From: Cris Di Sclafani Date: Fri, 12 Mar 2021 15:00:39 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.1 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=3e44e20b4a9ee2e903924a6b0e8f379128e80e3e;p=motion2.git Built motion from commit (unavailable).|2.5.1 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index fa8b03d..b30fc0f 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-12T14:38:38.173Z", "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-12T14:53:02.009Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 54e1529..d1199a6 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-12T14:38:38.173Z", "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-12T14:53:02.009Z", "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 0bb7689..f05adc6 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 _0xff86=['exports','INTEGER','sequelize'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xff86,0x173));var _0x6ff8=function(_0xb9f4ed,_0x41afa0){_0xb9f4ed=_0xb9f4ed-0x0;var _0x30fbbf=_0xff86[_0xb9f4ed];return _0x30fbbf;};'use strict';var Sequelize=require(_0x6ff8('0x0'));module[_0x6ff8('0x1')]={'ChatInteractionId':{'type':Sequelize[_0x6ff8('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0x7bc4=['INTEGER','sequelize','exports'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x7bc4,0xd9));var _0x47bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7bc4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x47bc('0x0'));module[_0x47bc('0x1')]={'ChatInteractionId':{'type':Sequelize[_0x47bc('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x47bc('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.controller.js b/server/api/UserChatInteraction/UserChatInteraction.controller.js index 5b4b6cd..da8a2d5 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 _0x6629=['sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserChatInteractions','end','error','stack','name','send','map','UserChatInteraction','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','includeAll','include','rows','catch','show','params','length','options','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x28192e,_0x579b24){var _0x3f6c9c=function(_0x725af8){while(--_0x725af8){_0x28192e['push'](_0x28192e['shift']());}};_0x3f6c9c(++_0x579b24);}(_0x6629,0x1c2));var _0x9662=function(_0x2b110a,_0x42b678){_0x2b110a=_0x2b110a-0x0;var _0x7e5707=_0x6629[_0x2b110a];return _0x7e5707;};'use strict';var pdf=require(_0x9662('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9662('0x1'));var jsonpatch=require(_0x9662('0x2'));var rp=require(_0x9662('0x3'));var moment=require(_0x9662('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9662('0x5'));var util=require(_0x9662('0x6'));var path=require(_0x9662('0x7'));var sox=require('sox');var csv=require(_0x9662('0x8'));var ejs=require(_0x9662('0x9'));var fs=require('fs');var _=require(_0x9662('0xa'));var squel=require('squel');var crypto=require(_0x9662('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9662('0xc'));var toCsv=require(_0x9662('0x8'));var querystring=require(_0x9662('0xd'));var Papa=require(_0x9662('0xe'));var Redis=require(_0x9662('0xf'));var authService=require(_0x9662('0x10'));var qs=require(_0x9662('0x11'));var as=require(_0x9662('0x12'));var hardwareService=require(_0x9662('0x13'));var logger=require(_0x9662('0x14'))(_0x9662('0x15'));var utils=require('../../config/utils');var config=require(_0x9662('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9662('0x17'))['db'];function respondWithStatusCode(_0x8db665,_0x5d55bd){_0x5d55bd=_0x5d55bd||0xcc;return function(_0x317f88){if(_0x317f88){return _0x8db665[_0x9662('0x18')](_0x5d55bd);}return _0x8db665[_0x9662('0x19')](_0x5d55bd)['end']();};}function respondWithResult(_0x533fc4,_0x2186fc){_0x2186fc=_0x2186fc||0xc8;return function(_0x54b966){if(_0x54b966){return _0x533fc4[_0x9662('0x19')](_0x2186fc)[_0x9662('0x1a')](_0x54b966);}};}function respondWithFilteredResult(_0x25c17c,_0x5a55c5){return function(_0x4d608d){if(_0x4d608d){var _0x531ec5=_0x4d608d[_0x9662('0x1b')],_0x1a6606=_0x5a55c5[_0x9662('0x1c')],_0xd555b6=_0x5a55c5[_0x9662('0x1c')]+_0x5a55c5[_0x9662('0x1d')],_0x4930c5;if(_0xd555b6>=_0x531ec5){_0xd555b6=_0x531ec5;_0x4930c5=0xc8;}else{_0x4930c5=0xce;}_0x25c17c[_0x9662('0x19')](_0x4930c5);return _0x25c17c[_0x9662('0x1e')]('Content-Range',_0x1a6606+'-'+_0xd555b6+'/'+_0x531ec5)[_0x9662('0x1a')](_0x4d608d);}return null;};}function patchUpdates(_0x2dce5d){return function(_0x4e69af){try{jsonpatch[_0x9662('0x1f')](_0x4e69af,_0x2dce5d,!![]);}catch(_0xef0462){return BPromise[_0x9662('0x20')](_0xef0462);}return _0x4e69af[_0x9662('0x21')]();};}function saveUpdates(_0x2e16cf,_0x2ef848){return function(_0x23ca68){if(_0x23ca68){return _0x23ca68[_0x9662('0x22')](_0x2e16cf)[_0x9662('0x23')](function(_0xf2005a){return _0xf2005a;});}return null;};}function removeEntity(_0x5e4083,_0x521094){return function(_0x3178c1){if(_0x3178c1){return _0x3178c1[_0x9662('0x24')]()[_0x9662('0x23')](function(){var _0x12170b=_0x3178c1[_0x9662('0x25')]({'plain':!![]});var _0x3d8d97=_0x9662('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x3d8d97,'resourceId':_0x12170b['id']}})[_0x9662('0x23')](function(){return _0x3178c1;});})[_0x9662('0x23')](function(){_0x5e4083[_0x9662('0x19')](0xcc)[_0x9662('0x27')]();});}};}function handleEntityNotFound(_0x5a16cd,_0x2beb50){return function(_0x2f4d28){if(!_0x2f4d28){_0x5a16cd[_0x9662('0x18')](0x194);}return _0x2f4d28;};}function handleError(_0x3c69ab,_0x3e1af2){_0x3e1af2=_0x3e1af2||0x1f4;return function(_0x402896){logger[_0x9662('0x28')](_0x402896[_0x9662('0x29')]);if(_0x402896['name']){delete _0x402896[_0x9662('0x2a')];}_0x3c69ab[_0x9662('0x19')](_0x3e1af2)[_0x9662('0x2b')](_0x402896);};}exports['index']=function(_0x4f59c7,_0x4f18a9){var _0x56e731={},_0x54a8b4={},_0x481bb5={'count':0x0,'rows':[]};var _0x8a6cad=_[_0x9662('0x2c')](db[_0x9662('0x2d')][_0x9662('0x2e')],function(_0x4ae219){return{'name':_0x4ae219['fieldName'],'type':_0x4ae219[_0x9662('0x2f')]['key']};});_0x54a8b4[_0x9662('0x30')]=_[_0x9662('0x2c')](_0x8a6cad,_0x9662('0x2a'));_0x54a8b4[_0x9662('0x31')]=_[_0x9662('0x32')](_0x4f59c7['query']);_0x54a8b4[_0x9662('0x33')]=_[_0x9662('0x34')](_0x54a8b4[_0x9662('0x30')],_0x54a8b4[_0x9662('0x31')]);_0x56e731[_0x9662('0x35')]=_['intersection'](_0x54a8b4[_0x9662('0x30')],qs['fields'](_0x4f59c7[_0x9662('0x31')][_0x9662('0x36')]));_0x56e731[_0x9662('0x35')]=_0x56e731['attributes']['length']?_0x56e731['attributes']:_0x54a8b4[_0x9662('0x30')];if(!_0x4f59c7[_0x9662('0x31')][_0x9662('0x37')]('nolimit')){_0x56e731[_0x9662('0x1d')]=qs[_0x9662('0x1d')](_0x4f59c7['query'][_0x9662('0x1d')]);_0x56e731[_0x9662('0x1c')]=qs[_0x9662('0x1c')](_0x4f59c7[_0x9662('0x31')]['offset']);}_0x56e731['order']=qs[_0x9662('0x38')](_0x4f59c7[_0x9662('0x31')][_0x9662('0x38')]);_0x56e731['where']=qs[_0x9662('0x33')](_[_0x9662('0x39')](_0x4f59c7[_0x9662('0x31')],_0x54a8b4[_0x9662('0x33')]),_0x8a6cad);if(_0x4f59c7[_0x9662('0x31')][_0x9662('0x3a')]){_0x56e731[_0x9662('0x3b')]=_['merge'](_0x56e731['where'],{'$or':_['map'](_0x8a6cad,function(_0x41fbcc){if(_0x41fbcc['type']!=='VIRTUAL'){var _0x232d7e={};_0x232d7e[_0x41fbcc[_0x9662('0x2a')]]={'$like':'%'+_0x4f59c7['query'][_0x9662('0x3a')]+'%'};return _0x232d7e;}})});}_0x56e731=_[_0x9662('0x3c')]({},_0x56e731,_0x4f59c7['options']);var _0x49ab25={'where':_0x56e731[_0x9662('0x3b')]};return db[_0x9662('0x2d')][_0x9662('0x1b')](_0x49ab25)[_0x9662('0x23')](function(_0x127fed){_0x481bb5['count']=_0x127fed;if(_0x4f59c7['query'][_0x9662('0x3d')]){_0x56e731[_0x9662('0x3e')]=[{'all':!![]}];}return db[_0x9662('0x2d')]['findAll'](_0x56e731);})[_0x9662('0x23')](function(_0x2f01b4){_0x481bb5[_0x9662('0x3f')]=_0x2f01b4;return _0x481bb5;})[_0x9662('0x23')](respondWithFilteredResult(_0x4f18a9,_0x56e731))[_0x9662('0x40')](handleError(_0x4f18a9,null));};exports[_0x9662('0x41')]=function(_0xe6a507,_0x31850c){var _0x47b895={'raw':!![],'where':{'id':_0xe6a507[_0x9662('0x42')]['id']}},_0x5b00b2={};_0x5b00b2[_0x9662('0x30')]=_[_0x9662('0x32')](db[_0x9662('0x2d')][_0x9662('0x2e')]);_0x5b00b2[_0x9662('0x31')]=_[_0x9662('0x32')](_0xe6a507[_0x9662('0x31')]);_0x5b00b2[_0x9662('0x33')]=_[_0x9662('0x34')](_0x5b00b2['model'],_0x5b00b2['query']);_0x47b895['attributes']=_[_0x9662('0x34')](_0x5b00b2['model'],qs[_0x9662('0x36')](_0xe6a507[_0x9662('0x31')][_0x9662('0x36')]));_0x47b895[_0x9662('0x35')]=_0x47b895[_0x9662('0x35')][_0x9662('0x43')]?_0x47b895['attributes']:_0x5b00b2['model'];if(_0xe6a507[_0x9662('0x31')][_0x9662('0x3d')]){_0x47b895[_0x9662('0x3e')]=[{'all':!![]}];}_0x47b895=_[_0x9662('0x3c')]({},_0x47b895,_0xe6a507[_0x9662('0x44')]);return db[_0x9662('0x2d')]['find'](_0x47b895)[_0x9662('0x23')](handleEntityNotFound(_0x31850c,null))[_0x9662('0x23')](respondWithResult(_0x31850c,null))[_0x9662('0x40')](handleError(_0x31850c,null));};exports['create']=function(_0x2a6f55,_0x5b85d0){return db['UserChatInteraction'][_0x9662('0x45')](_0x2a6f55['body'],{})[_0x9662('0x23')](function(_0x4440e5){var _0x228744=_0x2a6f55[_0x9662('0x46')][_0x9662('0x25')]({'plain':!![]});if(!_0x228744)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x228744[_0x9662('0x47')]===_0x9662('0x46')){var _0x247a41=_0x4440e5[_0x9662('0x25')]({'plain':!![]});var _0xe83f20=_0x9662('0x26');return db[_0x9662('0x48')][_0x9662('0x49')]({'where':{'name':_0xe83f20,'userProfileId':_0x228744[_0x9662('0x4a')]},'raw':!![]})[_0x9662('0x23')](function(_0x1bc310){if(_0x1bc310&&_0x1bc310[_0x9662('0x4b')]===0x0){return db[_0x9662('0x4c')][_0x9662('0x45')]({'name':_0x247a41[_0x9662('0x2a')],'resourceId':_0x247a41['id'],'type':_0x1bc310[_0x9662('0x2a')],'sectionId':_0x1bc310['id']},{})[_0x9662('0x23')](function(){return _0x4440e5;});}else{return _0x4440e5;}})['catch'](function(_0x319c10){logger['error'](_0x9662('0x4d'),_0x319c10);throw _0x319c10;});}return _0x4440e5;})['then'](respondWithResult(_0x5b85d0,0xc9))[_0x9662('0x40')](handleError(_0x5b85d0,null));};exports[_0x9662('0x22')]=function(_0x5ea3fd,_0x371037){if(_0x5ea3fd[_0x9662('0x4e')]['id']){delete _0x5ea3fd['body']['id'];}return db['UserChatInteraction']['find']({'where':{'id':_0x5ea3fd[_0x9662('0x42')]['id']}})['then'](handleEntityNotFound(_0x371037,null))[_0x9662('0x23')](saveUpdates(_0x5ea3fd[_0x9662('0x4e')],null))[_0x9662('0x23')](respondWithResult(_0x371037,null))[_0x9662('0x40')](handleError(_0x371037,null));};exports[_0x9662('0x24')]=function(_0x679e56,_0x3dfabc){return db[_0x9662('0x2d')][_0x9662('0x49')]({'where':{'id':_0x679e56[_0x9662('0x42')]['id']}})['then'](handleEntityNotFound(_0x3dfabc,null))[_0x9662('0x23')](removeEntity(_0x3dfabc,null))[_0x9662('0x40')](handleError(_0x3dfabc,null));}; \ No newline at end of file +var _0x0c19=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','UserProfileResource','error','stack','name','send','index','map','UserChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','options','includeAll','include','findAll','catch','show','keys','find','create','body','user','get','role','UserChatInteractions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf'];(function(_0x412572,_0x37e9e2){var _0x20881f=function(_0x58e4d2){while(--_0x58e4d2){_0x412572['push'](_0x412572['shift']());}};_0x20881f(++_0x37e9e2);}(_0x0c19,0xf5));var _0x90c1=function(_0x353774,_0x467ba5){_0x353774=_0x353774-0x0;var _0x3c97cf=_0x0c19[_0x353774];return _0x3c97cf;};'use strict';var pdf=require(_0x90c1('0x0'));var emlformat=require(_0x90c1('0x1'));var rimraf=require(_0x90c1('0x2'));var zipdir=require(_0x90c1('0x3'));var jsonpatch=require(_0x90c1('0x4'));var rp=require(_0x90c1('0x5'));var moment=require('moment');var BPromise=require(_0x90c1('0x6'));var Mustache=require(_0x90c1('0x7'));var util=require(_0x90c1('0x8'));var path=require('path');var sox=require(_0x90c1('0x9'));var csv=require(_0x90c1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x90c1('0xb'));var squel=require(_0x90c1('0xc'));var crypto=require(_0x90c1('0xd'));var jsforce=require(_0x90c1('0xe'));var deskjs=require(_0x90c1('0xf'));var toCsv=require(_0x90c1('0xa'));var querystring=require(_0x90c1('0x10'));var Papa=require('papaparse');var Redis=require(_0x90c1('0x11'));var authService=require(_0x90c1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x90c1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x90c1('0x14'));var utils=require('../../config/utils');var config=require(_0x90c1('0x15'));var licenseUtil=require(_0x90c1('0x16'));var db=require(_0x90c1('0x17'))['db'];function respondWithStatusCode(_0x2d9964,_0x4aa112){_0x4aa112=_0x4aa112||0xcc;return function(_0x59a0ca){if(_0x59a0ca){return _0x2d9964[_0x90c1('0x18')](_0x4aa112);}return _0x2d9964[_0x90c1('0x19')](_0x4aa112)[_0x90c1('0x1a')]();};}function respondWithResult(_0x3a8b82,_0x52a659){_0x52a659=_0x52a659||0xc8;return function(_0xaaab35){if(_0xaaab35){return _0x3a8b82[_0x90c1('0x19')](_0x52a659)[_0x90c1('0x1b')](_0xaaab35);}};}function respondWithFilteredResult(_0x139c67,_0x38fcea){return function(_0x1cfb86){if(_0x1cfb86){var _0x4f77bf=_0x1cfb86[_0x90c1('0x1c')],_0x39dc3c=_0x38fcea[_0x90c1('0x1d')],_0x387b94=_0x38fcea[_0x90c1('0x1d')]+_0x38fcea[_0x90c1('0x1e')],_0x45a64c;if(_0x387b94>=_0x4f77bf){_0x387b94=_0x4f77bf;_0x45a64c=0xc8;}else{_0x45a64c=0xce;}_0x139c67[_0x90c1('0x19')](_0x45a64c);return _0x139c67[_0x90c1('0x1f')](_0x90c1('0x20'),_0x39dc3c+'-'+_0x387b94+'/'+_0x4f77bf)[_0x90c1('0x1b')](_0x1cfb86);}return null;};}function patchUpdates(_0x5ddafe){return function(_0x302ca2){try{jsonpatch[_0x90c1('0x21')](_0x302ca2,_0x5ddafe,!![]);}catch(_0x37e21b){return BPromise[_0x90c1('0x22')](_0x37e21b);}return _0x302ca2[_0x90c1('0x23')]();};}function saveUpdates(_0x3c8cc6,_0x5a8358){return function(_0x412d9f){if(_0x412d9f){return _0x412d9f['update'](_0x3c8cc6)[_0x90c1('0x24')](function(_0x490182){return _0x490182;});}return null;};}function removeEntity(_0x4b0480,_0x18323c){return function(_0x512cd9){if(_0x512cd9){return _0x512cd9['destroy']()[_0x90c1('0x24')](function(){var _0x5f4c05=_0x512cd9['get']({'plain':!![]});var _0x36fe37='UserChatInteractions';return db[_0x90c1('0x25')]['destroy']({'where':{'type':_0x36fe37,'resourceId':_0x5f4c05['id']}})[_0x90c1('0x24')](function(){return _0x512cd9;});})[_0x90c1('0x24')](function(){_0x4b0480[_0x90c1('0x19')](0xcc)[_0x90c1('0x1a')]();});}};}function handleEntityNotFound(_0x174506,_0x3902c8){return function(_0x2a60fb){if(!_0x2a60fb){_0x174506['sendStatus'](0x194);}return _0x2a60fb;};}function handleError(_0x26ee39,_0x163939){_0x163939=_0x163939||0x1f4;return function(_0x18d8ab){logger[_0x90c1('0x26')](_0x18d8ab[_0x90c1('0x27')]);if(_0x18d8ab[_0x90c1('0x28')]){delete _0x18d8ab[_0x90c1('0x28')];}_0x26ee39[_0x90c1('0x19')](_0x163939)[_0x90c1('0x29')](_0x18d8ab);};}exports[_0x90c1('0x2a')]=function(_0x17b923,_0x2f85dc){var _0x46c65b={},_0x39f856={},_0x36ee47={'count':0x0,'rows':[]};var _0x4a5f29=_[_0x90c1('0x2b')](db[_0x90c1('0x2c')][_0x90c1('0x2d')],function(_0x5be73c){return{'name':_0x5be73c[_0x90c1('0x2e')],'type':_0x5be73c[_0x90c1('0x2f')][_0x90c1('0x30')]};});_0x39f856[_0x90c1('0x31')]=_[_0x90c1('0x2b')](_0x4a5f29,_0x90c1('0x28'));_0x39f856[_0x90c1('0x32')]=_['keys'](_0x17b923[_0x90c1('0x32')]);_0x39f856[_0x90c1('0x33')]=_[_0x90c1('0x34')](_0x39f856['model'],_0x39f856[_0x90c1('0x32')]);_0x46c65b[_0x90c1('0x35')]=_[_0x90c1('0x34')](_0x39f856[_0x90c1('0x31')],qs[_0x90c1('0x36')](_0x17b923[_0x90c1('0x32')][_0x90c1('0x36')]));_0x46c65b[_0x90c1('0x35')]=_0x46c65b[_0x90c1('0x35')][_0x90c1('0x37')]?_0x46c65b[_0x90c1('0x35')]:_0x39f856[_0x90c1('0x31')];if(!_0x17b923[_0x90c1('0x32')][_0x90c1('0x38')]('nolimit')){_0x46c65b[_0x90c1('0x1e')]=qs[_0x90c1('0x1e')](_0x17b923[_0x90c1('0x32')][_0x90c1('0x1e')]);_0x46c65b['offset']=qs['offset'](_0x17b923[_0x90c1('0x32')][_0x90c1('0x1d')]);}_0x46c65b[_0x90c1('0x39')]=qs[_0x90c1('0x3a')](_0x17b923['query']['sort']);_0x46c65b[_0x90c1('0x3b')]=qs[_0x90c1('0x33')](_[_0x90c1('0x3c')](_0x17b923[_0x90c1('0x32')],_0x39f856[_0x90c1('0x33')]),_0x4a5f29);if(_0x17b923['query']['filter']){_0x46c65b['where']=_[_0x90c1('0x3d')](_0x46c65b[_0x90c1('0x3b')],{'$or':_[_0x90c1('0x2b')](_0x4a5f29,function(_0x4e1dc5){if(_0x4e1dc5[_0x90c1('0x2f')]!=='VIRTUAL'){var _0x5cc23f={};_0x5cc23f[_0x4e1dc5[_0x90c1('0x28')]]={'$like':'%'+_0x17b923[_0x90c1('0x32')]['filter']+'%'};return _0x5cc23f;}})});}_0x46c65b=_[_0x90c1('0x3d')]({},_0x46c65b,_0x17b923[_0x90c1('0x3e')]);var _0x916ce1={'where':_0x46c65b[_0x90c1('0x3b')]};return db[_0x90c1('0x2c')][_0x90c1('0x1c')](_0x916ce1)['then'](function(_0x3fb4ed){_0x36ee47['count']=_0x3fb4ed;if(_0x17b923[_0x90c1('0x32')][_0x90c1('0x3f')]){_0x46c65b[_0x90c1('0x40')]=[{'all':!![]}];}return db[_0x90c1('0x2c')][_0x90c1('0x41')](_0x46c65b);})[_0x90c1('0x24')](function(_0x31c6a0){_0x36ee47['rows']=_0x31c6a0;return _0x36ee47;})['then'](respondWithFilteredResult(_0x2f85dc,_0x46c65b))[_0x90c1('0x42')](handleError(_0x2f85dc,null));};exports[_0x90c1('0x43')]=function(_0x1699a1,_0x4175d1){var _0x30545a={'raw':!![],'where':{'id':_0x1699a1['params']['id']}},_0x4ad106={};_0x4ad106[_0x90c1('0x31')]=_[_0x90c1('0x44')](db['UserChatInteraction'][_0x90c1('0x2d')]);_0x4ad106['query']=_['keys'](_0x1699a1[_0x90c1('0x32')]);_0x4ad106['filters']=_[_0x90c1('0x34')](_0x4ad106['model'],_0x4ad106['query']);_0x30545a[_0x90c1('0x35')]=_[_0x90c1('0x34')](_0x4ad106[_0x90c1('0x31')],qs[_0x90c1('0x36')](_0x1699a1['query'][_0x90c1('0x36')]));_0x30545a[_0x90c1('0x35')]=_0x30545a[_0x90c1('0x35')][_0x90c1('0x37')]?_0x30545a['attributes']:_0x4ad106[_0x90c1('0x31')];if(_0x1699a1[_0x90c1('0x32')]['includeAll']){_0x30545a[_0x90c1('0x40')]=[{'all':!![]}];}_0x30545a=_[_0x90c1('0x3d')]({},_0x30545a,_0x1699a1[_0x90c1('0x3e')]);return db[_0x90c1('0x2c')][_0x90c1('0x45')](_0x30545a)['then'](handleEntityNotFound(_0x4175d1,null))[_0x90c1('0x24')](respondWithResult(_0x4175d1,null))['catch'](handleError(_0x4175d1,null));};exports[_0x90c1('0x46')]=function(_0x4dfe8b,_0x44e29d){return db[_0x90c1('0x2c')][_0x90c1('0x46')](_0x4dfe8b[_0x90c1('0x47')],{})[_0x90c1('0x24')](function(_0x3aa812){var _0x1d00e4=_0x4dfe8b[_0x90c1('0x48')][_0x90c1('0x49')]({'plain':!![]});if(!_0x1d00e4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d00e4[_0x90c1('0x4a')]==='user'){var _0x2bb75a=_0x3aa812[_0x90c1('0x49')]({'plain':!![]});var _0x36addd=_0x90c1('0x4b');return db[_0x90c1('0x4c')][_0x90c1('0x45')]({'where':{'name':_0x36addd,'userProfileId':_0x1d00e4[_0x90c1('0x4d')]},'raw':!![]})[_0x90c1('0x24')](function(_0xa117d1){if(_0xa117d1&&_0xa117d1[_0x90c1('0x4e')]===0x0){return db[_0x90c1('0x25')]['create']({'name':_0x2bb75a[_0x90c1('0x28')],'resourceId':_0x2bb75a['id'],'type':_0xa117d1[_0x90c1('0x28')],'sectionId':_0xa117d1['id']},{})[_0x90c1('0x24')](function(){return _0x3aa812;});}else{return _0x3aa812;}})['catch'](function(_0x34a7b6){logger[_0x90c1('0x26')](_0x90c1('0x4f'),_0x34a7b6);throw _0x34a7b6;});}return _0x3aa812;})['then'](respondWithResult(_0x44e29d,0xc9))['catch'](handleError(_0x44e29d,null));};exports[_0x90c1('0x50')]=function(_0x1d5723,_0x5a4940){if(_0x1d5723[_0x90c1('0x47')]['id']){delete _0x1d5723['body']['id'];}return db['UserChatInteraction']['find']({'where':{'id':_0x1d5723[_0x90c1('0x51')]['id']}})['then'](handleEntityNotFound(_0x5a4940,null))[_0x90c1('0x24')](saveUpdates(_0x1d5723[_0x90c1('0x47')],null))[_0x90c1('0x24')](respondWithResult(_0x5a4940,null))[_0x90c1('0x42')](handleError(_0x5a4940,null));};exports['destroy']=function(_0x53d98f,_0x1f339f){return db[_0x90c1('0x2c')][_0x90c1('0x45')]({'where':{'id':_0x53d98f[_0x90c1('0x51')]['id']}})['then'](handleEntityNotFound(_0x1f339f,null))['then'](removeEntity(_0x1f339f,null))[_0x90c1('0x42')](handleError(_0x1f339f,null));}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.model.js b/server/api/UserChatInteraction/UserChatInteraction.model.js index 5a75d95..e5ba4d2 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 _0x6ca0=['util','moment','bluebird','request-promise','../../config/environment','exports','define','UserChatInteraction','user_has_chat_interactions','lodash'];(function(_0xe4936,_0x3cd5c0){var _0x254fee=function(_0x3a2b9f){while(--_0x3a2b9f){_0xe4936['push'](_0xe4936['shift']());}};_0x254fee(++_0x3cd5c0);}(_0x6ca0,0x9f));var _0x06ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ca0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x06ca('0x0'));var util=require(_0x06ca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x06ca('0x2'));var BPromise=require(_0x06ca('0x3'));var rp=require(_0x06ca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x06ca('0x5'));var attributes=require('./UserChatInteraction.attributes');module[_0x06ca('0x6')]=function(_0x495dca,_0x3a1d75){return _0x495dca[_0x06ca('0x7')](_0x06ca('0x8'),attributes,{'tableName':_0x06ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c04=['bluebird','request-promise','rimraf','../../config/environment','./UserChatInteraction.attributes','UserChatInteraction','user_has_chat_interactions','lodash','util','../../config/logger','api'];(function(_0x322e30,_0x2810c9){var _0x24f5fb=function(_0x5c33b7){while(--_0x5c33b7){_0x322e30['push'](_0x322e30['shift']());}};_0x24f5fb(++_0x2810c9);}(_0x0c04,0x80));var _0x40c0=function(_0x139d56,_0x5b6cba){_0x139d56=_0x139d56-0x0;var _0x5619cf=_0x0c04[_0x139d56];return _0x5619cf;};'use strict';var _=require(_0x40c0('0x0'));var util=require(_0x40c0('0x1'));var logger=require(_0x40c0('0x2'))(_0x40c0('0x3'));var moment=require('moment');var BPromise=require(_0x40c0('0x4'));var rp=require(_0x40c0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x40c0('0x6'));var config=require(_0x40c0('0x7'));var attributes=require(_0x40c0('0x8'));module['exports']=function(_0x52b8ed,_0x3ecb8e){return _0x52b8ed['define'](_0x40c0('0x9'),attributes,{'tableName':_0x40c0('0xa'),'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 ddba7f9..ed8a4f6 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 _0xd774=['jayson/promise','client','http','info','UserChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','randomstring','../../mysqldb','rpc','../../config/environment'];(function(_0x3c2bf2,_0x483e7f){var _0x25a0ac=function(_0x47d56c){while(--_0x47d56c){_0x3c2bf2['push'](_0x3c2bf2['shift']());}};_0x25a0ac(++_0x483e7f);}(_0xd774,0xe5));var _0x4d77=function(_0x4bffac,_0x586170){_0x4bffac=_0x4bffac-0x0;var _0x1d8504=_0xd774[_0x4bffac];return _0x1d8504;};'use strict';var _=require(_0x4d77('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d77('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d77('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4d77('0x3'));var config=require(_0x4d77('0x4'));var jayson=require(_0x4d77('0x5'));var client=jayson[_0x4d77('0x6')][_0x4d77('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f5ef7,_0x629bea,_0x1a360f){return new BPromise(function(_0x44a0c3,_0x4c28f1){return client['request'](_0x4f5ef7,_0x1a360f)['then'](function(_0xe78088){logger[_0x4d77('0x8')](_0x4d77('0x9'),_0x629bea,_0x4d77('0xa'));logger[_0x4d77('0xb')]('UserChatInteraction,\x20%s,\x20%s,\x20%s',_0x629bea,_0x4d77('0xa'),JSON[_0x4d77('0xc')](_0xe78088));if(_0xe78088['error']){if(_0xe78088['error'][_0x4d77('0xd')]===0x1f4){logger['error']('UserChatInteraction,\x20%s,\x20%s',_0x629bea,_0xe78088[_0x4d77('0xe')][_0x4d77('0xf')]);return _0x4c28f1(_0xe78088[_0x4d77('0xe')][_0x4d77('0xf')]);}logger[_0x4d77('0xe')](_0x4d77('0x9'),_0x629bea,_0xe78088['error'][_0x4d77('0xf')]);return _0x44a0c3(_0xe78088[_0x4d77('0xe')][_0x4d77('0xf')]);}else{logger[_0x4d77('0x8')](_0x4d77('0x9'),_0x629bea,_0x4d77('0xa'));_0x44a0c3(_0xe78088[_0x4d77('0x10')]['message']);}})[_0x4d77('0x11')](function(_0x5a1277){logger[_0x4d77('0xe')](_0x4d77('0x9'),_0x629bea,_0x5a1277);_0x4c28f1(_0x5a1277);});});} \ No newline at end of file +var _0xaeda=['debug','UserChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','UserChatInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0xaeda,0x13a));var _0xaaed=function(_0x3aa8a2,_0x5bc3a9){_0x3aa8a2=_0x3aa8a2-0x0;var _0x1ce8fe=_0xaeda[_0x3aa8a2];return _0x1ce8fe;};'use strict';var _=require(_0xaaed('0x0'));var util=require(_0xaaed('0x1'));var moment=require('moment');var BPromise=require(_0xaaed('0x2'));var rs=require(_0xaaed('0x3'));var fs=require('fs');var Redis=require(_0xaaed('0x4'));var db=require(_0xaaed('0x5'))['db'];var utils=require(_0xaaed('0x6'));var logger=require(_0xaaed('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaaed('0x8'));var client=jayson[_0xaaed('0x9')][_0xaaed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcfcec3,_0x551bf6,_0x39b33e){return new BPromise(function(_0x5729a6,_0x20d151){return client[_0xaaed('0xb')](_0xcfcec3,_0x39b33e)[_0xaaed('0xc')](function(_0x3f08d1){logger[_0xaaed('0xd')](_0xaaed('0xe'),_0x551bf6,_0xaaed('0xf'));logger[_0xaaed('0x10')](_0xaaed('0x11'),_0x551bf6,'request\x20sent',JSON[_0xaaed('0x12')](_0x3f08d1));if(_0x3f08d1[_0xaaed('0x13')]){if(_0x3f08d1['error'][_0xaaed('0x14')]===0x1f4){logger[_0xaaed('0x13')]('UserChatInteraction,\x20%s,\x20%s',_0x551bf6,_0x3f08d1[_0xaaed('0x13')][_0xaaed('0x15')]);return _0x20d151(_0x3f08d1[_0xaaed('0x13')][_0xaaed('0x15')]);}logger[_0xaaed('0x13')]('UserChatInteraction,\x20%s,\x20%s',_0x551bf6,_0x3f08d1[_0xaaed('0x13')][_0xaaed('0x15')]);return _0x5729a6(_0x3f08d1['error'][_0xaaed('0x15')]);}else{logger[_0xaaed('0xd')](_0xaaed('0xe'),_0x551bf6,_0xaaed('0xf'));_0x5729a6(_0x3f08d1['result'][_0xaaed('0x15')]);}})['catch'](function(_0x5a537d){logger[_0xaaed('0x13')]('UserChatInteraction,\x20%s,\x20%s',_0x551bf6,_0x5a537d);_0x20d151(_0x5a537d);});});} \ No newline at end of file diff --git a/server/api/UserChatInteraction/index.js b/server/api/UserChatInteraction/index.js index e17e9fd..067c7b9 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 _0xbaa4=['../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated','create','put','update','delete','/:id','destroy','exports','util','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbaa4,0x68));var _0x4baa=function(_0xe8c3f8,_0x4499a3){_0xe8c3f8=_0xe8c3f8-0x0;var _0x13d6ac=_0xbaa4[_0xe8c3f8];return _0x13d6ac;};'use strict';var multer=require('multer');var util=require(_0x4baa('0x0'));var path=require(_0x4baa('0x1'));var timeout=require('connect-timeout');var express=require(_0x4baa('0x2'));var router=express[_0x4baa('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4baa('0x4'));var config=require(_0x4baa('0x5'));var controller=require('./UserChatInteraction.controller');router[_0x4baa('0x6')]('/',auth['isAuthenticated'](),controller[_0x4baa('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4baa('0x8')]);router[_0x4baa('0x9')]('/',auth[_0x4baa('0xa')](),controller[_0x4baa('0xb')]);router[_0x4baa('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x4baa('0xd')]);router[_0x4baa('0xe')](_0x4baa('0xf'),auth[_0x4baa('0xa')](),controller[_0x4baa('0x10')]);module[_0x4baa('0x11')]=router; \ No newline at end of file +var _0xbc06=['get','isAuthenticated','/:id','show','post','create','update','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x41bc4f,_0x2bf526){var _0x5d9016=function(_0x5bc8dc){while(--_0x5bc8dc){_0x41bc4f['push'](_0x41bc4f['shift']());}};_0x5d9016(++_0x2bf526);}(_0xbc06,0xae));var _0x6bc0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc06[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6bc0('0x0'));var timeout=require(_0x6bc0('0x1'));var express=require(_0x6bc0('0x2'));var router=express[_0x6bc0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6bc0('0x4'));var config=require(_0x6bc0('0x5'));var controller=require('./UserChatInteraction.controller');router[_0x6bc0('0x6')]('/',auth[_0x6bc0('0x7')](),controller['index']);router[_0x6bc0('0x6')](_0x6bc0('0x8'),auth[_0x6bc0('0x7')](),controller[_0x6bc0('0x9')]);router[_0x6bc0('0xa')]('/',auth[_0x6bc0('0x7')](),controller[_0x6bc0('0xb')]);router['put'](_0x6bc0('0x8'),auth[_0x6bc0('0x7')](),controller[_0x6bc0('0xc')]);router[_0x6bc0('0xd')](_0x6bc0('0x8'),auth['isAuthenticated'](),controller[_0x6bc0('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js index 7aa2156..ffb5f4e 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 _0xcfd0=['INTEGER','exports'];(function(_0x56646e,_0x4556d5){var _0x5b37c6=function(_0x38e757){while(--_0x38e757){_0x56646e['push'](_0x56646e['shift']());}};_0x5b37c6(++_0x4556d5);}(_0xcfd0,0x1a5));var _0x0cfd=function(_0x360e5b,_0x366396){_0x360e5b=_0x360e5b-0x0;var _0x403393=_0xcfd0[_0x360e5b];return _0x403393;};'use strict';var Sequelize=require('sequelize');module[_0x0cfd('0x0')]={'FaxInteractionId':{'type':Sequelize[_0x0cfd('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x0cfd('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0xd06a=['exports','INTEGER'];(function(_0x2355d1,_0x1d3a83){var _0x5da689=function(_0x4bcd96){while(--_0x4bcd96){_0x2355d1['push'](_0x2355d1['shift']());}};_0x5da689(++_0x1d3a83);}(_0xd06a,0xd6));var _0xad06=function(_0x36f2f6,_0x102e0f){_0x36f2f6=_0x36f2f6-0x0;var _0x2ebf71=_0xd06a[_0x36f2f6];return _0x2ebf71;};'use strict';var Sequelize=require('sequelize');module[_0xad06('0x0')]={'FaxInteractionId':{'type':Sequelize[_0xad06('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xad06('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 9e57ddf..467a814 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 _0x5b4d=['index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','UserFaxInteraction','findAll','show','params','keys','length','include','find','catch','create','user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','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','status','end','json','count','limit','set','Content-Range','apply','save','then','UserFaxInteractions','UserProfileResource','destroy','sendStatus','error','name'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x5b4d,0x175));var _0xd5b4=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5b4d[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0xd5b4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd5b4('0x1'));var zipdir=require(_0xd5b4('0x2'));var jsonpatch=require(_0xd5b4('0x3'));var rp=require('request-promise');var moment=require(_0xd5b4('0x4'));var BPromise=require(_0xd5b4('0x5'));var Mustache=require(_0xd5b4('0x6'));var util=require(_0xd5b4('0x7'));var path=require(_0xd5b4('0x8'));var sox=require(_0xd5b4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd5b4('0xa'));var squel=require(_0xd5b4('0xb'));var crypto=require('crypto');var jsforce=require(_0xd5b4('0xc'));var deskjs=require(_0xd5b4('0xd'));var toCsv=require(_0xd5b4('0xe'));var querystring=require(_0xd5b4('0xf'));var Papa=require('papaparse');var Redis=require(_0xd5b4('0x10'));var authService=require(_0xd5b4('0x11'));var qs=require(_0xd5b4('0x12'));var as=require(_0xd5b4('0x13'));var hardwareService=require(_0xd5b4('0x14'));var logger=require(_0xd5b4('0x15'))(_0xd5b4('0x16'));var utils=require(_0xd5b4('0x17'));var config=require(_0xd5b4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd5b4('0x19'))['db'];function respondWithStatusCode(_0x1f47ab,_0x1d97d1){_0x1d97d1=_0x1d97d1||0xcc;return function(_0xe33151){if(_0xe33151){return _0x1f47ab['sendStatus'](_0x1d97d1);}return _0x1f47ab[_0xd5b4('0x1a')](_0x1d97d1)[_0xd5b4('0x1b')]();};}function respondWithResult(_0x2ece15,_0x4e4ef0){_0x4e4ef0=_0x4e4ef0||0xc8;return function(_0x3206f0){if(_0x3206f0){return _0x2ece15['status'](_0x4e4ef0)[_0xd5b4('0x1c')](_0x3206f0);}};}function respondWithFilteredResult(_0x2c7a37,_0x29d67e){return function(_0x125b8b){if(_0x125b8b){var _0x3a8f47=_0x125b8b[_0xd5b4('0x1d')],_0x1e746a=_0x29d67e['offset'],_0x4c9119=_0x29d67e['offset']+_0x29d67e[_0xd5b4('0x1e')],_0x13243c;if(_0x4c9119>=_0x3a8f47){_0x4c9119=_0x3a8f47;_0x13243c=0xc8;}else{_0x13243c=0xce;}_0x2c7a37[_0xd5b4('0x1a')](_0x13243c);return _0x2c7a37[_0xd5b4('0x1f')](_0xd5b4('0x20'),_0x1e746a+'-'+_0x4c9119+'/'+_0x3a8f47)[_0xd5b4('0x1c')](_0x125b8b);}return null;};}function patchUpdates(_0x24b8b0){return function(_0x32f20a){try{jsonpatch[_0xd5b4('0x21')](_0x32f20a,_0x24b8b0,!![]);}catch(_0x54b69d){return BPromise['reject'](_0x54b69d);}return _0x32f20a[_0xd5b4('0x22')]();};}function saveUpdates(_0xef41cb,_0x1ecc52){return function(_0xa3d5ef){if(_0xa3d5ef){return _0xa3d5ef['update'](_0xef41cb)[_0xd5b4('0x23')](function(_0x4c92cc){return _0x4c92cc;});}return null;};}function removeEntity(_0x46d778,_0x36e1f7){return function(_0x1bc942){if(_0x1bc942){return _0x1bc942['destroy']()[_0xd5b4('0x23')](function(){var _0x2253bb=_0x1bc942['get']({'plain':!![]});var _0x4773d5=_0xd5b4('0x24');return db[_0xd5b4('0x25')][_0xd5b4('0x26')]({'where':{'type':_0x4773d5,'resourceId':_0x2253bb['id']}})[_0xd5b4('0x23')](function(){return _0x1bc942;});})['then'](function(){_0x46d778[_0xd5b4('0x1a')](0xcc)[_0xd5b4('0x1b')]();});}};}function handleEntityNotFound(_0x327dd3,_0x10953c){return function(_0x36b341){if(!_0x36b341){_0x327dd3[_0xd5b4('0x27')](0x194);}return _0x36b341;};}function handleError(_0x2baf88,_0x3f626c){_0x3f626c=_0x3f626c||0x1f4;return function(_0x3e7869){logger[_0xd5b4('0x28')](_0x3e7869['stack']);if(_0x3e7869['name']){delete _0x3e7869[_0xd5b4('0x29')];}_0x2baf88[_0xd5b4('0x1a')](_0x3f626c)['send'](_0x3e7869);};}exports[_0xd5b4('0x2a')]=function(_0x1a8d2a,_0x51bcf2){var _0x3d2ce0={},_0x376c93={},_0x1d4201={'count':0x0,'rows':[]};var _0x40b438=_[_0xd5b4('0x2b')](db['UserFaxInteraction'][_0xd5b4('0x2c')],function(_0x3ad94e){return{'name':_0x3ad94e['fieldName'],'type':_0x3ad94e[_0xd5b4('0x2d')][_0xd5b4('0x2e')]};});_0x376c93[_0xd5b4('0x2f')]=_[_0xd5b4('0x2b')](_0x40b438,'name');_0x376c93[_0xd5b4('0x30')]=_['keys'](_0x1a8d2a[_0xd5b4('0x30')]);_0x376c93[_0xd5b4('0x31')]=_[_0xd5b4('0x32')](_0x376c93[_0xd5b4('0x2f')],_0x376c93[_0xd5b4('0x30')]);_0x3d2ce0[_0xd5b4('0x33')]=_[_0xd5b4('0x32')](_0x376c93[_0xd5b4('0x2f')],qs[_0xd5b4('0x34')](_0x1a8d2a[_0xd5b4('0x30')][_0xd5b4('0x34')]));_0x3d2ce0[_0xd5b4('0x33')]=_0x3d2ce0[_0xd5b4('0x33')]['length']?_0x3d2ce0[_0xd5b4('0x33')]:_0x376c93['model'];if(!_0x1a8d2a[_0xd5b4('0x30')][_0xd5b4('0x35')](_0xd5b4('0x36'))){_0x3d2ce0['limit']=qs[_0xd5b4('0x1e')](_0x1a8d2a[_0xd5b4('0x30')][_0xd5b4('0x1e')]);_0x3d2ce0[_0xd5b4('0x37')]=qs[_0xd5b4('0x37')](_0x1a8d2a[_0xd5b4('0x30')]['offset']);}_0x3d2ce0[_0xd5b4('0x38')]=qs['sort'](_0x1a8d2a[_0xd5b4('0x30')][_0xd5b4('0x39')]);_0x3d2ce0[_0xd5b4('0x3a')]=qs[_0xd5b4('0x31')](_[_0xd5b4('0x3b')](_0x1a8d2a['query'],_0x376c93['filters']),_0x40b438);if(_0x1a8d2a['query'][_0xd5b4('0x3c')]){_0x3d2ce0['where']=_['merge'](_0x3d2ce0[_0xd5b4('0x3a')],{'$or':_[_0xd5b4('0x2b')](_0x40b438,function(_0x2839c5){if(_0x2839c5[_0xd5b4('0x2d')]!==_0xd5b4('0x3d')){var _0x8cd422={};_0x8cd422[_0x2839c5[_0xd5b4('0x29')]]={'$like':'%'+_0x1a8d2a['query'][_0xd5b4('0x3c')]+'%'};return _0x8cd422;}})});}_0x3d2ce0=_[_0xd5b4('0x3e')]({},_0x3d2ce0,_0x1a8d2a[_0xd5b4('0x3f')]);var _0x4a44a4={'where':_0x3d2ce0[_0xd5b4('0x3a')]};return db['UserFaxInteraction'][_0xd5b4('0x1d')](_0x4a44a4)[_0xd5b4('0x23')](function(_0x1a52b3){_0x1d4201[_0xd5b4('0x1d')]=_0x1a52b3;if(_0x1a8d2a[_0xd5b4('0x30')][_0xd5b4('0x40')]){_0x3d2ce0['include']=[{'all':!![]}];}return db[_0xd5b4('0x41')][_0xd5b4('0x42')](_0x3d2ce0);})[_0xd5b4('0x23')](function(_0x200738){_0x1d4201['rows']=_0x200738;return _0x1d4201;})[_0xd5b4('0x23')](respondWithFilteredResult(_0x51bcf2,_0x3d2ce0))['catch'](handleError(_0x51bcf2,null));};exports[_0xd5b4('0x43')]=function(_0x5dce4a,_0x1ae9ae){var _0x2fad66={'raw':!![],'where':{'id':_0x5dce4a[_0xd5b4('0x44')]['id']}},_0x3505de={};_0x3505de[_0xd5b4('0x2f')]=_[_0xd5b4('0x45')](db[_0xd5b4('0x41')][_0xd5b4('0x2c')]);_0x3505de[_0xd5b4('0x30')]=_[_0xd5b4('0x45')](_0x5dce4a['query']);_0x3505de[_0xd5b4('0x31')]=_[_0xd5b4('0x32')](_0x3505de[_0xd5b4('0x2f')],_0x3505de[_0xd5b4('0x30')]);_0x2fad66[_0xd5b4('0x33')]=_['intersection'](_0x3505de['model'],qs[_0xd5b4('0x34')](_0x5dce4a[_0xd5b4('0x30')][_0xd5b4('0x34')]));_0x2fad66[_0xd5b4('0x33')]=_0x2fad66['attributes'][_0xd5b4('0x46')]?_0x2fad66[_0xd5b4('0x33')]:_0x3505de['model'];if(_0x5dce4a[_0xd5b4('0x30')]['includeAll']){_0x2fad66[_0xd5b4('0x47')]=[{'all':!![]}];}_0x2fad66=_['merge']({},_0x2fad66,_0x5dce4a[_0xd5b4('0x3f')]);return db[_0xd5b4('0x41')][_0xd5b4('0x48')](_0x2fad66)[_0xd5b4('0x23')](handleEntityNotFound(_0x1ae9ae,null))[_0xd5b4('0x23')](respondWithResult(_0x1ae9ae,null))[_0xd5b4('0x49')](handleError(_0x1ae9ae,null));};exports[_0xd5b4('0x4a')]=function(_0xb383ce,_0x508545){return db['UserFaxInteraction'][_0xd5b4('0x4a')](_0xb383ce['body'],{})['then'](function(_0x152e93){var _0x2e29d4=_0xb383ce[_0xd5b4('0x4b')]['get']({'plain':!![]});if(!_0x2e29d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e29d4[_0xd5b4('0x4c')]===_0xd5b4('0x4b')){var _0x100406=_0x152e93[_0xd5b4('0x4d')]({'plain':!![]});var _0x3dcd7e=_0xd5b4('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x3dcd7e,'userProfileId':_0x2e29d4[_0xd5b4('0x4e')]},'raw':!![]})['then'](function(_0x3a93be){if(_0x3a93be&&_0x3a93be[_0xd5b4('0x4f')]===0x0){return db[_0xd5b4('0x25')][_0xd5b4('0x4a')]({'name':_0x100406[_0xd5b4('0x29')],'resourceId':_0x100406['id'],'type':_0x3a93be['name'],'sectionId':_0x3a93be['id']},{})[_0xd5b4('0x23')](function(){return _0x152e93;});}else{return _0x152e93;}})['catch'](function(_0x2f0b1a){logger[_0xd5b4('0x28')](_0xd5b4('0x50'),_0x2f0b1a);throw _0x2f0b1a;});}return _0x152e93;})[_0xd5b4('0x23')](respondWithResult(_0x508545,0xc9))[_0xd5b4('0x49')](handleError(_0x508545,null));};exports[_0xd5b4('0x51')]=function(_0x5029c4,_0x555909){if(_0x5029c4[_0xd5b4('0x52')]['id']){delete _0x5029c4['body']['id'];}return db['UserFaxInteraction'][_0xd5b4('0x48')]({'where':{'id':_0x5029c4[_0xd5b4('0x44')]['id']}})[_0xd5b4('0x23')](handleEntityNotFound(_0x555909,null))[_0xd5b4('0x23')](saveUpdates(_0x5029c4['body'],null))[_0xd5b4('0x23')](respondWithResult(_0x555909,null))['catch'](handleError(_0x555909,null));};exports[_0xd5b4('0x26')]=function(_0x58188f,_0x27a296){return db[_0xd5b4('0x41')]['find']({'where':{'id':_0x58188f[_0xd5b4('0x44')]['id']}})[_0xd5b4('0x23')](handleEntityNotFound(_0x27a296,null))[_0xd5b4('0x23')](removeEntity(_0x27a296,null))[_0xd5b4('0x49')](handleError(_0x27a296,null));}; \ No newline at end of file +var _0xc30a=['moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserFaxInteractions','error','stack','name','send','map','UserFaxInteraction','fieldName','key','model','query','keys','filters','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','show','rawAttributes','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','request-promise'];(function(_0x49ba19,_0x377732){var _0xa556c0=function(_0x23c948){while(--_0x23c948){_0x49ba19['push'](_0x49ba19['shift']());}};_0xa556c0(++_0x377732);}(_0xc30a,0xfa));var _0xac30=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xc30a[_0x256b72];return _0x2183e3;};'use strict';var pdf=require(_0xac30('0x0'));var emlformat=require(_0xac30('0x1'));var rimraf=require(_0xac30('0x2'));var zipdir=require(_0xac30('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac30('0x4'));var moment=require(_0xac30('0x5'));var BPromise=require(_0xac30('0x6'));var Mustache=require(_0xac30('0x7'));var util=require(_0xac30('0x8'));var path=require('path');var sox=require(_0xac30('0x9'));var csv=require(_0xac30('0xa'));var ejs=require(_0xac30('0xb'));var fs=require('fs');var _=require(_0xac30('0xc'));var squel=require(_0xac30('0xd'));var crypto=require('crypto');var jsforce=require(_0xac30('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xac30('0xa'));var querystring=require(_0xac30('0xf'));var Papa=require(_0xac30('0x10'));var Redis=require(_0xac30('0x11'));var authService=require(_0xac30('0x12'));var qs=require(_0xac30('0x13'));var as=require(_0xac30('0x14'));var hardwareService=require(_0xac30('0x15'));var logger=require(_0xac30('0x16'))(_0xac30('0x17'));var utils=require(_0xac30('0x18'));var config=require(_0xac30('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xac30('0x1a'))['db'];function respondWithStatusCode(_0x2f7aa0,_0x2571e9){_0x2571e9=_0x2571e9||0xcc;return function(_0x455e4d){if(_0x455e4d){return _0x2f7aa0[_0xac30('0x1b')](_0x2571e9);}return _0x2f7aa0[_0xac30('0x1c')](_0x2571e9)[_0xac30('0x1d')]();};}function respondWithResult(_0x1045f9,_0x273494){_0x273494=_0x273494||0xc8;return function(_0xd354f3){if(_0xd354f3){return _0x1045f9[_0xac30('0x1c')](_0x273494)[_0xac30('0x1e')](_0xd354f3);}};}function respondWithFilteredResult(_0x75df4c,_0x56bae5){return function(_0x5df946){if(_0x5df946){var _0x227400=_0x5df946[_0xac30('0x1f')],_0x138d30=_0x56bae5[_0xac30('0x20')],_0x1b4658=_0x56bae5[_0xac30('0x20')]+_0x56bae5['limit'],_0x23c83b;if(_0x1b4658>=_0x227400){_0x1b4658=_0x227400;_0x23c83b=0xc8;}else{_0x23c83b=0xce;}_0x75df4c[_0xac30('0x1c')](_0x23c83b);return _0x75df4c[_0xac30('0x21')](_0xac30('0x22'),_0x138d30+'-'+_0x1b4658+'/'+_0x227400)[_0xac30('0x1e')](_0x5df946);}return null;};}function patchUpdates(_0x13ee6f){return function(_0x1b61a1){try{jsonpatch[_0xac30('0x23')](_0x1b61a1,_0x13ee6f,!![]);}catch(_0x40588f){return BPromise[_0xac30('0x24')](_0x40588f);}return _0x1b61a1[_0xac30('0x25')]();};}function saveUpdates(_0x24f8d0,_0x110adb){return function(_0x188a02){if(_0x188a02){return _0x188a02[_0xac30('0x26')](_0x24f8d0)[_0xac30('0x27')](function(_0x28c0e6){return _0x28c0e6;});}return null;};}function removeEntity(_0x3f9be2,_0x3d04d6){return function(_0x5c68b4){if(_0x5c68b4){return _0x5c68b4[_0xac30('0x28')]()[_0xac30('0x27')](function(){var _0x17948b=_0x5c68b4[_0xac30('0x29')]({'plain':!![]});var _0x21b730=_0xac30('0x2a');return db['UserProfileResource'][_0xac30('0x28')]({'where':{'type':_0x21b730,'resourceId':_0x17948b['id']}})[_0xac30('0x27')](function(){return _0x5c68b4;});})[_0xac30('0x27')](function(){_0x3f9be2[_0xac30('0x1c')](0xcc)[_0xac30('0x1d')]();});}};}function handleEntityNotFound(_0x191cf8,_0x3036e){return function(_0x289e23){if(!_0x289e23){_0x191cf8['sendStatus'](0x194);}return _0x289e23;};}function handleError(_0x48231a,_0x422e99){_0x422e99=_0x422e99||0x1f4;return function(_0x28b5a1){logger[_0xac30('0x2b')](_0x28b5a1[_0xac30('0x2c')]);if(_0x28b5a1[_0xac30('0x2d')]){delete _0x28b5a1[_0xac30('0x2d')];}_0x48231a['status'](_0x422e99)[_0xac30('0x2e')](_0x28b5a1);};}exports['index']=function(_0x4856f9,_0x1993bb){var _0x24b375={},_0x10ccc5={},_0x4e4603={'count':0x0,'rows':[]};var _0x4dd88b=_[_0xac30('0x2f')](db[_0xac30('0x30')]['rawAttributes'],function(_0x3cd5f9){return{'name':_0x3cd5f9[_0xac30('0x31')],'type':_0x3cd5f9['type'][_0xac30('0x32')]};});_0x10ccc5[_0xac30('0x33')]=_[_0xac30('0x2f')](_0x4dd88b,_0xac30('0x2d'));_0x10ccc5[_0xac30('0x34')]=_[_0xac30('0x35')](_0x4856f9[_0xac30('0x34')]);_0x10ccc5[_0xac30('0x36')]=_['intersection'](_0x10ccc5[_0xac30('0x33')],_0x10ccc5[_0xac30('0x34')]);_0x24b375[_0xac30('0x37')]=_['intersection'](_0x10ccc5[_0xac30('0x33')],qs[_0xac30('0x38')](_0x4856f9[_0xac30('0x34')][_0xac30('0x38')]));_0x24b375['attributes']=_0x24b375[_0xac30('0x37')][_0xac30('0x39')]?_0x24b375[_0xac30('0x37')]:_0x10ccc5[_0xac30('0x33')];if(!_0x4856f9['query']['hasOwnProperty'](_0xac30('0x3a'))){_0x24b375['limit']=qs[_0xac30('0x3b')](_0x4856f9[_0xac30('0x34')]['limit']);_0x24b375[_0xac30('0x20')]=qs[_0xac30('0x20')](_0x4856f9[_0xac30('0x34')][_0xac30('0x20')]);}_0x24b375[_0xac30('0x3c')]=qs['sort'](_0x4856f9[_0xac30('0x34')][_0xac30('0x3d')]);_0x24b375[_0xac30('0x3e')]=qs[_0xac30('0x36')](_[_0xac30('0x3f')](_0x4856f9[_0xac30('0x34')],_0x10ccc5[_0xac30('0x36')]),_0x4dd88b);if(_0x4856f9[_0xac30('0x34')][_0xac30('0x40')]){_0x24b375[_0xac30('0x3e')]=_['merge'](_0x24b375[_0xac30('0x3e')],{'$or':_['map'](_0x4dd88b,function(_0x298507){if(_0x298507[_0xac30('0x41')]!==_0xac30('0x42')){var _0x1755a6={};_0x1755a6[_0x298507[_0xac30('0x2d')]]={'$like':'%'+_0x4856f9[_0xac30('0x34')][_0xac30('0x40')]+'%'};return _0x1755a6;}})});}_0x24b375=_[_0xac30('0x43')]({},_0x24b375,_0x4856f9[_0xac30('0x44')]);var _0x164974={'where':_0x24b375[_0xac30('0x3e')]};return db['UserFaxInteraction'][_0xac30('0x1f')](_0x164974)[_0xac30('0x27')](function(_0x39cbbe){_0x4e4603[_0xac30('0x1f')]=_0x39cbbe;if(_0x4856f9['query']['includeAll']){_0x24b375[_0xac30('0x45')]=[{'all':!![]}];}return db[_0xac30('0x30')][_0xac30('0x46')](_0x24b375);})[_0xac30('0x27')](function(_0x2110d0){_0x4e4603['rows']=_0x2110d0;return _0x4e4603;})[_0xac30('0x27')](respondWithFilteredResult(_0x1993bb,_0x24b375))['catch'](handleError(_0x1993bb,null));};exports[_0xac30('0x47')]=function(_0x3a2317,_0x52216b){var _0x556a1b={'raw':!![],'where':{'id':_0x3a2317['params']['id']}},_0x9d1b28={};_0x9d1b28[_0xac30('0x33')]=_[_0xac30('0x35')](db[_0xac30('0x30')][_0xac30('0x48')]);_0x9d1b28[_0xac30('0x34')]=_[_0xac30('0x35')](_0x3a2317[_0xac30('0x34')]);_0x9d1b28[_0xac30('0x36')]=_[_0xac30('0x49')](_0x9d1b28[_0xac30('0x33')],_0x9d1b28[_0xac30('0x34')]);_0x556a1b[_0xac30('0x37')]=_[_0xac30('0x49')](_0x9d1b28[_0xac30('0x33')],qs[_0xac30('0x38')](_0x3a2317[_0xac30('0x34')][_0xac30('0x38')]));_0x556a1b['attributes']=_0x556a1b[_0xac30('0x37')][_0xac30('0x39')]?_0x556a1b[_0xac30('0x37')]:_0x9d1b28['model'];if(_0x3a2317[_0xac30('0x34')]['includeAll']){_0x556a1b[_0xac30('0x45')]=[{'all':!![]}];}_0x556a1b=_['merge']({},_0x556a1b,_0x3a2317[_0xac30('0x44')]);return db['UserFaxInteraction'][_0xac30('0x4a')](_0x556a1b)[_0xac30('0x27')](handleEntityNotFound(_0x52216b,null))['then'](respondWithResult(_0x52216b,null))[_0xac30('0x4b')](handleError(_0x52216b,null));};exports[_0xac30('0x4c')]=function(_0x329ea5,_0x1938c1){return db[_0xac30('0x30')][_0xac30('0x4c')](_0x329ea5[_0xac30('0x4d')],{})['then'](function(_0x1a75e9){var _0x2be9cf=_0x329ea5[_0xac30('0x4e')]['get']({'plain':!![]});if(!_0x2be9cf)throw new Error(_0xac30('0x4f'));if(_0x2be9cf['role']===_0xac30('0x4e')){var _0x105ec4=_0x1a75e9[_0xac30('0x29')]({'plain':!![]});var _0x2331e3=_0xac30('0x2a');return db['UserProfileSection'][_0xac30('0x4a')]({'where':{'name':_0x2331e3,'userProfileId':_0x2be9cf[_0xac30('0x50')]},'raw':!![]})[_0xac30('0x27')](function(_0x245dd3){if(_0x245dd3&&_0x245dd3[_0xac30('0x51')]===0x0){return db[_0xac30('0x52')]['create']({'name':_0x105ec4[_0xac30('0x2d')],'resourceId':_0x105ec4['id'],'type':_0x245dd3[_0xac30('0x2d')],'sectionId':_0x245dd3['id']},{})[_0xac30('0x27')](function(){return _0x1a75e9;});}else{return _0x1a75e9;}})[_0xac30('0x4b')](function(_0x27898e){logger[_0xac30('0x2b')](_0xac30('0x53'),_0x27898e);throw _0x27898e;});}return _0x1a75e9;})[_0xac30('0x27')](respondWithResult(_0x1938c1,0xc9))[_0xac30('0x4b')](handleError(_0x1938c1,null));};exports[_0xac30('0x26')]=function(_0x194deb,_0x271cc5){if(_0x194deb[_0xac30('0x4d')]['id']){delete _0x194deb[_0xac30('0x4d')]['id'];}return db['UserFaxInteraction'][_0xac30('0x4a')]({'where':{'id':_0x194deb[_0xac30('0x54')]['id']}})[_0xac30('0x27')](handleEntityNotFound(_0x271cc5,null))['then'](saveUpdates(_0x194deb['body'],null))['then'](respondWithResult(_0x271cc5,null))[_0xac30('0x4b')](handleError(_0x271cc5,null));};exports[_0xac30('0x28')]=function(_0xe0d1d8,_0x322e66){return db['UserFaxInteraction'][_0xac30('0x4a')]({'where':{'id':_0xe0d1d8['params']['id']}})[_0xac30('0x27')](handleEntityNotFound(_0x322e66,null))[_0xac30('0x27')](removeEntity(_0x322e66,null))[_0xac30('0x4b')](handleError(_0x322e66,null));}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.model.js b/server/api/UserFaxInteraction/UserFaxInteraction.model.js index afb35cc..0e51858 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 _0x2ef3=['exports','define','UserFaxInteraction','user_has_fax_interactions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./UserFaxInteraction.attributes'];(function(_0x217483,_0x422422){var _0x37f8a4=function(_0x7639ac){while(--_0x7639ac){_0x217483['push'](_0x217483['shift']());}};_0x37f8a4(++_0x422422);}(_0x2ef3,0xba));var _0x32ef=function(_0x5594a3,_0x3de08a){_0x5594a3=_0x5594a3-0x0;var _0xe206fc=_0x2ef3[_0x5594a3];return _0xe206fc;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','UserFaxInteraction','user_has_fax_interactions','util','api','moment','bluebird'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./UserFaxInteraction.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js b/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js index ad0cfea..6148ccd 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 _0x7563=['error','code','UserFaxInteraction,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','UserFaxInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x7563,0x17c));var _0x3756=function(_0x3198a3,_0x3581f2){_0x3198a3=_0x3198a3-0x0;var _0xc34c75=_0x7563[_0x3198a3];return _0xc34c75;};'use strict';var _=require('lodash');var util=require(_0x3756('0x0'));var moment=require(_0x3756('0x1'));var BPromise=require(_0x3756('0x2'));var rs=require(_0x3756('0x3'));var fs=require('fs');var Redis=require(_0x3756('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3756('0x5'));var logger=require('../../config/logger')(_0x3756('0x6'));var config=require(_0x3756('0x7'));var jayson=require(_0x3756('0x8'));var client=jayson[_0x3756('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bb6b8,_0x2337bf,_0xa20240){return new BPromise(function(_0x576ce0,_0x4e8754){return client['request'](_0x3bb6b8,_0xa20240)[_0x3756('0xa')](function(_0x33f59a){logger[_0x3756('0xb')]('UserFaxInteraction,\x20%s,\x20%s',_0x2337bf,_0x3756('0xc'));logger[_0x3756('0xd')](_0x3756('0xe'),_0x2337bf,_0x3756('0xc'),JSON[_0x3756('0xf')](_0x33f59a));if(_0x33f59a['error']){if(_0x33f59a[_0x3756('0x10')][_0x3756('0x11')]===0x1f4){logger['error'](_0x3756('0x12'),_0x2337bf,_0x33f59a[_0x3756('0x10')]['message']);return _0x4e8754(_0x33f59a[_0x3756('0x10')][_0x3756('0x13')]);}logger[_0x3756('0x10')](_0x3756('0x12'),_0x2337bf,_0x33f59a[_0x3756('0x10')][_0x3756('0x13')]);return _0x576ce0(_0x33f59a[_0x3756('0x10')][_0x3756('0x13')]);}else{logger[_0x3756('0xb')](_0x3756('0x12'),_0x2337bf,_0x3756('0xc'));_0x576ce0(_0x33f59a[_0x3756('0x14')][_0x3756('0x13')]);}})[_0x3756('0x15')](function(_0x4b5563){logger[_0x3756('0x10')]('UserFaxInteraction,\x20%s,\x20%s',_0x2337bf,_0x4b5563);_0x4e8754(_0x4b5563);});});} \ No newline at end of file +var _0x01f9=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','UserFaxInteraction,\x20%s,\x20%s','request\x20sent','UserFaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3b1cf8,_0x5b79f9){var _0x5d0434=function(_0x1b6559){while(--_0x1b6559){_0x3b1cf8['push'](_0x3b1cf8['shift']());}};_0x5d0434(++_0x5b79f9);}(_0x01f9,0x1a3));var _0x901f=function(_0x119179,_0x2d3794){_0x119179=_0x119179-0x0;var _0x1d6239=_0x01f9[_0x119179];return _0x1d6239;};'use strict';var _=require(_0x901f('0x0'));var util=require(_0x901f('0x1'));var moment=require(_0x901f('0x2'));var BPromise=require('bluebird');var rs=require(_0x901f('0x3'));var fs=require('fs');var Redis=require(_0x901f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x901f('0x5'));var logger=require(_0x901f('0x6'))(_0x901f('0x7'));var config=require(_0x901f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x901f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x252be0,_0x23d67e,_0x273eeb){return new BPromise(function(_0x2a69aa,_0x1277a1){return client[_0x901f('0xa')](_0x252be0,_0x273eeb)[_0x901f('0xb')](function(_0x1613ff){logger[_0x901f('0xc')](_0x901f('0xd'),_0x23d67e,_0x901f('0xe'));logger['debug'](_0x901f('0xf'),_0x23d67e,'request\x20sent',JSON[_0x901f('0x10')](_0x1613ff));if(_0x1613ff[_0x901f('0x11')]){if(_0x1613ff['error'][_0x901f('0x12')]===0x1f4){logger['error'](_0x901f('0xd'),_0x23d67e,_0x1613ff[_0x901f('0x11')][_0x901f('0x13')]);return _0x1277a1(_0x1613ff[_0x901f('0x11')][_0x901f('0x13')]);}logger[_0x901f('0x11')]('UserFaxInteraction,\x20%s,\x20%s',_0x23d67e,_0x1613ff[_0x901f('0x11')]['message']);return _0x2a69aa(_0x1613ff[_0x901f('0x11')][_0x901f('0x13')]);}else{logger[_0x901f('0xc')](_0x901f('0xd'),_0x23d67e,'request\x20sent');_0x2a69aa(_0x1613ff[_0x901f('0x14')][_0x901f('0x13')]);}})[_0x901f('0x15')](function(_0x478bd8){logger[_0x901f('0x11')](_0x901f('0xd'),_0x23d67e,_0x478bd8);_0x1277a1(_0x478bd8);});});} \ No newline at end of file diff --git a/server/api/UserFaxInteraction/index.js b/server/api/UserFaxInteraction/index.js index a23d7b0..0fb3416 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 _0x0e0a=['express','Router','./UserFaxInteraction.controller','get','index','isAuthenticated','post','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3c6436,_0x57fa39){var _0x4372ac=function(_0x454c00){while(--_0x454c00){_0x3c6436['push'](_0x3c6436['shift']());}};_0x4372ac(++_0x57fa39);}(_0x0e0a,0x1be));var _0xa0e0=function(_0x5ec655,_0x1b7d41){_0x5ec655=_0x5ec655-0x0;var _0x144c58=_0x0e0a[_0x5ec655];return _0x144c58;};'use strict';var multer=require(_0xa0e0('0x0'));var util=require(_0xa0e0('0x1'));var path=require(_0xa0e0('0x2'));var timeout=require(_0xa0e0('0x3'));var express=require(_0xa0e0('0x4'));var router=express[_0xa0e0('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa0e0('0x6'));router[_0xa0e0('0x7')]('/',auth['isAuthenticated'](),controller[_0xa0e0('0x8')]);router[_0xa0e0('0x7')]('/:id',auth[_0xa0e0('0x9')](),controller['show']);router[_0xa0e0('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa0e0('0xb')]('/:id',auth[_0xa0e0('0x9')](),controller['update']);router[_0xa0e0('0xc')]('/:id',auth[_0xa0e0('0x9')](),controller[_0xa0e0('0xd')]);module[_0xa0e0('0xe')]=router; \ No newline at end of file +var _0xac97=['delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xac97,0x132));var _0x7ac9=function(_0x3fb4b4,_0x202910){_0x3fb4b4=_0x3fb4b4-0x0;var _0x3acabb=_0xac97[_0x3fb4b4];return _0x3acabb;};'use strict';var multer=require(_0x7ac9('0x0'));var util=require('util');var path=require(_0x7ac9('0x1'));var timeout=require(_0x7ac9('0x2'));var express=require(_0x7ac9('0x3'));var router=express[_0x7ac9('0x4')]();var auth=require(_0x7ac9('0x5'));var interaction=require(_0x7ac9('0x6'));var config=require(_0x7ac9('0x7'));var controller=require('./UserFaxInteraction.controller');router[_0x7ac9('0x8')]('/',auth[_0x7ac9('0x9')](),controller[_0x7ac9('0xa')]);router[_0x7ac9('0x8')](_0x7ac9('0xb'),auth[_0x7ac9('0x9')](),controller[_0x7ac9('0xc')]);router[_0x7ac9('0xd')]('/',auth['isAuthenticated'](),controller[_0x7ac9('0xe')]);router[_0x7ac9('0xf')](_0x7ac9('0xb'),auth[_0x7ac9('0x9')](),controller[_0x7ac9('0x10')]);router[_0x7ac9('0x11')](_0x7ac9('0xb'),auth[_0x7ac9('0x9')](),controller['destroy']);module[_0x7ac9('0x12')]=router; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.attributes.js b/server/api/UserMailInteraction/UserMailInteraction.attributes.js index ea782ad..5d76357 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 _0xe737=['INTEGER','sequelize','exports'];(function(_0xfc2d29,_0x37c077){var _0x129511=function(_0x1fd9c6){while(--_0x1fd9c6){_0xfc2d29['push'](_0xfc2d29['shift']());}};_0x129511(++_0x37c077);}(_0xe737,0x1bd));var _0x7e73=function(_0x23adaa,_0xea5faf){_0x23adaa=_0x23adaa-0x0;var _0x6cd9d1=_0xe737[_0x23adaa];return _0x6cd9d1;};'use strict';var Sequelize=require(_0x7e73('0x0'));module[_0x7e73('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x7e73('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x9044=['exports','INTEGER'];(function(_0x25fd71,_0x493b52){var _0x15917d=function(_0x4337f6){while(--_0x4337f6){_0x25fd71['push'](_0x25fd71['shift']());}};_0x15917d(++_0x493b52);}(_0x9044,0x13c));var _0x4904=function(_0x38da08,_0x3455ad){_0x38da08=_0x38da08-0x0;var _0x29463f=_0x9044[_0x38da08];return _0x29463f;};'use strict';var Sequelize=require('sequelize');module[_0x4904('0x0')]={'MailInteractionId':{'type':Sequelize[_0x4904('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x4904('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.controller.js b/server/api/UserMailInteraction/UserMailInteraction.controller.js index 18dcbcb..f47c288 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 _0x8d46=['sendStatus','status','end','json','count','limit','set','apply','reject','save','update','get','then','stack','name','send','index','map','UserMailInteraction','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','offset','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserMailInteractions','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3c8acd,_0x3dcf5a){var _0x2731e2=function(_0x29e0fa){while(--_0x29e0fa){_0x3c8acd['push'](_0x3c8acd['shift']());}};_0x2731e2(++_0x3dcf5a);}(_0x8d46,0xd5));var _0x68d4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8d46[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0x68d4('0x0'));var emlformat=require(_0x68d4('0x1'));var rimraf=require(_0x68d4('0x2'));var zipdir=require(_0x68d4('0x3'));var jsonpatch=require(_0x68d4('0x4'));var rp=require(_0x68d4('0x5'));var moment=require('moment');var BPromise=require(_0x68d4('0x6'));var Mustache=require(_0x68d4('0x7'));var util=require(_0x68d4('0x8'));var path=require('path');var sox=require(_0x68d4('0x9'));var csv=require(_0x68d4('0xa'));var ejs=require(_0x68d4('0xb'));var fs=require('fs');var _=require(_0x68d4('0xc'));var squel=require('squel');var crypto=require(_0x68d4('0xd'));var jsforce=require(_0x68d4('0xe'));var deskjs=require(_0x68d4('0xf'));var toCsv=require(_0x68d4('0xa'));var querystring=require(_0x68d4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x68d4('0x11'));var hardwareService=require(_0x68d4('0x12'));var logger=require(_0x68d4('0x13'))(_0x68d4('0x14'));var utils=require(_0x68d4('0x15'));var config=require(_0x68d4('0x16'));var licenseUtil=require(_0x68d4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b45fc,_0x52f8b4){_0x52f8b4=_0x52f8b4||0xcc;return function(_0x146c73){if(_0x146c73){return _0x3b45fc[_0x68d4('0x18')](_0x52f8b4);}return _0x3b45fc[_0x68d4('0x19')](_0x52f8b4)[_0x68d4('0x1a')]();};}function respondWithResult(_0x3b65fe,_0x3613fc){_0x3613fc=_0x3613fc||0xc8;return function(_0x5ec807){if(_0x5ec807){return _0x3b65fe[_0x68d4('0x19')](_0x3613fc)[_0x68d4('0x1b')](_0x5ec807);}};}function respondWithFilteredResult(_0x39971e,_0x2de18c){return function(_0x1e8cd9){if(_0x1e8cd9){var _0x46017f=_0x1e8cd9[_0x68d4('0x1c')],_0x1986d7=_0x2de18c['offset'],_0xc47d01=_0x2de18c['offset']+_0x2de18c[_0x68d4('0x1d')],_0x222d0f;if(_0xc47d01>=_0x46017f){_0xc47d01=_0x46017f;_0x222d0f=0xc8;}else{_0x222d0f=0xce;}_0x39971e[_0x68d4('0x19')](_0x222d0f);return _0x39971e[_0x68d4('0x1e')]('Content-Range',_0x1986d7+'-'+_0xc47d01+'/'+_0x46017f)['json'](_0x1e8cd9);}return null;};}function patchUpdates(_0x181224){return function(_0x4127d1){try{jsonpatch[_0x68d4('0x1f')](_0x4127d1,_0x181224,!![]);}catch(_0x540a17){return BPromise[_0x68d4('0x20')](_0x540a17);}return _0x4127d1[_0x68d4('0x21')]();};}function saveUpdates(_0x13a254,_0x3c616e){return function(_0x14ee83){if(_0x14ee83){return _0x14ee83[_0x68d4('0x22')](_0x13a254)['then'](function(_0x3736de){return _0x3736de;});}return null;};}function removeEntity(_0x3e4d76,_0x4049ac){return function(_0x232968){if(_0x232968){return _0x232968['destroy']()['then'](function(){var _0x4d3327=_0x232968[_0x68d4('0x23')]({'plain':!![]});var _0x247388='UserMailInteractions';return db['UserProfileResource']['destroy']({'where':{'type':_0x247388,'resourceId':_0x4d3327['id']}})[_0x68d4('0x24')](function(){return _0x232968;});})[_0x68d4('0x24')](function(){_0x3e4d76[_0x68d4('0x19')](0xcc)[_0x68d4('0x1a')]();});}};}function handleEntityNotFound(_0x491e1,_0x3d96c4){return function(_0x50001c){if(!_0x50001c){_0x491e1[_0x68d4('0x18')](0x194);}return _0x50001c;};}function handleError(_0x1a4510,_0x1dea19){_0x1dea19=_0x1dea19||0x1f4;return function(_0x21ffa4){logger['error'](_0x21ffa4[_0x68d4('0x25')]);if(_0x21ffa4[_0x68d4('0x26')]){delete _0x21ffa4[_0x68d4('0x26')];}_0x1a4510[_0x68d4('0x19')](_0x1dea19)[_0x68d4('0x27')](_0x21ffa4);};}exports[_0x68d4('0x28')]=function(_0x4ebe02,_0x2b79d1){var _0x158942={},_0x11722a={},_0x2daac6={'count':0x0,'rows':[]};var _0x4321a8=_[_0x68d4('0x29')](db[_0x68d4('0x2a')]['rawAttributes'],function(_0x3a3f95){return{'name':_0x3a3f95[_0x68d4('0x2b')],'type':_0x3a3f95[_0x68d4('0x2c')][_0x68d4('0x2d')]};});_0x11722a['model']=_[_0x68d4('0x29')](_0x4321a8,_0x68d4('0x26'));_0x11722a[_0x68d4('0x2e')]=_[_0x68d4('0x2f')](_0x4ebe02[_0x68d4('0x2e')]);_0x11722a[_0x68d4('0x30')]=_['intersection'](_0x11722a[_0x68d4('0x31')],_0x11722a[_0x68d4('0x2e')]);_0x158942[_0x68d4('0x32')]=_[_0x68d4('0x33')](_0x11722a[_0x68d4('0x31')],qs[_0x68d4('0x34')](_0x4ebe02[_0x68d4('0x2e')][_0x68d4('0x34')]));_0x158942[_0x68d4('0x32')]=_0x158942[_0x68d4('0x32')][_0x68d4('0x35')]?_0x158942[_0x68d4('0x32')]:_0x11722a[_0x68d4('0x31')];if(!_0x4ebe02[_0x68d4('0x2e')]['hasOwnProperty']('nolimit')){_0x158942[_0x68d4('0x1d')]=qs['limit'](_0x4ebe02['query'][_0x68d4('0x1d')]);_0x158942[_0x68d4('0x36')]=qs[_0x68d4('0x36')](_0x4ebe02[_0x68d4('0x2e')][_0x68d4('0x36')]);}_0x158942['order']=qs[_0x68d4('0x37')](_0x4ebe02['query']['sort']);_0x158942[_0x68d4('0x38')]=qs[_0x68d4('0x30')](_[_0x68d4('0x39')](_0x4ebe02[_0x68d4('0x2e')],_0x11722a['filters']),_0x4321a8);if(_0x4ebe02['query']['filter']){_0x158942['where']=_[_0x68d4('0x3a')](_0x158942[_0x68d4('0x38')],{'$or':_['map'](_0x4321a8,function(_0x403f02){if(_0x403f02[_0x68d4('0x2c')]!=='VIRTUAL'){var _0x30e665={};_0x30e665[_0x403f02[_0x68d4('0x26')]]={'$like':'%'+_0x4ebe02[_0x68d4('0x2e')][_0x68d4('0x3b')]+'%'};return _0x30e665;}})});}_0x158942=_[_0x68d4('0x3a')]({},_0x158942,_0x4ebe02[_0x68d4('0x3c')]);var _0x22a573={'where':_0x158942['where']};return db[_0x68d4('0x2a')][_0x68d4('0x1c')](_0x22a573)[_0x68d4('0x24')](function(_0x12871a){_0x2daac6[_0x68d4('0x1c')]=_0x12871a;if(_0x4ebe02[_0x68d4('0x2e')][_0x68d4('0x3d')]){_0x158942[_0x68d4('0x3e')]=[{'all':!![]}];}return db[_0x68d4('0x2a')][_0x68d4('0x3f')](_0x158942);})[_0x68d4('0x24')](function(_0x15ca8f){_0x2daac6['rows']=_0x15ca8f;return _0x2daac6;})[_0x68d4('0x24')](respondWithFilteredResult(_0x2b79d1,_0x158942))[_0x68d4('0x40')](handleError(_0x2b79d1,null));};exports[_0x68d4('0x41')]=function(_0x54449d,_0x564336){var _0x5d735a={'raw':!![],'where':{'id':_0x54449d[_0x68d4('0x42')]['id']}},_0x106398={};_0x106398['model']=_[_0x68d4('0x2f')](db[_0x68d4('0x2a')]['rawAttributes']);_0x106398[_0x68d4('0x2e')]=_[_0x68d4('0x2f')](_0x54449d[_0x68d4('0x2e')]);_0x106398[_0x68d4('0x30')]=_[_0x68d4('0x33')](_0x106398[_0x68d4('0x31')],_0x106398[_0x68d4('0x2e')]);_0x5d735a[_0x68d4('0x32')]=_['intersection'](_0x106398['model'],qs[_0x68d4('0x34')](_0x54449d[_0x68d4('0x2e')][_0x68d4('0x34')]));_0x5d735a[_0x68d4('0x32')]=_0x5d735a[_0x68d4('0x32')][_0x68d4('0x35')]?_0x5d735a['attributes']:_0x106398[_0x68d4('0x31')];if(_0x54449d['query'][_0x68d4('0x3d')]){_0x5d735a[_0x68d4('0x3e')]=[{'all':!![]}];}_0x5d735a=_[_0x68d4('0x3a')]({},_0x5d735a,_0x54449d[_0x68d4('0x3c')]);return db[_0x68d4('0x2a')]['find'](_0x5d735a)[_0x68d4('0x24')](handleEntityNotFound(_0x564336,null))[_0x68d4('0x24')](respondWithResult(_0x564336,null))[_0x68d4('0x40')](handleError(_0x564336,null));};exports['create']=function(_0x28fb0a,_0x3bb8db){return db[_0x68d4('0x2a')][_0x68d4('0x43')](_0x28fb0a[_0x68d4('0x44')],{})[_0x68d4('0x24')](function(_0x375ae3){var _0x1c1e00=_0x28fb0a[_0x68d4('0x45')]['get']({'plain':!![]});if(!_0x1c1e00)throw new Error(_0x68d4('0x46'));if(_0x1c1e00['role']===_0x68d4('0x45')){var _0x385891=_0x375ae3[_0x68d4('0x23')]({'plain':!![]});var _0x1245f2=_0x68d4('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x1245f2,'userProfileId':_0x1c1e00[_0x68d4('0x48')]},'raw':!![]})['then'](function(_0x1cad6d){if(_0x1cad6d&&_0x1cad6d[_0x68d4('0x49')]===0x0){return db[_0x68d4('0x4a')][_0x68d4('0x43')]({'name':_0x385891[_0x68d4('0x26')],'resourceId':_0x385891['id'],'type':_0x1cad6d[_0x68d4('0x26')],'sectionId':_0x1cad6d['id']},{})['then'](function(){return _0x375ae3;});}else{return _0x375ae3;}})[_0x68d4('0x40')](function(_0x42f2bc){logger[_0x68d4('0x4b')](_0x68d4('0x4c'),_0x42f2bc);throw _0x42f2bc;});}return _0x375ae3;})['then'](respondWithResult(_0x3bb8db,0xc9))[_0x68d4('0x40')](handleError(_0x3bb8db,null));};exports[_0x68d4('0x22')]=function(_0x4a8d2f,_0xa6fb4e){if(_0x4a8d2f[_0x68d4('0x44')]['id']){delete _0x4a8d2f['body']['id'];}return db[_0x68d4('0x2a')][_0x68d4('0x4d')]({'where':{'id':_0x4a8d2f['params']['id']}})[_0x68d4('0x24')](handleEntityNotFound(_0xa6fb4e,null))['then'](saveUpdates(_0x4a8d2f['body'],null))['then'](respondWithResult(_0xa6fb4e,null))[_0x68d4('0x40')](handleError(_0xa6fb4e,null));};exports[_0x68d4('0x4e')]=function(_0x31ed31,_0x5da1d6){return db['UserMailInteraction']['find']({'where':{'id':_0x31ed31[_0x68d4('0x42')]['id']}})['then'](handleEntityNotFound(_0x5da1d6,null))[_0x68d4('0x24')](removeEntity(_0x5da1d6,null))[_0x68d4('0x40')](handleError(_0x5da1d6,null));}; \ No newline at end of file +var _0x3f57=['find','create','body','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','UserMailInteractions','UserProfileResource','sendStatus','error','stack','name','send','map','UserMailInteraction','rawAttributes','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','length'];(function(_0x4c0187,_0x2ed98a){var _0x432e66=function(_0x51a7f7){while(--_0x51a7f7){_0x4c0187['push'](_0x4c0187['shift']());}};_0x432e66(++_0x2ed98a);}(_0x3f57,0xaf));var _0x73f5=function(_0x28ad8e,_0x16eb6a){_0x28ad8e=_0x28ad8e-0x0;var _0x3e8b8f=_0x3f57[_0x28ad8e];return _0x3e8b8f;};'use strict';var pdf=require(_0x73f5('0x0'));var emlformat=require(_0x73f5('0x1'));var rimraf=require(_0x73f5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73f5('0x3'));var rp=require(_0x73f5('0x4'));var moment=require(_0x73f5('0x5'));var BPromise=require(_0x73f5('0x6'));var Mustache=require(_0x73f5('0x7'));var util=require(_0x73f5('0x8'));var path=require(_0x73f5('0x9'));var sox=require(_0x73f5('0xa'));var csv=require(_0x73f5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x73f5('0xc'));var squel=require(_0x73f5('0xd'));var crypto=require(_0x73f5('0xe'));var jsforce=require(_0x73f5('0xf'));var deskjs=require(_0x73f5('0x10'));var toCsv=require(_0x73f5('0xb'));var querystring=require(_0x73f5('0x11'));var Papa=require(_0x73f5('0x12'));var Redis=require(_0x73f5('0x13'));var authService=require(_0x73f5('0x14'));var qs=require(_0x73f5('0x15'));var as=require(_0x73f5('0x16'));var hardwareService=require(_0x73f5('0x17'));var logger=require(_0x73f5('0x18'))(_0x73f5('0x19'));var utils=require(_0x73f5('0x1a'));var config=require(_0x73f5('0x1b'));var licenseUtil=require(_0x73f5('0x1c'));var db=require(_0x73f5('0x1d'))['db'];function respondWithStatusCode(_0x4788a5,_0x314bdd){_0x314bdd=_0x314bdd||0xcc;return function(_0x5a98a8){if(_0x5a98a8){return _0x4788a5['sendStatus'](_0x314bdd);}return _0x4788a5['status'](_0x314bdd)['end']();};}function respondWithResult(_0xf3352e,_0x12c479){_0x12c479=_0x12c479||0xc8;return function(_0x131298){if(_0x131298){return _0xf3352e[_0x73f5('0x1e')](_0x12c479)[_0x73f5('0x1f')](_0x131298);}};}function respondWithFilteredResult(_0x31a883,_0x5935eb){return function(_0x1c7bca){if(_0x1c7bca){var _0x3981c4=_0x1c7bca[_0x73f5('0x20')],_0x2463a5=_0x5935eb[_0x73f5('0x21')],_0x3d045d=_0x5935eb[_0x73f5('0x21')]+_0x5935eb[_0x73f5('0x22')],_0x4e9739;if(_0x3d045d>=_0x3981c4){_0x3d045d=_0x3981c4;_0x4e9739=0xc8;}else{_0x4e9739=0xce;}_0x31a883[_0x73f5('0x1e')](_0x4e9739);return _0x31a883['set'](_0x73f5('0x23'),_0x2463a5+'-'+_0x3d045d+'/'+_0x3981c4)['json'](_0x1c7bca);}return null;};}function patchUpdates(_0x254556){return function(_0x202287){try{jsonpatch[_0x73f5('0x24')](_0x202287,_0x254556,!![]);}catch(_0x2e9086){return BPromise[_0x73f5('0x25')](_0x2e9086);}return _0x202287[_0x73f5('0x26')]();};}function saveUpdates(_0x131c17,_0x106bba){return function(_0x15b533){if(_0x15b533){return _0x15b533[_0x73f5('0x27')](_0x131c17)['then'](function(_0x58e0ee){return _0x58e0ee;});}return null;};}function removeEntity(_0x3fe1ae,_0x1d1e8d){return function(_0x17e43d){if(_0x17e43d){return _0x17e43d[_0x73f5('0x28')]()[_0x73f5('0x29')](function(){var _0x3bf7de=_0x17e43d[_0x73f5('0x2a')]({'plain':!![]});var _0x5bcc66=_0x73f5('0x2b');return db[_0x73f5('0x2c')]['destroy']({'where':{'type':_0x5bcc66,'resourceId':_0x3bf7de['id']}})[_0x73f5('0x29')](function(){return _0x17e43d;});})[_0x73f5('0x29')](function(){_0x3fe1ae[_0x73f5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ccb42,_0x59700a){return function(_0xb4e52b){if(!_0xb4e52b){_0x2ccb42[_0x73f5('0x2d')](0x194);}return _0xb4e52b;};}function handleError(_0x193950,_0x225c8b){_0x225c8b=_0x225c8b||0x1f4;return function(_0xee22d4){logger[_0x73f5('0x2e')](_0xee22d4[_0x73f5('0x2f')]);if(_0xee22d4[_0x73f5('0x30')]){delete _0xee22d4[_0x73f5('0x30')];}_0x193950[_0x73f5('0x1e')](_0x225c8b)[_0x73f5('0x31')](_0xee22d4);};}exports['index']=function(_0x186406,_0x2440ab){var _0x1b3536={},_0x211481={},_0x32cb64={'count':0x0,'rows':[]};var _0x3039c3=_[_0x73f5('0x32')](db[_0x73f5('0x33')][_0x73f5('0x34')],function(_0x1a7f7d){return{'name':_0x1a7f7d['fieldName'],'type':_0x1a7f7d[_0x73f5('0x35')]['key']};});_0x211481[_0x73f5('0x36')]=_[_0x73f5('0x32')](_0x3039c3,_0x73f5('0x30'));_0x211481['query']=_[_0x73f5('0x37')](_0x186406[_0x73f5('0x38')]);_0x211481[_0x73f5('0x39')]=_['intersection'](_0x211481[_0x73f5('0x36')],_0x211481[_0x73f5('0x38')]);_0x1b3536[_0x73f5('0x3a')]=_[_0x73f5('0x3b')](_0x211481[_0x73f5('0x36')],qs[_0x73f5('0x3c')](_0x186406[_0x73f5('0x38')][_0x73f5('0x3c')]));_0x1b3536[_0x73f5('0x3a')]=_0x1b3536[_0x73f5('0x3a')]['length']?_0x1b3536['attributes']:_0x211481[_0x73f5('0x36')];if(!_0x186406['query'][_0x73f5('0x3d')](_0x73f5('0x3e'))){_0x1b3536['limit']=qs[_0x73f5('0x22')](_0x186406[_0x73f5('0x38')][_0x73f5('0x22')]);_0x1b3536[_0x73f5('0x21')]=qs[_0x73f5('0x21')](_0x186406[_0x73f5('0x38')][_0x73f5('0x21')]);}_0x1b3536[_0x73f5('0x3f')]=qs[_0x73f5('0x40')](_0x186406[_0x73f5('0x38')][_0x73f5('0x40')]);_0x1b3536[_0x73f5('0x41')]=qs[_0x73f5('0x39')](_[_0x73f5('0x42')](_0x186406[_0x73f5('0x38')],_0x211481[_0x73f5('0x39')]),_0x3039c3);if(_0x186406['query'][_0x73f5('0x43')]){_0x1b3536[_0x73f5('0x41')]=_[_0x73f5('0x44')](_0x1b3536[_0x73f5('0x41')],{'$or':_[_0x73f5('0x32')](_0x3039c3,function(_0x5947aa){if(_0x5947aa['type']!==_0x73f5('0x45')){var _0x9accb={};_0x9accb[_0x5947aa['name']]={'$like':'%'+_0x186406[_0x73f5('0x38')][_0x73f5('0x43')]+'%'};return _0x9accb;}})});}_0x1b3536=_[_0x73f5('0x44')]({},_0x1b3536,_0x186406[_0x73f5('0x46')]);var _0x1e0747={'where':_0x1b3536[_0x73f5('0x41')]};return db[_0x73f5('0x33')][_0x73f5('0x20')](_0x1e0747)[_0x73f5('0x29')](function(_0x1387e7){_0x32cb64[_0x73f5('0x20')]=_0x1387e7;if(_0x186406[_0x73f5('0x38')]['includeAll']){_0x1b3536[_0x73f5('0x47')]=[{'all':!![]}];}return db[_0x73f5('0x33')][_0x73f5('0x48')](_0x1b3536);})['then'](function(_0xd9fe3a){_0x32cb64[_0x73f5('0x49')]=_0xd9fe3a;return _0x32cb64;})[_0x73f5('0x29')](respondWithFilteredResult(_0x2440ab,_0x1b3536))[_0x73f5('0x4a')](handleError(_0x2440ab,null));};exports['show']=function(_0x1698e2,_0x4c9f3a){var _0x44a12d={'raw':!![],'where':{'id':_0x1698e2[_0x73f5('0x4b')]['id']}},_0x4ec11e={};_0x4ec11e[_0x73f5('0x36')]=_['keys'](db[_0x73f5('0x33')][_0x73f5('0x34')]);_0x4ec11e[_0x73f5('0x38')]=_[_0x73f5('0x37')](_0x1698e2['query']);_0x4ec11e['filters']=_['intersection'](_0x4ec11e['model'],_0x4ec11e['query']);_0x44a12d[_0x73f5('0x3a')]=_[_0x73f5('0x3b')](_0x4ec11e[_0x73f5('0x36')],qs[_0x73f5('0x3c')](_0x1698e2[_0x73f5('0x38')][_0x73f5('0x3c')]));_0x44a12d[_0x73f5('0x3a')]=_0x44a12d[_0x73f5('0x3a')][_0x73f5('0x4c')]?_0x44a12d['attributes']:_0x4ec11e[_0x73f5('0x36')];if(_0x1698e2[_0x73f5('0x38')]['includeAll']){_0x44a12d[_0x73f5('0x47')]=[{'all':!![]}];}_0x44a12d=_[_0x73f5('0x44')]({},_0x44a12d,_0x1698e2[_0x73f5('0x46')]);return db['UserMailInteraction'][_0x73f5('0x4d')](_0x44a12d)['then'](handleEntityNotFound(_0x4c9f3a,null))[_0x73f5('0x29')](respondWithResult(_0x4c9f3a,null))[_0x73f5('0x4a')](handleError(_0x4c9f3a,null));};exports[_0x73f5('0x4e')]=function(_0x4a1f28,_0x26b6f1){return db[_0x73f5('0x33')][_0x73f5('0x4e')](_0x4a1f28[_0x73f5('0x4f')],{})[_0x73f5('0x29')](function(_0x59f2b0){var _0x51cb82=_0x4a1f28['user'][_0x73f5('0x2a')]({'plain':!![]});if(!_0x51cb82)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51cb82[_0x73f5('0x50')]===_0x73f5('0x51')){var _0xd19048=_0x59f2b0[_0x73f5('0x2a')]({'plain':!![]});var _0xcfbc04=_0x73f5('0x2b');return db[_0x73f5('0x52')][_0x73f5('0x4d')]({'where':{'name':_0xcfbc04,'userProfileId':_0x51cb82['userProfileId']},'raw':!![]})[_0x73f5('0x29')](function(_0x16eaf7){if(_0x16eaf7&&_0x16eaf7['autoAssociation']===0x0){return db[_0x73f5('0x2c')][_0x73f5('0x4e')]({'name':_0xd19048['name'],'resourceId':_0xd19048['id'],'type':_0x16eaf7[_0x73f5('0x30')],'sectionId':_0x16eaf7['id']},{})[_0x73f5('0x29')](function(){return _0x59f2b0;});}else{return _0x59f2b0;}})['catch'](function(_0x329785){logger[_0x73f5('0x2e')](_0x73f5('0x53'),_0x329785);throw _0x329785;});}return _0x59f2b0;})[_0x73f5('0x29')](respondWithResult(_0x26b6f1,0xc9))[_0x73f5('0x4a')](handleError(_0x26b6f1,null));};exports[_0x73f5('0x27')]=function(_0x5dadc9,_0x3d23bf){if(_0x5dadc9[_0x73f5('0x4f')]['id']){delete _0x5dadc9[_0x73f5('0x4f')]['id'];}return db['UserMailInteraction'][_0x73f5('0x4d')]({'where':{'id':_0x5dadc9[_0x73f5('0x4b')]['id']}})[_0x73f5('0x29')](handleEntityNotFound(_0x3d23bf,null))[_0x73f5('0x29')](saveUpdates(_0x5dadc9[_0x73f5('0x4f')],null))[_0x73f5('0x29')](respondWithResult(_0x3d23bf,null))[_0x73f5('0x4a')](handleError(_0x3d23bf,null));};exports['destroy']=function(_0x57accd,_0x4cc159){return db['UserMailInteraction'][_0x73f5('0x4d')]({'where':{'id':_0x57accd[_0x73f5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4cc159,null))[_0x73f5('0x29')](removeEntity(_0x4cc159,null))[_0x73f5('0x4a')](handleError(_0x4cc159,null));}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.model.js b/server/api/UserMailInteraction/UserMailInteraction.model.js index 7b3b100..e782977 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 _0x71d3=['rimraf','../../config/environment','./UserMailInteraction.attributes','user_has_mail_interactions','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x71d3,0x67));var _0x371d=function(_0x2f5547,_0x4eb6df){_0x2f5547=_0x2f5547-0x0;var _0x29c469=_0x71d3[_0x2f5547];return _0x29c469;};'use strict';var _=require(_0x371d('0x0'));var util=require(_0x371d('0x1'));var logger=require(_0x371d('0x2'))('api');var moment=require(_0x371d('0x3'));var BPromise=require(_0x371d('0x4'));var rp=require(_0x371d('0x5'));var fs=require('fs');var path=require(_0x371d('0x6'));var rimraf=require(_0x371d('0x7'));var config=require(_0x371d('0x8'));var attributes=require(_0x371d('0x9'));module['exports']=function(_0x1c3cb7,_0x26ce75){return _0x1c3cb7['define']('UserMailInteraction',attributes,{'tableName':_0x371d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecf3=['UserMailInteraction','user_has_mail_interactions','../../config/logger','api','moment','request-promise','path','rimraf','./UserMailInteraction.attributes','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xecf3,0x66));var _0x3ecf=function(_0x399f42,_0x7dede2){_0x399f42=_0x399f42-0x0;var _0xfa8c71=_0xecf3[_0x399f42];return _0xfa8c71;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3ecf('0x0'))(_0x3ecf('0x1'));var moment=require(_0x3ecf('0x2'));var BPromise=require('bluebird');var rp=require(_0x3ecf('0x3'));var fs=require('fs');var path=require(_0x3ecf('0x4'));var rimraf=require(_0x3ecf('0x5'));var config=require('../../config/environment');var attributes=require(_0x3ecf('0x6'));module[_0x3ecf('0x7')]=function(_0x4af095,_0xe52550){return _0x4af095['define'](_0x3ecf('0x8'),attributes,{'tableName':_0x3ecf('0x9'),'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 78e47a6..44dcee3 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 _0x0dba=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1bfc72,_0x45f543){var _0x575ab3=function(_0x52202b){while(--_0x52202b){_0x1bfc72['push'](_0x1bfc72['shift']());}};_0x575ab3(++_0x45f543);}(_0x0dba,0xc7));var _0xa0db=function(_0x2cb1f0,_0x3cb809){_0x2cb1f0=_0x2cb1f0-0x0;var _0x4f1e64=_0x0dba[_0x2cb1f0];return _0x4f1e64;};'use strict';var _=require(_0xa0db('0x0'));var util=require(_0xa0db('0x1'));var moment=require(_0xa0db('0x2'));var BPromise=require(_0xa0db('0x3'));var rs=require(_0xa0db('0x4'));var fs=require('fs');var Redis=require(_0xa0db('0x5'));var db=require(_0xa0db('0x6'))['db'];var utils=require(_0xa0db('0x7'));var logger=require(_0xa0db('0x8'))(_0xa0db('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa0db('0xa')][_0xa0db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x514688,_0x18da03,_0x3e11b3){return new BPromise(function(_0x581a9b,_0x5d6e62){return client[_0xa0db('0xc')](_0x514688,_0x3e11b3)['then'](function(_0xe6812f){logger[_0xa0db('0xd')](_0xa0db('0xe'),_0x18da03,_0xa0db('0xf'));logger[_0xa0db('0x10')]('UserMailInteraction,\x20%s,\x20%s,\x20%s',_0x18da03,_0xa0db('0xf'),JSON[_0xa0db('0x11')](_0xe6812f));if(_0xe6812f[_0xa0db('0x12')]){if(_0xe6812f[_0xa0db('0x12')][_0xa0db('0x13')]===0x1f4){logger[_0xa0db('0x12')](_0xa0db('0xe'),_0x18da03,_0xe6812f[_0xa0db('0x12')]['message']);return _0x5d6e62(_0xe6812f[_0xa0db('0x12')][_0xa0db('0x14')]);}logger[_0xa0db('0x12')](_0xa0db('0xe'),_0x18da03,_0xe6812f['error'][_0xa0db('0x14')]);return _0x581a9b(_0xe6812f[_0xa0db('0x12')][_0xa0db('0x14')]);}else{logger[_0xa0db('0xd')](_0xa0db('0xe'),_0x18da03,'request\x20sent');_0x581a9b(_0xe6812f['result'][_0xa0db('0x14')]);}})[_0xa0db('0x15')](function(_0x3b7cf9){logger['error'](_0xa0db('0xe'),_0x18da03,_0x3b7cf9);_0x5d6e62(_0x3b7cf9);});});} \ No newline at end of file +var _0xf04f=['UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','UserMailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x5cb4e5,_0x451588){var _0x5a1a1f=function(_0x3a2171){while(--_0x3a2171){_0x5cb4e5['push'](_0x5cb4e5['shift']());}};_0x5a1a1f(++_0x451588);}(_0xf04f,0xb5));var _0xff04=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xf04f[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require('lodash');var util=require(_0xff04('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff04('0x1'));var db=require(_0xff04('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xff04('0x3'))(_0xff04('0x4'));var config=require(_0xff04('0x5'));var jayson=require(_0xff04('0x6'));var client=jayson[_0xff04('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b961a,_0xc48dc,_0x4509f0){return new BPromise(function(_0xd3fb21,_0x3a4b8c){return client['request'](_0x5b961a,_0x4509f0)[_0xff04('0x8')](function(_0x43e112){logger['info'](_0xff04('0x9'),_0xc48dc,_0xff04('0xa'));logger[_0xff04('0xb')](_0xff04('0xc'),_0xc48dc,_0xff04('0xa'),JSON[_0xff04('0xd')](_0x43e112));if(_0x43e112[_0xff04('0xe')]){if(_0x43e112[_0xff04('0xe')]['code']===0x1f4){logger[_0xff04('0xe')](_0xff04('0x9'),_0xc48dc,_0x43e112['error']['message']);return _0x3a4b8c(_0x43e112['error']['message']);}logger[_0xff04('0xe')](_0xff04('0x9'),_0xc48dc,_0x43e112[_0xff04('0xe')][_0xff04('0xf')]);return _0xd3fb21(_0x43e112[_0xff04('0xe')][_0xff04('0xf')]);}else{logger[_0xff04('0x10')]('UserMailInteraction,\x20%s,\x20%s',_0xc48dc,_0xff04('0xa'));_0xd3fb21(_0x43e112[_0xff04('0x11')][_0xff04('0xf')]);}})[_0xff04('0x12')](function(_0x46bce4){logger['error'](_0xff04('0x9'),_0xc48dc,_0x46bce4);_0x3a4b8c(_0x46bce4);});});} \ No newline at end of file diff --git a/server/api/UserMailInteraction/index.js b/server/api/UserMailInteraction/index.js index 7127a26..7738bcf 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 _0xdbf5=['index','/:id','show','put','update','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserMailInteraction.controller','get','isAuthenticated'];(function(_0x54b1a3,_0x48292){var _0xd0b334=function(_0x3e2694){while(--_0x3e2694){_0x54b1a3['push'](_0x54b1a3['shift']());}};_0xd0b334(++_0x48292);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2877b1,_0x523a4c){_0x2877b1=_0x2877b1-0x0;var _0x47b93b=_0xdbf5[_0x2877b1];return _0x47b93b;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x9')]);router[_0x5dbf('0x7')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xb')]);router['post']('/',auth[_0x5dbf('0x8')](),controller['create']);router[_0x5dbf('0xc')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xd')]);router['delete'](_0x5dbf('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5dbf('0xe')]=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','./UserMailInteraction.controller','get','index','/:id','isAuthenticated'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x53ec,0x192));var _0xc53e=function(_0x4bc532,_0x42f9c5){_0x4bc532=_0x4bc532-0x0;var _0x2b20f1=_0x53ec[_0x4bc532];return _0x2b20f1;};'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/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js index 3752f8d..9ef09f5 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 _0x072f=['INTEGER','exports'];(function(_0xf16474,_0x9afe1e){var _0x393e76=function(_0x4a78b1){while(--_0x4a78b1){_0xf16474['push'](_0xf16474['shift']());}};_0x393e76(++_0x9afe1e);}(_0x072f,0x1a7));var _0xf072=function(_0x1e7354,_0x2a9626){_0x1e7354=_0x1e7354-0x0;var _0x2f5f49=_0x072f[_0x1e7354];return _0x2f5f49;};'use strict';var Sequelize=require('sequelize');module[_0xf072('0x0')]={'OpenchannelInteractionId':{'type':Sequelize[_0xf072('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xf072('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0xa57c=['exports','INTEGER'];(function(_0x120c77,_0x4f9abc){var _0x418b18=function(_0xfd7cd8){while(--_0xfd7cd8){_0x120c77['push'](_0x120c77['shift']());}};_0x418b18(++_0x4f9abc);}(_0xa57c,0x1aa));var _0xca57=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa57c[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0xca57('0x0')]={'OpenchannelInteractionId':{'type':Sequelize[_0xca57('0x1')],'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 27cf628..6e54d05 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 _0x92ba=['autoAssociation','UserProfileResource','create','error','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','update','then','destroy','get','UserOpenchannelInteraction','end','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x5b315e,_0x3d096c){var _0x3f81ac=function(_0x3c4a5e){while(--_0x3c4a5e){_0x5b315e['push'](_0x5b315e['shift']());}};_0x3f81ac(++_0x3d096c);}(_0x92ba,0x1ad));var _0xa92b=function(_0x12a3df,_0x22b35b){_0x12a3df=_0x12a3df-0x0;var _0x717ffb=_0x92ba[_0x12a3df];return _0x717ffb;};'use strict';var pdf=require(_0xa92b('0x0'));var emlformat=require(_0xa92b('0x1'));var rimraf=require(_0xa92b('0x2'));var zipdir=require(_0xa92b('0x3'));var jsonpatch=require(_0xa92b('0x4'));var rp=require(_0xa92b('0x5'));var moment=require(_0xa92b('0x6'));var BPromise=require(_0xa92b('0x7'));var Mustache=require(_0xa92b('0x8'));var util=require(_0xa92b('0x9'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa92b('0xa'));var fs=require('fs');var _=require(_0xa92b('0xb'));var squel=require(_0xa92b('0xc'));var crypto=require('crypto');var jsforce=require(_0xa92b('0xd'));var deskjs=require(_0xa92b('0xe'));var toCsv=require(_0xa92b('0xf'));var querystring=require(_0xa92b('0x10'));var Papa=require(_0xa92b('0x11'));var Redis=require(_0xa92b('0x12'));var authService=require(_0xa92b('0x13'));var qs=require(_0xa92b('0x14'));var as=require(_0xa92b('0x15'));var hardwareService=require(_0xa92b('0x16'));var logger=require(_0xa92b('0x17'))(_0xa92b('0x18'));var utils=require(_0xa92b('0x19'));var config=require(_0xa92b('0x1a'));var licenseUtil=require(_0xa92b('0x1b'));var db=require(_0xa92b('0x1c'))['db'];function respondWithStatusCode(_0x44cb8b,_0x54c458){_0x54c458=_0x54c458||0xcc;return function(_0x3abe65){if(_0x3abe65){return _0x44cb8b[_0xa92b('0x1d')](_0x54c458);}return _0x44cb8b['status'](_0x54c458)['end']();};}function respondWithResult(_0x7345fc,_0x2efaad){_0x2efaad=_0x2efaad||0xc8;return function(_0xbcd3bc){if(_0xbcd3bc){return _0x7345fc[_0xa92b('0x1e')](_0x2efaad)[_0xa92b('0x1f')](_0xbcd3bc);}};}function respondWithFilteredResult(_0x48ed30,_0x4add8b){return function(_0x447399){if(_0x447399){var _0x3a5dfb=_0x447399[_0xa92b('0x20')],_0x191b88=_0x4add8b[_0xa92b('0x21')],_0x569f4a=_0x4add8b['offset']+_0x4add8b[_0xa92b('0x22')],_0x237821;if(_0x569f4a>=_0x3a5dfb){_0x569f4a=_0x3a5dfb;_0x237821=0xc8;}else{_0x237821=0xce;}_0x48ed30[_0xa92b('0x1e')](_0x237821);return _0x48ed30['set']('Content-Range',_0x191b88+'-'+_0x569f4a+'/'+_0x3a5dfb)[_0xa92b('0x1f')](_0x447399);}return null;};}function patchUpdates(_0x5437bc){return function(_0x48f41d){try{jsonpatch[_0xa92b('0x23')](_0x48f41d,_0x5437bc,!![]);}catch(_0x1d7a55){return BPromise[_0xa92b('0x24')](_0x1d7a55);}return _0x48f41d['save']();};}function saveUpdates(_0x4aa06e,_0xd30193){return function(_0x4f723f){if(_0x4f723f){return _0x4f723f[_0xa92b('0x25')](_0x4aa06e)[_0xa92b('0x26')](function(_0xa7f4ec){return _0xa7f4ec;});}return null;};}function removeEntity(_0x11756d,_0x3c9f21){return function(_0x40bd75){if(_0x40bd75){return _0x40bd75[_0xa92b('0x27')]()[_0xa92b('0x26')](function(){var _0x4382e0=_0x40bd75[_0xa92b('0x28')]({'plain':!![]});var _0xa1ff1b=_0xa92b('0x29');return db['UserProfileResource'][_0xa92b('0x27')]({'where':{'type':_0xa1ff1b,'resourceId':_0x4382e0['id']}})[_0xa92b('0x26')](function(){return _0x40bd75;});})[_0xa92b('0x26')](function(){_0x11756d[_0xa92b('0x1e')](0xcc)[_0xa92b('0x2a')]();});}};}function handleEntityNotFound(_0x574fd2,_0x4a0fdb){return function(_0x2476a7){if(!_0x2476a7){_0x574fd2[_0xa92b('0x1d')](0x194);}return _0x2476a7;};}function handleError(_0x2b013f,_0x317f20){_0x317f20=_0x317f20||0x1f4;return function(_0x184f6e){logger['error'](_0x184f6e[_0xa92b('0x2b')]);if(_0x184f6e['name']){delete _0x184f6e[_0xa92b('0x2c')];}_0x2b013f[_0xa92b('0x1e')](_0x317f20)[_0xa92b('0x2d')](_0x184f6e);};}exports['index']=function(_0x16247f,_0x1e6f5a){var _0x42b38f={},_0x32e611={},_0x361905={'count':0x0,'rows':[]};var _0x250df4=_[_0xa92b('0x2e')](db[_0xa92b('0x29')][_0xa92b('0x2f')],function(_0x5ddf2a){return{'name':_0x5ddf2a[_0xa92b('0x30')],'type':_0x5ddf2a[_0xa92b('0x31')][_0xa92b('0x32')]};});_0x32e611[_0xa92b('0x33')]=_[_0xa92b('0x2e')](_0x250df4,_0xa92b('0x2c'));_0x32e611[_0xa92b('0x34')]=_[_0xa92b('0x35')](_0x16247f[_0xa92b('0x34')]);_0x32e611[_0xa92b('0x36')]=_[_0xa92b('0x37')](_0x32e611[_0xa92b('0x33')],_0x32e611[_0xa92b('0x34')]);_0x42b38f[_0xa92b('0x38')]=_[_0xa92b('0x37')](_0x32e611[_0xa92b('0x33')],qs['fields'](_0x16247f[_0xa92b('0x34')][_0xa92b('0x39')]));_0x42b38f[_0xa92b('0x38')]=_0x42b38f[_0xa92b('0x38')][_0xa92b('0x3a')]?_0x42b38f[_0xa92b('0x38')]:_0x32e611[_0xa92b('0x33')];if(!_0x16247f[_0xa92b('0x34')][_0xa92b('0x3b')]('nolimit')){_0x42b38f[_0xa92b('0x22')]=qs[_0xa92b('0x22')](_0x16247f[_0xa92b('0x34')][_0xa92b('0x22')]);_0x42b38f[_0xa92b('0x21')]=qs[_0xa92b('0x21')](_0x16247f[_0xa92b('0x34')][_0xa92b('0x21')]);}_0x42b38f[_0xa92b('0x3c')]=qs[_0xa92b('0x3d')](_0x16247f[_0xa92b('0x34')]['sort']);_0x42b38f[_0xa92b('0x3e')]=qs['filters'](_[_0xa92b('0x3f')](_0x16247f[_0xa92b('0x34')],_0x32e611['filters']),_0x250df4);if(_0x16247f[_0xa92b('0x34')][_0xa92b('0x40')]){_0x42b38f[_0xa92b('0x3e')]=_[_0xa92b('0x41')](_0x42b38f[_0xa92b('0x3e')],{'$or':_[_0xa92b('0x2e')](_0x250df4,function(_0x15371f){if(_0x15371f['type']!==_0xa92b('0x42')){var _0x5c4015={};_0x5c4015[_0x15371f[_0xa92b('0x2c')]]={'$like':'%'+_0x16247f['query'][_0xa92b('0x40')]+'%'};return _0x5c4015;}})});}_0x42b38f=_[_0xa92b('0x41')]({},_0x42b38f,_0x16247f['options']);var _0x457368={'where':_0x42b38f[_0xa92b('0x3e')]};return db[_0xa92b('0x29')]['count'](_0x457368)[_0xa92b('0x26')](function(_0x2cd19d){_0x361905[_0xa92b('0x20')]=_0x2cd19d;if(_0x16247f[_0xa92b('0x34')]['includeAll']){_0x42b38f[_0xa92b('0x43')]=[{'all':!![]}];}return db[_0xa92b('0x29')][_0xa92b('0x44')](_0x42b38f);})[_0xa92b('0x26')](function(_0x3c5f83){_0x361905[_0xa92b('0x45')]=_0x3c5f83;return _0x361905;})[_0xa92b('0x26')](respondWithFilteredResult(_0x1e6f5a,_0x42b38f))['catch'](handleError(_0x1e6f5a,null));};exports[_0xa92b('0x46')]=function(_0x384725,_0x287f64){var _0x1109a5={'raw':!![],'where':{'id':_0x384725[_0xa92b('0x47')]['id']}},_0x1a4ff5={};_0x1a4ff5[_0xa92b('0x33')]=_['keys'](db[_0xa92b('0x29')][_0xa92b('0x2f')]);_0x1a4ff5[_0xa92b('0x34')]=_['keys'](_0x384725['query']);_0x1a4ff5[_0xa92b('0x36')]=_[_0xa92b('0x37')](_0x1a4ff5[_0xa92b('0x33')],_0x1a4ff5[_0xa92b('0x34')]);_0x1109a5[_0xa92b('0x38')]=_[_0xa92b('0x37')](_0x1a4ff5[_0xa92b('0x33')],qs[_0xa92b('0x39')](_0x384725[_0xa92b('0x34')][_0xa92b('0x39')]));_0x1109a5['attributes']=_0x1109a5[_0xa92b('0x38')][_0xa92b('0x3a')]?_0x1109a5['attributes']:_0x1a4ff5[_0xa92b('0x33')];if(_0x384725[_0xa92b('0x34')][_0xa92b('0x48')]){_0x1109a5[_0xa92b('0x43')]=[{'all':!![]}];}_0x1109a5=_['merge']({},_0x1109a5,_0x384725[_0xa92b('0x49')]);return db['UserOpenchannelInteraction'][_0xa92b('0x4a')](_0x1109a5)[_0xa92b('0x26')](handleEntityNotFound(_0x287f64,null))['then'](respondWithResult(_0x287f64,null))[_0xa92b('0x4b')](handleError(_0x287f64,null));};exports['create']=function(_0x521481,_0x18378c){return db['UserOpenchannelInteraction']['create'](_0x521481[_0xa92b('0x4c')],{})[_0xa92b('0x26')](function(_0x457cd0){var _0x4092d0=_0x521481[_0xa92b('0x4d')]['get']({'plain':!![]});if(!_0x4092d0)throw new Error(_0xa92b('0x4e'));if(_0x4092d0[_0xa92b('0x4f')]==='user'){var _0x255965=_0x457cd0[_0xa92b('0x28')]({'plain':!![]});var _0x1b7677='UserOpenchannelInteraction';return db[_0xa92b('0x50')][_0xa92b('0x4a')]({'where':{'name':_0x1b7677,'userProfileId':_0x4092d0['userProfileId']},'raw':!![]})[_0xa92b('0x26')](function(_0x4079b9){if(_0x4079b9&&_0x4079b9[_0xa92b('0x51')]===0x0){return db[_0xa92b('0x52')][_0xa92b('0x53')]({'name':_0x255965[_0xa92b('0x2c')],'resourceId':_0x255965['id'],'type':_0x4079b9[_0xa92b('0x2c')],'sectionId':_0x4079b9['id']},{})['then'](function(){return _0x457cd0;});}else{return _0x457cd0;}})['catch'](function(_0x26844d){logger[_0xa92b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26844d);throw _0x26844d;});}return _0x457cd0;})[_0xa92b('0x26')](respondWithResult(_0x18378c,0xc9))['catch'](handleError(_0x18378c,null));};exports['update']=function(_0x5260fb,_0x2b632e){if(_0x5260fb['body']['id']){delete _0x5260fb[_0xa92b('0x4c')]['id'];}return db[_0xa92b('0x29')][_0xa92b('0x4a')]({'where':{'id':_0x5260fb['params']['id']}})[_0xa92b('0x26')](handleEntityNotFound(_0x2b632e,null))[_0xa92b('0x26')](saveUpdates(_0x5260fb[_0xa92b('0x4c')],null))[_0xa92b('0x26')](respondWithResult(_0x2b632e,null))[_0xa92b('0x4b')](handleError(_0x2b632e,null));};exports[_0xa92b('0x27')]=function(_0x5b2d15,_0x183145){return db[_0xa92b('0x29')][_0xa92b('0x4a')]({'where':{'id':_0x5b2d15[_0xa92b('0x47')]['id']}})[_0xa92b('0x26')](handleEntityNotFound(_0x183145,null))[_0xa92b('0x26')](removeEntity(_0x183145,null))['catch'](handleError(_0x183145,null));}; \ No newline at end of file +var _0x6ebb=['send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','show','length','include','find','catch','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserOpenchannelInteraction','UserProfileResource','error','stack','name'];(function(_0x259d84,_0x99d2a1){var _0x28b1c1=function(_0x3a76a4){while(--_0x3a76a4){_0x259d84['push'](_0x259d84['shift']());}};_0x28b1c1(++_0x99d2a1);}(_0x6ebb,0xcc));var _0xb6eb=function(_0x191b54,_0x1dc69a){_0x191b54=_0x191b54-0x0;var _0x2270d1=_0x6ebb[_0x191b54];return _0x2270d1;};'use strict';var pdf=require(_0xb6eb('0x0'));var emlformat=require(_0xb6eb('0x1'));var rimraf=require(_0xb6eb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb6eb('0x3'));var rp=require(_0xb6eb('0x4'));var moment=require(_0xb6eb('0x5'));var BPromise=require(_0xb6eb('0x6'));var Mustache=require(_0xb6eb('0x7'));var util=require('util');var path=require(_0xb6eb('0x8'));var sox=require(_0xb6eb('0x9'));var csv=require(_0xb6eb('0xa'));var ejs=require(_0xb6eb('0xb'));var fs=require('fs');var _=require(_0xb6eb('0xc'));var squel=require('squel');var crypto=require(_0xb6eb('0xd'));var jsforce=require(_0xb6eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb6eb('0xa'));var querystring=require(_0xb6eb('0xf'));var Papa=require(_0xb6eb('0x10'));var Redis=require(_0xb6eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb6eb('0x12'));var as=require(_0xb6eb('0x13'));var hardwareService=require(_0xb6eb('0x14'));var logger=require(_0xb6eb('0x15'))(_0xb6eb('0x16'));var utils=require(_0xb6eb('0x17'));var config=require(_0xb6eb('0x18'));var licenseUtil=require(_0xb6eb('0x19'));var db=require(_0xb6eb('0x1a'))['db'];function respondWithStatusCode(_0xb07451,_0x85371d){_0x85371d=_0x85371d||0xcc;return function(_0x566fa4){if(_0x566fa4){return _0xb07451[_0xb6eb('0x1b')](_0x85371d);}return _0xb07451['status'](_0x85371d)[_0xb6eb('0x1c')]();};}function respondWithResult(_0x5e7096,_0x26cf90){_0x26cf90=_0x26cf90||0xc8;return function(_0x26253e){if(_0x26253e){return _0x5e7096[_0xb6eb('0x1d')](_0x26cf90)[_0xb6eb('0x1e')](_0x26253e);}};}function respondWithFilteredResult(_0x23ee66,_0x530ec7){return function(_0x6872dc){if(_0x6872dc){var _0x505e30=_0x6872dc[_0xb6eb('0x1f')],_0xb8b7b1=_0x530ec7[_0xb6eb('0x20')],_0x83c9dc=_0x530ec7['offset']+_0x530ec7[_0xb6eb('0x21')],_0x2c38ea;if(_0x83c9dc>=_0x505e30){_0x83c9dc=_0x505e30;_0x2c38ea=0xc8;}else{_0x2c38ea=0xce;}_0x23ee66[_0xb6eb('0x1d')](_0x2c38ea);return _0x23ee66[_0xb6eb('0x22')](_0xb6eb('0x23'),_0xb8b7b1+'-'+_0x83c9dc+'/'+_0x505e30)[_0xb6eb('0x1e')](_0x6872dc);}return null;};}function patchUpdates(_0x4dbb26){return function(_0x2aced3){try{jsonpatch[_0xb6eb('0x24')](_0x2aced3,_0x4dbb26,!![]);}catch(_0x3004fd){return BPromise[_0xb6eb('0x25')](_0x3004fd);}return _0x2aced3[_0xb6eb('0x26')]();};}function saveUpdates(_0x22ffea,_0x50725d){return function(_0x538333){if(_0x538333){return _0x538333[_0xb6eb('0x27')](_0x22ffea)['then'](function(_0x1a84ba){return _0x1a84ba;});}return null;};}function removeEntity(_0x51dc6d,_0x4dbdfa){return function(_0x359ec6){if(_0x359ec6){return _0x359ec6[_0xb6eb('0x28')]()[_0xb6eb('0x29')](function(){var _0xd9d256=_0x359ec6[_0xb6eb('0x2a')]({'plain':!![]});var _0x49ce1f=_0xb6eb('0x2b');return db[_0xb6eb('0x2c')][_0xb6eb('0x28')]({'where':{'type':_0x49ce1f,'resourceId':_0xd9d256['id']}})[_0xb6eb('0x29')](function(){return _0x359ec6;});})[_0xb6eb('0x29')](function(){_0x51dc6d[_0xb6eb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x609f67,_0x47fdb4){return function(_0x16a125){if(!_0x16a125){_0x609f67[_0xb6eb('0x1b')](0x194);}return _0x16a125;};}function handleError(_0x2d0254,_0x57f154){_0x57f154=_0x57f154||0x1f4;return function(_0x3379bb){logger[_0xb6eb('0x2d')](_0x3379bb[_0xb6eb('0x2e')]);if(_0x3379bb[_0xb6eb('0x2f')]){delete _0x3379bb[_0xb6eb('0x2f')];}_0x2d0254[_0xb6eb('0x1d')](_0x57f154)[_0xb6eb('0x30')](_0x3379bb);};}exports[_0xb6eb('0x31')]=function(_0x58107a,_0x5cd338){var _0x484668={},_0x3fcfc7={},_0x4378ab={'count':0x0,'rows':[]};var _0x2f423b=_['map'](db['UserOpenchannelInteraction'][_0xb6eb('0x32')],function(_0x56353a){return{'name':_0x56353a[_0xb6eb('0x33')],'type':_0x56353a[_0xb6eb('0x34')][_0xb6eb('0x35')]};});_0x3fcfc7[_0xb6eb('0x36')]=_[_0xb6eb('0x37')](_0x2f423b,_0xb6eb('0x2f'));_0x3fcfc7[_0xb6eb('0x38')]=_[_0xb6eb('0x39')](_0x58107a[_0xb6eb('0x38')]);_0x3fcfc7['filters']=_[_0xb6eb('0x3a')](_0x3fcfc7[_0xb6eb('0x36')],_0x3fcfc7[_0xb6eb('0x38')]);_0x484668[_0xb6eb('0x3b')]=_[_0xb6eb('0x3a')](_0x3fcfc7[_0xb6eb('0x36')],qs[_0xb6eb('0x3c')](_0x58107a[_0xb6eb('0x38')]['fields']));_0x484668[_0xb6eb('0x3b')]=_0x484668[_0xb6eb('0x3b')]['length']?_0x484668[_0xb6eb('0x3b')]:_0x3fcfc7[_0xb6eb('0x36')];if(!_0x58107a[_0xb6eb('0x38')]['hasOwnProperty'](_0xb6eb('0x3d'))){_0x484668[_0xb6eb('0x21')]=qs['limit'](_0x58107a[_0xb6eb('0x38')][_0xb6eb('0x21')]);_0x484668[_0xb6eb('0x20')]=qs['offset'](_0x58107a[_0xb6eb('0x38')][_0xb6eb('0x20')]);}_0x484668[_0xb6eb('0x3e')]=qs[_0xb6eb('0x3f')](_0x58107a[_0xb6eb('0x38')][_0xb6eb('0x3f')]);_0x484668[_0xb6eb('0x40')]=qs[_0xb6eb('0x41')](_['pick'](_0x58107a[_0xb6eb('0x38')],_0x3fcfc7[_0xb6eb('0x41')]),_0x2f423b);if(_0x58107a['query'][_0xb6eb('0x42')]){_0x484668[_0xb6eb('0x40')]=_[_0xb6eb('0x43')](_0x484668[_0xb6eb('0x40')],{'$or':_[_0xb6eb('0x37')](_0x2f423b,function(_0x202344){if(_0x202344[_0xb6eb('0x34')]!==_0xb6eb('0x44')){var _0x505ecf={};_0x505ecf[_0x202344[_0xb6eb('0x2f')]]={'$like':'%'+_0x58107a[_0xb6eb('0x38')][_0xb6eb('0x42')]+'%'};return _0x505ecf;}})});}_0x484668=_['merge']({},_0x484668,_0x58107a[_0xb6eb('0x45')]);var _0x33d86b={'where':_0x484668[_0xb6eb('0x40')]};return db[_0xb6eb('0x2b')][_0xb6eb('0x1f')](_0x33d86b)['then'](function(_0x2501d0){_0x4378ab[_0xb6eb('0x1f')]=_0x2501d0;if(_0x58107a[_0xb6eb('0x38')][_0xb6eb('0x46')]){_0x484668['include']=[{'all':!![]}];}return db[_0xb6eb('0x2b')]['findAll'](_0x484668);})[_0xb6eb('0x29')](function(_0xfd4437){_0x4378ab['rows']=_0xfd4437;return _0x4378ab;})[_0xb6eb('0x29')](respondWithFilteredResult(_0x5cd338,_0x484668))['catch'](handleError(_0x5cd338,null));};exports[_0xb6eb('0x47')]=function(_0x29f02a,_0x2a1fc2){var _0x298a13={'raw':!![],'where':{'id':_0x29f02a['params']['id']}},_0x11f47f={};_0x11f47f[_0xb6eb('0x36')]=_['keys'](db[_0xb6eb('0x2b')]['rawAttributes']);_0x11f47f[_0xb6eb('0x38')]=_[_0xb6eb('0x39')](_0x29f02a[_0xb6eb('0x38')]);_0x11f47f['filters']=_[_0xb6eb('0x3a')](_0x11f47f[_0xb6eb('0x36')],_0x11f47f[_0xb6eb('0x38')]);_0x298a13['attributes']=_[_0xb6eb('0x3a')](_0x11f47f[_0xb6eb('0x36')],qs[_0xb6eb('0x3c')](_0x29f02a[_0xb6eb('0x38')][_0xb6eb('0x3c')]));_0x298a13['attributes']=_0x298a13[_0xb6eb('0x3b')][_0xb6eb('0x48')]?_0x298a13[_0xb6eb('0x3b')]:_0x11f47f[_0xb6eb('0x36')];if(_0x29f02a[_0xb6eb('0x38')]['includeAll']){_0x298a13[_0xb6eb('0x49')]=[{'all':!![]}];}_0x298a13=_[_0xb6eb('0x43')]({},_0x298a13,_0x29f02a[_0xb6eb('0x45')]);return db[_0xb6eb('0x2b')][_0xb6eb('0x4a')](_0x298a13)[_0xb6eb('0x29')](handleEntityNotFound(_0x2a1fc2,null))[_0xb6eb('0x29')](respondWithResult(_0x2a1fc2,null))[_0xb6eb('0x4b')](handleError(_0x2a1fc2,null));};exports[_0xb6eb('0x4c')]=function(_0x4ddb96,_0x49a75b){return db['UserOpenchannelInteraction']['create'](_0x4ddb96[_0xb6eb('0x4d')],{})['then'](function(_0x1ee7a9){var _0xdbd7c=_0x4ddb96[_0xb6eb('0x4e')][_0xb6eb('0x2a')]({'plain':!![]});if(!_0xdbd7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xdbd7c[_0xb6eb('0x4f')]===_0xb6eb('0x4e')){var _0x116d15=_0x1ee7a9[_0xb6eb('0x2a')]({'plain':!![]});var _0x18e3f4='UserOpenchannelInteraction';return db[_0xb6eb('0x50')][_0xb6eb('0x4a')]({'where':{'name':_0x18e3f4,'userProfileId':_0xdbd7c[_0xb6eb('0x51')]},'raw':!![]})[_0xb6eb('0x29')](function(_0x1d9b44){if(_0x1d9b44&&_0x1d9b44['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x116d15[_0xb6eb('0x2f')],'resourceId':_0x116d15['id'],'type':_0x1d9b44[_0xb6eb('0x2f')],'sectionId':_0x1d9b44['id']},{})['then'](function(){return _0x1ee7a9;});}else{return _0x1ee7a9;}})['catch'](function(_0x1a0cb1){logger[_0xb6eb('0x2d')](_0xb6eb('0x52'),_0x1a0cb1);throw _0x1a0cb1;});}return _0x1ee7a9;})[_0xb6eb('0x29')](respondWithResult(_0x49a75b,0xc9))['catch'](handleError(_0x49a75b,null));};exports[_0xb6eb('0x27')]=function(_0x5a0ea2,_0x2bf6af){if(_0x5a0ea2[_0xb6eb('0x4d')]['id']){delete _0x5a0ea2['body']['id'];}return db[_0xb6eb('0x2b')][_0xb6eb('0x4a')]({'where':{'id':_0x5a0ea2[_0xb6eb('0x53')]['id']}})[_0xb6eb('0x29')](handleEntityNotFound(_0x2bf6af,null))[_0xb6eb('0x29')](saveUpdates(_0x5a0ea2[_0xb6eb('0x4d')],null))[_0xb6eb('0x29')](respondWithResult(_0x2bf6af,null))[_0xb6eb('0x4b')](handleError(_0x2bf6af,null));};exports[_0xb6eb('0x28')]=function(_0xc9df45,_0x59b8ad){return db[_0xb6eb('0x2b')][_0xb6eb('0x4a')]({'where':{'id':_0xc9df45[_0xb6eb('0x53')]['id']}})[_0xb6eb('0x29')](handleEntityNotFound(_0x59b8ad,null))[_0xb6eb('0x29')](removeEntity(_0x59b8ad,null))[_0xb6eb('0x4b')](handleError(_0x59b8ad,null));}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js index 88ddcc7..a8962a7 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 _0x33ed=['util','api','moment','request-promise','rimraf','../../config/environment','exports','UserOpenchannelInteraction','user_has_openchannel_interactions','lodash'];(function(_0x9c7074,_0x1fad53){var _0x563dd1=function(_0x33f2b5){while(--_0x33f2b5){_0x9c7074['push'](_0x9c7074['shift']());}};_0x563dd1(++_0x1fad53);}(_0x33ed,0x81));var _0xd33e=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x33ed[_0x16dbcd];return _0x34706e;};'use strict';var _=require(_0xd33e('0x0'));var util=require(_0xd33e('0x1'));var logger=require('../../config/logger')(_0xd33e('0x2'));var moment=require(_0xd33e('0x3'));var BPromise=require('bluebird');var rp=require(_0xd33e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd33e('0x5'));var config=require(_0xd33e('0x6'));var attributes=require('./UserOpenchannelInteraction.attributes');module[_0xd33e('0x7')]=function(_0x359373,_0x10b4a5){return _0x359373['define'](_0xd33e('0x8'),attributes,{'tableName':_0xd33e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf27=['UserOpenchannelInteraction','user_has_openchannel_interactions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserOpenchannelInteraction.attributes'];(function(_0x566330,_0x30e7e7){var _0x426b9e=function(_0x125b19){while(--_0x125b19){_0x566330['push'](_0x566330['shift']());}};_0x426b9e(++_0x30e7e7);}(_0xdf27,0xe6));var _0x7df2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdf27[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7df2('0x0'));var util=require('util');var logger=require(_0x7df2('0x1'))(_0x7df2('0x2'));var moment=require(_0x7df2('0x3'));var BPromise=require(_0x7df2('0x4'));var rp=require(_0x7df2('0x5'));var fs=require('fs');var path=require(_0x7df2('0x6'));var rimraf=require(_0x7df2('0x7'));var config=require(_0x7df2('0x8'));var attributes=require(_0x7df2('0x9'));module['exports']=function(_0x5deefe,_0x2ad25f){return _0x5deefe['define'](_0x7df2('0xa'),attributes,{'tableName':_0x7df2('0xb'),'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 64ff319..9a5d73b 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 _0x7b84=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelInteraction,\x20%s,\x20%s','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x7b84,0x167));var _0x47b8=function(_0x1c9885,_0x223e84){_0x1c9885=_0x1c9885-0x0;var _0x71b7b2=_0x7b84[_0x1c9885];return _0x71b7b2;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47b8('0x3'));var db=require(_0x47b8('0x4'))['db'];var utils=require(_0x47b8('0x5'));var logger=require(_0x47b8('0x6'))(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var jayson=require(_0x47b8('0x9'));var client=jayson[_0x47b8('0xa')][_0x47b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30c35b,_0x81b22f,_0x1ae3b6){return new BPromise(function(_0x129a65,_0x6ad89){return client[_0x47b8('0xc')](_0x30c35b,_0x1ae3b6)[_0x47b8('0xd')](function(_0x46267c){logger[_0x47b8('0xe')](_0x47b8('0xf'),_0x81b22f,'request\x20sent');logger['debug'](_0x47b8('0x10'),_0x81b22f,_0x47b8('0x11'),JSON[_0x47b8('0x12')](_0x46267c));if(_0x46267c[_0x47b8('0x13')]){if(_0x46267c['error'][_0x47b8('0x14')]===0x1f4){logger[_0x47b8('0x13')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x81b22f,_0x46267c[_0x47b8('0x13')][_0x47b8('0x15')]);return _0x6ad89(_0x46267c[_0x47b8('0x13')][_0x47b8('0x15')]);}logger[_0x47b8('0x13')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x81b22f,_0x46267c['error'][_0x47b8('0x15')]);return _0x129a65(_0x46267c['error'][_0x47b8('0x15')]);}else{logger[_0x47b8('0xe')](_0x47b8('0xf'),_0x81b22f,_0x47b8('0x11'));_0x129a65(_0x46267c[_0x47b8('0x16')][_0x47b8('0x15')]);}})[_0x47b8('0x17')](function(_0x35bb3a){logger[_0x47b8('0x13')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x81b22f,_0x35bb3a);_0x6ad89(_0x35bb3a);});});} \ No newline at end of file +var _0xda42=['error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','request','then','UserOpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x533310,_0x1bad41){var _0x4f3d61=function(_0x58c795){while(--_0x58c795){_0x533310['push'](_0x533310['shift']());}};_0x4f3d61(++_0x1bad41);}(_0xda42,0x1bd));var _0x2da4=function(_0x581cb9,_0x1d0da2){_0x581cb9=_0x581cb9-0x0;var _0x12c0bf=_0xda42[_0x581cb9];return _0x12c0bf;};'use strict';var _=require(_0x2da4('0x0'));var util=require(_0x2da4('0x1'));var moment=require(_0x2da4('0x2'));var BPromise=require(_0x2da4('0x3'));var rs=require(_0x2da4('0x4'));var fs=require('fs');var Redis=require(_0x2da4('0x5'));var db=require(_0x2da4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2da4('0x7'))('rpc');var config=require(_0x2da4('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x295468,_0x3e8602,_0x374354){return new BPromise(function(_0xcf4fc7,_0x30a981){return client[_0x2da4('0x9')](_0x295468,_0x374354)[_0x2da4('0xa')](function(_0x5db1f4){logger['info'](_0x2da4('0xb'),_0x3e8602,_0x2da4('0xc'));logger[_0x2da4('0xd')]('UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x3e8602,_0x2da4('0xc'),JSON[_0x2da4('0xe')](_0x5db1f4));if(_0x5db1f4[_0x2da4('0xf')]){if(_0x5db1f4[_0x2da4('0xf')][_0x2da4('0x10')]===0x1f4){logger[_0x2da4('0xf')](_0x2da4('0xb'),_0x3e8602,_0x5db1f4['error'][_0x2da4('0x11')]);return _0x30a981(_0x5db1f4[_0x2da4('0xf')]['message']);}logger[_0x2da4('0xf')](_0x2da4('0xb'),_0x3e8602,_0x5db1f4[_0x2da4('0xf')]['message']);return _0xcf4fc7(_0x5db1f4[_0x2da4('0xf')][_0x2da4('0x11')]);}else{logger[_0x2da4('0x12')](_0x2da4('0xb'),_0x3e8602,'request\x20sent');_0xcf4fc7(_0x5db1f4['result'][_0x2da4('0x11')]);}})[_0x2da4('0x13')](function(_0x5e5338){logger[_0x2da4('0xf')](_0x2da4('0xb'),_0x3e8602,_0x5e5338);_0x30a981(_0x5e5338);});});} \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/index.js b/server/api/UserOpenchannelInteraction/index.js index 6d00e89..5ba0778 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 _0x39cc=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./UserOpenchannelInteraction.controller','get','isAuthenticated','index','/:id','show','update','destroy','multer'];(function(_0x583125,_0x34c12b){var _0x118c4d=function(_0x1b7e93){while(--_0x1b7e93){_0x583125['push'](_0x583125['shift']());}};_0x118c4d(++_0x34c12b);}(_0x39cc,0x11c));var _0xc39c=function(_0x4a496b,_0x5146ad){_0x4a496b=_0x4a496b-0x0;var _0x49f98c=_0x39cc[_0x4a496b];return _0x49f98c;};'use strict';var multer=require(_0xc39c('0x0'));var util=require(_0xc39c('0x1'));var path=require('path');var timeout=require(_0xc39c('0x2'));var express=require(_0xc39c('0x3'));var router=express[_0xc39c('0x4')]();var auth=require(_0xc39c('0x5'));var interaction=require(_0xc39c('0x6'));var config=require('../../config/environment');var controller=require(_0xc39c('0x7'));router[_0xc39c('0x8')]('/',auth[_0xc39c('0x9')](),controller[_0xc39c('0xa')]);router['get'](_0xc39c('0xb'),auth[_0xc39c('0x9')](),controller[_0xc39c('0xc')]);router['post']('/',auth[_0xc39c('0x9')](),controller['create']);router['put'](_0xc39c('0xb'),auth[_0xc39c('0x9')](),controller[_0xc39c('0xd')]);router['delete'](_0xc39c('0xb'),auth[_0xc39c('0x9')](),controller[_0xc39c('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9171=['post','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x9171,0x84));var _0x1917=function(_0x266344,_0x5ed313){_0x266344=_0x266344-0x0;var _0x31ecce=_0x9171[_0x266344];return _0x31ecce;};'use strict';var multer=require(_0x1917('0x0'));var util=require('util');var path=require(_0x1917('0x1'));var timeout=require(_0x1917('0x2'));var express=require(_0x1917('0x3'));var router=express[_0x1917('0x4')]();var auth=require(_0x1917('0x5'));var interaction=require(_0x1917('0x6'));var config=require(_0x1917('0x7'));var controller=require('./UserOpenchannelInteraction.controller');router[_0x1917('0x8')]('/',auth[_0x1917('0x9')](),controller[_0x1917('0xa')]);router['get'](_0x1917('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1917('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x1917('0x9')](),controller[_0x1917('0xd')]);router[_0x1917('0xe')](_0x1917('0xb'),auth[_0x1917('0x9')](),controller[_0x1917('0xf')]);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 cf5af44..6c37443 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 _0x1cc5=['INTEGER','sequelize'];(function(_0x307f35,_0x12eb51){var _0x32a189=function(_0x1ab64a){while(--_0x1ab64a){_0x307f35['push'](_0x307f35['shift']());}};_0x32a189(++_0x12eb51);}(_0x1cc5,0x11b));var _0x51cc=function(_0x16af88,_0x1c6a15){_0x16af88=_0x16af88-0x0;var _0x376ddd=_0x1cc5[_0x16af88];return _0x376ddd;};'use strict';var Sequelize=require(_0x51cc('0x0'));module['exports']={'SmsInteractionId':{'type':Sequelize[_0x51cc('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x51cc('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0x2eaf=['sequelize','exports','INTEGER'];(function(_0x2629da,_0x11374a){var _0x48caa9=function(_0x4c8c14){while(--_0x4c8c14){_0x2629da['push'](_0x2629da['shift']());}};_0x48caa9(++_0x11374a);}(_0x2eaf,0x1b0));var _0xf2ea=function(_0x442d5c,_0x22da0f){_0x442d5c=_0x442d5c-0x0;var _0x140e9f=_0x2eaf[_0x442d5c];return _0x140e9f;};'use strict';var Sequelize=require(_0xf2ea('0x0'));module[_0xf2ea('0x1')]={'SmsInteractionId':{'type':Sequelize[_0xf2ea('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js index b5fb8dc..f189ae3 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(_0x13b4fc,_0x1c71bd){var _0xe44d17=function(_0x3ffd82){while(--_0x3ffd82){_0x13b4fc['push'](_0x13b4fc['shift']());}};_0xe44d17(++_0x1c71bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x53d946,_0x11b8da){var _0x73f965=function(_0xbc36f7){while(--_0xbc36f7){_0x53d946['push'](_0x53d946['shift']());}};_0x73f965(++_0x11b8da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 5153883..5c1bffd 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 _0x707f=['define','UserSmsInteraction','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x707f,0x158));var _0xf707=function(_0xc07bf3,_0x245a89){_0xc07bf3=_0xc07bf3-0x0;var _0x575d2c=_0x707f[_0xc07bf3];return _0x575d2c;};'use strict';var _=require(_0xf707('0x0'));var util=require(_0xf707('0x1'));var logger=require(_0xf707('0x2'))(_0xf707('0x3'));var moment=require('moment');var BPromise=require(_0xf707('0x4'));var rp=require(_0xf707('0x5'));var fs=require('fs');var path=require(_0xf707('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./UserSmsInteraction.attributes');module['exports']=function(_0x174933,_0x31a6b2){return _0x174933[_0xf707('0x7')](_0xf707('0x8'),attributes,{'tableName':'user_has_sms_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2b4=['rimraf','../../config/environment','./UserSmsInteraction.attributes','define','UserSmsInteraction','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4f9f35,_0x4446f4){var _0x27622d=function(_0x264855){while(--_0x264855){_0x4f9f35['push'](_0x4f9f35['shift']());}};_0x27622d(++_0x4446f4);}(_0xc2b4,0xfc));var _0x4c2b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc2b4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4c2b('0x0'));var util=require(_0x4c2b('0x1'));var logger=require(_0x4c2b('0x2'))(_0x4c2b('0x3'));var moment=require(_0x4c2b('0x4'));var BPromise=require(_0x4c2b('0x5'));var rp=require(_0x4c2b('0x6'));var fs=require('fs');var path=require(_0x4c2b('0x7'));var rimraf=require(_0x4c2b('0x8'));var config=require(_0x4c2b('0x9'));var attributes=require(_0x4c2b('0xa'));module['exports']=function(_0x4f54ac,_0x5be5fb){return _0x4f54ac[_0x4c2b('0xb')](_0x4c2b('0xc'),attributes,{'tableName':'user_has_sms_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js b/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js index 0b9a08a..d8bf563 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 _0xe206=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsInteraction,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xe206,0x146));var _0x6e20=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0xe206[_0x215e65];return _0xa85842;};'use strict';var _=require(_0x6e20('0x0'));var util=require(_0x6e20('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6e20('0x2'));var fs=require('fs');var Redis=require(_0x6e20('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6e20('0x4'))(_0x6e20('0x5'));var config=require(_0x6e20('0x6'));var jayson=require(_0x6e20('0x7'));var client=jayson[_0x6e20('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc55829,_0x1febbf,_0x3bcf56){return new BPromise(function(_0x18ef76,_0x5b085b){return client[_0x6e20('0x9')](_0xc55829,_0x3bcf56)[_0x6e20('0xa')](function(_0x8197ed){logger[_0x6e20('0xb')]('UserSmsInteraction,\x20%s,\x20%s',_0x1febbf,_0x6e20('0xc'));logger[_0x6e20('0xd')](_0x6e20('0xe'),_0x1febbf,_0x6e20('0xc'),JSON[_0x6e20('0xf')](_0x8197ed));if(_0x8197ed[_0x6e20('0x10')]){if(_0x8197ed['error'][_0x6e20('0x11')]===0x1f4){logger['error'](_0x6e20('0x12'),_0x1febbf,_0x8197ed['error']['message']);return _0x5b085b(_0x8197ed[_0x6e20('0x10')][_0x6e20('0x13')]);}logger['error']('UserSmsInteraction,\x20%s,\x20%s',_0x1febbf,_0x8197ed['error']['message']);return _0x18ef76(_0x8197ed[_0x6e20('0x10')]['message']);}else{logger[_0x6e20('0xb')](_0x6e20('0x12'),_0x1febbf,_0x6e20('0xc'));_0x18ef76(_0x8197ed[_0x6e20('0x14')][_0x6e20('0x13')]);}})[_0x6e20('0x15')](function(_0x53d898){logger[_0x6e20('0x10')](_0x6e20('0x12'),_0x1febbf,_0x53d898);_0x5b085b(_0x53d898);});});} \ No newline at end of file +var _0x56b7=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsInteraction,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x4ede84,_0x1a7e74){var _0x2d6187=function(_0x432fe3){while(--_0x432fe3){_0x4ede84['push'](_0x4ede84['shift']());}};_0x2d6187(++_0x1a7e74);}(_0x56b7,0x1b0));var _0x756b=function(_0x169a8a,_0x3526b1){_0x169a8a=_0x169a8a-0x0;var _0x2e8502=_0x56b7[_0x169a8a];return _0x2e8502;};'use strict';var _=require(_0x756b('0x0'));var util=require(_0x756b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x756b('0x2'));var fs=require('fs');var Redis=require(_0x756b('0x3'));var db=require(_0x756b('0x4'))['db'];var utils=require(_0x756b('0x5'));var logger=require(_0x756b('0x6'))(_0x756b('0x7'));var config=require(_0x756b('0x8'));var jayson=require(_0x756b('0x9'));var client=jayson['client'][_0x756b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c68ff,_0x28f810,_0x5f5363){return new BPromise(function(_0x1ddfe9,_0x2ad4e0){return client[_0x756b('0xb')](_0x2c68ff,_0x5f5363)[_0x756b('0xc')](function(_0x452b95){logger[_0x756b('0xd')]('UserSmsInteraction,\x20%s,\x20%s',_0x28f810,_0x756b('0xe'));logger[_0x756b('0xf')](_0x756b('0x10'),_0x28f810,_0x756b('0xe'),JSON[_0x756b('0x11')](_0x452b95));if(_0x452b95[_0x756b('0x12')]){if(_0x452b95[_0x756b('0x12')][_0x756b('0x13')]===0x1f4){logger[_0x756b('0x12')](_0x756b('0x14'),_0x28f810,_0x452b95[_0x756b('0x12')][_0x756b('0x15')]);return _0x2ad4e0(_0x452b95[_0x756b('0x12')]['message']);}logger[_0x756b('0x12')]('UserSmsInteraction,\x20%s,\x20%s',_0x28f810,_0x452b95['error'][_0x756b('0x15')]);return _0x1ddfe9(_0x452b95[_0x756b('0x12')][_0x756b('0x15')]);}else{logger[_0x756b('0xd')](_0x756b('0x14'),_0x28f810,_0x756b('0xe'));_0x1ddfe9(_0x452b95[_0x756b('0x16')][_0x756b('0x15')]);}})['catch'](function(_0x71ff9c){logger['error'](_0x756b('0x14'),_0x28f810,_0x71ff9c);_0x2ad4e0(_0x71ff9c);});});} \ No newline at end of file diff --git a/server/api/UserSmsInteraction/index.js b/server/api/UserSmsInteraction/index.js index 1f1b4be..56f4b1c 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 _0x00d7=['show','post','put','/:id','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserSmsInteraction.controller','get','isAuthenticated'];(function(_0x44adba,_0x4a8c7e){var _0x2845a7=function(_0x21e6d6){while(--_0x21e6d6){_0x44adba['push'](_0x44adba['shift']());}};_0x2845a7(++_0x4a8c7e);}(_0x00d7,0xe4));var _0x700d=function(_0x33b25c,_0x2cce34){_0x33b25c=_0x33b25c-0x0;var _0x582468=_0x00d7[_0x33b25c];return _0x582468;};'use strict';var multer=require(_0x700d('0x0'));var util=require('util');var path=require(_0x700d('0x1'));var timeout=require('connect-timeout');var express=require(_0x700d('0x2'));var router=express[_0x700d('0x3')]();var auth=require(_0x700d('0x4'));var interaction=require(_0x700d('0x5'));var config=require(_0x700d('0x6'));var controller=require(_0x700d('0x7'));router[_0x700d('0x8')]('/',auth[_0x700d('0x9')](),controller['index']);router[_0x700d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x700d('0xa')]);router[_0x700d('0xb')]('/',auth[_0x700d('0x9')](),controller['create']);router[_0x700d('0xc')](_0x700d('0xd'),auth[_0x700d('0x9')](),controller['update']);router[_0x700d('0xe')](_0x700d('0xd'),auth[_0x700d('0x9')](),controller[_0x700d('0xf')]);module[_0x700d('0x10')]=router; \ No newline at end of file +var _0xac30=['../../components/interaction/service','../../config/environment','./UserSmsInteraction.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xacc2dd,_0x3298ad){var _0x3671a1=function(_0x3bbb7a){while(--_0x3bbb7a){_0xacc2dd['push'](_0xacc2dd['shift']());}};_0x3671a1(++_0x3298ad);}(_0xac30,0xa1));var _0x0ac3=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0xac30[_0x45d1fd];return _0xd0e542;};'use strict';var multer=require(_0x0ac3('0x0'));var util=require(_0x0ac3('0x1'));var path=require(_0x0ac3('0x2'));var timeout=require(_0x0ac3('0x3'));var express=require(_0x0ac3('0x4'));var router=express[_0x0ac3('0x5')]();var auth=require(_0x0ac3('0x6'));var interaction=require(_0x0ac3('0x7'));var config=require(_0x0ac3('0x8'));var controller=require(_0x0ac3('0x9'));router[_0x0ac3('0xa')]('/',auth[_0x0ac3('0xb')](),controller[_0x0ac3('0xc')]);router[_0x0ac3('0xa')](_0x0ac3('0xd'),auth['isAuthenticated'](),controller[_0x0ac3('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0ac3('0xf')]);router[_0x0ac3('0x10')](_0x0ac3('0xd'),auth[_0x0ac3('0xb')](),controller[_0x0ac3('0x11')]);router[_0x0ac3('0x12')](_0x0ac3('0xd'),auth['isAuthenticated'](),controller[_0x0ac3('0x13')]);module[_0x0ac3('0x14')]=router; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js index 9705d69..cd76dd5 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 _0x80a4=['INTEGER'];(function(_0xb9099a,_0x23e926){var _0x3441b1=function(_0x2167c6){while(--_0x2167c6){_0xb9099a['push'](_0xb9099a['shift']());}};_0x3441b1(++_0x23e926);}(_0x80a4,0xdb));var _0x480a=function(_0x1c17e3,_0x5995b9){_0x1c17e3=_0x1c17e3-0x0;var _0x54a18b=_0x80a4[_0x1c17e3];return _0x54a18b;};'use strict';var Sequelize=require('sequelize');module['exports']={'WhatsappInteractionId':{'type':Sequelize[_0x480a('0x0')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0xf1b1=['INTEGER','exports'];(function(_0x3b4b9c,_0x5aa494){var _0x2ffed7=function(_0x6adebb){while(--_0x6adebb){_0x3b4b9c['push'](_0x3b4b9c['shift']());}};_0x2ffed7(++_0x5aa494);}(_0xf1b1,0x197));var _0x1f1b=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0xf1b1[_0x390a19];return _0x5d8230;};'use strict';var Sequelize=require('sequelize');module[_0x1f1b('0x0')]={'WhatsappInteractionId':{'type':Sequelize[_0x1f1b('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x1f1b('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js index b42cb58..222fc5b 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 _0xd668=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','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','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','end','sendStatus','stack','name','send','index','map','UserWhatsappInteraction','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource'];(function(_0xcc150d,_0x5aa9e2){var _0x2bdf09=function(_0x575c1e){while(--_0x575c1e){_0xcc150d['push'](_0xcc150d['shift']());}};_0x2bdf09(++_0x5aa9e2);}(_0xd668,0x1f4));var _0x8d66=function(_0x10eb40,_0x3f5002){_0x10eb40=_0x10eb40-0x0;var _0x36e2d1=_0xd668[_0x10eb40];return _0x36e2d1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8d66('0x0'));var rimraf=require(_0x8d66('0x1'));var zipdir=require(_0x8d66('0x2'));var jsonpatch=require(_0x8d66('0x3'));var rp=require(_0x8d66('0x4'));var moment=require('moment');var BPromise=require(_0x8d66('0x5'));var Mustache=require(_0x8d66('0x6'));var util=require(_0x8d66('0x7'));var path=require(_0x8d66('0x8'));var sox=require(_0x8d66('0x9'));var csv=require(_0x8d66('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8d66('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8d66('0xc'));var deskjs=require(_0x8d66('0xd'));var toCsv=require(_0x8d66('0xa'));var querystring=require(_0x8d66('0xe'));var Papa=require('papaparse');var Redis=require(_0x8d66('0xf'));var authService=require(_0x8d66('0x10'));var qs=require(_0x8d66('0x11'));var as=require(_0x8d66('0x12'));var hardwareService=require(_0x8d66('0x13'));var logger=require('../../config/logger')(_0x8d66('0x14'));var utils=require(_0x8d66('0x15'));var config=require(_0x8d66('0x16'));var licenseUtil=require(_0x8d66('0x17'));var db=require(_0x8d66('0x18'))['db'];function respondWithStatusCode(_0x4ea413,_0x6fcede){_0x6fcede=_0x6fcede||0xcc;return function(_0x42f4c1){if(_0x42f4c1){return _0x4ea413['sendStatus'](_0x6fcede);}return _0x4ea413[_0x8d66('0x19')](_0x6fcede)['end']();};}function respondWithResult(_0x4b6e91,_0x33cdcf){_0x33cdcf=_0x33cdcf||0xc8;return function(_0xf6f28b){if(_0xf6f28b){return _0x4b6e91['status'](_0x33cdcf)[_0x8d66('0x1a')](_0xf6f28b);}};}function respondWithFilteredResult(_0x4965c4,_0x50f784){return function(_0x252bd2){if(_0x252bd2){var _0x561f88=_0x252bd2[_0x8d66('0x1b')],_0x5f566d=_0x50f784[_0x8d66('0x1c')],_0x165acb=_0x50f784[_0x8d66('0x1c')]+_0x50f784[_0x8d66('0x1d')],_0xea5c13;if(_0x165acb>=_0x561f88){_0x165acb=_0x561f88;_0xea5c13=0xc8;}else{_0xea5c13=0xce;}_0x4965c4[_0x8d66('0x19')](_0xea5c13);return _0x4965c4['set'](_0x8d66('0x1e'),_0x5f566d+'-'+_0x165acb+'/'+_0x561f88)[_0x8d66('0x1a')](_0x252bd2);}return null;};}function patchUpdates(_0x3dccae){return function(_0x16ebbe){try{jsonpatch[_0x8d66('0x1f')](_0x16ebbe,_0x3dccae,!![]);}catch(_0x1ac9cb){return BPromise[_0x8d66('0x20')](_0x1ac9cb);}return _0x16ebbe[_0x8d66('0x21')]();};}function saveUpdates(_0x6b75a4,_0x42ed62){return function(_0x3eba68){if(_0x3eba68){return _0x3eba68[_0x8d66('0x22')](_0x6b75a4)[_0x8d66('0x23')](function(_0x5d5d57){return _0x5d5d57;});}return null;};}function removeEntity(_0x14460c,_0x11c6c7){return function(_0x50ff8d){if(_0x50ff8d){return _0x50ff8d[_0x8d66('0x24')]()[_0x8d66('0x23')](function(){var _0x58fe96=_0x50ff8d[_0x8d66('0x25')]({'plain':!![]});var _0x378245='UserWhatsappInteractions';return db['UserProfileResource']['destroy']({'where':{'type':_0x378245,'resourceId':_0x58fe96['id']}})[_0x8d66('0x23')](function(){return _0x50ff8d;});})[_0x8d66('0x23')](function(){_0x14460c[_0x8d66('0x19')](0xcc)[_0x8d66('0x26')]();});}};}function handleEntityNotFound(_0x5b5a55,_0x31f748){return function(_0x583d2b){if(!_0x583d2b){_0x5b5a55[_0x8d66('0x27')](0x194);}return _0x583d2b;};}function handleError(_0x4dcc55,_0x5e825c){_0x5e825c=_0x5e825c||0x1f4;return function(_0x4aa20d){logger['error'](_0x4aa20d[_0x8d66('0x28')]);if(_0x4aa20d[_0x8d66('0x29')]){delete _0x4aa20d['name'];}_0x4dcc55[_0x8d66('0x19')](_0x5e825c)[_0x8d66('0x2a')](_0x4aa20d);};}exports[_0x8d66('0x2b')]=function(_0x2ac018,_0x311a71){var _0x475f92={},_0x119832={},_0x44261e={'count':0x0,'rows':[]};var _0x56cd0d=_[_0x8d66('0x2c')](db[_0x8d66('0x2d')][_0x8d66('0x2e')],function(_0x399951){return{'name':_0x399951['fieldName'],'type':_0x399951[_0x8d66('0x2f')]['key']};});_0x119832[_0x8d66('0x30')]=_[_0x8d66('0x2c')](_0x56cd0d,_0x8d66('0x29'));_0x119832[_0x8d66('0x31')]=_[_0x8d66('0x32')](_0x2ac018['query']);_0x119832['filters']=_[_0x8d66('0x33')](_0x119832[_0x8d66('0x30')],_0x119832['query']);_0x475f92['attributes']=_[_0x8d66('0x33')](_0x119832[_0x8d66('0x30')],qs[_0x8d66('0x34')](_0x2ac018['query'][_0x8d66('0x34')]));_0x475f92[_0x8d66('0x35')]=_0x475f92[_0x8d66('0x35')][_0x8d66('0x36')]?_0x475f92[_0x8d66('0x35')]:_0x119832[_0x8d66('0x30')];if(!_0x2ac018['query'][_0x8d66('0x37')](_0x8d66('0x38'))){_0x475f92[_0x8d66('0x1d')]=qs[_0x8d66('0x1d')](_0x2ac018['query'][_0x8d66('0x1d')]);_0x475f92[_0x8d66('0x1c')]=qs[_0x8d66('0x1c')](_0x2ac018[_0x8d66('0x31')][_0x8d66('0x1c')]);}_0x475f92[_0x8d66('0x39')]=qs['sort'](_0x2ac018[_0x8d66('0x31')]['sort']);_0x475f92[_0x8d66('0x3a')]=qs['filters'](_[_0x8d66('0x3b')](_0x2ac018['query'],_0x119832['filters']),_0x56cd0d);if(_0x2ac018[_0x8d66('0x31')][_0x8d66('0x3c')]){_0x475f92[_0x8d66('0x3a')]=_[_0x8d66('0x3d')](_0x475f92[_0x8d66('0x3a')],{'$or':_[_0x8d66('0x2c')](_0x56cd0d,function(_0x13de82){if(_0x13de82['type']!==_0x8d66('0x3e')){var _0x2a79de={};_0x2a79de[_0x13de82[_0x8d66('0x29')]]={'$like':'%'+_0x2ac018[_0x8d66('0x31')]['filter']+'%'};return _0x2a79de;}})});}_0x475f92=_[_0x8d66('0x3d')]({},_0x475f92,_0x2ac018[_0x8d66('0x3f')]);var _0x3ecd72={'where':_0x475f92[_0x8d66('0x3a')]};return db[_0x8d66('0x2d')][_0x8d66('0x1b')](_0x3ecd72)[_0x8d66('0x23')](function(_0x84d520){_0x44261e['count']=_0x84d520;if(_0x2ac018[_0x8d66('0x31')][_0x8d66('0x40')]){_0x475f92[_0x8d66('0x41')]=[{'all':!![]}];}return db[_0x8d66('0x2d')][_0x8d66('0x42')](_0x475f92);})['then'](function(_0x5a5844){_0x44261e[_0x8d66('0x43')]=_0x5a5844;return _0x44261e;})[_0x8d66('0x23')](respondWithFilteredResult(_0x311a71,_0x475f92))[_0x8d66('0x44')](handleError(_0x311a71,null));};exports[_0x8d66('0x45')]=function(_0x3537f0,_0x2c3b2a){var _0x206baa={'raw':!![],'where':{'id':_0x3537f0[_0x8d66('0x46')]['id']}},_0xcb614b={};_0xcb614b['model']=_[_0x8d66('0x32')](db[_0x8d66('0x2d')]['rawAttributes']);_0xcb614b[_0x8d66('0x31')]=_[_0x8d66('0x32')](_0x3537f0[_0x8d66('0x31')]);_0xcb614b[_0x8d66('0x47')]=_[_0x8d66('0x33')](_0xcb614b[_0x8d66('0x30')],_0xcb614b[_0x8d66('0x31')]);_0x206baa[_0x8d66('0x35')]=_['intersection'](_0xcb614b[_0x8d66('0x30')],qs['fields'](_0x3537f0[_0x8d66('0x31')][_0x8d66('0x34')]));_0x206baa[_0x8d66('0x35')]=_0x206baa[_0x8d66('0x35')][_0x8d66('0x36')]?_0x206baa['attributes']:_0xcb614b[_0x8d66('0x30')];if(_0x3537f0[_0x8d66('0x31')]['includeAll']){_0x206baa[_0x8d66('0x41')]=[{'all':!![]}];}_0x206baa=_[_0x8d66('0x3d')]({},_0x206baa,_0x3537f0['options']);return db[_0x8d66('0x2d')][_0x8d66('0x48')](_0x206baa)['then'](handleEntityNotFound(_0x2c3b2a,null))[_0x8d66('0x23')](respondWithResult(_0x2c3b2a,null))['catch'](handleError(_0x2c3b2a,null));};exports[_0x8d66('0x49')]=function(_0x5639ca,_0x3728f7){return db['UserWhatsappInteraction'][_0x8d66('0x49')](_0x5639ca[_0x8d66('0x4a')],{})[_0x8d66('0x23')](function(_0x4f309a){var _0x45c330=_0x5639ca[_0x8d66('0x4b')][_0x8d66('0x25')]({'plain':!![]});if(!_0x45c330)throw new Error(_0x8d66('0x4c'));if(_0x45c330[_0x8d66('0x4d')]===_0x8d66('0x4b')){var _0x4c512d=_0x4f309a[_0x8d66('0x25')]({'plain':!![]});var _0x45cab7='UserWhatsappInteractions';return db['UserProfileSection'][_0x8d66('0x48')]({'where':{'name':_0x45cab7,'userProfileId':_0x45c330[_0x8d66('0x4e')]},'raw':!![]})[_0x8d66('0x23')](function(_0x4a27ee){if(_0x4a27ee&&_0x4a27ee[_0x8d66('0x4f')]===0x0){return db[_0x8d66('0x50')][_0x8d66('0x49')]({'name':_0x4c512d[_0x8d66('0x29')],'resourceId':_0x4c512d['id'],'type':_0x4a27ee[_0x8d66('0x29')],'sectionId':_0x4a27ee['id']},{})[_0x8d66('0x23')](function(){return _0x4f309a;});}else{return _0x4f309a;}})[_0x8d66('0x44')](function(_0x2076c5){logger[_0x8d66('0x51')](_0x8d66('0x52'),_0x2076c5);throw _0x2076c5;});}return _0x4f309a;})[_0x8d66('0x23')](respondWithResult(_0x3728f7,0xc9))[_0x8d66('0x44')](handleError(_0x3728f7,null));};exports['update']=function(_0x19338e,_0x544b96){if(_0x19338e[_0x8d66('0x4a')]['id']){delete _0x19338e[_0x8d66('0x4a')]['id'];}return db[_0x8d66('0x2d')][_0x8d66('0x48')]({'where':{'id':_0x19338e[_0x8d66('0x46')]['id']}})[_0x8d66('0x23')](handleEntityNotFound(_0x544b96,null))[_0x8d66('0x23')](saveUpdates(_0x19338e[_0x8d66('0x4a')],null))[_0x8d66('0x23')](respondWithResult(_0x544b96,null))[_0x8d66('0x44')](handleError(_0x544b96,null));};exports[_0x8d66('0x24')]=function(_0x49591d,_0x704ac9){return db[_0x8d66('0x2d')]['find']({'where':{'id':_0x49591d[_0x8d66('0x46')]['id']}})[_0x8d66('0x23')](handleEntityNotFound(_0x704ac9,null))[_0x8d66('0x23')](removeEntity(_0x704ac9,null))[_0x8d66('0x44')](handleError(_0x704ac9,null));}; \ No newline at end of file +var _0x1bc8=['order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','UserWhatsappInteractions','UserProfileResource','stack','name','send','index','map','UserWhatsappInteraction','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit'];(function(_0x2e8ada,_0x339de1){var _0x1597f7=function(_0x2ce7e4){while(--_0x2ce7e4){_0x2e8ada['push'](_0x2e8ada['shift']());}};_0x1597f7(++_0x339de1);}(_0x1bc8,0x6a));var _0x81bc=function(_0x83d48e,_0x507328){_0x83d48e=_0x83d48e-0x0;var _0x26f1d1=_0x1bc8[_0x83d48e];return _0x26f1d1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x81bc('0x0'));var zipdir=require(_0x81bc('0x1'));var jsonpatch=require(_0x81bc('0x2'));var rp=require(_0x81bc('0x3'));var moment=require(_0x81bc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x81bc('0x5'));var path=require(_0x81bc('0x6'));var sox=require('sox');var csv=require(_0x81bc('0x7'));var ejs=require(_0x81bc('0x8'));var fs=require('fs');var _=require(_0x81bc('0x9'));var squel=require(_0x81bc('0xa'));var crypto=require(_0x81bc('0xb'));var jsforce=require(_0x81bc('0xc'));var deskjs=require(_0x81bc('0xd'));var toCsv=require(_0x81bc('0x7'));var querystring=require(_0x81bc('0xe'));var Papa=require('papaparse');var Redis=require(_0x81bc('0xf'));var authService=require(_0x81bc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x81bc('0x11'));var hardwareService=require(_0x81bc('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x81bc('0x13'));var licenseUtil=require(_0x81bc('0x14'));var db=require(_0x81bc('0x15'))['db'];function respondWithStatusCode(_0x52d69b,_0x1537e8){_0x1537e8=_0x1537e8||0xcc;return function(_0x250105){if(_0x250105){return _0x52d69b[_0x81bc('0x16')](_0x1537e8);}return _0x52d69b[_0x81bc('0x17')](_0x1537e8)[_0x81bc('0x18')]();};}function respondWithResult(_0x3601d9,_0x5bea26){_0x5bea26=_0x5bea26||0xc8;return function(_0xdca694){if(_0xdca694){return _0x3601d9['status'](_0x5bea26)[_0x81bc('0x19')](_0xdca694);}};}function respondWithFilteredResult(_0x254722,_0xe0c7e7){return function(_0x241bbd){if(_0x241bbd){var _0x4e310b=_0x241bbd[_0x81bc('0x1a')],_0x36300a=_0xe0c7e7['offset'],_0x3b8ce8=_0xe0c7e7[_0x81bc('0x1b')]+_0xe0c7e7[_0x81bc('0x1c')],_0x42c21a;if(_0x3b8ce8>=_0x4e310b){_0x3b8ce8=_0x4e310b;_0x42c21a=0xc8;}else{_0x42c21a=0xce;}_0x254722[_0x81bc('0x17')](_0x42c21a);return _0x254722[_0x81bc('0x1d')](_0x81bc('0x1e'),_0x36300a+'-'+_0x3b8ce8+'/'+_0x4e310b)[_0x81bc('0x19')](_0x241bbd);}return null;};}function patchUpdates(_0x1844a0){return function(_0x233be2){try{jsonpatch[_0x81bc('0x1f')](_0x233be2,_0x1844a0,!![]);}catch(_0x32b14e){return BPromise[_0x81bc('0x20')](_0x32b14e);}return _0x233be2['save']();};}function saveUpdates(_0x520f7a,_0x3885cb){return function(_0x26ad8b){if(_0x26ad8b){return _0x26ad8b['update'](_0x520f7a)[_0x81bc('0x21')](function(_0x2e580f){return _0x2e580f;});}return null;};}function removeEntity(_0x172254,_0x451944){return function(_0x7145ee){if(_0x7145ee){return _0x7145ee[_0x81bc('0x22')]()[_0x81bc('0x21')](function(){var _0x4d194e=_0x7145ee['get']({'plain':!![]});var _0x686c6a=_0x81bc('0x23');return db[_0x81bc('0x24')][_0x81bc('0x22')]({'where':{'type':_0x686c6a,'resourceId':_0x4d194e['id']}})[_0x81bc('0x21')](function(){return _0x7145ee;});})[_0x81bc('0x21')](function(){_0x172254[_0x81bc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c833f,_0x3ede9a){return function(_0x2a4798){if(!_0x2a4798){_0x5c833f[_0x81bc('0x16')](0x194);}return _0x2a4798;};}function handleError(_0x1389f0,_0xe37af5){_0xe37af5=_0xe37af5||0x1f4;return function(_0x417f50){logger['error'](_0x417f50[_0x81bc('0x25')]);if(_0x417f50['name']){delete _0x417f50[_0x81bc('0x26')];}_0x1389f0[_0x81bc('0x17')](_0xe37af5)[_0x81bc('0x27')](_0x417f50);};}exports[_0x81bc('0x28')]=function(_0x118f24,_0x5a3a39){var _0x112135={},_0x521a9b={},_0x2f4501={'count':0x0,'rows':[]};var _0x6d0578=_[_0x81bc('0x29')](db[_0x81bc('0x2a')]['rawAttributes'],function(_0x4d9fd3){return{'name':_0x4d9fd3[_0x81bc('0x2b')],'type':_0x4d9fd3[_0x81bc('0x2c')][_0x81bc('0x2d')]};});_0x521a9b['model']=_[_0x81bc('0x29')](_0x6d0578,_0x81bc('0x26'));_0x521a9b[_0x81bc('0x2e')]=_[_0x81bc('0x2f')](_0x118f24[_0x81bc('0x2e')]);_0x521a9b['filters']=_[_0x81bc('0x30')](_0x521a9b[_0x81bc('0x31')],_0x521a9b[_0x81bc('0x2e')]);_0x112135[_0x81bc('0x32')]=_[_0x81bc('0x30')](_0x521a9b[_0x81bc('0x31')],qs[_0x81bc('0x33')](_0x118f24[_0x81bc('0x2e')][_0x81bc('0x33')]));_0x112135[_0x81bc('0x32')]=_0x112135[_0x81bc('0x32')][_0x81bc('0x34')]?_0x112135[_0x81bc('0x32')]:_0x521a9b['model'];if(!_0x118f24[_0x81bc('0x2e')]['hasOwnProperty'](_0x81bc('0x35'))){_0x112135[_0x81bc('0x1c')]=qs[_0x81bc('0x1c')](_0x118f24[_0x81bc('0x2e')][_0x81bc('0x1c')]);_0x112135['offset']=qs[_0x81bc('0x1b')](_0x118f24['query']['offset']);}_0x112135[_0x81bc('0x36')]=qs[_0x81bc('0x37')](_0x118f24['query'][_0x81bc('0x37')]);_0x112135[_0x81bc('0x38')]=qs['filters'](_[_0x81bc('0x39')](_0x118f24[_0x81bc('0x2e')],_0x521a9b[_0x81bc('0x3a')]),_0x6d0578);if(_0x118f24[_0x81bc('0x2e')]['filter']){_0x112135[_0x81bc('0x38')]=_[_0x81bc('0x3b')](_0x112135[_0x81bc('0x38')],{'$or':_[_0x81bc('0x29')](_0x6d0578,function(_0xfc7c2){if(_0xfc7c2[_0x81bc('0x2c')]!==_0x81bc('0x3c')){var _0x1f00fb={};_0x1f00fb[_0xfc7c2[_0x81bc('0x26')]]={'$like':'%'+_0x118f24['query'][_0x81bc('0x3d')]+'%'};return _0x1f00fb;}})});}_0x112135=_[_0x81bc('0x3b')]({},_0x112135,_0x118f24[_0x81bc('0x3e')]);var _0x4770af={'where':_0x112135['where']};return db[_0x81bc('0x2a')]['count'](_0x4770af)[_0x81bc('0x21')](function(_0x4d3ed9){_0x2f4501['count']=_0x4d3ed9;if(_0x118f24[_0x81bc('0x2e')][_0x81bc('0x3f')]){_0x112135['include']=[{'all':!![]}];}return db[_0x81bc('0x2a')][_0x81bc('0x40')](_0x112135);})[_0x81bc('0x21')](function(_0x15e64f){_0x2f4501['rows']=_0x15e64f;return _0x2f4501;})[_0x81bc('0x21')](respondWithFilteredResult(_0x5a3a39,_0x112135))[_0x81bc('0x41')](handleError(_0x5a3a39,null));};exports[_0x81bc('0x42')]=function(_0x3d7dba,_0xd46ed8){var _0x83e6ac={'raw':!![],'where':{'id':_0x3d7dba[_0x81bc('0x43')]['id']}},_0xb900db={};_0xb900db['model']=_['keys'](db[_0x81bc('0x2a')][_0x81bc('0x44')]);_0xb900db[_0x81bc('0x2e')]=_[_0x81bc('0x2f')](_0x3d7dba[_0x81bc('0x2e')]);_0xb900db['filters']=_['intersection'](_0xb900db[_0x81bc('0x31')],_0xb900db[_0x81bc('0x2e')]);_0x83e6ac['attributes']=_['intersection'](_0xb900db[_0x81bc('0x31')],qs['fields'](_0x3d7dba['query'][_0x81bc('0x33')]));_0x83e6ac['attributes']=_0x83e6ac[_0x81bc('0x32')][_0x81bc('0x34')]?_0x83e6ac['attributes']:_0xb900db[_0x81bc('0x31')];if(_0x3d7dba[_0x81bc('0x2e')][_0x81bc('0x3f')]){_0x83e6ac[_0x81bc('0x45')]=[{'all':!![]}];}_0x83e6ac=_[_0x81bc('0x3b')]({},_0x83e6ac,_0x3d7dba[_0x81bc('0x3e')]);return db[_0x81bc('0x2a')][_0x81bc('0x46')](_0x83e6ac)['then'](handleEntityNotFound(_0xd46ed8,null))[_0x81bc('0x21')](respondWithResult(_0xd46ed8,null))[_0x81bc('0x41')](handleError(_0xd46ed8,null));};exports[_0x81bc('0x47')]=function(_0x254637,_0x2fe7d8){return db[_0x81bc('0x2a')]['create'](_0x254637[_0x81bc('0x48')],{})[_0x81bc('0x21')](function(_0x3f9a35){var _0x26da0d=_0x254637['user'][_0x81bc('0x49')]({'plain':!![]});if(!_0x26da0d)throw new Error(_0x81bc('0x4a'));if(_0x26da0d['role']==='user'){var _0x5977e5=_0x3f9a35['get']({'plain':!![]});var _0x42bc6f=_0x81bc('0x23');return db[_0x81bc('0x4b')][_0x81bc('0x46')]({'where':{'name':_0x42bc6f,'userProfileId':_0x26da0d[_0x81bc('0x4c')]},'raw':!![]})[_0x81bc('0x21')](function(_0x8d51f1){if(_0x8d51f1&&_0x8d51f1['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5977e5['name'],'resourceId':_0x5977e5['id'],'type':_0x8d51f1[_0x81bc('0x26')],'sectionId':_0x8d51f1['id']},{})[_0x81bc('0x21')](function(){return _0x3f9a35;});}else{return _0x3f9a35;}})[_0x81bc('0x41')](function(_0x182efa){logger[_0x81bc('0x4d')](_0x81bc('0x4e'),_0x182efa);throw _0x182efa;});}return _0x3f9a35;})[_0x81bc('0x21')](respondWithResult(_0x2fe7d8,0xc9))[_0x81bc('0x41')](handleError(_0x2fe7d8,null));};exports[_0x81bc('0x4f')]=function(_0x29e3a1,_0x4c7431){if(_0x29e3a1[_0x81bc('0x48')]['id']){delete _0x29e3a1[_0x81bc('0x48')]['id'];}return db[_0x81bc('0x2a')][_0x81bc('0x46')]({'where':{'id':_0x29e3a1[_0x81bc('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c7431,null))[_0x81bc('0x21')](saveUpdates(_0x29e3a1[_0x81bc('0x48')],null))['then'](respondWithResult(_0x4c7431,null))[_0x81bc('0x41')](handleError(_0x4c7431,null));};exports[_0x81bc('0x22')]=function(_0x5d3870,_0x4ce672){return db[_0x81bc('0x2a')][_0x81bc('0x46')]({'where':{'id':_0x5d3870['params']['id']}})[_0x81bc('0x21')](handleEntityNotFound(_0x4ce672,null))[_0x81bc('0x21')](removeEntity(_0x4ce672,null))[_0x81bc('0x41')](handleError(_0x4ce672,null));}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js index f7d1448..c7d5726 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 _0x5c9c=['rimraf','../../config/environment','define','user_has_whatsapp_interactions','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5edc2a,_0x213d51){var _0x1e075e=function(_0x3c9f99){while(--_0x3c9f99){_0x5edc2a['push'](_0x5edc2a['shift']());}};_0x1e075e(++_0x213d51);}(_0x5c9c,0x16c));var _0xc5c9=function(_0x126b54,_0x6d4fe){_0x126b54=_0x126b54-0x0;var _0x23bd55=_0x5c9c[_0x126b54];return _0x23bd55;};'use strict';var _=require('lodash');var util=require(_0xc5c9('0x0'));var logger=require(_0xc5c9('0x1'))(_0xc5c9('0x2'));var moment=require(_0xc5c9('0x3'));var BPromise=require(_0xc5c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5c9('0x5'));var rimraf=require(_0xc5c9('0x6'));var config=require(_0xc5c9('0x7'));var attributes=require('./UserWhatsappInteraction.attributes');module['exports']=function(_0x3fbb75,_0x4249e3){return _0x3fbb75[_0xc5c9('0x8')]('UserWhatsappInteraction',attributes,{'tableName':_0xc5c9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5806=['./UserWhatsappInteraction.attributes','exports','define','UserWhatsappInteraction','user_has_whatsapp_interactions','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5db0d0,_0x5c0410){var _0x393dac=function(_0x277e41){while(--_0x277e41){_0x5db0d0['push'](_0x5db0d0['shift']());}};_0x393dac(++_0x5c0410);}(_0x5806,0x10d));var _0x6580=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0x5806[_0x53a7a8];return _0x555f71;};'use strict';var _=require('lodash');var util=require(_0x6580('0x0'));var logger=require(_0x6580('0x1'))(_0x6580('0x2'));var moment=require(_0x6580('0x3'));var BPromise=require('bluebird');var rp=require(_0x6580('0x4'));var fs=require('fs');var path=require(_0x6580('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6580('0x6'));module[_0x6580('0x7')]=function(_0x5b4e75,_0x11e3e4){return _0x5b4e75[_0x6580('0x8')](_0x6580('0x9'),attributes,{'tableName':_0x6580('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 6683a63..d3e504c 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 _0x476b=['UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappInteraction,\x20%s,\x20%s','debug'];(function(_0xc4b20b,_0x37bcfb){var _0x27aa03=function(_0x5d69ed){while(--_0x5d69ed){_0xc4b20b['push'](_0xc4b20b['shift']());}};_0x27aa03(++_0x37bcfb);}(_0x476b,0xd5));var _0xb476=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x476b[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0xb476('0x0'));var moment=require(_0xb476('0x1'));var BPromise=require('bluebird');var rs=require(_0xb476('0x2'));var fs=require('fs');var Redis=require(_0xb476('0x3'));var db=require(_0xb476('0x4'))['db'];var utils=require(_0xb476('0x5'));var logger=require(_0xb476('0x6'))(_0xb476('0x7'));var config=require(_0xb476('0x8'));var jayson=require(_0xb476('0x9'));var client=jayson[_0xb476('0xa')][_0xb476('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c2784,_0x170160,_0x2bd5c6){return new BPromise(function(_0x4961c4,_0x426b62){return client[_0xb476('0xc')](_0x3c2784,_0x2bd5c6)[_0xb476('0xd')](function(_0x4ca4a9){logger[_0xb476('0xe')](_0xb476('0xf'),_0x170160,'request\x20sent');logger[_0xb476('0x10')](_0xb476('0x11'),_0x170160,_0xb476('0x12'),JSON['stringify'](_0x4ca4a9));if(_0x4ca4a9['error']){if(_0x4ca4a9['error']['code']===0x1f4){logger[_0xb476('0x13')](_0xb476('0xf'),_0x170160,_0x4ca4a9[_0xb476('0x13')][_0xb476('0x14')]);return _0x426b62(_0x4ca4a9[_0xb476('0x13')][_0xb476('0x14')]);}logger[_0xb476('0x13')](_0xb476('0xf'),_0x170160,_0x4ca4a9[_0xb476('0x13')]['message']);return _0x4961c4(_0x4ca4a9[_0xb476('0x13')][_0xb476('0x14')]);}else{logger[_0xb476('0xe')](_0xb476('0xf'),_0x170160,_0xb476('0x12'));_0x4961c4(_0x4ca4a9[_0xb476('0x15')][_0xb476('0x14')]);}})[_0xb476('0x16')](function(_0x5db1c0){logger[_0xb476('0x13')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x170160,_0x5db1c0);_0x426b62(_0x5db1c0);});});} \ No newline at end of file +var _0x7d83=['../../config/logger','rpc','../../config/environment','jayson/promise','UserWhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1985d3,_0x5e6a4f){var _0x1523d4=function(_0x334d90){while(--_0x334d90){_0x1985d3['push'](_0x1985d3['shift']());}};_0x1523d4(++_0x5e6a4f);}(_0x7d83,0xf0));var _0x37d8=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x7d83[_0x361d3f];return _0x320229;};'use strict';var _=require(_0x37d8('0x0'));var util=require(_0x37d8('0x1'));var moment=require(_0x37d8('0x2'));var BPromise=require('bluebird');var rs=require(_0x37d8('0x3'));var fs=require('fs');var Redis=require(_0x37d8('0x4'));var db=require(_0x37d8('0x5'))['db'];var utils=require(_0x37d8('0x6'));var logger=require(_0x37d8('0x7'))(_0x37d8('0x8'));var config=require(_0x37d8('0x9'));var jayson=require(_0x37d8('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6234cb,_0x2f8c6c,_0x5247ad){return new BPromise(function(_0x40ab5b,_0x29542a){return client['request'](_0x6234cb,_0x5247ad)['then'](function(_0x4afd73){logger['info'](_0x37d8('0xb'),_0x2f8c6c,_0x37d8('0xc'));logger[_0x37d8('0xd')]('UserWhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x2f8c6c,_0x37d8('0xc'),JSON['stringify'](_0x4afd73));if(_0x4afd73['error']){if(_0x4afd73[_0x37d8('0xe')][_0x37d8('0xf')]===0x1f4){logger[_0x37d8('0xe')](_0x37d8('0xb'),_0x2f8c6c,_0x4afd73['error']['message']);return _0x29542a(_0x4afd73['error']['message']);}logger[_0x37d8('0xe')](_0x37d8('0xb'),_0x2f8c6c,_0x4afd73['error']['message']);return _0x40ab5b(_0x4afd73['error'][_0x37d8('0x10')]);}else{logger[_0x37d8('0x11')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x2f8c6c,_0x37d8('0xc'));_0x40ab5b(_0x4afd73[_0x37d8('0x12')][_0x37d8('0x10')]);}})['catch'](function(_0x49701f){logger[_0x37d8('0xe')](_0x37d8('0xb'),_0x2f8c6c,_0x49701f);_0x29542a(_0x49701f);});});} \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/index.js b/server/api/UserWhatsappInteraction/index.js index 4e583f7..fee27a7 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 _0x68b7=['update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','put'];(function(_0x240dfe,_0x23ce92){var _0x25b1e9=function(_0x2053e1){while(--_0x2053e1){_0x240dfe['push'](_0x240dfe['shift']());}};_0x25b1e9(++_0x23ce92);}(_0x68b7,0x8c));var _0x768b=function(_0x4b796f,_0x1d5532){_0x4b796f=_0x4b796f-0x0;var _0x206ef2=_0x68b7[_0x4b796f];return _0x206ef2;};'use strict';var multer=require(_0x768b('0x0'));var util=require('util');var path=require(_0x768b('0x1'));var timeout=require(_0x768b('0x2'));var express=require(_0x768b('0x3'));var router=express['Router']();var auth=require(_0x768b('0x4'));var interaction=require(_0x768b('0x5'));var config=require(_0x768b('0x6'));var controller=require('./UserWhatsappInteraction.controller');router[_0x768b('0x7')]('/',auth[_0x768b('0x8')](),controller[_0x768b('0x9')]);router[_0x768b('0x7')](_0x768b('0xa'),auth[_0x768b('0x8')](),controller[_0x768b('0xb')]);router['post']('/',auth[_0x768b('0x8')](),controller['create']);router[_0x768b('0xc')](_0x768b('0xa'),auth[_0x768b('0x8')](),controller[_0x768b('0xd')]);router[_0x768b('0xe')](_0x768b('0xa'),auth['isAuthenticated'](),controller[_0x768b('0xf')]);module[_0x768b('0x10')]=router; \ No newline at end of file +var _0x477a=['put','update','multer','path','connect-timeout','Router','../../components/auth/service','./UserWhatsappInteraction.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x9a620a,_0x3c37a2){var _0x1e6f14=function(_0xa9454){while(--_0xa9454){_0x9a620a['push'](_0x9a620a['shift']());}};_0x1e6f14(++_0x3c37a2);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa477('0x0'));var util=require('util');var path=require(_0xa477('0x1'));var timeout=require(_0xa477('0x2'));var express=require('express');var router=express[_0xa477('0x3')]();var auth=require(_0xa477('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa477('0x5'));router[_0xa477('0x6')]('/',auth['isAuthenticated'](),controller[_0xa477('0x7')]);router[_0xa477('0x6')](_0xa477('0x8'),auth[_0xa477('0x9')](),controller[_0xa477('0xa')]);router[_0xa477('0xb')]('/',auth[_0xa477('0x9')](),controller[_0xa477('0xc')]);router[_0xa477('0xd')]('/:id',auth[_0xa477('0x9')](),controller[_0xa477('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index d15750a..cf323ca 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 _0xc4e3=['motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','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]'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xc4e3,0xd4));var _0x3c4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4e3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3c4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3c4e('0x1')],'get':function(_0x56f590){return this['getDataValue']('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x3c4e('0x2'),_0x3c4e('0x3'),_0x3c4e('0x4'),_0x3c4e('0x5'),_0x3c4e('0x6'),_0x3c4e('0x7'),_0x3c4e('0x8'),'script']],'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[_0x3c4e('0x9')](0x1000),'comment':_0x3c4e('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x3c4e('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x3c4e('0xc')},'data4':{'type':Sequelize[_0x3c4e('0x9')](0x1000)},'data5':{'type':Sequelize[_0x3c4e('0x9')](0x1000)},'data6':{'type':Sequelize[_0x3c4e('0x9')]},'data7':{'type':Sequelize[_0x3c4e('0xd')]}}; \ No newline at end of file +var _0x5ec3=['TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','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]'];(function(_0x55d143,_0x4836e2){var _0x29c2f7=function(_0xa65606){while(--_0xa65606){_0x55d143['push'](_0x55d143['shift']());}};_0x29c2f7(++_0x4836e2);}(_0x5ec3,0xa3));var _0x35ec=function(_0x43da3c,_0x1e9822){_0x43da3c=_0x43da3c-0x0;var _0x451055=_0x5ec3[_0x43da3c];return _0x451055;};'use strict';var Sequelize=require(_0x35ec('0x0'));module[_0x35ec('0x1')]={'name':{'type':Sequelize[_0x35ec('0x2')],'get':function(_0x2b8a10){return this[_0x35ec('0x3')](_0x35ec('0x4'));}},'action':{'type':Sequelize[_0x35ec('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x35ec('0x6'),_0x35ec('0x7'),_0x35ec('0x8'),_0x35ec('0x9'),_0x35ec('0xa'),'browser',_0x35ec('0xb'),_0x35ec('0xc')]],'msg':_0x35ec('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x35ec('0x5')](0x1000),'comment':_0x35ec('0xe')},'data2':{'type':Sequelize[_0x35ec('0x5')](0x1000),'comment':_0x35ec('0xf')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x35ec('0x10')},'data4':{'type':Sequelize[_0x35ec('0x5')](0x1000)},'data5':{'type':Sequelize[_0x35ec('0x5')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x35ec('0x11')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 706ca0e..3f2c062 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 _0xba18=['end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','body','Action','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x498334,_0x27b6fe){var _0x13bb70=function(_0x4087b1){while(--_0x4087b1){_0x498334['push'](_0x498334['shift']());}};_0x13bb70(++_0x27b6fe);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x8ba1('0x0'));var emlformat=require(_0x8ba1('0x1'));var rimraf=require(_0x8ba1('0x2'));var zipdir=require(_0x8ba1('0x3'));var jsonpatch=require(_0x8ba1('0x4'));var rp=require(_0x8ba1('0x5'));var moment=require(_0x8ba1('0x6'));var BPromise=require(_0x8ba1('0x7'));var Mustache=require('mustache');var util=require(_0x8ba1('0x8'));var path=require(_0x8ba1('0x9'));var sox=require(_0x8ba1('0xa'));var csv=require(_0x8ba1('0xb'));var ejs=require(_0x8ba1('0xc'));var fs=require('fs');var _=require(_0x8ba1('0xd'));var squel=require('squel');var crypto=require(_0x8ba1('0xe'));var jsforce=require(_0x8ba1('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ba1('0x10'));var Redis=require(_0x8ba1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8ba1('0x12'));var as=require(_0x8ba1('0x13'));var hardwareService=require(_0x8ba1('0x14'));var logger=require(_0x8ba1('0x15'))(_0x8ba1('0x16'));var utils=require('../../config/utils');var config=require(_0x8ba1('0x17'));var licenseUtil=require(_0x8ba1('0x18'));var db=require(_0x8ba1('0x19'))['db'];function respondWithStatusCode(_0x1fcfd7,_0x29adbb){_0x29adbb=_0x29adbb||0xcc;return function(_0x229748){if(_0x229748){return _0x1fcfd7['sendStatus'](_0x29adbb);}return _0x1fcfd7[_0x8ba1('0x1a')](_0x29adbb)[_0x8ba1('0x1b')]();};}function respondWithResult(_0x2e81d1,_0xca53c4){_0xca53c4=_0xca53c4||0xc8;return function(_0x4c8d5c){if(_0x4c8d5c){return _0x2e81d1['status'](_0xca53c4)['json'](_0x4c8d5c);}};}function respondWithFilteredResult(_0x3058ac,_0x398f40){return function(_0x5a3a8a){if(_0x5a3a8a){var _0x1b885b=_0x5a3a8a[_0x8ba1('0x1c')],_0xc72b8d=_0x398f40[_0x8ba1('0x1d')],_0x3880aa=_0x398f40[_0x8ba1('0x1d')]+_0x398f40['limit'],_0x107846;if(_0x3880aa>=_0x1b885b){_0x3880aa=_0x1b885b;_0x107846=0xc8;}else{_0x107846=0xce;}_0x3058ac['status'](_0x107846);return _0x3058ac[_0x8ba1('0x1e')](_0x8ba1('0x1f'),_0xc72b8d+'-'+_0x3880aa+'/'+_0x1b885b)['json'](_0x5a3a8a);}return null;};}function patchUpdates(_0xd8bda0){return function(_0x2e5fba){try{jsonpatch[_0x8ba1('0x20')](_0x2e5fba,_0xd8bda0,!![]);}catch(_0x3355c8){return BPromise[_0x8ba1('0x21')](_0x3355c8);}return _0x2e5fba[_0x8ba1('0x22')]();};}function saveUpdates(_0x5ddcf8,_0x489662){return function(_0x5b09f7){if(_0x5b09f7){return _0x5b09f7[_0x8ba1('0x23')](_0x5ddcf8)[_0x8ba1('0x24')](function(_0x121cc4){return _0x121cc4;});}return null;};}function removeEntity(_0x3dd1d8,_0x4e66e1){return function(_0x1d619c){if(_0x1d619c){return _0x1d619c[_0x8ba1('0x25')]()[_0x8ba1('0x24')](function(){_0x3dd1d8[_0x8ba1('0x1a')](0xcc)[_0x8ba1('0x1b')]();});}};}function handleEntityNotFound(_0x3b70ea,_0x845108){return function(_0x1c51ef){if(!_0x1c51ef){_0x3b70ea[_0x8ba1('0x26')](0x194);}return _0x1c51ef;};}function handleError(_0x31a38c,_0x3b205c){_0x3b205c=_0x3b205c||0x1f4;return function(_0x550d33){logger['error'](_0x550d33[_0x8ba1('0x27')]);if(_0x550d33[_0x8ba1('0x28')]){delete _0x550d33['name'];}_0x31a38c[_0x8ba1('0x1a')](_0x3b205c)[_0x8ba1('0x29')](_0x550d33);};}exports[_0x8ba1('0x23')]=function(_0x326460,_0x15e419){if(_0x326460[_0x8ba1('0x2a')]['id']){delete _0x326460[_0x8ba1('0x2a')]['id'];}return db[_0x8ba1('0x2b')][_0x8ba1('0x2c')]({'where':{'id':_0x326460[_0x8ba1('0x2d')]['id']}})[_0x8ba1('0x24')](handleEntityNotFound(_0x15e419,null))[_0x8ba1('0x24')](saveUpdates(_0x326460[_0x8ba1('0x2a')],null))[_0x8ba1('0x24')](respondWithResult(_0x15e419,null))['catch'](handleError(_0x15e419,null));};exports[_0x8ba1('0x25')]=function(_0x353678,_0x22059f){return db[_0x8ba1('0x2b')][_0x8ba1('0x2c')]({'where':{'id':_0x353678[_0x8ba1('0x2d')]['id']}})['then'](handleEntityNotFound(_0x22059f,null))[_0x8ba1('0x24')](removeEntity(_0x22059f,null))[_0x8ba1('0x2e')](handleError(_0x22059f,null));}; \ No newline at end of file +var _0x1623=['bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','destroy','then','sendStatus','error','stack','name','send','update','body','Action','find','catch','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5bbc25,_0x8a0a14){var _0x3f0dfd=function(_0x52d393){while(--_0x52d393){_0x5bbc25['push'](_0x5bbc25['shift']());}};_0x3f0dfd(++_0x8a0a14);}(_0x1623,0xab));var _0x3162=function(_0x4b21b5,_0x328e6f){_0x4b21b5=_0x4b21b5-0x0;var _0x40102a=_0x1623[_0x4b21b5];return _0x40102a;};'use strict';var pdf=require(_0x3162('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3162('0x1'));var jsonpatch=require(_0x3162('0x2'));var rp=require(_0x3162('0x3'));var moment=require(_0x3162('0x4'));var BPromise=require(_0x3162('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3162('0x6'));var sox=require('sox');var csv=require(_0x3162('0x7'));var ejs=require(_0x3162('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0x7'));var querystring=require(_0x3162('0xd'));var Papa=require(_0x3162('0xe'));var Redis=require(_0x3162('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x10'));var hardwareService=require(_0x3162('0x11'));var logger=require(_0x3162('0x12'))(_0x3162('0x13'));var utils=require(_0x3162('0x14'));var config=require(_0x3162('0x15'));var licenseUtil=require(_0x3162('0x16'));var db=require(_0x3162('0x17'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x18')](_0x4c3625)[_0x3162('0x19')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x18')](_0x4a393a)[_0x3162('0x1a')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=_0x3d0bea[_0x3162('0x1b')],_0x490371=_0x15e348[_0x3162('0x1c')],_0x78a56c=_0x15e348[_0x3162('0x1c')]+_0x15e348[_0x3162('0x1d')],_0x42cf7d;if(_0x78a56c>=_0x2705d1){_0x78a56c=_0x2705d1;_0x42cf7d=0xc8;}else{_0x42cf7d=0xce;}_0x4b8a3b[_0x3162('0x18')](_0x42cf7d);return _0x4b8a3b['set'](_0x3162('0x1e'),_0x490371+'-'+_0x78a56c+'/'+_0x2705d1)[_0x3162('0x1a')](_0x3d0bea);}return null;};}function patchUpdates(_0x460b7b){return function(_0x36ca97){try{jsonpatch['apply'](_0x36ca97,_0x460b7b,!![]);}catch(_0x1dfd5c){return BPromise['reject'](_0x1dfd5c);}return _0x36ca97['save']();};}function saveUpdates(_0xa5c62b,_0x3e4d23){return function(_0x31946d){if(_0x31946d){return _0x31946d['update'](_0xa5c62b)['then'](function(_0x27133e){return _0x27133e;});}return null;};}function removeEntity(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x1f')]()[_0x3162('0x20')](function(){_0x396372[_0x3162('0x18')](0xcc)[_0x3162('0x19')]();});}};}function handleEntityNotFound(_0x5a4994,_0xd283d6){return function(_0x2433f8){if(!_0x2433f8){_0x5a4994[_0x3162('0x21')](0x194);}return _0x2433f8;};}function handleError(_0x1fd76f,_0x1c9992){_0x1c9992=_0x1c9992||0x1f4;return function(_0x3c543e){logger[_0x3162('0x22')](_0x3c543e[_0x3162('0x23')]);if(_0x3c543e[_0x3162('0x24')]){delete _0x3c543e[_0x3162('0x24')];}_0x1fd76f[_0x3162('0x18')](_0x1c9992)[_0x3162('0x25')](_0x3c543e);};}exports[_0x3162('0x26')]=function(_0x48de45,_0x4025c3){if(_0x48de45['body']['id']){delete _0x48de45[_0x3162('0x27')]['id'];}return db[_0x3162('0x28')][_0x3162('0x29')]({'where':{'id':_0x48de45['params']['id']}})['then'](handleEntityNotFound(_0x4025c3,null))[_0x3162('0x20')](saveUpdates(_0x48de45[_0x3162('0x27')],null))[_0x3162('0x20')](respondWithResult(_0x4025c3,null))[_0x3162('0x2a')](handleError(_0x4025c3,null));};exports[_0x3162('0x1f')]=function(_0x5c2d28,_0x8a7bce){return db['Action'][_0x3162('0x29')]({'where':{'id':_0x5c2d28[_0x3162('0x2b')]['id']}})[_0x3162('0x20')](handleEntityNotFound(_0x8a7bce,null))[_0x3162('0x20')](removeEntity(_0x8a7bce,null))[_0x3162('0x2a')](handleError(_0x8a7bce,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 85aa21c..1e2b921 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 _0x9bf8=['request-promise','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','../../config/logger','api','moment'];(function(_0x22789a,_0x4a1c8c){var _0xede88=function(_0x49243f){while(--_0x49243f){_0x22789a['push'](_0x22789a['shift']());}};_0xede88(++_0x4a1c8c);}(_0x9bf8,0xc5));var _0x89bf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9bf8[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x89bf('0x0'))(_0x89bf('0x1'));var moment=require(_0x89bf('0x2'));var BPromise=require('bluebird');var rp=require(_0x89bf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89bf('0x4'));var config=require(_0x89bf('0x5'));var attributes=require(_0x89bf('0x6'));module[_0x89bf('0x7')]=function(_0x3c901f,_0x49cf92){return _0x3c901f['define'](_0x89bf('0x8'),attributes,{'tableName':_0x89bf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe51c=['api','moment','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','lodash','util','../../config/logger'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0xe51c,0x99));var _0xce51=function(_0x2646bc,_0xc54066){_0x2646bc=_0x2646bc-0x0;var _0x26a1b7=_0xe51c[_0x2646bc];return _0x26a1b7;};'use strict';var _=require(_0xce51('0x0'));var util=require(_0xce51('0x1'));var logger=require(_0xce51('0x2'))(_0xce51('0x3'));var moment=require(_0xce51('0x4'));var BPromise=require('bluebird');var rp=require(_0xce51('0x5'));var fs=require('fs');var path=require(_0xce51('0x6'));var rimraf=require(_0xce51('0x7'));var config=require(_0xce51('0x8'));var attributes=require(_0xce51('0x9'));module[_0xce51('0xa')]=function(_0x27b582,_0x428bd2){return _0x27b582[_0xce51('0xb')](_0xce51('0xc'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 6594153..1a228b0 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 _0xbaf0=['client','http','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Action,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3e936d,_0x2cc5dc){var _0xeb9c9e=function(_0x18aee2){while(--_0x18aee2){_0x3e936d['push'](_0x3e936d['shift']());}};_0xeb9c9e(++_0x2cc5dc);}(_0xe706,0xa3));var _0x6e70=function(_0x1389ae,_0x1caf91){_0x1389ae=_0x1389ae-0x0;var _0x1514d4=_0xe706[_0x1389ae];return _0x1514d4;};'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']('Action,\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']('Action,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index e84fd14..6b53afb 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 _0x543d=['./action.controller','put','/:id','isAuthenticated','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4974f4,_0x35cf85){var _0x23d9cc=function(_0x48afb5){while(--_0x48afb5){_0x4974f4['push'](_0x4974f4['shift']());}};_0x23d9cc(++_0x35cf85);}(_0x543d,0x7b));var _0xd543=function(_0x18847a,_0xd6898e){_0x18847a=_0x18847a-0x0;var _0x5b68ca=_0x543d[_0x18847a];return _0x5b68ca;};'use strict';var multer=require('multer');var util=require(_0xd543('0x0'));var path=require(_0xd543('0x1'));var timeout=require(_0xd543('0x2'));var express=require(_0xd543('0x3'));var router=express[_0xd543('0x4')]();var auth=require(_0xd543('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd543('0x6'));var controller=require(_0xd543('0x7'));router[_0xd543('0x8')](_0xd543('0x9'),auth[_0xd543('0xa')](),controller[_0xd543('0xb')]);router[_0xd543('0xc')](_0xd543('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcc85=['/:id','isAuthenticated','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./action.controller'];(function(_0x2a5ce9,_0x42debb){var _0x10dec1=function(_0x2f749c){while(--_0x2f749c){_0x2a5ce9['push'](_0x2a5ce9['shift']());}};_0x10dec1(++_0x42debb);}(_0xcc85,0xdc));var _0x5cc8=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0xcc85[_0x12c280];return _0x3638d3;};'use strict';var multer=require('multer');var util=require(_0x5cc8('0x0'));var path=require(_0x5cc8('0x1'));var timeout=require(_0x5cc8('0x2'));var express=require(_0x5cc8('0x3'));var router=express[_0x5cc8('0x4')]();var auth=require(_0x5cc8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5cc8('0x6'));var controller=require(_0x5cc8('0x7'));router['put'](_0x5cc8('0x8'),auth[_0x5cc8('0x9')](),controller[_0x5cc8('0xa')]);router['delete'](_0x5cc8('0x8'),auth[_0x5cc8('0x9')](),controller['destroy']);module[_0x5cc8('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 132e5aa..bc0b437 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 _0xcc84=['STRING','TEXT','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcc84,0x19d));var _0x4cc8=function(_0x5df7e6,_0x12d771){_0x5df7e6=_0x5df7e6-0x0;var _0xfaba1b=_0xcc84[_0x5df7e6];return _0xfaba1b;};'use strict';var Sequelize=require('sequelize');module[_0x4cc8('0x0')]={'name':{'type':Sequelize[_0x4cc8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4cc8('0x1')]},'parent':{'type':Sequelize[_0x4cc8('0x1')]},'table':{'type':Sequelize[_0x4cc8('0x1')]},'conditions':{'type':Sequelize[_0x4cc8('0x2')]},'joins':{'type':Sequelize[_0x4cc8('0x2')]}}; \ No newline at end of file +var _0x7a94=['sequelize','exports','STRING','TEXT'];(function(_0x1c467b,_0x457eda){var _0x1ece5c=function(_0x27cbc9){while(--_0x27cbc9){_0x1c467b['push'](_0x1c467b['shift']());}};_0x1ece5c(++_0x457eda);}(_0x7a94,0xc0));var _0x47a9=function(_0x5f564d,_0x29cbff){_0x5f564d=_0x5f564d-0x0;var _0x502c42=_0x7a94[_0x5f564d];return _0x502c42;};'use strict';var Sequelize=require(_0x47a9('0x0'));module[_0x47a9('0x1')]={'name':{'type':Sequelize[_0x47a9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x47a9('0x2')]},'table':{'type':Sequelize[_0x47a9('0x2')]},'conditions':{'type':Sequelize[_0x47a9('0x3')]},'joins':{'type':Sequelize[_0x47a9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 322d16b..0e73ba7 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 _0x5a1b=['Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','field','function','format','replace','groupBy','orderBy','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','SUM(%s)','includes','IS\x20NULL','from','DESC','parse','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','DATE(%s)','HOUR(%s)','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','body','preview','join','left_join','right_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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value'];(function(_0x25edd2,_0x564c8c){var _0x26eaf6=function(_0x937195){while(--_0x937195){_0x25edd2['push'](_0x25edd2['shift']());}};_0x26eaf6(++_0x564c8c);}(_0x5a1b,0xe6));var _0xb5a1=function(_0x38f5cf,_0x2c455b){_0x38f5cf=_0x38f5cf-0x0;var _0x5af4ac=_0x5a1b[_0x38f5cf];return _0x5af4ac;};'use strict';var pdf=require(_0xb5a1('0x0'));var emlformat=require(_0xb5a1('0x1'));var rimraf=require(_0xb5a1('0x2'));var zipdir=require(_0xb5a1('0x3'));var jsonpatch=require(_0xb5a1('0x4'));var rp=require('request-promise');var moment=require(_0xb5a1('0x5'));var BPromise=require(_0xb5a1('0x6'));var Mustache=require(_0xb5a1('0x7'));var util=require('util');var path=require(_0xb5a1('0x8'));var sox=require('sox');var csv=require(_0xb5a1('0x9'));var ejs=require(_0xb5a1('0xa'));var fs=require('fs');var _=require(_0xb5a1('0xb'));var squel=require('squel');var crypto=require(_0xb5a1('0xc'));var jsforce=require(_0xb5a1('0xd'));var deskjs=require(_0xb5a1('0xe'));var toCsv=require(_0xb5a1('0x9'));var querystring=require('querystring');var Papa=require(_0xb5a1('0xf'));var Redis=require(_0xb5a1('0x10'));var authService=require(_0xb5a1('0x11'));var qs=require(_0xb5a1('0x12'));var as=require(_0xb5a1('0x13'));var hardwareService=require(_0xb5a1('0x14'));var logger=require(_0xb5a1('0x15'))(_0xb5a1('0x16'));var utils=require(_0xb5a1('0x17'));var config=require(_0xb5a1('0x18'));var licenseUtil=require(_0xb5a1('0x19'));var db=require(_0xb5a1('0x1a'))['db'];var dbH=require(_0xb5a1('0x1a'))['dbH'];function respondWithStatusCode(_0x8d5524,_0x493508){_0x493508=_0x493508||0xcc;return function(_0x1c5c0b){if(_0x1c5c0b){return _0x8d5524[_0xb5a1('0x1b')](_0x493508);}return _0x8d5524[_0xb5a1('0x1c')](_0x493508)[_0xb5a1('0x1d')]();};}function respondWithResult(_0x31a540,_0x43386e){_0x43386e=_0x43386e||0xc8;return function(_0x1b7198){if(_0x1b7198){return _0x31a540[_0xb5a1('0x1c')](_0x43386e)[_0xb5a1('0x1e')](_0x1b7198);}};}function respondWithFilteredResult(_0x56932a,_0x4cda72){return function(_0x37da70){if(_0x37da70){var _0x485e0e=_0x37da70[_0xb5a1('0x1f')],_0x5522e1=_0x4cda72[_0xb5a1('0x20')],_0x47c3f9=_0x4cda72[_0xb5a1('0x20')]+_0x4cda72[_0xb5a1('0x21')],_0x5ba229;if(_0x47c3f9>=_0x485e0e){_0x47c3f9=_0x485e0e;_0x5ba229=0xc8;}else{_0x5ba229=0xce;}_0x56932a['status'](_0x5ba229);return _0x56932a[_0xb5a1('0x22')](_0xb5a1('0x23'),_0x5522e1+'-'+_0x47c3f9+'/'+_0x485e0e)['json'](_0x37da70);}return null;};}function patchUpdates(_0x34a4de){return function(_0x10854c){try{jsonpatch[_0xb5a1('0x24')](_0x10854c,_0x34a4de,!![]);}catch(_0x169c5c){return BPromise['reject'](_0x169c5c);}return _0x10854c['save']();};}function saveUpdates(_0x36a2b2,_0x560a91){return function(_0xe283f1){if(_0xe283f1){return _0xe283f1[_0xb5a1('0x25')](_0x36a2b2)[_0xb5a1('0x26')](function(_0x1cc9ab){return _0x1cc9ab;});}return null;};}function removeEntity(_0x51cf17,_0x16977b){return function(_0x295a97){if(_0x295a97){return _0x295a97[_0xb5a1('0x27')]()[_0xb5a1('0x26')](function(){var _0xa425f6=_0x295a97[_0xb5a1('0x28')]({'plain':!![]});var _0x58edd7=_0xb5a1('0x29');return db[_0xb5a1('0x2a')][_0xb5a1('0x27')]({'where':{'type':_0x58edd7,'resourceId':_0xa425f6['id']}})[_0xb5a1('0x26')](function(){return _0x295a97;});})[_0xb5a1('0x26')](function(){_0x51cf17[_0xb5a1('0x1c')](0xcc)[_0xb5a1('0x1d')]();});}};}function handleEntityNotFound(_0x55b363,_0x391293){return function(_0x540e79){if(!_0x540e79){_0x55b363['sendStatus'](0x194);}return _0x540e79;};}function handleError(_0x40e8b7,_0x32e175){_0x32e175=_0x32e175||0x1f4;return function(_0x4d93aa){logger[_0xb5a1('0x2b')](_0x4d93aa[_0xb5a1('0x2c')]);if(_0x4d93aa[_0xb5a1('0x2d')]){delete _0x4d93aa[_0xb5a1('0x2d')];}_0x40e8b7[_0xb5a1('0x1c')](_0x32e175)[_0xb5a1('0x2e')](_0x4d93aa);};}exports[_0xb5a1('0x2f')]=function(_0x2aa0b5,_0x230f2d){var _0x404e6f={},_0x238b1c={},_0x386da7={'count':0x0,'rows':[]};var _0xca3ddc=_[_0xb5a1('0x30')](db[_0xb5a1('0x31')][_0xb5a1('0x32')],function(_0x4267ce){return{'name':_0x4267ce['fieldName'],'type':_0x4267ce[_0xb5a1('0x33')][_0xb5a1('0x34')]};});_0x238b1c[_0xb5a1('0x35')]=_[_0xb5a1('0x30')](_0xca3ddc,_0xb5a1('0x2d'));_0x238b1c['query']=_['keys'](_0x2aa0b5[_0xb5a1('0x36')]);_0x238b1c[_0xb5a1('0x37')]=_[_0xb5a1('0x38')](_0x238b1c[_0xb5a1('0x35')],_0x238b1c['query']);_0x404e6f[_0xb5a1('0x39')]=_[_0xb5a1('0x38')](_0x238b1c[_0xb5a1('0x35')],qs[_0xb5a1('0x3a')](_0x2aa0b5[_0xb5a1('0x36')][_0xb5a1('0x3a')]));_0x404e6f['attributes']=_0x404e6f[_0xb5a1('0x39')][_0xb5a1('0x3b')]?_0x404e6f['attributes']:_0x238b1c[_0xb5a1('0x35')];if(!_0x2aa0b5[_0xb5a1('0x36')][_0xb5a1('0x3c')](_0xb5a1('0x3d'))){_0x404e6f['limit']=qs[_0xb5a1('0x21')](_0x2aa0b5['query']['limit']);_0x404e6f[_0xb5a1('0x20')]=qs[_0xb5a1('0x20')](_0x2aa0b5['query'][_0xb5a1('0x20')]);}_0x404e6f[_0xb5a1('0x3e')]=qs[_0xb5a1('0x3f')](_0x2aa0b5['query'][_0xb5a1('0x3f')]);_0x404e6f[_0xb5a1('0x40')]=qs[_0xb5a1('0x37')](_[_0xb5a1('0x41')](_0x2aa0b5[_0xb5a1('0x36')],_0x238b1c[_0xb5a1('0x37')]),_0xca3ddc);if(_0x2aa0b5['query'][_0xb5a1('0x42')]){_0x404e6f[_0xb5a1('0x40')]=_[_0xb5a1('0x43')](_0x404e6f['where'],{'$or':_['map'](_0xca3ddc,function(_0x16ddaf){if(_0x16ddaf[_0xb5a1('0x33')]!=='VIRTUAL'){var _0x17d4d7={};_0x17d4d7[_0x16ddaf[_0xb5a1('0x2d')]]={'$like':'%'+_0x2aa0b5[_0xb5a1('0x36')][_0xb5a1('0x42')]+'%'};return _0x17d4d7;}})});}_0x404e6f=_[_0xb5a1('0x43')]({},_0x404e6f,_0x2aa0b5[_0xb5a1('0x44')]);var _0x48e4c9={'where':_0x404e6f[_0xb5a1('0x40')]};return db[_0xb5a1('0x31')][_0xb5a1('0x1f')](_0x48e4c9)[_0xb5a1('0x26')](function(_0x23a80){_0x386da7[_0xb5a1('0x1f')]=_0x23a80;if(_0x2aa0b5[_0xb5a1('0x36')]['includeAll']){_0x404e6f[_0xb5a1('0x45')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xb5a1('0x46')](_0x404e6f);})[_0xb5a1('0x26')](function(_0x3def4f){_0x386da7['rows']=_0x3def4f;return _0x386da7;})[_0xb5a1('0x26')](respondWithFilteredResult(_0x230f2d,_0x404e6f))[_0xb5a1('0x47')](handleError(_0x230f2d,null));};exports[_0xb5a1('0x48')]=function(_0x1d2d3f,_0xc6b896){var _0x13c30e={'raw':![],'where':{'id':_0x1d2d3f[_0xb5a1('0x49')]['id']}},_0x181a13={};_0x181a13[_0xb5a1('0x35')]=_[_0xb5a1('0x4a')](db[_0xb5a1('0x31')][_0xb5a1('0x32')]);_0x181a13[_0xb5a1('0x36')]=_[_0xb5a1('0x4a')](_0x1d2d3f['query']);_0x181a13[_0xb5a1('0x37')]=_['intersection'](_0x181a13[_0xb5a1('0x35')],_0x181a13['query']);_0x13c30e['attributes']=_['intersection'](_0x181a13[_0xb5a1('0x35')],qs[_0xb5a1('0x3a')](_0x1d2d3f[_0xb5a1('0x36')]['fields']));_0x13c30e[_0xb5a1('0x39')]=_0x13c30e['attributes'][_0xb5a1('0x3b')]?_0x13c30e['attributes']:_0x181a13['model'];if(_0x1d2d3f['query']['includeAll']){_0x13c30e[_0xb5a1('0x45')]=[{'all':!![]}];}_0x13c30e=_[_0xb5a1('0x43')]({},_0x13c30e,_0x1d2d3f[_0xb5a1('0x44')]);return db[_0xb5a1('0x31')][_0xb5a1('0x4b')](_0x13c30e)[_0xb5a1('0x26')](handleEntityNotFound(_0xc6b896,null))[_0xb5a1('0x26')](respondWithResult(_0xc6b896,null))[_0xb5a1('0x47')](handleError(_0xc6b896,null));};exports[_0xb5a1('0x4c')]=function(_0x2b5260,_0x52cf23){return db['AnalyticCustomReport'][_0xb5a1('0x4c')](_0x2b5260['body'],{})[_0xb5a1('0x26')](function(_0x45c651){var _0x12bee4=_0x2b5260[_0xb5a1('0x4d')]['get']({'plain':!![]});if(!_0x12bee4)throw new Error(_0xb5a1('0x4e'));if(_0x12bee4[_0xb5a1('0x4f')]===_0xb5a1('0x4d')){var _0x359c1e=_0x45c651[_0xb5a1('0x28')]({'plain':!![]});var _0x3e71c0=_0xb5a1('0x50');return db[_0xb5a1('0x51')][_0xb5a1('0x4b')]({'where':{'name':_0x3e71c0,'userProfileId':_0x12bee4[_0xb5a1('0x52')]},'raw':!![]})['then'](function(_0x286dec){if(_0x286dec&&_0x286dec[_0xb5a1('0x53')]===0x0){return db['UserProfileResource'][_0xb5a1('0x4c')]({'name':_0x359c1e[_0xb5a1('0x2d')],'resourceId':_0x359c1e['id'],'type':_0xb5a1('0x29'),'sectionId':_0x286dec['id']},{})[_0xb5a1('0x26')](function(){return _0x45c651;});}else{return _0x45c651;}})['catch'](function(_0x53bcca){logger[_0xb5a1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53bcca);throw _0x53bcca;});}return _0x45c651;})[_0xb5a1('0x26')](respondWithResult(_0x52cf23,0xc9))[_0xb5a1('0x47')](handleError(_0x52cf23,null));};exports['update']=function(_0x586f53,_0x60bef4){if(_0x586f53['body']['id']){delete _0x586f53[_0xb5a1('0x54')]['id'];}return db[_0xb5a1('0x31')][_0xb5a1('0x4b')]({'where':{'id':_0x586f53[_0xb5a1('0x49')]['id']}})['then'](handleEntityNotFound(_0x60bef4,null))[_0xb5a1('0x26')](saveUpdates(_0x586f53[_0xb5a1('0x54')],null))['then'](respondWithResult(_0x60bef4,null))[_0xb5a1('0x47')](handleError(_0x60bef4,null));};exports[_0xb5a1('0x27')]=function(_0x5dadef,_0x55f574){return db[_0xb5a1('0x31')]['find']({'where':{'id':_0x5dadef['params']['id']}})[_0xb5a1('0x26')](handleEntityNotFound(_0x55f574,null))['then'](removeEntity(_0x55f574,null))[_0xb5a1('0x47')](handleError(_0x55f574,null));};exports[_0xb5a1('0x55')]=function(_0x412098,_0x32c495){var _0x34ee1c=0xa;var _0x5b4b67=[_0xb5a1('0x56'),_0xb5a1('0x57'),_0xb5a1('0x58'),'cross_join'];var _0x317820={'SUM':'SUM(%s)','COUNT':_0xb5a1('0x59'),'COUNT DISTINCT':_0xb5a1('0x5a'),'MAX':_0xb5a1('0x5b'),'MIN':_0xb5a1('0x5c'),'AVG':_0xb5a1('0x5d'),'GROUP_CONCAT':_0xb5a1('0x5e'),'GROUP_CONCAT ASC':_0xb5a1('0x5f'),'GROUP_CONCAT DESC':_0xb5a1('0x60')};var _0x547f06={'SEC_TO_TIME':_0xb5a1('0x61'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb5a1('0x62'),'UNIX_TIMESTAMP':_0xb5a1('0x63')};var _0x4a3344=function(_0x53bc2c){return!_['includes'](['IS\x20NULL',_0xb5a1('0x64'),_0xb5a1('0x65'),_0xb5a1('0x66')],_0x53bc2c);};var _0x2bf986=function(_0x70dfca){if(!_0x70dfca||!_0x70dfca[_0xb5a1('0x67')]['length']){return'';}for(var _0x11eb3c='(',_0x6dc627=0x0;_0x6dc627<_0x70dfca[_0xb5a1('0x67')][_0xb5a1('0x3b')];_0x6dc627+=0x1){_0x6dc627>0x0&&(_0x11eb3c+='\x20'+_0x70dfca[_0xb5a1('0x68')]+'\x20');_0x11eb3c+=_0x70dfca[_0xb5a1('0x67')][_0x6dc627]['group']?_0x2bf986(_0x70dfca[_0xb5a1('0x67')][_0x6dc627][_0xb5a1('0x69')]):_0x70dfca[_0xb5a1('0x67')][_0x6dc627]['field']+'\x20'+_0x70dfca['rules'][_0x6dc627][_0xb5a1('0x6a')]+(_0x4a3344(_0x70dfca[_0xb5a1('0x67')][_0x6dc627][_0xb5a1('0x6a')])?'\x20'+_0x70dfca[_0xb5a1('0x67')][_0x6dc627][_0xb5a1('0x6b')]:'');}return _0x11eb3c+')';};var _0x176fd7={'where':{'id':_0x412098[_0xb5a1('0x49')]['id']}},_0x10b7f9,_0x2c5d36,_0x48a1d7,_0x10d31e,_0x505633;_0x176fd7=_[_0xb5a1('0x43')]({},_0x176fd7,_0x412098['options']);return db[_0xb5a1('0x31')]['find'](_0x176fd7)['then'](function(_0x32ff7d){if(_0x32ff7d){_0x10b7f9=_0x32ff7d;return _0x32ff7d['getFields']();}return null;})[_0xb5a1('0x26')](function(_0xc0184f){if(_0xc0184f){if(!_0xc0184f[_0xb5a1('0x3b')]){throw new db[(_0xb5a1('0x6c'))][(_0xb5a1('0x6d'))](_0xb5a1('0x6e'),0x193);}_0x2c5d36=_0xc0184f;return db[_0xb5a1('0x6f')]['findAll']({'raw':!![]});}return null;})[_0xb5a1('0x26')](function(_0x333425){if(_0x333425){_0x48a1d7=_[_0xb5a1('0x70')](_0x333425,'id');var _0x1cd464;var _0x14b346=squel[_0xb5a1('0x71')]();_0x14b346['from'](_0x10b7f9[_0xb5a1('0x72')]);for(var _0x568235=0x0;_0x568235<_0x2c5d36[_0xb5a1('0x3b')];_0x568235+=0x1){_0x1cd464=_0x2c5d36[_0x568235][_0xb5a1('0x73')]?_0x48a1d7[_0x2c5d36[_0x568235][_0xb5a1('0x73')]][_0xb5a1('0x74')]:_0x2c5d36[_0x568235][_0xb5a1('0x75')];_0x1cd464=_0x2c5d36[_0x568235][_0xb5a1('0x76')]?_['replace'](_0x317820[_0x2c5d36[_0x568235]['function']],'%s',_0x1cd464):_0x1cd464;_0x1cd464=_0x2c5d36[_0x568235][_0xb5a1('0x77')]?_[_0xb5a1('0x78')](_0x547f06[_0x2c5d36[_0x568235]['format']],'%s',_0x1cd464):_0x1cd464;if(_0x2c5d36[_0x568235][_0xb5a1('0x79')]){_0x14b346[_0xb5a1('0x69')](_0x1cd464);}_0x2c5d36[_0x568235][_0xb5a1('0x7a')]&&_0x14b346['order'](_0x1cd464,_0x2c5d36[_0x568235][_0xb5a1('0x7a')]==='DESC'?![]:!![]);_0x14b346[_0xb5a1('0x75')](_0x1cd464,_0x2c5d36[_0x568235][_0xb5a1('0x7b')]||_0x1cd464);}if(_0x10b7f9['joins']){_0x10b7f9[_0xb5a1('0x7c')]=JSON['parse'](_0x10b7f9[_0xb5a1('0x7c')]);for(var _0x58f492=0x0;_0x58f492<_0x10b7f9[_0xb5a1('0x7c')]['length'];_0x58f492+=0x1){if(_0x10b7f9[_0xb5a1('0x7c')][_0x58f492]['type']&&_['includes'](_0x5b4b67,_0x10b7f9[_0xb5a1('0x7c')][_0x58f492][_0xb5a1('0x33')])&&_0x10b7f9['joins'][_0x58f492][_0xb5a1('0x7d')]&&_0x10b7f9[_0xb5a1('0x7c')][_0x58f492]['foreignTable']&&_0x10b7f9[_0xb5a1('0x7c')][_0x58f492][_0xb5a1('0x7e')]){_0x14b346[_0x10b7f9[_0xb5a1('0x7c')][_0x58f492][_0xb5a1('0x33')]](_0x10b7f9['joins'][_0x58f492][_0xb5a1('0x7f')],null,util[_0xb5a1('0x77')](_0xb5a1('0x80'),_0x10b7f9['table'],_0x10b7f9['joins'][_0x58f492][_0xb5a1('0x7d')],_0x10b7f9[_0xb5a1('0x7c')][_0x58f492][_0xb5a1('0x7f')],_0x10b7f9[_0xb5a1('0x7c')][_0x58f492]['foreignKey']));}}}if(_0x10b7f9['conditions']){_0x10b7f9[_0xb5a1('0x81')]=JSON['parse'](_0x10b7f9['conditions']);_0x14b346['where'](_0x2bf986(_0x10b7f9[_0xb5a1('0x81')]['group']));}_0x505633=_0x14b346[_0xb5a1('0x82')]();_0x14b346[_0xb5a1('0x21')](_0x34ee1c);_0x14b346['offset'](0x0);logger[_0xb5a1('0x83')](_0xb5a1('0x84'),_0x14b346[_0xb5a1('0x85')]());return dbH[_0xb5a1('0x86')][_0xb5a1('0x36')](_0x14b346[_0xb5a1('0x85')](),{'type':dbH[_0xb5a1('0x86')][_0xb5a1('0x87')][_0xb5a1('0x88')]});}})[_0xb5a1('0x26')](respondWithResult(_0x32c495,null))[_0xb5a1('0x47')](handleError(_0x32c495,null));};function runReport(_0x5880fe,_0x3b5eda,_0x1dc1da){var _0x3398a7=_0x3b5eda['name'];var _0x48ef7e=0xa;var _0x2ef385=[_0xb5a1('0x56'),'left_join',_0xb5a1('0x58'),_0xb5a1('0x89')];var _0x19f165={'SUM':_0xb5a1('0x8a'),'COUNT':_0xb5a1('0x59'),'COUNT DISTINCT':_0xb5a1('0x5a'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xb5a1('0x5d'),'GROUP_CONCAT':_0xb5a1('0x5e'),'GROUP_CONCAT ASC':_0xb5a1('0x5f'),'GROUP_CONCAT DESC':_0xb5a1('0x60')};var _0x3822d1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb5a1('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3da986=function(_0x342a5a){return!_[_0xb5a1('0x8b')]([_0xb5a1('0x8c'),'IS\x20NOT\x20NULL',_0xb5a1('0x65'),_0xb5a1('0x66')],_0x342a5a);};var _0x3fff0e=function(_0x42b0a8){if(!_0x42b0a8||!_0x42b0a8[_0xb5a1('0x67')][_0xb5a1('0x3b')]){return'';}for(var _0x329b74='(',_0x2b0ab6=0x0;_0x2b0ab6<_0x42b0a8[_0xb5a1('0x67')]['length'];_0x2b0ab6+=0x1){_0x2b0ab6>0x0&&(_0x329b74+='\x20'+_0x42b0a8[_0xb5a1('0x68')]+'\x20');_0x329b74+=_0x42b0a8[_0xb5a1('0x67')][_0x2b0ab6][_0xb5a1('0x69')]?_0x3fff0e(_0x42b0a8[_0xb5a1('0x67')][_0x2b0ab6][_0xb5a1('0x69')]):_0x42b0a8[_0xb5a1('0x67')][_0x2b0ab6][_0xb5a1('0x75')]+'\x20'+_0x42b0a8[_0xb5a1('0x67')][_0x2b0ab6][_0xb5a1('0x6a')]+(_0x3da986(_0x42b0a8['rules'][_0x2b0ab6][_0xb5a1('0x6a')])?'\x20'+_0x42b0a8[_0xb5a1('0x67')][_0x2b0ab6][_0xb5a1('0x6b')]:'');}return _0x329b74+')';};var _0x2ae3b8={'where':{'id':_0x5880fe['id']}},_0x3c8008,_0x47a238,_0x1d292a,_0x1258ea,_0x39462e;_0x2ae3b8=_[_0xb5a1('0x43')]({},_0x2ae3b8,_0x1dc1da);return db[_0xb5a1('0x31')]['find'](_0x2ae3b8)[_0xb5a1('0x26')](function(_0x1209f8){if(_0x1209f8){_0x3c8008=_0x1209f8;return _0x1209f8['getFields']();}return null;})['then'](function(_0x4463a9){if(_0x4463a9){if(!_0x4463a9['length']){throw new db[(_0xb5a1('0x6c'))][(_0xb5a1('0x6d'))](_0xb5a1('0x6e'),0x193);}_0x47a238=_0x4463a9;return db['AnalyticMetric'][_0xb5a1('0x46')]({'raw':!![]});}return null;})[_0xb5a1('0x26')](function(_0x252b2e){if(_0x252b2e){_0x1d292a=_[_0xb5a1('0x70')](_0x252b2e,'id');var _0x4fcfe3;var _0x12ad89=squel[_0xb5a1('0x71')]();_0x12ad89[_0xb5a1('0x8d')](_0x3c8008[_0xb5a1('0x72')]);for(var _0x20fedf=0x0;_0x20fedf<_0x47a238[_0xb5a1('0x3b')];_0x20fedf+=0x1){_0x4fcfe3=_0x47a238[_0x20fedf]['MetricId']?_0x1d292a[_0x47a238[_0x20fedf][_0xb5a1('0x73')]][_0xb5a1('0x74')]:_0x47a238[_0x20fedf][_0xb5a1('0x75')];_0x4fcfe3=_0x47a238[_0x20fedf][_0xb5a1('0x76')]?_[_0xb5a1('0x78')](_0x19f165[_0x47a238[_0x20fedf]['function']],'%s',_0x4fcfe3):_0x4fcfe3;_0x4fcfe3=_0x47a238[_0x20fedf][_0xb5a1('0x77')]?_[_0xb5a1('0x78')](_0x3822d1[_0x47a238[_0x20fedf][_0xb5a1('0x77')]],'%s',_0x4fcfe3):_0x4fcfe3;if(_0x47a238[_0x20fedf][_0xb5a1('0x79')]){_0x12ad89[_0xb5a1('0x69')](_0x4fcfe3);}_0x47a238[_0x20fedf]['orderBy']&&_0x12ad89[_0xb5a1('0x3e')](_0x4fcfe3,_0x47a238[_0x20fedf][_0xb5a1('0x7a')]===_0xb5a1('0x8e')?![]:!![]);_0x12ad89[_0xb5a1('0x75')](_0x4fcfe3,_0x47a238[_0x20fedf][_0xb5a1('0x7b')]||_0x4fcfe3);}if(_0x3c8008[_0xb5a1('0x7c')]){_0x3c8008[_0xb5a1('0x7c')]=JSON[_0xb5a1('0x8f')](_0x3c8008[_0xb5a1('0x7c')]);for(var _0xbf1d53=0x0;_0xbf1d53<_0x3c8008[_0xb5a1('0x7c')][_0xb5a1('0x3b')];_0xbf1d53+=0x1){if(_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x33')]&&_[_0xb5a1('0x8b')](_0x2ef385,_0x3c8008['joins'][_0xbf1d53][_0xb5a1('0x33')])&&_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x7d')]&&_0x3c8008['joins'][_0xbf1d53][_0xb5a1('0x7f')]&&_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x7e')]){_0x12ad89[_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x33')]](_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x7f')],null,util[_0xb5a1('0x77')](_0xb5a1('0x80'),_0x3c8008[_0xb5a1('0x72')],_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x7d')],_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x7f')],_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x7e')]));}}}if(_0x3c8008[_0xb5a1('0x81')]){_0x3c8008[_0xb5a1('0x81')]=JSON[_0xb5a1('0x8f')](_0x3c8008[_0xb5a1('0x81')]);_0x12ad89[_0xb5a1('0x40')](_0x3fff0e(_0x3c8008[_0xb5a1('0x81')][_0xb5a1('0x69')]));}_0x39462e=_0x12ad89[_0xb5a1('0x82')]();_0x12ad89['limit'](_0x48ef7e);_0x12ad89[_0xb5a1('0x20')](0x0);return;}})[_0xb5a1('0x26')](function(){if(_0x3b5eda[_0xb5a1('0x90')]===_0xb5a1('0x91')){return null;}var _0x418d7f=_[_0xb5a1('0x43')](_0x3b5eda,{'name':_0x3b5eda[_0xb5a1('0x92')]||_0x3b5eda['name']||_0x3c8008[_0xb5a1('0x2d')],'basename':_0x3398a7,'savename':util[_0xb5a1('0x77')]('%s-%s.%s',_0x3b5eda[_0xb5a1('0x2d')]||_0x3c8008[_0xb5a1('0x2d')],require(_0xb5a1('0x93'))[_0xb5a1('0x94')](0x4),_0x3b5eda[_0xb5a1('0x90')]||_0xb5a1('0x95')),'reportId':_0x3c8008['id'],'reportType':_0xb5a1('0x96')});return db[_0xb5a1('0x97')][_0xb5a1('0x4c')](_0x418d7f,{'raw':!![]});})[_0xb5a1('0x26')](function(_0x3f84c0){if(_0x3c8008[_0xb5a1('0x72')]===_0xb5a1('0x98')){_0x39462e['where'](_0x3c8008[_0xb5a1('0x72')]+_0xb5a1('0x99'),_0x3b5eda[_0xb5a1('0x9a')],_0x3b5eda['endDate']);}else{_0x39462e[_0xb5a1('0x40')](_0x3c8008[_0xb5a1('0x72')]+_0xb5a1('0x9b'),_0x3b5eda[_0xb5a1('0x9a')],_0x3b5eda[_0xb5a1('0x9c')]);}if(_0x3f84c0){logger[_0xb5a1('0x9d')]('Run\x20Query:',_0x39462e['toString']());require(_0xb5a1('0x9e'))[_0xb5a1('0x9f')](path[_0xb5a1('0x56')](__dirname,_0xb5a1('0xa0'),_0x3f84c0[_0xb5a1('0x90')]),[_0x3f84c0['id'],_0x39462e['toString'](),path[_0xb5a1('0x56')](__dirname,_0xb5a1('0xa1'),_0x3f84c0[_0xb5a1('0xa2')]),_0x3398a7]);return _0x3f84c0;}else{var _0x19446c=squel[_0xb5a1('0x71')]();_0x19446c['from']('('+_0x39462e['toString']()+')','countTable');_0x19446c[_0xb5a1('0x75')](_0xb5a1('0xa3'),'count');_0x39462e[_0xb5a1('0x21')](_0x3b5eda[_0xb5a1('0x21')]||_0x48ef7e);_0x39462e[_0xb5a1('0x20')](_0x3b5eda[_0xb5a1('0x20')]||0x0);return dbH[_0xb5a1('0x86')][_0xb5a1('0x36')](_0x19446c[_0xb5a1('0x85')](),{'type':dbH['sequelize'][_0xb5a1('0x87')][_0xb5a1('0x88')]})[_0xb5a1('0x26')](function(_0x25c030){if(!_0x25c030[_0xb5a1('0x3b')]){_0x1258ea=0x0;}else{_0x1258ea=_0x25c030[0x0][_0xb5a1('0x1f')]||0x0;}return dbH['sequelize']['query'](_0x39462e[_0xb5a1('0x85')](),{'type':dbH[_0xb5a1('0x86')][_0xb5a1('0x87')][_0xb5a1('0x88')]});})[_0xb5a1('0x26')](function(_0x33eb44){return{'rows':_0x33eb44||[],'count':_0x1258ea};});}});}exports[_0xb5a1('0xa4')]=function(_0x5c8912,_0x3840a8){return runReport(_0x5c8912[_0xb5a1('0x49')],_0x5c8912[_0xb5a1('0x36')],_0x5c8912['options'])[_0xb5a1('0x26')](respondWithResult(_0x3840a8,null))[_0xb5a1('0x47')](handleError(_0x3840a8,null));};exports[_0xb5a1('0xa5')]=runReport;exports[_0xb5a1('0x36')]=function(_0x5dfb61,_0x5c5c4e){var _0xe83ef5=0xa;var _0x17fa6e=[_0xb5a1('0x56'),'left_join',_0xb5a1('0x58'),_0xb5a1('0x89')];var _0x466238={'SUM':_0xb5a1('0x8a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb5a1('0x5a'),'MAX':_0xb5a1('0x5b'),'MIN':'MIN(%s)','AVG':_0xb5a1('0x5d'),'GROUP_CONCAT':_0xb5a1('0x5e'),'GROUP_CONCAT ASC':_0xb5a1('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1db6a7={'SEC_TO_TIME':_0xb5a1('0x61'),'DATE':_0xb5a1('0xa6'),'HOUR':_0xb5a1('0xa7'),'ROUND':_0xb5a1('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x31ef40=function(_0x5aaa6d){return!_[_0xb5a1('0x8b')]([_0xb5a1('0x8c'),_0xb5a1('0x64'),_0xb5a1('0x65'),_0xb5a1('0x66')],_0x5aaa6d);};var _0x161e05=function(_0x391a83){if(!_0x391a83||!_0x391a83[_0xb5a1('0x67')][_0xb5a1('0x3b')]){return'';}for(var _0x3969f7='(',_0x2a9ba9=0x0;_0x2a9ba9<_0x391a83['rules'][_0xb5a1('0x3b')];_0x2a9ba9+=0x1){_0x2a9ba9>0x0&&(_0x3969f7+='\x20'+_0x391a83[_0xb5a1('0x68')]+'\x20');_0x3969f7+=_0x391a83[_0xb5a1('0x67')][_0x2a9ba9][_0xb5a1('0x69')]?_0x161e05(_0x391a83[_0xb5a1('0x67')][_0x2a9ba9][_0xb5a1('0x69')]):_0x391a83['rules'][_0x2a9ba9]['field']+'\x20'+_0x391a83[_0xb5a1('0x67')][_0x2a9ba9][_0xb5a1('0x6a')]+(_0x31ef40(_0x391a83[_0xb5a1('0x67')][_0x2a9ba9]['condition'])?'\x20'+_0x391a83[_0xb5a1('0x67')][_0x2a9ba9][_0xb5a1('0x6b')]:'');}return _0x3969f7+')';};var _0x540dcd={'where':{'id':_0x5dfb61[_0xb5a1('0x49')]['id']}},_0x4dd37d,_0x1e882d,_0x1fd3a2,_0x32afd0,_0x4e152a;_0x540dcd=_['merge']({},_0x540dcd,_0x5dfb61['options']);return db[_0xb5a1('0x31')][_0xb5a1('0x4b')](_0x540dcd)[_0xb5a1('0x26')](function(_0x53836f){if(_0x53836f){_0x4dd37d=_0x53836f;return _0x53836f[_0xb5a1('0xa8')]();}return null;})[_0xb5a1('0x26')](function(_0x57f309){if(_0x57f309){if(!_0x57f309[_0xb5a1('0x3b')]){throw new db['Sequelize'][(_0xb5a1('0x6d'))](_0xb5a1('0x6e'),0x193);}_0x1e882d=_0x57f309;return db[_0xb5a1('0x6f')][_0xb5a1('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3df21a){if(_0x3df21a){_0x1fd3a2=_[_0xb5a1('0x70')](_0x3df21a,'id');var _0x15d119;var _0x150028=squel[_0xb5a1('0x71')]();_0x150028[_0xb5a1('0x8d')](_0x4dd37d[_0xb5a1('0x72')]);for(var _0x3961ca=0x0;_0x3961ca<_0x1e882d[_0xb5a1('0x3b')];_0x3961ca+=0x1){_0x15d119=_0x1e882d[_0x3961ca]['MetricId']?_0x1fd3a2[_0x1e882d[_0x3961ca][_0xb5a1('0x73')]]['metric']:_0x1e882d[_0x3961ca][_0xb5a1('0x75')];_0x15d119=_0x1e882d[_0x3961ca][_0xb5a1('0x76')]?_[_0xb5a1('0x78')](_0x466238[_0x1e882d[_0x3961ca][_0xb5a1('0x76')]],'%s',_0x15d119):_0x15d119;_0x15d119=_0x1e882d[_0x3961ca][_0xb5a1('0x77')]?_[_0xb5a1('0x78')](_0x1db6a7[_0x1e882d[_0x3961ca][_0xb5a1('0x77')]],'%s',_0x15d119):_0x15d119;if(_0x1e882d[_0x3961ca][_0xb5a1('0x79')]){_0x150028['group'](_0x15d119);}_0x1e882d[_0x3961ca]['orderBy']&&_0x150028['order'](_0x15d119,_0x1e882d[_0x3961ca][_0xb5a1('0x7a')]==='DESC'?![]:!![]);_0x150028[_0xb5a1('0x75')](_0x15d119,_0x1e882d[_0x3961ca][_0xb5a1('0x7b')]||_0x15d119);}if(_0x4dd37d[_0xb5a1('0x7c')]){_0x4dd37d[_0xb5a1('0x7c')]=JSON['parse'](_0x4dd37d['joins']);for(var _0x375695=0x0;_0x375695<_0x4dd37d[_0xb5a1('0x7c')]['length'];_0x375695+=0x1){if(_0x4dd37d[_0xb5a1('0x7c')][_0x375695][_0xb5a1('0x33')]&&_[_0xb5a1('0x8b')](_0x17fa6e,_0x4dd37d['joins'][_0x375695][_0xb5a1('0x33')])&&_0x4dd37d['joins'][_0x375695][_0xb5a1('0x7d')]&&_0x4dd37d['joins'][_0x375695][_0xb5a1('0x7f')]&&_0x4dd37d[_0xb5a1('0x7c')][_0x375695][_0xb5a1('0x7e')]){_0x150028[_0x4dd37d['joins'][_0x375695][_0xb5a1('0x33')]](_0x4dd37d[_0xb5a1('0x7c')][_0x375695]['foreignTable'],null,util['format'](_0xb5a1('0x80'),_0x4dd37d[_0xb5a1('0x72')],_0x4dd37d['joins'][_0x375695][_0xb5a1('0x7d')],_0x4dd37d[_0xb5a1('0x7c')][_0x375695][_0xb5a1('0x7f')],_0x4dd37d['joins'][_0x375695][_0xb5a1('0x7e')]));}}}if(_0x4dd37d['conditions']){_0x4dd37d[_0xb5a1('0x81')]=JSON[_0xb5a1('0x8f')](_0x4dd37d[_0xb5a1('0x81')]);_0x150028['where'](_0x161e05(_0x4dd37d[_0xb5a1('0x81')][_0xb5a1('0x69')]));}_0x4e152a=_0x150028[_0xb5a1('0x82')]();_0x150028[_0xb5a1('0x21')](_0xe83ef5);_0x150028[_0xb5a1('0x20')](0x0);logger[_0xb5a1('0x83')](_0xb5a1('0x84'),_0x150028[_0xb5a1('0x85')]());return dbH['sequelize']['query'](_0x150028[_0xb5a1('0x85')](),{'type':dbH[_0xb5a1('0x86')][_0xb5a1('0x87')]['SELECT']});}})['then'](function(){return{'sql':_0x4e152a[_0xb5a1('0x85')]()};})['then'](respondWithResult(_0x5c5c4e,null))[_0xb5a1('0x47')](handleError(_0x5c5c4e,null));}; \ No newline at end of file +var _0xb466=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','merge','options','include','AnalyticCustomReport','findAll','catch','show','params','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','value','getFields','select','metric','groupBy','%s.%s\x20=\x20%s.%s','foreignKey','output','%s-%s.%s','randomstring','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','countTable','COUNT(*)','run','runReport','right_join','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys'];(function(_0x31f208,_0x28b633){var _0x195dc2=function(_0x1ff0c7){while(--_0x1ff0c7){_0x31f208['push'](_0x31f208['shift']());}};_0x195dc2(++_0x28b633);}(_0xb466,0x6d));var _0x6b46=function(_0x271ff8,_0x312078){_0x271ff8=_0x271ff8-0x0;var _0x341a46=_0xb466[_0x271ff8];return _0x341a46;};'use strict';var pdf=require(_0x6b46('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6b46('0x1'));var zipdir=require(_0x6b46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b46('0x3'));var moment=require(_0x6b46('0x4'));var BPromise=require(_0x6b46('0x5'));var Mustache=require(_0x6b46('0x6'));var util=require(_0x6b46('0x7'));var path=require(_0x6b46('0x8'));var sox=require(_0x6b46('0x9'));var csv=require(_0x6b46('0xa'));var ejs=require(_0x6b46('0xb'));var fs=require('fs');var _=require(_0x6b46('0xc'));var squel=require(_0x6b46('0xd'));var crypto=require('crypto');var jsforce=require(_0x6b46('0xe'));var deskjs=require(_0x6b46('0xf'));var toCsv=require(_0x6b46('0xa'));var querystring=require(_0x6b46('0x10'));var Papa=require(_0x6b46('0x11'));var Redis=require('ioredis');var authService=require(_0x6b46('0x12'));var qs=require(_0x6b46('0x13'));var as=require(_0x6b46('0x14'));var hardwareService=require(_0x6b46('0x15'));var logger=require('../../config/logger')(_0x6b46('0x16'));var utils=require(_0x6b46('0x17'));var config=require(_0x6b46('0x18'));var licenseUtil=require(_0x6b46('0x19'));var db=require(_0x6b46('0x1a'))['db'];var dbH=require(_0x6b46('0x1a'))[_0x6b46('0x1b')];function respondWithStatusCode(_0x2bcdb5,_0x4ad476){_0x4ad476=_0x4ad476||0xcc;return function(_0x3d506a){if(_0x3d506a){return _0x2bcdb5[_0x6b46('0x1c')](_0x4ad476);}return _0x2bcdb5['status'](_0x4ad476)[_0x6b46('0x1d')]();};}function respondWithResult(_0x12d5f8,_0x14c551){_0x14c551=_0x14c551||0xc8;return function(_0x3d9675){if(_0x3d9675){return _0x12d5f8[_0x6b46('0x1e')](_0x14c551)[_0x6b46('0x1f')](_0x3d9675);}};}function respondWithFilteredResult(_0x1ce80d,_0x47655c){return function(_0x1dcde5){if(_0x1dcde5){var _0x33079a=_0x1dcde5[_0x6b46('0x20')],_0x4b9598=_0x47655c['offset'],_0x487e27=_0x47655c[_0x6b46('0x21')]+_0x47655c[_0x6b46('0x22')],_0x1008cf;if(_0x487e27>=_0x33079a){_0x487e27=_0x33079a;_0x1008cf=0xc8;}else{_0x1008cf=0xce;}_0x1ce80d[_0x6b46('0x1e')](_0x1008cf);return _0x1ce80d[_0x6b46('0x23')](_0x6b46('0x24'),_0x4b9598+'-'+_0x487e27+'/'+_0x33079a)[_0x6b46('0x1f')](_0x1dcde5);}return null;};}function patchUpdates(_0x1e6b5d){return function(_0x38d5cf){try{jsonpatch[_0x6b46('0x25')](_0x38d5cf,_0x1e6b5d,!![]);}catch(_0x5da1c2){return BPromise[_0x6b46('0x26')](_0x5da1c2);}return _0x38d5cf['save']();};}function saveUpdates(_0x5a2d19,_0xd36cfe){return function(_0x21d372){if(_0x21d372){return _0x21d372[_0x6b46('0x27')](_0x5a2d19)[_0x6b46('0x28')](function(_0x490482){return _0x490482;});}return null;};}function removeEntity(_0x2f5a4e,_0x4d3022){return function(_0x40b20d){if(_0x40b20d){return _0x40b20d[_0x6b46('0x29')]()[_0x6b46('0x28')](function(){var _0x2e2630=_0x40b20d[_0x6b46('0x2a')]({'plain':!![]});var _0x1adc2d=_0x6b46('0x2b');return db[_0x6b46('0x2c')]['destroy']({'where':{'type':_0x1adc2d,'resourceId':_0x2e2630['id']}})['then'](function(){return _0x40b20d;});})[_0x6b46('0x28')](function(){_0x2f5a4e[_0x6b46('0x1e')](0xcc)[_0x6b46('0x1d')]();});}};}function handleEntityNotFound(_0x316e87,_0x1719b3){return function(_0x35aede){if(!_0x35aede){_0x316e87['sendStatus'](0x194);}return _0x35aede;};}function handleError(_0x5d3c9e,_0x2a1801){_0x2a1801=_0x2a1801||0x1f4;return function(_0x11541f){logger[_0x6b46('0x2d')](_0x11541f[_0x6b46('0x2e')]);if(_0x11541f[_0x6b46('0x2f')]){delete _0x11541f[_0x6b46('0x2f')];}_0x5d3c9e[_0x6b46('0x1e')](_0x2a1801)[_0x6b46('0x30')](_0x11541f);};}exports['index']=function(_0x2a91e9,_0x338d53){var _0x168d78={},_0x3a82b5={},_0x3f7b73={'count':0x0,'rows':[]};var _0x35c073=_[_0x6b46('0x31')](db['AnalyticCustomReport'][_0x6b46('0x32')],function(_0x12e586){return{'name':_0x12e586[_0x6b46('0x33')],'type':_0x12e586['type'][_0x6b46('0x34')]};});_0x3a82b5[_0x6b46('0x35')]=_[_0x6b46('0x31')](_0x35c073,_0x6b46('0x2f'));_0x3a82b5[_0x6b46('0x36')]=_[_0x6b46('0x37')](_0x2a91e9[_0x6b46('0x36')]);_0x3a82b5['filters']=_[_0x6b46('0x38')](_0x3a82b5['model'],_0x3a82b5['query']);_0x168d78['attributes']=_['intersection'](_0x3a82b5['model'],qs[_0x6b46('0x39')](_0x2a91e9[_0x6b46('0x36')][_0x6b46('0x39')]));_0x168d78['attributes']=_0x168d78[_0x6b46('0x3a')][_0x6b46('0x3b')]?_0x168d78[_0x6b46('0x3a')]:_0x3a82b5[_0x6b46('0x35')];if(!_0x2a91e9['query'][_0x6b46('0x3c')](_0x6b46('0x3d'))){_0x168d78[_0x6b46('0x22')]=qs[_0x6b46('0x22')](_0x2a91e9[_0x6b46('0x36')]['limit']);_0x168d78['offset']=qs[_0x6b46('0x21')](_0x2a91e9['query']['offset']);}_0x168d78[_0x6b46('0x3e')]=qs['sort'](_0x2a91e9[_0x6b46('0x36')][_0x6b46('0x3f')]);_0x168d78[_0x6b46('0x40')]=qs[_0x6b46('0x41')](_[_0x6b46('0x42')](_0x2a91e9[_0x6b46('0x36')],_0x3a82b5['filters']),_0x35c073);if(_0x2a91e9[_0x6b46('0x36')][_0x6b46('0x43')]){_0x168d78[_0x6b46('0x40')]=_['merge'](_0x168d78['where'],{'$or':_[_0x6b46('0x31')](_0x35c073,function(_0x52a0d9){if(_0x52a0d9[_0x6b46('0x44')]!=='VIRTUAL'){var _0x3b608d={};_0x3b608d[_0x52a0d9[_0x6b46('0x2f')]]={'$like':'%'+_0x2a91e9[_0x6b46('0x36')][_0x6b46('0x43')]+'%'};return _0x3b608d;}})});}_0x168d78=_[_0x6b46('0x45')]({},_0x168d78,_0x2a91e9[_0x6b46('0x46')]);var _0x2186d0={'where':_0x168d78[_0x6b46('0x40')]};return db['AnalyticCustomReport'][_0x6b46('0x20')](_0x2186d0)[_0x6b46('0x28')](function(_0x54f58e){_0x3f7b73[_0x6b46('0x20')]=_0x54f58e;if(_0x2a91e9[_0x6b46('0x36')]['includeAll']){_0x168d78[_0x6b46('0x47')]=[{'all':!![]}];}return db[_0x6b46('0x48')][_0x6b46('0x49')](_0x168d78);})[_0x6b46('0x28')](function(_0x357123){_0x3f7b73['rows']=_0x357123;return _0x3f7b73;})[_0x6b46('0x28')](respondWithFilteredResult(_0x338d53,_0x168d78))[_0x6b46('0x4a')](handleError(_0x338d53,null));};exports[_0x6b46('0x4b')]=function(_0x591b3f,_0x429550){var _0x7ee13e={'raw':![],'where':{'id':_0x591b3f[_0x6b46('0x4c')]['id']}},_0x310ddb={};_0x310ddb['model']=_[_0x6b46('0x37')](db[_0x6b46('0x48')][_0x6b46('0x32')]);_0x310ddb[_0x6b46('0x36')]=_['keys'](_0x591b3f[_0x6b46('0x36')]);_0x310ddb[_0x6b46('0x41')]=_[_0x6b46('0x38')](_0x310ddb[_0x6b46('0x35')],_0x310ddb[_0x6b46('0x36')]);_0x7ee13e['attributes']=_['intersection'](_0x310ddb[_0x6b46('0x35')],qs[_0x6b46('0x39')](_0x591b3f[_0x6b46('0x36')][_0x6b46('0x39')]));_0x7ee13e[_0x6b46('0x3a')]=_0x7ee13e[_0x6b46('0x3a')][_0x6b46('0x3b')]?_0x7ee13e[_0x6b46('0x3a')]:_0x310ddb['model'];if(_0x591b3f['query']['includeAll']){_0x7ee13e['include']=[{'all':!![]}];}_0x7ee13e=_[_0x6b46('0x45')]({},_0x7ee13e,_0x591b3f[_0x6b46('0x46')]);return db[_0x6b46('0x48')]['find'](_0x7ee13e)[_0x6b46('0x28')](handleEntityNotFound(_0x429550,null))[_0x6b46('0x28')](respondWithResult(_0x429550,null))['catch'](handleError(_0x429550,null));};exports['create']=function(_0x2eed3c,_0x3f3f72){return db[_0x6b46('0x48')]['create'](_0x2eed3c[_0x6b46('0x4d')],{})[_0x6b46('0x28')](function(_0x665aa){var _0x5ac912=_0x2eed3c[_0x6b46('0x4e')]['get']({'plain':!![]});if(!_0x5ac912)throw new Error(_0x6b46('0x4f'));if(_0x5ac912[_0x6b46('0x50')]===_0x6b46('0x4e')){var _0x3e2144=_0x665aa[_0x6b46('0x2a')]({'plain':!![]});var _0x52a62d=_0x6b46('0x51');return db[_0x6b46('0x52')][_0x6b46('0x53')]({'where':{'name':_0x52a62d,'userProfileId':_0x5ac912['userProfileId']},'raw':!![]})[_0x6b46('0x28')](function(_0x3fc20a){if(_0x3fc20a&&_0x3fc20a[_0x6b46('0x54')]===0x0){return db['UserProfileResource'][_0x6b46('0x55')]({'name':_0x3e2144[_0x6b46('0x2f')],'resourceId':_0x3e2144['id'],'type':_0x6b46('0x2b'),'sectionId':_0x3fc20a['id']},{})['then'](function(){return _0x665aa;});}else{return _0x665aa;}})[_0x6b46('0x4a')](function(_0xe0f217){logger[_0x6b46('0x2d')](_0x6b46('0x56'),_0xe0f217);throw _0xe0f217;});}return _0x665aa;})['then'](respondWithResult(_0x3f3f72,0xc9))[_0x6b46('0x4a')](handleError(_0x3f3f72,null));};exports['update']=function(_0x3331f3,_0xd140d7){if(_0x3331f3['body']['id']){delete _0x3331f3[_0x6b46('0x4d')]['id'];}return db['AnalyticCustomReport'][_0x6b46('0x53')]({'where':{'id':_0x3331f3[_0x6b46('0x4c')]['id']}})['then'](handleEntityNotFound(_0xd140d7,null))['then'](saveUpdates(_0x3331f3[_0x6b46('0x4d')],null))['then'](respondWithResult(_0xd140d7,null))[_0x6b46('0x4a')](handleError(_0xd140d7,null));};exports[_0x6b46('0x29')]=function(_0x299209,_0x559eb7){return db[_0x6b46('0x48')]['find']({'where':{'id':_0x299209[_0x6b46('0x4c')]['id']}})[_0x6b46('0x28')](handleEntityNotFound(_0x559eb7,null))['then'](removeEntity(_0x559eb7,null))[_0x6b46('0x4a')](handleError(_0x559eb7,null));};exports['preview']=function(_0x3fa938,_0x1fb0fd){var _0x37e99d=0xa;var _0x5c170e=[_0x6b46('0x57'),_0x6b46('0x58'),'right_join',_0x6b46('0x59')];var _0x27e69f={'SUM':_0x6b46('0x5a'),'COUNT':_0x6b46('0x5b'),'COUNT DISTINCT':_0x6b46('0x5c'),'MAX':_0x6b46('0x5d'),'MIN':_0x6b46('0x5e'),'AVG':_0x6b46('0x5f'),'GROUP_CONCAT':_0x6b46('0x60'),'GROUP_CONCAT ASC':_0x6b46('0x61'),'GROUP_CONCAT DESC':_0x6b46('0x62')};var _0x35b194={'SEC_TO_TIME':_0x6b46('0x63'),'DATE':_0x6b46('0x64'),'HOUR':_0x6b46('0x65'),'ROUND':_0x6b46('0x66'),'UNIX_TIMESTAMP':_0x6b46('0x67')};var _0xb256fb=function(_0x14c01a){return!_[_0x6b46('0x68')]([_0x6b46('0x69'),_0x6b46('0x6a'),_0x6b46('0x6b'),_0x6b46('0x6c')],_0x14c01a);};var _0x13045d=function(_0x35fbd4){if(!_0x35fbd4||!_0x35fbd4[_0x6b46('0x6d')][_0x6b46('0x3b')]){return'';}for(var _0x20b0c5='(',_0xcdf94e=0x0;_0xcdf94e<_0x35fbd4[_0x6b46('0x6d')][_0x6b46('0x3b')];_0xcdf94e+=0x1){_0xcdf94e>0x0&&(_0x20b0c5+='\x20'+_0x35fbd4[_0x6b46('0x6e')]+'\x20');_0x20b0c5+=_0x35fbd4[_0x6b46('0x6d')][_0xcdf94e][_0x6b46('0x6f')]?_0x13045d(_0x35fbd4['rules'][_0xcdf94e]['group']):_0x35fbd4['rules'][_0xcdf94e][_0x6b46('0x70')]+'\x20'+_0x35fbd4[_0x6b46('0x6d')][_0xcdf94e][_0x6b46('0x71')]+(_0xb256fb(_0x35fbd4[_0x6b46('0x6d')][_0xcdf94e]['condition'])?'\x20'+_0x35fbd4['rules'][_0xcdf94e]['value']:'');}return _0x20b0c5+')';};var _0x4fde0f={'where':{'id':_0x3fa938['params']['id']}},_0x414a82,_0x1867d8,_0x3c9593,_0x4bb45e,_0x51981b;_0x4fde0f=_[_0x6b46('0x45')]({},_0x4fde0f,_0x3fa938[_0x6b46('0x46')]);return db['AnalyticCustomReport']['find'](_0x4fde0f)['then'](function(_0x509971){if(_0x509971){_0x414a82=_0x509971;return _0x509971['getFields']();}return null;})[_0x6b46('0x28')](function(_0x93c5de){if(_0x93c5de){if(!_0x93c5de[_0x6b46('0x3b')]){throw new db[(_0x6b46('0x72'))][(_0x6b46('0x73'))](_0x6b46('0x74'),0x193);}_0x1867d8=_0x93c5de;return db[_0x6b46('0x75')][_0x6b46('0x49')]({'raw':!![]});}return null;})[_0x6b46('0x28')](function(_0x442dd1){if(_0x442dd1){_0x3c9593=_[_0x6b46('0x76')](_0x442dd1,'id');var _0x17d073;var _0x4d34f6=squel['select']();_0x4d34f6[_0x6b46('0x77')](_0x414a82[_0x6b46('0x78')]);for(var _0x37f2d=0x0;_0x37f2d<_0x1867d8[_0x6b46('0x3b')];_0x37f2d+=0x1){_0x17d073=_0x1867d8[_0x37f2d][_0x6b46('0x79')]?_0x3c9593[_0x1867d8[_0x37f2d]['MetricId']]['metric']:_0x1867d8[_0x37f2d][_0x6b46('0x70')];_0x17d073=_0x1867d8[_0x37f2d]['function']?_[_0x6b46('0x7a')](_0x27e69f[_0x1867d8[_0x37f2d][_0x6b46('0x7b')]],'%s',_0x17d073):_0x17d073;_0x17d073=_0x1867d8[_0x37f2d]['format']?_[_0x6b46('0x7a')](_0x35b194[_0x1867d8[_0x37f2d][_0x6b46('0x7c')]],'%s',_0x17d073):_0x17d073;if(_0x1867d8[_0x37f2d]['groupBy']){_0x4d34f6[_0x6b46('0x6f')](_0x17d073);}_0x1867d8[_0x37f2d][_0x6b46('0x7d')]&&_0x4d34f6['order'](_0x17d073,_0x1867d8[_0x37f2d]['orderBy']===_0x6b46('0x7e')?![]:!![]);_0x4d34f6['field'](_0x17d073,_0x1867d8[_0x37f2d][_0x6b46('0x7f')]||_0x17d073);}if(_0x414a82[_0x6b46('0x80')]){_0x414a82[_0x6b46('0x80')]=JSON[_0x6b46('0x81')](_0x414a82[_0x6b46('0x80')]);for(var _0x5b080c=0x0;_0x5b080c<_0x414a82[_0x6b46('0x80')][_0x6b46('0x3b')];_0x5b080c+=0x1){if(_0x414a82[_0x6b46('0x80')][_0x5b080c][_0x6b46('0x44')]&&_[_0x6b46('0x68')](_0x5c170e,_0x414a82[_0x6b46('0x80')][_0x5b080c]['type'])&&_0x414a82[_0x6b46('0x80')][_0x5b080c][_0x6b46('0x82')]&&_0x414a82[_0x6b46('0x80')][_0x5b080c][_0x6b46('0x83')]&&_0x414a82['joins'][_0x5b080c]['foreignKey']){_0x4d34f6[_0x414a82[_0x6b46('0x80')][_0x5b080c][_0x6b46('0x44')]](_0x414a82[_0x6b46('0x80')][_0x5b080c][_0x6b46('0x83')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x414a82[_0x6b46('0x78')],_0x414a82['joins'][_0x5b080c]['parentKey'],_0x414a82[_0x6b46('0x80')][_0x5b080c][_0x6b46('0x83')],_0x414a82[_0x6b46('0x80')][_0x5b080c]['foreignKey']));}}}if(_0x414a82[_0x6b46('0x84')]){_0x414a82[_0x6b46('0x84')]=JSON[_0x6b46('0x81')](_0x414a82[_0x6b46('0x84')]);_0x4d34f6['where'](_0x13045d(_0x414a82[_0x6b46('0x84')][_0x6b46('0x6f')]));}_0x51981b=_0x4d34f6[_0x6b46('0x85')]();_0x4d34f6['limit'](_0x37e99d);_0x4d34f6['offset'](0x0);logger[_0x6b46('0x86')](_0x6b46('0x87'),_0x4d34f6[_0x6b46('0x88')]());return dbH['sequelize'][_0x6b46('0x36')](_0x4d34f6[_0x6b46('0x88')](),{'type':dbH[_0x6b46('0x89')][_0x6b46('0x8a')][_0x6b46('0x8b')]});}})['then'](respondWithResult(_0x1fb0fd,null))[_0x6b46('0x4a')](handleError(_0x1fb0fd,null));};function runReport(_0x535686,_0x20bef6,_0x2b8f4c){var _0x5b3cb2=_0x20bef6[_0x6b46('0x2f')];var _0x4545d9=0xa;var _0x29cbfe=['join','left_join','right_join',_0x6b46('0x59')];var _0x461aee={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x6b46('0x5c'),'MAX':_0x6b46('0x5d'),'MIN':_0x6b46('0x5e'),'AVG':_0x6b46('0x5f'),'GROUP_CONCAT':_0x6b46('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4a1ba6={'SEC_TO_TIME':_0x6b46('0x63'),'DATE':_0x6b46('0x64'),'HOUR':_0x6b46('0x65'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x6b46('0x67')};var _0x1f4518=function(_0x1aedc4){return!_['includes']([_0x6b46('0x69'),'IS\x20NOT\x20NULL',_0x6b46('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1aedc4);};var _0x1447ed=function(_0x35a1fd){if(!_0x35a1fd||!_0x35a1fd['rules'][_0x6b46('0x3b')]){return'';}for(var _0x5e9aa1='(',_0x3be735=0x0;_0x3be735<_0x35a1fd[_0x6b46('0x6d')][_0x6b46('0x3b')];_0x3be735+=0x1){_0x3be735>0x0&&(_0x5e9aa1+='\x20'+_0x35a1fd[_0x6b46('0x6e')]+'\x20');_0x5e9aa1+=_0x35a1fd['rules'][_0x3be735][_0x6b46('0x6f')]?_0x1447ed(_0x35a1fd[_0x6b46('0x6d')][_0x3be735]['group']):_0x35a1fd[_0x6b46('0x6d')][_0x3be735][_0x6b46('0x70')]+'\x20'+_0x35a1fd[_0x6b46('0x6d')][_0x3be735]['condition']+(_0x1f4518(_0x35a1fd[_0x6b46('0x6d')][_0x3be735]['condition'])?'\x20'+_0x35a1fd[_0x6b46('0x6d')][_0x3be735][_0x6b46('0x8c')]:'');}return _0x5e9aa1+')';};var _0x258b22={'where':{'id':_0x535686['id']}},_0x402933,_0x4f2c94,_0x5e5717,_0xd2a99f,_0x52864b;_0x258b22=_[_0x6b46('0x45')]({},_0x258b22,_0x2b8f4c);return db[_0x6b46('0x48')][_0x6b46('0x53')](_0x258b22)[_0x6b46('0x28')](function(_0x36d5dd){if(_0x36d5dd){_0x402933=_0x36d5dd;return _0x36d5dd[_0x6b46('0x8d')]();}return null;})[_0x6b46('0x28')](function(_0x57e013){if(_0x57e013){if(!_0x57e013['length']){throw new db[(_0x6b46('0x72'))][(_0x6b46('0x73'))](_0x6b46('0x74'),0x193);}_0x4f2c94=_0x57e013;return db[_0x6b46('0x75')][_0x6b46('0x49')]({'raw':!![]});}return null;})['then'](function(_0x41da1f){if(_0x41da1f){_0x5e5717=_[_0x6b46('0x76')](_0x41da1f,'id');var _0x12b026;var _0x39091a=squel[_0x6b46('0x8e')]();_0x39091a['from'](_0x402933[_0x6b46('0x78')]);for(var _0x1ebaf8=0x0;_0x1ebaf8<_0x4f2c94[_0x6b46('0x3b')];_0x1ebaf8+=0x1){_0x12b026=_0x4f2c94[_0x1ebaf8][_0x6b46('0x79')]?_0x5e5717[_0x4f2c94[_0x1ebaf8][_0x6b46('0x79')]][_0x6b46('0x8f')]:_0x4f2c94[_0x1ebaf8][_0x6b46('0x70')];_0x12b026=_0x4f2c94[_0x1ebaf8][_0x6b46('0x7b')]?_['replace'](_0x461aee[_0x4f2c94[_0x1ebaf8][_0x6b46('0x7b')]],'%s',_0x12b026):_0x12b026;_0x12b026=_0x4f2c94[_0x1ebaf8][_0x6b46('0x7c')]?_[_0x6b46('0x7a')](_0x4a1ba6[_0x4f2c94[_0x1ebaf8]['format']],'%s',_0x12b026):_0x12b026;if(_0x4f2c94[_0x1ebaf8][_0x6b46('0x90')]){_0x39091a[_0x6b46('0x6f')](_0x12b026);}_0x4f2c94[_0x1ebaf8][_0x6b46('0x7d')]&&_0x39091a[_0x6b46('0x3e')](_0x12b026,_0x4f2c94[_0x1ebaf8][_0x6b46('0x7d')]==='DESC'?![]:!![]);_0x39091a['field'](_0x12b026,_0x4f2c94[_0x1ebaf8][_0x6b46('0x7f')]||_0x12b026);}if(_0x402933[_0x6b46('0x80')]){_0x402933['joins']=JSON[_0x6b46('0x81')](_0x402933[_0x6b46('0x80')]);for(var _0x45426c=0x0;_0x45426c<_0x402933['joins'][_0x6b46('0x3b')];_0x45426c+=0x1){if(_0x402933[_0x6b46('0x80')][_0x45426c][_0x6b46('0x44')]&&_[_0x6b46('0x68')](_0x29cbfe,_0x402933[_0x6b46('0x80')][_0x45426c][_0x6b46('0x44')])&&_0x402933[_0x6b46('0x80')][_0x45426c][_0x6b46('0x82')]&&_0x402933[_0x6b46('0x80')][_0x45426c][_0x6b46('0x83')]&&_0x402933[_0x6b46('0x80')][_0x45426c]['foreignKey']){_0x39091a[_0x402933[_0x6b46('0x80')][_0x45426c][_0x6b46('0x44')]](_0x402933['joins'][_0x45426c][_0x6b46('0x83')],null,util[_0x6b46('0x7c')](_0x6b46('0x91'),_0x402933['table'],_0x402933[_0x6b46('0x80')][_0x45426c][_0x6b46('0x82')],_0x402933[_0x6b46('0x80')][_0x45426c][_0x6b46('0x83')],_0x402933[_0x6b46('0x80')][_0x45426c][_0x6b46('0x92')]));}}}if(_0x402933[_0x6b46('0x84')]){_0x402933[_0x6b46('0x84')]=JSON[_0x6b46('0x81')](_0x402933[_0x6b46('0x84')]);_0x39091a[_0x6b46('0x40')](_0x1447ed(_0x402933[_0x6b46('0x84')]['group']));}_0x52864b=_0x39091a[_0x6b46('0x85')]();_0x39091a['limit'](_0x4545d9);_0x39091a[_0x6b46('0x21')](0x0);return;}})[_0x6b46('0x28')](function(){if(_0x20bef6[_0x6b46('0x93')]==='web'){return null;}var _0x5b2a6d=_[_0x6b46('0x45')](_0x20bef6,{'name':_0x20bef6['fullPath']||_0x20bef6[_0x6b46('0x2f')]||_0x402933['name'],'basename':_0x5b3cb2,'savename':util[_0x6b46('0x7c')](_0x6b46('0x94'),_0x20bef6[_0x6b46('0x2f')]||_0x402933[_0x6b46('0x2f')],require(_0x6b46('0x95'))['generate'](0x4),_0x20bef6[_0x6b46('0x93')]||'csv'),'reportId':_0x402933['id'],'reportType':_0x6b46('0x96')});return db[_0x6b46('0x97')][_0x6b46('0x55')](_0x5b2a6d,{'raw':!![]});})[_0x6b46('0x28')](function(_0x43e7da){if(_0x402933[_0x6b46('0x78')]===_0x6b46('0x98')){_0x52864b[_0x6b46('0x40')](_0x402933[_0x6b46('0x78')]+_0x6b46('0x99'),_0x20bef6[_0x6b46('0x9a')],_0x20bef6['endDate']);}else{_0x52864b[_0x6b46('0x40')](_0x402933[_0x6b46('0x78')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x20bef6[_0x6b46('0x9a')],_0x20bef6[_0x6b46('0x9b')]);}if(_0x43e7da){logger['info'](_0x6b46('0x9c'),_0x52864b[_0x6b46('0x88')]());require(_0x6b46('0x9d'))[_0x6b46('0x9e')](path[_0x6b46('0x57')](__dirname,_0x6b46('0x9f'),_0x43e7da['output']),[_0x43e7da['id'],_0x52864b[_0x6b46('0x88')](),path[_0x6b46('0x57')](__dirname,'../../files/reports',_0x43e7da['savename']),_0x5b3cb2]);return _0x43e7da;}else{var _0x1bba5c=squel['select']();_0x1bba5c[_0x6b46('0x77')]('('+_0x52864b['toString']()+')',_0x6b46('0xa0'));_0x1bba5c[_0x6b46('0x70')](_0x6b46('0xa1'),'count');_0x52864b[_0x6b46('0x22')](_0x20bef6[_0x6b46('0x22')]||_0x4545d9);_0x52864b[_0x6b46('0x21')](_0x20bef6[_0x6b46('0x21')]||0x0);return dbH[_0x6b46('0x89')][_0x6b46('0x36')](_0x1bba5c['toString'](),{'type':dbH[_0x6b46('0x89')][_0x6b46('0x8a')][_0x6b46('0x8b')]})['then'](function(_0x4298b1){if(!_0x4298b1['length']){_0xd2a99f=0x0;}else{_0xd2a99f=_0x4298b1[0x0][_0x6b46('0x20')]||0x0;}return dbH[_0x6b46('0x89')]['query'](_0x52864b[_0x6b46('0x88')](),{'type':dbH[_0x6b46('0x89')][_0x6b46('0x8a')][_0x6b46('0x8b')]});})['then'](function(_0x343f1c){return{'rows':_0x343f1c||[],'count':_0xd2a99f};});}});}exports[_0x6b46('0xa2')]=function(_0x45c2f5,_0x5d30e7){return runReport(_0x45c2f5['params'],_0x45c2f5[_0x6b46('0x36')],_0x45c2f5[_0x6b46('0x46')])[_0x6b46('0x28')](respondWithResult(_0x5d30e7,null))[_0x6b46('0x4a')](handleError(_0x5d30e7,null));};exports[_0x6b46('0xa3')]=runReport;exports[_0x6b46('0x36')]=function(_0x337f59,_0xc65cfa){var _0x3c949f=0xa;var _0x58a036=[_0x6b46('0x57'),_0x6b46('0x58'),_0x6b46('0xa4'),'cross_join'];var _0x5a1251={'SUM':_0x6b46('0x5a'),'COUNT':_0x6b46('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x6b46('0x5e'),'AVG':_0x6b46('0x5f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x6b46('0x61'),'GROUP_CONCAT DESC':_0x6b46('0x62')};var _0x3f107b={'SEC_TO_TIME':_0x6b46('0x63'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x6b46('0x67')};var _0x409e65=function(_0x44af46){return!_[_0x6b46('0x68')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x6b46('0x6c')],_0x44af46);};var _0x536057=function(_0x56b07c){if(!_0x56b07c||!_0x56b07c['rules'][_0x6b46('0x3b')]){return'';}for(var _0x1a5da5='(',_0x53d2b7=0x0;_0x53d2b7<_0x56b07c[_0x6b46('0x6d')][_0x6b46('0x3b')];_0x53d2b7+=0x1){_0x53d2b7>0x0&&(_0x1a5da5+='\x20'+_0x56b07c[_0x6b46('0x6e')]+'\x20');_0x1a5da5+=_0x56b07c[_0x6b46('0x6d')][_0x53d2b7]['group']?_0x536057(_0x56b07c[_0x6b46('0x6d')][_0x53d2b7][_0x6b46('0x6f')]):_0x56b07c[_0x6b46('0x6d')][_0x53d2b7][_0x6b46('0x70')]+'\x20'+_0x56b07c[_0x6b46('0x6d')][_0x53d2b7][_0x6b46('0x71')]+(_0x409e65(_0x56b07c[_0x6b46('0x6d')][_0x53d2b7][_0x6b46('0x71')])?'\x20'+_0x56b07c[_0x6b46('0x6d')][_0x53d2b7][_0x6b46('0x8c')]:'');}return _0x1a5da5+')';};var _0x1edccb={'where':{'id':_0x337f59[_0x6b46('0x4c')]['id']}},_0x422dc2,_0x37e759,_0x4f9700,_0x180c10,_0x703b67;_0x1edccb=_[_0x6b46('0x45')]({},_0x1edccb,_0x337f59['options']);return db[_0x6b46('0x48')]['find'](_0x1edccb)['then'](function(_0x30f71f){if(_0x30f71f){_0x422dc2=_0x30f71f;return _0x30f71f[_0x6b46('0x8d')]();}return null;})[_0x6b46('0x28')](function(_0x580f7d){if(_0x580f7d){if(!_0x580f7d[_0x6b46('0x3b')]){throw new db['Sequelize'][(_0x6b46('0x73'))](_0x6b46('0x74'),0x193);}_0x37e759=_0x580f7d;return db[_0x6b46('0x75')]['findAll']({'raw':!![]});}return null;})[_0x6b46('0x28')](function(_0x1403df){if(_0x1403df){_0x4f9700=_[_0x6b46('0x76')](_0x1403df,'id');var _0x25b825;var _0x23c72e=squel[_0x6b46('0x8e')]();_0x23c72e[_0x6b46('0x77')](_0x422dc2[_0x6b46('0x78')]);for(var _0x1ec4d8=0x0;_0x1ec4d8<_0x37e759[_0x6b46('0x3b')];_0x1ec4d8+=0x1){_0x25b825=_0x37e759[_0x1ec4d8]['MetricId']?_0x4f9700[_0x37e759[_0x1ec4d8][_0x6b46('0x79')]][_0x6b46('0x8f')]:_0x37e759[_0x1ec4d8]['field'];_0x25b825=_0x37e759[_0x1ec4d8][_0x6b46('0x7b')]?_[_0x6b46('0x7a')](_0x5a1251[_0x37e759[_0x1ec4d8][_0x6b46('0x7b')]],'%s',_0x25b825):_0x25b825;_0x25b825=_0x37e759[_0x1ec4d8][_0x6b46('0x7c')]?_[_0x6b46('0x7a')](_0x3f107b[_0x37e759[_0x1ec4d8]['format']],'%s',_0x25b825):_0x25b825;if(_0x37e759[_0x1ec4d8]['groupBy']){_0x23c72e[_0x6b46('0x6f')](_0x25b825);}_0x37e759[_0x1ec4d8][_0x6b46('0x7d')]&&_0x23c72e['order'](_0x25b825,_0x37e759[_0x1ec4d8][_0x6b46('0x7d')]==='DESC'?![]:!![]);_0x23c72e[_0x6b46('0x70')](_0x25b825,_0x37e759[_0x1ec4d8]['alias']||_0x25b825);}if(_0x422dc2[_0x6b46('0x80')]){_0x422dc2[_0x6b46('0x80')]=JSON[_0x6b46('0x81')](_0x422dc2['joins']);for(var _0x36f76f=0x0;_0x36f76f<_0x422dc2[_0x6b46('0x80')][_0x6b46('0x3b')];_0x36f76f+=0x1){if(_0x422dc2['joins'][_0x36f76f][_0x6b46('0x44')]&&_[_0x6b46('0x68')](_0x58a036,_0x422dc2[_0x6b46('0x80')][_0x36f76f][_0x6b46('0x44')])&&_0x422dc2['joins'][_0x36f76f]['parentKey']&&_0x422dc2[_0x6b46('0x80')][_0x36f76f]['foreignTable']&&_0x422dc2[_0x6b46('0x80')][_0x36f76f]['foreignKey']){_0x23c72e[_0x422dc2[_0x6b46('0x80')][_0x36f76f][_0x6b46('0x44')]](_0x422dc2[_0x6b46('0x80')][_0x36f76f][_0x6b46('0x83')],null,util[_0x6b46('0x7c')](_0x6b46('0x91'),_0x422dc2[_0x6b46('0x78')],_0x422dc2['joins'][_0x36f76f][_0x6b46('0x82')],_0x422dc2[_0x6b46('0x80')][_0x36f76f][_0x6b46('0x83')],_0x422dc2[_0x6b46('0x80')][_0x36f76f][_0x6b46('0x92')]));}}}if(_0x422dc2['conditions']){_0x422dc2[_0x6b46('0x84')]=JSON[_0x6b46('0x81')](_0x422dc2[_0x6b46('0x84')]);_0x23c72e[_0x6b46('0x40')](_0x536057(_0x422dc2[_0x6b46('0x84')]['group']));}_0x703b67=_0x23c72e[_0x6b46('0x85')]();_0x23c72e[_0x6b46('0x22')](_0x3c949f);_0x23c72e['offset'](0x0);logger['debug'](_0x6b46('0x87'),_0x23c72e['toString']());return dbH[_0x6b46('0x89')][_0x6b46('0x36')](_0x23c72e[_0x6b46('0x88')](),{'type':dbH[_0x6b46('0x89')][_0x6b46('0x8a')][_0x6b46('0x8b')]});}})['then'](function(){return{'sql':_0x703b67[_0x6b46('0x88')]()};})[_0x6b46('0x28')](respondWithResult(_0xc65cfa,null))[_0x6b46('0x4a')](handleError(_0xc65cfa,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 0ffbfc6..4a9c501 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 _0x8777=['bluebird','path','../../config/environment','./analyticCustomReport.attributes','exports','util','../../config/logger','api','moment'];(function(_0x3f2c28,_0xf9593b){var _0x2b942a=function(_0x4954d3){while(--_0x4954d3){_0x3f2c28['push'](_0x3f2c28['shift']());}};_0x2b942a(++_0xf9593b);}(_0x8777,0x1e2));var _0x7877=function(_0x19c829,_0x468e83){_0x19c829=_0x19c829-0x0;var _0x46be66=_0x8777[_0x19c829];return _0x46be66;};'use strict';var _=require('lodash');var util=require(_0x7877('0x0'));var logger=require(_0x7877('0x1'))(_0x7877('0x2'));var moment=require(_0x7877('0x3'));var BPromise=require(_0x7877('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7877('0x5'));var rimraf=require('rimraf');var config=require(_0x7877('0x6'));var attributes=require(_0x7877('0x7'));module[_0x7877('0x8')]=function(_0x2950d7,_0x3d22b2){return _0x2950d7['define']('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbad=['moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api'];(function(_0x25ff2e,_0x5e8c6e){var _0x21b9d0=function(_0x359b35){while(--_0x359b35){_0x25ff2e['push'](_0x25ff2e['shift']());}};_0x21b9d0(++_0x5e8c6e);}(_0xbbad,0x1d0));var _0xdbba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbad[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdbba('0x0'));var util=require(_0xdbba('0x1'));var logger=require(_0xdbba('0x2'))(_0xdbba('0x3'));var moment=require(_0xdbba('0x4'));var BPromise=require(_0xdbba('0x5'));var rp=require(_0xdbba('0x6'));var fs=require('fs');var path=require(_0xdbba('0x7'));var rimraf=require(_0xdbba('0x8'));var config=require('../../config/environment');var attributes=require(_0xdbba('0x9'));module['exports']=function(_0x51d184,_0x52104d){return _0x51d184[_0xdbba('0xa')](_0xdbba('0xb'),attributes,{'tableName':_0xdbba('0xc'),'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 474a4a1..e34921a 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 _0xdd1d=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd1d,0xf7));var _0xddd1=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xdd1d[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0xddd1('0x0'));var util=require(_0xddd1('0x1'));var moment=require(_0xddd1('0x2'));var BPromise=require(_0xddd1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddd1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xddd1('0x5'))(_0xddd1('0x6'));var config=require(_0xddd1('0x7'));var jayson=require(_0xddd1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x304806,_0x5d4ebc,_0x5469e1){return new BPromise(function(_0xbca7e5,_0x2d2785){return client[_0xddd1('0x9')](_0x304806,_0x5469e1)[_0xddd1('0xa')](function(_0x44a929){logger['info'](_0xddd1('0xb'),_0x5d4ebc,_0xddd1('0xc'));logger[_0xddd1('0xd')](_0xddd1('0xe'),_0x5d4ebc,_0xddd1('0xc'),JSON['stringify'](_0x44a929));if(_0x44a929[_0xddd1('0xf')]){if(_0x44a929[_0xddd1('0xf')][_0xddd1('0x10')]===0x1f4){logger[_0xddd1('0xf')](_0xddd1('0xb'),_0x5d4ebc,_0x44a929[_0xddd1('0xf')][_0xddd1('0x11')]);return _0x2d2785(_0x44a929['error'][_0xddd1('0x11')]);}logger[_0xddd1('0xf')](_0xddd1('0xb'),_0x5d4ebc,_0x44a929[_0xddd1('0xf')][_0xddd1('0x11')]);return _0xbca7e5(_0x44a929[_0xddd1('0xf')][_0xddd1('0x11')]);}else{logger[_0xddd1('0x12')](_0xddd1('0xb'),_0x5d4ebc,_0xddd1('0xc'));_0xbca7e5(_0x44a929[_0xddd1('0x13')][_0xddd1('0x11')]);}})['catch'](function(_0x3e2bf5){logger['error'](_0xddd1('0xb'),_0x5d4ebc,_0x3e2bf5);_0x2d2785(_0x3e2bf5);});});} \ No newline at end of file +var _0x66c9=['lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3330a6,_0x380de0){var _0x2f7b63=function(_0x1416ef){while(--_0x1416ef){_0x3330a6['push'](_0x3330a6['shift']());}};_0x2f7b63(++_0x380de0);}(_0x66c9,0x154));var _0x966c=function(_0x35a229,_0x161806){_0x35a229=_0x35a229-0x0;var _0x440d18=_0x66c9[_0x35a229];return _0x440d18;};'use strict';var _=require(_0x966c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x966c('0x1'));var rs=require(_0x966c('0x2'));var fs=require('fs');var Redis=require(_0x966c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x966c('0x4'));var logger=require('../../config/logger')(_0x966c('0x5'));var config=require(_0x966c('0x6'));var jayson=require(_0x966c('0x7'));var client=jayson[_0x966c('0x8')][_0x966c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b59e7,_0x1bed47,_0x23c845){return new BPromise(function(_0x1d5b42,_0x5c03a4){return client['request'](_0x2b59e7,_0x23c845)[_0x966c('0xa')](function(_0x5d65a9){logger[_0x966c('0xb')](_0x966c('0xc'),_0x1bed47,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1bed47,_0x966c('0xd'),JSON[_0x966c('0xe')](_0x5d65a9));if(_0x5d65a9[_0x966c('0xf')]){if(_0x5d65a9[_0x966c('0xf')][_0x966c('0x10')]===0x1f4){logger[_0x966c('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1bed47,_0x5d65a9['error']['message']);return _0x5c03a4(_0x5d65a9[_0x966c('0xf')][_0x966c('0x11')]);}logger[_0x966c('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1bed47,_0x5d65a9[_0x966c('0xf')]['message']);return _0x1d5b42(_0x5d65a9[_0x966c('0xf')][_0x966c('0x11')]);}else{logger[_0x966c('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1bed47,_0x966c('0xd'));_0x1d5b42(_0x5d65a9[_0x966c('0x12')]['message']);}})[_0x966c('0x13')](function(_0x3b8a4c){logger['error'](_0x966c('0xc'),_0x1bed47,_0x3b8a4c);_0x5c03a4(_0x3b8a4c);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 101e944..e1269be 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 _0x0788=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','/:id/preview','preview','run','/:id/query','query','post','put','update','delete','destroy'];(function(_0x5ae8f1,_0x58098e){var _0x4ac982=function(_0x469656){while(--_0x469656){_0x5ae8f1['push'](_0x5ae8f1['shift']());}};_0x4ac982(++_0x58098e);}(_0x0788,0x191));var _0x8078=function(_0x30b457,_0x5f2c58){_0x30b457=_0x30b457-0x0;var _0x8133ee=_0x0788[_0x30b457];return _0x8133ee;};'use strict';var multer=require(_0x8078('0x0'));var util=require(_0x8078('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8078('0x2'));var router=express[_0x8078('0x3')]();var auth=require(_0x8078('0x4'));var interaction=require(_0x8078('0x5'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x8078('0x6')]('/',auth[_0x8078('0x7')](),controller['index']);router[_0x8078('0x6')](_0x8078('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x8078('0x6')](_0x8078('0x9'),auth[_0x8078('0x7')](),controller[_0x8078('0xa')]);router[_0x8078('0x6')]('/:id/run',auth['isAuthenticated'](),controller[_0x8078('0xb')]);router[_0x8078('0x6')](_0x8078('0xc'),auth['isAuthenticated'](),controller[_0x8078('0xd')]);router[_0x8078('0xe')]('/',auth[_0x8078('0x7')](),controller['create']);router[_0x8078('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8078('0x10')]);router[_0x8078('0x11')](_0x8078('0x8'),auth[_0x8078('0x7')](),controller[_0x8078('0x12')]);module[_0x8078('0x13')]=router; \ No newline at end of file +var _0xd7a1=['../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/run','/:id/query','query','create','delete','destroy','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x38e74a,_0x1bcaf1){var _0x184561=function(_0xb8e89b){while(--_0xb8e89b){_0x38e74a['push'](_0x38e74a['shift']());}};_0x184561(++_0x1bcaf1);}(_0xd7a1,0x160));var _0x1d7a=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0xd7a1[_0x2bbc07];return _0x6879e4;};'use strict';var multer=require('multer');var util=require(_0x1d7a('0x0'));var path=require('path');var timeout=require(_0x1d7a('0x1'));var express=require(_0x1d7a('0x2'));var router=express[_0x1d7a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1d7a('0x4'));var config=require(_0x1d7a('0x5'));var controller=require(_0x1d7a('0x6'));router[_0x1d7a('0x7')]('/',auth[_0x1d7a('0x8')](),controller['index']);router['get'](_0x1d7a('0x9'),auth[_0x1d7a('0x8')](),controller[_0x1d7a('0xa')]);router['get']('/:id/preview',auth[_0x1d7a('0x8')](),controller['preview']);router['get'](_0x1d7a('0xb'),auth[_0x1d7a('0x8')](),controller['run']);router[_0x1d7a('0x7')](_0x1d7a('0xc'),auth[_0x1d7a('0x8')](),controller[_0x1d7a('0xd')]);router['post']('/',auth[_0x1d7a('0x8')](),controller[_0x1d7a('0xe')]);router['put'](_0x1d7a('0x9'),auth[_0x1d7a('0x8')](),controller['update']);router[_0x1d7a('0xf')]('/:id',auth[_0x1d7a('0x8')](),controller[_0x1d7a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6738740..ef5759c 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 _0xbc4c=['TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc4c,0x69));var _0xcbc4=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0xbc4c[_0x21de89];return _0x290b7e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcbc4('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xcbc4('0x0')]},'parent':{'type':Sequelize[_0xcbc4('0x0')]},'table':{'type':Sequelize[_0xcbc4('0x0')]},'conditions':{'type':Sequelize[_0xcbc4('0x1')]},'joins':{'type':Sequelize[_0xcbc4('0x1')]}}; \ No newline at end of file +var _0xa18e=['exports','STRING','sequelize'];(function(_0xbb6c6b,_0x38a86c){var _0x9ca7de=function(_0x471ad5){while(--_0x471ad5){_0xbb6c6b['push'](_0xbb6c6b['shift']());}};_0x9ca7de(++_0x38a86c);}(_0xa18e,0x95));var _0xea18=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xa18e[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0xea18('0x0'));module[_0xea18('0x1')]={'name':{'type':Sequelize[_0xea18('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xea18('0x2')]},'parent':{'type':Sequelize[_0xea18('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index d11362f..ae8f331 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 _0xcd59=['endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','Limited\x20Query:','SELECT','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','DefaultReports','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','MetricId','metric','function','groupBy','group','orderBy','DESC','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','clone','debug','toString','sequelize','QueryTypes','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','Sequelize','keyBy','replace','format','alias','output','web','fullPath','%s-%s.%s','randomstring','default','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x9eb9cc,_0x129c6d){var _0x5e8af8=function(_0x20c929){while(--_0x20c929){_0x9eb9cc['push'](_0x9eb9cc['shift']());}};_0x5e8af8(++_0x129c6d);}(_0xcd59,0xb7));var _0x9cd5=function(_0x3c126c,_0x22f353){_0x3c126c=_0x3c126c-0x0;var _0x3b89e4=_0xcd59[_0x3c126c];return _0x3b89e4;};'use strict';var pdf=require(_0x9cd5('0x0'));var emlformat=require(_0x9cd5('0x1'));var rimraf=require(_0x9cd5('0x2'));var zipdir=require(_0x9cd5('0x3'));var jsonpatch=require(_0x9cd5('0x4'));var rp=require(_0x9cd5('0x5'));var moment=require('moment');var BPromise=require(_0x9cd5('0x6'));var Mustache=require(_0x9cd5('0x7'));var util=require(_0x9cd5('0x8'));var path=require(_0x9cd5('0x9'));var sox=require(_0x9cd5('0xa'));var csv=require('to-csv');var ejs=require(_0x9cd5('0xb'));var fs=require('fs');var _=require(_0x9cd5('0xc'));var squel=require(_0x9cd5('0xd'));var crypto=require(_0x9cd5('0xe'));var jsforce=require(_0x9cd5('0xf'));var deskjs=require(_0x9cd5('0x10'));var toCsv=require(_0x9cd5('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9cd5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9cd5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cd5('0x14'));var logger=require(_0x9cd5('0x15'))(_0x9cd5('0x16'));var utils=require(_0x9cd5('0x17'));var config=require(_0x9cd5('0x18'));var licenseUtil=require(_0x9cd5('0x19'));var db=require(_0x9cd5('0x1a'))['db'];var dbH=require('../../mysqldb')[_0x9cd5('0x1b')];function respondWithStatusCode(_0x197e05,_0x4d66ba){_0x4d66ba=_0x4d66ba||0xcc;return function(_0x2edb71){if(_0x2edb71){return _0x197e05[_0x9cd5('0x1c')](_0x4d66ba);}return _0x197e05[_0x9cd5('0x1d')](_0x4d66ba)[_0x9cd5('0x1e')]();};}function respondWithResult(_0x8b5ec6,_0x15052c){_0x15052c=_0x15052c||0xc8;return function(_0x55491a){if(_0x55491a){return _0x8b5ec6[_0x9cd5('0x1d')](_0x15052c)['json'](_0x55491a);}};}function respondWithFilteredResult(_0x11f0f6,_0x20af4b){return function(_0x2e57c9){if(_0x2e57c9){var _0x1d5d3f=_0x2e57c9[_0x9cd5('0x1f')],_0x5d37f7=_0x20af4b[_0x9cd5('0x20')],_0x13c2e4=_0x20af4b['offset']+_0x20af4b[_0x9cd5('0x21')],_0x127273;if(_0x13c2e4>=_0x1d5d3f){_0x13c2e4=_0x1d5d3f;_0x127273=0xc8;}else{_0x127273=0xce;}_0x11f0f6['status'](_0x127273);return _0x11f0f6[_0x9cd5('0x22')](_0x9cd5('0x23'),_0x5d37f7+'-'+_0x13c2e4+'/'+_0x1d5d3f)['json'](_0x2e57c9);}return null;};}function patchUpdates(_0x1bd827){return function(_0x144c84){try{jsonpatch['apply'](_0x144c84,_0x1bd827,!![]);}catch(_0x1c1978){return BPromise[_0x9cd5('0x24')](_0x1c1978);}return _0x144c84[_0x9cd5('0x25')]();};}function saveUpdates(_0x2b1e18,_0x3549ad){return function(_0x2e5fa6){if(_0x2e5fa6){return _0x2e5fa6[_0x9cd5('0x26')](_0x2b1e18)[_0x9cd5('0x27')](function(_0x13f55f){return _0x13f55f;});}return null;};}function removeEntity(_0x160388,_0x5a2ffc){return function(_0x533b38){if(_0x533b38){return _0x533b38[_0x9cd5('0x28')]()['then'](function(){var _0x1a6482=_0x533b38['get']({'plain':!![]});var _0x595ca1=_0x9cd5('0x29');return db['UserProfileResource'][_0x9cd5('0x28')]({'where':{'type':_0x595ca1,'resourceId':_0x1a6482['id']}})[_0x9cd5('0x27')](function(){return _0x533b38;});})[_0x9cd5('0x27')](function(){_0x160388[_0x9cd5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54fa13,_0xe159b0){return function(_0x3b07f6){if(!_0x3b07f6){_0x54fa13[_0x9cd5('0x1c')](0x194);}return _0x3b07f6;};}function handleError(_0x1c0fcd,_0xa2682e){_0xa2682e=_0xa2682e||0x1f4;return function(_0x59c29d){logger[_0x9cd5('0x2a')](_0x59c29d[_0x9cd5('0x2b')]);if(_0x59c29d['name']){delete _0x59c29d[_0x9cd5('0x2c')];}_0x1c0fcd['status'](_0xa2682e)['send'](_0x59c29d);};}exports[_0x9cd5('0x2d')]=function(_0x531f40,_0x288430){var _0x187eba={},_0x4a2727={},_0x1c129c={'count':0x0,'rows':[]};var _0x45f17f=_[_0x9cd5('0x2e')](db[_0x9cd5('0x2f')][_0x9cd5('0x30')],function(_0x312356){return{'name':_0x312356[_0x9cd5('0x31')],'type':_0x312356['type'][_0x9cd5('0x32')]};});_0x4a2727['model']=_['map'](_0x45f17f,_0x9cd5('0x2c'));_0x4a2727['query']=_['keys'](_0x531f40[_0x9cd5('0x33')]);_0x4a2727[_0x9cd5('0x34')]=_['intersection'](_0x4a2727[_0x9cd5('0x35')],_0x4a2727[_0x9cd5('0x33')]);_0x187eba[_0x9cd5('0x36')]=_[_0x9cd5('0x37')](_0x4a2727[_0x9cd5('0x35')],qs[_0x9cd5('0x38')](_0x531f40[_0x9cd5('0x33')][_0x9cd5('0x38')]));_0x187eba['attributes']=_0x187eba[_0x9cd5('0x36')]['length']?_0x187eba['attributes']:_0x4a2727[_0x9cd5('0x35')];if(!_0x531f40[_0x9cd5('0x33')]['hasOwnProperty'](_0x9cd5('0x39'))){_0x187eba[_0x9cd5('0x21')]=qs[_0x9cd5('0x21')](_0x531f40[_0x9cd5('0x33')]['limit']);_0x187eba[_0x9cd5('0x20')]=qs['offset'](_0x531f40['query']['offset']);}_0x187eba[_0x9cd5('0x3a')]=qs[_0x9cd5('0x3b')](_0x531f40[_0x9cd5('0x33')][_0x9cd5('0x3b')]);_0x187eba[_0x9cd5('0x3c')]=qs[_0x9cd5('0x34')](_[_0x9cd5('0x3d')](_0x531f40[_0x9cd5('0x33')],_0x4a2727[_0x9cd5('0x34')]),_0x45f17f);if(_0x531f40[_0x9cd5('0x33')][_0x9cd5('0x3e')]){_0x187eba[_0x9cd5('0x3c')]=_[_0x9cd5('0x3f')](_0x187eba['where'],{'$or':_[_0x9cd5('0x2e')](_0x45f17f,function(_0x2ada40){if(_0x2ada40[_0x9cd5('0x40')]!==_0x9cd5('0x41')){var _0x5babe0={};_0x5babe0[_0x2ada40[_0x9cd5('0x2c')]]={'$like':'%'+_0x531f40[_0x9cd5('0x33')][_0x9cd5('0x3e')]+'%'};return _0x5babe0;}})});}_0x187eba=_[_0x9cd5('0x3f')]({},_0x187eba,_0x531f40[_0x9cd5('0x42')]);var _0x245d14={'where':_0x187eba[_0x9cd5('0x3c')]};return db['AnalyticDefaultReport'][_0x9cd5('0x1f')](_0x245d14)[_0x9cd5('0x27')](function(_0x294385){_0x1c129c['count']=_0x294385;if(_0x531f40[_0x9cd5('0x33')][_0x9cd5('0x43')]){_0x187eba[_0x9cd5('0x44')]=[{'all':!![]}];}return db[_0x9cd5('0x2f')][_0x9cd5('0x45')](_0x187eba);})[_0x9cd5('0x27')](function(_0xf89456){_0x1c129c[_0x9cd5('0x46')]=_0xf89456;return _0x1c129c;})[_0x9cd5('0x27')](respondWithFilteredResult(_0x288430,_0x187eba))[_0x9cd5('0x47')](handleError(_0x288430,null));};exports['show']=function(_0x130516,_0x76eda7){var _0x1ac87c={'raw':!![],'where':{'id':_0x130516[_0x9cd5('0x48')]['id']}},_0x54cfb7={};_0x54cfb7['model']=_[_0x9cd5('0x49')](db['AnalyticDefaultReport'][_0x9cd5('0x30')]);_0x54cfb7[_0x9cd5('0x33')]=_[_0x9cd5('0x49')](_0x130516[_0x9cd5('0x33')]);_0x54cfb7['filters']=_[_0x9cd5('0x37')](_0x54cfb7['model'],_0x54cfb7[_0x9cd5('0x33')]);_0x1ac87c[_0x9cd5('0x36')]=_[_0x9cd5('0x37')](_0x54cfb7[_0x9cd5('0x35')],qs['fields'](_0x130516[_0x9cd5('0x33')][_0x9cd5('0x38')]));_0x1ac87c[_0x9cd5('0x36')]=_0x1ac87c[_0x9cd5('0x36')][_0x9cd5('0x4a')]?_0x1ac87c[_0x9cd5('0x36')]:_0x54cfb7[_0x9cd5('0x35')];if(_0x130516[_0x9cd5('0x33')][_0x9cd5('0x43')]){_0x1ac87c[_0x9cd5('0x44')]=[{'all':!![]}];}_0x1ac87c=_[_0x9cd5('0x3f')]({},_0x1ac87c,_0x130516[_0x9cd5('0x42')]);return db[_0x9cd5('0x2f')][_0x9cd5('0x4b')](_0x1ac87c)['then'](handleEntityNotFound(_0x76eda7,null))[_0x9cd5('0x27')](respondWithResult(_0x76eda7,null))[_0x9cd5('0x47')](handleError(_0x76eda7,null));};exports['create']=function(_0x1d3d05,_0x2707b1){return db['AnalyticDefaultReport']['create'](_0x1d3d05[_0x9cd5('0x4c')],{})[_0x9cd5('0x27')](function(_0xe55355){var _0x184009=_0x1d3d05[_0x9cd5('0x4d')][_0x9cd5('0x4e')]({'plain':!![]});if(!_0x184009)throw new Error(_0x9cd5('0x4f'));if(_0x184009[_0x9cd5('0x50')]===_0x9cd5('0x4d')){var _0x120b1b=_0xe55355[_0x9cd5('0x4e')]({'plain':!![]});var _0x5b2dce='Reports';return db[_0x9cd5('0x51')][_0x9cd5('0x4b')]({'where':{'name':_0x5b2dce,'userProfileId':_0x184009['userProfileId']},'raw':!![]})[_0x9cd5('0x27')](function(_0x2380db){if(_0x2380db&&_0x2380db[_0x9cd5('0x52')]===0x0){return db[_0x9cd5('0x53')][_0x9cd5('0x54')]({'name':_0x120b1b[_0x9cd5('0x2c')],'resourceId':_0x120b1b['id'],'type':'DefaultReports','sectionId':_0x2380db['id']},{})['then'](function(){return _0xe55355;});}else{return _0xe55355;}})[_0x9cd5('0x47')](function(_0x1f0148){logger[_0x9cd5('0x2a')](_0x9cd5('0x55'),_0x1f0148);throw _0x1f0148;});}return _0xe55355;})[_0x9cd5('0x27')](respondWithResult(_0x2707b1,0xc9))['catch'](handleError(_0x2707b1,null));};exports[_0x9cd5('0x26')]=function(_0x519dfc,_0x55d51a){if(_0x519dfc[_0x9cd5('0x4c')]['id']){delete _0x519dfc[_0x9cd5('0x4c')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x519dfc[_0x9cd5('0x48')]['id']}})[_0x9cd5('0x27')](handleEntityNotFound(_0x55d51a,null))['then'](saveUpdates(_0x519dfc[_0x9cd5('0x4c')],null))['then'](respondWithResult(_0x55d51a,null))[_0x9cd5('0x47')](handleError(_0x55d51a,null));};exports['destroy']=function(_0x3e15f0,_0x194de){return db[_0x9cd5('0x2f')][_0x9cd5('0x4b')]({'where':{'id':_0x3e15f0['params']['id']}})[_0x9cd5('0x27')](handleEntityNotFound(_0x194de,null))[_0x9cd5('0x27')](removeEntity(_0x194de,null))['catch'](handleError(_0x194de,null));};exports[_0x9cd5('0x56')]=function(_0x32bd1a,_0x3e112a){var _0x24b394=0xa;var _0x2adc85=[_0x9cd5('0x57'),_0x9cd5('0x58'),_0x9cd5('0x59'),_0x9cd5('0x5a')];var _0x589210={'SUM':_0x9cd5('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9cd5('0x5c'),'MAX':_0x9cd5('0x5d'),'MIN':_0x9cd5('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9cd5('0x5f'),'GROUP_CONCAT ASC':_0x9cd5('0x60'),'GROUP_CONCAT DESC':_0x9cd5('0x61')};var _0x57bdd6={'SEC_TO_TIME':_0x9cd5('0x62'),'DATE':_0x9cd5('0x63'),'HOUR':_0x9cd5('0x64'),'ROUND':_0x9cd5('0x65'),'UNIX_TIMESTAMP':_0x9cd5('0x66')};var _0x1671a5=function(_0x1e0d5e){return!_[_0x9cd5('0x67')]([_0x9cd5('0x68'),'IS\x20NOT\x20NULL',_0x9cd5('0x69'),_0x9cd5('0x6a')],_0x1e0d5e);};var _0x21cbc1=function(_0x53f1ef){if(!_0x53f1ef||!_0x53f1ef['rules'][_0x9cd5('0x4a')]){return'';}for(var _0x5801ba='(',_0x30c698=0x0;_0x30c698<_0x53f1ef[_0x9cd5('0x6b')][_0x9cd5('0x4a')];_0x30c698+=0x1){_0x30c698>0x0&&(_0x5801ba+='\x20'+_0x53f1ef[_0x9cd5('0x6c')]+'\x20');_0x5801ba+=_0x53f1ef[_0x9cd5('0x6b')][_0x30c698]['group']?_0x21cbc1(_0x53f1ef[_0x9cd5('0x6b')][_0x30c698]['group']):_0x53f1ef[_0x9cd5('0x6b')][_0x30c698][_0x9cd5('0x6d')]+'\x20'+_0x53f1ef[_0x9cd5('0x6b')][_0x30c698][_0x9cd5('0x6e')]+(_0x1671a5(_0x53f1ef[_0x9cd5('0x6b')][_0x30c698][_0x9cd5('0x6e')])?'\x20'+_0x53f1ef[_0x9cd5('0x6b')][_0x30c698][_0x9cd5('0x6f')]:'');}return _0x5801ba+')';};var _0x4ab98a={'where':{'id':_0x32bd1a[_0x9cd5('0x48')]['id']}},_0x38573f,_0x3ac17e,_0x3e6a2c,_0x272194,_0x296c15;_0x4ab98a=_[_0x9cd5('0x3f')]({},_0x4ab98a,_0x32bd1a[_0x9cd5('0x42')]);return db[_0x9cd5('0x2f')]['find'](_0x4ab98a)['then'](function(_0x12bbec){if(_0x12bbec){_0x38573f=_0x12bbec;return _0x12bbec[_0x9cd5('0x70')]();}return null;})[_0x9cd5('0x27')](function(_0x66cb1a){if(_0x66cb1a){if(!_0x66cb1a[_0x9cd5('0x4a')]){throw new db['Sequelize'][(_0x9cd5('0x71'))](_0x9cd5('0x72'),0x193);}_0x3ac17e=_0x66cb1a;return db[_0x9cd5('0x73')][_0x9cd5('0x45')]({'raw':!![]});}return null;})[_0x9cd5('0x27')](function(_0x5c4003){if(_0x5c4003){_0x3e6a2c=_['keyBy'](_0x5c4003,'id');var _0x59c996;var _0x419eb0=squel[_0x9cd5('0x74')]();_0x419eb0[_0x9cd5('0x75')](_0x38573f['table']);for(var _0x2c0ec2=0x0;_0x2c0ec2<_0x3ac17e[_0x9cd5('0x4a')];_0x2c0ec2+=0x1){_0x59c996=_0x3ac17e[_0x2c0ec2]['MetricId']?_0x3e6a2c[_0x3ac17e[_0x2c0ec2][_0x9cd5('0x76')]][_0x9cd5('0x77')]:_0x3ac17e[_0x2c0ec2][_0x9cd5('0x6d')];_0x59c996=_0x3ac17e[_0x2c0ec2][_0x9cd5('0x78')]?_['replace'](_0x589210[_0x3ac17e[_0x2c0ec2]['function']],'%s',_0x59c996):_0x59c996;_0x59c996=_0x3ac17e[_0x2c0ec2]['format']?_['replace'](_0x57bdd6[_0x3ac17e[_0x2c0ec2]['format']],'%s',_0x59c996):_0x59c996;if(_0x3ac17e[_0x2c0ec2][_0x9cd5('0x79')]){_0x419eb0[_0x9cd5('0x7a')](_0x59c996);}_0x3ac17e[_0x2c0ec2][_0x9cd5('0x7b')]&&_0x419eb0[_0x9cd5('0x3a')](_0x59c996,_0x3ac17e[_0x2c0ec2][_0x9cd5('0x7b')]===_0x9cd5('0x7c')?![]:!![]);_0x419eb0[_0x9cd5('0x6d')](_0x59c996,_0x3ac17e[_0x2c0ec2]['alias']||_0x59c996);}if(_0x38573f[_0x9cd5('0x7d')]){_0x38573f[_0x9cd5('0x7d')]=JSON[_0x9cd5('0x7e')](_0x38573f[_0x9cd5('0x7d')]);for(var _0x582a5c=0x0;_0x582a5c<_0x38573f['joins'][_0x9cd5('0x4a')];_0x582a5c+=0x1){if(_0x38573f[_0x9cd5('0x7d')][_0x582a5c][_0x9cd5('0x40')]&&_[_0x9cd5('0x67')](_0x2adc85,_0x38573f[_0x9cd5('0x7d')][_0x582a5c][_0x9cd5('0x40')])&&_0x38573f['joins'][_0x582a5c][_0x9cd5('0x7f')]&&_0x38573f[_0x9cd5('0x7d')][_0x582a5c]['foreignTable']&&_0x38573f[_0x9cd5('0x7d')][_0x582a5c]['foreignKey']){_0x419eb0[_0x38573f[_0x9cd5('0x7d')][_0x582a5c][_0x9cd5('0x40')]](_0x38573f[_0x9cd5('0x7d')][_0x582a5c][_0x9cd5('0x80')],null,util['format'](_0x9cd5('0x81'),_0x38573f[_0x9cd5('0x82')],_0x38573f['joins'][_0x582a5c][_0x9cd5('0x7f')],_0x38573f[_0x9cd5('0x7d')][_0x582a5c]['foreignTable'],_0x38573f[_0x9cd5('0x7d')][_0x582a5c][_0x9cd5('0x83')]));}}}if(_0x38573f['conditions']){_0x38573f[_0x9cd5('0x84')]=JSON[_0x9cd5('0x7e')](_0x38573f[_0x9cd5('0x84')]);_0x419eb0[_0x9cd5('0x3c')](_0x21cbc1(_0x38573f[_0x9cd5('0x84')][_0x9cd5('0x7a')]));}_0x296c15=_0x419eb0[_0x9cd5('0x85')]();_0x419eb0['limit'](_0x24b394);_0x419eb0[_0x9cd5('0x20')](0x0);logger[_0x9cd5('0x86')]('Limited\x20Query:',_0x419eb0[_0x9cd5('0x87')]());return dbH[_0x9cd5('0x88')][_0x9cd5('0x33')](_0x419eb0[_0x9cd5('0x87')](),{'type':dbH[_0x9cd5('0x88')][_0x9cd5('0x89')]['SELECT']});}})[_0x9cd5('0x27')](respondWithResult(_0x3e112a,null))[_0x9cd5('0x47')](handleError(_0x3e112a,null));};function runReport(_0x4dcffa,_0x21f6e5,_0x31213b){var _0x2e3696=_0x21f6e5[_0x9cd5('0x2c')];var _0x1ce10c=0xa;var _0x208694=[_0x9cd5('0x57'),_0x9cd5('0x58'),_0x9cd5('0x59'),'cross_join'];var _0xe4e3d8={'SUM':_0x9cd5('0x5b'),'COUNT':_0x9cd5('0x8a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9cd5('0x5d'),'MIN':_0x9cd5('0x5e'),'AVG':_0x9cd5('0x8b'),'GROUP_CONCAT':_0x9cd5('0x5f'),'GROUP_CONCAT ASC':_0x9cd5('0x60'),'GROUP_CONCAT DESC':_0x9cd5('0x61')};var _0x536302={'SEC_TO_TIME':_0x9cd5('0x62'),'DATE':_0x9cd5('0x63'),'HOUR':_0x9cd5('0x64'),'ROUND':_0x9cd5('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x103026=function(_0x323cee){return!_['includes']([_0x9cd5('0x68'),_0x9cd5('0x8c'),_0x9cd5('0x69'),'IS\x20NOT\x20EMPTY'],_0x323cee);};var _0x2c5296=function(_0x89b9b8){if(!_0x89b9b8||!_0x89b9b8['rules'][_0x9cd5('0x4a')]){return'';}for(var _0x5a96b6='(',_0x30a44e=0x0;_0x30a44e<_0x89b9b8['rules'][_0x9cd5('0x4a')];_0x30a44e+=0x1){_0x30a44e>0x0&&(_0x5a96b6+='\x20'+_0x89b9b8[_0x9cd5('0x6c')]+'\x20');_0x5a96b6+=_0x89b9b8[_0x9cd5('0x6b')][_0x30a44e]['group']?_0x2c5296(_0x89b9b8[_0x9cd5('0x6b')][_0x30a44e][_0x9cd5('0x7a')]):_0x89b9b8[_0x9cd5('0x6b')][_0x30a44e][_0x9cd5('0x6d')]+'\x20'+_0x89b9b8['rules'][_0x30a44e][_0x9cd5('0x6e')]+(_0x103026(_0x89b9b8[_0x9cd5('0x6b')][_0x30a44e][_0x9cd5('0x6e')])?'\x20'+_0x89b9b8[_0x9cd5('0x6b')][_0x30a44e]['value']:'');}return _0x5a96b6+')';};var _0x1d7f30={'where':{'id':_0x4dcffa['id']}},_0x2307da,_0x2dff8e,_0x5706b6,_0x329b03,_0x47de70;_0x1d7f30=_[_0x9cd5('0x3f')]({},_0x1d7f30,_0x31213b);return db[_0x9cd5('0x2f')][_0x9cd5('0x4b')](_0x1d7f30)[_0x9cd5('0x27')](function(_0x164773){if(_0x164773){_0x2307da=_0x164773;return _0x164773[_0x9cd5('0x70')]();}return null;})[_0x9cd5('0x27')](function(_0x97b03b){if(_0x97b03b){if(!_0x97b03b[_0x9cd5('0x4a')]){throw new db[(_0x9cd5('0x8d'))][(_0x9cd5('0x71'))](_0x9cd5('0x72'),0x193);}_0x2dff8e=_0x97b03b;return db[_0x9cd5('0x73')][_0x9cd5('0x45')]({'raw':!![]});}return null;})[_0x9cd5('0x27')](function(_0x74767d){if(_0x74767d){_0x5706b6=_[_0x9cd5('0x8e')](_0x74767d,'id');var _0x551a79;var _0x14e9fc=squel[_0x9cd5('0x74')]();_0x14e9fc[_0x9cd5('0x75')](_0x2307da['table']);for(var _0x1616de=0x0;_0x1616de<_0x2dff8e[_0x9cd5('0x4a')];_0x1616de+=0x1){_0x551a79=_0x2dff8e[_0x1616de][_0x9cd5('0x76')]?_0x5706b6[_0x2dff8e[_0x1616de][_0x9cd5('0x76')]][_0x9cd5('0x77')]:_0x2dff8e[_0x1616de][_0x9cd5('0x6d')];_0x551a79=_0x2dff8e[_0x1616de][_0x9cd5('0x78')]?_[_0x9cd5('0x8f')](_0xe4e3d8[_0x2dff8e[_0x1616de][_0x9cd5('0x78')]],'%s',_0x551a79):_0x551a79;_0x551a79=_0x2dff8e[_0x1616de][_0x9cd5('0x90')]?_['replace'](_0x536302[_0x2dff8e[_0x1616de]['format']],'%s',_0x551a79):_0x551a79;if(_0x2dff8e[_0x1616de][_0x9cd5('0x79')]){_0x14e9fc['group'](_0x551a79);}_0x2dff8e[_0x1616de][_0x9cd5('0x7b')]&&_0x14e9fc[_0x9cd5('0x3a')](_0x551a79,_0x2dff8e[_0x1616de][_0x9cd5('0x7b')]===_0x9cd5('0x7c')?![]:!![]);_0x14e9fc[_0x9cd5('0x6d')](_0x551a79,_0x2dff8e[_0x1616de][_0x9cd5('0x91')]||_0x551a79);}if(_0x2307da[_0x9cd5('0x7d')]){_0x2307da[_0x9cd5('0x7d')]=JSON[_0x9cd5('0x7e')](_0x2307da[_0x9cd5('0x7d')]);for(var _0x44d918=0x0;_0x44d918<_0x2307da['joins'][_0x9cd5('0x4a')];_0x44d918+=0x1){if(_0x2307da['joins'][_0x44d918]['type']&&_[_0x9cd5('0x67')](_0x208694,_0x2307da[_0x9cd5('0x7d')][_0x44d918]['type'])&&_0x2307da['joins'][_0x44d918][_0x9cd5('0x7f')]&&_0x2307da[_0x9cd5('0x7d')][_0x44d918][_0x9cd5('0x80')]&&_0x2307da[_0x9cd5('0x7d')][_0x44d918][_0x9cd5('0x83')]){_0x14e9fc[_0x2307da[_0x9cd5('0x7d')][_0x44d918][_0x9cd5('0x40')]](_0x2307da[_0x9cd5('0x7d')][_0x44d918][_0x9cd5('0x80')],null,util[_0x9cd5('0x90')](_0x9cd5('0x81'),_0x2307da[_0x9cd5('0x82')],_0x2307da['joins'][_0x44d918][_0x9cd5('0x7f')],_0x2307da[_0x9cd5('0x7d')][_0x44d918]['foreignTable'],_0x2307da[_0x9cd5('0x7d')][_0x44d918][_0x9cd5('0x83')]));}}}if(_0x2307da['conditions']){_0x2307da[_0x9cd5('0x84')]=JSON['parse'](_0x2307da[_0x9cd5('0x84')]);_0x14e9fc[_0x9cd5('0x3c')](_0x2c5296(_0x2307da[_0x9cd5('0x84')]['group']));}_0x47de70=_0x14e9fc[_0x9cd5('0x85')]();_0x14e9fc['limit'](_0x1ce10c);_0x14e9fc[_0x9cd5('0x20')](0x0);return;}})[_0x9cd5('0x27')](function(){if(_0x21f6e5[_0x9cd5('0x92')]===_0x9cd5('0x93')){return null;}var _0x373803=_['merge'](_0x21f6e5,{'name':_0x21f6e5[_0x9cd5('0x94')]||_0x21f6e5[_0x9cd5('0x2c')]||_0x2307da[_0x9cd5('0x2c')],'basename':_0x2e3696,'savename':util[_0x9cd5('0x90')](_0x9cd5('0x95'),_0x21f6e5[_0x9cd5('0x2c')]||_0x2307da[_0x9cd5('0x2c')],require(_0x9cd5('0x96'))['generate'](0x4),_0x21f6e5[_0x9cd5('0x92')]||'csv'),'reportId':_0x2307da['id'],'reportType':_0x9cd5('0x97')});return db['AnalyticExtractedReport'][_0x9cd5('0x54')](_0x373803,{'raw':!![]});})[_0x9cd5('0x27')](function(_0x13a2af){if(_0x2307da[_0x9cd5('0x82')]===_0x9cd5('0x98')){_0x47de70[_0x9cd5('0x3c')](_0x2307da['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x21f6e5[_0x9cd5('0x99')],_0x21f6e5['endDate']);}else{_0x47de70[_0x9cd5('0x3c')](_0x2307da[_0x9cd5('0x82')]+_0x9cd5('0x9a'),_0x21f6e5[_0x9cd5('0x99')],_0x21f6e5[_0x9cd5('0x9b')]);}if(_0x13a2af){logger[_0x9cd5('0x9c')](_0x9cd5('0x9d'),_0x47de70[_0x9cd5('0x87')]());require(_0x9cd5('0x9e'))[_0x9cd5('0x9f')](path['join'](__dirname,_0x9cd5('0xa0'),_0x13a2af['output']),[_0x13a2af['id'],_0x47de70[_0x9cd5('0x87')](),path[_0x9cd5('0x57')](__dirname,_0x9cd5('0xa1'),_0x13a2af[_0x9cd5('0xa2')]),_0x2e3696]);return _0x13a2af;}else{var _0xafe80f=squel[_0x9cd5('0x74')]();_0xafe80f[_0x9cd5('0x75')]('('+_0x47de70[_0x9cd5('0x87')]()+')',_0x9cd5('0xa3'));_0xafe80f[_0x9cd5('0x6d')](_0x9cd5('0xa4'),'count');_0x47de70[_0x9cd5('0x21')](_0x21f6e5['limit']||_0x1ce10c);_0x47de70[_0x9cd5('0x20')](_0x21f6e5[_0x9cd5('0x20')]||0x0);return dbH[_0x9cd5('0x88')][_0x9cd5('0x33')](_0xafe80f['toString'](),{'type':dbH[_0x9cd5('0x88')][_0x9cd5('0x89')]['SELECT']})[_0x9cd5('0x27')](function(_0xff21bc){if(!_0xff21bc[_0x9cd5('0x4a')]){_0x329b03=0x0;}else{_0x329b03=_0xff21bc[0x0][_0x9cd5('0x1f')]||0x0;}return dbH[_0x9cd5('0x88')]['query'](_0x47de70['toString'](),{'type':dbH[_0x9cd5('0x88')][_0x9cd5('0x89')]['SELECT']});})['then'](function(_0xf7841f){return{'rows':_0xf7841f||[],'count':_0x329b03};});}});}exports[_0x9cd5('0xa5')]=function(_0x945028,_0x3f58c5){return runReport(_0x945028['params'],_0x945028['query'],_0x945028[_0x9cd5('0x42')])[_0x9cd5('0x27')](respondWithResult(_0x3f58c5,null))['catch'](handleError(_0x3f58c5,null));};exports[_0x9cd5('0xa6')]=runReport;exports['query']=function(_0x3a9516,_0x57aecd){var _0x242045=0xa;var _0x4ebd13=['join',_0x9cd5('0x58'),_0x9cd5('0x59'),_0x9cd5('0x5a')];var _0x480a33={'SUM':_0x9cd5('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9cd5('0x5c'),'MAX':_0x9cd5('0x5d'),'MIN':_0x9cd5('0x5e'),'AVG':_0x9cd5('0x8b'),'GROUP_CONCAT':_0x9cd5('0x5f'),'GROUP_CONCAT ASC':_0x9cd5('0x60'),'GROUP_CONCAT DESC':_0x9cd5('0x61')};var _0x37fc74={'SEC_TO_TIME':_0x9cd5('0x62'),'DATE':_0x9cd5('0x63'),'HOUR':_0x9cd5('0x64'),'ROUND':_0x9cd5('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x9bee13=function(_0x57407e){return!_[_0x9cd5('0x67')]([_0x9cd5('0x68'),_0x9cd5('0x8c'),_0x9cd5('0x69'),_0x9cd5('0x6a')],_0x57407e);};var _0x41c07b=function(_0x4a9ff0){if(!_0x4a9ff0||!_0x4a9ff0[_0x9cd5('0x6b')]['length']){return'';}for(var _0x420b31='(',_0x26503e=0x0;_0x26503e<_0x4a9ff0[_0x9cd5('0x6b')][_0x9cd5('0x4a')];_0x26503e+=0x1){_0x26503e>0x0&&(_0x420b31+='\x20'+_0x4a9ff0[_0x9cd5('0x6c')]+'\x20');_0x420b31+=_0x4a9ff0[_0x9cd5('0x6b')][_0x26503e][_0x9cd5('0x7a')]?_0x41c07b(_0x4a9ff0[_0x9cd5('0x6b')][_0x26503e][_0x9cd5('0x7a')]):_0x4a9ff0[_0x9cd5('0x6b')][_0x26503e][_0x9cd5('0x6d')]+'\x20'+_0x4a9ff0[_0x9cd5('0x6b')][_0x26503e][_0x9cd5('0x6e')]+(_0x9bee13(_0x4a9ff0[_0x9cd5('0x6b')][_0x26503e][_0x9cd5('0x6e')])?'\x20'+_0x4a9ff0[_0x9cd5('0x6b')][_0x26503e]['value']:'');}return _0x420b31+')';};var _0x2f4289={'where':{'id':_0x3a9516['params']['id']}},_0x46d12b,_0x50c1c7,_0x3b7742,_0x3d4cf7,_0x3bd1b9;_0x2f4289=_[_0x9cd5('0x3f')]({},_0x2f4289,_0x3a9516[_0x9cd5('0x42')]);return db[_0x9cd5('0x2f')][_0x9cd5('0x4b')](_0x2f4289)[_0x9cd5('0x27')](function(_0x1ffa7d){if(_0x1ffa7d){_0x46d12b=_0x1ffa7d;return _0x1ffa7d[_0x9cd5('0x70')]();}return null;})[_0x9cd5('0x27')](function(_0x3c799c){if(_0x3c799c){if(!_0x3c799c[_0x9cd5('0x4a')]){throw new db['Sequelize'][(_0x9cd5('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x50c1c7=_0x3c799c;return db[_0x9cd5('0x73')][_0x9cd5('0x45')]({'raw':!![]});}return null;})['then'](function(_0x25e69f){if(_0x25e69f){_0x3b7742=_[_0x9cd5('0x8e')](_0x25e69f,'id');var _0x40610;var _0x5b9c96=squel['select']();_0x5b9c96['from'](_0x46d12b[_0x9cd5('0x82')]);for(var _0x3ecd1d=0x0;_0x3ecd1d<_0x50c1c7[_0x9cd5('0x4a')];_0x3ecd1d+=0x1){_0x40610=_0x50c1c7[_0x3ecd1d]['MetricId']?_0x3b7742[_0x50c1c7[_0x3ecd1d][_0x9cd5('0x76')]][_0x9cd5('0x77')]:_0x50c1c7[_0x3ecd1d][_0x9cd5('0x6d')];_0x40610=_0x50c1c7[_0x3ecd1d][_0x9cd5('0x78')]?_[_0x9cd5('0x8f')](_0x480a33[_0x50c1c7[_0x3ecd1d]['function']],'%s',_0x40610):_0x40610;_0x40610=_0x50c1c7[_0x3ecd1d]['format']?_['replace'](_0x37fc74[_0x50c1c7[_0x3ecd1d][_0x9cd5('0x90')]],'%s',_0x40610):_0x40610;if(_0x50c1c7[_0x3ecd1d][_0x9cd5('0x79')]){_0x5b9c96['group'](_0x40610);}_0x50c1c7[_0x3ecd1d][_0x9cd5('0x7b')]&&_0x5b9c96[_0x9cd5('0x3a')](_0x40610,_0x50c1c7[_0x3ecd1d][_0x9cd5('0x7b')]===_0x9cd5('0x7c')?![]:!![]);_0x5b9c96[_0x9cd5('0x6d')](_0x40610,_0x50c1c7[_0x3ecd1d][_0x9cd5('0x91')]||_0x40610);}if(_0x46d12b[_0x9cd5('0x7d')]){_0x46d12b[_0x9cd5('0x7d')]=JSON[_0x9cd5('0x7e')](_0x46d12b[_0x9cd5('0x7d')]);for(var _0x4f524e=0x0;_0x4f524e<_0x46d12b[_0x9cd5('0x7d')][_0x9cd5('0x4a')];_0x4f524e+=0x1){if(_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x40')]&&_['includes'](_0x4ebd13,_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x40')])&&_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x7f')]&&_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x80')]&&_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x83')]){_0x5b9c96[_0x46d12b[_0x9cd5('0x7d')][_0x4f524e]['type']](_0x46d12b['joins'][_0x4f524e]['foreignTable'],null,util[_0x9cd5('0x90')](_0x9cd5('0x81'),_0x46d12b[_0x9cd5('0x82')],_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x7f')],_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x80')],_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x83')]));}}}if(_0x46d12b[_0x9cd5('0x84')]){_0x46d12b[_0x9cd5('0x84')]=JSON[_0x9cd5('0x7e')](_0x46d12b[_0x9cd5('0x84')]);_0x5b9c96[_0x9cd5('0x3c')](_0x41c07b(_0x46d12b[_0x9cd5('0x84')][_0x9cd5('0x7a')]));}_0x3bd1b9=_0x5b9c96[_0x9cd5('0x85')]();_0x5b9c96[_0x9cd5('0x21')](_0x242045);_0x5b9c96[_0x9cd5('0x20')](0x0);logger[_0x9cd5('0x86')](_0x9cd5('0xa7'),_0x5b9c96['toString']());return dbH[_0x9cd5('0x88')][_0x9cd5('0x33')](_0x5b9c96['toString'](),{'type':dbH[_0x9cd5('0x88')][_0x9cd5('0x89')][_0x9cd5('0xa8')]});}})[_0x9cd5('0x27')](function(){return{'sql':_0x3bd1b9[_0x9cd5('0x87')]()};})[_0x9cd5('0x27')](respondWithResult(_0x57aecd,null))['catch'](handleError(_0x57aecd,null));}; \ No newline at end of file +var _0x60fa=['ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','table','MetricId','function','format','replace','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','from','metric','alias','output','web','%s-%s.%s','randomstring','generate','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','cross_join','HOUR(%s)','debug','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','dbH','sendStatus','status','end','json','count','offset','set','apply','save','update','then','destroy','get','DefaultReports','error','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','show','params','length','find','create','body','role','user','UserProfileSection','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)'];(function(_0x245238,_0x326f25){var _0x1a64ee=function(_0x4f368b){while(--_0x4f368b){_0x245238['push'](_0x245238['shift']());}};_0x1a64ee(++_0x326f25);}(_0x60fa,0x181));var _0xa60f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x60fa[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xa60f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa60f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa60f('0x2'));var rp=require(_0xa60f('0x3'));var moment=require(_0xa60f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa60f('0x5'));var path=require(_0xa60f('0x6'));var sox=require(_0xa60f('0x7'));var csv=require(_0xa60f('0x8'));var ejs=require(_0xa60f('0x9'));var fs=require('fs');var _=require(_0xa60f('0xa'));var squel=require(_0xa60f('0xb'));var crypto=require('crypto');var jsforce=require(_0xa60f('0xc'));var deskjs=require(_0xa60f('0xd'));var toCsv=require(_0xa60f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa60f('0xe'));var as=require(_0xa60f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa60f('0x10'));var utils=require(_0xa60f('0x11'));var config=require(_0xa60f('0x12'));var licenseUtil=require(_0xa60f('0x13'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xa60f('0x14')];function respondWithStatusCode(_0x399619,_0x36f0ca){_0x36f0ca=_0x36f0ca||0xcc;return function(_0x760fc7){if(_0x760fc7){return _0x399619[_0xa60f('0x15')](_0x36f0ca);}return _0x399619[_0xa60f('0x16')](_0x36f0ca)[_0xa60f('0x17')]();};}function respondWithResult(_0x5f1317,_0x56328f){_0x56328f=_0x56328f||0xc8;return function(_0x510fc6){if(_0x510fc6){return _0x5f1317[_0xa60f('0x16')](_0x56328f)[_0xa60f('0x18')](_0x510fc6);}};}function respondWithFilteredResult(_0x9871c4,_0x50a627){return function(_0x3875eb){if(_0x3875eb){var _0x4dbec3=_0x3875eb[_0xa60f('0x19')],_0x284770=_0x50a627[_0xa60f('0x1a')],_0x2851d2=_0x50a627[_0xa60f('0x1a')]+_0x50a627['limit'],_0x3d8e77;if(_0x2851d2>=_0x4dbec3){_0x2851d2=_0x4dbec3;_0x3d8e77=0xc8;}else{_0x3d8e77=0xce;}_0x9871c4[_0xa60f('0x16')](_0x3d8e77);return _0x9871c4[_0xa60f('0x1b')]('Content-Range',_0x284770+'-'+_0x2851d2+'/'+_0x4dbec3)['json'](_0x3875eb);}return null;};}function patchUpdates(_0xe0199a){return function(_0x4e973f){try{jsonpatch[_0xa60f('0x1c')](_0x4e973f,_0xe0199a,!![]);}catch(_0x54e9f5){return BPromise['reject'](_0x54e9f5);}return _0x4e973f[_0xa60f('0x1d')]();};}function saveUpdates(_0x4c00ab,_0x38970c){return function(_0x2f00b4){if(_0x2f00b4){return _0x2f00b4[_0xa60f('0x1e')](_0x4c00ab)[_0xa60f('0x1f')](function(_0x2cf833){return _0x2cf833;});}return null;};}function removeEntity(_0x27b249,_0x126aae){return function(_0x3b5ae8){if(_0x3b5ae8){return _0x3b5ae8[_0xa60f('0x20')]()['then'](function(){var _0x48abfd=_0x3b5ae8[_0xa60f('0x21')]({'plain':!![]});var _0x3af65e=_0xa60f('0x22');return db['UserProfileResource'][_0xa60f('0x20')]({'where':{'type':_0x3af65e,'resourceId':_0x48abfd['id']}})[_0xa60f('0x1f')](function(){return _0x3b5ae8;});})[_0xa60f('0x1f')](function(){_0x27b249[_0xa60f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fb6ef,_0x5da7e0){return function(_0x2ad040){if(!_0x2ad040){_0x1fb6ef[_0xa60f('0x15')](0x194);}return _0x2ad040;};}function handleError(_0x5aafe5,_0x561748){_0x561748=_0x561748||0x1f4;return function(_0x330adf){logger[_0xa60f('0x23')](_0x330adf['stack']);if(_0x330adf[_0xa60f('0x24')]){delete _0x330adf['name'];}_0x5aafe5[_0xa60f('0x16')](_0x561748)[_0xa60f('0x25')](_0x330adf);};}exports[_0xa60f('0x26')]=function(_0x2d9bfb,_0x73301b){var _0x535236={},_0x4c4c5c={},_0x260eca={'count':0x0,'rows':[]};var _0xa5bfcd=_[_0xa60f('0x27')](db['AnalyticDefaultReport'][_0xa60f('0x28')],function(_0x4c70c6){return{'name':_0x4c70c6['fieldName'],'type':_0x4c70c6['type'][_0xa60f('0x29')]};});_0x4c4c5c[_0xa60f('0x2a')]=_[_0xa60f('0x27')](_0xa5bfcd,_0xa60f('0x24'));_0x4c4c5c['query']=_[_0xa60f('0x2b')](_0x2d9bfb[_0xa60f('0x2c')]);_0x4c4c5c[_0xa60f('0x2d')]=_[_0xa60f('0x2e')](_0x4c4c5c[_0xa60f('0x2a')],_0x4c4c5c['query']);_0x535236[_0xa60f('0x2f')]=_[_0xa60f('0x2e')](_0x4c4c5c['model'],qs[_0xa60f('0x30')](_0x2d9bfb[_0xa60f('0x2c')][_0xa60f('0x30')]));_0x535236[_0xa60f('0x2f')]=_0x535236[_0xa60f('0x2f')]['length']?_0x535236[_0xa60f('0x2f')]:_0x4c4c5c['model'];if(!_0x2d9bfb['query'][_0xa60f('0x31')](_0xa60f('0x32'))){_0x535236[_0xa60f('0x33')]=qs[_0xa60f('0x33')](_0x2d9bfb[_0xa60f('0x2c')][_0xa60f('0x33')]);_0x535236[_0xa60f('0x1a')]=qs[_0xa60f('0x1a')](_0x2d9bfb[_0xa60f('0x2c')]['offset']);}_0x535236[_0xa60f('0x34')]=qs['sort'](_0x2d9bfb[_0xa60f('0x2c')][_0xa60f('0x35')]);_0x535236['where']=qs['filters'](_[_0xa60f('0x36')](_0x2d9bfb[_0xa60f('0x2c')],_0x4c4c5c[_0xa60f('0x2d')]),_0xa5bfcd);if(_0x2d9bfb['query'][_0xa60f('0x37')]){_0x535236[_0xa60f('0x38')]=_[_0xa60f('0x39')](_0x535236[_0xa60f('0x38')],{'$or':_['map'](_0xa5bfcd,function(_0x327577){if(_0x327577[_0xa60f('0x3a')]!==_0xa60f('0x3b')){var _0x49bb4a={};_0x49bb4a[_0x327577['name']]={'$like':'%'+_0x2d9bfb[_0xa60f('0x2c')][_0xa60f('0x37')]+'%'};return _0x49bb4a;}})});}_0x535236=_['merge']({},_0x535236,_0x2d9bfb[_0xa60f('0x3c')]);var _0x15c9fa={'where':_0x535236[_0xa60f('0x38')]};return db[_0xa60f('0x3d')]['count'](_0x15c9fa)['then'](function(_0x5163b2){_0x260eca[_0xa60f('0x19')]=_0x5163b2;if(_0x2d9bfb[_0xa60f('0x2c')][_0xa60f('0x3e')]){_0x535236[_0xa60f('0x3f')]=[{'all':!![]}];}return db[_0xa60f('0x3d')][_0xa60f('0x40')](_0x535236);})['then'](function(_0x2372cb){_0x260eca['rows']=_0x2372cb;return _0x260eca;})[_0xa60f('0x1f')](respondWithFilteredResult(_0x73301b,_0x535236))['catch'](handleError(_0x73301b,null));};exports[_0xa60f('0x41')]=function(_0x267166,_0x9991be){var _0x180abe={'raw':!![],'where':{'id':_0x267166[_0xa60f('0x42')]['id']}},_0x172929={};_0x172929[_0xa60f('0x2a')]=_['keys'](db[_0xa60f('0x3d')][_0xa60f('0x28')]);_0x172929['query']=_['keys'](_0x267166[_0xa60f('0x2c')]);_0x172929[_0xa60f('0x2d')]=_[_0xa60f('0x2e')](_0x172929[_0xa60f('0x2a')],_0x172929[_0xa60f('0x2c')]);_0x180abe['attributes']=_[_0xa60f('0x2e')](_0x172929[_0xa60f('0x2a')],qs['fields'](_0x267166[_0xa60f('0x2c')][_0xa60f('0x30')]));_0x180abe[_0xa60f('0x2f')]=_0x180abe['attributes'][_0xa60f('0x43')]?_0x180abe[_0xa60f('0x2f')]:_0x172929[_0xa60f('0x2a')];if(_0x267166[_0xa60f('0x2c')][_0xa60f('0x3e')]){_0x180abe['include']=[{'all':!![]}];}_0x180abe=_[_0xa60f('0x39')]({},_0x180abe,_0x267166[_0xa60f('0x3c')]);return db[_0xa60f('0x3d')][_0xa60f('0x44')](_0x180abe)[_0xa60f('0x1f')](handleEntityNotFound(_0x9991be,null))[_0xa60f('0x1f')](respondWithResult(_0x9991be,null))['catch'](handleError(_0x9991be,null));};exports[_0xa60f('0x45')]=function(_0x4d057c,_0x541999){return db[_0xa60f('0x3d')][_0xa60f('0x45')](_0x4d057c[_0xa60f('0x46')],{})['then'](function(_0xe5a22b){var _0x107e91=_0x4d057c['user']['get']({'plain':!![]});if(!_0x107e91)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x107e91[_0xa60f('0x47')]===_0xa60f('0x48')){var _0x443c8a=_0xe5a22b[_0xa60f('0x21')]({'plain':!![]});var _0x11e236='Reports';return db[_0xa60f('0x49')][_0xa60f('0x44')]({'where':{'name':_0x11e236,'userProfileId':_0x107e91['userProfileId']},'raw':!![]})[_0xa60f('0x1f')](function(_0x2c85c6){if(_0x2c85c6&&_0x2c85c6[_0xa60f('0x4a')]===0x0){return db[_0xa60f('0x4b')][_0xa60f('0x45')]({'name':_0x443c8a[_0xa60f('0x24')],'resourceId':_0x443c8a['id'],'type':'DefaultReports','sectionId':_0x2c85c6['id']},{})[_0xa60f('0x1f')](function(){return _0xe5a22b;});}else{return _0xe5a22b;}})[_0xa60f('0x4c')](function(_0x5d2c71){logger['error'](_0xa60f('0x4d'),_0x5d2c71);throw _0x5d2c71;});}return _0xe5a22b;})[_0xa60f('0x1f')](respondWithResult(_0x541999,0xc9))[_0xa60f('0x4c')](handleError(_0x541999,null));};exports[_0xa60f('0x1e')]=function(_0x3bb54c,_0x4c2e48){if(_0x3bb54c[_0xa60f('0x46')]['id']){delete _0x3bb54c[_0xa60f('0x46')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x3bb54c[_0xa60f('0x42')]['id']}})[_0xa60f('0x1f')](handleEntityNotFound(_0x4c2e48,null))['then'](saveUpdates(_0x3bb54c['body'],null))[_0xa60f('0x1f')](respondWithResult(_0x4c2e48,null))[_0xa60f('0x4c')](handleError(_0x4c2e48,null));};exports['destroy']=function(_0x582d20,_0x16afdd){return db['AnalyticDefaultReport'][_0xa60f('0x44')]({'where':{'id':_0x582d20[_0xa60f('0x42')]['id']}})['then'](handleEntityNotFound(_0x16afdd,null))[_0xa60f('0x1f')](removeEntity(_0x16afdd,null))['catch'](handleError(_0x16afdd,null));};exports['preview']=function(_0x2c383a,_0x2e7d06){var _0x599d85=0xa;var _0x595e45=[_0xa60f('0x4e'),_0xa60f('0x4f'),'right_join','cross_join'];var _0x567b1f={'SUM':_0xa60f('0x50'),'COUNT':_0xa60f('0x51'),'COUNT DISTINCT':_0xa60f('0x52'),'MAX':'MAX(%s)','MIN':_0xa60f('0x53'),'AVG':_0xa60f('0x54'),'GROUP_CONCAT':_0xa60f('0x55'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xa60f('0x56')};var _0x1f57fb={'SEC_TO_TIME':_0xa60f('0x57'),'DATE':_0xa60f('0x58'),'HOUR':'HOUR(%s)','ROUND':_0xa60f('0x59'),'UNIX_TIMESTAMP':_0xa60f('0x5a')};var _0x224bd5=function(_0x3b92f3){return!_[_0xa60f('0x5b')]([_0xa60f('0x5c'),'IS\x20NOT\x20NULL',_0xa60f('0x5d'),_0xa60f('0x5e')],_0x3b92f3);};var _0x46315a=function(_0x24044b){if(!_0x24044b||!_0x24044b[_0xa60f('0x5f')][_0xa60f('0x43')]){return'';}for(var _0x25f13f='(',_0x1b05b2=0x0;_0x1b05b2<_0x24044b[_0xa60f('0x5f')][_0xa60f('0x43')];_0x1b05b2+=0x1){_0x1b05b2>0x0&&(_0x25f13f+='\x20'+_0x24044b[_0xa60f('0x60')]+'\x20');_0x25f13f+=_0x24044b[_0xa60f('0x5f')][_0x1b05b2][_0xa60f('0x61')]?_0x46315a(_0x24044b[_0xa60f('0x5f')][_0x1b05b2][_0xa60f('0x61')]):_0x24044b['rules'][_0x1b05b2][_0xa60f('0x62')]+'\x20'+_0x24044b[_0xa60f('0x5f')][_0x1b05b2][_0xa60f('0x63')]+(_0x224bd5(_0x24044b[_0xa60f('0x5f')][_0x1b05b2][_0xa60f('0x63')])?'\x20'+_0x24044b[_0xa60f('0x5f')][_0x1b05b2][_0xa60f('0x64')]:'');}return _0x25f13f+')';};var _0x207a7a={'where':{'id':_0x2c383a[_0xa60f('0x42')]['id']}},_0x2d8354,_0x4b117d,_0x1f842c,_0x303be0,_0x57b03d;_0x207a7a=_[_0xa60f('0x39')]({},_0x207a7a,_0x2c383a[_0xa60f('0x3c')]);return db[_0xa60f('0x3d')][_0xa60f('0x44')](_0x207a7a)[_0xa60f('0x1f')](function(_0x1b8669){if(_0x1b8669){_0x2d8354=_0x1b8669;return _0x1b8669[_0xa60f('0x65')]();}return null;})['then'](function(_0xb116eb){if(_0xb116eb){if(!_0xb116eb['length']){throw new db[(_0xa60f('0x66'))][(_0xa60f('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4b117d=_0xb116eb;return db[_0xa60f('0x68')][_0xa60f('0x40')]({'raw':!![]});}return null;})[_0xa60f('0x1f')](function(_0xb724a0){if(_0xb724a0){_0x1f842c=_[_0xa60f('0x69')](_0xb724a0,'id');var _0x53af2b;var _0x5dfc21=squel[_0xa60f('0x6a')]();_0x5dfc21['from'](_0x2d8354[_0xa60f('0x6b')]);for(var _0x398b23=0x0;_0x398b23<_0x4b117d[_0xa60f('0x43')];_0x398b23+=0x1){_0x53af2b=_0x4b117d[_0x398b23][_0xa60f('0x6c')]?_0x1f842c[_0x4b117d[_0x398b23]['MetricId']]['metric']:_0x4b117d[_0x398b23][_0xa60f('0x62')];_0x53af2b=_0x4b117d[_0x398b23][_0xa60f('0x6d')]?_['replace'](_0x567b1f[_0x4b117d[_0x398b23][_0xa60f('0x6d')]],'%s',_0x53af2b):_0x53af2b;_0x53af2b=_0x4b117d[_0x398b23][_0xa60f('0x6e')]?_[_0xa60f('0x6f')](_0x1f57fb[_0x4b117d[_0x398b23][_0xa60f('0x6e')]],'%s',_0x53af2b):_0x53af2b;if(_0x4b117d[_0x398b23][_0xa60f('0x70')]){_0x5dfc21[_0xa60f('0x61')](_0x53af2b);}_0x4b117d[_0x398b23]['orderBy']&&_0x5dfc21[_0xa60f('0x34')](_0x53af2b,_0x4b117d[_0x398b23][_0xa60f('0x71')]===_0xa60f('0x72')?![]:!![]);_0x5dfc21[_0xa60f('0x62')](_0x53af2b,_0x4b117d[_0x398b23]['alias']||_0x53af2b);}if(_0x2d8354[_0xa60f('0x73')]){_0x2d8354[_0xa60f('0x73')]=JSON[_0xa60f('0x74')](_0x2d8354[_0xa60f('0x73')]);for(var _0xcac248=0x0;_0xcac248<_0x2d8354[_0xa60f('0x73')][_0xa60f('0x43')];_0xcac248+=0x1){if(_0x2d8354[_0xa60f('0x73')][_0xcac248][_0xa60f('0x3a')]&&_['includes'](_0x595e45,_0x2d8354['joins'][_0xcac248]['type'])&&_0x2d8354[_0xa60f('0x73')][_0xcac248][_0xa60f('0x75')]&&_0x2d8354[_0xa60f('0x73')][_0xcac248][_0xa60f('0x76')]&&_0x2d8354[_0xa60f('0x73')][_0xcac248][_0xa60f('0x77')]){_0x5dfc21[_0x2d8354[_0xa60f('0x73')][_0xcac248][_0xa60f('0x3a')]](_0x2d8354['joins'][_0xcac248][_0xa60f('0x76')],null,util[_0xa60f('0x6e')](_0xa60f('0x78'),_0x2d8354['table'],_0x2d8354[_0xa60f('0x73')][_0xcac248][_0xa60f('0x75')],_0x2d8354[_0xa60f('0x73')][_0xcac248][_0xa60f('0x76')],_0x2d8354['joins'][_0xcac248][_0xa60f('0x77')]));}}}if(_0x2d8354[_0xa60f('0x79')]){_0x2d8354[_0xa60f('0x79')]=JSON[_0xa60f('0x74')](_0x2d8354[_0xa60f('0x79')]);_0x5dfc21['where'](_0x46315a(_0x2d8354['conditions'][_0xa60f('0x61')]));}_0x57b03d=_0x5dfc21[_0xa60f('0x7a')]();_0x5dfc21[_0xa60f('0x33')](_0x599d85);_0x5dfc21[_0xa60f('0x1a')](0x0);logger['debug'](_0xa60f('0x7b'),_0x5dfc21[_0xa60f('0x7c')]());return dbH[_0xa60f('0x7d')][_0xa60f('0x2c')](_0x5dfc21['toString'](),{'type':dbH[_0xa60f('0x7d')][_0xa60f('0x7e')][_0xa60f('0x7f')]});}})[_0xa60f('0x1f')](respondWithResult(_0x2e7d06,null))[_0xa60f('0x4c')](handleError(_0x2e7d06,null));};function runReport(_0x7b194c,_0x3113ba,_0x17116d){var _0x353a3e=_0x3113ba[_0xa60f('0x24')];var _0x1b60e1=0xa;var _0x18f246=[_0xa60f('0x4e'),_0xa60f('0x4f'),_0xa60f('0x80'),'cross_join'];var _0x1141e6={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xa60f('0x81'),'MIN':_0xa60f('0x53'),'AVG':_0xa60f('0x54'),'GROUP_CONCAT':_0xa60f('0x55'),'GROUP_CONCAT ASC':_0xa60f('0x82'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x46fbbe={'SEC_TO_TIME':_0xa60f('0x57'),'DATE':_0xa60f('0x58'),'HOUR':'HOUR(%s)','ROUND':_0xa60f('0x59'),'UNIX_TIMESTAMP':_0xa60f('0x5a')};var _0x51d88e=function(_0x5071e6){return!_['includes']([_0xa60f('0x5c'),_0xa60f('0x83'),_0xa60f('0x5d'),_0xa60f('0x5e')],_0x5071e6);};var _0x22f6a9=function(_0x23285b){if(!_0x23285b||!_0x23285b[_0xa60f('0x5f')][_0xa60f('0x43')]){return'';}for(var _0x124022='(',_0x2c2d70=0x0;_0x2c2d70<_0x23285b['rules'][_0xa60f('0x43')];_0x2c2d70+=0x1){_0x2c2d70>0x0&&(_0x124022+='\x20'+_0x23285b[_0xa60f('0x60')]+'\x20');_0x124022+=_0x23285b[_0xa60f('0x5f')][_0x2c2d70][_0xa60f('0x61')]?_0x22f6a9(_0x23285b['rules'][_0x2c2d70][_0xa60f('0x61')]):_0x23285b[_0xa60f('0x5f')][_0x2c2d70][_0xa60f('0x62')]+'\x20'+_0x23285b[_0xa60f('0x5f')][_0x2c2d70]['condition']+(_0x51d88e(_0x23285b[_0xa60f('0x5f')][_0x2c2d70][_0xa60f('0x63')])?'\x20'+_0x23285b[_0xa60f('0x5f')][_0x2c2d70][_0xa60f('0x64')]:'');}return _0x124022+')';};var _0x31f3={'where':{'id':_0x7b194c['id']}},_0x128a4f,_0x1d5b15,_0x5459c0,_0x45f8a8,_0x210a41;_0x31f3=_[_0xa60f('0x39')]({},_0x31f3,_0x17116d);return db[_0xa60f('0x3d')][_0xa60f('0x44')](_0x31f3)[_0xa60f('0x1f')](function(_0x561104){if(_0x561104){_0x128a4f=_0x561104;return _0x561104['getFields']();}return null;})[_0xa60f('0x1f')](function(_0x4f2cce){if(_0x4f2cce){if(!_0x4f2cce[_0xa60f('0x43')]){throw new db[(_0xa60f('0x66'))][(_0xa60f('0x67'))](_0xa60f('0x84'),0x193);}_0x1d5b15=_0x4f2cce;return db[_0xa60f('0x68')][_0xa60f('0x40')]({'raw':!![]});}return null;})[_0xa60f('0x1f')](function(_0x2bd559){if(_0x2bd559){_0x5459c0=_[_0xa60f('0x69')](_0x2bd559,'id');var _0x165da9;var _0x4f43b5=squel['select']();_0x4f43b5[_0xa60f('0x85')](_0x128a4f['table']);for(var _0x37ff2b=0x0;_0x37ff2b<_0x1d5b15[_0xa60f('0x43')];_0x37ff2b+=0x1){_0x165da9=_0x1d5b15[_0x37ff2b]['MetricId']?_0x5459c0[_0x1d5b15[_0x37ff2b][_0xa60f('0x6c')]][_0xa60f('0x86')]:_0x1d5b15[_0x37ff2b][_0xa60f('0x62')];_0x165da9=_0x1d5b15[_0x37ff2b][_0xa60f('0x6d')]?_[_0xa60f('0x6f')](_0x1141e6[_0x1d5b15[_0x37ff2b][_0xa60f('0x6d')]],'%s',_0x165da9):_0x165da9;_0x165da9=_0x1d5b15[_0x37ff2b][_0xa60f('0x6e')]?_[_0xa60f('0x6f')](_0x46fbbe[_0x1d5b15[_0x37ff2b][_0xa60f('0x6e')]],'%s',_0x165da9):_0x165da9;if(_0x1d5b15[_0x37ff2b][_0xa60f('0x70')]){_0x4f43b5[_0xa60f('0x61')](_0x165da9);}_0x1d5b15[_0x37ff2b][_0xa60f('0x71')]&&_0x4f43b5['order'](_0x165da9,_0x1d5b15[_0x37ff2b]['orderBy']===_0xa60f('0x72')?![]:!![]);_0x4f43b5[_0xa60f('0x62')](_0x165da9,_0x1d5b15[_0x37ff2b][_0xa60f('0x87')]||_0x165da9);}if(_0x128a4f[_0xa60f('0x73')]){_0x128a4f[_0xa60f('0x73')]=JSON['parse'](_0x128a4f[_0xa60f('0x73')]);for(var _0x5e7bdd=0x0;_0x5e7bdd<_0x128a4f[_0xa60f('0x73')][_0xa60f('0x43')];_0x5e7bdd+=0x1){if(_0x128a4f[_0xa60f('0x73')][_0x5e7bdd][_0xa60f('0x3a')]&&_[_0xa60f('0x5b')](_0x18f246,_0x128a4f[_0xa60f('0x73')][_0x5e7bdd][_0xa60f('0x3a')])&&_0x128a4f[_0xa60f('0x73')][_0x5e7bdd][_0xa60f('0x75')]&&_0x128a4f['joins'][_0x5e7bdd][_0xa60f('0x76')]&&_0x128a4f[_0xa60f('0x73')][_0x5e7bdd][_0xa60f('0x77')]){_0x4f43b5[_0x128a4f[_0xa60f('0x73')][_0x5e7bdd]['type']](_0x128a4f['joins'][_0x5e7bdd][_0xa60f('0x76')],null,util[_0xa60f('0x6e')](_0xa60f('0x78'),_0x128a4f['table'],_0x128a4f[_0xa60f('0x73')][_0x5e7bdd][_0xa60f('0x75')],_0x128a4f['joins'][_0x5e7bdd][_0xa60f('0x76')],_0x128a4f[_0xa60f('0x73')][_0x5e7bdd][_0xa60f('0x77')]));}}}if(_0x128a4f[_0xa60f('0x79')]){_0x128a4f['conditions']=JSON[_0xa60f('0x74')](_0x128a4f[_0xa60f('0x79')]);_0x4f43b5[_0xa60f('0x38')](_0x22f6a9(_0x128a4f[_0xa60f('0x79')][_0xa60f('0x61')]));}_0x210a41=_0x4f43b5[_0xa60f('0x7a')]();_0x4f43b5['limit'](_0x1b60e1);_0x4f43b5[_0xa60f('0x1a')](0x0);return;}})['then'](function(){if(_0x3113ba[_0xa60f('0x88')]===_0xa60f('0x89')){return null;}var _0x7349e2=_[_0xa60f('0x39')](_0x3113ba,{'name':_0x3113ba['fullPath']||_0x3113ba[_0xa60f('0x24')]||_0x128a4f[_0xa60f('0x24')],'basename':_0x353a3e,'savename':util[_0xa60f('0x6e')](_0xa60f('0x8a'),_0x3113ba[_0xa60f('0x24')]||_0x128a4f[_0xa60f('0x24')],require(_0xa60f('0x8b'))[_0xa60f('0x8c')](0x4),_0x3113ba['output']||'csv'),'reportId':_0x128a4f['id'],'reportType':'default'});return db[_0xa60f('0x8d')][_0xa60f('0x45')](_0x7349e2,{'raw':!![]});})[_0xa60f('0x1f')](function(_0x4a1a51){if(_0x128a4f[_0xa60f('0x6b')]==='cdr'){_0x210a41[_0xa60f('0x38')](_0x128a4f[_0xa60f('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3113ba[_0xa60f('0x8e')],_0x3113ba[_0xa60f('0x8f')]);}else{_0x210a41['where'](_0x128a4f[_0xa60f('0x6b')]+_0xa60f('0x90'),_0x3113ba['startDate'],_0x3113ba[_0xa60f('0x8f')]);}if(_0x4a1a51){logger[_0xa60f('0x91')](_0xa60f('0x92'),_0x210a41[_0xa60f('0x7c')]());require(_0xa60f('0x93'))[_0xa60f('0x94')](path['join'](__dirname,_0xa60f('0x95'),_0x4a1a51[_0xa60f('0x88')]),[_0x4a1a51['id'],_0x210a41['toString'](),path['join'](__dirname,_0xa60f('0x96'),_0x4a1a51['savename']),_0x353a3e]);return _0x4a1a51;}else{var _0x1025e0=squel[_0xa60f('0x6a')]();_0x1025e0['from']('('+_0x210a41[_0xa60f('0x7c')]()+')',_0xa60f('0x97'));_0x1025e0[_0xa60f('0x62')](_0xa60f('0x98'),_0xa60f('0x19'));_0x210a41['limit'](_0x3113ba[_0xa60f('0x33')]||_0x1b60e1);_0x210a41[_0xa60f('0x1a')](_0x3113ba[_0xa60f('0x1a')]||0x0);return dbH[_0xa60f('0x7d')][_0xa60f('0x2c')](_0x1025e0[_0xa60f('0x7c')](),{'type':dbH[_0xa60f('0x7d')]['QueryTypes'][_0xa60f('0x7f')]})[_0xa60f('0x1f')](function(_0x3aa43a){if(!_0x3aa43a['length']){_0x45f8a8=0x0;}else{_0x45f8a8=_0x3aa43a[0x0][_0xa60f('0x19')]||0x0;}return dbH['sequelize'][_0xa60f('0x2c')](_0x210a41['toString'](),{'type':dbH[_0xa60f('0x7d')][_0xa60f('0x7e')][_0xa60f('0x7f')]});})[_0xa60f('0x1f')](function(_0x2a9a3a){return{'rows':_0x2a9a3a||[],'count':_0x45f8a8};});}});}exports[_0xa60f('0x99')]=function(_0x8d041b,_0x54b52a){return runReport(_0x8d041b['params'],_0x8d041b[_0xa60f('0x2c')],_0x8d041b[_0xa60f('0x3c')])['then'](respondWithResult(_0x54b52a,null))[_0xa60f('0x4c')](handleError(_0x54b52a,null));};exports[_0xa60f('0x9a')]=runReport;exports[_0xa60f('0x2c')]=function(_0x566ff5,_0x558045){var _0x175599=0xa;var _0x260a83=[_0xa60f('0x4e'),'left_join','right_join',_0xa60f('0x9b')];var _0x2dfc3e={'SUM':_0xa60f('0x50'),'COUNT':_0xa60f('0x51'),'COUNT DISTINCT':_0xa60f('0x52'),'MAX':_0xa60f('0x81'),'MIN':_0xa60f('0x53'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xa60f('0x56')};var _0x45389={'SEC_TO_TIME':_0xa60f('0x57'),'DATE':'DATE(%s)','HOUR':_0xa60f('0x9c'),'ROUND':_0xa60f('0x59'),'UNIX_TIMESTAMP':_0xa60f('0x5a')};var _0x2333dd=function(_0x21de5d){return!_[_0xa60f('0x5b')]([_0xa60f('0x5c'),'IS\x20NOT\x20NULL',_0xa60f('0x5d'),_0xa60f('0x5e')],_0x21de5d);};var _0x1ec70c=function(_0x2eb333){if(!_0x2eb333||!_0x2eb333[_0xa60f('0x5f')]['length']){return'';}for(var _0x272d45='(',_0x4fd5fb=0x0;_0x4fd5fb<_0x2eb333['rules'][_0xa60f('0x43')];_0x4fd5fb+=0x1){_0x4fd5fb>0x0&&(_0x272d45+='\x20'+_0x2eb333['operator']+'\x20');_0x272d45+=_0x2eb333[_0xa60f('0x5f')][_0x4fd5fb]['group']?_0x1ec70c(_0x2eb333[_0xa60f('0x5f')][_0x4fd5fb][_0xa60f('0x61')]):_0x2eb333[_0xa60f('0x5f')][_0x4fd5fb][_0xa60f('0x62')]+'\x20'+_0x2eb333['rules'][_0x4fd5fb][_0xa60f('0x63')]+(_0x2333dd(_0x2eb333[_0xa60f('0x5f')][_0x4fd5fb]['condition'])?'\x20'+_0x2eb333['rules'][_0x4fd5fb]['value']:'');}return _0x272d45+')';};var _0x61f8a3={'where':{'id':_0x566ff5[_0xa60f('0x42')]['id']}},_0x2bfc7b,_0x30abef,_0x5ef92e,_0x179c01,_0xe92f66;_0x61f8a3=_[_0xa60f('0x39')]({},_0x61f8a3,_0x566ff5[_0xa60f('0x3c')]);return db[_0xa60f('0x3d')][_0xa60f('0x44')](_0x61f8a3)[_0xa60f('0x1f')](function(_0x34634c){if(_0x34634c){_0x2bfc7b=_0x34634c;return _0x34634c[_0xa60f('0x65')]();}return null;})[_0xa60f('0x1f')](function(_0x6f1203){if(_0x6f1203){if(!_0x6f1203[_0xa60f('0x43')]){throw new db['Sequelize'][(_0xa60f('0x67'))](_0xa60f('0x84'),0x193);}_0x30abef=_0x6f1203;return db[_0xa60f('0x68')][_0xa60f('0x40')]({'raw':!![]});}return null;})[_0xa60f('0x1f')](function(_0x4042c1){if(_0x4042c1){_0x5ef92e=_[_0xa60f('0x69')](_0x4042c1,'id');var _0x4d6ca2;var _0x254b0a=squel[_0xa60f('0x6a')]();_0x254b0a['from'](_0x2bfc7b[_0xa60f('0x6b')]);for(var _0x2fc0e7=0x0;_0x2fc0e7<_0x30abef[_0xa60f('0x43')];_0x2fc0e7+=0x1){_0x4d6ca2=_0x30abef[_0x2fc0e7][_0xa60f('0x6c')]?_0x5ef92e[_0x30abef[_0x2fc0e7]['MetricId']]['metric']:_0x30abef[_0x2fc0e7][_0xa60f('0x62')];_0x4d6ca2=_0x30abef[_0x2fc0e7][_0xa60f('0x6d')]?_[_0xa60f('0x6f')](_0x2dfc3e[_0x30abef[_0x2fc0e7][_0xa60f('0x6d')]],'%s',_0x4d6ca2):_0x4d6ca2;_0x4d6ca2=_0x30abef[_0x2fc0e7][_0xa60f('0x6e')]?_['replace'](_0x45389[_0x30abef[_0x2fc0e7]['format']],'%s',_0x4d6ca2):_0x4d6ca2;if(_0x30abef[_0x2fc0e7]['groupBy']){_0x254b0a[_0xa60f('0x61')](_0x4d6ca2);}_0x30abef[_0x2fc0e7][_0xa60f('0x71')]&&_0x254b0a[_0xa60f('0x34')](_0x4d6ca2,_0x30abef[_0x2fc0e7][_0xa60f('0x71')]==='DESC'?![]:!![]);_0x254b0a['field'](_0x4d6ca2,_0x30abef[_0x2fc0e7][_0xa60f('0x87')]||_0x4d6ca2);}if(_0x2bfc7b[_0xa60f('0x73')]){_0x2bfc7b[_0xa60f('0x73')]=JSON[_0xa60f('0x74')](_0x2bfc7b[_0xa60f('0x73')]);for(var _0x3aa2f4=0x0;_0x3aa2f4<_0x2bfc7b[_0xa60f('0x73')][_0xa60f('0x43')];_0x3aa2f4+=0x1){if(_0x2bfc7b[_0xa60f('0x73')][_0x3aa2f4][_0xa60f('0x3a')]&&_[_0xa60f('0x5b')](_0x260a83,_0x2bfc7b[_0xa60f('0x73')][_0x3aa2f4][_0xa60f('0x3a')])&&_0x2bfc7b[_0xa60f('0x73')][_0x3aa2f4]['parentKey']&&_0x2bfc7b['joins'][_0x3aa2f4][_0xa60f('0x76')]&&_0x2bfc7b[_0xa60f('0x73')][_0x3aa2f4][_0xa60f('0x77')]){_0x254b0a[_0x2bfc7b[_0xa60f('0x73')][_0x3aa2f4][_0xa60f('0x3a')]](_0x2bfc7b[_0xa60f('0x73')][_0x3aa2f4][_0xa60f('0x76')],null,util[_0xa60f('0x6e')](_0xa60f('0x78'),_0x2bfc7b[_0xa60f('0x6b')],_0x2bfc7b[_0xa60f('0x73')][_0x3aa2f4]['parentKey'],_0x2bfc7b[_0xa60f('0x73')][_0x3aa2f4]['foreignTable'],_0x2bfc7b['joins'][_0x3aa2f4][_0xa60f('0x77')]));}}}if(_0x2bfc7b[_0xa60f('0x79')]){_0x2bfc7b[_0xa60f('0x79')]=JSON['parse'](_0x2bfc7b[_0xa60f('0x79')]);_0x254b0a[_0xa60f('0x38')](_0x1ec70c(_0x2bfc7b['conditions']['group']));}_0xe92f66=_0x254b0a[_0xa60f('0x7a')]();_0x254b0a[_0xa60f('0x33')](_0x175599);_0x254b0a[_0xa60f('0x1a')](0x0);logger[_0xa60f('0x9d')](_0xa60f('0x7b'),_0x254b0a['toString']());return dbH['sequelize'][_0xa60f('0x2c')](_0x254b0a[_0xa60f('0x7c')](),{'type':dbH[_0xa60f('0x7d')][_0xa60f('0x7e')][_0xa60f('0x7f')]});}})[_0xa60f('0x1f')](function(){return{'sql':_0xe92f66[_0xa60f('0x7c')]()};})[_0xa60f('0x1f')](respondWithResult(_0x558045,null))[_0xa60f('0x4c')](handleError(_0x558045,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 1d70a18..b4956b3 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 _0x16ea=['exports','define','analytics_default_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x339ade,_0x343c2a){var _0x4f5e4b=function(_0xe2e5d9){while(--_0xe2e5d9){_0x339ade['push'](_0x339ade['shift']());}};_0x4f5e4b(++_0x343c2a);}(_0x16ea,0x78));var _0xa16e=function(_0x2f30de,_0x5d86ff){_0x2f30de=_0x2f30de-0x0;var _0x1ce460=_0x16ea[_0x2f30de];return _0x1ce460;};'use strict';var _=require('lodash');var util=require(_0xa16e('0x0'));var logger=require(_0xa16e('0x1'))(_0xa16e('0x2'));var moment=require(_0xa16e('0x3'));var BPromise=require(_0xa16e('0x4'));var rp=require(_0xa16e('0x5'));var fs=require('fs');var path=require(_0xa16e('0x6'));var rimraf=require(_0xa16e('0x7'));var config=require(_0xa16e('0x8'));var attributes=require(_0xa16e('0x9'));module[_0xa16e('0xa')]=function(_0xe84d74,_0x3db5d8){return _0xe84d74[_0xa16e('0xb')]('AnalyticDefaultReport',attributes,{'tableName':_0xa16e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4635=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3647c2,_0x52994f){var _0x15224c=function(_0x753a39){while(--_0x753a39){_0x3647c2['push'](_0x3647c2['shift']());}};_0x15224c(++_0x52994f);}(_0x4635,0x80));var _0x5463=function(_0x1e09c0,_0x5b0f67){_0x1e09c0=_0x1e09c0-0x0;var _0x99319d=_0x4635[_0x1e09c0];return _0x99319d;};'use strict';var _=require(_0x5463('0x0'));var util=require(_0x5463('0x1'));var logger=require(_0x5463('0x2'))(_0x5463('0x3'));var moment=require(_0x5463('0x4'));var BPromise=require(_0x5463('0x5'));var rp=require(_0x5463('0x6'));var fs=require('fs');var path=require(_0x5463('0x7'));var rimraf=require(_0x5463('0x8'));var config=require(_0x5463('0x9'));var attributes=require(_0x5463('0xa'));module[_0x5463('0xb')]=function(_0x545216,_0x5d28a3){return _0x545216[_0x5463('0xc')](_0x5463('0xd'),attributes,{'tableName':_0x5463('0xe'),'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 2d80282..b8aef9b 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 _0x58a7=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5978b4,_0x341665){var _0x52ab25=function(_0x5d06eb){while(--_0x5d06eb){_0x5978b4['push'](_0x5978b4['shift']());}};_0x52ab25(++_0x341665);}(_0x58a7,0xf7));var _0x758a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x58a7[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x758a('0x0'));var util=require(_0x758a('0x1'));var moment=require(_0x758a('0x2'));var BPromise=require(_0x758a('0x3'));var rs=require(_0x758a('0x4'));var fs=require('fs');var Redis=require(_0x758a('0x5'));var db=require(_0x758a('0x6'))['db'];var utils=require(_0x758a('0x7'));var logger=require('../../config/logger')(_0x758a('0x8'));var config=require(_0x758a('0x9'));var jayson=require(_0x758a('0xa'));var client=jayson[_0x758a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52bc94,_0x232c83,_0x514bca){return new BPromise(function(_0x227bdb,_0x31311b){return client[_0x758a('0xc')](_0x52bc94,_0x514bca)[_0x758a('0xd')](function(_0x1e5665){logger[_0x758a('0xe')](_0x758a('0xf'),_0x232c83,_0x758a('0x10'));logger[_0x758a('0x11')](_0x758a('0x12'),_0x232c83,_0x758a('0x10'),JSON['stringify'](_0x1e5665));if(_0x1e5665['error']){if(_0x1e5665[_0x758a('0x13')][_0x758a('0x14')]===0x1f4){logger[_0x758a('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x232c83,_0x1e5665[_0x758a('0x13')][_0x758a('0x15')]);return _0x31311b(_0x1e5665[_0x758a('0x13')][_0x758a('0x15')]);}logger[_0x758a('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x232c83,_0x1e5665['error'][_0x758a('0x15')]);return _0x227bdb(_0x1e5665[_0x758a('0x13')][_0x758a('0x15')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x232c83,'request\x20sent');_0x227bdb(_0x1e5665['result'][_0x758a('0x15')]);}})[_0x758a('0x16')](function(_0x520883){logger[_0x758a('0x13')](_0x758a('0xf'),_0x232c83,_0x520883);_0x31311b(_0x520883);});});} \ No newline at end of file +var _0x1ebd=['AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x1ebd,0x64));var _0xd1eb=function(_0x1080e4,_0x2dedb5){_0x1080e4=_0x1080e4-0x0;var _0xc759bd=_0x1ebd[_0x1080e4];return _0xc759bd;};'use strict';var _=require(_0xd1eb('0x0'));var util=require(_0xd1eb('0x1'));var moment=require(_0xd1eb('0x2'));var BPromise=require('bluebird');var rs=require(_0xd1eb('0x3'));var fs=require('fs');var Redis=require(_0xd1eb('0x4'));var db=require(_0xd1eb('0x5'))['db'];var utils=require(_0xd1eb('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd1eb('0x7'));var jayson=require(_0xd1eb('0x8'));var client=jayson['client'][_0xd1eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb4c88d,_0x10555e,_0x5ea9bf){return new BPromise(function(_0x33ce51,_0x209954){return client[_0xd1eb('0xa')](_0xb4c88d,_0x5ea9bf)[_0xd1eb('0xb')](function(_0x14a89b){logger[_0xd1eb('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x10555e,_0xd1eb('0xd'));logger[_0xd1eb('0xe')](_0xd1eb('0xf'),_0x10555e,'request\x20sent',JSON[_0xd1eb('0x10')](_0x14a89b));if(_0x14a89b['error']){if(_0x14a89b[_0xd1eb('0x11')][_0xd1eb('0x12')]===0x1f4){logger[_0xd1eb('0x11')](_0xd1eb('0x13'),_0x10555e,_0x14a89b[_0xd1eb('0x11')]['message']);return _0x209954(_0x14a89b[_0xd1eb('0x11')][_0xd1eb('0x14')]);}logger[_0xd1eb('0x11')](_0xd1eb('0x13'),_0x10555e,_0x14a89b[_0xd1eb('0x11')][_0xd1eb('0x14')]);return _0x33ce51(_0x14a89b[_0xd1eb('0x11')][_0xd1eb('0x14')]);}else{logger['info'](_0xd1eb('0x13'),_0x10555e,_0xd1eb('0xd'));_0x33ce51(_0x14a89b[_0xd1eb('0x15')][_0xd1eb('0x14')]);}})[_0xd1eb('0x16')](function(_0x3c1834){logger[_0xd1eb('0x11')](_0xd1eb('0x13'),_0x10555e,_0x3c1834);_0x209954(_0x3c1834);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index b5f50eb..390d4b7 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 _0x483f=['/:id/run','/:id/query','query','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview'];(function(_0x3fcc20,_0x57c31b){var _0x15d3ce=function(_0x575619){while(--_0x575619){_0x3fcc20['push'](_0x3fcc20['shift']());}};_0x15d3ce(++_0x57c31b);}(_0x483f,0x142));var _0xf483=function(_0x522924,_0x4e61ea){_0x522924=_0x522924-0x0;var _0x326539=_0x483f[_0x522924];return _0x326539;};'use strict';var multer=require(_0xf483('0x0'));var util=require(_0xf483('0x1'));var path=require(_0xf483('0x2'));var timeout=require(_0xf483('0x3'));var express=require(_0xf483('0x4'));var router=express['Router']();var auth=require(_0xf483('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf483('0x6'));var controller=require(_0xf483('0x7'));router[_0xf483('0x8')]('/',auth[_0xf483('0x9')](),controller[_0xf483('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf483('0xb')]);router[_0xf483('0x8')](_0xf483('0xc'),auth['isAuthenticated'](),controller[_0xf483('0xd')]);router[_0xf483('0x8')](_0xf483('0xe'),auth[_0xf483('0x9')](),controller['run']);router[_0xf483('0x8')](_0xf483('0xf'),auth[_0xf483('0x9')](),controller[_0xf483('0x10')]);router[_0xf483('0x11')]('/',auth[_0xf483('0x9')](),controller[_0xf483('0x12')]);router[_0xf483('0x13')](_0xf483('0x14'),auth['isAuthenticated'](),controller[_0xf483('0x15')]);router['delete'](_0xf483('0x14'),auth[_0xf483('0x9')](),controller[_0xf483('0x16')]);module[_0xf483('0x17')]=router; \ No newline at end of file +var _0xf881=['query','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','preview','/:id/query'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf881,0x1ab));var _0x1f88=function(_0xbb772f,_0x299c73){_0xbb772f=_0xbb772f-0x0;var _0x3d7f23=_0xf881[_0xbb772f];return _0x3d7f23;};'use strict';var multer=require(_0x1f88('0x0'));var util=require('util');var path=require(_0x1f88('0x1'));var timeout=require('connect-timeout');var express=require(_0x1f88('0x2'));var router=express[_0x1f88('0x3')]();var auth=require(_0x1f88('0x4'));var interaction=require(_0x1f88('0x5'));var config=require(_0x1f88('0x6'));var controller=require(_0x1f88('0x7'));router[_0x1f88('0x8')]('/',auth[_0x1f88('0x9')](),controller[_0x1f88('0xa')]);router[_0x1f88('0x8')](_0x1f88('0xb'),auth[_0x1f88('0x9')](),controller['show']);router[_0x1f88('0x8')]('/:id/preview',auth[_0x1f88('0x9')](),controller[_0x1f88('0xc')]);router[_0x1f88('0x8')]('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0x1f88('0x8')](_0x1f88('0xd'),auth[_0x1f88('0x9')](),controller[_0x1f88('0xe')]);router['post']('/',auth[_0x1f88('0x9')](),controller[_0x1f88('0xf')]);router[_0x1f88('0x10')](_0x1f88('0xb'),auth[_0x1f88('0x9')](),controller[_0x1f88('0x11')]);router[_0x1f88('0x12')](_0x1f88('0xb'),auth[_0x1f88('0x9')](),controller[_0x1f88('0x13')]);module[_0x1f88('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index b11b038..f78cf49 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 _0x8e28=['STRING','ENUM','csv','pdf','DATE','Loading','scheduled','INTEGER','UNSIGNED','moment','exports'];(function(_0x1ae51f,_0x42b687){var _0x5eeb5d=function(_0x4dcf7d){while(--_0x4dcf7d){_0x1ae51f['push'](_0x1ae51f['shift']());}};_0x5eeb5d(++_0x42b687);}(_0x8e28,0x127));var _0x88e2=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x8e28[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x88e2('0x0'));module[_0x88e2('0x1')]={'name':{'type':Sequelize[_0x88e2('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x88e2('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x88e2('0x3')](_0x88e2('0x4'),_0x88e2('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x88e2('0x4')},'savename':{'type':Sequelize[_0x88e2('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x88e2('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x88e2('0x2')],'defaultValue':_0x88e2('0x7')},'type':{'type':Sequelize['ENUM']('manual',_0x88e2('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x88e2('0x9')](0xb)[_0x88e2('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x21fa=['xlsx','DATE','Loading','manual','INTEGER','UNSIGNED','moment','exports','STRING','ENUM','pdf'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x21fa,0x69));var _0xa21f=function(_0x4af1c8,_0x1cfb0f){_0x4af1c8=_0x4af1c8-0x0;var _0xf9c5b4=_0x21fa[_0x4af1c8];return _0xf9c5b4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa21f('0x0'));module[_0xa21f('0x1')]={'name':{'type':Sequelize[_0xa21f('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xa21f('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xa21f('0x3')]('csv',_0xa21f('0x4'),_0xa21f('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xa21f('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa21f('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xa21f('0x2')],'defaultValue':_0xa21f('0x7')},'type':{'type':Sequelize[_0xa21f('0x3')](_0xa21f('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0xa21f('0x8')},'reportId':{'type':Sequelize[_0xa21f('0x9')](0xb)[_0xa21f('0xa')]},'reportType':{'type':Sequelize[_0xa21f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index c8f1db9..4fd74ed 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 _0x4d87=['model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','AnalyticExtractedReport','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName'];(function(_0x14a3e9,_0x47c0d6){var _0x262274=function(_0x3b9437){while(--_0x3b9437){_0x14a3e9['push'](_0x14a3e9['shift']());}};_0x262274(++_0x47c0d6);}(_0x4d87,0x153));var _0x74d8=function(_0x25be38,_0x1d989a){_0x25be38=_0x25be38-0x0;var _0x2f546b=_0x4d87[_0x25be38];return _0x2f546b;};'use strict';var pdf=require(_0x74d8('0x0'));var emlformat=require(_0x74d8('0x1'));var rimraf=require(_0x74d8('0x2'));var zipdir=require(_0x74d8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74d8('0x4'));var moment=require(_0x74d8('0x5'));var BPromise=require(_0x74d8('0x6'));var Mustache=require(_0x74d8('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x74d8('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x74d8('0x9'));var squel=require('squel');var crypto=require(_0x74d8('0xa'));var jsforce=require(_0x74d8('0xb'));var deskjs=require(_0x74d8('0xc'));var toCsv=require(_0x74d8('0x8'));var querystring=require(_0x74d8('0xd'));var Papa=require(_0x74d8('0xe'));var Redis=require('ioredis');var authService=require(_0x74d8('0xf'));var qs=require(_0x74d8('0x10'));var as=require(_0x74d8('0x11'));var hardwareService=require(_0x74d8('0x12'));var logger=require(_0x74d8('0x13'))(_0x74d8('0x14'));var utils=require(_0x74d8('0x15'));var config=require(_0x74d8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x74d8('0x17'))['db'];function respondWithStatusCode(_0x5687c4,_0x47bbf3){_0x47bbf3=_0x47bbf3||0xcc;return function(_0x515c7b){if(_0x515c7b){return _0x5687c4[_0x74d8('0x18')](_0x47bbf3);}return _0x5687c4[_0x74d8('0x19')](_0x47bbf3)[_0x74d8('0x1a')]();};}function respondWithResult(_0x401c9c,_0x14ee54){_0x14ee54=_0x14ee54||0xc8;return function(_0x1f2e67){if(_0x1f2e67){return _0x401c9c['status'](_0x14ee54)['json'](_0x1f2e67);}};}function respondWithFilteredResult(_0xb1ce3,_0x53e57e){return function(_0x463228){if(_0x463228){var _0x46dd1a=_0x463228[_0x74d8('0x1b')],_0x3247fe=_0x53e57e[_0x74d8('0x1c')],_0x19cfa0=_0x53e57e[_0x74d8('0x1c')]+_0x53e57e[_0x74d8('0x1d')],_0x18b02a;if(_0x19cfa0>=_0x46dd1a){_0x19cfa0=_0x46dd1a;_0x18b02a=0xc8;}else{_0x18b02a=0xce;}_0xb1ce3[_0x74d8('0x19')](_0x18b02a);return _0xb1ce3[_0x74d8('0x1e')](_0x74d8('0x1f'),_0x3247fe+'-'+_0x19cfa0+'/'+_0x46dd1a)[_0x74d8('0x20')](_0x463228);}return null;};}function patchUpdates(_0x37b3d0){return function(_0x45e160){try{jsonpatch[_0x74d8('0x21')](_0x45e160,_0x37b3d0,!![]);}catch(_0x468f26){return BPromise[_0x74d8('0x22')](_0x468f26);}return _0x45e160['save']();};}function saveUpdates(_0x736335,_0x32891e){return function(_0x3ae527){if(_0x3ae527){return _0x3ae527['update'](_0x736335)[_0x74d8('0x23')](function(_0x2357ec){return _0x2357ec;});}return null;};}function removeEntity(_0x33b5f2,_0x7e6f71){return function(_0x5ea759){if(_0x5ea759){return _0x5ea759[_0x74d8('0x24')]()[_0x74d8('0x23')](function(){var _0x5abfc4=_0x5ea759['get']({'plain':!![]});var _0x13cfc9='ExtractedReports';return db[_0x74d8('0x25')]['destroy']({'where':{'type':_0x13cfc9,'resourceId':_0x5abfc4['id']}})[_0x74d8('0x23')](function(){return _0x5ea759;});})['then'](function(){_0x33b5f2[_0x74d8('0x19')](0xcc)[_0x74d8('0x1a')]();});}};}function handleEntityNotFound(_0x4fed5d,_0x1266e6){return function(_0x413d59){if(!_0x413d59){_0x4fed5d[_0x74d8('0x18')](0x194);}return _0x413d59;};}function handleError(_0x1eca83,_0x371468){_0x371468=_0x371468||0x1f4;return function(_0x1c5059){logger[_0x74d8('0x26')](_0x1c5059[_0x74d8('0x27')]);if(_0x1c5059[_0x74d8('0x28')]){delete _0x1c5059[_0x74d8('0x28')];}_0x1eca83[_0x74d8('0x19')](_0x371468)[_0x74d8('0x29')](_0x1c5059);};}exports[_0x74d8('0x2a')]=function(_0x39d9e7,_0x1e0ab4){var _0x4f0934={},_0x33e358={},_0x4f2891={'count':0x0,'rows':[]};var _0x16fceb=_['map'](db['AnalyticExtractedReport'][_0x74d8('0x2b')],function(_0x3a0c05){return{'name':_0x3a0c05[_0x74d8('0x2c')],'type':_0x3a0c05['type']['key']};});_0x33e358[_0x74d8('0x2d')]=_[_0x74d8('0x2e')](_0x16fceb,_0x74d8('0x28'));_0x33e358[_0x74d8('0x2f')]=_[_0x74d8('0x30')](_0x39d9e7[_0x74d8('0x2f')]);_0x33e358['filters']=_[_0x74d8('0x31')](_0x33e358[_0x74d8('0x2d')],_0x33e358[_0x74d8('0x2f')]);_0x4f0934[_0x74d8('0x32')]=_['intersection'](_0x33e358[_0x74d8('0x2d')],qs[_0x74d8('0x33')](_0x39d9e7['query']['fields']));_0x4f0934[_0x74d8('0x32')]=_0x4f0934[_0x74d8('0x32')][_0x74d8('0x34')]?_0x4f0934[_0x74d8('0x32')]:_0x33e358['model'];if(!_0x39d9e7[_0x74d8('0x2f')]['hasOwnProperty'](_0x74d8('0x35'))){_0x4f0934[_0x74d8('0x1d')]=qs['limit'](_0x39d9e7['query'][_0x74d8('0x1d')]);_0x4f0934[_0x74d8('0x1c')]=qs[_0x74d8('0x1c')](_0x39d9e7[_0x74d8('0x2f')][_0x74d8('0x1c')]);}_0x4f0934[_0x74d8('0x36')]=qs[_0x74d8('0x37')](_0x39d9e7[_0x74d8('0x2f')][_0x74d8('0x37')]);_0x4f0934[_0x74d8('0x38')]=qs[_0x74d8('0x39')](_[_0x74d8('0x3a')](_0x39d9e7[_0x74d8('0x2f')],_0x33e358[_0x74d8('0x39')]),_0x16fceb);if(_0x39d9e7['query'][_0x74d8('0x3b')]){_0x4f0934[_0x74d8('0x38')]=_[_0x74d8('0x3c')](_0x4f0934['where'],{'$or':_['map'](_0x16fceb,function(_0x4759a5){if(_0x4759a5[_0x74d8('0x3d')]!==_0x74d8('0x3e')){var _0x3cf601={};_0x3cf601[_0x4759a5[_0x74d8('0x28')]]={'$like':'%'+_0x39d9e7['query'][_0x74d8('0x3b')]+'%'};return _0x3cf601;}})});}_0x4f0934=_[_0x74d8('0x3c')]({},_0x4f0934,_0x39d9e7[_0x74d8('0x3f')]);var _0x5dbcb8={'where':_0x4f0934[_0x74d8('0x38')]};return db['AnalyticExtractedReport'][_0x74d8('0x1b')](_0x5dbcb8)[_0x74d8('0x23')](function(_0x26ed75){_0x4f2891[_0x74d8('0x1b')]=_0x26ed75;if(_0x39d9e7[_0x74d8('0x2f')][_0x74d8('0x40')]){_0x4f0934[_0x74d8('0x41')]=[{'all':!![]}];}return db[_0x74d8('0x42')]['findAll'](_0x4f0934);})[_0x74d8('0x23')](function(_0x549350){_0x4f2891[_0x74d8('0x43')]=_0x549350;return _0x4f2891;})[_0x74d8('0x23')](respondWithFilteredResult(_0x1e0ab4,_0x4f0934))[_0x74d8('0x44')](handleError(_0x1e0ab4,null));};exports[_0x74d8('0x45')]=function(_0x58187e,_0x18f1b4){var _0x5bd56e={'raw':!![],'where':{'id':_0x58187e[_0x74d8('0x46')]['id']}},_0xed43cb={};_0xed43cb['model']=_['keys'](db[_0x74d8('0x42')][_0x74d8('0x2b')]);_0xed43cb[_0x74d8('0x2f')]=_[_0x74d8('0x30')](_0x58187e[_0x74d8('0x2f')]);_0xed43cb[_0x74d8('0x39')]=_['intersection'](_0xed43cb[_0x74d8('0x2d')],_0xed43cb['query']);_0x5bd56e[_0x74d8('0x32')]=_[_0x74d8('0x31')](_0xed43cb['model'],qs[_0x74d8('0x33')](_0x58187e[_0x74d8('0x2f')][_0x74d8('0x33')]));_0x5bd56e['attributes']=_0x5bd56e[_0x74d8('0x32')][_0x74d8('0x34')]?_0x5bd56e[_0x74d8('0x32')]:_0xed43cb[_0x74d8('0x2d')];if(_0x58187e['query'][_0x74d8('0x40')]){_0x5bd56e[_0x74d8('0x41')]=[{'all':!![]}];}_0x5bd56e=_['merge']({},_0x5bd56e,_0x58187e[_0x74d8('0x3f')]);return db[_0x74d8('0x42')][_0x74d8('0x47')](_0x5bd56e)[_0x74d8('0x23')](handleEntityNotFound(_0x18f1b4,null))[_0x74d8('0x23')](respondWithResult(_0x18f1b4,null))[_0x74d8('0x44')](handleError(_0x18f1b4,null));};exports[_0x74d8('0x48')]=function(_0x56b250,_0x3b0375){return db['AnalyticExtractedReport'][_0x74d8('0x48')](_0x56b250['body'],{})[_0x74d8('0x23')](function(_0x47f008){var _0x981a63=_0x56b250[_0x74d8('0x49')][_0x74d8('0x4a')]({'plain':!![]});if(!_0x981a63)throw new Error(_0x74d8('0x4b'));if(_0x981a63[_0x74d8('0x4c')]===_0x74d8('0x49')){var _0x40bfae=_0x47f008['get']({'plain':!![]});var _0xed6dcd=_0x74d8('0x4d');return db[_0x74d8('0x4e')][_0x74d8('0x47')]({'where':{'name':_0xed6dcd,'userProfileId':_0x981a63[_0x74d8('0x4f')]},'raw':!![]})[_0x74d8('0x23')](function(_0x5e6604){if(_0x5e6604&&_0x5e6604[_0x74d8('0x50')]===0x0){return db[_0x74d8('0x25')]['create']({'name':_0x40bfae[_0x74d8('0x28')],'resourceId':_0x40bfae['id'],'type':_0x5e6604['name'],'sectionId':_0x5e6604['id']},{})[_0x74d8('0x23')](function(){return _0x47f008;});}else{return _0x47f008;}})[_0x74d8('0x44')](function(_0x31a959){logger[_0x74d8('0x26')](_0x74d8('0x51'),_0x31a959);throw _0x31a959;});}return _0x47f008;})[_0x74d8('0x23')](respondWithResult(_0x3b0375,0xc9))[_0x74d8('0x44')](handleError(_0x3b0375,null));};exports['update']=function(_0x50319e,_0x3e3b62){if(_0x50319e['body']['id']){delete _0x50319e[_0x74d8('0x52')]['id'];}return db['AnalyticExtractedReport'][_0x74d8('0x47')]({'where':{'id':_0x50319e[_0x74d8('0x46')]['id']}})[_0x74d8('0x23')](handleEntityNotFound(_0x3e3b62,null))['then'](saveUpdates(_0x50319e['body'],null))['then'](respondWithResult(_0x3e3b62,null))[_0x74d8('0x44')](handleError(_0x3e3b62,null));};exports[_0x74d8('0x24')]=function(_0x1c8a97,_0x5d2b26){return db['AnalyticExtractedReport'][_0x74d8('0x47')]({'where':{'id':_0x1c8a97[_0x74d8('0x46')]['id']}})[_0x74d8('0x23')](handleEntityNotFound(_0x5d2b26,null))[_0x74d8('0x23')](removeEntity(_0x5d2b26,null))[_0x74d8('0x44')](handleError(_0x5d2b26,null));};exports[_0x74d8('0x53')]=function(_0x12addb,_0x48d7ff,_0x16ca6d){return db['AnalyticExtractedReport'][_0x74d8('0x47')]({'where':{'id':_0x12addb['params']['id']},'attributes':['name',_0x74d8('0x54'),_0x74d8('0x55'),_0x74d8('0x56')],'raw':!![]})[_0x74d8('0x23')](handleEntityNotFound(_0x48d7ff,null))[_0x74d8('0x23')](function(_0x38ca69){if(_0x38ca69){if(!fs[_0x74d8('0x57')](path[_0x74d8('0x58')](config[_0x74d8('0x59')],_0x74d8('0x5a'),_0x38ca69[_0x74d8('0x55')]))){throw new db[(_0x74d8('0x5b'))][(_0x74d8('0x5c'))](_0x74d8('0x5d'));}if(_0x12addb['query'][_0x74d8('0x5e')]){return _0x48d7ff[_0x74d8('0x18')](0xc8);}return _0x48d7ff[_0x74d8('0x53')](path[_0x74d8('0x58')](config[_0x74d8('0x59')],_0x74d8('0x5a'),_0x38ca69[_0x74d8('0x55')]),util['format']('%s.%s',_0x38ca69[_0x74d8('0x54')]||_0x38ca69[_0x74d8('0x28')],_0x38ca69[_0x74d8('0x56')][_0x74d8('0x5f')]()));}})[_0x74d8('0x44')](handleError(_0x48d7ff,null));}; \ No newline at end of file +var _0x7a73=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','create','body','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','join','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','server/files/reports','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model'];(function(_0x401f2e,_0x119d0d){var _0x4ef876=function(_0x5bb365){while(--_0x5bb365){_0x401f2e['push'](_0x401f2e['shift']());}};_0x4ef876(++_0x119d0d);}(_0x7a73,0x84));var _0x37a7=function(_0x41c81f,_0x543ea4){_0x41c81f=_0x41c81f-0x0;var _0x3327e3=_0x7a73[_0x41c81f];return _0x3327e3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x37a7('0x0'));var rimraf=require(_0x37a7('0x1'));var zipdir=require(_0x37a7('0x2'));var jsonpatch=require(_0x37a7('0x3'));var rp=require(_0x37a7('0x4'));var moment=require(_0x37a7('0x5'));var BPromise=require(_0x37a7('0x6'));var Mustache=require(_0x37a7('0x7'));var util=require(_0x37a7('0x8'));var path=require('path');var sox=require(_0x37a7('0x9'));var csv=require(_0x37a7('0xa'));var ejs=require(_0x37a7('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x37a7('0xc'));var crypto=require(_0x37a7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x37a7('0xe'));var toCsv=require(_0x37a7('0xa'));var querystring=require(_0x37a7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x37a7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37a7('0x11'));var logger=require(_0x37a7('0x12'))('api');var utils=require(_0x37a7('0x13'));var config=require(_0x37a7('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ea381,_0x48f2c0){_0x48f2c0=_0x48f2c0||0xcc;return function(_0x32601f){if(_0x32601f){return _0x1ea381[_0x37a7('0x15')](_0x48f2c0);}return _0x1ea381['status'](_0x48f2c0)[_0x37a7('0x16')]();};}function respondWithResult(_0x1158bb,_0x14e49f){_0x14e49f=_0x14e49f||0xc8;return function(_0xc6eb2d){if(_0xc6eb2d){return _0x1158bb[_0x37a7('0x17')](_0x14e49f)[_0x37a7('0x18')](_0xc6eb2d);}};}function respondWithFilteredResult(_0x5d432c,_0x4c5ef6){return function(_0x2130cc){if(_0x2130cc){var _0x577b0d=_0x2130cc[_0x37a7('0x19')],_0x53790e=_0x4c5ef6[_0x37a7('0x1a')],_0x2ccec2=_0x4c5ef6[_0x37a7('0x1a')]+_0x4c5ef6[_0x37a7('0x1b')],_0x2aad82;if(_0x2ccec2>=_0x577b0d){_0x2ccec2=_0x577b0d;_0x2aad82=0xc8;}else{_0x2aad82=0xce;}_0x5d432c[_0x37a7('0x17')](_0x2aad82);return _0x5d432c[_0x37a7('0x1c')]('Content-Range',_0x53790e+'-'+_0x2ccec2+'/'+_0x577b0d)[_0x37a7('0x18')](_0x2130cc);}return null;};}function patchUpdates(_0xb456ae){return function(_0x532e41){try{jsonpatch[_0x37a7('0x1d')](_0x532e41,_0xb456ae,!![]);}catch(_0x246a6d){return BPromise[_0x37a7('0x1e')](_0x246a6d);}return _0x532e41[_0x37a7('0x1f')]();};}function saveUpdates(_0x50fbbb,_0x253a81){return function(_0x19435a){if(_0x19435a){return _0x19435a[_0x37a7('0x20')](_0x50fbbb)[_0x37a7('0x21')](function(_0x35ca7b){return _0x35ca7b;});}return null;};}function removeEntity(_0x1ad917,_0x567760){return function(_0x1ecb4){if(_0x1ecb4){return _0x1ecb4[_0x37a7('0x22')]()[_0x37a7('0x21')](function(){var _0x2be367=_0x1ecb4[_0x37a7('0x23')]({'plain':!![]});var _0x26d017=_0x37a7('0x24');return db[_0x37a7('0x25')][_0x37a7('0x22')]({'where':{'type':_0x26d017,'resourceId':_0x2be367['id']}})[_0x37a7('0x21')](function(){return _0x1ecb4;});})[_0x37a7('0x21')](function(){_0x1ad917[_0x37a7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x281e7d,_0x22b75c){return function(_0x4ded7b){if(!_0x4ded7b){_0x281e7d[_0x37a7('0x15')](0x194);}return _0x4ded7b;};}function handleError(_0x3b4bcc,_0x445950){_0x445950=_0x445950||0x1f4;return function(_0x4b795b){logger[_0x37a7('0x26')](_0x4b795b[_0x37a7('0x27')]);if(_0x4b795b[_0x37a7('0x28')]){delete _0x4b795b['name'];}_0x3b4bcc[_0x37a7('0x17')](_0x445950)[_0x37a7('0x29')](_0x4b795b);};}exports['index']=function(_0x18c235,_0x202499){var _0x4f970b={},_0x2fa0f0={},_0x5cb78f={'count':0x0,'rows':[]};var _0x55cd19=_[_0x37a7('0x2a')](db[_0x37a7('0x2b')][_0x37a7('0x2c')],function(_0x30b843){return{'name':_0x30b843[_0x37a7('0x2d')],'type':_0x30b843['type'][_0x37a7('0x2e')]};});_0x2fa0f0['model']=_[_0x37a7('0x2a')](_0x55cd19,'name');_0x2fa0f0[_0x37a7('0x2f')]=_[_0x37a7('0x30')](_0x18c235[_0x37a7('0x2f')]);_0x2fa0f0[_0x37a7('0x31')]=_[_0x37a7('0x32')](_0x2fa0f0[_0x37a7('0x33')],_0x2fa0f0['query']);_0x4f970b[_0x37a7('0x34')]=_[_0x37a7('0x32')](_0x2fa0f0[_0x37a7('0x33')],qs[_0x37a7('0x35')](_0x18c235[_0x37a7('0x2f')]['fields']));_0x4f970b[_0x37a7('0x34')]=_0x4f970b[_0x37a7('0x34')][_0x37a7('0x36')]?_0x4f970b[_0x37a7('0x34')]:_0x2fa0f0[_0x37a7('0x33')];if(!_0x18c235[_0x37a7('0x2f')][_0x37a7('0x37')](_0x37a7('0x38'))){_0x4f970b[_0x37a7('0x1b')]=qs['limit'](_0x18c235[_0x37a7('0x2f')][_0x37a7('0x1b')]);_0x4f970b['offset']=qs['offset'](_0x18c235[_0x37a7('0x2f')][_0x37a7('0x1a')]);}_0x4f970b[_0x37a7('0x39')]=qs[_0x37a7('0x3a')](_0x18c235[_0x37a7('0x2f')][_0x37a7('0x3a')]);_0x4f970b[_0x37a7('0x3b')]=qs[_0x37a7('0x31')](_[_0x37a7('0x3c')](_0x18c235[_0x37a7('0x2f')],_0x2fa0f0['filters']),_0x55cd19);if(_0x18c235[_0x37a7('0x2f')]['filter']){_0x4f970b[_0x37a7('0x3b')]=_[_0x37a7('0x3d')](_0x4f970b['where'],{'$or':_[_0x37a7('0x2a')](_0x55cd19,function(_0x549148){if(_0x549148[_0x37a7('0x3e')]!==_0x37a7('0x3f')){var _0x457bd1={};_0x457bd1[_0x549148[_0x37a7('0x28')]]={'$like':'%'+_0x18c235[_0x37a7('0x2f')][_0x37a7('0x40')]+'%'};return _0x457bd1;}})});}_0x4f970b=_[_0x37a7('0x3d')]({},_0x4f970b,_0x18c235[_0x37a7('0x41')]);var _0x41798f={'where':_0x4f970b[_0x37a7('0x3b')]};return db[_0x37a7('0x2b')][_0x37a7('0x19')](_0x41798f)[_0x37a7('0x21')](function(_0x3ab9d9){_0x5cb78f['count']=_0x3ab9d9;if(_0x18c235['query'][_0x37a7('0x42')]){_0x4f970b['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x37a7('0x43')](_0x4f970b);})[_0x37a7('0x21')](function(_0x54ca73){_0x5cb78f[_0x37a7('0x44')]=_0x54ca73;return _0x5cb78f;})[_0x37a7('0x21')](respondWithFilteredResult(_0x202499,_0x4f970b))[_0x37a7('0x45')](handleError(_0x202499,null));};exports['show']=function(_0xf9b495,_0x3f1d0b){var _0x2f1de8={'raw':!![],'where':{'id':_0xf9b495[_0x37a7('0x46')]['id']}},_0x5998b9={};_0x5998b9[_0x37a7('0x33')]=_[_0x37a7('0x30')](db[_0x37a7('0x2b')][_0x37a7('0x2c')]);_0x5998b9[_0x37a7('0x2f')]=_[_0x37a7('0x30')](_0xf9b495['query']);_0x5998b9[_0x37a7('0x31')]=_[_0x37a7('0x32')](_0x5998b9['model'],_0x5998b9[_0x37a7('0x2f')]);_0x2f1de8['attributes']=_[_0x37a7('0x32')](_0x5998b9[_0x37a7('0x33')],qs[_0x37a7('0x35')](_0xf9b495[_0x37a7('0x2f')]['fields']));_0x2f1de8['attributes']=_0x2f1de8[_0x37a7('0x34')][_0x37a7('0x36')]?_0x2f1de8[_0x37a7('0x34')]:_0x5998b9['model'];if(_0xf9b495[_0x37a7('0x2f')][_0x37a7('0x42')]){_0x2f1de8[_0x37a7('0x47')]=[{'all':!![]}];}_0x2f1de8=_[_0x37a7('0x3d')]({},_0x2f1de8,_0xf9b495[_0x37a7('0x41')]);return db[_0x37a7('0x2b')]['find'](_0x2f1de8)[_0x37a7('0x21')](handleEntityNotFound(_0x3f1d0b,null))[_0x37a7('0x21')](respondWithResult(_0x3f1d0b,null))[_0x37a7('0x45')](handleError(_0x3f1d0b,null));};exports[_0x37a7('0x48')]=function(_0x2e10ae,_0x43c787){return db[_0x37a7('0x2b')][_0x37a7('0x48')](_0x2e10ae[_0x37a7('0x49')],{})[_0x37a7('0x21')](function(_0x511720){var _0x3de251=_0x2e10ae[_0x37a7('0x4a')][_0x37a7('0x23')]({'plain':!![]});if(!_0x3de251)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3de251['role']===_0x37a7('0x4a')){var _0x89b0f3=_0x511720[_0x37a7('0x23')]({'plain':!![]});var _0x5e17d6=_0x37a7('0x24');return db[_0x37a7('0x4b')][_0x37a7('0x4c')]({'where':{'name':_0x5e17d6,'userProfileId':_0x3de251['userProfileId']},'raw':!![]})[_0x37a7('0x21')](function(_0x5cdb5a){if(_0x5cdb5a&&_0x5cdb5a['autoAssociation']===0x0){return db['UserProfileResource'][_0x37a7('0x48')]({'name':_0x89b0f3[_0x37a7('0x28')],'resourceId':_0x89b0f3['id'],'type':_0x5cdb5a[_0x37a7('0x28')],'sectionId':_0x5cdb5a['id']},{})[_0x37a7('0x21')](function(){return _0x511720;});}else{return _0x511720;}})[_0x37a7('0x45')](function(_0x3f625b){logger[_0x37a7('0x26')](_0x37a7('0x4d'),_0x3f625b);throw _0x3f625b;});}return _0x511720;})[_0x37a7('0x21')](respondWithResult(_0x43c787,0xc9))['catch'](handleError(_0x43c787,null));};exports[_0x37a7('0x20')]=function(_0x38d048,_0x580990){if(_0x38d048[_0x37a7('0x49')]['id']){delete _0x38d048['body']['id'];}return db[_0x37a7('0x2b')]['find']({'where':{'id':_0x38d048[_0x37a7('0x46')]['id']}})['then'](handleEntityNotFound(_0x580990,null))[_0x37a7('0x21')](saveUpdates(_0x38d048[_0x37a7('0x49')],null))[_0x37a7('0x21')](respondWithResult(_0x580990,null))[_0x37a7('0x45')](handleError(_0x580990,null));};exports[_0x37a7('0x22')]=function(_0x4e1f9a,_0x10a05a){return db[_0x37a7('0x2b')][_0x37a7('0x4c')]({'where':{'id':_0x4e1f9a[_0x37a7('0x46')]['id']}})[_0x37a7('0x21')](handleEntityNotFound(_0x10a05a,null))[_0x37a7('0x21')](removeEntity(_0x10a05a,null))[_0x37a7('0x45')](handleError(_0x10a05a,null));};exports[_0x37a7('0x4e')]=function(_0x35cc61,_0x1db761,_0x4ed252){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x35cc61['params']['id']},'attributes':[_0x37a7('0x28'),_0x37a7('0x4f'),'savename',_0x37a7('0x50')],'raw':!![]})[_0x37a7('0x21')](handleEntityNotFound(_0x1db761,null))[_0x37a7('0x21')](function(_0x476325){if(_0x476325){if(!fs[_0x37a7('0x51')](path[_0x37a7('0x52')](config['root'],'server/files/reports',_0x476325[_0x37a7('0x53')]))){throw new db[(_0x37a7('0x54'))][(_0x37a7('0x55'))](_0x37a7('0x56'));}if(_0x35cc61[_0x37a7('0x2f')][_0x37a7('0x57')]){return _0x1db761[_0x37a7('0x15')](0xc8);}return _0x1db761[_0x37a7('0x4e')](path[_0x37a7('0x52')](config[_0x37a7('0x58')],_0x37a7('0x59'),_0x476325[_0x37a7('0x53')]),util[_0x37a7('0x5a')](_0x37a7('0x5b'),_0x476325[_0x37a7('0x4f')]||_0x476325[_0x37a7('0x28')],_0x476325[_0x37a7('0x50')]['toLowerCase']()));}})['catch'](handleError(_0x1db761,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index b5e4895..0b17c53 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 _0x4e9d=['api','moment','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash'];(function(_0x27d9ee,_0x4ead1d){var _0x4ef0d6=function(_0x3bd5a2){while(--_0x3bd5a2){_0x27d9ee['push'](_0x27d9ee['shift']());}};_0x4ef0d6(++_0x4ead1d);}(_0x4e9d,0x171));var _0xd4e9=function(_0x248c51,_0xdf9962){_0x248c51=_0x248c51-0x0;var _0x28c4ce=_0x4e9d[_0x248c51];return _0x28c4ce;};'use strict';var _=require(_0xd4e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd4e9('0x1'));var moment=require(_0xd4e9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4e9('0x3'));var rimraf=require(_0xd4e9('0x4'));var config=require(_0xd4e9('0x5'));var attributes=require(_0xd4e9('0x6'));module[_0xd4e9('0x7')]=function(_0x5ed83d,_0x15bed1){return _0x5ed83d[_0xd4e9('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0xd4e9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe289=['moment','bluebird','request-promise','path','./analyticExtractedReport.attributes','analytics_extracted_reports','util','../../config/logger','api'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xe289,0xde));var _0x9e28=function(_0x5d6814,_0x1dfdc5){_0x5d6814=_0x5d6814-0x0;var _0x271a00=_0xe289[_0x5d6814];return _0x271a00;};'use strict';var _=require('lodash');var util=require(_0x9e28('0x0'));var logger=require(_0x9e28('0x1'))(_0x9e28('0x2'));var moment=require(_0x9e28('0x3'));var BPromise=require(_0x9e28('0x4'));var rp=require(_0x9e28('0x5'));var fs=require('fs');var path=require(_0x9e28('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9e28('0x7'));module['exports']=function(_0x31978b,_0x5c97cd){return _0x31978b['define']('AnalyticExtractedReport',attributes,{'tableName':_0x9e28('0x8'),'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 4b207b7..296142c 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 _0x15a1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x18ddd8,_0x263229){var _0x72af0a=function(_0x58130d){while(--_0x58130d){_0x18ddd8['push'](_0x18ddd8['shift']());}};_0x72af0a(++_0x263229);}(_0x15a1,0x125));var _0x115a=function(_0x5c0927,_0x3de68){_0x5c0927=_0x5c0927-0x0;var _0x46ea03=_0x15a1[_0x5c0927];return _0x46ea03;};'use strict';var _=require(_0x115a('0x0'));var util=require(_0x115a('0x1'));var moment=require(_0x115a('0x2'));var BPromise=require(_0x115a('0x3'));var rs=require(_0x115a('0x4'));var fs=require('fs');var Redis=require(_0x115a('0x5'));var db=require(_0x115a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x115a('0x7'))(_0x115a('0x8'));var config=require(_0x115a('0x9'));var jayson=require(_0x115a('0xa'));var client=jayson[_0x115a('0xb')][_0x115a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57bc65,_0x45a587,_0xa32b96){return new BPromise(function(_0x30ac98,_0x4bbbd5){return client[_0x115a('0xd')](_0x57bc65,_0xa32b96)[_0x115a('0xe')](function(_0x487ebc){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x45a587,_0x115a('0xf'));logger[_0x115a('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x45a587,_0x115a('0xf'),JSON[_0x115a('0x11')](_0x487ebc));if(_0x487ebc[_0x115a('0x12')]){if(_0x487ebc[_0x115a('0x12')][_0x115a('0x13')]===0x1f4){logger['error'](_0x115a('0x14'),_0x45a587,_0x487ebc[_0x115a('0x12')]['message']);return _0x4bbbd5(_0x487ebc[_0x115a('0x12')][_0x115a('0x15')]);}logger[_0x115a('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x45a587,_0x487ebc[_0x115a('0x12')][_0x115a('0x15')]);return _0x30ac98(_0x487ebc[_0x115a('0x12')][_0x115a('0x15')]);}else{logger[_0x115a('0x16')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x45a587,_0x115a('0xf'));_0x30ac98(_0x487ebc[_0x115a('0x17')][_0x115a('0x15')]);}})[_0x115a('0x18')](function(_0x5586f9){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x45a587,_0x5586f9);_0x4bbbd5(_0x5586f9);});});} \ No newline at end of file +var _0x7e7f=['then','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2ccd0a,_0x162350){var _0x247b45=function(_0x2c220d){while(--_0x2c220d){_0x2ccd0a['push'](_0x2ccd0a['shift']());}};_0x247b45(++_0x162350);}(_0x7e7f,0x129));var _0xf7e7=function(_0x24f487,_0x53e63d){_0x24f487=_0x24f487-0x0;var _0x3a4aec=_0x7e7f[_0x24f487];return _0x3a4aec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf7e7('0x0'));var BPromise=require(_0xf7e7('0x1'));var rs=require(_0xf7e7('0x2'));var fs=require('fs');var Redis=require(_0xf7e7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf7e7('0x4'))(_0xf7e7('0x5'));var config=require('../../config/environment');var jayson=require(_0xf7e7('0x6'));var client=jayson[_0xf7e7('0x7')][_0xf7e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d0a76,_0x3f73d4,_0x3a9386){return new BPromise(function(_0x4e21a2,_0x1e931f){return client['request'](_0x5d0a76,_0x3a9386)[_0xf7e7('0x9')](function(_0x12d273){logger['info'](_0xf7e7('0xa'),_0x3f73d4,'request\x20sent');logger['debug'](_0xf7e7('0xb'),_0x3f73d4,'request\x20sent',JSON['stringify'](_0x12d273));if(_0x12d273[_0xf7e7('0xc')]){if(_0x12d273['error'][_0xf7e7('0xd')]===0x1f4){logger[_0xf7e7('0xc')](_0xf7e7('0xa'),_0x3f73d4,_0x12d273[_0xf7e7('0xc')]['message']);return _0x1e931f(_0x12d273[_0xf7e7('0xc')][_0xf7e7('0xe')]);}logger[_0xf7e7('0xc')](_0xf7e7('0xa'),_0x3f73d4,_0x12d273[_0xf7e7('0xc')][_0xf7e7('0xe')]);return _0x4e21a2(_0x12d273[_0xf7e7('0xc')][_0xf7e7('0xe')]);}else{logger['info'](_0xf7e7('0xa'),_0x3f73d4,'request\x20sent');_0x4e21a2(_0x12d273[_0xf7e7('0xf')][_0xf7e7('0xe')]);}})[_0xf7e7('0x10')](function(_0x3e7730){logger[_0xf7e7('0xc')](_0xf7e7('0xa'),_0x3f73d4,_0x3e7730);_0x1e931f(_0x3e7730);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 09d1b8c..1a23535 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 _0x484a=['/:id','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/download','download','create','put','delete'];(function(_0x3e31b2,_0x2e95b3){var _0x1f4574=function(_0x210699){while(--_0x210699){_0x3e31b2['push'](_0x3e31b2['shift']());}};_0x1f4574(++_0x2e95b3);}(_0x484a,0x191));var _0xa484=function(_0x10dcf0,_0x2d67a8){_0x10dcf0=_0x10dcf0-0x0;var _0x128c8a=_0x484a[_0x10dcf0];return _0x128c8a;};'use strict';var multer=require(_0xa484('0x0'));var util=require(_0xa484('0x1'));var path=require('path');var timeout=require(_0xa484('0x2'));var express=require('express');var router=express[_0xa484('0x3')]();var auth=require(_0xa484('0x4'));var interaction=require(_0xa484('0x5'));var config=require(_0xa484('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0xa484('0x7')]('/',auth[_0xa484('0x8')](),controller[_0xa484('0x9')]);router[_0xa484('0x7')]('/:id',auth[_0xa484('0x8')](),controller['show']);router[_0xa484('0x7')](_0xa484('0xa'),auth[_0xa484('0x8')](),controller[_0xa484('0xb')]);router['post']('/',auth[_0xa484('0x8')](),controller[_0xa484('0xc')]);router[_0xa484('0xd')]('/:id',auth[_0xa484('0x8')](),controller['update']);router[_0xa484('0xe')](_0xa484('0xf'),auth[_0xa484('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xddbb=['show','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','./analyticExtractedReport.controller','get','index','isAuthenticated'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xddbb,0xbf));var _0xbddb=function(_0x1f0c9d,_0x1e2ba2){_0x1f0c9d=_0x1f0c9d-0x0;var _0x55a7fd=_0xddbb[_0x1f0c9d];return _0x55a7fd;};'use strict';var multer=require(_0xbddb('0x0'));var util=require(_0xbddb('0x1'));var path=require('path');var timeout=require(_0xbddb('0x2'));var express=require(_0xbddb('0x3'));var router=express[_0xbddb('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbddb('0x5'));router[_0xbddb('0x6')]('/',auth['isAuthenticated'](),controller[_0xbddb('0x7')]);router[_0xbddb('0x6')]('/:id',auth[_0xbddb('0x8')](),controller[_0xbddb('0x9')]);router['get'](_0xbddb('0xa'),auth['isAuthenticated'](),controller[_0xbddb('0xb')]);router[_0xbddb('0xc')]('/',auth[_0xbddb('0x8')](),controller[_0xbddb('0xd')]);router[_0xbddb('0xe')](_0xbddb('0xf'),auth[_0xbddb('0x8')](),controller[_0xbddb('0x10')]);router[_0xbddb('0x11')](_0xbddb('0xf'),auth[_0xbddb('0x8')](),controller[_0xbddb('0x12')]);module[_0xbddb('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index c01e28a..15f2c97 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 _0x7217=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x61c374,_0xc9d5e4){var _0x3a2120=function(_0x955f6a){while(--_0x955f6a){_0x61c374['push'](_0x61c374['shift']());}};_0x3a2120(++_0xc9d5e4);}(_0x7217,0x19e));var _0x7721=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7217[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'field':{'type':Sequelize[_0x7721('0x1')]},'alias':{'type':Sequelize[_0x7721('0x2')]},'function':{'type':Sequelize[_0x7721('0x2')]},'format':{'type':Sequelize[_0x7721('0x2')]},'groupBy':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x5aaabb,_0x2f2fe3){var _0x2ce0c5=function(_0x503bc9){while(--_0x503bc9){_0x5aaabb['push'](_0x5aaabb['shift']());}};_0x2ce0c5(++_0x2f2fe3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc4aa[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 3c58529..5390244 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 _0x001b=['limit','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','include','catch','create','body','bulkCreate','find','bulkDestroy','addFields','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x001b,0x11c));var _0xb001=function(_0x574d9c,_0x3c49fe){_0x574d9c=_0x574d9c-0x0;var _0x2629ba=_0x001b[_0x574d9c];return _0x2629ba;};'use strict';var pdf=require(_0xb001('0x0'));var emlformat=require(_0xb001('0x1'));var rimraf=require(_0xb001('0x2'));var zipdir=require(_0xb001('0x3'));var jsonpatch=require(_0xb001('0x4'));var rp=require(_0xb001('0x5'));var moment=require(_0xb001('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb001('0x7'));var util=require('util');var path=require(_0xb001('0x8'));var sox=require(_0xb001('0x9'));var csv=require(_0xb001('0xa'));var ejs=require(_0xb001('0xb'));var fs=require('fs');var _=require(_0xb001('0xc'));var squel=require('squel');var crypto=require(_0xb001('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb001('0xa'));var querystring=require('querystring');var Papa=require(_0xb001('0xe'));var Redis=require(_0xb001('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb001('0x10'));var as=require(_0xb001('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb001('0x12'))(_0xb001('0x13'));var utils=require(_0xb001('0x14'));var config=require(_0xb001('0x15'));var licenseUtil=require(_0xb001('0x16'));var db=require(_0xb001('0x17'))['db'];function respondWithStatusCode(_0x2c1320,_0x6de31d){_0x6de31d=_0x6de31d||0xcc;return function(_0x890452){if(_0x890452){return _0x2c1320[_0xb001('0x18')](_0x6de31d);}return _0x2c1320[_0xb001('0x19')](_0x6de31d)['end']();};}function respondWithResult(_0x1bd63b,_0x231c8d){_0x231c8d=_0x231c8d||0xc8;return function(_0x54ba1c){if(_0x54ba1c){return _0x1bd63b[_0xb001('0x19')](_0x231c8d)['json'](_0x54ba1c);}};}function respondWithFilteredResult(_0xd69892,_0x325d77){return function(_0x52ea30){if(_0x52ea30){var _0x536f0a=_0x52ea30[_0xb001('0x1a')],_0x49fc36=_0x325d77[_0xb001('0x1b')],_0x49155b=_0x325d77[_0xb001('0x1b')]+_0x325d77[_0xb001('0x1c')],_0x280caf;if(_0x49155b>=_0x536f0a){_0x49155b=_0x536f0a;_0x280caf=0xc8;}else{_0x280caf=0xce;}_0xd69892['status'](_0x280caf);return _0xd69892[_0xb001('0x1d')](_0xb001('0x1e'),_0x49fc36+'-'+_0x49155b+'/'+_0x536f0a)['json'](_0x52ea30);}return null;};}function patchUpdates(_0xbd8ebb){return function(_0x52b54e){try{jsonpatch['apply'](_0x52b54e,_0xbd8ebb,!![]);}catch(_0x15988d){return BPromise[_0xb001('0x1f')](_0x15988d);}return _0x52b54e[_0xb001('0x20')]();};}function saveUpdates(_0x4fc519,_0x5049c9){return function(_0x5c5dc6){if(_0x5c5dc6){return _0x5c5dc6[_0xb001('0x21')](_0x4fc519)['then'](function(_0x160778){return _0x160778;});}return null;};}function removeEntity(_0x1cb902,_0x1da8e6){return function(_0x2cd349){if(_0x2cd349){return _0x2cd349[_0xb001('0x22')]()[_0xb001('0x23')](function(){_0x1cb902[_0xb001('0x19')](0xcc)[_0xb001('0x24')]();});}};}function handleEntityNotFound(_0x44ea88,_0x46f4ac){return function(_0x3f28c5){if(!_0x3f28c5){_0x44ea88['sendStatus'](0x194);}return _0x3f28c5;};}function handleError(_0x3ebc1b,_0x29ba94){_0x29ba94=_0x29ba94||0x1f4;return function(_0xd8fec7){logger[_0xb001('0x25')](_0xd8fec7[_0xb001('0x26')]);if(_0xd8fec7[_0xb001('0x27')]){delete _0xd8fec7[_0xb001('0x27')];}_0x3ebc1b['status'](_0x29ba94)[_0xb001('0x28')](_0xd8fec7);};}exports[_0xb001('0x29')]=function(_0x1b815f,_0x3b7075){var _0x555c60={},_0x3aa33a={},_0x1c1d66={'count':0x0,'rows':[]};var _0xd0f29b=_[_0xb001('0x2a')](db[_0xb001('0x2b')]['rawAttributes'],function(_0xe51ae8){return{'name':_0xe51ae8[_0xb001('0x2c')],'type':_0xe51ae8['type'][_0xb001('0x2d')]};});_0x3aa33a[_0xb001('0x2e')]=_[_0xb001('0x2a')](_0xd0f29b,_0xb001('0x27'));_0x3aa33a['query']=_[_0xb001('0x2f')](_0x1b815f[_0xb001('0x30')]);_0x3aa33a[_0xb001('0x31')]=_[_0xb001('0x32')](_0x3aa33a['model'],_0x3aa33a[_0xb001('0x30')]);_0x555c60[_0xb001('0x33')]=_[_0xb001('0x32')](_0x3aa33a['model'],qs[_0xb001('0x34')](_0x1b815f[_0xb001('0x30')][_0xb001('0x34')]));_0x555c60['attributes']=_0x555c60['attributes'][_0xb001('0x35')]?_0x555c60[_0xb001('0x33')]:_0x3aa33a[_0xb001('0x2e')];if(!_0x1b815f['query'][_0xb001('0x36')](_0xb001('0x37'))){_0x555c60[_0xb001('0x1c')]=qs['limit'](_0x1b815f[_0xb001('0x30')][_0xb001('0x1c')]);_0x555c60['offset']=qs['offset'](_0x1b815f[_0xb001('0x30')][_0xb001('0x1b')]);}_0x555c60[_0xb001('0x38')]=qs[_0xb001('0x39')](_0x1b815f[_0xb001('0x30')][_0xb001('0x39')]);_0x555c60[_0xb001('0x3a')]=qs[_0xb001('0x31')](_[_0xb001('0x3b')](_0x1b815f[_0xb001('0x30')],_0x3aa33a[_0xb001('0x31')]),_0xd0f29b);if(_0x1b815f[_0xb001('0x30')][_0xb001('0x3c')]){_0x555c60[_0xb001('0x3a')]=_['merge'](_0x555c60[_0xb001('0x3a')],{'$or':_[_0xb001('0x2a')](_0xd0f29b,function(_0x4e012f){if(_0x4e012f[_0xb001('0x3d')]!==_0xb001('0x3e')){var _0x5eb7b8={};_0x5eb7b8[_0x4e012f[_0xb001('0x27')]]={'$like':'%'+_0x1b815f[_0xb001('0x30')][_0xb001('0x3c')]+'%'};return _0x5eb7b8;}})});}_0x555c60=_['merge']({},_0x555c60,_0x1b815f[_0xb001('0x3f')]);var _0x57a1d5={'where':_0x555c60[_0xb001('0x3a')]};return db[_0xb001('0x2b')][_0xb001('0x1a')](_0x57a1d5)['then'](function(_0x3d9374){_0x1c1d66[_0xb001('0x1a')]=_0x3d9374;if(_0x1b815f['query'][_0xb001('0x40')]){_0x555c60['include']=[{'all':!![]}];}return db[_0xb001('0x2b')][_0xb001('0x41')](_0x555c60);})[_0xb001('0x23')](function(_0x925465){_0x1c1d66['rows']=_0x925465;return _0x1c1d66;})[_0xb001('0x23')](respondWithFilteredResult(_0x3b7075,_0x555c60))['catch'](handleError(_0x3b7075,null));};exports[_0xb001('0x42')]=function(_0x35f171,_0x408f99){var _0x5022f0={'raw':![],'where':{'id':_0x35f171[_0xb001('0x43')]['id']}},_0x56dc29={};_0x56dc29[_0xb001('0x2e')]=_[_0xb001('0x2f')](db[_0xb001('0x2b')][_0xb001('0x44')]);_0x56dc29[_0xb001('0x30')]=_[_0xb001('0x2f')](_0x35f171['query']);_0x56dc29[_0xb001('0x31')]=_['intersection'](_0x56dc29[_0xb001('0x2e')],_0x56dc29['query']);_0x5022f0[_0xb001('0x33')]=_['intersection'](_0x56dc29[_0xb001('0x2e')],qs[_0xb001('0x34')](_0x35f171[_0xb001('0x30')][_0xb001('0x34')]));_0x5022f0[_0xb001('0x33')]=_0x5022f0[_0xb001('0x33')][_0xb001('0x35')]?_0x5022f0['attributes']:_0x56dc29[_0xb001('0x2e')];if(_0x35f171[_0xb001('0x30')]['includeAll']){_0x5022f0[_0xb001('0x45')]=[{'all':!![]}];}_0x5022f0=_['merge']({},_0x5022f0,_0x35f171['options']);return db[_0xb001('0x2b')]['find'](_0x5022f0)[_0xb001('0x23')](handleEntityNotFound(_0x408f99,null))[_0xb001('0x23')](respondWithResult(_0x408f99,null))[_0xb001('0x46')](handleError(_0x408f99,null));};exports[_0xb001('0x47')]=function(_0x41cf98,_0x5d522c){return db['AnalyticFieldReport']['create'](_0x41cf98[_0xb001('0x48')],{})['then'](respondWithResult(_0x5d522c,0xc9))[_0xb001('0x46')](handleError(_0x5d522c,null));};exports[_0xb001('0x49')]=function(_0x79fa5f,_0x448555){return db[_0xb001('0x2b')][_0xb001('0x49')](_0x79fa5f['body'],{'raw':![],'individualHooks':!![]})[_0xb001('0x23')](respondWithResult(_0x448555,0xc9))[_0xb001('0x46')](handleError(_0x448555,null));};exports[_0xb001('0x21')]=function(_0x288cd8,_0x305ad1){if(_0x288cd8[_0xb001('0x48')]['id']){delete _0x288cd8[_0xb001('0x48')]['id'];}return db[_0xb001('0x2b')][_0xb001('0x4a')]({'where':{'id':_0x288cd8[_0xb001('0x43')]['id']}})[_0xb001('0x23')](handleEntityNotFound(_0x305ad1,null))[_0xb001('0x23')](saveUpdates(_0x288cd8[_0xb001('0x48')],null))[_0xb001('0x23')](respondWithResult(_0x305ad1,null))[_0xb001('0x46')](handleError(_0x305ad1,null));};exports[_0xb001('0x22')]=function(_0x292c85,_0x2092ce){return db[_0xb001('0x2b')][_0xb001('0x4a')]({'where':{'id':_0x292c85[_0xb001('0x43')]['id']}})[_0xb001('0x23')](handleEntityNotFound(_0x2092ce,null))[_0xb001('0x23')](removeEntity(_0x2092ce,null))[_0xb001('0x46')](handleError(_0x2092ce,null));};exports[_0xb001('0x4b')]=function(_0x55eb1d,_0x33098e){return db[_0xb001('0x2b')][_0xb001('0x22')]({'where':{'id':_0x55eb1d['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x33098e,0xcc))[_0xb001('0x46')](handleError(_0x33098e,null));};exports[_0xb001('0x4c')]=function(_0x1b7e9d,_0x172894,_0x4ea3c9){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x1b7e9d[_0xb001('0x43')]['id']}})[_0xb001('0x23')](handleEntityNotFound(_0x172894,null))[_0xb001('0x23')](function(_0x26f166){if(_0x26f166){return db['sequelize']['transaction'](function(_0x3ad806){return db[_0xb001('0x2b')][_0xb001('0x22')]({'where':{'CustomReportId':_0x1b7e9d[_0xb001('0x43')]['id']},'transaction':_0x3ad806})['then'](function(_0x5c08bf){var _0x23ae5a=_[_0xb001('0x2a')](_0x1b7e9d['body'],function(_0x2377ba){delete _0x2377ba['id'];_0x2377ba[_0xb001('0x4d')]=_0x1b7e9d[_0xb001('0x43')]['id'];return _0x2377ba;});return db[_0xb001('0x2b')][_0xb001('0x49')](_0x23ae5a,{'transaction':_0x3ad806});});})[_0xb001('0x23')](function(){return db[_0xb001('0x2b')]['findAll']({'where':{'CustomReportId':_0x1b7e9d['params']['id']}});});}})[_0xb001('0x23')](respondWithResult(_0x172894,null))[_0xb001('0x46')](handleError(_0x172894,null));}; \ No newline at end of file +var _0x26e4=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','update','destroy','then','end','stack','name','send','index','map','AnalyticFieldReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','count','findAll','catch','show','params','rawAttributes','length','includeAll','include','find','create','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x91ff52,_0x2cde3c){var _0x37d193=function(_0x5cb450){while(--_0x5cb450){_0x91ff52['push'](_0x91ff52['shift']());}};_0x37d193(++_0x2cde3c);}(_0x26e4,0x1ee));var _0x426e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x26e4[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x426e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x426e('0x1'));var zipdir=require(_0x426e('0x2'));var jsonpatch=require(_0x426e('0x3'));var rp=require(_0x426e('0x4'));var moment=require(_0x426e('0x5'));var BPromise=require(_0x426e('0x6'));var Mustache=require(_0x426e('0x7'));var util=require(_0x426e('0x8'));var path=require(_0x426e('0x9'));var sox=require(_0x426e('0xa'));var csv=require(_0x426e('0xb'));var ejs=require(_0x426e('0xc'));var fs=require('fs');var _=require(_0x426e('0xd'));var squel=require(_0x426e('0xe'));var crypto=require(_0x426e('0xf'));var jsforce=require(_0x426e('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x426e('0x11'));var Redis=require(_0x426e('0x12'));var authService=require(_0x426e('0x13'));var qs=require(_0x426e('0x14'));var as=require(_0x426e('0x15'));var hardwareService=require(_0x426e('0x16'));var logger=require(_0x426e('0x17'))(_0x426e('0x18'));var utils=require(_0x426e('0x19'));var config=require(_0x426e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x426e('0x1b'))['db'];function respondWithStatusCode(_0x5bfccf,_0x3a32d0){_0x3a32d0=_0x3a32d0||0xcc;return function(_0x2c4845){if(_0x2c4845){return _0x5bfccf[_0x426e('0x1c')](_0x3a32d0);}return _0x5bfccf[_0x426e('0x1d')](_0x3a32d0)['end']();};}function respondWithResult(_0x499bb4,_0x5293a5){_0x5293a5=_0x5293a5||0xc8;return function(_0xde7647){if(_0xde7647){return _0x499bb4[_0x426e('0x1d')](_0x5293a5)[_0x426e('0x1e')](_0xde7647);}};}function respondWithFilteredResult(_0x18b0e3,_0x1975c2){return function(_0x16d844){if(_0x16d844){var _0x394881=_0x16d844['count'],_0x2b15f7=_0x1975c2[_0x426e('0x1f')],_0x3a2cf7=_0x1975c2[_0x426e('0x1f')]+_0x1975c2[_0x426e('0x20')],_0x280f41;if(_0x3a2cf7>=_0x394881){_0x3a2cf7=_0x394881;_0x280f41=0xc8;}else{_0x280f41=0xce;}_0x18b0e3['status'](_0x280f41);return _0x18b0e3[_0x426e('0x21')](_0x426e('0x22'),_0x2b15f7+'-'+_0x3a2cf7+'/'+_0x394881)[_0x426e('0x1e')](_0x16d844);}return null;};}function patchUpdates(_0x5b2506){return function(_0x15d372){try{jsonpatch[_0x426e('0x23')](_0x15d372,_0x5b2506,!![]);}catch(_0x43212f){return BPromise['reject'](_0x43212f);}return _0x15d372['save']();};}function saveUpdates(_0x2f4f05,_0x390ae3){return function(_0x5a3ff6){if(_0x5a3ff6){return _0x5a3ff6[_0x426e('0x24')](_0x2f4f05)['then'](function(_0x188b5c){return _0x188b5c;});}return null;};}function removeEntity(_0x42677d,_0x53dab5){return function(_0x2af2a2){if(_0x2af2a2){return _0x2af2a2[_0x426e('0x25')]()[_0x426e('0x26')](function(){_0x42677d['status'](0xcc)[_0x426e('0x27')]();});}};}function handleEntityNotFound(_0x2018ee,_0x32e82c){return function(_0x26ade4){if(!_0x26ade4){_0x2018ee[_0x426e('0x1c')](0x194);}return _0x26ade4;};}function handleError(_0x445cdc,_0xe00a2d){_0xe00a2d=_0xe00a2d||0x1f4;return function(_0x21b10b){logger['error'](_0x21b10b[_0x426e('0x28')]);if(_0x21b10b['name']){delete _0x21b10b[_0x426e('0x29')];}_0x445cdc[_0x426e('0x1d')](_0xe00a2d)[_0x426e('0x2a')](_0x21b10b);};}exports[_0x426e('0x2b')]=function(_0x129b3f,_0x2f0c1c){var _0x542034={},_0x12af6f={},_0x5d0c47={'count':0x0,'rows':[]};var _0x3982ea=_[_0x426e('0x2c')](db[_0x426e('0x2d')]['rawAttributes'],function(_0x1caaf0){return{'name':_0x1caaf0[_0x426e('0x2e')],'type':_0x1caaf0[_0x426e('0x2f')]['key']};});_0x12af6f[_0x426e('0x30')]=_['map'](_0x3982ea,_0x426e('0x29'));_0x12af6f[_0x426e('0x31')]=_[_0x426e('0x32')](_0x129b3f[_0x426e('0x31')]);_0x12af6f[_0x426e('0x33')]=_[_0x426e('0x34')](_0x12af6f['model'],_0x12af6f[_0x426e('0x31')]);_0x542034[_0x426e('0x35')]=_[_0x426e('0x34')](_0x12af6f[_0x426e('0x30')],qs[_0x426e('0x36')](_0x129b3f['query']['fields']));_0x542034[_0x426e('0x35')]=_0x542034['attributes']['length']?_0x542034[_0x426e('0x35')]:_0x12af6f[_0x426e('0x30')];if(!_0x129b3f[_0x426e('0x31')]['hasOwnProperty'](_0x426e('0x37'))){_0x542034[_0x426e('0x20')]=qs[_0x426e('0x20')](_0x129b3f['query'][_0x426e('0x20')]);_0x542034[_0x426e('0x1f')]=qs['offset'](_0x129b3f[_0x426e('0x31')][_0x426e('0x1f')]);}_0x542034[_0x426e('0x38')]=qs[_0x426e('0x39')](_0x129b3f[_0x426e('0x31')][_0x426e('0x39')]);_0x542034['where']=qs['filters'](_[_0x426e('0x3a')](_0x129b3f[_0x426e('0x31')],_0x12af6f[_0x426e('0x33')]),_0x3982ea);if(_0x129b3f[_0x426e('0x31')][_0x426e('0x3b')]){_0x542034[_0x426e('0x3c')]=_[_0x426e('0x3d')](_0x542034[_0x426e('0x3c')],{'$or':_[_0x426e('0x2c')](_0x3982ea,function(_0x448b9a){if(_0x448b9a[_0x426e('0x2f')]!=='VIRTUAL'){var _0xfc7e0d={};_0xfc7e0d[_0x448b9a[_0x426e('0x29')]]={'$like':'%'+_0x129b3f[_0x426e('0x31')][_0x426e('0x3b')]+'%'};return _0xfc7e0d;}})});}_0x542034=_[_0x426e('0x3d')]({},_0x542034,_0x129b3f[_0x426e('0x3e')]);var _0x479544={'where':_0x542034[_0x426e('0x3c')]};return db[_0x426e('0x2d')][_0x426e('0x3f')](_0x479544)[_0x426e('0x26')](function(_0x5028c8){_0x5d0c47['count']=_0x5028c8;if(_0x129b3f[_0x426e('0x31')]['includeAll']){_0x542034['include']=[{'all':!![]}];}return db[_0x426e('0x2d')][_0x426e('0x40')](_0x542034);})[_0x426e('0x26')](function(_0x169b97){_0x5d0c47['rows']=_0x169b97;return _0x5d0c47;})['then'](respondWithFilteredResult(_0x2f0c1c,_0x542034))[_0x426e('0x41')](handleError(_0x2f0c1c,null));};exports[_0x426e('0x42')]=function(_0x3b95e9,_0x1ee88d){var _0x1acd5f={'raw':![],'where':{'id':_0x3b95e9[_0x426e('0x43')]['id']}},_0x3329ef={};_0x3329ef[_0x426e('0x30')]=_['keys'](db[_0x426e('0x2d')][_0x426e('0x44')]);_0x3329ef[_0x426e('0x31')]=_['keys'](_0x3b95e9[_0x426e('0x31')]);_0x3329ef[_0x426e('0x33')]=_['intersection'](_0x3329ef[_0x426e('0x30')],_0x3329ef[_0x426e('0x31')]);_0x1acd5f[_0x426e('0x35')]=_[_0x426e('0x34')](_0x3329ef[_0x426e('0x30')],qs['fields'](_0x3b95e9['query'][_0x426e('0x36')]));_0x1acd5f['attributes']=_0x1acd5f[_0x426e('0x35')][_0x426e('0x45')]?_0x1acd5f[_0x426e('0x35')]:_0x3329ef[_0x426e('0x30')];if(_0x3b95e9[_0x426e('0x31')][_0x426e('0x46')]){_0x1acd5f[_0x426e('0x47')]=[{'all':!![]}];}_0x1acd5f=_[_0x426e('0x3d')]({},_0x1acd5f,_0x3b95e9[_0x426e('0x3e')]);return db[_0x426e('0x2d')][_0x426e('0x48')](_0x1acd5f)[_0x426e('0x26')](handleEntityNotFound(_0x1ee88d,null))[_0x426e('0x26')](respondWithResult(_0x1ee88d,null))[_0x426e('0x41')](handleError(_0x1ee88d,null));};exports[_0x426e('0x49')]=function(_0x23d5cc,_0x450d63){return db[_0x426e('0x2d')][_0x426e('0x49')](_0x23d5cc[_0x426e('0x4a')],{})[_0x426e('0x26')](respondWithResult(_0x450d63,0xc9))['catch'](handleError(_0x450d63,null));};exports[_0x426e('0x4b')]=function(_0x113c3a,_0x56126c){return db[_0x426e('0x2d')][_0x426e('0x4b')](_0x113c3a[_0x426e('0x4a')],{'raw':![],'individualHooks':!![]})[_0x426e('0x26')](respondWithResult(_0x56126c,0xc9))[_0x426e('0x41')](handleError(_0x56126c,null));};exports[_0x426e('0x24')]=function(_0x107f43,_0x27de0c){if(_0x107f43['body']['id']){delete _0x107f43[_0x426e('0x4a')]['id'];}return db[_0x426e('0x2d')][_0x426e('0x48')]({'where':{'id':_0x107f43['params']['id']}})[_0x426e('0x26')](handleEntityNotFound(_0x27de0c,null))[_0x426e('0x26')](saveUpdates(_0x107f43[_0x426e('0x4a')],null))[_0x426e('0x26')](respondWithResult(_0x27de0c,null))[_0x426e('0x41')](handleError(_0x27de0c,null));};exports['destroy']=function(_0x118095,_0x3be4f9){return db[_0x426e('0x2d')][_0x426e('0x48')]({'where':{'id':_0x118095[_0x426e('0x43')]['id']}})['then'](handleEntityNotFound(_0x3be4f9,null))[_0x426e('0x26')](removeEntity(_0x3be4f9,null))[_0x426e('0x41')](handleError(_0x3be4f9,null));};exports['bulkDestroy']=function(_0x47a4d0,_0x2108b3){return db[_0x426e('0x2d')]['destroy']({'where':{'id':_0x47a4d0[_0x426e('0x31')][_0x426e('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2108b3,0xcc))[_0x426e('0x41')](handleError(_0x2108b3,null));};exports[_0x426e('0x4d')]=function(_0x122b58,_0xac5a00,_0x555e9b){return db[_0x426e('0x4e')][_0x426e('0x4f')]({'where':{'id':_0x122b58[_0x426e('0x43')]['id']}})[_0x426e('0x26')](handleEntityNotFound(_0xac5a00,null))['then'](function(_0x291e3c){if(_0x291e3c){return db[_0x426e('0x50')][_0x426e('0x51')](function(_0x23a59c){return db['AnalyticFieldReport'][_0x426e('0x25')]({'where':{'CustomReportId':_0x122b58[_0x426e('0x43')]['id']},'transaction':_0x23a59c})[_0x426e('0x26')](function(_0x52ce49){var _0x471039=_[_0x426e('0x2c')](_0x122b58[_0x426e('0x4a')],function(_0x58c43a){delete _0x58c43a['id'];_0x58c43a[_0x426e('0x52')]=_0x122b58[_0x426e('0x43')]['id'];return _0x58c43a;});return db[_0x426e('0x2d')][_0x426e('0x4b')](_0x471039,{'transaction':_0x23a59c});});})[_0x426e('0x26')](function(){return db[_0x426e('0x2d')]['findAll']({'where':{'CustomReportId':_0x122b58['params']['id']}});});}})[_0x426e('0x26')](respondWithResult(_0xac5a00,null))[_0x426e('0x41')](handleError(_0xac5a00,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ac3a1f2..ee67995 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 _0x58ce=['exports','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x209c34,_0x4ec17b){var _0x8d73ed=function(_0x450536){while(--_0x450536){_0x209c34['push'](_0x209c34['shift']());}};_0x8d73ed(++_0x4ec17b);}(_0x58ce,0x15f));var _0xe58c=function(_0x217bb0,_0x383c5b){_0x217bb0=_0x217bb0-0x0;var _0x40d985=_0x58ce[_0x217bb0];return _0x40d985;};'use strict';var _=require(_0xe58c('0x0'));var util=require('util');var logger=require(_0xe58c('0x1'))('api');var moment=require(_0xe58c('0x2'));var BPromise=require(_0xe58c('0x3'));var rp=require(_0xe58c('0x4'));var fs=require('fs');var path=require(_0xe58c('0x5'));var rimraf=require(_0xe58c('0x6'));var config=require(_0xe58c('0x7'));var attributes=require(_0xe58c('0x8'));module[_0xe58c('0x9')]=function(_0x179c8a,_0xbab602){return _0x179c8a['define'](_0xe58c('0xa'),attributes,{'tableName':_0xe58c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9468=['AnalyticFieldReport','analytics_report_fields','util','api','moment','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9468,0x92));var _0x8946=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x9468[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require('lodash');var util=require(_0x8946('0x0'));var logger=require('../../config/logger')(_0x8946('0x1'));var moment=require(_0x8946('0x2'));var BPromise=require('bluebird');var rp=require(_0x8946('0x3'));var fs=require('fs');var path=require(_0x8946('0x4'));var rimraf=require(_0x8946('0x5'));var config=require(_0x8946('0x6'));var attributes=require(_0x8946('0x7'));module[_0x8946('0x8')]=function(_0x5dbcee,_0x3b85ae){return _0x5dbcee[_0x8946('0x9')](_0x8946('0xa'),attributes,{'tableName':_0x8946('0xb'),'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 b17fffc..c8c504f 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 _0xfb0b=['stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','AnalyticFieldReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb0b,0xb1));var _0xbfb0=function(_0x15a106,_0xbc5c2a){_0x15a106=_0x15a106-0x0;var _0xe9013a=_0xfb0b[_0x15a106];return _0xe9013a;};'use strict';var _=require(_0xbfb0('0x0'));var util=require('util');var moment=require(_0xbfb0('0x1'));var BPromise=require('bluebird');var rs=require(_0xbfb0('0x2'));var fs=require('fs');var Redis=require(_0xbfb0('0x3'));var db=require(_0xbfb0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfb0('0x5'))(_0xbfb0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfb0('0x7')][_0xbfb0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58e88b,_0x2ca208,_0x4df3eb){return new BPromise(function(_0x2e90ff,_0x74acba){return client[_0xbfb0('0x9')](_0x58e88b,_0x4df3eb)['then'](function(_0x951491){logger['info'](_0xbfb0('0xa'),_0x2ca208,'request\x20sent');logger[_0xbfb0('0xb')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x2ca208,_0xbfb0('0xc'),JSON[_0xbfb0('0xd')](_0x951491));if(_0x951491['error']){if(_0x951491[_0xbfb0('0xe')][_0xbfb0('0xf')]===0x1f4){logger[_0xbfb0('0xe')](_0xbfb0('0xa'),_0x2ca208,_0x951491[_0xbfb0('0xe')][_0xbfb0('0x10')]);return _0x74acba(_0x951491[_0xbfb0('0xe')][_0xbfb0('0x10')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x2ca208,_0x951491['error'][_0xbfb0('0x10')]);return _0x2e90ff(_0x951491[_0xbfb0('0xe')]['message']);}else{logger[_0xbfb0('0x11')](_0xbfb0('0xa'),_0x2ca208,_0xbfb0('0xc'));_0x2e90ff(_0x951491[_0xbfb0('0x12')][_0xbfb0('0x10')]);}})['catch'](function(_0x12c39e){logger[_0xbfb0('0xe')](_0xbfb0('0xa'),_0x2ca208,_0x12c39e);_0x74acba(_0x12c39e);});});} \ No newline at end of file +var _0xf4ff=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x1604fe,_0x149797){var _0x5e229c=function(_0x1afcd6){while(--_0x1afcd6){_0x1604fe['push'](_0x1604fe['shift']());}};_0x5e229c(++_0x149797);}(_0xf4ff,0x190));var _0xff4f=function(_0xe7e925,_0x57d420){_0xe7e925=_0xe7e925-0x0;var _0x1fe3b4=_0xf4ff[_0xe7e925];return _0x1fe3b4;};'use strict';var _=require(_0xff4f('0x0'));var util=require(_0xff4f('0x1'));var moment=require(_0xff4f('0x2'));var BPromise=require(_0xff4f('0x3'));var rs=require(_0xff4f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff4f('0x5'))['db'];var utils=require(_0xff4f('0x6'));var logger=require(_0xff4f('0x7'))(_0xff4f('0x8'));var config=require(_0xff4f('0x9'));var jayson=require(_0xff4f('0xa'));var client=jayson['client'][_0xff4f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5153dc,_0x2edbb5,_0x3afdc5){return new BPromise(function(_0x54cbce,_0x50b4e3){return client[_0xff4f('0xc')](_0x5153dc,_0x3afdc5)[_0xff4f('0xd')](function(_0x2f9296){logger['info'](_0xff4f('0xe'),_0x2edbb5,_0xff4f('0xf'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x2edbb5,'request\x20sent',JSON['stringify'](_0x2f9296));if(_0x2f9296[_0xff4f('0x10')]){if(_0x2f9296[_0xff4f('0x10')][_0xff4f('0x11')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x2edbb5,_0x2f9296[_0xff4f('0x10')]['message']);return _0x50b4e3(_0x2f9296['error'][_0xff4f('0x12')]);}logger[_0xff4f('0x10')](_0xff4f('0xe'),_0x2edbb5,_0x2f9296['error'][_0xff4f('0x12')]);return _0x54cbce(_0x2f9296[_0xff4f('0x10')]['message']);}else{logger[_0xff4f('0x13')](_0xff4f('0xe'),_0x2edbb5,_0xff4f('0xf'));_0x54cbce(_0x2f9296[_0xff4f('0x14')][_0xff4f('0x12')]);}})[_0xff4f('0x15')](function(_0xad5fe0){logger[_0xff4f('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2edbb5,_0xad5fe0);_0x50b4e3(_0xad5fe0);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index d283037..25bf0ba 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 _0x326f=['/:id','show','post','/create_many','bulkCreate','/:id/create_many','addFields','update','/destroy_many','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x326f,0xd1));var _0xf326=function(_0x1f70ab,_0x3b297d){_0x1f70ab=_0x1f70ab-0x0;var _0x378dcd=_0x326f[_0x1f70ab];return _0x378dcd;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf326('0xe'),auth[_0xf326('0x9')](),controller[_0xf326('0xf')]);router[_0xf326('0xd')](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['put'](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x12')]);router['delete'](_0xf326('0x13'),auth[_0xf326('0x9')](),controller['bulkDestroy']);router[_0xf326('0x14')](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0x15')]);module['exports']=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(_0x8acfd3,_0x2d21a3){var _0x3f89da=function(_0x387acf){while(--_0x387acf){_0x8acfd3['push'](_0x8acfd3['shift']());}};_0x3f89da(++_0x2d21a3);}(_0x7217,0x19e));var _0x7721=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x7217[_0x102e37];return _0x35a07c;};'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 d9fa674..9ccb1fd 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 _0x07be=['TEXT','sequelize','exports','STRING','name'];(function(_0x2eeb31,_0x4917f5){var _0x13f89b=function(_0x5cc746){while(--_0x5cc746){_0x2eeb31['push'](_0x2eeb31['shift']());}};_0x13f89b(++_0x4917f5);}(_0x07be,0xfb));var _0xe07b=function(_0x35ec3d,_0x676597){_0x35ec3d=_0x35ec3d-0x0;var _0x29f9ce=_0x07be[_0x35ec3d];return _0x29f9ce;};'use strict';var Sequelize=require(_0xe07b('0x0'));module[_0xe07b('0x1')]={'name':{'type':Sequelize[_0xe07b('0x2')],'allowNull':![],'unique':_0xe07b('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xe07b('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8bec=['sequelize','exports','STRING','name','TEXT'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x8bec,0x6e));var _0xc8be=function(_0x83ffc6,_0x5db88a){_0x83ffc6=_0x83ffc6-0x0;var _0x25b86c=_0x8bec[_0x83ffc6];return _0x25b86c;};'use strict';var Sequelize=require(_0xc8be('0x0'));module[_0xc8be('0x1')]={'name':{'type':Sequelize[_0xc8be('0x2')],'allowNull':![],'unique':_0xc8be('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xc8be('0x4')]},'description':{'type':Sequelize[_0xc8be('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index db6b365..e3d0b63 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 _0xddad=['filter','merge','VIRTUAL','include','findAll','catch','show','params','length','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../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','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x59647,_0x315257){var _0x334a9e=function(_0x5bcd37){while(--_0x5bcd37){_0x59647['push'](_0x59647['shift']());}};_0x334a9e(++_0x315257);}(_0xddad,0x1b4));var _0xddda=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0xddad[_0x8c8176];return _0x4dc47b;};'use strict';var pdf=require(_0xddda('0x0'));var emlformat=require(_0xddda('0x1'));var rimraf=require(_0xddda('0x2'));var zipdir=require(_0xddda('0x3'));var jsonpatch=require(_0xddda('0x4'));var rp=require(_0xddda('0x5'));var moment=require(_0xddda('0x6'));var BPromise=require(_0xddda('0x7'));var Mustache=require(_0xddda('0x8'));var util=require(_0xddda('0x9'));var path=require(_0xddda('0xa'));var sox=require(_0xddda('0xb'));var csv=require(_0xddda('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xddda('0xd'));var squel=require(_0xddda('0xe'));var crypto=require(_0xddda('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xddda('0x10'));var toCsv=require('to-csv');var querystring=require(_0xddda('0x11'));var Papa=require('papaparse');var Redis=require(_0xddda('0x12'));var authService=require(_0xddda('0x13'));var qs=require(_0xddda('0x14'));var as=require(_0xddda('0x15'));var hardwareService=require(_0xddda('0x16'));var logger=require(_0xddda('0x17'))(_0xddda('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xddda('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11e24f,_0x14159b){_0x14159b=_0x14159b||0xcc;return function(_0x50d739){if(_0x50d739){return _0x11e24f[_0xddda('0x1a')](_0x14159b);}return _0x11e24f['status'](_0x14159b)[_0xddda('0x1b')]();};}function respondWithResult(_0x3d45b8,_0x11ff99){_0x11ff99=_0x11ff99||0xc8;return function(_0x191816){if(_0x191816){return _0x3d45b8[_0xddda('0x1c')](_0x11ff99)[_0xddda('0x1d')](_0x191816);}};}function respondWithFilteredResult(_0x25975f,_0x3716ad){return function(_0x42812e){if(_0x42812e){var _0x3f8ce3=_0x42812e[_0xddda('0x1e')],_0x2eba00=_0x3716ad[_0xddda('0x1f')],_0x1e71ba=_0x3716ad[_0xddda('0x1f')]+_0x3716ad[_0xddda('0x20')],_0x537128;if(_0x1e71ba>=_0x3f8ce3){_0x1e71ba=_0x3f8ce3;_0x537128=0xc8;}else{_0x537128=0xce;}_0x25975f[_0xddda('0x1c')](_0x537128);return _0x25975f['set'](_0xddda('0x21'),_0x2eba00+'-'+_0x1e71ba+'/'+_0x3f8ce3)['json'](_0x42812e);}return null;};}function patchUpdates(_0x165393){return function(_0x49384a){try{jsonpatch[_0xddda('0x22')](_0x49384a,_0x165393,!![]);}catch(_0x2b012f){return BPromise['reject'](_0x2b012f);}return _0x49384a[_0xddda('0x23')]();};}function saveUpdates(_0x3b2051,_0x575c53){return function(_0x3f0924){if(_0x3f0924){return _0x3f0924[_0xddda('0x24')](_0x3b2051)[_0xddda('0x25')](function(_0x382d54){return _0x382d54;});}return null;};}function removeEntity(_0x59210d,_0x4aa5ea){return function(_0x2979ba){if(_0x2979ba){return _0x2979ba[_0xddda('0x26')]()[_0xddda('0x25')](function(){var _0x18f919=_0x2979ba[_0xddda('0x27')]({'plain':!![]});var _0x31f646='Metrics';return db[_0xddda('0x28')][_0xddda('0x26')]({'where':{'type':_0x31f646,'resourceId':_0x18f919['id']}})[_0xddda('0x25')](function(){return _0x2979ba;});})[_0xddda('0x25')](function(){_0x59210d[_0xddda('0x1c')](0xcc)[_0xddda('0x1b')]();});}};}function handleEntityNotFound(_0x385285,_0x4ac032){return function(_0x110006){if(!_0x110006){_0x385285[_0xddda('0x1a')](0x194);}return _0x110006;};}function handleError(_0x47079c,_0x131dd5){_0x131dd5=_0x131dd5||0x1f4;return function(_0x2a3ddc){logger[_0xddda('0x29')](_0x2a3ddc[_0xddda('0x2a')]);if(_0x2a3ddc['name']){delete _0x2a3ddc[_0xddda('0x2b')];}_0x47079c['status'](_0x131dd5)['send'](_0x2a3ddc);};}exports['index']=function(_0x3af6ea,_0x28b687){var _0x47db0a={},_0x1a0047={},_0x396434={'count':0x0,'rows':[]};var _0xdb99ab=_[_0xddda('0x2c')](db[_0xddda('0x2d')][_0xddda('0x2e')],function(_0x1bde98){return{'name':_0x1bde98[_0xddda('0x2f')],'type':_0x1bde98[_0xddda('0x30')][_0xddda('0x31')]};});_0x1a0047[_0xddda('0x32')]=_['map'](_0xdb99ab,'name');_0x1a0047[_0xddda('0x33')]=_[_0xddda('0x34')](_0x3af6ea['query']);_0x1a0047[_0xddda('0x35')]=_['intersection'](_0x1a0047[_0xddda('0x32')],_0x1a0047[_0xddda('0x33')]);_0x47db0a[_0xddda('0x36')]=_[_0xddda('0x37')](_0x1a0047['model'],qs[_0xddda('0x38')](_0x3af6ea[_0xddda('0x33')]['fields']));_0x47db0a['attributes']=_0x47db0a[_0xddda('0x36')]['length']?_0x47db0a['attributes']:_0x1a0047[_0xddda('0x32')];if(!_0x3af6ea[_0xddda('0x33')][_0xddda('0x39')](_0xddda('0x3a'))){_0x47db0a[_0xddda('0x20')]=qs['limit'](_0x3af6ea[_0xddda('0x33')][_0xddda('0x20')]);_0x47db0a[_0xddda('0x1f')]=qs['offset'](_0x3af6ea[_0xddda('0x33')][_0xddda('0x1f')]);}_0x47db0a['order']=qs['sort'](_0x3af6ea['query'][_0xddda('0x3b')]);_0x47db0a[_0xddda('0x3c')]=qs[_0xddda('0x35')](_[_0xddda('0x3d')](_0x3af6ea[_0xddda('0x33')],_0x1a0047[_0xddda('0x35')]),_0xdb99ab);if(_0x3af6ea[_0xddda('0x33')][_0xddda('0x3e')]){_0x47db0a['where']=_[_0xddda('0x3f')](_0x47db0a[_0xddda('0x3c')],{'$or':_[_0xddda('0x2c')](_0xdb99ab,function(_0x16a841){if(_0x16a841[_0xddda('0x30')]!==_0xddda('0x40')){var _0x72779d={};_0x72779d[_0x16a841[_0xddda('0x2b')]]={'$like':'%'+_0x3af6ea['query'][_0xddda('0x3e')]+'%'};return _0x72779d;}})});}_0x47db0a=_[_0xddda('0x3f')]({},_0x47db0a,_0x3af6ea['options']);var _0x4d819f={'where':_0x47db0a[_0xddda('0x3c')]};return db[_0xddda('0x2d')][_0xddda('0x1e')](_0x4d819f)[_0xddda('0x25')](function(_0x44744e){_0x396434[_0xddda('0x1e')]=_0x44744e;if(_0x3af6ea[_0xddda('0x33')]['includeAll']){_0x47db0a[_0xddda('0x41')]=[{'all':!![]}];}return db[_0xddda('0x2d')][_0xddda('0x42')](_0x47db0a);})[_0xddda('0x25')](function(_0x34aade){_0x396434['rows']=_0x34aade;return _0x396434;})['then'](respondWithFilteredResult(_0x28b687,_0x47db0a))[_0xddda('0x43')](handleError(_0x28b687,null));};exports[_0xddda('0x44')]=function(_0x56127b,_0x3175f9){var _0x5d6813={'raw':!![],'where':{'id':_0x56127b[_0xddda('0x45')]['id']}},_0x5634e0={};_0x5634e0[_0xddda('0x32')]=_['keys'](db['AnalyticMetric'][_0xddda('0x2e')]);_0x5634e0['query']=_[_0xddda('0x34')](_0x56127b['query']);_0x5634e0[_0xddda('0x35')]=_[_0xddda('0x37')](_0x5634e0[_0xddda('0x32')],_0x5634e0[_0xddda('0x33')]);_0x5d6813[_0xddda('0x36')]=_[_0xddda('0x37')](_0x5634e0[_0xddda('0x32')],qs[_0xddda('0x38')](_0x56127b[_0xddda('0x33')][_0xddda('0x38')]));_0x5d6813[_0xddda('0x36')]=_0x5d6813[_0xddda('0x36')][_0xddda('0x46')]?_0x5d6813[_0xddda('0x36')]:_0x5634e0[_0xddda('0x32')];if(_0x56127b['query'][_0xddda('0x47')]){_0x5d6813[_0xddda('0x41')]=[{'all':!![]}];}_0x5d6813=_['merge']({},_0x5d6813,_0x56127b[_0xddda('0x48')]);return db[_0xddda('0x2d')][_0xddda('0x49')](_0x5d6813)[_0xddda('0x25')](handleEntityNotFound(_0x3175f9,null))[_0xddda('0x25')](respondWithResult(_0x3175f9,null))[_0xddda('0x43')](handleError(_0x3175f9,null));};exports[_0xddda('0x4a')]=function(_0x37582b,_0xa9989d){return db[_0xddda('0x2d')][_0xddda('0x4a')](_0x37582b['body'],{})['then'](function(_0x129455){var _0x5af923=_0x37582b[_0xddda('0x4b')][_0xddda('0x27')]({'plain':!![]});if(!_0x5af923)throw new Error(_0xddda('0x4c'));if(_0x5af923[_0xddda('0x4d')]===_0xddda('0x4b')){var _0x69f782=_0x129455[_0xddda('0x27')]({'plain':!![]});var _0x5ce5e6=_0xddda('0x4e');return db['UserProfileSection'][_0xddda('0x49')]({'where':{'name':_0x5ce5e6,'userProfileId':_0x5af923[_0xddda('0x4f')]},'raw':!![]})['then'](function(_0xd3ba3d){if(_0xd3ba3d&&_0xd3ba3d[_0xddda('0x50')]===0x0){return db[_0xddda('0x28')]['create']({'name':_0x69f782[_0xddda('0x2b')],'resourceId':_0x69f782['id'],'type':_0xd3ba3d[_0xddda('0x2b')],'sectionId':_0xd3ba3d['id']},{})[_0xddda('0x25')](function(){return _0x129455;});}else{return _0x129455;}})[_0xddda('0x43')](function(_0x167347){logger[_0xddda('0x29')](_0xddda('0x51'),_0x167347);throw _0x167347;});}return _0x129455;})[_0xddda('0x25')](respondWithResult(_0xa9989d,0xc9))['catch'](handleError(_0xa9989d,null));};exports[_0xddda('0x24')]=function(_0x246a48,_0x3735ca){if(_0x246a48['body']['id']){delete _0x246a48[_0xddda('0x52')]['id'];}return db[_0xddda('0x2d')][_0xddda('0x49')]({'where':{'id':_0x246a48[_0xddda('0x45')]['id']}})[_0xddda('0x25')](handleEntityNotFound(_0x3735ca,null))[_0xddda('0x25')](saveUpdates(_0x246a48[_0xddda('0x52')],null))['then'](respondWithResult(_0x3735ca,null))['catch'](handleError(_0x3735ca,null));};exports['destroy']=function(_0x4ecc61,_0x2c5e84){return db[_0xddda('0x2d')][_0xddda('0x49')]({'where':{'id':_0x4ecc61[_0xddda('0x45')]['id']}})[_0xddda('0x25')](handleEntityNotFound(_0x2c5e84,null))[_0xddda('0x25')](removeEntity(_0x2c5e84,null))['catch'](handleError(_0x2c5e84,null));}; \ No newline at end of file +var _0x3855=['reject','save','update','then','destroy','get','UserProfileResource','error','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','catch','keys','find','create','body','role','user','Metrics','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply'];(function(_0x222972,_0xb31141){var _0x53d302=function(_0x49eeb2){while(--_0x49eeb2){_0x222972['push'](_0x222972['shift']());}};_0x53d302(++_0xb31141);}(_0x3855,0x1c5));var _0x5385=function(_0x2d283b,_0x1741eb){_0x2d283b=_0x2d283b-0x0;var _0x43cbcb=_0x3855[_0x2d283b];return _0x43cbcb;};'use strict';var pdf=require(_0x5385('0x0'));var emlformat=require(_0x5385('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5385('0x2'));var jsonpatch=require(_0x5385('0x3'));var rp=require(_0x5385('0x4'));var moment=require(_0x5385('0x5'));var BPromise=require(_0x5385('0x6'));var Mustache=require(_0x5385('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5385('0x8'));var csv=require(_0x5385('0x9'));var ejs=require(_0x5385('0xa'));var fs=require('fs');var _=require(_0x5385('0xb'));var squel=require('squel');var crypto=require(_0x5385('0xc'));var jsforce=require(_0x5385('0xd'));var deskjs=require(_0x5385('0xe'));var toCsv=require(_0x5385('0x9'));var querystring=require(_0x5385('0xf'));var Papa=require('papaparse');var Redis=require(_0x5385('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5385('0x11'));var as=require(_0x5385('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5385('0x13'))(_0x5385('0x14'));var utils=require(_0x5385('0x15'));var config=require(_0x5385('0x16'));var licenseUtil=require(_0x5385('0x17'));var db=require(_0x5385('0x18'))['db'];function respondWithStatusCode(_0x3918ad,_0x14f6f8){_0x14f6f8=_0x14f6f8||0xcc;return function(_0x5a15ab){if(_0x5a15ab){return _0x3918ad['sendStatus'](_0x14f6f8);}return _0x3918ad[_0x5385('0x19')](_0x14f6f8)[_0x5385('0x1a')]();};}function respondWithResult(_0x3ea0d0,_0x452a7b){_0x452a7b=_0x452a7b||0xc8;return function(_0x1503fa){if(_0x1503fa){return _0x3ea0d0[_0x5385('0x19')](_0x452a7b)[_0x5385('0x1b')](_0x1503fa);}};}function respondWithFilteredResult(_0x19cc02,_0x350d37){return function(_0x1850a4){if(_0x1850a4){var _0x433101=_0x1850a4['count'],_0x3cfefc=_0x350d37[_0x5385('0x1c')],_0x2ee8bb=_0x350d37[_0x5385('0x1c')]+_0x350d37[_0x5385('0x1d')],_0x36f20a;if(_0x2ee8bb>=_0x433101){_0x2ee8bb=_0x433101;_0x36f20a=0xc8;}else{_0x36f20a=0xce;}_0x19cc02[_0x5385('0x19')](_0x36f20a);return _0x19cc02[_0x5385('0x1e')](_0x5385('0x1f'),_0x3cfefc+'-'+_0x2ee8bb+'/'+_0x433101)[_0x5385('0x1b')](_0x1850a4);}return null;};}function patchUpdates(_0x338f34){return function(_0x469c79){try{jsonpatch[_0x5385('0x20')](_0x469c79,_0x338f34,!![]);}catch(_0x12e770){return BPromise[_0x5385('0x21')](_0x12e770);}return _0x469c79[_0x5385('0x22')]();};}function saveUpdates(_0x298770,_0xd1414e){return function(_0x5bcef7){if(_0x5bcef7){return _0x5bcef7[_0x5385('0x23')](_0x298770)[_0x5385('0x24')](function(_0x4702c9){return _0x4702c9;});}return null;};}function removeEntity(_0x1f191b,_0x133a41){return function(_0x2f85f0){if(_0x2f85f0){return _0x2f85f0[_0x5385('0x25')]()[_0x5385('0x24')](function(){var _0x533f8e=_0x2f85f0[_0x5385('0x26')]({'plain':!![]});var _0x33e559='Metrics';return db[_0x5385('0x27')][_0x5385('0x25')]({'where':{'type':_0x33e559,'resourceId':_0x533f8e['id']}})[_0x5385('0x24')](function(){return _0x2f85f0;});})[_0x5385('0x24')](function(){_0x1f191b[_0x5385('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x204f7e,_0x29d07d){return function(_0x589608){if(!_0x589608){_0x204f7e['sendStatus'](0x194);}return _0x589608;};}function handleError(_0x5ae4f8,_0x3a2ba2){_0x3a2ba2=_0x3a2ba2||0x1f4;return function(_0x44ac98){logger[_0x5385('0x28')](_0x44ac98['stack']);if(_0x44ac98[_0x5385('0x29')]){delete _0x44ac98['name'];}_0x5ae4f8[_0x5385('0x19')](_0x3a2ba2)[_0x5385('0x2a')](_0x44ac98);};}exports['index']=function(_0x1c02bd,_0x21102d){var _0xe4c40c={},_0x390bd4={},_0x477aa0={'count':0x0,'rows':[]};var _0x529a6d=_[_0x5385('0x2b')](db['AnalyticMetric'][_0x5385('0x2c')],function(_0x20f185){return{'name':_0x20f185[_0x5385('0x2d')],'type':_0x20f185[_0x5385('0x2e')][_0x5385('0x2f')]};});_0x390bd4[_0x5385('0x30')]=_[_0x5385('0x2b')](_0x529a6d,'name');_0x390bd4[_0x5385('0x31')]=_['keys'](_0x1c02bd[_0x5385('0x31')]);_0x390bd4['filters']=_[_0x5385('0x32')](_0x390bd4[_0x5385('0x30')],_0x390bd4['query']);_0xe4c40c[_0x5385('0x33')]=_[_0x5385('0x32')](_0x390bd4['model'],qs[_0x5385('0x34')](_0x1c02bd['query']['fields']));_0xe4c40c[_0x5385('0x33')]=_0xe4c40c['attributes'][_0x5385('0x35')]?_0xe4c40c[_0x5385('0x33')]:_0x390bd4[_0x5385('0x30')];if(!_0x1c02bd['query'][_0x5385('0x36')](_0x5385('0x37'))){_0xe4c40c['limit']=qs[_0x5385('0x1d')](_0x1c02bd[_0x5385('0x31')]['limit']);_0xe4c40c[_0x5385('0x1c')]=qs[_0x5385('0x1c')](_0x1c02bd[_0x5385('0x31')][_0x5385('0x1c')]);}_0xe4c40c[_0x5385('0x38')]=qs[_0x5385('0x39')](_0x1c02bd['query'][_0x5385('0x39')]);_0xe4c40c[_0x5385('0x3a')]=qs['filters'](_['pick'](_0x1c02bd[_0x5385('0x31')],_0x390bd4['filters']),_0x529a6d);if(_0x1c02bd[_0x5385('0x31')][_0x5385('0x3b')]){_0xe4c40c[_0x5385('0x3a')]=_[_0x5385('0x3c')](_0xe4c40c[_0x5385('0x3a')],{'$or':_[_0x5385('0x2b')](_0x529a6d,function(_0x517bf7){if(_0x517bf7[_0x5385('0x2e')]!==_0x5385('0x3d')){var _0x3e5b4a={};_0x3e5b4a[_0x517bf7[_0x5385('0x29')]]={'$like':'%'+_0x1c02bd['query']['filter']+'%'};return _0x3e5b4a;}})});}_0xe4c40c=_['merge']({},_0xe4c40c,_0x1c02bd[_0x5385('0x3e')]);var _0x8b2dfb={'where':_0xe4c40c['where']};return db[_0x5385('0x3f')][_0x5385('0x40')](_0x8b2dfb)['then'](function(_0x52f486){_0x477aa0[_0x5385('0x40')]=_0x52f486;if(_0x1c02bd[_0x5385('0x31')][_0x5385('0x41')]){_0xe4c40c[_0x5385('0x42')]=[{'all':!![]}];}return db[_0x5385('0x3f')][_0x5385('0x43')](_0xe4c40c);})['then'](function(_0x2f9d19){_0x477aa0['rows']=_0x2f9d19;return _0x477aa0;})[_0x5385('0x24')](respondWithFilteredResult(_0x21102d,_0xe4c40c))[_0x5385('0x44')](handleError(_0x21102d,null));};exports['show']=function(_0x1375a3,_0x357104){var _0x23b969={'raw':!![],'where':{'id':_0x1375a3['params']['id']}},_0x4f9bb2={};_0x4f9bb2[_0x5385('0x30')]=_[_0x5385('0x45')](db[_0x5385('0x3f')][_0x5385('0x2c')]);_0x4f9bb2[_0x5385('0x31')]=_[_0x5385('0x45')](_0x1375a3[_0x5385('0x31')]);_0x4f9bb2['filters']=_[_0x5385('0x32')](_0x4f9bb2[_0x5385('0x30')],_0x4f9bb2['query']);_0x23b969[_0x5385('0x33')]=_[_0x5385('0x32')](_0x4f9bb2[_0x5385('0x30')],qs[_0x5385('0x34')](_0x1375a3[_0x5385('0x31')][_0x5385('0x34')]));_0x23b969[_0x5385('0x33')]=_0x23b969[_0x5385('0x33')]['length']?_0x23b969['attributes']:_0x4f9bb2[_0x5385('0x30')];if(_0x1375a3['query'][_0x5385('0x41')]){_0x23b969['include']=[{'all':!![]}];}_0x23b969=_['merge']({},_0x23b969,_0x1375a3[_0x5385('0x3e')]);return db['AnalyticMetric'][_0x5385('0x46')](_0x23b969)['then'](handleEntityNotFound(_0x357104,null))[_0x5385('0x24')](respondWithResult(_0x357104,null))[_0x5385('0x44')](handleError(_0x357104,null));};exports['create']=function(_0x16cbd3,_0x54852b){return db[_0x5385('0x3f')][_0x5385('0x47')](_0x16cbd3[_0x5385('0x48')],{})[_0x5385('0x24')](function(_0x385e5b){var _0x2356d2=_0x16cbd3['user'][_0x5385('0x26')]({'plain':!![]});if(!_0x2356d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2356d2[_0x5385('0x49')]===_0x5385('0x4a')){var _0xcb05e7=_0x385e5b[_0x5385('0x26')]({'plain':!![]});var _0x14b0b7=_0x5385('0x4b');return db[_0x5385('0x4c')][_0x5385('0x46')]({'where':{'name':_0x14b0b7,'userProfileId':_0x2356d2[_0x5385('0x4d')]},'raw':!![]})['then'](function(_0x403622){if(_0x403622&&_0x403622[_0x5385('0x4e')]===0x0){return db[_0x5385('0x27')][_0x5385('0x47')]({'name':_0xcb05e7[_0x5385('0x29')],'resourceId':_0xcb05e7['id'],'type':_0x403622[_0x5385('0x29')],'sectionId':_0x403622['id']},{})[_0x5385('0x24')](function(){return _0x385e5b;});}else{return _0x385e5b;}})['catch'](function(_0x115761){logger[_0x5385('0x28')](_0x5385('0x4f'),_0x115761);throw _0x115761;});}return _0x385e5b;})['then'](respondWithResult(_0x54852b,0xc9))[_0x5385('0x44')](handleError(_0x54852b,null));};exports[_0x5385('0x23')]=function(_0x27a74f,_0x5af71b){if(_0x27a74f[_0x5385('0x48')]['id']){delete _0x27a74f['body']['id'];}return db[_0x5385('0x3f')][_0x5385('0x46')]({'where':{'id':_0x27a74f[_0x5385('0x50')]['id']}})[_0x5385('0x24')](handleEntityNotFound(_0x5af71b,null))[_0x5385('0x24')](saveUpdates(_0x27a74f['body'],null))[_0x5385('0x24')](respondWithResult(_0x5af71b,null))[_0x5385('0x44')](handleError(_0x5af71b,null));};exports['destroy']=function(_0xb62d7f,_0x1b6fd8){return db[_0x5385('0x3f')]['find']({'where':{'id':_0xb62d7f[_0x5385('0x50')]['id']}})[_0x5385('0x24')](handleEntityNotFound(_0x1b6fd8,null))['then'](removeEntity(_0x1b6fd8,null))[_0x5385('0x44')](handleError(_0x1b6fd8,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5511f30..d678828 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 _0x5f18=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x257b25,_0x197cee){var _0x39ad84=function(_0x304660){while(--_0x304660){_0x257b25['push'](_0x257b25['shift']());}};_0x39ad84(++_0x197cee);}(_0x5f18,0x1c0));var _0x85f1=function(_0x3d1170,_0x32785c){_0x3d1170=_0x3d1170-0x0;var _0x1c3a3e=_0x5f18[_0x3d1170];return _0x1c3a3e;};'use strict';var _=require(_0x85f1('0x0'));var util=require(_0x85f1('0x1'));var logger=require(_0x85f1('0x2'))(_0x85f1('0x3'));var moment=require(_0x85f1('0x4'));var BPromise=require('bluebird');var rp=require(_0x85f1('0x5'));var fs=require('fs');var path=require(_0x85f1('0x6'));var rimraf=require(_0x85f1('0x7'));var config=require(_0x85f1('0x8'));var attributes=require(_0x85f1('0x9'));module[_0x85f1('0xa')]=function(_0x1c4ae7,_0x280454){return _0x1c4ae7[_0x85f1('0xb')](_0x85f1('0xc'),attributes,{'tableName':_0x85f1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x185c=['path','rimraf','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','moment','bluebird','request-promise'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x185c,0xc1));var _0xc185=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0x185c[_0xb301d4];return _0x3b5bde;};'use strict';var _=require(_0xc185('0x0'));var util=require(_0xc185('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc185('0x2'));var BPromise=require(_0xc185('0x3'));var rp=require(_0xc185('0x4'));var fs=require('fs');var path=require(_0xc185('0x5'));var rimraf=require(_0xc185('0x6'));var config=require('../../config/environment');var attributes=require(_0xc185('0x7'));module[_0xc185('0x8')]=function(_0x47011b,_0x230941){return _0x47011b[_0xc185('0x9')]('AnalyticMetric',attributes,{'tableName':_0xc185('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 ad07303..ded6a90 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 _0xe347=['result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x98cada,_0x46c804){var _0x1c7f85=function(_0x4e447a){while(--_0x4e447a){_0x98cada['push'](_0x98cada['shift']());}};_0x1c7f85(++_0x46c804);}(_0xe347,0x87));var _0x7e34=function(_0x5e9689,_0x48e034){_0x5e9689=_0x5e9689-0x0;var _0x2fac94=_0xe347[_0x5e9689];return _0x2fac94;};'use strict';var _=require(_0x7e34('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7e34('0x1'));var rs=require(_0x7e34('0x2'));var fs=require('fs');var Redis=require(_0x7e34('0x3'));var db=require(_0x7e34('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e34('0x5'));var config=require('../../config/environment');var jayson=require(_0x7e34('0x6'));var client=jayson[_0x7e34('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x204379,_0x3b7168,_0x1ad7d4){return new BPromise(function(_0xd4d213,_0x207066){return client[_0x7e34('0x8')](_0x204379,_0x1ad7d4)[_0x7e34('0x9')](function(_0x20c989){logger['info'](_0x7e34('0xa'),_0x3b7168,_0x7e34('0xb'));logger[_0x7e34('0xc')](_0x7e34('0xd'),_0x3b7168,_0x7e34('0xb'),JSON['stringify'](_0x20c989));if(_0x20c989[_0x7e34('0xe')]){if(_0x20c989['error']['code']===0x1f4){logger['error'](_0x7e34('0xa'),_0x3b7168,_0x20c989[_0x7e34('0xe')][_0x7e34('0xf')]);return _0x207066(_0x20c989[_0x7e34('0xe')]['message']);}logger['error'](_0x7e34('0xa'),_0x3b7168,_0x20c989[_0x7e34('0xe')][_0x7e34('0xf')]);return _0xd4d213(_0x20c989[_0x7e34('0xe')]['message']);}else{logger[_0x7e34('0x10')](_0x7e34('0xa'),_0x3b7168,_0x7e34('0xb'));_0xd4d213(_0x20c989[_0x7e34('0x11')][_0x7e34('0xf')]);}})[_0x7e34('0x12')](function(_0x5eaadb){logger[_0x7e34('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x3b7168,_0x5eaadb);_0x207066(_0x5eaadb);});});} \ No newline at end of file +var _0x6ae0=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x6ae0,0xef));var _0x06ae=function(_0x3393cb,_0x38e8a3){_0x3393cb=_0x3393cb-0x0;var _0x508cb7=_0x6ae0[_0x3393cb];return _0x508cb7;};'use strict';var _=require(_0x06ae('0x0'));var util=require(_0x06ae('0x1'));var moment=require(_0x06ae('0x2'));var BPromise=require(_0x06ae('0x3'));var rs=require(_0x06ae('0x4'));var fs=require('fs');var Redis=require(_0x06ae('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x06ae('0x6'));var logger=require(_0x06ae('0x7'))(_0x06ae('0x8'));var config=require(_0x06ae('0x9'));var jayson=require(_0x06ae('0xa'));var client=jayson[_0x06ae('0xb')][_0x06ae('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52f025,_0x5d2ddf,_0x28b3e5){return new BPromise(function(_0x2708c9,_0x2c3aaa){return client['request'](_0x52f025,_0x28b3e5)[_0x06ae('0xd')](function(_0x17de00){logger[_0x06ae('0xe')](_0x06ae('0xf'),_0x5d2ddf,_0x06ae('0x10'));logger[_0x06ae('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x5d2ddf,'request\x20sent',JSON['stringify'](_0x17de00));if(_0x17de00[_0x06ae('0x12')]){if(_0x17de00[_0x06ae('0x12')][_0x06ae('0x13')]===0x1f4){logger[_0x06ae('0x12')](_0x06ae('0xf'),_0x5d2ddf,_0x17de00[_0x06ae('0x12')][_0x06ae('0x14')]);return _0x2c3aaa(_0x17de00[_0x06ae('0x12')][_0x06ae('0x14')]);}logger['error'](_0x06ae('0xf'),_0x5d2ddf,_0x17de00[_0x06ae('0x12')]['message']);return _0x2708c9(_0x17de00[_0x06ae('0x12')][_0x06ae('0x14')]);}else{logger['info'](_0x06ae('0xf'),_0x5d2ddf,_0x06ae('0x10'));_0x2708c9(_0x17de00['result'][_0x06ae('0x14')]);}})[_0x06ae('0x15')](function(_0x118373){logger[_0x06ae('0x12')](_0x06ae('0xf'),_0x5d2ddf,_0x118373);_0x2c3aaa(_0x118373);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index ddbc32f..577a821 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 _0x57ca=['isAuthenticated','index','/:id','show','post','create','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2c219c,_0x3ed4d8){var _0x1b7002=function(_0x271c7a){while(--_0x271c7a){_0x2c219c['push'](_0x2c219c['shift']());}};_0x1b7002(++_0x3ed4d8);}(_0x57ca,0x108));var _0xa57c=function(_0x3fcfb6,_0x515024){_0x3fcfb6=_0x3fcfb6-0x0;var _0x3b99a7=_0x57ca[_0x3fcfb6];return _0x3b99a7;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var auth=require(_0xa57c('0x4'));var interaction=require(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var controller=require('./analyticMetric.controller');router[_0xa57c('0x7')]('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0x9')]);router[_0xa57c('0x7')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0xb')]);router[_0xa57c('0xc')]('/',auth['isAuthenticated'](),controller[_0xa57c('0xd')]);router['put'](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller['update']);router[_0xa57c('0xe')]('/:id',auth[_0xa57c('0x8')](),controller[_0xa57c('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc6ac=['show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2d28e3,_0x2f04e9){_0x2d28e3=_0x2d28e3-0x0;var _0xfc15eb=_0xc6ac[_0x2d28e3];return _0xfc15eb;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xc')]);router[_0xcc6a('0xa')]('/:id',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xe')]('/',auth['isAuthenticated'](),controller[_0xcc6a('0xf')]);router[_0xcc6a('0x10')](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x12')]);router['delete'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 711acdd..fd9f8d0 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 _0x9d1a=['TEXT','sequelize'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0x9d1a,0x1af));var _0xa9d1=function(_0x366e51,_0x3a0178){_0x366e51=_0x366e51-0x0;var _0x4e23e3=_0x9d1a[_0x366e51];return _0x4e23e3;};'use strict';var Sequelize=require(_0xa9d1('0x0'));module['exports']={'tree':{'type':Sequelize[_0xa9d1('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x43fd=['TEXT','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x43fd,0xb7));var _0xd43f=function(_0x52f722,_0x5ec8ca){_0x52f722=_0x52f722-0x0;var _0x33c635=_0x43fd[_0x52f722];return _0x33c635;};'use strict';var Sequelize=require('sequelize');module[_0xd43f('0x0')]={'tree':{'type':Sequelize[_0xd43f('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 bf41767..db7b74b 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 _0x4e4e=['count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','AnalyticTreeReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','rows','catch','params','rawAttributes','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','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','json'];(function(_0x27ca87,_0x559fd7){var _0x26ed60=function(_0x9a05ce){while(--_0x9a05ce){_0x27ca87['push'](_0x27ca87['shift']());}};_0x26ed60(++_0x559fd7);}(_0x4e4e,0x1eb));var _0xe4e4=function(_0x537625,_0x324deb){_0x537625=_0x537625-0x0;var _0x10158b=_0x4e4e[_0x537625];return _0x10158b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe4e4('0x0'));var rimraf=require(_0xe4e4('0x1'));var zipdir=require(_0xe4e4('0x2'));var jsonpatch=require(_0xe4e4('0x3'));var rp=require(_0xe4e4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe4e4('0x5'));var util=require(_0xe4e4('0x6'));var path=require('path');var sox=require(_0xe4e4('0x7'));var csv=require(_0xe4e4('0x8'));var ejs=require(_0xe4e4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe4e4('0xa'));var crypto=require(_0xe4e4('0xb'));var jsforce=require(_0xe4e4('0xc'));var deskjs=require(_0xe4e4('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4e4('0xe'));var authService=require(_0xe4e4('0xf'));var qs=require(_0xe4e4('0x10'));var as=require(_0xe4e4('0x11'));var hardwareService=require(_0xe4e4('0x12'));var logger=require(_0xe4e4('0x13'))('api');var utils=require(_0xe4e4('0x14'));var config=require(_0xe4e4('0x15'));var licenseUtil=require(_0xe4e4('0x16'));var db=require(_0xe4e4('0x17'))['db'];function respondWithStatusCode(_0x38cf50,_0x4e7620){_0x4e7620=_0x4e7620||0xcc;return function(_0x4a2464){if(_0x4a2464){return _0x38cf50[_0xe4e4('0x18')](_0x4e7620);}return _0x38cf50['status'](_0x4e7620)['end']();};}function respondWithResult(_0x270022,_0x25fda2){_0x25fda2=_0x25fda2||0xc8;return function(_0x51a370){if(_0x51a370){return _0x270022[_0xe4e4('0x19')](_0x25fda2)[_0xe4e4('0x1a')](_0x51a370);}};}function respondWithFilteredResult(_0x545f46,_0xe77447){return function(_0x21c577){if(_0x21c577){var _0x14f061=_0x21c577[_0xe4e4('0x1b')],_0x1ea821=_0xe77447[_0xe4e4('0x1c')],_0x3cdf22=_0xe77447[_0xe4e4('0x1c')]+_0xe77447['limit'],_0x2bb574;if(_0x3cdf22>=_0x14f061){_0x3cdf22=_0x14f061;_0x2bb574=0xc8;}else{_0x2bb574=0xce;}_0x545f46[_0xe4e4('0x19')](_0x2bb574);return _0x545f46[_0xe4e4('0x1d')](_0xe4e4('0x1e'),_0x1ea821+'-'+_0x3cdf22+'/'+_0x14f061)[_0xe4e4('0x1a')](_0x21c577);}return null;};}function patchUpdates(_0x3f04a6){return function(_0x5e667d){try{jsonpatch[_0xe4e4('0x1f')](_0x5e667d,_0x3f04a6,!![]);}catch(_0x5e6a59){return BPromise[_0xe4e4('0x20')](_0x5e6a59);}return _0x5e667d['save']();};}function saveUpdates(_0x11c1ef,_0x19796f){return function(_0x511fce){if(_0x511fce){return _0x511fce[_0xe4e4('0x21')](_0x11c1ef)[_0xe4e4('0x22')](function(_0x3a0ce0){return _0x3a0ce0;});}return null;};}function removeEntity(_0x10523a,_0x2f1797){return function(_0x26de0d){if(_0x26de0d){return _0x26de0d[_0xe4e4('0x23')]()[_0xe4e4('0x22')](function(){_0x10523a[_0xe4e4('0x19')](0xcc)[_0xe4e4('0x24')]();});}};}function handleEntityNotFound(_0x10ad0a,_0x4f5424){return function(_0x317ac6){if(!_0x317ac6){_0x10ad0a[_0xe4e4('0x18')](0x194);}return _0x317ac6;};}function handleError(_0x14b17c,_0x3bf2b1){_0x3bf2b1=_0x3bf2b1||0x1f4;return function(_0x437a09){logger[_0xe4e4('0x25')](_0x437a09[_0xe4e4('0x26')]);if(_0x437a09[_0xe4e4('0x27')]){delete _0x437a09[_0xe4e4('0x27')];}_0x14b17c[_0xe4e4('0x19')](_0x3bf2b1)[_0xe4e4('0x28')](_0x437a09);};}exports['index']=function(_0x35439b,_0x413dca){var _0x5de720={},_0x29d368={},_0x7fc175={'count':0x0,'rows':[]};var _0x3f99e7=_[_0xe4e4('0x29')](db[_0xe4e4('0x2a')]['rawAttributes'],function(_0x4899a0){return{'name':_0x4899a0[_0xe4e4('0x2b')],'type':_0x4899a0[_0xe4e4('0x2c')][_0xe4e4('0x2d')]};});_0x29d368[_0xe4e4('0x2e')]=_[_0xe4e4('0x29')](_0x3f99e7,_0xe4e4('0x27'));_0x29d368['query']=_[_0xe4e4('0x2f')](_0x35439b[_0xe4e4('0x30')]);_0x29d368['filters']=_[_0xe4e4('0x31')](_0x29d368[_0xe4e4('0x2e')],_0x29d368[_0xe4e4('0x30')]);_0x5de720[_0xe4e4('0x32')]=_[_0xe4e4('0x31')](_0x29d368['model'],qs['fields'](_0x35439b[_0xe4e4('0x30')][_0xe4e4('0x33')]));_0x5de720['attributes']=_0x5de720[_0xe4e4('0x32')][_0xe4e4('0x34')]?_0x5de720[_0xe4e4('0x32')]:_0x29d368['model'];if(!_0x35439b[_0xe4e4('0x30')][_0xe4e4('0x35')](_0xe4e4('0x36'))){_0x5de720[_0xe4e4('0x37')]=qs[_0xe4e4('0x37')](_0x35439b[_0xe4e4('0x30')]['limit']);_0x5de720[_0xe4e4('0x1c')]=qs[_0xe4e4('0x1c')](_0x35439b[_0xe4e4('0x30')]['offset']);}_0x5de720[_0xe4e4('0x38')]=qs[_0xe4e4('0x39')](_0x35439b[_0xe4e4('0x30')][_0xe4e4('0x39')]);_0x5de720[_0xe4e4('0x3a')]=qs[_0xe4e4('0x3b')](_[_0xe4e4('0x3c')](_0x35439b['query'],_0x29d368['filters']),_0x3f99e7);if(_0x35439b['query']['filter']){_0x5de720['where']=_[_0xe4e4('0x3d')](_0x5de720[_0xe4e4('0x3a')],{'$or':_[_0xe4e4('0x29')](_0x3f99e7,function(_0x3097aa){if(_0x3097aa[_0xe4e4('0x2c')]!==_0xe4e4('0x3e')){var _0x5b17bb={};_0x5b17bb[_0x3097aa[_0xe4e4('0x27')]]={'$like':'%'+_0x35439b[_0xe4e4('0x30')][_0xe4e4('0x3f')]+'%'};return _0x5b17bb;}})});}_0x5de720=_[_0xe4e4('0x3d')]({},_0x5de720,_0x35439b['options']);var _0x33b58a={'where':_0x5de720[_0xe4e4('0x3a')]};return db[_0xe4e4('0x2a')]['count'](_0x33b58a)['then'](function(_0x42b615){_0x7fc175['count']=_0x42b615;if(_0x35439b[_0xe4e4('0x30')][_0xe4e4('0x40')]){_0x5de720['include']=[{'all':!![]}];}return db[_0xe4e4('0x2a')]['findAll'](_0x5de720);})[_0xe4e4('0x22')](function(_0x5744d0){_0x7fc175[_0xe4e4('0x41')]=_0x5744d0;return _0x7fc175;})[_0xe4e4('0x22')](respondWithFilteredResult(_0x413dca,_0x5de720))[_0xe4e4('0x42')](handleError(_0x413dca,null));};exports['show']=function(_0x16f425,_0x2c9d1c){var _0x569a3c={'raw':!![],'where':{'id':_0x16f425[_0xe4e4('0x43')]['id']}},_0x3df250={};_0x3df250[_0xe4e4('0x2e')]=_['keys'](db[_0xe4e4('0x2a')][_0xe4e4('0x44')]);_0x3df250[_0xe4e4('0x30')]=_[_0xe4e4('0x2f')](_0x16f425[_0xe4e4('0x30')]);_0x3df250[_0xe4e4('0x3b')]=_[_0xe4e4('0x31')](_0x3df250[_0xe4e4('0x2e')],_0x3df250['query']);_0x569a3c['attributes']=_[_0xe4e4('0x31')](_0x3df250[_0xe4e4('0x2e')],qs['fields'](_0x16f425[_0xe4e4('0x30')][_0xe4e4('0x33')]));_0x569a3c[_0xe4e4('0x32')]=_0x569a3c['attributes'][_0xe4e4('0x34')]?_0x569a3c['attributes']:_0x3df250['model'];if(_0x16f425['query'][_0xe4e4('0x40')]){_0x569a3c[_0xe4e4('0x45')]=[{'all':!![]}];}_0x569a3c=_[_0xe4e4('0x3d')]({},_0x569a3c,_0x16f425[_0xe4e4('0x46')]);return db[_0xe4e4('0x2a')][_0xe4e4('0x47')](_0x569a3c)[_0xe4e4('0x22')](handleEntityNotFound(_0x2c9d1c,null))[_0xe4e4('0x22')](respondWithResult(_0x2c9d1c,null))[_0xe4e4('0x42')](handleError(_0x2c9d1c,null));};exports[_0xe4e4('0x48')]=function(_0x5d5ed0,_0x261b63){return db[_0xe4e4('0x2a')]['create'](_0x5d5ed0['body'],{})[_0xe4e4('0x22')](respondWithResult(_0x261b63,0xc9))[_0xe4e4('0x42')](handleError(_0x261b63,null));};exports['update']=function(_0x21d42a,_0x499092){if(_0x21d42a[_0xe4e4('0x49')]['id']){delete _0x21d42a[_0xe4e4('0x49')]['id'];}return db[_0xe4e4('0x2a')]['find']({'where':{'id':_0x21d42a[_0xe4e4('0x43')]['id']}})[_0xe4e4('0x22')](handleEntityNotFound(_0x499092,null))['then'](saveUpdates(_0x21d42a[_0xe4e4('0x49')],null))['then'](respondWithResult(_0x499092,null))[_0xe4e4('0x42')](handleError(_0x499092,null));};exports[_0xe4e4('0x23')]=function(_0x453da4,_0x14e772){return db[_0xe4e4('0x2a')]['find']({'where':{'id':_0x453da4[_0xe4e4('0x43')]['id']}})[_0xe4e4('0x22')](handleEntityNotFound(_0x14e772,null))[_0xe4e4('0x22')](removeEntity(_0x14e772,null))['catch'](handleError(_0x14e772,null));}; \ No newline at end of file +var _0xc678=['mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','end','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','options','where','includeAll','findAll','rows','catch','params','fields','include','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x449559,_0x423b34){var _0x2930e5=function(_0x43bc2a){while(--_0x43bc2a){_0x449559['push'](_0x449559['shift']());}};_0x2930e5(++_0x423b34);}(_0xc678,0x125));var _0x8c67=function(_0x230174,_0x491658){_0x230174=_0x230174-0x0;var _0x398cfb=_0xc678[_0x230174];return _0x398cfb;};'use strict';var pdf=require(_0x8c67('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8c67('0x1'));var zipdir=require(_0x8c67('0x2'));var jsonpatch=require(_0x8c67('0x3'));var rp=require(_0x8c67('0x4'));var moment=require(_0x8c67('0x5'));var BPromise=require(_0x8c67('0x6'));var Mustache=require(_0x8c67('0x7'));var util=require(_0x8c67('0x8'));var path=require(_0x8c67('0x9'));var sox=require(_0x8c67('0xa'));var csv=require(_0x8c67('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8c67('0xc'));var squel=require(_0x8c67('0xd'));var crypto=require(_0x8c67('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8c67('0xf'));var toCsv=require(_0x8c67('0xb'));var querystring=require(_0x8c67('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8c67('0x11'));var qs=require(_0x8c67('0x12'));var as=require(_0x8c67('0x13'));var hardwareService=require(_0x8c67('0x14'));var logger=require(_0x8c67('0x15'))(_0x8c67('0x16'));var utils=require(_0x8c67('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8c67('0x18'));var db=require(_0x8c67('0x19'))['db'];function respondWithStatusCode(_0x94b04f,_0x2b7794){_0x2b7794=_0x2b7794||0xcc;return function(_0x17e179){if(_0x17e179){return _0x94b04f[_0x8c67('0x1a')](_0x2b7794);}return _0x94b04f[_0x8c67('0x1b')](_0x2b7794)['end']();};}function respondWithResult(_0x1c9afa,_0x3e5de8){_0x3e5de8=_0x3e5de8||0xc8;return function(_0x22ed01){if(_0x22ed01){return _0x1c9afa['status'](_0x3e5de8)['json'](_0x22ed01);}};}function respondWithFilteredResult(_0x270898,_0x36afde){return function(_0x343076){if(_0x343076){var _0x417c5f=_0x343076[_0x8c67('0x1c')],_0x41f070=_0x36afde[_0x8c67('0x1d')],_0xe08f0c=_0x36afde[_0x8c67('0x1d')]+_0x36afde[_0x8c67('0x1e')],_0x2eb243;if(_0xe08f0c>=_0x417c5f){_0xe08f0c=_0x417c5f;_0x2eb243=0xc8;}else{_0x2eb243=0xce;}_0x270898[_0x8c67('0x1b')](_0x2eb243);return _0x270898[_0x8c67('0x1f')](_0x8c67('0x20'),_0x41f070+'-'+_0xe08f0c+'/'+_0x417c5f)[_0x8c67('0x21')](_0x343076);}return null;};}function patchUpdates(_0x480d34){return function(_0x5e0985){try{jsonpatch[_0x8c67('0x22')](_0x5e0985,_0x480d34,!![]);}catch(_0x422a1f){return BPromise['reject'](_0x422a1f);}return _0x5e0985[_0x8c67('0x23')]();};}function saveUpdates(_0x1566ad,_0x580dfe){return function(_0xadf0d0){if(_0xadf0d0){return _0xadf0d0[_0x8c67('0x24')](_0x1566ad)[_0x8c67('0x25')](function(_0x10165d){return _0x10165d;});}return null;};}function removeEntity(_0x354bae,_0x3562f1){return function(_0x40e706){if(_0x40e706){return _0x40e706[_0x8c67('0x26')]()[_0x8c67('0x25')](function(){_0x354bae[_0x8c67('0x1b')](0xcc)[_0x8c67('0x27')]();});}};}function handleEntityNotFound(_0x3e80ac,_0x25589a){return function(_0x56078e){if(!_0x56078e){_0x3e80ac[_0x8c67('0x1a')](0x194);}return _0x56078e;};}function handleError(_0xa1d335,_0x58d638){_0x58d638=_0x58d638||0x1f4;return function(_0x1c6af7){logger['error'](_0x1c6af7[_0x8c67('0x28')]);if(_0x1c6af7[_0x8c67('0x29')]){delete _0x1c6af7['name'];}_0xa1d335[_0x8c67('0x1b')](_0x58d638)[_0x8c67('0x2a')](_0x1c6af7);};}exports[_0x8c67('0x2b')]=function(_0xee621b,_0x378e5c){var _0x3f303c={},_0x1d0e91={},_0x280be4={'count':0x0,'rows':[]};var _0x3f3def=_[_0x8c67('0x2c')](db[_0x8c67('0x2d')][_0x8c67('0x2e')],function(_0x21461d){return{'name':_0x21461d[_0x8c67('0x2f')],'type':_0x21461d[_0x8c67('0x30')][_0x8c67('0x31')]};});_0x1d0e91[_0x8c67('0x32')]=_[_0x8c67('0x2c')](_0x3f3def,_0x8c67('0x29'));_0x1d0e91['query']=_[_0x8c67('0x33')](_0xee621b[_0x8c67('0x34')]);_0x1d0e91[_0x8c67('0x35')]=_[_0x8c67('0x36')](_0x1d0e91['model'],_0x1d0e91[_0x8c67('0x34')]);_0x3f303c[_0x8c67('0x37')]=_['intersection'](_0x1d0e91[_0x8c67('0x32')],qs['fields'](_0xee621b['query']['fields']));_0x3f303c[_0x8c67('0x37')]=_0x3f303c['attributes'][_0x8c67('0x38')]?_0x3f303c['attributes']:_0x1d0e91[_0x8c67('0x32')];if(!_0xee621b['query'][_0x8c67('0x39')](_0x8c67('0x3a'))){_0x3f303c[_0x8c67('0x1e')]=qs[_0x8c67('0x1e')](_0xee621b[_0x8c67('0x34')][_0x8c67('0x1e')]);_0x3f303c[_0x8c67('0x1d')]=qs[_0x8c67('0x1d')](_0xee621b[_0x8c67('0x34')]['offset']);}_0x3f303c[_0x8c67('0x3b')]=qs['sort'](_0xee621b[_0x8c67('0x34')][_0x8c67('0x3c')]);_0x3f303c['where']=qs[_0x8c67('0x35')](_['pick'](_0xee621b[_0x8c67('0x34')],_0x1d0e91[_0x8c67('0x35')]),_0x3f3def);if(_0xee621b[_0x8c67('0x34')][_0x8c67('0x3d')]){_0x3f303c['where']=_[_0x8c67('0x3e')](_0x3f303c['where'],{'$or':_[_0x8c67('0x2c')](_0x3f3def,function(_0x2f3f5f){if(_0x2f3f5f[_0x8c67('0x30')]!=='VIRTUAL'){var _0x2e8488={};_0x2e8488[_0x2f3f5f[_0x8c67('0x29')]]={'$like':'%'+_0xee621b[_0x8c67('0x34')]['filter']+'%'};return _0x2e8488;}})});}_0x3f303c=_['merge']({},_0x3f303c,_0xee621b[_0x8c67('0x3f')]);var _0x4b872e={'where':_0x3f303c[_0x8c67('0x40')]};return db[_0x8c67('0x2d')][_0x8c67('0x1c')](_0x4b872e)['then'](function(_0x16511e){_0x280be4[_0x8c67('0x1c')]=_0x16511e;if(_0xee621b[_0x8c67('0x34')][_0x8c67('0x41')]){_0x3f303c['include']=[{'all':!![]}];}return db[_0x8c67('0x2d')][_0x8c67('0x42')](_0x3f303c);})[_0x8c67('0x25')](function(_0x2d4de8){_0x280be4[_0x8c67('0x43')]=_0x2d4de8;return _0x280be4;})['then'](respondWithFilteredResult(_0x378e5c,_0x3f303c))[_0x8c67('0x44')](handleError(_0x378e5c,null));};exports['show']=function(_0x4fcb6f,_0x2d5b11){var _0x1270a1={'raw':!![],'where':{'id':_0x4fcb6f[_0x8c67('0x45')]['id']}},_0x1d011f={};_0x1d011f[_0x8c67('0x32')]=_[_0x8c67('0x33')](db[_0x8c67('0x2d')][_0x8c67('0x2e')]);_0x1d011f[_0x8c67('0x34')]=_[_0x8c67('0x33')](_0x4fcb6f[_0x8c67('0x34')]);_0x1d011f[_0x8c67('0x35')]=_[_0x8c67('0x36')](_0x1d011f[_0x8c67('0x32')],_0x1d011f[_0x8c67('0x34')]);_0x1270a1[_0x8c67('0x37')]=_[_0x8c67('0x36')](_0x1d011f[_0x8c67('0x32')],qs[_0x8c67('0x46')](_0x4fcb6f['query']['fields']));_0x1270a1[_0x8c67('0x37')]=_0x1270a1['attributes']['length']?_0x1270a1[_0x8c67('0x37')]:_0x1d011f[_0x8c67('0x32')];if(_0x4fcb6f[_0x8c67('0x34')][_0x8c67('0x41')]){_0x1270a1[_0x8c67('0x47')]=[{'all':!![]}];}_0x1270a1=_['merge']({},_0x1270a1,_0x4fcb6f[_0x8c67('0x3f')]);return db[_0x8c67('0x2d')][_0x8c67('0x48')](_0x1270a1)[_0x8c67('0x25')](handleEntityNotFound(_0x2d5b11,null))[_0x8c67('0x25')](respondWithResult(_0x2d5b11,null))[_0x8c67('0x44')](handleError(_0x2d5b11,null));};exports[_0x8c67('0x49')]=function(_0x173f12,_0x3aa38c){return db[_0x8c67('0x2d')][_0x8c67('0x49')](_0x173f12[_0x8c67('0x4a')],{})[_0x8c67('0x25')](respondWithResult(_0x3aa38c,0xc9))[_0x8c67('0x44')](handleError(_0x3aa38c,null));};exports[_0x8c67('0x24')]=function(_0x7930db,_0x4c5ff4){if(_0x7930db[_0x8c67('0x4a')]['id']){delete _0x7930db[_0x8c67('0x4a')]['id'];}return db[_0x8c67('0x2d')][_0x8c67('0x48')]({'where':{'id':_0x7930db['params']['id']}})[_0x8c67('0x25')](handleEntityNotFound(_0x4c5ff4,null))['then'](saveUpdates(_0x7930db[_0x8c67('0x4a')],null))[_0x8c67('0x25')](respondWithResult(_0x4c5ff4,null))[_0x8c67('0x44')](handleError(_0x4c5ff4,null));};exports[_0x8c67('0x26')]=function(_0x3c2ae8,_0x48ab80){return db['AnalyticTreeReport'][_0x8c67('0x48')]({'where':{'id':_0x3c2ae8[_0x8c67('0x45')]['id']}})[_0x8c67('0x25')](handleEntityNotFound(_0x48ab80,null))[_0x8c67('0x25')](removeEntity(_0x48ab80,null))[_0x8c67('0x44')](handleError(_0x48ab80,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index ec2a688..7311d40 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 _0x8411=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x8411,0x118));var _0x1841=function(_0x1a99cb,_0x23c826){_0x1a99cb=_0x1a99cb-0x0;var _0xe981e8=_0x8411[_0x1a99cb];return _0xe981e8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1841('0x0'))(_0x1841('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1841('0x2'));var fs=require('fs');var path=require(_0x1841('0x3'));var rimraf=require(_0x1841('0x4'));var config=require(_0x1841('0x5'));var attributes=require(_0x1841('0x6'));module['exports']=function(_0x3432f2,_0x54a581){return _0x3432f2[_0x1841('0x7')](_0x1841('0x8'),attributes,{'tableName':_0x1841('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5430=['../../config/logger','api','moment','bluebird','rimraf','exports','define','AnalyticTreeReport','lodash','util'];(function(_0x5948f2,_0x49d702){var _0x3256b0=function(_0x2da014){while(--_0x2da014){_0x5948f2['push'](_0x5948f2['shift']());}};_0x3256b0(++_0x49d702);}(_0x5430,0x10c));var _0x0543=function(_0x347c57,_0x17bfcc){_0x347c57=_0x347c57-0x0;var _0x2f65b4=_0x5430[_0x347c57];return _0x2f65b4;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var logger=require(_0x0543('0x2'))(_0x0543('0x3'));var moment=require(_0x0543('0x4'));var BPromise=require(_0x0543('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0543('0x6'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x0543('0x7')]=function(_0x45b909,_0x9754ba){return _0x45b909[_0x0543('0x8')](_0x0543('0x9'),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 019cbe6..b015534 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 _0x73b0=['jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x5a86c1,_0x30b562){var _0x24abbf=function(_0x5463cb){while(--_0x5463cb){_0x5a86c1['push'](_0x5a86c1['shift']());}};_0x24abbf(++_0x30b562);}(_0x73b0,0x1d9));var _0x073b=function(_0x5443c6,_0x544e39){_0x5443c6=_0x5443c6-0x0;var _0x2a0bab=_0x73b0[_0x5443c6];return _0x2a0bab;};'use strict';var _=require(_0x073b('0x0'));var util=require(_0x073b('0x1'));var moment=require(_0x073b('0x2'));var BPromise=require(_0x073b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x073b('0x4'));var db=require(_0x073b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x073b('0x6'));var config=require('../../config/environment');var jayson=require(_0x073b('0x7'));var client=jayson[_0x073b('0x8')][_0x073b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a6372,_0x2ac2ec,_0x2f36bd){return new BPromise(function(_0x44f641,_0x5e6d99){return client[_0x073b('0xa')](_0x3a6372,_0x2f36bd)[_0x073b('0xb')](function(_0xe97c4b){logger[_0x073b('0xc')](_0x073b('0xd'),_0x2ac2ec,'request\x20sent');logger[_0x073b('0xe')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x2ac2ec,'request\x20sent',JSON[_0x073b('0xf')](_0xe97c4b));if(_0xe97c4b[_0x073b('0x10')]){if(_0xe97c4b['error'][_0x073b('0x11')]===0x1f4){logger[_0x073b('0x10')](_0x073b('0xd'),_0x2ac2ec,_0xe97c4b['error'][_0x073b('0x12')]);return _0x5e6d99(_0xe97c4b[_0x073b('0x10')][_0x073b('0x12')]);}logger[_0x073b('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2ac2ec,_0xe97c4b[_0x073b('0x10')][_0x073b('0x12')]);return _0x44f641(_0xe97c4b['error'][_0x073b('0x12')]);}else{logger[_0x073b('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2ac2ec,_0x073b('0x13'));_0x44f641(_0xe97c4b['result']['message']);}})['catch'](function(_0x2b6e18){logger[_0x073b('0x10')](_0x073b('0xd'),_0x2ac2ec,_0x2b6e18);_0x5e6d99(_0x2b6e18);});});} \ No newline at end of file +var _0xc88f=['message','AnalyticTreeReport,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x9a2978,_0x3b3ea4){var _0x5c74f5=function(_0xd5ce7d){while(--_0xd5ce7d){_0x9a2978['push'](_0x9a2978['shift']());}};_0x5c74f5(++_0x3b3ea4);}(_0xc88f,0xbd));var _0xfc88=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc88f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfc88('0x0'));var util=require(_0xfc88('0x1'));var moment=require('moment');var BPromise=require(_0xfc88('0x2'));var rs=require(_0xfc88('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc88('0x4'))['db'];var utils=require(_0xfc88('0x5'));var logger=require(_0xfc88('0x6'))('rpc');var config=require(_0xfc88('0x7'));var jayson=require(_0xfc88('0x8'));var client=jayson[_0xfc88('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2398bb,_0x42a3e1,_0x3e3f37){return new BPromise(function(_0x3594c8,_0x55422d){return client[_0xfc88('0xa')](_0x2398bb,_0x3e3f37)[_0xfc88('0xb')](function(_0x57bf73){logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x42a3e1,'request\x20sent');logger[_0xfc88('0xc')](_0xfc88('0xd'),_0x42a3e1,_0xfc88('0xe'),JSON[_0xfc88('0xf')](_0x57bf73));if(_0x57bf73[_0xfc88('0x10')]){if(_0x57bf73[_0xfc88('0x10')][_0xfc88('0x11')]===0x1f4){logger[_0xfc88('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x42a3e1,_0x57bf73[_0xfc88('0x10')][_0xfc88('0x12')]);return _0x55422d(_0x57bf73[_0xfc88('0x10')][_0xfc88('0x12')]);}logger[_0xfc88('0x10')](_0xfc88('0x13'),_0x42a3e1,_0x57bf73[_0xfc88('0x10')][_0xfc88('0x12')]);return _0x3594c8(_0x57bf73['error'][_0xfc88('0x12')]);}else{logger[_0xfc88('0x14')](_0xfc88('0x13'),_0x42a3e1,'request\x20sent');_0x3594c8(_0x57bf73[_0xfc88('0x15')]['message']);}})[_0xfc88('0x16')](function(_0x1fc1dc){logger[_0xfc88('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x42a3e1,_0x1fc1dc);_0x55422d(_0x1fc1dc);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index f18008f..9b12b7f 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 _0xf456=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','util'];(function(_0x4b1122,_0xef5923){var _0x24b956=function(_0x4cc15e){while(--_0x4cc15e){_0x4b1122['push'](_0x4b1122['shift']());}};_0x24b956(++_0xef5923);}(_0xf456,0x168));var _0x6f45=function(_0x2ff16c,_0x42189c){_0x2ff16c=_0x2ff16c-0x0;var _0x2dd982=_0xf456[_0x2ff16c];return _0x2dd982;};'use strict';var multer=require('multer');var util=require(_0x6f45('0x0'));var path=require(_0x6f45('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f45('0x2'));var router=express[_0x6f45('0x3')]();var auth=require(_0x6f45('0x4'));var interaction=require(_0x6f45('0x5'));var config=require(_0x6f45('0x6'));var controller=require(_0x6f45('0x7'));router[_0x6f45('0x8')]('/',auth[_0x6f45('0x9')](),controller[_0x6f45('0xa')]);router[_0x6f45('0x8')]('/:id',auth[_0x6f45('0x9')](),controller[_0x6f45('0xb')]);router[_0x6f45('0xc')]('/',auth['isAuthenticated'](),controller[_0x6f45('0xd')]);router['put'](_0x6f45('0xe'),auth['isAuthenticated'](),controller[_0x6f45('0xf')]);router[_0x6f45('0x10')](_0x6f45('0xe'),auth[_0x6f45('0x9')](),controller[_0x6f45('0x11')]);module[_0x6f45('0x12')]=router; \ No newline at end of file +var _0xb0c2=['isAuthenticated','index','/:id','show','post','put','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xb0c2,0xd8));var _0x2b0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb0c2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2b0c('0x0'));var util=require(_0x2b0c('0x1'));var path=require(_0x2b0c('0x2'));var timeout=require(_0x2b0c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x2b0c('0x4'));var interaction=require(_0x2b0c('0x5'));var config=require(_0x2b0c('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x2b0c('0x7')]('/',auth[_0x2b0c('0x8')](),controller[_0x2b0c('0x9')]);router[_0x2b0c('0x7')](_0x2b0c('0xa'),auth[_0x2b0c('0x8')](),controller[_0x2b0c('0xb')]);router[_0x2b0c('0xc')]('/',auth[_0x2b0c('0x8')](),controller['create']);router[_0x2b0c('0xd')](_0x2b0c('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2b0c('0xe')]('/:id',auth[_0x2b0c('0x8')](),controller[_0x2b0c('0xf')]);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 9e9e8d4..8949341 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 _0x5da4=['STRING','sequelize','exports'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0x5da4,0x118));var _0x45da=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5da4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x45da('0x0'));module[_0x45da('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x45da('0x2')]},'type':{'type':Sequelize[_0x45da('0x2')]}}; \ No newline at end of file +var _0x7c34=['exports','STRING','sequelize'];(function(_0x5de85c,_0x67c18e){var _0x515b90=function(_0x1a5cf4){while(--_0x1a5cf4){_0x5de85c['push'](_0x5de85c['shift']());}};_0x515b90(++_0x67c18e);}(_0x7c34,0x11c));var _0x47c3=function(_0x88f33a,_0x2fa07f){_0x88f33a=_0x88f33a-0x0;var _0x57626c=_0x7c34[_0x88f33a];return _0x57626c;};'use strict';var Sequelize=require(_0x47c3('0x0'));module[_0x47c3('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x47c3('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 71c2604..83f4d99 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 _0xe4ba=['Content-Range','reject','save','destroy','then','sendStatus','stack','name','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','options','Attachment','include','findAll','rows','show','params','keys','includeAll','merge','catch','rawAttributes','get','omit','createdAt','updatedAt','body','create','find','file','originalname','filename','mimetype','download','join','root','basename','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','count','offset','set'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xe4ba,0x175));var _0xae4b=function(_0x346060,_0x1cab15){_0x346060=_0x346060-0x0;var _0x37289b=_0xe4ba[_0x346060];return _0x37289b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae4b('0x0'));var rimraf=require(_0xae4b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae4b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xae4b('0x3'));var Mustache=require('mustache');var util=require(_0xae4b('0x4'));var path=require(_0xae4b('0x5'));var sox=require(_0xae4b('0x6'));var csv=require(_0xae4b('0x7'));var ejs=require(_0xae4b('0x8'));var fs=require('fs');var _=require(_0xae4b('0x9'));var squel=require(_0xae4b('0xa'));var crypto=require('crypto');var jsforce=require(_0xae4b('0xb'));var deskjs=require(_0xae4b('0xc'));var toCsv=require(_0xae4b('0x7'));var querystring=require(_0xae4b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xae4b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xae4b('0xf'));var hardwareService=require(_0xae4b('0x10'));var logger=require(_0xae4b('0x11'))(_0xae4b('0x12'));var utils=require('../../config/utils');var config=require(_0xae4b('0x13'));var licenseUtil=require(_0xae4b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5692ed,_0x57e89b){_0x57e89b=_0x57e89b||0xcc;return function(_0x4d33ba){if(_0x4d33ba){return _0x5692ed['sendStatus'](_0x57e89b);}return _0x5692ed[_0xae4b('0x15')](_0x57e89b)[_0xae4b('0x16')]();};}function respondWithResult(_0x16b4b8,_0x360070){_0x360070=_0x360070||0xc8;return function(_0x46d02a){if(_0x46d02a){return _0x16b4b8['status'](_0x360070)[_0xae4b('0x17')](_0x46d02a);}};}function respondWithFilteredResult(_0xc8c213,_0x21cea0){return function(_0x4b6c81){if(_0x4b6c81){var _0x19d276=_0x4b6c81[_0xae4b('0x18')],_0x262075=_0x21cea0['offset'],_0x11ea2b=_0x21cea0[_0xae4b('0x19')]+_0x21cea0['limit'],_0x5d0819;if(_0x11ea2b>=_0x19d276){_0x11ea2b=_0x19d276;_0x5d0819=0xc8;}else{_0x5d0819=0xce;}_0xc8c213[_0xae4b('0x15')](_0x5d0819);return _0xc8c213[_0xae4b('0x1a')](_0xae4b('0x1b'),_0x262075+'-'+_0x11ea2b+'/'+_0x19d276)[_0xae4b('0x17')](_0x4b6c81);}return null;};}function patchUpdates(_0x4380df){return function(_0x1b8771){try{jsonpatch['apply'](_0x1b8771,_0x4380df,!![]);}catch(_0x3581a8){return BPromise[_0xae4b('0x1c')](_0x3581a8);}return _0x1b8771[_0xae4b('0x1d')]();};}function saveUpdates(_0x40e64e,_0xc30357){return function(_0x232602){if(_0x232602){return _0x232602['update'](_0x40e64e)['then'](function(_0x1b7ba6){return _0x1b7ba6;});}return null;};}function removeEntity(_0x3d3777,_0x10f23d){return function(_0xba3129){if(_0xba3129){return _0xba3129[_0xae4b('0x1e')]()[_0xae4b('0x1f')](function(){_0x3d3777[_0xae4b('0x15')](0xcc)[_0xae4b('0x16')]();});}};}function handleEntityNotFound(_0x4cdfc8,_0x2054e6){return function(_0x488563){if(!_0x488563){_0x4cdfc8[_0xae4b('0x20')](0x194);}return _0x488563;};}function handleError(_0x5215cd,_0x4c08da){_0x4c08da=_0x4c08da||0x1f4;return function(_0x105ea5){logger['error'](_0x105ea5[_0xae4b('0x21')]);if(_0x105ea5['name']){delete _0x105ea5[_0xae4b('0x22')];}_0x5215cd['status'](_0x4c08da)['send'](_0x105ea5);};}exports['index']=function(_0x2d366e,_0x12d4fa){var _0x355db6={},_0x5bcd3a={},_0x358e17={'count':0x0,'rows':[]};var _0x1133de=_['map'](db['Attachment']['rawAttributes'],function(_0x498aee){return{'name':_0x498aee[_0xae4b('0x23')],'type':_0x498aee[_0xae4b('0x24')][_0xae4b('0x25')]};});_0x5bcd3a['model']=_[_0xae4b('0x26')](_0x1133de,_0xae4b('0x22'));_0x5bcd3a[_0xae4b('0x27')]=_['keys'](_0x2d366e[_0xae4b('0x27')]);_0x5bcd3a[_0xae4b('0x28')]=_[_0xae4b('0x29')](_0x5bcd3a[_0xae4b('0x2a')],_0x5bcd3a[_0xae4b('0x27')]);_0x355db6['attributes']=_[_0xae4b('0x29')](_0x5bcd3a[_0xae4b('0x2a')],qs['fields'](_0x2d366e[_0xae4b('0x27')][_0xae4b('0x2b')]));_0x355db6[_0xae4b('0x2c')]=_0x355db6[_0xae4b('0x2c')][_0xae4b('0x2d')]?_0x355db6[_0xae4b('0x2c')]:_0x5bcd3a[_0xae4b('0x2a')];if(!_0x2d366e[_0xae4b('0x27')][_0xae4b('0x2e')](_0xae4b('0x2f'))){_0x355db6[_0xae4b('0x30')]=qs['limit'](_0x2d366e['query'][_0xae4b('0x30')]);_0x355db6[_0xae4b('0x19')]=qs[_0xae4b('0x19')](_0x2d366e[_0xae4b('0x27')]['offset']);}_0x355db6['order']=qs[_0xae4b('0x31')](_0x2d366e['query'][_0xae4b('0x31')]);_0x355db6[_0xae4b('0x32')]=qs[_0xae4b('0x28')](_[_0xae4b('0x33')](_0x2d366e[_0xae4b('0x27')],_0x5bcd3a[_0xae4b('0x28')]),_0x1133de);if(_0x2d366e[_0xae4b('0x27')][_0xae4b('0x34')]){_0x355db6['where']=_['merge'](_0x355db6[_0xae4b('0x32')],{'$or':_[_0xae4b('0x26')](_0x1133de,function(_0x4fab8){if(_0x4fab8[_0xae4b('0x24')]!=='VIRTUAL'){var _0xe458fc={};_0xe458fc[_0x4fab8[_0xae4b('0x22')]]={'$like':'%'+_0x2d366e['query'][_0xae4b('0x34')]+'%'};return _0xe458fc;}})});}_0x355db6=_['merge']({},_0x355db6,_0x2d366e[_0xae4b('0x35')]);var _0xaf369d={'where':_0x355db6[_0xae4b('0x32')]};return db[_0xae4b('0x36')][_0xae4b('0x18')](_0xaf369d)[_0xae4b('0x1f')](function(_0x18b2d1){_0x358e17['count']=_0x18b2d1;if(_0x2d366e[_0xae4b('0x27')]['includeAll']){_0x355db6[_0xae4b('0x37')]=[{'all':!![]}];}return db[_0xae4b('0x36')][_0xae4b('0x38')](_0x355db6);})[_0xae4b('0x1f')](function(_0x17395b){_0x358e17[_0xae4b('0x39')]=_0x17395b;return _0x358e17;})[_0xae4b('0x1f')](respondWithFilteredResult(_0x12d4fa,_0x355db6))['catch'](handleError(_0x12d4fa,null));};exports[_0xae4b('0x3a')]=function(_0x13afbe,_0xbbab9){var _0x26dc54={'raw':!![],'where':{'id':_0x13afbe[_0xae4b('0x3b')]['id']}},_0x10d8fe={};_0x10d8fe[_0xae4b('0x2a')]=_['keys'](db['Attachment']['rawAttributes']);_0x10d8fe[_0xae4b('0x27')]=_[_0xae4b('0x3c')](_0x13afbe['query']);_0x10d8fe[_0xae4b('0x28')]=_[_0xae4b('0x29')](_0x10d8fe[_0xae4b('0x2a')],_0x10d8fe[_0xae4b('0x27')]);_0x26dc54[_0xae4b('0x2c')]=_[_0xae4b('0x29')](_0x10d8fe['model'],qs[_0xae4b('0x2b')](_0x13afbe[_0xae4b('0x27')][_0xae4b('0x2b')]));_0x26dc54[_0xae4b('0x2c')]=_0x26dc54[_0xae4b('0x2c')][_0xae4b('0x2d')]?_0x26dc54['attributes']:_0x10d8fe['model'];if(_0x13afbe[_0xae4b('0x27')][_0xae4b('0x3d')]){_0x26dc54[_0xae4b('0x37')]=[{'all':!![]}];}_0x26dc54=_[_0xae4b('0x3e')]({},_0x26dc54,_0x13afbe[_0xae4b('0x35')]);return db[_0xae4b('0x36')]['find'](_0x26dc54)[_0xae4b('0x1f')](handleEntityNotFound(_0xbbab9,null))[_0xae4b('0x1f')](respondWithResult(_0xbbab9,null))[_0xae4b('0x3f')](handleError(_0xbbab9,null));};exports['clone']=function(_0x44c252,_0x25c03a){var _0x54589d={'where':{'id':_0x44c252[_0xae4b('0x3b')]['id']}},_0xfd6faa={};_0xfd6faa[_0xae4b('0x2a')]=_[_0xae4b('0x3c')](db[_0xae4b('0x36')][_0xae4b('0x40')]);_0x54589d[_0xae4b('0x2c')]=_[_0xae4b('0x29')](_0xfd6faa[_0xae4b('0x2a')],qs[_0xae4b('0x2b')](_0x44c252['query'][_0xae4b('0x2b')]));_0x54589d[_0xae4b('0x2c')]=_0x54589d[_0xae4b('0x2c')][_0xae4b('0x2d')]?_0x54589d[_0xae4b('0x2c')]:_0xfd6faa['model'];if(_0x44c252[_0xae4b('0x27')]['includeAll']){_0x54589d[_0xae4b('0x37')]=[{'all':!![]}];}_0x54589d=_[_0xae4b('0x3e')]({},_0x54589d,_0x44c252[_0xae4b('0x35')]);return db[_0xae4b('0x36')]['find'](_0x54589d)[_0xae4b('0x1f')](handleEntityNotFound(_0x25c03a,null))[_0xae4b('0x1f')](function(_0x3dda1d){if(_0x3dda1d){var _0x3d0d5d=_0x3dda1d[_0xae4b('0x41')]({'plain':!![]});_0x3d0d5d=qs[_0xae4b('0x42')](_0x3d0d5d,['id',_0xae4b('0x43'),_0xae4b('0x44')]);_0x44c252[_0xae4b('0x45')]=_[_0xae4b('0x42')](_0x44c252[_0xae4b('0x45')],['id',_0xae4b('0x43'),_0xae4b('0x44')]);return db['Attachment'][_0xae4b('0x46')](_[_0xae4b('0x3e')](_0x3d0d5d,_0x44c252['body']),{'include':_0x44c252[_0xae4b('0x27')][_0xae4b('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x25c03a,0xc9))[_0xae4b('0x3f')](handleError(_0x25c03a,null));};exports['update']=function(_0x564e6d,_0x4131a3){if(_0x564e6d[_0xae4b('0x45')]['id']){delete _0x564e6d[_0xae4b('0x45')]['id'];}return db[_0xae4b('0x36')][_0xae4b('0x47')]({'where':{'id':_0x564e6d[_0xae4b('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4131a3,null))['then'](saveUpdates(_0x564e6d['body'],null))[_0xae4b('0x1f')](respondWithResult(_0x4131a3,null))['catch'](handleError(_0x4131a3,null));};exports[_0xae4b('0x1e')]=function(_0x551ef9,_0x2ce3db){return db[_0xae4b('0x36')]['find']({'where':{'id':_0x551ef9[_0xae4b('0x3b')]['id']}})[_0xae4b('0x1f')](handleEntityNotFound(_0x2ce3db,null))['then'](removeEntity(_0x2ce3db,null))[_0xae4b('0x3f')](handleError(_0x2ce3db,null));};exports['create']=function(_0x6bdce5,_0x53dbde,_0x5a4fed){_0x6bdce5['body'][_0xae4b('0x22')]=_0x6bdce5[_0xae4b('0x48')][_0xae4b('0x49')];_0x6bdce5['body']['basename']=_0x6bdce5[_0xae4b('0x48')][_0xae4b('0x4a')];_0x6bdce5['body'][_0xae4b('0x24')]=_0x6bdce5['file'][_0xae4b('0x4b')];return db[_0xae4b('0x36')][_0xae4b('0x46')](_0x6bdce5[_0xae4b('0x45')])[_0xae4b('0x1f')](respondWithResult(_0x53dbde,0xc9))[_0xae4b('0x3f')](handleError(_0x53dbde,null));};exports[_0xae4b('0x4c')]=function(_0x533e98,_0x21ba21,_0x21f5f3){return db[_0xae4b('0x36')]['findOne']({'where':{'id':_0x533e98[_0xae4b('0x3b')]['id']},'raw':!![]})[_0xae4b('0x1f')](handleEntityNotFound(_0x21ba21,null))[_0xae4b('0x1f')](function(_0x1b9445){if(_0x1b9445){return _0x21ba21[_0xae4b('0x4c')](path[_0xae4b('0x4d')](config[_0xae4b('0x4e')],'server/files/attachments/',_0x1b9445[_0xae4b('0x4f')]));}})[_0xae4b('0x3f')](handleError(_0x21ba21,null));}; \ No newline at end of file +var _0x0135=['createdAt','updatedAt','body','create','file','mimetype','download','join','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','pick','merge','options','where','Attachment','include','findAll','catch','params','includeAll','find','clone','get','omit'];(function(_0x58a083,_0x58aad7){var _0x523a42=function(_0x1d5c59){while(--_0x1d5c59){_0x58a083['push'](_0x58a083['shift']());}};_0x523a42(++_0x58aad7);}(_0x0135,0xa9));var _0x5013=function(_0x4ecb40,_0x15ab76){_0x4ecb40=_0x4ecb40-0x0;var _0x22d86d=_0x0135[_0x4ecb40];return _0x22d86d;};'use strict';var pdf=require(_0x5013('0x0'));var emlformat=require(_0x5013('0x1'));var rimraf=require(_0x5013('0x2'));var zipdir=require(_0x5013('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5013('0x4'));var moment=require(_0x5013('0x5'));var BPromise=require(_0x5013('0x6'));var Mustache=require(_0x5013('0x7'));var util=require(_0x5013('0x8'));var path=require(_0x5013('0x9'));var sox=require(_0x5013('0xa'));var csv=require(_0x5013('0xb'));var ejs=require(_0x5013('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5013('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5013('0xe'));var Papa=require(_0x5013('0xf'));var Redis=require(_0x5013('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5013('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5013('0x12'));var logger=require(_0x5013('0x13'))(_0x5013('0x14'));var utils=require(_0x5013('0x15'));var config=require(_0x5013('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5013('0x17'))['db'];function respondWithStatusCode(_0xf94446,_0x3af491){_0x3af491=_0x3af491||0xcc;return function(_0x2f1fca){if(_0x2f1fca){return _0xf94446[_0x5013('0x18')](_0x3af491);}return _0xf94446[_0x5013('0x19')](_0x3af491)['end']();};}function respondWithResult(_0x26bb38,_0x2fec09){_0x2fec09=_0x2fec09||0xc8;return function(_0x2cefbb){if(_0x2cefbb){return _0x26bb38['status'](_0x2fec09)[_0x5013('0x1a')](_0x2cefbb);}};}function respondWithFilteredResult(_0x211bbe,_0x82e55a){return function(_0x381c46){if(_0x381c46){var _0x1fd600=_0x381c46[_0x5013('0x1b')],_0x223e20=_0x82e55a['offset'],_0xa813b0=_0x82e55a['offset']+_0x82e55a[_0x5013('0x1c')],_0x3abe3f;if(_0xa813b0>=_0x1fd600){_0xa813b0=_0x1fd600;_0x3abe3f=0xc8;}else{_0x3abe3f=0xce;}_0x211bbe[_0x5013('0x19')](_0x3abe3f);return _0x211bbe[_0x5013('0x1d')]('Content-Range',_0x223e20+'-'+_0xa813b0+'/'+_0x1fd600)[_0x5013('0x1a')](_0x381c46);}return null;};}function patchUpdates(_0x4c8172){return function(_0x349c9c){try{jsonpatch['apply'](_0x349c9c,_0x4c8172,!![]);}catch(_0x201b8c){return BPromise[_0x5013('0x1e')](_0x201b8c);}return _0x349c9c[_0x5013('0x1f')]();};}function saveUpdates(_0x305467,_0x3179ad){return function(_0x5d7a18){if(_0x5d7a18){return _0x5d7a18[_0x5013('0x20')](_0x305467)[_0x5013('0x21')](function(_0x352df6){return _0x352df6;});}return null;};}function removeEntity(_0x22aab0,_0x239634){return function(_0x24438f){if(_0x24438f){return _0x24438f[_0x5013('0x22')]()['then'](function(){_0x22aab0[_0x5013('0x19')](0xcc)[_0x5013('0x23')]();});}};}function handleEntityNotFound(_0x281fad,_0x1c9dbd){return function(_0x2a66a9){if(!_0x2a66a9){_0x281fad['sendStatus'](0x194);}return _0x2a66a9;};}function handleError(_0x2eaa3b,_0x28a509){_0x28a509=_0x28a509||0x1f4;return function(_0x4f6f0d){logger['error'](_0x4f6f0d[_0x5013('0x24')]);if(_0x4f6f0d['name']){delete _0x4f6f0d[_0x5013('0x25')];}_0x2eaa3b[_0x5013('0x19')](_0x28a509)[_0x5013('0x26')](_0x4f6f0d);};}exports[_0x5013('0x27')]=function(_0x5a7749,_0x1d0f44){var _0x3bfd2e={},_0x1a6020={},_0x55681b={'count':0x0,'rows':[]};var _0x39eb27=_[_0x5013('0x28')](db['Attachment'][_0x5013('0x29')],function(_0x22899a){return{'name':_0x22899a[_0x5013('0x2a')],'type':_0x22899a[_0x5013('0x2b')][_0x5013('0x2c')]};});_0x1a6020[_0x5013('0x2d')]=_[_0x5013('0x28')](_0x39eb27,_0x5013('0x25'));_0x1a6020[_0x5013('0x2e')]=_[_0x5013('0x2f')](_0x5a7749['query']);_0x1a6020[_0x5013('0x30')]=_[_0x5013('0x31')](_0x1a6020[_0x5013('0x2d')],_0x1a6020[_0x5013('0x2e')]);_0x3bfd2e[_0x5013('0x32')]=_[_0x5013('0x31')](_0x1a6020[_0x5013('0x2d')],qs[_0x5013('0x33')](_0x5a7749[_0x5013('0x2e')][_0x5013('0x33')]));_0x3bfd2e[_0x5013('0x32')]=_0x3bfd2e[_0x5013('0x32')][_0x5013('0x34')]?_0x3bfd2e[_0x5013('0x32')]:_0x1a6020[_0x5013('0x2d')];if(!_0x5a7749[_0x5013('0x2e')][_0x5013('0x35')](_0x5013('0x36'))){_0x3bfd2e[_0x5013('0x1c')]=qs[_0x5013('0x1c')](_0x5a7749[_0x5013('0x2e')][_0x5013('0x1c')]);_0x3bfd2e[_0x5013('0x37')]=qs['offset'](_0x5a7749['query'][_0x5013('0x37')]);}_0x3bfd2e['order']=qs['sort'](_0x5a7749[_0x5013('0x2e')][_0x5013('0x38')]);_0x3bfd2e['where']=qs[_0x5013('0x30')](_[_0x5013('0x39')](_0x5a7749[_0x5013('0x2e')],_0x1a6020[_0x5013('0x30')]),_0x39eb27);if(_0x5a7749[_0x5013('0x2e')]['filter']){_0x3bfd2e['where']=_[_0x5013('0x3a')](_0x3bfd2e['where'],{'$or':_[_0x5013('0x28')](_0x39eb27,function(_0x2e4fe9){if(_0x2e4fe9[_0x5013('0x2b')]!=='VIRTUAL'){var _0x537088={};_0x537088[_0x2e4fe9[_0x5013('0x25')]]={'$like':'%'+_0x5a7749[_0x5013('0x2e')]['filter']+'%'};return _0x537088;}})});}_0x3bfd2e=_[_0x5013('0x3a')]({},_0x3bfd2e,_0x5a7749[_0x5013('0x3b')]);var _0xa023a1={'where':_0x3bfd2e[_0x5013('0x3c')]};return db[_0x5013('0x3d')]['count'](_0xa023a1)[_0x5013('0x21')](function(_0x378fcc){_0x55681b[_0x5013('0x1b')]=_0x378fcc;if(_0x5a7749[_0x5013('0x2e')]['includeAll']){_0x3bfd2e[_0x5013('0x3e')]=[{'all':!![]}];}return db[_0x5013('0x3d')][_0x5013('0x3f')](_0x3bfd2e);})['then'](function(_0x1aac65){_0x55681b['rows']=_0x1aac65;return _0x55681b;})[_0x5013('0x21')](respondWithFilteredResult(_0x1d0f44,_0x3bfd2e))[_0x5013('0x40')](handleError(_0x1d0f44,null));};exports['show']=function(_0x1d5ec1,_0x1bc49a){var _0x5dac14={'raw':!![],'where':{'id':_0x1d5ec1[_0x5013('0x41')]['id']}},_0x3151e4={};_0x3151e4[_0x5013('0x2d')]=_[_0x5013('0x2f')](db[_0x5013('0x3d')][_0x5013('0x29')]);_0x3151e4[_0x5013('0x2e')]=_[_0x5013('0x2f')](_0x1d5ec1[_0x5013('0x2e')]);_0x3151e4[_0x5013('0x30')]=_[_0x5013('0x31')](_0x3151e4[_0x5013('0x2d')],_0x3151e4[_0x5013('0x2e')]);_0x5dac14[_0x5013('0x32')]=_[_0x5013('0x31')](_0x3151e4[_0x5013('0x2d')],qs[_0x5013('0x33')](_0x1d5ec1['query'][_0x5013('0x33')]));_0x5dac14[_0x5013('0x32')]=_0x5dac14['attributes'][_0x5013('0x34')]?_0x5dac14['attributes']:_0x3151e4[_0x5013('0x2d')];if(_0x1d5ec1[_0x5013('0x2e')][_0x5013('0x42')]){_0x5dac14[_0x5013('0x3e')]=[{'all':!![]}];}_0x5dac14=_[_0x5013('0x3a')]({},_0x5dac14,_0x1d5ec1['options']);return db[_0x5013('0x3d')][_0x5013('0x43')](_0x5dac14)[_0x5013('0x21')](handleEntityNotFound(_0x1bc49a,null))[_0x5013('0x21')](respondWithResult(_0x1bc49a,null))[_0x5013('0x40')](handleError(_0x1bc49a,null));};exports[_0x5013('0x44')]=function(_0x3a3f50,_0x13a77e){var _0xe5c28={'where':{'id':_0x3a3f50[_0x5013('0x41')]['id']}},_0x4c3a26={};_0x4c3a26[_0x5013('0x2d')]=_[_0x5013('0x2f')](db[_0x5013('0x3d')]['rawAttributes']);_0xe5c28[_0x5013('0x32')]=_['intersection'](_0x4c3a26['model'],qs[_0x5013('0x33')](_0x3a3f50['query'][_0x5013('0x33')]));_0xe5c28[_0x5013('0x32')]=_0xe5c28['attributes'][_0x5013('0x34')]?_0xe5c28[_0x5013('0x32')]:_0x4c3a26['model'];if(_0x3a3f50[_0x5013('0x2e')]['includeAll']){_0xe5c28[_0x5013('0x3e')]=[{'all':!![]}];}_0xe5c28=_[_0x5013('0x3a')]({},_0xe5c28,_0x3a3f50[_0x5013('0x3b')]);return db[_0x5013('0x3d')][_0x5013('0x43')](_0xe5c28)['then'](handleEntityNotFound(_0x13a77e,null))['then'](function(_0x2de226){if(_0x2de226){var _0x1a8611=_0x2de226[_0x5013('0x45')]({'plain':!![]});_0x1a8611=qs[_0x5013('0x46')](_0x1a8611,['id',_0x5013('0x47'),_0x5013('0x48')]);_0x3a3f50[_0x5013('0x49')]=_[_0x5013('0x46')](_0x3a3f50[_0x5013('0x49')],['id','createdAt',_0x5013('0x48')]);return db[_0x5013('0x3d')][_0x5013('0x4a')](_[_0x5013('0x3a')](_0x1a8611,_0x3a3f50['body']),{'include':_0x3a3f50[_0x5013('0x2e')][_0x5013('0x42')]?[{'all':!![]}]:undefined});}})[_0x5013('0x21')](respondWithResult(_0x13a77e,0xc9))['catch'](handleError(_0x13a77e,null));};exports[_0x5013('0x20')]=function(_0x255f54,_0x42531b){if(_0x255f54[_0x5013('0x49')]['id']){delete _0x255f54[_0x5013('0x49')]['id'];}return db['Attachment'][_0x5013('0x43')]({'where':{'id':_0x255f54[_0x5013('0x41')]['id']}})[_0x5013('0x21')](handleEntityNotFound(_0x42531b,null))['then'](saveUpdates(_0x255f54[_0x5013('0x49')],null))[_0x5013('0x21')](respondWithResult(_0x42531b,null))[_0x5013('0x40')](handleError(_0x42531b,null));};exports['destroy']=function(_0x465093,_0x3e8b0b){return db['Attachment'][_0x5013('0x43')]({'where':{'id':_0x465093[_0x5013('0x41')]['id']}})[_0x5013('0x21')](handleEntityNotFound(_0x3e8b0b,null))[_0x5013('0x21')](removeEntity(_0x3e8b0b,null))[_0x5013('0x40')](handleError(_0x3e8b0b,null));};exports['create']=function(_0x148b1e,_0x227324,_0x522298){_0x148b1e[_0x5013('0x49')]['name']=_0x148b1e[_0x5013('0x4b')]['originalname'];_0x148b1e[_0x5013('0x49')]['basename']=_0x148b1e[_0x5013('0x4b')]['filename'];_0x148b1e[_0x5013('0x49')][_0x5013('0x2b')]=_0x148b1e[_0x5013('0x4b')][_0x5013('0x4c')];return db[_0x5013('0x3d')][_0x5013('0x4a')](_0x148b1e['body'])[_0x5013('0x21')](respondWithResult(_0x227324,0xc9))[_0x5013('0x40')](handleError(_0x227324,null));};exports[_0x5013('0x4d')]=function(_0x31017d,_0x176e00,_0x58e384){return db[_0x5013('0x3d')]['findOne']({'where':{'id':_0x31017d[_0x5013('0x41')]['id']},'raw':!![]})[_0x5013('0x21')](handleEntityNotFound(_0x176e00,null))['then'](function(_0x4f7d5b){if(_0x4f7d5b){return _0x176e00[_0x5013('0x4d')](path[_0x5013('0x4e')](config['root'],_0x5013('0x4f'),_0x4f7d5b['basename']));}})[_0x5013('0x40')](handleError(_0x176e00,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index bc7c640..9b27ca0 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 _0xa35e=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment'];(function(_0x5bdee0,_0x40b482){var _0x1a7f2f=function(_0x1ac279){while(--_0x1ac279){_0x5bdee0['push'](_0x5bdee0['shift']());}};_0x1a7f2f(++_0x40b482);}(_0xa35e,0x111));var _0xea35=function(_0x16e705,_0x3c1245){_0x16e705=_0x16e705-0x0;var _0x1008fd=_0xa35e[_0x16e705];return _0x1008fd;};'use strict';var _=require(_0xea35('0x0'));var util=require('util');var logger=require(_0xea35('0x1'))(_0xea35('0x2'));var moment=require(_0xea35('0x3'));var BPromise=require(_0xea35('0x4'));var rp=require(_0xea35('0x5'));var fs=require('fs');var path=require(_0xea35('0x6'));var rimraf=require(_0xea35('0x7'));var config=require(_0xea35('0x8'));var attributes=require(_0xea35('0x9'));module[_0xea35('0xa')]=function(_0x3d2b41,_0x3dc645){return _0x3d2b41[_0xea35('0xb')](_0xea35('0xc'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0abf=['define','attachments','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x1d454e,_0x15e46c){var _0x4622df=function(_0x2153fb){while(--_0x2153fb){_0x1d454e['push'](_0x1d454e['shift']());}};_0x4622df(++_0x15e46c);}(_0x0abf,0xe8));var _0xf0ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0abf[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var logger=require(_0xf0ab('0x1'))(_0xf0ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf0ab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var attributes=require(_0xf0ab('0x6'));module[_0xf0ab('0x7')]=function(_0x2ab7d6,_0x4d2ea8){return _0x2ab7d6[_0xf0ab('0x8')]('Attachment',attributes,{'tableName':_0xf0ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 08289b9..57c9891 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 _0x2015=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','Attachment,\x20%s,\x20%s','message','info','result','catch','CreateAttachment','Attachment','body','options'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x2015,0x1d0));var _0x5201=function(_0xce1b62,_0x3688c5){_0xce1b62=_0xce1b62-0x0;var _0x19aca0=_0x2015[_0xce1b62];return _0x19aca0;};'use strict';var _=require(_0x5201('0x0'));var util=require(_0x5201('0x1'));var moment=require(_0x5201('0x2'));var BPromise=require(_0x5201('0x3'));var rs=require(_0x5201('0x4'));var fs=require('fs');var Redis=require(_0x5201('0x5'));var db=require(_0x5201('0x6'))['db'];var utils=require(_0x5201('0x7'));var logger=require(_0x5201('0x8'))('rpc');var config=require(_0x5201('0x9'));var jayson=require(_0x5201('0xa'));var client=jayson[_0x5201('0xb')][_0x5201('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x803edf,_0x4d74c9,_0x126536){return new BPromise(function(_0x5e8883,_0x55b4b3){return client[_0x5201('0xd')](_0x803edf,_0x126536)[_0x5201('0xe')](function(_0x403f87){logger['info']('Attachment,\x20%s,\x20%s',_0x4d74c9,_0x5201('0xf'));logger[_0x5201('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x4d74c9,_0x5201('0xf'),JSON[_0x5201('0x11')](_0x403f87));if(_0x403f87[_0x5201('0x12')]){if(_0x403f87[_0x5201('0x12')][_0x5201('0x13')]===0x1f4){logger[_0x5201('0x12')](_0x5201('0x14'),_0x4d74c9,_0x403f87[_0x5201('0x12')][_0x5201('0x15')]);return _0x55b4b3(_0x403f87[_0x5201('0x12')][_0x5201('0x15')]);}logger[_0x5201('0x12')](_0x5201('0x14'),_0x4d74c9,_0x403f87[_0x5201('0x12')][_0x5201('0x15')]);return _0x5e8883(_0x403f87[_0x5201('0x12')][_0x5201('0x15')]);}else{logger[_0x5201('0x16')](_0x5201('0x14'),_0x4d74c9,'request\x20sent');_0x5e8883(_0x403f87[_0x5201('0x17')][_0x5201('0x15')]);}})[_0x5201('0x18')](function(_0x101888){logger[_0x5201('0x12')](_0x5201('0x14'),_0x4d74c9,_0x101888);_0x55b4b3(_0x101888);});});}exports[_0x5201('0x19')]=function(_0x3cca){var _0x3958b4=this;return new Promise(function(_0x14b376,_0x271f5f){return db[_0x5201('0x1a')]['create'](_0x3cca[_0x5201('0x1b')],{'raw':_0x3cca[_0x5201('0x1c')]?_0x3cca[_0x5201('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x5201('0xe')](function(_0x4bd62d){logger[_0x5201('0x16')](_0x5201('0x19'),_0x3cca);logger[_0x5201('0x10')](_0x5201('0x19'),_0x3cca,JSON[_0x5201('0x11')](_0x4bd62d));_0x14b376(_0x4bd62d);})[_0x5201('0x18')](function(_0x361e3f){logger['error']('CreateAttachment',_0x361e3f[_0x5201('0x15')],_0x3cca);_0x271f5f(_0x3958b4['error'](0x1f4,_0x361e3f[_0x5201('0x15')]));});});}; \ No newline at end of file +var _0x008a=['CreateAttachment','Attachment','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x008a,0x17f));var _0xa008=function(_0x1b01c5,_0x2529f7){_0x1b01c5=_0x1b01c5-0x0;var _0x5c6d99=_0x008a[_0x1b01c5];return _0x5c6d99;};'use strict';var _=require(_0xa008('0x0'));var util=require(_0xa008('0x1'));var moment=require(_0xa008('0x2'));var BPromise=require(_0xa008('0x3'));var rs=require(_0xa008('0x4'));var fs=require('fs');var Redis=require(_0xa008('0x5'));var db=require(_0xa008('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa008('0x7'))(_0xa008('0x8'));var config=require('../../config/environment');var jayson=require(_0xa008('0x9'));var client=jayson[_0xa008('0xa')][_0xa008('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14f358,_0x2ce085,_0x46c923){return new BPromise(function(_0x44e083,_0xcd1e54){return client[_0xa008('0xc')](_0x14f358,_0x46c923)[_0xa008('0xd')](function(_0x21ca49){logger['info'](_0xa008('0xe'),_0x2ce085,'request\x20sent');logger[_0xa008('0xf')](_0xa008('0x10'),_0x2ce085,_0xa008('0x11'),JSON['stringify'](_0x21ca49));if(_0x21ca49[_0xa008('0x12')]){if(_0x21ca49[_0xa008('0x12')]['code']===0x1f4){logger[_0xa008('0x12')]('Attachment,\x20%s,\x20%s',_0x2ce085,_0x21ca49[_0xa008('0x12')][_0xa008('0x13')]);return _0xcd1e54(_0x21ca49[_0xa008('0x12')]['message']);}logger[_0xa008('0x12')]('Attachment,\x20%s,\x20%s',_0x2ce085,_0x21ca49[_0xa008('0x12')][_0xa008('0x13')]);return _0x44e083(_0x21ca49[_0xa008('0x12')][_0xa008('0x13')]);}else{logger[_0xa008('0x14')](_0xa008('0xe'),_0x2ce085,_0xa008('0x11'));_0x44e083(_0x21ca49[_0xa008('0x15')][_0xa008('0x13')]);}})[_0xa008('0x16')](function(_0x361400){logger['error'](_0xa008('0xe'),_0x2ce085,_0x361400);_0xcd1e54(_0x361400);});});}exports[_0xa008('0x17')]=function(_0x5b1fe7){var _0x448aea=this;return new Promise(function(_0x970cc8,_0x1254f0){return db[_0xa008('0x18')][_0xa008('0x19')](_0x5b1fe7['body'],{'raw':_0x5b1fe7['options']?_0x5b1fe7[_0xa008('0x1a')][_0xa008('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xa25768){logger[_0xa008('0x14')](_0xa008('0x17'),_0x5b1fe7);logger[_0xa008('0xf')](_0xa008('0x17'),_0x5b1fe7,JSON[_0xa008('0x1c')](_0xa25768));_0x970cc8(_0xa25768);})[_0xa008('0x16')](function(_0x1388aa){logger[_0xa008('0x12')](_0xa008('0x17'),_0x1388aa[_0xa008('0x13')],_0x5b1fe7);_0x1254f0(_0x448aea[_0xa008('0x12')](0x1f4,_0x1388aa[_0xa008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 5cf2b10..f4eb86f 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 _0xb4c3=['file','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s','replace','single'];(function(_0x8b69e9,_0x1407f9){var _0x485d2d=function(_0x3b9ce1){while(--_0x3b9ce1){_0x8b69e9['push'](_0x8b69e9['shift']());}};_0x485d2d(++_0x1407f9);}(_0xb4c3,0x115));var _0x3b4c=function(_0xba33b6,_0x53e429){_0xba33b6=_0xba33b6-0x0;var _0x7ce659=_0xb4c3[_0xba33b6];return _0x7ce659;};'use strict';var multer=require(_0x3b4c('0x0'));var util=require('util');var path=require(_0x3b4c('0x1'));var timeout=require(_0x3b4c('0x2'));var express=require(_0x3b4c('0x3'));var router=express[_0x3b4c('0x4')]();var auth=require(_0x3b4c('0x5'));var interaction=require(_0x3b4c('0x6'));var config=require(_0x3b4c('0x7'));var controller=require('./attachment.controller');router[_0x3b4c('0x8')]('/',auth['isAuthenticated'](),controller[_0x3b4c('0x9')]);router[_0x3b4c('0x8')]('/:id',auth[_0x3b4c('0xa')](),controller[_0x3b4c('0xb')]);router[_0x3b4c('0x8')](_0x3b4c('0xc'),auth[_0x3b4c('0xa')](),controller[_0x3b4c('0xd')]);router[_0x3b4c('0xe')](_0x3b4c('0xf'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0x3b4c('0x10')]({'destination':function(_0x3288eb,_0x43ac72,_0x14cb65){_0x14cb65(null,path[_0x3b4c('0x11')](config['root'],_0x3b4c('0x12')));},'filename':function(_0x153500,_0x2e1f99,_0x2769f6){_0x2769f6(null,util[_0x3b4c('0x13')](_0x3b4c('0x14'),Date['now'](),_0x2e1f99['originalname'][_0x3b4c('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3b4c('0xe')]('/',upload[_0x3b4c('0x16')](_0x3b4c('0x17')),controller[_0x3b4c('0x18')]);router[_0x3b4c('0x19')](_0x3b4c('0x1a'),auth[_0x3b4c('0xa')](),controller[_0x3b4c('0x1b')]);router[_0x3b4c('0x1c')](_0x3b4c('0x1a'),auth['isAuthenticated'](),controller[_0x3b4c('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xbc87=['create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone','clone','join','root','server/files/attachments/','format','%s-%s','originalname','single','file'];(function(_0x4103af,_0x3eca37){var _0x56f720=function(_0x24c102){while(--_0x24c102){_0x4103af['push'](_0x4103af['shift']());}};_0x56f720(++_0x3eca37);}(_0xbc87,0x144));var _0x7bc8=function(_0x1c489c,_0x5b1c09){_0x1c489c=_0x1c489c-0x0;var _0xe29147=_0xbc87[_0x1c489c];return _0xe29147;};'use strict';var multer=require(_0x7bc8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7bc8('0x1'));var express=require(_0x7bc8('0x2'));var router=express[_0x7bc8('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7bc8('0x4'));var controller=require(_0x7bc8('0x5'));router[_0x7bc8('0x6')]('/',auth[_0x7bc8('0x7')](),controller[_0x7bc8('0x8')]);router[_0x7bc8('0x6')](_0x7bc8('0x9'),auth[_0x7bc8('0x7')](),controller[_0x7bc8('0xa')]);router[_0x7bc8('0x6')](_0x7bc8('0xb'),auth[_0x7bc8('0x7')](),controller[_0x7bc8('0xc')]);router[_0x7bc8('0xd')](_0x7bc8('0xe'),auth[_0x7bc8('0x7')](),controller[_0x7bc8('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd1616a,_0x47a082,_0xc357a2){_0xc357a2(null,path[_0x7bc8('0x10')](config[_0x7bc8('0x11')],_0x7bc8('0x12')));},'filename':function(_0x39d4f8,_0x41a2be,_0x4cd0ff){_0x4cd0ff(null,util[_0x7bc8('0x13')](_0x7bc8('0x14'),Date['now'](),_0x41a2be[_0x7bc8('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7bc8('0xd')]('/',upload[_0x7bc8('0x16')](_0x7bc8('0x17')),controller[_0x7bc8('0x18')]);router[_0x7bc8('0x19')]('/:id',auth[_0x7bc8('0x7')](),controller['update']);router[_0x7bc8('0x1a')]('/:id',auth[_0x7bc8('0x7')](),controller[_0x7bc8('0x1b')]);module[_0x7bc8('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 e1ca086..3bebeda 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 _0x21cd=['add','blockDuration','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service','authenticate','google','/login','profile','email','callback','use','clientSecret','secret','callbackURL','Setting','findOne','find','map','emails','value','user','agent','then','disabled','blocked','blockedAt'];(function(_0x4bb0eb,_0x598f72){var _0x1d8d8f=function(_0x323482){while(--_0x323482){_0x4bb0eb['push'](_0x4bb0eb['shift']());}};_0x1d8d8f(++_0x598f72);}(_0x21cd,0x1e2));var _0xd21c=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x21cd[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require('lodash');var passport=require(_0xd21c('0x0'));var GoogleStrategy=require(_0xd21c('0x1'))[_0xd21c('0x2')];var moment=require(_0xd21c('0x3'));var db=require(_0xd21c('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0xd21c('0x5'))['signToken'];var utils=require('../../config/utils');exports['login']=passport[_0xd21c('0x6')](_0xd21c('0x7'),{'failureRedirect':_0xd21c('0x8'),'scope':[_0xd21c('0x9'),_0xd21c('0xa')],'session':![]});exports[_0xd21c('0xb')]=passport[_0xd21c('0x6')]('google',{'failureRedirect':_0xd21c('0x8'),'session':![]});passport[_0xd21c('0xc')](new GoogleStrategy({'clientID':config[_0xd21c('0x7')]?config['google']['clientID']:'id','clientSecret':config['google']?config['google'][_0xd21c('0xd')]:_0xd21c('0xe'),'callbackURL':config[_0xd21c('0x7')]?config['google'][_0xd21c('0xf')]:''},function(_0x403771,_0x100037,_0x539b30,_0x3a6353){var _0x3f36c7,_0x228a78;return db[_0xd21c('0x10')][_0xd21c('0x11')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x4742e0){_0x3f36c7=_0x4742e0;return db['User'][_0xd21c('0x12')]({'where':{'email':_[_0xd21c('0x13')](_0x539b30[_0xd21c('0x14')],_0xd21c('0x15')),'role':{'$or':['admin',_0xd21c('0x16'),_0xd21c('0x17')]}}});})[_0xd21c('0x18')](function(_0xc5b1e5){_0x228a78=_0xc5b1e5;if(_0x228a78){if(_0x228a78[_0xd21c('0x19')]){return _0x3a6353('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x3f36c7['blockDuration']>0x0){if(_0x228a78[_0xd21c('0x1a')]){if(moment(_0x228a78[_0xd21c('0x1b')])[_0xd21c('0x1c')](_0x3f36c7[_0xd21c('0x1d')],'minutes')>moment()){return _0x3a6353(_0xd21c('0x1e'));}else{return utils[_0xd21c('0x1f')](_0x228a78,0x0,![],null)['then'](function(){return utils[_0xd21c('0x20')](_0x228a78);})[_0xd21c('0x18')](function(){return _0x3a6353(null,_0x228a78);});}}else{return utils[_0xd21c('0x20')](_0x228a78)['then'](function(){return _0x3a6353(null,_0x228a78);});}}else{return utils[_0xd21c('0x20')](_0x228a78)['then'](function(){return _0x3a6353(null,_0x228a78);});}}return _0x3a6353(_0xd21c('0x1e'));})[_0xd21c('0x21')](function(_0xc93a15){_0x3a6353(_0xc93a15);});})); \ No newline at end of file +var _0x18b1=['add','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','../../mysqldb','../../components/auth/service','login','authenticate','google','/login','profile','callback','use','clientID','clientSecret','secret','Setting','findOne','allowedLoginAttempts','blockDuration','find','emails','value','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x18b1,0x164));var _0x118b=function(_0x34b87f,_0x28aef2){_0x34b87f=_0x34b87f-0x0;var _0x449805=_0x18b1[_0x34b87f];return _0x449805;};'use strict';var _=require(_0x118b('0x0'));var passport=require(_0x118b('0x1'));var GoogleStrategy=require(_0x118b('0x2'))['Strategy'];var moment=require('moment');var db=require(_0x118b('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0x118b('0x4'))['signToken'];var utils=require('../../config/utils');exports[_0x118b('0x5')]=passport[_0x118b('0x6')](_0x118b('0x7'),{'failureRedirect':_0x118b('0x8'),'scope':[_0x118b('0x9'),'email'],'session':![]});exports[_0x118b('0xa')]=passport[_0x118b('0x6')](_0x118b('0x7'),{'failureRedirect':'/login','session':![]});passport[_0x118b('0xb')](new GoogleStrategy({'clientID':config[_0x118b('0x7')]?config[_0x118b('0x7')][_0x118b('0xc')]:'id','clientSecret':config[_0x118b('0x7')]?config['google'][_0x118b('0xd')]:_0x118b('0xe'),'callbackURL':config['google']?config[_0x118b('0x7')]['callbackURL']:''},function(_0x335402,_0x2a9570,_0x26695e,_0x1e1c59){var _0x3a46e5,_0x21e3d2;return db[_0x118b('0xf')][_0x118b('0x10')]({'where':{'id':0x1},'attributes':[_0x118b('0x11'),_0x118b('0x12')],'raw':!![]})['then'](function(_0x2e0660){_0x3a46e5=_0x2e0660;return db['User'][_0x118b('0x13')]({'where':{'email':_['map'](_0x26695e[_0x118b('0x14')],_0x118b('0x15')),'role':{'$or':['admin','user',_0x118b('0x16')]}}});})[_0x118b('0x17')](function(_0x23339e){_0x21e3d2=_0x23339e;if(_0x21e3d2){if(_0x21e3d2[_0x118b('0x18')]){return _0x1e1c59(_0x118b('0x19'));}else if(_0x3a46e5[_0x118b('0x12')]>0x0){if(_0x21e3d2[_0x118b('0x1a')]){if(moment(_0x21e3d2[_0x118b('0x1b')])[_0x118b('0x1c')](_0x3a46e5['blockDuration'],'minutes')>moment()){return _0x1e1c59(_0x118b('0x19'));}else{return utils[_0x118b('0x1d')](_0x21e3d2,0x0,![],null)[_0x118b('0x17')](function(){return utils['getLicense'](_0x21e3d2);})['then'](function(){return _0x1e1c59(null,_0x21e3d2);});}}else{return utils[_0x118b('0x1e')](_0x21e3d2)[_0x118b('0x17')](function(){return _0x1e1c59(null,_0x21e3d2);});}}else{return utils['getLicense'](_0x21e3d2)['then'](function(){return _0x1e1c59(null,_0x21e3d2);});}}return _0x1e1c59(_0x118b('0x19'));})[_0x118b('0x1f')](function(_0x3122fe){_0x1e1c59(_0x3122fe);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index e5f4776..2d800cf 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 _0x8c99=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8c99,0x1a8));var _0x98c9=function(_0x5ad190,_0xd39c9e){_0x5ad190=_0x5ad190-0x0;var _0x518ed3=_0x8c99[_0x5ad190];return _0x518ed3;};'use strict';var express=require(_0x98c9('0x0'));var passport=require(_0x98c9('0x1'));var router=express[_0x98c9('0x2')]();var controller=require(_0x98c9('0x3'));var userController=require(_0x98c9('0x4'));var authService=require(_0x98c9('0x5'));router[_0x98c9('0x6')]('/',controller[_0x98c9('0x7')]);router[_0x98c9('0x6')](_0x98c9('0x8'),controller[_0x98c9('0x9')],authService[_0x98c9('0xa')],userController['login'],authService[_0x98c9('0xb')]);module[_0x98c9('0xc')]=router; \ No newline at end of file +var _0x6658=['express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','setTokenCookie','exports'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0x6658,0x198));var _0x8665=function(_0x30e044,_0x2248a8){_0x30e044=_0x30e044-0x0;var _0x5b0abe=_0x6658[_0x30e044];return _0x5b0abe;};'use strict';var express=require(_0x8665('0x0'));var passport=require(_0x8665('0x1'));var router=express[_0x8665('0x2')]();var controller=require(_0x8665('0x3'));var userController=require(_0x8665('0x4'));var authService=require(_0x8665('0x5'));router[_0x8665('0x6')]('/',controller[_0x8665('0x7')]);router['get'](_0x8665('0x8'),controller[_0x8665('0x9')],authService['isMiddleware'],userController['login'],authService[_0x8665('0xa')]);module[_0x8665('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index a5d24bb..50b1824 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 _0x323f=['merge','format','request','error','message','stringify','send','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','resetPasswordToken','Password\x20reset!','use','passport','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','pass'];(function(_0x39e8fd,_0x556307){var _0x353ca5=function(_0x15a443){while(--_0x15a443){_0x39e8fd['push'](_0x39e8fd['shift']());}};_0x353ca5(++_0x556307);}(_0x323f,0x1ee));var _0xf323=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x323f[_0x1ac595];return _0x455fff;};'use strict';var util=require('util');var passport=require(_0xf323('0x0'));var LocalStrategy=require('passport-local')[_0xf323('0x1')];var jayson=require(_0xf323('0x2'));var _=require(_0xf323('0x3'));var rs=require(_0xf323('0x4'));var moment=require(_0xf323('0x5'));var db=require(_0xf323('0x6'))['db'];var authService=require(_0xf323('0x7'));var utils=require(_0xf323('0x8'));var client=jayson[_0xf323('0x9')][_0xf323('0xa')]({'port':0x232b});function localAuthenticate(_0x5d7d60,_0xb9a667,_0x444cba,_0x1af70d){var _0x2c8271,_0x8abeac;return db[_0xf323('0xb')][_0xf323('0xc')]({'where':{'id':0x1},'attributes':[_0xf323('0xd'),_0xf323('0xe')],'raw':!![]})[_0xf323('0xf')](function(_0x22fd48){_0x2c8271=_0x22fd48;return _0x5d7d60[_0xf323('0xc')]({'attributes':['id',_0xf323('0x10'),_0xf323('0x11'),_0xf323('0x12'),_0xf323('0x13'),_0xf323('0x14'),'blocked',_0xf323('0x15'),_0xf323('0x16')],'where':{'name':_0xb9a667,'role':{'$or':[_0xf323('0x17'),'user',_0xf323('0x18')]}}});})[_0xf323('0xf')](function(_0x367db4){if(!_0x367db4||_0x367db4&&_0x367db4[_0xf323('0x10')]!==_0xb9a667){throw new Error(_0xf323('0x19'));}else{_0x8abeac=_0x367db4;return _0x8abeac;}})[_0xf323('0xf')](function(){_0x8abeac['authenticate'](_0x444cba,function(_0x4cc3ce,_0x874219){var _0x447517=_0x8abeac[_0xf323('0x16')]+0x1;if(_0x4cc3ce){return _0x1af70d(_0x4cc3ce);}else if(!_0x874219){if(_0x8abeac[_0xf323('0x14')]){return _0x1af70d(null,![],{'message':_0xf323('0x19')});}else if(_0x2c8271['allowedLoginAttempts']>0x0){if(_0x8abeac[_0xf323('0x1a')]){if(_0x2c8271[_0xf323('0xe')]>0x0){if(moment(_0x8abeac[_0xf323('0x15')])[_0xf323('0x1b')](_0x2c8271['blockDuration'],_0xf323('0x1c'))>moment()){return _0x1af70d(null,![],{'message':_0xf323('0x19')});}else{return utils[_0xf323('0x1d')](_0x8abeac,_0x447517,![],null)[_0xf323('0xf')](function(){return _0x1af70d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1af70d(null,![],{'message':_0xf323('0x19')});}}else{if(_0x447517>=_0x2c8271[_0xf323('0xd')]){return utils['clearBlockUser'](_0x8abeac,0x0,!![],moment())[_0xf323('0xf')](function(){return _0x1af70d(null,![],{'message':_0xf323('0x19')});});}else{return utils[_0xf323('0x1d')](_0x8abeac,_0x447517,![],null)[_0xf323('0xf')](function(){return _0x1af70d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x1af70d(null,![],{'message':_0xf323('0x19')});}}else{if(_0x8abeac[_0xf323('0x14')]){return _0x1af70d(null,![],{'message':_0xf323('0x19')});}else if(_0x2c8271['allowedLoginAttempts']>0x0){if(_0x8abeac[_0xf323('0x1a')]){if(_0x2c8271[_0xf323('0xe')]>0x0){if(moment(_0x8abeac[_0xf323('0x15')])[_0xf323('0x1b')](_0x2c8271[_0xf323('0xe')],_0xf323('0x1c'))>moment()){return _0x1af70d(null,![],{'message':_0xf323('0x19')});}else{return utils[_0xf323('0x1d')](_0x8abeac,0x0,![],null)[_0xf323('0xf')](function(){return utils['getLicense'](_0x8abeac);})[_0xf323('0xf')](function(){return _0x1af70d(null,_0x8abeac);});}}else{return _0x1af70d(null,![],{'message':_0xf323('0x19')});}}else{return utils[_0xf323('0x1d')](_0x8abeac,0x0,![],null)[_0xf323('0xf')](function(){return utils[_0xf323('0x1e')](_0x8abeac);})[_0xf323('0xf')](function(){return _0x1af70d(null,_0x8abeac);})['catch'](function(_0x30ed93){return _0x1af70d(null,![],_0x30ed93);});}}else{if(_0x8abeac['blocked']){return _0x1af70d(null,![],{'message':_0xf323('0x19')});}else{return utils[_0xf323('0x1e')](_0x8abeac)['then'](function(){return _0x1af70d(null,_0x8abeac);});}}}});})[_0xf323('0x1f')](function(_0x3c95ce){return _0x1af70d(null,![],_0x3c95ce);});}function sendServiceMail(_0x2b6254){return db[_0xf323('0x20')][_0xf323('0x21')]({'where':{'service':!![]},'attributes':['id','name',_0xf323('0x22')],'include':[{'model':db[_0xf323('0x23')],'as':_0xf323('0x24')}]})[_0xf323('0xf')](function(_0x4260f3){if(!_0x4260f3){throw new Error(_0xf323('0x25'));}var _0x17cb4d={'tls':{'rejectUnauthorized':![]}};if(_0x4260f3[_0xf323('0x24')][_0xf323('0x26')]){_0x17cb4d['service']=_0x4260f3[_0xf323('0x24')][_0xf323('0x26')];}else{_0x17cb4d[_0xf323('0x27')]=_0x4260f3[_0xf323('0x24')][_0xf323('0x27')];_0x17cb4d['port']=_0x4260f3[_0xf323('0x24')][_0xf323('0x28')];_0x17cb4d[_0xf323('0x29')]=_0x4260f3[_0xf323('0x24')][_0xf323('0x29')];}if(_0x4260f3['Smtp'][_0xf323('0x2a')]){_0x17cb4d[_0xf323('0x2b')]={'user':_0x4260f3[_0xf323('0x24')][_0xf323('0x2c')],'pass':_0x4260f3['Smtp'][_0xf323('0x2d')]};}var _0x5658db={'account':_0x17cb4d,'message':_[_0xf323('0x2e')]({'from':util[_0xf323('0x2f')]('\x22%s\x22\x20<%s>',_0x4260f3[_0xf323('0x10')],_0x4260f3['email']||_0x4260f3[_0xf323('0x24')]['user'])},_0x2b6254)};return client[_0xf323('0x30')]('SendMail',_0x5658db);})[_0xf323('0xf')](function(_0x82a6ca){if(_0x82a6ca['error']){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x82a6ca[_0xf323('0x31')][_0xf323('0x32')]||JSON[_0xf323('0x33')](_0x82a6ca[_0xf323('0x31')])));}return!![];});}function handleError(_0x223fb7,_0x49e458,_0x54104a){return _0x223fb7['status'](_0x49e458||0x1f4)[_0xf323('0x34')]({'message':_0x54104a?_0x54104a['message']||_0x54104a:''});}exports[_0xf323('0x35')]=function(_0x47e7a2,_0x431bc,_0x1f7b34){passport[_0xf323('0x36')](_0xf323('0x37'),function(_0x325248,_0x48a6c4,_0x3d8ddb){var _0x3bbe02=_0x325248||_0x3d8ddb;if(_0x3bbe02){return handleError(_0x431bc,0x191,_0x3bbe02);}if(!_0x48a6c4){return handleError(_0x431bc,0x194,{'message':_0xf323('0x38')});}else{var _0x27ddcc={'payload':{'id':_0x48a6c4['id'],'role':_0x48a6c4[_0xf323('0x13')]},'options':{'expiresIn':0x15180}};return authService[_0xf323('0x39')](_0x27ddcc)[_0xf323('0xf')](function(_0x2dcb00){_0x431bc[_0xf323('0x3a')]({'id':_0x48a6c4['id'],'token':_0x2dcb00,'statusCall':'','isAlreadyLogged':_0x48a6c4[_0xf323('0x3b')]});});}})(_0x47e7a2,_0x431bc,_0x1f7b34);};exports[_0xf323('0x3c')]=function(_0x45287b,_0xc48a6e,_0x388d80){if(!_0x45287b[_0xf323('0x3d')][_0xf323('0x22')]){return handleError(_0xc48a6e,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x502114=rs[_0xf323('0x3e')]();_0x45287b[_0xf323('0x3d')][_0xf323('0x22')]=_0x45287b[_0xf323('0x3d')][_0xf323('0x22')][_0xf323('0x3f')]()[_0xf323('0x40')]();var _0x125047;return db[_0xf323('0xb')][_0xf323('0xc')]({'where':{'id':0x1},'attributes':[_0xf323('0xd'),_0xf323('0xe')],'raw':!![]})[_0xf323('0xf')](function(_0x48d4df){_0x125047=_0x48d4df;return db[_0xf323('0x41')]['find']({'where':{'email':_0x45287b['body'][_0xf323('0x22')]}});})['then'](function(_0x5ddb5b){if(!_0x5ddb5b){throw new Error(_0xf323('0x42'));}if(_0x5ddb5b[_0xf323('0x14')]){throw new Error(_0xf323('0x43'));}if(_0x5ddb5b[_0xf323('0x1a')]){if(moment(_0x5ddb5b[_0xf323('0x15')])[_0xf323('0x1b')](_0x125047[_0xf323('0xe')],_0xf323('0x1c'))>moment()){throw new Error(_0xf323('0x44'));}else{_0x5ddb5b[_0xf323('0x1a')]=![];_0x5ddb5b[_0xf323('0x15')]=null;}}_0x5ddb5b['resetPasswordToken']=_0x502114;_0x5ddb5b[_0xf323('0x45')]=Date['now']()+0x36ee80;return _0x5ddb5b[_0xf323('0x46')]();})[_0xf323('0xf')](function(){return sendServiceMail({'to':_0x45287b[_0xf323('0x3d')][_0xf323('0x22')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xf323('0x47')+'https://'+_0x45287b[_0xf323('0x48')]['host']+_0xf323('0x49')+_0x502114+'\x0a\x0a'+_0xf323('0x4a')});})['then'](function(){_0xc48a6e[_0xf323('0x4b')](0xc8)[_0xf323('0x34')]({'message':_0xf323('0x4c')});})[_0xf323('0x1f')](function(_0x1e50b3){return handleError(_0xc48a6e,0x1f4,_0x1e50b3);});};exports[_0xf323('0x4d')]=function(_0x34268e,_0x103cc9,_0x1cb5fa){return db[_0xf323('0x41')][_0xf323('0x21')]({'where':{'resetPasswordToken':_0x34268e[_0xf323('0x4e')][_0xf323('0x4f')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xf323('0xf')](function(_0x18ad3e){if(!_0x18ad3e){throw new Error(_0xf323('0x50'));}return db[_0xf323('0xb')][_0xf323('0xc')]({'attributes':['id',_0xf323('0x51'),'enforcePasswordHistory',_0xf323('0x52')]})[_0xf323('0xf')](function(_0x5caa1c){if(_0x5caa1c[_0xf323('0x51')])authService[_0xf323('0x53')](_0x34268e['body']['password']);if(!_0x5caa1c[_0xf323('0x54')]||!_0x18ad3e[_0xf323('0x55')])return _0x18ad3e;authService[_0xf323('0x56')](_0x34268e[_0xf323('0x3d')][_0xf323('0x11')],_0x18ad3e[_0xf323('0x55')],_0x5caa1c[_0xf323('0x52')]);return _0x18ad3e;})[_0xf323('0xf')](function(){_0x18ad3e['password']=_0x34268e[_0xf323('0x3d')][_0xf323('0x11')];_0x18ad3e[_0xf323('0x57')]=null;_0x18ad3e[_0xf323('0x45')]=null;return _0x18ad3e[_0xf323('0x46')]();});})[_0xf323('0xf')](function(){_0x103cc9[_0xf323('0x4b')](0xc8)['send']({'message':_0xf323('0x58')});})[_0xf323('0x1f')](function(_0x277aa0){return handleError(_0x103cc9,0x1f4,_0x277aa0);});};passport[_0xf323('0x59')](new LocalStrategy({'usernameField':_0xf323('0x10'),'passwordField':_0xf323('0x11')},function(_0x4621f2,_0x728994,_0x3f0cfe){return localAuthenticate(db['User'],_0x4621f2,_0x728994,_0x3f0cfe);})); \ No newline at end of file +var _0xc1c6=['password','validatePasswordHistory','previousPasswords','passwordHistoryLimit','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','jayson/promise','randomstring','moment','../../mysqldb','client','findOne','allowedLoginAttempts','then','name','salt','role','disabled','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','clearBlockUser','blocked','add','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','Smtp','host','port','secure','authentication','user','format','SendMail','message','stringify','error','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','forgot','body','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','validatePasswordPattern'];(function(_0x232e1d,_0x2c5b3d){var _0x186c60=function(_0x4539db){while(--_0x4539db){_0x232e1d['push'](_0x232e1d['shift']());}};_0x186c60(++_0x2c5b3d);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2290f7,_0x162232){_0x2290f7=_0x2290f7-0x0;var _0x942154=_0xc1c6[_0x2290f7];return _0x942154;};'use strict';var util=require(_0x6c1c('0x0'));var passport=require(_0x6c1c('0x1'));var LocalStrategy=require(_0x6c1c('0x2'))['Strategy'];var jayson=require(_0x6c1c('0x3'));var _=require('lodash');var rs=require(_0x6c1c('0x4'));var moment=require(_0x6c1c('0x5'));var db=require(_0x6c1c('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0x6c1c('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x50c1bb,_0x582bec,_0xe510ca,_0x2eb1ba){var _0x38369d,_0x2cec58;return db['Setting'][_0x6c1c('0x8')]({'where':{'id':0x1},'attributes':[_0x6c1c('0x9'),'blockDuration'],'raw':!![]})[_0x6c1c('0xa')](function(_0x36275f){_0x38369d=_0x36275f;return _0x50c1bb[_0x6c1c('0x8')]({'attributes':['id',_0x6c1c('0xb'),'password',_0x6c1c('0xc'),_0x6c1c('0xd'),_0x6c1c('0xe'),'blocked',_0x6c1c('0xf'),_0x6c1c('0x10')],'where':{'name':_0x582bec,'role':{'$or':[_0x6c1c('0x11'),'user',_0x6c1c('0x12')]}}});})['then'](function(_0x357370){if(!_0x357370||_0x357370&&_0x357370[_0x6c1c('0xb')]!==_0x582bec){throw new Error(_0x6c1c('0x13'));}else{_0x2cec58=_0x357370;return _0x2cec58;}})[_0x6c1c('0xa')](function(){_0x2cec58[_0x6c1c('0x14')](_0xe510ca,function(_0x3f532c,_0x297c33){var _0x41aa74=_0x2cec58[_0x6c1c('0x10')]+0x1;if(_0x3f532c){return _0x2eb1ba(_0x3f532c);}else if(!_0x297c33){if(_0x2cec58['disabled']){return _0x2eb1ba(null,![],{'message':_0x6c1c('0x13')});}else if(_0x38369d[_0x6c1c('0x9')]>0x0){if(_0x2cec58['blocked']){if(_0x38369d[_0x6c1c('0x15')]>0x0){if(moment(_0x2cec58[_0x6c1c('0xf')])['add'](_0x38369d[_0x6c1c('0x15')],'minutes')>moment()){return _0x2eb1ba(null,![],{'message':_0x6c1c('0x13')});}else{return utils[_0x6c1c('0x16')](_0x2cec58,_0x41aa74,![],null)['then'](function(){return _0x2eb1ba(null,![],{'message':_0x6c1c('0x13')});});}}else{return _0x2eb1ba(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x41aa74>=_0x38369d[_0x6c1c('0x9')]){return utils[_0x6c1c('0x16')](_0x2cec58,0x0,!![],moment())[_0x6c1c('0xa')](function(){return _0x2eb1ba(null,![],{'message':_0x6c1c('0x13')});});}else{return utils[_0x6c1c('0x16')](_0x2cec58,_0x41aa74,![],null)[_0x6c1c('0xa')](function(){return _0x2eb1ba(null,![],{'message':_0x6c1c('0x13')});});}}}else{return _0x2eb1ba(null,![],{'message':_0x6c1c('0x13')});}}else{if(_0x2cec58[_0x6c1c('0xe')]){return _0x2eb1ba(null,![],{'message':_0x6c1c('0x13')});}else if(_0x38369d[_0x6c1c('0x9')]>0x0){if(_0x2cec58[_0x6c1c('0x17')]){if(_0x38369d[_0x6c1c('0x15')]>0x0){if(moment(_0x2cec58[_0x6c1c('0xf')])[_0x6c1c('0x18')](_0x38369d[_0x6c1c('0x15')],_0x6c1c('0x19'))>moment()){return _0x2eb1ba(null,![],{'message':_0x6c1c('0x13')});}else{return utils[_0x6c1c('0x16')](_0x2cec58,0x0,![],null)[_0x6c1c('0xa')](function(){return utils[_0x6c1c('0x1a')](_0x2cec58);})[_0x6c1c('0xa')](function(){return _0x2eb1ba(null,_0x2cec58);});}}else{return _0x2eb1ba(null,![],{'message':_0x6c1c('0x13')});}}else{return utils[_0x6c1c('0x16')](_0x2cec58,0x0,![],null)[_0x6c1c('0xa')](function(){return utils[_0x6c1c('0x1a')](_0x2cec58);})[_0x6c1c('0xa')](function(){return _0x2eb1ba(null,_0x2cec58);})[_0x6c1c('0x1b')](function(_0x2feaf4){return _0x2eb1ba(null,![],_0x2feaf4);});}}else{if(_0x2cec58['blocked']){return _0x2eb1ba(null,![],{'message':_0x6c1c('0x13')});}else{return utils['getLicense'](_0x2cec58)[_0x6c1c('0xa')](function(){return _0x2eb1ba(null,_0x2cec58);});}}}});})['catch'](function(_0xcd3179){return _0x2eb1ba(null,![],_0xcd3179);});}function sendServiceMail(_0x5f286b){return db[_0x6c1c('0x1c')][_0x6c1c('0x1d')]({'where':{'service':!![]},'attributes':['id','name',_0x6c1c('0x1e')],'include':[{'model':db[_0x6c1c('0x1f')],'as':'Smtp'}]})[_0x6c1c('0xa')](function(_0x19a8f1){if(!_0x19a8f1){throw new Error(_0x6c1c('0x20'));}var _0xcb489a={'tls':{'rejectUnauthorized':![]}};if(_0x19a8f1['Smtp']['service']){_0xcb489a[_0x6c1c('0x21')]=_0x19a8f1[_0x6c1c('0x22')][_0x6c1c('0x21')];}else{_0xcb489a[_0x6c1c('0x23')]=_0x19a8f1[_0x6c1c('0x22')][_0x6c1c('0x23')];_0xcb489a['port']=_0x19a8f1[_0x6c1c('0x22')][_0x6c1c('0x24')];_0xcb489a['secure']=_0x19a8f1[_0x6c1c('0x22')][_0x6c1c('0x25')];}if(_0x19a8f1[_0x6c1c('0x22')][_0x6c1c('0x26')]){_0xcb489a['auth']={'user':_0x19a8f1[_0x6c1c('0x22')][_0x6c1c('0x27')],'pass':_0x19a8f1[_0x6c1c('0x22')]['pass']};}var _0x1356d4={'account':_0xcb489a,'message':_['merge']({'from':util[_0x6c1c('0x28')]('\x22%s\x22\x20<%s>',_0x19a8f1[_0x6c1c('0xb')],_0x19a8f1[_0x6c1c('0x1e')]||_0x19a8f1[_0x6c1c('0x22')]['user'])},_0x5f286b)};return client['request'](_0x6c1c('0x29'),_0x1356d4);})[_0x6c1c('0xa')](function(_0x3ab64d){if(_0x3ab64d['error']){throw new Error(util[_0x6c1c('0x28')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x3ab64d['error'][_0x6c1c('0x2a')]||JSON[_0x6c1c('0x2b')](_0x3ab64d[_0x6c1c('0x2c')])));}return!![];});}function handleError(_0x3215a9,_0x4bed10,_0x9da66e){return _0x3215a9[_0x6c1c('0x2d')](_0x4bed10||0x1f4)[_0x6c1c('0x2e')]({'message':_0x9da66e?_0x9da66e[_0x6c1c('0x2a')]||_0x9da66e:''});}exports[_0x6c1c('0x2f')]=function(_0x398e95,_0x4ae7dc,_0x988821){passport[_0x6c1c('0x14')](_0x6c1c('0x30'),function(_0x47d75e,_0xb05b38,_0x464549){var _0xf053b1=_0x47d75e||_0x464549;if(_0xf053b1){return handleError(_0x4ae7dc,0x191,_0xf053b1);}if(!_0xb05b38){return handleError(_0x4ae7dc,0x194,{'message':_0x6c1c('0x31')});}else{var _0x1cb3b4={'payload':{'id':_0xb05b38['id'],'role':_0xb05b38['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1cb3b4)['then'](function(_0x8300d0){_0x4ae7dc['json']({'id':_0xb05b38['id'],'token':_0x8300d0,'statusCall':'','isAlreadyLogged':_0xb05b38['online']});});}})(_0x398e95,_0x4ae7dc,_0x988821);};exports[_0x6c1c('0x32')]=function(_0x37244e,_0x5f3f3e,_0x2b2ae5){if(!_0x37244e[_0x6c1c('0x33')][_0x6c1c('0x1e')]){return handleError(_0x5f3f3e,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x313f9d=rs[_0x6c1c('0x34')]();_0x37244e['body'][_0x6c1c('0x1e')]=_0x37244e['body'][_0x6c1c('0x1e')][_0x6c1c('0x35')]()[_0x6c1c('0x36')]();var _0x174f2c;return db[_0x6c1c('0x37')]['findOne']({'where':{'id':0x1},'attributes':[_0x6c1c('0x9'),_0x6c1c('0x15')],'raw':!![]})[_0x6c1c('0xa')](function(_0x5d4058){_0x174f2c=_0x5d4058;return db[_0x6c1c('0x38')][_0x6c1c('0x1d')]({'where':{'email':_0x37244e[_0x6c1c('0x33')][_0x6c1c('0x1e')]}});})[_0x6c1c('0xa')](function(_0x57b07a){if(!_0x57b07a){throw new Error(_0x6c1c('0x39'));}if(_0x57b07a['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x57b07a['blocked']){if(moment(_0x57b07a[_0x6c1c('0xf')])[_0x6c1c('0x18')](_0x174f2c[_0x6c1c('0x15')],_0x6c1c('0x19'))>moment()){throw new Error(_0x6c1c('0x3a'));}else{_0x57b07a[_0x6c1c('0x17')]=![];_0x57b07a[_0x6c1c('0xf')]=null;}}_0x57b07a[_0x6c1c('0x3b')]=_0x313f9d;_0x57b07a['resetPasswordExpires']=Date[_0x6c1c('0x3c')]()+0x36ee80;return _0x57b07a[_0x6c1c('0x3d')]();})['then'](function(){return sendServiceMail({'to':_0x37244e[_0x6c1c('0x33')]['email'],'subject':_0x6c1c('0x3e'),'text':_0x6c1c('0x3f')+_0x6c1c('0x40')+_0x6c1c('0x41')+_0x37244e[_0x6c1c('0x42')]['host']+_0x6c1c('0x43')+_0x313f9d+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x6c1c('0xa')](function(){_0x5f3f3e[_0x6c1c('0x2d')](0xc8)[_0x6c1c('0x2e')]({'message':_0x6c1c('0x44')});})[_0x6c1c('0x1b')](function(_0x26cf7f){return handleError(_0x5f3f3e,0x1f4,_0x26cf7f);});};exports['reset']=function(_0xa9889a,_0x292536,_0x4b7014){return db[_0x6c1c('0x38')][_0x6c1c('0x1d')]({'where':{'resetPasswordToken':_0xa9889a[_0x6c1c('0x45')][_0x6c1c('0x46')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x6c1c('0xa')](function(_0x1f00e6){if(!_0x1f00e6){throw new Error(_0x6c1c('0x47'));}return db['Setting']['findOne']({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})[_0x6c1c('0xa')](function(_0x28c3bb){if(_0x28c3bb['securePassword'])authService[_0x6c1c('0x48')](_0xa9889a[_0x6c1c('0x33')][_0x6c1c('0x49')]);if(!_0x28c3bb['enforcePasswordHistory']||!_0x1f00e6['previousPasswords'])return _0x1f00e6;authService[_0x6c1c('0x4a')](_0xa9889a[_0x6c1c('0x33')]['password'],_0x1f00e6[_0x6c1c('0x4b')],_0x28c3bb[_0x6c1c('0x4c')]);return _0x1f00e6;})[_0x6c1c('0xa')](function(){_0x1f00e6[_0x6c1c('0x49')]=_0xa9889a[_0x6c1c('0x33')][_0x6c1c('0x49')];_0x1f00e6['resetPasswordToken']=null;_0x1f00e6[_0x6c1c('0x4d')]=null;return _0x1f00e6[_0x6c1c('0x3d')]();});})['then'](function(){_0x292536['status'](0xc8)[_0x6c1c('0x2e')]({'message':_0x6c1c('0x4e')});})[_0x6c1c('0x1b')](function(_0x58ac8d){return handleError(_0x292536,0x1f4,_0x58ac8d);});};passport[_0x6c1c('0x4f')](new LocalStrategy({'usernameField':_0x6c1c('0xb'),'passwordField':_0x6c1c('0x49')},function(_0x41637f,_0x5c86fe,_0x54e9c9){return localAuthenticate(db[_0x6c1c('0x38')],_0x41637f,_0x5c86fe,_0x54e9c9);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 6952a14..4daba3c 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 _0x7cca=['/reset/:token','reset','exports','express','Router','login','post','/forgot','forgot'];(function(_0x1b406b,_0x67b0ce){var _0x29ad55=function(_0xc61d78){while(--_0xc61d78){_0x1b406b['push'](_0x1b406b['shift']());}};_0x29ad55(++_0x67b0ce);}(_0x7cca,0xff));var _0xa7cc=function(_0x2706ee,_0x122496){_0x2706ee=_0x2706ee-0x0;var _0x5d0e50=_0x7cca[_0x2706ee];return _0x5d0e50;};'use strict';var express=require(_0xa7cc('0x0'));var router=express[_0xa7cc('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0xa7cc('0x2')]);router[_0xa7cc('0x3')](_0xa7cc('0x4'),controller[_0xa7cc('0x5')]);router[_0xa7cc('0x3')](_0xa7cc('0x6'),controller[_0xa7cc('0x7')]);module[_0xa7cc('0x8')]=router; \ No newline at end of file +var _0x8ae4=['reset','express','./authLocal.controller','login','post','/forgot','forgot','/reset/:token'];(function(_0x463ab7,_0x4366ea){var _0x1bd788=function(_0x1baf78){while(--_0x1baf78){_0x463ab7['push'](_0x463ab7['shift']());}};_0x1bd788(++_0x4366ea);}(_0x8ae4,0x89));var _0x48ae=function(_0x28ed2e,_0x48be94){_0x28ed2e=_0x28ed2e-0x0;var _0x160019=_0x8ae4[_0x28ed2e];return _0x160019;};'use strict';var express=require(_0x48ae('0x0'));var router=express['Router']();var controller=require(_0x48ae('0x1'));router['post']('/',controller[_0x48ae('0x2')]);router[_0x48ae('0x3')](_0x48ae('0x4'),controller[_0x48ae('0x5')]);router['post'](_0x48ae('0x6'),controller[_0x48ae('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 34a75e3..51e2164 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 _0x9bce=['STRING','INTEGER','sequelize'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x9bce,0x119));var _0xe9bc=function(_0x503476,_0x552f95){_0x503476=_0x503476-0x0;var _0x416471=_0x9bce[_0x503476];return _0x416471;};'use strict';var Sequelize=require(_0xe9bc('0x0'));module['exports']={'name':{'type':Sequelize[_0xe9bc('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xe9bc('0x1')]},'description':{'type':Sequelize[_0xe9bc('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe9bc('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x1392=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0x1392,0xa0));var _0x2139=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0x1392[_0x2a18b7];return _0x45e74e;};'use strict';var Sequelize=require(_0x2139('0x0'));module[_0x2139('0x1')]={'name':{'type':Sequelize[_0x2139('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2139('0x2')]},'status':{'type':Sequelize[_0x2139('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 3779f9b..421da70 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(_0x256b0c,_0x78abcd){var _0x37da7c=function(_0x4f36e6){while(--_0x4f36e6){_0x256b0c['push'](_0x256b0c['shift']());}};_0x37da7c(++_0x78abcd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file +var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range'];(function(_0x86dc1b,_0xcc6c){var _0x5c571f=function(_0x1ee27a){while(--_0x1ee27a){_0x86dc1b['push'](_0x86dc1b['shift']());}};_0x5c571f(++_0xcc6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 0093699..a605e13 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 _0xc17d=['exports','define','util','moment','bluebird','path','rimraf','./automation.attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc17d,0x10a));var _0xdc17=function(_0x292deb,_0x7b3a71){_0x292deb=_0x292deb-0x0;var _0x4526fa=_0xc17d[_0x292deb];return _0x4526fa;};'use strict';var _=require('lodash');var util=require(_0xdc17('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xdc17('0x1'));var BPromise=require(_0xdc17('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc17('0x3'));var rimraf=require(_0xdc17('0x4'));var config=require('../../config/environment');var attributes=require(_0xdc17('0x5'));module[_0xdc17('0x6')]=function(_0x1c2238,_0x2801c5){return _0x1c2238[_0xdc17('0x7')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf66=['exports','Automation','tools_automations','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x34bf2a,_0x413840){var _0x21103e=function(_0x90284a){while(--_0x90284a){_0x34bf2a['push'](_0x34bf2a['shift']());}};_0x21103e(++_0x413840);}(_0xcf66,0x71));var _0x6cf6=function(_0x32c640,_0x20837e){_0x32c640=_0x32c640-0x0;var _0x1d2506=_0xcf66[_0x32c640];return _0x1d2506;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var logger=require(_0x6cf6('0x2'))('api');var moment=require(_0x6cf6('0x3'));var BPromise=require(_0x6cf6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var attributes=require('./automation.attributes');module[_0x6cf6('0x7')]=function(_0x1fbedd,_0x2a573e){return _0x1fbedd['define'](_0x6cf6('0x8'),attributes,{'tableName':_0x6cf6('0x9'),'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 e7ac037..e832b63 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 _0xacc3=['Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','debug'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0xacc3,0x1a6));var _0x3acc=function(_0x35e8d6,_0x1179f3){_0x35e8d6=_0x35e8d6-0x0;var _0x2036cb=_0xacc3[_0x35e8d6];return _0x2036cb;};'use strict';var _=require(_0x3acc('0x0'));var util=require(_0x3acc('0x1'));var moment=require(_0x3acc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3acc('0x3'));var db=require(_0x3acc('0x4'))['db'];var utils=require(_0x3acc('0x5'));var logger=require(_0x3acc('0x6'))('rpc');var config=require(_0x3acc('0x7'));var jayson=require(_0x3acc('0x8'));var client=jayson[_0x3acc('0x9')][_0x3acc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f2adf,_0xa6323b,_0x5a33d4){return new BPromise(function(_0x2cc529,_0x1ad293){return client[_0x3acc('0xb')](_0x2f2adf,_0x5a33d4)[_0x3acc('0xc')](function(_0x1742cb){logger['info'](_0x3acc('0xd'),_0xa6323b,'request\x20sent');logger[_0x3acc('0xe')](_0x3acc('0xf'),_0xa6323b,_0x3acc('0x10'),JSON[_0x3acc('0x11')](_0x1742cb));if(_0x1742cb[_0x3acc('0x12')]){if(_0x1742cb['error'][_0x3acc('0x13')]===0x1f4){logger[_0x3acc('0x12')]('Automation,\x20%s,\x20%s',_0xa6323b,_0x1742cb[_0x3acc('0x12')][_0x3acc('0x14')]);return _0x1ad293(_0x1742cb[_0x3acc('0x12')][_0x3acc('0x14')]);}logger[_0x3acc('0x12')](_0x3acc('0xd'),_0xa6323b,_0x1742cb[_0x3acc('0x12')][_0x3acc('0x14')]);return _0x2cc529(_0x1742cb[_0x3acc('0x12')][_0x3acc('0x14')]);}else{logger['info'](_0x3acc('0xd'),_0xa6323b,'request\x20sent');_0x2cc529(_0x1742cb[_0x3acc('0x15')]['message']);}})[_0x3acc('0x16')](function(_0x4c33c6){logger[_0x3acc('0x12')]('Automation,\x20%s,\x20%s',_0xa6323b,_0x4c33c6);_0x1ad293(_0x4c33c6);});});} \ No newline at end of file +var _0x0b90=['message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Automation,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x0b90,0x134));var _0x00b9=function(_0x100d15,_0x49ac8d){_0x100d15=_0x100d15-0x0;var _0x5224e7=_0x0b90[_0x100d15];return _0x5224e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x00b9('0x0'));var rs=require(_0x00b9('0x1'));var fs=require('fs');var Redis=require(_0x00b9('0x2'));var db=require(_0x00b9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x00b9('0x4'))(_0x00b9('0x5'));var config=require(_0x00b9('0x6'));var jayson=require(_0x00b9('0x7'));var client=jayson[_0x00b9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46e92a,_0x2b8040,_0x360031){return new BPromise(function(_0x9eb1ef,_0x31c42e){return client['request'](_0x46e92a,_0x360031)[_0x00b9('0x9')](function(_0x5a13fb){logger[_0x00b9('0xa')](_0x00b9('0xb'),_0x2b8040,_0x00b9('0xc'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x2b8040,_0x00b9('0xc'),JSON[_0x00b9('0xd')](_0x5a13fb));if(_0x5a13fb[_0x00b9('0xe')]){if(_0x5a13fb[_0x00b9('0xe')]['code']===0x1f4){logger['error'](_0x00b9('0xb'),_0x2b8040,_0x5a13fb['error']['message']);return _0x31c42e(_0x5a13fb['error']['message']);}logger[_0x00b9('0xe')]('Automation,\x20%s,\x20%s',_0x2b8040,_0x5a13fb['error'][_0x00b9('0xf')]);return _0x9eb1ef(_0x5a13fb[_0x00b9('0xe')]['message']);}else{logger[_0x00b9('0xa')]('Automation,\x20%s,\x20%s',_0x2b8040,_0x00b9('0xc'));_0x9eb1ef(_0x5a13fb[_0x00b9('0x10')][_0x00b9('0xf')]);}})['catch'](function(_0xed689b){logger[_0x00b9('0xe')]('Automation,\x20%s,\x20%s',_0x2b8040,_0xed689b);_0x31c42e(_0xed689b);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index c0266b7..e21c7ee 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 _0xdcda=['destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','getActions','post','create','/:id/actions','addActions','put','update'];(function(_0x47809f,_0x17a9d2){var _0x5bfd78=function(_0x36fc46){while(--_0x36fc46){_0x47809f['push'](_0x47809f['shift']());}};_0x5bfd78(++_0x17a9d2);}(_0xdcda,0xa3));var _0xadcd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdcda[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xadcd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xadcd('0x1'));var express=require(_0xadcd('0x2'));var router=express[_0xadcd('0x3')]();var auth=require(_0xadcd('0x4'));var interaction=require(_0xadcd('0x5'));var config=require(_0xadcd('0x6'));var controller=require(_0xadcd('0x7'));router[_0xadcd('0x8')]('/',auth[_0xadcd('0x9')](),controller[_0xadcd('0xa')]);router[_0xadcd('0x8')](_0xadcd('0xb'),auth[_0xadcd('0x9')](),controller[_0xadcd('0xc')]);router['get']('/:id/conditions',auth[_0xadcd('0x9')](),controller[_0xadcd('0xd')]);router['get']('/:id/actions',auth[_0xadcd('0x9')](),controller[_0xadcd('0xe')]);router[_0xadcd('0xf')]('/',auth['isAuthenticated'](),controller[_0xadcd('0x10')]);router[_0xadcd('0xf')]('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0xadcd('0xf')](_0xadcd('0x11'),auth['isAuthenticated'](),controller[_0xadcd('0x12')]);router[_0xadcd('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xadcd('0x14')]);router['delete'](_0xadcd('0xb'),auth[_0xadcd('0x9')](),controller[_0xadcd('0x15')]);module[_0xadcd('0x16')]=router; \ No newline at end of file +var _0xfad1=['exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/conditions','/:id/actions','post','create','addConditions','addActions','put','update','destroy'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xfad1,0xd3));var _0x1fad=function(_0x22ca98,_0x41dcc2){_0x22ca98=_0x22ca98-0x0;var _0x4e7adf=_0xfad1[_0x22ca98];return _0x4e7adf;};'use strict';var multer=require('multer');var util=require(_0x1fad('0x0'));var path=require(_0x1fad('0x1'));var timeout=require('connect-timeout');var express=require(_0x1fad('0x2'));var router=express[_0x1fad('0x3')]();var auth=require(_0x1fad('0x4'));var interaction=require(_0x1fad('0x5'));var config=require(_0x1fad('0x6'));var controller=require('./automation.controller');router[_0x1fad('0x7')]('/',auth[_0x1fad('0x8')](),controller['index']);router['get'](_0x1fad('0x9'),auth[_0x1fad('0x8')](),controller[_0x1fad('0xa')]);router[_0x1fad('0x7')](_0x1fad('0xb'),auth[_0x1fad('0x8')](),controller['getConditions']);router[_0x1fad('0x7')](_0x1fad('0xc'),auth[_0x1fad('0x8')](),controller['getActions']);router[_0x1fad('0xd')]('/',auth['isAuthenticated'](),controller[_0x1fad('0xe')]);router[_0x1fad('0xd')](_0x1fad('0xb'),auth['isAuthenticated'](),controller[_0x1fad('0xf')]);router[_0x1fad('0xd')](_0x1fad('0xc'),auth[_0x1fad('0x8')](),controller[_0x1fad('0x10')]);router[_0x1fad('0x11')](_0x1fad('0x9'),auth[_0x1fad('0x8')](),controller[_0x1fad('0x12')]);router['delete']('/:id',auth[_0x1fad('0x8')](),controller[_0x1fad('0x13')]);module[_0x1fad('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 79fac4f..77b3877 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 _0x8f9d=['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','exports','name','ENUM','ivr','STRING','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)'];(function(_0x480ce6,_0x3721a7){var _0x3683fc=function(_0x300e99){while(--_0x300e99){_0x480ce6['push'](_0x480ce6['shift']());}};_0x3683fc(++_0x3721a7);}(_0x8f9d,0xbf));var _0xd8f9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8f9d[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xd8f9('0x0'));module[_0xd8f9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd8f9('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd8f9('0x3')](_0xd8f9('0x4')),'allowNull':![],'defaultValue':_0xd8f9('0x4')},'description':{'type':Sequelize[_0xd8f9('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd8f9('0x6')},'limitCalls':{'type':Sequelize[_0xd8f9('0x7')](0x4)[_0xd8f9('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xd8f9('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd8f9('0xd')},'dialTimezone':{'type':Sequelize[_0xd8f9('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd8f9('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xd8f9('0x3')](_0xd8f9('0xf'),_0xd8f9('0x10'),_0xd8f9('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xd8f9('0x12')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd8f9('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd8f9('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd8f9('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd8f9('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd8f9('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd8f9('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd8f9('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd8f9('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xd8f9('0x3')](_0xd8f9('0x1a'),_0xd8f9('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd8f9('0x1c')},'dialCutDigit':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd8f9('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0x24')}}; \ No newline at end of file +var _0xdff8=['#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0xb6e257,_0x445cd7){var _0x33b778=function(_0x28ba38){while(--_0x28ba38){_0xb6e257['push'](_0xb6e257['shift']());}};_0x33b778(++_0x445cd7);}(_0xdff8,0xa8));var _0x8dff=function(_0x30bd01,_0x557a2c){_0x30bd01=_0x30bd01-0x0;var _0x44cdc3=_0xdff8[_0x30bd01];return _0x44cdc3;};'use strict';var Sequelize=require(_0x8dff('0x0'));module[_0x8dff('0x1')]={'name':{'type':Sequelize[_0x8dff('0x2')],'unique':_0x8dff('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8dff('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x8dff('0x5')},'description':{'type':Sequelize[_0x8dff('0x2')]},'active':{'type':Sequelize[_0x8dff('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x8dff('0x7')](0x4)[_0x8dff('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8dff('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8dff('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8dff('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x8dff('0x7')](0x3)[_0x8dff('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8dff('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8dff('0x7')](0x3)[_0x8dff('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8dff('0x7')](0x5)[_0x8dff('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8dff('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x8dff('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8dff('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8dff('0x7')](0x5)[_0x8dff('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8dff('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8dff('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8dff('0x7')](0x5)[_0x8dff('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8dff('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8dff('0x7')](0x3)[_0x8dff('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8dff('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8dff('0x2')],'defaultValue':_0x8dff('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x8dff('0x4')](_0x8dff('0x11'),_0x8dff('0x12'),_0x8dff('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x8dff('0x6')],'defaultValue':0x0,'comment':_0x8dff('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x8dff('0x7')](0x9)[_0x8dff('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x8dff('0x7')](0x9)[_0x8dff('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8dff('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8dff('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8dff('0x7')](0x9)[_0x8dff('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8dff('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x8dff('0x7')](0x9)[_0x8dff('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8dff('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8dff('0x7')](0x9)[_0x8dff('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8dff('0x7')](0x9)[_0x8dff('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8dff('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8dff('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8dff('0x7')](0x9)[_0x8dff('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8dff('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8dff('0x4')](_0x8dff('0x1a'),_0x8dff('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8dff('0x7')](0x3)[_0x8dff('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x8dff('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8dff('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8dff('0x7')](0x3)[_0x8dff('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8dff('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8dff('0x7')](0x5)[_0x8dff('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8dff('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x8dff('0x7')](0x5)[_0x8dff('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8dff('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8dff('0x7')](0x3)[_0x8dff('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8dff('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8dff('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8dff('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x8dff('0x7')](0x3)[_0x8dff('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8dff('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8dff('0x7')](0x5)[_0x8dff('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8dff('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8dff('0x7')](0x3)[_0x8dff('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8dff('0x7')](0x5)[_0x8dff('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 441aaa1..32597db 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 _0x5cd5=['removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','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','offset','limit','set','Content-Range','reject','save','update','then','destroy','IvrCampaigns','error','name','send','Campaign','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','clone','omit','createdAt','updatedAt','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','CampaignId','findAll','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','scheduledAt','push','all','removeLists','ids','getBlackLists','addBlackLists','spread','cm_hopper_black','fromQuery','sequelize'];(function(_0x1a5f67,_0x21d8d5){var _0x51f104=function(_0x21517e){while(--_0x21517e){_0x1a5f67['push'](_0x1a5f67['shift']());}};_0x51f104(++_0x21d8d5);}(_0x5cd5,0x10b));var _0x55cd=function(_0x2661f1,_0x1e0f14){_0x2661f1=_0x2661f1-0x0;var _0x44cead=_0x5cd5[_0x2661f1];return _0x44cead;};'use strict';var pdf=require(_0x55cd('0x0'));var emlformat=require(_0x55cd('0x1'));var rimraf=require(_0x55cd('0x2'));var zipdir=require(_0x55cd('0x3'));var jsonpatch=require(_0x55cd('0x4'));var rp=require(_0x55cd('0x5'));var moment=require('moment');var BPromise=require(_0x55cd('0x6'));var Mustache=require(_0x55cd('0x7'));var util=require(_0x55cd('0x8'));var path=require(_0x55cd('0x9'));var sox=require(_0x55cd('0xa'));var csv=require(_0x55cd('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x55cd('0xc'));var squel=require('squel');var crypto=require(_0x55cd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x55cd('0xe'));var toCsv=require(_0x55cd('0xb'));var querystring=require(_0x55cd('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x55cd('0x10'));var qs=require(_0x55cd('0x11'));var as=require(_0x55cd('0x12'));var hardwareService=require(_0x55cd('0x13'));var logger=require(_0x55cd('0x14'))(_0x55cd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x55cd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43b7f2,_0x2357fe){_0x2357fe=_0x2357fe||0xcc;return function(_0x5adcc2){if(_0x5adcc2){return _0x43b7f2[_0x55cd('0x17')](_0x2357fe);}return _0x43b7f2['status'](_0x2357fe)['end']();};}function respondWithResult(_0x45030b,_0x569e9e){_0x569e9e=_0x569e9e||0xc8;return function(_0x30b9c2){if(_0x30b9c2){return _0x45030b[_0x55cd('0x18')](_0x569e9e)[_0x55cd('0x19')](_0x30b9c2);}};}function respondWithFilteredResult(_0xa7eb2d,_0xfceec9){return function(_0x11c498){if(_0x11c498){var _0x5c850b=_0x11c498[_0x55cd('0x1a')],_0x26fcd6=_0xfceec9['offset'],_0xf7907b=_0xfceec9[_0x55cd('0x1b')]+_0xfceec9[_0x55cd('0x1c')],_0x277e1e;if(_0xf7907b>=_0x5c850b){_0xf7907b=_0x5c850b;_0x277e1e=0xc8;}else{_0x277e1e=0xce;}_0xa7eb2d['status'](_0x277e1e);return _0xa7eb2d[_0x55cd('0x1d')](_0x55cd('0x1e'),_0x26fcd6+'-'+_0xf7907b+'/'+_0x5c850b)[_0x55cd('0x19')](_0x11c498);}return null;};}function patchUpdates(_0x30cd24){return function(_0x2ccaf6){try{jsonpatch['apply'](_0x2ccaf6,_0x30cd24,!![]);}catch(_0x552c72){return BPromise[_0x55cd('0x1f')](_0x552c72);}return _0x2ccaf6[_0x55cd('0x20')]();};}function saveUpdates(_0x1ea4e4,_0x5592e6){return function(_0x254b4b){if(_0x254b4b){return _0x254b4b[_0x55cd('0x21')](_0x1ea4e4)[_0x55cd('0x22')](function(_0x1eba6d){return _0x1eba6d;});}return null;};}function removeEntity(_0x3a43dc,_0x26ad37){return function(_0x581218){if(_0x581218){return _0x581218[_0x55cd('0x23')]()[_0x55cd('0x22')](function(){var _0x5e8a4b=_0x581218['get']({'plain':!![]});var _0x24e78f=_0x55cd('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x24e78f,'resourceId':_0x5e8a4b['id']}})[_0x55cd('0x22')](function(){return _0x581218;});})[_0x55cd('0x22')](function(){_0x3a43dc[_0x55cd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x209339,_0xdac999){return function(_0x141c2f){if(!_0x141c2f){_0x209339[_0x55cd('0x17')](0x194);}return _0x141c2f;};}function handleError(_0x27c80b,_0x15ebef){_0x15ebef=_0x15ebef||0x1f4;return function(_0x2d592c){logger[_0x55cd('0x25')](_0x2d592c['stack']);if(_0x2d592c['name']){delete _0x2d592c[_0x55cd('0x26')];}_0x27c80b[_0x55cd('0x18')](_0x15ebef)[_0x55cd('0x27')](_0x2d592c);};}exports['index']=function(_0x4ad8b6,_0x70a565){var _0x61d2af={},_0x4b2cde={},_0x7b7a97={'count':0x0,'rows':[]};var _0x534dfc=_['map'](db[_0x55cd('0x28')]['rawAttributes'],function(_0x3ad984){return{'name':_0x3ad984[_0x55cd('0x29')],'type':_0x3ad984[_0x55cd('0x2a')]['key']};});_0x4b2cde[_0x55cd('0x2b')]=_[_0x55cd('0x2c')](_0x534dfc,_0x55cd('0x26'));_0x4b2cde[_0x55cd('0x2d')]=_[_0x55cd('0x2e')](_0x4ad8b6[_0x55cd('0x2d')]);_0x4b2cde[_0x55cd('0x2f')]=_[_0x55cd('0x30')](_0x4b2cde[_0x55cd('0x2b')],_0x4b2cde[_0x55cd('0x2d')]);_0x61d2af['attributes']=_['intersection'](_0x4b2cde['model'],qs[_0x55cd('0x31')](_0x4ad8b6[_0x55cd('0x2d')][_0x55cd('0x31')]));_0x61d2af[_0x55cd('0x32')]=_0x61d2af[_0x55cd('0x32')][_0x55cd('0x33')]?_0x61d2af['attributes']:_0x4b2cde[_0x55cd('0x2b')];if(!_0x4ad8b6[_0x55cd('0x2d')][_0x55cd('0x34')](_0x55cd('0x35'))){_0x61d2af[_0x55cd('0x1c')]=qs['limit'](_0x4ad8b6[_0x55cd('0x2d')]['limit']);_0x61d2af['offset']=qs[_0x55cd('0x1b')](_0x4ad8b6[_0x55cd('0x2d')][_0x55cd('0x1b')]);}_0x61d2af[_0x55cd('0x36')]=qs[_0x55cd('0x37')](_0x4ad8b6[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x61d2af['where']=qs['filters'](_[_0x55cd('0x38')](_0x4ad8b6[_0x55cd('0x2d')],_0x4b2cde[_0x55cd('0x2f')]),_0x534dfc);if(_0x4ad8b6[_0x55cd('0x2d')][_0x55cd('0x39')]){_0x61d2af[_0x55cd('0x3a')]=_[_0x55cd('0x3b')](_0x61d2af[_0x55cd('0x3a')],{'$or':_[_0x55cd('0x2c')](_0x534dfc,function(_0x439f6c){if(_0x439f6c[_0x55cd('0x2a')]!==_0x55cd('0x3c')){var _0x2f922f={};_0x2f922f[_0x439f6c['name']]={'$like':'%'+_0x4ad8b6[_0x55cd('0x2d')]['filter']+'%'};return _0x2f922f;}})});}_0x61d2af=_[_0x55cd('0x3b')]({},_0x61d2af,_0x4ad8b6[_0x55cd('0x3d')]);var _0x2d8def={'where':_0x61d2af[_0x55cd('0x3a')]};return db['Campaign'][_0x55cd('0x1a')](_0x2d8def)[_0x55cd('0x22')](function(_0x48cb28){_0x7b7a97[_0x55cd('0x1a')]=_0x48cb28;if(_0x4ad8b6[_0x55cd('0x2d')][_0x55cd('0x3e')]){_0x61d2af[_0x55cd('0x3f')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x61d2af);})[_0x55cd('0x22')](function(_0x3f926c){_0x7b7a97[_0x55cd('0x40')]=_0x3f926c;return _0x7b7a97;})['then'](respondWithFilteredResult(_0x70a565,_0x61d2af))[_0x55cd('0x41')](handleError(_0x70a565,null));};exports[_0x55cd('0x42')]=function(_0x246aee,_0x24fdce){var _0x195190={'raw':![],'where':{'id':_0x246aee[_0x55cd('0x43')]['id']}},_0x14ad12={};_0x14ad12['model']=_[_0x55cd('0x2e')](db[_0x55cd('0x28')][_0x55cd('0x44')]);_0x14ad12[_0x55cd('0x2d')]=_[_0x55cd('0x2e')](_0x246aee['query']);_0x14ad12['filters']=_[_0x55cd('0x30')](_0x14ad12[_0x55cd('0x2b')],_0x14ad12[_0x55cd('0x2d')]);_0x195190[_0x55cd('0x32')]=_[_0x55cd('0x30')](_0x14ad12[_0x55cd('0x2b')],qs[_0x55cd('0x31')](_0x246aee[_0x55cd('0x2d')]['fields']));_0x195190[_0x55cd('0x32')]=_0x195190[_0x55cd('0x32')][_0x55cd('0x33')]?_0x195190[_0x55cd('0x32')]:_0x14ad12[_0x55cd('0x2b')];if(_0x246aee['query']['includeAll']){_0x195190[_0x55cd('0x3f')]=[{'all':!![]}];}_0x195190=_[_0x55cd('0x3b')]({},_0x195190,_0x246aee[_0x55cd('0x3d')]);return db[_0x55cd('0x28')][_0x55cd('0x45')](_0x195190)[_0x55cd('0x22')](handleEntityNotFound(_0x24fdce,null))[_0x55cd('0x22')](respondWithResult(_0x24fdce,null))[_0x55cd('0x41')](handleError(_0x24fdce,null));};exports[_0x55cd('0x46')]=function(_0x2b6101,_0x3f6063){return db['Campaign'][_0x55cd('0x46')](_0x2b6101[_0x55cd('0x47')],{})[_0x55cd('0x22')](function(_0x55e171){var _0x49dee8=_0x2b6101[_0x55cd('0x48')][_0x55cd('0x49')]({'plain':!![]});if(!_0x49dee8)throw new Error(_0x55cd('0x4a'));if(_0x49dee8[_0x55cd('0x4b')]===_0x55cd('0x48')){var _0x34c526=_0x55e171[_0x55cd('0x49')]({'plain':!![]});var _0x36c160=_0x55cd('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x36c160,'userProfileId':_0x49dee8[_0x55cd('0x4c')]},'raw':!![]})[_0x55cd('0x22')](function(_0x2136ec){if(_0x2136ec&&_0x2136ec['autoAssociation']===0x0){return db[_0x55cd('0x4d')][_0x55cd('0x46')]({'name':_0x34c526[_0x55cd('0x26')],'resourceId':_0x34c526['id'],'type':_0x2136ec[_0x55cd('0x26')],'sectionId':_0x2136ec['id']},{})[_0x55cd('0x22')](function(){return _0x55e171;});}else{return _0x55e171;}})[_0x55cd('0x41')](function(_0x420a2a){logger[_0x55cd('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x420a2a);throw _0x420a2a;});}return _0x55e171;})[_0x55cd('0x22')](respondWithResult(_0x3f6063,0xc9))[_0x55cd('0x41')](handleError(_0x3f6063,null));};exports[_0x55cd('0x4e')]=function(_0x36ca11,_0x23104f){var _0x41656d={'where':{'id':_0x36ca11['params']['id']}},_0xd3edbb={};_0xd3edbb[_0x55cd('0x2b')]=_[_0x55cd('0x2e')](db['Campaign'][_0x55cd('0x44')]);_0x41656d[_0x55cd('0x32')]=_[_0x55cd('0x30')](_0xd3edbb[_0x55cd('0x2b')],qs[_0x55cd('0x31')](_0x36ca11[_0x55cd('0x2d')][_0x55cd('0x31')]));_0x41656d[_0x55cd('0x32')]=_0x41656d[_0x55cd('0x32')][_0x55cd('0x33')]?_0x41656d[_0x55cd('0x32')]:_0xd3edbb[_0x55cd('0x2b')];if(_0x36ca11['query'][_0x55cd('0x3e')]){_0x41656d['include']=[{'all':!![]}];}_0x41656d=_[_0x55cd('0x3b')]({},_0x41656d,_0x36ca11['options']);return db[_0x55cd('0x28')][_0x55cd('0x45')](_0x41656d)[_0x55cd('0x22')](handleEntityNotFound(_0x23104f,null))[_0x55cd('0x22')](function(_0x4e4c50){if(_0x4e4c50){var _0xfa6bf7=_0x4e4c50[_0x55cd('0x49')]({'plain':!![]});_0xfa6bf7=qs[_0x55cd('0x4f')](_0xfa6bf7,['id',_0x55cd('0x50'),_0x55cd('0x51')]);_0x36ca11['body']=_[_0x55cd('0x4f')](_0x36ca11['body'],['id','createdAt',_0x55cd('0x51')]);return db[_0x55cd('0x28')]['create'](_[_0x55cd('0x3b')](_0xfa6bf7,_0x36ca11[_0x55cd('0x47')]),{'include':_0x36ca11[_0x55cd('0x2d')][_0x55cd('0x3e')]?[{'all':!![]}]:undefined})[_0x55cd('0x22')](function(_0x4f166c){var _0x3ed250=_0x36ca11[_0x55cd('0x48')]['get']({'plain':!![]});if(!_0x3ed250)throw new Error(_0x55cd('0x4a'));if(_0x3ed250[_0x55cd('0x4b')]===_0x55cd('0x48')){var _0x439d92=_0x4f166c[_0x55cd('0x49')]({'plain':!![]});var _0x4d44af='IvrCampaigns';return db['UserProfileSection'][_0x55cd('0x45')]({'where':{'name':_0x4d44af,'userProfileId':_0x3ed250[_0x55cd('0x4c')]},'raw':!![]})[_0x55cd('0x22')](function(_0x524e64){if(_0x524e64&&_0x524e64[_0x55cd('0x52')]===0x0){return db[_0x55cd('0x4d')]['create']({'name':_0x439d92['name'],'resourceId':_0x439d92['id'],'type':_0x524e64[_0x55cd('0x26')],'sectionId':_0x524e64['id']},{})[_0x55cd('0x22')](function(){return _0x4f166c;});}else{return _0x4f166c;}})['catch'](function(_0x45952e){logger[_0x55cd('0x25')](_0x55cd('0x53'),_0x45952e);throw _0x45952e;});}return _0x4f166c;});}})[_0x55cd('0x22')](respondWithResult(_0x23104f,0xc9))[_0x55cd('0x41')](handleError(_0x23104f,null));};exports[_0x55cd('0x21')]=function(_0x3835f8,_0x421b4c){if(_0x3835f8[_0x55cd('0x47')]['id']){delete _0x3835f8['body']['id'];}return db[_0x55cd('0x28')][_0x55cd('0x45')]({'where':{'id':_0x3835f8['params']['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x421b4c,null))[_0x55cd('0x22')](saveUpdates(_0x3835f8['body'],null))['then'](respondWithResult(_0x421b4c,null))[_0x55cd('0x41')](handleError(_0x421b4c,null));};exports[_0x55cd('0x23')]=function(_0x21448d,_0x37b751){return db[_0x55cd('0x28')]['find']({'where':{'id':_0x21448d[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x37b751,null))['then'](removeEntity(_0x37b751,null))[_0x55cd('0x41')](handleError(_0x37b751,null));};exports[_0x55cd('0x54')]=function(_0x50ebf4,_0x30dd83,_0x3a029c){var _0x441c29={'raw':!![],'where':{}};var _0xba85ef={};var _0x217176={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x50ebf4[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x30dd83,null))[_0x55cd('0x22')](function(_0x5161ae){if(_0x5161ae){_0xba85ef[_0x55cd('0x2b')]=_[_0x55cd('0x2e')](db[_0x55cd('0x55')]['rawAttributes']);_0xba85ef['query']=_[_0x55cd('0x2e')](_0x50ebf4['query']);_0xba85ef[_0x55cd('0x2f')]=_[_0x55cd('0x30')](_0xba85ef[_0x55cd('0x2b')],_0xba85ef[_0x55cd('0x2d')]);_0x441c29['attributes']=_[_0x55cd('0x30')](_0xba85ef['model'],qs['fields'](_0x50ebf4[_0x55cd('0x2d')][_0x55cd('0x31')]));_0x441c29[_0x55cd('0x32')]=_0x441c29[_0x55cd('0x32')][_0x55cd('0x33')]?_0x441c29[_0x55cd('0x32')]:_0xba85ef[_0x55cd('0x2b')];if(!_0x50ebf4[_0x55cd('0x2d')][_0x55cd('0x34')]('nolimit')){_0x441c29[_0x55cd('0x1c')]=qs[_0x55cd('0x1c')](_0x50ebf4[_0x55cd('0x2d')]['limit']);_0x441c29[_0x55cd('0x1b')]=qs[_0x55cd('0x1b')](_0x50ebf4['query']['offset']);}_0x441c29[_0x55cd('0x36')]=qs[_0x55cd('0x37')](_0x50ebf4[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x441c29['where']=qs[_0x55cd('0x2f')](_[_0x55cd('0x38')](_0x50ebf4[_0x55cd('0x2d')],_0xba85ef[_0x55cd('0x2f')]));_0x441c29[_0x55cd('0x3a')][_0x55cd('0x56')]=_0x5161ae['id'];if(_0x50ebf4[_0x55cd('0x2d')][_0x55cd('0x39')]){_0x441c29['where']=_[_0x55cd('0x3b')](_0x441c29[_0x55cd('0x3a')],{'$or':_[_0x55cd('0x2c')](_0x441c29[_0x55cd('0x32')],function(_0x2cb94d){var _0x42eebd={};_0x42eebd[_0x2cb94d]={'$like':'%'+_0x50ebf4['query'][_0x55cd('0x39')]+'%'};return _0x42eebd;})});}_0x441c29=_['merge']({},_0x441c29,_0x50ebf4[_0x55cd('0x3d')]);return db[_0x55cd('0x55')][_0x55cd('0x1a')]({'where':_0x441c29['where']})[_0x55cd('0x22')](function(_0x5075b5){_0x217176['count']=_0x5075b5;if(_0x50ebf4[_0x55cd('0x2d')][_0x55cd('0x3e')]){_0x441c29['include']=[{'all':!![]}];}return db[_0x55cd('0x55')][_0x55cd('0x57')](_0x441c29);})['then'](function(_0xcf0ad6){_0x217176[_0x55cd('0x40')]=_0xcf0ad6;return _0x217176;});}})['then'](respondWithFilteredResult(_0x30dd83,_0x441c29))['catch'](handleError(_0x30dd83,null));};exports[_0x55cd('0x58')]=function(_0x5810e2,_0xe972f3,_0x6a8e15){var _0x388254={'raw':!![],'where':{}};var _0x1d094a={};var _0x3c68a4={'count':0x0,'rows':[]};return db['Campaign'][_0x55cd('0x59')]({'where':{'id':_0x5810e2[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0xe972f3,null))[_0x55cd('0x22')](function(_0x3290c6){if(_0x3290c6){_0x1d094a[_0x55cd('0x2b')]=_['keys'](db[_0x55cd('0x5a')][_0x55cd('0x44')]);_0x1d094a[_0x55cd('0x2d')]=_[_0x55cd('0x2e')](_0x5810e2[_0x55cd('0x2d')]);_0x1d094a[_0x55cd('0x2f')]=_[_0x55cd('0x30')](_0x1d094a[_0x55cd('0x2b')],_0x1d094a[_0x55cd('0x2d')]);_0x388254['attributes']=_[_0x55cd('0x30')](_0x1d094a[_0x55cd('0x2b')],qs[_0x55cd('0x31')](_0x5810e2['query'][_0x55cd('0x31')]));_0x388254[_0x55cd('0x32')]=_0x388254[_0x55cd('0x32')][_0x55cd('0x33')]?_0x388254[_0x55cd('0x32')]:_0x1d094a[_0x55cd('0x2b')];if(!_0x5810e2[_0x55cd('0x2d')][_0x55cd('0x34')]('nolimit')){_0x388254[_0x55cd('0x1c')]=qs['limit'](_0x5810e2[_0x55cd('0x2d')][_0x55cd('0x1c')]);_0x388254[_0x55cd('0x1b')]=qs[_0x55cd('0x1b')](_0x5810e2[_0x55cd('0x2d')]['offset']);}_0x388254[_0x55cd('0x36')]=qs[_0x55cd('0x37')](_0x5810e2[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x388254[_0x55cd('0x3a')]=qs[_0x55cd('0x2f')](_[_0x55cd('0x38')](_0x5810e2[_0x55cd('0x2d')],_0x1d094a[_0x55cd('0x2f')]));_0x388254[_0x55cd('0x3a')][_0x55cd('0x56')]=_0x3290c6['id'];if(_0x5810e2['query'][_0x55cd('0x39')]){_0x388254[_0x55cd('0x3a')]=_['merge'](_0x388254[_0x55cd('0x3a')],{'$or':_['map'](_0x388254[_0x55cd('0x32')],function(_0x293c99){var _0x591943={};_0x591943[_0x293c99]={'$like':'%'+_0x5810e2[_0x55cd('0x2d')][_0x55cd('0x39')]+'%'};return _0x591943;})});}_0x388254=_['merge']({},_0x388254,_0x5810e2[_0x55cd('0x3d')]);return db['CmHopperHistory'][_0x55cd('0x1a')]({'where':_0x388254[_0x55cd('0x3a')]})[_0x55cd('0x22')](function(_0x2840d2){_0x3c68a4[_0x55cd('0x1a')]=_0x2840d2;if(_0x5810e2[_0x55cd('0x2d')][_0x55cd('0x3e')]){_0x388254[_0x55cd('0x3f')]=[{'all':!![]}];}return db[_0x55cd('0x5a')][_0x55cd('0x57')](_0x388254);})[_0x55cd('0x22')](function(_0x8b8c71){_0x3c68a4['rows']=_0x8b8c71;return _0x3c68a4;});}})['then'](respondWithFilteredResult(_0xe972f3,_0x388254))[_0x55cd('0x41')](handleError(_0xe972f3,null));};exports['getHopperFinals']=function(_0xa7ea87,_0x4118d7,_0x35b4a0){var _0x161bb3={'raw':!![],'where':{}};var _0x2c4abf={};var _0x37bc3f={'count':0x0,'rows':[]};return db[_0x55cd('0x28')][_0x55cd('0x59')]({'where':{'id':_0xa7ea87[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x4118d7,null))[_0x55cd('0x22')](function(_0x2c8721){if(_0x2c8721){_0x2c4abf[_0x55cd('0x2b')]=_[_0x55cd('0x2e')](db[_0x55cd('0x5b')][_0x55cd('0x44')]);_0x2c4abf[_0x55cd('0x2d')]=_[_0x55cd('0x2e')](_0xa7ea87['query']);_0x2c4abf[_0x55cd('0x2f')]=_[_0x55cd('0x30')](_0x2c4abf[_0x55cd('0x2b')],_0x2c4abf['query']);_0x161bb3[_0x55cd('0x32')]=_[_0x55cd('0x30')](_0x2c4abf[_0x55cd('0x2b')],qs[_0x55cd('0x31')](_0xa7ea87['query'][_0x55cd('0x31')]));_0x161bb3[_0x55cd('0x32')]=_0x161bb3[_0x55cd('0x32')][_0x55cd('0x33')]?_0x161bb3[_0x55cd('0x32')]:_0x2c4abf[_0x55cd('0x2b')];if(!_0xa7ea87['query']['hasOwnProperty']('nolimit')){_0x161bb3['limit']=qs['limit'](_0xa7ea87[_0x55cd('0x2d')][_0x55cd('0x1c')]);_0x161bb3[_0x55cd('0x1b')]=qs['offset'](_0xa7ea87[_0x55cd('0x2d')][_0x55cd('0x1b')]);}_0x161bb3[_0x55cd('0x36')]=qs[_0x55cd('0x37')](_0xa7ea87[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x161bb3[_0x55cd('0x3a')]=qs[_0x55cd('0x2f')](_[_0x55cd('0x38')](_0xa7ea87[_0x55cd('0x2d')],_0x2c4abf[_0x55cd('0x2f')]));_0x161bb3[_0x55cd('0x3a')][_0x55cd('0x56')]=_0x2c8721['id'];if(_0xa7ea87[_0x55cd('0x2d')][_0x55cd('0x39')]){_0x161bb3['where']=_[_0x55cd('0x3b')](_0x161bb3['where'],{'$or':_[_0x55cd('0x2c')](_0x161bb3[_0x55cd('0x32')],function(_0x3d3896){var _0x33a9b6={};_0x33a9b6[_0x3d3896]={'$like':'%'+_0xa7ea87[_0x55cd('0x2d')][_0x55cd('0x39')]+'%'};return _0x33a9b6;})});}_0x161bb3=_['merge']({},_0x161bb3,_0xa7ea87[_0x55cd('0x3d')]);return db[_0x55cd('0x5b')][_0x55cd('0x1a')]({'where':_0x161bb3[_0x55cd('0x3a')]})[_0x55cd('0x22')](function(_0x371882){_0x37bc3f[_0x55cd('0x1a')]=_0x371882;if(_0xa7ea87[_0x55cd('0x2d')][_0x55cd('0x3e')]){_0x161bb3[_0x55cd('0x3f')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x161bb3);})['then'](function(_0xed322b){_0x37bc3f[_0x55cd('0x40')]=_0xed322b;return _0x37bc3f;});}})[_0x55cd('0x22')](respondWithFilteredResult(_0x4118d7,_0x161bb3))['catch'](handleError(_0x4118d7,null));};exports[_0x55cd('0x5c')]=function(_0x559deb,_0x451221,_0x32e16a){var _0x3c817e={'raw':!![],'where':{}};var _0x55d37d={};var _0x1497f6={'count':0x0,'rows':[]};return db[_0x55cd('0x28')]['findOne']({'where':{'id':_0x559deb[_0x55cd('0x43')]['id']}})['then'](handleEntityNotFound(_0x451221,null))[_0x55cd('0x22')](function(_0x5cc876){if(_0x5cc876){_0x55d37d['model']=_[_0x55cd('0x2e')](db[_0x55cd('0x5d')][_0x55cd('0x44')]);_0x55d37d['query']=_['keys'](_0x559deb[_0x55cd('0x2d')]);_0x55d37d[_0x55cd('0x2f')]=_[_0x55cd('0x30')](_0x55d37d[_0x55cd('0x2b')],_0x55d37d[_0x55cd('0x2d')]);_0x3c817e[_0x55cd('0x32')]=_[_0x55cd('0x30')](_0x55d37d[_0x55cd('0x2b')],qs[_0x55cd('0x31')](_0x559deb['query']['fields']));_0x3c817e[_0x55cd('0x32')]=_0x3c817e['attributes']['length']?_0x3c817e['attributes']:_0x55d37d[_0x55cd('0x2b')];if(!_0x559deb[_0x55cd('0x2d')][_0x55cd('0x34')](_0x55cd('0x35'))){_0x3c817e[_0x55cd('0x1c')]=qs[_0x55cd('0x1c')](_0x559deb['query'][_0x55cd('0x1c')]);_0x3c817e[_0x55cd('0x1b')]=qs[_0x55cd('0x1b')](_0x559deb[_0x55cd('0x2d')][_0x55cd('0x1b')]);}_0x3c817e[_0x55cd('0x36')]=qs[_0x55cd('0x37')](_0x559deb[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x3c817e[_0x55cd('0x3a')]=qs['filters'](_[_0x55cd('0x38')](_0x559deb[_0x55cd('0x2d')],_0x55d37d[_0x55cd('0x2f')]));_0x3c817e[_0x55cd('0x3a')][_0x55cd('0x56')]=_0x5cc876['id'];if(_0x559deb['query'][_0x55cd('0x39')]){_0x3c817e[_0x55cd('0x3a')]=_['merge'](_0x3c817e['where'],{'$or':_[_0x55cd('0x2c')](_0x3c817e[_0x55cd('0x32')],function(_0x5615a3){var _0x3273e5={};_0x3273e5[_0x5615a3]={'$like':'%'+_0x559deb['query'][_0x55cd('0x39')]+'%'};return _0x3273e5;})});}_0x3c817e=_[_0x55cd('0x3b')]({},_0x3c817e,_0x559deb[_0x55cd('0x3d')]);return db['CmHopperBlack']['count']({'where':_0x3c817e[_0x55cd('0x3a')]})[_0x55cd('0x22')](function(_0x5341f0){_0x1497f6[_0x55cd('0x1a')]=_0x5341f0;if(_0x559deb[_0x55cd('0x2d')][_0x55cd('0x3e')]){_0x3c817e[_0x55cd('0x3f')]=[{'all':!![]}];}return db[_0x55cd('0x5d')][_0x55cd('0x57')](_0x3c817e);})[_0x55cd('0x22')](function(_0x3f35be){_0x1497f6[_0x55cd('0x40')]=_0x3f35be;return _0x1497f6;});}})[_0x55cd('0x22')](respondWithFilteredResult(_0x451221,_0x3c817e))['catch'](handleError(_0x451221,null));};exports[_0x55cd('0x5e')]=function(_0x28ea09,_0x195b72,_0x18ce38){var _0x366000={};var _0xd78c98={};var _0x5a1401;var _0x5b3f27;return db[_0x55cd('0x28')][_0x55cd('0x59')]({'where':{'id':_0x28ea09[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x195b72,null))[_0x55cd('0x22')](function(_0x1e2e9b){if(_0x1e2e9b){_0x5a1401=_0x1e2e9b;_0xd78c98[_0x55cd('0x2b')]=_[_0x55cd('0x2e')](db[_0x55cd('0x5f')][_0x55cd('0x44')]);_0xd78c98[_0x55cd('0x2d')]=_[_0x55cd('0x2e')](_0x28ea09['query']);_0xd78c98[_0x55cd('0x2f')]=_[_0x55cd('0x30')](_0xd78c98[_0x55cd('0x2b')],_0xd78c98[_0x55cd('0x2d')]);_0x366000[_0x55cd('0x32')]=_['intersection'](_0xd78c98[_0x55cd('0x2b')],qs['fields'](_0x28ea09[_0x55cd('0x2d')][_0x55cd('0x31')]));_0x366000[_0x55cd('0x32')]=_0x366000['attributes'][_0x55cd('0x33')]?_0x366000['attributes']:_0xd78c98[_0x55cd('0x2b')];_0x366000[_0x55cd('0x36')]=qs[_0x55cd('0x37')](_0x28ea09[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x366000[_0x55cd('0x3a')]=qs[_0x55cd('0x2f')](_[_0x55cd('0x38')](_0x28ea09['query'],_0xd78c98[_0x55cd('0x2f')]));if(_0x28ea09['query'][_0x55cd('0x39')]){_0x366000[_0x55cd('0x3a')]=_['merge'](_0x366000['where'],{'$or':_[_0x55cd('0x2c')](_0x366000[_0x55cd('0x32')],function(_0x16c2db){var _0x4c20ca={};_0x4c20ca[_0x16c2db]={'$like':'%'+_0x28ea09[_0x55cd('0x2d')][_0x55cd('0x39')]+'%'};return _0x4c20ca;})});}_0x366000=_[_0x55cd('0x3b')]({},_0x366000,_0x28ea09['options']);return _0x5a1401['getLists'](_0x366000);}})[_0x55cd('0x22')](function(_0x568de0){if(_0x568de0){_0x5b3f27=_0x568de0['length'];if(!_0x28ea09[_0x55cd('0x2d')][_0x55cd('0x34')](_0x55cd('0x35'))){_0x366000[_0x55cd('0x1c')]=qs[_0x55cd('0x1c')](_0x28ea09['query'][_0x55cd('0x1c')]);_0x366000[_0x55cd('0x1b')]=qs[_0x55cd('0x1b')](_0x28ea09[_0x55cd('0x2d')][_0x55cd('0x1b')]);}return _0x5a1401[_0x55cd('0x5e')](_0x366000);}})[_0x55cd('0x22')](function(_0x1ad679){if(_0x1ad679){return _0x1ad679?{'count':_0x5b3f27,'rows':_0x1ad679}:null;}})[_0x55cd('0x22')](respondWithResult(_0x195b72,null))[_0x55cd('0x41')](handleError(_0x195b72,null));};exports[_0x55cd('0x60')]=function(_0x3d937d,_0x2d8fc1,_0x283198){var _0x53afc8,_0x37a801;return db[_0x55cd('0x28')][_0x55cd('0x45')]({'where':{'id':_0x3d937d['params']['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x2d8fc1,null))[_0x55cd('0x22')](function(_0x28fdc8){if(_0x28fdc8){_0x37a801=_0x28fdc8;return _0x28fdc8[_0x55cd('0x60')](_0x3d937d['body']['ids'],_['omit'](_0x3d937d[_0x55cd('0x47')],['ids','id'])||{});}return null;})['spread'](function(_0x450157){var _0xa310ba;_0x53afc8=_0x450157||[];var _0x17389e=[];if(_0x450157){for(var _0x5b1f36=0x0;_0x5b1f36<_0x450157[_0x55cd('0x33')];_0x5b1f36+=0x1){var _0x1fafba=_0x450157[_0x5b1f36]['get']({'plain':!![]});_0x37a801[_0x55cd('0x61')]=_0x3d937d[_0x55cd('0x47')][_0x55cd('0x61')]?_0x3d937d[_0x55cd('0x47')][_0x55cd('0x61')]:_0x37a801[_0x55cd('0x61')];switch(_0x37a801[_0x55cd('0x61')]){case _0x55cd('0x62'):_0xa310ba=squel[_0x55cd('0x63')]()[_0x55cd('0x64')](_0x55cd('0x65'))['fromQuery']([_0x55cd('0x66'),'scheduledAt',_0x55cd('0x67'),_0x55cd('0x68'),_0x55cd('0x56'),_0x55cd('0x50'),_0x55cd('0x51')],squel[_0x55cd('0x69')]()[_0x55cd('0x6a')](_0x55cd('0x66'),_0x55cd('0x66'))['field'](_0x55cd('0x6b'),'scheduledAt')[_0x55cd('0x6a')]('id',_0x55cd('0x67'))['field'](_0x1fafba[_0x55cd('0x6c')][_0x55cd('0x6d')](),_0x55cd('0x68'))[_0x55cd('0x6a')](_0x3d937d['params']['id']['toString'](),_0x55cd('0x56'))[_0x55cd('0x6a')]('NOW()',_0x55cd('0x50'))['field'](_0x55cd('0x6b'),_0x55cd('0x51'))[_0x55cd('0x6e')](_0x55cd('0x6f'))[_0x55cd('0x3a')]('deletedAt\x20IS\x20NULL')[_0x55cd('0x3a')](_0x55cd('0x70'),_0x1fafba['CmListId'][_0x55cd('0x6d')]())[_0x55cd('0x3a')](_0x55cd('0x71'))[_0x55cd('0x3a')](_0x55cd('0x72'),squel[_0x55cd('0x69')]()[_0x55cd('0x6a')](_0x55cd('0x73'))[_0x55cd('0x6e')](_0x55cd('0x74'))[_0x55cd('0x3a')]('CampaignId\x20=\x20?',_0x3d937d[_0x55cd('0x43')]['id']['toString']()))[_0x55cd('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x55cd('0x6a')]('COALESCE(phone,\x27\x27)')[_0x55cd('0x6e')]('cm_hopper')[_0x55cd('0x3a')](_0x55cd('0x75'),_0x3d937d[_0x55cd('0x43')]['id'][_0x55cd('0x6d')]())))['toString']();break;case _0x55cd('0x76'):_0xa310ba=squel['insert']()[_0x55cd('0x64')](_0x55cd('0x65'))['fromQuery']([_0x55cd('0x66'),'scheduledAt',_0x55cd('0x67'),_0x55cd('0x68'),_0x55cd('0x56'),_0x55cd('0x50'),_0x55cd('0x51')],squel[_0x55cd('0x69')]()['field'](_0x55cd('0x66'),'phone')['field'](_0x55cd('0x6b'),'scheduledAt')[_0x55cd('0x6a')]('id','ContactId')[_0x55cd('0x6a')](_0x1fafba[_0x55cd('0x6c')][_0x55cd('0x6d')](),'ListId')[_0x55cd('0x6a')](_0x3d937d['params']['id'][_0x55cd('0x6d')](),_0x55cd('0x56'))[_0x55cd('0x6a')](_0x55cd('0x6b'),_0x55cd('0x50'))[_0x55cd('0x6a')](_0x55cd('0x6b'),'updatedAt')['from'](_0x55cd('0x6f'))[_0x55cd('0x3a')](_0x55cd('0x77'))[_0x55cd('0x3a')](_0x55cd('0x70'),_0x1fafba[_0x55cd('0x6c')][_0x55cd('0x6d')]())[_0x55cd('0x3a')](_0x55cd('0x71'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x55cd('0x69')]()[_0x55cd('0x6a')](_0x55cd('0x78'))[_0x55cd('0x6e')]('cm_hopper')[_0x55cd('0x3a')](_0x55cd('0x75'),_0x3d937d[_0x55cd('0x43')]['id']['toString']())))[_0x55cd('0x6d')]();break;default:_0xa310ba=squel[_0x55cd('0x63')]()['into'](_0x55cd('0x65'))['fromQuery'](['phone',_0x55cd('0x79'),_0x55cd('0x67'),_0x55cd('0x68'),_0x55cd('0x56'),_0x55cd('0x50'),_0x55cd('0x51')],squel[_0x55cd('0x69')]()['field']('phone',_0x55cd('0x66'))[_0x55cd('0x6a')](_0x55cd('0x6b'),_0x55cd('0x79'))[_0x55cd('0x6a')]('id',_0x55cd('0x67'))[_0x55cd('0x6a')](_0x1fafba['CmListId']['toString'](),_0x55cd('0x68'))[_0x55cd('0x6a')](_0x3d937d[_0x55cd('0x43')]['id']['toString'](),_0x55cd('0x56'))[_0x55cd('0x6a')]('NOW()',_0x55cd('0x50'))[_0x55cd('0x6a')](_0x55cd('0x6b'),'updatedAt')[_0x55cd('0x6e')](_0x55cd('0x6f'))['where'](_0x55cd('0x77'))[_0x55cd('0x3a')]('ListId\x20=\x20?',_0x1fafba['CmListId'][_0x55cd('0x6d')]())[_0x55cd('0x3a')](_0x55cd('0x71')))[_0x55cd('0x6d')]();}_0x17389e[_0x55cd('0x7a')](db['sequelize'][_0x55cd('0x2d')](_0xa310ba));}return BPromise[_0x55cd('0x7b')](_0x17389e);}})[_0x55cd('0x22')](function(){return _0x53afc8;})['then'](respondWithResult(_0x2d8fc1,null))[_0x55cd('0x41')](handleError(_0x2d8fc1,null));};exports['removeLists']=function(_0x2769a3,_0x5292f4,_0x445075){return db[_0x55cd('0x28')][_0x55cd('0x45')]({'where':{'id':_0x2769a3[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x5292f4,null))[_0x55cd('0x22')](function(_0x2758e6){if(_0x2758e6){return _0x2758e6[_0x55cd('0x7c')](_0x2769a3[_0x55cd('0x2d')][_0x55cd('0x7d')]);}})[_0x55cd('0x22')](function(_0x47831a){if(_0x47831a){return db[_0x55cd('0x55')][_0x55cd('0x23')]({'where':{'ListId':_0x2769a3['query'][_0x55cd('0x7d')],'CampaignId':_0x2769a3[_0x55cd('0x43')]['id']}})['then'](function(){return _0x47831a;});}})['then'](respondWithStatusCode(_0x5292f4,null))['catch'](handleError(_0x5292f4,null));};exports[_0x55cd('0x7e')]=function(_0x264335,_0x3ff7f9,_0x53ec73){var _0x5a3b21={};var _0x214ab0={};var _0x1481f2;var _0x11565a;return db[_0x55cd('0x28')]['findOne']({'where':{'id':_0x264335[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x3ff7f9,null))[_0x55cd('0x22')](function(_0x37d965){if(_0x37d965){_0x1481f2=_0x37d965;_0x214ab0[_0x55cd('0x2b')]=_['keys'](db[_0x55cd('0x5f')][_0x55cd('0x44')]);_0x214ab0[_0x55cd('0x2d')]=_[_0x55cd('0x2e')](_0x264335[_0x55cd('0x2d')]);_0x214ab0['filters']=_['intersection'](_0x214ab0[_0x55cd('0x2b')],_0x214ab0[_0x55cd('0x2d')]);_0x5a3b21[_0x55cd('0x32')]=_[_0x55cd('0x30')](_0x214ab0['model'],qs[_0x55cd('0x31')](_0x264335[_0x55cd('0x2d')][_0x55cd('0x31')]));_0x5a3b21[_0x55cd('0x32')]=_0x5a3b21[_0x55cd('0x32')][_0x55cd('0x33')]?_0x5a3b21[_0x55cd('0x32')]:_0x214ab0[_0x55cd('0x2b')];_0x5a3b21['order']=qs[_0x55cd('0x37')](_0x264335[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x5a3b21['where']=qs[_0x55cd('0x2f')](_['pick'](_0x264335[_0x55cd('0x2d')],_0x214ab0[_0x55cd('0x2f')]));if(_0x264335['query'][_0x55cd('0x39')]){_0x5a3b21['where']=_[_0x55cd('0x3b')](_0x5a3b21['where'],{'$or':_[_0x55cd('0x2c')](_0x5a3b21[_0x55cd('0x32')],function(_0x4861d4){var _0x306689={};_0x306689[_0x4861d4]={'$like':'%'+_0x264335[_0x55cd('0x2d')]['filter']+'%'};return _0x306689;})});}_0x5a3b21=_[_0x55cd('0x3b')]({},_0x5a3b21,_0x264335[_0x55cd('0x3d')]);return _0x1481f2[_0x55cd('0x7e')](_0x5a3b21);}})[_0x55cd('0x22')](function(_0x1f6acc){if(_0x1f6acc){_0x11565a=_0x1f6acc[_0x55cd('0x33')];if(!_0x264335[_0x55cd('0x2d')]['hasOwnProperty'](_0x55cd('0x35'))){_0x5a3b21[_0x55cd('0x1c')]=qs[_0x55cd('0x1c')](_0x264335['query'][_0x55cd('0x1c')]);_0x5a3b21[_0x55cd('0x1b')]=qs[_0x55cd('0x1b')](_0x264335[_0x55cd('0x2d')]['offset']);}return _0x1481f2['getBlackLists'](_0x5a3b21);}})[_0x55cd('0x22')](function(_0x212e21){if(_0x212e21){return _0x212e21?{'count':_0x11565a,'rows':_0x212e21}:null;}})[_0x55cd('0x22')](respondWithResult(_0x3ff7f9,null))[_0x55cd('0x41')](handleError(_0x3ff7f9,null));};exports[_0x55cd('0x7f')]=function(_0x20a72f,_0x169955,_0x3ac6f1){var _0x474a5c,_0x2ee94c;return db[_0x55cd('0x28')]['find']({'where':{'id':_0x20a72f[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x169955,null))['then'](function(_0x3b548a){if(_0x3b548a){_0x2ee94c=_0x3b548a;return _0x3b548a[_0x55cd('0x7f')](_0x20a72f['body'][_0x55cd('0x7d')],_['omit'](_0x20a72f[_0x55cd('0x47')],[_0x55cd('0x7d'),'id'])||{});}return null;})[_0x55cd('0x80')](function(_0x4e15da){var _0xf54691;_0x474a5c=_0x4e15da||[];var _0x24c45a=[];if(_0x4e15da){for(var _0x28b64d=0x0;_0x28b64d<_0x4e15da[_0x55cd('0x33')];_0x28b64d+=0x1){var _0x21e968=_0x4e15da[_0x28b64d][_0x55cd('0x49')]({'plain':!![]});_0xf54691=squel[_0x55cd('0x63')]()[_0x55cd('0x64')](_0x55cd('0x81'))[_0x55cd('0x82')](['phone','ContactId',_0x55cd('0x68'),'CampaignId',_0x55cd('0x50'),_0x55cd('0x51')],squel[_0x55cd('0x69')]()[_0x55cd('0x6a')](_0x55cd('0x66'),_0x55cd('0x66'))['field']('id','ContactId')['field'](_0x21e968['CmListId'][_0x55cd('0x6d')](),'ListId')[_0x55cd('0x6a')](_0x20a72f[_0x55cd('0x43')]['id'][_0x55cd('0x6d')](),_0x55cd('0x56'))[_0x55cd('0x6a')](_0x55cd('0x6b'),_0x55cd('0x50'))[_0x55cd('0x6a')](_0x55cd('0x6b'),_0x55cd('0x51'))['from'](_0x55cd('0x6f'))[_0x55cd('0x3a')]('deletedAt\x20IS\x20NULL')[_0x55cd('0x3a')]('ListId\x20=\x20?',_0x21e968[_0x55cd('0x6c')]['toString']())[_0x55cd('0x3a')](_0x55cd('0x71')))[_0x55cd('0x6d')]();_0x24c45a[_0x55cd('0x7a')](db[_0x55cd('0x83')][_0x55cd('0x2d')](_0xf54691));}return BPromise['all'](_0x24c45a);}})[_0x55cd('0x22')](function(){return _0x474a5c;})[_0x55cd('0x22')](respondWithResult(_0x169955,null))[_0x55cd('0x41')](handleError(_0x169955,null));};exports[_0x55cd('0x84')]=function(_0xab8418,_0x4bd3db,_0x585838){return db[_0x55cd('0x28')][_0x55cd('0x45')]({'where':{'id':_0xab8418[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x4bd3db,null))[_0x55cd('0x22')](function(_0x379522){if(_0x379522){return _0x379522[_0x55cd('0x84')](_0xab8418[_0x55cd('0x2d')][_0x55cd('0x7d')]);}})[_0x55cd('0x22')](function(_0x499ee5){if(_0x499ee5){return db[_0x55cd('0x5d')][_0x55cd('0x23')]({'where':{'ListId':_0xab8418['query']['ids'],'CampaignId':_0xab8418[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](function(){return _0x499ee5;});}})[_0x55cd('0x22')](respondWithStatusCode(_0x4bd3db,null))[_0x55cd('0x41')](handleError(_0x4bd3db,null));}; \ No newline at end of file +var _0x1979=['catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','get','omit','createdAt','updatedAt','role','error','findOne','CmHopper','getHopperHistories','CmHopperHistory','nolimit','getHopperFinals','CmHopperFinal','CmHopperBlack','CampaignId','getLists','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','field','phone','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','onlyIfOpen','select','COALESCE(phone,\x27\x27)','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','ListId\x20=\x20?','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','IvrCampaigns','UserProfileResource','stack','name','send','index','Campaign','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows'];(function(_0x232baa,_0x32545e){var _0x24d0b3=function(_0x5a8b9b){while(--_0x5a8b9b){_0x232baa['push'](_0x232baa['shift']());}};_0x24d0b3(++_0x32545e);}(_0x1979,0x156));var _0x9197=function(_0x593752,_0xfc3827){_0x593752=_0x593752-0x0;var _0x4612be=_0x1979[_0x593752];return _0x4612be;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9197('0x0'));var rimraf=require(_0x9197('0x1'));var zipdir=require(_0x9197('0x2'));var jsonpatch=require(_0x9197('0x3'));var rp=require(_0x9197('0x4'));var moment=require('moment');var BPromise=require(_0x9197('0x5'));var Mustache=require(_0x9197('0x6'));var util=require(_0x9197('0x7'));var path=require(_0x9197('0x8'));var sox=require(_0x9197('0x9'));var csv=require(_0x9197('0xa'));var ejs=require(_0x9197('0xb'));var fs=require('fs');var _=require(_0x9197('0xc'));var squel=require(_0x9197('0xd'));var crypto=require('crypto');var jsforce=require(_0x9197('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9197('0xf'));var Papa=require('papaparse');var Redis=require(_0x9197('0x10'));var authService=require(_0x9197('0x11'));var qs=require(_0x9197('0x12'));var as=require(_0x9197('0x13'));var hardwareService=require(_0x9197('0x14'));var logger=require(_0x9197('0x15'))(_0x9197('0x16'));var utils=require(_0x9197('0x17'));var config=require(_0x9197('0x18'));var licenseUtil=require(_0x9197('0x19'));var db=require(_0x9197('0x1a'))['db'];function respondWithStatusCode(_0x3cec2a,_0x11a52e){_0x11a52e=_0x11a52e||0xcc;return function(_0xdfae73){if(_0xdfae73){return _0x3cec2a[_0x9197('0x1b')](_0x11a52e);}return _0x3cec2a['status'](_0x11a52e)[_0x9197('0x1c')]();};}function respondWithResult(_0x2dd939,_0x5e9474){_0x5e9474=_0x5e9474||0xc8;return function(_0x53f393){if(_0x53f393){return _0x2dd939[_0x9197('0x1d')](_0x5e9474)[_0x9197('0x1e')](_0x53f393);}};}function respondWithFilteredResult(_0x303768,_0x3cf46f){return function(_0x19e78e){if(_0x19e78e){var _0x590067=_0x19e78e['count'],_0x3e8b9=_0x3cf46f[_0x9197('0x1f')],_0x405b65=_0x3cf46f['offset']+_0x3cf46f[_0x9197('0x20')],_0x5b5700;if(_0x405b65>=_0x590067){_0x405b65=_0x590067;_0x5b5700=0xc8;}else{_0x5b5700=0xce;}_0x303768['status'](_0x5b5700);return _0x303768[_0x9197('0x21')](_0x9197('0x22'),_0x3e8b9+'-'+_0x405b65+'/'+_0x590067)[_0x9197('0x1e')](_0x19e78e);}return null;};}function patchUpdates(_0xd91968){return function(_0x46fb59){try{jsonpatch[_0x9197('0x23')](_0x46fb59,_0xd91968,!![]);}catch(_0x2da22b){return BPromise['reject'](_0x2da22b);}return _0x46fb59[_0x9197('0x24')]();};}function saveUpdates(_0x5d279d,_0x5f4bd7){return function(_0x13d05f){if(_0x13d05f){return _0x13d05f[_0x9197('0x25')](_0x5d279d)[_0x9197('0x26')](function(_0x536fd0){return _0x536fd0;});}return null;};}function removeEntity(_0x1134b8,_0x184bcf){return function(_0x3fe776){if(_0x3fe776){return _0x3fe776[_0x9197('0x27')]()['then'](function(){var _0x5919cf=_0x3fe776['get']({'plain':!![]});var _0x548f94=_0x9197('0x28');return db[_0x9197('0x29')][_0x9197('0x27')]({'where':{'type':_0x548f94,'resourceId':_0x5919cf['id']}})['then'](function(){return _0x3fe776;});})[_0x9197('0x26')](function(){_0x1134b8[_0x9197('0x1d')](0xcc)[_0x9197('0x1c')]();});}};}function handleEntityNotFound(_0x4ddc96,_0x3bf8bd){return function(_0x432598){if(!_0x432598){_0x4ddc96[_0x9197('0x1b')](0x194);}return _0x432598;};}function handleError(_0xd0f4cf,_0x2e2900){_0x2e2900=_0x2e2900||0x1f4;return function(_0x197690){logger['error'](_0x197690[_0x9197('0x2a')]);if(_0x197690[_0x9197('0x2b')]){delete _0x197690[_0x9197('0x2b')];}_0xd0f4cf['status'](_0x2e2900)[_0x9197('0x2c')](_0x197690);};}exports[_0x9197('0x2d')]=function(_0x3fe5e5,_0x131ca7){var _0x54801f={},_0x2c144b={},_0x5f140e={'count':0x0,'rows':[]};var _0x5e9051=_['map'](db[_0x9197('0x2e')][_0x9197('0x2f')],function(_0x363886){return{'name':_0x363886[_0x9197('0x30')],'type':_0x363886[_0x9197('0x31')][_0x9197('0x32')]};});_0x2c144b[_0x9197('0x33')]=_[_0x9197('0x34')](_0x5e9051,_0x9197('0x2b'));_0x2c144b[_0x9197('0x35')]=_[_0x9197('0x36')](_0x3fe5e5[_0x9197('0x35')]);_0x2c144b[_0x9197('0x37')]=_['intersection'](_0x2c144b[_0x9197('0x33')],_0x2c144b[_0x9197('0x35')]);_0x54801f['attributes']=_[_0x9197('0x38')](_0x2c144b[_0x9197('0x33')],qs[_0x9197('0x39')](_0x3fe5e5['query'][_0x9197('0x39')]));_0x54801f['attributes']=_0x54801f[_0x9197('0x3a')][_0x9197('0x3b')]?_0x54801f[_0x9197('0x3a')]:_0x2c144b[_0x9197('0x33')];if(!_0x3fe5e5[_0x9197('0x35')][_0x9197('0x3c')]('nolimit')){_0x54801f[_0x9197('0x20')]=qs['limit'](_0x3fe5e5[_0x9197('0x35')]['limit']);_0x54801f[_0x9197('0x1f')]=qs[_0x9197('0x1f')](_0x3fe5e5['query'][_0x9197('0x1f')]);}_0x54801f[_0x9197('0x3d')]=qs[_0x9197('0x3e')](_0x3fe5e5[_0x9197('0x35')]['sort']);_0x54801f[_0x9197('0x3f')]=qs['filters'](_[_0x9197('0x40')](_0x3fe5e5[_0x9197('0x35')],_0x2c144b['filters']),_0x5e9051);if(_0x3fe5e5[_0x9197('0x35')][_0x9197('0x41')]){_0x54801f['where']=_[_0x9197('0x42')](_0x54801f[_0x9197('0x3f')],{'$or':_[_0x9197('0x34')](_0x5e9051,function(_0x4d2a9c){if(_0x4d2a9c['type']!=='VIRTUAL'){var _0x33175d={};_0x33175d[_0x4d2a9c[_0x9197('0x2b')]]={'$like':'%'+_0x3fe5e5['query'][_0x9197('0x41')]+'%'};return _0x33175d;}})});}_0x54801f=_[_0x9197('0x42')]({},_0x54801f,_0x3fe5e5[_0x9197('0x43')]);var _0x4a2ca7={'where':_0x54801f[_0x9197('0x3f')]};return db[_0x9197('0x2e')][_0x9197('0x44')](_0x4a2ca7)['then'](function(_0x2fce14){_0x5f140e[_0x9197('0x44')]=_0x2fce14;if(_0x3fe5e5[_0x9197('0x35')][_0x9197('0x45')]){_0x54801f['include']=[{'all':!![]}];}return db[_0x9197('0x2e')][_0x9197('0x46')](_0x54801f);})['then'](function(_0x1ef3df){_0x5f140e[_0x9197('0x47')]=_0x1ef3df;return _0x5f140e;})[_0x9197('0x26')](respondWithFilteredResult(_0x131ca7,_0x54801f))[_0x9197('0x48')](handleError(_0x131ca7,null));};exports[_0x9197('0x49')]=function(_0x4a3bf4,_0x1c1670){var _0x554284={'raw':![],'where':{'id':_0x4a3bf4[_0x9197('0x4a')]['id']}},_0x401b57={};_0x401b57[_0x9197('0x33')]=_[_0x9197('0x36')](db[_0x9197('0x2e')][_0x9197('0x2f')]);_0x401b57[_0x9197('0x35')]=_['keys'](_0x4a3bf4[_0x9197('0x35')]);_0x401b57[_0x9197('0x37')]=_[_0x9197('0x38')](_0x401b57[_0x9197('0x33')],_0x401b57['query']);_0x554284[_0x9197('0x3a')]=_[_0x9197('0x38')](_0x401b57[_0x9197('0x33')],qs[_0x9197('0x39')](_0x4a3bf4[_0x9197('0x35')]['fields']));_0x554284[_0x9197('0x3a')]=_0x554284['attributes'][_0x9197('0x3b')]?_0x554284[_0x9197('0x3a')]:_0x401b57[_0x9197('0x33')];if(_0x4a3bf4[_0x9197('0x35')]['includeAll']){_0x554284['include']=[{'all':!![]}];}_0x554284=_[_0x9197('0x42')]({},_0x554284,_0x4a3bf4['options']);return db['Campaign'][_0x9197('0x4b')](_0x554284)[_0x9197('0x26')](handleEntityNotFound(_0x1c1670,null))[_0x9197('0x26')](respondWithResult(_0x1c1670,null))[_0x9197('0x48')](handleError(_0x1c1670,null));};exports[_0x9197('0x4c')]=function(_0xfd9fd1,_0x5629ce){return db['Campaign'][_0x9197('0x4c')](_0xfd9fd1[_0x9197('0x4d')],{})[_0x9197('0x26')](function(_0x4023f8){var _0x2c2700=_0xfd9fd1[_0x9197('0x4e')]['get']({'plain':!![]});if(!_0x2c2700)throw new Error(_0x9197('0x4f'));if(_0x2c2700['role']===_0x9197('0x4e')){var _0x5e0334=_0x4023f8['get']({'plain':!![]});var _0x2c9759=_0x9197('0x28');return db[_0x9197('0x50')][_0x9197('0x4b')]({'where':{'name':_0x2c9759,'userProfileId':_0x2c2700[_0x9197('0x51')]},'raw':!![]})[_0x9197('0x26')](function(_0x3d1817){if(_0x3d1817&&_0x3d1817[_0x9197('0x52')]===0x0){return db[_0x9197('0x29')][_0x9197('0x4c')]({'name':_0x5e0334[_0x9197('0x2b')],'resourceId':_0x5e0334['id'],'type':_0x3d1817[_0x9197('0x2b')],'sectionId':_0x3d1817['id']},{})[_0x9197('0x26')](function(){return _0x4023f8;});}else{return _0x4023f8;}})[_0x9197('0x48')](function(_0x6da5c7){logger['error'](_0x9197('0x53'),_0x6da5c7);throw _0x6da5c7;});}return _0x4023f8;})[_0x9197('0x26')](respondWithResult(_0x5629ce,0xc9))['catch'](handleError(_0x5629ce,null));};exports[_0x9197('0x54')]=function(_0x1521b8,_0x4bcf36){var _0x17b340={'where':{'id':_0x1521b8['params']['id']}},_0x5b9af8={};_0x5b9af8[_0x9197('0x33')]=_['keys'](db[_0x9197('0x2e')]['rawAttributes']);_0x17b340[_0x9197('0x3a')]=_[_0x9197('0x38')](_0x5b9af8['model'],qs[_0x9197('0x39')](_0x1521b8[_0x9197('0x35')][_0x9197('0x39')]));_0x17b340[_0x9197('0x3a')]=_0x17b340[_0x9197('0x3a')][_0x9197('0x3b')]?_0x17b340[_0x9197('0x3a')]:_0x5b9af8[_0x9197('0x33')];if(_0x1521b8[_0x9197('0x35')][_0x9197('0x45')]){_0x17b340[_0x9197('0x55')]=[{'all':!![]}];}_0x17b340=_['merge']({},_0x17b340,_0x1521b8[_0x9197('0x43')]);return db[_0x9197('0x2e')][_0x9197('0x4b')](_0x17b340)[_0x9197('0x26')](handleEntityNotFound(_0x4bcf36,null))[_0x9197('0x26')](function(_0x219ce5){if(_0x219ce5){var _0x330186=_0x219ce5[_0x9197('0x56')]({'plain':!![]});_0x330186=qs[_0x9197('0x57')](_0x330186,['id',_0x9197('0x58'),_0x9197('0x59')]);_0x1521b8['body']=_[_0x9197('0x57')](_0x1521b8[_0x9197('0x4d')],['id',_0x9197('0x58'),'updatedAt']);return db[_0x9197('0x2e')]['create'](_['merge'](_0x330186,_0x1521b8['body']),{'include':_0x1521b8[_0x9197('0x35')][_0x9197('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x2e620c){var _0x16ba71=_0x1521b8[_0x9197('0x4e')][_0x9197('0x56')]({'plain':!![]});if(!_0x16ba71)throw new Error(_0x9197('0x4f'));if(_0x16ba71[_0x9197('0x5a')]===_0x9197('0x4e')){var _0x268651=_0x2e620c[_0x9197('0x56')]({'plain':!![]});var _0x4cfd2f=_0x9197('0x28');return db[_0x9197('0x50')][_0x9197('0x4b')]({'where':{'name':_0x4cfd2f,'userProfileId':_0x16ba71[_0x9197('0x51')]},'raw':!![]})[_0x9197('0x26')](function(_0x58d507){if(_0x58d507&&_0x58d507['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x268651['name'],'resourceId':_0x268651['id'],'type':_0x58d507[_0x9197('0x2b')],'sectionId':_0x58d507['id']},{})['then'](function(){return _0x2e620c;});}else{return _0x2e620c;}})[_0x9197('0x48')](function(_0x39985f){logger[_0x9197('0x5b')](_0x9197('0x53'),_0x39985f);throw _0x39985f;});}return _0x2e620c;});}})[_0x9197('0x26')](respondWithResult(_0x4bcf36,0xc9))[_0x9197('0x48')](handleError(_0x4bcf36,null));};exports[_0x9197('0x25')]=function(_0x2525da,_0x49c83b){if(_0x2525da[_0x9197('0x4d')]['id']){delete _0x2525da['body']['id'];}return db[_0x9197('0x2e')]['find']({'where':{'id':_0x2525da[_0x9197('0x4a')]['id']}})[_0x9197('0x26')](handleEntityNotFound(_0x49c83b,null))[_0x9197('0x26')](saveUpdates(_0x2525da[_0x9197('0x4d')],null))['then'](respondWithResult(_0x49c83b,null))[_0x9197('0x48')](handleError(_0x49c83b,null));};exports['destroy']=function(_0x195851,_0x2d0095){return db[_0x9197('0x2e')][_0x9197('0x4b')]({'where':{'id':_0x195851[_0x9197('0x4a')]['id']}})[_0x9197('0x26')](handleEntityNotFound(_0x2d0095,null))['then'](removeEntity(_0x2d0095,null))[_0x9197('0x48')](handleError(_0x2d0095,null));};exports['getHoppers']=function(_0x1f5165,_0xdc218a,_0x69459c){var _0x24fcb3={'raw':!![],'where':{}};var _0x5f56bb={};var _0x63465d={'count':0x0,'rows':[]};return db[_0x9197('0x2e')][_0x9197('0x5c')]({'where':{'id':_0x1f5165[_0x9197('0x4a')]['id']}})[_0x9197('0x26')](handleEntityNotFound(_0xdc218a,null))[_0x9197('0x26')](function(_0x5e0863){if(_0x5e0863){_0x5f56bb[_0x9197('0x33')]=_[_0x9197('0x36')](db[_0x9197('0x5d')][_0x9197('0x2f')]);_0x5f56bb[_0x9197('0x35')]=_[_0x9197('0x36')](_0x1f5165[_0x9197('0x35')]);_0x5f56bb[_0x9197('0x37')]=_[_0x9197('0x38')](_0x5f56bb[_0x9197('0x33')],_0x5f56bb[_0x9197('0x35')]);_0x24fcb3[_0x9197('0x3a')]=_[_0x9197('0x38')](_0x5f56bb[_0x9197('0x33')],qs['fields'](_0x1f5165['query']['fields']));_0x24fcb3[_0x9197('0x3a')]=_0x24fcb3[_0x9197('0x3a')]['length']?_0x24fcb3['attributes']:_0x5f56bb['model'];if(!_0x1f5165[_0x9197('0x35')][_0x9197('0x3c')]('nolimit')){_0x24fcb3[_0x9197('0x20')]=qs[_0x9197('0x20')](_0x1f5165[_0x9197('0x35')][_0x9197('0x20')]);_0x24fcb3['offset']=qs[_0x9197('0x1f')](_0x1f5165['query'][_0x9197('0x1f')]);}_0x24fcb3[_0x9197('0x3d')]=qs[_0x9197('0x3e')](_0x1f5165['query'][_0x9197('0x3e')]);_0x24fcb3[_0x9197('0x3f')]=qs[_0x9197('0x37')](_[_0x9197('0x40')](_0x1f5165[_0x9197('0x35')],_0x5f56bb[_0x9197('0x37')]));_0x24fcb3[_0x9197('0x3f')]['CampaignId']=_0x5e0863['id'];if(_0x1f5165[_0x9197('0x35')][_0x9197('0x41')]){_0x24fcb3[_0x9197('0x3f')]=_[_0x9197('0x42')](_0x24fcb3['where'],{'$or':_[_0x9197('0x34')](_0x24fcb3[_0x9197('0x3a')],function(_0x31a691){var _0x87ac={};_0x87ac[_0x31a691]={'$like':'%'+_0x1f5165[_0x9197('0x35')][_0x9197('0x41')]+'%'};return _0x87ac;})});}_0x24fcb3=_[_0x9197('0x42')]({},_0x24fcb3,_0x1f5165[_0x9197('0x43')]);return db[_0x9197('0x5d')][_0x9197('0x44')]({'where':_0x24fcb3[_0x9197('0x3f')]})[_0x9197('0x26')](function(_0x520b02){_0x63465d['count']=_0x520b02;if(_0x1f5165[_0x9197('0x35')][_0x9197('0x45')]){_0x24fcb3[_0x9197('0x55')]=[{'all':!![]}];}return db[_0x9197('0x5d')][_0x9197('0x46')](_0x24fcb3);})[_0x9197('0x26')](function(_0x482690){_0x63465d['rows']=_0x482690;return _0x63465d;});}})[_0x9197('0x26')](respondWithFilteredResult(_0xdc218a,_0x24fcb3))['catch'](handleError(_0xdc218a,null));};exports[_0x9197('0x5e')]=function(_0x20ee75,_0x1323c7,_0x552939){var _0x164ae0={'raw':!![],'where':{}};var _0x1c8f5c={};var _0x21b804={'count':0x0,'rows':[]};return db[_0x9197('0x2e')]['findOne']({'where':{'id':_0x20ee75[_0x9197('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1323c7,null))['then'](function(_0x37ac19){if(_0x37ac19){_0x1c8f5c[_0x9197('0x33')]=_['keys'](db[_0x9197('0x5f')][_0x9197('0x2f')]);_0x1c8f5c['query']=_[_0x9197('0x36')](_0x20ee75['query']);_0x1c8f5c[_0x9197('0x37')]=_[_0x9197('0x38')](_0x1c8f5c[_0x9197('0x33')],_0x1c8f5c['query']);_0x164ae0['attributes']=_[_0x9197('0x38')](_0x1c8f5c[_0x9197('0x33')],qs[_0x9197('0x39')](_0x20ee75['query']['fields']));_0x164ae0['attributes']=_0x164ae0[_0x9197('0x3a')][_0x9197('0x3b')]?_0x164ae0[_0x9197('0x3a')]:_0x1c8f5c[_0x9197('0x33')];if(!_0x20ee75[_0x9197('0x35')][_0x9197('0x3c')](_0x9197('0x60'))){_0x164ae0['limit']=qs[_0x9197('0x20')](_0x20ee75[_0x9197('0x35')][_0x9197('0x20')]);_0x164ae0[_0x9197('0x1f')]=qs[_0x9197('0x1f')](_0x20ee75[_0x9197('0x35')][_0x9197('0x1f')]);}_0x164ae0['order']=qs[_0x9197('0x3e')](_0x20ee75[_0x9197('0x35')]['sort']);_0x164ae0['where']=qs[_0x9197('0x37')](_[_0x9197('0x40')](_0x20ee75[_0x9197('0x35')],_0x1c8f5c[_0x9197('0x37')]));_0x164ae0[_0x9197('0x3f')]['CampaignId']=_0x37ac19['id'];if(_0x20ee75[_0x9197('0x35')][_0x9197('0x41')]){_0x164ae0[_0x9197('0x3f')]=_[_0x9197('0x42')](_0x164ae0[_0x9197('0x3f')],{'$or':_[_0x9197('0x34')](_0x164ae0[_0x9197('0x3a')],function(_0x1a7bfc){var _0x3b5b56={};_0x3b5b56[_0x1a7bfc]={'$like':'%'+_0x20ee75[_0x9197('0x35')]['filter']+'%'};return _0x3b5b56;})});}_0x164ae0=_['merge']({},_0x164ae0,_0x20ee75[_0x9197('0x43')]);return db['CmHopperHistory'][_0x9197('0x44')]({'where':_0x164ae0[_0x9197('0x3f')]})[_0x9197('0x26')](function(_0x328ed6){_0x21b804[_0x9197('0x44')]=_0x328ed6;if(_0x20ee75['query']['includeAll']){_0x164ae0[_0x9197('0x55')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x164ae0);})[_0x9197('0x26')](function(_0x2920f5){_0x21b804[_0x9197('0x47')]=_0x2920f5;return _0x21b804;});}})['then'](respondWithFilteredResult(_0x1323c7,_0x164ae0))[_0x9197('0x48')](handleError(_0x1323c7,null));};exports[_0x9197('0x61')]=function(_0x36633f,_0x2e89c8,_0x4bf50f){var _0x1f0e7c={'raw':!![],'where':{}};var _0x22c0d3={};var _0x3ba55b={'count':0x0,'rows':[]};return db[_0x9197('0x2e')][_0x9197('0x5c')]({'where':{'id':_0x36633f[_0x9197('0x4a')]['id']}})[_0x9197('0x26')](handleEntityNotFound(_0x2e89c8,null))[_0x9197('0x26')](function(_0x3127e6){if(_0x3127e6){_0x22c0d3[_0x9197('0x33')]=_[_0x9197('0x36')](db[_0x9197('0x62')][_0x9197('0x2f')]);_0x22c0d3[_0x9197('0x35')]=_[_0x9197('0x36')](_0x36633f[_0x9197('0x35')]);_0x22c0d3['filters']=_['intersection'](_0x22c0d3[_0x9197('0x33')],_0x22c0d3[_0x9197('0x35')]);_0x1f0e7c['attributes']=_[_0x9197('0x38')](_0x22c0d3[_0x9197('0x33')],qs[_0x9197('0x39')](_0x36633f[_0x9197('0x35')][_0x9197('0x39')]));_0x1f0e7c[_0x9197('0x3a')]=_0x1f0e7c[_0x9197('0x3a')][_0x9197('0x3b')]?_0x1f0e7c[_0x9197('0x3a')]:_0x22c0d3[_0x9197('0x33')];if(!_0x36633f[_0x9197('0x35')][_0x9197('0x3c')](_0x9197('0x60'))){_0x1f0e7c[_0x9197('0x20')]=qs[_0x9197('0x20')](_0x36633f[_0x9197('0x35')][_0x9197('0x20')]);_0x1f0e7c[_0x9197('0x1f')]=qs[_0x9197('0x1f')](_0x36633f[_0x9197('0x35')]['offset']);}_0x1f0e7c[_0x9197('0x3d')]=qs['sort'](_0x36633f[_0x9197('0x35')][_0x9197('0x3e')]);_0x1f0e7c[_0x9197('0x3f')]=qs[_0x9197('0x37')](_['pick'](_0x36633f[_0x9197('0x35')],_0x22c0d3[_0x9197('0x37')]));_0x1f0e7c[_0x9197('0x3f')]['CampaignId']=_0x3127e6['id'];if(_0x36633f['query'][_0x9197('0x41')]){_0x1f0e7c[_0x9197('0x3f')]=_['merge'](_0x1f0e7c['where'],{'$or':_[_0x9197('0x34')](_0x1f0e7c[_0x9197('0x3a')],function(_0x4db457){var _0x39ed7a={};_0x39ed7a[_0x4db457]={'$like':'%'+_0x36633f['query'][_0x9197('0x41')]+'%'};return _0x39ed7a;})});}_0x1f0e7c=_[_0x9197('0x42')]({},_0x1f0e7c,_0x36633f['options']);return db[_0x9197('0x62')]['count']({'where':_0x1f0e7c[_0x9197('0x3f')]})[_0x9197('0x26')](function(_0x4dc63f){_0x3ba55b[_0x9197('0x44')]=_0x4dc63f;if(_0x36633f[_0x9197('0x35')][_0x9197('0x45')]){_0x1f0e7c['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x9197('0x46')](_0x1f0e7c);})[_0x9197('0x26')](function(_0x572c26){_0x3ba55b[_0x9197('0x47')]=_0x572c26;return _0x3ba55b;});}})['then'](respondWithFilteredResult(_0x2e89c8,_0x1f0e7c))[_0x9197('0x48')](handleError(_0x2e89c8,null));};exports['getHopperBlacks']=function(_0x2bc721,_0x5c59bc,_0x47dc01){var _0x52caee={'raw':!![],'where':{}};var _0x17ba61={};var _0x4ec813={'count':0x0,'rows':[]};return db[_0x9197('0x2e')][_0x9197('0x5c')]({'where':{'id':_0x2bc721[_0x9197('0x4a')]['id']}})[_0x9197('0x26')](handleEntityNotFound(_0x5c59bc,null))[_0x9197('0x26')](function(_0x1112f0){if(_0x1112f0){_0x17ba61[_0x9197('0x33')]=_[_0x9197('0x36')](db[_0x9197('0x63')][_0x9197('0x2f')]);_0x17ba61[_0x9197('0x35')]=_[_0x9197('0x36')](_0x2bc721[_0x9197('0x35')]);_0x17ba61['filters']=_[_0x9197('0x38')](_0x17ba61[_0x9197('0x33')],_0x17ba61[_0x9197('0x35')]);_0x52caee[_0x9197('0x3a')]=_[_0x9197('0x38')](_0x17ba61[_0x9197('0x33')],qs[_0x9197('0x39')](_0x2bc721[_0x9197('0x35')]['fields']));_0x52caee[_0x9197('0x3a')]=_0x52caee[_0x9197('0x3a')][_0x9197('0x3b')]?_0x52caee[_0x9197('0x3a')]:_0x17ba61[_0x9197('0x33')];if(!_0x2bc721[_0x9197('0x35')]['hasOwnProperty'](_0x9197('0x60'))){_0x52caee['limit']=qs[_0x9197('0x20')](_0x2bc721[_0x9197('0x35')][_0x9197('0x20')]);_0x52caee['offset']=qs[_0x9197('0x1f')](_0x2bc721['query'][_0x9197('0x1f')]);}_0x52caee[_0x9197('0x3d')]=qs[_0x9197('0x3e')](_0x2bc721['query'][_0x9197('0x3e')]);_0x52caee[_0x9197('0x3f')]=qs[_0x9197('0x37')](_['pick'](_0x2bc721[_0x9197('0x35')],_0x17ba61['filters']));_0x52caee['where'][_0x9197('0x64')]=_0x1112f0['id'];if(_0x2bc721[_0x9197('0x35')][_0x9197('0x41')]){_0x52caee['where']=_[_0x9197('0x42')](_0x52caee[_0x9197('0x3f')],{'$or':_[_0x9197('0x34')](_0x52caee[_0x9197('0x3a')],function(_0x369538){var _0x546946={};_0x546946[_0x369538]={'$like':'%'+_0x2bc721['query'][_0x9197('0x41')]+'%'};return _0x546946;})});}_0x52caee=_[_0x9197('0x42')]({},_0x52caee,_0x2bc721['options']);return db['CmHopperBlack'][_0x9197('0x44')]({'where':_0x52caee[_0x9197('0x3f')]})[_0x9197('0x26')](function(_0x475e8c){_0x4ec813['count']=_0x475e8c;if(_0x2bc721['query']['includeAll']){_0x52caee[_0x9197('0x55')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x9197('0x46')](_0x52caee);})['then'](function(_0x1caaab){_0x4ec813[_0x9197('0x47')]=_0x1caaab;return _0x4ec813;});}})[_0x9197('0x26')](respondWithFilteredResult(_0x5c59bc,_0x52caee))['catch'](handleError(_0x5c59bc,null));};exports[_0x9197('0x65')]=function(_0x28df10,_0x249a34,_0x3ba678){var _0x38bf43={};var _0x2dfa1b={};var _0x53b755;var _0x45dd8c;return db[_0x9197('0x2e')][_0x9197('0x5c')]({'where':{'id':_0x28df10[_0x9197('0x4a')]['id']}})[_0x9197('0x26')](handleEntityNotFound(_0x249a34,null))[_0x9197('0x26')](function(_0x50df1e){if(_0x50df1e){_0x53b755=_0x50df1e;_0x2dfa1b[_0x9197('0x33')]=_['keys'](db['CmList']['rawAttributes']);_0x2dfa1b[_0x9197('0x35')]=_[_0x9197('0x36')](_0x28df10['query']);_0x2dfa1b[_0x9197('0x37')]=_[_0x9197('0x38')](_0x2dfa1b[_0x9197('0x33')],_0x2dfa1b['query']);_0x38bf43['attributes']=_['intersection'](_0x2dfa1b[_0x9197('0x33')],qs[_0x9197('0x39')](_0x28df10[_0x9197('0x35')][_0x9197('0x39')]));_0x38bf43['attributes']=_0x38bf43[_0x9197('0x3a')][_0x9197('0x3b')]?_0x38bf43[_0x9197('0x3a')]:_0x2dfa1b[_0x9197('0x33')];_0x38bf43[_0x9197('0x3d')]=qs['sort'](_0x28df10[_0x9197('0x35')][_0x9197('0x3e')]);_0x38bf43[_0x9197('0x3f')]=qs[_0x9197('0x37')](_[_0x9197('0x40')](_0x28df10[_0x9197('0x35')],_0x2dfa1b['filters']));if(_0x28df10[_0x9197('0x35')][_0x9197('0x41')]){_0x38bf43['where']=_[_0x9197('0x42')](_0x38bf43[_0x9197('0x3f')],{'$or':_[_0x9197('0x34')](_0x38bf43[_0x9197('0x3a')],function(_0x5269cb){var _0x52a825={};_0x52a825[_0x5269cb]={'$like':'%'+_0x28df10['query'][_0x9197('0x41')]+'%'};return _0x52a825;})});}_0x38bf43=_[_0x9197('0x42')]({},_0x38bf43,_0x28df10[_0x9197('0x43')]);return _0x53b755[_0x9197('0x65')](_0x38bf43);}})[_0x9197('0x26')](function(_0x4ddb9e){if(_0x4ddb9e){_0x45dd8c=_0x4ddb9e['length'];if(!_0x28df10[_0x9197('0x35')][_0x9197('0x3c')](_0x9197('0x60'))){_0x38bf43[_0x9197('0x20')]=qs[_0x9197('0x20')](_0x28df10[_0x9197('0x35')][_0x9197('0x20')]);_0x38bf43[_0x9197('0x1f')]=qs['offset'](_0x28df10[_0x9197('0x35')]['offset']);}return _0x53b755[_0x9197('0x65')](_0x38bf43);}})['then'](function(_0x3d4bf7){if(_0x3d4bf7){return _0x3d4bf7?{'count':_0x45dd8c,'rows':_0x3d4bf7}:null;}})['then'](respondWithResult(_0x249a34,null))[_0x9197('0x48')](handleError(_0x249a34,null));};exports[_0x9197('0x66')]=function(_0xf70ea4,_0x126ba1,_0x5c7538){var _0x43774f,_0xac1ee0;return db[_0x9197('0x2e')]['find']({'where':{'id':_0xf70ea4[_0x9197('0x4a')]['id']}})[_0x9197('0x26')](handleEntityNotFound(_0x126ba1,null))[_0x9197('0x26')](function(_0x3206ad){if(_0x3206ad){_0xac1ee0=_0x3206ad;return _0x3206ad['addLists'](_0xf70ea4[_0x9197('0x4d')][_0x9197('0x67')],_[_0x9197('0x57')](_0xf70ea4[_0x9197('0x4d')],[_0x9197('0x67'),'id'])||{});}return null;})['spread'](function(_0x1ce922){var _0x21c1a5;_0x43774f=_0x1ce922||[];var _0x5d2869=[];if(_0x1ce922){for(var _0x40b5a8=0x0;_0x40b5a8<_0x1ce922[_0x9197('0x3b')];_0x40b5a8+=0x1){var _0x507393=_0x1ce922[_0x40b5a8][_0x9197('0x56')]({'plain':!![]});_0xac1ee0[_0x9197('0x68')]=_0xf70ea4[_0x9197('0x4d')]['dialCheckDuplicateType']?_0xf70ea4[_0x9197('0x4d')][_0x9197('0x68')]:_0xac1ee0[_0x9197('0x68')];switch(_0xac1ee0[_0x9197('0x68')]){case _0x9197('0x69'):_0x21c1a5=squel[_0x9197('0x6a')]()[_0x9197('0x6b')](_0x9197('0x6c'))[_0x9197('0x6d')](['phone',_0x9197('0x6e'),_0x9197('0x6f'),_0x9197('0x70'),_0x9197('0x64'),_0x9197('0x58'),_0x9197('0x59')],squel['select']()[_0x9197('0x71')](_0x9197('0x72'),_0x9197('0x72'))[_0x9197('0x71')](_0x9197('0x73'),_0x9197('0x6e'))[_0x9197('0x71')]('id',_0x9197('0x6f'))[_0x9197('0x71')](_0x507393[_0x9197('0x74')]['toString'](),_0x9197('0x70'))[_0x9197('0x71')](_0xf70ea4['params']['id'][_0x9197('0x75')](),_0x9197('0x64'))[_0x9197('0x71')](_0x9197('0x73'),_0x9197('0x58'))[_0x9197('0x71')](_0x9197('0x73'),_0x9197('0x59'))['from'](_0x9197('0x76'))[_0x9197('0x3f')](_0x9197('0x77'))[_0x9197('0x3f')]('ListId\x20=\x20?',_0x507393[_0x9197('0x74')][_0x9197('0x75')]())['where'](_0x9197('0x78'))['where'](_0x9197('0x79'),squel['select']()['field'](_0x9197('0x7a'))[_0x9197('0x7b')]('cm_hopper_final')[_0x9197('0x3f')](_0x9197('0x7c'),_0xf70ea4[_0x9197('0x4a')]['id'][_0x9197('0x75')]()))['where'](_0x9197('0x79'),squel['select']()[_0x9197('0x71')]('COALESCE(phone,\x27\x27)')[_0x9197('0x7b')]('cm_hopper')[_0x9197('0x3f')]('CampaignId\x20=\x20?',_0xf70ea4[_0x9197('0x4a')]['id']['toString']())))[_0x9197('0x75')]();break;case _0x9197('0x7d'):_0x21c1a5=squel[_0x9197('0x6a')]()['into'](_0x9197('0x6c'))['fromQuery'](['phone',_0x9197('0x6e'),_0x9197('0x6f'),_0x9197('0x70'),_0x9197('0x64'),'createdAt','updatedAt'],squel[_0x9197('0x7e')]()[_0x9197('0x71')](_0x9197('0x72'),_0x9197('0x72'))[_0x9197('0x71')]('NOW()',_0x9197('0x6e'))[_0x9197('0x71')]('id',_0x9197('0x6f'))[_0x9197('0x71')](_0x507393['CmListId'][_0x9197('0x75')](),_0x9197('0x70'))[_0x9197('0x71')](_0xf70ea4['params']['id'][_0x9197('0x75')](),_0x9197('0x64'))[_0x9197('0x71')](_0x9197('0x73'),_0x9197('0x58'))[_0x9197('0x71')]('NOW()',_0x9197('0x59'))[_0x9197('0x7b')]('cm_contacts')['where'](_0x9197('0x77'))[_0x9197('0x3f')]('ListId\x20=\x20?',_0x507393[_0x9197('0x74')]['toString']())['where'](_0x9197('0x78'))[_0x9197('0x3f')](_0x9197('0x79'),squel[_0x9197('0x7e')]()[_0x9197('0x71')](_0x9197('0x7f'))[_0x9197('0x7b')](_0x9197('0x6c'))['where'](_0x9197('0x7c'),_0xf70ea4['params']['id'][_0x9197('0x75')]())))[_0x9197('0x75')]();break;default:_0x21c1a5=squel[_0x9197('0x6a')]()['into'](_0x9197('0x6c'))[_0x9197('0x6d')]([_0x9197('0x72'),_0x9197('0x6e'),_0x9197('0x6f'),'ListId','CampaignId','createdAt',_0x9197('0x59')],squel[_0x9197('0x7e')]()[_0x9197('0x71')](_0x9197('0x72'),_0x9197('0x72'))[_0x9197('0x71')](_0x9197('0x73'),_0x9197('0x6e'))[_0x9197('0x71')]('id','ContactId')[_0x9197('0x71')](_0x507393[_0x9197('0x74')][_0x9197('0x75')](),_0x9197('0x70'))['field'](_0xf70ea4[_0x9197('0x4a')]['id'][_0x9197('0x75')](),'CampaignId')[_0x9197('0x71')](_0x9197('0x73'),'createdAt')['field']('NOW()',_0x9197('0x59'))[_0x9197('0x7b')]('cm_contacts')[_0x9197('0x3f')](_0x9197('0x77'))[_0x9197('0x3f')]('ListId\x20=\x20?',_0x507393[_0x9197('0x74')]['toString']())[_0x9197('0x3f')](_0x9197('0x78')))['toString']();}_0x5d2869[_0x9197('0x80')](db[_0x9197('0x81')][_0x9197('0x35')](_0x21c1a5));}return BPromise[_0x9197('0x82')](_0x5d2869);}})['then'](function(){return _0x43774f;})[_0x9197('0x26')](respondWithResult(_0x126ba1,null))[_0x9197('0x48')](handleError(_0x126ba1,null));};exports['removeLists']=function(_0x4dd455,_0x2ba16b,_0x4bdf1f){return db[_0x9197('0x2e')][_0x9197('0x4b')]({'where':{'id':_0x4dd455['params']['id']}})[_0x9197('0x26')](handleEntityNotFound(_0x2ba16b,null))[_0x9197('0x26')](function(_0x2d67c2){if(_0x2d67c2){return _0x2d67c2[_0x9197('0x83')](_0x4dd455[_0x9197('0x35')][_0x9197('0x67')]);}})['then'](function(_0x2a54a5){if(_0x2a54a5){return db[_0x9197('0x5d')]['destroy']({'where':{'ListId':_0x4dd455[_0x9197('0x35')][_0x9197('0x67')],'CampaignId':_0x4dd455[_0x9197('0x4a')]['id']}})[_0x9197('0x26')](function(){return _0x2a54a5;});}})[_0x9197('0x26')](respondWithStatusCode(_0x2ba16b,null))['catch'](handleError(_0x2ba16b,null));};exports[_0x9197('0x84')]=function(_0x17b6b5,_0x5cb5fd,_0x1c9055){var _0x5a3bca={};var _0x122f93={};var _0x9c9275;var _0x5183d6;return db[_0x9197('0x2e')]['findOne']({'where':{'id':_0x17b6b5['params']['id']}})['then'](handleEntityNotFound(_0x5cb5fd,null))[_0x9197('0x26')](function(_0x4b4bba){if(_0x4b4bba){_0x9c9275=_0x4b4bba;_0x122f93[_0x9197('0x33')]=_[_0x9197('0x36')](db['CmList'][_0x9197('0x2f')]);_0x122f93['query']=_[_0x9197('0x36')](_0x17b6b5[_0x9197('0x35')]);_0x122f93['filters']=_['intersection'](_0x122f93[_0x9197('0x33')],_0x122f93[_0x9197('0x35')]);_0x5a3bca[_0x9197('0x3a')]=_[_0x9197('0x38')](_0x122f93[_0x9197('0x33')],qs['fields'](_0x17b6b5[_0x9197('0x35')][_0x9197('0x39')]));_0x5a3bca['attributes']=_0x5a3bca[_0x9197('0x3a')][_0x9197('0x3b')]?_0x5a3bca[_0x9197('0x3a')]:_0x122f93['model'];_0x5a3bca[_0x9197('0x3d')]=qs['sort'](_0x17b6b5[_0x9197('0x35')][_0x9197('0x3e')]);_0x5a3bca[_0x9197('0x3f')]=qs[_0x9197('0x37')](_['pick'](_0x17b6b5[_0x9197('0x35')],_0x122f93[_0x9197('0x37')]));if(_0x17b6b5[_0x9197('0x35')]['filter']){_0x5a3bca[_0x9197('0x3f')]=_['merge'](_0x5a3bca[_0x9197('0x3f')],{'$or':_[_0x9197('0x34')](_0x5a3bca[_0x9197('0x3a')],function(_0x1f433a){var _0x20e4bc={};_0x20e4bc[_0x1f433a]={'$like':'%'+_0x17b6b5[_0x9197('0x35')]['filter']+'%'};return _0x20e4bc;})});}_0x5a3bca=_[_0x9197('0x42')]({},_0x5a3bca,_0x17b6b5[_0x9197('0x43')]);return _0x9c9275[_0x9197('0x84')](_0x5a3bca);}})[_0x9197('0x26')](function(_0x14ee18){if(_0x14ee18){_0x5183d6=_0x14ee18['length'];if(!_0x17b6b5['query'][_0x9197('0x3c')](_0x9197('0x60'))){_0x5a3bca['limit']=qs['limit'](_0x17b6b5[_0x9197('0x35')]['limit']);_0x5a3bca['offset']=qs[_0x9197('0x1f')](_0x17b6b5[_0x9197('0x35')][_0x9197('0x1f')]);}return _0x9c9275['getBlackLists'](_0x5a3bca);}})[_0x9197('0x26')](function(_0x15c525){if(_0x15c525){return _0x15c525?{'count':_0x5183d6,'rows':_0x15c525}:null;}})[_0x9197('0x26')](respondWithResult(_0x5cb5fd,null))[_0x9197('0x48')](handleError(_0x5cb5fd,null));};exports['addBlackLists']=function(_0x374941,_0xfff3cf,_0x29b4f3){var _0x38b114,_0x244dcd;return db[_0x9197('0x2e')][_0x9197('0x4b')]({'where':{'id':_0x374941[_0x9197('0x4a')]['id']}})[_0x9197('0x26')](handleEntityNotFound(_0xfff3cf,null))['then'](function(_0x4fa2bb){if(_0x4fa2bb){_0x244dcd=_0x4fa2bb;return _0x4fa2bb[_0x9197('0x85')](_0x374941[_0x9197('0x4d')][_0x9197('0x67')],_[_0x9197('0x57')](_0x374941[_0x9197('0x4d')],[_0x9197('0x67'),'id'])||{});}return null;})[_0x9197('0x86')](function(_0x1449d2){var _0x1d61f5;_0x38b114=_0x1449d2||[];var _0x16edf6=[];if(_0x1449d2){for(var _0x561449=0x0;_0x561449<_0x1449d2['length'];_0x561449+=0x1){var _0xb82f03=_0x1449d2[_0x561449]['get']({'plain':!![]});_0x1d61f5=squel[_0x9197('0x6a')]()[_0x9197('0x6b')](_0x9197('0x87'))[_0x9197('0x6d')]([_0x9197('0x72'),_0x9197('0x6f'),_0x9197('0x70'),_0x9197('0x64'),_0x9197('0x58'),'updatedAt'],squel[_0x9197('0x7e')]()['field']('phone',_0x9197('0x72'))[_0x9197('0x71')]('id',_0x9197('0x6f'))['field'](_0xb82f03[_0x9197('0x74')][_0x9197('0x75')](),_0x9197('0x70'))['field'](_0x374941[_0x9197('0x4a')]['id'][_0x9197('0x75')](),_0x9197('0x64'))[_0x9197('0x71')](_0x9197('0x73'),'createdAt')[_0x9197('0x71')](_0x9197('0x73'),_0x9197('0x59'))[_0x9197('0x7b')](_0x9197('0x76'))[_0x9197('0x3f')](_0x9197('0x77'))[_0x9197('0x3f')](_0x9197('0x88'),_0xb82f03['CmListId'][_0x9197('0x75')]())[_0x9197('0x3f')](_0x9197('0x78')))[_0x9197('0x75')]();_0x16edf6['push'](db['sequelize'][_0x9197('0x35')](_0x1d61f5));}return BPromise['all'](_0x16edf6);}})[_0x9197('0x26')](function(){return _0x38b114;})['then'](respondWithResult(_0xfff3cf,null))[_0x9197('0x48')](handleError(_0xfff3cf,null));};exports[_0x9197('0x89')]=function(_0x366571,_0x580a31,_0x210a4f){return db[_0x9197('0x2e')][_0x9197('0x4b')]({'where':{'id':_0x366571[_0x9197('0x4a')]['id']}})['then'](handleEntityNotFound(_0x580a31,null))[_0x9197('0x26')](function(_0x221741){if(_0x221741){return _0x221741['removeBlackLists'](_0x366571[_0x9197('0x35')][_0x9197('0x67')]);}})[_0x9197('0x26')](function(_0x14bcc6){if(_0x14bcc6){return db['CmHopperBlack'][_0x9197('0x27')]({'where':{'ListId':_0x366571['query'][_0x9197('0x67')],'CampaignId':_0x366571[_0x9197('0x4a')]['id']}})[_0x9197('0x26')](function(){return _0x14bcc6;});}})[_0x9197('0x26')](respondWithStatusCode(_0x580a31,null))['catch'](handleError(_0x580a31,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 58b350c..80c7aed 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 _0xc698=['request-promise','path','rimraf','../../config/environment','./campaign.attributes','Campaign','lodash','util','bluebird'];(function(_0x14ddd4,_0x5b527d){var _0x421616=function(_0x4f0a42){while(--_0x4f0a42){_0x14ddd4['push'](_0x14ddd4['shift']());}};_0x421616(++_0x5b527d);}(_0xc698,0x189));var _0x8c69=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0xc698[_0xd299c3];return _0x376574;};'use strict';var _=require(_0x8c69('0x0'));var util=require(_0x8c69('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8c69('0x2'));var rp=require(_0x8c69('0x3'));var fs=require('fs');var path=require(_0x8c69('0x4'));var rimraf=require(_0x8c69('0x5'));var config=require(_0x8c69('0x6'));var attributes=require(_0x8c69('0x7'));module['exports']=function(_0x35a9f4,_0x389dda){return _0x35a9f4['define'](_0x8c69('0x8'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38b2=['request-promise','path','rimraf','./campaign.attributes','exports','Campaign','campaigns','util','../../config/logger'];(function(_0x3ef45e,_0xe84f33){var _0x69e7c=function(_0x43ba11){while(--_0x43ba11){_0x3ef45e['push'](_0x3ef45e['shift']());}};_0x69e7c(++_0xe84f33);}(_0x38b2,0x1d2));var _0x238b=function(_0x9d69a8,_0x17ced2){_0x9d69a8=_0x9d69a8-0x0;var _0x5d7c70=_0x38b2[_0x9d69a8];return _0x5d7c70;};'use strict';var _=require('lodash');var util=require(_0x238b('0x0'));var logger=require(_0x238b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x238b('0x2'));var fs=require('fs');var path=require(_0x238b('0x3'));var rimraf=require(_0x238b('0x4'));var config=require('../../config/environment');var attributes=require(_0x238b('0x5'));module[_0x238b('0x6')]=function(_0x3cfa8b,_0x121322){return _0x3cfa8b['define'](_0x238b('0x7'),attributes,{'tableName':_0x238b('0x8'),'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 a4e12c6..f36f6dc 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x10844b,_0x1fdc2d){var _0x9af234=function(_0x25a32f){while(--_0x25a32f){_0x10844b['push'](_0x10844b['shift']());}};_0x9af234(++_0x1fdc2d);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3cdf98,_0xda80f7){var _0xc3464b=function(_0x418fc4){while(--_0x418fc4){_0x3cdf98['push'](_0x3cdf98['shift']());}};_0xc3464b(++_0xda80f7);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index c193dfb..274f7c4 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 _0x51ba=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','post','/:id/clone','clone','addLists','put','update','destroy','delete','removeBlackLists','multer','util','path','connect-timeout','express'];(function(_0x1b9f58,_0x398fb4){var _0x57751e=function(_0x39dfdc){while(--_0x39dfdc){_0x1b9f58['push'](_0x1b9f58['shift']());}};_0x57751e(++_0x398fb4);}(_0x51ba,0x10b));var _0xa51b=function(_0x528a34,_0x4533eb){_0x528a34=_0x528a34-0x0;var _0x2fbedf=_0x51ba[_0x528a34];return _0x2fbedf;};'use strict';var multer=require(_0xa51b('0x0'));var util=require(_0xa51b('0x1'));var path=require(_0xa51b('0x2'));var timeout=require(_0xa51b('0x3'));var express=require(_0xa51b('0x4'));var router=express[_0xa51b('0x5')]();var auth=require(_0xa51b('0x6'));var interaction=require(_0xa51b('0x7'));var config=require(_0xa51b('0x8'));var controller=require(_0xa51b('0x9'));router[_0xa51b('0xa')]('/',auth[_0xa51b('0xb')](),controller[_0xa51b('0xc')]);router[_0xa51b('0xa')](_0xa51b('0xd'),auth['isAuthenticated'](),controller[_0xa51b('0xe')]);router[_0xa51b('0xa')](_0xa51b('0xf'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x10')]);router[_0xa51b('0xa')](_0xa51b('0x11'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x12')]);router['get'](_0xa51b('0x13'),auth['isAuthenticated'](),controller[_0xa51b('0x14')]);router['get'](_0xa51b('0x15'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x16')]);router[_0xa51b('0xa')](_0xa51b('0x17'),auth['isAuthenticated'](),controller['getLists']);router[_0xa51b('0xa')](_0xa51b('0x18'),auth[_0xa51b('0xb')](),controller['getBlackLists']);router[_0xa51b('0x19')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa51b('0x1a'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x1b')]);router['post'](_0xa51b('0x17'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x1c')]);router[_0xa51b('0x19')](_0xa51b('0x18'),auth[_0xa51b('0xb')](),controller['addBlackLists']);router[_0xa51b('0x1d')](_0xa51b('0xd'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x1e')]);router['delete'](_0xa51b('0xd'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x1f')]);router[_0xa51b('0x20')](_0xa51b('0x17'),auth[_0xa51b('0xb')](),controller['removeLists']);router[_0xa51b('0x20')](_0xa51b('0x18'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x21')]);module['exports']=router; \ No newline at end of file +var _0xbf6b=['getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','/:id/blacklists','post','create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put','destroy','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf6b,0x168));var _0xbbf6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbf6b[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xbbf6('0x0'));var util=require(_0xbbf6('0x1'));var path=require(_0xbbf6('0x2'));var timeout=require(_0xbbf6('0x3'));var express=require(_0xbbf6('0x4'));var router=express['Router']();var auth=require(_0xbbf6('0x5'));var interaction=require(_0xbbf6('0x6'));var config=require(_0xbbf6('0x7'));var controller=require(_0xbbf6('0x8'));router[_0xbbf6('0x9')]('/',auth[_0xbbf6('0xa')](),controller[_0xbbf6('0xb')]);router[_0xbbf6('0x9')](_0xbbf6('0xc'),auth[_0xbbf6('0xa')](),controller[_0xbbf6('0xd')]);router[_0xbbf6('0x9')]('/:id/hoppers',auth[_0xbbf6('0xa')](),controller[_0xbbf6('0xe')]);router[_0xbbf6('0x9')](_0xbbf6('0xf'),auth[_0xbbf6('0xa')](),controller['getHopperHistories']);router[_0xbbf6('0x9')](_0xbbf6('0x10'),auth[_0xbbf6('0xa')](),controller[_0xbbf6('0x11')]);router[_0xbbf6('0x9')](_0xbbf6('0x12'),auth['isAuthenticated'](),controller['getHopperBlacks']);router['get']('/:id/lists',auth[_0xbbf6('0xa')](),controller[_0xbbf6('0x13')]);router['get'](_0xbbf6('0x14'),auth[_0xbbf6('0xa')](),controller['getBlackLists']);router[_0xbbf6('0x15')]('/',auth[_0xbbf6('0xa')](),controller[_0xbbf6('0x16')]);router['post'](_0xbbf6('0x17'),auth['isAuthenticated'](),controller[_0xbbf6('0x18')]);router['post'](_0xbbf6('0x19'),auth[_0xbbf6('0xa')](),controller[_0xbbf6('0x1a')]);router[_0xbbf6('0x15')](_0xbbf6('0x14'),auth['isAuthenticated'](),controller[_0xbbf6('0x1b')]);router[_0xbbf6('0x1c')](_0xbbf6('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xbbf6('0xa')](),controller[_0xbbf6('0x1d')]);router[_0xbbf6('0x1e')](_0xbbf6('0x19'),auth[_0xbbf6('0xa')](),controller[_0xbbf6('0x1f')]);router[_0xbbf6('0x1e')](_0xbbf6('0x14'),auth[_0xbbf6('0xa')](),controller[_0xbbf6('0x20')]);module[_0xbbf6('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 061d3aa..3e6c23b 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 _0x42d0=['key','STRING','VIRTUAL','getDataValue'];(function(_0x18d72d,_0xe7e88e){var _0x37b91e=function(_0x41cdc7){while(--_0x41cdc7){_0x18d72d['push'](_0x18d72d['shift']());}};_0x37b91e(++_0xe7e88e);}(_0x42d0,0x1c9));var _0x042d=function(_0x2067e9,_0x5e6a97){_0x2067e9=_0x2067e9-0x0;var _0x280ce4=_0x42d0[_0x2067e9];return _0x280ce4;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x042d('0x0')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x042d('0x0')]},'name':{'type':Sequelize[_0x042d('0x1')],'get':function(){return this[_0x042d('0x2')](_0x042d('0x3'));}}}; \ No newline at end of file +var _0xa956=['STRING','VIRTUAL','getDataValue','exports'];(function(_0x104221,_0x3b0fc1){var _0x253a54=function(_0xfcd50d){while(--_0xfcd50d){_0x104221['push'](_0x104221['shift']());}};_0x253a54(++_0x3b0fc1);}(_0xa956,0xab));var _0x6a95=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0xa956[_0x1a89a1];return _0x3d5b46;};'use strict';var Sequelize=require('sequelize');module[_0x6a95('0x0')]={'key':{'type':Sequelize[_0x6a95('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x6a95('0x2')],'get':function(){return this[_0x6a95('0x3')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 670daba..4342c69 100644 --- a/server/api/cannedAnswer/cannedAnswer.controller.js +++ b/server/api/cannedAnswer/cannedAnswer.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x13e482,_0x150dc2){var _0x10a28f=function(_0x2b4bad){while(--_0x2b4bad){_0x13e482['push'](_0x13e482['shift']());}};_0x10a28f(++_0x150dc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x47')]['id']){delete _0x8d6dd1[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x16f976[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x49')]=function(_0x4f7240,_0x4ae14b){var _0x5ddf84={'key':_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x2e')]};if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')]){_0x5ddf84[_0x0a9e('0x4a')]=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')];}else if(_0x4f7240[_0x0a9e('0x47')]['SmsAccountId']){_0x5ddf84['SmsAccountId']=_0x4f7240['body'][_0x0a9e('0x4b')];}else if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5ddf84['OpenchannelAccountId']=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')];}else if(_0x4f7240['body']['ChatWebsiteId']){_0x5ddf84[_0x0a9e('0x4d')]=_0x4f7240['body'][_0x0a9e('0x4d')];}return db['CannedAnswer'][_0x0a9e('0x48')]({'where':_0x5ddf84})[_0x0a9e('0x22')](function(_0x439340){if(_0x439340){throw new db['Sequelize'][(_0x0a9e('0x4e'))](_0x0a9e('0x4f'));}return db['CannedAnswer']['create'](_0x4f7240[_0x0a9e('0x47')]);})[_0x0a9e('0x22')](function(_0x49c095){var _0x145931=_0x4f7240['user'][_0x0a9e('0x50')]({'plain':!![]});if(!_0x145931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145931[_0x0a9e('0x51')]==='user'){var _0x5da27d=_0x49c095['get']({'plain':!![]});return db[_0x0a9e('0x52')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x145931[_0x0a9e('0x53')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x19b4df){if(_0x19b4df&&_0x19b4df[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x49')]({'name':_0x5da27d[_0x0a9e('0x26')],'resourceId':_0x5da27d['id'],'type':_0x19b4df['name'],'sectionId':_0x19b4df['id']},{})[_0x0a9e('0x22')](function(){return _0x49c095;});}else{return _0x49c095;}})[_0x0a9e('0x42')](function(_0x2642bb){logger[_0x0a9e('0x55')](_0x0a9e('0x56'),_0x2642bb);throw _0x2642bb;});}return _0x49c095;})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,0xc9))['catch'](handleError(_0x4ae14b,null));}; \ No newline at end of file +var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 0462720..5c4a92c 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 _0xcb67=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4b87dc,_0x65bfba){var _0x4c3b12=function(_0xf7ff85){while(--_0xf7ff85){_0x4b87dc['push'](_0x4b87dc['shift']());}};_0x4c3b12(++_0x65bfba);}(_0xcb67,0x104));var _0x7cb6=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0xcb67[_0x56f7e2];return _0x36240b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7cb6('0x0'));var moment=require(_0x7cb6('0x1'));var BPromise=require(_0x7cb6('0x2'));var rp=require(_0x7cb6('0x3'));var fs=require('fs');var path=require(_0x7cb6('0x4'));var rimraf=require(_0x7cb6('0x5'));var config=require(_0x7cb6('0x6'));var attributes=require(_0x7cb6('0x7'));module['exports']=function(_0x1a0505,_0x4b9f51){return _0x1a0505[_0x7cb6('0x8')](_0x7cb6('0x9'),attributes,{'tableName':_0x7cb6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7cb6('0xb'),'collate':_0x7cb6('0xc')});}; \ No newline at end of file +var _0x1060=['define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0x1060,0x147));var _0x0106=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x1060[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x0106('0x0'));var util=require(_0x0106('0x1'));var logger=require(_0x0106('0x2'))(_0x0106('0x3'));var moment=require('moment');var BPromise=require(_0x0106('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0106('0x5'));var rimraf=require(_0x0106('0x6'));var config=require(_0x0106('0x7'));var attributes=require(_0x0106('0x8'));module['exports']=function(_0x260c50,_0xa8504f){return _0x260c50[_0x0106('0x9')](_0x0106('0xa'),attributes,{'tableName':_0x0106('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0106('0xc'),'collate':_0x0106('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index b788ecc..5704b54 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 _0xf6d9=['ioredis','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','error','CannedAnswer,\x20%s,\x20%s','message','moment','randomstring'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xf6d9,0x1ab));var _0x9f6d=function(_0x4ab7f4,_0x5442c9){_0x4ab7f4=_0x4ab7f4-0x0;var _0x89ee6b=_0xf6d9[_0x4ab7f4];return _0x89ee6b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9f6d('0x0'));var BPromise=require('bluebird');var rs=require(_0x9f6d('0x1'));var fs=require('fs');var Redis=require(_0x9f6d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f6d('0x3'));var logger=require(_0x9f6d('0x4'))(_0x9f6d('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9f6d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x11a375,_0x28f51c,_0x4aa666){return new BPromise(function(_0x350053,_0x43a7d7){return client['request'](_0x11a375,_0x4aa666)[_0x9f6d('0x7')](function(_0x36e3cb){logger[_0x9f6d('0x8')]('CannedAnswer,\x20%s,\x20%s',_0x28f51c,_0x9f6d('0x9'));logger['debug']('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x28f51c,_0x9f6d('0x9'),JSON['stringify'](_0x36e3cb));if(_0x36e3cb[_0x9f6d('0xa')]){if(_0x36e3cb[_0x9f6d('0xa')]['code']===0x1f4){logger[_0x9f6d('0xa')](_0x9f6d('0xb'),_0x28f51c,_0x36e3cb[_0x9f6d('0xa')][_0x9f6d('0xc')]);return _0x43a7d7(_0x36e3cb[_0x9f6d('0xa')][_0x9f6d('0xc')]);}logger[_0x9f6d('0xa')](_0x9f6d('0xb'),_0x28f51c,_0x36e3cb[_0x9f6d('0xa')][_0x9f6d('0xc')]);return _0x350053(_0x36e3cb[_0x9f6d('0xa')][_0x9f6d('0xc')]);}else{logger[_0x9f6d('0x8')](_0x9f6d('0xb'),_0x28f51c,'request\x20sent');_0x350053(_0x36e3cb['result'][_0x9f6d('0xc')]);}})['catch'](function(_0x2ad3a9){logger[_0x9f6d('0xa')]('CannedAnswer,\x20%s,\x20%s',_0x28f51c,_0x2ad3a9);_0x43a7d7(_0x2ad3a9);});});} \ No newline at end of file +var _0x88e0=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x215bde,_0x3f998c){var _0x1e836c=function(_0x3d6ed3){while(--_0x3d6ed3){_0x215bde['push'](_0x215bde['shift']());}};_0x1e836c(++_0x3f998c);}(_0x88e0,0x11e));var _0x088e=function(_0x43235b,_0x260d38){_0x43235b=_0x43235b-0x0;var _0x1338d8=_0x88e0[_0x43235b];return _0x1338d8;};'use strict';var _=require(_0x088e('0x0'));var util=require(_0x088e('0x1'));var moment=require('moment');var BPromise=require(_0x088e('0x2'));var rs=require(_0x088e('0x3'));var fs=require('fs');var Redis=require(_0x088e('0x4'));var db=require(_0x088e('0x5'))['db'];var utils=require(_0x088e('0x6'));var logger=require(_0x088e('0x7'))(_0x088e('0x8'));var config=require(_0x088e('0x9'));var jayson=require(_0x088e('0xa'));var client=jayson[_0x088e('0xb')][_0x088e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x514471,_0x7a8dbf,_0x231dd1){return new BPromise(function(_0x3d8ec6,_0x3d7a2f){return client[_0x088e('0xd')](_0x514471,_0x231dd1)[_0x088e('0xe')](function(_0x405aed){logger[_0x088e('0xf')](_0x088e('0x10'),_0x7a8dbf,_0x088e('0x11'));logger[_0x088e('0x12')](_0x088e('0x13'),_0x7a8dbf,'request\x20sent',JSON[_0x088e('0x14')](_0x405aed));if(_0x405aed['error']){if(_0x405aed[_0x088e('0x15')][_0x088e('0x16')]===0x1f4){logger[_0x088e('0x15')](_0x088e('0x10'),_0x7a8dbf,_0x405aed['error']['message']);return _0x3d7a2f(_0x405aed['error'][_0x088e('0x17')]);}logger[_0x088e('0x15')](_0x088e('0x10'),_0x7a8dbf,_0x405aed[_0x088e('0x15')]['message']);return _0x3d8ec6(_0x405aed['error'][_0x088e('0x17')]);}else{logger['info'](_0x088e('0x10'),_0x7a8dbf,'request\x20sent');_0x3d8ec6(_0x405aed[_0x088e('0x18')][_0x088e('0x17')]);}})[_0x088e('0x19')](function(_0xfccc80){logger['error'](_0x088e('0x10'),_0x7a8dbf,_0xfccc80);_0x3d7a2f(_0xfccc80);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 11e16ba..12d49c8 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 _0xa0a1=['express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','destroy','multer','path','connect-timeout'];(function(_0x405dc0,_0x5f2898){var _0x1ed46d=function(_0x5efad7){while(--_0x5efad7){_0x405dc0['push'](_0x405dc0['shift']());}};_0x1ed46d(++_0x5f2898);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x293d88,_0x21a47c){_0x293d88=_0x293d88-0x0;var _0x3c53b7=_0xa0a1[_0x293d88];return _0x3c53b7;};'use strict';var multer=require(_0x1a0a('0x0'));var util=require('util');var path=require(_0x1a0a('0x1'));var timeout=require(_0x1a0a('0x2'));var express=require(_0x1a0a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1a0a('0x4'));var config=require(_0x1a0a('0x5'));var controller=require('./cannedAnswer.controller');router[_0x1a0a('0x6')]('/',auth[_0x1a0a('0x7')](),controller['index']);router[_0x1a0a('0x6')](_0x1a0a('0x8'),auth[_0x1a0a('0x7')](),controller[_0x1a0a('0x9')]);router[_0x1a0a('0xa')]('/',auth['isAuthenticated'](),controller[_0x1a0a('0xb')]);router[_0x1a0a('0xc')](_0x1a0a('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1a0a('0x8'),auth[_0x1a0a('0x7')](),controller[_0x1a0a('0xd')]);module['exports']=router; \ No newline at end of file +var _0x510b=['get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','./cannedAnswer.controller'];(function(_0x1ec77c,_0x2454b6){var _0x2cfc61=function(_0x4f8a1f){while(--_0x4f8a1f){_0x1ec77c['push'](_0x1ec77c['shift']());}};_0x2cfc61(++_0x2454b6);}(_0x510b,0x14e));var _0xb510=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x510b[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb510('0x0'));var util=require(_0xb510('0x1'));var path=require(_0xb510('0x2'));var timeout=require(_0xb510('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb510('0x4'));var config=require('../../config/environment');var controller=require(_0xb510('0x5'));router[_0xb510('0x6')]('/',auth[_0xb510('0x7')](),controller['index']);router[_0xb510('0x6')](_0xb510('0x8'),auth['isAuthenticated'](),controller[_0xb510('0x9')]);router[_0xb510('0xa')]('/',auth['isAuthenticated'](),controller[_0xb510('0xb')]);router[_0xb510('0xc')](_0xb510('0x8'),auth[_0xb510('0x7')](),controller[_0xb510('0xd')]);router[_0xb510('0xe')]('/:id',auth[_0xb510('0x7')](),controller[_0xb510('0xf')]);module[_0xb510('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index fad949b..eee8f19 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 _0xc747=['INTEGER','sequelize','STRING'];(function(_0x5af6eb,_0x4dcee0){var _0x29b21f=function(_0x46c873){while(--_0x46c873){_0x5af6eb['push'](_0x5af6eb['shift']());}};_0x29b21f(++_0x4dcee0);}(_0xc747,0x76));var _0x7c74=function(_0x1fb7c9,_0xb14ddf){_0x1fb7c9=_0x1fb7c9-0x0;var _0x5f0c3a=_0xc747[_0x1fb7c9];return _0x5f0c3a;};'use strict';var Sequelize=require(_0x7c74('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x7c74('0x1')]},'dcontext':{'type':Sequelize[_0x7c74('0x1')]},'channel':{'type':Sequelize[_0x7c74('0x1')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x7c74('0x1')]},'lastdata':{'type':Sequelize[_0x7c74('0x1')]},'duration':{'type':Sequelize[_0x7c74('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7c74('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7c74('0x1')]},'amaflags':{'type':Sequelize[_0x7c74('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x7c74('0x1')]},'userfield':{'type':Sequelize[_0x7c74('0x1')]},'uniqueid':{'type':Sequelize[_0x7c74('0x1')]},'linkedid':{'type':Sequelize[_0x7c74('0x1')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x7c74('0x1')]},'type':{'type':Sequelize[_0x7c74('0x1')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x11c3=['STRING','INTEGER','exports','1970-01-01\x2000:00:01'];(function(_0x5e3211,_0x15f9fa){var _0x4f9904=function(_0x2ba754){while(--_0x2ba754){_0x5e3211['push'](_0x5e3211['shift']());}};_0x4f9904(++_0x15f9fa);}(_0x11c3,0x166));var _0x311c=function(_0x419174,_0x4ac66f){_0x419174=_0x419174-0x0;var _0x18c856=_0x11c3[_0x419174];return _0x18c856;};'use strict';var Sequelize=require('sequelize');module[_0x311c('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x311c('0x1')},'clid':{'type':Sequelize[_0x311c('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x311c('0x2')]},'dcontext':{'type':Sequelize[_0x311c('0x2')]},'channel':{'type':Sequelize[_0x311c('0x2')]},'dstchannel':{'type':Sequelize[_0x311c('0x2')]},'lastapp':{'type':Sequelize[_0x311c('0x2')]},'lastdata':{'type':Sequelize[_0x311c('0x2')]},'duration':{'type':Sequelize[_0x311c('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x311c('0x2')]},'amaflags':{'type':Sequelize[_0x311c('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x311c('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x311c('0x2')]},'linkedid':{'type':Sequelize[_0x311c('0x2')]},'sequence':{'type':Sequelize[_0x311c('0x2')]},'peeraccount':{'type':Sequelize[_0x311c('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x311c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 3ab9637..ef0a656 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 _0xe4d4=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','catch','show','params','include','find','create','body','destroy','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x313025,_0x643fac){var _0x5dc8c9=function(_0x2ab3c7){while(--_0x2ab3c7){_0x313025['push'](_0x313025['shift']());}};_0x5dc8c9(++_0x643fac);}(_0xe4d4,0x192));var _0x4e4d=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0xe4d4[_0x380307];return _0x9ea14b;};'use strict';var pdf=require(_0x4e4d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4e4d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e4d('0x2'));var rp=require(_0x4e4d('0x3'));var moment=require(_0x4e4d('0x4'));var BPromise=require(_0x4e4d('0x5'));var Mustache=require('mustache');var util=require(_0x4e4d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4e4d('0x7'));var ejs=require(_0x4e4d('0x8'));var fs=require('fs');var _=require(_0x4e4d('0x9'));var squel=require('squel');var crypto=require(_0x4e4d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4e4d('0xb'));var toCsv=require(_0x4e4d('0x7'));var querystring=require('querystring');var Papa=require(_0x4e4d('0xc'));var Redis=require(_0x4e4d('0xd'));var authService=require(_0x4e4d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4e4d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e4d('0x10'))(_0x4e4d('0x11'));var utils=require(_0x4e4d('0x12'));var config=require(_0x4e4d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e4d('0x14'))['db'];function respondWithStatusCode(_0x4126cc,_0x1a50c0){_0x1a50c0=_0x1a50c0||0xcc;return function(_0x30ea92){if(_0x30ea92){return _0x4126cc[_0x4e4d('0x15')](_0x1a50c0);}return _0x4126cc[_0x4e4d('0x16')](_0x1a50c0)[_0x4e4d('0x17')]();};}function respondWithResult(_0x526a51,_0x43b5d4){_0x43b5d4=_0x43b5d4||0xc8;return function(_0x54886b){if(_0x54886b){return _0x526a51['status'](_0x43b5d4)['json'](_0x54886b);}};}function respondWithFilteredResult(_0x155933,_0x3574e2){return function(_0x2fa22d){if(_0x2fa22d){var _0x44c75c=_0x2fa22d[_0x4e4d('0x18')],_0x519e73=_0x3574e2[_0x4e4d('0x19')],_0x13ffff=_0x3574e2[_0x4e4d('0x19')]+_0x3574e2['limit'],_0xd2933d;if(_0x13ffff>=_0x44c75c){_0x13ffff=_0x44c75c;_0xd2933d=0xc8;}else{_0xd2933d=0xce;}_0x155933[_0x4e4d('0x16')](_0xd2933d);return _0x155933[_0x4e4d('0x1a')]('Content-Range',_0x519e73+'-'+_0x13ffff+'/'+_0x44c75c)[_0x4e4d('0x1b')](_0x2fa22d);}return null;};}function patchUpdates(_0x323328){return function(_0x26fdf6){try{jsonpatch[_0x4e4d('0x1c')](_0x26fdf6,_0x323328,!![]);}catch(_0x142db5){return BPromise[_0x4e4d('0x1d')](_0x142db5);}return _0x26fdf6['save']();};}function saveUpdates(_0x33acc7,_0x1801ac){return function(_0x37017c){if(_0x37017c){return _0x37017c[_0x4e4d('0x1e')](_0x33acc7)['then'](function(_0x3beb65){return _0x3beb65;});}return null;};}function removeEntity(_0x1fbd82,_0x2d0950){return function(_0x2a01e0){if(_0x2a01e0){return _0x2a01e0['destroy']()[_0x4e4d('0x1f')](function(){_0x1fbd82[_0x4e4d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3fe8,_0x4a7a4e){return function(_0x2beb18){if(!_0x2beb18){_0x5d3fe8[_0x4e4d('0x15')](0x194);}return _0x2beb18;};}function handleError(_0x181d97,_0x40fa3e){_0x40fa3e=_0x40fa3e||0x1f4;return function(_0x43b21b){logger[_0x4e4d('0x20')](_0x43b21b[_0x4e4d('0x21')]);if(_0x43b21b[_0x4e4d('0x22')]){delete _0x43b21b[_0x4e4d('0x22')];}_0x181d97[_0x4e4d('0x16')](_0x40fa3e)[_0x4e4d('0x23')](_0x43b21b);};}exports[_0x4e4d('0x24')]=function(_0x36b72b,_0x1a1298){var _0x1d9c37={},_0x10cc29={},_0x2ce2a7={'count':0x0,'rows':[]};var _0x26fc55=_[_0x4e4d('0x25')](db[_0x4e4d('0x26')][_0x4e4d('0x27')],function(_0x4df318){return{'name':_0x4df318[_0x4e4d('0x28')],'type':_0x4df318[_0x4e4d('0x29')][_0x4e4d('0x2a')]};});_0x10cc29[_0x4e4d('0x2b')]=_[_0x4e4d('0x25')](_0x26fc55,_0x4e4d('0x22'));_0x10cc29[_0x4e4d('0x2c')]=_[_0x4e4d('0x2d')](_0x36b72b['query']);_0x10cc29['filters']=_[_0x4e4d('0x2e')](_0x10cc29[_0x4e4d('0x2b')],_0x10cc29[_0x4e4d('0x2c')]);_0x1d9c37[_0x4e4d('0x2f')]=_['intersection'](_0x10cc29[_0x4e4d('0x2b')],qs['fields'](_0x36b72b[_0x4e4d('0x2c')][_0x4e4d('0x30')]));_0x1d9c37[_0x4e4d('0x2f')]=_0x1d9c37['attributes'][_0x4e4d('0x31')]?_0x1d9c37[_0x4e4d('0x2f')]:_0x10cc29[_0x4e4d('0x2b')];if(!_0x36b72b[_0x4e4d('0x2c')]['hasOwnProperty'](_0x4e4d('0x32'))){_0x1d9c37[_0x4e4d('0x33')]=qs['limit'](_0x36b72b[_0x4e4d('0x2c')][_0x4e4d('0x33')]);_0x1d9c37[_0x4e4d('0x19')]=qs['offset'](_0x36b72b[_0x4e4d('0x2c')][_0x4e4d('0x19')]);}_0x1d9c37[_0x4e4d('0x34')]=qs[_0x4e4d('0x35')](_0x36b72b[_0x4e4d('0x2c')][_0x4e4d('0x35')]);_0x1d9c37[_0x4e4d('0x36')]=qs[_0x4e4d('0x37')](_[_0x4e4d('0x38')](_0x36b72b[_0x4e4d('0x2c')],_0x10cc29[_0x4e4d('0x37')]),_0x26fc55);if(_0x36b72b['query']['filter']){_0x1d9c37[_0x4e4d('0x36')]=_[_0x4e4d('0x39')](_0x1d9c37[_0x4e4d('0x36')],{'$or':_[_0x4e4d('0x25')](_0x26fc55,function(_0x4c974){if(_0x4c974[_0x4e4d('0x29')]!==_0x4e4d('0x3a')){var _0x37f6f7={};_0x37f6f7[_0x4c974[_0x4e4d('0x22')]]={'$like':'%'+_0x36b72b[_0x4e4d('0x2c')]['filter']+'%'};return _0x37f6f7;}})});}_0x1d9c37=_['merge']({},_0x1d9c37,_0x36b72b[_0x4e4d('0x3b')]);var _0x357f03={'where':_0x1d9c37[_0x4e4d('0x36')]};return db[_0x4e4d('0x26')]['count'](_0x357f03)[_0x4e4d('0x1f')](function(_0x2256f9){_0x2ce2a7[_0x4e4d('0x18')]=_0x2256f9;if(_0x36b72b[_0x4e4d('0x2c')][_0x4e4d('0x3c')]){_0x1d9c37['include']=[{'all':!![]}];}return db[_0x4e4d('0x26')]['findAll'](_0x1d9c37);})[_0x4e4d('0x1f')](function(_0x1d4638){_0x2ce2a7['rows']=_0x1d4638;return _0x2ce2a7;})[_0x4e4d('0x1f')](respondWithFilteredResult(_0x1a1298,_0x1d9c37))[_0x4e4d('0x3d')](handleError(_0x1a1298,null));};exports[_0x4e4d('0x3e')]=function(_0x433930,_0x39ffae){var _0x492b03={'raw':!![],'where':{'id':_0x433930[_0x4e4d('0x3f')]['id']}},_0x1c49ad={};_0x1c49ad[_0x4e4d('0x2b')]=_[_0x4e4d('0x2d')](db[_0x4e4d('0x26')]['rawAttributes']);_0x1c49ad['query']=_[_0x4e4d('0x2d')](_0x433930[_0x4e4d('0x2c')]);_0x1c49ad['filters']=_[_0x4e4d('0x2e')](_0x1c49ad[_0x4e4d('0x2b')],_0x1c49ad['query']);_0x492b03[_0x4e4d('0x2f')]=_['intersection'](_0x1c49ad[_0x4e4d('0x2b')],qs[_0x4e4d('0x30')](_0x433930['query'][_0x4e4d('0x30')]));_0x492b03[_0x4e4d('0x2f')]=_0x492b03[_0x4e4d('0x2f')][_0x4e4d('0x31')]?_0x492b03[_0x4e4d('0x2f')]:_0x1c49ad[_0x4e4d('0x2b')];if(_0x433930['query'][_0x4e4d('0x3c')]){_0x492b03[_0x4e4d('0x40')]=[{'all':!![]}];}_0x492b03=_[_0x4e4d('0x39')]({},_0x492b03,_0x433930[_0x4e4d('0x3b')]);return db[_0x4e4d('0x26')][_0x4e4d('0x41')](_0x492b03)['then'](handleEntityNotFound(_0x39ffae,null))[_0x4e4d('0x1f')](respondWithResult(_0x39ffae,null))[_0x4e4d('0x3d')](handleError(_0x39ffae,null));};exports[_0x4e4d('0x42')]=function(_0x135c4d,_0x3cad10){return db[_0x4e4d('0x26')][_0x4e4d('0x42')](_0x135c4d[_0x4e4d('0x43')],{})[_0x4e4d('0x1f')](respondWithResult(_0x3cad10,0xc9))['catch'](handleError(_0x3cad10,null));};exports[_0x4e4d('0x1e')]=function(_0x5c5aea,_0x27427d){if(_0x5c5aea[_0x4e4d('0x43')]['id']){delete _0x5c5aea['body']['id'];}return db[_0x4e4d('0x26')][_0x4e4d('0x41')]({'where':{'id':_0x5c5aea['params']['id']}})[_0x4e4d('0x1f')](handleEntityNotFound(_0x27427d,null))[_0x4e4d('0x1f')](saveUpdates(_0x5c5aea['body'],null))[_0x4e4d('0x1f')](respondWithResult(_0x27427d,null))[_0x4e4d('0x3d')](handleError(_0x27427d,null));};exports[_0x4e4d('0x44')]=function(_0x5bdf65,_0x3ce5f5){return db[_0x4e4d('0x26')][_0x4e4d('0x41')]({'where':{'id':_0x5bdf65[_0x4e4d('0x3f')]['id']}})[_0x4e4d('0x1f')](handleEntityNotFound(_0x3ce5f5,null))[_0x4e4d('0x1f')](removeEntity(_0x3ce5f5,null))[_0x4e4d('0x3d')](handleError(_0x3ce5f5,null));};exports[_0x4e4d('0x45')]=function(_0x4e9640,_0x334e9e){return db[_0x4e4d('0x26')][_0x4e4d('0x45')]()[_0x4e4d('0x1f')](respondWithResult(_0x334e9e,null))[_0x4e4d('0x3d')](handleError(_0x334e9e,null));}; \ No newline at end of file +var _0x8324=['fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','keys','rawAttributes','fields','find','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','update','destroy','then','error','stack','name','send','map','Cdr'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x8324,0x129));var _0x4832=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x8324[_0x33554b];return _0x256954;};'use strict';var pdf=require(_0x4832('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4832('0x1'));var jsonpatch=require(_0x4832('0x2'));var rp=require(_0x4832('0x3'));var moment=require(_0x4832('0x4'));var BPromise=require(_0x4832('0x5'));var Mustache=require(_0x4832('0x6'));var util=require('util');var path=require(_0x4832('0x7'));var sox=require(_0x4832('0x8'));var csv=require(_0x4832('0x9'));var ejs=require(_0x4832('0xa'));var fs=require('fs');var _=require(_0x4832('0xb'));var squel=require(_0x4832('0xc'));var crypto=require(_0x4832('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4832('0x9'));var querystring=require(_0x4832('0xe'));var Papa=require(_0x4832('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4832('0x10'));var config=require(_0x4832('0x11'));var licenseUtil=require(_0x4832('0x12'));var db=require(_0x4832('0x13'))['db'];function respondWithStatusCode(_0x463d44,_0x2e886c){_0x2e886c=_0x2e886c||0xcc;return function(_0xce87e4){if(_0xce87e4){return _0x463d44[_0x4832('0x14')](_0x2e886c);}return _0x463d44[_0x4832('0x15')](_0x2e886c)[_0x4832('0x16')]();};}function respondWithResult(_0x136c5a,_0x50a1da){_0x50a1da=_0x50a1da||0xc8;return function(_0x1c3078){if(_0x1c3078){return _0x136c5a['status'](_0x50a1da)[_0x4832('0x17')](_0x1c3078);}};}function respondWithFilteredResult(_0x2fd907,_0x996f91){return function(_0x4dd106){if(_0x4dd106){var _0x29a851=_0x4dd106['count'],_0x228a12=_0x996f91[_0x4832('0x18')],_0x2c658c=_0x996f91[_0x4832('0x18')]+_0x996f91[_0x4832('0x19')],_0x2e84eb;if(_0x2c658c>=_0x29a851){_0x2c658c=_0x29a851;_0x2e84eb=0xc8;}else{_0x2e84eb=0xce;}_0x2fd907[_0x4832('0x15')](_0x2e84eb);return _0x2fd907[_0x4832('0x1a')]('Content-Range',_0x228a12+'-'+_0x2c658c+'/'+_0x29a851)[_0x4832('0x17')](_0x4dd106);}return null;};}function patchUpdates(_0x251dc0){return function(_0x134f81){try{jsonpatch[_0x4832('0x1b')](_0x134f81,_0x251dc0,!![]);}catch(_0x746f37){return BPromise['reject'](_0x746f37);}return _0x134f81[_0x4832('0x1c')]();};}function saveUpdates(_0x226ba6,_0xb8c529){return function(_0x8bf9c3){if(_0x8bf9c3){return _0x8bf9c3[_0x4832('0x1d')](_0x226ba6)['then'](function(_0x1e7118){return _0x1e7118;});}return null;};}function removeEntity(_0x3aae8b,_0x15b760){return function(_0x272fc2){if(_0x272fc2){return _0x272fc2[_0x4832('0x1e')]()[_0x4832('0x1f')](function(){_0x3aae8b[_0x4832('0x15')](0xcc)[_0x4832('0x16')]();});}};}function handleEntityNotFound(_0x2630b9,_0x187b81){return function(_0x4e9b1c){if(!_0x4e9b1c){_0x2630b9[_0x4832('0x14')](0x194);}return _0x4e9b1c;};}function handleError(_0x51c4e1,_0x93015e){_0x93015e=_0x93015e||0x1f4;return function(_0x335b83){logger[_0x4832('0x20')](_0x335b83[_0x4832('0x21')]);if(_0x335b83['name']){delete _0x335b83[_0x4832('0x22')];}_0x51c4e1[_0x4832('0x15')](_0x93015e)[_0x4832('0x23')](_0x335b83);};}exports['index']=function(_0x3688d8,_0x461565){var _0x28ec35={},_0x19ee86={},_0x2a5605={'count':0x0,'rows':[]};var _0x365253=_[_0x4832('0x24')](db[_0x4832('0x25')]['rawAttributes'],function(_0x10a60f){return{'name':_0x10a60f[_0x4832('0x26')],'type':_0x10a60f[_0x4832('0x27')]['key']};});_0x19ee86[_0x4832('0x28')]=_[_0x4832('0x24')](_0x365253,_0x4832('0x22'));_0x19ee86[_0x4832('0x29')]=_['keys'](_0x3688d8[_0x4832('0x29')]);_0x19ee86[_0x4832('0x2a')]=_[_0x4832('0x2b')](_0x19ee86[_0x4832('0x28')],_0x19ee86[_0x4832('0x29')]);_0x28ec35['attributes']=_[_0x4832('0x2b')](_0x19ee86[_0x4832('0x28')],qs['fields'](_0x3688d8[_0x4832('0x29')]['fields']));_0x28ec35[_0x4832('0x2c')]=_0x28ec35[_0x4832('0x2c')][_0x4832('0x2d')]?_0x28ec35[_0x4832('0x2c')]:_0x19ee86[_0x4832('0x28')];if(!_0x3688d8[_0x4832('0x29')][_0x4832('0x2e')](_0x4832('0x2f'))){_0x28ec35[_0x4832('0x19')]=qs[_0x4832('0x19')](_0x3688d8[_0x4832('0x29')][_0x4832('0x19')]);_0x28ec35[_0x4832('0x18')]=qs[_0x4832('0x18')](_0x3688d8[_0x4832('0x29')][_0x4832('0x18')]);}_0x28ec35['order']=qs['sort'](_0x3688d8[_0x4832('0x29')][_0x4832('0x30')]);_0x28ec35[_0x4832('0x31')]=qs[_0x4832('0x2a')](_[_0x4832('0x32')](_0x3688d8[_0x4832('0x29')],_0x19ee86['filters']),_0x365253);if(_0x3688d8[_0x4832('0x29')][_0x4832('0x33')]){_0x28ec35[_0x4832('0x31')]=_[_0x4832('0x34')](_0x28ec35[_0x4832('0x31')],{'$or':_['map'](_0x365253,function(_0x252d52){if(_0x252d52[_0x4832('0x27')]!==_0x4832('0x35')){var _0x4f2457={};_0x4f2457[_0x252d52[_0x4832('0x22')]]={'$like':'%'+_0x3688d8[_0x4832('0x29')][_0x4832('0x33')]+'%'};return _0x4f2457;}})});}_0x28ec35=_['merge']({},_0x28ec35,_0x3688d8[_0x4832('0x36')]);var _0x5cd862={'where':_0x28ec35[_0x4832('0x31')]};return db['Cdr']['count'](_0x5cd862)['then'](function(_0x496ed1){_0x2a5605[_0x4832('0x37')]=_0x496ed1;if(_0x3688d8['query'][_0x4832('0x38')]){_0x28ec35[_0x4832('0x39')]=[{'all':!![]}];}return db[_0x4832('0x25')][_0x4832('0x3a')](_0x28ec35);})[_0x4832('0x1f')](function(_0x3318f4){_0x2a5605['rows']=_0x3318f4;return _0x2a5605;})[_0x4832('0x1f')](respondWithFilteredResult(_0x461565,_0x28ec35))[_0x4832('0x3b')](handleError(_0x461565,null));};exports['show']=function(_0x16e32c,_0x2561fa){var _0x85d9d4={'raw':!![],'where':{'id':_0x16e32c[_0x4832('0x3c')]['id']}},_0xbe1dce={};_0xbe1dce[_0x4832('0x28')]=_[_0x4832('0x3d')](db[_0x4832('0x25')][_0x4832('0x3e')]);_0xbe1dce['query']=_[_0x4832('0x3d')](_0x16e32c[_0x4832('0x29')]);_0xbe1dce[_0x4832('0x2a')]=_[_0x4832('0x2b')](_0xbe1dce[_0x4832('0x28')],_0xbe1dce[_0x4832('0x29')]);_0x85d9d4[_0x4832('0x2c')]=_['intersection'](_0xbe1dce[_0x4832('0x28')],qs[_0x4832('0x3f')](_0x16e32c['query'][_0x4832('0x3f')]));_0x85d9d4[_0x4832('0x2c')]=_0x85d9d4[_0x4832('0x2c')]['length']?_0x85d9d4[_0x4832('0x2c')]:_0xbe1dce[_0x4832('0x28')];if(_0x16e32c[_0x4832('0x29')][_0x4832('0x38')]){_0x85d9d4[_0x4832('0x39')]=[{'all':!![]}];}_0x85d9d4=_['merge']({},_0x85d9d4,_0x16e32c[_0x4832('0x36')]);return db[_0x4832('0x25')][_0x4832('0x40')](_0x85d9d4)[_0x4832('0x1f')](handleEntityNotFound(_0x2561fa,null))[_0x4832('0x1f')](respondWithResult(_0x2561fa,null))[_0x4832('0x3b')](handleError(_0x2561fa,null));};exports['create']=function(_0xabb698,_0x1a6881){return db[_0x4832('0x25')]['create'](_0xabb698['body'],{})['then'](respondWithResult(_0x1a6881,0xc9))[_0x4832('0x3b')](handleError(_0x1a6881,null));};exports[_0x4832('0x1d')]=function(_0x54f624,_0xf78901){if(_0x54f624[_0x4832('0x41')]['id']){delete _0x54f624[_0x4832('0x41')]['id'];}return db[_0x4832('0x25')][_0x4832('0x40')]({'where':{'id':_0x54f624[_0x4832('0x3c')]['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0xf78901,null))[_0x4832('0x1f')](saveUpdates(_0x54f624[_0x4832('0x41')],null))['then'](respondWithResult(_0xf78901,null))['catch'](handleError(_0xf78901,null));};exports[_0x4832('0x1e')]=function(_0x2440a5,_0x23e45d){return db['Cdr'][_0x4832('0x40')]({'where':{'id':_0x2440a5[_0x4832('0x3c')]['id']}})['then'](handleEntityNotFound(_0x23e45d,null))[_0x4832('0x1f')](removeEntity(_0x23e45d,null))['catch'](handleError(_0x23e45d,null));};exports[_0x4832('0x42')]=function(_0x40daeb,_0x39eb50){return db[_0x4832('0x25')][_0x4832('0x42')]()[_0x4832('0x1f')](respondWithResult(_0x39eb50,null))[_0x4832('0x3b')](handleError(_0x39eb50,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 1b1f3ab..f472f93 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 _0x1623=['disposition','src','uniqueid','lodash','api','moment','bluebird','request-promise','path','./cdr.attributes','Cdr','cdr','accountcode','calldate'];(function(_0x5ddf45,_0x3ec271){var _0x560fc0=function(_0x100bd6){while(--_0x100bd6){_0x5ddf45['push'](_0x5ddf45['shift']());}};_0x560fc0(++_0x3ec271);}(_0x1623,0xab));var _0x3162=function(_0x44def1,_0x459fb8){_0x44def1=_0x44def1-0x0;var _0x43fa48=_0x1623[_0x44def1];return _0x43fa48;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'paranoid':![],'indexes':[{'name':_0x3162('0x9'),'fields':[_0x3162('0x9')]},{'name':_0x3162('0xa'),'fields':[_0x3162('0xa')]},{'name':_0x3162('0xb'),'fields':[_0x3162('0xb')]},{'name':'dst','fields':['dst']},{'name':_0x3162('0xc'),'fields':[_0x3162('0xc')]},{'name':_0x3162('0xd'),'fields':[_0x3162('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xe2fe=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Cdr','accountcode','calldate','disposition','dst','uniqueid','lodash'];(function(_0x1139f5,_0xcf1e1b){var _0x536371=function(_0x2de173){while(--_0x2de173){_0x1139f5['push'](_0x1139f5['shift']());}};_0x536371(++_0xcf1e1b);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./cdr.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['accountcode']},{'name':_0xee2f('0xb'),'fields':[_0xee2f('0xb')]},{'name':'disposition','fields':[_0xee2f('0xc')]},{'name':_0xee2f('0xd'),'fields':['dst']},{'name':'src','fields':['src']},{'name':'uniqueid','fields':[_0xee2f('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 438e24b..8292a60 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 _0x4d4c=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Cdr,\x20%s,\x20%s'];(function(_0x24e893,_0x130483){var _0x437e82=function(_0x5dbb8c){while(--_0x5dbb8c){_0x24e893['push'](_0x24e893['shift']());}};_0x437e82(++_0x130483);}(_0x4d4c,0xd4));var _0xc4d4=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0x4d4c[_0x29ae80];return _0x5d6d71;};'use strict';var _=require(_0xc4d4('0x0'));var util=require(_0xc4d4('0x1'));var moment=require('moment');var BPromise=require(_0xc4d4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4d4('0x3'));var db=require(_0xc4d4('0x4'))['db'];var utils=require(_0xc4d4('0x5'));var logger=require(_0xc4d4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc4d4('0x7'));var client=jayson[_0xc4d4('0x8')][_0xc4d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b81a8,_0xc9943b,_0x5d0196){return new BPromise(function(_0x442190,_0x6371d4){return client['request'](_0x5b81a8,_0x5d0196)[_0xc4d4('0xa')](function(_0x28313c){logger[_0xc4d4('0xb')]('Cdr,\x20%s,\x20%s',_0xc9943b,'request\x20sent');logger['debug'](_0xc4d4('0xc'),_0xc9943b,_0xc4d4('0xd'),JSON[_0xc4d4('0xe')](_0x28313c));if(_0x28313c[_0xc4d4('0xf')]){if(_0x28313c[_0xc4d4('0xf')][_0xc4d4('0x10')]===0x1f4){logger[_0xc4d4('0xf')]('Cdr,\x20%s,\x20%s',_0xc9943b,_0x28313c['error'][_0xc4d4('0x11')]);return _0x6371d4(_0x28313c[_0xc4d4('0xf')][_0xc4d4('0x11')]);}logger[_0xc4d4('0xf')](_0xc4d4('0x12'),_0xc9943b,_0x28313c[_0xc4d4('0xf')]['message']);return _0x442190(_0x28313c[_0xc4d4('0xf')]['message']);}else{logger[_0xc4d4('0xb')]('Cdr,\x20%s,\x20%s',_0xc9943b,_0xc4d4('0xd'));_0x442190(_0x28313c[_0xc4d4('0x13')][_0xc4d4('0x11')]);}})[_0xc4d4('0x14')](function(_0x27c9f1){logger[_0xc4d4('0xf')](_0xc4d4('0x12'),_0xc9943b,_0x27c9f1);_0x6371d4(_0x27c9f1);});});} \ No newline at end of file +var _0xd82f=['info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then'];(function(_0xf714cf,_0x584b1b){var _0x4570d6=function(_0xd1eb1){while(--_0xd1eb1){_0xf714cf['push'](_0xf714cf['shift']());}};_0x4570d6(++_0x584b1b);}(_0xd82f,0x11c));var _0xfd82=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd82f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xfd82('0x0'));var util=require(_0xfd82('0x1'));var moment=require('moment');var BPromise=require(_0xfd82('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd82('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd82('0x4'))('rpc');var config=require(_0xfd82('0x5'));var jayson=require(_0xfd82('0x6'));var client=jayson['client'][_0xfd82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x765142,_0x3b2dd5,_0x198194){return new BPromise(function(_0x14b14e,_0x2dc420){return client[_0xfd82('0x8')](_0x765142,_0x198194)[_0xfd82('0x9')](function(_0x2c3932){logger[_0xfd82('0xa')](_0xfd82('0xb'),_0x3b2dd5,_0xfd82('0xc'));logger[_0xfd82('0xd')](_0xfd82('0xe'),_0x3b2dd5,_0xfd82('0xc'),JSON[_0xfd82('0xf')](_0x2c3932));if(_0x2c3932[_0xfd82('0x10')]){if(_0x2c3932[_0xfd82('0x10')][_0xfd82('0x11')]===0x1f4){logger[_0xfd82('0x10')](_0xfd82('0xb'),_0x3b2dd5,_0x2c3932['error'][_0xfd82('0x12')]);return _0x2dc420(_0x2c3932['error'][_0xfd82('0x12')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x3b2dd5,_0x2c3932['error'][_0xfd82('0x12')]);return _0x14b14e(_0x2c3932[_0xfd82('0x10')][_0xfd82('0x12')]);}else{logger['info'](_0xfd82('0xb'),_0x3b2dd5,_0xfd82('0xc'));_0x14b14e(_0x2c3932[_0xfd82('0x13')][_0xfd82('0x12')]);}})[_0xfd82('0x14')](function(_0x58e4d6){logger['error'](_0xfd82('0xb'),_0x3b2dd5,_0x58e4d6);_0x2dc420(_0x58e4d6);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 35635c4..e01f68e 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 _0x5d4f=['Router','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','multer','connect-timeout','express'];(function(_0x159264,_0x5540de){var _0x2fd8e5=function(_0xd192fc){while(--_0xd192fc){_0x159264['push'](_0x159264['shift']());}};_0x2fd8e5(++_0x5540de);}(_0x5d4f,0x1dd));var _0xf5d4=function(_0x2c7c91,_0x4ebb5c){_0x2c7c91=_0x2c7c91-0x0;var _0x5ab590=_0x5d4f[_0x2c7c91];return _0x5ab590;};'use strict';var multer=require(_0xf5d4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf5d4('0x1'));var express=require(_0xf5d4('0x2'));var router=express[_0xf5d4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf5d4('0x4'));var config=require(_0xf5d4('0x5'));var controller=require(_0xf5d4('0x6'));router['get']('/',auth[_0xf5d4('0x7')](),controller[_0xf5d4('0x8')]);router['get'](_0xf5d4('0x9'),auth[_0xf5d4('0x7')](),controller[_0xf5d4('0xa')]);router['get'](_0xf5d4('0xb'),auth[_0xf5d4('0x7')](),controller[_0xf5d4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf5d4('0xd')]);router[_0xf5d4('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf5d4('0xf')]);router['delete'](_0xf5d4('0xb'),auth[_0xf5d4('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe592=['/:id','show','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0xe592,0x1bb));var _0x2e59=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0xe592[_0x4fe19c];return _0x952ac7;};'use strict';var multer=require(_0x2e59('0x0'));var util=require('util');var path=require(_0x2e59('0x1'));var timeout=require(_0x2e59('0x2'));var express=require(_0x2e59('0x3'));var router=express[_0x2e59('0x4')]();var auth=require(_0x2e59('0x5'));var interaction=require(_0x2e59('0x6'));var config=require(_0x2e59('0x7'));var controller=require(_0x2e59('0x8'));router[_0x2e59('0x9')]('/',auth[_0x2e59('0xa')](),controller[_0x2e59('0xb')]);router[_0x2e59('0x9')](_0x2e59('0xc'),auth[_0x2e59('0xa')](),controller['describe']);router[_0x2e59('0x9')](_0x2e59('0xd'),auth['isAuthenticated'](),controller[_0x2e59('0xe')]);router['post']('/',auth[_0x2e59('0xa')](),controller['create']);router[_0x2e59('0xf')]('/:id',auth[_0x2e59('0xa')](),controller[_0x2e59('0x10')]);router[_0x2e59('0x11')]('/:id',auth[_0x2e59('0xa')](),controller['destroy']);module[_0x2e59('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 27431f2..a764744 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 _0xcc42=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x1edfa,_0x30bb3d){var _0x47c0c1=function(_0x361120){while(--_0x361120){_0x1edfa['push'](_0x1edfa['shift']());}};_0x47c0c1(++_0x30bb3d);}(_0xcc42,0x9b));var _0x2cc4=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xcc42[_0x30cd7e];return _0x462a02;};'use strict';var Sequelize=require(_0x2cc4('0x0'));module[_0x2cc4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2cc4('0x2')],'allowNull':![],'defaultValue':_0x2cc4('0x3')},'appdata':{'type':Sequelize[_0x2cc4('0x4')]()},'description':{'type':Sequelize[_0x2cc4('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2cc4('0x5')}}; \ No newline at end of file +var _0x24e9=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0x5e653b,_0x1a2b9d){var _0x49bf56=function(_0x4fc70d){while(--_0x4fc70d){_0x5e653b['push'](_0x5e653b['shift']());}};_0x49bf56(++_0x1a2b9d);}(_0x24e9,0x144));var _0x924e=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x24e9[_0x556bb1];return _0x45455f;};'use strict';var Sequelize=require(_0x924e('0x0'));module[_0x924e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x924e('0x2')],'allowNull':![],'defaultValue':_0x924e('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x924e('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x924e('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 15a8e57..3a226d4 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 _0xe70c=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','show','params','ChatApplication','query','keys','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','update','body','catch','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x23b19d,_0x443d14){var _0x5283f6=function(_0x5d4bb2){while(--_0x5d4bb2){_0x23b19d['push'](_0x23b19d['shift']());}};_0x5283f6(++_0x443d14);}(_0xe70c,0x1a8));var _0xce70=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xe70c[_0x2b10c6];return _0x3789d2;};'use strict';var pdf=require(_0xce70('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xce70('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce70('0x2'));var rp=require(_0xce70('0x3'));var moment=require('moment');var BPromise=require(_0xce70('0x4'));var Mustache=require(_0xce70('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xce70('0x6'));var ejs=require(_0xce70('0x7'));var fs=require('fs');var _=require(_0xce70('0x8'));var squel=require(_0xce70('0x9'));var crypto=require('crypto');var jsforce=require(_0xce70('0xa'));var deskjs=require(_0xce70('0xb'));var toCsv=require(_0xce70('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce70('0xc'));var as=require(_0xce70('0xd'));var hardwareService=require(_0xce70('0xe'));var logger=require(_0xce70('0xf'))(_0xce70('0x10'));var utils=require(_0xce70('0x11'));var config=require(_0xce70('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xce70('0x13'))['db'];function respondWithStatusCode(_0x2b7b14,_0x31bb5a){_0x31bb5a=_0x31bb5a||0xcc;return function(_0x348245){if(_0x348245){return _0x2b7b14[_0xce70('0x14')](_0x31bb5a);}return _0x2b7b14[_0xce70('0x15')](_0x31bb5a)['end']();};}function respondWithResult(_0x13f84d,_0x391bc4){_0x391bc4=_0x391bc4||0xc8;return function(_0x1d2384){if(_0x1d2384){return _0x13f84d[_0xce70('0x15')](_0x391bc4)[_0xce70('0x16')](_0x1d2384);}};}function respondWithFilteredResult(_0x518944,_0x307ee4){return function(_0x3ad2ed){if(_0x3ad2ed){var _0x2c1bd0=_0x3ad2ed[_0xce70('0x17')],_0x540083=_0x307ee4['offset'],_0x40ab4f=_0x307ee4[_0xce70('0x18')]+_0x307ee4[_0xce70('0x19')],_0x1cecdf;if(_0x40ab4f>=_0x2c1bd0){_0x40ab4f=_0x2c1bd0;_0x1cecdf=0xc8;}else{_0x1cecdf=0xce;}_0x518944[_0xce70('0x15')](_0x1cecdf);return _0x518944[_0xce70('0x1a')](_0xce70('0x1b'),_0x540083+'-'+_0x40ab4f+'/'+_0x2c1bd0)['json'](_0x3ad2ed);}return null;};}function patchUpdates(_0x1e2699){return function(_0x43b0d4){try{jsonpatch[_0xce70('0x1c')](_0x43b0d4,_0x1e2699,!![]);}catch(_0x2c7f23){return BPromise[_0xce70('0x1d')](_0x2c7f23);}return _0x43b0d4[_0xce70('0x1e')]();};}function saveUpdates(_0x1cac42,_0x5743a9){return function(_0x3d814d){if(_0x3d814d){return _0x3d814d['update'](_0x1cac42)[_0xce70('0x1f')](function(_0x47a0cb){return _0x47a0cb;});}return null;};}function removeEntity(_0x3c1a61,_0x167329){return function(_0x2e68b5){if(_0x2e68b5){return _0x2e68b5[_0xce70('0x20')]()['then'](function(){_0x3c1a61[_0xce70('0x15')](0xcc)[_0xce70('0x21')]();});}};}function handleEntityNotFound(_0x3b83da,_0x579595){return function(_0x38283d){if(!_0x38283d){_0x3b83da[_0xce70('0x14')](0x194);}return _0x38283d;};}function handleError(_0x534475,_0x23ef5e){_0x23ef5e=_0x23ef5e||0x1f4;return function(_0xca4b19){logger[_0xce70('0x22')](_0xca4b19['stack']);if(_0xca4b19[_0xce70('0x23')]){delete _0xca4b19[_0xce70('0x23')];}_0x534475[_0xce70('0x15')](_0x23ef5e)[_0xce70('0x24')](_0xca4b19);};}exports[_0xce70('0x25')]=function(_0xb7c940,_0x471760){var _0x194109={'raw':!![],'where':{'id':_0xb7c940[_0xce70('0x26')]['id']}},_0x2216ee={};_0x2216ee['model']=_['keys'](db[_0xce70('0x27')]['rawAttributes']);_0x2216ee[_0xce70('0x28')]=_[_0xce70('0x29')](_0xb7c940['query']);_0x2216ee['filters']=_['intersection'](_0x2216ee[_0xce70('0x2a')],_0x2216ee[_0xce70('0x28')]);_0x194109[_0xce70('0x2b')]=_[_0xce70('0x2c')](_0x2216ee[_0xce70('0x2a')],qs['fields'](_0xb7c940[_0xce70('0x28')][_0xce70('0x2d')]));_0x194109['attributes']=_0x194109[_0xce70('0x2b')][_0xce70('0x2e')]?_0x194109['attributes']:_0x2216ee['model'];if(_0xb7c940['query'][_0xce70('0x2f')]){_0x194109[_0xce70('0x30')]=[{'all':!![]}];}_0x194109=_[_0xce70('0x31')]({},_0x194109,_0xb7c940[_0xce70('0x32')]);return db['ChatApplication'][_0xce70('0x33')](_0x194109)[_0xce70('0x1f')](handleEntityNotFound(_0x471760,null))[_0xce70('0x1f')](respondWithResult(_0x471760,null))['catch'](handleError(_0x471760,null));};exports[_0xce70('0x34')]=function(_0x361e04,_0x238975){if(_0x361e04[_0xce70('0x35')]['id']){delete _0x361e04['body']['id'];}return db[_0xce70('0x27')]['find']({'where':{'id':_0x361e04[_0xce70('0x26')]['id']}})['then'](handleEntityNotFound(_0x238975,null))[_0xce70('0x1f')](saveUpdates(_0x361e04[_0xce70('0x35')],null))['then'](respondWithResult(_0x238975,null))[_0xce70('0x36')](handleError(_0x238975,null));};exports['destroy']=function(_0x1a7646,_0x399fbb){return db[_0xce70('0x27')][_0xce70('0x33')]({'where':{'id':_0x1a7646[_0xce70('0x26')]['id']}})['then'](handleEntityNotFound(_0x399fbb,null))[_0xce70('0x1f')](removeEntity(_0x399fbb,null))['catch'](handleError(_0x399fbb,null));}; \ No newline at end of file +var _0xdee8=['model','attributes','intersection','fields','options','find','catch','body','destroy','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','then','error','stack','name','show','params','ChatApplication','rawAttributes','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdee8,0xe5));var _0x8dee=function(_0x3aabae,_0x47d2d5){_0x3aabae=_0x3aabae-0x0;var _0x31e9ed=_0xdee8[_0x3aabae];return _0x31e9ed;};'use strict';var pdf=require(_0x8dee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8dee('0x1'));var zipdir=require(_0x8dee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8dee('0x3'));var BPromise=require(_0x8dee('0x4'));var Mustache=require(_0x8dee('0x5'));var util=require(_0x8dee('0x6'));var path=require(_0x8dee('0x7'));var sox=require('sox');var csv=require(_0x8dee('0x8'));var ejs=require(_0x8dee('0x9'));var fs=require('fs');var _=require(_0x8dee('0xa'));var squel=require(_0x8dee('0xb'));var crypto=require(_0x8dee('0xc'));var jsforce=require(_0x8dee('0xd'));var deskjs=require(_0x8dee('0xe'));var toCsv=require(_0x8dee('0x8'));var querystring=require('querystring');var Papa=require(_0x8dee('0xf'));var Redis=require(_0x8dee('0x10'));var authService=require(_0x8dee('0x11'));var qs=require(_0x8dee('0x12'));var as=require(_0x8dee('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8dee('0x14'))(_0x8dee('0x15'));var utils=require(_0x8dee('0x16'));var config=require(_0x8dee('0x17'));var licenseUtil=require(_0x8dee('0x18'));var db=require(_0x8dee('0x19'))['db'];function respondWithStatusCode(_0x577430,_0x584f42){_0x584f42=_0x584f42||0xcc;return function(_0x20836e){if(_0x20836e){return _0x577430[_0x8dee('0x1a')](_0x584f42);}return _0x577430[_0x8dee('0x1b')](_0x584f42)[_0x8dee('0x1c')]();};}function respondWithResult(_0x3655f5,_0x200650){_0x200650=_0x200650||0xc8;return function(_0x546bf1){if(_0x546bf1){return _0x3655f5[_0x8dee('0x1b')](_0x200650)['json'](_0x546bf1);}};}function respondWithFilteredResult(_0x1d9e08,_0x546413){return function(_0x4cf2c3){if(_0x4cf2c3){var _0x581dc6=_0x4cf2c3[_0x8dee('0x1d')],_0x4c5c6c=_0x546413['offset'],_0xe13c19=_0x546413[_0x8dee('0x1e')]+_0x546413[_0x8dee('0x1f')],_0x1065d0;if(_0xe13c19>=_0x581dc6){_0xe13c19=_0x581dc6;_0x1065d0=0xc8;}else{_0x1065d0=0xce;}_0x1d9e08[_0x8dee('0x1b')](_0x1065d0);return _0x1d9e08[_0x8dee('0x20')]('Content-Range',_0x4c5c6c+'-'+_0xe13c19+'/'+_0x581dc6)[_0x8dee('0x21')](_0x4cf2c3);}return null;};}function patchUpdates(_0x3ff895){return function(_0xa7cea7){try{jsonpatch['apply'](_0xa7cea7,_0x3ff895,!![]);}catch(_0x4a0ba2){return BPromise[_0x8dee('0x22')](_0x4a0ba2);}return _0xa7cea7[_0x8dee('0x23')]();};}function saveUpdates(_0x1fb172,_0x1335f0){return function(_0x2117e1){if(_0x2117e1){return _0x2117e1[_0x8dee('0x24')](_0x1fb172)[_0x8dee('0x25')](function(_0xc5a3e5){return _0xc5a3e5;});}return null;};}function removeEntity(_0x5937d1,_0x5671b4){return function(_0x2e0215){if(_0x2e0215){return _0x2e0215['destroy']()[_0x8dee('0x25')](function(){_0x5937d1['status'](0xcc)[_0x8dee('0x1c')]();});}};}function handleEntityNotFound(_0x270835,_0x40d103){return function(_0x1b5a43){if(!_0x1b5a43){_0x270835[_0x8dee('0x1a')](0x194);}return _0x1b5a43;};}function handleError(_0x38d6d5,_0x546e96){_0x546e96=_0x546e96||0x1f4;return function(_0x757013){logger[_0x8dee('0x26')](_0x757013[_0x8dee('0x27')]);if(_0x757013[_0x8dee('0x28')]){delete _0x757013[_0x8dee('0x28')];}_0x38d6d5[_0x8dee('0x1b')](_0x546e96)['send'](_0x757013);};}exports[_0x8dee('0x29')]=function(_0x3230a5,_0xe316c4){var _0x7d50c5={'raw':!![],'where':{'id':_0x3230a5[_0x8dee('0x2a')]['id']}},_0x38d63a={};_0x38d63a['model']=_['keys'](db[_0x8dee('0x2b')][_0x8dee('0x2c')]);_0x38d63a[_0x8dee('0x2d')]=_['keys'](_0x3230a5[_0x8dee('0x2d')]);_0x38d63a['filters']=_['intersection'](_0x38d63a[_0x8dee('0x2e')],_0x38d63a[_0x8dee('0x2d')]);_0x7d50c5[_0x8dee('0x2f')]=_[_0x8dee('0x30')](_0x38d63a[_0x8dee('0x2e')],qs[_0x8dee('0x31')](_0x3230a5['query']['fields']));_0x7d50c5[_0x8dee('0x2f')]=_0x7d50c5[_0x8dee('0x2f')]['length']?_0x7d50c5['attributes']:_0x38d63a['model'];if(_0x3230a5[_0x8dee('0x2d')]['includeAll']){_0x7d50c5['include']=[{'all':!![]}];}_0x7d50c5=_['merge']({},_0x7d50c5,_0x3230a5[_0x8dee('0x32')]);return db['ChatApplication'][_0x8dee('0x33')](_0x7d50c5)[_0x8dee('0x25')](handleEntityNotFound(_0xe316c4,null))[_0x8dee('0x25')](respondWithResult(_0xe316c4,null))[_0x8dee('0x34')](handleError(_0xe316c4,null));};exports[_0x8dee('0x24')]=function(_0x44cdbc,_0x18e1b4){if(_0x44cdbc['body']['id']){delete _0x44cdbc[_0x8dee('0x35')]['id'];}return db[_0x8dee('0x2b')][_0x8dee('0x33')]({'where':{'id':_0x44cdbc[_0x8dee('0x2a')]['id']}})['then'](handleEntityNotFound(_0x18e1b4,null))[_0x8dee('0x25')](saveUpdates(_0x44cdbc[_0x8dee('0x35')],null))[_0x8dee('0x25')](respondWithResult(_0x18e1b4,null))[_0x8dee('0x34')](handleError(_0x18e1b4,null));};exports[_0x8dee('0x36')]=function(_0x552dca,_0x31826f){return db[_0x8dee('0x2b')][_0x8dee('0x33')]({'where':{'id':_0x552dca[_0x8dee('0x2a')]['id']}})[_0x8dee('0x25')](handleEntityNotFound(_0x31826f,null))['then'](removeEntity(_0x31826f,null))[_0x8dee('0x34')](handleError(_0x31826f,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 14a5bc2..b1a9ae9 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_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 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 e0d29f9..232cc5f 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 _0xad14=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x560c2f,_0x236d1c){var _0x398306=function(_0x45bc74){while(--_0x45bc74){_0x560c2f['push'](_0x560c2f['shift']());}};_0x398306(++_0x236d1c);}(_0xad14,0x10a));var _0x4ad1=function(_0x4914ad,_0x551a18){_0x4914ad=_0x4914ad-0x0;var _0x3cd61f=_0xad14[_0x4914ad];return _0x3cd61f;};'use strict';var _=require(_0x4ad1('0x0'));var util=require(_0x4ad1('0x1'));var moment=require(_0x4ad1('0x2'));var BPromise=require(_0x4ad1('0x3'));var rs=require(_0x4ad1('0x4'));var fs=require('fs');var Redis=require(_0x4ad1('0x5'));var db=require(_0x4ad1('0x6'))['db'];var utils=require(_0x4ad1('0x7'));var logger=require(_0x4ad1('0x8'))(_0x4ad1('0x9'));var config=require(_0x4ad1('0xa'));var jayson=require(_0x4ad1('0xb'));var client=jayson[_0x4ad1('0xc')][_0x4ad1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1bddd3,_0x548f20,_0x76c4ab){return new BPromise(function(_0x4c1315,_0x5b9850){return client[_0x4ad1('0xe')](_0x1bddd3,_0x76c4ab)[_0x4ad1('0xf')](function(_0x489b63){logger[_0x4ad1('0x10')](_0x4ad1('0x11'),_0x548f20,_0x4ad1('0x12'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x548f20,'request\x20sent',JSON[_0x4ad1('0x13')](_0x489b63));if(_0x489b63[_0x4ad1('0x14')]){if(_0x489b63[_0x4ad1('0x14')]['code']===0x1f4){logger['error'](_0x4ad1('0x11'),_0x548f20,_0x489b63[_0x4ad1('0x14')][_0x4ad1('0x15')]);return _0x5b9850(_0x489b63[_0x4ad1('0x14')]['message']);}logger[_0x4ad1('0x14')]('ChatApplication,\x20%s,\x20%s',_0x548f20,_0x489b63['error'][_0x4ad1('0x15')]);return _0x4c1315(_0x489b63[_0x4ad1('0x14')][_0x4ad1('0x15')]);}else{logger['info'](_0x4ad1('0x11'),_0x548f20,_0x4ad1('0x12'));_0x4c1315(_0x489b63[_0x4ad1('0x16')][_0x4ad1('0x15')]);}})[_0x4ad1('0x17')](function(_0x22dc6f){logger[_0x4ad1('0x14')](_0x4ad1('0x11'),_0x548f20,_0x22dc6f);_0x5b9850(_0x22dc6f);});});} \ No newline at end of file +var _0x5b6d=['ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info'];(function(_0x55db09,_0x1c4730){var _0x1d2ffe=function(_0x2aee92){while(--_0x2aee92){_0x55db09['push'](_0x55db09['shift']());}};_0x1d2ffe(++_0x1c4730);}(_0x5b6d,0xa9));var _0xd5b6=function(_0x25ada9,_0x5f0e07){_0x25ada9=_0x25ada9-0x0;var _0x59e1ab=_0x5b6d[_0x25ada9];return _0x59e1ab;};'use strict';var _=require('lodash');var util=require(_0xd5b6('0x0'));var moment=require(_0xd5b6('0x1'));var BPromise=require(_0xd5b6('0x2'));var rs=require(_0xd5b6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5b6('0x4'))['db'];var utils=require(_0xd5b6('0x5'));var logger=require(_0xd5b6('0x6'))(_0xd5b6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd5b6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e4f95,_0x3a1e43,_0x2d2eb8){return new BPromise(function(_0x168143,_0x753a48){return client['request'](_0x5e4f95,_0x2d2eb8)[_0xd5b6('0x9')](function(_0x5d9eff){logger[_0xd5b6('0xa')](_0xd5b6('0xb'),_0x3a1e43,_0xd5b6('0xc'));logger[_0xd5b6('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x3a1e43,_0xd5b6('0xc'),JSON[_0xd5b6('0xe')](_0x5d9eff));if(_0x5d9eff['error']){if(_0x5d9eff['error'][_0xd5b6('0xf')]===0x1f4){logger[_0xd5b6('0x10')](_0xd5b6('0xb'),_0x3a1e43,_0x5d9eff['error'][_0xd5b6('0x11')]);return _0x753a48(_0x5d9eff[_0xd5b6('0x10')][_0xd5b6('0x11')]);}logger['error'](_0xd5b6('0xb'),_0x3a1e43,_0x5d9eff[_0xd5b6('0x10')]['message']);return _0x168143(_0x5d9eff['error']['message']);}else{logger[_0xd5b6('0xa')](_0xd5b6('0xb'),_0x3a1e43,_0xd5b6('0xc'));_0x168143(_0x5d9eff[_0xd5b6('0x12')][_0xd5b6('0x11')]);}})[_0xd5b6('0x13')](function(_0x4c4c66){logger[_0xd5b6('0x10')]('ChatApplication,\x20%s,\x20%s',_0x3a1e43,_0x4c4c66);_0x753a48(_0x4c4c66);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 6dc5813..b403fec 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 _0xa223=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','exports','multer','util','path','Router'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0xa223,0xec));var _0x3a22=function(_0x4fdab1,_0x26cfeb){_0x4fdab1=_0x4fdab1-0x0;var _0x265935=_0xa223[_0x4fdab1];return _0x265935;};'use strict';var multer=require(_0x3a22('0x0'));var util=require(_0x3a22('0x1'));var path=require(_0x3a22('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3a22('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3a22('0x4'));var config=require(_0x3a22('0x5'));var controller=require(_0x3a22('0x6'));router[_0x3a22('0x7')](_0x3a22('0x8'),auth[_0x3a22('0x9')](),controller[_0x3a22('0xa')]);router[_0x3a22('0xb')](_0x3a22('0x8'),auth[_0x3a22('0x9')](),controller[_0x3a22('0xc')]);router['delete'](_0x3a22('0x8'),auth[_0x3a22('0x9')](),controller[_0x3a22('0xd')]);module[_0x3a22('0xe')]=router; \ No newline at end of file +var _0xbe76=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','isAuthenticated','put','update'];(function(_0x3a7650,_0x458946){var _0x136de7=function(_0x1f8037){while(--_0x1f8037){_0x3a7650['push'](_0x3a7650['shift']());}};_0x136de7(++_0x458946);}(_0xbe76,0xf3));var _0x6be7=function(_0x3b7fb0,_0x553e21){_0x3b7fb0=_0x3b7fb0-0x0;var _0x3b7fc5=_0xbe76[_0x3b7fb0];return _0x3b7fc5;};'use strict';var multer=require(_0x6be7('0x0'));var util=require(_0x6be7('0x1'));var path=require(_0x6be7('0x2'));var timeout=require(_0x6be7('0x3'));var express=require(_0x6be7('0x4'));var router=express[_0x6be7('0x5')]();var auth=require(_0x6be7('0x6'));var interaction=require(_0x6be7('0x7'));var config=require(_0x6be7('0x8'));var controller=require(_0x6be7('0x9'));router['get']('/:id',auth[_0x6be7('0xa')](),controller['show']);router[_0x6be7('0xb')]('/:id',auth[_0x6be7('0xa')](),controller[_0x6be7('0xc')]);router['delete'](_0x6be7('0xd'),auth[_0x6be7('0xa')](),controller[_0x6be7('0xe')]);module[_0x6be7('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index ceab65b..9a8de25 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 _0x73f9=['sequelize','exports','STRING','BOOLEAN'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x73f9,0xdc));var _0x973f=function(_0x7c0a21,_0x47b41b){_0x7c0a21=_0x7c0a21-0x0;var _0x4fe65a=_0x73f9[_0x7c0a21];return _0x4fe65a;};'use strict';var Sequelize=require(_0x973f('0x0'));module[_0x973f('0x1')]={'name':{'type':Sequelize[_0x973f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x973f('0x2')]},'write':{'type':Sequelize[_0x973f('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdb57=['BOOLEAN','sequelize','exports','STRING'];(function(_0x61afb4,_0x5df085){var _0x47e3ee=function(_0x580fc3){while(--_0x580fc3){_0x61afb4['push'](_0x61afb4['shift']());}};_0x47e3ee(++_0x5df085);}(_0xdb57,0x1bd));var _0x7db5=function(_0x434142,_0x6b006e){_0x434142=_0x434142-0x0;var _0x3c9b5a=_0xdb57[_0x434142];return _0x3c9b5a;};'use strict';var Sequelize=require(_0x7db5('0x0'));module[_0x7db5('0x1')]={'name':{'type':Sequelize[_0x7db5('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7db5('0x2')]},'write':{'type':Sequelize[_0x7db5('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 4ae961e..85c72b5 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 _0xafc4=['request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','limit','set','Content-Range','json','apply','reject','save','update','destroy','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','merge','where','VIRTUAL','filter','ChatGroup','count','includeAll','include','findAll','show','params','rawAttributes','options','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','pick','$gte','split','format','html-pdf','rimraf','fast-json-patch'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xafc4,0x69));var _0x4afc=function(_0x50503c,_0x4af617){_0x50503c=_0x50503c-0x0;var _0x4eeed6=_0xafc4[_0x50503c];return _0x4eeed6;};'use strict';var pdf=require(_0x4afc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4afc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4afc('0x2'));var rp=require(_0x4afc('0x3'));var moment=require(_0x4afc('0x4'));var BPromise=require(_0x4afc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4afc('0x6'));var csv=require(_0x4afc('0x7'));var ejs=require(_0x4afc('0x8'));var fs=require('fs');var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x7'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];config[_0x4afc('0x16')]=_[_0x4afc('0x17')](config[_0x4afc('0x16')],{'host':_0x4afc('0x18'),'port':0x18eb});var socket=require(_0x4afc('0x19'))(new Redis(config[_0x4afc('0x16')]));require('./chatGroup.socket')[_0x4afc('0x1a')](socket);var jayson=require(_0x4afc('0x1b'));var client=jayson[_0x4afc('0x1c')][_0x4afc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5f2dc9,_0x4e32e8,_0x2452ae,_0x4f3127){return new BPromise(function(_0x23ae30,_0x24ed6d){var _0x2b928b=_0x4f3127||client;return _0x2b928b[_0x4afc('0x1e')](_0x5f2dc9,_0x2452ae)[_0x4afc('0x1f')](function(_0x3ebdc8){logger[_0x4afc('0x20')](_0x4afc('0x21'),_0x4e32e8,_0x4afc('0x22'));logger[_0x4afc('0x23')](_0x4afc('0x24'),_0x4e32e8,'request\x20sent',JSON[_0x4afc('0x25')](_0x3ebdc8));if(_0x3ebdc8[_0x4afc('0x26')]){if(_0x3ebdc8[_0x4afc('0x26')][_0x4afc('0x27')]===0x1f4){logger['error'](_0x4afc('0x21'),_0x4e32e8,_0x3ebdc8[_0x4afc('0x26')][_0x4afc('0x28')]);return _0x24ed6d(_0x3ebdc8[_0x4afc('0x26')][_0x4afc('0x28')]);}logger[_0x4afc('0x26')](_0x4afc('0x21'),_0x4e32e8,_0x3ebdc8['error'][_0x4afc('0x28')]);return _0x23ae30(_0x3ebdc8[_0x4afc('0x26')]['message']);}else{logger[_0x4afc('0x20')]('ChatGroup,\x20%s,\x20%s',_0x4e32e8,_0x4afc('0x22'));_0x23ae30(_0x3ebdc8[_0x4afc('0x29')][_0x4afc('0x28')]);}})[_0x4afc('0x2a')](function(_0x86dbd4){logger[_0x4afc('0x26')](_0x4afc('0x21'),_0x4e32e8,_0x86dbd4);_0x24ed6d(_0x86dbd4);});});}function respondWithStatusCode(_0x383a71,_0x2bb837){_0x2bb837=_0x2bb837||0xcc;return function(_0x100220){if(_0x100220){return _0x383a71[_0x4afc('0x2b')](_0x2bb837);}return _0x383a71[_0x4afc('0x2c')](_0x2bb837)[_0x4afc('0x2d')]();};}function respondWithResult(_0x55842c,_0xc3952e){_0xc3952e=_0xc3952e||0xc8;return function(_0x244f6c){if(_0x244f6c){return _0x55842c[_0x4afc('0x2c')](_0xc3952e)['json'](_0x244f6c);}};}function respondWithFilteredResult(_0x52212d,_0x54433f){return function(_0x426e9d){if(_0x426e9d){var _0x5db47e=_0x426e9d['count'],_0x5e4747=_0x54433f['offset'],_0xd26d2f=_0x54433f['offset']+_0x54433f[_0x4afc('0x2e')],_0x628e42;if(_0xd26d2f>=_0x5db47e){_0xd26d2f=_0x5db47e;_0x628e42=0xc8;}else{_0x628e42=0xce;}_0x52212d[_0x4afc('0x2c')](_0x628e42);return _0x52212d[_0x4afc('0x2f')](_0x4afc('0x30'),_0x5e4747+'-'+_0xd26d2f+'/'+_0x5db47e)[_0x4afc('0x31')](_0x426e9d);}return null;};}function patchUpdates(_0x28cd3e){return function(_0x566389){try{jsonpatch[_0x4afc('0x32')](_0x566389,_0x28cd3e,!![]);}catch(_0x3d1693){return BPromise[_0x4afc('0x33')](_0x3d1693);}return _0x566389[_0x4afc('0x34')]();};}function saveUpdates(_0x2b115d,_0xf95893){return function(_0xbabe1e){if(_0xbabe1e){return _0xbabe1e[_0x4afc('0x35')](_0x2b115d)['then'](function(_0x1383cf){return _0x1383cf;});}return null;};}function removeEntity(_0x51660d,_0x539b61){return function(_0x324a12){if(_0x324a12){return _0x324a12[_0x4afc('0x36')]()[_0x4afc('0x1f')](function(){_0x51660d[_0x4afc('0x2c')](0xcc)[_0x4afc('0x2d')]();});}};}function handleEntityNotFound(_0x3f50cc,_0x523520){return function(_0x380f9f){if(!_0x380f9f){_0x3f50cc[_0x4afc('0x2b')](0x194);}return _0x380f9f;};}function handleError(_0x111dbf,_0x127ac8){_0x127ac8=_0x127ac8||0x1f4;return function(_0x3127e6){logger[_0x4afc('0x26')](_0x3127e6['stack']);if(_0x3127e6[_0x4afc('0x37')]){delete _0x3127e6[_0x4afc('0x37')];}_0x111dbf[_0x4afc('0x2c')](_0x127ac8)[_0x4afc('0x38')](_0x3127e6);};}exports['index']=function(_0x4be1e6,_0x43c341){var _0x22bd75={},_0x17ea03={},_0x5edfe1={'count':0x0,'rows':[]};var _0x5790a2=_[_0x4afc('0x39')](db['ChatGroup']['rawAttributes'],function(_0x295b53){return{'name':_0x295b53[_0x4afc('0x3a')],'type':_0x295b53[_0x4afc('0x3b')][_0x4afc('0x3c')]};});_0x17ea03[_0x4afc('0x3d')]=_[_0x4afc('0x39')](_0x5790a2,_0x4afc('0x37'));_0x17ea03[_0x4afc('0x3e')]=_[_0x4afc('0x3f')](_0x4be1e6[_0x4afc('0x3e')]);_0x17ea03[_0x4afc('0x40')]=_[_0x4afc('0x41')](_0x17ea03[_0x4afc('0x3d')],_0x17ea03[_0x4afc('0x3e')]);_0x22bd75[_0x4afc('0x42')]=_['intersection'](_0x17ea03[_0x4afc('0x3d')],qs[_0x4afc('0x43')](_0x4be1e6[_0x4afc('0x3e')][_0x4afc('0x43')]));_0x22bd75[_0x4afc('0x42')]=_0x22bd75[_0x4afc('0x42')][_0x4afc('0x44')]?_0x22bd75['attributes']:_0x17ea03['model'];if(!_0x4be1e6['query'][_0x4afc('0x45')](_0x4afc('0x46'))){_0x22bd75['limit']=qs[_0x4afc('0x2e')](_0x4be1e6[_0x4afc('0x3e')][_0x4afc('0x2e')]);_0x22bd75[_0x4afc('0x47')]=qs['offset'](_0x4be1e6[_0x4afc('0x3e')][_0x4afc('0x47')]);}_0x22bd75[_0x4afc('0x48')]=qs[_0x4afc('0x49')](_0x4be1e6[_0x4afc('0x3e')][_0x4afc('0x49')]);_0x22bd75['where']=qs[_0x4afc('0x40')](_['pick'](_0x4be1e6[_0x4afc('0x3e')],_0x17ea03[_0x4afc('0x40')]),_0x5790a2);if(_0x4be1e6[_0x4afc('0x3e')]['filter']){_0x22bd75['where']=_[_0x4afc('0x4a')](_0x22bd75[_0x4afc('0x4b')],{'$or':_[_0x4afc('0x39')](_0x5790a2,function(_0x12e97d){if(_0x12e97d[_0x4afc('0x3b')]!==_0x4afc('0x4c')){var _0x42ecb6={};_0x42ecb6[_0x12e97d[_0x4afc('0x37')]]={'$like':'%'+_0x4be1e6['query'][_0x4afc('0x4d')]+'%'};return _0x42ecb6;}})});}_0x22bd75=_[_0x4afc('0x4a')]({},_0x22bd75,_0x4be1e6['options']);var _0x1f2604={'where':_0x22bd75['where']};return db[_0x4afc('0x4e')][_0x4afc('0x4f')](_0x1f2604)[_0x4afc('0x1f')](function(_0x5e0ebd){_0x5edfe1[_0x4afc('0x4f')]=_0x5e0ebd;if(_0x4be1e6[_0x4afc('0x3e')][_0x4afc('0x50')]){_0x22bd75[_0x4afc('0x51')]=[{'all':!![]}];}return db[_0x4afc('0x4e')][_0x4afc('0x52')](_0x22bd75);})['then'](function(_0x4e470d){_0x5edfe1['rows']=_0x4e470d;return _0x5edfe1;})[_0x4afc('0x1f')](respondWithFilteredResult(_0x43c341,_0x22bd75))[_0x4afc('0x2a')](handleError(_0x43c341,null));};exports[_0x4afc('0x53')]=function(_0x269c24,_0xb5cca9){var _0x122cbc={'raw':!![],'where':{'id':_0x269c24[_0x4afc('0x54')]['id']}},_0x22e8b0={};_0x22e8b0[_0x4afc('0x3d')]=_[_0x4afc('0x3f')](db['ChatGroup'][_0x4afc('0x55')]);_0x22e8b0['query']=_['keys'](_0x269c24[_0x4afc('0x3e')]);_0x22e8b0['filters']=_[_0x4afc('0x41')](_0x22e8b0[_0x4afc('0x3d')],_0x22e8b0[_0x4afc('0x3e')]);_0x122cbc[_0x4afc('0x42')]=_['intersection'](_0x22e8b0[_0x4afc('0x3d')],qs['fields'](_0x269c24[_0x4afc('0x3e')][_0x4afc('0x43')]));_0x122cbc[_0x4afc('0x42')]=_0x122cbc[_0x4afc('0x42')][_0x4afc('0x44')]?_0x122cbc[_0x4afc('0x42')]:_0x22e8b0[_0x4afc('0x3d')];if(_0x269c24[_0x4afc('0x3e')][_0x4afc('0x50')]){_0x122cbc[_0x4afc('0x51')]=[{'all':!![]}];}_0x122cbc=_[_0x4afc('0x4a')]({},_0x122cbc,_0x269c24[_0x4afc('0x56')]);return db['ChatGroup'][_0x4afc('0x57')](_0x122cbc)[_0x4afc('0x1f')](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x1f')](respondWithResult(_0xb5cca9,null))[_0x4afc('0x2a')](handleError(_0xb5cca9,null));};exports[_0x4afc('0x58')]=function(_0x285c25,_0x2fd538){return db[_0x4afc('0x4e')][_0x4afc('0x58')](_0x285c25[_0x4afc('0x59')],{})[_0x4afc('0x1f')](respondWithResult(_0x2fd538,0xc9))[_0x4afc('0x2a')](handleError(_0x2fd538,null));};exports[_0x4afc('0x35')]=function(_0x5c1421,_0x2abf25){if(_0x5c1421['body']['id']){delete _0x5c1421[_0x4afc('0x59')]['id'];}return db[_0x4afc('0x4e')][_0x4afc('0x57')]({'where':{'id':_0x5c1421[_0x4afc('0x54')]['id']}})['then'](handleEntityNotFound(_0x2abf25,null))['then'](saveUpdates(_0x5c1421[_0x4afc('0x59')],null))[_0x4afc('0x1f')](respondWithResult(_0x2abf25,null))['catch'](handleError(_0x2abf25,null));};exports[_0x4afc('0x36')]=function(_0x3af52c,_0xb1c023){return db[_0x4afc('0x4e')][_0x4afc('0x57')]({'where':{'id':_0x3af52c[_0x4afc('0x54')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0xb1c023,null))[_0x4afc('0x1f')](removeEntity(_0xb1c023,null))[_0x4afc('0x2a')](handleError(_0xb1c023,null));};exports[_0x4afc('0x5a')]=function(_0x4295a5,_0x1a4d15){return db[_0x4afc('0x4e')][_0x4afc('0x5a')]()['then'](respondWithResult(_0x1a4d15,null))[_0x4afc('0x2a')](handleError(_0x1a4d15,null));};exports[_0x4afc('0x5b')]=function(_0x2d1d06,_0x19cb0b,_0x16cff0){return db[_0x4afc('0x5c')][_0x4afc('0x4f')]({'where':{'ChatGroupId':_0x2d1d06['params']['id'],'ToId':_0x2d1d06[_0x4afc('0x5d')]['id'],'read':![]}})[_0x4afc('0x1f')](function(_0x543dce){return{'id':_['toInteger'](_0x2d1d06[_0x4afc('0x54')]['id']),'count':_0x543dce};})[_0x4afc('0x1f')](respondWithResult(_0x19cb0b,null))[_0x4afc('0x2a')](handleError(_0x19cb0b,null));};exports[_0x4afc('0x5e')]=function(_0x258fed,_0x193850,_0x37cfa6){return db[_0x4afc('0x4e')][_0x4afc('0x57')]({'where':{'id':_0x258fed[_0x4afc('0x54')]['id']}})['then'](handleEntityNotFound(_0x193850,null))['then'](function(_0x458533){if(_0x458533){return _0x458533[_0x4afc('0x5e')](_0x258fed['body'][_0x4afc('0x5f')],_[_0x4afc('0x60')](_0x258fed['body'],['ids','id'])||{});}})[_0x4afc('0x1f')](respondWithResult(_0x193850,null))[_0x4afc('0x2a')](handleError(_0x193850,null));};exports[_0x4afc('0x61')]=function(_0x53792a,_0x3875f8,_0x4a9df1){var _0x5a2be2={};var _0x10e5c6={};var _0x37b5aa;var _0x53f9ca;return db[_0x4afc('0x4e')][_0x4afc('0x62')]({'where':{'id':_0x53792a[_0x4afc('0x54')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x3875f8,null))[_0x4afc('0x1f')](function(_0x3d1825){if(_0x3d1825){_0x37b5aa=_0x3d1825;_0x10e5c6['model']=_[_0x4afc('0x3f')](db[_0x4afc('0x63')][_0x4afc('0x55')]);_0x10e5c6['query']=_['keys'](_0x53792a['query']);_0x10e5c6[_0x4afc('0x40')]=_[_0x4afc('0x41')](_0x10e5c6[_0x4afc('0x3d')],_0x10e5c6['query']);_0x5a2be2[_0x4afc('0x42')]=_['intersection'](_0x10e5c6['model'],qs['fields'](_0x53792a[_0x4afc('0x3e')][_0x4afc('0x43')]));_0x5a2be2[_0x4afc('0x42')]=_0x5a2be2['attributes'][_0x4afc('0x44')]?_0x5a2be2[_0x4afc('0x42')]:_0x10e5c6[_0x4afc('0x3d')];_0x5a2be2['order']=qs[_0x4afc('0x49')](_0x53792a[_0x4afc('0x3e')][_0x4afc('0x49')]);_0x5a2be2[_0x4afc('0x4b')]=qs[_0x4afc('0x40')](_['pick'](_0x53792a['query'],_0x10e5c6[_0x4afc('0x40')]));if(_0x53792a[_0x4afc('0x3e')][_0x4afc('0x4d')]){_0x5a2be2['where']=_[_0x4afc('0x4a')](_0x5a2be2[_0x4afc('0x4b')],{'$or':_[_0x4afc('0x39')](_0x5a2be2[_0x4afc('0x42')],function(_0x3a7a19){var _0x4bc6e5={};_0x4bc6e5[_0x3a7a19]={'$like':'%'+_0x53792a[_0x4afc('0x3e')][_0x4afc('0x4d')]+'%'};return _0x4bc6e5;})});}_0x5a2be2=_['merge']({},_0x5a2be2,_0x53792a[_0x4afc('0x56')]);return _0x37b5aa[_0x4afc('0x61')](_0x5a2be2);}})[_0x4afc('0x1f')](function(_0x4ca3e8){if(_0x4ca3e8){_0x53f9ca=_0x4ca3e8[_0x4afc('0x44')];if(!_0x53792a[_0x4afc('0x3e')][_0x4afc('0x45')](_0x4afc('0x46'))){_0x5a2be2[_0x4afc('0x2e')]=qs[_0x4afc('0x2e')](_0x53792a[_0x4afc('0x3e')][_0x4afc('0x2e')]);_0x5a2be2['offset']=qs[_0x4afc('0x47')](_0x53792a['query']['offset']);}return _0x37b5aa[_0x4afc('0x61')](_0x5a2be2);}})[_0x4afc('0x1f')](function(_0x1354f1){if(_0x1354f1){return _0x1354f1?{'count':_0x53f9ca,'rows':_0x1354f1}:null;}})['then'](respondWithResult(_0x3875f8,null))['catch'](handleError(_0x3875f8,null));};exports[_0x4afc('0x64')]=function(_0x222e68,_0xa3f8b7,_0xb34abf){return db[_0x4afc('0x4e')][_0x4afc('0x57')]({'where':{'id':_0x222e68[_0x4afc('0x54')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0xa3f8b7,null))[_0x4afc('0x1f')](function(_0x396cb5){if(_0x396cb5){return _0x396cb5[_0x4afc('0x64')](_0x222e68[_0x4afc('0x3e')][_0x4afc('0x5f')]);}})[_0x4afc('0x1f')](respondWithStatusCode(_0xa3f8b7,null))[_0x4afc('0x2a')](handleError(_0xa3f8b7,null));};exports[_0x4afc('0x65')]=function(_0x4f8b24,_0x2d7d36,_0x33eeb0){if(_0x4f8b24[_0x4afc('0x59')]['id']){delete _0x4f8b24[_0x4afc('0x59')]['id'];}return db[_0x4afc('0x4e')][_0x4afc('0x57')]({'where':{'id':_0x4f8b24[_0x4afc('0x54')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x2d7d36,null))[_0x4afc('0x1f')](function(_0x4d3da7){if(_0x4d3da7){_0x4f8b24[_0x4afc('0x59')][_0x4afc('0x66')]=_0x4d3da7['id'];return db[_0x4afc('0x5c')][_0x4afc('0x58')](_0x4f8b24['body']);}})[_0x4afc('0x1f')](respondWithResult(_0x2d7d36,null))[_0x4afc('0x2a')](handleError(_0x2d7d36,null));};exports[_0x4afc('0x67')]=function(_0x4956b2,_0x46fe52,_0x96f84d){var _0x248f10={};var _0xf9b232={};var _0x253d25;var _0x2b20ad;return db['ChatGroup'][_0x4afc('0x62')]({'where':{'id':_0x4956b2[_0x4afc('0x54')]['id']}})['then'](handleEntityNotFound(_0x46fe52,null))[_0x4afc('0x1f')](function(_0x41a3a9){if(_0x41a3a9){_0x253d25=_0x41a3a9;_0xf9b232[_0x4afc('0x3d')]=_['keys'](db[_0x4afc('0x5c')][_0x4afc('0x55')]);_0xf9b232[_0x4afc('0x3e')]=_[_0x4afc('0x3f')](_0x4956b2['query']);_0xf9b232[_0x4afc('0x40')]=_[_0x4afc('0x41')](_0xf9b232['model'],_0xf9b232[_0x4afc('0x3e')]);_0x248f10[_0x4afc('0x42')]=_[_0x4afc('0x41')](_0xf9b232['model'],qs['fields'](_0x4956b2[_0x4afc('0x3e')][_0x4afc('0x43')]));_0x248f10[_0x4afc('0x42')]=_0x248f10[_0x4afc('0x42')][_0x4afc('0x44')]?_0x248f10[_0x4afc('0x42')]:_0xf9b232[_0x4afc('0x3d')];_0x248f10[_0x4afc('0x48')]=qs[_0x4afc('0x49')](_0x4956b2[_0x4afc('0x3e')][_0x4afc('0x49')]);_0x248f10[_0x4afc('0x4b')]=qs[_0x4afc('0x40')](_[_0x4afc('0x68')](_0x4956b2[_0x4afc('0x3e')],_0xf9b232[_0x4afc('0x40')]));if(_0x4956b2['query'][_0x4afc('0x4d')]){_0x248f10[_0x4afc('0x4b')]=_['merge'](_0x248f10[_0x4afc('0x4b')],{'$or':_['map'](_0x248f10['attributes'],function(_0x6ac9ae){var _0x4ae14b={};_0x4ae14b[_0x6ac9ae]={'$like':'%'+_0x4956b2['query'][_0x4afc('0x4d')]+'%'};return _0x4ae14b;})});}if(_0x4956b2['query'][_0x4afc('0x69')]){var _0x492301=_0x4956b2[_0x4afc('0x3e')][_0x4afc('0x69')][_0x4afc('0x6a')](',');var _0x40536f={};_0x40536f[_0x492301[0x0]]={'$gte':moment(_0x492301[0x1])[_0x4afc('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x248f10[_0x4afc('0x4b')]=_[_0x4afc('0x4a')](_0x248f10['where'],_0x40536f);}_0x248f10=_['merge']({},_0x248f10,_0x4956b2[_0x4afc('0x56')]);return _0x253d25[_0x4afc('0x67')](_0x248f10);}})[_0x4afc('0x1f')](function(_0x115121){if(_0x115121){_0x2b20ad=_0x115121[_0x4afc('0x44')];if(!_0x4956b2['query'][_0x4afc('0x45')](_0x4afc('0x46'))){_0x248f10[_0x4afc('0x2e')]=qs[_0x4afc('0x2e')](_0x4956b2['query'][_0x4afc('0x2e')]);_0x248f10['offset']=qs[_0x4afc('0x47')](_0x4956b2[_0x4afc('0x3e')][_0x4afc('0x47')]);}return _0x253d25[_0x4afc('0x67')](_0x248f10);}})[_0x4afc('0x1f')](function(_0x29c8aa){if(_0x29c8aa){return _0x29c8aa?{'count':_0x2b20ad,'rows':_0x29c8aa}:null;}})[_0x4afc('0x1f')](respondWithResult(_0x46fe52,null))[_0x4afc('0x2a')](handleError(_0x46fe52,null));}; \ No newline at end of file +var _0xa32b=['findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','jayson/promise','client','http','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','stack','name','send','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','length','create','body','find','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','User','removeMembers','addMessage','ChatGroupId'];(function(_0x4fbfcf,_0x1d5691){var _0x1af765=function(_0x3ab535){while(--_0x3ab535){_0x4fbfcf['push'](_0x4fbfcf['shift']());}};_0x1af765(++_0x1d5691);}(_0xa32b,0x68));var _0xba32=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0xa32b[_0x2525f1];return _0x13c1b5;};'use strict';var pdf=require(_0xba32('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xba32('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xba32('0x2'));var moment=require(_0xba32('0x3'));var BPromise=require(_0xba32('0x4'));var Mustache=require('mustache');var util=require(_0xba32('0x5'));var path=require(_0xba32('0x6'));var sox=require(_0xba32('0x7'));var csv=require(_0xba32('0x8'));var ejs=require(_0xba32('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xba32('0xa'));var crypto=require('crypto');var jsforce=require(_0xba32('0xb'));var deskjs=require(_0xba32('0xc'));var toCsv=require(_0xba32('0x8'));var querystring=require(_0xba32('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xba32('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba32('0xf'))('api');var utils=require(_0xba32('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xba32('0x11'))['db'];config[_0xba32('0x12')]=_[_0xba32('0x13')](config[_0xba32('0x12')],{'host':_0xba32('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba32('0x12')]));require(_0xba32('0x15'))[_0xba32('0x16')](socket);var jayson=require(_0xba32('0x17'));var client=jayson[_0xba32('0x18')][_0xba32('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x11d280,_0x5c0bd8,_0x176763,_0x22c2be){return new BPromise(function(_0x3d3ebe,_0xd8e067){var _0x310dee=_0x22c2be||client;return _0x310dee['request'](_0x11d280,_0x176763)['then'](function(_0x56ea88){logger['info'](_0xba32('0x1a'),_0x5c0bd8,_0xba32('0x1b'));logger[_0xba32('0x1c')](_0xba32('0x1d'),_0x5c0bd8,_0xba32('0x1b'),JSON[_0xba32('0x1e')](_0x56ea88));if(_0x56ea88['error']){if(_0x56ea88['error']['code']===0x1f4){logger[_0xba32('0x1f')]('ChatGroup,\x20%s,\x20%s',_0x5c0bd8,_0x56ea88[_0xba32('0x1f')][_0xba32('0x20')]);return _0xd8e067(_0x56ea88[_0xba32('0x1f')][_0xba32('0x20')]);}logger[_0xba32('0x1f')](_0xba32('0x1a'),_0x5c0bd8,_0x56ea88[_0xba32('0x1f')]['message']);return _0x3d3ebe(_0x56ea88[_0xba32('0x1f')][_0xba32('0x20')]);}else{logger[_0xba32('0x21')](_0xba32('0x1a'),_0x5c0bd8,'request\x20sent');_0x3d3ebe(_0x56ea88['result'][_0xba32('0x20')]);}})[_0xba32('0x22')](function(_0x4cfd59){logger[_0xba32('0x1f')]('ChatGroup,\x20%s,\x20%s',_0x5c0bd8,_0x4cfd59);_0xd8e067(_0x4cfd59);});});}function respondWithStatusCode(_0x37ade0,_0x18f0c8){_0x18f0c8=_0x18f0c8||0xcc;return function(_0x3c8b78){if(_0x3c8b78){return _0x37ade0[_0xba32('0x23')](_0x18f0c8);}return _0x37ade0[_0xba32('0x24')](_0x18f0c8)[_0xba32('0x25')]();};}function respondWithResult(_0x2ebb91,_0x54d03d){_0x54d03d=_0x54d03d||0xc8;return function(_0x1e470){if(_0x1e470){return _0x2ebb91[_0xba32('0x24')](_0x54d03d)[_0xba32('0x26')](_0x1e470);}};}function respondWithFilteredResult(_0x26c724,_0x3a932f){return function(_0x168206){if(_0x168206){var _0x27bc6f=_0x168206[_0xba32('0x27')],_0xd00fcd=_0x3a932f[_0xba32('0x28')],_0x1ef5ed=_0x3a932f[_0xba32('0x28')]+_0x3a932f[_0xba32('0x29')],_0x5dbba9;if(_0x1ef5ed>=_0x27bc6f){_0x1ef5ed=_0x27bc6f;_0x5dbba9=0xc8;}else{_0x5dbba9=0xce;}_0x26c724[_0xba32('0x24')](_0x5dbba9);return _0x26c724['set'](_0xba32('0x2a'),_0xd00fcd+'-'+_0x1ef5ed+'/'+_0x27bc6f)['json'](_0x168206);}return null;};}function patchUpdates(_0x2f0796){return function(_0x39bf24){try{jsonpatch['apply'](_0x39bf24,_0x2f0796,!![]);}catch(_0x198161){return BPromise[_0xba32('0x2b')](_0x198161);}return _0x39bf24[_0xba32('0x2c')]();};}function saveUpdates(_0x42cf37,_0x48d819){return function(_0x197325){if(_0x197325){return _0x197325[_0xba32('0x2d')](_0x42cf37)['then'](function(_0x44fdf7){return _0x44fdf7;});}return null;};}function removeEntity(_0x3cfff3,_0x178f36){return function(_0x10735b){if(_0x10735b){return _0x10735b['destroy']()[_0xba32('0x2e')](function(){_0x3cfff3['status'](0xcc)[_0xba32('0x25')]();});}};}function handleEntityNotFound(_0x2a75bc,_0x350ac7){return function(_0x4a33e2){if(!_0x4a33e2){_0x2a75bc[_0xba32('0x23')](0x194);}return _0x4a33e2;};}function handleError(_0xccc14d,_0x5a3903){_0x5a3903=_0x5a3903||0x1f4;return function(_0x110684){logger[_0xba32('0x1f')](_0x110684[_0xba32('0x2f')]);if(_0x110684[_0xba32('0x30')]){delete _0x110684['name'];}_0xccc14d['status'](_0x5a3903)[_0xba32('0x31')](_0x110684);};}exports['index']=function(_0x1958d5,_0x9cb405){var _0x219b40={},_0x1d27f3={},_0x5f2bb6={'count':0x0,'rows':[]};var _0x45a55d=_[_0xba32('0x32')](db[_0xba32('0x33')][_0xba32('0x34')],function(_0x557b5c){return{'name':_0x557b5c['fieldName'],'type':_0x557b5c[_0xba32('0x35')][_0xba32('0x36')]};});_0x1d27f3[_0xba32('0x37')]=_[_0xba32('0x32')](_0x45a55d,_0xba32('0x30'));_0x1d27f3[_0xba32('0x38')]=_[_0xba32('0x39')](_0x1958d5[_0xba32('0x38')]);_0x1d27f3[_0xba32('0x3a')]=_[_0xba32('0x3b')](_0x1d27f3[_0xba32('0x37')],_0x1d27f3['query']);_0x219b40[_0xba32('0x3c')]=_[_0xba32('0x3b')](_0x1d27f3[_0xba32('0x37')],qs[_0xba32('0x3d')](_0x1958d5['query'][_0xba32('0x3d')]));_0x219b40['attributes']=_0x219b40[_0xba32('0x3c')]['length']?_0x219b40[_0xba32('0x3c')]:_0x1d27f3[_0xba32('0x37')];if(!_0x1958d5[_0xba32('0x38')][_0xba32('0x3e')](_0xba32('0x3f'))){_0x219b40[_0xba32('0x29')]=qs['limit'](_0x1958d5[_0xba32('0x38')]['limit']);_0x219b40[_0xba32('0x28')]=qs[_0xba32('0x28')](_0x1958d5[_0xba32('0x38')]['offset']);}_0x219b40[_0xba32('0x40')]=qs[_0xba32('0x41')](_0x1958d5['query'][_0xba32('0x41')]);_0x219b40[_0xba32('0x42')]=qs[_0xba32('0x3a')](_['pick'](_0x1958d5[_0xba32('0x38')],_0x1d27f3[_0xba32('0x3a')]),_0x45a55d);if(_0x1958d5['query'][_0xba32('0x43')]){_0x219b40[_0xba32('0x42')]=_[_0xba32('0x44')](_0x219b40[_0xba32('0x42')],{'$or':_['map'](_0x45a55d,function(_0x7cd2e0){if(_0x7cd2e0[_0xba32('0x35')]!=='VIRTUAL'){var _0x32566d={};_0x32566d[_0x7cd2e0[_0xba32('0x30')]]={'$like':'%'+_0x1958d5['query'][_0xba32('0x43')]+'%'};return _0x32566d;}})});}_0x219b40=_['merge']({},_0x219b40,_0x1958d5[_0xba32('0x45')]);var _0x194147={'where':_0x219b40[_0xba32('0x42')]};return db[_0xba32('0x33')][_0xba32('0x27')](_0x194147)[_0xba32('0x2e')](function(_0x4be0e5){_0x5f2bb6[_0xba32('0x27')]=_0x4be0e5;if(_0x1958d5[_0xba32('0x38')][_0xba32('0x46')]){_0x219b40[_0xba32('0x47')]=[{'all':!![]}];}return db[_0xba32('0x33')]['findAll'](_0x219b40);})[_0xba32('0x2e')](function(_0x21032f){_0x5f2bb6[_0xba32('0x48')]=_0x21032f;return _0x5f2bb6;})['then'](respondWithFilteredResult(_0x9cb405,_0x219b40))['catch'](handleError(_0x9cb405,null));};exports[_0xba32('0x49')]=function(_0xc8624,_0x58309d){var _0x57a618={'raw':!![],'where':{'id':_0xc8624[_0xba32('0x4a')]['id']}},_0x3adc2d={};_0x3adc2d[_0xba32('0x37')]=_['keys'](db['ChatGroup'][_0xba32('0x34')]);_0x3adc2d[_0xba32('0x38')]=_[_0xba32('0x39')](_0xc8624[_0xba32('0x38')]);_0x3adc2d['filters']=_[_0xba32('0x3b')](_0x3adc2d[_0xba32('0x37')],_0x3adc2d[_0xba32('0x38')]);_0x57a618[_0xba32('0x3c')]=_['intersection'](_0x3adc2d[_0xba32('0x37')],qs[_0xba32('0x3d')](_0xc8624[_0xba32('0x38')][_0xba32('0x3d')]));_0x57a618['attributes']=_0x57a618[_0xba32('0x3c')][_0xba32('0x4b')]?_0x57a618[_0xba32('0x3c')]:_0x3adc2d[_0xba32('0x37')];if(_0xc8624[_0xba32('0x38')]['includeAll']){_0x57a618[_0xba32('0x47')]=[{'all':!![]}];}_0x57a618=_[_0xba32('0x44')]({},_0x57a618,_0xc8624[_0xba32('0x45')]);return db[_0xba32('0x33')]['find'](_0x57a618)[_0xba32('0x2e')](handleEntityNotFound(_0x58309d,null))[_0xba32('0x2e')](respondWithResult(_0x58309d,null))[_0xba32('0x22')](handleError(_0x58309d,null));};exports[_0xba32('0x4c')]=function(_0x5b673d,_0x59a4d1){return db[_0xba32('0x33')][_0xba32('0x4c')](_0x5b673d[_0xba32('0x4d')],{})[_0xba32('0x2e')](respondWithResult(_0x59a4d1,0xc9))[_0xba32('0x22')](handleError(_0x59a4d1,null));};exports['update']=function(_0x2a901d,_0xb4623d){if(_0x2a901d[_0xba32('0x4d')]['id']){delete _0x2a901d[_0xba32('0x4d')]['id'];}return db['ChatGroup'][_0xba32('0x4e')]({'where':{'id':_0x2a901d[_0xba32('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb4623d,null))[_0xba32('0x2e')](saveUpdates(_0x2a901d['body'],null))['then'](respondWithResult(_0xb4623d,null))[_0xba32('0x22')](handleError(_0xb4623d,null));};exports[_0xba32('0x4f')]=function(_0x1d0302,_0x4afe1e){return db[_0xba32('0x33')][_0xba32('0x4e')]({'where':{'id':_0x1d0302[_0xba32('0x4a')]['id']}})[_0xba32('0x2e')](handleEntityNotFound(_0x4afe1e,null))[_0xba32('0x2e')](removeEntity(_0x4afe1e,null))['catch'](handleError(_0x4afe1e,null));};exports[_0xba32('0x50')]=function(_0x553b97,_0x9217c5){return db[_0xba32('0x33')][_0xba32('0x50')]()[_0xba32('0x2e')](respondWithResult(_0x9217c5,null))[_0xba32('0x22')](handleError(_0x9217c5,null));};exports[_0xba32('0x51')]=function(_0x138eb1,_0x3f4c95,_0x3d8d18){return db[_0xba32('0x52')][_0xba32('0x27')]({'where':{'ChatGroupId':_0x138eb1[_0xba32('0x4a')]['id'],'ToId':_0x138eb1[_0xba32('0x53')]['id'],'read':![]}})[_0xba32('0x2e')](function(_0x2eef2d){return{'id':_[_0xba32('0x54')](_0x138eb1['params']['id']),'count':_0x2eef2d};})['then'](respondWithResult(_0x3f4c95,null))[_0xba32('0x22')](handleError(_0x3f4c95,null));};exports[_0xba32('0x55')]=function(_0x23cb82,_0x1f12dd,_0x460348){return db[_0xba32('0x33')][_0xba32('0x4e')]({'where':{'id':_0x23cb82['params']['id']}})[_0xba32('0x2e')](handleEntityNotFound(_0x1f12dd,null))[_0xba32('0x2e')](function(_0x3e591f){if(_0x3e591f){return _0x3e591f[_0xba32('0x55')](_0x23cb82[_0xba32('0x4d')][_0xba32('0x56')],_['omit'](_0x23cb82[_0xba32('0x4d')],[_0xba32('0x56'),'id'])||{});}})[_0xba32('0x2e')](respondWithResult(_0x1f12dd,null))['catch'](handleError(_0x1f12dd,null));};exports[_0xba32('0x57')]=function(_0x543d2f,_0x1a1175,_0x4fe383){var _0x5d62de={};var _0x429ae8={};var _0x4046a3;var _0x5341e3;return db[_0xba32('0x33')]['findOne']({'where':{'id':_0x543d2f[_0xba32('0x4a')]['id']}})[_0xba32('0x2e')](handleEntityNotFound(_0x1a1175,null))[_0xba32('0x2e')](function(_0x4096c7){if(_0x4096c7){_0x4046a3=_0x4096c7;_0x429ae8[_0xba32('0x37')]=_[_0xba32('0x39')](db[_0xba32('0x58')][_0xba32('0x34')]);_0x429ae8[_0xba32('0x38')]=_[_0xba32('0x39')](_0x543d2f[_0xba32('0x38')]);_0x429ae8[_0xba32('0x3a')]=_[_0xba32('0x3b')](_0x429ae8[_0xba32('0x37')],_0x429ae8[_0xba32('0x38')]);_0x5d62de['attributes']=_[_0xba32('0x3b')](_0x429ae8[_0xba32('0x37')],qs[_0xba32('0x3d')](_0x543d2f[_0xba32('0x38')][_0xba32('0x3d')]));_0x5d62de[_0xba32('0x3c')]=_0x5d62de[_0xba32('0x3c')]['length']?_0x5d62de[_0xba32('0x3c')]:_0x429ae8[_0xba32('0x37')];_0x5d62de[_0xba32('0x40')]=qs[_0xba32('0x41')](_0x543d2f['query'][_0xba32('0x41')]);_0x5d62de[_0xba32('0x42')]=qs['filters'](_['pick'](_0x543d2f[_0xba32('0x38')],_0x429ae8[_0xba32('0x3a')]));if(_0x543d2f[_0xba32('0x38')][_0xba32('0x43')]){_0x5d62de[_0xba32('0x42')]=_[_0xba32('0x44')](_0x5d62de[_0xba32('0x42')],{'$or':_[_0xba32('0x32')](_0x5d62de[_0xba32('0x3c')],function(_0x4bc77f){var _0x24d281={};_0x24d281[_0x4bc77f]={'$like':'%'+_0x543d2f[_0xba32('0x38')][_0xba32('0x43')]+'%'};return _0x24d281;})});}_0x5d62de=_[_0xba32('0x44')]({},_0x5d62de,_0x543d2f['options']);return _0x4046a3['getMembers'](_0x5d62de);}})[_0xba32('0x2e')](function(_0xec94d4){if(_0xec94d4){_0x5341e3=_0xec94d4[_0xba32('0x4b')];if(!_0x543d2f[_0xba32('0x38')]['hasOwnProperty'](_0xba32('0x3f'))){_0x5d62de['limit']=qs['limit'](_0x543d2f[_0xba32('0x38')]['limit']);_0x5d62de[_0xba32('0x28')]=qs[_0xba32('0x28')](_0x543d2f[_0xba32('0x38')][_0xba32('0x28')]);}return _0x4046a3[_0xba32('0x57')](_0x5d62de);}})[_0xba32('0x2e')](function(_0x3066ed){if(_0x3066ed){return _0x3066ed?{'count':_0x5341e3,'rows':_0x3066ed}:null;}})['then'](respondWithResult(_0x1a1175,null))[_0xba32('0x22')](handleError(_0x1a1175,null));};exports[_0xba32('0x59')]=function(_0x55c233,_0x89096c,_0x43de06){return db[_0xba32('0x33')]['find']({'where':{'id':_0x55c233[_0xba32('0x4a')]['id']}})['then'](handleEntityNotFound(_0x89096c,null))['then'](function(_0x480df6){if(_0x480df6){return _0x480df6[_0xba32('0x59')](_0x55c233[_0xba32('0x38')][_0xba32('0x56')]);}})[_0xba32('0x2e')](respondWithStatusCode(_0x89096c,null))[_0xba32('0x22')](handleError(_0x89096c,null));};exports[_0xba32('0x5a')]=function(_0x425a2c,_0x1ff865,_0xf60750){if(_0x425a2c['body']['id']){delete _0x425a2c[_0xba32('0x4d')]['id'];}return db[_0xba32('0x33')][_0xba32('0x4e')]({'where':{'id':_0x425a2c[_0xba32('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ff865,null))['then'](function(_0x100b82){if(_0x100b82){_0x425a2c[_0xba32('0x4d')][_0xba32('0x5b')]=_0x100b82['id'];return db['ChatInternalMessage']['create'](_0x425a2c[_0xba32('0x4d')]);}})['then'](respondWithResult(_0x1ff865,null))[_0xba32('0x22')](handleError(_0x1ff865,null));};exports['getMessages']=function(_0x437592,_0x2edeaf,_0x10dcf5){var _0x5c7b5a={};var _0x1bbd46={};var _0x1eada6;var _0x5bc235;return db[_0xba32('0x33')][_0xba32('0x5c')]({'where':{'id':_0x437592[_0xba32('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2edeaf,null))['then'](function(_0x196a0a){if(_0x196a0a){_0x1eada6=_0x196a0a;_0x1bbd46['model']=_[_0xba32('0x39')](db['ChatInternalMessage']['rawAttributes']);_0x1bbd46[_0xba32('0x38')]=_[_0xba32('0x39')](_0x437592[_0xba32('0x38')]);_0x1bbd46['filters']=_['intersection'](_0x1bbd46['model'],_0x1bbd46[_0xba32('0x38')]);_0x5c7b5a[_0xba32('0x3c')]=_[_0xba32('0x3b')](_0x1bbd46[_0xba32('0x37')],qs[_0xba32('0x3d')](_0x437592[_0xba32('0x38')][_0xba32('0x3d')]));_0x5c7b5a['attributes']=_0x5c7b5a[_0xba32('0x3c')][_0xba32('0x4b')]?_0x5c7b5a[_0xba32('0x3c')]:_0x1bbd46[_0xba32('0x37')];_0x5c7b5a[_0xba32('0x40')]=qs['sort'](_0x437592[_0xba32('0x38')][_0xba32('0x41')]);_0x5c7b5a[_0xba32('0x42')]=qs[_0xba32('0x3a')](_['pick'](_0x437592['query'],_0x1bbd46[_0xba32('0x3a')]));if(_0x437592['query'][_0xba32('0x43')]){_0x5c7b5a[_0xba32('0x42')]=_[_0xba32('0x44')](_0x5c7b5a[_0xba32('0x42')],{'$or':_[_0xba32('0x32')](_0x5c7b5a[_0xba32('0x3c')],function(_0x426df){var _0xd65d46={};_0xd65d46[_0x426df]={'$like':'%'+_0x437592[_0xba32('0x38')][_0xba32('0x43')]+'%'};return _0xd65d46;})});}if(_0x437592['query'][_0xba32('0x5d')]){var _0x57f8e0=_0x437592['query']['$gte'][_0xba32('0x5e')](',');var _0x42e572={};_0x42e572[_0x57f8e0[0x0]]={'$gte':moment(_0x57f8e0[0x1])[_0xba32('0x5f')](_0xba32('0x60'))};_0x5c7b5a[_0xba32('0x42')]=_[_0xba32('0x44')](_0x5c7b5a[_0xba32('0x42')],_0x42e572);}_0x5c7b5a=_[_0xba32('0x44')]({},_0x5c7b5a,_0x437592[_0xba32('0x45')]);return _0x1eada6[_0xba32('0x61')](_0x5c7b5a);}})['then'](function(_0x362270){if(_0x362270){_0x5bc235=_0x362270[_0xba32('0x4b')];if(!_0x437592['query'][_0xba32('0x3e')](_0xba32('0x3f'))){_0x5c7b5a['limit']=qs[_0xba32('0x29')](_0x437592[_0xba32('0x38')][_0xba32('0x29')]);_0x5c7b5a[_0xba32('0x28')]=qs[_0xba32('0x28')](_0x437592[_0xba32('0x38')][_0xba32('0x28')]);}return _0x1eada6[_0xba32('0x61')](_0x5c7b5a);}})['then'](function(_0x22ca2a){if(_0x22ca2a){return _0x22ca2a?{'count':_0x5bc235,'rows':_0x22ca2a}:null;}})[_0xba32('0x2e')](respondWithResult(_0x2edeaf,null))[_0xba32('0x22')](handleError(_0x2edeaf,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index a2db18f..f2c4a5d 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 _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x163ff3,_0x260b31){var _0x4e87f6=function(_0x29cfb9){while(--_0x29cfb9){_0x163ff3['push'](_0x163ff3['shift']());}};_0x4e87f6(++_0x260b31);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x54f716,_0x67d0d8){var _0x1ff22e=function(_0x887c99){while(--_0x887c99){_0x54f716['push'](_0x54f716['shift']());}};_0x1ff22e(++_0x67d0d8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 89f1fce..db3a0d2 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 _0xf611=['path','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','util','../../config/logger','api'];(function(_0x2947b9,_0x48ac26){var _0x23ae65=function(_0x477e38){while(--_0x477e38){_0x2947b9['push'](_0x2947b9['shift']());}};_0x23ae65(++_0x48ac26);}(_0xf611,0x7b));var _0x1f61=function(_0x4145ed,_0x1965e3){_0x4145ed=_0x4145ed-0x0;var _0x2294a6=_0xf611[_0x4145ed];return _0x2294a6;};'use strict';var _=require('lodash');var util=require(_0x1f61('0x0'));var logger=require(_0x1f61('0x1'))(_0x1f61('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f61('0x3'));var rimraf=require('rimraf');var config=require(_0x1f61('0x4'));var attributes=require(_0x1f61('0x5'));module['exports']=function(_0x4faa5b,_0x290165){return _0x4faa5b[_0x1f61('0x6')](_0x1f61('0x7'),attributes,{'tableName':_0x1f61('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb8f=['util','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','chat_groups'];(function(_0x19eaf0,_0x40bced){var _0x35865f=function(_0x1ec882){while(--_0x1ec882){_0x19eaf0['push'](_0x19eaf0['shift']());}};_0x35865f(++_0x40bced);}(_0xfb8f,0x18c));var _0xffb8=function(_0x42fb47,_0x535cdd){_0x42fb47=_0x42fb47-0x0;var _0xde0481=_0xfb8f[_0x42fb47];return _0xde0481;};'use strict';var _=require('lodash');var util=require(_0xffb8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xffb8('0x1'));var BPromise=require(_0xffb8('0x2'));var rp=require(_0xffb8('0x3'));var fs=require('fs');var path=require(_0xffb8('0x4'));var rimraf=require(_0xffb8('0x5'));var config=require('../../config/environment');var attributes=require(_0xffb8('0x6'));module[_0xffb8('0x7')]=function(_0x463cfb,_0x47b1e5){return _0x463cfb['define']('ChatGroup',attributes,{'tableName':_0xffb8('0x8'),'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 5e89d86..8469fb0 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 _0x2472=['error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2472,0x1cf));var _0x2247=function(_0x4cb27c,_0x5bdac2){_0x4cb27c=_0x4cb27c-0x0;var _0x1bda3a=_0x2472[_0x4cb27c];return _0x1bda3a;};'use strict';var _=require(_0x2247('0x0'));var util=require(_0x2247('0x1'));var moment=require(_0x2247('0x2'));var BPromise=require('bluebird');var rs=require(_0x2247('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2247('0x4'))['db'];var utils=require(_0x2247('0x5'));var logger=require('../../config/logger')(_0x2247('0x6'));var config=require(_0x2247('0x7'));var jayson=require(_0x2247('0x8'));var client=jayson[_0x2247('0x9')][_0x2247('0xa')]({'port':0x232a});config[_0x2247('0xb')]=_[_0x2247('0xc')](config[_0x2247('0xb')],{'host':_0x2247('0xd'),'port':0x18eb});var socket=require(_0x2247('0xe'))(new Redis(config[_0x2247('0xb')]));require(_0x2247('0xf'))[_0x2247('0x10')](socket);function respondWithRpcPromise(_0x19be06,_0xfb1b9e,_0x5cf6b0){return new BPromise(function(_0x4e05d5,_0x35485a){return client['request'](_0x19be06,_0x5cf6b0)[_0x2247('0x11')](function(_0xf4be){logger[_0x2247('0x12')](_0x2247('0x13'),_0xfb1b9e,_0x2247('0x14'));logger[_0x2247('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xfb1b9e,_0x2247('0x14'),JSON[_0x2247('0x16')](_0xf4be));if(_0xf4be[_0x2247('0x17')]){if(_0xf4be[_0x2247('0x17')][_0x2247('0x18')]===0x1f4){logger['error'](_0x2247('0x13'),_0xfb1b9e,_0xf4be[_0x2247('0x17')][_0x2247('0x19')]);return _0x35485a(_0xf4be[_0x2247('0x17')][_0x2247('0x19')]);}logger[_0x2247('0x17')](_0x2247('0x13'),_0xfb1b9e,_0xf4be[_0x2247('0x17')][_0x2247('0x19')]);return _0x4e05d5(_0xf4be['error']['message']);}else{logger[_0x2247('0x12')](_0x2247('0x13'),_0xfb1b9e,_0x2247('0x14'));_0x4e05d5(_0xf4be['result'][_0x2247('0x19')]);}})[_0x2247('0x1a')](function(_0x1d1ab0){logger[_0x2247('0x17')](_0x2247('0x13'),_0xfb1b9e,_0x1d1ab0);_0x35485a(_0x1d1ab0);});});} \ No newline at end of file +var _0x5439=['localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x12c587,_0x430382){var _0x38ffe9=function(_0x336cb8){while(--_0x336cb8){_0x12c587['push'](_0x12c587['shift']());}};_0x38ffe9(++_0x430382);}(_0x5439,0xb1));var _0x9543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5439[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9543('0x0'));var util=require(_0x9543('0x1'));var moment=require('moment');var BPromise=require(_0x9543('0x2'));var rs=require(_0x9543('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9543('0x4'))['db'];var utils=require(_0x9543('0x5'));var logger=require(_0x9543('0x6'))('rpc');var config=require(_0x9543('0x7'));var jayson=require(_0x9543('0x8'));var client=jayson[_0x9543('0x9')][_0x9543('0xa')]({'port':0x232a});config[_0x9543('0xb')]=_['defaults'](config[_0x9543('0xb')],{'host':_0x9543('0xc'),'port':0x18eb});var socket=require(_0x9543('0xd'))(new Redis(config[_0x9543('0xb')]));require('./chatGroup.socket')[_0x9543('0xe')](socket);function respondWithRpcPromise(_0x3b12a5,_0x567a40,_0x4a5139){return new BPromise(function(_0x1156b1,_0xf24cb2){return client[_0x9543('0xf')](_0x3b12a5,_0x4a5139)[_0x9543('0x10')](function(_0x49b5ec){logger[_0x9543('0x11')]('ChatGroup,\x20%s,\x20%s',_0x567a40,_0x9543('0x12'));logger[_0x9543('0x13')](_0x9543('0x14'),_0x567a40,_0x9543('0x12'),JSON['stringify'](_0x49b5ec));if(_0x49b5ec[_0x9543('0x15')]){if(_0x49b5ec['error'][_0x9543('0x16')]===0x1f4){logger[_0x9543('0x15')]('ChatGroup,\x20%s,\x20%s',_0x567a40,_0x49b5ec[_0x9543('0x15')][_0x9543('0x17')]);return _0xf24cb2(_0x49b5ec[_0x9543('0x15')][_0x9543('0x17')]);}logger['error'](_0x9543('0x18'),_0x567a40,_0x49b5ec['error'][_0x9543('0x17')]);return _0x1156b1(_0x49b5ec[_0x9543('0x15')][_0x9543('0x17')]);}else{logger['info'](_0x9543('0x18'),_0x567a40,'request\x20sent');_0x1156b1(_0x49b5ec[_0x9543('0x19')][_0x9543('0x17')]);}})[_0x9543('0x1a')](function(_0x4cb36d){logger[_0x9543('0x15')](_0x9543('0x18'),_0x567a40,_0x4cb36d);_0xf24cb2(_0x4cb36d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index a11a63d..725b7e0 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 _0xed9b=['chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x19be04,_0x166c55){var _0x2b0ed0=function(_0x3d8900){while(--_0x3d8900){_0x19be04['push'](_0x19be04['shift']());}};_0x2b0ed0(++_0x166c55);}(_0xed9b,0x189));var _0xbed9=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xed9b[_0x82129b];return _0x2ae5dc;};'use strict';var ChatGroupEvents=require(_0xbed9('0x0'));var events=[_0xbed9('0x1'),_0xbed9('0x2'),_0xbed9('0x3')];function createListener(_0x1499eb,_0x3f6dbb){return function(_0x162f2c){_0x3f6dbb[_0xbed9('0x4')](_0x1499eb,_0x162f2c);};}function removeListener(_0x3eb923,_0x4c701e){return function(){ChatGroupEvents[_0xbed9('0x5')](_0x3eb923,_0x4c701e);};}exports[_0xbed9('0x6')]=function(_0x51bdd2){for(var _0xaf2b9c=0x0,_0x56f04d=events['length'];_0xaf2b9c<_0x56f04d;_0xaf2b9c++){var _0x56c589=events[_0xaf2b9c];var _0x292a8f=createListener(_0xbed9('0x7')+_0x56c589,_0x51bdd2);ChatGroupEvents['on'](_0x56c589,_0x292a8f);}}; \ No newline at end of file +var _0xa26b=['save','remove','removeListener','length','chatGroup:'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0xa26b,0x1bd));var _0xba26=function(_0x250a34,_0xe5c2dc){_0x250a34=_0x250a34-0x0;var _0x8655e9=_0xa26b[_0x250a34];return _0x8655e9;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xba26('0x0'),_0xba26('0x1'),'update'];function createListener(_0x34f1b8,_0x5c93c1){return function(_0x345a09){_0x5c93c1['emit'](_0x34f1b8,_0x345a09);};}function removeListener(_0x91df35,_0x3c9a6b){return function(){ChatGroupEvents[_0xba26('0x2')](_0x91df35,_0x3c9a6b);};}exports['register']=function(_0x4dfb60){for(var _0x27db44=0x0,_0xcb055c=events[_0xba26('0x3')];_0x27db44<_0xcb055c;_0x27db44++){var _0x2adb2f=events[_0x27db44];var _0x4b4fb6=createListener(_0xba26('0x4')+_0x2adb2f,_0x4dfb60);ChatGroupEvents['on'](_0x2adb2f,_0x4b4fb6);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e16b528..b1223fc 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 _0x2230=['isAuthenticated','/describe','describe','/:id','show','getUnread','getMembers','getMessages','post','/:id/members','/:id/messages','put','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1fae5f,_0x46b58c){var _0x2ba661=function(_0x3923dd){while(--_0x3923dd){_0x1fae5f['push'](_0x1fae5f['shift']());}};_0x2ba661(++_0x46b58c);}(_0x2230,0xd9));var _0x0223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2230[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x0223('0x0'));var path=require(_0x0223('0x1'));var timeout=require(_0x0223('0x2'));var express=require('express');var router=express[_0x0223('0x3')]();var auth=require(_0x0223('0x4'));var interaction=require(_0x0223('0x5'));var config=require(_0x0223('0x6'));var controller=require('./chatGroup.controller');router[_0x0223('0x7')]('/',auth[_0x0223('0x8')](),controller['index']);router[_0x0223('0x7')](_0x0223('0x9'),auth['isAuthenticated'](),controller[_0x0223('0xa')]);router[_0x0223('0x7')](_0x0223('0xb'),auth['isAuthenticated'](),controller[_0x0223('0xc')]);router[_0x0223('0x7')]('/:id/unread',auth[_0x0223('0x8')](),controller[_0x0223('0xd')]);router[_0x0223('0x7')]('/:id/members',auth[_0x0223('0x8')](),controller[_0x0223('0xe')]);router[_0x0223('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x0223('0xf')]);router[_0x0223('0x10')]('/',auth[_0x0223('0x8')](),controller['create']);router[_0x0223('0x10')](_0x0223('0x11'),auth['isAuthenticated'](),controller['addMembers']);router[_0x0223('0x10')](_0x0223('0x12'),auth[_0x0223('0x8')](),controller['addMessage']);router[_0x0223('0x13')]('/:id',auth[_0x0223('0x8')](),controller[_0x0223('0x14')]);router[_0x0223('0x15')](_0x0223('0xb'),auth[_0x0223('0x8')](),controller[_0x0223('0x16')]);router[_0x0223('0x15')](_0x0223('0x11'),auth['isAuthenticated'](),controller[_0x0223('0x17')]);module[_0x0223('0x18')]=router; \ No newline at end of file +var _0x6d41=['update','delete','destroy','removeMembers','util','path','connect-timeout','Router','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','describe','/:id/unread','getUnread','getMembers','getMessages','post','create','/:id/members','addMembers','/:id/messages','addMessage','/:id'];(function(_0x163682,_0x220bca){var _0x3fd9d4=function(_0xaf50bc){while(--_0xaf50bc){_0x163682['push'](_0x163682['shift']());}};_0x3fd9d4(++_0x220bca);}(_0x6d41,0x68));var _0x16d4=function(_0x5828cc,_0x569e34){_0x5828cc=_0x5828cc-0x0;var _0x2cbaca=_0x6d41[_0x5828cc];return _0x2cbaca;};'use strict';var multer=require('multer');var util=require(_0x16d4('0x0'));var path=require(_0x16d4('0x1'));var timeout=require(_0x16d4('0x2'));var express=require('express');var router=express[_0x16d4('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x16d4('0x4'));var controller=require(_0x16d4('0x5'));router['get']('/',auth[_0x16d4('0x6')](),controller[_0x16d4('0x7')]);router[_0x16d4('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x16d4('0x9')]);router[_0x16d4('0x8')]('/:id',auth[_0x16d4('0x6')](),controller['show']);router[_0x16d4('0x8')](_0x16d4('0xa'),auth['isAuthenticated'](),controller[_0x16d4('0xb')]);router['get']('/:id/members',auth[_0x16d4('0x6')](),controller[_0x16d4('0xc')]);router['get']('/:id/messages',auth[_0x16d4('0x6')](),controller[_0x16d4('0xd')]);router[_0x16d4('0xe')]('/',auth[_0x16d4('0x6')](),controller[_0x16d4('0xf')]);router['post'](_0x16d4('0x10'),auth['isAuthenticated'](),controller[_0x16d4('0x11')]);router['post'](_0x16d4('0x12'),auth[_0x16d4('0x6')](),controller[_0x16d4('0x13')]);router['put'](_0x16d4('0x14'),auth[_0x16d4('0x6')](),controller[_0x16d4('0x15')]);router[_0x16d4('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x16d4('0x17')]);router[_0x16d4('0x16')](_0x16d4('0x10'),auth[_0x16d4('0x6')](),controller[_0x16d4('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 5482ba8..eb871b8 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 _0x4453=['exports','BOOLEAN','INTEGER','ENUM','thumb','star','TEXT','STRING','DATE','out','sequelize'];(function(_0xa89478,_0x5c4cdc){var _0xf49237=function(_0x48ab1f){while(--_0x48ab1f){_0xa89478['push'](_0xa89478['shift']());}};_0xf49237(++_0x5c4cdc);}(_0x4453,0x18b));var _0x3445=function(_0x44aaed,_0x5c9172){_0x44aaed=_0x44aaed-0x0;var _0x1bc121=_0x4453[_0x44aaed];return _0x1bc121;};'use strict';var Sequelize=require(_0x3445('0x0'));module[_0x3445('0x1')]={'closed':{'type':Sequelize[_0x3445('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3445('0x3')]},'ratingType':{'type':Sequelize[_0x3445('0x4')]('star',_0x3445('0x5')),'defaultValue':_0x3445('0x6')},'ratingMessage':{'type':Sequelize[_0x3445('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x3445('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3445('0x9')]},'disposition':{'type':Sequelize[_0x3445('0x8')]},'secondDisposition':{'type':Sequelize[_0x3445('0x8')]},'thirdDisposition':{'type':Sequelize[_0x3445('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x3445('0x8')]},'browserVersion':{'type':Sequelize[_0x3445('0x8')]},'osName':{'type':Sequelize[_0x3445('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x3445('0x8')]},'deviceVendor':{'type':Sequelize[_0x3445('0x8')]},'deviceType':{'type':Sequelize[_0x3445('0x8')]},'referer':{'type':Sequelize[_0x3445('0x7')]},'customerIp':{'type':Sequelize[_0x3445('0x8')]},'formData':{'type':Sequelize[_0x3445('0x7')]('long')},'read1stAt':{'type':Sequelize[_0x3445('0x9')]},'lastMsgAt':{'type':Sequelize[_0x3445('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3445('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3445('0x8')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x3445('0x7')]}}; \ No newline at end of file +var _0x4695=['exports','star','thumb','TEXT','DATE','STRING','long','ENUM','out','sequelize'];(function(_0x40961d,_0x32665c){var _0x31f924=function(_0x22bcf1){while(--_0x22bcf1){_0x40961d['push'](_0x40961d['shift']());}};_0x31f924(++_0x32665c);}(_0x4695,0x77));var _0x5469=function(_0x2e1d9c,_0x2e9528){_0x2e1d9c=_0x2e1d9c-0x0;var _0x5c18fb=_0x4695[_0x2e1d9c];return _0x5c18fb;};'use strict';var Sequelize=require(_0x5469('0x0'));module[_0x5469('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x5469('0x2'),_0x5469('0x3')),'defaultValue':_0x5469('0x2')},'ratingMessage':{'type':Sequelize[_0x5469('0x4')]},'pathTranscript':{'type':Sequelize[_0x5469('0x4')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x5469('0x5')]},'disposition':{'type':Sequelize[_0x5469('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5469('0x6')]},'browserName':{'type':Sequelize[_0x5469('0x6')]},'browserVersion':{'type':Sequelize[_0x5469('0x6')]},'osName':{'type':Sequelize[_0x5469('0x6')]},'osVersion':{'type':Sequelize[_0x5469('0x6')]},'deviceModel':{'type':Sequelize[_0x5469('0x6')]},'deviceVendor':{'type':Sequelize[_0x5469('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x5469('0x6')]},'formData':{'type':Sequelize[_0x5469('0x4')](_0x5469('0x7'))},'read1stAt':{'type':Sequelize[_0x5469('0x5')]},'lastMsgAt':{'type':Sequelize[_0x5469('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x5469('0x8')]('in',_0x5469('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x5469('0x6')]},'customerPort':{'type':Sequelize[_0x5469('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index a8e752a..360cb58 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 _0xdacb=['renderFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','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','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','sendStatus','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','index','ChatInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','ChatWebsiteId','sequelize','toString','merge','Account.key','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.internal','Owner.internal','groupBy','ChatInteractionId','push','all','rows','show','params','includeAll','options','create','update','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','follow','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','download','join','mailTranscript','format','transcript-%s.txt','now','Messages','User','customer','%s%d','agentIdentifier','website_alias','agentAlias','System','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','pick','include','findAll','getMyMessages','includeAgent','addTags','setTags','spread','emit','chatInteractionTags:save','unix','root','files','tmp','server','attachments','firstName','Account','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','lastName'];(function(_0x3bf043,_0x439342){var _0x35a484=function(_0x3ad0ab){while(--_0x3ad0ab){_0x3bf043['push'](_0x3bf043['shift']());}};_0x35a484(++_0x439342);}(_0xdacb,0x137));var _0xbdac=function(_0x34b946,_0xa61ab2){_0x34b946=_0x34b946-0x0;var _0x1d7632=_0xdacb[_0x34b946];return _0x1d7632;};'use strict';var pdf=require(_0xbdac('0x0'));var emlformat=require(_0xbdac('0x1'));var rimraf=require(_0xbdac('0x2'));var zipdir=require(_0xbdac('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbdac('0x4'));var moment=require(_0xbdac('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbdac('0x6'));var util=require('util');var path=require(_0xbdac('0x7'));var sox=require('sox');var csv=require(_0xbdac('0x8'));var ejs=require(_0xbdac('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbdac('0xa'));var toCsv=require(_0xbdac('0x8'));var querystring=require(_0xbdac('0xb'));var Papa=require(_0xbdac('0xc'));var Redis=require(_0xbdac('0xd'));var authService=require(_0xbdac('0xe'));var qs=require(_0xbdac('0xf'));var as=require(_0xbdac('0x10'));var hardwareService=require(_0xbdac('0x11'));var logger=require('../../config/logger')(_0xbdac('0x12'));var utils=require(_0xbdac('0x13'));var config=require(_0xbdac('0x14'));var licenseUtil=require(_0xbdac('0x15'));var db=require(_0xbdac('0x16'))['db'];config[_0xbdac('0x17')]=_[_0xbdac('0x18')](config[_0xbdac('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xbdac('0x19'))(new Redis(config['redis']));require(_0xbdac('0x1a'))[_0xbdac('0x1b')](socket);var jayson=require(_0xbdac('0x1c'));var client=jayson[_0xbdac('0x1d')][_0xbdac('0x1e')]({'port':0x232b});var client9004=jayson['client'][_0xbdac('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x58a7d7,_0x3ecd1d,_0x2a6645,_0x5360cb){return new BPromise(function(_0x1d552a,_0x209183){var _0xc9ae16=_0x5360cb||client;return _0xc9ae16[_0xbdac('0x1f')](_0x58a7d7,_0x2a6645)[_0xbdac('0x20')](function(_0x377248){logger['info'](_0xbdac('0x21'),_0x3ecd1d,_0xbdac('0x22'));logger[_0xbdac('0x23')](_0xbdac('0x24'),_0x3ecd1d,_0xbdac('0x22'),JSON[_0xbdac('0x25')](_0x377248));if(_0x377248[_0xbdac('0x26')]){if(_0x377248[_0xbdac('0x26')][_0xbdac('0x27')]===0x1f4){logger['error'](_0xbdac('0x21'),_0x3ecd1d,_0x377248[_0xbdac('0x26')][_0xbdac('0x28')]);return _0x209183(_0x377248[_0xbdac('0x26')]['message']);}logger[_0xbdac('0x26')](_0xbdac('0x21'),_0x3ecd1d,_0x377248['error'][_0xbdac('0x28')]);return _0x1d552a(_0x377248[_0xbdac('0x26')]['message']);}else{logger[_0xbdac('0x29')]('ChatInteraction,\x20%s,\x20%s',_0x3ecd1d,_0xbdac('0x22'));_0x1d552a(_0x377248[_0xbdac('0x2a')]['message']);}})[_0xbdac('0x2b')](function(_0x3984ef){logger[_0xbdac('0x26')](_0xbdac('0x21'),_0x3ecd1d,_0x3984ef);_0x209183(_0x3984ef);});});}function respondWithStatusCode(_0x478e3c,_0x14642d){_0x14642d=_0x14642d||0xcc;return function(_0x3d4bb6){if(_0x3d4bb6){return _0x478e3c['sendStatus'](_0x14642d);}return _0x478e3c[_0xbdac('0x2c')](_0x14642d)[_0xbdac('0x2d')]();};}function respondWithResult(_0x57506e,_0x529fc2){_0x529fc2=_0x529fc2||0xc8;return function(_0x30f8b2){if(_0x30f8b2){return _0x57506e[_0xbdac('0x2c')](_0x529fc2)[_0xbdac('0x2e')](_0x30f8b2);}};}function respondWithFilteredResult(_0x58bf11,_0x63e7f4){return function(_0x29c10e){if(_0x29c10e){var _0x1f85d4=_0x29c10e[_0xbdac('0x2f')],_0x5b8741=_0x63e7f4[_0xbdac('0x30')],_0x54d8d6=_0x63e7f4['offset']+_0x63e7f4[_0xbdac('0x31')],_0x373701;if(_0x54d8d6>=_0x1f85d4){_0x54d8d6=_0x1f85d4;_0x373701=0xc8;}else{_0x373701=0xce;}_0x58bf11[_0xbdac('0x2c')](_0x373701);return _0x58bf11[_0xbdac('0x32')](_0xbdac('0x33'),_0x5b8741+'-'+_0x54d8d6+'/'+_0x1f85d4)[_0xbdac('0x2e')](_0x29c10e);}return null;};}function patchUpdates(_0x44848c){return function(_0x1835fd){try{jsonpatch[_0xbdac('0x34')](_0x1835fd,_0x44848c,!![]);}catch(_0x2f935b){return BPromise[_0xbdac('0x35')](_0x2f935b);}return _0x1835fd['save']();};}function saveUpdates(_0x361713,_0x12aa66){return function(_0x34a6a8){if(_0x34a6a8){return _0x34a6a8['update'](_0x361713)[_0xbdac('0x20')](function(_0x47231d){return _0x47231d;});}return null;};}function removeEntity(_0x5946a0,_0x3208dd){return function(_0x439b6a){if(_0x439b6a){return _0x439b6a[_0xbdac('0x36')]()[_0xbdac('0x20')](function(){_0x5946a0['status'](0xcc)[_0xbdac('0x2d')]();});}};}function handleEntityNotFound(_0xff83bc,_0x369aa8){return function(_0x5c71e6){if(!_0x5c71e6){_0xff83bc[_0xbdac('0x37')](0x194);}return _0x5c71e6;};}function handleError(_0x5f2a78,_0x505ed5){_0x505ed5=_0x505ed5||0x1f4;return function(_0x1e7554){logger[_0xbdac('0x26')](_0x1e7554[_0xbdac('0x38')]);if(_0x1e7554[_0xbdac('0x39')]){delete _0x1e7554['name'];}_0x5f2a78[_0xbdac('0x2c')](_0x505ed5)[_0xbdac('0x3a')](_0x1e7554);};}function getInteractionUsers(_0x4b075b,_0x143ade){return new BPromise(function(_0x291b25,_0x28bb59){try{if(_0x143ade[_0x4b075b['id']]){_0x4b075b[_0xbdac('0x3b')]=_[_0xbdac('0x3c')](_0x143ade[_0x4b075b['id']],function(_0x792821){return{'id':_0x792821['id'],'fullname':_0x792821[_0xbdac('0x3d')]};});}}catch(_0x4b0692){_0x28bb59(_0x4b0692);}_0x291b25(_0x4b075b);});}function getInteractionTags(_0x526975,_0x378394){return new BPromise(function(_0x3f4193,_0x4b2230){try{if(_0x526975['TagIds']){_0x526975[_0xbdac('0x3e')]=[];_0x526975[_0xbdac('0x3f')][_0xbdac('0x40')](',')[_0xbdac('0x41')](function(_0x18f45c){_0x526975['Tags']['push'](_0x378394[_0x18f45c]);});}delete _0x526975[_0xbdac('0x3f')];}catch(_0x276c8a){_0x4b2230(_0x276c8a);}_0x3f4193(_0x526975);});}function updateChatInteraction(_0x474185,_0x5c5a7e,_0x2fe4e5){return new BPromise(function(_0x47dbfc,_0x33646b){return getInteractionUsers(_0x474185,_0x2fe4e5)[_0xbdac('0x20')](function(_0x4c7aac){return getInteractionTags(_0x4c7aac,_0x5c5a7e);})[_0xbdac('0x20')](function(_0x1a52ef){_0x47dbfc(_0x1a52ef);})[_0xbdac('0x2b')](function(_0x44f515){_0x33646b(_0x44f515);});});}exports[_0xbdac('0x42')]=function(_0x437719,_0x17da66){var _0x334492={},_0x2ffa73={},_0x4a8699={'count':0x0,'rows':[]};var _0x4f8aad=_['map'](db[_0xbdac('0x43')][_0xbdac('0x44')],function(_0x4c5459){return{'name':_0x4c5459[_0xbdac('0x45')],'type':_0x4c5459[_0xbdac('0x46')]['key']};});_0x2ffa73[_0xbdac('0x47')]=_[_0xbdac('0x3c')](_0x4f8aad,_0xbdac('0x39'));_0x2ffa73[_0xbdac('0x48')]=_[_0xbdac('0x49')](_0x437719[_0xbdac('0x48')]);_0x2ffa73[_0xbdac('0x4a')]=_[_0xbdac('0x4b')](_0x2ffa73['model'],_0x2ffa73[_0xbdac('0x48')]);_0x334492[_0xbdac('0x4c')]=_[_0xbdac('0x4b')](_0x2ffa73[_0xbdac('0x47')],qs[_0xbdac('0x4d')](_0x437719[_0xbdac('0x48')]['fields']));_0x334492[_0xbdac('0x4c')]=_0x334492['attributes']['length']?_0x334492[_0xbdac('0x4c')]:_0x2ffa73['model'];if(!_0x437719[_0xbdac('0x48')][_0xbdac('0x4e')]('nolimit')){_0x334492['limit']=qs[_0xbdac('0x31')](_0x437719[_0xbdac('0x48')][_0xbdac('0x31')]);_0x334492['offset']=qs['offset'](_0x437719[_0xbdac('0x48')][_0xbdac('0x30')]);}_0x334492[_0xbdac('0x4f')]=qs[_0xbdac('0x50')](_0x437719[_0xbdac('0x48')][_0xbdac('0x50')]);_0x334492['where']=qs[_0xbdac('0x4a')](_['pick'](_0x437719[_0xbdac('0x48')],_0x2ffa73[_0xbdac('0x4a')]),_0x4f8aad);var _0x3f50f9=[];var _0x1ac44b=squel[_0xbdac('0x51')]()[_0xbdac('0x52')]('id')['field']('name')[_0xbdac('0x52')](_0xbdac('0x53'))[_0xbdac('0x54')](_0xbdac('0x55'));var _0x144b97=squel['select']()[_0xbdac('0x52')](_0xbdac('0x56'))[_0xbdac('0x52')](_0xbdac('0x57'))[_0xbdac('0x52')](_0xbdac('0x58'))['from']('user_has_chat_interactions','ui')[_0xbdac('0x59')]('users','u',_0xbdac('0x5a'));var _0x401b40=squel[_0xbdac('0x51')]()[_0xbdac('0x54')](_0xbdac('0x5b'),'i')[_0xbdac('0x59')]('cm_contacts','c',_0xbdac('0x5c'))['left_join']('users','o','o.id\x20=\x20i.UserId')['left_join'](_0xbdac('0x5d'),'a',_0xbdac('0x5e'))[_0xbdac('0x59')](_0xbdac('0x5f'),'me','me.ChatInteractionId\x20=\x20i.id')['left_join'](_0xbdac('0x60'),'it',_0xbdac('0x61'))['left_join'](_0xbdac('0x55'),'t',_0xbdac('0x62'));var _0x58e9e8=squel[_0xbdac('0x63')]();var _0x2c43d5=[];var _0x1f49fb=squel['expr']();var _0x2d4770;if(_0x437719[_0xbdac('0x48')]['search']){_0x2d4770=as[_0xbdac('0x64')](_0x437719['query'][_0xbdac('0x65')]);var _0x18c132=_0x2d4770[_0xbdac('0x66')];for(var _0x5a93d1=0x0;_0x5a93d1<_0x2d4770[_0xbdac('0x67')][_0xbdac('0x68')];_0x5a93d1++){var _0x16e1e7=_0x2d4770[_0xbdac('0x67')][_0x5a93d1];var _0x2236cf='i';var _0x16272a=_[_0xbdac('0x69')](_0x4f8aad,[_0xbdac('0x39'),_0x16e1e7['field']]);if(!_0x16272a){switch(_0x16e1e7['field']){case _0xbdac('0x6a'):if(_0x16e1e7[_0xbdac('0x6b')]==0x1){_0x401b40['having']('`'+_0x16e1e7[_0xbdac('0x52')]+_0xbdac('0x6c'));}else{_0x401b40[_0xbdac('0x6d')]('`'+_0x16e1e7[_0xbdac('0x52')]+_0xbdac('0x6e'));}break;case _0xbdac('0x6f'):if(_0x16e1e7[_0xbdac('0x70')]==='$substring'){if(_0x16e1e7[_0xbdac('0x6b')]['split']('\x20')['length']>0x1){_0x58e9e8[_0x18c132]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbdac('0x71')](_0x16e1e7[_0xbdac('0x6b')]),null);}else{var _0x3952fe='%'+_0x16e1e7['value']+'%';_0x58e9e8[_0x18c132](_0xbdac('0x72'),_0x3952fe,_0x3952fe,_0x3952fe);}}else{_0x16272a=_['find'](_0x4f8aad,['name',_0xbdac('0x73')]);_0x16e1e7[_0xbdac('0x52')]=_0xbdac('0x73');_0x2e41f3=as[_0xbdac('0x74')](_0x2236cf,_0x16272a['type'],_0x16e1e7);_0x58e9e8[_0x18c132](_0x2e41f3['text'],_0x2e41f3[_0xbdac('0x6b')][_0xbdac('0x75')],_0x2e41f3[_0xbdac('0x6b')][_0xbdac('0x2d')]);}break;case _0xbdac('0x76'):var _0x1112f8=_0x16e1e7[_0xbdac('0x6b')][_0xbdac('0x40')](',')[_0xbdac('0x3c')](function(_0x24f0c4){return Number(_0x24f0c4);});_0x1112f8[_0xbdac('0x41')](function(_0x2f2ab0){_0x1f49fb['or'](_0xbdac('0x77'),'%,'+_0x2f2ab0+',%');});_0x2c43d5=_[_0xbdac('0x78')](_0x2c43d5,_0x1112f8);break;case'User':if(_0x16e1e7[_0xbdac('0x70')]===_0xbdac('0x79')){_0x58e9e8[_0x18c132](_0xbdac('0x7a'),'%'+_0x16e1e7['value']+'%',null);}else{_0x16272a=_[_0xbdac('0x69')](_0x4f8aad,[_0xbdac('0x39'),'UserId']);_0x16e1e7[_0xbdac('0x52')]=_0xbdac('0x7b');_0x2e41f3=as['buildExpression'](_0x2236cf,_0x16272a[_0xbdac('0x46')],_0x16e1e7);_0x58e9e8[_0x18c132](_0x2e41f3[_0xbdac('0x7c')],_0x2e41f3[_0xbdac('0x6b')][_0xbdac('0x75')],_0x2e41f3['value']['end']);}break;case _0xbdac('0x7d'):_0x2e41f3=as['buildExpression']('me',null,_0x16e1e7);_0x58e9e8[_0x18c132](_0x2e41f3[_0xbdac('0x7c')],_0x2e41f3[_0xbdac('0x6b')][_0xbdac('0x75')],_0x2e41f3[_0xbdac('0x6b')][_0xbdac('0x2d')]);break;}}else{var _0x2e41f3=as[_0xbdac('0x74')](_0x2236cf,_0x16272a[_0xbdac('0x46')],_0x16e1e7);_0x58e9e8[_0x18c132](_0x2e41f3[_0xbdac('0x7c')],_0x2e41f3[_0xbdac('0x6b')][_0xbdac('0x75')],_0x2e41f3[_0xbdac('0x6b')]['end']);}}}else{var _0x29531f=_(_0x437719['query'])[_0xbdac('0x49')]()[_0xbdac('0x3c')](function(_0x4f8c71){return _[_0xbdac('0x7e')](_0x4f8aad,['name',_0x4f8c71])?_0x4f8c71:undefined;})[_0xbdac('0x7f')]()[_0xbdac('0x6b')]();if(!_[_0xbdac('0x80')](_0x29531f)){_0x29531f[_0xbdac('0x41')](function(_0x2a2a63){if(_0x2a2a63==='ChatWebsiteId'){_0x401b40['where'](_0xbdac('0x81'),[][_0xbdac('0x82')](_0x437719['query'][_0x2a2a63]));}else if(_0x2a2a63===_0xbdac('0x83')){var _0x4c8ba6=JSON[_0xbdac('0x84')](_0x437719[_0xbdac('0x48')][_0x2a2a63])[_0xbdac('0x85')];var _0x4e465e=JSON[_0xbdac('0x84')](_0x437719['query'][_0x2a2a63])[_0xbdac('0x86')];_0x401b40[_0xbdac('0x87')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4c8ba6,_0x4e465e);}else{if(_0x437719[_0xbdac('0x48')][_0x2a2a63]===_0xbdac('0x88')){_0x401b40[_0xbdac('0x87')]('i.'+_0x2a2a63+_0xbdac('0x89'));}else{_0x401b40['where']('i.'+_0x2a2a63+_0xbdac('0x8a'),_0x437719[_0xbdac('0x48')][_0x2a2a63]);}}});}if(_0x437719[_0xbdac('0x48')][_0xbdac('0x8b')]){if(_0x437719[_0xbdac('0x48')][_0xbdac('0x8b')]==0x1){_0x401b40['having'](_0xbdac('0x8c'));}else{_0x401b40[_0xbdac('0x6d')](_0xbdac('0x8d'));}}if(_0x437719['query'][_0xbdac('0x8e')]){_0x2c43d5=_[_0xbdac('0x8f')](_0x437719[_0xbdac('0x48')][_0xbdac('0x8e')])?_0x437719[_0xbdac('0x48')][_0xbdac('0x8e')]:new Array(_0x437719[_0xbdac('0x48')][_0xbdac('0x8e')]);_0x2c43d5[_0xbdac('0x41')](function(_0x430c3c){_0x1f49fb['or'](_0xbdac('0x77'),'%,'+_0x430c3c+',%');});}if(_0x437719[_0xbdac('0x48')][_0xbdac('0x90')]){var _0x5dc240=_0x437719[_0xbdac('0x48')][_0xbdac('0x90')][_0xbdac('0x91')]('\x5c','\x5c\x5c')[_0xbdac('0x91')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5dc240)){_0x58e9e8['or']('i.id\x20LIKE\x20?',_0x5dc240+'%');}else{_0x58e9e8['or'](_0xbdac('0x92'),qs[_0xbdac('0x71')](_0x5dc240))['or'](_0xbdac('0x93'),_0x5dc240+'%');}}}_0x401b40['where'](_0x58e9e8);_0x401b40[_0xbdac('0x94')](_0xbdac('0x95'));var _0x3cc2e5={'type':db['Sequelize'][_0xbdac('0x96')][_0xbdac('0x97')],'raw':!![]};var _0x483c60=_0x401b40[_0xbdac('0x98')]();_0x483c60[_0xbdac('0x52')](_0xbdac('0x95'));_0x483c60['field'](_0xbdac('0x99'),_0xbdac('0x6a'));if(_0x334492['order']){_0x334492[_0xbdac('0x4f')][_0xbdac('0x41')](function(_0x47fb11){var _0x1bcd63=_0x47fb11[0x0]===_0xbdac('0x9a')?_0x47fb11[0x0]:'i.'+_0x47fb11[0x0];_0x401b40[_0xbdac('0x4f')](_0x1bcd63,_0x47fb11[0x1]===_0xbdac('0x9b')?![]:!![]);});}if(!_[_0xbdac('0x80')](_0x2c43d5)){_0x401b40['having'](_0x1f49fb);_0x483c60[_0xbdac('0x87')](_0xbdac('0x9c'),_0x2c43d5);}BPromise['resolve']()['then'](function(){if(!_0x2d4770){if(_0x437719[_0xbdac('0x48')]['ChatWebsiteId'])return;_0x483c60[_0xbdac('0x87')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x401b40[_0xbdac('0x87')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x437719[_0xbdac('0x9d')][_0xbdac('0x9e')]!==_0xbdac('0x9f'))return;return _0x437719[_0xbdac('0x9d')][_0xbdac('0xa0')]({'attributes':['id'],'raw':!![]})[_0xbdac('0x20')](function(_0x201d0b){if(_[_0xbdac('0x80')](_0x201d0b)){_0x483c60[_0xbdac('0x87')]('i.ChatWebsiteId\x20IS\x20NULL');_0x401b40[_0xbdac('0x87')](_0xbdac('0xa1'));}else{_0x483c60[_0xbdac('0x87')](_0xbdac('0x81'),_[_0xbdac('0x3c')](_0x201d0b,'id'));_0x401b40[_0xbdac('0x87')](_0xbdac('0x81'),_[_0xbdac('0x3c')](_0x201d0b,'id'));}});})[_0xbdac('0x20')](function(){if(_0x437719[_0xbdac('0x9d')][_0xbdac('0x9e')]===_0xbdac('0x9f')&&!_0x2d4770&&!_0x437719[_0xbdac('0x48')][_0xbdac('0xa2')])return[];return db[_0xbdac('0xa3')]['query'](_0x483c60[_0xbdac('0xa4')](),_0x3cc2e5);})[_0xbdac('0x20')](function(_0x3a353f){_0x4a8699[_0xbdac('0x2f')]=_0x3a353f[_0xbdac('0x68')];if(_0x4a8699['count']===0x0)return[];return db[_0xbdac('0xa3')][_0xbdac('0x48')](_0x1ac44b['toString'](),_0x3cc2e5)[_0xbdac('0x20')](function(_0x38a9c2){_0x3f50f9=_['keyBy'](_0x38a9c2,'id');_0x3cc2e5=_[_0xbdac('0xa5')](_0x3cc2e5,{'model':db[_0xbdac('0x43')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x437719[_0xbdac('0x48')][_0xbdac('0x4d')]){_0x334492[_0xbdac('0x4c')][_0xbdac('0x41')](function(_0x970cc){_0x401b40[_0xbdac('0x52')]('i.'+_0x970cc);});}else{_0x401b40[_0xbdac('0x52')](_0xbdac('0x99'),_0xbdac('0x6a'));_0x401b40[_0xbdac('0x52')]('a.key',_0xbdac('0xa6'));_0x401b40[_0xbdac('0x52')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x401b40['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');_0x401b40[_0xbdac('0x52')](_0xbdac('0xa7'));_0x401b40[_0xbdac('0x52')](_0xbdac('0xa8'),_0xbdac('0xa9'));_0x401b40[_0xbdac('0x52')](_0xbdac('0xaa'),_0xbdac('0xab'));_0x401b40[_0xbdac('0x52')](_0xbdac('0xac'),_0xbdac('0xad'));_0x401b40[_0xbdac('0x52')](_0xbdac('0xae'),_0xbdac('0xaf'));_0x401b40[_0xbdac('0x52')](_0xbdac('0xb0'),'Contact.mobile');_0x401b40[_0xbdac('0x52')]('c.fax',_0xbdac('0xb1'));_0x401b40[_0xbdac('0x52')]('o.fullname','Owner.fullname');_0x401b40[_0xbdac('0x52')](_0xbdac('0xb2'),_0xbdac('0xb3'));_0x401b40[_0xbdac('0x52')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbdac('0x3f'));}if(_0x334492[_0xbdac('0x31')])_0x401b40[_0xbdac('0x31')](_0x334492[_0xbdac('0x31')]);if(_0x334492[_0xbdac('0x30')])_0x401b40['offset'](_0x334492['offset']);return db[_0xbdac('0xa3')][_0xbdac('0x48')](_0x401b40[_0xbdac('0xa4')](),_0x3cc2e5);})['then'](function(_0x28f252){_0x144b97[_0xbdac('0x87')]('ui.ChatInteractionId\x20IN\x20?',_[_0xbdac('0x3c')](_0x28f252,'id'));return db[_0xbdac('0xa3')]['query'](_0x144b97[_0xbdac('0xa4')](),_0x3cc2e5)[_0xbdac('0x20')](function(_0x43ed7e){var _0x4d6b44=_[_0xbdac('0xb4')](_0x43ed7e,_0xbdac('0xb5'));var _0x49feb1=[];_0x28f252[_0xbdac('0x41')](function(_0xfabdea){_0x49feb1[_0xbdac('0xb6')](updateChatInteraction(_0xfabdea,_0x3f50f9,_0x4d6b44));});return BPromise[_0xbdac('0xb7')](_0x49feb1);});});})[_0xbdac('0x20')](function(_0x1a5110){_0x4a8699[_0xbdac('0xb8')]=_0x1a5110;return _0x4a8699;})[_0xbdac('0x20')](respondWithFilteredResult(_0x17da66,_0x334492))[_0xbdac('0x2b')](handleError(_0x17da66,null));};exports[_0xbdac('0xb9')]=function(_0xd9e58e,_0x55ae9e){var _0x596977={'raw':![],'where':{'id':_0xd9e58e[_0xbdac('0xba')]['id']}},_0x1b19f8={};_0x1b19f8[_0xbdac('0x47')]=_[_0xbdac('0x49')](db[_0xbdac('0x43')][_0xbdac('0x44')]);_0x1b19f8[_0xbdac('0x48')]=_[_0xbdac('0x49')](_0xd9e58e[_0xbdac('0x48')]);_0x1b19f8[_0xbdac('0x4a')]=_[_0xbdac('0x4b')](_0x1b19f8[_0xbdac('0x47')],_0x1b19f8[_0xbdac('0x48')]);_0x596977[_0xbdac('0x4c')]=_['intersection'](_0x1b19f8[_0xbdac('0x47')],qs[_0xbdac('0x4d')](_0xd9e58e[_0xbdac('0x48')][_0xbdac('0x4d')]));_0x596977['attributes']=_0x596977[_0xbdac('0x4c')]['length']?_0x596977[_0xbdac('0x4c')]:_0x1b19f8[_0xbdac('0x47')];if(_0xd9e58e[_0xbdac('0x48')][_0xbdac('0xbb')]){_0x596977['include']=[{'all':!![]}];}_0x596977=_[_0xbdac('0xa5')]({},_0x596977,_0xd9e58e[_0xbdac('0xbc')]);return db['ChatInteraction'][_0xbdac('0x69')](_0x596977)[_0xbdac('0x20')](handleEntityNotFound(_0x55ae9e,null))['then'](respondWithResult(_0x55ae9e,null))[_0xbdac('0x2b')](handleError(_0x55ae9e,null));};exports[_0xbdac('0xbd')]=function(_0x20461a,_0x378f2c){return db[_0xbdac('0x43')][_0xbdac('0xbd')](_0x20461a[_0xbdac('0x7d')],{})['then'](respondWithResult(_0x378f2c,0xc9))['catch'](handleError(_0x378f2c,null));};exports[_0xbdac('0xbe')]=function(_0x3bb42d,_0x25d913){if(_0x3bb42d['body']['id']){delete _0x3bb42d[_0xbdac('0x7d')]['id'];}return db[_0xbdac('0x43')][_0xbdac('0x69')]({'where':{'id':_0x3bb42d['params']['id']}})[_0xbdac('0x20')](handleEntityNotFound(_0x25d913,null))[_0xbdac('0x20')](saveUpdates(_0x3bb42d[_0xbdac('0x7d')],null))[_0xbdac('0x20')](respondWithResult(_0x25d913,null))[_0xbdac('0x2b')](handleError(_0x25d913,null));};exports['destroy']=function(_0x5551f4,_0x2f2514){return db[_0xbdac('0x43')][_0xbdac('0x69')]({'where':{'id':_0x5551f4[_0xbdac('0xba')]['id']}})['then'](handleEntityNotFound(_0x2f2514,null))[_0xbdac('0x20')](removeEntity(_0x2f2514,null))[_0xbdac('0x2b')](handleError(_0x2f2514,null));};exports[_0xbdac('0xbf')]=function(_0x329767,_0xa07efa){return db[_0xbdac('0x43')][_0xbdac('0xbf')]()[_0xbdac('0x20')](respondWithResult(_0xa07efa,null))['catch'](handleError(_0xa07efa,null));};exports[_0xbdac('0xc0')]=function(_0x55766e,_0x9ea734){var _0x22c0c1=_0x55766e['params']['id'];var _0x178aaf;var _0xa208f9;var _0x4696ed;return db[_0xbdac('0x43')][_0xbdac('0xc1')]({'where':{'id':_0x22c0c1}})[_0xbdac('0x20')](function(_0x19ca31){_0x178aaf=_0x19ca31;return db[_0xbdac('0xc2')]['findOne']({'where':{'id':_0x19ca31[_0xbdac('0xa2')]},'attributes':['id',_0xbdac('0xc3'),_0xbdac('0xc4')],'raw':!![]});})['then'](function(_0x21b6fc){if(_0x21b6fc&&_0x21b6fc['vidaooApiKey']&&_0x21b6fc[_0xbdac('0xc4')]){_0xa208f9=_0x21b6fc;var _0x2b9c5b={'rejectUnauthorized':![],'method':_0xbdac('0xc5'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x21b6fc['vidaooApiKey']},'body':{'name':'MotionCWB:'+_0x22c0c1},'redirect':_0xbdac('0xc6'),'json':!![]};return rp(_0x2b9c5b);}else{throw new db[(_0xbdac('0xc7'))]['ValidationError'](_0xbdac('0xc8'));}})[_0xbdac('0x20')](function(_0x2da5d6){_0x4696ed=_0x2da5d6;if(_0x4696ed['id']){var _0x1ee390={'body':_0x4696ed[_0xbdac('0xc9')],'ChatWebsiteId':_0xa208f9['id'],'ChatInteractionId':_0x178aaf['id'],'direction':_0xbdac('0xca'),'UserId':_0x55766e[_0xbdac('0x9d')]['id']};return db[_0xbdac('0xcb')][_0xbdac('0xbd')](_0x1ee390,{});}else{throw new db[(_0xbdac('0xc7'))][(_0xbdac('0xcc'))](_0xbdac('0xcd'));}})['then'](function(){return _0x178aaf[_0xbdac('0xce')]({'vidaooSessionId':_0x4696ed['id']});})[_0xbdac('0x20')](respondWithResult(_0x9ea734,null))[_0xbdac('0x2b')](handleError(_0x9ea734,null));};exports[_0xbdac('0xcf')]=function(_0x2221ff,_0x135f15){if(_0x2221ff[_0xbdac('0x7d')]['id']){delete _0x2221ff[_0xbdac('0x7d')]['id'];}return db['ChatInteraction'][_0xbdac('0x69')]({'where':{'id':_0x2221ff[_0xbdac('0xba')]['id']}})[_0xbdac('0x20')](handleEntityNotFound(_0x135f15,null))[_0xbdac('0x20')](saveUpdates(_0x2221ff[_0xbdac('0x7d')],null))[_0xbdac('0x20')](respondWithResult(_0x135f15,null))[_0xbdac('0x2b')](handleError(_0x135f15,null));};exports[_0xbdac('0xd0')]=function(_0x13bdc3,_0x59bd7f,_0xdc5023){if(_0x13bdc3[_0xbdac('0x7d')]['id']){delete _0x13bdc3[_0xbdac('0x7d')]['id'];}return db[_0xbdac('0x43')][_0xbdac('0x69')]({'where':{'id':_0x13bdc3['params']['id']}})['then'](function(_0x59adff){if(!_0x59adff){logger[_0xbdac('0x26')](_0xbdac('0xd1'),_0xbdac('0xd0'),0x194,_0xbdac('0xd2'));_0x59bd7f[_0xbdac('0x37')](0x194);}else{if(_0x59adff[_0xbdac('0x7b')]){throw new db[(_0xbdac('0xc7'))][(_0xbdac('0xcc'))]('Interaction\x20already\x20assigned');}}return _0x59adff;})[_0xbdac('0x20')](function(_0x5b48a5){if(_0x5b48a5){return _0x5b48a5[_0xbdac('0xbe')]({'closed':_0x13bdc3[_0xbdac('0x7d')][_0xbdac('0xd3')],'disposition':_0x13bdc3[_0xbdac('0x7d')][_0xbdac('0xd4')]})[_0xbdac('0x20')](function(_0x555613){return _0x555613;});}})['then'](function(_0xfc5f67){return respondWithRpcPromise('AbandonInteraction',_0xbdac('0xd0'),_0x13bdc3[_0xbdac('0x7d')],client9004);})[_0xbdac('0x20')](respondWithResult(_0x59bd7f,null))[_0xbdac('0x2b')](handleError(_0x59bd7f,null));};exports[_0xbdac('0xd5')]=function(_0xadba88,_0xf85da9,_0x4f9cc1){_0xadba88[_0xbdac('0x7d')][_0xbdac('0x39')]=_0xadba88[_0xbdac('0xd6')][_0xbdac('0xd7')];_0xadba88[_0xbdac('0x7d')][_0xbdac('0xd8')]=_0xadba88[_0xbdac('0xd6')][_0xbdac('0xd9')];_0xadba88['body'][_0xbdac('0x46')]=_0xadba88['file'][_0xbdac('0xda')];return db[_0xbdac('0xdb')][_0xbdac('0xbd')](_0xadba88[_0xbdac('0x7d')])[_0xbdac('0x20')](respondWithResult(_0xf85da9,0xc9))[_0xbdac('0x2b')](handleError(_0xf85da9,null));};exports[_0xbdac('0xdc')]=function(_0x22a043,_0x46fc58,_0x4f4dae){return db[_0xbdac('0x43')][_0xbdac('0xc1')]({'where':{'id':_0x22a043[_0xbdac('0xba')]['id']},'raw':!![]})[_0xbdac('0x20')](handleEntityNotFound(_0x46fc58,null))[_0xbdac('0x20')](function(_0x56d003){if(_0x56d003){if(_0x56d003[_0xbdac('0xd3')]){return _0x46fc58[_0xbdac('0x2c')](0x193)[_0xbdac('0x2e')]({'status':0x193,'message':_0xbdac('0xdd')});}return db['Attachment']['findOne']({'where':{'id':_0x22a043[_0xbdac('0x48')][_0xbdac('0xde')]},'raw':!![]})['then'](handleEntityNotFound(_0x46fc58,null));}})['then'](function(_0xa35ecd){if(_0xa35ecd){return _0x46fc58[_0xbdac('0xdf')](path[_0xbdac('0xe0')](config['root'],'server/files/attachments/',_0xa35ecd[_0xbdac('0xd8')]));}})[_0xbdac('0x2b')](handleError(_0x46fc58,null));};exports['close']=function(_0x2ce32a,_0x5ec87a){var _0x422c3e=null;var _0x55f9da=null;var _0x5370c4=null;var _0xbc1b24=null;if(_0x2ce32a[_0xbdac('0x7d')]['id']){delete _0x2ce32a[_0xbdac('0x7d')]['id'];}if(_0x2ce32a['body'][_0xbdac('0xe1')]){_0xbc1b24=path[_0xbdac('0xe0')](config['root'],'server/files/chat/upload/',util[_0xbdac('0xe2')](_0xbdac('0xe3'),Date[_0xbdac('0xe4')]()));_0x2ce32a[_0xbdac('0x7d')]['pathTranscript']=_0xbc1b24;}return db[_0xbdac('0x43')][_0xbdac('0x69')]({'where':{'id':_0x2ce32a[_0xbdac('0xba')]['id']},'include':[{'model':db[_0xbdac('0xcb')],'as':_0xbdac('0xe5'),'include':[{'model':db[_0xbdac('0xe6')],'as':_0xbdac('0xe6')}]}]})[_0xbdac('0x20')](handleEntityNotFound(_0x5ec87a,null))[_0xbdac('0x20')](saveUpdates(_0x2ce32a['body'],null))[_0xbdac('0x20')](function(_0x1ea03e){if(_0x1ea03e){_0x422c3e=_0x1ea03e;return db['ChatWebsite'][_0xbdac('0x69')]({'where':{'id':_0x422c3e['ChatWebsiteId']}});}})['then'](function(_0x5904a9){if(_0x5904a9){_0x5370c4=_0x5904a9;return db['CmContact'][_0xbdac('0x69')]({'where':{'id':_0x422c3e[_0xbdac('0x73')]}});}})[_0xbdac('0x20')](function(_0x2b11ad){if(_0x2b11ad){_0x55f9da=_0x2b11ad;if(_0xbc1b24){var _0x307d77=null;for(var _0x390581=0x1;_0x390581<_0x422c3e['Messages'][_0xbdac('0x68')];++_0x390581){_0x307d77=_0x422c3e[_0xbdac('0xe5')][_0x390581];var _0x12ecc7=_0x307d77[_0xbdac('0x7b')]?util['format']('%s%d',_0x5370c4['agentAlias'],_0x307d77[_0xbdac('0x7b')]):'System';var _0x4e9347=_0x2ce32a[_0xbdac('0x7d')][_0xbdac('0xe7')]||util[_0xbdac('0xe2')](_0xbdac('0xe8'),'Visitor',_0x307d77[_0xbdac('0x73')]);switch(_0x5370c4[_0xbdac('0xe9')]){case _0xbdac('0xea'):_0x12ecc7=_0x307d77[_0xbdac('0x7b')]?util[_0xbdac('0xe2')](_0xbdac('0xe8'),_0x5370c4[_0xbdac('0xeb')],_0x307d77[_0xbdac('0x7b')]):_0xbdac('0xec');break;case'agent_alias':_0x12ecc7=_0x307d77[_0xbdac('0x7b')]?_0x307d77['User'][_0xbdac('0xed')]||_0x307d77[_0xbdac('0xe6')]['fullname']:_0xbdac('0xec');break;case _0xbdac('0xee'):_0x12ecc7=_0x307d77[_0xbdac('0x7b')]?_0x307d77[_0xbdac('0xe6')]['fullname']:'System';break;default:_0x12ecc7=_0x307d77[_0xbdac('0x7b')]?util[_0xbdac('0xe2')]('%s%d',_0x5370c4['agentAlias'],_0x307d77['UserId']):_0xbdac('0xec');}var _0xec96a8=util[_0xbdac('0xe2')](_0xbdac('0xef'),moment(_0x307d77[_0xbdac('0x83')])['format'](_0xbdac('0xf0')),_0x307d77[_0xbdac('0xf1')]==='in'?_0x4e9347:_0x12ecc7,_0x307d77[_0xbdac('0x7d')]);if(!_0x307d77[_0xbdac('0xf2')]){fs[_0xbdac('0xf3')](_0xbc1b24,_0xec96a8);}}return db[_0xbdac('0xf4')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0xbdac('0x20')](function(_0x3b01c6){if(_0x3b01c6&&_0x3b01c6[_0xbdac('0xf5')]&&_0x2ce32a[_0xbdac('0x7d')]){var _0x382cb9={'tls':{'rejectUnauthorized':![]}};if(_0x3b01c6[_0xbdac('0xf5')][_0xbdac('0xf6')]){_0x382cb9[_0xbdac('0xf6')]=_0x3b01c6['Smtp'][_0xbdac('0xf6')];}else{_0x382cb9[_0xbdac('0xf7')]=_0x3b01c6[_0xbdac('0xf5')]['host'];_0x382cb9[_0xbdac('0xf8')]=_0x3b01c6[_0xbdac('0xf5')][_0xbdac('0xf8')];_0x382cb9[_0xbdac('0xf9')]=_0x3b01c6['Smtp']['secure'];}if(_0x3b01c6[_0xbdac('0xf5')][_0xbdac('0xfa')]){_0x382cb9[_0xbdac('0xfb')]={'user':_0x3b01c6['Smtp'][_0xbdac('0x9d')],'pass':_0x3b01c6[_0xbdac('0xf5')][_0xbdac('0xfc')]};}return respondWithRpcPromise(_0xbdac('0xfd'),_0xbdac('0xfe'),{'account':_0x382cb9,'message':{'from':util[_0xbdac('0xe2')](_0xbdac('0xff'),_0x3b01c6['name'],_0x3b01c6['email']||_0x3b01c6[_0xbdac('0xf5')][_0xbdac('0x9d')]),'to':_0x2ce32a[_0xbdac('0x7d')][_0xbdac('0xe1')],'subject':'Mail\x20Transcript','text':util[_0xbdac('0xe2')](_0xbdac('0x100'),_0x2ce32a['body'][_0xbdac('0xe1')]),'attachments':[{'path':_0xbc1b24}]}})[_0xbdac('0x20')](function(){return _0x422c3e;})[_0xbdac('0x2b')](function(_0x9a87ce){console[_0xbdac('0x26')](_0x9a87ce);});}else{return _0x422c3e;}})[_0xbdac('0x20')](respondWithStatusCode(_0x5ec87a,0xc8))[_0xbdac('0x2b')](handleError(_0x5ec87a,null));};exports[_0xbdac('0x101')]=function(_0x2f4807,_0x4faa27,_0x4fa3f6){return db[_0xbdac('0xcb')][_0xbdac('0x69')]({'where':{'id':_0x2f4807['params']['id']}})[_0xbdac('0x20')](handleEntityNotFound(_0x4faa27,null))[_0xbdac('0x20')](function(_0x3dd7b4){if(_0x3dd7b4){return _0x3dd7b4['addMessage'](_0x2f4807[_0xbdac('0x7d')]['ids'],_[_0xbdac('0x102')](_0x2f4807[_0xbdac('0x7d')],[_0xbdac('0x103'),'id'])||{});}})[_0xbdac('0x20')](respondWithResult(_0x4faa27,null))[_0xbdac('0x2b')](handleError(_0x4faa27,null));};exports[_0xbdac('0x104')]=function(_0x1b1dcb,_0x9fe2bd,_0x4fe877){var _0x358749={'raw':![],'where':{}};var _0x3e8377={};var _0x2ee791={'count':0x0,'rows':[]};return db[_0xbdac('0x43')][_0xbdac('0xc1')]({'where':{'id':_0x1b1dcb[_0xbdac('0xba')]['id']}})['then'](handleEntityNotFound(_0x9fe2bd,null))['then'](function(_0x100975){if(_0x100975){_0x3e8377[_0xbdac('0x47')]=_['keys'](db[_0xbdac('0xcb')][_0xbdac('0x44')]);_0x3e8377[_0xbdac('0x48')]=_[_0xbdac('0x49')](_0x1b1dcb[_0xbdac('0x48')]);_0x3e8377[_0xbdac('0x4a')]=_['intersection'](_0x3e8377[_0xbdac('0x47')],_0x3e8377[_0xbdac('0x48')]);_0x358749[_0xbdac('0x4c')]=_[_0xbdac('0x4b')](_0x3e8377[_0xbdac('0x47')],qs[_0xbdac('0x4d')](_0x1b1dcb[_0xbdac('0x48')]['fields']));_0x358749['attributes']=_0x358749[_0xbdac('0x4c')][_0xbdac('0x68')]?_0x358749[_0xbdac('0x4c')]:_0x3e8377[_0xbdac('0x47')];if(!_0x1b1dcb['query'][_0xbdac('0x4e')]('nolimit')){_0x358749[_0xbdac('0x31')]=qs[_0xbdac('0x31')](_0x1b1dcb['query'][_0xbdac('0x31')]);_0x358749[_0xbdac('0x30')]=qs[_0xbdac('0x30')](_0x1b1dcb['query'][_0xbdac('0x30')]);}_0x358749[_0xbdac('0x4f')]=qs[_0xbdac('0x50')](_0x1b1dcb['query']['sort']);_0x358749[_0xbdac('0x87')]=qs[_0xbdac('0x4a')](_[_0xbdac('0x105')](_0x1b1dcb[_0xbdac('0x48')],_0x3e8377[_0xbdac('0x4a')]));_0x358749[_0xbdac('0x87')][_0xbdac('0xb5')]=_0x100975['id'];if(_0x1b1dcb[_0xbdac('0x48')][_0xbdac('0x90')]){_0x358749[_0xbdac('0x87')]=_[_0xbdac('0xa5')](_0x358749[_0xbdac('0x87')],{'$or':_[_0xbdac('0x3c')](_0x358749[_0xbdac('0x4c')],function(_0x2c473a){var _0x389f95={};_0x389f95[_0x2c473a]={'$like':'%'+_0x1b1dcb[_0xbdac('0x48')][_0xbdac('0x90')]+'%'};return _0x389f95;})});}if(_0x1b1dcb[_0xbdac('0x48')][_0xbdac('0x85')]){var _0x1115ef=_0x1b1dcb[_0xbdac('0x48')]['$gte'][_0xbdac('0x40')](',');var _0x5a7f63={};_0x5a7f63[_0x1115ef[0x0]]={'$gte':moment(_0x1115ef[0x1])[_0xbdac('0xe2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x358749[_0xbdac('0x87')]=_['merge'](_0x358749[_0xbdac('0x87')],_0x5a7f63);}_0x358749=_[_0xbdac('0xa5')]({},_0x358749,_0x1b1dcb[_0xbdac('0xbc')]);return db[_0xbdac('0xcb')][_0xbdac('0x2f')]({'where':_0x358749[_0xbdac('0x87')]})[_0xbdac('0x20')](function(_0x5b354b){_0x2ee791[_0xbdac('0x2f')]=_0x5b354b;if(_0x1b1dcb[_0xbdac('0x48')]['includeAll']){_0x358749[_0xbdac('0x106')]=[{'all':!![]}];}return db[_0xbdac('0xcb')][_0xbdac('0x107')](_0x358749);})[_0xbdac('0x20')](function(_0x13bdb4){_0x2ee791[_0xbdac('0xb8')]=_0x13bdb4;return _0x2ee791;});}})[_0xbdac('0x20')](respondWithFilteredResult(_0x9fe2bd,_0x358749))[_0xbdac('0x2b')](handleError(_0x9fe2bd,null));};exports[_0xbdac('0x108')]=function(_0x11e80d,_0x2154da,_0x4c96f4){var _0x5a6868={'where':{}},_0x5f1d9b={},_0x169a1c={'count':0x0,'rows':[]};return db[_0xbdac('0x43')][_0xbdac('0xc1')]({'where':{'id':_0x11e80d[_0xbdac('0xba')]['id']}})[_0xbdac('0x20')](handleEntityNotFound(_0x2154da,null))['then'](function(_0x287035){if(_0x287035){_0x5f1d9b['model']=_[_0xbdac('0x49')](db[_0xbdac('0xcb')]['rawAttributes']);_0x5f1d9b[_0xbdac('0x48')]=_[_0xbdac('0x49')](_0x11e80d[_0xbdac('0x48')]);_0x5f1d9b[_0xbdac('0x4a')]=_['intersection'](_0x5f1d9b['model'],_0x5f1d9b[_0xbdac('0x48')]);_0x5a6868[_0xbdac('0x4c')]=_[_0xbdac('0x4b')](_0x5f1d9b[_0xbdac('0x47')],qs['fields'](_0x11e80d[_0xbdac('0x48')][_0xbdac('0x4d')]));_0x5a6868[_0xbdac('0x4c')]=_0x5a6868['attributes']['length']?_0x5a6868['attributes']:_0x5f1d9b['model'];if(!_0x11e80d[_0xbdac('0x48')]['hasOwnProperty']('nolimit')){_0x5a6868[_0xbdac('0x31')]=qs['limit'](_0x11e80d[_0xbdac('0x48')][_0xbdac('0x31')]);_0x5a6868[_0xbdac('0x30')]=qs[_0xbdac('0x30')](_0x11e80d[_0xbdac('0x48')][_0xbdac('0x30')]);}_0x5a6868[_0xbdac('0x4f')]=qs[_0xbdac('0x50')](_0x11e80d[_0xbdac('0x48')][_0xbdac('0x50')]);_0x5a6868[_0xbdac('0x87')]=qs['filters'](_[_0xbdac('0x105')](_0x11e80d['query'],_0x5f1d9b[_0xbdac('0x4a')]));_0x5a6868['where'][_0xbdac('0xb5')]=_0x287035['id'];if(_0x11e80d[_0xbdac('0x48')][_0xbdac('0x90')]){_0x5a6868[_0xbdac('0x87')]=_[_0xbdac('0xa5')](_0x5a6868[_0xbdac('0x87')],{'$or':_[_0xbdac('0x3c')](_0x5a6868['attributes'],function(_0x1e2f6c){var _0x461e10={};_0x461e10[_0x1e2f6c]={'$like':'%'+_0x11e80d[_0xbdac('0x48')]['filter']+'%'};return _0x461e10;})});}_0x5a6868[_0xbdac('0x87')]['secret']=![];if(_0x11e80d[_0xbdac('0x48')]['id']){_0x5a6868[_0xbdac('0x87')]['id']={'$gt':_0x11e80d['query']['id']};}_0x5a6868=_[_0xbdac('0xa5')]({},_0x5a6868,_0x11e80d[_0xbdac('0xbc')]);return db[_0xbdac('0xcb')][_0xbdac('0x2f')]({'where':_0x5a6868['where']})[_0xbdac('0x20')](function(_0x23deec){_0x169a1c[_0xbdac('0x2f')]=_0x23deec;_0x5a6868[_0xbdac('0x106')]=[];if(_0x11e80d[_0xbdac('0x48')][_0xbdac('0x109')]){_0x5a6868['include'][_0xbdac('0xb6')]({'model':db[_0xbdac('0xe6')],'as':_0xbdac('0xe6'),'attributes':['id','fullname',_0xbdac('0xed')]});}if(_0x11e80d[_0xbdac('0x48')][_0xbdac('0xbb')]){_0x5a6868[_0xbdac('0x106')]=[{'all':!![]}];}return db[_0xbdac('0xcb')][_0xbdac('0x107')](_0x5a6868);})[_0xbdac('0x20')](function(_0x219095){_0x169a1c[_0xbdac('0xb8')]=_0x219095;return _0x169a1c;});}})['then'](respondWithFilteredResult(_0x2154da,_0x5a6868))['catch'](handleError(_0x2154da,null));};exports[_0xbdac('0x10a')]=function(_0xa932f4,_0x4f5631,_0x1f2312){return db[_0xbdac('0x43')]['find']({'where':{'id':_0xa932f4[_0xbdac('0xba')]['id']}})[_0xbdac('0x20')](handleEntityNotFound(_0x4f5631,null))[_0xbdac('0x20')](function(_0x34c13e){if(_0x34c13e){return _0x34c13e[_0xbdac('0x10b')](_0xa932f4['body']['ids'],_[_0xbdac('0x102')](_0xa932f4[_0xbdac('0x7d')],[_0xbdac('0x103'),'id'])||{})[_0xbdac('0x10c')](function(){return db[_0xbdac('0x76')][_0xbdac('0x107')]({'attributes':['id',_0xbdac('0x39'),_0xbdac('0x53')],'where':{'id':_0xa932f4[_0xbdac('0x7d')]['ids']}});})[_0xbdac('0x20')](function(_0x40b21d){socket[_0xbdac('0x10d')](_0xbdac('0x10e'),{'id':Number(_0xa932f4[_0xbdac('0xba')]['id']),'tags':_0x40b21d||[]});return{'id':Number(_0xa932f4['params']['id']),'tags':_0x40b21d||[]};});}})[_0xbdac('0x20')](respondWithResult(_0x4f5631,null))[_0xbdac('0x2b')](handleError(_0x4f5631,null));};exports['removeTags']=function(_0x219f03,_0x3bf083,_0x3108c0){return db[_0xbdac('0x43')][_0xbdac('0x69')]({'where':{'id':_0x219f03[_0xbdac('0xba')]['id']}})[_0xbdac('0x20')](handleEntityNotFound(_0x3bf083,null))['then'](function(_0x4da676){if(_0x4da676){return _0x4da676['removeTags'](_0x219f03['query'][_0xbdac('0x103')]);}})[_0xbdac('0x20')](respondWithStatusCode(_0x3bf083,null))[_0xbdac('0x2b')](handleError(_0x3bf083,null));};exports[_0xbdac('0xdf')]=function(_0x3d4e28,_0x242587){var _0x386ead=moment()[_0xbdac('0x10f')]()['toString']();var _0x4520b1=path[_0xbdac('0xe0')](config[_0xbdac('0x110')],'server',_0xbdac('0x111'),_0xbdac('0x112'));var _0x39a719=path['join'](config['root'],_0xbdac('0x113'),_0xbdac('0x111'),_0xbdac('0x114'));var _0xa80301=path[_0xbdac('0xe0')](_0x4520b1,_0x386ead);var _0x1ed563=util[_0xbdac('0xe2')]('transcript-%d-%s.zip',_0x3d4e28['params']['id'],_0x386ead);var _0x52fef2=path['join'](_0x4520b1,_0x1ed563);var _0x7e813f=[];_0x7e813f[_0xbdac('0xb6')]({'model':db['User'],'as':_0xbdac('0xe6'),'attributes':['id',_0xbdac('0x3d')],'raw':!![]});_0x7e813f['push']({'model':db['CmContact'],'as':_0xbdac('0x6f'),'attributes':['id',_0xbdac('0x115'),'lastName'],'raw':!![]});if(_0x3d4e28[_0xbdac('0x48')][_0xbdac('0x114')]){_0x7e813f['push']({'model':db[_0xbdac('0xdb')],'as':_0xbdac('0xdb'),'raw':!![]});}var _0x3cde99=[{'model':db[_0xbdac('0xcb')],'as':_0xbdac('0xe5'),'attributes':['id',_0xbdac('0x7d'),'createdAt',_0xbdac('0xf1'),'secret',_0xbdac('0x8b')],'include':_0x7e813f}];_0x3cde99[_0xbdac('0xb6')]({'model':db['ChatWebsite'],'as':_0xbdac('0x116'),'attributes':['id','name']});_0x3cde99['push']({'model':db[_0xbdac('0xe6')],'as':'Owner','attributes':['id',_0xbdac('0x3d')]});return db[_0xbdac('0x43')][_0xbdac('0x69')]({'where':{'id':_0x3d4e28[_0xbdac('0xba')]['id']},'include':_0x3cde99})[_0xbdac('0x20')](handleEntityNotFound(_0x242587,null))[_0xbdac('0x20')](function(_0x28ce74){if(_0x28ce74){var _0x3e76ee=_0x28ce74[_0xbdac('0x117')]({'plain':!![]});fs['mkdirSync'](_0xa80301);var _0x5197c2={'format':'A4','border':_0xbdac('0x118'),'header':{'height':_0xbdac('0x119'),'contents':{'first':_0xbdac('0x11a')}},'footer':{'height':_0xbdac('0x11b'),'contents':{'default':util[_0xbdac('0xe2')](_0xbdac('0x11c'),util[_0xbdac('0xe2')](_0xbdac('0x11d'),'Chat',_0x3e76ee['id']),moment()[_0xbdac('0xe2')](_0xbdac('0x11e'))[_0xbdac('0xa4')]())}}};var _0x49e9f0={'channel':'Chat','account':_0x3e76ee[_0xbdac('0x116')][_0xbdac('0x39')],'agent':_0x3e76ee[_0xbdac('0x11f')]?_0x3e76ee[_0xbdac('0x11f')]['fullname']:_0xbdac('0x120'),'createdAt':moment(_0x3e76ee['createdAt'])[_0xbdac('0xe2')](_0xbdac('0x121'))[_0xbdac('0xa4')](),'closedAt':_0x3e76ee[_0xbdac('0xd3')]?moment(_0x3e76ee[_0xbdac('0x122')])['format'](_0xbdac('0x121'))[_0xbdac('0xa4')]():'','disposition':_0x3e76ee[_0xbdac('0xd4')],'chatInfo':{'browser':_0x3e76ee[_0xbdac('0x123')],'os':_0x3e76ee[_0xbdac('0x124')],'referer':_0x3e76ee[_0xbdac('0x125')],'customerIp':_0x3e76ee[_0xbdac('0x126')],'customerPort':_0x3e76ee[_0xbdac('0x127')]?_0x3e76ee[_0xbdac('0x127')]:_0xbdac('0x120')},'messages':_(_0x3e76ee['Messages'])['tail']()[_0xbdac('0x90')]({'secret':![]})['map'](function(_0x367bea){if(_0x367bea[_0xbdac('0xdb')]){var _0x4768de=path[_0xbdac('0xe0')](_0x39a719,_0x367bea['Attachment'][_0xbdac('0xd8')]);if(fs[_0xbdac('0x128')](_0x4768de)){fs[_0xbdac('0x129')](_0x4768de)[_0xbdac('0x12a')](fs[_0xbdac('0x12b')](path['join'](_0xa80301,_0x367bea[_0xbdac('0xdb')][_0xbdac('0xd8')])));}}return{'date':moment(_0x367bea[_0xbdac('0x83')])[_0xbdac('0xe2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbdac('0xa4')](),'sender':_0x367bea[_0xbdac('0xf1')]===_0xbdac('0xca')?_0x367bea[_0xbdac('0xe6')]?_0x367bea['User']['fullname']:_0xbdac('0xec'):_0x367bea['Contact'][_0xbdac('0x115')]+(_0x367bea['Contact'][_0xbdac('0x12c')]?'\x20'+_0x367bea[_0xbdac('0x6f')][_0xbdac('0x12c')]:''),'body':_0x367bea[_0xbdac('0xdb')]?_0x367bea['Attachment']['basename']:_0x367bea[_0xbdac('0x7d')],'direction':_0x367bea[_0xbdac('0xf1')]===_0xbdac('0xca')?'A':'C','secret':_0x367bea['secret'],'read':_0x367bea[_0xbdac('0x8b')],'attachment':_0x367bea[_0xbdac('0xdb')]};})[_0xbdac('0x6b')]()};return ejs[_0xbdac('0x12d')](path['join'](config[_0xbdac('0x110')],_0xbdac('0x113'),'views','downloadInteraction.html'),{'interaction':_0x49e9f0})[_0xbdac('0x20')](function(_0x545dc3){return new BPromise(function(_0x5e94e9,_0x15cb13){pdf['create'](_0x545dc3,_0x5197c2)['toFile'](path[_0xbdac('0xe0')](_0xa80301,_0xbdac('0x12e')+_0x3e76ee['id']+'-'+_0x386ead+'.pdf'),function(_0xba16b2,_0x42cdc1){if(_0xba16b2)return _0x15cb13(_0xba16b2);_0x5e94e9(_0x42cdc1);});});})[_0xbdac('0x20')](function(){return new BPromise(function(_0x58896c,_0x81fa91){zipdir(_0xa80301,{'saveTo':_0x52fef2},function(_0x178e75,_0x821535){if(_0x178e75)return _0x81fa91(_0x178e75);return _0x58896c(_0x821535);});})[_0xbdac('0x20')](function(){return new BPromise(function(_0x1093b0,_0x5071e5){rimraf(_0xa80301,function(_0x1d96a2){if(_0x1d96a2)_0x5071e5(_0x1d96a2);return _0x1093b0();});});})[_0xbdac('0x20')](function(){return _0x242587[_0xbdac('0xdf')](_0x52fef2,_0x1ed563,function(_0x2c58ed){if(_0x2c58ed){console[_0xbdac('0x12f')](_0xbdac('0x130'),_0x2c58ed);}else{fs[_0xbdac('0x131')](_0x52fef2);}});});});}else{return _0x242587[_0xbdac('0x37')](0xc8);}})[_0xbdac('0x2b')](handleError(_0x242587,null));}; \ No newline at end of file +var _0x0c62=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','jayson/promise','client','http','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','set','Content-Range','json','reject','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','index','ChatInteraction','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','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','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.lastName','Contact.lastName','c.email','Contact.email','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','params','rawAttributes','includeAll','options','create','describe','createVidaooSession','findOne','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','vidaooApiKey','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','originalname','basename','file','mimetype','Attachment','attachmentDownload','attachId','download','root','server/files/attachments/','close','mailTranscript','join','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','customer','format','Visitor','website_alias','agent_alias','alias','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','hasOwnProperty','include','findAll','getMyMessages','includeAgent','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','ChatWebsite','Account','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','osName','referer','customerIp','customerPort','existsSync','createReadStream','createWriteStream','renderFile','views','downloadInteraction.html','log','err','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x0c62,0x128));var _0x20c6=function(_0x456c89,_0x303bab){_0x456c89=_0x456c89-0x0;var _0x5d2670=_0x0c62[_0x456c89];return _0x5d2670;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x20c6('0x0'));var rimraf=require(_0x20c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20c6('0x2'));var rp=require(_0x20c6('0x3'));var moment=require(_0x20c6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x20c6('0x5'));var util=require(_0x20c6('0x6'));var path=require(_0x20c6('0x7'));var sox=require(_0x20c6('0x8'));var csv=require('to-csv');var ejs=require(_0x20c6('0x9'));var fs=require('fs');var _=require(_0x20c6('0xa'));var squel=require('squel');var crypto=require(_0x20c6('0xb'));var jsforce=require(_0x20c6('0xc'));var deskjs=require(_0x20c6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x20c6('0xe'));var Papa=require(_0x20c6('0xf'));var Redis=require(_0x20c6('0x10'));var authService=require(_0x20c6('0x11'));var qs=require(_0x20c6('0x12'));var as=require(_0x20c6('0x13'));var hardwareService=require(_0x20c6('0x14'));var logger=require(_0x20c6('0x15'))(_0x20c6('0x16'));var utils=require(_0x20c6('0x17'));var config=require(_0x20c6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x20c6('0x19'))['db'];config['redis']=_[_0x20c6('0x1a')](config['redis'],{'host':_0x20c6('0x1b'),'port':0x18eb});var socket=require(_0x20c6('0x1c'))(new Redis(config[_0x20c6('0x1d')]));require(_0x20c6('0x1e'))[_0x20c6('0x1f')](socket);var jayson=require(_0x20c6('0x20'));var client=jayson[_0x20c6('0x21')][_0x20c6('0x22')]({'port':0x232b});var client9004=jayson[_0x20c6('0x21')][_0x20c6('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x5f48b8,_0x169fc4,_0xffd706,_0x56a29a){return new BPromise(function(_0x2ac2d9,_0x19f666){var _0x40c471=_0x56a29a||client;return _0x40c471['request'](_0x5f48b8,_0xffd706)['then'](function(_0x5dcb96){logger[_0x20c6('0x23')](_0x20c6('0x24'),_0x169fc4,_0x20c6('0x25'));logger[_0x20c6('0x26')](_0x20c6('0x27'),_0x169fc4,_0x20c6('0x25'),JSON[_0x20c6('0x28')](_0x5dcb96));if(_0x5dcb96[_0x20c6('0x29')]){if(_0x5dcb96[_0x20c6('0x29')][_0x20c6('0x2a')]===0x1f4){logger[_0x20c6('0x29')](_0x20c6('0x24'),_0x169fc4,_0x5dcb96['error'][_0x20c6('0x2b')]);return _0x19f666(_0x5dcb96[_0x20c6('0x29')][_0x20c6('0x2b')]);}logger['error'](_0x20c6('0x24'),_0x169fc4,_0x5dcb96[_0x20c6('0x29')][_0x20c6('0x2b')]);return _0x2ac2d9(_0x5dcb96[_0x20c6('0x29')]['message']);}else{logger['info'](_0x20c6('0x24'),_0x169fc4,'request\x20sent');_0x2ac2d9(_0x5dcb96[_0x20c6('0x2c')][_0x20c6('0x2b')]);}})[_0x20c6('0x2d')](function(_0x1400ef){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x169fc4,_0x1400ef);_0x19f666(_0x1400ef);});});}function respondWithStatusCode(_0xaab166,_0x5b017e){_0x5b017e=_0x5b017e||0xcc;return function(_0x3a2ff2){if(_0x3a2ff2){return _0xaab166[_0x20c6('0x2e')](_0x5b017e);}return _0xaab166[_0x20c6('0x2f')](_0x5b017e)[_0x20c6('0x30')]();};}function respondWithResult(_0x1669a2,_0x3a182c){_0x3a182c=_0x3a182c||0xc8;return function(_0x57979c){if(_0x57979c){return _0x1669a2[_0x20c6('0x2f')](_0x3a182c)['json'](_0x57979c);}};}function respondWithFilteredResult(_0x1674e0,_0x323491){return function(_0x46eb96){if(_0x46eb96){var _0x5a20df=_0x46eb96['count'],_0x1e6db6=_0x323491[_0x20c6('0x31')],_0x37608c=_0x323491[_0x20c6('0x31')]+_0x323491['limit'],_0x1b3c28;if(_0x37608c>=_0x5a20df){_0x37608c=_0x5a20df;_0x1b3c28=0xc8;}else{_0x1b3c28=0xce;}_0x1674e0[_0x20c6('0x2f')](_0x1b3c28);return _0x1674e0[_0x20c6('0x32')](_0x20c6('0x33'),_0x1e6db6+'-'+_0x37608c+'/'+_0x5a20df)[_0x20c6('0x34')](_0x46eb96);}return null;};}function patchUpdates(_0x15a3db){return function(_0x2d3650){try{jsonpatch['apply'](_0x2d3650,_0x15a3db,!![]);}catch(_0x303cc7){return BPromise[_0x20c6('0x35')](_0x303cc7);}return _0x2d3650['save']();};}function saveUpdates(_0x38e3f5,_0x291845){return function(_0x8ca54b){if(_0x8ca54b){return _0x8ca54b[_0x20c6('0x36')](_0x38e3f5)[_0x20c6('0x37')](function(_0x4cf314){return _0x4cf314;});}return null;};}function removeEntity(_0x13fbf4,_0x6b6be6){return function(_0x101b73){if(_0x101b73){return _0x101b73[_0x20c6('0x38')]()[_0x20c6('0x37')](function(){_0x13fbf4[_0x20c6('0x2f')](0xcc)[_0x20c6('0x30')]();});}};}function handleEntityNotFound(_0x303afb,_0x3ecaf0){return function(_0x50d99c){if(!_0x50d99c){_0x303afb[_0x20c6('0x2e')](0x194);}return _0x50d99c;};}function handleError(_0x59eb27,_0x75a7bd){_0x75a7bd=_0x75a7bd||0x1f4;return function(_0x3bc232){logger[_0x20c6('0x29')](_0x3bc232[_0x20c6('0x39')]);if(_0x3bc232['name']){delete _0x3bc232[_0x20c6('0x3a')];}_0x59eb27['status'](_0x75a7bd)[_0x20c6('0x3b')](_0x3bc232);};}function getInteractionUsers(_0x5c0b34,_0x3a16c5){return new BPromise(function(_0x366b49,_0x57d2be){try{if(_0x3a16c5[_0x5c0b34['id']]){_0x5c0b34[_0x20c6('0x3c')]=_[_0x20c6('0x3d')](_0x3a16c5[_0x5c0b34['id']],function(_0x37e7c3){return{'id':_0x37e7c3['id'],'fullname':_0x37e7c3[_0x20c6('0x3e')]};});}}catch(_0x32aa5c){_0x57d2be(_0x32aa5c);}_0x366b49(_0x5c0b34);});}function getInteractionTags(_0x1637bb,_0x3b8b3f){return new BPromise(function(_0x54c9e7,_0x3839b6){try{if(_0x1637bb[_0x20c6('0x3f')]){_0x1637bb['Tags']=[];_0x1637bb['TagIds'][_0x20c6('0x40')](',')[_0x20c6('0x41')](function(_0x1eaedb){_0x1637bb[_0x20c6('0x42')][_0x20c6('0x43')](_0x3b8b3f[_0x1eaedb]);});}delete _0x1637bb[_0x20c6('0x3f')];}catch(_0x3769a7){_0x3839b6(_0x3769a7);}_0x54c9e7(_0x1637bb);});}function updateChatInteraction(_0x56c9dd,_0x284de1,_0x3da4a6){return new BPromise(function(_0x33afda,_0x156cb7){return getInteractionUsers(_0x56c9dd,_0x3da4a6)[_0x20c6('0x37')](function(_0x1f432b){return getInteractionTags(_0x1f432b,_0x284de1);})[_0x20c6('0x37')](function(_0x224338){_0x33afda(_0x224338);})[_0x20c6('0x2d')](function(_0x450387){_0x156cb7(_0x450387);});});}exports[_0x20c6('0x44')]=function(_0x37d7e6,_0x283cbc){var _0x23acb5={},_0x476ace={},_0xdfb264={'count':0x0,'rows':[]};var _0x27bcea=_[_0x20c6('0x3d')](db[_0x20c6('0x45')]['rawAttributes'],function(_0x420fa1){return{'name':_0x420fa1[_0x20c6('0x46')],'type':_0x420fa1['type'][_0x20c6('0x47')]};});_0x476ace[_0x20c6('0x48')]=_[_0x20c6('0x3d')](_0x27bcea,_0x20c6('0x3a'));_0x476ace[_0x20c6('0x49')]=_[_0x20c6('0x4a')](_0x37d7e6['query']);_0x476ace[_0x20c6('0x4b')]=_[_0x20c6('0x4c')](_0x476ace[_0x20c6('0x48')],_0x476ace[_0x20c6('0x49')]);_0x23acb5[_0x20c6('0x4d')]=_[_0x20c6('0x4c')](_0x476ace[_0x20c6('0x48')],qs['fields'](_0x37d7e6[_0x20c6('0x49')][_0x20c6('0x4e')]));_0x23acb5['attributes']=_0x23acb5[_0x20c6('0x4d')][_0x20c6('0x4f')]?_0x23acb5[_0x20c6('0x4d')]:_0x476ace[_0x20c6('0x48')];if(!_0x37d7e6['query']['hasOwnProperty'](_0x20c6('0x50'))){_0x23acb5['limit']=qs[_0x20c6('0x51')](_0x37d7e6[_0x20c6('0x49')][_0x20c6('0x51')]);_0x23acb5[_0x20c6('0x31')]=qs['offset'](_0x37d7e6[_0x20c6('0x49')][_0x20c6('0x31')]);}_0x23acb5[_0x20c6('0x52')]=qs['sort'](_0x37d7e6[_0x20c6('0x49')][_0x20c6('0x53')]);_0x23acb5[_0x20c6('0x54')]=qs[_0x20c6('0x4b')](_[_0x20c6('0x55')](_0x37d7e6[_0x20c6('0x49')],_0x476ace[_0x20c6('0x4b')]),_0x27bcea);var _0x126cb0=[];var _0xda1b9b=squel[_0x20c6('0x56')]()[_0x20c6('0x57')]('id')[_0x20c6('0x57')](_0x20c6('0x3a'))[_0x20c6('0x57')](_0x20c6('0x58'))['from'](_0x20c6('0x59'));var _0x3fb574=squel[_0x20c6('0x56')]()['field'](_0x20c6('0x5a'))['field'](_0x20c6('0x5b'))['field']('ui.ChatInteractionId')['from'](_0x20c6('0x5c'),'ui')[_0x20c6('0x5d')](_0x20c6('0x5e'),'u',_0x20c6('0x5f'));var _0x2b3495=squel[_0x20c6('0x56')]()[_0x20c6('0x60')](_0x20c6('0x61'),'i')[_0x20c6('0x5d')](_0x20c6('0x62'),'c',_0x20c6('0x63'))[_0x20c6('0x5d')]('users','o',_0x20c6('0x64'))[_0x20c6('0x5d')](_0x20c6('0x65'),'a',_0x20c6('0x66'))[_0x20c6('0x5d')](_0x20c6('0x67'),'me',_0x20c6('0x68'))[_0x20c6('0x5d')]('chat_interaction_has_tags','it',_0x20c6('0x69'))['left_join'](_0x20c6('0x59'),'t',_0x20c6('0x6a'));var _0x2d347b=squel[_0x20c6('0x6b')]();var _0x3fbf2c=[];var _0x3f78c2=squel[_0x20c6('0x6b')]();var _0x1d1423;if(_0x37d7e6[_0x20c6('0x49')][_0x20c6('0x6c')]){_0x1d1423=as[_0x20c6('0x6d')](_0x37d7e6[_0x20c6('0x49')][_0x20c6('0x6c')]);var _0x7e16e5=_0x1d1423['sqlOperator'];for(var _0x138d4a=0x0;_0x138d4a<_0x1d1423[_0x20c6('0x6e')][_0x20c6('0x4f')];_0x138d4a++){var _0x1212e0=_0x1d1423[_0x20c6('0x6e')][_0x138d4a];var _0x55b871='i';var _0x2734ad=_[_0x20c6('0x6f')](_0x27bcea,[_0x20c6('0x3a'),_0x1212e0['field']]);if(!_0x2734ad){switch(_0x1212e0[_0x20c6('0x57')]){case _0x20c6('0x70'):if(_0x1212e0[_0x20c6('0x71')]==0x1){_0x2b3495[_0x20c6('0x72')]('`'+_0x1212e0[_0x20c6('0x57')]+_0x20c6('0x73'));}else{_0x2b3495['having']('`'+_0x1212e0[_0x20c6('0x57')]+'`\x20>\x200');}break;case _0x20c6('0x74'):if(_0x1212e0['operator']==='$substring'){if(_0x1212e0['value'][_0x20c6('0x40')]('\x20')[_0x20c6('0x4f')]>0x1){_0x2d347b[_0x7e16e5](_0x20c6('0x75'),qs['getFullTextValue'](_0x1212e0[_0x20c6('0x71')]),null);}else{var _0x27f9ad='%'+_0x1212e0[_0x20c6('0x71')]+'%';_0x2d347b[_0x7e16e5](_0x20c6('0x76'),_0x27f9ad,_0x27f9ad,_0x27f9ad);}}else{_0x2734ad=_['find'](_0x27bcea,[_0x20c6('0x3a'),_0x20c6('0x77')]);_0x1212e0[_0x20c6('0x57')]=_0x20c6('0x77');_0x40e350=as[_0x20c6('0x78')](_0x55b871,_0x2734ad[_0x20c6('0x79')],_0x1212e0);_0x2d347b[_0x7e16e5](_0x40e350[_0x20c6('0x7a')],_0x40e350['value'][_0x20c6('0x7b')],_0x40e350[_0x20c6('0x71')][_0x20c6('0x30')]);}break;case _0x20c6('0x7c'):var _0x3503b2=_0x1212e0[_0x20c6('0x71')][_0x20c6('0x40')](',')['map'](function(_0x13b9fd){return Number(_0x13b9fd);});_0x3503b2[_0x20c6('0x41')](function(_0x466280){_0x3f78c2['or'](_0x20c6('0x7d'),'%,'+_0x466280+',%');});_0x3fbf2c=_[_0x20c6('0x7e')](_0x3fbf2c,_0x3503b2);break;case _0x20c6('0x7f'):if(_0x1212e0['operator']===_0x20c6('0x80')){_0x2d347b[_0x7e16e5](_0x20c6('0x81'),'%'+_0x1212e0[_0x20c6('0x71')]+'%',null);}else{_0x2734ad=_[_0x20c6('0x6f')](_0x27bcea,[_0x20c6('0x3a'),_0x20c6('0x82')]);_0x1212e0[_0x20c6('0x57')]=_0x20c6('0x82');_0x40e350=as[_0x20c6('0x78')](_0x55b871,_0x2734ad[_0x20c6('0x79')],_0x1212e0);_0x2d347b[_0x7e16e5](_0x40e350[_0x20c6('0x7a')],_0x40e350[_0x20c6('0x71')][_0x20c6('0x7b')],_0x40e350[_0x20c6('0x71')]['end']);}break;case _0x20c6('0x83'):_0x40e350=as['buildExpression']('me',null,_0x1212e0);_0x2d347b[_0x7e16e5](_0x40e350['text'],_0x40e350[_0x20c6('0x71')][_0x20c6('0x7b')],_0x40e350[_0x20c6('0x71')]['end']);break;}}else{var _0x40e350=as[_0x20c6('0x78')](_0x55b871,_0x2734ad['type'],_0x1212e0);_0x2d347b[_0x7e16e5](_0x40e350['text'],_0x40e350[_0x20c6('0x71')][_0x20c6('0x7b')],_0x40e350[_0x20c6('0x71')]['end']);}}}else{var _0x3e86da=_(_0x37d7e6[_0x20c6('0x49')])['keys']()[_0x20c6('0x3d')](function(_0x244738){return _[_0x20c6('0x84')](_0x27bcea,[_0x20c6('0x3a'),_0x244738])?_0x244738:undefined;})[_0x20c6('0x85')]()[_0x20c6('0x71')]();if(!_[_0x20c6('0x86')](_0x3e86da)){_0x3e86da[_0x20c6('0x41')](function(_0x2684fc){if(_0x2684fc===_0x20c6('0x87')){_0x2b3495[_0x20c6('0x54')](_0x20c6('0x88'),[][_0x20c6('0x89')](_0x37d7e6[_0x20c6('0x49')][_0x2684fc]));}else if(_0x2684fc===_0x20c6('0x8a')){var _0x1f5ca0=JSON[_0x20c6('0x8b')](_0x37d7e6['query'][_0x2684fc])[_0x20c6('0x8c')];var _0x509745=JSON[_0x20c6('0x8b')](_0x37d7e6[_0x20c6('0x49')][_0x2684fc])['$lte'];_0x2b3495[_0x20c6('0x54')](_0x20c6('0x8d'),_0x1f5ca0,_0x509745);}else{if(_0x37d7e6[_0x20c6('0x49')][_0x2684fc]==='null'){_0x2b3495[_0x20c6('0x54')]('i.'+_0x2684fc+'\x20IS\x20NULL');}else{_0x2b3495['where']('i.'+_0x2684fc+_0x20c6('0x8e'),_0x37d7e6[_0x20c6('0x49')][_0x2684fc]);}}});}if(_0x37d7e6['query']['read']){if(_0x37d7e6[_0x20c6('0x49')]['read']==0x1){_0x2b3495['having'](_0x20c6('0x8f'));}else{_0x2b3495['having'](_0x20c6('0x90'));}}if(_0x37d7e6[_0x20c6('0x49')][_0x20c6('0x91')]){_0x3fbf2c=_[_0x20c6('0x92')](_0x37d7e6['query']['tag'])?_0x37d7e6[_0x20c6('0x49')]['tag']:new Array(_0x37d7e6[_0x20c6('0x49')][_0x20c6('0x91')]);_0x3fbf2c[_0x20c6('0x41')](function(_0x5ed106){_0x3f78c2['or'](_0x20c6('0x7d'),'%,'+_0x5ed106+',%');});}if(_0x37d7e6['query'][_0x20c6('0x93')]){var _0x3e0200=_0x37d7e6[_0x20c6('0x49')]['filter'][_0x20c6('0x94')]('\x5c','\x5c\x5c')[_0x20c6('0x94')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3e0200)){_0x2d347b['or'](_0x20c6('0x95'),_0x3e0200+'%');}else{_0x2d347b['or'](_0x20c6('0x96'),qs[_0x20c6('0x97')](_0x3e0200))['or'](_0x20c6('0x98'),_0x3e0200+'%');}}}_0x2b3495[_0x20c6('0x54')](_0x2d347b);_0x2b3495['group'](_0x20c6('0x99'));var _0x2ca32a={'type':db[_0x20c6('0x9a')]['QueryTypes'][_0x20c6('0x9b')],'raw':!![]};var _0x4e962d=_0x2b3495[_0x20c6('0x9c')]();_0x4e962d['field'](_0x20c6('0x99'));_0x4e962d[_0x20c6('0x57')](_0x20c6('0x9d'),'unreadMessages');if(_0x23acb5[_0x20c6('0x52')]){_0x23acb5['order'][_0x20c6('0x41')](function(_0x158d08){var _0x33b76d=_0x158d08[0x0]===_0x20c6('0x9e')?_0x158d08[0x0]:'i.'+_0x158d08[0x0];_0x2b3495[_0x20c6('0x52')](_0x33b76d,_0x158d08[0x1]===_0x20c6('0x9f')?![]:!![]);});}if(!_[_0x20c6('0x86')](_0x3fbf2c)){_0x2b3495[_0x20c6('0x72')](_0x3f78c2);_0x4e962d[_0x20c6('0x54')](_0x20c6('0xa0'),_0x3fbf2c);}BPromise[_0x20c6('0xa1')]()[_0x20c6('0x37')](function(){if(!_0x1d1423){if(_0x37d7e6[_0x20c6('0x49')][_0x20c6('0x87')])return;_0x4e962d[_0x20c6('0x54')](_0x20c6('0xa2'));_0x2b3495[_0x20c6('0x54')](_0x20c6('0xa2'));return;}if(_0x37d7e6[_0x20c6('0xa3')][_0x20c6('0xa4')]!==_0x20c6('0xa5'))return;return _0x37d7e6['user'][_0x20c6('0xa6')]({'attributes':['id'],'raw':!![]})[_0x20c6('0x37')](function(_0x40a284){if(_[_0x20c6('0x86')](_0x40a284)){_0x4e962d[_0x20c6('0x54')](_0x20c6('0xa7'));_0x2b3495[_0x20c6('0x54')](_0x20c6('0xa7'));}else{_0x4e962d[_0x20c6('0x54')](_0x20c6('0x88'),_[_0x20c6('0x3d')](_0x40a284,'id'));_0x2b3495['where'](_0x20c6('0x88'),_[_0x20c6('0x3d')](_0x40a284,'id'));}});})[_0x20c6('0x37')](function(){if(_0x37d7e6[_0x20c6('0xa3')][_0x20c6('0xa4')]===_0x20c6('0xa5')&&!_0x1d1423&&!_0x37d7e6[_0x20c6('0x49')][_0x20c6('0x87')])return[];return db[_0x20c6('0xa8')][_0x20c6('0x49')](_0x4e962d[_0x20c6('0xa9')](),_0x2ca32a);})[_0x20c6('0x37')](function(_0x8a42fd){_0xdfb264['count']=_0x8a42fd['length'];if(_0xdfb264[_0x20c6('0xaa')]===0x0)return[];return db[_0x20c6('0xa8')][_0x20c6('0x49')](_0xda1b9b[_0x20c6('0xa9')](),_0x2ca32a)['then'](function(_0xbb4eb8){_0x126cb0=_[_0x20c6('0xab')](_0xbb4eb8,'id');_0x2ca32a=_[_0x20c6('0xac')](_0x2ca32a,{'model':db[_0x20c6('0x45')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x37d7e6[_0x20c6('0x49')][_0x20c6('0x4e')]){_0x23acb5[_0x20c6('0x4d')][_0x20c6('0x41')](function(_0x3e9a35){_0x2b3495[_0x20c6('0x57')]('i.'+_0x3e9a35);});}else{_0x2b3495[_0x20c6('0x57')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x20c6('0x70'));_0x2b3495['field'](_0x20c6('0xad'),'Account.key');_0x2b3495[_0x20c6('0x57')]('a.mandatoryDisposition',_0x20c6('0xae'));_0x2b3495['field'](_0x20c6('0xaf'),_0x20c6('0x9e'));_0x2b3495[_0x20c6('0x57')]('i.*');_0x2b3495['field']('c.firstName','Contact.firstName');_0x2b3495['field'](_0x20c6('0xb0'),_0x20c6('0xb1'));_0x2b3495[_0x20c6('0x57')](_0x20c6('0xb2'),_0x20c6('0xb3'));_0x2b3495['field']('c.phone','Contact.phone');_0x2b3495['field']('c.mobile',_0x20c6('0xb4'));_0x2b3495[_0x20c6('0x57')]('c.fax',_0x20c6('0xb5'));_0x2b3495[_0x20c6('0x57')](_0x20c6('0xb6'),_0x20c6('0xb7'));_0x2b3495['field'](_0x20c6('0xb8'),_0x20c6('0xb9'));_0x2b3495[_0x20c6('0x57')](_0x20c6('0xba'),'TagIds');}if(_0x23acb5['limit'])_0x2b3495['limit'](_0x23acb5[_0x20c6('0x51')]);if(_0x23acb5[_0x20c6('0x31')])_0x2b3495[_0x20c6('0x31')](_0x23acb5['offset']);return db[_0x20c6('0xa8')]['query'](_0x2b3495[_0x20c6('0xa9')](),_0x2ca32a);})[_0x20c6('0x37')](function(_0x5751c1){_0x3fb574['where'](_0x20c6('0xbb'),_[_0x20c6('0x3d')](_0x5751c1,'id'));return db[_0x20c6('0xa8')]['query'](_0x3fb574[_0x20c6('0xa9')](),_0x2ca32a)[_0x20c6('0x37')](function(_0x378d9f){var _0x3a523c=_['groupBy'](_0x378d9f,_0x20c6('0xbc'));var _0x17cfee=[];_0x5751c1['forEach'](function(_0x47275b){_0x17cfee['push'](updateChatInteraction(_0x47275b,_0x126cb0,_0x3a523c));});return BPromise[_0x20c6('0xbd')](_0x17cfee);});});})[_0x20c6('0x37')](function(_0x2b7d67){_0xdfb264[_0x20c6('0xbe')]=_0x2b7d67;return _0xdfb264;})[_0x20c6('0x37')](respondWithFilteredResult(_0x283cbc,_0x23acb5))[_0x20c6('0x2d')](handleError(_0x283cbc,null));};exports['show']=function(_0x5c1d51,_0x4f573a){var _0x2ada0c={'raw':![],'where':{'id':_0x5c1d51[_0x20c6('0xbf')]['id']}},_0x5379ee={};_0x5379ee[_0x20c6('0x48')]=_[_0x20c6('0x4a')](db[_0x20c6('0x45')][_0x20c6('0xc0')]);_0x5379ee[_0x20c6('0x49')]=_[_0x20c6('0x4a')](_0x5c1d51[_0x20c6('0x49')]);_0x5379ee[_0x20c6('0x4b')]=_[_0x20c6('0x4c')](_0x5379ee[_0x20c6('0x48')],_0x5379ee['query']);_0x2ada0c['attributes']=_['intersection'](_0x5379ee[_0x20c6('0x48')],qs[_0x20c6('0x4e')](_0x5c1d51['query'][_0x20c6('0x4e')]));_0x2ada0c[_0x20c6('0x4d')]=_0x2ada0c['attributes']['length']?_0x2ada0c['attributes']:_0x5379ee[_0x20c6('0x48')];if(_0x5c1d51[_0x20c6('0x49')][_0x20c6('0xc1')]){_0x2ada0c['include']=[{'all':!![]}];}_0x2ada0c=_[_0x20c6('0xac')]({},_0x2ada0c,_0x5c1d51[_0x20c6('0xc2')]);return db[_0x20c6('0x45')]['find'](_0x2ada0c)[_0x20c6('0x37')](handleEntityNotFound(_0x4f573a,null))[_0x20c6('0x37')](respondWithResult(_0x4f573a,null))[_0x20c6('0x2d')](handleError(_0x4f573a,null));};exports[_0x20c6('0xc3')]=function(_0xa91eaf,_0xdce13f){return db['ChatInteraction']['create'](_0xa91eaf[_0x20c6('0x83')],{})[_0x20c6('0x37')](respondWithResult(_0xdce13f,0xc9))[_0x20c6('0x2d')](handleError(_0xdce13f,null));};exports[_0x20c6('0x36')]=function(_0x3721c0,_0x4b2651){if(_0x3721c0[_0x20c6('0x83')]['id']){delete _0x3721c0[_0x20c6('0x83')]['id'];}return db[_0x20c6('0x45')][_0x20c6('0x6f')]({'where':{'id':_0x3721c0[_0x20c6('0xbf')]['id']}})[_0x20c6('0x37')](handleEntityNotFound(_0x4b2651,null))[_0x20c6('0x37')](saveUpdates(_0x3721c0[_0x20c6('0x83')],null))[_0x20c6('0x37')](respondWithResult(_0x4b2651,null))[_0x20c6('0x2d')](handleError(_0x4b2651,null));};exports['destroy']=function(_0xd7888b,_0x21435f){return db['ChatInteraction'][_0x20c6('0x6f')]({'where':{'id':_0xd7888b[_0x20c6('0xbf')]['id']}})['then'](handleEntityNotFound(_0x21435f,null))[_0x20c6('0x37')](removeEntity(_0x21435f,null))[_0x20c6('0x2d')](handleError(_0x21435f,null));};exports[_0x20c6('0xc4')]=function(_0x5c4374,_0x29dae5){return db[_0x20c6('0x45')]['describe']()[_0x20c6('0x37')](respondWithResult(_0x29dae5,null))[_0x20c6('0x2d')](handleError(_0x29dae5,null));};exports[_0x20c6('0xc5')]=function(_0x1a37dc,_0x28841b){var _0x209e2f=_0x1a37dc[_0x20c6('0xbf')]['id'];var _0x2c8577;var _0x50baa9;var _0x2f912d;return db[_0x20c6('0x45')][_0x20c6('0xc6')]({'where':{'id':_0x209e2f}})[_0x20c6('0x37')](function(_0x2638e8){_0x2c8577=_0x2638e8;return db['ChatWebsite'][_0x20c6('0xc6')]({'where':{'id':_0x2638e8[_0x20c6('0x87')]},'attributes':['id','vidaooApiKey',_0x20c6('0xc7')],'raw':!![]});})[_0x20c6('0x37')](function(_0x411d9d){if(_0x411d9d&&_0x411d9d['vidaooApiKey']&&_0x411d9d[_0x20c6('0xc7')]){_0x50baa9=_0x411d9d;var _0x18645e={'rejectUnauthorized':![],'method':_0x20c6('0xc8'),'uri':_0x20c6('0xc9'),'headers':{'X-APIKEY':_0x411d9d[_0x20c6('0xca')]},'body':{'name':'MotionCWB:'+_0x209e2f},'redirect':_0x20c6('0xcb'),'json':!![]};return rp(_0x18645e);}else{throw new db[(_0x20c6('0x9a'))][(_0x20c6('0xcc'))](_0x20c6('0xcd'));}})[_0x20c6('0x37')](function(_0x36813b){_0x2f912d=_0x36813b;if(_0x2f912d['id']){var _0x3dda2a={'body':_0x2f912d[_0x20c6('0xce')],'ChatWebsiteId':_0x50baa9['id'],'ChatInteractionId':_0x2c8577['id'],'direction':_0x20c6('0xcf'),'UserId':_0x1a37dc[_0x20c6('0xa3')]['id']};return db[_0x20c6('0xd0')][_0x20c6('0xc3')](_0x3dda2a,{});}else{throw new db[(_0x20c6('0x9a'))][(_0x20c6('0xcc'))](_0x20c6('0xd1'));}})[_0x20c6('0x37')](function(){return _0x2c8577[_0x20c6('0xd2')]({'vidaooSessionId':_0x2f912d['id']});})[_0x20c6('0x37')](respondWithResult(_0x28841b,null))['catch'](handleError(_0x28841b,null));};exports[_0x20c6('0xd3')]=function(_0x4ff9ee,_0x595aed){if(_0x4ff9ee[_0x20c6('0x83')]['id']){delete _0x4ff9ee[_0x20c6('0x83')]['id'];}return db[_0x20c6('0x45')][_0x20c6('0x6f')]({'where':{'id':_0x4ff9ee['params']['id']}})['then'](handleEntityNotFound(_0x595aed,null))['then'](saveUpdates(_0x4ff9ee[_0x20c6('0x83')],null))[_0x20c6('0x37')](respondWithResult(_0x595aed,null))[_0x20c6('0x2d')](handleError(_0x595aed,null));};exports[_0x20c6('0xd4')]=function(_0x576166,_0x1334f6,_0x29a6ca){if(_0x576166[_0x20c6('0x83')]['id']){delete _0x576166[_0x20c6('0x83')]['id'];}return db['ChatInteraction'][_0x20c6('0x6f')]({'where':{'id':_0x576166[_0x20c6('0xbf')]['id']}})['then'](function(_0xba0d6e){if(!_0xba0d6e){logger[_0x20c6('0x29')](_0x20c6('0xd5'),_0x20c6('0xd4'),0x194,_0x20c6('0xd6'));_0x1334f6[_0x20c6('0x2e')](0x194);}else{if(_0xba0d6e[_0x20c6('0x82')]){throw new db[(_0x20c6('0x9a'))][(_0x20c6('0xcc'))](_0x20c6('0xd7'));}}return _0xba0d6e;})[_0x20c6('0x37')](function(_0x4843b5){if(_0x4843b5){return _0x4843b5[_0x20c6('0x36')]({'closed':_0x576166[_0x20c6('0x83')][_0x20c6('0xd8')],'disposition':_0x576166['body'][_0x20c6('0xd9')]})['then'](function(_0x3bb2ab){return _0x3bb2ab;});}})[_0x20c6('0x37')](function(_0x37cf7c){return respondWithRpcPromise(_0x20c6('0xda'),_0x20c6('0xd4'),_0x576166[_0x20c6('0x83')],client9004);})[_0x20c6('0x37')](respondWithResult(_0x1334f6,null))[_0x20c6('0x2d')](handleError(_0x1334f6,null));};exports['attachmentUpload']=function(_0x1265df,_0xd494b7,_0x39bb37){_0x1265df[_0x20c6('0x83')][_0x20c6('0x3a')]=_0x1265df['file'][_0x20c6('0xdb')];_0x1265df[_0x20c6('0x83')][_0x20c6('0xdc')]=_0x1265df[_0x20c6('0xdd')]['filename'];_0x1265df['body'][_0x20c6('0x79')]=_0x1265df[_0x20c6('0xdd')][_0x20c6('0xde')];return db[_0x20c6('0xdf')]['create'](_0x1265df[_0x20c6('0x83')])[_0x20c6('0x37')](respondWithResult(_0xd494b7,0xc9))[_0x20c6('0x2d')](handleError(_0xd494b7,null));};exports[_0x20c6('0xe0')]=function(_0x478b79,_0xcd6ef8,_0x40178a){return db[_0x20c6('0x45')]['findOne']({'where':{'id':_0x478b79['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0xcd6ef8,null))[_0x20c6('0x37')](function(_0x93a506){if(_0x93a506){if(_0x93a506[_0x20c6('0xd8')]){return _0xcd6ef8[_0x20c6('0x2f')](0x193)[_0x20c6('0x34')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x20c6('0xc6')]({'where':{'id':_0x478b79['query'][_0x20c6('0xe1')]},'raw':!![]})['then'](handleEntityNotFound(_0xcd6ef8,null));}})[_0x20c6('0x37')](function(_0x133e60){if(_0x133e60){return _0xcd6ef8[_0x20c6('0xe2')](path['join'](config[_0x20c6('0xe3')],_0x20c6('0xe4'),_0x133e60[_0x20c6('0xdc')]));}})[_0x20c6('0x2d')](handleError(_0xcd6ef8,null));};exports[_0x20c6('0xe5')]=function(_0x3df168,_0x580f25){var _0x67f138=null;var _0x24e8af=null;var _0x3fb742=null;var _0x58b5bd=null;if(_0x3df168[_0x20c6('0x83')]['id']){delete _0x3df168[_0x20c6('0x83')]['id'];}if(_0x3df168[_0x20c6('0x83')][_0x20c6('0xe6')]){_0x58b5bd=path[_0x20c6('0xe7')](config[_0x20c6('0xe3')],_0x20c6('0xe8'),util['format'](_0x20c6('0xe9'),Date[_0x20c6('0xea')]()));_0x3df168['body'][_0x20c6('0xeb')]=_0x58b5bd;}return db[_0x20c6('0x45')][_0x20c6('0x6f')]({'where':{'id':_0x3df168[_0x20c6('0xbf')]['id']},'include':[{'model':db[_0x20c6('0xd0')],'as':_0x20c6('0xec'),'include':[{'model':db[_0x20c6('0x7f')],'as':_0x20c6('0x7f')}]}]})[_0x20c6('0x37')](handleEntityNotFound(_0x580f25,null))[_0x20c6('0x37')](saveUpdates(_0x3df168[_0x20c6('0x83')],null))[_0x20c6('0x37')](function(_0x41d5bf){if(_0x41d5bf){_0x67f138=_0x41d5bf;return db['ChatWebsite']['find']({'where':{'id':_0x67f138['ChatWebsiteId']}});}})[_0x20c6('0x37')](function(_0x48824a){if(_0x48824a){_0x3fb742=_0x48824a;return db[_0x20c6('0xed')][_0x20c6('0x6f')]({'where':{'id':_0x67f138[_0x20c6('0x77')]}});}})[_0x20c6('0x37')](function(_0x5203bc){if(_0x5203bc){_0x24e8af=_0x5203bc;if(_0x58b5bd){var _0x15495a=null;for(var _0x403e05=0x1;_0x403e05<_0x67f138['Messages'][_0x20c6('0x4f')];++_0x403e05){_0x15495a=_0x67f138['Messages'][_0x403e05];var _0x336565=_0x15495a[_0x20c6('0x82')]?util['format'](_0x20c6('0xee'),_0x3fb742[_0x20c6('0xef')],_0x15495a[_0x20c6('0x82')]):'System';var _0x505564=_0x3df168[_0x20c6('0x83')][_0x20c6('0xf0')]||util[_0x20c6('0xf1')]('%s%d',_0x20c6('0xf2'),_0x15495a['ContactId']);switch(_0x3fb742['agentIdentifier']){case _0x20c6('0xf3'):_0x336565=_0x15495a[_0x20c6('0x82')]?util['format']('%s%d',_0x3fb742[_0x20c6('0xef')],_0x15495a[_0x20c6('0x82')]):'System';break;case _0x20c6('0xf4'):_0x336565=_0x15495a['UserId']?_0x15495a[_0x20c6('0x7f')][_0x20c6('0xf5')]||_0x15495a[_0x20c6('0x7f')]['fullname']:_0x20c6('0xf6');break;case _0x20c6('0xf7'):_0x336565=_0x15495a[_0x20c6('0x82')]?_0x15495a[_0x20c6('0x7f')][_0x20c6('0x3e')]:'System';break;default:_0x336565=_0x15495a['UserId']?util[_0x20c6('0xf1')](_0x20c6('0xee'),_0x3fb742[_0x20c6('0xef')],_0x15495a[_0x20c6('0x82')]):_0x20c6('0xf6');}var _0x319bd7=util[_0x20c6('0xf1')](_0x20c6('0xf8'),moment(_0x15495a['createdAt'])[_0x20c6('0xf1')](_0x20c6('0xf9')),_0x15495a[_0x20c6('0xfa')]==='in'?_0x505564:_0x336565,_0x15495a['body']);if(!_0x15495a[_0x20c6('0xfb')]){fs[_0x20c6('0xfc')](_0x58b5bd,_0x319bd7);}}return db[_0x20c6('0xfd')][_0x20c6('0xc6')]({'where':{'service':!![]},'include':[{'model':db[_0x20c6('0xfe')],'as':_0x20c6('0xff'),'raw':!![]}]});}}})[_0x20c6('0x37')](function(_0x3e6660){if(_0x3e6660&&_0x3e6660[_0x20c6('0xff')]&&_0x3df168['body']){var _0x16a734={'tls':{'rejectUnauthorized':![]}};if(_0x3e6660['Smtp']['service']){_0x16a734['service']=_0x3e6660['Smtp']['service'];}else{_0x16a734[_0x20c6('0x100')]=_0x3e6660['Smtp'][_0x20c6('0x100')];_0x16a734[_0x20c6('0x101')]=_0x3e6660[_0x20c6('0xff')][_0x20c6('0x101')];_0x16a734['secure']=_0x3e6660['Smtp'][_0x20c6('0x102')];}if(_0x3e6660[_0x20c6('0xff')][_0x20c6('0x103')]){_0x16a734[_0x20c6('0x104')]={'user':_0x3e6660[_0x20c6('0xff')][_0x20c6('0xa3')],'pass':_0x3e6660[_0x20c6('0xff')][_0x20c6('0x105')]};}return respondWithRpcPromise(_0x20c6('0x106'),_0x20c6('0x107'),{'account':_0x16a734,'message':{'from':util[_0x20c6('0xf1')](_0x20c6('0x108'),_0x3e6660[_0x20c6('0x3a')],_0x3e6660['email']||_0x3e6660[_0x20c6('0xff')][_0x20c6('0xa3')]),'to':_0x3df168[_0x20c6('0x83')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x3df168[_0x20c6('0x83')][_0x20c6('0xe6')]),'attachments':[{'path':_0x58b5bd}]}})['then'](function(){return _0x67f138;})['catch'](function(_0x51ef74){console[_0x20c6('0x29')](_0x51ef74);});}else{return _0x67f138;}})[_0x20c6('0x37')](respondWithStatusCode(_0x580f25,0xc8))[_0x20c6('0x2d')](handleError(_0x580f25,null));};exports[_0x20c6('0x109')]=function(_0xe0b7b0,_0x31dc7b,_0x83d8e7){return db[_0x20c6('0xd0')][_0x20c6('0x6f')]({'where':{'id':_0xe0b7b0[_0x20c6('0xbf')]['id']}})[_0x20c6('0x37')](handleEntityNotFound(_0x31dc7b,null))[_0x20c6('0x37')](function(_0x7d7287){if(_0x7d7287){return _0x7d7287[_0x20c6('0x109')](_0xe0b7b0[_0x20c6('0x83')][_0x20c6('0x10a')],_[_0x20c6('0x10b')](_0xe0b7b0[_0x20c6('0x83')],['ids','id'])||{});}})[_0x20c6('0x37')](respondWithResult(_0x31dc7b,null))[_0x20c6('0x2d')](handleError(_0x31dc7b,null));};exports[_0x20c6('0x10c')]=function(_0x3066f0,_0x55c411,_0x1864a4){var _0x3e013b={'raw':![],'where':{}};var _0x26dc45={};var _0x3100b2={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x20c6('0xc6')]({'where':{'id':_0x3066f0[_0x20c6('0xbf')]['id']}})[_0x20c6('0x37')](handleEntityNotFound(_0x55c411,null))[_0x20c6('0x37')](function(_0x3bb147){if(_0x3bb147){_0x26dc45[_0x20c6('0x48')]=_[_0x20c6('0x4a')](db['ChatMessage']['rawAttributes']);_0x26dc45[_0x20c6('0x49')]=_[_0x20c6('0x4a')](_0x3066f0[_0x20c6('0x49')]);_0x26dc45[_0x20c6('0x4b')]=_[_0x20c6('0x4c')](_0x26dc45[_0x20c6('0x48')],_0x26dc45[_0x20c6('0x49')]);_0x3e013b['attributes']=_['intersection'](_0x26dc45[_0x20c6('0x48')],qs[_0x20c6('0x4e')](_0x3066f0[_0x20c6('0x49')][_0x20c6('0x4e')]));_0x3e013b[_0x20c6('0x4d')]=_0x3e013b[_0x20c6('0x4d')]['length']?_0x3e013b[_0x20c6('0x4d')]:_0x26dc45[_0x20c6('0x48')];if(!_0x3066f0[_0x20c6('0x49')][_0x20c6('0x10d')](_0x20c6('0x50'))){_0x3e013b[_0x20c6('0x51')]=qs['limit'](_0x3066f0[_0x20c6('0x49')][_0x20c6('0x51')]);_0x3e013b[_0x20c6('0x31')]=qs['offset'](_0x3066f0[_0x20c6('0x49')][_0x20c6('0x31')]);}_0x3e013b['order']=qs[_0x20c6('0x53')](_0x3066f0['query']['sort']);_0x3e013b[_0x20c6('0x54')]=qs['filters'](_[_0x20c6('0x55')](_0x3066f0[_0x20c6('0x49')],_0x26dc45[_0x20c6('0x4b')]));_0x3e013b[_0x20c6('0x54')][_0x20c6('0xbc')]=_0x3bb147['id'];if(_0x3066f0['query']['filter']){_0x3e013b['where']=_[_0x20c6('0xac')](_0x3e013b[_0x20c6('0x54')],{'$or':_['map'](_0x3e013b[_0x20c6('0x4d')],function(_0x4c9dad){var _0x125a0c={};_0x125a0c[_0x4c9dad]={'$like':'%'+_0x3066f0['query'][_0x20c6('0x93')]+'%'};return _0x125a0c;})});}if(_0x3066f0[_0x20c6('0x49')][_0x20c6('0x8c')]){var _0x143205=_0x3066f0[_0x20c6('0x49')][_0x20c6('0x8c')][_0x20c6('0x40')](',');var _0x2c22a7={};_0x2c22a7[_0x143205[0x0]]={'$gte':moment(_0x143205[0x1])[_0x20c6('0xf1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3e013b[_0x20c6('0x54')]=_['merge'](_0x3e013b[_0x20c6('0x54')],_0x2c22a7);}_0x3e013b=_[_0x20c6('0xac')]({},_0x3e013b,_0x3066f0[_0x20c6('0xc2')]);return db[_0x20c6('0xd0')][_0x20c6('0xaa')]({'where':_0x3e013b[_0x20c6('0x54')]})[_0x20c6('0x37')](function(_0x52ca3a){_0x3100b2['count']=_0x52ca3a;if(_0x3066f0[_0x20c6('0x49')][_0x20c6('0xc1')]){_0x3e013b[_0x20c6('0x10e')]=[{'all':!![]}];}return db['ChatMessage'][_0x20c6('0x10f')](_0x3e013b);})[_0x20c6('0x37')](function(_0x40a2cc){_0x3100b2[_0x20c6('0xbe')]=_0x40a2cc;return _0x3100b2;});}})[_0x20c6('0x37')](respondWithFilteredResult(_0x55c411,_0x3e013b))[_0x20c6('0x2d')](handleError(_0x55c411,null));};exports[_0x20c6('0x110')]=function(_0x3fc77a,_0x527e87,_0x49d117){var _0x711960={'where':{}},_0x35b7b0={},_0x32eb5d={'count':0x0,'rows':[]};return db[_0x20c6('0x45')][_0x20c6('0xc6')]({'where':{'id':_0x3fc77a[_0x20c6('0xbf')]['id']}})[_0x20c6('0x37')](handleEntityNotFound(_0x527e87,null))['then'](function(_0x156b7b){if(_0x156b7b){_0x35b7b0['model']=_[_0x20c6('0x4a')](db[_0x20c6('0xd0')][_0x20c6('0xc0')]);_0x35b7b0['query']=_[_0x20c6('0x4a')](_0x3fc77a[_0x20c6('0x49')]);_0x35b7b0[_0x20c6('0x4b')]=_[_0x20c6('0x4c')](_0x35b7b0[_0x20c6('0x48')],_0x35b7b0[_0x20c6('0x49')]);_0x711960[_0x20c6('0x4d')]=_[_0x20c6('0x4c')](_0x35b7b0[_0x20c6('0x48')],qs[_0x20c6('0x4e')](_0x3fc77a[_0x20c6('0x49')][_0x20c6('0x4e')]));_0x711960[_0x20c6('0x4d')]=_0x711960[_0x20c6('0x4d')]['length']?_0x711960[_0x20c6('0x4d')]:_0x35b7b0['model'];if(!_0x3fc77a[_0x20c6('0x49')]['hasOwnProperty']('nolimit')){_0x711960['limit']=qs['limit'](_0x3fc77a[_0x20c6('0x49')][_0x20c6('0x51')]);_0x711960[_0x20c6('0x31')]=qs[_0x20c6('0x31')](_0x3fc77a[_0x20c6('0x49')][_0x20c6('0x31')]);}_0x711960['order']=qs[_0x20c6('0x53')](_0x3fc77a[_0x20c6('0x49')]['sort']);_0x711960[_0x20c6('0x54')]=qs[_0x20c6('0x4b')](_['pick'](_0x3fc77a['query'],_0x35b7b0[_0x20c6('0x4b')]));_0x711960['where'][_0x20c6('0xbc')]=_0x156b7b['id'];if(_0x3fc77a[_0x20c6('0x49')][_0x20c6('0x93')]){_0x711960[_0x20c6('0x54')]=_['merge'](_0x711960[_0x20c6('0x54')],{'$or':_['map'](_0x711960[_0x20c6('0x4d')],function(_0x5876b3){var _0x26ee1c={};_0x26ee1c[_0x5876b3]={'$like':'%'+_0x3fc77a[_0x20c6('0x49')]['filter']+'%'};return _0x26ee1c;})});}_0x711960[_0x20c6('0x54')][_0x20c6('0xfb')]=![];if(_0x3fc77a[_0x20c6('0x49')]['id']){_0x711960[_0x20c6('0x54')]['id']={'$gt':_0x3fc77a[_0x20c6('0x49')]['id']};}_0x711960=_[_0x20c6('0xac')]({},_0x711960,_0x3fc77a[_0x20c6('0xc2')]);return db['ChatMessage']['count']({'where':_0x711960['where']})[_0x20c6('0x37')](function(_0x2cbf25){_0x32eb5d[_0x20c6('0xaa')]=_0x2cbf25;_0x711960[_0x20c6('0x10e')]=[];if(_0x3fc77a[_0x20c6('0x49')][_0x20c6('0x111')]){_0x711960[_0x20c6('0x10e')][_0x20c6('0x43')]({'model':db['User'],'as':_0x20c6('0x7f'),'attributes':['id',_0x20c6('0x3e'),_0x20c6('0xf5')]});}if(_0x3fc77a['query']['includeAll']){_0x711960[_0x20c6('0x10e')]=[{'all':!![]}];}return db[_0x20c6('0xd0')][_0x20c6('0x10f')](_0x711960);})[_0x20c6('0x37')](function(_0x4643cb){_0x32eb5d[_0x20c6('0xbe')]=_0x4643cb;return _0x32eb5d;});}})[_0x20c6('0x37')](respondWithFilteredResult(_0x527e87,_0x711960))[_0x20c6('0x2d')](handleError(_0x527e87,null));};exports['addTags']=function(_0x899ff0,_0x337e58,_0x885456){return db[_0x20c6('0x45')][_0x20c6('0x6f')]({'where':{'id':_0x899ff0['params']['id']}})[_0x20c6('0x37')](handleEntityNotFound(_0x337e58,null))[_0x20c6('0x37')](function(_0x49ad47){if(_0x49ad47){return _0x49ad47['setTags'](_0x899ff0[_0x20c6('0x83')][_0x20c6('0x10a')],_[_0x20c6('0x10b')](_0x899ff0[_0x20c6('0x83')],[_0x20c6('0x10a'),'id'])||{})[_0x20c6('0x112')](function(){return db['Tag'][_0x20c6('0x10f')]({'attributes':['id','name',_0x20c6('0x58')],'where':{'id':_0x899ff0[_0x20c6('0x83')][_0x20c6('0x10a')]}});})[_0x20c6('0x37')](function(_0x2fbe36){socket[_0x20c6('0x113')](_0x20c6('0x114'),{'id':Number(_0x899ff0[_0x20c6('0xbf')]['id']),'tags':_0x2fbe36||[]});return{'id':Number(_0x899ff0[_0x20c6('0xbf')]['id']),'tags':_0x2fbe36||[]};});}})[_0x20c6('0x37')](respondWithResult(_0x337e58,null))[_0x20c6('0x2d')](handleError(_0x337e58,null));};exports[_0x20c6('0x115')]=function(_0x2d0bed,_0x114d40,_0x4ac35b){return db[_0x20c6('0x45')][_0x20c6('0x6f')]({'where':{'id':_0x2d0bed[_0x20c6('0xbf')]['id']}})['then'](handleEntityNotFound(_0x114d40,null))[_0x20c6('0x37')](function(_0x306955){if(_0x306955){return _0x306955['removeTags'](_0x2d0bed[_0x20c6('0x49')][_0x20c6('0x10a')]);}})[_0x20c6('0x37')](respondWithStatusCode(_0x114d40,null))[_0x20c6('0x2d')](handleError(_0x114d40,null));};exports[_0x20c6('0xe2')]=function(_0x3fcc4c,_0x409ccc){var _0x550ccd=moment()[_0x20c6('0x116')]()[_0x20c6('0xa9')]();var _0x10f1e4=path['join'](config[_0x20c6('0xe3')],_0x20c6('0x117'),_0x20c6('0x118'),_0x20c6('0x119'));var _0x51fe5a=path[_0x20c6('0xe7')](config[_0x20c6('0xe3')],'server',_0x20c6('0x118'),_0x20c6('0x11a'));var _0xff0478=path['join'](_0x10f1e4,_0x550ccd);var _0x3afb6a=util['format'](_0x20c6('0x11b'),_0x3fcc4c[_0x20c6('0xbf')]['id'],_0x550ccd);var _0x56a7c6=path['join'](_0x10f1e4,_0x3afb6a);var _0x9c5d9e=[];_0x9c5d9e[_0x20c6('0x43')]({'model':db['User'],'as':_0x20c6('0x7f'),'attributes':['id','fullname'],'raw':!![]});_0x9c5d9e[_0x20c6('0x43')]({'model':db[_0x20c6('0xed')],'as':_0x20c6('0x74'),'attributes':['id',_0x20c6('0x11c'),_0x20c6('0x11d')],'raw':!![]});if(_0x3fcc4c[_0x20c6('0x49')]['attachments']){_0x9c5d9e[_0x20c6('0x43')]({'model':db[_0x20c6('0xdf')],'as':_0x20c6('0xdf'),'raw':!![]});}var _0x95fee8=[{'model':db[_0x20c6('0xd0')],'as':_0x20c6('0xec'),'attributes':['id',_0x20c6('0x83'),_0x20c6('0x8a'),_0x20c6('0xfa'),_0x20c6('0xfb'),_0x20c6('0x11e')],'include':_0x9c5d9e}];_0x95fee8[_0x20c6('0x43')]({'model':db[_0x20c6('0x11f')],'as':_0x20c6('0x120'),'attributes':['id',_0x20c6('0x3a')]});_0x95fee8[_0x20c6('0x43')]({'model':db[_0x20c6('0x7f')],'as':_0x20c6('0x121'),'attributes':['id',_0x20c6('0x3e')]});return db[_0x20c6('0x45')][_0x20c6('0x6f')]({'where':{'id':_0x3fcc4c[_0x20c6('0xbf')]['id']},'include':_0x95fee8})[_0x20c6('0x37')](handleEntityNotFound(_0x409ccc,null))['then'](function(_0x5890d0){if(_0x5890d0){var _0x215f7e=_0x5890d0[_0x20c6('0x122')]({'plain':!![]});fs['mkdirSync'](_0xff0478);var _0x13c9aa={'format':'A4','border':_0x20c6('0x123'),'header':{'height':_0x20c6('0x124'),'contents':{'first':_0x20c6('0x125')}},'footer':{'height':_0x20c6('0x126'),'contents':{'default':util['format'](_0x20c6('0x127'),util[_0x20c6('0xf1')](_0x20c6('0x128'),'Chat',_0x215f7e['id']),moment()['format'](_0x20c6('0x129'))['toString']())}}};var _0x15ec05={'channel':'Chat','account':_0x215f7e[_0x20c6('0x120')][_0x20c6('0x3a')],'agent':_0x215f7e[_0x20c6('0x121')]?_0x215f7e['Owner']['fullname']:_0x20c6('0x12a'),'createdAt':moment(_0x215f7e[_0x20c6('0x8a')])[_0x20c6('0xf1')](_0x20c6('0x12b'))[_0x20c6('0xa9')](),'closedAt':_0x215f7e[_0x20c6('0xd8')]?moment(_0x215f7e[_0x20c6('0x12c')])['format'](_0x20c6('0x12b'))['toString']():'','disposition':_0x215f7e['disposition'],'chatInfo':{'browser':_0x215f7e['browserName'],'os':_0x215f7e[_0x20c6('0x12d')],'referer':_0x215f7e[_0x20c6('0x12e')],'customerIp':_0x215f7e[_0x20c6('0x12f')],'customerPort':_0x215f7e[_0x20c6('0x130')]?_0x215f7e[_0x20c6('0x130')]:'N.A.'},'messages':_(_0x215f7e[_0x20c6('0xec')])['tail']()[_0x20c6('0x93')]({'secret':![]})[_0x20c6('0x3d')](function(_0x466ee4){if(_0x466ee4['Attachment']){var _0x6abcc6=path['join'](_0x51fe5a,_0x466ee4[_0x20c6('0xdf')][_0x20c6('0xdc')]);if(fs[_0x20c6('0x131')](_0x6abcc6)){fs[_0x20c6('0x132')](_0x6abcc6)['pipe'](fs[_0x20c6('0x133')](path['join'](_0xff0478,_0x466ee4[_0x20c6('0xdf')]['basename'])));}}return{'date':moment(_0x466ee4['createdAt'])[_0x20c6('0xf1')](_0x20c6('0x12b'))[_0x20c6('0xa9')](),'sender':_0x466ee4[_0x20c6('0xfa')]===_0x20c6('0xcf')?_0x466ee4[_0x20c6('0x7f')]?_0x466ee4[_0x20c6('0x7f')][_0x20c6('0x3e')]:'System':_0x466ee4[_0x20c6('0x74')][_0x20c6('0x11c')]+(_0x466ee4[_0x20c6('0x74')][_0x20c6('0x11d')]?'\x20'+_0x466ee4[_0x20c6('0x74')][_0x20c6('0x11d')]:''),'body':_0x466ee4[_0x20c6('0xdf')]?_0x466ee4[_0x20c6('0xdf')]['basename']:_0x466ee4[_0x20c6('0x83')],'direction':_0x466ee4[_0x20c6('0xfa')]===_0x20c6('0xcf')?'A':'C','secret':_0x466ee4['secret'],'read':_0x466ee4[_0x20c6('0x11e')],'attachment':_0x466ee4['Attachment']};})['value']()};return ejs[_0x20c6('0x134')](path[_0x20c6('0xe7')](config[_0x20c6('0xe3')],_0x20c6('0x117'),_0x20c6('0x135'),_0x20c6('0x136')),{'interaction':_0x15ec05})[_0x20c6('0x37')](function(_0x1594f7){return new BPromise(function(_0x3efc8d,_0x15327a){pdf[_0x20c6('0xc3')](_0x1594f7,_0x13c9aa)['toFile'](path['join'](_0xff0478,'transcript-'+_0x215f7e['id']+'-'+_0x550ccd+'.pdf'),function(_0x5722c8,_0x1da5ae){if(_0x5722c8)return _0x15327a(_0x5722c8);_0x3efc8d(_0x1da5ae);});});})[_0x20c6('0x37')](function(){return new BPromise(function(_0x4c65a2,_0x2f4681){zipdir(_0xff0478,{'saveTo':_0x56a7c6},function(_0x5330f0,_0x5a9d70){if(_0x5330f0)return _0x2f4681(_0x5330f0);return _0x4c65a2(_0x5a9d70);});})['then'](function(){return new BPromise(function(_0x49570d,_0x21bda0){rimraf(_0xff0478,function(_0x1230a6){if(_0x1230a6)_0x21bda0(_0x1230a6);return _0x49570d();});});})['then'](function(){return _0x409ccc[_0x20c6('0xe2')](_0x56a7c6,_0x3afb6a,function(_0x461ab2){if(_0x461ab2){console[_0x20c6('0x137')](_0x20c6('0x138'),_0x461ab2);}else{fs['unlinkSync'](_0x56a7c6);}});});});}else{return _0x409ccc[_0x20c6('0x2e')](0xc8);}})[_0x20c6('0x2d')](handleError(_0x409ccc,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 43233c3..562a10c 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 _0x7d95=['emit','catch','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','getUsers','then','setDataValue','map','findAll','unreadMessages'];(function(_0x2f376e,_0x555d2e){var _0x34a46d=function(_0x4fada1){while(--_0x4fada1){_0x2f376e['push'](_0x2f376e['shift']());}};_0x34a46d(++_0x555d2e);}(_0x7d95,0x1ec));var _0x57d9=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0x7d95[_0x60286b];return _0x5dff69;};'use strict';var EventEmitter=require(_0x57d9('0x0'));var ChatInteraction=require(_0x57d9('0x1'))['db'][_0x57d9('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x57d9('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x57d9('0x4')](0x0);var events={'afterCreate':_0x57d9('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1c5448){return function(_0x46fdc6,_0x314a2d,_0x181c62){_0x46fdc6[_0x57d9('0x6')]({'attributes':['id'],'raw':!![]})[_0x57d9('0x7')](function(_0x54b72e){_0x46fdc6[_0x57d9('0x8')]('Users',_0x54b72e[_0x57d9('0x9')](function(_0x20a4f5){return{'id':_0x20a4f5['id']};}));return ChatMessage[_0x57d9('0xa')]({'where':{'ChatInteractionId':_0x46fdc6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x57d9('0x7')](function(_0x2c5738){_0x46fdc6[_0x57d9('0x8')](_0x57d9('0xb'),_0x2c5738['length']);ChatInteractionEvents[_0x57d9('0xc')](_0x1c5448+':'+_0x46fdc6['id'],_0x46fdc6);ChatInteractionEvents[_0x57d9('0xc')](_0x1c5448,_0x46fdc6);_0x181c62(null);})[_0x57d9('0xd')](_0x181c62(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x46c9=['Users','map','findAll','unreadMessages','emit','catch','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x46c9,0x106));var _0x946c=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0x46c9[_0x52f159];return _0x156799;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x946c('0x0')];var ChatMessage=require(_0x946c('0x1'))['db'][_0x946c('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x946c('0x3')](0x0);var events={'afterCreate':_0x946c('0x4'),'afterUpdate':_0x946c('0x5'),'afterDestroy':_0x946c('0x6')};function emitEvent(_0x7ced70){return function(_0x1d72a0,_0x464ed9,_0x12b399){_0x1d72a0[_0x946c('0x7')]({'attributes':['id'],'raw':!![]})[_0x946c('0x8')](function(_0x144180){_0x1d72a0[_0x946c('0x9')](_0x946c('0xa'),_0x144180[_0x946c('0xb')](function(_0x11c5c5){return{'id':_0x11c5c5['id']};}));return ChatMessage[_0x946c('0xc')]({'where':{'ChatInteractionId':_0x1d72a0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x946c('0x8')](function(_0x5c1375){_0x1d72a0[_0x946c('0x9')](_0x946c('0xd'),_0x5c1375['length']);ChatInteractionEvents[_0x946c('0xe')](_0x7ced70+':'+_0x1d72a0['id'],_0x1d72a0);ChatInteractionEvents['emit'](_0x7ced70,_0x1d72a0);_0x12b399(null);})[_0x946c('0xf')](_0x12b399(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 66c9486..5cf923c 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 _0x47ae=['util','moment','bluebird','path','rimraf','../../config/environment','exports','define','changed','closed','format','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4c10a8,_0x57c4ec){var _0xf73423=function(_0x5cd99f){while(--_0x5cd99f){_0x4c10a8['push'](_0x4c10a8['shift']());}};_0xf73423(++_0x57c4ec);}(_0x47ae,0x117));var _0xe47a=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x47ae[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0xe47a('0x0'));var util=require(_0xe47a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe47a('0x2'));var BPromise=require(_0xe47a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe47a('0x4'));var rimraf=require(_0xe47a('0x5'));var config=require(_0xe47a('0x6'));var attributes=require('./chatInteraction.attributes');module[_0xe47a('0x7')]=function(_0x18b3b3,_0x1ec6c5){return _0x18b3b3[_0xe47a('0x8')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53a12a,_0x4ee5d0,_0x5e99dc){if(_0x53a12a[_0xe47a('0x9')](_0xe47a('0xa'))){_0x53a12a['closedAt']=moment()[_0xe47a('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5e99dc(null,_0x53a12a);}},'charset':_0xe47a('0xc'),'collate':_0xe47a('0xd')});}; \ No newline at end of file +var _0x0c06=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions'];(function(_0x4d0e6e,_0x5b4ad9){var _0x15b991=function(_0x631847){while(--_0x631847){_0x4d0e6e['push'](_0x4d0e6e['shift']());}};_0x15b991(++_0x5b4ad9);}(_0x0c06,0xd5));var _0x60c0=function(_0x5590c2,_0x460013){_0x5590c2=_0x5590c2-0x0;var _0x548bef=_0x0c06[_0x5590c2];return _0x548bef;};'use strict';var _=require('lodash');var util=require(_0x60c0('0x0'));var logger=require('../../config/logger')(_0x60c0('0x1'));var moment=require(_0x60c0('0x2'));var BPromise=require('bluebird');var rp=require(_0x60c0('0x3'));var fs=require('fs');var path=require(_0x60c0('0x4'));var rimraf=require(_0x60c0('0x5'));var config=require(_0x60c0('0x6'));var attributes=require(_0x60c0('0x7'));module[_0x60c0('0x8')]=function(_0x5ec9f3,_0x3a4566){return _0x5ec9f3['define'](_0x60c0('0x9'),attributes,{'tableName':_0x60c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14d1a5,_0x1391b6,_0x121bde){if(_0x14d1a5['changed'](_0x60c0('0xb'))){_0x14d1a5[_0x60c0('0xc')]=moment()[_0x60c0('0xd')](_0x60c0('0xe'));}_0x121bde(null,_0x14d1a5);}},'charset':_0x60c0('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 05daff1..341dcb6 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 _0xc723=['limit','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','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','stringify','error','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc723,0x16f));var _0x3c72=function(_0x3bf3f1,_0x5b8238){_0x3bf3f1=_0x3bf3f1-0x0;var _0x5a0c0c=_0xc723[_0x3bf3f1];return _0x5a0c0c;};'use strict';var _=require(_0x3c72('0x0'));var util=require(_0x3c72('0x1'));var moment=require(_0x3c72('0x2'));var BPromise=require(_0x3c72('0x3'));var rs=require(_0x3c72('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c72('0x5'))['db'];var utils=require(_0x3c72('0x6'));var logger=require('../../config/logger')(_0x3c72('0x7'));var config=require('../../config/environment');var jayson=require(_0x3c72('0x8'));var client=jayson[_0x3c72('0x9')]['http']({'port':0x232a});config[_0x3c72('0xa')]=_[_0x3c72('0xb')](config[_0x3c72('0xa')],{'host':_0x3c72('0xc'),'port':0x18eb});var socket=require(_0x3c72('0xd'))(new Redis(config[_0x3c72('0xa')]));require(_0x3c72('0xe'))['register'](socket);function respondWithRpcPromise(_0x4ba720,_0x115824,_0x1931c5){return new BPromise(function(_0x32af51,_0x14187c){return client[_0x3c72('0xf')](_0x4ba720,_0x1931c5)[_0x3c72('0x10')](function(_0x2beca4){logger[_0x3c72('0x11')](_0x3c72('0x12'),_0x115824,_0x3c72('0x13'));logger[_0x3c72('0x14')](_0x3c72('0x15'),_0x115824,_0x3c72('0x13'),JSON[_0x3c72('0x16')](_0x2beca4));if(_0x2beca4[_0x3c72('0x17')]){if(_0x2beca4[_0x3c72('0x17')]['code']===0x1f4){logger[_0x3c72('0x17')](_0x3c72('0x12'),_0x115824,_0x2beca4[_0x3c72('0x17')][_0x3c72('0x18')]);return _0x14187c(_0x2beca4[_0x3c72('0x17')][_0x3c72('0x18')]);}logger[_0x3c72('0x17')](_0x3c72('0x12'),_0x115824,_0x2beca4[_0x3c72('0x17')]['message']);return _0x32af51(_0x2beca4[_0x3c72('0x17')]['message']);}else{logger[_0x3c72('0x11')](_0x3c72('0x12'),_0x115824,_0x3c72('0x13'));_0x32af51(_0x2beca4['result'][_0x3c72('0x18')]);}})[_0x3c72('0x19')](function(_0x377ff1){logger[_0x3c72('0x17')](_0x3c72('0x12'),_0x115824,_0x377ff1);_0x14187c(_0x377ff1);});});}exports[_0x3c72('0x1a')]=function(_0xfdcad4){var _0x223ff9=this;return new Promise(function(_0x4512d6,_0x33c0d3){return db[_0x3c72('0x1b')][_0x3c72('0x1c')](_0xfdcad4[_0x3c72('0x1d')],{'raw':_0xfdcad4[_0x3c72('0x1e')]?_0xfdcad4['options'][_0x3c72('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfdcad4[_0x3c72('0x1e')]?_0xfdcad4['options'][_0x3c72('0x20')]||null:null,'attributes':_0xfdcad4[_0x3c72('0x1e')]?_0xfdcad4[_0x3c72('0x1e')]['attributes']||null:null,'limit':_0xfdcad4['options']?_0xfdcad4[_0x3c72('0x1e')][_0x3c72('0x21')]||null:null})['then'](function(_0x4d4dca){logger[_0x3c72('0x11')]('UpdateChatInteraction',_0xfdcad4);logger[_0x3c72('0x14')](_0x3c72('0x1a'),_0xfdcad4,JSON[_0x3c72('0x16')](_0x4d4dca));_0x4512d6(_0x4d4dca);})[_0x3c72('0x19')](function(_0x2f5b79){logger[_0x3c72('0x17')]('UpdateChatInteraction',_0x2f5b79['message'],_0xfdcad4);_0x33c0d3(_0x223ff9['error'](0x1f4,_0x2f5b79[_0x3c72('0x18')]));});});};exports['AddTagsToChatInteraction']=function(_0x3a7aac){return new Promise(function(_0x13be0b,_0x47aff4){return db[_0x3c72('0x1b')][_0x3c72('0x22')]({'where':_0x3a7aac[_0x3c72('0x1e')]?_0x3a7aac['options'][_0x3c72('0x20')]||null:null})[_0x3c72('0x10')](function(_0x34ae10){if(_0x34ae10){return _0x34ae10[_0x3c72('0x23')](_0x3a7aac[_0x3c72('0x1d')][_0x3c72('0x24')],_[_0x3c72('0x25')](_0x3a7aac['body'],[_0x3c72('0x24'),'id'])||{});}})[_0x3c72('0x26')](function(_0x572b20){logger[_0x3c72('0x11')](_0x3c72('0x27'),_0x3a7aac);logger['debug'](_0x3c72('0x27'),_0x3a7aac,JSON[_0x3c72('0x16')](_0x572b20));_0x13be0b(_0x572b20);})[_0x3c72('0x19')](function(_0x5749db){logger['error'](_0x3c72('0x27'),_0x5749db[_0x3c72('0x18')],_0x3a7aac);_0x47aff4(_this[_0x3c72('0x17')](0x1f4,_0x5749db[_0x3c72('0x18')]));});});}; \ No newline at end of file +var _0x8969=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','debug','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x39cf33,_0x2214d7){var _0x8ff2e3=function(_0x1bb770){while(--_0x1bb770){_0x39cf33['push'](_0x39cf33['shift']());}};_0x8ff2e3(++_0x2214d7);}(_0x8969,0x1b1));var _0x9896=function(_0x1e0717,_0x29f843){_0x1e0717=_0x1e0717-0x0;var _0x217fbc=_0x8969[_0x1e0717];return _0x217fbc;};'use strict';var _=require(_0x9896('0x0'));var util=require(_0x9896('0x1'));var moment=require(_0x9896('0x2'));var BPromise=require(_0x9896('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9896('0x4'));var db=require(_0x9896('0x5'))['db'];var utils=require(_0x9896('0x6'));var logger=require('../../config/logger')(_0x9896('0x7'));var config=require(_0x9896('0x8'));var jayson=require(_0x9896('0x9'));var client=jayson['client'][_0x9896('0xa')]({'port':0x232a});config[_0x9896('0xb')]=_[_0x9896('0xc')](config[_0x9896('0xb')],{'host':_0x9896('0xd'),'port':0x18eb});var socket=require(_0x9896('0xe'))(new Redis(config[_0x9896('0xb')]));require(_0x9896('0xf'))[_0x9896('0x10')](socket);function respondWithRpcPromise(_0x8a1cf9,_0x413fe7,_0xe1e8c){return new BPromise(function(_0x1924a2,_0xc17451){return client[_0x9896('0x11')](_0x8a1cf9,_0xe1e8c)[_0x9896('0x12')](function(_0x11ec34){logger['info'](_0x9896('0x13'),_0x413fe7,'request\x20sent');logger['debug'](_0x9896('0x14'),_0x413fe7,_0x9896('0x15'),JSON['stringify'](_0x11ec34));if(_0x11ec34[_0x9896('0x16')]){if(_0x11ec34[_0x9896('0x16')][_0x9896('0x17')]===0x1f4){logger[_0x9896('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x413fe7,_0x11ec34['error'][_0x9896('0x18')]);return _0xc17451(_0x11ec34[_0x9896('0x16')][_0x9896('0x18')]);}logger[_0x9896('0x16')](_0x9896('0x13'),_0x413fe7,_0x11ec34[_0x9896('0x16')][_0x9896('0x18')]);return _0x1924a2(_0x11ec34['error']['message']);}else{logger[_0x9896('0x19')](_0x9896('0x13'),_0x413fe7,_0x9896('0x15'));_0x1924a2(_0x11ec34[_0x9896('0x1a')][_0x9896('0x18')]);}})[_0x9896('0x1b')](function(_0x2ebea8){logger[_0x9896('0x16')](_0x9896('0x13'),_0x413fe7,_0x2ebea8);_0xc17451(_0x2ebea8);});});}exports[_0x9896('0x1c')]=function(_0x27d812){var _0x561ad2=this;return new Promise(function(_0x34a3d1,_0x5713f1){return db[_0x9896('0x1d')][_0x9896('0x1e')](_0x27d812[_0x9896('0x1f')],{'raw':_0x27d812['options']?_0x27d812[_0x9896('0x20')][_0x9896('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27d812[_0x9896('0x20')]?_0x27d812['options'][_0x9896('0x22')]||null:null,'attributes':_0x27d812[_0x9896('0x20')]?_0x27d812[_0x9896('0x20')]['attributes']||null:null,'limit':_0x27d812['options']?_0x27d812[_0x9896('0x20')][_0x9896('0x23')]||null:null})[_0x9896('0x12')](function(_0xa7cf60){logger['info'](_0x9896('0x1c'),_0x27d812);logger[_0x9896('0x24')](_0x9896('0x1c'),_0x27d812,JSON['stringify'](_0xa7cf60));_0x34a3d1(_0xa7cf60);})[_0x9896('0x1b')](function(_0xa7f05){logger['error'](_0x9896('0x1c'),_0xa7f05[_0x9896('0x18')],_0x27d812);_0x5713f1(_0x561ad2[_0x9896('0x16')](0x1f4,_0xa7f05[_0x9896('0x18')]));});});};exports[_0x9896('0x25')]=function(_0x214149){return new Promise(function(_0x593000,_0x190973){return db['ChatInteraction'][_0x9896('0x26')]({'where':_0x214149['options']?_0x214149[_0x9896('0x20')]['where']||null:null})['then'](function(_0x55eea1){if(_0x55eea1){return _0x55eea1[_0x9896('0x27')](_0x214149[_0x9896('0x1f')][_0x9896('0x28')],_['omit'](_0x214149[_0x9896('0x1f')],[_0x9896('0x28'),'id'])||{});}})[_0x9896('0x29')](function(_0x42d47c){logger['info'](_0x9896('0x2a'),_0x214149);logger['debug'](_0x9896('0x2a'),_0x214149,JSON[_0x9896('0x2b')](_0x42d47c));_0x593000(_0x42d47c);})['catch'](function(_0x4b6d52){logger[_0x9896('0x16')](_0x9896('0x2a'),_0x4b6d52['message'],_0x214149);_0x190973(_this[_0x9896('0x16')](0x1f4,_0x4b6d52['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 8f035a8..6530433 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 _0x5ff6=['length','./chatInteraction.events','remove','update','removeListener','register'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5ff6,0x15d));var _0x65ff=function(_0x2cd559,_0x5da3bd){_0x2cd559=_0x2cd559-0x0;var _0x1d5f80=_0x5ff6[_0x2cd559];return _0x1d5f80;};'use strict';var ChatInteractionEvents=require(_0x65ff('0x0'));var events=['save',_0x65ff('0x1'),_0x65ff('0x2')];function createListener(_0x47cb78,_0x2e0e15){return function(_0x145726){_0x2e0e15['emit'](_0x47cb78,_0x145726);};}function removeListener(_0x4e347a,_0x2c2812){return function(){ChatInteractionEvents[_0x65ff('0x3')](_0x4e347a,_0x2c2812);};}exports[_0x65ff('0x4')]=function(_0x5eb14e){for(var _0x4540aa=0x0,_0x591089=events[_0x65ff('0x5')];_0x4540aa<_0x591089;_0x4540aa++){var _0x1ee6b4=events[_0x4540aa];var _0x1d3e98=createListener('chatInteraction:'+_0x1ee6b4,_0x5eb14e);ChatInteractionEvents['on'](_0x1ee6b4,_0x1d3e98);}}; \ No newline at end of file +var _0x5a6c=['save','remove','length','chatInteraction:','./chatInteraction.events'];(function(_0x18ae6e,_0xf18e2f){var _0xc91603=function(_0x4215fa){while(--_0x4215fa){_0x18ae6e['push'](_0x18ae6e['shift']());}};_0xc91603(++_0xf18e2f);}(_0x5a6c,0x95));var _0xc5a6=function(_0x8aa78f,_0x306ec5){_0x8aa78f=_0x8aa78f-0x0;var _0x3fc7c7=_0x5a6c[_0x8aa78f];return _0x3fc7c7;};'use strict';var ChatInteractionEvents=require(_0xc5a6('0x0'));var events=[_0xc5a6('0x1'),_0xc5a6('0x2'),'update'];function createListener(_0x13d7e4,_0x2be80b){return function(_0x1595ce){_0x2be80b['emit'](_0x13d7e4,_0x1595ce);};}function removeListener(_0x4c615d,_0x356645){return function(){ChatInteractionEvents['removeListener'](_0x4c615d,_0x356645);};}exports['register']=function(_0xcc8f11){for(var _0x3f2350=0x0,_0xff10d8=events[_0xc5a6('0x3')];_0x3f2350<_0xff10d8;_0x3f2350++){var _0x5f2e44=events[_0x3f2350];var _0x13a46f=createListener(_0xc5a6('0x4')+_0x5f2e44,_0xcc8f11);ChatInteractionEvents['on'](_0x5f2e44,_0x13a46f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 526732f..d5f8e12 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 _0xef1e=['addTags','put','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','multer','util','express','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat'];(function(_0xc42e34,_0x30d16b){var _0x5e65ef=function(_0x3b22c5){while(--_0x3b22c5){_0xc42e34['push'](_0xc42e34['shift']());}};_0x5e65ef(++_0x30d16b);}(_0xef1e,0x10b));var _0xeef1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xef1e[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xeef1('0x0'));var util=require(_0xeef1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeef1('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xeef1('0x3'));var config=require(_0xeef1('0x4'));var controller=require(_0xeef1('0x5'));router[_0xeef1('0x6')]('/',auth['isAuthenticated'](),controller[_0xeef1('0x7')]);router['get'](_0xeef1('0x8'),auth[_0xeef1('0x9')](),controller[_0xeef1('0xa')]);router['get'](_0xeef1('0xb'),auth[_0xeef1('0xc')](),controller['show']);router[_0xeef1('0x6')](_0xeef1('0xd'),auth[_0xeef1('0xc')](),controller[_0xeef1('0xe')]);router['get'](_0xeef1('0xf'),auth[_0xeef1('0x9')](),controller[_0xeef1('0x10')]);router[_0xeef1('0x6')](_0xeef1('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xeef1('0x12')]);router[_0xeef1('0x6')](_0xeef1('0x13'),auth[_0xeef1('0x9')](),controller[_0xeef1('0x14')]);router[_0xeef1('0x15')]('/',auth['isAuthenticated'](),controller[_0xeef1('0x16')]);router[_0xeef1('0x15')](_0xeef1('0x17'),auth[_0xeef1('0x9')](),controller[_0xeef1('0x18')]);var upload=multer({'storage':multer[_0xeef1('0x19')]({'destination':function(_0x331fab,_0x5f2e9e,_0xbc15a2){_0xbc15a2(null,path['join'](config['root'],_0xeef1('0x1a')));},'filename':function(_0x4a4983,_0x286b8e,_0x3ddea3){_0x3ddea3(null,util[_0xeef1('0x1b')]('%s-%s',Date[_0xeef1('0x1c')](),_0x286b8e[_0xeef1('0x1d')][_0xeef1('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xeef1('0x15')](_0xeef1('0x1f'),upload[_0xeef1('0x20')](_0xeef1('0x21')),controller[_0xeef1('0x22')]);router[_0xeef1('0x15')](_0xeef1('0xf'),auth[_0xeef1('0xc')](),controller[_0xeef1('0x23')]);router[_0xeef1('0x15')](_0xeef1('0x24'),auth[_0xeef1('0x9')](),interaction[_0xeef1('0x25')](_0xeef1('0x26'),'chatinteraction:addtags'),controller[_0xeef1('0x27')]);router[_0xeef1('0x28')](_0xeef1('0xb'),auth[_0xeef1('0x9')](),interaction[_0xeef1('0x25')](_0xeef1('0x26'),'chatinteraction:update'),controller[_0xeef1('0x29')]);router['put'](_0xeef1('0x2a'),controller['customUpdate']);router[_0xeef1('0x28')](_0xeef1('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0xeef1('0x2c')]);router[_0xeef1('0x28')](_0xeef1('0x2d'),controller[_0xeef1('0x2e')]);router[_0xeef1('0x2f')]('/:id',auth[_0xeef1('0x9')](),interaction[_0xeef1('0x25')](_0xeef1('0x26'),'chatinteraction:destroy'),controller[_0xeef1('0x30')]);router[_0xeef1('0x2f')](_0xeef1('0x24'),auth[_0xeef1('0x9')](),controller[_0xeef1('0x31')]);module[_0xeef1('0x32')]=router; \ No newline at end of file +var _0xbef5=['/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','now','replace'];(function(_0xbf5221,_0x24ddac){var _0x5da5f0=function(_0x3a9cea){while(--_0x3a9cea){_0xbf5221['push'](_0xbf5221['shift']());}};_0x5da5f0(++_0x24ddac);}(_0xbef5,0x1f1));var _0x5bef=function(_0x58db8c,_0x54e006){_0x58db8c=_0x58db8c-0x0;var _0x336313=_0xbef5[_0x58db8c];return _0x336313;};'use strict';var multer=require(_0x5bef('0x0'));var util=require(_0x5bef('0x1'));var path=require('path');var timeout=require(_0x5bef('0x2'));var express=require(_0x5bef('0x3'));var router=express[_0x5bef('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5bef('0x5'));var config=require(_0x5bef('0x6'));var controller=require(_0x5bef('0x7'));router[_0x5bef('0x8')]('/',auth['isAuthenticated'](),controller[_0x5bef('0x9')]);router[_0x5bef('0x8')](_0x5bef('0xa'),auth[_0x5bef('0xb')](),controller[_0x5bef('0xc')]);router[_0x5bef('0x8')](_0x5bef('0xd'),auth[_0x5bef('0xe')](),controller['show']);router[_0x5bef('0x8')](_0x5bef('0xf'),auth[_0x5bef('0xe')](),controller[_0x5bef('0x10')]);router[_0x5bef('0x8')](_0x5bef('0x11'),auth['isAuthenticated'](),controller[_0x5bef('0x12')]);router[_0x5bef('0x8')](_0x5bef('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x5bef('0x14')]);router[_0x5bef('0x8')](_0x5bef('0x15'),auth[_0x5bef('0xb')](),controller[_0x5bef('0x16')]);router[_0x5bef('0x17')]('/',auth[_0x5bef('0xb')](),controller['create']);router['post'](_0x5bef('0x18'),auth[_0x5bef('0xb')](),controller[_0x5bef('0x19')]);var upload=multer({'storage':multer[_0x5bef('0x1a')]({'destination':function(_0x2a6e53,_0x75861b,_0x85d3bd){_0x85d3bd(null,path[_0x5bef('0x1b')](config[_0x5bef('0x1c')],_0x5bef('0x1d')));},'filename':function(_0x4b4dc3,_0x167416,_0x317a80){_0x317a80(null,util[_0x5bef('0x1e')]('%s-%s',Date[_0x5bef('0x1f')](),_0x167416['originalname'][_0x5bef('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5bef('0x17')](_0x5bef('0x21'),upload[_0x5bef('0x22')](_0x5bef('0x23')),controller[_0x5bef('0x24')]);router[_0x5bef('0x17')](_0x5bef('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x5bef('0x25')]);router[_0x5bef('0x17')](_0x5bef('0x26'),auth[_0x5bef('0xb')](),interaction[_0x5bef('0x27')](_0x5bef('0x28'),'chatinteraction:addtags'),controller[_0x5bef('0x29')]);router[_0x5bef('0x2a')](_0x5bef('0xd'),auth['isAuthenticated'](),interaction[_0x5bef('0x27')](_0x5bef('0x28'),'chatinteraction:update'),controller[_0x5bef('0x2b')]);router[_0x5bef('0x2a')](_0x5bef('0x2c'),controller[_0x5bef('0x2d')]);router[_0x5bef('0x2a')](_0x5bef('0x2e'),auth['isChatInteractionAuthorized'](),controller[_0x5bef('0x2f')]);router[_0x5bef('0x2a')]('/:id/close',controller[_0x5bef('0x30')]);router[_0x5bef('0x31')](_0x5bef('0xd'),auth[_0x5bef('0xb')](),interaction[_0x5bef('0x27')]('chat',_0x5bef('0x32')),controller[_0x5bef('0x33')]);router[_0x5bef('0x31')](_0x5bef('0x26'),auth[_0x5bef('0xb')](),controller['removeTags']);module[_0x5bef('0x34')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index f3b7c92..abb5b38 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 _0x2ef3=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x75b343,_0x5e3960){var _0x469faf=function(_0x3109fe){while(--_0x3109fe){_0x75b343['push'](_0x75b343['shift']());}};_0x469faf(++_0x5e3960);}(_0x2ef3,0xba));var _0x32ef=function(_0x5e8ba1,_0x3a8d18){_0x5e8ba1=_0x5e8ba1-0x0;var _0x214e2d=_0x2ef3[_0x5e8ba1];return _0x214e2d;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'body':{'type':Sequelize[_0x32ef('0x2')](_0x32ef('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x32ef('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x32ef('0x5')]}}; \ No newline at end of file +var _0xda2d=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x435615,_0x29f526){var _0x416d29=function(_0x26d373){while(--_0x26d373){_0x435615['push'](_0x435615['shift']());}};_0x416d29(++_0x29f526);}(_0xda2d,0x102));var _0xdda2=function(_0xf0367e,_0x5de51b){_0xf0367e=_0xf0367e-0x0;var _0x125e59=_0xda2d[_0xf0367e];return _0x125e59;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'body':{'type':Sequelize[_0xdda2('0x1')](_0xdda2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdda2('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdda2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 6b64cbc..388cd96 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 _0x65c4=['FromId','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','catch','show','length','include','create','body','find','params','describe','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','messages'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x65c4,0x1d1));var _0x465c=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x65c4[_0x411add];return _0x238242;};'use strict';var pdf=require(_0x465c('0x0'));var emlformat=require(_0x465c('0x1'));var rimraf=require(_0x465c('0x2'));var zipdir=require(_0x465c('0x3'));var jsonpatch=require(_0x465c('0x4'));var rp=require(_0x465c('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x465c('0x6'));var util=require(_0x465c('0x7'));var path=require(_0x465c('0x8'));var sox=require(_0x465c('0x9'));var csv=require(_0x465c('0xa'));var ejs=require(_0x465c('0xb'));var fs=require('fs');var _=require(_0x465c('0xc'));var squel=require('squel');var crypto=require(_0x465c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x465c('0xe'));var toCsv=require(_0x465c('0xa'));var querystring=require('querystring');var Papa=require(_0x465c('0xf'));var Redis=require(_0x465c('0x10'));var authService=require(_0x465c('0x11'));var qs=require(_0x465c('0x12'));var as=require(_0x465c('0x13'));var hardwareService=require(_0x465c('0x14'));var logger=require(_0x465c('0x15'))(_0x465c('0x16'));var utils=require(_0x465c('0x17'));var config=require(_0x465c('0x18'));var licenseUtil=require(_0x465c('0x19'));var db=require(_0x465c('0x1a'))['db'];config['redis']=_['defaults'](config[_0x465c('0x1b')],{'host':_0x465c('0x1c'),'port':0x18eb});var socket=require(_0x465c('0x1d'))(new Redis(config[_0x465c('0x1b')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x31c188,_0xd940c1){_0xd940c1=_0xd940c1||0xcc;return function(_0x3d3986){if(_0x3d3986){return _0x31c188[_0x465c('0x1e')](_0xd940c1);}return _0x31c188['status'](_0xd940c1)[_0x465c('0x1f')]();};}function respondWithResult(_0x1852bd,_0x4874b0){_0x4874b0=_0x4874b0||0xc8;return function(_0x5a8411){if(_0x5a8411){return _0x1852bd[_0x465c('0x20')](_0x4874b0)[_0x465c('0x21')](_0x5a8411);}};}function respondWithFilteredResult(_0x2480cf,_0x96ba43){return function(_0x48aafd){if(_0x48aafd){var _0x5df0dd=_0x48aafd[_0x465c('0x22')],_0x3f9e15=_0x96ba43[_0x465c('0x23')],_0x53089e=_0x96ba43[_0x465c('0x23')]+_0x96ba43[_0x465c('0x24')],_0x1dfcbe;if(_0x53089e>=_0x5df0dd){_0x53089e=_0x5df0dd;_0x1dfcbe=0xc8;}else{_0x1dfcbe=0xce;}_0x2480cf['status'](_0x1dfcbe);return _0x2480cf[_0x465c('0x25')](_0x465c('0x26'),_0x3f9e15+'-'+_0x53089e+'/'+_0x5df0dd)[_0x465c('0x21')](_0x48aafd);}return null;};}function patchUpdates(_0x50e2e9){return function(_0x37dc5e){try{jsonpatch[_0x465c('0x27')](_0x37dc5e,_0x50e2e9,!![]);}catch(_0x107770){return BPromise[_0x465c('0x28')](_0x107770);}return _0x37dc5e[_0x465c('0x29')]();};}function saveUpdates(_0x3c9d8b,_0xa85b22){return function(_0x201dc7){if(_0x201dc7){return _0x201dc7[_0x465c('0x2a')](_0x3c9d8b)[_0x465c('0x2b')](function(_0x69b617){return _0x69b617;});}return null;};}function removeEntity(_0x1202d9,_0x472f6c){return function(_0x7fead3){if(_0x7fead3){return _0x7fead3[_0x465c('0x2c')]()['then'](function(){_0x1202d9[_0x465c('0x20')](0xcc)[_0x465c('0x1f')]();});}};}function handleEntityNotFound(_0x4139b4,_0x442a59){return function(_0x43b76a){if(!_0x43b76a){_0x4139b4[_0x465c('0x1e')](0x194);}return _0x43b76a;};}function handleError(_0x5bbfff,_0x1c0369){_0x1c0369=_0x1c0369||0x1f4;return function(_0x77984b){logger[_0x465c('0x2d')](_0x77984b['stack']);if(_0x77984b[_0x465c('0x2e')]){delete _0x77984b['name'];}_0x5bbfff[_0x465c('0x20')](_0x1c0369)[_0x465c('0x2f')](_0x77984b);};}exports[_0x465c('0x30')]=function(_0x3b002b,_0x53aa31){var _0x549709={},_0x36e360={},_0x44b112={'count':0x0,'rows':[]};var _0x43eeb5=_['map'](db[_0x465c('0x31')][_0x465c('0x32')],function(_0x4246e8){return{'name':_0x4246e8[_0x465c('0x33')],'type':_0x4246e8[_0x465c('0x34')]['key']};});_0x36e360[_0x465c('0x35')]=_[_0x465c('0x36')](_0x43eeb5,_0x465c('0x2e'));_0x36e360[_0x465c('0x37')]=_[_0x465c('0x38')](_0x3b002b[_0x465c('0x37')]);_0x36e360[_0x465c('0x39')]=_[_0x465c('0x3a')](_0x36e360[_0x465c('0x35')],_0x36e360[_0x465c('0x37')]);_0x549709[_0x465c('0x3b')]=_[_0x465c('0x3a')](_0x36e360[_0x465c('0x35')],qs[_0x465c('0x3c')](_0x3b002b[_0x465c('0x37')][_0x465c('0x3c')]));_0x549709[_0x465c('0x3b')]=_0x549709[_0x465c('0x3b')]['length']?_0x549709['attributes']:_0x36e360[_0x465c('0x35')];if(!_0x3b002b['query'][_0x465c('0x3d')](_0x465c('0x3e'))){_0x549709[_0x465c('0x24')]=qs[_0x465c('0x24')](_0x3b002b[_0x465c('0x37')]['limit']);_0x549709[_0x465c('0x23')]=qs[_0x465c('0x23')](_0x3b002b[_0x465c('0x37')][_0x465c('0x23')]);}_0x549709[_0x465c('0x3f')]=qs[_0x465c('0x40')](_0x3b002b[_0x465c('0x37')][_0x465c('0x40')]);_0x549709[_0x465c('0x41')]=qs[_0x465c('0x39')](_[_0x465c('0x42')](_0x3b002b[_0x465c('0x37')],_0x36e360['filters']),_0x43eeb5);if(_0x3b002b[_0x465c('0x37')][_0x465c('0x43')]){_0x549709['where']=_['merge'](_0x549709['where'],{'$or':_[_0x465c('0x36')](_0x43eeb5,function(_0x2e057e){if(_0x2e057e[_0x465c('0x34')]!==_0x465c('0x44')){var _0x4bfc3d={};_0x4bfc3d[_0x2e057e['name']]={'$like':'%'+_0x3b002b[_0x465c('0x37')][_0x465c('0x43')]+'%'};return _0x4bfc3d;}})});}_0x549709=_['merge']({},_0x549709,_0x3b002b[_0x465c('0x45')]);var _0x232c2d={'where':_0x549709['where']};return db[_0x465c('0x31')][_0x465c('0x22')](_0x232c2d)['then'](function(_0x201ec0){_0x44b112[_0x465c('0x22')]=_0x201ec0;if(_0x3b002b[_0x465c('0x37')][_0x465c('0x46')]){_0x549709['include']=[{'all':!![]}];}return db[_0x465c('0x31')][_0x465c('0x47')](_0x549709);})[_0x465c('0x2b')](function(_0x116248){_0x44b112['rows']=_0x116248;return _0x44b112;})[_0x465c('0x2b')](respondWithFilteredResult(_0x53aa31,_0x549709))[_0x465c('0x48')](handleError(_0x53aa31,null));};exports[_0x465c('0x49')]=function(_0x416f2b,_0x3ed80d){var _0x49345a={'raw':!![],'where':{'id':_0x416f2b['params']['id']}},_0x10405c={};_0x10405c[_0x465c('0x35')]=_[_0x465c('0x38')](db[_0x465c('0x31')][_0x465c('0x32')]);_0x10405c['query']=_[_0x465c('0x38')](_0x416f2b['query']);_0x10405c[_0x465c('0x39')]=_[_0x465c('0x3a')](_0x10405c[_0x465c('0x35')],_0x10405c[_0x465c('0x37')]);_0x49345a[_0x465c('0x3b')]=_['intersection'](_0x10405c['model'],qs[_0x465c('0x3c')](_0x416f2b[_0x465c('0x37')][_0x465c('0x3c')]));_0x49345a[_0x465c('0x3b')]=_0x49345a['attributes'][_0x465c('0x4a')]?_0x49345a['attributes']:_0x10405c[_0x465c('0x35')];if(_0x416f2b[_0x465c('0x37')][_0x465c('0x46')]){_0x49345a[_0x465c('0x4b')]=[{'all':!![]}];}_0x49345a=_['merge']({},_0x49345a,_0x416f2b['options']);return db[_0x465c('0x31')]['find'](_0x49345a)[_0x465c('0x2b')](handleEntityNotFound(_0x3ed80d,null))[_0x465c('0x2b')](respondWithResult(_0x3ed80d,null))[_0x465c('0x48')](handleError(_0x3ed80d,null));};exports['create']=function(_0x124ece,_0x1c91b7){return db[_0x465c('0x31')][_0x465c('0x4c')](_0x124ece[_0x465c('0x4d')],{})[_0x465c('0x2b')](respondWithResult(_0x1c91b7,0xc9))[_0x465c('0x48')](handleError(_0x1c91b7,null));};exports[_0x465c('0x2a')]=function(_0x26e4f7,_0x38bb9c){if(_0x26e4f7['body']['id']){delete _0x26e4f7[_0x465c('0x4d')]['id'];}return db[_0x465c('0x31')][_0x465c('0x4e')]({'where':{'id':_0x26e4f7[_0x465c('0x4f')]['id']}})[_0x465c('0x2b')](handleEntityNotFound(_0x38bb9c,null))[_0x465c('0x2b')](saveUpdates(_0x26e4f7['body'],null))[_0x465c('0x2b')](respondWithResult(_0x38bb9c,null))[_0x465c('0x48')](handleError(_0x38bb9c,null));};exports['destroy']=function(_0x2fc222,_0xcb5d8d){return db[_0x465c('0x31')][_0x465c('0x4e')]({'where':{'id':_0x2fc222['params']['id']}})[_0x465c('0x2b')](handleEntityNotFound(_0xcb5d8d,null))[_0x465c('0x2b')](removeEntity(_0xcb5d8d,null))['catch'](handleError(_0xcb5d8d,null));};exports[_0x465c('0x50')]=function(_0x5a331f,_0x4d10c4){return db['ChatInternalMessage'][_0x465c('0x50')]()[_0x465c('0x2b')](respondWithResult(_0x4d10c4,null))[_0x465c('0x48')](handleError(_0x4d10c4,null));};function wrapUser(_0x3965af){return function(_0x44c298){var _0x5ee9b2=_0x3965af['get']({'plain':!![]});_0x5ee9b2['messages']=[];if(_0x44c298){_0x5ee9b2['lastMessageAt']=_0x44c298[_0x465c('0x51')];_0x5ee9b2[_0x465c('0x52')]=_0x44c298;}else{_0x5ee9b2[_0x465c('0x53')]=moment(0x0)[_0x465c('0x54')](_0x465c('0x55'));_0x5ee9b2[_0x465c('0x52')]={};}return _0x5ee9b2;};}exports[_0x465c('0x56')]=function(_0x4e3dae,_0x5aed38,_0x3aac0b){var _0x5b9d9a=[];return db['User']['findAll']({'where':{'role':[_0x465c('0x57'),_0x465c('0x58'),_0x465c('0x59')]},'attributes':['id',_0x465c('0x5a'),_0x465c('0x2e'),_0x465c('0x5b'),_0x465c('0x5c'),_0x465c('0x5d'),_0x465c('0x5e'),_0x465c('0x5f'),_0x465c('0x60'),_0x465c('0x61')],'order':qs['sort'](_0x465c('0x62')),'include':[{'model':db[_0x465c('0x63')],'as':_0x465c('0x64'),'attributes':['id',_0x465c('0x2e'),_0x465c('0x34')],'through':{'attributes':[]}}]})[_0x465c('0x2b')](function(_0xa84d38){if(_0xa84d38){var _0x2a25b7=_0x4e3dae[_0x465c('0x59')]['get']({'plain':!![]});if(!_0x2a25b7)throw new Error(_0x465c('0x65'));if(_0x2a25b7[_0x465c('0x5b')]===_0x465c('0x59')){return db[_0x465c('0x66')]['find']({'where':{'name':_0x465c('0x67'),'userProfileId':_0x2a25b7[_0x465c('0x68')]},'raw':!![]})[_0x465c('0x2b')](function(_0x224233){if(_0x224233){if(_0x224233[_0x465c('0x69')]===0x0){return db[_0x465c('0x6a')][_0x465c('0x47')]({'where':{'sectionId':_0x224233['id']},'raw':!![]})[_0x465c('0x2b')](function(_0x5db7ec){var _0x505be3=[];if(_['isEmpty'](_0x5db7ec)){_0x505be3=_[_0x465c('0x43')](_0xa84d38,function(_0x434259){if(_0x434259[_0x465c('0x5b')]!==_0x465c('0x57')){return _0x434259;}});return _0x505be3;}else{for(var _0x5bb67f=0x0;_0x5bb67f<_0xa84d38[_0x465c('0x4a')];_0x5bb67f++){var _0x30d00c=_0xa84d38[_0x5bb67f];if(_0x30d00c[_0x465c('0x5b')]===_0x465c('0x57')){var _0x565169=_[_0x465c('0x4e')](_0x5db7ec,function(_0x49b588){return _0x49b588[_0x465c('0x6b')]===_0x30d00c['id'];});if(_0x565169)_0x505be3[_0x465c('0x6c')](_0x30d00c);}else{_0x505be3['push'](_0x30d00c);}}return _0x505be3;}});}else{return _0xa84d38;}}else{var _0x59b4b7=_[_0x465c('0x43')](_0xa84d38,function(_0x2bc4c9){if(_0x2bc4c9[_0x465c('0x5b')]!==_0x465c('0x57')){return _0x2bc4c9;}});return _0x59b4b7;}});}else{return _0xa84d38;}}})[_0x465c('0x2b')](function(_0x489e05){var _0x3f7891=[];if(_0x489e05){_0x5b9d9a=_0x489e05;for(var _0x588197=0x0;_0x588197<_0x489e05[_0x465c('0x4a')];_0x588197+=0x1){_0x5b9d9a[_0x588197][_0x465c('0x6d')]=[];_0x3f7891[_0x465c('0x6c')](db[_0x465c('0x31')][_0x465c('0x4e')]({'where':{'FromId':[_0x4e3dae[_0x465c('0x59')]['id'],_0x489e05[_0x588197]['id']],'ToId':[_0x4e3dae['user']['id'],_0x489e05[_0x588197]['id']],'ChatGroupId':null},'attributes':['id',_0x465c('0x51'),_0x465c('0x6e'),_0x465c('0x6f'),_0x465c('0x70'),_0x465c('0x4d')],'order':qs[_0x465c('0x40')](_0x465c('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x489e05[_0x588197])));}return BPromise[_0x465c('0x72')](_0x3f7891);}return[];})[_0x465c('0x2b')](function(_0x4e681f){return{'rows':_0x4e681f,'count':_0x4e681f[_0x465c('0x4a')]};})['then'](respondWithResult(_0x5aed38,null))[_0x465c('0x48')](handleError(_0x5aed38,null));}; \ No newline at end of file +var _0xc4b6=['read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','messages','lastMessageAt','createdAt','lastMessage','getUsers','User','agent','user','role','userpic','internal','online','lastLoginAt','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','FromId','ToId'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc4b6,0xd9));var _0x6c4b=function(_0x1831fa,_0x2977e6){_0x1831fa=_0x1831fa-0x0;var _0x219f00=_0xc4b6[_0x1831fa];return _0x219f00;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6c4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c4b('0x1'));var jsonpatch=require(_0x6c4b('0x2'));var rp=require(_0x6c4b('0x3'));var moment=require('moment');var BPromise=require(_0x6c4b('0x4'));var Mustache=require('mustache');var util=require(_0x6c4b('0x5'));var path=require('path');var sox=require(_0x6c4b('0x6'));var csv=require(_0x6c4b('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6c4b('0x8'));var squel=require(_0x6c4b('0x9'));var crypto=require(_0x6c4b('0xa'));var jsforce=require(_0x6c4b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6c4b('0x7'));var querystring=require(_0x6c4b('0xc'));var Papa=require(_0x6c4b('0xd'));var Redis=require(_0x6c4b('0xe'));var authService=require(_0x6c4b('0xf'));var qs=require(_0x6c4b('0x10'));var as=require(_0x6c4b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c4b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6c4b('0x13'));var licenseUtil=require(_0x6c4b('0x14'));var db=require(_0x6c4b('0x15'))['db'];config[_0x6c4b('0x16')]=_['defaults'](config[_0x6c4b('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c4b('0x17'))(new Redis(config[_0x6c4b('0x16')]));require(_0x6c4b('0x18'))[_0x6c4b('0x19')](socket);function respondWithStatusCode(_0x55fd41,_0x184c09){_0x184c09=_0x184c09||0xcc;return function(_0x155a02){if(_0x155a02){return _0x55fd41[_0x6c4b('0x1a')](_0x184c09);}return _0x55fd41[_0x6c4b('0x1b')](_0x184c09)[_0x6c4b('0x1c')]();};}function respondWithResult(_0x2b090a,_0xed58c0){_0xed58c0=_0xed58c0||0xc8;return function(_0x2880c6){if(_0x2880c6){return _0x2b090a['status'](_0xed58c0)[_0x6c4b('0x1d')](_0x2880c6);}};}function respondWithFilteredResult(_0xad64de,_0x5e8b23){return function(_0x20004d){if(_0x20004d){var _0x4a08cc=_0x20004d[_0x6c4b('0x1e')],_0x17459a=_0x5e8b23[_0x6c4b('0x1f')],_0x36bcb7=_0x5e8b23['offset']+_0x5e8b23[_0x6c4b('0x20')],_0x19159e;if(_0x36bcb7>=_0x4a08cc){_0x36bcb7=_0x4a08cc;_0x19159e=0xc8;}else{_0x19159e=0xce;}_0xad64de['status'](_0x19159e);return _0xad64de[_0x6c4b('0x21')](_0x6c4b('0x22'),_0x17459a+'-'+_0x36bcb7+'/'+_0x4a08cc)[_0x6c4b('0x1d')](_0x20004d);}return null;};}function patchUpdates(_0x30d98e){return function(_0x10867c){try{jsonpatch[_0x6c4b('0x23')](_0x10867c,_0x30d98e,!![]);}catch(_0x2cd870){return BPromise[_0x6c4b('0x24')](_0x2cd870);}return _0x10867c[_0x6c4b('0x25')]();};}function saveUpdates(_0x287eda,_0x264ec7){return function(_0x480e3e){if(_0x480e3e){return _0x480e3e[_0x6c4b('0x26')](_0x287eda)[_0x6c4b('0x27')](function(_0x4721bc){return _0x4721bc;});}return null;};}function removeEntity(_0x3de512,_0x4b8298){return function(_0x4b54f2){if(_0x4b54f2){return _0x4b54f2['destroy']()['then'](function(){_0x3de512['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10efb4,_0x53942e){return function(_0x2da36d){if(!_0x2da36d){_0x10efb4[_0x6c4b('0x1a')](0x194);}return _0x2da36d;};}function handleError(_0x11b21a,_0x53fbd4){_0x53fbd4=_0x53fbd4||0x1f4;return function(_0x4636a3){logger['error'](_0x4636a3['stack']);if(_0x4636a3['name']){delete _0x4636a3[_0x6c4b('0x28')];}_0x11b21a[_0x6c4b('0x1b')](_0x53fbd4)[_0x6c4b('0x29')](_0x4636a3);};}exports[_0x6c4b('0x2a')]=function(_0xae1345,_0x587070){var _0x26ab5d={},_0x22a9e1={},_0x2af3ad={'count':0x0,'rows':[]};var _0x4fc809=_[_0x6c4b('0x2b')](db[_0x6c4b('0x2c')][_0x6c4b('0x2d')],function(_0x283f6f){return{'name':_0x283f6f[_0x6c4b('0x2e')],'type':_0x283f6f['type'][_0x6c4b('0x2f')]};});_0x22a9e1[_0x6c4b('0x30')]=_[_0x6c4b('0x2b')](_0x4fc809,_0x6c4b('0x28'));_0x22a9e1[_0x6c4b('0x31')]=_[_0x6c4b('0x32')](_0xae1345[_0x6c4b('0x31')]);_0x22a9e1['filters']=_[_0x6c4b('0x33')](_0x22a9e1['model'],_0x22a9e1[_0x6c4b('0x31')]);_0x26ab5d['attributes']=_['intersection'](_0x22a9e1['model'],qs[_0x6c4b('0x34')](_0xae1345[_0x6c4b('0x31')][_0x6c4b('0x34')]));_0x26ab5d[_0x6c4b('0x35')]=_0x26ab5d['attributes'][_0x6c4b('0x36')]?_0x26ab5d[_0x6c4b('0x35')]:_0x22a9e1[_0x6c4b('0x30')];if(!_0xae1345[_0x6c4b('0x31')][_0x6c4b('0x37')](_0x6c4b('0x38'))){_0x26ab5d[_0x6c4b('0x20')]=qs[_0x6c4b('0x20')](_0xae1345[_0x6c4b('0x31')][_0x6c4b('0x20')]);_0x26ab5d['offset']=qs['offset'](_0xae1345['query'][_0x6c4b('0x1f')]);}_0x26ab5d[_0x6c4b('0x39')]=qs[_0x6c4b('0x3a')](_0xae1345[_0x6c4b('0x31')]['sort']);_0x26ab5d[_0x6c4b('0x3b')]=qs[_0x6c4b('0x3c')](_[_0x6c4b('0x3d')](_0xae1345[_0x6c4b('0x31')],_0x22a9e1[_0x6c4b('0x3c')]),_0x4fc809);if(_0xae1345[_0x6c4b('0x31')][_0x6c4b('0x3e')]){_0x26ab5d['where']=_['merge'](_0x26ab5d['where'],{'$or':_['map'](_0x4fc809,function(_0x434b06){if(_0x434b06[_0x6c4b('0x3f')]!==_0x6c4b('0x40')){var _0x1a09d3={};_0x1a09d3[_0x434b06['name']]={'$like':'%'+_0xae1345[_0x6c4b('0x31')]['filter']+'%'};return _0x1a09d3;}})});}_0x26ab5d=_[_0x6c4b('0x41')]({},_0x26ab5d,_0xae1345[_0x6c4b('0x42')]);var _0x2fb368={'where':_0x26ab5d[_0x6c4b('0x3b')]};return db[_0x6c4b('0x2c')][_0x6c4b('0x1e')](_0x2fb368)[_0x6c4b('0x27')](function(_0x5d9d76){_0x2af3ad[_0x6c4b('0x1e')]=_0x5d9d76;if(_0xae1345[_0x6c4b('0x31')]['includeAll']){_0x26ab5d[_0x6c4b('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x6c4b('0x44')](_0x26ab5d);})[_0x6c4b('0x27')](function(_0x3fd74f){_0x2af3ad[_0x6c4b('0x45')]=_0x3fd74f;return _0x2af3ad;})[_0x6c4b('0x27')](respondWithFilteredResult(_0x587070,_0x26ab5d))[_0x6c4b('0x46')](handleError(_0x587070,null));};exports[_0x6c4b('0x47')]=function(_0x6c7467,_0x193f50){var _0x359c0f={'raw':!![],'where':{'id':_0x6c7467[_0x6c4b('0x48')]['id']}},_0x5d8cdc={};_0x5d8cdc[_0x6c4b('0x30')]=_['keys'](db[_0x6c4b('0x2c')][_0x6c4b('0x2d')]);_0x5d8cdc['query']=_['keys'](_0x6c7467[_0x6c4b('0x31')]);_0x5d8cdc[_0x6c4b('0x3c')]=_[_0x6c4b('0x33')](_0x5d8cdc[_0x6c4b('0x30')],_0x5d8cdc[_0x6c4b('0x31')]);_0x359c0f['attributes']=_[_0x6c4b('0x33')](_0x5d8cdc[_0x6c4b('0x30')],qs[_0x6c4b('0x34')](_0x6c7467[_0x6c4b('0x31')][_0x6c4b('0x34')]));_0x359c0f[_0x6c4b('0x35')]=_0x359c0f['attributes'][_0x6c4b('0x36')]?_0x359c0f[_0x6c4b('0x35')]:_0x5d8cdc[_0x6c4b('0x30')];if(_0x6c7467['query'][_0x6c4b('0x49')]){_0x359c0f[_0x6c4b('0x43')]=[{'all':!![]}];}_0x359c0f=_['merge']({},_0x359c0f,_0x6c7467['options']);return db[_0x6c4b('0x2c')][_0x6c4b('0x4a')](_0x359c0f)[_0x6c4b('0x27')](handleEntityNotFound(_0x193f50,null))[_0x6c4b('0x27')](respondWithResult(_0x193f50,null))[_0x6c4b('0x46')](handleError(_0x193f50,null));};exports[_0x6c4b('0x4b')]=function(_0x4ec151,_0x3f7d40){return db['ChatInternalMessage'][_0x6c4b('0x4b')](_0x4ec151['body'],{})[_0x6c4b('0x27')](respondWithResult(_0x3f7d40,0xc9))[_0x6c4b('0x46')](handleError(_0x3f7d40,null));};exports[_0x6c4b('0x26')]=function(_0x1ae0ec,_0x492827){if(_0x1ae0ec[_0x6c4b('0x4c')]['id']){delete _0x1ae0ec['body']['id'];}return db[_0x6c4b('0x2c')]['find']({'where':{'id':_0x1ae0ec[_0x6c4b('0x48')]['id']}})[_0x6c4b('0x27')](handleEntityNotFound(_0x492827,null))['then'](saveUpdates(_0x1ae0ec[_0x6c4b('0x4c')],null))[_0x6c4b('0x27')](respondWithResult(_0x492827,null))[_0x6c4b('0x46')](handleError(_0x492827,null));};exports[_0x6c4b('0x4d')]=function(_0x2b8288,_0x41d304){return db[_0x6c4b('0x2c')]['find']({'where':{'id':_0x2b8288[_0x6c4b('0x48')]['id']}})['then'](handleEntityNotFound(_0x41d304,null))[_0x6c4b('0x27')](removeEntity(_0x41d304,null))['catch'](handleError(_0x41d304,null));};exports[_0x6c4b('0x4e')]=function(_0x559cb1,_0x3db7ac){return db[_0x6c4b('0x2c')]['describe']()[_0x6c4b('0x27')](respondWithResult(_0x3db7ac,null))['catch'](handleError(_0x3db7ac,null));};function wrapUser(_0xa7bf29){return function(_0xad8804){var _0xe44e16=_0xa7bf29['get']({'plain':!![]});_0xe44e16[_0x6c4b('0x4f')]=[];if(_0xad8804){_0xe44e16[_0x6c4b('0x50')]=_0xad8804[_0x6c4b('0x51')];_0xe44e16[_0x6c4b('0x52')]=_0xad8804;}else{_0xe44e16['lastMessageAt']=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0xe44e16[_0x6c4b('0x52')]={};}return _0xe44e16;};}exports[_0x6c4b('0x53')]=function(_0x9c0cbd,_0x422798,_0x59e7bc){var _0x555c4a=[];return db[_0x6c4b('0x54')]['findAll']({'where':{'role':[_0x6c4b('0x55'),'admin',_0x6c4b('0x56')]},'attributes':['id','fullname',_0x6c4b('0x28'),_0x6c4b('0x57'),_0x6c4b('0x58'),_0x6c4b('0x59'),_0x6c4b('0x5a'),_0x6c4b('0x5b'),'allowmessenger','showWebBar'],'order':qs['sort']('-online'),'include':[{'model':db[_0x6c4b('0x5c')],'as':_0x6c4b('0x5d'),'attributes':['id',_0x6c4b('0x28'),_0x6c4b('0x3f')],'through':{'attributes':[]}}]})[_0x6c4b('0x27')](function(_0x8df09a){if(_0x8df09a){var _0x1e2fc8=_0x9c0cbd[_0x6c4b('0x56')][_0x6c4b('0x5e')]({'plain':!![]});if(!_0x1e2fc8)throw new Error(_0x6c4b('0x5f'));if(_0x1e2fc8[_0x6c4b('0x57')]===_0x6c4b('0x56')){return db[_0x6c4b('0x60')][_0x6c4b('0x4a')]({'where':{'name':'Agents','userProfileId':_0x1e2fc8[_0x6c4b('0x61')]},'raw':!![]})[_0x6c4b('0x27')](function(_0x5974c4){if(_0x5974c4){if(_0x5974c4[_0x6c4b('0x62')]===0x0){return db[_0x6c4b('0x63')][_0x6c4b('0x44')]({'where':{'sectionId':_0x5974c4['id']},'raw':!![]})['then'](function(_0xb8b1f2){var _0x2c6ea8=[];if(_[_0x6c4b('0x64')](_0xb8b1f2)){_0x2c6ea8=_[_0x6c4b('0x3e')](_0x8df09a,function(_0x37b1e9){if(_0x37b1e9[_0x6c4b('0x57')]!==_0x6c4b('0x55')){return _0x37b1e9;}});return _0x2c6ea8;}else{for(var _0x56cd6a=0x0;_0x56cd6a<_0x8df09a[_0x6c4b('0x36')];_0x56cd6a++){var _0x19b4ba=_0x8df09a[_0x56cd6a];if(_0x19b4ba[_0x6c4b('0x57')]===_0x6c4b('0x55')){var _0x49c2ae=_[_0x6c4b('0x4a')](_0xb8b1f2,function(_0x50dfe6){return _0x50dfe6[_0x6c4b('0x65')]===_0x19b4ba['id'];});if(_0x49c2ae)_0x2c6ea8['push'](_0x19b4ba);}else{_0x2c6ea8['push'](_0x19b4ba);}}return _0x2c6ea8;}});}else{return _0x8df09a;}}else{var _0xf5bfc9=_[_0x6c4b('0x3e')](_0x8df09a,function(_0x11815b){if(_0x11815b[_0x6c4b('0x57')]!==_0x6c4b('0x55')){return _0x11815b;}});return _0xf5bfc9;}});}else{return _0x8df09a;}}})[_0x6c4b('0x27')](function(_0x1e2940){var _0x4e5961=[];if(_0x1e2940){_0x555c4a=_0x1e2940;for(var _0x4c9f60=0x0;_0x4c9f60<_0x1e2940['length'];_0x4c9f60+=0x1){_0x555c4a[_0x4c9f60]['messages']=[];_0x4e5961['push'](db[_0x6c4b('0x2c')][_0x6c4b('0x4a')]({'where':{'FromId':[_0x9c0cbd[_0x6c4b('0x56')]['id'],_0x1e2940[_0x4c9f60]['id']],'ToId':[_0x9c0cbd['user']['id'],_0x1e2940[_0x4c9f60]['id']],'ChatGroupId':null},'attributes':['id',_0x6c4b('0x51'),_0x6c4b('0x66'),_0x6c4b('0x67'),_0x6c4b('0x68'),_0x6c4b('0x4c')],'order':qs[_0x6c4b('0x3a')](_0x6c4b('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x6c4b('0x27')](wrapUser(_0x1e2940[_0x4c9f60])));}return BPromise[_0x6c4b('0x6a')](_0x4e5961);}return[];})[_0x6c4b('0x27')](function(_0x224c52){return{'rows':_0x224c52,'count':_0x224c52[_0x6c4b('0x36')]};})[_0x6c4b('0x27')](respondWithResult(_0x422798,null))[_0x6c4b('0x46')](handleError(_0x422798,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 838294c..b091ed5 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 _0x1c9a=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x2ebcb4,_0xae69ec){var _0x3edec0=function(_0x46ad43){while(--_0x46ad43){_0x2ebcb4['push'](_0x2ebcb4['shift']());}};_0x3edec0(++_0xae69ec);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0xbf7e33,_0x219087){_0xbf7e33=_0xbf7e33-0x0;var _0x21f488=_0x1c9a[_0xbf7e33];return _0x21f488;};'use strict';var EventEmitter=require(_0xa1c9('0x0'));var ChatInternalMessage=require(_0xa1c9('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa1c9('0x2')](0x0);var events={'afterCreate':_0xa1c9('0x3'),'afterUpdate':_0xa1c9('0x4'),'afterDestroy':_0xa1c9('0x5')};function emitEvent(_0x3d8576){return function(_0x4a0d3d,_0x2f883c,_0x5bccfd){ChatInternalMessageEvents[_0xa1c9('0x6')](_0x3d8576+':'+_0x4a0d3d['id'],_0x4a0d3d);ChatInternalMessageEvents[_0xa1c9('0x6')](_0x3d8576,_0x4a0d3d);_0x5bccfd(null);};}for(var e in events){if(events[_0xa1c9('0x7')](e)){var event=events[e];ChatInternalMessage[_0xa1c9('0x8')](e,emitEvent(event));}}module[_0xa1c9('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x8169=['emit','hasOwnProperty','hook','exports','events','ChatInternalMessage','update','remove'];(function(_0x5e32f3,_0x3386c1){var _0x4d4e03=function(_0xe86f5){while(--_0xe86f5){_0x5e32f3['push'](_0x5e32f3['shift']());}};_0x4d4e03(++_0x3386c1);}(_0x8169,0xd4));var _0x9816=function(_0x40b282,_0x856fbe){_0x40b282=_0x40b282-0x0;var _0x4ba825=_0x8169[_0x40b282];return _0x4ba825;};'use strict';var EventEmitter=require(_0x9816('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x9816('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9816('0x2'),'afterDestroy':_0x9816('0x3')};function emitEvent(_0x107e25){return function(_0x531722,_0x510359,_0x46f988){ChatInternalMessageEvents[_0x9816('0x4')](_0x107e25+':'+_0x531722['id'],_0x531722);ChatInternalMessageEvents['emit'](_0x107e25,_0x531722);_0x46f988(null);};}for(var e in events){if(events[_0x9816('0x5')](e)){var event=events[e];ChatInternalMessage[_0x9816('0x6')](e,emitEvent(event));}}module[_0x9816('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 63158dd..8343f02 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.model.js +++ b/server/api/chatInternalMessage/chatInternalMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3071('0xc'),'collate':_0x3071('0xd')});}; \ No newline at end of file +var _0xda3f=['../../config/environment','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','rimraf'];(function(_0x55e899,_0x3ccb9a){var _0x189b28=function(_0x417cc3){while(--_0x417cc3){_0x55e899['push'](_0x55e899['shift']());}};_0x189b28(++_0x3ccb9a);}(_0xda3f,0xec));var _0xfda3=function(_0x57357f,_0x4dfd2d){_0x57357f=_0x57357f-0x0;var _0x4ab4c6=_0xda3f[_0x57357f];return _0x4ab4c6;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfda3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var attributes=require('./chatInternalMessage.attributes');module[_0xfda3('0x5')]=function(_0x43a010,_0x47e7e2){return _0x43a010['define'](_0xfda3('0x6'),attributes,{'tableName':_0xfda3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfda3('0x8'),'collate':_0xfda3('0x9')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 2b194db..bf38bef 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 _0xd929=['rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xd929,0xaf));var _0x9d92=function(_0x46edf9,_0x52387f){_0x46edf9=_0x46edf9-0x0;var _0x52ca52=_0xd929[_0x46edf9];return _0x52ca52;};'use strict';var _=require(_0x9d92('0x0'));var util=require('util');var moment=require(_0x9d92('0x1'));var BPromise=require(_0x9d92('0x2'));var rs=require(_0x9d92('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d92('0x4'))['db'];var utils=require(_0x9d92('0x5'));var logger=require(_0x9d92('0x6'))(_0x9d92('0x7'));var config=require(_0x9d92('0x8'));var jayson=require(_0x9d92('0x9'));var client=jayson[_0x9d92('0xa')]['http']({'port':0x232a});config['redis']=_[_0x9d92('0xb')](config[_0x9d92('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d92('0xd'))(new Redis(config[_0x9d92('0xc')]));require(_0x9d92('0xe'))[_0x9d92('0xf')](socket);function respondWithRpcPromise(_0x5ec25f,_0x8eb713,_0x574129){return new BPromise(function(_0x534fbf,_0x7439e6){return client[_0x9d92('0x10')](_0x5ec25f,_0x574129)[_0x9d92('0x11')](function(_0x395b8d){logger[_0x9d92('0x12')](_0x9d92('0x13'),_0x8eb713,'request\x20sent');logger[_0x9d92('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x8eb713,_0x9d92('0x15'),JSON[_0x9d92('0x16')](_0x395b8d));if(_0x395b8d['error']){if(_0x395b8d[_0x9d92('0x17')][_0x9d92('0x18')]===0x1f4){logger[_0x9d92('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x8eb713,_0x395b8d[_0x9d92('0x17')][_0x9d92('0x19')]);return _0x7439e6(_0x395b8d[_0x9d92('0x17')][_0x9d92('0x19')]);}logger[_0x9d92('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x8eb713,_0x395b8d[_0x9d92('0x17')][_0x9d92('0x19')]);return _0x534fbf(_0x395b8d[_0x9d92('0x17')][_0x9d92('0x19')]);}else{logger[_0x9d92('0x12')](_0x9d92('0x13'),_0x8eb713,'request\x20sent');_0x534fbf(_0x395b8d['result'][_0x9d92('0x19')]);}})['catch'](function(_0x3122b1){logger[_0x9d92('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x8eb713,_0x3122b1);_0x7439e6(_0x3122b1);});});} \ No newline at end of file +var _0xe1d0=['result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x349b5c,_0x55e5fa){var _0x3efcac=function(_0x27832d){while(--_0x27832d){_0x349b5c['push'](_0x349b5c['shift']());}};_0x3efcac(++_0x55e5fa);}(_0xe1d0,0xb1));var _0x0e1d=function(_0x42799c,_0x86dd4a){_0x42799c=_0x42799c-0x0;var _0x55b6e8=_0xe1d0[_0x42799c];return _0x55b6e8;};'use strict';var _=require('lodash');var util=require(_0x0e1d('0x0'));var moment=require(_0x0e1d('0x1'));var BPromise=require('bluebird');var rs=require(_0x0e1d('0x2'));var fs=require('fs');var Redis=require(_0x0e1d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e1d('0x4'));var logger=require(_0x0e1d('0x5'))(_0x0e1d('0x6'));var config=require('../../config/environment');var jayson=require(_0x0e1d('0x7'));var client=jayson[_0x0e1d('0x8')][_0x0e1d('0x9')]({'port':0x232a});config[_0x0e1d('0xa')]=_[_0x0e1d('0xb')](config[_0x0e1d('0xa')],{'host':_0x0e1d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0e1d('0xa')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3679a8,_0x558d88,_0x3a45bd){return new BPromise(function(_0x1c6348,_0x37d4f9){return client[_0x0e1d('0xd')](_0x3679a8,_0x3a45bd)[_0x0e1d('0xe')](function(_0x400fb9){logger[_0x0e1d('0xf')](_0x0e1d('0x10'),_0x558d88,_0x0e1d('0x11'));logger[_0x0e1d('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x558d88,'request\x20sent',JSON[_0x0e1d('0x13')](_0x400fb9));if(_0x400fb9[_0x0e1d('0x14')]){if(_0x400fb9[_0x0e1d('0x14')][_0x0e1d('0x15')]===0x1f4){logger[_0x0e1d('0x14')](_0x0e1d('0x10'),_0x558d88,_0x400fb9[_0x0e1d('0x14')]['message']);return _0x37d4f9(_0x400fb9[_0x0e1d('0x14')][_0x0e1d('0x16')]);}logger[_0x0e1d('0x14')](_0x0e1d('0x10'),_0x558d88,_0x400fb9[_0x0e1d('0x14')][_0x0e1d('0x16')]);return _0x1c6348(_0x400fb9[_0x0e1d('0x14')]['message']);}else{logger[_0x0e1d('0xf')](_0x0e1d('0x10'),_0x558d88,_0x0e1d('0x11'));_0x1c6348(_0x400fb9[_0x0e1d('0x17')][_0x0e1d('0x16')]);}})[_0x0e1d('0x18')](function(_0x39406c){logger['error'](_0x0e1d('0x10'),_0x558d88,_0x39406c);_0x37d4f9(_0x39406c);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index dee90b3..e94a946 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 _0x6921=['register','length','chatInternalMessage:','save','update','removeListener'];(function(_0x5854d6,_0x439c2e){var _0x3b35c3=function(_0xe0516d){while(--_0xe0516d){_0x5854d6['push'](_0x5854d6['shift']());}};_0x3b35c3(++_0x439c2e);}(_0x6921,0x1d1));var _0x1692=function(_0xf66077,_0x3530fa){_0xf66077=_0xf66077-0x0;var _0x5978a2=_0x6921[_0xf66077];return _0x5978a2;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x1692('0x0'),'remove',_0x1692('0x1')];function createListener(_0x557c3c,_0x434ea2){return function(_0x13a03b){_0x434ea2['emit'](_0x557c3c,_0x13a03b);};}function removeListener(_0x3995b3,_0x577497){return function(){ChatInternalMessageEvents[_0x1692('0x2')](_0x3995b3,_0x577497);};}exports[_0x1692('0x3')]=function(_0x15f20e){for(var _0x14fbfe=0x0,_0x2825c9=events[_0x1692('0x4')];_0x14fbfe<_0x2825c9;_0x14fbfe++){var _0x2d694f=events[_0x14fbfe];var _0x3ffe29=createListener(_0x1692('0x5')+_0x2d694f,_0x15f20e);ChatInternalMessageEvents['on'](_0x2d694f,_0x3ffe29);}}; \ No newline at end of file +var _0x33a4=['removeListener','register','length','chatInternalMessage:','save','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x33a4,0x88));var _0x433a=function(_0x3f70b7,_0x16b627){_0x3f70b7=_0x3f70b7-0x0;var _0xda3e70=_0x33a4[_0x3f70b7];return _0xda3e70;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x433a('0x0'),'remove',_0x433a('0x1')];function createListener(_0x4786e1,_0x1917aa){return function(_0x4909a4){_0x1917aa['emit'](_0x4786e1,_0x4909a4);};}function removeListener(_0x4f5bc0,_0x19166b){return function(){ChatInternalMessageEvents[_0x433a('0x2')](_0x4f5bc0,_0x19166b);};}exports[_0x433a('0x3')]=function(_0x60b6b3){for(var _0x1b6f5a=0x0,_0x4fcc88=events[_0x433a('0x4')];_0x1b6f5a<_0x4fcc88;_0x1b6f5a++){var _0x58e65c=events[_0x1b6f5a];var _0x2c2404=createListener(_0x433a('0x5')+_0x58e65c,_0x60b6b3);ChatInternalMessageEvents['on'](_0x58e65c,_0x2c2404);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index c5b3627..de7e4cd 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(_0x1be69b,_0x517ce2){var _0x5b56cd=function(_0x2ee114){while(--_0x2ee114){_0x1be69b['push'](_0x1be69b['shift']());}};_0x5b56cd(++_0x517ce2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/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 _0xb7e7=['exports','multer','path','express','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','/users','getUsers','/:id','post','create','put','update','delete'];(function(_0x5a69a4,_0x3a7a34){var _0x63a69c=function(_0x17c1b2){while(--_0x17c1b2){_0x5a69a4['push'](_0x5a69a4['shift']());}};_0x63a69c(++_0x3a7a34);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xb7e7[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0xc')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0xb'),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['destroy']);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 13bcddc..4d32a2c 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 _0x72fd=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x72fd,0xc2));var _0xd72f=function(_0x252d71,_0x367b81){_0x252d71=_0x252d71-0x0;var _0x2495cf=_0x72fd[_0x252d71];return _0x2495cf;};'use strict';var Sequelize=require(_0xd72f('0x0'));module[_0xd72f('0x1')]={'body':{'type':Sequelize[_0xd72f('0x2')](_0xd72f('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xd72f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd72f('0x5')),'defaultValue':_0xd72f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd72f('0x6')]},'providerName':{'type':Sequelize[_0xd72f('0x7')]},'providerResponse':{'type':Sequelize[_0xd72f('0x2')]}}; \ No newline at end of file +var _0xa8d7=['BOOLEAN','out','DATE','STRING','TEXT'];(function(_0x2c2a03,_0x22541c){var _0x39ca4f=function(_0x398cd9){while(--_0x398cd9){_0x2c2a03['push'](_0x2c2a03['shift']());}};_0x39ca4f(++_0x22541c);}(_0xa8d7,0x19e));var _0x7a8d=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0xa8d7[_0xa2c0a3];return _0x52c618;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x7a8d('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x7a8d('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x7a8d('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7a8d('0x3')]},'providerName':{'type':Sequelize[_0x7a8d('0x4')]},'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 ba0edab..1f6150b 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 _0xcdd8=['rows','params','keys','include','merge','find','create','body','describe','../../config/logger','chat-interactions','chat','read','readAt','format','UserId','user','agent','CmContact','get','ChatInteraction','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','http','client','then','info','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','ChatMessage','includeAll','findAll'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xcdd8,0x19d));var _0x8cdd=function(_0x112c13,_0x3d073f){_0x112c13=_0x112c13-0x0;var _0x2aea28=_0xcdd8[_0x112c13];return _0x2aea28;};'use strict';var pdf=require(_0x8cdd('0x0'));var emlformat=require(_0x8cdd('0x1'));var rimraf=require(_0x8cdd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8cdd('0x3'));var moment=require(_0x8cdd('0x4'));var BPromise=require(_0x8cdd('0x5'));var Mustache=require(_0x8cdd('0x6'));var util=require(_0x8cdd('0x7'));var path=require('path');var sox=require(_0x8cdd('0x8'));var csv=require('to-csv');var ejs=require(_0x8cdd('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8cdd('0xa'));var deskjs=require(_0x8cdd('0xb'));var toCsv=require(_0x8cdd('0xc'));var querystring=require(_0x8cdd('0xd'));var Papa=require(_0x8cdd('0xe'));var Redis=require(_0x8cdd('0xf'));var authService=require(_0x8cdd('0x10'));var qs=require(_0x8cdd('0x11'));var as=require(_0x8cdd('0x12'));var hardwareService=require(_0x8cdd('0x13'));var logger=require('../../config/logger')(_0x8cdd('0x14'));var utils=require(_0x8cdd('0x15'));var config=require(_0x8cdd('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8cdd('0x17'))['db'];config['redis']=_[_0x8cdd('0x18')](config[_0x8cdd('0x19')],{'host':_0x8cdd('0x1a'),'port':0x18eb});var socket=require(_0x8cdd('0x1b'))(new Redis(config['redis']));require(_0x8cdd('0x1c'))[_0x8cdd('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8cdd('0x1e')]({'port':0x232c});var client9002=jayson[_0x8cdd('0x1f')][_0x8cdd('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x48f976,_0x4eccd7,_0x1ed13a,_0x53bbc1){return new BPromise(function(_0x52b066,_0x3b339b){var _0x1b9ceb=_0x53bbc1||client;return _0x1b9ceb['request'](_0x48f976,_0x1ed13a)[_0x8cdd('0x20')](function(_0x376207){logger[_0x8cdd('0x21')]('ChatMessage,\x20%s,\x20%s',_0x4eccd7,_0x8cdd('0x22'));logger[_0x8cdd('0x23')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4eccd7,_0x8cdd('0x22'),JSON[_0x8cdd('0x24')](_0x376207));if(_0x376207['error']){if(_0x376207[_0x8cdd('0x25')][_0x8cdd('0x26')]===0x1f4){logger[_0x8cdd('0x25')](_0x8cdd('0x27'),_0x4eccd7,_0x376207['error'][_0x8cdd('0x28')]);return _0x3b339b(_0x376207[_0x8cdd('0x25')][_0x8cdd('0x28')]);}logger[_0x8cdd('0x25')](_0x8cdd('0x27'),_0x4eccd7,_0x376207['error'][_0x8cdd('0x28')]);return _0x52b066(_0x376207['error'][_0x8cdd('0x28')]);}else{logger[_0x8cdd('0x21')](_0x8cdd('0x27'),_0x4eccd7,_0x8cdd('0x22'));_0x52b066(_0x376207[_0x8cdd('0x29')][_0x8cdd('0x28')]);}})[_0x8cdd('0x2a')](function(_0x452480){logger[_0x8cdd('0x25')](_0x8cdd('0x27'),_0x4eccd7,_0x452480);_0x3b339b(_0x452480);});});}function respondWithStatusCode(_0x38d7ae,_0x2733b8){_0x2733b8=_0x2733b8||0xcc;return function(_0x25210e){if(_0x25210e){return _0x38d7ae[_0x8cdd('0x2b')](_0x2733b8);}return _0x38d7ae[_0x8cdd('0x2c')](_0x2733b8)[_0x8cdd('0x2d')]();};}function respondWithResult(_0x50b75a,_0xd9f7fa){_0xd9f7fa=_0xd9f7fa||0xc8;return function(_0x106967){if(_0x106967){return _0x50b75a[_0x8cdd('0x2c')](_0xd9f7fa)[_0x8cdd('0x2e')](_0x106967);}};}function respondWithFilteredResult(_0x13c6fd,_0x3d9c94){return function(_0xd37016){if(_0xd37016){var _0x8d50b4=_0xd37016[_0x8cdd('0x2f')],_0x5df973=_0x3d9c94[_0x8cdd('0x30')],_0x1937b8=_0x3d9c94[_0x8cdd('0x30')]+_0x3d9c94[_0x8cdd('0x31')],_0x26cb78;if(_0x1937b8>=_0x8d50b4){_0x1937b8=_0x8d50b4;_0x26cb78=0xc8;}else{_0x26cb78=0xce;}_0x13c6fd[_0x8cdd('0x2c')](_0x26cb78);return _0x13c6fd[_0x8cdd('0x32')]('Content-Range',_0x5df973+'-'+_0x1937b8+'/'+_0x8d50b4)[_0x8cdd('0x2e')](_0xd37016);}return null;};}function patchUpdates(_0x1e583e){return function(_0x174f74){try{jsonpatch[_0x8cdd('0x33')](_0x174f74,_0x1e583e,!![]);}catch(_0x1c3498){return BPromise[_0x8cdd('0x34')](_0x1c3498);}return _0x174f74[_0x8cdd('0x35')]();};}function saveUpdates(_0x2902b8,_0x3b0c79){return function(_0x31da19){if(_0x31da19){return _0x31da19[_0x8cdd('0x36')](_0x2902b8)[_0x8cdd('0x20')](function(_0x516c6a){return _0x516c6a;});}return null;};}function removeEntity(_0x4859e0,_0x250034){return function(_0x2f884b){if(_0x2f884b){return _0x2f884b[_0x8cdd('0x37')]()[_0x8cdd('0x20')](function(){_0x4859e0['status'](0xcc)[_0x8cdd('0x2d')]();});}};}function handleEntityNotFound(_0x106055,_0xc7464f){return function(_0x2cf7b2){if(!_0x2cf7b2){_0x106055['sendStatus'](0x194);}return _0x2cf7b2;};}function handleError(_0x85a51b,_0x39873c){_0x39873c=_0x39873c||0x1f4;return function(_0x1b40f5){logger['error'](_0x1b40f5[_0x8cdd('0x38')]);if(_0x1b40f5['name']){delete _0x1b40f5[_0x8cdd('0x39')];}_0x85a51b[_0x8cdd('0x2c')](_0x39873c)[_0x8cdd('0x3a')](_0x1b40f5);};}exports[_0x8cdd('0x3b')]=function(_0x2ce658,_0x1a10b4){var _0x8a8994={},_0x1346b4={},_0x40f9fd={'count':0x0,'rows':[]};var _0x494f90=_[_0x8cdd('0x3c')](db['ChatMessage'][_0x8cdd('0x3d')],function(_0xe5bb6f){return{'name':_0xe5bb6f[_0x8cdd('0x3e')],'type':_0xe5bb6f[_0x8cdd('0x3f')]['key']};});_0x1346b4['model']=_['map'](_0x494f90,'name');_0x1346b4['query']=_['keys'](_0x2ce658[_0x8cdd('0x40')]);_0x1346b4[_0x8cdd('0x41')]=_[_0x8cdd('0x42')](_0x1346b4['model'],_0x1346b4[_0x8cdd('0x40')]);_0x8a8994['attributes']=_[_0x8cdd('0x42')](_0x1346b4['model'],qs[_0x8cdd('0x43')](_0x2ce658[_0x8cdd('0x40')][_0x8cdd('0x43')]));_0x8a8994[_0x8cdd('0x44')]=_0x8a8994['attributes'][_0x8cdd('0x45')]?_0x8a8994[_0x8cdd('0x44')]:_0x1346b4[_0x8cdd('0x46')];if(!_0x2ce658['query'][_0x8cdd('0x47')](_0x8cdd('0x48'))){_0x8a8994[_0x8cdd('0x31')]=qs[_0x8cdd('0x31')](_0x2ce658[_0x8cdd('0x40')][_0x8cdd('0x31')]);_0x8a8994[_0x8cdd('0x30')]=qs[_0x8cdd('0x30')](_0x2ce658[_0x8cdd('0x40')][_0x8cdd('0x30')]);}_0x8a8994[_0x8cdd('0x49')]=qs[_0x8cdd('0x4a')](_0x2ce658[_0x8cdd('0x40')][_0x8cdd('0x4a')]);_0x8a8994[_0x8cdd('0x4b')]=qs['filters'](_[_0x8cdd('0x4c')](_0x2ce658[_0x8cdd('0x40')],_0x1346b4[_0x8cdd('0x41')]),_0x494f90);if(_0x2ce658[_0x8cdd('0x40')]['filter']){_0x8a8994[_0x8cdd('0x4b')]=_['merge'](_0x8a8994[_0x8cdd('0x4b')],{'$or':_[_0x8cdd('0x3c')](_0x494f90,function(_0x136671){if(_0x136671[_0x8cdd('0x3f')]!==_0x8cdd('0x4d')){var _0x3b1ad7={};_0x3b1ad7[_0x136671[_0x8cdd('0x39')]]={'$like':'%'+_0x2ce658[_0x8cdd('0x40')][_0x8cdd('0x4e')]+'%'};return _0x3b1ad7;}})});}_0x8a8994=_['merge']({},_0x8a8994,_0x2ce658[_0x8cdd('0x4f')]);var _0x5ddaed={'where':_0x8a8994[_0x8cdd('0x4b')]};return db[_0x8cdd('0x50')]['count'](_0x5ddaed)[_0x8cdd('0x20')](function(_0x7314c4){_0x40f9fd[_0x8cdd('0x2f')]=_0x7314c4;if(_0x2ce658[_0x8cdd('0x40')][_0x8cdd('0x51')]){_0x8a8994['include']=[{'all':!![]}];}return db['ChatMessage'][_0x8cdd('0x52')](_0x8a8994);})['then'](function(_0x39ee4a){_0x40f9fd[_0x8cdd('0x53')]=_0x39ee4a;return _0x40f9fd;})['then'](respondWithFilteredResult(_0x1a10b4,_0x8a8994))[_0x8cdd('0x2a')](handleError(_0x1a10b4,null));};exports['show']=function(_0x33d142,_0x1f7aa1){var _0x5a2fab={'raw':!![],'where':{'id':_0x33d142[_0x8cdd('0x54')]['id']}},_0x5d3a6b={};_0x5d3a6b[_0x8cdd('0x46')]=_['keys'](db['ChatMessage'][_0x8cdd('0x3d')]);_0x5d3a6b[_0x8cdd('0x40')]=_[_0x8cdd('0x55')](_0x33d142['query']);_0x5d3a6b[_0x8cdd('0x41')]=_['intersection'](_0x5d3a6b[_0x8cdd('0x46')],_0x5d3a6b['query']);_0x5a2fab['attributes']=_[_0x8cdd('0x42')](_0x5d3a6b[_0x8cdd('0x46')],qs['fields'](_0x33d142[_0x8cdd('0x40')][_0x8cdd('0x43')]));_0x5a2fab['attributes']=_0x5a2fab[_0x8cdd('0x44')][_0x8cdd('0x45')]?_0x5a2fab[_0x8cdd('0x44')]:_0x5d3a6b[_0x8cdd('0x46')];if(_0x33d142[_0x8cdd('0x40')][_0x8cdd('0x51')]){_0x5a2fab[_0x8cdd('0x56')]=[{'all':!![]}];}_0x5a2fab=_[_0x8cdd('0x57')]({},_0x5a2fab,_0x33d142[_0x8cdd('0x4f')]);return db[_0x8cdd('0x50')][_0x8cdd('0x58')](_0x5a2fab)['then'](handleEntityNotFound(_0x1f7aa1,null))[_0x8cdd('0x20')](respondWithResult(_0x1f7aa1,null))[_0x8cdd('0x2a')](handleError(_0x1f7aa1,null));};exports[_0x8cdd('0x59')]=function(_0x304ab5,_0x15c315){return db['ChatMessage'][_0x8cdd('0x59')](_0x304ab5[_0x8cdd('0x5a')],{})[_0x8cdd('0x20')](respondWithResult(_0x15c315,0xc9))['catch'](handleError(_0x15c315,null));};exports[_0x8cdd('0x36')]=function(_0x5a3fa5,_0xda93a8){if(_0x5a3fa5[_0x8cdd('0x5a')]['id']){delete _0x5a3fa5[_0x8cdd('0x5a')]['id'];}return db[_0x8cdd('0x50')][_0x8cdd('0x58')]({'where':{'id':_0x5a3fa5['params']['id']}})[_0x8cdd('0x20')](handleEntityNotFound(_0xda93a8,null))[_0x8cdd('0x20')](saveUpdates(_0x5a3fa5[_0x8cdd('0x5a')],null))[_0x8cdd('0x20')](respondWithResult(_0xda93a8,null))['catch'](handleError(_0xda93a8,null));};exports['destroy']=function(_0x5a9207,_0x54d7aa){return db['ChatMessage']['find']({'where':{'id':_0x5a9207[_0x8cdd('0x54')]['id']}})[_0x8cdd('0x20')](handleEntityNotFound(_0x54d7aa,null))['then'](removeEntity(_0x54d7aa,null))[_0x8cdd('0x2a')](handleError(_0x54d7aa,null));};exports[_0x8cdd('0x5b')]=function(_0x55d2eb,_0x2ea3e7){return db['ChatMessage']['describe']()[_0x8cdd('0x20')](respondWithResult(_0x2ea3e7,null))[_0x8cdd('0x2a')](handleError(_0x2ea3e7,null));};var interaction_log=require(_0x8cdd('0x5c'))(_0x8cdd('0x5d'));exports['accept']=function(_0x3add54,_0x3260dc,_0x5d4c8c){var _0x9db4d={'agent':{},'channel':_0x8cdd('0x5e')};if(_0x3add54[_0x8cdd('0x5a')]['id']){delete _0x3add54[_0x8cdd('0x5a')]['id'];}_0x3add54[_0x8cdd('0x5a')][_0x8cdd('0x5f')]=!![];_0x3add54[_0x8cdd('0x5a')][_0x8cdd('0x60')]=moment()[_0x8cdd('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x3add54[_0x8cdd('0x5a')][_0x8cdd('0x62')]=_0x3add54[_0x8cdd('0x5a')][_0x8cdd('0x62')]||_0x3add54[_0x8cdd('0x63')]['id'];_0x9db4d[_0x8cdd('0x64')]['id']=_0x3add54[_0x8cdd('0x5a')]['UserId'];return db['ChatMessage'][_0x8cdd('0x58')]({'where':{'id':_0x3add54['params']['id'],'UserId':null},'include':[{'model':db[_0x8cdd('0x65')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x3260dc,null))[_0x8cdd('0x20')](saveUpdates(_0x3add54[_0x8cdd('0x5a')],null))[_0x8cdd('0x20')](function(_0x4dee5a){if(_0x4dee5a){_0x9db4d['message']=_0x4dee5a[_0x8cdd('0x66')]({'plain':!![]});return db[_0x8cdd('0x67')][_0x8cdd('0x58')]({'where':{'id':_0x4dee5a['ChatInteractionId']}});}return null;})[_0x8cdd('0x20')](handleEntityNotFound(_0x3260dc,null))[_0x8cdd('0x20')](function(_0x535cf5){if(_0x535cf5){return _0x535cf5[_0x8cdd('0x36')]({'UserId':_0x3add54[_0x8cdd('0x5a')][_0x8cdd('0x62')],'read1stAt':_[_0x8cdd('0x68')](_0x535cf5[_0x8cdd('0x69')])?moment()[_0x8cdd('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x8cdd('0x20')](function(_0x494b42){if(_0x494b42){_0x9db4d[_0x8cdd('0x6a')]=_0x494b42[_0x8cdd('0x66')]({'plain':!![]});interaction_log['info'](_0x8cdd('0x6b'),_0x3add54[_0x8cdd('0x63')]['id'],_0x3add54['user'][_0x8cdd('0x39')],_0x3add54['user']['role'],_0x9db4d[_0x8cdd('0x6a')]['id'],_0x3add54[_0x8cdd('0x5a')]?JSON[_0x8cdd('0x24')](_0x3add54[_0x8cdd('0x5a')]):_0x8cdd('0x6c'));return respondWithRpcPromise(_0x8cdd('0x6d'),_0x8cdd('0x6e'),_0x9db4d);}return null;})[_0x8cdd('0x20')](function(_0x437657){if(_0x437657){if(_0x3add54['body'][_0x8cdd('0x6f')]){_0x9db4d[_0x8cdd('0x28')][_0x8cdd('0x70')]=util[_0x8cdd('0x61')](_0x8cdd('0x71'),_0x3add54[_0x8cdd('0x63')][_0x8cdd('0x39')]);_0x9db4d[_0x8cdd('0x28')][_0x8cdd('0x72')]=_0x9db4d[_0x8cdd('0x72')];_0x9db4d[_0x8cdd('0x28')][_0x8cdd('0x73')]=_0x8cdd('0x74');return respondWithRpcPromise(_0x8cdd('0x75'),_0x8cdd('0x75'),{'event':_0x8cdd('0x76'),'message':_['merge'](_0x9db4d[_0x8cdd('0x28')],JSON['parse'](_0x9db4d[_0x8cdd('0x6a')][_0x8cdd('0x77')]))},client9002)[_0x8cdd('0x20')](function(){return _0x9db4d;});}return _0x9db4d;}return null;})[_0x8cdd('0x20')](respondWithResult(_0x3260dc,null))['catch'](handleError(_0x3260dc,null));};var interaction_log=require(_0x8cdd('0x5c'))(_0x8cdd('0x5d'));exports[_0x8cdd('0x34')]=function(_0x1de6ff,_0x3899a0,_0x28e6c0){var _0xab20b0={'agent':{},'channel':_0x8cdd('0x5e')};if(_0x1de6ff['body']['id']){delete _0x1de6ff[_0x8cdd('0x5a')]['id'];}_0x1de6ff['body']['UserId']=_0x1de6ff[_0x8cdd('0x5a')][_0x8cdd('0x62')]||_0x1de6ff[_0x8cdd('0x63')]['id'];_0xab20b0[_0x8cdd('0x64')]['id']=_0x1de6ff[_0x8cdd('0x5a')][_0x8cdd('0x62')];return db[_0x8cdd('0x50')][_0x8cdd('0x58')]({'where':{'id':_0x1de6ff[_0x8cdd('0x54')]['id'],'UserId':null}})[_0x8cdd('0x20')](handleEntityNotFound(_0x3899a0,null))[_0x8cdd('0x20')](function(_0x1f4c47){if(_0x1f4c47){_0xab20b0[_0x8cdd('0x28')]=_0x1f4c47[_0x8cdd('0x66')]({'plain':!![]});return db[_0x8cdd('0x67')][_0x8cdd('0x58')]({'where':{'id':_0x1f4c47[_0x8cdd('0x78')]}});}return null;})[_0x8cdd('0x20')](handleEntityNotFound(_0x3899a0,null))[_0x8cdd('0x20')](function(_0x4ae189){if(_0x4ae189){_0xab20b0['interaction']=_0x4ae189['get']({'plain':!![]});interaction_log['info'](_0x8cdd('0x79'),_0x1de6ff['user']['id'],_0x1de6ff[_0x8cdd('0x63')]['name'],_0x1de6ff[_0x8cdd('0x63')][_0x8cdd('0x7a')],_0xab20b0[_0x8cdd('0x6a')]['id'],_0x1de6ff[_0x8cdd('0x5a')]?JSON[_0x8cdd('0x24')](_0x1de6ff[_0x8cdd('0x5a')]):_0x8cdd('0x6c'));return respondWithRpcPromise('RejectMessage',_0x8cdd('0x7b'),_0xab20b0);}return null;})['then'](function(_0x5c399d){if(_0x5c399d){_0x5c399d[_0x8cdd('0x28')][_0x8cdd('0x70')]=util[_0x8cdd('0x61')](_0x8cdd('0x71'),_0x1de6ff[_0x8cdd('0x63')][_0x8cdd('0x39')]);_0x5c399d[_0x8cdd('0x28')]['channel']=_0xab20b0[_0x8cdd('0x72')];_0x5c399d[_0x8cdd('0x28')]['event']=_0x8cdd('0x34');respondWithRpcPromise(_0x8cdd('0x75'),_0x8cdd('0x75'),{'event':'rejectmessage','message':_0x5c399d['message']},client9002);return _0xab20b0;}return null;})['then'](respondWithResult(_0x3899a0,null))['catch'](handleError(_0x3899a0,null));}; \ No newline at end of file +var _0x0619=['../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','stack','name','index','map','ChatMessage','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','find','create','body','params','destroy','describe','../../config/logger','accept','chat','readAt','UserId','user','agent','CmContact','Contact','get','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','format','reject','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x12ca16,_0x281fd9){var _0x56fb78=function(_0x3479b2){while(--_0x3479b2){_0x12ca16['push'](_0x12ca16['shift']());}};_0x56fb78(++_0x281fd9);}(_0x0619,0xe1));var _0x9061=function(_0x5b5123,_0x5bbd05){_0x5b5123=_0x5b5123-0x0;var _0x3ea511=_0x0619[_0x5b5123];return _0x3ea511;};'use strict';var pdf=require(_0x9061('0x0'));var emlformat=require(_0x9061('0x1'));var rimraf=require(_0x9061('0x2'));var zipdir=require(_0x9061('0x3'));var jsonpatch=require(_0x9061('0x4'));var rp=require('request-promise');var moment=require(_0x9061('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9061('0x6'));var util=require(_0x9061('0x7'));var path=require(_0x9061('0x8'));var sox=require(_0x9061('0x9'));var csv=require(_0x9061('0xa'));var ejs=require(_0x9061('0xb'));var fs=require('fs');var _=require(_0x9061('0xc'));var squel=require(_0x9061('0xd'));var crypto=require(_0x9061('0xe'));var jsforce=require(_0x9061('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9061('0xa'));var querystring=require(_0x9061('0x10'));var Papa=require(_0x9061('0x11'));var Redis=require(_0x9061('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9061('0x13'));var as=require(_0x9061('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9061('0x15'));var utils=require(_0x9061('0x16'));var config=require(_0x9061('0x17'));var licenseUtil=require(_0x9061('0x18'));var db=require('../../mysqldb')['db'];config[_0x9061('0x19')]=_[_0x9061('0x1a')](config[_0x9061('0x19')],{'host':_0x9061('0x1b'),'port':0x18eb});var socket=require(_0x9061('0x1c'))(new Redis(config[_0x9061('0x19')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x9061('0x1d'));var client=jayson[_0x9061('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0x9061('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x28c492,_0x566127,_0x447bed,_0x3fbd72){return new BPromise(function(_0x17bb0d,_0x58600f){var _0x5478b9=_0x3fbd72||client;return _0x5478b9[_0x9061('0x20')](_0x28c492,_0x447bed)[_0x9061('0x21')](function(_0x1c3635){logger['info'](_0x9061('0x22'),_0x566127,_0x9061('0x23'));logger[_0x9061('0x24')](_0x9061('0x25'),_0x566127,_0x9061('0x23'),JSON[_0x9061('0x26')](_0x1c3635));if(_0x1c3635[_0x9061('0x27')]){if(_0x1c3635[_0x9061('0x27')][_0x9061('0x28')]===0x1f4){logger[_0x9061('0x27')](_0x9061('0x22'),_0x566127,_0x1c3635[_0x9061('0x27')][_0x9061('0x29')]);return _0x58600f(_0x1c3635[_0x9061('0x27')][_0x9061('0x29')]);}logger[_0x9061('0x27')](_0x9061('0x22'),_0x566127,_0x1c3635[_0x9061('0x27')][_0x9061('0x29')]);return _0x17bb0d(_0x1c3635[_0x9061('0x27')][_0x9061('0x29')]);}else{logger[_0x9061('0x2a')](_0x9061('0x22'),_0x566127,_0x9061('0x23'));_0x17bb0d(_0x1c3635[_0x9061('0x2b')][_0x9061('0x29')]);}})[_0x9061('0x2c')](function(_0x456844){logger[_0x9061('0x27')](_0x9061('0x22'),_0x566127,_0x456844);_0x58600f(_0x456844);});});}function respondWithStatusCode(_0x12aff9,_0x536cd3){_0x536cd3=_0x536cd3||0xcc;return function(_0x231045){if(_0x231045){return _0x12aff9[_0x9061('0x2d')](_0x536cd3);}return _0x12aff9[_0x9061('0x2e')](_0x536cd3)[_0x9061('0x2f')]();};}function respondWithResult(_0xf30859,_0xf69b4a){_0xf69b4a=_0xf69b4a||0xc8;return function(_0x298c29){if(_0x298c29){return _0xf30859[_0x9061('0x2e')](_0xf69b4a)[_0x9061('0x30')](_0x298c29);}};}function respondWithFilteredResult(_0x5dc37d,_0x1716e4){return function(_0xe62c81){if(_0xe62c81){var _0x14dda7=_0xe62c81[_0x9061('0x31')],_0x3994d8=_0x1716e4[_0x9061('0x32')],_0x46daf6=_0x1716e4[_0x9061('0x32')]+_0x1716e4[_0x9061('0x33')],_0x51974c;if(_0x46daf6>=_0x14dda7){_0x46daf6=_0x14dda7;_0x51974c=0xc8;}else{_0x51974c=0xce;}_0x5dc37d[_0x9061('0x2e')](_0x51974c);return _0x5dc37d[_0x9061('0x34')](_0x9061('0x35'),_0x3994d8+'-'+_0x46daf6+'/'+_0x14dda7)['json'](_0xe62c81);}return null;};}function patchUpdates(_0x42a610){return function(_0xec88f4){try{jsonpatch['apply'](_0xec88f4,_0x42a610,!![]);}catch(_0x4c9b9a){return BPromise['reject'](_0x4c9b9a);}return _0xec88f4[_0x9061('0x36')]();};}function saveUpdates(_0x3be777,_0x3bdbcf){return function(_0x41ae57){if(_0x41ae57){return _0x41ae57[_0x9061('0x37')](_0x3be777)['then'](function(_0x10a5b8){return _0x10a5b8;});}return null;};}function removeEntity(_0x3bb748,_0x442452){return function(_0x59f7a2){if(_0x59f7a2){return _0x59f7a2['destroy']()['then'](function(){_0x3bb748[_0x9061('0x2e')](0xcc)[_0x9061('0x2f')]();});}};}function handleEntityNotFound(_0x1019cc,_0x45b931){return function(_0x59b120){if(!_0x59b120){_0x1019cc[_0x9061('0x2d')](0x194);}return _0x59b120;};}function handleError(_0x34a955,_0x45f844){_0x45f844=_0x45f844||0x1f4;return function(_0x580e48){logger[_0x9061('0x27')](_0x580e48[_0x9061('0x38')]);if(_0x580e48[_0x9061('0x39')]){delete _0x580e48['name'];}_0x34a955[_0x9061('0x2e')](_0x45f844)['send'](_0x580e48);};}exports[_0x9061('0x3a')]=function(_0x40a590,_0x383414){var _0x1886c9={},_0x1d6064={},_0x1c0da8={'count':0x0,'rows':[]};var _0x16523c=_[_0x9061('0x3b')](db[_0x9061('0x3c')]['rawAttributes'],function(_0x33589c){return{'name':_0x33589c['fieldName'],'type':_0x33589c['type'][_0x9061('0x3d')]};});_0x1d6064['model']=_[_0x9061('0x3b')](_0x16523c,'name');_0x1d6064['query']=_[_0x9061('0x3e')](_0x40a590['query']);_0x1d6064[_0x9061('0x3f')]=_[_0x9061('0x40')](_0x1d6064[_0x9061('0x41')],_0x1d6064[_0x9061('0x42')]);_0x1886c9[_0x9061('0x43')]=_['intersection'](_0x1d6064[_0x9061('0x41')],qs[_0x9061('0x44')](_0x40a590[_0x9061('0x42')]['fields']));_0x1886c9[_0x9061('0x43')]=_0x1886c9[_0x9061('0x43')][_0x9061('0x45')]?_0x1886c9[_0x9061('0x43')]:_0x1d6064['model'];if(!_0x40a590[_0x9061('0x42')][_0x9061('0x46')]('nolimit')){_0x1886c9[_0x9061('0x33')]=qs[_0x9061('0x33')](_0x40a590[_0x9061('0x42')][_0x9061('0x33')]);_0x1886c9[_0x9061('0x32')]=qs[_0x9061('0x32')](_0x40a590[_0x9061('0x42')][_0x9061('0x32')]);}_0x1886c9['order']=qs['sort'](_0x40a590[_0x9061('0x42')][_0x9061('0x47')]);_0x1886c9[_0x9061('0x48')]=qs[_0x9061('0x3f')](_[_0x9061('0x49')](_0x40a590[_0x9061('0x42')],_0x1d6064['filters']),_0x16523c);if(_0x40a590[_0x9061('0x42')][_0x9061('0x4a')]){_0x1886c9['where']=_['merge'](_0x1886c9[_0x9061('0x48')],{'$or':_['map'](_0x16523c,function(_0x306211){if(_0x306211[_0x9061('0x4b')]!==_0x9061('0x4c')){var _0x2971b0={};_0x2971b0[_0x306211[_0x9061('0x39')]]={'$like':'%'+_0x40a590[_0x9061('0x42')][_0x9061('0x4a')]+'%'};return _0x2971b0;}})});}_0x1886c9=_[_0x9061('0x4d')]({},_0x1886c9,_0x40a590[_0x9061('0x4e')]);var _0xfb9a90={'where':_0x1886c9[_0x9061('0x48')]};return db[_0x9061('0x3c')][_0x9061('0x31')](_0xfb9a90)[_0x9061('0x21')](function(_0x2fe878){_0x1c0da8[_0x9061('0x31')]=_0x2fe878;if(_0x40a590['query'][_0x9061('0x4f')]){_0x1886c9[_0x9061('0x50')]=[{'all':!![]}];}return db[_0x9061('0x3c')][_0x9061('0x51')](_0x1886c9);})[_0x9061('0x21')](function(_0x16684e){_0x1c0da8[_0x9061('0x52')]=_0x16684e;return _0x1c0da8;})[_0x9061('0x21')](respondWithFilteredResult(_0x383414,_0x1886c9))['catch'](handleError(_0x383414,null));};exports['show']=function(_0x535a24,_0x15aacc){var _0x25739c={'raw':!![],'where':{'id':_0x535a24['params']['id']}},_0x23a280={};_0x23a280[_0x9061('0x41')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x23a280[_0x9061('0x42')]=_[_0x9061('0x3e')](_0x535a24[_0x9061('0x42')]);_0x23a280[_0x9061('0x3f')]=_['intersection'](_0x23a280[_0x9061('0x41')],_0x23a280[_0x9061('0x42')]);_0x25739c[_0x9061('0x43')]=_[_0x9061('0x40')](_0x23a280['model'],qs[_0x9061('0x44')](_0x535a24[_0x9061('0x42')][_0x9061('0x44')]));_0x25739c['attributes']=_0x25739c[_0x9061('0x43')][_0x9061('0x45')]?_0x25739c[_0x9061('0x43')]:_0x23a280[_0x9061('0x41')];if(_0x535a24[_0x9061('0x42')][_0x9061('0x4f')]){_0x25739c[_0x9061('0x50')]=[{'all':!![]}];}_0x25739c=_['merge']({},_0x25739c,_0x535a24[_0x9061('0x4e')]);return db[_0x9061('0x3c')][_0x9061('0x53')](_0x25739c)[_0x9061('0x21')](handleEntityNotFound(_0x15aacc,null))[_0x9061('0x21')](respondWithResult(_0x15aacc,null))[_0x9061('0x2c')](handleError(_0x15aacc,null));};exports[_0x9061('0x54')]=function(_0x4ed87b,_0x441c4f){return db[_0x9061('0x3c')]['create'](_0x4ed87b[_0x9061('0x55')],{})[_0x9061('0x21')](respondWithResult(_0x441c4f,0xc9))[_0x9061('0x2c')](handleError(_0x441c4f,null));};exports['update']=function(_0x3c1a56,_0x598dec){if(_0x3c1a56[_0x9061('0x55')]['id']){delete _0x3c1a56['body']['id'];}return db[_0x9061('0x3c')][_0x9061('0x53')]({'where':{'id':_0x3c1a56[_0x9061('0x56')]['id']}})['then'](handleEntityNotFound(_0x598dec,null))[_0x9061('0x21')](saveUpdates(_0x3c1a56['body'],null))[_0x9061('0x21')](respondWithResult(_0x598dec,null))[_0x9061('0x2c')](handleError(_0x598dec,null));};exports[_0x9061('0x57')]=function(_0x55cc50,_0x26aa82){return db[_0x9061('0x3c')]['find']({'where':{'id':_0x55cc50[_0x9061('0x56')]['id']}})[_0x9061('0x21')](handleEntityNotFound(_0x26aa82,null))['then'](removeEntity(_0x26aa82,null))['catch'](handleError(_0x26aa82,null));};exports[_0x9061('0x58')]=function(_0x3eb3ec,_0x5ba3b3){return db['ChatMessage'][_0x9061('0x58')]()[_0x9061('0x21')](respondWithResult(_0x5ba3b3,null))[_0x9061('0x2c')](handleError(_0x5ba3b3,null));};var interaction_log=require(_0x9061('0x59'))('chat-interactions');exports[_0x9061('0x5a')]=function(_0x2fd1ca,_0x1b5cd0,_0x56ee61){var _0x5d9f2d={'agent':{},'channel':_0x9061('0x5b')};if(_0x2fd1ca[_0x9061('0x55')]['id']){delete _0x2fd1ca[_0x9061('0x55')]['id'];}_0x2fd1ca[_0x9061('0x55')]['read']=!![];_0x2fd1ca[_0x9061('0x55')][_0x9061('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2fd1ca['body'][_0x9061('0x5d')]=_0x2fd1ca[_0x9061('0x55')]['UserId']||_0x2fd1ca[_0x9061('0x5e')]['id'];_0x5d9f2d[_0x9061('0x5f')]['id']=_0x2fd1ca[_0x9061('0x55')][_0x9061('0x5d')];return db[_0x9061('0x3c')][_0x9061('0x53')]({'where':{'id':_0x2fd1ca[_0x9061('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x9061('0x60')],'as':_0x9061('0x61')}]})[_0x9061('0x21')](handleEntityNotFound(_0x1b5cd0,null))['then'](saveUpdates(_0x2fd1ca[_0x9061('0x55')],null))['then'](function(_0x5ab91c){if(_0x5ab91c){_0x5d9f2d[_0x9061('0x29')]=_0x5ab91c[_0x9061('0x62')]({'plain':!![]});return db['ChatInteraction'][_0x9061('0x53')]({'where':{'id':_0x5ab91c['ChatInteractionId']}});}return null;})[_0x9061('0x21')](handleEntityNotFound(_0x1b5cd0,null))[_0x9061('0x21')](function(_0x3fa230){if(_0x3fa230){return _0x3fa230[_0x9061('0x37')]({'UserId':_0x2fd1ca[_0x9061('0x55')][_0x9061('0x5d')],'read1stAt':_[_0x9061('0x63')](_0x3fa230[_0x9061('0x64')])?moment()['format'](_0x9061('0x65')):undefined});}return null;})[_0x9061('0x21')](function(_0x42461a){if(_0x42461a){_0x5d9f2d[_0x9061('0x66')]=_0x42461a[_0x9061('0x62')]({'plain':!![]});interaction_log[_0x9061('0x2a')](_0x9061('0x67'),_0x2fd1ca[_0x9061('0x5e')]['id'],_0x2fd1ca[_0x9061('0x5e')][_0x9061('0x39')],_0x2fd1ca[_0x9061('0x5e')][_0x9061('0x68')],_0x5d9f2d[_0x9061('0x66')]['id'],_0x2fd1ca[_0x9061('0x55')]?JSON[_0x9061('0x26')](_0x2fd1ca[_0x9061('0x55')]):_0x9061('0x69'));return respondWithRpcPromise(_0x9061('0x6a'),_0x9061('0x6b'),_0x5d9f2d);}return null;})[_0x9061('0x21')](function(_0x4bcf68){if(_0x4bcf68){if(_0x2fd1ca[_0x9061('0x55')]['manual']){_0x5d9f2d[_0x9061('0x29')][_0x9061('0x6c')]=util['format'](_0x9061('0x6d'),_0x2fd1ca[_0x9061('0x5e')][_0x9061('0x39')]);_0x5d9f2d[_0x9061('0x29')][_0x9061('0x6e')]=_0x5d9f2d['channel'];_0x5d9f2d[_0x9061('0x29')][_0x9061('0x6f')]=_0x9061('0x5a');return respondWithRpcPromise(_0x9061('0x70'),_0x9061('0x70'),{'event':_0x9061('0x71'),'message':_['merge'](_0x5d9f2d[_0x9061('0x29')],JSON[_0x9061('0x72')](_0x5d9f2d[_0x9061('0x66')][_0x9061('0x73')]))},client9002)['then'](function(){return _0x5d9f2d;});}return _0x5d9f2d;}return null;})['then'](respondWithResult(_0x1b5cd0,null))[_0x9061('0x2c')](handleError(_0x1b5cd0,null));};var interaction_log=require(_0x9061('0x59'))('chat-interactions');exports['reject']=function(_0x5aa802,_0x349877,_0x7e50d0){var _0x58de75={'agent':{},'channel':_0x9061('0x5b')};if(_0x5aa802[_0x9061('0x55')]['id']){delete _0x5aa802[_0x9061('0x55')]['id'];}_0x5aa802['body']['UserId']=_0x5aa802[_0x9061('0x55')][_0x9061('0x5d')]||_0x5aa802[_0x9061('0x5e')]['id'];_0x58de75[_0x9061('0x5f')]['id']=_0x5aa802['body']['UserId'];return db[_0x9061('0x3c')][_0x9061('0x53')]({'where':{'id':_0x5aa802[_0x9061('0x56')]['id'],'UserId':null}})[_0x9061('0x21')](handleEntityNotFound(_0x349877,null))[_0x9061('0x21')](function(_0x36760b){if(_0x36760b){_0x58de75[_0x9061('0x29')]=_0x36760b['get']({'plain':!![]});return db[_0x9061('0x74')][_0x9061('0x53')]({'where':{'id':_0x36760b[_0x9061('0x75')]}});}return null;})[_0x9061('0x21')](handleEntityNotFound(_0x349877,null))['then'](function(_0x2e0072){if(_0x2e0072){_0x58de75[_0x9061('0x66')]=_0x2e0072['get']({'plain':!![]});interaction_log[_0x9061('0x2a')](_0x9061('0x76'),_0x5aa802[_0x9061('0x5e')]['id'],_0x5aa802[_0x9061('0x5e')]['name'],_0x5aa802['user'][_0x9061('0x68')],_0x58de75['interaction']['id'],_0x5aa802[_0x9061('0x55')]?JSON['stringify'](_0x5aa802[_0x9061('0x55')]):_0x9061('0x69'));return respondWithRpcPromise(_0x9061('0x77'),_0x9061('0x78'),_0x58de75);}return null;})[_0x9061('0x21')](function(_0x14b89c){if(_0x14b89c){_0x14b89c[_0x9061('0x29')][_0x9061('0x6c')]=util[_0x9061('0x79')]('SIP/%s',_0x5aa802[_0x9061('0x5e')][_0x9061('0x39')]);_0x14b89c[_0x9061('0x29')]['channel']=_0x58de75['channel'];_0x14b89c[_0x9061('0x29')][_0x9061('0x6f')]=_0x9061('0x7a');respondWithRpcPromise(_0x9061('0x70'),_0x9061('0x70'),{'event':_0x9061('0x7b'),'message':_0x14b89c[_0x9061('0x29')]},client9002);return _0x58de75;}return null;})[_0x9061('0x21')](respondWithResult(_0x349877,null))[_0x9061('0x2c')](handleError(_0x349877,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 7b77793..876e110 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 _0x9cef=['events','ChatMessage','save','update','remove','emit','hook'];(function(_0x299655,_0x1cc80e){var _0xdd4ca8=function(_0x5f3259){while(--_0x5f3259){_0x299655['push'](_0x299655['shift']());}};_0xdd4ca8(++_0x1cc80e);}(_0x9cef,0xd9));var _0xf9ce=function(_0x480a51,_0x3aecea){_0x480a51=_0x480a51-0x0;var _0x19673b=_0x9cef[_0x480a51];return _0x19673b;};'use strict';var EventEmitter=require(_0xf9ce('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xf9ce('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf9ce('0x2'),'afterUpdate':_0xf9ce('0x3'),'afterDestroy':_0xf9ce('0x4')};function emitEvent(_0x567666){return function(_0x48ad3d,_0x594322,_0x3cafc6){ChatMessageEvents['emit'](_0x567666+':'+_0x48ad3d['id'],_0x48ad3d);ChatMessageEvents[_0xf9ce('0x5')](_0x567666,_0x48ad3d);_0x3cafc6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xf9ce('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x94aa=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','save','update'];(function(_0x17eb11,_0x25d8c6){var _0x559093=function(_0x1bf619){while(--_0x1bf619){_0x17eb11['push'](_0x17eb11['shift']());}};_0x559093(++_0x25d8c6);}(_0x94aa,0x100));var _0xa94a=function(_0x2283ad,_0x2f7fdc){_0x2283ad=_0x2283ad-0x0;var _0x47d952=_0x94aa[_0x2283ad];return _0x47d952;};'use strict';var EventEmitter=require(_0xa94a('0x0'));var ChatMessage=require(_0xa94a('0x1'))['db'][_0xa94a('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa94a('0x3'),'afterUpdate':_0xa94a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c0ffc){return function(_0x21ed8f,_0x3fb215,_0x227b9b){ChatMessageEvents[_0xa94a('0x5')](_0x5c0ffc+':'+_0x21ed8f['id'],_0x21ed8f);ChatMessageEvents[_0xa94a('0x5')](_0x5c0ffc,_0x21ed8f);_0x227b9b(null);};}for(var e in events){if(events[_0xa94a('0x6')](e)){var event=events[e];ChatMessage[_0xa94a('0x7')](e,emitEvent(event));}}module[_0xa94a('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 619931a..30eabf4 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 _0x7044=['findOne','ChatInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','out','secret','isNil','UserId','ChatInteraction'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x7044,0xd0));var _0x4704=function(_0xb0ef57,_0x22011d){_0xb0ef57=_0xb0ef57-0x0;var _0x3ddf63=_0x7044[_0xb0ef57];return _0x3ddf63;};'use strict';var _=require(_0x4704('0x0'));var util=require(_0x4704('0x1'));var logger=require(_0x4704('0x2'))(_0x4704('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4704('0x4'));var fs=require('fs');var path=require(_0x4704('0x5'));var rimraf=require(_0x4704('0x6'));var config=require(_0x4704('0x7'));var attributes=require(_0x4704('0x8'));module[_0x4704('0x9')]=function(_0x357dcf,_0x4ef5a6){return _0x357dcf[_0x4704('0xa')](_0x4704('0xb'),attributes,{'tableName':_0x4704('0xc'),'paranoid':![],'indexes':[{'name':_0x4704('0xd'),'fields':[_0x4704('0xe')],'type':_0x4704('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3db52f,_0x2844b0,_0xd1fbf1){var _0x3e1f60=_0x357dcf[_0x4704('0x10')];var _0x1f6c6f=_0x3db52f['get']({'plain':!![]});if(_0x1f6c6f['direction']['toLowerCase']()==='in'||_0x1f6c6f[_0x4704('0x11')]['toLowerCase']()===_0x4704('0x12')&&!_0x1f6c6f[_0x4704('0x13')]&&!_[_0x4704('0x14')](_0x1f6c6f[_0x4704('0x15')])){_0x3e1f60[_0x4704('0x16')][_0x4704('0x17')]({'where':{'id':_0x1f6c6f[_0x4704('0x18')]}})[_0x4704('0x19')](function(_0x32bd66){if(_0x32bd66){_0x32bd66[_0x4704('0x1a')]({'lastMsgAt':_0x1f6c6f[_0x4704('0x1b')],'lastMsgDirection':_0x1f6c6f[_0x4704('0x11')][_0x4704('0x1c')]()});}})[_0x4704('0x1d')](function(_0x4c831a){console[_0x4704('0x1e')](_0x4c831a);});}_0xd1fbf1();}},'charset':_0x4704('0x1f'),'collate':_0x4704('0x20')});}; \ No newline at end of file +var _0x5408=['direction','toLowerCase','UserId','ChatInteraction','then','update','createdAt','catch','error','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','FULLTEXT'];(function(_0x1b01f6,_0x57d583){var _0x1f67af=function(_0x1838e2){while(--_0x1838e2){_0x1b01f6['push'](_0x1b01f6['shift']());}};_0x1f67af(++_0x57d583);}(_0x5408,0x111));var _0x8540=function(_0x5dfba5,_0x2caa21){_0x5dfba5=_0x5dfba5-0x0;var _0x3083a0=_0x5408[_0x5dfba5];return _0x3083a0;};'use strict';var _=require(_0x8540('0x0'));var util=require(_0x8540('0x1'));var logger=require(_0x8540('0x2'))(_0x8540('0x3'));var moment=require('moment');var BPromise=require(_0x8540('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8540('0x5'));var rimraf=require(_0x8540('0x6'));var config=require(_0x8540('0x7'));var attributes=require(_0x8540('0x8'));module[_0x8540('0x9')]=function(_0x1ed9c8,_0x581cd0){return _0x1ed9c8['define'](_0x8540('0xa'),attributes,{'tableName':_0x8540('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x8540('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35033e,_0x2f6ec4,_0x3f7a10){var _0x213780=_0x1ed9c8['models'];var _0x4780f6=_0x35033e['get']({'plain':!![]});if(_0x4780f6[_0x8540('0xd')][_0x8540('0xe')]()==='in'||_0x4780f6['direction'][_0x8540('0xe')]()==='out'&&!_0x4780f6['secret']&&!_['isNil'](_0x4780f6[_0x8540('0xf')])){_0x213780[_0x8540('0x10')]['findOne']({'where':{'id':_0x4780f6['ChatInteractionId']}})[_0x8540('0x11')](function(_0xdc2fb3){if(_0xdc2fb3){_0xdc2fb3[_0x8540('0x12')]({'lastMsgAt':_0x4780f6[_0x8540('0x13')],'lastMsgDirection':_0x4780f6['direction'][_0x8540('0xe')]()});}})[_0x8540('0x14')](function(_0x595dcb){console[_0x8540('0x15')](_0x595dcb);});}_0x3f7a10();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 3700f63..ebb2435 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 _0xe6d5=['http','localhost','socket.io-emitter','redis','register','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','CreateChatMessage','ChatMessage','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3ce0e2,_0x3ca132){var _0x36fb36=function(_0x24fd4c){while(--_0x24fd4c){_0x3ce0e2['push'](_0x3ce0e2['shift']());}};_0x36fb36(++_0x3ca132);}(_0xe6d5,0xcd));var _0x5e6d=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0xe6d5[_0x44a3b0];return _0x39e6f6;};'use strict';var _=require(_0x5e6d('0x0'));var util=require(_0x5e6d('0x1'));var moment=require(_0x5e6d('0x2'));var BPromise=require(_0x5e6d('0x3'));var rs=require(_0x5e6d('0x4'));var fs=require('fs');var Redis=require(_0x5e6d('0x5'));var db=require(_0x5e6d('0x6'))['db'];var utils=require(_0x5e6d('0x7'));var logger=require(_0x5e6d('0x8'))('rpc');var config=require(_0x5e6d('0x9'));var jayson=require(_0x5e6d('0xa'));var client=jayson[_0x5e6d('0xb')][_0x5e6d('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x5e6d('0xd'),'port':0x18eb});var socket=require(_0x5e6d('0xe'))(new Redis(config[_0x5e6d('0xf')]));require('./chatMessage.socket')[_0x5e6d('0x10')](socket);function respondWithRpcPromise(_0x51e6ea,_0x28dc52,_0x2b7bcb){return new BPromise(function(_0x427dfb,_0x1e77c7){return client[_0x5e6d('0x11')](_0x51e6ea,_0x2b7bcb)[_0x5e6d('0x12')](function(_0x53dc51){logger[_0x5e6d('0x13')]('ChatMessage,\x20%s,\x20%s',_0x28dc52,_0x5e6d('0x14'));logger[_0x5e6d('0x15')](_0x5e6d('0x16'),_0x28dc52,_0x5e6d('0x14'),JSON[_0x5e6d('0x17')](_0x53dc51));if(_0x53dc51[_0x5e6d('0x18')]){if(_0x53dc51[_0x5e6d('0x18')]['code']===0x1f4){logger['error'](_0x5e6d('0x19'),_0x28dc52,_0x53dc51['error'][_0x5e6d('0x1a')]);return _0x1e77c7(_0x53dc51[_0x5e6d('0x18')][_0x5e6d('0x1a')]);}logger[_0x5e6d('0x18')](_0x5e6d('0x19'),_0x28dc52,_0x53dc51[_0x5e6d('0x18')]['message']);return _0x427dfb(_0x53dc51['error'][_0x5e6d('0x1a')]);}else{logger[_0x5e6d('0x13')](_0x5e6d('0x19'),_0x28dc52,'request\x20sent');_0x427dfb(_0x53dc51['result']['message']);}})['catch'](function(_0x20e0fd){logger[_0x5e6d('0x18')](_0x5e6d('0x19'),_0x28dc52,_0x20e0fd);_0x1e77c7(_0x20e0fd);});});}exports[_0x5e6d('0x1b')]=function(_0x572490){var _0x4064c1=this;return new Promise(function(_0x5f2027,_0xb53512){return db[_0x5e6d('0x1c')]['create'](_0x572490['body'],{'raw':_0x572490[_0x5e6d('0x1d')]?_0x572490['options'][_0x5e6d('0x1e')]===undefined?!![]:![]:!![]})[_0x5e6d('0x12')](function(_0x56421c){logger[_0x5e6d('0x13')]('CreateChatMessage',_0x572490);logger[_0x5e6d('0x15')](_0x5e6d('0x1b'),_0x572490,JSON[_0x5e6d('0x17')](_0x56421c));_0x5f2027(_0x56421c);})['catch'](function(_0x4ea4a9){logger[_0x5e6d('0x18')](_0x5e6d('0x1b'),_0x4ea4a9[_0x5e6d('0x1a')],_0x572490);_0xb53512(_0x4064c1[_0x5e6d('0x18')](0x1f4,_0x4ea4a9['message']));});});}; \ No newline at end of file +var _0xdb30=['then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','create','body','options','raw','CreateChatMessage','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request'];(function(_0x30424e,_0x50743d){var _0x2ef27d=function(_0x32b2cb){while(--_0x32b2cb){_0x30424e['push'](_0x30424e['shift']());}};_0x2ef27d(++_0x50743d);}(_0xdb30,0xa5));var _0x0db3=function(_0x4e731a,_0x268b0a){_0x4e731a=_0x4e731a-0x0;var _0xac9961=_0xdb30[_0x4e731a];return _0xac9961;};'use strict';var _=require(_0x0db3('0x0'));var util=require('util');var moment=require(_0x0db3('0x1'));var BPromise=require(_0x0db3('0x2'));var rs=require(_0x0db3('0x3'));var fs=require('fs');var Redis=require(_0x0db3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0db3('0x5'))(_0x0db3('0x6'));var config=require('../../config/environment');var jayson=require(_0x0db3('0x7'));var client=jayson[_0x0db3('0x8')][_0x0db3('0x9')]({'port':0x232a});config[_0x0db3('0xa')]=_[_0x0db3('0xb')](config[_0x0db3('0xa')],{'host':_0x0db3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0db3('0xa')]));require('./chatMessage.socket')[_0x0db3('0xd')](socket);function respondWithRpcPromise(_0x496a44,_0x5d0eca,_0x363028){return new BPromise(function(_0x2a715a,_0x845cab){return client[_0x0db3('0xe')](_0x496a44,_0x363028)[_0x0db3('0xf')](function(_0x12f374){logger[_0x0db3('0x10')](_0x0db3('0x11'),_0x5d0eca,'request\x20sent');logger[_0x0db3('0x12')](_0x0db3('0x13'),_0x5d0eca,_0x0db3('0x14'),JSON[_0x0db3('0x15')](_0x12f374));if(_0x12f374[_0x0db3('0x16')]){if(_0x12f374[_0x0db3('0x16')]['code']===0x1f4){logger['error'](_0x0db3('0x11'),_0x5d0eca,_0x12f374[_0x0db3('0x16')][_0x0db3('0x17')]);return _0x845cab(_0x12f374[_0x0db3('0x16')][_0x0db3('0x17')]);}logger[_0x0db3('0x16')](_0x0db3('0x11'),_0x5d0eca,_0x12f374[_0x0db3('0x16')][_0x0db3('0x17')]);return _0x2a715a(_0x12f374[_0x0db3('0x16')][_0x0db3('0x17')]);}else{logger['info'](_0x0db3('0x11'),_0x5d0eca,_0x0db3('0x14'));_0x2a715a(_0x12f374[_0x0db3('0x18')][_0x0db3('0x17')]);}})['catch'](function(_0x598bdb){logger[_0x0db3('0x16')](_0x0db3('0x11'),_0x5d0eca,_0x598bdb);_0x845cab(_0x598bdb);});});}exports['CreateChatMessage']=function(_0x44d9f7){var _0x19dc27=this;return new Promise(function(_0x595fc6,_0xa9c3c6){return db['ChatMessage'][_0x0db3('0x19')](_0x44d9f7[_0x0db3('0x1a')],{'raw':_0x44d9f7[_0x0db3('0x1b')]?_0x44d9f7['options'][_0x0db3('0x1c')]===undefined?!![]:![]:!![]})[_0x0db3('0xf')](function(_0x14d69f){logger[_0x0db3('0x10')]('CreateChatMessage',_0x44d9f7);logger[_0x0db3('0x12')](_0x0db3('0x1d'),_0x44d9f7,JSON[_0x0db3('0x15')](_0x14d69f));_0x595fc6(_0x14d69f);})['catch'](function(_0x3e0e41){logger['error']('CreateChatMessage',_0x3e0e41[_0x0db3('0x17')],_0x44d9f7);_0xa9c3c6(_0x19dc27['error'](0x1f4,_0x3e0e41[_0x0db3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index bc6a307..f3c5540 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 _0xfdbd=['removeListener','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x42a8b1,_0x4fef9c){var _0x2d7dcd=function(_0x220513){while(--_0x220513){_0x42a8b1['push'](_0x42a8b1['shift']());}};_0x2d7dcd(++_0x4fef9c);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0xfdbd[_0xbe40ad];return _0x50fac9;};'use strict';var ChatMessageEvents=require(_0xdfdb('0x0'));var events=[_0xdfdb('0x1'),_0xdfdb('0x2'),_0xdfdb('0x3')];function createListener(_0x28f05d,_0x3078f0){return function(_0x11218a){_0x3078f0[_0xdfdb('0x4')](_0x28f05d,_0x11218a);};}function removeListener(_0x330ad3,_0x5945e0){return function(){ChatMessageEvents[_0xdfdb('0x5')](_0x330ad3,_0x5945e0);};}exports['register']=function(_0x453ef6){for(var _0x41bd5e=0x0,_0x489f19=events['length'];_0x41bd5e<_0x489f19;_0x41bd5e++){var _0x590b5d=events[_0x41bd5e];var _0x188508=createListener(_0xdfdb('0x6')+_0x590b5d,_0x453ef6);ChatMessageEvents['on'](_0x590b5d,_0x188508);}}; \ No newline at end of file +var _0x7880=['register','length','save','remove','update','removeListener'];(function(_0xd0d8fa,_0x4f38c6){var _0x46a888=function(_0x38504c){while(--_0x38504c){_0xd0d8fa['push'](_0xd0d8fa['shift']());}};_0x46a888(++_0x4f38c6);}(_0x7880,0x1f4));var _0x0788=function(_0x4102a1,_0x2baefd){_0x4102a1=_0x4102a1-0x0;var _0x443434=_0x7880[_0x4102a1];return _0x443434;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x0788('0x0'),_0x0788('0x1'),_0x0788('0x2')];function createListener(_0x1b196a,_0x47dc20){return function(_0x446ded){_0x47dc20['emit'](_0x1b196a,_0x446ded);};}function removeListener(_0x3925a6,_0x1e0814){return function(){ChatMessageEvents[_0x0788('0x3')](_0x3925a6,_0x1e0814);};}exports[_0x0788('0x4')]=function(_0x262f5c){for(var _0x775629=0x0,_0x3f9cb8=events[_0x0788('0x5')];_0x775629<_0x3f9cb8;_0x775629++){var _0x3c29f3=events[_0x775629];var _0x422f8b=createListener('chatMessage:'+_0x3c29f3,_0x262f5c);ChatMessageEvents['on'](_0x3c29f3,_0x422f8b);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index e13e801..80a6e79 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 _0x9e58=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','update','put','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x50b0d3,_0x289142){var _0x41118f=function(_0x431b98){while(--_0x431b98){_0x50b0d3['push'](_0x50b0d3['shift']());}};_0x41118f(++_0x289142);}(_0x9e58,0xfc));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x89e5('0x0'));var path=require(_0x89e5('0x1'));var timeout=require(_0x89e5('0x2'));var express=require(_0x89e5('0x3'));var router=express['Router']();var auth=require(_0x89e5('0x4'));var interaction=require(_0x89e5('0x5'));var config=require(_0x89e5('0x6'));var controller=require(_0x89e5('0x7'));router[_0x89e5('0x8')]('/',auth[_0x89e5('0x9')](),controller[_0x89e5('0xa')]);router[_0x89e5('0x8')](_0x89e5('0xb'),auth[_0x89e5('0x9')](),controller[_0x89e5('0xc')]);router[_0x89e5('0x8')](_0x89e5('0xd'),auth[_0x89e5('0x9')](),controller[_0x89e5('0xe')]);router[_0x89e5('0xf')]('/',auth['isAuthenticated'](),interaction[_0x89e5('0x10')](_0x89e5('0x11'),_0x89e5('0x12')),controller[_0x89e5('0x13')]);router['put'](_0x89e5('0xd'),controller[_0x89e5('0x14')]);router[_0x89e5('0x15')]('/:id/accept',auth[_0x89e5('0x9')](),controller[_0x89e5('0x16')]);router[_0x89e5('0x15')](_0x89e5('0x17'),auth['isAuthenticated'](),controller[_0x89e5('0x18')]);router[_0x89e5('0x19')]('/:id',auth[_0x89e5('0x9')](),controller[_0x89e5('0x1a')]);module[_0x89e5('0x1b')]=router; \ No newline at end of file +var _0x0c84=['accept','put','reject','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','show','post','tracked','chat','/:id','update','/:id/accept'];(function(_0x2b3ba1,_0x1eba89){var _0x281a27=function(_0xbd6376){while(--_0xbd6376){_0x2b3ba1['push'](_0x2b3ba1['shift']());}};_0x281a27(++_0x1eba89);}(_0x0c84,0x68));var _0x40c8=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x0c84[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x40c8('0x0'));var util=require(_0x40c8('0x1'));var path=require(_0x40c8('0x2'));var timeout=require(_0x40c8('0x3'));var express=require(_0x40c8('0x4'));var router=express[_0x40c8('0x5')]();var auth=require(_0x40c8('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0x40c8('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x40c8('0x8')](),controller['describe']);router[_0x40c8('0x7')]('/:id',auth[_0x40c8('0x8')](),controller[_0x40c8('0x9')]);router[_0x40c8('0xa')]('/',auth[_0x40c8('0x8')](),interaction[_0x40c8('0xb')](_0x40c8('0xc'),'chatmessage:create'),controller['create']);router['put'](_0x40c8('0xd'),controller[_0x40c8('0xe')]);router['put'](_0x40c8('0xf'),auth['isAuthenticated'](),controller[_0x40c8('0x10')]);router[_0x40c8('0x11')]('/:id/reject',auth[_0x40c8('0x8')](),controller[_0x40c8('0x12')]);router['delete'](_0x40c8('0xd'),auth[_0x40c8('0x8')](),controller[_0x40c8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 78724cc..15e0515 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 _0xe9c1=['TEXT','medium'];(function(_0x5b0135,_0x50ce54){var _0x372c9d=function(_0x106963){while(--_0x106963){_0x5b0135['push'](_0x5b0135['shift']());}};_0x372c9d(++_0x50ce54);}(_0xe9c1,0x1e0));var _0x1e9c=function(_0x1eec33,_0x529d1d){_0x1eec33=_0x1eec33-0x0;var _0x50c904=_0xe9c1[_0x1eec33];return _0x50c904;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x1e9c('0x0')](_0x1e9c('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xdbe0=['medium','sequelize','exports'];(function(_0x43126d,_0x2139d4){var _0x15b8d0=function(_0x38d459){while(--_0x38d459){_0x43126d['push'](_0x43126d['shift']());}};_0x15b8d0(++_0x2139d4);}(_0xdbe0,0x1f0));var _0x0dbe=function(_0x92d240,_0x34cef7){_0x92d240=_0x92d240-0x0;var _0x54a104=_0xdbe0[_0x92d240];return _0x54a104;};'use strict';var Sequelize=require(_0x0dbe('0x0'));module[_0x0dbe('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0dbe('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index b78b372..8358dfc 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 _0x7aa0=['catch','show','params','find','create','body','update','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','set','apply','save','then','end','sendStatus','error','name','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','rows'];(function(_0x5b0ebc,_0x9bb654){var _0x3a27ba=function(_0x4aa556){while(--_0x4aa556){_0x5b0ebc['push'](_0x5b0ebc['shift']());}};_0x3a27ba(++_0x9bb654);}(_0x7aa0,0xa1));var _0x07aa=function(_0xd33602,_0x19a74d){_0xd33602=_0xd33602-0x0;var _0x4f6f3b=_0x7aa0[_0xd33602];return _0x4f6f3b;};'use strict';var pdf=require(_0x07aa('0x0'));var emlformat=require(_0x07aa('0x1'));var rimraf=require(_0x07aa('0x2'));var zipdir=require(_0x07aa('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x07aa('0x4'));var BPromise=require(_0x07aa('0x5'));var Mustache=require(_0x07aa('0x6'));var util=require(_0x07aa('0x7'));var path=require(_0x07aa('0x8'));var sox=require(_0x07aa('0x9'));var csv=require('to-csv');var ejs=require(_0x07aa('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x07aa('0xb'));var crypto=require('crypto');var jsforce=require(_0x07aa('0xc'));var deskjs=require(_0x07aa('0xd'));var toCsv=require(_0x07aa('0xe'));var querystring=require(_0x07aa('0xf'));var Papa=require(_0x07aa('0x10'));var Redis=require(_0x07aa('0x11'));var authService=require(_0x07aa('0x12'));var qs=require(_0x07aa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x07aa('0x14'));var logger=require('../../config/logger')(_0x07aa('0x15'));var utils=require(_0x07aa('0x16'));var config=require(_0x07aa('0x17'));var licenseUtil=require(_0x07aa('0x18'));var db=require(_0x07aa('0x19'))['db'];function respondWithStatusCode(_0x56e8d6,_0x3fb3ad){_0x3fb3ad=_0x3fb3ad||0xcc;return function(_0x82b55a){if(_0x82b55a){return _0x56e8d6['sendStatus'](_0x3fb3ad);}return _0x56e8d6[_0x07aa('0x1a')](_0x3fb3ad)['end']();};}function respondWithResult(_0x32df91,_0x54d592){_0x54d592=_0x54d592||0xc8;return function(_0x1d358c){if(_0x1d358c){return _0x32df91[_0x07aa('0x1a')](_0x54d592)[_0x07aa('0x1b')](_0x1d358c);}};}function respondWithFilteredResult(_0x4b96b3,_0x59028c){return function(_0x2d1b51){if(_0x2d1b51){var _0x986040=_0x2d1b51['count'],_0x41c0ca=_0x59028c[_0x07aa('0x1c')],_0xe6ff5f=_0x59028c[_0x07aa('0x1c')]+_0x59028c['limit'],_0x1bf857;if(_0xe6ff5f>=_0x986040){_0xe6ff5f=_0x986040;_0x1bf857=0xc8;}else{_0x1bf857=0xce;}_0x4b96b3[_0x07aa('0x1a')](_0x1bf857);return _0x4b96b3[_0x07aa('0x1d')]('Content-Range',_0x41c0ca+'-'+_0xe6ff5f+'/'+_0x986040)[_0x07aa('0x1b')](_0x2d1b51);}return null;};}function patchUpdates(_0x1177ce){return function(_0x33fd2b){try{jsonpatch[_0x07aa('0x1e')](_0x33fd2b,_0x1177ce,!![]);}catch(_0xd18462){return BPromise['reject'](_0xd18462);}return _0x33fd2b[_0x07aa('0x1f')]();};}function saveUpdates(_0x517ea1,_0x32e63b){return function(_0x345b38){if(_0x345b38){return _0x345b38['update'](_0x517ea1)['then'](function(_0x3b0b8e){return _0x3b0b8e;});}return null;};}function removeEntity(_0x29e4f0,_0x39087d){return function(_0xd94526){if(_0xd94526){return _0xd94526['destroy']()[_0x07aa('0x20')](function(){_0x29e4f0[_0x07aa('0x1a')](0xcc)[_0x07aa('0x21')]();});}};}function handleEntityNotFound(_0x3f9451,_0x15ee2f){return function(_0x1c7d75){if(!_0x1c7d75){_0x3f9451[_0x07aa('0x22')](0x194);}return _0x1c7d75;};}function handleError(_0x4fa901,_0x172c52){_0x172c52=_0x172c52||0x1f4;return function(_0x11cdd9){logger[_0x07aa('0x23')](_0x11cdd9['stack']);if(_0x11cdd9[_0x07aa('0x24')]){delete _0x11cdd9[_0x07aa('0x24')];}_0x4fa901[_0x07aa('0x1a')](_0x172c52)['send'](_0x11cdd9);};}exports[_0x07aa('0x25')]=function(_0x4aacbd,_0x352cca){var _0x4aca7f={},_0x327a2a={},_0xefe3d6={'count':0x0,'rows':[]};var _0x232102=_[_0x07aa('0x26')](db[_0x07aa('0x27')][_0x07aa('0x28')],function(_0x20155c){return{'name':_0x20155c[_0x07aa('0x29')],'type':_0x20155c[_0x07aa('0x2a')][_0x07aa('0x2b')]};});_0x327a2a[_0x07aa('0x2c')]=_[_0x07aa('0x26')](_0x232102,_0x07aa('0x24'));_0x327a2a[_0x07aa('0x2d')]=_[_0x07aa('0x2e')](_0x4aacbd['query']);_0x327a2a[_0x07aa('0x2f')]=_[_0x07aa('0x30')](_0x327a2a[_0x07aa('0x2c')],_0x327a2a[_0x07aa('0x2d')]);_0x4aca7f[_0x07aa('0x31')]=_[_0x07aa('0x30')](_0x327a2a[_0x07aa('0x2c')],qs[_0x07aa('0x32')](_0x4aacbd[_0x07aa('0x2d')]['fields']));_0x4aca7f[_0x07aa('0x31')]=_0x4aca7f[_0x07aa('0x31')][_0x07aa('0x33')]?_0x4aca7f[_0x07aa('0x31')]:_0x327a2a['model'];if(!_0x4aacbd[_0x07aa('0x2d')][_0x07aa('0x34')](_0x07aa('0x35'))){_0x4aca7f[_0x07aa('0x36')]=qs[_0x07aa('0x36')](_0x4aacbd['query'][_0x07aa('0x36')]);_0x4aca7f['offset']=qs[_0x07aa('0x1c')](_0x4aacbd[_0x07aa('0x2d')][_0x07aa('0x1c')]);}_0x4aca7f[_0x07aa('0x37')]=qs[_0x07aa('0x38')](_0x4aacbd[_0x07aa('0x2d')][_0x07aa('0x38')]);_0x4aca7f['where']=qs[_0x07aa('0x2f')](_[_0x07aa('0x39')](_0x4aacbd[_0x07aa('0x2d')],_0x327a2a[_0x07aa('0x2f')]),_0x232102);if(_0x4aacbd[_0x07aa('0x2d')][_0x07aa('0x3a')]){_0x4aca7f[_0x07aa('0x3b')]=_['merge'](_0x4aca7f[_0x07aa('0x3b')],{'$or':_[_0x07aa('0x26')](_0x232102,function(_0x5a3545){if(_0x5a3545[_0x07aa('0x2a')]!==_0x07aa('0x3c')){var _0x94b7c8={};_0x94b7c8[_0x5a3545['name']]={'$like':'%'+_0x4aacbd['query'][_0x07aa('0x3a')]+'%'};return _0x94b7c8;}})});}_0x4aca7f=_[_0x07aa('0x3d')]({},_0x4aca7f,_0x4aacbd[_0x07aa('0x3e')]);var _0x524393={'where':_0x4aca7f['where']};return db[_0x07aa('0x27')][_0x07aa('0x3f')](_0x524393)[_0x07aa('0x20')](function(_0x4ae535){_0xefe3d6[_0x07aa('0x3f')]=_0x4ae535;if(_0x4aacbd['query'][_0x07aa('0x40')]){_0x4aca7f[_0x07aa('0x41')]=[{'all':!![]}];}return db[_0x07aa('0x27')]['findAll'](_0x4aca7f);})['then'](function(_0x446566){_0xefe3d6[_0x07aa('0x42')]=_0x446566;return _0xefe3d6;})['then'](respondWithFilteredResult(_0x352cca,_0x4aca7f))[_0x07aa('0x43')](handleError(_0x352cca,null));};exports[_0x07aa('0x44')]=function(_0x4b8dcc,_0x178c98){var _0x5b9c1e={'raw':!![],'where':{'id':_0x4b8dcc[_0x07aa('0x45')]['id']}},_0x3d3838={};_0x3d3838['model']=_[_0x07aa('0x2e')](db[_0x07aa('0x27')][_0x07aa('0x28')]);_0x3d3838[_0x07aa('0x2d')]=_[_0x07aa('0x2e')](_0x4b8dcc['query']);_0x3d3838['filters']=_[_0x07aa('0x30')](_0x3d3838[_0x07aa('0x2c')],_0x3d3838[_0x07aa('0x2d')]);_0x5b9c1e['attributes']=_['intersection'](_0x3d3838['model'],qs[_0x07aa('0x32')](_0x4b8dcc[_0x07aa('0x2d')][_0x07aa('0x32')]));_0x5b9c1e[_0x07aa('0x31')]=_0x5b9c1e[_0x07aa('0x31')][_0x07aa('0x33')]?_0x5b9c1e[_0x07aa('0x31')]:_0x3d3838['model'];if(_0x4b8dcc['query'][_0x07aa('0x40')]){_0x5b9c1e[_0x07aa('0x41')]=[{'all':!![]}];}_0x5b9c1e=_['merge']({},_0x5b9c1e,_0x4b8dcc[_0x07aa('0x3e')]);return db[_0x07aa('0x27')][_0x07aa('0x46')](_0x5b9c1e)['then'](handleEntityNotFound(_0x178c98,null))[_0x07aa('0x20')](respondWithResult(_0x178c98,null))[_0x07aa('0x43')](handleError(_0x178c98,null));};exports['create']=function(_0xbc3db,_0x41ab4f){return db[_0x07aa('0x27')][_0x07aa('0x47')](_0xbc3db[_0x07aa('0x48')],{})[_0x07aa('0x20')](respondWithResult(_0x41ab4f,0xc9))[_0x07aa('0x43')](handleError(_0x41ab4f,null));};exports[_0x07aa('0x49')]=function(_0x46484c,_0x4db992){if(_0x46484c[_0x07aa('0x48')]['id']){delete _0x46484c['body']['id'];}return db[_0x07aa('0x27')][_0x07aa('0x46')]({'where':{'id':_0x46484c[_0x07aa('0x45')]['id']}})[_0x07aa('0x20')](handleEntityNotFound(_0x4db992,null))['then'](saveUpdates(_0x46484c[_0x07aa('0x48')],null))[_0x07aa('0x20')](respondWithResult(_0x4db992,null))[_0x07aa('0x43')](handleError(_0x4db992,null));};exports[_0x07aa('0x4a')]=function(_0x48fe2b,_0x1468f7){return db[_0x07aa('0x27')][_0x07aa('0x46')]({'where':{'id':_0x48fe2b[_0x07aa('0x45')]['id']}})[_0x07aa('0x20')](handleEntityNotFound(_0x1468f7,null))[_0x07aa('0x20')](removeEntity(_0x1468f7,null))['catch'](handleError(_0x1468f7,null));};exports[_0x07aa('0x4b')]=function(_0x54b4fd,_0x1368fd){return db[_0x07aa('0x27')][_0x07aa('0x4b')]()[_0x07aa('0x20')](respondWithResult(_0x1368fd,null))[_0x07aa('0x43')](handleError(_0x1368fd,null));}; \ No newline at end of file +var _0xfd07=['../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','ChatOfflineMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','filter','includeAll','rows','show','params','include','find','catch','create','body','describe','html-pdf','eml-format','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x172717,_0x3e0b0b){var _0x21e411=function(_0x358b3a){while(--_0x358b3a){_0x172717['push'](_0x172717['shift']());}};_0x21e411(++_0x3e0b0b);}(_0xfd07,0x104));var _0x7fd0=function(_0xc5e02a,_0xd9da3c){_0xc5e02a=_0xc5e02a-0x0;var _0xbeca77=_0xfd07[_0xc5e02a];return _0xbeca77;};'use strict';var pdf=require(_0x7fd0('0x0'));var emlformat=require(_0x7fd0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7fd0('0x2'));var BPromise=require(_0x7fd0('0x3'));var Mustache=require(_0x7fd0('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7fd0('0x5'));var csv=require(_0x7fd0('0x6'));var ejs=require(_0x7fd0('0x7'));var fs=require('fs');var _=require(_0x7fd0('0x8'));var squel=require('squel');var crypto=require(_0x7fd0('0x9'));var jsforce=require(_0x7fd0('0xa'));var deskjs=require(_0x7fd0('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7fd0('0xc'));var Redis=require('ioredis');var authService=require(_0x7fd0('0xd'));var qs=require(_0x7fd0('0xe'));var as=require(_0x7fd0('0xf'));var hardwareService=require(_0x7fd0('0x10'));var logger=require(_0x7fd0('0x11'))(_0x7fd0('0x12'));var utils=require(_0x7fd0('0x13'));var config=require(_0x7fd0('0x14'));var licenseUtil=require(_0x7fd0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5922ac,_0x339bc7){_0x339bc7=_0x339bc7||0xcc;return function(_0x465326){if(_0x465326){return _0x5922ac[_0x7fd0('0x16')](_0x339bc7);}return _0x5922ac[_0x7fd0('0x17')](_0x339bc7)[_0x7fd0('0x18')]();};}function respondWithResult(_0x463526,_0x3e6519){_0x3e6519=_0x3e6519||0xc8;return function(_0x52c40d){if(_0x52c40d){return _0x463526[_0x7fd0('0x17')](_0x3e6519)[_0x7fd0('0x19')](_0x52c40d);}};}function respondWithFilteredResult(_0x3bf1be,_0x3289f1){return function(_0x2ab283){if(_0x2ab283){var _0x11115=_0x2ab283[_0x7fd0('0x1a')],_0x213f54=_0x3289f1[_0x7fd0('0x1b')],_0x1adf5d=_0x3289f1['offset']+_0x3289f1[_0x7fd0('0x1c')],_0x5ca99d;if(_0x1adf5d>=_0x11115){_0x1adf5d=_0x11115;_0x5ca99d=0xc8;}else{_0x5ca99d=0xce;}_0x3bf1be[_0x7fd0('0x17')](_0x5ca99d);return _0x3bf1be[_0x7fd0('0x1d')](_0x7fd0('0x1e'),_0x213f54+'-'+_0x1adf5d+'/'+_0x11115)[_0x7fd0('0x19')](_0x2ab283);}return null;};}function patchUpdates(_0x29a7c1){return function(_0x458622){try{jsonpatch[_0x7fd0('0x1f')](_0x458622,_0x29a7c1,!![]);}catch(_0x4386d2){return BPromise['reject'](_0x4386d2);}return _0x458622[_0x7fd0('0x20')]();};}function saveUpdates(_0x1ec783,_0x1b3dfe){return function(_0x4a59d0){if(_0x4a59d0){return _0x4a59d0[_0x7fd0('0x21')](_0x1ec783)[_0x7fd0('0x22')](function(_0x5a7caf){return _0x5a7caf;});}return null;};}function removeEntity(_0x19b2e3,_0xdd4a81){return function(_0x2083ce){if(_0x2083ce){return _0x2083ce[_0x7fd0('0x23')]()[_0x7fd0('0x22')](function(){_0x19b2e3[_0x7fd0('0x17')](0xcc)[_0x7fd0('0x18')]();});}};}function handleEntityNotFound(_0x1e1378,_0x39a23a){return function(_0xb9dff6){if(!_0xb9dff6){_0x1e1378['sendStatus'](0x194);}return _0xb9dff6;};}function handleError(_0x2bd958,_0x383d91){_0x383d91=_0x383d91||0x1f4;return function(_0x525bd0){logger[_0x7fd0('0x24')](_0x525bd0[_0x7fd0('0x25')]);if(_0x525bd0['name']){delete _0x525bd0[_0x7fd0('0x26')];}_0x2bd958[_0x7fd0('0x17')](_0x383d91)['send'](_0x525bd0);};}exports[_0x7fd0('0x27')]=function(_0x29a654,_0x187102){var _0x21297d={},_0x80b765={},_0x2d82ad={'count':0x0,'rows':[]};var _0x2cf3bc=_['map'](db[_0x7fd0('0x28')][_0x7fd0('0x29')],function(_0x326688){return{'name':_0x326688[_0x7fd0('0x2a')],'type':_0x326688[_0x7fd0('0x2b')][_0x7fd0('0x2c')]};});_0x80b765['model']=_[_0x7fd0('0x2d')](_0x2cf3bc,'name');_0x80b765[_0x7fd0('0x2e')]=_[_0x7fd0('0x2f')](_0x29a654[_0x7fd0('0x2e')]);_0x80b765[_0x7fd0('0x30')]=_['intersection'](_0x80b765[_0x7fd0('0x31')],_0x80b765[_0x7fd0('0x2e')]);_0x21297d[_0x7fd0('0x32')]=_[_0x7fd0('0x33')](_0x80b765[_0x7fd0('0x31')],qs['fields'](_0x29a654[_0x7fd0('0x2e')][_0x7fd0('0x34')]));_0x21297d[_0x7fd0('0x32')]=_0x21297d[_0x7fd0('0x32')][_0x7fd0('0x35')]?_0x21297d[_0x7fd0('0x32')]:_0x80b765[_0x7fd0('0x31')];if(!_0x29a654[_0x7fd0('0x2e')]['hasOwnProperty'](_0x7fd0('0x36'))){_0x21297d[_0x7fd0('0x1c')]=qs['limit'](_0x29a654[_0x7fd0('0x2e')][_0x7fd0('0x1c')]);_0x21297d[_0x7fd0('0x1b')]=qs[_0x7fd0('0x1b')](_0x29a654[_0x7fd0('0x2e')][_0x7fd0('0x1b')]);}_0x21297d['order']=qs[_0x7fd0('0x37')](_0x29a654[_0x7fd0('0x2e')]['sort']);_0x21297d[_0x7fd0('0x38')]=qs[_0x7fd0('0x30')](_[_0x7fd0('0x39')](_0x29a654[_0x7fd0('0x2e')],_0x80b765[_0x7fd0('0x30')]),_0x2cf3bc);if(_0x29a654[_0x7fd0('0x2e')]['filter']){_0x21297d[_0x7fd0('0x38')]=_[_0x7fd0('0x3a')](_0x21297d[_0x7fd0('0x38')],{'$or':_[_0x7fd0('0x2d')](_0x2cf3bc,function(_0x26e9c0){if(_0x26e9c0['type']!=='VIRTUAL'){var _0x44ad8d={};_0x44ad8d[_0x26e9c0[_0x7fd0('0x26')]]={'$like':'%'+_0x29a654[_0x7fd0('0x2e')][_0x7fd0('0x3b')]+'%'};return _0x44ad8d;}})});}_0x21297d=_[_0x7fd0('0x3a')]({},_0x21297d,_0x29a654['options']);var _0x202f4a={'where':_0x21297d[_0x7fd0('0x38')]};return db[_0x7fd0('0x28')]['count'](_0x202f4a)[_0x7fd0('0x22')](function(_0x27c217){_0x2d82ad[_0x7fd0('0x1a')]=_0x27c217;if(_0x29a654['query'][_0x7fd0('0x3c')]){_0x21297d['include']=[{'all':!![]}];}return db[_0x7fd0('0x28')]['findAll'](_0x21297d);})[_0x7fd0('0x22')](function(_0x2545b0){_0x2d82ad[_0x7fd0('0x3d')]=_0x2545b0;return _0x2d82ad;})[_0x7fd0('0x22')](respondWithFilteredResult(_0x187102,_0x21297d))['catch'](handleError(_0x187102,null));};exports[_0x7fd0('0x3e')]=function(_0x5a6ac2,_0x2e0496){var _0x22c6da={'raw':!![],'where':{'id':_0x5a6ac2[_0x7fd0('0x3f')]['id']}},_0x4042f6={};_0x4042f6['model']=_[_0x7fd0('0x2f')](db[_0x7fd0('0x28')][_0x7fd0('0x29')]);_0x4042f6[_0x7fd0('0x2e')]=_['keys'](_0x5a6ac2[_0x7fd0('0x2e')]);_0x4042f6[_0x7fd0('0x30')]=_[_0x7fd0('0x33')](_0x4042f6['model'],_0x4042f6[_0x7fd0('0x2e')]);_0x22c6da[_0x7fd0('0x32')]=_[_0x7fd0('0x33')](_0x4042f6[_0x7fd0('0x31')],qs[_0x7fd0('0x34')](_0x5a6ac2[_0x7fd0('0x2e')]['fields']));_0x22c6da[_0x7fd0('0x32')]=_0x22c6da[_0x7fd0('0x32')][_0x7fd0('0x35')]?_0x22c6da['attributes']:_0x4042f6[_0x7fd0('0x31')];if(_0x5a6ac2[_0x7fd0('0x2e')]['includeAll']){_0x22c6da[_0x7fd0('0x40')]=[{'all':!![]}];}_0x22c6da=_['merge']({},_0x22c6da,_0x5a6ac2['options']);return db['ChatOfflineMessage'][_0x7fd0('0x41')](_0x22c6da)[_0x7fd0('0x22')](handleEntityNotFound(_0x2e0496,null))['then'](respondWithResult(_0x2e0496,null))[_0x7fd0('0x42')](handleError(_0x2e0496,null));};exports[_0x7fd0('0x43')]=function(_0x1cecb7,_0xd611e2){return db['ChatOfflineMessage'][_0x7fd0('0x43')](_0x1cecb7[_0x7fd0('0x44')],{})[_0x7fd0('0x22')](respondWithResult(_0xd611e2,0xc9))[_0x7fd0('0x42')](handleError(_0xd611e2,null));};exports[_0x7fd0('0x21')]=function(_0x25229d,_0x3435e3){if(_0x25229d[_0x7fd0('0x44')]['id']){delete _0x25229d[_0x7fd0('0x44')]['id'];}return db[_0x7fd0('0x28')]['find']({'where':{'id':_0x25229d[_0x7fd0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3435e3,null))[_0x7fd0('0x22')](saveUpdates(_0x25229d[_0x7fd0('0x44')],null))[_0x7fd0('0x22')](respondWithResult(_0x3435e3,null))['catch'](handleError(_0x3435e3,null));};exports[_0x7fd0('0x23')]=function(_0x509447,_0x427bae){return db['ChatOfflineMessage'][_0x7fd0('0x41')]({'where':{'id':_0x509447[_0x7fd0('0x3f')]['id']}})[_0x7fd0('0x22')](handleEntityNotFound(_0x427bae,null))[_0x7fd0('0x22')](removeEntity(_0x427bae,null))[_0x7fd0('0x42')](handleError(_0x427bae,null));};exports['describe']=function(_0x2cb87e,_0x2ef42a){return db['ChatOfflineMessage'][_0x7fd0('0x45')]()[_0x7fd0('0x22')](respondWithResult(_0x2ef42a,null))[_0x7fd0('0x42')](handleError(_0x2ef42a,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 7c9f8ca..0049ee7 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 _0x0faf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x2a6193,_0x2ec097){var _0x317a31=function(_0x478fa1){while(--_0x478fa1){_0x2a6193['push'](_0x2a6193['shift']());}};_0x317a31(++_0x2ec097);}(_0x0faf,0x132));var _0xf0fa=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0x0faf[_0x55a89e];return _0x3aa2bd;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var logger=require(_0xf0fa('0x1'))(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require(_0xf0fa('0x4'));var rp=require(_0xf0fa('0x5'));var fs=require('fs');var path=require(_0xf0fa('0x6'));var rimraf=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var attributes=require(_0xf0fa('0x9'));module['exports']=function(_0x3637a3,_0x44ffa0){return _0x3637a3[_0xf0fa('0xa')](_0xf0fa('0xb'),attributes,{'tableName':_0xf0fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf0fa('0xd')});}; \ No newline at end of file +var _0xfd28=['moment','request-promise','path','rimraf','./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0xd03fed,_0x1bc7b1){var _0x578077=function(_0x2f1b06){while(--_0x2f1b06){_0xd03fed['push'](_0xd03fed['shift']());}};_0x578077(++_0x1bc7b1);}(_0xfd28,0x148));var _0x8fd2=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0xfd28[_0x4bcf38];return _0x4a89be;};'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')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8fd2('0x9'),'collate':_0x8fd2('0xa')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 4b3fa66..68c1f39 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 _0x8c6a=['http','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2068d8,_0x2f0834){var _0x399ce9=function(_0x18ecd5){while(--_0x18ecd5){_0x2068d8['push'](_0x2068d8['shift']());}};_0x399ce9(++_0x2f0834);}(_0x8c6a,0x13b));var _0xa8c6=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0x8c6a[_0x323d87];return _0x5e8f74;};'use strict';var _=require(_0xa8c6('0x0'));var util=require(_0xa8c6('0x1'));var moment=require(_0xa8c6('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8c6('0x3'));var fs=require('fs');var Redis=require(_0xa8c6('0x4'));var db=require(_0xa8c6('0x5'))['db'];var utils=require(_0xa8c6('0x6'));var logger=require('../../config/logger')(_0xa8c6('0x7'));var config=require(_0xa8c6('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa8c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ced79,_0x40068b,_0x1f196a){return new BPromise(function(_0x35fc6f,_0x2ab003){return client[_0xa8c6('0xa')](_0x5ced79,_0x1f196a)['then'](function(_0x5a060e){logger[_0xa8c6('0xb')](_0xa8c6('0xc'),_0x40068b,'request\x20sent');logger[_0xa8c6('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x40068b,_0xa8c6('0xe'),JSON[_0xa8c6('0xf')](_0x5a060e));if(_0x5a060e[_0xa8c6('0x10')]){if(_0x5a060e[_0xa8c6('0x10')]['code']===0x1f4){logger[_0xa8c6('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x40068b,_0x5a060e[_0xa8c6('0x10')][_0xa8c6('0x11')]);return _0x2ab003(_0x5a060e[_0xa8c6('0x10')]['message']);}logger[_0xa8c6('0x10')](_0xa8c6('0xc'),_0x40068b,_0x5a060e[_0xa8c6('0x10')]['message']);return _0x35fc6f(_0x5a060e[_0xa8c6('0x10')]['message']);}else{logger[_0xa8c6('0xb')](_0xa8c6('0xc'),_0x40068b,_0xa8c6('0xe'));_0x35fc6f(_0x5a060e['result']['message']);}})['catch'](function(_0x4de8dc){logger['error'](_0xa8c6('0xc'),_0x40068b,_0x4de8dc);_0x2ab003(_0x4de8dc);});});} \ No newline at end of file +var _0x8a48=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x242544,_0x598053){var _0x556b5b=function(_0x11442a){while(--_0x11442a){_0x242544['push'](_0x242544['shift']());}};_0x556b5b(++_0x598053);}(_0x8a48,0x1ca));var _0x88a4=function(_0x3e3501,_0x1926da){_0x3e3501=_0x3e3501-0x0;var _0x45737f=_0x8a48[_0x3e3501];return _0x45737f;};'use strict';var _=require('lodash');var util=require(_0x88a4('0x0'));var moment=require(_0x88a4('0x1'));var BPromise=require(_0x88a4('0x2'));var rs=require(_0x88a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88a4('0x4'))['db'];var utils=require(_0x88a4('0x5'));var logger=require('../../config/logger')(_0x88a4('0x6'));var config=require(_0x88a4('0x7'));var jayson=require(_0x88a4('0x8'));var client=jayson[_0x88a4('0x9')][_0x88a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x716aa6,_0x351895,_0x320cb7){return new BPromise(function(_0x346690,_0x24004a){return client[_0x88a4('0xb')](_0x716aa6,_0x320cb7)[_0x88a4('0xc')](function(_0x543eb2){logger[_0x88a4('0xd')](_0x88a4('0xe'),_0x351895,_0x88a4('0xf'));logger[_0x88a4('0x10')](_0x88a4('0x11'),_0x351895,_0x88a4('0xf'),JSON['stringify'](_0x543eb2));if(_0x543eb2['error']){if(_0x543eb2['error']['code']===0x1f4){logger[_0x88a4('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x351895,_0x543eb2['error']['message']);return _0x24004a(_0x543eb2[_0x88a4('0x12')][_0x88a4('0x13')]);}logger['error'](_0x88a4('0xe'),_0x351895,_0x543eb2[_0x88a4('0x12')][_0x88a4('0x13')]);return _0x346690(_0x543eb2[_0x88a4('0x12')][_0x88a4('0x13')]);}else{logger[_0x88a4('0xd')](_0x88a4('0xe'),_0x351895,_0x88a4('0xf'));_0x346690(_0x543eb2[_0x88a4('0x14')][_0x88a4('0x13')]);}})[_0x88a4('0x15')](function(_0xcdc110){logger['error'](_0x88a4('0xe'),_0x351895,_0xcdc110);_0x24004a(_0xcdc110);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 87c2b73..d7de1b9 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 _0x29ab=['update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','post','create','put','/:id'];(function(_0xfb2512,_0x187a37){var _0x41b2ba=function(_0x2765aa){while(--_0x2765aa){_0xfb2512['push'](_0xfb2512['shift']());}};_0x41b2ba(++_0x187a37);}(_0x29ab,0x158));var _0xb29a=function(_0x115410,_0x3e3e95){_0x115410=_0x115410-0x0;var _0x4ac622=_0x29ab[_0x115410];return _0x4ac622;};'use strict';var multer=require(_0xb29a('0x0'));var util=require(_0xb29a('0x1'));var path=require(_0xb29a('0x2'));var timeout=require(_0xb29a('0x3'));var express=require(_0xb29a('0x4'));var router=express[_0xb29a('0x5')]();var auth=require(_0xb29a('0x6'));var interaction=require(_0xb29a('0x7'));var config=require(_0xb29a('0x8'));var controller=require(_0xb29a('0x9'));router['get']('/',auth[_0xb29a('0xa')](),controller[_0xb29a('0xb')]);router[_0xb29a('0xc')]('/describe',auth[_0xb29a('0xa')](),controller['describe']);router['get']('/:id',auth[_0xb29a('0xa')](),controller['show']);router[_0xb29a('0xd')]('/',auth[_0xb29a('0xa')](),controller[_0xb29a('0xe')]);router[_0xb29a('0xf')](_0xb29a('0x10'),auth[_0xb29a('0xa')](),controller[_0xb29a('0x11')]);router['delete']('/:id',auth[_0xb29a('0xa')](),controller[_0xb29a('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd8f1=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x2f9549,_0x16dcfa){var _0x1548f2=function(_0x40b09e){while(--_0x40b09e){_0x2f9549['push'](_0x2f9549['shift']());}};_0x1548f2(++_0x16dcfa);}(_0xd8f1,0xeb));var _0x1d8f=function(_0x9d11c0,_0x31e40d){_0x9d11c0=_0x9d11c0-0x0;var _0xfd4b77=_0xd8f1[_0x9d11c0];return _0xfd4b77;};'use strict';var multer=require(_0x1d8f('0x0'));var util=require(_0x1d8f('0x1'));var path=require('path');var timeout=require(_0x1d8f('0x2'));var express=require(_0x1d8f('0x3'));var router=express[_0x1d8f('0x4')]();var auth=require(_0x1d8f('0x5'));var interaction=require(_0x1d8f('0x6'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0x1d8f('0x7')]('/',auth[_0x1d8f('0x8')](),controller[_0x1d8f('0x9')]);router[_0x1d8f('0x7')](_0x1d8f('0xa'),auth[_0x1d8f('0x8')](),controller[_0x1d8f('0xb')]);router[_0x1d8f('0x7')](_0x1d8f('0xc'),auth[_0x1d8f('0x8')](),controller[_0x1d8f('0xd')]);router[_0x1d8f('0xe')]('/',auth['isAuthenticated'](),controller[_0x1d8f('0xf')]);router[_0x1d8f('0x10')]('/:id',auth[_0x1d8f('0x8')](),controller[_0x1d8f('0x11')]);router[_0x1d8f('0x12')](_0x1d8f('0xc'),auth[_0x1d8f('0x8')](),controller[_0x1d8f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 54cb820..4a60793 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 _0x5e31=['timeout','INTEGER','sequelize','STRING','ENUM','mouseOver'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e31,0x15e));var _0x15e3=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x5e31[_0x467488];return _0x56107f;};'use strict';var Sequelize=require(_0x15e3('0x0'));module['exports']={'name':{'type':Sequelize[_0x15e3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x15e3('0x2')](_0x15e3('0x3'),_0x15e3('0x4')),'defaultValue':_0x15e3('0x3')},'selector':{'type':Sequelize[_0x15e3('0x1')]},'timeout':{'type':Sequelize[_0x15e3('0x5')]}}; \ No newline at end of file +var _0x9606=['INTEGER','sequelize','STRING','timeout'];(function(_0x1cffe2,_0x5383e8){var _0x57030e=function(_0xe9c73f){while(--_0xe9c73f){_0x1cffe2['push'](_0x1cffe2['shift']());}};_0x57030e(++_0x5383e8);}(_0x9606,0x9d));var _0x6960=function(_0x414aba,_0x2750b3){_0x414aba=_0x414aba-0x0;var _0x278b27=_0x9606[_0x414aba];return _0x278b27;};'use strict';var Sequelize=require(_0x6960('0x0'));module['exports']={'name':{'type':Sequelize[_0x6960('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x6960('0x2')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x6960('0x1')]},'timeout':{'type':Sequelize[_0x6960('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index b78d12c..5f7967a 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 _0x0f25=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','show','model','keys','ChatProactiveAction','query','filters','attributes','intersection','fields','length','include','merge','options','find','create','body','catch','params','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x2226f8,_0x350f4c){var _0x151cfe=function(_0x3001d9){while(--_0x3001d9){_0x2226f8['push'](_0x2226f8['shift']());}};_0x151cfe(++_0x350f4c);}(_0x0f25,0x1dc));var _0x50f2=function(_0x4769f8,_0x55854a){_0x4769f8=_0x4769f8-0x0;var _0xdc249c=_0x0f25[_0x4769f8];return _0xdc249c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x50f2('0x0'));var rimraf=require(_0x50f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50f2('0x2'));var rp=require('request-promise');var moment=require(_0x50f2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x50f2('0x4'));var util=require(_0x50f2('0x5'));var path=require(_0x50f2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x50f2('0x7'));var squel=require(_0x50f2('0x8'));var crypto=require(_0x50f2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x50f2('0xa'));var toCsv=require(_0x50f2('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x50f2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x50f2('0xd'));var as=require(_0x50f2('0xe'));var hardwareService=require(_0x50f2('0xf'));var logger=require(_0x50f2('0x10'))('api');var utils=require(_0x50f2('0x11'));var config=require(_0x50f2('0x12'));var licenseUtil=require(_0x50f2('0x13'));var db=require(_0x50f2('0x14'))['db'];function respondWithStatusCode(_0x541097,_0x2c96d9){_0x2c96d9=_0x2c96d9||0xcc;return function(_0x4a3fb4){if(_0x4a3fb4){return _0x541097[_0x50f2('0x15')](_0x2c96d9);}return _0x541097['status'](_0x2c96d9)[_0x50f2('0x16')]();};}function respondWithResult(_0x5da9b6,_0x473b82){_0x473b82=_0x473b82||0xc8;return function(_0x3cc610){if(_0x3cc610){return _0x5da9b6[_0x50f2('0x17')](_0x473b82)[_0x50f2('0x18')](_0x3cc610);}};}function respondWithFilteredResult(_0x161a8a,_0x35d4e5){return function(_0x435cc3){if(_0x435cc3){var _0x29932e=_0x435cc3[_0x50f2('0x19')],_0x351eca=_0x35d4e5[_0x50f2('0x1a')],_0x5103eb=_0x35d4e5['offset']+_0x35d4e5['limit'],_0x28eea5;if(_0x5103eb>=_0x29932e){_0x5103eb=_0x29932e;_0x28eea5=0xc8;}else{_0x28eea5=0xce;}_0x161a8a[_0x50f2('0x17')](_0x28eea5);return _0x161a8a[_0x50f2('0x1b')](_0x50f2('0x1c'),_0x351eca+'-'+_0x5103eb+'/'+_0x29932e)['json'](_0x435cc3);}return null;};}function patchUpdates(_0x3048f9){return function(_0xadcd79){try{jsonpatch[_0x50f2('0x1d')](_0xadcd79,_0x3048f9,!![]);}catch(_0x34ecbc){return BPromise[_0x50f2('0x1e')](_0x34ecbc);}return _0xadcd79[_0x50f2('0x1f')]();};}function saveUpdates(_0x41977c,_0x1f10ec){return function(_0x5e3a70){if(_0x5e3a70){return _0x5e3a70[_0x50f2('0x20')](_0x41977c)[_0x50f2('0x21')](function(_0x525ac8){return _0x525ac8;});}return null;};}function removeEntity(_0x48485d,_0x59ae01){return function(_0x50945d){if(_0x50945d){return _0x50945d['destroy']()[_0x50f2('0x21')](function(){_0x48485d[_0x50f2('0x17')](0xcc)[_0x50f2('0x16')]();});}};}function handleEntityNotFound(_0x172d02,_0x443af4){return function(_0xf5196c){if(!_0xf5196c){_0x172d02[_0x50f2('0x15')](0x194);}return _0xf5196c;};}function handleError(_0x285f76,_0x22f14e){_0x22f14e=_0x22f14e||0x1f4;return function(_0x18b55e){logger['error'](_0x18b55e[_0x50f2('0x22')]);if(_0x18b55e['name']){delete _0x18b55e[_0x50f2('0x23')];}_0x285f76[_0x50f2('0x17')](_0x22f14e)[_0x50f2('0x24')](_0x18b55e);};}exports[_0x50f2('0x25')]=function(_0xe8496f,_0x4bc7b4){var _0x22a83f={'raw':!![],'where':{'id':_0xe8496f['params']['id']}},_0x33faa7={};_0x33faa7[_0x50f2('0x26')]=_[_0x50f2('0x27')](db[_0x50f2('0x28')]['rawAttributes']);_0x33faa7['query']=_['keys'](_0xe8496f[_0x50f2('0x29')]);_0x33faa7[_0x50f2('0x2a')]=_['intersection'](_0x33faa7[_0x50f2('0x26')],_0x33faa7[_0x50f2('0x29')]);_0x22a83f[_0x50f2('0x2b')]=_[_0x50f2('0x2c')](_0x33faa7[_0x50f2('0x26')],qs[_0x50f2('0x2d')](_0xe8496f[_0x50f2('0x29')][_0x50f2('0x2d')]));_0x22a83f[_0x50f2('0x2b')]=_0x22a83f['attributes'][_0x50f2('0x2e')]?_0x22a83f['attributes']:_0x33faa7['model'];if(_0xe8496f[_0x50f2('0x29')]['includeAll']){_0x22a83f[_0x50f2('0x2f')]=[{'all':!![]}];}_0x22a83f=_[_0x50f2('0x30')]({},_0x22a83f,_0xe8496f[_0x50f2('0x31')]);return db[_0x50f2('0x28')][_0x50f2('0x32')](_0x22a83f)['then'](handleEntityNotFound(_0x4bc7b4,null))[_0x50f2('0x21')](respondWithResult(_0x4bc7b4,null))['catch'](handleError(_0x4bc7b4,null));};exports[_0x50f2('0x33')]=function(_0x2770dd,_0xf3e79f){return db[_0x50f2('0x28')][_0x50f2('0x33')](_0x2770dd[_0x50f2('0x34')],{})[_0x50f2('0x21')](respondWithResult(_0xf3e79f,0xc9))[_0x50f2('0x35')](handleError(_0xf3e79f,null));};exports[_0x50f2('0x20')]=function(_0x59c7e2,_0x1072ab){if(_0x59c7e2['body']['id']){delete _0x59c7e2[_0x50f2('0x34')]['id'];}return db[_0x50f2('0x28')][_0x50f2('0x32')]({'where':{'id':_0x59c7e2[_0x50f2('0x36')]['id']}})[_0x50f2('0x21')](handleEntityNotFound(_0x1072ab,null))[_0x50f2('0x21')](saveUpdates(_0x59c7e2[_0x50f2('0x34')],null))['then'](respondWithResult(_0x1072ab,null))[_0x50f2('0x35')](handleError(_0x1072ab,null));};exports['destroy']=function(_0x464bec,_0x133327){return db[_0x50f2('0x28')]['find']({'where':{'id':_0x464bec[_0x50f2('0x36')]['id']}})[_0x50f2('0x21')](handleEntityNotFound(_0x133327,null))[_0x50f2('0x21')](removeEntity(_0x133327,null))[_0x50f2('0x35')](handleError(_0x133327,null));}; \ No newline at end of file +var _0xfeaa=['squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','Content-Range','reject','save','update','then','end','sendStatus','stack','send','params','model','rawAttributes','keys','query','attributes','intersection','fields','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x885eff,_0x555809){var _0x17819f=function(_0x3a69f0){while(--_0x3a69f0){_0x885eff['push'](_0x885eff['shift']());}};_0x17819f(++_0x555809);}(_0xfeaa,0x1eb));var _0xafea=function(_0xc27f0b,_0x31541e){_0xc27f0b=_0xc27f0b-0x0;var _0x3f31a1=_0xfeaa[_0xc27f0b];return _0x3f31a1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xafea('0x0'));var rimraf=require(_0xafea('0x1'));var zipdir=require(_0xafea('0x2'));var jsonpatch=require(_0xafea('0x3'));var rp=require(_0xafea('0x4'));var moment=require(_0xafea('0x5'));var BPromise=require(_0xafea('0x6'));var Mustache=require(_0xafea('0x7'));var util=require(_0xafea('0x8'));var path=require(_0xafea('0x9'));var sox=require(_0xafea('0xa'));var csv=require(_0xafea('0xb'));var ejs=require(_0xafea('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xafea('0xd'));var crypto=require('crypto');var jsforce=require(_0xafea('0xe'));var deskjs=require(_0xafea('0xf'));var toCsv=require(_0xafea('0xb'));var querystring=require(_0xafea('0x10'));var Papa=require(_0xafea('0x11'));var Redis=require(_0xafea('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xafea('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xafea('0x14'));var logger=require(_0xafea('0x15'))('api');var utils=require(_0xafea('0x16'));var config=require(_0xafea('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xafea('0x18'))['db'];function respondWithStatusCode(_0xa57ee9,_0x1a8773){_0x1a8773=_0x1a8773||0xcc;return function(_0x1d9e0c){if(_0x1d9e0c){return _0xa57ee9['sendStatus'](_0x1a8773);}return _0xa57ee9[_0xafea('0x19')](_0x1a8773)['end']();};}function respondWithResult(_0x2af18d,_0x36400b){_0x36400b=_0x36400b||0xc8;return function(_0x24eafc){if(_0x24eafc){return _0x2af18d['status'](_0x36400b)[_0xafea('0x1a')](_0x24eafc);}};}function respondWithFilteredResult(_0x1f173c,_0xdb9a22){return function(_0x5e25ff){if(_0x5e25ff){var _0xfb972a=_0x5e25ff['count'],_0x165b31=_0xdb9a22[_0xafea('0x1b')],_0x1d0a0e=_0xdb9a22[_0xafea('0x1b')]+_0xdb9a22[_0xafea('0x1c')],_0x9dbd78;if(_0x1d0a0e>=_0xfb972a){_0x1d0a0e=_0xfb972a;_0x9dbd78=0xc8;}else{_0x9dbd78=0xce;}_0x1f173c['status'](_0x9dbd78);return _0x1f173c['set'](_0xafea('0x1d'),_0x165b31+'-'+_0x1d0a0e+'/'+_0xfb972a)[_0xafea('0x1a')](_0x5e25ff);}return null;};}function patchUpdates(_0x5329f8){return function(_0x2a5969){try{jsonpatch['apply'](_0x2a5969,_0x5329f8,!![]);}catch(_0x490e55){return BPromise[_0xafea('0x1e')](_0x490e55);}return _0x2a5969[_0xafea('0x1f')]();};}function saveUpdates(_0x63e8e1,_0x7f7d6d){return function(_0x30c9d7){if(_0x30c9d7){return _0x30c9d7[_0xafea('0x20')](_0x63e8e1)[_0xafea('0x21')](function(_0x32aff9){return _0x32aff9;});}return null;};}function removeEntity(_0x1e5575,_0x2e5d2a){return function(_0x404f28){if(_0x404f28){return _0x404f28['destroy']()['then'](function(){_0x1e5575['status'](0xcc)[_0xafea('0x22')]();});}};}function handleEntityNotFound(_0x5ba046,_0x4cf24d){return function(_0x3dc5f7){if(!_0x3dc5f7){_0x5ba046[_0xafea('0x23')](0x194);}return _0x3dc5f7;};}function handleError(_0x5d5d0d,_0x59ec36){_0x59ec36=_0x59ec36||0x1f4;return function(_0x8241eb){logger['error'](_0x8241eb[_0xafea('0x24')]);if(_0x8241eb['name']){delete _0x8241eb['name'];}_0x5d5d0d[_0xafea('0x19')](_0x59ec36)[_0xafea('0x25')](_0x8241eb);};}exports['show']=function(_0x2ebaa7,_0x4556ec){var _0x1bb988={'raw':!![],'where':{'id':_0x2ebaa7[_0xafea('0x26')]['id']}},_0x1a0bc8={};_0x1a0bc8[_0xafea('0x27')]=_['keys'](db['ChatProactiveAction'][_0xafea('0x28')]);_0x1a0bc8['query']=_[_0xafea('0x29')](_0x2ebaa7[_0xafea('0x2a')]);_0x1a0bc8['filters']=_['intersection'](_0x1a0bc8[_0xafea('0x27')],_0x1a0bc8[_0xafea('0x2a')]);_0x1bb988[_0xafea('0x2b')]=_[_0xafea('0x2c')](_0x1a0bc8[_0xafea('0x27')],qs[_0xafea('0x2d')](_0x2ebaa7[_0xafea('0x2a')][_0xafea('0x2d')]));_0x1bb988[_0xafea('0x2b')]=_0x1bb988[_0xafea('0x2b')][_0xafea('0x2e')]?_0x1bb988['attributes']:_0x1a0bc8[_0xafea('0x27')];if(_0x2ebaa7['query'][_0xafea('0x2f')]){_0x1bb988[_0xafea('0x30')]=[{'all':!![]}];}_0x1bb988=_[_0xafea('0x31')]({},_0x1bb988,_0x2ebaa7[_0xafea('0x32')]);return db[_0xafea('0x33')][_0xafea('0x34')](_0x1bb988)['then'](handleEntityNotFound(_0x4556ec,null))[_0xafea('0x21')](respondWithResult(_0x4556ec,null))[_0xafea('0x35')](handleError(_0x4556ec,null));};exports[_0xafea('0x36')]=function(_0x48bdc1,_0x2fd77f){return db['ChatProactiveAction'][_0xafea('0x36')](_0x48bdc1[_0xafea('0x37')],{})[_0xafea('0x21')](respondWithResult(_0x2fd77f,0xc9))[_0xafea('0x35')](handleError(_0x2fd77f,null));};exports[_0xafea('0x20')]=function(_0x49819a,_0x18ac75){if(_0x49819a[_0xafea('0x37')]['id']){delete _0x49819a[_0xafea('0x37')]['id'];}return db[_0xafea('0x33')][_0xafea('0x34')]({'where':{'id':_0x49819a[_0xafea('0x26')]['id']}})[_0xafea('0x21')](handleEntityNotFound(_0x18ac75,null))['then'](saveUpdates(_0x49819a[_0xafea('0x37')],null))[_0xafea('0x21')](respondWithResult(_0x18ac75,null))[_0xafea('0x35')](handleError(_0x18ac75,null));};exports['destroy']=function(_0x27a3e9,_0x176566){return db[_0xafea('0x33')][_0xafea('0x34')]({'where':{'id':_0x27a3e9['params']['id']}})[_0xafea('0x21')](handleEntityNotFound(_0x176566,null))[_0xafea('0x21')](removeEntity(_0x176566,null))[_0xafea('0x35')](handleError(_0x176566,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index bf923da..057efb5 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 _0x3bd5=['request-promise','path','rimraf','../../config/environment','define','chat_proactive_actions','../../config/logger','api','bluebird'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x3bd5,0xe7));var _0x53bd=function(_0x1034ea,_0x4fe295){_0x1034ea=_0x1034ea-0x0;var _0xc5c83=_0x3bd5[_0x1034ea];return _0xc5c83;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x53bd('0x0'))(_0x53bd('0x1'));var moment=require('moment');var BPromise=require(_0x53bd('0x2'));var rp=require(_0x53bd('0x3'));var fs=require('fs');var path=require(_0x53bd('0x4'));var rimraf=require(_0x53bd('0x5'));var config=require(_0x53bd('0x6'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x443882,_0x21567b){return _0x443882[_0x53bd('0x7')]('ChatProactiveAction',attributes,{'tableName':_0x53bd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x941f=['rimraf','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash','moment','bluebird','request-promise','path'];(function(_0x205ed2,_0x248ed0){var _0x540c3b=function(_0x9a7918){while(--_0x9a7918){_0x205ed2['push'](_0x205ed2['shift']());}};_0x540c3b(++_0x248ed0);}(_0x941f,0x113));var _0xf941=function(_0x26c934,_0xaf090a){_0x26c934=_0x26c934-0x0;var _0x2d0849=_0x941f[_0x26c934];return _0x2d0849;};'use strict';var _=require(_0xf941('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf941('0x1'));var BPromise=require(_0xf941('0x2'));var rp=require(_0xf941('0x3'));var fs=require('fs');var path=require(_0xf941('0x4'));var rimraf=require(_0xf941('0x5'));var config=require('../../config/environment');var attributes=require(_0xf941('0x6'));module['exports']=function(_0x51aa47,_0x34e07b){return _0x51aa47[_0xf941('0x7')](_0xf941('0x8'),attributes,{'tableName':_0xf941('0x9'),'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 64052d1..8d3e399 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 _0x8977=['then','info','ChatProactiveAction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','http','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8977,0x75));var _0x7897=function(_0x32a385,_0x196d83){_0x32a385=_0x32a385-0x0;var _0x3ad492=_0x8977[_0x32a385];return _0x3ad492;};'use strict';var _=require(_0x7897('0x0'));var util=require('util');var moment=require(_0x7897('0x1'));var BPromise=require(_0x7897('0x2'));var rs=require(_0x7897('0x3'));var fs=require('fs');var Redis=require(_0x7897('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7897('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7897('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7897('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x56129b,_0x433ed2,_0x133e00){return new BPromise(function(_0x57d161,_0x5d7de4){return client[_0x7897('0x8')](_0x56129b,_0x133e00)[_0x7897('0x9')](function(_0x6bb12){logger[_0x7897('0xa')](_0x7897('0xb'),_0x433ed2,'request\x20sent');logger[_0x7897('0xc')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x433ed2,_0x7897('0xd'),JSON['stringify'](_0x6bb12));if(_0x6bb12[_0x7897('0xe')]){if(_0x6bb12[_0x7897('0xe')][_0x7897('0xf')]===0x1f4){logger['error'](_0x7897('0xb'),_0x433ed2,_0x6bb12[_0x7897('0xe')][_0x7897('0x10')]);return _0x5d7de4(_0x6bb12[_0x7897('0xe')][_0x7897('0x10')]);}logger[_0x7897('0xe')](_0x7897('0xb'),_0x433ed2,_0x6bb12[_0x7897('0xe')]['message']);return _0x57d161(_0x6bb12[_0x7897('0xe')]['message']);}else{logger[_0x7897('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x433ed2,_0x7897('0xd'));_0x57d161(_0x6bb12['result'][_0x7897('0x10')]);}})[_0x7897('0x11')](function(_0xbf4cdb){logger['error'](_0x7897('0xb'),_0x433ed2,_0xbf4cdb);_0x5d7de4(_0xbf4cdb);});});} \ No newline at end of file +var _0xb5c9=['then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x40d92c,_0x1ca5cf){var _0x2422e2=function(_0x1f5f09){while(--_0x1f5f09){_0x40d92c['push'](_0x40d92c['shift']());}};_0x2422e2(++_0x1ca5cf);}(_0xb5c9,0x10e));var _0x9b5c=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xb5c9[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0x9b5c('0x0'));var util=require('util');var moment=require(_0x9b5c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b5c('0x2'))['db'];var utils=require(_0x9b5c('0x3'));var logger=require('../../config/logger')(_0x9b5c('0x4'));var config=require(_0x9b5c('0x5'));var jayson=require(_0x9b5c('0x6'));var client=jayson[_0x9b5c('0x7')][_0x9b5c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x222e16,_0x28e54b,_0xbaafb2){return new BPromise(function(_0x151b4a,_0x13c913){return client[_0x9b5c('0x9')](_0x222e16,_0xbaafb2)[_0x9b5c('0xa')](function(_0x320004){logger[_0x9b5c('0xb')](_0x9b5c('0xc'),_0x28e54b,_0x9b5c('0xd'));logger[_0x9b5c('0xe')](_0x9b5c('0xf'),_0x28e54b,_0x9b5c('0xd'),JSON['stringify'](_0x320004));if(_0x320004[_0x9b5c('0x10')]){if(_0x320004[_0x9b5c('0x10')][_0x9b5c('0x11')]===0x1f4){logger['error'](_0x9b5c('0xc'),_0x28e54b,_0x320004[_0x9b5c('0x10')][_0x9b5c('0x12')]);return _0x13c913(_0x320004['error'][_0x9b5c('0x12')]);}logger[_0x9b5c('0x10')](_0x9b5c('0xc'),_0x28e54b,_0x320004[_0x9b5c('0x10')]['message']);return _0x151b4a(_0x320004[_0x9b5c('0x10')]['message']);}else{logger[_0x9b5c('0xb')](_0x9b5c('0xc'),_0x28e54b,'request\x20sent');_0x151b4a(_0x320004['result']['message']);}})[_0x9b5c('0x13')](function(_0x3cca7e){logger[_0x9b5c('0x10')](_0x9b5c('0xc'),_0x28e54b,_0x3cca7e);_0x13c913(_0x3cca7e);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 414f28b..dcae7a8 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 _0x3442=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','put','isAuthenticated'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3442,0x194));var _0x2344=function(_0x1a7096,_0x924837){_0x1a7096=_0x1a7096-0x0;var _0x51eec2=_0x3442[_0x1a7096];return _0x51eec2;};'use strict';var multer=require(_0x2344('0x0'));var util=require(_0x2344('0x1'));var path=require(_0x2344('0x2'));var timeout=require(_0x2344('0x3'));var express=require(_0x2344('0x4'));var router=express[_0x2344('0x5')]();var auth=require(_0x2344('0x6'));var interaction=require(_0x2344('0x7'));var config=require(_0x2344('0x8'));var controller=require(_0x2344('0x9'));router[_0x2344('0xa')](_0x2344('0xb'),auth['isAuthenticated'](),controller[_0x2344('0xc')]);router[_0x2344('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2344('0xe')](_0x2344('0xb'),auth[_0x2344('0xf')](),controller[_0x2344('0x10')]);router[_0x2344('0x11')](_0x2344('0xb'),auth[_0x2344('0xf')](),controller[_0x2344('0x12')]);module[_0x2344('0x13')]=router; \ No newline at end of file +var _0xfdb0=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','update','delete','destroy'];(function(_0x40a6b5,_0x2ef12f){var _0x4bab77=function(_0x303e52){while(--_0x303e52){_0x40a6b5['push'](_0x40a6b5['shift']());}};_0x4bab77(++_0x2ef12f);}(_0xfdb0,0x10b));var _0x0fdb=function(_0x3ce28a,_0x22fe54){_0x3ce28a=_0x3ce28a-0x0;var _0x1057a9=_0xfdb0[_0x3ce28a];return _0x1057a9;};'use strict';var multer=require(_0x0fdb('0x0'));var util=require(_0x0fdb('0x1'));var path=require(_0x0fdb('0x2'));var timeout=require(_0x0fdb('0x3'));var express=require(_0x0fdb('0x4'));var router=express[_0x0fdb('0x5')]();var auth=require(_0x0fdb('0x6'));var interaction=require(_0x0fdb('0x7'));var config=require(_0x0fdb('0x8'));var controller=require(_0x0fdb('0x9'));router[_0x0fdb('0xa')](_0x0fdb('0xb'),auth['isAuthenticated'](),controller[_0x0fdb('0xc')]);router[_0x0fdb('0xd')]('/',auth[_0x0fdb('0xe')](),controller['create']);router['put'](_0x0fdb('0xb'),auth[_0x0fdb('0xe')](),controller[_0x0fdb('0xf')]);router[_0x0fdb('0x10')](_0x0fdb('0xb'),auth['isAuthenticated'](),controller[_0x0fdb('0x11')]);module[_0x0fdb('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index c19aad9..266dcbc 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 _0xaf9a=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x477bb3,_0x1af649){var _0x3a2f31=function(_0x1ba1c4){while(--_0x1ba1c4){_0x477bb3['push'](_0x477bb3['shift']());}};_0x3a2f31(++_0x1af649);}(_0xaf9a,0x124));var _0xaaf9=function(_0x3eee60,_0xc4a39e){_0x3eee60=_0x3eee60-0x0;var _0x3ef42a=_0xaf9a[_0x3eee60];return _0x3ef42a;};'use strict';var Sequelize=require(_0xaaf9('0x0'));module[_0xaaf9('0x1')]={'name':{'type':Sequelize[_0xaaf9('0x2')],'unique':_0xaaf9('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xaaf9('0x2')]},'timeout':{'type':Sequelize[_0xaaf9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaaf9('0x5')](_0xaaf9('0x6'),_0xaaf9('0x7'),_0xaaf9('0x8'))}}; \ No newline at end of file +var _0xebfc=['roundrobin','exports','INTEGER','rrmemory','beepall'];(function(_0x2ecb67,_0x8ec62d){var _0x168079=function(_0x56c365){while(--_0x56c365){_0x2ecb67['push'](_0x2ecb67['shift']());}};_0x168079(++_0x8ec62d);}(_0xebfc,0x97));var _0xcebf=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xebfc[_0x2db12b];return _0x20990b;};'use strict';var Sequelize=require('sequelize');module[_0xcebf('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xcebf('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xcebf('0x2'),_0xcebf('0x3'),_0xcebf('0x4'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e294ff5..99ac662 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 _0xbd01=['find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','keys','hasOwnProperty','ChatQueueId','UserChatQueue','findAndCountAll','UserId','chatPause','format','SIP','updatedAt','Team','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','userChatQueue:save','removeTeams','User','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','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','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','result','sendStatus','status','json','count','offset','set','Content-Range','update','destroy','get','ChatQueues','UserProfileResource','end','name','send','index','map','ChatQueue','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','show','params','rawAttributes','fields','includeAll'];(function(_0x2997ea,_0x1e25e0){var _0x4a6c39=function(_0x12d7c7){while(--_0x12d7c7){_0x2997ea['push'](_0x2997ea['shift']());}};_0x4a6c39(++_0x1e25e0);}(_0xbd01,0xd4));var _0x1bd0=function(_0x1dc849,_0x53faa2){_0x1dc849=_0x1dc849-0x0;var _0x3a0a43=_0xbd01[_0x1dc849];return _0x3a0a43;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1bd0('0x0'));var rimraf=require(_0x1bd0('0x1'));var zipdir=require(_0x1bd0('0x2'));var jsonpatch=require(_0x1bd0('0x3'));var rp=require(_0x1bd0('0x4'));var moment=require(_0x1bd0('0x5'));var BPromise=require(_0x1bd0('0x6'));var Mustache=require(_0x1bd0('0x7'));var util=require(_0x1bd0('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x1bd0('0x9'));var ejs=require(_0x1bd0('0xa'));var fs=require('fs');var _=require(_0x1bd0('0xb'));var squel=require('squel');var crypto=require(_0x1bd0('0xc'));var jsforce=require(_0x1bd0('0xd'));var deskjs=require(_0x1bd0('0xe'));var toCsv=require(_0x1bd0('0x9'));var querystring=require(_0x1bd0('0xf'));var Papa=require(_0x1bd0('0x10'));var Redis=require(_0x1bd0('0x11'));var authService=require(_0x1bd0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1bd0('0x13'));var hardwareService=require(_0x1bd0('0x14'));var logger=require(_0x1bd0('0x15'))(_0x1bd0('0x16'));var utils=require(_0x1bd0('0x17'));var config=require(_0x1bd0('0x18'));var licenseUtil=require(_0x1bd0('0x19'));var db=require(_0x1bd0('0x1a'))['db'];config[_0x1bd0('0x1b')]=_[_0x1bd0('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1bd0('0x1d'))(new Redis(config['redis']));require(_0x1bd0('0x1e'))[_0x1bd0('0x1f')](socket);var jayson=require(_0x1bd0('0x20'));var client=jayson[_0x1bd0('0x21')][_0x1bd0('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4a340a,_0x393488,_0x5cc757,_0x11ffd4){return new BPromise(function(_0x59f8d3,_0x1fa7f3){var _0xf4e6f9=_0x11ffd4||client;return _0xf4e6f9[_0x1bd0('0x23')](_0x4a340a,_0x5cc757)[_0x1bd0('0x24')](function(_0x5ec1f4){logger['info']('ChatQueue,\x20%s,\x20%s',_0x393488,_0x1bd0('0x25'));logger[_0x1bd0('0x26')](_0x1bd0('0x27'),_0x393488,_0x1bd0('0x25'),JSON[_0x1bd0('0x28')](_0x5ec1f4));if(_0x5ec1f4[_0x1bd0('0x29')]){if(_0x5ec1f4[_0x1bd0('0x29')][_0x1bd0('0x2a')]===0x1f4){logger[_0x1bd0('0x29')]('ChatQueue,\x20%s,\x20%s',_0x393488,_0x5ec1f4[_0x1bd0('0x29')][_0x1bd0('0x2b')]);return _0x1fa7f3(_0x5ec1f4[_0x1bd0('0x29')][_0x1bd0('0x2b')]);}logger[_0x1bd0('0x29')]('ChatQueue,\x20%s,\x20%s',_0x393488,_0x5ec1f4[_0x1bd0('0x29')][_0x1bd0('0x2b')]);return _0x59f8d3(_0x5ec1f4[_0x1bd0('0x29')][_0x1bd0('0x2b')]);}else{logger['info'](_0x1bd0('0x2c'),_0x393488,_0x1bd0('0x25'));_0x59f8d3(_0x5ec1f4[_0x1bd0('0x2d')][_0x1bd0('0x2b')]);}})['catch'](function(_0x29cc12){logger[_0x1bd0('0x29')](_0x1bd0('0x2c'),_0x393488,_0x29cc12);_0x1fa7f3(_0x29cc12);});});}function respondWithStatusCode(_0x4ab7fa,_0x4806b5){_0x4806b5=_0x4806b5||0xcc;return function(_0x12452e){if(_0x12452e){return _0x4ab7fa[_0x1bd0('0x2e')](_0x4806b5);}return _0x4ab7fa[_0x1bd0('0x2f')](_0x4806b5)['end']();};}function respondWithResult(_0x608fb3,_0x1b6162){_0x1b6162=_0x1b6162||0xc8;return function(_0xba3472){if(_0xba3472){return _0x608fb3['status'](_0x1b6162)[_0x1bd0('0x30')](_0xba3472);}};}function respondWithFilteredResult(_0x628ac5,_0x4d9f95){return function(_0x14c6b6){if(_0x14c6b6){var _0x358b7f=_0x14c6b6[_0x1bd0('0x31')],_0x2f94b3=_0x4d9f95[_0x1bd0('0x32')],_0x108956=_0x4d9f95['offset']+_0x4d9f95['limit'],_0xb87aba;if(_0x108956>=_0x358b7f){_0x108956=_0x358b7f;_0xb87aba=0xc8;}else{_0xb87aba=0xce;}_0x628ac5[_0x1bd0('0x2f')](_0xb87aba);return _0x628ac5[_0x1bd0('0x33')](_0x1bd0('0x34'),_0x2f94b3+'-'+_0x108956+'/'+_0x358b7f)[_0x1bd0('0x30')](_0x14c6b6);}return null;};}function patchUpdates(_0xe0b9b7){return function(_0x5a8624){try{jsonpatch['apply'](_0x5a8624,_0xe0b9b7,!![]);}catch(_0x3ed490){return BPromise['reject'](_0x3ed490);}return _0x5a8624['save']();};}function saveUpdates(_0x1a9801,_0x2eb7f8){return function(_0x1860d1){if(_0x1860d1){return _0x1860d1[_0x1bd0('0x35')](_0x1a9801)[_0x1bd0('0x24')](function(_0x38f9a6){return _0x38f9a6;});}return null;};}function removeEntity(_0x101660,_0x33c103){return function(_0x1d5a54){if(_0x1d5a54){return _0x1d5a54[_0x1bd0('0x36')]()['then'](function(){var _0xb98ac7=_0x1d5a54[_0x1bd0('0x37')]({'plain':!![]});var _0x3a1d6c=_0x1bd0('0x38');return db[_0x1bd0('0x39')][_0x1bd0('0x36')]({'where':{'type':_0x3a1d6c,'resourceId':_0xb98ac7['id']}})[_0x1bd0('0x24')](function(){return _0x1d5a54;});})[_0x1bd0('0x24')](function(){_0x101660['status'](0xcc)[_0x1bd0('0x3a')]();});}};}function handleEntityNotFound(_0x35ef0d,_0x1d18fa){return function(_0x2b6bf0){if(!_0x2b6bf0){_0x35ef0d[_0x1bd0('0x2e')](0x194);}return _0x2b6bf0;};}function handleError(_0x30f692,_0x17dea0){_0x17dea0=_0x17dea0||0x1f4;return function(_0x550ece){logger[_0x1bd0('0x29')](_0x550ece['stack']);if(_0x550ece[_0x1bd0('0x3b')]){delete _0x550ece[_0x1bd0('0x3b')];}_0x30f692[_0x1bd0('0x2f')](_0x17dea0)[_0x1bd0('0x3c')](_0x550ece);};}exports[_0x1bd0('0x3d')]=function(_0x52553f,_0x1ddd1e){var _0x6f1f5b={},_0x41d3ae={},_0x23fd8a={'count':0x0,'rows':[]};var _0x141c4a=_[_0x1bd0('0x3e')](db[_0x1bd0('0x3f')]['rawAttributes'],function(_0x1416eb){return{'name':_0x1416eb[_0x1bd0('0x40')],'type':_0x1416eb[_0x1bd0('0x41')][_0x1bd0('0x42')]};});_0x41d3ae[_0x1bd0('0x43')]=_['map'](_0x141c4a,_0x1bd0('0x3b'));_0x41d3ae[_0x1bd0('0x44')]=_['keys'](_0x52553f[_0x1bd0('0x44')]);_0x41d3ae[_0x1bd0('0x45')]=_[_0x1bd0('0x46')](_0x41d3ae[_0x1bd0('0x43')],_0x41d3ae['query']);_0x6f1f5b['attributes']=_[_0x1bd0('0x46')](_0x41d3ae['model'],qs['fields'](_0x52553f[_0x1bd0('0x44')]['fields']));_0x6f1f5b['attributes']=_0x6f1f5b[_0x1bd0('0x47')][_0x1bd0('0x48')]?_0x6f1f5b['attributes']:_0x41d3ae['model'];if(!_0x52553f[_0x1bd0('0x44')]['hasOwnProperty'](_0x1bd0('0x49'))){_0x6f1f5b[_0x1bd0('0x4a')]=qs[_0x1bd0('0x4a')](_0x52553f[_0x1bd0('0x44')][_0x1bd0('0x4a')]);_0x6f1f5b[_0x1bd0('0x32')]=qs[_0x1bd0('0x32')](_0x52553f[_0x1bd0('0x44')][_0x1bd0('0x32')]);}_0x6f1f5b[_0x1bd0('0x4b')]=qs[_0x1bd0('0x4c')](_0x52553f[_0x1bd0('0x44')]['sort']);_0x6f1f5b[_0x1bd0('0x4d')]=qs['filters'](_[_0x1bd0('0x4e')](_0x52553f[_0x1bd0('0x44')],_0x41d3ae[_0x1bd0('0x45')]),_0x141c4a);if(_0x52553f['query'][_0x1bd0('0x4f')]){_0x6f1f5b[_0x1bd0('0x4d')]=_['merge'](_0x6f1f5b[_0x1bd0('0x4d')],{'$or':_[_0x1bd0('0x3e')](_0x141c4a,function(_0x259118){if(_0x259118[_0x1bd0('0x41')]!==_0x1bd0('0x50')){var _0x20e31e={};_0x20e31e[_0x259118[_0x1bd0('0x3b')]]={'$like':'%'+_0x52553f[_0x1bd0('0x44')][_0x1bd0('0x4f')]+'%'};return _0x20e31e;}})});}_0x6f1f5b=_[_0x1bd0('0x51')]({},_0x6f1f5b,_0x52553f[_0x1bd0('0x52')]);var _0x201521={'where':_0x6f1f5b[_0x1bd0('0x4d')]};return db[_0x1bd0('0x3f')][_0x1bd0('0x31')](_0x201521)[_0x1bd0('0x24')](function(_0x4ab30f){_0x23fd8a[_0x1bd0('0x31')]=_0x4ab30f;if(_0x52553f['query']['includeAll']){_0x6f1f5b['include']=[{'all':!![]}];}return db[_0x1bd0('0x3f')][_0x1bd0('0x53')](_0x6f1f5b);})[_0x1bd0('0x24')](function(_0x2ffb51){_0x23fd8a[_0x1bd0('0x54')]=_0x2ffb51;return _0x23fd8a;})[_0x1bd0('0x24')](respondWithFilteredResult(_0x1ddd1e,_0x6f1f5b))['catch'](handleError(_0x1ddd1e,null));};exports[_0x1bd0('0x55')]=function(_0x94989,_0x49c6e4){var _0x1263fb={'raw':!![],'where':{'id':_0x94989[_0x1bd0('0x56')]['id']}},_0x3012a3={};_0x3012a3[_0x1bd0('0x43')]=_['keys'](db[_0x1bd0('0x3f')][_0x1bd0('0x57')]);_0x3012a3[_0x1bd0('0x44')]=_['keys'](_0x94989[_0x1bd0('0x44')]);_0x3012a3[_0x1bd0('0x45')]=_[_0x1bd0('0x46')](_0x3012a3['model'],_0x3012a3[_0x1bd0('0x44')]);_0x1263fb['attributes']=_['intersection'](_0x3012a3[_0x1bd0('0x43')],qs[_0x1bd0('0x58')](_0x94989[_0x1bd0('0x44')][_0x1bd0('0x58')]));_0x1263fb['attributes']=_0x1263fb[_0x1bd0('0x47')][_0x1bd0('0x48')]?_0x1263fb[_0x1bd0('0x47')]:_0x3012a3[_0x1bd0('0x43')];if(_0x94989[_0x1bd0('0x44')][_0x1bd0('0x59')]){_0x1263fb['include']=[{'all':!![]}];}_0x1263fb=_[_0x1bd0('0x51')]({},_0x1263fb,_0x94989[_0x1bd0('0x52')]);return db[_0x1bd0('0x3f')][_0x1bd0('0x5a')](_0x1263fb)[_0x1bd0('0x24')](handleEntityNotFound(_0x49c6e4,null))['then'](respondWithResult(_0x49c6e4,null))[_0x1bd0('0x5b')](handleError(_0x49c6e4,null));};exports[_0x1bd0('0x5c')]=function(_0x5b840c,_0x4de65e){return db[_0x1bd0('0x3f')][_0x1bd0('0x5c')](_0x5b840c[_0x1bd0('0x5d')],{})[_0x1bd0('0x24')](function(_0x1dca76){var _0x261aca=_0x5b840c[_0x1bd0('0x5e')][_0x1bd0('0x37')]({'plain':!![]});if(!_0x261aca)throw new Error(_0x1bd0('0x5f'));if(_0x261aca[_0x1bd0('0x60')]===_0x1bd0('0x5e')){var _0x54c6be=_0x1dca76[_0x1bd0('0x37')]({'plain':!![]});var _0x24f2a4=_0x1bd0('0x38');return db['UserProfileSection'][_0x1bd0('0x5a')]({'where':{'name':_0x24f2a4,'userProfileId':_0x261aca['userProfileId']},'raw':!![]})[_0x1bd0('0x24')](function(_0x4d22a0){if(_0x4d22a0&&_0x4d22a0['autoAssociation']===0x0){return db[_0x1bd0('0x39')][_0x1bd0('0x5c')]({'name':_0x54c6be['name'],'resourceId':_0x54c6be['id'],'type':_0x4d22a0[_0x1bd0('0x3b')],'sectionId':_0x4d22a0['id']},{})[_0x1bd0('0x24')](function(){return _0x1dca76;});}else{return _0x1dca76;}})[_0x1bd0('0x5b')](function(_0x23275e){logger[_0x1bd0('0x29')](_0x1bd0('0x61'),_0x23275e);throw _0x23275e;});}return _0x1dca76;})[_0x1bd0('0x24')](respondWithResult(_0x4de65e,0xc9))[_0x1bd0('0x5b')](handleError(_0x4de65e,null));};exports['update']=function(_0x50a614,_0x3ccd5d){if(_0x50a614['body']['id']){delete _0x50a614[_0x1bd0('0x5d')]['id'];}return db[_0x1bd0('0x3f')]['find']({'where':{'id':_0x50a614[_0x1bd0('0x56')]['id']}})[_0x1bd0('0x24')](handleEntityNotFound(_0x3ccd5d,null))['then'](saveUpdates(_0x50a614[_0x1bd0('0x5d')],null))[_0x1bd0('0x24')](respondWithResult(_0x3ccd5d,null))[_0x1bd0('0x5b')](handleError(_0x3ccd5d,null));};exports['destroy']=function(_0x28a4e9,_0x5ed2f2){return db[_0x1bd0('0x3f')][_0x1bd0('0x5a')]({'where':{'id':_0x28a4e9[_0x1bd0('0x56')]['id']}})[_0x1bd0('0x24')](handleEntityNotFound(_0x5ed2f2,null))[_0x1bd0('0x24')](removeEntity(_0x5ed2f2,null))[_0x1bd0('0x5b')](handleError(_0x5ed2f2,null));};exports['describe']=function(_0x57a894,_0x115c23){return db['ChatQueue'][_0x1bd0('0x62')]()[_0x1bd0('0x24')](respondWithResult(_0x115c23,null))[_0x1bd0('0x5b')](handleError(_0x115c23,null));};exports[_0x1bd0('0x63')]=function(_0x47452d,_0x3262da,_0x25116c){var _0x335cc3={'raw':!![],'where':{}},_0x4732b9={},_0x19f5b;return db[_0x1bd0('0x3f')][_0x1bd0('0x64')]({'where':{'id':_0x47452d[_0x1bd0('0x56')]['id']}})[_0x1bd0('0x24')](handleEntityNotFound(_0x3262da,null))[_0x1bd0('0x24')](function(_0x5b88c3){if(_0x5b88c3){_0x19f5b=_0x5b88c3[_0x1bd0('0x37')]({'plain':!![]});_0x4732b9[_0x1bd0('0x43')]=_[_0x1bd0('0x65')](db['UserChatQueue']['rawAttributes']);_0x4732b9[_0x1bd0('0x44')]=_[_0x1bd0('0x65')](_0x47452d[_0x1bd0('0x44')]);_0x4732b9['filters']=_[_0x1bd0('0x46')](_0x4732b9[_0x1bd0('0x43')],_0x4732b9[_0x1bd0('0x44')]);_0x335cc3['attributes']=_['intersection'](_0x4732b9[_0x1bd0('0x43')],qs[_0x1bd0('0x58')](_0x47452d[_0x1bd0('0x44')][_0x1bd0('0x58')]));_0x335cc3['attributes']=_0x335cc3[_0x1bd0('0x47')][_0x1bd0('0x48')]?_0x335cc3['attributes']:_0x4732b9[_0x1bd0('0x43')];if(!_0x47452d[_0x1bd0('0x44')][_0x1bd0('0x66')]('nolimit')){_0x335cc3[_0x1bd0('0x4a')]=qs[_0x1bd0('0x4a')](_0x47452d['query'][_0x1bd0('0x4a')]);_0x335cc3[_0x1bd0('0x32')]=qs[_0x1bd0('0x32')](_0x47452d[_0x1bd0('0x44')][_0x1bd0('0x32')]);}_0x335cc3[_0x1bd0('0x4b')]=qs['sort'](_0x47452d[_0x1bd0('0x44')][_0x1bd0('0x4c')]);_0x335cc3[_0x1bd0('0x4d')]=qs[_0x1bd0('0x45')](_[_0x1bd0('0x4e')](_0x47452d[_0x1bd0('0x44')],_0x4732b9[_0x1bd0('0x45')]));_0x335cc3[_0x1bd0('0x4d')][_0x1bd0('0x67')]=_0x5b88c3['id'];if(_0x47452d[_0x1bd0('0x44')][_0x1bd0('0x4f')]){_0x335cc3[_0x1bd0('0x4d')]=_[_0x1bd0('0x51')](_0x335cc3[_0x1bd0('0x4d')],{'$or':_[_0x1bd0('0x3e')](_0x335cc3[_0x1bd0('0x47')],function(_0x5f1e3a){var _0x5bb2f5={};_0x5bb2f5[_0x5f1e3a]={'$like':'%'+_0x47452d['query'][_0x1bd0('0x4f')]+'%'};return _0x5bb2f5;})});}_0x335cc3=_['merge']({},_0x335cc3,_0x47452d[_0x1bd0('0x52')]);return db[_0x1bd0('0x68')][_0x1bd0('0x53')](_0x335cc3);}})[_0x1bd0('0x24')](function(_0x11a1c1){if(_0x11a1c1){return db['User'][_0x1bd0('0x69')]({'where':{'id':_[_0x1bd0('0x3e')](_0x11a1c1,_0x1bd0('0x6a')),'role':'agent'},'attributes':['id',_0x1bd0('0x3b'),_0x1bd0('0x6b'),'updatedAt','createdAt']});}})[_0x1bd0('0x24')](function(_0x410f52){if(_0x410f52){return{'count':_0x410f52[_0x1bd0('0x31')],'rows':_[_0x1bd0('0x3e')](_0x410f52[_0x1bd0('0x54')],function(_0x3258bd){return{'membername':_0x3258bd['name'],'UserId':_0x3258bd['id'],'queue_name':_0x19f5b[_0x1bd0('0x3b')],'ChatQueueId':_0x19f5b['id'],'interface':util[_0x1bd0('0x6c')]('%s/%s',_0x1bd0('0x6d'),_0x3258bd[_0x1bd0('0x3b')]),'penalty':0x0,'paused':_0x3258bd[_0x1bd0('0x6b')],'createdAt':_0x3258bd['createdAt'],'updatedAt':_0x3258bd[_0x1bd0('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1bd0('0x24')](respondWithFilteredResult(_0x3262da,_0x335cc3))['catch'](handleError(_0x3262da,null));};exports['getTeams']=function(_0x5e0217,_0x1819a9,_0x1d1ba2){var _0x23c168={};var _0x3f04eb={};var _0x5d692c;var _0x4d2813;return db['ChatQueue'][_0x1bd0('0x64')]({'where':{'id':_0x5e0217['params']['id']}})[_0x1bd0('0x24')](handleEntityNotFound(_0x1819a9,null))['then'](function(_0x3cd69b){if(_0x3cd69b){_0x5d692c=_0x3cd69b;_0x3f04eb[_0x1bd0('0x43')]=_[_0x1bd0('0x65')](db[_0x1bd0('0x6f')][_0x1bd0('0x57')]);_0x3f04eb[_0x1bd0('0x44')]=_[_0x1bd0('0x65')](_0x5e0217['query']);_0x3f04eb[_0x1bd0('0x45')]=_[_0x1bd0('0x46')](_0x3f04eb[_0x1bd0('0x43')],_0x3f04eb['query']);_0x23c168[_0x1bd0('0x47')]=_[_0x1bd0('0x46')](_0x3f04eb[_0x1bd0('0x43')],qs['fields'](_0x5e0217[_0x1bd0('0x44')][_0x1bd0('0x58')]));_0x23c168[_0x1bd0('0x47')]=_0x23c168['attributes'][_0x1bd0('0x48')]?_0x23c168['attributes']:_0x3f04eb[_0x1bd0('0x43')];_0x23c168['order']=qs[_0x1bd0('0x4c')](_0x5e0217[_0x1bd0('0x44')][_0x1bd0('0x4c')]);_0x23c168[_0x1bd0('0x4d')]=qs[_0x1bd0('0x45')](_[_0x1bd0('0x4e')](_0x5e0217[_0x1bd0('0x44')],_0x3f04eb['filters']));if(_0x5e0217[_0x1bd0('0x44')][_0x1bd0('0x4f')]){_0x23c168[_0x1bd0('0x4d')]=_[_0x1bd0('0x51')](_0x23c168['where'],{'$or':_[_0x1bd0('0x3e')](_0x23c168[_0x1bd0('0x47')],function(_0x2c9e1f){var _0x549b47={};_0x549b47[_0x2c9e1f]={'$like':'%'+_0x5e0217['query']['filter']+'%'};return _0x549b47;})});}_0x23c168=_[_0x1bd0('0x51')]({},_0x23c168,_0x5e0217['options']);return _0x5d692c[_0x1bd0('0x70')](_0x23c168);}})['then'](function(_0x130633){if(_0x130633){_0x4d2813=_0x130633[_0x1bd0('0x48')];if(!_0x5e0217[_0x1bd0('0x44')][_0x1bd0('0x66')](_0x1bd0('0x49'))){_0x23c168['limit']=qs['limit'](_0x5e0217[_0x1bd0('0x44')][_0x1bd0('0x4a')]);_0x23c168[_0x1bd0('0x32')]=qs['offset'](_0x5e0217['query']['offset']);}return _0x5d692c['getTeams'](_0x23c168);}})[_0x1bd0('0x24')](function(_0x2ae2f8){if(_0x2ae2f8){return _0x2ae2f8?{'count':_0x4d2813,'rows':_0x2ae2f8}:null;}})[_0x1bd0('0x24')](respondWithResult(_0x1819a9,null))[_0x1bd0('0x5b')](handleError(_0x1819a9,null));};exports[_0x1bd0('0x71')]=function(_0x25a2ef,_0x33df72,_0x47a310){var _0x3151f3=_0x25a2ef[_0x1bd0('0x5d')][_0x1bd0('0x72')];return db[_0x1bd0('0x6f')][_0x1bd0('0x53')]({'where':{'id':_0x3151f3},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1bd0('0x73'),'attributes':['id','name',_0x1bd0('0x74'),'voicePause',_0x1bd0('0x75')],'raw':!![]}]})[_0x1bd0('0x24')](function(_0x174c24){if(_0x174c24){var _0x228c76=_[_0x1bd0('0x76')](_0x174c24,function(_0x3174ed){var _0x4e096e=_0x3174ed[_0x1bd0('0x37')]({'plain':!![]});return _0x4e096e[_0x1bd0('0x73')];});return db[_0x1bd0('0x3f')]['find']({'where':{'id':_0x25a2ef[_0x1bd0('0x56')]['id']}})[_0x1bd0('0x24')](function(_0x1046ee){return db[_0x1bd0('0x77')][_0x1bd0('0x78')](function(_0x4ef841){return _0x1046ee[_0x1bd0('0x71')](_0x3151f3,{'transaction':_0x4ef841})[_0x1bd0('0x24')](function(){return BPromise['each'](_0x228c76,function(_0xc24b8f){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0xc24b8f['id'],'ChatQueueId':_0x25a2ef[_0x1bd0('0x56')]['id']},'transaction':_0x4ef841});});})[_0x1bd0('0x24')](function(){_0x228c76['forEach'](function(_0x3a95db){socket['emit'](_0x1bd0('0x79'),{'UserId':_0x3a95db['id'],'ChatQueueId':_0x1046ee['id']});});});});});}})[_0x1bd0('0x24')](respondWithStatusCode(_0x33df72,null))[_0x1bd0('0x5b')](handleError(_0x33df72,null));};exports[_0x1bd0('0x7a')]=function(_0x130f17,_0x4a083c,_0x937b1a){return db['Team'][_0x1bd0('0x53')]({'where':{'id':_0x130f17[_0x1bd0('0x44')][_0x1bd0('0x72')]},'attributes':['id'],'include':[{'model':db[_0x1bd0('0x7b')],'as':_0x1bd0('0x73'),'attributes':['id'],'raw':!![]}]})[_0x1bd0('0x24')](handleEntityNotFound(_0x4a083c,null))[_0x1bd0('0x24')](function(_0x2920ba){var _0x527365=_[_0x1bd0('0x3e')](_0x2920ba,'id');var _0x21cf73=[];var _0x30a493=[];var _0x266fb8=squel['select']();_0x266fb8['field'](_0x1bd0('0x7c'))[_0x1bd0('0x7d')](_0x1bd0('0x7e'),'tq')['join'](_0x1bd0('0x7f'),'ut',_0x1bd0('0x80'))[_0x1bd0('0x4d')](_0x1bd0('0x81'),_0x130f17[_0x1bd0('0x56')]['id']);for(var _0x58c971=0x0;_0x58c971<_0x2920ba['length'];_0x58c971+=0x1){let _0x1f5306=_0x2920ba[_0x58c971];for(var _0xfaaff1=0x0;_0xfaaff1<_0x1f5306[_0x1bd0('0x73')][_0x1bd0('0x48')];_0xfaaff1+=0x1){let _0x2b4190=_0x1f5306[_0x1bd0('0x73')][_0xfaaff1];var _0xe29fb2=_0x266fb8[_0x1bd0('0x82')]();_0xe29fb2[_0x1bd0('0x4d')]('ut.UserId\x20=\x20?',_0x2b4190['id']);_0x30a493['push'](db[_0x1bd0('0x77')][_0x1bd0('0x44')](_0xe29fb2[_0x1bd0('0x83')](),{'type':db[_0x1bd0('0x77')][_0x1bd0('0x84')][_0x1bd0('0x85')]})[_0x1bd0('0x24')](function(_0x3d426b){if(_0x3d426b[_0x1bd0('0x48')]===0x1){return _0x2b4190['id'];}else{var _0x265417=_[_0x1bd0('0x86')](_['map'](_0x3d426b,_0x1bd0('0x87')),function(_0x2b7449){return _[_0x1bd0('0x88')](_0x527365,_0x2b7449);});if(_0x265417){return _0x2b4190['id'];}}}));}}return BPromise[_0x1bd0('0x89')](_0x30a493)[_0x1bd0('0x24')](function(_0x5afa1b){_0x21cf73=_(_0x21cf73)[_0x1bd0('0x8a')](_0x5afa1b)[_0x1bd0('0x8b')]()[_0x1bd0('0x8c')]();return db[_0x1bd0('0x3f')]['find']({'where':{'id':_0x130f17[_0x1bd0('0x56')]['id']}})[_0x1bd0('0x24')](function(_0x585f73){return db[_0x1bd0('0x77')][_0x1bd0('0x78')](function(_0x2be27f){return _0x585f73[_0x1bd0('0x7a')](_0x130f17[_0x1bd0('0x44')]['ids'],{'transaction':_0x2be27f})[_0x1bd0('0x24')](function(){if(!_[_0x1bd0('0x8d')](_0x21cf73)){return _0x585f73[_0x1bd0('0x8e')](_0x21cf73,{'transaction':_0x2be27f});}})[_0x1bd0('0x24')](function(){_0x21cf73[_0x1bd0('0x8f')](function(_0x2cd101){socket[_0x1bd0('0x90')](_0x1bd0('0x91'),{'UserId':_0x2cd101,'ChatQueueId':_0x585f73['id']});});});});});});})[_0x1bd0('0x24')](respondWithStatusCode(_0x4a083c,null))[_0x1bd0('0x5b')](handleError(_0x4a083c,null));};exports[_0x1bd0('0x92')]=function(_0x1ca0c9,_0x317b07,_0xecd864){return db[_0x1bd0('0x3f')][_0x1bd0('0x5a')]({'where':{'id':_0x1ca0c9[_0x1bd0('0x56')]['id']}})['then'](handleEntityNotFound(_0x317b07,null))[_0x1bd0('0x24')](function(_0x5383b3){if(_0x5383b3){return _0x5383b3[_0x1bd0('0x92')](_0x1ca0c9['body'][_0x1bd0('0x72')],_[_0x1bd0('0x93')](_0x1ca0c9[_0x1bd0('0x5d')],[_0x1bd0('0x72'),'id'])||{})[_0x1bd0('0x94')](function(_0x76965d){for(var _0x330ca9=0x0;_0x330ca9<_0x1ca0c9[_0x1bd0('0x5d')][_0x1bd0('0x72')][_0x1bd0('0x48')];_0x330ca9+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x1ca0c9[_0x1bd0('0x5d')][_0x1bd0('0x72')][_0x330ca9],'ChatQueueId':_0x1ca0c9[_0x1bd0('0x56')]['id']});}return _0x76965d;});}})['then'](respondWithResult(_0x317b07,null))[_0x1bd0('0x5b')](handleError(_0x317b07,null));};exports['removeAgents']=function(_0x17160d,_0x3d6d8e,_0xba041d){return db[_0x1bd0('0x3f')]['find']({'where':{'id':_0x17160d[_0x1bd0('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d6d8e,null))[_0x1bd0('0x24')](function(_0x2f6a2f){if(_0x2f6a2f){return _0x2f6a2f[_0x1bd0('0x8e')](_0x17160d[_0x1bd0('0x44')][_0x1bd0('0x72')])[_0x1bd0('0x24')](function(){if(_[_0x1bd0('0x95')](_0x17160d[_0x1bd0('0x44')]['ids'])){for(var _0x34bca5=0x0;_0x34bca5<_0x17160d[_0x1bd0('0x44')][_0x1bd0('0x72')][_0x1bd0('0x48')];_0x34bca5+=0x1){socket[_0x1bd0('0x90')](_0x1bd0('0x91'),{'UserId':Number(_0x17160d['query'][_0x1bd0('0x72')][_0x34bca5]),'ChatQueueId':Number(_0x17160d['params']['id'])});}}else{socket[_0x1bd0('0x90')](_0x1bd0('0x91'),{'UserId':Number(_0x17160d[_0x1bd0('0x44')]['ids']),'ChatQueueId':Number(_0x17160d[_0x1bd0('0x56')]['id'])});}});}})[_0x1bd0('0x24')](respondWithStatusCode(_0x3d6d8e,null))['catch'](handleError(_0x3d6d8e,null));};exports[_0x1bd0('0x96')]=function(_0x4eca83,_0x82298a,_0x33d9be){var _0x535a7a={};var _0x2450ec={};var _0x4e2b8c;var _0x24d5c8;return db[_0x1bd0('0x3f')][_0x1bd0('0x64')]({'where':{'id':_0x4eca83[_0x1bd0('0x56')]['id']}})['then'](handleEntityNotFound(_0x82298a,null))[_0x1bd0('0x24')](function(_0x554928){if(_0x554928){_0x4e2b8c=_0x554928;_0x2450ec[_0x1bd0('0x43')]=_['keys'](db['User'][_0x1bd0('0x57')]);_0x2450ec['query']=_[_0x1bd0('0x65')](_0x4eca83['query']);_0x2450ec[_0x1bd0('0x45')]=_['intersection'](_0x2450ec[_0x1bd0('0x43')],_0x2450ec['query']);_0x535a7a['attributes']=_[_0x1bd0('0x46')](_0x2450ec[_0x1bd0('0x43')],qs[_0x1bd0('0x58')](_0x4eca83[_0x1bd0('0x44')][_0x1bd0('0x58')]));_0x535a7a[_0x1bd0('0x47')]=_0x535a7a[_0x1bd0('0x47')]['length']?_0x535a7a[_0x1bd0('0x47')]:_0x2450ec[_0x1bd0('0x43')];_0x535a7a['order']=qs[_0x1bd0('0x4c')](_0x4eca83[_0x1bd0('0x44')]['sort']);_0x535a7a[_0x1bd0('0x4d')]=qs[_0x1bd0('0x45')](_[_0x1bd0('0x4e')](_0x4eca83[_0x1bd0('0x44')],_0x2450ec[_0x1bd0('0x45')]));if(_0x4eca83[_0x1bd0('0x44')][_0x1bd0('0x4f')]){_0x535a7a['where']=_[_0x1bd0('0x51')](_0x535a7a['where'],{'$or':_['map'](_0x535a7a[_0x1bd0('0x47')],function(_0x393dfd){var _0x11a2b3={};_0x11a2b3[_0x393dfd]={'$like':'%'+_0x4eca83['query'][_0x1bd0('0x4f')]+'%'};return _0x11a2b3;})});}_0x535a7a=_['merge']({},_0x535a7a,_0x4eca83['options']);return _0x4e2b8c[_0x1bd0('0x96')](_0x535a7a);}})['then'](function(_0x496ab9){if(_0x496ab9){_0x24d5c8=_0x496ab9[_0x1bd0('0x48')];if(!_0x4eca83[_0x1bd0('0x44')][_0x1bd0('0x66')](_0x1bd0('0x49'))){_0x535a7a[_0x1bd0('0x4a')]=qs[_0x1bd0('0x4a')](_0x4eca83[_0x1bd0('0x44')]['limit']);_0x535a7a['offset']=qs[_0x1bd0('0x32')](_0x4eca83['query']['offset']);}return _0x4e2b8c['getAgents'](_0x535a7a);}})[_0x1bd0('0x24')](function(_0x154915){if(_0x154915){return _0x154915?{'count':_0x24d5c8,'rows':_0x154915}:null;}})['then'](respondWithResult(_0x82298a,null))[_0x1bd0('0x5b')](handleError(_0x82298a,null));}; \ No newline at end of file +var _0x5060=['role','UserProfileSection','find','userProfileId','update','body','params','describe','getMembers','findOne','UserChatQueue','nolimit','sort','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','union','compact','value','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','ChatQueue','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','map','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0x5060,0x169));var _0x0506=function(_0xe18ab7,_0x95a601){_0xe18ab7=_0xe18ab7-0x0;var _0x531ce5=_0x5060[_0xe18ab7];return _0x531ce5;};'use strict';var pdf=require(_0x0506('0x0'));var emlformat=require(_0x0506('0x1'));var rimraf=require(_0x0506('0x2'));var zipdir=require(_0x0506('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0506('0x4'));var moment=require(_0x0506('0x5'));var BPromise=require(_0x0506('0x6'));var Mustache=require('mustache');var util=require(_0x0506('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0506('0x8'));var squel=require(_0x0506('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0506('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0506('0xb'));var Redis=require('ioredis');var authService=require(_0x0506('0xc'));var qs=require(_0x0506('0xd'));var as=require(_0x0506('0xe'));var hardwareService=require(_0x0506('0xf'));var logger=require(_0x0506('0x10'))('api');var utils=require(_0x0506('0x11'));var config=require(_0x0506('0x12'));var licenseUtil=require(_0x0506('0x13'));var db=require(_0x0506('0x14'))['db'];config[_0x0506('0x15')]=_['defaults'](config['redis'],{'host':_0x0506('0x16'),'port':0x18eb});var socket=require(_0x0506('0x17'))(new Redis(config[_0x0506('0x15')]));require(_0x0506('0x18'))[_0x0506('0x19')](socket);var jayson=require(_0x0506('0x1a'));var client=jayson[_0x0506('0x1b')][_0x0506('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x47361e,_0x149587,_0x44e01d,_0x501210){return new BPromise(function(_0x311c30,_0x2bee9b){var _0x37c07b=_0x501210||client;return _0x37c07b[_0x0506('0x1d')](_0x47361e,_0x44e01d)[_0x0506('0x1e')](function(_0x4946fa){logger[_0x0506('0x1f')](_0x0506('0x20'),_0x149587,_0x0506('0x21'));logger[_0x0506('0x22')](_0x0506('0x23'),_0x149587,'request\x20sent',JSON['stringify'](_0x4946fa));if(_0x4946fa[_0x0506('0x24')]){if(_0x4946fa['error'][_0x0506('0x25')]===0x1f4){logger[_0x0506('0x24')](_0x0506('0x20'),_0x149587,_0x4946fa[_0x0506('0x24')]['message']);return _0x2bee9b(_0x4946fa[_0x0506('0x24')][_0x0506('0x26')]);}logger[_0x0506('0x24')]('ChatQueue,\x20%s,\x20%s',_0x149587,_0x4946fa['error'][_0x0506('0x26')]);return _0x311c30(_0x4946fa[_0x0506('0x24')]['message']);}else{logger[_0x0506('0x1f')](_0x0506('0x20'),_0x149587,_0x0506('0x21'));_0x311c30(_0x4946fa[_0x0506('0x27')]['message']);}})['catch'](function(_0x534675){logger[_0x0506('0x24')]('ChatQueue,\x20%s,\x20%s',_0x149587,_0x534675);_0x2bee9b(_0x534675);});});}function respondWithStatusCode(_0x1604f9,_0x1e7fa6){_0x1e7fa6=_0x1e7fa6||0xcc;return function(_0x58670e){if(_0x58670e){return _0x1604f9[_0x0506('0x28')](_0x1e7fa6);}return _0x1604f9['status'](_0x1e7fa6)['end']();};}function respondWithResult(_0x5b029c,_0x2cb193){_0x2cb193=_0x2cb193||0xc8;return function(_0x579cb9){if(_0x579cb9){return _0x5b029c[_0x0506('0x29')](_0x2cb193)['json'](_0x579cb9);}};}function respondWithFilteredResult(_0x409e12,_0x5546c0){return function(_0x2ca5ca){if(_0x2ca5ca){var _0x4955e6=_0x2ca5ca[_0x0506('0x2a')],_0x5de14c=_0x5546c0['offset'],_0x3d9b6a=_0x5546c0[_0x0506('0x2b')]+_0x5546c0[_0x0506('0x2c')],_0x38e40b;if(_0x3d9b6a>=_0x4955e6){_0x3d9b6a=_0x4955e6;_0x38e40b=0xc8;}else{_0x38e40b=0xce;}_0x409e12[_0x0506('0x29')](_0x38e40b);return _0x409e12[_0x0506('0x2d')](_0x0506('0x2e'),_0x5de14c+'-'+_0x3d9b6a+'/'+_0x4955e6)['json'](_0x2ca5ca);}return null;};}function patchUpdates(_0x25faa5){return function(_0x183a6b){try{jsonpatch[_0x0506('0x2f')](_0x183a6b,_0x25faa5,!![]);}catch(_0x12d854){return BPromise[_0x0506('0x30')](_0x12d854);}return _0x183a6b[_0x0506('0x31')]();};}function saveUpdates(_0x4e5111,_0x38d5f0){return function(_0x56ee6f){if(_0x56ee6f){return _0x56ee6f['update'](_0x4e5111)[_0x0506('0x1e')](function(_0x58b7c0){return _0x58b7c0;});}return null;};}function removeEntity(_0x8f39dc,_0x4ed590){return function(_0x228445){if(_0x228445){return _0x228445[_0x0506('0x32')]()[_0x0506('0x1e')](function(){var _0x480614=_0x228445[_0x0506('0x33')]({'plain':!![]});var _0x58d423=_0x0506('0x34');return db[_0x0506('0x35')]['destroy']({'where':{'type':_0x58d423,'resourceId':_0x480614['id']}})['then'](function(){return _0x228445;});})[_0x0506('0x1e')](function(){_0x8f39dc[_0x0506('0x29')](0xcc)[_0x0506('0x36')]();});}};}function handleEntityNotFound(_0x1f0d5e,_0x894883){return function(_0xbefee7){if(!_0xbefee7){_0x1f0d5e['sendStatus'](0x194);}return _0xbefee7;};}function handleError(_0x40376d,_0x23cd07){_0x23cd07=_0x23cd07||0x1f4;return function(_0x292fbe){logger[_0x0506('0x24')](_0x292fbe[_0x0506('0x37')]);if(_0x292fbe[_0x0506('0x38')]){delete _0x292fbe[_0x0506('0x38')];}_0x40376d[_0x0506('0x29')](_0x23cd07)[_0x0506('0x39')](_0x292fbe);};}exports[_0x0506('0x3a')]=function(_0x2e61f0,_0x54e9eb){var _0x3a89f9={},_0x58e89a={},_0x88227f={'count':0x0,'rows':[]};var _0x238ebf=_['map'](db[_0x0506('0x3b')][_0x0506('0x3c')],function(_0x14cf35){return{'name':_0x14cf35[_0x0506('0x3d')],'type':_0x14cf35[_0x0506('0x3e')]['key']};});_0x58e89a[_0x0506('0x3f')]=_['map'](_0x238ebf,_0x0506('0x38'));_0x58e89a[_0x0506('0x40')]=_[_0x0506('0x41')](_0x2e61f0[_0x0506('0x40')]);_0x58e89a['filters']=_[_0x0506('0x42')](_0x58e89a[_0x0506('0x3f')],_0x58e89a[_0x0506('0x40')]);_0x3a89f9[_0x0506('0x43')]=_[_0x0506('0x42')](_0x58e89a[_0x0506('0x3f')],qs[_0x0506('0x44')](_0x2e61f0[_0x0506('0x40')][_0x0506('0x44')]));_0x3a89f9[_0x0506('0x43')]=_0x3a89f9['attributes'][_0x0506('0x45')]?_0x3a89f9[_0x0506('0x43')]:_0x58e89a['model'];if(!_0x2e61f0['query'][_0x0506('0x46')]('nolimit')){_0x3a89f9['limit']=qs[_0x0506('0x2c')](_0x2e61f0[_0x0506('0x40')][_0x0506('0x2c')]);_0x3a89f9['offset']=qs[_0x0506('0x2b')](_0x2e61f0[_0x0506('0x40')][_0x0506('0x2b')]);}_0x3a89f9[_0x0506('0x47')]=qs['sort'](_0x2e61f0[_0x0506('0x40')]['sort']);_0x3a89f9[_0x0506('0x48')]=qs[_0x0506('0x49')](_[_0x0506('0x4a')](_0x2e61f0[_0x0506('0x40')],_0x58e89a[_0x0506('0x49')]),_0x238ebf);if(_0x2e61f0[_0x0506('0x40')][_0x0506('0x4b')]){_0x3a89f9[_0x0506('0x48')]=_[_0x0506('0x4c')](_0x3a89f9[_0x0506('0x48')],{'$or':_[_0x0506('0x4d')](_0x238ebf,function(_0x438798){if(_0x438798['type']!==_0x0506('0x4e')){var _0x1ee818={};_0x1ee818[_0x438798['name']]={'$like':'%'+_0x2e61f0[_0x0506('0x40')][_0x0506('0x4b')]+'%'};return _0x1ee818;}})});}_0x3a89f9=_['merge']({},_0x3a89f9,_0x2e61f0['options']);var _0x13fa83={'where':_0x3a89f9[_0x0506('0x48')]};return db[_0x0506('0x3b')][_0x0506('0x2a')](_0x13fa83)[_0x0506('0x1e')](function(_0x46c3e){_0x88227f[_0x0506('0x2a')]=_0x46c3e;if(_0x2e61f0[_0x0506('0x40')]['includeAll']){_0x3a89f9[_0x0506('0x4f')]=[{'all':!![]}];}return db[_0x0506('0x3b')][_0x0506('0x50')](_0x3a89f9);})['then'](function(_0x4a5706){_0x88227f[_0x0506('0x51')]=_0x4a5706;return _0x88227f;})[_0x0506('0x1e')](respondWithFilteredResult(_0x54e9eb,_0x3a89f9))[_0x0506('0x52')](handleError(_0x54e9eb,null));};exports[_0x0506('0x53')]=function(_0x18efd0,_0x1062cb){var _0x4b6fe={'raw':!![],'where':{'id':_0x18efd0['params']['id']}},_0x2ea1b7={};_0x2ea1b7[_0x0506('0x3f')]=_['keys'](db[_0x0506('0x3b')]['rawAttributes']);_0x2ea1b7[_0x0506('0x40')]=_['keys'](_0x18efd0['query']);_0x2ea1b7[_0x0506('0x49')]=_[_0x0506('0x42')](_0x2ea1b7['model'],_0x2ea1b7[_0x0506('0x40')]);_0x4b6fe['attributes']=_[_0x0506('0x42')](_0x2ea1b7['model'],qs[_0x0506('0x44')](_0x18efd0[_0x0506('0x40')]['fields']));_0x4b6fe[_0x0506('0x43')]=_0x4b6fe[_0x0506('0x43')][_0x0506('0x45')]?_0x4b6fe['attributes']:_0x2ea1b7['model'];if(_0x18efd0['query'][_0x0506('0x54')]){_0x4b6fe[_0x0506('0x4f')]=[{'all':!![]}];}_0x4b6fe=_[_0x0506('0x4c')]({},_0x4b6fe,_0x18efd0[_0x0506('0x55')]);return db[_0x0506('0x3b')]['find'](_0x4b6fe)[_0x0506('0x1e')](handleEntityNotFound(_0x1062cb,null))[_0x0506('0x1e')](respondWithResult(_0x1062cb,null))[_0x0506('0x52')](handleError(_0x1062cb,null));};exports['create']=function(_0x2e7d15,_0x2a50dc){return db[_0x0506('0x3b')][_0x0506('0x56')](_0x2e7d15['body'],{})[_0x0506('0x1e')](function(_0x4320e8){var _0x57a47f=_0x2e7d15[_0x0506('0x57')][_0x0506('0x33')]({'plain':!![]});if(!_0x57a47f)throw new Error(_0x0506('0x58'));if(_0x57a47f[_0x0506('0x59')]===_0x0506('0x57')){var _0x306270=_0x4320e8[_0x0506('0x33')]({'plain':!![]});var _0x1376db=_0x0506('0x34');return db[_0x0506('0x5a')][_0x0506('0x5b')]({'where':{'name':_0x1376db,'userProfileId':_0x57a47f[_0x0506('0x5c')]},'raw':!![]})['then'](function(_0x3a6e86){if(_0x3a6e86&&_0x3a6e86['autoAssociation']===0x0){return db['UserProfileResource'][_0x0506('0x56')]({'name':_0x306270['name'],'resourceId':_0x306270['id'],'type':_0x3a6e86[_0x0506('0x38')],'sectionId':_0x3a6e86['id']},{})[_0x0506('0x1e')](function(){return _0x4320e8;});}else{return _0x4320e8;}})['catch'](function(_0x184ece){logger[_0x0506('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x184ece);throw _0x184ece;});}return _0x4320e8;})['then'](respondWithResult(_0x2a50dc,0xc9))[_0x0506('0x52')](handleError(_0x2a50dc,null));};exports[_0x0506('0x5d')]=function(_0x3fbd52,_0x236e30){if(_0x3fbd52[_0x0506('0x5e')]['id']){delete _0x3fbd52[_0x0506('0x5e')]['id'];}return db[_0x0506('0x3b')][_0x0506('0x5b')]({'where':{'id':_0x3fbd52[_0x0506('0x5f')]['id']}})[_0x0506('0x1e')](handleEntityNotFound(_0x236e30,null))[_0x0506('0x1e')](saveUpdates(_0x3fbd52[_0x0506('0x5e')],null))[_0x0506('0x1e')](respondWithResult(_0x236e30,null))[_0x0506('0x52')](handleError(_0x236e30,null));};exports['destroy']=function(_0x53a8ee,_0x1bc8cb){return db[_0x0506('0x3b')]['find']({'where':{'id':_0x53a8ee[_0x0506('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1bc8cb,null))[_0x0506('0x1e')](removeEntity(_0x1bc8cb,null))['catch'](handleError(_0x1bc8cb,null));};exports[_0x0506('0x60')]=function(_0x1d3e4f,_0x5e265c){return db[_0x0506('0x3b')][_0x0506('0x60')]()['then'](respondWithResult(_0x5e265c,null))[_0x0506('0x52')](handleError(_0x5e265c,null));};exports[_0x0506('0x61')]=function(_0x2c24a9,_0x5b76e8,_0x24de22){var _0x4de259={'raw':!![],'where':{}},_0x28b106={},_0x170823;return db['ChatQueue'][_0x0506('0x62')]({'where':{'id':_0x2c24a9['params']['id']}})['then'](handleEntityNotFound(_0x5b76e8,null))['then'](function(_0x390dd2){if(_0x390dd2){_0x170823=_0x390dd2['get']({'plain':!![]});_0x28b106[_0x0506('0x3f')]=_['keys'](db[_0x0506('0x63')][_0x0506('0x3c')]);_0x28b106[_0x0506('0x40')]=_['keys'](_0x2c24a9['query']);_0x28b106['filters']=_[_0x0506('0x42')](_0x28b106[_0x0506('0x3f')],_0x28b106[_0x0506('0x40')]);_0x4de259[_0x0506('0x43')]=_[_0x0506('0x42')](_0x28b106[_0x0506('0x3f')],qs[_0x0506('0x44')](_0x2c24a9[_0x0506('0x40')][_0x0506('0x44')]));_0x4de259[_0x0506('0x43')]=_0x4de259[_0x0506('0x43')]['length']?_0x4de259['attributes']:_0x28b106['model'];if(!_0x2c24a9[_0x0506('0x40')][_0x0506('0x46')](_0x0506('0x64'))){_0x4de259[_0x0506('0x2c')]=qs[_0x0506('0x2c')](_0x2c24a9[_0x0506('0x40')][_0x0506('0x2c')]);_0x4de259[_0x0506('0x2b')]=qs[_0x0506('0x2b')](_0x2c24a9[_0x0506('0x40')][_0x0506('0x2b')]);}_0x4de259[_0x0506('0x47')]=qs['sort'](_0x2c24a9['query'][_0x0506('0x65')]);_0x4de259[_0x0506('0x48')]=qs['filters'](_[_0x0506('0x4a')](_0x2c24a9[_0x0506('0x40')],_0x28b106[_0x0506('0x49')]));_0x4de259['where'][_0x0506('0x66')]=_0x390dd2['id'];if(_0x2c24a9['query'][_0x0506('0x4b')]){_0x4de259[_0x0506('0x48')]=_[_0x0506('0x4c')](_0x4de259[_0x0506('0x48')],{'$or':_['map'](_0x4de259[_0x0506('0x43')],function(_0x9c8757){var _0x492879={};_0x492879[_0x9c8757]={'$like':'%'+_0x2c24a9[_0x0506('0x40')][_0x0506('0x4b')]+'%'};return _0x492879;})});}_0x4de259=_[_0x0506('0x4c')]({},_0x4de259,_0x2c24a9[_0x0506('0x55')]);return db[_0x0506('0x63')][_0x0506('0x50')](_0x4de259);}})['then'](function(_0x74393f){if(_0x74393f){return db[_0x0506('0x67')][_0x0506('0x68')]({'where':{'id':_[_0x0506('0x4d')](_0x74393f,_0x0506('0x69')),'role':_0x0506('0x6a')},'attributes':['id',_0x0506('0x38'),_0x0506('0x6b'),_0x0506('0x6c'),'createdAt']});}})[_0x0506('0x1e')](function(_0x2ff6d1){if(_0x2ff6d1){return{'count':_0x2ff6d1[_0x0506('0x2a')],'rows':_[_0x0506('0x4d')](_0x2ff6d1['rows'],function(_0x30a72e){return{'membername':_0x30a72e[_0x0506('0x38')],'UserId':_0x30a72e['id'],'queue_name':_0x170823['name'],'ChatQueueId':_0x170823['id'],'interface':util[_0x0506('0x6d')](_0x0506('0x6e'),'SIP',_0x30a72e['name']),'penalty':0x0,'paused':_0x30a72e[_0x0506('0x6b')],'createdAt':_0x30a72e['createdAt'],'updatedAt':_0x30a72e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0506('0x1e')](respondWithFilteredResult(_0x5b76e8,_0x4de259))[_0x0506('0x52')](handleError(_0x5b76e8,null));};exports[_0x0506('0x6f')]=function(_0x5a4f01,_0x4cdea9,_0x1cd2b4){var _0x5a0de7={};var _0x317e1f={};var _0x224622;var _0x527685;return db[_0x0506('0x3b')][_0x0506('0x62')]({'where':{'id':_0x5a4f01[_0x0506('0x5f')]['id']}})[_0x0506('0x1e')](handleEntityNotFound(_0x4cdea9,null))[_0x0506('0x1e')](function(_0x190ce8){if(_0x190ce8){_0x224622=_0x190ce8;_0x317e1f['model']=_[_0x0506('0x41')](db[_0x0506('0x70')][_0x0506('0x3c')]);_0x317e1f[_0x0506('0x40')]=_[_0x0506('0x41')](_0x5a4f01[_0x0506('0x40')]);_0x317e1f[_0x0506('0x49')]=_['intersection'](_0x317e1f['model'],_0x317e1f[_0x0506('0x40')]);_0x5a0de7[_0x0506('0x43')]=_[_0x0506('0x42')](_0x317e1f['model'],qs[_0x0506('0x44')](_0x5a4f01[_0x0506('0x40')][_0x0506('0x44')]));_0x5a0de7[_0x0506('0x43')]=_0x5a0de7[_0x0506('0x43')][_0x0506('0x45')]?_0x5a0de7[_0x0506('0x43')]:_0x317e1f[_0x0506('0x3f')];_0x5a0de7[_0x0506('0x47')]=qs[_0x0506('0x65')](_0x5a4f01[_0x0506('0x40')][_0x0506('0x65')]);_0x5a0de7['where']=qs[_0x0506('0x49')](_[_0x0506('0x4a')](_0x5a4f01[_0x0506('0x40')],_0x317e1f['filters']));if(_0x5a4f01[_0x0506('0x40')][_0x0506('0x4b')]){_0x5a0de7[_0x0506('0x48')]=_['merge'](_0x5a0de7['where'],{'$or':_[_0x0506('0x4d')](_0x5a0de7[_0x0506('0x43')],function(_0x5d4d0b){var _0x15fd49={};_0x15fd49[_0x5d4d0b]={'$like':'%'+_0x5a4f01[_0x0506('0x40')][_0x0506('0x4b')]+'%'};return _0x15fd49;})});}_0x5a0de7=_[_0x0506('0x4c')]({},_0x5a0de7,_0x5a4f01[_0x0506('0x55')]);return _0x224622[_0x0506('0x6f')](_0x5a0de7);}})[_0x0506('0x1e')](function(_0x13ab14){if(_0x13ab14){_0x527685=_0x13ab14[_0x0506('0x45')];if(!_0x5a4f01[_0x0506('0x40')][_0x0506('0x46')]('nolimit')){_0x5a0de7['limit']=qs['limit'](_0x5a4f01['query'][_0x0506('0x2c')]);_0x5a0de7['offset']=qs[_0x0506('0x2b')](_0x5a4f01[_0x0506('0x40')][_0x0506('0x2b')]);}return _0x224622[_0x0506('0x6f')](_0x5a0de7);}})[_0x0506('0x1e')](function(_0x929e64){if(_0x929e64){return _0x929e64?{'count':_0x527685,'rows':_0x929e64}:null;}})[_0x0506('0x1e')](respondWithResult(_0x4cdea9,null))[_0x0506('0x52')](handleError(_0x4cdea9,null));};exports[_0x0506('0x71')]=function(_0x3cf792,_0x2e4d59,_0x61f828){var _0x23aa10=_0x3cf792['body'][_0x0506('0x72')];return db[_0x0506('0x70')]['findAll']({'where':{'id':_0x23aa10},'attributes':['id'],'include':[{'model':db[_0x0506('0x67')],'as':_0x0506('0x73'),'attributes':['id',_0x0506('0x38'),_0x0506('0x74'),'voicePause',_0x0506('0x75')],'raw':!![]}]})[_0x0506('0x1e')](function(_0xf7389e){if(_0xf7389e){var _0x2efaa8=_[_0x0506('0x76')](_0xf7389e,function(_0x2428c2){var _0x2bd764=_0x2428c2['get']({'plain':!![]});return _0x2bd764[_0x0506('0x73')];});return db[_0x0506('0x3b')]['find']({'where':{'id':_0x3cf792[_0x0506('0x5f')]['id']}})['then'](function(_0x4607f5){return db[_0x0506('0x77')][_0x0506('0x78')](function(_0x3cadb1){return _0x4607f5['addTeams'](_0x23aa10,{'transaction':_0x3cadb1})[_0x0506('0x1e')](function(){return BPromise[_0x0506('0x79')](_0x2efaa8,function(_0x5e6424){return db['UserChatQueue'][_0x0506('0x7a')]({'where':{'UserId':_0x5e6424['id'],'ChatQueueId':_0x3cf792[_0x0506('0x5f')]['id']},'transaction':_0x3cadb1});});})[_0x0506('0x1e')](function(){_0x2efaa8[_0x0506('0x7b')](function(_0x177a97){socket[_0x0506('0x7c')](_0x0506('0x7d'),{'UserId':_0x177a97['id'],'ChatQueueId':_0x4607f5['id']});});});});});}})[_0x0506('0x1e')](respondWithStatusCode(_0x2e4d59,null))[_0x0506('0x52')](handleError(_0x2e4d59,null));};exports['removeTeams']=function(_0x3f2487,_0x4655bb,_0x25011b){return db[_0x0506('0x70')][_0x0506('0x50')]({'where':{'id':_0x3f2487[_0x0506('0x40')][_0x0506('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0506('0x1e')](handleEntityNotFound(_0x4655bb,null))['then'](function(_0x11be45){var _0x433b12=_['map'](_0x11be45,'id');var _0x5c3799=[];var _0x7a0003=[];var _0xa2f8e=squel[_0x0506('0x7e')]();_0xa2f8e[_0x0506('0x7f')]('tq.TeamId')[_0x0506('0x80')]('team_has_chat_queues','tq')[_0x0506('0x81')](_0x0506('0x82'),'ut',_0x0506('0x83'))['where'](_0x0506('0x84'),_0x3f2487[_0x0506('0x5f')]['id']);for(var _0x5d68cc=0x0;_0x5d68cc<_0x11be45[_0x0506('0x45')];_0x5d68cc+=0x1){let _0x172eb0=_0x11be45[_0x5d68cc];for(var _0x460f3c=0x0;_0x460f3c<_0x172eb0[_0x0506('0x73')][_0x0506('0x45')];_0x460f3c+=0x1){let _0x3e58c9=_0x172eb0[_0x0506('0x73')][_0x460f3c];var _0x1c46fe=_0xa2f8e[_0x0506('0x85')]();_0x1c46fe[_0x0506('0x48')](_0x0506('0x86'),_0x3e58c9['id']);_0x7a0003[_0x0506('0x87')](db[_0x0506('0x77')]['query'](_0x1c46fe['toString'](),{'type':db[_0x0506('0x77')]['QueryTypes'][_0x0506('0x88')]})[_0x0506('0x1e')](function(_0x15cd4a){if(_0x15cd4a['length']===0x1){return _0x3e58c9['id'];}else{var _0x58ea9d=_[_0x0506('0x89')](_[_0x0506('0x4d')](_0x15cd4a,_0x0506('0x8a')),function(_0xd1b21){return _['includes'](_0x433b12,_0xd1b21);});if(_0x58ea9d){return _0x3e58c9['id'];}}}));}}return BPromise['all'](_0x7a0003)[_0x0506('0x1e')](function(_0x1a6c9e){_0x5c3799=_(_0x5c3799)[_0x0506('0x8b')](_0x1a6c9e)[_0x0506('0x8c')]()[_0x0506('0x8d')]();return db[_0x0506('0x3b')]['find']({'where':{'id':_0x3f2487['params']['id']}})[_0x0506('0x1e')](function(_0x570c3a){return db[_0x0506('0x77')][_0x0506('0x78')](function(_0x373439){return _0x570c3a[_0x0506('0x8e')](_0x3f2487[_0x0506('0x40')][_0x0506('0x72')],{'transaction':_0x373439})['then'](function(){if(!_[_0x0506('0x8f')](_0x5c3799)){return _0x570c3a[_0x0506('0x90')](_0x5c3799,{'transaction':_0x373439});}})[_0x0506('0x1e')](function(){_0x5c3799['forEach'](function(_0x1e1f99){socket[_0x0506('0x7c')](_0x0506('0x91'),{'UserId':_0x1e1f99,'ChatQueueId':_0x570c3a['id']});});});});});});})['then'](respondWithStatusCode(_0x4655bb,null))[_0x0506('0x52')](handleError(_0x4655bb,null));};exports[_0x0506('0x92')]=function(_0x5e54ee,_0x2ec007,_0x5be2f4){return db[_0x0506('0x3b')][_0x0506('0x5b')]({'where':{'id':_0x5e54ee['params']['id']}})[_0x0506('0x1e')](handleEntityNotFound(_0x2ec007,null))['then'](function(_0x3990de){if(_0x3990de){return _0x3990de[_0x0506('0x92')](_0x5e54ee[_0x0506('0x5e')]['ids'],_['omit'](_0x5e54ee['body'],['ids','id'])||{})[_0x0506('0x93')](function(_0x4532a2){for(var _0xa2a113=0x0;_0xa2a113<_0x5e54ee['body'][_0x0506('0x72')]['length'];_0xa2a113+=0x1){socket['emit'](_0x0506('0x7d'),{'UserId':_0x5e54ee['body'][_0x0506('0x72')][_0xa2a113],'ChatQueueId':_0x5e54ee[_0x0506('0x5f')]['id']});}return _0x4532a2;});}})[_0x0506('0x1e')](respondWithResult(_0x2ec007,null))[_0x0506('0x52')](handleError(_0x2ec007,null));};exports[_0x0506('0x90')]=function(_0x33bbd9,_0x1483a3,_0x1aca12){return db[_0x0506('0x3b')]['find']({'where':{'id':_0x33bbd9[_0x0506('0x5f')]['id']}})[_0x0506('0x1e')](handleEntityNotFound(_0x1483a3,null))[_0x0506('0x1e')](function(_0x555011){if(_0x555011){return _0x555011[_0x0506('0x90')](_0x33bbd9[_0x0506('0x40')][_0x0506('0x72')])[_0x0506('0x1e')](function(){if(_[_0x0506('0x94')](_0x33bbd9[_0x0506('0x40')][_0x0506('0x72')])){for(var _0x35de52=0x0;_0x35de52<_0x33bbd9[_0x0506('0x40')]['ids'][_0x0506('0x45')];_0x35de52+=0x1){socket[_0x0506('0x7c')](_0x0506('0x91'),{'UserId':Number(_0x33bbd9[_0x0506('0x40')][_0x0506('0x72')][_0x35de52]),'ChatQueueId':Number(_0x33bbd9[_0x0506('0x5f')]['id'])});}}else{socket[_0x0506('0x7c')](_0x0506('0x91'),{'UserId':Number(_0x33bbd9[_0x0506('0x40')][_0x0506('0x72')]),'ChatQueueId':Number(_0x33bbd9[_0x0506('0x5f')]['id'])});}});}})[_0x0506('0x1e')](respondWithStatusCode(_0x1483a3,null))[_0x0506('0x52')](handleError(_0x1483a3,null));};exports['getAgents']=function(_0xee0433,_0x461776,_0x58a897){var _0x521b27={};var _0x18d46d={};var _0x1b3865;var _0x1d187b;return db['ChatQueue'][_0x0506('0x62')]({'where':{'id':_0xee0433[_0x0506('0x5f')]['id']}})[_0x0506('0x1e')](handleEntityNotFound(_0x461776,null))[_0x0506('0x1e')](function(_0x21873b){if(_0x21873b){_0x1b3865=_0x21873b;_0x18d46d[_0x0506('0x3f')]=_[_0x0506('0x41')](db[_0x0506('0x67')][_0x0506('0x3c')]);_0x18d46d[_0x0506('0x40')]=_[_0x0506('0x41')](_0xee0433[_0x0506('0x40')]);_0x18d46d[_0x0506('0x49')]=_[_0x0506('0x42')](_0x18d46d[_0x0506('0x3f')],_0x18d46d[_0x0506('0x40')]);_0x521b27['attributes']=_['intersection'](_0x18d46d['model'],qs[_0x0506('0x44')](_0xee0433[_0x0506('0x40')]['fields']));_0x521b27[_0x0506('0x43')]=_0x521b27[_0x0506('0x43')]['length']?_0x521b27['attributes']:_0x18d46d['model'];_0x521b27['order']=qs[_0x0506('0x65')](_0xee0433[_0x0506('0x40')][_0x0506('0x65')]);_0x521b27['where']=qs['filters'](_['pick'](_0xee0433[_0x0506('0x40')],_0x18d46d['filters']));if(_0xee0433[_0x0506('0x40')][_0x0506('0x4b')]){_0x521b27[_0x0506('0x48')]=_[_0x0506('0x4c')](_0x521b27[_0x0506('0x48')],{'$or':_[_0x0506('0x4d')](_0x521b27['attributes'],function(_0x2daa34){var _0x466a89={};_0x466a89[_0x2daa34]={'$like':'%'+_0xee0433[_0x0506('0x40')][_0x0506('0x4b')]+'%'};return _0x466a89;})});}_0x521b27=_['merge']({},_0x521b27,_0xee0433['options']);return _0x1b3865[_0x0506('0x95')](_0x521b27);}})[_0x0506('0x1e')](function(_0x1550bb){if(_0x1550bb){_0x1d187b=_0x1550bb['length'];if(!_0xee0433[_0x0506('0x40')][_0x0506('0x46')](_0x0506('0x64'))){_0x521b27['limit']=qs['limit'](_0xee0433[_0x0506('0x40')][_0x0506('0x2c')]);_0x521b27['offset']=qs[_0x0506('0x2b')](_0xee0433[_0x0506('0x40')][_0x0506('0x2b')]);}return _0x1b3865[_0x0506('0x95')](_0x521b27);}})[_0x0506('0x1e')](function(_0x120a99){if(_0x120a99){return _0x120a99?{'count':_0x1d187b,'rows':_0x120a99}:null;}})['then'](respondWithResult(_0x461776,null))[_0x0506('0x52')](handleError(_0x461776,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 81bc6e1..b144cd7 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 _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x1807aa,_0xccd2cc){var _0x1b9a83=function(_0x58789c){while(--_0x58789c){_0x1807aa['push'](_0x1807aa['shift']());}};_0x1b9a83(++_0xccd2cc);}(_0x0b0e,0x187));var _0xe0b0=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0x0b0e[_0xdd0313];return _0x2bd7e8;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x5ec659,_0x3eb2c1){var _0x4823c3=function(_0x59b478){while(--_0x59b478){_0x5ec659['push'](_0x5ec659['shift']());}};_0x4823c3(++_0x3eb2c1);}(_0x5f2f,0x73));var _0xf5f2=function(_0xf5fafb,_0xdc4ceb){_0xf5fafb=_0xf5fafb-0x0;var _0x35f5a7=_0x5f2f[_0xf5fafb];return _0x35f5a7;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index fec98d7..27d8c18 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 _0x9e79=['define','ChatQueue','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x4faeb4,_0x3f3a19){var _0x3b00f1=function(_0x52d8ae){while(--_0x52d8ae){_0x4faeb4['push'](_0x4faeb4['shift']());}};_0x3b00f1(++_0x3f3a19);}(_0x9e79,0xbd));var _0x99e7=function(_0x273f1b,_0x22b88f){_0x273f1b=_0x273f1b-0x0;var _0x38aab0=_0x9e79[_0x273f1b];return _0x38aab0;};'use strict';var _=require(_0x99e7('0x0'));var util=require(_0x99e7('0x1'));var logger=require(_0x99e7('0x2'))('api');var moment=require(_0x99e7('0x3'));var BPromise=require(_0x99e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99e7('0x5'));var rimraf=require(_0x99e7('0x6'));var config=require(_0x99e7('0x7'));var attributes=require('./chatQueue.attributes');module[_0x99e7('0x8')]=function(_0x39be82,_0x2f98e6){return _0x39be82[_0x99e7('0x9')](_0x99e7('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a1d=['api','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0x7a1d,0x73));var _0xd7a1=function(_0x1b69aa,_0x5aa147){_0x1b69aa=_0x1b69aa-0x0;var _0x42647d=_0x7a1d[_0x1b69aa];return _0x42647d;};'use strict';var _=require(_0xd7a1('0x0'));var util=require('util');var logger=require(_0xd7a1('0x1'))(_0xd7a1('0x2'));var moment=require(_0xd7a1('0x3'));var BPromise=require(_0xd7a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd7a1('0x5'));var rimraf=require(_0xd7a1('0x6'));var config=require(_0xd7a1('0x7'));var attributes=require(_0xd7a1('0x8'));module[_0xd7a1('0x9')]=function(_0x567763,_0x5872b5){return _0x567763[_0xd7a1('0xa')](_0xd7a1('0xb'),attributes,{'tableName':_0xd7a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 1761657..e1731bb 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 _0x73f5=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','redis','./chatQueue.socket','register','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','find','lodash','util','moment'];(function(_0x2806cd,_0x1a0454){var _0x5bf0f2=function(_0x387bad){while(--_0x387bad){_0x2806cd['push'](_0x2806cd['shift']());}};_0x5bf0f2(++_0x1a0454);}(_0x73f5,0x1cb));var _0x573f=function(_0x3abc2d,_0x38b34f){_0x3abc2d=_0x3abc2d-0x0;var _0x1c876d=_0x73f5[_0x3abc2d];return _0x1c876d;};'use strict';var _=require(_0x573f('0x0'));var util=require(_0x573f('0x1'));var moment=require(_0x573f('0x2'));var BPromise=require(_0x573f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x573f('0x4'));var db=require(_0x573f('0x5'))['db'];var utils=require(_0x573f('0x6'));var logger=require(_0x573f('0x7'))(_0x573f('0x8'));var config=require(_0x573f('0x9'));var jayson=require(_0x573f('0xa'));var client=jayson['client'][_0x573f('0xb')]({'port':0x232a});config['redis']=_[_0x573f('0xc')](config['redis'],{'host':_0x573f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x573f('0xe')]));require(_0x573f('0xf'))[_0x573f('0x10')](socket);function respondWithRpcPromise(_0x5af20d,_0x444114,_0x4ca7b1){return new BPromise(function(_0x33f70c,_0x2c0c0e){return client[_0x573f('0x11')](_0x5af20d,_0x4ca7b1)[_0x573f('0x12')](function(_0x513b1b){logger['info']('ChatQueue,\x20%s,\x20%s',_0x444114,_0x573f('0x13'));logger[_0x573f('0x14')](_0x573f('0x15'),_0x444114,_0x573f('0x13'),JSON[_0x573f('0x16')](_0x513b1b));if(_0x513b1b['error']){if(_0x513b1b['error']['code']===0x1f4){logger[_0x573f('0x17')](_0x573f('0x18'),_0x444114,_0x513b1b[_0x573f('0x17')]['message']);return _0x2c0c0e(_0x513b1b[_0x573f('0x17')]['message']);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x444114,_0x513b1b[_0x573f('0x17')][_0x573f('0x19')]);return _0x33f70c(_0x513b1b[_0x573f('0x17')][_0x573f('0x19')]);}else{logger[_0x573f('0x1a')]('ChatQueue,\x20%s,\x20%s',_0x444114,'request\x20sent');_0x33f70c(_0x513b1b[_0x573f('0x1b')][_0x573f('0x19')]);}})[_0x573f('0x1c')](function(_0x52b193){logger[_0x573f('0x17')](_0x573f('0x18'),_0x444114,_0x52b193);_0x2c0c0e(_0x52b193);});});}exports[_0x573f('0x1d')]=function(_0x17ebd0){var _0x2ff1c0=this;return new Promise(function(_0x443f68,_0x5c4308){return db[_0x573f('0x1e')][_0x573f('0x1f')]({'raw':_0x17ebd0[_0x573f('0x20')]?_0x17ebd0[_0x573f('0x20')][_0x573f('0x21')]===undefined?!![]:![]:!![],'where':_0x17ebd0[_0x573f('0x20')]?_0x17ebd0[_0x573f('0x20')][_0x573f('0x22')]||null:null,'attributes':_0x17ebd0[_0x573f('0x20')]?_0x17ebd0[_0x573f('0x20')][_0x573f('0x23')]||null:null,'limit':_0x17ebd0[_0x573f('0x20')]?_0x17ebd0[_0x573f('0x20')][_0x573f('0x24')]||null:null,'include':_0x17ebd0[_0x573f('0x20')]?_0x17ebd0[_0x573f('0x20')][_0x573f('0x25')]?_['map'](_0x17ebd0['options'][_0x573f('0x25')],function(_0x31e7cd){return{'model':db[_0x31e7cd['model']],'as':_0x31e7cd['as'],'attributes':_0x31e7cd['attributes'],'include':_0x31e7cd[_0x573f('0x25')]?_[_0x573f('0x26')](_0x31e7cd[_0x573f('0x25')],function(_0x54ae1a){return{'model':db[_0x54ae1a[_0x573f('0x27')]],'as':_0x54ae1a['as'],'attributes':_0x54ae1a[_0x573f('0x23')],'include':_0x54ae1a[_0x573f('0x25')]?_[_0x573f('0x26')](_0x54ae1a[_0x573f('0x25')],function(_0x54eef1){return{'model':db[_0x54eef1[_0x573f('0x27')]],'as':_0x54eef1['as'],'attributes':_0x54eef1[_0x573f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x573f('0x12')](function(_0xf92f26){logger['info']('GetChatQueue',_0x17ebd0);logger[_0x573f('0x14')](_0x573f('0x1d'),_0x17ebd0,JSON[_0x573f('0x16')](_0xf92f26));_0x443f68(_0xf92f26);})[_0x573f('0x1c')](function(_0x30c1b4){logger[_0x573f('0x17')](_0x573f('0x1d'),_0x30c1b4[_0x573f('0x19')],_0x17ebd0);_0x5c4308(_0x2ff1c0['error'](0x1f4,_0x30c1b4[_0x573f('0x19')]));});});};exports[_0x573f('0x28')]=function(_0x454012){var _0x41c3d9=this;return new Promise(function(_0x448647,_0x4ea70d){return db[_0x573f('0x1e')][_0x573f('0x29')]({'raw':_0x454012[_0x573f('0x20')]?_0x454012['options'][_0x573f('0x21')]===undefined?!![]:![]:!![],'where':_0x454012[_0x573f('0x20')]?_0x454012[_0x573f('0x20')]['where']||null:null,'attributes':_0x454012[_0x573f('0x20')]?_0x454012[_0x573f('0x20')][_0x573f('0x23')]||null:null,'include':_0x454012['options']?_0x454012['options']['include']?_[_0x573f('0x26')](_0x454012['options'][_0x573f('0x25')],function(_0x5b7401){return{'model':db[_0x5b7401[_0x573f('0x27')]],'as':_0x5b7401['as'],'attributes':_0x5b7401['attributes'],'include':_0x5b7401[_0x573f('0x25')]?_[_0x573f('0x26')](_0x5b7401[_0x573f('0x25')],function(_0x26d973){return{'model':db[_0x26d973[_0x573f('0x27')]],'as':_0x26d973['as'],'attributes':_0x26d973[_0x573f('0x23')],'include':_0x26d973[_0x573f('0x25')]?_[_0x573f('0x26')](_0x26d973[_0x573f('0x25')],function(_0x3b5017){return{'model':db[_0x3b5017[_0x573f('0x27')]],'as':_0x3b5017['as'],'attributes':_0x3b5017['attributes']};}):[]};}):[]};}):[]:[]})[_0x573f('0x12')](function(_0x68f3a8){logger['info'](_0x573f('0x28'),_0x454012);logger[_0x573f('0x14')](_0x573f('0x28'),_0x454012,JSON[_0x573f('0x16')](_0x68f3a8));_0x448647(_0x68f3a8);})['catch'](function(_0x2b4fc5){logger[_0x573f('0x17')](_0x573f('0x28'),_0x2b4fc5[_0x573f('0x19')],_0x454012);_0x4ea70d(_0x41c3d9['error'](0x1f4,_0x2b4fc5['message']));});});}; \ No newline at end of file +var _0x726f=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','findAll','options','raw','where','attributes','map','include','model','then','ChatQueue','find','ShowChatQueue','lodash','util'];(function(_0x12abfc,_0x4c7965){var _0x3ad136=function(_0x2286b8){while(--_0x2286b8){_0x12abfc['push'](_0x12abfc['shift']());}};_0x3ad136(++_0x4c7965);}(_0x726f,0xa2));var _0xf726=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x726f[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xf726('0x0'));var util=require(_0xf726('0x1'));var moment=require('moment');var BPromise=require(_0xf726('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf726('0x3'))['db'];var utils=require(_0xf726('0x4'));var logger=require(_0xf726('0x5'))(_0xf726('0x6'));var config=require(_0xf726('0x7'));var jayson=require(_0xf726('0x8'));var client=jayson[_0xf726('0x9')][_0xf726('0xa')]({'port':0x232a});config[_0xf726('0xb')]=_[_0xf726('0xc')](config[_0xf726('0xb')],{'host':_0xf726('0xd'),'port':0x18eb});var socket=require(_0xf726('0xe'))(new Redis(config[_0xf726('0xb')]));require(_0xf726('0xf'))[_0xf726('0x10')](socket);function respondWithRpcPromise(_0xa9b9c,_0x555e37,_0x5a029b){return new BPromise(function(_0x4b786c,_0x45eb25){return client['request'](_0xa9b9c,_0x5a029b)['then'](function(_0xd2f44){logger[_0xf726('0x11')]('ChatQueue,\x20%s,\x20%s',_0x555e37,_0xf726('0x12'));logger[_0xf726('0x13')](_0xf726('0x14'),_0x555e37,_0xf726('0x12'),JSON[_0xf726('0x15')](_0xd2f44));if(_0xd2f44[_0xf726('0x16')]){if(_0xd2f44[_0xf726('0x16')][_0xf726('0x17')]===0x1f4){logger['error'](_0xf726('0x18'),_0x555e37,_0xd2f44['error']['message']);return _0x45eb25(_0xd2f44[_0xf726('0x16')][_0xf726('0x19')]);}logger['error'](_0xf726('0x18'),_0x555e37,_0xd2f44[_0xf726('0x16')][_0xf726('0x19')]);return _0x4b786c(_0xd2f44['error'][_0xf726('0x19')]);}else{logger[_0xf726('0x11')](_0xf726('0x18'),_0x555e37,'request\x20sent');_0x4b786c(_0xd2f44[_0xf726('0x1a')]['message']);}})[_0xf726('0x1b')](function(_0x4acd9d){logger[_0xf726('0x16')]('ChatQueue,\x20%s,\x20%s',_0x555e37,_0x4acd9d);_0x45eb25(_0x4acd9d);});});}exports[_0xf726('0x1c')]=function(_0x84dde5){var _0x453a6e=this;return new Promise(function(_0x54167d,_0x1e08a5){return db['ChatQueue'][_0xf726('0x1d')]({'raw':_0x84dde5[_0xf726('0x1e')]?_0x84dde5['options'][_0xf726('0x1f')]===undefined?!![]:![]:!![],'where':_0x84dde5[_0xf726('0x1e')]?_0x84dde5[_0xf726('0x1e')][_0xf726('0x20')]||null:null,'attributes':_0x84dde5[_0xf726('0x1e')]?_0x84dde5[_0xf726('0x1e')][_0xf726('0x21')]||null:null,'limit':_0x84dde5['options']?_0x84dde5[_0xf726('0x1e')]['limit']||null:null,'include':_0x84dde5[_0xf726('0x1e')]?_0x84dde5['options']['include']?_[_0xf726('0x22')](_0x84dde5[_0xf726('0x1e')][_0xf726('0x23')],function(_0x3877af){return{'model':db[_0x3877af[_0xf726('0x24')]],'as':_0x3877af['as'],'attributes':_0x3877af[_0xf726('0x21')],'include':_0x3877af['include']?_['map'](_0x3877af['include'],function(_0x470be4){return{'model':db[_0x470be4['model']],'as':_0x470be4['as'],'attributes':_0x470be4[_0xf726('0x21')],'include':_0x470be4[_0xf726('0x23')]?_['map'](_0x470be4[_0xf726('0x23')],function(_0x291869){return{'model':db[_0x291869[_0xf726('0x24')]],'as':_0x291869['as'],'attributes':_0x291869['attributes']};}):[]};}):[]};}):[]:[]})[_0xf726('0x25')](function(_0x26df78){logger[_0xf726('0x11')](_0xf726('0x1c'),_0x84dde5);logger['debug'](_0xf726('0x1c'),_0x84dde5,JSON[_0xf726('0x15')](_0x26df78));_0x54167d(_0x26df78);})[_0xf726('0x1b')](function(_0x5580ec){logger[_0xf726('0x16')](_0xf726('0x1c'),_0x5580ec[_0xf726('0x19')],_0x84dde5);_0x1e08a5(_0x453a6e['error'](0x1f4,_0x5580ec[_0xf726('0x19')]));});});};exports['ShowChatQueue']=function(_0x3b7026){var _0xa91bb3=this;return new Promise(function(_0x30a951,_0x5a654f){return db[_0xf726('0x26')][_0xf726('0x27')]({'raw':_0x3b7026[_0xf726('0x1e')]?_0x3b7026[_0xf726('0x1e')][_0xf726('0x1f')]===undefined?!![]:![]:!![],'where':_0x3b7026[_0xf726('0x1e')]?_0x3b7026['options'][_0xf726('0x20')]||null:null,'attributes':_0x3b7026['options']?_0x3b7026[_0xf726('0x1e')][_0xf726('0x21')]||null:null,'include':_0x3b7026[_0xf726('0x1e')]?_0x3b7026[_0xf726('0x1e')][_0xf726('0x23')]?_[_0xf726('0x22')](_0x3b7026[_0xf726('0x1e')]['include'],function(_0x5d1565){return{'model':db[_0x5d1565[_0xf726('0x24')]],'as':_0x5d1565['as'],'attributes':_0x5d1565['attributes'],'include':_0x5d1565[_0xf726('0x23')]?_[_0xf726('0x22')](_0x5d1565[_0xf726('0x23')],function(_0x5844b1){return{'model':db[_0x5844b1['model']],'as':_0x5844b1['as'],'attributes':_0x5844b1[_0xf726('0x21')],'include':_0x5844b1[_0xf726('0x23')]?_[_0xf726('0x22')](_0x5844b1[_0xf726('0x23')],function(_0x2e7ce5){return{'model':db[_0x2e7ce5['model']],'as':_0x2e7ce5['as'],'attributes':_0x2e7ce5[_0xf726('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c9390){logger[_0xf726('0x11')]('ShowChatQueue',_0x3b7026);logger['debug']('ShowChatQueue',_0x3b7026,JSON[_0xf726('0x15')](_0x2c9390));_0x30a951(_0x2c9390);})[_0xf726('0x1b')](function(_0x84fbe1){logger[_0xf726('0x16')](_0xf726('0x28'),_0x84fbe1['message'],_0x3b7026);_0x5a654f(_0xa91bb3[_0xf726('0x16')](0x1f4,_0x84fbe1['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index ad7fde6..67c5674 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x2299b8,_0x31ea5e){var _0xa70342=function(_0x1fb0c2){while(--_0x1fb0c2){_0x2299b8['push'](_0x2299b8['shift']());}};_0xa70342(++_0x31ea5e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4e7844,_0x30ce77){_0x4e7844=_0x4e7844-0x0;var _0x336119=_0x0b0e[_0x4e7844];return _0x336119;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0xa8311e,_0x2f866b){var _0x2ceb57=function(_0x5ea533){while(--_0x5ea533){_0xa8311e['push'](_0xa8311e['shift']());}};_0x2ceb57(++_0x2f866b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0x0b0e[_0x284a61];return _0x220e3c;};'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 cd44517..2ce4167 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 _0x70f0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x40fc45,_0x5518bc){var _0x179e2d=function(_0x584129){while(--_0x584129){_0x40fc45['push'](_0x40fc45['shift']());}};_0x179e2d(++_0x5518bc);}(_0x70f0,0x17a));var _0x070f=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x70f0[_0x2a56ad];return _0x425175;};'use strict';var multer=require(_0x070f('0x0'));var util=require(_0x070f('0x1'));var path=require(_0x070f('0x2'));var timeout=require(_0x070f('0x3'));var express=require(_0x070f('0x4'));var router=express[_0x070f('0x5')]();var auth=require(_0x070f('0x6'));var interaction=require(_0x070f('0x7'));var config=require(_0x070f('0x8'));var controller=require(_0x070f('0x9'));router[_0x070f('0xa')]('/',auth[_0x070f('0xb')](),controller[_0x070f('0xc')]);router[_0x070f('0xa')]('/describe',auth[_0x070f('0xb')](),controller[_0x070f('0xd')]);router[_0x070f('0xa')](_0x070f('0xe'),auth['isAuthenticated'](),controller[_0x070f('0xf')]);router[_0x070f('0xa')](_0x070f('0x10'),auth[_0x070f('0xb')](),controller['getMembers']);router[_0x070f('0xa')](_0x070f('0x11'),auth[_0x070f('0xb')](),controller[_0x070f('0x12')]);router[_0x070f('0xa')](_0x070f('0x13'),auth[_0x070f('0xb')](),controller[_0x070f('0x14')]);router[_0x070f('0x15')]('/',auth[_0x070f('0xb')](),controller[_0x070f('0x16')]);router[_0x070f('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x070f('0x17')]);router['post']('/:id/users',auth[_0x070f('0xb')](),controller[_0x070f('0x18')]);router[_0x070f('0x19')](_0x070f('0xe'),auth[_0x070f('0xb')](),controller[_0x070f('0x1a')]);router[_0x070f('0x1b')](_0x070f('0xe'),auth[_0x070f('0xb')](),controller[_0x070f('0x1c')]);router[_0x070f('0x1b')]('/:id/teams',auth[_0x070f('0xb')](),controller[_0x070f('0x1d')]);router[_0x070f('0x1b')](_0x070f('0x13'),auth[_0x070f('0xb')](),controller[_0x070f('0x1e')]);module[_0x070f('0x1f')]=router; \ No newline at end of file +var _0xf80b=['addAgents','put','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users'];(function(_0x209ba4,_0x11aee){var _0x336e86=function(_0x46b455){while(--_0x46b455){_0x209ba4['push'](_0x209ba4['shift']());}};_0x336e86(++_0x11aee);}(_0xf80b,0xad));var _0xbf80=function(_0x11e20f,_0x206416){_0x11e20f=_0x11e20f-0x0;var _0xa6c52d=_0xf80b[_0x11e20f];return _0xa6c52d;};'use strict';var multer=require('multer');var util=require(_0xbf80('0x0'));var path=require('path');var timeout=require(_0xbf80('0x1'));var express=require(_0xbf80('0x2'));var router=express[_0xbf80('0x3')]();var auth=require(_0xbf80('0x4'));var interaction=require(_0xbf80('0x5'));var config=require(_0xbf80('0x6'));var controller=require(_0xbf80('0x7'));router[_0xbf80('0x8')]('/',auth[_0xbf80('0x9')](),controller['index']);router['get'](_0xbf80('0xa'),auth[_0xbf80('0x9')](),controller[_0xbf80('0xb')]);router[_0xbf80('0x8')](_0xbf80('0xc'),auth[_0xbf80('0x9')](),controller[_0xbf80('0xd')]);router[_0xbf80('0x8')](_0xbf80('0xe'),auth[_0xbf80('0x9')](),controller[_0xbf80('0xf')]);router[_0xbf80('0x8')](_0xbf80('0x10'),auth[_0xbf80('0x9')](),controller[_0xbf80('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xbf80('0x12')]);router[_0xbf80('0x13')]('/',auth[_0xbf80('0x9')](),controller[_0xbf80('0x14')]);router[_0xbf80('0x13')](_0xbf80('0x10'),auth['isAuthenticated'](),controller[_0xbf80('0x15')]);router['post'](_0xbf80('0x16'),auth[_0xbf80('0x9')](),controller[_0xbf80('0x17')]);router[_0xbf80('0x18')](_0xbf80('0xc'),auth[_0xbf80('0x9')](),controller['update']);router[_0xbf80('0x19')]('/:id',auth[_0xbf80('0x9')](),controller[_0xbf80('0x1a')]);router[_0xbf80('0x19')](_0xbf80('0x10'),auth[_0xbf80('0x9')](),controller['removeTeams']);router[_0xbf80('0x19')](_0xbf80('0x16'),auth[_0xbf80('0x9')](),controller['removeAgents']);module[_0xbf80('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index a037612..5be8737 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 _0x3d70=['moment','STRING','DATE'];(function(_0x39d961,_0x1dbce3){var _0x3dfa92=function(_0x71caf2){while(--_0x71caf2){_0x39d961['push'](_0x39d961['shift']());}};_0x3dfa92(++_0x1dbce3);}(_0x3d70,0x144));var _0x03d7=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x3d70[_0x5471ec];return _0x121d4c;};'use strict';var moment=require(_0x03d7('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x03d7('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x03d7('0x1')]},'joinAt':{'type':Sequelize[_0x03d7('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x03d7('0x2')]},'reason':{'type':Sequelize[_0x03d7('0x1')]}}; \ No newline at end of file +var _0xecc7=['sequelize','exports','STRING','DATE','moment'];(function(_0x3e56cf,_0x3815ba){var _0x2d1802=function(_0x428256){while(--_0x428256){_0x3e56cf['push'](_0x3e56cf['shift']());}};_0x2d1802(++_0x3815ba);}(_0xecc7,0x11c));var _0x7ecc=function(_0xcba291,_0x10e9d5){_0xcba291=_0xcba291-0x0;var _0x162274=_0xecc7[_0xcba291];return _0x162274;};'use strict';var moment=require(_0x7ecc('0x0'));var Sequelize=require(_0x7ecc('0x1'));module[_0x7ecc('0x2')]={'uniqueid':{'type':Sequelize[_0x7ecc('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7ecc('0x3')]},'joinAt':{'type':Sequelize[_0x7ecc('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7ecc('0x4')]},'exitAt':{'type':Sequelize[_0x7ecc('0x4')]},'reason':{'type':Sequelize[_0x7ecc('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 2004f4d..46c403e 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 _0x9bd8=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','intersection','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x19449a,_0x190b60){var _0x4d0acd=function(_0xfb4226){while(--_0xfb4226){_0x19449a['push'](_0x19449a['shift']());}};_0x4d0acd(++_0x190b60);}(_0x9bd8,0x1f4));var _0x89bd=function(_0x8ec6b4,_0x31ef52){_0x8ec6b4=_0x8ec6b4-0x0;var _0x52c0d0=_0x9bd8[_0x8ec6b4];return _0x52c0d0;};'use strict';var pdf=require(_0x89bd('0x0'));var emlformat=require(_0x89bd('0x1'));var rimraf=require(_0x89bd('0x2'));var zipdir=require(_0x89bd('0x3'));var jsonpatch=require(_0x89bd('0x4'));var rp=require(_0x89bd('0x5'));var moment=require(_0x89bd('0x6'));var BPromise=require(_0x89bd('0x7'));var Mustache=require(_0x89bd('0x8'));var util=require(_0x89bd('0x9'));var path=require(_0x89bd('0xa'));var sox=require(_0x89bd('0xb'));var csv=require(_0x89bd('0xc'));var ejs=require(_0x89bd('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x89bd('0xe'));var crypto=require(_0x89bd('0xf'));var jsforce=require(_0x89bd('0x10'));var deskjs=require(_0x89bd('0x11'));var toCsv=require(_0x89bd('0xc'));var querystring=require(_0x89bd('0x12'));var Papa=require(_0x89bd('0x13'));var Redis=require('ioredis');var authService=require(_0x89bd('0x14'));var qs=require(_0x89bd('0x15'));var as=require(_0x89bd('0x16'));var hardwareService=require(_0x89bd('0x17'));var logger=require(_0x89bd('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x89bd('0x19'));var licenseUtil=require(_0x89bd('0x1a'));var db=require(_0x89bd('0x1b'))['db'];function respondWithStatusCode(_0x398cea,_0x440426){_0x440426=_0x440426||0xcc;return function(_0x331f94){if(_0x331f94){return _0x398cea[_0x89bd('0x1c')](_0x440426);}return _0x398cea['status'](_0x440426)['end']();};}function respondWithResult(_0x478903,_0x5d8dc4){_0x5d8dc4=_0x5d8dc4||0xc8;return function(_0x4e8579){if(_0x4e8579){return _0x478903[_0x89bd('0x1d')](_0x5d8dc4)[_0x89bd('0x1e')](_0x4e8579);}};}function respondWithFilteredResult(_0x3627d4,_0x42540f){return function(_0x56bf6f){if(_0x56bf6f){var _0xe6aa9=_0x56bf6f[_0x89bd('0x1f')],_0x52b50e=_0x42540f[_0x89bd('0x20')],_0x5724cd=_0x42540f[_0x89bd('0x20')]+_0x42540f[_0x89bd('0x21')],_0x34a4f0;if(_0x5724cd>=_0xe6aa9){_0x5724cd=_0xe6aa9;_0x34a4f0=0xc8;}else{_0x34a4f0=0xce;}_0x3627d4[_0x89bd('0x1d')](_0x34a4f0);return _0x3627d4[_0x89bd('0x22')](_0x89bd('0x23'),_0x52b50e+'-'+_0x5724cd+'/'+_0xe6aa9)['json'](_0x56bf6f);}return null;};}function patchUpdates(_0x3824eb){return function(_0x2d56c2){try{jsonpatch[_0x89bd('0x24')](_0x2d56c2,_0x3824eb,!![]);}catch(_0x41a7b8){return BPromise['reject'](_0x41a7b8);}return _0x2d56c2['save']();};}function saveUpdates(_0x4da497,_0x12e174){return function(_0x35ed21){if(_0x35ed21){return _0x35ed21[_0x89bd('0x25')](_0x4da497)[_0x89bd('0x26')](function(_0x46a0be){return _0x46a0be;});}return null;};}function removeEntity(_0x4e0f93,_0x24d3bf){return function(_0x57fe0e){if(_0x57fe0e){return _0x57fe0e[_0x89bd('0x27')]()['then'](function(){_0x4e0f93['status'](0xcc)[_0x89bd('0x28')]();});}};}function handleEntityNotFound(_0x1a10a8,_0x137300){return function(_0x1b72c3){if(!_0x1b72c3){_0x1a10a8['sendStatus'](0x194);}return _0x1b72c3;};}function handleError(_0x4805d6,_0x1425bc){_0x1425bc=_0x1425bc||0x1f4;return function(_0x1077a2){logger[_0x89bd('0x29')](_0x1077a2[_0x89bd('0x2a')]);if(_0x1077a2[_0x89bd('0x2b')]){delete _0x1077a2[_0x89bd('0x2b')];}_0x4805d6[_0x89bd('0x1d')](_0x1425bc)[_0x89bd('0x2c')](_0x1077a2);};}exports[_0x89bd('0x2d')]=function(_0x464d78,_0x1a34fb){var _0x3cbb77={},_0x31b79c={},_0x44302c={'count':0x0,'rows':[]};var _0x1d3edd=_[_0x89bd('0x2e')](db[_0x89bd('0x2f')][_0x89bd('0x30')],function(_0x46abe7){return{'name':_0x46abe7['fieldName'],'type':_0x46abe7['type']['key']};});_0x31b79c[_0x89bd('0x31')]=_['map'](_0x1d3edd,_0x89bd('0x2b'));_0x31b79c['query']=_[_0x89bd('0x32')](_0x464d78[_0x89bd('0x33')]);_0x31b79c[_0x89bd('0x34')]=_['intersection'](_0x31b79c['model'],_0x31b79c[_0x89bd('0x33')]);_0x3cbb77[_0x89bd('0x35')]=_['intersection'](_0x31b79c[_0x89bd('0x31')],qs[_0x89bd('0x36')](_0x464d78[_0x89bd('0x33')][_0x89bd('0x36')]));_0x3cbb77[_0x89bd('0x35')]=_0x3cbb77[_0x89bd('0x35')]['length']?_0x3cbb77[_0x89bd('0x35')]:_0x31b79c['model'];if(!_0x464d78[_0x89bd('0x33')][_0x89bd('0x37')](_0x89bd('0x38'))){_0x3cbb77[_0x89bd('0x21')]=qs[_0x89bd('0x21')](_0x464d78[_0x89bd('0x33')][_0x89bd('0x21')]);_0x3cbb77[_0x89bd('0x20')]=qs[_0x89bd('0x20')](_0x464d78[_0x89bd('0x33')][_0x89bd('0x20')]);}_0x3cbb77[_0x89bd('0x39')]=qs[_0x89bd('0x3a')](_0x464d78[_0x89bd('0x33')][_0x89bd('0x3a')]);_0x3cbb77[_0x89bd('0x3b')]=qs[_0x89bd('0x34')](_[_0x89bd('0x3c')](_0x464d78[_0x89bd('0x33')],_0x31b79c['filters']),_0x1d3edd);if(_0x464d78[_0x89bd('0x33')][_0x89bd('0x3d')]){_0x3cbb77[_0x89bd('0x3b')]=_[_0x89bd('0x3e')](_0x3cbb77[_0x89bd('0x3b')],{'$or':_[_0x89bd('0x2e')](_0x1d3edd,function(_0x4e1251){if(_0x4e1251['type']!=='VIRTUAL'){var _0x227d03={};_0x227d03[_0x4e1251[_0x89bd('0x2b')]]={'$like':'%'+_0x464d78[_0x89bd('0x33')][_0x89bd('0x3d')]+'%'};return _0x227d03;}})});}_0x3cbb77=_['merge']({},_0x3cbb77,_0x464d78[_0x89bd('0x3f')]);var _0x578e4f={'where':_0x3cbb77['where']};return db[_0x89bd('0x2f')][_0x89bd('0x1f')](_0x578e4f)[_0x89bd('0x26')](function(_0x347610){_0x44302c[_0x89bd('0x1f')]=_0x347610;if(_0x464d78[_0x89bd('0x33')][_0x89bd('0x40')]){_0x3cbb77[_0x89bd('0x41')]=[{'all':!![]}];}return db[_0x89bd('0x2f')]['findAll'](_0x3cbb77);})[_0x89bd('0x26')](function(_0x22fd87){_0x44302c[_0x89bd('0x42')]=_0x22fd87;return _0x44302c;})['then'](respondWithFilteredResult(_0x1a34fb,_0x3cbb77))[_0x89bd('0x43')](handleError(_0x1a34fb,null));};exports['show']=function(_0x3cfd32,_0x1cd8f7){var _0x159a2c={'raw':!![],'where':{'id':_0x3cfd32[_0x89bd('0x44')]['id']}},_0x4b4637={};_0x4b4637[_0x89bd('0x31')]=_[_0x89bd('0x32')](db[_0x89bd('0x2f')]['rawAttributes']);_0x4b4637[_0x89bd('0x33')]=_[_0x89bd('0x32')](_0x3cfd32[_0x89bd('0x33')]);_0x4b4637[_0x89bd('0x34')]=_[_0x89bd('0x45')](_0x4b4637[_0x89bd('0x31')],_0x4b4637[_0x89bd('0x33')]);_0x159a2c['attributes']=_[_0x89bd('0x45')](_0x4b4637[_0x89bd('0x31')],qs['fields'](_0x3cfd32[_0x89bd('0x33')]['fields']));_0x159a2c[_0x89bd('0x35')]=_0x159a2c[_0x89bd('0x35')][_0x89bd('0x46')]?_0x159a2c[_0x89bd('0x35')]:_0x4b4637[_0x89bd('0x31')];if(_0x3cfd32[_0x89bd('0x33')][_0x89bd('0x40')]){_0x159a2c[_0x89bd('0x41')]=[{'all':!![]}];}_0x159a2c=_[_0x89bd('0x3e')]({},_0x159a2c,_0x3cfd32[_0x89bd('0x3f')]);return db[_0x89bd('0x2f')][_0x89bd('0x47')](_0x159a2c)[_0x89bd('0x26')](handleEntityNotFound(_0x1cd8f7,null))[_0x89bd('0x26')](respondWithResult(_0x1cd8f7,null))['catch'](handleError(_0x1cd8f7,null));};exports[_0x89bd('0x48')]=function(_0x389386,_0x575c86){return db['ChatQueueReport']['create'](_0x389386[_0x89bd('0x49')],{})['then'](respondWithResult(_0x575c86,0xc9))[_0x89bd('0x43')](handleError(_0x575c86,null));};exports[_0x89bd('0x25')]=function(_0x4e03cf,_0x11576f){if(_0x4e03cf['body']['id']){delete _0x4e03cf[_0x89bd('0x49')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x4e03cf[_0x89bd('0x44')]['id']}})[_0x89bd('0x26')](handleEntityNotFound(_0x11576f,null))['then'](saveUpdates(_0x4e03cf[_0x89bd('0x49')],null))[_0x89bd('0x26')](respondWithResult(_0x11576f,null))[_0x89bd('0x43')](handleError(_0x11576f,null));};exports[_0x89bd('0x27')]=function(_0x28c3b2,_0x12328c){return db[_0x89bd('0x2f')]['find']({'where':{'id':_0x28c3b2[_0x89bd('0x44')]['id']}})['then'](handleEntityNotFound(_0x12328c,null))[_0x89bd('0x26')](removeEntity(_0x12328c,null))[_0x89bd('0x43')](handleError(_0x12328c,null));};exports['describe']=function(_0x3a221f,_0x50b8ec){return db[_0x89bd('0x2f')][_0x89bd('0x4a')]()[_0x89bd('0x26')](respondWithResult(_0x50b8ec,null))[_0x89bd('0x43')](handleError(_0x50b8ec,null));}; \ No newline at end of file +var _0x2376=['map','ChatQueueReport','fieldName','key','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','model','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','send'];(function(_0x42016e,_0x34ce3d){var _0x41020f=function(_0x23be29){while(--_0x23be29){_0x42016e['push'](_0x42016e['shift']());}};_0x41020f(++_0x34ce3d);}(_0x2376,0x6a));var _0x6237=function(_0x34195f,_0x1d99cb){_0x34195f=_0x34195f-0x0;var _0x139a92=_0x2376[_0x34195f];return _0x139a92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6237('0x0'));var rimraf=require(_0x6237('0x1'));var zipdir=require(_0x6237('0x2'));var jsonpatch=require(_0x6237('0x3'));var rp=require(_0x6237('0x4'));var moment=require(_0x6237('0x5'));var BPromise=require(_0x6237('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6237('0x7'));var sox=require(_0x6237('0x8'));var csv=require(_0x6237('0x9'));var ejs=require(_0x6237('0xa'));var fs=require('fs');var _=require(_0x6237('0xb'));var squel=require(_0x6237('0xc'));var crypto=require(_0x6237('0xd'));var jsforce=require(_0x6237('0xe'));var deskjs=require(_0x6237('0xf'));var toCsv=require(_0x6237('0x9'));var querystring=require('querystring');var Papa=require(_0x6237('0x10'));var Redis=require(_0x6237('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6237('0x12'));var as=require(_0x6237('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6237('0x14'))(_0x6237('0x15'));var utils=require(_0x6237('0x16'));var config=require(_0x6237('0x17'));var licenseUtil=require(_0x6237('0x18'));var db=require(_0x6237('0x19'))['db'];function respondWithStatusCode(_0x51951b,_0x3fd70d){_0x3fd70d=_0x3fd70d||0xcc;return function(_0x3772ed){if(_0x3772ed){return _0x51951b[_0x6237('0x1a')](_0x3fd70d);}return _0x51951b[_0x6237('0x1b')](_0x3fd70d)[_0x6237('0x1c')]();};}function respondWithResult(_0x28a06e,_0x5cbaf7){_0x5cbaf7=_0x5cbaf7||0xc8;return function(_0x1fcd7d){if(_0x1fcd7d){return _0x28a06e[_0x6237('0x1b')](_0x5cbaf7)[_0x6237('0x1d')](_0x1fcd7d);}};}function respondWithFilteredResult(_0x5d36ac,_0x1bbf6a){return function(_0x416df6){if(_0x416df6){var _0xdbe550=_0x416df6['count'],_0x182162=_0x1bbf6a[_0x6237('0x1e')],_0x47a125=_0x1bbf6a[_0x6237('0x1e')]+_0x1bbf6a[_0x6237('0x1f')],_0x5f3bd0;if(_0x47a125>=_0xdbe550){_0x47a125=_0xdbe550;_0x5f3bd0=0xc8;}else{_0x5f3bd0=0xce;}_0x5d36ac[_0x6237('0x1b')](_0x5f3bd0);return _0x5d36ac[_0x6237('0x20')](_0x6237('0x21'),_0x182162+'-'+_0x47a125+'/'+_0xdbe550)[_0x6237('0x1d')](_0x416df6);}return null;};}function patchUpdates(_0x40946b){return function(_0x29b9e1){try{jsonpatch[_0x6237('0x22')](_0x29b9e1,_0x40946b,!![]);}catch(_0x53f263){return BPromise[_0x6237('0x23')](_0x53f263);}return _0x29b9e1['save']();};}function saveUpdates(_0x293168,_0x2af79b){return function(_0x4f43da){if(_0x4f43da){return _0x4f43da[_0x6237('0x24')](_0x293168)[_0x6237('0x25')](function(_0x2ae0c3){return _0x2ae0c3;});}return null;};}function removeEntity(_0x5150ce,_0x45d5cc){return function(_0x2d7efd){if(_0x2d7efd){return _0x2d7efd[_0x6237('0x26')]()[_0x6237('0x25')](function(){_0x5150ce['status'](0xcc)[_0x6237('0x1c')]();});}};}function handleEntityNotFound(_0x356181,_0x514f06){return function(_0x41def8){if(!_0x41def8){_0x356181[_0x6237('0x1a')](0x194);}return _0x41def8;};}function handleError(_0x26d0cc,_0x8f63b3){_0x8f63b3=_0x8f63b3||0x1f4;return function(_0x2adc34){logger[_0x6237('0x27')](_0x2adc34[_0x6237('0x28')]);if(_0x2adc34['name']){delete _0x2adc34['name'];}_0x26d0cc['status'](_0x8f63b3)[_0x6237('0x29')](_0x2adc34);};}exports['index']=function(_0x105374,_0x21d702){var _0x4dfab4={},_0xe14e61={},_0x5df1e4={'count':0x0,'rows':[]};var _0x141e12=_[_0x6237('0x2a')](db[_0x6237('0x2b')]['rawAttributes'],function(_0x1c7b2c){return{'name':_0x1c7b2c[_0x6237('0x2c')],'type':_0x1c7b2c['type'][_0x6237('0x2d')]};});_0xe14e61['model']=_['map'](_0x141e12,_0x6237('0x2e'));_0xe14e61[_0x6237('0x2f')]=_[_0x6237('0x30')](_0x105374['query']);_0xe14e61[_0x6237('0x31')]=_[_0x6237('0x32')](_0xe14e61['model'],_0xe14e61[_0x6237('0x2f')]);_0x4dfab4[_0x6237('0x33')]=_['intersection'](_0xe14e61['model'],qs['fields'](_0x105374['query'][_0x6237('0x34')]));_0x4dfab4[_0x6237('0x33')]=_0x4dfab4[_0x6237('0x33')]['length']?_0x4dfab4[_0x6237('0x33')]:_0xe14e61['model'];if(!_0x105374[_0x6237('0x2f')][_0x6237('0x35')]('nolimit')){_0x4dfab4['limit']=qs[_0x6237('0x1f')](_0x105374[_0x6237('0x2f')][_0x6237('0x1f')]);_0x4dfab4[_0x6237('0x1e')]=qs[_0x6237('0x1e')](_0x105374[_0x6237('0x2f')][_0x6237('0x1e')]);}_0x4dfab4[_0x6237('0x36')]=qs[_0x6237('0x37')](_0x105374[_0x6237('0x2f')][_0x6237('0x37')]);_0x4dfab4[_0x6237('0x38')]=qs[_0x6237('0x31')](_[_0x6237('0x39')](_0x105374['query'],_0xe14e61[_0x6237('0x31')]),_0x141e12);if(_0x105374['query'][_0x6237('0x3a')]){_0x4dfab4[_0x6237('0x38')]=_[_0x6237('0x3b')](_0x4dfab4[_0x6237('0x38')],{'$or':_[_0x6237('0x2a')](_0x141e12,function(_0x46eaa5){if(_0x46eaa5[_0x6237('0x3c')]!==_0x6237('0x3d')){var _0x1e1b54={};_0x1e1b54[_0x46eaa5[_0x6237('0x2e')]]={'$like':'%'+_0x105374[_0x6237('0x2f')][_0x6237('0x3a')]+'%'};return _0x1e1b54;}})});}_0x4dfab4=_['merge']({},_0x4dfab4,_0x105374[_0x6237('0x3e')]);var _0x2833ed={'where':_0x4dfab4[_0x6237('0x38')]};return db['ChatQueueReport'][_0x6237('0x3f')](_0x2833ed)[_0x6237('0x25')](function(_0x4732ee){_0x5df1e4['count']=_0x4732ee;if(_0x105374['query'][_0x6237('0x40')]){_0x4dfab4[_0x6237('0x41')]=[{'all':!![]}];}return db[_0x6237('0x2b')]['findAll'](_0x4dfab4);})[_0x6237('0x25')](function(_0x444949){_0x5df1e4[_0x6237('0x42')]=_0x444949;return _0x5df1e4;})[_0x6237('0x25')](respondWithFilteredResult(_0x21d702,_0x4dfab4))[_0x6237('0x43')](handleError(_0x21d702,null));};exports[_0x6237('0x44')]=function(_0x64bc1c,_0x38a797){var _0x763654={'raw':!![],'where':{'id':_0x64bc1c['params']['id']}},_0x12ed52={};_0x12ed52[_0x6237('0x45')]=_[_0x6237('0x30')](db[_0x6237('0x2b')]['rawAttributes']);_0x12ed52[_0x6237('0x2f')]=_[_0x6237('0x30')](_0x64bc1c['query']);_0x12ed52[_0x6237('0x31')]=_[_0x6237('0x32')](_0x12ed52[_0x6237('0x45')],_0x12ed52[_0x6237('0x2f')]);_0x763654[_0x6237('0x33')]=_[_0x6237('0x32')](_0x12ed52[_0x6237('0x45')],qs[_0x6237('0x34')](_0x64bc1c[_0x6237('0x2f')][_0x6237('0x34')]));_0x763654[_0x6237('0x33')]=_0x763654[_0x6237('0x33')]['length']?_0x763654['attributes']:_0x12ed52[_0x6237('0x45')];if(_0x64bc1c['query']['includeAll']){_0x763654['include']=[{'all':!![]}];}_0x763654=_[_0x6237('0x3b')]({},_0x763654,_0x64bc1c['options']);return db[_0x6237('0x2b')]['find'](_0x763654)['then'](handleEntityNotFound(_0x38a797,null))['then'](respondWithResult(_0x38a797,null))[_0x6237('0x43')](handleError(_0x38a797,null));};exports['create']=function(_0x3fdef5,_0x28fc9d){return db['ChatQueueReport']['create'](_0x3fdef5[_0x6237('0x46')],{})[_0x6237('0x25')](respondWithResult(_0x28fc9d,0xc9))[_0x6237('0x43')](handleError(_0x28fc9d,null));};exports[_0x6237('0x24')]=function(_0x13eaaa,_0x3b32f7){if(_0x13eaaa[_0x6237('0x46')]['id']){delete _0x13eaaa[_0x6237('0x46')]['id'];}return db[_0x6237('0x2b')][_0x6237('0x47')]({'where':{'id':_0x13eaaa[_0x6237('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b32f7,null))[_0x6237('0x25')](saveUpdates(_0x13eaaa[_0x6237('0x46')],null))[_0x6237('0x25')](respondWithResult(_0x3b32f7,null))[_0x6237('0x43')](handleError(_0x3b32f7,null));};exports['destroy']=function(_0x4d34a1,_0x32f77c){return db[_0x6237('0x2b')][_0x6237('0x47')]({'where':{'id':_0x4d34a1[_0x6237('0x48')]['id']}})[_0x6237('0x25')](handleEntityNotFound(_0x32f77c,null))[_0x6237('0x25')](removeEntity(_0x32f77c,null))[_0x6237('0x43')](handleError(_0x32f77c,null));};exports[_0x6237('0x49')]=function(_0x3e16cb,_0x1cc11d){return db[_0x6237('0x2b')][_0x6237('0x49')]()[_0x6237('0x25')](respondWithResult(_0x1cc11d,null))[_0x6237('0x43')](handleError(_0x1cc11d,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index bf340cd..504ada5 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 _0xfcd8=['./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x415f7e,_0x4630b6){var _0x311ff4=function(_0x19c19d){while(--_0x19c19d){_0x415f7e['push'](_0x415f7e['shift']());}};_0x311ff4(++_0x4630b6);}(_0xfcd8,0x131));var _0x8fcd=function(_0x42b9cd,_0x2a5af6){_0x42b9cd=_0x42b9cd-0x0;var _0x42bd9a=_0xfcd8[_0x42b9cd];return _0x42bd9a;};'use strict';var _=require(_0x8fcd('0x0'));var util=require(_0x8fcd('0x1'));var logger=require(_0x8fcd('0x2'))(_0x8fcd('0x3'));var moment=require(_0x8fcd('0x4'));var BPromise=require(_0x8fcd('0x5'));var rp=require(_0x8fcd('0x6'));var fs=require('fs');var path=require(_0x8fcd('0x7'));var rimraf=require(_0x8fcd('0x8'));var config=require(_0x8fcd('0x9'));var attributes=require(_0x8fcd('0xa'));module[_0x8fcd('0xb')]=function(_0x3b9f65,_0x5d6e8e){return _0x3b9f65[_0x8fcd('0xc')](_0x8fcd('0xd'),attributes,{'tableName':_0x8fcd('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa2d9=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue'];(function(_0x40b5a1,_0x4e8ec7){var _0x5db874=function(_0x56f72c){while(--_0x56f72c){_0x40b5a1['push'](_0x40b5a1['shift']());}};_0x5db874(++_0x4e8ec7);}(_0xa2d9,0x71));var _0x9a2d=function(_0x4a66a2,_0x226d03){_0x4a66a2=_0x4a66a2-0x0;var _0x3d8459=_0xa2d9[_0x4a66a2];return _0x3d8459;};'use strict';var _=require(_0x9a2d('0x0'));var util=require(_0x9a2d('0x1'));var logger=require(_0x9a2d('0x2'))('api');var moment=require(_0x9a2d('0x3'));var BPromise=require(_0x9a2d('0x4'));var rp=require(_0x9a2d('0x5'));var fs=require('fs');var path=require(_0x9a2d('0x6'));var rimraf=require(_0x9a2d('0x7'));var config=require('../../config/environment');var attributes=require(_0x9a2d('0x8'));module[_0x9a2d('0x9')]=function(_0x55d2a1,_0x262f19){return _0x55d2a1[_0x9a2d('0xa')](_0x9a2d('0xb'),attributes,{'tableName':_0x9a2d('0xc'),'paranoid':![],'indexes':[{'name':_0x9a2d('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index e9703a0..4da1b18 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 _0x552a=['update','body','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','raw','UpdateChatQueueReport'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0x552a,0x1e2));var _0xa552=function(_0x44dfeb,_0x5bfd54){_0x44dfeb=_0x44dfeb-0x0;var _0x2710c0=_0x552a[_0x44dfeb];return _0x2710c0;};'use strict';var _=require(_0xa552('0x0'));var util=require(_0xa552('0x1'));var moment=require(_0xa552('0x2'));var BPromise=require(_0xa552('0x3'));var rs=require(_0xa552('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa552('0x5'))['db'];var utils=require(_0xa552('0x6'));var logger=require(_0xa552('0x7'))(_0xa552('0x8'));var config=require(_0xa552('0x9'));var jayson=require(_0xa552('0xa'));var client=jayson[_0xa552('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x79506,_0x5c9cd6,_0x395ef5){return new BPromise(function(_0x1e8f35,_0x506fc4){return client[_0xa552('0xc')](_0x79506,_0x395ef5)[_0xa552('0xd')](function(_0x398284){logger[_0xa552('0xe')](_0xa552('0xf'),_0x5c9cd6,'request\x20sent');logger[_0xa552('0x10')](_0xa552('0x11'),_0x5c9cd6,_0xa552('0x12'),JSON[_0xa552('0x13')](_0x398284));if(_0x398284[_0xa552('0x14')]){if(_0x398284[_0xa552('0x14')]['code']===0x1f4){logger['error'](_0xa552('0xf'),_0x5c9cd6,_0x398284[_0xa552('0x14')][_0xa552('0x15')]);return _0x506fc4(_0x398284[_0xa552('0x14')][_0xa552('0x15')]);}logger[_0xa552('0x14')](_0xa552('0xf'),_0x5c9cd6,_0x398284[_0xa552('0x14')][_0xa552('0x15')]);return _0x1e8f35(_0x398284[_0xa552('0x14')][_0xa552('0x15')]);}else{logger[_0xa552('0xe')](_0xa552('0xf'),_0x5c9cd6,_0xa552('0x12'));_0x1e8f35(_0x398284[_0xa552('0x16')][_0xa552('0x15')]);}})[_0xa552('0x17')](function(_0x35e97f){logger[_0xa552('0x14')](_0xa552('0xf'),_0x5c9cd6,_0x35e97f);_0x506fc4(_0x35e97f);});});}exports[_0xa552('0x18')]=function(_0x54a3e8){var _0x2fb388=this;return new Promise(function(_0x35f93f,_0x1a5d1c){return db[_0xa552('0x19')]['create'](_0x54a3e8['body'],{'raw':_0x54a3e8['options']?_0x54a3e8['options'][_0xa552('0x1a')]===undefined?!![]:![]:!![]})[_0xa552('0xd')](function(_0x480cb1){logger[_0xa552('0xe')](_0xa552('0x18'),_0x54a3e8);logger[_0xa552('0x10')]('CreateChatQueueReport',_0x54a3e8,JSON[_0xa552('0x13')](_0x480cb1));_0x35f93f(_0x480cb1);})[_0xa552('0x17')](function(_0x231500){logger[_0xa552('0x14')](_0xa552('0x18'),_0x231500[_0xa552('0x15')],_0x54a3e8);_0x1a5d1c(_0x2fb388[_0xa552('0x14')](0x1f4,_0x231500['message']));});});};exports[_0xa552('0x1b')]=function(_0x1dc727){var _0x188474=this;return new Promise(function(_0x595ea8,_0x5230e6){return db[_0xa552('0x19')][_0xa552('0x1c')](_0x1dc727[_0xa552('0x1d')],{'raw':_0x1dc727[_0xa552('0x1e')]?_0x1dc727[_0xa552('0x1e')][_0xa552('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dc727['options']?_0x1dc727[_0xa552('0x1e')][_0xa552('0x1f')]||null:null,'attributes':_0x1dc727[_0xa552('0x1e')]?_0x1dc727['options'][_0xa552('0x20')]||null:null,'limit':_0x1dc727[_0xa552('0x1e')]?_0x1dc727[_0xa552('0x1e')][_0xa552('0x21')]||null:null})[_0xa552('0xd')](function(_0x5ba43c){logger[_0xa552('0xe')](_0xa552('0x1b'),_0x1dc727);logger[_0xa552('0x10')](_0xa552('0x1b'),_0x1dc727,JSON[_0xa552('0x13')](_0x5ba43c));_0x595ea8(_0x5ba43c);})[_0xa552('0x17')](function(_0x55c155){logger[_0xa552('0x14')](_0xa552('0x1b'),_0x55c155[_0xa552('0x15')],_0x1dc727);_0x5230e6(_0x188474[_0xa552('0x14')](0x1f4,_0x55c155[_0xa552('0x15')]));});});}; \ No newline at end of file +var _0xbd46=['update','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport'];(function(_0x13e407,_0x58b7ba){var _0x3c55ec=function(_0x4c93b8){while(--_0x4c93b8){_0x13e407['push'](_0x13e407['shift']());}};_0x3c55ec(++_0x58b7ba);}(_0xbd46,0xca));var _0x6bd4=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xbd46[_0x9c2427];return _0x51984f;};'use strict';var _=require('lodash');var util=require(_0x6bd4('0x0'));var moment=require(_0x6bd4('0x1'));var BPromise=require(_0x6bd4('0x2'));var rs=require(_0x6bd4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6bd4('0x4'))['db'];var utils=require(_0x6bd4('0x5'));var logger=require(_0x6bd4('0x6'))(_0x6bd4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6bd4('0x8')][_0x6bd4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a4c97,_0x56b742,_0x19af5c){return new BPromise(function(_0x5e2d83,_0x1517d6){return client[_0x6bd4('0xa')](_0x2a4c97,_0x19af5c)[_0x6bd4('0xb')](function(_0x4941e7){logger[_0x6bd4('0xc')](_0x6bd4('0xd'),_0x56b742,_0x6bd4('0xe'));logger[_0x6bd4('0xf')](_0x6bd4('0x10'),_0x56b742,_0x6bd4('0xe'),JSON[_0x6bd4('0x11')](_0x4941e7));if(_0x4941e7['error']){if(_0x4941e7[_0x6bd4('0x12')][_0x6bd4('0x13')]===0x1f4){logger[_0x6bd4('0x12')](_0x6bd4('0xd'),_0x56b742,_0x4941e7[_0x6bd4('0x12')][_0x6bd4('0x14')]);return _0x1517d6(_0x4941e7[_0x6bd4('0x12')]['message']);}logger[_0x6bd4('0x12')](_0x6bd4('0xd'),_0x56b742,_0x4941e7[_0x6bd4('0x12')][_0x6bd4('0x14')]);return _0x5e2d83(_0x4941e7[_0x6bd4('0x12')][_0x6bd4('0x14')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x56b742,_0x6bd4('0xe'));_0x5e2d83(_0x4941e7['result'][_0x6bd4('0x14')]);}})[_0x6bd4('0x15')](function(_0x46b2d7){logger[_0x6bd4('0x12')](_0x6bd4('0xd'),_0x56b742,_0x46b2d7);_0x1517d6(_0x46b2d7);});});}exports[_0x6bd4('0x16')]=function(_0x43e5fc){var _0x4af44a=this;return new Promise(function(_0x1cffc4,_0x52a12a){return db[_0x6bd4('0x17')][_0x6bd4('0x18')](_0x43e5fc[_0x6bd4('0x19')],{'raw':_0x43e5fc[_0x6bd4('0x1a')]?_0x43e5fc[_0x6bd4('0x1a')][_0x6bd4('0x1b')]===undefined?!![]:![]:!![]})[_0x6bd4('0xb')](function(_0x179148){logger[_0x6bd4('0xc')]('CreateChatQueueReport',_0x43e5fc);logger[_0x6bd4('0xf')]('CreateChatQueueReport',_0x43e5fc,JSON[_0x6bd4('0x11')](_0x179148));_0x1cffc4(_0x179148);})[_0x6bd4('0x15')](function(_0xdf57c7){logger['error'](_0x6bd4('0x16'),_0xdf57c7[_0x6bd4('0x14')],_0x43e5fc);_0x52a12a(_0x4af44a[_0x6bd4('0x12')](0x1f4,_0xdf57c7['message']));});});};exports[_0x6bd4('0x1c')]=function(_0x3e8fcc){var _0x84c996=this;return new Promise(function(_0x3aa9e6,_0x9be956){return db[_0x6bd4('0x17')][_0x6bd4('0x1d')](_0x3e8fcc['body'],{'raw':_0x3e8fcc[_0x6bd4('0x1a')]?_0x3e8fcc[_0x6bd4('0x1a')][_0x6bd4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e8fcc[_0x6bd4('0x1a')]?_0x3e8fcc[_0x6bd4('0x1a')][_0x6bd4('0x1e')]||null:null,'attributes':_0x3e8fcc['options']?_0x3e8fcc[_0x6bd4('0x1a')][_0x6bd4('0x1f')]||null:null,'limit':_0x3e8fcc[_0x6bd4('0x1a')]?_0x3e8fcc['options'][_0x6bd4('0x20')]||null:null})[_0x6bd4('0xb')](function(_0x5254ad){logger[_0x6bd4('0xc')](_0x6bd4('0x1c'),_0x3e8fcc);logger[_0x6bd4('0xf')](_0x6bd4('0x1c'),_0x3e8fcc,JSON[_0x6bd4('0x11')](_0x5254ad));_0x3aa9e6(_0x5254ad);})[_0x6bd4('0x15')](function(_0x59de5b){logger[_0x6bd4('0x12')]('UpdateChatQueueReport',_0x59de5b[_0x6bd4('0x14')],_0x3e8fcc);_0x9be956(_0x84c996[_0x6bd4('0x12')](0x1f4,_0x59de5b['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c20a7a9..15ac944 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 _0x41d9=['Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x25fd7c,_0x4a8990){var _0x2623b9=function(_0x1604d3){while(--_0x1604d3){_0x25fd7c['push'](_0x25fd7c['shift']());}};_0x2623b9(++_0x4a8990);}(_0x41d9,0x1b3));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var path=require(_0x941d('0x2'));var timeout=require(_0x941d('0x3'));var express=require(_0x941d('0x4'));var router=express[_0x941d('0x5')]();var auth=require(_0x941d('0x6'));var interaction=require(_0x941d('0x7'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x941d('0x8')]('/',auth['isAuthenticated'](),controller[_0x941d('0x9')]);router[_0x941d('0x8')](_0x941d('0xa'),auth[_0x941d('0xb')](),controller[_0x941d('0xc')]);router['get'](_0x941d('0xd'),auth[_0x941d('0xb')](),controller['show']);router[_0x941d('0xe')]('/',auth['isAuthenticated'](),controller[_0x941d('0xf')]);router['put'](_0x941d('0xd'),auth[_0x941d('0xb')](),controller[_0x941d('0x10')]);router[_0x941d('0x11')](_0x941d('0xd'),auth[_0x941d('0xb')](),controller[_0x941d('0x12')]);module[_0x941d('0x13')]=router; \ No newline at end of file +var _0x2e4b=['index','/describe','describe','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x47a8da,_0x5ca7d9){var _0x49e860=function(_0x5ea3ff){while(--_0x5ea3ff){_0x47a8da['push'](_0x47a8da['shift']());}};_0x49e860(++_0x5ca7d9);}(_0x2e4b,0x16f));var _0xb2e4=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x2e4b[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0xb2e4('0x0'));var util=require(_0xb2e4('0x1'));var path=require(_0xb2e4('0x2'));var timeout=require(_0xb2e4('0x3'));var express=require(_0xb2e4('0x4'));var router=express[_0xb2e4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb2e4('0x6'));var config=require(_0xb2e4('0x7'));var controller=require(_0xb2e4('0x8'));router[_0xb2e4('0x9')]('/',auth[_0xb2e4('0xa')](),controller[_0xb2e4('0xb')]);router[_0xb2e4('0x9')](_0xb2e4('0xc'),auth[_0xb2e4('0xa')](),controller[_0xb2e4('0xd')]);router[_0xb2e4('0x9')](_0xb2e4('0xe'),auth['isAuthenticated'](),controller[_0xb2e4('0xf')]);router[_0xb2e4('0x10')]('/',auth[_0xb2e4('0xa')](),controller[_0xb2e4('0x11')]);router[_0xb2e4('0x12')]('/:id',auth[_0xb2e4('0xa')](),controller[_0xb2e4('0x13')]);router['delete'](_0xb2e4('0xe'),auth[_0xb2e4('0xa')](),controller['destroy']);module[_0xb2e4('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index f9f2a0f..5738780 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 _0x320f=['agent','queue','DATE','moment','sequelize','exports','ENUM'];(function(_0x5b2eb5,_0x50f39e){var _0x2ad9bc=function(_0xf1ebc){while(--_0xf1ebc){_0x5b2eb5['push'](_0x5b2eb5['shift']());}};_0x2ad9bc(++_0x50f39e);}(_0x320f,0x129));var _0xf320=function(_0x43422c,_0x17388f){_0x43422c=_0x43422c-0x0;var _0x5f20b8=_0x320f[_0x43422c];return _0x5f20b8;};'use strict';var moment=require(_0xf320('0x0'));var Sequelize=require(_0xf320('0x1'));module[_0xf320('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf320('0x3')]('account',_0xf320('0x4'),_0xf320('0x5')),'allowNull':![],'defaultValue':_0xf320('0x5')},'transferredAt':{'type':Sequelize[_0xf320('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x7c6b=['STRING','ENUM','account','queue','DATE','sequelize','exports'];(function(_0x78087a,_0x135b22){var _0x1a5435=function(_0xc940ff){while(--_0xc940ff){_0x78087a['push'](_0x78087a['shift']());}};_0x1a5435(++_0x135b22);}(_0x7c6b,0xe5));var _0xb7c6=function(_0x2d17ec,_0x54eb4d){_0x2d17ec=_0x2d17ec-0x0;var _0x162002=_0x7c6b[_0x2d17ec];return _0x162002;};'use strict';var moment=require('moment');var Sequelize=require(_0xb7c6('0x0'));module[_0xb7c6('0x1')]={'uniqueid':{'type':Sequelize[_0xb7c6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb7c6('0x3')](_0xb7c6('0x4'),'agent',_0xb7c6('0x5')),'allowNull':![],'defaultValue':_0xb7c6('0x5')},'transferredAt':{'type':Sequelize[_0xb7c6('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 891a5fd..ec5f9d0 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 _0xfe64=['count','offset','limit','set','Content-Range','update','then','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','ChatTransferReport','findAll','rows','show','params','rawAttributes','keys','includeAll','catch','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x1ccda2,_0x52a5de){var _0x553ec9=function(_0x1fd9c2){while(--_0x1fd9c2){_0x1ccda2['push'](_0x1ccda2['shift']());}};_0x553ec9(++_0x52a5de);}(_0xfe64,0x7a));var _0x4fe6=function(_0x2ec54a,_0x4968d7){_0x2ec54a=_0x2ec54a-0x0;var _0x3db721=_0xfe64[_0x2ec54a];return _0x3db721;};'use strict';var pdf=require(_0x4fe6('0x0'));var emlformat=require(_0x4fe6('0x1'));var rimraf=require(_0x4fe6('0x2'));var zipdir=require(_0x4fe6('0x3'));var jsonpatch=require(_0x4fe6('0x4'));var rp=require(_0x4fe6('0x5'));var moment=require(_0x4fe6('0x6'));var BPromise=require(_0x4fe6('0x7'));var Mustache=require('mustache');var util=require(_0x4fe6('0x8'));var path=require(_0x4fe6('0x9'));var sox=require('sox');var csv=require(_0x4fe6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4fe6('0xb'));var squel=require(_0x4fe6('0xc'));var crypto=require(_0x4fe6('0xd'));var jsforce=require(_0x4fe6('0xe'));var deskjs=require(_0x4fe6('0xf'));var toCsv=require(_0x4fe6('0xa'));var querystring=require(_0x4fe6('0x10'));var Papa=require(_0x4fe6('0x11'));var Redis=require(_0x4fe6('0x12'));var authService=require(_0x4fe6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4fe6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4fe6('0x15'));var utils=require(_0x4fe6('0x16'));var config=require(_0x4fe6('0x17'));var licenseUtil=require(_0x4fe6('0x18'));var db=require(_0x4fe6('0x19'))['db'];function respondWithStatusCode(_0x309627,_0x5c3b75){_0x5c3b75=_0x5c3b75||0xcc;return function(_0x848894){if(_0x848894){return _0x309627[_0x4fe6('0x1a')](_0x5c3b75);}return _0x309627[_0x4fe6('0x1b')](_0x5c3b75)[_0x4fe6('0x1c')]();};}function respondWithResult(_0x46bcfa,_0x315ffd){_0x315ffd=_0x315ffd||0xc8;return function(_0x28120a){if(_0x28120a){return _0x46bcfa[_0x4fe6('0x1b')](_0x315ffd)[_0x4fe6('0x1d')](_0x28120a);}};}function respondWithFilteredResult(_0x2379f3,_0x55c195){return function(_0x2e6e14){if(_0x2e6e14){var _0x4ad8bd=_0x2e6e14[_0x4fe6('0x1e')],_0x15d9e2=_0x55c195[_0x4fe6('0x1f')],_0x28cb88=_0x55c195[_0x4fe6('0x1f')]+_0x55c195[_0x4fe6('0x20')],_0x2b8063;if(_0x28cb88>=_0x4ad8bd){_0x28cb88=_0x4ad8bd;_0x2b8063=0xc8;}else{_0x2b8063=0xce;}_0x2379f3['status'](_0x2b8063);return _0x2379f3[_0x4fe6('0x21')](_0x4fe6('0x22'),_0x15d9e2+'-'+_0x28cb88+'/'+_0x4ad8bd)[_0x4fe6('0x1d')](_0x2e6e14);}return null;};}function patchUpdates(_0x3b982f){return function(_0xb99e22){try{jsonpatch['apply'](_0xb99e22,_0x3b982f,!![]);}catch(_0x2e5230){return BPromise['reject'](_0x2e5230);}return _0xb99e22['save']();};}function saveUpdates(_0x5e0dfb,_0x3a802a){return function(_0x1b8210){if(_0x1b8210){return _0x1b8210[_0x4fe6('0x23')](_0x5e0dfb)[_0x4fe6('0x24')](function(_0x1449ab){return _0x1449ab;});}return null;};}function removeEntity(_0x1e64ca,_0x55a4ce){return function(_0xf3d4a5){if(_0xf3d4a5){return _0xf3d4a5['destroy']()['then'](function(){_0x1e64ca[_0x4fe6('0x1b')](0xcc)[_0x4fe6('0x1c')]();});}};}function handleEntityNotFound(_0x240619,_0xbb8589){return function(_0x304f03){if(!_0x304f03){_0x240619[_0x4fe6('0x1a')](0x194);}return _0x304f03;};}function handleError(_0x1cefaf,_0x475e4c){_0x475e4c=_0x475e4c||0x1f4;return function(_0x300629){logger[_0x4fe6('0x25')](_0x300629[_0x4fe6('0x26')]);if(_0x300629[_0x4fe6('0x27')]){delete _0x300629[_0x4fe6('0x27')];}_0x1cefaf['status'](_0x475e4c)[_0x4fe6('0x28')](_0x300629);};}exports['index']=function(_0x2cf3b3,_0x5b440c){var _0x2c4950={},_0x16d409={},_0x17f60a={'count':0x0,'rows':[]};var _0x134a15=_[_0x4fe6('0x29')](db['ChatTransferReport']['rawAttributes'],function(_0x5e4a69){return{'name':_0x5e4a69[_0x4fe6('0x2a')],'type':_0x5e4a69[_0x4fe6('0x2b')][_0x4fe6('0x2c')]};});_0x16d409[_0x4fe6('0x2d')]=_['map'](_0x134a15,_0x4fe6('0x27'));_0x16d409[_0x4fe6('0x2e')]=_['keys'](_0x2cf3b3[_0x4fe6('0x2e')]);_0x16d409[_0x4fe6('0x2f')]=_[_0x4fe6('0x30')](_0x16d409[_0x4fe6('0x2d')],_0x16d409['query']);_0x2c4950[_0x4fe6('0x31')]=_[_0x4fe6('0x30')](_0x16d409[_0x4fe6('0x2d')],qs[_0x4fe6('0x32')](_0x2cf3b3[_0x4fe6('0x2e')][_0x4fe6('0x32')]));_0x2c4950[_0x4fe6('0x31')]=_0x2c4950[_0x4fe6('0x31')][_0x4fe6('0x33')]?_0x2c4950[_0x4fe6('0x31')]:_0x16d409['model'];if(!_0x2cf3b3[_0x4fe6('0x2e')][_0x4fe6('0x34')](_0x4fe6('0x35'))){_0x2c4950[_0x4fe6('0x20')]=qs[_0x4fe6('0x20')](_0x2cf3b3[_0x4fe6('0x2e')][_0x4fe6('0x20')]);_0x2c4950['offset']=qs[_0x4fe6('0x1f')](_0x2cf3b3['query'][_0x4fe6('0x1f')]);}_0x2c4950[_0x4fe6('0x36')]=qs[_0x4fe6('0x37')](_0x2cf3b3[_0x4fe6('0x2e')][_0x4fe6('0x37')]);_0x2c4950[_0x4fe6('0x38')]=qs['filters'](_['pick'](_0x2cf3b3[_0x4fe6('0x2e')],_0x16d409[_0x4fe6('0x2f')]),_0x134a15);if(_0x2cf3b3[_0x4fe6('0x2e')][_0x4fe6('0x39')]){_0x2c4950[_0x4fe6('0x38')]=_[_0x4fe6('0x3a')](_0x2c4950[_0x4fe6('0x38')],{'$or':_[_0x4fe6('0x29')](_0x134a15,function(_0x34f313){if(_0x34f313[_0x4fe6('0x2b')]!==_0x4fe6('0x3b')){var _0x37505a={};_0x37505a[_0x34f313[_0x4fe6('0x27')]]={'$like':'%'+_0x2cf3b3['query'][_0x4fe6('0x39')]+'%'};return _0x37505a;}})});}_0x2c4950=_[_0x4fe6('0x3a')]({},_0x2c4950,_0x2cf3b3[_0x4fe6('0x3c')]);var _0x14e9c2={'where':_0x2c4950[_0x4fe6('0x38')]};return db['ChatTransferReport'][_0x4fe6('0x1e')](_0x14e9c2)['then'](function(_0x6d929d){_0x17f60a[_0x4fe6('0x1e')]=_0x6d929d;if(_0x2cf3b3[_0x4fe6('0x2e')]['includeAll']){_0x2c4950[_0x4fe6('0x3d')]=[{'all':!![]}];}return db[_0x4fe6('0x3e')][_0x4fe6('0x3f')](_0x2c4950);})[_0x4fe6('0x24')](function(_0x427d58){_0x17f60a[_0x4fe6('0x40')]=_0x427d58;return _0x17f60a;})[_0x4fe6('0x24')](respondWithFilteredResult(_0x5b440c,_0x2c4950))['catch'](handleError(_0x5b440c,null));};exports[_0x4fe6('0x41')]=function(_0x27a2b2,_0x21da08){var _0x2676ea={'raw':!![],'where':{'id':_0x27a2b2[_0x4fe6('0x42')]['id']}},_0x3dab99={};_0x3dab99['model']=_['keys'](db['ChatTransferReport'][_0x4fe6('0x43')]);_0x3dab99[_0x4fe6('0x2e')]=_[_0x4fe6('0x44')](_0x27a2b2[_0x4fe6('0x2e')]);_0x3dab99[_0x4fe6('0x2f')]=_[_0x4fe6('0x30')](_0x3dab99['model'],_0x3dab99[_0x4fe6('0x2e')]);_0x2676ea['attributes']=_[_0x4fe6('0x30')](_0x3dab99[_0x4fe6('0x2d')],qs[_0x4fe6('0x32')](_0x27a2b2[_0x4fe6('0x2e')][_0x4fe6('0x32')]));_0x2676ea[_0x4fe6('0x31')]=_0x2676ea['attributes'][_0x4fe6('0x33')]?_0x2676ea['attributes']:_0x3dab99[_0x4fe6('0x2d')];if(_0x27a2b2[_0x4fe6('0x2e')][_0x4fe6('0x45')]){_0x2676ea[_0x4fe6('0x3d')]=[{'all':!![]}];}_0x2676ea=_['merge']({},_0x2676ea,_0x27a2b2['options']);return db['ChatTransferReport']['find'](_0x2676ea)['then'](handleEntityNotFound(_0x21da08,null))[_0x4fe6('0x24')](respondWithResult(_0x21da08,null))[_0x4fe6('0x46')](handleError(_0x21da08,null));};exports[_0x4fe6('0x47')]=function(_0x35025d,_0x30c830){return db[_0x4fe6('0x3e')]['create'](_0x35025d[_0x4fe6('0x48')],{})[_0x4fe6('0x24')](respondWithResult(_0x30c830,0xc9))[_0x4fe6('0x46')](handleError(_0x30c830,null));};exports[_0x4fe6('0x23')]=function(_0x1b2da8,_0x1bd74a){if(_0x1b2da8[_0x4fe6('0x48')]['id']){delete _0x1b2da8['body']['id'];}return db[_0x4fe6('0x3e')][_0x4fe6('0x49')]({'where':{'id':_0x1b2da8['params']['id']}})['then'](handleEntityNotFound(_0x1bd74a,null))[_0x4fe6('0x24')](saveUpdates(_0x1b2da8[_0x4fe6('0x48')],null))[_0x4fe6('0x24')](respondWithResult(_0x1bd74a,null))[_0x4fe6('0x46')](handleError(_0x1bd74a,null));};exports[_0x4fe6('0x4a')]=function(_0x313e29,_0x5f1536){return db['ChatTransferReport']['find']({'where':{'id':_0x313e29[_0x4fe6('0x42')]['id']}})[_0x4fe6('0x24')](handleEntityNotFound(_0x5f1536,null))[_0x4fe6('0x24')](removeEntity(_0x5f1536,null))[_0x4fe6('0x46')](handleError(_0x5f1536,null));};exports[_0x4fe6('0x4b')]=function(_0x3ede4a,_0x14db5a){return db['ChatTransferReport'][_0x4fe6('0x4b')]()[_0x4fe6('0x24')](respondWithResult(_0x14db5a,null))[_0x4fe6('0x46')](handleError(_0x14db5a,null));}; \ No newline at end of file +var _0xca80=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','ChatTransferReport','includeAll','findAll','rows','show','params','include','find','catch','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x3bdd7a,_0x533977){var _0x78e7b=function(_0x22aaa8){while(--_0x22aaa8){_0x3bdd7a['push'](_0x3bdd7a['shift']());}};_0x78e7b(++_0x533977);}(_0xca80,0x1a6));var _0x0ca8=function(_0x5d5fcd,_0x165444){_0x5d5fcd=_0x5d5fcd-0x0;var _0x5ec451=_0xca80[_0x5d5fcd];return _0x5ec451;};'use strict';var pdf=require(_0x0ca8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0ca8('0x1'));var zipdir=require(_0x0ca8('0x2'));var jsonpatch=require(_0x0ca8('0x3'));var rp=require(_0x0ca8('0x4'));var moment=require(_0x0ca8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0ca8('0x6'));var path=require(_0x0ca8('0x7'));var sox=require('sox');var csv=require(_0x0ca8('0x8'));var ejs=require(_0x0ca8('0x9'));var fs=require('fs');var _=require(_0x0ca8('0xa'));var squel=require(_0x0ca8('0xb'));var crypto=require(_0x0ca8('0xc'));var jsforce=require(_0x0ca8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0ca8('0x8'));var querystring=require(_0x0ca8('0xe'));var Papa=require(_0x0ca8('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0ca8('0x10'));var hardwareService=require(_0x0ca8('0x11'));var logger=require('../../config/logger')(_0x0ca8('0x12'));var utils=require(_0x0ca8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0ca8('0x14'));var db=require(_0x0ca8('0x15'))['db'];function respondWithStatusCode(_0x26d67a,_0x1f8fdc){_0x1f8fdc=_0x1f8fdc||0xcc;return function(_0x2f82ac){if(_0x2f82ac){return _0x26d67a[_0x0ca8('0x16')](_0x1f8fdc);}return _0x26d67a[_0x0ca8('0x17')](_0x1f8fdc)[_0x0ca8('0x18')]();};}function respondWithResult(_0x1ecdcf,_0xe54b41){_0xe54b41=_0xe54b41||0xc8;return function(_0x5c47e2){if(_0x5c47e2){return _0x1ecdcf[_0x0ca8('0x17')](_0xe54b41)[_0x0ca8('0x19')](_0x5c47e2);}};}function respondWithFilteredResult(_0x2dfb57,_0x2a0fd0){return function(_0x4437e7){if(_0x4437e7){var _0x15cb9c=_0x4437e7[_0x0ca8('0x1a')],_0xa31508=_0x2a0fd0['offset'],_0x1efbc0=_0x2a0fd0[_0x0ca8('0x1b')]+_0x2a0fd0[_0x0ca8('0x1c')],_0xf38699;if(_0x1efbc0>=_0x15cb9c){_0x1efbc0=_0x15cb9c;_0xf38699=0xc8;}else{_0xf38699=0xce;}_0x2dfb57[_0x0ca8('0x17')](_0xf38699);return _0x2dfb57[_0x0ca8('0x1d')](_0x0ca8('0x1e'),_0xa31508+'-'+_0x1efbc0+'/'+_0x15cb9c)['json'](_0x4437e7);}return null;};}function patchUpdates(_0x4364e3){return function(_0x37f45d){try{jsonpatch[_0x0ca8('0x1f')](_0x37f45d,_0x4364e3,!![]);}catch(_0x5a975a){return BPromise[_0x0ca8('0x20')](_0x5a975a);}return _0x37f45d[_0x0ca8('0x21')]();};}function saveUpdates(_0x12f5d5,_0x111815){return function(_0x9b3ec4){if(_0x9b3ec4){return _0x9b3ec4[_0x0ca8('0x22')](_0x12f5d5)[_0x0ca8('0x23')](function(_0x142626){return _0x142626;});}return null;};}function removeEntity(_0xd897e5,_0x10319f){return function(_0x433293){if(_0x433293){return _0x433293[_0x0ca8('0x24')]()[_0x0ca8('0x23')](function(){_0xd897e5[_0x0ca8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7b0be7,_0x4fc785){return function(_0x594422){if(!_0x594422){_0x7b0be7['sendStatus'](0x194);}return _0x594422;};}function handleError(_0x47efcf,_0x4cc962){_0x4cc962=_0x4cc962||0x1f4;return function(_0x41a7ce){logger[_0x0ca8('0x25')](_0x41a7ce[_0x0ca8('0x26')]);if(_0x41a7ce[_0x0ca8('0x27')]){delete _0x41a7ce[_0x0ca8('0x27')];}_0x47efcf[_0x0ca8('0x17')](_0x4cc962)[_0x0ca8('0x28')](_0x41a7ce);};}exports[_0x0ca8('0x29')]=function(_0x29efd4,_0x510567){var _0x16dedc={},_0x444ef7={},_0x50e85b={'count':0x0,'rows':[]};var _0x4d9602=_[_0x0ca8('0x2a')](db['ChatTransferReport'][_0x0ca8('0x2b')],function(_0x28987d){return{'name':_0x28987d['fieldName'],'type':_0x28987d[_0x0ca8('0x2c')][_0x0ca8('0x2d')]};});_0x444ef7[_0x0ca8('0x2e')]=_[_0x0ca8('0x2a')](_0x4d9602,_0x0ca8('0x27'));_0x444ef7[_0x0ca8('0x2f')]=_[_0x0ca8('0x30')](_0x29efd4[_0x0ca8('0x2f')]);_0x444ef7['filters']=_['intersection'](_0x444ef7[_0x0ca8('0x2e')],_0x444ef7['query']);_0x16dedc[_0x0ca8('0x31')]=_[_0x0ca8('0x32')](_0x444ef7[_0x0ca8('0x2e')],qs['fields'](_0x29efd4['query'][_0x0ca8('0x33')]));_0x16dedc['attributes']=_0x16dedc[_0x0ca8('0x31')][_0x0ca8('0x34')]?_0x16dedc['attributes']:_0x444ef7[_0x0ca8('0x2e')];if(!_0x29efd4[_0x0ca8('0x2f')][_0x0ca8('0x35')](_0x0ca8('0x36'))){_0x16dedc[_0x0ca8('0x1c')]=qs[_0x0ca8('0x1c')](_0x29efd4['query'][_0x0ca8('0x1c')]);_0x16dedc['offset']=qs[_0x0ca8('0x1b')](_0x29efd4[_0x0ca8('0x2f')][_0x0ca8('0x1b')]);}_0x16dedc[_0x0ca8('0x37')]=qs[_0x0ca8('0x38')](_0x29efd4[_0x0ca8('0x2f')]['sort']);_0x16dedc[_0x0ca8('0x39')]=qs[_0x0ca8('0x3a')](_[_0x0ca8('0x3b')](_0x29efd4['query'],_0x444ef7['filters']),_0x4d9602);if(_0x29efd4[_0x0ca8('0x2f')][_0x0ca8('0x3c')]){_0x16dedc[_0x0ca8('0x39')]=_[_0x0ca8('0x3d')](_0x16dedc[_0x0ca8('0x39')],{'$or':_[_0x0ca8('0x2a')](_0x4d9602,function(_0x46d468){if(_0x46d468[_0x0ca8('0x2c')]!=='VIRTUAL'){var _0x1375c7={};_0x1375c7[_0x46d468[_0x0ca8('0x27')]]={'$like':'%'+_0x29efd4['query'][_0x0ca8('0x3c')]+'%'};return _0x1375c7;}})});}_0x16dedc=_[_0x0ca8('0x3d')]({},_0x16dedc,_0x29efd4[_0x0ca8('0x3e')]);var _0x91718a={'where':_0x16dedc[_0x0ca8('0x39')]};return db[_0x0ca8('0x3f')][_0x0ca8('0x1a')](_0x91718a)[_0x0ca8('0x23')](function(_0x56c5e9){_0x50e85b[_0x0ca8('0x1a')]=_0x56c5e9;if(_0x29efd4[_0x0ca8('0x2f')][_0x0ca8('0x40')]){_0x16dedc['include']=[{'all':!![]}];}return db[_0x0ca8('0x3f')][_0x0ca8('0x41')](_0x16dedc);})['then'](function(_0x244536){_0x50e85b[_0x0ca8('0x42')]=_0x244536;return _0x50e85b;})[_0x0ca8('0x23')](respondWithFilteredResult(_0x510567,_0x16dedc))['catch'](handleError(_0x510567,null));};exports[_0x0ca8('0x43')]=function(_0x416940,_0x5ee727){var _0x4eceaf={'raw':!![],'where':{'id':_0x416940[_0x0ca8('0x44')]['id']}},_0x3a7db9={};_0x3a7db9[_0x0ca8('0x2e')]=_[_0x0ca8('0x30')](db[_0x0ca8('0x3f')][_0x0ca8('0x2b')]);_0x3a7db9['query']=_[_0x0ca8('0x30')](_0x416940['query']);_0x3a7db9[_0x0ca8('0x3a')]=_[_0x0ca8('0x32')](_0x3a7db9[_0x0ca8('0x2e')],_0x3a7db9['query']);_0x4eceaf[_0x0ca8('0x31')]=_[_0x0ca8('0x32')](_0x3a7db9[_0x0ca8('0x2e')],qs[_0x0ca8('0x33')](_0x416940[_0x0ca8('0x2f')][_0x0ca8('0x33')]));_0x4eceaf[_0x0ca8('0x31')]=_0x4eceaf[_0x0ca8('0x31')][_0x0ca8('0x34')]?_0x4eceaf[_0x0ca8('0x31')]:_0x3a7db9[_0x0ca8('0x2e')];if(_0x416940[_0x0ca8('0x2f')][_0x0ca8('0x40')]){_0x4eceaf[_0x0ca8('0x45')]=[{'all':!![]}];}_0x4eceaf=_[_0x0ca8('0x3d')]({},_0x4eceaf,_0x416940['options']);return db[_0x0ca8('0x3f')][_0x0ca8('0x46')](_0x4eceaf)[_0x0ca8('0x23')](handleEntityNotFound(_0x5ee727,null))[_0x0ca8('0x23')](respondWithResult(_0x5ee727,null))[_0x0ca8('0x47')](handleError(_0x5ee727,null));};exports['create']=function(_0x5e4b1c,_0x68e0dc){return db['ChatTransferReport']['create'](_0x5e4b1c[_0x0ca8('0x48')],{})[_0x0ca8('0x23')](respondWithResult(_0x68e0dc,0xc9))['catch'](handleError(_0x68e0dc,null));};exports[_0x0ca8('0x22')]=function(_0x49796b,_0x47e36f){if(_0x49796b[_0x0ca8('0x48')]['id']){delete _0x49796b[_0x0ca8('0x48')]['id'];}return db[_0x0ca8('0x3f')][_0x0ca8('0x46')]({'where':{'id':_0x49796b[_0x0ca8('0x44')]['id']}})[_0x0ca8('0x23')](handleEntityNotFound(_0x47e36f,null))[_0x0ca8('0x23')](saveUpdates(_0x49796b[_0x0ca8('0x48')],null))['then'](respondWithResult(_0x47e36f,null))[_0x0ca8('0x47')](handleError(_0x47e36f,null));};exports[_0x0ca8('0x24')]=function(_0x48f2f3,_0x175afc){return db[_0x0ca8('0x3f')]['find']({'where':{'id':_0x48f2f3['params']['id']}})[_0x0ca8('0x23')](handleEntityNotFound(_0x175afc,null))[_0x0ca8('0x23')](removeEntity(_0x175afc,null))['catch'](handleError(_0x175afc,null));};exports[_0x0ca8('0x49')]=function(_0x245a3b,_0x282db2){return db['ChatTransferReport'][_0x0ca8('0x49')]()[_0x0ca8('0x23')](respondWithResult(_0x282db2,null))[_0x0ca8('0x47')](handleError(_0x282db2,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index f02aca8..2b7d311 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 _0x4b83=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x592f6e,_0x23c902){var _0x1504ea=function(_0x38b54e){while(--_0x38b54e){_0x592f6e['push'](_0x592f6e['shift']());}};_0x1504ea(++_0x23c902);}(_0x4b83,0xba));var _0x34b8=function(_0x4d6f62,_0x1342d4){_0x4d6f62=_0x4d6f62-0x0;var _0x26c1cf=_0x4b83[_0x4d6f62];return _0x26c1cf;};'use strict';var _=require(_0x34b8('0x0'));var util=require(_0x34b8('0x1'));var logger=require(_0x34b8('0x2'))('api');var moment=require(_0x34b8('0x3'));var BPromise=require(_0x34b8('0x4'));var rp=require(_0x34b8('0x5'));var fs=require('fs');var path=require(_0x34b8('0x6'));var rimraf=require(_0x34b8('0x7'));var config=require(_0x34b8('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0x34b8('0x9')]=function(_0x527f7b,_0x1ff371){return _0x527f7b[_0x34b8('0xa')](_0x34b8('0xb'),attributes,{'tableName':_0x34b8('0xc'),'paranoid':![],'indexes':[{'name':_0x34b8('0xd'),'fields':[_0x34b8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb28c=['path','rimraf','../../config/environment','define','ChatTransferReport','report_chat_transfer','uniqueid','util','api','moment','bluebird'];(function(_0x50e7aa,_0x2ea713){var _0x2d3384=function(_0x1fd271){while(--_0x1fd271){_0x50e7aa['push'](_0x50e7aa['shift']());}};_0x2d3384(++_0x2ea713);}(_0xb28c,0x6a));var _0xcb28=function(_0x26b775,_0x263618){_0x26b775=_0x26b775-0x0;var _0xeb81d0=_0xb28c[_0x26b775];return _0xeb81d0;};'use strict';var _=require('lodash');var util=require(_0xcb28('0x0'));var logger=require('../../config/logger')(_0xcb28('0x1'));var moment=require(_0xcb28('0x2'));var BPromise=require(_0xcb28('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb28('0x4'));var rimraf=require(_0xcb28('0x5'));var config=require(_0xcb28('0x6'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x361549,_0x56aae4){return _0x361549[_0xcb28('0x7')](_0xcb28('0x8'),attributes,{'tableName':_0xcb28('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcb28('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 1966f6f..8e0b69c 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 _0x0793=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x4d3f9d,_0x19acd4){var _0x14f5d4=function(_0x5dfe8d){while(--_0x5dfe8d){_0x4d3f9d['push'](_0x4d3f9d['shift']());}};_0x14f5d4(++_0x19acd4);}(_0x0793,0x131));var _0x3079=function(_0x52e9a9,_0x346b5f){_0x52e9a9=_0x52e9a9-0x0;var _0x3e7432=_0x0793[_0x52e9a9];return _0x3e7432;};'use strict';var _=require(_0x3079('0x0'));var util=require(_0x3079('0x1'));var moment=require(_0x3079('0x2'));var BPromise=require('bluebird');var rs=require(_0x3079('0x3'));var fs=require('fs');var Redis=require(_0x3079('0x4'));var db=require(_0x3079('0x5'))['db'];var utils=require(_0x3079('0x6'));var logger=require(_0x3079('0x7'))('rpc');var config=require(_0x3079('0x8'));var jayson=require(_0x3079('0x9'));var client=jayson[_0x3079('0xa')][_0x3079('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e150e,_0x549973,_0x1591b3){return new BPromise(function(_0x3d4bec,_0x41a2d8){return client['request'](_0x2e150e,_0x1591b3)['then'](function(_0x3b0100){logger[_0x3079('0xc')](_0x3079('0xd'),_0x549973,_0x3079('0xe'));logger[_0x3079('0xf')](_0x3079('0x10'),_0x549973,_0x3079('0xe'),JSON[_0x3079('0x11')](_0x3b0100));if(_0x3b0100[_0x3079('0x12')]){if(_0x3b0100['error']['code']===0x1f4){logger['error'](_0x3079('0xd'),_0x549973,_0x3b0100[_0x3079('0x12')]['message']);return _0x41a2d8(_0x3b0100[_0x3079('0x12')][_0x3079('0x13')]);}logger[_0x3079('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x549973,_0x3b0100['error'][_0x3079('0x13')]);return _0x3d4bec(_0x3b0100[_0x3079('0x12')]['message']);}else{logger[_0x3079('0xc')](_0x3079('0xd'),_0x549973,_0x3079('0xe'));_0x3d4bec(_0x3b0100[_0x3079('0x14')]['message']);}})[_0x3079('0x15')](function(_0x354f01){logger['error'](_0x3079('0xd'),_0x549973,_0x354f01);_0x41a2d8(_0x354f01);});});} \ No newline at end of file +var _0xecad=['message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1c2465,_0x47d416){var _0x4ee15b=function(_0x1a8544){while(--_0x1a8544){_0x1c2465['push'](_0x1c2465['shift']());}};_0x4ee15b(++_0x47d416);}(_0xecad,0xab));var _0xdeca=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xecad[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xdeca('0x0'));var util=require(_0xdeca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdeca('0x2'));var fs=require('fs');var Redis=require(_0xdeca('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeca('0x4'));var logger=require(_0xdeca('0x5'))(_0xdeca('0x6'));var config=require(_0xdeca('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdeca('0x8')][_0xdeca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c8aea,_0x4a4158,_0x23d593){return new BPromise(function(_0x2e481a,_0xd1c177){return client[_0xdeca('0xa')](_0x5c8aea,_0x23d593)[_0xdeca('0xb')](function(_0x5108a5){logger[_0xdeca('0xc')](_0xdeca('0xd'),_0x4a4158,_0xdeca('0xe'));logger[_0xdeca('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4a4158,_0xdeca('0xe'),JSON[_0xdeca('0x10')](_0x5108a5));if(_0x5108a5[_0xdeca('0x11')]){if(_0x5108a5['error']['code']===0x1f4){logger[_0xdeca('0x11')](_0xdeca('0xd'),_0x4a4158,_0x5108a5[_0xdeca('0x11')]['message']);return _0xd1c177(_0x5108a5[_0xdeca('0x11')][_0xdeca('0x12')]);}logger['error'](_0xdeca('0xd'),_0x4a4158,_0x5108a5[_0xdeca('0x11')]['message']);return _0x2e481a(_0x5108a5[_0xdeca('0x11')]['message']);}else{logger[_0xdeca('0xc')](_0xdeca('0xd'),_0x4a4158,_0xdeca('0xe'));_0x2e481a(_0x5108a5[_0xdeca('0x13')][_0xdeca('0x12')]);}})[_0xdeca('0x14')](function(_0x2d02db){logger[_0xdeca('0x11')](_0xdeca('0xd'),_0x4a4158,_0x2d02db);_0xd1c177(_0x2d02db);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index ec22a1f..80fa8d0 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 _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0x2b6dd0,_0x3cd07b){var _0x29e9a5=function(_0x3a70b2){while(--_0x3a70b2){_0x2b6dd0['push'](_0x2b6dd0['shift']());}};_0x29e9a5(++_0x3cd07b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x0b0e[_0x478414];return _0x5eb6b9;};'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['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=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(_0xf95c83,_0x3c0965){var _0x2463f3=function(_0x792791){while(--_0x792791){_0xf95c83['push'](_0xf95c83['shift']());}};_0x2463f3(++_0x3c0965);}(_0x2032,0xd9));var _0x2203=function(_0x184c4a,_0x4d3e43){_0x184c4a=_0x184c4a-0x0;var _0x4b7e59=_0x2032[_0x184c4a];return _0x4b7e59;};'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 5b19058..c66741a 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 _0x6cca=['stringify','input','text','name','getDataValue','onlineForm','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','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','INTEGER','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','address','email','#011F6A','#ffffff','rounded','squared','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','BOOLEAN','Feedback','ENUM','star','thumb'];(function(_0x125777,_0x308240){var _0x24208f=function(_0x3d179f){while(--_0x3d179f){_0x125777['push'](_0x125777['shift']());}};_0x24208f(++_0x308240);}(_0x6cca,0x10e));var _0xa6cc=function(_0x38cbb6,_0x5c73ec){_0x38cbb6=_0x38cbb6-0x0;var _0x4fe3fe=_0x6cca[_0x38cbb6];return _0x4fe3fe;};'use strict';var Sequelize=require(_0xa6cc('0x0'));var rs=require(_0xa6cc('0x1'));module['exports']={'name':{'type':Sequelize[_0xa6cc('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xa6cc('0x2')],'allowNull':![],'unique':_0xa6cc('0x3')},'description':{'type':Sequelize[_0xa6cc('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xa6cc('0x4')},'mapKeyOffline':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x4')},'key':{'type':Sequelize[_0xa6cc('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa6cc('0x2')],'allowNull':![],'defaultValue':_0xa6cc('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa6cc('0x2')],'allowNull':![],'defaultValue':_0xa6cc('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa6cc('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa6cc('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xa6cc('0x7'),_0xa6cc('0x8')),'defaultValue':_0xa6cc('0x7')},'header_online':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x9')},'offline_chat_button':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0xa')},'header_offline':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0xb')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0xc')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa6cc('0xd')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xa6cc('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x10')},'noteTitle':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x11')},'placeholderMessage':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x12')},'closingMessage':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0xa')},'skipMessageButton':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xa6cc('0x14')},'ratingType':{'type':Sequelize[_0xa6cc('0x15')](_0xa6cc('0x16'),_0xa6cc('0x17')),'defaultValue':_0xa6cc('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa6cc('0xd')],'defaultValue':function(){return JSON[_0xa6cc('0x18')]({'items':[{'type':_0xa6cc('0x19'),'variable':null,'config':{'placeholder':'name','type':_0xa6cc('0x1a'),'required':!![]},'props':{'title':_0xa6cc('0x1b'),'helpText':''}},{'type':_0xa6cc('0x19'),'props':{'title':_0xa6cc('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xa6cc('0x4'),'type':_0xa6cc('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xa6cc('0x1c')](_0xa6cc('0x1d'))?JSON['parse'](this[_0xa6cc('0x1c')](_0xa6cc('0x1d'))):{};},'set':function(_0x1aa1ba){return this[_0xa6cc('0x1e')]('onlineForm',JSON[_0xa6cc('0x18')](_0x1aa1ba));}},'offlineForm':{'type':Sequelize[_0xa6cc('0xd')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xa6cc('0x19'),'props':{'title':_0xa6cc('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xa6cc('0x4'),'type':_0xa6cc('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0xa6cc('0x1f'),'helpText':_0xa6cc('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xa6cc('0x1c')](_0xa6cc('0x21'))?JSON[_0xa6cc('0x22')](this[_0xa6cc('0x1c')](_0xa6cc('0x21'))):{};},'set':function(_0x55eb9b){return this['setDataValue'](_0xa6cc('0x21'),JSON[_0xa6cc('0x18')](_0x55eb9b));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa6cc('0x23')]();}},'autoclose':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xa6cc('0x2')]},'waitingTitle':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa6cc('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x26')},'skipUnmanaged':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x27')},'sendUnmanaged':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa6cc('0xd')]},'showAgentAvatar':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xa6cc('0xd')],'defaultValue':function(){return _0xa6cc('0x28');}},'notificationSound':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xa6cc('0x2a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x2b')},'verticalAlignment':{'type':Sequelize[_0xa6cc('0x2a')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xa6cc('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa6cc('0x2')],'allowNull':![],'defaultValue':_0xa6cc('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa6cc('0x2a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa6cc('0x2a')],'comment':_0xa6cc('0x2e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x34c4ac){if(!_0x34c4ac)this[_0xa6cc('0x1e')](_0xa6cc('0x2f'),null);this[_0xa6cc('0x1e')](_0xa6cc('0x30'),_0x34c4ac);}},'vidaooEscalation':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8838=['offlineForm','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','bottom_right','alternate','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','input','name','text','getDataValue','parse','onlineForm','setDataValue','Comments'];(function(_0x313cc1,_0x59e3cd){var _0x2cb794=function(_0x41fc20){while(--_0x41fc20){_0x313cc1['push'](_0x313cc1['shift']());}};_0x2cb794(++_0x59e3cd);}(_0x8838,0xeb));var _0x8883=function(_0x247c5b,_0x5817e2){_0x247c5b=_0x247c5b-0x0;var _0x1a5f90=_0x8838[_0x247c5b];return _0x1a5f90;};'use strict';var Sequelize=require(_0x8883('0x0'));var rs=require(_0x8883('0x1'));module[_0x8883('0x2')]={'name':{'type':Sequelize[_0x8883('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x8883('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x8883('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x8883('0x4')},'mapKeyOffline':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8883('0x3')],'allowNull':![],'defaultValue':_0x8883('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8883('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8883('0x3')],'allowNull':![],'defaultValue':_0x8883('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8883('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x8883('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8883('0xa')]('rounded','squared'),'defaultValue':_0x8883('0xb')},'header_online':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x8883('0xd')},'offline_chat_button':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x8883('0xf')},'download_transcript':{'type':Sequelize[_0x8883('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8883('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x8883('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8883('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x8883('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8883('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0x13')},'noteTitle':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0x14')},'placeholderMessage':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0x15')},'closingMessage':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0x16')},'closingMessageButton':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0xe')},'skipMessageButton':{'type':Sequelize[_0x8883('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x8883('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8883('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8883('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0x17')},'ratingType':{'type':Sequelize[_0x8883('0xa')](_0x8883('0x18'),_0x8883('0x19')),'defaultValue':_0x8883('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x8883('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8883('0x11')],'defaultValue':function(){return JSON[_0x8883('0x1a')]({'items':[{'type':_0x8883('0x1b'),'variable':null,'config':{'placeholder':_0x8883('0x1c'),'type':_0x8883('0x1d'),'required':!![]},'props':{'title':_0x8883('0x1c'),'helpText':''}},{'type':_0x8883('0x1b'),'props':{'title':_0x8883('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8883('0x4'),'type':_0x8883('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8883('0x1e')]('onlineForm')?JSON[_0x8883('0x1f')](this[_0x8883('0x1e')](_0x8883('0x20'))):{};},'set':function(_0x3fb3b4){return this[_0x8883('0x21')](_0x8883('0x20'),JSON[_0x8883('0x1a')](_0x3fb3b4));}},'offlineForm':{'type':Sequelize[_0x8883('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8883('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x8883('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x8883('0x22')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x8883('0x1e')]('offlineForm')?JSON[_0x8883('0x1f')](this[_0x8883('0x1e')](_0x8883('0x23'))):{};},'set':function(_0x2a42f3){return this[_0x8883('0x21')](_0x8883('0x23'),JSON['stringify'](_0x2a42f3));}},'token':{'type':Sequelize[_0x8883('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x8883('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8883('0x3')]},'forwardOffline':{'type':Sequelize[_0x8883('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x8883('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x8883('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0x24')},'offlineMessageBody':{'type':Sequelize[_0x8883('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x8883('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0x25')},'skipUnmanaged':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0x26')},'sendUnmanaged':{'type':Sequelize[_0x8883('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x8883('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x8883('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x8883('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x8883('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8883('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x8883('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8883('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8883('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x8883('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x8883('0x3')],'defaultValue':_0x8883('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x8883('0x29')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x8883('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x8883('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8883('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8883('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8883('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8883('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8883('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8883('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x8883('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8883('0x8')],'comment':_0x8883('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0x8883('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x344177){if(!_0x344177)this[_0x8883('0x21')](_0x8883('0x2b'),null);this[_0x8883('0x21')](_0x8883('0x2c'),_0x344177);}},'vidaooEscalation':{'type':Sequelize[_0x8883('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8883('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index b22d5b7..f6d456d 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 _0x6ad8=['mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','CmContact','ChatApplication','account','Applications','list','applications','orderBy','priority','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','omit','getInteractions','Contact','User','Owner','fullname','internal','color','tag','getSnippet','timezone','interval','iftime\x20%s','ONLINE','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','some','remote','x-real-ip','connection','replace','render','alignment','verticalAlignment','textColor','addApplications','sequelize','bulkCreate','getApplications','addProactiveActions','getFields','online','offlineForm','onlineForm','items','fromKey','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','UserProfileResource','end','stack','name','send','index','Pause','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','ChatWebsite','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','find','create','body','user','get','role','ChatWebsites','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addLogo','filename','addAvatar','file','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey'];(function(_0x52a145,_0x6e566b){var _0x162422=function(_0x57b7af){while(--_0x57b7af){_0x52a145['push'](_0x52a145['shift']());}};_0x162422(++_0x6e566b);}(_0x6ad8,0x19e));var _0x86ad=function(_0x4b02f7,_0x48cf70){_0x4b02f7=_0x4b02f7-0x0;var _0x251219=_0x6ad8[_0x4b02f7];return _0x251219;};'use strict';var pdf=require(_0x86ad('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x86ad('0x1'));var zipdir=require(_0x86ad('0x2'));var jsonpatch=require(_0x86ad('0x3'));var rp=require(_0x86ad('0x4'));var moment=require(_0x86ad('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x86ad('0x6'));var util=require(_0x86ad('0x7'));var path=require(_0x86ad('0x8'));var sox=require(_0x86ad('0x9'));var csv=require(_0x86ad('0xa'));var ejs=require(_0x86ad('0xb'));var fs=require('fs');var _=require(_0x86ad('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x86ad('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x86ad('0xa'));var querystring=require(_0x86ad('0xe'));var Papa=require(_0x86ad('0xf'));var Redis=require(_0x86ad('0x10'));var authService=require(_0x86ad('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x86ad('0x12'));var hardwareService=require(_0x86ad('0x13'));var logger=require(_0x86ad('0x14'))(_0x86ad('0x15'));var utils=require(_0x86ad('0x16'));var config=require(_0x86ad('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x86ad('0x18'))['db'];config[_0x86ad('0x19')]=_[_0x86ad('0x1a')](config[_0x86ad('0x19')],{'host':_0x86ad('0x1b'),'port':0x18eb});var socket=require(_0x86ad('0x1c'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x86ad('0x1d')](socket);var jayson=require(_0x86ad('0x1e'));var client=jayson[_0x86ad('0x1f')][_0x86ad('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x86ad('0x1f')][_0x86ad('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x40fc76,_0xf267c0,_0x147341,_0x665866){return new BPromise(function(_0x118686,_0x1801f2){var _0x1267d4=_0x665866||client;return _0x1267d4['request'](_0x40fc76,_0x147341)[_0x86ad('0x21')](function(_0x5948a6){logger['info'](_0x86ad('0x22'),_0xf267c0,'request\x20sent');logger[_0x86ad('0x23')](_0x86ad('0x24'),_0xf267c0,_0x86ad('0x25'),JSON[_0x86ad('0x26')](_0x5948a6));if(_0x5948a6[_0x86ad('0x27')]){if(_0x5948a6['error'][_0x86ad('0x28')]===0x1f4){logger[_0x86ad('0x27')](_0x86ad('0x22'),_0xf267c0,_0x5948a6[_0x86ad('0x27')][_0x86ad('0x29')]);return _0x1801f2(_0x5948a6[_0x86ad('0x27')][_0x86ad('0x29')]);}logger[_0x86ad('0x27')](_0x86ad('0x22'),_0xf267c0,_0x5948a6['error'][_0x86ad('0x29')]);return _0x118686(_0x5948a6[_0x86ad('0x27')]['message']);}else{logger[_0x86ad('0x2a')](_0x86ad('0x22'),_0xf267c0,'request\x20sent');_0x118686(_0x5948a6[_0x86ad('0x2b')][_0x86ad('0x29')]);}})[_0x86ad('0x2c')](function(_0x146345){logger['error'](_0x86ad('0x22'),_0xf267c0,_0x146345);_0x1801f2(_0x146345);});});}function respondWithStatusCode(_0x394968,_0x465195){_0x465195=_0x465195||0xcc;return function(_0x59de2d){if(_0x59de2d){return _0x394968[_0x86ad('0x2d')](_0x465195);}return _0x394968['status'](_0x465195)['end']();};}function respondWithResult(_0x5b68f9,_0x454eb9){_0x454eb9=_0x454eb9||0xc8;return function(_0x401adb){if(_0x401adb){return _0x5b68f9[_0x86ad('0x2e')](_0x454eb9)[_0x86ad('0x2f')](_0x401adb);}};}function respondWithFilteredResult(_0x24e8d1,_0x2afb36){return function(_0x210313){if(_0x210313){var _0x59f691=_0x210313[_0x86ad('0x30')],_0x30ca8f=_0x2afb36['offset'],_0x38785b=_0x2afb36[_0x86ad('0x31')]+_0x2afb36[_0x86ad('0x32')],_0x48db1e;if(_0x38785b>=_0x59f691){_0x38785b=_0x59f691;_0x48db1e=0xc8;}else{_0x48db1e=0xce;}_0x24e8d1[_0x86ad('0x2e')](_0x48db1e);return _0x24e8d1[_0x86ad('0x33')](_0x86ad('0x34'),_0x30ca8f+'-'+_0x38785b+'/'+_0x59f691)['json'](_0x210313);}return null;};}function patchUpdates(_0x6834b8){return function(_0x317468){try{jsonpatch['apply'](_0x317468,_0x6834b8,!![]);}catch(_0x485c38){return BPromise[_0x86ad('0x35')](_0x485c38);}return _0x317468[_0x86ad('0x36')]();};}function saveUpdates(_0x2c78c8,_0x45ef0d){return function(_0x5ee46e){if(_0x5ee46e){return _0x5ee46e[_0x86ad('0x37')](_0x2c78c8)[_0x86ad('0x21')](function(_0xb9431b){return _0xb9431b;});}return null;};}function removeEntity(_0x3dfdc4,_0x53779d){return function(_0x393f47){if(_0x393f47){return _0x393f47[_0x86ad('0x38')]()[_0x86ad('0x21')](function(){var _0x1da834=_0x393f47['get']({'plain':!![]});var _0x315f1a='ChatWebsites';return db[_0x86ad('0x39')][_0x86ad('0x38')]({'where':{'type':_0x315f1a,'resourceId':_0x1da834['id']}})['then'](function(){return _0x393f47;});})[_0x86ad('0x21')](function(){_0x3dfdc4[_0x86ad('0x2e')](0xcc)[_0x86ad('0x3a')]();});}};}function handleEntityNotFound(_0x1f1c15,_0x3c4f7f){return function(_0x4a785c){if(!_0x4a785c){_0x1f1c15[_0x86ad('0x2d')](0x194);}return _0x4a785c;};}function handleError(_0x4bbab3,_0x17c148){_0x17c148=_0x17c148||0x1f4;return function(_0x55e7d6){logger[_0x86ad('0x27')](_0x55e7d6[_0x86ad('0x3b')]);if(_0x55e7d6['name']){delete _0x55e7d6[_0x86ad('0x3c')];}_0x4bbab3[_0x86ad('0x2e')](_0x17c148)[_0x86ad('0x3d')](_0x55e7d6);};}exports[_0x86ad('0x3e')]=function(_0x4e67c5,_0x769e3e){var _0xfaca30={'include':[{'model':db[_0x86ad('0x3f')],'as':'mandatoryDispositionPause'}]},_0x24643e={},_0x472d88={'count':0x0,'rows':[]};var _0x402556=_['map'](db['ChatWebsite'][_0x86ad('0x40')],function(_0x2afc22){return{'name':_0x2afc22[_0x86ad('0x41')],'type':_0x2afc22[_0x86ad('0x42')][_0x86ad('0x43')]};});_0x24643e['model']=_['map'](_0x402556,_0x86ad('0x3c'));_0x24643e[_0x86ad('0x44')]=_['keys'](_0x4e67c5[_0x86ad('0x44')]);_0x24643e[_0x86ad('0x45')]=_['intersection'](_0x24643e[_0x86ad('0x46')],_0x24643e[_0x86ad('0x44')]);_0xfaca30[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0x24643e['model'],qs[_0x86ad('0x49')](_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x49')]));_0xfaca30[_0x86ad('0x47')]=_0xfaca30[_0x86ad('0x47')][_0x86ad('0x4a')]?_0xfaca30[_0x86ad('0x47')]:_0x24643e['model'];if(!_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x4b')](_0x86ad('0x4c'))){_0xfaca30[_0x86ad('0x32')]=qs['limit'](_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x32')]);_0xfaca30[_0x86ad('0x31')]=qs[_0x86ad('0x31')](_0x4e67c5[_0x86ad('0x44')]['offset']);}_0xfaca30[_0x86ad('0x4d')]=qs[_0x86ad('0x4e')](_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x4e')]);_0xfaca30[_0x86ad('0x4f')]=qs['filters'](_[_0x86ad('0x50')](_0x4e67c5[_0x86ad('0x44')],_0x24643e[_0x86ad('0x45')]),_0x402556);if(_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x51')]){_0xfaca30['where']=_['merge'](_0xfaca30[_0x86ad('0x4f')],{'$or':_[_0x86ad('0x52')](_0x402556,function(_0x7f7ec){if(_0x7f7ec['type']!==_0x86ad('0x53')){var _0x29d288={};_0x29d288[_0x7f7ec[_0x86ad('0x3c')]]={'$like':'%'+_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x51')]+'%'};return _0x29d288;}})});}_0xfaca30=_[_0x86ad('0x54')]({},_0xfaca30,_0x4e67c5[_0x86ad('0x55')]);var _0x7fd43b={'where':_0xfaca30['where']};return db[_0x86ad('0x56')][_0x86ad('0x30')](_0x7fd43b)[_0x86ad('0x21')](function(_0x307320){_0x472d88['count']=_0x307320;if(_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x57')]){_0xfaca30[_0x86ad('0x58')]=[{'all':!![]}];}return db[_0x86ad('0x56')][_0x86ad('0x59')](_0xfaca30);})['then'](function(_0x17b279){_0x472d88[_0x86ad('0x5a')]=_0x17b279;return _0x472d88;})[_0x86ad('0x21')](respondWithFilteredResult(_0x769e3e,_0xfaca30))['catch'](handleError(_0x769e3e,null));};exports[_0x86ad('0x5b')]=function(_0x4e309d,_0x1e6d33){var _0x201400={'raw':![],'where':{'id':_0x4e309d[_0x86ad('0x5c')]['id']},'include':[{'model':db[_0x86ad('0x3f')],'as':_0x86ad('0x5d')}]},_0x1362d7={};_0x1362d7[_0x86ad('0x46')]=_['keys'](db['ChatWebsite'][_0x86ad('0x40')]);_0x1362d7[_0x86ad('0x44')]=_[_0x86ad('0x5e')](_0x4e309d[_0x86ad('0x44')]);_0x1362d7['filters']=_['intersection'](_0x1362d7[_0x86ad('0x46')],_0x1362d7[_0x86ad('0x44')]);_0x201400['attributes']=_[_0x86ad('0x48')](_0x1362d7['model'],qs[_0x86ad('0x49')](_0x4e309d[_0x86ad('0x44')][_0x86ad('0x49')]));_0x201400['attributes']=_0x201400[_0x86ad('0x47')][_0x86ad('0x4a')]?_0x201400['attributes']:_0x1362d7[_0x86ad('0x46')];if(_0x4e309d[_0x86ad('0x44')]['includeAll']){_0x201400[_0x86ad('0x58')]=[{'all':!![]}];}_0x201400=_[_0x86ad('0x54')]({},_0x201400,_0x4e309d[_0x86ad('0x55')]);return db['ChatWebsite'][_0x86ad('0x5f')](_0x201400)[_0x86ad('0x21')](handleEntityNotFound(_0x1e6d33,null))[_0x86ad('0x21')](respondWithResult(_0x1e6d33,null))['catch'](handleError(_0x1e6d33,null));};exports[_0x86ad('0x60')]=function(_0x129159,_0x2bdc91){return db[_0x86ad('0x56')][_0x86ad('0x60')](_0x129159[_0x86ad('0x61')],{})[_0x86ad('0x21')](function(_0x307f71){var _0x1823aa=_0x129159[_0x86ad('0x62')][_0x86ad('0x63')]({'plain':!![]});if(!_0x1823aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1823aa[_0x86ad('0x64')]==='user'){var _0x4bb854=_0x307f71[_0x86ad('0x63')]({'plain':!![]});var _0x421420=_0x86ad('0x65');return db['UserProfileSection']['find']({'where':{'name':_0x421420,'userProfileId':_0x1823aa[_0x86ad('0x66')]},'raw':!![]})[_0x86ad('0x21')](function(_0x56025a){if(_0x56025a&&_0x56025a[_0x86ad('0x67')]===0x0){return db[_0x86ad('0x39')][_0x86ad('0x60')]({'name':_0x4bb854['name'],'resourceId':_0x4bb854['id'],'type':_0x56025a[_0x86ad('0x3c')],'sectionId':_0x56025a['id']},{})[_0x86ad('0x21')](function(){return _0x307f71;});}else{return _0x307f71;}})[_0x86ad('0x2c')](function(_0x46629c){logger[_0x86ad('0x27')](_0x86ad('0x68'),_0x46629c);throw _0x46629c;});}return _0x307f71;})[_0x86ad('0x21')](respondWithResult(_0x2bdc91,0xc9))[_0x86ad('0x2c')](handleError(_0x2bdc91,null));};exports[_0x86ad('0x37')]=function(_0xc68c1b,_0x5b5d2c){if(_0xc68c1b[_0x86ad('0x61')]['id']){delete _0xc68c1b[_0x86ad('0x61')]['id'];}return db['ChatWebsite'][_0x86ad('0x5f')]({'where':{'id':_0xc68c1b[_0x86ad('0x5c')]['id']},'include':[{'model':db[_0x86ad('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x86ad('0x21')](handleEntityNotFound(_0x5b5d2c,null))[_0x86ad('0x21')](saveUpdates(_0xc68c1b['body'],null))[_0x86ad('0x21')](respondWithResult(_0x5b5d2c,null))[_0x86ad('0x2c')](handleError(_0x5b5d2c,null));};exports['destroy']=function(_0xeb4690,_0x5898a4){return db[_0x86ad('0x56')]['find']({'where':{'id':_0xeb4690[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x5898a4,null))['then'](removeEntity(_0x5898a4,null))[_0x86ad('0x2c')](handleError(_0x5898a4,null));};exports[_0x86ad('0x69')]=function(_0x584af3,_0x27df1f){return db[_0x86ad('0x56')][_0x86ad('0x69')]()[_0x86ad('0x21')](respondWithResult(_0x27df1f,null))[_0x86ad('0x2c')](handleError(_0x27df1f,null));};exports[_0x86ad('0x6a')]=function(_0x4a84f4,_0x5a421b,_0x5df9ad){if(_0x4a84f4[_0x86ad('0x61')]['id']){delete _0x4a84f4['body']['id'];}return db['ChatWebsite'][_0x86ad('0x5f')]({'where':{'id':_0x4a84f4[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x5a421b,null))[_0x86ad('0x21')](function(_0x16db6e){if(_0x16db6e){_0x4a84f4[_0x86ad('0x61')][_0x86ad('0x6b')]=_0x16db6e['id'];return db[_0x86ad('0x6c')]['create'](_0x4a84f4[_0x86ad('0x61')]);}})[_0x86ad('0x21')](respondWithResult(_0x5a421b,null))[_0x86ad('0x2c')](handleError(_0x5a421b,null));};exports[_0x86ad('0x6d')]=function(_0x299378,_0x143853,_0x1297d4){var _0x3dc894={'raw':![],'where':{}};var _0x2daf9a={};var _0x3d0b2e={'count':0x0,'rows':[]};return db[_0x86ad('0x56')][_0x86ad('0x6e')]({'where':{'id':_0x299378[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x143853,null))[_0x86ad('0x21')](function(_0x366d5b){if(_0x366d5b){_0x2daf9a['model']=_[_0x86ad('0x5e')](db[_0x86ad('0x6c')][_0x86ad('0x40')]);_0x2daf9a[_0x86ad('0x44')]=_['keys'](_0x299378[_0x86ad('0x44')]);_0x2daf9a[_0x86ad('0x45')]=_[_0x86ad('0x48')](_0x2daf9a['model'],_0x2daf9a['query']);_0x3dc894[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0x2daf9a[_0x86ad('0x46')],qs[_0x86ad('0x49')](_0x299378[_0x86ad('0x44')][_0x86ad('0x49')]));_0x3dc894[_0x86ad('0x47')]=_0x3dc894[_0x86ad('0x47')][_0x86ad('0x4a')]?_0x3dc894[_0x86ad('0x47')]:_0x2daf9a[_0x86ad('0x46')];if(!_0x299378[_0x86ad('0x44')]['hasOwnProperty']('nolimit')){_0x3dc894[_0x86ad('0x32')]=qs[_0x86ad('0x32')](_0x299378[_0x86ad('0x44')][_0x86ad('0x32')]);_0x3dc894[_0x86ad('0x31')]=qs[_0x86ad('0x31')](_0x299378[_0x86ad('0x44')][_0x86ad('0x31')]);}_0x3dc894['order']=qs[_0x86ad('0x4e')](_0x299378[_0x86ad('0x44')][_0x86ad('0x4e')]);_0x3dc894[_0x86ad('0x4f')]=qs[_0x86ad('0x45')](_[_0x86ad('0x50')](_0x299378['query'],_0x2daf9a[_0x86ad('0x45')]));_0x3dc894[_0x86ad('0x4f')][_0x86ad('0x6b')]=_0x366d5b['id'];if(_0x299378['query']['filter']){_0x3dc894[_0x86ad('0x4f')]=_[_0x86ad('0x54')](_0x3dc894[_0x86ad('0x4f')],{'$or':_['map'](_0x3dc894['attributes'],function(_0x13ce11){var _0x252654={};_0x252654[_0x13ce11]={'$like':'%'+_0x299378[_0x86ad('0x44')][_0x86ad('0x51')]+'%'};return _0x252654;})});}_0x3dc894=_[_0x86ad('0x54')]({},_0x3dc894,_0x299378[_0x86ad('0x55')]);return db[_0x86ad('0x6c')][_0x86ad('0x30')]({'where':_0x3dc894[_0x86ad('0x4f')]})[_0x86ad('0x21')](function(_0x5d32df){_0x3d0b2e['count']=_0x5d32df;if(_0x299378[_0x86ad('0x44')][_0x86ad('0x57')]){_0x3dc894['include']=[{'all':!![]}];}return db[_0x86ad('0x6c')]['findAll'](_0x3dc894);})[_0x86ad('0x21')](function(_0x37363e){_0x3d0b2e[_0x86ad('0x5a')]=_0x37363e;return _0x3d0b2e;});}})[_0x86ad('0x21')](respondWithFilteredResult(_0x143853,_0x3dc894))[_0x86ad('0x2c')](handleError(_0x143853,null));};exports[_0x86ad('0x6f')]=function(_0x5449b6,_0x224ac4,_0x13131f){return db['ChatWebsite'][_0x86ad('0x5f')]({'where':{'id':_0x5449b6['params']['id']}})['then'](handleEntityNotFound(_0x224ac4,null))[_0x86ad('0x21')](function(_0x1e36cd){if(_0x1e36cd){return _0x1e36cd[_0x86ad('0x6f')](_0x5449b6['query']['ids']);}})[_0x86ad('0x21')](respondWithStatusCode(_0x224ac4,null))[_0x86ad('0x2c')](handleError(_0x224ac4,null));};exports[_0x86ad('0x70')]=function(_0x3134df,_0x41ab13,_0x959e35){if(_0x3134df[_0x86ad('0x61')]['id']){delete _0x3134df[_0x86ad('0x61')]['id'];}return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x3134df[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x41ab13,null))[_0x86ad('0x21')](function(_0x2f7965){if(_0x2f7965){_0x3134df[_0x86ad('0x61')][_0x86ad('0x6b')]=_0x2f7965['id'];return db[_0x86ad('0x71')][_0x86ad('0x60')](_0x3134df[_0x86ad('0x61')]);}})[_0x86ad('0x21')](respondWithResult(_0x41ab13,null))[_0x86ad('0x2c')](handleError(_0x41ab13,null));};exports['getAnswers']=function(_0x4a431c,_0x440eeb,_0x50d5a0){var _0x251bef={'raw':![],'where':{}};var _0x3ad8b2={};var _0x2b3ed0={'count':0x0,'rows':[]};return db[_0x86ad('0x56')][_0x86ad('0x6e')]({'where':{'id':_0x4a431c[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x440eeb,null))['then'](function(_0x425e49){if(_0x425e49){_0x3ad8b2['model']=_['keys'](db['CannedAnswer'][_0x86ad('0x40')]);_0x3ad8b2['query']=_[_0x86ad('0x5e')](_0x4a431c[_0x86ad('0x44')]);_0x3ad8b2[_0x86ad('0x45')]=_['intersection'](_0x3ad8b2['model'],_0x3ad8b2['query']);_0x251bef['attributes']=_[_0x86ad('0x48')](_0x3ad8b2[_0x86ad('0x46')],qs[_0x86ad('0x49')](_0x4a431c['query'][_0x86ad('0x49')]));_0x251bef['attributes']=_0x251bef[_0x86ad('0x47')][_0x86ad('0x4a')]?_0x251bef[_0x86ad('0x47')]:_0x3ad8b2[_0x86ad('0x46')];if(!_0x4a431c['query'][_0x86ad('0x4b')]('nolimit')){_0x251bef[_0x86ad('0x32')]=qs[_0x86ad('0x32')](_0x4a431c[_0x86ad('0x44')]['limit']);_0x251bef['offset']=qs[_0x86ad('0x31')](_0x4a431c[_0x86ad('0x44')][_0x86ad('0x31')]);}_0x251bef['order']=qs[_0x86ad('0x4e')](_0x4a431c['query']['sort']);_0x251bef[_0x86ad('0x4f')]=qs['filters'](_[_0x86ad('0x50')](_0x4a431c[_0x86ad('0x44')],_0x3ad8b2[_0x86ad('0x45')]));_0x251bef[_0x86ad('0x4f')][_0x86ad('0x6b')]=_0x425e49['id'];if(_0x4a431c['query'][_0x86ad('0x51')]){_0x251bef['where']=_[_0x86ad('0x54')](_0x251bef['where'],{'$or':_[_0x86ad('0x52')](_0x251bef['attributes'],function(_0x47ab53){var _0x156e69={};_0x156e69[_0x47ab53]={'$like':'%'+_0x4a431c[_0x86ad('0x44')]['filter']+'%'};return _0x156e69;})});}_0x251bef=_[_0x86ad('0x54')]({},_0x251bef,_0x4a431c[_0x86ad('0x55')]);return db[_0x86ad('0x71')][_0x86ad('0x30')]({'where':_0x251bef['where']})['then'](function(_0x2c6e7b){_0x2b3ed0[_0x86ad('0x30')]=_0x2c6e7b;if(_0x4a431c[_0x86ad('0x44')][_0x86ad('0x57')]){_0x251bef[_0x86ad('0x58')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x251bef);})[_0x86ad('0x21')](function(_0x42dc4b){_0x2b3ed0[_0x86ad('0x5a')]=_0x42dc4b;return _0x2b3ed0;});}})[_0x86ad('0x21')](respondWithFilteredResult(_0x440eeb,_0x251bef))[_0x86ad('0x2c')](handleError(_0x440eeb,null));};exports[_0x86ad('0x72')]=function(_0x35dba7,_0x4635f7,_0x22402d){return db['ChatWebsite']['find']({'where':{'id':_0x35dba7[_0x86ad('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4635f7,null))[_0x86ad('0x21')](function(_0x5d785f){if(_0x5d785f){return _0x5d785f['removeAnswers'](_0x35dba7[_0x86ad('0x44')][_0x86ad('0x73')]);}})[_0x86ad('0x21')](respondWithStatusCode(_0x4635f7,null))['catch'](handleError(_0x4635f7,null));};exports[_0x86ad('0x74')]=function(_0x41b0b8,_0x26a231,_0x53a749){_0x41b0b8['body']['sitepic']=_0x41b0b8['file'][_0x86ad('0x75')];return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x41b0b8['params']['id']}})['then'](handleEntityNotFound(_0x26a231,null))[_0x86ad('0x21')](saveUpdates(_0x41b0b8[_0x86ad('0x61')],null))[_0x86ad('0x21')](respondWithResult(_0x26a231,null))['catch'](handleError(_0x26a231,null));};exports[_0x86ad('0x76')]=function(_0x1dca1a,_0x433f32,_0x423b00){_0x1dca1a[_0x86ad('0x61')]['agentAvatar']=_0x1dca1a[_0x86ad('0x77')]['filename'];return db[_0x86ad('0x56')]['find']({'where':{'id':_0x1dca1a['params']['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x433f32,null))['then'](saveUpdates(_0x1dca1a[_0x86ad('0x61')],null))[_0x86ad('0x21')](respondWithResult(_0x433f32,null))['catch'](handleError(_0x433f32,null));};exports['addCustomerAvatar']=function(_0x129d59,_0x35c460,_0x24f9f1){_0x129d59[_0x86ad('0x61')][_0x86ad('0x78')]=_0x129d59['file'][_0x86ad('0x75')];return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x129d59[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x35c460,null))[_0x86ad('0x21')](saveUpdates(_0x129d59[_0x86ad('0x61')],null))[_0x86ad('0x21')](respondWithResult(_0x35c460,null))[_0x86ad('0x2c')](handleError(_0x35c460,null));};exports[_0x86ad('0x79')]=function(_0x494082,_0xb07210,_0x20f0e9){_0x494082['body'][_0x86ad('0x7a')]=_0x494082[_0x86ad('0x77')][_0x86ad('0x75')];return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x494082[_0x86ad('0x5c')]['id']}})['then'](handleEntityNotFound(_0xb07210,null))[_0x86ad('0x21')](saveUpdates(_0x494082[_0x86ad('0x61')],null))['then'](respondWithResult(_0xb07210,null))[_0x86ad('0x2c')](handleError(_0xb07210,null));};exports[_0x86ad('0x7b')]=function(_0x2f4d0a,_0x460d3d,_0x268bd2){var _0x581f94=path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x7e'));var _0x13f7d4={'where':{'id':_0x2f4d0a[_0x86ad('0x5c')]['id']},'attributes':['id',_0x86ad('0x7f')],'raw':!![]};var _0x391017=![];return require('../../config/license/util')[_0x86ad('0x80')]()['then'](function(_0xff8dd5){if(_0xff8dd5){_0x391017=_0xff8dd5[_0x86ad('0x81')];}})['then'](function(){return db['ChatWebsite']['find'](_0x13f7d4);})[_0x86ad('0x21')](handleEntityNotFound(_0x460d3d,null))[_0x86ad('0x21')](function(_0x11840f){if(_0x11840f){if(!_[_0x86ad('0x82')](_0x11840f['sitepic'])){if(fs[_0x86ad('0x83')](path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x84'),_0x11840f[_0x86ad('0x7f')]))&&_0x391017){_0x581f94=path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],'server/files/images/logos/',_0x11840f[_0x86ad('0x7f')]);}}return _0x460d3d[_0x86ad('0x85')](_0x581f94);}})['catch'](handleError(_0x460d3d,null));};exports[_0x86ad('0x86')]=function(_0x1e7755,_0x2cb3bb,_0x5c98d9){var _0x481736=path[_0x86ad('0x7c')](config['root'],_0x86ad('0x87'));var _0x8244e7={'where':{'id':_0x1e7755['params']['id']},'attributes':['id',_0x86ad('0x88')],'raw':!![]};return db[_0x86ad('0x56')][_0x86ad('0x5f')](_0x8244e7)[_0x86ad('0x21')](handleEntityNotFound(_0x2cb3bb,null))[_0x86ad('0x21')](function(_0x3676ec){if(_0x3676ec){if(!_[_0x86ad('0x82')](_0x3676ec[_0x86ad('0x88')])){if(fs[_0x86ad('0x83')](path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x89'),_0x3676ec[_0x86ad('0x88')]))){_0x481736=path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x89'),_0x3676ec[_0x86ad('0x88')]);}}return _0x2cb3bb['download'](_0x481736);}})[_0x86ad('0x2c')](handleError(_0x2cb3bb,null));};exports[_0x86ad('0x8a')]=function(_0x56ae7f,_0x540f0c,_0x597a5e){var _0x581891=path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x8b'));var _0x2af4b7={'where':{'id':_0x56ae7f[_0x86ad('0x5c')]['id']},'attributes':['id',_0x86ad('0x78'),_0x86ad('0x8c')],'raw':!![]};return db[_0x86ad('0x56')]['find'](_0x2af4b7)[_0x86ad('0x21')](handleEntityNotFound(_0x540f0c,null))['then'](function(_0x3fff42){if(_0x3fff42){if(!_[_0x86ad('0x82')](_0x3fff42[_0x86ad('0x78')])){if(fs[_0x86ad('0x83')](path['join'](config[_0x86ad('0x7d')],_0x86ad('0x89'),_0x3fff42[_0x86ad('0x78')]))&&_0x3fff42['showCustomerAvatar']){_0x581891=path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x89'),_0x3fff42[_0x86ad('0x78')]);}}return _0x540f0c['download'](_0x581891);}})['catch'](handleError(_0x540f0c,null));};exports['getSystemAvatar']=function(_0x498bb0,_0xec1d07,_0x445e3a){var _0x1b998a=path['join'](config[_0x86ad('0x7d')],'server/files/images/avatars/system_avatar.png');var _0x2597e9={'where':{'id':_0x498bb0[_0x86ad('0x5c')]['id']},'attributes':['id',_0x86ad('0x7a')],'raw':!![]};return db[_0x86ad('0x56')][_0x86ad('0x5f')](_0x2597e9)['then'](handleEntityNotFound(_0xec1d07,null))[_0x86ad('0x21')](function(_0x1400ad){if(_0x1400ad){if(!_[_0x86ad('0x82')](_0x1400ad[_0x86ad('0x7a')])){if(fs[_0x86ad('0x83')](path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],'server/files/images/avatars/',_0x1400ad['systemAvatar']))){_0x1b998a=path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x89'),_0x1400ad[_0x86ad('0x7a')]);}}return _0xec1d07[_0x86ad('0x85')](_0x1b998a);}})[_0x86ad('0x2c')](handleError(_0xec1d07,null));};exports['notify']=function(_0x6e3687,_0x4232fc,_0x19f3a6){var _0xace0df=require('user-agent-parser');var _0x1948b8=new _0xace0df();var _0x2ee892=_0x1948b8['setUA'](_0x6e3687[_0x86ad('0x8d')][_0x86ad('0x8e')])[_0x86ad('0x8f')]();var _0x2fa0bc={'body':_0x6e3687[_0x86ad('0x61')],'channel':_0x86ad('0x90')};var _0x855a29=[];var _0xecf8c4=[];var _0x3cc933={};var _0x30b26b=![];return db['CmContact'][_0x86ad('0x69')]()['then'](function(_0x1f917d){if(!_0x1f917d){throw new db[(_0x86ad('0x91'))][(_0x86ad('0x92'))](_0x86ad('0x93'));}_0x855a29=_['difference'](_[_0x86ad('0x5e')](_0x1f917d),[_0x86ad('0x94'),'updatedAt']);_0xecf8c4=_[_0x86ad('0x95')](_['keys'](_0x1f917d),['createdAt',_0x86ad('0x96'),_0x86ad('0x97'),_0x86ad('0x98')]);if(_0x6e3687[_0x86ad('0x61')]['id']){delete _0x6e3687[_0x86ad('0x61')]['id'];}if(_[_0x86ad('0x82')](_0x6e3687['body'][_0x86ad('0x99')])){throw new db['Sequelize']['ValidationError'](_0x86ad('0x9a'));}if(_[_0x86ad('0x82')](_0x6e3687['body'][_0x86ad('0x61')])||_0x6e3687['body'][_0x86ad('0x61')]===''){throw new db['Sequelize'][(_0x86ad('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x86ad('0x82')](_0x6e3687['body'][_0x86ad('0x9b')])){throw new db[(_0x86ad('0x91'))][(_0x86ad('0x92'))](_0x86ad('0x9c')+_0xecf8c4);}if(!_[_0x86ad('0x9d')](_0xecf8c4,_0x6e3687[_0x86ad('0x61')]['mapKey'])){throw new db[(_0x86ad('0x91'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xecf8c4);}_0x3cc933[_0x6e3687['body'][_0x86ad('0x9b')]]=_0x6e3687['body'][_0x86ad('0x99')];})[_0x86ad('0x21')](function(){return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x6e3687[_0x86ad('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x86ad('0x9e'),'include':[{'model':db[_0x86ad('0x9f')],'as':'Contacts','where':_0x3cc933,'limit':0x1,'order':[[_0x86ad('0x96'),'DESC']]}]},{'model':db[_0x86ad('0xa0')],'as':'Applications'}]});})[_0x86ad('0x21')](handleEntityNotFound(_0x4232fc,null))[_0x86ad('0x21')](function(_0x4a5b31){if(_0x4a5b31&&_0x4a5b31[_0x86ad('0x9e')]){_0x2fa0bc[_0x86ad('0xa1')]=_0x4a5b31;_0x2fa0bc['applications']=_0x4a5b31[_0x86ad('0xa2')];_0x2fa0bc[_0x86ad('0xa3')]=_0x4a5b31[_0x86ad('0x9e')];_0x2fa0bc[_0x86ad('0xa4')]=_[_0x86ad('0xa5')](_0x2fa0bc['applications'],[_0x86ad('0xa6')],['asc']);if(_0x2fa0bc[_0x86ad('0xa1')][_0x86ad('0xa2')]){delete _0x2fa0bc[_0x86ad('0xa1')]['Applications'];}if(_0x2fa0bc[_0x86ad('0xa1')][_0x86ad('0x9e')]&&_0x2fa0bc['account']['List']['Contacts'][_0x86ad('0x4a')]){return _0x2fa0bc['account'][_0x86ad('0x9e')]['Contacts'][0x0];}var _0x529494=_[_0x86ad('0x1a')](_0x6e3687[_0x86ad('0x61')],{'firstName':_0x6e3687[_0x86ad('0x61')][_0x86ad('0x99')],'ListId':_0x4a5b31[_0x86ad('0x98')]});_0x529494[_0x6e3687['body']['mapKey']]=_0x6e3687[_0x86ad('0x61')]['from'];return db[_0x86ad('0x9f')][_0x86ad('0x60')](_0x529494,{'fields':_0x855a29,'raw':!![]});}})['then'](handleEntityNotFound(_0x4232fc,null))[_0x86ad('0x21')](function(_0x52c29a){_0x2fa0bc[_0x86ad('0xa7')]=_0x52c29a;var _0x2f4b13=_0x6e3687['body'][_0x86ad('0xa8')];if(_0x6e3687['headers'][_0x86ad('0xa9')]){_0x2f4b13=_0x6e3687[_0x86ad('0x8d')]['cf-connecting-ip'];}else if(_0x6e3687['headers'][_0x86ad('0xaa')]){_0x2f4b13=_[_0x86ad('0xab')](_0x6e3687['headers'][_0x86ad('0xaa')]['split'](','));}if(_0x52c29a){var _0x39b531={'ContactId':_0x52c29a['id'],'ChatWebsiteId':_0x6e3687[_0x86ad('0x5c')]['id'],'from':(_0x52c29a[_0x86ad('0xac')]||'')+'\x20'+(_0x52c29a[_0x86ad('0xad')]||''),'customerIp':_0x2f4b13,'customerPort':_0x6e3687['headers'][_0x86ad('0xae')]?_0x6e3687[_0x86ad('0x8d')][_0x86ad('0xae')]:null,'referer':_0x6e3687[_0x86ad('0x61')][_0x86ad('0xaf')],'browserName':_0x2ee892[_0x86ad('0xb0')][_0x86ad('0x3c')]&&_0x2ee892['browser'][_0x86ad('0xb1')]?util[_0x86ad('0xb2')](_0x86ad('0xb3'),_0x2ee892['browser']['name'],_0x2ee892['browser'][_0x86ad('0xb1')]):_0x86ad('0xb4'),'browserVersion':_0x2ee892['browser'][_0x86ad('0xb1')]||_0x86ad('0xb4'),'osName':util[_0x86ad('0xb2')](_0x86ad('0xb3'),_0x2ee892['os'][_0x86ad('0x3c')],_0x2ee892['os'][_0x86ad('0xb1')]),'osVersion':_0x2ee892['os']['version'],'deviceModel':_0x2ee892[_0x86ad('0xb5')][_0x86ad('0x46')]&&_0x2ee892[_0x86ad('0xb5')][_0x86ad('0xb6')]?util[_0x86ad('0xb2')](_0x86ad('0xb7'),_0x2ee892['device'][_0x86ad('0x46')],_0x2ee892[_0x86ad('0xb5')][_0x86ad('0xb6')],_0x2ee892[_0x86ad('0xb5')][_0x86ad('0x42')]):null,'deviceVendor':_0x2ee892[_0x86ad('0xb5')][_0x86ad('0xb6')],'deviceType':_0x2ee892['device'][_0x86ad('0x42')],'formData':JSON[_0x86ad('0x26')](_0x6e3687['body'])};var _0x12359={'ChatWebsiteId':_0x6e3687[_0x86ad('0x5c')]['id'],'closed':![]};if(_0x6e3687[_0x86ad('0x61')][_0x86ad('0xb8')]){_0x12359[_0x86ad('0xb8')]=_0x6e3687[_0x86ad('0x61')][_0x86ad('0xb8')];return db[_0x86ad('0xb9')]['find']({'where':_0x12359})[_0x86ad('0x21')](function(_0x4cd555){if(_0x4cd555){return[_0x4cd555,![]];}_0x39b531[_0x86ad('0xb8')]=_0x6e3687[_0x86ad('0x61')][_0x86ad('0xb8')];_0x39b531[_0x86ad('0xba')]=_0x6e3687[_0x86ad('0x61')][_0x86ad('0xba')];return db[_0x86ad('0xb9')]['create'](_0x39b531)[_0x86ad('0x21')](function(_0x40db64){return[_0x40db64,!![]];});});}_0x12359[_0x86ad('0xbb')]=_0x52c29a['id'];if(_0x6e3687[_0x86ad('0x61')][_0x86ad('0xbc')]&&_0x6e3687[_0x86ad('0x61')]['interaction']['id']){_0x12359['id']=_0x6e3687[_0x86ad('0x61')][_0x86ad('0xbc')]['id'];return db[_0x86ad('0xb9')][_0x86ad('0x5f')]({'where':_0x12359})['then'](function(_0x11da97){if(_0x11da97){return[_0x11da97,![]];}return db[_0x86ad('0xb9')]['create'](_0x39b531)['then'](function(_0x5b66a0){return[_0x5b66a0,!![]];});});}return db['ChatInteraction'][_0x86ad('0x60')](_0x39b531)[_0x86ad('0x21')](function(_0xd27d99){return[_0xd27d99,!![]];});}})[_0x86ad('0xbd')](function(_0x4d2876,_0x13b6ef){if(_0x4d2876){_0x30b26b=_0x13b6ef;if(!_0x13b6ef){var _0x39bfb3={'from':(_0x2fa0bc[_0x86ad('0xa7')][_0x86ad('0xac')]||'')+'\x20'+(_0x2fa0bc[_0x86ad('0xa7')][_0x86ad('0xad')]||'')};if(_0x6e3687[_0x86ad('0x61')][_0x86ad('0xb8')]&&_0x6e3687['body'][_0x86ad('0xbe')]&&_0x6e3687[_0x86ad('0x61')]['threadId']!=_0x6e3687['body'][_0x86ad('0xbe')]){_0x39bfb3[_0x86ad('0xb8')]=_0x6e3687[_0x86ad('0x61')][_0x86ad('0xbe')];}return _0x4d2876['update'](_0x39bfb3);}else{return _0x4d2876;}}})[_0x86ad('0x21')](function(_0x412a7f){_0x2fa0bc[_0x86ad('0xbc')]=_0x412a7f[_0x86ad('0x63')]({'plain':!![]});_0x2fa0bc['interaction'][_0x86ad('0xbf')]=_0x30b26b;if(_0x2fa0bc[_0x86ad('0xbc')][_0x86ad('0xbf')]){if(_0x2fa0bc[_0x86ad('0xa1')][_0x86ad('0xc0')]){_0x2fa0bc[_0x86ad('0xa4')][_0x86ad('0xc1')]({'id':0x0,'priority':_0x2fa0bc[_0x86ad('0xa4')]['length']+0x1,'app':_0x86ad('0xc2'),'appdata':_0x86ad('0xc3'),'interval':'*,*,*,*'});}}return db[_0x86ad('0xc4')]['create']({'body':_0x6e3687[_0x86ad('0x61')][_0x86ad('0x61')],'ChatWebsiteId':_0x6e3687[_0x86ad('0x5c')]['id'],'ChatInteractionId':_0x412a7f['id'],'direction':'in','ContactId':_0x2fa0bc['contact']['id'],'AttachmentId':_0x6e3687[_0x86ad('0x61')][_0x86ad('0xc5')]});})[_0x86ad('0x21')](function(_0x5e2f03){_0x2fa0bc[_0x86ad('0x29')]=_0x5e2f03;if(_0x2fa0bc[_0x86ad('0xbc')][_0x86ad('0xc6')]){return db['User']['find']({'attributes':['id',_0x86ad('0x3c')],'where':{'id':_0x2fa0bc[_0x86ad('0xbc')]['UserId']}})['then'](function(_0x5ae628){if(_0x5ae628){_0x2fa0bc[_0x86ad('0xa4')]['unshift']({'id':0x0,'priority':0x0,'app':_0x86ad('0xc7'),'appdata':_0x5ae628[_0x86ad('0x3c')]+','+(_0x2fa0bc[_0x86ad('0xa1')]['waitForTheAssignedAgent']||0xa),'interval':_0x86ad('0xc8')});_0x2fa0bc[_0x86ad('0xc9')]=!![];}return respondWithRpcPromise(_0x86ad('0xca'),_0x86ad('0xcb'),_0x2fa0bc);});}return respondWithRpcPromise('Start',_0x86ad('0xcb'),_0x2fa0bc);})[_0x86ad('0x21')](function(_0x778276){respondWithRpcPromise(_0x86ad('0xcc'),'EventManager',{'event':_0x86ad('0xcd'),'message':_0x778276},client9002);return _0x778276;})['then'](respondWithResult(_0x4232fc,null))[_0x86ad('0x2c')](handleError(_0x4232fc,null));};exports[_0x86ad('0xce')]=function(_0x4490f3,_0x5befb5,_0xc7cd8d){var _0x46e6d5,_0x40b89c,_0x47ed23;var _0x1a7c6b=[];var _0x258724=[];var _0x4ecd33={};return db[_0x86ad('0x9f')][_0x86ad('0x69')]()[_0x86ad('0x21')](function(_0x1c19d6){if(!_0x1c19d6){throw new db[(_0x86ad('0x91'))][(_0x86ad('0x92'))](_0x86ad('0x93'));}_0x258724=_[_0x86ad('0x95')](_[_0x86ad('0x5e')](_0x1c19d6),[_0x86ad('0x94'),_0x86ad('0x96')]);_0x1a7c6b=_[_0x86ad('0x95')](_[_0x86ad('0x5e')](_0x1c19d6),[_0x86ad('0x94'),_0x86ad('0x96'),'CompanyId',_0x86ad('0x98')]);if(_0x4490f3[_0x86ad('0x61')]['id']){delete _0x4490f3[_0x86ad('0x61')]['id'];}if(_[_0x86ad('0x82')](_0x4490f3[_0x86ad('0x61')][_0x86ad('0x99')])){throw _0x5befb5[_0x86ad('0x2e')](0x1f4)[_0x86ad('0x3d')](new db[(_0x86ad('0x91'))]['ValidationError'](_0x86ad('0x9a')));}if(_['isNil'](_0x4490f3['body']['body'])||_0x4490f3[_0x86ad('0x61')][_0x86ad('0x61')]===''){throw _0x5befb5[_0x86ad('0x2e')](0x1f4)[_0x86ad('0x3d')](new db['Sequelize'][(_0x86ad('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x86ad('0x82')](_0x4490f3[_0x86ad('0x61')][_0x86ad('0xcf')])){throw _0x5befb5[_0x86ad('0x2e')](0x1f4)[_0x86ad('0x3d')](new db['Sequelize'][(_0x86ad('0x92'))](_0x86ad('0xd0')+_0x1a7c6b));}if(!_[_0x86ad('0x9d')](_0x1a7c6b,_0x4490f3[_0x86ad('0x61')][_0x86ad('0xcf')])){throw _0x5befb5[_0x86ad('0x2e')](0x1f4)['send'](new db[(_0x86ad('0x91'))][(_0x86ad('0x92'))](_0x86ad('0xd1')+_0x1a7c6b));}_0x4ecd33[_0x4490f3[_0x86ad('0x61')]['mapKeyOffline']]=_0x4490f3[_0x86ad('0x61')][_0x86ad('0x99')];})[_0x86ad('0x21')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x4490f3['params']['id']},'include':[{'model':db[_0x86ad('0xd2')],'as':_0x86ad('0x9e')}]});})['then'](handleEntityNotFound(_0x5befb5,null))['then'](function(_0x22589b){if(_0x22589b&&_0x22589b[_0x86ad('0x9e')]){_0x40b89c=_0x22589b;var _0x29fd91=_[_0x86ad('0x1a')](_0x4490f3['body'],{'firstName':_0x4490f3[_0x86ad('0x61')][_0x86ad('0x99')],'phone':_0x4490f3[_0x86ad('0x61')]['from'],'ListId':_0x22589b[_0x86ad('0x98')]});_0x29fd91[_0x4490f3[_0x86ad('0x61')]['mapKeyOffline']]=_0x4490f3['body'][_0x86ad('0x99')];return db[_0x86ad('0x9f')][_0x86ad('0xd3')]({'where':_0x4ecd33,'defaults':_0x29fd91});}})['spread'](function(_0x594238){if(_0x594238){_0x47ed23=_0x594238;var _0x376ecc=fs[_0x86ad('0xd4')](path['join'](config[_0x86ad('0x7d')],_0x86ad('0xd5')),_0x86ad('0xd6'));var _0x306aae=ejs['render'](_0x376ecc,{'body':_[_0x86ad('0xd7')](_0x4490f3['body']['body']),'bodyTitle':_0x40b89c[_0x86ad('0xd8')]});return db[_0x86ad('0xd9')][_0x86ad('0x60')]({'body':_0x306aae,'ContactId':_0x594238['id'],'ChatWebsiteId':_0x40b89c['id']});}})[_0x86ad('0x21')](function(_0x56e18f){if(_0x56e18f){_0x46e6d5=_0x56e18f;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x86ad('0xda')],'as':_0x86ad('0xdb'),'raw':!![]}]});}})[_0x86ad('0x21')](function(_0x5d5f33){if(_0x5d5f33&&_0x5d5f33[_0x86ad('0xdb')]&&_0x40b89c[_0x86ad('0xdc')]){var _0x347081={'tls':{'rejectUnauthorized':![]}};if(_0x5d5f33[_0x86ad('0xdb')][_0x86ad('0xdd')]){_0x347081[_0x86ad('0xdd')]=_0x5d5f33[_0x86ad('0xdb')][_0x86ad('0xdd')];}else{_0x347081[_0x86ad('0xde')]=_0x5d5f33['Smtp']['host'];_0x347081[_0x86ad('0xdf')]=_0x5d5f33[_0x86ad('0xdb')]['port'];_0x347081[_0x86ad('0xe0')]=_0x5d5f33[_0x86ad('0xdb')][_0x86ad('0xe0')];}if(_0x5d5f33[_0x86ad('0xdb')][_0x86ad('0xe1')]){_0x347081[_0x86ad('0xe2')]={'user':_0x5d5f33['Smtp'][_0x86ad('0x62')],'pass':_0x5d5f33[_0x86ad('0xdb')][_0x86ad('0xe3')]};}return respondWithRpcPromise(_0x86ad('0xe4'),_0x86ad('0xe5'),{'account':_0x347081,'message':{'from':util[_0x86ad('0xb2')](_0x86ad('0xe6'),_0x5d5f33[_0x86ad('0x3c')],_0x5d5f33[_0x86ad('0xe7')]||_0x5d5f33[_0x86ad('0xdb')]['user']),'to':_0x40b89c['forwardOfflineAddress'],'subject':_0x40b89c['offlineMessageSubject'],'text':_0x46e6d5[_0x86ad('0x61')]}},client9003)[_0x86ad('0x21')](function(){return _0x46e6d5;})[_0x86ad('0x2c')](function(_0x133f62){console[_0x86ad('0x27')](_0x133f62);});}})[_0x86ad('0x21')](function(){if(_0x46e6d5){return _0x46e6d5;}})[_0x86ad('0x21')](respondWithResult(_0x5befb5,null))[_0x86ad('0x2c')](handleError(_0x5befb5,null));};exports['addInteraction']=function(_0x5c4ef9,_0x383473,_0x2b4707){return db[_0x86ad('0xb9')]['find']({'where':{'id':_0x5c4ef9[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x383473,null))[_0x86ad('0x21')](function(_0x1eca11){if(_0x1eca11){return _0x1eca11['addInteraction'](_0x5c4ef9[_0x86ad('0x61')][_0x86ad('0x73')],_[_0x86ad('0xe8')](_0x5c4ef9[_0x86ad('0x61')],[_0x86ad('0x73'),'id'])||{});}})[_0x86ad('0x21')](respondWithResult(_0x383473,null))[_0x86ad('0x2c')](handleError(_0x383473,null));};exports[_0x86ad('0xe9')]=function(_0x1260b0,_0x2c44b1,_0x3f47a1){var _0x51629c={'raw':![],'where':{}};var _0x843294={};var _0x322924={'count':0x0,'rows':[]};return db[_0x86ad('0x56')][_0x86ad('0x6e')]({'where':{'id':_0x1260b0['params']['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x2c44b1,null))[_0x86ad('0x21')](function(_0x37c655){if(_0x37c655){_0x843294[_0x86ad('0x46')]=_[_0x86ad('0x5e')](db[_0x86ad('0xb9')][_0x86ad('0x40')]);_0x843294[_0x86ad('0x44')]=_[_0x86ad('0x5e')](_0x1260b0[_0x86ad('0x44')]);_0x843294[_0x86ad('0x45')]=_[_0x86ad('0x48')](_0x843294['model'],_0x843294[_0x86ad('0x44')]);_0x51629c[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0x843294[_0x86ad('0x46')],qs[_0x86ad('0x49')](_0x1260b0[_0x86ad('0x44')]['fields']));_0x51629c[_0x86ad('0x47')]=_0x51629c[_0x86ad('0x47')]['length']?_0x51629c[_0x86ad('0x47')]:_0x843294['model'];if(!_0x1260b0['query'][_0x86ad('0x4b')](_0x86ad('0x4c'))){_0x51629c[_0x86ad('0x32')]=qs[_0x86ad('0x32')](_0x1260b0['query'][_0x86ad('0x32')]);_0x51629c[_0x86ad('0x31')]=qs[_0x86ad('0x31')](_0x1260b0[_0x86ad('0x44')][_0x86ad('0x31')]);}_0x51629c[_0x86ad('0x4d')]=qs['sort'](_0x1260b0['query'][_0x86ad('0x4e')]);_0x51629c[_0x86ad('0x4f')]=qs[_0x86ad('0x45')](_[_0x86ad('0x50')](_0x1260b0['query'],_0x843294['filters']));_0x51629c[_0x86ad('0x4f')][_0x86ad('0x6b')]=_0x37c655['id'];if(_0x1260b0['query'][_0x86ad('0x51')]){_0x51629c[_0x86ad('0x4f')]=_[_0x86ad('0x54')](_0x51629c[_0x86ad('0x4f')],{'$or':_[_0x86ad('0x52')](_0x51629c[_0x86ad('0x47')],function(_0x4542ab){var _0x5ca411={};_0x5ca411[_0x4542ab]={'$like':'%'+_0x1260b0['query']['filter']+'%'};return _0x5ca411;})});}_0x51629c=_['merge']({},_0x51629c,_0x1260b0[_0x86ad('0x55')]);return db[_0x86ad('0xb9')][_0x86ad('0x30')]({'where':_0x51629c[_0x86ad('0x4f')]})['then'](function(_0x36fc2f){_0x322924[_0x86ad('0x30')]=_0x36fc2f;if(_0x1260b0['query']['includeAll']){_0x51629c['include']=[{'model':db['CmContact'],'as':_0x86ad('0xea'),'required':![]},{'model':db[_0x86ad('0xeb')],'as':_0x86ad('0xec'),'attributes':[_0x86ad('0x3c'),_0x86ad('0xed'),_0x86ad('0xee')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x86ad('0xef')],'where':_0x1260b0[_0x86ad('0x44')][_0x86ad('0xf0')]?{'id':_0x1260b0[_0x86ad('0x44')][_0x86ad('0xf0')]}:undefined,'required':_0x1260b0[_0x86ad('0x44')]['tag']?!![]:![]}];}return db[_0x86ad('0xb9')][_0x86ad('0x59')](_0x51629c);})['then'](function(_0x5a7299){_0x322924[_0x86ad('0x5a')]=_0x5a7299;return _0x322924;});}})[_0x86ad('0x21')](respondWithFilteredResult(_0x2c44b1,_0x51629c))[_0x86ad('0x2c')](handleError(_0x2c44b1,null));};function iftimePromise(_0x79c6b9,_0x567ef2){return respondWithRpcPromise('Command',_0x86ad('0xf1'),{'command':_0x567ef2[_0x86ad('0xf2')]?util[_0x86ad('0xb2')]('iftime\x20%s,%s',_0x79c6b9[_0x86ad('0xf3')],_0x567ef2['timezone']):util['format'](_0x86ad('0xf4'),_0x79c6b9[_0x86ad('0xf3')])},client9002)[_0x86ad('0x21')](function(_0x1390e0){var _0x316e9a=_0x1390e0&&_0x1390e0['indexOf']('true')>=0x0?!![]:![];logger[_0x86ad('0x2a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x567ef2['id'],_0x79c6b9['id'],_0x79c6b9[_0x86ad('0xf3')],_0x316e9a?_0x86ad('0xf5'):_0x86ad('0xf6'),_0x567ef2[_0x86ad('0xf2')]?_0x567ef2[_0x86ad('0xf2')]:'No\x20timezone');return _0x316e9a;})[_0x86ad('0x2c')](function(_0x2db7bd){logger[_0x86ad('0x27')](_0x86ad('0xf7'),_0x567ef2['id'],_0x79c6b9['id'],_0x79c6b9['interval'],util[_0x86ad('0xf8')](_0x2db7bd,{'showHidden':![],'depth':null}),_0x567ef2[_0x86ad('0xf2')]?_0x567ef2[_0x86ad('0xf2')]:_0x86ad('0xf9'));return![];});}exports[_0x86ad('0xf1')]=function(_0x45a097,_0x5a0037,_0x1a4382){var _0x2bb3b5=0x0;var _0x584fde=0x0;var _0x53703b=![];var _0x206ff2;var _0x4e6f68;return db[_0x86ad('0x56')]['find']({'where':{'id':_0x45a097[_0x86ad('0x5c')]['id']},'include':[{'model':db[_0x86ad('0xfa')],'as':'Interval','include':[{'model':db[_0x86ad('0xfa')],'as':_0x86ad('0xfb'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5a0037,null))[_0x86ad('0x21')](function(_0x27a3d7){if(_0x27a3d7){_0x206ff2=_0x27a3d7;return _0x27a3d7[_0x86ad('0xfc')]({'raw':!![]});}})[_0x86ad('0x21')](function(_0x378439){if(_0x206ff2){if(_0x378439){_0x4e6f68=_0x378439;}}return require(_0x86ad('0xfd'))[_0x86ad('0x80')]();})[_0x86ad('0x21')](function(_0x4a02fa){if(_0x4a02fa){_0x584fde=_0x4a02fa[_0x86ad('0xfe')];_0x53703b=_0x4a02fa['custom'];}})[_0x86ad('0x21')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0x4d6af1){_0x2bb3b5=_0x4d6af1;if(_0x584fde&&_0x4d6af1>_0x584fde){return db[_0x86ad('0xff')][_0x86ad('0x6e')]({'where':{'id':0x1}})[_0x86ad('0x21')](function(_0x14409a){if(_0x14409a){_0x14409a[_0x86ad('0x100')](_0x86ad('0x101'));}});}})['then'](function(){if(_0x206ff2[_0x86ad('0xfa')]&&_0x206ff2[_0x86ad('0xfa')]['Intervals']){var _0x1e0225=[];for(var _0x5e2874=0x0;_0x5e2874<_0x206ff2[_0x86ad('0xfa')][_0x86ad('0xfb')][_0x86ad('0x4a')];_0x5e2874++){var _0x257d87=_0x206ff2[_0x86ad('0xfa')][_0x86ad('0xfb')][_0x5e2874][_0x86ad('0x63')]({'plain':!![]});_0x1e0225[_0x86ad('0xc1')](iftimePromise(_0x257d87,_0x206ff2));}return BPromise['all'](_0x1e0225)[_0x86ad('0x21')](function(_0x153e09){return _[_0x86ad('0x102')](_0x153e09);});}else{return!![];}})['then'](function(_0x3439b0){var _0x1cb7bd=fs[_0x86ad('0xd4')](path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],'server/files/chat/iframe.js'),'utf8');var _0x3f9b41={'remote':_0x206ff2[_0x86ad('0x103')],'query':querystring['stringify'](_[_0x86ad('0x54')](_0x206ff2['get']({'plain':!![]}),{'customerIp':_0x45a097[_0x86ad('0x8d')]['x-forwarded-for']||_0x45a097[_0x86ad('0x8d')][_0x86ad('0x104')]||_0x45a097[_0x86ad('0x105')]['remoteAddress']||_0x45a097['ip'],'referer':_0x45a097[_0x86ad('0x8d')][_0x86ad('0xaf')],'openedInteractions':_0x2bb3b5,'maxInteractions':_0x584fde,'virtual':_0x53703b[_0x86ad('0xfe')],'online':_0x3439b0,'custom':_0x53703b}))[_0x86ad('0x106')](/'/g,'\x5c\x27')};_0x5a0037['send'](ejs[_0x86ad('0x107')](Mustache[_0x86ad('0x107')](_0x1cb7bd,_0x3f9b41),{'proactiveActions':_0x4e6f68,'alignment':_0x206ff2[_0x86ad('0x108')],'verticalAlignment':_0x206ff2[_0x86ad('0x109')],'div_color':_0x206ff2[_0x86ad('0xef')],'text_color':_0x206ff2[_0x86ad('0x10a')]}));})[_0x86ad('0x2c')](handleError(_0x5a0037,null));};exports[_0x86ad('0x10b')]=function(_0x387a47,_0x34252e,_0x48d321){return db[_0x86ad('0x56')][_0x86ad('0x6e')]({'where':{'id':_0x387a47[_0x86ad('0x5c')]['id']}})['then'](handleEntityNotFound(_0x34252e,null))[_0x86ad('0x21')](function(_0x1105e2){if(_0x1105e2){return db[_0x86ad('0x10c')]['transaction'](function(_0xf5faa1){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x387a47['params']['id']},'transaction':_0xf5faa1})[_0x86ad('0x21')](function(_0x27d991){var _0x5b9694=_[_0x86ad('0x52')](_0x387a47[_0x86ad('0x61')],function(_0x573030){_0x573030['ChatWebsiteId']=_0x387a47['params']['id'];return _0x573030;});return db[_0x86ad('0xa0')][_0x86ad('0x10d')](_0x5b9694,{'transaction':_0xf5faa1});});})['then'](function(){return db[_0x86ad('0xa0')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x387a47[_0x86ad('0x5c')]['id']},'order':_0x86ad('0xa6')});});}})[_0x86ad('0x21')](respondWithResult(_0x34252e,null))[_0x86ad('0x2c')](handleError(_0x34252e,null));};exports[_0x86ad('0x10e')]=function(_0x4e7cd3,_0x2533d4,_0x2c1c24){var _0x3ff100={};var _0x3ffdd4={};var _0x1e963e;var _0x8ebccc;return db[_0x86ad('0x56')][_0x86ad('0x6e')]({'where':{'id':_0x4e7cd3['params']['id']}})['then'](handleEntityNotFound(_0x2533d4,null))['then'](function(_0x51c516){if(_0x51c516){_0x1e963e=_0x51c516;_0x3ffdd4['model']=_[_0x86ad('0x5e')](db['ChatApplication']['rawAttributes']);_0x3ffdd4[_0x86ad('0x44')]=_[_0x86ad('0x5e')](_0x4e7cd3[_0x86ad('0x44')]);_0x3ffdd4['filters']=_['intersection'](_0x3ffdd4[_0x86ad('0x46')],_0x3ffdd4['query']);_0x3ff100[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0x3ffdd4['model'],qs['fields'](_0x4e7cd3['query'][_0x86ad('0x49')]));_0x3ff100[_0x86ad('0x47')]=_0x3ff100['attributes'][_0x86ad('0x4a')]?_0x3ff100[_0x86ad('0x47')]:_0x3ffdd4[_0x86ad('0x46')];_0x3ff100[_0x86ad('0x4d')]=qs[_0x86ad('0x4e')](_0x4e7cd3['query']['sort']);_0x3ff100['where']=qs[_0x86ad('0x45')](_[_0x86ad('0x50')](_0x4e7cd3['query'],_0x3ffdd4[_0x86ad('0x45')]));if(_0x4e7cd3['query']['filter']){_0x3ff100['where']=_[_0x86ad('0x54')](_0x3ff100[_0x86ad('0x4f')],{'$or':_[_0x86ad('0x52')](_0x3ff100['attributes'],function(_0x2771c){var _0x5f40c5={};_0x5f40c5[_0x2771c]={'$like':'%'+_0x4e7cd3[_0x86ad('0x44')][_0x86ad('0x51')]+'%'};return _0x5f40c5;})});}_0x3ff100=_[_0x86ad('0x54')]({},_0x3ff100,_0x4e7cd3[_0x86ad('0x55')]);return _0x1e963e['getApplications'](_0x3ff100);}})[_0x86ad('0x21')](function(_0x56ef77){if(_0x56ef77){_0x8ebccc=_0x56ef77[_0x86ad('0x4a')];if(!_0x4e7cd3[_0x86ad('0x44')][_0x86ad('0x4b')](_0x86ad('0x4c'))){_0x3ff100[_0x86ad('0x32')]=qs[_0x86ad('0x32')](_0x4e7cd3[_0x86ad('0x44')][_0x86ad('0x32')]);_0x3ff100['offset']=qs[_0x86ad('0x31')](_0x4e7cd3[_0x86ad('0x44')][_0x86ad('0x31')]);}return _0x1e963e['getApplications'](_0x3ff100);}})[_0x86ad('0x21')](function(_0x588f45){if(_0x588f45){return _0x588f45?{'count':_0x8ebccc,'rows':_0x588f45}:null;}})[_0x86ad('0x21')](respondWithResult(_0x2533d4,null))['catch'](handleError(_0x2533d4,null));};exports[_0x86ad('0x10f')]=function(_0x274d29,_0x55422c,_0x1ba115){return db['chatProactiveAction'][_0x86ad('0x5f')]({'where':{'id':_0x274d29[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x55422c,null))['then'](function(_0x508c99){if(_0x508c99){return _0x508c99['addProactiveActions'](_0x274d29['body'][_0x86ad('0x73')],_[_0x86ad('0xe8')](_0x274d29[_0x86ad('0x61')],[_0x86ad('0x73'),'id'])||{});}})[_0x86ad('0x21')](respondWithResult(_0x55422c,null))['catch'](handleError(_0x55422c,null));};exports[_0x86ad('0xfc')]=function(_0x2b6e8f,_0x33914c,_0x129956){var _0x4d174b={};var _0x4faeb5={};var _0xb1079e;var _0x10004b;return db[_0x86ad('0x56')]['findOne']({'where':{'id':_0x2b6e8f[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x33914c,null))[_0x86ad('0x21')](function(_0x4aa2c6){if(_0x4aa2c6){_0xb1079e=_0x4aa2c6;_0x4faeb5[_0x86ad('0x46')]=_[_0x86ad('0x5e')](db['ChatProactiveAction'][_0x86ad('0x40')]);_0x4faeb5[_0x86ad('0x44')]=_[_0x86ad('0x5e')](_0x2b6e8f[_0x86ad('0x44')]);_0x4faeb5[_0x86ad('0x45')]=_['intersection'](_0x4faeb5[_0x86ad('0x46')],_0x4faeb5[_0x86ad('0x44')]);_0x4d174b[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0x4faeb5['model'],qs[_0x86ad('0x49')](_0x2b6e8f[_0x86ad('0x44')][_0x86ad('0x49')]));_0x4d174b['attributes']=_0x4d174b['attributes'][_0x86ad('0x4a')]?_0x4d174b[_0x86ad('0x47')]:_0x4faeb5['model'];_0x4d174b[_0x86ad('0x4d')]=qs[_0x86ad('0x4e')](_0x2b6e8f[_0x86ad('0x44')][_0x86ad('0x4e')]);_0x4d174b[_0x86ad('0x4f')]=qs[_0x86ad('0x45')](_[_0x86ad('0x50')](_0x2b6e8f[_0x86ad('0x44')],_0x4faeb5['filters']));if(_0x2b6e8f[_0x86ad('0x44')][_0x86ad('0x51')]){_0x4d174b['where']=_['merge'](_0x4d174b['where'],{'$or':_[_0x86ad('0x52')](_0x4d174b[_0x86ad('0x47')],function(_0x69dcb3){var _0x4a854e={};_0x4a854e[_0x69dcb3]={'$like':'%'+_0x2b6e8f['query'][_0x86ad('0x51')]+'%'};return _0x4a854e;})});}_0x4d174b=_[_0x86ad('0x54')]({},_0x4d174b,_0x2b6e8f[_0x86ad('0x55')]);return _0xb1079e['getProactiveActions'](_0x4d174b);}})['then'](function(_0x235c77){if(_0x235c77){_0x10004b=_0x235c77['length'];if(!_0x2b6e8f['query'][_0x86ad('0x4b')](_0x86ad('0x4c'))){_0x4d174b['limit']=qs[_0x86ad('0x32')](_0x2b6e8f[_0x86ad('0x44')]['limit']);_0x4d174b['offset']=qs[_0x86ad('0x31')](_0x2b6e8f[_0x86ad('0x44')]['offset']);}return _0xb1079e[_0x86ad('0xfc')](_0x4d174b);}})[_0x86ad('0x21')](function(_0x4d15f9){if(_0x4d15f9){return _0x4d15f9?{'count':_0x10004b,'rows':_0x4d15f9}:null;}})[_0x86ad('0x21')](respondWithResult(_0x33914c,null))[_0x86ad('0x2c')](handleError(_0x33914c,null));};exports[_0x86ad('0x110')]=function(_0x1ce300,_0x3496e2,_0x36db19){var _0xc6df02=_0x1ce300[_0x86ad('0x44')][_0x86ad('0x111')]==='false'?_0x86ad('0x112'):_0x86ad('0x113');return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'attributes':['id',_0xc6df02],'where':{'id':_0x1ce300['params']['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x3496e2,null))[_0x86ad('0x21')](function(_0x3a2f5b){if(_0x3a2f5b){var _0x5cd6ba=_0x3a2f5b[_0xc6df02];var _0xd8bca1=_0x5cd6ba&&_0x5cd6ba[_0x86ad('0x114')]?_0x5cd6ba[_0x86ad('0x114')]:[];_0x3496e2['send']({'fromKey':_[_0x86ad('0x82')](_0x5cd6ba[_0x86ad('0x115')])?undefined:_0x5cd6ba[_0x86ad('0x115')],'count':_0xd8bca1[_0x86ad('0x4a')],'rows':_0xd8bca1});}})[_0x86ad('0x2c')](handleError(_0x3496e2,null));};exports['getOfflineMessages']=function(_0x8e9ba8,_0x4aae92,_0x39dbd1){var _0x1720ed={'raw':![],'where':{}};var _0xa18382={};var _0x2b20b6={'count':0x0,'rows':[]};return db[_0x86ad('0x56')][_0x86ad('0x6e')]({'where':{'id':_0x8e9ba8[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x4aae92,null))[_0x86ad('0x21')](function(_0x8de820){if(_0x8de820){_0xa18382[_0x86ad('0x46')]=_[_0x86ad('0x5e')](db['ChatOfflineMessage'][_0x86ad('0x40')]);_0xa18382[_0x86ad('0x44')]=_[_0x86ad('0x5e')](_0x8e9ba8[_0x86ad('0x44')]);_0xa18382[_0x86ad('0x45')]=_[_0x86ad('0x48')](_0xa18382[_0x86ad('0x46')],_0xa18382[_0x86ad('0x44')]);_0x1720ed[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0xa18382[_0x86ad('0x46')],qs['fields'](_0x8e9ba8['query']['fields']));_0x1720ed[_0x86ad('0x47')]=_0x1720ed[_0x86ad('0x47')][_0x86ad('0x4a')]?_0x1720ed[_0x86ad('0x47')]:_0xa18382[_0x86ad('0x46')];if(!_0x8e9ba8[_0x86ad('0x44')][_0x86ad('0x4b')](_0x86ad('0x4c'))){_0x1720ed['limit']=qs['limit'](_0x8e9ba8[_0x86ad('0x44')][_0x86ad('0x32')]);_0x1720ed['offset']=qs[_0x86ad('0x31')](_0x8e9ba8['query'][_0x86ad('0x31')]);}_0x1720ed[_0x86ad('0x4d')]=qs['sort'](_0x8e9ba8['query']['sort']);_0x1720ed['where']=qs[_0x86ad('0x45')](_[_0x86ad('0x50')](_0x8e9ba8[_0x86ad('0x44')],_0xa18382['filters']));_0x1720ed['where'][_0x86ad('0x6b')]=_0x8de820['id'];if(_0x8e9ba8[_0x86ad('0x44')]['filter']){_0x1720ed[_0x86ad('0x4f')]=_[_0x86ad('0x54')](_0x1720ed[_0x86ad('0x4f')],{'$or':_[_0x86ad('0x52')](_0x1720ed[_0x86ad('0x47')],function(_0x47afde){var _0x55d7cf={};_0x55d7cf[_0x47afde]={'$like':'%'+_0x8e9ba8['query'][_0x86ad('0x51')]+'%'};return _0x55d7cf;})});}_0x1720ed=_[_0x86ad('0x54')]({},_0x1720ed,_0x8e9ba8[_0x86ad('0x55')]);return db[_0x86ad('0xd9')]['count']({'where':_0x1720ed[_0x86ad('0x4f')]})['then'](function(_0x5c097d){_0x2b20b6[_0x86ad('0x30')]=_0x5c097d;if(_0x8e9ba8[_0x86ad('0x44')][_0x86ad('0x57')]){_0x1720ed[_0x86ad('0x58')]=[{'all':!![]}];}else{_0x1720ed[_0x86ad('0x58')]=[{'model':db[_0x86ad('0x9f')],'as':_0x86ad('0xea'),'required':![]}];}return db[_0x86ad('0xd9')][_0x86ad('0x59')](_0x1720ed);})[_0x86ad('0x21')](function(_0xdc365e){_0x2b20b6['rows']=_0xdc365e;return _0x2b20b6;});}})['then'](respondWithFilteredResult(_0x4aae92,_0x1720ed))[_0x86ad('0x2c')](handleError(_0x4aae92,null));};exports[_0x86ad('0x116')]=function(_0x12bc36,_0x14d575,_0x25cb44){return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x12bc36[_0x86ad('0x5c')]['id']}})['then'](handleEntityNotFound(_0x14d575,null))[_0x86ad('0x21')](function(_0x5aa324){if(_0x5aa324){return _0x5aa324[_0x86ad('0x116')](_0x12bc36[_0x86ad('0x61')]['ids'],_['omit'](_0x12bc36['body'],['ids','id'])||{})[_0x86ad('0xbd')](function(_0x2b5a65){for(var _0x38b7a9=0x0;_0x38b7a9<_0x12bc36[_0x86ad('0x61')][_0x86ad('0x73')][_0x86ad('0x4a')];_0x38b7a9+=0x1){socket['emit'](_0x86ad('0x117'),{'UserId':_0x12bc36[_0x86ad('0x61')]['ids'][_0x38b7a9],'ChatWebsiteId':_0x12bc36['params']['id']});}return _0x2b5a65;});}})[_0x86ad('0x21')](respondWithResult(_0x14d575,null))[_0x86ad('0x2c')](handleError(_0x14d575,null));};exports[_0x86ad('0x118')]=function(_0x51fc09,_0x3c0035,_0x629ec1){return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x51fc09[_0x86ad('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3c0035,null))[_0x86ad('0x21')](function(_0x206117){if(_0x206117){return _0x206117['removeAgents'](_0x51fc09[_0x86ad('0x44')]['ids'])[_0x86ad('0x21')](function(){if(_[_0x86ad('0x119')](_0x51fc09[_0x86ad('0x44')][_0x86ad('0x73')])){for(var _0x50a323=0x0;_0x50a323<_0x51fc09[_0x86ad('0x44')][_0x86ad('0x73')][_0x86ad('0x4a')];_0x50a323+=0x1){socket[_0x86ad('0x11a')](_0x86ad('0x11b'),{'UserId':Number(_0x51fc09[_0x86ad('0x44')][_0x86ad('0x73')][_0x50a323]),'ChatWebsiteId':Number(_0x51fc09['params']['id'])});}}else{socket['emit'](_0x86ad('0x11b'),{'UserId':Number(_0x51fc09[_0x86ad('0x44')]['ids']),'ChatWebsiteId':Number(_0x51fc09[_0x86ad('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c0035,null))[_0x86ad('0x2c')](handleError(_0x3c0035,null));};exports[_0x86ad('0x11c')]=function(_0x375cf4,_0x1194de,_0x288bd1){var _0x4cb275={};var _0x9ca5e4={};var _0x10910b;var _0x1bbbca;return db['ChatWebsite'][_0x86ad('0x6e')]({'where':{'id':_0x375cf4['params']['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x1194de,null))[_0x86ad('0x21')](function(_0x12a1e8){if(_0x12a1e8){_0x10910b=_0x12a1e8;_0x9ca5e4[_0x86ad('0x46')]=_['keys'](db[_0x86ad('0xeb')][_0x86ad('0x40')]);_0x9ca5e4[_0x86ad('0x44')]=_['keys'](_0x375cf4[_0x86ad('0x44')]);_0x9ca5e4['filters']=_[_0x86ad('0x48')](_0x9ca5e4['model'],_0x9ca5e4[_0x86ad('0x44')]);_0x4cb275[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0x9ca5e4[_0x86ad('0x46')],qs[_0x86ad('0x49')](_0x375cf4[_0x86ad('0x44')]['fields']));_0x4cb275[_0x86ad('0x47')]=_0x4cb275[_0x86ad('0x47')][_0x86ad('0x4a')]?_0x4cb275[_0x86ad('0x47')]:_0x9ca5e4[_0x86ad('0x46')];_0x4cb275['order']=qs[_0x86ad('0x4e')](_0x375cf4['query']['sort']);_0x4cb275[_0x86ad('0x4f')]=qs[_0x86ad('0x45')](_[_0x86ad('0x50')](_0x375cf4[_0x86ad('0x44')],_0x9ca5e4['filters']));if(_0x375cf4['query'][_0x86ad('0x51')]){_0x4cb275[_0x86ad('0x4f')]=_[_0x86ad('0x54')](_0x4cb275[_0x86ad('0x4f')],{'$or':_[_0x86ad('0x52')](_0x4cb275[_0x86ad('0x47')],function(_0x17ad02){var _0x372cce={};_0x372cce[_0x17ad02]={'$like':'%'+_0x375cf4[_0x86ad('0x44')][_0x86ad('0x51')]+'%'};return _0x372cce;})});}_0x4cb275=_[_0x86ad('0x54')]({},_0x4cb275,_0x375cf4['options']);return _0x10910b[_0x86ad('0x11c')](_0x4cb275);}})[_0x86ad('0x21')](function(_0x5ddc14){if(_0x5ddc14){_0x1bbbca=_0x5ddc14[_0x86ad('0x4a')];if(!_0x375cf4[_0x86ad('0x44')][_0x86ad('0x4b')](_0x86ad('0x4c'))){_0x4cb275['limit']=qs[_0x86ad('0x32')](_0x375cf4['query']['limit']);_0x4cb275[_0x86ad('0x31')]=qs[_0x86ad('0x31')](_0x375cf4['query'][_0x86ad('0x31')]);}return _0x10910b[_0x86ad('0x11c')](_0x4cb275);}})[_0x86ad('0x21')](function(_0x2f6dab){if(_0x2f6dab){return _0x2f6dab?{'count':_0x1bbbca,'rows':_0x2f6dab}:null;}})[_0x86ad('0x21')](respondWithResult(_0x1194de,null))[_0x86ad('0x2c')](handleError(_0x1194de,null));}; \ No newline at end of file +var _0xf231=['intersection','fields','length','hasOwnProperty','nolimit','limit','offset','order','where','filter','merge','options','count','includeAll','findAll','show','params','Pause','include','find','create','body','user','role','UserProfileSection','userProfileId','destroy','describe','Disposition','getDispositions','findOne','sort','ChatWebsiteId','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','ids','filename','agentAvatar','file','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','isNil','server/files/images/logos/','join','download','existsSync','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','chat','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','DESC','Applications','account','applications','list','List','asc','Contacts','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','autoclose','push','unmanaged','*,*,*,*','AttachmentId','User','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','addInteraction','getInteractions','Contact','Owner','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','Interval','Intervals','virtual','License','all','readFileSync','server/files/chat/iframe.js','remote','x-real-ip','connection','replace','alignment','verticalAlignment','sequelize','ChatApplication','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','addAgents','omit','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','set','Content-Range','json','apply','reject','save','update','get','ChatWebsites','UserProfileResource','stack','name','send','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0xbcf099,_0x5119b4){var _0x2b483d=function(_0x9968ba){while(--_0x9968ba){_0xbcf099['push'](_0xbcf099['shift']());}};_0x2b483d(++_0x5119b4);}(_0xf231,0xca));var _0x1f23=function(_0x13e35d,_0x57f3c5){_0x13e35d=_0x13e35d-0x0;var _0x21cbe4=_0xf231[_0x13e35d];return _0x21cbe4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1f23('0x0'));var rimraf=require(_0x1f23('0x1'));var zipdir=require(_0x1f23('0x2'));var jsonpatch=require(_0x1f23('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1f23('0x4'));var util=require(_0x1f23('0x5'));var path=require(_0x1f23('0x6'));var sox=require(_0x1f23('0x7'));var csv=require(_0x1f23('0x8'));var ejs=require(_0x1f23('0x9'));var fs=require('fs');var _=require(_0x1f23('0xa'));var squel=require(_0x1f23('0xb'));var crypto=require(_0x1f23('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1f23('0xd'));var toCsv=require(_0x1f23('0x8'));var querystring=require(_0x1f23('0xe'));var Papa=require(_0x1f23('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1f23('0x10'));var as=require(_0x1f23('0x11'));var hardwareService=require(_0x1f23('0x12'));var logger=require(_0x1f23('0x13'))(_0x1f23('0x14'));var utils=require(_0x1f23('0x15'));var config=require(_0x1f23('0x16'));var licenseUtil=require(_0x1f23('0x17'));var db=require('../../mysqldb')['db'];config[_0x1f23('0x18')]=_[_0x1f23('0x19')](config[_0x1f23('0x18')],{'host':_0x1f23('0x1a'),'port':0x18eb});var socket=require(_0x1f23('0x1b'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x1f23('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x1f23('0x1d')][_0x1f23('0x1e')]({'port':0x232a});var client9003=jayson[_0x1f23('0x1d')][_0x1f23('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x21993a,_0x2cc9a2,_0x66453a,_0x2e2054){return new BPromise(function(_0x2c612f,_0x1e0994){var _0x377cba=_0x2e2054||client;return _0x377cba[_0x1f23('0x1f')](_0x21993a,_0x66453a)[_0x1f23('0x20')](function(_0x2e3ea9){logger[_0x1f23('0x21')](_0x1f23('0x22'),_0x2cc9a2,_0x1f23('0x23'));logger[_0x1f23('0x24')](_0x1f23('0x25'),_0x2cc9a2,'request\x20sent',JSON[_0x1f23('0x26')](_0x2e3ea9));if(_0x2e3ea9[_0x1f23('0x27')]){if(_0x2e3ea9[_0x1f23('0x27')][_0x1f23('0x28')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x2cc9a2,_0x2e3ea9[_0x1f23('0x27')][_0x1f23('0x29')]);return _0x1e0994(_0x2e3ea9['error'][_0x1f23('0x29')]);}logger[_0x1f23('0x27')](_0x1f23('0x22'),_0x2cc9a2,_0x2e3ea9[_0x1f23('0x27')][_0x1f23('0x29')]);return _0x2c612f(_0x2e3ea9[_0x1f23('0x27')][_0x1f23('0x29')]);}else{logger[_0x1f23('0x21')](_0x1f23('0x22'),_0x2cc9a2,'request\x20sent');_0x2c612f(_0x2e3ea9[_0x1f23('0x2a')][_0x1f23('0x29')]);}})[_0x1f23('0x2b')](function(_0x4559c1){logger[_0x1f23('0x27')](_0x1f23('0x22'),_0x2cc9a2,_0x4559c1);_0x1e0994(_0x4559c1);});});}function respondWithStatusCode(_0x288348,_0x6fc444){_0x6fc444=_0x6fc444||0xcc;return function(_0x45cb44){if(_0x45cb44){return _0x288348[_0x1f23('0x2c')](_0x6fc444);}return _0x288348[_0x1f23('0x2d')](_0x6fc444)[_0x1f23('0x2e')]();};}function respondWithResult(_0x2649ee,_0x352e96){_0x352e96=_0x352e96||0xc8;return function(_0x1bdacf){if(_0x1bdacf){return _0x2649ee[_0x1f23('0x2d')](_0x352e96)['json'](_0x1bdacf);}};}function respondWithFilteredResult(_0x3b576e,_0x20fc7b){return function(_0x1096c3){if(_0x1096c3){var _0x49068a=_0x1096c3['count'],_0x448bac=_0x20fc7b['offset'],_0x4adb00=_0x20fc7b['offset']+_0x20fc7b['limit'],_0x1b3f39;if(_0x4adb00>=_0x49068a){_0x4adb00=_0x49068a;_0x1b3f39=0xc8;}else{_0x1b3f39=0xce;}_0x3b576e[_0x1f23('0x2d')](_0x1b3f39);return _0x3b576e[_0x1f23('0x2f')](_0x1f23('0x30'),_0x448bac+'-'+_0x4adb00+'/'+_0x49068a)[_0x1f23('0x31')](_0x1096c3);}return null;};}function patchUpdates(_0x10aded){return function(_0x1fd56f){try{jsonpatch[_0x1f23('0x32')](_0x1fd56f,_0x10aded,!![]);}catch(_0x47897e){return BPromise[_0x1f23('0x33')](_0x47897e);}return _0x1fd56f[_0x1f23('0x34')]();};}function saveUpdates(_0x7b8535,_0x1b0ab7){return function(_0x39295e){if(_0x39295e){return _0x39295e[_0x1f23('0x35')](_0x7b8535)[_0x1f23('0x20')](function(_0x332180){return _0x332180;});}return null;};}function removeEntity(_0x3d53a8,_0x42ee15){return function(_0x2c6a6e){if(_0x2c6a6e){return _0x2c6a6e['destroy']()[_0x1f23('0x20')](function(){var _0x26eb55=_0x2c6a6e[_0x1f23('0x36')]({'plain':!![]});var _0x53f9ff=_0x1f23('0x37');return db[_0x1f23('0x38')]['destroy']({'where':{'type':_0x53f9ff,'resourceId':_0x26eb55['id']}})[_0x1f23('0x20')](function(){return _0x2c6a6e;});})[_0x1f23('0x20')](function(){_0x3d53a8[_0x1f23('0x2d')](0xcc)[_0x1f23('0x2e')]();});}};}function handleEntityNotFound(_0x21ab7c,_0x5b4577){return function(_0x5cea8f){if(!_0x5cea8f){_0x21ab7c['sendStatus'](0x194);}return _0x5cea8f;};}function handleError(_0x579f0b,_0x2631ff){_0x2631ff=_0x2631ff||0x1f4;return function(_0x557547){logger['error'](_0x557547[_0x1f23('0x39')]);if(_0x557547['name']){delete _0x557547[_0x1f23('0x3a')];}_0x579f0b['status'](_0x2631ff)[_0x1f23('0x3b')](_0x557547);};}exports['index']=function(_0x561707,_0x3d9d74){var _0x5b1006={'include':[{'model':db['Pause'],'as':_0x1f23('0x3c')}]},_0x1f9979={},_0x350955={'count':0x0,'rows':[]};var _0x57098c=_[_0x1f23('0x3d')](db[_0x1f23('0x3e')][_0x1f23('0x3f')],function(_0x5e3d93){return{'name':_0x5e3d93[_0x1f23('0x40')],'type':_0x5e3d93[_0x1f23('0x41')][_0x1f23('0x42')]};});_0x1f9979[_0x1f23('0x43')]=_[_0x1f23('0x3d')](_0x57098c,_0x1f23('0x3a'));_0x1f9979[_0x1f23('0x44')]=_[_0x1f23('0x45')](_0x561707[_0x1f23('0x44')]);_0x1f9979[_0x1f23('0x46')]=_['intersection'](_0x1f9979[_0x1f23('0x43')],_0x1f9979[_0x1f23('0x44')]);_0x5b1006[_0x1f23('0x47')]=_[_0x1f23('0x48')](_0x1f9979['model'],qs[_0x1f23('0x49')](_0x561707[_0x1f23('0x44')][_0x1f23('0x49')]));_0x5b1006[_0x1f23('0x47')]=_0x5b1006[_0x1f23('0x47')][_0x1f23('0x4a')]?_0x5b1006[_0x1f23('0x47')]:_0x1f9979[_0x1f23('0x43')];if(!_0x561707[_0x1f23('0x44')][_0x1f23('0x4b')](_0x1f23('0x4c'))){_0x5b1006['limit']=qs[_0x1f23('0x4d')](_0x561707[_0x1f23('0x44')][_0x1f23('0x4d')]);_0x5b1006[_0x1f23('0x4e')]=qs[_0x1f23('0x4e')](_0x561707[_0x1f23('0x44')][_0x1f23('0x4e')]);}_0x5b1006[_0x1f23('0x4f')]=qs['sort'](_0x561707['query']['sort']);_0x5b1006[_0x1f23('0x50')]=qs[_0x1f23('0x46')](_['pick'](_0x561707[_0x1f23('0x44')],_0x1f9979['filters']),_0x57098c);if(_0x561707[_0x1f23('0x44')][_0x1f23('0x51')]){_0x5b1006[_0x1f23('0x50')]=_[_0x1f23('0x52')](_0x5b1006['where'],{'$or':_[_0x1f23('0x3d')](_0x57098c,function(_0x3901fb){if(_0x3901fb[_0x1f23('0x41')]!=='VIRTUAL'){var _0x12ba0a={};_0x12ba0a[_0x3901fb[_0x1f23('0x3a')]]={'$like':'%'+_0x561707['query']['filter']+'%'};return _0x12ba0a;}})});}_0x5b1006=_[_0x1f23('0x52')]({},_0x5b1006,_0x561707[_0x1f23('0x53')]);var _0x520c59={'where':_0x5b1006[_0x1f23('0x50')]};return db[_0x1f23('0x3e')][_0x1f23('0x54')](_0x520c59)[_0x1f23('0x20')](function(_0x3aee3b){_0x350955[_0x1f23('0x54')]=_0x3aee3b;if(_0x561707[_0x1f23('0x44')][_0x1f23('0x55')]){_0x5b1006['include']=[{'all':!![]}];}return db[_0x1f23('0x3e')][_0x1f23('0x56')](_0x5b1006);})['then'](function(_0x46b397){_0x350955['rows']=_0x46b397;return _0x350955;})[_0x1f23('0x20')](respondWithFilteredResult(_0x3d9d74,_0x5b1006))[_0x1f23('0x2b')](handleError(_0x3d9d74,null));};exports[_0x1f23('0x57')]=function(_0x241900,_0x30f961){var _0x2e6da6={'raw':![],'where':{'id':_0x241900[_0x1f23('0x58')]['id']},'include':[{'model':db[_0x1f23('0x59')],'as':'mandatoryDispositionPause'}]},_0x32368e={};_0x32368e[_0x1f23('0x43')]=_[_0x1f23('0x45')](db['ChatWebsite'][_0x1f23('0x3f')]);_0x32368e['query']=_[_0x1f23('0x45')](_0x241900['query']);_0x32368e[_0x1f23('0x46')]=_['intersection'](_0x32368e[_0x1f23('0x43')],_0x32368e[_0x1f23('0x44')]);_0x2e6da6[_0x1f23('0x47')]=_[_0x1f23('0x48')](_0x32368e[_0x1f23('0x43')],qs[_0x1f23('0x49')](_0x241900[_0x1f23('0x44')][_0x1f23('0x49')]));_0x2e6da6[_0x1f23('0x47')]=_0x2e6da6[_0x1f23('0x47')][_0x1f23('0x4a')]?_0x2e6da6[_0x1f23('0x47')]:_0x32368e['model'];if(_0x241900['query'][_0x1f23('0x55')]){_0x2e6da6[_0x1f23('0x5a')]=[{'all':!![]}];}_0x2e6da6=_[_0x1f23('0x52')]({},_0x2e6da6,_0x241900[_0x1f23('0x53')]);return db[_0x1f23('0x3e')][_0x1f23('0x5b')](_0x2e6da6)[_0x1f23('0x20')](handleEntityNotFound(_0x30f961,null))[_0x1f23('0x20')](respondWithResult(_0x30f961,null))[_0x1f23('0x2b')](handleError(_0x30f961,null));};exports[_0x1f23('0x5c')]=function(_0x1d7288,_0x404054){return db[_0x1f23('0x3e')][_0x1f23('0x5c')](_0x1d7288[_0x1f23('0x5d')],{})[_0x1f23('0x20')](function(_0x298f6f){var _0x12fcdd=_0x1d7288[_0x1f23('0x5e')][_0x1f23('0x36')]({'plain':!![]});if(!_0x12fcdd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12fcdd[_0x1f23('0x5f')]===_0x1f23('0x5e')){var _0x8b1918=_0x298f6f[_0x1f23('0x36')]({'plain':!![]});var _0x469eda='ChatWebsites';return db[_0x1f23('0x60')][_0x1f23('0x5b')]({'where':{'name':_0x469eda,'userProfileId':_0x12fcdd[_0x1f23('0x61')]},'raw':!![]})['then'](function(_0x224a8c){if(_0x224a8c&&_0x224a8c['autoAssociation']===0x0){return db[_0x1f23('0x38')][_0x1f23('0x5c')]({'name':_0x8b1918[_0x1f23('0x3a')],'resourceId':_0x8b1918['id'],'type':_0x224a8c[_0x1f23('0x3a')],'sectionId':_0x224a8c['id']},{})[_0x1f23('0x20')](function(){return _0x298f6f;});}else{return _0x298f6f;}})[_0x1f23('0x2b')](function(_0x31ddae){logger[_0x1f23('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31ddae);throw _0x31ddae;});}return _0x298f6f;})[_0x1f23('0x20')](respondWithResult(_0x404054,0xc9))[_0x1f23('0x2b')](handleError(_0x404054,null));};exports[_0x1f23('0x35')]=function(_0x28c567,_0x291be3){if(_0x28c567[_0x1f23('0x5d')]['id']){delete _0x28c567[_0x1f23('0x5d')]['id'];}return db[_0x1f23('0x3e')][_0x1f23('0x5b')]({'where':{'id':_0x28c567['params']['id']},'include':[{'model':db[_0x1f23('0x59')],'as':_0x1f23('0x3c')}]})['then'](handleEntityNotFound(_0x291be3,null))[_0x1f23('0x20')](saveUpdates(_0x28c567[_0x1f23('0x5d')],null))['then'](respondWithResult(_0x291be3,null))['catch'](handleError(_0x291be3,null));};exports[_0x1f23('0x62')]=function(_0x1bd461,_0x1349e3){return db[_0x1f23('0x3e')][_0x1f23('0x5b')]({'where':{'id':_0x1bd461['params']['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x1349e3,null))[_0x1f23('0x20')](removeEntity(_0x1349e3,null))[_0x1f23('0x2b')](handleError(_0x1349e3,null));};exports[_0x1f23('0x63')]=function(_0x232dad,_0x51ea09){return db[_0x1f23('0x3e')]['describe']()['then'](respondWithResult(_0x51ea09,null))[_0x1f23('0x2b')](handleError(_0x51ea09,null));};exports['addDisposition']=function(_0x5055ee,_0x4300eb,_0x56e017){if(_0x5055ee[_0x1f23('0x5d')]['id']){delete _0x5055ee[_0x1f23('0x5d')]['id'];}return db['ChatWebsite'][_0x1f23('0x5b')]({'where':{'id':_0x5055ee[_0x1f23('0x58')]['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x4300eb,null))[_0x1f23('0x20')](function(_0xd3b95d){if(_0xd3b95d){_0x5055ee[_0x1f23('0x5d')]['ChatWebsiteId']=_0xd3b95d['id'];return db[_0x1f23('0x64')]['create'](_0x5055ee[_0x1f23('0x5d')]);}})['then'](respondWithResult(_0x4300eb,null))['catch'](handleError(_0x4300eb,null));};exports[_0x1f23('0x65')]=function(_0x1d4095,_0x2608d0,_0x3f1a13){var _0x31bee6={'raw':![],'where':{}};var _0x5c3524={};var _0x2de696={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1f23('0x66')]({'where':{'id':_0x1d4095['params']['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x2608d0,null))[_0x1f23('0x20')](function(_0x31123c){if(_0x31123c){_0x5c3524[_0x1f23('0x43')]=_[_0x1f23('0x45')](db[_0x1f23('0x64')][_0x1f23('0x3f')]);_0x5c3524[_0x1f23('0x44')]=_[_0x1f23('0x45')](_0x1d4095[_0x1f23('0x44')]);_0x5c3524[_0x1f23('0x46')]=_['intersection'](_0x5c3524[_0x1f23('0x43')],_0x5c3524[_0x1f23('0x44')]);_0x31bee6['attributes']=_[_0x1f23('0x48')](_0x5c3524[_0x1f23('0x43')],qs[_0x1f23('0x49')](_0x1d4095['query']['fields']));_0x31bee6[_0x1f23('0x47')]=_0x31bee6[_0x1f23('0x47')][_0x1f23('0x4a')]?_0x31bee6['attributes']:_0x5c3524[_0x1f23('0x43')];if(!_0x1d4095[_0x1f23('0x44')][_0x1f23('0x4b')](_0x1f23('0x4c'))){_0x31bee6[_0x1f23('0x4d')]=qs[_0x1f23('0x4d')](_0x1d4095[_0x1f23('0x44')]['limit']);_0x31bee6[_0x1f23('0x4e')]=qs[_0x1f23('0x4e')](_0x1d4095[_0x1f23('0x44')]['offset']);}_0x31bee6[_0x1f23('0x4f')]=qs['sort'](_0x1d4095['query'][_0x1f23('0x67')]);_0x31bee6[_0x1f23('0x50')]=qs['filters'](_['pick'](_0x1d4095['query'],_0x5c3524[_0x1f23('0x46')]));_0x31bee6[_0x1f23('0x50')][_0x1f23('0x68')]=_0x31123c['id'];if(_0x1d4095[_0x1f23('0x44')][_0x1f23('0x51')]){_0x31bee6[_0x1f23('0x50')]=_['merge'](_0x31bee6[_0x1f23('0x50')],{'$or':_[_0x1f23('0x3d')](_0x31bee6[_0x1f23('0x47')],function(_0x1a6f2c){var _0x4ffd32={};_0x4ffd32[_0x1a6f2c]={'$like':'%'+_0x1d4095[_0x1f23('0x44')][_0x1f23('0x51')]+'%'};return _0x4ffd32;})});}_0x31bee6=_[_0x1f23('0x52')]({},_0x31bee6,_0x1d4095[_0x1f23('0x53')]);return db[_0x1f23('0x64')][_0x1f23('0x54')]({'where':_0x31bee6[_0x1f23('0x50')]})['then'](function(_0xf1e3b6){_0x2de696['count']=_0xf1e3b6;if(_0x1d4095[_0x1f23('0x44')]['includeAll']){_0x31bee6[_0x1f23('0x5a')]=[{'all':!![]}];}return db[_0x1f23('0x64')][_0x1f23('0x56')](_0x31bee6);})['then'](function(_0x7354f6){_0x2de696[_0x1f23('0x69')]=_0x7354f6;return _0x2de696;});}})[_0x1f23('0x20')](respondWithFilteredResult(_0x2608d0,_0x31bee6))[_0x1f23('0x2b')](handleError(_0x2608d0,null));};exports[_0x1f23('0x6a')]=function(_0x17dee6,_0x1bd207,_0x1f5255){return db[_0x1f23('0x3e')][_0x1f23('0x5b')]({'where':{'id':_0x17dee6[_0x1f23('0x58')]['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x1bd207,null))[_0x1f23('0x20')](function(_0x1600f3){if(_0x1600f3){return _0x1600f3[_0x1f23('0x6a')](_0x17dee6['query']['ids']);}})['then'](respondWithStatusCode(_0x1bd207,null))[_0x1f23('0x2b')](handleError(_0x1bd207,null));};exports[_0x1f23('0x6b')]=function(_0x483a87,_0x2298fa,_0x3dc823){if(_0x483a87[_0x1f23('0x5d')]['id']){delete _0x483a87['body']['id'];}return db[_0x1f23('0x3e')]['find']({'where':{'id':_0x483a87[_0x1f23('0x58')]['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x2298fa,null))['then'](function(_0x43939c){if(_0x43939c){_0x483a87[_0x1f23('0x5d')][_0x1f23('0x68')]=_0x43939c['id'];return db[_0x1f23('0x6c')][_0x1f23('0x5c')](_0x483a87[_0x1f23('0x5d')]);}})[_0x1f23('0x20')](respondWithResult(_0x2298fa,null))[_0x1f23('0x2b')](handleError(_0x2298fa,null));};exports[_0x1f23('0x6d')]=function(_0x39a9cc,_0x2e70df,_0x34a43c){var _0x3e75a7={'raw':![],'where':{}};var _0x2984ff={};var _0x4aebf8={'count':0x0,'rows':[]};return db[_0x1f23('0x3e')]['findOne']({'where':{'id':_0x39a9cc[_0x1f23('0x58')]['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x2e70df,null))[_0x1f23('0x20')](function(_0x18f08a){if(_0x18f08a){_0x2984ff[_0x1f23('0x43')]=_[_0x1f23('0x45')](db[_0x1f23('0x6c')]['rawAttributes']);_0x2984ff[_0x1f23('0x44')]=_['keys'](_0x39a9cc['query']);_0x2984ff['filters']=_[_0x1f23('0x48')](_0x2984ff[_0x1f23('0x43')],_0x2984ff[_0x1f23('0x44')]);_0x3e75a7[_0x1f23('0x47')]=_[_0x1f23('0x48')](_0x2984ff[_0x1f23('0x43')],qs[_0x1f23('0x49')](_0x39a9cc[_0x1f23('0x44')][_0x1f23('0x49')]));_0x3e75a7[_0x1f23('0x47')]=_0x3e75a7[_0x1f23('0x47')]['length']?_0x3e75a7[_0x1f23('0x47')]:_0x2984ff[_0x1f23('0x43')];if(!_0x39a9cc[_0x1f23('0x44')][_0x1f23('0x4b')](_0x1f23('0x4c'))){_0x3e75a7[_0x1f23('0x4d')]=qs[_0x1f23('0x4d')](_0x39a9cc[_0x1f23('0x44')][_0x1f23('0x4d')]);_0x3e75a7[_0x1f23('0x4e')]=qs[_0x1f23('0x4e')](_0x39a9cc['query'][_0x1f23('0x4e')]);}_0x3e75a7['order']=qs[_0x1f23('0x67')](_0x39a9cc[_0x1f23('0x44')][_0x1f23('0x67')]);_0x3e75a7[_0x1f23('0x50')]=qs[_0x1f23('0x46')](_[_0x1f23('0x6e')](_0x39a9cc['query'],_0x2984ff[_0x1f23('0x46')]));_0x3e75a7[_0x1f23('0x50')][_0x1f23('0x68')]=_0x18f08a['id'];if(_0x39a9cc[_0x1f23('0x44')]['filter']){_0x3e75a7[_0x1f23('0x50')]=_['merge'](_0x3e75a7[_0x1f23('0x50')],{'$or':_[_0x1f23('0x3d')](_0x3e75a7[_0x1f23('0x47')],function(_0x2db5e4){var _0x158f06={};_0x158f06[_0x2db5e4]={'$like':'%'+_0x39a9cc['query'][_0x1f23('0x51')]+'%'};return _0x158f06;})});}_0x3e75a7=_['merge']({},_0x3e75a7,_0x39a9cc[_0x1f23('0x53')]);return db[_0x1f23('0x6c')][_0x1f23('0x54')]({'where':_0x3e75a7[_0x1f23('0x50')]})['then'](function(_0x3bf7a9){_0x4aebf8[_0x1f23('0x54')]=_0x3bf7a9;if(_0x39a9cc[_0x1f23('0x44')][_0x1f23('0x55')]){_0x3e75a7['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3e75a7);})[_0x1f23('0x20')](function(_0x261095){_0x4aebf8['rows']=_0x261095;return _0x4aebf8;});}})['then'](respondWithFilteredResult(_0x2e70df,_0x3e75a7))[_0x1f23('0x2b')](handleError(_0x2e70df,null));};exports[_0x1f23('0x6f')]=function(_0x2e1355,_0x10292c,_0x21e0fa){return db['ChatWebsite'][_0x1f23('0x5b')]({'where':{'id':_0x2e1355[_0x1f23('0x58')]['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x10292c,null))['then'](function(_0x3f5133){if(_0x3f5133){return _0x3f5133[_0x1f23('0x6f')](_0x2e1355['query'][_0x1f23('0x70')]);}})[_0x1f23('0x20')](respondWithStatusCode(_0x10292c,null))[_0x1f23('0x2b')](handleError(_0x10292c,null));};exports['addLogo']=function(_0x52d972,_0x138612,_0x468d20){_0x52d972['body']['sitepic']=_0x52d972['file'][_0x1f23('0x71')];return db['ChatWebsite'][_0x1f23('0x5b')]({'where':{'id':_0x52d972['params']['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x138612,null))[_0x1f23('0x20')](saveUpdates(_0x52d972[_0x1f23('0x5d')],null))[_0x1f23('0x20')](respondWithResult(_0x138612,null))[_0x1f23('0x2b')](handleError(_0x138612,null));};exports['addAvatar']=function(_0xd0c94f,_0x4f199b,_0x320670){_0xd0c94f[_0x1f23('0x5d')][_0x1f23('0x72')]=_0xd0c94f[_0x1f23('0x73')][_0x1f23('0x71')];return db[_0x1f23('0x3e')][_0x1f23('0x5b')]({'where':{'id':_0xd0c94f[_0x1f23('0x58')]['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x4f199b,null))[_0x1f23('0x20')](saveUpdates(_0xd0c94f[_0x1f23('0x5d')],null))[_0x1f23('0x20')](respondWithResult(_0x4f199b,null))[_0x1f23('0x2b')](handleError(_0x4f199b,null));};exports[_0x1f23('0x74')]=function(_0xa1a96b,_0x3c162a,_0x4b93b1){_0xa1a96b['body'][_0x1f23('0x75')]=_0xa1a96b[_0x1f23('0x73')][_0x1f23('0x71')];return db[_0x1f23('0x3e')][_0x1f23('0x5b')]({'where':{'id':_0xa1a96b[_0x1f23('0x58')]['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x3c162a,null))[_0x1f23('0x20')](saveUpdates(_0xa1a96b[_0x1f23('0x5d')],null))['then'](respondWithResult(_0x3c162a,null))[_0x1f23('0x2b')](handleError(_0x3c162a,null));};exports['addSystemAvatar']=function(_0x5ce22f,_0x4ac547,_0x16b09f){_0x5ce22f[_0x1f23('0x5d')][_0x1f23('0x76')]=_0x5ce22f[_0x1f23('0x73')][_0x1f23('0x71')];return db[_0x1f23('0x3e')]['find']({'where':{'id':_0x5ce22f['params']['id']}})['then'](handleEntityNotFound(_0x4ac547,null))[_0x1f23('0x20')](saveUpdates(_0x5ce22f[_0x1f23('0x5d')],null))['then'](respondWithResult(_0x4ac547,null))[_0x1f23('0x2b')](handleError(_0x4ac547,null));};exports[_0x1f23('0x77')]=function(_0x200bd4,_0x2b35f2,_0x25669e){var _0x394883=path['join'](config[_0x1f23('0x78')],_0x1f23('0x79'));var _0x30a294={'where':{'id':_0x200bd4[_0x1f23('0x58')]['id']},'attributes':['id',_0x1f23('0x7a')],'raw':!![]};var _0x18b7ca=![];return require('../../config/license/util')[_0x1f23('0x7b')]()[_0x1f23('0x20')](function(_0x3aa853){if(_0x3aa853){_0x18b7ca=_0x3aa853[_0x1f23('0x7c')];}})[_0x1f23('0x20')](function(){return db[_0x1f23('0x3e')][_0x1f23('0x5b')](_0x30a294);})[_0x1f23('0x20')](handleEntityNotFound(_0x2b35f2,null))[_0x1f23('0x20')](function(_0x3a76f2){if(_0x3a76f2){if(!_[_0x1f23('0x7d')](_0x3a76f2[_0x1f23('0x7a')])){if(fs['existsSync'](path['join'](config[_0x1f23('0x78')],_0x1f23('0x7e'),_0x3a76f2[_0x1f23('0x7a')]))&&_0x18b7ca){_0x394883=path[_0x1f23('0x7f')](config[_0x1f23('0x78')],'server/files/images/logos/',_0x3a76f2['sitepic']);}}return _0x2b35f2[_0x1f23('0x80')](_0x394883);}})[_0x1f23('0x2b')](handleError(_0x2b35f2,null));};exports['getAvatar']=function(_0x15e787,_0x5cf2b9,_0x50b9c9){var _0x1cdc1b=path['join'](config[_0x1f23('0x78')],'server/files/images/avatars/default_avatar.png');var _0x980e89={'where':{'id':_0x15e787['params']['id']},'attributes':['id',_0x1f23('0x72')],'raw':!![]};return db['ChatWebsite'][_0x1f23('0x5b')](_0x980e89)[_0x1f23('0x20')](handleEntityNotFound(_0x5cf2b9,null))[_0x1f23('0x20')](function(_0x2da5af){if(_0x2da5af){if(!_[_0x1f23('0x7d')](_0x2da5af['agentAvatar'])){if(fs[_0x1f23('0x81')](path[_0x1f23('0x7f')](config['root'],'server/files/images/avatars/',_0x2da5af[_0x1f23('0x72')]))){_0x1cdc1b=path[_0x1f23('0x7f')](config[_0x1f23('0x78')],'server/files/images/avatars/',_0x2da5af[_0x1f23('0x72')]);}}return _0x5cf2b9[_0x1f23('0x80')](_0x1cdc1b);}})[_0x1f23('0x2b')](handleError(_0x5cf2b9,null));};exports[_0x1f23('0x82')]=function(_0x5f2ac,_0x5ee4bd,_0x4ec2fd){var _0x46c1c1=path[_0x1f23('0x7f')](config[_0x1f23('0x78')],_0x1f23('0x83'));var _0x2d5dec={'where':{'id':_0x5f2ac[_0x1f23('0x58')]['id']},'attributes':['id',_0x1f23('0x75'),_0x1f23('0x84')],'raw':!![]};return db[_0x1f23('0x3e')]['find'](_0x2d5dec)[_0x1f23('0x20')](handleEntityNotFound(_0x5ee4bd,null))[_0x1f23('0x20')](function(_0x386210){if(_0x386210){if(!_[_0x1f23('0x7d')](_0x386210['customerAvatar'])){if(fs['existsSync'](path['join'](config[_0x1f23('0x78')],_0x1f23('0x85'),_0x386210[_0x1f23('0x75')]))&&_0x386210['showCustomerAvatar']){_0x46c1c1=path['join'](config[_0x1f23('0x78')],_0x1f23('0x85'),_0x386210[_0x1f23('0x75')]);}}return _0x5ee4bd[_0x1f23('0x80')](_0x46c1c1);}})['catch'](handleError(_0x5ee4bd,null));};exports[_0x1f23('0x86')]=function(_0x17236c,_0x170cfd,_0x4f3936){var _0x5eb833=path[_0x1f23('0x7f')](config[_0x1f23('0x78')],_0x1f23('0x87'));var _0x47bb5d={'where':{'id':_0x17236c[_0x1f23('0x58')]['id']},'attributes':['id',_0x1f23('0x76')],'raw':!![]};return db['ChatWebsite'][_0x1f23('0x5b')](_0x47bb5d)['then'](handleEntityNotFound(_0x170cfd,null))['then'](function(_0x233f31){if(_0x233f31){if(!_[_0x1f23('0x7d')](_0x233f31[_0x1f23('0x76')])){if(fs[_0x1f23('0x81')](path[_0x1f23('0x7f')](config[_0x1f23('0x78')],_0x1f23('0x85'),_0x233f31[_0x1f23('0x76')]))){_0x5eb833=path[_0x1f23('0x7f')](config['root'],_0x1f23('0x85'),_0x233f31['systemAvatar']);}}return _0x170cfd[_0x1f23('0x80')](_0x5eb833);}})[_0x1f23('0x2b')](handleError(_0x170cfd,null));};exports[_0x1f23('0x88')]=function(_0xabe167,_0x433aa8,_0x196f15){var _0x381228=require(_0x1f23('0x89'));var _0x487a90=new _0x381228();var _0x176b39=_0x487a90[_0x1f23('0x8a')](_0xabe167[_0x1f23('0x8b')]['user-agent'])['getResult']();var _0x124d70={'body':_0xabe167[_0x1f23('0x5d')],'channel':_0x1f23('0x8c')};var _0x22def3=[];var _0x3ec59e=[];var _0x25ea83={};var _0x21867a=![];return db[_0x1f23('0x8d')]['describe']()[_0x1f23('0x20')](function(_0x51c2e1){if(!_0x51c2e1){throw new db['Sequelize'][(_0x1f23('0x8e'))]('no\x20available\x20attributes');}_0x22def3=_[_0x1f23('0x8f')](_[_0x1f23('0x45')](_0x51c2e1),[_0x1f23('0x90'),'updatedAt']);_0x3ec59e=_[_0x1f23('0x8f')](_[_0x1f23('0x45')](_0x51c2e1),['createdAt',_0x1f23('0x91'),_0x1f23('0x92'),_0x1f23('0x93')]);if(_0xabe167[_0x1f23('0x5d')]['id']){delete _0xabe167[_0x1f23('0x5d')]['id'];}if(_[_0x1f23('0x7d')](_0xabe167[_0x1f23('0x5d')]['from'])){throw new db[(_0x1f23('0x94'))][(_0x1f23('0x8e'))](_0x1f23('0x95'));}if(_[_0x1f23('0x7d')](_0xabe167[_0x1f23('0x5d')][_0x1f23('0x5d')])||_0xabe167[_0x1f23('0x5d')][_0x1f23('0x5d')]===''){throw new db[(_0x1f23('0x94'))][(_0x1f23('0x8e'))](_0x1f23('0x96'));}if(_[_0x1f23('0x7d')](_0xabe167[_0x1f23('0x5d')][_0x1f23('0x97')])){throw new db['Sequelize'][(_0x1f23('0x8e'))](_0x1f23('0x98')+_0x3ec59e);}if(!_[_0x1f23('0x99')](_0x3ec59e,_0xabe167[_0x1f23('0x5d')][_0x1f23('0x97')])){throw new db[(_0x1f23('0x94'))][(_0x1f23('0x8e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3ec59e);}_0x25ea83[_0xabe167[_0x1f23('0x5d')][_0x1f23('0x97')]]=_0xabe167[_0x1f23('0x5d')][_0x1f23('0x9a')];})[_0x1f23('0x20')](function(){return db[_0x1f23('0x3e')]['find']({'where':{'id':_0xabe167[_0x1f23('0x58')]['id']},'include':[{'model':db[_0x1f23('0x9b')],'as':'List','include':[{'model':db[_0x1f23('0x8d')],'as':'Contacts','where':_0x25ea83,'limit':0x1,'order':[[_0x1f23('0x91'),_0x1f23('0x9c')]]}]},{'model':db['ChatApplication'],'as':_0x1f23('0x9d')}]});})['then'](handleEntityNotFound(_0x433aa8,null))[_0x1f23('0x20')](function(_0x496e56){if(_0x496e56&&_0x496e56['List']){_0x124d70[_0x1f23('0x9e')]=_0x496e56;_0x124d70[_0x1f23('0x9f')]=_0x496e56[_0x1f23('0x9d')];_0x124d70[_0x1f23('0xa0')]=_0x496e56[_0x1f23('0xa1')];_0x124d70[_0x1f23('0x9f')]=_['orderBy'](_0x124d70[_0x1f23('0x9f')],['priority'],[_0x1f23('0xa2')]);if(_0x124d70[_0x1f23('0x9e')][_0x1f23('0x9d')]){delete _0x124d70['account'][_0x1f23('0x9d')];}if(_0x124d70[_0x1f23('0x9e')][_0x1f23('0xa1')]&&_0x124d70[_0x1f23('0x9e')]['List'][_0x1f23('0xa3')][_0x1f23('0x4a')]){return _0x124d70[_0x1f23('0x9e')]['List']['Contacts'][0x0];}var _0x4c0a71=_[_0x1f23('0x19')](_0xabe167[_0x1f23('0x5d')],{'firstName':_0xabe167['body'][_0x1f23('0x9a')],'ListId':_0x496e56[_0x1f23('0x93')]});_0x4c0a71[_0xabe167['body'][_0x1f23('0x97')]]=_0xabe167[_0x1f23('0x5d')][_0x1f23('0x9a')];return db[_0x1f23('0x8d')][_0x1f23('0x5c')](_0x4c0a71,{'fields':_0x22def3,'raw':!![]});}})[_0x1f23('0x20')](handleEntityNotFound(_0x433aa8,null))['then'](function(_0x2ab772){_0x124d70['contact']=_0x2ab772;var _0x4066cc=_0xabe167['body'][_0x1f23('0xa4')];if(_0xabe167[_0x1f23('0x8b')][_0x1f23('0xa5')]){_0x4066cc=_0xabe167[_0x1f23('0x8b')][_0x1f23('0xa5')];}else if(_0xabe167[_0x1f23('0x8b')][_0x1f23('0xa6')]){_0x4066cc=_['first'](_0xabe167['headers']['x-forwarded-for'][_0x1f23('0xa7')](','));}if(_0x2ab772){var _0x4f3ec4={'ContactId':_0x2ab772['id'],'ChatWebsiteId':_0xabe167[_0x1f23('0x58')]['id'],'from':(_0x2ab772['firstName']||'')+'\x20'+(_0x2ab772[_0x1f23('0xa8')]||''),'customerIp':_0x4066cc,'customerPort':_0xabe167[_0x1f23('0x8b')][_0x1f23('0xa9')]?_0xabe167['headers'][_0x1f23('0xa9')]:null,'referer':_0xabe167[_0x1f23('0x5d')][_0x1f23('0xaa')],'browserName':_0x176b39[_0x1f23('0xab')][_0x1f23('0x3a')]&&_0x176b39[_0x1f23('0xab')]['version']?util[_0x1f23('0xac')](_0x1f23('0xad'),_0x176b39[_0x1f23('0xab')]['name'],_0x176b39[_0x1f23('0xab')][_0x1f23('0xae')]):_0x1f23('0xaf'),'browserVersion':_0x176b39[_0x1f23('0xab')][_0x1f23('0xae')]||_0x1f23('0xaf'),'osName':util[_0x1f23('0xac')](_0x1f23('0xad'),_0x176b39['os'][_0x1f23('0x3a')],_0x176b39['os']['version']),'osVersion':_0x176b39['os'][_0x1f23('0xae')],'deviceModel':_0x176b39[_0x1f23('0xb0')][_0x1f23('0x43')]&&_0x176b39[_0x1f23('0xb0')][_0x1f23('0xb1')]?util[_0x1f23('0xac')](_0x1f23('0xb2'),_0x176b39['device']['model'],_0x176b39[_0x1f23('0xb0')][_0x1f23('0xb1')],_0x176b39[_0x1f23('0xb0')][_0x1f23('0x41')]):null,'deviceVendor':_0x176b39[_0x1f23('0xb0')]['vendor'],'deviceType':_0x176b39[_0x1f23('0xb0')][_0x1f23('0x41')],'formData':JSON[_0x1f23('0x26')](_0xabe167['body'])};var _0x27cf73={'ChatWebsiteId':_0xabe167[_0x1f23('0x58')]['id'],'closed':![]};if(_0xabe167['body'][_0x1f23('0xb3')]){_0x27cf73['threadId']=_0xabe167['body'][_0x1f23('0xb3')];return db[_0x1f23('0xb4')][_0x1f23('0x5b')]({'where':_0x27cf73})[_0x1f23('0x20')](function(_0x10ff3b){if(_0x10ff3b){return[_0x10ff3b,![]];}_0x4f3ec4[_0x1f23('0xb3')]=_0xabe167[_0x1f23('0x5d')][_0x1f23('0xb3')];_0x4f3ec4[_0x1f23('0xb5')]=_0xabe167[_0x1f23('0x5d')][_0x1f23('0xb5')];return db['ChatInteraction'][_0x1f23('0x5c')](_0x4f3ec4)[_0x1f23('0x20')](function(_0x441039){return[_0x441039,!![]];});});}_0x27cf73[_0x1f23('0xb6')]=_0x2ab772['id'];if(_0xabe167[_0x1f23('0x5d')][_0x1f23('0xb7')]&&_0xabe167[_0x1f23('0x5d')][_0x1f23('0xb7')]['id']){_0x27cf73['id']=_0xabe167[_0x1f23('0x5d')][_0x1f23('0xb7')]['id'];return db['ChatInteraction'][_0x1f23('0x5b')]({'where':_0x27cf73})[_0x1f23('0x20')](function(_0x156691){if(_0x156691){return[_0x156691,![]];}return db[_0x1f23('0xb4')][_0x1f23('0x5c')](_0x4f3ec4)['then'](function(_0x1dc492){return[_0x1dc492,!![]];});});}return db[_0x1f23('0xb4')][_0x1f23('0x5c')](_0x4f3ec4)[_0x1f23('0x20')](function(_0x216b1a){return[_0x216b1a,!![]];});}})[_0x1f23('0xb8')](function(_0x152366,_0x176564){if(_0x152366){_0x21867a=_0x176564;if(!_0x176564){var _0x239dd2={'from':(_0x124d70[_0x1f23('0xb9')]['firstName']||'')+'\x20'+(_0x124d70[_0x1f23('0xb9')][_0x1f23('0xa8')]||'')};if(_0xabe167[_0x1f23('0x5d')][_0x1f23('0xb3')]&&_0xabe167[_0x1f23('0x5d')]['messageId']&&_0xabe167['body'][_0x1f23('0xb3')]!=_0xabe167[_0x1f23('0x5d')][_0x1f23('0xba')]){_0x239dd2[_0x1f23('0xb3')]=_0xabe167[_0x1f23('0x5d')][_0x1f23('0xba')];}return _0x152366[_0x1f23('0x35')](_0x239dd2);}else{return _0x152366;}}})[_0x1f23('0x20')](function(_0x44d2aa){_0x124d70['interaction']=_0x44d2aa[_0x1f23('0x36')]({'plain':!![]});_0x124d70[_0x1f23('0xb7')]['created']=_0x21867a;if(_0x124d70['interaction']['created']){if(_0x124d70[_0x1f23('0x9e')][_0x1f23('0xbb')]){_0x124d70[_0x1f23('0x9f')][_0x1f23('0xbc')]({'id':0x0,'priority':_0x124d70[_0x1f23('0x9f')][_0x1f23('0x4a')]+0x1,'app':'close','appdata':_0x1f23('0xbd'),'interval':_0x1f23('0xbe')});}}return db['ChatMessage'][_0x1f23('0x5c')]({'body':_0xabe167[_0x1f23('0x5d')][_0x1f23('0x5d')],'ChatWebsiteId':_0xabe167[_0x1f23('0x58')]['id'],'ChatInteractionId':_0x44d2aa['id'],'direction':'in','ContactId':_0x124d70[_0x1f23('0xb9')]['id'],'AttachmentId':_0xabe167[_0x1f23('0x5d')][_0x1f23('0xbf')]});})['then'](function(_0x5ee491){_0x124d70[_0x1f23('0x29')]=_0x5ee491;if(_0x124d70[_0x1f23('0xb7')]['UserId']){return db[_0x1f23('0xc0')][_0x1f23('0x5b')]({'attributes':['id',_0x1f23('0x3a')],'where':{'id':_0x124d70[_0x1f23('0xb7')]['UserId']}})['then'](function(_0x2b7b2a){if(_0x2b7b2a){_0x124d70['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2b7b2a['name']+','+(_0x124d70[_0x1f23('0x9e')][_0x1f23('0xc1')]||0xa),'interval':_0x1f23('0xbe')});_0x124d70[_0x1f23('0xc2')]=!![];}return respondWithRpcPromise('Start',_0x1f23('0xc3'),_0x124d70);});}return respondWithRpcPromise(_0x1f23('0xc4'),_0x1f23('0xc3'),_0x124d70);})['then'](function(_0x328706){respondWithRpcPromise(_0x1f23('0xc5'),_0x1f23('0xc5'),{'event':'notify','message':_0x328706},client9002);return _0x328706;})['then'](respondWithResult(_0x433aa8,null))['catch'](handleError(_0x433aa8,null));};exports[_0x1f23('0xc6')]=function(_0x386715,_0x56b342,_0xe2bc68){var _0x37c601,_0x8d8408,_0x5af7c6;var _0xf7019c=[];var _0x471646=[];var _0x47125e={};return db['CmContact'][_0x1f23('0x63')]()[_0x1f23('0x20')](function(_0x21923a){if(!_0x21923a){throw new db[(_0x1f23('0x94'))][(_0x1f23('0x8e'))]('no\x20available\x20attributes');}_0x471646=_['difference'](_['keys'](_0x21923a),[_0x1f23('0x90'),_0x1f23('0x91')]);_0xf7019c=_[_0x1f23('0x8f')](_['keys'](_0x21923a),[_0x1f23('0x90'),'updatedAt',_0x1f23('0x92'),'ListId']);if(_0x386715['body']['id']){delete _0x386715[_0x1f23('0x5d')]['id'];}if(_[_0x1f23('0x7d')](_0x386715[_0x1f23('0x5d')][_0x1f23('0x9a')])){throw _0x56b342[_0x1f23('0x2d')](0x1f4)[_0x1f23('0x3b')](new db[(_0x1f23('0x94'))]['ValidationError'](_0x1f23('0x95')));}if(_[_0x1f23('0x7d')](_0x386715[_0x1f23('0x5d')]['body'])||_0x386715[_0x1f23('0x5d')][_0x1f23('0x5d')]===''){throw _0x56b342[_0x1f23('0x2d')](0x1f4)[_0x1f23('0x3b')](new db[(_0x1f23('0x94'))][(_0x1f23('0x8e'))](_0x1f23('0x96')));}if(_['isNil'](_0x386715[_0x1f23('0x5d')][_0x1f23('0xc7')])){throw _0x56b342['status'](0x1f4)['send'](new db[(_0x1f23('0x94'))][(_0x1f23('0x8e'))](_0x1f23('0xc8')+_0xf7019c));}if(!_['includes'](_0xf7019c,_0x386715[_0x1f23('0x5d')][_0x1f23('0xc7')])){throw _0x56b342[_0x1f23('0x2d')](0x1f4)[_0x1f23('0x3b')](new db[(_0x1f23('0x94'))][(_0x1f23('0x8e'))](_0x1f23('0xc9')+_0xf7019c));}_0x47125e[_0x386715[_0x1f23('0x5d')][_0x1f23('0xc7')]]=_0x386715[_0x1f23('0x5d')][_0x1f23('0x9a')];})['then'](function(){return db[_0x1f23('0x3e')][_0x1f23('0x5b')]({'where':{'id':_0x386715[_0x1f23('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x1f23('0xa1')}]});})[_0x1f23('0x20')](handleEntityNotFound(_0x56b342,null))[_0x1f23('0x20')](function(_0x27088f){if(_0x27088f&&_0x27088f[_0x1f23('0xa1')]){_0x8d8408=_0x27088f;var _0x581c3b=_[_0x1f23('0x19')](_0x386715[_0x1f23('0x5d')],{'firstName':_0x386715[_0x1f23('0x5d')][_0x1f23('0x9a')],'phone':_0x386715[_0x1f23('0x5d')]['from'],'ListId':_0x27088f[_0x1f23('0x93')]});_0x581c3b[_0x386715[_0x1f23('0x5d')]['mapKeyOffline']]=_0x386715[_0x1f23('0x5d')][_0x1f23('0x9a')];return db[_0x1f23('0x8d')][_0x1f23('0xca')]({'where':_0x47125e,'defaults':_0x581c3b});}})[_0x1f23('0xb8')](function(_0x5a023d){if(_0x5a023d){_0x5af7c6=_0x5a023d;var _0x3c9139=fs['readFileSync'](path[_0x1f23('0x7f')](config[_0x1f23('0x78')],_0x1f23('0xcb')),_0x1f23('0xcc'));var _0x3656a6=ejs[_0x1f23('0xcd')](_0x3c9139,{'body':_[_0x1f23('0xce')](_0x386715[_0x1f23('0x5d')][_0x1f23('0x5d')]),'bodyTitle':_0x8d8408['offlineMessageBody']});return db['ChatOfflineMessage'][_0x1f23('0x5c')]({'body':_0x3656a6,'ContactId':_0x5a023d['id'],'ChatWebsiteId':_0x8d8408['id']});}})[_0x1f23('0x20')](function(_0x4b256a){if(_0x4b256a){_0x37c601=_0x4b256a;return db[_0x1f23('0xcf')][_0x1f23('0x66')]({'where':{'service':!![]},'include':[{'model':db[_0x1f23('0xd0')],'as':_0x1f23('0xd1'),'raw':!![]}]});}})[_0x1f23('0x20')](function(_0x98f11c){if(_0x98f11c&&_0x98f11c[_0x1f23('0xd1')]&&_0x8d8408['forwardOfflineAddress']){var _0x13467a={'tls':{'rejectUnauthorized':![]}};if(_0x98f11c[_0x1f23('0xd1')][_0x1f23('0xd2')]){_0x13467a[_0x1f23('0xd2')]=_0x98f11c[_0x1f23('0xd1')]['service'];}else{_0x13467a[_0x1f23('0xd3')]=_0x98f11c[_0x1f23('0xd1')][_0x1f23('0xd3')];_0x13467a[_0x1f23('0xd4')]=_0x98f11c[_0x1f23('0xd1')][_0x1f23('0xd4')];_0x13467a['secure']=_0x98f11c[_0x1f23('0xd1')][_0x1f23('0xd5')];}if(_0x98f11c[_0x1f23('0xd1')]['authentication']){_0x13467a[_0x1f23('0xd6')]={'user':_0x98f11c['Smtp']['user'],'pass':_0x98f11c[_0x1f23('0xd1')][_0x1f23('0xd7')]};}return respondWithRpcPromise(_0x1f23('0xd8'),_0x1f23('0xd9'),{'account':_0x13467a,'message':{'from':util['format'](_0x1f23('0xda'),_0x98f11c[_0x1f23('0x3a')],_0x98f11c[_0x1f23('0xdb')]||_0x98f11c[_0x1f23('0xd1')][_0x1f23('0x5e')]),'to':_0x8d8408[_0x1f23('0xdc')],'subject':_0x8d8408['offlineMessageSubject'],'text':_0x37c601['body']}},client9003)[_0x1f23('0x20')](function(){return _0x37c601;})[_0x1f23('0x2b')](function(_0x4690da){console[_0x1f23('0x27')](_0x4690da);});}})['then'](function(){if(_0x37c601){return _0x37c601;}})['then'](respondWithResult(_0x56b342,null))[_0x1f23('0x2b')](handleError(_0x56b342,null));};exports['addInteraction']=function(_0x2c550d,_0x3d3010,_0xa10c11){return db[_0x1f23('0xb4')][_0x1f23('0x5b')]({'where':{'id':_0x2c550d[_0x1f23('0x58')]['id']}})['then'](handleEntityNotFound(_0x3d3010,null))[_0x1f23('0x20')](function(_0x31081d){if(_0x31081d){return _0x31081d[_0x1f23('0xdd')](_0x2c550d[_0x1f23('0x5d')]['ids'],_['omit'](_0x2c550d[_0x1f23('0x5d')],[_0x1f23('0x70'),'id'])||{});}})['then'](respondWithResult(_0x3d3010,null))[_0x1f23('0x2b')](handleError(_0x3d3010,null));};exports[_0x1f23('0xde')]=function(_0x831d1d,_0x13165c,_0x39f94f){var _0x503b50={'raw':![],'where':{}};var _0x181b04={};var _0x563a2a={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1f23('0x66')]({'where':{'id':_0x831d1d['params']['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x13165c,null))['then'](function(_0x3021d3){if(_0x3021d3){_0x181b04[_0x1f23('0x43')]=_[_0x1f23('0x45')](db[_0x1f23('0xb4')][_0x1f23('0x3f')]);_0x181b04[_0x1f23('0x44')]=_[_0x1f23('0x45')](_0x831d1d[_0x1f23('0x44')]);_0x181b04['filters']=_[_0x1f23('0x48')](_0x181b04['model'],_0x181b04['query']);_0x503b50[_0x1f23('0x47')]=_['intersection'](_0x181b04[_0x1f23('0x43')],qs[_0x1f23('0x49')](_0x831d1d['query'][_0x1f23('0x49')]));_0x503b50['attributes']=_0x503b50[_0x1f23('0x47')][_0x1f23('0x4a')]?_0x503b50[_0x1f23('0x47')]:_0x181b04['model'];if(!_0x831d1d['query'][_0x1f23('0x4b')](_0x1f23('0x4c'))){_0x503b50['limit']=qs[_0x1f23('0x4d')](_0x831d1d[_0x1f23('0x44')][_0x1f23('0x4d')]);_0x503b50['offset']=qs[_0x1f23('0x4e')](_0x831d1d[_0x1f23('0x44')][_0x1f23('0x4e')]);}_0x503b50[_0x1f23('0x4f')]=qs[_0x1f23('0x67')](_0x831d1d[_0x1f23('0x44')][_0x1f23('0x67')]);_0x503b50[_0x1f23('0x50')]=qs[_0x1f23('0x46')](_[_0x1f23('0x6e')](_0x831d1d[_0x1f23('0x44')],_0x181b04[_0x1f23('0x46')]));_0x503b50[_0x1f23('0x50')][_0x1f23('0x68')]=_0x3021d3['id'];if(_0x831d1d[_0x1f23('0x44')][_0x1f23('0x51')]){_0x503b50[_0x1f23('0x50')]=_[_0x1f23('0x52')](_0x503b50['where'],{'$or':_[_0x1f23('0x3d')](_0x503b50[_0x1f23('0x47')],function(_0xb39171){var _0x2aee90={};_0x2aee90[_0xb39171]={'$like':'%'+_0x831d1d[_0x1f23('0x44')][_0x1f23('0x51')]+'%'};return _0x2aee90;})});}_0x503b50=_[_0x1f23('0x52')]({},_0x503b50,_0x831d1d[_0x1f23('0x53')]);return db[_0x1f23('0xb4')]['count']({'where':_0x503b50[_0x1f23('0x50')]})[_0x1f23('0x20')](function(_0x426232){_0x563a2a['count']=_0x426232;if(_0x831d1d[_0x1f23('0x44')][_0x1f23('0x55')]){_0x503b50['include']=[{'model':db[_0x1f23('0x8d')],'as':_0x1f23('0xdf'),'required':![]},{'model':db['User'],'as':_0x1f23('0xe0'),'attributes':[_0x1f23('0x3a'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x1f23('0xe1'),'attributes':['id',_0x1f23('0x3a'),_0x1f23('0xe2')],'where':_0x831d1d['query'][_0x1f23('0xe3')]?{'id':_0x831d1d['query'][_0x1f23('0xe3')]}:undefined,'required':_0x831d1d[_0x1f23('0x44')][_0x1f23('0xe3')]?!![]:![]}];}return db[_0x1f23('0xb4')][_0x1f23('0x56')](_0x503b50);})[_0x1f23('0x20')](function(_0x57ebd0){_0x563a2a[_0x1f23('0x69')]=_0x57ebd0;return _0x563a2a;});}})['then'](respondWithFilteredResult(_0x13165c,_0x503b50))['catch'](handleError(_0x13165c,null));};function iftimePromise(_0x33e1ae,_0x4afb39){return respondWithRpcPromise('Command',_0x1f23('0xe4'),{'command':_0x4afb39[_0x1f23('0xe5')]?util[_0x1f23('0xac')](_0x1f23('0xe6'),_0x33e1ae['interval'],_0x4afb39[_0x1f23('0xe5')]):util['format']('iftime\x20%s',_0x33e1ae[_0x1f23('0xe7')])},client9002)[_0x1f23('0x20')](function(_0x47fcd3){var _0x38ffcf=_0x47fcd3&&_0x47fcd3[_0x1f23('0xe8')]('true')>=0x0?!![]:![];logger['info'](_0x1f23('0xe9'),_0x4afb39['id'],_0x33e1ae['id'],_0x33e1ae[_0x1f23('0xe7')],_0x38ffcf?_0x1f23('0xea'):_0x1f23('0xeb'),_0x4afb39[_0x1f23('0xe5')]?_0x4afb39[_0x1f23('0xe5')]:'No\x20timezone');return _0x38ffcf;})[_0x1f23('0x2b')](function(_0x5e0cb4){logger[_0x1f23('0x27')](_0x1f23('0xe9'),_0x4afb39['id'],_0x33e1ae['id'],_0x33e1ae[_0x1f23('0xe7')],util['inspect'](_0x5e0cb4,{'showHidden':![],'depth':null}),_0x4afb39[_0x1f23('0xe5')]?_0x4afb39['timezone']:'No\x20timezone');return![];});}exports[_0x1f23('0xe4')]=function(_0x159304,_0x2eec1b,_0xb594bc){var _0x59a9e5=0x0;var _0x11d85e=0x0;var _0x24f6e3=![];var _0xa1a250;var _0x1b68b9;return db[_0x1f23('0x3e')][_0x1f23('0x5b')]({'where':{'id':_0x159304[_0x1f23('0x58')]['id']},'include':[{'model':db[_0x1f23('0xec')],'as':'Interval','include':[{'model':db[_0x1f23('0xec')],'as':_0x1f23('0xed'),'attributes':['id',_0x1f23('0xe7')],'raw':!![]}]}]})[_0x1f23('0x20')](handleEntityNotFound(_0x2eec1b,null))['then'](function(_0x82fac2){if(_0x82fac2){_0xa1a250=_0x82fac2;return _0x82fac2['getProactiveActions']({'raw':!![]});}})[_0x1f23('0x20')](function(_0x1cfe95){if(_0xa1a250){if(_0x1cfe95){_0x1b68b9=_0x1cfe95;}}return require(_0x1f23('0x17'))[_0x1f23('0x7b')]();})['then'](function(_0xed0ad3){if(_0xed0ad3){_0x11d85e=_0xed0ad3[_0x1f23('0xee')];_0x24f6e3=_0xed0ad3[_0x1f23('0x7c')];}})[_0x1f23('0x20')](function(){return db['ChatInteraction'][_0x1f23('0x54')]({'where':{'closed':![]}});})[_0x1f23('0x20')](function(_0x2b052c){_0x59a9e5=_0x2b052c;if(_0x11d85e&&_0x2b052c>_0x11d85e){return db[_0x1f23('0xef')][_0x1f23('0x66')]({'where':{'id':0x1}})[_0x1f23('0x20')](function(_0x26fd18){if(_0x26fd18){_0x26fd18['increment']('chatLicenseExceeded');}});}})[_0x1f23('0x20')](function(){if(_0xa1a250[_0x1f23('0xec')]&&_0xa1a250['Interval'][_0x1f23('0xed')]){var _0x5573dc=[];for(var _0x5a2d86=0x0;_0x5a2d86<_0xa1a250['Interval'][_0x1f23('0xed')][_0x1f23('0x4a')];_0x5a2d86++){var _0x150113=_0xa1a250[_0x1f23('0xec')][_0x1f23('0xed')][_0x5a2d86]['get']({'plain':!![]});_0x5573dc[_0x1f23('0xbc')](iftimePromise(_0x150113,_0xa1a250));}return BPromise[_0x1f23('0xf0')](_0x5573dc)[_0x1f23('0x20')](function(_0x27a466){return _['some'](_0x27a466);});}else{return!![];}})[_0x1f23('0x20')](function(_0x599c9c){var _0x2d188a=fs[_0x1f23('0xf1')](path[_0x1f23('0x7f')](config[_0x1f23('0x78')],_0x1f23('0xf2')),_0x1f23('0xcc'));var _0x2bbc72={'remote':_0xa1a250[_0x1f23('0xf3')],'query':querystring['stringify'](_['merge'](_0xa1a250[_0x1f23('0x36')]({'plain':!![]}),{'customerIp':_0x159304[_0x1f23('0x8b')][_0x1f23('0xa6')]||_0x159304[_0x1f23('0x8b')][_0x1f23('0xf4')]||_0x159304[_0x1f23('0xf5')]['remoteAddress']||_0x159304['ip'],'referer':_0x159304[_0x1f23('0x8b')][_0x1f23('0xaa')],'openedInteractions':_0x59a9e5,'maxInteractions':_0x11d85e,'virtual':_0x24f6e3['virtual'],'online':_0x599c9c,'custom':_0x24f6e3}))[_0x1f23('0xf6')](/'/g,'\x5c\x27')};_0x2eec1b[_0x1f23('0x3b')](ejs[_0x1f23('0xcd')](Mustache['render'](_0x2d188a,_0x2bbc72),{'proactiveActions':_0x1b68b9,'alignment':_0xa1a250[_0x1f23('0xf7')],'verticalAlignment':_0xa1a250[_0x1f23('0xf8')],'div_color':_0xa1a250['color'],'text_color':_0xa1a250['textColor']}));})[_0x1f23('0x2b')](handleError(_0x2eec1b,null));};exports['addApplications']=function(_0x58c65a,_0x2adfc6,_0x4e5097){return db[_0x1f23('0x3e')][_0x1f23('0x66')]({'where':{'id':_0x58c65a[_0x1f23('0x58')]['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x2adfc6,null))[_0x1f23('0x20')](function(_0x5da7c4){if(_0x5da7c4){return db[_0x1f23('0xf9')]['transaction'](function(_0x2092bb){return db[_0x1f23('0xfa')][_0x1f23('0x62')]({'where':{'ChatWebsiteId':_0x58c65a[_0x1f23('0x58')]['id']},'transaction':_0x2092bb})[_0x1f23('0x20')](function(_0x16fa01){var _0xbd8b60=_[_0x1f23('0x3d')](_0x58c65a[_0x1f23('0x5d')],function(_0x41cf38){_0x41cf38['ChatWebsiteId']=_0x58c65a[_0x1f23('0x58')]['id'];return _0x41cf38;});return db['ChatApplication'][_0x1f23('0xfb')](_0xbd8b60,{'transaction':_0x2092bb});});})['then'](function(){return db[_0x1f23('0xfa')][_0x1f23('0xfc')]({'where':{'ChatWebsiteId':_0x58c65a['params']['id']},'order':_0x1f23('0xfd')});});}})[_0x1f23('0x20')](respondWithResult(_0x2adfc6,null))[_0x1f23('0x2b')](handleError(_0x2adfc6,null));};exports[_0x1f23('0xfe')]=function(_0x3d7ac3,_0x2de192,_0x31d422){var _0x397e9f={};var _0x5a89be={};var _0x4dfb73;var _0x37ad06;return db['ChatWebsite'][_0x1f23('0x66')]({'where':{'id':_0x3d7ac3[_0x1f23('0x58')]['id']}})['then'](handleEntityNotFound(_0x2de192,null))[_0x1f23('0x20')](function(_0x553362){if(_0x553362){_0x4dfb73=_0x553362;_0x5a89be[_0x1f23('0x43')]=_[_0x1f23('0x45')](db[_0x1f23('0xfa')][_0x1f23('0x3f')]);_0x5a89be[_0x1f23('0x44')]=_[_0x1f23('0x45')](_0x3d7ac3[_0x1f23('0x44')]);_0x5a89be['filters']=_[_0x1f23('0x48')](_0x5a89be['model'],_0x5a89be[_0x1f23('0x44')]);_0x397e9f['attributes']=_['intersection'](_0x5a89be[_0x1f23('0x43')],qs[_0x1f23('0x49')](_0x3d7ac3[_0x1f23('0x44')][_0x1f23('0x49')]));_0x397e9f[_0x1f23('0x47')]=_0x397e9f[_0x1f23('0x47')]['length']?_0x397e9f[_0x1f23('0x47')]:_0x5a89be[_0x1f23('0x43')];_0x397e9f['order']=qs[_0x1f23('0x67')](_0x3d7ac3['query'][_0x1f23('0x67')]);_0x397e9f[_0x1f23('0x50')]=qs[_0x1f23('0x46')](_[_0x1f23('0x6e')](_0x3d7ac3[_0x1f23('0x44')],_0x5a89be['filters']));if(_0x3d7ac3[_0x1f23('0x44')]['filter']){_0x397e9f['where']=_[_0x1f23('0x52')](_0x397e9f[_0x1f23('0x50')],{'$or':_[_0x1f23('0x3d')](_0x397e9f[_0x1f23('0x47')],function(_0x14a887){var _0xea3b4c={};_0xea3b4c[_0x14a887]={'$like':'%'+_0x3d7ac3[_0x1f23('0x44')][_0x1f23('0x51')]+'%'};return _0xea3b4c;})});}_0x397e9f=_[_0x1f23('0x52')]({},_0x397e9f,_0x3d7ac3[_0x1f23('0x53')]);return _0x4dfb73['getApplications'](_0x397e9f);}})[_0x1f23('0x20')](function(_0x494f3e){if(_0x494f3e){_0x37ad06=_0x494f3e[_0x1f23('0x4a')];if(!_0x3d7ac3['query'][_0x1f23('0x4b')](_0x1f23('0x4c'))){_0x397e9f[_0x1f23('0x4d')]=qs[_0x1f23('0x4d')](_0x3d7ac3['query'][_0x1f23('0x4d')]);_0x397e9f[_0x1f23('0x4e')]=qs[_0x1f23('0x4e')](_0x3d7ac3[_0x1f23('0x44')][_0x1f23('0x4e')]);}return _0x4dfb73[_0x1f23('0xfe')](_0x397e9f);}})['then'](function(_0x58c363){if(_0x58c363){return _0x58c363?{'count':_0x37ad06,'rows':_0x58c363}:null;}})[_0x1f23('0x20')](respondWithResult(_0x2de192,null))[_0x1f23('0x2b')](handleError(_0x2de192,null));};exports[_0x1f23('0xff')]=function(_0x4afa1c,_0x3d6f5f,_0x4fad26){return db[_0x1f23('0x100')][_0x1f23('0x5b')]({'where':{'id':_0x4afa1c['params']['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x3d6f5f,null))['then'](function(_0x291618){if(_0x291618){return _0x291618[_0x1f23('0xff')](_0x4afa1c[_0x1f23('0x5d')][_0x1f23('0x70')],_['omit'](_0x4afa1c[_0x1f23('0x5d')],[_0x1f23('0x70'),'id'])||{});}})['then'](respondWithResult(_0x3d6f5f,null))[_0x1f23('0x2b')](handleError(_0x3d6f5f,null));};exports[_0x1f23('0x101')]=function(_0x3c5814,_0x41b53a,_0x2d528f){var _0x57a66={};var _0x41e740={};var _0x5576a9;var _0x56e350;return db[_0x1f23('0x3e')]['findOne']({'where':{'id':_0x3c5814[_0x1f23('0x58')]['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x41b53a,null))['then'](function(_0x2995e6){if(_0x2995e6){_0x5576a9=_0x2995e6;_0x41e740['model']=_[_0x1f23('0x45')](db['ChatProactiveAction'][_0x1f23('0x3f')]);_0x41e740[_0x1f23('0x44')]=_[_0x1f23('0x45')](_0x3c5814[_0x1f23('0x44')]);_0x41e740[_0x1f23('0x46')]=_[_0x1f23('0x48')](_0x41e740['model'],_0x41e740[_0x1f23('0x44')]);_0x57a66[_0x1f23('0x47')]=_[_0x1f23('0x48')](_0x41e740['model'],qs[_0x1f23('0x49')](_0x3c5814[_0x1f23('0x44')]['fields']));_0x57a66['attributes']=_0x57a66[_0x1f23('0x47')][_0x1f23('0x4a')]?_0x57a66['attributes']:_0x41e740['model'];_0x57a66[_0x1f23('0x4f')]=qs[_0x1f23('0x67')](_0x3c5814[_0x1f23('0x44')][_0x1f23('0x67')]);_0x57a66['where']=qs[_0x1f23('0x46')](_[_0x1f23('0x6e')](_0x3c5814['query'],_0x41e740[_0x1f23('0x46')]));if(_0x3c5814[_0x1f23('0x44')][_0x1f23('0x51')]){_0x57a66[_0x1f23('0x50')]=_['merge'](_0x57a66[_0x1f23('0x50')],{'$or':_[_0x1f23('0x3d')](_0x57a66[_0x1f23('0x47')],function(_0x18d944){var _0x50d653={};_0x50d653[_0x18d944]={'$like':'%'+_0x3c5814['query']['filter']+'%'};return _0x50d653;})});}_0x57a66=_['merge']({},_0x57a66,_0x3c5814[_0x1f23('0x53')]);return _0x5576a9[_0x1f23('0x101')](_0x57a66);}})[_0x1f23('0x20')](function(_0x6533b9){if(_0x6533b9){_0x56e350=_0x6533b9[_0x1f23('0x4a')];if(!_0x3c5814[_0x1f23('0x44')]['hasOwnProperty'](_0x1f23('0x4c'))){_0x57a66[_0x1f23('0x4d')]=qs['limit'](_0x3c5814[_0x1f23('0x44')]['limit']);_0x57a66[_0x1f23('0x4e')]=qs[_0x1f23('0x4e')](_0x3c5814['query']['offset']);}return _0x5576a9[_0x1f23('0x101')](_0x57a66);}})[_0x1f23('0x20')](function(_0x2c159f){if(_0x2c159f){return _0x2c159f?{'count':_0x56e350,'rows':_0x2c159f}:null;}})[_0x1f23('0x20')](respondWithResult(_0x41b53a,null))['catch'](handleError(_0x41b53a,null));};exports[_0x1f23('0x102')]=function(_0x56b701,_0x1d9334,_0x3474ec){var _0x4b28b7=_0x56b701[_0x1f23('0x44')][_0x1f23('0x103')]===_0x1f23('0x104')?_0x1f23('0x105'):_0x1f23('0x106');return db[_0x1f23('0x3e')][_0x1f23('0x5b')]({'attributes':['id',_0x4b28b7],'where':{'id':_0x56b701[_0x1f23('0x58')]['id']}})['then'](handleEntityNotFound(_0x1d9334,null))[_0x1f23('0x20')](function(_0x249c1b){if(_0x249c1b){var _0x542f55=_0x249c1b[_0x4b28b7];var _0x577fab=_0x542f55&&_0x542f55[_0x1f23('0x107')]?_0x542f55[_0x1f23('0x107')]:[];_0x1d9334[_0x1f23('0x3b')]({'fromKey':_[_0x1f23('0x7d')](_0x542f55[_0x1f23('0x108')])?undefined:_0x542f55[_0x1f23('0x108')],'count':_0x577fab[_0x1f23('0x4a')],'rows':_0x577fab});}})[_0x1f23('0x2b')](handleError(_0x1d9334,null));};exports['getOfflineMessages']=function(_0x5a90a0,_0x1357e1,_0x4c86ed){var _0x441bc7={'raw':![],'where':{}};var _0x238cec={};var _0x5dba8e={'count':0x0,'rows':[]};return db[_0x1f23('0x3e')][_0x1f23('0x66')]({'where':{'id':_0x5a90a0['params']['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x1357e1,null))[_0x1f23('0x20')](function(_0x5e83c7){if(_0x5e83c7){_0x238cec[_0x1f23('0x43')]=_[_0x1f23('0x45')](db[_0x1f23('0x109')][_0x1f23('0x3f')]);_0x238cec[_0x1f23('0x44')]=_[_0x1f23('0x45')](_0x5a90a0['query']);_0x238cec[_0x1f23('0x46')]=_['intersection'](_0x238cec[_0x1f23('0x43')],_0x238cec[_0x1f23('0x44')]);_0x441bc7[_0x1f23('0x47')]=_['intersection'](_0x238cec[_0x1f23('0x43')],qs[_0x1f23('0x49')](_0x5a90a0[_0x1f23('0x44')][_0x1f23('0x49')]));_0x441bc7[_0x1f23('0x47')]=_0x441bc7[_0x1f23('0x47')][_0x1f23('0x4a')]?_0x441bc7[_0x1f23('0x47')]:_0x238cec['model'];if(!_0x5a90a0[_0x1f23('0x44')]['hasOwnProperty'](_0x1f23('0x4c'))){_0x441bc7[_0x1f23('0x4d')]=qs[_0x1f23('0x4d')](_0x5a90a0[_0x1f23('0x44')]['limit']);_0x441bc7[_0x1f23('0x4e')]=qs['offset'](_0x5a90a0['query'][_0x1f23('0x4e')]);}_0x441bc7[_0x1f23('0x4f')]=qs['sort'](_0x5a90a0[_0x1f23('0x44')][_0x1f23('0x67')]);_0x441bc7[_0x1f23('0x50')]=qs['filters'](_[_0x1f23('0x6e')](_0x5a90a0[_0x1f23('0x44')],_0x238cec[_0x1f23('0x46')]));_0x441bc7[_0x1f23('0x50')][_0x1f23('0x68')]=_0x5e83c7['id'];if(_0x5a90a0['query'][_0x1f23('0x51')]){_0x441bc7[_0x1f23('0x50')]=_[_0x1f23('0x52')](_0x441bc7[_0x1f23('0x50')],{'$or':_[_0x1f23('0x3d')](_0x441bc7[_0x1f23('0x47')],function(_0x283186){var _0x4fff91={};_0x4fff91[_0x283186]={'$like':'%'+_0x5a90a0[_0x1f23('0x44')][_0x1f23('0x51')]+'%'};return _0x4fff91;})});}_0x441bc7=_[_0x1f23('0x52')]({},_0x441bc7,_0x5a90a0['options']);return db[_0x1f23('0x109')][_0x1f23('0x54')]({'where':_0x441bc7[_0x1f23('0x50')]})[_0x1f23('0x20')](function(_0x5c074c){_0x5dba8e[_0x1f23('0x54')]=_0x5c074c;if(_0x5a90a0[_0x1f23('0x44')][_0x1f23('0x55')]){_0x441bc7[_0x1f23('0x5a')]=[{'all':!![]}];}else{_0x441bc7[_0x1f23('0x5a')]=[{'model':db[_0x1f23('0x8d')],'as':'Contact','required':![]}];}return db[_0x1f23('0x109')]['findAll'](_0x441bc7);})[_0x1f23('0x20')](function(_0x172c05){_0x5dba8e[_0x1f23('0x69')]=_0x172c05;return _0x5dba8e;});}})['then'](respondWithFilteredResult(_0x1357e1,_0x441bc7))[_0x1f23('0x2b')](handleError(_0x1357e1,null));};exports[_0x1f23('0x10a')]=function(_0x15e153,_0x1966ba,_0x41f26d){return db['ChatWebsite'][_0x1f23('0x5b')]({'where':{'id':_0x15e153['params']['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x1966ba,null))['then'](function(_0x6deb43){if(_0x6deb43){return _0x6deb43[_0x1f23('0x10a')](_0x15e153[_0x1f23('0x5d')]['ids'],_[_0x1f23('0x10b')](_0x15e153[_0x1f23('0x5d')],[_0x1f23('0x70'),'id'])||{})[_0x1f23('0xb8')](function(_0x17ff8a){for(var _0x527a06=0x0;_0x527a06<_0x15e153[_0x1f23('0x5d')][_0x1f23('0x70')][_0x1f23('0x4a')];_0x527a06+=0x1){socket[_0x1f23('0x10c')](_0x1f23('0x10d'),{'UserId':_0x15e153[_0x1f23('0x5d')][_0x1f23('0x70')][_0x527a06],'ChatWebsiteId':_0x15e153[_0x1f23('0x58')]['id']});}return _0x17ff8a;});}})[_0x1f23('0x20')](respondWithResult(_0x1966ba,null))[_0x1f23('0x2b')](handleError(_0x1966ba,null));};exports[_0x1f23('0x10e')]=function(_0x39b816,_0x82611e,_0x5723c0){return db[_0x1f23('0x3e')][_0x1f23('0x5b')]({'where':{'id':_0x39b816[_0x1f23('0x58')]['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x82611e,null))['then'](function(_0x4c51b4){if(_0x4c51b4){return _0x4c51b4[_0x1f23('0x10e')](_0x39b816[_0x1f23('0x44')][_0x1f23('0x70')])[_0x1f23('0x20')](function(){if(_[_0x1f23('0x10f')](_0x39b816[_0x1f23('0x44')][_0x1f23('0x70')])){for(var _0xe98c57=0x0;_0xe98c57<_0x39b816['query'][_0x1f23('0x70')]['length'];_0xe98c57+=0x1){socket[_0x1f23('0x10c')](_0x1f23('0x110'),{'UserId':Number(_0x39b816[_0x1f23('0x44')][_0x1f23('0x70')][_0xe98c57]),'ChatWebsiteId':Number(_0x39b816[_0x1f23('0x58')]['id'])});}}else{socket[_0x1f23('0x10c')](_0x1f23('0x110'),{'UserId':Number(_0x39b816[_0x1f23('0x44')][_0x1f23('0x70')]),'ChatWebsiteId':Number(_0x39b816['params']['id'])});}});}})[_0x1f23('0x20')](respondWithStatusCode(_0x82611e,null))[_0x1f23('0x2b')](handleError(_0x82611e,null));};exports[_0x1f23('0x111')]=function(_0x4ec381,_0x57b0ae,_0x39cda7){var _0x139467={};var _0xbac523={};var _0x112dd3;var _0x9419dd;return db[_0x1f23('0x3e')][_0x1f23('0x66')]({'where':{'id':_0x4ec381[_0x1f23('0x58')]['id']}})[_0x1f23('0x20')](handleEntityNotFound(_0x57b0ae,null))[_0x1f23('0x20')](function(_0xea245c){if(_0xea245c){_0x112dd3=_0xea245c;_0xbac523[_0x1f23('0x43')]=_[_0x1f23('0x45')](db[_0x1f23('0xc0')][_0x1f23('0x3f')]);_0xbac523['query']=_[_0x1f23('0x45')](_0x4ec381[_0x1f23('0x44')]);_0xbac523[_0x1f23('0x46')]=_[_0x1f23('0x48')](_0xbac523[_0x1f23('0x43')],_0xbac523[_0x1f23('0x44')]);_0x139467['attributes']=_['intersection'](_0xbac523[_0x1f23('0x43')],qs['fields'](_0x4ec381[_0x1f23('0x44')][_0x1f23('0x49')]));_0x139467[_0x1f23('0x47')]=_0x139467[_0x1f23('0x47')][_0x1f23('0x4a')]?_0x139467[_0x1f23('0x47')]:_0xbac523[_0x1f23('0x43')];_0x139467[_0x1f23('0x4f')]=qs['sort'](_0x4ec381[_0x1f23('0x44')]['sort']);_0x139467['where']=qs[_0x1f23('0x46')](_['pick'](_0x4ec381[_0x1f23('0x44')],_0xbac523[_0x1f23('0x46')]));if(_0x4ec381[_0x1f23('0x44')]['filter']){_0x139467['where']=_[_0x1f23('0x52')](_0x139467['where'],{'$or':_['map'](_0x139467[_0x1f23('0x47')],function(_0x12cb8c){var _0x534fe6={};_0x534fe6[_0x12cb8c]={'$like':'%'+_0x4ec381['query'][_0x1f23('0x51')]+'%'};return _0x534fe6;})});}_0x139467=_[_0x1f23('0x52')]({},_0x139467,_0x4ec381[_0x1f23('0x53')]);return _0x112dd3['getAgents'](_0x139467);}})[_0x1f23('0x20')](function(_0x370bea){if(_0x370bea){_0x9419dd=_0x370bea[_0x1f23('0x4a')];if(!_0x4ec381[_0x1f23('0x44')][_0x1f23('0x4b')]('nolimit')){_0x139467['limit']=qs[_0x1f23('0x4d')](_0x4ec381[_0x1f23('0x44')][_0x1f23('0x4d')]);_0x139467[_0x1f23('0x4e')]=qs[_0x1f23('0x4e')](_0x4ec381[_0x1f23('0x44')][_0x1f23('0x4e')]);}return _0x112dd3['getAgents'](_0x139467);}})['then'](function(_0x329145){if(_0x329145){return _0x329145?{'count':_0x9419dd,'rows':_0x329145}:null;}})[_0x1f23('0x20')](respondWithResult(_0x57b0ae,null))[_0x1f23('0x2b')](handleError(_0x57b0ae,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 58e7178..86db304 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 _0x84ab=['../../mysqldb','ChatWebsite','setMaxListeners','save','remove','emit','exports','events'];(function(_0x4555d1,_0x3ac745){var _0x154a85=function(_0x4dfedc){while(--_0x4dfedc){_0x4555d1['push'](_0x4555d1['shift']());}};_0x154a85(++_0x3ac745);}(_0x84ab,0x12f));var _0xb84a=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0x84ab[_0x27d958];return _0x53e63e;};'use strict';var EventEmitter=require(_0xb84a('0x0'));var ChatWebsite=require(_0xb84a('0x1'))['db'][_0xb84a('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xb84a('0x3')](0x0);var events={'afterCreate':_0xb84a('0x4'),'afterUpdate':'update','afterDestroy':_0xb84a('0x5')};function emitEvent(_0x18a4a5){return function(_0x47b8e3,_0x9d3a00,_0xe72ccd){ChatWebsiteEvents[_0xb84a('0x6')](_0x18a4a5+':'+_0x47b8e3['id'],_0x47b8e3);ChatWebsiteEvents['emit'](_0x18a4a5,_0x47b8e3);_0xe72ccd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xb84a('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x0911=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0xf3bd88,_0x32eb6e){var _0x19cadb=function(_0x321aef){while(--_0x321aef){_0xf3bd88['push'](_0xf3bd88['shift']());}};_0x19cadb(++_0x32eb6e);}(_0x0911,0x1a9));var _0x1091=function(_0x715d76,_0x402d60){_0x715d76=_0x715d76-0x0;var _0x48fe88=_0x0911[_0x715d76];return _0x48fe88;};'use strict';var EventEmitter=require(_0x1091('0x0'));var ChatWebsite=require(_0x1091('0x1'))['db'][_0x1091('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1091('0x3')](0x0);var events={'afterCreate':_0x1091('0x4'),'afterUpdate':'update','afterDestroy':_0x1091('0x5')};function emitEvent(_0x580aa2){return function(_0x3a71a4,_0x58640b,_0x26a1a5){ChatWebsiteEvents[_0x1091('0x6')](_0x580aa2+':'+_0x3a71a4['id'],_0x3a71a4);ChatWebsiteEvents[_0x1091('0x6')](_0x580aa2,_0x3a71a4);_0x26a1a5(null);};}for(var e in events){if(events[_0x1091('0x7')](e)){var event=events[e];ChatWebsite[_0x1091('0x8')](e,emitEvent(event));}}module[_0x1091('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 83303bb..1cd6915 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 _0xd404=['util','api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash'];(function(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0xd404,0x15b));var _0x4d40=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0xd404[_0x4179e2];return _0x24cb50;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var logger=require('../../config/logger')(_0x4d40('0x2'));var moment=require(_0x4d40('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d40('0x4'));var fs=require('fs');var path=require(_0x4d40('0x5'));var rimraf=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var attributes=require(_0x4d40('0x8'));module[_0x4d40('0x9')]=function(_0xc2a9db,_0x24a237){return _0xc2a9db[_0x4d40('0xa')]('ChatWebsite',attributes,{'tableName':_0x4d40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4a9a38,_0x6517a){var _0x397b28=function(_0x3b4e8e){while(--_0x3b4e8e){_0x4a9a38['push'](_0x4a9a38['shift']());}};_0x397b28(++_0x6517a);}(_0xe706,0xa3));var _0x6e70=function(_0x7261e6,_0x3e3bf7){_0x7261e6=_0x7261e6-0x0;var _0x20d5ed=_0xe706[_0x7261e6];return _0x20d5ed;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('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 23be01e..1a38e9e 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 _0x7880=['defaults','localhost','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7880,0x1f4));var _0x0788=function(_0x252ef1,_0x2e0041){_0x252ef1=_0x252ef1-0x0;var _0x25817c=_0x7880[_0x252ef1];return _0x25817c;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});config[_0x0788('0xc')]=_[_0x0788('0xd')](config[_0x0788('0xc')],{'host':_0x0788('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0788('0xc')]));require('./chatWebsite.socket')[_0x0788('0xf')](socket);function respondWithRpcPromise(_0x53b2f2,_0x433c26,_0x3c6d18){return new BPromise(function(_0x1f9ff6,_0xee8670){return client[_0x0788('0x10')](_0x53b2f2,_0x3c6d18)['then'](function(_0x1920b3){logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,_0x0788('0x13'));logger[_0x0788('0x14')](_0x0788('0x15'),_0x433c26,_0x0788('0x13'),JSON['stringify'](_0x1920b3));if(_0x1920b3[_0x0788('0x16')]){if(_0x1920b3[_0x0788('0x16')][_0x0788('0x17')]===0x1f4){logger[_0x0788('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x433c26,_0x1920b3[_0x0788('0x16')]['message']);return _0xee8670(_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);}logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);return _0x1f9ff6(_0x1920b3['error']['message']);}else{logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,'request\x20sent');_0x1f9ff6(_0x1920b3[_0x0788('0x19')][_0x0788('0x18')]);}})[_0x0788('0x1a')](function(_0x52c339){logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x52c339);_0xee8670(_0x52c339);});});} \ No newline at end of file +var _0xc2c7=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x575991,_0x1b2f1c){var _0x2596e6=function(_0xe736b2){while(--_0xe736b2){_0x575991['push'](_0x575991['shift']());}};_0x2596e6(++_0x1b2f1c);}(_0xc2c7,0x134));var _0x7c2c=function(_0x19bab4,_0x2c8483){_0x19bab4=_0x19bab4-0x0;var _0x23e711=_0xc2c7[_0x19bab4];return _0x23e711;};'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});config['redis']=_['defaults'](config['redis'],{'host':_0x7c2c('0xb'),'port':0x18eb});var socket=require(_0x7c2c('0xc'))(new Redis(config[_0x7c2c('0xd')]));require(_0x7c2c('0xe'))[_0x7c2c('0xf')](socket);function respondWithRpcPromise(_0x57b107,_0x3093d2,_0x307bec){return new BPromise(function(_0x285ff6,_0x1bfeaf){return client[_0x7c2c('0x10')](_0x57b107,_0x307bec)[_0x7c2c('0x11')](function(_0x2cb057){logger[_0x7c2c('0x12')](_0x7c2c('0x13'),_0x3093d2,_0x7c2c('0x14'));logger[_0x7c2c('0x15')](_0x7c2c('0x16'),_0x3093d2,_0x7c2c('0x14'),JSON[_0x7c2c('0x17')](_0x2cb057));if(_0x2cb057[_0x7c2c('0x18')]){if(_0x2cb057[_0x7c2c('0x18')]['code']===0x1f4){logger['error'](_0x7c2c('0x13'),_0x3093d2,_0x2cb057[_0x7c2c('0x18')][_0x7c2c('0x19')]);return _0x1bfeaf(_0x2cb057['error'][_0x7c2c('0x19')]);}logger[_0x7c2c('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x3093d2,_0x2cb057[_0x7c2c('0x18')]['message']);return _0x285ff6(_0x2cb057[_0x7c2c('0x18')]['message']);}else{logger[_0x7c2c('0x12')](_0x7c2c('0x13'),_0x3093d2,_0x7c2c('0x14'));_0x285ff6(_0x2cb057[_0x7c2c('0x1a')][_0x7c2c('0x19')]);}})[_0x7c2c('0x1b')](function(_0x2c1378){logger[_0x7c2c('0x18')](_0x7c2c('0x13'),_0x3093d2,_0x2c1378);_0x1bfeaf(_0x2c1378);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index f21e530..d999a7b 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 _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x4ebdf4,_0x57d47f){var _0x18d1c1=function(_0x83f2a0){while(--_0x83f2a0){_0x4ebdf4['push'](_0x4ebdf4['shift']());}};_0x18d1c1(++_0x57d47f);}(_0xb10b,0x12a));var _0xbb10=function(_0x193a6e,_0x45dd00){_0x193a6e=_0x193a6e-0x0;var _0x599a9b=_0xb10b[_0x193a6e];return _0x599a9b;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x1d6b36,_0xe43028){var _0x53dd45=function(_0x21bd7d){while(--_0x21bd7d){_0x1d6b36['push'](_0x1d6b36['shift']());}};_0x53dd45(++_0xe43028);}(_0x7a54,0x106));var _0x47a5=function(_0x1e5eb6,_0x5e435a){_0x1e5eb6=_0x1e5eb6-0x0;var _0x3d2f3a=_0x7a54[_0x1e5eb6];return _0x3d2f3a;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index a10f0b9..af9d202 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 _0x81a8=['getCustomerAvatar','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','notify','/:id/offline','/:id/interactions','addInteraction','/:id/proactive_actions','/:id/users','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x81a8,0x1cf));var _0x881a=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0x81a8[_0x3eff21];return _0x1945bb;};'use strict';var multer=require('multer');var util=require(_0x881a('0x0'));var path=require(_0x881a('0x1'));var timeout=require('connect-timeout');var express=require(_0x881a('0x2'));var router=express['Router']();var auth=require(_0x881a('0x3'));var interaction=require(_0x881a('0x4'));var config=require(_0x881a('0x5'));var controller=require('./chatWebsite.controller');router[_0x881a('0x6')]('/',auth[_0x881a('0x7')](),controller[_0x881a('0x8')]);router[_0x881a('0x6')](_0x881a('0x9'),auth[_0x881a('0x7')](),controller['describe']);router[_0x881a('0x6')]('/:id',auth[_0x881a('0x7')](),controller[_0x881a('0xa')]);router[_0x881a('0x6')](_0x881a('0xb'),auth['isAuthenticated'](),controller[_0x881a('0xc')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x881a('0xd')]);router[_0x881a('0x6')](_0x881a('0xe'),controller[_0x881a('0xf')]);router['get'](_0x881a('0x10'),controller['getAvatar']);router[_0x881a('0x6')]('/:id/customer_avatar',controller[_0x881a('0x11')]);router[_0x881a('0x6')]('/:id/system_avatar',controller['getSystemAvatar']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x881a('0x6')]('/:id/snippet',controller[_0x881a('0x12')]);router['get'](_0x881a('0x13'),auth[_0x881a('0x7')](),controller[_0x881a('0x14')]);router[_0x881a('0x6')]('/:id/proactive_actions',auth[_0x881a('0x7')](),controller[_0x881a('0x15')]);router[_0x881a('0x6')](_0x881a('0x16'),controller[_0x881a('0x17')]);router['get'](_0x881a('0x18'),auth[_0x881a('0x7')](),controller[_0x881a('0x19')]);router[_0x881a('0x6')]('/:id/users',auth[_0x881a('0x7')](),controller[_0x881a('0x1a')]);router['post']('/',auth[_0x881a('0x7')](),controller['create']);router[_0x881a('0x1b')](_0x881a('0xb'),auth[_0x881a('0x7')](),controller['addDisposition']);router[_0x881a('0x1b')](_0x881a('0x1c'),auth[_0x881a('0x7')](),controller[_0x881a('0x1d')]);var upload=multer({'storage':multer[_0x881a('0x1e')]({'destination':function(_0x3d89e6,_0x3a8661,_0x195ffa){_0x195ffa(null,path[_0x881a('0x1f')](config[_0x881a('0x20')],_0x881a('0x21')));},'filename':function(_0x460c20,_0x42f75c,_0x111fa8){_0x111fa8(null,util[_0x881a('0x22')](_0x881a('0x23'),Date[_0x881a('0x24')](),_0x42f75c[_0x881a('0x25')]));}})});router['post'](_0x881a('0xe'),upload[_0x881a('0x26')](_0x881a('0x27')),controller[_0x881a('0x28')]);var upload=multer({'storage':multer[_0x881a('0x1e')]({'destination':function(_0xa19f86,_0x3b4ce7,_0xca305d){_0xca305d(null,path[_0x881a('0x1f')](config[_0x881a('0x20')],_0x881a('0x29')));},'filename':function(_0x3d6c61,_0x3d0709,_0x127f80){_0x127f80(null,util[_0x881a('0x22')](_0x881a('0x23'),Date['now'](),_0x3d0709['originalname']));}})});router[_0x881a('0x1b')](_0x881a('0x10'),upload[_0x881a('0x26')]('file'),controller[_0x881a('0x2a')]);var upload=multer({'storage':multer[_0x881a('0x1e')]({'destination':function(_0x37e704,_0x396680,_0x242a47){_0x242a47(null,path[_0x881a('0x1f')](config[_0x881a('0x20')],_0x881a('0x29')));},'filename':function(_0x371f77,_0x4d8369,_0x31f4c1){_0x31f4c1(null,util['format'](_0x881a('0x23'),Date[_0x881a('0x24')](),_0x4d8369[_0x881a('0x25')]));}})});router[_0x881a('0x1b')](_0x881a('0x2b'),upload[_0x881a('0x26')]('file'),controller[_0x881a('0x2c')]);var upload=multer({'storage':multer[_0x881a('0x1e')]({'destination':function(_0x5b39ea,_0x161d9a,_0x4d6e0d){_0x4d6e0d(null,path[_0x881a('0x1f')](config[_0x881a('0x20')],_0x881a('0x29')));},'filename':function(_0x21663e,_0x586144,_0x45cf89){_0x45cf89(null,util[_0x881a('0x22')](_0x881a('0x23'),Date['now'](),_0x586144[_0x881a('0x25')]));}})});router[_0x881a('0x1b')](_0x881a('0x2d'),upload[_0x881a('0x26')](_0x881a('0x27')),controller['addSystemAvatar']);router[_0x881a('0x1b')]('/:id/notify',controller[_0x881a('0x2e')]);router['post'](_0x881a('0x2f'),controller['offline']);router[_0x881a('0x1b')](_0x881a('0x30'),auth['isAuthenticated'](),controller[_0x881a('0x31')]);router[_0x881a('0x1b')]('/:id/applications',auth[_0x881a('0x7')](),controller['addApplications']);router[_0x881a('0x1b')](_0x881a('0x32'),auth[_0x881a('0x7')](),controller['addProactiveActions']);router[_0x881a('0x1b')](_0x881a('0x33'),auth[_0x881a('0x7')](),controller[_0x881a('0x34')]);router[_0x881a('0x35')](_0x881a('0x36'),auth[_0x881a('0x7')](),controller[_0x881a('0x37')]);router[_0x881a('0x38')](_0x881a('0x36'),auth['isAuthenticated'](),controller[_0x881a('0x39')]);router[_0x881a('0x38')](_0x881a('0xb'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x881a('0x38')]('/:id/canned_answers',auth[_0x881a('0x7')](),controller['removeAnswers']);router[_0x881a('0x38')](_0x881a('0x33'),auth[_0x881a('0x7')](),controller[_0x881a('0x3a')]);module[_0x881a('0x3b')]=router; \ No newline at end of file +var _0x3c70=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/logo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','addDisposition','post','addAnswer','diskStorage','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','join','root','server/files/images/avatars/','/:id/avatar','addAvatar','addCustomerAvatar','notify','/:id/offline','offline','addInteraction','addApplications','addAgents','put','update','removeDispositions','removeAnswers','delete','removeAgents','multer','util','connect-timeout'];(function(_0x3cd849,_0x452e72){var _0x5587ff=function(_0x5ba2e9){while(--_0x5ba2e9){_0x3cd849['push'](_0x3cd849['shift']());}};_0x5587ff(++_0x452e72);}(_0x3c70,0xb1));var _0x03c7=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x3c70[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x03c7('0x0'));var util=require(_0x03c7('0x1'));var path=require('path');var timeout=require(_0x03c7('0x2'));var express=require('express');var router=express[_0x03c7('0x3')]();var auth=require(_0x03c7('0x4'));var interaction=require(_0x03c7('0x5'));var config=require(_0x03c7('0x6'));var controller=require(_0x03c7('0x7'));router[_0x03c7('0x8')]('/',auth[_0x03c7('0x9')](),controller[_0x03c7('0xa')]);router[_0x03c7('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x03c7('0xb')]);router['get'](_0x03c7('0xc'),auth[_0x03c7('0x9')](),controller[_0x03c7('0xd')]);router[_0x03c7('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x03c7('0xe'),auth[_0x03c7('0x9')](),controller[_0x03c7('0xf')]);router[_0x03c7('0x8')](_0x03c7('0x10'),controller['getLogo']);router[_0x03c7('0x8')]('/:id/avatar',controller['getAvatar']);router[_0x03c7('0x8')](_0x03c7('0x11'),controller[_0x03c7('0x12')]);router['get'](_0x03c7('0x13'),controller['getSystemAvatar']);router[_0x03c7('0x8')]('/:id/interactions',auth[_0x03c7('0x9')](),controller['getInteractions']);router[_0x03c7('0x8')](_0x03c7('0x14'),controller[_0x03c7('0x15')]);router['get'](_0x03c7('0x16'),auth[_0x03c7('0x9')](),controller[_0x03c7('0x17')]);router[_0x03c7('0x8')](_0x03c7('0x18'),auth['isAuthenticated'](),controller[_0x03c7('0x19')]);router[_0x03c7('0x8')](_0x03c7('0x1a'),controller[_0x03c7('0x1b')]);router['get'](_0x03c7('0x1c'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x03c7('0x8')](_0x03c7('0x1d'),auth[_0x03c7('0x9')](),controller['getAgents']);router['post']('/',auth[_0x03c7('0x9')](),controller['create']);router['post']('/:id/dispositions',auth[_0x03c7('0x9')](),controller[_0x03c7('0x1e')]);router[_0x03c7('0x1f')](_0x03c7('0xe'),auth['isAuthenticated'](),controller[_0x03c7('0x20')]);var upload=multer({'storage':multer[_0x03c7('0x21')]({'destination':function(_0x64f398,_0x14c93a,_0x271d8a){_0x271d8a(null,path['join'](config['root'],_0x03c7('0x22')));},'filename':function(_0x475e18,_0x370d9f,_0x380899){_0x380899(null,util[_0x03c7('0x23')](_0x03c7('0x24'),Date[_0x03c7('0x25')](),_0x370d9f[_0x03c7('0x26')]));}})});router[_0x03c7('0x1f')](_0x03c7('0x10'),upload[_0x03c7('0x27')](_0x03c7('0x28')),controller[_0x03c7('0x29')]);var upload=multer({'storage':multer[_0x03c7('0x21')]({'destination':function(_0x3343f0,_0x1b3e35,_0x888020){_0x888020(null,path[_0x03c7('0x2a')](config[_0x03c7('0x2b')],_0x03c7('0x2c')));},'filename':function(_0x2c147c,_0x8173ce,_0x201c6d){_0x201c6d(null,util['format']('%s-%s',Date[_0x03c7('0x25')](),_0x8173ce[_0x03c7('0x26')]));}})});router[_0x03c7('0x1f')](_0x03c7('0x2d'),upload[_0x03c7('0x27')](_0x03c7('0x28')),controller[_0x03c7('0x2e')]);var upload=multer({'storage':multer[_0x03c7('0x21')]({'destination':function(_0x4b7eb5,_0x4ab266,_0x2e070f){_0x2e070f(null,path['join'](config[_0x03c7('0x2b')],_0x03c7('0x2c')));},'filename':function(_0x3f8202,_0x5ae137,_0x2eb3ca){_0x2eb3ca(null,util[_0x03c7('0x23')](_0x03c7('0x24'),Date['now'](),_0x5ae137[_0x03c7('0x26')]));}})});router[_0x03c7('0x1f')](_0x03c7('0x11'),upload[_0x03c7('0x27')]('file'),controller[_0x03c7('0x2f')]);var upload=multer({'storage':multer[_0x03c7('0x21')]({'destination':function(_0x59c062,_0xab088a,_0x38ad55){_0x38ad55(null,path['join'](config[_0x03c7('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x1ad614,_0xc6b5ae,_0x40aced){_0x40aced(null,util[_0x03c7('0x23')](_0x03c7('0x24'),Date[_0x03c7('0x25')](),_0xc6b5ae[_0x03c7('0x26')]));}})});router[_0x03c7('0x1f')](_0x03c7('0x13'),upload['single'](_0x03c7('0x28')),controller['addSystemAvatar']);router[_0x03c7('0x1f')]('/:id/notify',controller[_0x03c7('0x30')]);router[_0x03c7('0x1f')](_0x03c7('0x31'),controller[_0x03c7('0x32')]);router[_0x03c7('0x1f')]('/:id/interactions',auth[_0x03c7('0x9')](),controller[_0x03c7('0x33')]);router[_0x03c7('0x1f')](_0x03c7('0x16'),auth[_0x03c7('0x9')](),controller[_0x03c7('0x34')]);router[_0x03c7('0x1f')](_0x03c7('0x18'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x03c7('0x1f')](_0x03c7('0x1d'),auth['isAuthenticated'](),controller[_0x03c7('0x35')]);router[_0x03c7('0x36')](_0x03c7('0xc'),auth[_0x03c7('0x9')](),controller[_0x03c7('0x37')]);router['delete'](_0x03c7('0xc'),auth[_0x03c7('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x03c7('0x9')](),controller[_0x03c7('0x38')]);router['delete'](_0x03c7('0xe'),auth[_0x03c7('0x9')](),controller[_0x03c7('0x39')]);router[_0x03c7('0x3a')](_0x03c7('0x1d'),auth[_0x03c7('0x9')](),controller[_0x03c7('0x3b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 99eb04a..0c3364e 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 _0xbd3c=['exports','STRING','AmazonAWS','Google','sequelize'];(function(_0x3ef819,_0x288818){var _0x424e3a=function(_0x113da0){while(--_0x113da0){_0x3ef819['push'](_0x3ef819['shift']());}};_0x424e3a(++_0x288818);}(_0xbd3c,0xc2));var _0xcbd3=function(_0x2f5d1f,_0x483df0){_0x2f5d1f=_0x2f5d1f-0x0;var _0x1091c2=_0xbd3c[_0x2f5d1f];return _0x1091c2;};'use strict';var Sequelize=require(_0xcbd3('0x0'));module[_0xcbd3('0x1')]={'name':{'type':Sequelize[_0xcbd3('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xcbd3('0x3'),_0xcbd3('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xcbd3('0x2')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdbf5=['exports','AmazonAWS','Google','STRING'];(function(_0x48e666,_0x1c196e){var _0x3f6fbc=function(_0x4d6b6d){while(--_0x4d6b6d){_0x48e666['push'](_0x48e666['shift']());}};_0x3f6fbc(++_0x1c196e);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x57727f,_0x1b7995){_0x57727f=_0x57727f-0x0;var _0x2dc32d=_0xdbf5[_0x57727f];return _0x2dc32d;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x5dbf('0x1'),_0x5dbf('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x5dbf('0x3')]},'data2':{'type':Sequelize[_0x5dbf('0x3')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 9f74f5e..4142cee 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 _0x5eae=['merge','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','CloudProvider','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter'];(function(_0x17882e,_0x4da367){var _0x2c3016=function(_0x246c3a){while(--_0x246c3a){_0x17882e['push'](_0x17882e['shift']());}};_0x2c3016(++_0x4da367);}(_0x5eae,0x9b));var _0xe5ea=function(_0x2d0599,_0x299dbf){_0x2d0599=_0x2d0599-0x0;var _0x31ec14=_0x5eae[_0x2d0599];return _0x31ec14;};'use strict';var pdf=require(_0xe5ea('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe5ea('0x1'));var jsonpatch=require(_0xe5ea('0x2'));var rp=require(_0xe5ea('0x3'));var moment=require('moment');var BPromise=require(_0xe5ea('0x4'));var Mustache=require(_0xe5ea('0x5'));var util=require(_0xe5ea('0x6'));var path=require(_0xe5ea('0x7'));var sox=require(_0xe5ea('0x8'));var csv=require(_0xe5ea('0x9'));var ejs=require(_0xe5ea('0xa'));var fs=require('fs');var _=require(_0xe5ea('0xb'));var squel=require('squel');var crypto=require(_0xe5ea('0xc'));var jsforce=require(_0xe5ea('0xd'));var deskjs=require(_0xe5ea('0xe'));var toCsv=require(_0xe5ea('0x9'));var querystring=require(_0xe5ea('0xf'));var Papa=require(_0xe5ea('0x10'));var Redis=require(_0xe5ea('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe5ea('0x12'));var as=require(_0xe5ea('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe5ea('0x14'));var utils=require(_0xe5ea('0x15'));var config=require(_0xe5ea('0x16'));var licenseUtil=require(_0xe5ea('0x17'));var db=require(_0xe5ea('0x18'))['db'];function respondWithStatusCode(_0x2d8b34,_0x1a5d33){_0x1a5d33=_0x1a5d33||0xcc;return function(_0x4b568b){if(_0x4b568b){return _0x2d8b34[_0xe5ea('0x19')](_0x1a5d33);}return _0x2d8b34[_0xe5ea('0x1a')](_0x1a5d33)[_0xe5ea('0x1b')]();};}function respondWithResult(_0x5bc359,_0x543267){_0x543267=_0x543267||0xc8;return function(_0x353a86){if(_0x353a86){return _0x5bc359[_0xe5ea('0x1a')](_0x543267)[_0xe5ea('0x1c')](_0x353a86);}};}function respondWithFilteredResult(_0x1945c,_0x54150d){return function(_0x23a739){if(_0x23a739){var _0x55ac93=_0x23a739['count'],_0x3b02fe=_0x54150d[_0xe5ea('0x1d')],_0x40823c=_0x54150d[_0xe5ea('0x1d')]+_0x54150d[_0xe5ea('0x1e')],_0x55548f;if(_0x40823c>=_0x55ac93){_0x40823c=_0x55ac93;_0x55548f=0xc8;}else{_0x55548f=0xce;}_0x1945c[_0xe5ea('0x1a')](_0x55548f);return _0x1945c[_0xe5ea('0x1f')](_0xe5ea('0x20'),_0x3b02fe+'-'+_0x40823c+'/'+_0x55ac93)['json'](_0x23a739);}return null;};}function patchUpdates(_0x4ce2cd){return function(_0x31ab6c){try{jsonpatch['apply'](_0x31ab6c,_0x4ce2cd,!![]);}catch(_0x4c21db){return BPromise[_0xe5ea('0x21')](_0x4c21db);}return _0x31ab6c[_0xe5ea('0x22')]();};}function saveUpdates(_0x5aeaf9,_0x17e672){return function(_0x4c6fa0){if(_0x4c6fa0){return _0x4c6fa0[_0xe5ea('0x23')](_0x5aeaf9)[_0xe5ea('0x24')](function(_0x2f55f2){return _0x2f55f2;});}return null;};}function removeEntity(_0x337541,_0x3138a7){return function(_0x3b042c){if(_0x3b042c){return _0x3b042c[_0xe5ea('0x25')]()[_0xe5ea('0x24')](function(){_0x337541[_0xe5ea('0x1a')](0xcc)[_0xe5ea('0x1b')]();});}};}function handleEntityNotFound(_0x292b15,_0xf60e75){return function(_0x32b049){if(!_0x32b049){_0x292b15[_0xe5ea('0x19')](0x194);}return _0x32b049;};}function handleError(_0x4ea5b8,_0x4b4647){_0x4b4647=_0x4b4647||0x1f4;return function(_0x67f97e){logger[_0xe5ea('0x26')](_0x67f97e['stack']);if(_0x67f97e[_0xe5ea('0x27')]){delete _0x67f97e[_0xe5ea('0x27')];}_0x4ea5b8[_0xe5ea('0x1a')](_0x4b4647)['send'](_0x67f97e);};}exports[_0xe5ea('0x28')]=function(_0x287fd8,_0x212830){var _0x37ed01={},_0x142749={},_0x1e5866={'count':0x0,'rows':[]};var _0x4d54df=_[_0xe5ea('0x29')](db[_0xe5ea('0x2a')][_0xe5ea('0x2b')],function(_0x4790ab){return{'name':_0x4790ab['fieldName'],'type':_0x4790ab[_0xe5ea('0x2c')]['key']};});_0x142749[_0xe5ea('0x2d')]=_[_0xe5ea('0x29')](_0x4d54df,_0xe5ea('0x27'));_0x142749[_0xe5ea('0x2e')]=_[_0xe5ea('0x2f')](_0x287fd8[_0xe5ea('0x2e')]);_0x142749[_0xe5ea('0x30')]=_[_0xe5ea('0x31')](_0x142749[_0xe5ea('0x2d')],_0x142749['query']);_0x37ed01['attributes']=_['intersection'](_0x142749[_0xe5ea('0x2d')],qs['fields'](_0x287fd8[_0xe5ea('0x2e')][_0xe5ea('0x32')]));_0x37ed01[_0xe5ea('0x33')]=_0x37ed01[_0xe5ea('0x33')][_0xe5ea('0x34')]?_0x37ed01[_0xe5ea('0x33')]:_0x142749[_0xe5ea('0x2d')];if(!_0x287fd8[_0xe5ea('0x2e')][_0xe5ea('0x35')]('nolimit')){_0x37ed01[_0xe5ea('0x1e')]=qs[_0xe5ea('0x1e')](_0x287fd8[_0xe5ea('0x2e')]['limit']);_0x37ed01[_0xe5ea('0x1d')]=qs[_0xe5ea('0x1d')](_0x287fd8[_0xe5ea('0x2e')]['offset']);}_0x37ed01[_0xe5ea('0x36')]=qs[_0xe5ea('0x37')](_0x287fd8[_0xe5ea('0x2e')][_0xe5ea('0x37')]);_0x37ed01[_0xe5ea('0x38')]=qs[_0xe5ea('0x30')](_['pick'](_0x287fd8[_0xe5ea('0x2e')],_0x142749[_0xe5ea('0x30')]),_0x4d54df);if(_0x287fd8[_0xe5ea('0x2e')][_0xe5ea('0x39')]){_0x37ed01['where']=_[_0xe5ea('0x3a')](_0x37ed01['where'],{'$or':_[_0xe5ea('0x29')](_0x4d54df,function(_0x52a471){if(_0x52a471[_0xe5ea('0x2c')]!=='VIRTUAL'){var _0x53fc82={};_0x53fc82[_0x52a471[_0xe5ea('0x27')]]={'$like':'%'+_0x287fd8[_0xe5ea('0x2e')][_0xe5ea('0x39')]+'%'};return _0x53fc82;}})});}_0x37ed01=_['merge']({},_0x37ed01,_0x287fd8[_0xe5ea('0x3b')]);var _0x3bfd38={'where':_0x37ed01[_0xe5ea('0x38')]};return db[_0xe5ea('0x2a')][_0xe5ea('0x3c')](_0x3bfd38)[_0xe5ea('0x24')](function(_0x247096){_0x1e5866[_0xe5ea('0x3c')]=_0x247096;if(_0x287fd8[_0xe5ea('0x2e')]['includeAll']){_0x37ed01[_0xe5ea('0x3d')]=[{'all':!![]}];}return db[_0xe5ea('0x2a')][_0xe5ea('0x3e')](_0x37ed01);})[_0xe5ea('0x24')](function(_0x899140){_0x1e5866[_0xe5ea('0x3f')]=_0x899140;return _0x1e5866;})['then'](respondWithFilteredResult(_0x212830,_0x37ed01))[_0xe5ea('0x40')](handleError(_0x212830,null));};exports[_0xe5ea('0x41')]=function(_0x51ac67,_0x4c2666){var _0x34773a={'raw':!![],'where':{'id':_0x51ac67['params']['id']}},_0x60965d={};_0x60965d[_0xe5ea('0x2d')]=_[_0xe5ea('0x2f')](db[_0xe5ea('0x2a')][_0xe5ea('0x2b')]);_0x60965d['query']=_[_0xe5ea('0x2f')](_0x51ac67[_0xe5ea('0x2e')]);_0x60965d[_0xe5ea('0x30')]=_[_0xe5ea('0x31')](_0x60965d['model'],_0x60965d[_0xe5ea('0x2e')]);_0x34773a[_0xe5ea('0x33')]=_[_0xe5ea('0x31')](_0x60965d['model'],qs['fields'](_0x51ac67[_0xe5ea('0x2e')][_0xe5ea('0x32')]));_0x34773a['attributes']=_0x34773a['attributes'][_0xe5ea('0x34')]?_0x34773a[_0xe5ea('0x33')]:_0x60965d[_0xe5ea('0x2d')];if(_0x51ac67[_0xe5ea('0x2e')][_0xe5ea('0x42')]){_0x34773a[_0xe5ea('0x3d')]=[{'all':!![]}];}_0x34773a=_[_0xe5ea('0x3a')]({},_0x34773a,_0x51ac67[_0xe5ea('0x3b')]);return db[_0xe5ea('0x2a')][_0xe5ea('0x43')](_0x34773a)[_0xe5ea('0x24')](handleEntityNotFound(_0x4c2666,null))['then'](respondWithResult(_0x4c2666,null))[_0xe5ea('0x40')](handleError(_0x4c2666,null));};exports[_0xe5ea('0x44')]=function(_0x1e1748,_0x31845e){return db['CloudProvider'][_0xe5ea('0x44')](_0x1e1748['body'],{})[_0xe5ea('0x24')](respondWithResult(_0x31845e,0xc9))[_0xe5ea('0x40')](handleError(_0x31845e,null));};exports[_0xe5ea('0x23')]=function(_0x263de8,_0x9a78ed){if(_0x263de8[_0xe5ea('0x45')]['id']){delete _0x263de8[_0xe5ea('0x45')]['id'];}return db['CloudProvider'][_0xe5ea('0x43')]({'where':{'id':_0x263de8[_0xe5ea('0x46')]['id']}})[_0xe5ea('0x24')](handleEntityNotFound(_0x9a78ed,null))[_0xe5ea('0x24')](saveUpdates(_0x263de8[_0xe5ea('0x45')],null))['then'](respondWithResult(_0x9a78ed,null))[_0xe5ea('0x40')](handleError(_0x9a78ed,null));};exports[_0xe5ea('0x25')]=function(_0x2f9305,_0xeb660e){return db[_0xe5ea('0x2a')]['find']({'where':{'id':_0x2f9305[_0xe5ea('0x46')]['id']}})['then'](handleEntityNotFound(_0xeb660e,null))['then'](removeEntity(_0xeb660e,null))[_0xe5ea('0x40')](handleError(_0xeb660e,null));}; \ No newline at end of file +var _0x6459=['apply','reject','save','update','destroy','then','stack','name','send','map','CloudProvider','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','fields','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit'];(function(_0x1d1e29,_0x2977a6){var _0x52cf9f=function(_0x309a30){while(--_0x309a30){_0x1d1e29['push'](_0x1d1e29['shift']());}};_0x52cf9f(++_0x2977a6);}(_0x6459,0x6e));var _0x9645=function(_0xe70721,_0x4a24cb){_0xe70721=_0xe70721-0x0;var _0x51cc22=_0x6459[_0xe70721];return _0x51cc22;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9645('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9645('0x1'));var jsonpatch=require(_0x9645('0x2'));var rp=require(_0x9645('0x3'));var moment=require(_0x9645('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9645('0x5'));var util=require(_0x9645('0x6'));var path=require(_0x9645('0x7'));var sox=require(_0x9645('0x8'));var csv=require(_0x9645('0x9'));var ejs=require(_0x9645('0xa'));var fs=require('fs');var _=require(_0x9645('0xb'));var squel=require(_0x9645('0xc'));var crypto=require(_0x9645('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9645('0xe'));var toCsv=require(_0x9645('0x9'));var querystring=require(_0x9645('0xf'));var Papa=require(_0x9645('0x10'));var Redis=require(_0x9645('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9645('0x12'));var as=require(_0x9645('0x13'));var hardwareService=require(_0x9645('0x14'));var logger=require(_0x9645('0x15'))(_0x9645('0x16'));var utils=require(_0x9645('0x17'));var config=require(_0x9645('0x18'));var licenseUtil=require(_0x9645('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25974a,_0x7cc2ac){_0x7cc2ac=_0x7cc2ac||0xcc;return function(_0x4d1528){if(_0x4d1528){return _0x25974a[_0x9645('0x1a')](_0x7cc2ac);}return _0x25974a[_0x9645('0x1b')](_0x7cc2ac)['end']();};}function respondWithResult(_0x1a51cd,_0x3d5031){_0x3d5031=_0x3d5031||0xc8;return function(_0x5db7a0){if(_0x5db7a0){return _0x1a51cd[_0x9645('0x1b')](_0x3d5031)[_0x9645('0x1c')](_0x5db7a0);}};}function respondWithFilteredResult(_0x54de39,_0x5d73fd){return function(_0x26c3ea){if(_0x26c3ea){var _0x556641=_0x26c3ea[_0x9645('0x1d')],_0x374354=_0x5d73fd['offset'],_0xfb4b9d=_0x5d73fd[_0x9645('0x1e')]+_0x5d73fd[_0x9645('0x1f')],_0x1a9781;if(_0xfb4b9d>=_0x556641){_0xfb4b9d=_0x556641;_0x1a9781=0xc8;}else{_0x1a9781=0xce;}_0x54de39[_0x9645('0x1b')](_0x1a9781);return _0x54de39['set']('Content-Range',_0x374354+'-'+_0xfb4b9d+'/'+_0x556641)[_0x9645('0x1c')](_0x26c3ea);}return null;};}function patchUpdates(_0xa5b798){return function(_0x5306df){try{jsonpatch[_0x9645('0x20')](_0x5306df,_0xa5b798,!![]);}catch(_0x4de7c0){return BPromise[_0x9645('0x21')](_0x4de7c0);}return _0x5306df[_0x9645('0x22')]();};}function saveUpdates(_0x17cfa6,_0x5e225e){return function(_0x5ecabe){if(_0x5ecabe){return _0x5ecabe[_0x9645('0x23')](_0x17cfa6)['then'](function(_0x325903){return _0x325903;});}return null;};}function removeEntity(_0x3bfeea,_0x152a93){return function(_0x3fb8cb){if(_0x3fb8cb){return _0x3fb8cb[_0x9645('0x24')]()[_0x9645('0x25')](function(){_0x3bfeea[_0x9645('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x109d11,_0x804f84){return function(_0x40b5a3){if(!_0x40b5a3){_0x109d11[_0x9645('0x1a')](0x194);}return _0x40b5a3;};}function handleError(_0x10eff7,_0xf04f98){_0xf04f98=_0xf04f98||0x1f4;return function(_0x143944){logger['error'](_0x143944[_0x9645('0x26')]);if(_0x143944[_0x9645('0x27')]){delete _0x143944[_0x9645('0x27')];}_0x10eff7['status'](_0xf04f98)[_0x9645('0x28')](_0x143944);};}exports['index']=function(_0x124c30,_0x39dea4){var _0x2f696b={},_0x1ca23b={},_0x20480b={'count':0x0,'rows':[]};var _0x1882b6=_[_0x9645('0x29')](db[_0x9645('0x2a')]['rawAttributes'],function(_0x461071){return{'name':_0x461071[_0x9645('0x2b')],'type':_0x461071['type'][_0x9645('0x2c')]};});_0x1ca23b[_0x9645('0x2d')]=_[_0x9645('0x29')](_0x1882b6,_0x9645('0x27'));_0x1ca23b[_0x9645('0x2e')]=_[_0x9645('0x2f')](_0x124c30[_0x9645('0x2e')]);_0x1ca23b[_0x9645('0x30')]=_['intersection'](_0x1ca23b['model'],_0x1ca23b[_0x9645('0x2e')]);_0x2f696b[_0x9645('0x31')]=_[_0x9645('0x32')](_0x1ca23b[_0x9645('0x2d')],qs['fields'](_0x124c30['query']['fields']));_0x2f696b[_0x9645('0x31')]=_0x2f696b[_0x9645('0x31')][_0x9645('0x33')]?_0x2f696b[_0x9645('0x31')]:_0x1ca23b[_0x9645('0x2d')];if(!_0x124c30[_0x9645('0x2e')][_0x9645('0x34')]('nolimit')){_0x2f696b[_0x9645('0x1f')]=qs[_0x9645('0x1f')](_0x124c30[_0x9645('0x2e')][_0x9645('0x1f')]);_0x2f696b[_0x9645('0x1e')]=qs[_0x9645('0x1e')](_0x124c30[_0x9645('0x2e')][_0x9645('0x1e')]);}_0x2f696b[_0x9645('0x35')]=qs['sort'](_0x124c30[_0x9645('0x2e')]['sort']);_0x2f696b[_0x9645('0x36')]=qs[_0x9645('0x30')](_[_0x9645('0x37')](_0x124c30[_0x9645('0x2e')],_0x1ca23b[_0x9645('0x30')]),_0x1882b6);if(_0x124c30[_0x9645('0x2e')][_0x9645('0x38')]){_0x2f696b[_0x9645('0x36')]=_[_0x9645('0x39')](_0x2f696b[_0x9645('0x36')],{'$or':_[_0x9645('0x29')](_0x1882b6,function(_0x10c78d){if(_0x10c78d[_0x9645('0x3a')]!==_0x9645('0x3b')){var _0x186342={};_0x186342[_0x10c78d[_0x9645('0x27')]]={'$like':'%'+_0x124c30[_0x9645('0x2e')][_0x9645('0x38')]+'%'};return _0x186342;}})});}_0x2f696b=_[_0x9645('0x39')]({},_0x2f696b,_0x124c30[_0x9645('0x3c')]);var _0x29a5a0={'where':_0x2f696b[_0x9645('0x36')]};return db[_0x9645('0x2a')][_0x9645('0x1d')](_0x29a5a0)['then'](function(_0x33ba1c){_0x20480b[_0x9645('0x1d')]=_0x33ba1c;if(_0x124c30[_0x9645('0x2e')][_0x9645('0x3d')]){_0x2f696b['include']=[{'all':!![]}];}return db[_0x9645('0x2a')][_0x9645('0x3e')](_0x2f696b);})[_0x9645('0x25')](function(_0x5e3a38){_0x20480b[_0x9645('0x3f')]=_0x5e3a38;return _0x20480b;})['then'](respondWithFilteredResult(_0x39dea4,_0x2f696b))[_0x9645('0x40')](handleError(_0x39dea4,null));};exports['show']=function(_0x3ba38a,_0x4ba947){var _0x2d1062={'raw':!![],'where':{'id':_0x3ba38a[_0x9645('0x41')]['id']}},_0x39c0b5={};_0x39c0b5['model']=_[_0x9645('0x2f')](db['CloudProvider']['rawAttributes']);_0x39c0b5[_0x9645('0x2e')]=_[_0x9645('0x2f')](_0x3ba38a[_0x9645('0x2e')]);_0x39c0b5[_0x9645('0x30')]=_['intersection'](_0x39c0b5['model'],_0x39c0b5[_0x9645('0x2e')]);_0x2d1062['attributes']=_['intersection'](_0x39c0b5[_0x9645('0x2d')],qs[_0x9645('0x42')](_0x3ba38a[_0x9645('0x2e')][_0x9645('0x42')]));_0x2d1062[_0x9645('0x31')]=_0x2d1062[_0x9645('0x31')][_0x9645('0x33')]?_0x2d1062[_0x9645('0x31')]:_0x39c0b5[_0x9645('0x2d')];if(_0x3ba38a['query'][_0x9645('0x3d')]){_0x2d1062[_0x9645('0x43')]=[{'all':!![]}];}_0x2d1062=_['merge']({},_0x2d1062,_0x3ba38a[_0x9645('0x3c')]);return db['CloudProvider'][_0x9645('0x44')](_0x2d1062)[_0x9645('0x25')](handleEntityNotFound(_0x4ba947,null))['then'](respondWithResult(_0x4ba947,null))[_0x9645('0x40')](handleError(_0x4ba947,null));};exports[_0x9645('0x45')]=function(_0x560d4e,_0x33a570){return db[_0x9645('0x2a')][_0x9645('0x45')](_0x560d4e['body'],{})[_0x9645('0x25')](respondWithResult(_0x33a570,0xc9))['catch'](handleError(_0x33a570,null));};exports[_0x9645('0x23')]=function(_0x565d96,_0x1cccd8){if(_0x565d96['body']['id']){delete _0x565d96[_0x9645('0x46')]['id'];}return db[_0x9645('0x2a')][_0x9645('0x44')]({'where':{'id':_0x565d96[_0x9645('0x41')]['id']}})[_0x9645('0x25')](handleEntityNotFound(_0x1cccd8,null))[_0x9645('0x25')](saveUpdates(_0x565d96[_0x9645('0x46')],null))[_0x9645('0x25')](respondWithResult(_0x1cccd8,null))[_0x9645('0x40')](handleError(_0x1cccd8,null));};exports[_0x9645('0x24')]=function(_0x6c973f,_0x9475a6){return db[_0x9645('0x2a')][_0x9645('0x44')]({'where':{'id':_0x6c973f[_0x9645('0x41')]['id']}})[_0x9645('0x25')](handleEntityNotFound(_0x9475a6,null))[_0x9645('0x25')](removeEntity(_0x9475a6,null))[_0x9645('0x40')](handleError(_0x9475a6,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 86e3ebf..05f45f5 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 _0x284c=['define','CloudProvider','cloud_providers','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x250e3d,_0x3cfc4e){var _0x3b687d=function(_0x52fd68){while(--_0x52fd68){_0x250e3d['push'](_0x250e3d['shift']());}};_0x3b687d(++_0x3cfc4e);}(_0x284c,0x158));var _0xc284=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x284c[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xc284('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc284('0x1'));var moment=require('moment');var BPromise=require(_0xc284('0x2'));var rp=require(_0xc284('0x3'));var fs=require('fs');var path=require(_0xc284('0x4'));var rimraf=require(_0xc284('0x5'));var config=require(_0xc284('0x6'));var attributes=require('./cloudProvider.attributes');module[_0xc284('0x7')]=function(_0x11c499,_0x2d21ed){return _0x11c499[_0xc284('0x8')](_0xc284('0x9'),attributes,{'tableName':_0xc284('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa18b=['CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa18b,0x115));var _0xba18=function(_0x226e5b,_0x4935ed){_0x226e5b=_0x226e5b-0x0;var _0x3c44d3=_0xa18b[_0x226e5b];return _0x3c44d3;};'use strict';var _=require(_0xba18('0x0'));var util=require(_0xba18('0x1'));var logger=require(_0xba18('0x2'))(_0xba18('0x3'));var moment=require('moment');var BPromise=require(_0xba18('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba18('0x5'));var rimraf=require(_0xba18('0x6'));var config=require(_0xba18('0x7'));var attributes=require('./cloudProvider.attributes');module[_0xba18('0x8')]=function(_0x41b28d,_0x1cff64){return _0x41b28d['define'](_0xba18('0x9'),attributes,{'tableName':_0xba18('0xa'),'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 ed43937..4fa0d71 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 _0x9abb=['request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CloudProvider,\x20%s,\x20%s'];(function(_0x5d4db9,_0x2adda5){var _0x129cf7=function(_0x465d60){while(--_0x465d60){_0x5d4db9['push'](_0x5d4db9['shift']());}};_0x129cf7(++_0x2adda5);}(_0x9abb,0x9e));var _0xb9ab=function(_0x5c3014,_0x872c2){_0x5c3014=_0x5c3014-0x0;var _0x3da0ed=_0x9abb[_0x5c3014];return _0x3da0ed;};'use strict';var _=require(_0xb9ab('0x0'));var util=require(_0xb9ab('0x1'));var moment=require('moment');var BPromise=require(_0xb9ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9ab('0x3'));var db=require(_0xb9ab('0x4'))['db'];var utils=require(_0xb9ab('0x5'));var logger=require(_0xb9ab('0x6'))('rpc');var config=require(_0xb9ab('0x7'));var jayson=require(_0xb9ab('0x8'));var client=jayson['client'][_0xb9ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e4a5d,_0xa3688d,_0x454ffb){return new BPromise(function(_0x1a2b9a,_0x16a63e){return client[_0xb9ab('0xa')](_0x2e4a5d,_0x454ffb)['then'](function(_0x560eb5){logger[_0xb9ab('0xb')](_0xb9ab('0xc'),_0xa3688d,_0xb9ab('0xd'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0xa3688d,_0xb9ab('0xd'),JSON[_0xb9ab('0xe')](_0x560eb5));if(_0x560eb5[_0xb9ab('0xf')]){if(_0x560eb5['error'][_0xb9ab('0x10')]===0x1f4){logger[_0xb9ab('0xf')](_0xb9ab('0xc'),_0xa3688d,_0x560eb5[_0xb9ab('0xf')][_0xb9ab('0x11')]);return _0x16a63e(_0x560eb5[_0xb9ab('0xf')][_0xb9ab('0x11')]);}logger[_0xb9ab('0xf')]('CloudProvider,\x20%s,\x20%s',_0xa3688d,_0x560eb5[_0xb9ab('0xf')]['message']);return _0x1a2b9a(_0x560eb5[_0xb9ab('0xf')][_0xb9ab('0x11')]);}else{logger[_0xb9ab('0xb')]('CloudProvider,\x20%s,\x20%s',_0xa3688d,_0xb9ab('0xd'));_0x1a2b9a(_0x560eb5[_0xb9ab('0x12')]['message']);}})['catch'](function(_0x3fb19a){logger[_0xb9ab('0xf')](_0xb9ab('0xc'),_0xa3688d,_0x3fb19a);_0x16a63e(_0x3fb19a);});});} \ No newline at end of file +var _0x14e8=['then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14e8,0xba));var _0x814e=function(_0x254d77,_0x41ec9c){_0x254d77=_0x254d77-0x0;var _0x20067e=_0x14e8[_0x254d77];return _0x20067e;};'use strict';var _=require(_0x814e('0x0'));var util=require(_0x814e('0x1'));var moment=require(_0x814e('0x2'));var BPromise=require(_0x814e('0x3'));var rs=require(_0x814e('0x4'));var fs=require('fs');var Redis=require(_0x814e('0x5'));var db=require(_0x814e('0x6'))['db'];var utils=require(_0x814e('0x7'));var logger=require('../../config/logger')(_0x814e('0x8'));var config=require(_0x814e('0x9'));var jayson=require(_0x814e('0xa'));var client=jayson[_0x814e('0xb')][_0x814e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a113f,_0x56882c,_0x4601be){return new BPromise(function(_0x47d30c,_0x5f19f7){return client[_0x814e('0xd')](_0x5a113f,_0x4601be)[_0x814e('0xe')](function(_0x1d111b){logger[_0x814e('0xf')](_0x814e('0x10'),_0x56882c,_0x814e('0x11'));logger[_0x814e('0x12')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x56882c,_0x814e('0x11'),JSON[_0x814e('0x13')](_0x1d111b));if(_0x1d111b['error']){if(_0x1d111b['error'][_0x814e('0x14')]===0x1f4){logger[_0x814e('0x15')](_0x814e('0x10'),_0x56882c,_0x1d111b[_0x814e('0x15')]['message']);return _0x5f19f7(_0x1d111b[_0x814e('0x15')]['message']);}logger[_0x814e('0x15')](_0x814e('0x10'),_0x56882c,_0x1d111b[_0x814e('0x15')]['message']);return _0x47d30c(_0x1d111b[_0x814e('0x15')][_0x814e('0x16')]);}else{logger[_0x814e('0xf')](_0x814e('0x10'),_0x56882c,_0x814e('0x11'));_0x47d30c(_0x1d111b[_0x814e('0x17')][_0x814e('0x16')]);}})[_0x814e('0x18')](function(_0x3457dd){logger[_0x814e('0x15')](_0x814e('0x10'),_0x56882c,_0x3457dd);_0x5f19f7(_0x3457dd);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index d1cfb28..acf7b62 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 _0x7b58=['../../config/environment','./cloudProvider.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','path','express','Router'];(function(_0x34ac51,_0x47b509){var _0xea1dc5=function(_0x5f3fb4){while(--_0x5f3fb4){_0x34ac51['push'](_0x34ac51['shift']());}};_0xea1dc5(++_0x47b509);}(_0x7b58,0xad));var _0x87b5=function(_0x5e7e92,_0xdb0f1){_0x5e7e92=_0x5e7e92-0x0;var _0x412746=_0x7b58[_0x5e7e92];return _0x412746;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x87b5('0x0'));var timeout=require('connect-timeout');var express=require(_0x87b5('0x1'));var router=express[_0x87b5('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x87b5('0x3'));var controller=require(_0x87b5('0x4'));router['get']('/',auth[_0x87b5('0x5')](),controller[_0x87b5('0x6')]);router[_0x87b5('0x7')](_0x87b5('0x8'),auth[_0x87b5('0x5')](),controller[_0x87b5('0x9')]);router['post']('/',auth[_0x87b5('0x5')](),controller[_0x87b5('0xa')]);router[_0x87b5('0xb')](_0x87b5('0x8'),auth['isAuthenticated'](),controller[_0x87b5('0xc')]);router[_0x87b5('0xd')](_0x87b5('0x8'),auth['isAuthenticated'](),controller[_0x87b5('0xe')]);module[_0x87b5('0xf')]=router; \ No newline at end of file +var _0xe68f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe68f,0x1ec));var _0xfe68=function(_0x512ce9,_0x1625fe){_0x512ce9=_0x512ce9-0x0;var _0x501c8d=_0xe68f[_0x512ce9];return _0x501c8d;};'use strict';var multer=require(_0xfe68('0x0'));var util=require(_0xfe68('0x1'));var path=require(_0xfe68('0x2'));var timeout=require(_0xfe68('0x3'));var express=require(_0xfe68('0x4'));var router=express[_0xfe68('0x5')]();var auth=require(_0xfe68('0x6'));var interaction=require(_0xfe68('0x7'));var config=require(_0xfe68('0x8'));var controller=require('./cloudProvider.controller');router[_0xfe68('0x9')]('/',auth[_0xfe68('0xa')](),controller[_0xfe68('0xb')]);router[_0xfe68('0x9')](_0xfe68('0xc'),auth['isAuthenticated'](),controller[_0xfe68('0xd')]);router['post']('/',auth[_0xfe68('0xa')](),controller[_0xfe68('0xe')]);router[_0xfe68('0xf')](_0xfe68('0xc'),auth[_0xfe68('0xa')](),controller[_0xfe68('0x10')]);router[_0xfe68('0x11')](_0xfe68('0xc'),auth[_0xfe68('0xa')](),controller['destroy']);module[_0xfe68('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 7d7d0c9..7994eab 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 _0xce67=['sequelize','exports','STRING','name'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xce67,0x94));var _0x7ce6=function(_0x2b6293,_0x45cd27){_0x2b6293=_0x2b6293-0x0;var _0x255502=_0xce67[_0x2b6293];return _0x255502;};'use strict';var Sequelize=require(_0x7ce6('0x0'));module[_0x7ce6('0x1')]={'name':{'type':Sequelize[_0x7ce6('0x2')],'unique':_0x7ce6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7ce6('0x2')]},'companyId':{'type':Sequelize[_0x7ce6('0x2')]},'website':{'type':Sequelize[_0x7ce6('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x7ce6('0x2')]},'type':{'type':Sequelize[_0x7ce6('0x2')]},'street':{'type':Sequelize[_0x7ce6('0x2')]},'postalCode':{'type':Sequelize[_0x7ce6('0x2')]},'city':{'type':Sequelize[_0x7ce6('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7ce6('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7ce6('0x2')]},'sStreet':{'type':Sequelize[_0x7ce6('0x2')]},'sPostalCode':{'type':Sequelize[_0x7ce6('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x7ce6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdce7=['STRING','name','sequelize','exports'];(function(_0x14a8f8,_0x35a6f4){var _0x4dce53=function(_0x2b72c4){while(--_0x2b72c4){_0x14a8f8['push'](_0x14a8f8['shift']());}};_0x4dce53(++_0x35a6f4);}(_0xdce7,0x1ee));var _0x7dce=function(_0x18920a,_0x5c7896){_0x18920a=_0x18920a-0x0;var _0x5b48a2=_0xdce7[_0x18920a];return _0x5b48a2;};'use strict';var Sequelize=require(_0x7dce('0x0'));module[_0x7dce('0x1')]={'name':{'type':Sequelize[_0x7dce('0x2')],'unique':_0x7dce('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7dce('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x7dce('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x7dce('0x2')]},'type':{'type':Sequelize[_0x7dce('0x2')]},'street':{'type':Sequelize[_0x7dce('0x2')]},'postalCode':{'type':Sequelize[_0x7dce('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7dce('0x2')]},'email':{'type':Sequelize[_0x7dce('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7dce('0x2')]},'sStreet':{'type':Sequelize[_0x7dce('0x2')]},'sPostalCode':{'type':Sequelize[_0x7dce('0x2')]},'sCity':{'type':Sequelize[_0x7dce('0x2')]},'sCountry':{'type':Sequelize[_0x7dce('0x2')]},'description':{'type':Sequelize[_0x7dce('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index d3cae54..8a86075 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 _0x9d01=['ejs','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','describe','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','filter','where','merge','map','options','includeAll','include','findAll','rows','catch','CmCompany','rawAttributes','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Companies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','ids','omit','getContacts','findOne','CmContact','order','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv'];(function(_0x4de9e8,_0x565ffa){var _0x4db0de=function(_0x12279d){while(--_0x12279d){_0x4de9e8['push'](_0x4de9e8['shift']());}};_0x4db0de(++_0x565ffa);}(_0x9d01,0x9f));var _0x19d0=function(_0x264f8d,_0xac465a){_0x264f8d=_0x264f8d-0x0;var _0xed26c1=_0x9d01[_0x264f8d];return _0xed26c1;};'use strict';var pdf=require(_0x19d0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x19d0('0x1'));var zipdir=require(_0x19d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19d0('0x3'));var moment=require('moment');var BPromise=require(_0x19d0('0x4'));var Mustache=require(_0x19d0('0x5'));var util=require(_0x19d0('0x6'));var path=require(_0x19d0('0x7'));var sox=require('sox');var csv=require(_0x19d0('0x8'));var ejs=require(_0x19d0('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x19d0('0xa'));var toCsv=require(_0x19d0('0x8'));var querystring=require('querystring');var Papa=require(_0x19d0('0xb'));var Redis=require(_0x19d0('0xc'));var authService=require(_0x19d0('0xd'));var qs=require(_0x19d0('0xe'));var as=require(_0x19d0('0xf'));var hardwareService=require(_0x19d0('0x10'));var logger=require(_0x19d0('0x11'))(_0x19d0('0x12'));var utils=require(_0x19d0('0x13'));var config=require(_0x19d0('0x14'));var licenseUtil=require(_0x19d0('0x15'));var db=require(_0x19d0('0x16'))['db'];function respondWithStatusCode(_0x24d583,_0x43033b){_0x43033b=_0x43033b||0xcc;return function(_0x5672fb){if(_0x5672fb){return _0x24d583[_0x19d0('0x17')](_0x43033b);}return _0x24d583[_0x19d0('0x18')](_0x43033b)['end']();};}function respondWithResult(_0x157da2,_0x5837bb){_0x5837bb=_0x5837bb||0xc8;return function(_0xc85787){if(_0xc85787){return _0x157da2[_0x19d0('0x18')](_0x5837bb)[_0x19d0('0x19')](_0xc85787);}};}function respondWithFilteredResult(_0x1cee00,_0x175604){return function(_0x1dd603){if(_0x1dd603){var _0x109c4d=_0x1dd603[_0x19d0('0x1a')],_0x4dd62f=_0x175604[_0x19d0('0x1b')],_0x24bcef=_0x175604[_0x19d0('0x1b')]+_0x175604[_0x19d0('0x1c')],_0x50c61b;if(_0x24bcef>=_0x109c4d){_0x24bcef=_0x109c4d;_0x50c61b=0xc8;}else{_0x50c61b=0xce;}_0x1cee00['status'](_0x50c61b);return _0x1cee00['set']('Content-Range',_0x4dd62f+'-'+_0x24bcef+'/'+_0x109c4d)['json'](_0x1dd603);}return null;};}function patchUpdates(_0x3499fe){return function(_0xd320d8){try{jsonpatch[_0x19d0('0x1d')](_0xd320d8,_0x3499fe,!![]);}catch(_0x44257f){return BPromise[_0x19d0('0x1e')](_0x44257f);}return _0xd320d8[_0x19d0('0x1f')]();};}function saveUpdates(_0x37be22,_0x355e46){return function(_0x3fde5f){if(_0x3fde5f){return _0x3fde5f[_0x19d0('0x20')](_0x37be22)[_0x19d0('0x21')](function(_0x23794f){return _0x23794f;});}return null;};}function removeEntity(_0x5d8f3e,_0x44427a){return function(_0x20d217){if(_0x20d217){return _0x20d217[_0x19d0('0x22')]()[_0x19d0('0x21')](function(){var _0x25ab72=_0x20d217['get']({'plain':!![]});var _0x330769='Companies';return db[_0x19d0('0x23')][_0x19d0('0x22')]({'where':{'type':_0x330769,'resourceId':_0x25ab72['id']}})[_0x19d0('0x21')](function(){return _0x20d217;});})[_0x19d0('0x21')](function(){_0x5d8f3e[_0x19d0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b3735,_0x48e895){return function(_0x3ea867){if(!_0x3ea867){_0x5b3735[_0x19d0('0x17')](0x194);}return _0x3ea867;};}function handleError(_0x2817c4,_0x3b2782){_0x3b2782=_0x3b2782||0x1f4;return function(_0x18d9d8){logger[_0x19d0('0x24')](_0x18d9d8[_0x19d0('0x25')]);if(_0x18d9d8[_0x19d0('0x26')]){delete _0x18d9d8[_0x19d0('0x26')];}_0x2817c4[_0x19d0('0x18')](_0x3b2782)[_0x19d0('0x27')](_0x18d9d8);};}exports[_0x19d0('0x28')]=function(_0x238e70,_0xaa3acb){var _0x48d623={},_0x137273={},_0x52bed1={'count':0x0,'rows':[]};return db['CmCompany'][_0x19d0('0x29')]()[_0x19d0('0x21')](function(_0x732b05){_0x137273[_0x19d0('0x2a')]=_[_0x19d0('0x2b')](_0x732b05);_0x137273[_0x19d0('0x2c')]=_[_0x19d0('0x2b')](_0x238e70[_0x19d0('0x2c')]);_0x137273['filters']=_[_0x19d0('0x2d')](_0x137273['model'],_0x137273[_0x19d0('0x2c')]);_0x48d623[_0x19d0('0x2e')]=_[_0x19d0('0x2d')](_0x137273['model'],qs[_0x19d0('0x2f')](_0x238e70[_0x19d0('0x2c')][_0x19d0('0x2f')]));_0x48d623[_0x19d0('0x2e')]=_0x48d623[_0x19d0('0x2e')]['length']?_0x48d623[_0x19d0('0x2e')]:_0x137273['model'];if(!_0x238e70[_0x19d0('0x2c')][_0x19d0('0x30')](_0x19d0('0x31'))){_0x48d623['limit']=qs[_0x19d0('0x1c')](_0x238e70[_0x19d0('0x2c')]['limit']);_0x48d623[_0x19d0('0x1b')]=qs['offset'](_0x238e70['query'][_0x19d0('0x1b')]);}_0x48d623['order']=qs[_0x19d0('0x32')](_0x238e70[_0x19d0('0x2c')]['sort']);_0x48d623['where']=qs['filters'](_['pick'](_0x238e70[_0x19d0('0x2c')],_0x137273[_0x19d0('0x33')]),_0x732b05);if(_0x238e70['query'][_0x19d0('0x34')]){_0x48d623[_0x19d0('0x35')]=_[_0x19d0('0x36')](_0x48d623['where'],{'$or':_[_0x19d0('0x37')](_0x48d623[_0x19d0('0x2e')],function(_0x244ad8){var _0x4251e0={};_0x4251e0[_0x244ad8]={'$like':'%'+_0x238e70[_0x19d0('0x2c')][_0x19d0('0x34')]+'%'};return _0x4251e0;})});}_0x48d623=_[_0x19d0('0x36')]({},_0x48d623,_0x238e70[_0x19d0('0x38')]);var _0x4290c3={'where':_0x48d623['where']};return db['CmCompany'][_0x19d0('0x1a')](_0x4290c3)['then'](function(_0xb89562){_0x52bed1[_0x19d0('0x1a')]=_0xb89562;if(_0x238e70['query'][_0x19d0('0x39')]){_0x48d623[_0x19d0('0x3a')]=[{'all':!![]}];}return db['CmCompany'][_0x19d0('0x3b')](_0x48d623);})['then'](function(_0x31c405){_0x52bed1[_0x19d0('0x3c')]=_0x31c405;return _0x52bed1;})[_0x19d0('0x21')](respondWithFilteredResult(_0xaa3acb,_0x48d623))[_0x19d0('0x3d')](handleError(_0xaa3acb,null));})[_0x19d0('0x3d')](handleError(_0xaa3acb,null));};exports['show']=function(_0x28d38f,_0x441acf){var _0x26a40b={'raw':![],'where':{'id':_0x28d38f['params']['id']}},_0x4f9fe4={};_0x4f9fe4[_0x19d0('0x2a')]=_['keys'](db[_0x19d0('0x3e')][_0x19d0('0x3f')]);_0x4f9fe4[_0x19d0('0x2c')]=_['keys'](_0x28d38f[_0x19d0('0x2c')]);_0x4f9fe4['filters']=_[_0x19d0('0x2d')](_0x4f9fe4[_0x19d0('0x2a')],_0x4f9fe4[_0x19d0('0x2c')]);_0x26a40b[_0x19d0('0x2e')]=_['intersection'](_0x4f9fe4[_0x19d0('0x2a')],qs['fields'](_0x28d38f[_0x19d0('0x2c')]['fields']));_0x26a40b[_0x19d0('0x2e')]=_0x26a40b[_0x19d0('0x2e')][_0x19d0('0x40')]?_0x26a40b[_0x19d0('0x2e')]:_0x4f9fe4[_0x19d0('0x2a')];if(_0x28d38f['query'][_0x19d0('0x39')]){_0x26a40b[_0x19d0('0x3a')]=[{'all':!![]}];}_0x26a40b=_['merge']({},_0x26a40b,_0x28d38f[_0x19d0('0x38')]);return db['CmCompany'][_0x19d0('0x41')](_0x26a40b)[_0x19d0('0x21')](handleEntityNotFound(_0x441acf,null))[_0x19d0('0x21')](respondWithResult(_0x441acf,null))[_0x19d0('0x3d')](handleError(_0x441acf,null));};exports[_0x19d0('0x42')]=function(_0x57131b,_0xadb10e){return db[_0x19d0('0x3e')]['create'](_0x57131b[_0x19d0('0x43')],{})['then'](function(_0x36514b){var _0x532f6b=_0x57131b['user'][_0x19d0('0x44')]({'plain':!![]});if(!_0x532f6b)throw new Error(_0x19d0('0x45'));if(_0x532f6b['role']===_0x19d0('0x46')){var _0x2e124a=_0x36514b['get']({'plain':!![]});var _0xb0233a=_0x19d0('0x47');return db[_0x19d0('0x48')][_0x19d0('0x41')]({'where':{'name':_0xb0233a,'userProfileId':_0x532f6b[_0x19d0('0x49')]},'raw':!![]})[_0x19d0('0x21')](function(_0x3c1bc6){if(_0x3c1bc6&&_0x3c1bc6[_0x19d0('0x4a')]===0x0){return db[_0x19d0('0x23')]['create']({'name':_0x2e124a[_0x19d0('0x26')],'resourceId':_0x2e124a['id'],'type':_0x3c1bc6[_0x19d0('0x26')],'sectionId':_0x3c1bc6['id']},{})[_0x19d0('0x21')](function(){return _0x36514b;});}else{return _0x36514b;}})[_0x19d0('0x3d')](function(_0x58bd81){logger['error'](_0x19d0('0x4b'),_0x58bd81);throw _0x58bd81;});}return _0x36514b;})[_0x19d0('0x21')](respondWithResult(_0xadb10e,0xc9))['catch'](handleError(_0xadb10e,null));};exports['update']=function(_0x7b26f9,_0x45e364){if(_0x7b26f9[_0x19d0('0x43')]['id']){delete _0x7b26f9[_0x19d0('0x43')]['id'];}return db[_0x19d0('0x3e')][_0x19d0('0x41')]({'where':{'id':_0x7b26f9['params']['id']}})[_0x19d0('0x21')](handleEntityNotFound(_0x45e364,null))[_0x19d0('0x21')](saveUpdates(_0x7b26f9[_0x19d0('0x43')],null))[_0x19d0('0x21')](respondWithResult(_0x45e364,null))['catch'](handleError(_0x45e364,null));};exports['destroy']=function(_0x5274e8,_0x154901){return db['CmCompany'][_0x19d0('0x41')]({'where':{'id':_0x5274e8[_0x19d0('0x4c')]['id']}})[_0x19d0('0x21')](handleEntityNotFound(_0x154901,null))[_0x19d0('0x21')](removeEntity(_0x154901,null))[_0x19d0('0x3d')](handleError(_0x154901,null));};exports[_0x19d0('0x29')]=function(_0x2e0a3b,_0x48405a){return db[_0x19d0('0x3e')][_0x19d0('0x29')]()[_0x19d0('0x21')](respondWithResult(_0x48405a,null))['catch'](handleError(_0x48405a,null));};exports['addContacts']=function(_0x252dc9,_0x4ccbbe,_0x1c8dde){return db['CmContact'][_0x19d0('0x41')]({'where':{'id':_0x252dc9[_0x19d0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4ccbbe,null))[_0x19d0('0x21')](function(_0x3829dd){if(_0x3829dd){return _0x3829dd[_0x19d0('0x4d')](_0x252dc9['body'][_0x19d0('0x4e')],_[_0x19d0('0x4f')](_0x252dc9['body'],[_0x19d0('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x4ccbbe,null))[_0x19d0('0x3d')](handleError(_0x4ccbbe,null));};exports[_0x19d0('0x50')]=function(_0x1bedd6,_0x31c174,_0x1ad804){var _0x107305={};var _0x39ad20={};var _0x383881;var _0x3c875c;return db['CmCompany'][_0x19d0('0x51')]({'where':{'id':_0x1bedd6['params']['id']}})[_0x19d0('0x21')](handleEntityNotFound(_0x31c174,null))['then'](function(_0xac0d57){if(_0xac0d57){_0x383881=_0xac0d57;_0x39ad20[_0x19d0('0x2a')]=_[_0x19d0('0x2b')](db[_0x19d0('0x52')][_0x19d0('0x3f')]);_0x39ad20[_0x19d0('0x2c')]=_[_0x19d0('0x2b')](_0x1bedd6[_0x19d0('0x2c')]);_0x39ad20[_0x19d0('0x33')]=_[_0x19d0('0x2d')](_0x39ad20[_0x19d0('0x2a')],_0x39ad20['query']);_0x107305[_0x19d0('0x2e')]=_[_0x19d0('0x2d')](_0x39ad20['model'],qs[_0x19d0('0x2f')](_0x1bedd6[_0x19d0('0x2c')][_0x19d0('0x2f')]));_0x107305[_0x19d0('0x2e')]=_0x107305[_0x19d0('0x2e')][_0x19d0('0x40')]?_0x107305[_0x19d0('0x2e')]:_0x39ad20[_0x19d0('0x2a')];_0x107305[_0x19d0('0x53')]=qs[_0x19d0('0x32')](_0x1bedd6[_0x19d0('0x2c')][_0x19d0('0x32')]);_0x107305[_0x19d0('0x35')]=qs[_0x19d0('0x33')](_['pick'](_0x1bedd6['query'],_0x39ad20[_0x19d0('0x33')]));if(_0x1bedd6[_0x19d0('0x2c')][_0x19d0('0x34')]){_0x107305[_0x19d0('0x35')]=_['merge'](_0x107305[_0x19d0('0x35')],{'$or':_['map'](_0x107305[_0x19d0('0x2e')],function(_0x1ec2f5){var _0x43023d={};_0x43023d[_0x1ec2f5]={'$like':'%'+_0x1bedd6[_0x19d0('0x2c')][_0x19d0('0x34')]+'%'};return _0x43023d;})});}_0x107305=_[_0x19d0('0x36')]({},_0x107305,_0x1bedd6[_0x19d0('0x38')]);return _0x383881[_0x19d0('0x50')](_0x107305);}})[_0x19d0('0x21')](function(_0x11c194){if(_0x11c194){_0x3c875c=_0x11c194[_0x19d0('0x40')];if(!_0x1bedd6[_0x19d0('0x2c')][_0x19d0('0x30')](_0x19d0('0x31'))){_0x107305[_0x19d0('0x1c')]=qs[_0x19d0('0x1c')](_0x1bedd6[_0x19d0('0x2c')]['limit']);_0x107305[_0x19d0('0x1b')]=qs[_0x19d0('0x1b')](_0x1bedd6['query'][_0x19d0('0x1b')]);}return _0x383881[_0x19d0('0x50')](_0x107305);}})[_0x19d0('0x21')](function(_0x1feff5){if(_0x1feff5){return _0x1feff5?{'count':_0x3c875c,'rows':_0x1feff5}:null;}})[_0x19d0('0x21')](respondWithResult(_0x31c174,null))[_0x19d0('0x3d')](handleError(_0x31c174,null));}; \ No newline at end of file +var _0x2a9f=['sendStatus','status','end','count','apply','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','CmCompany','describe','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filters','filter','where','merge','include','findAll','catch','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','omit','ids','findOne','rawAttributes','getContacts','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x504609,_0x2dc5ae){var _0x1fc031=function(_0x454931){while(--_0x454931){_0x504609['push'](_0x504609['shift']());}};_0x1fc031(++_0x2dc5ae);}(_0x2a9f,0x88));var _0xf2a9=function(_0x1e126c,_0x4fad10){_0x1e126c=_0x1e126c-0x0;var _0x57c52c=_0x2a9f[_0x1e126c];return _0x57c52c;};'use strict';var pdf=require(_0xf2a9('0x0'));var emlformat=require(_0xf2a9('0x1'));var rimraf=require(_0xf2a9('0x2'));var zipdir=require(_0xf2a9('0x3'));var jsonpatch=require(_0xf2a9('0x4'));var rp=require(_0xf2a9('0x5'));var moment=require(_0xf2a9('0x6'));var BPromise=require(_0xf2a9('0x7'));var Mustache=require(_0xf2a9('0x8'));var util=require(_0xf2a9('0x9'));var path=require('path');var sox=require(_0xf2a9('0xa'));var csv=require(_0xf2a9('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf2a9('0xc'));var squel=require('squel');var crypto=require(_0xf2a9('0xd'));var jsforce=require(_0xf2a9('0xe'));var deskjs=require(_0xf2a9('0xf'));var toCsv=require(_0xf2a9('0xb'));var querystring=require(_0xf2a9('0x10'));var Papa=require(_0xf2a9('0x11'));var Redis=require(_0xf2a9('0x12'));var authService=require(_0xf2a9('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2a9('0x14'));var logger=require(_0xf2a9('0x15'))(_0xf2a9('0x16'));var utils=require(_0xf2a9('0x17'));var config=require(_0xf2a9('0x18'));var licenseUtil=require(_0xf2a9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a7a34,_0x1fb2de){_0x1fb2de=_0x1fb2de||0xcc;return function(_0x35e6ee){if(_0x35e6ee){return _0x1a7a34[_0xf2a9('0x1a')](_0x1fb2de);}return _0x1a7a34[_0xf2a9('0x1b')](_0x1fb2de)[_0xf2a9('0x1c')]();};}function respondWithResult(_0x3eb5ad,_0x16ddd0){_0x16ddd0=_0x16ddd0||0xc8;return function(_0x1f1ffe){if(_0x1f1ffe){return _0x3eb5ad[_0xf2a9('0x1b')](_0x16ddd0)['json'](_0x1f1ffe);}};}function respondWithFilteredResult(_0x3d9a7e,_0x1132a4){return function(_0x1a5429){if(_0x1a5429){var _0x47a391=_0x1a5429[_0xf2a9('0x1d')],_0x2063d7=_0x1132a4['offset'],_0xa1f40a=_0x1132a4['offset']+_0x1132a4['limit'],_0x1a9d81;if(_0xa1f40a>=_0x47a391){_0xa1f40a=_0x47a391;_0x1a9d81=0xc8;}else{_0x1a9d81=0xce;}_0x3d9a7e[_0xf2a9('0x1b')](_0x1a9d81);return _0x3d9a7e['set']('Content-Range',_0x2063d7+'-'+_0xa1f40a+'/'+_0x47a391)['json'](_0x1a5429);}return null;};}function patchUpdates(_0x20f062){return function(_0x4d55d4){try{jsonpatch[_0xf2a9('0x1e')](_0x4d55d4,_0x20f062,!![]);}catch(_0x5c2c62){return BPromise['reject'](_0x5c2c62);}return _0x4d55d4['save']();};}function saveUpdates(_0x1574aa,_0x589ea3){return function(_0x143f00){if(_0x143f00){return _0x143f00[_0xf2a9('0x1f')](_0x1574aa)[_0xf2a9('0x20')](function(_0x4a7572){return _0x4a7572;});}return null;};}function removeEntity(_0x810c51,_0x2846fe){return function(_0x28250d){if(_0x28250d){return _0x28250d[_0xf2a9('0x21')]()['then'](function(){var _0xfd1df6=_0x28250d[_0xf2a9('0x22')]({'plain':!![]});var _0xbc422e=_0xf2a9('0x23');return db[_0xf2a9('0x24')][_0xf2a9('0x21')]({'where':{'type':_0xbc422e,'resourceId':_0xfd1df6['id']}})[_0xf2a9('0x20')](function(){return _0x28250d;});})[_0xf2a9('0x20')](function(){_0x810c51['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcd9525,_0x721bc3){return function(_0x34face){if(!_0x34face){_0xcd9525[_0xf2a9('0x1a')](0x194);}return _0x34face;};}function handleError(_0x5ed562,_0x1918a6){_0x1918a6=_0x1918a6||0x1f4;return function(_0x2e905c){logger[_0xf2a9('0x25')](_0x2e905c[_0xf2a9('0x26')]);if(_0x2e905c['name']){delete _0x2e905c[_0xf2a9('0x27')];}_0x5ed562['status'](_0x1918a6)[_0xf2a9('0x28')](_0x2e905c);};}exports['index']=function(_0x94961d,_0x574217){var _0x1da65d={},_0x20c1ff={},_0x44620a={'count':0x0,'rows':[]};return db[_0xf2a9('0x29')][_0xf2a9('0x2a')]()[_0xf2a9('0x20')](function(_0x2e35bb){_0x20c1ff['model']=_[_0xf2a9('0x2b')](_0x2e35bb);_0x20c1ff[_0xf2a9('0x2c')]=_['keys'](_0x94961d[_0xf2a9('0x2c')]);_0x20c1ff['filters']=_[_0xf2a9('0x2d')](_0x20c1ff['model'],_0x20c1ff[_0xf2a9('0x2c')]);_0x1da65d[_0xf2a9('0x2e')]=_[_0xf2a9('0x2d')](_0x20c1ff[_0xf2a9('0x2f')],qs[_0xf2a9('0x30')](_0x94961d[_0xf2a9('0x2c')][_0xf2a9('0x30')]));_0x1da65d[_0xf2a9('0x2e')]=_0x1da65d['attributes'][_0xf2a9('0x31')]?_0x1da65d[_0xf2a9('0x2e')]:_0x20c1ff[_0xf2a9('0x2f')];if(!_0x94961d[_0xf2a9('0x2c')][_0xf2a9('0x32')](_0xf2a9('0x33'))){_0x1da65d[_0xf2a9('0x34')]=qs[_0xf2a9('0x34')](_0x94961d['query'][_0xf2a9('0x34')]);_0x1da65d[_0xf2a9('0x35')]=qs[_0xf2a9('0x35')](_0x94961d[_0xf2a9('0x2c')]['offset']);}_0x1da65d[_0xf2a9('0x36')]=qs[_0xf2a9('0x37')](_0x94961d[_0xf2a9('0x2c')][_0xf2a9('0x37')]);_0x1da65d['where']=qs['filters'](_[_0xf2a9('0x38')](_0x94961d[_0xf2a9('0x2c')],_0x20c1ff[_0xf2a9('0x39')]),_0x2e35bb);if(_0x94961d[_0xf2a9('0x2c')][_0xf2a9('0x3a')]){_0x1da65d[_0xf2a9('0x3b')]=_[_0xf2a9('0x3c')](_0x1da65d[_0xf2a9('0x3b')],{'$or':_['map'](_0x1da65d[_0xf2a9('0x2e')],function(_0x5d7395){var _0x1e7697={};_0x1e7697[_0x5d7395]={'$like':'%'+_0x94961d[_0xf2a9('0x2c')][_0xf2a9('0x3a')]+'%'};return _0x1e7697;})});}_0x1da65d=_[_0xf2a9('0x3c')]({},_0x1da65d,_0x94961d['options']);var _0xec8271={'where':_0x1da65d[_0xf2a9('0x3b')]};return db[_0xf2a9('0x29')][_0xf2a9('0x1d')](_0xec8271)[_0xf2a9('0x20')](function(_0x46c508){_0x44620a[_0xf2a9('0x1d')]=_0x46c508;if(_0x94961d['query']['includeAll']){_0x1da65d[_0xf2a9('0x3d')]=[{'all':!![]}];}return db[_0xf2a9('0x29')][_0xf2a9('0x3e')](_0x1da65d);})[_0xf2a9('0x20')](function(_0x569055){_0x44620a['rows']=_0x569055;return _0x44620a;})[_0xf2a9('0x20')](respondWithFilteredResult(_0x574217,_0x1da65d))[_0xf2a9('0x3f')](handleError(_0x574217,null));})['catch'](handleError(_0x574217,null));};exports['show']=function(_0x1206b1,_0x591e6c){var _0x37a16e={'raw':![],'where':{'id':_0x1206b1[_0xf2a9('0x40')]['id']}},_0x2a7d45={};_0x2a7d45['model']=_['keys'](db[_0xf2a9('0x29')]['rawAttributes']);_0x2a7d45['query']=_['keys'](_0x1206b1[_0xf2a9('0x2c')]);_0x2a7d45[_0xf2a9('0x39')]=_[_0xf2a9('0x2d')](_0x2a7d45[_0xf2a9('0x2f')],_0x2a7d45[_0xf2a9('0x2c')]);_0x37a16e[_0xf2a9('0x2e')]=_[_0xf2a9('0x2d')](_0x2a7d45[_0xf2a9('0x2f')],qs[_0xf2a9('0x30')](_0x1206b1['query'][_0xf2a9('0x30')]));_0x37a16e['attributes']=_0x37a16e[_0xf2a9('0x2e')][_0xf2a9('0x31')]?_0x37a16e[_0xf2a9('0x2e')]:_0x2a7d45[_0xf2a9('0x2f')];if(_0x1206b1[_0xf2a9('0x2c')]['includeAll']){_0x37a16e['include']=[{'all':!![]}];}_0x37a16e=_['merge']({},_0x37a16e,_0x1206b1[_0xf2a9('0x41')]);return db[_0xf2a9('0x29')][_0xf2a9('0x42')](_0x37a16e)['then'](handleEntityNotFound(_0x591e6c,null))[_0xf2a9('0x20')](respondWithResult(_0x591e6c,null))[_0xf2a9('0x3f')](handleError(_0x591e6c,null));};exports[_0xf2a9('0x43')]=function(_0x4f1bd9,_0x29dc60){return db[_0xf2a9('0x29')][_0xf2a9('0x43')](_0x4f1bd9['body'],{})['then'](function(_0x707272){var _0x426776=_0x4f1bd9[_0xf2a9('0x44')][_0xf2a9('0x22')]({'plain':!![]});if(!_0x426776)throw new Error(_0xf2a9('0x45'));if(_0x426776['role']==='user'){var _0x54688b=_0x707272[_0xf2a9('0x22')]({'plain':!![]});var _0x2552dd=_0xf2a9('0x23');return db[_0xf2a9('0x46')]['find']({'where':{'name':_0x2552dd,'userProfileId':_0x426776[_0xf2a9('0x47')]},'raw':!![]})[_0xf2a9('0x20')](function(_0x5ac233){if(_0x5ac233&&_0x5ac233['autoAssociation']===0x0){return db['UserProfileResource'][_0xf2a9('0x43')]({'name':_0x54688b['name'],'resourceId':_0x54688b['id'],'type':_0x5ac233[_0xf2a9('0x27')],'sectionId':_0x5ac233['id']},{})[_0xf2a9('0x20')](function(){return _0x707272;});}else{return _0x707272;}})[_0xf2a9('0x3f')](function(_0x40ee2b){logger[_0xf2a9('0x25')](_0xf2a9('0x48'),_0x40ee2b);throw _0x40ee2b;});}return _0x707272;})[_0xf2a9('0x20')](respondWithResult(_0x29dc60,0xc9))['catch'](handleError(_0x29dc60,null));};exports[_0xf2a9('0x1f')]=function(_0x1712fa,_0x593f63){if(_0x1712fa[_0xf2a9('0x49')]['id']){delete _0x1712fa[_0xf2a9('0x49')]['id'];}return db[_0xf2a9('0x29')][_0xf2a9('0x42')]({'where':{'id':_0x1712fa[_0xf2a9('0x40')]['id']}})[_0xf2a9('0x20')](handleEntityNotFound(_0x593f63,null))[_0xf2a9('0x20')](saveUpdates(_0x1712fa[_0xf2a9('0x49')],null))[_0xf2a9('0x20')](respondWithResult(_0x593f63,null))['catch'](handleError(_0x593f63,null));};exports[_0xf2a9('0x21')]=function(_0x1e9cd2,_0xa58f85){return db[_0xf2a9('0x29')][_0xf2a9('0x42')]({'where':{'id':_0x1e9cd2[_0xf2a9('0x40')]['id']}})[_0xf2a9('0x20')](handleEntityNotFound(_0xa58f85,null))['then'](removeEntity(_0xa58f85,null))['catch'](handleError(_0xa58f85,null));};exports[_0xf2a9('0x2a')]=function(_0x54df0e,_0xaf896d){return db[_0xf2a9('0x29')][_0xf2a9('0x2a')]()['then'](respondWithResult(_0xaf896d,null))[_0xf2a9('0x3f')](handleError(_0xaf896d,null));};exports[_0xf2a9('0x4a')]=function(_0x42a720,_0x3ee6ca,_0x2e01e7){return db[_0xf2a9('0x4b')][_0xf2a9('0x42')]({'where':{'id':_0x42a720[_0xf2a9('0x40')]['id']}})[_0xf2a9('0x20')](handleEntityNotFound(_0x3ee6ca,null))[_0xf2a9('0x20')](function(_0x3cab4f){if(_0x3cab4f){return _0x3cab4f[_0xf2a9('0x4a')](_0x42a720[_0xf2a9('0x49')]['ids'],_[_0xf2a9('0x4c')](_0x42a720[_0xf2a9('0x49')],[_0xf2a9('0x4d'),'id'])||{});}})[_0xf2a9('0x20')](respondWithResult(_0x3ee6ca,null))[_0xf2a9('0x3f')](handleError(_0x3ee6ca,null));};exports['getContacts']=function(_0x13ded6,_0x4be739,_0x414234){var _0x166603={};var _0x2afb66={};var _0x70a030;var _0x2fcf51;return db[_0xf2a9('0x29')][_0xf2a9('0x4e')]({'where':{'id':_0x13ded6['params']['id']}})[_0xf2a9('0x20')](handleEntityNotFound(_0x4be739,null))[_0xf2a9('0x20')](function(_0xee3c5){if(_0xee3c5){_0x70a030=_0xee3c5;_0x2afb66['model']=_[_0xf2a9('0x2b')](db[_0xf2a9('0x4b')][_0xf2a9('0x4f')]);_0x2afb66[_0xf2a9('0x2c')]=_[_0xf2a9('0x2b')](_0x13ded6[_0xf2a9('0x2c')]);_0x2afb66[_0xf2a9('0x39')]=_[_0xf2a9('0x2d')](_0x2afb66[_0xf2a9('0x2f')],_0x2afb66['query']);_0x166603[_0xf2a9('0x2e')]=_[_0xf2a9('0x2d')](_0x2afb66[_0xf2a9('0x2f')],qs['fields'](_0x13ded6[_0xf2a9('0x2c')][_0xf2a9('0x30')]));_0x166603[_0xf2a9('0x2e')]=_0x166603[_0xf2a9('0x2e')]['length']?_0x166603[_0xf2a9('0x2e')]:_0x2afb66['model'];_0x166603[_0xf2a9('0x36')]=qs['sort'](_0x13ded6[_0xf2a9('0x2c')]['sort']);_0x166603['where']=qs[_0xf2a9('0x39')](_['pick'](_0x13ded6[_0xf2a9('0x2c')],_0x2afb66[_0xf2a9('0x39')]));if(_0x13ded6['query'][_0xf2a9('0x3a')]){_0x166603[_0xf2a9('0x3b')]=_[_0xf2a9('0x3c')](_0x166603['where'],{'$or':_['map'](_0x166603[_0xf2a9('0x2e')],function(_0x54c923){var _0x40830e={};_0x40830e[_0x54c923]={'$like':'%'+_0x13ded6[_0xf2a9('0x2c')]['filter']+'%'};return _0x40830e;})});}_0x166603=_[_0xf2a9('0x3c')]({},_0x166603,_0x13ded6[_0xf2a9('0x41')]);return _0x70a030[_0xf2a9('0x50')](_0x166603);}})['then'](function(_0x2c035d){if(_0x2c035d){_0x2fcf51=_0x2c035d[_0xf2a9('0x31')];if(!_0x13ded6[_0xf2a9('0x2c')][_0xf2a9('0x32')](_0xf2a9('0x33'))){_0x166603[_0xf2a9('0x34')]=qs[_0xf2a9('0x34')](_0x13ded6[_0xf2a9('0x2c')][_0xf2a9('0x34')]);_0x166603[_0xf2a9('0x35')]=qs['offset'](_0x13ded6['query']['offset']);}return _0x70a030[_0xf2a9('0x50')](_0x166603);}})[_0xf2a9('0x20')](function(_0x4256b8){if(_0x4256b8){return _0x4256b8?{'count':_0x2fcf51,'rows':_0x4256b8}:null;}})['then'](respondWithResult(_0x4be739,null))[_0xf2a9('0x3f')](handleError(_0x4be739,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 596eb69..1cfb595 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 _0xd13e=['bluebird','path','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','../../config/logger','api'];(function(_0x2e112f,_0x11d82f){var _0x4928be=function(_0x21738b){while(--_0x21738b){_0x2e112f['push'](_0x2e112f['shift']());}};_0x4928be(++_0x11d82f);}(_0xd13e,0x193));var _0xed13=function(_0x41437f,_0x1d126f){_0x41437f=_0x41437f-0x0;var _0x1e35ab=_0xd13e[_0x41437f];return _0x1e35ab;};'use strict';var _=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var logger=require(_0xed13('0x2'))(_0xed13('0x3'));var moment=require('moment');var BPromise=require(_0xed13('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed13('0x5'));var rimraf=require('rimraf');var config=require(_0xed13('0x6'));var attributes=require(_0xed13('0x7'));module['exports']=function(_0x50de44,_0x5142bd){return _0x50de44[_0xed13('0x8')](_0xed13('0x9'),attributes,{'tableName':_0xed13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecd5=['CmCompany','cm_companies','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmCompany.attributes'];(function(_0x27463f,_0x2ab942){var _0x1b7005=function(_0x16b0f4){while(--_0x16b0f4){_0x27463f['push'](_0x27463f['shift']());}};_0x1b7005(++_0x2ab942);}(_0xecd5,0x110));var _0x5ecd=function(_0x501559,_0x588127){_0x501559=_0x501559-0x0;var _0x428597=_0xecd5[_0x501559];return _0x428597;};'use strict';var _=require('lodash');var util=require(_0x5ecd('0x0'));var logger=require(_0x5ecd('0x1'))(_0x5ecd('0x2'));var moment=require('moment');var BPromise=require(_0x5ecd('0x3'));var rp=require(_0x5ecd('0x4'));var fs=require('fs');var path=require(_0x5ecd('0x5'));var rimraf=require(_0x5ecd('0x6'));var config=require('../../config/environment');var attributes=require(_0x5ecd('0x7'));module['exports']=function(_0x1ddbad,_0x492eba){return _0x1ddbad['define'](_0x5ecd('0x8'),attributes,{'tableName':_0x5ecd('0x9'),'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 f431a89..f7051b7 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 _0x7b14=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x7b14,0x112));var _0x47b1=function(_0x2007b4,_0x384151){_0x2007b4=_0x2007b4-0x0;var _0x2067cd=_0x7b14[_0x2007b4];return _0x2067cd;};'use strict';var _=require(_0x47b1('0x0'));var util=require(_0x47b1('0x1'));var moment=require(_0x47b1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47b1('0x3'));var db=require(_0x47b1('0x4'))['db'];var utils=require(_0x47b1('0x5'));var logger=require(_0x47b1('0x6'))(_0x47b1('0x7'));var config=require(_0x47b1('0x8'));var jayson=require(_0x47b1('0x9'));var client=jayson[_0x47b1('0xa')][_0x47b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x468a96,_0x1e672c,_0x599848){return new BPromise(function(_0x49a6cb,_0x59fe1a){return client[_0x47b1('0xc')](_0x468a96,_0x599848)[_0x47b1('0xd')](function(_0x38fac7){logger[_0x47b1('0xe')](_0x47b1('0xf'),_0x1e672c,'request\x20sent');logger[_0x47b1('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1e672c,_0x47b1('0x11'),JSON[_0x47b1('0x12')](_0x38fac7));if(_0x38fac7[_0x47b1('0x13')]){if(_0x38fac7[_0x47b1('0x13')][_0x47b1('0x14')]===0x1f4){logger['error'](_0x47b1('0xf'),_0x1e672c,_0x38fac7['error'][_0x47b1('0x15')]);return _0x59fe1a(_0x38fac7[_0x47b1('0x13')][_0x47b1('0x15')]);}logger[_0x47b1('0x13')](_0x47b1('0xf'),_0x1e672c,_0x38fac7['error'][_0x47b1('0x15')]);return _0x49a6cb(_0x38fac7[_0x47b1('0x13')][_0x47b1('0x15')]);}else{logger[_0x47b1('0xe')](_0x47b1('0xf'),_0x1e672c,_0x47b1('0x11'));_0x49a6cb(_0x38fac7[_0x47b1('0x16')]['message']);}})['catch'](function(_0x4ae160){logger['error'](_0x47b1('0xf'),_0x1e672c,_0x4ae160);_0x59fe1a(_0x4ae160);});});} \ No newline at end of file +var _0x2205=['debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x2205,0x15b));var _0x5220=function(_0x228f94,_0x2bc5d4){_0x228f94=_0x228f94-0x0;var _0x2f724a=_0x2205[_0x228f94];return _0x2f724a;};'use strict';var _=require('lodash');var util=require(_0x5220('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5220('0x1'));var fs=require('fs');var Redis=require(_0x5220('0x2'));var db=require(_0x5220('0x3'))['db'];var utils=require(_0x5220('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5220('0x5'));var jayson=require(_0x5220('0x6'));var client=jayson[_0x5220('0x7')][_0x5220('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x508567,_0x1f5906,_0x4806f0){return new BPromise(function(_0x35b8bb,_0x1d5041){return client['request'](_0x508567,_0x4806f0)[_0x5220('0x9')](function(_0x3ff407){logger[_0x5220('0xa')](_0x5220('0xb'),_0x1f5906,_0x5220('0xc'));logger[_0x5220('0xd')](_0x5220('0xe'),_0x1f5906,_0x5220('0xc'),JSON[_0x5220('0xf')](_0x3ff407));if(_0x3ff407['error']){if(_0x3ff407[_0x5220('0x10')]['code']===0x1f4){logger[_0x5220('0x10')](_0x5220('0xb'),_0x1f5906,_0x3ff407['error'][_0x5220('0x11')]);return _0x1d5041(_0x3ff407[_0x5220('0x10')][_0x5220('0x11')]);}logger[_0x5220('0x10')](_0x5220('0xb'),_0x1f5906,_0x3ff407[_0x5220('0x10')]['message']);return _0x35b8bb(_0x3ff407[_0x5220('0x10')][_0x5220('0x11')]);}else{logger['info'](_0x5220('0xb'),_0x1f5906,_0x5220('0xc'));_0x35b8bb(_0x3ff407['result']['message']);}})['catch'](function(_0x5463cc){logger['error']('CmCompany,\x20%s,\x20%s',_0x1f5906,_0x5463cc);_0x1d5041(_0x5463cc);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index f381986..5ddae48 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 _0xa30a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','post','addContacts','update','destroy','exports','multer','util','path','express','Router'];(function(_0x34105f,_0x3f464b){var _0xd6d36e=function(_0x1c82ef){while(--_0x1c82ef){_0x34105f['push'](_0x34105f['shift']());}};_0xd6d36e(++_0x3f464b);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var path=require(_0xaa30('0x2'));var timeout=require('connect-timeout');var express=require(_0xaa30('0x3'));var router=express[_0xaa30('0x4')]();var auth=require(_0xaa30('0x5'));var interaction=require(_0xaa30('0x6'));var config=require(_0xaa30('0x7'));var controller=require(_0xaa30('0x8'));router[_0xaa30('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa30('0xa')]);router['get'](_0xaa30('0xb'),auth[_0xaa30('0xc')](),controller[_0xaa30('0xd')]);router['get'](_0xaa30('0xe'),auth[_0xaa30('0xc')](),controller[_0xaa30('0xf')]);router[_0xaa30('0x9')](_0xaa30('0x10'),auth[_0xaa30('0xc')](),controller['getContacts']);router['post']('/',auth[_0xaa30('0xc')](),controller['create']);router[_0xaa30('0x11')](_0xaa30('0x10'),auth[_0xaa30('0xc')](),controller[_0xaa30('0x12')]);router['put'](_0xaa30('0xe'),auth[_0xaa30('0xc')](),controller[_0xaa30('0x13')]);router['delete'](_0xaa30('0xe'),auth[_0xaa30('0xc')](),controller[_0xaa30('0x14')]);module[_0xaa30('0x15')]=router; \ No newline at end of file +var _0x7a54=['Router','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','describe','/:id','/:id/contacts','post','addContacts','put','delete','destroy','exports','multer','util','path','express'];(function(_0x5f275b,_0x3752a3){var _0x3aeebc=function(_0x475b5e){while(--_0x475b5e){_0x5f275b['push'](_0x5f275b['shift']());}};_0x3aeebc(++_0x3752a3);}(_0x7a54,0x106));var _0x47a5=function(_0x205a01,_0x3d3753){_0x205a01=_0x205a01-0x0;var _0x152676=_0x7a54[_0x205a01];return _0x152676;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x47a5('0xc'),auth[_0x47a5('0x9')](),controller['getContacts']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x47a5('0xd')](_0x47a5('0xc'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);router[_0x47a5('0xf')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller['update']);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 74aa520..d2f9117 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 _0x25fa=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash','sequelize'];(function(_0x3e8426,_0x49a842){var _0x874e2e=function(_0x3b3699){while(--_0x3b3699){_0x3e8426['push'](_0x3e8426['shift']());}};_0x874e2e(++_0x49a842);}(_0x25fa,0x13e));var _0xa25f=function(_0x66a9c5,_0x8474b7){_0x66a9c5=_0x66a9c5-0x0;var _0x580d0e=_0x25fa[_0x66a9c5];return _0x580d0e;};'use strict';var _=require(_0xa25f('0x0'));var Sequelize=require(_0xa25f('0x1'));module[_0xa25f('0x2')]={'firstName':{'type':Sequelize[_0xa25f('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa25f('0x3')]},'postalCode':{'type':Sequelize[_0xa25f('0x3')]},'city':{'type':Sequelize[_0xa25f('0x3')]},'country':{'type':Sequelize[_0xa25f('0x3')]},'dateOfBirth':{'type':Sequelize[_0xa25f('0x3')]},'description':{'type':Sequelize[_0xa25f('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa25f('0x3')]},'email':{'type':Sequelize[_0xa25f('0x3')]},'url':{'type':Sequelize[_0xa25f('0x3')]},'facebook':{'type':Sequelize[_0xa25f('0x3')]},'fb_data':{'type':Sequelize[_0xa25f('0x3')]},'twitter':{'type':Sequelize[_0xa25f('0x3')]},'skype':{'type':Sequelize[_0xa25f('0x3')]},'teams':{'type':Sequelize[_0xa25f('0x3')]},'viber':{'type':Sequelize[_0xa25f('0x3')]},'line':{'type':Sequelize[_0xa25f('0x3')]},'wechat':{'type':Sequelize[_0xa25f('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xa25f('0x5')]},'priority':{'type':Sequelize[_0xa25f('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa25f('0x6')],'defaultValue':Sequelize[_0xa25f('0x7')]}}; \ No newline at end of file +var _0xb2f0=['exports','STRING','TEXT','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x34684e,_0x296eca){var _0x314707=function(_0x3894fa){while(--_0x3894fa){_0x34684e['push'](_0x34684e['shift']());}};_0x314707(++_0x296eca);}(_0xb2f0,0x1a6));var _0x0b2f=function(_0x4b55a6,_0x5acf5d){_0x4b55a6=_0x4b55a6-0x0;var _0x40dcde=_0xb2f0[_0x4b55a6];return _0x40dcde;};'use strict';var _=require(_0x0b2f('0x0'));var Sequelize=require(_0x0b2f('0x1'));module[_0x0b2f('0x2')]={'firstName':{'type':Sequelize[_0x0b2f('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0b2f('0x3')]},'street':{'type':Sequelize[_0x0b2f('0x3')]},'postalCode':{'type':Sequelize[_0x0b2f('0x3')]},'city':{'type':Sequelize[_0x0b2f('0x3')]},'country':{'type':Sequelize[_0x0b2f('0x3')]},'dateOfBirth':{'type':Sequelize[_0x0b2f('0x3')]},'description':{'type':Sequelize[_0x0b2f('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x0b2f('0x3')]},'fax':{'type':Sequelize[_0x0b2f('0x3')]},'email':{'type':Sequelize[_0x0b2f('0x3')]},'url':{'type':Sequelize[_0x0b2f('0x3')]},'facebook':{'type':Sequelize[_0x0b2f('0x3')]},'fb_data':{'type':Sequelize[_0x0b2f('0x3')]},'twitter':{'type':Sequelize[_0x0b2f('0x3')]},'skype':{'type':Sequelize[_0x0b2f('0x3')]},'teams':{'type':Sequelize[_0x0b2f('0x3')]},'viber':{'type':Sequelize[_0x0b2f('0x3')]},'line':{'type':Sequelize[_0x0b2f('0x3')]},'wechat':{'type':Sequelize[_0x0b2f('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x0b2f('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0b2f('0x6')],'defaultValue':Sequelize[_0x0b2f('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 81a3f1a..09848e4 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 _0x1948=['userSecondDisposition','DESC','findAndCountAll','fullname','startCase','Website','Account','closed','closedAt','secondDisposition','thirdDisposition','UserId','Owner','browserName','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','substatus','threadId','Interaction','all','flatten','sortBy','reverse','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','count','offset','set','json','reject','save','update','then','name','send','index','describe','keys','startsWith','cf_','push','findOne','fieldType','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','limit','order','sort','pick','select','field','from','tools_tags','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','sqlOperator','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','uc.UserId\x20=\x20?','datetime','castTo','DATE','buildExpression','text','start','filter','isNil','Contact','isEmpty','ListId','where','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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?','group','c.id','SELECT','clone','having','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','merge','CmContact','c.lastName','c.phone','c.mobile','c.fax','c.email','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','destroy','columnName','displayName','CmCustomField','findAll','alias','body','get','mergeWith','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','catch','bulkCreate','each','duplicates','$or','findOrCreate','error','show','params','color','$and','omit','format','cf_%d','setFields','id\x20=\x20?','toParam','values','phone','getTags','rawAttributes','options','nolimit','setTags','getHoppers','ContactId','getHopperHistories','CmHopperHistory','includeAll','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','meta','import','binding','No\x20phone\x20column\x20specified','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','getJourney','mail','chat','fax','whatsapp','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','endtime','duration','note','createdAt','userDisposition'];(function(_0x2d64fc,_0x42b2a7){var _0x2c8556=function(_0x4b29da){while(--_0x4b29da){_0x2d64fc['push'](_0x2d64fc['shift']());}};_0x2c8556(++_0x42b2a7);}(_0x1948,0x145));var _0x8194=function(_0x1ef912,_0xe60aa9){_0x1ef912=_0x1ef912-0x0;var _0x4b7aff=_0x1948[_0x1ef912];return _0x4b7aff;};'use strict';var pdf=require(_0x8194('0x0'));var emlformat=require(_0x8194('0x1'));var rimraf=require(_0x8194('0x2'));var zipdir=require(_0x8194('0x3'));var jsonpatch=require(_0x8194('0x4'));var rp=require('request-promise');var moment=require(_0x8194('0x5'));var BPromise=require(_0x8194('0x6'));var Mustache=require(_0x8194('0x7'));var util=require(_0x8194('0x8'));var path=require(_0x8194('0x9'));var sox=require(_0x8194('0xa'));var csv=require(_0x8194('0xb'));var ejs=require(_0x8194('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8194('0xd'));var crypto=require(_0x8194('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8194('0xf'));var toCsv=require(_0x8194('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8194('0x10'));var authService=require(_0x8194('0x11'));var qs=require(_0x8194('0x12'));var as=require(_0x8194('0x13'));var hardwareService=require(_0x8194('0x14'));var logger=require('../../config/logger')(_0x8194('0x15'));var utils=require(_0x8194('0x16'));var config=require(_0x8194('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8194('0x18'))['db'];config[_0x8194('0x19')]=_[_0x8194('0x1a')](config[_0x8194('0x19')],{'host':_0x8194('0x1b'),'port':0x18eb});var socket=require(_0x8194('0x1c'))(new Redis(config['redis']));require(_0x8194('0x1d'))[_0x8194('0x1e')](socket);function respondWithStatusCode(_0xfd031c,_0x2ab425){_0x2ab425=_0x2ab425||0xcc;return function(_0x2d4463){if(_0x2d4463){return _0xfd031c[_0x8194('0x1f')](_0x2ab425);}return _0xfd031c[_0x8194('0x20')](_0x2ab425)[_0x8194('0x21')]();};}function respondWithResult(_0x19c23e,_0x5abd09){_0x5abd09=_0x5abd09||0xc8;return function(_0x49731d){if(_0x49731d){return _0x19c23e[_0x8194('0x20')](_0x5abd09)['json'](_0x49731d);}};}function respondWithFilteredResult(_0x41a11e,_0x4afbe3){return function(_0x55e4c2){if(_0x55e4c2){var _0x5f2172=_0x55e4c2[_0x8194('0x22')],_0x37b048=_0x4afbe3[_0x8194('0x23')],_0x43a192=_0x4afbe3[_0x8194('0x23')]+_0x4afbe3['limit'],_0x48421e;if(_0x43a192>=_0x5f2172){_0x43a192=_0x5f2172;_0x48421e=0xc8;}else{_0x48421e=0xce;}_0x41a11e['status'](_0x48421e);return _0x41a11e[_0x8194('0x24')]('Content-Range',_0x37b048+'-'+_0x43a192+'/'+_0x5f2172)[_0x8194('0x25')](_0x55e4c2);}return null;};}function patchUpdates(_0x24d1ff){return function(_0x9421f5){try{jsonpatch['apply'](_0x9421f5,_0x24d1ff,!![]);}catch(_0x3cdb81){return BPromise[_0x8194('0x26')](_0x3cdb81);}return _0x9421f5[_0x8194('0x27')]();};}function saveUpdates(_0x28df4f,_0x1babf1){return function(_0x17dcde){if(_0x17dcde){return _0x17dcde[_0x8194('0x28')](_0x28df4f)[_0x8194('0x29')](function(_0x269a22){return _0x269a22;});}return null;};}function removeEntity(_0x263093,_0xbb64b7){return function(_0x300491){if(_0x300491){return _0x300491['destroy']()[_0x8194('0x29')](function(){_0x263093[_0x8194('0x20')](0xcc)[_0x8194('0x21')]();});}};}function handleEntityNotFound(_0x46a242,_0x55b0d9){return function(_0x34c430){if(!_0x34c430){_0x46a242[_0x8194('0x1f')](0x194);}return _0x34c430;};}function handleError(_0x425a1d,_0x42c3b0){_0x42c3b0=_0x42c3b0||0x1f4;return function(_0x3e8cb3){logger['error'](_0x3e8cb3['stack']);if(_0x3e8cb3[_0x8194('0x2a')]){delete _0x3e8cb3[_0x8194('0x2a')];}_0x425a1d[_0x8194('0x20')](_0x42c3b0)[_0x8194('0x2b')](_0x3e8cb3);};}exports[_0x8194('0x2c')]=function(_0x56c512,_0x4af9cc){var _0x5624a0={},_0x1ea1f={},_0x56b5bc={'count':0x0,'rows':[]};return db['CmContact'][_0x8194('0x2d')]()[_0x8194('0x29')](function(_0x4ee84e){var _0x1ef19a=[];for(var _0x58f209=0x0;_0x58f2090x1){_0x4c0350['or'](_0x8194('0x6c'),qs['getFullTextValue'](_0xfaa533),null);}else{if(qs[_0x8194('0x6d')](_0xfaa533)){_0x4c0350['or'](_0x8194('0x6e'),_0xfaa533+'%');_0x4c0350['or'](_0x8194('0x6f'),_0xfaa533+'%');_0x4c0350['or'](_0x8194('0x70'),_0xfaa533+'%');_0x4c0350['or'](_0x8194('0x71'),_0xfaa533+'%');}else if(qs[_0x8194('0x72')](_0xfaa533)){_0x4c0350['or'](_0x8194('0x73'),_0xfaa533+'%');}else{_0x4c0350['or'](_0x8194('0x74'),'%'+_0xfaa533+'%');_0x4c0350['or'](_0x8194('0x75'),'%'+_0xfaa533+'%');_0x4c0350['or'](_0x8194('0x73'),'%'+_0xfaa533+'%');}}}}_0x369856[_0x8194('0x66')](_0x4c0350);_0x369856[_0x8194('0x76')](_0x8194('0x77'));var _0x545068={'type':db['Sequelize']['QueryTypes'][_0x8194('0x78')],'raw':!![]};var _0x42f541=_0x369856[_0x8194('0x79')]()['field'](_0x8194('0x77'));if(_0x5624a0[_0x8194('0x3e')]){_0x5624a0['order'][_0x8194('0x56')](function(_0x494f0f){_0x369856['order']('c.'+_0x494f0f[0x0],_0x494f0f[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x573003)){_0x369856[_0x8194('0x7a')](_0x1200c8);_0x42f541[_0x8194('0x66')](_0x8194('0x7b'),_0x573003);}BPromise[_0x8194('0x7c')]()['then'](function(){if(!_0x958766)return;if(_0x56c512[_0x8194('0x7d')][_0x8194('0x7e')]!==_0x8194('0x7f'))return;if(!_[_0x8194('0x80')](_0x958766[_0x8194('0x50')],[_0x8194('0x42'),_0x8194('0x59')])){return _0x56c512[_0x8194('0x7d')][_0x8194('0x81')]({'attributes':['id'],'raw':!![]})[_0x8194('0x29')](function(_0x4b4c70){if(_['isEmpty'](_0x4b4c70)){_0x42f541['where'](_0x8194('0x82'));_0x369856[_0x8194('0x66')]('c.ListId\x20IS\x20NULL');}else{_0x42f541[_0x8194('0x66')](_0x8194('0x83'),_['map'](_0x4b4c70,'id'));_0x369856['where'](_0x8194('0x83'),_[_0x8194('0x55')](_0x4b4c70,'id'));}});}})[_0x8194('0x29')](function(){if(_0x56c512[_0x8194('0x7d')][_0x8194('0x7e')]==='agent'&&!_0x958766&&!_0x56c512['query']['ListId'])return[];return db[_0x8194('0x84')][_0x8194('0x35')](_0x42f541[_0x8194('0x85')](),_0x545068);})['then'](function(_0x24b6f9){_0x56b5bc['count']=_0x24b6f9[_0x8194('0x3b')];if(_0x56b5bc[_0x8194('0x22')]===0x0)return[];return db[_0x8194('0x84')]['query'](_0x4aa53a[_0x8194('0x85')](),_0x545068)['then'](function(_0x5e0778){_0x2256d8=_['keyBy'](_0x5e0778,'id');_0x545068=_[_0x8194('0x86')](_0x545068,{'model':db[_0x8194('0x87')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x56c512[_0x8194('0x35')][_0x8194('0x3a')]){_0x5624a0['attributes'][_0x8194('0x56')](function(_0x5a3a29){_0x369856[_0x8194('0x42')]('c.'+_0x5a3a29);});}else{_0x369856[_0x8194('0x42')](_0x8194('0x77'));_0x369856['field']('c.firstName');_0x369856[_0x8194('0x42')](_0x8194('0x88'));_0x369856[_0x8194('0x42')](_0x8194('0x89'));_0x369856[_0x8194('0x42')](_0x8194('0x8a'));_0x369856[_0x8194('0x42')](_0x8194('0x8b'));_0x369856[_0x8194('0x42')](_0x8194('0x8c'));_0x369856[_0x8194('0x42')]('c.ListId');_0x369856['field']('c.createdAt');_0x369856[_0x8194('0x42')](_0x8194('0x8d'));_0x369856[_0x8194('0x42')]('c.CompanyId');_0x369856[_0x8194('0x42')](_0x8194('0x8e'),_0x8194('0x8f'));}if(_0x5624a0['limit'])_0x369856[_0x8194('0x3d')](_0x5624a0[_0x8194('0x3d')]);if(_0x5624a0[_0x8194('0x23')])_0x369856[_0x8194('0x23')](_0x5624a0[_0x8194('0x23')]);return db['sequelize'][_0x8194('0x35')](_0x369856[_0x8194('0x85')](),_0x545068);});})['then'](function(_0x3ee59e){_0x3ee59e['forEach'](function(_0x1a2062){if(_0x1a2062[_0x8194('0x8f')]){_0x1a2062[_0x8194('0x90')]=[];_0x1a2062[_0x8194('0x8f')][_0x8194('0x54')](',')[_0x8194('0x56')](function(_0x29aaa6){_0x1a2062[_0x8194('0x90')]['push'](_0x2256d8[_0x29aaa6]);});}delete _0x1a2062[_0x8194('0x8f')];});_0x56b5bc[_0x8194('0x91')]=_0x3ee59e;return _0x56b5bc;})['then'](respondWithFilteredResult(_0x4af9cc,_0x5624a0));})['catch'](handleError(_0x4af9cc,null));};exports[_0x8194('0x92')]=function(_0x1c92d8,_0x8b3c28){return db[_0x8194('0x87')][_0x8194('0x51')]({'where':{'id':_0x1c92d8['params']['id']}})[_0x8194('0x29')](handleEntityNotFound(_0x8b3c28,null))[_0x8194('0x29')](removeEntity(_0x8b3c28,null))['catch'](handleError(_0x8b3c28,null));};exports[_0x8194('0x2d')]=function(_0x5acb38,_0x345cd7){return db['CmContact'][_0x8194('0x2d')]()[_0x8194('0x29')](function(_0x286d9d){delete _0x286d9d['tags'];for(var _0x55a34d=0x0;_0x55a34d=_0x1bafdf){_0x3b4805=_0x1bafdf;_0x56d424=0xc8;}else{_0x56d424=0xce;}_0xafc423[_0x8b24('0x1f')](_0x56d424);return _0xafc423[_0x8b24('0x23')](_0x8b24('0x24'),_0x5e3c52+'-'+_0x3b4805+'/'+_0x1bafdf)[_0x8b24('0x25')](_0x527af7);}return null;};}function patchUpdates(_0x2f62b3){return function(_0x5c9c38){try{jsonpatch[_0x8b24('0x26')](_0x5c9c38,_0x2f62b3,!![]);}catch(_0x237d62){return BPromise['reject'](_0x237d62);}return _0x5c9c38[_0x8b24('0x27')]();};}function saveUpdates(_0x13dd68,_0x2225a6){return function(_0x3379df){if(_0x3379df){return _0x3379df[_0x8b24('0x28')](_0x13dd68)[_0x8b24('0x29')](function(_0x347591){return _0x347591;});}return null;};}function removeEntity(_0x3fddf8,_0x2e8c46){return function(_0xc1dc78){if(_0xc1dc78){return _0xc1dc78[_0x8b24('0x2a')]()[_0x8b24('0x29')](function(){_0x3fddf8[_0x8b24('0x1f')](0xcc)[_0x8b24('0x2b')]();});}};}function handleEntityNotFound(_0x19600a,_0x35d496){return function(_0x1fe79f){if(!_0x1fe79f){_0x19600a[_0x8b24('0x1e')](0x194);}return _0x1fe79f;};}function handleError(_0x44ee85,_0x279837){_0x279837=_0x279837||0x1f4;return function(_0x1adcb4){logger[_0x8b24('0x2c')](_0x1adcb4[_0x8b24('0x2d')]);if(_0x1adcb4[_0x8b24('0x2e')]){delete _0x1adcb4[_0x8b24('0x2e')];}_0x44ee85[_0x8b24('0x1f')](_0x279837)[_0x8b24('0x2f')](_0x1adcb4);};}exports[_0x8b24('0x30')]=function(_0x5d3958,_0x36ff89){var _0x59d6e1={},_0xadbba0={},_0x14316c={'count':0x0,'rows':[]};return db[_0x8b24('0x31')][_0x8b24('0x32')]()[_0x8b24('0x29')](function(_0x4de1cf){var _0xa37fe3=[];for(var _0x28d351=0x0;_0x28d3510x1){_0x357084['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8b24('0x6d')](_0x28119b),null);}else{if(qs[_0x8b24('0x6e')](_0x28119b)){_0x357084['or'](_0x8b24('0x6f'),_0x28119b+'%');_0x357084['or']('c.phone\x20LIKE\x20?',_0x28119b+'%');_0x357084['or'](_0x8b24('0x70'),_0x28119b+'%');_0x357084['or']('c.fax\x20LIKE\x20?',_0x28119b+'%');}else if(qs[_0x8b24('0x71')](_0x28119b)){_0x357084['or'](_0x8b24('0x72'),_0x28119b+'%');}else{_0x357084['or'](_0x8b24('0x73'),'%'+_0x28119b+'%');_0x357084['or'](_0x8b24('0x74'),'%'+_0x28119b+'%');_0x357084['or'](_0x8b24('0x72'),'%'+_0x28119b+'%');}}}}_0x529cad['where'](_0x357084);_0x529cad[_0x8b24('0x75')](_0x8b24('0x76'));var _0x2662b9={'type':db[_0x8b24('0x77')][_0x8b24('0x78')]['SELECT'],'raw':!![]};var _0x5c57ed=_0x529cad[_0x8b24('0x79')]()[_0x8b24('0x4a')](_0x8b24('0x76'));if(_0x59d6e1['order']){_0x59d6e1[_0x8b24('0x45')][_0x8b24('0x59')](function(_0x51b881){_0x529cad['order']('c.'+_0x51b881[0x0],_0x51b881[0x1]===_0x8b24('0x7a')?![]:!![]);});}if(!_[_0x8b24('0x65')](_0x204297)){_0x529cad[_0x8b24('0x7b')](_0x5a2b4b);_0x5c57ed[_0x8b24('0x47')](_0x8b24('0x7c'),_0x204297);}BPromise[_0x8b24('0x7d')]()[_0x8b24('0x29')](function(){if(!_0x54cbaf)return;if(_0x5d3958[_0x8b24('0x7e')][_0x8b24('0x7f')]!=='agent')return;if(!_[_0x8b24('0x80')](_0x54cbaf[_0x8b24('0x55')],[_0x8b24('0x4a'),_0x8b24('0x81')])){return _0x5d3958[_0x8b24('0x7e')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x4419c2){if(_[_0x8b24('0x65')](_0x4419c2)){_0x5c57ed['where'](_0x8b24('0x82'));_0x529cad['where'](_0x8b24('0x82'));}else{_0x5c57ed['where']('c.ListId\x20IN\x20?',_[_0x8b24('0x58')](_0x4419c2,'id'));_0x529cad[_0x8b24('0x47')]('c.ListId\x20IN\x20?',_[_0x8b24('0x58')](_0x4419c2,'id'));}});}})['then'](function(){if(_0x5d3958[_0x8b24('0x7e')]['role']===_0x8b24('0x83')&&!_0x54cbaf&&!_0x5d3958[_0x8b24('0x3f')][_0x8b24('0x66')])return[];return db[_0x8b24('0x84')]['query'](_0x5c57ed[_0x8b24('0x85')](),_0x2662b9);})[_0x8b24('0x29')](function(_0x304b57){_0x14316c[_0x8b24('0x20')]=_0x304b57['length'];if(_0x14316c[_0x8b24('0x20')]===0x0)return[];return db[_0x8b24('0x84')][_0x8b24('0x3f')](_0x8a41d0[_0x8b24('0x85')](),_0x2662b9)['then'](function(_0x525617){_0x5397aa=_['keyBy'](_0x525617,'id');_0x2662b9=_[_0x8b24('0x86')](_0x2662b9,{'model':db[_0x8b24('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d3958[_0x8b24('0x3f')][_0x8b24('0x43')]){_0x59d6e1[_0x8b24('0x42')][_0x8b24('0x59')](function(_0x4bcdf9){_0x529cad[_0x8b24('0x4a')]('c.'+_0x4bcdf9);});}else{_0x529cad['field'](_0x8b24('0x76'));_0x529cad[_0x8b24('0x4a')](_0x8b24('0x87'));_0x529cad[_0x8b24('0x4a')](_0x8b24('0x88'));_0x529cad[_0x8b24('0x4a')](_0x8b24('0x89'));_0x529cad['field']('c.mobile');_0x529cad[_0x8b24('0x4a')]('c.fax');_0x529cad[_0x8b24('0x4a')]('c.email');_0x529cad[_0x8b24('0x4a')](_0x8b24('0x8a'));_0x529cad[_0x8b24('0x4a')](_0x8b24('0x8b'));_0x529cad[_0x8b24('0x4a')](_0x8b24('0x8c'));_0x529cad[_0x8b24('0x4a')](_0x8b24('0x8d'));_0x529cad[_0x8b24('0x4a')](_0x8b24('0x8e'),_0x8b24('0x8f'));}if(_0x59d6e1[_0x8b24('0x22')])_0x529cad[_0x8b24('0x22')](_0x59d6e1[_0x8b24('0x22')]);if(_0x59d6e1[_0x8b24('0x21')])_0x529cad[_0x8b24('0x21')](_0x59d6e1[_0x8b24('0x21')]);return db['sequelize'][_0x8b24('0x3f')](_0x529cad['toString'](),_0x2662b9);});})[_0x8b24('0x29')](function(_0x368b89){_0x368b89[_0x8b24('0x59')](function(_0x3503a8){if(_0x3503a8[_0x8b24('0x8f')]){_0x3503a8[_0x8b24('0x90')]=[];_0x3503a8[_0x8b24('0x8f')][_0x8b24('0x57')](',')['forEach'](function(_0x4fd50a){_0x3503a8[_0x8b24('0x90')][_0x8b24('0x36')](_0x5397aa[_0x4fd50a]);});}delete _0x3503a8['TagIds'];});_0x14316c['rows']=_0x368b89;return _0x14316c;})[_0x8b24('0x29')](respondWithFilteredResult(_0x36ff89,_0x59d6e1));})['catch'](handleError(_0x36ff89,null));};exports[_0x8b24('0x2a')]=function(_0x5c1012,_0x4573a1){return db[_0x8b24('0x31')][_0x8b24('0x91')]({'where':{'id':_0x5c1012[_0x8b24('0x92')]['id']}})[_0x8b24('0x29')](handleEntityNotFound(_0x4573a1,null))[_0x8b24('0x29')](removeEntity(_0x4573a1,null))['catch'](handleError(_0x4573a1,null));};exports[_0x8b24('0x32')]=function(_0x423aa9,_0x31442f){return db[_0x8b24('0x31')][_0x8b24('0x32')]()['then'](function(_0x3823ff){delete _0x3823ff[_0x8b24('0x93')];for(var _0x253da3=0x0;_0x253da3{}\s\\|]/g,'-');_0x1797ba(null,util[_0xe195('0x20')](_0xe195('0x21'),path[_0xe195('0x22')](_0x334b4a[_0xe195('0x23')],path[_0xe195('0x24')](_0x334b4a[_0xe195('0x23')])),Date[_0xe195('0x25')](),path[_0xe195('0x24')](_0x334b4a[_0xe195('0x23')])));}})});router[_0xe195('0x17')](_0xe195('0x26'),upload[_0xe195('0x27')](_0xe195('0x28')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xe195('0x1d')]({'destination':function(_0x334cb8,_0x147563,_0x2a0504){_0x2a0504(null,path[_0xe195('0x1e')](config[_0xe195('0x29')],_0xe195('0x1f')));},'filename':function(_0x401808,_0x998af8,_0x1f1ca7){_0x998af8['originalname']=_0x998af8[_0xe195('0x23')][_0xe195('0x2a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1f1ca7(null,util[_0xe195('0x20')](_0xe195('0x21'),path[_0xe195('0x22')](_0x998af8['originalname'],path['extname'](_0x998af8[_0xe195('0x23')])),Date[_0xe195('0x25')](),path[_0xe195('0x24')](_0x998af8[_0xe195('0x23')])));}})});router[_0xe195('0x17')](_0xe195('0x2b'),upload['single'](_0xe195('0x28')),controller[_0xe195('0x2c')]);router[_0xe195('0x17')]('/upload/:id',auth[_0xe195('0xb')](),controller['import']);router[_0xe195('0x2d')](_0xe195('0xf'),auth['isAuthenticated'](),controller[_0xe195('0x2e')]);router[_0xe195('0x2f')](_0xe195('0xf'),auth['isAuthenticated'](),controller[_0xe195('0x30')]);module[_0xe195('0x31')]=router; \ No newline at end of file +var _0xa25c=['/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','/create_many','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','single','uploadCsv','file','upload','/upload/:id','import','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','/:id/tags','getTags','/:id/hoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x1eca9f,_0x17f40d){var _0x4579de=function(_0x429755){while(--_0x429755){_0x1eca9f['push'](_0x1eca9f['shift']());}};_0x4579de(++_0x17f40d);}(_0xa25c,0x13f));var _0xca25=function(_0x9fcb9d,_0x299aad){_0x9fcb9d=_0x9fcb9d-0x0;var _0x8ea66=_0xa25c[_0x9fcb9d];return _0x8ea66;};'use strict';var multer=require('multer');var util=require(_0xca25('0x0'));var path=require(_0xca25('0x1'));var timeout=require(_0xca25('0x2'));var express=require(_0xca25('0x3'));var router=express[_0xca25('0x4')]();var auth=require(_0xca25('0x5'));var interaction=require(_0xca25('0x6'));var config=require(_0xca25('0x7'));var controller=require('./cmContact.controller');router[_0xca25('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xca25('0x8')]('/describe',auth[_0xca25('0x9')](),controller[_0xca25('0xa')]);router[_0xca25('0x8')](_0xca25('0xb'),auth[_0xca25('0x9')](),controller['show']);router['get'](_0xca25('0xc'),auth['isAuthenticated'](),controller[_0xca25('0xd')]);router[_0xca25('0x8')](_0xca25('0xe'),auth['isAuthenticated'](),controller['getHoppers']);router['get'](_0xca25('0xf'),auth[_0xca25('0x9')](),controller[_0xca25('0x10')]);router['get']('/:id/hopper_finals',auth[_0xca25('0x9')](),controller['getHopperFinals']);router[_0xca25('0x8')](_0xca25('0x11'),auth[_0xca25('0x9')](),controller[_0xca25('0x12')]);router[_0xca25('0x8')](_0xca25('0x13'),auth[_0xca25('0x9')](),controller[_0xca25('0x14')]);router[_0xca25('0x15')](_0xca25('0x16'),auth[_0xca25('0x9')](),controller['merge']);router[_0xca25('0x15')]('/',auth[_0xca25('0x9')](),controller['create']);router[_0xca25('0x15')](_0xca25('0x17'),auth[_0xca25('0x9')](),controller[_0xca25('0x18')]);router[_0xca25('0x15')]('/:id/tags',auth[_0xca25('0x9')](),controller[_0xca25('0x19')]);var upload=multer({'storage':multer[_0xca25('0x1a')]({'destination':function(_0x1cf09c,_0x1b0c3f,_0x5d375b){_0x5d375b(null,path[_0xca25('0x1b')](config[_0xca25('0x1c')],_0xca25('0x1d')));},'filename':function(_0x1f69c6,_0x327719,_0x38d6e6){_0x327719[_0xca25('0x1e')]=_0x327719['originalname'][_0xca25('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x38d6e6(null,util[_0xca25('0x20')](_0xca25('0x21'),path[_0xca25('0x22')](_0x327719[_0xca25('0x1e')],path[_0xca25('0x23')](_0x327719[_0xca25('0x1e')])),Date[_0xca25('0x24')](),path[_0xca25('0x23')](_0x327719[_0xca25('0x1e')])));}})});router[_0xca25('0x15')](_0xca25('0x25'),upload[_0xca25('0x26')]('file'),controller[_0xca25('0x27')]);var upload=multer({'storage':multer[_0xca25('0x1a')]({'destination':function(_0x7ceacb,_0x374cde,_0x220546){_0x220546(null,path['join'](config[_0xca25('0x1c')],_0xca25('0x1d')));},'filename':function(_0x3d7414,_0xd61524,_0x2ae0e3){_0xd61524[_0xca25('0x1e')]=_0xd61524[_0xca25('0x1e')][_0xca25('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2ae0e3(null,util[_0xca25('0x20')](_0xca25('0x21'),path[_0xca25('0x22')](_0xd61524[_0xca25('0x1e')],path[_0xca25('0x23')](_0xd61524[_0xca25('0x1e')])),Date[_0xca25('0x24')](),path[_0xca25('0x23')](_0xd61524[_0xca25('0x1e')])));}})});router[_0xca25('0x15')]('/upload',upload[_0xca25('0x26')](_0xca25('0x28')),controller[_0xca25('0x29')]);router['post'](_0xca25('0x2a'),auth[_0xca25('0x9')](),controller[_0xca25('0x2b')]);router[_0xca25('0x2c')](_0xca25('0xb'),auth[_0xca25('0x9')](),controller['update']);router[_0xca25('0x2d')]('/:id',auth[_0xca25('0x9')](),controller[_0xca25('0x2e')]);module[_0xca25('0x2f')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index eec61f3..caa2f05 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 _0x885a=['exports','INTEGER','STRING','PHONE'];(function(_0x550a2b,_0x220da0){var _0x4ac9b4=function(_0x1c956c){while(--_0x1c956c){_0x550a2b['push'](_0x550a2b['shift']());}};_0x4ac9b4(++_0x220da0);}(_0x885a,0x180));var _0xa885=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x885a[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module[_0xa885('0x0')]={'CmContactId':{'type':Sequelize[_0xa885('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xa885('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa885('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xa885('0x3')},'OrderBy':{'type':Sequelize[_0xa885('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xe574=['sequelize','INTEGER','STRING','PHONE'];(function(_0x1b56b2,_0x167f30){var _0x389c12=function(_0x104c18){while(--_0x104c18){_0x1b56b2['push'](_0x1b56b2['shift']());}};_0x389c12(++_0x167f30);}(_0xe574,0x100));var _0x4e57=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe574[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4e57('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x4e57('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x4e57('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':_0x4e57('0x3')},'OrderBy':{'type':Sequelize[_0x4e57('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index d114686..ed8853e 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 _0xc8fc=['merge','type','includeAll','include','findAll','rows','catch','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','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','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','CmContactHasItems','then','error','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter'];(function(_0x475b7d,_0x3e1f95){var _0x2ad527=function(_0x191883){while(--_0x191883){_0x475b7d['push'](_0x475b7d['shift']());}};_0x2ad527(++_0x3e1f95);}(_0xc8fc,0x118));var _0xcc8f=function(_0x25febc,_0xa928d){_0x25febc=_0x25febc-0x0;var _0x21b031=_0xc8fc[_0x25febc];return _0x21b031;};'use strict';var pdf=require(_0xcc8f('0x0'));var emlformat=require(_0xcc8f('0x1'));var rimraf=require(_0xcc8f('0x2'));var zipdir=require(_0xcc8f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc8f('0x4'));var moment=require(_0xcc8f('0x5'));var BPromise=require(_0xcc8f('0x6'));var Mustache=require(_0xcc8f('0x7'));var util=require(_0xcc8f('0x8'));var path=require(_0xcc8f('0x9'));var sox=require(_0xcc8f('0xa'));var csv=require(_0xcc8f('0xb'));var ejs=require(_0xcc8f('0xc'));var fs=require('fs');var _=require(_0xcc8f('0xd'));var squel=require(_0xcc8f('0xe'));var crypto=require(_0xcc8f('0xf'));var jsforce=require(_0xcc8f('0x10'));var deskjs=require(_0xcc8f('0x11'));var toCsv=require(_0xcc8f('0xb'));var querystring=require(_0xcc8f('0x12'));var Papa=require(_0xcc8f('0x13'));var Redis=require('ioredis');var authService=require(_0xcc8f('0x14'));var qs=require(_0xcc8f('0x15'));var as=require(_0xcc8f('0x16'));var hardwareService=require(_0xcc8f('0x17'));var logger=require(_0xcc8f('0x18'))(_0xcc8f('0x19'));var utils=require(_0xcc8f('0x1a'));var config=require(_0xcc8f('0x1b'));var licenseUtil=require(_0xcc8f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15a9b8,_0xcd40e7){_0xcd40e7=_0xcd40e7||0xcc;return function(_0x539ca3){if(_0x539ca3){return _0x15a9b8[_0xcc8f('0x1d')](_0xcd40e7);}return _0x15a9b8['status'](_0xcd40e7)[_0xcc8f('0x1e')]();};}function respondWithResult(_0x48f01c,_0x4adada){_0x4adada=_0x4adada||0xc8;return function(_0x1c78c1){if(_0x1c78c1){return _0x48f01c[_0xcc8f('0x1f')](_0x4adada)[_0xcc8f('0x20')](_0x1c78c1);}};}function respondWithFilteredResult(_0x44b3d3,_0x50d516){return function(_0x1fdfe4){if(_0x1fdfe4){var _0x5a0023=_0x1fdfe4[_0xcc8f('0x21')],_0x3ac3cc=_0x50d516[_0xcc8f('0x22')],_0x1990a0=_0x50d516[_0xcc8f('0x22')]+_0x50d516[_0xcc8f('0x23')],_0xf236e5;if(_0x1990a0>=_0x5a0023){_0x1990a0=_0x5a0023;_0xf236e5=0xc8;}else{_0xf236e5=0xce;}_0x44b3d3[_0xcc8f('0x1f')](_0xf236e5);return _0x44b3d3[_0xcc8f('0x24')](_0xcc8f('0x25'),_0x3ac3cc+'-'+_0x1990a0+'/'+_0x5a0023)[_0xcc8f('0x20')](_0x1fdfe4);}return null;};}function patchUpdates(_0xdd2fad){return function(_0x56b930){try{jsonpatch[_0xcc8f('0x26')](_0x56b930,_0xdd2fad,!![]);}catch(_0x406d5a){return BPromise[_0xcc8f('0x27')](_0x406d5a);}return _0x56b930[_0xcc8f('0x28')]();};}function saveUpdates(_0x15400d,_0x443b2b){return function(_0x4d2d44){if(_0x4d2d44){return _0x4d2d44[_0xcc8f('0x29')](_0x15400d)['then'](function(_0x20727d){return _0x20727d;});}return null;};}function removeEntity(_0x34b3a2,_0x925e12){return function(_0x32edef){if(_0x32edef){return _0x32edef[_0xcc8f('0x2a')]()['then'](function(){var _0x22b0b9=_0x32edef[_0xcc8f('0x2b')]({'plain':!![]});var _0x287188=_0xcc8f('0x2c');return db['UserProfileResource'][_0xcc8f('0x2a')]({'where':{'type':_0x287188,'resourceId':_0x22b0b9['id']}})[_0xcc8f('0x2d')](function(){return _0x32edef;});})[_0xcc8f('0x2d')](function(){_0x34b3a2[_0xcc8f('0x1f')](0xcc)[_0xcc8f('0x1e')]();});}};}function handleEntityNotFound(_0x2b5739,_0x575187){return function(_0x5b8cdf){if(!_0x5b8cdf){_0x2b5739['sendStatus'](0x194);}return _0x5b8cdf;};}function handleError(_0x100dcf,_0x11ee07){_0x11ee07=_0x11ee07||0x1f4;return function(_0xaa4d2b){logger[_0xcc8f('0x2e')](_0xaa4d2b['stack']);if(_0xaa4d2b[_0xcc8f('0x2f')]){delete _0xaa4d2b[_0xcc8f('0x2f')];}_0x100dcf['status'](_0x11ee07)[_0xcc8f('0x30')](_0xaa4d2b);};}exports[_0xcc8f('0x31')]=function(_0x60b08,_0x5e3939){var _0x57e2e7={},_0x125cee={},_0x4e6674={'count':0x0,'rows':[]};var _0x4bd057=_[_0xcc8f('0x32')](db[_0xcc8f('0x33')][_0xcc8f('0x34')],function(_0x212ca3){return{'name':_0x212ca3[_0xcc8f('0x35')],'type':_0x212ca3['type'][_0xcc8f('0x36')]};});_0x125cee[_0xcc8f('0x37')]=_[_0xcc8f('0x32')](_0x4bd057,_0xcc8f('0x2f'));_0x125cee[_0xcc8f('0x38')]=_['keys'](_0x60b08[_0xcc8f('0x38')]);_0x125cee['filters']=_[_0xcc8f('0x39')](_0x125cee[_0xcc8f('0x37')],_0x125cee[_0xcc8f('0x38')]);_0x57e2e7['attributes']=_[_0xcc8f('0x39')](_0x125cee[_0xcc8f('0x37')],qs[_0xcc8f('0x3a')](_0x60b08['query'][_0xcc8f('0x3a')]));_0x57e2e7[_0xcc8f('0x3b')]=_0x57e2e7[_0xcc8f('0x3b')][_0xcc8f('0x3c')]?_0x57e2e7[_0xcc8f('0x3b')]:_0x125cee['model'];if(!_0x60b08[_0xcc8f('0x38')][_0xcc8f('0x3d')](_0xcc8f('0x3e'))){_0x57e2e7[_0xcc8f('0x23')]=qs['limit'](_0x60b08[_0xcc8f('0x38')]['limit']);_0x57e2e7[_0xcc8f('0x22')]=qs[_0xcc8f('0x22')](_0x60b08[_0xcc8f('0x38')][_0xcc8f('0x22')]);}_0x57e2e7[_0xcc8f('0x3f')]=qs[_0xcc8f('0x40')](_0x60b08[_0xcc8f('0x38')]['sort']);_0x57e2e7[_0xcc8f('0x41')]=qs[_0xcc8f('0x42')](_['pick'](_0x60b08[_0xcc8f('0x38')],_0x125cee[_0xcc8f('0x42')]),_0x4bd057);if(_0x60b08[_0xcc8f('0x38')][_0xcc8f('0x43')]){_0x57e2e7[_0xcc8f('0x41')]=_[_0xcc8f('0x44')](_0x57e2e7[_0xcc8f('0x41')],{'$or':_[_0xcc8f('0x32')](_0x4bd057,function(_0x26dd38){if(_0x26dd38[_0xcc8f('0x45')]!=='VIRTUAL'){var _0x18a291={};_0x18a291[_0x26dd38['name']]={'$like':'%'+_0x60b08[_0xcc8f('0x38')][_0xcc8f('0x43')]+'%'};return _0x18a291;}})});}_0x57e2e7=_['merge']({},_0x57e2e7,_0x60b08['options']);var _0x424c71={'where':_0x57e2e7[_0xcc8f('0x41')]};return db[_0xcc8f('0x33')][_0xcc8f('0x21')](_0x424c71)[_0xcc8f('0x2d')](function(_0x2b0126){_0x4e6674[_0xcc8f('0x21')]=_0x2b0126;if(_0x60b08[_0xcc8f('0x38')][_0xcc8f('0x46')]){_0x57e2e7[_0xcc8f('0x47')]=[{'all':!![]}];}return db[_0xcc8f('0x33')][_0xcc8f('0x48')](_0x57e2e7);})[_0xcc8f('0x2d')](function(_0x562e16){_0x4e6674[_0xcc8f('0x49')]=_0x562e16;return _0x4e6674;})[_0xcc8f('0x2d')](respondWithFilteredResult(_0x5e3939,_0x57e2e7))[_0xcc8f('0x4a')](handleError(_0x5e3939,null));};exports['show']=function(_0x1b87a9,_0x25ba73){var _0x4b49c2={'raw':!![],'where':{'id':_0x1b87a9[_0xcc8f('0x4b')]['id']}},_0x1e82af={};_0x1e82af[_0xcc8f('0x37')]=_[_0xcc8f('0x4c')](db['CmContactHasItem'][_0xcc8f('0x34')]);_0x1e82af[_0xcc8f('0x38')]=_[_0xcc8f('0x4c')](_0x1b87a9[_0xcc8f('0x38')]);_0x1e82af[_0xcc8f('0x42')]=_['intersection'](_0x1e82af[_0xcc8f('0x37')],_0x1e82af[_0xcc8f('0x38')]);_0x4b49c2['attributes']=_[_0xcc8f('0x39')](_0x1e82af[_0xcc8f('0x37')],qs[_0xcc8f('0x3a')](_0x1b87a9[_0xcc8f('0x38')][_0xcc8f('0x3a')]));_0x4b49c2[_0xcc8f('0x3b')]=_0x4b49c2[_0xcc8f('0x3b')][_0xcc8f('0x3c')]?_0x4b49c2['attributes']:_0x1e82af['model'];if(_0x1b87a9['query'][_0xcc8f('0x46')]){_0x4b49c2[_0xcc8f('0x47')]=[{'all':!![]}];}_0x4b49c2=_['merge']({},_0x4b49c2,_0x1b87a9[_0xcc8f('0x4d')]);return db[_0xcc8f('0x33')][_0xcc8f('0x4e')](_0x4b49c2)['then'](handleEntityNotFound(_0x25ba73,null))[_0xcc8f('0x2d')](respondWithResult(_0x25ba73,null))[_0xcc8f('0x4a')](handleError(_0x25ba73,null));};exports['create']=function(_0x2f7800,_0x3f2314){return db[_0xcc8f('0x33')][_0xcc8f('0x4f')](_0x2f7800['body'],{})[_0xcc8f('0x2d')](function(_0x4a4941){var _0x256f21=_0x2f7800[_0xcc8f('0x50')]['get']({'plain':!![]});if(!_0x256f21)throw new Error(_0xcc8f('0x51'));if(_0x256f21[_0xcc8f('0x52')]===_0xcc8f('0x50')){var _0x72e808=_0x4a4941[_0xcc8f('0x2b')]({'plain':!![]});var _0x3a44fd=_0xcc8f('0x2c');return db['UserProfileSection'][_0xcc8f('0x4e')]({'where':{'name':_0x3a44fd,'userProfileId':_0x256f21['userProfileId']},'raw':!![]})[_0xcc8f('0x2d')](function(_0x1d9687){if(_0x1d9687&&_0x1d9687[_0xcc8f('0x53')]===0x0){return db[_0xcc8f('0x54')]['create']({'name':_0x72e808[_0xcc8f('0x2f')],'resourceId':_0x72e808['id'],'type':_0x1d9687[_0xcc8f('0x2f')],'sectionId':_0x1d9687['id']},{})[_0xcc8f('0x2d')](function(){return _0x4a4941;});}else{return _0x4a4941;}})[_0xcc8f('0x4a')](function(_0x38698e){logger[_0xcc8f('0x2e')](_0xcc8f('0x55'),_0x38698e);throw _0x38698e;});}return _0x4a4941;})['then'](respondWithResult(_0x3f2314,0xc9))[_0xcc8f('0x4a')](handleError(_0x3f2314,null));};exports['update']=function(_0x1cf852,_0x498a26){if(_0x1cf852['body']['id']){delete _0x1cf852['body']['id'];}return db[_0xcc8f('0x33')][_0xcc8f('0x4e')]({'where':{'id':_0x1cf852[_0xcc8f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x498a26,null))[_0xcc8f('0x2d')](saveUpdates(_0x1cf852[_0xcc8f('0x56')],null))['then'](respondWithResult(_0x498a26,null))[_0xcc8f('0x4a')](handleError(_0x498a26,null));};exports[_0xcc8f('0x2a')]=function(_0x6ad9b8,_0x6a10d3){return db[_0xcc8f('0x33')][_0xcc8f('0x4e')]({'where':{'id':_0x6ad9b8['params']['id']}})['then'](handleEntityNotFound(_0x6a10d3,null))['then'](removeEntity(_0x6a10d3,null))[_0xcc8f('0x4a')](handleError(_0x6a10d3,null));}; \ No newline at end of file +var _0x8738=['params','length','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','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','get','CmContactHasItems','error','stack','name','send','index','map','rawAttributes','fieldName','keys','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmContactHasItem','includeAll','include','findAll','rows','catch','show'];(function(_0x4352fb,_0x323648){var _0x3f3557=function(_0x1c8607){while(--_0x1c8607){_0x4352fb['push'](_0x4352fb['shift']());}};_0x3f3557(++_0x323648);}(_0x8738,0x1aa));var _0x8873=function(_0x526955,_0x316692){_0x526955=_0x526955-0x0;var _0x2791ad=_0x8738[_0x526955];return _0x2791ad;};'use strict';var pdf=require(_0x8873('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8873('0x1'));var zipdir=require(_0x8873('0x2'));var jsonpatch=require(_0x8873('0x3'));var rp=require(_0x8873('0x4'));var moment=require(_0x8873('0x5'));var BPromise=require(_0x8873('0x6'));var Mustache=require('mustache');var util=require(_0x8873('0x7'));var path=require('path');var sox=require(_0x8873('0x8'));var csv=require(_0x8873('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8873('0xa'));var squel=require(_0x8873('0xb'));var crypto=require(_0x8873('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8873('0xd'));var toCsv=require(_0x8873('0x9'));var querystring=require(_0x8873('0xe'));var Papa=require('papaparse');var Redis=require(_0x8873('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8873('0x10'));var as=require(_0x8873('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8873('0x12'))(_0x8873('0x13'));var utils=require(_0x8873('0x14'));var config=require(_0x8873('0x15'));var licenseUtil=require(_0x8873('0x16'));var db=require(_0x8873('0x17'))['db'];function respondWithStatusCode(_0x20959d,_0x1f12c0){_0x1f12c0=_0x1f12c0||0xcc;return function(_0x15f600){if(_0x15f600){return _0x20959d[_0x8873('0x18')](_0x1f12c0);}return _0x20959d[_0x8873('0x19')](_0x1f12c0)[_0x8873('0x1a')]();};}function respondWithResult(_0x19f386,_0x50ca5b){_0x50ca5b=_0x50ca5b||0xc8;return function(_0x3526b4){if(_0x3526b4){return _0x19f386['status'](_0x50ca5b)[_0x8873('0x1b')](_0x3526b4);}};}function respondWithFilteredResult(_0xcabe6a,_0x2baa52){return function(_0x38257a){if(_0x38257a){var _0x2aba30=_0x38257a[_0x8873('0x1c')],_0x5a661e=_0x2baa52[_0x8873('0x1d')],_0x441892=_0x2baa52['offset']+_0x2baa52[_0x8873('0x1e')],_0x237593;if(_0x441892>=_0x2aba30){_0x441892=_0x2aba30;_0x237593=0xc8;}else{_0x237593=0xce;}_0xcabe6a['status'](_0x237593);return _0xcabe6a[_0x8873('0x1f')](_0x8873('0x20'),_0x5a661e+'-'+_0x441892+'/'+_0x2aba30)['json'](_0x38257a);}return null;};}function patchUpdates(_0xb7b51e){return function(_0x202027){try{jsonpatch[_0x8873('0x21')](_0x202027,_0xb7b51e,!![]);}catch(_0x3b87d9){return BPromise[_0x8873('0x22')](_0x3b87d9);}return _0x202027['save']();};}function saveUpdates(_0x18aba5,_0x2b7d04){return function(_0x37576f){if(_0x37576f){return _0x37576f[_0x8873('0x23')](_0x18aba5)[_0x8873('0x24')](function(_0x25f991){return _0x25f991;});}return null;};}function removeEntity(_0x5b8a77,_0x5e1517){return function(_0x496e6a){if(_0x496e6a){return _0x496e6a[_0x8873('0x25')]()[_0x8873('0x24')](function(){var _0x3b3255=_0x496e6a[_0x8873('0x26')]({'plain':!![]});var _0x5199fd=_0x8873('0x27');return db['UserProfileResource'][_0x8873('0x25')]({'where':{'type':_0x5199fd,'resourceId':_0x3b3255['id']}})[_0x8873('0x24')](function(){return _0x496e6a;});})['then'](function(){_0x5b8a77[_0x8873('0x19')](0xcc)[_0x8873('0x1a')]();});}};}function handleEntityNotFound(_0x4d1d95,_0x313c12){return function(_0x532b0b){if(!_0x532b0b){_0x4d1d95[_0x8873('0x18')](0x194);}return _0x532b0b;};}function handleError(_0xee8299,_0x511b31){_0x511b31=_0x511b31||0x1f4;return function(_0x4d20cf){logger[_0x8873('0x28')](_0x4d20cf[_0x8873('0x29')]);if(_0x4d20cf[_0x8873('0x2a')]){delete _0x4d20cf[_0x8873('0x2a')];}_0xee8299[_0x8873('0x19')](_0x511b31)[_0x8873('0x2b')](_0x4d20cf);};}exports[_0x8873('0x2c')]=function(_0x3458d4,_0x1b6e63){var _0x2f95cb={},_0xf41579={},_0x1e5815={'count':0x0,'rows':[]};var _0x4baa03=_[_0x8873('0x2d')](db['CmContactHasItem'][_0x8873('0x2e')],function(_0x1cf984){return{'name':_0x1cf984[_0x8873('0x2f')],'type':_0x1cf984['type']['key']};});_0xf41579['model']=_[_0x8873('0x2d')](_0x4baa03,_0x8873('0x2a'));_0xf41579['query']=_[_0x8873('0x30')](_0x3458d4[_0x8873('0x31')]);_0xf41579['filters']=_[_0x8873('0x32')](_0xf41579['model'],_0xf41579[_0x8873('0x31')]);_0x2f95cb[_0x8873('0x33')]=_['intersection'](_0xf41579[_0x8873('0x34')],qs[_0x8873('0x35')](_0x3458d4[_0x8873('0x31')][_0x8873('0x35')]));_0x2f95cb['attributes']=_0x2f95cb[_0x8873('0x33')]['length']?_0x2f95cb[_0x8873('0x33')]:_0xf41579[_0x8873('0x34')];if(!_0x3458d4[_0x8873('0x31')][_0x8873('0x36')](_0x8873('0x37'))){_0x2f95cb[_0x8873('0x1e')]=qs[_0x8873('0x1e')](_0x3458d4['query'][_0x8873('0x1e')]);_0x2f95cb[_0x8873('0x1d')]=qs['offset'](_0x3458d4[_0x8873('0x31')][_0x8873('0x1d')]);}_0x2f95cb[_0x8873('0x38')]=qs[_0x8873('0x39')](_0x3458d4[_0x8873('0x31')][_0x8873('0x39')]);_0x2f95cb[_0x8873('0x3a')]=qs[_0x8873('0x3b')](_[_0x8873('0x3c')](_0x3458d4[_0x8873('0x31')],_0xf41579[_0x8873('0x3b')]),_0x4baa03);if(_0x3458d4['query'][_0x8873('0x3d')]){_0x2f95cb['where']=_[_0x8873('0x3e')](_0x2f95cb[_0x8873('0x3a')],{'$or':_[_0x8873('0x2d')](_0x4baa03,function(_0x461430){if(_0x461430['type']!==_0x8873('0x3f')){var _0x2309de={};_0x2309de[_0x461430[_0x8873('0x2a')]]={'$like':'%'+_0x3458d4['query']['filter']+'%'};return _0x2309de;}})});}_0x2f95cb=_[_0x8873('0x3e')]({},_0x2f95cb,_0x3458d4[_0x8873('0x40')]);var _0x32c21a={'where':_0x2f95cb[_0x8873('0x3a')]};return db[_0x8873('0x41')][_0x8873('0x1c')](_0x32c21a)[_0x8873('0x24')](function(_0x5485de){_0x1e5815[_0x8873('0x1c')]=_0x5485de;if(_0x3458d4['query'][_0x8873('0x42')]){_0x2f95cb[_0x8873('0x43')]=[{'all':!![]}];}return db[_0x8873('0x41')][_0x8873('0x44')](_0x2f95cb);})[_0x8873('0x24')](function(_0x480355){_0x1e5815[_0x8873('0x45')]=_0x480355;return _0x1e5815;})['then'](respondWithFilteredResult(_0x1b6e63,_0x2f95cb))[_0x8873('0x46')](handleError(_0x1b6e63,null));};exports[_0x8873('0x47')]=function(_0x55a27b,_0x3af760){var _0x163636={'raw':!![],'where':{'id':_0x55a27b[_0x8873('0x48')]['id']}},_0x3836a1={};_0x3836a1[_0x8873('0x34')]=_[_0x8873('0x30')](db[_0x8873('0x41')][_0x8873('0x2e')]);_0x3836a1[_0x8873('0x31')]=_[_0x8873('0x30')](_0x55a27b['query']);_0x3836a1[_0x8873('0x3b')]=_[_0x8873('0x32')](_0x3836a1['model'],_0x3836a1['query']);_0x163636['attributes']=_[_0x8873('0x32')](_0x3836a1[_0x8873('0x34')],qs[_0x8873('0x35')](_0x55a27b[_0x8873('0x31')]['fields']));_0x163636[_0x8873('0x33')]=_0x163636[_0x8873('0x33')][_0x8873('0x49')]?_0x163636[_0x8873('0x33')]:_0x3836a1['model'];if(_0x55a27b['query']['includeAll']){_0x163636[_0x8873('0x43')]=[{'all':!![]}];}_0x163636=_[_0x8873('0x3e')]({},_0x163636,_0x55a27b[_0x8873('0x40')]);return db[_0x8873('0x41')][_0x8873('0x4a')](_0x163636)[_0x8873('0x24')](handleEntityNotFound(_0x3af760,null))[_0x8873('0x24')](respondWithResult(_0x3af760,null))[_0x8873('0x46')](handleError(_0x3af760,null));};exports[_0x8873('0x4b')]=function(_0x51080a,_0x492525){return db[_0x8873('0x41')][_0x8873('0x4b')](_0x51080a['body'],{})['then'](function(_0x41d1a2){var _0x4bdc68=_0x51080a[_0x8873('0x4c')][_0x8873('0x26')]({'plain':!![]});if(!_0x4bdc68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bdc68[_0x8873('0x4d')]==='user'){var _0x2210f8=_0x41d1a2[_0x8873('0x26')]({'plain':!![]});var _0x2023f1='CmContactHasItems';return db[_0x8873('0x4e')][_0x8873('0x4a')]({'where':{'name':_0x2023f1,'userProfileId':_0x4bdc68[_0x8873('0x4f')]},'raw':!![]})[_0x8873('0x24')](function(_0x534118){if(_0x534118&&_0x534118[_0x8873('0x50')]===0x0){return db['UserProfileResource'][_0x8873('0x4b')]({'name':_0x2210f8['name'],'resourceId':_0x2210f8['id'],'type':_0x534118[_0x8873('0x2a')],'sectionId':_0x534118['id']},{})[_0x8873('0x24')](function(){return _0x41d1a2;});}else{return _0x41d1a2;}})['catch'](function(_0xedf078){logger[_0x8873('0x28')](_0x8873('0x51'),_0xedf078);throw _0xedf078;});}return _0x41d1a2;})[_0x8873('0x24')](respondWithResult(_0x492525,0xc9))[_0x8873('0x46')](handleError(_0x492525,null));};exports[_0x8873('0x23')]=function(_0xff948b,_0x3603f7){if(_0xff948b[_0x8873('0x52')]['id']){delete _0xff948b[_0x8873('0x52')]['id'];}return db[_0x8873('0x41')]['find']({'where':{'id':_0xff948b['params']['id']}})['then'](handleEntityNotFound(_0x3603f7,null))['then'](saveUpdates(_0xff948b[_0x8873('0x52')],null))[_0x8873('0x24')](respondWithResult(_0x3603f7,null))[_0x8873('0x46')](handleError(_0x3603f7,null));};exports[_0x8873('0x25')]=function(_0x4d2c21,_0x1e99d6){return db[_0x8873('0x41')][_0x8873('0x4a')]({'where':{'id':_0x4d2c21[_0x8873('0x48')]['id']}})[_0x8873('0x24')](handleEntityNotFound(_0x1e99d6,null))[_0x8873('0x24')](removeEntity(_0x1e99d6,null))[_0x8873('0x46')](handleError(_0x1e99d6,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 0ef1ba4..6e9d088 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 _0x8f9d=['define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x2ac756,_0x33408b){var _0xa621fb=function(_0x5a316f){while(--_0x5a316f){_0x2ac756['push'](_0x2ac756['shift']());}};_0xa621fb(++_0x33408b);}(_0x8f9d,0x93));var _0xd8f9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8f9d[_0xfae23b];return _0x200640;};'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':!![]});}; \ No newline at end of file +var _0xd8fb=['lodash','util','../../config/logger','api','path','rimraf','./cmContactHasItem.attributes','exports','CmContactHasItem'];(function(_0x21d1be,_0x13cdc3){var _0x58f2c5=function(_0x37d558){while(--_0x37d558){_0x21d1be['push'](_0x21d1be['shift']());}};_0x58f2c5(++_0x13cdc3);}(_0xd8fb,0x99));var _0xbd8f=function(_0x678cc9,_0x37752f){_0x678cc9=_0x678cc9-0x0;var _0x1dd2c6=_0xd8fb[_0x678cc9];return _0x1dd2c6;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 12c3724..898d168 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 _0x938a=['jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x938a,0x1f2));var _0xa938=function(_0x430524,_0x23b611){_0x430524=_0x430524-0x0;var _0x3a726d=_0x938a[_0x430524];return _0x3a726d;};'use strict';var _=require(_0xa938('0x0'));var util=require(_0xa938('0x1'));var moment=require(_0xa938('0x2'));var BPromise=require(_0xa938('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa938('0x4'))['db'];var utils=require(_0xa938('0x5'));var logger=require(_0xa938('0x6'))('rpc');var config=require(_0xa938('0x7'));var jayson=require(_0xa938('0x8'));var client=jayson['client'][_0xa938('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22b3bc,_0x5ead46,_0x56ad1d){return new BPromise(function(_0x570280,_0x1de832){return client[_0xa938('0xa')](_0x22b3bc,_0x56ad1d)[_0xa938('0xb')](function(_0x5c6366){logger[_0xa938('0xc')](_0xa938('0xd'),_0x5ead46,_0xa938('0xe'));logger[_0xa938('0xf')](_0xa938('0x10'),_0x5ead46,'request\x20sent',JSON[_0xa938('0x11')](_0x5c6366));if(_0x5c6366[_0xa938('0x12')]){if(_0x5c6366[_0xa938('0x12')]['code']===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x5ead46,_0x5c6366['error']['message']);return _0x1de832(_0x5c6366[_0xa938('0x12')][_0xa938('0x13')]);}logger['error'](_0xa938('0xd'),_0x5ead46,_0x5c6366[_0xa938('0x12')][_0xa938('0x13')]);return _0x570280(_0x5c6366['error'][_0xa938('0x13')]);}else{logger[_0xa938('0xc')](_0xa938('0xd'),_0x5ead46,_0xa938('0xe'));_0x570280(_0x5c6366[_0xa938('0x14')]['message']);}})[_0xa938('0x15')](function(_0x7c29b3){logger[_0xa938('0x12')](_0xa938('0xd'),_0x5ead46,_0x7c29b3);_0x1de832(_0x7c29b3);});});} \ No newline at end of file +var _0xebf9=['CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5b6d3d,_0x2dea63){var _0x1b50b0=function(_0xefc750){while(--_0xefc750){_0x5b6d3d['push'](_0x5b6d3d['shift']());}};_0x1b50b0(++_0x2dea63);}(_0xebf9,0x1a7));var _0x9ebf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xebf9[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x9ebf('0x0'));var moment=require(_0x9ebf('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ebf('0x2'));var db=require(_0x9ebf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ebf('0x4'))(_0x9ebf('0x5'));var config=require(_0x9ebf('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9ebf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x154047,_0x5de28f,_0x313e0b){return new BPromise(function(_0x5ea05c,_0x54950c){return client[_0x9ebf('0x8')](_0x154047,_0x313e0b)['then'](function(_0x20dd80){logger['info'](_0x9ebf('0x9'),_0x5de28f,_0x9ebf('0xa'));logger['debug'](_0x9ebf('0xb'),_0x5de28f,'request\x20sent',JSON[_0x9ebf('0xc')](_0x20dd80));if(_0x20dd80[_0x9ebf('0xd')]){if(_0x20dd80[_0x9ebf('0xd')][_0x9ebf('0xe')]===0x1f4){logger[_0x9ebf('0xd')](_0x9ebf('0x9'),_0x5de28f,_0x20dd80[_0x9ebf('0xd')][_0x9ebf('0xf')]);return _0x54950c(_0x20dd80[_0x9ebf('0xd')]['message']);}logger[_0x9ebf('0xd')](_0x9ebf('0x9'),_0x5de28f,_0x20dd80[_0x9ebf('0xd')][_0x9ebf('0xf')]);return _0x5ea05c(_0x20dd80[_0x9ebf('0xd')][_0x9ebf('0xf')]);}else{logger[_0x9ebf('0x10')](_0x9ebf('0x9'),_0x5de28f,_0x9ebf('0xa'));_0x5ea05c(_0x20dd80['result'][_0x9ebf('0xf')]);}})[_0x9ebf('0x11')](function(_0x3969ff){logger['error'](_0x9ebf('0x9'),_0x5de28f,_0x3969ff);_0x54950c(_0x3969ff);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index c4450cb..b8ea4fd 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 _0x87f0=['../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x2db79f,_0x51f8dd){var _0x162aac=function(_0x5c8240){while(--_0x5c8240){_0x2db79f['push'](_0x2db79f['shift']());}};_0x162aac(++_0x51f8dd);}(_0x87f0,0x187));var _0x087f=function(_0x285749,_0x52705d){_0x285749=_0x285749-0x0;var _0x42db52=_0x87f0[_0x285749];return _0x42db52;};'use strict';var multer=require(_0x087f('0x0'));var util=require(_0x087f('0x1'));var path=require(_0x087f('0x2'));var timeout=require('connect-timeout');var express=require(_0x087f('0x3'));var router=express[_0x087f('0x4')]();var auth=require(_0x087f('0x5'));var interaction=require(_0x087f('0x6'));var config=require('../../config/environment');var controller=require(_0x087f('0x7'));router['get']('/',auth[_0x087f('0x8')](),controller[_0x087f('0x9')]);router[_0x087f('0xa')](_0x087f('0xb'),auth[_0x087f('0x8')](),controller[_0x087f('0xc')]);router[_0x087f('0xd')]('/',auth[_0x087f('0x8')](),controller['create']);router[_0x087f('0xe')](_0x087f('0xb'),auth[_0x087f('0x8')](),controller[_0x087f('0xf')]);router[_0x087f('0x10')](_0x087f('0xb'),auth[_0x087f('0x8')](),controller['destroy']);module[_0x087f('0x11')]=router; \ No newline at end of file +var _0xbf0b=['delete','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x406ba5,_0x39fa4b){var _0x557db7=function(_0x40f28b){while(--_0x40f28b){_0x406ba5['push'](_0x406ba5['shift']());}};_0x557db7(++_0x39fa4b);}(_0xbf0b,0xef));var _0xbbf0=function(_0x35f1e0,_0x37e334){_0x35f1e0=_0x35f1e0-0x0;var _0x55051e=_0xbf0b[_0x35f1e0];return _0x55051e;};'use strict';var multer=require(_0xbbf0('0x0'));var util=require(_0xbbf0('0x1'));var path=require(_0xbbf0('0x2'));var timeout=require(_0xbbf0('0x3'));var express=require('express');var router=express[_0xbbf0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbbf0('0x5'));var config=require(_0xbbf0('0x6'));var controller=require(_0xbbf0('0x7'));router['get']('/',auth[_0xbbf0('0x8')](),controller[_0xbbf0('0x9')]);router['get'](_0xbbf0('0xa'),auth['isAuthenticated'](),controller[_0xbbf0('0xb')]);router[_0xbbf0('0xc')]('/',auth[_0xbbf0('0x8')](),controller[_0xbbf0('0xd')]);router[_0xbbf0('0xe')]('/:id',auth[_0xbbf0('0x8')](),controller[_0xbbf0('0xf')]);router[_0xbbf0('0x10')](_0xbbf0('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 803a99d..85612ed 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 _0xc50f=['exports','INTEGER','STRING'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0xc50f,0x13e));var _0xfc50=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc50f[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0xfc50('0x0')]={'CmContactId':{'type':Sequelize[_0xfc50('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xfc50('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x6be5=['exports','STRING'];(function(_0x254dde,_0x75cf5b){var _0xd87ba8=function(_0x6b6e93){while(--_0x6b6e93){_0x254dde['push'](_0x254dde['shift']());}};_0xd87ba8(++_0x75cf5b);}(_0x6be5,0x10a));var _0x56be=function(_0x3d07ad,_0x3d4abe){_0x3d07ad=_0x3d07ad-0x0;var _0x511f22=_0x6be5[_0x3d07ad];return _0x511f22;};'use strict';var Sequelize=require('sequelize');module[_0x56be('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'phone':{'type':Sequelize[_0x56be('0x1')],'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 a713521..5bc3b0c 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 _0xb481=['keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','CmContactHasPhone','includeAll','include','findAll','catch','rawAttributes','options','find','create','user','role','CmContactHasPhones','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../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','get','UserProfileResource','sendStatus','name','send','index','map','type','key','query'];(function(_0x50ee2b,_0x26adfb){var _0x23a568=function(_0x3a7dbb){while(--_0x3a7dbb){_0x50ee2b['push'](_0x50ee2b['shift']());}};_0x23a568(++_0x26adfb);}(_0xb481,0x11a));var _0x1b48=function(_0x7baac8,_0x481055){_0x7baac8=_0x7baac8-0x0;var _0x572f4e=_0xb481[_0x7baac8];return _0x572f4e;};'use strict';var pdf=require(_0x1b48('0x0'));var emlformat=require(_0x1b48('0x1'));var rimraf=require(_0x1b48('0x2'));var zipdir=require(_0x1b48('0x3'));var jsonpatch=require(_0x1b48('0x4'));var rp=require(_0x1b48('0x5'));var moment=require('moment');var BPromise=require(_0x1b48('0x6'));var Mustache=require(_0x1b48('0x7'));var util=require(_0x1b48('0x8'));var path=require(_0x1b48('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1b48('0xa'));var fs=require('fs');var _=require(_0x1b48('0xb'));var squel=require('squel');var crypto=require(_0x1b48('0xc'));var jsforce=require(_0x1b48('0xd'));var deskjs=require(_0x1b48('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1b48('0xf'));var Papa=require('papaparse');var Redis=require(_0x1b48('0x10'));var authService=require(_0x1b48('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1b48('0x12'));var hardwareService=require(_0x1b48('0x13'));var logger=require(_0x1b48('0x14'))(_0x1b48('0x15'));var utils=require(_0x1b48('0x16'));var config=require(_0x1b48('0x17'));var licenseUtil=require(_0x1b48('0x18'));var db=require(_0x1b48('0x19'))['db'];function respondWithStatusCode(_0x52cbe3,_0x1df5a0){_0x1df5a0=_0x1df5a0||0xcc;return function(_0x13e690){if(_0x13e690){return _0x52cbe3['sendStatus'](_0x1df5a0);}return _0x52cbe3[_0x1b48('0x1a')](_0x1df5a0)[_0x1b48('0x1b')]();};}function respondWithResult(_0x52455c,_0x2d5f17){_0x2d5f17=_0x2d5f17||0xc8;return function(_0x334621){if(_0x334621){return _0x52455c['status'](_0x2d5f17)[_0x1b48('0x1c')](_0x334621);}};}function respondWithFilteredResult(_0x20a0bd,_0x32d4da){return function(_0x46ba17){if(_0x46ba17){var _0x3bb29a=_0x46ba17[_0x1b48('0x1d')],_0x4cc6d6=_0x32d4da[_0x1b48('0x1e')],_0x4f4477=_0x32d4da[_0x1b48('0x1e')]+_0x32d4da[_0x1b48('0x1f')],_0x701704;if(_0x4f4477>=_0x3bb29a){_0x4f4477=_0x3bb29a;_0x701704=0xc8;}else{_0x701704=0xce;}_0x20a0bd[_0x1b48('0x1a')](_0x701704);return _0x20a0bd[_0x1b48('0x20')](_0x1b48('0x21'),_0x4cc6d6+'-'+_0x4f4477+'/'+_0x3bb29a)[_0x1b48('0x1c')](_0x46ba17);}return null;};}function patchUpdates(_0x28e099){return function(_0x416118){try{jsonpatch[_0x1b48('0x22')](_0x416118,_0x28e099,!![]);}catch(_0x8e0db6){return BPromise[_0x1b48('0x23')](_0x8e0db6);}return _0x416118[_0x1b48('0x24')]();};}function saveUpdates(_0x486685,_0x176f02){return function(_0xa3ebe3){if(_0xa3ebe3){return _0xa3ebe3[_0x1b48('0x25')](_0x486685)[_0x1b48('0x26')](function(_0x4fc79d){return _0x4fc79d;});}return null;};}function removeEntity(_0x22a80f,_0x5802bd){return function(_0x172224){if(_0x172224){return _0x172224[_0x1b48('0x27')]()[_0x1b48('0x26')](function(){var _0x37d240=_0x172224[_0x1b48('0x28')]({'plain':!![]});var _0x7ca71c='CmContactHasPhones';return db[_0x1b48('0x29')]['destroy']({'where':{'type':_0x7ca71c,'resourceId':_0x37d240['id']}})[_0x1b48('0x26')](function(){return _0x172224;});})[_0x1b48('0x26')](function(){_0x22a80f[_0x1b48('0x1a')](0xcc)[_0x1b48('0x1b')]();});}};}function handleEntityNotFound(_0x1d8e37,_0x8adbdd){return function(_0x24b4ab){if(!_0x24b4ab){_0x1d8e37[_0x1b48('0x2a')](0x194);}return _0x24b4ab;};}function handleError(_0x529b61,_0x3224d6){_0x3224d6=_0x3224d6||0x1f4;return function(_0xa69a5d){logger['error'](_0xa69a5d['stack']);if(_0xa69a5d['name']){delete _0xa69a5d[_0x1b48('0x2b')];}_0x529b61['status'](_0x3224d6)[_0x1b48('0x2c')](_0xa69a5d);};}exports[_0x1b48('0x2d')]=function(_0x4d68eb,_0x169ddd){var _0x4b948f={},_0x139e4e={},_0x51b2b5={'count':0x0,'rows':[]};var _0x400057=_[_0x1b48('0x2e')](db['CmContactHasPhone']['rawAttributes'],function(_0xfe98f6){return{'name':_0xfe98f6['fieldName'],'type':_0xfe98f6[_0x1b48('0x2f')][_0x1b48('0x30')]};});_0x139e4e['model']=_['map'](_0x400057,_0x1b48('0x2b'));_0x139e4e[_0x1b48('0x31')]=_[_0x1b48('0x32')](_0x4d68eb[_0x1b48('0x31')]);_0x139e4e[_0x1b48('0x33')]=_[_0x1b48('0x34')](_0x139e4e[_0x1b48('0x35')],_0x139e4e[_0x1b48('0x31')]);_0x4b948f[_0x1b48('0x36')]=_[_0x1b48('0x34')](_0x139e4e['model'],qs['fields'](_0x4d68eb['query'][_0x1b48('0x37')]));_0x4b948f[_0x1b48('0x36')]=_0x4b948f[_0x1b48('0x36')][_0x1b48('0x38')]?_0x4b948f[_0x1b48('0x36')]:_0x139e4e[_0x1b48('0x35')];if(!_0x4d68eb[_0x1b48('0x31')]['hasOwnProperty'](_0x1b48('0x39'))){_0x4b948f[_0x1b48('0x1f')]=qs[_0x1b48('0x1f')](_0x4d68eb[_0x1b48('0x31')]['limit']);_0x4b948f[_0x1b48('0x1e')]=qs[_0x1b48('0x1e')](_0x4d68eb['query'][_0x1b48('0x1e')]);}_0x4b948f[_0x1b48('0x3a')]=qs[_0x1b48('0x3b')](_0x4d68eb[_0x1b48('0x31')][_0x1b48('0x3b')]);_0x4b948f['where']=qs[_0x1b48('0x33')](_[_0x1b48('0x3c')](_0x4d68eb['query'],_0x139e4e[_0x1b48('0x33')]),_0x400057);if(_0x4d68eb[_0x1b48('0x31')][_0x1b48('0x3d')]){_0x4b948f[_0x1b48('0x3e')]=_[_0x1b48('0x3f')](_0x4b948f[_0x1b48('0x3e')],{'$or':_[_0x1b48('0x2e')](_0x400057,function(_0x8f1933){if(_0x8f1933['type']!==_0x1b48('0x40')){var _0x551a26={};_0x551a26[_0x8f1933[_0x1b48('0x2b')]]={'$like':'%'+_0x4d68eb[_0x1b48('0x31')][_0x1b48('0x3d')]+'%'};return _0x551a26;}})});}_0x4b948f=_[_0x1b48('0x3f')]({},_0x4b948f,_0x4d68eb['options']);var _0x396d4f={'where':_0x4b948f[_0x1b48('0x3e')]};return db[_0x1b48('0x41')][_0x1b48('0x1d')](_0x396d4f)[_0x1b48('0x26')](function(_0x2f9d42){_0x51b2b5[_0x1b48('0x1d')]=_0x2f9d42;if(_0x4d68eb[_0x1b48('0x31')][_0x1b48('0x42')]){_0x4b948f[_0x1b48('0x43')]=[{'all':!![]}];}return db[_0x1b48('0x41')][_0x1b48('0x44')](_0x4b948f);})[_0x1b48('0x26')](function(_0x3321a8){_0x51b2b5['rows']=_0x3321a8;return _0x51b2b5;})[_0x1b48('0x26')](respondWithFilteredResult(_0x169ddd,_0x4b948f))[_0x1b48('0x45')](handleError(_0x169ddd,null));};exports['show']=function(_0x388229,_0x5e7bbc){var _0xb8de1={'raw':!![],'where':{'id':_0x388229['params']['id']}},_0x40aa4a={};_0x40aa4a[_0x1b48('0x35')]=_[_0x1b48('0x32')](db[_0x1b48('0x41')][_0x1b48('0x46')]);_0x40aa4a[_0x1b48('0x31')]=_[_0x1b48('0x32')](_0x388229[_0x1b48('0x31')]);_0x40aa4a[_0x1b48('0x33')]=_[_0x1b48('0x34')](_0x40aa4a[_0x1b48('0x35')],_0x40aa4a[_0x1b48('0x31')]);_0xb8de1[_0x1b48('0x36')]=_[_0x1b48('0x34')](_0x40aa4a[_0x1b48('0x35')],qs[_0x1b48('0x37')](_0x388229[_0x1b48('0x31')][_0x1b48('0x37')]));_0xb8de1[_0x1b48('0x36')]=_0xb8de1['attributes'][_0x1b48('0x38')]?_0xb8de1[_0x1b48('0x36')]:_0x40aa4a[_0x1b48('0x35')];if(_0x388229[_0x1b48('0x31')]['includeAll']){_0xb8de1[_0x1b48('0x43')]=[{'all':!![]}];}_0xb8de1=_[_0x1b48('0x3f')]({},_0xb8de1,_0x388229[_0x1b48('0x47')]);return db[_0x1b48('0x41')][_0x1b48('0x48')](_0xb8de1)['then'](handleEntityNotFound(_0x5e7bbc,null))[_0x1b48('0x26')](respondWithResult(_0x5e7bbc,null))[_0x1b48('0x45')](handleError(_0x5e7bbc,null));};exports['create']=function(_0x5f9d5e,_0xfe52f2){return db['CmContactHasPhone'][_0x1b48('0x49')](_0x5f9d5e['body'],{})[_0x1b48('0x26')](function(_0x3a4df6){var _0x12e256=_0x5f9d5e[_0x1b48('0x4a')][_0x1b48('0x28')]({'plain':!![]});if(!_0x12e256)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12e256[_0x1b48('0x4b')]===_0x1b48('0x4a')){var _0xfee19f=_0x3a4df6['get']({'plain':!![]});var _0x3f3313=_0x1b48('0x4c');return db[_0x1b48('0x4d')]['find']({'where':{'name':_0x3f3313,'userProfileId':_0x12e256[_0x1b48('0x4e')]},'raw':!![]})[_0x1b48('0x26')](function(_0x1f3e84){if(_0x1f3e84&&_0x1f3e84['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xfee19f['name'],'resourceId':_0xfee19f['id'],'type':_0x1f3e84[_0x1b48('0x2b')],'sectionId':_0x1f3e84['id']},{})[_0x1b48('0x26')](function(){return _0x3a4df6;});}else{return _0x3a4df6;}})[_0x1b48('0x45')](function(_0x401199){logger[_0x1b48('0x4f')](_0x1b48('0x50'),_0x401199);throw _0x401199;});}return _0x3a4df6;})[_0x1b48('0x26')](respondWithResult(_0xfe52f2,0xc9))['catch'](handleError(_0xfe52f2,null));};exports['update']=function(_0x1e5c6a,_0x1b4724){if(_0x1e5c6a[_0x1b48('0x51')]['id']){delete _0x1e5c6a[_0x1b48('0x51')]['id'];}return db[_0x1b48('0x41')][_0x1b48('0x48')]({'where':{'id':_0x1e5c6a[_0x1b48('0x52')]['id']}})[_0x1b48('0x26')](handleEntityNotFound(_0x1b4724,null))['then'](saveUpdates(_0x1e5c6a['body'],null))[_0x1b48('0x26')](respondWithResult(_0x1b4724,null))[_0x1b48('0x45')](handleError(_0x1b4724,null));};exports[_0x1b48('0x27')]=function(_0x48da2c,_0x3d9232){return db['CmContactHasPhone'][_0x1b48('0x48')]({'where':{'id':_0x48da2c['params']['id']}})[_0x1b48('0x26')](handleEntityNotFound(_0x3d9232,null))['then'](removeEntity(_0x3d9232,null))[_0x1b48('0x45')](handleError(_0x3d9232,null));}; \ No newline at end of file +var _0x755b=['UserProfileResource','end','error','stack','name','send','index','map','CmContactHasPhone','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','CmContactHasPhones'];(function(_0x42c555,_0x29b3a5){var _0x46fbf7=function(_0x3e66cf){while(--_0x3e66cf){_0x42c555['push'](_0x42c555['shift']());}};_0x46fbf7(++_0x29b3a5);}(_0x755b,0x1cc));var _0xb755=function(_0x5e551d,_0x221082){_0x5e551d=_0x5e551d-0x0;var _0x552c34=_0x755b[_0x5e551d];return _0x552c34;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb755('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb755('0x1'));var jsonpatch=require(_0xb755('0x2'));var rp=require('request-promise');var moment=require(_0xb755('0x3'));var BPromise=require(_0xb755('0x4'));var Mustache=require(_0xb755('0x5'));var util=require(_0xb755('0x6'));var path=require(_0xb755('0x7'));var sox=require('sox');var csv=require(_0xb755('0x8'));var ejs=require(_0xb755('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb755('0xa'));var crypto=require(_0xb755('0xb'));var jsforce=require(_0xb755('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb755('0x8'));var querystring=require(_0xb755('0xd'));var Papa=require('papaparse');var Redis=require(_0xb755('0xe'));var authService=require(_0xb755('0xf'));var qs=require(_0xb755('0x10'));var as=require(_0xb755('0x11'));var hardwareService=require(_0xb755('0x12'));var logger=require(_0xb755('0x13'))(_0xb755('0x14'));var utils=require('../../config/utils');var config=require(_0xb755('0x15'));var licenseUtil=require(_0xb755('0x16'));var db=require(_0xb755('0x17'))['db'];function respondWithStatusCode(_0x59aae3,_0x45a040){_0x45a040=_0x45a040||0xcc;return function(_0xa140b6){if(_0xa140b6){return _0x59aae3[_0xb755('0x18')](_0x45a040);}return _0x59aae3['status'](_0x45a040)['end']();};}function respondWithResult(_0x2ebd26,_0x2dd6fb){_0x2dd6fb=_0x2dd6fb||0xc8;return function(_0x358120){if(_0x358120){return _0x2ebd26[_0xb755('0x19')](_0x2dd6fb)['json'](_0x358120);}};}function respondWithFilteredResult(_0x30b9f6,_0x5685f4){return function(_0x564807){if(_0x564807){var _0x3349d0=_0x564807[_0xb755('0x1a')],_0x13a156=_0x5685f4[_0xb755('0x1b')],_0x22a70b=_0x5685f4[_0xb755('0x1b')]+_0x5685f4[_0xb755('0x1c')],_0x51f767;if(_0x22a70b>=_0x3349d0){_0x22a70b=_0x3349d0;_0x51f767=0xc8;}else{_0x51f767=0xce;}_0x30b9f6[_0xb755('0x19')](_0x51f767);return _0x30b9f6[_0xb755('0x1d')](_0xb755('0x1e'),_0x13a156+'-'+_0x22a70b+'/'+_0x3349d0)[_0xb755('0x1f')](_0x564807);}return null;};}function patchUpdates(_0x43efb4){return function(_0x55adcf){try{jsonpatch[_0xb755('0x20')](_0x55adcf,_0x43efb4,!![]);}catch(_0x6e6da0){return BPromise['reject'](_0x6e6da0);}return _0x55adcf[_0xb755('0x21')]();};}function saveUpdates(_0x5386f3,_0x546631){return function(_0x68ff4c){if(_0x68ff4c){return _0x68ff4c[_0xb755('0x22')](_0x5386f3)[_0xb755('0x23')](function(_0xc030fe){return _0xc030fe;});}return null;};}function removeEntity(_0x408a96,_0x56c54b){return function(_0x7d7e6b){if(_0x7d7e6b){return _0x7d7e6b[_0xb755('0x24')]()[_0xb755('0x23')](function(){var _0x3bc401=_0x7d7e6b['get']({'plain':!![]});var _0x1f3a73=_0xb755('0x25');return db[_0xb755('0x26')][_0xb755('0x24')]({'where':{'type':_0x1f3a73,'resourceId':_0x3bc401['id']}})[_0xb755('0x23')](function(){return _0x7d7e6b;});})[_0xb755('0x23')](function(){_0x408a96[_0xb755('0x19')](0xcc)[_0xb755('0x27')]();});}};}function handleEntityNotFound(_0x4607f7,_0x4f2a3f){return function(_0x474a8c){if(!_0x474a8c){_0x4607f7['sendStatus'](0x194);}return _0x474a8c;};}function handleError(_0x5bd09f,_0x44d6f7){_0x44d6f7=_0x44d6f7||0x1f4;return function(_0x1ee053){logger[_0xb755('0x28')](_0x1ee053[_0xb755('0x29')]);if(_0x1ee053['name']){delete _0x1ee053[_0xb755('0x2a')];}_0x5bd09f[_0xb755('0x19')](_0x44d6f7)[_0xb755('0x2b')](_0x1ee053);};}exports[_0xb755('0x2c')]=function(_0x4c1b88,_0x197d73){var _0x281c93={},_0x190512={},_0x3acd5d={'count':0x0,'rows':[]};var _0x382a9b=_[_0xb755('0x2d')](db[_0xb755('0x2e')][_0xb755('0x2f')],function(_0x3fefab){return{'name':_0x3fefab[_0xb755('0x30')],'type':_0x3fefab[_0xb755('0x31')][_0xb755('0x32')]};});_0x190512['model']=_['map'](_0x382a9b,'name');_0x190512['query']=_[_0xb755('0x33')](_0x4c1b88['query']);_0x190512[_0xb755('0x34')]=_['intersection'](_0x190512[_0xb755('0x35')],_0x190512[_0xb755('0x36')]);_0x281c93[_0xb755('0x37')]=_[_0xb755('0x38')](_0x190512[_0xb755('0x35')],qs[_0xb755('0x39')](_0x4c1b88[_0xb755('0x36')]['fields']));_0x281c93['attributes']=_0x281c93['attributes'][_0xb755('0x3a')]?_0x281c93[_0xb755('0x37')]:_0x190512[_0xb755('0x35')];if(!_0x4c1b88[_0xb755('0x36')][_0xb755('0x3b')](_0xb755('0x3c'))){_0x281c93[_0xb755('0x1c')]=qs[_0xb755('0x1c')](_0x4c1b88[_0xb755('0x36')]['limit']);_0x281c93[_0xb755('0x1b')]=qs[_0xb755('0x1b')](_0x4c1b88[_0xb755('0x36')]['offset']);}_0x281c93[_0xb755('0x3d')]=qs[_0xb755('0x3e')](_0x4c1b88[_0xb755('0x36')]['sort']);_0x281c93[_0xb755('0x3f')]=qs['filters'](_['pick'](_0x4c1b88['query'],_0x190512[_0xb755('0x34')]),_0x382a9b);if(_0x4c1b88['query']['filter']){_0x281c93[_0xb755('0x3f')]=_[_0xb755('0x40')](_0x281c93[_0xb755('0x3f')],{'$or':_['map'](_0x382a9b,function(_0x34a980){if(_0x34a980[_0xb755('0x31')]!==_0xb755('0x41')){var _0x5093d9={};_0x5093d9[_0x34a980[_0xb755('0x2a')]]={'$like':'%'+_0x4c1b88[_0xb755('0x36')][_0xb755('0x42')]+'%'};return _0x5093d9;}})});}_0x281c93=_[_0xb755('0x40')]({},_0x281c93,_0x4c1b88[_0xb755('0x43')]);var _0x16082b={'where':_0x281c93[_0xb755('0x3f')]};return db[_0xb755('0x2e')][_0xb755('0x1a')](_0x16082b)[_0xb755('0x23')](function(_0xee4e43){_0x3acd5d[_0xb755('0x1a')]=_0xee4e43;if(_0x4c1b88[_0xb755('0x36')]['includeAll']){_0x281c93[_0xb755('0x44')]=[{'all':!![]}];}return db['CmContactHasPhone'][_0xb755('0x45')](_0x281c93);})['then'](function(_0x470ae7){_0x3acd5d[_0xb755('0x46')]=_0x470ae7;return _0x3acd5d;})[_0xb755('0x23')](respondWithFilteredResult(_0x197d73,_0x281c93))['catch'](handleError(_0x197d73,null));};exports[_0xb755('0x47')]=function(_0x1c6939,_0x37e493){var _0x28b926={'raw':!![],'where':{'id':_0x1c6939[_0xb755('0x48')]['id']}},_0x16ab63={};_0x16ab63[_0xb755('0x35')]=_['keys'](db[_0xb755('0x2e')][_0xb755('0x2f')]);_0x16ab63[_0xb755('0x36')]=_['keys'](_0x1c6939[_0xb755('0x36')]);_0x16ab63[_0xb755('0x34')]=_[_0xb755('0x38')](_0x16ab63[_0xb755('0x35')],_0x16ab63[_0xb755('0x36')]);_0x28b926[_0xb755('0x37')]=_['intersection'](_0x16ab63[_0xb755('0x35')],qs[_0xb755('0x39')](_0x1c6939[_0xb755('0x36')][_0xb755('0x39')]));_0x28b926[_0xb755('0x37')]=_0x28b926['attributes'][_0xb755('0x3a')]?_0x28b926[_0xb755('0x37')]:_0x16ab63[_0xb755('0x35')];if(_0x1c6939['query'][_0xb755('0x49')]){_0x28b926[_0xb755('0x44')]=[{'all':!![]}];}_0x28b926=_[_0xb755('0x40')]({},_0x28b926,_0x1c6939[_0xb755('0x43')]);return db[_0xb755('0x2e')][_0xb755('0x4a')](_0x28b926)['then'](handleEntityNotFound(_0x37e493,null))[_0xb755('0x23')](respondWithResult(_0x37e493,null))['catch'](handleError(_0x37e493,null));};exports[_0xb755('0x4b')]=function(_0x3cc090,_0x4b24db){return db[_0xb755('0x2e')][_0xb755('0x4b')](_0x3cc090[_0xb755('0x4c')],{})[_0xb755('0x23')](function(_0x406ebe){var _0x17f882=_0x3cc090[_0xb755('0x4d')][_0xb755('0x4e')]({'plain':!![]});if(!_0x17f882)throw new Error(_0xb755('0x4f'));if(_0x17f882[_0xb755('0x50')]===_0xb755('0x4d')){var _0x28b726=_0x406ebe[_0xb755('0x4e')]({'plain':!![]});var _0x5e876f='CmContactHasPhones';return db['UserProfileSection']['find']({'where':{'name':_0x5e876f,'userProfileId':_0x17f882['userProfileId']},'raw':!![]})[_0xb755('0x23')](function(_0x23e0a3){if(_0x23e0a3&&_0x23e0a3['autoAssociation']===0x0){return db[_0xb755('0x26')]['create']({'name':_0x28b726[_0xb755('0x2a')],'resourceId':_0x28b726['id'],'type':_0x23e0a3[_0xb755('0x2a')],'sectionId':_0x23e0a3['id']},{})[_0xb755('0x23')](function(){return _0x406ebe;});}else{return _0x406ebe;}})[_0xb755('0x51')](function(_0x1afcb3){logger['error'](_0xb755('0x52'),_0x1afcb3);throw _0x1afcb3;});}return _0x406ebe;})[_0xb755('0x23')](respondWithResult(_0x4b24db,0xc9))[_0xb755('0x51')](handleError(_0x4b24db,null));};exports[_0xb755('0x22')]=function(_0x553891,_0x1fe7b8){if(_0x553891['body']['id']){delete _0x553891[_0xb755('0x4c')]['id'];}return db['CmContactHasPhone']['find']({'where':{'id':_0x553891['params']['id']}})[_0xb755('0x23')](handleEntityNotFound(_0x1fe7b8,null))[_0xb755('0x23')](saveUpdates(_0x553891['body'],null))[_0xb755('0x23')](respondWithResult(_0x1fe7b8,null))[_0xb755('0x51')](handleError(_0x1fe7b8,null));};exports[_0xb755('0x24')]=function(_0x263a79,_0x30835e){return db[_0xb755('0x2e')][_0xb755('0x4a')]({'where':{'id':_0x263a79[_0xb755('0x48')]['id']}})['then'](handleEntityNotFound(_0x30835e,null))[_0xb755('0x23')](removeEntity(_0x30835e,null))['catch'](handleError(_0x30835e,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index be78078..1194257 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 _0xecd0=['define','CmContactHasPhone','cm_contact_has_phones','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3e8a3f,_0x3fd3f0){var _0x5d3ff6=function(_0x4eaa29){while(--_0x4eaa29){_0x3e8a3f['push'](_0x3e8a3f['shift']());}};_0x5d3ff6(++_0x3fd3f0);}(_0xecd0,0x162));var _0x0ecd=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0xecd0[_0x459a0a];return _0x4ab46c;};'use strict';var _=require(_0x0ecd('0x0'));var util=require(_0x0ecd('0x1'));var logger=require(_0x0ecd('0x2'))(_0x0ecd('0x3'));var moment=require(_0x0ecd('0x4'));var BPromise=require('bluebird');var rp=require(_0x0ecd('0x5'));var fs=require('fs');var path=require(_0x0ecd('0x6'));var rimraf=require(_0x0ecd('0x7'));var config=require(_0x0ecd('0x8'));var attributes=require('./cmContactHasPhone.attributes');module[_0x0ecd('0x9')]=function(_0x1cde06,_0xff2f1c){return _0x1cde06[_0x0ecd('0xa')](_0x0ecd('0xb'),attributes,{'tableName':_0x0ecd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84e6=['util','../../config/logger','api','request-promise','../../config/environment','./cmContactHasPhone.attributes','exports','CmContactHasPhone','lodash'];(function(_0x55a5dc,_0x5ecda8){var _0x534d12=function(_0x5292e2){while(--_0x5292e2){_0x55a5dc['push'](_0x55a5dc['shift']());}};_0x534d12(++_0x5ecda8);}(_0x84e6,0x8f));var _0x684e=function(_0x3f6ce1,_0x5360df){_0x3f6ce1=_0x3f6ce1-0x0;var _0x3e3106=_0x84e6[_0x3f6ce1];return _0x3e3106;};'use strict';var _=require(_0x684e('0x0'));var util=require(_0x684e('0x1'));var logger=require(_0x684e('0x2'))(_0x684e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x684e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x684e('0x5'));var attributes=require(_0x684e('0x6'));module[_0x684e('0x7')]=function(_0x58d742,_0x1dfb0b){return _0x58d742['define'](_0x684e('0x8'),attributes,{'tableName':'cm_contact_has_phones','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 7b422d9..870eb2f 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 _0xb48c=['client','http','request','then','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2f6541,_0x363cba){var _0x4d76d8=function(_0x86404){while(--_0x86404){_0x2f6541['push'](_0x2f6541['shift']());}};_0x4d76d8(++_0x363cba);}(_0xb48c,0xdd));var _0xcb48=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb48c[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xcb48('0x0'));var util=require(_0xcb48('0x1'));var moment=require(_0xcb48('0x2'));var BPromise=require('bluebird');var rs=require(_0xcb48('0x3'));var fs=require('fs');var Redis=require(_0xcb48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb48('0x5'));var logger=require(_0xcb48('0x6'))(_0xcb48('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb48('0x8'));var client=jayson[_0xcb48('0x9')][_0xcb48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a477d,_0x4db4fa,_0x1c1256){return new BPromise(function(_0x4a67fb,_0x43dc84){return client[_0xcb48('0xb')](_0x5a477d,_0x1c1256)[_0xcb48('0xc')](function(_0x584cbf){logger[_0xcb48('0xd')](_0xcb48('0xe'),_0x4db4fa,_0xcb48('0xf'));logger[_0xcb48('0x10')](_0xcb48('0x11'),_0x4db4fa,'request\x20sent',JSON[_0xcb48('0x12')](_0x584cbf));if(_0x584cbf[_0xcb48('0x13')]){if(_0x584cbf['error']['code']===0x1f4){logger[_0xcb48('0x13')](_0xcb48('0xe'),_0x4db4fa,_0x584cbf[_0xcb48('0x13')][_0xcb48('0x14')]);return _0x43dc84(_0x584cbf[_0xcb48('0x13')][_0xcb48('0x14')]);}logger[_0xcb48('0x13')]('CmContactHasPhone,\x20%s,\x20%s',_0x4db4fa,_0x584cbf[_0xcb48('0x13')][_0xcb48('0x14')]);return _0x4a67fb(_0x584cbf[_0xcb48('0x13')][_0xcb48('0x14')]);}else{logger[_0xcb48('0xd')](_0xcb48('0xe'),_0x4db4fa,_0xcb48('0xf'));_0x4a67fb(_0x584cbf[_0xcb48('0x15')][_0xcb48('0x14')]);}})[_0xcb48('0x16')](function(_0x502940){logger[_0xcb48('0x13')]('CmContactHasPhone,\x20%s,\x20%s',_0x4db4fa,_0x502940);_0x43dc84(_0x502940);});});} \ No newline at end of file +var _0x2c43=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','error','code','CmContactHasPhone,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring'];(function(_0x264767,_0x460fbb){var _0x46084f=function(_0x4fbeac){while(--_0x4fbeac){_0x264767['push'](_0x264767['shift']());}};_0x46084f(++_0x460fbb);}(_0x2c43,0xfa));var _0x32c4=function(_0x442a31,_0x47c835){_0x442a31=_0x442a31-0x0;var _0x5bad90=_0x2c43[_0x442a31];return _0x5bad90;};'use strict';var _=require('lodash');var util=require(_0x32c4('0x0'));var moment=require('moment');var BPromise=require(_0x32c4('0x1'));var rs=require(_0x32c4('0x2'));var fs=require('fs');var Redis=require(_0x32c4('0x3'));var db=require(_0x32c4('0x4'))['db'];var utils=require(_0x32c4('0x5'));var logger=require(_0x32c4('0x6'))(_0x32c4('0x7'));var config=require(_0x32c4('0x8'));var jayson=require(_0x32c4('0x9'));var client=jayson[_0x32c4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17b3ba,_0x3a9092,_0x18b368){return new BPromise(function(_0x5c69f1,_0xf57ab4){return client[_0x32c4('0xb')](_0x17b3ba,_0x18b368)[_0x32c4('0xc')](function(_0x57eebf){logger[_0x32c4('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x3a9092,_0x32c4('0xe'));logger[_0x32c4('0xf')](_0x32c4('0x10'),_0x3a9092,_0x32c4('0xe'),JSON['stringify'](_0x57eebf));if(_0x57eebf[_0x32c4('0x11')]){if(_0x57eebf[_0x32c4('0x11')][_0x32c4('0x12')]===0x1f4){logger[_0x32c4('0x11')](_0x32c4('0x13'),_0x3a9092,_0x57eebf[_0x32c4('0x11')]['message']);return _0xf57ab4(_0x57eebf[_0x32c4('0x11')][_0x32c4('0x14')]);}logger[_0x32c4('0x11')](_0x32c4('0x13'),_0x3a9092,_0x57eebf['error']['message']);return _0x5c69f1(_0x57eebf[_0x32c4('0x11')][_0x32c4('0x14')]);}else{logger[_0x32c4('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x3a9092,'request\x20sent');_0x5c69f1(_0x57eebf[_0x32c4('0x15')][_0x32c4('0x14')]);}})[_0x32c4('0x16')](function(_0x371a22){logger[_0x32c4('0x11')](_0x32c4('0x13'),_0x3a9092,_0x371a22);_0xf57ab4(_0x371a22);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 8c37714..e109604 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 _0x249a=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x54b0c5,_0x9c7637){var _0x1039fb=function(_0x297916){while(--_0x297916){_0x54b0c5['push'](_0x54b0c5['shift']());}};_0x1039fb(++_0x9c7637);}(_0x249a,0x124));var _0xa249=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x249a[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require('multer');var util=require(_0xa249('0x0'));var path=require(_0xa249('0x1'));var timeout=require(_0xa249('0x2'));var express=require('express');var router=express[_0xa249('0x3')]();var auth=require(_0xa249('0x4'));var interaction=require(_0xa249('0x5'));var config=require(_0xa249('0x6'));var controller=require(_0xa249('0x7'));router[_0xa249('0x8')]('/',auth[_0xa249('0x9')](),controller[_0xa249('0xa')]);router[_0xa249('0x8')](_0xa249('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa249('0xc')]('/',auth[_0xa249('0x9')](),controller[_0xa249('0xd')]);router[_0xa249('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa249('0xf')]);router[_0xa249('0x10')](_0xa249('0xb'),auth[_0xa249('0x9')](),controller[_0xa249('0x11')]);module[_0xa249('0x12')]=router; \ No newline at end of file +var _0x183d=['show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated'];(function(_0x145e9e,_0x2e6dd4){var _0x2264c2=function(_0x57d209){while(--_0x57d209){_0x145e9e['push'](_0x145e9e['shift']());}};_0x2264c2(++_0x2e6dd4);}(_0x183d,0x1b8));var _0xd183=function(_0x21605f,_0x22308a){_0x21605f=_0x21605f-0x0;var _0x466f25=_0x183d[_0x21605f];return _0x466f25;};'use strict';var multer=require(_0xd183('0x0'));var util=require('util');var path=require(_0xd183('0x1'));var timeout=require(_0xd183('0x2'));var express=require(_0xd183('0x3'));var router=express[_0xd183('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd183('0x5'));var controller=require('./cmContactHasPhone.controller');router[_0xd183('0x6')]('/',auth[_0xd183('0x7')](),controller['index']);router[_0xd183('0x6')]('/:id',auth[_0xd183('0x7')](),controller[_0xd183('0x8')]);router[_0xd183('0x9')]('/',auth[_0xd183('0x7')](),controller[_0xd183('0xa')]);router[_0xd183('0xb')](_0xd183('0xc'),auth[_0xd183('0x7')](),controller[_0xd183('0xd')]);router[_0xd183('0xe')](_0xd183('0xc'),auth[_0xd183('0x7')](),controller['destroy']);module[_0xd183('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index a90d6d6..08a874f 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 _0x6737=['ENUM','voice','lodash','exports','getDataValue','alias','STRING','setDataValue','name','select','values','isArray','stringify','BOOLEAN'];(function(_0x5ae761,_0x9afc7c){var _0x42add3=function(_0x5e0fa8){while(--_0x5e0fa8){_0x5ae761['push'](_0x5ae761['shift']());}};_0x42add3(++_0x9afc7c);}(_0x6737,0xe2));var _0x7673=function(_0x4fb876,_0x45ab98){_0x4fb876=_0x4fb876-0x0;var _0x52b6c9=_0x6737[_0x4fb876];return _0x52b6c9;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7673('0x0'));module[_0x7673('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2f05d4){return this[_0x7673('0x2')](_0x7673('0x3'));}},'alias':{'type':Sequelize[_0x7673('0x4')],'allowNull':![],'set':function(_0x54002e){this[_0x7673('0x5')](_0x7673('0x3'),_0x54002e?_0x54002e:this['getDataValue'](_0x7673('0x6')));}},'type':{'type':Sequelize[_0x7673('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this['getDataValue']('type')===_0x7673('0x7')){return JSON['parse'](this[_0x7673('0x2')](_0x7673('0x8')));}else{return this['getDataValue'](_0x7673('0x8'));}},'set':function(_0x331f57){if(Array[_0x7673('0x9')](_0x331f57)){this['setDataValue']('values',JSON[_0x7673('0xa')](_0x331f57));}else{this['setDataValue'](_0x7673('0x8'),_0x331f57);}}},'required':{'type':Sequelize[_0x7673('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7673('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7673('0xc')](_0x7673('0xd'))}}; \ No newline at end of file +var _0x5178=['TEXT','long','type','parse','values','isArray','stringify','BOOLEAN','voice','lodash','exports','VIRTUAL','getDataValue','setDataValue','STRING'];(function(_0x3b24f2,_0x1b5c40){var _0x2d0a30=function(_0x2a0071){while(--_0x2a0071){_0x3b24f2['push'](_0x3b24f2['shift']());}};_0x2d0a30(++_0x1b5c40);}(_0x5178,0x171));var _0x8517=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5178[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');var _=require(_0x8517('0x0'));module[_0x8517('0x1')]={'name':{'type':Sequelize[_0x8517('0x2')],'get':function(_0x2dc28f){return this[_0x8517('0x3')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3ed6a5){this[_0x8517('0x4')]('alias',_0x3ed6a5?_0x3ed6a5:this[_0x8517('0x3')]('name'));}},'type':{'type':Sequelize[_0x8517('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x8517('0x6')](_0x8517('0x7')),'get':function(){if(this[_0x8517('0x3')](_0x8517('0x8'))==='select'){return JSON[_0x8517('0x9')](this['getDataValue']('values'));}else{return this[_0x8517('0x3')](_0x8517('0xa'));}},'set':function(_0x4dac4d){if(Array[_0x8517('0xb')](_0x4dac4d)){this[_0x8517('0x4')](_0x8517('0xa'),JSON[_0x8517('0xc')](_0x4dac4d));}else{this[_0x8517('0x4')](_0x8517('0xa'),_0x4dac4d);}}},'required':{'type':Sequelize[_0x8517('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8517('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x8517('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index aa404f8..436624c 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 _0x0dbf=['lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','body','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x4325be,_0x29692c){var _0x3cf5a6=function(_0x2ba6f6){while(--_0x2ba6f6){_0x4325be['push'](_0x4325be['shift']());}};_0x3cf5a6(++_0x29692c);}(_0x0dbf,0x1a9));var _0xf0db=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0x0dbf[_0x1fa759];return _0x2da9f4;};'use strict';var pdf=require(_0xf0db('0x0'));var emlformat=require(_0xf0db('0x1'));var rimraf=require(_0xf0db('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf0db('0x3'));var BPromise=require(_0xf0db('0x4'));var Mustache=require(_0xf0db('0x5'));var util=require('util');var path=require(_0xf0db('0x6'));var sox=require(_0xf0db('0x7'));var csv=require(_0xf0db('0x8'));var ejs=require(_0xf0db('0x9'));var fs=require('fs');var _=require(_0xf0db('0xa'));var squel=require(_0xf0db('0xb'));var crypto=require(_0xf0db('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf0db('0x8'));var querystring=require(_0xf0db('0xd'));var Papa=require('papaparse');var Redis=require(_0xf0db('0xe'));var authService=require(_0xf0db('0xf'));var qs=require(_0xf0db('0x10'));var as=require(_0xf0db('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0db('0x12'))(_0xf0db('0x13'));var utils=require(_0xf0db('0x14'));var config=require(_0xf0db('0x15'));var licenseUtil=require(_0xf0db('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10ed1a,_0x18a351){_0x18a351=_0x18a351||0xcc;return function(_0x5b6e8b){if(_0x5b6e8b){return _0x10ed1a[_0xf0db('0x17')](_0x18a351);}return _0x10ed1a[_0xf0db('0x18')](_0x18a351)[_0xf0db('0x19')]();};}function respondWithResult(_0x53bef9,_0xc8f9e1){_0xc8f9e1=_0xc8f9e1||0xc8;return function(_0x4fa1c0){if(_0x4fa1c0){return _0x53bef9[_0xf0db('0x18')](_0xc8f9e1)[_0xf0db('0x1a')](_0x4fa1c0);}};}function respondWithFilteredResult(_0x237e6f,_0x445c85){return function(_0x5b13ad){if(_0x5b13ad){var _0x13b5a7=_0x5b13ad[_0xf0db('0x1b')],_0xa19108=_0x445c85[_0xf0db('0x1c')],_0x2fc126=_0x445c85[_0xf0db('0x1c')]+_0x445c85[_0xf0db('0x1d')],_0x4982fa;if(_0x2fc126>=_0x13b5a7){_0x2fc126=_0x13b5a7;_0x4982fa=0xc8;}else{_0x4982fa=0xce;}_0x237e6f[_0xf0db('0x18')](_0x4982fa);return _0x237e6f[_0xf0db('0x1e')]('Content-Range',_0xa19108+'-'+_0x2fc126+'/'+_0x13b5a7)[_0xf0db('0x1a')](_0x5b13ad);}return null;};}function patchUpdates(_0x32d334){return function(_0x346a41){try{jsonpatch[_0xf0db('0x1f')](_0x346a41,_0x32d334,!![]);}catch(_0x21dbc3){return BPromise[_0xf0db('0x20')](_0x21dbc3);}return _0x346a41[_0xf0db('0x21')]();};}function saveUpdates(_0x5715af,_0x30f9a2){return function(_0x4213ee){if(_0x4213ee){return _0x4213ee[_0xf0db('0x22')](_0x5715af)[_0xf0db('0x23')](function(_0x450b90){return _0x450b90;});}return null;};}function removeEntity(_0x2cf6e7,_0x2676b5){return function(_0x2ee523){if(_0x2ee523){return _0x2ee523[_0xf0db('0x24')]()[_0xf0db('0x23')](function(){_0x2cf6e7[_0xf0db('0x18')](0xcc)[_0xf0db('0x19')]();});}};}function handleEntityNotFound(_0x4f1f76,_0x102960){return function(_0xec85b){if(!_0xec85b){_0x4f1f76[_0xf0db('0x17')](0x194);}return _0xec85b;};}function handleError(_0x37d989,_0x1cc976){_0x1cc976=_0x1cc976||0x1f4;return function(_0x3c48ca){logger[_0xf0db('0x25')](_0x3c48ca['stack']);if(_0x3c48ca[_0xf0db('0x26')]){delete _0x3c48ca['name'];}_0x37d989[_0xf0db('0x18')](_0x1cc976)[_0xf0db('0x27')](_0x3c48ca);};}exports['index']=function(_0x1e23e1,_0x18eac2){var _0x4217d8={},_0x4dfcc4={},_0x8a8c07={'count':0x0,'rows':[]};var _0x343fb8=_[_0xf0db('0x28')](db[_0xf0db('0x29')][_0xf0db('0x2a')],function(_0x1f7c98){return{'name':_0x1f7c98[_0xf0db('0x2b')],'type':_0x1f7c98[_0xf0db('0x2c')][_0xf0db('0x2d')]};});_0x4dfcc4[_0xf0db('0x2e')]=_[_0xf0db('0x2f')](_[_0xf0db('0x28')](_0x343fb8,'name'),[_0xf0db('0x26')]);_0x4dfcc4[_0xf0db('0x30')]=_[_0xf0db('0x31')](_0x1e23e1['query']);_0x4dfcc4[_0xf0db('0x32')]=_[_0xf0db('0x33')](_0x4dfcc4[_0xf0db('0x2e')],_0x4dfcc4[_0xf0db('0x30')]);_0x4217d8[_0xf0db('0x34')]=_[_0xf0db('0x33')](_0x4dfcc4[_0xf0db('0x2e')],qs[_0xf0db('0x35')](_0x1e23e1[_0xf0db('0x30')][_0xf0db('0x35')]));_0x4217d8[_0xf0db('0x34')]=_0x4217d8[_0xf0db('0x34')][_0xf0db('0x36')]?_0x4217d8[_0xf0db('0x34')]:_0x4dfcc4[_0xf0db('0x2e')];if(!_0x1e23e1[_0xf0db('0x30')][_0xf0db('0x37')]('nolimit')){_0x4217d8['limit']=qs['limit'](_0x1e23e1[_0xf0db('0x30')][_0xf0db('0x1d')]);_0x4217d8[_0xf0db('0x1c')]=qs[_0xf0db('0x1c')](_0x1e23e1['query'][_0xf0db('0x1c')]);}_0x4217d8[_0xf0db('0x38')]=qs[_0xf0db('0x39')](_0x1e23e1[_0xf0db('0x30')]['sort']);_0x4217d8['where']=qs[_0xf0db('0x32')](_[_0xf0db('0x3a')](_0x1e23e1['query'],_0x4dfcc4[_0xf0db('0x32')]),_0x343fb8);if(_0x1e23e1['query'][_0xf0db('0x3b')]){_0x4217d8[_0xf0db('0x3c')]=_[_0xf0db('0x3d')](_0x4217d8[_0xf0db('0x3c')],{'$or':_[_0xf0db('0x28')](_0x343fb8,function(_0x3984cd){if(_0x3984cd[_0xf0db('0x2c')]!==_0xf0db('0x3e')){var _0x59ffb3={};_0x59ffb3[_0x3984cd[_0xf0db('0x26')]]={'$like':'%'+_0x1e23e1[_0xf0db('0x30')][_0xf0db('0x3b')]+'%'};return _0x59ffb3;}})});}_0x4217d8=_[_0xf0db('0x3d')]({},_0x4217d8,_0x1e23e1[_0xf0db('0x3f')]);var _0x194fb1={'where':_0x4217d8['where']};return db[_0xf0db('0x29')][_0xf0db('0x1b')](_0x194fb1)[_0xf0db('0x23')](function(_0x35a11d){_0x8a8c07['count']=_0x35a11d;if(_0x1e23e1[_0xf0db('0x30')][_0xf0db('0x40')]){_0x4217d8[_0xf0db('0x41')]=[{'all':!![]}];}return db[_0xf0db('0x29')][_0xf0db('0x42')](_0x4217d8);})['then'](function(_0x25996d){_0x8a8c07['rows']=_0x25996d;return _0x8a8c07;})[_0xf0db('0x23')](respondWithFilteredResult(_0x18eac2,_0x4217d8))[_0xf0db('0x43')](handleError(_0x18eac2,null));};exports[_0xf0db('0x44')]=function(_0x5b7f9f,_0x550016){var _0x153b64={'raw':!![],'where':{'id':_0x5b7f9f[_0xf0db('0x45')]['id']}},_0x198a39={};_0x198a39[_0xf0db('0x2e')]=_[_0xf0db('0x31')](db['CmCustomField'][_0xf0db('0x2a')]);_0x198a39['query']=_[_0xf0db('0x31')](_0x5b7f9f[_0xf0db('0x30')]);_0x198a39[_0xf0db('0x32')]=_[_0xf0db('0x33')](_0x198a39[_0xf0db('0x2e')],_0x198a39[_0xf0db('0x30')]);_0x153b64[_0xf0db('0x34')]=_[_0xf0db('0x33')](_0x198a39[_0xf0db('0x2e')],qs[_0xf0db('0x35')](_0x5b7f9f['query'][_0xf0db('0x35')]));_0x153b64[_0xf0db('0x34')]=_0x153b64[_0xf0db('0x34')]['length']?_0x153b64['attributes']:_0x198a39['model'];if(_0x5b7f9f[_0xf0db('0x30')]['includeAll']){_0x153b64[_0xf0db('0x41')]=[{'all':!![]}];}_0x153b64=_[_0xf0db('0x3d')]({},_0x153b64,_0x5b7f9f[_0xf0db('0x3f')]);return db[_0xf0db('0x29')][_0xf0db('0x46')](_0x153b64)[_0xf0db('0x23')](handleEntityNotFound(_0x550016,null))[_0xf0db('0x23')](respondWithResult(_0x550016,null))[_0xf0db('0x43')](handleError(_0x550016,null));};exports['update']=function(_0x35ca40,_0xfac9d9){if(_0x35ca40['body']['id']){delete _0x35ca40[_0xf0db('0x47')]['id'];}return db[_0xf0db('0x29')][_0xf0db('0x46')]({'where':{'id':_0x35ca40[_0xf0db('0x45')]['id']}})[_0xf0db('0x23')](handleEntityNotFound(_0xfac9d9,null))['then'](saveUpdates(_0x35ca40[_0xf0db('0x47')],null))[_0xf0db('0x23')](respondWithResult(_0xfac9d9,null))[_0xf0db('0x43')](handleError(_0xfac9d9,null));};exports['destroy']=function(_0x3c531d,_0x4cd660){return db[_0xf0db('0x29')]['find']({'where':{'id':_0x3c531d[_0xf0db('0x45')]['id']}})[_0xf0db('0x23')](handleEntityNotFound(_0x4cd660,null))[_0xf0db('0x23')](removeEntity(_0x4cd660,null))[_0xf0db('0x43')](handleError(_0x4cd660,null));};exports[_0xf0db('0x48')]=function(_0x238180,_0x5b5121){var _0x10294c;return db['sequelize'][_0xf0db('0x49')](function(_0x54a544){return db[_0xf0db('0x29')][_0xf0db('0x48')](_0x238180['body'],{'transaction':_0x54a544})['then'](function(_0x251fbd){_0x10294c=_0x251fbd;var _0x3f181b={'type':db[_0xf0db('0x4a')][_0xf0db('0x4b')],'transaction':_0x54a544};switch(_0x238180['body'][_0xf0db('0x2c')]){case _0xf0db('0x4c'):_0x3f181b['type']=db[_0xf0db('0x4a')][_0xf0db('0x4b')];break;case _0xf0db('0x4d'):_0x3f181b[_0xf0db('0x2c')]=db[_0xf0db('0x4a')][_0xf0db('0x4e')];break;case _0xf0db('0x4f'):_0x3f181b['type']=db[_0xf0db('0x4a')][_0xf0db('0x50')];_0x3f181b[_0xf0db('0x51')]=![];break;default:}return db['sequelize'][_0xf0db('0x52')][_0xf0db('0x53')](_0xf0db('0x54'),util[_0xf0db('0x55')](_0xf0db('0x56'),_0x10294c['id']),_0x3f181b);})[_0xf0db('0x23')](function(){return _0x10294c;});})[_0xf0db('0x23')](respondWithResult(_0x5b5121,0xc9))[_0xf0db('0x43')](handleError(_0x5b5121,null));}; \ No newline at end of file +var _0x88c8=['includeAll','findAll','rows','catch','params','fields','length','include','find','body','destroy','create','sequelize','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count'];(function(_0x3d3198,_0x1777da){var _0x42882c=function(_0x5409e8){while(--_0x5409e8){_0x3d3198['push'](_0x3d3198['shift']());}};_0x42882c(++_0x1777da);}(_0x88c8,0x117));var _0x888c=function(_0x295fc2,_0x2058d1){_0x295fc2=_0x295fc2-0x0;var _0x3df38f=_0x88c8[_0x295fc2];return _0x3df38f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x888c('0x0'));var rimraf=require(_0x888c('0x1'));var zipdir=require(_0x888c('0x2'));var jsonpatch=require(_0x888c('0x3'));var rp=require(_0x888c('0x4'));var moment=require('moment');var BPromise=require(_0x888c('0x5'));var Mustache=require(_0x888c('0x6'));var util=require(_0x888c('0x7'));var path=require(_0x888c('0x8'));var sox=require('sox');var csv=require(_0x888c('0x9'));var ejs=require(_0x888c('0xa'));var fs=require('fs');var _=require(_0x888c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x888c('0xc'));var deskjs=require(_0x888c('0xd'));var toCsv=require(_0x888c('0x9'));var querystring=require(_0x888c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x888c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x888c('0x10'))(_0x888c('0x11'));var utils=require('../../config/utils');var config=require(_0x888c('0x12'));var licenseUtil=require(_0x888c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35f2d5,_0x33a875){_0x33a875=_0x33a875||0xcc;return function(_0x56d9df){if(_0x56d9df){return _0x35f2d5[_0x888c('0x14')](_0x33a875);}return _0x35f2d5[_0x888c('0x15')](_0x33a875)[_0x888c('0x16')]();};}function respondWithResult(_0x3a9071,_0x176860){_0x176860=_0x176860||0xc8;return function(_0x119fe6){if(_0x119fe6){return _0x3a9071[_0x888c('0x15')](_0x176860)[_0x888c('0x17')](_0x119fe6);}};}function respondWithFilteredResult(_0x56263c,_0x1cde30){return function(_0xc25010){if(_0xc25010){var _0x4e0aee=_0xc25010['count'],_0x1511e9=_0x1cde30[_0x888c('0x18')],_0x53e448=_0x1cde30[_0x888c('0x18')]+_0x1cde30[_0x888c('0x19')],_0x412629;if(_0x53e448>=_0x4e0aee){_0x53e448=_0x4e0aee;_0x412629=0xc8;}else{_0x412629=0xce;}_0x56263c[_0x888c('0x15')](_0x412629);return _0x56263c[_0x888c('0x1a')]('Content-Range',_0x1511e9+'-'+_0x53e448+'/'+_0x4e0aee)[_0x888c('0x17')](_0xc25010);}return null;};}function patchUpdates(_0x2ff60a){return function(_0xdb1277){try{jsonpatch[_0x888c('0x1b')](_0xdb1277,_0x2ff60a,!![]);}catch(_0x134ee5){return BPromise[_0x888c('0x1c')](_0x134ee5);}return _0xdb1277[_0x888c('0x1d')]();};}function saveUpdates(_0x3740fc,_0x3088f0){return function(_0x436809){if(_0x436809){return _0x436809[_0x888c('0x1e')](_0x3740fc)[_0x888c('0x1f')](function(_0x286d6d){return _0x286d6d;});}return null;};}function removeEntity(_0x2e4482,_0x5b05d4){return function(_0x4bfb6d){if(_0x4bfb6d){return _0x4bfb6d['destroy']()[_0x888c('0x1f')](function(){_0x2e4482['status'](0xcc)[_0x888c('0x16')]();});}};}function handleEntityNotFound(_0x27d86b,_0x38ef33){return function(_0x4dc26f){if(!_0x4dc26f){_0x27d86b[_0x888c('0x14')](0x194);}return _0x4dc26f;};}function handleError(_0x3ec336,_0x18f0d1){_0x18f0d1=_0x18f0d1||0x1f4;return function(_0x4d992a){logger[_0x888c('0x20')](_0x4d992a[_0x888c('0x21')]);if(_0x4d992a['name']){delete _0x4d992a[_0x888c('0x22')];}_0x3ec336[_0x888c('0x15')](_0x18f0d1)[_0x888c('0x23')](_0x4d992a);};}exports[_0x888c('0x24')]=function(_0x3219de,_0x173659){var _0x587b74={},_0x185874={},_0x5e7fac={'count':0x0,'rows':[]};var _0x3a6436=_[_0x888c('0x25')](db[_0x888c('0x26')][_0x888c('0x27')],function(_0x24342b){return{'name':_0x24342b[_0x888c('0x28')],'type':_0x24342b[_0x888c('0x29')][_0x888c('0x2a')]};});_0x185874[_0x888c('0x2b')]=_[_0x888c('0x2c')](_[_0x888c('0x25')](_0x3a6436,_0x888c('0x22')),[_0x888c('0x22')]);_0x185874[_0x888c('0x2d')]=_[_0x888c('0x2e')](_0x3219de['query']);_0x185874[_0x888c('0x2f')]=_[_0x888c('0x30')](_0x185874['model'],_0x185874[_0x888c('0x2d')]);_0x587b74['attributes']=_[_0x888c('0x30')](_0x185874['model'],qs['fields'](_0x3219de['query']['fields']));_0x587b74[_0x888c('0x31')]=_0x587b74[_0x888c('0x31')]['length']?_0x587b74['attributes']:_0x185874[_0x888c('0x2b')];if(!_0x3219de[_0x888c('0x2d')][_0x888c('0x32')](_0x888c('0x33'))){_0x587b74[_0x888c('0x19')]=qs['limit'](_0x3219de[_0x888c('0x2d')][_0x888c('0x19')]);_0x587b74[_0x888c('0x18')]=qs[_0x888c('0x18')](_0x3219de['query'][_0x888c('0x18')]);}_0x587b74[_0x888c('0x34')]=qs[_0x888c('0x35')](_0x3219de['query'][_0x888c('0x35')]);_0x587b74[_0x888c('0x36')]=qs['filters'](_[_0x888c('0x37')](_0x3219de[_0x888c('0x2d')],_0x185874[_0x888c('0x2f')]),_0x3a6436);if(_0x3219de[_0x888c('0x2d')][_0x888c('0x38')]){_0x587b74[_0x888c('0x36')]=_[_0x888c('0x39')](_0x587b74[_0x888c('0x36')],{'$or':_['map'](_0x3a6436,function(_0x1097cc){if(_0x1097cc[_0x888c('0x29')]!==_0x888c('0x3a')){var _0x12d9b6={};_0x12d9b6[_0x1097cc[_0x888c('0x22')]]={'$like':'%'+_0x3219de[_0x888c('0x2d')][_0x888c('0x38')]+'%'};return _0x12d9b6;}})});}_0x587b74=_[_0x888c('0x39')]({},_0x587b74,_0x3219de[_0x888c('0x3b')]);var _0x3dd6c0={'where':_0x587b74['where']};return db[_0x888c('0x26')][_0x888c('0x3c')](_0x3dd6c0)[_0x888c('0x1f')](function(_0x2b569c){_0x5e7fac[_0x888c('0x3c')]=_0x2b569c;if(_0x3219de[_0x888c('0x2d')][_0x888c('0x3d')]){_0x587b74['include']=[{'all':!![]}];}return db[_0x888c('0x26')][_0x888c('0x3e')](_0x587b74);})['then'](function(_0x50466e){_0x5e7fac[_0x888c('0x3f')]=_0x50466e;return _0x5e7fac;})[_0x888c('0x1f')](respondWithFilteredResult(_0x173659,_0x587b74))[_0x888c('0x40')](handleError(_0x173659,null));};exports['show']=function(_0x2758df,_0x5df606){var _0xf700e7={'raw':!![],'where':{'id':_0x2758df[_0x888c('0x41')]['id']}},_0x253d9a={};_0x253d9a['model']=_[_0x888c('0x2e')](db[_0x888c('0x26')][_0x888c('0x27')]);_0x253d9a['query']=_[_0x888c('0x2e')](_0x2758df[_0x888c('0x2d')]);_0x253d9a[_0x888c('0x2f')]=_[_0x888c('0x30')](_0x253d9a[_0x888c('0x2b')],_0x253d9a[_0x888c('0x2d')]);_0xf700e7[_0x888c('0x31')]=_[_0x888c('0x30')](_0x253d9a['model'],qs[_0x888c('0x42')](_0x2758df[_0x888c('0x2d')][_0x888c('0x42')]));_0xf700e7[_0x888c('0x31')]=_0xf700e7[_0x888c('0x31')][_0x888c('0x43')]?_0xf700e7[_0x888c('0x31')]:_0x253d9a[_0x888c('0x2b')];if(_0x2758df[_0x888c('0x2d')][_0x888c('0x3d')]){_0xf700e7[_0x888c('0x44')]=[{'all':!![]}];}_0xf700e7=_[_0x888c('0x39')]({},_0xf700e7,_0x2758df['options']);return db[_0x888c('0x26')][_0x888c('0x45')](_0xf700e7)[_0x888c('0x1f')](handleEntityNotFound(_0x5df606,null))[_0x888c('0x1f')](respondWithResult(_0x5df606,null))[_0x888c('0x40')](handleError(_0x5df606,null));};exports[_0x888c('0x1e')]=function(_0x2c3dd3,_0x2ea20b){if(_0x2c3dd3[_0x888c('0x46')]['id']){delete _0x2c3dd3[_0x888c('0x46')]['id'];}return db[_0x888c('0x26')][_0x888c('0x45')]({'where':{'id':_0x2c3dd3['params']['id']}})[_0x888c('0x1f')](handleEntityNotFound(_0x2ea20b,null))[_0x888c('0x1f')](saveUpdates(_0x2c3dd3['body'],null))['then'](respondWithResult(_0x2ea20b,null))[_0x888c('0x40')](handleError(_0x2ea20b,null));};exports[_0x888c('0x47')]=function(_0x53f5ea,_0x12b3df){return db[_0x888c('0x26')]['find']({'where':{'id':_0x53f5ea[_0x888c('0x41')]['id']}})['then'](handleEntityNotFound(_0x12b3df,null))[_0x888c('0x1f')](removeEntity(_0x12b3df,null))[_0x888c('0x40')](handleError(_0x12b3df,null));};exports[_0x888c('0x48')]=function(_0x3eaf97,_0x5e54f8){var _0xd96078;return db[_0x888c('0x49')]['transaction'](function(_0x2ae3c1){return db[_0x888c('0x26')][_0x888c('0x48')](_0x3eaf97[_0x888c('0x46')],{'transaction':_0x2ae3c1})[_0x888c('0x1f')](function(_0x2bdf7e){_0xd96078=_0x2bdf7e;var _0x8e902b={'type':db[_0x888c('0x4a')][_0x888c('0x4b')],'transaction':_0x2ae3c1};switch(_0x3eaf97[_0x888c('0x46')][_0x888c('0x29')]){case _0x888c('0x4c'):_0x8e902b[_0x888c('0x29')]=db['Sequelize'][_0x888c('0x4b')];break;case _0x888c('0x4d'):_0x8e902b[_0x888c('0x29')]=db[_0x888c('0x4a')][_0x888c('0x4e')];break;case _0x888c('0x4f'):_0x8e902b[_0x888c('0x29')]=db[_0x888c('0x4a')][_0x888c('0x50')];_0x8e902b[_0x888c('0x51')]=![];break;default:}return db[_0x888c('0x49')][_0x888c('0x52')][_0x888c('0x53')]('cm_contacts',util['format'](_0x888c('0x54'),_0xd96078['id']),_0x8e902b);})[_0x888c('0x1f')](function(){return _0xd96078;});})[_0x888c('0x1f')](respondWithResult(_0x5e54f8,0xc9))[_0x888c('0x40')](handleError(_0x5e54f8,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 3b83d60..fa01f35 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 _0x5b9c=['rimraf','./cmCustomField.attributes','exports','define','cm_custom_fields','api','moment','request-promise'];(function(_0x3a1f7b,_0x376f6a){var _0x2156a4=function(_0x13acd9){while(--_0x13acd9){_0x3a1f7b['push'](_0x3a1f7b['shift']());}};_0x2156a4(++_0x376f6a);}(_0x5b9c,0x1ad));var _0xc5b9=function(_0x4c06f7,_0x5642c7){_0x4c06f7=_0x4c06f7-0x0;var _0x129ac9=_0x5b9c[_0x4c06f7];return _0x129ac9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc5b9('0x0'));var moment=require(_0xc5b9('0x1'));var BPromise=require('bluebird');var rp=require(_0xc5b9('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5b9('0x3'));var config=require('../../config/environment');var attributes=require(_0xc5b9('0x4'));module[_0xc5b9('0x5')]=function(_0x38166c,_0x684fa9){return _0x38166c[_0xc5b9('0x6')]('CmCustomField',attributes,{'tableName':_0xc5b9('0x7'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe34c=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','CmCustomField','cm_custom_fields','lodash','util'];(function(_0x1626e2,_0x8db414){var _0x17cd10=function(_0xcf7580){while(--_0xcf7580){_0x1626e2['push'](_0x1626e2['shift']());}};_0x17cd10(++_0x8db414);}(_0xe34c,0x1cc));var _0xce34=function(_0x3c36eb,_0x1fe7d3){_0x3c36eb=_0x3c36eb-0x0;var _0x1dddf=_0xe34c[_0x3c36eb];return _0x1dddf;};'use strict';var _=require(_0xce34('0x0'));var util=require(_0xce34('0x1'));var logger=require('../../config/logger')(_0xce34('0x2'));var moment=require(_0xce34('0x3'));var BPromise=require(_0xce34('0x4'));var rp=require(_0xce34('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce34('0x6'));var config=require(_0xce34('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xce34('0x8')]=function(_0x25511d,_0x595914){return _0x25511d['define'](_0xce34('0x9'),attributes,{'tableName':_0xce34('0xa'),'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 7083d69..7594631 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 _0x6737=['stringify','error','code','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1c56be,_0x2564b1){var _0x2d1e98=function(_0x35d3d1){while(--_0x35d3d1){_0x1c56be['push'](_0x1c56be['shift']());}};_0x2d1e98(++_0x2564b1);}(_0x6737,0xe2));var _0x7673=function(_0x249693,_0x3c22b2){_0x249693=_0x249693-0x0;var _0x2af704=_0x6737[_0x249693];return _0x2af704;};'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')]('CmCustomField,\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')]('CmCustomField,\x20%s,\x20%s',_0x4e4b24,_0x164d05);_0x285c6d(_0x164d05);});});} \ No newline at end of file +var _0xdace=['request\x20sent','debug','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xdace,0xc5));var _0xedac=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0xdace[_0x261e29];return _0x25ef43;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('CmCustomField,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 202754e..d3d75c3 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 _0x3eea=['index','/:id','post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x3eea,0x1bd));var _0xa3ee=function(_0x2174b3,_0x428f53){_0x2174b3=_0x2174b3-0x0;var _0x57370e=_0x3eea[_0x2174b3];return _0x57370e;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require(_0xa3ee('0x1'));var path=require(_0xa3ee('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var auth=require(_0xa3ee('0x5'));var interaction=require(_0xa3ee('0x6'));var config=require(_0xa3ee('0x7'));var controller=require(_0xa3ee('0x8'));router[_0xa3ee('0x9')]('/',auth[_0xa3ee('0xa')](),controller[_0xa3ee('0xb')]);router[_0xa3ee('0x9')](_0xa3ee('0xc'),auth[_0xa3ee('0xa')](),controller['show']);router[_0xa3ee('0xd')]('/',auth[_0xa3ee('0xa')](),controller[_0xa3ee('0xe')]);router[_0xa3ee('0xf')](_0xa3ee('0xc'),auth['isAuthenticated'](),controller[_0xa3ee('0x10')]);router[_0xa3ee('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa3ee('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe6c5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4637dd,_0x4e2109){var _0x4d97d3=function(_0x3e19cc){while(--_0x3e19cc){_0x4637dd['push'](_0x4637dd['shift']());}};_0x4d97d3(++_0x4e2109);}(_0xe6c5,0x64));var _0x5e6c=function(_0x1279ec,_0x3c959e){_0x1279ec=_0x1279ec-0x0;var _0x207b37=_0xe6c5[_0x1279ec];return _0x207b37;};'use strict';var multer=require(_0x5e6c('0x0'));var util=require(_0x5e6c('0x1'));var path=require(_0x5e6c('0x2'));var timeout=require(_0x5e6c('0x3'));var express=require(_0x5e6c('0x4'));var router=express[_0x5e6c('0x5')]();var auth=require(_0x5e6c('0x6'));var interaction=require(_0x5e6c('0x7'));var config=require(_0x5e6c('0x8'));var controller=require(_0x5e6c('0x9'));router[_0x5e6c('0xa')]('/',auth[_0x5e6c('0xb')](),controller[_0x5e6c('0xc')]);router[_0x5e6c('0xa')]('/:id',auth[_0x5e6c('0xb')](),controller[_0x5e6c('0xd')]);router[_0x5e6c('0xe')]('/',auth[_0x5e6c('0xb')](),controller[_0x5e6c('0xf')]);router['put'](_0x5e6c('0x10'),auth[_0x5e6c('0xb')](),controller[_0x5e6c('0x11')]);router[_0x5e6c('0x12')](_0x5e6c('0x10'),auth[_0x5e6c('0xb')](),controller[_0x5e6c('0x13')]);module[_0x5e6c('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 07ce360..15cd4ef 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 _0x7c09=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','sequelize','exports','BOOLEAN'];(function(_0x8e9597,_0x2aa555){var _0x3be06a=function(_0x7a8e7a){while(--_0x7a8e7a){_0x8e9597['push'](_0x8e9597['shift']());}};_0x3be06a(++_0x2aa555);}(_0x7c09,0x102));var _0x97c0=function(_0x29ac91,_0x3a726d){_0x29ac91=_0x29ac91-0x0;var _0x159849=_0x7c09[_0x29ac91];return _0x159849;};'use strict';var moment=require('moment');var Sequelize=require(_0x97c0('0x0'));module[_0x97c0('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x97c0('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x97c0('0x3')],'defaultValue':moment()[_0x97c0('0x4')](_0x97c0('0x5'))},'countbusyretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x97c0('0x6')](0x2)[_0x97c0('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x97c0('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x97c0('0x6')],'unique':_0x97c0('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x97c0('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x97c0('0x6')],'unique':_0x97c0('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb4c7=['moment','sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','contactListQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x5c1856,_0x265775){_0x5c1856=_0x5c1856-0x0;var _0xac7285=_0xb4c7[_0x5c1856];return _0xac7285;};'use strict';var moment=require(_0x7b4c('0x0'));var Sequelize=require(_0x7b4c('0x1'));module[_0x7b4c('0x2')]={'phone':{'type':Sequelize[_0x7b4c('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x7b4c('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x7b4c('0x5')](_0x7b4c('0x6'))},'countbusyretry':{'type':Sequelize[_0x7b4c('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7b4c('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7b4c('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7b4c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7b4c('0x8')]},'priority':{'type':Sequelize[_0x7b4c('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7b4c('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7b4c('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x7b4c('0x7')],'unique':_0x7b4c('0x9')},'UserId':{'type':Sequelize[_0x7b4c('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x7b4c('0x7')],'unique':_0x7b4c('0x9')},'CampaignId':{'type':Sequelize[_0x7b4c('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x7b4c('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7b4c('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7b4c('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7b4c('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 d428e2b..cb17dbf 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 _0xefe3=['apply','reject','save','then','error','stack','name','index','map','CmHopper','fieldName','type','query','keys','filters','intersection','concat','$and','$gt','$ne','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','createdAt','state','statedesc','deleted','campaign','user','UserId','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','firstName','isNil','lastName','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','priority','ASC','scheduledAt','DESC','isEmpty','hopperIds','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','update','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','html-pdf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range'];(function(_0x356127,_0x4873ac){var _0x5d4c75=function(_0x4fe60c){while(--_0x4fe60c){_0x356127['push'](_0x356127['shift']());}};_0x5d4c75(++_0x4873ac);}(_0xefe3,0xf5));var _0x3efe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xefe3[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x3efe('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3efe('0x1'));var rp=require(_0x3efe('0x2'));var moment=require(_0x3efe('0x3'));var BPromise=require(_0x3efe('0x4'));var Mustache=require('mustache');var util=require(_0x3efe('0x5'));var path=require('path');var sox=require(_0x3efe('0x6'));var csv=require('to-csv');var ejs=require(_0x3efe('0x7'));var fs=require('fs');var _=require(_0x3efe('0x8'));var squel=require(_0x3efe('0x9'));var crypto=require(_0x3efe('0xa'));var jsforce=require(_0x3efe('0xb'));var deskjs=require(_0x3efe('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3efe('0xd'));var Papa=require('papaparse');var Redis=require(_0x3efe('0xe'));var authService=require(_0x3efe('0xf'));var qs=require(_0x3efe('0x10'));var as=require(_0x3efe('0x11'));var hardwareService=require(_0x3efe('0x12'));var logger=require(_0x3efe('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3efe('0x14'));var licenseUtil=require(_0x3efe('0x15'));var db=require(_0x3efe('0x16'))['db'];function respondWithStatusCode(_0x3ad584,_0x11b9b4){_0x11b9b4=_0x11b9b4||0xcc;return function(_0x3778ec){if(_0x3778ec){return _0x3ad584[_0x3efe('0x17')](_0x11b9b4);}return _0x3ad584[_0x3efe('0x18')](_0x11b9b4)[_0x3efe('0x19')]();};}function respondWithResult(_0x44bdbf,_0x2dd99f){_0x2dd99f=_0x2dd99f||0xc8;return function(_0x49f4ff){if(_0x49f4ff){return _0x44bdbf[_0x3efe('0x18')](_0x2dd99f)[_0x3efe('0x1a')](_0x49f4ff);}};}function respondWithFilteredResult(_0x1e1ce9,_0x230785){return function(_0x4a3d0d){if(_0x4a3d0d){var _0x219ecf=_0x4a3d0d['count'],_0x13730a=_0x230785[_0x3efe('0x1b')],_0x18b4c2=_0x230785[_0x3efe('0x1b')]+_0x230785[_0x3efe('0x1c')],_0x515e1b;if(_0x18b4c2>=_0x219ecf){_0x18b4c2=_0x219ecf;_0x515e1b=0xc8;}else{_0x515e1b=0xce;}_0x1e1ce9[_0x3efe('0x18')](_0x515e1b);return _0x1e1ce9[_0x3efe('0x1d')](_0x3efe('0x1e'),_0x13730a+'-'+_0x18b4c2+'/'+_0x219ecf)['json'](_0x4a3d0d);}return null;};}function patchUpdates(_0x21abe1){return function(_0x30b3fb){try{jsonpatch[_0x3efe('0x1f')](_0x30b3fb,_0x21abe1,!![]);}catch(_0x182a6f){return BPromise[_0x3efe('0x20')](_0x182a6f);}return _0x30b3fb[_0x3efe('0x21')]();};}function saveUpdates(_0x41cfcd,_0x2b2c09){return function(_0x34d520){if(_0x34d520){return _0x34d520['update'](_0x41cfcd)[_0x3efe('0x22')](function(_0x3103bb){return _0x3103bb;});}return null;};}function removeEntity(_0x3403ce,_0x3b6464){return function(_0x4a3fdb){if(_0x4a3fdb){return _0x4a3fdb['destroy']()[_0x3efe('0x22')](function(){_0x3403ce[_0x3efe('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c8b1d,_0x2aec5c){return function(_0x8c746e){if(!_0x8c746e){_0x5c8b1d[_0x3efe('0x17')](0x194);}return _0x8c746e;};}function handleError(_0x252c27,_0x394716){_0x394716=_0x394716||0x1f4;return function(_0x39fc88){logger[_0x3efe('0x23')](_0x39fc88[_0x3efe('0x24')]);if(_0x39fc88[_0x3efe('0x25')]){delete _0x39fc88['name'];}_0x252c27[_0x3efe('0x18')](_0x394716)['send'](_0x39fc88);};}exports[_0x3efe('0x26')]=function(_0x21c15d,_0x5cbe1a){var _0x25bf85={},_0x14908e={},_0x331a83={'count':0x0,'rows':[]};var _0x4cedac=_[_0x3efe('0x27')](db[_0x3efe('0x28')]['rawAttributes'],function(_0x730e5c){return{'name':_0x730e5c[_0x3efe('0x29')],'type':_0x730e5c[_0x3efe('0x2a')]['key']};});_0x14908e['model']=_[_0x3efe('0x27')](_0x4cedac,_0x3efe('0x25'));_0x14908e[_0x3efe('0x2b')]=_[_0x3efe('0x2c')](_0x21c15d[_0x3efe('0x2b')]);_0x14908e[_0x3efe('0x2d')]=_[_0x3efe('0x2e')](_0x14908e['model'],_0x14908e[_0x3efe('0x2b')]);_0x14908e['filters']=_[_0x3efe('0x2f')](_0x14908e['filters'],[_0x3efe('0x30'),'$or',_0x3efe('0x31'),'$gte','$lt','$lte',_0x3efe('0x32'),'$eq','$not','$between',_0x3efe('0x33'),_0x3efe('0x34'),'$notIn',_0x3efe('0x35'),_0x3efe('0x36'),_0x3efe('0x37'),_0x3efe('0x38'),_0x3efe('0x35'),_0x3efe('0x39'),_0x3efe('0x3a'),_0x3efe('0x3b'),_0x3efe('0x3c')]);_0x25bf85[_0x3efe('0x3d')]=_[_0x3efe('0x2e')](_0x14908e[_0x3efe('0x3e')],qs[_0x3efe('0x3f')](_0x21c15d[_0x3efe('0x2b')][_0x3efe('0x3f')]));_0x25bf85[_0x3efe('0x3d')]=_0x25bf85[_0x3efe('0x3d')][_0x3efe('0x40')]?_0x25bf85[_0x3efe('0x3d')]:_0x14908e[_0x3efe('0x3e')];if(!_0x21c15d['query'][_0x3efe('0x41')](_0x3efe('0x42'))){_0x25bf85['limit']=qs[_0x3efe('0x1c')](_0x21c15d['query'][_0x3efe('0x1c')]);_0x25bf85[_0x3efe('0x1b')]=qs[_0x3efe('0x1b')](_0x21c15d[_0x3efe('0x2b')]['offset']);}_0x25bf85['order']=qs[_0x3efe('0x43')](_0x21c15d['query'][_0x3efe('0x43')]);_0x25bf85[_0x3efe('0x44')]=qs[_0x3efe('0x2d')](_[_0x3efe('0x45')](_0x21c15d[_0x3efe('0x2b')],_0x14908e[_0x3efe('0x2d')]),_0x4cedac);if(_0x21c15d['query'][_0x3efe('0x46')]){_0x25bf85[_0x3efe('0x44')]=_[_0x3efe('0x47')](_0x25bf85[_0x3efe('0x44')],{'$or':_[_0x3efe('0x27')](_0x4cedac,function(_0x2f2580){if(_0x2f2580['type']!==_0x3efe('0x48')){var _0xf2622c={};_0xf2622c[_0x2f2580[_0x3efe('0x25')]]={'$like':'%'+_0x21c15d['query'][_0x3efe('0x46')]+'%'};return _0xf2622c;}})});}_0x25bf85=_[_0x3efe('0x47')]({},_0x25bf85,_0x21c15d['options']);var _0x5e06ee={'where':_0x25bf85['where']};return db[_0x3efe('0x28')][_0x3efe('0x49')](_0x5e06ee)['then'](function(_0x3f5e0d){_0x331a83[_0x3efe('0x49')]=_0x3f5e0d;if(_0x21c15d['query'][_0x3efe('0x4a')]){_0x25bf85['include']=[{'all':!![]}];}return db[_0x3efe('0x28')][_0x3efe('0x4b')](_0x25bf85);})[_0x3efe('0x22')](function(_0x5e6e60){_0x331a83[_0x3efe('0x4c')]=_0x5e6e60;return _0x331a83;})[_0x3efe('0x22')](respondWithFilteredResult(_0x5cbe1a,_0x25bf85))[_0x3efe('0x4d')](handleError(_0x5cbe1a,null));};exports['show']=function(_0x1280bb,_0x38cd15){var _0x51672b={'raw':!![],'where':{'id':_0x1280bb[_0x3efe('0x4e')]['id']}},_0x472b6b={};_0x472b6b[_0x3efe('0x3e')]=_[_0x3efe('0x2c')](db[_0x3efe('0x28')][_0x3efe('0x4f')]);_0x472b6b[_0x3efe('0x2b')]=_[_0x3efe('0x2c')](_0x1280bb[_0x3efe('0x2b')]);_0x472b6b[_0x3efe('0x2d')]=_[_0x3efe('0x2e')](_0x472b6b['model'],_0x472b6b['query']);_0x51672b[_0x3efe('0x3d')]=_[_0x3efe('0x2e')](_0x472b6b[_0x3efe('0x3e')],qs[_0x3efe('0x3f')](_0x1280bb['query'][_0x3efe('0x3f')]));_0x51672b[_0x3efe('0x3d')]=_0x51672b['attributes'][_0x3efe('0x40')]?_0x51672b[_0x3efe('0x3d')]:_0x472b6b[_0x3efe('0x3e')];if(_0x1280bb[_0x3efe('0x2b')]['includeAll']){_0x51672b[_0x3efe('0x50')]=[{'all':!![]}];}_0x51672b=_[_0x3efe('0x47')]({},_0x51672b,_0x1280bb['options']);return db[_0x3efe('0x28')][_0x3efe('0x51')](_0x51672b)[_0x3efe('0x22')](handleEntityNotFound(_0x38cd15,null))[_0x3efe('0x22')](respondWithResult(_0x38cd15,null))[_0x3efe('0x4d')](handleError(_0x38cd15,null));};exports[_0x3efe('0x52')]=function(_0x2a512e,_0x311d68){return db[_0x3efe('0x28')][_0x3efe('0x52')](_0x2a512e['body'],{})['then'](respondWithResult(_0x311d68,0xc9))[_0x3efe('0x4d')](handleError(_0x311d68,null));};exports['update']=function(_0x2f61cd,_0x1bbfd9){if(_0x2f61cd['body']['id']){delete _0x2f61cd[_0x3efe('0x53')]['id'];}return db[_0x3efe('0x28')][_0x3efe('0x51')]({'where':{'id':_0x2f61cd[_0x3efe('0x4e')]['id']}})[_0x3efe('0x22')](handleEntityNotFound(_0x1bbfd9,null))['then'](saveUpdates(_0x2f61cd[_0x3efe('0x53')],null))['then'](respondWithResult(_0x1bbfd9,null))[_0x3efe('0x4d')](handleError(_0x1bbfd9,null));};exports[_0x3efe('0x54')]=function(_0x2a5545,_0xce63d9){return db[_0x3efe('0x28')][_0x3efe('0x54')]()[_0x3efe('0x22')](respondWithResult(_0xce63d9,null))[_0x3efe('0x4d')](handleError(_0xce63d9,null));};exports[_0x3efe('0x55')]=function(_0x411cc8,_0x4dec6e){var _0x2ab7c6;return db['CmHopper'][_0x3efe('0x51')]({'where':{'id':_0x411cc8[_0x3efe('0x4e')]['id']}})[_0x3efe('0x22')](handleEntityNotFound(_0x4dec6e,null))[_0x3efe('0x22')](function(_0x263ba7){if(_0x263ba7){return _0x263ba7[_0x3efe('0x55')]()[_0x3efe('0x22')](function(_0x44b328){return _0x44b328;});}})[_0x3efe('0x22')](function(_0x5d1c76){_0x2ab7c6=_0x5d1c76;if(_0x5d1c76){if(_0x5d1c76[_0x3efe('0x56')]||_0x5d1c76[_0x3efe('0x57')]){return db[_0x5d1c76[_0x3efe('0x56')]?_0x3efe('0x58'):_0x3efe('0x59')][_0x3efe('0x51')]({'where':{'id':_0x5d1c76['VoiceQueueId']?_0x5d1c76[_0x3efe('0x56')]:_0x5d1c76[_0x3efe('0x57')]},'attributes':['id','name'],'raw':!![]});}}})[_0x3efe('0x22')](function(_0x31ccd4){var _0x1e314b={};if(_0x31ccd4){_['merge'](_0x1e314b,_['omit'](_0x2ab7c6['dataValues'],[_0x3efe('0x5a'),'updatedAt','id']));_0x1e314b[_0x3efe('0x5b')]=0x15;_0x1e314b[_0x3efe('0x5c')]=_0x3efe('0x5d');_0x1e314b[_0x3efe('0x5e')]=_0x31ccd4[_0x3efe('0x25')];_0x1e314b['membername']=_0x411cc8[_0x3efe('0x5f')][_0x3efe('0x25')];_0x1e314b[_0x3efe('0x60')]=_0x411cc8[_0x3efe('0x5f')]['id'];_0x1e314b[_0x3efe('0x5d')]=!![];_0x1e314b['deletedat']=moment()['format'](_0x3efe('0x61'));_0x1e314b[_0x3efe('0x62')]=_0x2ab7c6['phone'];_0x1e314b[_0x3efe('0x63')]=_0x2ab7c6['VoiceQueueId']?'queue':_0x3efe('0x64');return db[_0x3efe('0x65')]['find']({'where':{'id':_0x1e314b['ContactId']},'attributes':[_0x3efe('0x66'),'lastName']})[_0x3efe('0x22')](function(_0x4a909c){if(!_[_0x3efe('0x67')](_0x4dec6e)&&!_[_0x3efe('0x67')](_0x4a909c[_0x3efe('0x66')])){_0x1e314b['calleridname']=_0x4a909c[_0x3efe('0x66')];if(!_['isNil'](_0x4a909c['lastName'])){_0x1e314b['calleridname']+='\x20'+_0x4a909c[_0x3efe('0x68')];}}})[_0x3efe('0x69')](function(){return db[_0x3efe('0x6a')][_0x3efe('0x52')](_0x1e314b);});}})[_0x3efe('0x22')](function(){return _0x4dec6e['status'](0xcc)['end']();})['catch'](handleError(_0x4dec6e,null));};exports['getPreview']=function(_0x3cbcd0,_0x16d235,_0x5c45a0){var _0x5b4f86=[];return db['CmContact'][_0x3efe('0x54')]()[_0x3efe('0x22')](function(_0x3da866){_0x5b4f86=_['keys'](_0x3da866);return _0x3cbcd0['user'][_0x3efe('0x6b')]({'where':{'type':_0x3efe('0x6c'),'dialActive':!![],'dialMethod':_0x3efe('0x6d')},'attributes':['id',_0x3efe('0x6e')],'raw':!![]});})[_0x3efe('0x22')](function(_0x3df712){if(_0x3df712&&_0x3df712[_0x3efe('0x40')]){return db[_0x3efe('0x6f')][_0x3efe('0x70')](function(_0x54fd9f){var _0x185da1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3efe('0x71')](_0x3efe('0x61'))},'VoiceQueueId':{'$in':_[_0x3efe('0x27')](_0x3df712,'id')},'$or':[{'UserId':null},{'UserId':_0x3cbcd0[_0x3efe('0x5f')]['id']}]};var _0x146d09=[];if(_0x3cbcd0[_0x3efe('0x53')][_0x3efe('0x72')]&&_0x3cbcd0[_0x3efe('0x53')]['direction']===_0x3efe('0x73')){if(!_['isEmpty'](_0x3cbcd0['body']['hopperIds'])){_0x185da1['id']={'$in':_0x3cbcd0[_0x3efe('0x53')]['hopperIds']};}_0x146d09=[[_0x3efe('0x74'),_0x3efe('0x75')],[_0x3efe('0x76'),_0x3df712[0x0][_0x3efe('0x6e')]==='ASC'?'DESC':'ASC'],db[_0x3efe('0x6f')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x3efe('0x77')]];}else{if(!_[_0x3efe('0x78')](_0x3cbcd0[_0x3efe('0x53')][_0x3efe('0x79')])){_0x185da1['id']={'$notIn':_0x3cbcd0['body'][_0x3efe('0x79')]};}_0x146d09=[[_0x3efe('0x74'),'DESC'],['scheduledAt',_0x3df712[0x0][_0x3efe('0x6e')]],db[_0x3efe('0x6f')][_0x3efe('0x7a')](_0x3efe('0x7b')),['id',_0x3efe('0x75')]];}return db[_0x3efe('0x28')]['findOne']({'attributes':['id',_0x3efe('0x7c')],'where':_0x185da1,'order':_0x146d09,'transaction':_0x54fd9f,'lock':_0x54fd9f[_0x3efe('0x7d')][_0x3efe('0x7e')],'include':[{'model':db[_0x3efe('0x65')],'as':_0x3efe('0x7f'),'attributes':_0x5b4f86,'include':[{'model':db[_0x3efe('0x80')],'as':_0x3efe('0x81'),'attributes':['id',_0x3efe('0x25')]}]},{'model':db['CmList'],'as':_0x3efe('0x82'),'attributes':['id',_0x3efe('0x25')]},{'model':db[_0x3efe('0x58')],'as':_0x3efe('0x83'),'attributes':['id','name',_0x3efe('0x84')]}]})[_0x3efe('0x22')](function(_0x4d6883){if(_0x4d6883){return _0x4d6883[_0x3efe('0x85')]({'UserId':_0x3cbcd0[_0x3efe('0x5f')]['id']},{'transaction':_0x54fd9f});}});});}})[_0x3efe('0x22')](handleEntityNotFound(_0x16d235,null))[_0x3efe('0x22')](respondWithResult(_0x16d235,null))[_0x3efe('0x4d')](handleError(_0x16d235,null));};exports['getOpenContacts']=function(_0x2ab0f8,_0x2650cb,_0x15d7b0){return _0x2ab0f8[_0x3efe('0x5f')][_0x3efe('0x6b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x3efe('0x6d')},'attributes':['id'],'raw':!![]})[_0x3efe('0x22')](function(_0x1a4589){if(_0x1a4589&&_0x1a4589[_0x3efe('0x40')]){return db['CmHopper'][_0x3efe('0x49')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3efe('0x71')](_0x3efe('0x61'))},'VoiceQueueId':{'$in':_['map'](_0x1a4589,'id')},'$or':[{'UserId':null},{'UserId':_0x2ab0f8['user']['id']}]}});}return 0x0;})['then'](function(_0x2019de){if(!_[_0x3efe('0x67')](_0x2019de)&&_[_0x3efe('0x86')](_0x2019de)){return _0x2650cb[_0x3efe('0x18')](0xc8)['json']({'contacts':_0x2019de});}else{logger['error'](_0x3efe('0x87'),_0x3efe('0x88'),0x194,_0x3efe('0x89'));_0x2650cb[_0x3efe('0x17')](0x194);}})['catch'](handleError(_0x2650cb,null));}; \ No newline at end of file +var _0x43c8=['isNil','finally','CmHopperFinal','describe','getVoiceQueues','outbound','preview','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','CmContact','Contact','CmCompany','Company','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','key','model','keys','query','filters','intersection','concat','$and','$or','$gt','$lt','$ne','$eq','$between','$notBetween','$in','$like','$notLike','$notILike','$overlap','$contains','$contained','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','count','include','catch','params','includeAll','find','create','body','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','ivr','ContactId','firstName','lastName'];(function(_0x1e17a9,_0xe85600){var _0x1c1cf7=function(_0x2531bf){while(--_0x2531bf){_0x1e17a9['push'](_0x1e17a9['shift']());}};_0x1c1cf7(++_0xe85600);}(_0x43c8,0xaf));var _0x843c=function(_0x387255,_0x897a7d){_0x387255=_0x387255-0x0;var _0x330d18=_0x43c8[_0x387255];return _0x330d18;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x843c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x843c('0x1'));var jsonpatch=require(_0x843c('0x2'));var rp=require(_0x843c('0x3'));var moment=require(_0x843c('0x4'));var BPromise=require(_0x843c('0x5'));var Mustache=require(_0x843c('0x6'));var util=require(_0x843c('0x7'));var path=require('path');var sox=require(_0x843c('0x8'));var csv=require(_0x843c('0x9'));var ejs=require(_0x843c('0xa'));var fs=require('fs');var _=require(_0x843c('0xb'));var squel=require(_0x843c('0xc'));var crypto=require('crypto');var jsforce=require(_0x843c('0xd'));var deskjs=require(_0x843c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x843c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x843c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x843c('0x11'));var hardwareService=require(_0x843c('0x12'));var logger=require(_0x843c('0x13'))(_0x843c('0x14'));var utils=require('../../config/utils');var config=require(_0x843c('0x15'));var licenseUtil=require(_0x843c('0x16'));var db=require(_0x843c('0x17'))['db'];function respondWithStatusCode(_0xe0ae48,_0x231ce1){_0x231ce1=_0x231ce1||0xcc;return function(_0x34e297){if(_0x34e297){return _0xe0ae48[_0x843c('0x18')](_0x231ce1);}return _0xe0ae48[_0x843c('0x19')](_0x231ce1)[_0x843c('0x1a')]();};}function respondWithResult(_0x7092f0,_0x313947){_0x313947=_0x313947||0xc8;return function(_0x36e07f){if(_0x36e07f){return _0x7092f0[_0x843c('0x19')](_0x313947)[_0x843c('0x1b')](_0x36e07f);}};}function respondWithFilteredResult(_0x3c67eb,_0x5577ff){return function(_0x3dc50d){if(_0x3dc50d){var _0x2c013c=_0x3dc50d['count'],_0x1d92cf=_0x5577ff[_0x843c('0x1c')],_0x42558b=_0x5577ff[_0x843c('0x1c')]+_0x5577ff[_0x843c('0x1d')],_0x16e8f6;if(_0x42558b>=_0x2c013c){_0x42558b=_0x2c013c;_0x16e8f6=0xc8;}else{_0x16e8f6=0xce;}_0x3c67eb[_0x843c('0x19')](_0x16e8f6);return _0x3c67eb['set'](_0x843c('0x1e'),_0x1d92cf+'-'+_0x42558b+'/'+_0x2c013c)[_0x843c('0x1b')](_0x3dc50d);}return null;};}function patchUpdates(_0x181508){return function(_0x65b0e5){try{jsonpatch[_0x843c('0x1f')](_0x65b0e5,_0x181508,!![]);}catch(_0x556049){return BPromise[_0x843c('0x20')](_0x556049);}return _0x65b0e5['save']();};}function saveUpdates(_0x505d5c,_0x5eb8ca){return function(_0x3422a3){if(_0x3422a3){return _0x3422a3[_0x843c('0x21')](_0x505d5c)['then'](function(_0x179772){return _0x179772;});}return null;};}function removeEntity(_0x30c897,_0x2d1d43){return function(_0x15513d){if(_0x15513d){return _0x15513d['destroy']()['then'](function(){_0x30c897['status'](0xcc)[_0x843c('0x1a')]();});}};}function handleEntityNotFound(_0x17e6ab,_0x2d90f9){return function(_0x408bf1){if(!_0x408bf1){_0x17e6ab[_0x843c('0x18')](0x194);}return _0x408bf1;};}function handleError(_0x35c3b1,_0x37bc86){_0x37bc86=_0x37bc86||0x1f4;return function(_0x51f75b){logger[_0x843c('0x22')](_0x51f75b[_0x843c('0x23')]);if(_0x51f75b[_0x843c('0x24')]){delete _0x51f75b['name'];}_0x35c3b1[_0x843c('0x19')](_0x37bc86)['send'](_0x51f75b);};}exports[_0x843c('0x25')]=function(_0x1ee7e3,_0x30534b){var _0x4f61af={},_0x28f0ea={},_0x2a3c64={'count':0x0,'rows':[]};var _0x177db5=_[_0x843c('0x26')](db[_0x843c('0x27')][_0x843c('0x28')],function(_0x4e2a13){return{'name':_0x4e2a13[_0x843c('0x29')],'type':_0x4e2a13['type'][_0x843c('0x2a')]};});_0x28f0ea[_0x843c('0x2b')]=_[_0x843c('0x26')](_0x177db5,_0x843c('0x24'));_0x28f0ea['query']=_[_0x843c('0x2c')](_0x1ee7e3[_0x843c('0x2d')]);_0x28f0ea[_0x843c('0x2e')]=_[_0x843c('0x2f')](_0x28f0ea[_0x843c('0x2b')],_0x28f0ea[_0x843c('0x2d')]);_0x28f0ea[_0x843c('0x2e')]=_[_0x843c('0x30')](_0x28f0ea[_0x843c('0x2e')],[_0x843c('0x31'),_0x843c('0x32'),_0x843c('0x33'),'$gte',_0x843c('0x34'),'$lte',_0x843c('0x35'),_0x843c('0x36'),'$not',_0x843c('0x37'),_0x843c('0x38'),_0x843c('0x39'),'$notIn',_0x843c('0x3a'),_0x843c('0x3b'),'$iLike',_0x843c('0x3c'),'$like',_0x843c('0x3d'),_0x843c('0x3e'),_0x843c('0x3f'),'$any']);_0x4f61af[_0x843c('0x40')]=_[_0x843c('0x2f')](_0x28f0ea[_0x843c('0x2b')],qs[_0x843c('0x41')](_0x1ee7e3[_0x843c('0x2d')]['fields']));_0x4f61af[_0x843c('0x40')]=_0x4f61af[_0x843c('0x40')][_0x843c('0x42')]?_0x4f61af[_0x843c('0x40')]:_0x28f0ea[_0x843c('0x2b')];if(!_0x1ee7e3[_0x843c('0x2d')]['hasOwnProperty'](_0x843c('0x43'))){_0x4f61af[_0x843c('0x1d')]=qs[_0x843c('0x1d')](_0x1ee7e3[_0x843c('0x2d')][_0x843c('0x1d')]);_0x4f61af[_0x843c('0x1c')]=qs[_0x843c('0x1c')](_0x1ee7e3['query']['offset']);}_0x4f61af[_0x843c('0x44')]=qs[_0x843c('0x45')](_0x1ee7e3[_0x843c('0x2d')]['sort']);_0x4f61af[_0x843c('0x46')]=qs[_0x843c('0x2e')](_[_0x843c('0x47')](_0x1ee7e3[_0x843c('0x2d')],_0x28f0ea[_0x843c('0x2e')]),_0x177db5);if(_0x1ee7e3['query'][_0x843c('0x48')]){_0x4f61af[_0x843c('0x46')]=_[_0x843c('0x49')](_0x4f61af[_0x843c('0x46')],{'$or':_[_0x843c('0x26')](_0x177db5,function(_0xb76536){if(_0xb76536[_0x843c('0x4a')]!==_0x843c('0x4b')){var _0x370ffa={};_0x370ffa[_0xb76536[_0x843c('0x24')]]={'$like':'%'+_0x1ee7e3[_0x843c('0x2d')][_0x843c('0x48')]+'%'};return _0x370ffa;}})});}_0x4f61af=_[_0x843c('0x49')]({},_0x4f61af,_0x1ee7e3[_0x843c('0x4c')]);var _0x33243a={'where':_0x4f61af['where']};return db['CmHopper']['count'](_0x33243a)[_0x843c('0x4d')](function(_0x5b244c){_0x2a3c64[_0x843c('0x4e')]=_0x5b244c;if(_0x1ee7e3[_0x843c('0x2d')]['includeAll']){_0x4f61af[_0x843c('0x4f')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x4f61af);})['then'](function(_0x2e74e9){_0x2a3c64['rows']=_0x2e74e9;return _0x2a3c64;})[_0x843c('0x4d')](respondWithFilteredResult(_0x30534b,_0x4f61af))[_0x843c('0x50')](handleError(_0x30534b,null));};exports['show']=function(_0x4e2e6a,_0x10d611){var _0x1918c8={'raw':!![],'where':{'id':_0x4e2e6a[_0x843c('0x51')]['id']}},_0x2c5800={};_0x2c5800[_0x843c('0x2b')]=_['keys'](db[_0x843c('0x27')]['rawAttributes']);_0x2c5800[_0x843c('0x2d')]=_[_0x843c('0x2c')](_0x4e2e6a[_0x843c('0x2d')]);_0x2c5800[_0x843c('0x2e')]=_[_0x843c('0x2f')](_0x2c5800[_0x843c('0x2b')],_0x2c5800[_0x843c('0x2d')]);_0x1918c8[_0x843c('0x40')]=_[_0x843c('0x2f')](_0x2c5800[_0x843c('0x2b')],qs[_0x843c('0x41')](_0x4e2e6a[_0x843c('0x2d')][_0x843c('0x41')]));_0x1918c8[_0x843c('0x40')]=_0x1918c8[_0x843c('0x40')][_0x843c('0x42')]?_0x1918c8[_0x843c('0x40')]:_0x2c5800['model'];if(_0x4e2e6a[_0x843c('0x2d')][_0x843c('0x52')]){_0x1918c8[_0x843c('0x4f')]=[{'all':!![]}];}_0x1918c8=_[_0x843c('0x49')]({},_0x1918c8,_0x4e2e6a[_0x843c('0x4c')]);return db['CmHopper'][_0x843c('0x53')](_0x1918c8)['then'](handleEntityNotFound(_0x10d611,null))[_0x843c('0x4d')](respondWithResult(_0x10d611,null))['catch'](handleError(_0x10d611,null));};exports[_0x843c('0x54')]=function(_0x3dff05,_0x45239d){return db[_0x843c('0x27')][_0x843c('0x54')](_0x3dff05[_0x843c('0x55')],{})[_0x843c('0x4d')](respondWithResult(_0x45239d,0xc9))[_0x843c('0x50')](handleError(_0x45239d,null));};exports[_0x843c('0x21')]=function(_0x3b290a,_0x5e27be){if(_0x3b290a[_0x843c('0x55')]['id']){delete _0x3b290a[_0x843c('0x55')]['id'];}return db[_0x843c('0x27')][_0x843c('0x53')]({'where':{'id':_0x3b290a[_0x843c('0x51')]['id']}})[_0x843c('0x4d')](handleEntityNotFound(_0x5e27be,null))[_0x843c('0x4d')](saveUpdates(_0x3b290a[_0x843c('0x55')],null))[_0x843c('0x4d')](respondWithResult(_0x5e27be,null))[_0x843c('0x50')](handleError(_0x5e27be,null));};exports['describe']=function(_0x2c4044,_0x110b6b){return db[_0x843c('0x27')]['describe']()[_0x843c('0x4d')](respondWithResult(_0x110b6b,null))[_0x843c('0x50')](handleError(_0x110b6b,null));};exports[_0x843c('0x56')]=function(_0x4eedf9,_0x3d2d2d){var _0x2473cd;return db[_0x843c('0x27')][_0x843c('0x53')]({'where':{'id':_0x4eedf9['params']['id']}})['then'](handleEntityNotFound(_0x3d2d2d,null))[_0x843c('0x4d')](function(_0x124c96){if(_0x124c96){return _0x124c96[_0x843c('0x56')]()['then'](function(_0x124701){return _0x124701;});}})[_0x843c('0x4d')](function(_0x25170d){_0x2473cd=_0x25170d;if(_0x25170d){if(_0x25170d[_0x843c('0x57')]||_0x25170d[_0x843c('0x58')]){return db[_0x25170d['VoiceQueueId']?_0x843c('0x59'):'Campaign'][_0x843c('0x53')]({'where':{'id':_0x25170d[_0x843c('0x57')]?_0x25170d[_0x843c('0x57')]:_0x25170d[_0x843c('0x58')]},'attributes':['id',_0x843c('0x24')],'raw':!![]});}}})['then'](function(_0xc7dec5){var _0x4f93a2={};if(_0xc7dec5){_[_0x843c('0x49')](_0x4f93a2,_[_0x843c('0x5a')](_0x2473cd['dataValues'],[_0x843c('0x5b'),_0x843c('0x5c'),'id']));_0x4f93a2[_0x843c('0x5d')]=0x15;_0x4f93a2[_0x843c('0x5e')]=_0x843c('0x5f');_0x4f93a2[_0x843c('0x60')]=_0xc7dec5[_0x843c('0x24')];_0x4f93a2[_0x843c('0x61')]=_0x4eedf9[_0x843c('0x62')]['name'];_0x4f93a2[_0x843c('0x63')]=_0x4eedf9[_0x843c('0x62')]['id'];_0x4f93a2['deleted']=!![];_0x4f93a2[_0x843c('0x64')]=moment()[_0x843c('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f93a2[_0x843c('0x66')]=_0x2473cd[_0x843c('0x67')];_0x4f93a2[_0x843c('0x68')]=_0x2473cd['VoiceQueueId']?'queue':_0x843c('0x69');return db['CmContact'][_0x843c('0x53')]({'where':{'id':_0x4f93a2[_0x843c('0x6a')]},'attributes':[_0x843c('0x6b'),_0x843c('0x6c')]})[_0x843c('0x4d')](function(_0x31a4c5){if(!_[_0x843c('0x6d')](_0x3d2d2d)&&!_[_0x843c('0x6d')](_0x31a4c5[_0x843c('0x6b')])){_0x4f93a2['calleridname']=_0x31a4c5[_0x843c('0x6b')];if(!_['isNil'](_0x31a4c5[_0x843c('0x6c')])){_0x4f93a2['calleridname']+='\x20'+_0x31a4c5[_0x843c('0x6c')];}}})[_0x843c('0x6e')](function(){return db[_0x843c('0x6f')][_0x843c('0x54')](_0x4f93a2);});}})['then'](function(){return _0x3d2d2d[_0x843c('0x19')](0xcc)[_0x843c('0x1a')]();})[_0x843c('0x50')](handleError(_0x3d2d2d,null));};exports['getPreview']=function(_0x15b36e,_0x5388cf,_0x249e63){var _0x227971=[];return db['CmContact'][_0x843c('0x70')]()[_0x843c('0x4d')](function(_0x50db50){_0x227971=_[_0x843c('0x2c')](_0x50db50);return _0x15b36e['user'][_0x843c('0x71')]({'where':{'type':_0x843c('0x72'),'dialActive':!![],'dialMethod':_0x843c('0x73')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x843c('0x4d')](function(_0x54e155){if(_0x54e155&&_0x54e155[_0x843c('0x42')]){return db[_0x843c('0x74')][_0x843c('0x75')](function(_0x152b63){var _0x26fd19={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x843c('0x65')](_0x843c('0x76'))},'VoiceQueueId':{'$in':_[_0x843c('0x26')](_0x54e155,'id')},'$or':[{'UserId':null},{'UserId':_0x15b36e[_0x843c('0x62')]['id']}]};var _0x6779d1=[];if(_0x15b36e[_0x843c('0x55')][_0x843c('0x77')]&&_0x15b36e[_0x843c('0x55')][_0x843c('0x77')]===_0x843c('0x78')){if(!_[_0x843c('0x79')](_0x15b36e[_0x843c('0x55')][_0x843c('0x7a')])){_0x26fd19['id']={'$in':_0x15b36e[_0x843c('0x55')][_0x843c('0x7a')]};}_0x6779d1=[[_0x843c('0x7b'),_0x843c('0x7c')],[_0x843c('0x7d'),_0x54e155[0x0]['dialOrderByScheduledAt']===_0x843c('0x7c')?'DESC':_0x843c('0x7c')],db[_0x843c('0x74')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x843c('0x79')](_0x15b36e[_0x843c('0x55')][_0x843c('0x7a')])){_0x26fd19['id']={'$notIn':_0x15b36e['body'][_0x843c('0x7a')]};}_0x6779d1=[[_0x843c('0x7b'),_0x843c('0x7e')],[_0x843c('0x7d'),_0x54e155[0x0][_0x843c('0x7f')]],db['sequelize'][_0x843c('0x80')](_0x843c('0x81')),['id',_0x843c('0x7c')]];}return db[_0x843c('0x27')]['findOne']({'attributes':['id',_0x843c('0x82')],'where':_0x26fd19,'order':_0x6779d1,'transaction':_0x152b63,'lock':_0x152b63['LOCK']['UPDATE'],'include':[{'model':db[_0x843c('0x83')],'as':_0x843c('0x84'),'attributes':_0x227971,'include':[{'model':db[_0x843c('0x85')],'as':_0x843c('0x86'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x843c('0x87'),'attributes':['id',_0x843c('0x24')]},{'model':db[_0x843c('0x59')],'as':_0x843c('0x88'),'attributes':['id',_0x843c('0x24'),_0x843c('0x89')]}]})[_0x843c('0x4d')](function(_0x41b975){if(_0x41b975){return _0x41b975[_0x843c('0x21')]({'UserId':_0x15b36e[_0x843c('0x62')]['id']},{'transaction':_0x152b63});}});});}})[_0x843c('0x4d')](handleEntityNotFound(_0x5388cf,null))[_0x843c('0x4d')](respondWithResult(_0x5388cf,null))[_0x843c('0x50')](handleError(_0x5388cf,null));};exports[_0x843c('0x8a')]=function(_0x2d3f3d,_0x319564,_0x159b57){return _0x2d3f3d[_0x843c('0x62')][_0x843c('0x71')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x843c('0x4d')](function(_0x44a77a){if(_0x44a77a&&_0x44a77a[_0x843c('0x42')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x843c('0x76'))},'VoiceQueueId':{'$in':_[_0x843c('0x26')](_0x44a77a,'id')},'$or':[{'UserId':null},{'UserId':_0x2d3f3d[_0x843c('0x62')]['id']}]}});}return 0x0;})[_0x843c('0x4d')](function(_0x55986f){if(!_['isNil'](_0x55986f)&&_[_0x843c('0x8b')](_0x55986f)){return _0x319564[_0x843c('0x19')](0xc8)[_0x843c('0x1b')]({'contacts':_0x55986f});}else{logger[_0x843c('0x22')](_0x843c('0x8c'),'getOpenContacts',0x194,_0x843c('0x8d'));_0x319564[_0x843c('0x18')](0x194);}})['catch'](handleError(_0x319564,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index d320cac..e2a2069 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 _0xb00f=['path','rimraf','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','request-promise'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0xb00f,0x70));var _0xfb00=function(_0x17b7b6,_0x403509){_0x17b7b6=_0x17b7b6-0x0;var _0x40b94b=_0xb00f[_0x17b7b6];return _0x40b94b;};'use strict';var _=require('lodash');var util=require(_0xfb00('0x0'));var logger=require(_0xfb00('0x1'))(_0xfb00('0x2'));var moment=require(_0xfb00('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb00('0x4'));var fs=require('fs');var path=require(_0xfb00('0x5'));var rimraf=require(_0xfb00('0x6'));var config=require('../../config/environment');var attributes=require(_0xfb00('0x7'));module['exports']=function(_0x294e92,_0x3a3ed7){return _0x294e92[_0xfb00('0x8')]('CmHopper',attributes,{'tableName':_0xfb00('0x9'),'paranoid':![],'indexes':[{'name':_0xfb00('0xa'),'fields':['scheduledat']},{'name':_0xfb00('0xb'),'fields':[_0xfb00('0xb')]},{'name':_0xfb00('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x91cc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','phone','priority','lodash','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91cc,0x16a));var _0xc91c=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x91cc[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0xc91c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc91c('0x1'));var moment=require(_0xc91c('0x2'));var BPromise=require(_0xc91c('0x3'));var rp=require(_0xc91c('0x4'));var fs=require('fs');var path=require(_0xc91c('0x5'));var rimraf=require(_0xc91c('0x6'));var config=require(_0xc91c('0x7'));var attributes=require(_0xc91c('0x8'));module[_0xc91c('0x9')]=function(_0x3f276f,_0x4f7420){return _0x3f276f[_0xc91c('0xa')]('CmHopper',attributes,{'tableName':_0xc91c('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xc91c('0xc'),'fields':['phone']},{'name':'priority','fields':[_0xc91c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index e7b8891..206647b 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 _0xad2e=['name','voicePause','length','includes','UserId','push','sequelize','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','all','GetContactRecallMe','GetCmHopperPreview','Contact','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','attributes','map','model','debug','find','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','keys','User','Agent'];(function(_0x145fc7,_0x3907f4){var _0x241a7d=function(_0x49c355){while(--_0x49c355){_0x145fc7['push'](_0x145fc7['shift']());}};_0x241a7d(++_0x3907f4);}(_0xad2e,0xa4));var _0xead2=function(_0xed80dc,_0x1fa8dc){_0xed80dc=_0xed80dc-0x0;var _0x124c4d=_0xad2e[_0xed80dc];return _0x124c4d;};'use strict';var _=require('lodash');var util=require(_0xead2('0x0'));var moment=require(_0xead2('0x1'));var BPromise=require(_0xead2('0x2'));var rs=require(_0xead2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xead2('0x4'))['db'];var utils=require(_0xead2('0x5'));var logger=require(_0xead2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xead2('0x7'));var client=jayson[_0xead2('0x8')][_0xead2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116dc8,_0xe506e8,_0x5dee3e){return new BPromise(function(_0x4a9845,_0x16e36c){return client[_0xead2('0xa')](_0x116dc8,_0x5dee3e)[_0xead2('0xb')](function(_0x534b1d){logger[_0xead2('0xc')](_0xead2('0xd'),_0xe506e8,_0xead2('0xe'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0xe506e8,_0xead2('0xe'),JSON[_0xead2('0xf')](_0x534b1d));if(_0x534b1d[_0xead2('0x10')]){if(_0x534b1d[_0xead2('0x10')][_0xead2('0x11')]===0x1f4){logger[_0xead2('0x10')](_0xead2('0xd'),_0xe506e8,_0x534b1d[_0xead2('0x10')][_0xead2('0x12')]);return _0x16e36c(_0x534b1d[_0xead2('0x10')]['message']);}logger[_0xead2('0x10')](_0xead2('0xd'),_0xe506e8,_0x534b1d[_0xead2('0x10')]['message']);return _0x4a9845(_0x534b1d[_0xead2('0x10')][_0xead2('0x12')]);}else{logger['info'](_0xead2('0xd'),_0xe506e8,_0xead2('0xe'));_0x4a9845(_0x534b1d[_0xead2('0x13')][_0xead2('0x12')]);}})[_0xead2('0x14')](function(_0x5f33bb){logger['error']('CmHopper,\x20%s,\x20%s',_0xe506e8,_0x5f33bb);_0x16e36c(_0x5f33bb);});});}exports[_0xead2('0x15')]=function(_0x5c6d69){var _0x5d2483=this;return new Promise(function(_0xdbbd6b,_0x19a24a){return db[_0xead2('0x16')][_0xead2('0x17')]({'raw':_0x5c6d69['options']?_0x5c6d69[_0xead2('0x18')][_0xead2('0x19')]===undefined?!![]:![]:!![],'where':_0x5c6d69[_0xead2('0x18')]?_0x5c6d69['options'][_0xead2('0x1a')]||null:null,'attributes':_0x5c6d69[_0xead2('0x18')]?_0x5c6d69[_0xead2('0x18')]['attributes']||null:null,'limit':_0x5c6d69[_0xead2('0x18')]?_0x5c6d69[_0xead2('0x18')][_0xead2('0x1b')]||null:null,'include':_0x5c6d69['options']?_0x5c6d69[_0xead2('0x18')][_0xead2('0x1c')]?_['map'](_0x5c6d69[_0xead2('0x18')][_0xead2('0x1c')],function(_0xf9e726){return{'model':db[_0xf9e726['model']],'as':_0xf9e726['as'],'attributes':_0xf9e726[_0xead2('0x1d')],'include':_0xf9e726[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0xf9e726['include'],function(_0x4388df){return{'model':db[_0x4388df[_0xead2('0x1f')]],'as':_0x4388df['as'],'attributes':_0x4388df['attributes'],'include':_0x4388df['include']?_[_0xead2('0x1e')](_0x4388df[_0xead2('0x1c')],function(_0xfbf38d){return{'model':db[_0xfbf38d[_0xead2('0x1f')]],'as':_0xfbf38d['as'],'attributes':_0xfbf38d[_0xead2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xead2('0xb')](function(_0x2cd202){logger[_0xead2('0xc')]('GetCmHopper',_0x5c6d69);logger[_0xead2('0x20')](_0xead2('0x15'),_0x5c6d69,JSON[_0xead2('0xf')](_0x2cd202));_0xdbbd6b(_0x2cd202);})['catch'](function(_0x399201){logger[_0xead2('0x10')]('GetCmHopper',_0x399201[_0xead2('0x12')],_0x5c6d69);_0x19a24a(_0x5d2483[_0xead2('0x10')](0x1f4,_0x399201['message']));});});};exports['ShowCmHopper']=function(_0x3c9948){var _0x12a28e=this;return new Promise(function(_0x4afa7e,_0x3819ea){return db[_0xead2('0x16')][_0xead2('0x21')]({'raw':_0x3c9948[_0xead2('0x18')]?_0x3c9948[_0xead2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3c9948[_0xead2('0x18')]?_0x3c9948[_0xead2('0x18')]['where']||null:null,'attributes':_0x3c9948[_0xead2('0x18')]?_0x3c9948[_0xead2('0x18')][_0xead2('0x1d')]||null:null,'include':_0x3c9948[_0xead2('0x18')]?_0x3c9948[_0xead2('0x18')][_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x3c9948[_0xead2('0x18')]['include'],function(_0x49b385){return{'model':db[_0x49b385[_0xead2('0x1f')]],'as':_0x49b385['as'],'attributes':_0x49b385[_0xead2('0x1d')],'include':_0x49b385[_0xead2('0x1c')]?_['map'](_0x49b385[_0xead2('0x1c')],function(_0x5e4517){return{'model':db[_0x5e4517[_0xead2('0x1f')]],'as':_0x5e4517['as'],'attributes':_0x5e4517['attributes'],'include':_0x5e4517[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x5e4517[_0xead2('0x1c')],function(_0xaf2f97){return{'model':db[_0xaf2f97[_0xead2('0x1f')]],'as':_0xaf2f97['as'],'attributes':_0xaf2f97[_0xead2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xead2('0xb')](function(_0x283b23){logger[_0xead2('0xc')]('ShowCmHopper',_0x3c9948);logger['debug'](_0xead2('0x22'),_0x3c9948,JSON['stringify'](_0x283b23));_0x4afa7e(_0x283b23);})[_0xead2('0x14')](function(_0x21a113){logger[_0xead2('0x10')](_0xead2('0x22'),_0x21a113[_0xead2('0x12')],_0x3c9948);_0x3819ea(_0x12a28e[_0xead2('0x10')](0x1f4,_0x21a113['message']));});});};exports['CreateCmHopper']=function(_0x1070f6){var _0x3c9884=this;return new Promise(function(_0x526f5a,_0x1d9278){return db[_0xead2('0x16')][_0xead2('0x23')](_0x1070f6[_0xead2('0x24')],{'raw':_0x1070f6[_0xead2('0x18')]?_0x1070f6['options'][_0xead2('0x19')]===undefined?!![]:![]:!![]})[_0xead2('0xb')](function(_0x4aefb1){logger[_0xead2('0xc')](_0xead2('0x25'),_0x1070f6);logger[_0xead2('0x20')](_0xead2('0x25'),_0x1070f6,JSON[_0xead2('0xf')](_0x4aefb1));_0x526f5a(_0x4aefb1);})[_0xead2('0x14')](function(_0x70a52d){logger[_0xead2('0x10')](_0xead2('0x25'),_0x70a52d['message'],_0x1070f6);_0x1d9278(_0x3c9884[_0xead2('0x10')](0x1f4,_0x70a52d[_0xead2('0x12')]));});});};exports[_0xead2('0x26')]=function(_0x1c4ee2){var _0xeed8b6=this;return new Promise(function(_0x526156,_0x2dcc2d){return db[_0xead2('0x16')][_0xead2('0x27')](_0x1c4ee2[_0xead2('0x24')],{'raw':_0x1c4ee2['options']?_0x1c4ee2[_0xead2('0x18')][_0xead2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c4ee2[_0xead2('0x18')]?_0x1c4ee2[_0xead2('0x18')]['where']||null:null,'attributes':_0x1c4ee2[_0xead2('0x18')]?_0x1c4ee2['options'][_0xead2('0x1d')]||null:null,'limit':_0x1c4ee2['options']?_0x1c4ee2['options']['limit']||null:null})['then'](function(_0x55193a){logger[_0xead2('0xc')](_0xead2('0x26'),_0x1c4ee2);logger[_0xead2('0x20')](_0xead2('0x26'),_0x1c4ee2,JSON['stringify'](_0x55193a));_0x526156(_0x55193a);})[_0xead2('0x14')](function(_0x4b4af6){logger[_0xead2('0x10')]('UpdateCmHopper',_0x4b4af6['message'],_0x1c4ee2);_0x2dcc2d(_0xeed8b6['error'](0x1f4,_0x4b4af6[_0xead2('0x12')]));});});};exports[_0xead2('0x28')]=function(_0x278b63){var _0x198226=this;return new Promise(function(_0x226a47,_0xa86640){return db[_0xead2('0x16')][_0xead2('0x29')]({'where':_0x278b63[_0xead2('0x18')]?_0x278b63[_0xead2('0x18')][_0xead2('0x1a')]||null:null})[_0xead2('0xb')](function(_0x33f614){logger[_0xead2('0xc')]('DestroyCmHopper',_0x278b63);logger[_0xead2('0x20')]('DestroyCmHopper',_0x278b63,JSON[_0xead2('0xf')](_0x33f614));_0x226a47(_0x33f614);})[_0xead2('0x14')](function(_0x15aec1){logger[_0xead2('0x10')](_0xead2('0x28'),_0x15aec1['message'],_0x278b63);_0xa86640(_0x198226[_0xead2('0x10')](0x1f4,_0x15aec1[_0xead2('0x12')]));});});};exports[_0xead2('0x2a')]=function(_0x6bbfca){var _0x1fb53e=this;return new Promise(function(_0x1c86c1,_0x227e94){return db[_0xead2('0x2b')][_0xead2('0x2c')]()[_0xead2('0xb')](function(_0x24c0a1){return db['sequelize'][_0xead2('0x2d')](function(_0x373881){return db[_0xead2('0x16')]['findAll']({'where':_0x6bbfca['options']?_0x6bbfca[_0xead2('0x18')][_0xead2('0x1a')]||null:null,'attributes':_0x6bbfca[_0xead2('0x18')]?_0x6bbfca['options'][_0xead2('0x1d')]||null:null,'limit':_0x6bbfca[_0xead2('0x18')]?_0x6bbfca['options']['limit']||null:null,'order':_0x6bbfca['options']?_0x6bbfca[_0xead2('0x18')][_0xead2('0x2e')]||null:null,'transaction':_0x373881,'lock':_0x373881[_0xead2('0x2f')][_0xead2('0x30')],'include':[{'model':db[_0xead2('0x2b')],'as':'Contact','attributes':_[_0xead2('0x31')](_0x24c0a1)},{'model':db[_0xead2('0x32')],'as':_0xead2('0x33'),'attributes':['id',_0xead2('0x34'),_0xead2('0x35')]}]})['then'](function(_0x53f37a){var _0x44c0e9=[];var _0x5cb5ea=[];for(var _0x3ca0b1=0x0;_0x3ca0b1<_0x53f37a[_0xead2('0x36')];_0x3ca0b1+=0x1){if(!_0x5cb5ea[_0xead2('0x37')](_0x53f37a[_0x3ca0b1][_0xead2('0x38')])){_0x5cb5ea[_0xead2('0x39')](_0x53f37a[_0x3ca0b1][_0xead2('0x38')]);_0x44c0e9[_0xead2('0x39')](_0x53f37a[_0x3ca0b1][_0xead2('0x27')](_0x6bbfca[_0xead2('0x24')],{'transaction':_0x373881}));}}return BPromise['all'](_0x44c0e9);});})['then'](function(_0x4152d2){logger[_0xead2('0xc')](_0xead2('0x2a'),_0x6bbfca);logger[_0xead2('0x20')](_0xead2('0x2a'),_0x6bbfca,JSON[_0xead2('0xf')](_0x4152d2));_0x1c86c1(_0x4152d2);})[_0xead2('0x14')](function(_0x25661a){logger[_0xead2('0x10')](_0xead2('0x2a'),_0x25661a[_0xead2('0x12')],_0x6bbfca);_0x227e94(_0x1fb53e[_0xead2('0x10')](0x1f4,_0x25661a[_0xead2('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x46bc8f){var _0xda1dfe=this;return new Promise(function(_0x2085e1,_0x240b84){return db[_0xead2('0x3a')][_0xead2('0x2d')](function(_0x31d2b8){return db[_0xead2('0x3b')]['create'](_0x46bc8f[_0xead2('0x24')],{'raw':_0x46bc8f[_0xead2('0x18')]?_0x46bc8f['options'][_0xead2('0x19')]===undefined?!![]:![]:!![],'transaction':_0x31d2b8})[_0xead2('0xb')](function(){return db[_0xead2('0x16')][_0xead2('0x29')]({'where':_0x46bc8f[_0xead2('0x18')]?_0x46bc8f[_0xead2('0x18')][_0xead2('0x1a')]||null:null,'transaction':_0x31d2b8});});})[_0xead2('0xb')](function(_0x48927a){logger[_0xead2('0xc')]('MoveContactManagedDialer',_0x46bc8f);logger[_0xead2('0x20')]('MoveContactManagedDialer',_0x46bc8f,JSON[_0xead2('0xf')](_0x48927a));_0x2085e1(_0x48927a);})[_0xead2('0x14')](function(_0x50f960){logger[_0xead2('0x10')]('MoveContactManagedDialer',_0x50f960['message'],_0x46bc8f);_0x240b84(_0xda1dfe[_0xead2('0x10')](0x1f4,_0x50f960[_0xead2('0x12')]));});});};exports[_0xead2('0x3c')]=function(_0x45ac0e){var _0x1f00b8=this;return new Promise(function(_0x3e9e4f,_0x5e85e4){return db['CmHopper']['findAll']({'raw':_0x45ac0e[_0xead2('0x18')]?_0x45ac0e[_0xead2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x45ac0e[_0xead2('0x18')]?_0x45ac0e['options'][_0xead2('0x1a')]||null:null,'attributes':[[db['sequelize']['fn'](_0xead2('0x3d'),db[_0xead2('0x3a')]['fn']('IF',db[_0xead2('0x3a')][_0xead2('0x3e')](_0xead2('0x3f')+util[_0xead2('0x40')]('\x22%s\x22',moment()[_0xead2('0x40')](_0xead2('0x41')))+_0xead2('0x42')))),_0xead2('0x43')]]})['then'](function(_0x217484){logger[_0xead2('0xc')](_0xead2('0x3c'),_0x45ac0e);logger[_0xead2('0x20')]('CountReScheduled',_0x45ac0e,JSON['stringify'](_0x217484));_0x3e9e4f(_0x217484);})['catch'](function(_0x5bbc61){logger[_0xead2('0x10')](_0xead2('0x3c'),_0x5bbc61[_0xead2('0x12')],_0x45ac0e);_0x5e85e4(_0x1f00b8['error'](0x1f4,_0x5bbc61[_0xead2('0x12')]));});});};exports['GetContactRecallMe']=function(_0x45616a){var _0x2ddb2d=this;return new Promise(function(_0x3760d4,_0x1e140d){return db[_0xead2('0x2b')][_0xead2('0x2c')]()['then'](function(_0x3e1d0d){return db[_0xead2('0x3a')][_0xead2('0x2d')](function(_0x5cd59c){return db[_0xead2('0x16')][_0xead2('0x17')]({'where':_0x45616a[_0xead2('0x18')]?_0x45616a[_0xead2('0x18')]['where']||null:null,'attributes':_0x45616a[_0xead2('0x18')]?_0x45616a[_0xead2('0x18')]['attributes']||null:null,'limit':0x1,'order':_0x45616a['options']?_0x45616a[_0xead2('0x18')]['order']||null:null,'group':db[_0xead2('0x16')][_0xead2('0x38')],'transaction':_0x5cd59c,'lock':_0x5cd59c[_0xead2('0x2f')][_0xead2('0x30')],'include':_0x45616a[_0xead2('0x18')]?_0x45616a[_0xead2('0x18')]['include']?_[_0xead2('0x1e')](_0x45616a['options'][_0xead2('0x1c')],function(_0x52a5a6){return{'model':db[_0x52a5a6[_0xead2('0x1f')]],'as':_0x52a5a6['as'],'attributes':_0x52a5a6[_0xead2('0x1d')],'include':_0x52a5a6['include']?_[_0xead2('0x1e')](_0x52a5a6['include'],function(_0x3ff043){return{'model':db[_0x3ff043[_0xead2('0x1f')]],'as':_0x3ff043['as'],'attributes':_0x3ff043['attributes'],'include':_0x3ff043[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x3ff043[_0xead2('0x1c')],function(_0x303f15){return{'model':db[_0x303f15[_0xead2('0x1f')]],'as':_0x303f15['as'],'attributes':_0x303f15[_0xead2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xead2('0xb')](function(_0x50a6cf){var _0x51b7df=[];for(var _0x3c0ea5=0x0;_0x3c0ea5<_0x50a6cf[_0xead2('0x36')];_0x3c0ea5+=0x1){_0x51b7df[_0xead2('0x39')](_0x50a6cf[_0x3c0ea5]['update'](_0x45616a[_0xead2('0x24')],{'transaction':_0x5cd59c}));}return BPromise[_0xead2('0x44')](_0x51b7df);});})[_0xead2('0xb')](function(_0x4320c6){logger[_0xead2('0xc')]('GetContactRecallMe',_0x45616a);logger['debug'](_0xead2('0x45'),_0x45616a,JSON[_0xead2('0xf')](_0x4320c6));_0x3760d4(_0x4320c6);})['catch'](function(_0x35b15c){logger[_0xead2('0x10')]('GetContactRecallMe',_0x35b15c['message'],_0x45616a);_0x1e140d(_0x2ddb2d[_0xead2('0x10')](0x1f4,_0x35b15c['message']));});});});};exports[_0xead2('0x46')]=function(_0x40871e){var _0x10a903=this;return new Promise(function(_0x81f95b,_0x3b25d7){db['CmContact'][_0xead2('0x2c')]()[_0xead2('0xb')](function(_0x389d3f){return db[_0xead2('0x16')][_0xead2('0x17')]({'raw':_0x40871e[_0xead2('0x18')]?_0x40871e['options'][_0xead2('0x19')]===undefined?!![]:![]:!![],'where':_0x40871e[_0xead2('0x18')]?_0x40871e[_0xead2('0x18')][_0xead2('0x1a')]||null:null,'attributes':_0x40871e[_0xead2('0x18')]?_0x40871e[_0xead2('0x18')][_0xead2('0x1d')]||null:null,'limit':_0x40871e[_0xead2('0x18')]?_0x40871e[_0xead2('0x18')][_0xead2('0x1b')]||null:null,'include':_0x40871e[_0xead2('0x18')]?_0x40871e[_0xead2('0x18')][_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x40871e[_0xead2('0x18')][_0xead2('0x1c')],function(_0x2ec1a2){return{'model':db[_0x2ec1a2[_0xead2('0x1f')]],'as':_0x2ec1a2['as'],'attributes':_0x2ec1a2['as']===_0xead2('0x47')?_['keys'](_0x389d3f):_0x2ec1a2['attributes'],'include':_0x2ec1a2[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x2ec1a2[_0xead2('0x1c')],function(_0x10ed29){return{'model':db[_0x10ed29[_0xead2('0x1f')]],'as':_0x10ed29['as'],'attributes':_0x10ed29[_0xead2('0x1d')],'include':_0x10ed29[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x10ed29[_0xead2('0x1c')],function(_0x4857bf){return{'model':db[_0x4857bf['model']],'as':_0x4857bf['as'],'attributes':_0x4857bf[_0xead2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xead2('0xb')](function(_0x518665){logger[_0xead2('0xc')](_0xead2('0x15'),_0x40871e);logger[_0xead2('0x20')]('GetCmHopper',_0x40871e,JSON[_0xead2('0xf')](_0x518665));_0x81f95b(_0x518665);})[_0xead2('0x14')](function(_0x5cdc28){logger['error']('GetCmHopper',_0x5cdc28[_0xead2('0x12')],_0x40871e);_0x3b25d7(_0x10a903[_0xead2('0x10')](0x1f4,_0x5cdc28[_0xead2('0x12')]));});});});}; \ No newline at end of file +var _0xf7d5=['CmHopperFinal','destroy','CountReScheduled','sequelize','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','length','all','GetCmHopperPreview','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetCmHopper','findAll','options','where','attributes','limit','map','include','model','debug','CmHopper','find','raw','ShowCmHopper','stringify','CreateCmHopper','create','body','UpdateCmHopper','DestroyCmHopper','CmContact','describe','order','LOCK','UPDATE','keys','User','Agent','name','includes','UserId','push','update','GetContactDialer','MoveContactManagedDialer','transaction'];(function(_0x1df27c,_0x36189f){var _0x10b2d8=function(_0xf8b519){while(--_0xf8b519){_0x1df27c['push'](_0x1df27c['shift']());}};_0x10b2d8(++_0x36189f);}(_0xf7d5,0xe2));var _0x5f7d=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0xf7d5[_0x4702ee];return _0x62ca7d;};'use strict';var _=require('lodash');var util=require(_0x5f7d('0x0'));var moment=require(_0x5f7d('0x1'));var BPromise=require('bluebird');var rs=require(_0x5f7d('0x2'));var fs=require('fs');var Redis=require(_0x5f7d('0x3'));var db=require(_0x5f7d('0x4'))['db'];var utils=require(_0x5f7d('0x5'));var logger=require(_0x5f7d('0x6'))(_0x5f7d('0x7'));var config=require(_0x5f7d('0x8'));var jayson=require(_0x5f7d('0x9'));var client=jayson[_0x5f7d('0xa')][_0x5f7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x364801,_0x5b6b0c,_0x3d322b){return new BPromise(function(_0x53e56b,_0x3bb5e9){return client[_0x5f7d('0xc')](_0x364801,_0x3d322b)[_0x5f7d('0xd')](function(_0x332bc4){logger['info'](_0x5f7d('0xe'),_0x5b6b0c,_0x5f7d('0xf'));logger['debug'](_0x5f7d('0x10'),_0x5b6b0c,_0x5f7d('0xf'),JSON['stringify'](_0x332bc4));if(_0x332bc4['error']){if(_0x332bc4[_0x5f7d('0x11')]['code']===0x1f4){logger[_0x5f7d('0x11')](_0x5f7d('0xe'),_0x5b6b0c,_0x332bc4[_0x5f7d('0x11')]['message']);return _0x3bb5e9(_0x332bc4[_0x5f7d('0x11')][_0x5f7d('0x12')]);}logger[_0x5f7d('0x11')]('CmHopper,\x20%s,\x20%s',_0x5b6b0c,_0x332bc4[_0x5f7d('0x11')][_0x5f7d('0x12')]);return _0x53e56b(_0x332bc4[_0x5f7d('0x11')][_0x5f7d('0x12')]);}else{logger[_0x5f7d('0x13')](_0x5f7d('0xe'),_0x5b6b0c,_0x5f7d('0xf'));_0x53e56b(_0x332bc4[_0x5f7d('0x14')][_0x5f7d('0x12')]);}})[_0x5f7d('0x15')](function(_0x3ea5d7){logger['error']('CmHopper,\x20%s,\x20%s',_0x5b6b0c,_0x3ea5d7);_0x3bb5e9(_0x3ea5d7);});});}exports[_0x5f7d('0x16')]=function(_0x20ff92){var _0x3b01df=this;return new Promise(function(_0x24ef83,_0x5b3783){return db['CmHopper'][_0x5f7d('0x17')]({'raw':_0x20ff92['options']?_0x20ff92['options']['raw']===undefined?!![]:![]:!![],'where':_0x20ff92[_0x5f7d('0x18')]?_0x20ff92[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null,'attributes':_0x20ff92[_0x5f7d('0x18')]?_0x20ff92['options'][_0x5f7d('0x1a')]||null:null,'limit':_0x20ff92['options']?_0x20ff92[_0x5f7d('0x18')][_0x5f7d('0x1b')]||null:null,'include':_0x20ff92['options']?_0x20ff92[_0x5f7d('0x18')]['include']?_[_0x5f7d('0x1c')](_0x20ff92[_0x5f7d('0x18')][_0x5f7d('0x1d')],function(_0x36ef22){return{'model':db[_0x36ef22[_0x5f7d('0x1e')]],'as':_0x36ef22['as'],'attributes':_0x36ef22[_0x5f7d('0x1a')],'include':_0x36ef22[_0x5f7d('0x1d')]?_[_0x5f7d('0x1c')](_0x36ef22['include'],function(_0x21cd02){return{'model':db[_0x21cd02[_0x5f7d('0x1e')]],'as':_0x21cd02['as'],'attributes':_0x21cd02[_0x5f7d('0x1a')],'include':_0x21cd02[_0x5f7d('0x1d')]?_['map'](_0x21cd02[_0x5f7d('0x1d')],function(_0xfcee37){return{'model':db[_0xfcee37[_0x5f7d('0x1e')]],'as':_0xfcee37['as'],'attributes':_0xfcee37[_0x5f7d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5f7d('0xd')](function(_0x5ddc8a){logger[_0x5f7d('0x13')](_0x5f7d('0x16'),_0x20ff92);logger[_0x5f7d('0x1f')](_0x5f7d('0x16'),_0x20ff92,JSON['stringify'](_0x5ddc8a));_0x24ef83(_0x5ddc8a);})[_0x5f7d('0x15')](function(_0x256c0e){logger[_0x5f7d('0x11')]('GetCmHopper',_0x256c0e['message'],_0x20ff92);_0x5b3783(_0x3b01df['error'](0x1f4,_0x256c0e[_0x5f7d('0x12')]));});});};exports['ShowCmHopper']=function(_0x48cd55){var _0x4c47dd=this;return new Promise(function(_0x43db57,_0x3fd734){return db[_0x5f7d('0x20')][_0x5f7d('0x21')]({'raw':_0x48cd55['options']?_0x48cd55[_0x5f7d('0x18')][_0x5f7d('0x22')]===undefined?!![]:![]:!![],'where':_0x48cd55[_0x5f7d('0x18')]?_0x48cd55[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null,'attributes':_0x48cd55['options']?_0x48cd55[_0x5f7d('0x18')][_0x5f7d('0x1a')]||null:null,'include':_0x48cd55[_0x5f7d('0x18')]?_0x48cd55['options'][_0x5f7d('0x1d')]?_['map'](_0x48cd55[_0x5f7d('0x18')][_0x5f7d('0x1d')],function(_0x332acd){return{'model':db[_0x332acd['model']],'as':_0x332acd['as'],'attributes':_0x332acd[_0x5f7d('0x1a')],'include':_0x332acd[_0x5f7d('0x1d')]?_['map'](_0x332acd['include'],function(_0x185f93){return{'model':db[_0x185f93[_0x5f7d('0x1e')]],'as':_0x185f93['as'],'attributes':_0x185f93[_0x5f7d('0x1a')],'include':_0x185f93['include']?_[_0x5f7d('0x1c')](_0x185f93['include'],function(_0x731f2){return{'model':db[_0x731f2[_0x5f7d('0x1e')]],'as':_0x731f2['as'],'attributes':_0x731f2[_0x5f7d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2107bc){logger[_0x5f7d('0x13')](_0x5f7d('0x23'),_0x48cd55);logger[_0x5f7d('0x1f')](_0x5f7d('0x23'),_0x48cd55,JSON[_0x5f7d('0x24')](_0x2107bc));_0x43db57(_0x2107bc);})[_0x5f7d('0x15')](function(_0x1b5e1b){logger[_0x5f7d('0x11')](_0x5f7d('0x23'),_0x1b5e1b['message'],_0x48cd55);_0x3fd734(_0x4c47dd['error'](0x1f4,_0x1b5e1b['message']));});});};exports[_0x5f7d('0x25')]=function(_0x237855){var _0x53f664=this;return new Promise(function(_0x4f4474,_0x33ed84){return db[_0x5f7d('0x20')][_0x5f7d('0x26')](_0x237855[_0x5f7d('0x27')],{'raw':_0x237855['options']?_0x237855[_0x5f7d('0x18')][_0x5f7d('0x22')]===undefined?!![]:![]:!![]})[_0x5f7d('0xd')](function(_0x5b2504){logger['info']('CreateCmHopper',_0x237855);logger['debug'](_0x5f7d('0x25'),_0x237855,JSON[_0x5f7d('0x24')](_0x5b2504));_0x4f4474(_0x5b2504);})['catch'](function(_0x4bdc78){logger[_0x5f7d('0x11')](_0x5f7d('0x25'),_0x4bdc78[_0x5f7d('0x12')],_0x237855);_0x33ed84(_0x53f664[_0x5f7d('0x11')](0x1f4,_0x4bdc78[_0x5f7d('0x12')]));});});};exports[_0x5f7d('0x28')]=function(_0x167022){var _0x4f8065=this;return new Promise(function(_0x48cd8a,_0x38e70a){return db[_0x5f7d('0x20')]['update'](_0x167022['body'],{'raw':_0x167022[_0x5f7d('0x18')]?_0x167022[_0x5f7d('0x18')][_0x5f7d('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x167022[_0x5f7d('0x18')]?_0x167022[_0x5f7d('0x18')]['where']||null:null,'attributes':_0x167022[_0x5f7d('0x18')]?_0x167022[_0x5f7d('0x18')][_0x5f7d('0x1a')]||null:null,'limit':_0x167022[_0x5f7d('0x18')]?_0x167022[_0x5f7d('0x18')][_0x5f7d('0x1b')]||null:null})[_0x5f7d('0xd')](function(_0xc36ccb){logger[_0x5f7d('0x13')](_0x5f7d('0x28'),_0x167022);logger[_0x5f7d('0x1f')]('UpdateCmHopper',_0x167022,JSON[_0x5f7d('0x24')](_0xc36ccb));_0x48cd8a(_0xc36ccb);})['catch'](function(_0x3adfc6){logger[_0x5f7d('0x11')](_0x5f7d('0x28'),_0x3adfc6[_0x5f7d('0x12')],_0x167022);_0x38e70a(_0x4f8065[_0x5f7d('0x11')](0x1f4,_0x3adfc6[_0x5f7d('0x12')]));});});};exports[_0x5f7d('0x29')]=function(_0x23d619){var _0x397289=this;return new Promise(function(_0x2c34b9,_0x29208f){return db[_0x5f7d('0x20')]['destroy']({'where':_0x23d619[_0x5f7d('0x18')]?_0x23d619[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null})['then'](function(_0x3cc10c){logger['info']('DestroyCmHopper',_0x23d619);logger['debug']('DestroyCmHopper',_0x23d619,JSON[_0x5f7d('0x24')](_0x3cc10c));_0x2c34b9(_0x3cc10c);})[_0x5f7d('0x15')](function(_0x4f162d){logger[_0x5f7d('0x11')]('DestroyCmHopper',_0x4f162d[_0x5f7d('0x12')],_0x23d619);_0x29208f(_0x397289['error'](0x1f4,_0x4f162d[_0x5f7d('0x12')]));});});};exports['GetContactDialer']=function(_0x44eb0c){var _0x431974=this;return new Promise(function(_0x4a1b4d,_0x25567e){return db[_0x5f7d('0x2a')][_0x5f7d('0x2b')]()['then'](function(_0x54d974){return db['sequelize']['transaction'](function(_0x59b3b4){return db[_0x5f7d('0x20')][_0x5f7d('0x17')]({'where':_0x44eb0c[_0x5f7d('0x18')]?_0x44eb0c[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null,'attributes':_0x44eb0c[_0x5f7d('0x18')]?_0x44eb0c[_0x5f7d('0x18')]['attributes']||null:null,'limit':_0x44eb0c[_0x5f7d('0x18')]?_0x44eb0c[_0x5f7d('0x18')][_0x5f7d('0x1b')]||null:null,'order':_0x44eb0c[_0x5f7d('0x18')]?_0x44eb0c[_0x5f7d('0x18')][_0x5f7d('0x2c')]||null:null,'transaction':_0x59b3b4,'lock':_0x59b3b4[_0x5f7d('0x2d')][_0x5f7d('0x2e')],'include':[{'model':db[_0x5f7d('0x2a')],'as':'Contact','attributes':_[_0x5f7d('0x2f')](_0x54d974)},{'model':db[_0x5f7d('0x30')],'as':_0x5f7d('0x31'),'attributes':['id',_0x5f7d('0x32'),'voicePause']}]})[_0x5f7d('0xd')](function(_0x5943ec){var _0x3e9c4c=[];var _0x386e03=[];for(var _0x17b779=0x0;_0x17b779<_0x5943ec['length'];_0x17b779+=0x1){if(!_0x386e03[_0x5f7d('0x33')](_0x5943ec[_0x17b779][_0x5f7d('0x34')])){_0x386e03[_0x5f7d('0x35')](_0x5943ec[_0x17b779][_0x5f7d('0x34')]);_0x3e9c4c[_0x5f7d('0x35')](_0x5943ec[_0x17b779][_0x5f7d('0x36')](_0x44eb0c[_0x5f7d('0x27')],{'transaction':_0x59b3b4}));}}return BPromise['all'](_0x3e9c4c);});})[_0x5f7d('0xd')](function(_0x2271f0){logger[_0x5f7d('0x13')](_0x5f7d('0x37'),_0x44eb0c);logger[_0x5f7d('0x1f')](_0x5f7d('0x37'),_0x44eb0c,JSON['stringify'](_0x2271f0));_0x4a1b4d(_0x2271f0);})[_0x5f7d('0x15')](function(_0x12de2c){logger[_0x5f7d('0x11')](_0x5f7d('0x37'),_0x12de2c[_0x5f7d('0x12')],_0x44eb0c);_0x25567e(_0x431974['error'](0x1f4,_0x12de2c['message']));});});});};exports[_0x5f7d('0x38')]=function(_0x591580){var _0x280592=this;return new Promise(function(_0x45c4d1,_0x35b966){return db['sequelize'][_0x5f7d('0x39')](function(_0x37b1f6){return db[_0x5f7d('0x3a')][_0x5f7d('0x26')](_0x591580['body'],{'raw':_0x591580['options']?_0x591580[_0x5f7d('0x18')][_0x5f7d('0x22')]===undefined?!![]:![]:!![],'transaction':_0x37b1f6})['then'](function(){return db[_0x5f7d('0x20')][_0x5f7d('0x3b')]({'where':_0x591580['options']?_0x591580['options'][_0x5f7d('0x19')]||null:null,'transaction':_0x37b1f6});});})[_0x5f7d('0xd')](function(_0x4a2180){logger[_0x5f7d('0x13')](_0x5f7d('0x38'),_0x591580);logger[_0x5f7d('0x1f')](_0x5f7d('0x38'),_0x591580,JSON['stringify'](_0x4a2180));_0x45c4d1(_0x4a2180);})['catch'](function(_0x1264bf){logger[_0x5f7d('0x11')](_0x5f7d('0x38'),_0x1264bf[_0x5f7d('0x12')],_0x591580);_0x35b966(_0x280592[_0x5f7d('0x11')](0x1f4,_0x1264bf[_0x5f7d('0x12')]));});});};exports[_0x5f7d('0x3c')]=function(_0x18d00e){var _0xa40529=this;return new Promise(function(_0x3af81d,_0x2e86f8){return db[_0x5f7d('0x20')][_0x5f7d('0x17')]({'raw':_0x18d00e[_0x5f7d('0x18')]?_0x18d00e[_0x5f7d('0x18')][_0x5f7d('0x22')]===undefined?!![]:![]:!![],'where':_0x18d00e[_0x5f7d('0x18')]?_0x18d00e[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null,'attributes':[[db[_0x5f7d('0x3d')]['fn']('COUNT',db[_0x5f7d('0x3d')]['fn']('IF',db[_0x5f7d('0x3d')][_0x5f7d('0x3e')](_0x5f7d('0x3f')+util[_0x5f7d('0x40')](_0x5f7d('0x41'),moment()[_0x5f7d('0x40')](_0x5f7d('0x42')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x5f7d('0xd')](function(_0x278eb9){logger[_0x5f7d('0x13')](_0x5f7d('0x3c'),_0x18d00e);logger[_0x5f7d('0x1f')](_0x5f7d('0x3c'),_0x18d00e,JSON['stringify'](_0x278eb9));_0x3af81d(_0x278eb9);})[_0x5f7d('0x15')](function(_0x54fd95){logger['error']('CountReScheduled',_0x54fd95[_0x5f7d('0x12')],_0x18d00e);_0x2e86f8(_0xa40529['error'](0x1f4,_0x54fd95[_0x5f7d('0x12')]));});});};exports[_0x5f7d('0x43')]=function(_0x248c33){var _0x2ab780=this;return new Promise(function(_0x296361,_0x24d78d){return db['CmContact']['describe']()[_0x5f7d('0xd')](function(_0x476d81){return db[_0x5f7d('0x3d')][_0x5f7d('0x39')](function(_0x477294){return db[_0x5f7d('0x20')][_0x5f7d('0x17')]({'where':_0x248c33[_0x5f7d('0x18')]?_0x248c33[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null,'attributes':_0x248c33[_0x5f7d('0x18')]?_0x248c33['options'][_0x5f7d('0x1a')]||null:null,'limit':0x1,'order':_0x248c33[_0x5f7d('0x18')]?_0x248c33['options']['order']||null:null,'group':db[_0x5f7d('0x20')]['UserId'],'transaction':_0x477294,'lock':_0x477294[_0x5f7d('0x2d')][_0x5f7d('0x2e')],'include':_0x248c33[_0x5f7d('0x18')]?_0x248c33[_0x5f7d('0x18')]['include']?_[_0x5f7d('0x1c')](_0x248c33[_0x5f7d('0x18')][_0x5f7d('0x1d')],function(_0x52141a){return{'model':db[_0x52141a[_0x5f7d('0x1e')]],'as':_0x52141a['as'],'attributes':_0x52141a[_0x5f7d('0x1a')],'include':_0x52141a[_0x5f7d('0x1d')]?_[_0x5f7d('0x1c')](_0x52141a['include'],function(_0x50fc75){return{'model':db[_0x50fc75[_0x5f7d('0x1e')]],'as':_0x50fc75['as'],'attributes':_0x50fc75[_0x5f7d('0x1a')],'include':_0x50fc75[_0x5f7d('0x1d')]?_['map'](_0x50fc75[_0x5f7d('0x1d')],function(_0x21790b){return{'model':db[_0x21790b['model']],'as':_0x21790b['as'],'attributes':_0x21790b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x559bf6){var _0x4ad365=[];for(var _0x25c1aa=0x0;_0x25c1aa<_0x559bf6[_0x5f7d('0x44')];_0x25c1aa+=0x1){_0x4ad365[_0x5f7d('0x35')](_0x559bf6[_0x25c1aa][_0x5f7d('0x36')](_0x248c33[_0x5f7d('0x27')],{'transaction':_0x477294}));}return BPromise[_0x5f7d('0x45')](_0x4ad365);});})[_0x5f7d('0xd')](function(_0x33ab8b){logger[_0x5f7d('0x13')](_0x5f7d('0x43'),_0x248c33);logger[_0x5f7d('0x1f')](_0x5f7d('0x43'),_0x248c33,JSON[_0x5f7d('0x24')](_0x33ab8b));_0x296361(_0x33ab8b);})[_0x5f7d('0x15')](function(_0x3c6993){logger[_0x5f7d('0x11')](_0x5f7d('0x43'),_0x3c6993[_0x5f7d('0x12')],_0x248c33);_0x24d78d(_0x2ab780[_0x5f7d('0x11')](0x1f4,_0x3c6993[_0x5f7d('0x12')]));});});});};exports[_0x5f7d('0x46')]=function(_0x80be4e){var _0x8a591c=this;return new Promise(function(_0x2551d0,_0x294e5b){db[_0x5f7d('0x2a')]['describe']()[_0x5f7d('0xd')](function(_0x350153){return db['CmHopper'][_0x5f7d('0x17')]({'raw':_0x80be4e[_0x5f7d('0x18')]?_0x80be4e['options'][_0x5f7d('0x22')]===undefined?!![]:![]:!![],'where':_0x80be4e[_0x5f7d('0x18')]?_0x80be4e[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null,'attributes':_0x80be4e[_0x5f7d('0x18')]?_0x80be4e[_0x5f7d('0x18')][_0x5f7d('0x1a')]||null:null,'limit':_0x80be4e[_0x5f7d('0x18')]?_0x80be4e['options'][_0x5f7d('0x1b')]||null:null,'include':_0x80be4e[_0x5f7d('0x18')]?_0x80be4e[_0x5f7d('0x18')][_0x5f7d('0x1d')]?_[_0x5f7d('0x1c')](_0x80be4e[_0x5f7d('0x18')][_0x5f7d('0x1d')],function(_0x44aaad){return{'model':db[_0x44aaad[_0x5f7d('0x1e')]],'as':_0x44aaad['as'],'attributes':_0x44aaad['as']==='Contact'?_[_0x5f7d('0x2f')](_0x350153):_0x44aaad[_0x5f7d('0x1a')],'include':_0x44aaad[_0x5f7d('0x1d')]?_[_0x5f7d('0x1c')](_0x44aaad[_0x5f7d('0x1d')],function(_0x3b305c){return{'model':db[_0x3b305c[_0x5f7d('0x1e')]],'as':_0x3b305c['as'],'attributes':_0x3b305c[_0x5f7d('0x1a')],'include':_0x3b305c[_0x5f7d('0x1d')]?_['map'](_0x3b305c[_0x5f7d('0x1d')],function(_0x32bc56){return{'model':db[_0x32bc56[_0x5f7d('0x1e')]],'as':_0x32bc56['as'],'attributes':_0x32bc56[_0x5f7d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5f7d('0xd')](function(_0x3b2152){logger['info'](_0x5f7d('0x16'),_0x80be4e);logger[_0x5f7d('0x1f')](_0x5f7d('0x16'),_0x80be4e,JSON[_0x5f7d('0x24')](_0x3b2152));_0x2551d0(_0x3b2152);})[_0x5f7d('0x15')](function(_0x407034){logger[_0x5f7d('0x11')]('GetCmHopper',_0x407034['message'],_0x80be4e);_0x294e5b(_0x8a591c['error'](0x1f4,_0x407034[_0x5f7d('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 24aff44..62dfaef 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 _0x6f75=['../../config/environment','./cmHopper.controller','get','/describe','isAuthenticated','getOpenContacts','/:id','show','post','create','/preview','getPreview','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x6f75,0x71));var _0x56f7=function(_0x44f26d,_0x10af74){_0x44f26d=_0x44f26d-0x0;var _0x45b98c=_0x6f75[_0x44f26d];return _0x45b98c;};'use strict';var multer=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var path=require(_0x56f7('0x2'));var timeout=require(_0x56f7('0x3'));var express=require(_0x56f7('0x4'));var router=express[_0x56f7('0x5')]();var auth=require(_0x56f7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x56f7('0x7'));var controller=require(_0x56f7('0x8'));router[_0x56f7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x56f7('0xa'),auth[_0x56f7('0xb')](),controller['describe']);router[_0x56f7('0x9')]('/opencontacts',auth['isAuthenticated'](),controller[_0x56f7('0xc')]);router[_0x56f7('0x9')](_0x56f7('0xd'),auth[_0x56f7('0xb')](),controller[_0x56f7('0xe')]);router[_0x56f7('0xf')]('/',auth[_0x56f7('0xb')](),controller[_0x56f7('0x10')]);router[_0x56f7('0xf')](_0x56f7('0x11'),auth[_0x56f7('0xb')](),controller[_0x56f7('0x12')]);router[_0x56f7('0x13')](_0x56f7('0xd'),auth['isAuthenticated'](),controller[_0x56f7('0x14')]);router[_0x56f7('0x15')](_0x56f7('0xd'),auth[_0x56f7('0xb')](),controller[_0x56f7('0x16')]);module[_0x56f7('0x17')]=router; \ No newline at end of file +var _0x758a=['describe','/opencontacts','getOpenContacts','create','/preview','getPreview','put','/:id','update','multer','util','path','connect-timeout','express','Router','./cmHopper.controller','isAuthenticated','index','get'];(function(_0x124cac,_0xbe9807){var _0x1b06f6=function(_0x5461de){while(--_0x5461de){_0x124cac['push'](_0x124cac['shift']());}};_0x1b06f6(++_0xbe9807);}(_0x758a,0x1d1));var _0xa758=function(_0x4bfb33,_0x754751){_0x4bfb33=_0x4bfb33-0x0;var _0x344ef9=_0x758a[_0x4bfb33];return _0x344ef9;};'use strict';var multer=require(_0xa758('0x0'));var util=require(_0xa758('0x1'));var path=require(_0xa758('0x2'));var timeout=require(_0xa758('0x3'));var express=require(_0xa758('0x4'));var router=express[_0xa758('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa758('0x6'));router['get']('/',auth[_0xa758('0x7')](),controller[_0xa758('0x8')]);router[_0xa758('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa758('0xa')]);router[_0xa758('0x9')](_0xa758('0xb'),auth[_0xa758('0x7')](),controller[_0xa758('0xc')]);router[_0xa758('0x9')]('/:id',auth[_0xa758('0x7')](),controller['show']);router['post']('/',auth[_0xa758('0x7')](),controller[_0xa758('0xd')]);router['post'](_0xa758('0xe'),auth[_0xa758('0x7')](),controller[_0xa758('0xf')]);router[_0xa758('0x10')](_0xa758('0x11'),auth[_0xa758('0x7')](),controller[_0xa758('0x12')]);router['delete']('/:id',auth[_0xa758('0x7')](),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 b443cd0..37cba8b 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 _0x99c9=['DATE','format','moment','exports','INTEGER','STRING'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x99c9,0x1be));var _0x999c=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x99c9[_0x4e676e];return _0x336a3c;};'use strict';var moment=require(_0x999c('0x0'));var Sequelize=require('sequelize');module[_0x999c('0x1')]={'CmHopperId':{'type':Sequelize[_0x999c('0x2')]},'phone':{'type':Sequelize[_0x999c('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x999c('0x4')],'defaultValue':moment()[_0x999c('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x999c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x999c('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x999c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x999c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x999c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x36ae=['sequelize','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x36ae,0x14f));var _0xe36a=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0x36ae[_0x2652ef];return _0x2db578;};'use strict';var moment=require(_0xe36a('0x0'));var Sequelize=require(_0xe36a('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xe36a('0x2')]},'phone':{'type':Sequelize[_0xe36a('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xe36a('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xe36a('0x4')],'defaultValue':moment()[_0xe36a('0x5')](_0xe36a('0x6'))},'countbusyretry':{'type':Sequelize[_0xe36a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe36a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xe36a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe36a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe36a('0x2')],'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 5c430d6..693d962 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 _0x78f4=['index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send'];(function(_0x146155,_0x5f30f4){var _0xbe70a5=function(_0xdf2f65){while(--_0xdf2f65){_0x146155['push'](_0x146155['shift']());}};_0xbe70a5(++_0x5f30f4);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x478f('0x0'));var rimraf=require(_0x478f('0x1'));var zipdir=require(_0x478f('0x2'));var jsonpatch=require(_0x478f('0x3'));var rp=require('request-promise');var moment=require(_0x478f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x478f('0x5'));var util=require(_0x478f('0x6'));var path=require(_0x478f('0x7'));var sox=require('sox');var csv=require(_0x478f('0x8'));var ejs=require(_0x478f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x478f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x478f('0xb'));var toCsv=require('to-csv');var querystring=require(_0x478f('0xc'));var Papa=require(_0x478f('0xd'));var Redis=require(_0x478f('0xe'));var authService=require(_0x478f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x478f('0x10'));var logger=require(_0x478f('0x11'))(_0x478f('0x12'));var utils=require(_0x478f('0x13'));var config=require(_0x478f('0x14'));var licenseUtil=require(_0x478f('0x15'));var db=require(_0x478f('0x16'))['db'];function respondWithStatusCode(_0x3c91d0,_0x551169){_0x551169=_0x551169||0xcc;return function(_0x1fbb84){if(_0x1fbb84){return _0x3c91d0[_0x478f('0x17')](_0x551169);}return _0x3c91d0[_0x478f('0x18')](_0x551169)[_0x478f('0x19')]();};}function respondWithResult(_0x165dfd,_0xbcfcb4){_0xbcfcb4=_0xbcfcb4||0xc8;return function(_0x41eaae){if(_0x41eaae){return _0x165dfd[_0x478f('0x18')](_0xbcfcb4)['json'](_0x41eaae);}};}function respondWithFilteredResult(_0x3de264,_0x1c8990){return function(_0x36e13a){if(_0x36e13a){var _0x2f1266=_0x36e13a[_0x478f('0x1a')],_0x528142=_0x1c8990[_0x478f('0x1b')],_0x10e21d=_0x1c8990['offset']+_0x1c8990[_0x478f('0x1c')],_0x4f2aeb;if(_0x10e21d>=_0x2f1266){_0x10e21d=_0x2f1266;_0x4f2aeb=0xc8;}else{_0x4f2aeb=0xce;}_0x3de264['status'](_0x4f2aeb);return _0x3de264[_0x478f('0x1d')](_0x478f('0x1e'),_0x528142+'-'+_0x10e21d+'/'+_0x2f1266)[_0x478f('0x1f')](_0x36e13a);}return null;};}function patchUpdates(_0x23b455){return function(_0x3c4b01){try{jsonpatch[_0x478f('0x20')](_0x3c4b01,_0x23b455,!![]);}catch(_0x3e97d2){return BPromise[_0x478f('0x21')](_0x3e97d2);}return _0x3c4b01[_0x478f('0x22')]();};}function saveUpdates(_0x341cd0,_0x47160a){return function(_0x427a8a){if(_0x427a8a){return _0x427a8a[_0x478f('0x23')](_0x341cd0)[_0x478f('0x24')](function(_0x185706){return _0x185706;});}return null;};}function removeEntity(_0x32b512,_0x424427){return function(_0x3b92f5){if(_0x3b92f5){return _0x3b92f5[_0x478f('0x25')]()[_0x478f('0x24')](function(){var _0x4e4a2d=_0x3b92f5['get']({'plain':!![]});var _0x3934b4='CmHopperAdditionalPhones';return db[_0x478f('0x26')][_0x478f('0x25')]({'where':{'type':_0x3934b4,'resourceId':_0x4e4a2d['id']}})[_0x478f('0x24')](function(){return _0x3b92f5;});})[_0x478f('0x24')](function(){_0x32b512[_0x478f('0x18')](0xcc)[_0x478f('0x19')]();});}};}function handleEntityNotFound(_0x4ced66,_0x5ecfd8){return function(_0x65ef4){if(!_0x65ef4){_0x4ced66['sendStatus'](0x194);}return _0x65ef4;};}function handleError(_0x1c0e91,_0x49cb67){_0x49cb67=_0x49cb67||0x1f4;return function(_0x101952){logger['error'](_0x101952[_0x478f('0x27')]);if(_0x101952[_0x478f('0x28')]){delete _0x101952[_0x478f('0x28')];}_0x1c0e91[_0x478f('0x18')](_0x49cb67)[_0x478f('0x29')](_0x101952);};}exports[_0x478f('0x2a')]=function(_0x4e48cd,_0x238967){var _0x28b7b0={},_0x2f9384={},_0x892248={'count':0x0,'rows':[]};var _0xc4e899=_[_0x478f('0x2b')](db[_0x478f('0x2c')][_0x478f('0x2d')],function(_0x3aff4e){return{'name':_0x3aff4e[_0x478f('0x2e')],'type':_0x3aff4e[_0x478f('0x2f')]['key']};});_0x2f9384[_0x478f('0x30')]=_[_0x478f('0x2b')](_0xc4e899,'name');_0x2f9384[_0x478f('0x31')]=_[_0x478f('0x32')](_0x4e48cd[_0x478f('0x31')]);_0x2f9384[_0x478f('0x33')]=_[_0x478f('0x34')](_0x2f9384[_0x478f('0x30')],_0x2f9384['query']);_0x28b7b0[_0x478f('0x35')]=_[_0x478f('0x34')](_0x2f9384[_0x478f('0x30')],qs[_0x478f('0x36')](_0x4e48cd[_0x478f('0x31')][_0x478f('0x36')]));_0x28b7b0[_0x478f('0x35')]=_0x28b7b0['attributes'][_0x478f('0x37')]?_0x28b7b0[_0x478f('0x35')]:_0x2f9384[_0x478f('0x30')];if(!_0x4e48cd[_0x478f('0x31')][_0x478f('0x38')](_0x478f('0x39'))){_0x28b7b0[_0x478f('0x1c')]=qs[_0x478f('0x1c')](_0x4e48cd['query'][_0x478f('0x1c')]);_0x28b7b0[_0x478f('0x1b')]=qs['offset'](_0x4e48cd[_0x478f('0x31')]['offset']);}_0x28b7b0[_0x478f('0x3a')]=qs[_0x478f('0x3b')](_0x4e48cd['query'][_0x478f('0x3b')]);_0x28b7b0[_0x478f('0x3c')]=qs[_0x478f('0x33')](_['pick'](_0x4e48cd['query'],_0x2f9384[_0x478f('0x33')]),_0xc4e899);if(_0x4e48cd[_0x478f('0x31')][_0x478f('0x3d')]){_0x28b7b0[_0x478f('0x3c')]=_[_0x478f('0x3e')](_0x28b7b0['where'],{'$or':_['map'](_0xc4e899,function(_0x34d65c){if(_0x34d65c[_0x478f('0x2f')]!=='VIRTUAL'){var _0x59c805={};_0x59c805[_0x34d65c[_0x478f('0x28')]]={'$like':'%'+_0x4e48cd[_0x478f('0x31')][_0x478f('0x3d')]+'%'};return _0x59c805;}})});}_0x28b7b0=_[_0x478f('0x3e')]({},_0x28b7b0,_0x4e48cd[_0x478f('0x3f')]);var _0x30c32d={'where':_0x28b7b0[_0x478f('0x3c')]};return db[_0x478f('0x2c')][_0x478f('0x1a')](_0x30c32d)[_0x478f('0x24')](function(_0x185413){_0x892248['count']=_0x185413;if(_0x4e48cd[_0x478f('0x31')][_0x478f('0x40')]){_0x28b7b0['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x478f('0x41')](_0x28b7b0);})[_0x478f('0x24')](function(_0x21c13d){_0x892248[_0x478f('0x42')]=_0x21c13d;return _0x892248;})[_0x478f('0x24')](respondWithFilteredResult(_0x238967,_0x28b7b0))['catch'](handleError(_0x238967,null));};exports[_0x478f('0x43')]=function(_0x74793e,_0x348bae){var _0x1697ad={'raw':!![],'where':{'id':_0x74793e[_0x478f('0x44')]['id']}},_0xc46353={};_0xc46353['model']=_['keys'](db[_0x478f('0x2c')][_0x478f('0x2d')]);_0xc46353[_0x478f('0x31')]=_[_0x478f('0x32')](_0x74793e[_0x478f('0x31')]);_0xc46353['filters']=_['intersection'](_0xc46353['model'],_0xc46353[_0x478f('0x31')]);_0x1697ad['attributes']=_[_0x478f('0x34')](_0xc46353[_0x478f('0x30')],qs[_0x478f('0x36')](_0x74793e[_0x478f('0x31')][_0x478f('0x36')]));_0x1697ad['attributes']=_0x1697ad[_0x478f('0x35')][_0x478f('0x37')]?_0x1697ad[_0x478f('0x35')]:_0xc46353[_0x478f('0x30')];if(_0x74793e['query'][_0x478f('0x40')]){_0x1697ad[_0x478f('0x45')]=[{'all':!![]}];}_0x1697ad=_[_0x478f('0x3e')]({},_0x1697ad,_0x74793e['options']);return db['CmHopperAdditionalPhone'][_0x478f('0x46')](_0x1697ad)[_0x478f('0x24')](handleEntityNotFound(_0x348bae,null))[_0x478f('0x24')](respondWithResult(_0x348bae,null))[_0x478f('0x47')](handleError(_0x348bae,null));};exports[_0x478f('0x48')]=function(_0x5cb7fc,_0x5769b1){return db[_0x478f('0x2c')][_0x478f('0x48')](_0x5cb7fc['body'],{})[_0x478f('0x24')](function(_0x1c8e53){var _0x465364=_0x5cb7fc[_0x478f('0x49')][_0x478f('0x4a')]({'plain':!![]});if(!_0x465364)throw new Error(_0x478f('0x4b'));if(_0x465364[_0x478f('0x4c')]===_0x478f('0x49')){var _0x249d01=_0x1c8e53[_0x478f('0x4a')]({'plain':!![]});var _0x3bd9bf=_0x478f('0x4d');return db['UserProfileSection'][_0x478f('0x46')]({'where':{'name':_0x3bd9bf,'userProfileId':_0x465364[_0x478f('0x4e')]},'raw':!![]})['then'](function(_0x27bf73){if(_0x27bf73&&_0x27bf73[_0x478f('0x4f')]===0x0){return db[_0x478f('0x26')][_0x478f('0x48')]({'name':_0x249d01['name'],'resourceId':_0x249d01['id'],'type':_0x27bf73[_0x478f('0x28')],'sectionId':_0x27bf73['id']},{})[_0x478f('0x24')](function(){return _0x1c8e53;});}else{return _0x1c8e53;}})[_0x478f('0x47')](function(_0x9ed68d){logger[_0x478f('0x50')](_0x478f('0x51'),_0x9ed68d);throw _0x9ed68d;});}return _0x1c8e53;})[_0x478f('0x24')](respondWithResult(_0x5769b1,0xc9))[_0x478f('0x47')](handleError(_0x5769b1,null));};exports['update']=function(_0xccd14b,_0x55c00c){if(_0xccd14b[_0x478f('0x52')]['id']){delete _0xccd14b[_0x478f('0x52')]['id'];}return db[_0x478f('0x2c')]['find']({'where':{'id':_0xccd14b['params']['id']}})['then'](handleEntityNotFound(_0x55c00c,null))['then'](saveUpdates(_0xccd14b[_0x478f('0x52')],null))[_0x478f('0x24')](respondWithResult(_0x55c00c,null))[_0x478f('0x47')](handleError(_0x55c00c,null));};exports[_0x478f('0x25')]=function(_0x55afe2,_0x527363){return db[_0x478f('0x2c')][_0x478f('0x46')]({'where':{'id':_0x55afe2[_0x478f('0x44')]['id']}})[_0x478f('0x24')](handleEntityNotFound(_0x527363,null))[_0x478f('0x24')](removeEntity(_0x527363,null))[_0x478f('0x47')](handleError(_0x527363,null));}; \ No newline at end of file +var _0x27eb=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','CmHopperAdditionalPhone','includeAll','include','rows','catch','show','params','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','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource'];(function(_0x48cbb8,_0x1c1230){var _0x574b03=function(_0x280152){while(--_0x280152){_0x48cbb8['push'](_0x48cbb8['shift']());}};_0x574b03(++_0x1c1230);}(_0x27eb,0xd0));var _0xb27e=function(_0x3e81d9,_0x488e01){_0x3e81d9=_0x3e81d9-0x0;var _0x311823=_0x27eb[_0x3e81d9];return _0x311823;};'use strict';var pdf=require(_0xb27e('0x0'));var emlformat=require(_0xb27e('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb27e('0x2'));var rp=require(_0xb27e('0x3'));var moment=require(_0xb27e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb27e('0x5'));var util=require(_0xb27e('0x6'));var path=require(_0xb27e('0x7'));var sox=require(_0xb27e('0x8'));var csv=require('to-csv');var ejs=require(_0xb27e('0x9'));var fs=require('fs');var _=require(_0xb27e('0xa'));var squel=require(_0xb27e('0xb'));var crypto=require(_0xb27e('0xc'));var jsforce=require(_0xb27e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb27e('0xe'));var querystring=require(_0xb27e('0xf'));var Papa=require(_0xb27e('0x10'));var Redis=require(_0xb27e('0x11'));var authService=require(_0xb27e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb27e('0x13'));var hardwareService=require(_0xb27e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb27e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb27e('0x16'));var db=require(_0xb27e('0x17'))['db'];function respondWithStatusCode(_0x4d0b5d,_0x58b37f){_0x58b37f=_0x58b37f||0xcc;return function(_0x48c914){if(_0x48c914){return _0x4d0b5d[_0xb27e('0x18')](_0x58b37f);}return _0x4d0b5d['status'](_0x58b37f)[_0xb27e('0x19')]();};}function respondWithResult(_0x54657b,_0x1b55e2){_0x1b55e2=_0x1b55e2||0xc8;return function(_0x5aa86f){if(_0x5aa86f){return _0x54657b[_0xb27e('0x1a')](_0x1b55e2)[_0xb27e('0x1b')](_0x5aa86f);}};}function respondWithFilteredResult(_0x28cc6d,_0x522bbf){return function(_0x26ec32){if(_0x26ec32){var _0x1d14bb=_0x26ec32[_0xb27e('0x1c')],_0x24fc3e=_0x522bbf[_0xb27e('0x1d')],_0x188073=_0x522bbf[_0xb27e('0x1d')]+_0x522bbf[_0xb27e('0x1e')],_0x240767;if(_0x188073>=_0x1d14bb){_0x188073=_0x1d14bb;_0x240767=0xc8;}else{_0x240767=0xce;}_0x28cc6d['status'](_0x240767);return _0x28cc6d[_0xb27e('0x1f')](_0xb27e('0x20'),_0x24fc3e+'-'+_0x188073+'/'+_0x1d14bb)[_0xb27e('0x1b')](_0x26ec32);}return null;};}function patchUpdates(_0x4bb34f){return function(_0x352856){try{jsonpatch['apply'](_0x352856,_0x4bb34f,!![]);}catch(_0x517932){return BPromise[_0xb27e('0x21')](_0x517932);}return _0x352856[_0xb27e('0x22')]();};}function saveUpdates(_0x4ec66c,_0x2a78c0){return function(_0x1f7053){if(_0x1f7053){return _0x1f7053[_0xb27e('0x23')](_0x4ec66c)[_0xb27e('0x24')](function(_0x486202){return _0x486202;});}return null;};}function removeEntity(_0x3c9e21,_0x5a3cdf){return function(_0x19c0f2){if(_0x19c0f2){return _0x19c0f2[_0xb27e('0x25')]()['then'](function(){var _0x58fc84=_0x19c0f2[_0xb27e('0x26')]({'plain':!![]});var _0xfbc258=_0xb27e('0x27');return db[_0xb27e('0x28')][_0xb27e('0x25')]({'where':{'type':_0xfbc258,'resourceId':_0x58fc84['id']}})['then'](function(){return _0x19c0f2;});})[_0xb27e('0x24')](function(){_0x3c9e21['status'](0xcc)[_0xb27e('0x19')]();});}};}function handleEntityNotFound(_0x1ac460,_0x289bb5){return function(_0x3fbc78){if(!_0x3fbc78){_0x1ac460[_0xb27e('0x18')](0x194);}return _0x3fbc78;};}function handleError(_0x4dab95,_0x29ca0c){_0x29ca0c=_0x29ca0c||0x1f4;return function(_0x5bae7c){logger[_0xb27e('0x29')](_0x5bae7c[_0xb27e('0x2a')]);if(_0x5bae7c[_0xb27e('0x2b')]){delete _0x5bae7c[_0xb27e('0x2b')];}_0x4dab95[_0xb27e('0x1a')](_0x29ca0c)[_0xb27e('0x2c')](_0x5bae7c);};}exports[_0xb27e('0x2d')]=function(_0x125c0b,_0x42c5de){var _0x4ef0e6={},_0x377d79={},_0x3118e8={'count':0x0,'rows':[]};var _0x21c90e=_[_0xb27e('0x2e')](db['CmHopperAdditionalPhone'][_0xb27e('0x2f')],function(_0x28927a){return{'name':_0x28927a[_0xb27e('0x30')],'type':_0x28927a[_0xb27e('0x31')][_0xb27e('0x32')]};});_0x377d79[_0xb27e('0x33')]=_[_0xb27e('0x2e')](_0x21c90e,'name');_0x377d79['query']=_[_0xb27e('0x34')](_0x125c0b['query']);_0x377d79[_0xb27e('0x35')]=_['intersection'](_0x377d79[_0xb27e('0x33')],_0x377d79[_0xb27e('0x36')]);_0x4ef0e6[_0xb27e('0x37')]=_[_0xb27e('0x38')](_0x377d79[_0xb27e('0x33')],qs[_0xb27e('0x39')](_0x125c0b['query'][_0xb27e('0x39')]));_0x4ef0e6['attributes']=_0x4ef0e6[_0xb27e('0x37')]['length']?_0x4ef0e6[_0xb27e('0x37')]:_0x377d79['model'];if(!_0x125c0b[_0xb27e('0x36')][_0xb27e('0x3a')]('nolimit')){_0x4ef0e6['limit']=qs[_0xb27e('0x1e')](_0x125c0b['query']['limit']);_0x4ef0e6['offset']=qs[_0xb27e('0x1d')](_0x125c0b[_0xb27e('0x36')]['offset']);}_0x4ef0e6[_0xb27e('0x3b')]=qs[_0xb27e('0x3c')](_0x125c0b['query']['sort']);_0x4ef0e6[_0xb27e('0x3d')]=qs['filters'](_[_0xb27e('0x3e')](_0x125c0b['query'],_0x377d79[_0xb27e('0x35')]),_0x21c90e);if(_0x125c0b[_0xb27e('0x36')][_0xb27e('0x3f')]){_0x4ef0e6[_0xb27e('0x3d')]=_[_0xb27e('0x40')](_0x4ef0e6[_0xb27e('0x3d')],{'$or':_[_0xb27e('0x2e')](_0x21c90e,function(_0x451196){if(_0x451196['type']!==_0xb27e('0x41')){var _0x1884d8={};_0x1884d8[_0x451196[_0xb27e('0x2b')]]={'$like':'%'+_0x125c0b[_0xb27e('0x36')][_0xb27e('0x3f')]+'%'};return _0x1884d8;}})});}_0x4ef0e6=_['merge']({},_0x4ef0e6,_0x125c0b['options']);var _0xfe0de5={'where':_0x4ef0e6[_0xb27e('0x3d')]};return db[_0xb27e('0x42')]['count'](_0xfe0de5)[_0xb27e('0x24')](function(_0x2a2c78){_0x3118e8[_0xb27e('0x1c')]=_0x2a2c78;if(_0x125c0b[_0xb27e('0x36')][_0xb27e('0x43')]){_0x4ef0e6[_0xb27e('0x44')]=[{'all':!![]}];}return db[_0xb27e('0x42')]['findAll'](_0x4ef0e6);})['then'](function(_0x1950f4){_0x3118e8[_0xb27e('0x45')]=_0x1950f4;return _0x3118e8;})[_0xb27e('0x24')](respondWithFilteredResult(_0x42c5de,_0x4ef0e6))[_0xb27e('0x46')](handleError(_0x42c5de,null));};exports[_0xb27e('0x47')]=function(_0x42f5e3,_0x2959f5){var _0x1f5c52={'raw':!![],'where':{'id':_0x42f5e3[_0xb27e('0x48')]['id']}},_0x4fbac3={};_0x4fbac3[_0xb27e('0x33')]=_[_0xb27e('0x34')](db[_0xb27e('0x42')]['rawAttributes']);_0x4fbac3[_0xb27e('0x36')]=_['keys'](_0x42f5e3['query']);_0x4fbac3[_0xb27e('0x35')]=_[_0xb27e('0x38')](_0x4fbac3['model'],_0x4fbac3[_0xb27e('0x36')]);_0x1f5c52[_0xb27e('0x37')]=_[_0xb27e('0x38')](_0x4fbac3[_0xb27e('0x33')],qs[_0xb27e('0x39')](_0x42f5e3[_0xb27e('0x36')][_0xb27e('0x39')]));_0x1f5c52['attributes']=_0x1f5c52[_0xb27e('0x37')]['length']?_0x1f5c52[_0xb27e('0x37')]:_0x4fbac3[_0xb27e('0x33')];if(_0x42f5e3[_0xb27e('0x36')][_0xb27e('0x43')]){_0x1f5c52[_0xb27e('0x44')]=[{'all':!![]}];}_0x1f5c52=_[_0xb27e('0x40')]({},_0x1f5c52,_0x42f5e3['options']);return db['CmHopperAdditionalPhone'][_0xb27e('0x49')](_0x1f5c52)[_0xb27e('0x24')](handleEntityNotFound(_0x2959f5,null))[_0xb27e('0x24')](respondWithResult(_0x2959f5,null))[_0xb27e('0x46')](handleError(_0x2959f5,null));};exports[_0xb27e('0x4a')]=function(_0x5ed4c5,_0x2fca54){return db[_0xb27e('0x42')][_0xb27e('0x4a')](_0x5ed4c5[_0xb27e('0x4b')],{})[_0xb27e('0x24')](function(_0x16a71b){var _0x320b9c=_0x5ed4c5[_0xb27e('0x4c')][_0xb27e('0x26')]({'plain':!![]});if(!_0x320b9c)throw new Error(_0xb27e('0x4d'));if(_0x320b9c[_0xb27e('0x4e')]==='user'){var _0x876b1a=_0x16a71b['get']({'plain':!![]});var _0x18bb5c=_0xb27e('0x27');return db[_0xb27e('0x4f')][_0xb27e('0x49')]({'where':{'name':_0x18bb5c,'userProfileId':_0x320b9c[_0xb27e('0x50')]},'raw':!![]})[_0xb27e('0x24')](function(_0xf901b1){if(_0xf901b1&&_0xf901b1[_0xb27e('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x876b1a[_0xb27e('0x2b')],'resourceId':_0x876b1a['id'],'type':_0xf901b1[_0xb27e('0x2b')],'sectionId':_0xf901b1['id']},{})[_0xb27e('0x24')](function(){return _0x16a71b;});}else{return _0x16a71b;}})['catch'](function(_0x1c4846){logger['error'](_0xb27e('0x52'),_0x1c4846);throw _0x1c4846;});}return _0x16a71b;})[_0xb27e('0x24')](respondWithResult(_0x2fca54,0xc9))[_0xb27e('0x46')](handleError(_0x2fca54,null));};exports['update']=function(_0x30d7d7,_0x5b2cd7){if(_0x30d7d7[_0xb27e('0x4b')]['id']){delete _0x30d7d7[_0xb27e('0x4b')]['id'];}return db[_0xb27e('0x42')][_0xb27e('0x49')]({'where':{'id':_0x30d7d7['params']['id']}})[_0xb27e('0x24')](handleEntityNotFound(_0x5b2cd7,null))[_0xb27e('0x24')](saveUpdates(_0x30d7d7[_0xb27e('0x4b')],null))[_0xb27e('0x24')](respondWithResult(_0x5b2cd7,null))[_0xb27e('0x46')](handleError(_0x5b2cd7,null));};exports[_0xb27e('0x25')]=function(_0x22e8f7,_0x287aad){return db[_0xb27e('0x42')]['find']({'where':{'id':_0x22e8f7[_0xb27e('0x48')]['id']}})['then'](handleEntityNotFound(_0x287aad,null))['then'](removeEntity(_0x287aad,null))[_0xb27e('0x46')](handleError(_0x287aad,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 793c087..774fb60 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 _0xe004=['define','CmHopperAdditionalPhone','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x442d83,_0x41c218){var _0x5651be=function(_0x24dc9e){while(--_0x24dc9e){_0x442d83['push'](_0x442d83['shift']());}};_0x5651be(++_0x41c218);}(_0xe004,0x1a4));var _0x4e00=function(_0x6545ca,_0x5f257f){_0x6545ca=_0x6545ca-0x0;var _0x5f3bfe=_0xe004[_0x6545ca];return _0x5f3bfe;};'use strict';var _=require('lodash');var util=require(_0x4e00('0x0'));var logger=require('../../config/logger')(_0x4e00('0x1'));var moment=require(_0x4e00('0x2'));var BPromise=require(_0x4e00('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e00('0x4'));var rimraf=require(_0x4e00('0x5'));var config=require(_0x4e00('0x6'));var attributes=require(_0x4e00('0x7'));module[_0x4e00('0x8')]=function(_0x38bbd1,_0x4bc449){return _0x38bbd1[_0x4e00('0x9')](_0x4e00('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x824a=['cm_hopper_additional_phones','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone'];(function(_0x2de831,_0x2025ea){var _0x247c16=function(_0x4d335c){while(--_0x4d335c){_0x2de831['push'](_0x2de831['shift']());}};_0x247c16(++_0x2025ea);}(_0x824a,0xa9));var _0xa824=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x824a[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xa824('0x0'));var logger=require(_0xa824('0x1'))(_0xa824('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa824('0x3'));var fs=require('fs');var path=require(_0xa824('0x4'));var rimraf=require(_0xa824('0x5'));var config=require(_0xa824('0x6'));var attributes=require(_0xa824('0x7'));module[_0xa824('0x8')]=function(_0x8b996d,_0x5380e7){return _0x8b996d[_0xa824('0x9')](_0xa824('0xa'),attributes,{'tableName':_0xa824('0xb'),'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 aee147f..732250f 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 _0xcae9=['updatedAt','additionalToHop','sequelize','update','IncrementPreviewCounters','field','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','request\x20sent','debug','stringify','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','countcongestionretry','countabandonedretry','entity','SwapAdditionalPhones','ListId','waitTime','scheduledat','add','minutes','phone','isNil','createdAt'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xcae9,0xe2));var _0x9cae=function(_0x15cae3,_0x458cb9){_0x15cae3=_0x15cae3-0x0;var _0x20596f=_0xcae9[_0x15cae3];return _0x20596f;};'use strict';var _=require(_0x9cae('0x0'));var util=require('util');var moment=require(_0x9cae('0x1'));var BPromise=require(_0x9cae('0x2'));var rs=require(_0x9cae('0x3'));var fs=require('fs');var Redis=require(_0x9cae('0x4'));var db=require(_0x9cae('0x5'))['db'];var utils=require(_0x9cae('0x6'));var logger=require(_0x9cae('0x7'))('rpc');var config=require(_0x9cae('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9cae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bf641,_0x52fe2f,_0x2b0a1b){return new BPromise(function(_0x1e600a,_0x3152c3){return client['request'](_0x3bf641,_0x2b0a1b)[_0x9cae('0xa')](function(_0x56b11e){logger[_0x9cae('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x52fe2f,_0x9cae('0xc'));logger[_0x9cae('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x52fe2f,_0x9cae('0xc'),JSON[_0x9cae('0xe')](_0x56b11e));if(_0x56b11e['error']){if(_0x56b11e[_0x9cae('0xf')][_0x9cae('0x10')]===0x1f4){logger[_0x9cae('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x52fe2f,_0x56b11e[_0x9cae('0xf')][_0x9cae('0x11')]);return _0x3152c3(_0x56b11e['error'][_0x9cae('0x11')]);}logger[_0x9cae('0xf')](_0x9cae('0x12'),_0x52fe2f,_0x56b11e[_0x9cae('0xf')][_0x9cae('0x11')]);return _0x1e600a(_0x56b11e[_0x9cae('0xf')]['message']);}else{logger[_0x9cae('0xb')](_0x9cae('0x12'),_0x52fe2f,_0x9cae('0xc'));_0x1e600a(_0x56b11e[_0x9cae('0x13')][_0x9cae('0x11')]);}})[_0x9cae('0x14')](function(_0x2952c5){logger[_0x9cae('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x52fe2f,_0x2952c5);_0x3152c3(_0x2952c5);});});}exports[_0x9cae('0x15')]=function(_0x473d30){var _0x1f5e73=this;return new Promise(function(_0x34d084,_0x5ea393){return db[_0x9cae('0x16')][_0x9cae('0x17')]({'raw':!![],'where':{'ContactId':_0x473d30[_0x9cae('0x18')]['ContactId'],'ListId':_0x473d30[_0x9cae('0x18')]['ListId'],'VoiceQueueId':_0x473d30['body']['VoiceQueueId']===undefined?null:_0x473d30[_0x9cae('0x18')][_0x9cae('0x19')],'CampaignId':_0x473d30[_0x9cae('0x18')][_0x9cae('0x1a')]===undefined?null:_0x473d30[_0x9cae('0x18')]['CampaignId']}})[_0x9cae('0xa')](function(_0x1efe82){if(_0x1efe82!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1efe82['id'],'OrderBy':{'$gt':_0x1efe82[_0x9cae('0x1b')]}},'order':[[_0x9cae('0x1b'),_0x9cae('0x1c')]]})[_0x9cae('0xa')](function(_0x57a836){var _0xcb9b59=0x0;if(_0x57a836){if(_0x57a836[_0x9cae('0x1d')]+_0x57a836['countcongestionretry']+_0x57a836[_0x9cae('0x1e')]+_0x57a836[_0x9cae('0x1f')]+_0x57a836[_0x9cae('0x20')]+_0x57a836['countabandonedretry']+_0x57a836[_0x9cae('0x21')]+_0x57a836[_0x9cae('0x22')]<_0x473d30['entity'][_0x9cae('0x23')])_0xcb9b59=0x1;_0x34d084({'additional':_0xcb9b59});}else{return db[_0x9cae('0x24')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1efe82['id']},'order':[[_0x9cae('0x1b'),_0x9cae('0x1c')]]})[_0x9cae('0xa')](function(_0x34a77f){var _0x2a41ea=0x0;if(_0x34a77f){if(_0x34a77f[_0x9cae('0x1d')]+_0x34a77f[_0x9cae('0x25')]+_0x34a77f['countnoanswerretry']+_0x34a77f['countnosuchnumberretry']+_0x34a77f['countdropretry']+_0x34a77f[_0x9cae('0x26')]+_0x34a77f[_0x9cae('0x21')]+_0x34a77f['countagentrejectretry']<_0x473d30[_0x9cae('0x27')][_0x9cae('0x23')])_0x2a41ea=0x1;_0x34d084({'additional':_0x2a41ea});}else{_0x34d084({'additional':0x0});}})[_0x9cae('0x14')](function(_0x12750a){logger[_0x9cae('0xf')](_0x9cae('0x15'),_0x12750a[_0x9cae('0x11')],_0x473d30);_0x5ea393(_0x1f5e73[_0x9cae('0xf')](0x1f4,_0x12750a['message']));});}})[_0x9cae('0x14')](function(_0x48971a){logger[_0x9cae('0xf')](_0x9cae('0x15'),_0x48971a[_0x9cae('0x11')],_0x473d30);_0x5ea393(_0x1f5e73[_0x9cae('0xf')](0x1f4,_0x48971a['message']));});}else _0x34d084({'additional':0x0});});});};exports[_0x9cae('0x28')]=function(_0xc599af){var _0x4c3238=this;return new Promise(function(_0x38da2c,_0x5b0674){return db[_0x9cae('0x16')][_0x9cae('0x17')]({'raw':!![],'where':{'ContactId':_0xc599af[_0x9cae('0x18')]['ContactId'],'ListId':_0xc599af[_0x9cae('0x18')][_0x9cae('0x29')],'VoiceQueueId':_0xc599af[_0x9cae('0x18')][_0x9cae('0x19')]===undefined?null:_0xc599af[_0x9cae('0x18')]['VoiceQueueId'],'CampaignId':_0xc599af['body'][_0x9cae('0x1a')]===undefined?null:_0xc599af[_0x9cae('0x18')]['CampaignId']}})[_0x9cae('0xa')](function(_0x3fab11){if(_0x3fab11!=null){return db[_0x9cae('0x24')][_0x9cae('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3fab11['id'],'OrderBy':{'$gt':_0x3fab11[_0x9cae('0x1b')]}},'order':[[_0x9cae('0x1b'),'ASC']]})[_0x9cae('0xa')](function(_0x4adae4){if(_0x4adae4)return activateAdditionalPhone(_0x3fab11,_0xc599af[_0x9cae('0x18')],_0x4adae4,_0xc599af['duration'],_0xc599af[_0x9cae('0x2a')])[_0x9cae('0xa')](function(_0x4755f9){_0x38da2c(_0x4755f9);});else{return db[_0x9cae('0x24')][_0x9cae('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3fab11['id']},'order':[['OrderBy',_0x9cae('0x1c')]]})['then'](function(_0x37d80d){if(_0x37d80d)return activateAdditionalPhone(_0x3fab11,_0xc599af[_0x9cae('0x18')],_0x37d80d,_0xc599af['duration'],_0xc599af[_0x9cae('0x2a')])[_0x9cae('0xa')](function(_0x549f3e){_0x38da2c(_0x549f3e);});else{_0x38da2c({'id':_0x3fab11['id'],'phone':''});}})[_0x9cae('0x14')](function(_0x12617b){logger[_0x9cae('0xf')](_0x9cae('0x15'),_0x12617b[_0x9cae('0x11')],_0xc599af);_0x5b0674(_0x4c3238[_0x9cae('0xf')](0x1f4,_0x12617b[_0x9cae('0x11')]));});}})[_0x9cae('0x14')](function(_0xff8e0b){logger['error'](_0x9cae('0x15'),_0xff8e0b['message'],_0xc599af);_0x5b0674(_0x4c3238[_0x9cae('0xf')](0x1f4,_0xff8e0b['message']));});}else _0x38da2c(0x1);});});};function activateAdditionalPhone(_0x535e72,_0x3822d7,_0x23c514,_0x57e0ff,_0x44bc7a){return new Promise(function(_0x5002b5,_0x409b04){logger[_0x9cae('0xb')]('VerifyAdditionalPhones',_0x23c514);var _0x29e766;if(moment()>moment(_0x23c514[_0x9cae('0x2b')])){_0x29e766=moment()[_0x9cae('0x2c')](_0x44bc7a||0x3,_0x9cae('0x2d'));}else{if(_0x23c514['OrderBy']==0x0){_0x29e766=moment(_0x23c514[_0x9cae('0x2b')]);}else{_0x29e766=moment()[_0x9cae('0x2c')](_0x44bc7a||0x3,_0x9cae('0x2d'));}}var _0x1907f9={'phone':_0x535e72[_0x9cae('0x2e')],'active':0x0,'OrderBy':_[_0x9cae('0x2f')](_0x535e72[_0x9cae('0x1b')])?0x0:_0x535e72[_0x9cae('0x1b')],'scheduledat':moment()[_0x9cae('0x2c')](_0x57e0ff||0x1,_0x9cae('0x2d')),'countbusyretry':_0x3822d7[_0x9cae('0x1d')],'countcongestionretry':_0x3822d7[_0x9cae('0x25')],'countnoanswerretry':_0x3822d7[_0x9cae('0x1e')],'countnosuchnumberretry':_0x3822d7[_0x9cae('0x1f')],'countdropretry':_0x3822d7[_0x9cae('0x20')],'countabandonedretry':_0x3822d7[_0x9cae('0x26')],'countmachineretry':_0x3822d7['countmachineretry'],'countagentrejectretry':_0x3822d7[_0x9cae('0x22')],'createdAt':_0x3822d7[_0x9cae('0x30')],'updatedAt':_0x3822d7['updatedAt']};var _0x451335={'CmHopperId':_0x535e72['id'],'phone':_0x23c514[_0x9cae('0x2e')],'active':0x0,'OrderBy':_[_0x9cae('0x2f')](_0x23c514[_0x9cae('0x1b')])?0x0:_0x23c514[_0x9cae('0x1b')],'scheduledat':_0x29e766,'countbusyretry':_0x23c514[_0x9cae('0x1d')],'countcongestionretry':_0x23c514[_0x9cae('0x25')],'countnoanswerretry':_0x23c514[_0x9cae('0x1e')],'countnosuchnumberretry':_0x3822d7['countnosuchnumberretry'],'countdropretry':_0x3822d7[_0x9cae('0x20')],'countabandonedretry':_0x3822d7['countabandonedretry'],'countmachineretry':_0x3822d7['countmachineretry'],'countagentrejectretry':_0x3822d7['countagentrejectretry'],'createdAt':_0x23c514[_0x9cae('0x30')],'updatedAt':_0x23c514[_0x9cae('0x31')]};logger[_0x9cae('0xb')]('hopperToAdd',_0x1907f9);logger[_0x9cae('0xb')](_0x9cae('0x32'),_0x451335);return db[_0x9cae('0x33')]['transaction'](function(_0x210764){return db[_0x9cae('0x24')][_0x9cae('0x34')](_0x1907f9,{'where':{'id':_0x23c514['id']}},{'transaction':_0x210764})[_0x9cae('0xa')](function(){return db[_0x9cae('0x16')][_0x9cae('0x34')](_0x451335,{'where':{'id':_0x535e72['id']}},{'transaction':_0x210764});});})['then'](function(_0x3b3d3c){_0x5002b5({'id':_0x535e72['id'],'phone':_0x23c514[_0x9cae('0x2e')]});})[_0x9cae('0x14')](function(_0x55f25b){logger['error'](_0x9cae('0x15'),_0x55f25b[_0x9cae('0x11')],req);_0x409b04(_this[_0x9cae('0xf')](0x1f4,_0x55f25b[_0x9cae('0x11')]));});});}exports[_0x9cae('0x35')]=function(_0x35d9fe){var _0x56128b=this;return new Promise(function(_0x30d432,_0x1a43c6){return db[_0x9cae('0x16')][_0x9cae('0x34')](_0x35d9fe[_0x9cae('0x18')][_0x9cae('0x36')],{'where':{'id':_0x35d9fe[_0x9cae('0x18')]['id']}})[_0x9cae('0xa')](function(_0x449081){_0x30d432(_0x449081);})[_0x9cae('0x14')](function(_0x580aa5){logger[_0x9cae('0xf')](_0x9cae('0x35'),_0x580aa5['message'],_0x35d9fe);_0x1a43c6(_0x56128b[_0x9cae('0xf')](0x1f4,_0x580aa5[_0x9cae('0x11')]));});});}; \ No newline at end of file +var _0x6d50=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','VerifyAdditionalPhones','body','ListId','VoiceQueueId','CampaignId','findOne','OrderBy','ASC','countbusyretry','countnosuchnumberretry','countabandonedretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','catch','SwapAdditionalPhones','CmHopper','ContactId','duration','waitTime','scheduledat','add','minutes','phone','countdropretry','createdAt','updatedAt','isNil','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x4c74ae,_0x12408d){var _0x307451=function(_0x210931){while(--_0x210931){_0x4c74ae['push'](_0x4c74ae['shift']());}};_0x307451(++_0x12408d);}(_0x6d50,0x1a6));var _0x06d5=function(_0x24219d,_0x2f6213){_0x24219d=_0x24219d-0x0;var _0x39dda0=_0x6d50[_0x24219d];return _0x39dda0;};'use strict';var _=require(_0x06d5('0x0'));var util=require(_0x06d5('0x1'));var moment=require('moment');var BPromise=require(_0x06d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x06d5('0x3'))['db'];var utils=require(_0x06d5('0x4'));var logger=require(_0x06d5('0x5'))(_0x06d5('0x6'));var config=require(_0x06d5('0x7'));var jayson=require(_0x06d5('0x8'));var client=jayson[_0x06d5('0x9')][_0x06d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a2d3b,_0x253c72,_0x459677){return new BPromise(function(_0xf81756,_0x396f78){return client[_0x06d5('0xb')](_0x2a2d3b,_0x459677)[_0x06d5('0xc')](function(_0x4ab682){logger[_0x06d5('0xd')](_0x06d5('0xe'),_0x253c72,'request\x20sent');logger[_0x06d5('0xf')](_0x06d5('0x10'),_0x253c72,_0x06d5('0x11'),JSON[_0x06d5('0x12')](_0x4ab682));if(_0x4ab682[_0x06d5('0x13')]){if(_0x4ab682[_0x06d5('0x13')]['code']===0x1f4){logger[_0x06d5('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x253c72,_0x4ab682[_0x06d5('0x13')][_0x06d5('0x14')]);return _0x396f78(_0x4ab682['error'][_0x06d5('0x14')]);}logger[_0x06d5('0x13')](_0x06d5('0xe'),_0x253c72,_0x4ab682[_0x06d5('0x13')][_0x06d5('0x14')]);return _0xf81756(_0x4ab682[_0x06d5('0x13')][_0x06d5('0x14')]);}else{logger[_0x06d5('0xd')](_0x06d5('0xe'),_0x253c72,_0x06d5('0x11'));_0xf81756(_0x4ab682[_0x06d5('0x15')][_0x06d5('0x14')]);}})['catch'](function(_0x43dfc2){logger[_0x06d5('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x253c72,_0x43dfc2);_0x396f78(_0x43dfc2);});});}exports[_0x06d5('0x16')]=function(_0xb4bc1a){var _0x213a2a=this;return new Promise(function(_0x5178b6,_0x4e082e){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0xb4bc1a[_0x06d5('0x17')]['ContactId'],'ListId':_0xb4bc1a[_0x06d5('0x17')][_0x06d5('0x18')],'VoiceQueueId':_0xb4bc1a['body'][_0x06d5('0x19')]===undefined?null:_0xb4bc1a[_0x06d5('0x17')][_0x06d5('0x19')],'CampaignId':_0xb4bc1a[_0x06d5('0x17')]['CampaignId']===undefined?null:_0xb4bc1a[_0x06d5('0x17')][_0x06d5('0x1a')]}})[_0x06d5('0xc')](function(_0x4cdb4a){if(_0x4cdb4a!=null){return db['CmHopperAdditionalPhone'][_0x06d5('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x4cdb4a['id'],'OrderBy':{'$gt':_0x4cdb4a[_0x06d5('0x1c')]}},'order':[['OrderBy',_0x06d5('0x1d')]]})[_0x06d5('0xc')](function(_0x300488){var _0x1bc3b8=0x0;if(_0x300488){if(_0x300488[_0x06d5('0x1e')]+_0x300488['countcongestionretry']+_0x300488['countnoanswerretry']+_0x300488[_0x06d5('0x1f')]+_0x300488['countdropretry']+_0x300488[_0x06d5('0x20')]+_0x300488['countmachineretry']+_0x300488['countagentrejectretry']<_0xb4bc1a[_0x06d5('0x21')][_0x06d5('0x22')])_0x1bc3b8=0x1;_0x5178b6({'additional':_0x1bc3b8});}else{return db[_0x06d5('0x23')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4cdb4a['id']},'order':[['OrderBy',_0x06d5('0x1d')]]})[_0x06d5('0xc')](function(_0xac3828){var _0x58e5d0=0x0;if(_0xac3828){if(_0xac3828[_0x06d5('0x1e')]+_0xac3828[_0x06d5('0x24')]+_0xac3828[_0x06d5('0x25')]+_0xac3828['countnosuchnumberretry']+_0xac3828['countdropretry']+_0xac3828[_0x06d5('0x20')]+_0xac3828[_0x06d5('0x26')]+_0xac3828[_0x06d5('0x27')]<_0xb4bc1a[_0x06d5('0x21')][_0x06d5('0x22')])_0x58e5d0=0x1;_0x5178b6({'additional':_0x58e5d0});}else{_0x5178b6({'additional':0x0});}})[_0x06d5('0x28')](function(_0x39be11){logger[_0x06d5('0x13')](_0x06d5('0x16'),_0x39be11[_0x06d5('0x14')],_0xb4bc1a);_0x4e082e(_0x213a2a['error'](0x1f4,_0x39be11['message']));});}})[_0x06d5('0x28')](function(_0x2af796){logger[_0x06d5('0x13')](_0x06d5('0x16'),_0x2af796[_0x06d5('0x14')],_0xb4bc1a);_0x4e082e(_0x213a2a[_0x06d5('0x13')](0x1f4,_0x2af796['message']));});}else _0x5178b6({'additional':0x0});});});};exports[_0x06d5('0x29')]=function(_0x1fa6e2){var _0x43af69=this;return new Promise(function(_0xbc748c,_0x5cc29b){return db[_0x06d5('0x2a')]['findOne']({'raw':!![],'where':{'ContactId':_0x1fa6e2[_0x06d5('0x17')][_0x06d5('0x2b')],'ListId':_0x1fa6e2['body']['ListId'],'VoiceQueueId':_0x1fa6e2[_0x06d5('0x17')][_0x06d5('0x19')]===undefined?null:_0x1fa6e2[_0x06d5('0x17')]['VoiceQueueId'],'CampaignId':_0x1fa6e2['body']['CampaignId']===undefined?null:_0x1fa6e2[_0x06d5('0x17')][_0x06d5('0x1a')]}})[_0x06d5('0xc')](function(_0x4de82a){if(_0x4de82a!=null){return db[_0x06d5('0x23')][_0x06d5('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x4de82a['id'],'OrderBy':{'$gt':_0x4de82a[_0x06d5('0x1c')]}},'order':[[_0x06d5('0x1c'),_0x06d5('0x1d')]]})[_0x06d5('0xc')](function(_0x372dce){if(_0x372dce)return activateAdditionalPhone(_0x4de82a,_0x1fa6e2[_0x06d5('0x17')],_0x372dce,_0x1fa6e2[_0x06d5('0x2c')],_0x1fa6e2[_0x06d5('0x2d')])[_0x06d5('0xc')](function(_0x455f4d){_0xbc748c(_0x455f4d);});else{return db[_0x06d5('0x23')][_0x06d5('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x4de82a['id']},'order':[[_0x06d5('0x1c'),_0x06d5('0x1d')]]})[_0x06d5('0xc')](function(_0x4b0a97){if(_0x4b0a97)return activateAdditionalPhone(_0x4de82a,_0x1fa6e2[_0x06d5('0x17')],_0x4b0a97,_0x1fa6e2[_0x06d5('0x2c')],_0x1fa6e2[_0x06d5('0x2d')])[_0x06d5('0xc')](function(_0x50a39b){_0xbc748c(_0x50a39b);});else{_0xbc748c({'id':_0x4de82a['id'],'phone':''});}})[_0x06d5('0x28')](function(_0x3eb714){logger[_0x06d5('0x13')](_0x06d5('0x16'),_0x3eb714['message'],_0x1fa6e2);_0x5cc29b(_0x43af69[_0x06d5('0x13')](0x1f4,_0x3eb714[_0x06d5('0x14')]));});}})['catch'](function(_0x46c052){logger['error']('VerifyAdditionalPhones',_0x46c052[_0x06d5('0x14')],_0x1fa6e2);_0x5cc29b(_0x43af69[_0x06d5('0x13')](0x1f4,_0x46c052[_0x06d5('0x14')]));});}else _0xbc748c(0x1);});});};function activateAdditionalPhone(_0x27df93,_0x125dcf,_0x3d22f5,_0x2929fb,_0x242047){return new Promise(function(_0xa289cc,_0x1fb586){logger[_0x06d5('0xd')]('VerifyAdditionalPhones',_0x3d22f5);var _0x1cd668;if(moment()>moment(_0x3d22f5[_0x06d5('0x2e')])){_0x1cd668=moment()[_0x06d5('0x2f')](_0x242047||0x3,_0x06d5('0x30'));}else{if(_0x3d22f5[_0x06d5('0x1c')]==0x0){_0x1cd668=moment(_0x3d22f5[_0x06d5('0x2e')]);}else{_0x1cd668=moment()['add'](_0x242047||0x3,_0x06d5('0x30'));}}var _0x19d27c={'phone':_0x27df93[_0x06d5('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x27df93[_0x06d5('0x1c')])?0x0:_0x27df93[_0x06d5('0x1c')],'scheduledat':moment()[_0x06d5('0x2f')](_0x2929fb||0x1,_0x06d5('0x30')),'countbusyretry':_0x125dcf['countbusyretry'],'countcongestionretry':_0x125dcf[_0x06d5('0x24')],'countnoanswerretry':_0x125dcf[_0x06d5('0x25')],'countnosuchnumberretry':_0x125dcf[_0x06d5('0x1f')],'countdropretry':_0x125dcf[_0x06d5('0x32')],'countabandonedretry':_0x125dcf['countabandonedretry'],'countmachineretry':_0x125dcf[_0x06d5('0x26')],'countagentrejectretry':_0x125dcf[_0x06d5('0x27')],'createdAt':_0x125dcf[_0x06d5('0x33')],'updatedAt':_0x125dcf[_0x06d5('0x34')]};var _0x58f453={'CmHopperId':_0x27df93['id'],'phone':_0x3d22f5['phone'],'active':0x0,'OrderBy':_[_0x06d5('0x35')](_0x3d22f5[_0x06d5('0x1c')])?0x0:_0x3d22f5['OrderBy'],'scheduledat':_0x1cd668,'countbusyretry':_0x3d22f5[_0x06d5('0x1e')],'countcongestionretry':_0x3d22f5[_0x06d5('0x24')],'countnoanswerretry':_0x3d22f5['countnoanswerretry'],'countnosuchnumberretry':_0x125dcf[_0x06d5('0x1f')],'countdropretry':_0x125dcf[_0x06d5('0x32')],'countabandonedretry':_0x125dcf[_0x06d5('0x20')],'countmachineretry':_0x125dcf['countmachineretry'],'countagentrejectretry':_0x125dcf[_0x06d5('0x27')],'createdAt':_0x3d22f5['createdAt'],'updatedAt':_0x3d22f5[_0x06d5('0x34')]};logger[_0x06d5('0xd')](_0x06d5('0x36'),_0x19d27c);logger[_0x06d5('0xd')](_0x06d5('0x37'),_0x58f453);return db[_0x06d5('0x38')][_0x06d5('0x39')](function(_0x3e9f29){return db[_0x06d5('0x23')][_0x06d5('0x3a')](_0x19d27c,{'where':{'id':_0x3d22f5['id']}},{'transaction':_0x3e9f29})[_0x06d5('0xc')](function(){return db[_0x06d5('0x2a')][_0x06d5('0x3a')](_0x58f453,{'where':{'id':_0x27df93['id']}},{'transaction':_0x3e9f29});});})[_0x06d5('0xc')](function(_0x5eb57e){_0xa289cc({'id':_0x27df93['id'],'phone':_0x3d22f5[_0x06d5('0x31')]});})['catch'](function(_0x20f487){logger[_0x06d5('0x13')](_0x06d5('0x16'),_0x20f487[_0x06d5('0x14')],req);_0x1fb586(_this[_0x06d5('0x13')](0x1f4,_0x20f487[_0x06d5('0x14')]));});});}exports[_0x06d5('0x3b')]=function(_0x25fff6){var _0x58fa48=this;return new Promise(function(_0x50bd37,_0x77f7f2){return db['CmHopper'][_0x06d5('0x3a')](_0x25fff6[_0x06d5('0x17')][_0x06d5('0x3c')],{'where':{'id':_0x25fff6[_0x06d5('0x17')]['id']}})[_0x06d5('0xc')](function(_0x243233){_0x50bd37(_0x243233);})[_0x06d5('0x28')](function(_0x3b479d){logger[_0x06d5('0x13')](_0x06d5('0x3b'),_0x3b479d[_0x06d5('0x14')],_0x25fff6);_0x77f7f2(_0x58fa48[_0x06d5('0x13')](0x1f4,_0x3b479d['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index e4bac5f..eaecefe 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 _0xc41a=['update','delete','/:id','destroy','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','show','post','create'];(function(_0x5e8205,_0x4d16a6){var _0x1376c7=function(_0x46dcc3){while(--_0x46dcc3){_0x5e8205['push'](_0x5e8205['shift']());}};_0x1376c7(++_0x4d16a6);}(_0xc41a,0x19c));var _0xac41=function(_0x5e0257,_0x25bc85){_0x5e0257=_0x5e0257-0x0;var _0x4493ce=_0xc41a[_0x5e0257];return _0x4493ce;};'use strict';var multer=require(_0xac41('0x0'));var util=require(_0xac41('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac41('0x2')]();var auth=require(_0xac41('0x3'));var interaction=require(_0xac41('0x4'));var config=require(_0xac41('0x5'));var controller=require(_0xac41('0x6'));router['get']('/',auth[_0xac41('0x7')](),controller[_0xac41('0x8')]);router[_0xac41('0x9')]('/:id',auth[_0xac41('0x7')](),controller[_0xac41('0xa')]);router[_0xac41('0xb')]('/',auth[_0xac41('0x7')](),controller[_0xac41('0xc')]);router['put']('/:id',auth[_0xac41('0x7')](),controller[_0xac41('0xd')]);router[_0xac41('0xe')](_0xac41('0xf'),auth[_0xac41('0x7')](),controller[_0xac41('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8bb2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','multer','path','connect-timeout','express','Router'];(function(_0x560b20,_0x378201){var _0x267755=function(_0x36a3cb){while(--_0x36a3cb){_0x560b20['push'](_0x560b20['shift']());}};_0x267755(++_0x378201);}(_0x8bb2,0x13b));var _0x28bb=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x8bb2[_0x50e593];return _0x3821d0;};'use strict';var multer=require(_0x28bb('0x0'));var util=require('util');var path=require(_0x28bb('0x1'));var timeout=require(_0x28bb('0x2'));var express=require(_0x28bb('0x3'));var router=express[_0x28bb('0x4')]();var auth=require(_0x28bb('0x5'));var interaction=require(_0x28bb('0x6'));var config=require(_0x28bb('0x7'));var controller=require(_0x28bb('0x8'));router[_0x28bb('0x9')]('/',auth[_0x28bb('0xa')](),controller[_0x28bb('0xb')]);router[_0x28bb('0x9')]('/:id',auth[_0x28bb('0xa')](),controller[_0x28bb('0xc')]);router[_0x28bb('0xd')]('/',auth['isAuthenticated'](),controller[_0x28bb('0xe')]);router[_0x28bb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x28bb('0x10')]);router[_0x28bb('0x11')](_0x28bb('0x12'),auth[_0x28bb('0xa')](),controller[_0x28bb('0x13')]);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 76dc7d1..b63a49a 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 _0x844a=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x844a,0x8a));var _0xa844=function(_0x4fc7e5,_0x278c25){_0x4fc7e5=_0x4fc7e5-0x0;var _0x122086=_0x844a[_0x4fc7e5];return _0x122086;};'use strict';var moment=require(_0xa844('0x0'));var Sequelize=require(_0xa844('0x1'));module[_0xa844('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa844('0x3')],'unique':_0xa844('0x4')},'ListId':{'type':Sequelize[_0xa844('0x3')],'unique':_0xa844('0x4')},'VoiceQueueId':{'type':Sequelize[_0xa844('0x3')],'unique':_0xa844('0x4')}}; \ No newline at end of file +var _0xab05=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xab05,0x195));var _0x5ab0=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xab05[_0x23e7c1];return _0x1add43;};'use strict';var moment=require(_0x5ab0('0x0'));var Sequelize=require(_0x5ab0('0x1'));module[_0x5ab0('0x2')]={'phone':{'type':Sequelize[_0x5ab0('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5ab0('0x4')],'unique':_0x5ab0('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x5ab0('0x4')],'unique':_0x5ab0('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7fed15c..f1d2806 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 _0x5149=['keys','include','options','find','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','includeAll','rows','catch','params'];(function(_0xa9859c,_0x50500d){var _0x3e23f9=function(_0x4f242a){while(--_0x4f242a){_0xa9859c['push'](_0xa9859c['shift']());}};_0x3e23f9(++_0x50500d);}(_0x5149,0x127));var _0x9514=function(_0x718a85,_0x5272fb){_0x718a85=_0x718a85-0x0;var _0x180486=_0x5149[_0x718a85];return _0x180486;};'use strict';var pdf=require(_0x9514('0x0'));var emlformat=require(_0x9514('0x1'));var rimraf=require(_0x9514('0x2'));var zipdir=require(_0x9514('0x3'));var jsonpatch=require(_0x9514('0x4'));var rp=require('request-promise');var moment=require(_0x9514('0x5'));var BPromise=require(_0x9514('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9514('0x7'));var csv=require(_0x9514('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9514('0x9'));var squel=require(_0x9514('0xa'));var crypto=require(_0x9514('0xb'));var jsforce=require(_0x9514('0xc'));var deskjs=require(_0x9514('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9514('0xe'));var Papa=require(_0x9514('0xf'));var Redis=require(_0x9514('0x10'));var authService=require(_0x9514('0x11'));var qs=require(_0x9514('0x12'));var as=require(_0x9514('0x13'));var hardwareService=require(_0x9514('0x14'));var logger=require(_0x9514('0x15'))(_0x9514('0x16'));var utils=require('../../config/utils');var config=require(_0x9514('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9514('0x18'))['db'];function respondWithStatusCode(_0x1cf3af,_0x3295e9){_0x3295e9=_0x3295e9||0xcc;return function(_0x164fa6){if(_0x164fa6){return _0x1cf3af[_0x9514('0x19')](_0x3295e9);}return _0x1cf3af[_0x9514('0x1a')](_0x3295e9)[_0x9514('0x1b')]();};}function respondWithResult(_0x43ca14,_0x5cee42){_0x5cee42=_0x5cee42||0xc8;return function(_0x3289c7){if(_0x3289c7){return _0x43ca14['status'](_0x5cee42)['json'](_0x3289c7);}};}function respondWithFilteredResult(_0x26a1ba,_0x1680c4){return function(_0x57f7d2){if(_0x57f7d2){var _0x323590=_0x57f7d2[_0x9514('0x1c')],_0x480520=_0x1680c4[_0x9514('0x1d')],_0x25b63b=_0x1680c4[_0x9514('0x1d')]+_0x1680c4[_0x9514('0x1e')],_0x48db2c;if(_0x25b63b>=_0x323590){_0x25b63b=_0x323590;_0x48db2c=0xc8;}else{_0x48db2c=0xce;}_0x26a1ba[_0x9514('0x1a')](_0x48db2c);return _0x26a1ba[_0x9514('0x1f')](_0x9514('0x20'),_0x480520+'-'+_0x25b63b+'/'+_0x323590)[_0x9514('0x21')](_0x57f7d2);}return null;};}function patchUpdates(_0x2a63e7){return function(_0x45b03b){try{jsonpatch[_0x9514('0x22')](_0x45b03b,_0x2a63e7,!![]);}catch(_0x354c1b){return BPromise['reject'](_0x354c1b);}return _0x45b03b[_0x9514('0x23')]();};}function saveUpdates(_0x26bc2c,_0x5c1fab){return function(_0x4b1835){if(_0x4b1835){return _0x4b1835[_0x9514('0x24')](_0x26bc2c)[_0x9514('0x25')](function(_0x408545){return _0x408545;});}return null;};}function removeEntity(_0x567ad7,_0x503663){return function(_0x2e186d){if(_0x2e186d){return _0x2e186d['destroy']()[_0x9514('0x25')](function(){_0x567ad7[_0x9514('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1816da,_0x267fc1){return function(_0x535e4d){if(!_0x535e4d){_0x1816da[_0x9514('0x19')](0x194);}return _0x535e4d;};}function handleError(_0x4d6a3f,_0x569e1b){_0x569e1b=_0x569e1b||0x1f4;return function(_0x211a1e){logger['error'](_0x211a1e[_0x9514('0x26')]);if(_0x211a1e[_0x9514('0x27')]){delete _0x211a1e[_0x9514('0x27')];}_0x4d6a3f['status'](_0x569e1b)[_0x9514('0x28')](_0x211a1e);};}exports[_0x9514('0x29')]=function(_0x1449a6,_0xf9dfaa){var _0x4816d3={},_0x36c2a6={},_0x2415dc={'count':0x0,'rows':[]};var _0x1cf192=_['map'](db[_0x9514('0x2a')][_0x9514('0x2b')],function(_0x2c7a5c){return{'name':_0x2c7a5c[_0x9514('0x2c')],'type':_0x2c7a5c[_0x9514('0x2d')][_0x9514('0x2e')]};});_0x36c2a6[_0x9514('0x2f')]=_[_0x9514('0x30')](_0x1cf192,_0x9514('0x27'));_0x36c2a6[_0x9514('0x31')]=_['keys'](_0x1449a6[_0x9514('0x31')]);_0x36c2a6[_0x9514('0x32')]=_[_0x9514('0x33')](_0x36c2a6[_0x9514('0x2f')],_0x36c2a6[_0x9514('0x31')]);_0x4816d3['attributes']=_[_0x9514('0x33')](_0x36c2a6[_0x9514('0x2f')],qs['fields'](_0x1449a6[_0x9514('0x31')][_0x9514('0x34')]));_0x4816d3['attributes']=_0x4816d3[_0x9514('0x35')][_0x9514('0x36')]?_0x4816d3[_0x9514('0x35')]:_0x36c2a6[_0x9514('0x2f')];if(!_0x1449a6[_0x9514('0x31')]['hasOwnProperty'](_0x9514('0x37'))){_0x4816d3['limit']=qs['limit'](_0x1449a6[_0x9514('0x31')][_0x9514('0x1e')]);_0x4816d3[_0x9514('0x1d')]=qs['offset'](_0x1449a6['query'][_0x9514('0x1d')]);}_0x4816d3[_0x9514('0x38')]=qs[_0x9514('0x39')](_0x1449a6[_0x9514('0x31')][_0x9514('0x39')]);_0x4816d3[_0x9514('0x3a')]=qs[_0x9514('0x32')](_[_0x9514('0x3b')](_0x1449a6['query'],_0x36c2a6['filters']),_0x1cf192);if(_0x1449a6[_0x9514('0x31')]['filter']){_0x4816d3[_0x9514('0x3a')]=_[_0x9514('0x3c')](_0x4816d3[_0x9514('0x3a')],{'$or':_[_0x9514('0x30')](_0x1cf192,function(_0x1e737d){if(_0x1e737d[_0x9514('0x2d')]!=='VIRTUAL'){var _0x2a5cc9={};_0x2a5cc9[_0x1e737d['name']]={'$like':'%'+_0x1449a6[_0x9514('0x31')]['filter']+'%'};return _0x2a5cc9;}})});}_0x4816d3=_['merge']({},_0x4816d3,_0x1449a6['options']);var _0x35e83f={'where':_0x4816d3[_0x9514('0x3a')]};return db['CmHopperBlack'][_0x9514('0x1c')](_0x35e83f)[_0x9514('0x25')](function(_0x2857c6){_0x2415dc[_0x9514('0x1c')]=_0x2857c6;if(_0x1449a6['query'][_0x9514('0x3d')]){_0x4816d3['include']=[{'all':!![]}];}return db[_0x9514('0x2a')]['findAll'](_0x4816d3);})[_0x9514('0x25')](function(_0x205a5e){_0x2415dc[_0x9514('0x3e')]=_0x205a5e;return _0x2415dc;})['then'](respondWithFilteredResult(_0xf9dfaa,_0x4816d3))[_0x9514('0x3f')](handleError(_0xf9dfaa,null));};exports['show']=function(_0xa4ce5d,_0x171068){var _0x1c3014={'raw':!![],'where':{'id':_0xa4ce5d[_0x9514('0x40')]['id']}},_0x136634={};_0x136634[_0x9514('0x2f')]=_['keys'](db[_0x9514('0x2a')][_0x9514('0x2b')]);_0x136634[_0x9514('0x31')]=_[_0x9514('0x41')](_0xa4ce5d['query']);_0x136634[_0x9514('0x32')]=_[_0x9514('0x33')](_0x136634[_0x9514('0x2f')],_0x136634['query']);_0x1c3014[_0x9514('0x35')]=_['intersection'](_0x136634[_0x9514('0x2f')],qs[_0x9514('0x34')](_0xa4ce5d[_0x9514('0x31')][_0x9514('0x34')]));_0x1c3014['attributes']=_0x1c3014[_0x9514('0x35')][_0x9514('0x36')]?_0x1c3014['attributes']:_0x136634[_0x9514('0x2f')];if(_0xa4ce5d[_0x9514('0x31')][_0x9514('0x3d')]){_0x1c3014[_0x9514('0x42')]=[{'all':!![]}];}_0x1c3014=_[_0x9514('0x3c')]({},_0x1c3014,_0xa4ce5d[_0x9514('0x43')]);return db[_0x9514('0x2a')][_0x9514('0x44')](_0x1c3014)['then'](handleEntityNotFound(_0x171068,null))[_0x9514('0x25')](respondWithResult(_0x171068,null))[_0x9514('0x3f')](handleError(_0x171068,null));};exports[_0x9514('0x24')]=function(_0x407f0e,_0xe7a3d5){if(_0x407f0e[_0x9514('0x45')]['id']){delete _0x407f0e[_0x9514('0x45')]['id'];}return db[_0x9514('0x2a')][_0x9514('0x44')]({'where':{'id':_0x407f0e['params']['id']}})[_0x9514('0x25')](handleEntityNotFound(_0xe7a3d5,null))['then'](saveUpdates(_0x407f0e[_0x9514('0x45')],null))['then'](respondWithResult(_0xe7a3d5,null))[_0x9514('0x3f')](handleError(_0xe7a3d5,null));};exports[_0x9514('0x46')]=function(_0x45c017,_0x372b69){return db[_0x9514('0x2a')][_0x9514('0x44')]({'where':{'id':_0x45c017['params']['id']}})[_0x9514('0x25')](handleEntityNotFound(_0x372b69,null))[_0x9514('0x25')](removeEntity(_0x372b69,null))[_0x9514('0x3f')](handleError(_0x372b69,null));};exports['describe']=function(_0x3e8868,_0x51964b){return db[_0x9514('0x2a')][_0x9514('0x47')]()[_0x9514('0x25')](respondWithResult(_0x51964b,null))[_0x9514('0x3f')](handleError(_0x51964b,null));}; \ No newline at end of file +var _0x3aca=['include','findAll','catch','show','length','find','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','status','end','count','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','limit','offset','where','pick','filters','merge','options','CmHopperBlack'];(function(_0x1e85cc,_0x50652b){var _0x165760=function(_0x40d65a){while(--_0x40d65a){_0x1e85cc['push'](_0x1e85cc['shift']());}};_0x165760(++_0x50652b);}(_0x3aca,0xde));var _0xa3ac=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x3aca[_0x87b0ff];return _0x3bc0b2;};'use strict';var pdf=require(_0xa3ac('0x0'));var emlformat=require(_0xa3ac('0x1'));var rimraf=require(_0xa3ac('0x2'));var zipdir=require(_0xa3ac('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa3ac('0x4'));var moment=require(_0xa3ac('0x5'));var BPromise=require(_0xa3ac('0x6'));var Mustache=require(_0xa3ac('0x7'));var util=require(_0xa3ac('0x8'));var path=require(_0xa3ac('0x9'));var sox=require(_0xa3ac('0xa'));var csv=require(_0xa3ac('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa3ac('0xc'));var squel=require(_0xa3ac('0xd'));var crypto=require(_0xa3ac('0xe'));var jsforce=require(_0xa3ac('0xf'));var deskjs=require(_0xa3ac('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa3ac('0x11'));var Papa=require(_0xa3ac('0x12'));var Redis=require(_0xa3ac('0x13'));var authService=require(_0xa3ac('0x14'));var qs=require(_0xa3ac('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3ac('0x16'));var logger=require(_0xa3ac('0x17'))('api');var utils=require(_0xa3ac('0x18'));var config=require(_0xa3ac('0x19'));var licenseUtil=require(_0xa3ac('0x1a'));var db=require(_0xa3ac('0x1b'))['db'];function respondWithStatusCode(_0x256127,_0x5f0830){_0x5f0830=_0x5f0830||0xcc;return function(_0x55c20d){if(_0x55c20d){return _0x256127['sendStatus'](_0x5f0830);}return _0x256127[_0xa3ac('0x1c')](_0x5f0830)[_0xa3ac('0x1d')]();};}function respondWithResult(_0x500b14,_0x5c67bc){_0x5c67bc=_0x5c67bc||0xc8;return function(_0xd54820){if(_0xd54820){return _0x500b14['status'](_0x5c67bc)['json'](_0xd54820);}};}function respondWithFilteredResult(_0x352994,_0x47c0ed){return function(_0x38d925){if(_0x38d925){var _0x36a6b6=_0x38d925[_0xa3ac('0x1e')],_0x1083b=_0x47c0ed['offset'],_0x2eec46=_0x47c0ed['offset']+_0x47c0ed['limit'],_0x4cf705;if(_0x2eec46>=_0x36a6b6){_0x2eec46=_0x36a6b6;_0x4cf705=0xc8;}else{_0x4cf705=0xce;}_0x352994[_0xa3ac('0x1c')](_0x4cf705);return _0x352994['set']('Content-Range',_0x1083b+'-'+_0x2eec46+'/'+_0x36a6b6)['json'](_0x38d925);}return null;};}function patchUpdates(_0x2f2c61){return function(_0xe99efe){try{jsonpatch[_0xa3ac('0x1f')](_0xe99efe,_0x2f2c61,!![]);}catch(_0x4163a7){return BPromise['reject'](_0x4163a7);}return _0xe99efe[_0xa3ac('0x20')]();};}function saveUpdates(_0x49e75d,_0x2b147e){return function(_0x5570ef){if(_0x5570ef){return _0x5570ef[_0xa3ac('0x21')](_0x49e75d)['then'](function(_0x1dc218){return _0x1dc218;});}return null;};}function removeEntity(_0x44cee4,_0x3252b6){return function(_0x30353d){if(_0x30353d){return _0x30353d[_0xa3ac('0x22')]()[_0xa3ac('0x23')](function(){_0x44cee4[_0xa3ac('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3abe70,_0x9d0da7){return function(_0x4a7a13){if(!_0x4a7a13){_0x3abe70[_0xa3ac('0x24')](0x194);}return _0x4a7a13;};}function handleError(_0x187492,_0x3a13cc){_0x3a13cc=_0x3a13cc||0x1f4;return function(_0x309207){logger[_0xa3ac('0x25')](_0x309207[_0xa3ac('0x26')]);if(_0x309207['name']){delete _0x309207[_0xa3ac('0x27')];}_0x187492[_0xa3ac('0x1c')](_0x3a13cc)[_0xa3ac('0x28')](_0x309207);};}exports[_0xa3ac('0x29')]=function(_0x33979a,_0x6ffe77){var _0x3b0aad={},_0x4dc4d9={},_0x47cb88={'count':0x0,'rows':[]};var _0x468e80=_[_0xa3ac('0x2a')](db['CmHopperBlack'][_0xa3ac('0x2b')],function(_0x2614eb){return{'name':_0x2614eb[_0xa3ac('0x2c')],'type':_0x2614eb[_0xa3ac('0x2d')][_0xa3ac('0x2e')]};});_0x4dc4d9[_0xa3ac('0x2f')]=_[_0xa3ac('0x2a')](_0x468e80,_0xa3ac('0x27'));_0x4dc4d9['query']=_[_0xa3ac('0x30')](_0x33979a[_0xa3ac('0x31')]);_0x4dc4d9['filters']=_[_0xa3ac('0x32')](_0x4dc4d9[_0xa3ac('0x2f')],_0x4dc4d9['query']);_0x3b0aad[_0xa3ac('0x33')]=_[_0xa3ac('0x32')](_0x4dc4d9[_0xa3ac('0x2f')],qs[_0xa3ac('0x34')](_0x33979a[_0xa3ac('0x31')][_0xa3ac('0x34')]));_0x3b0aad['attributes']=_0x3b0aad[_0xa3ac('0x33')]['length']?_0x3b0aad[_0xa3ac('0x33')]:_0x4dc4d9['model'];if(!_0x33979a[_0xa3ac('0x31')][_0xa3ac('0x35')]('nolimit')){_0x3b0aad['limit']=qs[_0xa3ac('0x36')](_0x33979a['query']['limit']);_0x3b0aad[_0xa3ac('0x37')]=qs['offset'](_0x33979a[_0xa3ac('0x31')][_0xa3ac('0x37')]);}_0x3b0aad['order']=qs['sort'](_0x33979a[_0xa3ac('0x31')]['sort']);_0x3b0aad[_0xa3ac('0x38')]=qs['filters'](_[_0xa3ac('0x39')](_0x33979a[_0xa3ac('0x31')],_0x4dc4d9[_0xa3ac('0x3a')]),_0x468e80);if(_0x33979a[_0xa3ac('0x31')]['filter']){_0x3b0aad[_0xa3ac('0x38')]=_[_0xa3ac('0x3b')](_0x3b0aad[_0xa3ac('0x38')],{'$or':_[_0xa3ac('0x2a')](_0x468e80,function(_0x618eb6){if(_0x618eb6[_0xa3ac('0x2d')]!=='VIRTUAL'){var _0x123460={};_0x123460[_0x618eb6[_0xa3ac('0x27')]]={'$like':'%'+_0x33979a[_0xa3ac('0x31')]['filter']+'%'};return _0x123460;}})});}_0x3b0aad=_[_0xa3ac('0x3b')]({},_0x3b0aad,_0x33979a[_0xa3ac('0x3c')]);var _0x286605={'where':_0x3b0aad[_0xa3ac('0x38')]};return db[_0xa3ac('0x3d')][_0xa3ac('0x1e')](_0x286605)['then'](function(_0x1b53b2){_0x47cb88[_0xa3ac('0x1e')]=_0x1b53b2;if(_0x33979a[_0xa3ac('0x31')]['includeAll']){_0x3b0aad[_0xa3ac('0x3e')]=[{'all':!![]}];}return db[_0xa3ac('0x3d')][_0xa3ac('0x3f')](_0x3b0aad);})[_0xa3ac('0x23')](function(_0x5dfbbf){_0x47cb88['rows']=_0x5dfbbf;return _0x47cb88;})[_0xa3ac('0x23')](respondWithFilteredResult(_0x6ffe77,_0x3b0aad))[_0xa3ac('0x40')](handleError(_0x6ffe77,null));};exports[_0xa3ac('0x41')]=function(_0x45b524,_0x54d209){var _0x3ba223={'raw':!![],'where':{'id':_0x45b524['params']['id']}},_0x53e5be={};_0x53e5be[_0xa3ac('0x2f')]=_[_0xa3ac('0x30')](db[_0xa3ac('0x3d')][_0xa3ac('0x2b')]);_0x53e5be[_0xa3ac('0x31')]=_[_0xa3ac('0x30')](_0x45b524[_0xa3ac('0x31')]);_0x53e5be[_0xa3ac('0x3a')]=_[_0xa3ac('0x32')](_0x53e5be[_0xa3ac('0x2f')],_0x53e5be[_0xa3ac('0x31')]);_0x3ba223[_0xa3ac('0x33')]=_[_0xa3ac('0x32')](_0x53e5be['model'],qs[_0xa3ac('0x34')](_0x45b524[_0xa3ac('0x31')][_0xa3ac('0x34')]));_0x3ba223['attributes']=_0x3ba223[_0xa3ac('0x33')][_0xa3ac('0x42')]?_0x3ba223['attributes']:_0x53e5be['model'];if(_0x45b524[_0xa3ac('0x31')]['includeAll']){_0x3ba223['include']=[{'all':!![]}];}_0x3ba223=_[_0xa3ac('0x3b')]({},_0x3ba223,_0x45b524[_0xa3ac('0x3c')]);return db[_0xa3ac('0x3d')][_0xa3ac('0x43')](_0x3ba223)[_0xa3ac('0x23')](handleEntityNotFound(_0x54d209,null))[_0xa3ac('0x23')](respondWithResult(_0x54d209,null))['catch'](handleError(_0x54d209,null));};exports[_0xa3ac('0x21')]=function(_0x403492,_0x109096){if(_0x403492[_0xa3ac('0x44')]['id']){delete _0x403492[_0xa3ac('0x44')]['id'];}return db[_0xa3ac('0x3d')][_0xa3ac('0x43')]({'where':{'id':_0x403492[_0xa3ac('0x45')]['id']}})[_0xa3ac('0x23')](handleEntityNotFound(_0x109096,null))[_0xa3ac('0x23')](saveUpdates(_0x403492['body'],null))[_0xa3ac('0x23')](respondWithResult(_0x109096,null))[_0xa3ac('0x40')](handleError(_0x109096,null));};exports[_0xa3ac('0x22')]=function(_0x315b33,_0x38e727){return db['CmHopperBlack']['find']({'where':{'id':_0x315b33[_0xa3ac('0x45')]['id']}})[_0xa3ac('0x23')](handleEntityNotFound(_0x38e727,null))[_0xa3ac('0x23')](removeEntity(_0x38e727,null))['catch'](handleError(_0x38e727,null));};exports[_0xa3ac('0x46')]=function(_0x1c61e2,_0x2fe49d){return db[_0xa3ac('0x3d')][_0xa3ac('0x46')]()[_0xa3ac('0x23')](respondWithResult(_0x2fe49d,null))[_0xa3ac('0x40')](handleError(_0x2fe49d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index c2dd6a9..3bdffe9 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 _0x525c=['util','../../config/logger','api','moment','bluebird','request-promise','path','./cmHopperBlack.attributes','exports','cm_hopper_black','lodash'];(function(_0x9c0336,_0x500ffb){var _0x53caa4=function(_0x2f2c8b){while(--_0x2f2c8b){_0x9c0336['push'](_0x9c0336['shift']());}};_0x53caa4(++_0x500ffb);}(_0x525c,0xfc));var _0xc525=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x525c[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xc525('0x0'));var util=require(_0xc525('0x1'));var logger=require(_0xc525('0x2'))(_0xc525('0x3'));var moment=require(_0xc525('0x4'));var BPromise=require(_0xc525('0x5'));var rp=require(_0xc525('0x6'));var fs=require('fs');var path=require(_0xc525('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc525('0x8'));module[_0xc525('0x9')]=function(_0x509474,_0x1daa95){return _0x509474['define']('CmHopperBlack',attributes,{'tableName':_0xc525('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72b9=['../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','util','api','moment','bluebird','path','rimraf'];(function(_0x59b48b,_0x584733){var _0x4c3f79=function(_0x3f2e94){while(--_0x3f2e94){_0x59b48b['push'](_0x59b48b['shift']());}};_0x4c3f79(++_0x584733);}(_0x72b9,0x1c8));var _0x972b=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0x72b9[_0x558e45];return _0x3e9075;};'use strict';var _=require('lodash');var util=require(_0x972b('0x0'));var logger=require('../../config/logger')(_0x972b('0x1'));var moment=require(_0x972b('0x2'));var BPromise=require(_0x972b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x972b('0x4'));var rimraf=require(_0x972b('0x5'));var config=require(_0x972b('0x6'));var attributes=require(_0x972b('0x7'));module['exports']=function(_0x50aee8,_0x2fa18f){return _0x50aee8[_0x972b('0x8')](_0x972b('0x9'),attributes,{'tableName':_0x972b('0xa'),'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 92f048f..c65e2dd 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 _0x0db0=['update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','model','map','catch'];(function(_0x4d688b,_0x28a0a4){var _0x11f2b8=function(_0x3dde93){while(--_0x3dde93){_0x4d688b['push'](_0x4d688b['shift']());}};_0x11f2b8(++_0x28a0a4);}(_0x0db0,0x176));var _0x00db=function(_0x1eeb15,_0x539688){_0x1eeb15=_0x1eeb15-0x0;var _0x12a9ce=_0x0db0[_0x1eeb15];return _0x12a9ce;};'use strict';var _=require(_0x00db('0x0'));var util=require(_0x00db('0x1'));var moment=require('moment');var BPromise=require(_0x00db('0x2'));var rs=require(_0x00db('0x3'));var fs=require('fs');var Redis=require(_0x00db('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x00db('0x5'));var logger=require(_0x00db('0x6'))('rpc');var config=require(_0x00db('0x7'));var jayson=require(_0x00db('0x8'));var client=jayson[_0x00db('0x9')][_0x00db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54dc29,_0x525616,_0x4b9d8a){return new BPromise(function(_0x47f5cd,_0x4a9134){return client[_0x00db('0xb')](_0x54dc29,_0x4b9d8a)[_0x00db('0xc')](function(_0x101766){logger['info'](_0x00db('0xd'),_0x525616,_0x00db('0xe'));logger[_0x00db('0xf')](_0x00db('0x10'),_0x525616,'request\x20sent',JSON[_0x00db('0x11')](_0x101766));if(_0x101766[_0x00db('0x12')]){if(_0x101766['error']['code']===0x1f4){logger[_0x00db('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x525616,_0x101766['error'][_0x00db('0x13')]);return _0x4a9134(_0x101766[_0x00db('0x12')][_0x00db('0x13')]);}logger[_0x00db('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x525616,_0x101766[_0x00db('0x12')][_0x00db('0x13')]);return _0x47f5cd(_0x101766['error'][_0x00db('0x13')]);}else{logger[_0x00db('0x14')](_0x00db('0xd'),_0x525616,'request\x20sent');_0x47f5cd(_0x101766[_0x00db('0x15')][_0x00db('0x13')]);}})['catch'](function(_0x56c5da){logger[_0x00db('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x525616,_0x56c5da);_0x4a9134(_0x56c5da);});});}exports[_0x00db('0x16')]=function(_0x5a48ea){var _0x39c2b4=this;return new Promise(function(_0x13924a,_0x3bbc8d){return db[_0x00db('0x17')]['findAll']({'raw':_0x5a48ea[_0x00db('0x18')]?_0x5a48ea[_0x00db('0x18')][_0x00db('0x19')]===undefined?!![]:![]:!![],'where':_0x5a48ea[_0x00db('0x18')]?_0x5a48ea[_0x00db('0x18')][_0x00db('0x1a')]||null:null,'attributes':_0x5a48ea[_0x00db('0x18')]?_0x5a48ea[_0x00db('0x18')][_0x00db('0x1b')]||null:null,'limit':_0x5a48ea[_0x00db('0x18')]?_0x5a48ea[_0x00db('0x18')][_0x00db('0x1c')]||null:null,'include':_0x5a48ea[_0x00db('0x18')]?_0x5a48ea[_0x00db('0x18')][_0x00db('0x1d')]?_['map'](_0x5a48ea['options'][_0x00db('0x1d')],function(_0x5e69ad){return{'model':db[_0x5e69ad[_0x00db('0x1e')]],'as':_0x5e69ad['as'],'attributes':_0x5e69ad[_0x00db('0x1b')],'include':_0x5e69ad[_0x00db('0x1d')]?_[_0x00db('0x1f')](_0x5e69ad[_0x00db('0x1d')],function(_0x1fe0b3){return{'model':db[_0x1fe0b3['model']],'as':_0x1fe0b3['as'],'attributes':_0x1fe0b3['attributes'],'include':_0x1fe0b3[_0x00db('0x1d')]?_[_0x00db('0x1f')](_0x1fe0b3[_0x00db('0x1d')],function(_0x10627d){return{'model':db[_0x10627d[_0x00db('0x1e')]],'as':_0x10627d['as'],'attributes':_0x10627d[_0x00db('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x00db('0xc')](function(_0x15147a){logger[_0x00db('0x14')](_0x00db('0x16'),_0x5a48ea);logger[_0x00db('0xf')](_0x00db('0x16'),_0x5a48ea,JSON[_0x00db('0x11')](_0x15147a));_0x13924a(_0x15147a);})[_0x00db('0x20')](function(_0x45aff0){logger[_0x00db('0x12')]('GetCmHopperBlack',_0x45aff0['message'],_0x5a48ea);_0x3bbc8d(_0x39c2b4[_0x00db('0x12')](0x1f4,_0x45aff0[_0x00db('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0xe61da7){var _0x568cd7=this;return new Promise(function(_0x4e7fef,_0x31e1ad){return db[_0x00db('0x17')][_0x00db('0x21')](_0xe61da7[_0x00db('0x22')],{'raw':_0xe61da7[_0x00db('0x18')]?_0xe61da7[_0x00db('0x18')][_0x00db('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe61da7['options']?_0xe61da7[_0x00db('0x18')]['where']||null:null,'attributes':_0xe61da7[_0x00db('0x18')]?_0xe61da7[_0x00db('0x18')][_0x00db('0x1b')]||null:null,'limit':_0xe61da7['options']?_0xe61da7[_0x00db('0x18')][_0x00db('0x1c')]||null:null})[_0x00db('0xc')](function(_0x52ed5d){logger[_0x00db('0x14')](_0x00db('0x23'),_0xe61da7);logger[_0x00db('0xf')](_0x00db('0x23'),_0xe61da7,JSON['stringify'](_0x52ed5d));_0x4e7fef(_0x52ed5d);})[_0x00db('0x20')](function(_0x179034){logger[_0x00db('0x12')]('UpdateCmHopperBlack',_0x179034[_0x00db('0x13')],_0xe61da7);_0x31e1ad(_0x568cd7[_0x00db('0x12')](0x1f4,_0x179034[_0x00db('0x13')]));});});};exports[_0x00db('0x24')]=function(_0x486598){var _0x496aa1=this;return new Promise(function(_0x5891cd,_0x14d58d){return db[_0x00db('0x17')]['destroy']({'where':_0x486598[_0x00db('0x18')]?_0x486598[_0x00db('0x18')][_0x00db('0x1a')]||null:null})[_0x00db('0xc')](function(_0x516412){logger[_0x00db('0x14')](_0x00db('0x24'),_0x486598);logger[_0x00db('0xf')](_0x00db('0x24'),_0x486598,JSON[_0x00db('0x11')](_0x516412));_0x5891cd(_0x516412);})['catch'](function(_0x133664){logger[_0x00db('0x12')](_0x00db('0x24'),_0x133664[_0x00db('0x13')],_0x486598);_0x14d58d(_0x496aa1['error'](0x1f4,_0x133664[_0x00db('0x13')]));});});}; \ No newline at end of file +var _0x56ec=['code','message','catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','GetCmHopperBlack','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xa69ec8,_0x80959d){var _0x1e7a66=function(_0x24de7c){while(--_0x24de7c){_0xa69ec8['push'](_0xa69ec8['shift']());}};_0x1e7a66(++_0x80959d);}(_0x56ec,0x15f));var _0xc56e=function(_0x55e626,_0x18792b){_0x55e626=_0x55e626-0x0;var _0x14a5a6=_0x56ec[_0x55e626];return _0x14a5a6;};'use strict';var _=require(_0xc56e('0x0'));var util=require(_0xc56e('0x1'));var moment=require(_0xc56e('0x2'));var BPromise=require(_0xc56e('0x3'));var rs=require(_0xc56e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc56e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc56e('0x6'))(_0xc56e('0x7'));var config=require('../../config/environment');var jayson=require(_0xc56e('0x8'));var client=jayson[_0xc56e('0x9')][_0xc56e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24c769,_0x3c6a66,_0x2290f9){return new BPromise(function(_0xe003a6,_0xca3e2b){return client['request'](_0x24c769,_0x2290f9)[_0xc56e('0xb')](function(_0x5ba47d){logger[_0xc56e('0xc')](_0xc56e('0xd'),_0x3c6a66,_0xc56e('0xe'));logger[_0xc56e('0xf')](_0xc56e('0x10'),_0x3c6a66,_0xc56e('0xe'),JSON[_0xc56e('0x11')](_0x5ba47d));if(_0x5ba47d['error']){if(_0x5ba47d[_0xc56e('0x12')][_0xc56e('0x13')]===0x1f4){logger['error'](_0xc56e('0xd'),_0x3c6a66,_0x5ba47d[_0xc56e('0x12')][_0xc56e('0x14')]);return _0xca3e2b(_0x5ba47d[_0xc56e('0x12')][_0xc56e('0x14')]);}logger[_0xc56e('0x12')](_0xc56e('0xd'),_0x3c6a66,_0x5ba47d['error']['message']);return _0xe003a6(_0x5ba47d[_0xc56e('0x12')][_0xc56e('0x14')]);}else{logger[_0xc56e('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x3c6a66,'request\x20sent');_0xe003a6(_0x5ba47d['result']['message']);}})[_0xc56e('0x15')](function(_0x3ab20d){logger[_0xc56e('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x3c6a66,_0x3ab20d);_0xca3e2b(_0x3ab20d);});});}exports['GetCmHopperBlack']=function(_0x42df17){var _0x4c3b87=this;return new Promise(function(_0x17b5c8,_0x2d7d80){return db[_0xc56e('0x16')][_0xc56e('0x17')]({'raw':_0x42df17['options']?_0x42df17[_0xc56e('0x18')][_0xc56e('0x19')]===undefined?!![]:![]:!![],'where':_0x42df17[_0xc56e('0x18')]?_0x42df17[_0xc56e('0x18')][_0xc56e('0x1a')]||null:null,'attributes':_0x42df17['options']?_0x42df17[_0xc56e('0x18')][_0xc56e('0x1b')]||null:null,'limit':_0x42df17['options']?_0x42df17[_0xc56e('0x18')][_0xc56e('0x1c')]||null:null,'include':_0x42df17[_0xc56e('0x18')]?_0x42df17['options']['include']?_['map'](_0x42df17[_0xc56e('0x18')][_0xc56e('0x1d')],function(_0x336ac1){return{'model':db[_0x336ac1[_0xc56e('0x1e')]],'as':_0x336ac1['as'],'attributes':_0x336ac1[_0xc56e('0x1b')],'include':_0x336ac1[_0xc56e('0x1d')]?_[_0xc56e('0x1f')](_0x336ac1['include'],function(_0x59d6d8){return{'model':db[_0x59d6d8[_0xc56e('0x1e')]],'as':_0x59d6d8['as'],'attributes':_0x59d6d8[_0xc56e('0x1b')],'include':_0x59d6d8[_0xc56e('0x1d')]?_[_0xc56e('0x1f')](_0x59d6d8[_0xc56e('0x1d')],function(_0x22c7ea){return{'model':db[_0x22c7ea[_0xc56e('0x1e')]],'as':_0x22c7ea['as'],'attributes':_0x22c7ea[_0xc56e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc56e('0xb')](function(_0x167369){logger[_0xc56e('0xc')](_0xc56e('0x20'),_0x42df17);logger[_0xc56e('0xf')](_0xc56e('0x20'),_0x42df17,JSON['stringify'](_0x167369));_0x17b5c8(_0x167369);})[_0xc56e('0x15')](function(_0xfae72e){logger[_0xc56e('0x12')](_0xc56e('0x20'),_0xfae72e[_0xc56e('0x14')],_0x42df17);_0x2d7d80(_0x4c3b87['error'](0x1f4,_0xfae72e[_0xc56e('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0x27f835){var _0x12dc07=this;return new Promise(function(_0x15951a,_0x448d98){return db[_0xc56e('0x16')]['update'](_0x27f835[_0xc56e('0x21')],{'raw':_0x27f835[_0xc56e('0x18')]?_0x27f835['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27f835[_0xc56e('0x18')]?_0x27f835['options'][_0xc56e('0x1a')]||null:null,'attributes':_0x27f835[_0xc56e('0x18')]?_0x27f835[_0xc56e('0x18')]['attributes']||null:null,'limit':_0x27f835[_0xc56e('0x18')]?_0x27f835['options'][_0xc56e('0x1c')]||null:null})[_0xc56e('0xb')](function(_0x4ee739){logger[_0xc56e('0xc')](_0xc56e('0x22'),_0x27f835);logger['debug'](_0xc56e('0x22'),_0x27f835,JSON['stringify'](_0x4ee739));_0x15951a(_0x4ee739);})[_0xc56e('0x15')](function(_0x3c008f){logger['error'](_0xc56e('0x22'),_0x3c008f['message'],_0x27f835);_0x448d98(_0x12dc07[_0xc56e('0x12')](0x1f4,_0x3c008f[_0xc56e('0x14')]));});});};exports[_0xc56e('0x23')]=function(_0x2699bc){var _0x8e3467=this;return new Promise(function(_0x41cc4c,_0x580843){return db[_0xc56e('0x16')][_0xc56e('0x24')]({'where':_0x2699bc['options']?_0x2699bc[_0xc56e('0x18')][_0xc56e('0x1a')]||null:null})[_0xc56e('0xb')](function(_0x5682c5){logger['info'](_0xc56e('0x23'),_0x2699bc);logger[_0xc56e('0xf')](_0xc56e('0x23'),_0x2699bc,JSON[_0xc56e('0x11')](_0x5682c5));_0x41cc4c(_0x5682c5);})['catch'](function(_0x1df68c){logger[_0xc56e('0x12')]('DestroyCmHopperBlack',_0x1df68c[_0xc56e('0x14')],_0x2699bc);_0x580843(_0x8e3467['error'](0x1f4,_0x1df68c[_0xc56e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index ed613aa..65c1edf 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 _0x7dfd=['index','/describe','describe','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x1a0642,_0x2d6007){var _0x1c803d=function(_0x37cb6f){while(--_0x37cb6f){_0x1a0642['push'](_0x1a0642['shift']());}};_0x1c803d(++_0x2d6007);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var auth=require(_0xd7df('0x6'));var interaction=require(_0xd7df('0x7'));var config=require(_0xd7df('0x8'));var controller=require(_0xd7df('0x9'));router[_0xd7df('0xa')]('/',auth[_0xd7df('0xb')](),controller[_0xd7df('0xc')]);router[_0xd7df('0xa')](_0xd7df('0xd'),auth[_0xd7df('0xb')](),controller[_0xd7df('0xe')]);router['get'](_0xd7df('0xf'),auth[_0xd7df('0xb')](),controller[_0xd7df('0x10')]);router[_0xd7df('0x11')]('/:id',auth[_0xd7df('0xb')](),controller['update']);router[_0xd7df('0x12')]('/:id',auth[_0xd7df('0xb')](),controller[_0xd7df('0x13')]);module[_0xd7df('0x14')]=router; \ No newline at end of file +var _0xb903=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','describe','/:id','exports','multer','util','path'];(function(_0x146fe9,_0x32165c){var _0xbecd0a=function(_0x9f2f9a){while(--_0x9f2f9a){_0x146fe9['push'](_0x146fe9['shift']());}};_0xbecd0a(++_0x32165c);}(_0xb903,0x185));var _0x3b90=function(_0x5bf848,_0x3daf0d){_0x5bf848=_0x5bf848-0x0;var _0x106484=_0xb903[_0x5bf848];return _0x106484;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var auth=require(_0x3b90('0x5'));var interaction=require(_0x3b90('0x6'));var config=require(_0x3b90('0x7'));var controller=require(_0x3b90('0x8'));router[_0x3b90('0x9')]('/',auth[_0x3b90('0xa')](),controller['index']);router[_0x3b90('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router[_0x3b90('0x9')](_0x3b90('0xc'),auth[_0x3b90('0xa')](),controller['show']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x3b90('0xc'),auth[_0x3b90('0xa')](),controller['destroy']);module[_0x3b90('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index dacd581..7728edb 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 _0x7612=['moment','exports','INTEGER','STRING','DATE','endtime','followuptime','diff','seconds','setDataValue','dispositionat','BOOLEAN','sequelize'];(function(_0x43794c,_0x4b4158){var _0xa31045=function(_0x2201e7){while(--_0x2201e7){_0x43794c['push'](_0x43794c['shift']());}};_0xa31045(++_0x4b4158);}(_0x7612,0x192));var _0x2761=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0x7612[_0x33fcbb];return _0x2efe40;};'use strict';var Sequelize=require(_0x2761('0x0'));var moment=require(_0x2761('0x1'));module[_0x2761('0x2')]={'state':{'type':Sequelize[_0x2761('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x2761('0x4')]},'scheduledat':{'type':Sequelize[_0x2761('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2761('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x2761('0x4')]},'originatecalleridname':{'type':Sequelize[_0x2761('0x4')]},'calleridnum':{'type':Sequelize[_0x2761('0x4')]},'calleridname':{'type':Sequelize[_0x2761('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x2761('0x5')]},'answertime':{'type':Sequelize[_0x2761('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2761('0x5')]},'ringtime':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x2761('0x4')]},'campaigntype':{'type':Sequelize[_0x2761('0x4')]},'membername':{'type':Sequelize[_0x2761('0x4')]},'reason':{'type':Sequelize[_0x2761('0x4')]},'disposition':{'type':Sequelize[_0x2761('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2761('0x4')]},'dispositionat':{'type':Sequelize[_0x2761('0x5')],'set':function(_0x544f5a){var _0x234aef=this['getDataValue'](_0x2761('0x6'));if(_0x234aef&&_0x544f5a){this['setDataValue'](_0x2761('0x7'),moment(_0x544f5a)[_0x2761('0x8')](moment(_0x234aef),_0x2761('0x9')));}return this[_0x2761('0xa')](_0x2761('0xb'),_0x544f5a);}},'amd':{'type':Sequelize[_0x2761('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2761('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2761('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2761('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x2761('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2761('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2761('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2761('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5111=['exports','DATE','INTEGER','STRING','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x4dfd10,_0x3169d5){var _0x267950=function(_0x15b4ae){while(--_0x15b4ae){_0x4dfd10['push'](_0x4dfd10['shift']());}};_0x267950(++_0x3169d5);}(_0x5111,0x132));var _0x1511=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5111[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x1511('0x0'));var moment=require(_0x1511('0x1'));module[_0x1511('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1511('0x3')]},'countbusyretry':{'type':Sequelize[_0x1511('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1511('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1511('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x1511('0x5')]},'originatecalleridname':{'type':Sequelize[_0x1511('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x1511('0x3')]},'responsetime':{'type':Sequelize[_0x1511('0x3')]},'answertime':{'type':Sequelize[_0x1511('0x3')]},'droptime':{'type':Sequelize[_0x1511('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x1511('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1511('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1511('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1511('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1511('0x5')]},'campaign':{'type':Sequelize[_0x1511('0x5')]},'campaigntype':{'type':Sequelize[_0x1511('0x5')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x1511('0x5')]},'disposition':{'type':Sequelize[_0x1511('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1511('0x5')]},'dispositionat':{'type':Sequelize[_0x1511('0x3')],'set':function(_0x1686fd){var _0x3e6e1f=this[_0x1511('0x6')](_0x1511('0x7'));if(_0x3e6e1f&&_0x1686fd){this[_0x1511('0x8')](_0x1511('0x9'),moment(_0x1686fd)[_0x1511('0xa')](moment(_0x3e6e1f),_0x1511('0xb')));}return this[_0x1511('0x8')](_0x1511('0xc'),_0x1686fd);}},'amd':{'type':Sequelize[_0x1511('0xd')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1511('0xd')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x1511('0xd')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x1511('0xd')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1511('0x3')]},'callback':{'type':Sequelize[_0x1511('0xd')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1511('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x1511('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1511('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x1511('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1511('0x4')],'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 8ba5dff..68bb382 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 _0x9649=['reCallContacts','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','state','CampaignId\x20=\x20?','checkContactHopper','CmHopper','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','describe','body','uniqueid','find','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`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'];(function(_0x4f0797,_0x258af1){var _0x3ebec2=function(_0x1630ab){while(--_0x1630ab){_0x4f0797['push'](_0x4f0797['shift']());}};_0x3ebec2(++_0x258af1);}(_0x9649,0x19f));var _0x9964=function(_0x220f29,_0x1266a8){_0x220f29=_0x220f29-0x0;var _0x12612d=_0x9649[_0x220f29];return _0x12612d;};'use strict';var pdf=require(_0x9964('0x0'));var emlformat=require(_0x9964('0x1'));var rimraf=require(_0x9964('0x2'));var zipdir=require(_0x9964('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9964('0x4'));var moment=require(_0x9964('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9964('0x6'));var util=require('util');var path=require(_0x9964('0x7'));var sox=require(_0x9964('0x8'));var csv=require(_0x9964('0x9'));var ejs=require(_0x9964('0xa'));var fs=require('fs');var _=require(_0x9964('0xb'));var squel=require(_0x9964('0xc'));var crypto=require(_0x9964('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9964('0xe'));var toCsv=require(_0x9964('0x9'));var querystring=require('querystring');var Papa=require(_0x9964('0xf'));var Redis=require(_0x9964('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9964('0x11'));var hardwareService=require(_0x9964('0x12'));var logger=require(_0x9964('0x13'))(_0x9964('0x14'));var utils=require(_0x9964('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9964('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56a69d,_0x39c624){_0x39c624=_0x39c624||0xcc;return function(_0x547b98){if(_0x547b98){return _0x56a69d[_0x9964('0x17')](_0x39c624);}return _0x56a69d[_0x9964('0x18')](_0x39c624)['end']();};}function respondWithResult(_0x1fd4b4,_0x463dbf){_0x463dbf=_0x463dbf||0xc8;return function(_0x11dfc9){if(_0x11dfc9){return _0x1fd4b4[_0x9964('0x18')](_0x463dbf)[_0x9964('0x19')](_0x11dfc9);}};}function respondWithFilteredResult(_0x5f002e,_0x411544){return function(_0x226e78){if(_0x226e78){var _0x57b330=_0x226e78[_0x9964('0x1a')],_0x2fd50d=_0x411544[_0x9964('0x1b')],_0x3fe796=_0x411544[_0x9964('0x1b')]+_0x411544[_0x9964('0x1c')],_0x57fe55;if(_0x3fe796>=_0x57b330){_0x3fe796=_0x57b330;_0x57fe55=0xc8;}else{_0x57fe55=0xce;}_0x5f002e['status'](_0x57fe55);return _0x5f002e[_0x9964('0x1d')](_0x9964('0x1e'),_0x2fd50d+'-'+_0x3fe796+'/'+_0x57b330)['json'](_0x226e78);}return null;};}function patchUpdates(_0x2eb3a8){return function(_0x3f6472){try{jsonpatch[_0x9964('0x1f')](_0x3f6472,_0x2eb3a8,!![]);}catch(_0x1477b5){return BPromise[_0x9964('0x20')](_0x1477b5);}return _0x3f6472[_0x9964('0x21')]();};}function saveUpdates(_0x400bb5,_0x414649){return function(_0x1072b5){if(_0x1072b5){return _0x1072b5[_0x9964('0x22')](_0x400bb5)['then'](function(_0x455b62){return _0x455b62;});}return null;};}function removeEntity(_0x447026,_0x4c479f){return function(_0x2b03a8){if(_0x2b03a8){return _0x2b03a8['destroy']()[_0x9964('0x23')](function(){_0x447026[_0x9964('0x18')](0xcc)[_0x9964('0x24')]();});}};}function handleEntityNotFound(_0x167525,_0x2d049c){return function(_0x62eda6){if(!_0x62eda6){_0x167525['sendStatus'](0x194);}return _0x62eda6;};}function handleError(_0x452c96,_0x378e34){_0x378e34=_0x378e34||0x1f4;return function(_0x5961e9){logger[_0x9964('0x25')](_0x5961e9[_0x9964('0x26')]);if(_0x5961e9[_0x9964('0x27')]){delete _0x5961e9[_0x9964('0x27')];}_0x452c96[_0x9964('0x18')](_0x378e34)['send'](_0x5961e9);};}exports[_0x9964('0x28')]=function(_0x4c2b44,_0x44cb60){var _0x512f6b={},_0x17b29f={},_0x5dc789={'count':0x0,'rows':[]};var _0x432f81=_[_0x9964('0x29')](db[_0x9964('0x2a')][_0x9964('0x2b')],function(_0x11cdce){return{'name':_0x11cdce[_0x9964('0x2c')],'type':_0x11cdce[_0x9964('0x2d')][_0x9964('0x2e')]};});_0x17b29f[_0x9964('0x2f')]=_['map'](_0x432f81,'name');_0x17b29f['query']=_['keys'](_0x4c2b44[_0x9964('0x30')]);_0x17b29f[_0x9964('0x31')]=_[_0x9964('0x32')](_0x17b29f[_0x9964('0x2f')],_0x17b29f[_0x9964('0x30')]);_0x512f6b[_0x9964('0x33')]=_[_0x9964('0x32')](_0x17b29f[_0x9964('0x2f')],qs[_0x9964('0x34')](_0x4c2b44['query'][_0x9964('0x34')]));_0x512f6b[_0x9964('0x33')]=_0x512f6b['attributes'][_0x9964('0x35')]?_0x512f6b[_0x9964('0x33')]:_0x17b29f[_0x9964('0x2f')];if(!_0x4c2b44[_0x9964('0x30')]['hasOwnProperty']('nolimit')){_0x512f6b[_0x9964('0x1c')]=qs['limit'](_0x4c2b44['query'][_0x9964('0x1c')]);_0x512f6b[_0x9964('0x1b')]=qs['offset'](_0x4c2b44['query'][_0x9964('0x1b')]);}_0x512f6b[_0x9964('0x36')]=qs['sort'](_0x4c2b44[_0x9964('0x30')]['sort']);_0x512f6b['where']=qs['filters'](_[_0x9964('0x37')](_0x4c2b44[_0x9964('0x30')],_0x17b29f[_0x9964('0x31')]),_0x432f81);if(_0x4c2b44[_0x9964('0x30')][_0x9964('0x38')]){_0x512f6b[_0x9964('0x39')]=_[_0x9964('0x3a')](_0x512f6b[_0x9964('0x39')],{'$or':_[_0x9964('0x29')](_0x432f81,function(_0x526c96){if(_0x526c96[_0x9964('0x2d')]!==_0x9964('0x3b')){var _0x39cd4a={};_0x39cd4a[_0x526c96[_0x9964('0x27')]]={'$like':'%'+_0x4c2b44['query']['filter']+'%'};return _0x39cd4a;}})});}_0x512f6b=_[_0x9964('0x3a')]({},_0x512f6b,_0x4c2b44[_0x9964('0x3c')]);var _0x3d9cbf={'where':_0x512f6b[_0x9964('0x39')]};return db[_0x9964('0x2a')]['count'](_0x3d9cbf)[_0x9964('0x23')](function(_0xca740f){_0x5dc789[_0x9964('0x1a')]=_0xca740f;if(_0x4c2b44[_0x9964('0x30')][_0x9964('0x3d')]){_0x512f6b[_0x9964('0x3e')]=[{'all':!![]}];}return db[_0x9964('0x2a')][_0x9964('0x3f')](_0x512f6b);})[_0x9964('0x23')](function(_0x29efe7){_0x5dc789[_0x9964('0x40')]=_0x29efe7;return _0x5dc789;})[_0x9964('0x23')](respondWithFilteredResult(_0x44cb60,_0x512f6b))[_0x9964('0x41')](handleError(_0x44cb60,null));};exports[_0x9964('0x42')]=function(_0x35348a,_0x2f625e){var _0x57e107={'raw':!![],'where':{'id':_0x35348a['params']['id']}},_0x344c6c={};_0x344c6c[_0x9964('0x2f')]=_[_0x9964('0x43')](db[_0x9964('0x2a')]['rawAttributes']);_0x344c6c[_0x9964('0x30')]=_['keys'](_0x35348a[_0x9964('0x30')]);_0x344c6c['filters']=_[_0x9964('0x32')](_0x344c6c[_0x9964('0x2f')],_0x344c6c[_0x9964('0x30')]);_0x57e107[_0x9964('0x33')]=_[_0x9964('0x32')](_0x344c6c[_0x9964('0x2f')],qs[_0x9964('0x34')](_0x35348a[_0x9964('0x30')]['fields']));_0x57e107[_0x9964('0x33')]=_0x57e107[_0x9964('0x33')][_0x9964('0x35')]?_0x57e107[_0x9964('0x33')]:_0x344c6c[_0x9964('0x2f')];if(_0x35348a[_0x9964('0x30')][_0x9964('0x3d')]){_0x57e107[_0x9964('0x3e')]=[{'all':!![]}];}_0x57e107=_[_0x9964('0x3a')]({},_0x57e107,_0x35348a[_0x9964('0x3c')]);return db['CmHopperFinal']['find'](_0x57e107)[_0x9964('0x23')](handleEntityNotFound(_0x2f625e,null))['then'](respondWithResult(_0x2f625e,null))[_0x9964('0x41')](handleError(_0x2f625e,null));};exports['describe']=function(_0x485dfc,_0x5d8720){return db[_0x9964('0x2a')][_0x9964('0x44')]()[_0x9964('0x23')](respondWithResult(_0x5d8720,null))['catch'](handleError(_0x5d8720,null));};exports['update']=function(_0x652882,_0x4aefaa){if(_0x652882[_0x9964('0x45')][_0x9964('0x46')]){delete _0x652882[_0x9964('0x45')][_0x9964('0x46')];}return db[_0x9964('0x2a')][_0x9964('0x47')]({'where':{'uniqueid':_0x652882['params']['id']}})[_0x9964('0x23')](handleEntityNotFound(_0x4aefaa,null))[_0x9964('0x23')](saveUpdates(_0x652882[_0x9964('0x45')],null))[_0x9964('0x23')](respondWithResult(_0x4aefaa,null))[_0x9964('0x41')](handleError(_0x4aefaa,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x1e7c32,_0x3873f5,_0x2847e8){return db['CmHopperFinal'][_0x9964('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x1e7c32[_0x9964('0x48')]['id']},'attributes':[[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')](_0x9964('0x4c')))),'noSuchContacts'],[db[_0x9964('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9964('0x49')]['literal'](_0x9964('0x4d')))),_0x9964('0x4e')],[db[_0x9964('0x49')]['fn']('COUNT',db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')](_0x9964('0x4f')))),_0x9964('0x50')],[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')]['literal'](_0x9964('0x51')))),'congestionContacts'],[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db[_0x9964('0x49')]['fn']('IF',db['sequelize'][_0x9964('0x4b')](_0x9964('0x52')))),_0x9964('0x53')],[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db['sequelize']['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')](_0x9964('0x54')))),_0x9964('0x55')],[db[_0x9964('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x9964('0x56')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0x9964('0x49')]['fn']('IF',db['sequelize'][_0x9964('0x4b')](_0x9964('0x57')))),_0x9964('0x58')]]})['then'](handleEntityNotFound(_0x3873f5,null))[_0x9964('0x23')](respondWithResult(_0x3873f5,null))['catch'](handleError(_0x3873f5,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3e4944,_0x192a2c,_0x2ffa8e){return db['CmHopperFinal'][_0x9964('0x3f')]({'raw':![],'where':{'CampaignId':_0x3e4944[_0x9964('0x48')]['id']},'attributes':[[db[_0x9964('0x49')]['fn']('COUNT',db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')](_0x9964('0x4d')))),_0x9964('0x4e')],[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')](_0x9964('0x4f')))),_0x9964('0x50')],[db[_0x9964('0x49')]['fn']('COUNT',db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')](_0x9964('0x51')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x9964('0x4b')](_0x9964('0x52')))),'dropContacts'],[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x9964('0x55')],[db[_0x9964('0x49')]['fn']('COUNT',db[_0x9964('0x49')]['fn']('IF',db['sequelize'][_0x9964('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x9964('0x59')],[db[_0x9964('0x49')]['fn']('COUNT',db[_0x9964('0x49')]['fn']('IF',db['sequelize']['literal'](_0x9964('0x57')))),'answeringMachine']]})[_0x9964('0x23')](handleEntityNotFound(_0x192a2c,null))['then'](respondWithResult(_0x192a2c,null))[_0x9964('0x41')](handleError(_0x192a2c,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x19c6f2,_0xe4a9a8,_0x336f52){return db[_0x9964('0x5a')][_0x9964('0x47')]({'where':{'id':_0x19c6f2[_0x9964('0x48')]['id']}})['then'](handleEntityNotFound(_0xe4a9a8,null))[_0x9964('0x23')](function(_0x2d90c9){var _0xa59931;if(_0x2d90c9){_0xa59931=squel['insert']()[_0x9964('0x5b')](_0x9964('0x5c'))[_0x9964('0x5d')]([_0x9964('0x5e'),_0x9964('0x5f'),_0x9964('0x60'),_0x9964('0x61'),_0x9964('0x62'),_0x9964('0x63'),_0x9964('0x64')],squel[_0x9964('0x65')]()['field'](_0x9964('0x66'),'phone')[_0x9964('0x67')](_0x9964('0x68'),_0x9964('0x5f'))[_0x9964('0x67')]('ANY_VALUE(ContactId)',_0x9964('0x60'))[_0x9964('0x67')](_0x9964('0x69'),_0x9964('0x61'))[_0x9964('0x67')](_0x9964('0x6a'),_0x9964('0x62'))[_0x9964('0x67')](_0x9964('0x68'),_0x9964('0x63'))['field'](_0x9964('0x68'),_0x9964('0x64'))[_0x9964('0x6b')](_0x9964('0x6c'))[_0x9964('0x39')](_0x9964('0x6d'),_0x19c6f2['params']['id'][_0x9964('0x6e')]())[_0x9964('0x39')](_0x9964('0x6f'),_0x19c6f2[_0x9964('0x45')]['state']['toString']())['where'](_0x9964('0x70'))[_0x9964('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9964('0x65')]()[_0x9964('0x67')](_0x9964('0x5e'))['from'](_0x9964('0x5c'))[_0x9964('0x39')]('VoiceQueueId\x20=\x20?',_0x19c6f2[_0x9964('0x48')]['id'][_0x9964('0x6e')]()))['where'](_0x9964('0x71'),squel[_0x9964('0x65')]()[_0x9964('0x67')](_0x9964('0x72'))[_0x9964('0x6b')]('cm_hopper_final')[_0x9964('0x39')]('VoiceQueueId\x20=\x20?',_0x19c6f2[_0x9964('0x48')]['id'][_0x9964('0x6e')]())['where'](_0x9964('0x73')))[_0x9964('0x74')](_0x9964('0x60')))[_0x9964('0x6e')]();return db['sequelize'][_0x9964('0x30')](_0xa59931);}return[];})[_0x9964('0x23')](respondWithResult(_0xe4a9a8,null))[_0x9964('0x41')](handleError(_0xe4a9a8,null));};exports[_0x9964('0x75')]=function(_0x364b64,_0x265d7e,_0x128882){return db[_0x9964('0x76')][_0x9964('0x47')]({'where':{'id':_0x364b64[_0x9964('0x48')]['id']}})[_0x9964('0x23')](handleEntityNotFound(_0x265d7e,null))[_0x9964('0x23')](function(_0x4d6ac6){var _0x424e6e;if(_0x4d6ac6){_0x424e6e=squel['insert']()[_0x9964('0x5b')](_0x9964('0x5c'))['fromQuery']([_0x9964('0x5e'),_0x9964('0x5f'),_0x9964('0x60'),_0x9964('0x61'),_0x9964('0x77'),_0x9964('0x63'),_0x9964('0x64')],squel[_0x9964('0x65')]()['field'](_0x9964('0x66'),_0x9964('0x5e'))[_0x9964('0x67')]('NOW()',_0x9964('0x5f'))[_0x9964('0x67')](_0x9964('0x78'),'ContactId')[_0x9964('0x67')](_0x9964('0x69'),_0x9964('0x61'))[_0x9964('0x67')](_0x9964('0x79'),_0x9964('0x77'))[_0x9964('0x67')](_0x9964('0x68'),_0x9964('0x63'))['field'](_0x9964('0x68'),_0x9964('0x64'))[_0x9964('0x6b')]('cm_hopper_final')[_0x9964('0x39')]('CampaignId\x20=\x20?',_0x364b64[_0x9964('0x48')]['id'][_0x9964('0x6e')]())[_0x9964('0x39')]('state\x20=\x20?',_0x364b64[_0x9964('0x45')][_0x9964('0x7a')][_0x9964('0x6e')]())['where'](_0x9964('0x70'))[_0x9964('0x39')](_0x9964('0x71'),squel['select']()[_0x9964('0x67')](_0x9964('0x5e'))[_0x9964('0x6b')]('cm_hopper')[_0x9964('0x39')](_0x9964('0x7b'),_0x364b64[_0x9964('0x48')]['id']['toString']()))[_0x9964('0x39')](_0x9964('0x71'),squel[_0x9964('0x65')]()[_0x9964('0x67')](_0x9964('0x72'))[_0x9964('0x6b')]('cm_hopper_final')[_0x9964('0x39')](_0x9964('0x7b'),_0x364b64[_0x9964('0x48')]['id'][_0x9964('0x6e')]())[_0x9964('0x39')](_0x9964('0x73')))[_0x9964('0x74')]('ContactId'))[_0x9964('0x6e')]();return db[_0x9964('0x49')][_0x9964('0x30')](_0x424e6e);}return[];})[_0x9964('0x23')](respondWithResult(_0x265d7e,null))[_0x9964('0x41')](handleError(_0x265d7e,null));};exports[_0x9964('0x7c')]=function(_0xf24f8a,_0x3b03af,_0x2a9a53){return db[_0x9964('0x7d')]['findOne']({'where':{'VoiceQueueId':_0xf24f8a['body']['VoiceQueueId'],'CampaignId':_0xf24f8a['body'][_0x9964('0x77')],'ContactId':_0xf24f8a[_0x9964('0x45')][_0x9964('0x60')]}})[_0x9964('0x23')](handleEntityNotFound(_0x3b03af,null))[_0x9964('0x23')](function(_0xf61611){if(_0xf61611){return _0xf61611;}return null;})[_0x9964('0x23')](respondWithResult(_0x3b03af,null))['catch'](handleError(_0x3b03af,null));}; \ No newline at end of file +var _0xa37e=['ANY_VALUE(VoiceQueueId)','VoiceQueueId','createdAt','from','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','calleridnum','cm_hopper_final','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','CampaignId\x20=\x20?','state\x20=\x20?','state','group','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','set','apply','reject','save','then','destroy','error','stack','name','send','map','CmHopperFinal','fieldName','type','key','keys','model','query','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','rawAttributes','includeAll','find','describe','update','uniqueid','body','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`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','answeringMachine','countContactsIvrCampaignHopperFinal','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','updatedAt','select','field','NOW()','ANY_VALUE(ListId)','ListId'];(function(_0x209bbf,_0x2e2375){var _0x592d4b=function(_0x419947){while(--_0x419947){_0x209bbf['push'](_0x209bbf['shift']());}};_0x592d4b(++_0x2e2375);}(_0xa37e,0x97));var _0xea37=function(_0x41e06f,_0x5d741a){_0x41e06f=_0x41e06f-0x0;var _0x5ea6a0=_0xa37e[_0x41e06f];return _0x5ea6a0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xea37('0x0'));var zipdir=require(_0xea37('0x1'));var jsonpatch=require(_0xea37('0x2'));var rp=require(_0xea37('0x3'));var moment=require('moment');var BPromise=require(_0xea37('0x4'));var Mustache=require('mustache');var util=require(_0xea37('0x5'));var path=require(_0xea37('0x6'));var sox=require(_0xea37('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xea37('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xea37('0x9'));var deskjs=require(_0xea37('0xa'));var toCsv=require(_0xea37('0xb'));var querystring=require(_0xea37('0xc'));var Papa=require('papaparse');var Redis=require(_0xea37('0xd'));var authService=require(_0xea37('0xe'));var qs=require(_0xea37('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xea37('0x10'))(_0xea37('0x11'));var utils=require(_0xea37('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xea37('0x13'));var db=require(_0xea37('0x14'))['db'];function respondWithStatusCode(_0x2a2bcd,_0x589a61){_0x589a61=_0x589a61||0xcc;return function(_0x3aef9e){if(_0x3aef9e){return _0x2a2bcd[_0xea37('0x15')](_0x589a61);}return _0x2a2bcd['status'](_0x589a61)[_0xea37('0x16')]();};}function respondWithResult(_0x556a64,_0xd7d4e7){_0xd7d4e7=_0xd7d4e7||0xc8;return function(_0x4dd6d0){if(_0x4dd6d0){return _0x556a64[_0xea37('0x17')](_0xd7d4e7)[_0xea37('0x18')](_0x4dd6d0);}};}function respondWithFilteredResult(_0x168e80,_0x46aaf0){return function(_0x5b38aa){if(_0x5b38aa){var _0x18e4b8=_0x5b38aa['count'],_0x58f979=_0x46aaf0[_0xea37('0x19')],_0x49604a=_0x46aaf0[_0xea37('0x19')]+_0x46aaf0['limit'],_0x3ae3cc;if(_0x49604a>=_0x18e4b8){_0x49604a=_0x18e4b8;_0x3ae3cc=0xc8;}else{_0x3ae3cc=0xce;}_0x168e80[_0xea37('0x17')](_0x3ae3cc);return _0x168e80[_0xea37('0x1a')]('Content-Range',_0x58f979+'-'+_0x49604a+'/'+_0x18e4b8)[_0xea37('0x18')](_0x5b38aa);}return null;};}function patchUpdates(_0x3f5ebc){return function(_0x3ee6bb){try{jsonpatch[_0xea37('0x1b')](_0x3ee6bb,_0x3f5ebc,!![]);}catch(_0xac3650){return BPromise[_0xea37('0x1c')](_0xac3650);}return _0x3ee6bb[_0xea37('0x1d')]();};}function saveUpdates(_0x238567,_0x28ed44){return function(_0x3e00cb){if(_0x3e00cb){return _0x3e00cb['update'](_0x238567)[_0xea37('0x1e')](function(_0x2a81f5){return _0x2a81f5;});}return null;};}function removeEntity(_0x356f04,_0x536eff){return function(_0x4aa2ae){if(_0x4aa2ae){return _0x4aa2ae[_0xea37('0x1f')]()[_0xea37('0x1e')](function(){_0x356f04[_0xea37('0x17')](0xcc)[_0xea37('0x16')]();});}};}function handleEntityNotFound(_0x4996e9,_0x25042e){return function(_0x5a85b7){if(!_0x5a85b7){_0x4996e9['sendStatus'](0x194);}return _0x5a85b7;};}function handleError(_0x5503f1,_0x32c116){_0x32c116=_0x32c116||0x1f4;return function(_0x4ff973){logger[_0xea37('0x20')](_0x4ff973[_0xea37('0x21')]);if(_0x4ff973[_0xea37('0x22')]){delete _0x4ff973[_0xea37('0x22')];}_0x5503f1[_0xea37('0x17')](_0x32c116)[_0xea37('0x23')](_0x4ff973);};}exports['index']=function(_0x57a7cc,_0x55880c){var _0x477e25={},_0x3e272e={},_0x4ffcf1={'count':0x0,'rows':[]};var _0x1ff12d=_[_0xea37('0x24')](db[_0xea37('0x25')]['rawAttributes'],function(_0xe5b07a){return{'name':_0xe5b07a[_0xea37('0x26')],'type':_0xe5b07a[_0xea37('0x27')][_0xea37('0x28')]};});_0x3e272e['model']=_[_0xea37('0x24')](_0x1ff12d,'name');_0x3e272e['query']=_[_0xea37('0x29')](_0x57a7cc['query']);_0x3e272e['filters']=_['intersection'](_0x3e272e[_0xea37('0x2a')],_0x3e272e[_0xea37('0x2b')]);_0x477e25[_0xea37('0x2c')]=_[_0xea37('0x2d')](_0x3e272e[_0xea37('0x2a')],qs[_0xea37('0x2e')](_0x57a7cc['query'][_0xea37('0x2e')]));_0x477e25[_0xea37('0x2c')]=_0x477e25[_0xea37('0x2c')][_0xea37('0x2f')]?_0x477e25[_0xea37('0x2c')]:_0x3e272e[_0xea37('0x2a')];if(!_0x57a7cc['query'][_0xea37('0x30')]('nolimit')){_0x477e25[_0xea37('0x31')]=qs[_0xea37('0x31')](_0x57a7cc[_0xea37('0x2b')][_0xea37('0x31')]);_0x477e25[_0xea37('0x19')]=qs[_0xea37('0x19')](_0x57a7cc[_0xea37('0x2b')][_0xea37('0x19')]);}_0x477e25['order']=qs[_0xea37('0x32')](_0x57a7cc[_0xea37('0x2b')][_0xea37('0x32')]);_0x477e25[_0xea37('0x33')]=qs[_0xea37('0x34')](_[_0xea37('0x35')](_0x57a7cc['query'],_0x3e272e['filters']),_0x1ff12d);if(_0x57a7cc['query'][_0xea37('0x36')]){_0x477e25['where']=_[_0xea37('0x37')](_0x477e25['where'],{'$or':_['map'](_0x1ff12d,function(_0x5652a4){if(_0x5652a4['type']!==_0xea37('0x38')){var _0x46787b={};_0x46787b[_0x5652a4[_0xea37('0x22')]]={'$like':'%'+_0x57a7cc[_0xea37('0x2b')][_0xea37('0x36')]+'%'};return _0x46787b;}})});}_0x477e25=_[_0xea37('0x37')]({},_0x477e25,_0x57a7cc[_0xea37('0x39')]);var _0x1f446a={'where':_0x477e25[_0xea37('0x33')]};return db['CmHopperFinal'][_0xea37('0x3a')](_0x1f446a)['then'](function(_0x278c9e){_0x4ffcf1[_0xea37('0x3a')]=_0x278c9e;if(_0x57a7cc[_0xea37('0x2b')]['includeAll']){_0x477e25[_0xea37('0x3b')]=[{'all':!![]}];}return db[_0xea37('0x25')][_0xea37('0x3c')](_0x477e25);})[_0xea37('0x1e')](function(_0x517a44){_0x4ffcf1[_0xea37('0x3d')]=_0x517a44;return _0x4ffcf1;})['then'](respondWithFilteredResult(_0x55880c,_0x477e25))[_0xea37('0x3e')](handleError(_0x55880c,null));};exports[_0xea37('0x3f')]=function(_0x30c247,_0x847051){var _0x3c1b8a={'raw':!![],'where':{'id':_0x30c247['params']['id']}},_0x435300={};_0x435300[_0xea37('0x2a')]=_[_0xea37('0x29')](db['CmHopperFinal'][_0xea37('0x40')]);_0x435300[_0xea37('0x2b')]=_[_0xea37('0x29')](_0x30c247[_0xea37('0x2b')]);_0x435300[_0xea37('0x34')]=_[_0xea37('0x2d')](_0x435300[_0xea37('0x2a')],_0x435300[_0xea37('0x2b')]);_0x3c1b8a[_0xea37('0x2c')]=_[_0xea37('0x2d')](_0x435300[_0xea37('0x2a')],qs[_0xea37('0x2e')](_0x30c247[_0xea37('0x2b')][_0xea37('0x2e')]));_0x3c1b8a[_0xea37('0x2c')]=_0x3c1b8a[_0xea37('0x2c')][_0xea37('0x2f')]?_0x3c1b8a['attributes']:_0x435300[_0xea37('0x2a')];if(_0x30c247[_0xea37('0x2b')][_0xea37('0x41')]){_0x3c1b8a[_0xea37('0x3b')]=[{'all':!![]}];}_0x3c1b8a=_[_0xea37('0x37')]({},_0x3c1b8a,_0x30c247['options']);return db[_0xea37('0x25')][_0xea37('0x42')](_0x3c1b8a)[_0xea37('0x1e')](handleEntityNotFound(_0x847051,null))[_0xea37('0x1e')](respondWithResult(_0x847051,null))[_0xea37('0x3e')](handleError(_0x847051,null));};exports[_0xea37('0x43')]=function(_0x4f3222,_0x422d24){return db[_0xea37('0x25')][_0xea37('0x43')]()[_0xea37('0x1e')](respondWithResult(_0x422d24,null))[_0xea37('0x3e')](handleError(_0x422d24,null));};exports[_0xea37('0x44')]=function(_0x2cd612,_0x3dd82b){if(_0x2cd612['body'][_0xea37('0x45')]){delete _0x2cd612[_0xea37('0x46')]['uniqueid'];}return db[_0xea37('0x25')][_0xea37('0x42')]({'where':{'uniqueid':_0x2cd612[_0xea37('0x47')]['id']}})[_0xea37('0x1e')](handleEntityNotFound(_0x3dd82b,null))[_0xea37('0x1e')](saveUpdates(_0x2cd612[_0xea37('0x46')],null))[_0xea37('0x1e')](respondWithResult(_0x3dd82b,null))[_0xea37('0x3e')](handleError(_0x3dd82b,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x46d6e3,_0x4e4980,_0x3b451a){return db['CmHopperFinal'][_0xea37('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x46d6e3[_0xea37('0x47')]['id']},'attributes':[[db[_0xea37('0x48')]['fn'](_0xea37('0x49'),db[_0xea37('0x48')]['fn']('IF',db[_0xea37('0x48')][_0xea37('0x4a')](_0xea37('0x4b')))),'noSuchContacts'],[db['sequelize']['fn'](_0xea37('0x49'),db[_0xea37('0x48')]['fn']('IF',db[_0xea37('0x48')]['literal'](_0xea37('0x4c')))),_0xea37('0x4d')],[db['sequelize']['fn'](_0xea37('0x49'),db[_0xea37('0x48')]['fn']('IF',db[_0xea37('0x48')][_0xea37('0x4a')](_0xea37('0x4e')))),_0xea37('0x4f')],[db[_0xea37('0x48')]['fn'](_0xea37('0x49'),db[_0xea37('0x48')]['fn']('IF',db[_0xea37('0x48')][_0xea37('0x4a')](_0xea37('0x50')))),_0xea37('0x51')],[db[_0xea37('0x48')]['fn'](_0xea37('0x49'),db['sequelize']['fn']('IF',db[_0xea37('0x48')][_0xea37('0x4a')](_0xea37('0x52')))),_0xea37('0x53')],[db[_0xea37('0x48')]['fn'](_0xea37('0x49'),db['sequelize']['fn']('IF',db[_0xea37('0x48')][_0xea37('0x4a')](_0xea37('0x54')))),_0xea37('0x55')],[db[_0xea37('0x48')]['fn']('COUNT',db[_0xea37('0x48')]['fn']('IF',db[_0xea37('0x48')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0xea37('0x48')]['fn'](_0xea37('0x49'),db[_0xea37('0x48')]['fn']('IF',db[_0xea37('0x48')][_0xea37('0x4a')]('`state`\x20=\x2019,\x201,\x20null'))),_0xea37('0x56')]]})[_0xea37('0x1e')](handleEntityNotFound(_0x4e4980,null))[_0xea37('0x1e')](respondWithResult(_0x4e4980,null))[_0xea37('0x3e')](handleError(_0x4e4980,null));};exports[_0xea37('0x57')]=function(_0x3b4cb1,_0x36930d,_0x440267){return db[_0xea37('0x25')][_0xea37('0x3c')]({'raw':![],'where':{'CampaignId':_0x3b4cb1[_0xea37('0x47')]['id']},'attributes':[[db[_0xea37('0x48')]['fn'](_0xea37('0x49'),db[_0xea37('0x48')]['fn']('IF',db[_0xea37('0x48')][_0xea37('0x4a')](_0xea37('0x4b')))),'noSuchContacts'],[db[_0xea37('0x48')]['fn']('COUNT',db[_0xea37('0x48')]['fn']('IF',db[_0xea37('0x48')][_0xea37('0x4a')](_0xea37('0x4c')))),_0xea37('0x4d')],[db[_0xea37('0x48')]['fn'](_0xea37('0x49'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xea37('0x4e')))),'busyContacts'],[db['sequelize']['fn'](_0xea37('0x49'),db[_0xea37('0x48')]['fn']('IF',db[_0xea37('0x48')]['literal'](_0xea37('0x50')))),_0xea37('0x51')],[db[_0xea37('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xea37('0x48')][_0xea37('0x4a')](_0xea37('0x52')))),'dropContacts'],[db[_0xea37('0x48')]['fn'](_0xea37('0x49'),db[_0xea37('0x48')]['fn']('IF',db[_0xea37('0x48')][_0xea37('0x4a')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xea37('0x55')],[db[_0xea37('0x48')]['fn'](_0xea37('0x49'),db[_0xea37('0x48')]['fn']('IF',db['sequelize'][_0xea37('0x4a')]('`state`\x20=\x2022,\x201,\x20null'))),_0xea37('0x58')],[db[_0xea37('0x48')]['fn'](_0xea37('0x49'),db[_0xea37('0x48')]['fn']('IF',db['sequelize'][_0xea37('0x4a')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xea37('0x1e')](handleEntityNotFound(_0x36930d,null))[_0xea37('0x1e')](respondWithResult(_0x36930d,null))[_0xea37('0x3e')](handleError(_0x36930d,null));};exports[_0xea37('0x59')]=function(_0x54f013,_0x4fcc40,_0x4f585f){return db[_0xea37('0x5a')][_0xea37('0x42')]({'where':{'id':_0x54f013['params']['id']}})[_0xea37('0x1e')](handleEntityNotFound(_0x4fcc40,null))[_0xea37('0x1e')](function(_0x447972){var _0x463c9a;if(_0x447972){_0x463c9a=squel[_0xea37('0x5b')]()[_0xea37('0x5c')](_0xea37('0x5d'))['fromQuery']([_0xea37('0x5e'),_0xea37('0x5f'),_0xea37('0x60'),'ListId','VoiceQueueId','createdAt',_0xea37('0x61')],squel[_0xea37('0x62')]()['field']('ANY_VALUE(calleridnum)','phone')[_0xea37('0x63')](_0xea37('0x64'),_0xea37('0x5f'))[_0xea37('0x63')]('ANY_VALUE(ContactId)','ContactId')[_0xea37('0x63')](_0xea37('0x65'),_0xea37('0x66'))[_0xea37('0x63')](_0xea37('0x67'),_0xea37('0x68'))[_0xea37('0x63')](_0xea37('0x64'),_0xea37('0x69'))[_0xea37('0x63')]('NOW()',_0xea37('0x61'))[_0xea37('0x6a')]('cm_hopper_final')[_0xea37('0x33')]('VoiceQueueId\x20=\x20?',_0x54f013['params']['id'][_0xea37('0x6b')]())['where']('state\x20=\x20?',_0x54f013[_0xea37('0x46')]['state'][_0xea37('0x6b')]())[_0xea37('0x33')](_0xea37('0x6c'))[_0xea37('0x33')](_0xea37('0x6d'),squel['select']()['field'](_0xea37('0x5e'))[_0xea37('0x6a')](_0xea37('0x5d'))['where'](_0xea37('0x6e'),_0x54f013[_0xea37('0x47')]['id'][_0xea37('0x6b')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xea37('0x63')](_0xea37('0x6f'))[_0xea37('0x6a')](_0xea37('0x70'))[_0xea37('0x33')](_0xea37('0x6e'),_0x54f013[_0xea37('0x47')]['id'][_0xea37('0x6b')]())[_0xea37('0x33')](_0xea37('0x71')))['group'](_0xea37('0x60')))[_0xea37('0x6b')]();return db[_0xea37('0x48')][_0xea37('0x2b')](_0x463c9a);}return[];})['then'](respondWithResult(_0x4fcc40,null))[_0xea37('0x3e')](handleError(_0x4fcc40,null));};exports[_0xea37('0x72')]=function(_0x41d951,_0xa7b74f,_0x2dfd40){return db[_0xea37('0x73')][_0xea37('0x42')]({'where':{'id':_0x41d951[_0xea37('0x47')]['id']}})[_0xea37('0x1e')](handleEntityNotFound(_0xa7b74f,null))['then'](function(_0x5639ec){var _0x227cb6;if(_0x5639ec){_0x227cb6=squel['insert']()[_0xea37('0x5c')]('cm_hopper')[_0xea37('0x74')]([_0xea37('0x5e'),_0xea37('0x5f'),_0xea37('0x60'),'ListId',_0xea37('0x75'),_0xea37('0x69'),_0xea37('0x61')],squel[_0xea37('0x62')]()[_0xea37('0x63')](_0xea37('0x76'),_0xea37('0x5e'))[_0xea37('0x63')](_0xea37('0x64'),_0xea37('0x5f'))['field'](_0xea37('0x77'),_0xea37('0x60'))[_0xea37('0x63')](_0xea37('0x65'),'ListId')[_0xea37('0x63')]('ANY_VALUE(CampaignId)',_0xea37('0x75'))[_0xea37('0x63')](_0xea37('0x64'),_0xea37('0x69'))[_0xea37('0x63')]('NOW()',_0xea37('0x61'))[_0xea37('0x6a')](_0xea37('0x70'))['where'](_0xea37('0x78'),_0x41d951['params']['id'][_0xea37('0x6b')]())[_0xea37('0x33')](_0xea37('0x79'),_0x41d951[_0xea37('0x46')][_0xea37('0x7a')][_0xea37('0x6b')]())[_0xea37('0x33')](_0xea37('0x6c'))[_0xea37('0x33')](_0xea37('0x6d'),squel[_0xea37('0x62')]()[_0xea37('0x63')](_0xea37('0x5e'))[_0xea37('0x6a')](_0xea37('0x5d'))[_0xea37('0x33')](_0xea37('0x78'),_0x41d951['params']['id'][_0xea37('0x6b')]()))[_0xea37('0x33')](_0xea37('0x6d'),squel[_0xea37('0x62')]()[_0xea37('0x63')](_0xea37('0x6f'))[_0xea37('0x6a')](_0xea37('0x70'))[_0xea37('0x33')](_0xea37('0x78'),_0x41d951[_0xea37('0x47')]['id'][_0xea37('0x6b')]())[_0xea37('0x33')]('state\x20=\x204'))[_0xea37('0x7b')](_0xea37('0x60')))[_0xea37('0x6b')]();return db[_0xea37('0x48')][_0xea37('0x2b')](_0x227cb6);}return[];})[_0xea37('0x1e')](respondWithResult(_0xa7b74f,null))[_0xea37('0x3e')](handleError(_0xa7b74f,null));};exports[_0xea37('0x7c')]=function(_0x176bbe,_0x364c6a,_0x3f0ef6){return db[_0xea37('0x7d')][_0xea37('0x7e')]({'where':{'VoiceQueueId':_0x176bbe['body'][_0xea37('0x68')],'CampaignId':_0x176bbe[_0xea37('0x46')][_0xea37('0x75')],'ContactId':_0x176bbe[_0xea37('0x46')][_0xea37('0x60')]}})[_0xea37('0x1e')](handleEntityNotFound(_0x364c6a,null))['then'](function(_0x5c8d28){if(_0x5c8d28){return _0x5c8d28;}return null;})[_0xea37('0x1e')](respondWithResult(_0x364c6a,null))[_0xea37('0x3e')](handleError(_0x364c6a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d0ee823..ea012bd 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 _0xca25=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define'];(function(_0x369829,_0x5149ad){var _0xb9c603=function(_0x2fc8c9){while(--_0x2fc8c9){_0x369829['push'](_0x369829['shift']());}};_0xb9c603(++_0x5149ad);}(_0xca25,0xa0));var _0x5ca2=function(_0x149f32,_0x4273f7){_0x149f32=_0x149f32-0x0;var _0x11f475=_0xca25[_0x149f32];return _0x11f475;};'use strict';var _=require(_0x5ca2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5ca2('0x1'));var moment=require(_0x5ca2('0x2'));var BPromise=require('bluebird');var rp=require(_0x5ca2('0x3'));var fs=require('fs');var path=require(_0x5ca2('0x4'));var rimraf=require(_0x5ca2('0x5'));var config=require(_0x5ca2('0x6'));var attributes=require(_0x5ca2('0x7'));module['exports']=function(_0x4bd7ef,_0x7217b1){return _0x4bd7ef[_0x5ca2('0x8')](_0x5ca2('0x9'),attributes,{'tableName':_0x5ca2('0xa'),'paranoid':![],'indexes':[{'name':_0x5ca2('0xb'),'fields':['calleridnum']},{'name':_0x5ca2('0xc'),'fields':[_0x5ca2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f3f=['lodash','util','../../config/logger','api','request-promise','path','rimraf','define','CmHopperFinal','cm_hopper_final','uniqueid'];(function(_0x3cc7b9,_0x5d893f){var _0x1c4496=function(_0x1f8cb6){while(--_0x1f8cb6){_0x3cc7b9['push'](_0x3cc7b9['shift']());}};_0x1c4496(++_0x5d893f);}(_0x4f3f,0x1ef));var _0xf4f3=function(_0x214c18,_0x4a7b79){_0x214c18=_0x214c18-0x0;var _0x1db402=_0x4f3f[_0x214c18];return _0x1db402;};'use strict';var _=require(_0xf4f3('0x0'));var util=require(_0xf4f3('0x1'));var logger=require(_0xf4f3('0x2'))(_0xf4f3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf4f3('0x4'));var fs=require('fs');var path=require(_0xf4f3('0x5'));var rimraf=require(_0xf4f3('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x46aeff,_0x49721c){return _0x46aeff[_0xf4f3('0x7')](_0xf4f3('0x8'),attributes,{'tableName':_0xf4f3('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0xf4f3('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index ef0abd4..ebe2975 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 _0x7985=['client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','options','raw','lodash','util','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x451762,_0x5069dd){var _0x5726fa=function(_0x39958a){while(--_0x39958a){_0x451762['push'](_0x451762['shift']());}};_0x5726fa(++_0x5069dd);}(_0x7985,0x119));var _0x5798=function(_0x5ba353,_0x11fd8b){_0x5ba353=_0x5ba353-0x0;var _0x149f6b=_0x7985[_0x5ba353];return _0x149f6b;};'use strict';var _=require(_0x5798('0x0'));var util=require(_0x5798('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5798('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5798('0x3'));var logger=require('../../config/logger')(_0x5798('0x4'));var config=require(_0x5798('0x5'));var jayson=require(_0x5798('0x6'));var client=jayson[_0x5798('0x7')][_0x5798('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x433085,_0xf99a47,_0x520900){return new BPromise(function(_0x21705e,_0x7a3952){return client[_0x5798('0x9')](_0x433085,_0x520900)[_0x5798('0xa')](function(_0x1c5bff){logger[_0x5798('0xb')](_0x5798('0xc'),_0xf99a47,'request\x20sent');logger[_0x5798('0xd')](_0x5798('0xe'),_0xf99a47,_0x5798('0xf'),JSON[_0x5798('0x10')](_0x1c5bff));if(_0x1c5bff[_0x5798('0x11')]){if(_0x1c5bff[_0x5798('0x11')]['code']===0x1f4){logger['error'](_0x5798('0xc'),_0xf99a47,_0x1c5bff[_0x5798('0x11')][_0x5798('0x12')]);return _0x7a3952(_0x1c5bff[_0x5798('0x11')][_0x5798('0x12')]);}logger[_0x5798('0x11')](_0x5798('0xc'),_0xf99a47,_0x1c5bff[_0x5798('0x11')]['message']);return _0x21705e(_0x1c5bff[_0x5798('0x11')][_0x5798('0x12')]);}else{logger[_0x5798('0xb')](_0x5798('0xc'),_0xf99a47,_0x5798('0xf'));_0x21705e(_0x1c5bff[_0x5798('0x13')]['message']);}})['catch'](function(_0x1527cb){logger[_0x5798('0x11')](_0x5798('0xc'),_0xf99a47,_0x1527cb);_0x7a3952(_0x1527cb);});});}exports[_0x5798('0x14')]=function(_0x50a693){var _0x40b22c=this;return new Promise(function(_0x41945e,_0x3ae4ab){return db[_0x5798('0x15')]['create'](_0x50a693['body'],{'raw':_0x50a693[_0x5798('0x16')]?_0x50a693[_0x5798('0x16')][_0x5798('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x2664d7){logger['info']('CreateCmHopperFinal',_0x50a693);logger[_0x5798('0xd')](_0x5798('0x14'),_0x50a693,JSON['stringify'](_0x2664d7));_0x41945e(_0x2664d7);})['catch'](function(_0x53a46a){logger[_0x5798('0x11')]('CreateCmHopperFinal',_0x53a46a['message'],_0x50a693);_0x3ae4ab(_0x40b22c[_0x5798('0x11')](0x1f4,_0x53a46a[_0x5798('0x12')]));});});}; \ No newline at end of file +var _0x359d=['../../mysqldb','../../config/logger','jayson/promise','client','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperFinal','create','body','options','raw','lodash','moment','ioredis'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0x359d,0x105));var _0xd359=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0x359d[_0x37756b];return _0x46efec;};'use strict';var _=require(_0xd359('0x0'));var util=require('util');var moment=require(_0xd359('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd359('0x2'));var db=require(_0xd359('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd359('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd359('0x5'));var client=jayson[_0xd359('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38e6cc,_0x3b2a47,_0x54bafb){return new BPromise(function(_0x41b959,_0x4f58c5){return client['request'](_0x38e6cc,_0x54bafb)[_0xd359('0x7')](function(_0x37f6a6){logger[_0xd359('0x8')](_0xd359('0x9'),_0x3b2a47,_0xd359('0xa'));logger[_0xd359('0xb')](_0xd359('0xc'),_0x3b2a47,_0xd359('0xa'),JSON[_0xd359('0xd')](_0x37f6a6));if(_0x37f6a6[_0xd359('0xe')]){if(_0x37f6a6[_0xd359('0xe')][_0xd359('0xf')]===0x1f4){logger[_0xd359('0xe')](_0xd359('0x9'),_0x3b2a47,_0x37f6a6[_0xd359('0xe')][_0xd359('0x10')]);return _0x4f58c5(_0x37f6a6[_0xd359('0xe')][_0xd359('0x10')]);}logger[_0xd359('0xe')](_0xd359('0x9'),_0x3b2a47,_0x37f6a6[_0xd359('0xe')]['message']);return _0x41b959(_0x37f6a6[_0xd359('0xe')][_0xd359('0x10')]);}else{logger['info'](_0xd359('0x9'),_0x3b2a47,_0xd359('0xa'));_0x41b959(_0x37f6a6[_0xd359('0x11')][_0xd359('0x10')]);}})[_0xd359('0x12')](function(_0x4c48d2){logger[_0xd359('0xe')](_0xd359('0x9'),_0x3b2a47,_0x4c48d2);_0x4f58c5(_0x4c48d2);});});}exports[_0xd359('0x13')]=function(_0x3c8ee9){var _0x5b1ece=this;return new Promise(function(_0x55e77f,_0x5c80b0){return db['CmHopperFinal'][_0xd359('0x14')](_0x3c8ee9[_0xd359('0x15')],{'raw':_0x3c8ee9[_0xd359('0x16')]?_0x3c8ee9['options'][_0xd359('0x17')]===undefined?!![]:![]:!![]})[_0xd359('0x7')](function(_0x5e12df){logger[_0xd359('0x8')]('CreateCmHopperFinal',_0x3c8ee9);logger['debug'](_0xd359('0x13'),_0x3c8ee9,JSON[_0xd359('0xd')](_0x5e12df));_0x55e77f(_0x5e12df);})['catch'](function(_0x2068ac){logger[_0xd359('0xe')](_0xd359('0x13'),_0x2068ac[_0xd359('0x10')],_0x3c8ee9);_0x5c80b0(_0x5b1ece['error'](0x1f4,_0x2068ac[_0xd359('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 431c177..2c00074 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 _0xea9d=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x276015,_0x57eb3d){var _0x385345=function(_0x3c5bb4){while(--_0x3c5bb4){_0x276015['push'](_0x276015['shift']());}};_0x385345(++_0x57eb3d);}(_0xea9d,0x1a3));var _0xdea9=function(_0x22811e,_0x873f03){_0x22811e=_0x22811e-0x0;var _0x217145=_0xea9d[_0x22811e];return _0x217145;};'use strict';var multer=require(_0xdea9('0x0'));var util=require(_0xdea9('0x1'));var path=require(_0xdea9('0x2'));var timeout=require('connect-timeout');var express=require(_0xdea9('0x3'));var router=express[_0xdea9('0x4')]();var auth=require(_0xdea9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdea9('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xdea9('0x7')]('/',auth[_0xdea9('0x8')](),controller[_0xdea9('0x9')]);router[_0xdea9('0x7')](_0xdea9('0xa'),auth[_0xdea9('0x8')](),controller[_0xdea9('0xb')]);router[_0xdea9('0x7')](_0xdea9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xdea9('0x7')]('/voice/queue/countAttributes/:id',auth[_0xdea9('0x8')](),controller[_0xdea9('0xd')]);router['get'](_0xdea9('0xe'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0xdea9('0xf')](_0xdea9('0x10'),auth[_0xdea9('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xdea9('0xf')](_0xdea9('0x11'),auth[_0xdea9('0x8')](),controller[_0xdea9('0x12')]);router[_0xdea9('0xf')](_0xdea9('0x13'),auth[_0xdea9('0x8')](),controller[_0xdea9('0x14')]);router[_0xdea9('0x15')](_0xdea9('0xc'),auth[_0xdea9('0x8')](),controller[_0xdea9('0x16')]);module[_0xdea9('0x17')]=router; \ No newline at end of file +var _0x1c28=['multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c28,0xa1));var _0x81c2=function(_0x5a9f24,_0x1378f3){_0x5a9f24=_0x5a9f24-0x0;var _0x396817=_0x1c28[_0x5a9f24];return _0x396817;};'use strict';var multer=require(_0x81c2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x81c2('0x1'));var express=require(_0x81c2('0x2'));var router=express['Router']();var auth=require(_0x81c2('0x3'));var interaction=require(_0x81c2('0x4'));var config=require(_0x81c2('0x5'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x81c2('0x6')](),controller[_0x81c2('0x7')]);router[_0x81c2('0x8')](_0x81c2('0x9'),auth[_0x81c2('0x6')](),controller[_0x81c2('0xa')]);router['get'](_0x81c2('0xb'),auth[_0x81c2('0x6')](),controller[_0x81c2('0xc')]);router[_0x81c2('0x8')](_0x81c2('0xd'),auth['isAuthenticated'](),controller[_0x81c2('0xe')]);router['get']('/campaign/countAttributes/:id',auth[_0x81c2('0x6')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x81c2('0xf')](_0x81c2('0x10'),auth[_0x81c2('0x6')](),controller[_0x81c2('0x11')]);router[_0x81c2('0xf')](_0x81c2('0x12'),auth[_0x81c2('0x6')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x81c2('0xf')](_0x81c2('0x13'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x81c2('0x14')](_0x81c2('0xb'),auth['isAuthenticated'](),controller[_0x81c2('0x15')]);module[_0x81c2('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 6907078..e4f7006 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 _0xf9ab=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x269afe,_0x107775){var _0x17d6ba=function(_0x4b6735){while(--_0x4b6735){_0x269afe['push'](_0x269afe['shift']());}};_0x17d6ba(++_0x107775);}(_0xf9ab,0x155));var _0xbf9a=function(_0x13d617,_0x554d30){_0x13d617=_0x13d617-0x0;var _0x8bbfaa=_0xf9ab[_0x13d617];return _0x8bbfaa;};'use strict';var Sequelize=require(_0xbf9a('0x0'));module[_0xbf9a('0x1')]={'state':{'type':Sequelize[_0xbf9a('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbf9a('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xbf9a('0x3')]},'calleridnum':{'type':Sequelize[_0xbf9a('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xbf9a('0x4')]},'responsetime':{'type':Sequelize[_0xbf9a('0x4')]},'answertime':{'type':Sequelize[_0xbf9a('0x4')]},'droptime':{'type':Sequelize[_0xbf9a('0x4')]},'endtime':{'type':Sequelize[_0xbf9a('0x4')]},'ringtime':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbf9a('0x3')]},'campaign':{'type':Sequelize[_0xbf9a('0x3')]},'campaigntype':{'type':Sequelize[_0xbf9a('0x3')]},'membername':{'type':Sequelize[_0xbf9a('0x3')]},'reason':{'type':Sequelize[_0xbf9a('0x3')]},'amd':{'type':Sequelize[_0xbf9a('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbf9a('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbf9a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbf9a('0x4')]},'recallme':{'type':Sequelize[_0xbf9a('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xbf9a('0x4')]},'edited':{'type':Sequelize[_0xbf9a('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfd20=['sequelize','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x3527be,_0x113fdb){var _0x5c61b8=function(_0xc4357f){while(--_0xc4357f){_0x3527be['push'](_0x3527be['shift']());}};_0x5c61b8(++_0x113fdb);}(_0xfd20,0x127));var _0x0fd2=function(_0x2a153b,_0x2d5c66){_0x2a153b=_0x2a153b-0x0;var _0x37d930=_0xfd20[_0x2a153b];return _0x37d930;};'use strict';var Sequelize=require(_0x0fd2('0x0'));module['exports']={'state':{'type':Sequelize[_0x0fd2('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x0fd2('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0fd2('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0fd2('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0fd2('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x0fd2('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0fd2('0x2')]},'calleridnum':{'type':Sequelize[_0x0fd2('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0fd2('0x3')]},'answertime':{'type':Sequelize[_0x0fd2('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0fd2('0x3')]},'ringtime':{'type':Sequelize[_0x0fd2('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0fd2('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0fd2('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x0fd2('0x2')]},'campaigntype':{'type':Sequelize[_0x0fd2('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x0fd2('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0fd2('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0fd2('0x3')]},'recallme':{'type':Sequelize[_0x0fd2('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0fd2('0x3')]},'edited':{'type':Sequelize[_0x0fd2('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0fd2('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0fd2('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0fd2('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0fd2('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0fd2('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 2507ef8..c813769 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 _0x94ec=['include','findAll','rows','show','params','find','catch','create','body','describe','uniqueid','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll'];(function(_0x304fa5,_0x330004){var _0x59aec9=function(_0x262bb5){while(--_0x262bb5){_0x304fa5['push'](_0x304fa5['shift']());}};_0x59aec9(++_0x330004);}(_0x94ec,0x1df));var _0xc94e=function(_0x11ce5d,_0x53f225){_0x11ce5d=_0x11ce5d-0x0;var _0x49874e=_0x94ec[_0x11ce5d];return _0x49874e;};'use strict';var pdf=require(_0xc94e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc94e('0x1'));var zipdir=require(_0xc94e('0x2'));var jsonpatch=require(_0xc94e('0x3'));var rp=require(_0xc94e('0x4'));var moment=require(_0xc94e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc94e('0x6'));var csv=require('to-csv');var ejs=require(_0xc94e('0x7'));var fs=require('fs');var _=require(_0xc94e('0x8'));var squel=require(_0xc94e('0x9'));var crypto=require(_0xc94e('0xa'));var jsforce=require(_0xc94e('0xb'));var deskjs=require(_0xc94e('0xc'));var toCsv=require(_0xc94e('0xd'));var querystring=require(_0xc94e('0xe'));var Papa=require(_0xc94e('0xf'));var Redis=require(_0xc94e('0x10'));var authService=require(_0xc94e('0x11'));var qs=require(_0xc94e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc94e('0x13'));var logger=require(_0xc94e('0x14'))(_0xc94e('0x15'));var utils=require(_0xc94e('0x16'));var config=require(_0xc94e('0x17'));var licenseUtil=require(_0xc94e('0x18'));var db=require(_0xc94e('0x19'))['db'];function respondWithStatusCode(_0x36067e,_0x25d3da){_0x25d3da=_0x25d3da||0xcc;return function(_0x2d0f98){if(_0x2d0f98){return _0x36067e[_0xc94e('0x1a')](_0x25d3da);}return _0x36067e[_0xc94e('0x1b')](_0x25d3da)[_0xc94e('0x1c')]();};}function respondWithResult(_0xbc1f68,_0x195df7){_0x195df7=_0x195df7||0xc8;return function(_0x5de258){if(_0x5de258){return _0xbc1f68[_0xc94e('0x1b')](_0x195df7)[_0xc94e('0x1d')](_0x5de258);}};}function respondWithFilteredResult(_0x4434b8,_0x584546){return function(_0x109c82){if(_0x109c82){var _0x17b70b=_0x109c82[_0xc94e('0x1e')],_0x4fb6e3=_0x584546[_0xc94e('0x1f')],_0x4cbe27=_0x584546[_0xc94e('0x1f')]+_0x584546[_0xc94e('0x20')],_0x4af116;if(_0x4cbe27>=_0x17b70b){_0x4cbe27=_0x17b70b;_0x4af116=0xc8;}else{_0x4af116=0xce;}_0x4434b8['status'](_0x4af116);return _0x4434b8[_0xc94e('0x21')](_0xc94e('0x22'),_0x4fb6e3+'-'+_0x4cbe27+'/'+_0x17b70b)[_0xc94e('0x1d')](_0x109c82);}return null;};}function patchUpdates(_0x26b98b){return function(_0x57fe63){try{jsonpatch['apply'](_0x57fe63,_0x26b98b,!![]);}catch(_0xedaf02){return BPromise['reject'](_0xedaf02);}return _0x57fe63[_0xc94e('0x23')]();};}function saveUpdates(_0x4984f1,_0x94d18c){return function(_0x2aee5b){if(_0x2aee5b){return _0x2aee5b[_0xc94e('0x24')](_0x4984f1)[_0xc94e('0x25')](function(_0x1c4677){return _0x1c4677;});}return null;};}function removeEntity(_0x30956a,_0x546e64){return function(_0xaba54b){if(_0xaba54b){return _0xaba54b[_0xc94e('0x26')]()[_0xc94e('0x25')](function(){_0x30956a[_0xc94e('0x1b')](0xcc)[_0xc94e('0x1c')]();});}};}function handleEntityNotFound(_0xfc8012,_0x38323f){return function(_0x2279c4){if(!_0x2279c4){_0xfc8012['sendStatus'](0x194);}return _0x2279c4;};}function handleError(_0x4361fe,_0x1df663){_0x1df663=_0x1df663||0x1f4;return function(_0x206635){logger['error'](_0x206635[_0xc94e('0x27')]);if(_0x206635['name']){delete _0x206635[_0xc94e('0x28')];}_0x4361fe[_0xc94e('0x1b')](_0x1df663)['send'](_0x206635);};}exports[_0xc94e('0x29')]=function(_0x562305,_0x4365fc){var _0x2f8e5e={},_0x343542={},_0x344f1d={'count':0x0,'rows':[]};var _0x18a984=_[_0xc94e('0x2a')](db[_0xc94e('0x2b')][_0xc94e('0x2c')],function(_0x48c079){return{'name':_0x48c079[_0xc94e('0x2d')],'type':_0x48c079[_0xc94e('0x2e')][_0xc94e('0x2f')]};});_0x343542[_0xc94e('0x30')]=_[_0xc94e('0x2a')](_0x18a984,_0xc94e('0x28'));_0x343542[_0xc94e('0x31')]=_[_0xc94e('0x32')](_0x562305['query']);_0x343542[_0xc94e('0x33')]=_[_0xc94e('0x34')](_0x343542['model'],_0x343542[_0xc94e('0x31')]);_0x2f8e5e['attributes']=_[_0xc94e('0x34')](_0x343542[_0xc94e('0x30')],qs['fields'](_0x562305[_0xc94e('0x31')][_0xc94e('0x35')]));_0x2f8e5e[_0xc94e('0x36')]=_0x2f8e5e[_0xc94e('0x36')][_0xc94e('0x37')]?_0x2f8e5e[_0xc94e('0x36')]:_0x343542['model'];if(!_0x562305['query'][_0xc94e('0x38')](_0xc94e('0x39'))){_0x2f8e5e[_0xc94e('0x20')]=qs[_0xc94e('0x20')](_0x562305[_0xc94e('0x31')]['limit']);_0x2f8e5e[_0xc94e('0x1f')]=qs[_0xc94e('0x1f')](_0x562305[_0xc94e('0x31')][_0xc94e('0x1f')]);}_0x2f8e5e[_0xc94e('0x3a')]=qs['sort'](_0x562305[_0xc94e('0x31')][_0xc94e('0x3b')]);_0x2f8e5e[_0xc94e('0x3c')]=qs[_0xc94e('0x33')](_[_0xc94e('0x3d')](_0x562305[_0xc94e('0x31')],_0x343542['filters']),_0x18a984);if(_0x562305['query'][_0xc94e('0x3e')]){_0x2f8e5e[_0xc94e('0x3c')]=_['merge'](_0x2f8e5e[_0xc94e('0x3c')],{'$or':_[_0xc94e('0x2a')](_0x18a984,function(_0x3d79cb){if(_0x3d79cb[_0xc94e('0x2e')]!==_0xc94e('0x3f')){var _0x12475b={};_0x12475b[_0x3d79cb['name']]={'$like':'%'+_0x562305[_0xc94e('0x31')][_0xc94e('0x3e')]+'%'};return _0x12475b;}})});}_0x2f8e5e=_[_0xc94e('0x40')]({},_0x2f8e5e,_0x562305[_0xc94e('0x41')]);var _0x4456dc={'where':_0x2f8e5e[_0xc94e('0x3c')]};return db[_0xc94e('0x2b')][_0xc94e('0x1e')](_0x4456dc)[_0xc94e('0x25')](function(_0x51cd29){_0x344f1d['count']=_0x51cd29;if(_0x562305[_0xc94e('0x31')][_0xc94e('0x42')]){_0x2f8e5e[_0xc94e('0x43')]=[{'all':!![]}];}return db[_0xc94e('0x2b')][_0xc94e('0x44')](_0x2f8e5e);})[_0xc94e('0x25')](function(_0x166297){_0x344f1d[_0xc94e('0x45')]=_0x166297;return _0x344f1d;})['then'](respondWithFilteredResult(_0x4365fc,_0x2f8e5e))['catch'](handleError(_0x4365fc,null));};exports[_0xc94e('0x46')]=function(_0x549746,_0x46d1b7){var _0x2dfd59={'raw':!![],'where':{'id':_0x549746[_0xc94e('0x47')]['id']}},_0x52062e={};_0x52062e[_0xc94e('0x30')]=_[_0xc94e('0x32')](db[_0xc94e('0x2b')]['rawAttributes']);_0x52062e[_0xc94e('0x31')]=_[_0xc94e('0x32')](_0x549746[_0xc94e('0x31')]);_0x52062e[_0xc94e('0x33')]=_[_0xc94e('0x34')](_0x52062e[_0xc94e('0x30')],_0x52062e[_0xc94e('0x31')]);_0x2dfd59[_0xc94e('0x36')]=_['intersection'](_0x52062e['model'],qs[_0xc94e('0x35')](_0x549746[_0xc94e('0x31')][_0xc94e('0x35')]));_0x2dfd59[_0xc94e('0x36')]=_0x2dfd59[_0xc94e('0x36')][_0xc94e('0x37')]?_0x2dfd59['attributes']:_0x52062e[_0xc94e('0x30')];if(_0x549746[_0xc94e('0x31')]['includeAll']){_0x2dfd59['include']=[{'all':!![]}];}_0x2dfd59=_['merge']({},_0x2dfd59,_0x549746[_0xc94e('0x41')]);return db[_0xc94e('0x2b')][_0xc94e('0x48')](_0x2dfd59)[_0xc94e('0x25')](handleEntityNotFound(_0x46d1b7,null))[_0xc94e('0x25')](respondWithResult(_0x46d1b7,null))[_0xc94e('0x49')](handleError(_0x46d1b7,null));};exports[_0xc94e('0x4a')]=function(_0x3df387,_0x51be3c){return db[_0xc94e('0x2b')][_0xc94e('0x4a')](_0x3df387[_0xc94e('0x4b')],{})[_0xc94e('0x25')](respondWithResult(_0x51be3c,0xc9))[_0xc94e('0x49')](handleError(_0x51be3c,null));};exports[_0xc94e('0x4c')]=function(_0x361e14,_0x4cbb17){return db['CmHopperHistory'][_0xc94e('0x4c')]()[_0xc94e('0x25')](respondWithResult(_0x4cbb17,null))[_0xc94e('0x49')](handleError(_0x4cbb17,null));};exports[_0xc94e('0x24')]=function(_0x990ab5,_0x2bcc12){if(_0x990ab5[_0xc94e('0x4b')][_0xc94e('0x4d')]){delete _0x990ab5[_0xc94e('0x4b')][_0xc94e('0x4d')];}return db[_0xc94e('0x2b')]['find']({'where':{'uniqueid':_0x990ab5['params']['id']}})[_0xc94e('0x25')](handleEntityNotFound(_0x2bcc12,null))[_0xc94e('0x25')](saveUpdates(_0x990ab5['body'],null))[_0xc94e('0x25')](respondWithResult(_0x2bcc12,null))[_0xc94e('0x49')](handleError(_0x2bcc12,null));}; \ No newline at end of file +var _0xb8df=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','CmHopperHistory','findAll','show','find','catch','create','body','describe','uniqueid','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','squel','crypto'];(function(_0x27ebe8,_0x21dd01){var _0x431778=function(_0xcf97c6){while(--_0xcf97c6){_0x27ebe8['push'](_0x27ebe8['shift']());}};_0x431778(++_0x21dd01);}(_0xb8df,0x89));var _0xfb8d=function(_0x4f8d61,_0x29eff0){_0x4f8d61=_0x4f8d61-0x0;var _0x3bc078=_0xb8df[_0x4f8d61];return _0x3bc078;};'use strict';var pdf=require(_0xfb8d('0x0'));var emlformat=require(_0xfb8d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfb8d('0x2'));var jsonpatch=require(_0xfb8d('0x3'));var rp=require(_0xfb8d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfb8d('0x5'));var util=require('util');var path=require('path');var sox=require(_0xfb8d('0x6'));var csv=require(_0xfb8d('0x7'));var ejs=require(_0xfb8d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfb8d('0x9'));var crypto=require(_0xfb8d('0xa'));var jsforce=require(_0xfb8d('0xb'));var deskjs=require(_0xfb8d('0xc'));var toCsv=require(_0xfb8d('0x7'));var querystring=require(_0xfb8d('0xd'));var Papa=require('papaparse');var Redis=require(_0xfb8d('0xe'));var authService=require(_0xfb8d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb8d('0x10'));var logger=require('../../config/logger')(_0xfb8d('0x11'));var utils=require(_0xfb8d('0x12'));var config=require(_0xfb8d('0x13'));var licenseUtil=require(_0xfb8d('0x14'));var db=require(_0xfb8d('0x15'))['db'];function respondWithStatusCode(_0x3d2a52,_0x3d6bb2){_0x3d6bb2=_0x3d6bb2||0xcc;return function(_0x4b1ec6){if(_0x4b1ec6){return _0x3d2a52[_0xfb8d('0x16')](_0x3d6bb2);}return _0x3d2a52[_0xfb8d('0x17')](_0x3d6bb2)[_0xfb8d('0x18')]();};}function respondWithResult(_0x15f52a,_0x403ba5){_0x403ba5=_0x403ba5||0xc8;return function(_0x49851b){if(_0x49851b){return _0x15f52a[_0xfb8d('0x17')](_0x403ba5)[_0xfb8d('0x19')](_0x49851b);}};}function respondWithFilteredResult(_0x14c29a,_0xd1a5){return function(_0x18aac9){if(_0x18aac9){var _0x592fb3=_0x18aac9[_0xfb8d('0x1a')],_0x322664=_0xd1a5[_0xfb8d('0x1b')],_0x508e1f=_0xd1a5[_0xfb8d('0x1b')]+_0xd1a5[_0xfb8d('0x1c')],_0x427d3f;if(_0x508e1f>=_0x592fb3){_0x508e1f=_0x592fb3;_0x427d3f=0xc8;}else{_0x427d3f=0xce;}_0x14c29a[_0xfb8d('0x17')](_0x427d3f);return _0x14c29a[_0xfb8d('0x1d')](_0xfb8d('0x1e'),_0x322664+'-'+_0x508e1f+'/'+_0x592fb3)['json'](_0x18aac9);}return null;};}function patchUpdates(_0x38e00e){return function(_0x405be1){try{jsonpatch[_0xfb8d('0x1f')](_0x405be1,_0x38e00e,!![]);}catch(_0x1f0890){return BPromise[_0xfb8d('0x20')](_0x1f0890);}return _0x405be1[_0xfb8d('0x21')]();};}function saveUpdates(_0x3e7fd8,_0x184162){return function(_0x41b1f6){if(_0x41b1f6){return _0x41b1f6[_0xfb8d('0x22')](_0x3e7fd8)[_0xfb8d('0x23')](function(_0x353714){return _0x353714;});}return null;};}function removeEntity(_0x308ed3,_0x1a299c){return function(_0x17a2eb){if(_0x17a2eb){return _0x17a2eb[_0xfb8d('0x24')]()['then'](function(){_0x308ed3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44f051,_0x191309){return function(_0x440903){if(!_0x440903){_0x44f051[_0xfb8d('0x16')](0x194);}return _0x440903;};}function handleError(_0x1ca323,_0x1c3946){_0x1c3946=_0x1c3946||0x1f4;return function(_0x46888e){logger[_0xfb8d('0x25')](_0x46888e['stack']);if(_0x46888e[_0xfb8d('0x26')]){delete _0x46888e[_0xfb8d('0x26')];}_0x1ca323['status'](_0x1c3946)[_0xfb8d('0x27')](_0x46888e);};}exports['index']=function(_0x453173,_0x58f691){var _0x411b83={},_0x4e7481={},_0x460199={'count':0x0,'rows':[]};var _0x48e5f3=_[_0xfb8d('0x28')](db['CmHopperHistory'][_0xfb8d('0x29')],function(_0x5f3f06){return{'name':_0x5f3f06[_0xfb8d('0x2a')],'type':_0x5f3f06[_0xfb8d('0x2b')][_0xfb8d('0x2c')]};});_0x4e7481[_0xfb8d('0x2d')]=_[_0xfb8d('0x28')](_0x48e5f3,_0xfb8d('0x26'));_0x4e7481['query']=_[_0xfb8d('0x2e')](_0x453173['query']);_0x4e7481['filters']=_[_0xfb8d('0x2f')](_0x4e7481[_0xfb8d('0x2d')],_0x4e7481['query']);_0x411b83[_0xfb8d('0x30')]=_[_0xfb8d('0x2f')](_0x4e7481[_0xfb8d('0x2d')],qs[_0xfb8d('0x31')](_0x453173[_0xfb8d('0x32')][_0xfb8d('0x31')]));_0x411b83[_0xfb8d('0x30')]=_0x411b83[_0xfb8d('0x30')][_0xfb8d('0x33')]?_0x411b83['attributes']:_0x4e7481['model'];if(!_0x453173[_0xfb8d('0x32')][_0xfb8d('0x34')](_0xfb8d('0x35'))){_0x411b83[_0xfb8d('0x1c')]=qs[_0xfb8d('0x1c')](_0x453173['query'][_0xfb8d('0x1c')]);_0x411b83[_0xfb8d('0x1b')]=qs[_0xfb8d('0x1b')](_0x453173['query'][_0xfb8d('0x1b')]);}_0x411b83['order']=qs['sort'](_0x453173[_0xfb8d('0x32')][_0xfb8d('0x36')]);_0x411b83[_0xfb8d('0x37')]=qs['filters'](_[_0xfb8d('0x38')](_0x453173['query'],_0x4e7481[_0xfb8d('0x39')]),_0x48e5f3);if(_0x453173[_0xfb8d('0x32')][_0xfb8d('0x3a')]){_0x411b83['where']=_['merge'](_0x411b83[_0xfb8d('0x37')],{'$or':_['map'](_0x48e5f3,function(_0x29d51c){if(_0x29d51c[_0xfb8d('0x2b')]!==_0xfb8d('0x3b')){var _0x46a8e0={};_0x46a8e0[_0x29d51c[_0xfb8d('0x26')]]={'$like':'%'+_0x453173[_0xfb8d('0x32')][_0xfb8d('0x3a')]+'%'};return _0x46a8e0;}})});}_0x411b83=_[_0xfb8d('0x3c')]({},_0x411b83,_0x453173[_0xfb8d('0x3d')]);var _0x273e51={'where':_0x411b83[_0xfb8d('0x37')]};return db['CmHopperHistory']['count'](_0x273e51)[_0xfb8d('0x23')](function(_0x341c3c){_0x460199[_0xfb8d('0x1a')]=_0x341c3c;if(_0x453173[_0xfb8d('0x32')][_0xfb8d('0x3e')]){_0x411b83[_0xfb8d('0x3f')]=[{'all':!![]}];}return db[_0xfb8d('0x40')][_0xfb8d('0x41')](_0x411b83);})[_0xfb8d('0x23')](function(_0x53bf96){_0x460199['rows']=_0x53bf96;return _0x460199;})[_0xfb8d('0x23')](respondWithFilteredResult(_0x58f691,_0x411b83))['catch'](handleError(_0x58f691,null));};exports[_0xfb8d('0x42')]=function(_0x26f622,_0x5215bb){var _0x21c7c1={'raw':!![],'where':{'id':_0x26f622['params']['id']}},_0x3ee2dc={};_0x3ee2dc['model']=_[_0xfb8d('0x2e')](db[_0xfb8d('0x40')][_0xfb8d('0x29')]);_0x3ee2dc[_0xfb8d('0x32')]=_[_0xfb8d('0x2e')](_0x26f622[_0xfb8d('0x32')]);_0x3ee2dc[_0xfb8d('0x39')]=_[_0xfb8d('0x2f')](_0x3ee2dc[_0xfb8d('0x2d')],_0x3ee2dc[_0xfb8d('0x32')]);_0x21c7c1['attributes']=_[_0xfb8d('0x2f')](_0x3ee2dc[_0xfb8d('0x2d')],qs['fields'](_0x26f622[_0xfb8d('0x32')]['fields']));_0x21c7c1[_0xfb8d('0x30')]=_0x21c7c1[_0xfb8d('0x30')]['length']?_0x21c7c1[_0xfb8d('0x30')]:_0x3ee2dc[_0xfb8d('0x2d')];if(_0x26f622[_0xfb8d('0x32')][_0xfb8d('0x3e')]){_0x21c7c1['include']=[{'all':!![]}];}_0x21c7c1=_[_0xfb8d('0x3c')]({},_0x21c7c1,_0x26f622[_0xfb8d('0x3d')]);return db[_0xfb8d('0x40')][_0xfb8d('0x43')](_0x21c7c1)['then'](handleEntityNotFound(_0x5215bb,null))[_0xfb8d('0x23')](respondWithResult(_0x5215bb,null))[_0xfb8d('0x44')](handleError(_0x5215bb,null));};exports[_0xfb8d('0x45')]=function(_0x24e75b,_0x298364){return db[_0xfb8d('0x40')][_0xfb8d('0x45')](_0x24e75b[_0xfb8d('0x46')],{})[_0xfb8d('0x23')](respondWithResult(_0x298364,0xc9))[_0xfb8d('0x44')](handleError(_0x298364,null));};exports[_0xfb8d('0x47')]=function(_0x3ec530,_0x20c0da){return db[_0xfb8d('0x40')][_0xfb8d('0x47')]()[_0xfb8d('0x23')](respondWithResult(_0x20c0da,null))[_0xfb8d('0x44')](handleError(_0x20c0da,null));};exports['update']=function(_0xe96cc4,_0x1b976c){if(_0xe96cc4['body']['uniqueid']){delete _0xe96cc4[_0xfb8d('0x46')][_0xfb8d('0x48')];}return db[_0xfb8d('0x40')][_0xfb8d('0x43')]({'where':{'uniqueid':_0xe96cc4[_0xfb8d('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b976c,null))[_0xfb8d('0x23')](saveUpdates(_0xe96cc4[_0xfb8d('0x46')],null))['then'](respondWithResult(_0x1b976c,null))[_0xfb8d('0x44')](handleError(_0x1b976c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index e4978db..02af0b4 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 _0x183b=['moment','path','rimraf','../../config/environment','./cmHopperHistory.attributes','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0x3680e3,_0x5bf3a1){var _0x4c37b9=function(_0xf9990f){while(--_0xf9990f){_0x3680e3['push'](_0x3680e3['shift']());}};_0x4c37b9(++_0x5bf3a1);}(_0x183b,0x99));var _0xb183=function(_0x3c5aac,_0x972ee1){_0x3c5aac=_0x3c5aac-0x0;var _0x5cff78=_0x183b[_0x3c5aac];return _0x5cff78;};'use strict';var _=require(_0xb183('0x0'));var util=require(_0xb183('0x1'));var logger=require(_0xb183('0x2'))('api');var moment=require(_0xb183('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb183('0x4'));var rimraf=require(_0xb183('0x5'));var config=require(_0xb183('0x6'));var attributes=require(_0xb183('0x7'));module['exports']=function(_0x4ec3ad,_0x75f5e6){return _0x4ec3ad['define'](_0xb183('0x8'),attributes,{'tableName':_0xb183('0x9'),'paranoid':![],'indexes':[{'name':_0xb183('0xa'),'fields':[_0xb183('0xa')]},{'name':_0xb183('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2ac=['rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x377f50,_0x5589ba){var _0x14a9d2=function(_0x4ab38b){while(--_0x4ab38b){_0x377f50['push'](_0x377f50['shift']());}};_0x14a9d2(++_0x5589ba);}(_0xe2ac,0xcb));var _0xce2a=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0xe2ac[_0xc0d9bc];return _0x32ff73;};'use strict';var _=require(_0xce2a('0x0'));var util=require(_0xce2a('0x1'));var logger=require('../../config/logger')(_0xce2a('0x2'));var moment=require(_0xce2a('0x3'));var BPromise=require(_0xce2a('0x4'));var rp=require(_0xce2a('0x5'));var fs=require('fs');var path=require(_0xce2a('0x6'));var rimraf=require(_0xce2a('0x7'));var config=require(_0xce2a('0x8'));var attributes=require(_0xce2a('0x9'));module['exports']=function(_0x252abb,_0x570491){return _0x252abb[_0xce2a('0xa')](_0xce2a('0xb'),attributes,{'tableName':_0xce2a('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0xce2a('0xd'),'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 6fb4e1c..3b74c9b 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 _0xc1e8=['ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','info','CmHopperHistory,\x20%s,\x20%s','catch','CreateCmHopperHistory','CmHopperHistory','create','body','AvgHandleTime','options','raw','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','stringify','GetCampaignHopperHistory','ivrTotalCallsDays'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xc1e8,0x83));var _0x8c1e=function(_0x29d87d,_0x23dc31){_0x29d87d=_0x29d87d-0x0;var _0x1fd84b=_0xc1e8[_0x29d87d];return _0x1fd84b;};'use strict';var _=require(_0x8c1e('0x0'));var util=require(_0x8c1e('0x1'));var moment=require(_0x8c1e('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c1e('0x3'));var fs=require('fs');var Redis=require(_0x8c1e('0x4'));var db=require(_0x8c1e('0x5'))['db'];var utils=require(_0x8c1e('0x6'));var logger=require('../../config/logger')(_0x8c1e('0x7'));var config=require(_0x8c1e('0x8'));var jayson=require(_0x8c1e('0x9'));var client=jayson['client'][_0x8c1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x127480,_0x5a713e,_0x1dcfa4){return new BPromise(function(_0x4ddb8b,_0xecea62){return client['request'](_0x127480,_0x1dcfa4)[_0x8c1e('0xb')](function(_0x2ffaf1){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x5a713e,_0x8c1e('0xc'));logger[_0x8c1e('0xd')](_0x8c1e('0xe'),_0x5a713e,_0x8c1e('0xc'),JSON['stringify'](_0x2ffaf1));if(_0x2ffaf1[_0x8c1e('0xf')]){if(_0x2ffaf1[_0x8c1e('0xf')][_0x8c1e('0x10')]===0x1f4){logger[_0x8c1e('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x5a713e,_0x2ffaf1[_0x8c1e('0xf')][_0x8c1e('0x11')]);return _0xecea62(_0x2ffaf1[_0x8c1e('0xf')]['message']);}logger[_0x8c1e('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x5a713e,_0x2ffaf1[_0x8c1e('0xf')][_0x8c1e('0x11')]);return _0x4ddb8b(_0x2ffaf1[_0x8c1e('0xf')][_0x8c1e('0x11')]);}else{logger[_0x8c1e('0x12')](_0x8c1e('0x13'),_0x5a713e,_0x8c1e('0xc'));_0x4ddb8b(_0x2ffaf1['result'][_0x8c1e('0x11')]);}})[_0x8c1e('0x14')](function(_0x3dd07c){logger[_0x8c1e('0xf')](_0x8c1e('0x13'),_0x5a713e,_0x3dd07c);_0xecea62(_0x3dd07c);});});}exports[_0x8c1e('0x15')]=function(_0x1e8f6d){var _0x37c4e5=this;return new Promise(function(_0x32ce09,_0x4b761a){return db[_0x8c1e('0x16')][_0x8c1e('0x17')](_0x1e8f6d[_0x8c1e('0x18')],{'raw':_0x1e8f6d['options']?_0x1e8f6d['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x10f80f){logger['info'](_0x8c1e('0x15'),_0x1e8f6d);logger[_0x8c1e('0xd')]('CreateCmHopperHistory',_0x1e8f6d,JSON['stringify'](_0x10f80f));_0x32ce09(_0x10f80f);})['catch'](function(_0x2f5ea9){logger[_0x8c1e('0xf')](_0x8c1e('0x15'),_0x2f5ea9[_0x8c1e('0x11')],_0x1e8f6d);_0x4b761a(_0x37c4e5[_0x8c1e('0xf')](0x1f4,_0x2f5ea9['message']));});});};exports[_0x8c1e('0x19')]=function(_0x528d6a){var _0x33f108=this;return new Promise(function(_0x3196de,_0x459672){return db[_0x8c1e('0x16')]['findAll']({'raw':_0x528d6a[_0x8c1e('0x1a')]?_0x528d6a[_0x8c1e('0x1a')][_0x8c1e('0x1b')]===undefined?!![]:![]:!![],'where':_0x528d6a['options']?_0x528d6a[_0x8c1e('0x1a')]['where']||null:null,'attributes':[[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')][_0x8c1e('0x1e')]('id')),_0x8c1e('0x1f')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x8c1e('0x20')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),_0x8c1e('0x22')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x23')))),_0x8c1e('0x24')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x25'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x25'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x26')))),_0x8c1e('0x27')]]})[_0x8c1e('0xb')](function(_0x44d095){logger['info'](_0x8c1e('0x19'),_0x528d6a);logger['debug'](_0x8c1e('0x19'),_0x528d6a,JSON['stringify'](_0x44d095));_0x3196de(_0x44d095);})[_0x8c1e('0x14')](function(_0x4c443d){logger['error'](_0x8c1e('0x19'),_0x4c443d['message'],_0x528d6a);_0x459672(_0x33f108['error'](0x1f4,_0x4c443d[_0x8c1e('0x11')]));});});};exports[_0x8c1e('0x28')]=function(_0x36000d){var _0x45fc92=this;return new Promise(function(_0x3190f7,_0x5bc3fb){return db[_0x8c1e('0x16')][_0x8c1e('0x29')]({'raw':_0x36000d[_0x8c1e('0x1a')]?_0x36000d[_0x8c1e('0x1a')][_0x8c1e('0x1b')]===undefined?!![]:![]:!![],'where':_0x36000d[_0x8c1e('0x1a')]?_0x36000d[_0x8c1e('0x1a')][_0x8c1e('0x2a')]||null:null,'attributes':[[_0x8c1e('0x2b'),_0x8c1e('0x2c')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db['sequelize']['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x2d')))),_0x8c1e('0x2e')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x203,\x201,\x20null'))),_0x8c1e('0x2f')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db['sequelize']['fn']('IF',db[_0x8c1e('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x205,\x201,\x20null'))),_0x8c1e('0x30')],[db[_0x8c1e('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x31')))),_0x8c1e('0x32')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x33')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x34')))),_0x8c1e('0x35')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),_0x8c1e('0x36')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x8c1e('0x37')],[db['sequelize']['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0x8c1e('0x38')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x39')))),_0x8c1e('0x3a')],[db[_0x8c1e('0x1c')]['fn']('COUNT',db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),_0x8c1e('0x3b')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db['sequelize'][_0x8c1e('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0x8c1e('0x3a')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x8c1e('0x3c')))),'outboundReCallsDay']],'group':['campaign']})['then'](function(_0x54b6a5){logger['info'](_0x8c1e('0x28'),_0x36000d);logger[_0x8c1e('0xd')]('GetVoiceQueueHopperHistory',_0x36000d,JSON[_0x8c1e('0x3d')](_0x54b6a5));_0x3190f7(_0x54b6a5);})[_0x8c1e('0x14')](function(_0xfed240){logger[_0x8c1e('0xf')](_0x8c1e('0x28'),_0xfed240[_0x8c1e('0x11')],_0x36000d);_0x5bc3fb(_0x45fc92[_0x8c1e('0xf')](0x1f4,_0xfed240[_0x8c1e('0x11')]));});});};exports[_0x8c1e('0x3e')]=function(_0x4001e9){var _0x13cf7a=this;return new Promise(function(_0x5c8d15,_0x479f09){return db[_0x8c1e('0x16')][_0x8c1e('0x29')]({'raw':_0x4001e9[_0x8c1e('0x1a')]?_0x4001e9['options'][_0x8c1e('0x1b')]===undefined?!![]:![]:!![],'where':_0x4001e9['options']?_0x4001e9[_0x8c1e('0x1a')][_0x8c1e('0x2a')]||null:null,'attributes':[[_0x8c1e('0x2b'),_0x8c1e('0x2c')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')][_0x8c1e('0x1e')]('id')),_0x8c1e('0x3f')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db['sequelize']['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x20')))),_0x8c1e('0x40')]],'group':[_0x8c1e('0x2b')]})[_0x8c1e('0xb')](function(_0x5cae1a){logger[_0x8c1e('0x12')](_0x8c1e('0x3e'),_0x4001e9);logger['debug'](_0x8c1e('0x3e'),_0x4001e9,JSON[_0x8c1e('0x3d')](_0x5cae1a));_0x5c8d15(_0x5cae1a);})['catch'](function(_0xee8957){logger[_0x8c1e('0xf')](_0x8c1e('0x3e'),_0xee8957[_0x8c1e('0x11')],_0x4001e9);_0x479f09(_0x13cf7a[_0x8c1e('0xf')](0x1f4,_0xee8957['message']));});});}; \ No newline at end of file +var _0x80f6=['findAll','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','then','AvgHandleTime','where','sequelize','COUNT','col','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory'];(function(_0xe09d0,_0x1e55d0){var _0x44ad05=function(_0x5095b0){while(--_0x5095b0){_0xe09d0['push'](_0xe09d0['shift']());}};_0x44ad05(++_0x1e55d0);}(_0x80f6,0x171));var _0x680f=function(_0x1a6eed,_0x293a54){_0x1a6eed=_0x1a6eed-0x0;var _0x2799f3=_0x80f6[_0x1a6eed];return _0x2799f3;};'use strict';var _=require(_0x680f('0x0'));var util=require(_0x680f('0x1'));var moment=require(_0x680f('0x2'));var BPromise=require(_0x680f('0x3'));var rs=require(_0x680f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x680f('0x5'));var logger=require(_0x680f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x680f('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x524724,_0x54973e,_0x5b9644){return new BPromise(function(_0x542dc5,_0x2259a5){return client[_0x680f('0x8')](_0x524724,_0x5b9644)['then'](function(_0x29e3ae){logger[_0x680f('0x9')](_0x680f('0xa'),_0x54973e,_0x680f('0xb'));logger[_0x680f('0xc')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x54973e,'request\x20sent',JSON[_0x680f('0xd')](_0x29e3ae));if(_0x29e3ae['error']){if(_0x29e3ae['error'][_0x680f('0xe')]===0x1f4){logger[_0x680f('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x54973e,_0x29e3ae[_0x680f('0xf')][_0x680f('0x10')]);return _0x2259a5(_0x29e3ae[_0x680f('0xf')][_0x680f('0x10')]);}logger[_0x680f('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x54973e,_0x29e3ae[_0x680f('0xf')][_0x680f('0x10')]);return _0x542dc5(_0x29e3ae['error'][_0x680f('0x10')]);}else{logger[_0x680f('0x9')](_0x680f('0xa'),_0x54973e,_0x680f('0xb'));_0x542dc5(_0x29e3ae[_0x680f('0x11')][_0x680f('0x10')]);}})[_0x680f('0x12')](function(_0x29eab7){logger['error'](_0x680f('0xa'),_0x54973e,_0x29eab7);_0x2259a5(_0x29eab7);});});}exports[_0x680f('0x13')]=function(_0x324437){var _0x46d470=this;return new Promise(function(_0x1fbd54,_0x44d965){return db[_0x680f('0x14')][_0x680f('0x15')](_0x324437['body'],{'raw':_0x324437['options']?_0x324437[_0x680f('0x16')][_0x680f('0x17')]===undefined?!![]:![]:!![]})[_0x680f('0x18')](function(_0x33fe0b){logger[_0x680f('0x9')](_0x680f('0x13'),_0x324437);logger['debug'](_0x680f('0x13'),_0x324437,JSON['stringify'](_0x33fe0b));_0x1fbd54(_0x33fe0b);})[_0x680f('0x12')](function(_0x5bae4d){logger[_0x680f('0xf')](_0x680f('0x13'),_0x5bae4d[_0x680f('0x10')],_0x324437);_0x44d965(_0x46d470[_0x680f('0xf')](0x1f4,_0x5bae4d[_0x680f('0x10')]));});});};exports[_0x680f('0x19')]=function(_0x44bc31){var _0x1aa03b=this;return new Promise(function(_0x3b440e,_0x4de78c){return db[_0x680f('0x14')]['findAll']({'raw':_0x44bc31['options']?_0x44bc31['options'][_0x680f('0x17')]===undefined?!![]:![]:!![],'where':_0x44bc31['options']?_0x44bc31[_0x680f('0x16')][_0x680f('0x1a')]||null:null,'attributes':[[db[_0x680f('0x1b')]['fn'](_0x680f('0x1c'),db['sequelize'][_0x680f('0x1d')]('id')),'predictiveIntervalTotalCalls'],[db[_0x680f('0x1b')]['fn']('COUNT',db[_0x680f('0x1b')]['fn']('IF',db['sequelize'][_0x680f('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0x680f('0x1f')],[db[_0x680f('0x1b')]['fn'](_0x680f('0x1c'),db[_0x680f('0x1b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x680f('0x1c'),db[_0x680f('0x1b')]['fn']('IF',db[_0x680f('0x1b')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0x680f('0x20')],[db['sequelize']['fn'](_0x680f('0x21'),db[_0x680f('0x1b')]['fn']('IF',db[_0x680f('0x1b')][_0x680f('0x1e')](_0x680f('0x22')))),_0x680f('0x23')],[db[_0x680f('0x1b')]['fn'](_0x680f('0x21'),db['sequelize']['fn']('IF',db[_0x680f('0x1b')][_0x680f('0x1e')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x680f('0x24')]]})[_0x680f('0x18')](function(_0x5182e7){logger[_0x680f('0x9')](_0x680f('0x19'),_0x44bc31);logger[_0x680f('0xc')](_0x680f('0x19'),_0x44bc31,JSON[_0x680f('0xd')](_0x5182e7));_0x3b440e(_0x5182e7);})['catch'](function(_0x5412de){logger['error']('AvgHandleTime',_0x5412de[_0x680f('0x10')],_0x44bc31);_0x4de78c(_0x1aa03b['error'](0x1f4,_0x5412de[_0x680f('0x10')]));});});};exports[_0x680f('0x25')]=function(_0x569843){var _0x2806e8=this;return new Promise(function(_0x2ff7f8,_0xf6b14){return db[_0x680f('0x14')]['findAll']({'raw':_0x569843[_0x680f('0x16')]?_0x569843[_0x680f('0x16')][_0x680f('0x17')]===undefined?!![]:![]:!![],'where':_0x569843['options']?_0x569843[_0x680f('0x16')][_0x680f('0x1a')]||null:null,'attributes':[[_0x680f('0x26'),_0x680f('0x27')],[db[_0x680f('0x1b')]['fn'](_0x680f('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x680f('0x28')))),'outboundNoSuchCallsDay'],[db[_0x680f('0x1b')]['fn'](_0x680f('0x1c'),db[_0x680f('0x1b')]['fn']('IF',db[_0x680f('0x1b')][_0x680f('0x1e')]('`state`\x20=\x203,\x201,\x20null'))),_0x680f('0x29')],[db[_0x680f('0x1b')]['fn']('COUNT',db[_0x680f('0x1b')]['fn']('IF',db['sequelize'][_0x680f('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x680f('0x1b')]['fn'](_0x680f('0x1c'),db[_0x680f('0x1b')]['fn']('IF',db['sequelize'][_0x680f('0x1e')](_0x680f('0x2a')))),_0x680f('0x2b')],[db['sequelize']['fn'](_0x680f('0x1c'),db['sequelize']['fn']('IF',db[_0x680f('0x1b')]['literal'](_0x680f('0x2c')))),_0x680f('0x2d')],[db[_0x680f('0x1b')]['fn'](_0x680f('0x1c'),db[_0x680f('0x1b')]['fn']('IF',db[_0x680f('0x1b')][_0x680f('0x1e')](_0x680f('0x2e')))),_0x680f('0x2f')],[db[_0x680f('0x1b')]['fn'](_0x680f('0x1c'),db[_0x680f('0x1b')]['fn']('IF',db[_0x680f('0x1b')][_0x680f('0x1e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x680f('0x30')],[db['sequelize']['fn'](_0x680f('0x1c'),db[_0x680f('0x1b')]['fn']('IF',db[_0x680f('0x1b')][_0x680f('0x1e')](_0x680f('0x31')))),_0x680f('0x32')],[db[_0x680f('0x1b')]['fn']('COUNT',db[_0x680f('0x1b')]['fn']('IF',db[_0x680f('0x1b')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x680f('0x33')],[db[_0x680f('0x1b')]['fn']('COUNT',db[_0x680f('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x680f('0x34')))),_0x680f('0x35')],[db[_0x680f('0x1b')]['fn'](_0x680f('0x1c'),db[_0x680f('0x1b')]['fn']('IF',db[_0x680f('0x1b')][_0x680f('0x1e')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x680f('0x1b')]['fn']('COUNT',db[_0x680f('0x1b')]['fn']('IF',db[_0x680f('0x1b')][_0x680f('0x1e')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x680f('0x1b')]['fn']('COUNT',db[_0x680f('0x1b')]['fn']('IF',db['sequelize'][_0x680f('0x1e')]('`state`\x20=\x2020,\x201,\x20null'))),_0x680f('0x36')],[db[_0x680f('0x1b')]['fn'](_0x680f('0x1c'),db[_0x680f('0x1b')]['fn']('IF',db['sequelize'][_0x680f('0x1e')](_0x680f('0x37')))),_0x680f('0x38')]],'group':['campaign']})[_0x680f('0x18')](function(_0x100d40){logger[_0x680f('0x9')](_0x680f('0x25'),_0x569843);logger[_0x680f('0xc')](_0x680f('0x25'),_0x569843,JSON[_0x680f('0xd')](_0x100d40));_0x2ff7f8(_0x100d40);})[_0x680f('0x12')](function(_0x21baa1){logger[_0x680f('0xf')](_0x680f('0x25'),_0x21baa1[_0x680f('0x10')],_0x569843);_0xf6b14(_0x2806e8[_0x680f('0xf')](0x1f4,_0x21baa1[_0x680f('0x10')]));});});};exports[_0x680f('0x39')]=function(_0x3cd362){var _0x47d5de=this;return new Promise(function(_0x50e3e0,_0x4a34c7){return db[_0x680f('0x14')][_0x680f('0x3a')]({'raw':_0x3cd362[_0x680f('0x16')]?_0x3cd362['options']['raw']===undefined?!![]:![]:!![],'where':_0x3cd362[_0x680f('0x16')]?_0x3cd362[_0x680f('0x16')][_0x680f('0x1a')]||null:null,'attributes':[[_0x680f('0x26'),_0x680f('0x27')],[db[_0x680f('0x1b')]['fn'](_0x680f('0x1c'),db[_0x680f('0x1b')][_0x680f('0x1d')]('id')),'ivrTotalCallsDays'],[db[_0x680f('0x1b')]['fn'](_0x680f('0x1c'),db[_0x680f('0x1b')]['fn']('IF',db[_0x680f('0x1b')]['literal'](_0x680f('0x3b')))),_0x680f('0x3c')]],'group':[_0x680f('0x26')]})[_0x680f('0x18')](function(_0x2e93dd){logger[_0x680f('0x9')](_0x680f('0x39'),_0x3cd362);logger[_0x680f('0xc')](_0x680f('0x39'),_0x3cd362,JSON['stringify'](_0x2e93dd));_0x50e3e0(_0x2e93dd);})[_0x680f('0x12')](function(_0x135fef){logger[_0x680f('0xf')](_0x680f('0x39'),_0x135fef[_0x680f('0x10')],_0x3cd362);_0x4a34c7(_0x47d5de[_0x680f('0xf')](0x1f4,_0x135fef['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 2f807bc..0ba6822 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 _0x0182=['create','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','get','/describe','describe','/:id'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0182,0x18a));var _0x2018=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x0182[_0x382a62];return _0x490a25;};'use strict';var multer=require(_0x2018('0x0'));var util=require(_0x2018('0x1'));var path=require(_0x2018('0x2'));var timeout=require(_0x2018('0x3'));var express=require(_0x2018('0x4'));var router=express[_0x2018('0x5')]();var auth=require(_0x2018('0x6'));var interaction=require(_0x2018('0x7'));var config=require('../../config/environment');var controller=require(_0x2018('0x8'));router['get']('/',auth[_0x2018('0x9')](),controller['index']);router[_0x2018('0xa')](_0x2018('0xb'),auth[_0x2018('0x9')](),controller[_0x2018('0xc')]);router[_0x2018('0xa')](_0x2018('0xd'),auth[_0x2018('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2018('0xe')]);router[_0x2018('0xf')](_0x2018('0xd'),auth['isAuthenticated'](),controller[_0x2018('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6fd9=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','./cmHopperHistory.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','exports'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0x6fd9,0x190));var _0x96fd=function(_0x258581,_0x39812d){_0x258581=_0x258581-0x0;var _0x2dfc61=_0x6fd9[_0x258581];return _0x2dfc61;};'use strict';var multer=require(_0x96fd('0x0'));var util=require(_0x96fd('0x1'));var path=require(_0x96fd('0x2'));var timeout=require(_0x96fd('0x3'));var express=require(_0x96fd('0x4'));var router=express[_0x96fd('0x5')]();var auth=require(_0x96fd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x96fd('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x96fd('0x8')]);router[_0x96fd('0x9')](_0x96fd('0xa'),auth[_0x96fd('0xb')](),controller[_0x96fd('0xc')]);router[_0x96fd('0x9')](_0x96fd('0xd'),auth['isAuthenticated'](),controller[_0x96fd('0xe')]);router[_0x96fd('0xf')]('/',auth[_0x96fd('0xb')](),controller[_0x96fd('0x10')]);router[_0x96fd('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x96fd('0x12')]);module[_0x96fd('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index a4cf56b..0489ca8 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 _0xed29=['STRING','sequelize'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0xed29,0x1a3));var _0x9ed2=function(_0xc8a598,_0x8ffd7c){_0xc8a598=_0xc8a598-0x0;var _0x2a6225=_0xed29[_0xc8a598];return _0x2a6225;};'use strict';var Sequelize=require(_0x9ed2('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ed2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9ed2('0x1')]},'dialPrefix':{'type':Sequelize[_0x9ed2('0x1')]}}; \ No newline at end of file +var _0x44c7=['name','sequelize','exports','STRING'];(function(_0x259eba,_0x22ede8){var _0x3b4a07=function(_0x3b4a67){while(--_0x3b4a67){_0x259eba['push'](_0x259eba['shift']());}};_0x3b4a07(++_0x22ede8);}(_0x44c7,0x1e9));var _0x744c=function(_0x2d8246,_0x54a449){_0x2d8246=_0x2d8246-0x0;var _0x3f0a0c=_0x44c7[_0x2d8246];return _0x3f0a0c;};'use strict';var Sequelize=require(_0x744c('0x0'));module[_0x744c('0x1')]={'name':{'type':Sequelize[_0x744c('0x2')],'unique':_0x744c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b483564..32457b4 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(_0x3173f2,_0x5d4f2f){var _0x488bb6=function(_0x5ae4ae){while(--_0x5ae4ae){_0x3173f2['push'](_0x3173f2['shift']());}};_0x488bb6(++_0x5d4f2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file +var _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x17e59f,_0x35fc97){var _0x1d2b26=function(_0x54a619){while(--_0x54a619){_0x17e59f['push'](_0x17e59f['shift']());}};_0x1d2b26(++_0x35fc97);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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 29a32b5..fea30da 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 _0xceb3=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','CmList','save'];(function(_0x192681,_0x991e0b){var _0x4c50da=function(_0x4f7d8f){while(--_0x4f7d8f){_0x192681['push'](_0x192681['shift']());}};_0x4c50da(++_0x991e0b);}(_0xceb3,0x94));var _0x3ceb=function(_0x4f6f84,_0x31e197){_0x4f6f84=_0x4f6f84-0x0;var _0x20d989=_0xceb3[_0x4f6f84];return _0x20d989;};'use strict';var EventEmitter=require(_0x3ceb('0x0'));var CmList=require(_0x3ceb('0x1'))['db'][_0x3ceb('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3ceb('0x3'),'afterUpdate':'update','afterDestroy':_0x3ceb('0x4')};function emitEvent(_0x454d8d){return function(_0x4e9a10,_0x1a430b,_0x19d374){CmListEvents[_0x3ceb('0x5')](_0x454d8d+':'+_0x4e9a10['id'],_0x4e9a10);CmListEvents['emit'](_0x454d8d,_0x4e9a10);_0x19d374(null);};}for(var e in events){if(events[_0x3ceb('0x6')](e)){var event=events[e];CmList[_0x3ceb('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x4bd3=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x48d664,_0x534066){var _0x5745a7=function(_0x36a42f){while(--_0x36a42f){_0x48d664['push'](_0x48d664['shift']());}};_0x5745a7(++_0x534066);}(_0x4bd3,0x198));var _0x34bd=function(_0x422a8b,_0x578987){_0x422a8b=_0x422a8b-0x0;var _0x38763f=_0x4bd3[_0x422a8b];return _0x38763f;};'use strict';var EventEmitter=require(_0x34bd('0x0'));var CmList=require(_0x34bd('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':_0x34bd('0x3'),'afterUpdate':_0x34bd('0x4'),'afterDestroy':_0x34bd('0x5')};function emitEvent(_0xe5f89e){return function(_0x54cf87,_0x1a93ad,_0x33dc8c){CmListEvents[_0x34bd('0x6')](_0xe5f89e+':'+_0x54cf87['id'],_0x54cf87);CmListEvents['emit'](_0xe5f89e,_0x54cf87);_0x33dc8c(null);};}for(var e in events){if(events[_0x34bd('0x7')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x34bd('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 32f12e1..0bcab57 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 _0x0c88=['./cmList.attributes','exports','define','CmList','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2099e5,_0x45825c){var _0x58e8f=function(_0x2aad5e){while(--_0x2aad5e){_0x2099e5['push'](_0x2099e5['shift']());}};_0x58e8f(++_0x45825c);}(_0x0c88,0x72));var _0x80c8=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x0c88[_0x387dc1];return _0x17567c;};'use strict';var _=require(_0x80c8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x80c8('0x1'));var moment=require(_0x80c8('0x2'));var BPromise=require(_0x80c8('0x3'));var rp=require(_0x80c8('0x4'));var fs=require('fs');var path=require(_0x80c8('0x5'));var rimraf=require(_0x80c8('0x6'));var config=require('../../config/environment');var attributes=require(_0x80c8('0x7'));module[_0x80c8('0x8')]=function(_0x25621f,_0xca9727){return _0x25621f[_0x80c8('0x9')](_0x80c8('0xa'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7de=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmList.attributes','exports','define','CmList'];(function(_0x1dea69,_0x2b8cc6){var _0xe60e45=function(_0xe586f4){while(--_0xe586f4){_0x1dea69['push'](_0x1dea69['shift']());}};_0xe60e45(++_0x2b8cc6);}(_0xf7de,0x84));var _0xef7d=function(_0x3295b6,_0x1bc521){_0x3295b6=_0x3295b6-0x0;var _0x4e7914=_0xf7de[_0x3295b6];return _0x4e7914;};'use strict';var _=require(_0xef7d('0x0'));var util=require(_0xef7d('0x1'));var logger=require(_0xef7d('0x2'))('api');var moment=require(_0xef7d('0x3'));var BPromise=require(_0xef7d('0x4'));var rp=require(_0xef7d('0x5'));var fs=require('fs');var path=require(_0xef7d('0x6'));var rimraf=require('rimraf');var config=require(_0xef7d('0x7'));var attributes=require(_0xef7d('0x8'));module[_0xef7d('0x9')]=function(_0x49de8a,_0x442221){return _0x49de8a[_0xef7d('0xa')](_0xef7d('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index b952ac0..5042e48 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 _0x6a8d=['./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x36549f,_0x5c74f9){var _0x174066=function(_0x211330){while(--_0x211330){_0x36549f['push'](_0x36549f['shift']());}};_0x174066(++_0x5c74f9);}(_0x6a8d,0x1ed));var _0xd6a8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x6a8d[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0xd6a8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6a8('0x1'));var db=require(_0xd6a8('0x2'))['db'];var utils=require(_0xd6a8('0x3'));var logger=require(_0xd6a8('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd6a8('0x5'));var client=jayson[_0xd6a8('0x6')][_0xd6a8('0x7')]({'port':0x232a});config[_0xd6a8('0x8')]=_['defaults'](config[_0xd6a8('0x8')],{'host':_0xd6a8('0x9'),'port':0x18eb});var socket=require(_0xd6a8('0xa'))(new Redis(config[_0xd6a8('0x8')]));require(_0xd6a8('0xb'))[_0xd6a8('0xc')](socket);function respondWithRpcPromise(_0x4781e5,_0x52aa7c,_0x16c4c0){return new BPromise(function(_0x1a75e1,_0xb5f533){return client[_0xd6a8('0xd')](_0x4781e5,_0x16c4c0)['then'](function(_0x361b18){logger[_0xd6a8('0xe')](_0xd6a8('0xf'),_0x52aa7c,_0xd6a8('0x10'));logger[_0xd6a8('0x11')](_0xd6a8('0x12'),_0x52aa7c,'request\x20sent',JSON[_0xd6a8('0x13')](_0x361b18));if(_0x361b18[_0xd6a8('0x14')]){if(_0x361b18[_0xd6a8('0x14')][_0xd6a8('0x15')]===0x1f4){logger[_0xd6a8('0x14')](_0xd6a8('0xf'),_0x52aa7c,_0x361b18[_0xd6a8('0x14')]['message']);return _0xb5f533(_0x361b18[_0xd6a8('0x14')][_0xd6a8('0x16')]);}logger[_0xd6a8('0x14')](_0xd6a8('0xf'),_0x52aa7c,_0x361b18[_0xd6a8('0x14')][_0xd6a8('0x16')]);return _0x1a75e1(_0x361b18[_0xd6a8('0x14')]['message']);}else{logger[_0xd6a8('0xe')](_0xd6a8('0xf'),_0x52aa7c,_0xd6a8('0x10'));_0x1a75e1(_0x361b18['result']['message']);}})[_0xd6a8('0x17')](function(_0x10943d){logger[_0xd6a8('0x14')](_0xd6a8('0xf'),_0x52aa7c,_0x10943d);_0xb5f533(_0x10943d);});});} \ No newline at end of file +var _0x14b9=['./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x3a06f4,_0x5b0647){var _0x2a9114=function(_0x2dcd48){while(--_0x2dcd48){_0x3a06f4['push'](_0x3a06f4['shift']());}};_0x2a9114(++_0x5b0647);}(_0x14b9,0xfd));var _0x914b=function(_0x4bee5a,_0xa2a71a){_0x4bee5a=_0x4bee5a-0x0;var _0x2a4772=_0x14b9[_0x4bee5a];return _0x2a4772;};'use strict';var _=require(_0x914b('0x0'));var util=require('util');var moment=require(_0x914b('0x1'));var BPromise=require(_0x914b('0x2'));var rs=require(_0x914b('0x3'));var fs=require('fs');var Redis=require(_0x914b('0x4'));var db=require(_0x914b('0x5'))['db'];var utils=require(_0x914b('0x6'));var logger=require(_0x914b('0x7'))(_0x914b('0x8'));var config=require(_0x914b('0x9'));var jayson=require(_0x914b('0xa'));var client=jayson[_0x914b('0xb')][_0x914b('0xc')]({'port':0x232a});config[_0x914b('0xd')]=_[_0x914b('0xe')](config[_0x914b('0xd')],{'host':_0x914b('0xf'),'port':0x18eb});var socket=require(_0x914b('0x10'))(new Redis(config[_0x914b('0xd')]));require(_0x914b('0x11'))['register'](socket);function respondWithRpcPromise(_0x2174cc,_0x673317,_0x48ab0a){return new BPromise(function(_0x14d928,_0x562434){return client[_0x914b('0x12')](_0x2174cc,_0x48ab0a)[_0x914b('0x13')](function(_0x1264d4){logger[_0x914b('0x14')](_0x914b('0x15'),_0x673317,'request\x20sent');logger[_0x914b('0x16')](_0x914b('0x17'),_0x673317,_0x914b('0x18'),JSON[_0x914b('0x19')](_0x1264d4));if(_0x1264d4[_0x914b('0x1a')]){if(_0x1264d4['error'][_0x914b('0x1b')]===0x1f4){logger[_0x914b('0x1a')](_0x914b('0x15'),_0x673317,_0x1264d4[_0x914b('0x1a')][_0x914b('0x1c')]);return _0x562434(_0x1264d4[_0x914b('0x1a')][_0x914b('0x1c')]);}logger['error'](_0x914b('0x15'),_0x673317,_0x1264d4[_0x914b('0x1a')][_0x914b('0x1c')]);return _0x14d928(_0x1264d4[_0x914b('0x1a')][_0x914b('0x1c')]);}else{logger[_0x914b('0x14')](_0x914b('0x15'),_0x673317,_0x914b('0x18'));_0x14d928(_0x1264d4[_0x914b('0x1d')][_0x914b('0x1c')]);}})['catch'](function(_0x52fd26){logger[_0x914b('0x1a')](_0x914b('0x15'),_0x673317,_0x52fd26);_0x562434(_0x52fd26);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2237ca3..7f2ee5b 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 _0x9c63=['./cmList.events','save','remove','update','emit','removeListener','register','length','cmList:'];(function(_0x2b9305,_0x1ce6a7){var _0x281243=function(_0x59892c){while(--_0x59892c){_0x2b9305['push'](_0x2b9305['shift']());}};_0x281243(++_0x1ce6a7);}(_0x9c63,0x1a7));var _0x39c6=function(_0x1da60f,_0x1cb7a0){_0x1da60f=_0x1da60f-0x0;var _0x2a67a4=_0x9c63[_0x1da60f];return _0x2a67a4;};'use strict';var CmListEvents=require(_0x39c6('0x0'));var events=[_0x39c6('0x1'),_0x39c6('0x2'),_0x39c6('0x3')];function createListener(_0xcdf16c,_0x5dccd9){return function(_0x15f661){_0x5dccd9[_0x39c6('0x4')](_0xcdf16c,_0x15f661);};}function removeListener(_0x521670,_0x59c413){return function(){CmListEvents[_0x39c6('0x5')](_0x521670,_0x59c413);};}exports[_0x39c6('0x6')]=function(_0x1071e8){for(var _0xf47b0d=0x0,_0x435078=events[_0x39c6('0x7')];_0xf47b0d<_0x435078;_0xf47b0d++){var _0x48e68f=events[_0xf47b0d];var _0x364ad5=createListener(_0x39c6('0x8')+_0x48e68f,_0x1071e8);CmListEvents['on'](_0x48e68f,_0x364ad5);}}; \ No newline at end of file +var _0x7f3f=['cmList:','./cmList.events','save','update','emit','removeListener','length'];(function(_0x5d4cb5,_0x22025e){var _0x25561e=function(_0x4d792a){while(--_0x4d792a){_0x5d4cb5['push'](_0x5d4cb5['shift']());}};_0x25561e(++_0x22025e);}(_0x7f3f,0x1c8));var _0xf7f3=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x7f3f[_0x34d346];return _0x122d76;};'use strict';var CmListEvents=require(_0xf7f3('0x0'));var events=[_0xf7f3('0x1'),'remove',_0xf7f3('0x2')];function createListener(_0x445831,_0x2925b0){return function(_0x1354ec){_0x2925b0[_0xf7f3('0x3')](_0x445831,_0x1354ec);};}function removeListener(_0x4b4dbb,_0x19374c){return function(){CmListEvents[_0xf7f3('0x4')](_0x4b4dbb,_0x19374c);};}exports['register']=function(_0x163eab){for(var _0x2c1059=0x0,_0xe75375=events[_0xf7f3('0x5')];_0x2c1059<_0xe75375;_0x2c1059++){var _0x14b371=events[_0x2c1059];var _0x31beac=createListener(_0xf7f3('0x6')+_0x14b371,_0x163eab);CmListEvents['on'](_0x14b371,_0x31beac);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e561b27..32dc3b9 100644 --- a/server/api/cmList/index.js +++ b/server/api/cmList/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 6a02294..bc62e2b 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(_0x18c601,_0x46b6aa){var _0x2ef994=function(_0x151917){while(--_0x151917){_0x18c601['push'](_0x18c601['shift']());}};_0x2ef994(++_0x46b6aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x16efe4,_0x1d7255){var _0x30335e=function(_0x57d87a){while(--_0x57d87a){_0x16efe4['push'](_0x16efe4['shift']());}};_0x30335e(++_0x1d7255);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 bec0679..01504de 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 _0x3518=['then','destroy','error','stack','name','send','body','find','params','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update'];(function(_0x8d3282,_0x23704e){var _0x4355ec=function(_0x22a7b9){while(--_0x22a7b9){_0x8d3282['push'](_0x8d3282['shift']());}};_0x4355ec(++_0x23704e);}(_0x3518,0xbe));var _0x8351=function(_0x36e059,_0x19ee27){_0x36e059=_0x36e059-0x0;var _0x52ee13=_0x3518[_0x36e059];return _0x52ee13;};'use strict';var pdf=require(_0x8351('0x0'));var emlformat=require(_0x8351('0x1'));var rimraf=require(_0x8351('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8351('0x3'));var rp=require(_0x8351('0x4'));var moment=require(_0x8351('0x5'));var BPromise=require(_0x8351('0x6'));var Mustache=require(_0x8351('0x7'));var util=require('util');var path=require(_0x8351('0x8'));var sox=require(_0x8351('0x9'));var csv=require(_0x8351('0xa'));var ejs=require(_0x8351('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8351('0xc'));var crypto=require(_0x8351('0xd'));var jsforce=require(_0x8351('0xe'));var deskjs=require(_0x8351('0xf'));var toCsv=require(_0x8351('0xa'));var querystring=require(_0x8351('0x10'));var Papa=require(_0x8351('0x11'));var Redis=require(_0x8351('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8351('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8351('0x14'));var logger=require('../../config/logger')(_0x8351('0x15'));var utils=require('../../config/utils');var config=require(_0x8351('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8351('0x17'))['db'];function respondWithStatusCode(_0x45e7e4,_0x32f509){_0x32f509=_0x32f509||0xcc;return function(_0x55b8a7){if(_0x55b8a7){return _0x45e7e4[_0x8351('0x18')](_0x32f509);}return _0x45e7e4[_0x8351('0x19')](_0x32f509)[_0x8351('0x1a')]();};}function respondWithResult(_0x295e43,_0x5be0fa){_0x5be0fa=_0x5be0fa||0xc8;return function(_0x17aa72){if(_0x17aa72){return _0x295e43['status'](_0x5be0fa)[_0x8351('0x1b')](_0x17aa72);}};}function respondWithFilteredResult(_0x5c9be3,_0x203b9){return function(_0x4c4bf2){if(_0x4c4bf2){var _0x52416a=_0x4c4bf2[_0x8351('0x1c')],_0x528a93=_0x203b9[_0x8351('0x1d')],_0xeb12a9=_0x203b9[_0x8351('0x1d')]+_0x203b9[_0x8351('0x1e')],_0xfa6f25;if(_0xeb12a9>=_0x52416a){_0xeb12a9=_0x52416a;_0xfa6f25=0xc8;}else{_0xfa6f25=0xce;}_0x5c9be3[_0x8351('0x19')](_0xfa6f25);return _0x5c9be3['set'](_0x8351('0x1f'),_0x528a93+'-'+_0xeb12a9+'/'+_0x52416a)['json'](_0x4c4bf2);}return null;};}function patchUpdates(_0x7b87a){return function(_0x3bdceb){try{jsonpatch[_0x8351('0x20')](_0x3bdceb,_0x7b87a,!![]);}catch(_0x5ac99a){return BPromise[_0x8351('0x21')](_0x5ac99a);}return _0x3bdceb['save']();};}function saveUpdates(_0x253951,_0x33f16d){return function(_0x3292fa){if(_0x3292fa){return _0x3292fa[_0x8351('0x22')](_0x253951)[_0x8351('0x23')](function(_0x1d96a2){return _0x1d96a2;});}return null;};}function removeEntity(_0x5f3822,_0xb1ee54){return function(_0x22e2cf){if(_0x22e2cf){return _0x22e2cf[_0x8351('0x24')]()[_0x8351('0x23')](function(){_0x5f3822[_0x8351('0x19')](0xcc)[_0x8351('0x1a')]();});}};}function handleEntityNotFound(_0x180e06,_0x25b4d9){return function(_0x1a11fe){if(!_0x1a11fe){_0x180e06[_0x8351('0x18')](0x194);}return _0x1a11fe;};}function handleError(_0x284380,_0x321287){_0x321287=_0x321287||0x1f4;return function(_0x446947){logger[_0x8351('0x25')](_0x446947[_0x8351('0x26')]);if(_0x446947[_0x8351('0x27')]){delete _0x446947['name'];}_0x284380[_0x8351('0x19')](_0x321287)[_0x8351('0x28')](_0x446947);};}exports[_0x8351('0x22')]=function(_0x41e78d,_0x407253){if(_0x41e78d[_0x8351('0x29')]['id']){delete _0x41e78d[_0x8351('0x29')]['id'];}return db['Condition'][_0x8351('0x2a')]({'where':{'id':_0x41e78d[_0x8351('0x2b')]['id']}})['then'](handleEntityNotFound(_0x407253,null))[_0x8351('0x23')](saveUpdates(_0x41e78d[_0x8351('0x29')],null))['then'](respondWithResult(_0x407253,null))['catch'](handleError(_0x407253,null));};exports[_0x8351('0x24')]=function(_0x54593c,_0x7e7a30){return db['Condition'][_0x8351('0x2a')]({'where':{'id':_0x54593c[_0x8351('0x2b')]['id']}})[_0x8351('0x23')](handleEntityNotFound(_0x7e7a30,null))[_0x8351('0x23')](removeEntity(_0x7e7a30,null))[_0x8351('0x2c')](handleError(_0x7e7a30,null));}; \ No newline at end of file +var _0x8577=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','body','Condition','params','catch','find'];(function(_0x33466c,_0x18db25){var _0x524eda=function(_0x177d34){while(--_0x177d34){_0x33466c['push'](_0x33466c['shift']());}};_0x524eda(++_0x18db25);}(_0x8577,0x90));var _0x7857=function(_0x2b8705,_0x128bac){_0x2b8705=_0x2b8705-0x0;var _0x5d74d3=_0x8577[_0x2b8705];return _0x5d74d3;};'use strict';var pdf=require(_0x7857('0x0'));var emlformat=require(_0x7857('0x1'));var rimraf=require(_0x7857('0x2'));var zipdir=require(_0x7857('0x3'));var jsonpatch=require(_0x7857('0x4'));var rp=require('request-promise');var moment=require(_0x7857('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7857('0x6'));var util=require(_0x7857('0x7'));var path=require('path');var sox=require(_0x7857('0x8'));var csv=require('to-csv');var ejs=require(_0x7857('0x9'));var fs=require('fs');var _=require(_0x7857('0xa'));var squel=require(_0x7857('0xb'));var crypto=require(_0x7857('0xc'));var jsforce=require(_0x7857('0xd'));var deskjs=require(_0x7857('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7857('0xf'));var Redis=require(_0x7857('0x10'));var authService=require(_0x7857('0x11'));var qs=require(_0x7857('0x12'));var as=require(_0x7857('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7857('0x14'))(_0x7857('0x15'));var utils=require(_0x7857('0x16'));var config=require(_0x7857('0x17'));var licenseUtil=require(_0x7857('0x18'));var db=require(_0x7857('0x19'))['db'];function respondWithStatusCode(_0xcd036e,_0x49f8c8){_0x49f8c8=_0x49f8c8||0xcc;return function(_0x282b33){if(_0x282b33){return _0xcd036e['sendStatus'](_0x49f8c8);}return _0xcd036e[_0x7857('0x1a')](_0x49f8c8)[_0x7857('0x1b')]();};}function respondWithResult(_0x360e15,_0x217403){_0x217403=_0x217403||0xc8;return function(_0x4743d3){if(_0x4743d3){return _0x360e15[_0x7857('0x1a')](_0x217403)['json'](_0x4743d3);}};}function respondWithFilteredResult(_0x8f2e77,_0x5326c7){return function(_0x434544){if(_0x434544){var _0xb36c3a=_0x434544[_0x7857('0x1c')],_0x303e90=_0x5326c7[_0x7857('0x1d')],_0x1e1da4=_0x5326c7[_0x7857('0x1d')]+_0x5326c7[_0x7857('0x1e')],_0x3f5220;if(_0x1e1da4>=_0xb36c3a){_0x1e1da4=_0xb36c3a;_0x3f5220=0xc8;}else{_0x3f5220=0xce;}_0x8f2e77['status'](_0x3f5220);return _0x8f2e77[_0x7857('0x1f')](_0x7857('0x20'),_0x303e90+'-'+_0x1e1da4+'/'+_0xb36c3a)[_0x7857('0x21')](_0x434544);}return null;};}function patchUpdates(_0x161761){return function(_0x362130){try{jsonpatch[_0x7857('0x22')](_0x362130,_0x161761,!![]);}catch(_0x520f70){return BPromise[_0x7857('0x23')](_0x520f70);}return _0x362130['save']();};}function saveUpdates(_0x1c93bf,_0x4c5663){return function(_0x31f276){if(_0x31f276){return _0x31f276[_0x7857('0x24')](_0x1c93bf)[_0x7857('0x25')](function(_0x24d08c){return _0x24d08c;});}return null;};}function removeEntity(_0x3eba1d,_0x941ecf){return function(_0x5b03f7){if(_0x5b03f7){return _0x5b03f7[_0x7857('0x26')]()[_0x7857('0x25')](function(){_0x3eba1d[_0x7857('0x1a')](0xcc)[_0x7857('0x1b')]();});}};}function handleEntityNotFound(_0xc462f0,_0x153751){return function(_0x13a881){if(!_0x13a881){_0xc462f0[_0x7857('0x27')](0x194);}return _0x13a881;};}function handleError(_0x34ba4d,_0x345192){_0x345192=_0x345192||0x1f4;return function(_0x11ed9f){logger[_0x7857('0x28')](_0x11ed9f[_0x7857('0x29')]);if(_0x11ed9f['name']){delete _0x11ed9f[_0x7857('0x2a')];}_0x34ba4d[_0x7857('0x1a')](_0x345192)['send'](_0x11ed9f);};}exports[_0x7857('0x24')]=function(_0xe414ca,_0x203c7c){if(_0xe414ca[_0x7857('0x2b')]['id']){delete _0xe414ca['body']['id'];}return db[_0x7857('0x2c')]['find']({'where':{'id':_0xe414ca[_0x7857('0x2d')]['id']}})[_0x7857('0x25')](handleEntityNotFound(_0x203c7c,null))['then'](saveUpdates(_0xe414ca['body'],null))[_0x7857('0x25')](respondWithResult(_0x203c7c,null))[_0x7857('0x2e')](handleError(_0x203c7c,null));};exports[_0x7857('0x26')]=function(_0x5ae448,_0x598988){return db[_0x7857('0x2c')][_0x7857('0x2f')]({'where':{'id':_0x5ae448[_0x7857('0x2d')]['id']}})[_0x7857('0x25')](handleEntityNotFound(_0x598988,null))[_0x7857('0x25')](removeEntity(_0x598988,null))[_0x7857('0x2e')](handleError(_0x598988,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 5aeaf59..56a7d25 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 _0xfec3=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','lodash'];(function(_0x652209,_0x243c43){var _0x443cbc=function(_0x1135cd){while(--_0x1135cd){_0x652209['push'](_0x652209['shift']());}};_0x443cbc(++_0x243c43);}(_0xfec3,0x12a));var _0x3fec=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xfec3[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3fec('0x0'));var util=require(_0x3fec('0x1'));var logger=require(_0x3fec('0x2'))(_0x3fec('0x3'));var moment=require(_0x3fec('0x4'));var BPromise=require(_0x3fec('0x5'));var rp=require(_0x3fec('0x6'));var fs=require('fs');var path=require(_0x3fec('0x7'));var rimraf=require('rimraf');var config=require(_0x3fec('0x8'));var attributes=require(_0x3fec('0x9'));module[_0x3fec('0xa')]=function(_0x153e9f,_0x2e039d){return _0x153e9f[_0x3fec('0xb')](_0x3fec('0xc'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf930=['bluebird','request-promise','path','../../config/environment','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','moment'];(function(_0x180c05,_0x53bb61){var _0x5da11a=function(_0x230b7d){while(--_0x230b7d){_0x180c05['push'](_0x180c05['shift']());}};_0x5da11a(++_0x53bb61);}(_0xf930,0xec));var _0x0f93=function(_0x55cc6a,_0x5dbd65){_0x55cc6a=_0x55cc6a-0x0;var _0x26e2cd=_0xf930[_0x55cc6a];return _0x26e2cd;};'use strict';var _=require(_0x0f93('0x0'));var util=require(_0x0f93('0x1'));var logger=require(_0x0f93('0x2'))('api');var moment=require(_0x0f93('0x3'));var BPromise=require(_0x0f93('0x4'));var rp=require(_0x0f93('0x5'));var fs=require('fs');var path=require(_0x0f93('0x6'));var rimraf=require('rimraf');var config=require(_0x0f93('0x7'));var attributes=require('./condition.attributes');module[_0x0f93('0x8')]=function(_0x53a4b2,_0x1ae7e3){return _0x53a4b2[_0x0f93('0x9')](_0x0f93('0xa'),attributes,{'tableName':_0x0f93('0xb'),'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 31482cd..9e06d43 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 _0xccb9=['request','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x20c3d1,_0x48c3ba){var _0x3e5849=function(_0x5a7b4c){while(--_0x5a7b4c){_0x20c3d1['push'](_0x20c3d1['shift']());}};_0x3e5849(++_0x48c3ba);}(_0xccb9,0x79));var _0x9ccb=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xccb9[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x9ccb('0x0'));var util=require(_0x9ccb('0x1'));var moment=require(_0x9ccb('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ccb('0x3'));var fs=require('fs');var Redis=require(_0x9ccb('0x4'));var db=require(_0x9ccb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ccb('0x6'))(_0x9ccb('0x7'));var config=require('../../config/environment');var jayson=require(_0x9ccb('0x8'));var client=jayson[_0x9ccb('0x9')][_0x9ccb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x380f4e,_0x567e4a,_0x429bd4){return new BPromise(function(_0xca438c,_0x5263c8){return client[_0x9ccb('0xb')](_0x380f4e,_0x429bd4)[_0x9ccb('0xc')](function(_0x10f6fd){logger[_0x9ccb('0xd')](_0x9ccb('0xe'),_0x567e4a,_0x9ccb('0xf'));logger['debug'](_0x9ccb('0x10'),_0x567e4a,_0x9ccb('0xf'),JSON[_0x9ccb('0x11')](_0x10f6fd));if(_0x10f6fd['error']){if(_0x10f6fd[_0x9ccb('0x12')][_0x9ccb('0x13')]===0x1f4){logger[_0x9ccb('0x12')](_0x9ccb('0xe'),_0x567e4a,_0x10f6fd[_0x9ccb('0x12')][_0x9ccb('0x14')]);return _0x5263c8(_0x10f6fd[_0x9ccb('0x12')][_0x9ccb('0x14')]);}logger[_0x9ccb('0x12')](_0x9ccb('0xe'),_0x567e4a,_0x10f6fd[_0x9ccb('0x12')][_0x9ccb('0x14')]);return _0xca438c(_0x10f6fd[_0x9ccb('0x12')][_0x9ccb('0x14')]);}else{logger[_0x9ccb('0xd')]('Condition,\x20%s,\x20%s',_0x567e4a,_0x9ccb('0xf'));_0xca438c(_0x10f6fd['result'][_0x9ccb('0x14')]);}})[_0x9ccb('0x15')](function(_0x5559fe){logger[_0x9ccb('0x12')](_0x9ccb('0xe'),_0x567e4a,_0x5559fe);_0x5263c8(_0x5559fe);});});} \ No newline at end of file +var _0x94cd=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3b3f7b,_0x55d57a){var _0x3487d0=function(_0x17df6b){while(--_0x17df6b){_0x3b3f7b['push'](_0x3b3f7b['shift']());}};_0x3487d0(++_0x55d57a);}(_0x94cd,0x91));var _0xd94c=function(_0xbb64e8,_0x375452){_0xbb64e8=_0xbb64e8-0x0;var _0x311389=_0x94cd[_0xbb64e8];return _0x311389;};'use strict';var _=require(_0xd94c('0x0'));var util=require(_0xd94c('0x1'));var moment=require(_0xd94c('0x2'));var BPromise=require(_0xd94c('0x3'));var rs=require(_0xd94c('0x4'));var fs=require('fs');var Redis=require(_0xd94c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd94c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd94c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59dd73,_0x58b60b,_0x5c262c){return new BPromise(function(_0x10819a,_0x120037){return client[_0xd94c('0x8')](_0x59dd73,_0x5c262c)[_0xd94c('0x9')](function(_0x2fd5fa){logger[_0xd94c('0xa')](_0xd94c('0xb'),_0x58b60b,'request\x20sent');logger[_0xd94c('0xc')](_0xd94c('0xd'),_0x58b60b,_0xd94c('0xe'),JSON['stringify'](_0x2fd5fa));if(_0x2fd5fa[_0xd94c('0xf')]){if(_0x2fd5fa[_0xd94c('0xf')][_0xd94c('0x10')]===0x1f4){logger['error'](_0xd94c('0xb'),_0x58b60b,_0x2fd5fa[_0xd94c('0xf')][_0xd94c('0x11')]);return _0x120037(_0x2fd5fa[_0xd94c('0xf')][_0xd94c('0x11')]);}logger['error'](_0xd94c('0xb'),_0x58b60b,_0x2fd5fa[_0xd94c('0xf')]['message']);return _0x10819a(_0x2fd5fa[_0xd94c('0xf')]['message']);}else{logger['info']('Condition,\x20%s,\x20%s',_0x58b60b,'request\x20sent');_0x10819a(_0x2fd5fa[_0xd94c('0x12')][_0xd94c('0x11')]);}})[_0xd94c('0x13')](function(_0x1447a0){logger['error'](_0xd94c('0xb'),_0x58b60b,_0x1447a0);_0x120037(_0x1447a0);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e316ae1..bbd5a8d 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 _0x5f1f=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','destroy','exports'];(function(_0x26f113,_0x4b01c9){var _0x4eb310=function(_0x5d7e62){while(--_0x5d7e62){_0x26f113['push'](_0x26f113['shift']());}};_0x4eb310(++_0x4b01c9);}(_0x5f1f,0x16c));var _0xf5f1=function(_0x2a9153,_0x44fd73){_0x2a9153=_0x2a9153-0x0;var _0x2f6615=_0x5f1f[_0x2a9153];return _0x2f6615;};'use strict';var multer=require('multer');var util=require(_0xf5f1('0x0'));var path=require('path');var timeout=require(_0xf5f1('0x1'));var express=require(_0xf5f1('0x2'));var router=express[_0xf5f1('0x3')]();var auth=require(_0xf5f1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf5f1('0x5'));var controller=require(_0xf5f1('0x6'));router[_0xf5f1('0x7')](_0xf5f1('0x8'),auth['isAuthenticated'](),controller[_0xf5f1('0x9')]);router[_0xf5f1('0xa')](_0xf5f1('0x8'),auth[_0xf5f1('0xb')](),controller[_0xf5f1('0xc')]);module[_0xf5f1('0xd')]=router; \ No newline at end of file +var _0xf5b2=['isAuthenticated','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update'];(function(_0x41c0b3,_0x57ecf5){var _0x3dedc1=function(_0x39031e){while(--_0x39031e){_0x41c0b3['push'](_0x41c0b3['shift']());}};_0x3dedc1(++_0x57ecf5);}(_0xf5b2,0xd5));var _0x2f5b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf5b2[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x2f5b('0x0'));var path=require(_0x2f5b('0x1'));var timeout=require(_0x2f5b('0x2'));var express=require(_0x2f5b('0x3'));var router=express[_0x2f5b('0x4')]();var auth=require(_0x2f5b('0x5'));var interaction=require(_0x2f5b('0x6'));var config=require(_0x2f5b('0x7'));var controller=require(_0x2f5b('0x8'));router[_0x2f5b('0x9')](_0x2f5b('0xa'),auth['isAuthenticated'](),controller[_0x2f5b('0xb')]);router['delete'](_0x2f5b('0xa'),auth[_0x2f5b('0xc')](),controller[_0x2f5b('0xd')]);module[_0x2f5b('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 26b3609..94e845f 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 _0x9a19=['sequelize','exports','STRING','INTEGER'];(function(_0x1fbe59,_0x45dd45){var _0x315b32=function(_0x403fe){while(--_0x403fe){_0x1fbe59['push'](_0x1fbe59['shift']());}};_0x315b32(++_0x45dd45);}(_0x9a19,0x114));var _0x99a1=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x9a19[_0x5eaa0b];return _0x28b295;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'name':{'type':Sequelize[_0x99a1('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x99a1('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x99a1('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xda65=['sequelize','exports','STRING','INTEGER'];(function(_0x45abdf,_0x13c99b){var _0x523395=function(_0x34eb26){while(--_0x34eb26){_0x45abdf['push'](_0x45abdf['shift']());}};_0x523395(++_0x13c99b);}(_0xda65,0x1d0));var _0x5da6=function(_0x445c13,_0xef3ccc){_0x445c13=_0x445c13-0x0;var _0x40cf5a=_0xda65[_0x445c13];return _0x40cf5a;};'use strict';var Sequelize=require(_0x5da6('0x0'));module[_0x5da6('0x1')]={'name':{'type':Sequelize[_0x5da6('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x5da6('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x5da6('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index cdf06ce..43f96e0 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 _0xea4e=['reject','update','destroy','get','ContactItemTypes','then','error','stack','name','send','index','map','ContactItemType','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','catch','params','rawAttributes','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','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/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply'];(function(_0x1da8f5,_0xc052c4){var _0x2973a4=function(_0x260e37){while(--_0x260e37){_0x1da8f5['push'](_0x1da8f5['shift']());}};_0x2973a4(++_0xc052c4);}(_0xea4e,0x10c));var _0xeea4=function(_0x25292e,_0x44f47f){_0x25292e=_0x25292e-0x0;var _0x48de57=_0xea4e[_0x25292e];return _0x48de57;};'use strict';var pdf=require(_0xeea4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xeea4('0x1'));var rp=require('request-promise');var moment=require(_0xeea4('0x2'));var BPromise=require(_0xeea4('0x3'));var Mustache=require('mustache');var util=require(_0xeea4('0x4'));var path=require(_0xeea4('0x5'));var sox=require(_0xeea4('0x6'));var csv=require(_0xeea4('0x7'));var ejs=require(_0xeea4('0x8'));var fs=require('fs');var _=require(_0xeea4('0x9'));var squel=require(_0xeea4('0xa'));var crypto=require(_0xeea4('0xb'));var jsforce=require(_0xeea4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeea4('0x7'));var querystring=require('querystring');var Papa=require(_0xeea4('0xd'));var Redis=require(_0xeea4('0xe'));var authService=require(_0xeea4('0xf'));var qs=require(_0xeea4('0x10'));var as=require(_0xeea4('0x11'));var hardwareService=require(_0xeea4('0x12'));var logger=require(_0xeea4('0x13'))(_0xeea4('0x14'));var utils=require('../../config/utils');var config=require(_0xeea4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xeea4('0x16'))['db'];function respondWithStatusCode(_0x216785,_0x3c18ed){_0x3c18ed=_0x3c18ed||0xcc;return function(_0x3dbf8c){if(_0x3dbf8c){return _0x216785[_0xeea4('0x17')](_0x3c18ed);}return _0x216785[_0xeea4('0x18')](_0x3c18ed)[_0xeea4('0x19')]();};}function respondWithResult(_0x9d04aa,_0x4d6605){_0x4d6605=_0x4d6605||0xc8;return function(_0x169fc5){if(_0x169fc5){return _0x9d04aa[_0xeea4('0x18')](_0x4d6605)['json'](_0x169fc5);}};}function respondWithFilteredResult(_0x44f13a,_0x4d47b0){return function(_0x2d5a6c){if(_0x2d5a6c){var _0x44f573=_0x2d5a6c[_0xeea4('0x1a')],_0x8b4b62=_0x4d47b0[_0xeea4('0x1b')],_0x12f574=_0x4d47b0[_0xeea4('0x1b')]+_0x4d47b0[_0xeea4('0x1c')],_0x308034;if(_0x12f574>=_0x44f573){_0x12f574=_0x44f573;_0x308034=0xc8;}else{_0x308034=0xce;}_0x44f13a[_0xeea4('0x18')](_0x308034);return _0x44f13a['set'](_0xeea4('0x1d'),_0x8b4b62+'-'+_0x12f574+'/'+_0x44f573)[_0xeea4('0x1e')](_0x2d5a6c);}return null;};}function patchUpdates(_0x5c4e7b){return function(_0x36a9b3){try{jsonpatch[_0xeea4('0x1f')](_0x36a9b3,_0x5c4e7b,!![]);}catch(_0x4c039c){return BPromise[_0xeea4('0x20')](_0x4c039c);}return _0x36a9b3['save']();};}function saveUpdates(_0x3f7316,_0x54cf4d){return function(_0x592e81){if(_0x592e81){return _0x592e81[_0xeea4('0x21')](_0x3f7316)['then'](function(_0x2acc9b){return _0x2acc9b;});}return null;};}function removeEntity(_0x12ba5b,_0x3e162c){return function(_0x19b2a8){if(_0x19b2a8){return _0x19b2a8[_0xeea4('0x22')]()['then'](function(){var _0x3f2cd2=_0x19b2a8[_0xeea4('0x23')]({'plain':!![]});var _0x290983=_0xeea4('0x24');return db['UserProfileResource'][_0xeea4('0x22')]({'where':{'type':_0x290983,'resourceId':_0x3f2cd2['id']}})[_0xeea4('0x25')](function(){return _0x19b2a8;});})[_0xeea4('0x25')](function(){_0x12ba5b[_0xeea4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x594258,_0x1ac8f3){return function(_0x28d8f9){if(!_0x28d8f9){_0x594258[_0xeea4('0x17')](0x194);}return _0x28d8f9;};}function handleError(_0x197573,_0x2ca258){_0x2ca258=_0x2ca258||0x1f4;return function(_0x5b35e1){logger[_0xeea4('0x26')](_0x5b35e1[_0xeea4('0x27')]);if(_0x5b35e1['name']){delete _0x5b35e1[_0xeea4('0x28')];}_0x197573['status'](_0x2ca258)[_0xeea4('0x29')](_0x5b35e1);};}exports[_0xeea4('0x2a')]=function(_0x2eb38c,_0x134f24){var _0x1217b4={},_0x5b651f={},_0x1abc8c={'count':0x0,'rows':[]};var _0x4e68c4=_[_0xeea4('0x2b')](db[_0xeea4('0x2c')]['rawAttributes'],function(_0x48a047){return{'name':_0x48a047['fieldName'],'type':_0x48a047[_0xeea4('0x2d')]['key']};});_0x5b651f[_0xeea4('0x2e')]=_[_0xeea4('0x2b')](_0x4e68c4,_0xeea4('0x28'));_0x5b651f[_0xeea4('0x2f')]=_[_0xeea4('0x30')](_0x2eb38c['query']);_0x5b651f[_0xeea4('0x31')]=_[_0xeea4('0x32')](_0x5b651f[_0xeea4('0x2e')],_0x5b651f['query']);_0x1217b4[_0xeea4('0x33')]=_[_0xeea4('0x32')](_0x5b651f[_0xeea4('0x2e')],qs[_0xeea4('0x34')](_0x2eb38c[_0xeea4('0x2f')][_0xeea4('0x34')]));_0x1217b4[_0xeea4('0x33')]=_0x1217b4[_0xeea4('0x33')][_0xeea4('0x35')]?_0x1217b4[_0xeea4('0x33')]:_0x5b651f['model'];if(!_0x2eb38c['query'][_0xeea4('0x36')](_0xeea4('0x37'))){_0x1217b4[_0xeea4('0x1c')]=qs[_0xeea4('0x1c')](_0x2eb38c[_0xeea4('0x2f')][_0xeea4('0x1c')]);_0x1217b4[_0xeea4('0x1b')]=qs['offset'](_0x2eb38c[_0xeea4('0x2f')][_0xeea4('0x1b')]);}_0x1217b4[_0xeea4('0x38')]=qs['sort'](_0x2eb38c[_0xeea4('0x2f')][_0xeea4('0x39')]);_0x1217b4['where']=qs[_0xeea4('0x31')](_[_0xeea4('0x3a')](_0x2eb38c[_0xeea4('0x2f')],_0x5b651f[_0xeea4('0x31')]),_0x4e68c4);if(_0x2eb38c[_0xeea4('0x2f')][_0xeea4('0x3b')]){_0x1217b4[_0xeea4('0x3c')]=_[_0xeea4('0x3d')](_0x1217b4['where'],{'$or':_[_0xeea4('0x2b')](_0x4e68c4,function(_0x1091a2){if(_0x1091a2['type']!==_0xeea4('0x3e')){var _0x9c419={};_0x9c419[_0x1091a2[_0xeea4('0x28')]]={'$like':'%'+_0x2eb38c[_0xeea4('0x2f')][_0xeea4('0x3b')]+'%'};return _0x9c419;}})});}_0x1217b4=_[_0xeea4('0x3d')]({},_0x1217b4,_0x2eb38c[_0xeea4('0x3f')]);var _0x4ad5e3={'where':_0x1217b4[_0xeea4('0x3c')]};return db[_0xeea4('0x2c')]['count'](_0x4ad5e3)[_0xeea4('0x25')](function(_0x4e2d1c){_0x1abc8c[_0xeea4('0x1a')]=_0x4e2d1c;if(_0x2eb38c[_0xeea4('0x2f')]['includeAll']){_0x1217b4['include']=[{'all':!![]}];}return db[_0xeea4('0x2c')]['findAll'](_0x1217b4);})[_0xeea4('0x25')](function(_0x62d5fc){_0x1abc8c['rows']=_0x62d5fc;return _0x1abc8c;})[_0xeea4('0x25')](respondWithFilteredResult(_0x134f24,_0x1217b4))[_0xeea4('0x40')](handleError(_0x134f24,null));};exports['show']=function(_0xb56e01,_0x13a30c){var _0x1cd6a9={'raw':!![],'where':{'id':_0xb56e01[_0xeea4('0x41')]['id']}},_0xa04588={};_0xa04588[_0xeea4('0x2e')]=_[_0xeea4('0x30')](db['ContactItemType'][_0xeea4('0x42')]);_0xa04588[_0xeea4('0x2f')]=_[_0xeea4('0x30')](_0xb56e01[_0xeea4('0x2f')]);_0xa04588['filters']=_[_0xeea4('0x32')](_0xa04588[_0xeea4('0x2e')],_0xa04588[_0xeea4('0x2f')]);_0x1cd6a9['attributes']=_['intersection'](_0xa04588[_0xeea4('0x2e')],qs[_0xeea4('0x34')](_0xb56e01['query']['fields']));_0x1cd6a9[_0xeea4('0x33')]=_0x1cd6a9[_0xeea4('0x33')][_0xeea4('0x35')]?_0x1cd6a9[_0xeea4('0x33')]:_0xa04588[_0xeea4('0x2e')];if(_0xb56e01['query'][_0xeea4('0x43')]){_0x1cd6a9['include']=[{'all':!![]}];}_0x1cd6a9=_[_0xeea4('0x3d')]({},_0x1cd6a9,_0xb56e01[_0xeea4('0x3f')]);return db[_0xeea4('0x2c')]['find'](_0x1cd6a9)[_0xeea4('0x25')](handleEntityNotFound(_0x13a30c,null))['then'](respondWithResult(_0x13a30c,null))['catch'](handleError(_0x13a30c,null));};exports[_0xeea4('0x44')]=function(_0x111cbd,_0x15461a){return db[_0xeea4('0x2c')]['create'](_0x111cbd['body'],{})[_0xeea4('0x25')](function(_0x18bb53){var _0x208282=_0x111cbd['user'][_0xeea4('0x23')]({'plain':!![]});if(!_0x208282)throw new Error(_0xeea4('0x45'));if(_0x208282['role']==='user'){var _0x47eac8=_0x18bb53[_0xeea4('0x23')]({'plain':!![]});var _0x3a4a27=_0xeea4('0x24');return db[_0xeea4('0x46')][_0xeea4('0x47')]({'where':{'name':_0x3a4a27,'userProfileId':_0x208282[_0xeea4('0x48')]},'raw':!![]})[_0xeea4('0x25')](function(_0x471825){if(_0x471825&&_0x471825['autoAssociation']===0x0){return db['UserProfileResource'][_0xeea4('0x44')]({'name':_0x47eac8['name'],'resourceId':_0x47eac8['id'],'type':_0x471825[_0xeea4('0x28')],'sectionId':_0x471825['id']},{})['then'](function(){return _0x18bb53;});}else{return _0x18bb53;}})[_0xeea4('0x40')](function(_0xfb11fd){logger['error'](_0xeea4('0x49'),_0xfb11fd);throw _0xfb11fd;});}return _0x18bb53;})[_0xeea4('0x25')](respondWithResult(_0x15461a,0xc9))[_0xeea4('0x40')](handleError(_0x15461a,null));};exports['update']=function(_0x23d152,_0x828b){if(_0x23d152[_0xeea4('0x4a')]['id']){delete _0x23d152['body']['id'];}return db[_0xeea4('0x2c')][_0xeea4('0x47')]({'where':{'id':_0x23d152[_0xeea4('0x41')]['id']}})[_0xeea4('0x25')](handleEntityNotFound(_0x828b,null))[_0xeea4('0x25')](saveUpdates(_0x23d152[_0xeea4('0x4a')],null))[_0xeea4('0x25')](respondWithResult(_0x828b,null))[_0xeea4('0x40')](handleError(_0x828b,null));};exports[_0xeea4('0x22')]=function(_0x3862f0,_0x142086){return db[_0xeea4('0x2c')][_0xeea4('0x47')]({'where':{'id':_0x3862f0['params']['id']}})[_0xeea4('0x25')](handleEntityNotFound(_0x142086,null))['then'](removeEntity(_0x142086,null))['catch'](handleError(_0x142086,null));}; \ No newline at end of file +var _0xe9e7=['util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','end','error','stack','name','index','map','type','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','ContactItemType','rawAttributes','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4a14cf,_0x2d4d93){var _0xfba8ad=function(_0x481f5b){while(--_0x481f5b){_0x4a14cf['push'](_0x4a14cf['shift']());}};_0xfba8ad(++_0x2d4d93);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x1f03c5,_0xb326a4){_0x1f03c5=_0x1f03c5-0x0;var _0x5d99f9=_0xe9e7[_0x1f03c5];return _0x5d99f9;};'use strict';var pdf=require(_0x7e9e('0x0'));var emlformat=require(_0x7e9e('0x1'));var rimraf=require(_0x7e9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e9e('0x3'));var rp=require(_0x7e9e('0x4'));var moment=require(_0x7e9e('0x5'));var BPromise=require(_0x7e9e('0x6'));var Mustache=require(_0x7e9e('0x7'));var util=require(_0x7e9e('0x8'));var path=require(_0x7e9e('0x9'));var sox=require('sox');var csv=require(_0x7e9e('0xa'));var ejs=require(_0x7e9e('0xb'));var fs=require('fs');var _=require(_0x7e9e('0xc'));var squel=require('squel');var crypto=require(_0x7e9e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7e9e('0xe'));var toCsv=require(_0x7e9e('0xa'));var querystring=require(_0x7e9e('0xf'));var Papa=require(_0x7e9e('0x10'));var Redis=require(_0x7e9e('0x11'));var authService=require(_0x7e9e('0x12'));var qs=require(_0x7e9e('0x13'));var as=require(_0x7e9e('0x14'));var hardwareService=require(_0x7e9e('0x15'));var logger=require(_0x7e9e('0x16'))(_0x7e9e('0x17'));var utils=require(_0x7e9e('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa5db58,_0x356d5c){_0x356d5c=_0x356d5c||0xcc;return function(_0x245c50){if(_0x245c50){return _0xa5db58[_0x7e9e('0x19')](_0x356d5c);}return _0xa5db58['status'](_0x356d5c)['end']();};}function respondWithResult(_0x2d8de4,_0x46f30d){_0x46f30d=_0x46f30d||0xc8;return function(_0x1b59d1){if(_0x1b59d1){return _0x2d8de4[_0x7e9e('0x1a')](_0x46f30d)[_0x7e9e('0x1b')](_0x1b59d1);}};}function respondWithFilteredResult(_0x89bb24,_0x2cf803){return function(_0x5bf42b){if(_0x5bf42b){var _0x428312=_0x5bf42b[_0x7e9e('0x1c')],_0x4f38d5=_0x2cf803[_0x7e9e('0x1d')],_0x3a1a89=_0x2cf803[_0x7e9e('0x1d')]+_0x2cf803[_0x7e9e('0x1e')],_0xfc5f48;if(_0x3a1a89>=_0x428312){_0x3a1a89=_0x428312;_0xfc5f48=0xc8;}else{_0xfc5f48=0xce;}_0x89bb24[_0x7e9e('0x1a')](_0xfc5f48);return _0x89bb24['set'](_0x7e9e('0x1f'),_0x4f38d5+'-'+_0x3a1a89+'/'+_0x428312)[_0x7e9e('0x1b')](_0x5bf42b);}return null;};}function patchUpdates(_0x573db3){return function(_0x52358b){try{jsonpatch[_0x7e9e('0x20')](_0x52358b,_0x573db3,!![]);}catch(_0x58eef4){return BPromise['reject'](_0x58eef4);}return _0x52358b[_0x7e9e('0x21')]();};}function saveUpdates(_0x5f554d,_0x35914e){return function(_0xf53279){if(_0xf53279){return _0xf53279[_0x7e9e('0x22')](_0x5f554d)[_0x7e9e('0x23')](function(_0xcd3ea0){return _0xcd3ea0;});}return null;};}function removeEntity(_0x206062,_0x18c975){return function(_0x5206df){if(_0x5206df){return _0x5206df[_0x7e9e('0x24')]()[_0x7e9e('0x23')](function(){var _0x1dc4c9=_0x5206df[_0x7e9e('0x25')]({'plain':!![]});var _0x523e5f=_0x7e9e('0x26');return db[_0x7e9e('0x27')][_0x7e9e('0x24')]({'where':{'type':_0x523e5f,'resourceId':_0x1dc4c9['id']}})[_0x7e9e('0x23')](function(){return _0x5206df;});})[_0x7e9e('0x23')](function(){_0x206062[_0x7e9e('0x1a')](0xcc)[_0x7e9e('0x28')]();});}};}function handleEntityNotFound(_0x54f7b5,_0x2b4df6){return function(_0x1e1b1d){if(!_0x1e1b1d){_0x54f7b5[_0x7e9e('0x19')](0x194);}return _0x1e1b1d;};}function handleError(_0x3ca0b5,_0x4e947e){_0x4e947e=_0x4e947e||0x1f4;return function(_0x1b61b4){logger[_0x7e9e('0x29')](_0x1b61b4[_0x7e9e('0x2a')]);if(_0x1b61b4[_0x7e9e('0x2b')]){delete _0x1b61b4['name'];}_0x3ca0b5[_0x7e9e('0x1a')](_0x4e947e)['send'](_0x1b61b4);};}exports[_0x7e9e('0x2c')]=function(_0x266b4a,_0x1726e9){var _0x203415={},_0x12de96={},_0x20e8c7={'count':0x0,'rows':[]};var _0x3ef7a0=_[_0x7e9e('0x2d')](db['ContactItemType']['rawAttributes'],function(_0x2d9c81){return{'name':_0x2d9c81['fieldName'],'type':_0x2d9c81[_0x7e9e('0x2e')][_0x7e9e('0x2f')]};});_0x12de96['model']=_['map'](_0x3ef7a0,_0x7e9e('0x2b'));_0x12de96[_0x7e9e('0x30')]=_['keys'](_0x266b4a['query']);_0x12de96[_0x7e9e('0x31')]=_['intersection'](_0x12de96[_0x7e9e('0x32')],_0x12de96[_0x7e9e('0x30')]);_0x203415['attributes']=_[_0x7e9e('0x33')](_0x12de96[_0x7e9e('0x32')],qs['fields'](_0x266b4a[_0x7e9e('0x30')][_0x7e9e('0x34')]));_0x203415[_0x7e9e('0x35')]=_0x203415[_0x7e9e('0x35')]['length']?_0x203415[_0x7e9e('0x35')]:_0x12de96['model'];if(!_0x266b4a[_0x7e9e('0x30')][_0x7e9e('0x36')](_0x7e9e('0x37'))){_0x203415[_0x7e9e('0x1e')]=qs[_0x7e9e('0x1e')](_0x266b4a[_0x7e9e('0x30')]['limit']);_0x203415[_0x7e9e('0x1d')]=qs['offset'](_0x266b4a[_0x7e9e('0x30')][_0x7e9e('0x1d')]);}_0x203415[_0x7e9e('0x38')]=qs['sort'](_0x266b4a['query']['sort']);_0x203415[_0x7e9e('0x39')]=qs[_0x7e9e('0x31')](_[_0x7e9e('0x3a')](_0x266b4a[_0x7e9e('0x30')],_0x12de96['filters']),_0x3ef7a0);if(_0x266b4a[_0x7e9e('0x30')]['filter']){_0x203415['where']=_[_0x7e9e('0x3b')](_0x203415[_0x7e9e('0x39')],{'$or':_[_0x7e9e('0x2d')](_0x3ef7a0,function(_0x5024e3){if(_0x5024e3[_0x7e9e('0x2e')]!==_0x7e9e('0x3c')){var _0xd604c4={};_0xd604c4[_0x5024e3['name']]={'$like':'%'+_0x266b4a[_0x7e9e('0x30')][_0x7e9e('0x3d')]+'%'};return _0xd604c4;}})});}_0x203415=_[_0x7e9e('0x3b')]({},_0x203415,_0x266b4a[_0x7e9e('0x3e')]);var _0x80ac45={'where':_0x203415['where']};return db['ContactItemType'][_0x7e9e('0x1c')](_0x80ac45)[_0x7e9e('0x23')](function(_0x5b4171){_0x20e8c7[_0x7e9e('0x1c')]=_0x5b4171;if(_0x266b4a[_0x7e9e('0x30')][_0x7e9e('0x3f')]){_0x203415[_0x7e9e('0x40')]=[{'all':!![]}];}return db['ContactItemType'][_0x7e9e('0x41')](_0x203415);})[_0x7e9e('0x23')](function(_0x4e8458){_0x20e8c7[_0x7e9e('0x42')]=_0x4e8458;return _0x20e8c7;})[_0x7e9e('0x23')](respondWithFilteredResult(_0x1726e9,_0x203415))[_0x7e9e('0x43')](handleError(_0x1726e9,null));};exports[_0x7e9e('0x44')]=function(_0x4e8ef3,_0x5337a8){var _0x3a2157={'raw':!![],'where':{'id':_0x4e8ef3[_0x7e9e('0x45')]['id']}},_0x3eba14={};_0x3eba14[_0x7e9e('0x32')]=_['keys'](db[_0x7e9e('0x46')][_0x7e9e('0x47')]);_0x3eba14[_0x7e9e('0x30')]=_[_0x7e9e('0x48')](_0x4e8ef3['query']);_0x3eba14['filters']=_['intersection'](_0x3eba14[_0x7e9e('0x32')],_0x3eba14[_0x7e9e('0x30')]);_0x3a2157[_0x7e9e('0x35')]=_[_0x7e9e('0x33')](_0x3eba14[_0x7e9e('0x32')],qs[_0x7e9e('0x34')](_0x4e8ef3[_0x7e9e('0x30')]['fields']));_0x3a2157[_0x7e9e('0x35')]=_0x3a2157[_0x7e9e('0x35')][_0x7e9e('0x49')]?_0x3a2157['attributes']:_0x3eba14['model'];if(_0x4e8ef3[_0x7e9e('0x30')][_0x7e9e('0x3f')]){_0x3a2157[_0x7e9e('0x40')]=[{'all':!![]}];}_0x3a2157=_[_0x7e9e('0x3b')]({},_0x3a2157,_0x4e8ef3[_0x7e9e('0x3e')]);return db[_0x7e9e('0x46')][_0x7e9e('0x4a')](_0x3a2157)[_0x7e9e('0x23')](handleEntityNotFound(_0x5337a8,null))[_0x7e9e('0x23')](respondWithResult(_0x5337a8,null))[_0x7e9e('0x43')](handleError(_0x5337a8,null));};exports[_0x7e9e('0x4b')]=function(_0x23aa3c,_0x10f92e){return db['ContactItemType'][_0x7e9e('0x4b')](_0x23aa3c[_0x7e9e('0x4c')],{})[_0x7e9e('0x23')](function(_0x26dc29){var _0x284750=_0x23aa3c[_0x7e9e('0x4d')][_0x7e9e('0x25')]({'plain':!![]});if(!_0x284750)throw new Error(_0x7e9e('0x4e'));if(_0x284750[_0x7e9e('0x4f')]===_0x7e9e('0x4d')){var _0x4cdcb4=_0x26dc29[_0x7e9e('0x25')]({'plain':!![]});var _0x910787='ContactItemTypes';return db[_0x7e9e('0x50')][_0x7e9e('0x4a')]({'where':{'name':_0x910787,'userProfileId':_0x284750[_0x7e9e('0x51')]},'raw':!![]})[_0x7e9e('0x23')](function(_0x3071ec){if(_0x3071ec&&_0x3071ec[_0x7e9e('0x52')]===0x0){return db[_0x7e9e('0x27')][_0x7e9e('0x4b')]({'name':_0x4cdcb4[_0x7e9e('0x2b')],'resourceId':_0x4cdcb4['id'],'type':_0x3071ec[_0x7e9e('0x2b')],'sectionId':_0x3071ec['id']},{})[_0x7e9e('0x23')](function(){return _0x26dc29;});}else{return _0x26dc29;}})['catch'](function(_0x355ad4){logger[_0x7e9e('0x29')](_0x7e9e('0x53'),_0x355ad4);throw _0x355ad4;});}return _0x26dc29;})['then'](respondWithResult(_0x10f92e,0xc9))[_0x7e9e('0x43')](handleError(_0x10f92e,null));};exports[_0x7e9e('0x22')]=function(_0x117fa8,_0x3b5778){if(_0x117fa8[_0x7e9e('0x4c')]['id']){delete _0x117fa8[_0x7e9e('0x4c')]['id'];}return db[_0x7e9e('0x46')][_0x7e9e('0x4a')]({'where':{'id':_0x117fa8[_0x7e9e('0x45')]['id']}})[_0x7e9e('0x23')](handleEntityNotFound(_0x3b5778,null))[_0x7e9e('0x23')](saveUpdates(_0x117fa8[_0x7e9e('0x4c')],null))['then'](respondWithResult(_0x3b5778,null))[_0x7e9e('0x43')](handleError(_0x3b5778,null));};exports[_0x7e9e('0x24')]=function(_0x23ec62,_0x1870a1){return db[_0x7e9e('0x46')][_0x7e9e('0x4a')]({'where':{'id':_0x23ec62[_0x7e9e('0x45')]['id']}})['then'](handleEntityNotFound(_0x1870a1,null))[_0x7e9e('0x23')](removeEntity(_0x1870a1,null))['catch'](handleError(_0x1870a1,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index f22d3e1..2f74673 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 _0x4677=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define'];(function(_0x34c542,_0x220b05){var _0x5b9ec2=function(_0x51dc4f){while(--_0x51dc4f){_0x34c542['push'](_0x34c542['shift']());}};_0x5b9ec2(++_0x220b05);}(_0x4677,0x155));var _0x7467=function(_0x59a2f1,_0x3281d4){_0x59a2f1=_0x59a2f1-0x0;var _0xee03b3=_0x4677[_0x59a2f1];return _0xee03b3;};'use strict';var _=require(_0x7467('0x0'));var util=require('util');var logger=require(_0x7467('0x1'))(_0x7467('0x2'));var moment=require(_0x7467('0x3'));var BPromise=require('bluebird');var rp=require(_0x7467('0x4'));var fs=require('fs');var path=require(_0x7467('0x5'));var rimraf=require(_0x7467('0x6'));var config=require(_0x7467('0x7'));var attributes=require(_0x7467('0x8'));module[_0x7467('0x9')]=function(_0x36fc81,_0x40a9c6){return _0x36fc81[_0x7467('0xa')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5078=['rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x5078,0x148));var _0x8507=function(_0x12b294,_0x192e53){_0x12b294=_0x12b294-0x0;var _0x7b92cb=_0x5078[_0x12b294];return _0x7b92cb;};'use strict';var _=require(_0x8507('0x0'));var util=require(_0x8507('0x1'));var logger=require(_0x8507('0x2'))(_0x8507('0x3'));var moment=require(_0x8507('0x4'));var BPromise=require(_0x8507('0x5'));var rp=require(_0x8507('0x6'));var fs=require('fs');var path=require(_0x8507('0x7'));var rimraf=require(_0x8507('0x8'));var config=require(_0x8507('0x9'));var attributes=require(_0x8507('0xa'));module[_0x8507('0xb')]=function(_0x37519c,_0x5a359c){return _0x37519c[_0x8507('0xc')](_0x8507('0xd'),attributes,{'tableName':'tools_contact_item_types','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 a674c10..6217553 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 _0x8c38=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash'];(function(_0x486ab6,_0x257c0a){var _0x1ce5ea=function(_0x1443a5){while(--_0x1443a5){_0x486ab6['push'](_0x486ab6['shift']());}};_0x1ce5ea(++_0x257c0a);}(_0x8c38,0x83));var _0x88c3=function(_0x92a92f,_0x43b003){_0x92a92f=_0x92a92f-0x0;var _0x2174d8=_0x8c38[_0x92a92f];return _0x2174d8;};'use strict';var _=require(_0x88c3('0x0'));var util=require(_0x88c3('0x1'));var moment=require('moment');var BPromise=require(_0x88c3('0x2'));var rs=require(_0x88c3('0x3'));var fs=require('fs');var Redis=require(_0x88c3('0x4'));var db=require(_0x88c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x88c3('0x6'))(_0x88c3('0x7'));var config=require(_0x88c3('0x8'));var jayson=require(_0x88c3('0x9'));var client=jayson[_0x88c3('0xa')][_0x88c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcdbc28,_0x25e385,_0x5020c9){return new BPromise(function(_0x350a11,_0x4efd63){return client[_0x88c3('0xc')](_0xcdbc28,_0x5020c9)['then'](function(_0x760391){logger['info'](_0x88c3('0xd'),_0x25e385,_0x88c3('0xe'));logger[_0x88c3('0xf')](_0x88c3('0x10'),_0x25e385,'request\x20sent',JSON[_0x88c3('0x11')](_0x760391));if(_0x760391[_0x88c3('0x12')]){if(_0x760391[_0x88c3('0x12')]['code']===0x1f4){logger[_0x88c3('0x12')]('ContactItemType,\x20%s,\x20%s',_0x25e385,_0x760391['error'][_0x88c3('0x13')]);return _0x4efd63(_0x760391[_0x88c3('0x12')][_0x88c3('0x13')]);}logger[_0x88c3('0x12')](_0x88c3('0xd'),_0x25e385,_0x760391['error'][_0x88c3('0x13')]);return _0x350a11(_0x760391[_0x88c3('0x12')][_0x88c3('0x13')]);}else{logger[_0x88c3('0x14')]('ContactItemType,\x20%s,\x20%s',_0x25e385,_0x88c3('0xe'));_0x350a11(_0x760391['result'][_0x88c3('0x13')]);}})[_0x88c3('0x15')](function(_0x26019e){logger[_0x88c3('0x12')]('ContactItemType,\x20%s,\x20%s',_0x25e385,_0x26019e);_0x4efd63(_0x26019e);});});} \ No newline at end of file +var _0x559a=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x23fcde,_0x3c700b){var _0x5d34e6=function(_0x48911b){while(--_0x48911b){_0x23fcde['push'](_0x23fcde['shift']());}};_0x5d34e6(++_0x3c700b);}(_0x559a,0xb3));var _0xa559=function(_0x18d5c7,_0x4c63a7){_0x18d5c7=_0x18d5c7-0x0;var _0xc022c9=_0x559a[_0x18d5c7];return _0xc022c9;};'use strict';var _=require(_0xa559('0x0'));var util=require(_0xa559('0x1'));var moment=require('moment');var BPromise=require(_0xa559('0x2'));var rs=require(_0xa559('0x3'));var fs=require('fs');var Redis=require(_0xa559('0x4'));var db=require(_0xa559('0x5'))['db'];var utils=require(_0xa559('0x6'));var logger=require(_0xa559('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa559('0x8'));var client=jayson[_0xa559('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2edab4,_0x1a5cec,_0x4eada1){return new BPromise(function(_0xb8055,_0x218e3b){return client[_0xa559('0xa')](_0x2edab4,_0x4eada1)[_0xa559('0xb')](function(_0x48aa9a){logger[_0xa559('0xc')](_0xa559('0xd'),_0x1a5cec,_0xa559('0xe'));logger[_0xa559('0xf')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1a5cec,'request\x20sent',JSON[_0xa559('0x10')](_0x48aa9a));if(_0x48aa9a[_0xa559('0x11')]){if(_0x48aa9a['error'][_0xa559('0x12')]===0x1f4){logger['error'](_0xa559('0xd'),_0x1a5cec,_0x48aa9a['error'][_0xa559('0x13')]);return _0x218e3b(_0x48aa9a[_0xa559('0x11')][_0xa559('0x13')]);}logger['error'](_0xa559('0xd'),_0x1a5cec,_0x48aa9a[_0xa559('0x11')]['message']);return _0xb8055(_0x48aa9a[_0xa559('0x11')][_0xa559('0x13')]);}else{logger[_0xa559('0xc')](_0xa559('0xd'),_0x1a5cec,'request\x20sent');_0xb8055(_0x48aa9a[_0xa559('0x14')]['message']);}})[_0xa559('0x15')](function(_0x1387b6){logger['error'](_0xa559('0xd'),_0x1a5cec,_0x1387b6);_0x218e3b(_0x1387b6);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 889d2b4..3c89e0d 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 _0xb27f=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0xb27f,0x13d));var _0xfb27=function(_0x4f61c8,_0x431d2f){_0x4f61c8=_0x4f61c8-0x0;var _0x14a5d6=_0xb27f[_0x4f61c8];return _0x14a5d6;};'use strict';var multer=require(_0xfb27('0x0'));var util=require(_0xfb27('0x1'));var path=require(_0xfb27('0x2'));var timeout=require(_0xfb27('0x3'));var express=require(_0xfb27('0x4'));var router=express['Router']();var auth=require(_0xfb27('0x5'));var interaction=require(_0xfb27('0x6'));var config=require(_0xfb27('0x7'));var controller=require(_0xfb27('0x8'));router[_0xfb27('0x9')]('/',auth[_0xfb27('0xa')](),controller['index']);router['get'](_0xfb27('0xb'),auth[_0xfb27('0xa')](),controller[_0xfb27('0xc')]);router[_0xfb27('0xd')]('/',auth['isAuthenticated'](),controller[_0xfb27('0xe')]);router[_0xfb27('0xf')](_0xfb27('0xb'),auth[_0xfb27('0xa')](),controller[_0xfb27('0x10')]);router[_0xfb27('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xfb27('0x12')]);module[_0xfb27('0x13')]=router; \ No newline at end of file +var _0x369b=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path'];(function(_0x4e34bf,_0x40babb){var _0x3aa30c=function(_0x42564f){while(--_0x42564f){_0x4e34bf['push'](_0x4e34bf['shift']());}};_0x3aa30c(++_0x40babb);}(_0x369b,0x82));var _0xb369=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x369b[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0xb369('0x0'));var util=require(_0xb369('0x1'));var path=require(_0xb369('0x2'));var timeout=require(_0xb369('0x3'));var express=require(_0xb369('0x4'));var router=express[_0xb369('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb369('0x6'));var config=require(_0xb369('0x7'));var controller=require(_0xb369('0x8'));router[_0xb369('0x9')]('/',auth[_0xb369('0xa')](),controller[_0xb369('0xb')]);router['get'](_0xb369('0xc'),auth[_0xb369('0xa')](),controller[_0xb369('0xd')]);router[_0xb369('0xe')]('/',auth[_0xb369('0xa')](),controller[_0xb369('0xf')]);router['put'](_0xb369('0xc'),auth[_0xb369('0xa')](),controller[_0xb369('0x10')]);router['delete']('/:id',auth[_0xb369('0xa')](),controller[_0xb369('0x11')]);module[_0xb369('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 492b5df..0f88755 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 _0xafbf=['name','STRING','exports'];(function(_0x2bc664,_0x190d17){var _0x1e417d=function(_0x193336){while(--_0x193336){_0x2bc664['push'](_0x2bc664['shift']());}};_0x1e417d(++_0x190d17);}(_0xafbf,0x65));var _0xfafb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xafbf[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0xfafb('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfafb('0x1')},'description':{'type':Sequelize[_0xfafb('0x2')]}}; \ No newline at end of file +var _0x48e3=['exports','name','sequelize'];(function(_0x2ba94d,_0xe72e7f){var _0x30d771=function(_0x55a506){while(--_0x55a506){_0x2ba94d['push'](_0x2ba94d['shift']());}};_0x30d771(++_0xe72e7f);}(_0x48e3,0xe9));var _0x348e=function(_0x304654,_0x5043c2){_0x304654=_0x304654-0x0;var _0x595362=_0x48e3[_0x304654];return _0x595362;};'use strict';var Sequelize=require(_0x348e('0x0'));module[_0x348e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x348e('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 30c6a0c..ad9ecd7 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 _0x81f9=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','CustomDashboards','UserProfileResource','stack','name','send','index','map','Dashboard','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','length','omit','createdAt','updatedAt','body','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','order','pick','getItems','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0x81f9,0x1e8));var _0x981f=function(_0x396aba,_0x3ef523){_0x396aba=_0x396aba-0x0;var _0x74213e=_0x81f9[_0x396aba];return _0x74213e;};'use strict';var pdf=require(_0x981f('0x0'));var emlformat=require(_0x981f('0x1'));var rimraf=require(_0x981f('0x2'));var zipdir=require(_0x981f('0x3'));var jsonpatch=require(_0x981f('0x4'));var rp=require(_0x981f('0x5'));var moment=require('moment');var BPromise=require(_0x981f('0x6'));var Mustache=require(_0x981f('0x7'));var util=require('util');var path=require(_0x981f('0x8'));var sox=require(_0x981f('0x9'));var csv=require(_0x981f('0xa'));var ejs=require(_0x981f('0xb'));var fs=require('fs');var _=require(_0x981f('0xc'));var squel=require(_0x981f('0xd'));var crypto=require(_0x981f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x981f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x981f('0x10'));var Papa=require(_0x981f('0x11'));var Redis=require(_0x981f('0x12'));var authService=require(_0x981f('0x13'));var qs=require(_0x981f('0x14'));var as=require(_0x981f('0x15'));var hardwareService=require(_0x981f('0x16'));var logger=require(_0x981f('0x17'))(_0x981f('0x18'));var utils=require(_0x981f('0x19'));var config=require(_0x981f('0x1a'));var licenseUtil=require(_0x981f('0x1b'));var db=require(_0x981f('0x1c'))['db'];config[_0x981f('0x1d')]=_[_0x981f('0x1e')](config[_0x981f('0x1d')],{'host':_0x981f('0x1f'),'port':0x18eb});var socket=require(_0x981f('0x20'))(new Redis(config['redis']));require('./dashboard.socket')[_0x981f('0x21')](socket);function respondWithStatusCode(_0xb4fbcb,_0xc526bd){_0xc526bd=_0xc526bd||0xcc;return function(_0x50da4f){if(_0x50da4f){return _0xb4fbcb[_0x981f('0x22')](_0xc526bd);}return _0xb4fbcb[_0x981f('0x23')](_0xc526bd)[_0x981f('0x24')]();};}function respondWithResult(_0x3aa4fc,_0x3fa9f3){_0x3fa9f3=_0x3fa9f3||0xc8;return function(_0x55a5d7){if(_0x55a5d7){return _0x3aa4fc[_0x981f('0x23')](_0x3fa9f3)[_0x981f('0x25')](_0x55a5d7);}};}function respondWithFilteredResult(_0x564fc6,_0x4ca01f){return function(_0x1ee9a6){if(_0x1ee9a6){var _0x3091ec=_0x1ee9a6[_0x981f('0x26')],_0x55fed9=_0x4ca01f[_0x981f('0x27')],_0x2a908d=_0x4ca01f['offset']+_0x4ca01f['limit'],_0x2f711e;if(_0x2a908d>=_0x3091ec){_0x2a908d=_0x3091ec;_0x2f711e=0xc8;}else{_0x2f711e=0xce;}_0x564fc6[_0x981f('0x23')](_0x2f711e);return _0x564fc6[_0x981f('0x28')](_0x981f('0x29'),_0x55fed9+'-'+_0x2a908d+'/'+_0x3091ec)['json'](_0x1ee9a6);}return null;};}function patchUpdates(_0x206d38){return function(_0x4ccd3e){try{jsonpatch[_0x981f('0x2a')](_0x4ccd3e,_0x206d38,!![]);}catch(_0x591f55){return BPromise[_0x981f('0x2b')](_0x591f55);}return _0x4ccd3e[_0x981f('0x2c')]();};}function saveUpdates(_0x2f09e1,_0x225287){return function(_0x197ca2){if(_0x197ca2){return _0x197ca2[_0x981f('0x2d')](_0x2f09e1)['then'](function(_0x2ee347){return _0x2ee347;});}return null;};}function removeEntity(_0x3a9ded,_0x64c106){return function(_0x39d92c){if(_0x39d92c){return _0x39d92c[_0x981f('0x2e')]()[_0x981f('0x2f')](function(){var _0x2593c6=_0x39d92c['get']({'plain':!![]});var _0x55862b=_0x981f('0x30');return db[_0x981f('0x31')][_0x981f('0x2e')]({'where':{'type':_0x55862b,'resourceId':_0x2593c6['id']}})['then'](function(){return _0x39d92c;});})[_0x981f('0x2f')](function(){_0x3a9ded['status'](0xcc)[_0x981f('0x24')]();});}};}function handleEntityNotFound(_0x3c64e8,_0x3c3aa8){return function(_0x3cf3f2){if(!_0x3cf3f2){_0x3c64e8[_0x981f('0x22')](0x194);}return _0x3cf3f2;};}function handleError(_0x4dbc49,_0x1573b8){_0x1573b8=_0x1573b8||0x1f4;return function(_0x57d506){logger['error'](_0x57d506[_0x981f('0x32')]);if(_0x57d506[_0x981f('0x33')]){delete _0x57d506['name'];}_0x4dbc49[_0x981f('0x23')](_0x1573b8)[_0x981f('0x34')](_0x57d506);};}exports[_0x981f('0x35')]=function(_0x58ed39,_0x501fae){var _0x20db58={},_0x250f0c={},_0x564eaa={'count':0x0,'rows':[]};var _0x542d40=_[_0x981f('0x36')](db[_0x981f('0x37')]['rawAttributes'],function(_0x412378){return{'name':_0x412378['fieldName'],'type':_0x412378['type'][_0x981f('0x38')]};});_0x250f0c[_0x981f('0x39')]=_[_0x981f('0x36')](_0x542d40,_0x981f('0x33'));_0x250f0c['query']=_[_0x981f('0x3a')](_0x58ed39[_0x981f('0x3b')]);_0x250f0c[_0x981f('0x3c')]=_[_0x981f('0x3d')](_0x250f0c[_0x981f('0x39')],_0x250f0c[_0x981f('0x3b')]);_0x20db58[_0x981f('0x3e')]=_['intersection'](_0x250f0c['model'],qs[_0x981f('0x3f')](_0x58ed39[_0x981f('0x3b')]['fields']));_0x20db58['attributes']=_0x20db58[_0x981f('0x3e')]['length']?_0x20db58[_0x981f('0x3e')]:_0x250f0c[_0x981f('0x39')];if(!_0x58ed39[_0x981f('0x3b')][_0x981f('0x40')]('nolimit')){_0x20db58[_0x981f('0x41')]=qs[_0x981f('0x41')](_0x58ed39[_0x981f('0x3b')][_0x981f('0x41')]);_0x20db58[_0x981f('0x27')]=qs['offset'](_0x58ed39['query'][_0x981f('0x27')]);}_0x20db58['order']=qs[_0x981f('0x42')](_0x58ed39[_0x981f('0x3b')][_0x981f('0x42')]);_0x20db58['where']=qs[_0x981f('0x3c')](_['pick'](_0x58ed39[_0x981f('0x3b')],_0x250f0c[_0x981f('0x3c')]),_0x542d40);if(_0x58ed39['query'][_0x981f('0x43')]){_0x20db58[_0x981f('0x44')]=_[_0x981f('0x45')](_0x20db58[_0x981f('0x44')],{'$or':_[_0x981f('0x36')](_0x542d40,function(_0x513dd5){if(_0x513dd5['type']!==_0x981f('0x46')){var _0x529e14={};_0x529e14[_0x513dd5[_0x981f('0x33')]]={'$like':'%'+_0x58ed39[_0x981f('0x3b')][_0x981f('0x43')]+'%'};return _0x529e14;}})});}_0x20db58=_[_0x981f('0x45')]({},_0x20db58,_0x58ed39[_0x981f('0x47')]);var _0x1be7be={'where':_0x20db58[_0x981f('0x44')]};return db['Dashboard'][_0x981f('0x26')](_0x1be7be)[_0x981f('0x2f')](function(_0x57c62a){_0x564eaa[_0x981f('0x26')]=_0x57c62a;if(_0x58ed39['query'][_0x981f('0x48')]){_0x20db58[_0x981f('0x49')]=[{'all':!![]}];}return db[_0x981f('0x37')][_0x981f('0x4a')](_0x20db58);})[_0x981f('0x2f')](function(_0x58cb12){_0x564eaa[_0x981f('0x4b')]=_0x58cb12;return _0x564eaa;})['then'](respondWithFilteredResult(_0x501fae,_0x20db58))[_0x981f('0x4c')](handleError(_0x501fae,null));};exports[_0x981f('0x4d')]=function(_0x43a180,_0x3fef4d){var _0x3a1aa6={'raw':![],'where':{'id':_0x43a180[_0x981f('0x4e')]['id']}},_0x182c7f={};_0x182c7f[_0x981f('0x39')]=_[_0x981f('0x3a')](db['Dashboard']['rawAttributes']);_0x182c7f[_0x981f('0x3b')]=_[_0x981f('0x3a')](_0x43a180[_0x981f('0x3b')]);_0x182c7f[_0x981f('0x3c')]=_[_0x981f('0x3d')](_0x182c7f['model'],_0x182c7f[_0x981f('0x3b')]);_0x3a1aa6[_0x981f('0x3e')]=_[_0x981f('0x3d')](_0x182c7f[_0x981f('0x39')],qs[_0x981f('0x3f')](_0x43a180[_0x981f('0x3b')][_0x981f('0x3f')]));_0x3a1aa6['attributes']=_0x3a1aa6[_0x981f('0x3e')]['length']?_0x3a1aa6[_0x981f('0x3e')]:_0x182c7f[_0x981f('0x39')];if(_0x43a180[_0x981f('0x3b')][_0x981f('0x48')]){_0x3a1aa6[_0x981f('0x49')]=[{'all':!![]}];}_0x3a1aa6=_[_0x981f('0x45')]({},_0x3a1aa6,_0x43a180['options']);return db[_0x981f('0x37')][_0x981f('0x4f')](_0x3a1aa6)[_0x981f('0x2f')](handleEntityNotFound(_0x3fef4d,null))[_0x981f('0x2f')](respondWithResult(_0x3fef4d,null))[_0x981f('0x4c')](handleError(_0x3fef4d,null));};exports[_0x981f('0x50')]=function(_0x5096cf,_0x33ab2b){return db[_0x981f('0x37')][_0x981f('0x50')](_0x5096cf['body'],{})[_0x981f('0x2f')](function(_0x43dbf6){var _0x3f13d8=_0x5096cf[_0x981f('0x51')][_0x981f('0x52')]({'plain':!![]});if(!_0x3f13d8)throw new Error(_0x981f('0x53'));if(_0x3f13d8[_0x981f('0x54')]==='user'){var _0x40a461=_0x43dbf6[_0x981f('0x52')]({'plain':!![]});var _0x242364=_0x981f('0x30');return db[_0x981f('0x55')][_0x981f('0x4f')]({'where':{'name':_0x242364,'userProfileId':_0x3f13d8['userProfileId']},'raw':!![]})[_0x981f('0x2f')](function(_0x1c0a2b){if(_0x1c0a2b&&_0x1c0a2b[_0x981f('0x56')]===0x0){return db['UserProfileResource'][_0x981f('0x50')]({'name':_0x40a461['name'],'resourceId':_0x40a461['id'],'type':_0x1c0a2b[_0x981f('0x33')],'sectionId':_0x1c0a2b['id']},{})[_0x981f('0x2f')](function(){return _0x43dbf6;});}else{return _0x43dbf6;}})[_0x981f('0x4c')](function(_0x311b63){logger['error'](_0x981f('0x57'),_0x311b63);throw _0x311b63;});}return _0x43dbf6;})[_0x981f('0x2f')](respondWithResult(_0x33ab2b,0xc9))[_0x981f('0x4c')](handleError(_0x33ab2b,null));};exports[_0x981f('0x58')]=function(_0x7c6b,_0x30ed81){var _0xc52fd8={'where':{'id':_0x7c6b[_0x981f('0x4e')]['id']}},_0x3407dd={};_0x3407dd[_0x981f('0x39')]=_['keys'](db[_0x981f('0x37')][_0x981f('0x59')]);_0xc52fd8['attributes']=_[_0x981f('0x3d')](_0x3407dd[_0x981f('0x39')],qs[_0x981f('0x3f')](_0x7c6b[_0x981f('0x3b')][_0x981f('0x3f')]));_0xc52fd8['attributes']=_0xc52fd8['attributes'][_0x981f('0x5a')]?_0xc52fd8[_0x981f('0x3e')]:_0x3407dd['model'];if(_0x7c6b[_0x981f('0x3b')][_0x981f('0x48')]){_0xc52fd8['include']=[{'all':!![]}];}_0xc52fd8=_['merge']({},_0xc52fd8,_0x7c6b[_0x981f('0x47')]);return db[_0x981f('0x37')][_0x981f('0x4f')](_0xc52fd8)[_0x981f('0x2f')](handleEntityNotFound(_0x30ed81,null))['then'](function(_0xdf5faf){if(_0xdf5faf){var _0x28ff0e=_0xdf5faf[_0x981f('0x52')]({'plain':!![]});_0x28ff0e=qs[_0x981f('0x5b')](_0x28ff0e,['id',_0x981f('0x5c'),_0x981f('0x5d')]);_0x7c6b[_0x981f('0x5e')]=_[_0x981f('0x5b')](_0x7c6b['body'],['id',_0x981f('0x5c'),_0x981f('0x5d')]);return db['Dashboard'][_0x981f('0x50')](_[_0x981f('0x45')](_0x28ff0e,_0x7c6b['body']),{'include':_0x7c6b[_0x981f('0x3b')][_0x981f('0x48')]?[{'all':!![]}]:undefined})[_0x981f('0x2f')](function(_0x251650){var _0xcaa834=_0x7c6b[_0x981f('0x51')][_0x981f('0x52')]({'plain':!![]});if(!_0xcaa834)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcaa834[_0x981f('0x54')]===_0x981f('0x51')){var _0x36030a=_0x251650[_0x981f('0x52')]({'plain':!![]});var _0x50da00='CustomDashboards';return db[_0x981f('0x55')][_0x981f('0x4f')]({'where':{'name':_0x50da00,'userProfileId':_0xcaa834['userProfileId']},'raw':!![]})[_0x981f('0x2f')](function(_0x5778f9){if(_0x5778f9&&_0x5778f9[_0x981f('0x56')]===0x0){return db[_0x981f('0x31')][_0x981f('0x50')]({'name':_0x36030a['name'],'resourceId':_0x36030a['id'],'type':_0x5778f9[_0x981f('0x33')],'sectionId':_0x5778f9['id']},{})[_0x981f('0x2f')](function(){return _0x251650;});}else{return _0x251650;}})[_0x981f('0x4c')](function(_0x1b784a){logger['error'](_0x981f('0x57'),_0x1b784a);throw _0x1b784a;});}return _0x251650;});}})['then'](respondWithResult(_0x30ed81,0xc9))[_0x981f('0x4c')](handleError(_0x30ed81,null));};exports[_0x981f('0x2d')]=function(_0x462c25,_0xd2966a){if(_0x462c25['body']['id']){delete _0x462c25[_0x981f('0x5e')]['id'];}return db[_0x981f('0x37')][_0x981f('0x4f')]({'where':{'id':_0x462c25[_0x981f('0x4e')]['id']}})['then'](handleEntityNotFound(_0xd2966a,null))[_0x981f('0x2f')](saveUpdates(_0x462c25[_0x981f('0x5e')],null))[_0x981f('0x2f')](respondWithResult(_0xd2966a,null))[_0x981f('0x4c')](handleError(_0xd2966a,null));};exports[_0x981f('0x2e')]=function(_0x43ff4c,_0x366321){return db[_0x981f('0x37')][_0x981f('0x4f')]({'where':{'id':_0x43ff4c[_0x981f('0x4e')]['id']}})[_0x981f('0x2f')](handleEntityNotFound(_0x366321,null))['then'](removeEntity(_0x366321,null))[_0x981f('0x4c')](handleError(_0x366321,null));};function widgetAttributes(_0x4b68fd){try{switch(_0x4b68fd[_0x981f('0x5f')]){case'iframe':return[{'name':_0x981f('0x60'),'value':_0x4b68fd[_0x981f('0x60')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd['attrs'][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x62')]:undefined)||_0x981f('0x63')}];case _0x981f('0x64'):return[{'name':'attrPath','value':_0x4b68fd[_0x981f('0x65')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x62')]:undefined)||''}];case _0x981f('0x66'):return[{'name':_0x981f('0x67'),'value':_0x4b68fd['attrHourFormat']||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x62')]:undefined)||_0x981f('0x68')},{'name':_0x981f('0x69'),'value':_0x4b68fd[_0x981f('0x69')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd['attrs'][0x1]?_0x4b68fd[_0x981f('0x61')][0x1][_0x981f('0x62')]:undefined)||_0x981f('0x6a')},{'name':_0x981f('0x6b'),'value':_0x4b68fd[_0x981f('0x6b')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x2]?_0x4b68fd[_0x981f('0x61')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x981f('0x6c'),'value':_0x4b68fd[_0x981f('0x6c')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x62')]:undefined)||'total'},{'name':_0x981f('0x6d'),'value':_0x4b68fd[_0x981f('0x6d')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x1]?_0x4b68fd[_0x981f('0x61')][0x1][_0x981f('0x62')]:undefined)||[]},{'name':_0x981f('0x6b'),'value':_0x4b68fd[_0x981f('0x6b')]||(_0x4b68fd['attrs']&&_0x4b68fd['attrs'][0x2]?_0x4b68fd[_0x981f('0x61')][0x2]['value']:undefined)||0x14}];case _0x981f('0x6e'):case _0x981f('0x6f'):return[{'name':_0x981f('0x70'),'value':_0x4b68fd[_0x981f('0x70')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x62')]:undefined)||_0x981f('0x71')},{'name':_0x981f('0x72'),'value':_0x4b68fd[_0x981f('0x72')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x1]?_0x4b68fd[_0x981f('0x61')][0x1]['value']:undefined)||null},{'name':_0x981f('0x73'),'value':_0x4b68fd[_0x981f('0x73')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x2]?_0x4b68fd[_0x981f('0x61')][0x2]['value']:undefined)||null},{'name':_0x981f('0x6d'),'value':_0x4b68fd[_0x981f('0x6d')]||(_0x4b68fd['attrs']&&_0x4b68fd[_0x981f('0x61')][0x3]?_0x4b68fd[_0x981f('0x61')][0x3][_0x981f('0x62')]:undefined)||[]}];case _0x981f('0x74'):return[{'name':'attrReport','type':_0x4b68fd[_0x981f('0x75')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x5f')]:undefined)||null,'value':_0x4b68fd['attrReport']||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x62')]:undefined)||null},{'name':_0x981f('0x76'),'value':_0x4b68fd[_0x981f('0x76')]||(_0x4b68fd['attrs']&&_0x4b68fd[_0x981f('0x61')][0x1]?_0x4b68fd[_0x981f('0x61')][0x1][_0x981f('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x4fd87f){logger[_0x981f('0x77')](_0x981f('0x78'),JSON[_0x981f('0x79')](_0x4fd87f));return[];}}exports[_0x981f('0x7a')]=function(_0x1c2fc7,_0x547b93,_0x274b41){if(_0x1c2fc7[_0x981f('0x5e')]['id']){delete _0x1c2fc7[_0x981f('0x5e')]['id'];}return db[_0x981f('0x37')]['find']({'where':{'id':_0x1c2fc7['params']['id']}})[_0x981f('0x2f')](handleEntityNotFound(_0x547b93,null))[_0x981f('0x2f')](function(_0x409f90){if(_0x409f90){_0x1c2fc7[_0x981f('0x5e')]['DashboardId']=_0x409f90['id'];_0x1c2fc7[_0x981f('0x5e')][_0x981f('0x61')]=widgetAttributes(_0x1c2fc7[_0x981f('0x5e')]);return db[_0x981f('0x7b')][_0x981f('0x50')](_0x1c2fc7[_0x981f('0x5e')]);}})['then'](respondWithResult(_0x547b93,null))[_0x981f('0x4c')](handleError(_0x547b93,null));};exports['getItems']=function(_0x491bb3,_0x743370,_0x534db5){var _0x290e5c={};var _0x584d4b={};var _0x2f563d;var _0x4b0d3e;return db[_0x981f('0x37')][_0x981f('0x7c')]({'where':{'id':_0x491bb3['params']['id']}})[_0x981f('0x2f')](handleEntityNotFound(_0x743370,null))[_0x981f('0x2f')](function(_0x3b3cb6){if(_0x3b3cb6){_0x2f563d=_0x3b3cb6;_0x584d4b['model']=_[_0x981f('0x3a')](db[_0x981f('0x7b')][_0x981f('0x59')]);_0x584d4b[_0x981f('0x3b')]=_['keys'](_0x491bb3[_0x981f('0x3b')]);_0x584d4b[_0x981f('0x3c')]=_[_0x981f('0x3d')](_0x584d4b['model'],_0x584d4b[_0x981f('0x3b')]);_0x290e5c['attributes']=_[_0x981f('0x3d')](_0x584d4b[_0x981f('0x39')],qs[_0x981f('0x3f')](_0x491bb3[_0x981f('0x3b')]['fields']));_0x290e5c[_0x981f('0x3e')]=_0x290e5c['attributes']['length']?_0x290e5c[_0x981f('0x3e')]:_0x584d4b[_0x981f('0x39')];_0x290e5c[_0x981f('0x7d')]=qs[_0x981f('0x42')](_0x491bb3[_0x981f('0x3b')][_0x981f('0x42')]);_0x290e5c[_0x981f('0x44')]=qs[_0x981f('0x3c')](_[_0x981f('0x7e')](_0x491bb3[_0x981f('0x3b')],_0x584d4b['filters']));if(_0x491bb3[_0x981f('0x3b')][_0x981f('0x43')]){_0x290e5c[_0x981f('0x44')]=_[_0x981f('0x45')](_0x290e5c[_0x981f('0x44')],{'$or':_[_0x981f('0x36')](_0x290e5c[_0x981f('0x3e')],function(_0x4ef761){var _0x379010={};_0x379010[_0x4ef761]={'$like':'%'+_0x491bb3['query'][_0x981f('0x43')]+'%'};return _0x379010;})});}_0x290e5c=_[_0x981f('0x45')]({},_0x290e5c,_0x491bb3[_0x981f('0x47')]);return _0x2f563d[_0x981f('0x7f')](_0x290e5c);}})['then'](function(_0x2d136d){if(_0x2d136d){_0x4b0d3e=_0x2d136d['length'];if(!_0x491bb3[_0x981f('0x3b')][_0x981f('0x40')](_0x981f('0x80'))){_0x290e5c[_0x981f('0x41')]=qs[_0x981f('0x41')](_0x491bb3[_0x981f('0x3b')][_0x981f('0x41')]);_0x290e5c[_0x981f('0x27')]=qs['offset'](_0x491bb3[_0x981f('0x3b')][_0x981f('0x27')]);}return _0x2f563d[_0x981f('0x7f')](_0x290e5c);}})[_0x981f('0x2f')](function(_0x168641){if(_0x168641){return _0x168641?{'count':_0x4b0d3e,'rows':_0x168641}:null;}})[_0x981f('0x2f')](respondWithResult(_0x743370,null))[_0x981f('0x4c')](handleError(_0x743370,null));}; \ No newline at end of file +var _0xd5b7=['attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie3','reportType','attrReport','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','end','sendStatus','stack','name','send','index','map','Dashboard','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','catch','show','params','length','include','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','error','destroy','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00'];(function(_0x30163a,_0x2b7f0c){var _0x48f877=function(_0x539210){while(--_0x539210){_0x30163a['push'](_0x30163a['shift']());}};_0x48f877(++_0x2b7f0c);}(_0xd5b7,0x8b));var _0x7d5b=function(_0x431ff8,_0x4085dd){_0x431ff8=_0x431ff8-0x0;var _0x84ccd4=_0xd5b7[_0x431ff8];return _0x84ccd4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7d5b('0x0'));var rimraf=require(_0x7d5b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7d5b('0x2'));var BPromise=require(_0x7d5b('0x3'));var Mustache=require(_0x7d5b('0x4'));var util=require(_0x7d5b('0x5'));var path=require(_0x7d5b('0x6'));var sox=require('sox');var csv=require(_0x7d5b('0x7'));var ejs=require(_0x7d5b('0x8'));var fs=require('fs');var _=require(_0x7d5b('0x9'));var squel=require(_0x7d5b('0xa'));var crypto=require(_0x7d5b('0xb'));var jsforce=require(_0x7d5b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7d5b('0x7'));var querystring=require(_0x7d5b('0xd'));var Papa=require(_0x7d5b('0xe'));var Redis=require('ioredis');var authService=require(_0x7d5b('0xf'));var qs=require(_0x7d5b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d5b('0x11'));var logger=require(_0x7d5b('0x12'))(_0x7d5b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7d5b('0x14')]=_[_0x7d5b('0x15')](config[_0x7d5b('0x14')],{'host':_0x7d5b('0x16'),'port':0x18eb});var socket=require(_0x7d5b('0x17'))(new Redis(config['redis']));require(_0x7d5b('0x18'))[_0x7d5b('0x19')](socket);function respondWithStatusCode(_0x2e5a7c,_0x561e9c){_0x561e9c=_0x561e9c||0xcc;return function(_0x216488){if(_0x216488){return _0x2e5a7c['sendStatus'](_0x561e9c);}return _0x2e5a7c[_0x7d5b('0x1a')](_0x561e9c)['end']();};}function respondWithResult(_0x3f14cf,_0x3f438f){_0x3f438f=_0x3f438f||0xc8;return function(_0x342bef){if(_0x342bef){return _0x3f14cf['status'](_0x3f438f)[_0x7d5b('0x1b')](_0x342bef);}};}function respondWithFilteredResult(_0x5f5796,_0x5ac11b){return function(_0x1dacf4){if(_0x1dacf4){var _0x310ea3=_0x1dacf4[_0x7d5b('0x1c')],_0x314a8b=_0x5ac11b['offset'],_0x3c0bdf=_0x5ac11b['offset']+_0x5ac11b[_0x7d5b('0x1d')],_0x4027db;if(_0x3c0bdf>=_0x310ea3){_0x3c0bdf=_0x310ea3;_0x4027db=0xc8;}else{_0x4027db=0xce;}_0x5f5796['status'](_0x4027db);return _0x5f5796[_0x7d5b('0x1e')](_0x7d5b('0x1f'),_0x314a8b+'-'+_0x3c0bdf+'/'+_0x310ea3)[_0x7d5b('0x1b')](_0x1dacf4);}return null;};}function patchUpdates(_0x467d19){return function(_0x5e7c06){try{jsonpatch[_0x7d5b('0x20')](_0x5e7c06,_0x467d19,!![]);}catch(_0x7613fe){return BPromise[_0x7d5b('0x21')](_0x7613fe);}return _0x5e7c06[_0x7d5b('0x22')]();};}function saveUpdates(_0x2ebe3e,_0xd1a3d8){return function(_0x48e82f){if(_0x48e82f){return _0x48e82f[_0x7d5b('0x23')](_0x2ebe3e)['then'](function(_0x5ba9e){return _0x5ba9e;});}return null;};}function removeEntity(_0x391d85,_0x5ef93a){return function(_0x5f3d20){if(_0x5f3d20){return _0x5f3d20['destroy']()[_0x7d5b('0x24')](function(){var _0x5c568d=_0x5f3d20[_0x7d5b('0x25')]({'plain':!![]});var _0x3d211b=_0x7d5b('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x3d211b,'resourceId':_0x5c568d['id']}})[_0x7d5b('0x24')](function(){return _0x5f3d20;});})['then'](function(){_0x391d85[_0x7d5b('0x1a')](0xcc)[_0x7d5b('0x27')]();});}};}function handleEntityNotFound(_0x45d19e,_0x215c9c){return function(_0x431044){if(!_0x431044){_0x45d19e[_0x7d5b('0x28')](0x194);}return _0x431044;};}function handleError(_0x376b22,_0x16db25){_0x16db25=_0x16db25||0x1f4;return function(_0x5d7ebd){logger['error'](_0x5d7ebd[_0x7d5b('0x29')]);if(_0x5d7ebd[_0x7d5b('0x2a')]){delete _0x5d7ebd['name'];}_0x376b22[_0x7d5b('0x1a')](_0x16db25)[_0x7d5b('0x2b')](_0x5d7ebd);};}exports[_0x7d5b('0x2c')]=function(_0x585cdb,_0x2e4f36){var _0x376b2b={},_0x51d774={},_0x3bf5ea={'count':0x0,'rows':[]};var _0x4b2f03=_[_0x7d5b('0x2d')](db[_0x7d5b('0x2e')][_0x7d5b('0x2f')],function(_0x3a97db){return{'name':_0x3a97db['fieldName'],'type':_0x3a97db[_0x7d5b('0x30')][_0x7d5b('0x31')]};});_0x51d774[_0x7d5b('0x32')]=_[_0x7d5b('0x2d')](_0x4b2f03,'name');_0x51d774[_0x7d5b('0x33')]=_[_0x7d5b('0x34')](_0x585cdb[_0x7d5b('0x33')]);_0x51d774[_0x7d5b('0x35')]=_[_0x7d5b('0x36')](_0x51d774[_0x7d5b('0x32')],_0x51d774['query']);_0x376b2b['attributes']=_[_0x7d5b('0x36')](_0x51d774[_0x7d5b('0x32')],qs[_0x7d5b('0x37')](_0x585cdb[_0x7d5b('0x33')][_0x7d5b('0x37')]));_0x376b2b[_0x7d5b('0x38')]=_0x376b2b[_0x7d5b('0x38')]['length']?_0x376b2b[_0x7d5b('0x38')]:_0x51d774['model'];if(!_0x585cdb['query'][_0x7d5b('0x39')](_0x7d5b('0x3a'))){_0x376b2b[_0x7d5b('0x1d')]=qs[_0x7d5b('0x1d')](_0x585cdb[_0x7d5b('0x33')][_0x7d5b('0x1d')]);_0x376b2b[_0x7d5b('0x3b')]=qs[_0x7d5b('0x3b')](_0x585cdb[_0x7d5b('0x33')][_0x7d5b('0x3b')]);}_0x376b2b['order']=qs[_0x7d5b('0x3c')](_0x585cdb['query']['sort']);_0x376b2b['where']=qs[_0x7d5b('0x35')](_[_0x7d5b('0x3d')](_0x585cdb[_0x7d5b('0x33')],_0x51d774['filters']),_0x4b2f03);if(_0x585cdb[_0x7d5b('0x33')][_0x7d5b('0x3e')]){_0x376b2b[_0x7d5b('0x3f')]=_['merge'](_0x376b2b[_0x7d5b('0x3f')],{'$or':_[_0x7d5b('0x2d')](_0x4b2f03,function(_0x3a2135){if(_0x3a2135[_0x7d5b('0x30')]!==_0x7d5b('0x40')){var _0x5675e5={};_0x5675e5[_0x3a2135[_0x7d5b('0x2a')]]={'$like':'%'+_0x585cdb[_0x7d5b('0x33')][_0x7d5b('0x3e')]+'%'};return _0x5675e5;}})});}_0x376b2b=_['merge']({},_0x376b2b,_0x585cdb[_0x7d5b('0x41')]);var _0x4097e3={'where':_0x376b2b[_0x7d5b('0x3f')]};return db['Dashboard'][_0x7d5b('0x1c')](_0x4097e3)[_0x7d5b('0x24')](function(_0x2623a0){_0x3bf5ea['count']=_0x2623a0;if(_0x585cdb[_0x7d5b('0x33')][_0x7d5b('0x42')]){_0x376b2b['include']=[{'all':!![]}];}return db[_0x7d5b('0x2e')][_0x7d5b('0x43')](_0x376b2b);})[_0x7d5b('0x24')](function(_0x52630a){_0x3bf5ea['rows']=_0x52630a;return _0x3bf5ea;})[_0x7d5b('0x24')](respondWithFilteredResult(_0x2e4f36,_0x376b2b))[_0x7d5b('0x44')](handleError(_0x2e4f36,null));};exports[_0x7d5b('0x45')]=function(_0x46f401,_0x5ab13a){var _0x125787={'raw':![],'where':{'id':_0x46f401[_0x7d5b('0x46')]['id']}},_0x5cee66={};_0x5cee66[_0x7d5b('0x32')]=_[_0x7d5b('0x34')](db[_0x7d5b('0x2e')]['rawAttributes']);_0x5cee66['query']=_[_0x7d5b('0x34')](_0x46f401[_0x7d5b('0x33')]);_0x5cee66[_0x7d5b('0x35')]=_[_0x7d5b('0x36')](_0x5cee66[_0x7d5b('0x32')],_0x5cee66[_0x7d5b('0x33')]);_0x125787[_0x7d5b('0x38')]=_[_0x7d5b('0x36')](_0x5cee66[_0x7d5b('0x32')],qs['fields'](_0x46f401[_0x7d5b('0x33')][_0x7d5b('0x37')]));_0x125787[_0x7d5b('0x38')]=_0x125787[_0x7d5b('0x38')][_0x7d5b('0x47')]?_0x125787['attributes']:_0x5cee66[_0x7d5b('0x32')];if(_0x46f401[_0x7d5b('0x33')][_0x7d5b('0x42')]){_0x125787[_0x7d5b('0x48')]=[{'all':!![]}];}_0x125787=_[_0x7d5b('0x49')]({},_0x125787,_0x46f401[_0x7d5b('0x41')]);return db[_0x7d5b('0x2e')][_0x7d5b('0x4a')](_0x125787)[_0x7d5b('0x24')](handleEntityNotFound(_0x5ab13a,null))['then'](respondWithResult(_0x5ab13a,null))['catch'](handleError(_0x5ab13a,null));};exports[_0x7d5b('0x4b')]=function(_0x41b41c,_0x5f06c0){return db[_0x7d5b('0x2e')][_0x7d5b('0x4b')](_0x41b41c[_0x7d5b('0x4c')],{})['then'](function(_0xb533c9){var _0x4b634e=_0x41b41c['user'][_0x7d5b('0x25')]({'plain':!![]});if(!_0x4b634e)throw new Error(_0x7d5b('0x4d'));if(_0x4b634e[_0x7d5b('0x4e')]===_0x7d5b('0x4f')){var _0x1462c0=_0xb533c9[_0x7d5b('0x25')]({'plain':!![]});var _0x3e46a5=_0x7d5b('0x26');return db[_0x7d5b('0x50')][_0x7d5b('0x4a')]({'where':{'name':_0x3e46a5,'userProfileId':_0x4b634e[_0x7d5b('0x51')]},'raw':!![]})['then'](function(_0x1867eb){if(_0x1867eb&&_0x1867eb[_0x7d5b('0x52')]===0x0){return db[_0x7d5b('0x53')][_0x7d5b('0x4b')]({'name':_0x1462c0[_0x7d5b('0x2a')],'resourceId':_0x1462c0['id'],'type':_0x1867eb[_0x7d5b('0x2a')],'sectionId':_0x1867eb['id']},{})[_0x7d5b('0x24')](function(){return _0xb533c9;});}else{return _0xb533c9;}})[_0x7d5b('0x44')](function(_0x20cc21){logger['error'](_0x7d5b('0x54'),_0x20cc21);throw _0x20cc21;});}return _0xb533c9;})[_0x7d5b('0x24')](respondWithResult(_0x5f06c0,0xc9))['catch'](handleError(_0x5f06c0,null));};exports[_0x7d5b('0x55')]=function(_0x4deacc,_0xff6abf){var _0x10a384={'where':{'id':_0x4deacc[_0x7d5b('0x46')]['id']}},_0x401ec1={};_0x401ec1[_0x7d5b('0x32')]=_[_0x7d5b('0x34')](db['Dashboard']['rawAttributes']);_0x10a384['attributes']=_['intersection'](_0x401ec1[_0x7d5b('0x32')],qs[_0x7d5b('0x37')](_0x4deacc[_0x7d5b('0x33')][_0x7d5b('0x37')]));_0x10a384[_0x7d5b('0x38')]=_0x10a384['attributes'][_0x7d5b('0x47')]?_0x10a384[_0x7d5b('0x38')]:_0x401ec1[_0x7d5b('0x32')];if(_0x4deacc[_0x7d5b('0x33')][_0x7d5b('0x42')]){_0x10a384['include']=[{'all':!![]}];}_0x10a384=_[_0x7d5b('0x49')]({},_0x10a384,_0x4deacc[_0x7d5b('0x41')]);return db[_0x7d5b('0x2e')][_0x7d5b('0x4a')](_0x10a384)['then'](handleEntityNotFound(_0xff6abf,null))[_0x7d5b('0x24')](function(_0x46380d){if(_0x46380d){var _0x384af7=_0x46380d[_0x7d5b('0x25')]({'plain':!![]});_0x384af7=qs[_0x7d5b('0x56')](_0x384af7,['id',_0x7d5b('0x57'),_0x7d5b('0x58')]);_0x4deacc['body']=_['omit'](_0x4deacc['body'],['id',_0x7d5b('0x57'),'updatedAt']);return db[_0x7d5b('0x2e')][_0x7d5b('0x4b')](_[_0x7d5b('0x49')](_0x384af7,_0x4deacc[_0x7d5b('0x4c')]),{'include':_0x4deacc[_0x7d5b('0x33')][_0x7d5b('0x42')]?[{'all':!![]}]:undefined})[_0x7d5b('0x24')](function(_0x124f89){var _0x5ae9ea=_0x4deacc[_0x7d5b('0x4f')][_0x7d5b('0x25')]({'plain':!![]});if(!_0x5ae9ea)throw new Error(_0x7d5b('0x4d'));if(_0x5ae9ea[_0x7d5b('0x4e')]==='user'){var _0x2a22a0=_0x124f89[_0x7d5b('0x25')]({'plain':!![]});var _0xba3051=_0x7d5b('0x26');return db[_0x7d5b('0x50')][_0x7d5b('0x4a')]({'where':{'name':_0xba3051,'userProfileId':_0x5ae9ea[_0x7d5b('0x51')]},'raw':!![]})[_0x7d5b('0x24')](function(_0x4ffcec){if(_0x4ffcec&&_0x4ffcec[_0x7d5b('0x52')]===0x0){return db[_0x7d5b('0x53')][_0x7d5b('0x4b')]({'name':_0x2a22a0['name'],'resourceId':_0x2a22a0['id'],'type':_0x4ffcec[_0x7d5b('0x2a')],'sectionId':_0x4ffcec['id']},{})['then'](function(){return _0x124f89;});}else{return _0x124f89;}})[_0x7d5b('0x44')](function(_0x4511c9){logger[_0x7d5b('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4511c9);throw _0x4511c9;});}return _0x124f89;});}})['then'](respondWithResult(_0xff6abf,0xc9))[_0x7d5b('0x44')](handleError(_0xff6abf,null));};exports[_0x7d5b('0x23')]=function(_0x33a455,_0x3000bd){if(_0x33a455[_0x7d5b('0x4c')]['id']){delete _0x33a455[_0x7d5b('0x4c')]['id'];}return db[_0x7d5b('0x2e')][_0x7d5b('0x4a')]({'where':{'id':_0x33a455[_0x7d5b('0x46')]['id']}})[_0x7d5b('0x24')](handleEntityNotFound(_0x3000bd,null))[_0x7d5b('0x24')](saveUpdates(_0x33a455[_0x7d5b('0x4c')],null))['then'](respondWithResult(_0x3000bd,null))[_0x7d5b('0x44')](handleError(_0x3000bd,null));};exports[_0x7d5b('0x5a')]=function(_0x246357,_0x2d965d){return db[_0x7d5b('0x2e')][_0x7d5b('0x4a')]({'where':{'id':_0x246357[_0x7d5b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d965d,null))['then'](removeEntity(_0x2d965d,null))['catch'](handleError(_0x2d965d,null));};function widgetAttributes(_0x5ae6b9){try{switch(_0x5ae6b9['type']){case'iframe':return[{'name':_0x7d5b('0x5b'),'value':_0x5ae6b9[_0x7d5b('0x5b')]||(_0x5ae6b9[_0x7d5b('0x5c')]&&_0x5ae6b9[_0x7d5b('0x5c')][0x0]?_0x5ae6b9[_0x7d5b('0x5c')][0x0][_0x7d5b('0x5d')]:undefined)||'https://'}];case _0x7d5b('0x5e'):return[{'name':'attrPath','value':_0x5ae6b9[_0x7d5b('0x5f')]||(_0x5ae6b9[_0x7d5b('0x5c')]&&_0x5ae6b9[_0x7d5b('0x5c')][0x0]?_0x5ae6b9[_0x7d5b('0x5c')][0x0]['value']:undefined)||''}];case _0x7d5b('0x60'):return[{'name':_0x7d5b('0x61'),'value':_0x5ae6b9[_0x7d5b('0x61')]||(_0x5ae6b9['attrs']&&_0x5ae6b9[_0x7d5b('0x5c')][0x0]?_0x5ae6b9[_0x7d5b('0x5c')][0x0][_0x7d5b('0x5d')]:undefined)||_0x7d5b('0x62')},{'name':'attrTimezone','value':_0x5ae6b9[_0x7d5b('0x63')]||(_0x5ae6b9[_0x7d5b('0x5c')]&&_0x5ae6b9['attrs'][0x1]?_0x5ae6b9['attrs'][0x1][_0x7d5b('0x5d')]:undefined)||_0x7d5b('0x64')},{'name':_0x7d5b('0x65'),'value':_0x5ae6b9[_0x7d5b('0x65')]||(_0x5ae6b9[_0x7d5b('0x5c')]&&_0x5ae6b9[_0x7d5b('0x5c')][0x2]?_0x5ae6b9[_0x7d5b('0x5c')][0x2]['value']:undefined)||0xc}];case _0x7d5b('0x66'):return[{'name':_0x7d5b('0x67'),'value':_0x5ae6b9[_0x7d5b('0x67')]||(_0x5ae6b9[_0x7d5b('0x5c')]&&_0x5ae6b9['attrs'][0x0]?_0x5ae6b9[_0x7d5b('0x5c')][0x0][_0x7d5b('0x5d')]:undefined)||_0x7d5b('0x68')},{'name':_0x7d5b('0x69'),'value':_0x5ae6b9['attrVoiceQueues']||(_0x5ae6b9[_0x7d5b('0x5c')]&&_0x5ae6b9[_0x7d5b('0x5c')][0x1]?_0x5ae6b9[_0x7d5b('0x5c')][0x1][_0x7d5b('0x5d')]:undefined)||[]},{'name':_0x7d5b('0x65'),'value':_0x5ae6b9[_0x7d5b('0x65')]||(_0x5ae6b9[_0x7d5b('0x5c')]&&_0x5ae6b9['attrs'][0x2]?_0x5ae6b9['attrs'][0x2][_0x7d5b('0x5d')]:undefined)||0x14}];case _0x7d5b('0x6a'):case _0x7d5b('0x6b'):return[{'name':_0x7d5b('0x6c'),'value':_0x5ae6b9[_0x7d5b('0x6c')]||(_0x5ae6b9[_0x7d5b('0x5c')]&&_0x5ae6b9['attrs'][0x0]?_0x5ae6b9[_0x7d5b('0x5c')][0x0][_0x7d5b('0x5d')]:undefined)||_0x7d5b('0x68')},{'name':'attrSerie2','value':_0x5ae6b9['attrSerie2']||(_0x5ae6b9[_0x7d5b('0x5c')]&&_0x5ae6b9['attrs'][0x1]?_0x5ae6b9[_0x7d5b('0x5c')][0x1][_0x7d5b('0x5d')]:undefined)||null},{'name':_0x7d5b('0x6d'),'value':_0x5ae6b9[_0x7d5b('0x6d')]||(_0x5ae6b9[_0x7d5b('0x5c')]&&_0x5ae6b9['attrs'][0x2]?_0x5ae6b9[_0x7d5b('0x5c')][0x2][_0x7d5b('0x5d')]:undefined)||null},{'name':_0x7d5b('0x69'),'value':_0x5ae6b9[_0x7d5b('0x69')]||(_0x5ae6b9[_0x7d5b('0x5c')]&&_0x5ae6b9[_0x7d5b('0x5c')][0x3]?_0x5ae6b9[_0x7d5b('0x5c')][0x3][_0x7d5b('0x5d')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x5ae6b9[_0x7d5b('0x6e')]||(_0x5ae6b9['attrs']&&_0x5ae6b9[_0x7d5b('0x5c')][0x0]?_0x5ae6b9[_0x7d5b('0x5c')][0x0][_0x7d5b('0x30')]:undefined)||null,'value':_0x5ae6b9[_0x7d5b('0x6f')]||(_0x5ae6b9['attrs']&&_0x5ae6b9[_0x7d5b('0x5c')][0x0]?_0x5ae6b9[_0x7d5b('0x5c')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x5ae6b9['attrRefresh']||(_0x5ae6b9['attrs']&&_0x5ae6b9[_0x7d5b('0x5c')][0x1]?_0x5ae6b9['attrs'][0x1][_0x7d5b('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x3cfb0b){logger[_0x7d5b('0x59')](_0x7d5b('0x70'),JSON[_0x7d5b('0x71')](_0x3cfb0b));return[];}}exports[_0x7d5b('0x72')]=function(_0x92735f,_0x185ddf,_0x317276){if(_0x92735f[_0x7d5b('0x4c')]['id']){delete _0x92735f[_0x7d5b('0x4c')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x92735f[_0x7d5b('0x46')]['id']}})[_0x7d5b('0x24')](handleEntityNotFound(_0x185ddf,null))['then'](function(_0x231de7){if(_0x231de7){_0x92735f[_0x7d5b('0x4c')][_0x7d5b('0x73')]=_0x231de7['id'];_0x92735f[_0x7d5b('0x4c')]['attrs']=widgetAttributes(_0x92735f['body']);return db[_0x7d5b('0x74')]['create'](_0x92735f[_0x7d5b('0x4c')]);}})['then'](respondWithResult(_0x185ddf,null))[_0x7d5b('0x44')](handleError(_0x185ddf,null));};exports[_0x7d5b('0x75')]=function(_0x31d11e,_0x2af51a,_0x4871c7){var _0x574800={};var _0x1818c5={};var _0x23ce68;var _0x64c0c1;return db[_0x7d5b('0x2e')][_0x7d5b('0x76')]({'where':{'id':_0x31d11e['params']['id']}})[_0x7d5b('0x24')](handleEntityNotFound(_0x2af51a,null))[_0x7d5b('0x24')](function(_0x32942){if(_0x32942){_0x23ce68=_0x32942;_0x1818c5[_0x7d5b('0x32')]=_[_0x7d5b('0x34')](db[_0x7d5b('0x74')][_0x7d5b('0x2f')]);_0x1818c5['query']=_[_0x7d5b('0x34')](_0x31d11e['query']);_0x1818c5[_0x7d5b('0x35')]=_[_0x7d5b('0x36')](_0x1818c5[_0x7d5b('0x32')],_0x1818c5[_0x7d5b('0x33')]);_0x574800[_0x7d5b('0x38')]=_['intersection'](_0x1818c5[_0x7d5b('0x32')],qs['fields'](_0x31d11e['query'][_0x7d5b('0x37')]));_0x574800['attributes']=_0x574800[_0x7d5b('0x38')][_0x7d5b('0x47')]?_0x574800[_0x7d5b('0x38')]:_0x1818c5[_0x7d5b('0x32')];_0x574800[_0x7d5b('0x77')]=qs[_0x7d5b('0x3c')](_0x31d11e[_0x7d5b('0x33')]['sort']);_0x574800[_0x7d5b('0x3f')]=qs[_0x7d5b('0x35')](_['pick'](_0x31d11e['query'],_0x1818c5[_0x7d5b('0x35')]));if(_0x31d11e['query']['filter']){_0x574800['where']=_[_0x7d5b('0x49')](_0x574800[_0x7d5b('0x3f')],{'$or':_[_0x7d5b('0x2d')](_0x574800[_0x7d5b('0x38')],function(_0x4d13c9){var _0x5513c7={};_0x5513c7[_0x4d13c9]={'$like':'%'+_0x31d11e[_0x7d5b('0x33')][_0x7d5b('0x3e')]+'%'};return _0x5513c7;})});}_0x574800=_['merge']({},_0x574800,_0x31d11e['options']);return _0x23ce68[_0x7d5b('0x75')](_0x574800);}})[_0x7d5b('0x24')](function(_0x45c3bb){if(_0x45c3bb){_0x64c0c1=_0x45c3bb[_0x7d5b('0x47')];if(!_0x31d11e['query'][_0x7d5b('0x39')](_0x7d5b('0x3a'))){_0x574800[_0x7d5b('0x1d')]=qs[_0x7d5b('0x1d')](_0x31d11e[_0x7d5b('0x33')][_0x7d5b('0x1d')]);_0x574800[_0x7d5b('0x3b')]=qs[_0x7d5b('0x3b')](_0x31d11e[_0x7d5b('0x33')][_0x7d5b('0x3b')]);}return _0x23ce68[_0x7d5b('0x75')](_0x574800);}})[_0x7d5b('0x24')](function(_0x144d57){if(_0x144d57){return _0x144d57?{'count':_0x64c0c1,'rows':_0x144d57}:null;}})[_0x7d5b('0x24')](respondWithResult(_0x2af51a,null))[_0x7d5b('0x44')](handleError(_0x2af51a,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 373677a..416e50f 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 _0x5815=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x5815,0xb5));var _0x5581=function(_0x1f4694,_0x29ab44){_0x1f4694=_0x1f4694-0x0;var _0x2be28f=_0x5815[_0x1f4694];return _0x2be28f;};'use strict';var EventEmitter=require(_0x5581('0x0'));var Dashboard=require(_0x5581('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5581('0x2')](0x0);var events={'afterCreate':_0x5581('0x3'),'afterUpdate':_0x5581('0x4'),'afterDestroy':_0x5581('0x5')};function emitEvent(_0x43d60a){return function(_0x1d3354,_0x170e31,_0x410599){DashboardEvents['emit'](_0x43d60a+':'+_0x1d3354['id'],_0x1d3354);DashboardEvents['emit'](_0x43d60a,_0x1d3354);_0x410599(null);};}for(var e in events){if(events[_0x5581('0x6')](e)){var event=events[e];Dashboard[_0x5581('0x7')](e,emitEvent(event));}}module[_0x5581('0x8')]=DashboardEvents; \ No newline at end of file +var _0x284f=['hasOwnProperty','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0x5365d5,_0x51aa66){var _0x1d3d0e=function(_0x3d1e01){while(--_0x3d1e01){_0x5365d5['push'](_0x5365d5['shift']());}};_0x1d3d0e(++_0x51aa66);}(_0x284f,0x169));var _0xf284=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x284f[_0x2aea9e];return _0x430b92;};'use strict';var EventEmitter=require(_0xf284('0x0'));var Dashboard=require(_0xf284('0x1'))['db'][_0xf284('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf284('0x3')](0x0);var events={'afterCreate':_0xf284('0x4'),'afterUpdate':_0xf284('0x5'),'afterDestroy':_0xf284('0x6')};function emitEvent(_0x1ca5f7){return function(_0x13daad,_0x25ee39,_0x1a05dc){DashboardEvents[_0xf284('0x7')](_0x1ca5f7+':'+_0x13daad['id'],_0x13daad);DashboardEvents[_0xf284('0x7')](_0x1ca5f7,_0x13daad);_0x1a05dc(null);};}for(var e in events){if(events[_0xf284('0x8')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index fd38260..fdeda75 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 _0x5855=['request-promise','rimraf','./dashboard.attributes','exports','define','Dashboard','dashboards','util','../../config/logger','api','moment'];(function(_0x5504d5,_0x29a41b){var _0x3df904=function(_0x524c88){while(--_0x524c88){_0x5504d5['push'](_0x5504d5['shift']());}};_0x3df904(++_0x29a41b);}(_0x5855,0x1e0));var _0x5585=function(_0x589ac8,_0x10ac6e){_0x589ac8=_0x589ac8-0x0;var _0x1bb5dc=_0x5855[_0x589ac8];return _0x1bb5dc;};'use strict';var _=require('lodash');var util=require(_0x5585('0x0'));var logger=require(_0x5585('0x1'))(_0x5585('0x2'));var moment=require(_0x5585('0x3'));var BPromise=require('bluebird');var rp=require(_0x5585('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5585('0x5'));var config=require('../../config/environment');var attributes=require(_0x5585('0x6'));module[_0x5585('0x7')]=function(_0x3af97c,_0xb3a082){return _0x3af97c[_0x5585('0x8')](_0x5585('0x9'),attributes,{'tableName':_0x5585('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92e9=['dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x3b7c70,_0x1b3db2){var _0x49fb90=function(_0x124ba2){while(--_0x124ba2){_0x3b7c70['push'](_0x3b7c70['shift']());}};_0x49fb90(++_0x1b3db2);}(_0x92e9,0x112));var _0x992e=function(_0x326b86,_0x200d91){_0x326b86=_0x326b86-0x0;var _0x28d781=_0x92e9[_0x326b86];return _0x28d781;};'use strict';var _=require(_0x992e('0x0'));var util=require(_0x992e('0x1'));var logger=require(_0x992e('0x2'))(_0x992e('0x3'));var moment=require(_0x992e('0x4'));var BPromise=require(_0x992e('0x5'));var rp=require(_0x992e('0x6'));var fs=require('fs');var path=require(_0x992e('0x7'));var rimraf=require(_0x992e('0x8'));var config=require(_0x992e('0x9'));var attributes=require(_0x992e('0xa'));module[_0x992e('0xb')]=function(_0x77d622,_0x4ffca5){return _0x77d622['define']('Dashboard',attributes,{'tableName':_0x992e('0xc'),'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 346543c..afecd89 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 _0x9512=['debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x45c284,_0x4e93d1){var _0x4af76c=function(_0x4942c6){while(--_0x4942c6){_0x45c284['push'](_0x45c284['shift']());}};_0x4af76c(++_0x4e93d1);}(_0x9512,0x1ac));var _0x2951=function(_0x575228,_0x3f9bc1){_0x575228=_0x575228-0x0;var _0x4cb11e=_0x9512[_0x575228];return _0x4cb11e;};'use strict';var _=require(_0x2951('0x0'));var util=require(_0x2951('0x1'));var moment=require(_0x2951('0x2'));var BPromise=require('bluebird');var rs=require(_0x2951('0x3'));var fs=require('fs');var Redis=require(_0x2951('0x4'));var db=require(_0x2951('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2951('0x6'));var config=require(_0x2951('0x7'));var jayson=require(_0x2951('0x8'));var client=jayson[_0x2951('0x9')][_0x2951('0xa')]({'port':0x232a});config[_0x2951('0xb')]=_[_0x2951('0xc')](config[_0x2951('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2951('0xd'))(new Redis(config[_0x2951('0xb')]));require(_0x2951('0xe'))[_0x2951('0xf')](socket);function respondWithRpcPromise(_0x31771e,_0x414aba,_0x15ec09){return new BPromise(function(_0x54cb63,_0x14cd96){return client[_0x2951('0x10')](_0x31771e,_0x15ec09)[_0x2951('0x11')](function(_0x163e33){logger[_0x2951('0x12')](_0x2951('0x13'),_0x414aba,'request\x20sent');logger[_0x2951('0x14')](_0x2951('0x15'),_0x414aba,_0x2951('0x16'),JSON[_0x2951('0x17')](_0x163e33));if(_0x163e33[_0x2951('0x18')]){if(_0x163e33[_0x2951('0x18')][_0x2951('0x19')]===0x1f4){logger['error'](_0x2951('0x13'),_0x414aba,_0x163e33[_0x2951('0x18')][_0x2951('0x1a')]);return _0x14cd96(_0x163e33[_0x2951('0x18')]['message']);}logger[_0x2951('0x18')](_0x2951('0x13'),_0x414aba,_0x163e33[_0x2951('0x18')][_0x2951('0x1a')]);return _0x54cb63(_0x163e33[_0x2951('0x18')][_0x2951('0x1a')]);}else{logger[_0x2951('0x12')]('Dashboard,\x20%s,\x20%s',_0x414aba,_0x2951('0x16'));_0x54cb63(_0x163e33['result'][_0x2951('0x1a')]);}})[_0x2951('0x1b')](function(_0x371f2e){logger[_0x2951('0x18')](_0x2951('0x13'),_0x414aba,_0x371f2e);_0x14cd96(_0x371f2e);});});} \ No newline at end of file +var _0x7b7c=['http','redis','./dashboard.socket','register','request','then','debug','request\x20sent','stringify','error','Dashboard,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','client'];(function(_0x4487e3,_0x1cd4cd){var _0x56a60a=function(_0x50eebe){while(--_0x50eebe){_0x4487e3['push'](_0x4487e3['shift']());}};_0x56a60a(++_0x1cd4cd);}(_0x7b7c,0x67));var _0xc7b7=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x7b7c[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var util=require(_0xc7b7('0x0'));var moment=require(_0xc7b7('0x1'));var BPromise=require(_0xc7b7('0x2'));var rs=require(_0xc7b7('0x3'));var fs=require('fs');var Redis=require(_0xc7b7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc7b7('0x6')][_0xc7b7('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7b7('0x8')]));require(_0xc7b7('0x9'))[_0xc7b7('0xa')](socket);function respondWithRpcPromise(_0xacfa15,_0x4be9fb,_0xbff12f){return new BPromise(function(_0x150e09,_0x2c5142){return client[_0xc7b7('0xb')](_0xacfa15,_0xbff12f)[_0xc7b7('0xc')](function(_0x2fd7f6){logger['info']('Dashboard,\x20%s,\x20%s',_0x4be9fb,'request\x20sent');logger[_0xc7b7('0xd')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x4be9fb,_0xc7b7('0xe'),JSON[_0xc7b7('0xf')](_0x2fd7f6));if(_0x2fd7f6[_0xc7b7('0x10')]){if(_0x2fd7f6[_0xc7b7('0x10')]['code']===0x1f4){logger['error'](_0xc7b7('0x11'),_0x4be9fb,_0x2fd7f6['error'][_0xc7b7('0x12')]);return _0x2c5142(_0x2fd7f6[_0xc7b7('0x10')][_0xc7b7('0x12')]);}logger[_0xc7b7('0x10')](_0xc7b7('0x11'),_0x4be9fb,_0x2fd7f6['error'][_0xc7b7('0x12')]);return _0x150e09(_0x2fd7f6[_0xc7b7('0x10')]['message']);}else{logger[_0xc7b7('0x13')](_0xc7b7('0x11'),_0x4be9fb,'request\x20sent');_0x150e09(_0x2fd7f6[_0xc7b7('0x14')]['message']);}})[_0xc7b7('0x15')](function(_0x15fbb3){logger[_0xc7b7('0x10')]('Dashboard,\x20%s,\x20%s',_0x4be9fb,_0x15fbb3);_0x2c5142(_0x15fbb3);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index dc4d29c..3572bf7 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 _0xd37a=['./dashboard.events','save','update','emit','removeListener','register','dashboard:'];(function(_0x2276c0,_0x48e46a){var _0x185f33=function(_0x8e5000){while(--_0x8e5000){_0x2276c0['push'](_0x2276c0['shift']());}};_0x185f33(++_0x48e46a);}(_0xd37a,0x10a));var _0xad37=function(_0x355644,_0xb79867){_0x355644=_0x355644-0x0;var _0x3a7e95=_0xd37a[_0x355644];return _0x3a7e95;};'use strict';var DashboardEvents=require(_0xad37('0x0'));var events=[_0xad37('0x1'),'remove',_0xad37('0x2')];function createListener(_0x16eba3,_0x842f3c){return function(_0x38316e){_0x842f3c[_0xad37('0x3')](_0x16eba3,_0x38316e);};}function removeListener(_0x4ed390,_0x21aeb7){return function(){DashboardEvents[_0xad37('0x4')](_0x4ed390,_0x21aeb7);};}exports[_0xad37('0x5')]=function(_0x1dfdf1){for(var _0x5ce3fd=0x0,_0x1603dc=events['length'];_0x5ce3fd<_0x1603dc;_0x5ce3fd++){var _0x23526c=events[_0x5ce3fd];var _0x6bdf9e=createListener(_0xad37('0x6')+_0x23526c,_0x1dfdf1);DashboardEvents['on'](_0x23526c,_0x6bdf9e);}}; \ No newline at end of file +var _0xfd0a=['length','dashboard:','./dashboard.events','save','remove','update','emit','removeListener'];(function(_0x4f04ce,_0x31ecad){var _0x41766e=function(_0x3cf4c9){while(--_0x3cf4c9){_0x4f04ce['push'](_0x4f04ce['shift']());}};_0x41766e(++_0x31ecad);}(_0xfd0a,0xca));var _0xafd0=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0xfd0a[_0x3a1ea5];return _0xfac9b2;};'use strict';var DashboardEvents=require(_0xafd0('0x0'));var events=[_0xafd0('0x1'),_0xafd0('0x2'),_0xafd0('0x3')];function createListener(_0x4ec7c9,_0x4f4025){return function(_0x3fa7c4){_0x4f4025[_0xafd0('0x4')](_0x4ec7c9,_0x3fa7c4);};}function removeListener(_0xafbf14,_0x2b12b1){return function(){DashboardEvents[_0xafd0('0x5')](_0xafbf14,_0x2b12b1);};}exports['register']=function(_0x47e364){for(var _0x48b107=0x0,_0x49225a=events[_0xafd0('0x6')];_0x48b107<_0x49225a;_0x48b107++){var _0x4df03f=events[_0x48b107];var _0x5b9a04=createListener(_0xafd0('0x7')+_0x4df03f,_0x47e364);DashboardEvents['on'](_0x4df03f,_0x5b9a04);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 65a68af..c62eb99 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 _0xb7e7=['addItem','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xb7e7[_0x4e6ae6];return _0x23c108;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['post'](_0x7b7e('0xd'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xe')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0x7'),auth['isAuthenticated'](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','multer','util','path','express','Router'];(function(_0x4d4f61,_0x56d7a7){var _0x297414=function(_0x30d055){while(--_0x30d055){_0x4d4f61['push'](_0x4d4f61['shift']());}};_0x297414(++_0x56d7a7);}(_0xe706,0xa3));var _0x6e70=function(_0xf8baeb,_0x4c83e8){_0xf8baeb=_0xf8baeb-0x0;var _0x5997a4=_0xe706[_0xf8baeb];return _0x5997a4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x10')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x10')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['post']('/:id/items',auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index fbf49ea..4a20e34 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 _0xdf68=['lodash','exports','STRING','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','squel'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xdf68,0x1ac));var _0x8df6=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0xdf68[_0x49ad79];return _0xa4e38a;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x8df6('0x0'));var _=require(_0x8df6('0x1'));module[_0x8df6('0x2')]={'title':{'type':Sequelize[_0x8df6('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8df6('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0x8df6('0x4')](this[_0x8df6('0x5')](_0x8df6('0x6')));}catch(_0x1abc17){return[];}},'set':function(_0x13f7e8){try{this[_0x8df6('0x7')](_0x8df6('0x6'),JSON[_0x8df6('0x8')](_0x13f7e8));}catch(_0x35d4f9){this['setDataValue']('attrs',JSON[_0x8df6('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x8df6('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x8df6('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x8df6('0x9')]},'col':{'type':Sequelize[_0x8df6('0x9')]},'background':{'type':Sequelize[_0x8df6('0x3')],'allowNull':![],'defaultValue':_0x8df6('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8df6('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8df6('0x3')]},'titleFontSize':{'type':Sequelize[_0x8df6('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xd779=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','exports','STRING'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0xd779,0xa4));var _0x9d77=function(_0x47aac1,_0x50193d){_0x47aac1=_0x47aac1-0x0;var _0x2c2c8b=_0xd779[_0x47aac1];return _0x2c2c8b;};'use strict';var Sequelize=require(_0x9d77('0x0'));var squel=require(_0x9d77('0x1'));var _=require('lodash');module[_0x9d77('0x2')]={'title':{'type':Sequelize[_0x9d77('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9d77('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9d77('0x4')](_0x9d77('0x5')),'get':function(){try{return JSON[_0x9d77('0x6')](this[_0x9d77('0x7')](_0x9d77('0x8')));}catch(_0x67e56e){return[];}},'set':function(_0xbf610a){try{this[_0x9d77('0x9')](_0x9d77('0x8'),JSON[_0x9d77('0xa')](_0xbf610a));}catch(_0xf751aa){this[_0x9d77('0x9')](_0x9d77('0x8'),JSON[_0x9d77('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x9d77('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9d77('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x9d77('0xb')]},'col':{'type':Sequelize[_0x9d77('0xb')]},'background':{'type':Sequelize[_0x9d77('0x3')],'allowNull':![],'defaultValue':_0x9d77('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9d77('0x3')],'allowNull':![],'defaultValue':_0x9d77('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9d77('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index fe1ccbf..51820c0 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 _0xa4fb=['stringify','create','body','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./dashboardItem.socket','sendStatus','end','status','json','offset','set','apply','reject','save','update','then','destroy','error','name','send','show','params','keys','DashboardItem','rawAttributes','query','filters','model','attributes','intersection','length','includeAll','merge','options','find','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s'];(function(_0x5b973c,_0x46c0d0){var _0xc3a214=function(_0xff037a){while(--_0xff037a){_0x5b973c['push'](_0x5b973c['shift']());}};_0xc3a214(++_0x46c0d0);}(_0xa4fb,0xb0));var _0xba4f=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0xa4fb[_0x30c2ae];return _0x1ee1cc;};'use strict';var pdf=require(_0xba4f('0x0'));var emlformat=require(_0xba4f('0x1'));var rimraf=require(_0xba4f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba4f('0x3'));var rp=require(_0xba4f('0x4'));var moment=require(_0xba4f('0x5'));var BPromise=require(_0xba4f('0x6'));var Mustache=require('mustache');var util=require(_0xba4f('0x7'));var path=require(_0xba4f('0x8'));var sox=require('sox');var csv=require(_0xba4f('0x9'));var ejs=require(_0xba4f('0xa'));var fs=require('fs');var _=require(_0xba4f('0xb'));var squel=require('squel');var crypto=require(_0xba4f('0xc'));var jsforce=require(_0xba4f('0xd'));var deskjs=require(_0xba4f('0xe'));var toCsv=require(_0xba4f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba4f('0xf'));var authService=require(_0xba4f('0x10'));var qs=require(_0xba4f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba4f('0x12'));var logger=require('../../config/logger')(_0xba4f('0x13'));var utils=require('../../config/utils');var config=require(_0xba4f('0x14'));var licenseUtil=require(_0xba4f('0x15'));var db=require(_0xba4f('0x16'))['db'];config[_0xba4f('0x17')]=_[_0xba4f('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba4f('0x17')]));require(_0xba4f('0x19'))['register'](socket);function respondWithStatusCode(_0x2d7d68,_0x1a4d2a){_0x1a4d2a=_0x1a4d2a||0xcc;return function(_0x41f855){if(_0x41f855){return _0x2d7d68[_0xba4f('0x1a')](_0x1a4d2a);}return _0x2d7d68['status'](_0x1a4d2a)[_0xba4f('0x1b')]();};}function respondWithResult(_0x482ace,_0x52ca6e){_0x52ca6e=_0x52ca6e||0xc8;return function(_0x215949){if(_0x215949){return _0x482ace[_0xba4f('0x1c')](_0x52ca6e)[_0xba4f('0x1d')](_0x215949);}};}function respondWithFilteredResult(_0x4b3e17,_0xe31451){return function(_0x4e0638){if(_0x4e0638){var _0x129a18=_0x4e0638['count'],_0x1210a1=_0xe31451[_0xba4f('0x1e')],_0x29de25=_0xe31451[_0xba4f('0x1e')]+_0xe31451['limit'],_0x14db67;if(_0x29de25>=_0x129a18){_0x29de25=_0x129a18;_0x14db67=0xc8;}else{_0x14db67=0xce;}_0x4b3e17[_0xba4f('0x1c')](_0x14db67);return _0x4b3e17[_0xba4f('0x1f')]('Content-Range',_0x1210a1+'-'+_0x29de25+'/'+_0x129a18)[_0xba4f('0x1d')](_0x4e0638);}return null;};}function patchUpdates(_0x55b528){return function(_0x1f6a4b){try{jsonpatch[_0xba4f('0x20')](_0x1f6a4b,_0x55b528,!![]);}catch(_0x171dba){return BPromise[_0xba4f('0x21')](_0x171dba);}return _0x1f6a4b[_0xba4f('0x22')]();};}function saveUpdates(_0x121b8b,_0x4298b3){return function(_0x1a32ac){if(_0x1a32ac){return _0x1a32ac[_0xba4f('0x23')](_0x121b8b)[_0xba4f('0x24')](function(_0x8c0f84){return _0x8c0f84;});}return null;};}function removeEntity(_0x526bc7,_0x4af237){return function(_0x4cd35e){if(_0x4cd35e){return _0x4cd35e[_0xba4f('0x25')]()[_0xba4f('0x24')](function(){_0x526bc7[_0xba4f('0x1c')](0xcc)[_0xba4f('0x1b')]();});}};}function handleEntityNotFound(_0x2aaa14,_0xeae738){return function(_0x35dcc4){if(!_0x35dcc4){_0x2aaa14[_0xba4f('0x1a')](0x194);}return _0x35dcc4;};}function handleError(_0x3d3b56,_0x19d6eb){_0x19d6eb=_0x19d6eb||0x1f4;return function(_0x4c3945){logger[_0xba4f('0x26')](_0x4c3945['stack']);if(_0x4c3945['name']){delete _0x4c3945[_0xba4f('0x27')];}_0x3d3b56['status'](_0x19d6eb)[_0xba4f('0x28')](_0x4c3945);};}exports[_0xba4f('0x29')]=function(_0x444df8,_0xbe946e){var _0x3e4cb1={'raw':![],'where':{'id':_0x444df8[_0xba4f('0x2a')]['id']}},_0x29c79b={};_0x29c79b['model']=_[_0xba4f('0x2b')](db[_0xba4f('0x2c')][_0xba4f('0x2d')]);_0x29c79b[_0xba4f('0x2e')]=_['keys'](_0x444df8[_0xba4f('0x2e')]);_0x29c79b[_0xba4f('0x2f')]=_['intersection'](_0x29c79b[_0xba4f('0x30')],_0x29c79b[_0xba4f('0x2e')]);_0x3e4cb1[_0xba4f('0x31')]=_[_0xba4f('0x32')](_0x29c79b[_0xba4f('0x30')],qs['fields'](_0x444df8[_0xba4f('0x2e')]['fields']));_0x3e4cb1[_0xba4f('0x31')]=_0x3e4cb1[_0xba4f('0x31')][_0xba4f('0x33')]?_0x3e4cb1[_0xba4f('0x31')]:_0x29c79b[_0xba4f('0x30')];if(_0x444df8[_0xba4f('0x2e')][_0xba4f('0x34')]){_0x3e4cb1['include']=[{'all':!![]}];}_0x3e4cb1=_[_0xba4f('0x35')]({},_0x3e4cb1,_0x444df8[_0xba4f('0x36')]);return db[_0xba4f('0x2c')][_0xba4f('0x37')](_0x3e4cb1)[_0xba4f('0x24')](handleEntityNotFound(_0xbe946e,null))[_0xba4f('0x24')](respondWithResult(_0xbe946e,null))['catch'](handleError(_0xbe946e,null));};exports[_0xba4f('0x25')]=function(_0x291410,_0x3cce5b){return db[_0xba4f('0x2c')][_0xba4f('0x37')]({'where':{'id':_0x291410['params']['id']}})[_0xba4f('0x24')](handleEntityNotFound(_0x3cce5b,null))[_0xba4f('0x24')](removeEntity(_0x3cce5b,null))['catch'](handleError(_0x3cce5b,null));};function widgetAttributes(_0x22de55){try{switch(_0x22de55['type']){case _0xba4f('0x38'):return[{'name':_0xba4f('0x39'),'value':_0x22de55['attrUrl']||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55['attrs'][0x0]?_0x22de55[_0xba4f('0x3a')][0x0]['value']:undefined)||_0xba4f('0x3b')}];case _0xba4f('0x3c'):return[{'name':_0xba4f('0x3d'),'value':_0x22de55[_0xba4f('0x3d')]||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55[_0xba4f('0x3a')][0x0]?_0x22de55['attrs'][0x0][_0xba4f('0x3e')]:undefined)||''}];case _0xba4f('0x3f'):return[{'name':_0xba4f('0x40'),'value':_0x22de55[_0xba4f('0x40')]||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x0]?_0x22de55['attrs'][0x0][_0xba4f('0x3e')]:undefined)||_0xba4f('0x41')},{'name':'attrTimezone','value':_0x22de55[_0xba4f('0x42')]||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x1]?_0x22de55[_0xba4f('0x3a')][0x1][_0xba4f('0x3e')]:undefined)||_0xba4f('0x43')},{'name':_0xba4f('0x44'),'value':_0x22de55['attrFontSize']||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55[_0xba4f('0x3a')][0x2]?_0x22de55[_0xba4f('0x3a')][0x2][_0xba4f('0x3e')]:undefined)||0xc}];case'counter':return[{'name':_0xba4f('0x45'),'value':_0x22de55[_0xba4f('0x45')]||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x0]?_0x22de55[_0xba4f('0x3a')][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x22de55[_0xba4f('0x46')]||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55[_0xba4f('0x3a')][0x1]?_0x22de55[_0xba4f('0x3a')][0x1][_0xba4f('0x3e')]:undefined)||[]},{'name':'attrFontSize','value':_0x22de55[_0xba4f('0x44')]||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x2]?_0x22de55[_0xba4f('0x3a')][0x2][_0xba4f('0x3e')]:undefined)||0x14}];case _0xba4f('0x47'):case _0xba4f('0x48'):return[{'name':_0xba4f('0x49'),'value':_0x22de55[_0xba4f('0x49')]||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x0]?_0x22de55[_0xba4f('0x3a')][0x0][_0xba4f('0x3e')]:undefined)||'total'},{'name':_0xba4f('0x4a'),'value':_0x22de55[_0xba4f('0x4a')]||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55[_0xba4f('0x3a')][0x1]?_0x22de55[_0xba4f('0x3a')][0x1]['value']:undefined)||null},{'name':_0xba4f('0x4b'),'value':_0x22de55['attrSerie3']||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55['attrs'][0x2]?_0x22de55[_0xba4f('0x3a')][0x2][_0xba4f('0x3e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x22de55['attrVoiceQueues']||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x3]?_0x22de55[_0xba4f('0x3a')][0x3][_0xba4f('0x3e')]:undefined)||[]}];case _0xba4f('0x4c'):return[{'name':_0xba4f('0x4d'),'type':_0x22de55[_0xba4f('0x4e')]||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55[_0xba4f('0x3a')][0x0]?_0x22de55['attrs'][0x0][_0xba4f('0x4f')]:undefined)||null,'value':_0x22de55[_0xba4f('0x4d')]||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55[_0xba4f('0x3a')][0x0]?_0x22de55[_0xba4f('0x3a')][0x0][_0xba4f('0x3e')]:undefined)||null},{'name':_0xba4f('0x50'),'value':_0x22de55[_0xba4f('0x50')]||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x1]?_0x22de55[_0xba4f('0x3a')][0x1][_0xba4f('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x7f7181){logger['error'](_0xba4f('0x51'),JSON[_0xba4f('0x52')](_0x7f7181));return[];}}exports[_0xba4f('0x53')]=function(_0x1a2e38,_0x3fb9ba){if(_0x1a2e38[_0xba4f('0x54')]){_0x1a2e38[_0xba4f('0x54')][_0xba4f('0x3a')]=widgetAttributes(_0x1a2e38[_0xba4f('0x54')]);}return db[_0xba4f('0x2c')][_0xba4f('0x53')](_0x1a2e38[_0xba4f('0x54')],{})[_0xba4f('0x24')](respondWithResult(_0x3fb9ba,0xc9))[_0xba4f('0x55')](handleError(_0x3fb9ba,null));};exports[_0xba4f('0x23')]=function(_0x2a2e54,_0x3951b9){if(_0x2a2e54[_0xba4f('0x54')]['id']){delete _0x2a2e54['body']['id'];}_0x2a2e54[_0xba4f('0x54')][_0xba4f('0x3a')]=widgetAttributes(_0x2a2e54[_0xba4f('0x54')]);return db['DashboardItem'][_0xba4f('0x37')]({'where':{'id':_0x2a2e54[_0xba4f('0x2a')]['id']}})[_0xba4f('0x24')](handleEntityNotFound(_0x3951b9,null))['then'](saveUpdates(_0x2a2e54[_0xba4f('0x54')],null))[_0xba4f('0x24')](respondWithResult(_0x3951b9,null))[_0xba4f('0x55')](handleError(_0x3951b9,null));}; \ No newline at end of file +var _0xf87c=['value','custom','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrRefresh','widgetAttributes:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','then','error','stack','name','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','destroy','params','type','attrUrl','attrs'];(function(_0xc01c9c,_0x480169){var _0x1187fa=function(_0x57ecdf){while(--_0x57ecdf){_0xc01c9c['push'](_0xc01c9c['shift']());}};_0x1187fa(++_0x480169);}(_0xf87c,0x155));var _0xcf87=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0xf87c[_0x36fbef];return _0x45e270;};'use strict';var pdf=require(_0xcf87('0x0'));var emlformat=require(_0xcf87('0x1'));var rimraf=require(_0xcf87('0x2'));var zipdir=require(_0xcf87('0x3'));var jsonpatch=require(_0xcf87('0x4'));var rp=require(_0xcf87('0x5'));var moment=require(_0xcf87('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xcf87('0x7'));var util=require('util');var path=require(_0xcf87('0x8'));var sox=require('sox');var csv=require(_0xcf87('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xcf87('0xa'));var crypto=require(_0xcf87('0xb'));var jsforce=require(_0xcf87('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcf87('0xd'));var Papa=require('papaparse');var Redis=require(_0xcf87('0xe'));var authService=require(_0xcf87('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcf87('0x10'));var hardwareService=require(_0xcf87('0x11'));var logger=require(_0xcf87('0x12'))(_0xcf87('0x13'));var utils=require('../../config/utils');var config=require(_0xcf87('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xcf87('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcf87('0x16'))[_0xcf87('0x17')](socket);function respondWithStatusCode(_0x1e3931,_0x569ed2){_0x569ed2=_0x569ed2||0xcc;return function(_0x2e906d){if(_0x2e906d){return _0x1e3931[_0xcf87('0x18')](_0x569ed2);}return _0x1e3931[_0xcf87('0x19')](_0x569ed2)[_0xcf87('0x1a')]();};}function respondWithResult(_0x437059,_0xe95bf5){_0xe95bf5=_0xe95bf5||0xc8;return function(_0x172d74){if(_0x172d74){return _0x437059['status'](_0xe95bf5)[_0xcf87('0x1b')](_0x172d74);}};}function respondWithFilteredResult(_0x1a4023,_0x52a220){return function(_0xc9d15e){if(_0xc9d15e){var _0x2b23ba=_0xc9d15e['count'],_0x55ab0a=_0x52a220[_0xcf87('0x1c')],_0x1de2e6=_0x52a220['offset']+_0x52a220['limit'],_0x40744a;if(_0x1de2e6>=_0x2b23ba){_0x1de2e6=_0x2b23ba;_0x40744a=0xc8;}else{_0x40744a=0xce;}_0x1a4023[_0xcf87('0x19')](_0x40744a);return _0x1a4023[_0xcf87('0x1d')](_0xcf87('0x1e'),_0x55ab0a+'-'+_0x1de2e6+'/'+_0x2b23ba)[_0xcf87('0x1b')](_0xc9d15e);}return null;};}function patchUpdates(_0x4ec584){return function(_0x429102){try{jsonpatch[_0xcf87('0x1f')](_0x429102,_0x4ec584,!![]);}catch(_0x589494){return BPromise['reject'](_0x589494);}return _0x429102[_0xcf87('0x20')]();};}function saveUpdates(_0x17307d,_0xc642d3){return function(_0x4b45da){if(_0x4b45da){return _0x4b45da[_0xcf87('0x21')](_0x17307d)['then'](function(_0x1e11e0){return _0x1e11e0;});}return null;};}function removeEntity(_0x390931,_0x26f78a){return function(_0x4ac319){if(_0x4ac319){return _0x4ac319['destroy']()[_0xcf87('0x22')](function(){_0x390931['status'](0xcc)[_0xcf87('0x1a')]();});}};}function handleEntityNotFound(_0x5b2564,_0x43539a){return function(_0x450a28){if(!_0x450a28){_0x5b2564[_0xcf87('0x18')](0x194);}return _0x450a28;};}function handleError(_0x247b80,_0x276506){_0x276506=_0x276506||0x1f4;return function(_0x3b43d7){logger[_0xcf87('0x23')](_0x3b43d7[_0xcf87('0x24')]);if(_0x3b43d7[_0xcf87('0x25')]){delete _0x3b43d7['name'];}_0x247b80['status'](_0x276506)['send'](_0x3b43d7);};}exports[_0xcf87('0x26')]=function(_0x77e3c0,_0x1b96e3){var _0x18e093={'raw':![],'where':{'id':_0x77e3c0['params']['id']}},_0x710417={};_0x710417[_0xcf87('0x27')]=_[_0xcf87('0x28')](db[_0xcf87('0x29')][_0xcf87('0x2a')]);_0x710417[_0xcf87('0x2b')]=_[_0xcf87('0x28')](_0x77e3c0[_0xcf87('0x2b')]);_0x710417[_0xcf87('0x2c')]=_[_0xcf87('0x2d')](_0x710417[_0xcf87('0x27')],_0x710417[_0xcf87('0x2b')]);_0x18e093[_0xcf87('0x2e')]=_['intersection'](_0x710417[_0xcf87('0x27')],qs[_0xcf87('0x2f')](_0x77e3c0[_0xcf87('0x2b')]['fields']));_0x18e093[_0xcf87('0x2e')]=_0x18e093[_0xcf87('0x2e')][_0xcf87('0x30')]?_0x18e093[_0xcf87('0x2e')]:_0x710417['model'];if(_0x77e3c0[_0xcf87('0x2b')][_0xcf87('0x31')]){_0x18e093['include']=[{'all':!![]}];}_0x18e093=_[_0xcf87('0x32')]({},_0x18e093,_0x77e3c0[_0xcf87('0x33')]);return db[_0xcf87('0x29')][_0xcf87('0x34')](_0x18e093)['then'](handleEntityNotFound(_0x1b96e3,null))[_0xcf87('0x22')](respondWithResult(_0x1b96e3,null))[_0xcf87('0x35')](handleError(_0x1b96e3,null));};exports[_0xcf87('0x36')]=function(_0x596862,_0x1a692b){return db[_0xcf87('0x29')]['find']({'where':{'id':_0x596862[_0xcf87('0x37')]['id']}})[_0xcf87('0x22')](handleEntityNotFound(_0x1a692b,null))[_0xcf87('0x22')](removeEntity(_0x1a692b,null))[_0xcf87('0x35')](handleError(_0x1a692b,null));};function widgetAttributes(_0x2c5591){try{switch(_0x2c5591[_0xcf87('0x38')]){case'iframe':return[{'name':_0xcf87('0x39'),'value':_0x2c5591['attrUrl']||(_0x2c5591[_0xcf87('0x3a')]&&_0x2c5591[_0xcf87('0x3a')][0x0]?_0x2c5591[_0xcf87('0x3a')][0x0][_0xcf87('0x3b')]:undefined)||'https://'}];case _0xcf87('0x3c'):return[{'name':'attrPath','value':_0x2c5591['attrPath']||(_0x2c5591[_0xcf87('0x3a')]&&_0x2c5591[_0xcf87('0x3a')][0x0]?_0x2c5591[_0xcf87('0x3a')][0x0][_0xcf87('0x3b')]:undefined)||''}];case _0xcf87('0x3d'):return[{'name':'attrHourFormat','value':_0x2c5591[_0xcf87('0x3e')]||(_0x2c5591[_0xcf87('0x3a')]&&_0x2c5591[_0xcf87('0x3a')][0x0]?_0x2c5591[_0xcf87('0x3a')][0x0][_0xcf87('0x3b')]:undefined)||_0xcf87('0x3f')},{'name':'attrTimezone','value':_0x2c5591[_0xcf87('0x40')]||(_0x2c5591['attrs']&&_0x2c5591[_0xcf87('0x3a')][0x1]?_0x2c5591['attrs'][0x1][_0xcf87('0x3b')]:undefined)||_0xcf87('0x41')},{'name':_0xcf87('0x42'),'value':_0x2c5591[_0xcf87('0x42')]||(_0x2c5591[_0xcf87('0x3a')]&&_0x2c5591[_0xcf87('0x3a')][0x2]?_0x2c5591['attrs'][0x2]['value']:undefined)||0xc}];case _0xcf87('0x43'):return[{'name':'attrMetric','value':_0x2c5591[_0xcf87('0x44')]||(_0x2c5591[_0xcf87('0x3a')]&&_0x2c5591[_0xcf87('0x3a')][0x0]?_0x2c5591[_0xcf87('0x3a')][0x0][_0xcf87('0x3b')]:undefined)||_0xcf87('0x45')},{'name':_0xcf87('0x46'),'value':_0x2c5591['attrVoiceQueues']||(_0x2c5591['attrs']&&_0x2c5591['attrs'][0x1]?_0x2c5591[_0xcf87('0x3a')][0x1]['value']:undefined)||[]},{'name':_0xcf87('0x42'),'value':_0x2c5591[_0xcf87('0x42')]||(_0x2c5591['attrs']&&_0x2c5591['attrs'][0x2]?_0x2c5591[_0xcf87('0x3a')][0x2][_0xcf87('0x3b')]:undefined)||0x14}];case _0xcf87('0x47'):case _0xcf87('0x48'):return[{'name':_0xcf87('0x49'),'value':_0x2c5591[_0xcf87('0x49')]||(_0x2c5591['attrs']&&_0x2c5591[_0xcf87('0x3a')][0x0]?_0x2c5591[_0xcf87('0x3a')][0x0][_0xcf87('0x3b')]:undefined)||_0xcf87('0x45')},{'name':_0xcf87('0x4a'),'value':_0x2c5591['attrSerie2']||(_0x2c5591[_0xcf87('0x3a')]&&_0x2c5591[_0xcf87('0x3a')][0x1]?_0x2c5591[_0xcf87('0x3a')][0x1][_0xcf87('0x3b')]:undefined)||null},{'name':_0xcf87('0x4b'),'value':_0x2c5591['attrSerie3']||(_0x2c5591[_0xcf87('0x3a')]&&_0x2c5591[_0xcf87('0x3a')][0x2]?_0x2c5591[_0xcf87('0x3a')][0x2]['value']:undefined)||null},{'name':_0xcf87('0x46'),'value':_0x2c5591[_0xcf87('0x46')]||(_0x2c5591[_0xcf87('0x3a')]&&_0x2c5591[_0xcf87('0x3a')][0x3]?_0x2c5591['attrs'][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x2c5591[_0xcf87('0x4c')]||(_0x2c5591[_0xcf87('0x3a')]&&_0x2c5591[_0xcf87('0x3a')][0x0]?_0x2c5591[_0xcf87('0x3a')][0x0][_0xcf87('0x38')]:undefined)||null,'value':_0x2c5591['attrReport']||(_0x2c5591[_0xcf87('0x3a')]&&_0x2c5591[_0xcf87('0x3a')][0x0]?_0x2c5591[_0xcf87('0x3a')][0x0][_0xcf87('0x3b')]:undefined)||null},{'name':_0xcf87('0x4d'),'value':_0x2c5591[_0xcf87('0x4d')]||(_0x2c5591[_0xcf87('0x3a')]&&_0x2c5591[_0xcf87('0x3a')][0x1]?_0x2c5591[_0xcf87('0x3a')][0x1][_0xcf87('0x3b')]:undefined)||0x0}];default:return[];}}catch(_0x58e04e){logger[_0xcf87('0x23')](_0xcf87('0x4e'),JSON['stringify'](_0x58e04e));return[];}}exports['create']=function(_0x1e494e,_0x8d56cd){if(_0x1e494e[_0xcf87('0x4f')]){_0x1e494e[_0xcf87('0x4f')][_0xcf87('0x3a')]=widgetAttributes(_0x1e494e[_0xcf87('0x4f')]);}return db[_0xcf87('0x29')]['create'](_0x1e494e[_0xcf87('0x4f')],{})[_0xcf87('0x22')](respondWithResult(_0x8d56cd,0xc9))['catch'](handleError(_0x8d56cd,null));};exports[_0xcf87('0x21')]=function(_0x5b72bc,_0x887bc1){if(_0x5b72bc[_0xcf87('0x4f')]['id']){delete _0x5b72bc[_0xcf87('0x4f')]['id'];}_0x5b72bc['body'][_0xcf87('0x3a')]=widgetAttributes(_0x5b72bc['body']);return db[_0xcf87('0x29')]['find']({'where':{'id':_0x5b72bc[_0xcf87('0x37')]['id']}})[_0xcf87('0x22')](handleEntityNotFound(_0x887bc1,null))[_0xcf87('0x22')](saveUpdates(_0x5b72bc[_0xcf87('0x4f')],null))[_0xcf87('0x22')](respondWithResult(_0x887bc1,null))['catch'](handleError(_0x887bc1,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 5cef3cd..bd08810 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 _0xade4=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x3e3e5a,_0x26f1a0){var _0x45a7d8=function(_0x350bd4){while(--_0x350bd4){_0x3e3e5a['push'](_0x3e3e5a['shift']());}};_0x45a7d8(++_0x26f1a0);}(_0xade4,0x159));var _0x4ade=function(_0x38899e,_0xa918a5){_0x38899e=_0x38899e-0x0;var _0x4c9362=_0xade4[_0x38899e];return _0x4c9362;};'use strict';var EventEmitter=require(_0x4ade('0x0'));var DashboardItem=require(_0x4ade('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x4ade('0x2')](0x0);var events={'afterCreate':_0x4ade('0x3'),'afterUpdate':'update','afterDestroy':_0x4ade('0x4')};function emitEvent(_0x4b6e76){return function(_0x4bcd01,_0x425327,_0x386e04){DashboardItemEvents[_0x4ade('0x5')](_0x4b6e76+':'+_0x4bcd01['id'],_0x4bcd01);DashboardItemEvents[_0x4ade('0x5')](_0x4b6e76,_0x4bcd01);_0x386e04(null);};}for(var e in events){if(events[_0x4ade('0x6')](e)){var event=events[e];DashboardItem[_0x4ade('0x7')](e,emitEvent(event));}}module[_0x4ade('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x6a6b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update'];(function(_0x3e9139,_0x5f1e52){var _0x440bae=function(_0x7de25){while(--_0x7de25){_0x3e9139['push'](_0x3e9139['shift']());}};_0x440bae(++_0x5f1e52);}(_0x6a6b,0x165));var _0xb6a6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6a6b[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0xb6a6('0x0'));var DashboardItem=require(_0xb6a6('0x1'))['db'][_0xb6a6('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb6a6('0x3')](0x0);var events={'afterCreate':_0xb6a6('0x4'),'afterUpdate':_0xb6a6('0x5'),'afterDestroy':_0xb6a6('0x6')};function emitEvent(_0x1a14dd){return function(_0x2f3e9f,_0x9aed75,_0x3dbdca){DashboardItemEvents[_0xb6a6('0x7')](_0x1a14dd+':'+_0x2f3e9f['id'],_0x2f3e9f);DashboardItemEvents[_0xb6a6('0x7')](_0x1a14dd,_0x2f3e9f);_0x3dbdca(null);};}for(var e in events){if(events[_0xb6a6('0x8')](e)){var event=events[e];DashboardItem[_0xb6a6('0x9')](e,emitEvent(event));}}module[_0xb6a6('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e64315f..f264b9b 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 _0xb2ac=['bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash','../../config/logger'];(function(_0x442955,_0x410333){var _0x14f4b3=function(_0x3f0bc3){while(--_0x3f0bc3){_0x442955['push'](_0x442955['shift']());}};_0x14f4b3(++_0x410333);}(_0xb2ac,0x11e));var _0xcb2a=function(_0x3a0ba5,_0x3d4793){_0x3a0ba5=_0x3a0ba5-0x0;var _0x253dce=_0xb2ac[_0x3a0ba5];return _0x253dce;};'use strict';var _=require(_0xcb2a('0x0'));var util=require('util');var logger=require(_0xcb2a('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcb2a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb2a('0x3'));var rimraf=require(_0xcb2a('0x4'));var config=require(_0xcb2a('0x5'));var attributes=require(_0xcb2a('0x6'));module['exports']=function(_0x43b3a6,_0x1c301a){return _0x43b3a6[_0xcb2a('0x7')](_0xcb2a('0x8'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b76=['exports','define','DashboardItem','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x7e3bb8,_0x27c048){var _0x44c887=function(_0x55d7c6){while(--_0x55d7c6){_0x7e3bb8['push'](_0x7e3bb8['shift']());}};_0x44c887(++_0x27c048);}(_0x2b76,0xb7));var _0x62b7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2b76[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x62b7('0x0'));var logger=require(_0x62b7('0x1'))(_0x62b7('0x2'));var moment=require('moment');var BPromise=require(_0x62b7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62b7('0x4'));var rimraf=require('rimraf');var config=require(_0x62b7('0x5'));var attributes=require('./dashboardItem.attributes');module[_0x62b7('0x6')]=function(_0x2923d,_0x3dd5d0){return _0x2923d[_0x62b7('0x7')](_0x62b7('0x8'),attributes,{'tableName':'dashboard_items','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 dc8341e..cb41da0 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 _0x7cef=['message','info','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7cef,0x154));var _0xf7ce=function(_0x593b0f,_0x1adadd){_0x593b0f=_0x593b0f-0x0;var _0x5c5aae=_0x7cef[_0x593b0f];return _0x5c5aae;};'use strict';var _=require(_0xf7ce('0x0'));var util=require(_0xf7ce('0x1'));var moment=require(_0xf7ce('0x2'));var BPromise=require(_0xf7ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7ce('0x4'))['db'];var utils=require(_0xf7ce('0x5'));var logger=require(_0xf7ce('0x6'))(_0xf7ce('0x7'));var config=require('../../config/environment');var jayson=require(_0xf7ce('0x8'));var client=jayson[_0xf7ce('0x9')][_0xf7ce('0xa')]({'port':0x232a});config[_0xf7ce('0xb')]=_['defaults'](config[_0xf7ce('0xb')],{'host':_0xf7ce('0xc'),'port':0x18eb});var socket=require(_0xf7ce('0xd'))(new Redis(config[_0xf7ce('0xb')]));require('./dashboardItem.socket')[_0xf7ce('0xe')](socket);function respondWithRpcPromise(_0x4840c7,_0x2a6634,_0x3e27e4){return new BPromise(function(_0x8193ac,_0x3596b3){return client[_0xf7ce('0xf')](_0x4840c7,_0x3e27e4)[_0xf7ce('0x10')](function(_0x3422b5){logger['info'](_0xf7ce('0x11'),_0x2a6634,_0xf7ce('0x12'));logger[_0xf7ce('0x13')](_0xf7ce('0x14'),_0x2a6634,_0xf7ce('0x12'),JSON[_0xf7ce('0x15')](_0x3422b5));if(_0x3422b5[_0xf7ce('0x16')]){if(_0x3422b5[_0xf7ce('0x16')][_0xf7ce('0x17')]===0x1f4){logger[_0xf7ce('0x16')]('DashboardItem,\x20%s,\x20%s',_0x2a6634,_0x3422b5['error'][_0xf7ce('0x18')]);return _0x3596b3(_0x3422b5[_0xf7ce('0x16')][_0xf7ce('0x18')]);}logger[_0xf7ce('0x16')](_0xf7ce('0x11'),_0x2a6634,_0x3422b5[_0xf7ce('0x16')][_0xf7ce('0x18')]);return _0x8193ac(_0x3422b5[_0xf7ce('0x16')][_0xf7ce('0x18')]);}else{logger[_0xf7ce('0x19')](_0xf7ce('0x11'),_0x2a6634,_0xf7ce('0x12'));_0x8193ac(_0x3422b5['result']['message']);}})['catch'](function(_0x22a1aa){logger['error'](_0xf7ce('0x11'),_0x2a6634,_0x22a1aa);_0x3596b3(_0x22a1aa);});});} \ No newline at end of file +var _0x8a52=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','defaults','redis','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4b14bb,_0xe7b4d3){var _0x285200=function(_0x48c1d7){while(--_0x48c1d7){_0x4b14bb['push'](_0x4b14bb['shift']());}};_0x285200(++_0xe7b4d3);}(_0x8a52,0x16a));var _0x28a5=function(_0x101732,_0x3f5834){_0x101732=_0x101732-0x0;var _0x56e05d=_0x8a52[_0x101732];return _0x56e05d;};'use strict';var _=require(_0x28a5('0x0'));var util=require(_0x28a5('0x1'));var moment=require(_0x28a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x28a5('0x3'));var fs=require('fs');var Redis=require(_0x28a5('0x4'));var db=require(_0x28a5('0x5'))['db'];var utils=require(_0x28a5('0x6'));var logger=require(_0x28a5('0x7'))('rpc');var config=require(_0x28a5('0x8'));var jayson=require(_0x28a5('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x28a5('0xa')](config[_0x28a5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x28a5('0xc'))(new Redis(config[_0x28a5('0xb')]));require(_0x28a5('0xd'))[_0x28a5('0xe')](socket);function respondWithRpcPromise(_0x13d7e7,_0x5b83ff,_0x19c534){return new BPromise(function(_0x234a9f,_0x1141d7){return client['request'](_0x13d7e7,_0x19c534)[_0x28a5('0xf')](function(_0x317829){logger[_0x28a5('0x10')](_0x28a5('0x11'),_0x5b83ff,_0x28a5('0x12'));logger['debug'](_0x28a5('0x13'),_0x5b83ff,_0x28a5('0x12'),JSON[_0x28a5('0x14')](_0x317829));if(_0x317829[_0x28a5('0x15')]){if(_0x317829[_0x28a5('0x15')][_0x28a5('0x16')]===0x1f4){logger[_0x28a5('0x15')](_0x28a5('0x11'),_0x5b83ff,_0x317829[_0x28a5('0x15')][_0x28a5('0x17')]);return _0x1141d7(_0x317829[_0x28a5('0x15')]['message']);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x5b83ff,_0x317829[_0x28a5('0x15')][_0x28a5('0x17')]);return _0x234a9f(_0x317829['error'][_0x28a5('0x17')]);}else{logger[_0x28a5('0x10')](_0x28a5('0x11'),_0x5b83ff,_0x28a5('0x12'));_0x234a9f(_0x317829[_0x28a5('0x18')]['message']);}})[_0x28a5('0x19')](function(_0x4563f3){logger[_0x28a5('0x15')]('DashboardItem,\x20%s,\x20%s',_0x5b83ff,_0x4563f3);_0x1141d7(_0x4563f3);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 679d4ab..77a47ed 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 _0x5f15=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x2368c1,_0x1e7cc6){var _0x1f1b07=function(_0x88b66){while(--_0x88b66){_0x2368c1['push'](_0x2368c1['shift']());}};_0x1f1b07(++_0x1e7cc6);}(_0x5f15,0xa5));var _0x55f1=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5f15[_0xfae23b];return _0x200640;};'use strict';var DashboardItemEvents=require(_0x55f1('0x0'));var events=[_0x55f1('0x1'),_0x55f1('0x2'),'update'];function createListener(_0x449bf0,_0x218a09){return function(_0x33133d){_0x218a09[_0x55f1('0x3')](_0x449bf0,_0x33133d);};}function removeListener(_0x3fe72a,_0x80eb17){return function(){DashboardItemEvents[_0x55f1('0x4')](_0x3fe72a,_0x80eb17);};}exports[_0x55f1('0x5')]=function(_0x29803d){for(var _0x117b40=0x0,_0x24ef1d=events[_0x55f1('0x6')];_0x117b40<_0x24ef1d;_0x117b40++){var _0x2d910e=events[_0x117b40];var _0x26ad3f=createListener(_0x55f1('0x7')+_0x2d910e,_0x29803d);DashboardItemEvents['on'](_0x2d910e,_0x26ad3f);}}; \ No newline at end of file +var _0x4da6=['emit','removeListener','register','dashboardItem:','./dashboardItem.events','remove','update'];(function(_0x40c194,_0xb1c83c){var _0x3209f6=function(_0x19517e){while(--_0x19517e){_0x40c194['push'](_0x40c194['shift']());}};_0x3209f6(++_0xb1c83c);}(_0x4da6,0xeb));var _0x64da=function(_0x273b98,_0x3e9c75){_0x273b98=_0x273b98-0x0;var _0x2e38fb=_0x4da6[_0x273b98];return _0x2e38fb;};'use strict';var DashboardItemEvents=require(_0x64da('0x0'));var events=['save',_0x64da('0x1'),_0x64da('0x2')];function createListener(_0x47abc6,_0x334eb8){return function(_0x38f7f6){_0x334eb8[_0x64da('0x3')](_0x47abc6,_0x38f7f6);};}function removeListener(_0x5d9357,_0x98ed4f){return function(){DashboardItemEvents[_0x64da('0x4')](_0x5d9357,_0x98ed4f);};}exports[_0x64da('0x5')]=function(_0x33ee59){for(var _0x23c700=0x0,_0x26844c=events['length'];_0x23c700<_0x26844c;_0x23c700++){var _0x33801c=events[_0x23c700];var _0x4bb6ec=createListener(_0x64da('0x6')+_0x33801c,_0x33ee59);DashboardItemEvents['on'](_0x33801c,_0x4bb6ec);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index b3626b7..5db3b50 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 _0x814b=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','put'];(function(_0x2dee01,_0x47c04d){var _0x3d6408=function(_0xdc5e5f){while(--_0xdc5e5f){_0x2dee01['push'](_0x2dee01['shift']());}};_0x3d6408(++_0x47c04d);}(_0x814b,0x1a2));var _0xb814=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x814b[_0x25d386];return _0x857f4a;};'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')](_0xb814('0xa'),auth[_0xb814('0xb')](),controller['show']);router[_0xb814('0xc')]('/',auth[_0xb814('0xb')](),controller['create']);router[_0xb814('0xd')](_0xb814('0xa'),auth[_0xb814('0xb')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')](_0xb814('0xa'),auth[_0xb814('0xb')](),controller[_0xb814('0x10')]);module[_0xb814('0x11')]=router; \ No newline at end of file +var _0x187d=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0x187d,0x93));var _0xd187=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x187d[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var auth=require(_0xd187('0x5'));var interaction=require(_0xd187('0x6'));var config=require('../../config/environment');var controller=require(_0xd187('0x7'));router[_0xd187('0x8')]('/:id',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0xc')]);router[_0xd187('0xd')](_0xd187('0xe'),auth[_0xd187('0x9')](),controller['update']);router[_0xd187('0xf')](_0xd187('0xe'),auth[_0xd187('0x9')](),controller[_0xd187('0x10')]);module[_0xd187('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 66f1939..5be200c 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 _0xb931=['second','sequelize','exports','STRING','ENUM','first'];(function(_0x2aeac7,_0x47c8fa){var _0x52cc45=function(_0x40485b){while(--_0x40485b){_0x2aeac7['push'](_0x2aeac7['shift']());}};_0x52cc45(++_0x47c8fa);}(_0xb931,0xdf));var _0x1b93=function(_0x255706,_0x4e7e0e){_0x255706=_0x255706-0x0;var _0xd7c8f3=_0xb931[_0x255706];return _0xd7c8f3;};'use strict';var Sequelize=require(_0x1b93('0x0'));module[_0x1b93('0x1')]={'name':{'type':Sequelize[_0x1b93('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x1b93('0x3')](_0x1b93('0x4'),_0x1b93('0x5'),'third'),'allowNull':![],'defaultValue':_0x1b93('0x4')},'description':{'type':Sequelize[_0x1b93('0x2')]}}; \ No newline at end of file +var _0x3006=['third','exports','STRING','first','second'];(function(_0x2cd193,_0x32487b){var _0x274066=function(_0x11ec87){while(--_0x11ec87){_0x2cd193['push'](_0x2cd193['shift']());}};_0x274066(++_0x32487b);}(_0x3006,0x65));var _0x6300=function(_0x3be314,_0x5f157b){_0x3be314=_0x3be314-0x0;var _0x1a2ac0=_0x3006[_0x3be314];return _0x1a2ac0;};'use strict';var Sequelize=require('sequelize');module[_0x6300('0x0')]={'name':{'type':Sequelize[_0x6300('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x6300('0x2'),_0x6300('0x3'),_0x6300('0x4')),'allowNull':![],'defaultValue':_0x6300('0x2')},'description':{'type':Sequelize[_0x6300('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 6c9a5da..0073484 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 _0x2cf9=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','get','Dispositions','destroy','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cf9,0xaa));var _0x92cf=function(_0x18e696,_0x566133){_0x18e696=_0x18e696-0x0;var _0x1e4f52=_0x2cf9[_0x18e696];return _0x1e4f52;};'use strict';var pdf=require(_0x92cf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x92cf('0x1'));var zipdir=require(_0x92cf('0x2'));var jsonpatch=require(_0x92cf('0x3'));var rp=require(_0x92cf('0x4'));var moment=require(_0x92cf('0x5'));var BPromise=require(_0x92cf('0x6'));var Mustache=require(_0x92cf('0x7'));var util=require(_0x92cf('0x8'));var path=require(_0x92cf('0x9'));var sox=require(_0x92cf('0xa'));var csv=require('to-csv');var ejs=require(_0x92cf('0xb'));var fs=require('fs');var _=require(_0x92cf('0xc'));var squel=require(_0x92cf('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x92cf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x92cf('0xf'));var Papa=require(_0x92cf('0x10'));var Redis=require('ioredis');var authService=require(_0x92cf('0x11'));var qs=require(_0x92cf('0x12'));var as=require(_0x92cf('0x13'));var hardwareService=require(_0x92cf('0x14'));var logger=require(_0x92cf('0x15'))(_0x92cf('0x16'));var utils=require(_0x92cf('0x17'));var config=require(_0x92cf('0x18'));var licenseUtil=require(_0x92cf('0x19'));var db=require(_0x92cf('0x1a'))['db'];function respondWithStatusCode(_0x1030ab,_0x31f825){_0x31f825=_0x31f825||0xcc;return function(_0x1dc6fd){if(_0x1dc6fd){return _0x1030ab[_0x92cf('0x1b')](_0x31f825);}return _0x1030ab[_0x92cf('0x1c')](_0x31f825)[_0x92cf('0x1d')]();};}function respondWithResult(_0x4577f7,_0x5b725f){_0x5b725f=_0x5b725f||0xc8;return function(_0x1b1d4d){if(_0x1b1d4d){return _0x4577f7['status'](_0x5b725f)[_0x92cf('0x1e')](_0x1b1d4d);}};}function respondWithFilteredResult(_0x5c2d7d,_0x35add4){return function(_0x1cf0ee){if(_0x1cf0ee){var _0x99ec1c=_0x1cf0ee[_0x92cf('0x1f')],_0x3cc67a=_0x35add4[_0x92cf('0x20')],_0x56be7f=_0x35add4[_0x92cf('0x20')]+_0x35add4[_0x92cf('0x21')],_0x54b710;if(_0x56be7f>=_0x99ec1c){_0x56be7f=_0x99ec1c;_0x54b710=0xc8;}else{_0x54b710=0xce;}_0x5c2d7d[_0x92cf('0x1c')](_0x54b710);return _0x5c2d7d[_0x92cf('0x22')](_0x92cf('0x23'),_0x3cc67a+'-'+_0x56be7f+'/'+_0x99ec1c)[_0x92cf('0x1e')](_0x1cf0ee);}return null;};}function patchUpdates(_0x6858d6){return function(_0x426157){try{jsonpatch[_0x92cf('0x24')](_0x426157,_0x6858d6,!![]);}catch(_0x45e128){return BPromise['reject'](_0x45e128);}return _0x426157['save']();};}function saveUpdates(_0x52d51a,_0x5b4a7e){return function(_0x11c4a9){if(_0x11c4a9){return _0x11c4a9[_0x92cf('0x25')](_0x52d51a)[_0x92cf('0x26')](function(_0x2606d7){return _0x2606d7;});}return null;};}function removeEntity(_0x19dcc1,_0x47ceb0){return function(_0x37bd19){if(_0x37bd19){return _0x37bd19['destroy']()[_0x92cf('0x26')](function(){var _0x222c6d=_0x37bd19[_0x92cf('0x27')]({'plain':!![]});var _0x2097f5=_0x92cf('0x28');return db['UserProfileResource'][_0x92cf('0x29')]({'where':{'type':_0x2097f5,'resourceId':_0x222c6d['id']}})[_0x92cf('0x26')](function(){return _0x37bd19;});})[_0x92cf('0x26')](function(){_0x19dcc1[_0x92cf('0x1c')](0xcc)[_0x92cf('0x1d')]();});}};}function handleEntityNotFound(_0x22e842,_0x419646){return function(_0xf4817d){if(!_0xf4817d){_0x22e842['sendStatus'](0x194);}return _0xf4817d;};}function handleError(_0x518ab5,_0x42f990){_0x42f990=_0x42f990||0x1f4;return function(_0x16b3a0){logger['error'](_0x16b3a0[_0x92cf('0x2a')]);if(_0x16b3a0[_0x92cf('0x2b')]){delete _0x16b3a0[_0x92cf('0x2b')];}_0x518ab5[_0x92cf('0x1c')](_0x42f990)['send'](_0x16b3a0);};}exports[_0x92cf('0x2c')]=function(_0x41b657,_0x30b903){var _0x111e3f={},_0x5d3600={},_0x5b4ba6={'count':0x0,'rows':[]};var _0x1ad280=_[_0x92cf('0x2d')](db[_0x92cf('0x2e')][_0x92cf('0x2f')],function(_0x7875af){return{'name':_0x7875af[_0x92cf('0x30')],'type':_0x7875af[_0x92cf('0x31')][_0x92cf('0x32')]};});_0x5d3600[_0x92cf('0x33')]=_['map'](_0x1ad280,_0x92cf('0x2b'));_0x5d3600['query']=_['keys'](_0x41b657['query']);_0x5d3600[_0x92cf('0x34')]=_[_0x92cf('0x35')](_0x5d3600['model'],_0x5d3600[_0x92cf('0x36')]);_0x111e3f[_0x92cf('0x37')]=_[_0x92cf('0x35')](_0x5d3600[_0x92cf('0x33')],qs[_0x92cf('0x38')](_0x41b657[_0x92cf('0x36')][_0x92cf('0x38')]));_0x111e3f[_0x92cf('0x37')]=_0x111e3f[_0x92cf('0x37')][_0x92cf('0x39')]?_0x111e3f[_0x92cf('0x37')]:_0x5d3600['model'];if(!_0x41b657['query'][_0x92cf('0x3a')](_0x92cf('0x3b'))){_0x111e3f[_0x92cf('0x21')]=qs[_0x92cf('0x21')](_0x41b657[_0x92cf('0x36')][_0x92cf('0x21')]);_0x111e3f[_0x92cf('0x20')]=qs[_0x92cf('0x20')](_0x41b657[_0x92cf('0x36')][_0x92cf('0x20')]);}_0x111e3f['order']=qs['sort'](_0x41b657[_0x92cf('0x36')][_0x92cf('0x3c')]);_0x111e3f[_0x92cf('0x3d')]=qs[_0x92cf('0x34')](_[_0x92cf('0x3e')](_0x41b657[_0x92cf('0x36')],_0x5d3600[_0x92cf('0x34')]),_0x1ad280);if(_0x41b657[_0x92cf('0x36')][_0x92cf('0x3f')]){_0x111e3f['where']=_[_0x92cf('0x40')](_0x111e3f['where'],{'$or':_[_0x92cf('0x2d')](_0x1ad280,function(_0xea7a24){if(_0xea7a24[_0x92cf('0x31')]!==_0x92cf('0x41')){var _0x75aa00={};_0x75aa00[_0xea7a24[_0x92cf('0x2b')]]={'$like':'%'+_0x41b657['query'][_0x92cf('0x3f')]+'%'};return _0x75aa00;}})});}_0x111e3f=_[_0x92cf('0x40')]({},_0x111e3f,_0x41b657['options']);var _0x385a2e={'where':_0x111e3f['where']};return db[_0x92cf('0x2e')][_0x92cf('0x1f')](_0x385a2e)['then'](function(_0x94a55e){_0x5b4ba6[_0x92cf('0x1f')]=_0x94a55e;if(_0x41b657[_0x92cf('0x36')][_0x92cf('0x42')]){_0x111e3f[_0x92cf('0x43')]=[{'all':!![]}];}return db[_0x92cf('0x2e')][_0x92cf('0x44')](_0x111e3f);})[_0x92cf('0x26')](function(_0x3c2de4){_0x5b4ba6[_0x92cf('0x45')]=_0x3c2de4;return _0x5b4ba6;})[_0x92cf('0x26')](respondWithFilteredResult(_0x30b903,_0x111e3f))[_0x92cf('0x46')](handleError(_0x30b903,null));};exports[_0x92cf('0x47')]=function(_0x41878e,_0x31c375){var _0xc2069d={'raw':!![],'where':{'id':_0x41878e[_0x92cf('0x48')]['id']}},_0x2b1f77={};_0x2b1f77[_0x92cf('0x33')]=_[_0x92cf('0x49')](db[_0x92cf('0x2e')]['rawAttributes']);_0x2b1f77[_0x92cf('0x36')]=_[_0x92cf('0x49')](_0x41878e[_0x92cf('0x36')]);_0x2b1f77[_0x92cf('0x34')]=_[_0x92cf('0x35')](_0x2b1f77[_0x92cf('0x33')],_0x2b1f77[_0x92cf('0x36')]);_0xc2069d[_0x92cf('0x37')]=_[_0x92cf('0x35')](_0x2b1f77[_0x92cf('0x33')],qs[_0x92cf('0x38')](_0x41878e[_0x92cf('0x36')][_0x92cf('0x38')]));_0xc2069d['attributes']=_0xc2069d[_0x92cf('0x37')][_0x92cf('0x39')]?_0xc2069d[_0x92cf('0x37')]:_0x2b1f77['model'];if(_0x41878e[_0x92cf('0x36')][_0x92cf('0x42')]){_0xc2069d[_0x92cf('0x43')]=[{'all':!![]}];}_0xc2069d=_[_0x92cf('0x40')]({},_0xc2069d,_0x41878e[_0x92cf('0x4a')]);return db[_0x92cf('0x2e')][_0x92cf('0x4b')](_0xc2069d)[_0x92cf('0x26')](handleEntityNotFound(_0x31c375,null))['then'](respondWithResult(_0x31c375,null))[_0x92cf('0x46')](handleError(_0x31c375,null));};exports['create']=function(_0x4d68cb,_0xbb288d){return db['Disposition']['create'](_0x4d68cb[_0x92cf('0x4c')],{})[_0x92cf('0x26')](function(_0x146b45){var _0x3f90b4=_0x4d68cb[_0x92cf('0x4d')]['get']({'plain':!![]});if(!_0x3f90b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f90b4[_0x92cf('0x4e')]===_0x92cf('0x4d')){var _0x14d809=_0x146b45[_0x92cf('0x27')]({'plain':!![]});var _0x2d1e3b=_0x92cf('0x28');return db[_0x92cf('0x4f')][_0x92cf('0x4b')]({'where':{'name':_0x2d1e3b,'userProfileId':_0x3f90b4[_0x92cf('0x50')]},'raw':!![]})['then'](function(_0x346215){if(_0x346215&&_0x346215[_0x92cf('0x51')]===0x0){return db[_0x92cf('0x52')][_0x92cf('0x53')]({'name':_0x14d809[_0x92cf('0x2b')],'resourceId':_0x14d809['id'],'type':_0x346215[_0x92cf('0x2b')],'sectionId':_0x346215['id']},{})[_0x92cf('0x26')](function(){return _0x146b45;});}else{return _0x146b45;}})[_0x92cf('0x46')](function(_0x389a0a){logger[_0x92cf('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x389a0a);throw _0x389a0a;});}return _0x146b45;})['then'](respondWithResult(_0xbb288d,0xc9))['catch'](handleError(_0xbb288d,null));};exports[_0x92cf('0x25')]=function(_0x58a4ba,_0x2b0d35){if(_0x58a4ba[_0x92cf('0x4c')]['id']){delete _0x58a4ba['body']['id'];}return db[_0x92cf('0x2e')][_0x92cf('0x4b')]({'where':{'id':_0x58a4ba[_0x92cf('0x48')]['id']}})[_0x92cf('0x26')](handleEntityNotFound(_0x2b0d35,null))[_0x92cf('0x26')](saveUpdates(_0x58a4ba[_0x92cf('0x4c')],null))[_0x92cf('0x26')](respondWithResult(_0x2b0d35,null))[_0x92cf('0x46')](handleError(_0x2b0d35,null));};exports[_0x92cf('0x29')]=function(_0x8abdda,_0x3fe38a){return db[_0x92cf('0x2e')]['find']({'where':{'id':_0x8abdda[_0x92cf('0x48')]['id']}})[_0x92cf('0x26')](handleEntityNotFound(_0x3fe38a,null))[_0x92cf('0x26')](removeEntity(_0x3fe38a,null))[_0x92cf('0x46')](handleError(_0x3fe38a,null));}; \ No newline at end of file +var _0xa696=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','stack','name','index','Disposition','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','show','params','keys','find','catch','create','body','role','user','UserProfileSection','userProfileId','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x35ad40,_0x1ac867){var _0x7e1304=function(_0x59d1a7){while(--_0x59d1a7){_0x35ad40['push'](_0x35ad40['shift']());}};_0x7e1304(++_0x1ac867);}(_0xa696,0x1ca));var _0x6a69=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xa696[_0x2b5513];return _0x578fd2;};'use strict';var pdf=require(_0x6a69('0x0'));var emlformat=require(_0x6a69('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6a69('0x2'));var jsonpatch=require(_0x6a69('0x3'));var rp=require('request-promise');var moment=require(_0x6a69('0x4'));var BPromise=require(_0x6a69('0x5'));var Mustache=require(_0x6a69('0x6'));var util=require(_0x6a69('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6a69('0x8'));var ejs=require(_0x6a69('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6a69('0xa'));var crypto=require(_0x6a69('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6a69('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6a69('0xd'));var Redis=require('ioredis');var authService=require(_0x6a69('0xe'));var qs=require(_0x6a69('0xf'));var as=require(_0x6a69('0x10'));var hardwareService=require(_0x6a69('0x11'));var logger=require(_0x6a69('0x12'))(_0x6a69('0x13'));var utils=require(_0x6a69('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6a69('0x15'));var db=require(_0x6a69('0x16'))['db'];function respondWithStatusCode(_0x1963f1,_0x24e517){_0x24e517=_0x24e517||0xcc;return function(_0x3b8d5d){if(_0x3b8d5d){return _0x1963f1[_0x6a69('0x17')](_0x24e517);}return _0x1963f1[_0x6a69('0x18')](_0x24e517)[_0x6a69('0x19')]();};}function respondWithResult(_0x302cf8,_0x28496a){_0x28496a=_0x28496a||0xc8;return function(_0x1ae166){if(_0x1ae166){return _0x302cf8[_0x6a69('0x18')](_0x28496a)['json'](_0x1ae166);}};}function respondWithFilteredResult(_0x3852c8,_0x5d9aa1){return function(_0x549cae){if(_0x549cae){var _0x35638f=_0x549cae[_0x6a69('0x1a')],_0x373ed3=_0x5d9aa1[_0x6a69('0x1b')],_0x5795ea=_0x5d9aa1[_0x6a69('0x1b')]+_0x5d9aa1[_0x6a69('0x1c')],_0x6335a2;if(_0x5795ea>=_0x35638f){_0x5795ea=_0x35638f;_0x6335a2=0xc8;}else{_0x6335a2=0xce;}_0x3852c8[_0x6a69('0x18')](_0x6335a2);return _0x3852c8[_0x6a69('0x1d')](_0x6a69('0x1e'),_0x373ed3+'-'+_0x5795ea+'/'+_0x35638f)[_0x6a69('0x1f')](_0x549cae);}return null;};}function patchUpdates(_0x267005){return function(_0x264ab5){try{jsonpatch[_0x6a69('0x20')](_0x264ab5,_0x267005,!![]);}catch(_0x16c142){return BPromise[_0x6a69('0x21')](_0x16c142);}return _0x264ab5[_0x6a69('0x22')]();};}function saveUpdates(_0xc77fb7,_0x45bd9a){return function(_0x41caa2){if(_0x41caa2){return _0x41caa2[_0x6a69('0x23')](_0xc77fb7)[_0x6a69('0x24')](function(_0x2abdd6){return _0x2abdd6;});}return null;};}function removeEntity(_0x45ee59,_0x47942a){return function(_0x2d1e47){if(_0x2d1e47){return _0x2d1e47[_0x6a69('0x25')]()[_0x6a69('0x24')](function(){var _0x55075d=_0x2d1e47[_0x6a69('0x26')]({'plain':!![]});var _0x53e3df=_0x6a69('0x27');return db[_0x6a69('0x28')][_0x6a69('0x25')]({'where':{'type':_0x53e3df,'resourceId':_0x55075d['id']}})[_0x6a69('0x24')](function(){return _0x2d1e47;});})['then'](function(){_0x45ee59[_0x6a69('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cd17b,_0x548b51){return function(_0x2489d3){if(!_0x2489d3){_0x5cd17b[_0x6a69('0x17')](0x194);}return _0x2489d3;};}function handleError(_0x212018,_0x54f31e){_0x54f31e=_0x54f31e||0x1f4;return function(_0x66ef86){logger['error'](_0x66ef86[_0x6a69('0x29')]);if(_0x66ef86[_0x6a69('0x2a')]){delete _0x66ef86['name'];}_0x212018['status'](_0x54f31e)['send'](_0x66ef86);};}exports[_0x6a69('0x2b')]=function(_0x282fcd,_0x59e22f){var _0x474176={},_0x1fc942={},_0x2234f8={'count':0x0,'rows':[]};var _0x57a43d=_['map'](db[_0x6a69('0x2c')][_0x6a69('0x2d')],function(_0x31acaf){return{'name':_0x31acaf[_0x6a69('0x2e')],'type':_0x31acaf[_0x6a69('0x2f')][_0x6a69('0x30')]};});_0x1fc942[_0x6a69('0x31')]=_[_0x6a69('0x32')](_0x57a43d,_0x6a69('0x2a'));_0x1fc942[_0x6a69('0x33')]=_['keys'](_0x282fcd[_0x6a69('0x33')]);_0x1fc942[_0x6a69('0x34')]=_[_0x6a69('0x35')](_0x1fc942[_0x6a69('0x31')],_0x1fc942[_0x6a69('0x33')]);_0x474176['attributes']=_['intersection'](_0x1fc942['model'],qs[_0x6a69('0x36')](_0x282fcd[_0x6a69('0x33')][_0x6a69('0x36')]));_0x474176['attributes']=_0x474176[_0x6a69('0x37')][_0x6a69('0x38')]?_0x474176[_0x6a69('0x37')]:_0x1fc942[_0x6a69('0x31')];if(!_0x282fcd[_0x6a69('0x33')][_0x6a69('0x39')]('nolimit')){_0x474176[_0x6a69('0x1c')]=qs[_0x6a69('0x1c')](_0x282fcd[_0x6a69('0x33')][_0x6a69('0x1c')]);_0x474176['offset']=qs[_0x6a69('0x1b')](_0x282fcd[_0x6a69('0x33')][_0x6a69('0x1b')]);}_0x474176[_0x6a69('0x3a')]=qs['sort'](_0x282fcd[_0x6a69('0x33')]['sort']);_0x474176['where']=qs['filters'](_[_0x6a69('0x3b')](_0x282fcd[_0x6a69('0x33')],_0x1fc942[_0x6a69('0x34')]),_0x57a43d);if(_0x282fcd[_0x6a69('0x33')][_0x6a69('0x3c')]){_0x474176['where']=_[_0x6a69('0x3d')](_0x474176['where'],{'$or':_[_0x6a69('0x32')](_0x57a43d,function(_0x251a2e){if(_0x251a2e['type']!==_0x6a69('0x3e')){var _0x2f40d8={};_0x2f40d8[_0x251a2e[_0x6a69('0x2a')]]={'$like':'%'+_0x282fcd[_0x6a69('0x33')][_0x6a69('0x3c')]+'%'};return _0x2f40d8;}})});}_0x474176=_[_0x6a69('0x3d')]({},_0x474176,_0x282fcd[_0x6a69('0x3f')]);var _0x20d13d={'where':_0x474176[_0x6a69('0x40')]};return db[_0x6a69('0x2c')]['count'](_0x20d13d)[_0x6a69('0x24')](function(_0x173957){_0x2234f8[_0x6a69('0x1a')]=_0x173957;if(_0x282fcd[_0x6a69('0x33')][_0x6a69('0x41')]){_0x474176[_0x6a69('0x42')]=[{'all':!![]}];}return db[_0x6a69('0x2c')][_0x6a69('0x43')](_0x474176);})[_0x6a69('0x24')](function(_0x8207b0){_0x2234f8['rows']=_0x8207b0;return _0x2234f8;})['then'](respondWithFilteredResult(_0x59e22f,_0x474176))['catch'](handleError(_0x59e22f,null));};exports[_0x6a69('0x44')]=function(_0x55551e,_0x2dfa15){var _0x336653={'raw':!![],'where':{'id':_0x55551e[_0x6a69('0x45')]['id']}},_0x18e457={};_0x18e457[_0x6a69('0x31')]=_['keys'](db[_0x6a69('0x2c')]['rawAttributes']);_0x18e457[_0x6a69('0x33')]=_[_0x6a69('0x46')](_0x55551e[_0x6a69('0x33')]);_0x18e457[_0x6a69('0x34')]=_['intersection'](_0x18e457[_0x6a69('0x31')],_0x18e457[_0x6a69('0x33')]);_0x336653[_0x6a69('0x37')]=_[_0x6a69('0x35')](_0x18e457[_0x6a69('0x31')],qs[_0x6a69('0x36')](_0x55551e[_0x6a69('0x33')][_0x6a69('0x36')]));_0x336653[_0x6a69('0x37')]=_0x336653[_0x6a69('0x37')]['length']?_0x336653[_0x6a69('0x37')]:_0x18e457[_0x6a69('0x31')];if(_0x55551e[_0x6a69('0x33')][_0x6a69('0x41')]){_0x336653[_0x6a69('0x42')]=[{'all':!![]}];}_0x336653=_['merge']({},_0x336653,_0x55551e['options']);return db[_0x6a69('0x2c')][_0x6a69('0x47')](_0x336653)['then'](handleEntityNotFound(_0x2dfa15,null))[_0x6a69('0x24')](respondWithResult(_0x2dfa15,null))[_0x6a69('0x48')](handleError(_0x2dfa15,null));};exports['create']=function(_0x15ddd8,_0x472fd7){return db['Disposition'][_0x6a69('0x49')](_0x15ddd8[_0x6a69('0x4a')],{})[_0x6a69('0x24')](function(_0x42d980){var _0x2b9ff1=_0x15ddd8['user'][_0x6a69('0x26')]({'plain':!![]});if(!_0x2b9ff1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b9ff1[_0x6a69('0x4b')]===_0x6a69('0x4c')){var _0x16f859=_0x42d980['get']({'plain':!![]});var _0x4ef7ac=_0x6a69('0x27');return db[_0x6a69('0x4d')][_0x6a69('0x47')]({'where':{'name':_0x4ef7ac,'userProfileId':_0x2b9ff1[_0x6a69('0x4e')]},'raw':!![]})[_0x6a69('0x24')](function(_0x5ea3f0){if(_0x5ea3f0&&_0x5ea3f0['autoAssociation']===0x0){return db[_0x6a69('0x28')][_0x6a69('0x49')]({'name':_0x16f859[_0x6a69('0x2a')],'resourceId':_0x16f859['id'],'type':_0x5ea3f0[_0x6a69('0x2a')],'sectionId':_0x5ea3f0['id']},{})['then'](function(){return _0x42d980;});}else{return _0x42d980;}})[_0x6a69('0x48')](function(_0x3d252b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d252b);throw _0x3d252b;});}return _0x42d980;})[_0x6a69('0x24')](respondWithResult(_0x472fd7,0xc9))[_0x6a69('0x48')](handleError(_0x472fd7,null));};exports['update']=function(_0x1d21aa,_0x392016){if(_0x1d21aa[_0x6a69('0x4a')]['id']){delete _0x1d21aa[_0x6a69('0x4a')]['id'];}return db[_0x6a69('0x2c')][_0x6a69('0x47')]({'where':{'id':_0x1d21aa[_0x6a69('0x45')]['id']}})[_0x6a69('0x24')](handleEntityNotFound(_0x392016,null))[_0x6a69('0x24')](saveUpdates(_0x1d21aa[_0x6a69('0x4a')],null))[_0x6a69('0x24')](respondWithResult(_0x392016,null))[_0x6a69('0x48')](handleError(_0x392016,null));};exports[_0x6a69('0x25')]=function(_0x348e6d,_0x37fa5b){return db['Disposition'][_0x6a69('0x47')]({'where':{'id':_0x348e6d['params']['id']}})['then'](handleEntityNotFound(_0x37fa5b,null))[_0x6a69('0x24')](removeEntity(_0x37fa5b,null))['catch'](handleError(_0x37fa5b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 76a69f7..4f47745 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 _0xc99e=['exports','define','tools_dispositions','name_voice','ListId','name_chat','name_mail','name','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes'];(function(_0x329808,_0x343255){var _0x1bbad0=function(_0x458c5b){while(--_0x458c5b){_0x329808['push'](_0x329808['shift']());}};_0x1bbad0(++_0x343255);}(_0xc99e,0x6e));var _0xec99=function(_0x31ff61,_0x1f5f2e){_0x31ff61=_0x31ff61-0x0;var _0x36d1d8=_0xc99e[_0x31ff61];return _0x36d1d8;};'use strict';var _=require(_0xec99('0x0'));var util=require(_0xec99('0x1'));var logger=require(_0xec99('0x2'))(_0xec99('0x3'));var moment=require(_0xec99('0x4'));var BPromise=require(_0xec99('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec99('0x6'));var rimraf=require(_0xec99('0x7'));var config=require(_0xec99('0x8'));var attributes=require(_0xec99('0x9'));module[_0xec99('0xa')]=function(_0x39821d,_0x451dd4){return _0x39821d[_0xec99('0xb')]('Disposition',attributes,{'tableName':_0xec99('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xec99('0xd'),'fields':['name',_0xec99('0xe')]},{'unique':!![],'name':_0xec99('0xf'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0xec99('0x10'),'fields':[_0xec99('0x11'),_0xec99('0x12')]},{'unique':!![],'name':'name_sms','fields':[_0xec99('0x11'),_0xec99('0x13')]},{'unique':!![],'name':_0xec99('0x14'),'fields':[_0xec99('0x11'),_0xec99('0x15')]},{'unique':!![],'name':_0xec99('0x16'),'fields':['name',_0xec99('0x17')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xec99('0x11'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d0a=['ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','Disposition','tools_dispositions','name_voice','name'];(function(_0x3d8196,_0x2e6c18){var _0x3ed468=function(_0x26a4d7){while(--_0x26a4d7){_0x3d8196['push'](_0x3d8196['shift']());}};_0x3ed468(++_0x2e6c18);}(_0x8d0a,0x172));var _0xa8d0=function(_0x403e1b,_0x44e26c){_0x403e1b=_0x403e1b-0x0;var _0x4de3fc=_0x8d0a[_0x403e1b];return _0x4de3fc;};'use strict';var _=require(_0xa8d0('0x0'));var util=require(_0xa8d0('0x1'));var logger=require(_0xa8d0('0x2'))('api');var moment=require(_0xa8d0('0x3'));var BPromise=require(_0xa8d0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8d0('0x5'));var rimraf=require(_0xa8d0('0x6'));var config=require(_0xa8d0('0x7'));var attributes=require('./disposition.attributes');module[_0xa8d0('0x8')]=function(_0x134652,_0x397f0f){return _0x134652[_0xa8d0('0x9')](_0xa8d0('0xa'),attributes,{'tableName':_0xa8d0('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xa8d0('0xc'),'fields':[_0xa8d0('0xd'),_0xa8d0('0xe')]},{'unique':!![],'name':_0xa8d0('0xf'),'fields':[_0xa8d0('0xd'),_0xa8d0('0x10')]},{'unique':!![],'name':_0xa8d0('0x11'),'fields':[_0xa8d0('0xd'),_0xa8d0('0x12')]},{'unique':!![],'name':_0xa8d0('0x13'),'fields':[_0xa8d0('0xd'),_0xa8d0('0x14')]},{'unique':!![],'name':_0xa8d0('0x15'),'fields':[_0xa8d0('0xd'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0xa8d0('0xd'),_0xa8d0('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0xa8d0('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index cc7268b..42280c8 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 _0xc9bb=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x5515e1,_0x45c360){var _0x3bd5c2=function(_0x5c0141){while(--_0x5c0141){_0x5515e1['push'](_0x5515e1['shift']());}};_0x3bd5c2(++_0x45c360);}(_0xc9bb,0x8c));var _0xbc9b=function(_0x441f45,_0x16130c){_0x441f45=_0x441f45-0x0;var _0x2bc267=_0xc9bb[_0x441f45];return _0x2bc267;};'use strict';var _=require(_0xbc9b('0x0'));var util=require(_0xbc9b('0x1'));var moment=require('moment');var BPromise=require(_0xbc9b('0x2'));var rs=require(_0xbc9b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc9b('0x4'))['db'];var utils=require(_0xbc9b('0x5'));var logger=require(_0xbc9b('0x6'))(_0xbc9b('0x7'));var config=require(_0xbc9b('0x8'));var jayson=require(_0xbc9b('0x9'));var client=jayson[_0xbc9b('0xa')][_0xbc9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33ba5b,_0x259548,_0x22ef52){return new BPromise(function(_0x3b3028,_0x44656e){return client[_0xbc9b('0xc')](_0x33ba5b,_0x22ef52)[_0xbc9b('0xd')](function(_0x544793){logger[_0xbc9b('0xe')](_0xbc9b('0xf'),_0x259548,'request\x20sent');logger[_0xbc9b('0x10')](_0xbc9b('0x11'),_0x259548,_0xbc9b('0x12'),JSON['stringify'](_0x544793));if(_0x544793[_0xbc9b('0x13')]){if(_0x544793[_0xbc9b('0x13')][_0xbc9b('0x14')]===0x1f4){logger[_0xbc9b('0x13')](_0xbc9b('0xf'),_0x259548,_0x544793[_0xbc9b('0x13')]['message']);return _0x44656e(_0x544793['error']['message']);}logger[_0xbc9b('0x13')]('Disposition,\x20%s,\x20%s',_0x259548,_0x544793[_0xbc9b('0x13')][_0xbc9b('0x15')]);return _0x3b3028(_0x544793[_0xbc9b('0x13')]['message']);}else{logger['info']('Disposition,\x20%s,\x20%s',_0x259548,'request\x20sent');_0x3b3028(_0x544793[_0xbc9b('0x16')][_0xbc9b('0x15')]);}})[_0xbc9b('0x17')](function(_0x350c39){logger[_0xbc9b('0x13')]('Disposition,\x20%s,\x20%s',_0x259548,_0x350c39);_0x44656e(_0x350c39);});});} \ No newline at end of file +var _0x9380=['Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9380,0xcf));var _0x0938=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x9380[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x0938('0x0'));var util=require(_0x0938('0x1'));var moment=require('moment');var BPromise=require(_0x0938('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0938('0x3'))['db'];var utils=require(_0x0938('0x4'));var logger=require(_0x0938('0x5'))(_0x0938('0x6'));var config=require(_0x0938('0x7'));var jayson=require(_0x0938('0x8'));var client=jayson[_0x0938('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59583d,_0x47c829,_0x276fe0){return new BPromise(function(_0x3949ec,_0x362947){return client[_0x0938('0xa')](_0x59583d,_0x276fe0)[_0x0938('0xb')](function(_0x273c44){logger[_0x0938('0xc')](_0x0938('0xd'),_0x47c829,_0x0938('0xe'));logger[_0x0938('0xf')](_0x0938('0x10'),_0x47c829,_0x0938('0xe'),JSON[_0x0938('0x11')](_0x273c44));if(_0x273c44['error']){if(_0x273c44[_0x0938('0x12')][_0x0938('0x13')]===0x1f4){logger['error'](_0x0938('0xd'),_0x47c829,_0x273c44[_0x0938('0x12')][_0x0938('0x14')]);return _0x362947(_0x273c44[_0x0938('0x12')][_0x0938('0x14')]);}logger['error'](_0x0938('0xd'),_0x47c829,_0x273c44[_0x0938('0x12')]['message']);return _0x3949ec(_0x273c44[_0x0938('0x12')][_0x0938('0x14')]);}else{logger[_0x0938('0xc')](_0x0938('0xd'),_0x47c829,_0x0938('0xe'));_0x3949ec(_0x273c44[_0x0938('0x15')][_0x0938('0x14')]);}})['catch'](function(_0x46d2ec){logger[_0x0938('0x12')](_0x0938('0xd'),_0x47c829,_0x46d2ec);_0x362947(_0x46d2ec);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 057f9d6..d43ea20 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 _0x3c7d=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x1d78ab,_0x274068){var _0x5d0f02=function(_0x1eb378){while(--_0x1eb378){_0x1d78ab['push'](_0x1d78ab['shift']());}};_0x5d0f02(++_0x274068);}(_0x3c7d,0x1f2));var _0xd3c7=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x3c7d[_0x409353];return _0x4f4b59;};'use strict';var multer=require(_0xd3c7('0x0'));var util=require(_0xd3c7('0x1'));var path=require(_0xd3c7('0x2'));var timeout=require(_0xd3c7('0x3'));var express=require(_0xd3c7('0x4'));var router=express[_0xd3c7('0x5')]();var auth=require(_0xd3c7('0x6'));var interaction=require(_0xd3c7('0x7'));var config=require(_0xd3c7('0x8'));var controller=require('./disposition.controller');router[_0xd3c7('0x9')]('/',auth[_0xd3c7('0xa')](),controller[_0xd3c7('0xb')]);router['get'](_0xd3c7('0xc'),auth['isAuthenticated'](),controller[_0xd3c7('0xd')]);router[_0xd3c7('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd3c7('0xf')](_0xd3c7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd3c7('0x10')](_0xd3c7('0xc'),auth[_0xd3c7('0xa')](),controller[_0xd3c7('0x11')]);module[_0xd3c7('0x12')]=router; \ No newline at end of file +var _0x39a8=['show','post','isAuthenticated','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','./disposition.controller','get','index'];(function(_0x417b9d,_0x5c8ade){var _0xb842df=function(_0x179bcf){while(--_0x179bcf){_0x417b9d['push'](_0x417b9d['shift']());}};_0xb842df(++_0x5c8ade);}(_0x39a8,0xcf));var _0x839a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x39a8[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x839a('0x0'));var path=require(_0x839a('0x1'));var timeout=require(_0x839a('0x2'));var express=require(_0x839a('0x3'));var router=express[_0x839a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x839a('0x5'));var config=require('../../config/environment');var controller=require(_0x839a('0x6'));router[_0x839a('0x7')]('/',auth['isAuthenticated'](),controller[_0x839a('0x8')]);router[_0x839a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x839a('0x9')]);router[_0x839a('0xa')]('/',auth[_0x839a('0xb')](),controller[_0x839a('0xc')]);router[_0x839a('0xd')](_0x839a('0xe'),auth[_0x839a('0xb')](),controller[_0x839a('0xf')]);router[_0x839a('0x10')]('/:id',auth[_0x839a('0xb')](),controller[_0x839a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 5a7a71c..8447db7 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 _0x01d8=['mandatoryDispositionPauseId','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','7200','12000','9600','14400','v17,v27,v29','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x3e94c1,_0x5b87f8){var _0x25fc60=function(_0x11afce){while(--_0x11afce){_0x3e94c1['push'](_0x3e94c1['shift']());}};_0x25fc60(++_0x5b87f8);}(_0x01d8,0x1bb));var _0x801d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x01d8[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x801d('0x0'));module[_0x801d('0x1')]={'name':{'type':Sequelize[_0x801d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x801d('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x801d('0x3'),'no'),'defaultValue':_0x801d('0x3')},'headerinfo':{'type':Sequelize[_0x801d('0x2')],'defaultValue':_0x801d('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x801d('0x5')},'minrate':{'type':Sequelize[_0x801d('0x6')](_0x801d('0x7'),_0x801d('0x8'),_0x801d('0x9'),'9600',_0x801d('0xa'),'14400'),'defaultValue':_0x801d('0x8')},'maxrate':{'type':Sequelize[_0x801d('0x6')](_0x801d('0x7'),'4800','7200',_0x801d('0xb'),_0x801d('0xa'),_0x801d('0xc')),'defaultValue':_0x801d('0xc')},'modem':{'type':Sequelize[_0x801d('0x2')],'defaultValue':_0x801d('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x801d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x801d('0x6')]('SIP',_0x801d('0xe'),_0x801d('0xf'),_0x801d('0x10')),'defaultValue':_0x801d('0x11')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x801d('0x12')],'defaultValue':function(){return _0x801d('0x13');}},'notificationSound':{'type':Sequelize[_0x801d('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x801d('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x801d('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x801d('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x801d('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x801d('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x801d('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x801d('0x15')],'allowNull':!![],'defaultValue':null,'comment':_0x801d('0x16')},'mandatoryDisposition':{'type':Sequelize[_0x801d('0x14')],'defaultValue':![],'comment':_0x801d('0x17'),'set':function(_0x364d95){if(!_0x364d95)this[_0x801d('0x18')](_0x801d('0x19'),null);this['setDataValue']('mandatoryDisposition',_0x364d95);}}}; \ No newline at end of file +var _0xb5c1=['9600','12000','14400','ENUM','7200','INTEGER','DADHI','SIP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800'];(function(_0x5cd712,_0x1664ea){var _0x25d57c=function(_0x4f2a41){while(--_0x4f2a41){_0x5cd712['push'](_0x5cd712['shift']());}};_0x25d57c(++_0x1664ea);}(_0xb5c1,0xe0));var _0x1b5c=function(_0x6f07e4,_0x454e1d){_0x6f07e4=_0x6f07e4-0x0;var _0x753778=_0xb5c1[_0x6f07e4];return _0x753778;};'use strict';var Sequelize=require('sequelize');module[_0x1b5c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1b5c('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x1b5c('0x2'),'no'),'defaultValue':_0x1b5c('0x2')},'headerinfo':{'type':Sequelize[_0x1b5c('0x1')],'defaultValue':_0x1b5c('0x3')},'localstationid':{'type':Sequelize[_0x1b5c('0x1')],'unique':_0x1b5c('0x4')},'minrate':{'type':Sequelize['ENUM'](_0x1b5c('0x5'),_0x1b5c('0x6'),'7200',_0x1b5c('0x7'),_0x1b5c('0x8'),_0x1b5c('0x9')),'defaultValue':_0x1b5c('0x6')},'maxrate':{'type':Sequelize[_0x1b5c('0xa')](_0x1b5c('0x5'),'4800',_0x1b5c('0xb'),_0x1b5c('0x7'),_0x1b5c('0x8'),_0x1b5c('0x9')),'defaultValue':_0x1b5c('0x9')},'modem':{'type':Sequelize[_0x1b5c('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x1b5c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1b5c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1b5c('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1b5c('0xa')]('SIP','IAX',_0x1b5c('0xd'),'KHOMP'),'defaultValue':_0x1b5c('0xe')},'key':{'type':Sequelize[_0x1b5c('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1b5c('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1b5c('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1b5c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1b5c('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1b5c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1b5c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1b5c('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x1b5c('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x1b5c('0x10')],'defaultValue':![],'comment':_0x1b5c('0x12'),'set':function(_0x17280f){if(!_0x17280f)this[_0x1b5c('0x13')]('mandatoryDispositionPauseId',null);this[_0x1b5c('0x13')](_0x1b5c('0x14'),_0x17280f);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 3795a51..0e00b84 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 _0x4f17=['info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','count','offset','limit','Content-Range','save','then','destroy','get','FaxAccounts','sendStatus','stack','name','send','index','Pause','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','options','FaxAccount','include','findAll','rows','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','mandatoryDispositionPause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','order','sort','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','description','priority','appdata','push','Answer','Set','ecm','gateway','faxdetect','headerinfo','minrate','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','updatedAt','findById','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','server/files/attachments','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','Messages','out','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','request'];(function(_0x262bdb,_0x2b87ae){var _0x11510b=function(_0x47e16f){while(--_0x47e16f){_0x262bdb['push'](_0x262bdb['shift']());}};_0x11510b(++_0x2b87ae);}(_0x4f17,0x9e));var _0x74f1=function(_0xbebf50,_0x44ec09){_0xbebf50=_0xbebf50-0x0;var _0xce1496=_0x4f17[_0xbebf50];return _0xce1496;};'use strict';var pdf=require(_0x74f1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x74f1('0x1'));var zipdir=require(_0x74f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74f1('0x3'));var moment=require(_0x74f1('0x4'));var BPromise=require(_0x74f1('0x5'));var Mustache=require(_0x74f1('0x6'));var util=require(_0x74f1('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x74f1('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x74f1('0x9'));var squel=require('squel');var crypto=require(_0x74f1('0xa'));var jsforce=require(_0x74f1('0xb'));var deskjs=require(_0x74f1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x74f1('0xd'));var Papa=require('papaparse');var Redis=require(_0x74f1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x74f1('0xf'));var as=require(_0x74f1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x74f1('0x11'));var utils=require(_0x74f1('0x12'));var config=require(_0x74f1('0x13'));var licenseUtil=require(_0x74f1('0x14'));var db=require(_0x74f1('0x15'))['db'];config[_0x74f1('0x16')]=_[_0x74f1('0x17')](config[_0x74f1('0x16')],{'host':_0x74f1('0x18'),'port':0x18eb});var socket=require(_0x74f1('0x19'))(new Redis(config['redis']));require(_0x74f1('0x1a'))['register'](socket);var jayson=require(_0x74f1('0x1b'));var client=jayson['client'][_0x74f1('0x1c')]({'port':0x232c});var client9002=jayson[_0x74f1('0x1d')][_0x74f1('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1016a7,_0x33b851,_0x51faf1,_0x2310b0){return new BPromise(function(_0x10a0b1,_0x598573){var _0x387937=_0x2310b0||client;return _0x387937[_0x74f1('0x1e')](_0x1016a7,_0x51faf1)['then'](function(_0x1cc44b){logger[_0x74f1('0x1f')](_0x74f1('0x20'),_0x33b851,_0x74f1('0x21'));logger[_0x74f1('0x22')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x33b851,_0x74f1('0x21'),JSON[_0x74f1('0x23')](_0x1cc44b));if(_0x1cc44b[_0x74f1('0x24')]){if(_0x1cc44b[_0x74f1('0x24')][_0x74f1('0x25')]===0x1f4){logger[_0x74f1('0x24')]('FaxAccount,\x20%s,\x20%s',_0x33b851,_0x1cc44b['error']['message']);return _0x598573(_0x1cc44b[_0x74f1('0x24')][_0x74f1('0x26')]);}logger[_0x74f1('0x24')](_0x74f1('0x20'),_0x33b851,_0x1cc44b[_0x74f1('0x24')][_0x74f1('0x26')]);return _0x10a0b1(_0x1cc44b[_0x74f1('0x24')][_0x74f1('0x26')]);}else{logger[_0x74f1('0x1f')](_0x74f1('0x20'),_0x33b851,_0x74f1('0x21'));_0x10a0b1(_0x1cc44b['result']['message']);}})[_0x74f1('0x27')](function(_0x24e730){logger[_0x74f1('0x24')](_0x74f1('0x20'),_0x33b851,_0x24e730);_0x598573(_0x24e730);});});}function respondWithStatusCode(_0x458194,_0xddbb89){_0xddbb89=_0xddbb89||0xcc;return function(_0xd079b5){if(_0xd079b5){return _0x458194['sendStatus'](_0xddbb89);}return _0x458194[_0x74f1('0x28')](_0xddbb89)[_0x74f1('0x29')]();};}function respondWithResult(_0x59a7ac,_0x1736e3){_0x1736e3=_0x1736e3||0xc8;return function(_0x58d6d8){if(_0x58d6d8){return _0x59a7ac['status'](_0x1736e3)[_0x74f1('0x2a')](_0x58d6d8);}};}function respondWithFilteredResult(_0x37894a,_0x365a2f){return function(_0x27c47e){if(_0x27c47e){var _0x115abf=_0x27c47e[_0x74f1('0x2b')],_0x176340=_0x365a2f[_0x74f1('0x2c')],_0x19390c=_0x365a2f[_0x74f1('0x2c')]+_0x365a2f[_0x74f1('0x2d')],_0x237fcf;if(_0x19390c>=_0x115abf){_0x19390c=_0x115abf;_0x237fcf=0xc8;}else{_0x237fcf=0xce;}_0x37894a[_0x74f1('0x28')](_0x237fcf);return _0x37894a['set'](_0x74f1('0x2e'),_0x176340+'-'+_0x19390c+'/'+_0x115abf)[_0x74f1('0x2a')](_0x27c47e);}return null;};}function patchUpdates(_0x467c02){return function(_0xa191b1){try{jsonpatch['apply'](_0xa191b1,_0x467c02,!![]);}catch(_0x181201){return BPromise['reject'](_0x181201);}return _0xa191b1[_0x74f1('0x2f')]();};}function saveUpdates(_0x32d691,_0x26feaa){return function(_0x106a4c){if(_0x106a4c){return _0x106a4c['update'](_0x32d691)[_0x74f1('0x30')](function(_0x57fe1e){return _0x57fe1e;});}return null;};}function removeEntity(_0x28ac8a,_0x7cdfb7){return function(_0x1a34fd){if(_0x1a34fd){return _0x1a34fd[_0x74f1('0x31')]()[_0x74f1('0x30')](function(){var _0x366472=_0x1a34fd[_0x74f1('0x32')]({'plain':!![]});var _0x3dbb34=_0x74f1('0x33');return db['UserProfileResource'][_0x74f1('0x31')]({'where':{'type':_0x3dbb34,'resourceId':_0x366472['id']}})[_0x74f1('0x30')](function(){return _0x1a34fd;});})['then'](function(){_0x28ac8a[_0x74f1('0x28')](0xcc)[_0x74f1('0x29')]();});}};}function handleEntityNotFound(_0x221c75,_0x2eaad6){return function(_0x4203e4){if(!_0x4203e4){_0x221c75[_0x74f1('0x34')](0x194);}return _0x4203e4;};}function handleError(_0x5410e5,_0x45497f){_0x45497f=_0x45497f||0x1f4;return function(_0x10117b){logger[_0x74f1('0x24')](_0x10117b[_0x74f1('0x35')]);if(_0x10117b[_0x74f1('0x36')]){delete _0x10117b[_0x74f1('0x36')];}_0x5410e5[_0x74f1('0x28')](_0x45497f)[_0x74f1('0x37')](_0x10117b);};}exports[_0x74f1('0x38')]=function(_0x22512c,_0x547de5){var _0x3e9698={'include':[{'model':db[_0x74f1('0x39')],'as':'mandatoryDispositionPause'}]},_0x4c3fbf={},_0x353266={'count':0x0,'rows':[]};var _0xa9b443=_[_0x74f1('0x3a')](db['FaxAccount'][_0x74f1('0x3b')],function(_0x64706e){return{'name':_0x64706e['fieldName'],'type':_0x64706e[_0x74f1('0x3c')][_0x74f1('0x3d')]};});_0x4c3fbf[_0x74f1('0x3e')]=_[_0x74f1('0x3a')](_0xa9b443,_0x74f1('0x36'));_0x4c3fbf[_0x74f1('0x3f')]=_['keys'](_0x22512c['query']);_0x4c3fbf[_0x74f1('0x40')]=_[_0x74f1('0x41')](_0x4c3fbf[_0x74f1('0x3e')],_0x4c3fbf[_0x74f1('0x3f')]);_0x3e9698[_0x74f1('0x42')]=_[_0x74f1('0x41')](_0x4c3fbf[_0x74f1('0x3e')],qs[_0x74f1('0x43')](_0x22512c[_0x74f1('0x3f')][_0x74f1('0x43')]));_0x3e9698['attributes']=_0x3e9698['attributes'][_0x74f1('0x44')]?_0x3e9698['attributes']:_0x4c3fbf[_0x74f1('0x3e')];if(!_0x22512c[_0x74f1('0x3f')][_0x74f1('0x45')]('nolimit')){_0x3e9698[_0x74f1('0x2d')]=qs[_0x74f1('0x2d')](_0x22512c[_0x74f1('0x3f')][_0x74f1('0x2d')]);_0x3e9698[_0x74f1('0x2c')]=qs[_0x74f1('0x2c')](_0x22512c[_0x74f1('0x3f')][_0x74f1('0x2c')]);}_0x3e9698['order']=qs['sort'](_0x22512c[_0x74f1('0x3f')]['sort']);_0x3e9698[_0x74f1('0x46')]=qs[_0x74f1('0x40')](_[_0x74f1('0x47')](_0x22512c[_0x74f1('0x3f')],_0x4c3fbf[_0x74f1('0x40')]),_0xa9b443);if(_0x22512c[_0x74f1('0x3f')][_0x74f1('0x48')]){_0x3e9698['where']=_[_0x74f1('0x49')](_0x3e9698[_0x74f1('0x46')],{'$or':_[_0x74f1('0x3a')](_0xa9b443,function(_0x11f576){if(_0x11f576[_0x74f1('0x3c')]!=='VIRTUAL'){var _0x46ba90={};_0x46ba90[_0x11f576[_0x74f1('0x36')]]={'$like':'%'+_0x22512c[_0x74f1('0x3f')][_0x74f1('0x48')]+'%'};return _0x46ba90;}})});}_0x3e9698=_[_0x74f1('0x49')]({},_0x3e9698,_0x22512c[_0x74f1('0x4a')]);var _0x400090={'where':_0x3e9698[_0x74f1('0x46')]};return db[_0x74f1('0x4b')]['count'](_0x400090)[_0x74f1('0x30')](function(_0x7638c0){_0x353266[_0x74f1('0x2b')]=_0x7638c0;if(_0x22512c['query']['includeAll']){_0x3e9698[_0x74f1('0x4c')]=[{'all':!![]}];}return db[_0x74f1('0x4b')][_0x74f1('0x4d')](_0x3e9698);})[_0x74f1('0x30')](function(_0x3f1a61){_0x353266[_0x74f1('0x4e')]=_0x3f1a61;return _0x353266;})[_0x74f1('0x30')](respondWithFilteredResult(_0x547de5,_0x3e9698))[_0x74f1('0x27')](handleError(_0x547de5,null));};exports['show']=function(_0x17ce42,_0x2c8906){var _0xe025a4={'raw':![],'where':{'id':_0x17ce42[_0x74f1('0x4f')]['id']},'include':[{'model':db[_0x74f1('0x39')],'as':'mandatoryDispositionPause'}]},_0x23bf0d={};_0x23bf0d[_0x74f1('0x3e')]=_[_0x74f1('0x50')](db['FaxAccount'][_0x74f1('0x3b')]);_0x23bf0d[_0x74f1('0x3f')]=_[_0x74f1('0x50')](_0x17ce42[_0x74f1('0x3f')]);_0x23bf0d[_0x74f1('0x40')]=_[_0x74f1('0x41')](_0x23bf0d[_0x74f1('0x3e')],_0x23bf0d[_0x74f1('0x3f')]);_0xe025a4[_0x74f1('0x42')]=_[_0x74f1('0x41')](_0x23bf0d[_0x74f1('0x3e')],qs[_0x74f1('0x43')](_0x17ce42[_0x74f1('0x3f')][_0x74f1('0x43')]));_0xe025a4[_0x74f1('0x42')]=_0xe025a4[_0x74f1('0x42')][_0x74f1('0x44')]?_0xe025a4[_0x74f1('0x42')]:_0x23bf0d[_0x74f1('0x3e')];if(_0x17ce42[_0x74f1('0x3f')][_0x74f1('0x51')]){_0xe025a4[_0x74f1('0x4c')]=[{'all':!![]}];}_0xe025a4=_[_0x74f1('0x49')]({},_0xe025a4,_0x17ce42[_0x74f1('0x4a')]);return db[_0x74f1('0x4b')][_0x74f1('0x52')](_0xe025a4)[_0x74f1('0x30')](handleEntityNotFound(_0x2c8906,null))[_0x74f1('0x30')](respondWithResult(_0x2c8906,null))['catch'](handleError(_0x2c8906,null));};exports[_0x74f1('0x53')]=function(_0x421db8,_0x396ec6){return db[_0x74f1('0x4b')][_0x74f1('0x53')](_0x421db8[_0x74f1('0x54')],{})['then'](function(_0x3bb90d){var _0x132223=_0x421db8[_0x74f1('0x55')][_0x74f1('0x32')]({'plain':!![]});if(!_0x132223)throw new Error(_0x74f1('0x56'));if(_0x132223[_0x74f1('0x57')]===_0x74f1('0x55')){var _0x56963d=_0x3bb90d[_0x74f1('0x32')]({'plain':!![]});var _0x329e4c='FaxAccounts';return db[_0x74f1('0x58')][_0x74f1('0x52')]({'where':{'name':_0x329e4c,'userProfileId':_0x132223['userProfileId']},'raw':!![]})[_0x74f1('0x30')](function(_0x3e7a74){if(_0x3e7a74&&_0x3e7a74[_0x74f1('0x59')]===0x0){return db[_0x74f1('0x5a')][_0x74f1('0x53')]({'name':_0x56963d['name'],'resourceId':_0x56963d['id'],'type':_0x3e7a74[_0x74f1('0x36')],'sectionId':_0x3e7a74['id']},{})['then'](function(){return _0x3bb90d;});}else{return _0x3bb90d;}})[_0x74f1('0x27')](function(_0x181381){logger[_0x74f1('0x24')](_0x74f1('0x5b'),_0x181381);throw _0x181381;});}return _0x3bb90d;})[_0x74f1('0x30')](respondWithResult(_0x396ec6,0xc9))[_0x74f1('0x27')](handleError(_0x396ec6,null));};exports[_0x74f1('0x5c')]=function(_0x338bd6,_0xb74a0b){if(_0x338bd6[_0x74f1('0x54')]['id']){delete _0x338bd6[_0x74f1('0x54')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x338bd6[_0x74f1('0x4f')]['id']},'include':[{'model':db[_0x74f1('0x39')],'as':_0x74f1('0x5d')}]})[_0x74f1('0x30')](handleEntityNotFound(_0xb74a0b,null))[_0x74f1('0x30')](saveUpdates(_0x338bd6['body'],null))[_0x74f1('0x30')](respondWithResult(_0xb74a0b,null))[_0x74f1('0x27')](handleError(_0xb74a0b,null));};exports['destroy']=function(_0x2044a7,_0x1c717e){return db[_0x74f1('0x4b')][_0x74f1('0x52')]({'where':{'id':_0x2044a7[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x1c717e,null))[_0x74f1('0x30')](removeEntity(_0x1c717e,null))['catch'](handleError(_0x1c717e,null));};exports['describe']=function(_0x32dfa3,_0x4e69f5){return db[_0x74f1('0x4b')][_0x74f1('0x5e')]()[_0x74f1('0x30')](respondWithResult(_0x4e69f5,null))['catch'](handleError(_0x4e69f5,null));};exports[_0x74f1('0x5f')]=function(_0x59c362,_0x4aa2a4,_0x8c3bbb){if(_0x59c362['body']['id']){delete _0x59c362[_0x74f1('0x54')]['id'];}return db[_0x74f1('0x4b')][_0x74f1('0x52')]({'where':{'id':_0x59c362[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x4aa2a4,null))[_0x74f1('0x30')](function(_0x379d39){if(_0x379d39){_0x59c362[_0x74f1('0x54')][_0x74f1('0x60')]=_0x379d39['id'];return db[_0x74f1('0x61')][_0x74f1('0x53')](_0x59c362[_0x74f1('0x54')]);}})[_0x74f1('0x30')](respondWithResult(_0x4aa2a4,null))[_0x74f1('0x27')](handleError(_0x4aa2a4,null));};exports[_0x74f1('0x62')]=function(_0x55c50b,_0x42a407,_0x1fd601){var _0x1b0bce={'raw':![],'where':{}};var _0x4aa70f={};var _0x1eca4c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x74f1('0x63')]({'where':{'id':_0x55c50b[_0x74f1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x42a407,null))['then'](function(_0x2c8ab4){if(_0x2c8ab4){_0x4aa70f['model']=_[_0x74f1('0x50')](db[_0x74f1('0x61')][_0x74f1('0x3b')]);_0x4aa70f['query']=_[_0x74f1('0x50')](_0x55c50b[_0x74f1('0x3f')]);_0x4aa70f['filters']=_[_0x74f1('0x41')](_0x4aa70f[_0x74f1('0x3e')],_0x4aa70f[_0x74f1('0x3f')]);_0x1b0bce[_0x74f1('0x42')]=_['intersection'](_0x4aa70f[_0x74f1('0x3e')],qs[_0x74f1('0x43')](_0x55c50b[_0x74f1('0x3f')][_0x74f1('0x43')]));_0x1b0bce[_0x74f1('0x42')]=_0x1b0bce[_0x74f1('0x42')]['length']?_0x1b0bce[_0x74f1('0x42')]:_0x4aa70f[_0x74f1('0x3e')];if(!_0x55c50b[_0x74f1('0x3f')]['hasOwnProperty'](_0x74f1('0x64'))){_0x1b0bce[_0x74f1('0x2d')]=qs[_0x74f1('0x2d')](_0x55c50b[_0x74f1('0x3f')][_0x74f1('0x2d')]);_0x1b0bce[_0x74f1('0x2c')]=qs['offset'](_0x55c50b[_0x74f1('0x3f')]['offset']);}_0x1b0bce[_0x74f1('0x65')]=qs['sort'](_0x55c50b['query'][_0x74f1('0x66')]);_0x1b0bce[_0x74f1('0x46')]=qs[_0x74f1('0x40')](_[_0x74f1('0x47')](_0x55c50b[_0x74f1('0x3f')],_0x4aa70f[_0x74f1('0x40')]));_0x1b0bce[_0x74f1('0x46')][_0x74f1('0x60')]=_0x2c8ab4['id'];if(_0x55c50b[_0x74f1('0x3f')][_0x74f1('0x48')]){_0x1b0bce[_0x74f1('0x46')]=_['merge'](_0x1b0bce[_0x74f1('0x46')],{'$or':_[_0x74f1('0x3a')](_0x1b0bce[_0x74f1('0x42')],function(_0x44973e){var _0x1551a2={};_0x1551a2[_0x44973e]={'$like':'%'+_0x55c50b[_0x74f1('0x3f')][_0x74f1('0x48')]+'%'};return _0x1551a2;})});}_0x1b0bce=_['merge']({},_0x1b0bce,_0x55c50b['options']);return db[_0x74f1('0x61')][_0x74f1('0x2b')]({'where':_0x1b0bce['where']})['then'](function(_0xef9b1b){_0x1eca4c['count']=_0xef9b1b;if(_0x55c50b[_0x74f1('0x3f')][_0x74f1('0x51')]){_0x1b0bce[_0x74f1('0x4c')]=[{'all':!![]}];}return db[_0x74f1('0x61')][_0x74f1('0x4d')](_0x1b0bce);})['then'](function(_0x5345f5){_0x1eca4c['rows']=_0x5345f5;return _0x1eca4c;});}})[_0x74f1('0x30')](respondWithFilteredResult(_0x42a407,_0x1b0bce))[_0x74f1('0x27')](handleError(_0x42a407,null));};exports['removeDispositions']=function(_0x242518,_0x402613,_0x28b9bf){return db['FaxAccount'][_0x74f1('0x52')]({'where':{'id':_0x242518[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x402613,null))[_0x74f1('0x30')](function(_0x30b1ad){if(_0x30b1ad){return _0x30b1ad[_0x74f1('0x67')](_0x242518[_0x74f1('0x3f')][_0x74f1('0x68')]);}})['then'](respondWithStatusCode(_0x402613,null))[_0x74f1('0x27')](handleError(_0x402613,null));};exports[_0x74f1('0x69')]=function(_0xaf1d74,_0x4296c9,_0x284271){if(_0xaf1d74[_0x74f1('0x54')]['id']){delete _0xaf1d74[_0x74f1('0x54')]['id'];}return db[_0x74f1('0x4b')][_0x74f1('0x52')]({'where':{'id':_0xaf1d74[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x4296c9,null))['then'](function(_0x29024d){if(_0x29024d){_0xaf1d74[_0x74f1('0x54')][_0x74f1('0x60')]=_0x29024d['id'];return db[_0x74f1('0x6a')]['create'](_0xaf1d74['body']);}})['then'](respondWithResult(_0x4296c9,null))[_0x74f1('0x27')](handleError(_0x4296c9,null));};exports[_0x74f1('0x6b')]=function(_0x2aa5ba,_0x474a56,_0x2054d6){var _0x2bf4fa={'raw':![],'where':{}};var _0x330a7e={};var _0xeb4a70={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2aa5ba[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x474a56,null))['then'](function(_0x43fa0d){if(_0x43fa0d){_0x330a7e[_0x74f1('0x3e')]=_[_0x74f1('0x50')](db[_0x74f1('0x6a')][_0x74f1('0x3b')]);_0x330a7e[_0x74f1('0x3f')]=_['keys'](_0x2aa5ba[_0x74f1('0x3f')]);_0x330a7e[_0x74f1('0x40')]=_[_0x74f1('0x41')](_0x330a7e[_0x74f1('0x3e')],_0x330a7e['query']);_0x2bf4fa['attributes']=_[_0x74f1('0x41')](_0x330a7e[_0x74f1('0x3e')],qs['fields'](_0x2aa5ba['query'][_0x74f1('0x43')]));_0x2bf4fa[_0x74f1('0x42')]=_0x2bf4fa[_0x74f1('0x42')][_0x74f1('0x44')]?_0x2bf4fa[_0x74f1('0x42')]:_0x330a7e[_0x74f1('0x3e')];if(!_0x2aa5ba['query']['hasOwnProperty'](_0x74f1('0x64'))){_0x2bf4fa['limit']=qs['limit'](_0x2aa5ba[_0x74f1('0x3f')]['limit']);_0x2bf4fa[_0x74f1('0x2c')]=qs[_0x74f1('0x2c')](_0x2aa5ba[_0x74f1('0x3f')][_0x74f1('0x2c')]);}_0x2bf4fa[_0x74f1('0x65')]=qs[_0x74f1('0x66')](_0x2aa5ba[_0x74f1('0x3f')][_0x74f1('0x66')]);_0x2bf4fa[_0x74f1('0x46')]=qs[_0x74f1('0x40')](_[_0x74f1('0x47')](_0x2aa5ba[_0x74f1('0x3f')],_0x330a7e[_0x74f1('0x40')]));_0x2bf4fa[_0x74f1('0x46')][_0x74f1('0x60')]=_0x43fa0d['id'];if(_0x2aa5ba['query'][_0x74f1('0x48')]){_0x2bf4fa['where']=_[_0x74f1('0x49')](_0x2bf4fa[_0x74f1('0x46')],{'$or':_[_0x74f1('0x3a')](_0x2bf4fa[_0x74f1('0x42')],function(_0x3e620e){var _0x4f23cf={};_0x4f23cf[_0x3e620e]={'$like':'%'+_0x2aa5ba[_0x74f1('0x3f')][_0x74f1('0x48')]+'%'};return _0x4f23cf;})});}_0x2bf4fa=_[_0x74f1('0x49')]({},_0x2bf4fa,_0x2aa5ba['options']);return db[_0x74f1('0x6a')]['count']({'where':_0x2bf4fa[_0x74f1('0x46')]})['then'](function(_0x1e3255){_0xeb4a70[_0x74f1('0x2b')]=_0x1e3255;if(_0x2aa5ba[_0x74f1('0x3f')][_0x74f1('0x51')]){_0x2bf4fa[_0x74f1('0x4c')]=[{'all':!![]}];}return db[_0x74f1('0x6a')][_0x74f1('0x4d')](_0x2bf4fa);})[_0x74f1('0x30')](function(_0x548678){_0xeb4a70[_0x74f1('0x4e')]=_0x548678;return _0xeb4a70;});}})[_0x74f1('0x30')](respondWithFilteredResult(_0x474a56,_0x2bf4fa))['catch'](handleError(_0x474a56,null));};exports['removeAnswers']=function(_0x3b0f51,_0xcac1ed,_0x14825b){return db[_0x74f1('0x4b')][_0x74f1('0x52')]({'where':{'id':_0x3b0f51['params']['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0xcac1ed,null))[_0x74f1('0x30')](function(_0x559b5b){if(_0x559b5b){return _0x559b5b[_0x74f1('0x6c')](_0x3b0f51[_0x74f1('0x3f')][_0x74f1('0x68')]);}})[_0x74f1('0x30')](respondWithStatusCode(_0xcac1ed,null))[_0x74f1('0x27')](handleError(_0xcac1ed,null));};exports[_0x74f1('0x6d')]=function(_0x3f6e9f,_0x33fdeb,_0x4c21a4){return db[_0x74f1('0x6e')][_0x74f1('0x52')]({'where':{'id':_0x3f6e9f['params']['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x33fdeb,null))[_0x74f1('0x30')](function(_0x10b511){if(_0x10b511){return _0x10b511[_0x74f1('0x6d')](_0x3f6e9f[_0x74f1('0x54')][_0x74f1('0x68')],_[_0x74f1('0x6f')](_0x3f6e9f['body'],[_0x74f1('0x68'),'id'])||{});}})['then'](respondWithResult(_0x33fdeb,null))[_0x74f1('0x27')](handleError(_0x33fdeb,null));};exports[_0x74f1('0x70')]=function(_0x593920,_0x31fbe6,_0x398b7f){var _0x2b457a={'raw':![],'where':{}};var _0x22bc21={};var _0x386627={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x593920[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x31fbe6,null))['then'](function(_0x51027f){if(_0x51027f){_0x22bc21[_0x74f1('0x3e')]=_[_0x74f1('0x50')](db[_0x74f1('0x6e')]['rawAttributes']);_0x22bc21[_0x74f1('0x3f')]=_[_0x74f1('0x50')](_0x593920[_0x74f1('0x3f')]);_0x22bc21['filters']=_['intersection'](_0x22bc21[_0x74f1('0x3e')],_0x22bc21[_0x74f1('0x3f')]);_0x2b457a[_0x74f1('0x42')]=_[_0x74f1('0x41')](_0x22bc21['model'],qs[_0x74f1('0x43')](_0x593920[_0x74f1('0x3f')]['fields']));_0x2b457a[_0x74f1('0x42')]=_0x2b457a[_0x74f1('0x42')]['length']?_0x2b457a[_0x74f1('0x42')]:_0x22bc21[_0x74f1('0x3e')];if(!_0x593920['query']['hasOwnProperty'](_0x74f1('0x64'))){_0x2b457a[_0x74f1('0x2d')]=qs[_0x74f1('0x2d')](_0x593920['query'][_0x74f1('0x2d')]);_0x2b457a[_0x74f1('0x2c')]=qs['offset'](_0x593920[_0x74f1('0x3f')][_0x74f1('0x2c')]);}_0x2b457a[_0x74f1('0x65')]=qs[_0x74f1('0x66')](_0x593920[_0x74f1('0x3f')][_0x74f1('0x66')]);_0x2b457a[_0x74f1('0x46')]=qs['filters'](_[_0x74f1('0x47')](_0x593920[_0x74f1('0x3f')],_0x22bc21['filters']));_0x2b457a[_0x74f1('0x46')]['FaxAccountId']=_0x51027f['id'];if(_0x593920[_0x74f1('0x3f')]['filter']){_0x2b457a[_0x74f1('0x46')]=_['merge'](_0x2b457a[_0x74f1('0x46')],{'$or':_[_0x74f1('0x3a')](_0x2b457a[_0x74f1('0x42')],function(_0x4d8dc7){var _0x1d59f1={};_0x1d59f1[_0x4d8dc7]={'$like':'%'+_0x593920['query'][_0x74f1('0x48')]+'%'};return _0x1d59f1;})});}_0x2b457a=_[_0x74f1('0x49')]({},_0x2b457a,_0x593920[_0x74f1('0x4a')]);return db[_0x74f1('0x6e')]['count']({'where':_0x2b457a[_0x74f1('0x46')]})[_0x74f1('0x30')](function(_0x3d22d3){_0x386627[_0x74f1('0x2b')]=_0x3d22d3;if(_0x593920[_0x74f1('0x3f')][_0x74f1('0x51')]){_0x2b457a['include']=[{'model':db[_0x74f1('0x71')],'as':_0x74f1('0x72'),'required':![]},{'model':db[_0x74f1('0x73')],'as':_0x74f1('0x74'),'attributes':[_0x74f1('0x36'),_0x74f1('0x75'),'internal'],'required':![]},{'model':db[_0x74f1('0x76')],'as':_0x74f1('0x77'),'attributes':['id',_0x74f1('0x36'),_0x74f1('0x78')],'where':_0x593920[_0x74f1('0x3f')][_0x74f1('0x79')]?{'id':_0x593920[_0x74f1('0x3f')][_0x74f1('0x79')]}:undefined,'required':_0x593920['query']['tag']?!![]:![]}];}return db[_0x74f1('0x6e')][_0x74f1('0x4d')](_0x2b457a);})[_0x74f1('0x30')](function(_0x34bd1b){_0x386627['rows']=_0x34bd1b;return _0x386627;});}})[_0x74f1('0x30')](respondWithFilteredResult(_0x31fbe6,_0x2b457a))['catch'](handleError(_0x31fbe6,null));};exports[_0x74f1('0x7a')]=function(_0x58ac62,_0x3fc35c,_0x579a2a){return db['FaxAccount'][_0x74f1('0x63')]({'where':{'id':_0x58ac62['params']['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x3fc35c,null))[_0x74f1('0x30')](function(_0x46267a){if(_0x46267a){return db[_0x74f1('0x7b')][_0x74f1('0x7c')](function(_0x4007ba){return db['FaxApplication'][_0x74f1('0x31')]({'where':{'FaxAccountId':_0x58ac62[_0x74f1('0x4f')]['id']},'transaction':_0x4007ba})[_0x74f1('0x30')](function(_0x54b7a6){var _0x38a1dc=_[_0x74f1('0x3a')](_0x58ac62[_0x74f1('0x54')],function(_0x1077bd){_0x1077bd[_0x74f1('0x60')]=_0x58ac62['params']['id'];return _0x1077bd;});return db[_0x74f1('0x7d')][_0x74f1('0x7e')](_0x38a1dc,{'transaction':_0x4007ba});});})[_0x74f1('0x30')](function(){return db[_0x74f1('0x7d')][_0x74f1('0x7f')]({'where':{'FaxAccountId':_0x58ac62[_0x74f1('0x4f')]['id']},'order':'priority'});});}})[_0x74f1('0x30')](respondWithResult(_0x3fc35c,null))[_0x74f1('0x27')](handleError(_0x3fc35c,null));};exports['getApplications']=function(_0x541a60,_0x5be9d6,_0x3a86ee){var _0x2faf5c={};var _0x2a1e60={};var _0x3f3001;var _0x238a7f;return db['FaxAccount'][_0x74f1('0x63')]({'where':{'id':_0x541a60[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x5be9d6,null))['then'](function(_0x4b1a21){if(_0x4b1a21){_0x3f3001=_0x4b1a21;_0x2a1e60['model']=_[_0x74f1('0x50')](db[_0x74f1('0x7d')][_0x74f1('0x3b')]);_0x2a1e60['query']=_[_0x74f1('0x50')](_0x541a60[_0x74f1('0x3f')]);_0x2a1e60[_0x74f1('0x40')]=_['intersection'](_0x2a1e60['model'],_0x2a1e60[_0x74f1('0x3f')]);_0x2faf5c['attributes']=_[_0x74f1('0x41')](_0x2a1e60[_0x74f1('0x3e')],qs[_0x74f1('0x43')](_0x541a60[_0x74f1('0x3f')][_0x74f1('0x43')]));_0x2faf5c[_0x74f1('0x42')]=_0x2faf5c[_0x74f1('0x42')][_0x74f1('0x44')]?_0x2faf5c[_0x74f1('0x42')]:_0x2a1e60[_0x74f1('0x3e')];_0x2faf5c[_0x74f1('0x65')]=qs[_0x74f1('0x66')](_0x541a60[_0x74f1('0x3f')][_0x74f1('0x66')]);_0x2faf5c[_0x74f1('0x46')]=qs[_0x74f1('0x40')](_['pick'](_0x541a60[_0x74f1('0x3f')],_0x2a1e60[_0x74f1('0x40')]));if(_0x541a60[_0x74f1('0x3f')][_0x74f1('0x48')]){_0x2faf5c[_0x74f1('0x46')]=_[_0x74f1('0x49')](_0x2faf5c['where'],{'$or':_[_0x74f1('0x3a')](_0x2faf5c[_0x74f1('0x42')],function(_0x448952){var _0x3c3c59={};_0x3c3c59[_0x448952]={'$like':'%'+_0x541a60[_0x74f1('0x3f')][_0x74f1('0x48')]+'%'};return _0x3c3c59;})});}_0x2faf5c=_[_0x74f1('0x49')]({},_0x2faf5c,_0x541a60['options']);return _0x3f3001[_0x74f1('0x80')](_0x2faf5c);}})['then'](function(_0x274868){if(_0x274868){_0x238a7f=_0x274868[_0x74f1('0x44')];if(!_0x541a60[_0x74f1('0x3f')][_0x74f1('0x45')]('nolimit')){_0x2faf5c['limit']=qs['limit'](_0x541a60[_0x74f1('0x3f')][_0x74f1('0x2d')]);_0x2faf5c[_0x74f1('0x2c')]=qs[_0x74f1('0x2c')](_0x541a60[_0x74f1('0x3f')][_0x74f1('0x2c')]);}return _0x3f3001[_0x74f1('0x80')](_0x2faf5c);}})[_0x74f1('0x30')](function(_0x78f858){if(_0x78f858){return _0x78f858?{'count':_0x238a7f,'rows':_0x78f858}:null;}})[_0x74f1('0x30')](respondWithResult(_0x5be9d6,null))['catch'](handleError(_0x5be9d6,null));};function Extension(_0xf090bd,_0x26ee12,_0x44fb0a,_0x517aaa){this[_0x74f1('0x81')]=_0x74f1('0x82');this[_0x74f1('0x83')]=_0xf090bd[_0x74f1('0x84')];this[_0x74f1('0x85')]=_0x517aaa;this['type']='system';this[_0x74f1('0x86')]='Fax\x20Extension';this[_0x74f1('0x60')]=_0xf090bd['id'];this[_0x74f1('0x87')]=_0x26ee12;this[_0x74f1('0x88')]=_0x44fb0a;}function createExtensionsReciveFax(_0x294981){var _0x37b102=0x1;var _0x33e302=[];_0x33e302[_0x74f1('0x89')](new Extension(_0x294981,_0x37b102,'',_0x74f1('0x8a')));_0x37b102+=0x1;_0x33e302['push'](new Extension(_0x294981,_0x37b102,'CDR(type)=inbound-fax',_0x74f1('0x8b')));_0x37b102+=0x1;for(var _0x40ce83 in _0x294981){if(_0x294981[_0x74f1('0x45')](_0x40ce83)&&(_0x40ce83===_0x74f1('0x8c')||_0x40ce83===_0x74f1('0x84')||_0x40ce83===_0x74f1('0x8d')||_0x40ce83===_0x74f1('0x8e')||_0x40ce83===_0x74f1('0x8f')||_0x40ce83==='maxrate'||_0x40ce83===_0x74f1('0x90')||_0x40ce83==='modem'||_0x40ce83===_0x74f1('0x91'))){_0x33e302[_0x74f1('0x89')](new Extension(_0x294981,_0x37b102,_0x74f1('0x92')+_0x40ce83+')='+_0x294981[_0x40ce83],_0x74f1('0x8b')));_0x37b102+=0x1;}}_0x33e302[_0x74f1('0x89')](new Extension(_0x294981,_0x37b102,'6',_0x74f1('0x93')));_0x37b102+=0x1;_0x33e302[_0x74f1('0x89')](new Extension(_0x294981,_0x37b102,'/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',_0x74f1('0x94')));_0x37b102=0x0;return _0x33e302;}exports[_0x74f1('0x95')]=function(_0x36051,_0x4504a8,_0x18a2d3){var _0x1aba2e;return db['sequelize'][_0x74f1('0x7c')](function(_0x505751){return db[_0x74f1('0x4b')][_0x74f1('0x53')](_0x36051[_0x74f1('0x54')],{'transaction':_0x505751})[_0x74f1('0x30')](function(_0x3d282a){_0x1aba2e=_0x3d282a['get']({'plain':!![]});return db[_0x74f1('0x96')][_0x74f1('0x7e')](createExtensionsReciveFax(_0x1aba2e),{'transaction':_0x505751});});})['then'](function(){return _0x1aba2e;})['then'](respondWithResult(_0x4504a8,null))['catch'](handleError(_0x4504a8,null));};exports[_0x74f1('0x97')]=function(_0x223050,_0x491583,_0x9038e3){var _0x3f68da;return db['sequelize'][_0x74f1('0x7c')](function(_0x2cd6e7){return db['FaxAccount'][_0x74f1('0x5c')](_0x223050[_0x74f1('0x54')],{'where':{'id':_0x223050[_0x74f1('0x54')]['id']},'transaction':_0x2cd6e7})[_0x74f1('0x30')](function(_0x3b8d83){return db[_0x74f1('0x96')]['destroy']({'where':{'FaxAccountId':_0x223050[_0x74f1('0x54')]['id']},'transaction':_0x2cd6e7})[_0x74f1('0x30')](function(_0x4b21f9){return db['VoiceExtension'][_0x74f1('0x7e')](createExtensionsReciveFax(_[_0x74f1('0x6f')](_0x223050[_0x74f1('0x54')],['tech',_0x74f1('0x3d'),_0x74f1('0x98'),_0x74f1('0x99'),'TrunkId','ListId'])),{'transaction':_0x2cd6e7});});});})[_0x74f1('0x30')](function(){return db[_0x74f1('0x4b')][_0x74f1('0x9a')](_0x223050[_0x74f1('0x54')]['id']);})[_0x74f1('0x30')](respondWithResult(_0x491583,null))[_0x74f1('0x27')](handleError(_0x491583,null));};exports[_0x74f1('0x9b')]=function(_0x561e06,_0xad4224,_0x6d286){var _0x5586c9={'raw':!![],'where':{}};var _0xcfdeec={};var _0x4369f6={'count':0x0,'rows':[]};return db[_0x74f1('0x4b')][_0x74f1('0x63')]({'where':{'id':_0x561e06['params']['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0xad4224,null))[_0x74f1('0x30')](function(_0x500a1b){if(_0x500a1b){_0xcfdeec[_0x74f1('0x3e')]=_[_0x74f1('0x50')](db['FaxMessage'][_0x74f1('0x3b')]);_0xcfdeec[_0x74f1('0x3f')]=_[_0x74f1('0x50')](_0x561e06[_0x74f1('0x3f')]);_0xcfdeec[_0x74f1('0x40')]=_[_0x74f1('0x41')](_0xcfdeec[_0x74f1('0x3e')],_0xcfdeec[_0x74f1('0x3f')]);_0x5586c9[_0x74f1('0x42')]=_[_0x74f1('0x41')](_0xcfdeec[_0x74f1('0x3e')],qs['fields'](_0x561e06[_0x74f1('0x3f')][_0x74f1('0x43')]));_0x5586c9[_0x74f1('0x42')]=_0x5586c9[_0x74f1('0x42')][_0x74f1('0x44')]?_0x5586c9['attributes']:_0xcfdeec[_0x74f1('0x3e')];if(!_0x561e06[_0x74f1('0x3f')][_0x74f1('0x45')](_0x74f1('0x64'))){_0x5586c9['limit']=qs[_0x74f1('0x2d')](_0x561e06[_0x74f1('0x3f')]['limit']);_0x5586c9[_0x74f1('0x2c')]=qs['offset'](_0x561e06['query'][_0x74f1('0x2c')]);}_0x5586c9[_0x74f1('0x65')]=qs[_0x74f1('0x66')](_0x561e06[_0x74f1('0x3f')][_0x74f1('0x66')]);_0x5586c9[_0x74f1('0x46')]=qs[_0x74f1('0x40')](_[_0x74f1('0x47')](_0x561e06[_0x74f1('0x3f')],_0xcfdeec[_0x74f1('0x40')]));_0x5586c9[_0x74f1('0x46')][_0x74f1('0x60')]=_0x500a1b['id'];if(_0x561e06[_0x74f1('0x3f')][_0x74f1('0x48')]){_0x5586c9[_0x74f1('0x46')]=_[_0x74f1('0x49')](_0x5586c9[_0x74f1('0x46')],{'$or':_['map'](_0x5586c9['attributes'],function(_0x31ebb3){var _0x114d99={};_0x114d99[_0x31ebb3]={'$like':'%'+_0x561e06['query'][_0x74f1('0x48')]+'%'};return _0x114d99;})});}if(_0x561e06['query'][_0x74f1('0x9c')]){var _0x51b224=_0x561e06[_0x74f1('0x3f')][_0x74f1('0x9c')]['split'](',');var _0x31a65a={};_0x31a65a[_0x51b224[0x0]]={'$gte':moment(_0x51b224[0x1])[_0x74f1('0x9d')](_0x74f1('0x9e'))};_0x5586c9[_0x74f1('0x46')]=_[_0x74f1('0x49')](_0x5586c9['where'],_0x31a65a);}_0x5586c9=_[_0x74f1('0x49')]({},_0x5586c9,_0x561e06[_0x74f1('0x4a')]);return db[_0x74f1('0x9f')][_0x74f1('0x2b')]({'where':_0x5586c9[_0x74f1('0x46')]})[_0x74f1('0x30')](function(_0x50f2f2){_0x4369f6[_0x74f1('0x2b')]=_0x50f2f2;if(_0x561e06[_0x74f1('0x3f')]['includeAll']){_0x5586c9[_0x74f1('0x4c')]=[{'all':!![]}];}return db[_0x74f1('0x9f')]['findAll'](_0x5586c9);})[_0x74f1('0x30')](function(_0x4ef47c){_0x4369f6[_0x74f1('0x4e')]=_0x4ef47c;return _0x4369f6;});}})['then'](respondWithFilteredResult(_0xad4224,_0x5586c9))[_0x74f1('0x27')](handleError(_0xad4224,null));};exports[_0x74f1('0x37')]=function(_0x3b73da,_0x282cbe,_0x5b7c63){var _0x1be630,_0x307c50={},_0x5dd376;if(_0x3b73da['body']['to']){_0x5dd376=_0x3b73da[_0x74f1('0x54')]['to'][0x0];}return db[_0x74f1('0x4b')]['find']({'where':{'id':_0x3b73da[_0x74f1('0x4f')]['id']},'include':[{'model':db[_0x74f1('0xa0')],'as':_0x74f1('0xa1'),'include':[{'model':db[_0x74f1('0x71')],'as':_0x74f1('0xa2'),'where':{'fax':_0x5dd376},'limit':0x1,'order':[[_0x74f1('0x99'),_0x74f1('0xa3')]]}]}]})[_0x74f1('0x30')](handleEntityNotFound(_0x282cbe,null))[_0x74f1('0x30')](function(_0x256087){_0x1be630=_0x256087;if(_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')]&&_0x3b73da[_0x74f1('0x54')]['attachments'][_0x74f1('0x44')]){for(var _0x12c936=0x0;_0x12c936<_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')]['length'];_0x12c936+=0x1){_0x3b73da[_0x74f1('0x54')]['attachments'][_0x12c936]={'filename':_0x3b73da[_0x74f1('0x54')]['attachments'][_0x12c936]['name'],'id':_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][_0x12c936]['id'],'path':path['join'](config['root'],_0x74f1('0xa5'),_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][_0x12c936]['basename'])};}}return respondWithRpcPromise(_0x74f1('0xa6'),_0x74f1('0xa6'),{'FaxAccountId':_[_0x74f1('0xa7')](_0x3b73da['params']['id'])?undefined:_0x3b73da[_0x74f1('0x4f')]['id'],'path':_[_0x74f1('0xa7')](_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][0x0][_0x74f1('0xa8')])?undefined:_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][0x0][_0x74f1('0xa8')],'fax':_[_0x74f1('0xa7')](_0x3b73da[_0x74f1('0x54')]['to'][0x0])?undefined:_0x3b73da[_0x74f1('0x54')]['to'][0x0]},client9002);})['then'](function(){if(_0x1be630){if(_['isNil'](_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa9')])){_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa9')]=util[_0x74f1('0x9d')](_0x74f1('0xaa'),_0x1be630['name'],_0x1be630[_0x74f1('0xab')]);}if(_0x1be630[_0x74f1('0xa1')]){if(_0x1be630[_0x74f1('0xa1')][_0x74f1('0xa2')]['length']){return _0x1be630[_0x74f1('0xa1')][_0x74f1('0xa2')][0x0];}else{return db[_0x74f1('0x71')][_0x74f1('0x53')](_[_0x74f1('0x17')](_0x3b73da['body'],{'firstName':_0x3b73da[_0x74f1('0x54')]['to'][0x0],'phone':_0x3b73da[_0x74f1('0x54')]['to'][0x0],'fax':_0x3b73da[_0x74f1('0x54')]['to'][0x0],'ListId':_0x1be630[_0x74f1('0xac')]}));}}else{throw new Error(_0x74f1('0xad'));}}else{throw new Error(_0x74f1('0xae'));}})['then'](function(_0x2c6866){if(_0x2c6866){return db[_0x74f1('0x6e')][_0x74f1('0x52')]({'where':{'ContactId':_0x2c6866['id'],'closed':![],'FaxAccountId':_0x1be630['id']}})[_0x74f1('0x30')](function(_0x2da74c){if(_0x2da74c){return[_0x2da74c,![]];}return db[_0x74f1('0x6e')]['create']({'UserId':_0x3b73da['user']['id'],'ContactId':_0x2c6866['id'],'FaxAccountId':_0x1be630['id'],'fax':_0x3b73da['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x74f1('0x49')](_0x3b73da[_0x74f1('0x54')],{'read':![],'body':_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][0x0]['filename'],'FaxAccountId':_0x1be630['id'],'UserId':_0x3b73da[_0x74f1('0x55')]['id'],'ContactId':_0x2c6866['id'],'AttachmentId':_0x3b73da['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x74f1('0x9f')],'as':_0x74f1('0xaf')}]})[_0x74f1('0x30')](function(_0xa89d74){return[_0xa89d74,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x4ceca9,_0x3672ee){if(_0x3672ee){return _0x4ceca9;}return db['FaxMessage'][_0x74f1('0x53')]({'direction':_0x74f1('0xb0'),'read':![],'body':_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][0x0][_0x74f1('0xb1')],'FaxAccountId':_0x1be630['id'],'FaxInteractionId':_0x4ceca9['id'],'UserId':_0x3b73da[_0x74f1('0x55')]['id'],'ContactId':_0x4ceca9[_0x74f1('0xb2')],'AttachmentId':_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][0x0]['id']})[_0x74f1('0x30')](function(_0x4f583e){_0x4ceca9[_0x74f1('0xb3')]['Messages']=[];_0x4ceca9[_0x74f1('0xb3')][_0x74f1('0xaf')][_0x74f1('0x89')](_0x4f583e[_0x74f1('0xb3')]);return _0x4ceca9;});})[_0x74f1('0x30')](function(_0xdf147b){respondWithRpcPromise(_0x74f1('0xb4'),_0x74f1('0xb4'),{'FaxAccountId':_['isNil'](_0x3b73da[_0x74f1('0x4f')]['id'])?undefined:_0x3b73da[_0x74f1('0x4f')]['id'],'path':_[_0x74f1('0xa7')](_0x3b73da[_0x74f1('0x54')]['attachments'][0x0][_0x74f1('0xa8')])?undefined:_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][0x0]['path'],'fax':_[_0x74f1('0xa7')](_0x3b73da['body']['to'][0x0])?undefined:_0x3b73da['body']['to'][0x0],'AttachmentId':_0x3b73da[_0x74f1('0x54')]['attachments'][0x0]['id']},client9002)[_0x74f1('0x30')](function(_0x373ce3){logger[_0x74f1('0x1f')]('SendFaxRpc,\x20%s',_0x373ce3);})[_0x74f1('0x27')](function(_0x2db35f){logger[_0x74f1('0x1f')](_0x74f1('0xb5'),_0x2db35f);});return _0xdf147b;})[_0x74f1('0x30')](respondWithResult(_0x282cbe,null))['catch'](handleError(_0x282cbe,null));};exports[_0x74f1('0xb6')]=function(_0x50f270,_0x46e479,_0x50a2f0){return db[_0x74f1('0x4b')]['find']({'where':{'id':_0x50f270['params']['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x46e479,null))[_0x74f1('0x30')](function(_0x47b465){if(_0x47b465){return _0x47b465[_0x74f1('0xb6')](_0x50f270[_0x74f1('0x54')][_0x74f1('0x68')],_[_0x74f1('0x6f')](_0x50f270[_0x74f1('0x54')],[_0x74f1('0x68'),'id'])||{})[_0x74f1('0xb7')](function(_0x28ad4b){for(var _0x5c05d1=0x0;_0x5c05d1<_0x50f270[_0x74f1('0x54')]['ids']['length'];_0x5c05d1+=0x1){socket[_0x74f1('0xb8')](_0x74f1('0xb9'),{'UserId':_0x50f270[_0x74f1('0x54')][_0x74f1('0x68')][_0x5c05d1],'FaxAccountId':_0x50f270[_0x74f1('0x4f')]['id']});}return _0x28ad4b;});}})[_0x74f1('0x30')](respondWithResult(_0x46e479,null))[_0x74f1('0x27')](handleError(_0x46e479,null));};exports[_0x74f1('0xba')]=function(_0xa43b58,_0x2c442b,_0x2231a2){return db['FaxAccount'][_0x74f1('0x52')]({'where':{'id':_0xa43b58[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x2c442b,null))['then'](function(_0x5cbcf3){if(_0x5cbcf3){return _0x5cbcf3[_0x74f1('0xba')](_0xa43b58[_0x74f1('0x3f')]['ids'])[_0x74f1('0x30')](function(){if(_[_0x74f1('0xbb')](_0xa43b58[_0x74f1('0x3f')]['ids'])){for(var _0x746970=0x0;_0x746970<_0xa43b58[_0x74f1('0x3f')]['ids']['length'];_0x746970+=0x1){socket[_0x74f1('0xb8')]('userFaxAccount:remove',{'UserId':Number(_0xa43b58[_0x74f1('0x3f')][_0x74f1('0x68')][_0x746970]),'FaxAccountId':Number(_0xa43b58[_0x74f1('0x4f')]['id'])});}}else{socket[_0x74f1('0xb8')]('userFaxAccount:remove',{'UserId':Number(_0xa43b58['query']['ids']),'FaxAccountId':Number(_0xa43b58[_0x74f1('0x4f')]['id'])});}});}})[_0x74f1('0x30')](respondWithStatusCode(_0x2c442b,null))[_0x74f1('0x27')](handleError(_0x2c442b,null));};exports[_0x74f1('0xbc')]=function(_0x519ca0,_0x38491c,_0x4238e9){var _0x20bb3e={};var _0x4c410c={};var _0x194543;var _0xefcf65;return db[_0x74f1('0x4b')][_0x74f1('0x63')]({'where':{'id':_0x519ca0[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x38491c,null))[_0x74f1('0x30')](function(_0x52aff6){if(_0x52aff6){_0x194543=_0x52aff6;_0x4c410c[_0x74f1('0x3e')]=_['keys'](db[_0x74f1('0x73')]['rawAttributes']);_0x4c410c[_0x74f1('0x3f')]=_[_0x74f1('0x50')](_0x519ca0[_0x74f1('0x3f')]);_0x4c410c['filters']=_[_0x74f1('0x41')](_0x4c410c['model'],_0x4c410c[_0x74f1('0x3f')]);_0x20bb3e[_0x74f1('0x42')]=_[_0x74f1('0x41')](_0x4c410c[_0x74f1('0x3e')],qs['fields'](_0x519ca0['query'][_0x74f1('0x43')]));_0x20bb3e['attributes']=_0x20bb3e[_0x74f1('0x42')]['length']?_0x20bb3e[_0x74f1('0x42')]:_0x4c410c[_0x74f1('0x3e')];_0x20bb3e['order']=qs[_0x74f1('0x66')](_0x519ca0[_0x74f1('0x3f')][_0x74f1('0x66')]);_0x20bb3e[_0x74f1('0x46')]=qs[_0x74f1('0x40')](_[_0x74f1('0x47')](_0x519ca0[_0x74f1('0x3f')],_0x4c410c['filters']));if(_0x519ca0[_0x74f1('0x3f')][_0x74f1('0x48')]){_0x20bb3e[_0x74f1('0x46')]=_['merge'](_0x20bb3e[_0x74f1('0x46')],{'$or':_[_0x74f1('0x3a')](_0x20bb3e[_0x74f1('0x42')],function(_0x27c0ac){var _0x1da59c={};_0x1da59c[_0x27c0ac]={'$like':'%'+_0x519ca0[_0x74f1('0x3f')][_0x74f1('0x48')]+'%'};return _0x1da59c;})});}_0x20bb3e=_['merge']({},_0x20bb3e,_0x519ca0['options']);return _0x194543['getAgents'](_0x20bb3e);}})['then'](function(_0x4c6e9a){if(_0x4c6e9a){_0xefcf65=_0x4c6e9a['length'];if(!_0x519ca0[_0x74f1('0x3f')][_0x74f1('0x45')](_0x74f1('0x64'))){_0x20bb3e[_0x74f1('0x2d')]=qs[_0x74f1('0x2d')](_0x519ca0['query']['limit']);_0x20bb3e[_0x74f1('0x2c')]=qs['offset'](_0x519ca0[_0x74f1('0x3f')][_0x74f1('0x2c')]);}return _0x194543[_0x74f1('0xbc')](_0x20bb3e);}})[_0x74f1('0x30')](function(_0x5f1f9e){if(_0x5f1f9e){return _0x5f1f9e?{'count':_0xefcf65,'rows':_0x5f1f9e}:null;}})[_0x74f1('0x30')](respondWithResult(_0x38491c,null))[_0x74f1('0x27')](handleError(_0x38491c,null));}; \ No newline at end of file +var _0x07c3=['from-voip-provider','app','system','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','faxdetect','headerinfo','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','List','Contacts','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','user','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','get','UserProfileResource','stack','name','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','Pause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','ids','getAnswers','CannedAnswer','addInteraction','omit','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications'];(function(_0x2b497a,_0x33571f){var _0x420d40=function(_0x4f2d27){while(--_0x4f2d27){_0x2b497a['push'](_0x2b497a['shift']());}};_0x420d40(++_0x33571f);}(_0x07c3,0x1bf));var _0x307c=function(_0x44454f,_0x4bfbe8){_0x44454f=_0x44454f-0x0;var _0x475150=_0x07c3[_0x44454f];return _0x475150;};'use strict';var pdf=require(_0x307c('0x0'));var emlformat=require(_0x307c('0x1'));var rimraf=require(_0x307c('0x2'));var zipdir=require(_0x307c('0x3'));var jsonpatch=require(_0x307c('0x4'));var rp=require(_0x307c('0x5'));var moment=require(_0x307c('0x6'));var BPromise=require(_0x307c('0x7'));var Mustache=require('mustache');var util=require(_0x307c('0x8'));var path=require(_0x307c('0x9'));var sox=require(_0x307c('0xa'));var csv=require(_0x307c('0xb'));var ejs=require(_0x307c('0xc'));var fs=require('fs');var _=require(_0x307c('0xd'));var squel=require(_0x307c('0xe'));var crypto=require(_0x307c('0xf'));var jsforce=require(_0x307c('0x10'));var deskjs=require(_0x307c('0x11'));var toCsv=require(_0x307c('0xb'));var querystring=require(_0x307c('0x12'));var Papa=require(_0x307c('0x13'));var Redis=require(_0x307c('0x14'));var authService=require(_0x307c('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x307c('0x16'));var hardwareService=require(_0x307c('0x17'));var logger=require(_0x307c('0x18'))(_0x307c('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x307c('0x1a'));var db=require('../../mysqldb')['db'];config[_0x307c('0x1b')]=_[_0x307c('0x1c')](config['redis'],{'host':_0x307c('0x1d'),'port':0x18eb});var socket=require(_0x307c('0x1e'))(new Redis(config[_0x307c('0x1b')]));require(_0x307c('0x1f'))[_0x307c('0x20')](socket);var jayson=require(_0x307c('0x21'));var client=jayson[_0x307c('0x22')][_0x307c('0x23')]({'port':0x232c});var client9002=jayson[_0x307c('0x22')][_0x307c('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x405273,_0x424a74,_0x53e2f4,_0x2a3edc){return new BPromise(function(_0x364441,_0x1aca09){var _0x2f44ce=_0x2a3edc||client;return _0x2f44ce[_0x307c('0x24')](_0x405273,_0x53e2f4)[_0x307c('0x25')](function(_0x3e05e2){logger[_0x307c('0x26')](_0x307c('0x27'),_0x424a74,'request\x20sent');logger['debug'](_0x307c('0x28'),_0x424a74,'request\x20sent',JSON[_0x307c('0x29')](_0x3e05e2));if(_0x3e05e2['error']){if(_0x3e05e2['error'][_0x307c('0x2a')]===0x1f4){logger[_0x307c('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x424a74,_0x3e05e2[_0x307c('0x2b')][_0x307c('0x2c')]);return _0x1aca09(_0x3e05e2['error'][_0x307c('0x2c')]);}logger[_0x307c('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x424a74,_0x3e05e2[_0x307c('0x2b')][_0x307c('0x2c')]);return _0x364441(_0x3e05e2[_0x307c('0x2b')][_0x307c('0x2c')]);}else{logger[_0x307c('0x26')](_0x307c('0x27'),_0x424a74,_0x307c('0x2d'));_0x364441(_0x3e05e2[_0x307c('0x2e')][_0x307c('0x2c')]);}})[_0x307c('0x2f')](function(_0x5da864){logger[_0x307c('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x424a74,_0x5da864);_0x1aca09(_0x5da864);});});}function respondWithStatusCode(_0x598d43,_0x9a88a8){_0x9a88a8=_0x9a88a8||0xcc;return function(_0x2d81d8){if(_0x2d81d8){return _0x598d43[_0x307c('0x30')](_0x9a88a8);}return _0x598d43[_0x307c('0x31')](_0x9a88a8)[_0x307c('0x32')]();};}function respondWithResult(_0x1591d1,_0x4fd125){_0x4fd125=_0x4fd125||0xc8;return function(_0x1fbdda){if(_0x1fbdda){return _0x1591d1[_0x307c('0x31')](_0x4fd125)[_0x307c('0x33')](_0x1fbdda);}};}function respondWithFilteredResult(_0x54da33,_0x3b352a){return function(_0x1781ab){if(_0x1781ab){var _0xcb6ae6=_0x1781ab['count'],_0x12d9a9=_0x3b352a[_0x307c('0x34')],_0x3a58ec=_0x3b352a[_0x307c('0x34')]+_0x3b352a[_0x307c('0x35')],_0x1e5da0;if(_0x3a58ec>=_0xcb6ae6){_0x3a58ec=_0xcb6ae6;_0x1e5da0=0xc8;}else{_0x1e5da0=0xce;}_0x54da33[_0x307c('0x31')](_0x1e5da0);return _0x54da33[_0x307c('0x36')](_0x307c('0x37'),_0x12d9a9+'-'+_0x3a58ec+'/'+_0xcb6ae6)[_0x307c('0x33')](_0x1781ab);}return null;};}function patchUpdates(_0x2aa4ed){return function(_0x12b5f4){try{jsonpatch['apply'](_0x12b5f4,_0x2aa4ed,!![]);}catch(_0x29c0c4){return BPromise[_0x307c('0x38')](_0x29c0c4);}return _0x12b5f4[_0x307c('0x39')]();};}function saveUpdates(_0x1a706a,_0x1602e8){return function(_0x217044){if(_0x217044){return _0x217044[_0x307c('0x3a')](_0x1a706a)[_0x307c('0x25')](function(_0x2b3932){return _0x2b3932;});}return null;};}function removeEntity(_0x4338e2,_0x394766){return function(_0x4ec200){if(_0x4ec200){return _0x4ec200[_0x307c('0x3b')]()[_0x307c('0x25')](function(){var _0x4bfb47=_0x4ec200[_0x307c('0x3c')]({'plain':!![]});var _0x32523c='FaxAccounts';return db[_0x307c('0x3d')]['destroy']({'where':{'type':_0x32523c,'resourceId':_0x4bfb47['id']}})[_0x307c('0x25')](function(){return _0x4ec200;});})[_0x307c('0x25')](function(){_0x4338e2[_0x307c('0x31')](0xcc)[_0x307c('0x32')]();});}};}function handleEntityNotFound(_0x21bc5f,_0x20447b){return function(_0x345562){if(!_0x345562){_0x21bc5f['sendStatus'](0x194);}return _0x345562;};}function handleError(_0x267df0,_0x2dc15c){_0x2dc15c=_0x2dc15c||0x1f4;return function(_0x3b76fc){logger[_0x307c('0x2b')](_0x3b76fc[_0x307c('0x3e')]);if(_0x3b76fc[_0x307c('0x3f')]){delete _0x3b76fc[_0x307c('0x3f')];}_0x267df0['status'](_0x2dc15c)['send'](_0x3b76fc);};}exports['index']=function(_0x456e1d,_0x196e26){var _0x4e2873={'include':[{'model':db['Pause'],'as':_0x307c('0x40')}]},_0x4a29fe={},_0x38c69e={'count':0x0,'rows':[]};var _0x66c63c=_[_0x307c('0x41')](db[_0x307c('0x42')][_0x307c('0x43')],function(_0x70fc50){return{'name':_0x70fc50[_0x307c('0x44')],'type':_0x70fc50[_0x307c('0x45')]['key']};});_0x4a29fe[_0x307c('0x46')]=_['map'](_0x66c63c,_0x307c('0x3f'));_0x4a29fe['query']=_[_0x307c('0x47')](_0x456e1d[_0x307c('0x48')]);_0x4a29fe[_0x307c('0x49')]=_[_0x307c('0x4a')](_0x4a29fe[_0x307c('0x46')],_0x4a29fe[_0x307c('0x48')]);_0x4e2873[_0x307c('0x4b')]=_[_0x307c('0x4a')](_0x4a29fe[_0x307c('0x46')],qs[_0x307c('0x4c')](_0x456e1d[_0x307c('0x48')][_0x307c('0x4c')]));_0x4e2873['attributes']=_0x4e2873['attributes'][_0x307c('0x4d')]?_0x4e2873[_0x307c('0x4b')]:_0x4a29fe[_0x307c('0x46')];if(!_0x456e1d[_0x307c('0x48')][_0x307c('0x4e')](_0x307c('0x4f'))){_0x4e2873['limit']=qs['limit'](_0x456e1d[_0x307c('0x48')]['limit']);_0x4e2873[_0x307c('0x34')]=qs[_0x307c('0x34')](_0x456e1d[_0x307c('0x48')]['offset']);}_0x4e2873[_0x307c('0x50')]=qs[_0x307c('0x51')](_0x456e1d[_0x307c('0x48')][_0x307c('0x51')]);_0x4e2873[_0x307c('0x52')]=qs['filters'](_[_0x307c('0x53')](_0x456e1d[_0x307c('0x48')],_0x4a29fe['filters']),_0x66c63c);if(_0x456e1d[_0x307c('0x48')][_0x307c('0x54')]){_0x4e2873[_0x307c('0x52')]=_[_0x307c('0x55')](_0x4e2873[_0x307c('0x52')],{'$or':_[_0x307c('0x41')](_0x66c63c,function(_0x1ac427){if(_0x1ac427['type']!==_0x307c('0x56')){var _0x38099a={};_0x38099a[_0x1ac427[_0x307c('0x3f')]]={'$like':'%'+_0x456e1d['query'][_0x307c('0x54')]+'%'};return _0x38099a;}})});}_0x4e2873=_[_0x307c('0x55')]({},_0x4e2873,_0x456e1d[_0x307c('0x57')]);var _0x3a5160={'where':_0x4e2873['where']};return db[_0x307c('0x42')]['count'](_0x3a5160)['then'](function(_0x566628){_0x38c69e[_0x307c('0x58')]=_0x566628;if(_0x456e1d[_0x307c('0x48')][_0x307c('0x59')]){_0x4e2873[_0x307c('0x5a')]=[{'all':!![]}];}return db['FaxAccount'][_0x307c('0x5b')](_0x4e2873);})[_0x307c('0x25')](function(_0x398ef5){_0x38c69e[_0x307c('0x5c')]=_0x398ef5;return _0x38c69e;})[_0x307c('0x25')](respondWithFilteredResult(_0x196e26,_0x4e2873))[_0x307c('0x2f')](handleError(_0x196e26,null));};exports[_0x307c('0x5d')]=function(_0x5b0b77,_0x50876a){var _0x1f41c9={'raw':![],'where':{'id':_0x5b0b77[_0x307c('0x5e')]['id']},'include':[{'model':db[_0x307c('0x5f')],'as':_0x307c('0x40')}]},_0x424a92={};_0x424a92[_0x307c('0x46')]=_[_0x307c('0x47')](db['FaxAccount']['rawAttributes']);_0x424a92[_0x307c('0x48')]=_[_0x307c('0x47')](_0x5b0b77[_0x307c('0x48')]);_0x424a92[_0x307c('0x49')]=_[_0x307c('0x4a')](_0x424a92['model'],_0x424a92['query']);_0x1f41c9['attributes']=_[_0x307c('0x4a')](_0x424a92[_0x307c('0x46')],qs['fields'](_0x5b0b77[_0x307c('0x48')][_0x307c('0x4c')]));_0x1f41c9[_0x307c('0x4b')]=_0x1f41c9['attributes']['length']?_0x1f41c9['attributes']:_0x424a92[_0x307c('0x46')];if(_0x5b0b77[_0x307c('0x48')]['includeAll']){_0x1f41c9['include']=[{'all':!![]}];}_0x1f41c9=_[_0x307c('0x55')]({},_0x1f41c9,_0x5b0b77[_0x307c('0x57')]);return db['FaxAccount'][_0x307c('0x60')](_0x1f41c9)[_0x307c('0x25')](handleEntityNotFound(_0x50876a,null))[_0x307c('0x25')](respondWithResult(_0x50876a,null))[_0x307c('0x2f')](handleError(_0x50876a,null));};exports['create']=function(_0x20c329,_0x1cc75d){return db[_0x307c('0x42')][_0x307c('0x61')](_0x20c329[_0x307c('0x62')],{})[_0x307c('0x25')](function(_0x34d223){var _0x65e7d2=_0x20c329['user'][_0x307c('0x3c')]({'plain':!![]});if(!_0x65e7d2)throw new Error(_0x307c('0x63'));if(_0x65e7d2[_0x307c('0x64')]==='user'){var _0x10efed=_0x34d223[_0x307c('0x3c')]({'plain':!![]});var _0x26bcbd=_0x307c('0x65');return db['UserProfileSection']['find']({'where':{'name':_0x26bcbd,'userProfileId':_0x65e7d2[_0x307c('0x66')]},'raw':!![]})[_0x307c('0x25')](function(_0x5d1783){if(_0x5d1783&&_0x5d1783['autoAssociation']===0x0){return db['UserProfileResource'][_0x307c('0x61')]({'name':_0x10efed[_0x307c('0x3f')],'resourceId':_0x10efed['id'],'type':_0x5d1783[_0x307c('0x3f')],'sectionId':_0x5d1783['id']},{})[_0x307c('0x25')](function(){return _0x34d223;});}else{return _0x34d223;}})[_0x307c('0x2f')](function(_0xfe43a2){logger['error'](_0x307c('0x67'),_0xfe43a2);throw _0xfe43a2;});}return _0x34d223;})[_0x307c('0x25')](respondWithResult(_0x1cc75d,0xc9))[_0x307c('0x2f')](handleError(_0x1cc75d,null));};exports[_0x307c('0x3a')]=function(_0x54bfb3,_0x22f19e){if(_0x54bfb3['body']['id']){delete _0x54bfb3[_0x307c('0x62')]['id'];}return db[_0x307c('0x42')]['find']({'where':{'id':_0x54bfb3[_0x307c('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x307c('0x40')}]})[_0x307c('0x25')](handleEntityNotFound(_0x22f19e,null))['then'](saveUpdates(_0x54bfb3[_0x307c('0x62')],null))[_0x307c('0x25')](respondWithResult(_0x22f19e,null))[_0x307c('0x2f')](handleError(_0x22f19e,null));};exports['destroy']=function(_0x4bee3d,_0x543042){return db[_0x307c('0x42')][_0x307c('0x60')]({'where':{'id':_0x4bee3d['params']['id']}})[_0x307c('0x25')](handleEntityNotFound(_0x543042,null))[_0x307c('0x25')](removeEntity(_0x543042,null))['catch'](handleError(_0x543042,null));};exports['describe']=function(_0x2c905d,_0x553b70){return db[_0x307c('0x42')]['describe']()[_0x307c('0x25')](respondWithResult(_0x553b70,null))['catch'](handleError(_0x553b70,null));};exports[_0x307c('0x68')]=function(_0xa82555,_0x4ed01d,_0x3810a1){if(_0xa82555[_0x307c('0x62')]['id']){delete _0xa82555['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0xa82555[_0x307c('0x5e')]['id']}})[_0x307c('0x25')](handleEntityNotFound(_0x4ed01d,null))[_0x307c('0x25')](function(_0x53c61a){if(_0x53c61a){_0xa82555[_0x307c('0x62')][_0x307c('0x69')]=_0x53c61a['id'];return db[_0x307c('0x6a')][_0x307c('0x61')](_0xa82555[_0x307c('0x62')]);}})[_0x307c('0x25')](respondWithResult(_0x4ed01d,null))[_0x307c('0x2f')](handleError(_0x4ed01d,null));};exports[_0x307c('0x6b')]=function(_0x43649f,_0x3063fe,_0x5a0088){var _0x5c3f74={'raw':![],'where':{}};var _0x37d691={};var _0x3dbc97={'count':0x0,'rows':[]};return db[_0x307c('0x42')][_0x307c('0x6c')]({'where':{'id':_0x43649f['params']['id']}})['then'](handleEntityNotFound(_0x3063fe,null))['then'](function(_0x457d20){if(_0x457d20){_0x37d691[_0x307c('0x46')]=_['keys'](db['Disposition'][_0x307c('0x43')]);_0x37d691[_0x307c('0x48')]=_['keys'](_0x43649f[_0x307c('0x48')]);_0x37d691['filters']=_[_0x307c('0x4a')](_0x37d691[_0x307c('0x46')],_0x37d691['query']);_0x5c3f74[_0x307c('0x4b')]=_[_0x307c('0x4a')](_0x37d691[_0x307c('0x46')],qs['fields'](_0x43649f[_0x307c('0x48')][_0x307c('0x4c')]));_0x5c3f74['attributes']=_0x5c3f74[_0x307c('0x4b')][_0x307c('0x4d')]?_0x5c3f74['attributes']:_0x37d691[_0x307c('0x46')];if(!_0x43649f[_0x307c('0x48')]['hasOwnProperty'](_0x307c('0x4f'))){_0x5c3f74['limit']=qs[_0x307c('0x35')](_0x43649f[_0x307c('0x48')][_0x307c('0x35')]);_0x5c3f74['offset']=qs[_0x307c('0x34')](_0x43649f[_0x307c('0x48')][_0x307c('0x34')]);}_0x5c3f74[_0x307c('0x50')]=qs[_0x307c('0x51')](_0x43649f[_0x307c('0x48')][_0x307c('0x51')]);_0x5c3f74[_0x307c('0x52')]=qs[_0x307c('0x49')](_['pick'](_0x43649f['query'],_0x37d691[_0x307c('0x49')]));_0x5c3f74[_0x307c('0x52')]['FaxAccountId']=_0x457d20['id'];if(_0x43649f[_0x307c('0x48')][_0x307c('0x54')]){_0x5c3f74[_0x307c('0x52')]=_['merge'](_0x5c3f74['where'],{'$or':_['map'](_0x5c3f74[_0x307c('0x4b')],function(_0xa68398){var _0x1cc613={};_0x1cc613[_0xa68398]={'$like':'%'+_0x43649f[_0x307c('0x48')][_0x307c('0x54')]+'%'};return _0x1cc613;})});}_0x5c3f74=_['merge']({},_0x5c3f74,_0x43649f[_0x307c('0x57')]);return db[_0x307c('0x6a')]['count']({'where':_0x5c3f74['where']})[_0x307c('0x25')](function(_0x44393d){_0x3dbc97[_0x307c('0x58')]=_0x44393d;if(_0x43649f[_0x307c('0x48')]['includeAll']){_0x5c3f74[_0x307c('0x5a')]=[{'all':!![]}];}return db[_0x307c('0x6a')]['findAll'](_0x5c3f74);})[_0x307c('0x25')](function(_0x464445){_0x3dbc97['rows']=_0x464445;return _0x3dbc97;});}})[_0x307c('0x25')](respondWithFilteredResult(_0x3063fe,_0x5c3f74))[_0x307c('0x2f')](handleError(_0x3063fe,null));};exports['removeDispositions']=function(_0x5b8202,_0x5317ef,_0x351bb5){return db[_0x307c('0x42')][_0x307c('0x60')]({'where':{'id':_0x5b8202[_0x307c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5317ef,null))['then'](function(_0x2adbdc){if(_0x2adbdc){return _0x2adbdc['removeDispositions'](_0x5b8202['query'][_0x307c('0x6d')]);}})[_0x307c('0x25')](respondWithStatusCode(_0x5317ef,null))['catch'](handleError(_0x5317ef,null));};exports['addAnswer']=function(_0x310c7e,_0x5443ba,_0x12c879){if(_0x310c7e[_0x307c('0x62')]['id']){delete _0x310c7e[_0x307c('0x62')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x310c7e[_0x307c('0x5e')]['id']}})[_0x307c('0x25')](handleEntityNotFound(_0x5443ba,null))[_0x307c('0x25')](function(_0x19002c){if(_0x19002c){_0x310c7e[_0x307c('0x62')][_0x307c('0x69')]=_0x19002c['id'];return db['CannedAnswer'][_0x307c('0x61')](_0x310c7e[_0x307c('0x62')]);}})[_0x307c('0x25')](respondWithResult(_0x5443ba,null))[_0x307c('0x2f')](handleError(_0x5443ba,null));};exports[_0x307c('0x6e')]=function(_0x26ed4a,_0x101304,_0x28ae45){var _0x4e3f1c={'raw':![],'where':{}};var _0xcc402b={};var _0x260968={'count':0x0,'rows':[]};return db[_0x307c('0x42')][_0x307c('0x6c')]({'where':{'id':_0x26ed4a[_0x307c('0x5e')]['id']}})[_0x307c('0x25')](handleEntityNotFound(_0x101304,null))['then'](function(_0x47062f){if(_0x47062f){_0xcc402b[_0x307c('0x46')]=_[_0x307c('0x47')](db[_0x307c('0x6f')][_0x307c('0x43')]);_0xcc402b[_0x307c('0x48')]=_['keys'](_0x26ed4a[_0x307c('0x48')]);_0xcc402b[_0x307c('0x49')]=_[_0x307c('0x4a')](_0xcc402b[_0x307c('0x46')],_0xcc402b[_0x307c('0x48')]);_0x4e3f1c[_0x307c('0x4b')]=_[_0x307c('0x4a')](_0xcc402b['model'],qs['fields'](_0x26ed4a[_0x307c('0x48')][_0x307c('0x4c')]));_0x4e3f1c[_0x307c('0x4b')]=_0x4e3f1c[_0x307c('0x4b')]['length']?_0x4e3f1c[_0x307c('0x4b')]:_0xcc402b['model'];if(!_0x26ed4a[_0x307c('0x48')][_0x307c('0x4e')](_0x307c('0x4f'))){_0x4e3f1c['limit']=qs[_0x307c('0x35')](_0x26ed4a['query']['limit']);_0x4e3f1c[_0x307c('0x34')]=qs['offset'](_0x26ed4a[_0x307c('0x48')][_0x307c('0x34')]);}_0x4e3f1c[_0x307c('0x50')]=qs[_0x307c('0x51')](_0x26ed4a[_0x307c('0x48')][_0x307c('0x51')]);_0x4e3f1c[_0x307c('0x52')]=qs[_0x307c('0x49')](_[_0x307c('0x53')](_0x26ed4a[_0x307c('0x48')],_0xcc402b[_0x307c('0x49')]));_0x4e3f1c[_0x307c('0x52')][_0x307c('0x69')]=_0x47062f['id'];if(_0x26ed4a[_0x307c('0x48')][_0x307c('0x54')]){_0x4e3f1c[_0x307c('0x52')]=_[_0x307c('0x55')](_0x4e3f1c[_0x307c('0x52')],{'$or':_[_0x307c('0x41')](_0x4e3f1c[_0x307c('0x4b')],function(_0x3b8a70){var _0x851a31={};_0x851a31[_0x3b8a70]={'$like':'%'+_0x26ed4a[_0x307c('0x48')][_0x307c('0x54')]+'%'};return _0x851a31;})});}_0x4e3f1c=_['merge']({},_0x4e3f1c,_0x26ed4a[_0x307c('0x57')]);return db[_0x307c('0x6f')][_0x307c('0x58')]({'where':_0x4e3f1c['where']})[_0x307c('0x25')](function(_0x56a740){_0x260968[_0x307c('0x58')]=_0x56a740;if(_0x26ed4a[_0x307c('0x48')]['includeAll']){_0x4e3f1c[_0x307c('0x5a')]=[{'all':!![]}];}return db[_0x307c('0x6f')][_0x307c('0x5b')](_0x4e3f1c);})[_0x307c('0x25')](function(_0x5cb764){_0x260968[_0x307c('0x5c')]=_0x5cb764;return _0x260968;});}})[_0x307c('0x25')](respondWithFilteredResult(_0x101304,_0x4e3f1c))[_0x307c('0x2f')](handleError(_0x101304,null));};exports['removeAnswers']=function(_0x40943e,_0x115c0b,_0x2861ff){return db[_0x307c('0x42')][_0x307c('0x60')]({'where':{'id':_0x40943e[_0x307c('0x5e')]['id']}})[_0x307c('0x25')](handleEntityNotFound(_0x115c0b,null))[_0x307c('0x25')](function(_0x419a1b){if(_0x419a1b){return _0x419a1b['removeAnswers'](_0x40943e[_0x307c('0x48')][_0x307c('0x6d')]);}})[_0x307c('0x25')](respondWithStatusCode(_0x115c0b,null))[_0x307c('0x2f')](handleError(_0x115c0b,null));};exports[_0x307c('0x70')]=function(_0x627ffe,_0xe8031b,_0x4cd7aa){return db['FaxInteraction'][_0x307c('0x60')]({'where':{'id':_0x627ffe['params']['id']}})[_0x307c('0x25')](handleEntityNotFound(_0xe8031b,null))['then'](function(_0x5a06fd){if(_0x5a06fd){return _0x5a06fd['addInteraction'](_0x627ffe[_0x307c('0x62')]['ids'],_[_0x307c('0x71')](_0x627ffe[_0x307c('0x62')],[_0x307c('0x6d'),'id'])||{});}})[_0x307c('0x25')](respondWithResult(_0xe8031b,null))[_0x307c('0x2f')](handleError(_0xe8031b,null));};exports['getInteractions']=function(_0x4a8f0a,_0x31fdc2,_0x20dff5){var _0x137480={'raw':![],'where':{}};var _0xd19d54={};var _0x5b00a2={'count':0x0,'rows':[]};return db[_0x307c('0x42')][_0x307c('0x6c')]({'where':{'id':_0x4a8f0a['params']['id']}})[_0x307c('0x25')](handleEntityNotFound(_0x31fdc2,null))['then'](function(_0xbf3d1b){if(_0xbf3d1b){_0xd19d54[_0x307c('0x46')]=_[_0x307c('0x47')](db[_0x307c('0x72')]['rawAttributes']);_0xd19d54[_0x307c('0x48')]=_[_0x307c('0x47')](_0x4a8f0a[_0x307c('0x48')]);_0xd19d54[_0x307c('0x49')]=_['intersection'](_0xd19d54[_0x307c('0x46')],_0xd19d54['query']);_0x137480[_0x307c('0x4b')]=_[_0x307c('0x4a')](_0xd19d54['model'],qs[_0x307c('0x4c')](_0x4a8f0a[_0x307c('0x48')][_0x307c('0x4c')]));_0x137480[_0x307c('0x4b')]=_0x137480[_0x307c('0x4b')][_0x307c('0x4d')]?_0x137480[_0x307c('0x4b')]:_0xd19d54[_0x307c('0x46')];if(!_0x4a8f0a[_0x307c('0x48')][_0x307c('0x4e')](_0x307c('0x4f'))){_0x137480[_0x307c('0x35')]=qs['limit'](_0x4a8f0a[_0x307c('0x48')][_0x307c('0x35')]);_0x137480[_0x307c('0x34')]=qs[_0x307c('0x34')](_0x4a8f0a[_0x307c('0x48')][_0x307c('0x34')]);}_0x137480['order']=qs[_0x307c('0x51')](_0x4a8f0a['query']['sort']);_0x137480['where']=qs[_0x307c('0x49')](_[_0x307c('0x53')](_0x4a8f0a[_0x307c('0x48')],_0xd19d54[_0x307c('0x49')]));_0x137480['where'][_0x307c('0x69')]=_0xbf3d1b['id'];if(_0x4a8f0a[_0x307c('0x48')]['filter']){_0x137480[_0x307c('0x52')]=_[_0x307c('0x55')](_0x137480[_0x307c('0x52')],{'$or':_[_0x307c('0x41')](_0x137480[_0x307c('0x4b')],function(_0x306a47){var _0x541d48={};_0x541d48[_0x306a47]={'$like':'%'+_0x4a8f0a[_0x307c('0x48')][_0x307c('0x54')]+'%'};return _0x541d48;})});}_0x137480=_[_0x307c('0x55')]({},_0x137480,_0x4a8f0a[_0x307c('0x57')]);return db['FaxInteraction'][_0x307c('0x58')]({'where':_0x137480[_0x307c('0x52')]})[_0x307c('0x25')](function(_0x522c0c){_0x5b00a2[_0x307c('0x58')]=_0x522c0c;if(_0x4a8f0a[_0x307c('0x48')][_0x307c('0x59')]){_0x137480[_0x307c('0x5a')]=[{'model':db[_0x307c('0x73')],'as':_0x307c('0x74'),'required':![]},{'model':db[_0x307c('0x75')],'as':_0x307c('0x76'),'attributes':[_0x307c('0x3f'),_0x307c('0x77'),_0x307c('0x78')],'required':![]},{'model':db[_0x307c('0x79')],'as':'Tags','attributes':['id',_0x307c('0x3f'),_0x307c('0x7a')],'where':_0x4a8f0a[_0x307c('0x48')][_0x307c('0x7b')]?{'id':_0x4a8f0a[_0x307c('0x48')][_0x307c('0x7b')]}:undefined,'required':_0x4a8f0a[_0x307c('0x48')][_0x307c('0x7b')]?!![]:![]}];}return db[_0x307c('0x72')]['findAll'](_0x137480);})[_0x307c('0x25')](function(_0x13dbdd){_0x5b00a2[_0x307c('0x5c')]=_0x13dbdd;return _0x5b00a2;});}})['then'](respondWithFilteredResult(_0x31fdc2,_0x137480))['catch'](handleError(_0x31fdc2,null));};exports[_0x307c('0x7c')]=function(_0x3a9f23,_0x33c6e4,_0x1279ac){return db['FaxAccount']['findOne']({'where':{'id':_0x3a9f23[_0x307c('0x5e')]['id']}})[_0x307c('0x25')](handleEntityNotFound(_0x33c6e4,null))['then'](function(_0x377dfb){if(_0x377dfb){return db[_0x307c('0x7d')][_0x307c('0x7e')](function(_0x45ad4f){return db[_0x307c('0x7f')][_0x307c('0x3b')]({'where':{'FaxAccountId':_0x3a9f23[_0x307c('0x5e')]['id']},'transaction':_0x45ad4f})[_0x307c('0x25')](function(_0x42a35f){var _0xa0bb81=_['map'](_0x3a9f23[_0x307c('0x62')],function(_0x47be4a){_0x47be4a[_0x307c('0x69')]=_0x3a9f23[_0x307c('0x5e')]['id'];return _0x47be4a;});return db[_0x307c('0x7f')][_0x307c('0x80')](_0xa0bb81,{'transaction':_0x45ad4f});});})['then'](function(){return db[_0x307c('0x7f')][_0x307c('0x81')]({'where':{'FaxAccountId':_0x3a9f23[_0x307c('0x5e')]['id']},'order':_0x307c('0x82')});});}})[_0x307c('0x25')](respondWithResult(_0x33c6e4,null))[_0x307c('0x2f')](handleError(_0x33c6e4,null));};exports[_0x307c('0x83')]=function(_0x5c7041,_0x59ce95,_0x3e0ff9){var _0x30a74e={};var _0x4b90b0={};var _0x31d17d;var _0x21baee;return db['FaxAccount']['findOne']({'where':{'id':_0x5c7041['params']['id']}})[_0x307c('0x25')](handleEntityNotFound(_0x59ce95,null))['then'](function(_0x426340){if(_0x426340){_0x31d17d=_0x426340;_0x4b90b0['model']=_['keys'](db[_0x307c('0x7f')][_0x307c('0x43')]);_0x4b90b0[_0x307c('0x48')]=_[_0x307c('0x47')](_0x5c7041[_0x307c('0x48')]);_0x4b90b0[_0x307c('0x49')]=_[_0x307c('0x4a')](_0x4b90b0[_0x307c('0x46')],_0x4b90b0[_0x307c('0x48')]);_0x30a74e[_0x307c('0x4b')]=_[_0x307c('0x4a')](_0x4b90b0[_0x307c('0x46')],qs[_0x307c('0x4c')](_0x5c7041['query'][_0x307c('0x4c')]));_0x30a74e[_0x307c('0x4b')]=_0x30a74e[_0x307c('0x4b')][_0x307c('0x4d')]?_0x30a74e['attributes']:_0x4b90b0[_0x307c('0x46')];_0x30a74e[_0x307c('0x50')]=qs[_0x307c('0x51')](_0x5c7041['query'][_0x307c('0x51')]);_0x30a74e[_0x307c('0x52')]=qs[_0x307c('0x49')](_[_0x307c('0x53')](_0x5c7041[_0x307c('0x48')],_0x4b90b0[_0x307c('0x49')]));if(_0x5c7041[_0x307c('0x48')][_0x307c('0x54')]){_0x30a74e[_0x307c('0x52')]=_['merge'](_0x30a74e[_0x307c('0x52')],{'$or':_['map'](_0x30a74e[_0x307c('0x4b')],function(_0x221129){var _0x29c80e={};_0x29c80e[_0x221129]={'$like':'%'+_0x5c7041['query'][_0x307c('0x54')]+'%'};return _0x29c80e;})});}_0x30a74e=_[_0x307c('0x55')]({},_0x30a74e,_0x5c7041[_0x307c('0x57')]);return _0x31d17d['getApplications'](_0x30a74e);}})['then'](function(_0x4fafde){if(_0x4fafde){_0x21baee=_0x4fafde[_0x307c('0x4d')];if(!_0x5c7041[_0x307c('0x48')][_0x307c('0x4e')]('nolimit')){_0x30a74e[_0x307c('0x35')]=qs[_0x307c('0x35')](_0x5c7041[_0x307c('0x48')][_0x307c('0x35')]);_0x30a74e[_0x307c('0x34')]=qs[_0x307c('0x34')](_0x5c7041[_0x307c('0x48')][_0x307c('0x34')]);}return _0x31d17d[_0x307c('0x83')](_0x30a74e);}})[_0x307c('0x25')](function(_0x1d6b65){if(_0x1d6b65){return _0x1d6b65?{'count':_0x21baee,'rows':_0x1d6b65}:null;}})[_0x307c('0x25')](respondWithResult(_0x59ce95,null))[_0x307c('0x2f')](handleError(_0x59ce95,null));};function Extension(_0x424a56,_0xdc4e74,_0x2f475a,_0xcc16e8){this['context']=_0x307c('0x84');this['exten']=_0x424a56['localstationid'];this[_0x307c('0x85')]=_0xcc16e8;this[_0x307c('0x45')]=_0x307c('0x86');this['description']=_0x307c('0x87');this[_0x307c('0x69')]=_0x424a56['id'];this[_0x307c('0x82')]=_0xdc4e74;this[_0x307c('0x88')]=_0x2f475a;}function createExtensionsReciveFax(_0x337393){var _0x255af0=0x1;var _0x39597a=[];_0x39597a[_0x307c('0x89')](new Extension(_0x337393,_0x255af0,'',_0x307c('0x8a')));_0x255af0+=0x1;_0x39597a['push'](new Extension(_0x337393,_0x255af0,'CDR(type)=inbound-fax',_0x307c('0x8b')));_0x255af0+=0x1;for(var _0x5e3156 in _0x337393){if(_0x337393[_0x307c('0x4e')](_0x5e3156)&&(_0x5e3156===_0x307c('0x8c')||_0x5e3156==='localstationid'||_0x5e3156===_0x307c('0x8d')||_0x5e3156===_0x307c('0x8e')||_0x5e3156===_0x307c('0x8f')||_0x5e3156==='maxrate'||_0x5e3156===_0x307c('0x90')||_0x5e3156===_0x307c('0x91')||_0x5e3156==='t38timeout')){_0x39597a[_0x307c('0x89')](new Extension(_0x337393,_0x255af0,_0x307c('0x92')+_0x5e3156+')='+_0x337393[_0x5e3156],_0x307c('0x8b')));_0x255af0+=0x1;}}_0x39597a['push'](new Extension(_0x337393,_0x255af0,'6',_0x307c('0x93')));_0x255af0+=0x1;_0x39597a[_0x307c('0x89')](new Extension(_0x337393,_0x255af0,_0x307c('0x94'),_0x307c('0x95')));_0x255af0=0x0;return _0x39597a;}exports['addAccountApplications']=function(_0x34da75,_0x1801ef,_0x31a359){var _0x56b1cc;return db[_0x307c('0x7d')][_0x307c('0x7e')](function(_0x341097){return db[_0x307c('0x42')][_0x307c('0x61')](_0x34da75[_0x307c('0x62')],{'transaction':_0x341097})[_0x307c('0x25')](function(_0x1f4fef){_0x56b1cc=_0x1f4fef[_0x307c('0x3c')]({'plain':!![]});return db[_0x307c('0x96')]['bulkCreate'](createExtensionsReciveFax(_0x56b1cc),{'transaction':_0x341097});});})[_0x307c('0x25')](function(){return _0x56b1cc;})[_0x307c('0x25')](respondWithResult(_0x1801ef,null))['catch'](handleError(_0x1801ef,null));};exports[_0x307c('0x97')]=function(_0x1455a4,_0xb703e0,_0x45721b){var _0x218cec;return db[_0x307c('0x7d')][_0x307c('0x7e')](function(_0x1aaa19){return db[_0x307c('0x42')][_0x307c('0x3a')](_0x1455a4[_0x307c('0x62')],{'where':{'id':_0x1455a4[_0x307c('0x62')]['id']},'transaction':_0x1aaa19})[_0x307c('0x25')](function(_0x46cd32){return db[_0x307c('0x96')][_0x307c('0x3b')]({'where':{'FaxAccountId':_0x1455a4[_0x307c('0x62')]['id']},'transaction':_0x1aaa19})[_0x307c('0x25')](function(_0x452c95){return db['VoiceExtension'][_0x307c('0x80')](createExtensionsReciveFax(_[_0x307c('0x71')](_0x1455a4['body'],[_0x307c('0x98'),_0x307c('0x99'),_0x307c('0x9a'),_0x307c('0x9b'),_0x307c('0x9c'),_0x307c('0x9d')])),{'transaction':_0x1aaa19});});});})[_0x307c('0x25')](function(){return db[_0x307c('0x42')][_0x307c('0x9e')](_0x1455a4[_0x307c('0x62')]['id']);})['then'](respondWithResult(_0xb703e0,null))['catch'](handleError(_0xb703e0,null));};exports['getMessages']=function(_0xff7950,_0x2d7ea6,_0x4c127a){var _0x372ef3={'raw':!![],'where':{}};var _0x5538d2={};var _0x468778={'count':0x0,'rows':[]};return db[_0x307c('0x42')]['findOne']({'where':{'id':_0xff7950['params']['id']}})['then'](handleEntityNotFound(_0x2d7ea6,null))[_0x307c('0x25')](function(_0x5cf447){if(_0x5cf447){_0x5538d2[_0x307c('0x46')]=_[_0x307c('0x47')](db[_0x307c('0x9f')][_0x307c('0x43')]);_0x5538d2[_0x307c('0x48')]=_[_0x307c('0x47')](_0xff7950[_0x307c('0x48')]);_0x5538d2[_0x307c('0x49')]=_[_0x307c('0x4a')](_0x5538d2[_0x307c('0x46')],_0x5538d2['query']);_0x372ef3[_0x307c('0x4b')]=_[_0x307c('0x4a')](_0x5538d2[_0x307c('0x46')],qs[_0x307c('0x4c')](_0xff7950[_0x307c('0x48')]['fields']));_0x372ef3[_0x307c('0x4b')]=_0x372ef3[_0x307c('0x4b')][_0x307c('0x4d')]?_0x372ef3[_0x307c('0x4b')]:_0x5538d2[_0x307c('0x46')];if(!_0xff7950['query'][_0x307c('0x4e')](_0x307c('0x4f'))){_0x372ef3[_0x307c('0x35')]=qs['limit'](_0xff7950['query']['limit']);_0x372ef3['offset']=qs[_0x307c('0x34')](_0xff7950['query'][_0x307c('0x34')]);}_0x372ef3[_0x307c('0x50')]=qs[_0x307c('0x51')](_0xff7950[_0x307c('0x48')]['sort']);_0x372ef3['where']=qs['filters'](_[_0x307c('0x53')](_0xff7950['query'],_0x5538d2[_0x307c('0x49')]));_0x372ef3[_0x307c('0x52')]['FaxAccountId']=_0x5cf447['id'];if(_0xff7950[_0x307c('0x48')][_0x307c('0x54')]){_0x372ef3[_0x307c('0x52')]=_[_0x307c('0x55')](_0x372ef3['where'],{'$or':_[_0x307c('0x41')](_0x372ef3[_0x307c('0x4b')],function(_0x29d4cb){var _0x527824={};_0x527824[_0x29d4cb]={'$like':'%'+_0xff7950[_0x307c('0x48')][_0x307c('0x54')]+'%'};return _0x527824;})});}if(_0xff7950[_0x307c('0x48')][_0x307c('0xa0')]){var _0x3af881=_0xff7950[_0x307c('0x48')]['$gte'][_0x307c('0xa1')](',');var _0x3af479={};_0x3af479[_0x3af881[0x0]]={'$gte':moment(_0x3af881[0x1])[_0x307c('0xa2')](_0x307c('0xa3'))};_0x372ef3[_0x307c('0x52')]=_[_0x307c('0x55')](_0x372ef3[_0x307c('0x52')],_0x3af479);}_0x372ef3=_[_0x307c('0x55')]({},_0x372ef3,_0xff7950[_0x307c('0x57')]);return db[_0x307c('0x9f')][_0x307c('0x58')]({'where':_0x372ef3[_0x307c('0x52')]})['then'](function(_0x4a7460){_0x468778[_0x307c('0x58')]=_0x4a7460;if(_0xff7950[_0x307c('0x48')]['includeAll']){_0x372ef3[_0x307c('0x5a')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x372ef3);})['then'](function(_0x40e4c1){_0x468778[_0x307c('0x5c')]=_0x40e4c1;return _0x468778;});}})[_0x307c('0x25')](respondWithFilteredResult(_0x2d7ea6,_0x372ef3))[_0x307c('0x2f')](handleError(_0x2d7ea6,null));};exports[_0x307c('0xa4')]=function(_0x255d1d,_0x2f8dab,_0x9d001b){var _0x15a3a2,_0x551630={},_0x5bbea3;if(_0x255d1d[_0x307c('0x62')]['to']){_0x5bbea3=_0x255d1d[_0x307c('0x62')]['to'][0x0];}return db[_0x307c('0x42')][_0x307c('0x60')]({'where':{'id':_0x255d1d[_0x307c('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x307c('0xa5'),'include':[{'model':db['CmContact'],'as':_0x307c('0xa6'),'where':{'fax':_0x5bbea3},'limit':0x1,'order':[[_0x307c('0x9b'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2f8dab,null))[_0x307c('0x25')](function(_0x27542e){_0x15a3a2=_0x27542e;if(_0x255d1d[_0x307c('0x62')][_0x307c('0xa7')]&&_0x255d1d[_0x307c('0x62')]['attachments']['length']){for(var _0x58985e=0x0;_0x58985e<_0x255d1d[_0x307c('0x62')][_0x307c('0xa7')][_0x307c('0x4d')];_0x58985e+=0x1){_0x255d1d[_0x307c('0x62')][_0x307c('0xa7')][_0x58985e]={'filename':_0x255d1d[_0x307c('0x62')][_0x307c('0xa7')][_0x58985e][_0x307c('0x3f')],'id':_0x255d1d[_0x307c('0x62')]['attachments'][_0x58985e]['id'],'path':path[_0x307c('0xa8')](config['root'],_0x307c('0xa9'),_0x255d1d[_0x307c('0x62')][_0x307c('0xa7')][_0x58985e]['basename'])};}}return respondWithRpcPromise(_0x307c('0xaa'),_0x307c('0xaa'),{'FaxAccountId':_[_0x307c('0xab')](_0x255d1d[_0x307c('0x5e')]['id'])?undefined:_0x255d1d[_0x307c('0x5e')]['id'],'path':_[_0x307c('0xab')](_0x255d1d[_0x307c('0x62')][_0x307c('0xa7')][0x0][_0x307c('0x9')])?undefined:_0x255d1d[_0x307c('0x62')][_0x307c('0xa7')][0x0][_0x307c('0x9')],'fax':_[_0x307c('0xab')](_0x255d1d[_0x307c('0x62')]['to'][0x0])?undefined:_0x255d1d['body']['to'][0x0]},client9002);})[_0x307c('0x25')](function(){if(_0x15a3a2){if(_[_0x307c('0xab')](_0x255d1d['body'][_0x307c('0xac')])){_0x255d1d[_0x307c('0x62')][_0x307c('0xac')]=util['format'](_0x307c('0xad'),_0x15a3a2[_0x307c('0x3f')],_0x15a3a2[_0x307c('0xae')]);}if(_0x15a3a2['List']){if(_0x15a3a2[_0x307c('0xa5')]['Contacts']['length']){return _0x15a3a2[_0x307c('0xa5')][_0x307c('0xa6')][0x0];}else{return db[_0x307c('0x73')]['create'](_[_0x307c('0x1c')](_0x255d1d['body'],{'firstName':_0x255d1d[_0x307c('0x62')]['to'][0x0],'phone':_0x255d1d[_0x307c('0x62')]['to'][0x0],'fax':_0x255d1d['body']['to'][0x0],'ListId':_0x15a3a2[_0x307c('0x9d')]}));}}else{throw new Error(_0x307c('0xaf'));}}else{throw new Error(_0x307c('0xb0'));}})[_0x307c('0x25')](function(_0x18d860){if(_0x18d860){return db[_0x307c('0x72')][_0x307c('0x60')]({'where':{'ContactId':_0x18d860['id'],'closed':![],'FaxAccountId':_0x15a3a2['id']}})[_0x307c('0x25')](function(_0x4b98e0){if(_0x4b98e0){return[_0x4b98e0,![]];}return db[_0x307c('0x72')][_0x307c('0x61')]({'UserId':_0x255d1d[_0x307c('0xb1')]['id'],'ContactId':_0x18d860['id'],'FaxAccountId':_0x15a3a2['id'],'fax':_0x255d1d[_0x307c('0x62')]['to'][0x0],'firstMsgDirection':_0x307c('0xb2'),'Messages':[_[_0x307c('0x55')](_0x255d1d['body'],{'read':![],'body':_0x255d1d[_0x307c('0x62')]['attachments'][0x0][_0x307c('0xb3')],'FaxAccountId':_0x15a3a2['id'],'UserId':_0x255d1d['user']['id'],'ContactId':_0x18d860['id'],'AttachmentId':_0x255d1d[_0x307c('0x62')][_0x307c('0xa7')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x307c('0xb4')}]})[_0x307c('0x25')](function(_0x484e48){return[_0x484e48,!![]];});});}else{throw new Error(_0x307c('0xb5'));}})['spread'](function(_0x255cfa,_0x1195df){if(_0x1195df){return _0x255cfa;}return db['FaxMessage']['create']({'direction':'out','read':![],'body':_0x255d1d[_0x307c('0x62')][_0x307c('0xa7')][0x0]['filename'],'FaxAccountId':_0x15a3a2['id'],'FaxInteractionId':_0x255cfa['id'],'UserId':_0x255d1d[_0x307c('0xb1')]['id'],'ContactId':_0x255cfa[_0x307c('0xb6')],'AttachmentId':_0x255d1d[_0x307c('0x62')][_0x307c('0xa7')][0x0]['id']})['then'](function(_0x20e24c){_0x255cfa[_0x307c('0xb7')][_0x307c('0xb4')]=[];_0x255cfa['dataValues'][_0x307c('0xb4')][_0x307c('0x89')](_0x20e24c[_0x307c('0xb7')]);return _0x255cfa;});})[_0x307c('0x25')](function(_0x3f9035){respondWithRpcPromise('SendFax',_0x307c('0xb8'),{'FaxAccountId':_[_0x307c('0xab')](_0x255d1d['params']['id'])?undefined:_0x255d1d['params']['id'],'path':_[_0x307c('0xab')](_0x255d1d[_0x307c('0x62')]['attachments'][0x0][_0x307c('0x9')])?undefined:_0x255d1d['body']['attachments'][0x0][_0x307c('0x9')],'fax':_[_0x307c('0xab')](_0x255d1d[_0x307c('0x62')]['to'][0x0])?undefined:_0x255d1d['body']['to'][0x0],'AttachmentId':_0x255d1d['body'][_0x307c('0xa7')][0x0]['id']},client9002)['then'](function(_0xa5a297){logger[_0x307c('0x26')](_0x307c('0xb9'),_0xa5a297);})[_0x307c('0x2f')](function(_0x4b347f){logger[_0x307c('0x26')](_0x307c('0xb9'),_0x4b347f);});return _0x3f9035;})[_0x307c('0x25')](respondWithResult(_0x2f8dab,null))[_0x307c('0x2f')](handleError(_0x2f8dab,null));};exports[_0x307c('0xba')]=function(_0x786c9c,_0x32364f,_0x4f3e7f){return db['FaxAccount'][_0x307c('0x60')]({'where':{'id':_0x786c9c[_0x307c('0x5e')]['id']}})[_0x307c('0x25')](handleEntityNotFound(_0x32364f,null))[_0x307c('0x25')](function(_0x2d067a){if(_0x2d067a){return _0x2d067a[_0x307c('0xba')](_0x786c9c[_0x307c('0x62')][_0x307c('0x6d')],_[_0x307c('0x71')](_0x786c9c[_0x307c('0x62')],['ids','id'])||{})[_0x307c('0xbb')](function(_0x1251a2){for(var _0x674fb8=0x0;_0x674fb8<_0x786c9c[_0x307c('0x62')][_0x307c('0x6d')]['length'];_0x674fb8+=0x1){socket[_0x307c('0xbc')]('userFaxAccount:save',{'UserId':_0x786c9c[_0x307c('0x62')][_0x307c('0x6d')][_0x674fb8],'FaxAccountId':_0x786c9c[_0x307c('0x5e')]['id']});}return _0x1251a2;});}})[_0x307c('0x25')](respondWithResult(_0x32364f,null))[_0x307c('0x2f')](handleError(_0x32364f,null));};exports['removeAgents']=function(_0x3669bc,_0x5872c8,_0x440e7a){return db['FaxAccount'][_0x307c('0x60')]({'where':{'id':_0x3669bc[_0x307c('0x5e')]['id']}})[_0x307c('0x25')](handleEntityNotFound(_0x5872c8,null))[_0x307c('0x25')](function(_0x595ab5){if(_0x595ab5){return _0x595ab5[_0x307c('0xbd')](_0x3669bc[_0x307c('0x48')][_0x307c('0x6d')])[_0x307c('0x25')](function(){if(_[_0x307c('0xbe')](_0x3669bc[_0x307c('0x48')]['ids'])){for(var _0x3c4665=0x0;_0x3c4665<_0x3669bc[_0x307c('0x48')][_0x307c('0x6d')][_0x307c('0x4d')];_0x3c4665+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x3669bc[_0x307c('0x48')][_0x307c('0x6d')][_0x3c4665]),'FaxAccountId':Number(_0x3669bc[_0x307c('0x5e')]['id'])});}}else{socket[_0x307c('0xbc')](_0x307c('0xbf'),{'UserId':Number(_0x3669bc['query']['ids']),'FaxAccountId':Number(_0x3669bc[_0x307c('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x5872c8,null))[_0x307c('0x2f')](handleError(_0x5872c8,null));};exports[_0x307c('0xc0')]=function(_0x23339b,_0x438b04,_0x2b947c){var _0x5bee92={};var _0x40f99b={};var _0x5c90f4;var _0x426e55;return db['FaxAccount']['findOne']({'where':{'id':_0x23339b[_0x307c('0x5e')]['id']}})[_0x307c('0x25')](handleEntityNotFound(_0x438b04,null))[_0x307c('0x25')](function(_0x3e13b2){if(_0x3e13b2){_0x5c90f4=_0x3e13b2;_0x40f99b[_0x307c('0x46')]=_[_0x307c('0x47')](db[_0x307c('0x75')][_0x307c('0x43')]);_0x40f99b[_0x307c('0x48')]=_[_0x307c('0x47')](_0x23339b['query']);_0x40f99b[_0x307c('0x49')]=_['intersection'](_0x40f99b['model'],_0x40f99b[_0x307c('0x48')]);_0x5bee92['attributes']=_[_0x307c('0x4a')](_0x40f99b[_0x307c('0x46')],qs[_0x307c('0x4c')](_0x23339b[_0x307c('0x48')]['fields']));_0x5bee92[_0x307c('0x4b')]=_0x5bee92[_0x307c('0x4b')]['length']?_0x5bee92[_0x307c('0x4b')]:_0x40f99b[_0x307c('0x46')];_0x5bee92['order']=qs[_0x307c('0x51')](_0x23339b[_0x307c('0x48')][_0x307c('0x51')]);_0x5bee92[_0x307c('0x52')]=qs['filters'](_['pick'](_0x23339b[_0x307c('0x48')],_0x40f99b[_0x307c('0x49')]));if(_0x23339b[_0x307c('0x48')][_0x307c('0x54')]){_0x5bee92['where']=_[_0x307c('0x55')](_0x5bee92[_0x307c('0x52')],{'$or':_[_0x307c('0x41')](_0x5bee92['attributes'],function(_0x37446d){var _0x1992e2={};_0x1992e2[_0x37446d]={'$like':'%'+_0x23339b[_0x307c('0x48')][_0x307c('0x54')]+'%'};return _0x1992e2;})});}_0x5bee92=_[_0x307c('0x55')]({},_0x5bee92,_0x23339b[_0x307c('0x57')]);return _0x5c90f4[_0x307c('0xc0')](_0x5bee92);}})[_0x307c('0x25')](function(_0x2b898f){if(_0x2b898f){_0x426e55=_0x2b898f['length'];if(!_0x23339b['query']['hasOwnProperty'](_0x307c('0x4f'))){_0x5bee92[_0x307c('0x35')]=qs[_0x307c('0x35')](_0x23339b[_0x307c('0x48')]['limit']);_0x5bee92['offset']=qs['offset'](_0x23339b[_0x307c('0x48')]['offset']);}return _0x5c90f4[_0x307c('0xc0')](_0x5bee92);}})[_0x307c('0x25')](function(_0x123b91){if(_0x123b91){return _0x123b91?{'count':_0x426e55,'rows':_0x123b91}:null;}})[_0x307c('0x25')](respondWithResult(_0x438b04,null))[_0x307c('0x2f')](handleError(_0x438b04,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 0c7cb1b..97be36a 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 _0x683e=['events','FaxAccount','setMaxListeners','save','update','remove','emit','exports'];(function(_0x1aa6a9,_0x8ca9a9){var _0x4181f7=function(_0x457968){while(--_0x457968){_0x1aa6a9['push'](_0x1aa6a9['shift']());}};_0x4181f7(++_0x8ca9a9);}(_0x683e,0x190));var _0xe683=function(_0x47ba2f,_0x3ea976){_0x47ba2f=_0x47ba2f-0x0;var _0xc5c358=_0x683e[_0x47ba2f];return _0xc5c358;};'use strict';var EventEmitter=require(_0xe683('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xe683('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xe683('0x2')](0x0);var events={'afterCreate':_0xe683('0x3'),'afterUpdate':_0xe683('0x4'),'afterDestroy':_0xe683('0x5')};function emitEvent(_0x26ac38){return function(_0x4faf07,_0x2f59ea,_0x5a0c25){FaxAccountEvents[_0xe683('0x6')](_0x26ac38+':'+_0x4faf07['id'],_0x4faf07);FaxAccountEvents[_0xe683('0x6')](_0x26ac38,_0x4faf07);_0x5a0c25(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xe683('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x66f8=['remove','emit','hook','events','setMaxListeners','save','update'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x66f8,0x9d));var _0x866f=function(_0xe140af,_0x1e652a){_0xe140af=_0xe140af-0x0;var _0x5c9de2=_0x66f8[_0xe140af];return _0x5c9de2;};'use strict';var EventEmitter=require(_0x866f('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x866f('0x1')](0x0);var events={'afterCreate':_0x866f('0x2'),'afterUpdate':_0x866f('0x3'),'afterDestroy':_0x866f('0x4')};function emitEvent(_0xe00a82){return function(_0x1827de,_0x372549,_0x5e78b0){FaxAccountEvents[_0x866f('0x5')](_0xe00a82+':'+_0x1827de['id'],_0x1827de);FaxAccountEvents[_0x866f('0x5')](_0xe00a82,_0x1827de);_0x5e78b0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x866f('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 588017f..02c52a5 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 _0x81bf=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts'];(function(_0x4aa6a7,_0x3cd8a9){var _0x586167=function(_0x5e1452){while(--_0x5e1452){_0x4aa6a7['push'](_0x4aa6a7['shift']());}};_0x586167(++_0x3cd8a9);}(_0x81bf,0x12c));var _0xf81b=function(_0x53b8c0,_0x20d60e){_0x53b8c0=_0x53b8c0-0x0;var _0x57cd=_0x81bf[_0x53b8c0];return _0x57cd;};'use strict';var _=require(_0xf81b('0x0'));var util=require(_0xf81b('0x1'));var logger=require(_0xf81b('0x2'))(_0xf81b('0x3'));var moment=require('moment');var BPromise=require(_0xf81b('0x4'));var rp=require(_0xf81b('0x5'));var fs=require('fs');var path=require(_0xf81b('0x6'));var rimraf=require('rimraf');var config=require(_0xf81b('0x7'));var attributes=require(_0xf81b('0x8'));module[_0xf81b('0x9')]=function(_0x7b0d17,_0x3f3b4e){return _0x7b0d17[_0xf81b('0xa')]('FaxAccount',attributes,{'tableName':_0xf81b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23a5=['fax_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define'];(function(_0x217bbd,_0x1fdc65){var _0x43fb63=function(_0x21ba9f){while(--_0x21ba9f){_0x217bbd['push'](_0x217bbd['shift']());}};_0x43fb63(++_0x1fdc65);}(_0x23a5,0x14b));var _0x523a=function(_0x63b751,_0x96b44){_0x63b751=_0x63b751-0x0;var _0x564b98=_0x23a5[_0x63b751];return _0x564b98;};'use strict';var _=require(_0x523a('0x0'));var util=require('util');var logger=require(_0x523a('0x1'))(_0x523a('0x2'));var moment=require('moment');var BPromise=require(_0x523a('0x3'));var rp=require(_0x523a('0x4'));var fs=require('fs');var path=require(_0x523a('0x5'));var rimraf=require('rimraf');var config=require(_0x523a('0x6'));var attributes=require(_0x523a('0x7'));module[_0x523a('0x8')]=function(_0x4587b5,_0x51da68){return _0x4587b5[_0x523a('0x9')]('FaxAccount',attributes,{'tableName':_0x523a('0xa'),'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 6101fc2..5692da3 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 _0xe10c=['stringify','error','code','message','info','result','FaxAccount','options','raw','where','limit','include','map','model','attributes','debug','GetFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','orderBy','priority','create','FaxInteraction','length','unmanaged','*,*,*,*','created','ContactId','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x24c506,_0x19448b){var _0x4fc12a=function(_0x22b3f8){while(--_0x22b3f8){_0x24c506['push'](_0x24c506['shift']());}};_0x4fc12a(++_0x19448b);}(_0xe10c,0x1f0));var _0xce10=function(_0x25a202,_0x4fa782){_0x25a202=_0x25a202-0x0;var _0x197bfd=_0xe10c[_0x25a202];return _0x197bfd;};'use strict';var _=require(_0xce10('0x0'));var util=require(_0xce10('0x1'));var moment=require('moment');var BPromise=require(_0xce10('0x2'));var rs=require(_0xce10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce10('0x4'))['db'];var utils=require(_0xce10('0x5'));var logger=require(_0xce10('0x6'))(_0xce10('0x7'));var config=require(_0xce10('0x8'));var jayson=require(_0xce10('0x9'));var client=jayson[_0xce10('0xa')][_0xce10('0xb')]({'port':0x232c});config['redis']=_[_0xce10('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xce10('0xd'))(new Redis(config['redis']));require(_0xce10('0xe'))[_0xce10('0xf')](socket);function respondWithRpcPromise(_0x32b511,_0x5d144d,_0x25ea54){return new BPromise(function(_0x19a9e4,_0x124396){return client[_0xce10('0x10')](_0x32b511,_0x25ea54)[_0xce10('0x11')](function(_0x1c83fa){logger['info'](_0xce10('0x12'),_0x5d144d,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5d144d,_0xce10('0x13'),JSON[_0xce10('0x14')](_0x1c83fa));if(_0x1c83fa[_0xce10('0x15')]){if(_0x1c83fa[_0xce10('0x15')][_0xce10('0x16')]===0x1f4){logger[_0xce10('0x15')](_0xce10('0x12'),_0x5d144d,_0x1c83fa['error']['message']);return _0x124396(_0x1c83fa[_0xce10('0x15')]['message']);}logger[_0xce10('0x15')]('FaxAccount,\x20%s,\x20%s',_0x5d144d,_0x1c83fa[_0xce10('0x15')][_0xce10('0x17')]);return _0x19a9e4(_0x1c83fa[_0xce10('0x15')][_0xce10('0x17')]);}else{logger[_0xce10('0x18')](_0xce10('0x12'),_0x5d144d,_0xce10('0x13'));_0x19a9e4(_0x1c83fa[_0xce10('0x19')]['message']);}})['catch'](function(_0x35e325){logger['error'](_0xce10('0x12'),_0x5d144d,_0x35e325);_0x124396(_0x35e325);});});}exports['GetFaxAccount']=function(_0x19318b){var _0x241df3=this;return new Promise(function(_0x4d4f8b,_0x2beb4a){return db[_0xce10('0x1a')]['findAll']({'raw':_0x19318b[_0xce10('0x1b')]?_0x19318b[_0xce10('0x1b')][_0xce10('0x1c')]===undefined?!![]:![]:!![],'where':_0x19318b['options']?_0x19318b[_0xce10('0x1b')][_0xce10('0x1d')]||null:null,'attributes':_0x19318b['options']?_0x19318b[_0xce10('0x1b')]['attributes']||null:null,'limit':_0x19318b[_0xce10('0x1b')]?_0x19318b[_0xce10('0x1b')][_0xce10('0x1e')]||null:null,'include':_0x19318b[_0xce10('0x1b')]?_0x19318b[_0xce10('0x1b')][_0xce10('0x1f')]?_[_0xce10('0x20')](_0x19318b['options'][_0xce10('0x1f')],function(_0x27d519){return{'model':db[_0x27d519[_0xce10('0x21')]],'as':_0x27d519['as'],'attributes':_0x27d519[_0xce10('0x22')],'include':_0x27d519[_0xce10('0x1f')]?_['map'](_0x27d519[_0xce10('0x1f')],function(_0x6736d8){return{'model':db[_0x6736d8[_0xce10('0x21')]],'as':_0x6736d8['as'],'attributes':_0x6736d8[_0xce10('0x22')],'include':_0x6736d8['include']?_['map'](_0x6736d8[_0xce10('0x1f')],function(_0xcae893){return{'model':db[_0xcae893['model']],'as':_0xcae893['as'],'attributes':_0xcae893[_0xce10('0x22')]};}):[]};}):[]};}):[]:[]})[_0xce10('0x11')](function(_0x3e6117){logger['info']('GetFaxAccount',_0x19318b);logger[_0xce10('0x23')](_0xce10('0x24'),_0x19318b,JSON[_0xce10('0x14')](_0x3e6117));_0x4d4f8b(_0x3e6117);})['catch'](function(_0x202fff){logger[_0xce10('0x15')](_0xce10('0x24'),_0x202fff['message'],_0x19318b);_0x2beb4a(_0x241df3['error'](0x1f4,_0x202fff[_0xce10('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x250c4f,_0x26a8c2,_0x54bd93){var _0x3db822=this;return new Promise(function(_0x318d23,_0x4b3db3){var _0x54df19={'body':_0x250c4f[_0xce10('0x25')],'channel':_0xce10('0x26')};var _0x1595b1=[];var _0x2b7dfd=[];var _0x557e5a={};return db[_0xce10('0x27')][_0xce10('0x28')]()[_0xce10('0x11')](function(_0x31d300){if(!_0x31d300){throw new db[(_0xce10('0x29'))]['ValidationError'](_0xce10('0x2a'));}_0x1595b1=_[_0xce10('0x2b')](_[_0xce10('0x2c')](_0x31d300),[_0xce10('0x2d'),_0xce10('0x2e')]);_0x2b7dfd=_['difference'](_[_0xce10('0x2c')](_0x31d300),[_0xce10('0x2d'),'updatedAt','CompanyId',_0xce10('0x2f')]);if(_0x250c4f[_0xce10('0x25')]['id']){delete _0x250c4f['body']['id'];}if(_[_0xce10('0x30')](_0x250c4f['body'][_0xce10('0x31')])){throw new db[(_0xce10('0x29'))][(_0xce10('0x32'))](_0xce10('0x33'));}if(_['isNil'](_0x250c4f[_0xce10('0x25')][_0xce10('0x25')])||_0x250c4f[_0xce10('0x25')][_0xce10('0x25')]===''){throw new db[(_0xce10('0x29'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xce10('0x30')](_0x250c4f[_0xce10('0x25')][_0xce10('0x34')])){throw new db[(_0xce10('0x29'))][(_0xce10('0x32'))](_0xce10('0x35')+_0x2b7dfd);}if(!_[_0xce10('0x36')](_0x2b7dfd,_0x250c4f[_0xce10('0x25')]['mapKey'])){throw new db[(_0xce10('0x29'))][(_0xce10('0x32'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b7dfd);}_0x557e5a[_0x250c4f[_0xce10('0x25')]['mapKey']]=_0x250c4f[_0xce10('0x25')][_0xce10('0x31')];})[_0xce10('0x11')](function(){return db[_0xce10('0x1a')][_0xce10('0x37')]({'where':{'id':_0x250c4f[_0xce10('0x38')]['id']},'include':[{'model':db[_0xce10('0x39')],'as':_0xce10('0x3a'),'include':[{'model':db[_0xce10('0x27')],'as':_0xce10('0x3b'),'where':_0x557e5a,'limit':0x1,'order':[[_0xce10('0x2e'),_0xce10('0x3c')]]}]},{'model':db[_0xce10('0x3d')],'as':_0xce10('0x3e')}]});})['then'](function(_0x20a753){if(_0x20a753&&_0x20a753[_0xce10('0x3a')]){var _0x56378d=_0x20a753[_0xce10('0x3f')]({'plain':!![]});_0x54df19['account']=_0x56378d;_0x54df19['applications']=_0x56378d[_0xce10('0x3e')];_0x54df19[_0xce10('0x40')]=_0x56378d[_0xce10('0x3a')];_0x54df19[_0xce10('0x41')]=_[_0xce10('0x42')](_0x54df19[_0xce10('0x41')],[_0xce10('0x43')],['asc']);if(_0x54df19['account'][_0xce10('0x3e')]){delete _0x54df19[_0xce10('0x38')][_0xce10('0x3e')];}if(_0x54df19[_0xce10('0x38')]['List']&&_0x54df19[_0xce10('0x38')][_0xce10('0x3a')]['Contacts']['length']){return _0x54df19[_0xce10('0x38')][_0xce10('0x3a')][_0xce10('0x3b')][0x0];}var _0x5ba50d=_[_0xce10('0xc')](_0x250c4f[_0xce10('0x25')],{'firstName':_0x250c4f[_0xce10('0x25')][_0xce10('0x31')],'ListId':_0x56378d[_0xce10('0x2f')]});_0x5ba50d[_0x250c4f[_0xce10('0x25')]['mapKey']]=_0x250c4f[_0xce10('0x25')][_0xce10('0x31')];return db[_0xce10('0x27')][_0xce10('0x44')](_0x5ba50d,{'fields':_0x1595b1,'raw':!![]});}})[_0xce10('0x11')](function(_0x3676d0){_0x54df19['contact']=_0x3676d0;if(_0x3676d0){var _0x39df19={'ContactId':_0x3676d0['id'],'FaxAccountId':_0x250c4f[_0xce10('0x38')]['id'],'fax':_0x3676d0[_0xce10('0x26')]};return db['FaxInteraction'][_0xce10('0x37')]({'where':{'ContactId':_0x3676d0['id'],'closed':![],'FaxAccountId':_0x250c4f['account']['id']}})['then'](function(_0x3515ec){if(_0x3515ec){return[_0x3515ec,![]];}return db[_0xce10('0x45')][_0xce10('0x44')](_0x39df19)[_0xce10('0x11')](function(_0x261e12){return[_0x261e12,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x174a78,_0x27bc92){var _0xdc712a=_0x174a78[_0xce10('0x3f')]({'plain':!![]});if(_0x27bc92){if(_0x54df19[_0xce10('0x38')]['autoclose']){_0x54df19['applications']['push']({'id':0x0,'priority':_0x54df19['applications'][_0xce10('0x46')]+0x1,'app':'close','appdata':_0xce10('0x47'),'interval':_0xce10('0x48')});}_0xdc712a[_0xce10('0x49')]=!![];}else{_0xdc712a['created']=![];}_0x54df19['interaction']=_0xdc712a;return db['FaxMessage']['create']({'body':_0x250c4f[_0xce10('0x25')][_0xce10('0x25')],'FaxAccountId':_0x250c4f['account']['id'],'FaxInteractionId':_0x174a78['id'],'direction':'in','ContactId':_0x174a78[_0xce10('0x4a')],'AttachmentId':_0x250c4f[_0xce10('0x25')][_0xce10('0x4b')]});})[_0xce10('0x11')](function(_0x8987e8){_0x54df19[_0xce10('0x17')]=_0x8987e8;if(_0x54df19[_0xce10('0x4c')][_0xce10('0x4d')]){return db[_0xce10('0x4e')][_0xce10('0x37')]({'attributes':['id',_0xce10('0x4f')],'where':{'id':_0x54df19[_0xce10('0x4c')][_0xce10('0x4d')]}})[_0xce10('0x11')](function(_0x42e83a){if(_0x42e83a){_0x54df19[_0xce10('0x41')][_0xce10('0x50')]({'id':0x0,'priority':0x0,'app':_0xce10('0x51'),'appdata':_0x42e83a[_0xce10('0x4f')]+','+(_0x54df19[_0xce10('0x38')][_0xce10('0x52')]||0xa),'interval':_0xce10('0x48')});}return respondWithRpcPromise(_0xce10('0x53'),_0xce10('0x54'),_0x54df19);});}return respondWithRpcPromise('Start','startRouting',_0x54df19);})['then'](function(_0x58b3f7){_0x318d23(_0x58b3f7);})[_0xce10('0x55')](function(_0xc32802){_0x4b3db3(_0x3db822[_0xce10('0x15')](0x1f4,_0xc32802[_0xce10('0x17')]));});});}; \ No newline at end of file +var _0xa8b0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetFaxAccount','options','raw','map','model','attributes','include','NotifyFaxAccount','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','body','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','DESC','FaxApplication','Applications','get','applications','orderBy','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','agent','Start','startRouting'];(function(_0x1758e1,_0xbddd26){var _0x635e0c=function(_0x55e7cd){while(--_0x55e7cd){_0x1758e1['push'](_0x1758e1['shift']());}};_0x635e0c(++_0xbddd26);}(_0xa8b0,0xa8));var _0x0a8b=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0xa8b0[_0x1b2422];return _0x376573;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0a8b('0x0'));var BPromise=require(_0x0a8b('0x1'));var rs=require(_0x0a8b('0x2'));var fs=require('fs');var Redis=require(_0x0a8b('0x3'));var db=require(_0x0a8b('0x4'))['db'];var utils=require(_0x0a8b('0x5'));var logger=require(_0x0a8b('0x6'))(_0x0a8b('0x7'));var config=require(_0x0a8b('0x8'));var jayson=require(_0x0a8b('0x9'));var client=jayson[_0x0a8b('0xa')][_0x0a8b('0xb')]({'port':0x232c});config['redis']=_['defaults'](config[_0x0a8b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a8b('0xc')]));require('./faxAccount.socket')[_0x0a8b('0xd')](socket);function respondWithRpcPromise(_0x37eb29,_0x4ebd5f,_0x513ab5){return new BPromise(function(_0xfbec65,_0x49433d){return client[_0x0a8b('0xe')](_0x37eb29,_0x513ab5)[_0x0a8b('0xf')](function(_0x4f42ee){logger[_0x0a8b('0x10')](_0x0a8b('0x11'),_0x4ebd5f,'request\x20sent');logger[_0x0a8b('0x12')](_0x0a8b('0x13'),_0x4ebd5f,'request\x20sent',JSON[_0x0a8b('0x14')](_0x4f42ee));if(_0x4f42ee[_0x0a8b('0x15')]){if(_0x4f42ee[_0x0a8b('0x15')]['code']===0x1f4){logger[_0x0a8b('0x15')](_0x0a8b('0x11'),_0x4ebd5f,_0x4f42ee[_0x0a8b('0x15')][_0x0a8b('0x16')]);return _0x49433d(_0x4f42ee[_0x0a8b('0x15')][_0x0a8b('0x16')]);}logger[_0x0a8b('0x15')](_0x0a8b('0x11'),_0x4ebd5f,_0x4f42ee[_0x0a8b('0x15')][_0x0a8b('0x16')]);return _0xfbec65(_0x4f42ee[_0x0a8b('0x15')][_0x0a8b('0x16')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x4ebd5f,_0x0a8b('0x17'));_0xfbec65(_0x4f42ee[_0x0a8b('0x18')][_0x0a8b('0x16')]);}})[_0x0a8b('0x19')](function(_0x3e94e2){logger['error'](_0x0a8b('0x11'),_0x4ebd5f,_0x3e94e2);_0x49433d(_0x3e94e2);});});}exports[_0x0a8b('0x1a')]=function(_0x3ce599){var _0xb1f23f=this;return new Promise(function(_0x372fb9,_0x297a91){return db['FaxAccount']['findAll']({'raw':_0x3ce599[_0x0a8b('0x1b')]?_0x3ce599[_0x0a8b('0x1b')][_0x0a8b('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ce599[_0x0a8b('0x1b')]?_0x3ce599[_0x0a8b('0x1b')]['where']||null:null,'attributes':_0x3ce599[_0x0a8b('0x1b')]?_0x3ce599[_0x0a8b('0x1b')]['attributes']||null:null,'limit':_0x3ce599[_0x0a8b('0x1b')]?_0x3ce599[_0x0a8b('0x1b')]['limit']||null:null,'include':_0x3ce599[_0x0a8b('0x1b')]?_0x3ce599[_0x0a8b('0x1b')]['include']?_[_0x0a8b('0x1d')](_0x3ce599[_0x0a8b('0x1b')]['include'],function(_0x5a3446){return{'model':db[_0x5a3446[_0x0a8b('0x1e')]],'as':_0x5a3446['as'],'attributes':_0x5a3446[_0x0a8b('0x1f')],'include':_0x5a3446[_0x0a8b('0x20')]?_[_0x0a8b('0x1d')](_0x5a3446[_0x0a8b('0x20')],function(_0x4e0989){return{'model':db[_0x4e0989[_0x0a8b('0x1e')]],'as':_0x4e0989['as'],'attributes':_0x4e0989[_0x0a8b('0x1f')],'include':_0x4e0989[_0x0a8b('0x20')]?_[_0x0a8b('0x1d')](_0x4e0989[_0x0a8b('0x20')],function(_0x2a6b06){return{'model':db[_0x2a6b06[_0x0a8b('0x1e')]],'as':_0x2a6b06['as'],'attributes':_0x2a6b06['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a8b('0xf')](function(_0x4e855d){logger['info'](_0x0a8b('0x1a'),_0x3ce599);logger[_0x0a8b('0x12')](_0x0a8b('0x1a'),_0x3ce599,JSON[_0x0a8b('0x14')](_0x4e855d));_0x372fb9(_0x4e855d);})[_0x0a8b('0x19')](function(_0x3dc0ab){logger[_0x0a8b('0x15')]('GetFaxAccount',_0x3dc0ab[_0x0a8b('0x16')],_0x3ce599);_0x297a91(_0xb1f23f['error'](0x1f4,_0x3dc0ab['message']));});});};exports[_0x0a8b('0x21')]=function(_0x1162bc,_0x23a40e,_0x104738){var _0x24f1bb=this;return new Promise(function(_0x130635,_0x2e7ee8){var _0x173859={'body':_0x1162bc['body'],'channel':_0x0a8b('0x22')};var _0x23f861=[];var _0x2be24c=[];var _0x4b74d5={};return db[_0x0a8b('0x23')][_0x0a8b('0x24')]()[_0x0a8b('0xf')](function(_0x4e7db0){if(!_0x4e7db0){throw new db['Sequelize'][(_0x0a8b('0x25'))](_0x0a8b('0x26'));}_0x23f861=_[_0x0a8b('0x27')](_[_0x0a8b('0x28')](_0x4e7db0),[_0x0a8b('0x29'),_0x0a8b('0x2a')]);_0x2be24c=_[_0x0a8b('0x27')](_[_0x0a8b('0x28')](_0x4e7db0),[_0x0a8b('0x29'),_0x0a8b('0x2a'),'CompanyId',_0x0a8b('0x2b')]);if(_0x1162bc[_0x0a8b('0x2c')]['id']){delete _0x1162bc['body']['id'];}if(_[_0x0a8b('0x2d')](_0x1162bc[_0x0a8b('0x2c')][_0x0a8b('0x2e')])){throw new db[(_0x0a8b('0x2f'))][(_0x0a8b('0x25'))](_0x0a8b('0x30'));}if(_[_0x0a8b('0x2d')](_0x1162bc['body'][_0x0a8b('0x2c')])||_0x1162bc[_0x0a8b('0x2c')][_0x0a8b('0x2c')]===''){throw new db[(_0x0a8b('0x2f'))][(_0x0a8b('0x25'))](_0x0a8b('0x31'));}if(_[_0x0a8b('0x2d')](_0x1162bc[_0x0a8b('0x2c')][_0x0a8b('0x32')])){throw new db[(_0x0a8b('0x2f'))][(_0x0a8b('0x25'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2be24c);}if(!_[_0x0a8b('0x33')](_0x2be24c,_0x1162bc[_0x0a8b('0x2c')][_0x0a8b('0x32')])){throw new db['Sequelize']['ValidationError'](_0x0a8b('0x34')+_0x2be24c);}_0x4b74d5[_0x1162bc['body'][_0x0a8b('0x32')]]=_0x1162bc['body'][_0x0a8b('0x2e')];})['then'](function(){return db['FaxAccount'][_0x0a8b('0x35')]({'where':{'id':_0x1162bc[_0x0a8b('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0x0a8b('0x37'),'include':[{'model':db[_0x0a8b('0x23')],'as':_0x0a8b('0x38'),'where':_0x4b74d5,'limit':0x1,'order':[[_0x0a8b('0x2a'),_0x0a8b('0x39')]]}]},{'model':db[_0x0a8b('0x3a')],'as':_0x0a8b('0x3b')}]});})['then'](function(_0x493e7c){if(_0x493e7c&&_0x493e7c[_0x0a8b('0x37')]){var _0x246a9f=_0x493e7c[_0x0a8b('0x3c')]({'plain':!![]});_0x173859[_0x0a8b('0x36')]=_0x246a9f;_0x173859[_0x0a8b('0x3d')]=_0x246a9f[_0x0a8b('0x3b')];_0x173859['list']=_0x246a9f[_0x0a8b('0x37')];_0x173859[_0x0a8b('0x3d')]=_[_0x0a8b('0x3e')](_0x173859[_0x0a8b('0x3d')],['priority'],[_0x0a8b('0x3f')]);if(_0x173859[_0x0a8b('0x36')][_0x0a8b('0x3b')]){delete _0x173859[_0x0a8b('0x36')][_0x0a8b('0x3b')];}if(_0x173859[_0x0a8b('0x36')]['List']&&_0x173859[_0x0a8b('0x36')]['List'][_0x0a8b('0x38')][_0x0a8b('0x40')]){return _0x173859[_0x0a8b('0x36')][_0x0a8b('0x37')]['Contacts'][0x0];}var _0x218284=_['defaults'](_0x1162bc[_0x0a8b('0x2c')],{'firstName':_0x1162bc[_0x0a8b('0x2c')][_0x0a8b('0x2e')],'ListId':_0x246a9f[_0x0a8b('0x2b')]});_0x218284[_0x1162bc[_0x0a8b('0x2c')]['mapKey']]=_0x1162bc[_0x0a8b('0x2c')][_0x0a8b('0x2e')];return db['CmContact'][_0x0a8b('0x41')](_0x218284,{'fields':_0x23f861,'raw':!![]});}})['then'](function(_0x3be933){_0x173859[_0x0a8b('0x42')]=_0x3be933;if(_0x3be933){var _0x836a66={'ContactId':_0x3be933['id'],'FaxAccountId':_0x1162bc[_0x0a8b('0x36')]['id'],'fax':_0x3be933[_0x0a8b('0x22')]};return db[_0x0a8b('0x43')][_0x0a8b('0x35')]({'where':{'ContactId':_0x3be933['id'],'closed':![],'FaxAccountId':_0x1162bc[_0x0a8b('0x36')]['id']}})[_0x0a8b('0xf')](function(_0x4a2471){if(_0x4a2471){return[_0x4a2471,![]];}return db[_0x0a8b('0x43')][_0x0a8b('0x41')](_0x836a66)[_0x0a8b('0xf')](function(_0x12d84e){return[_0x12d84e,!![]];});});}else{throw new Error(_0x0a8b('0x44'));}})[_0x0a8b('0x45')](function(_0x1071d8,_0x3e713c){var _0x1d17b4=_0x1071d8[_0x0a8b('0x3c')]({'plain':!![]});if(_0x3e713c){if(_0x173859[_0x0a8b('0x36')]['autoclose']){_0x173859[_0x0a8b('0x3d')][_0x0a8b('0x46')]({'id':0x0,'priority':_0x173859[_0x0a8b('0x3d')][_0x0a8b('0x40')]+0x1,'app':_0x0a8b('0x47'),'appdata':_0x0a8b('0x48'),'interval':_0x0a8b('0x49')});}_0x1d17b4['created']=!![];}else{_0x1d17b4['created']=![];}_0x173859[_0x0a8b('0x4a')]=_0x1d17b4;return db[_0x0a8b('0x4b')][_0x0a8b('0x41')]({'body':_0x1162bc[_0x0a8b('0x2c')][_0x0a8b('0x2c')],'FaxAccountId':_0x1162bc[_0x0a8b('0x36')]['id'],'FaxInteractionId':_0x1071d8['id'],'direction':'in','ContactId':_0x1071d8[_0x0a8b('0x4c')],'AttachmentId':_0x1162bc['body'][_0x0a8b('0x4d')]});})[_0x0a8b('0xf')](function(_0xc8e01c){_0x173859[_0x0a8b('0x16')]=_0xc8e01c;if(_0x173859[_0x0a8b('0x4a')][_0x0a8b('0x4e')]){return db[_0x0a8b('0x4f')][_0x0a8b('0x35')]({'attributes':['id','name'],'where':{'id':_0x173859[_0x0a8b('0x4a')][_0x0a8b('0x4e')]}})[_0x0a8b('0xf')](function(_0x4f878d){if(_0x4f878d){_0x173859['applications'][_0x0a8b('0x50')]({'id':0x0,'priority':0x0,'app':_0x0a8b('0x51'),'appdata':_0x4f878d['name']+','+(_0x173859[_0x0a8b('0x36')]['waitForTheAssignedAgent']||0xa),'interval':_0x0a8b('0x49')});}return respondWithRpcPromise(_0x0a8b('0x52'),'startRouting',_0x173859);});}return respondWithRpcPromise('Start',_0x0a8b('0x53'),_0x173859);})[_0x0a8b('0xf')](function(_0x4c4606){_0x130635(_0x4c4606);})[_0x0a8b('0x19')](function(_0x5b2873){_0x2e7ee8(_0x24f1bb[_0x0a8b('0x15')](0x1f4,_0x5b2873[_0x0a8b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index c354b94..0becf36 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 _0x9f0e=['save','remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x289113,_0x34b31f){var _0x190bc2=function(_0x232a0e){while(--_0x232a0e){_0x289113['push'](_0x289113['shift']());}};_0x190bc2(++_0x34b31f);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2fe571,_0x1a565e){_0x2fe571=_0x2fe571-0x0;var _0x134f66=_0x9f0e[_0x2fe571];return _0x134f66;};'use strict';var FaxAccountEvents=require(_0xe9f0('0x0'));var events=[_0xe9f0('0x1'),_0xe9f0('0x2'),_0xe9f0('0x3')];function createListener(_0x146ad8,_0x4a1a30){return function(_0x5856dc){_0x4a1a30[_0xe9f0('0x4')](_0x146ad8,_0x5856dc);};}function removeListener(_0x150a03,_0x3c589d){return function(){FaxAccountEvents[_0xe9f0('0x5')](_0x150a03,_0x3c589d);};}exports[_0xe9f0('0x6')]=function(_0x50313d){for(var _0x5b87c1=0x0,_0x3a17b3=events[_0xe9f0('0x7')];_0x5b87c1<_0x3a17b3;_0x5b87c1++){var _0xe64a79=events[_0x5b87c1];var _0x4be6a6=createListener(_0xe9f0('0x8')+_0xe64a79,_0x50313d);FaxAccountEvents['on'](_0xe64a79,_0x4be6a6);}}; \ No newline at end of file +var _0xa6b0=['faxAccount:','./faxAccount.events','save','removeListener','register','length'];(function(_0x50d84b,_0x1d7ea7){var _0x6d4270=function(_0x883f21){while(--_0x883f21){_0x50d84b['push'](_0x50d84b['shift']());}};_0x6d4270(++_0x1d7ea7);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x39f55f,_0x3a89ac){_0x39f55f=_0x39f55f-0x0;var _0x2bfdf6=_0xa6b0[_0x39f55f];return _0x2bfdf6;};'use strict';var FaxAccountEvents=require(_0x0a6b('0x0'));var events=[_0x0a6b('0x1'),'remove','update'];function createListener(_0x4597d6,_0x2c0d7f){return function(_0x13d4d5){_0x2c0d7f['emit'](_0x4597d6,_0x13d4d5);};}function removeListener(_0x29ff80,_0x33e8c3){return function(){FaxAccountEvents[_0x0a6b('0x2')](_0x29ff80,_0x33e8c3);};}exports[_0x0a6b('0x3')]=function(_0x3dc2b0){for(var _0x3b6967=0x0,_0x1b5fb5=events[_0x0a6b('0x4')];_0x3b6967<_0x1b5fb5;_0x3b6967++){var _0x26f761=events[_0x3b6967];var _0x340a33=createListener(_0x0a6b('0x5')+_0x26f761,_0x3dc2b0);FaxAccountEvents['on'](_0x26f761,_0x340a33);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 55873a0..8089a1c 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 _0xede6=['send','addAgents','put','update','delete','removeDispositions','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','updateAccountApplications','/:id/send'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xede6,0x11e));var _0x6ede=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xede6[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x6ede('0x0'));var util=require(_0x6ede('0x1'));var path=require(_0x6ede('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ede('0x3'));var router=express[_0x6ede('0x4')]();var auth=require(_0x6ede('0x5'));var interaction=require(_0x6ede('0x6'));var config=require('../../config/environment');var controller=require(_0x6ede('0x7'));router['get']('/',auth[_0x6ede('0x8')](),controller[_0x6ede('0x9')]);router[_0x6ede('0xa')]('/describe',auth[_0x6ede('0x8')](),controller[_0x6ede('0xb')]);router[_0x6ede('0xa')](_0x6ede('0xc'),auth['isAuthenticated'](),controller[_0x6ede('0xd')]);router['get'](_0x6ede('0xe'),auth[_0x6ede('0x8')](),controller[_0x6ede('0xf')]);router[_0x6ede('0xa')](_0x6ede('0x10'),auth['isAuthenticated'](),controller[_0x6ede('0x11')]);router[_0x6ede('0xa')](_0x6ede('0x12'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x13')]);router[_0x6ede('0xa')](_0x6ede('0x14'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x15')]);router[_0x6ede('0xa')](_0x6ede('0x16'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x17')]);router[_0x6ede('0xa')](_0x6ede('0x18'),auth[_0x6ede('0x8')](),controller['getAgents']);router[_0x6ede('0x19')]('/',auth[_0x6ede('0x8')](),controller[_0x6ede('0x1a')]);router[_0x6ede('0x19')](_0x6ede('0xe'),auth['isAuthenticated'](),controller[_0x6ede('0x1b')]);router[_0x6ede('0x19')]('/:id/canned_answers',auth[_0x6ede('0x8')](),controller[_0x6ede('0x1c')]);router[_0x6ede('0x19')]('/:id/interactions',auth[_0x6ede('0x8')](),controller[_0x6ede('0x1d')]);router[_0x6ede('0x19')](_0x6ede('0x14'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x1e')]);router[_0x6ede('0x19')](_0x6ede('0x1f'),auth['isAuthenticated'](),controller['addAccountApplications']);router[_0x6ede('0x19')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0x6ede('0x20')]);router['post'](_0x6ede('0x21'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x22')]);router[_0x6ede('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x6ede('0x23')]);router[_0x6ede('0x24')](_0x6ede('0xc'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x25')]);router[_0x6ede('0x26')](_0x6ede('0xc'),auth[_0x6ede('0x8')](),controller['destroy']);router[_0x6ede('0x26')](_0x6ede('0xe'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x27')]);router[_0x6ede('0x26')](_0x6ede('0x10'),auth[_0x6ede('0x8')](),controller['removeAnswers']);router['delete'](_0x6ede('0x18'),auth[_0x6ede('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x9d34=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','post','create','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x273c89,_0x11b381){var _0x55ec3b=function(_0x44f328){while(--_0x44f328){_0x273c89['push'](_0x273c89['shift']());}};_0x55ec3b(++_0x11b381);}(_0x9d34,0x182));var _0x49d3=function(_0x13eaae,_0x11ec0a){_0x13eaae=_0x13eaae-0x0;var _0x4493db=_0x9d34[_0x13eaae];return _0x4493db;};'use strict';var multer=require(_0x49d3('0x0'));var util=require(_0x49d3('0x1'));var path=require(_0x49d3('0x2'));var timeout=require(_0x49d3('0x3'));var express=require(_0x49d3('0x4'));var router=express[_0x49d3('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x49d3('0x6'));var config=require(_0x49d3('0x7'));var controller=require(_0x49d3('0x8'));router[_0x49d3('0x9')]('/',auth[_0x49d3('0xa')](),controller[_0x49d3('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x49d3('0xc')]);router['get'](_0x49d3('0xd'),auth[_0x49d3('0xa')](),controller[_0x49d3('0xe')]);router[_0x49d3('0x9')](_0x49d3('0xf'),auth[_0x49d3('0xa')](),controller[_0x49d3('0x10')]);router[_0x49d3('0x9')](_0x49d3('0x11'),auth[_0x49d3('0xa')](),controller[_0x49d3('0x12')]);router[_0x49d3('0x9')](_0x49d3('0x13'),auth[_0x49d3('0xa')](),controller[_0x49d3('0x14')]);router[_0x49d3('0x9')](_0x49d3('0x15'),auth[_0x49d3('0xa')](),controller['getApplications']);router['get'](_0x49d3('0x16'),auth['isAuthenticated'](),controller[_0x49d3('0x17')]);router[_0x49d3('0x9')](_0x49d3('0x18'),auth[_0x49d3('0xa')](),controller['getAgents']);router[_0x49d3('0x19')]('/',auth[_0x49d3('0xa')](),controller[_0x49d3('0x1a')]);router[_0x49d3('0x19')](_0x49d3('0xf'),auth[_0x49d3('0xa')](),controller['addDisposition']);router[_0x49d3('0x19')](_0x49d3('0x11'),auth[_0x49d3('0xa')](),controller['addAnswer']);router[_0x49d3('0x19')](_0x49d3('0x13'),auth[_0x49d3('0xa')](),controller['addInteraction']);router['post'](_0x49d3('0x15'),auth['isAuthenticated'](),controller[_0x49d3('0x1b')]);router['post']('/addaccountapplications',auth[_0x49d3('0xa')](),controller[_0x49d3('0x1c')]);router['post'](_0x49d3('0x1d'),auth['isAuthenticated'](),controller[_0x49d3('0x1e')]);router[_0x49d3('0x19')](_0x49d3('0x1f'),auth['isAuthenticated'](),controller[_0x49d3('0x20')]);router[_0x49d3('0x19')]('/:id/users',auth[_0x49d3('0xa')](),controller[_0x49d3('0x21')]);router[_0x49d3('0x22')](_0x49d3('0xd'),auth[_0x49d3('0xa')](),controller[_0x49d3('0x23')]);router['delete'](_0x49d3('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x49d3('0x24')]('/:id/dispositions',auth[_0x49d3('0xa')](),controller[_0x49d3('0x25')]);router[_0x49d3('0x24')](_0x49d3('0x11'),auth[_0x49d3('0xa')](),controller[_0x49d3('0x26')]);router[_0x49d3('0x24')]('/:id/users',auth['isAuthenticated'](),controller[_0x49d3('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 466a145..aaa41fa 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 _0x8c8c=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x587445,_0x37dfb6){var _0x27fb18=function(_0x1bceac){while(--_0x1bceac){_0x587445['push'](_0x587445['shift']());}};_0x27fb18(++_0x37dfb6);}(_0x8c8c,0x185));var _0xc8c8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8c8c[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xc8c8('0x0'));module[_0xc8c8('0x1')]={'priority':{'type':Sequelize[_0xc8c8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc8c8('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc8c8('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc8c8('0x5')}}; \ No newline at end of file +var _0xa2cb=['sequelize','exports','STRING','noop','TEXT'];(function(_0x51dc70,_0x3f1c43){var _0x2c7e45=function(_0x39e4db){while(--_0x39e4db){_0x51dc70['push'](_0x51dc70['shift']());}};_0x2c7e45(++_0x3f1c43);}(_0xa2cb,0x7d));var _0xba2c=function(_0x394a0d,_0x417bf2){_0x394a0d=_0x394a0d-0x0;var _0x1f25c5=_0xa2cb[_0x394a0d];return _0x1f25c5;};'use strict';var Sequelize=require(_0xba2c('0x0'));module[_0xba2c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xba2c('0x2')],'allowNull':![],'defaultValue':_0xba2c('0x3')},'appdata':{'type':Sequelize[_0xba2c('0x4')]()},'description':{'type':Sequelize[_0xba2c('0x2')]},'interval':{'type':Sequelize[_0xba2c('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 3b94c74..81ccaab 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 _0xbb71=['params','FaxApplication','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show'];(function(_0x2d1ebd,_0x23d96c){var _0x29dff2=function(_0x2fbf0d){while(--_0x2fbf0d){_0x2d1ebd['push'](_0x2d1ebd['shift']());}};_0x29dff2(++_0x23d96c);}(_0xbb71,0xed));var _0x1bb7=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xbb71[_0x17b6e3];return _0x3906f3;};'use strict';var pdf=require(_0x1bb7('0x0'));var emlformat=require(_0x1bb7('0x1'));var rimraf=require(_0x1bb7('0x2'));var zipdir=require(_0x1bb7('0x3'));var jsonpatch=require(_0x1bb7('0x4'));var rp=require(_0x1bb7('0x5'));var moment=require('moment');var BPromise=require(_0x1bb7('0x6'));var Mustache=require(_0x1bb7('0x7'));var util=require(_0x1bb7('0x8'));var path=require(_0x1bb7('0x9'));var sox=require('sox');var csv=require(_0x1bb7('0xa'));var ejs=require(_0x1bb7('0xb'));var fs=require('fs');var _=require(_0x1bb7('0xc'));var squel=require(_0x1bb7('0xd'));var crypto=require('crypto');var jsforce=require(_0x1bb7('0xe'));var deskjs=require(_0x1bb7('0xf'));var toCsv=require(_0x1bb7('0xa'));var querystring=require(_0x1bb7('0x10'));var Papa=require(_0x1bb7('0x11'));var Redis=require(_0x1bb7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1bb7('0x13'));var as=require(_0x1bb7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1bb7('0x15'))(_0x1bb7('0x16'));var utils=require(_0x1bb7('0x17'));var config=require(_0x1bb7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1bb7('0x19'))['db'];function respondWithStatusCode(_0x100070,_0x589157){_0x589157=_0x589157||0xcc;return function(_0x4a3cbc){if(_0x4a3cbc){return _0x100070['sendStatus'](_0x589157);}return _0x100070[_0x1bb7('0x1a')](_0x589157)['end']();};}function respondWithResult(_0x2925b2,_0x3c803a){_0x3c803a=_0x3c803a||0xc8;return function(_0x39fcf4){if(_0x39fcf4){return _0x2925b2[_0x1bb7('0x1a')](_0x3c803a)[_0x1bb7('0x1b')](_0x39fcf4);}};}function respondWithFilteredResult(_0x557fdc,_0xcf7d9a){return function(_0x24cf7c){if(_0x24cf7c){var _0x3d63a6=_0x24cf7c['count'],_0x2e1bef=_0xcf7d9a[_0x1bb7('0x1c')],_0x43a2d1=_0xcf7d9a[_0x1bb7('0x1c')]+_0xcf7d9a[_0x1bb7('0x1d')],_0x56356b;if(_0x43a2d1>=_0x3d63a6){_0x43a2d1=_0x3d63a6;_0x56356b=0xc8;}else{_0x56356b=0xce;}_0x557fdc[_0x1bb7('0x1a')](_0x56356b);return _0x557fdc[_0x1bb7('0x1e')](_0x1bb7('0x1f'),_0x2e1bef+'-'+_0x43a2d1+'/'+_0x3d63a6)[_0x1bb7('0x1b')](_0x24cf7c);}return null;};}function patchUpdates(_0x4ba2f1){return function(_0xf6a4f6){try{jsonpatch[_0x1bb7('0x20')](_0xf6a4f6,_0x4ba2f1,!![]);}catch(_0x401d09){return BPromise[_0x1bb7('0x21')](_0x401d09);}return _0xf6a4f6[_0x1bb7('0x22')]();};}function saveUpdates(_0x191fb2,_0x23c00a){return function(_0x170ca5){if(_0x170ca5){return _0x170ca5[_0x1bb7('0x23')](_0x191fb2)['then'](function(_0x21bd39){return _0x21bd39;});}return null;};}function removeEntity(_0x543b72,_0x3a362d){return function(_0x52e4b1){if(_0x52e4b1){return _0x52e4b1[_0x1bb7('0x24')]()[_0x1bb7('0x25')](function(){_0x543b72[_0x1bb7('0x1a')](0xcc)[_0x1bb7('0x26')]();});}};}function handleEntityNotFound(_0xca1c40,_0x5dd0d3){return function(_0x2df75b){if(!_0x2df75b){_0xca1c40[_0x1bb7('0x27')](0x194);}return _0x2df75b;};}function handleError(_0x3bc5d8,_0x588eea){_0x588eea=_0x588eea||0x1f4;return function(_0x47d890){logger[_0x1bb7('0x28')](_0x47d890[_0x1bb7('0x29')]);if(_0x47d890['name']){delete _0x47d890[_0x1bb7('0x2a')];}_0x3bc5d8[_0x1bb7('0x1a')](_0x588eea)['send'](_0x47d890);};}exports['index']=function(_0x28db03,_0x27df79){var _0x1f3d6e={},_0x1224b8={},_0xf53772={'count':0x0,'rows':[]};var _0x41f6ae=_['map'](db['FaxApplication'][_0x1bb7('0x2b')],function(_0x583eae){return{'name':_0x583eae['fieldName'],'type':_0x583eae[_0x1bb7('0x2c')][_0x1bb7('0x2d')]};});_0x1224b8[_0x1bb7('0x2e')]=_[_0x1bb7('0x2f')](_0x41f6ae,_0x1bb7('0x2a'));_0x1224b8[_0x1bb7('0x30')]=_[_0x1bb7('0x31')](_0x28db03[_0x1bb7('0x30')]);_0x1224b8[_0x1bb7('0x32')]=_[_0x1bb7('0x33')](_0x1224b8[_0x1bb7('0x2e')],_0x1224b8[_0x1bb7('0x30')]);_0x1f3d6e['attributes']=_[_0x1bb7('0x33')](_0x1224b8[_0x1bb7('0x2e')],qs[_0x1bb7('0x34')](_0x28db03['query']['fields']));_0x1f3d6e[_0x1bb7('0x35')]=_0x1f3d6e[_0x1bb7('0x35')][_0x1bb7('0x36')]?_0x1f3d6e[_0x1bb7('0x35')]:_0x1224b8['model'];if(!_0x28db03[_0x1bb7('0x30')][_0x1bb7('0x37')](_0x1bb7('0x38'))){_0x1f3d6e['limit']=qs[_0x1bb7('0x1d')](_0x28db03[_0x1bb7('0x30')][_0x1bb7('0x1d')]);_0x1f3d6e[_0x1bb7('0x1c')]=qs[_0x1bb7('0x1c')](_0x28db03[_0x1bb7('0x30')][_0x1bb7('0x1c')]);}_0x1f3d6e[_0x1bb7('0x39')]=qs[_0x1bb7('0x3a')](_0x28db03[_0x1bb7('0x30')][_0x1bb7('0x3a')]);_0x1f3d6e[_0x1bb7('0x3b')]=qs[_0x1bb7('0x32')](_[_0x1bb7('0x3c')](_0x28db03['query'],_0x1224b8[_0x1bb7('0x32')]),_0x41f6ae);if(_0x28db03[_0x1bb7('0x30')][_0x1bb7('0x3d')]){_0x1f3d6e['where']=_[_0x1bb7('0x3e')](_0x1f3d6e['where'],{'$or':_['map'](_0x41f6ae,function(_0x20ac18){if(_0x20ac18[_0x1bb7('0x2c')]!==_0x1bb7('0x3f')){var _0x256161={};_0x256161[_0x20ac18[_0x1bb7('0x2a')]]={'$like':'%'+_0x28db03[_0x1bb7('0x30')]['filter']+'%'};return _0x256161;}})});}_0x1f3d6e=_[_0x1bb7('0x3e')]({},_0x1f3d6e,_0x28db03[_0x1bb7('0x40')]);var _0x5b934c={'where':_0x1f3d6e[_0x1bb7('0x3b')]};return db['FaxApplication'][_0x1bb7('0x41')](_0x5b934c)[_0x1bb7('0x25')](function(_0x3e036f){_0xf53772[_0x1bb7('0x41')]=_0x3e036f;if(_0x28db03[_0x1bb7('0x30')]['includeAll']){_0x1f3d6e[_0x1bb7('0x42')]=[{'all':!![]}];}return db['FaxApplication'][_0x1bb7('0x43')](_0x1f3d6e);})['then'](function(_0x1249c0){_0xf53772[_0x1bb7('0x44')]=_0x1249c0;return _0xf53772;})[_0x1bb7('0x25')](respondWithFilteredResult(_0x27df79,_0x1f3d6e))[_0x1bb7('0x45')](handleError(_0x27df79,null));};exports[_0x1bb7('0x46')]=function(_0x51f984,_0x90d605){var _0x358427={'raw':!![],'where':{'id':_0x51f984[_0x1bb7('0x47')]['id']}},_0x4092b2={};_0x4092b2[_0x1bb7('0x2e')]=_['keys'](db[_0x1bb7('0x48')][_0x1bb7('0x2b')]);_0x4092b2[_0x1bb7('0x30')]=_[_0x1bb7('0x31')](_0x51f984['query']);_0x4092b2[_0x1bb7('0x32')]=_[_0x1bb7('0x33')](_0x4092b2[_0x1bb7('0x2e')],_0x4092b2[_0x1bb7('0x30')]);_0x358427[_0x1bb7('0x35')]=_['intersection'](_0x4092b2[_0x1bb7('0x2e')],qs[_0x1bb7('0x34')](_0x51f984[_0x1bb7('0x30')]['fields']));_0x358427[_0x1bb7('0x35')]=_0x358427[_0x1bb7('0x35')][_0x1bb7('0x36')]?_0x358427['attributes']:_0x4092b2[_0x1bb7('0x2e')];if(_0x51f984[_0x1bb7('0x30')][_0x1bb7('0x49')]){_0x358427[_0x1bb7('0x42')]=[{'all':!![]}];}_0x358427=_[_0x1bb7('0x3e')]({},_0x358427,_0x51f984[_0x1bb7('0x40')]);return db[_0x1bb7('0x48')][_0x1bb7('0x4a')](_0x358427)[_0x1bb7('0x25')](handleEntityNotFound(_0x90d605,null))[_0x1bb7('0x25')](respondWithResult(_0x90d605,null))[_0x1bb7('0x45')](handleError(_0x90d605,null));};exports[_0x1bb7('0x4b')]=function(_0x5f1d60,_0x37a88f){return db[_0x1bb7('0x48')]['create'](_0x5f1d60['body'],{})[_0x1bb7('0x25')](respondWithResult(_0x37a88f,0xc9))[_0x1bb7('0x45')](handleError(_0x37a88f,null));};exports[_0x1bb7('0x23')]=function(_0x3f776d,_0x3b39b9){if(_0x3f776d[_0x1bb7('0x4c')]['id']){delete _0x3f776d[_0x1bb7('0x4c')]['id'];}return db[_0x1bb7('0x48')]['find']({'where':{'id':_0x3f776d[_0x1bb7('0x47')]['id']}})[_0x1bb7('0x25')](handleEntityNotFound(_0x3b39b9,null))[_0x1bb7('0x25')](saveUpdates(_0x3f776d[_0x1bb7('0x4c')],null))[_0x1bb7('0x25')](respondWithResult(_0x3b39b9,null))[_0x1bb7('0x45')](handleError(_0x3b39b9,null));};exports[_0x1bb7('0x24')]=function(_0x459e4f,_0x367c86){return db[_0x1bb7('0x48')]['find']({'where':{'id':_0x459e4f[_0x1bb7('0x47')]['id']}})[_0x1bb7('0x25')](handleEntityNotFound(_0x367c86,null))[_0x1bb7('0x25')](removeEntity(_0x367c86,null))[_0x1bb7('0x45')](handleError(_0x367c86,null));}; \ No newline at end of file +var _0xcded=['type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName'];(function(_0x13c315,_0x71739b){var _0x4a3246=function(_0x4d01bd){while(--_0x4d01bd){_0x13c315['push'](_0x13c315['shift']());}};_0x4a3246(++_0x71739b);}(_0xcded,0x64));var _0xdcde=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0xcded[_0x51b1a5];return _0x15c738;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdcde('0x0'));var rimraf=require(_0xdcde('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdcde('0x2'));var rp=require(_0xdcde('0x3'));var moment=require(_0xdcde('0x4'));var BPromise=require(_0xdcde('0x5'));var Mustache=require(_0xdcde('0x6'));var util=require(_0xdcde('0x7'));var path=require(_0xdcde('0x8'));var sox=require('sox');var csv=require(_0xdcde('0x9'));var ejs=require(_0xdcde('0xa'));var fs=require('fs');var _=require(_0xdcde('0xb'));var squel=require(_0xdcde('0xc'));var crypto=require(_0xdcde('0xd'));var jsforce=require(_0xdcde('0xe'));var deskjs=require(_0xdcde('0xf'));var toCsv=require(_0xdcde('0x9'));var querystring=require(_0xdcde('0x10'));var Papa=require(_0xdcde('0x11'));var Redis=require('ioredis');var authService=require(_0xdcde('0x12'));var qs=require(_0xdcde('0x13'));var as=require(_0xdcde('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdcde('0x15'));var config=require(_0xdcde('0x16'));var licenseUtil=require(_0xdcde('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd32096,_0x310d61){_0x310d61=_0x310d61||0xcc;return function(_0x595776){if(_0x595776){return _0xd32096[_0xdcde('0x18')](_0x310d61);}return _0xd32096[_0xdcde('0x19')](_0x310d61)[_0xdcde('0x1a')]();};}function respondWithResult(_0x5618f6,_0x3ee506){_0x3ee506=_0x3ee506||0xc8;return function(_0x11caca){if(_0x11caca){return _0x5618f6['status'](_0x3ee506)[_0xdcde('0x1b')](_0x11caca);}};}function respondWithFilteredResult(_0x14fd0b,_0x3cdc48){return function(_0x1b13d0){if(_0x1b13d0){var _0x3db403=_0x1b13d0['count'],_0x3e6433=_0x3cdc48['offset'],_0x146d8c=_0x3cdc48[_0xdcde('0x1c')]+_0x3cdc48['limit'],_0x397743;if(_0x146d8c>=_0x3db403){_0x146d8c=_0x3db403;_0x397743=0xc8;}else{_0x397743=0xce;}_0x14fd0b[_0xdcde('0x19')](_0x397743);return _0x14fd0b[_0xdcde('0x1d')](_0xdcde('0x1e'),_0x3e6433+'-'+_0x146d8c+'/'+_0x3db403)['json'](_0x1b13d0);}return null;};}function patchUpdates(_0x1ddd81){return function(_0x171b5a){try{jsonpatch[_0xdcde('0x1f')](_0x171b5a,_0x1ddd81,!![]);}catch(_0xd1e4a4){return BPromise['reject'](_0xd1e4a4);}return _0x171b5a[_0xdcde('0x20')]();};}function saveUpdates(_0xb90f8b,_0x1b54e9){return function(_0x41f571){if(_0x41f571){return _0x41f571[_0xdcde('0x21')](_0xb90f8b)['then'](function(_0x5b2ed4){return _0x5b2ed4;});}return null;};}function removeEntity(_0x54c67d,_0x596592){return function(_0x16d372){if(_0x16d372){return _0x16d372[_0xdcde('0x22')]()[_0xdcde('0x23')](function(){_0x54c67d['status'](0xcc)[_0xdcde('0x1a')]();});}};}function handleEntityNotFound(_0x2d0559,_0x10b503){return function(_0x1ae2c2){if(!_0x1ae2c2){_0x2d0559['sendStatus'](0x194);}return _0x1ae2c2;};}function handleError(_0x53b786,_0x5e89f4){_0x5e89f4=_0x5e89f4||0x1f4;return function(_0x194e0a){logger['error'](_0x194e0a[_0xdcde('0x24')]);if(_0x194e0a[_0xdcde('0x25')]){delete _0x194e0a['name'];}_0x53b786['status'](_0x5e89f4)[_0xdcde('0x26')](_0x194e0a);};}exports[_0xdcde('0x27')]=function(_0x27f57f,_0x2d0890){var _0x200723={},_0x5d9e81={},_0x554937={'count':0x0,'rows':[]};var _0x36e2ae=_[_0xdcde('0x28')](db[_0xdcde('0x29')][_0xdcde('0x2a')],function(_0x5cbe6e){return{'name':_0x5cbe6e[_0xdcde('0x2b')],'type':_0x5cbe6e[_0xdcde('0x2c')][_0xdcde('0x2d')]};});_0x5d9e81[_0xdcde('0x2e')]=_['map'](_0x36e2ae,_0xdcde('0x25'));_0x5d9e81[_0xdcde('0x2f')]=_[_0xdcde('0x30')](_0x27f57f[_0xdcde('0x2f')]);_0x5d9e81[_0xdcde('0x31')]=_[_0xdcde('0x32')](_0x5d9e81[_0xdcde('0x2e')],_0x5d9e81[_0xdcde('0x2f')]);_0x200723[_0xdcde('0x33')]=_[_0xdcde('0x32')](_0x5d9e81['model'],qs['fields'](_0x27f57f['query'][_0xdcde('0x34')]));_0x200723[_0xdcde('0x33')]=_0x200723[_0xdcde('0x33')]['length']?_0x200723['attributes']:_0x5d9e81[_0xdcde('0x2e')];if(!_0x27f57f[_0xdcde('0x2f')][_0xdcde('0x35')](_0xdcde('0x36'))){_0x200723['limit']=qs[_0xdcde('0x37')](_0x27f57f[_0xdcde('0x2f')][_0xdcde('0x37')]);_0x200723[_0xdcde('0x1c')]=qs[_0xdcde('0x1c')](_0x27f57f['query'][_0xdcde('0x1c')]);}_0x200723['order']=qs[_0xdcde('0x38')](_0x27f57f[_0xdcde('0x2f')][_0xdcde('0x38')]);_0x200723[_0xdcde('0x39')]=qs[_0xdcde('0x31')](_['pick'](_0x27f57f[_0xdcde('0x2f')],_0x5d9e81[_0xdcde('0x31')]),_0x36e2ae);if(_0x27f57f[_0xdcde('0x2f')][_0xdcde('0x3a')]){_0x200723[_0xdcde('0x39')]=_[_0xdcde('0x3b')](_0x200723[_0xdcde('0x39')],{'$or':_['map'](_0x36e2ae,function(_0x39e029){if(_0x39e029[_0xdcde('0x2c')]!==_0xdcde('0x3c')){var _0x2a49b3={};_0x2a49b3[_0x39e029[_0xdcde('0x25')]]={'$like':'%'+_0x27f57f[_0xdcde('0x2f')][_0xdcde('0x3a')]+'%'};return _0x2a49b3;}})});}_0x200723=_[_0xdcde('0x3b')]({},_0x200723,_0x27f57f[_0xdcde('0x3d')]);var _0x2a551e={'where':_0x200723[_0xdcde('0x39')]};return db['FaxApplication']['count'](_0x2a551e)[_0xdcde('0x23')](function(_0x522722){_0x554937[_0xdcde('0x3e')]=_0x522722;if(_0x27f57f[_0xdcde('0x2f')][_0xdcde('0x3f')]){_0x200723['include']=[{'all':!![]}];}return db[_0xdcde('0x29')][_0xdcde('0x40')](_0x200723);})[_0xdcde('0x23')](function(_0x2967e3){_0x554937[_0xdcde('0x41')]=_0x2967e3;return _0x554937;})[_0xdcde('0x23')](respondWithFilteredResult(_0x2d0890,_0x200723))[_0xdcde('0x42')](handleError(_0x2d0890,null));};exports['show']=function(_0x11062e,_0x303a3e){var _0x224122={'raw':!![],'where':{'id':_0x11062e[_0xdcde('0x43')]['id']}},_0x1111ea={};_0x1111ea[_0xdcde('0x2e')]=_[_0xdcde('0x30')](db[_0xdcde('0x29')][_0xdcde('0x2a')]);_0x1111ea[_0xdcde('0x2f')]=_['keys'](_0x11062e[_0xdcde('0x2f')]);_0x1111ea[_0xdcde('0x31')]=_[_0xdcde('0x32')](_0x1111ea[_0xdcde('0x2e')],_0x1111ea[_0xdcde('0x2f')]);_0x224122['attributes']=_[_0xdcde('0x32')](_0x1111ea[_0xdcde('0x2e')],qs['fields'](_0x11062e['query'][_0xdcde('0x34')]));_0x224122[_0xdcde('0x33')]=_0x224122['attributes']['length']?_0x224122[_0xdcde('0x33')]:_0x1111ea[_0xdcde('0x2e')];if(_0x11062e[_0xdcde('0x2f')]['includeAll']){_0x224122[_0xdcde('0x44')]=[{'all':!![]}];}_0x224122=_[_0xdcde('0x3b')]({},_0x224122,_0x11062e['options']);return db[_0xdcde('0x29')][_0xdcde('0x45')](_0x224122)['then'](handleEntityNotFound(_0x303a3e,null))['then'](respondWithResult(_0x303a3e,null))['catch'](handleError(_0x303a3e,null));};exports[_0xdcde('0x46')]=function(_0x5cd625,_0x56777a){return db[_0xdcde('0x29')][_0xdcde('0x46')](_0x5cd625[_0xdcde('0x47')],{})[_0xdcde('0x23')](respondWithResult(_0x56777a,0xc9))[_0xdcde('0x42')](handleError(_0x56777a,null));};exports[_0xdcde('0x21')]=function(_0x3e6797,_0x53d933){if(_0x3e6797[_0xdcde('0x47')]['id']){delete _0x3e6797[_0xdcde('0x47')]['id'];}return db[_0xdcde('0x29')][_0xdcde('0x45')]({'where':{'id':_0x3e6797[_0xdcde('0x43')]['id']}})['then'](handleEntityNotFound(_0x53d933,null))[_0xdcde('0x23')](saveUpdates(_0x3e6797[_0xdcde('0x47')],null))[_0xdcde('0x23')](respondWithResult(_0x53d933,null))[_0xdcde('0x42')](handleError(_0x53d933,null));};exports['destroy']=function(_0x52d68d,_0x275e54){return db['FaxApplication']['find']({'where':{'id':_0x52d68d[_0xdcde('0x43')]['id']}})[_0xdcde('0x23')](handleEntityNotFound(_0x275e54,null))[_0xdcde('0x23')](removeEntity(_0x275e54,null))[_0xdcde('0x42')](handleError(_0x275e54,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 928b818..e4a804b 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 _0xe295=['api','moment','path','rimraf','../../config/environment','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0xe295,0x16a));var _0x5e29=function(_0x529a0f,_0x328763){_0x529a0f=_0x529a0f-0x0;var _0x187a88=_0xe295[_0x529a0f];return _0x187a88;};'use strict';var _=require('lodash');var util=require(_0x5e29('0x0'));var logger=require('../../config/logger')(_0x5e29('0x1'));var moment=require(_0x5e29('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e29('0x3'));var rimraf=require(_0x5e29('0x4'));var config=require(_0x5e29('0x5'));var attributes=require('./faxApplication.attributes');module[_0x5e29('0x6')]=function(_0xf6b575,_0x37e832){return _0xf6b575[_0x5e29('0x7')]('FaxApplication',attributes,{'tableName':_0x5e29('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5e29('0x9'),'collate':_0x5e29('0xa')});}; \ No newline at end of file +var _0x7994=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0xaaf4df,_0x5f5856){var _0x38e14f=function(_0x377511){while(--_0x377511){_0xaaf4df['push'](_0xaaf4df['shift']());}};_0x38e14f(++_0x5f5856);}(_0x7994,0x129));var _0x4799=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7994[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4799('0x0'));var util=require(_0x4799('0x1'));var logger=require(_0x4799('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4799('0x3'));var rp=require(_0x4799('0x4'));var fs=require('fs');var path=require(_0x4799('0x5'));var rimraf=require(_0x4799('0x6'));var config=require('../../config/environment');var attributes=require(_0x4799('0x7'));module[_0x4799('0x8')]=function(_0x18b7c0,_0x379230){return _0x18b7c0[_0x4799('0x9')](_0x4799('0xa'),attributes,{'tableName':_0x4799('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4799('0xc'),'collate':_0x4799('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index f9d8763..7add9f3 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 _0xb43e=['FaxApplication','update','body','options','where','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3a18f3,_0xa6b079){var _0x431120=function(_0x3ce96e){while(--_0x3ce96e){_0x3a18f3['push'](_0x3a18f3['shift']());}};_0x431120(++_0xa6b079);}(_0xb43e,0x1e6));var _0xeb43=function(_0xaa8e37,_0x154c84){_0xaa8e37=_0xaa8e37-0x0;var _0x5dbf02=_0xb43e[_0xaa8e37];return _0x5dbf02;};'use strict';var _=require(_0xeb43('0x0'));var util=require(_0xeb43('0x1'));var moment=require(_0xeb43('0x2'));var BPromise=require(_0xeb43('0x3'));var rs=require(_0xeb43('0x4'));var fs=require('fs');var Redis=require(_0xeb43('0x5'));var db=require(_0xeb43('0x6'))['db'];var utils=require(_0xeb43('0x7'));var logger=require(_0xeb43('0x8'))(_0xeb43('0x9'));var config=require(_0xeb43('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xeb43('0xb')][_0xeb43('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x535616,_0x54eaf0,_0x614c4f){return new BPromise(function(_0x1d4fb8,_0x2a3cd5){return client[_0xeb43('0xd')](_0x535616,_0x614c4f)[_0xeb43('0xe')](function(_0x257c42){logger[_0xeb43('0xf')](_0xeb43('0x10'),_0x54eaf0,_0xeb43('0x11'));logger[_0xeb43('0x12')](_0xeb43('0x13'),_0x54eaf0,_0xeb43('0x11'),JSON[_0xeb43('0x14')](_0x257c42));if(_0x257c42[_0xeb43('0x15')]){if(_0x257c42[_0xeb43('0x15')][_0xeb43('0x16')]===0x1f4){logger[_0xeb43('0x15')]('FaxApplication,\x20%s,\x20%s',_0x54eaf0,_0x257c42['error'][_0xeb43('0x17')]);return _0x2a3cd5(_0x257c42[_0xeb43('0x15')][_0xeb43('0x17')]);}logger[_0xeb43('0x15')]('FaxApplication,\x20%s,\x20%s',_0x54eaf0,_0x257c42[_0xeb43('0x15')][_0xeb43('0x17')]);return _0x1d4fb8(_0x257c42['error'][_0xeb43('0x17')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x54eaf0,_0xeb43('0x11'));_0x1d4fb8(_0x257c42[_0xeb43('0x18')][_0xeb43('0x17')]);}})[_0xeb43('0x19')](function(_0x46b3a6){logger[_0xeb43('0x15')](_0xeb43('0x10'),_0x54eaf0,_0x46b3a6);_0x2a3cd5(_0x46b3a6);});});}exports['UpdateFaxApplication']=function(_0x461d52){var _0x274af4=this;return new Promise(function(_0x593b79,_0x3266d3){return db[_0xeb43('0x1a')][_0xeb43('0x1b')](_0x461d52[_0xeb43('0x1c')],{'raw':_0x461d52[_0xeb43('0x1d')]?_0x461d52['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x461d52['options']?_0x461d52[_0xeb43('0x1d')][_0xeb43('0x1e')]||null:null,'attributes':_0x461d52[_0xeb43('0x1d')]?_0x461d52[_0xeb43('0x1d')]['attributes']||null:null,'limit':_0x461d52[_0xeb43('0x1d')]?_0x461d52[_0xeb43('0x1d')]['limit']||null:null})['then'](function(_0x25b57a){logger[_0xeb43('0xf')](_0xeb43('0x1f'),_0x461d52);logger[_0xeb43('0x12')](_0xeb43('0x1f'),_0x461d52,JSON[_0xeb43('0x14')](_0x25b57a));_0x593b79(_0x25b57a);})[_0xeb43('0x19')](function(_0xdfd1a3){logger[_0xeb43('0x15')](_0xeb43('0x1f'),_0xdfd1a3['message'],_0x461d52);_0x3266d3(_0x274af4[_0xeb43('0x15')](0x1f4,_0xdfd1a3['message']));});});}; \ No newline at end of file +var _0xa849=['../../config/utils','../../config/logger','../../config/environment','client','http','then','info','request\x20sent','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','FaxApplication','update','options','raw','where','attributes','limit','UpdateFaxApplication','debug','catch','util','moment','bluebird','randomstring'];(function(_0x282e14,_0x25ab27){var _0x3e3ae9=function(_0x5eff51){while(--_0x5eff51){_0x282e14['push'](_0x282e14['shift']());}};_0x3e3ae9(++_0x25ab27);}(_0xa849,0x114));var _0x9a84=function(_0x1dc254,_0x2ab043){_0x1dc254=_0x1dc254-0x0;var _0x549dc6=_0xa849[_0x1dc254];return _0x549dc6;};'use strict';var _=require('lodash');var util=require(_0x9a84('0x0'));var moment=require(_0x9a84('0x1'));var BPromise=require(_0x9a84('0x2'));var rs=require(_0x9a84('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9a84('0x4'));var logger=require(_0x9a84('0x5'))('rpc');var config=require(_0x9a84('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9a84('0x7')][_0x9a84('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47be93,_0x315e7e,_0x3e8d3a){return new BPromise(function(_0x574cc3,_0x2a1029){return client['request'](_0x47be93,_0x3e8d3a)[_0x9a84('0x9')](function(_0x334dab){logger[_0x9a84('0xa')]('FaxApplication,\x20%s,\x20%s',_0x315e7e,_0x9a84('0xb'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x315e7e,_0x9a84('0xb'),JSON[_0x9a84('0xc')](_0x334dab));if(_0x334dab[_0x9a84('0xd')]){if(_0x334dab[_0x9a84('0xd')][_0x9a84('0xe')]===0x1f4){logger[_0x9a84('0xd')](_0x9a84('0xf'),_0x315e7e,_0x334dab[_0x9a84('0xd')][_0x9a84('0x10')]);return _0x2a1029(_0x334dab[_0x9a84('0xd')][_0x9a84('0x10')]);}logger[_0x9a84('0xd')](_0x9a84('0xf'),_0x315e7e,_0x334dab[_0x9a84('0xd')][_0x9a84('0x10')]);return _0x574cc3(_0x334dab[_0x9a84('0xd')][_0x9a84('0x10')]);}else{logger['info'](_0x9a84('0xf'),_0x315e7e,_0x9a84('0xb'));_0x574cc3(_0x334dab[_0x9a84('0x11')][_0x9a84('0x10')]);}})['catch'](function(_0x410c61){logger['error']('FaxApplication,\x20%s,\x20%s',_0x315e7e,_0x410c61);_0x2a1029(_0x410c61);});});}exports['UpdateFaxApplication']=function(_0x52570c){var _0x4207e7=this;return new Promise(function(_0x3e2277,_0x5412f0){return db[_0x9a84('0x12')][_0x9a84('0x13')](_0x52570c['body'],{'raw':_0x52570c['options']?_0x52570c[_0x9a84('0x14')][_0x9a84('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52570c[_0x9a84('0x14')]?_0x52570c['options'][_0x9a84('0x16')]||null:null,'attributes':_0x52570c[_0x9a84('0x14')]?_0x52570c['options'][_0x9a84('0x17')]||null:null,'limit':_0x52570c[_0x9a84('0x14')]?_0x52570c[_0x9a84('0x14')][_0x9a84('0x18')]||null:null})['then'](function(_0x1a1c54){logger['info'](_0x9a84('0x19'),_0x52570c);logger[_0x9a84('0x1a')](_0x9a84('0x19'),_0x52570c,JSON[_0x9a84('0xc')](_0x1a1c54));_0x3e2277(_0x1a1c54);})[_0x9a84('0x1b')](function(_0x8a83a7){logger['error'](_0x9a84('0x19'),_0x8a83a7['message'],_0x52570c);_0x5412f0(_0x4207e7['error'](0x1f4,_0x8a83a7[_0x9a84('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 770583b..8d35f48 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 _0x1883=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','update','delete','exports'];(function(_0x1ab6cc,_0x3217f0){var _0x5bebe4=function(_0x4a67be){while(--_0x4a67be){_0x1ab6cc['push'](_0x1ab6cc['shift']());}};_0x5bebe4(++_0x3217f0);}(_0x1883,0xab));var _0x3188=function(_0x1ccddc,_0x42a829){_0x1ccddc=_0x1ccddc-0x0;var _0x490d5f=_0x1883[_0x1ccddc];return _0x490d5f;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var auth=require(_0x3188('0x6'));var interaction=require(_0x3188('0x7'));var config=require(_0x3188('0x8'));var controller=require(_0x3188('0x9'));router[_0x3188('0xa')]('/',auth[_0x3188('0xb')](),controller[_0x3188('0xc')]);router[_0x3188('0xa')](_0x3188('0xd'),auth[_0x3188('0xb')](),controller[_0x3188('0xe')]);router['post']('/',auth[_0x3188('0xb')](),controller[_0x3188('0xf')]);router['put'](_0x3188('0xd'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router[_0x3188('0x11')](_0x3188('0xd'),auth[_0x3188('0xb')](),controller['destroy']);module[_0x3188('0x12')]=router; \ No newline at end of file +var _0x2eb2=['/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x24f724,_0x4f8e91){var _0xade918=function(_0x4e237f){while(--_0x4e237f){_0x24f724['push'](_0x24f724['shift']());}};_0xade918(++_0x4f8e91);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x2eb2[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var auth=require(_0x22eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22eb('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xb')]);router[_0x22eb('0xc')]('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller['update']);router[_0x22eb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x22eb('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 5b77739..b222dfa 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 _0x03db=['exports','BOOLEAN','DATE','STRING','out','ENUM','sequelize'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x03db,0x156));var _0xb03d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x03db[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb03d('0x0'));module[_0xb03d('0x1')]={'closed':{'type':Sequelize[_0xb03d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb03d('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb03d('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb03d('0x4')]},'note':{'type':Sequelize[_0xb03d('0x4')]},'read1stAt':{'type':Sequelize[_0xb03d('0x3')]},'fax':{'type':Sequelize[_0xb03d('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb03d('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb03d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb03d('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x31c2=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x407c40,_0x5a4b9b){var _0x2565d0=function(_0xff6297){while(--_0xff6297){_0x407c40['push'](_0x407c40['shift']());}};_0x2565d0(++_0x5a4b9b);}(_0x31c2,0x1e1));var _0x231c=function(_0x15b8bb,_0x308c2e){_0x15b8bb=_0x15b8bb-0x0;var _0x31ece2=_0x31c2[_0x15b8bb];return _0x31ece2;};'use strict';var Sequelize=require(_0x231c('0x0'));module[_0x231c('0x1')]={'closed':{'type':Sequelize[_0x231c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x231c('0x3')]},'disposition':{'type':Sequelize[_0x231c('0x4')]},'secondDisposition':{'type':Sequelize[_0x231c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x231c('0x4')]},'note':{'type':Sequelize[_0x231c('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x231c('0x5')]('in',_0x231c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x231c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x231c('0x5')]('in','out'),'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 8756b54..338ef9f 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 _0xf713=['rawAttributes','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','sort','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','Attachment','Messages','basename','createReadStream','pipe','createWriteStream','err','unlinkSync','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','FaxInteraction','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','filters','pick','select','field','from','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','left_join','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','keys','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','i.id\x20LIKE\x20?','i.fax\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?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xf713,0x1cc));var _0x3f71=function(_0x4c2dfc,_0x4814c0){_0x4c2dfc=_0x4c2dfc-0x0;var _0xfd728d=_0xf713[_0x4c2dfc];return _0xfd728d;};'use strict';var pdf=require(_0x3f71('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3f71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f71('0x2'));var moment=require(_0x3f71('0x3'));var BPromise=require(_0x3f71('0x4'));var Mustache=require(_0x3f71('0x5'));var util=require('util');var path=require(_0x3f71('0x6'));var sox=require(_0x3f71('0x7'));var csv=require(_0x3f71('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f71('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3f71('0xa'));var deskjs=require(_0x3f71('0xb'));var toCsv=require(_0x3f71('0x8'));var querystring=require(_0x3f71('0xc'));var Papa=require('papaparse');var Redis=require(_0x3f71('0xd'));var authService=require(_0x3f71('0xe'));var qs=require(_0x3f71('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f71('0x10'));var logger=require(_0x3f71('0x11'))(_0x3f71('0x12'));var utils=require(_0x3f71('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3f71('0x14'));var db=require(_0x3f71('0x15'))['db'];config[_0x3f71('0x16')]=_['defaults'](config[_0x3f71('0x16')],{'host':_0x3f71('0x17'),'port':0x18eb});var socket=require(_0x3f71('0x18'))(new Redis(config[_0x3f71('0x16')]));require(_0x3f71('0x19'))['register'](socket);function respondWithStatusCode(_0x42752d,_0x2b23fd){_0x2b23fd=_0x2b23fd||0xcc;return function(_0x1406a4){if(_0x1406a4){return _0x42752d[_0x3f71('0x1a')](_0x2b23fd);}return _0x42752d[_0x3f71('0x1b')](_0x2b23fd)[_0x3f71('0x1c')]();};}function respondWithResult(_0xf79d70,_0x10025f){_0x10025f=_0x10025f||0xc8;return function(_0x44f460){if(_0x44f460){return _0xf79d70[_0x3f71('0x1b')](_0x10025f)[_0x3f71('0x1d')](_0x44f460);}};}function respondWithFilteredResult(_0x3b0fdc,_0x535d8d){return function(_0x1756ff){if(_0x1756ff){var _0x44679d=_0x1756ff[_0x3f71('0x1e')],_0x5081c1=_0x535d8d[_0x3f71('0x1f')],_0x4ceedf=_0x535d8d[_0x3f71('0x1f')]+_0x535d8d[_0x3f71('0x20')],_0x5946e7;if(_0x4ceedf>=_0x44679d){_0x4ceedf=_0x44679d;_0x5946e7=0xc8;}else{_0x5946e7=0xce;}_0x3b0fdc[_0x3f71('0x1b')](_0x5946e7);return _0x3b0fdc[_0x3f71('0x21')]('Content-Range',_0x5081c1+'-'+_0x4ceedf+'/'+_0x44679d)['json'](_0x1756ff);}return null;};}function patchUpdates(_0x5452d7){return function(_0x27f258){try{jsonpatch[_0x3f71('0x22')](_0x27f258,_0x5452d7,!![]);}catch(_0x38f828){return BPromise[_0x3f71('0x23')](_0x38f828);}return _0x27f258[_0x3f71('0x24')]();};}function saveUpdates(_0x7686fd,_0x40d7fe){return function(_0x5ab7b3){if(_0x5ab7b3){return _0x5ab7b3[_0x3f71('0x25')](_0x7686fd)[_0x3f71('0x26')](function(_0x55a109){return _0x55a109;});}return null;};}function removeEntity(_0x38f1d8,_0xfd92f9){return function(_0x31dbad){if(_0x31dbad){return _0x31dbad[_0x3f71('0x27')]()[_0x3f71('0x26')](function(){_0x38f1d8[_0x3f71('0x1b')](0xcc)[_0x3f71('0x1c')]();});}};}function handleEntityNotFound(_0x49a574,_0x1f85b8){return function(_0x5b8860){if(!_0x5b8860){_0x49a574[_0x3f71('0x1a')](0x194);}return _0x5b8860;};}function handleError(_0x2a14b7,_0x401228){_0x401228=_0x401228||0x1f4;return function(_0x54f67d){logger[_0x3f71('0x28')](_0x54f67d['stack']);if(_0x54f67d[_0x3f71('0x29')]){delete _0x54f67d['name'];}_0x2a14b7[_0x3f71('0x1b')](_0x401228)[_0x3f71('0x2a')](_0x54f67d);};}function getInteractionUsers(_0x263139,_0xe2d043){return new BPromise(function(_0x34256c,_0x3328a8){try{if(_0xe2d043[_0x263139['id']]){_0x263139[_0x3f71('0x2b')]=_[_0x3f71('0x2c')](_0xe2d043[_0x263139['id']],function(_0x138caa){return{'id':_0x138caa['id'],'fullname':_0x138caa[_0x3f71('0x2d')]};});}}catch(_0x495807){_0x3328a8(_0x495807);}_0x34256c(_0x263139);});}function getInteractionTags(_0x2f3511,_0x4e9be2){return new BPromise(function(_0x49b291,_0x53c17e){try{if(_0x2f3511[_0x3f71('0x2e')]){_0x2f3511[_0x3f71('0x2f')]=[];_0x2f3511[_0x3f71('0x2e')][_0x3f71('0x30')](',')[_0x3f71('0x31')](function(_0x38cf2a){_0x2f3511[_0x3f71('0x2f')]['push'](_0x4e9be2[_0x38cf2a]);});}delete _0x2f3511[_0x3f71('0x2e')];}catch(_0x143d45){_0x53c17e(_0x143d45);}_0x49b291(_0x2f3511);});}function updateFaxInteraction(_0x52cae7,_0x1d3461,_0x44107c){return new BPromise(function(_0x19aa39,_0x46bd7){return getInteractionUsers(_0x52cae7,_0x44107c)[_0x3f71('0x26')](function(_0x13fb6a){return getInteractionTags(_0x13fb6a,_0x1d3461);})[_0x3f71('0x26')](function(_0x4a97dc){_0x19aa39(_0x4a97dc);})[_0x3f71('0x32')](function(_0x1cd2b4){_0x46bd7(_0x1cd2b4);});});}exports['index']=function(_0x468ef4,_0x133568){var _0x68cadb={},_0x2609c5={},_0x524e8a={'count':0x0,'rows':[]};var _0x37a4ff=_[_0x3f71('0x2c')](db[_0x3f71('0x33')]['rawAttributes'],function(_0x1af39d){return{'name':_0x1af39d['fieldName'],'type':_0x1af39d[_0x3f71('0x34')][_0x3f71('0x35')]};});_0x2609c5[_0x3f71('0x36')]=_[_0x3f71('0x2c')](_0x37a4ff,'name');_0x2609c5[_0x3f71('0x37')]=_['keys'](_0x468ef4[_0x3f71('0x37')]);_0x2609c5['filters']=_['intersection'](_0x2609c5['model'],_0x2609c5[_0x3f71('0x37')]);_0x68cadb[_0x3f71('0x38')]=_[_0x3f71('0x39')](_0x2609c5[_0x3f71('0x36')],qs[_0x3f71('0x3a')](_0x468ef4[_0x3f71('0x37')][_0x3f71('0x3a')]));_0x68cadb[_0x3f71('0x38')]=_0x68cadb[_0x3f71('0x38')][_0x3f71('0x3b')]?_0x68cadb[_0x3f71('0x38')]:_0x2609c5[_0x3f71('0x36')];if(!_0x468ef4[_0x3f71('0x37')][_0x3f71('0x3c')](_0x3f71('0x3d'))){_0x68cadb['limit']=qs[_0x3f71('0x20')](_0x468ef4[_0x3f71('0x37')][_0x3f71('0x20')]);_0x68cadb[_0x3f71('0x1f')]=qs[_0x3f71('0x1f')](_0x468ef4['query']['offset']);}_0x68cadb[_0x3f71('0x3e')]=qs['sort'](_0x468ef4[_0x3f71('0x37')]['sort']);_0x68cadb['where']=qs[_0x3f71('0x3f')](_[_0x3f71('0x40')](_0x468ef4['query'],_0x2609c5['filters']),_0x37a4ff);var _0x1da294=[];var _0x4239fa=squel[_0x3f71('0x41')]()[_0x3f71('0x42')]('id')[_0x3f71('0x42')](_0x3f71('0x29'))[_0x3f71('0x42')]('color')[_0x3f71('0x43')](_0x3f71('0x44'));var _0x4fad6b=squel[_0x3f71('0x41')]()[_0x3f71('0x42')]('u.id')[_0x3f71('0x42')](_0x3f71('0x45'))['field'](_0x3f71('0x46'))[_0x3f71('0x43')](_0x3f71('0x47'),'ui')['left_join'](_0x3f71('0x48'),'u',_0x3f71('0x49'));var _0x3a9abd=squel[_0x3f71('0x41')]()[_0x3f71('0x43')](_0x3f71('0x4a'),'i')['left_join'](_0x3f71('0x4b'),'c',_0x3f71('0x4c'))['left_join'](_0x3f71('0x48'),'o',_0x3f71('0x4d'))[_0x3f71('0x4e')](_0x3f71('0x4f'),'a',_0x3f71('0x50'))[_0x3f71('0x4e')](_0x3f71('0x51'),'me',_0x3f71('0x52'))[_0x3f71('0x4e')](_0x3f71('0x53'),'it',_0x3f71('0x54'))[_0x3f71('0x4e')](_0x3f71('0x44'),'t',_0x3f71('0x55'));var _0x4a0174=squel[_0x3f71('0x56')]();var _0x2209f2=[];var _0x493922=squel['expr']();var _0x4de467;if(_0x468ef4['query'][_0x3f71('0x57')]){_0x4de467=as['parseSearch'](_0x468ef4[_0x3f71('0x37')][_0x3f71('0x57')]);var _0xb397f7=_0x4de467[_0x3f71('0x58')];for(var _0x4b4569=0x0;_0x4b4569<_0x4de467['conditions']['length'];_0x4b4569++){var _0x10d5c9=_0x4de467[_0x3f71('0x59')][_0x4b4569];var _0xe8c7d3='i';var _0x3ff211=_[_0x3f71('0x5a')](_0x37a4ff,[_0x3f71('0x29'),_0x10d5c9[_0x3f71('0x42')]]);if(!_0x3ff211){switch(_0x10d5c9[_0x3f71('0x42')]){case _0x3f71('0x5b'):if(_0x10d5c9[_0x3f71('0x5c')]==0x1){_0x3a9abd['having']('`'+_0x10d5c9[_0x3f71('0x42')]+_0x3f71('0x5d'));}else{_0x3a9abd[_0x3f71('0x5e')]('`'+_0x10d5c9['field']+_0x3f71('0x5f'));}break;case _0x3f71('0x60'):if(_0x10d5c9[_0x3f71('0x61')]===_0x3f71('0x62')){if(_0x10d5c9[_0x3f71('0x5c')][_0x3f71('0x30')]('\x20')[_0x3f71('0x3b')]>0x1){_0x4a0174[_0xb397f7](_0x3f71('0x63'),qs[_0x3f71('0x64')](_0x10d5c9[_0x3f71('0x5c')]),null);}else{var _0x2b58d2='%'+_0x10d5c9[_0x3f71('0x5c')]+'%';_0x4a0174[_0xb397f7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2b58d2,_0x2b58d2,_0x2b58d2);}}else{_0x3ff211=_[_0x3f71('0x5a')](_0x37a4ff,[_0x3f71('0x29'),_0x3f71('0x65')]);_0x10d5c9[_0x3f71('0x42')]=_0x3f71('0x65');_0x16ba42=as['buildExpression'](_0xe8c7d3,_0x3ff211[_0x3f71('0x34')],_0x10d5c9);_0x4a0174[_0xb397f7](_0x16ba42[_0x3f71('0x66')],_0x16ba42[_0x3f71('0x5c')][_0x3f71('0x67')],_0x16ba42['value'][_0x3f71('0x1c')]);}break;case _0x3f71('0x68'):var _0x1d2406=_0x10d5c9[_0x3f71('0x5c')][_0x3f71('0x30')](',')['map'](function(_0x34c094){return Number(_0x34c094);});_0x1d2406[_0x3f71('0x31')](function(_0x16daec){_0x493922['or'](_0x3f71('0x69'),'%,'+_0x16daec+',%');});_0x2209f2=_['union'](_0x2209f2,_0x1d2406);break;case'User':if(_0x10d5c9[_0x3f71('0x61')]==='$substring'){_0x4a0174[_0xb397f7](_0x3f71('0x6a'),'%'+_0x10d5c9[_0x3f71('0x5c')]+'%',null);}else{_0x3ff211=_[_0x3f71('0x5a')](_0x37a4ff,['name',_0x3f71('0x6b')]);_0x10d5c9[_0x3f71('0x42')]=_0x3f71('0x6b');_0x16ba42=as[_0x3f71('0x6c')](_0xe8c7d3,_0x3ff211['type'],_0x10d5c9);_0x4a0174[_0xb397f7](_0x16ba42[_0x3f71('0x66')],_0x16ba42[_0x3f71('0x5c')][_0x3f71('0x67')],_0x16ba42[_0x3f71('0x5c')]['end']);}break;case _0x3f71('0x6d'):_0x16ba42=as['buildExpression']('me',null,_0x10d5c9);_0x4a0174[_0xb397f7](_0x16ba42['text'],_0x16ba42['value']['start'],_0x16ba42[_0x3f71('0x5c')][_0x3f71('0x1c')]);break;}}else{var _0x16ba42=as[_0x3f71('0x6c')](_0xe8c7d3,_0x3ff211['type'],_0x10d5c9);_0x4a0174[_0xb397f7](_0x16ba42[_0x3f71('0x66')],_0x16ba42['value'][_0x3f71('0x67')],_0x16ba42['value'][_0x3f71('0x1c')]);}}}else{var _0x176bd8=_(_0x468ef4[_0x3f71('0x37')])[_0x3f71('0x6e')]()['map'](function(_0x4419e4){return _['some'](_0x37a4ff,[_0x3f71('0x29'),_0x4419e4])?_0x4419e4:undefined;})[_0x3f71('0x6f')]()[_0x3f71('0x5c')]();if(!_[_0x3f71('0x70')](_0x176bd8)){_0x176bd8[_0x3f71('0x31')](function(_0xb106c5){if(_0xb106c5===_0x3f71('0x71')){_0x3a9abd[_0x3f71('0x72')](_0x3f71('0x73'),[][_0x3f71('0x74')](_0x468ef4[_0x3f71('0x37')][_0xb106c5]));}else if(_0xb106c5===_0x3f71('0x75')){var _0x2d9386=JSON['parse'](_0x468ef4[_0x3f71('0x37')][_0xb106c5])[_0x3f71('0x76')];var _0x3c0a64=JSON[_0x3f71('0x77')](_0x468ef4[_0x3f71('0x37')][_0xb106c5])['$lte'];_0x3a9abd[_0x3f71('0x72')](_0x3f71('0x78'),_0x2d9386,_0x3c0a64);}else{if(_0x468ef4[_0x3f71('0x37')][_0xb106c5]==='null'){_0x3a9abd[_0x3f71('0x72')]('i.'+_0xb106c5+_0x3f71('0x79'));}else{_0x3a9abd[_0x3f71('0x72')]('i.'+_0xb106c5+'\x20=\x20?',_0x468ef4[_0x3f71('0x37')][_0xb106c5]);}}});}if(_0x468ef4['query'][_0x3f71('0x7a')]){if(_0x468ef4[_0x3f71('0x37')]['read']==0x1){_0x3a9abd[_0x3f71('0x5e')](_0x3f71('0x7b'));}else{_0x3a9abd[_0x3f71('0x5e')](_0x3f71('0x7c'));}}if(_0x468ef4[_0x3f71('0x37')][_0x3f71('0x7d')]){_0x2209f2=_[_0x3f71('0x7e')](_0x468ef4[_0x3f71('0x37')][_0x3f71('0x7d')])?_0x468ef4[_0x3f71('0x37')]['tag']:new Array(_0x468ef4['query'][_0x3f71('0x7d')]);_0x2209f2['forEach'](function(_0x25bfeb){_0x493922['or'](_0x3f71('0x69'),'%,'+_0x25bfeb+',%');});}if(_0x468ef4[_0x3f71('0x37')]['filter']){var _0x2463b6=_0x468ef4['query'][_0x3f71('0x7f')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2463b6)){_0x4a0174['or'](_0x3f71('0x80'),_0x2463b6+'%')['or'](_0x3f71('0x81'),_0x2463b6+'%');}_0x4a0174['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2463b6+'%');}}_0x3a9abd[_0x3f71('0x72')](_0x4a0174);_0x3a9abd[_0x3f71('0x82')](_0x3f71('0x83'));var _0x530064={'type':db[_0x3f71('0x84')][_0x3f71('0x85')][_0x3f71('0x86')],'raw':!![]};var _0x433925=_0x3a9abd[_0x3f71('0x87')]();_0x433925['field'](_0x3f71('0x83'));_0x433925[_0x3f71('0x42')](_0x3f71('0x88'),_0x3f71('0x5b'));if(_0x68cadb[_0x3f71('0x3e')]){_0x68cadb[_0x3f71('0x3e')][_0x3f71('0x31')](function(_0x55d519){var _0x529166=_0x55d519[0x0]===_0x3f71('0x89')?_0x55d519[0x0]:'i.'+_0x55d519[0x0];_0x3a9abd[_0x3f71('0x3e')](_0x529166,_0x55d519[0x1]===_0x3f71('0x8a')?![]:!![]);});}if(!_[_0x3f71('0x70')](_0x2209f2)){_0x3a9abd[_0x3f71('0x5e')](_0x493922);_0x433925['where'](_0x3f71('0x8b'),_0x2209f2);}BPromise[_0x3f71('0x8c')]()[_0x3f71('0x26')](function(){if(!_0x4de467){if(_0x468ef4[_0x3f71('0x37')][_0x3f71('0x71')])return;_0x433925['where'](_0x3f71('0x8d'));_0x3a9abd[_0x3f71('0x72')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x468ef4[_0x3f71('0x8e')][_0x3f71('0x8f')]!==_0x3f71('0x90'))return;return _0x468ef4[_0x3f71('0x8e')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x3f71('0x26')](function(_0x284360){if(_[_0x3f71('0x70')](_0x284360)){_0x433925['where']('i.FaxAccountId\x20IS\x20NULL');_0x3a9abd[_0x3f71('0x72')](_0x3f71('0x91'));}else{_0x433925[_0x3f71('0x72')]('i.FaxAccountId\x20IN\x20?',_[_0x3f71('0x2c')](_0x284360,'id'));_0x3a9abd[_0x3f71('0x72')]('i.FaxAccountId\x20IN\x20?',_[_0x3f71('0x2c')](_0x284360,'id'));}});})[_0x3f71('0x26')](function(){if(_0x468ef4[_0x3f71('0x8e')]['role']==='agent'&&!_0x4de467&&!_0x468ef4[_0x3f71('0x37')][_0x3f71('0x71')])return[];return db[_0x3f71('0x92')]['query'](_0x433925[_0x3f71('0x93')](),_0x530064);})[_0x3f71('0x26')](function(_0x212d6c){_0x524e8a[_0x3f71('0x1e')]=_0x212d6c[_0x3f71('0x3b')];if(_0x524e8a[_0x3f71('0x1e')]===0x0)return[];return db[_0x3f71('0x92')][_0x3f71('0x37')](_0x4239fa[_0x3f71('0x93')](),_0x530064)[_0x3f71('0x26')](function(_0x27aa25){_0x1da294=_['keyBy'](_0x27aa25,'id');_0x530064=_[_0x3f71('0x94')](_0x530064,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x468ef4[_0x3f71('0x37')][_0x3f71('0x3a')]){_0x68cadb[_0x3f71('0x38')][_0x3f71('0x31')](function(_0x24fea8){_0x3a9abd['field']('i.'+_0x24fea8);});}else{_0x3a9abd[_0x3f71('0x42')](_0x3f71('0x88'),'unreadMessages');_0x3a9abd[_0x3f71('0x42')](_0x3f71('0x95'),'Account.key');_0x3a9abd['field'](_0x3f71('0x96'),'Account.mandatoryDisposition');_0x3a9abd[_0x3f71('0x42')](_0x3f71('0x97'),_0x3f71('0x89'));_0x3a9abd[_0x3f71('0x42')](_0x3f71('0x98'));_0x3a9abd[_0x3f71('0x42')](_0x3f71('0x99'),'Contact.firstName');_0x3a9abd['field'](_0x3f71('0x9a'),_0x3f71('0x9b'));_0x3a9abd[_0x3f71('0x42')](_0x3f71('0x9c'),_0x3f71('0x9d'));_0x3a9abd[_0x3f71('0x42')]('c.phone',_0x3f71('0x9e'));_0x3a9abd['field'](_0x3f71('0x9f'),_0x3f71('0xa0'));_0x3a9abd['field'](_0x3f71('0xa1'),_0x3f71('0xa2'));_0x3a9abd['field']('o.fullname',_0x3f71('0xa3'));_0x3a9abd['field'](_0x3f71('0xa4'),_0x3f71('0xa5'));_0x3a9abd[_0x3f71('0x42')](_0x3f71('0xa6'),_0x3f71('0x2e'));}if(_0x68cadb[_0x3f71('0x20')])_0x3a9abd[_0x3f71('0x20')](_0x68cadb[_0x3f71('0x20')]);if(_0x68cadb[_0x3f71('0x1f')])_0x3a9abd[_0x3f71('0x1f')](_0x68cadb[_0x3f71('0x1f')]);return db[_0x3f71('0x92')][_0x3f71('0x37')](_0x3a9abd[_0x3f71('0x93')](),_0x530064);})['then'](function(_0x2cd500){_0x4fad6b['where'](_0x3f71('0xa7'),_['map'](_0x2cd500,'id'));return db['sequelize'][_0x3f71('0x37')](_0x4fad6b['toString'](),_0x530064)[_0x3f71('0x26')](function(_0x576b48){var _0x22b71=_[_0x3f71('0xa8')](_0x576b48,_0x3f71('0xa9'));var _0x4ddeca=[];_0x2cd500[_0x3f71('0x31')](function(_0x3d3702){_0x4ddeca['push'](updateFaxInteraction(_0x3d3702,_0x1da294,_0x22b71));});return BPromise[_0x3f71('0xaa')](_0x4ddeca);});});})[_0x3f71('0x26')](function(_0x5ad428){_0x524e8a['rows']=_0x5ad428;return _0x524e8a;})['then'](respondWithFilteredResult(_0x133568,_0x68cadb))[_0x3f71('0x32')](handleError(_0x133568,null));};exports[_0x3f71('0xab')]=function(_0x53930e,_0x544430){var _0x23528b={'raw':![],'where':{'id':_0x53930e[_0x3f71('0xac')]['id']}},_0x3497fb={};_0x3497fb[_0x3f71('0x36')]=_[_0x3f71('0x6e')](db[_0x3f71('0x33')][_0x3f71('0xad')]);_0x3497fb[_0x3f71('0x37')]=_[_0x3f71('0x6e')](_0x53930e[_0x3f71('0x37')]);_0x3497fb[_0x3f71('0x3f')]=_[_0x3f71('0x39')](_0x3497fb[_0x3f71('0x36')],_0x3497fb[_0x3f71('0x37')]);_0x23528b[_0x3f71('0x38')]=_[_0x3f71('0x39')](_0x3497fb[_0x3f71('0x36')],qs[_0x3f71('0x3a')](_0x53930e[_0x3f71('0x37')][_0x3f71('0x3a')]));_0x23528b[_0x3f71('0x38')]=_0x23528b[_0x3f71('0x38')][_0x3f71('0x3b')]?_0x23528b[_0x3f71('0x38')]:_0x3497fb[_0x3f71('0x36')];if(_0x53930e[_0x3f71('0x37')][_0x3f71('0xae')]){_0x23528b[_0x3f71('0xaf')]=[{'all':!![]}];}_0x23528b=_[_0x3f71('0x94')]({},_0x23528b,_0x53930e[_0x3f71('0xb0')]);return db[_0x3f71('0x33')][_0x3f71('0x5a')](_0x23528b)[_0x3f71('0x26')](handleEntityNotFound(_0x544430,null))[_0x3f71('0x26')](respondWithResult(_0x544430,null))[_0x3f71('0x32')](handleError(_0x544430,null));};exports[_0x3f71('0xb1')]=function(_0x30e51d,_0x1e957d){return db['FaxInteraction'][_0x3f71('0xb1')](_0x30e51d[_0x3f71('0x6d')],{})[_0x3f71('0x26')](respondWithResult(_0x1e957d,0xc9))['catch'](handleError(_0x1e957d,null));};exports[_0x3f71('0x25')]=function(_0x175c11,_0x2850ca){if(_0x175c11[_0x3f71('0x6d')]['id']){delete _0x175c11[_0x3f71('0x6d')]['id'];}return db[_0x3f71('0x33')][_0x3f71('0x5a')]({'where':{'id':_0x175c11['params']['id']}})[_0x3f71('0x26')](handleEntityNotFound(_0x2850ca,null))[_0x3f71('0x26')](saveUpdates(_0x175c11[_0x3f71('0x6d')],null))[_0x3f71('0x26')](respondWithResult(_0x2850ca,null))[_0x3f71('0x32')](handleError(_0x2850ca,null));};exports[_0x3f71('0x27')]=function(_0x25ee0b,_0x153f8e){return db[_0x3f71('0x33')][_0x3f71('0x5a')]({'where':{'id':_0x25ee0b[_0x3f71('0xac')]['id']}})['then'](handleEntityNotFound(_0x153f8e,null))[_0x3f71('0x26')](removeEntity(_0x153f8e,null))[_0x3f71('0x32')](handleError(_0x153f8e,null));};exports[_0x3f71('0xb2')]=function(_0xeb4ca6,_0x303e9f){return db[_0x3f71('0x33')][_0x3f71('0xb2')]()[_0x3f71('0x26')](respondWithResult(_0x303e9f,null))[_0x3f71('0x32')](handleError(_0x303e9f,null));};exports[_0x3f71('0xb3')]=function(_0x4225a8,_0x102286,_0x514df5){return db['FaxMessage'][_0x3f71('0x5a')]({'where':{'id':_0x4225a8[_0x3f71('0xac')]['id']}})[_0x3f71('0x26')](handleEntityNotFound(_0x102286,null))[_0x3f71('0x26')](function(_0x17a46d){if(_0x17a46d){return _0x17a46d[_0x3f71('0xb3')](_0x4225a8[_0x3f71('0x6d')][_0x3f71('0xb4')],_[_0x3f71('0xb5')](_0x4225a8[_0x3f71('0x6d')],[_0x3f71('0xb4'),'id'])||{});}})[_0x3f71('0x26')](respondWithResult(_0x102286,null))[_0x3f71('0x32')](handleError(_0x102286,null));};exports[_0x3f71('0xb6')]=function(_0x5cc0e7,_0x1f636b,_0x1fc734){var _0x1d9221={'raw':![],'where':{}};var _0x54622e={};var _0x2d8c69={'count':0x0,'rows':[]};return db[_0x3f71('0x33')][_0x3f71('0xb7')]({'where':{'id':_0x5cc0e7['params']['id']}})[_0x3f71('0x26')](handleEntityNotFound(_0x1f636b,null))[_0x3f71('0x26')](function(_0x3cee54){if(_0x3cee54){_0x54622e['model']=_[_0x3f71('0x6e')](db[_0x3f71('0xb8')][_0x3f71('0xad')]);_0x54622e[_0x3f71('0x37')]=_[_0x3f71('0x6e')](_0x5cc0e7[_0x3f71('0x37')]);_0x54622e[_0x3f71('0x3f')]=_['intersection'](_0x54622e[_0x3f71('0x36')],_0x54622e[_0x3f71('0x37')]);_0x1d9221[_0x3f71('0x38')]=_[_0x3f71('0x39')](_0x54622e['model'],qs[_0x3f71('0x3a')](_0x5cc0e7['query'][_0x3f71('0x3a')]));_0x1d9221[_0x3f71('0x38')]=_0x1d9221[_0x3f71('0x38')][_0x3f71('0x3b')]?_0x1d9221[_0x3f71('0x38')]:_0x54622e[_0x3f71('0x36')];if(!_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0x3c')](_0x3f71('0x3d'))){_0x1d9221[_0x3f71('0x20')]=qs[_0x3f71('0x20')](_0x5cc0e7['query']['limit']);_0x1d9221[_0x3f71('0x1f')]=qs[_0x3f71('0x1f')](_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0x1f')]);}_0x1d9221[_0x3f71('0x3e')]=qs[_0x3f71('0xb9')](_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0xb9')]);_0x1d9221[_0x3f71('0x72')]=qs[_0x3f71('0x3f')](_[_0x3f71('0x40')](_0x5cc0e7[_0x3f71('0x37')],_0x54622e[_0x3f71('0x3f')]));_0x1d9221[_0x3f71('0x72')][_0x3f71('0xa9')]=_0x3cee54['id'];if(_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0x7f')]){_0x1d9221[_0x3f71('0x72')]=_[_0x3f71('0x94')](_0x1d9221[_0x3f71('0x72')],{'$or':_[_0x3f71('0x2c')](_0x1d9221[_0x3f71('0x38')],function(_0x266945){var _0x1e266b={};_0x1e266b[_0x266945]={'$like':'%'+_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0x7f')]+'%'};return _0x1e266b;})});}if(_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0x76')]){var _0x10e8d3=_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0x76')][_0x3f71('0x30')](',');var _0x22fa7c={};_0x22fa7c[_0x10e8d3[0x0]]={'$gte':moment(_0x10e8d3[0x1])[_0x3f71('0xba')](_0x3f71('0xbb'))};_0x1d9221[_0x3f71('0x72')]=_[_0x3f71('0x94')](_0x1d9221[_0x3f71('0x72')],_0x22fa7c);}_0x1d9221=_[_0x3f71('0x94')]({},_0x1d9221,_0x5cc0e7[_0x3f71('0xb0')]);return db[_0x3f71('0xb8')][_0x3f71('0x1e')]({'where':_0x1d9221[_0x3f71('0x72')]})[_0x3f71('0x26')](function(_0x3f6528){_0x2d8c69[_0x3f71('0x1e')]=_0x3f6528;if(_0x5cc0e7['query'][_0x3f71('0xae')]){_0x1d9221[_0x3f71('0xaf')]=[{'all':!![]}];}return db['FaxMessage'][_0x3f71('0xbc')](_0x1d9221);})[_0x3f71('0x26')](function(_0x576d55){_0x2d8c69[_0x3f71('0xbd')]=_0x576d55;return _0x2d8c69;});}})[_0x3f71('0x26')](respondWithFilteredResult(_0x1f636b,_0x1d9221))[_0x3f71('0x32')](handleError(_0x1f636b,null));};exports[_0x3f71('0xbe')]=function(_0xcab1fd,_0x5e504b,_0x343485){return db[_0x3f71('0x33')][_0x3f71('0x5a')]({'where':{'id':_0xcab1fd['params']['id']}})['then'](handleEntityNotFound(_0x5e504b,null))[_0x3f71('0x26')](function(_0x217c64){if(_0x217c64){return _0x217c64[_0x3f71('0xbf')](_0xcab1fd[_0x3f71('0x6d')]['ids'],_['omit'](_0xcab1fd[_0x3f71('0x6d')],[_0x3f71('0xb4'),'id'])||{})['spread'](function(){return db['Tag'][_0x3f71('0xbc')]({'attributes':['id','name',_0x3f71('0xc0')],'where':{'id':_0xcab1fd[_0x3f71('0x6d')][_0x3f71('0xb4')]}});})['then'](function(_0x13ceec){socket[_0x3f71('0xc1')](_0x3f71('0xc2'),{'id':Number(_0xcab1fd[_0x3f71('0xac')]['id']),'tags':_0x13ceec||[]});return{'id':Number(_0xcab1fd[_0x3f71('0xac')]['id']),'tags':_0x13ceec||[]};});}})[_0x3f71('0x26')](respondWithResult(_0x5e504b,null))[_0x3f71('0x32')](handleError(_0x5e504b,null));};exports[_0x3f71('0xc3')]=function(_0xcfab5a,_0x478a3d,_0x2b2b43){return db['FaxInteraction'][_0x3f71('0x5a')]({'where':{'id':_0xcfab5a[_0x3f71('0xac')]['id']}})['then'](handleEntityNotFound(_0x478a3d,null))[_0x3f71('0x26')](function(_0x43b755){if(_0x43b755){return _0x43b755['removeTags'](_0xcfab5a['query']['ids']);}})[_0x3f71('0x26')](respondWithStatusCode(_0x478a3d,null))[_0x3f71('0x32')](handleError(_0x478a3d,null));};exports[_0x3f71('0xc4')]=function(_0x3748d2,_0x2dd9a6){var _0x46b194=moment()[_0x3f71('0xc5')]()[_0x3f71('0x93')]();var _0x45f5fe=path[_0x3f71('0xc6')](config[_0x3f71('0xc7')],_0x3f71('0xc8'),_0x3f71('0xc9'),'tmp');var _0x41720c=path[_0x3f71('0xc6')](config['root'],_0x3f71('0xc8'),_0x3f71('0xc9'),'attachments');var _0x596dbf=path[_0x3f71('0xc6')](_0x45f5fe,_0x46b194);var _0x43d860=util['format'](_0x3f71('0xca'),_0x3748d2[_0x3f71('0xac')]['id'],_0x46b194);var _0x5bd95a=path['join'](_0x45f5fe,_0x43d860);var _0x1ff9e2=[];_0x1ff9e2['push']({'model':db[_0x3f71('0xcb')],'as':_0x3f71('0xcb'),'raw':!![]});var _0x59fbd3=[{'model':db['FaxMessage'],'as':_0x3f71('0xcc'),'attributes':['id',_0x3f71('0x6d'),'createdAt'],'include':_0x1ff9e2}];return db['FaxInteraction']['find']({'where':{'id':_0x3748d2[_0x3f71('0xac')]['id']},'include':_0x59fbd3})[_0x3f71('0x26')](handleEntityNotFound(_0x2dd9a6,null))[_0x3f71('0x26')](function(_0x256b42){if(_0x256b42&&_0x256b42['Messages']){var _0x4f3cae=_0x256b42['get']({'plain':!![]});fs['mkdirSync'](_0x596dbf);for(var _0x55f7ea=0x0;_0x55f7ea<_0x4f3cae[_0x3f71('0xcc')][_0x3f71('0x3b')];_0x55f7ea++){var _0x10ffa0=_0x4f3cae[_0x3f71('0xcc')][_0x55f7ea][_0x3f71('0xcb')];if(_0x10ffa0){var _0x51ba05=path[_0x3f71('0xc6')](_0x41720c,_0x10ffa0[_0x3f71('0xcd')]);if(fs['existsSync'](_0x51ba05)){fs[_0x3f71('0xce')](_0x51ba05)[_0x3f71('0xcf')](fs[_0x3f71('0xd0')](path[_0x3f71('0xc6')](_0x596dbf,_0x10ffa0['basename'])));}}}return BPromise[_0x3f71('0x8c')]()[_0x3f71('0x26')](function(){return new BPromise(function(_0x3c60cf,_0x5eda87){zipdir(_0x596dbf,{'saveTo':_0x5bd95a},function(_0x1d10ff,_0x2a4b07){if(_0x1d10ff)return _0x5eda87(_0x1d10ff);return _0x3c60cf(_0x2a4b07);});})[_0x3f71('0x26')](function(){return new BPromise(function(_0x2bca8a,_0x2096cb){rimraf(_0x596dbf,function(_0x4c2723){if(_0x4c2723)_0x2096cb(_0x4c2723);return _0x2bca8a();});});})[_0x3f71('0x26')](function(){return _0x2dd9a6[_0x3f71('0xc4')](_0x5bd95a,_0x43d860,function(_0x3e800d){if(_0x3e800d){console['log'](_0x3f71('0xd1'),_0x3e800d);}else{fs[_0x3f71('0xd2')](_0x5bd95a);}});});});}else{return _0x2dd9a6[_0x3f71('0x1a')](0xc8);}})['catch'](handleError(_0x2dd9a6,null));}; \ No newline at end of file +var _0x7712=['socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','index','map','FaxInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','select','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','fax_accounts','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','length','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','where','i.FaxAccountId\x20IN\x20?','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','user','role','agent','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.phone','c.fax','Contact.fax','Owner.fullname','o.internal','groupBy','push','all','rows','catch','show','includeAll','include','options','create','body','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x23e4b1,_0x5a71dd){var _0x174327=function(_0x2358df){while(--_0x2358df){_0x23e4b1['push'](_0x23e4b1['shift']());}};_0x174327(++_0x5a71dd);}(_0x7712,0x18e));var _0x2771=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7712[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2771('0x0'));var rimraf=require(_0x2771('0x1'));var zipdir=require(_0x2771('0x2'));var jsonpatch=require(_0x2771('0x3'));var rp=require(_0x2771('0x4'));var moment=require(_0x2771('0x5'));var BPromise=require(_0x2771('0x6'));var Mustache=require(_0x2771('0x7'));var util=require(_0x2771('0x8'));var path=require(_0x2771('0x9'));var sox=require(_0x2771('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2771('0xb'));var squel=require('squel');var crypto=require(_0x2771('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2771('0xd'));var toCsv=require(_0x2771('0xe'));var querystring=require(_0x2771('0xf'));var Papa=require('papaparse');var Redis=require(_0x2771('0x10'));var authService=require(_0x2771('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2771('0x12'));var logger=require(_0x2771('0x13'))(_0x2771('0x14'));var utils=require(_0x2771('0x15'));var config=require(_0x2771('0x16'));var licenseUtil=require(_0x2771('0x17'));var db=require(_0x2771('0x18'))['db'];config[_0x2771('0x19')]=_[_0x2771('0x1a')](config['redis'],{'host':_0x2771('0x1b'),'port':0x18eb});var socket=require(_0x2771('0x1c'))(new Redis(config['redis']));require(_0x2771('0x1d'))['register'](socket);function respondWithStatusCode(_0x91d7fc,_0x4f4a26){_0x4f4a26=_0x4f4a26||0xcc;return function(_0x34be56){if(_0x34be56){return _0x91d7fc[_0x2771('0x1e')](_0x4f4a26);}return _0x91d7fc[_0x2771('0x1f')](_0x4f4a26)[_0x2771('0x20')]();};}function respondWithResult(_0x8ae7aa,_0xbdcb24){_0xbdcb24=_0xbdcb24||0xc8;return function(_0x3e2c9f){if(_0x3e2c9f){return _0x8ae7aa['status'](_0xbdcb24)[_0x2771('0x21')](_0x3e2c9f);}};}function respondWithFilteredResult(_0x2e60b0,_0x387490){return function(_0x1344e9){if(_0x1344e9){var _0x4c0820=_0x1344e9['count'],_0x1caa9a=_0x387490['offset'],_0x4102e9=_0x387490[_0x2771('0x22')]+_0x387490[_0x2771('0x23')],_0x3d7984;if(_0x4102e9>=_0x4c0820){_0x4102e9=_0x4c0820;_0x3d7984=0xc8;}else{_0x3d7984=0xce;}_0x2e60b0[_0x2771('0x1f')](_0x3d7984);return _0x2e60b0[_0x2771('0x24')]('Content-Range',_0x1caa9a+'-'+_0x4102e9+'/'+_0x4c0820)[_0x2771('0x21')](_0x1344e9);}return null;};}function patchUpdates(_0x3b0c60){return function(_0x98a687){try{jsonpatch[_0x2771('0x25')](_0x98a687,_0x3b0c60,!![]);}catch(_0x436ece){return BPromise[_0x2771('0x26')](_0x436ece);}return _0x98a687[_0x2771('0x27')]();};}function saveUpdates(_0x47b67f,_0x143bda){return function(_0x53c4ca){if(_0x53c4ca){return _0x53c4ca[_0x2771('0x28')](_0x47b67f)[_0x2771('0x29')](function(_0x289762){return _0x289762;});}return null;};}function removeEntity(_0x1bc216,_0x3c2d9b){return function(_0x43d813){if(_0x43d813){return _0x43d813[_0x2771('0x2a')]()['then'](function(){_0x1bc216[_0x2771('0x1f')](0xcc)[_0x2771('0x20')]();});}};}function handleEntityNotFound(_0x1e6807,_0x179785){return function(_0x4c663e){if(!_0x4c663e){_0x1e6807[_0x2771('0x1e')](0x194);}return _0x4c663e;};}function handleError(_0x4209d0,_0x1384e2){_0x1384e2=_0x1384e2||0x1f4;return function(_0x3296a6){logger['error'](_0x3296a6[_0x2771('0x2b')]);if(_0x3296a6[_0x2771('0x2c')]){delete _0x3296a6[_0x2771('0x2c')];}_0x4209d0['status'](_0x1384e2)[_0x2771('0x2d')](_0x3296a6);};}function getInteractionUsers(_0x52455e,_0x1e7e52){return new BPromise(function(_0x2552bb,_0x33ed46){try{if(_0x1e7e52[_0x52455e['id']]){_0x52455e[_0x2771('0x2e')]=_['map'](_0x1e7e52[_0x52455e['id']],function(_0x19715e){return{'id':_0x19715e['id'],'fullname':_0x19715e[_0x2771('0x2f')]};});}}catch(_0x3f3706){_0x33ed46(_0x3f3706);}_0x2552bb(_0x52455e);});}function getInteractionTags(_0xa18f91,_0x573d17){return new BPromise(function(_0x564727,_0x3c5489){try{if(_0xa18f91[_0x2771('0x30')]){_0xa18f91[_0x2771('0x31')]=[];_0xa18f91[_0x2771('0x30')][_0x2771('0x32')](',')[_0x2771('0x33')](function(_0x217b9a){_0xa18f91[_0x2771('0x31')]['push'](_0x573d17[_0x217b9a]);});}delete _0xa18f91[_0x2771('0x30')];}catch(_0x26d6a1){_0x3c5489(_0x26d6a1);}_0x564727(_0xa18f91);});}function updateFaxInteraction(_0x3c042a,_0x5a3243,_0x5621de){return new BPromise(function(_0x2aca17,_0x2cb61e){return getInteractionUsers(_0x3c042a,_0x5621de)['then'](function(_0xb31c87){return getInteractionTags(_0xb31c87,_0x5a3243);})[_0x2771('0x29')](function(_0x15c1c7){_0x2aca17(_0x15c1c7);})['catch'](function(_0x217d04){_0x2cb61e(_0x217d04);});});}exports[_0x2771('0x34')]=function(_0x2d709b,_0x503fd3){var _0x3082a5={},_0xf19690={},_0x16ef72={'count':0x0,'rows':[]};var _0x372f22=_[_0x2771('0x35')](db[_0x2771('0x36')][_0x2771('0x37')],function(_0x922168){return{'name':_0x922168[_0x2771('0x38')],'type':_0x922168[_0x2771('0x39')][_0x2771('0x3a')]};});_0xf19690[_0x2771('0x3b')]=_['map'](_0x372f22,_0x2771('0x2c'));_0xf19690['query']=_[_0x2771('0x3c')](_0x2d709b[_0x2771('0x3d')]);_0xf19690[_0x2771('0x3e')]=_[_0x2771('0x3f')](_0xf19690['model'],_0xf19690[_0x2771('0x3d')]);_0x3082a5[_0x2771('0x40')]=_['intersection'](_0xf19690[_0x2771('0x3b')],qs['fields'](_0x2d709b[_0x2771('0x3d')][_0x2771('0x41')]));_0x3082a5[_0x2771('0x40')]=_0x3082a5[_0x2771('0x40')]['length']?_0x3082a5[_0x2771('0x40')]:_0xf19690[_0x2771('0x3b')];if(!_0x2d709b['query'][_0x2771('0x42')](_0x2771('0x43'))){_0x3082a5[_0x2771('0x23')]=qs[_0x2771('0x23')](_0x2d709b[_0x2771('0x3d')][_0x2771('0x23')]);_0x3082a5[_0x2771('0x22')]=qs[_0x2771('0x22')](_0x2d709b[_0x2771('0x3d')][_0x2771('0x22')]);}_0x3082a5[_0x2771('0x44')]=qs[_0x2771('0x45')](_0x2d709b[_0x2771('0x3d')][_0x2771('0x45')]);_0x3082a5['where']=qs[_0x2771('0x3e')](_[_0x2771('0x46')](_0x2d709b[_0x2771('0x3d')],_0xf19690[_0x2771('0x3e')]),_0x372f22);var _0x12702c=[];var _0x214a94=squel[_0x2771('0x47')]()[_0x2771('0x48')]('id')[_0x2771('0x48')](_0x2771('0x2c'))[_0x2771('0x48')](_0x2771('0x49'))['from'](_0x2771('0x4a'));var _0xebd1e=squel[_0x2771('0x47')]()['field'](_0x2771('0x4b'))['field'](_0x2771('0x4c'))[_0x2771('0x48')](_0x2771('0x4d'))[_0x2771('0x4e')](_0x2771('0x4f'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x5b8064=squel[_0x2771('0x47')]()[_0x2771('0x4e')](_0x2771('0x50'),'i')[_0x2771('0x51')](_0x2771('0x52'),'c',_0x2771('0x53'))[_0x2771('0x51')](_0x2771('0x54'),'o','o.id\x20=\x20i.UserId')[_0x2771('0x51')](_0x2771('0x55'),'a','a.id\x20=\x20i.FaxAccountId')[_0x2771('0x51')]('fax_messages','me',_0x2771('0x56'))['left_join'](_0x2771('0x57'),'it',_0x2771('0x58'))['left_join'](_0x2771('0x4a'),'t',_0x2771('0x59'));var _0x229868=squel['expr']();var _0x1f1cd5=[];var _0x4dab79=squel[_0x2771('0x5a')]();var _0x118b45;if(_0x2d709b[_0x2771('0x3d')][_0x2771('0x5b')]){_0x118b45=as[_0x2771('0x5c')](_0x2d709b[_0x2771('0x3d')]['search']);var _0x1ca815=_0x118b45[_0x2771('0x5d')];for(var _0x21f4cc=0x0;_0x21f4cc<_0x118b45['conditions']['length'];_0x21f4cc++){var _0x54392d=_0x118b45[_0x2771('0x5e')][_0x21f4cc];var _0xf60e7d='i';var _0x15f561=_[_0x2771('0x5f')](_0x372f22,[_0x2771('0x2c'),_0x54392d[_0x2771('0x48')]]);if(!_0x15f561){switch(_0x54392d[_0x2771('0x48')]){case _0x2771('0x60'):if(_0x54392d[_0x2771('0x61')]==0x1){_0x5b8064[_0x2771('0x62')]('`'+_0x54392d[_0x2771('0x48')]+_0x2771('0x63'));}else{_0x5b8064[_0x2771('0x62')]('`'+_0x54392d[_0x2771('0x48')]+_0x2771('0x64'));}break;case _0x2771('0x65'):if(_0x54392d['operator']===_0x2771('0x66')){if(_0x54392d[_0x2771('0x61')][_0x2771('0x32')]('\x20')[_0x2771('0x67')]>0x1){_0x229868[_0x1ca815]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2771('0x68')](_0x54392d[_0x2771('0x61')]),null);}else{var _0x4a5dfe='%'+_0x54392d[_0x2771('0x61')]+'%';_0x229868[_0x1ca815](_0x2771('0x69'),_0x4a5dfe,_0x4a5dfe,_0x4a5dfe);}}else{_0x15f561=_[_0x2771('0x5f')](_0x372f22,[_0x2771('0x2c'),_0x2771('0x6a')]);_0x54392d[_0x2771('0x48')]=_0x2771('0x6a');_0x1cf863=as[_0x2771('0x6b')](_0xf60e7d,_0x15f561[_0x2771('0x39')],_0x54392d);_0x229868[_0x1ca815](_0x1cf863[_0x2771('0x6c')],_0x1cf863[_0x2771('0x61')][_0x2771('0x6d')],_0x1cf863['value'][_0x2771('0x20')]);}break;case'Tag':var _0x276ee9=_0x54392d[_0x2771('0x61')][_0x2771('0x32')](',')[_0x2771('0x35')](function(_0x431f7f){return Number(_0x431f7f);});_0x276ee9[_0x2771('0x33')](function(_0x30d485){_0x4dab79['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x30d485+',%');});_0x1f1cd5=_[_0x2771('0x6e')](_0x1f1cd5,_0x276ee9);break;case _0x2771('0x6f'):if(_0x54392d[_0x2771('0x70')]===_0x2771('0x66')){_0x229868[_0x1ca815](_0x2771('0x71'),'%'+_0x54392d[_0x2771('0x61')]+'%',null);}else{_0x15f561=_[_0x2771('0x5f')](_0x372f22,['name',_0x2771('0x72')]);_0x54392d[_0x2771('0x48')]=_0x2771('0x72');_0x1cf863=as[_0x2771('0x6b')](_0xf60e7d,_0x15f561[_0x2771('0x39')],_0x54392d);_0x229868[_0x1ca815](_0x1cf863[_0x2771('0x6c')],_0x1cf863[_0x2771('0x61')]['start'],_0x1cf863['value']['end']);}break;case'body':_0x1cf863=as[_0x2771('0x6b')]('me',null,_0x54392d);_0x229868[_0x1ca815](_0x1cf863[_0x2771('0x6c')],_0x1cf863[_0x2771('0x61')][_0x2771('0x6d')],_0x1cf863[_0x2771('0x61')][_0x2771('0x20')]);break;}}else{var _0x1cf863=as['buildExpression'](_0xf60e7d,_0x15f561[_0x2771('0x39')],_0x54392d);_0x229868[_0x1ca815](_0x1cf863[_0x2771('0x6c')],_0x1cf863[_0x2771('0x61')][_0x2771('0x6d')],_0x1cf863[_0x2771('0x61')][_0x2771('0x20')]);}}}else{var _0x3b25e3=_(_0x2d709b[_0x2771('0x3d')])[_0x2771('0x3c')]()[_0x2771('0x35')](function(_0x1282fd){return _[_0x2771('0x73')](_0x372f22,[_0x2771('0x2c'),_0x1282fd])?_0x1282fd:undefined;})[_0x2771('0x74')]()['value']();if(!_[_0x2771('0x75')](_0x3b25e3)){_0x3b25e3['forEach'](function(_0x511070){if(_0x511070==='FaxAccountId'){_0x5b8064[_0x2771('0x76')](_0x2771('0x77'),[]['concat'](_0x2d709b['query'][_0x511070]));}else if(_0x511070==='createdAt'){var _0x4641b7=JSON[_0x2771('0x78')](_0x2d709b['query'][_0x511070])['$gte'];var _0x489e8c=JSON['parse'](_0x2d709b[_0x2771('0x3d')][_0x511070])[_0x2771('0x79')];_0x5b8064[_0x2771('0x76')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4641b7,_0x489e8c);}else{if(_0x2d709b['query'][_0x511070]===_0x2771('0x7a')){_0x5b8064[_0x2771('0x76')]('i.'+_0x511070+_0x2771('0x7b'));}else{_0x5b8064[_0x2771('0x76')]('i.'+_0x511070+_0x2771('0x7c'),_0x2d709b[_0x2771('0x3d')][_0x511070]);}}});}if(_0x2d709b[_0x2771('0x3d')]['read']){if(_0x2d709b[_0x2771('0x3d')][_0x2771('0x7d')]==0x1){_0x5b8064[_0x2771('0x62')](_0x2771('0x7e'));}else{_0x5b8064[_0x2771('0x62')](_0x2771('0x7f'));}}if(_0x2d709b[_0x2771('0x3d')]['tag']){_0x1f1cd5=_[_0x2771('0x80')](_0x2d709b[_0x2771('0x3d')]['tag'])?_0x2d709b[_0x2771('0x3d')]['tag']:new Array(_0x2d709b[_0x2771('0x3d')]['tag']);_0x1f1cd5[_0x2771('0x33')](function(_0x3100fe){_0x4dab79['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3100fe+',%');});}if(_0x2d709b['query'][_0x2771('0x81')]){var _0x4f8e41=_0x2d709b['query']['filter'][_0x2771('0x82')]('\x5c','\x5c\x5c')[_0x2771('0x82')](/'/g,'\x27\x27');if(qs[_0x2771('0x83')](_0x4f8e41)){_0x229868['or'](_0x2771('0x84'),_0x4f8e41+'%')['or'](_0x2771('0x85'),_0x4f8e41+'%');}_0x229868['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4f8e41+'%');}}_0x5b8064[_0x2771('0x76')](_0x229868);_0x5b8064[_0x2771('0x86')]('i.id');var _0x4ecc76={'type':db[_0x2771('0x87')][_0x2771('0x88')][_0x2771('0x89')],'raw':!![]};var _0x71fd63=_0x5b8064['clone']();_0x71fd63[_0x2771('0x48')]('i.id');_0x71fd63[_0x2771('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2771('0x60'));if(_0x3082a5[_0x2771('0x44')]){_0x3082a5[_0x2771('0x44')]['forEach'](function(_0x57efff){var _0x5a77be=_0x57efff[0x0]==='contactName'?_0x57efff[0x0]:'i.'+_0x57efff[0x0];_0x5b8064[_0x2771('0x44')](_0x5a77be,_0x57efff[0x1]===_0x2771('0x8a')?![]:!![]);});}if(!_[_0x2771('0x75')](_0x1f1cd5)){_0x5b8064[_0x2771('0x62')](_0x4dab79);_0x71fd63[_0x2771('0x76')](_0x2771('0x8b'),_0x1f1cd5);}BPromise[_0x2771('0x8c')]()['then'](function(){if(!_0x118b45){if(_0x2d709b[_0x2771('0x3d')][_0x2771('0x8d')])return;_0x71fd63['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x5b8064[_0x2771('0x76')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2d709b[_0x2771('0x8e')][_0x2771('0x8f')]!==_0x2771('0x90'))return;return _0x2d709b['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x205a56){if(_[_0x2771('0x75')](_0x205a56)){_0x71fd63[_0x2771('0x76')](_0x2771('0x91'));_0x5b8064[_0x2771('0x76')](_0x2771('0x91'));}else{_0x71fd63[_0x2771('0x76')](_0x2771('0x77'),_[_0x2771('0x35')](_0x205a56,'id'));_0x5b8064[_0x2771('0x76')](_0x2771('0x77'),_[_0x2771('0x35')](_0x205a56,'id'));}});})[_0x2771('0x29')](function(){if(_0x2d709b[_0x2771('0x8e')]['role']===_0x2771('0x90')&&!_0x118b45&&!_0x2d709b[_0x2771('0x3d')]['FaxAccountId'])return[];return db[_0x2771('0x92')][_0x2771('0x3d')](_0x71fd63[_0x2771('0x93')](),_0x4ecc76);})[_0x2771('0x29')](function(_0x1ccdee){_0x16ef72[_0x2771('0x94')]=_0x1ccdee[_0x2771('0x67')];if(_0x16ef72[_0x2771('0x94')]===0x0)return[];return db[_0x2771('0x92')][_0x2771('0x3d')](_0x214a94['toString'](),_0x4ecc76)[_0x2771('0x29')](function(_0x27fc6f){_0x12702c=_['keyBy'](_0x27fc6f,'id');_0x4ecc76=_[_0x2771('0x95')](_0x4ecc76,{'model':db[_0x2771('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d709b[_0x2771('0x3d')][_0x2771('0x41')]){_0x3082a5[_0x2771('0x40')][_0x2771('0x33')](function(_0x1ca5c9){_0x5b8064[_0x2771('0x48')]('i.'+_0x1ca5c9);});}else{_0x5b8064[_0x2771('0x48')](_0x2771('0x96'),_0x2771('0x60'));_0x5b8064[_0x2771('0x48')](_0x2771('0x97'),_0x2771('0x98'));_0x5b8064[_0x2771('0x48')](_0x2771('0x99'),_0x2771('0x9a'));_0x5b8064['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');_0x5b8064['field'](_0x2771('0x9b'));_0x5b8064[_0x2771('0x48')](_0x2771('0x9c'),_0x2771('0x9d'));_0x5b8064['field'](_0x2771('0x9e'),'Contact.lastName');_0x5b8064[_0x2771('0x48')](_0x2771('0x9f'),'Contact.email');_0x5b8064['field']('c.phone',_0x2771('0xa0'));_0x5b8064[_0x2771('0x48')]('c.mobile','Contact.mobile');_0x5b8064[_0x2771('0x48')](_0x2771('0xa1'),_0x2771('0xa2'));_0x5b8064[_0x2771('0x48')]('o.fullname',_0x2771('0xa3'));_0x5b8064[_0x2771('0x48')](_0x2771('0xa4'),'Owner.internal');_0x5b8064[_0x2771('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2771('0x30'));}if(_0x3082a5[_0x2771('0x23')])_0x5b8064[_0x2771('0x23')](_0x3082a5['limit']);if(_0x3082a5[_0x2771('0x22')])_0x5b8064[_0x2771('0x22')](_0x3082a5[_0x2771('0x22')]);return db['sequelize'][_0x2771('0x3d')](_0x5b8064[_0x2771('0x93')](),_0x4ecc76);})[_0x2771('0x29')](function(_0x5b0ca1){_0xebd1e[_0x2771('0x76')]('ui.FaxInteractionId\x20IN\x20?',_[_0x2771('0x35')](_0x5b0ca1,'id'));return db[_0x2771('0x92')]['query'](_0xebd1e[_0x2771('0x93')](),_0x4ecc76)['then'](function(_0x545878){var _0x1eb1c7=_[_0x2771('0xa5')](_0x545878,'FaxInteractionId');var _0x2961a2=[];_0x5b0ca1[_0x2771('0x33')](function(_0x59516d){_0x2961a2[_0x2771('0xa6')](updateFaxInteraction(_0x59516d,_0x12702c,_0x1eb1c7));});return BPromise[_0x2771('0xa7')](_0x2961a2);});});})['then'](function(_0x3ce0ad){_0x16ef72[_0x2771('0xa8')]=_0x3ce0ad;return _0x16ef72;})[_0x2771('0x29')](respondWithFilteredResult(_0x503fd3,_0x3082a5))[_0x2771('0xa9')](handleError(_0x503fd3,null));};exports[_0x2771('0xaa')]=function(_0x2b5a25,_0x4c3ed1){var _0x5c19a3={'raw':![],'where':{'id':_0x2b5a25['params']['id']}},_0x4d15d1={};_0x4d15d1[_0x2771('0x3b')]=_['keys'](db[_0x2771('0x36')][_0x2771('0x37')]);_0x4d15d1[_0x2771('0x3d')]=_[_0x2771('0x3c')](_0x2b5a25['query']);_0x4d15d1['filters']=_[_0x2771('0x3f')](_0x4d15d1[_0x2771('0x3b')],_0x4d15d1[_0x2771('0x3d')]);_0x5c19a3[_0x2771('0x40')]=_[_0x2771('0x3f')](_0x4d15d1[_0x2771('0x3b')],qs[_0x2771('0x41')](_0x2b5a25[_0x2771('0x3d')][_0x2771('0x41')]));_0x5c19a3['attributes']=_0x5c19a3[_0x2771('0x40')][_0x2771('0x67')]?_0x5c19a3['attributes']:_0x4d15d1[_0x2771('0x3b')];if(_0x2b5a25[_0x2771('0x3d')][_0x2771('0xab')]){_0x5c19a3[_0x2771('0xac')]=[{'all':!![]}];}_0x5c19a3=_[_0x2771('0x95')]({},_0x5c19a3,_0x2b5a25[_0x2771('0xad')]);return db[_0x2771('0x36')]['find'](_0x5c19a3)[_0x2771('0x29')](handleEntityNotFound(_0x4c3ed1,null))[_0x2771('0x29')](respondWithResult(_0x4c3ed1,null))[_0x2771('0xa9')](handleError(_0x4c3ed1,null));};exports[_0x2771('0xae')]=function(_0x238d6a,_0x31839a){return db[_0x2771('0x36')][_0x2771('0xae')](_0x238d6a[_0x2771('0xaf')],{})[_0x2771('0x29')](respondWithResult(_0x31839a,0xc9))['catch'](handleError(_0x31839a,null));};exports[_0x2771('0x28')]=function(_0x5bbcdc,_0x1aad5f){if(_0x5bbcdc[_0x2771('0xaf')]['id']){delete _0x5bbcdc[_0x2771('0xaf')]['id'];}return db[_0x2771('0x36')][_0x2771('0x5f')]({'where':{'id':_0x5bbcdc['params']['id']}})[_0x2771('0x29')](handleEntityNotFound(_0x1aad5f,null))[_0x2771('0x29')](saveUpdates(_0x5bbcdc[_0x2771('0xaf')],null))['then'](respondWithResult(_0x1aad5f,null))[_0x2771('0xa9')](handleError(_0x1aad5f,null));};exports['destroy']=function(_0x244619,_0x1fddc1){return db[_0x2771('0x36')]['find']({'where':{'id':_0x244619[_0x2771('0xb0')]['id']}})[_0x2771('0x29')](handleEntityNotFound(_0x1fddc1,null))['then'](removeEntity(_0x1fddc1,null))[_0x2771('0xa9')](handleError(_0x1fddc1,null));};exports[_0x2771('0xb1')]=function(_0x200fe5,_0x4beba4){return db[_0x2771('0x36')][_0x2771('0xb1')]()[_0x2771('0x29')](respondWithResult(_0x4beba4,null))[_0x2771('0xa9')](handleError(_0x4beba4,null));};exports[_0x2771('0xb2')]=function(_0x4a4c80,_0x4482a8,_0x3430d9){return db[_0x2771('0xb3')][_0x2771('0x5f')]({'where':{'id':_0x4a4c80[_0x2771('0xb0')]['id']}})[_0x2771('0x29')](handleEntityNotFound(_0x4482a8,null))[_0x2771('0x29')](function(_0x51bf12){if(_0x51bf12){return _0x51bf12[_0x2771('0xb2')](_0x4a4c80[_0x2771('0xaf')][_0x2771('0xb4')],_[_0x2771('0xb5')](_0x4a4c80[_0x2771('0xaf')],['ids','id'])||{});}})[_0x2771('0x29')](respondWithResult(_0x4482a8,null))[_0x2771('0xa9')](handleError(_0x4482a8,null));};exports[_0x2771('0xb6')]=function(_0x3695f6,_0x548369,_0x28cea7){var _0x8ffde2={'raw':![],'where':{}};var _0x534519={};var _0x20de2a={'count':0x0,'rows':[]};return db[_0x2771('0x36')][_0x2771('0xb7')]({'where':{'id':_0x3695f6[_0x2771('0xb0')]['id']}})['then'](handleEntityNotFound(_0x548369,null))[_0x2771('0x29')](function(_0x86da07){if(_0x86da07){_0x534519[_0x2771('0x3b')]=_['keys'](db['FaxMessage']['rawAttributes']);_0x534519['query']=_[_0x2771('0x3c')](_0x3695f6[_0x2771('0x3d')]);_0x534519[_0x2771('0x3e')]=_['intersection'](_0x534519[_0x2771('0x3b')],_0x534519['query']);_0x8ffde2['attributes']=_['intersection'](_0x534519[_0x2771('0x3b')],qs['fields'](_0x3695f6['query']['fields']));_0x8ffde2['attributes']=_0x8ffde2[_0x2771('0x40')][_0x2771('0x67')]?_0x8ffde2[_0x2771('0x40')]:_0x534519[_0x2771('0x3b')];if(!_0x3695f6[_0x2771('0x3d')][_0x2771('0x42')](_0x2771('0x43'))){_0x8ffde2[_0x2771('0x23')]=qs[_0x2771('0x23')](_0x3695f6[_0x2771('0x3d')][_0x2771('0x23')]);_0x8ffde2[_0x2771('0x22')]=qs['offset'](_0x3695f6[_0x2771('0x3d')]['offset']);}_0x8ffde2[_0x2771('0x44')]=qs[_0x2771('0x45')](_0x3695f6['query'][_0x2771('0x45')]);_0x8ffde2[_0x2771('0x76')]=qs['filters'](_[_0x2771('0x46')](_0x3695f6[_0x2771('0x3d')],_0x534519[_0x2771('0x3e')]));_0x8ffde2[_0x2771('0x76')]['FaxInteractionId']=_0x86da07['id'];if(_0x3695f6[_0x2771('0x3d')][_0x2771('0x81')]){_0x8ffde2['where']=_[_0x2771('0x95')](_0x8ffde2[_0x2771('0x76')],{'$or':_[_0x2771('0x35')](_0x8ffde2[_0x2771('0x40')],function(_0x1c1487){var _0x51222b={};_0x51222b[_0x1c1487]={'$like':'%'+_0x3695f6[_0x2771('0x3d')][_0x2771('0x81')]+'%'};return _0x51222b;})});}if(_0x3695f6['query'][_0x2771('0xb8')]){var _0x42d7aa=_0x3695f6[_0x2771('0x3d')][_0x2771('0xb8')][_0x2771('0x32')](',');var _0x54400e={};_0x54400e[_0x42d7aa[0x0]]={'$gte':moment(_0x42d7aa[0x1])['format'](_0x2771('0xb9'))};_0x8ffde2[_0x2771('0x76')]=_['merge'](_0x8ffde2[_0x2771('0x76')],_0x54400e);}_0x8ffde2=_[_0x2771('0x95')]({},_0x8ffde2,_0x3695f6[_0x2771('0xad')]);return db['FaxMessage'][_0x2771('0x94')]({'where':_0x8ffde2[_0x2771('0x76')]})[_0x2771('0x29')](function(_0x9a78d7){_0x20de2a[_0x2771('0x94')]=_0x9a78d7;if(_0x3695f6[_0x2771('0x3d')][_0x2771('0xab')]){_0x8ffde2[_0x2771('0xac')]=[{'all':!![]}];}return db[_0x2771('0xb3')][_0x2771('0xba')](_0x8ffde2);})['then'](function(_0x344c9f){_0x20de2a[_0x2771('0xa8')]=_0x344c9f;return _0x20de2a;});}})[_0x2771('0x29')](respondWithFilteredResult(_0x548369,_0x8ffde2))['catch'](handleError(_0x548369,null));};exports[_0x2771('0xbb')]=function(_0x537ed7,_0x18e591,_0x194b5a){return db[_0x2771('0x36')][_0x2771('0x5f')]({'where':{'id':_0x537ed7[_0x2771('0xb0')]['id']}})[_0x2771('0x29')](handleEntityNotFound(_0x18e591,null))[_0x2771('0x29')](function(_0x31dbf0){if(_0x31dbf0){return _0x31dbf0[_0x2771('0xbc')](_0x537ed7['body'][_0x2771('0xb4')],_[_0x2771('0xb5')](_0x537ed7[_0x2771('0xaf')],['ids','id'])||{})[_0x2771('0xbd')](function(){return db['Tag'][_0x2771('0xba')]({'attributes':['id',_0x2771('0x2c'),'color'],'where':{'id':_0x537ed7[_0x2771('0xaf')]['ids']}});})[_0x2771('0x29')](function(_0x3ff5cf){socket[_0x2771('0xbe')](_0x2771('0xbf'),{'id':Number(_0x537ed7['params']['id']),'tags':_0x3ff5cf||[]});return{'id':Number(_0x537ed7[_0x2771('0xb0')]['id']),'tags':_0x3ff5cf||[]};});}})[_0x2771('0x29')](respondWithResult(_0x18e591,null))[_0x2771('0xa9')](handleError(_0x18e591,null));};exports['removeTags']=function(_0x3347be,_0x55f00e,_0x4269f5){return db[_0x2771('0x36')][_0x2771('0x5f')]({'where':{'id':_0x3347be[_0x2771('0xb0')]['id']}})[_0x2771('0x29')](handleEntityNotFound(_0x55f00e,null))[_0x2771('0x29')](function(_0x26140e){if(_0x26140e){return _0x26140e[_0x2771('0xc0')](_0x3347be[_0x2771('0x3d')]['ids']);}})[_0x2771('0x29')](respondWithStatusCode(_0x55f00e,null))['catch'](handleError(_0x55f00e,null));};exports[_0x2771('0xc1')]=function(_0x35aeaa,_0x215083){var _0x3b72a0=moment()[_0x2771('0xc2')]()[_0x2771('0x93')]();var _0x30f7bb=path[_0x2771('0xc3')](config[_0x2771('0xc4')],_0x2771('0xc5'),_0x2771('0xc6'),_0x2771('0xc7'));var _0x49bd56=path[_0x2771('0xc3')](config[_0x2771('0xc4')],_0x2771('0xc5'),_0x2771('0xc6'),_0x2771('0xc8'));var _0x200029=path[_0x2771('0xc3')](_0x30f7bb,_0x3b72a0);var _0x50c8c0=util[_0x2771('0xc9')]('transcript-%d-%s.zip',_0x35aeaa[_0x2771('0xb0')]['id'],_0x3b72a0);var _0x1974ae=path['join'](_0x30f7bb,_0x50c8c0);var _0x227b42=[];_0x227b42[_0x2771('0xa6')]({'model':db[_0x2771('0xca')],'as':_0x2771('0xca'),'raw':!![]});var _0x4cf32c=[{'model':db[_0x2771('0xb3')],'as':_0x2771('0xcb'),'attributes':['id',_0x2771('0xaf'),_0x2771('0xcc')],'include':_0x227b42}];return db[_0x2771('0x36')][_0x2771('0x5f')]({'where':{'id':_0x35aeaa[_0x2771('0xb0')]['id']},'include':_0x4cf32c})[_0x2771('0x29')](handleEntityNotFound(_0x215083,null))['then'](function(_0x10c495){if(_0x10c495&&_0x10c495[_0x2771('0xcb')]){var _0x443812=_0x10c495['get']({'plain':!![]});fs[_0x2771('0xcd')](_0x200029);for(var _0x2d81fd=0x0;_0x2d81fd<_0x443812[_0x2771('0xcb')][_0x2771('0x67')];_0x2d81fd++){var _0x277337=_0x443812[_0x2771('0xcb')][_0x2d81fd][_0x2771('0xca')];if(_0x277337){var _0x2ef54c=path[_0x2771('0xc3')](_0x49bd56,_0x277337[_0x2771('0xce')]);if(fs[_0x2771('0xcf')](_0x2ef54c)){fs[_0x2771('0xd0')](_0x2ef54c)[_0x2771('0xd1')](fs['createWriteStream'](path[_0x2771('0xc3')](_0x200029,_0x277337[_0x2771('0xce')])));}}}return BPromise['resolve']()[_0x2771('0x29')](function(){return new BPromise(function(_0x11cbcb,_0x4059c5){zipdir(_0x200029,{'saveTo':_0x1974ae},function(_0x446569,_0x355e39){if(_0x446569)return _0x4059c5(_0x446569);return _0x11cbcb(_0x355e39);});})['then'](function(){return new BPromise(function(_0x45d503,_0x1cf201){rimraf(_0x200029,function(_0x32b980){if(_0x32b980)_0x1cf201(_0x32b980);return _0x45d503();});});})[_0x2771('0x29')](function(){return _0x215083[_0x2771('0xc1')](_0x1974ae,_0x50c8c0,function(_0x10ac86){if(_0x10ac86){console[_0x2771('0xd2')](_0x2771('0xd3'),_0x10ac86);}else{fs[_0x2771('0xd4')](_0x1974ae);}});});});}else{return _0x215083['sendStatus'](0xc8);}})['catch'](handleError(_0x215083,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index d32af65..c91ceff 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 _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x2c06e9,_0x327205){var _0x1e8dd1=function(_0x4e72bb){while(--_0x4e72bb){_0x2c06e9['push'](_0x2c06e9['shift']());}};_0x1e8dd1(++_0x327205);}(_0x814b,0x1a2));var _0xb814=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x814b[_0x120376];return _0x28c529;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x33af85,_0x5d1801){var _0x194ce2=function(_0x2ac7e6){while(--_0x2ac7e6){_0x33af85['push'](_0x33af85['shift']());}};_0x194ce2(++_0x5d1801);}(_0x814b,0x1a2));var _0xb814=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0x814b[_0x3e478c];return _0x29ef89;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index dbb4b90..3ae4d0a 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 _0xf528=['closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','FaxInteraction','fax_interactions','closed'];(function(_0x2e4811,_0x5bcd0b){var _0x40ea60=function(_0x2134fb){while(--_0x2134fb){_0x2e4811['push'](_0x2e4811['shift']());}};_0x40ea60(++_0x5bcd0b);}(_0xf528,0xe2));var _0x8f52=function(_0x446c11,_0x825160){_0x446c11=_0x446c11-0x0;var _0x30e5c7=_0xf528[_0x446c11];return _0x30e5c7;};'use strict';var _=require(_0x8f52('0x0'));var util=require('util');var logger=require(_0x8f52('0x1'))(_0x8f52('0x2'));var moment=require(_0x8f52('0x3'));var BPromise=require(_0x8f52('0x4'));var rp=require(_0x8f52('0x5'));var fs=require('fs');var path=require(_0x8f52('0x6'));var rimraf=require('rimraf');var config=require(_0x8f52('0x7'));var attributes=require(_0x8f52('0x8'));module['exports']=function(_0x13ab13,_0x2d9577){return _0x13ab13['define'](_0x8f52('0x9'),attributes,{'tableName':_0x8f52('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x26d7c0,_0x47ff3d,_0x50845c){if(_0x26d7c0['changed'](_0x8f52('0xb'))){_0x26d7c0[_0x8f52('0xc')]=moment()['format'](_0x8f52('0xd'));}_0x50845c(null,_0x26d7c0);}}});}; \ No newline at end of file +var _0x740a=['changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x740a,0x153));var _0xa740=function(_0xb08ae8,_0x3dcc50){_0xb08ae8=_0xb08ae8-0x0;var _0x554a28=_0x740a[_0xb08ae8];return _0x554a28;};'use strict';var _=require(_0xa740('0x0'));var util=require(_0xa740('0x1'));var logger=require(_0xa740('0x2'))('api');var moment=require(_0xa740('0x3'));var BPromise=require(_0xa740('0x4'));var rp=require(_0xa740('0x5'));var fs=require('fs');var path=require(_0xa740('0x6'));var rimraf=require('rimraf');var config=require(_0xa740('0x7'));var attributes=require(_0xa740('0x8'));module[_0xa740('0x9')]=function(_0x5e728b,_0x1540a6){return _0x5e728b[_0xa740('0xa')](_0xa740('0xb'),attributes,{'tableName':_0xa740('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15191b,_0x5a9905,_0x885cce){if(_0x15191b[_0xa740('0xd')]('closed')){_0x15191b[_0xa740('0xe')]=moment()['format'](_0xa740('0xf'));}_0x885cce(null,_0x15191b);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index f5da8fe..cd8cf0a 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 _0xa02e=['body','options','raw','where','limit','find','addTags','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','update'];(function(_0x21c7e4,_0x2d61be){var _0x310cd2=function(_0x27820b){while(--_0x27820b){_0x21c7e4['push'](_0x21c7e4['shift']());}};_0x310cd2(++_0x2d61be);}(_0xa02e,0x101));var _0xea02=function(_0x18793d,_0x2fb87a){_0x18793d=_0x18793d-0x0;var _0x82106c=_0xa02e[_0x18793d];return _0x82106c;};'use strict';var _=require('lodash');var util=require(_0xea02('0x0'));var moment=require(_0xea02('0x1'));var BPromise=require(_0xea02('0x2'));var rs=require(_0xea02('0x3'));var fs=require('fs');var Redis=require(_0xea02('0x4'));var db=require(_0xea02('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xea02('0x6'))('rpc');var config=require(_0xea02('0x7'));var jayson=require(_0xea02('0x8'));var client=jayson[_0xea02('0x9')][_0xea02('0xa')]({'port':0x232a});config[_0xea02('0xb')]=_['defaults'](config[_0xea02('0xb')],{'host':_0xea02('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea02('0xb')]));require(_0xea02('0xd'))[_0xea02('0xe')](socket);function respondWithRpcPromise(_0x3d2691,_0x49355b,_0x18fd78){return new BPromise(function(_0x5e15bd,_0x304776){return client[_0xea02('0xf')](_0x3d2691,_0x18fd78)[_0xea02('0x10')](function(_0x3b981f){logger[_0xea02('0x11')](_0xea02('0x12'),_0x49355b,_0xea02('0x13'));logger[_0xea02('0x14')](_0xea02('0x15'),_0x49355b,_0xea02('0x13'),JSON[_0xea02('0x16')](_0x3b981f));if(_0x3b981f[_0xea02('0x17')]){if(_0x3b981f[_0xea02('0x17')]['code']===0x1f4){logger[_0xea02('0x17')](_0xea02('0x12'),_0x49355b,_0x3b981f[_0xea02('0x17')][_0xea02('0x18')]);return _0x304776(_0x3b981f[_0xea02('0x17')][_0xea02('0x18')]);}logger[_0xea02('0x17')](_0xea02('0x12'),_0x49355b,_0x3b981f['error'][_0xea02('0x18')]);return _0x5e15bd(_0x3b981f['error']['message']);}else{logger['info'](_0xea02('0x12'),_0x49355b,_0xea02('0x13'));_0x5e15bd(_0x3b981f[_0xea02('0x19')][_0xea02('0x18')]);}})[_0xea02('0x1a')](function(_0x1aa49b){logger['error'](_0xea02('0x12'),_0x49355b,_0x1aa49b);_0x304776(_0x1aa49b);});});}exports[_0xea02('0x1b')]=function(_0x323776){var _0x4a560d=this;return new Promise(function(_0x54a02a,_0x567406){return db[_0xea02('0x1c')][_0xea02('0x1d')](_0x323776[_0xea02('0x1e')],{'raw':_0x323776[_0xea02('0x1f')]?_0x323776[_0xea02('0x1f')][_0xea02('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x323776[_0xea02('0x1f')]?_0x323776[_0xea02('0x1f')][_0xea02('0x21')]||null:null,'attributes':_0x323776[_0xea02('0x1f')]?_0x323776[_0xea02('0x1f')]['attributes']||null:null,'limit':_0x323776[_0xea02('0x1f')]?_0x323776['options'][_0xea02('0x22')]||null:null})[_0xea02('0x10')](function(_0x37980d){logger[_0xea02('0x11')](_0xea02('0x1b'),_0x323776);logger['debug'](_0xea02('0x1b'),_0x323776,JSON[_0xea02('0x16')](_0x37980d));_0x54a02a(_0x37980d);})['catch'](function(_0x34c112){logger['error'](_0xea02('0x1b'),_0x34c112[_0xea02('0x18')],_0x323776);_0x567406(_0x4a560d[_0xea02('0x17')](0x1f4,_0x34c112[_0xea02('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x13efde){return new Promise(function(_0x509586,_0x59b695){return db[_0xea02('0x1c')][_0xea02('0x23')]({'where':_0x13efde[_0xea02('0x1f')]?_0x13efde[_0xea02('0x1f')][_0xea02('0x21')]||null:null})[_0xea02('0x10')](function(_0x21878e){if(_0x21878e){return _0x21878e[_0xea02('0x24')](_0x13efde[_0xea02('0x1e')]['ids'],_[_0xea02('0x25')](_0x13efde['body'],[_0xea02('0x26'),'id'])||{});}})[_0xea02('0x27')](function(_0x23d68e){logger[_0xea02('0x11')](_0xea02('0x28'),_0x13efde);logger[_0xea02('0x14')](_0xea02('0x28'),_0x13efde,JSON['stringify'](_0x23d68e));_0x509586(_0x23d68e);})['catch'](function(_0x3edd5e){logger['error'](_0xea02('0x28'),_0x3edd5e['message'],_0x13efde);_0x59b695(_this[_0xea02('0x17')](0x1f4,_0x3edd5e[_0xea02('0x18')]));});});}; \ No newline at end of file +var _0x582b=['body','ids','omit','AddTags','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','UpdateFaxInteraction','FaxInteraction','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags'];(function(_0x4a140,_0x1f2087){var _0x1b12cc=function(_0x2c681c){while(--_0x2c681c){_0x4a140['push'](_0x4a140['shift']());}};_0x1b12cc(++_0x1f2087);}(_0x582b,0x12b));var _0xb582=function(_0x523031,_0x355d4f){_0x523031=_0x523031-0x0;var _0x2c0acc=_0x582b[_0x523031];return _0x2c0acc;};'use strict';var _=require('lodash');var util=require(_0xb582('0x0'));var moment=require(_0xb582('0x1'));var BPromise=require(_0xb582('0x2'));var rs=require(_0xb582('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb582('0x4'))['db'];var utils=require(_0xb582('0x5'));var logger=require(_0xb582('0x6'))('rpc');var config=require(_0xb582('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb582('0x8')][_0xb582('0x9')]({'port':0x232a});config[_0xb582('0xa')]=_['defaults'](config[_0xb582('0xa')],{'host':_0xb582('0xb'),'port':0x18eb});var socket=require(_0xb582('0xc'))(new Redis(config[_0xb582('0xa')]));require(_0xb582('0xd'))[_0xb582('0xe')](socket);function respondWithRpcPromise(_0xb96dd0,_0x315f8c,_0xb30c51){return new BPromise(function(_0x2d2306,_0x1c1634){return client[_0xb582('0xf')](_0xb96dd0,_0xb30c51)[_0xb582('0x10')](function(_0x1ea8d6){logger[_0xb582('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x315f8c,_0xb582('0x12'));logger[_0xb582('0x13')](_0xb582('0x14'),_0x315f8c,_0xb582('0x12'),JSON[_0xb582('0x15')](_0x1ea8d6));if(_0x1ea8d6[_0xb582('0x16')]){if(_0x1ea8d6[_0xb582('0x16')][_0xb582('0x17')]===0x1f4){logger[_0xb582('0x16')](_0xb582('0x18'),_0x315f8c,_0x1ea8d6['error'][_0xb582('0x19')]);return _0x1c1634(_0x1ea8d6[_0xb582('0x16')]['message']);}logger[_0xb582('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x315f8c,_0x1ea8d6[_0xb582('0x16')][_0xb582('0x19')]);return _0x2d2306(_0x1ea8d6[_0xb582('0x16')][_0xb582('0x19')]);}else{logger[_0xb582('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x315f8c,_0xb582('0x12'));_0x2d2306(_0x1ea8d6[_0xb582('0x1a')][_0xb582('0x19')]);}})['catch'](function(_0x153419){logger[_0xb582('0x16')](_0xb582('0x18'),_0x315f8c,_0x153419);_0x1c1634(_0x153419);});});}exports[_0xb582('0x1b')]=function(_0x2210b6){var _0x379664=this;return new Promise(function(_0x20f96b,_0x1bf0b4){return db[_0xb582('0x1c')]['update'](_0x2210b6['body'],{'raw':_0x2210b6[_0xb582('0x1d')]?_0x2210b6[_0xb582('0x1d')][_0xb582('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2210b6[_0xb582('0x1d')]?_0x2210b6[_0xb582('0x1d')][_0xb582('0x1f')]||null:null,'attributes':_0x2210b6[_0xb582('0x1d')]?_0x2210b6['options'][_0xb582('0x20')]||null:null,'limit':_0x2210b6[_0xb582('0x1d')]?_0x2210b6[_0xb582('0x1d')][_0xb582('0x21')]||null:null})[_0xb582('0x10')](function(_0x40db01){logger['info']('UpdateFaxInteraction',_0x2210b6);logger[_0xb582('0x13')](_0xb582('0x1b'),_0x2210b6,JSON[_0xb582('0x15')](_0x40db01));_0x20f96b(_0x40db01);})['catch'](function(_0x37ee69){logger[_0xb582('0x16')](_0xb582('0x1b'),_0x37ee69[_0xb582('0x19')],_0x2210b6);_0x1bf0b4(_0x379664[_0xb582('0x16')](0x1f4,_0x37ee69['message']));});});};exports[_0xb582('0x22')]=function(_0x23ae9f){return new Promise(function(_0x3befa2,_0x27351e){return db[_0xb582('0x1c')][_0xb582('0x23')]({'where':_0x23ae9f['options']?_0x23ae9f['options']['where']||null:null})[_0xb582('0x10')](function(_0x42de1a){if(_0x42de1a){return _0x42de1a[_0xb582('0x24')](_0x23ae9f[_0xb582('0x25')][_0xb582('0x26')],_[_0xb582('0x27')](_0x23ae9f[_0xb582('0x25')],['ids','id'])||{});}})['spread'](function(_0x525e37){logger[_0xb582('0x11')](_0xb582('0x28'),_0x23ae9f);logger[_0xb582('0x13')]('AddTags',_0x23ae9f,JSON[_0xb582('0x15')](_0x525e37));_0x3befa2(_0x525e37);})[_0xb582('0x29')](function(_0x1569aa){logger['error']('AddTags',_0x1569aa[_0xb582('0x19')],_0x23ae9f);_0x27351e(_this['error'](0x1f4,_0x1569aa[_0xb582('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index e68769b..d1c6a60 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 _0xe0a2=['faxInteraction:','./faxInteraction.events','save','update','removeListener','register'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xe0a2,0xdf));var _0x2e0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe0a2[_0x20a584];return _0x4b41a8;};'use strict';var FaxInteractionEvents=require(_0x2e0a('0x0'));var events=[_0x2e0a('0x1'),'remove',_0x2e0a('0x2')];function createListener(_0x2a80a3,_0x3570da){return function(_0x295aff){_0x3570da['emit'](_0x2a80a3,_0x295aff);};}function removeListener(_0x1b84ce,_0x11ac4d){return function(){FaxInteractionEvents[_0x2e0a('0x3')](_0x1b84ce,_0x11ac4d);};}exports[_0x2e0a('0x4')]=function(_0x5e6349){for(var _0x5e5cd6=0x0,_0x1bf17f=events['length'];_0x5e5cd6<_0x1bf17f;_0x5e5cd6++){var _0x138a92=events[_0x5e5cd6];var _0x4dc385=createListener(_0x2e0a('0x5')+_0x138a92,_0x5e6349);FaxInteractionEvents['on'](_0x138a92,_0x4dc385);}}; \ No newline at end of file +var _0x83b9=['update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','remove'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x83b9,0xe6));var _0x983b=function(_0x63d91,_0x12800e){_0x63d91=_0x63d91-0x0;var _0x4f7c6b=_0x83b9[_0x63d91];return _0x4f7c6b;};'use strict';var FaxInteractionEvents=require(_0x983b('0x0'));var events=['save',_0x983b('0x1'),_0x983b('0x2')];function createListener(_0x3c40be,_0x299c53){return function(_0x3cd8e0){_0x299c53[_0x983b('0x3')](_0x3c40be,_0x3cd8e0);};}function removeListener(_0x1301d4,_0x4cc997){return function(){FaxInteractionEvents[_0x983b('0x4')](_0x1301d4,_0x4cc997);};}exports[_0x983b('0x5')]=function(_0x293d81){for(var _0x5af39a=0x0,_0x1219b3=events[_0x983b('0x6')];_0x5af39a<_0x1219b3;_0x5af39a++){var _0x1e6502=events[_0x5af39a];var _0x570b25=createListener(_0x983b('0x7')+_0x1e6502,_0x293d81);FaxInteractionEvents['on'](_0x1e6502,_0x570b25);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 46d5fde..1f1284e 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 _0xb4e6=['show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','addTags','/:id','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x30b71b,_0x40ea0f){var _0x4f0a88=function(_0x30baba){while(--_0x30baba){_0x30b71b['push'](_0x30b71b['shift']());}};_0x4f0a88(++_0x40ea0f);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xb4e6[_0x397cfb];return _0x15fed9;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var auth=require(_0x6b4e('0x5'));var interaction=require(_0x6b4e('0x6'));var config=require(_0x6b4e('0x7'));var controller=require('./faxInteraction.controller');router[_0x6b4e('0x8')]('/',auth[_0x6b4e('0x9')](),controller[_0x6b4e('0xa')]);router['get'](_0x6b4e('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6b4e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x8')](_0x6b4e('0xd'),auth[_0x6b4e('0x9')](),controller[_0x6b4e('0xe')]);router[_0x6b4e('0x8')](_0x6b4e('0xf'),auth['isAuthenticated'](),controller[_0x6b4e('0x10')]);router[_0x6b4e('0x11')]('/',auth['isAuthenticated'](),controller[_0x6b4e('0x12')]);router[_0x6b4e('0x11')](_0x6b4e('0xd'),auth[_0x6b4e('0x9')](),controller[_0x6b4e('0x13')]);router[_0x6b4e('0x11')](_0x6b4e('0x14'),auth['isAuthenticated'](),interaction[_0x6b4e('0x15')](_0x6b4e('0x16'),'faxinteraction:addtags'),controller[_0x6b4e('0x17')]);router['put'](_0x6b4e('0x18'),auth[_0x6b4e('0x9')](),interaction[_0x6b4e('0x15')](_0x6b4e('0x16'),_0x6b4e('0x19')),controller[_0x6b4e('0x1a')]);router['delete']('/:id',auth[_0x6b4e('0x9')](),interaction[_0x6b4e('0x15')](_0x6b4e('0x16'),_0x6b4e('0x1b')),controller[_0x6b4e('0x1c')]);router[_0x6b4e('0x1d')](_0x6b4e('0x14'),auth[_0x6b4e('0x9')](),controller[_0x6b4e('0x1e')]);module[_0x6b4e('0x1f')]=router; \ No newline at end of file +var _0x0bb5=['/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','update','/:id','destroy','delete','removeTags','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','show'];(function(_0x25b439,_0xb20872){var _0xbf2210=function(_0x518b01){while(--_0x518b01){_0x25b439['push'](_0x25b439['shift']());}};_0xbf2210(++_0xb20872);}(_0x0bb5,0x148));var _0x50bb=function(_0x1f9a1a,_0x24a9f7){_0x1f9a1a=_0x1f9a1a-0x0;var _0x5442d=_0x0bb5[_0x1f9a1a];return _0x5442d;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var auth=require(_0x50bb('0x4'));var interaction=require(_0x50bb('0x5'));var config=require(_0x50bb('0x6'));var controller=require(_0x50bb('0x7'));router[_0x50bb('0x8')]('/',auth[_0x50bb('0x9')](),controller['index']);router['get'](_0x50bb('0xa'),auth[_0x50bb('0x9')](),controller[_0x50bb('0xb')]);router[_0x50bb('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x50bb('0xc')]);router[_0x50bb('0x8')](_0x50bb('0xd'),auth[_0x50bb('0x9')](),controller['getMessages']);router[_0x50bb('0x8')](_0x50bb('0xe'),auth[_0x50bb('0x9')](),controller[_0x50bb('0xf')]);router[_0x50bb('0x10')]('/',auth[_0x50bb('0x9')](),controller[_0x50bb('0x11')]);router['post'](_0x50bb('0xd'),auth['isAuthenticated'](),controller[_0x50bb('0x12')]);router[_0x50bb('0x10')](_0x50bb('0x13'),auth['isAuthenticated'](),interaction[_0x50bb('0x14')](_0x50bb('0x15'),_0x50bb('0x16')),controller['addTags']);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0x9')](),interaction[_0x50bb('0x14')](_0x50bb('0x15'),_0x50bb('0x18')),controller[_0x50bb('0x19')]);router['delete'](_0x50bb('0x1a'),auth[_0x50bb('0x9')](),interaction['tracked'](_0x50bb('0x15'),'faxinteraction:destroy'),controller[_0x50bb('0x1b')]);router[_0x50bb('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x50bb('0x1d')]);module[_0x50bb('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index c1e6118..7e304fa 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 _0x19c8=['BOOLEAN','ENUM','out','DATE','sequelize','TEXT'];(function(_0x20ae13,_0x2a0c8e){var _0x533fd5=function(_0x3bb746){while(--_0x3bb746){_0x20ae13['push'](_0x20ae13['shift']());}};_0x533fd5(++_0x2a0c8e);}(_0x19c8,0x94));var _0x819c=function(_0x44b9a9,_0x3323b2){_0x44b9a9=_0x44b9a9-0x0;var _0x103da4=_0x19c8[_0x44b9a9];return _0x103da4;};'use strict';var Sequelize=require(_0x819c('0x0'));module['exports']={'body':{'type':Sequelize[_0x819c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x819c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x819c('0x3')]('in',_0x819c('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x819c('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x819c('0x5')]}}; \ No newline at end of file +var _0xcfb2=['DATE','sequelize','exports','TEXT','medium','out'];(function(_0x18be00,_0x2b07f4){var _0x5487e9=function(_0x501385){while(--_0x501385){_0x18be00['push'](_0x18be00['shift']());}};_0x5487e9(++_0x2b07f4);}(_0xcfb2,0x67));var _0x2cfb=function(_0x30d62e,_0x3b318){_0x30d62e=_0x30d62e-0x0;var _0x1e872a=_0xcfb2[_0x30d62e];return _0x1e872a;};'use strict';var Sequelize=require(_0x2cfb('0x0'));module[_0x2cfb('0x1')]={'body':{'type':Sequelize[_0x2cfb('0x2')](_0x2cfb('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2cfb('0x4')),'defaultValue':_0x2cfb('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x2cfb('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2cfb('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 7a15a04..6bf2d61 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 _0xeb3b=['SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','join','files','attachments','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','status','end','offset','set','Content-Range','json','apply','reject','save','destroy','sendStatus','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','map','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','keys','length','body','find','params','describe','fax-interactions','accept','read','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','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','create','Attachment','findOne'];(function(_0x1617fe,_0x2faa0e){var _0x632abf=function(_0x4140dd){while(--_0x4140dd){_0x1617fe['push'](_0x1617fe['shift']());}};_0x632abf(++_0x2faa0e);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0xeb3b[_0x1bf809];return _0x1caa4e;};'use strict';var pdf=require(_0xbeb3('0x0'));var emlformat=require(_0xbeb3('0x1'));var rimraf=require(_0xbeb3('0x2'));var zipdir=require(_0xbeb3('0x3'));var jsonpatch=require(_0xbeb3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbeb3('0x5'));var Mustache=require('mustache');var util=require(_0xbeb3('0x6'));var path=require('path');var sox=require(_0xbeb3('0x7'));var csv=require(_0xbeb3('0x8'));var ejs=require(_0xbeb3('0x9'));var fs=require('fs');var _=require(_0xbeb3('0xa'));var squel=require(_0xbeb3('0xb'));var crypto=require(_0xbeb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeb3('0xd'));var toCsv=require(_0xbeb3('0x8'));var querystring=require(_0xbeb3('0xe'));var Papa=require(_0xbeb3('0xf'));var Redis=require(_0xbeb3('0x10'));var authService=require(_0xbeb3('0x11'));var qs=require(_0xbeb3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeb3('0x13'));var logger=require(_0xbeb3('0x14'))('api');var utils=require(_0xbeb3('0x15'));var config=require(_0xbeb3('0x16'));var licenseUtil=require(_0xbeb3('0x17'));var db=require(_0xbeb3('0x18'))['db'];config[_0xbeb3('0x19')]=_[_0xbeb3('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbeb3('0x1b'))(new Redis(config[_0xbeb3('0x19')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0xbeb3('0x1c'));var client=jayson[_0xbeb3('0x1d')][_0xbeb3('0x1e')]({'port':0x232c});var client9002=jayson[_0xbeb3('0x1d')][_0xbeb3('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x535836,_0x1aeaee,_0x5970a1,_0x80ef55){return new BPromise(function(_0x4e7d99,_0x4bc8da){var _0x4f8481=_0x80ef55||client;return _0x4f8481[_0xbeb3('0x1f')](_0x535836,_0x5970a1)[_0xbeb3('0x20')](function(_0x32275b){logger[_0xbeb3('0x21')]('FaxMessage,\x20%s,\x20%s',_0x1aeaee,_0xbeb3('0x22'));logger[_0xbeb3('0x23')](_0xbeb3('0x24'),_0x1aeaee,'request\x20sent',JSON['stringify'](_0x32275b));if(_0x32275b[_0xbeb3('0x25')]){if(_0x32275b['error'][_0xbeb3('0x26')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1aeaee,_0x32275b[_0xbeb3('0x25')][_0xbeb3('0x27')]);return _0x4bc8da(_0x32275b[_0xbeb3('0x25')]['message']);}logger[_0xbeb3('0x25')](_0xbeb3('0x28'),_0x1aeaee,_0x32275b['error'][_0xbeb3('0x27')]);return _0x4e7d99(_0x32275b[_0xbeb3('0x25')]['message']);}else{logger[_0xbeb3('0x21')](_0xbeb3('0x28'),_0x1aeaee,_0xbeb3('0x22'));_0x4e7d99(_0x32275b[_0xbeb3('0x29')][_0xbeb3('0x27')]);}})[_0xbeb3('0x2a')](function(_0x84921a){logger[_0xbeb3('0x25')](_0xbeb3('0x28'),_0x1aeaee,_0x84921a);_0x4bc8da(_0x84921a);});});}function respondWithStatusCode(_0x59f27c,_0x4e695e){_0x4e695e=_0x4e695e||0xcc;return function(_0x1f36b9){if(_0x1f36b9){return _0x59f27c['sendStatus'](_0x4e695e);}return _0x59f27c[_0xbeb3('0x2b')](_0x4e695e)[_0xbeb3('0x2c')]();};}function respondWithResult(_0x138adf,_0x400f65){_0x400f65=_0x400f65||0xc8;return function(_0x4fa3c7){if(_0x4fa3c7){return _0x138adf[_0xbeb3('0x2b')](_0x400f65)['json'](_0x4fa3c7);}};}function respondWithFilteredResult(_0x26cd8f,_0xab301c){return function(_0x5bd93d){if(_0x5bd93d){var _0x483198=_0x5bd93d['count'],_0x9b8f13=_0xab301c['offset'],_0x585c6f=_0xab301c[_0xbeb3('0x2d')]+_0xab301c['limit'],_0x51f7ef;if(_0x585c6f>=_0x483198){_0x585c6f=_0x483198;_0x51f7ef=0xc8;}else{_0x51f7ef=0xce;}_0x26cd8f[_0xbeb3('0x2b')](_0x51f7ef);return _0x26cd8f[_0xbeb3('0x2e')](_0xbeb3('0x2f'),_0x9b8f13+'-'+_0x585c6f+'/'+_0x483198)[_0xbeb3('0x30')](_0x5bd93d);}return null;};}function patchUpdates(_0x29e9c2){return function(_0x12f7d4){try{jsonpatch[_0xbeb3('0x31')](_0x12f7d4,_0x29e9c2,!![]);}catch(_0x30fcd4){return BPromise[_0xbeb3('0x32')](_0x30fcd4);}return _0x12f7d4[_0xbeb3('0x33')]();};}function saveUpdates(_0x4ead3b,_0xb829fd){return function(_0x281a7f){if(_0x281a7f){return _0x281a7f['update'](_0x4ead3b)[_0xbeb3('0x20')](function(_0x22c0c0){return _0x22c0c0;});}return null;};}function removeEntity(_0x2bcb46,_0x1230de){return function(_0x4c8682){if(_0x4c8682){return _0x4c8682[_0xbeb3('0x34')]()[_0xbeb3('0x20')](function(){_0x2bcb46[_0xbeb3('0x2b')](0xcc)[_0xbeb3('0x2c')]();});}};}function handleEntityNotFound(_0x212b1d,_0x3f8e35){return function(_0x2e9ade){if(!_0x2e9ade){_0x212b1d[_0xbeb3('0x35')](0x194);}return _0x2e9ade;};}function handleError(_0x3c81e0,_0x4d0cf3){_0x4d0cf3=_0x4d0cf3||0x1f4;return function(_0x106629){logger['error'](_0x106629[_0xbeb3('0x36')]);if(_0x106629[_0xbeb3('0x37')]){delete _0x106629[_0xbeb3('0x37')];}_0x3c81e0[_0xbeb3('0x2b')](_0x4d0cf3)[_0xbeb3('0x38')](_0x106629);};}exports[_0xbeb3('0x39')]=function(_0x75a01,_0x318450){var _0x52a632={},_0x9d078e={},_0x483238={'count':0x0,'rows':[]};var _0x59e6df=_['map'](db[_0xbeb3('0x3a')][_0xbeb3('0x3b')],function(_0x397b68){return{'name':_0x397b68[_0xbeb3('0x3c')],'type':_0x397b68[_0xbeb3('0x3d')][_0xbeb3('0x3e')]};});_0x9d078e['model']=_[_0xbeb3('0x3f')](_0x59e6df,_0xbeb3('0x37'));_0x9d078e[_0xbeb3('0x40')]=_['keys'](_0x75a01['query']);_0x9d078e['filters']=_[_0xbeb3('0x41')](_0x9d078e[_0xbeb3('0x42')],_0x9d078e[_0xbeb3('0x40')]);_0x52a632['attributes']=_[_0xbeb3('0x41')](_0x9d078e['model'],qs[_0xbeb3('0x43')](_0x75a01[_0xbeb3('0x40')][_0xbeb3('0x43')]));_0x52a632[_0xbeb3('0x44')]=_0x52a632['attributes']['length']?_0x52a632[_0xbeb3('0x44')]:_0x9d078e[_0xbeb3('0x42')];if(!_0x75a01[_0xbeb3('0x40')][_0xbeb3('0x45')](_0xbeb3('0x46'))){_0x52a632[_0xbeb3('0x47')]=qs[_0xbeb3('0x47')](_0x75a01[_0xbeb3('0x40')]['limit']);_0x52a632[_0xbeb3('0x2d')]=qs[_0xbeb3('0x2d')](_0x75a01[_0xbeb3('0x40')][_0xbeb3('0x2d')]);}_0x52a632[_0xbeb3('0x48')]=qs[_0xbeb3('0x49')](_0x75a01[_0xbeb3('0x40')]['sort']);_0x52a632[_0xbeb3('0x4a')]=qs[_0xbeb3('0x4b')](_[_0xbeb3('0x4c')](_0x75a01[_0xbeb3('0x40')],_0x9d078e[_0xbeb3('0x4b')]),_0x59e6df);if(_0x75a01[_0xbeb3('0x40')][_0xbeb3('0x4d')]){_0x52a632[_0xbeb3('0x4a')]=_[_0xbeb3('0x4e')](_0x52a632[_0xbeb3('0x4a')],{'$or':_[_0xbeb3('0x3f')](_0x59e6df,function(_0x445e5e){if(_0x445e5e[_0xbeb3('0x3d')]!=='VIRTUAL'){var _0xee04b0={};_0xee04b0[_0x445e5e[_0xbeb3('0x37')]]={'$like':'%'+_0x75a01[_0xbeb3('0x40')]['filter']+'%'};return _0xee04b0;}})});}_0x52a632=_['merge']({},_0x52a632,_0x75a01[_0xbeb3('0x4f')]);var _0x472adf={'where':_0x52a632[_0xbeb3('0x4a')]};return db[_0xbeb3('0x3a')]['count'](_0x472adf)[_0xbeb3('0x20')](function(_0x517ee9){_0x483238['count']=_0x517ee9;if(_0x75a01[_0xbeb3('0x40')][_0xbeb3('0x50')]){_0x52a632[_0xbeb3('0x51')]=[{'all':!![]}];}return db[_0xbeb3('0x3a')]['findAll'](_0x52a632);})[_0xbeb3('0x20')](function(_0x1fe264){_0x483238[_0xbeb3('0x52')]=_0x1fe264;return _0x483238;})['then'](respondWithFilteredResult(_0x318450,_0x52a632))[_0xbeb3('0x2a')](handleError(_0x318450,null));};exports['show']=function(_0x502955,_0x26d128){var _0xf8e19d={'raw':!![],'where':{'id':_0x502955['params']['id']}},_0x15dd16={};_0x15dd16[_0xbeb3('0x42')]=_[_0xbeb3('0x53')](db[_0xbeb3('0x3a')]['rawAttributes']);_0x15dd16[_0xbeb3('0x40')]=_['keys'](_0x502955[_0xbeb3('0x40')]);_0x15dd16['filters']=_[_0xbeb3('0x41')](_0x15dd16[_0xbeb3('0x42')],_0x15dd16[_0xbeb3('0x40')]);_0xf8e19d[_0xbeb3('0x44')]=_[_0xbeb3('0x41')](_0x15dd16[_0xbeb3('0x42')],qs[_0xbeb3('0x43')](_0x502955[_0xbeb3('0x40')]['fields']));_0xf8e19d[_0xbeb3('0x44')]=_0xf8e19d[_0xbeb3('0x44')][_0xbeb3('0x54')]?_0xf8e19d[_0xbeb3('0x44')]:_0x15dd16['model'];if(_0x502955[_0xbeb3('0x40')][_0xbeb3('0x50')]){_0xf8e19d[_0xbeb3('0x51')]=[{'all':!![]}];}_0xf8e19d=_[_0xbeb3('0x4e')]({},_0xf8e19d,_0x502955['options']);return db[_0xbeb3('0x3a')]['find'](_0xf8e19d)[_0xbeb3('0x20')](handleEntityNotFound(_0x26d128,null))[_0xbeb3('0x20')](respondWithResult(_0x26d128,null))[_0xbeb3('0x2a')](handleError(_0x26d128,null));};exports['update']=function(_0x43379e,_0x3e33fe){if(_0x43379e[_0xbeb3('0x55')]['id']){delete _0x43379e[_0xbeb3('0x55')]['id'];}return db[_0xbeb3('0x3a')][_0xbeb3('0x56')]({'where':{'id':_0x43379e[_0xbeb3('0x57')]['id']}})[_0xbeb3('0x20')](handleEntityNotFound(_0x3e33fe,null))[_0xbeb3('0x20')](saveUpdates(_0x43379e[_0xbeb3('0x55')],null))['then'](respondWithResult(_0x3e33fe,null))[_0xbeb3('0x2a')](handleError(_0x3e33fe,null));};exports[_0xbeb3('0x34')]=function(_0x241481,_0x8660b4){return db[_0xbeb3('0x3a')]['find']({'where':{'id':_0x241481['params']['id']}})[_0xbeb3('0x20')](handleEntityNotFound(_0x8660b4,null))[_0xbeb3('0x20')](removeEntity(_0x8660b4,null))['catch'](handleError(_0x8660b4,null));};exports[_0xbeb3('0x58')]=function(_0x405354,_0x2b642d){return db[_0xbeb3('0x3a')][_0xbeb3('0x58')]()[_0xbeb3('0x20')](respondWithResult(_0x2b642d,null))[_0xbeb3('0x2a')](handleError(_0x2b642d,null));};var interaction_log=require('../../config/logger')(_0xbeb3('0x59'));exports[_0xbeb3('0x5a')]=function(_0xad440e,_0x47980d,_0x3863b4){var _0x39a983={'agent':{},'channel':'fax'};if(_0xad440e[_0xbeb3('0x55')]['id']){delete _0xad440e[_0xbeb3('0x55')]['id'];}_0xad440e[_0xbeb3('0x55')][_0xbeb3('0x5b')]=!![];_0xad440e['body']['readAt']=moment()[_0xbeb3('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0xad440e[_0xbeb3('0x55')]['UserId']=_0xad440e[_0xbeb3('0x55')][_0xbeb3('0x5d')]||_0xad440e[_0xbeb3('0x5e')]['id'];_0x39a983[_0xbeb3('0x5f')]['id']=_0xad440e[_0xbeb3('0x55')][_0xbeb3('0x5d')];return db[_0xbeb3('0x3a')][_0xbeb3('0x56')]({'where':{'id':_0xad440e[_0xbeb3('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xbeb3('0x60')],'as':_0xbeb3('0x61')}]})[_0xbeb3('0x20')](handleEntityNotFound(_0x47980d,null))[_0xbeb3('0x20')](saveUpdates(_0xad440e[_0xbeb3('0x55')],null))[_0xbeb3('0x20')](function(_0x33d51d){if(_0x33d51d){_0x39a983[_0xbeb3('0x27')]=_0x33d51d[_0xbeb3('0x62')]({'plain':!![]});return db['FaxInteraction'][_0xbeb3('0x56')]({'where':{'id':_0x33d51d[_0xbeb3('0x63')]}});}return null;})[_0xbeb3('0x20')](handleEntityNotFound(_0x47980d,null))[_0xbeb3('0x20')](function(_0x1dfb62){if(_0x1dfb62){return _0x1dfb62['update']({'UserId':_0xad440e[_0xbeb3('0x55')]['UserId'],'read1stAt':_[_0xbeb3('0x64')](_0x1dfb62[_0xbeb3('0x65')])?moment()[_0xbeb3('0x5c')](_0xbeb3('0x66')):undefined});}return null;})[_0xbeb3('0x20')](function(_0x394524){if(_0x394524){_0x39a983[_0xbeb3('0x67')]=_0x394524[_0xbeb3('0x62')]({'plain':!![]});interaction_log[_0xbeb3('0x21')](_0xbeb3('0x68'),_0xad440e[_0xbeb3('0x5e')]['id'],_0xad440e[_0xbeb3('0x5e')][_0xbeb3('0x37')],_0xad440e[_0xbeb3('0x5e')][_0xbeb3('0x69')],_0x39a983[_0xbeb3('0x67')]['id'],_0xad440e[_0xbeb3('0x55')]?JSON[_0xbeb3('0x6a')](_0xad440e[_0xbeb3('0x55')]):_0xbeb3('0x6b'));return respondWithRpcPromise(_0xbeb3('0x6c'),_0xbeb3('0x6d'),_0x39a983);}return null;})[_0xbeb3('0x20')](function(_0x1ee0f0){if(_0x1ee0f0){if(_0xad440e[_0xbeb3('0x55')][_0xbeb3('0x6e')]){_0x39a983[_0xbeb3('0x27')][_0xbeb3('0x6f')]=util[_0xbeb3('0x5c')](_0xbeb3('0x70'),_0xad440e[_0xbeb3('0x5e')][_0xbeb3('0x37')]);_0x39a983[_0xbeb3('0x27')][_0xbeb3('0x71')]=_0x39a983[_0xbeb3('0x71')];_0x39a983[_0xbeb3('0x27')]['event']=_0xbeb3('0x5a');return respondWithRpcPromise(_0xbeb3('0x72'),'EventManager',{'event':_0xbeb3('0x73'),'message':_0x39a983[_0xbeb3('0x27')]},client9002)[_0xbeb3('0x20')](function(){return _0x39a983;});}return _0x39a983;}return null;})['then'](respondWithResult(_0x47980d,null))['catch'](handleError(_0x47980d,null));};var interaction_log=require(_0xbeb3('0x14'))(_0xbeb3('0x59'));exports[_0xbeb3('0x32')]=function(_0xebc0bc,_0x39ba67,_0x5c9fb4){var _0x27e497={'agent':{},'channel':_0xbeb3('0x74')};if(_0xebc0bc[_0xbeb3('0x55')]['id']){delete _0xebc0bc[_0xbeb3('0x55')]['id'];}_0xebc0bc[_0xbeb3('0x55')]['UserId']=_0xebc0bc[_0xbeb3('0x55')]['UserId']||_0xebc0bc['user']['id'];_0x27e497[_0xbeb3('0x5f')]['id']=_0xebc0bc['body'][_0xbeb3('0x5d')];return db[_0xbeb3('0x3a')][_0xbeb3('0x56')]({'where':{'id':_0xebc0bc[_0xbeb3('0x57')]['id'],'UserId':null}})[_0xbeb3('0x20')](handleEntityNotFound(_0x39ba67,null))[_0xbeb3('0x20')](function(_0x942394){if(_0x942394){_0x27e497['message']=_0x942394[_0xbeb3('0x62')]({'plain':!![]});return db[_0xbeb3('0x75')][_0xbeb3('0x56')]({'where':{'id':_0x942394['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x39ba67,null))[_0xbeb3('0x20')](function(_0x48da15){if(_0x48da15){_0x27e497['interaction']=_0x48da15['get']({'plain':!![]});interaction_log[_0xbeb3('0x21')](_0xbeb3('0x76'),_0xebc0bc[_0xbeb3('0x5e')]['id'],_0xebc0bc[_0xbeb3('0x5e')]['name'],_0xebc0bc['user'][_0xbeb3('0x69')],_0x27e497[_0xbeb3('0x67')]['id'],_0xebc0bc[_0xbeb3('0x55')]?JSON['stringify'](_0xebc0bc['body']):_0xbeb3('0x6b'));return respondWithRpcPromise(_0xbeb3('0x77'),_0xbeb3('0x78'),_0x27e497);}return null;})[_0xbeb3('0x20')](function(_0x2e4cff){if(_0x2e4cff){_0x2e4cff[_0xbeb3('0x27')][_0xbeb3('0x6f')]=util['format']('SIP/%s',_0xebc0bc[_0xbeb3('0x5e')][_0xbeb3('0x37')]);_0x2e4cff['message']['channel']=_0x27e497[_0xbeb3('0x71')];_0x2e4cff['message'][_0xbeb3('0x79')]=_0xbeb3('0x32');respondWithRpcPromise(_0xbeb3('0x72'),_0xbeb3('0x72'),{'event':_0xbeb3('0x7a'),'message':_0x2e4cff[_0xbeb3('0x27')]},client9002);return _0x27e497;}return null;})[_0xbeb3('0x20')](respondWithResult(_0x39ba67,null))[_0xbeb3('0x2a')](handleError(_0x39ba67,null));};exports[_0xbeb3('0x7b')]=function(_0xaf84a8,_0x154c80){var _0x1f7afa;return db[_0xbeb3('0x3a')][_0xbeb3('0x7b')](_0xaf84a8[_0xbeb3('0x55')],{})[_0xbeb3('0x20')](function(_0x29fd6c){_0x1f7afa=_0x29fd6c;return db[_0xbeb3('0x60')]['findOne']({'where':{'id':_0x1f7afa['ContactId']}});})[_0xbeb3('0x20')](function(_0x157ced){if(_['isNil'](_0x157ced)){return;}else{_0x1f7afa[_0xbeb3('0x74')]=_0x157ced['fax'];return db[_0xbeb3('0x7c')][_0xbeb3('0x7d')]({'where':{'id':_0x1f7afa['AttachmentId']}});}})[_0xbeb3('0x20')](function(_0x2d03be){return respondWithRpcPromise(_0xbeb3('0x7e'),_0xbeb3('0x7e'),{'FaxAccountId':_[_0xbeb3('0x64')](_0xaf84a8[_0xbeb3('0x55')])?undefined:_0xaf84a8[_0xbeb3('0x55')][_0xbeb3('0x7f')],'path':_[_0xbeb3('0x64')](_0x2d03be)?undefined:util[_0xbeb3('0x5c')](_0xbeb3('0x80'),_0x2d03be[_0xbeb3('0x81')]),'fax':_['isNil'](_0x1f7afa[_0xbeb3('0x74')])?undefined:_0x1f7afa[_0xbeb3('0x74')],'AttachmentId':_0x1f7afa[_0xbeb3('0x82')]},client9002);})[_0xbeb3('0x20')](respondWithResult(_0x154c80,0xc9))[_0xbeb3('0x2a')](handleError(_0x154c80,null));};exports['download']=function(_0x129029,_0x157fed){var _0x4a396a=path[_0xbeb3('0x83')](config['root'],'server',_0xbeb3('0x84'),_0xbeb3('0x85'));return db[_0xbeb3('0x3a')]['find']({'where':{'id':_0x129029[_0xbeb3('0x57')]['id']},'include':[{'model':db[_0xbeb3('0x7c')],'as':_0xbeb3('0x7c')}]})['then'](handleEntityNotFound(_0x157fed,null))[_0xbeb3('0x20')](function(_0x2ab119){if(_0x2ab119){return _0x157fed[_0xbeb3('0x86')](path['join'](_0x4a396a,_0x2ab119[_0xbeb3('0x7c')][_0xbeb3('0x81')]));}})[_0xbeb3('0x2a')](handleError(_0x157fed,null));}; \ No newline at end of file +var _0xb574=['moment','bluebird','mustache','util','path','ejs','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','http','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','destroy','stack','name','index','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','FaxMessage','findAll','rows','show','find','describe','fax-interactions','accept','fax','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SIP/%s','channel','event','EventManager','acceptmessage','agent','params','FaxInteractionId','RejectMessage','rejectMessage','interface','rejectmessage','create','CmContact','findOne','ContactId','Attachment','AttachmentId','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','join','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x3b0d4c,_0x506223){var _0x2f0bec=function(_0x326a14){while(--_0x326a14){_0x3b0d4c['push'](_0x3b0d4c['shift']());}};_0x2f0bec(++_0x506223);}(_0xb574,0x106));var _0x4b57=function(_0x31b9d3,_0x3f7129){_0x31b9d3=_0x31b9d3-0x0;var _0x481007=_0xb574[_0x31b9d3];return _0x481007;};'use strict';var pdf=require(_0x4b57('0x0'));var emlformat=require(_0x4b57('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4b57('0x2'));var jsonpatch=require(_0x4b57('0x3'));var rp=require('request-promise');var moment=require(_0x4b57('0x4'));var BPromise=require(_0x4b57('0x5'));var Mustache=require(_0x4b57('0x6'));var util=require(_0x4b57('0x7'));var path=require(_0x4b57('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b57('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];config[_0x4b57('0x16')]=_[_0x4b57('0x17')](config[_0x4b57('0x16')],{'host':_0x4b57('0x18'),'port':0x18eb});var socket=require(_0x4b57('0x19'))(new Redis(config[_0x4b57('0x16')]));require(_0x4b57('0x1a'))[_0x4b57('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x4b57('0x1c')]({'port':0x232c});var client9002=jayson[_0x4b57('0x1d')][_0x4b57('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x58d6bd,_0x284640,_0x48bd13,_0x159ce5){return new BPromise(function(_0x42aff4,_0x1b018c){var _0x10eda5=_0x159ce5||client;return _0x10eda5[_0x4b57('0x1e')](_0x58d6bd,_0x48bd13)[_0x4b57('0x1f')](function(_0x4ede42){logger[_0x4b57('0x20')](_0x4b57('0x21'),_0x284640,_0x4b57('0x22'));logger[_0x4b57('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x284640,_0x4b57('0x22'),JSON[_0x4b57('0x24')](_0x4ede42));if(_0x4ede42[_0x4b57('0x25')]){if(_0x4ede42[_0x4b57('0x25')][_0x4b57('0x26')]===0x1f4){logger[_0x4b57('0x25')]('FaxMessage,\x20%s,\x20%s',_0x284640,_0x4ede42[_0x4b57('0x25')][_0x4b57('0x27')]);return _0x1b018c(_0x4ede42[_0x4b57('0x25')]['message']);}logger[_0x4b57('0x25')](_0x4b57('0x21'),_0x284640,_0x4ede42[_0x4b57('0x25')][_0x4b57('0x27')]);return _0x42aff4(_0x4ede42['error'][_0x4b57('0x27')]);}else{logger[_0x4b57('0x20')]('FaxMessage,\x20%s,\x20%s',_0x284640,_0x4b57('0x22'));_0x42aff4(_0x4ede42[_0x4b57('0x28')][_0x4b57('0x27')]);}})[_0x4b57('0x29')](function(_0x540eff){logger[_0x4b57('0x25')]('FaxMessage,\x20%s,\x20%s',_0x284640,_0x540eff);_0x1b018c(_0x540eff);});});}function respondWithStatusCode(_0x131dab,_0x517119){_0x517119=_0x517119||0xcc;return function(_0x36ceb1){if(_0x36ceb1){return _0x131dab[_0x4b57('0x2a')](_0x517119);}return _0x131dab[_0x4b57('0x2b')](_0x517119)[_0x4b57('0x2c')]();};}function respondWithResult(_0x104f52,_0x392e37){_0x392e37=_0x392e37||0xc8;return function(_0x4ffee1){if(_0x4ffee1){return _0x104f52['status'](_0x392e37)[_0x4b57('0x2d')](_0x4ffee1);}};}function respondWithFilteredResult(_0x4c58e4,_0x1ea0cb){return function(_0x458f70){if(_0x458f70){var _0x874cf7=_0x458f70['count'],_0x3af22f=_0x1ea0cb[_0x4b57('0x2e')],_0x249461=_0x1ea0cb[_0x4b57('0x2e')]+_0x1ea0cb[_0x4b57('0x2f')],_0x2c20d2;if(_0x249461>=_0x874cf7){_0x249461=_0x874cf7;_0x2c20d2=0xc8;}else{_0x2c20d2=0xce;}_0x4c58e4[_0x4b57('0x2b')](_0x2c20d2);return _0x4c58e4['set'](_0x4b57('0x30'),_0x3af22f+'-'+_0x249461+'/'+_0x874cf7)[_0x4b57('0x2d')](_0x458f70);}return null;};}function patchUpdates(_0x4cc72a){return function(_0xbfb420){try{jsonpatch[_0x4b57('0x31')](_0xbfb420,_0x4cc72a,!![]);}catch(_0x4726a6){return BPromise[_0x4b57('0x32')](_0x4726a6);}return _0xbfb420['save']();};}function saveUpdates(_0x5742a0,_0x5f03d9){return function(_0x23ff83){if(_0x23ff83){return _0x23ff83[_0x4b57('0x33')](_0x5742a0)[_0x4b57('0x1f')](function(_0xb43038){return _0xb43038;});}return null;};}function removeEntity(_0x33fbfd,_0x5355d5){return function(_0x3ca5b1){if(_0x3ca5b1){return _0x3ca5b1[_0x4b57('0x34')]()[_0x4b57('0x1f')](function(){_0x33fbfd['status'](0xcc)[_0x4b57('0x2c')]();});}};}function handleEntityNotFound(_0x1135a1,_0x467a9d){return function(_0x5b9bfc){if(!_0x5b9bfc){_0x1135a1[_0x4b57('0x2a')](0x194);}return _0x5b9bfc;};}function handleError(_0x4d20b1,_0x4b5ea1){_0x4b5ea1=_0x4b5ea1||0x1f4;return function(_0x1b23b8){logger[_0x4b57('0x25')](_0x1b23b8[_0x4b57('0x35')]);if(_0x1b23b8[_0x4b57('0x36')]){delete _0x1b23b8[_0x4b57('0x36')];}_0x4d20b1[_0x4b57('0x2b')](_0x4b5ea1)['send'](_0x1b23b8);};}exports[_0x4b57('0x37')]=function(_0x3c09be,_0xc2d4f5){var _0x2c7972={},_0x2752d8={},_0x379dc5={'count':0x0,'rows':[]};var _0x1f30b2=_['map'](db['FaxMessage'][_0x4b57('0x38')],function(_0x41204e){return{'name':_0x41204e[_0x4b57('0x39')],'type':_0x41204e['type'][_0x4b57('0x3a')]};});_0x2752d8[_0x4b57('0x3b')]=_[_0x4b57('0x3c')](_0x1f30b2,_0x4b57('0x36'));_0x2752d8['query']=_[_0x4b57('0x3d')](_0x3c09be[_0x4b57('0x3e')]);_0x2752d8[_0x4b57('0x3f')]=_[_0x4b57('0x40')](_0x2752d8['model'],_0x2752d8['query']);_0x2c7972['attributes']=_[_0x4b57('0x40')](_0x2752d8[_0x4b57('0x3b')],qs[_0x4b57('0x41')](_0x3c09be[_0x4b57('0x3e')]['fields']));_0x2c7972[_0x4b57('0x42')]=_0x2c7972[_0x4b57('0x42')][_0x4b57('0x43')]?_0x2c7972[_0x4b57('0x42')]:_0x2752d8[_0x4b57('0x3b')];if(!_0x3c09be[_0x4b57('0x3e')][_0x4b57('0x44')](_0x4b57('0x45'))){_0x2c7972[_0x4b57('0x2f')]=qs['limit'](_0x3c09be[_0x4b57('0x3e')][_0x4b57('0x2f')]);_0x2c7972[_0x4b57('0x2e')]=qs['offset'](_0x3c09be[_0x4b57('0x3e')]['offset']);}_0x2c7972[_0x4b57('0x46')]=qs[_0x4b57('0x47')](_0x3c09be[_0x4b57('0x3e')][_0x4b57('0x47')]);_0x2c7972[_0x4b57('0x48')]=qs[_0x4b57('0x3f')](_[_0x4b57('0x49')](_0x3c09be[_0x4b57('0x3e')],_0x2752d8[_0x4b57('0x3f')]),_0x1f30b2);if(_0x3c09be[_0x4b57('0x3e')][_0x4b57('0x4a')]){_0x2c7972[_0x4b57('0x48')]=_[_0x4b57('0x4b')](_0x2c7972['where'],{'$or':_['map'](_0x1f30b2,function(_0x41258d){if(_0x41258d[_0x4b57('0x4c')]!==_0x4b57('0x4d')){var _0x3789c0={};_0x3789c0[_0x41258d['name']]={'$like':'%'+_0x3c09be[_0x4b57('0x3e')][_0x4b57('0x4a')]+'%'};return _0x3789c0;}})});}_0x2c7972=_['merge']({},_0x2c7972,_0x3c09be[_0x4b57('0x4e')]);var _0x53935e={'where':_0x2c7972[_0x4b57('0x48')]};return db['FaxMessage']['count'](_0x53935e)[_0x4b57('0x1f')](function(_0x42f798){_0x379dc5['count']=_0x42f798;if(_0x3c09be[_0x4b57('0x3e')][_0x4b57('0x4f')]){_0x2c7972[_0x4b57('0x50')]=[{'all':!![]}];}return db[_0x4b57('0x51')][_0x4b57('0x52')](_0x2c7972);})[_0x4b57('0x1f')](function(_0x5a3463){_0x379dc5[_0x4b57('0x53')]=_0x5a3463;return _0x379dc5;})[_0x4b57('0x1f')](respondWithFilteredResult(_0xc2d4f5,_0x2c7972))['catch'](handleError(_0xc2d4f5,null));};exports[_0x4b57('0x54')]=function(_0x23e852,_0x2efe50){var _0x55b7a7={'raw':!![],'where':{'id':_0x23e852['params']['id']}},_0x10fc0b={};_0x10fc0b[_0x4b57('0x3b')]=_[_0x4b57('0x3d')](db[_0x4b57('0x51')][_0x4b57('0x38')]);_0x10fc0b[_0x4b57('0x3e')]=_[_0x4b57('0x3d')](_0x23e852[_0x4b57('0x3e')]);_0x10fc0b[_0x4b57('0x3f')]=_['intersection'](_0x10fc0b[_0x4b57('0x3b')],_0x10fc0b[_0x4b57('0x3e')]);_0x55b7a7[_0x4b57('0x42')]=_['intersection'](_0x10fc0b[_0x4b57('0x3b')],qs[_0x4b57('0x41')](_0x23e852[_0x4b57('0x3e')]['fields']));_0x55b7a7[_0x4b57('0x42')]=_0x55b7a7[_0x4b57('0x42')][_0x4b57('0x43')]?_0x55b7a7[_0x4b57('0x42')]:_0x10fc0b[_0x4b57('0x3b')];if(_0x23e852[_0x4b57('0x3e')][_0x4b57('0x4f')]){_0x55b7a7['include']=[{'all':!![]}];}_0x55b7a7=_['merge']({},_0x55b7a7,_0x23e852[_0x4b57('0x4e')]);return db[_0x4b57('0x51')][_0x4b57('0x55')](_0x55b7a7)[_0x4b57('0x1f')](handleEntityNotFound(_0x2efe50,null))['then'](respondWithResult(_0x2efe50,null))[_0x4b57('0x29')](handleError(_0x2efe50,null));};exports[_0x4b57('0x33')]=function(_0x41529e,_0xee171b){if(_0x41529e['body']['id']){delete _0x41529e['body']['id'];}return db[_0x4b57('0x51')][_0x4b57('0x55')]({'where':{'id':_0x41529e['params']['id']}})['then'](handleEntityNotFound(_0xee171b,null))[_0x4b57('0x1f')](saveUpdates(_0x41529e['body'],null))[_0x4b57('0x1f')](respondWithResult(_0xee171b,null))[_0x4b57('0x29')](handleError(_0xee171b,null));};exports[_0x4b57('0x34')]=function(_0x2cd49a,_0x37d420){return db['FaxMessage']['find']({'where':{'id':_0x2cd49a['params']['id']}})['then'](handleEntityNotFound(_0x37d420,null))[_0x4b57('0x1f')](removeEntity(_0x37d420,null))[_0x4b57('0x29')](handleError(_0x37d420,null));};exports['describe']=function(_0x34aa23,_0x44ecb6){return db[_0x4b57('0x51')][_0x4b57('0x56')]()[_0x4b57('0x1f')](respondWithResult(_0x44ecb6,null))[_0x4b57('0x29')](handleError(_0x44ecb6,null));};var interaction_log=require(_0x4b57('0x12'))(_0x4b57('0x57'));exports[_0x4b57('0x58')]=function(_0x4be405,_0x18a9a1,_0x4d7f89){var _0x10bd32={'agent':{},'channel':_0x4b57('0x59')};if(_0x4be405['body']['id']){delete _0x4be405[_0x4b57('0x5a')]['id'];}_0x4be405[_0x4b57('0x5a')][_0x4b57('0x5b')]=!![];_0x4be405[_0x4b57('0x5a')][_0x4b57('0x5c')]=moment()[_0x4b57('0x5d')](_0x4b57('0x5e'));_0x4be405[_0x4b57('0x5a')][_0x4b57('0x5f')]=_0x4be405[_0x4b57('0x5a')][_0x4b57('0x5f')]||_0x4be405[_0x4b57('0x60')]['id'];_0x10bd32['agent']['id']=_0x4be405[_0x4b57('0x5a')][_0x4b57('0x5f')];return db['FaxMessage'][_0x4b57('0x55')]({'where':{'id':_0x4be405['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x4b57('0x1f')](handleEntityNotFound(_0x18a9a1,null))['then'](saveUpdates(_0x4be405[_0x4b57('0x5a')],null))[_0x4b57('0x1f')](function(_0x5e093a){if(_0x5e093a){_0x10bd32['message']=_0x5e093a[_0x4b57('0x61')]({'plain':!![]});return db[_0x4b57('0x62')][_0x4b57('0x55')]({'where':{'id':_0x5e093a['FaxInteractionId']}});}return null;})[_0x4b57('0x1f')](handleEntityNotFound(_0x18a9a1,null))[_0x4b57('0x1f')](function(_0x5f372d){if(_0x5f372d){return _0x5f372d[_0x4b57('0x33')]({'UserId':_0x4be405[_0x4b57('0x5a')]['UserId'],'read1stAt':_[_0x4b57('0x63')](_0x5f372d[_0x4b57('0x64')])?moment()[_0x4b57('0x5d')](_0x4b57('0x5e')):undefined});}return null;})[_0x4b57('0x1f')](function(_0x5d9dd5){if(_0x5d9dd5){_0x10bd32[_0x4b57('0x65')]=_0x5d9dd5['get']({'plain':!![]});interaction_log['info'](_0x4b57('0x66'),_0x4be405[_0x4b57('0x60')]['id'],_0x4be405['user']['name'],_0x4be405[_0x4b57('0x60')][_0x4b57('0x67')],_0x10bd32['interaction']['id'],_0x4be405['body']?JSON['stringify'](_0x4be405[_0x4b57('0x5a')]):_0x4b57('0x68'));return respondWithRpcPromise(_0x4b57('0x69'),'acceptMessage',_0x10bd32);}return null;})['then'](function(_0x50ccd4){if(_0x50ccd4){if(_0x4be405[_0x4b57('0x5a')]['manual']){_0x10bd32[_0x4b57('0x27')]['interface']=util[_0x4b57('0x5d')](_0x4b57('0x6a'),_0x4be405[_0x4b57('0x60')][_0x4b57('0x36')]);_0x10bd32['message'][_0x4b57('0x6b')]=_0x10bd32['channel'];_0x10bd32['message'][_0x4b57('0x6c')]=_0x4b57('0x58');return respondWithRpcPromise('EventManager',_0x4b57('0x6d'),{'event':_0x4b57('0x6e'),'message':_0x10bd32[_0x4b57('0x27')]},client9002)[_0x4b57('0x1f')](function(){return _0x10bd32;});}return _0x10bd32;}return null;})[_0x4b57('0x1f')](respondWithResult(_0x18a9a1,null))[_0x4b57('0x29')](handleError(_0x18a9a1,null));};var interaction_log=require('../../config/logger')(_0x4b57('0x57'));exports[_0x4b57('0x32')]=function(_0x3db213,_0xbc2990,_0x3007a6){var _0x55fc5d={'agent':{},'channel':_0x4b57('0x59')};if(_0x3db213[_0x4b57('0x5a')]['id']){delete _0x3db213[_0x4b57('0x5a')]['id'];}_0x3db213[_0x4b57('0x5a')]['UserId']=_0x3db213['body'][_0x4b57('0x5f')]||_0x3db213[_0x4b57('0x60')]['id'];_0x55fc5d[_0x4b57('0x6f')]['id']=_0x3db213['body'][_0x4b57('0x5f')];return db['FaxMessage'][_0x4b57('0x55')]({'where':{'id':_0x3db213[_0x4b57('0x70')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xbc2990,null))['then'](function(_0x3eb6d6){if(_0x3eb6d6){_0x55fc5d['message']=_0x3eb6d6[_0x4b57('0x61')]({'plain':!![]});return db[_0x4b57('0x62')][_0x4b57('0x55')]({'where':{'id':_0x3eb6d6[_0x4b57('0x71')]}});}return null;})[_0x4b57('0x1f')](handleEntityNotFound(_0xbc2990,null))['then'](function(_0x137532){if(_0x137532){_0x55fc5d[_0x4b57('0x65')]=_0x137532[_0x4b57('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3db213[_0x4b57('0x60')]['id'],_0x3db213[_0x4b57('0x60')]['name'],_0x3db213[_0x4b57('0x60')][_0x4b57('0x67')],_0x55fc5d['interaction']['id'],_0x3db213[_0x4b57('0x5a')]?JSON[_0x4b57('0x24')](_0x3db213['body']):_0x4b57('0x68'));return respondWithRpcPromise(_0x4b57('0x72'),_0x4b57('0x73'),_0x55fc5d);}return null;})['then'](function(_0x34d5c2){if(_0x34d5c2){_0x34d5c2[_0x4b57('0x27')][_0x4b57('0x74')]=util[_0x4b57('0x5d')](_0x4b57('0x6a'),_0x3db213[_0x4b57('0x60')][_0x4b57('0x36')]);_0x34d5c2['message'][_0x4b57('0x6b')]=_0x55fc5d[_0x4b57('0x6b')];_0x34d5c2['message'][_0x4b57('0x6c')]=_0x4b57('0x32');respondWithRpcPromise('EventManager',_0x4b57('0x6d'),{'event':_0x4b57('0x75'),'message':_0x34d5c2[_0x4b57('0x27')]},client9002);return _0x55fc5d;}return null;})[_0x4b57('0x1f')](respondWithResult(_0xbc2990,null))[_0x4b57('0x29')](handleError(_0xbc2990,null));};exports[_0x4b57('0x76')]=function(_0x1688dc,_0x226bf1){var _0xe62144;return db[_0x4b57('0x51')][_0x4b57('0x76')](_0x1688dc[_0x4b57('0x5a')],{})[_0x4b57('0x1f')](function(_0x11f513){_0xe62144=_0x11f513;return db[_0x4b57('0x77')][_0x4b57('0x78')]({'where':{'id':_0xe62144[_0x4b57('0x79')]}});})[_0x4b57('0x1f')](function(_0x40d259){if(_[_0x4b57('0x63')](_0x40d259)){return;}else{_0xe62144[_0x4b57('0x59')]=_0x40d259[_0x4b57('0x59')];return db[_0x4b57('0x7a')][_0x4b57('0x78')]({'where':{'id':_0xe62144[_0x4b57('0x7b')]}});}})['then'](function(_0x4cfed4){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x4b57('0x63')](_0x1688dc[_0x4b57('0x5a')])?undefined:_0x1688dc['body'][_0x4b57('0x7c')],'path':_[_0x4b57('0x63')](_0x4cfed4)?undefined:util['format'](_0x4b57('0x7d'),_0x4cfed4[_0x4b57('0x7e')]),'fax':_['isNil'](_0xe62144['fax'])?undefined:_0xe62144[_0x4b57('0x59')],'AttachmentId':_0xe62144[_0x4b57('0x7b')]},client9002);})[_0x4b57('0x1f')](respondWithResult(_0x226bf1,0xc9))[_0x4b57('0x29')](handleError(_0x226bf1,null));};exports[_0x4b57('0x7f')]=function(_0x1f4e6c,_0x1d518b){var _0x5412a1=path['join'](config[_0x4b57('0x80')],_0x4b57('0x81'),_0x4b57('0x82'),_0x4b57('0x83'));return db[_0x4b57('0x51')][_0x4b57('0x55')]({'where':{'id':_0x1f4e6c[_0x4b57('0x70')]['id']},'include':[{'model':db[_0x4b57('0x7a')],'as':_0x4b57('0x7a')}]})['then'](handleEntityNotFound(_0x1d518b,null))[_0x4b57('0x1f')](function(_0x1bda33){if(_0x1bda33){return _0x1d518b[_0x4b57('0x7f')](path[_0x4b57('0x84')](_0x5412a1,_0x1bda33['Attachment']['basename']));}})[_0x4b57('0x29')](handleError(_0x1d518b,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index a0548c5..78b84aa 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 _0x3e74=['hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x35634f,_0x3d15d9){_0x35634f=_0x35634f-0x0;var _0x5a4a07=_0x3e74[_0x35634f];return _0x5a4a07;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x43e7('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){FaxMessageEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);FaxMessageEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x55ca,0x126));var _0xa55c=function(_0x4a2cc2,_0x1fbafa){_0x4a2cc2=_0x4a2cc2-0x0;var _0x3f5f5c=_0x55ca[_0x4a2cc2];return _0x3f5f5c;};'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 b9b8d29..f91a887 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 _0x71ed=['UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x71ed,0x132));var _0xd71e=function(_0x118dfd,_0x31cb8f){_0x118dfd=_0x118dfd-0x0;var _0x473376=_0x71ed[_0x118dfd];return _0x473376;};'use strict';var _=require('lodash');var util=require(_0xd71e('0x0'));var logger=require(_0xd71e('0x1'))(_0xd71e('0x2'));var moment=require(_0xd71e('0x3'));var BPromise=require(_0xd71e('0x4'));var rp=require(_0xd71e('0x5'));var fs=require('fs');var path=require(_0xd71e('0x6'));var rimraf=require(_0xd71e('0x7'));var config=require(_0xd71e('0x8'));var attributes=require(_0xd71e('0x9'));module[_0xd71e('0xa')]=function(_0x294a03,_0x4eec0a){return _0x294a03[_0xd71e('0xb')](_0xd71e('0xc'),attributes,{'tableName':_0xd71e('0xd'),'paranoid':![],'indexes':[{'name':_0xd71e('0xe'),'fields':[_0xd71e('0xf')],'type':_0xd71e('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x80da52,_0x3ddef8,_0x2b2a19){var _0xffb58f=_0x294a03[_0xd71e('0x11')];var _0x4fc05a=_0x80da52[_0xd71e('0x12')]({'plain':!![]});if(_0x4fc05a[_0xd71e('0x13')][_0xd71e('0x14')]()==='in'||_0x4fc05a['direction'][_0xd71e('0x14')]()===_0xd71e('0x15')&&!_0x4fc05a[_0xd71e('0x16')]&&!_[_0xd71e('0x17')](_0x4fc05a[_0xd71e('0x18')])){_0xffb58f[_0xd71e('0x19')][_0xd71e('0x1a')]({'where':{'id':_0x4fc05a[_0xd71e('0x1b')]}})['then'](function(_0x3aab3f){if(_0x3aab3f){_0x3aab3f[_0xd71e('0x1c')]({'lastMsgAt':_0x4fc05a[_0xd71e('0x1d')],'lastMsgDirection':_0x4fc05a[_0xd71e('0x13')][_0xd71e('0x14')]()});}})[_0xd71e('0x1e')](function(_0xecc947){console[_0xd71e('0x1f')](_0xecc947);});}_0x2b2a19();}},'charset':'utf8mb4','collate':_0xd71e('0x20')});}; \ No newline at end of file +var _0xb966=['then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb966,0xa7));var _0x6b96=function(_0x449ea9,_0x30a02f){_0x449ea9=_0x449ea9-0x0;var _0x405c5d=_0xb966[_0x449ea9];return _0x405c5d;};'use strict';var _=require(_0x6b96('0x0'));var util=require(_0x6b96('0x1'));var logger=require(_0x6b96('0x2'))(_0x6b96('0x3'));var moment=require(_0x6b96('0x4'));var BPromise=require(_0x6b96('0x5'));var rp=require(_0x6b96('0x6'));var fs=require('fs');var path=require(_0x6b96('0x7'));var rimraf=require(_0x6b96('0x8'));var config=require(_0x6b96('0x9'));var attributes=require(_0x6b96('0xa'));module['exports']=function(_0x245a9c,_0xde3109){return _0x245a9c[_0x6b96('0xb')](_0x6b96('0xc'),attributes,{'tableName':_0x6b96('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x6b96('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14be66,_0x40becb,_0x322a86){var _0x46f904=_0x245a9c[_0x6b96('0xf')];var _0x249336=_0x14be66['get']({'plain':!![]});if(_0x249336[_0x6b96('0x10')][_0x6b96('0x11')]()==='in'||_0x249336[_0x6b96('0x10')]['toLowerCase']()===_0x6b96('0x12')&&!_0x249336[_0x6b96('0x13')]&&!_[_0x6b96('0x14')](_0x249336[_0x6b96('0x15')])){_0x46f904[_0x6b96('0x16')][_0x6b96('0x17')]({'where':{'id':_0x249336[_0x6b96('0x18')]}})[_0x6b96('0x19')](function(_0xfdb54a){if(_0xfdb54a){_0xfdb54a[_0x6b96('0x1a')]({'lastMsgAt':_0x249336[_0x6b96('0x1b')],'lastMsgDirection':_0x249336['direction']['toLowerCase']()});}})[_0x6b96('0x1c')](function(_0x428140){console[_0x6b96('0x1d')](_0x428140);});}_0x322a86();}},'charset':_0x6b96('0x1e'),'collate':_0x6b96('0x1f')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 75cee50..2cf96da 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 _0x51f3=['error','code','message','info','CreateFaxMessage','FaxMessage','create','body','options','raw','update','where','attributes','limit','UpdateFaxMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x228c43,_0x1a81d3){var _0x53e5b7=function(_0x246c8c){while(--_0x246c8c){_0x228c43['push'](_0x228c43['shift']());}};_0x53e5b7(++_0x1a81d3);}(_0x51f3,0x121));var _0x351f=function(_0x1d91b7,_0x6115d7){_0x1d91b7=_0x1d91b7-0x0;var _0x2b9c36=_0x51f3[_0x1d91b7];return _0x2b9c36;};'use strict';var _=require(_0x351f('0x0'));var util=require(_0x351f('0x1'));var moment=require(_0x351f('0x2'));var BPromise=require(_0x351f('0x3'));var rs=require(_0x351f('0x4'));var fs=require('fs');var Redis=require(_0x351f('0x5'));var db=require(_0x351f('0x6'))['db'];var utils=require(_0x351f('0x7'));var logger=require('../../config/logger')(_0x351f('0x8'));var config=require('../../config/environment');var jayson=require(_0x351f('0x9'));var client=jayson[_0x351f('0xa')][_0x351f('0xb')]({'port':0x232a});config[_0x351f('0xc')]=_['defaults'](config[_0x351f('0xc')],{'host':_0x351f('0xd'),'port':0x18eb});var socket=require(_0x351f('0xe'))(new Redis(config[_0x351f('0xc')]));require('./faxMessage.socket')[_0x351f('0xf')](socket);function respondWithRpcPromise(_0x34f2c1,_0x42c8b8,_0x4a6ed0){return new BPromise(function(_0x29e9e0,_0x51a492){return client[_0x351f('0x10')](_0x34f2c1,_0x4a6ed0)[_0x351f('0x11')](function(_0x1fd5f0){logger['info'](_0x351f('0x12'),_0x42c8b8,_0x351f('0x13'));logger[_0x351f('0x14')](_0x351f('0x15'),_0x42c8b8,_0x351f('0x13'),JSON[_0x351f('0x16')](_0x1fd5f0));if(_0x1fd5f0[_0x351f('0x17')]){if(_0x1fd5f0[_0x351f('0x17')][_0x351f('0x18')]===0x1f4){logger[_0x351f('0x17')](_0x351f('0x12'),_0x42c8b8,_0x1fd5f0[_0x351f('0x17')][_0x351f('0x19')]);return _0x51a492(_0x1fd5f0['error']['message']);}logger[_0x351f('0x17')](_0x351f('0x12'),_0x42c8b8,_0x1fd5f0[_0x351f('0x17')][_0x351f('0x19')]);return _0x29e9e0(_0x1fd5f0[_0x351f('0x17')][_0x351f('0x19')]);}else{logger[_0x351f('0x1a')](_0x351f('0x12'),_0x42c8b8,_0x351f('0x13'));_0x29e9e0(_0x1fd5f0['result'][_0x351f('0x19')]);}})['catch'](function(_0x19c08b){logger['error'](_0x351f('0x12'),_0x42c8b8,_0x19c08b);_0x51a492(_0x19c08b);});});}exports[_0x351f('0x1b')]=function(_0x3b8fcf){var _0x351cfd=this;return new Promise(function(_0x5f1fe1,_0x374c4f){return db[_0x351f('0x1c')][_0x351f('0x1d')](_0x3b8fcf[_0x351f('0x1e')],{'raw':_0x3b8fcf[_0x351f('0x1f')]?_0x3b8fcf[_0x351f('0x1f')][_0x351f('0x20')]===undefined?!![]:![]:!![]})[_0x351f('0x11')](function(_0x5e4250){logger['info'](_0x351f('0x1b'),_0x3b8fcf);logger[_0x351f('0x14')](_0x351f('0x1b'),_0x3b8fcf,JSON[_0x351f('0x16')](_0x5e4250));_0x5f1fe1(_0x5e4250);})['catch'](function(_0x2bf705){logger[_0x351f('0x17')](_0x351f('0x1b'),_0x2bf705[_0x351f('0x19')],_0x3b8fcf);_0x374c4f(_0x351cfd[_0x351f('0x17')](0x1f4,_0x2bf705['message']));});});};exports['UpdateFaxMessage']=function(_0x355da7){var _0x441e2e=this;return new Promise(function(_0x4fcf3e,_0x2beaad){return db['FaxMessage'][_0x351f('0x21')](_0x355da7[_0x351f('0x1e')],{'raw':_0x355da7[_0x351f('0x1f')]?_0x355da7[_0x351f('0x1f')][_0x351f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x355da7[_0x351f('0x1f')]?_0x355da7[_0x351f('0x1f')][_0x351f('0x22')]||null:null,'attributes':_0x355da7[_0x351f('0x1f')]?_0x355da7[_0x351f('0x1f')][_0x351f('0x23')]||null:null,'limit':_0x355da7[_0x351f('0x1f')]?_0x355da7[_0x351f('0x1f')][_0x351f('0x24')]||null:null})['then'](function(_0x679b0d){logger[_0x351f('0x1a')](_0x351f('0x25'),_0x355da7);logger[_0x351f('0x14')](_0x351f('0x25'),_0x355da7,JSON[_0x351f('0x16')](_0x679b0d));_0x4fcf3e(_0x679b0d);})[_0x351f('0x26')](function(_0x7e1a6){logger[_0x351f('0x17')](_0x351f('0x25'),_0x7e1a6['message'],_0x355da7);_0x2beaad(_0x441e2e[_0x351f('0x17')](0x1f4,_0x7e1a6[_0x351f('0x19')]));});});}; \ No newline at end of file +var _0x1190=['where','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','stringify','UpdateFaxMessage'];(function(_0x5b2f91,_0xcfff82){var _0x4df530=function(_0x20fbf4){while(--_0x20fbf4){_0x5b2f91['push'](_0x5b2f91['shift']());}};_0x4df530(++_0xcfff82);}(_0x1190,0x16a));var _0x0119=function(_0x2abff5,_0x1c5a97){_0x2abff5=_0x2abff5-0x0;var _0x72b404=_0x1190[_0x2abff5];return _0x72b404;};'use strict';var _=require('lodash');var util=require(_0x0119('0x0'));var moment=require('moment');var BPromise=require(_0x0119('0x1'));var rs=require(_0x0119('0x2'));var fs=require('fs');var Redis=require(_0x0119('0x3'));var db=require(_0x0119('0x4'))['db'];var utils=require(_0x0119('0x5'));var logger=require(_0x0119('0x6'))(_0x0119('0x7'));var config=require(_0x0119('0x8'));var jayson=require(_0x0119('0x9'));var client=jayson[_0x0119('0xa')][_0x0119('0xb')]({'port':0x232a});config[_0x0119('0xc')]=_[_0x0119('0xd')](config[_0x0119('0xc')],{'host':_0x0119('0xe'),'port':0x18eb});var socket=require(_0x0119('0xf'))(new Redis(config[_0x0119('0xc')]));require(_0x0119('0x10'))[_0x0119('0x11')](socket);function respondWithRpcPromise(_0x5b4cea,_0x15730a,_0x154aa3){return new BPromise(function(_0x177aae,_0x54054d){return client[_0x0119('0x12')](_0x5b4cea,_0x154aa3)[_0x0119('0x13')](function(_0x318d2d){logger['info'](_0x0119('0x14'),_0x15730a,'request\x20sent');logger[_0x0119('0x15')](_0x0119('0x16'),_0x15730a,_0x0119('0x17'),JSON['stringify'](_0x318d2d));if(_0x318d2d['error']){if(_0x318d2d[_0x0119('0x18')][_0x0119('0x19')]===0x1f4){logger[_0x0119('0x18')](_0x0119('0x14'),_0x15730a,_0x318d2d[_0x0119('0x18')][_0x0119('0x1a')]);return _0x54054d(_0x318d2d[_0x0119('0x18')][_0x0119('0x1a')]);}logger[_0x0119('0x18')](_0x0119('0x14'),_0x15730a,_0x318d2d['error']['message']);return _0x177aae(_0x318d2d['error']['message']);}else{logger[_0x0119('0x1b')](_0x0119('0x14'),_0x15730a,_0x0119('0x17'));_0x177aae(_0x318d2d[_0x0119('0x1c')][_0x0119('0x1a')]);}})[_0x0119('0x1d')](function(_0x15e549){logger[_0x0119('0x18')](_0x0119('0x14'),_0x15730a,_0x15e549);_0x54054d(_0x15e549);});});}exports[_0x0119('0x1e')]=function(_0x49a08e){var _0x1da1a4=this;return new Promise(function(_0x2e2014,_0x514b90){return db[_0x0119('0x1f')][_0x0119('0x20')](_0x49a08e[_0x0119('0x21')],{'raw':_0x49a08e[_0x0119('0x22')]?_0x49a08e[_0x0119('0x22')][_0x0119('0x23')]===undefined?!![]:![]:!![]})[_0x0119('0x13')](function(_0x1efcbc){logger[_0x0119('0x1b')](_0x0119('0x1e'),_0x49a08e);logger[_0x0119('0x15')](_0x0119('0x1e'),_0x49a08e,JSON[_0x0119('0x24')](_0x1efcbc));_0x2e2014(_0x1efcbc);})[_0x0119('0x1d')](function(_0x1d8e88){logger[_0x0119('0x18')](_0x0119('0x1e'),_0x1d8e88[_0x0119('0x1a')],_0x49a08e);_0x514b90(_0x1da1a4[_0x0119('0x18')](0x1f4,_0x1d8e88[_0x0119('0x1a')]));});});};exports[_0x0119('0x25')]=function(_0x2eb0e3){var _0x11db28=this;return new Promise(function(_0x1adef7,_0x5cbd78){return db[_0x0119('0x1f')]['update'](_0x2eb0e3[_0x0119('0x21')],{'raw':_0x2eb0e3[_0x0119('0x22')]?_0x2eb0e3[_0x0119('0x22')][_0x0119('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eb0e3[_0x0119('0x22')]?_0x2eb0e3['options'][_0x0119('0x26')]||null:null,'attributes':_0x2eb0e3[_0x0119('0x22')]?_0x2eb0e3[_0x0119('0x22')]['attributes']||null:null,'limit':_0x2eb0e3[_0x0119('0x22')]?_0x2eb0e3[_0x0119('0x22')][_0x0119('0x27')]||null:null})['then'](function(_0x444ad6){logger[_0x0119('0x1b')]('UpdateFaxMessage',_0x2eb0e3);logger['debug'](_0x0119('0x25'),_0x2eb0e3,JSON[_0x0119('0x24')](_0x444ad6));_0x1adef7(_0x444ad6);})[_0x0119('0x1d')](function(_0x14653c){logger[_0x0119('0x18')](_0x0119('0x25'),_0x14653c[_0x0119('0x1a')],_0x2eb0e3);_0x5cbd78(_0x11db28[_0x0119('0x18')](0x1f4,_0x14653c[_0x0119('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c3cda3e..3c1d045 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 _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 03c01e6..fd214a4 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 _0x87b1=['isAuthenticated','index','/describe','/:id','get','/:id/download','post','tracked','faxmessage:create','create','put','update','accept','reject','delete','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x87b1,0x160));var _0x187b=function(_0xa7783d,_0x425286){_0xa7783d=_0xa7783d-0x0;var _0x5df8fd=_0x87b1[_0xa7783d];return _0x5df8fd;};'use strict';var multer=require(_0x187b('0x0'));var util=require('util');var path=require(_0x187b('0x1'));var timeout=require(_0x187b('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x187b('0x3'));var config=require(_0x187b('0x4'));var controller=require('./faxMessage.controller');router['get']('/',auth[_0x187b('0x5')](),controller[_0x187b('0x6')]);router['get'](_0x187b('0x7'),auth[_0x187b('0x5')](),controller['describe']);router['get'](_0x187b('0x8'),auth[_0x187b('0x5')](),controller['show']);router[_0x187b('0x9')](_0x187b('0xa'),auth[_0x187b('0x5')](),controller['download']);router[_0x187b('0xb')]('/',auth[_0x187b('0x5')](),interaction[_0x187b('0xc')]('fax',_0x187b('0xd')),controller[_0x187b('0xe')]);router[_0x187b('0xf')](_0x187b('0x8'),auth[_0x187b('0x5')](),controller[_0x187b('0x10')]);router[_0x187b('0xf')]('/:id/accept',auth[_0x187b('0x5')](),controller[_0x187b('0x11')]);router['put']('/:id/reject',auth[_0x187b('0x5')](),controller[_0x187b('0x12')]);router[_0x187b('0x13')]('/:id',auth[_0x187b('0x5')](),controller['destroy']);module[_0x187b('0x14')]=router; \ No newline at end of file +var _0x0f6c=['../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','post','tracked','faxmessage:create','put','/:id/accept','accept','/:id/reject','reject','delete','/:id','exports','util','path','connect-timeout','express','Router'];(function(_0x367532,_0x24dd35){var _0x132bb5=function(_0x4ab98a){while(--_0x4ab98a){_0x367532['push'](_0x367532['shift']());}};_0x132bb5(++_0x24dd35);}(_0x0f6c,0x1bd));var _0xc0f6=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0f6c[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0xc0f6('0x0'));var path=require(_0xc0f6('0x1'));var timeout=require(_0xc0f6('0x2'));var express=require(_0xc0f6('0x3'));var router=express[_0xc0f6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc0f6('0x5'));var config=require('../../config/environment');var controller=require(_0xc0f6('0x6'));router[_0xc0f6('0x7')]('/',auth[_0xc0f6('0x8')](),controller[_0xc0f6('0x9')]);router['get'](_0xc0f6('0xa'),auth[_0xc0f6('0x8')](),controller[_0xc0f6('0xb')]);router[_0xc0f6('0x7')]('/:id',auth[_0xc0f6('0x8')](),controller[_0xc0f6('0xc')]);router[_0xc0f6('0x7')](_0xc0f6('0xd'),auth[_0xc0f6('0x8')](),controller['download']);router[_0xc0f6('0xe')]('/',auth[_0xc0f6('0x8')](),interaction[_0xc0f6('0xf')]('fax',_0xc0f6('0x10')),controller['create']);router[_0xc0f6('0x11')]('/:id',auth[_0xc0f6('0x8')](),controller['update']);router[_0xc0f6('0x11')](_0xc0f6('0x12'),auth[_0xc0f6('0x8')](),controller[_0xc0f6('0x13')]);router[_0xc0f6('0x11')](_0xc0f6('0x14'),auth[_0xc0f6('0x8')](),controller[_0xc0f6('0x15')]);router[_0xc0f6('0x16')](_0xc0f6('0x17'),auth[_0xc0f6('0x8')](),controller['destroy']);module[_0xc0f6('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index fe5ae80..18f2aa7 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 _0x7cca=['exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4adffe,_0x16819c){var _0x130746=function(_0x5ceba3){while(--_0x5ceba3){_0x4adffe['push'](_0x4adffe['shift']());}};_0x130746(++_0x16819c);}(_0x7cca,0xff));var _0xa7cc=function(_0x36a3b9,_0x299b8e){_0x36a3b9=_0x36a3b9-0x0;var _0x49b6a9=_0x7cca[_0x36a3b9];return _0x49b6a9;};'use strict';var Sequelize=require(_0xa7cc('0x0'));module[_0xa7cc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa7cc('0x2')]},'timeout':{'type':Sequelize[_0xa7cc('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa7cc('0x4')](_0xa7cc('0x5'),_0xa7cc('0x6'),_0xa7cc('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa7cc('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc9d9=['exports','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xc9d9,0x141));var _0x9c9d=function(_0x19ebef,_0x5b0535){_0x19ebef=_0x19ebef-0x0;var _0xa7cdbb=_0xc9d9[_0x19ebef];return _0xa7cdbb;};'use strict';var Sequelize=require(_0x9c9d('0x0'));module[_0x9c9d('0x1')]={'name':{'type':Sequelize[_0x9c9d('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9c9d('0x2')]},'timeout':{'type':Sequelize[_0x9c9d('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9c9d('0x4')]('rrmemory',_0x9c9d('0x5'),_0x9c9d('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9c9d('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index e3a1a1b..30962d0 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 _0xd41f=['apply','reject','save','update','then','destroy','FaxQueues','stack','name','index','FaxQueue','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','api','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','register','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x1ebea6,_0x3db7a9){var _0xeb2f99=function(_0x166a56){while(--_0x166a56){_0x1ebea6['push'](_0x1ebea6['shift']());}};_0xeb2f99(++_0x3db7a9);}(_0xd41f,0xf1));var _0xfd41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd41f[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfd41('0x0'));var rimraf=require(_0xfd41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd41('0x2'));var rp=require(_0xfd41('0x3'));var moment=require(_0xfd41('0x4'));var BPromise=require(_0xfd41('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfd41('0x6'));var csv=require('to-csv');var ejs=require(_0xfd41('0x7'));var fs=require('fs');var _=require(_0xfd41('0x8'));var squel=require(_0xfd41('0x9'));var crypto=require(_0xfd41('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfd41('0xb'));var toCsv=require(_0xfd41('0xc'));var querystring=require(_0xfd41('0xd'));var Papa=require('papaparse');var Redis=require(_0xfd41('0xe'));var authService=require(_0xfd41('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfd41('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfd41('0x11'));var db=require(_0xfd41('0x12'))['db'];config['redis']=_[_0xfd41('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfd41('0x14'))(new Redis(config[_0xfd41('0x15')]));require('./faxQueue.socket')[_0xfd41('0x16')](socket);function respondWithStatusCode(_0x1b8dec,_0x9cfbe7){_0x9cfbe7=_0x9cfbe7||0xcc;return function(_0x37c0cd){if(_0x37c0cd){return _0x1b8dec[_0xfd41('0x17')](_0x9cfbe7);}return _0x1b8dec[_0xfd41('0x18')](_0x9cfbe7)[_0xfd41('0x19')]();};}function respondWithResult(_0x4034bf,_0x17a904){_0x17a904=_0x17a904||0xc8;return function(_0x18a783){if(_0x18a783){return _0x4034bf['status'](_0x17a904)[_0xfd41('0x1a')](_0x18a783);}};}function respondWithFilteredResult(_0x3b83a,_0x587316){return function(_0x471da4){if(_0x471da4){var _0x27c002=_0x471da4[_0xfd41('0x1b')],_0x1befad=_0x587316[_0xfd41('0x1c')],_0x47f413=_0x587316[_0xfd41('0x1c')]+_0x587316[_0xfd41('0x1d')],_0x37b630;if(_0x47f413>=_0x27c002){_0x47f413=_0x27c002;_0x37b630=0xc8;}else{_0x37b630=0xce;}_0x3b83a[_0xfd41('0x18')](_0x37b630);return _0x3b83a[_0xfd41('0x1e')]('Content-Range',_0x1befad+'-'+_0x47f413+'/'+_0x27c002)[_0xfd41('0x1a')](_0x471da4);}return null;};}function patchUpdates(_0x51cb26){return function(_0x1683ca){try{jsonpatch[_0xfd41('0x1f')](_0x1683ca,_0x51cb26,!![]);}catch(_0x5e7ee9){return BPromise[_0xfd41('0x20')](_0x5e7ee9);}return _0x1683ca[_0xfd41('0x21')]();};}function saveUpdates(_0x18cd33,_0x595728){return function(_0x1fae45){if(_0x1fae45){return _0x1fae45[_0xfd41('0x22')](_0x18cd33)[_0xfd41('0x23')](function(_0x10330b){return _0x10330b;});}return null;};}function removeEntity(_0x34c078,_0x4739c0){return function(_0x2ea394){if(_0x2ea394){return _0x2ea394[_0xfd41('0x24')]()[_0xfd41('0x23')](function(){var _0x35fa3e=_0x2ea394['get']({'plain':!![]});var _0x4d3df3=_0xfd41('0x25');return db['UserProfileResource'][_0xfd41('0x24')]({'where':{'type':_0x4d3df3,'resourceId':_0x35fa3e['id']}})[_0xfd41('0x23')](function(){return _0x2ea394;});})['then'](function(){_0x34c078['status'](0xcc)[_0xfd41('0x19')]();});}};}function handleEntityNotFound(_0x1a1957,_0x4788e7){return function(_0x4dfaaf){if(!_0x4dfaaf){_0x1a1957[_0xfd41('0x17')](0x194);}return _0x4dfaaf;};}function handleError(_0x59c5e3,_0x4d2186){_0x4d2186=_0x4d2186||0x1f4;return function(_0x35ba3c){logger['error'](_0x35ba3c[_0xfd41('0x26')]);if(_0x35ba3c['name']){delete _0x35ba3c[_0xfd41('0x27')];}_0x59c5e3[_0xfd41('0x18')](_0x4d2186)['send'](_0x35ba3c);};}exports[_0xfd41('0x28')]=function(_0xd5c06c,_0x3c338b){var _0x9c78e5={},_0x5a5226={},_0xc8054c={'count':0x0,'rows':[]};var _0x3be7d6=_['map'](db[_0xfd41('0x29')][_0xfd41('0x2a')],function(_0x39f760){return{'name':_0x39f760[_0xfd41('0x2b')],'type':_0x39f760[_0xfd41('0x2c')]['key']};});_0x5a5226[_0xfd41('0x2d')]=_[_0xfd41('0x2e')](_0x3be7d6,'name');_0x5a5226[_0xfd41('0x2f')]=_['keys'](_0xd5c06c[_0xfd41('0x2f')]);_0x5a5226[_0xfd41('0x30')]=_[_0xfd41('0x31')](_0x5a5226['model'],_0x5a5226[_0xfd41('0x2f')]);_0x9c78e5[_0xfd41('0x32')]=_[_0xfd41('0x31')](_0x5a5226[_0xfd41('0x2d')],qs[_0xfd41('0x33')](_0xd5c06c[_0xfd41('0x2f')]['fields']));_0x9c78e5[_0xfd41('0x32')]=_0x9c78e5[_0xfd41('0x32')][_0xfd41('0x34')]?_0x9c78e5[_0xfd41('0x32')]:_0x5a5226[_0xfd41('0x2d')];if(!_0xd5c06c[_0xfd41('0x2f')][_0xfd41('0x35')]('nolimit')){_0x9c78e5['limit']=qs['limit'](_0xd5c06c[_0xfd41('0x2f')][_0xfd41('0x1d')]);_0x9c78e5['offset']=qs[_0xfd41('0x1c')](_0xd5c06c[_0xfd41('0x2f')][_0xfd41('0x1c')]);}_0x9c78e5[_0xfd41('0x36')]=qs[_0xfd41('0x37')](_0xd5c06c[_0xfd41('0x2f')][_0xfd41('0x37')]);_0x9c78e5[_0xfd41('0x38')]=qs['filters'](_[_0xfd41('0x39')](_0xd5c06c[_0xfd41('0x2f')],_0x5a5226[_0xfd41('0x30')]),_0x3be7d6);if(_0xd5c06c[_0xfd41('0x2f')][_0xfd41('0x3a')]){_0x9c78e5[_0xfd41('0x38')]=_[_0xfd41('0x3b')](_0x9c78e5['where'],{'$or':_[_0xfd41('0x2e')](_0x3be7d6,function(_0x25926d){if(_0x25926d[_0xfd41('0x2c')]!==_0xfd41('0x3c')){var _0x2f25e7={};_0x2f25e7[_0x25926d[_0xfd41('0x27')]]={'$like':'%'+_0xd5c06c[_0xfd41('0x2f')][_0xfd41('0x3a')]+'%'};return _0x2f25e7;}})});}_0x9c78e5=_[_0xfd41('0x3b')]({},_0x9c78e5,_0xd5c06c[_0xfd41('0x3d')]);var _0x1fe5c4={'where':_0x9c78e5[_0xfd41('0x38')]};return db['FaxQueue'][_0xfd41('0x1b')](_0x1fe5c4)['then'](function(_0x14dbba){_0xc8054c[_0xfd41('0x1b')]=_0x14dbba;if(_0xd5c06c[_0xfd41('0x2f')]['includeAll']){_0x9c78e5[_0xfd41('0x3e')]=[{'all':!![]}];}return db[_0xfd41('0x29')][_0xfd41('0x3f')](_0x9c78e5);})['then'](function(_0x501219){_0xc8054c[_0xfd41('0x40')]=_0x501219;return _0xc8054c;})[_0xfd41('0x23')](respondWithFilteredResult(_0x3c338b,_0x9c78e5))['catch'](handleError(_0x3c338b,null));};exports[_0xfd41('0x41')]=function(_0x1f6a2a,_0x15ef38){var _0x3ed971={'raw':!![],'where':{'id':_0x1f6a2a[_0xfd41('0x42')]['id']}},_0x255df5={};_0x255df5[_0xfd41('0x2d')]=_[_0xfd41('0x43')](db[_0xfd41('0x29')][_0xfd41('0x2a')]);_0x255df5[_0xfd41('0x2f')]=_['keys'](_0x1f6a2a[_0xfd41('0x2f')]);_0x255df5[_0xfd41('0x30')]=_[_0xfd41('0x31')](_0x255df5[_0xfd41('0x2d')],_0x255df5[_0xfd41('0x2f')]);_0x3ed971[_0xfd41('0x32')]=_[_0xfd41('0x31')](_0x255df5['model'],qs[_0xfd41('0x33')](_0x1f6a2a[_0xfd41('0x2f')][_0xfd41('0x33')]));_0x3ed971[_0xfd41('0x32')]=_0x3ed971[_0xfd41('0x32')][_0xfd41('0x34')]?_0x3ed971['attributes']:_0x255df5[_0xfd41('0x2d')];if(_0x1f6a2a[_0xfd41('0x2f')][_0xfd41('0x44')]){_0x3ed971['include']=[{'all':!![]}];}_0x3ed971=_[_0xfd41('0x3b')]({},_0x3ed971,_0x1f6a2a[_0xfd41('0x3d')]);return db['FaxQueue'][_0xfd41('0x45')](_0x3ed971)['then'](handleEntityNotFound(_0x15ef38,null))[_0xfd41('0x23')](respondWithResult(_0x15ef38,null))['catch'](handleError(_0x15ef38,null));};exports[_0xfd41('0x46')]=function(_0x15e8fa,_0x2570ed){return db['FaxQueue'][_0xfd41('0x46')](_0x15e8fa[_0xfd41('0x47')],{})[_0xfd41('0x23')](function(_0x4c40da){var _0x228c74=_0x15e8fa[_0xfd41('0x48')][_0xfd41('0x49')]({'plain':!![]});if(!_0x228c74)throw new Error(_0xfd41('0x4a'));if(_0x228c74[_0xfd41('0x4b')]==='user'){var _0xb34b35=_0x4c40da[_0xfd41('0x49')]({'plain':!![]});var _0xaba10e=_0xfd41('0x25');return db['UserProfileSection']['find']({'where':{'name':_0xaba10e,'userProfileId':_0x228c74['userProfileId']},'raw':!![]})[_0xfd41('0x23')](function(_0x3008ae){if(_0x3008ae&&_0x3008ae[_0xfd41('0x4c')]===0x0){return db[_0xfd41('0x4d')][_0xfd41('0x46')]({'name':_0xb34b35[_0xfd41('0x27')],'resourceId':_0xb34b35['id'],'type':_0x3008ae[_0xfd41('0x27')],'sectionId':_0x3008ae['id']},{})[_0xfd41('0x23')](function(){return _0x4c40da;});}else{return _0x4c40da;}})[_0xfd41('0x4e')](function(_0x5baf8a){logger[_0xfd41('0x4f')](_0xfd41('0x50'),_0x5baf8a);throw _0x5baf8a;});}return _0x4c40da;})[_0xfd41('0x23')](respondWithResult(_0x2570ed,0xc9))['catch'](handleError(_0x2570ed,null));};exports['update']=function(_0x585550,_0x3c6b01){if(_0x585550[_0xfd41('0x47')]['id']){delete _0x585550[_0xfd41('0x47')]['id'];}return db['FaxQueue'][_0xfd41('0x45')]({'where':{'id':_0x585550[_0xfd41('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c6b01,null))[_0xfd41('0x23')](saveUpdates(_0x585550[_0xfd41('0x47')],null))[_0xfd41('0x23')](respondWithResult(_0x3c6b01,null))[_0xfd41('0x4e')](handleError(_0x3c6b01,null));};exports['destroy']=function(_0x11750c,_0x1ab7b5){return db['FaxQueue'][_0xfd41('0x45')]({'where':{'id':_0x11750c[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](handleEntityNotFound(_0x1ab7b5,null))[_0xfd41('0x23')](removeEntity(_0x1ab7b5,null))[_0xfd41('0x4e')](handleError(_0x1ab7b5,null));};exports[_0xfd41('0x51')]=function(_0x174fd5,_0xf27323){return db['FaxQueue'][_0xfd41('0x51')]()['then'](respondWithResult(_0xf27323,null))['catch'](handleError(_0xf27323,null));};exports[_0xfd41('0x52')]=function(_0x5439ff,_0x3727dc,_0x3aafbd){var _0x3c03b2={'raw':!![],'where':{}},_0x4f1c35={},_0x39bb59;return db[_0xfd41('0x29')][_0xfd41('0x53')]({'where':{'id':_0x5439ff[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](handleEntityNotFound(_0x3727dc,null))['then'](function(_0x3ddb80){if(_0x3ddb80){_0x39bb59=_0x3ddb80['get']({'plain':!![]});_0x4f1c35['model']=_[_0xfd41('0x43')](db[_0xfd41('0x54')][_0xfd41('0x2a')]);_0x4f1c35[_0xfd41('0x2f')]=_[_0xfd41('0x43')](_0x5439ff['query']);_0x4f1c35[_0xfd41('0x30')]=_[_0xfd41('0x31')](_0x4f1c35[_0xfd41('0x2d')],_0x4f1c35[_0xfd41('0x2f')]);_0x3c03b2['attributes']=_[_0xfd41('0x31')](_0x4f1c35[_0xfd41('0x2d')],qs[_0xfd41('0x33')](_0x5439ff[_0xfd41('0x2f')][_0xfd41('0x33')]));_0x3c03b2['attributes']=_0x3c03b2['attributes'][_0xfd41('0x34')]?_0x3c03b2[_0xfd41('0x32')]:_0x4f1c35[_0xfd41('0x2d')];if(!_0x5439ff[_0xfd41('0x2f')][_0xfd41('0x35')](_0xfd41('0x55'))){_0x3c03b2[_0xfd41('0x1d')]=qs[_0xfd41('0x1d')](_0x5439ff[_0xfd41('0x2f')][_0xfd41('0x1d')]);_0x3c03b2[_0xfd41('0x1c')]=qs['offset'](_0x5439ff[_0xfd41('0x2f')][_0xfd41('0x1c')]);}_0x3c03b2['order']=qs[_0xfd41('0x37')](_0x5439ff[_0xfd41('0x2f')]['sort']);_0x3c03b2[_0xfd41('0x38')]=qs[_0xfd41('0x30')](_[_0xfd41('0x39')](_0x5439ff[_0xfd41('0x2f')],_0x4f1c35['filters']));_0x3c03b2[_0xfd41('0x38')][_0xfd41('0x56')]=_0x3ddb80['id'];if(_0x5439ff[_0xfd41('0x2f')][_0xfd41('0x3a')]){_0x3c03b2[_0xfd41('0x38')]=_[_0xfd41('0x3b')](_0x3c03b2['where'],{'$or':_['map'](_0x3c03b2[_0xfd41('0x32')],function(_0x340f1c){var _0x4e25c0={};_0x4e25c0[_0x340f1c]={'$like':'%'+_0x5439ff['query'][_0xfd41('0x3a')]+'%'};return _0x4e25c0;})});}_0x3c03b2=_['merge']({},_0x3c03b2,_0x5439ff['options']);return db[_0xfd41('0x54')][_0xfd41('0x3f')](_0x3c03b2);}})[_0xfd41('0x23')](function(_0x1ab51d){if(_0x1ab51d){return db['User'][_0xfd41('0x57')]({'where':{'id':_[_0xfd41('0x2e')](_0x1ab51d,_0xfd41('0x58')),'role':'agent'},'attributes':['id','name',_0xfd41('0x59'),_0xfd41('0x5a'),_0xfd41('0x5b')]});}})['then'](function(_0x55cdf2){if(_0x55cdf2){return{'count':_0x55cdf2[_0xfd41('0x1b')],'rows':_[_0xfd41('0x2e')](_0x55cdf2[_0xfd41('0x40')],function(_0x46d97c){return{'membername':_0x46d97c[_0xfd41('0x27')],'UserId':_0x46d97c['id'],'queue_name':_0x39bb59[_0xfd41('0x27')],'FaxQueueId':_0x39bb59['id'],'interface':util[_0xfd41('0x5c')](_0xfd41('0x5d'),_0xfd41('0x5e'),_0x46d97c[_0xfd41('0x27')]),'penalty':0x0,'paused':_0x46d97c[_0xfd41('0x59')],'createdAt':_0x46d97c[_0xfd41('0x5b')],'updatedAt':_0x46d97c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfd41('0x23')](respondWithFilteredResult(_0x3727dc,_0x3c03b2))['catch'](handleError(_0x3727dc,null));};exports['getTeams']=function(_0x1b262d,_0x28a84a,_0x3c1a9b){var _0x4e95f1={};var _0x1cc0a9={};var _0x1118b6;var _0x50b7f5;return db[_0xfd41('0x29')][_0xfd41('0x53')]({'where':{'id':_0x1b262d[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](handleEntityNotFound(_0x28a84a,null))[_0xfd41('0x23')](function(_0x3be58f){if(_0x3be58f){_0x1118b6=_0x3be58f;_0x1cc0a9[_0xfd41('0x2d')]=_[_0xfd41('0x43')](db[_0xfd41('0x5f')][_0xfd41('0x2a')]);_0x1cc0a9[_0xfd41('0x2f')]=_[_0xfd41('0x43')](_0x1b262d[_0xfd41('0x2f')]);_0x1cc0a9[_0xfd41('0x30')]=_[_0xfd41('0x31')](_0x1cc0a9[_0xfd41('0x2d')],_0x1cc0a9[_0xfd41('0x2f')]);_0x4e95f1['attributes']=_[_0xfd41('0x31')](_0x1cc0a9['model'],qs[_0xfd41('0x33')](_0x1b262d[_0xfd41('0x2f')][_0xfd41('0x33')]));_0x4e95f1[_0xfd41('0x32')]=_0x4e95f1[_0xfd41('0x32')][_0xfd41('0x34')]?_0x4e95f1[_0xfd41('0x32')]:_0x1cc0a9['model'];_0x4e95f1[_0xfd41('0x36')]=qs[_0xfd41('0x37')](_0x1b262d[_0xfd41('0x2f')][_0xfd41('0x37')]);_0x4e95f1['where']=qs[_0xfd41('0x30')](_[_0xfd41('0x39')](_0x1b262d[_0xfd41('0x2f')],_0x1cc0a9[_0xfd41('0x30')]));if(_0x1b262d[_0xfd41('0x2f')][_0xfd41('0x3a')]){_0x4e95f1[_0xfd41('0x38')]=_[_0xfd41('0x3b')](_0x4e95f1['where'],{'$or':_[_0xfd41('0x2e')](_0x4e95f1[_0xfd41('0x32')],function(_0x202bb4){var _0x54cf83={};_0x54cf83[_0x202bb4]={'$like':'%'+_0x1b262d['query']['filter']+'%'};return _0x54cf83;})});}_0x4e95f1=_[_0xfd41('0x3b')]({},_0x4e95f1,_0x1b262d[_0xfd41('0x3d')]);return _0x1118b6[_0xfd41('0x60')](_0x4e95f1);}})[_0xfd41('0x23')](function(_0x5ce063){if(_0x5ce063){_0x50b7f5=_0x5ce063['length'];if(!_0x1b262d[_0xfd41('0x2f')][_0xfd41('0x35')](_0xfd41('0x55'))){_0x4e95f1[_0xfd41('0x1d')]=qs[_0xfd41('0x1d')](_0x1b262d[_0xfd41('0x2f')][_0xfd41('0x1d')]);_0x4e95f1[_0xfd41('0x1c')]=qs[_0xfd41('0x1c')](_0x1b262d[_0xfd41('0x2f')]['offset']);}return _0x1118b6['getTeams'](_0x4e95f1);}})['then'](function(_0xdf1565){if(_0xdf1565){return _0xdf1565?{'count':_0x50b7f5,'rows':_0xdf1565}:null;}})[_0xfd41('0x23')](respondWithResult(_0x28a84a,null))[_0xfd41('0x4e')](handleError(_0x28a84a,null));};exports[_0xfd41('0x61')]=function(_0x4c4c70,_0x255b2e,_0x380866){var _0x147393=_0x4c4c70['body'][_0xfd41('0x62')];return db[_0xfd41('0x5f')][_0xfd41('0x3f')]({'where':{'id':_0x147393},'attributes':['id'],'include':[{'model':db[_0xfd41('0x63')],'as':_0xfd41('0x64'),'attributes':['id',_0xfd41('0x27'),_0xfd41('0x65'),_0xfd41('0x66'),_0xfd41('0x67')],'raw':!![]}]})['then'](function(_0x2151a1){if(_0x2151a1){var _0xf462a3=_[_0xfd41('0x68')](_0x2151a1,function(_0x24551a){var _0x50ed73=_0x24551a[_0xfd41('0x49')]({'plain':!![]});return _0x50ed73[_0xfd41('0x64')];});return db[_0xfd41('0x29')][_0xfd41('0x45')]({'where':{'id':_0x4c4c70[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](function(_0x388257){return db[_0xfd41('0x69')][_0xfd41('0x6a')](function(_0x3da116){return _0x388257[_0xfd41('0x61')](_0x147393,{'transaction':_0x3da116})[_0xfd41('0x23')](function(){return BPromise[_0xfd41('0x6b')](_0xf462a3,function(_0x116e0c){return db[_0xfd41('0x54')][_0xfd41('0x6c')]({'where':{'UserId':_0x116e0c['id'],'FaxQueueId':_0x4c4c70[_0xfd41('0x42')]['id']},'transaction':_0x3da116});});})[_0xfd41('0x23')](function(){_0xf462a3['forEach'](function(_0x279fe7){socket[_0xfd41('0x6d')]('userFaxQueue:save',{'UserId':_0x279fe7['id'],'FaxQueueId':_0x388257['id']});});});});});}})[_0xfd41('0x23')](respondWithStatusCode(_0x255b2e,null))[_0xfd41('0x4e')](handleError(_0x255b2e,null));};exports[_0xfd41('0x6e')]=function(_0x1f5fb1,_0x3d65bc,_0x1c5fd6){return db[_0xfd41('0x5f')]['findAll']({'where':{'id':_0x1f5fb1[_0xfd41('0x2f')][_0xfd41('0x62')]},'attributes':['id'],'include':[{'model':db[_0xfd41('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3d65bc,null))[_0xfd41('0x23')](function(_0x2c0bf1){var _0x2e54d4=_[_0xfd41('0x2e')](_0x2c0bf1,'id');var _0x5e3fe8=[];var _0x15a2e3=[];var _0x5856f7=squel[_0xfd41('0x6f')]();_0x5856f7[_0xfd41('0x70')](_0xfd41('0x71'))[_0xfd41('0x72')](_0xfd41('0x73'),'tq')[_0xfd41('0x74')](_0xfd41('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('FaxQueueId\x20=\x20?',_0x1f5fb1[_0xfd41('0x42')]['id']);for(var _0x236729=0x0;_0x236729<_0x2c0bf1['length'];_0x236729+=0x1){let _0x2ee3f2=_0x2c0bf1[_0x236729];for(var _0x1618b4=0x0;_0x1618b4<_0x2ee3f2[_0xfd41('0x64')][_0xfd41('0x34')];_0x1618b4+=0x1){let _0x3598bc=_0x2ee3f2[_0xfd41('0x64')][_0x1618b4];var _0x14891b=_0x5856f7[_0xfd41('0x76')]();_0x14891b[_0xfd41('0x38')](_0xfd41('0x77'),_0x3598bc['id']);_0x15a2e3[_0xfd41('0x78')](db['sequelize'][_0xfd41('0x2f')](_0x14891b['toString'](),{'type':db[_0xfd41('0x69')][_0xfd41('0x79')][_0xfd41('0x7a')]})[_0xfd41('0x23')](function(_0x17a223){if(_0x17a223['length']===0x1){return _0x3598bc['id'];}else{var _0x2b8f17=_[_0xfd41('0x7b')](_[_0xfd41('0x2e')](_0x17a223,_0xfd41('0x7c')),function(_0x2f0dc7){return _[_0xfd41('0x7d')](_0x2e54d4,_0x2f0dc7);});if(_0x2b8f17){return _0x3598bc['id'];}}}));}}return BPromise['all'](_0x15a2e3)[_0xfd41('0x23')](function(_0x51bf07){_0x5e3fe8=_(_0x5e3fe8)[_0xfd41('0x7e')](_0x51bf07)['compact']()['value']();return db[_0xfd41('0x29')]['find']({'where':{'id':_0x1f5fb1[_0xfd41('0x42')]['id']}})['then'](function(_0x4ff95f){return db['sequelize'][_0xfd41('0x6a')](function(_0x5a2d01){return _0x4ff95f['removeTeams'](_0x1f5fb1[_0xfd41('0x2f')][_0xfd41('0x62')],{'transaction':_0x5a2d01})[_0xfd41('0x23')](function(){if(!_[_0xfd41('0x7f')](_0x5e3fe8)){return _0x4ff95f[_0xfd41('0x80')](_0x5e3fe8,{'transaction':_0x5a2d01});}})[_0xfd41('0x23')](function(){_0x5e3fe8[_0xfd41('0x81')](function(_0xd66274){socket[_0xfd41('0x6d')](_0xfd41('0x82'),{'UserId':_0xd66274,'FaxQueueId':_0x4ff95f['id']});});});});});});})[_0xfd41('0x23')](respondWithStatusCode(_0x3d65bc,null))[_0xfd41('0x4e')](handleError(_0x3d65bc,null));};exports[_0xfd41('0x83')]=function(_0x20e61d,_0x2c9824,_0x2854e9){return db['FaxQueue']['find']({'where':{'id':_0x20e61d[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](handleEntityNotFound(_0x2c9824,null))[_0xfd41('0x23')](function(_0x4369a5){if(_0x4369a5){return _0x4369a5[_0xfd41('0x83')](_0x20e61d[_0xfd41('0x47')]['ids'],_[_0xfd41('0x84')](_0x20e61d['body'],[_0xfd41('0x62'),'id'])||{})[_0xfd41('0x85')](function(_0x34a037){for(var _0x1deb74=0x0;_0x1deb74<_0x20e61d[_0xfd41('0x47')]['ids']['length'];_0x1deb74+=0x1){socket[_0xfd41('0x6d')]('userFaxQueue:save',{'UserId':_0x20e61d['body']['ids'][_0x1deb74],'FaxQueueId':_0x20e61d[_0xfd41('0x42')]['id']});}return _0x34a037;});}})[_0xfd41('0x23')](respondWithResult(_0x2c9824,null))['catch'](handleError(_0x2c9824,null));};exports[_0xfd41('0x80')]=function(_0x326adf,_0x4c411b,_0x276f47){return db[_0xfd41('0x29')][_0xfd41('0x45')]({'where':{'id':_0x326adf[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](handleEntityNotFound(_0x4c411b,null))['then'](function(_0x56f221){if(_0x56f221){return _0x56f221[_0xfd41('0x80')](_0x326adf[_0xfd41('0x2f')][_0xfd41('0x62')])[_0xfd41('0x23')](function(){if(_[_0xfd41('0x86')](_0x326adf[_0xfd41('0x2f')][_0xfd41('0x62')])){for(var _0x71a3b3=0x0;_0x71a3b3<_0x326adf['query'][_0xfd41('0x62')]['length'];_0x71a3b3+=0x1){socket[_0xfd41('0x6d')](_0xfd41('0x82'),{'UserId':Number(_0x326adf[_0xfd41('0x2f')][_0xfd41('0x62')][_0x71a3b3]),'FaxQueueId':Number(_0x326adf['params']['id'])});}}else{socket[_0xfd41('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x326adf[_0xfd41('0x2f')][_0xfd41('0x62')]),'FaxQueueId':Number(_0x326adf[_0xfd41('0x42')]['id'])});}});}})[_0xfd41('0x23')](respondWithStatusCode(_0x4c411b,null))[_0xfd41('0x4e')](handleError(_0x4c411b,null));};exports[_0xfd41('0x87')]=function(_0x37ade2,_0x2ed6ce,_0xb3a9a){var _0x20c25f={};var _0x347ded={};var _0x422a4b;var _0x470790;return db[_0xfd41('0x29')][_0xfd41('0x53')]({'where':{'id':_0x37ade2[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](handleEntityNotFound(_0x2ed6ce,null))[_0xfd41('0x23')](function(_0x17a574){if(_0x17a574){_0x422a4b=_0x17a574;_0x347ded[_0xfd41('0x2d')]=_[_0xfd41('0x43')](db['User']['rawAttributes']);_0x347ded[_0xfd41('0x2f')]=_[_0xfd41('0x43')](_0x37ade2[_0xfd41('0x2f')]);_0x347ded['filters']=_[_0xfd41('0x31')](_0x347ded['model'],_0x347ded[_0xfd41('0x2f')]);_0x20c25f[_0xfd41('0x32')]=_['intersection'](_0x347ded['model'],qs[_0xfd41('0x33')](_0x37ade2['query'][_0xfd41('0x33')]));_0x20c25f['attributes']=_0x20c25f['attributes'][_0xfd41('0x34')]?_0x20c25f[_0xfd41('0x32')]:_0x347ded[_0xfd41('0x2d')];_0x20c25f[_0xfd41('0x36')]=qs[_0xfd41('0x37')](_0x37ade2[_0xfd41('0x2f')]['sort']);_0x20c25f[_0xfd41('0x38')]=qs[_0xfd41('0x30')](_[_0xfd41('0x39')](_0x37ade2[_0xfd41('0x2f')],_0x347ded[_0xfd41('0x30')]));if(_0x37ade2['query'][_0xfd41('0x3a')]){_0x20c25f[_0xfd41('0x38')]=_['merge'](_0x20c25f[_0xfd41('0x38')],{'$or':_[_0xfd41('0x2e')](_0x20c25f['attributes'],function(_0x547dea){var _0x2c489c={};_0x2c489c[_0x547dea]={'$like':'%'+_0x37ade2[_0xfd41('0x2f')][_0xfd41('0x3a')]+'%'};return _0x2c489c;})});}_0x20c25f=_[_0xfd41('0x3b')]({},_0x20c25f,_0x37ade2['options']);return _0x422a4b[_0xfd41('0x87')](_0x20c25f);}})[_0xfd41('0x23')](function(_0x4cd75c){if(_0x4cd75c){_0x470790=_0x4cd75c[_0xfd41('0x34')];if(!_0x37ade2[_0xfd41('0x2f')][_0xfd41('0x35')](_0xfd41('0x55'))){_0x20c25f[_0xfd41('0x1d')]=qs[_0xfd41('0x1d')](_0x37ade2[_0xfd41('0x2f')]['limit']);_0x20c25f[_0xfd41('0x1c')]=qs[_0xfd41('0x1c')](_0x37ade2[_0xfd41('0x2f')][_0xfd41('0x1c')]);}return _0x422a4b[_0xfd41('0x87')](_0x20c25f);}})['then'](function(_0x47e5bd){if(_0x47e5bd){return _0x47e5bd?{'count':_0x470790,'rows':_0x47e5bd}:null;}})[_0xfd41('0x23')](respondWithResult(_0x2ed6ce,null))[_0xfd41('0x4e')](handleError(_0x2ed6ce,null));}; \ No newline at end of file +var _0x9658=['UserFaxQueue','hasOwnProperty','User','UserId','agent','faxPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','select','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','compact','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','mustache','path','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','defaults','redis','localhost','./faxQueue.socket','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','VIRTUAL','name','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9658,0xba));var _0x8965=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0x9658[_0x3bceea];return _0x30a8d3;};'use strict';var pdf=require(_0x8965('0x0'));var emlformat=require(_0x8965('0x1'));var rimraf=require(_0x8965('0x2'));var zipdir=require(_0x8965('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8965('0x4'));var util=require('util');var path=require(_0x8965('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8965('0x6'));var crypto=require(_0x8965('0x7'));var jsforce=require(_0x8965('0x8'));var deskjs=require(_0x8965('0x9'));var toCsv=require('to-csv');var querystring=require(_0x8965('0xa'));var Papa=require('papaparse');var Redis=require(_0x8965('0xb'));var authService=require(_0x8965('0xc'));var qs=require(_0x8965('0xd'));var as=require(_0x8965('0xe'));var hardwareService=require(_0x8965('0xf'));var logger=require('../../config/logger')(_0x8965('0x10'));var utils=require(_0x8965('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8965('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8965('0x13')](config[_0x8965('0x14')],{'host':_0x8965('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8965('0x14')]));require(_0x8965('0x16'))['register'](socket);function respondWithStatusCode(_0x5ed325,_0x301a90){_0x301a90=_0x301a90||0xcc;return function(_0x2fa3e1){if(_0x2fa3e1){return _0x5ed325[_0x8965('0x17')](_0x301a90);}return _0x5ed325[_0x8965('0x18')](_0x301a90)[_0x8965('0x19')]();};}function respondWithResult(_0x5b49ce,_0x3418ff){_0x3418ff=_0x3418ff||0xc8;return function(_0x1a52f9){if(_0x1a52f9){return _0x5b49ce[_0x8965('0x18')](_0x3418ff)['json'](_0x1a52f9);}};}function respondWithFilteredResult(_0x1406b2,_0x2bebed){return function(_0xef2e1b){if(_0xef2e1b){var _0x5d6475=_0xef2e1b[_0x8965('0x1a')],_0x442046=_0x2bebed[_0x8965('0x1b')],_0x1a53b1=_0x2bebed['offset']+_0x2bebed['limit'],_0x22c04f;if(_0x1a53b1>=_0x5d6475){_0x1a53b1=_0x5d6475;_0x22c04f=0xc8;}else{_0x22c04f=0xce;}_0x1406b2[_0x8965('0x18')](_0x22c04f);return _0x1406b2[_0x8965('0x1c')](_0x8965('0x1d'),_0x442046+'-'+_0x1a53b1+'/'+_0x5d6475)[_0x8965('0x1e')](_0xef2e1b);}return null;};}function patchUpdates(_0x2a2edb){return function(_0xe53509){try{jsonpatch[_0x8965('0x1f')](_0xe53509,_0x2a2edb,!![]);}catch(_0x7c038d){return BPromise[_0x8965('0x20')](_0x7c038d);}return _0xe53509['save']();};}function saveUpdates(_0x4b8bb3,_0x482246){return function(_0x580ec1){if(_0x580ec1){return _0x580ec1[_0x8965('0x21')](_0x4b8bb3)[_0x8965('0x22')](function(_0x1bba3a){return _0x1bba3a;});}return null;};}function removeEntity(_0x11deb3,_0x30d3a8){return function(_0x5a16de){if(_0x5a16de){return _0x5a16de[_0x8965('0x23')]()[_0x8965('0x22')](function(){var _0x2eb0ef=_0x5a16de[_0x8965('0x24')]({'plain':!![]});var _0x471cbd=_0x8965('0x25');return db[_0x8965('0x26')]['destroy']({'where':{'type':_0x471cbd,'resourceId':_0x2eb0ef['id']}})[_0x8965('0x22')](function(){return _0x5a16de;});})[_0x8965('0x22')](function(){_0x11deb3[_0x8965('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40fac0,_0x4a3e70){return function(_0x578e0e){if(!_0x578e0e){_0x40fac0[_0x8965('0x17')](0x194);}return _0x578e0e;};}function handleError(_0x1c4215,_0x226b63){_0x226b63=_0x226b63||0x1f4;return function(_0x396812){logger[_0x8965('0x27')](_0x396812[_0x8965('0x28')]);if(_0x396812['name']){delete _0x396812['name'];}_0x1c4215['status'](_0x226b63)[_0x8965('0x29')](_0x396812);};}exports[_0x8965('0x2a')]=function(_0x164c1a,_0x21a356){var _0x30a046={},_0x113033={},_0x1b4314={'count':0x0,'rows':[]};var _0x27862b=_[_0x8965('0x2b')](db[_0x8965('0x2c')][_0x8965('0x2d')],function(_0x29aec9){return{'name':_0x29aec9[_0x8965('0x2e')],'type':_0x29aec9[_0x8965('0x2f')][_0x8965('0x30')]};});_0x113033[_0x8965('0x31')]=_['map'](_0x27862b,'name');_0x113033[_0x8965('0x32')]=_[_0x8965('0x33')](_0x164c1a['query']);_0x113033[_0x8965('0x34')]=_[_0x8965('0x35')](_0x113033[_0x8965('0x31')],_0x113033[_0x8965('0x32')]);_0x30a046['attributes']=_[_0x8965('0x35')](_0x113033[_0x8965('0x31')],qs[_0x8965('0x36')](_0x164c1a['query'][_0x8965('0x36')]));_0x30a046[_0x8965('0x37')]=_0x30a046[_0x8965('0x37')][_0x8965('0x38')]?_0x30a046[_0x8965('0x37')]:_0x113033[_0x8965('0x31')];if(!_0x164c1a[_0x8965('0x32')]['hasOwnProperty'](_0x8965('0x39'))){_0x30a046[_0x8965('0x3a')]=qs[_0x8965('0x3a')](_0x164c1a['query']['limit']);_0x30a046['offset']=qs['offset'](_0x164c1a[_0x8965('0x32')][_0x8965('0x1b')]);}_0x30a046[_0x8965('0x3b')]=qs[_0x8965('0x3c')](_0x164c1a[_0x8965('0x32')]['sort']);_0x30a046[_0x8965('0x3d')]=qs[_0x8965('0x34')](_['pick'](_0x164c1a['query'],_0x113033['filters']),_0x27862b);if(_0x164c1a[_0x8965('0x32')]['filter']){_0x30a046[_0x8965('0x3d')]=_['merge'](_0x30a046[_0x8965('0x3d')],{'$or':_[_0x8965('0x2b')](_0x27862b,function(_0x6492b){if(_0x6492b['type']!==_0x8965('0x3e')){var _0x56aa5e={};_0x56aa5e[_0x6492b[_0x8965('0x3f')]]={'$like':'%'+_0x164c1a['query'][_0x8965('0x40')]+'%'};return _0x56aa5e;}})});}_0x30a046=_[_0x8965('0x41')]({},_0x30a046,_0x164c1a[_0x8965('0x42')]);var _0x131fc2={'where':_0x30a046[_0x8965('0x3d')]};return db[_0x8965('0x2c')][_0x8965('0x1a')](_0x131fc2)[_0x8965('0x22')](function(_0x3e859f){_0x1b4314['count']=_0x3e859f;if(_0x164c1a[_0x8965('0x32')][_0x8965('0x43')]){_0x30a046[_0x8965('0x44')]=[{'all':!![]}];}return db[_0x8965('0x2c')][_0x8965('0x45')](_0x30a046);})['then'](function(_0x1c39ed){_0x1b4314[_0x8965('0x46')]=_0x1c39ed;return _0x1b4314;})[_0x8965('0x22')](respondWithFilteredResult(_0x21a356,_0x30a046))['catch'](handleError(_0x21a356,null));};exports[_0x8965('0x47')]=function(_0x48feec,_0x51265a){var _0x4b1e22={'raw':!![],'where':{'id':_0x48feec[_0x8965('0x48')]['id']}},_0x59f5e3={};_0x59f5e3[_0x8965('0x31')]=_[_0x8965('0x33')](db[_0x8965('0x2c')][_0x8965('0x2d')]);_0x59f5e3['query']=_[_0x8965('0x33')](_0x48feec['query']);_0x59f5e3[_0x8965('0x34')]=_['intersection'](_0x59f5e3[_0x8965('0x31')],_0x59f5e3['query']);_0x4b1e22['attributes']=_[_0x8965('0x35')](_0x59f5e3['model'],qs['fields'](_0x48feec[_0x8965('0x32')][_0x8965('0x36')]));_0x4b1e22[_0x8965('0x37')]=_0x4b1e22[_0x8965('0x37')]['length']?_0x4b1e22['attributes']:_0x59f5e3[_0x8965('0x31')];if(_0x48feec['query'][_0x8965('0x43')]){_0x4b1e22[_0x8965('0x44')]=[{'all':!![]}];}_0x4b1e22=_[_0x8965('0x41')]({},_0x4b1e22,_0x48feec['options']);return db[_0x8965('0x2c')][_0x8965('0x49')](_0x4b1e22)[_0x8965('0x22')](handleEntityNotFound(_0x51265a,null))[_0x8965('0x22')](respondWithResult(_0x51265a,null))[_0x8965('0x4a')](handleError(_0x51265a,null));};exports[_0x8965('0x4b')]=function(_0x4b7d5b,_0x3a8f72){return db[_0x8965('0x2c')][_0x8965('0x4b')](_0x4b7d5b[_0x8965('0x4c')],{})[_0x8965('0x22')](function(_0x362d40){var _0x2cca22=_0x4b7d5b['user'][_0x8965('0x24')]({'plain':!![]});if(!_0x2cca22)throw new Error(_0x8965('0x4d'));if(_0x2cca22['role']==='user'){var _0x539060=_0x362d40[_0x8965('0x24')]({'plain':!![]});var _0x3b317e=_0x8965('0x25');return db[_0x8965('0x4e')]['find']({'where':{'name':_0x3b317e,'userProfileId':_0x2cca22['userProfileId']},'raw':!![]})[_0x8965('0x22')](function(_0xbc1d54){if(_0xbc1d54&&_0xbc1d54[_0x8965('0x4f')]===0x0){return db[_0x8965('0x26')][_0x8965('0x4b')]({'name':_0x539060[_0x8965('0x3f')],'resourceId':_0x539060['id'],'type':_0xbc1d54[_0x8965('0x3f')],'sectionId':_0xbc1d54['id']},{})[_0x8965('0x22')](function(){return _0x362d40;});}else{return _0x362d40;}})['catch'](function(_0xc6b0ee){logger['error'](_0x8965('0x50'),_0xc6b0ee);throw _0xc6b0ee;});}return _0x362d40;})[_0x8965('0x22')](respondWithResult(_0x3a8f72,0xc9))['catch'](handleError(_0x3a8f72,null));};exports[_0x8965('0x21')]=function(_0x39d3e0,_0x37bb27){if(_0x39d3e0[_0x8965('0x4c')]['id']){delete _0x39d3e0['body']['id'];}return db[_0x8965('0x2c')][_0x8965('0x49')]({'where':{'id':_0x39d3e0[_0x8965('0x48')]['id']}})[_0x8965('0x22')](handleEntityNotFound(_0x37bb27,null))['then'](saveUpdates(_0x39d3e0['body'],null))[_0x8965('0x22')](respondWithResult(_0x37bb27,null))['catch'](handleError(_0x37bb27,null));};exports['destroy']=function(_0x70774f,_0x5c1600){return db[_0x8965('0x2c')][_0x8965('0x49')]({'where':{'id':_0x70774f[_0x8965('0x48')]['id']}})[_0x8965('0x22')](handleEntityNotFound(_0x5c1600,null))['then'](removeEntity(_0x5c1600,null))['catch'](handleError(_0x5c1600,null));};exports[_0x8965('0x51')]=function(_0x4803b5,_0x251af8){return db[_0x8965('0x2c')][_0x8965('0x51')]()['then'](respondWithResult(_0x251af8,null))['catch'](handleError(_0x251af8,null));};exports[_0x8965('0x52')]=function(_0x4b2b24,_0x3ba344,_0x77798){var _0x3c1644={'raw':!![],'where':{}},_0x40acd8={},_0x6148e;return db[_0x8965('0x2c')][_0x8965('0x53')]({'where':{'id':_0x4b2b24[_0x8965('0x48')]['id']}})[_0x8965('0x22')](handleEntityNotFound(_0x3ba344,null))[_0x8965('0x22')](function(_0x401145){if(_0x401145){_0x6148e=_0x401145[_0x8965('0x24')]({'plain':!![]});_0x40acd8['model']=_[_0x8965('0x33')](db[_0x8965('0x54')][_0x8965('0x2d')]);_0x40acd8['query']=_[_0x8965('0x33')](_0x4b2b24[_0x8965('0x32')]);_0x40acd8[_0x8965('0x34')]=_[_0x8965('0x35')](_0x40acd8[_0x8965('0x31')],_0x40acd8[_0x8965('0x32')]);_0x3c1644[_0x8965('0x37')]=_['intersection'](_0x40acd8['model'],qs[_0x8965('0x36')](_0x4b2b24[_0x8965('0x32')][_0x8965('0x36')]));_0x3c1644['attributes']=_0x3c1644['attributes'][_0x8965('0x38')]?_0x3c1644[_0x8965('0x37')]:_0x40acd8[_0x8965('0x31')];if(!_0x4b2b24['query'][_0x8965('0x55')](_0x8965('0x39'))){_0x3c1644[_0x8965('0x3a')]=qs[_0x8965('0x3a')](_0x4b2b24['query'][_0x8965('0x3a')]);_0x3c1644[_0x8965('0x1b')]=qs[_0x8965('0x1b')](_0x4b2b24['query'][_0x8965('0x1b')]);}_0x3c1644['order']=qs[_0x8965('0x3c')](_0x4b2b24['query'][_0x8965('0x3c')]);_0x3c1644[_0x8965('0x3d')]=qs[_0x8965('0x34')](_['pick'](_0x4b2b24['query'],_0x40acd8[_0x8965('0x34')]));_0x3c1644[_0x8965('0x3d')]['FaxQueueId']=_0x401145['id'];if(_0x4b2b24['query'][_0x8965('0x40')]){_0x3c1644[_0x8965('0x3d')]=_[_0x8965('0x41')](_0x3c1644[_0x8965('0x3d')],{'$or':_['map'](_0x3c1644[_0x8965('0x37')],function(_0x2986cd){var _0x129833={};_0x129833[_0x2986cd]={'$like':'%'+_0x4b2b24['query'][_0x8965('0x40')]+'%'};return _0x129833;})});}_0x3c1644=_[_0x8965('0x41')]({},_0x3c1644,_0x4b2b24[_0x8965('0x42')]);return db['UserFaxQueue'][_0x8965('0x45')](_0x3c1644);}})[_0x8965('0x22')](function(_0x3bd344){if(_0x3bd344){return db[_0x8965('0x56')]['findAndCountAll']({'where':{'id':_[_0x8965('0x2b')](_0x3bd344,_0x8965('0x57')),'role':_0x8965('0x58')},'attributes':['id',_0x8965('0x3f'),_0x8965('0x59'),_0x8965('0x5a'),'createdAt']});}})[_0x8965('0x22')](function(_0x303a4c){if(_0x303a4c){return{'count':_0x303a4c[_0x8965('0x1a')],'rows':_[_0x8965('0x2b')](_0x303a4c[_0x8965('0x46')],function(_0x240fbc){return{'membername':_0x240fbc[_0x8965('0x3f')],'UserId':_0x240fbc['id'],'queue_name':_0x6148e[_0x8965('0x3f')],'FaxQueueId':_0x6148e['id'],'interface':util[_0x8965('0x5b')](_0x8965('0x5c'),'SIP',_0x240fbc[_0x8965('0x3f')]),'penalty':0x0,'paused':_0x240fbc[_0x8965('0x59')],'createdAt':_0x240fbc[_0x8965('0x5d')],'updatedAt':_0x240fbc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8965('0x22')](respondWithFilteredResult(_0x3ba344,_0x3c1644))[_0x8965('0x4a')](handleError(_0x3ba344,null));};exports[_0x8965('0x5e')]=function(_0x48f06d,_0x190289,_0xb6b42){var _0x662427={};var _0x19700b={};var _0x1aa45a;var _0x57bf77;return db['FaxQueue'][_0x8965('0x53')]({'where':{'id':_0x48f06d[_0x8965('0x48')]['id']}})[_0x8965('0x22')](handleEntityNotFound(_0x190289,null))['then'](function(_0x5381fc){if(_0x5381fc){_0x1aa45a=_0x5381fc;_0x19700b[_0x8965('0x31')]=_['keys'](db[_0x8965('0x5f')][_0x8965('0x2d')]);_0x19700b[_0x8965('0x32')]=_[_0x8965('0x33')](_0x48f06d[_0x8965('0x32')]);_0x19700b['filters']=_['intersection'](_0x19700b['model'],_0x19700b[_0x8965('0x32')]);_0x662427['attributes']=_[_0x8965('0x35')](_0x19700b[_0x8965('0x31')],qs['fields'](_0x48f06d[_0x8965('0x32')][_0x8965('0x36')]));_0x662427[_0x8965('0x37')]=_0x662427[_0x8965('0x37')][_0x8965('0x38')]?_0x662427[_0x8965('0x37')]:_0x19700b[_0x8965('0x31')];_0x662427['order']=qs['sort'](_0x48f06d['query'][_0x8965('0x3c')]);_0x662427[_0x8965('0x3d')]=qs['filters'](_[_0x8965('0x60')](_0x48f06d[_0x8965('0x32')],_0x19700b[_0x8965('0x34')]));if(_0x48f06d['query'][_0x8965('0x40')]){_0x662427[_0x8965('0x3d')]=_[_0x8965('0x41')](_0x662427[_0x8965('0x3d')],{'$or':_[_0x8965('0x2b')](_0x662427[_0x8965('0x37')],function(_0x6ef13b){var _0xb31364={};_0xb31364[_0x6ef13b]={'$like':'%'+_0x48f06d['query'][_0x8965('0x40')]+'%'};return _0xb31364;})});}_0x662427=_[_0x8965('0x41')]({},_0x662427,_0x48f06d['options']);return _0x1aa45a[_0x8965('0x5e')](_0x662427);}})['then'](function(_0x3b34d7){if(_0x3b34d7){_0x57bf77=_0x3b34d7['length'];if(!_0x48f06d[_0x8965('0x32')][_0x8965('0x55')]('nolimit')){_0x662427[_0x8965('0x3a')]=qs[_0x8965('0x3a')](_0x48f06d[_0x8965('0x32')]['limit']);_0x662427[_0x8965('0x1b')]=qs[_0x8965('0x1b')](_0x48f06d['query'][_0x8965('0x1b')]);}return _0x1aa45a['getTeams'](_0x662427);}})[_0x8965('0x22')](function(_0x29fc5d){if(_0x29fc5d){return _0x29fc5d?{'count':_0x57bf77,'rows':_0x29fc5d}:null;}})[_0x8965('0x22')](respondWithResult(_0x190289,null))[_0x8965('0x4a')](handleError(_0x190289,null));};exports[_0x8965('0x61')]=function(_0x28f828,_0x277922,_0x1ed33f){var _0x28cd70=_0x28f828[_0x8965('0x4c')][_0x8965('0x62')];return db[_0x8965('0x5f')][_0x8965('0x45')]({'where':{'id':_0x28cd70},'attributes':['id'],'include':[{'model':db[_0x8965('0x56')],'as':_0x8965('0x63'),'attributes':['id',_0x8965('0x3f'),_0x8965('0x64'),_0x8965('0x65'),_0x8965('0x66')],'raw':!![]}]})[_0x8965('0x22')](function(_0x5da7e4){if(_0x5da7e4){var _0x547e05=_[_0x8965('0x67')](_0x5da7e4,function(_0x490d34){var _0x1f2a3e=_0x490d34[_0x8965('0x24')]({'plain':!![]});return _0x1f2a3e['Agents'];});return db['FaxQueue'][_0x8965('0x49')]({'where':{'id':_0x28f828[_0x8965('0x48')]['id']}})[_0x8965('0x22')](function(_0x59bd68){return db[_0x8965('0x68')][_0x8965('0x69')](function(_0x48c136){return _0x59bd68[_0x8965('0x61')](_0x28cd70,{'transaction':_0x48c136})['then'](function(){return BPromise[_0x8965('0x6a')](_0x547e05,function(_0x56c02f){return db[_0x8965('0x54')][_0x8965('0x6b')]({'where':{'UserId':_0x56c02f['id'],'FaxQueueId':_0x28f828[_0x8965('0x48')]['id']},'transaction':_0x48c136});});})['then'](function(){_0x547e05[_0x8965('0x6c')](function(_0x2c6073){socket[_0x8965('0x6d')]('userFaxQueue:save',{'UserId':_0x2c6073['id'],'FaxQueueId':_0x59bd68['id']});});});});});}})[_0x8965('0x22')](respondWithStatusCode(_0x277922,null))['catch'](handleError(_0x277922,null));};exports['removeTeams']=function(_0x2b9820,_0x5a7766,_0x5e68aa){return db['Team']['findAll']({'where':{'id':_0x2b9820['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x8965('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8965('0x22')](handleEntityNotFound(_0x5a7766,null))['then'](function(_0x3e5137){var _0x1581d2=_[_0x8965('0x2b')](_0x3e5137,'id');var _0x339af9=[];var _0x348b6a=[];var _0x361129=squel[_0x8965('0x6e')]();_0x361129['field'](_0x8965('0x6f'))['from'](_0x8965('0x70'),'tq')['join'](_0x8965('0x71'),'ut',_0x8965('0x72'))[_0x8965('0x3d')](_0x8965('0x73'),_0x2b9820['params']['id']);for(var _0x164775=0x0;_0x164775<_0x3e5137['length'];_0x164775+=0x1){let _0x336589=_0x3e5137[_0x164775];for(var _0x6e821c=0x0;_0x6e821c<_0x336589[_0x8965('0x63')][_0x8965('0x38')];_0x6e821c+=0x1){let _0x426f52=_0x336589[_0x8965('0x63')][_0x6e821c];var _0x4ee959=_0x361129[_0x8965('0x74')]();_0x4ee959[_0x8965('0x3d')](_0x8965('0x75'),_0x426f52['id']);_0x348b6a[_0x8965('0x76')](db[_0x8965('0x68')][_0x8965('0x32')](_0x4ee959[_0x8965('0x77')](),{'type':db[_0x8965('0x68')][_0x8965('0x78')][_0x8965('0x79')]})[_0x8965('0x22')](function(_0x135a7e){if(_0x135a7e[_0x8965('0x38')]===0x1){return _0x426f52['id'];}else{var _0x58b732=_['every'](_[_0x8965('0x2b')](_0x135a7e,'TeamId'),function(_0x3c9be9){return _[_0x8965('0x7a')](_0x1581d2,_0x3c9be9);});if(_0x58b732){return _0x426f52['id'];}}}));}}return BPromise[_0x8965('0x7b')](_0x348b6a)[_0x8965('0x22')](function(_0x3e9095){_0x339af9=_(_0x339af9)['union'](_0x3e9095)[_0x8965('0x7c')]()[_0x8965('0x7d')]();return db[_0x8965('0x2c')][_0x8965('0x49')]({'where':{'id':_0x2b9820['params']['id']}})[_0x8965('0x22')](function(_0x1af9c9){return db['sequelize'][_0x8965('0x69')](function(_0x10b312){return _0x1af9c9[_0x8965('0x7e')](_0x2b9820['query'][_0x8965('0x62')],{'transaction':_0x10b312})['then'](function(){if(!_[_0x8965('0x7f')](_0x339af9)){return _0x1af9c9[_0x8965('0x80')](_0x339af9,{'transaction':_0x10b312});}})[_0x8965('0x22')](function(){_0x339af9[_0x8965('0x6c')](function(_0x3ed8bd){socket[_0x8965('0x6d')](_0x8965('0x81'),{'UserId':_0x3ed8bd,'FaxQueueId':_0x1af9c9['id']});});});});});});})['then'](respondWithStatusCode(_0x5a7766,null))['catch'](handleError(_0x5a7766,null));};exports[_0x8965('0x82')]=function(_0x3dfb2e,_0x4609fb,_0xc88bec){return db[_0x8965('0x2c')][_0x8965('0x49')]({'where':{'id':_0x3dfb2e['params']['id']}})['then'](handleEntityNotFound(_0x4609fb,null))[_0x8965('0x22')](function(_0x1111d6){if(_0x1111d6){return _0x1111d6['addAgents'](_0x3dfb2e[_0x8965('0x4c')][_0x8965('0x62')],_[_0x8965('0x83')](_0x3dfb2e[_0x8965('0x4c')],['ids','id'])||{})[_0x8965('0x84')](function(_0x4f9e0a){for(var _0x11e20c=0x0;_0x11e20c<_0x3dfb2e[_0x8965('0x4c')][_0x8965('0x62')]['length'];_0x11e20c+=0x1){socket[_0x8965('0x6d')]('userFaxQueue:save',{'UserId':_0x3dfb2e['body'][_0x8965('0x62')][_0x11e20c],'FaxQueueId':_0x3dfb2e['params']['id']});}return _0x4f9e0a;});}})['then'](respondWithResult(_0x4609fb,null))[_0x8965('0x4a')](handleError(_0x4609fb,null));};exports[_0x8965('0x80')]=function(_0x578b2b,_0x3f7063,_0x20dc95){return db['FaxQueue'][_0x8965('0x49')]({'where':{'id':_0x578b2b[_0x8965('0x48')]['id']}})[_0x8965('0x22')](handleEntityNotFound(_0x3f7063,null))[_0x8965('0x22')](function(_0x175228){if(_0x175228){return _0x175228['removeAgents'](_0x578b2b[_0x8965('0x32')][_0x8965('0x62')])[_0x8965('0x22')](function(){if(_[_0x8965('0x85')](_0x578b2b['query']['ids'])){for(var _0x16f159=0x0;_0x16f159<_0x578b2b['query'][_0x8965('0x62')][_0x8965('0x38')];_0x16f159+=0x1){socket[_0x8965('0x6d')](_0x8965('0x81'),{'UserId':Number(_0x578b2b[_0x8965('0x32')][_0x8965('0x62')][_0x16f159]),'FaxQueueId':Number(_0x578b2b[_0x8965('0x48')]['id'])});}}else{socket['emit'](_0x8965('0x81'),{'UserId':Number(_0x578b2b['query'][_0x8965('0x62')]),'FaxQueueId':Number(_0x578b2b[_0x8965('0x48')]['id'])});}});}})[_0x8965('0x22')](respondWithStatusCode(_0x3f7063,null))[_0x8965('0x4a')](handleError(_0x3f7063,null));};exports[_0x8965('0x86')]=function(_0x33aa17,_0x53215d,_0x2ba717){var _0x3ae589={};var _0x4ced5b={};var _0x16b7ed;var _0x4e2086;return db[_0x8965('0x2c')][_0x8965('0x53')]({'where':{'id':_0x33aa17[_0x8965('0x48')]['id']}})[_0x8965('0x22')](handleEntityNotFound(_0x53215d,null))[_0x8965('0x22')](function(_0x10a6da){if(_0x10a6da){_0x16b7ed=_0x10a6da;_0x4ced5b[_0x8965('0x31')]=_['keys'](db[_0x8965('0x56')][_0x8965('0x2d')]);_0x4ced5b[_0x8965('0x32')]=_[_0x8965('0x33')](_0x33aa17['query']);_0x4ced5b[_0x8965('0x34')]=_[_0x8965('0x35')](_0x4ced5b[_0x8965('0x31')],_0x4ced5b[_0x8965('0x32')]);_0x3ae589[_0x8965('0x37')]=_['intersection'](_0x4ced5b[_0x8965('0x31')],qs['fields'](_0x33aa17[_0x8965('0x32')][_0x8965('0x36')]));_0x3ae589[_0x8965('0x37')]=_0x3ae589[_0x8965('0x37')]['length']?_0x3ae589[_0x8965('0x37')]:_0x4ced5b[_0x8965('0x31')];_0x3ae589[_0x8965('0x3b')]=qs[_0x8965('0x3c')](_0x33aa17['query'][_0x8965('0x3c')]);_0x3ae589['where']=qs[_0x8965('0x34')](_[_0x8965('0x60')](_0x33aa17['query'],_0x4ced5b[_0x8965('0x34')]));if(_0x33aa17[_0x8965('0x32')]['filter']){_0x3ae589['where']=_[_0x8965('0x41')](_0x3ae589['where'],{'$or':_[_0x8965('0x2b')](_0x3ae589['attributes'],function(_0x9ae54){var _0x46ca66={};_0x46ca66[_0x9ae54]={'$like':'%'+_0x33aa17[_0x8965('0x32')][_0x8965('0x40')]+'%'};return _0x46ca66;})});}_0x3ae589=_[_0x8965('0x41')]({},_0x3ae589,_0x33aa17[_0x8965('0x42')]);return _0x16b7ed['getAgents'](_0x3ae589);}})[_0x8965('0x22')](function(_0x1d2cba){if(_0x1d2cba){_0x4e2086=_0x1d2cba[_0x8965('0x38')];if(!_0x33aa17[_0x8965('0x32')]['hasOwnProperty']('nolimit')){_0x3ae589[_0x8965('0x3a')]=qs[_0x8965('0x3a')](_0x33aa17[_0x8965('0x32')][_0x8965('0x3a')]);_0x3ae589[_0x8965('0x1b')]=qs['offset'](_0x33aa17['query'][_0x8965('0x1b')]);}return _0x16b7ed[_0x8965('0x86')](_0x3ae589);}})[_0x8965('0x22')](function(_0x4de13b){if(_0x4de13b){return _0x4de13b?{'count':_0x4e2086,'rows':_0x4de13b}:null;}})['then'](respondWithResult(_0x53215d,null))[_0x8965('0x4a')](handleError(_0x53215d,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 90ea84d..7f462d6 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 _0xa3e0=['events','FaxQueue','setMaxListeners','save','remove','hasOwnProperty','hook'];(function(_0x3cc574,_0xa5de98){var _0x2d29f9=function(_0x17813b){while(--_0x17813b){_0x3cc574['push'](_0x3cc574['shift']());}};_0x2d29f9(++_0xa5de98);}(_0xa3e0,0x11f));var _0x0a3e=function(_0x397069,_0x4173b6){_0x397069=_0x397069-0x0;var _0x1ce7fc=_0xa3e0[_0x397069];return _0x1ce7fc;};'use strict';var EventEmitter=require(_0x0a3e('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x0a3e('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0a3e('0x2')](0x0);var events={'afterCreate':_0x0a3e('0x3'),'afterUpdate':'update','afterDestroy':_0x0a3e('0x4')};function emitEvent(_0x5706c5){return function(_0x2a2589,_0x357a35,_0x42d0a2){FaxQueueEvents['emit'](_0x5706c5+':'+_0x2a2589['id'],_0x2a2589);FaxQueueEvents['emit'](_0x5706c5,_0x2a2589);_0x42d0a2(null);};}for(var e in events){if(events[_0x0a3e('0x5')](e)){var event=events[e];FaxQueue[_0x0a3e('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x2ba8=['remove','hasOwnProperty','events','../../mysqldb','FaxQueue','setMaxListeners','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2ba8,0x9c));var _0x82ba=function(_0x47beda,_0xf71fef){_0x47beda=_0x47beda-0x0;var _0x3a744f=_0x2ba8[_0x47beda];return _0x3a744f;};'use strict';var EventEmitter=require(_0x82ba('0x0'));var FaxQueue=require(_0x82ba('0x1'))['db'][_0x82ba('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x82ba('0x3')](0x0);var events={'afterCreate':_0x82ba('0x4'),'afterUpdate':'update','afterDestroy':_0x82ba('0x5')};function emitEvent(_0x2d53dc){return function(_0x57d373,_0x16e4fe,_0x493d6d){FaxQueueEvents['emit'](_0x2d53dc+':'+_0x57d373['id'],_0x57d373);FaxQueueEvents['emit'](_0x2d53dc,_0x57d373);_0x493d6d(null);};}for(var e in events){if(events[_0x82ba('0x6')](e)){var event=events[e];FaxQueue['hook'](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 1caef2c..4ad1637 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 _0x57ae=['./faxQueue.attributes','exports','define','fax_queues','lodash','util','bluebird','path','rimraf','../../config/environment'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0x57ae,0x1ee));var _0xe57a=function(_0xeaf0e,_0x568209){_0xeaf0e=_0xeaf0e-0x0;var _0x1b73e5=_0x57ae[_0xeaf0e];return _0x1b73e5;};'use strict';var _=require(_0xe57a('0x0'));var util=require(_0xe57a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe57a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe57a('0x3'));var rimraf=require(_0xe57a('0x4'));var config=require(_0xe57a('0x5'));var attributes=require(_0xe57a('0x6'));module[_0xe57a('0x7')]=function(_0x128a45,_0x170953){return _0x128a45[_0xe57a('0x8')]('FaxQueue',attributes,{'tableName':_0xe57a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa178=['../../config/environment','./faxQueue.attributes','fax_queues','../../config/logger','api','bluebird','path','rimraf'];(function(_0x200859,_0x1ca95c){var _0x1cd962=function(_0x1d4010){while(--_0x1d4010){_0x200859['push'](_0x200859['shift']());}};_0x1cd962(++_0x1ca95c);}(_0xa178,0x17b));var _0x8a17=function(_0x537537,_0x13ad16){_0x537537=_0x537537-0x0;var _0x163d1c=_0xa178[_0x537537];return _0x163d1c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8a17('0x0'))(_0x8a17('0x1'));var moment=require('moment');var BPromise=require(_0x8a17('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a17('0x3'));var rimraf=require(_0x8a17('0x4'));var config=require(_0x8a17('0x5'));var attributes=require(_0x8a17('0x6'));module['exports']=function(_0x38755d,_0x36c737){return _0x38755d['define']('FaxQueue',attributes,{'tableName':_0x8a17('0x7'),'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 2edecbd..9f3ac0c 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 _0x0f6f=['raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','limit','map','include','model','attributes','ShowFaxQueue','find'];(function(_0x3dd8dd,_0x369f8e){var _0x33e300=function(_0xf1a7db){while(--_0xf1a7db){_0x3dd8dd['push'](_0x3dd8dd['shift']());}};_0x33e300(++_0x369f8e);}(_0x0f6f,0x141));var _0xf0f6=function(_0x38223f,_0x3a0dfc){_0x38223f=_0x38223f-0x0;var _0x3e3fab=_0x0f6f[_0x38223f];return _0x3e3fab;};'use strict';var _=require(_0xf0f6('0x0'));var util=require(_0xf0f6('0x1'));var moment=require(_0xf0f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0f6('0x3'));var fs=require('fs');var Redis=require(_0xf0f6('0x4'));var db=require(_0xf0f6('0x5'))['db'];var utils=require(_0xf0f6('0x6'));var logger=require(_0xf0f6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf0f6('0x8')][_0xf0f6('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf0f6('0xa')],{'host':_0xf0f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf0f6('0xc'))[_0xf0f6('0xd')](socket);function respondWithRpcPromise(_0x48def,_0x9b39db,_0x18dfcb){return new BPromise(function(_0x23d258,_0xc4da40){return client[_0xf0f6('0xe')](_0x48def,_0x18dfcb)[_0xf0f6('0xf')](function(_0x211a73){logger[_0xf0f6('0x10')](_0xf0f6('0x11'),_0x9b39db,'request\x20sent');logger[_0xf0f6('0x12')](_0xf0f6('0x13'),_0x9b39db,_0xf0f6('0x14'),JSON[_0xf0f6('0x15')](_0x211a73));if(_0x211a73[_0xf0f6('0x16')]){if(_0x211a73['error'][_0xf0f6('0x17')]===0x1f4){logger[_0xf0f6('0x16')]('FaxQueue,\x20%s,\x20%s',_0x9b39db,_0x211a73[_0xf0f6('0x16')]['message']);return _0xc4da40(_0x211a73[_0xf0f6('0x16')][_0xf0f6('0x18')]);}logger[_0xf0f6('0x16')](_0xf0f6('0x11'),_0x9b39db,_0x211a73[_0xf0f6('0x16')]['message']);return _0x23d258(_0x211a73[_0xf0f6('0x16')][_0xf0f6('0x18')]);}else{logger[_0xf0f6('0x10')]('FaxQueue,\x20%s,\x20%s',_0x9b39db,_0xf0f6('0x14'));_0x23d258(_0x211a73[_0xf0f6('0x19')][_0xf0f6('0x18')]);}})[_0xf0f6('0x1a')](function(_0x1b9e90){logger[_0xf0f6('0x16')](_0xf0f6('0x11'),_0x9b39db,_0x1b9e90);_0xc4da40(_0x1b9e90);});});}exports[_0xf0f6('0x1b')]=function(_0x5865df){var _0x172705=this;return new Promise(function(_0x14888c,_0x16ae49){return db[_0xf0f6('0x1c')][_0xf0f6('0x1d')]({'raw':_0x5865df[_0xf0f6('0x1e')]?_0x5865df['options']['raw']===undefined?!![]:![]:!![],'where':_0x5865df[_0xf0f6('0x1e')]?_0x5865df[_0xf0f6('0x1e')][_0xf0f6('0x1f')]||null:null,'attributes':_0x5865df['options']?_0x5865df[_0xf0f6('0x1e')]['attributes']||null:null,'limit':_0x5865df[_0xf0f6('0x1e')]?_0x5865df[_0xf0f6('0x1e')][_0xf0f6('0x20')]||null:null,'include':_0x5865df[_0xf0f6('0x1e')]?_0x5865df['options']['include']?_[_0xf0f6('0x21')](_0x5865df['options'][_0xf0f6('0x22')],function(_0x24020a){return{'model':db[_0x24020a[_0xf0f6('0x23')]],'as':_0x24020a['as'],'attributes':_0x24020a[_0xf0f6('0x24')],'include':_0x24020a[_0xf0f6('0x22')]?_[_0xf0f6('0x21')](_0x24020a[_0xf0f6('0x22')],function(_0x3d4709){return{'model':db[_0x3d4709['model']],'as':_0x3d4709['as'],'attributes':_0x3d4709[_0xf0f6('0x24')],'include':_0x3d4709[_0xf0f6('0x22')]?_['map'](_0x3d4709[_0xf0f6('0x22')],function(_0x11ff9a){return{'model':db[_0x11ff9a[_0xf0f6('0x23')]],'as':_0x11ff9a['as'],'attributes':_0x11ff9a[_0xf0f6('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf0f6('0xf')](function(_0x1b5ed0){logger['info'](_0xf0f6('0x1b'),_0x5865df);logger[_0xf0f6('0x12')]('GetFaxQueue',_0x5865df,JSON[_0xf0f6('0x15')](_0x1b5ed0));_0x14888c(_0x1b5ed0);})['catch'](function(_0x246e94){logger[_0xf0f6('0x16')](_0xf0f6('0x1b'),_0x246e94[_0xf0f6('0x18')],_0x5865df);_0x16ae49(_0x172705[_0xf0f6('0x16')](0x1f4,_0x246e94['message']));});});};exports[_0xf0f6('0x25')]=function(_0x524fbd){var _0x198318=this;return new Promise(function(_0xa3c5df,_0x2f9e37){return db[_0xf0f6('0x1c')][_0xf0f6('0x26')]({'raw':_0x524fbd[_0xf0f6('0x1e')]?_0x524fbd[_0xf0f6('0x1e')][_0xf0f6('0x27')]===undefined?!![]:![]:!![],'where':_0x524fbd[_0xf0f6('0x1e')]?_0x524fbd[_0xf0f6('0x1e')][_0xf0f6('0x1f')]||null:null,'attributes':_0x524fbd['options']?_0x524fbd[_0xf0f6('0x1e')]['attributes']||null:null,'include':_0x524fbd['options']?_0x524fbd[_0xf0f6('0x1e')][_0xf0f6('0x22')]?_[_0xf0f6('0x21')](_0x524fbd[_0xf0f6('0x1e')][_0xf0f6('0x22')],function(_0x1ae36d){return{'model':db[_0x1ae36d[_0xf0f6('0x23')]],'as':_0x1ae36d['as'],'attributes':_0x1ae36d[_0xf0f6('0x24')],'include':_0x1ae36d[_0xf0f6('0x22')]?_[_0xf0f6('0x21')](_0x1ae36d[_0xf0f6('0x22')],function(_0x112955){return{'model':db[_0x112955['model']],'as':_0x112955['as'],'attributes':_0x112955[_0xf0f6('0x24')],'include':_0x112955[_0xf0f6('0x22')]?_[_0xf0f6('0x21')](_0x112955['include'],function(_0x3e49ce){return{'model':db[_0x3e49ce[_0xf0f6('0x23')]],'as':_0x3e49ce['as'],'attributes':_0x3e49ce[_0xf0f6('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf0f6('0xf')](function(_0xe06266){logger[_0xf0f6('0x10')](_0xf0f6('0x25'),_0x524fbd);logger['debug'](_0xf0f6('0x25'),_0x524fbd,JSON[_0xf0f6('0x15')](_0xe06266));_0xa3c5df(_0xe06266);})[_0xf0f6('0x1a')](function(_0xc80d1c){logger[_0xf0f6('0x16')]('ShowFaxQueue',_0xc80d1c['message'],_0x524fbd);_0x2f9e37(_0x198318[_0xf0f6('0x16')](0x1f4,_0xc80d1c['message']));});});}; \ No newline at end of file +var _0x3642=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','map','include','model','ShowFaxQueue','find','lodash','util','moment'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x3642,0x1d1));var _0x2364=function(_0xbebf50,_0x44ec09){_0xbebf50=_0xbebf50-0x0;var _0xce1496=_0x3642[_0xbebf50];return _0xce1496;};'use strict';var _=require(_0x2364('0x0'));var util=require(_0x2364('0x1'));var moment=require(_0x2364('0x2'));var BPromise=require('bluebird');var rs=require(_0x2364('0x3'));var fs=require('fs');var Redis=require(_0x2364('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2364('0x5'))(_0x2364('0x6'));var config=require(_0x2364('0x7'));var jayson=require(_0x2364('0x8'));var client=jayson['client'][_0x2364('0x9')]({'port':0x232a});config['redis']=_[_0x2364('0xa')](config['redis'],{'host':_0x2364('0xb'),'port':0x18eb});var socket=require(_0x2364('0xc'))(new Redis(config[_0x2364('0xd')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x1a10e2,_0x38920e,_0x1acdc6){return new BPromise(function(_0x41666e,_0x283227){return client[_0x2364('0xe')](_0x1a10e2,_0x1acdc6)[_0x2364('0xf')](function(_0x5406d0){logger[_0x2364('0x10')](_0x2364('0x11'),_0x38920e,_0x2364('0x12'));logger[_0x2364('0x13')](_0x2364('0x14'),_0x38920e,_0x2364('0x12'),JSON[_0x2364('0x15')](_0x5406d0));if(_0x5406d0[_0x2364('0x16')]){if(_0x5406d0[_0x2364('0x16')][_0x2364('0x17')]===0x1f4){logger[_0x2364('0x16')](_0x2364('0x11'),_0x38920e,_0x5406d0['error'][_0x2364('0x18')]);return _0x283227(_0x5406d0['error'][_0x2364('0x18')]);}logger[_0x2364('0x16')](_0x2364('0x11'),_0x38920e,_0x5406d0[_0x2364('0x16')][_0x2364('0x18')]);return _0x41666e(_0x5406d0[_0x2364('0x16')][_0x2364('0x18')]);}else{logger[_0x2364('0x10')](_0x2364('0x11'),_0x38920e,_0x2364('0x12'));_0x41666e(_0x5406d0[_0x2364('0x19')][_0x2364('0x18')]);}})[_0x2364('0x1a')](function(_0x1c0983){logger[_0x2364('0x16')]('FaxQueue,\x20%s,\x20%s',_0x38920e,_0x1c0983);_0x283227(_0x1c0983);});});}exports[_0x2364('0x1b')]=function(_0x2d8a46){var _0x2b313b=this;return new Promise(function(_0x3205ce,_0x30a563){return db[_0x2364('0x1c')][_0x2364('0x1d')]({'raw':_0x2d8a46[_0x2364('0x1e')]?_0x2d8a46[_0x2364('0x1e')][_0x2364('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d8a46[_0x2364('0x1e')]?_0x2d8a46[_0x2364('0x1e')][_0x2364('0x20')]||null:null,'attributes':_0x2d8a46[_0x2364('0x1e')]?_0x2d8a46[_0x2364('0x1e')][_0x2364('0x21')]||null:null,'limit':_0x2d8a46[_0x2364('0x1e')]?_0x2d8a46[_0x2364('0x1e')]['limit']||null:null,'include':_0x2d8a46[_0x2364('0x1e')]?_0x2d8a46[_0x2364('0x1e')]['include']?_[_0x2364('0x22')](_0x2d8a46[_0x2364('0x1e')][_0x2364('0x23')],function(_0x3e6efc){return{'model':db[_0x3e6efc[_0x2364('0x24')]],'as':_0x3e6efc['as'],'attributes':_0x3e6efc[_0x2364('0x21')],'include':_0x3e6efc[_0x2364('0x23')]?_[_0x2364('0x22')](_0x3e6efc[_0x2364('0x23')],function(_0x453166){return{'model':db[_0x453166[_0x2364('0x24')]],'as':_0x453166['as'],'attributes':_0x453166[_0x2364('0x21')],'include':_0x453166['include']?_['map'](_0x453166[_0x2364('0x23')],function(_0x24b090){return{'model':db[_0x24b090[_0x2364('0x24')]],'as':_0x24b090['as'],'attributes':_0x24b090[_0x2364('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4dd2a5){logger[_0x2364('0x10')](_0x2364('0x1b'),_0x2d8a46);logger['debug'](_0x2364('0x1b'),_0x2d8a46,JSON[_0x2364('0x15')](_0x4dd2a5));_0x3205ce(_0x4dd2a5);})['catch'](function(_0x5641cb){logger['error']('GetFaxQueue',_0x5641cb[_0x2364('0x18')],_0x2d8a46);_0x30a563(_0x2b313b['error'](0x1f4,_0x5641cb['message']));});});};exports[_0x2364('0x25')]=function(_0x2c37ac){var _0x458ca5=this;return new Promise(function(_0x4140d3,_0x35a62a){return db['FaxQueue'][_0x2364('0x26')]({'raw':_0x2c37ac['options']?_0x2c37ac[_0x2364('0x1e')][_0x2364('0x1f')]===undefined?!![]:![]:!![],'where':_0x2c37ac[_0x2364('0x1e')]?_0x2c37ac[_0x2364('0x1e')][_0x2364('0x20')]||null:null,'attributes':_0x2c37ac[_0x2364('0x1e')]?_0x2c37ac[_0x2364('0x1e')]['attributes']||null:null,'include':_0x2c37ac[_0x2364('0x1e')]?_0x2c37ac[_0x2364('0x1e')][_0x2364('0x23')]?_[_0x2364('0x22')](_0x2c37ac['options'][_0x2364('0x23')],function(_0x55f90a){return{'model':db[_0x55f90a[_0x2364('0x24')]],'as':_0x55f90a['as'],'attributes':_0x55f90a['attributes'],'include':_0x55f90a['include']?_[_0x2364('0x22')](_0x55f90a['include'],function(_0x3bbcd){return{'model':db[_0x3bbcd[_0x2364('0x24')]],'as':_0x3bbcd['as'],'attributes':_0x3bbcd['attributes'],'include':_0x3bbcd[_0x2364('0x23')]?_[_0x2364('0x22')](_0x3bbcd[_0x2364('0x23')],function(_0x188e77){return{'model':db[_0x188e77[_0x2364('0x24')]],'as':_0x188e77['as'],'attributes':_0x188e77[_0x2364('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2364('0xf')](function(_0x6648cd){logger[_0x2364('0x10')](_0x2364('0x25'),_0x2c37ac);logger['debug']('ShowFaxQueue',_0x2c37ac,JSON[_0x2364('0x15')](_0x6648cd));_0x4140d3(_0x6648cd);})[_0x2364('0x1a')](function(_0x5afdd5){logger[_0x2364('0x16')]('ShowFaxQueue',_0x5afdd5[_0x2364('0x18')],_0x2c37ac);_0x35a62a(_0x458ca5[_0x2364('0x16')](0x1f4,_0x5afdd5[_0x2364('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index cf4cb09..5c7b3be 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 _0xa0db=['length','./faxQueue.events','update','emit'];(function(_0x148187,_0x2c8d81){var _0x2863ce=function(_0x292695){while(--_0x292695){_0x148187['push'](_0x148187['shift']());}};_0x2863ce(++_0x2c8d81);}(_0xa0db,0xa9));var _0xba0d=function(_0x5c7128,_0x5ef9da){_0x5c7128=_0x5c7128-0x0;var _0x1ffd85=_0xa0db[_0x5c7128];return _0x1ffd85;};'use strict';var FaxQueueEvents=require(_0xba0d('0x0'));var events=['save','remove',_0xba0d('0x1')];function createListener(_0x506f5a,_0x19d2dc){return function(_0x5874ce){_0x19d2dc[_0xba0d('0x2')](_0x506f5a,_0x5874ce);};}function removeListener(_0x4d28f4,_0x578b78){return function(){FaxQueueEvents['removeListener'](_0x4d28f4,_0x578b78);};}exports['register']=function(_0x2d99fd){for(var _0x1bb276=0x0,_0x134d9b=events[_0xba0d('0x3')];_0x1bb276<_0x134d9b;_0x1bb276++){var _0x59f252=events[_0x1bb276];var _0x16980c=createListener('faxQueue:'+_0x59f252,_0x2d99fd);FaxQueueEvents['on'](_0x59f252,_0x16980c);}}; \ No newline at end of file +var _0x3903=['remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x4eb08a,_0x46333c){var _0x1ae5af=function(_0x175c27){while(--_0x175c27){_0x4eb08a['push'](_0x4eb08a['shift']());}};_0x1ae5af(++_0x46333c);}(_0x3903,0xe8));var _0x3390=function(_0x43e00b,_0x13cfc9){_0x43e00b=_0x43e00b-0x0;var _0x382a74=_0x3903[_0x43e00b];return _0x382a74;};'use strict';var FaxQueueEvents=require(_0x3390('0x0'));var events=[_0x3390('0x1'),_0x3390('0x2'),_0x3390('0x3')];function createListener(_0x1ad71b,_0x2a76f6){return function(_0x554918){_0x2a76f6[_0x3390('0x4')](_0x1ad71b,_0x554918);};}function removeListener(_0x2feb7b,_0x4367d5){return function(){FaxQueueEvents[_0x3390('0x5')](_0x2feb7b,_0x4367d5);};}exports[_0x3390('0x6')]=function(_0x3bb219){for(var _0x1bcd11=0x0,_0x36b544=events[_0x3390('0x7')];_0x1bcd11<_0x36b544;_0x1bcd11++){var _0x510f41=events[_0x1bcd11];var _0x5da4cb=createListener(_0x3390('0x8')+_0x510f41,_0x3bb219);FaxQueueEvents['on'](_0x510f41,_0x5da4cb);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6e3c3b7..374510e 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xb10b,0x12a));var _0xbb10=function(_0x17ba7d,_0x3d1ace){_0x17ba7d=_0x17ba7d-0x0;var _0x8fd171=_0xb10b[_0x17ba7d];return _0x8fd171;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _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(_0x34aec4,_0x3801da){var _0x51e1a7=function(_0x24e87f){while(--_0x24e87f){_0x34aec4['push'](_0x34aec4['shift']());}};_0x51e1a7(++_0x3801da);}(_0x0b0e,0x187));var _0xe0b0=function(_0x441f7a,_0x576321){_0x441f7a=_0x441f7a-0x0;var _0x4821da=_0x0b0e[_0x441f7a];return _0x4821da;};'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 0f788a3..bd8340e 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 _0x6310=['DATE','moment','sequelize','exports','STRING'];(function(_0x198f24,_0x5ca474){var _0x591e77=function(_0x25886b){while(--_0x25886b){_0x198f24['push'](_0x198f24['shift']());}};_0x591e77(++_0x5ca474);}(_0x6310,0x7e));var _0x0631=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x6310[_0x47aa64];return _0x549c7a;};'use strict';var moment=require(_0x0631('0x0'));var Sequelize=require(_0x0631('0x1'));module[_0x0631('0x2')]={'uniqueid':{'type':Sequelize[_0x0631('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0631('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0631('0x4')]},'acceptAt':{'type':Sequelize[_0x0631('0x4')]},'exitAt':{'type':Sequelize[_0x0631('0x4')]},'reason':{'type':Sequelize[_0x0631('0x3')]}}; \ No newline at end of file +var _0x95a2=['sequelize','exports','STRING','DATE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x95a2,0xdc));var _0x295a=function(_0x1dd034,_0x5f5a76){_0x1dd034=_0x1dd034-0x0;var _0x4ecb48=_0x95a2[_0x1dd034];return _0x4ecb48;};'use strict';var moment=require('moment');var Sequelize=require(_0x295a('0x0'));module[_0x295a('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x295a('0x2')]},'joinAt':{'type':Sequelize[_0x295a('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x295a('0x3')]},'exitAt':{'type':Sequelize[_0x295a('0x3')]},'reason':{'type':Sequelize[_0x295a('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 673452e..84a8c05 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 _0x4998=['params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','then','error','stack','name','send','map','FaxQueueReport','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','update'];(function(_0x394be6,_0x4da593){var _0x431e55=function(_0x4bab2c){while(--_0x4bab2c){_0x394be6['push'](_0x394be6['shift']());}};_0x431e55(++_0x4da593);}(_0x4998,0x11f));var _0x8499=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0x4998[_0x2ff762];return _0x158b02;};'use strict';var pdf=require(_0x8499('0x0'));var emlformat=require(_0x8499('0x1'));var rimraf=require(_0x8499('0x2'));var zipdir=require(_0x8499('0x3'));var jsonpatch=require(_0x8499('0x4'));var rp=require(_0x8499('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8499('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8499('0x7'));var csv=require('to-csv');var ejs=require(_0x8499('0x8'));var fs=require('fs');var _=require(_0x8499('0x9'));var squel=require(_0x8499('0xa'));var crypto=require(_0x8499('0xb'));var jsforce=require(_0x8499('0xc'));var deskjs=require(_0x8499('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8499('0xe'));var Papa=require(_0x8499('0xf'));var Redis=require(_0x8499('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8499('0x11'));var hardwareService=require(_0x8499('0x12'));var logger=require(_0x8499('0x13'))(_0x8499('0x14'));var utils=require('../../config/utils');var config=require(_0x8499('0x15'));var licenseUtil=require(_0x8499('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3230f0,_0x176372){_0x176372=_0x176372||0xcc;return function(_0xf63191){if(_0xf63191){return _0x3230f0[_0x8499('0x17')](_0x176372);}return _0x3230f0[_0x8499('0x18')](_0x176372)[_0x8499('0x19')]();};}function respondWithResult(_0x3a7cf5,_0x11a7e4){_0x11a7e4=_0x11a7e4||0xc8;return function(_0x53e2c4){if(_0x53e2c4){return _0x3a7cf5[_0x8499('0x18')](_0x11a7e4)['json'](_0x53e2c4);}};}function respondWithFilteredResult(_0x1db399,_0x5d86c5){return function(_0x4779f6){if(_0x4779f6){var _0x1d9a99=_0x4779f6['count'],_0x5df603=_0x5d86c5[_0x8499('0x1a')],_0x39d4b1=_0x5d86c5[_0x8499('0x1a')]+_0x5d86c5[_0x8499('0x1b')],_0x16c9b7;if(_0x39d4b1>=_0x1d9a99){_0x39d4b1=_0x1d9a99;_0x16c9b7=0xc8;}else{_0x16c9b7=0xce;}_0x1db399[_0x8499('0x18')](_0x16c9b7);return _0x1db399[_0x8499('0x1c')](_0x8499('0x1d'),_0x5df603+'-'+_0x39d4b1+'/'+_0x1d9a99)['json'](_0x4779f6);}return null;};}function patchUpdates(_0x7b2866){return function(_0x2cbd8a){try{jsonpatch[_0x8499('0x1e')](_0x2cbd8a,_0x7b2866,!![]);}catch(_0x47709d){return BPromise[_0x8499('0x1f')](_0x47709d);}return _0x2cbd8a['save']();};}function saveUpdates(_0x198d5b,_0x1d850f){return function(_0x3d3630){if(_0x3d3630){return _0x3d3630['update'](_0x198d5b)[_0x8499('0x20')](function(_0x45aaa0){return _0x45aaa0;});}return null;};}function removeEntity(_0x1eab44,_0x419173){return function(_0x1ad72d){if(_0x1ad72d){return _0x1ad72d['destroy']()[_0x8499('0x20')](function(){_0x1eab44[_0x8499('0x18')](0xcc)[_0x8499('0x19')]();});}};}function handleEntityNotFound(_0x26e629,_0x35bc2a){return function(_0x499bb4){if(!_0x499bb4){_0x26e629['sendStatus'](0x194);}return _0x499bb4;};}function handleError(_0x408acf,_0x2225ae){_0x2225ae=_0x2225ae||0x1f4;return function(_0x84330d){logger[_0x8499('0x21')](_0x84330d[_0x8499('0x22')]);if(_0x84330d['name']){delete _0x84330d[_0x8499('0x23')];}_0x408acf[_0x8499('0x18')](_0x2225ae)[_0x8499('0x24')](_0x84330d);};}exports['index']=function(_0x5190fc,_0x16fbe6){var _0x444fdf={},_0x4afeee={},_0x42a31c={'count':0x0,'rows':[]};var _0x53b350=_[_0x8499('0x25')](db[_0x8499('0x26')]['rawAttributes'],function(_0x31bf56){return{'name':_0x31bf56[_0x8499('0x27')],'type':_0x31bf56['type'][_0x8499('0x28')]};});_0x4afeee['model']=_[_0x8499('0x25')](_0x53b350,_0x8499('0x23'));_0x4afeee[_0x8499('0x29')]=_[_0x8499('0x2a')](_0x5190fc[_0x8499('0x29')]);_0x4afeee[_0x8499('0x2b')]=_[_0x8499('0x2c')](_0x4afeee[_0x8499('0x2d')],_0x4afeee[_0x8499('0x29')]);_0x444fdf['attributes']=_[_0x8499('0x2c')](_0x4afeee[_0x8499('0x2d')],qs[_0x8499('0x2e')](_0x5190fc[_0x8499('0x29')]['fields']));_0x444fdf[_0x8499('0x2f')]=_0x444fdf['attributes'][_0x8499('0x30')]?_0x444fdf[_0x8499('0x2f')]:_0x4afeee[_0x8499('0x2d')];if(!_0x5190fc[_0x8499('0x29')][_0x8499('0x31')](_0x8499('0x32'))){_0x444fdf[_0x8499('0x1b')]=qs[_0x8499('0x1b')](_0x5190fc['query'][_0x8499('0x1b')]);_0x444fdf[_0x8499('0x1a')]=qs[_0x8499('0x1a')](_0x5190fc[_0x8499('0x29')]['offset']);}_0x444fdf[_0x8499('0x33')]=qs['sort'](_0x5190fc[_0x8499('0x29')][_0x8499('0x34')]);_0x444fdf['where']=qs['filters'](_['pick'](_0x5190fc[_0x8499('0x29')],_0x4afeee[_0x8499('0x2b')]),_0x53b350);if(_0x5190fc[_0x8499('0x29')][_0x8499('0x35')]){_0x444fdf[_0x8499('0x36')]=_['merge'](_0x444fdf['where'],{'$or':_[_0x8499('0x25')](_0x53b350,function(_0x190fcc){if(_0x190fcc['type']!=='VIRTUAL'){var _0x2145e7={};_0x2145e7[_0x190fcc[_0x8499('0x23')]]={'$like':'%'+_0x5190fc[_0x8499('0x29')][_0x8499('0x35')]+'%'};return _0x2145e7;}})});}_0x444fdf=_[_0x8499('0x37')]({},_0x444fdf,_0x5190fc[_0x8499('0x38')]);var _0x39a8ef={'where':_0x444fdf[_0x8499('0x36')]};return db[_0x8499('0x26')][_0x8499('0x39')](_0x39a8ef)[_0x8499('0x20')](function(_0x5f26af){_0x42a31c[_0x8499('0x39')]=_0x5f26af;if(_0x5190fc[_0x8499('0x29')][_0x8499('0x3a')]){_0x444fdf[_0x8499('0x3b')]=[{'all':!![]}];}return db[_0x8499('0x26')][_0x8499('0x3c')](_0x444fdf);})[_0x8499('0x20')](function(_0x63af21){_0x42a31c[_0x8499('0x3d')]=_0x63af21;return _0x42a31c;})[_0x8499('0x20')](respondWithFilteredResult(_0x16fbe6,_0x444fdf))[_0x8499('0x3e')](handleError(_0x16fbe6,null));};exports[_0x8499('0x3f')]=function(_0x33205b,_0x176321){var _0xada25b={'raw':!![],'where':{'id':_0x33205b['params']['id']}},_0x403d10={};_0x403d10[_0x8499('0x2d')]=_[_0x8499('0x2a')](db[_0x8499('0x26')]['rawAttributes']);_0x403d10[_0x8499('0x29')]=_['keys'](_0x33205b[_0x8499('0x29')]);_0x403d10[_0x8499('0x2b')]=_[_0x8499('0x2c')](_0x403d10[_0x8499('0x2d')],_0x403d10[_0x8499('0x29')]);_0xada25b[_0x8499('0x2f')]=_[_0x8499('0x2c')](_0x403d10[_0x8499('0x2d')],qs[_0x8499('0x2e')](_0x33205b['query'][_0x8499('0x2e')]));_0xada25b[_0x8499('0x2f')]=_0xada25b[_0x8499('0x2f')][_0x8499('0x30')]?_0xada25b[_0x8499('0x2f')]:_0x403d10[_0x8499('0x2d')];if(_0x33205b[_0x8499('0x29')][_0x8499('0x3a')]){_0xada25b[_0x8499('0x3b')]=[{'all':!![]}];}_0xada25b=_[_0x8499('0x37')]({},_0xada25b,_0x33205b[_0x8499('0x38')]);return db[_0x8499('0x26')][_0x8499('0x40')](_0xada25b)['then'](handleEntityNotFound(_0x176321,null))[_0x8499('0x20')](respondWithResult(_0x176321,null))[_0x8499('0x3e')](handleError(_0x176321,null));};exports[_0x8499('0x41')]=function(_0x56e11e,_0x25a239){return db[_0x8499('0x26')][_0x8499('0x41')](_0x56e11e[_0x8499('0x42')],{})[_0x8499('0x20')](respondWithResult(_0x25a239,0xc9))['catch'](handleError(_0x25a239,null));};exports[_0x8499('0x43')]=function(_0x39b666,_0x1755ae){if(_0x39b666[_0x8499('0x42')]['id']){delete _0x39b666[_0x8499('0x42')]['id'];}return db['FaxQueueReport'][_0x8499('0x40')]({'where':{'id':_0x39b666[_0x8499('0x44')]['id']}})[_0x8499('0x20')](handleEntityNotFound(_0x1755ae,null))[_0x8499('0x20')](saveUpdates(_0x39b666['body'],null))[_0x8499('0x20')](respondWithResult(_0x1755ae,null))['catch'](handleError(_0x1755ae,null));};exports[_0x8499('0x45')]=function(_0x364895,_0x42998d){return db[_0x8499('0x26')][_0x8499('0x40')]({'where':{'id':_0x364895[_0x8499('0x44')]['id']}})['then'](handleEntityNotFound(_0x42998d,null))['then'](removeEntity(_0x42998d,null))[_0x8499('0x3e')](handleError(_0x42998d,null));};exports['describe']=function(_0xe20c5b,_0x2db3ee){return db['FaxQueueReport'][_0x8499('0x46')]()[_0x8499('0x20')](respondWithResult(_0x2db3ee,null))[_0x8499('0x3e')](handleError(_0x2db3ee,null));}; \ No newline at end of file +var _0x23dc=['keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','rawAttributes','options','catch','create','body','update','find','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','json','reject','destroy','then','sendStatus','error','name','send','index','map','FaxQueueReport','type','key','query'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x23dc,0x1c5));var _0xc23d=function(_0xf6e35e,_0x2eb7b8){_0xf6e35e=_0xf6e35e-0x0;var _0x5c84d2=_0x23dc[_0xf6e35e];return _0x5c84d2;};'use strict';var pdf=require(_0xc23d('0x0'));var emlformat=require(_0xc23d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc23d('0x2'));var moment=require(_0xc23d('0x3'));var BPromise=require(_0xc23d('0x4'));var Mustache=require(_0xc23d('0x5'));var util=require(_0xc23d('0x6'));var path=require(_0xc23d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc23d('0x8'));var squel=require('squel');var crypto=require(_0xc23d('0x9'));var jsforce=require(_0xc23d('0xa'));var deskjs=require(_0xc23d('0xb'));var toCsv=require(_0xc23d('0xc'));var querystring=require(_0xc23d('0xd'));var Papa=require(_0xc23d('0xe'));var Redis=require(_0xc23d('0xf'));var authService=require(_0xc23d('0x10'));var qs=require(_0xc23d('0x11'));var as=require(_0xc23d('0x12'));var hardwareService=require(_0xc23d('0x13'));var logger=require(_0xc23d('0x14'))('api');var utils=require(_0xc23d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc23d('0x16'));var db=require(_0xc23d('0x17'))['db'];function respondWithStatusCode(_0x5e9431,_0x53c5ba){_0x53c5ba=_0x53c5ba||0xcc;return function(_0x203c5c){if(_0x203c5c){return _0x5e9431['sendStatus'](_0x53c5ba);}return _0x5e9431[_0xc23d('0x18')](_0x53c5ba)[_0xc23d('0x19')]();};}function respondWithResult(_0x3948d1,_0x53f5b7){_0x53f5b7=_0x53f5b7||0xc8;return function(_0x597523){if(_0x597523){return _0x3948d1['status'](_0x53f5b7)['json'](_0x597523);}};}function respondWithFilteredResult(_0x29dd91,_0x4b6261){return function(_0x4c5627){if(_0x4c5627){var _0x4f7d73=_0x4c5627[_0xc23d('0x1a')],_0x4445d1=_0x4b6261[_0xc23d('0x1b')],_0x1f2abf=_0x4b6261['offset']+_0x4b6261[_0xc23d('0x1c')],_0xffc352;if(_0x1f2abf>=_0x4f7d73){_0x1f2abf=_0x4f7d73;_0xffc352=0xc8;}else{_0xffc352=0xce;}_0x29dd91['status'](_0xffc352);return _0x29dd91[_0xc23d('0x1d')]('Content-Range',_0x4445d1+'-'+_0x1f2abf+'/'+_0x4f7d73)[_0xc23d('0x1e')](_0x4c5627);}return null;};}function patchUpdates(_0x1d7336){return function(_0x596bd5){try{jsonpatch['apply'](_0x596bd5,_0x1d7336,!![]);}catch(_0xfcb49){return BPromise[_0xc23d('0x1f')](_0xfcb49);}return _0x596bd5['save']();};}function saveUpdates(_0x5ac44e,_0x7577e7){return function(_0x384a2b){if(_0x384a2b){return _0x384a2b['update'](_0x5ac44e)['then'](function(_0x2e2ade){return _0x2e2ade;});}return null;};}function removeEntity(_0x55762b,_0x188d97){return function(_0x5f470d){if(_0x5f470d){return _0x5f470d[_0xc23d('0x20')]()[_0xc23d('0x21')](function(){_0x55762b['status'](0xcc)[_0xc23d('0x19')]();});}};}function handleEntityNotFound(_0x1d5ce2,_0x5c500e){return function(_0x53d7e8){if(!_0x53d7e8){_0x1d5ce2[_0xc23d('0x22')](0x194);}return _0x53d7e8;};}function handleError(_0x2f2b62,_0x2611e1){_0x2611e1=_0x2611e1||0x1f4;return function(_0x51e5ac){logger[_0xc23d('0x23')](_0x51e5ac['stack']);if(_0x51e5ac[_0xc23d('0x24')]){delete _0x51e5ac[_0xc23d('0x24')];}_0x2f2b62[_0xc23d('0x18')](_0x2611e1)[_0xc23d('0x25')](_0x51e5ac);};}exports[_0xc23d('0x26')]=function(_0xec3208,_0x36d5b0){var _0x242470={},_0xc0aba8={},_0x4aa7fa={'count':0x0,'rows':[]};var _0x1e7bbf=_[_0xc23d('0x27')](db[_0xc23d('0x28')]['rawAttributes'],function(_0x1f89af){return{'name':_0x1f89af['fieldName'],'type':_0x1f89af[_0xc23d('0x29')][_0xc23d('0x2a')]};});_0xc0aba8['model']=_[_0xc23d('0x27')](_0x1e7bbf,_0xc23d('0x24'));_0xc0aba8[_0xc23d('0x2b')]=_[_0xc23d('0x2c')](_0xec3208[_0xc23d('0x2b')]);_0xc0aba8[_0xc23d('0x2d')]=_[_0xc23d('0x2e')](_0xc0aba8[_0xc23d('0x2f')],_0xc0aba8['query']);_0x242470[_0xc23d('0x30')]=_[_0xc23d('0x2e')](_0xc0aba8['model'],qs['fields'](_0xec3208[_0xc23d('0x2b')][_0xc23d('0x31')]));_0x242470[_0xc23d('0x30')]=_0x242470[_0xc23d('0x30')]['length']?_0x242470[_0xc23d('0x30')]:_0xc0aba8[_0xc23d('0x2f')];if(!_0xec3208['query']['hasOwnProperty'](_0xc23d('0x32'))){_0x242470['limit']=qs[_0xc23d('0x1c')](_0xec3208[_0xc23d('0x2b')][_0xc23d('0x1c')]);_0x242470['offset']=qs['offset'](_0xec3208['query'][_0xc23d('0x1b')]);}_0x242470[_0xc23d('0x33')]=qs[_0xc23d('0x34')](_0xec3208[_0xc23d('0x2b')][_0xc23d('0x34')]);_0x242470[_0xc23d('0x35')]=qs[_0xc23d('0x2d')](_[_0xc23d('0x36')](_0xec3208[_0xc23d('0x2b')],_0xc0aba8['filters']),_0x1e7bbf);if(_0xec3208[_0xc23d('0x2b')][_0xc23d('0x37')]){_0x242470[_0xc23d('0x35')]=_[_0xc23d('0x38')](_0x242470[_0xc23d('0x35')],{'$or':_[_0xc23d('0x27')](_0x1e7bbf,function(_0x3593d1){if(_0x3593d1['type']!==_0xc23d('0x39')){var _0x59e587={};_0x59e587[_0x3593d1[_0xc23d('0x24')]]={'$like':'%'+_0xec3208['query'][_0xc23d('0x37')]+'%'};return _0x59e587;}})});}_0x242470=_[_0xc23d('0x38')]({},_0x242470,_0xec3208['options']);var _0x17225d={'where':_0x242470[_0xc23d('0x35')]};return db[_0xc23d('0x28')][_0xc23d('0x1a')](_0x17225d)[_0xc23d('0x21')](function(_0x41e9f5){_0x4aa7fa[_0xc23d('0x1a')]=_0x41e9f5;if(_0xec3208[_0xc23d('0x2b')][_0xc23d('0x3a')]){_0x242470[_0xc23d('0x3b')]=[{'all':!![]}];}return db[_0xc23d('0x28')]['findAll'](_0x242470);})['then'](function(_0x1b8ad0){_0x4aa7fa[_0xc23d('0x3c')]=_0x1b8ad0;return _0x4aa7fa;})[_0xc23d('0x21')](respondWithFilteredResult(_0x36d5b0,_0x242470))['catch'](handleError(_0x36d5b0,null));};exports[_0xc23d('0x3d')]=function(_0x512470,_0x31a2e3){var _0x40d435={'raw':!![],'where':{'id':_0x512470[_0xc23d('0x3e')]['id']}},_0x5a9dd6={};_0x5a9dd6[_0xc23d('0x2f')]=_[_0xc23d('0x2c')](db['FaxQueueReport'][_0xc23d('0x3f')]);_0x5a9dd6[_0xc23d('0x2b')]=_[_0xc23d('0x2c')](_0x512470[_0xc23d('0x2b')]);_0x5a9dd6['filters']=_['intersection'](_0x5a9dd6['model'],_0x5a9dd6[_0xc23d('0x2b')]);_0x40d435[_0xc23d('0x30')]=_['intersection'](_0x5a9dd6[_0xc23d('0x2f')],qs[_0xc23d('0x31')](_0x512470['query'][_0xc23d('0x31')]));_0x40d435['attributes']=_0x40d435[_0xc23d('0x30')]['length']?_0x40d435['attributes']:_0x5a9dd6[_0xc23d('0x2f')];if(_0x512470[_0xc23d('0x2b')][_0xc23d('0x3a')]){_0x40d435[_0xc23d('0x3b')]=[{'all':!![]}];}_0x40d435=_['merge']({},_0x40d435,_0x512470[_0xc23d('0x40')]);return db[_0xc23d('0x28')]['find'](_0x40d435)[_0xc23d('0x21')](handleEntityNotFound(_0x31a2e3,null))[_0xc23d('0x21')](respondWithResult(_0x31a2e3,null))[_0xc23d('0x41')](handleError(_0x31a2e3,null));};exports[_0xc23d('0x42')]=function(_0x5338b7,_0x34f176){return db[_0xc23d('0x28')][_0xc23d('0x42')](_0x5338b7[_0xc23d('0x43')],{})[_0xc23d('0x21')](respondWithResult(_0x34f176,0xc9))['catch'](handleError(_0x34f176,null));};exports[_0xc23d('0x44')]=function(_0x471fb7,_0x3769f2){if(_0x471fb7[_0xc23d('0x43')]['id']){delete _0x471fb7[_0xc23d('0x43')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x471fb7[_0xc23d('0x3e')]['id']}})[_0xc23d('0x21')](handleEntityNotFound(_0x3769f2,null))[_0xc23d('0x21')](saveUpdates(_0x471fb7[_0xc23d('0x43')],null))[_0xc23d('0x21')](respondWithResult(_0x3769f2,null))['catch'](handleError(_0x3769f2,null));};exports[_0xc23d('0x20')]=function(_0x566e97,_0x1a66f8){return db[_0xc23d('0x28')][_0xc23d('0x45')]({'where':{'id':_0x566e97['params']['id']}})[_0xc23d('0x21')](handleEntityNotFound(_0x1a66f8,null))[_0xc23d('0x21')](removeEntity(_0x1a66f8,null))['catch'](handleError(_0x1a66f8,null));};exports[_0xc23d('0x46')]=function(_0x348af3,_0x2c6a67){return db['FaxQueueReport'][_0xc23d('0x46')]()[_0xc23d('0x21')](respondWithResult(_0x2c6a67,null))['catch'](handleError(_0x2c6a67,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d768e48..db27440 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 _0xe0db=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger','moment','bluebird'];(function(_0x19248a,_0x336725){var _0x562211=function(_0x33b91b){while(--_0x33b91b){_0x19248a['push'](_0x19248a['shift']());}};_0x562211(++_0x336725);}(_0xe0db,0x188));var _0xbe0d=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xe0db[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0xbe0d('0x0'));var util=require('util');var logger=require(_0xbe0d('0x1'))('api');var moment=require(_0xbe0d('0x2'));var BPromise=require(_0xbe0d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe0d('0x4'));var rimraf=require(_0xbe0d('0x5'));var config=require(_0xbe0d('0x6'));var attributes=require(_0xbe0d('0x7'));module[_0xbe0d('0x8')]=function(_0x12e310,_0x230ab1){return _0x12e310[_0xbe0d('0x9')](_0xbe0d('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xbe0d('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9829=['FaxQueueReport','report_fax_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define'];(function(_0x3c78ff,_0x30290d){var _0x35aa2f=function(_0x432405){while(--_0x432405){_0x3c78ff['push'](_0x3c78ff['shift']());}};_0x35aa2f(++_0x30290d);}(_0x9829,0xd5));var _0x9982=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0x9829[_0x58c20f];return _0x3b0318;};'use strict';var _=require('lodash');var util=require(_0x9982('0x0'));var logger=require(_0x9982('0x1'))(_0x9982('0x2'));var moment=require(_0x9982('0x3'));var BPromise=require(_0x9982('0x4'));var rp=require(_0x9982('0x5'));var fs=require('fs');var path=require(_0x9982('0x6'));var rimraf=require(_0x9982('0x7'));var config=require(_0x9982('0x8'));var attributes=require(_0x9982('0x9'));module[_0x9982('0xa')]=function(_0x56484c,_0x4facba){return _0x56484c[_0x9982('0xb')](_0x9982('0xc'),attributes,{'tableName':_0x9982('0xd'),'paranoid':![],'indexes':[{'name':_0x9982('0xe'),'fields':[_0x9982('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 9a0f37a..12e8395 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 _0xffe2=['client','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','create','body','options','CreateFaxQueueReport','catch','UpdateFaxQueueReport','FaxQueueReport','update','raw','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1cee55,_0xe75188){var _0x4f640a=function(_0x550c43){while(--_0x550c43){_0x1cee55['push'](_0x1cee55['shift']());}};_0x4f640a(++_0xe75188);}(_0xffe2,0x106));var _0x2ffe=function(_0x2b3198,_0xa9ead2){_0x2b3198=_0x2b3198-0x0;var _0x1206fa=_0xffe2[_0x2b3198];return _0x1206fa;};'use strict';var _=require(_0x2ffe('0x0'));var util=require(_0x2ffe('0x1'));var moment=require('moment');var BPromise=require(_0x2ffe('0x2'));var rs=require(_0x2ffe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ffe('0x4'))['db'];var utils=require(_0x2ffe('0x5'));var logger=require(_0x2ffe('0x6'))('rpc');var config=require(_0x2ffe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2ffe('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x776302,_0x5f0c4c,_0x3310fd){return new BPromise(function(_0x2d8f27,_0x3e544a){return client['request'](_0x776302,_0x3310fd)[_0x2ffe('0x9')](function(_0xa0f6a){logger['info'](_0x2ffe('0xa'),_0x5f0c4c,_0x2ffe('0xb'));logger[_0x2ffe('0xc')](_0x2ffe('0xd'),_0x5f0c4c,'request\x20sent',JSON[_0x2ffe('0xe')](_0xa0f6a));if(_0xa0f6a['error']){if(_0xa0f6a[_0x2ffe('0xf')]['code']===0x1f4){logger[_0x2ffe('0xf')](_0x2ffe('0xa'),_0x5f0c4c,_0xa0f6a[_0x2ffe('0xf')][_0x2ffe('0x10')]);return _0x3e544a(_0xa0f6a[_0x2ffe('0xf')]['message']);}logger[_0x2ffe('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x5f0c4c,_0xa0f6a[_0x2ffe('0xf')]['message']);return _0x2d8f27(_0xa0f6a['error'][_0x2ffe('0x10')]);}else{logger[_0x2ffe('0x11')](_0x2ffe('0xa'),_0x5f0c4c,_0x2ffe('0xb'));_0x2d8f27(_0xa0f6a[_0x2ffe('0x12')]['message']);}})['catch'](function(_0x2375c9){logger['error'](_0x2ffe('0xa'),_0x5f0c4c,_0x2375c9);_0x3e544a(_0x2375c9);});});}exports['CreateFaxQueueReport']=function(_0x2ad4ab){var _0x18d6c9=this;return new Promise(function(_0x32da09,_0x44d08b){return db['FaxQueueReport'][_0x2ffe('0x13')](_0x2ad4ab[_0x2ffe('0x14')],{'raw':_0x2ad4ab[_0x2ffe('0x15')]?_0x2ad4ab[_0x2ffe('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x2ffe('0x9')](function(_0x2b32ba){logger[_0x2ffe('0x11')](_0x2ffe('0x16'),_0x2ad4ab);logger[_0x2ffe('0xc')](_0x2ffe('0x16'),_0x2ad4ab,JSON[_0x2ffe('0xe')](_0x2b32ba));_0x32da09(_0x2b32ba);})[_0x2ffe('0x17')](function(_0x131bc9){logger[_0x2ffe('0xf')](_0x2ffe('0x16'),_0x131bc9[_0x2ffe('0x10')],_0x2ad4ab);_0x44d08b(_0x18d6c9['error'](0x1f4,_0x131bc9['message']));});});};exports[_0x2ffe('0x18')]=function(_0xbdc73f){var _0x5b41fe=this;return new Promise(function(_0xc7e6cd,_0x1f63fb){return db[_0x2ffe('0x19')][_0x2ffe('0x1a')](_0xbdc73f[_0x2ffe('0x14')],{'raw':_0xbdc73f[_0x2ffe('0x15')]?_0xbdc73f['options'][_0x2ffe('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbdc73f['options']?_0xbdc73f[_0x2ffe('0x15')]['where']||null:null,'attributes':_0xbdc73f[_0x2ffe('0x15')]?_0xbdc73f[_0x2ffe('0x15')][_0x2ffe('0x1c')]||null:null,'limit':_0xbdc73f[_0x2ffe('0x15')]?_0xbdc73f[_0x2ffe('0x15')][_0x2ffe('0x1d')]||null:null})[_0x2ffe('0x9')](function(_0x20faee){logger[_0x2ffe('0x11')](_0x2ffe('0x18'),_0xbdc73f);logger[_0x2ffe('0xc')]('UpdateFaxQueueReport',_0xbdc73f,JSON[_0x2ffe('0xe')](_0x20faee));_0xc7e6cd(_0x20faee);})[_0x2ffe('0x17')](function(_0x30d038){logger[_0x2ffe('0xf')](_0x2ffe('0x18'),_0x30d038[_0x2ffe('0x10')],_0xbdc73f);_0x1f63fb(_0x5b41fe[_0x2ffe('0xf')](0x1f4,_0x30d038[_0x2ffe('0x10')]));});});}; \ No newline at end of file +var _0xf4dc=['request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x6ac7e0,_0x50b7da){var _0x99a233=function(_0x30c556){while(--_0x30c556){_0x6ac7e0['push'](_0x6ac7e0['shift']());}};_0x99a233(++_0x50b7da);}(_0xf4dc,0xdc));var _0xcf4d=function(_0x94e948,_0x5f21f8){_0x94e948=_0x94e948-0x0;var _0x4e7744=_0xf4dc[_0x94e948];return _0x4e7744;};'use strict';var _=require(_0xcf4d('0x0'));var util=require(_0xcf4d('0x1'));var moment=require(_0xcf4d('0x2'));var BPromise=require(_0xcf4d('0x3'));var rs=require(_0xcf4d('0x4'));var fs=require('fs');var Redis=require(_0xcf4d('0x5'));var db=require(_0xcf4d('0x6'))['db'];var utils=require(_0xcf4d('0x7'));var logger=require(_0xcf4d('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf4d('0x9'));var client=jayson['client'][_0xcf4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b5f04,_0x467104,_0xe701ab){return new BPromise(function(_0x15c647,_0xee2c1a){return client[_0xcf4d('0xb')](_0x1b5f04,_0xe701ab)[_0xcf4d('0xc')](function(_0x4a4c92){logger[_0xcf4d('0xd')](_0xcf4d('0xe'),_0x467104,_0xcf4d('0xf'));logger[_0xcf4d('0x10')](_0xcf4d('0x11'),_0x467104,_0xcf4d('0xf'),JSON[_0xcf4d('0x12')](_0x4a4c92));if(_0x4a4c92[_0xcf4d('0x13')]){if(_0x4a4c92[_0xcf4d('0x13')][_0xcf4d('0x14')]===0x1f4){logger[_0xcf4d('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x467104,_0x4a4c92['error'][_0xcf4d('0x15')]);return _0xee2c1a(_0x4a4c92['error'][_0xcf4d('0x15')]);}logger[_0xcf4d('0x13')](_0xcf4d('0xe'),_0x467104,_0x4a4c92[_0xcf4d('0x13')][_0xcf4d('0x15')]);return _0x15c647(_0x4a4c92[_0xcf4d('0x13')]['message']);}else{logger[_0xcf4d('0xd')](_0xcf4d('0xe'),_0x467104,_0xcf4d('0xf'));_0x15c647(_0x4a4c92[_0xcf4d('0x16')][_0xcf4d('0x15')]);}})[_0xcf4d('0x17')](function(_0x2cc148){logger[_0xcf4d('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x467104,_0x2cc148);_0xee2c1a(_0x2cc148);});});}exports[_0xcf4d('0x18')]=function(_0x86a398){var _0x236617=this;return new Promise(function(_0x5b644b,_0x1f6df0){return db['FaxQueueReport'][_0xcf4d('0x19')](_0x86a398[_0xcf4d('0x1a')],{'raw':_0x86a398[_0xcf4d('0x1b')]?_0x86a398[_0xcf4d('0x1b')][_0xcf4d('0x1c')]===undefined?!![]:![]:!![]})[_0xcf4d('0xc')](function(_0x3f799c){logger[_0xcf4d('0xd')](_0xcf4d('0x18'),_0x86a398);logger[_0xcf4d('0x10')](_0xcf4d('0x18'),_0x86a398,JSON[_0xcf4d('0x12')](_0x3f799c));_0x5b644b(_0x3f799c);})[_0xcf4d('0x17')](function(_0x1535ea){logger[_0xcf4d('0x13')]('CreateFaxQueueReport',_0x1535ea[_0xcf4d('0x15')],_0x86a398);_0x1f6df0(_0x236617[_0xcf4d('0x13')](0x1f4,_0x1535ea['message']));});});};exports[_0xcf4d('0x1d')]=function(_0x80483e){var _0x458b64=this;return new Promise(function(_0x1ad0f8,_0x4f6b6b){return db['FaxQueueReport']['update'](_0x80483e[_0xcf4d('0x1a')],{'raw':_0x80483e['options']?_0x80483e['options'][_0xcf4d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x80483e[_0xcf4d('0x1b')]?_0x80483e[_0xcf4d('0x1b')][_0xcf4d('0x1e')]||null:null,'attributes':_0x80483e[_0xcf4d('0x1b')]?_0x80483e[_0xcf4d('0x1b')][_0xcf4d('0x1f')]||null:null,'limit':_0x80483e[_0xcf4d('0x1b')]?_0x80483e[_0xcf4d('0x1b')][_0xcf4d('0x20')]||null:null})['then'](function(_0x39ec70){logger[_0xcf4d('0xd')]('UpdateFaxQueueReport',_0x80483e);logger[_0xcf4d('0x10')](_0xcf4d('0x1d'),_0x80483e,JSON[_0xcf4d('0x12')](_0x39ec70));_0x1ad0f8(_0x39ec70);})[_0xcf4d('0x17')](function(_0x5dea1e){logger['error'](_0xcf4d('0x1d'),_0x5dea1e['message'],_0x80483e);_0x4f6b6b(_0x458b64[_0xcf4d('0x13')](0x1f4,_0x5dea1e['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 5d129e3..a257770 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 _0xa1e6=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x2b2571,_0x28ef2b){var _0x4169d1=function(_0x21ac44){while(--_0x21ac44){_0x2b2571['push'](_0x2b2571['shift']());}};_0x4169d1(++_0x28ef2b);}(_0xa1e6,0x190));var _0x6a1e=function(_0x5171ff,_0x134e0b){_0x5171ff=_0x5171ff-0x0;var _0x4a8584=_0xa1e6[_0x5171ff];return _0x4a8584;};'use strict';var multer=require('multer');var util=require(_0x6a1e('0x0'));var path=require(_0x6a1e('0x1'));var timeout=require(_0x6a1e('0x2'));var express=require(_0x6a1e('0x3'));var router=express[_0x6a1e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a1e('0x5'));var config=require(_0x6a1e('0x6'));var controller=require(_0x6a1e('0x7'));router['get']('/',auth[_0x6a1e('0x8')](),controller[_0x6a1e('0x9')]);router[_0x6a1e('0xa')]('/describe',auth[_0x6a1e('0x8')](),controller[_0x6a1e('0xb')]);router[_0x6a1e('0xa')](_0x6a1e('0xc'),auth['isAuthenticated'](),controller[_0x6a1e('0xd')]);router[_0x6a1e('0xe')]('/',auth[_0x6a1e('0x8')](),controller['create']);router[_0x6a1e('0xf')](_0x6a1e('0xc'),auth[_0x6a1e('0x8')](),controller[_0x6a1e('0x10')]);router[_0x6a1e('0x11')]('/:id',auth[_0x6a1e('0x8')](),controller[_0x6a1e('0x12')]);module[_0x6a1e('0x13')]=router; \ No newline at end of file +var _0x437f=['./faxQueueReport.controller','isAuthenticated','index','/describe','describe','get','show','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x15b225,_0x5f3355){var _0x5c3bcd=function(_0x280ed3){while(--_0x280ed3){_0x15b225['push'](_0x15b225['shift']());}};_0x5c3bcd(++_0x5f3355);}(_0x437f,0x91));var _0xf437=function(_0x1bb0b6,_0x1734b7){_0x1bb0b6=_0x1bb0b6-0x0;var _0x45f16b=_0x437f[_0x1bb0b6];return _0x45f16b;};'use strict';var multer=require(_0xf437('0x0'));var util=require(_0xf437('0x1'));var path=require(_0xf437('0x2'));var timeout=require(_0xf437('0x3'));var express=require(_0xf437('0x4'));var router=express[_0xf437('0x5')]();var auth=require(_0xf437('0x6'));var interaction=require(_0xf437('0x7'));var config=require(_0xf437('0x8'));var controller=require(_0xf437('0x9'));router['get']('/',auth[_0xf437('0xa')](),controller[_0xf437('0xb')]);router['get'](_0xf437('0xc'),auth[_0xf437('0xa')](),controller[_0xf437('0xd')]);router[_0xf437('0xe')]('/:id',auth[_0xf437('0xa')](),controller[_0xf437('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf437('0x10')]);router[_0xf437('0x11')](_0xf437('0x12'),auth[_0xf437('0xa')](),controller[_0xf437('0x13')]);router[_0xf437('0x14')](_0xf437('0x12'),auth[_0xf437('0xa')](),controller['destroy']);module[_0xf437('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 999a97d..86c3456 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 _0xe5e4=['sequelize','exports','agent','queue','DATE','NOW'];(function(_0x4adbde,_0x1446ff){var _0x32865e=function(_0x40946c){while(--_0x40946c){_0x4adbde['push'](_0x4adbde['shift']());}};_0x32865e(++_0x1446ff);}(_0xe5e4,0x174));var _0x4e5e=function(_0x2c9e3e,_0x3235d2){_0x2c9e3e=_0x2c9e3e-0x0;var _0x42051b=_0xe5e4[_0x2c9e3e];return _0x42051b;};'use strict';var moment=require('moment');var Sequelize=require(_0x4e5e('0x0'));module[_0x4e5e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x4e5e('0x2'),_0x4e5e('0x3')),'allowNull':![],'defaultValue':_0x4e5e('0x3')},'transferredAt':{'type':Sequelize[_0x4e5e('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x4e5e('0x5')]}}; \ No newline at end of file +var _0x7548=['exports','STRING','account','agent','queue','NOW','moment','sequelize'];(function(_0x372590,_0x1ebb65){var _0x21abe6=function(_0xce83f4){while(--_0xce83f4){_0x372590['push'](_0x372590['shift']());}};_0x21abe6(++_0x1ebb65);}(_0x7548,0xbe));var _0x8754=function(_0x51bd91,_0x45a3f3){_0x51bd91=_0x51bd91-0x0;var _0x65a7db=_0x7548[_0x51bd91];return _0x65a7db;};'use strict';var moment=require(_0x8754('0x0'));var Sequelize=require(_0x8754('0x1'));module[_0x8754('0x2')]={'uniqueid':{'type':Sequelize[_0x8754('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8754('0x4'),_0x8754('0x5'),_0x8754('0x6')),'allowNull':![],'defaultValue':_0x8754('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x8754('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 5b008c2..b34d0d7 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 _0x126e=['then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','FaxTransferReport','count','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x126e,0x108));var _0xe126=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x126e[_0xa1e3e3];return _0xc980e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe126('0x0'));var rimraf=require(_0xe126('0x1'));var zipdir=require(_0xe126('0x2'));var jsonpatch=require(_0xe126('0x3'));var rp=require(_0xe126('0x4'));var moment=require(_0xe126('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe126('0x6'));var util=require(_0xe126('0x7'));var path=require(_0xe126('0x8'));var sox=require(_0xe126('0x9'));var csv=require(_0xe126('0xa'));var ejs=require(_0xe126('0xb'));var fs=require('fs');var _=require(_0xe126('0xc'));var squel=require('squel');var crypto=require(_0xe126('0xd'));var jsforce=require(_0xe126('0xe'));var deskjs=require(_0xe126('0xf'));var toCsv=require(_0xe126('0xa'));var querystring=require(_0xe126('0x10'));var Papa=require('papaparse');var Redis=require(_0xe126('0x11'));var authService=require(_0xe126('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe126('0x13'));var hardwareService=require(_0xe126('0x14'));var logger=require('../../config/logger')(_0xe126('0x15'));var utils=require('../../config/utils');var config=require(_0xe126('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe126('0x17'))['db'];function respondWithStatusCode(_0x34ae06,_0x23ff02){_0x23ff02=_0x23ff02||0xcc;return function(_0x38b8c3){if(_0x38b8c3){return _0x34ae06[_0xe126('0x18')](_0x23ff02);}return _0x34ae06[_0xe126('0x19')](_0x23ff02)[_0xe126('0x1a')]();};}function respondWithResult(_0x55f10a,_0xd55baf){_0xd55baf=_0xd55baf||0xc8;return function(_0x1c02c9){if(_0x1c02c9){return _0x55f10a['status'](_0xd55baf)[_0xe126('0x1b')](_0x1c02c9);}};}function respondWithFilteredResult(_0x28d7dd,_0x10bc24){return function(_0x38b0c0){if(_0x38b0c0){var _0x5e52d1=_0x38b0c0['count'],_0x14bfb7=_0x10bc24[_0xe126('0x1c')],_0x3a4996=_0x10bc24['offset']+_0x10bc24[_0xe126('0x1d')],_0x1c32fe;if(_0x3a4996>=_0x5e52d1){_0x3a4996=_0x5e52d1;_0x1c32fe=0xc8;}else{_0x1c32fe=0xce;}_0x28d7dd[_0xe126('0x19')](_0x1c32fe);return _0x28d7dd[_0xe126('0x1e')](_0xe126('0x1f'),_0x14bfb7+'-'+_0x3a4996+'/'+_0x5e52d1)[_0xe126('0x1b')](_0x38b0c0);}return null;};}function patchUpdates(_0x2efb73){return function(_0x20874b){try{jsonpatch[_0xe126('0x20')](_0x20874b,_0x2efb73,!![]);}catch(_0x5cc73b){return BPromise[_0xe126('0x21')](_0x5cc73b);}return _0x20874b[_0xe126('0x22')]();};}function saveUpdates(_0x35ab64,_0x2e5617){return function(_0x1777e2){if(_0x1777e2){return _0x1777e2[_0xe126('0x23')](_0x35ab64)[_0xe126('0x24')](function(_0x9dd8d1){return _0x9dd8d1;});}return null;};}function removeEntity(_0x5257bc,_0x4a1a97){return function(_0xdb6544){if(_0xdb6544){return _0xdb6544[_0xe126('0x25')]()[_0xe126('0x24')](function(){_0x5257bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47f179,_0x4807d3){return function(_0x20378c){if(!_0x20378c){_0x47f179['sendStatus'](0x194);}return _0x20378c;};}function handleError(_0x264082,_0x2f05ec){_0x2f05ec=_0x2f05ec||0x1f4;return function(_0x4157ed){logger[_0xe126('0x26')](_0x4157ed['stack']);if(_0x4157ed['name']){delete _0x4157ed[_0xe126('0x27')];}_0x264082['status'](_0x2f05ec)[_0xe126('0x28')](_0x4157ed);};}exports[_0xe126('0x29')]=function(_0x630bcc,_0x5b31a4){var _0x45f55c={},_0x449309={},_0x4f5d09={'count':0x0,'rows':[]};var _0x5efeab=_[_0xe126('0x2a')](db['FaxTransferReport'][_0xe126('0x2b')],function(_0x1fb354){return{'name':_0x1fb354[_0xe126('0x2c')],'type':_0x1fb354[_0xe126('0x2d')]['key']};});_0x449309[_0xe126('0x2e')]=_[_0xe126('0x2a')](_0x5efeab,'name');_0x449309['query']=_[_0xe126('0x2f')](_0x630bcc['query']);_0x449309[_0xe126('0x30')]=_[_0xe126('0x31')](_0x449309[_0xe126('0x2e')],_0x449309['query']);_0x45f55c[_0xe126('0x32')]=_[_0xe126('0x31')](_0x449309[_0xe126('0x2e')],qs['fields'](_0x630bcc[_0xe126('0x33')][_0xe126('0x34')]));_0x45f55c['attributes']=_0x45f55c['attributes'][_0xe126('0x35')]?_0x45f55c[_0xe126('0x32')]:_0x449309[_0xe126('0x2e')];if(!_0x630bcc[_0xe126('0x33')][_0xe126('0x36')](_0xe126('0x37'))){_0x45f55c[_0xe126('0x1d')]=qs[_0xe126('0x1d')](_0x630bcc['query'][_0xe126('0x1d')]);_0x45f55c[_0xe126('0x1c')]=qs[_0xe126('0x1c')](_0x630bcc[_0xe126('0x33')][_0xe126('0x1c')]);}_0x45f55c[_0xe126('0x38')]=qs['sort'](_0x630bcc[_0xe126('0x33')][_0xe126('0x39')]);_0x45f55c[_0xe126('0x3a')]=qs[_0xe126('0x30')](_[_0xe126('0x3b')](_0x630bcc['query'],_0x449309[_0xe126('0x30')]),_0x5efeab);if(_0x630bcc[_0xe126('0x33')][_0xe126('0x3c')]){_0x45f55c[_0xe126('0x3a')]=_['merge'](_0x45f55c[_0xe126('0x3a')],{'$or':_[_0xe126('0x2a')](_0x5efeab,function(_0x471715){if(_0x471715[_0xe126('0x2d')]!==_0xe126('0x3d')){var _0x2fe73a={};_0x2fe73a[_0x471715['name']]={'$like':'%'+_0x630bcc[_0xe126('0x33')][_0xe126('0x3c')]+'%'};return _0x2fe73a;}})});}_0x45f55c=_[_0xe126('0x3e')]({},_0x45f55c,_0x630bcc['options']);var _0x5073bc={'where':_0x45f55c[_0xe126('0x3a')]};return db[_0xe126('0x3f')][_0xe126('0x40')](_0x5073bc)[_0xe126('0x24')](function(_0x2caea4){_0x4f5d09[_0xe126('0x40')]=_0x2caea4;if(_0x630bcc['query'][_0xe126('0x41')]){_0x45f55c[_0xe126('0x42')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xe126('0x43')](_0x45f55c);})[_0xe126('0x24')](function(_0x9c5767){_0x4f5d09['rows']=_0x9c5767;return _0x4f5d09;})[_0xe126('0x24')](respondWithFilteredResult(_0x5b31a4,_0x45f55c))[_0xe126('0x44')](handleError(_0x5b31a4,null));};exports['show']=function(_0x130a1f,_0x366754){var _0x5629a8={'raw':!![],'where':{'id':_0x130a1f['params']['id']}},_0x3e168d={};_0x3e168d[_0xe126('0x2e')]=_[_0xe126('0x2f')](db['FaxTransferReport'][_0xe126('0x2b')]);_0x3e168d[_0xe126('0x33')]=_[_0xe126('0x2f')](_0x130a1f['query']);_0x3e168d[_0xe126('0x30')]=_['intersection'](_0x3e168d[_0xe126('0x2e')],_0x3e168d[_0xe126('0x33')]);_0x5629a8[_0xe126('0x32')]=_[_0xe126('0x31')](_0x3e168d[_0xe126('0x2e')],qs[_0xe126('0x34')](_0x130a1f[_0xe126('0x33')][_0xe126('0x34')]));_0x5629a8[_0xe126('0x32')]=_0x5629a8[_0xe126('0x32')][_0xe126('0x35')]?_0x5629a8['attributes']:_0x3e168d['model'];if(_0x130a1f[_0xe126('0x33')][_0xe126('0x41')]){_0x5629a8['include']=[{'all':!![]}];}_0x5629a8=_[_0xe126('0x3e')]({},_0x5629a8,_0x130a1f[_0xe126('0x45')]);return db[_0xe126('0x3f')][_0xe126('0x46')](_0x5629a8)['then'](handleEntityNotFound(_0x366754,null))[_0xe126('0x24')](respondWithResult(_0x366754,null))[_0xe126('0x44')](handleError(_0x366754,null));};exports[_0xe126('0x47')]=function(_0x45ac4a,_0x376f9e){return db[_0xe126('0x3f')][_0xe126('0x47')](_0x45ac4a[_0xe126('0x48')],{})[_0xe126('0x24')](respondWithResult(_0x376f9e,0xc9))[_0xe126('0x44')](handleError(_0x376f9e,null));};exports[_0xe126('0x23')]=function(_0x237181,_0x24c312){if(_0x237181['body']['id']){delete _0x237181['body']['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x237181[_0xe126('0x49')]['id']}})[_0xe126('0x24')](handleEntityNotFound(_0x24c312,null))[_0xe126('0x24')](saveUpdates(_0x237181[_0xe126('0x48')],null))[_0xe126('0x24')](respondWithResult(_0x24c312,null))[_0xe126('0x44')](handleError(_0x24c312,null));};exports[_0xe126('0x25')]=function(_0x5ece85,_0x58b1ef){return db[_0xe126('0x3f')][_0xe126('0x46')]({'where':{'id':_0x5ece85['params']['id']}})[_0xe126('0x24')](handleEntityNotFound(_0x58b1ef,null))[_0xe126('0x24')](removeEntity(_0x58b1ef,null))['catch'](handleError(_0x58b1ef,null));};exports[_0xe126('0x4a')]=function(_0x26b0ef,_0x5e3300){return db['FaxTransferReport'][_0xe126('0x4a')]()[_0xe126('0x24')](respondWithResult(_0x5e3300,null))[_0xe126('0x44')](handleError(_0x5e3300,null));}; \ No newline at end of file +var _0xf767=['end','count','offset','apply','save','then','status','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','filters','filter','where','VIRTUAL','options','FaxTransferReport','includeAll','include','rows','catch','show','params','merge','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x7f39b8,_0x28971e){var _0x5eb05d=function(_0x384890){while(--_0x384890){_0x7f39b8['push'](_0x7f39b8['shift']());}};_0x5eb05d(++_0x28971e);}(_0xf767,0x76));var _0x7f76=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xf767[_0x99868f];return _0x27a71b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7f76('0x0'));var rimraf=require(_0x7f76('0x1'));var zipdir=require(_0x7f76('0x2'));var jsonpatch=require(_0x7f76('0x3'));var rp=require(_0x7f76('0x4'));var moment=require('moment');var BPromise=require(_0x7f76('0x5'));var Mustache=require(_0x7f76('0x6'));var util=require(_0x7f76('0x7'));var path=require(_0x7f76('0x8'));var sox=require('sox');var csv=require(_0x7f76('0x9'));var ejs=require(_0x7f76('0xa'));var fs=require('fs');var _=require(_0x7f76('0xb'));var squel=require(_0x7f76('0xc'));var crypto=require(_0x7f76('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f76('0xe'));var toCsv=require(_0x7f76('0x9'));var querystring=require(_0x7f76('0xf'));var Papa=require(_0x7f76('0x10'));var Redis=require('ioredis');var authService=require(_0x7f76('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7f76('0x12'));var hardwareService=require(_0x7f76('0x13'));var logger=require(_0x7f76('0x14'))(_0x7f76('0x15'));var utils=require(_0x7f76('0x16'));var config=require(_0x7f76('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f76('0x18'))['db'];function respondWithStatusCode(_0x2cd1b3,_0x47403b){_0x47403b=_0x47403b||0xcc;return function(_0x32392b){if(_0x32392b){return _0x2cd1b3[_0x7f76('0x19')](_0x47403b);}return _0x2cd1b3['status'](_0x47403b)[_0x7f76('0x1a')]();};}function respondWithResult(_0x4d8de0,_0x42a9d3){_0x42a9d3=_0x42a9d3||0xc8;return function(_0x256f79){if(_0x256f79){return _0x4d8de0['status'](_0x42a9d3)['json'](_0x256f79);}};}function respondWithFilteredResult(_0x58d2f3,_0xe81aa9){return function(_0x2df2db){if(_0x2df2db){var _0x286e96=_0x2df2db[_0x7f76('0x1b')],_0x4f1b9c=_0xe81aa9[_0x7f76('0x1c')],_0x3d32e6=_0xe81aa9[_0x7f76('0x1c')]+_0xe81aa9['limit'],_0x522a2c;if(_0x3d32e6>=_0x286e96){_0x3d32e6=_0x286e96;_0x522a2c=0xc8;}else{_0x522a2c=0xce;}_0x58d2f3['status'](_0x522a2c);return _0x58d2f3['set']('Content-Range',_0x4f1b9c+'-'+_0x3d32e6+'/'+_0x286e96)['json'](_0x2df2db);}return null;};}function patchUpdates(_0xd2e9a9){return function(_0xdb1407){try{jsonpatch[_0x7f76('0x1d')](_0xdb1407,_0xd2e9a9,!![]);}catch(_0x21c2ca){return BPromise['reject'](_0x21c2ca);}return _0xdb1407[_0x7f76('0x1e')]();};}function saveUpdates(_0x557c0f,_0x38c4d6){return function(_0x39ec40){if(_0x39ec40){return _0x39ec40['update'](_0x557c0f)['then'](function(_0x15477){return _0x15477;});}return null;};}function removeEntity(_0xb647d8,_0x5efed5){return function(_0x3f2536){if(_0x3f2536){return _0x3f2536['destroy']()[_0x7f76('0x1f')](function(){_0xb647d8[_0x7f76('0x20')](0xcc)[_0x7f76('0x1a')]();});}};}function handleEntityNotFound(_0x3deb00,_0x3eea75){return function(_0x5cdaf7){if(!_0x5cdaf7){_0x3deb00[_0x7f76('0x19')](0x194);}return _0x5cdaf7;};}function handleError(_0x584a11,_0x4ad7ae){_0x4ad7ae=_0x4ad7ae||0x1f4;return function(_0x197519){logger[_0x7f76('0x21')](_0x197519[_0x7f76('0x22')]);if(_0x197519['name']){delete _0x197519[_0x7f76('0x23')];}_0x584a11[_0x7f76('0x20')](_0x4ad7ae)[_0x7f76('0x24')](_0x197519);};}exports[_0x7f76('0x25')]=function(_0x27a030,_0x5811eb){var _0x13f3c9={},_0xd6584d={},_0x523d7a={'count':0x0,'rows':[]};var _0x4ee0b0=_[_0x7f76('0x26')](db['FaxTransferReport'][_0x7f76('0x27')],function(_0x3542e3){return{'name':_0x3542e3[_0x7f76('0x28')],'type':_0x3542e3[_0x7f76('0x29')][_0x7f76('0x2a')]};});_0xd6584d[_0x7f76('0x2b')]=_['map'](_0x4ee0b0,_0x7f76('0x23'));_0xd6584d[_0x7f76('0x2c')]=_[_0x7f76('0x2d')](_0x27a030[_0x7f76('0x2c')]);_0xd6584d['filters']=_[_0x7f76('0x2e')](_0xd6584d[_0x7f76('0x2b')],_0xd6584d[_0x7f76('0x2c')]);_0x13f3c9['attributes']=_[_0x7f76('0x2e')](_0xd6584d[_0x7f76('0x2b')],qs[_0x7f76('0x2f')](_0x27a030[_0x7f76('0x2c')][_0x7f76('0x2f')]));_0x13f3c9[_0x7f76('0x30')]=_0x13f3c9[_0x7f76('0x30')][_0x7f76('0x31')]?_0x13f3c9[_0x7f76('0x30')]:_0xd6584d[_0x7f76('0x2b')];if(!_0x27a030[_0x7f76('0x2c')][_0x7f76('0x32')](_0x7f76('0x33'))){_0x13f3c9['limit']=qs[_0x7f76('0x34')](_0x27a030[_0x7f76('0x2c')][_0x7f76('0x34')]);_0x13f3c9[_0x7f76('0x1c')]=qs[_0x7f76('0x1c')](_0x27a030[_0x7f76('0x2c')][_0x7f76('0x1c')]);}_0x13f3c9[_0x7f76('0x35')]=qs['sort'](_0x27a030[_0x7f76('0x2c')]['sort']);_0x13f3c9['where']=qs[_0x7f76('0x36')](_['pick'](_0x27a030[_0x7f76('0x2c')],_0xd6584d[_0x7f76('0x36')]),_0x4ee0b0);if(_0x27a030['query'][_0x7f76('0x37')]){_0x13f3c9['where']=_['merge'](_0x13f3c9[_0x7f76('0x38')],{'$or':_[_0x7f76('0x26')](_0x4ee0b0,function(_0x445d2d){if(_0x445d2d[_0x7f76('0x29')]!==_0x7f76('0x39')){var _0x55036c={};_0x55036c[_0x445d2d[_0x7f76('0x23')]]={'$like':'%'+_0x27a030[_0x7f76('0x2c')]['filter']+'%'};return _0x55036c;}})});}_0x13f3c9=_['merge']({},_0x13f3c9,_0x27a030[_0x7f76('0x3a')]);var _0x4ea167={'where':_0x13f3c9[_0x7f76('0x38')]};return db[_0x7f76('0x3b')][_0x7f76('0x1b')](_0x4ea167)['then'](function(_0x2e1b96){_0x523d7a[_0x7f76('0x1b')]=_0x2e1b96;if(_0x27a030[_0x7f76('0x2c')][_0x7f76('0x3c')]){_0x13f3c9[_0x7f76('0x3d')]=[{'all':!![]}];}return db[_0x7f76('0x3b')]['findAll'](_0x13f3c9);})['then'](function(_0x218370){_0x523d7a[_0x7f76('0x3e')]=_0x218370;return _0x523d7a;})[_0x7f76('0x1f')](respondWithFilteredResult(_0x5811eb,_0x13f3c9))[_0x7f76('0x3f')](handleError(_0x5811eb,null));};exports[_0x7f76('0x40')]=function(_0x15c5ba,_0x401284){var _0x206d94={'raw':!![],'where':{'id':_0x15c5ba[_0x7f76('0x41')]['id']}},_0x211cb3={};_0x211cb3[_0x7f76('0x2b')]=_[_0x7f76('0x2d')](db[_0x7f76('0x3b')][_0x7f76('0x27')]);_0x211cb3[_0x7f76('0x2c')]=_[_0x7f76('0x2d')](_0x15c5ba[_0x7f76('0x2c')]);_0x211cb3[_0x7f76('0x36')]=_['intersection'](_0x211cb3[_0x7f76('0x2b')],_0x211cb3[_0x7f76('0x2c')]);_0x206d94[_0x7f76('0x30')]=_['intersection'](_0x211cb3['model'],qs[_0x7f76('0x2f')](_0x15c5ba['query'][_0x7f76('0x2f')]));_0x206d94['attributes']=_0x206d94['attributes'][_0x7f76('0x31')]?_0x206d94[_0x7f76('0x30')]:_0x211cb3[_0x7f76('0x2b')];if(_0x15c5ba[_0x7f76('0x2c')][_0x7f76('0x3c')]){_0x206d94[_0x7f76('0x3d')]=[{'all':!![]}];}_0x206d94=_[_0x7f76('0x42')]({},_0x206d94,_0x15c5ba[_0x7f76('0x3a')]);return db[_0x7f76('0x3b')][_0x7f76('0x43')](_0x206d94)[_0x7f76('0x1f')](handleEntityNotFound(_0x401284,null))[_0x7f76('0x1f')](respondWithResult(_0x401284,null))[_0x7f76('0x3f')](handleError(_0x401284,null));};exports[_0x7f76('0x44')]=function(_0x5b62ef,_0x450c49){return db['FaxTransferReport'][_0x7f76('0x44')](_0x5b62ef[_0x7f76('0x45')],{})[_0x7f76('0x1f')](respondWithResult(_0x450c49,0xc9))[_0x7f76('0x3f')](handleError(_0x450c49,null));};exports['update']=function(_0x16ffcd,_0x442ba9){if(_0x16ffcd[_0x7f76('0x45')]['id']){delete _0x16ffcd[_0x7f76('0x45')]['id'];}return db['FaxTransferReport'][_0x7f76('0x43')]({'where':{'id':_0x16ffcd[_0x7f76('0x41')]['id']}})['then'](handleEntityNotFound(_0x442ba9,null))[_0x7f76('0x1f')](saveUpdates(_0x16ffcd[_0x7f76('0x45')],null))[_0x7f76('0x1f')](respondWithResult(_0x442ba9,null))['catch'](handleError(_0x442ba9,null));};exports[_0x7f76('0x46')]=function(_0x44c8f5,_0x19d7dd){return db[_0x7f76('0x3b')][_0x7f76('0x43')]({'where':{'id':_0x44c8f5[_0x7f76('0x41')]['id']}})[_0x7f76('0x1f')](handleEntityNotFound(_0x19d7dd,null))[_0x7f76('0x1f')](removeEntity(_0x19d7dd,null))[_0x7f76('0x3f')](handleError(_0x19d7dd,null));};exports[_0x7f76('0x47')]=function(_0x3acaad,_0x1fa5af){return db['FaxTransferReport'][_0x7f76('0x47')]()['then'](respondWithResult(_0x1fa5af,null))[_0x7f76('0x3f')](handleError(_0x1fa5af,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index aacacf6..42439cb 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 _0x4de9=['rimraf','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','api','moment','bluebird','request-promise'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4de9,0xb0));var _0x94de=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0x4de9[_0x20d54d];return _0x516e8b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x94de('0x0'));var moment=require(_0x94de('0x1'));var BPromise=require(_0x94de('0x2'));var rp=require(_0x94de('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94de('0x4'));var config=require('../../config/environment');var attributes=require(_0x94de('0x5'));module['exports']=function(_0xa190cb,_0x5750fc){return _0xa190cb[_0x94de('0x6')](_0x94de('0x7'),attributes,{'tableName':_0x94de('0x8'),'paranoid':![],'indexes':[{'name':_0x94de('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c0c=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','FaxTransferReport'];(function(_0x2af5bd,_0x1465b9){var _0x294d2f=function(_0x5013e3){while(--_0x5013e3){_0x2af5bd['push'](_0x2af5bd['shift']());}};_0x294d2f(++_0x1465b9);}(_0x4c0c,0x1a2));var _0xc4c0=function(_0xb8ba53,_0x51bf17){_0xb8ba53=_0xb8ba53-0x0;var _0x32a9df=_0x4c0c[_0xb8ba53];return _0x32a9df;};'use strict';var _=require(_0xc4c0('0x0'));var util=require(_0xc4c0('0x1'));var logger=require(_0xc4c0('0x2'))(_0xc4c0('0x3'));var moment=require('moment');var BPromise=require(_0xc4c0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4c0('0x5'));var rimraf=require(_0xc4c0('0x6'));var config=require(_0xc4c0('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0xc4c0('0x8')]=function(_0x2591c0,_0x2d3f64){return _0x2591c0[_0xc4c0('0x9')](_0xc4c0('0xa'),attributes,{'tableName':_0xc4c0('0xb'),'paranoid':![],'indexes':[{'name':_0xc4c0('0xc'),'fields':[_0xc4c0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 8bed893..23d7065 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 _0x1158=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5702b0,_0x4df655){var _0x5ec006=function(_0x3313bd){while(--_0x3313bd){_0x5702b0['push'](_0x5702b0['shift']());}};_0x5ec006(++_0x4df655);}(_0x1158,0x1de));var _0x8115=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1158[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x8115('0x0'));var util=require(_0x8115('0x1'));var moment=require('moment');var BPromise=require(_0x8115('0x2'));var rs=require(_0x8115('0x3'));var fs=require('fs');var Redis=require(_0x8115('0x4'));var db=require(_0x8115('0x5'))['db'];var utils=require(_0x8115('0x6'));var logger=require(_0x8115('0x7'))(_0x8115('0x8'));var config=require(_0x8115('0x9'));var jayson=require(_0x8115('0xa'));var client=jayson[_0x8115('0xb')][_0x8115('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1eda30,_0x39a8d1,_0xca7dec){return new BPromise(function(_0x4ea4fa,_0xaceb3a){return client[_0x8115('0xd')](_0x1eda30,_0xca7dec)[_0x8115('0xe')](function(_0x29d53d){logger['info'](_0x8115('0xf'),_0x39a8d1,_0x8115('0x10'));logger[_0x8115('0x11')](_0x8115('0x12'),_0x39a8d1,_0x8115('0x10'),JSON[_0x8115('0x13')](_0x29d53d));if(_0x29d53d[_0x8115('0x14')]){if(_0x29d53d[_0x8115('0x14')][_0x8115('0x15')]===0x1f4){logger[_0x8115('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x39a8d1,_0x29d53d[_0x8115('0x14')][_0x8115('0x16')]);return _0xaceb3a(_0x29d53d['error'][_0x8115('0x16')]);}logger['error'](_0x8115('0xf'),_0x39a8d1,_0x29d53d['error'][_0x8115('0x16')]);return _0x4ea4fa(_0x29d53d[_0x8115('0x14')][_0x8115('0x16')]);}else{logger['info'](_0x8115('0xf'),_0x39a8d1,_0x8115('0x10'));_0x4ea4fa(_0x29d53d[_0x8115('0x17')][_0x8115('0x16')]);}})[_0x8115('0x18')](function(_0x3a86bd){logger[_0x8115('0x14')](_0x8115('0xf'),_0x39a8d1,_0x3a86bd);_0xaceb3a(_0x3a86bd);});});} \ No newline at end of file +var _0x6b78=['error','message','catch','util','moment','ioredis','../../config/utils','rpc','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x39d980,_0x15c127){var _0x33fcbc=function(_0x32548a){while(--_0x32548a){_0x39d980['push'](_0x39d980['shift']());}};_0x33fcbc(++_0x15c127);}(_0x6b78,0xff));var _0x86b7=function(_0x14f4be,_0xbc5de8){_0x14f4be=_0x14f4be-0x0;var _0x5c1195=_0x6b78[_0x14f4be];return _0x5c1195;};'use strict';var _=require('lodash');var util=require(_0x86b7('0x0'));var moment=require(_0x86b7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86b7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x86b7('0x3'));var logger=require('../../config/logger')(_0x86b7('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x86b7('0x5')][_0x86b7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2b909f,_0x4d2b08,_0x287085){return new BPromise(function(_0x4e7f52,_0x144458){return client[_0x86b7('0x7')](_0x2b909f,_0x287085)[_0x86b7('0x8')](function(_0x4c5e83){logger[_0x86b7('0x9')](_0x86b7('0xa'),_0x4d2b08,_0x86b7('0xb'));logger[_0x86b7('0xc')](_0x86b7('0xd'),_0x4d2b08,_0x86b7('0xb'),JSON[_0x86b7('0xe')](_0x4c5e83));if(_0x4c5e83[_0x86b7('0xf')]){if(_0x4c5e83['error']['code']===0x1f4){logger[_0x86b7('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x4d2b08,_0x4c5e83[_0x86b7('0xf')]['message']);return _0x144458(_0x4c5e83[_0x86b7('0xf')][_0x86b7('0x10')]);}logger[_0x86b7('0xf')](_0x86b7('0xa'),_0x4d2b08,_0x4c5e83['error']['message']);return _0x4e7f52(_0x4c5e83[_0x86b7('0xf')][_0x86b7('0x10')]);}else{logger[_0x86b7('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0x4d2b08,_0x86b7('0xb'));_0x4e7f52(_0x4c5e83['result'][_0x86b7('0x10')]);}})[_0x86b7('0x11')](function(_0x315d11){logger[_0x86b7('0xf')](_0x86b7('0xa'),_0x4d2b08,_0x315d11);_0x144458(_0x315d11);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index d32df6f..2a32d0d 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 _0x37d4=['put','update','delete','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0xc7dac8,_0x4d9afd){var _0x5638e5=function(_0x5e530b){while(--_0x5e530b){_0xc7dac8['push'](_0xc7dac8['shift']());}};_0x5638e5(++_0x4d9afd);}(_0x37d4,0xd4));var _0x437d=function(_0x28ddff,_0x16f29a){_0x28ddff=_0x28ddff-0x0;var _0x3744af=_0x37d4[_0x28ddff];return _0x3744af;};'use strict';var multer=require('multer');var util=require(_0x437d('0x0'));var path=require(_0x437d('0x1'));var timeout=require(_0x437d('0x2'));var express=require(_0x437d('0x3'));var router=express['Router']();var auth=require(_0x437d('0x4'));var interaction=require(_0x437d('0x5'));var config=require(_0x437d('0x6'));var controller=require(_0x437d('0x7'));router[_0x437d('0x8')]('/',auth['isAuthenticated'](),controller[_0x437d('0x9')]);router['get'](_0x437d('0xa'),auth[_0x437d('0xb')](),controller[_0x437d('0xc')]);router[_0x437d('0x8')](_0x437d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x437d('0xe')]('/',auth['isAuthenticated'](),controller[_0x437d('0xf')]);router[_0x437d('0x10')](_0x437d('0xd'),auth['isAuthenticated'](),controller[_0x437d('0x11')]);router[_0x437d('0x12')](_0x437d('0xd'),auth[_0x437d('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1afb=['put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','get','/describe','describe','post'];(function(_0x9b9d30,_0x25379f){var _0x12caae=function(_0xa4ace4){while(--_0xa4ace4){_0x9b9d30['push'](_0x9b9d30['shift']());}};_0x12caae(++_0x25379f);}(_0x1afb,0x112));var _0xb1af=function(_0xfd7831,_0x50f83a){_0xfd7831=_0xfd7831-0x0;var _0x4df499=_0x1afb[_0xfd7831];return _0x4df499;};'use strict';var multer=require(_0xb1af('0x0'));var util=require(_0xb1af('0x1'));var path=require(_0xb1af('0x2'));var timeout=require(_0xb1af('0x3'));var express=require(_0xb1af('0x4'));var router=express[_0xb1af('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb1af('0x6'));var config=require(_0xb1af('0x7'));var controller=require(_0xb1af('0x8'));router['get']('/',auth[_0xb1af('0x9')](),controller['index']);router[_0xb1af('0xa')](_0xb1af('0xb'),auth['isAuthenticated'](),controller[_0xb1af('0xc')]);router[_0xb1af('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb1af('0xd')]('/',auth[_0xb1af('0x9')](),controller['create']);router[_0xb1af('0xe')](_0xb1af('0xf'),auth[_0xb1af('0x9')](),controller['update']);router['delete'](_0xb1af('0xf'),auth['isAuthenticated'](),controller[_0xb1af('0x10')]);module[_0xb1af('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 7ecac70..c51dc74 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 _0xcef6=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','util'];(function(_0x2a9810,_0x5a5a93){var _0x4ca3fa=function(_0x13f294){while(--_0x13f294){_0x2a9810['push'](_0x2a9810['shift']());}};_0x4ca3fa(++_0x5a5a93);}(_0xcef6,0x142));var _0x6cef=function(_0xee37f1,_0x189f43){_0xee37f1=_0xee37f1-0x0;var _0x37fd54=_0xcef6[_0xee37f1];return _0x37fd54;};'use strict';var multer=require('multer');var util=require(_0x6cef('0x0'));var path=require('path');var timeout=require(_0x6cef('0x1'));var express=require('express');var router=express[_0x6cef('0x2')]();var auth=require(_0x6cef('0x3'));var interaction=require(_0x6cef('0x4'));var config=require(_0x6cef('0x5'));var controller=require(_0x6cef('0x6'));router[_0x6cef('0x7')]('/',auth[_0x6cef('0x8')](),controller['index']);router[_0x6cef('0x7')](_0x6cef('0x9'),auth['isAuthenticated'](),controller[_0x6cef('0xa')]);router[_0x6cef('0x7')](_0x6cef('0xb'),auth[_0x6cef('0x8')](),controller[_0x6cef('0xc')]);router[_0x6cef('0x7')](_0x6cef('0xd'),auth[_0x6cef('0x8')](),controller[_0x6cef('0xe')]);router[_0x6cef('0xf')]('/',auth[_0x6cef('0x8')](),controller[_0x6cef('0x10')]);router[_0x6cef('0xf')](_0x6cef('0xb'),auth[_0x6cef('0x8')](),controller[_0x6cef('0x11')]);router[_0x6cef('0x12')](_0x6cef('0x9'),auth[_0x6cef('0x8')](),controller['update']);router['delete'](_0x6cef('0x9'),auth[_0x6cef('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1792=['../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','post','create','addConfiguration','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3f8f16,_0x21256e){var _0x402b68=function(_0x2d7eac){while(--_0x2d7eac){_0x3f8f16['push'](_0x3f8f16['shift']());}};_0x402b68(++_0x21256e);}(_0x1792,0xfd));var _0x2179=function(_0x54861c,_0x8756fc){_0x54861c=_0x54861c-0x0;var _0x4786d6=_0x1792[_0x54861c];return _0x4786d6;};'use strict';var multer=require(_0x2179('0x0'));var util=require(_0x2179('0x1'));var path=require('path');var timeout=require(_0x2179('0x2'));var express=require(_0x2179('0x3'));var router=express[_0x2179('0x4')]();var auth=require(_0x2179('0x5'));var interaction=require(_0x2179('0x6'));var config=require(_0x2179('0x7'));var controller=require('./intDeskAccount.controller');router[_0x2179('0x8')]('/',auth[_0x2179('0x9')](),controller[_0x2179('0xa')]);router['get'](_0x2179('0xb'),auth[_0x2179('0x9')](),controller['show']);router[_0x2179('0x8')](_0x2179('0xc'),auth[_0x2179('0x9')](),controller[_0x2179('0xd')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x2179('0xe')]('/',auth['isAuthenticated'](),controller[_0x2179('0xf')]);router['post'](_0x2179('0xc'),auth[_0x2179('0x9')](),controller[_0x2179('0x10')]);router[_0x2179('0x11')]('/:id',auth[_0x2179('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2179('0x12')]);module[_0x2179('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 37965c7..8837b1d 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 _0x70e3=['integrationTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x70e3,0x9d));var _0x370e=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x70e3[_0x277107];return _0x1da046;};'use strict';var Sequelize=require(_0x370e('0x0'));module[_0x370e('0x1')]={'name':{'type':Sequelize[_0x370e('0x2')]},'description':{'type':Sequelize[_0x370e('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x370e('0x2')]},'authType':{'type':Sequelize[_0x370e('0x3')](_0x370e('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x370e('0x2')]},'consumerKey':{'type':Sequelize[_0x370e('0x2')]},'consumerSecret':{'type':Sequelize[_0x370e('0x2')]},'token':{'type':Sequelize[_0x370e('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x370e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x370e('0x5')}}; \ No newline at end of file +var _0x5ba3=['sequelize','STRING','ENUM','basic','integrationTab'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x5ba3,0x140));var _0x35ba=function(_0x4138ed,_0x24b0e2){_0x4138ed=_0x4138ed-0x0;var _0x163779=_0x5ba3[_0x4138ed];return _0x163779;};'use strict';var Sequelize=require(_0x35ba('0x0'));module['exports']={'name':{'type':Sequelize[_0x35ba('0x1')]},'description':{'type':Sequelize[_0x35ba('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x35ba('0x1')]},'authType':{'type':Sequelize[_0x35ba('0x2')](_0x35ba('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x35ba('0x1')]},'consumerKey':{'type':Sequelize[_0x35ba('0x1')]},'consumerSecret':{'type':Sequelize[_0x35ba('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x35ba('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x35ba('0x2')](_0x35ba('0x4'),'newTab'),'defaultValue':_0x35ba('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 23dd57c..9d343d0 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 _0x5f62=['then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','end','json','count','offset','status','Content-Range','apply','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','DeskAccount','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','basic','headers','Authorization','%s:%s','toString','base64','_embedded','entries','label','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request'];(function(_0x1956c9,_0x2ad6b4){var _0x499d4=function(_0x2fa03f){while(--_0x2fa03f){_0x1956c9['push'](_0x1956c9['shift']());}};_0x499d4(++_0x2ad6b4);}(_0x5f62,0x153));var _0x25f6=function(_0x4a73f2,_0x352409){_0x4a73f2=_0x4a73f2-0x0;var _0x4190ee=_0x5f62[_0x4a73f2];return _0x4190ee;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x25f6('0x0'));var rimraf=require(_0x25f6('0x1'));var zipdir=require(_0x25f6('0x2'));var jsonpatch=require(_0x25f6('0x3'));var rp=require(_0x25f6('0x4'));var moment=require(_0x25f6('0x5'));var BPromise=require(_0x25f6('0x6'));var Mustache=require(_0x25f6('0x7'));var util=require(_0x25f6('0x8'));var path=require(_0x25f6('0x9'));var sox=require('sox');var csv=require(_0x25f6('0xa'));var ejs=require(_0x25f6('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x25f6('0xc'));var crypto=require(_0x25f6('0xd'));var jsforce=require(_0x25f6('0xe'));var deskjs=require(_0x25f6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x25f6('0x10'));var Papa=require(_0x25f6('0x11'));var Redis=require(_0x25f6('0x12'));var authService=require(_0x25f6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x25f6('0x14'));var hardwareService=require(_0x25f6('0x15'));var logger=require(_0x25f6('0x16'))(_0x25f6('0x17'));var utils=require(_0x25f6('0x18'));var config=require(_0x25f6('0x19'));var licenseUtil=require(_0x25f6('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x25f6('0x1b'));var client=jayson[_0x25f6('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1efcc6,_0x2bbd0e,_0x5a2c19,_0x7206d8){return new BPromise(function(_0x31b161,_0x3cc080){var _0x3df266=_0x7206d8||client;return _0x3df266[_0x25f6('0x1d')](_0x1efcc6,_0x5a2c19)[_0x25f6('0x1e')](function(_0x608de3){logger['info'](_0x25f6('0x1f'),_0x2bbd0e,_0x25f6('0x20'));logger['debug'](_0x25f6('0x21'),_0x2bbd0e,_0x25f6('0x20'),JSON[_0x25f6('0x22')](_0x608de3));if(_0x608de3[_0x25f6('0x23')]){if(_0x608de3['error'][_0x25f6('0x24')]===0x1f4){logger[_0x25f6('0x23')]('DeskAccount,\x20%s,\x20%s',_0x2bbd0e,_0x608de3[_0x25f6('0x23')]['message']);return _0x3cc080(_0x608de3[_0x25f6('0x23')][_0x25f6('0x25')]);}logger[_0x25f6('0x23')](_0x25f6('0x1f'),_0x2bbd0e,_0x608de3[_0x25f6('0x23')][_0x25f6('0x25')]);return _0x31b161(_0x608de3[_0x25f6('0x23')]['message']);}else{logger[_0x25f6('0x26')]('DeskAccount,\x20%s,\x20%s',_0x2bbd0e,_0x25f6('0x20'));_0x31b161(_0x608de3[_0x25f6('0x27')][_0x25f6('0x25')]);}})['catch'](function(_0x4dbc29){logger['error']('DeskAccount,\x20%s,\x20%s',_0x2bbd0e,_0x4dbc29);_0x3cc080(_0x4dbc29);});});}function respondWithStatusCode(_0x3ba61e,_0x504d16){_0x504d16=_0x504d16||0xcc;return function(_0x431759){if(_0x431759){return _0x3ba61e['sendStatus'](_0x504d16);}return _0x3ba61e['status'](_0x504d16)[_0x25f6('0x28')]();};}function respondWithResult(_0x5252d5,_0x4fd57f){_0x4fd57f=_0x4fd57f||0xc8;return function(_0xe69277){if(_0xe69277){return _0x5252d5['status'](_0x4fd57f)[_0x25f6('0x29')](_0xe69277);}};}function respondWithFilteredResult(_0x28e042,_0x5166e9){return function(_0x4c8022){if(_0x4c8022){var _0x4bca99=_0x4c8022[_0x25f6('0x2a')],_0x28f010=_0x5166e9[_0x25f6('0x2b')],_0x101d81=_0x5166e9[_0x25f6('0x2b')]+_0x5166e9['limit'],_0x1f9e6e;if(_0x101d81>=_0x4bca99){_0x101d81=_0x4bca99;_0x1f9e6e=0xc8;}else{_0x1f9e6e=0xce;}_0x28e042[_0x25f6('0x2c')](_0x1f9e6e);return _0x28e042['set'](_0x25f6('0x2d'),_0x28f010+'-'+_0x101d81+'/'+_0x4bca99)[_0x25f6('0x29')](_0x4c8022);}return null;};}function patchUpdates(_0x5b778a){return function(_0x129b4c){try{jsonpatch[_0x25f6('0x2e')](_0x129b4c,_0x5b778a,!![]);}catch(_0x2e97ef){return BPromise['reject'](_0x2e97ef);}return _0x129b4c['save']();};}function saveUpdates(_0x3a3ec2,_0x3fdac3){return function(_0x18c5e5){if(_0x18c5e5){return _0x18c5e5[_0x25f6('0x2f')](_0x3a3ec2)[_0x25f6('0x1e')](function(_0x5bd6d7){return _0x5bd6d7;});}return null;};}function removeEntity(_0x275325,_0x4c46bf){return function(_0x4930a0){if(_0x4930a0){return _0x4930a0[_0x25f6('0x30')]()['then'](function(){_0x275325[_0x25f6('0x2c')](0xcc)[_0x25f6('0x28')]();});}};}function handleEntityNotFound(_0x5e1537,_0x265e34){return function(_0x4fbb08){if(!_0x4fbb08){_0x5e1537['sendStatus'](0x194);}return _0x4fbb08;};}function handleError(_0x6e607a,_0x3a38a1){_0x3a38a1=_0x3a38a1||0x1f4;return function(_0x50dd66){logger[_0x25f6('0x23')](_0x50dd66[_0x25f6('0x31')]);if(_0x50dd66[_0x25f6('0x32')]){delete _0x50dd66[_0x25f6('0x32')];}_0x6e607a['status'](_0x3a38a1)['send'](_0x50dd66);};}exports[_0x25f6('0x33')]=function(_0xc3f0e3,_0x27fae9){var _0x2f1371={},_0x61be97={},_0x1fa954={'count':0x0,'rows':[]};var _0x2eba9a=_[_0x25f6('0x34')](db['DeskAccount'][_0x25f6('0x35')],function(_0x3d0bb3){return{'name':_0x3d0bb3[_0x25f6('0x36')],'type':_0x3d0bb3[_0x25f6('0x37')][_0x25f6('0x38')]};});_0x61be97[_0x25f6('0x39')]=_[_0x25f6('0x34')](_0x2eba9a,_0x25f6('0x32'));_0x61be97[_0x25f6('0x3a')]=_[_0x25f6('0x3b')](_0xc3f0e3[_0x25f6('0x3a')]);_0x61be97[_0x25f6('0x3c')]=_['intersection'](_0x61be97['model'],_0x61be97[_0x25f6('0x3a')]);_0x2f1371[_0x25f6('0x3d')]=_['intersection'](_0x61be97[_0x25f6('0x39')],qs[_0x25f6('0x3e')](_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x3e')]));_0x2f1371[_0x25f6('0x3d')]=_0x2f1371[_0x25f6('0x3d')][_0x25f6('0x3f')]?_0x2f1371['attributes']:_0x61be97[_0x25f6('0x39')];if(!_0xc3f0e3['query'][_0x25f6('0x40')](_0x25f6('0x41'))){_0x2f1371[_0x25f6('0x42')]=qs[_0x25f6('0x42')](_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x42')]);_0x2f1371['offset']=qs[_0x25f6('0x2b')](_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x2b')]);}_0x2f1371[_0x25f6('0x43')]=qs[_0x25f6('0x44')](_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x44')]);_0x2f1371[_0x25f6('0x45')]=qs[_0x25f6('0x3c')](_[_0x25f6('0x46')](_0xc3f0e3[_0x25f6('0x3a')],_0x61be97[_0x25f6('0x3c')]),_0x2eba9a);if(_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x47')]){_0x2f1371['where']=_['merge'](_0x2f1371[_0x25f6('0x45')],{'$or':_[_0x25f6('0x34')](_0x2eba9a,function(_0x3f4779){if(_0x3f4779[_0x25f6('0x37')]!=='VIRTUAL'){var _0x250888={};_0x250888[_0x3f4779[_0x25f6('0x32')]]={'$like':'%'+_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x47')]+'%'};return _0x250888;}})});}_0x2f1371=_[_0x25f6('0x48')]({},_0x2f1371,_0xc3f0e3[_0x25f6('0x49')]);var _0x2bfad7={'where':_0x2f1371[_0x25f6('0x45')]};return db[_0x25f6('0x4a')][_0x25f6('0x2a')](_0x2bfad7)['then'](function(_0x3ec86b){_0x1fa954[_0x25f6('0x2a')]=_0x3ec86b;if(_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x4b')]){_0x2f1371[_0x25f6('0x4c')]=[{'all':!![]}];}return db['DeskAccount'][_0x25f6('0x4d')](_0x2f1371);})[_0x25f6('0x1e')](function(_0x46cb02){_0x1fa954[_0x25f6('0x4e')]=_0x46cb02;return _0x1fa954;})[_0x25f6('0x1e')](respondWithFilteredResult(_0x27fae9,_0x2f1371))[_0x25f6('0x4f')](handleError(_0x27fae9,null));};exports[_0x25f6('0x50')]=function(_0x10f605,_0x5c1fe6){var _0x227ae5={'raw':![],'where':{'id':_0x10f605[_0x25f6('0x51')]['id']}},_0x802064={};_0x802064[_0x25f6('0x39')]=_[_0x25f6('0x3b')](db[_0x25f6('0x4a')][_0x25f6('0x35')]);_0x802064[_0x25f6('0x3a')]=_[_0x25f6('0x3b')](_0x10f605[_0x25f6('0x3a')]);_0x802064['filters']=_[_0x25f6('0x52')](_0x802064[_0x25f6('0x39')],_0x802064[_0x25f6('0x3a')]);_0x227ae5[_0x25f6('0x3d')]=_[_0x25f6('0x52')](_0x802064[_0x25f6('0x39')],qs[_0x25f6('0x3e')](_0x10f605[_0x25f6('0x3a')][_0x25f6('0x3e')]));_0x227ae5[_0x25f6('0x3d')]=_0x227ae5[_0x25f6('0x3d')][_0x25f6('0x3f')]?_0x227ae5['attributes']:_0x802064['model'];if(_0x10f605[_0x25f6('0x3a')][_0x25f6('0x4b')]){_0x227ae5[_0x25f6('0x4c')]=[{'all':!![]}];}_0x227ae5=_['merge']({},_0x227ae5,_0x10f605[_0x25f6('0x49')]);return db[_0x25f6('0x4a')][_0x25f6('0x53')](_0x227ae5)[_0x25f6('0x1e')](handleEntityNotFound(_0x5c1fe6,null))['then'](respondWithResult(_0x5c1fe6,null))['catch'](handleError(_0x5c1fe6,null));};exports['create']=function(_0x37237e,_0x4a492e){return db[_0x25f6('0x4a')][_0x25f6('0x54')](_0x37237e[_0x25f6('0x55')],{})[_0x25f6('0x1e')](respondWithResult(_0x4a492e,0xc9))[_0x25f6('0x4f')](handleError(_0x4a492e,null));};exports[_0x25f6('0x2f')]=function(_0x1b1333,_0x4b6979){if(_0x1b1333[_0x25f6('0x55')]['id']){delete _0x1b1333[_0x25f6('0x55')]['id'];}return db[_0x25f6('0x4a')][_0x25f6('0x53')]({'where':{'id':_0x1b1333[_0x25f6('0x51')]['id']}})[_0x25f6('0x1e')](handleEntityNotFound(_0x4b6979,null))[_0x25f6('0x1e')](saveUpdates(_0x1b1333[_0x25f6('0x55')],null))['then'](respondWithResult(_0x4b6979,null))['catch'](handleError(_0x4b6979,null));};exports['destroy']=function(_0xaaa65,_0x3faa31){return db[_0x25f6('0x4a')]['find']({'where':{'id':_0xaaa65[_0x25f6('0x51')]['id']}})[_0x25f6('0x1e')](handleEntityNotFound(_0x3faa31,null))[_0x25f6('0x1e')](removeEntity(_0x3faa31,null))[_0x25f6('0x4f')](handleError(_0x3faa31,null));};exports[_0x25f6('0x56')]=function(_0x529708,_0x353f69,_0x27f89c){var _0x3c1934={};var _0x342646={};var _0x3c46b3;var _0x32680f;return db[_0x25f6('0x4a')][_0x25f6('0x57')]({'where':{'id':_0x529708[_0x25f6('0x51')]['id']}})[_0x25f6('0x1e')](handleEntityNotFound(_0x353f69,null))[_0x25f6('0x1e')](function(_0x42c78a){if(_0x42c78a){_0x3c46b3=_0x42c78a;_0x342646[_0x25f6('0x39')]=_[_0x25f6('0x3b')](db[_0x25f6('0x58')]['rawAttributes']);_0x342646['query']=_[_0x25f6('0x3b')](_0x529708[_0x25f6('0x3a')]);_0x342646[_0x25f6('0x3c')]=_[_0x25f6('0x52')](_0x342646['model'],_0x342646['query']);_0x3c1934[_0x25f6('0x3d')]=_['intersection'](_0x342646[_0x25f6('0x39')],qs[_0x25f6('0x3e')](_0x529708[_0x25f6('0x3a')]['fields']));_0x3c1934[_0x25f6('0x3d')]=_0x3c1934[_0x25f6('0x3d')][_0x25f6('0x3f')]?_0x3c1934[_0x25f6('0x3d')]:_0x342646[_0x25f6('0x39')];_0x3c1934[_0x25f6('0x43')]=qs['sort'](_0x529708[_0x25f6('0x3a')][_0x25f6('0x44')]);_0x3c1934[_0x25f6('0x45')]=qs[_0x25f6('0x3c')](_[_0x25f6('0x46')](_0x529708[_0x25f6('0x3a')],_0x342646[_0x25f6('0x3c')]));if(_0x529708['query'][_0x25f6('0x47')]){_0x3c1934['where']=_[_0x25f6('0x48')](_0x3c1934[_0x25f6('0x45')],{'$or':_['map'](_0x3c1934[_0x25f6('0x3d')],function(_0x390ee3){var _0x34d1ab={};_0x34d1ab[_0x390ee3]={'$like':'%'+_0x529708[_0x25f6('0x3a')][_0x25f6('0x47')]+'%'};return _0x34d1ab;})});}_0x3c1934=_['merge']({},_0x3c1934,_0x529708[_0x25f6('0x49')]);return _0x3c46b3[_0x25f6('0x56')](_0x3c1934);}})[_0x25f6('0x1e')](function(_0x3c3d58){if(_0x3c3d58){_0x32680f=_0x3c3d58[_0x25f6('0x3f')];if(!_0x529708[_0x25f6('0x3a')][_0x25f6('0x40')](_0x25f6('0x41'))){_0x3c1934[_0x25f6('0x42')]=qs[_0x25f6('0x42')](_0x529708[_0x25f6('0x3a')][_0x25f6('0x42')]);_0x3c1934[_0x25f6('0x2b')]=qs['offset'](_0x529708[_0x25f6('0x3a')][_0x25f6('0x2b')]);}return _0x3c46b3[_0x25f6('0x56')](_0x3c1934);}})[_0x25f6('0x1e')](function(_0xe55e1d){if(_0xe55e1d){return _0xe55e1d?{'count':_0x32680f,'rows':_0xe55e1d}:null;}})[_0x25f6('0x1e')](respondWithResult(_0x353f69,null))[_0x25f6('0x4f')](handleError(_0x353f69,null));};exports[_0x25f6('0x59')]=function(_0x4b22bc,_0x3a666e,_0x4c9676){if(_0x4b22bc['body']['id']){delete _0x4b22bc['body']['id'];}return db[_0x25f6('0x4a')][_0x25f6('0x57')]({'where':{'id':_0x4b22bc[_0x25f6('0x51')]['id']}})['then'](handleEntityNotFound(_0x3a666e,null))[_0x25f6('0x1e')](function(_0x3c19b7){if(_0x3c19b7){_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x5a')]=_0x3c19b7['id'];_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x5b')]=integrations[_0x25f6('0x5c')](_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x5d')],_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x37')]);_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x5e')]=integrations['getDescriptions'](_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x5d')],_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x37')]);return db['DeskConfiguration']['create'](_0x4b22bc[_0x25f6('0x55')],{'include':[{'model':db[_0x25f6('0x5f')],'as':_0x25f6('0x5b')},{'model':db[_0x25f6('0x5f')],'as':'Descriptions'}]});}return null;})[_0x25f6('0x1e')](respondWithResult(_0x3a666e,null))[_0x25f6('0x4f')](handleError(_0x3a666e,null));};exports[_0x25f6('0x60')]=function(_0x50e7d0,_0x3caecd,_0x5cafd3){var _0x16c792=[{'name':_0x25f6('0x61'),'label':_0x25f6('0x61'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3d3837='';return db[_0x25f6('0x4a')][_0x25f6('0x57')]({'where':{'id':_0x50e7d0[_0x25f6('0x51')]['id']},'attributes':['id',_0x25f6('0x62'),_0x25f6('0x63'),_0x25f6('0x64'),_0x25f6('0x65'),_0x25f6('0x66'),_0x25f6('0x67'),_0x25f6('0x68'),_0x25f6('0x69')]})[_0x25f6('0x1e')](handleEntityNotFound(_0x3caecd,null))[_0x25f6('0x1e')](function(_0x2437be){if(_0x2437be){_0x3d3837=_0x2437be[_0x25f6('0x62')];var _0x580027=_0x3d3837['slice'](-0x1);if(_0x580027==='/'){_0x3d3837=_0x3d3837[_0x25f6('0x6a')](0x0,_0x3d3837[_0x25f6('0x6b')](_0x580027));}var _0xd52b49={'method':_0x25f6('0x6c'),'uri':util[_0x25f6('0x6d')]('%s/custom_fields',_0x3d3837),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x2437be[_0x25f6('0x63')]===_0x25f6('0x6e')){_0xd52b49[_0x25f6('0x6f')][_0x25f6('0x70')]=util[_0x25f6('0x6d')]('Basic\x20%s',new Buffer(util[_0x25f6('0x6d')](_0x25f6('0x71'),_0x2437be[_0x25f6('0x64')],_0x2437be[_0x25f6('0x65')]))[_0x25f6('0x72')](_0x25f6('0x73')));}return rp(_0xd52b49)[_0x25f6('0x1e')](function(_0x1b1bb5){return _0x16c792['concat'](_[_0x25f6('0x34')](_0x1b1bb5[_0x25f6('0x74')][_0x25f6('0x75')],function(_0x335118){return{'id':_0x335118[_0x25f6('0x32')],'name':_0x335118['name'],'type':_0x335118['type'],'active':_0x335118['active'],'label':_0x335118[_0x25f6('0x76')],'custom':!![]};}));});}})[_0x25f6('0x1e')](function(_0x37c169){return{'count':_0x37c169[_0x25f6('0x3f')],'rows':_0x37c169};})[_0x25f6('0x1e')](respondWithResult(_0x3caecd,null))[_0x25f6('0x4f')](function(_0x2f7e8e){var _0x53c63a=_0x50e7d0[_0x25f6('0x3a')][_0x25f6('0x77')]?0x1f4:_0x2f7e8e['statusCode']||0x1f4;logger[_0x25f6('0x23')](_0x25f6('0x78'),_0x25f6('0x60'),_0x53c63a,JSON[_0x25f6('0x22')](_0x2f7e8e));delete _0x2f7e8e[_0x25f6('0x32')];if(_0x53c63a===0x191){_0x53c63a=0x190;}_0x3caecd['status'](_0x53c63a)['send'](_0x50e7d0['query']['test']?{'message':_0x25f6('0x79'),'statusCode':_0x2f7e8e[_0x25f6('0x7a')]}:_0x2f7e8e);});}; \ No newline at end of file +var _0x0400=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','end','stack','name','send','index','map','DeskAccount','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','fields','length','create','body','find','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','%s:%s','password','toString','base64','entries','active','label','statusCode','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js'];(function(_0x11625b,_0x57bdad){var _0x5baf73=function(_0x35b922){while(--_0x35b922){_0x11625b['push'](_0x11625b['shift']());}};_0x5baf73(++_0x57bdad);}(_0x0400,0x1da));var _0x0040=function(_0x5710db,_0x410db1){_0x5710db=_0x5710db-0x0;var _0xee92e=_0x0400[_0x5710db];return _0xee92e;};'use strict';var pdf=require(_0x0040('0x0'));var emlformat=require(_0x0040('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0040('0x2'));var rp=require(_0x0040('0x3'));var moment=require('moment');var BPromise=require(_0x0040('0x4'));var Mustache=require(_0x0040('0x5'));var util=require(_0x0040('0x6'));var path=require(_0x0040('0x7'));var sox=require(_0x0040('0x8'));var csv=require('to-csv');var ejs=require(_0x0040('0x9'));var fs=require('fs');var _=require(_0x0040('0xa'));var squel=require(_0x0040('0xb'));var crypto=require('crypto');var jsforce=require(_0x0040('0xc'));var deskjs=require(_0x0040('0xd'));var toCsv=require(_0x0040('0xe'));var querystring=require(_0x0040('0xf'));var Papa=require(_0x0040('0x10'));var Redis=require(_0x0040('0x11'));var authService=require(_0x0040('0x12'));var qs=require(_0x0040('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0040('0x14'));var utils=require(_0x0040('0x15'));var config=require(_0x0040('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x0040('0x17'));var jayson=require(_0x0040('0x18'));var client=jayson[_0x0040('0x19')][_0x0040('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3fd244,_0x5cc615,_0x26ee0a,_0x1ff8ed){return new BPromise(function(_0x185793,_0x559fd4){var _0x225267=_0x1ff8ed||client;return _0x225267[_0x0040('0x1b')](_0x3fd244,_0x26ee0a)['then'](function(_0x48e551){logger[_0x0040('0x1c')](_0x0040('0x1d'),_0x5cc615,'request\x20sent');logger[_0x0040('0x1e')](_0x0040('0x1f'),_0x5cc615,_0x0040('0x20'),JSON[_0x0040('0x21')](_0x48e551));if(_0x48e551[_0x0040('0x22')]){if(_0x48e551[_0x0040('0x22')][_0x0040('0x23')]===0x1f4){logger[_0x0040('0x22')]('DeskAccount,\x20%s,\x20%s',_0x5cc615,_0x48e551[_0x0040('0x22')]['message']);return _0x559fd4(_0x48e551[_0x0040('0x22')][_0x0040('0x24')]);}logger[_0x0040('0x22')](_0x0040('0x1d'),_0x5cc615,_0x48e551['error']['message']);return _0x185793(_0x48e551[_0x0040('0x22')][_0x0040('0x24')]);}else{logger['info'](_0x0040('0x1d'),_0x5cc615,_0x0040('0x20'));_0x185793(_0x48e551['result'][_0x0040('0x24')]);}})[_0x0040('0x25')](function(_0x2d7788){logger['error']('DeskAccount,\x20%s,\x20%s',_0x5cc615,_0x2d7788);_0x559fd4(_0x2d7788);});});}function respondWithStatusCode(_0x4b2073,_0x55b1d9){_0x55b1d9=_0x55b1d9||0xcc;return function(_0x458f46){if(_0x458f46){return _0x4b2073[_0x0040('0x26')](_0x55b1d9);}return _0x4b2073[_0x0040('0x27')](_0x55b1d9)['end']();};}function respondWithResult(_0x1fb7a4,_0xcb8139){_0xcb8139=_0xcb8139||0xc8;return function(_0x4b02fa){if(_0x4b02fa){return _0x1fb7a4[_0x0040('0x27')](_0xcb8139)['json'](_0x4b02fa);}};}function respondWithFilteredResult(_0x5220aa,_0xf2c279){return function(_0x1aeb43){if(_0x1aeb43){var _0x138d41=_0x1aeb43[_0x0040('0x28')],_0x4527b3=_0xf2c279[_0x0040('0x29')],_0x4c656f=_0xf2c279[_0x0040('0x29')]+_0xf2c279[_0x0040('0x2a')],_0x596d73;if(_0x4c656f>=_0x138d41){_0x4c656f=_0x138d41;_0x596d73=0xc8;}else{_0x596d73=0xce;}_0x5220aa[_0x0040('0x27')](_0x596d73);return _0x5220aa[_0x0040('0x2b')](_0x0040('0x2c'),_0x4527b3+'-'+_0x4c656f+'/'+_0x138d41)[_0x0040('0x2d')](_0x1aeb43);}return null;};}function patchUpdates(_0x4ded28){return function(_0x38ef2b){try{jsonpatch['apply'](_0x38ef2b,_0x4ded28,!![]);}catch(_0x3d17fd){return BPromise[_0x0040('0x2e')](_0x3d17fd);}return _0x38ef2b[_0x0040('0x2f')]();};}function saveUpdates(_0x3363ec,_0x35fca5){return function(_0x18ce12){if(_0x18ce12){return _0x18ce12[_0x0040('0x30')](_0x3363ec)[_0x0040('0x31')](function(_0x209028){return _0x209028;});}return null;};}function removeEntity(_0x4cd975,_0x38c536){return function(_0x46b35c){if(_0x46b35c){return _0x46b35c[_0x0040('0x32')]()[_0x0040('0x31')](function(){_0x4cd975[_0x0040('0x27')](0xcc)[_0x0040('0x33')]();});}};}function handleEntityNotFound(_0x564f83,_0x7e758b){return function(_0x438003){if(!_0x438003){_0x564f83['sendStatus'](0x194);}return _0x438003;};}function handleError(_0xcbceec,_0x297744){_0x297744=_0x297744||0x1f4;return function(_0x58fa2d){logger[_0x0040('0x22')](_0x58fa2d[_0x0040('0x34')]);if(_0x58fa2d[_0x0040('0x35')]){delete _0x58fa2d[_0x0040('0x35')];}_0xcbceec[_0x0040('0x27')](_0x297744)[_0x0040('0x36')](_0x58fa2d);};}exports[_0x0040('0x37')]=function(_0x28b913,_0x1f00d2){var _0x546087={},_0x4757cd={},_0x460a44={'count':0x0,'rows':[]};var _0x448ce9=_[_0x0040('0x38')](db[_0x0040('0x39')]['rawAttributes'],function(_0x4102d5){return{'name':_0x4102d5[_0x0040('0x3a')],'type':_0x4102d5[_0x0040('0x3b')][_0x0040('0x3c')]};});_0x4757cd[_0x0040('0x3d')]=_[_0x0040('0x38')](_0x448ce9,_0x0040('0x35'));_0x4757cd[_0x0040('0x3e')]=_[_0x0040('0x3f')](_0x28b913['query']);_0x4757cd['filters']=_[_0x0040('0x40')](_0x4757cd['model'],_0x4757cd[_0x0040('0x3e')]);_0x546087[_0x0040('0x41')]=_[_0x0040('0x40')](_0x4757cd['model'],qs['fields'](_0x28b913[_0x0040('0x3e')]['fields']));_0x546087['attributes']=_0x546087[_0x0040('0x41')]['length']?_0x546087[_0x0040('0x41')]:_0x4757cd['model'];if(!_0x28b913[_0x0040('0x3e')][_0x0040('0x42')](_0x0040('0x43'))){_0x546087[_0x0040('0x2a')]=qs[_0x0040('0x2a')](_0x28b913[_0x0040('0x3e')]['limit']);_0x546087[_0x0040('0x29')]=qs[_0x0040('0x29')](_0x28b913[_0x0040('0x3e')]['offset']);}_0x546087[_0x0040('0x44')]=qs[_0x0040('0x45')](_0x28b913[_0x0040('0x3e')][_0x0040('0x45')]);_0x546087[_0x0040('0x46')]=qs[_0x0040('0x47')](_[_0x0040('0x48')](_0x28b913[_0x0040('0x3e')],_0x4757cd['filters']),_0x448ce9);if(_0x28b913['query'][_0x0040('0x49')]){_0x546087[_0x0040('0x46')]=_[_0x0040('0x4a')](_0x546087['where'],{'$or':_['map'](_0x448ce9,function(_0x40e5d3){if(_0x40e5d3[_0x0040('0x3b')]!==_0x0040('0x4b')){var _0x33dc8a={};_0x33dc8a[_0x40e5d3[_0x0040('0x35')]]={'$like':'%'+_0x28b913[_0x0040('0x3e')]['filter']+'%'};return _0x33dc8a;}})});}_0x546087=_[_0x0040('0x4a')]({},_0x546087,_0x28b913[_0x0040('0x4c')]);var _0x526463={'where':_0x546087[_0x0040('0x46')]};return db[_0x0040('0x39')][_0x0040('0x28')](_0x526463)[_0x0040('0x31')](function(_0x400f75){_0x460a44['count']=_0x400f75;if(_0x28b913[_0x0040('0x3e')][_0x0040('0x4d')]){_0x546087[_0x0040('0x4e')]=[{'all':!![]}];}return db[_0x0040('0x39')][_0x0040('0x4f')](_0x546087);})[_0x0040('0x31')](function(_0x154f19){_0x460a44[_0x0040('0x50')]=_0x154f19;return _0x460a44;})['then'](respondWithFilteredResult(_0x1f00d2,_0x546087))[_0x0040('0x25')](handleError(_0x1f00d2,null));};exports['show']=function(_0x478f38,_0x62c82){var _0x397771={'raw':![],'where':{'id':_0x478f38[_0x0040('0x51')]['id']}},_0x353b0a={};_0x353b0a[_0x0040('0x3d')]=_[_0x0040('0x3f')](db[_0x0040('0x39')][_0x0040('0x52')]);_0x353b0a[_0x0040('0x3e')]=_[_0x0040('0x3f')](_0x478f38[_0x0040('0x3e')]);_0x353b0a[_0x0040('0x47')]=_[_0x0040('0x40')](_0x353b0a[_0x0040('0x3d')],_0x353b0a['query']);_0x397771['attributes']=_[_0x0040('0x40')](_0x353b0a[_0x0040('0x3d')],qs[_0x0040('0x53')](_0x478f38[_0x0040('0x3e')]['fields']));_0x397771[_0x0040('0x41')]=_0x397771[_0x0040('0x41')][_0x0040('0x54')]?_0x397771['attributes']:_0x353b0a[_0x0040('0x3d')];if(_0x478f38[_0x0040('0x3e')][_0x0040('0x4d')]){_0x397771[_0x0040('0x4e')]=[{'all':!![]}];}_0x397771=_[_0x0040('0x4a')]({},_0x397771,_0x478f38[_0x0040('0x4c')]);return db[_0x0040('0x39')]['find'](_0x397771)[_0x0040('0x31')](handleEntityNotFound(_0x62c82,null))[_0x0040('0x31')](respondWithResult(_0x62c82,null))[_0x0040('0x25')](handleError(_0x62c82,null));};exports[_0x0040('0x55')]=function(_0x37b835,_0x18eec7){return db['DeskAccount']['create'](_0x37b835[_0x0040('0x56')],{})['then'](respondWithResult(_0x18eec7,0xc9))[_0x0040('0x25')](handleError(_0x18eec7,null));};exports['update']=function(_0x3bfdd9,_0x1e6b1c){if(_0x3bfdd9[_0x0040('0x56')]['id']){delete _0x3bfdd9[_0x0040('0x56')]['id'];}return db[_0x0040('0x39')][_0x0040('0x57')]({'where':{'id':_0x3bfdd9[_0x0040('0x51')]['id']}})[_0x0040('0x31')](handleEntityNotFound(_0x1e6b1c,null))[_0x0040('0x31')](saveUpdates(_0x3bfdd9[_0x0040('0x56')],null))['then'](respondWithResult(_0x1e6b1c,null))[_0x0040('0x25')](handleError(_0x1e6b1c,null));};exports['destroy']=function(_0x5cfb1a,_0x59d03e){return db['DeskAccount'][_0x0040('0x57')]({'where':{'id':_0x5cfb1a[_0x0040('0x51')]['id']}})['then'](handleEntityNotFound(_0x59d03e,null))[_0x0040('0x31')](removeEntity(_0x59d03e,null))['catch'](handleError(_0x59d03e,null));};exports[_0x0040('0x58')]=function(_0x13643c,_0xa6686b,_0x47b78b){var _0x242e57={};var _0x2d1055={};var _0x3ddf77;var _0x3b396b;return db['DeskAccount'][_0x0040('0x59')]({'where':{'id':_0x13643c[_0x0040('0x51')]['id']}})[_0x0040('0x31')](handleEntityNotFound(_0xa6686b,null))[_0x0040('0x31')](function(_0x1eaf9d){if(_0x1eaf9d){_0x3ddf77=_0x1eaf9d;_0x2d1055[_0x0040('0x3d')]=_['keys'](db[_0x0040('0x5a')][_0x0040('0x52')]);_0x2d1055[_0x0040('0x3e')]=_[_0x0040('0x3f')](_0x13643c[_0x0040('0x3e')]);_0x2d1055['filters']=_[_0x0040('0x40')](_0x2d1055[_0x0040('0x3d')],_0x2d1055[_0x0040('0x3e')]);_0x242e57[_0x0040('0x41')]=_[_0x0040('0x40')](_0x2d1055[_0x0040('0x3d')],qs[_0x0040('0x53')](_0x13643c['query'][_0x0040('0x53')]));_0x242e57[_0x0040('0x41')]=_0x242e57[_0x0040('0x41')][_0x0040('0x54')]?_0x242e57['attributes']:_0x2d1055['model'];_0x242e57[_0x0040('0x44')]=qs[_0x0040('0x45')](_0x13643c['query'][_0x0040('0x45')]);_0x242e57['where']=qs[_0x0040('0x47')](_[_0x0040('0x48')](_0x13643c['query'],_0x2d1055['filters']));if(_0x13643c[_0x0040('0x3e')][_0x0040('0x49')]){_0x242e57[_0x0040('0x46')]=_[_0x0040('0x4a')](_0x242e57[_0x0040('0x46')],{'$or':_['map'](_0x242e57['attributes'],function(_0xaf62bb){var _0x15be7d={};_0x15be7d[_0xaf62bb]={'$like':'%'+_0x13643c['query'][_0x0040('0x49')]+'%'};return _0x15be7d;})});}_0x242e57=_[_0x0040('0x4a')]({},_0x242e57,_0x13643c[_0x0040('0x4c')]);return _0x3ddf77[_0x0040('0x58')](_0x242e57);}})[_0x0040('0x31')](function(_0x545a66){if(_0x545a66){_0x3b396b=_0x545a66[_0x0040('0x54')];if(!_0x13643c[_0x0040('0x3e')][_0x0040('0x42')](_0x0040('0x43'))){_0x242e57[_0x0040('0x2a')]=qs['limit'](_0x13643c['query'][_0x0040('0x2a')]);_0x242e57[_0x0040('0x29')]=qs[_0x0040('0x29')](_0x13643c[_0x0040('0x3e')][_0x0040('0x29')]);}return _0x3ddf77[_0x0040('0x58')](_0x242e57);}})[_0x0040('0x31')](function(_0x422af9){if(_0x422af9){return _0x422af9?{'count':_0x3b396b,'rows':_0x422af9}:null;}})[_0x0040('0x31')](respondWithResult(_0xa6686b,null))[_0x0040('0x25')](handleError(_0xa6686b,null));};exports[_0x0040('0x5b')]=function(_0x42f87c,_0x512996,_0x7a8b22){if(_0x42f87c[_0x0040('0x56')]['id']){delete _0x42f87c['body']['id'];}return db['DeskAccount'][_0x0040('0x59')]({'where':{'id':_0x42f87c[_0x0040('0x51')]['id']}})[_0x0040('0x31')](handleEntityNotFound(_0x512996,null))[_0x0040('0x31')](function(_0x4e1daf){if(_0x4e1daf){_0x42f87c[_0x0040('0x56')]['AccountId']=_0x4e1daf['id'];_0x42f87c[_0x0040('0x56')][_0x0040('0x5c')]=integrations[_0x0040('0x5d')](_0x42f87c[_0x0040('0x56')]['channel'],_0x42f87c[_0x0040('0x56')]['type']);_0x42f87c[_0x0040('0x56')][_0x0040('0x5e')]=integrations[_0x0040('0x5f')](_0x42f87c[_0x0040('0x56')]['channel'],_0x42f87c[_0x0040('0x56')]['type']);return db[_0x0040('0x5a')]['create'](_0x42f87c[_0x0040('0x56')],{'include':[{'model':db[_0x0040('0x60')],'as':_0x0040('0x5c')},{'model':db[_0x0040('0x60')],'as':_0x0040('0x5e')}]});}return null;})[_0x0040('0x31')](respondWithResult(_0x512996,null))[_0x0040('0x25')](handleError(_0x512996,null));};exports[_0x0040('0x61')]=function(_0x4df3fe,_0x3d0aae,_0x1be823){var _0x3fc25f=[{'name':'priority','label':_0x0040('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 _0xdc18ec='';return db[_0x0040('0x39')][_0x0040('0x59')]({'where':{'id':_0x4df3fe[_0x0040('0x51')]['id']},'attributes':['id',_0x0040('0x63'),_0x0040('0x64'),_0x0040('0x65'),'password','consumerKey','consumerSecret',_0x0040('0x66'),_0x0040('0x67')]})[_0x0040('0x31')](handleEntityNotFound(_0x3d0aae,null))[_0x0040('0x31')](function(_0x545887){if(_0x545887){_0xdc18ec=_0x545887[_0x0040('0x63')];var _0x3a621d=_0xdc18ec[_0x0040('0x68')](-0x1);if(_0x3a621d==='/'){_0xdc18ec=_0xdc18ec[_0x0040('0x69')](0x0,_0xdc18ec[_0x0040('0x6a')](_0x3a621d));}var _0x445243={'method':_0x0040('0x6b'),'uri':util[_0x0040('0x6c')](_0x0040('0x6d'),_0xdc18ec),'headers':{'Content-Type':'application/json','Accept':_0x0040('0x6e')},'json':!![]};if(_0x545887['authType']===_0x0040('0x6f')){_0x445243[_0x0040('0x70')]['Authorization']=util[_0x0040('0x6c')]('Basic\x20%s',new Buffer(util[_0x0040('0x6c')](_0x0040('0x71'),_0x545887[_0x0040('0x65')],_0x545887[_0x0040('0x72')]))[_0x0040('0x73')](_0x0040('0x74')));}return rp(_0x445243)[_0x0040('0x31')](function(_0x1a906f){return _0x3fc25f['concat'](_[_0x0040('0x38')](_0x1a906f['_embedded'][_0x0040('0x75')],function(_0x396017){return{'id':_0x396017[_0x0040('0x35')],'name':_0x396017[_0x0040('0x35')],'type':_0x396017[_0x0040('0x3b')],'active':_0x396017[_0x0040('0x76')],'label':_0x396017[_0x0040('0x77')],'custom':!![]};}));});}})['then'](function(_0x8b15eb){return{'count':_0x8b15eb['length'],'rows':_0x8b15eb};})['then'](respondWithResult(_0x3d0aae,null))[_0x0040('0x25')](function(_0x223ab6){var _0x5d122b=_0x4df3fe[_0x0040('0x3e')]['test']?0x1f4:_0x223ab6[_0x0040('0x78')]||0x1f4;logger[_0x0040('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x0040('0x61'),_0x5d122b,JSON['stringify'](_0x223ab6));delete _0x223ab6[_0x0040('0x35')];if(_0x5d122b===0x191){_0x5d122b=0x190;}_0x3d0aae['status'](_0x5d122b)[_0x0040('0x36')](_0x4df3fe[_0x0040('0x3e')]['test']?{'message':_0x0040('0x79'),'statusCode':_0x223ab6[_0x0040('0x78')]}:_0x223ab6);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 45aad64..1536d86 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 _0xec5c=['define','DeskAccount','api','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','exports'];(function(_0x3523d4,_0x7bebaa){var _0x5a92d1=function(_0x59b939){while(--_0x59b939){_0x3523d4['push'](_0x3523d4['shift']());}};_0x5a92d1(++_0x7bebaa);}(_0xec5c,0x1d8));var _0xcec5=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0xec5c[_0x54defc];return _0x1955d3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xcec5('0x0'));var moment=require(_0xcec5('0x1'));var BPromise=require(_0xcec5('0x2'));var rp=require(_0xcec5('0x3'));var fs=require('fs');var path=require(_0xcec5('0x4'));var rimraf=require(_0xcec5('0x5'));var config=require('../../config/environment');var attributes=require(_0xcec5('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xcec5('0x7')]=function(_0x47718e,_0x1f27fa){return _0x47718e[_0xcec5('0x8')](_0xcec5('0x9'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47e7=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts'];(function(_0x42b4a7,_0x46bfd2){var _0x36bb5e=function(_0x1295e4){while(--_0x1295e4){_0x42b4a7['push'](_0x42b4a7['shift']());}};_0x36bb5e(++_0x46bfd2);}(_0x47e7,0xe4));var _0x747e=function(_0x62d40f,_0x149b3d){_0x62d40f=_0x62d40f-0x0;var _0xe3c339=_0x47e7[_0x62d40f];return _0xe3c339;};'use strict';var _=require(_0x747e('0x0'));var util=require('util');var logger=require(_0x747e('0x1'))(_0x747e('0x2'));var moment=require('moment');var BPromise=require(_0x747e('0x3'));var rp=require(_0x747e('0x4'));var fs=require('fs');var path=require(_0x747e('0x5'));var rimraf=require(_0x747e('0x6'));var config=require('../../config/environment');var attributes=require(_0x747e('0x7'));var integrations=require(_0x747e('0x8'));module['exports']=function(_0x5e8e45,_0x5d9437){return _0x5e8e45[_0x747e('0x9')](_0x747e('0xa'),attributes,{'tableName':_0x747e('0xb'),'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 2a7a3cd..807bf2b 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 _0x7b01=['attributes','include','map','model','catch','find','ShowDeskAccount','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where'];(function(_0xf2a241,_0x4ee120){var _0xb8bfa8=function(_0x441e7d){while(--_0x441e7d){_0xf2a241['push'](_0xf2a241['shift']());}};_0xb8bfa8(++_0x4ee120);}(_0x7b01,0x19f));var _0x17b0=function(_0x1725c9,_0x463508){_0x1725c9=_0x1725c9-0x0;var _0xfeca9b=_0x7b01[_0x1725c9];return _0xfeca9b;};'use strict';var _=require('lodash');var util=require(_0x17b0('0x0'));var moment=require('moment');var BPromise=require(_0x17b0('0x1'));var rs=require(_0x17b0('0x2'));var fs=require('fs');var Redis=require(_0x17b0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x17b0('0x4'));var logger=require(_0x17b0('0x5'))('rpc');var config=require(_0x17b0('0x6'));var jayson=require(_0x17b0('0x7'));var client=jayson[_0x17b0('0x8')][_0x17b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc1cdb3,_0x39d0bf,_0x128d2b){return new BPromise(function(_0x4b00a0,_0x191ecd){return client[_0x17b0('0xa')](_0xc1cdb3,_0x128d2b)[_0x17b0('0xb')](function(_0xaff55d){logger[_0x17b0('0xc')](_0x17b0('0xd'),_0x39d0bf,_0x17b0('0xe'));logger[_0x17b0('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x39d0bf,_0x17b0('0xe'),JSON[_0x17b0('0x10')](_0xaff55d));if(_0xaff55d[_0x17b0('0x11')]){if(_0xaff55d[_0x17b0('0x11')][_0x17b0('0x12')]===0x1f4){logger['error'](_0x17b0('0xd'),_0x39d0bf,_0xaff55d['error'][_0x17b0('0x13')]);return _0x191ecd(_0xaff55d[_0x17b0('0x11')]['message']);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x39d0bf,_0xaff55d[_0x17b0('0x11')][_0x17b0('0x13')]);return _0x4b00a0(_0xaff55d[_0x17b0('0x11')][_0x17b0('0x13')]);}else{logger[_0x17b0('0xc')](_0x17b0('0xd'),_0x39d0bf,_0x17b0('0xe'));_0x4b00a0(_0xaff55d[_0x17b0('0x14')][_0x17b0('0x13')]);}})['catch'](function(_0x187afa){logger[_0x17b0('0x11')](_0x17b0('0xd'),_0x39d0bf,_0x187afa);_0x191ecd(_0x187afa);});});}exports[_0x17b0('0x15')]=function(_0x1c1864){var _0x45566f=this;return new Promise(function(_0x44bedf,_0x370d46){return db[_0x17b0('0x16')][_0x17b0('0x17')]({'raw':_0x1c1864[_0x17b0('0x18')]?_0x1c1864['options'][_0x17b0('0x19')]===undefined?!![]:![]:!![],'where':_0x1c1864[_0x17b0('0x18')]?_0x1c1864[_0x17b0('0x18')][_0x17b0('0x1a')]||null:null,'attributes':_0x1c1864[_0x17b0('0x18')]?_0x1c1864[_0x17b0('0x18')][_0x17b0('0x1b')]||null:null,'limit':_0x1c1864[_0x17b0('0x18')]?_0x1c1864[_0x17b0('0x18')]['limit']||null:null,'include':_0x1c1864['options']?_0x1c1864[_0x17b0('0x18')][_0x17b0('0x1c')]?_[_0x17b0('0x1d')](_0x1c1864[_0x17b0('0x18')][_0x17b0('0x1c')],function(_0x48c0af){return{'model':db[_0x48c0af['model']],'as':_0x48c0af['as'],'attributes':_0x48c0af[_0x17b0('0x1b')],'include':_0x48c0af['include']?_[_0x17b0('0x1d')](_0x48c0af[_0x17b0('0x1c')],function(_0x2fcafe){return{'model':db[_0x2fcafe[_0x17b0('0x1e')]],'as':_0x2fcafe['as'],'attributes':_0x2fcafe['attributes'],'include':_0x2fcafe['include']?_[_0x17b0('0x1d')](_0x2fcafe['include'],function(_0x23e7d8){return{'model':db[_0x23e7d8[_0x17b0('0x1e')]],'as':_0x23e7d8['as'],'attributes':_0x23e7d8[_0x17b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x17b0('0xb')](function(_0x3dc0d3){logger[_0x17b0('0xc')](_0x17b0('0x15'),_0x1c1864);logger[_0x17b0('0xf')]('GetDeskAccount',_0x1c1864,JSON[_0x17b0('0x10')](_0x3dc0d3));_0x44bedf(_0x3dc0d3);})[_0x17b0('0x1f')](function(_0x522dfd){logger[_0x17b0('0x11')](_0x17b0('0x15'),_0x522dfd[_0x17b0('0x13')],_0x1c1864);_0x370d46(_0x45566f[_0x17b0('0x11')](0x1f4,_0x522dfd[_0x17b0('0x13')]));});});};exports['ShowDeskAccount']=function(_0x2bc5fc){var _0x4a9ebd=this;return new Promise(function(_0x363dfc,_0x5adbda){return db[_0x17b0('0x16')][_0x17b0('0x20')]({'raw':_0x2bc5fc[_0x17b0('0x18')]?_0x2bc5fc[_0x17b0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2bc5fc[_0x17b0('0x18')]?_0x2bc5fc[_0x17b0('0x18')][_0x17b0('0x1a')]||null:null,'attributes':_0x2bc5fc[_0x17b0('0x18')]?_0x2bc5fc[_0x17b0('0x18')][_0x17b0('0x1b')]||null:null,'include':_0x2bc5fc[_0x17b0('0x18')]?_0x2bc5fc[_0x17b0('0x18')][_0x17b0('0x1c')]?_[_0x17b0('0x1d')](_0x2bc5fc['options'][_0x17b0('0x1c')],function(_0x48bb9c){return{'model':db[_0x48bb9c['model']],'as':_0x48bb9c['as'],'attributes':_0x48bb9c[_0x17b0('0x1b')],'include':_0x48bb9c[_0x17b0('0x1c')]?_[_0x17b0('0x1d')](_0x48bb9c[_0x17b0('0x1c')],function(_0x1aaf74){return{'model':db[_0x1aaf74[_0x17b0('0x1e')]],'as':_0x1aaf74['as'],'attributes':_0x1aaf74[_0x17b0('0x1b')],'include':_0x1aaf74[_0x17b0('0x1c')]?_[_0x17b0('0x1d')](_0x1aaf74[_0x17b0('0x1c')],function(_0x24949b){return{'model':db[_0x24949b[_0x17b0('0x1e')]],'as':_0x24949b['as'],'attributes':_0x24949b[_0x17b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x17b0('0xb')](function(_0x3bf957){logger[_0x17b0('0xc')](_0x17b0('0x21'),_0x2bc5fc);logger[_0x17b0('0xf')](_0x17b0('0x21'),_0x2bc5fc,JSON[_0x17b0('0x10')](_0x3bf957));_0x363dfc(_0x3bf957);})[_0x17b0('0x1f')](function(_0x792090){logger[_0x17b0('0x11')](_0x17b0('0x21'),_0x792090[_0x17b0('0x13')],_0x2bc5fc);_0x5adbda(_0x4a9ebd[_0x17b0('0x11')](0x1f4,_0x792090[_0x17b0('0x13')]));});});}; \ No newline at end of file +var _0x982a=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetDeskAccount','DeskAccount','raw','options','where','attributes','limit','include','map','model','stringify','catch','ShowDeskAccount','find','then'];(function(_0x545ff0,_0x45eba6){var _0x4813d2=function(_0x3972c2){while(--_0x3972c2){_0x545ff0['push'](_0x545ff0['shift']());}};_0x4813d2(++_0x45eba6);}(_0x982a,0x103));var _0xa982=function(_0x1fa09d,_0x3fbf3b){_0x1fa09d=_0x1fa09d-0x0;var _0x46da3c=_0x982a[_0x1fa09d];return _0x46da3c;};'use strict';var _=require(_0xa982('0x0'));var util=require('util');var moment=require(_0xa982('0x1'));var BPromise=require(_0xa982('0x2'));var rs=require(_0xa982('0x3'));var fs=require('fs');var Redis=require(_0xa982('0x4'));var db=require(_0xa982('0x5'))['db'];var utils=require(_0xa982('0x6'));var logger=require('../../config/logger')(_0xa982('0x7'));var config=require(_0xa982('0x8'));var jayson=require(_0xa982('0x9'));var client=jayson[_0xa982('0xa')][_0xa982('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50ccf7,_0x510ec7,_0x527eb0){return new BPromise(function(_0x143da1,_0xc89fd9){return client[_0xa982('0xc')](_0x50ccf7,_0x527eb0)['then'](function(_0x5a34bb){logger['info'](_0xa982('0xd'),_0x510ec7,_0xa982('0xe'));logger[_0xa982('0xf')](_0xa982('0x10'),_0x510ec7,'request\x20sent',JSON['stringify'](_0x5a34bb));if(_0x5a34bb[_0xa982('0x11')]){if(_0x5a34bb[_0xa982('0x11')][_0xa982('0x12')]===0x1f4){logger[_0xa982('0x11')](_0xa982('0xd'),_0x510ec7,_0x5a34bb[_0xa982('0x11')]['message']);return _0xc89fd9(_0x5a34bb['error'][_0xa982('0x13')]);}logger[_0xa982('0x11')](_0xa982('0xd'),_0x510ec7,_0x5a34bb[_0xa982('0x11')][_0xa982('0x13')]);return _0x143da1(_0x5a34bb[_0xa982('0x11')][_0xa982('0x13')]);}else{logger[_0xa982('0x14')](_0xa982('0xd'),_0x510ec7,_0xa982('0xe'));_0x143da1(_0x5a34bb[_0xa982('0x15')][_0xa982('0x13')]);}})['catch'](function(_0x57d44e){logger['error'](_0xa982('0xd'),_0x510ec7,_0x57d44e);_0xc89fd9(_0x57d44e);});});}exports[_0xa982('0x16')]=function(_0x438082){var _0x69e84f=this;return new Promise(function(_0x130ec8,_0xb353f5){return db[_0xa982('0x17')]['findAll']({'raw':_0x438082['options']?_0x438082['options'][_0xa982('0x18')]===undefined?!![]:![]:!![],'where':_0x438082[_0xa982('0x19')]?_0x438082[_0xa982('0x19')][_0xa982('0x1a')]||null:null,'attributes':_0x438082[_0xa982('0x19')]?_0x438082['options'][_0xa982('0x1b')]||null:null,'limit':_0x438082['options']?_0x438082[_0xa982('0x19')][_0xa982('0x1c')]||null:null,'include':_0x438082[_0xa982('0x19')]?_0x438082['options'][_0xa982('0x1d')]?_[_0xa982('0x1e')](_0x438082[_0xa982('0x19')]['include'],function(_0x4d67f5){return{'model':db[_0x4d67f5[_0xa982('0x1f')]],'as':_0x4d67f5['as'],'attributes':_0x4d67f5[_0xa982('0x1b')],'include':_0x4d67f5[_0xa982('0x1d')]?_[_0xa982('0x1e')](_0x4d67f5[_0xa982('0x1d')],function(_0x4f1e39){return{'model':db[_0x4f1e39['model']],'as':_0x4f1e39['as'],'attributes':_0x4f1e39[_0xa982('0x1b')],'include':_0x4f1e39[_0xa982('0x1d')]?_[_0xa982('0x1e')](_0x4f1e39[_0xa982('0x1d')],function(_0x3631fe){return{'model':db[_0x3631fe[_0xa982('0x1f')]],'as':_0x3631fe['as'],'attributes':_0x3631fe['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a64dd){logger[_0xa982('0x14')](_0xa982('0x16'),_0x438082);logger['debug'](_0xa982('0x16'),_0x438082,JSON[_0xa982('0x20')](_0x5a64dd));_0x130ec8(_0x5a64dd);})[_0xa982('0x21')](function(_0x278a20){logger[_0xa982('0x11')](_0xa982('0x16'),_0x278a20[_0xa982('0x13')],_0x438082);_0xb353f5(_0x69e84f[_0xa982('0x11')](0x1f4,_0x278a20[_0xa982('0x13')]));});});};exports[_0xa982('0x22')]=function(_0x437ef0){var _0x155386=this;return new Promise(function(_0x4244b0,_0x192577){return db[_0xa982('0x17')][_0xa982('0x23')]({'raw':_0x437ef0[_0xa982('0x19')]?_0x437ef0[_0xa982('0x19')][_0xa982('0x18')]===undefined?!![]:![]:!![],'where':_0x437ef0[_0xa982('0x19')]?_0x437ef0[_0xa982('0x19')][_0xa982('0x1a')]||null:null,'attributes':_0x437ef0['options']?_0x437ef0['options']['attributes']||null:null,'include':_0x437ef0['options']?_0x437ef0['options'][_0xa982('0x1d')]?_[_0xa982('0x1e')](_0x437ef0['options'][_0xa982('0x1d')],function(_0x38093e){return{'model':db[_0x38093e[_0xa982('0x1f')]],'as':_0x38093e['as'],'attributes':_0x38093e['attributes'],'include':_0x38093e[_0xa982('0x1d')]?_[_0xa982('0x1e')](_0x38093e[_0xa982('0x1d')],function(_0x270a69){return{'model':db[_0x270a69[_0xa982('0x1f')]],'as':_0x270a69['as'],'attributes':_0x270a69[_0xa982('0x1b')],'include':_0x270a69[_0xa982('0x1d')]?_[_0xa982('0x1e')](_0x270a69[_0xa982('0x1d')],function(_0x2333dd){return{'model':db[_0x2333dd['model']],'as':_0x2333dd['as'],'attributes':_0x2333dd[_0xa982('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa982('0x24')](function(_0x498f0d){logger['info'](_0xa982('0x22'),_0x437ef0);logger[_0xa982('0xf')](_0xa982('0x22'),_0x437ef0,JSON[_0xa982('0x20')](_0x498f0d));_0x4244b0(_0x498f0d);})['catch'](function(_0x41fd83){logger[_0xa982('0x11')](_0xa982('0x22'),_0x41fd83[_0xa982('0x13')],_0x437ef0);_0x192577(_0x155386['error'](0x1f4,_0x41fd83[_0xa982('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 5d05289..ab94dce 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 _0x5f6f=['isAuthenticated','index','show','/:id/fields','getFields','getSubjects','getDescriptions','/:id/tags','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5904b5,_0x14121f){var _0x1c51f4=function(_0x36d71e){while(--_0x36d71e){_0x5904b5['push'](_0x5904b5['shift']());}};_0x1c51f4(++_0x14121f);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x8c6164,_0x1dc7db){_0x8c6164=_0x8c6164-0x0;var _0x1ca172=_0x5f6f[_0x8c6164];return _0x1ca172;};'use strict';var multer=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var path=require(_0xf5f6('0x2'));var timeout=require(_0xf5f6('0x3'));var express=require(_0xf5f6('0x4'));var router=express['Router']();var auth=require(_0xf5f6('0x5'));var interaction=require(_0xf5f6('0x6'));var config=require(_0xf5f6('0x7'));var controller=require('./intDeskConfiguration.controller');router[_0xf5f6('0x8')]('/',auth[_0xf5f6('0x9')](),controller[_0xf5f6('0xa')]);router[_0xf5f6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf5f6('0xb')]);router[_0xf5f6('0x8')](_0xf5f6('0xc'),auth[_0xf5f6('0x9')](),controller[_0xf5f6('0xd')]);router[_0xf5f6('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xf5f6('0xe')]);router[_0xf5f6('0x8')]('/:id/descriptions',auth[_0xf5f6('0x9')](),controller[_0xf5f6('0xf')]);router[_0xf5f6('0x8')](_0xf5f6('0x10'),auth[_0xf5f6('0x9')](),controller['getTags']);router[_0xf5f6('0x11')]('/',auth['isAuthenticated'](),controller[_0xf5f6('0x12')]);router[_0xf5f6('0x11')](_0xf5f6('0x10'),auth[_0xf5f6('0x9')](),controller['setTags']);router[_0xf5f6('0x13')](_0xf5f6('0x14'),auth[_0xf5f6('0x9')](),controller[_0xf5f6('0x15')]);router['delete'](_0xf5f6('0x14'),auth[_0xf5f6('0x9')](),controller[_0xf5f6('0x16')]);module[_0xf5f6('0x17')]=router; \ No newline at end of file +var _0xacf4=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','post','create','setTags','put','update','destroy'];(function(_0x1d6d68,_0x316f60){var _0x6a92a4=function(_0x45500e){while(--_0x45500e){_0x1d6d68['push'](_0x1d6d68['shift']());}};_0x6a92a4(++_0x316f60);}(_0xacf4,0xe7));var _0x4acf=function(_0x1b701a,_0x126512){_0x1b701a=_0x1b701a-0x0;var _0xb92894=_0xacf4[_0x1b701a];return _0xb92894;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var auth=require(_0x4acf('0x4'));var interaction=require(_0x4acf('0x5'));var config=require(_0x4acf('0x6'));var controller=require('./intDeskConfiguration.controller');router[_0x4acf('0x7')]('/',auth[_0x4acf('0x8')](),controller['index']);router[_0x4acf('0x7')](_0x4acf('0x9'),auth[_0x4acf('0x8')](),controller[_0x4acf('0xa')]);router[_0x4acf('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4acf('0xb')]);router['get'](_0x4acf('0xc'),auth[_0x4acf('0x8')](),controller[_0x4acf('0xd')]);router['get'](_0x4acf('0xe'),auth[_0x4acf('0x8')](),controller['getDescriptions']);router['get'](_0x4acf('0xf'),auth['isAuthenticated'](),controller['getTags']);router[_0x4acf('0x10')]('/',auth[_0x4acf('0x8')](),controller[_0x4acf('0x11')]);router[_0x4acf('0x10')](_0x4acf('0xf'),auth[_0x4acf('0x8')](),controller[_0x4acf('0x12')]);router[_0x4acf('0x13')](_0x4acf('0x9'),auth[_0x4acf('0x8')](),controller[_0x4acf('0x14')]);router['delete'](_0x4acf('0x9'),auth['isAuthenticated'](),controller[_0x4acf('0x15')]);module[_0x4acf('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 51ec97e..f8a4925 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 _0x423b=['sequelize','exports','STRING'];(function(_0x26b125,_0x40838d){var _0x53ea65=function(_0x54f5bb){while(--_0x54f5bb){_0x26b125['push'](_0x26b125['shift']());}};_0x53ea65(++_0x40838d);}(_0x423b,0x14a));var _0xb423=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x423b[_0x4ae829];return _0x256b31;};'use strict';var Sequelize=require(_0xb423('0x0'));module[_0xb423('0x1')]={'name':{'type':Sequelize[_0xb423('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x34b9=['exports','STRING','sequelize'];(function(_0x568cf0,_0x1a44cb){var _0x360f81=function(_0x414953){while(--_0x414953){_0x568cf0['push'](_0x568cf0['shift']());}};_0x360f81(++_0x1a44cb);}(_0x34b9,0x188));var _0x934b=function(_0x387267,_0x46596b){_0x387267=_0x387267-0x0;var _0x596b16=_0x34b9[_0x387267];return _0x596b16;};'use strict';var Sequelize=require(_0x934b('0x0'));module[_0x934b('0x1')]={'name':{'type':Sequelize[_0x934b('0x2')]},'description':{'type':Sequelize[_0x934b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index ddfd008..592403d 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 _0x647c=['../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','json','count','offset','set','reject','save','update','then','end','sendStatus','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','map','VIRTUAL','options','DeskConfiguration','rows','show','params','includeAll','include','find','create','body','destroy','getFields','findOne','length','getSubjects','getDescriptions','DeskField','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2ca93f,_0x368b5a){var _0x584c06=function(_0x247453){while(--_0x247453){_0x2ca93f['push'](_0x2ca93f['shift']());}};_0x584c06(++_0x368b5a);}(_0x647c,0x10c));var _0xc647=function(_0x4dc8c6,_0x3fba52){_0x4dc8c6=_0x4dc8c6-0x0;var _0x69ce1d=_0x647c[_0x4dc8c6];return _0x69ce1d;};'use strict';var pdf=require(_0xc647('0x0'));var emlformat=require(_0xc647('0x1'));var rimraf=require(_0xc647('0x2'));var zipdir=require(_0xc647('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc647('0x4'));var moment=require(_0xc647('0x5'));var BPromise=require(_0xc647('0x6'));var Mustache=require(_0xc647('0x7'));var util=require(_0xc647('0x8'));var path=require(_0xc647('0x9'));var sox=require(_0xc647('0xa'));var csv=require(_0xc647('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc647('0xc'));var squel=require(_0xc647('0xd'));var crypto=require(_0xc647('0xe'));var jsforce=require(_0xc647('0xf'));var deskjs=require(_0xc647('0x10'));var toCsv=require(_0xc647('0xb'));var querystring=require('querystring');var Papa=require(_0xc647('0x11'));var Redis=require(_0xc647('0x12'));var authService=require(_0xc647('0x13'));var qs=require(_0xc647('0x14'));var as=require(_0xc647('0x15'));var hardwareService=require(_0xc647('0x16'));var logger=require(_0xc647('0x17'))(_0xc647('0x18'));var utils=require(_0xc647('0x19'));var config=require(_0xc647('0x1a'));var licenseUtil=require(_0xc647('0x1b'));var db=require(_0xc647('0x1c'))['db'];var jayson=require(_0xc647('0x1d'));var client=jayson[_0xc647('0x1e')][_0xc647('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4b7dec,_0x4ea7fd,_0x10d1f6,_0x4e355a){return new BPromise(function(_0x57466f,_0x19ef51){var _0x495967=_0x4e355a||client;return _0x495967[_0xc647('0x20')](_0x4b7dec,_0x10d1f6)['then'](function(_0x392ec8){logger['info'](_0xc647('0x21'),_0x4ea7fd,_0xc647('0x22'));logger[_0xc647('0x23')](_0xc647('0x24'),_0x4ea7fd,'request\x20sent',JSON[_0xc647('0x25')](_0x392ec8));if(_0x392ec8[_0xc647('0x26')]){if(_0x392ec8[_0xc647('0x26')]['code']===0x1f4){logger['error'](_0xc647('0x21'),_0x4ea7fd,_0x392ec8[_0xc647('0x26')][_0xc647('0x27')]);return _0x19ef51(_0x392ec8[_0xc647('0x26')]['message']);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4ea7fd,_0x392ec8[_0xc647('0x26')][_0xc647('0x27')]);return _0x57466f(_0x392ec8[_0xc647('0x26')][_0xc647('0x27')]);}else{logger['info'](_0xc647('0x21'),_0x4ea7fd,_0xc647('0x22'));_0x57466f(_0x392ec8['result']['message']);}})[_0xc647('0x28')](function(_0x4286bf){logger['error'](_0xc647('0x21'),_0x4ea7fd,_0x4286bf);_0x19ef51(_0x4286bf);});});}function respondWithStatusCode(_0x1066f5,_0x256597){_0x256597=_0x256597||0xcc;return function(_0x1704c4){if(_0x1704c4){return _0x1066f5['sendStatus'](_0x256597);}return _0x1066f5['status'](_0x256597)['end']();};}function respondWithResult(_0xc29576,_0x27123f){_0x27123f=_0x27123f||0xc8;return function(_0x5cce34){if(_0x5cce34){return _0xc29576[_0xc647('0x29')](_0x27123f)[_0xc647('0x2a')](_0x5cce34);}};}function respondWithFilteredResult(_0x452ae6,_0x5060e9){return function(_0x455d6a){if(_0x455d6a){var _0x4a6d8f=_0x455d6a[_0xc647('0x2b')],_0x2abd8b=_0x5060e9['offset'],_0xeadf94=_0x5060e9[_0xc647('0x2c')]+_0x5060e9['limit'],_0x289251;if(_0xeadf94>=_0x4a6d8f){_0xeadf94=_0x4a6d8f;_0x289251=0xc8;}else{_0x289251=0xce;}_0x452ae6[_0xc647('0x29')](_0x289251);return _0x452ae6[_0xc647('0x2d')]('Content-Range',_0x2abd8b+'-'+_0xeadf94+'/'+_0x4a6d8f)['json'](_0x455d6a);}return null;};}function patchUpdates(_0x2a62e4){return function(_0x582a53){try{jsonpatch['apply'](_0x582a53,_0x2a62e4,!![]);}catch(_0x1237c4){return BPromise[_0xc647('0x2e')](_0x1237c4);}return _0x582a53[_0xc647('0x2f')]();};}function saveUpdates(_0x1ed13a,_0x2d7656){return function(_0x56ccf0){if(_0x56ccf0){return _0x56ccf0[_0xc647('0x30')](_0x1ed13a)[_0xc647('0x31')](function(_0x1a06fd){return _0x1a06fd;});}return null;};}function removeEntity(_0x2dd332,_0x4b8897){return function(_0x5bb573){if(_0x5bb573){return _0x5bb573['destroy']()[_0xc647('0x31')](function(){_0x2dd332['status'](0xcc)[_0xc647('0x32')]();});}};}function handleEntityNotFound(_0x5f4e27,_0x55df04){return function(_0x1c6be4){if(!_0x1c6be4){_0x5f4e27[_0xc647('0x33')](0x194);}return _0x1c6be4;};}function handleError(_0x22b72a,_0x1fb2a3){_0x1fb2a3=_0x1fb2a3||0x1f4;return function(_0x472c5e){logger[_0xc647('0x26')](_0x472c5e[_0xc647('0x34')]);if(_0x472c5e['name']){delete _0x472c5e[_0xc647('0x35')];}_0x22b72a[_0xc647('0x29')](_0x1fb2a3)['send'](_0x472c5e);};}exports[_0xc647('0x36')]=function(_0x5ef0ed,_0x22cdfa){var _0x4b38a9={},_0x1b3678={},_0x53bb91={'count':0x0,'rows':[]};var _0x224685=_['map'](db['DeskConfiguration'][_0xc647('0x37')],function(_0x42683d){return{'name':_0x42683d[_0xc647('0x38')],'type':_0x42683d[_0xc647('0x39')][_0xc647('0x3a')]};});_0x1b3678[_0xc647('0x3b')]=_['map'](_0x224685,_0xc647('0x35'));_0x1b3678[_0xc647('0x3c')]=_[_0xc647('0x3d')](_0x5ef0ed['query']);_0x1b3678[_0xc647('0x3e')]=_[_0xc647('0x3f')](_0x1b3678[_0xc647('0x3b')],_0x1b3678['query']);_0x4b38a9[_0xc647('0x40')]=_[_0xc647('0x3f')](_0x1b3678[_0xc647('0x3b')],qs['fields'](_0x5ef0ed[_0xc647('0x3c')][_0xc647('0x41')]));_0x4b38a9[_0xc647('0x40')]=_0x4b38a9['attributes']['length']?_0x4b38a9[_0xc647('0x40')]:_0x1b3678[_0xc647('0x3b')];if(!_0x5ef0ed['query'][_0xc647('0x42')](_0xc647('0x43'))){_0x4b38a9[_0xc647('0x44')]=qs[_0xc647('0x44')](_0x5ef0ed[_0xc647('0x3c')][_0xc647('0x44')]);_0x4b38a9['offset']=qs[_0xc647('0x2c')](_0x5ef0ed[_0xc647('0x3c')]['offset']);}_0x4b38a9[_0xc647('0x45')]=qs[_0xc647('0x46')](_0x5ef0ed['query'][_0xc647('0x46')]);_0x4b38a9['where']=qs[_0xc647('0x3e')](_[_0xc647('0x47')](_0x5ef0ed[_0xc647('0x3c')],_0x1b3678['filters']),_0x224685);if(_0x5ef0ed[_0xc647('0x3c')][_0xc647('0x48')]){_0x4b38a9['where']=_[_0xc647('0x49')](_0x4b38a9[_0xc647('0x4a')],{'$or':_[_0xc647('0x4b')](_0x224685,function(_0x449956){if(_0x449956[_0xc647('0x39')]!==_0xc647('0x4c')){var _0x165c7c={};_0x165c7c[_0x449956[_0xc647('0x35')]]={'$like':'%'+_0x5ef0ed[_0xc647('0x3c')][_0xc647('0x48')]+'%'};return _0x165c7c;}})});}_0x4b38a9=_[_0xc647('0x49')]({},_0x4b38a9,_0x5ef0ed[_0xc647('0x4d')]);var _0x4e1c32={'where':_0x4b38a9[_0xc647('0x4a')]};return db[_0xc647('0x4e')][_0xc647('0x2b')](_0x4e1c32)[_0xc647('0x31')](function(_0x36e875){_0x53bb91['count']=_0x36e875;if(_0x5ef0ed[_0xc647('0x3c')]['includeAll']){_0x4b38a9['include']=[{'all':!![]}];}return db[_0xc647('0x4e')]['findAll'](_0x4b38a9);})[_0xc647('0x31')](function(_0x442b04){_0x53bb91[_0xc647('0x4f')]=_0x442b04;return _0x53bb91;})['then'](respondWithFilteredResult(_0x22cdfa,_0x4b38a9))[_0xc647('0x28')](handleError(_0x22cdfa,null));};exports[_0xc647('0x50')]=function(_0x374d5a,_0x4aa27e){var _0x19be49={'raw':![],'where':{'id':_0x374d5a[_0xc647('0x51')]['id']}},_0x4df6c4={};_0x4df6c4[_0xc647('0x3b')]=_[_0xc647('0x3d')](db[_0xc647('0x4e')][_0xc647('0x37')]);_0x4df6c4[_0xc647('0x3c')]=_['keys'](_0x374d5a['query']);_0x4df6c4[_0xc647('0x3e')]=_[_0xc647('0x3f')](_0x4df6c4[_0xc647('0x3b')],_0x4df6c4['query']);_0x19be49[_0xc647('0x40')]=_[_0xc647('0x3f')](_0x4df6c4[_0xc647('0x3b')],qs[_0xc647('0x41')](_0x374d5a[_0xc647('0x3c')][_0xc647('0x41')]));_0x19be49[_0xc647('0x40')]=_0x19be49[_0xc647('0x40')]['length']?_0x19be49[_0xc647('0x40')]:_0x4df6c4[_0xc647('0x3b')];if(_0x374d5a['query'][_0xc647('0x52')]){_0x19be49[_0xc647('0x53')]=[{'all':!![]}];}_0x19be49=_['merge']({},_0x19be49,_0x374d5a[_0xc647('0x4d')]);return db['DeskConfiguration'][_0xc647('0x54')](_0x19be49)[_0xc647('0x31')](handleEntityNotFound(_0x4aa27e,null))[_0xc647('0x31')](respondWithResult(_0x4aa27e,null))[_0xc647('0x28')](handleError(_0x4aa27e,null));};exports[_0xc647('0x55')]=function(_0x200fcc,_0x329680){return db[_0xc647('0x4e')][_0xc647('0x55')](_0x200fcc[_0xc647('0x56')],{})[_0xc647('0x31')](respondWithResult(_0x329680,0xc9))['catch'](handleError(_0x329680,null));};exports[_0xc647('0x30')]=function(_0x5ca612,_0x4bb02b){if(_0x5ca612[_0xc647('0x56')]['id']){delete _0x5ca612['body']['id'];}return db[_0xc647('0x4e')][_0xc647('0x54')]({'where':{'id':_0x5ca612['params']['id']}})[_0xc647('0x31')](handleEntityNotFound(_0x4bb02b,null))['then'](saveUpdates(_0x5ca612[_0xc647('0x56')],null))[_0xc647('0x31')](respondWithResult(_0x4bb02b,null))[_0xc647('0x28')](handleError(_0x4bb02b,null));};exports[_0xc647('0x57')]=function(_0x2e02aa,_0xd237d){return db[_0xc647('0x4e')][_0xc647('0x54')]({'where':{'id':_0x2e02aa[_0xc647('0x51')]['id']}})['then'](handleEntityNotFound(_0xd237d,null))[_0xc647('0x31')](removeEntity(_0xd237d,null))[_0xc647('0x28')](handleError(_0xd237d,null));};exports[_0xc647('0x58')]=function(_0x34cb5c,_0x341fa4,_0x4654bc){var _0x56dcfa={};var _0x14e6da={};var _0x1fde82;var _0x5813b9;return db[_0xc647('0x4e')][_0xc647('0x59')]({'where':{'id':_0x34cb5c[_0xc647('0x51')]['id']}})[_0xc647('0x31')](handleEntityNotFound(_0x341fa4,null))['then'](function(_0x55f56b){if(_0x55f56b){_0x1fde82=_0x55f56b;_0x14e6da[_0xc647('0x3b')]=_[_0xc647('0x3d')](db['DeskField'][_0xc647('0x37')]);_0x14e6da[_0xc647('0x3c')]=_['keys'](_0x34cb5c[_0xc647('0x3c')]);_0x14e6da['filters']=_[_0xc647('0x3f')](_0x14e6da['model'],_0x14e6da[_0xc647('0x3c')]);_0x56dcfa[_0xc647('0x40')]=_[_0xc647('0x3f')](_0x14e6da[_0xc647('0x3b')],qs[_0xc647('0x41')](_0x34cb5c['query'][_0xc647('0x41')]));_0x56dcfa['attributes']=_0x56dcfa[_0xc647('0x40')]['length']?_0x56dcfa[_0xc647('0x40')]:_0x14e6da['model'];_0x56dcfa['order']=qs[_0xc647('0x46')](_0x34cb5c[_0xc647('0x3c')][_0xc647('0x46')]);_0x56dcfa[_0xc647('0x4a')]=qs[_0xc647('0x3e')](_[_0xc647('0x47')](_0x34cb5c[_0xc647('0x3c')],_0x14e6da['filters']));if(_0x34cb5c[_0xc647('0x3c')][_0xc647('0x48')]){_0x56dcfa[_0xc647('0x4a')]=_[_0xc647('0x49')](_0x56dcfa[_0xc647('0x4a')],{'$or':_[_0xc647('0x4b')](_0x56dcfa[_0xc647('0x40')],function(_0x4df79a){var _0x5d421e={};_0x5d421e[_0x4df79a]={'$like':'%'+_0x34cb5c[_0xc647('0x3c')][_0xc647('0x48')]+'%'};return _0x5d421e;})});}_0x56dcfa=_[_0xc647('0x49')]({},_0x56dcfa,_0x34cb5c[_0xc647('0x4d')]);return _0x1fde82[_0xc647('0x58')](_0x56dcfa);}})['then'](function(_0x22daa0){if(_0x22daa0){_0x5813b9=_0x22daa0[_0xc647('0x5a')];if(!_0x34cb5c[_0xc647('0x3c')][_0xc647('0x42')]('nolimit')){_0x56dcfa[_0xc647('0x44')]=qs[_0xc647('0x44')](_0x34cb5c[_0xc647('0x3c')][_0xc647('0x44')]);_0x56dcfa[_0xc647('0x2c')]=qs['offset'](_0x34cb5c[_0xc647('0x3c')]['offset']);}return _0x1fde82[_0xc647('0x58')](_0x56dcfa);}})[_0xc647('0x31')](function(_0x21f26e){if(_0x21f26e){return _0x21f26e?{'count':_0x5813b9,'rows':_0x21f26e}:null;}})[_0xc647('0x31')](respondWithResult(_0x341fa4,null))[_0xc647('0x28')](handleError(_0x341fa4,null));};exports['getSubjects']=function(_0x4b03bc,_0x22ae82,_0x38c72d){var _0x1b88ea={};var _0x1de4e4={};var _0x494ae1;var _0x1fb40d;return db['DeskConfiguration'][_0xc647('0x59')]({'where':{'id':_0x4b03bc['params']['id']}})['then'](handleEntityNotFound(_0x22ae82,null))[_0xc647('0x31')](function(_0x4ad1a1){if(_0x4ad1a1){_0x494ae1=_0x4ad1a1;_0x1de4e4[_0xc647('0x3b')]=_[_0xc647('0x3d')](db['DeskField'][_0xc647('0x37')]);_0x1de4e4[_0xc647('0x3c')]=_[_0xc647('0x3d')](_0x4b03bc[_0xc647('0x3c')]);_0x1de4e4[_0xc647('0x3e')]=_[_0xc647('0x3f')](_0x1de4e4[_0xc647('0x3b')],_0x1de4e4[_0xc647('0x3c')]);_0x1b88ea[_0xc647('0x40')]=_[_0xc647('0x3f')](_0x1de4e4[_0xc647('0x3b')],qs['fields'](_0x4b03bc[_0xc647('0x3c')][_0xc647('0x41')]));_0x1b88ea[_0xc647('0x40')]=_0x1b88ea['attributes'][_0xc647('0x5a')]?_0x1b88ea[_0xc647('0x40')]:_0x1de4e4['model'];_0x1b88ea[_0xc647('0x45')]=qs[_0xc647('0x46')](_0x4b03bc[_0xc647('0x3c')][_0xc647('0x46')]);_0x1b88ea['where']=qs[_0xc647('0x3e')](_[_0xc647('0x47')](_0x4b03bc[_0xc647('0x3c')],_0x1de4e4[_0xc647('0x3e')]));if(_0x4b03bc['query'][_0xc647('0x48')]){_0x1b88ea[_0xc647('0x4a')]=_[_0xc647('0x49')](_0x1b88ea['where'],{'$or':_[_0xc647('0x4b')](_0x1b88ea['attributes'],function(_0x39a60a){var _0x8c0d26={};_0x8c0d26[_0x39a60a]={'$like':'%'+_0x4b03bc[_0xc647('0x3c')]['filter']+'%'};return _0x8c0d26;})});}_0x1b88ea=_['merge']({},_0x1b88ea,_0x4b03bc[_0xc647('0x4d')]);return _0x494ae1['getSubjects'](_0x1b88ea);}})[_0xc647('0x31')](function(_0x13b4dc){if(_0x13b4dc){_0x1fb40d=_0x13b4dc[_0xc647('0x5a')];if(!_0x4b03bc['query']['hasOwnProperty'](_0xc647('0x43'))){_0x1b88ea[_0xc647('0x44')]=qs[_0xc647('0x44')](_0x4b03bc['query'][_0xc647('0x44')]);_0x1b88ea[_0xc647('0x2c')]=qs['offset'](_0x4b03bc[_0xc647('0x3c')][_0xc647('0x2c')]);}return _0x494ae1[_0xc647('0x5b')](_0x1b88ea);}})[_0xc647('0x31')](function(_0x870733){if(_0x870733){return _0x870733?{'count':_0x1fb40d,'rows':_0x870733}:null;}})[_0xc647('0x31')](respondWithResult(_0x22ae82,null))[_0xc647('0x28')](handleError(_0x22ae82,null));};exports[_0xc647('0x5c')]=function(_0x5a02ed,_0x39992a,_0x3c9404){var _0x318cbe={};var _0x57d796={};var _0x29e351;var _0x235932;return db['DeskConfiguration']['findOne']({'where':{'id':_0x5a02ed[_0xc647('0x51')]['id']}})[_0xc647('0x31')](handleEntityNotFound(_0x39992a,null))[_0xc647('0x31')](function(_0x4ed29d){if(_0x4ed29d){_0x29e351=_0x4ed29d;_0x57d796[_0xc647('0x3b')]=_[_0xc647('0x3d')](db[_0xc647('0x5d')][_0xc647('0x37')]);_0x57d796[_0xc647('0x3c')]=_['keys'](_0x5a02ed[_0xc647('0x3c')]);_0x57d796['filters']=_[_0xc647('0x3f')](_0x57d796[_0xc647('0x3b')],_0x57d796[_0xc647('0x3c')]);_0x318cbe[_0xc647('0x40')]=_['intersection'](_0x57d796[_0xc647('0x3b')],qs[_0xc647('0x41')](_0x5a02ed[_0xc647('0x3c')]['fields']));_0x318cbe[_0xc647('0x40')]=_0x318cbe[_0xc647('0x40')][_0xc647('0x5a')]?_0x318cbe[_0xc647('0x40')]:_0x57d796[_0xc647('0x3b')];_0x318cbe['order']=qs['sort'](_0x5a02ed[_0xc647('0x3c')][_0xc647('0x46')]);_0x318cbe[_0xc647('0x4a')]=qs['filters'](_[_0xc647('0x47')](_0x5a02ed[_0xc647('0x3c')],_0x57d796[_0xc647('0x3e')]));if(_0x5a02ed[_0xc647('0x3c')]['filter']){_0x318cbe[_0xc647('0x4a')]=_[_0xc647('0x49')](_0x318cbe['where'],{'$or':_[_0xc647('0x4b')](_0x318cbe[_0xc647('0x40')],function(_0x3a9531){var _0x114bec={};_0x114bec[_0x3a9531]={'$like':'%'+_0x5a02ed[_0xc647('0x3c')]['filter']+'%'};return _0x114bec;})});}_0x318cbe=_[_0xc647('0x49')]({},_0x318cbe,_0x5a02ed['options']);return _0x29e351[_0xc647('0x5c')](_0x318cbe);}})[_0xc647('0x31')](function(_0x3304e3){if(_0x3304e3){_0x235932=_0x3304e3[_0xc647('0x5a')];if(!_0x5a02ed[_0xc647('0x3c')][_0xc647('0x42')](_0xc647('0x43'))){_0x318cbe[_0xc647('0x44')]=qs['limit'](_0x5a02ed[_0xc647('0x3c')]['limit']);_0x318cbe[_0xc647('0x2c')]=qs[_0xc647('0x2c')](_0x5a02ed['query']['offset']);}return _0x29e351[_0xc647('0x5c')](_0x318cbe);}})[_0xc647('0x31')](function(_0x4468a2){if(_0x4468a2){return _0x4468a2?{'count':_0x235932,'rows':_0x4468a2}:null;}})[_0xc647('0x31')](respondWithResult(_0x39992a,null))[_0xc647('0x28')](handleError(_0x39992a,null));};exports[_0xc647('0x5e')]=function(_0x4ddb8e,_0x43fa5,_0x38c8f6){var _0x21aceb={};var _0x19a1a4={};var _0x5c8f95;var _0x1032b3;return db[_0xc647('0x4e')]['findOne']({'where':{'id':_0x4ddb8e[_0xc647('0x51')]['id']}})['then'](handleEntityNotFound(_0x43fa5,null))['then'](function(_0x44bdda){if(_0x44bdda){_0x5c8f95=_0x44bdda;_0x19a1a4['model']=_[_0xc647('0x3d')](db[_0xc647('0x5f')][_0xc647('0x37')]);_0x19a1a4[_0xc647('0x3c')]=_[_0xc647('0x3d')](_0x4ddb8e[_0xc647('0x3c')]);_0x19a1a4[_0xc647('0x3e')]=_[_0xc647('0x3f')](_0x19a1a4[_0xc647('0x3b')],_0x19a1a4[_0xc647('0x3c')]);_0x21aceb['attributes']=_[_0xc647('0x3f')](_0x19a1a4[_0xc647('0x3b')],qs[_0xc647('0x41')](_0x4ddb8e[_0xc647('0x3c')][_0xc647('0x41')]));_0x21aceb[_0xc647('0x40')]=_0x21aceb['attributes'][_0xc647('0x5a')]?_0x21aceb['attributes']:_0x19a1a4['model'];_0x21aceb[_0xc647('0x45')]=qs['sort'](_0x4ddb8e['query'][_0xc647('0x46')]);_0x21aceb[_0xc647('0x4a')]=qs[_0xc647('0x3e')](_[_0xc647('0x47')](_0x4ddb8e[_0xc647('0x3c')],_0x19a1a4[_0xc647('0x3e')]));if(_0x4ddb8e[_0xc647('0x3c')][_0xc647('0x48')]){_0x21aceb[_0xc647('0x4a')]=_[_0xc647('0x49')](_0x21aceb[_0xc647('0x4a')],{'$or':_[_0xc647('0x4b')](_0x21aceb['attributes'],function(_0x5a4bb8){var _0xc731ce={};_0xc731ce[_0x5a4bb8]={'$like':'%'+_0x4ddb8e['query'][_0xc647('0x48')]+'%'};return _0xc731ce;})});}_0x21aceb=_[_0xc647('0x49')]({},_0x21aceb,_0x4ddb8e[_0xc647('0x4d')]);return _0x5c8f95[_0xc647('0x5e')](_0x21aceb);}})[_0xc647('0x31')](function(_0x5b198c){if(_0x5b198c){_0x1032b3=_0x5b198c['length'];if(!_0x4ddb8e['query'][_0xc647('0x42')](_0xc647('0x43'))){_0x21aceb[_0xc647('0x44')]=qs['limit'](_0x4ddb8e[_0xc647('0x3c')][_0xc647('0x44')]);_0x21aceb['offset']=qs[_0xc647('0x2c')](_0x4ddb8e[_0xc647('0x3c')][_0xc647('0x2c')]);}return _0x5c8f95['getTags'](_0x21aceb);}})[_0xc647('0x31')](function(_0x5820ce){if(_0x5820ce){return _0x5820ce?{'count':_0x1032b3,'rows':_0x5820ce}:null;}})[_0xc647('0x31')](respondWithResult(_0x43fa5,null))[_0xc647('0x28')](handleError(_0x43fa5,null));};exports[_0xc647('0x60')]=function(_0x2b803f,_0x378a53,_0x35adf){if(_0x2b803f[_0xc647('0x56')]['id']){delete _0x2b803f[_0xc647('0x56')]['id'];}return db[_0xc647('0x4e')]['findOne']({'where':{'id':_0x2b803f[_0xc647('0x51')]['id']}})[_0xc647('0x31')](handleEntityNotFound(_0x378a53,null))[_0xc647('0x31')](function(_0x652072){if(_0x652072){return _0x652072['setTags'](_0x2b803f[_0xc647('0x56')][_0xc647('0x61')]||[]);}return null;})[_0xc647('0x31')](respondWithResult(_0x378a53,null))[_0xc647('0x28')](handleError(_0x378a53,null));}; \ No newline at end of file +var _0xabae=['request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','destroy','end','name','send','map','DeskConfiguration','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','create','body','update','params','DeskField','getFields','getSubjects','findOne','getDescriptions','order','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','moment','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/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0xabae,0x162));var _0xeaba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xabae[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xeaba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeaba('0x1'));var zipdir=require(_0xeaba('0x2'));var jsonpatch=require(_0xeaba('0x3'));var rp=require('request-promise');var moment=require(_0xeaba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeaba('0x5'));var util=require(_0xeaba('0x6'));var path=require('path');var sox=require(_0xeaba('0x7'));var csv=require(_0xeaba('0x8'));var ejs=require(_0xeaba('0x9'));var fs=require('fs');var _=require(_0xeaba('0xa'));var squel=require(_0xeaba('0xb'));var crypto=require(_0xeaba('0xc'));var jsforce=require(_0xeaba('0xd'));var deskjs=require(_0xeaba('0xe'));var toCsv=require(_0xeaba('0x8'));var querystring=require(_0xeaba('0xf'));var Papa=require(_0xeaba('0x10'));var Redis=require(_0xeaba('0x11'));var authService=require(_0xeaba('0x12'));var qs=require(_0xeaba('0x13'));var as=require(_0xeaba('0x14'));var hardwareService=require(_0xeaba('0x15'));var logger=require(_0xeaba('0x16'))(_0xeaba('0x17'));var utils=require(_0xeaba('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xeaba('0x19'));var db=require(_0xeaba('0x1a'))['db'];var jayson=require(_0xeaba('0x1b'));var client=jayson[_0xeaba('0x1c')][_0xeaba('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x64aa96,_0x3cceb5,_0x5cc8c9,_0xc7ef4d){return new BPromise(function(_0x3d42df,_0x17982f){var _0xbb19f8=_0xc7ef4d||client;return _0xbb19f8[_0xeaba('0x1e')](_0x64aa96,_0x5cc8c9)[_0xeaba('0x1f')](function(_0x579b59){logger[_0xeaba('0x20')](_0xeaba('0x21'),_0x3cceb5,_0xeaba('0x22'));logger[_0xeaba('0x23')](_0xeaba('0x24'),_0x3cceb5,_0xeaba('0x22'),JSON[_0xeaba('0x25')](_0x579b59));if(_0x579b59[_0xeaba('0x26')]){if(_0x579b59['error'][_0xeaba('0x27')]===0x1f4){logger['error'](_0xeaba('0x21'),_0x3cceb5,_0x579b59[_0xeaba('0x26')]['message']);return _0x17982f(_0x579b59[_0xeaba('0x26')][_0xeaba('0x28')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3cceb5,_0x579b59[_0xeaba('0x26')][_0xeaba('0x28')]);return _0x3d42df(_0x579b59[_0xeaba('0x26')][_0xeaba('0x28')]);}else{logger[_0xeaba('0x20')](_0xeaba('0x21'),_0x3cceb5,_0xeaba('0x22'));_0x3d42df(_0x579b59[_0xeaba('0x29')][_0xeaba('0x28')]);}})[_0xeaba('0x2a')](function(_0x2c0785){logger[_0xeaba('0x26')](_0xeaba('0x21'),_0x3cceb5,_0x2c0785);_0x17982f(_0x2c0785);});});}function respondWithStatusCode(_0x3a6912,_0x2c4505){_0x2c4505=_0x2c4505||0xcc;return function(_0x472974){if(_0x472974){return _0x3a6912[_0xeaba('0x2b')](_0x2c4505);}return _0x3a6912[_0xeaba('0x2c')](_0x2c4505)['end']();};}function respondWithResult(_0x5e1d24,_0x328a30){_0x328a30=_0x328a30||0xc8;return function(_0x1cf0e3){if(_0x1cf0e3){return _0x5e1d24[_0xeaba('0x2c')](_0x328a30)[_0xeaba('0x2d')](_0x1cf0e3);}};}function respondWithFilteredResult(_0x5f5cef,_0x46c900){return function(_0x2abb53){if(_0x2abb53){var _0x427749=_0x2abb53[_0xeaba('0x2e')],_0x8f3f29=_0x46c900['offset'],_0x318adf=_0x46c900[_0xeaba('0x2f')]+_0x46c900[_0xeaba('0x30')],_0x2c3bb1;if(_0x318adf>=_0x427749){_0x318adf=_0x427749;_0x2c3bb1=0xc8;}else{_0x2c3bb1=0xce;}_0x5f5cef[_0xeaba('0x2c')](_0x2c3bb1);return _0x5f5cef['set'](_0xeaba('0x31'),_0x8f3f29+'-'+_0x318adf+'/'+_0x427749)[_0xeaba('0x2d')](_0x2abb53);}return null;};}function patchUpdates(_0x1196dc){return function(_0x2a0b87){try{jsonpatch[_0xeaba('0x32')](_0x2a0b87,_0x1196dc,!![]);}catch(_0x272c92){return BPromise['reject'](_0x272c92);}return _0x2a0b87['save']();};}function saveUpdates(_0x49996f,_0x13c6c9){return function(_0x4ec857){if(_0x4ec857){return _0x4ec857['update'](_0x49996f)[_0xeaba('0x1f')](function(_0x1b363b){return _0x1b363b;});}return null;};}function removeEntity(_0x28d0f0,_0x3e005f){return function(_0x46f68e){if(_0x46f68e){return _0x46f68e[_0xeaba('0x33')]()[_0xeaba('0x1f')](function(){_0x28d0f0['status'](0xcc)[_0xeaba('0x34')]();});}};}function handleEntityNotFound(_0x57b8d8,_0x342da8){return function(_0x514bec){if(!_0x514bec){_0x57b8d8[_0xeaba('0x2b')](0x194);}return _0x514bec;};}function handleError(_0x561866,_0x1bff3a){_0x1bff3a=_0x1bff3a||0x1f4;return function(_0x27fc0a){logger['error'](_0x27fc0a['stack']);if(_0x27fc0a['name']){delete _0x27fc0a[_0xeaba('0x35')];}_0x561866[_0xeaba('0x2c')](_0x1bff3a)[_0xeaba('0x36')](_0x27fc0a);};}exports['index']=function(_0x5d2081,_0x5e071a){var _0x55be04={},_0xa7f2bb={},_0x22423e={'count':0x0,'rows':[]};var _0x427a9c=_[_0xeaba('0x37')](db[_0xeaba('0x38')][_0xeaba('0x39')],function(_0x169339){return{'name':_0x169339[_0xeaba('0x3a')],'type':_0x169339['type'][_0xeaba('0x3b')]};});_0xa7f2bb['model']=_[_0xeaba('0x37')](_0x427a9c,_0xeaba('0x35'));_0xa7f2bb[_0xeaba('0x3c')]=_[_0xeaba('0x3d')](_0x5d2081['query']);_0xa7f2bb['filters']=_[_0xeaba('0x3e')](_0xa7f2bb['model'],_0xa7f2bb[_0xeaba('0x3c')]);_0x55be04[_0xeaba('0x3f')]=_['intersection'](_0xa7f2bb[_0xeaba('0x40')],qs[_0xeaba('0x41')](_0x5d2081[_0xeaba('0x3c')][_0xeaba('0x41')]));_0x55be04[_0xeaba('0x3f')]=_0x55be04[_0xeaba('0x3f')][_0xeaba('0x42')]?_0x55be04['attributes']:_0xa7f2bb[_0xeaba('0x40')];if(!_0x5d2081[_0xeaba('0x3c')][_0xeaba('0x43')](_0xeaba('0x44'))){_0x55be04[_0xeaba('0x30')]=qs[_0xeaba('0x30')](_0x5d2081[_0xeaba('0x3c')]['limit']);_0x55be04['offset']=qs['offset'](_0x5d2081[_0xeaba('0x3c')]['offset']);}_0x55be04['order']=qs[_0xeaba('0x45')](_0x5d2081[_0xeaba('0x3c')][_0xeaba('0x45')]);_0x55be04[_0xeaba('0x46')]=qs['filters'](_[_0xeaba('0x47')](_0x5d2081[_0xeaba('0x3c')],_0xa7f2bb[_0xeaba('0x48')]),_0x427a9c);if(_0x5d2081['query'][_0xeaba('0x49')]){_0x55be04[_0xeaba('0x46')]=_[_0xeaba('0x4a')](_0x55be04[_0xeaba('0x46')],{'$or':_['map'](_0x427a9c,function(_0xa063f9){if(_0xa063f9['type']!==_0xeaba('0x4b')){var _0x5ea533={};_0x5ea533[_0xa063f9['name']]={'$like':'%'+_0x5d2081[_0xeaba('0x3c')][_0xeaba('0x49')]+'%'};return _0x5ea533;}})});}_0x55be04=_[_0xeaba('0x4a')]({},_0x55be04,_0x5d2081[_0xeaba('0x4c')]);var _0x53b9e8={'where':_0x55be04[_0xeaba('0x46')]};return db[_0xeaba('0x38')][_0xeaba('0x2e')](_0x53b9e8)[_0xeaba('0x1f')](function(_0x314ce4){_0x22423e[_0xeaba('0x2e')]=_0x314ce4;if(_0x5d2081['query']['includeAll']){_0x55be04[_0xeaba('0x4d')]=[{'all':!![]}];}return db[_0xeaba('0x38')][_0xeaba('0x4e')](_0x55be04);})[_0xeaba('0x1f')](function(_0x16cee1){_0x22423e[_0xeaba('0x4f')]=_0x16cee1;return _0x22423e;})[_0xeaba('0x1f')](respondWithFilteredResult(_0x5e071a,_0x55be04))['catch'](handleError(_0x5e071a,null));};exports[_0xeaba('0x50')]=function(_0x5dfc29,_0x54b61c){var _0x5157bb={'raw':![],'where':{'id':_0x5dfc29['params']['id']}},_0x70b630={};_0x70b630[_0xeaba('0x40')]=_[_0xeaba('0x3d')](db[_0xeaba('0x38')][_0xeaba('0x39')]);_0x70b630[_0xeaba('0x3c')]=_[_0xeaba('0x3d')](_0x5dfc29['query']);_0x70b630[_0xeaba('0x48')]=_[_0xeaba('0x3e')](_0x70b630[_0xeaba('0x40')],_0x70b630[_0xeaba('0x3c')]);_0x5157bb[_0xeaba('0x3f')]=_[_0xeaba('0x3e')](_0x70b630['model'],qs[_0xeaba('0x41')](_0x5dfc29[_0xeaba('0x3c')]['fields']));_0x5157bb[_0xeaba('0x3f')]=_0x5157bb[_0xeaba('0x3f')]['length']?_0x5157bb['attributes']:_0x70b630[_0xeaba('0x40')];if(_0x5dfc29['query'][_0xeaba('0x51')]){_0x5157bb['include']=[{'all':!![]}];}_0x5157bb=_['merge']({},_0x5157bb,_0x5dfc29[_0xeaba('0x4c')]);return db[_0xeaba('0x38')][_0xeaba('0x52')](_0x5157bb)[_0xeaba('0x1f')](handleEntityNotFound(_0x54b61c,null))[_0xeaba('0x1f')](respondWithResult(_0x54b61c,null))['catch'](handleError(_0x54b61c,null));};exports[_0xeaba('0x53')]=function(_0x4b29cb,_0x1151e4){return db[_0xeaba('0x38')][_0xeaba('0x53')](_0x4b29cb[_0xeaba('0x54')],{})['then'](respondWithResult(_0x1151e4,0xc9))['catch'](handleError(_0x1151e4,null));};exports[_0xeaba('0x55')]=function(_0x4c334b,_0x395179){if(_0x4c334b[_0xeaba('0x54')]['id']){delete _0x4c334b['body']['id'];}return db[_0xeaba('0x38')][_0xeaba('0x52')]({'where':{'id':_0x4c334b[_0xeaba('0x56')]['id']}})[_0xeaba('0x1f')](handleEntityNotFound(_0x395179,null))[_0xeaba('0x1f')](saveUpdates(_0x4c334b['body'],null))['then'](respondWithResult(_0x395179,null))['catch'](handleError(_0x395179,null));};exports[_0xeaba('0x33')]=function(_0x4d9cc0,_0x4ec456){return db[_0xeaba('0x38')]['find']({'where':{'id':_0x4d9cc0[_0xeaba('0x56')]['id']}})[_0xeaba('0x1f')](handleEntityNotFound(_0x4ec456,null))[_0xeaba('0x1f')](removeEntity(_0x4ec456,null))[_0xeaba('0x2a')](handleError(_0x4ec456,null));};exports['getFields']=function(_0x405e64,_0x4e5e2d,_0x1c97b9){var _0x4e560d={};var _0xe9c006={};var _0x42aee1;var _0x2d5141;return db[_0xeaba('0x38')]['findOne']({'where':{'id':_0x405e64[_0xeaba('0x56')]['id']}})[_0xeaba('0x1f')](handleEntityNotFound(_0x4e5e2d,null))[_0xeaba('0x1f')](function(_0x476dc0){if(_0x476dc0){_0x42aee1=_0x476dc0;_0xe9c006['model']=_[_0xeaba('0x3d')](db[_0xeaba('0x57')][_0xeaba('0x39')]);_0xe9c006[_0xeaba('0x3c')]=_[_0xeaba('0x3d')](_0x405e64[_0xeaba('0x3c')]);_0xe9c006['filters']=_[_0xeaba('0x3e')](_0xe9c006[_0xeaba('0x40')],_0xe9c006[_0xeaba('0x3c')]);_0x4e560d['attributes']=_[_0xeaba('0x3e')](_0xe9c006['model'],qs['fields'](_0x405e64[_0xeaba('0x3c')][_0xeaba('0x41')]));_0x4e560d['attributes']=_0x4e560d[_0xeaba('0x3f')]['length']?_0x4e560d['attributes']:_0xe9c006[_0xeaba('0x40')];_0x4e560d['order']=qs[_0xeaba('0x45')](_0x405e64[_0xeaba('0x3c')][_0xeaba('0x45')]);_0x4e560d[_0xeaba('0x46')]=qs['filters'](_[_0xeaba('0x47')](_0x405e64[_0xeaba('0x3c')],_0xe9c006[_0xeaba('0x48')]));if(_0x405e64[_0xeaba('0x3c')]['filter']){_0x4e560d['where']=_[_0xeaba('0x4a')](_0x4e560d['where'],{'$or':_[_0xeaba('0x37')](_0x4e560d[_0xeaba('0x3f')],function(_0x19b785){var _0x1bc1bf={};_0x1bc1bf[_0x19b785]={'$like':'%'+_0x405e64[_0xeaba('0x3c')][_0xeaba('0x49')]+'%'};return _0x1bc1bf;})});}_0x4e560d=_[_0xeaba('0x4a')]({},_0x4e560d,_0x405e64[_0xeaba('0x4c')]);return _0x42aee1[_0xeaba('0x58')](_0x4e560d);}})[_0xeaba('0x1f')](function(_0x384c06){if(_0x384c06){_0x2d5141=_0x384c06[_0xeaba('0x42')];if(!_0x405e64[_0xeaba('0x3c')]['hasOwnProperty'](_0xeaba('0x44'))){_0x4e560d[_0xeaba('0x30')]=qs[_0xeaba('0x30')](_0x405e64[_0xeaba('0x3c')][_0xeaba('0x30')]);_0x4e560d[_0xeaba('0x2f')]=qs['offset'](_0x405e64[_0xeaba('0x3c')][_0xeaba('0x2f')]);}return _0x42aee1[_0xeaba('0x58')](_0x4e560d);}})[_0xeaba('0x1f')](function(_0x5f5d89){if(_0x5f5d89){return _0x5f5d89?{'count':_0x2d5141,'rows':_0x5f5d89}:null;}})[_0xeaba('0x1f')](respondWithResult(_0x4e5e2d,null))[_0xeaba('0x2a')](handleError(_0x4e5e2d,null));};exports[_0xeaba('0x59')]=function(_0x539c4b,_0x2213fd,_0x1535aa){var _0x325d34={};var _0x395420={};var _0x424a43;var _0x35324c;return db[_0xeaba('0x38')][_0xeaba('0x5a')]({'where':{'id':_0x539c4b[_0xeaba('0x56')]['id']}})['then'](handleEntityNotFound(_0x2213fd,null))[_0xeaba('0x1f')](function(_0x3ce72f){if(_0x3ce72f){_0x424a43=_0x3ce72f;_0x395420[_0xeaba('0x40')]=_[_0xeaba('0x3d')](db[_0xeaba('0x57')][_0xeaba('0x39')]);_0x395420['query']=_[_0xeaba('0x3d')](_0x539c4b[_0xeaba('0x3c')]);_0x395420[_0xeaba('0x48')]=_['intersection'](_0x395420[_0xeaba('0x40')],_0x395420[_0xeaba('0x3c')]);_0x325d34[_0xeaba('0x3f')]=_[_0xeaba('0x3e')](_0x395420[_0xeaba('0x40')],qs[_0xeaba('0x41')](_0x539c4b[_0xeaba('0x3c')][_0xeaba('0x41')]));_0x325d34['attributes']=_0x325d34['attributes'][_0xeaba('0x42')]?_0x325d34['attributes']:_0x395420[_0xeaba('0x40')];_0x325d34['order']=qs['sort'](_0x539c4b['query'][_0xeaba('0x45')]);_0x325d34['where']=qs['filters'](_[_0xeaba('0x47')](_0x539c4b[_0xeaba('0x3c')],_0x395420[_0xeaba('0x48')]));if(_0x539c4b[_0xeaba('0x3c')][_0xeaba('0x49')]){_0x325d34[_0xeaba('0x46')]=_[_0xeaba('0x4a')](_0x325d34[_0xeaba('0x46')],{'$or':_[_0xeaba('0x37')](_0x325d34[_0xeaba('0x3f')],function(_0x3674be){var _0x1eddeb={};_0x1eddeb[_0x3674be]={'$like':'%'+_0x539c4b['query'][_0xeaba('0x49')]+'%'};return _0x1eddeb;})});}_0x325d34=_['merge']({},_0x325d34,_0x539c4b[_0xeaba('0x4c')]);return _0x424a43[_0xeaba('0x59')](_0x325d34);}})[_0xeaba('0x1f')](function(_0x29e408){if(_0x29e408){_0x35324c=_0x29e408[_0xeaba('0x42')];if(!_0x539c4b[_0xeaba('0x3c')][_0xeaba('0x43')](_0xeaba('0x44'))){_0x325d34[_0xeaba('0x30')]=qs[_0xeaba('0x30')](_0x539c4b['query'][_0xeaba('0x30')]);_0x325d34[_0xeaba('0x2f')]=qs['offset'](_0x539c4b[_0xeaba('0x3c')][_0xeaba('0x2f')]);}return _0x424a43[_0xeaba('0x59')](_0x325d34);}})['then'](function(_0x54a918){if(_0x54a918){return _0x54a918?{'count':_0x35324c,'rows':_0x54a918}:null;}})[_0xeaba('0x1f')](respondWithResult(_0x2213fd,null))[_0xeaba('0x2a')](handleError(_0x2213fd,null));};exports[_0xeaba('0x5b')]=function(_0x552035,_0x453dc6,_0x295479){var _0x5c1f93={};var _0x54d620={};var _0x393259;var _0x49b101;return db[_0xeaba('0x38')]['findOne']({'where':{'id':_0x552035['params']['id']}})[_0xeaba('0x1f')](handleEntityNotFound(_0x453dc6,null))['then'](function(_0x373d0e){if(_0x373d0e){_0x393259=_0x373d0e;_0x54d620['model']=_[_0xeaba('0x3d')](db[_0xeaba('0x57')][_0xeaba('0x39')]);_0x54d620[_0xeaba('0x3c')]=_['keys'](_0x552035[_0xeaba('0x3c')]);_0x54d620[_0xeaba('0x48')]=_[_0xeaba('0x3e')](_0x54d620['model'],_0x54d620[_0xeaba('0x3c')]);_0x5c1f93[_0xeaba('0x3f')]=_[_0xeaba('0x3e')](_0x54d620['model'],qs[_0xeaba('0x41')](_0x552035[_0xeaba('0x3c')]['fields']));_0x5c1f93[_0xeaba('0x3f')]=_0x5c1f93['attributes'][_0xeaba('0x42')]?_0x5c1f93[_0xeaba('0x3f')]:_0x54d620['model'];_0x5c1f93[_0xeaba('0x5c')]=qs[_0xeaba('0x45')](_0x552035['query'][_0xeaba('0x45')]);_0x5c1f93[_0xeaba('0x46')]=qs[_0xeaba('0x48')](_[_0xeaba('0x47')](_0x552035[_0xeaba('0x3c')],_0x54d620[_0xeaba('0x48')]));if(_0x552035[_0xeaba('0x3c')]['filter']){_0x5c1f93['where']=_[_0xeaba('0x4a')](_0x5c1f93['where'],{'$or':_['map'](_0x5c1f93[_0xeaba('0x3f')],function(_0xecdb96){var _0x15a691={};_0x15a691[_0xecdb96]={'$like':'%'+_0x552035[_0xeaba('0x3c')][_0xeaba('0x49')]+'%'};return _0x15a691;})});}_0x5c1f93=_[_0xeaba('0x4a')]({},_0x5c1f93,_0x552035[_0xeaba('0x4c')]);return _0x393259['getDescriptions'](_0x5c1f93);}})[_0xeaba('0x1f')](function(_0x2b5162){if(_0x2b5162){_0x49b101=_0x2b5162['length'];if(!_0x552035[_0xeaba('0x3c')][_0xeaba('0x43')](_0xeaba('0x44'))){_0x5c1f93['limit']=qs[_0xeaba('0x30')](_0x552035[_0xeaba('0x3c')][_0xeaba('0x30')]);_0x5c1f93['offset']=qs[_0xeaba('0x2f')](_0x552035[_0xeaba('0x3c')]['offset']);}return _0x393259[_0xeaba('0x5b')](_0x5c1f93);}})[_0xeaba('0x1f')](function(_0x5575e9){if(_0x5575e9){return _0x5575e9?{'count':_0x49b101,'rows':_0x5575e9}:null;}})[_0xeaba('0x1f')](respondWithResult(_0x453dc6,null))[_0xeaba('0x2a')](handleError(_0x453dc6,null));};exports[_0xeaba('0x5d')]=function(_0x4928cb,_0x368f11,_0x22fb4a){var _0xee45f6={};var _0x21f59f={};var _0x31804c;var _0x114503;return db[_0xeaba('0x38')][_0xeaba('0x5a')]({'where':{'id':_0x4928cb['params']['id']}})[_0xeaba('0x1f')](handleEntityNotFound(_0x368f11,null))['then'](function(_0x5d95e0){if(_0x5d95e0){_0x31804c=_0x5d95e0;_0x21f59f[_0xeaba('0x40')]=_[_0xeaba('0x3d')](db[_0xeaba('0x5e')][_0xeaba('0x39')]);_0x21f59f['query']=_[_0xeaba('0x3d')](_0x4928cb[_0xeaba('0x3c')]);_0x21f59f['filters']=_['intersection'](_0x21f59f[_0xeaba('0x40')],_0x21f59f[_0xeaba('0x3c')]);_0xee45f6['attributes']=_[_0xeaba('0x3e')](_0x21f59f[_0xeaba('0x40')],qs[_0xeaba('0x41')](_0x4928cb['query'][_0xeaba('0x41')]));_0xee45f6['attributes']=_0xee45f6[_0xeaba('0x3f')][_0xeaba('0x42')]?_0xee45f6[_0xeaba('0x3f')]:_0x21f59f[_0xeaba('0x40')];_0xee45f6[_0xeaba('0x5c')]=qs[_0xeaba('0x45')](_0x4928cb[_0xeaba('0x3c')][_0xeaba('0x45')]);_0xee45f6[_0xeaba('0x46')]=qs[_0xeaba('0x48')](_[_0xeaba('0x47')](_0x4928cb['query'],_0x21f59f[_0xeaba('0x48')]));if(_0x4928cb[_0xeaba('0x3c')]['filter']){_0xee45f6[_0xeaba('0x46')]=_[_0xeaba('0x4a')](_0xee45f6[_0xeaba('0x46')],{'$or':_[_0xeaba('0x37')](_0xee45f6[_0xeaba('0x3f')],function(_0x3ed2a3){var _0x39edc8={};_0x39edc8[_0x3ed2a3]={'$like':'%'+_0x4928cb[_0xeaba('0x3c')][_0xeaba('0x49')]+'%'};return _0x39edc8;})});}_0xee45f6=_[_0xeaba('0x4a')]({},_0xee45f6,_0x4928cb[_0xeaba('0x4c')]);return _0x31804c['getTags'](_0xee45f6);}})[_0xeaba('0x1f')](function(_0x3d2878){if(_0x3d2878){_0x114503=_0x3d2878['length'];if(!_0x4928cb[_0xeaba('0x3c')][_0xeaba('0x43')](_0xeaba('0x44'))){_0xee45f6[_0xeaba('0x30')]=qs[_0xeaba('0x30')](_0x4928cb[_0xeaba('0x3c')][_0xeaba('0x30')]);_0xee45f6['offset']=qs['offset'](_0x4928cb[_0xeaba('0x3c')][_0xeaba('0x2f')]);}return _0x31804c[_0xeaba('0x5d')](_0xee45f6);}})[_0xeaba('0x1f')](function(_0x3b0326){if(_0x3b0326){return _0x3b0326?{'count':_0x114503,'rows':_0x3b0326}:null;}})[_0xeaba('0x1f')](respondWithResult(_0x368f11,null))['catch'](handleError(_0x368f11,null));};exports[_0xeaba('0x5f')]=function(_0x1a5a85,_0xf2614e,_0x562b4f){if(_0x1a5a85[_0xeaba('0x54')]['id']){delete _0x1a5a85[_0xeaba('0x54')]['id'];}return db[_0xeaba('0x38')]['findOne']({'where':{'id':_0x1a5a85[_0xeaba('0x56')]['id']}})[_0xeaba('0x1f')](handleEntityNotFound(_0xf2614e,null))[_0xeaba('0x1f')](function(_0x153357){if(_0x153357){return _0x153357[_0xeaba('0x5f')](_0x1a5a85[_0xeaba('0x54')][_0xeaba('0x60')]||[]);}return null;})[_0xeaba('0x1f')](respondWithResult(_0xf2614e,null))['catch'](handleError(_0xf2614e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index fede8e3..c8d39a4 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 _0xa110=['request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','int_desk_configurations','api','moment','bluebird'];(function(_0x38d403,_0x4a23aa){var _0x21264c=function(_0x4b41b1){while(--_0x4b41b1){_0x38d403['push'](_0x38d403['shift']());}};_0x21264c(++_0x4a23aa);}(_0xa110,0x1da));var _0x0a11=function(_0x1b0a2d,_0x3d9a2d){_0x1b0a2d=_0x1b0a2d-0x0;var _0x351af1=_0xa110[_0x1b0a2d];return _0x351af1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0a11('0x0'));var moment=require(_0x0a11('0x1'));var BPromise=require(_0x0a11('0x2'));var rp=require(_0x0a11('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a11('0x4'));var config=require(_0x0a11('0x5'));var attributes=require(_0x0a11('0x6'));module['exports']=function(_0x4670d1,_0x4ab488){return _0x4670d1[_0x0a11('0x7')]('DeskConfiguration',attributes,{'tableName':_0x0a11('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66c5=['int_desk_configurations','lodash','moment','bluebird','path','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0x37d870,_0x43470b){var _0x4b2c5f=function(_0x2018bd){while(--_0x2018bd){_0x37d870['push'](_0x37d870['shift']());}};_0x4b2c5f(++_0x43470b);}(_0x66c5,0x8d));var _0x566c=function(_0x4ee806,_0x33c72d){_0x4ee806=_0x4ee806-0x0;var _0x3ddc84=_0x66c5[_0x4ee806];return _0x3ddc84;};'use strict';var _=require(_0x566c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x566c('0x1'));var BPromise=require(_0x566c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x566c('0x3'));var rimraf=require(_0x566c('0x4'));var config=require('../../config/environment');var attributes=require(_0x566c('0x5'));module[_0x566c('0x6')]=function(_0x153f1b,_0x3cd188){return _0x153f1b[_0x566c('0x7')](_0x566c('0x8'),attributes,{'tableName':_0x566c('0x9'),'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 37ef7a1..de59379 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 _0xed8a=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','DeskConfiguration,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent'];(function(_0x2c65ab,_0x46f459){var _0x1902f9=function(_0x350e53){while(--_0x350e53){_0x2c65ab['push'](_0x2c65ab['shift']());}};_0x1902f9(++_0x46f459);}(_0xed8a,0xc5));var _0xaed8=function(_0x3ded0b,_0x32a047){_0x3ded0b=_0x3ded0b-0x0;var _0xaeba5=_0xed8a[_0x3ded0b];return _0xaeba5;};'use strict';var _=require(_0xaed8('0x0'));var util=require(_0xaed8('0x1'));var moment=require(_0xaed8('0x2'));var BPromise=require(_0xaed8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaed8('0x4'));var db=require(_0xaed8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaed8('0x6'))(_0xaed8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaed8('0x8')][_0xaed8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3db036,_0x2f6ab8,_0x291304){return new BPromise(function(_0x42bc11,_0x24ba07){return client['request'](_0x3db036,_0x291304)[_0xaed8('0xa')](function(_0x9c677){logger[_0xaed8('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x2f6ab8,_0xaed8('0xc'));logger[_0xaed8('0xd')](_0xaed8('0xe'),_0x2f6ab8,_0xaed8('0xc'),JSON[_0xaed8('0xf')](_0x9c677));if(_0x9c677['error']){if(_0x9c677['error'][_0xaed8('0x10')]===0x1f4){logger['error'](_0xaed8('0x11'),_0x2f6ab8,_0x9c677[_0xaed8('0x12')][_0xaed8('0x13')]);return _0x24ba07(_0x9c677[_0xaed8('0x12')]['message']);}logger[_0xaed8('0x12')](_0xaed8('0x11'),_0x2f6ab8,_0x9c677[_0xaed8('0x12')][_0xaed8('0x13')]);return _0x42bc11(_0x9c677[_0xaed8('0x12')][_0xaed8('0x13')]);}else{logger['info'](_0xaed8('0x11'),_0x2f6ab8,'request\x20sent');_0x42bc11(_0x9c677[_0xaed8('0x14')][_0xaed8('0x13')]);}})['catch'](function(_0x1827a9){logger[_0xaed8('0x12')](_0xaed8('0x11'),_0x2f6ab8,_0x1827a9);_0x24ba07(_0x1827a9);});});} \ No newline at end of file +var _0x05b0=['client','http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05b0,0x188));var _0x005b=function(_0x2fe756,_0x3d60c4){_0x2fe756=_0x2fe756-0x0;var _0x4235f9=_0x05b0[_0x2fe756];return _0x4235f9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x005b('0x0'));var BPromise=require(_0x005b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x005b('0x2'));var db=require(_0x005b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x005b('0x4'))(_0x005b('0x5'));var config=require('../../config/environment');var jayson=require(_0x005b('0x6'));var client=jayson[_0x005b('0x7')][_0x005b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x98e71c,_0x224c8d,_0x35998d){return new BPromise(function(_0x263bc9,_0x5cff7f){return client[_0x005b('0x9')](_0x98e71c,_0x35998d)[_0x005b('0xa')](function(_0x4c5552){logger['info'](_0x005b('0xb'),_0x224c8d,'request\x20sent');logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x224c8d,_0x005b('0xc'),JSON[_0x005b('0xd')](_0x4c5552));if(_0x4c5552['error']){if(_0x4c5552[_0x005b('0xe')][_0x005b('0xf')]===0x1f4){logger[_0x005b('0xe')](_0x005b('0xb'),_0x224c8d,_0x4c5552[_0x005b('0xe')][_0x005b('0x10')]);return _0x5cff7f(_0x4c5552[_0x005b('0xe')]['message']);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x224c8d,_0x4c5552[_0x005b('0xe')]['message']);return _0x263bc9(_0x4c5552[_0x005b('0xe')]['message']);}else{logger[_0x005b('0x11')](_0x005b('0xb'),_0x224c8d,_0x005b('0xc'));_0x263bc9(_0x4c5552[_0x005b('0x12')][_0x005b('0x10')]);}})['catch'](function(_0xa3c3fb){logger[_0x005b('0xe')](_0x005b('0xb'),_0x224c8d,_0xa3c3fb);_0x5cff7f(_0xa3c3fb);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 487275b..b5c3cbf 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 _0x3775=['../../config/environment','./intDeskField.controller','isAuthenticated','get','/:id','show','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0x3775,0xa5));var _0x5377=function(_0x1fd9c6,_0x4ea9b5){_0x1fd9c6=_0x1fd9c6-0x0;var _0x290e5b=_0x3775[_0x1fd9c6];return _0x290e5b;};'use strict';var multer=require(_0x5377('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5377('0x1'));var express=require(_0x5377('0x2'));var router=express[_0x5377('0x3')]();var auth=require(_0x5377('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5377('0x5'));var controller=require(_0x5377('0x6'));router['get']('/',auth[_0x5377('0x7')](),controller['index']);router[_0x5377('0x8')](_0x5377('0x9'),auth[_0x5377('0x7')](),controller[_0x5377('0xa')]);router[_0x5377('0xb')]('/',auth[_0x5377('0x7')](),controller[_0x5377('0xc')]);router['put']('/:id',auth[_0x5377('0x7')](),controller[_0x5377('0xd')]);router[_0x5377('0xe')](_0x5377('0x9'),auth[_0x5377('0x7')](),controller[_0x5377('0xf')]);module[_0x5377('0x10')]=router; \ No newline at end of file +var _0x0400=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x39ddd4,_0x38ce35){var _0x3d642a=function(_0xa05ced){while(--_0xa05ced){_0x39ddd4['push'](_0x39ddd4['shift']());}};_0x3d642a(++_0x38ce35);}(_0x0400,0xa4));var _0x0040=function(_0x2a7604,_0x184db3){_0x2a7604=_0x2a7604-0x0;var _0x41a171=_0x0400[_0x2a7604];return _0x41a171;};'use strict';var multer=require(_0x0040('0x0'));var util=require(_0x0040('0x1'));var path=require(_0x0040('0x2'));var timeout=require(_0x0040('0x3'));var express=require(_0x0040('0x4'));var router=express[_0x0040('0x5')]();var auth=require(_0x0040('0x6'));var interaction=require(_0x0040('0x7'));var config=require(_0x0040('0x8'));var controller=require(_0x0040('0x9'));router[_0x0040('0xa')]('/',auth[_0x0040('0xb')](),controller[_0x0040('0xc')]);router['get'](_0x0040('0xd'),auth[_0x0040('0xb')](),controller[_0x0040('0xe')]);router[_0x0040('0xf')]('/',auth[_0x0040('0xb')](),controller[_0x0040('0x10')]);router[_0x0040('0x11')](_0x0040('0xd'),auth[_0x0040('0xb')](),controller[_0x0040('0x12')]);router['delete'](_0x0040('0xd'),auth[_0x0040('0xb')](),controller[_0x0040('0x13')]);module[_0x0040('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index f5830f3..2b45c48 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 _0xf73c=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf73c,0x1bc));var _0xcf73=function(_0x37e037,_0x493e2b){_0x37e037=_0x37e037-0x0;var _0xbbfb95=_0xf73c[_0x37e037];return _0xbbfb95;};'use strict';var Sequelize=require(_0xcf73('0x0'));module[_0xcf73('0x1')]={'type':{'type':Sequelize[_0xcf73('0x2')](_0xcf73('0x3'),'variable',_0xcf73('0x4'),_0xcf73('0x5')),'defaultValue':_0xcf73('0x3')},'content':{'type':Sequelize[_0xcf73('0x6')]},'key':{'type':Sequelize[_0xcf73('0x6')]},'keyType':{'type':Sequelize[_0xcf73('0x2')](_0xcf73('0x3'),_0xcf73('0x7'),_0xcf73('0x4'))},'keyContent':{'type':Sequelize[_0xcf73('0x6')]},'idField':{'type':Sequelize[_0xcf73('0x6')]},'nameField':{'type':Sequelize[_0xcf73('0x6')]},'customField':{'type':Sequelize[_0xcf73('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcf73('0x6')]}}; \ No newline at end of file +var _0x10ea=['variable','customVariable','sequelize','exports','ENUM','string','STRING'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x10ea,0x13d));var _0xa10e=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0x10ea[_0x72895a];return _0x5226d5;};'use strict';var Sequelize=require(_0xa10e('0x0'));module[_0xa10e('0x1')]={'type':{'type':Sequelize[_0xa10e('0x2')](_0xa10e('0x3'),'variable','customVariable','keyValue'),'defaultValue':_0xa10e('0x3')},'content':{'type':Sequelize[_0xa10e('0x4')]},'key':{'type':Sequelize[_0xa10e('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xa10e('0x3'),_0xa10e('0x5'),_0xa10e('0x6'))},'keyContent':{'type':Sequelize[_0xa10e('0x4')]},'idField':{'type':Sequelize[_0xa10e('0x4')]},'nameField':{'type':Sequelize[_0xa10e('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa10e('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 877667e..efb6dd3 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 _0x20b5=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','set','Content-Range','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','DeskField','rows','options','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x12aa98,_0x39916d){var _0x42935f=function(_0x37d922){while(--_0x37d922){_0x12aa98['push'](_0x12aa98['shift']());}};_0x42935f(++_0x39916d);}(_0x20b5,0x1aa));var _0x520b=function(_0x50829b,_0x57e56a){_0x50829b=_0x50829b-0x0;var _0x2ef4db=_0x20b5[_0x50829b];return _0x2ef4db;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x520b('0x0'));var rimraf=require(_0x520b('0x1'));var zipdir=require(_0x520b('0x2'));var jsonpatch=require(_0x520b('0x3'));var rp=require('request-promise');var moment=require(_0x520b('0x4'));var BPromise=require(_0x520b('0x5'));var Mustache=require(_0x520b('0x6'));var util=require(_0x520b('0x7'));var path=require(_0x520b('0x8'));var sox=require(_0x520b('0x9'));var csv=require(_0x520b('0xa'));var ejs=require(_0x520b('0xb'));var fs=require('fs');var _=require(_0x520b('0xc'));var squel=require(_0x520b('0xd'));var crypto=require(_0x520b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x520b('0xf'));var toCsv=require(_0x520b('0xa'));var querystring=require(_0x520b('0x10'));var Papa=require(_0x520b('0x11'));var Redis=require('ioredis');var authService=require(_0x520b('0x12'));var qs=require(_0x520b('0x13'));var as=require(_0x520b('0x14'));var hardwareService=require(_0x520b('0x15'));var logger=require(_0x520b('0x16'))(_0x520b('0x17'));var utils=require(_0x520b('0x18'));var config=require(_0x520b('0x19'));var licenseUtil=require(_0x520b('0x1a'));var db=require(_0x520b('0x1b'))['db'];function respondWithStatusCode(_0x3d7236,_0x56c78b){_0x56c78b=_0x56c78b||0xcc;return function(_0x41119c){if(_0x41119c){return _0x3d7236['sendStatus'](_0x56c78b);}return _0x3d7236[_0x520b('0x1c')](_0x56c78b)[_0x520b('0x1d')]();};}function respondWithResult(_0x4b9671,_0x79fdb){_0x79fdb=_0x79fdb||0xc8;return function(_0x228431){if(_0x228431){return _0x4b9671[_0x520b('0x1c')](_0x79fdb)['json'](_0x228431);}};}function respondWithFilteredResult(_0x436130,_0x370eeb){return function(_0x33edbf){if(_0x33edbf){var _0x162213=_0x33edbf[_0x520b('0x1e')],_0x1288db=_0x370eeb[_0x520b('0x1f')],_0x19db0f=_0x370eeb[_0x520b('0x1f')]+_0x370eeb['limit'],_0x52a233;if(_0x19db0f>=_0x162213){_0x19db0f=_0x162213;_0x52a233=0xc8;}else{_0x52a233=0xce;}_0x436130[_0x520b('0x1c')](_0x52a233);return _0x436130[_0x520b('0x20')](_0x520b('0x21'),_0x1288db+'-'+_0x19db0f+'/'+_0x162213)['json'](_0x33edbf);}return null;};}function patchUpdates(_0x3d3e79){return function(_0x2a8d52){try{jsonpatch['apply'](_0x2a8d52,_0x3d3e79,!![]);}catch(_0x132624){return BPromise[_0x520b('0x22')](_0x132624);}return _0x2a8d52[_0x520b('0x23')]();};}function saveUpdates(_0x1bcb21,_0x2c5275){return function(_0x177be0){if(_0x177be0){return _0x177be0['update'](_0x1bcb21)['then'](function(_0x3febcd){return _0x3febcd;});}return null;};}function removeEntity(_0x1aea3f,_0x347e7d){return function(_0x39352f){if(_0x39352f){return _0x39352f[_0x520b('0x24')]()[_0x520b('0x25')](function(){_0x1aea3f[_0x520b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x446e10,_0x525e1b){return function(_0x3e61bb){if(!_0x3e61bb){_0x446e10[_0x520b('0x26')](0x194);}return _0x3e61bb;};}function handleError(_0x1eac3c,_0x5bf7ac){_0x5bf7ac=_0x5bf7ac||0x1f4;return function(_0x42d577){logger[_0x520b('0x27')](_0x42d577[_0x520b('0x28')]);if(_0x42d577[_0x520b('0x29')]){delete _0x42d577['name'];}_0x1eac3c[_0x520b('0x1c')](_0x5bf7ac)[_0x520b('0x2a')](_0x42d577);};}exports[_0x520b('0x2b')]=function(_0x21ef3d,_0x52ec57){var _0x4523a1={},_0x20fa50={},_0x240ffb={'count':0x0,'rows':[]};var _0x1e2a30=_[_0x520b('0x2c')](db['DeskField'][_0x520b('0x2d')],function(_0x2d5b74){return{'name':_0x2d5b74[_0x520b('0x2e')],'type':_0x2d5b74[_0x520b('0x2f')][_0x520b('0x30')]};});_0x20fa50['model']=_['map'](_0x1e2a30,'name');_0x20fa50[_0x520b('0x31')]=_[_0x520b('0x32')](_0x21ef3d[_0x520b('0x31')]);_0x20fa50[_0x520b('0x33')]=_[_0x520b('0x34')](_0x20fa50[_0x520b('0x35')],_0x20fa50[_0x520b('0x31')]);_0x4523a1['attributes']=_[_0x520b('0x34')](_0x20fa50[_0x520b('0x35')],qs[_0x520b('0x36')](_0x21ef3d[_0x520b('0x31')][_0x520b('0x36')]));_0x4523a1[_0x520b('0x37')]=_0x4523a1[_0x520b('0x37')][_0x520b('0x38')]?_0x4523a1[_0x520b('0x37')]:_0x20fa50[_0x520b('0x35')];if(!_0x21ef3d[_0x520b('0x31')][_0x520b('0x39')](_0x520b('0x3a'))){_0x4523a1['limit']=qs['limit'](_0x21ef3d['query']['limit']);_0x4523a1[_0x520b('0x1f')]=qs[_0x520b('0x1f')](_0x21ef3d['query'][_0x520b('0x1f')]);}_0x4523a1['order']=qs[_0x520b('0x3b')](_0x21ef3d[_0x520b('0x31')][_0x520b('0x3b')]);_0x4523a1[_0x520b('0x3c')]=qs['filters'](_['pick'](_0x21ef3d['query'],_0x20fa50[_0x520b('0x33')]),_0x1e2a30);if(_0x21ef3d[_0x520b('0x31')]['filter']){_0x4523a1[_0x520b('0x3c')]=_[_0x520b('0x3d')](_0x4523a1[_0x520b('0x3c')],{'$or':_[_0x520b('0x2c')](_0x1e2a30,function(_0x573edf){if(_0x573edf[_0x520b('0x2f')]!==_0x520b('0x3e')){var _0x2fed1c={};_0x2fed1c[_0x573edf[_0x520b('0x29')]]={'$like':'%'+_0x21ef3d[_0x520b('0x31')][_0x520b('0x3f')]+'%'};return _0x2fed1c;}})});}_0x4523a1=_['merge']({},_0x4523a1,_0x21ef3d['options']);var _0x303215={'where':_0x4523a1[_0x520b('0x3c')]};return db['DeskField']['count'](_0x303215)[_0x520b('0x25')](function(_0x52ee79){_0x240ffb[_0x520b('0x1e')]=_0x52ee79;if(_0x21ef3d[_0x520b('0x31')][_0x520b('0x40')]){_0x4523a1[_0x520b('0x41')]=[{'all':!![]}];}return db[_0x520b('0x42')]['findAll'](_0x4523a1);})['then'](function(_0x101695){_0x240ffb[_0x520b('0x43')]=_0x101695;return _0x240ffb;})[_0x520b('0x25')](respondWithFilteredResult(_0x52ec57,_0x4523a1))['catch'](handleError(_0x52ec57,null));};exports['show']=function(_0x533a37,_0x3488e1){var _0x31e325={'raw':!![],'where':{'id':_0x533a37['params']['id']}},_0x413967={};_0x413967[_0x520b('0x35')]=_['keys'](db[_0x520b('0x42')][_0x520b('0x2d')]);_0x413967[_0x520b('0x31')]=_[_0x520b('0x32')](_0x533a37[_0x520b('0x31')]);_0x413967[_0x520b('0x33')]=_['intersection'](_0x413967[_0x520b('0x35')],_0x413967[_0x520b('0x31')]);_0x31e325[_0x520b('0x37')]=_['intersection'](_0x413967[_0x520b('0x35')],qs[_0x520b('0x36')](_0x533a37[_0x520b('0x31')][_0x520b('0x36')]));_0x31e325['attributes']=_0x31e325[_0x520b('0x37')][_0x520b('0x38')]?_0x31e325['attributes']:_0x413967[_0x520b('0x35')];if(_0x533a37[_0x520b('0x31')][_0x520b('0x40')]){_0x31e325[_0x520b('0x41')]=[{'all':!![]}];}_0x31e325=_[_0x520b('0x3d')]({},_0x31e325,_0x533a37[_0x520b('0x44')]);return db[_0x520b('0x42')][_0x520b('0x45')](_0x31e325)[_0x520b('0x25')](handleEntityNotFound(_0x3488e1,null))[_0x520b('0x25')](respondWithResult(_0x3488e1,null))[_0x520b('0x46')](handleError(_0x3488e1,null));};exports['create']=function(_0x2efabf,_0x256acf){return db['DeskField'][_0x520b('0x47')](_0x2efabf[_0x520b('0x48')],{})[_0x520b('0x25')](respondWithResult(_0x256acf,0xc9))['catch'](handleError(_0x256acf,null));};exports[_0x520b('0x49')]=function(_0x4dd846,_0x3d7fd3){if(_0x4dd846['body']['id']){delete _0x4dd846[_0x520b('0x48')]['id'];}return db['DeskField']['find']({'where':{'id':_0x4dd846[_0x520b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3d7fd3,null))[_0x520b('0x25')](saveUpdates(_0x4dd846[_0x520b('0x48')],null))[_0x520b('0x25')](respondWithResult(_0x3d7fd3,null))['catch'](handleError(_0x3d7fd3,null));};exports[_0x520b('0x24')]=function(_0x5b72f7,_0x55c1b9){return db['DeskField'][_0x520b('0x45')]({'where':{'id':_0x5b72f7[_0x520b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x55c1b9,null))[_0x520b('0x25')](removeEntity(_0x55c1b9,null))[_0x520b('0x46')](handleError(_0x55c1b9,null));}; \ No newline at end of file +var _0xda28=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','then','destroy','end','error','stack','name','DeskField','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','find','catch','create','update','body','params','html-pdf'];(function(_0x24eeed,_0x51c3cc){var _0x33c864=function(_0x3330f0){while(--_0x3330f0){_0x24eeed['push'](_0x24eeed['shift']());}};_0x33c864(++_0x51c3cc);}(_0xda28,0x1a9));var _0x8da2=function(_0x39ab42,_0x57ae21){_0x39ab42=_0x39ab42-0x0;var _0x1e7c47=_0xda28[_0x39ab42];return _0x1e7c47;};'use strict';var pdf=require(_0x8da2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8da2('0x1'));var jsonpatch=require(_0x8da2('0x2'));var rp=require(_0x8da2('0x3'));var moment=require(_0x8da2('0x4'));var BPromise=require(_0x8da2('0x5'));var Mustache=require('mustache');var util=require(_0x8da2('0x6'));var path=require(_0x8da2('0x7'));var sox=require('sox');var csv=require(_0x8da2('0x8'));var ejs=require(_0x8da2('0x9'));var fs=require('fs');var _=require(_0x8da2('0xa'));var squel=require(_0x8da2('0xb'));var crypto=require(_0x8da2('0xc'));var jsforce=require(_0x8da2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8da2('0xe'));var Papa=require(_0x8da2('0xf'));var Redis=require(_0x8da2('0x10'));var authService=require(_0x8da2('0x11'));var qs=require(_0x8da2('0x12'));var as=require(_0x8da2('0x13'));var hardwareService=require(_0x8da2('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x8da2('0x15'));var config=require(_0x8da2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8da2('0x17'))['db'];function respondWithStatusCode(_0x26dc0a,_0xe20c50){_0xe20c50=_0xe20c50||0xcc;return function(_0x13d523){if(_0x13d523){return _0x26dc0a[_0x8da2('0x18')](_0xe20c50);}return _0x26dc0a['status'](_0xe20c50)['end']();};}function respondWithResult(_0xe1ea33,_0x58151c){_0x58151c=_0x58151c||0xc8;return function(_0xf75fdf){if(_0xf75fdf){return _0xe1ea33[_0x8da2('0x19')](_0x58151c)[_0x8da2('0x1a')](_0xf75fdf);}};}function respondWithFilteredResult(_0x3bc565,_0x65368c){return function(_0xcdbb97){if(_0xcdbb97){var _0x4377cb=_0xcdbb97[_0x8da2('0x1b')],_0x47a2da=_0x65368c[_0x8da2('0x1c')],_0x3065d6=_0x65368c['offset']+_0x65368c[_0x8da2('0x1d')],_0x238ad1;if(_0x3065d6>=_0x4377cb){_0x3065d6=_0x4377cb;_0x238ad1=0xc8;}else{_0x238ad1=0xce;}_0x3bc565[_0x8da2('0x19')](_0x238ad1);return _0x3bc565['set'](_0x8da2('0x1e'),_0x47a2da+'-'+_0x3065d6+'/'+_0x4377cb)['json'](_0xcdbb97);}return null;};}function patchUpdates(_0x5de61b){return function(_0x28c2e0){try{jsonpatch['apply'](_0x28c2e0,_0x5de61b,!![]);}catch(_0x2adc32){return BPromise[_0x8da2('0x1f')](_0x2adc32);}return _0x28c2e0[_0x8da2('0x20')]();};}function saveUpdates(_0x48b699,_0x54d8d9){return function(_0x18c78d){if(_0x18c78d){return _0x18c78d['update'](_0x48b699)[_0x8da2('0x21')](function(_0x4101a6){return _0x4101a6;});}return null;};}function removeEntity(_0x5e7bfd,_0x3a69b5){return function(_0x3af91f){if(_0x3af91f){return _0x3af91f[_0x8da2('0x22')]()[_0x8da2('0x21')](function(){_0x5e7bfd[_0x8da2('0x19')](0xcc)[_0x8da2('0x23')]();});}};}function handleEntityNotFound(_0x18007c,_0x1a421d){return function(_0xb34cd4){if(!_0xb34cd4){_0x18007c[_0x8da2('0x18')](0x194);}return _0xb34cd4;};}function handleError(_0x46d9c4,_0x47bcd8){_0x47bcd8=_0x47bcd8||0x1f4;return function(_0xc3f059){logger[_0x8da2('0x24')](_0xc3f059[_0x8da2('0x25')]);if(_0xc3f059[_0x8da2('0x26')]){delete _0xc3f059['name'];}_0x46d9c4[_0x8da2('0x19')](_0x47bcd8)['send'](_0xc3f059);};}exports['index']=function(_0x57f608,_0x13d8ed){var _0x1811e8={},_0x4d453c={},_0x9818f4={'count':0x0,'rows':[]};var _0x3407dd=_['map'](db[_0x8da2('0x27')][_0x8da2('0x28')],function(_0x3fe3b1){return{'name':_0x3fe3b1[_0x8da2('0x29')],'type':_0x3fe3b1['type'][_0x8da2('0x2a')]};});_0x4d453c[_0x8da2('0x2b')]=_[_0x8da2('0x2c')](_0x3407dd,'name');_0x4d453c['query']=_[_0x8da2('0x2d')](_0x57f608[_0x8da2('0x2e')]);_0x4d453c[_0x8da2('0x2f')]=_[_0x8da2('0x30')](_0x4d453c[_0x8da2('0x2b')],_0x4d453c['query']);_0x1811e8['attributes']=_['intersection'](_0x4d453c[_0x8da2('0x2b')],qs[_0x8da2('0x31')](_0x57f608['query'][_0x8da2('0x31')]));_0x1811e8[_0x8da2('0x32')]=_0x1811e8[_0x8da2('0x32')][_0x8da2('0x33')]?_0x1811e8[_0x8da2('0x32')]:_0x4d453c[_0x8da2('0x2b')];if(!_0x57f608[_0x8da2('0x2e')][_0x8da2('0x34')](_0x8da2('0x35'))){_0x1811e8[_0x8da2('0x1d')]=qs[_0x8da2('0x1d')](_0x57f608[_0x8da2('0x2e')]['limit']);_0x1811e8[_0x8da2('0x1c')]=qs[_0x8da2('0x1c')](_0x57f608[_0x8da2('0x2e')][_0x8da2('0x1c')]);}_0x1811e8[_0x8da2('0x36')]=qs[_0x8da2('0x37')](_0x57f608[_0x8da2('0x2e')]['sort']);_0x1811e8[_0x8da2('0x38')]=qs[_0x8da2('0x2f')](_[_0x8da2('0x39')](_0x57f608[_0x8da2('0x2e')],_0x4d453c[_0x8da2('0x2f')]),_0x3407dd);if(_0x57f608[_0x8da2('0x2e')][_0x8da2('0x3a')]){_0x1811e8[_0x8da2('0x38')]=_[_0x8da2('0x3b')](_0x1811e8[_0x8da2('0x38')],{'$or':_[_0x8da2('0x2c')](_0x3407dd,function(_0x570d1e){if(_0x570d1e['type']!==_0x8da2('0x3c')){var _0x924440={};_0x924440[_0x570d1e[_0x8da2('0x26')]]={'$like':'%'+_0x57f608[_0x8da2('0x2e')][_0x8da2('0x3a')]+'%'};return _0x924440;}})});}_0x1811e8=_['merge']({},_0x1811e8,_0x57f608[_0x8da2('0x3d')]);var _0x1a5375={'where':_0x1811e8[_0x8da2('0x38')]};return db[_0x8da2('0x27')][_0x8da2('0x1b')](_0x1a5375)['then'](function(_0x214786){_0x9818f4[_0x8da2('0x1b')]=_0x214786;if(_0x57f608[_0x8da2('0x2e')][_0x8da2('0x3e')]){_0x1811e8['include']=[{'all':!![]}];}return db[_0x8da2('0x27')]['findAll'](_0x1811e8);})[_0x8da2('0x21')](function(_0x1bd9aa){_0x9818f4[_0x8da2('0x3f')]=_0x1bd9aa;return _0x9818f4;})[_0x8da2('0x21')](respondWithFilteredResult(_0x13d8ed,_0x1811e8))['catch'](handleError(_0x13d8ed,null));};exports[_0x8da2('0x40')]=function(_0x55b7f2,_0x45fdca){var _0x2f746f={'raw':!![],'where':{'id':_0x55b7f2['params']['id']}},_0x131a73={};_0x131a73[_0x8da2('0x2b')]=_[_0x8da2('0x2d')](db[_0x8da2('0x27')]['rawAttributes']);_0x131a73[_0x8da2('0x2e')]=_[_0x8da2('0x2d')](_0x55b7f2['query']);_0x131a73[_0x8da2('0x2f')]=_[_0x8da2('0x30')](_0x131a73['model'],_0x131a73[_0x8da2('0x2e')]);_0x2f746f['attributes']=_[_0x8da2('0x30')](_0x131a73[_0x8da2('0x2b')],qs[_0x8da2('0x31')](_0x55b7f2['query']['fields']));_0x2f746f[_0x8da2('0x32')]=_0x2f746f[_0x8da2('0x32')]['length']?_0x2f746f[_0x8da2('0x32')]:_0x131a73[_0x8da2('0x2b')];if(_0x55b7f2['query']['includeAll']){_0x2f746f['include']=[{'all':!![]}];}_0x2f746f=_[_0x8da2('0x3b')]({},_0x2f746f,_0x55b7f2[_0x8da2('0x3d')]);return db['DeskField'][_0x8da2('0x41')](_0x2f746f)[_0x8da2('0x21')](handleEntityNotFound(_0x45fdca,null))[_0x8da2('0x21')](respondWithResult(_0x45fdca,null))[_0x8da2('0x42')](handleError(_0x45fdca,null));};exports['create']=function(_0x47c2db,_0x2d8f8c){return db[_0x8da2('0x27')][_0x8da2('0x43')](_0x47c2db['body'],{})[_0x8da2('0x21')](respondWithResult(_0x2d8f8c,0xc9))[_0x8da2('0x42')](handleError(_0x2d8f8c,null));};exports[_0x8da2('0x44')]=function(_0x47ca87,_0x583834){if(_0x47ca87[_0x8da2('0x45')]['id']){delete _0x47ca87[_0x8da2('0x45')]['id'];}return db[_0x8da2('0x27')][_0x8da2('0x41')]({'where':{'id':_0x47ca87['params']['id']}})[_0x8da2('0x21')](handleEntityNotFound(_0x583834,null))['then'](saveUpdates(_0x47ca87['body'],null))[_0x8da2('0x21')](respondWithResult(_0x583834,null))[_0x8da2('0x42')](handleError(_0x583834,null));};exports[_0x8da2('0x22')]=function(_0x528d2e,_0x2be3f1){return db['DeskField'][_0x8da2('0x41')]({'where':{'id':_0x528d2e[_0x8da2('0x46')]['id']}})[_0x8da2('0x21')](handleEntityNotFound(_0x2be3f1,null))['then'](removeEntity(_0x2be3f1,null))[_0x8da2('0x42')](handleError(_0x2be3f1,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 4f724cd..7c6ed30 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 _0x731d=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','FieldId','util'];(function(_0x4191bc,_0x3096c5){var _0x1ffd4e=function(_0x36faed){while(--_0x36faed){_0x4191bc['push'](_0x4191bc['shift']());}};_0x1ffd4e(++_0x3096c5);}(_0x731d,0x151));var _0xd731=function(_0x42ee16,_0x3b54b6){_0x42ee16=_0x42ee16-0x0;var _0x5c0fd3=_0x731d[_0x42ee16];return _0x5c0fd3;};'use strict';var _=require('lodash');var util=require(_0xd731('0x0'));var logger=require(_0xd731('0x1'))(_0xd731('0x2'));var moment=require(_0xd731('0x3'));var BPromise=require(_0xd731('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd731('0x5'));var config=require(_0xd731('0x6'));var attributes=require(_0xd731('0x7'));module[_0xd731('0x8')]=function(_0x271d02,_0x40ea6a){return _0x271d02[_0xd731('0x9')](_0xd731('0xa'),attributes,{'tableName':_0xd731('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xd731('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bff=['int_desk_fields','desk_unique_index','idField','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField'];(function(_0x23785c,_0x1c6e72){var _0x2dc080=function(_0x353f41){while(--_0x353f41){_0x23785c['push'](_0x23785c['shift']());}};_0x2dc080(++_0x1c6e72);}(_0x2bff,0x189));var _0xf2bf=function(_0x46b0ca,_0x3b0a57){_0x46b0ca=_0x46b0ca-0x0;var _0x51cb74=_0x2bff[_0x46b0ca];return _0x51cb74;};'use strict';var _=require(_0xf2bf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf2bf('0x1'));var moment=require(_0xf2bf('0x2'));var BPromise=require(_0xf2bf('0x3'));var rp=require(_0xf2bf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2bf('0x5'));var config=require(_0xf2bf('0x6'));var attributes=require(_0xf2bf('0x7'));module[_0xf2bf('0x8')]=function(_0x39ff59,_0x39e5a5){return _0x39ff59['define'](_0xf2bf('0x9'),attributes,{'tableName':_0xf2bf('0xa'),'paranoid':![],'indexes':[{'name':_0xf2bf('0xb'),'fields':[_0xf2bf('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 6bcf466..1971e99 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 _0xa1d4=['request','then','info','request\x20sent','debug','error','code','DeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3b5bca,_0x326805){var _0x39833=function(_0x16f56f){while(--_0x16f56f){_0x3b5bca['push'](_0x3b5bca['shift']());}};_0x39833(++_0x326805);}(_0xa1d4,0xba));var _0x4a1d=function(_0x4826d9,_0x100d50){_0x4826d9=_0x4826d9-0x0;var _0x485dde=_0xa1d4[_0x4826d9];return _0x485dde;};'use strict';var _=require(_0x4a1d('0x0'));var util=require(_0x4a1d('0x1'));var moment=require(_0x4a1d('0x2'));var BPromise=require(_0x4a1d('0x3'));var rs=require(_0x4a1d('0x4'));var fs=require('fs');var Redis=require(_0x4a1d('0x5'));var db=require(_0x4a1d('0x6'))['db'];var utils=require(_0x4a1d('0x7'));var logger=require(_0x4a1d('0x8'))(_0x4a1d('0x9'));var config=require('../../config/environment');var jayson=require(_0x4a1d('0xa'));var client=jayson[_0x4a1d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ddd0e,_0x1092ba,_0x5b3ab1){return new BPromise(function(_0x3e89c7,_0x53b905){return client[_0x4a1d('0xc')](_0x2ddd0e,_0x5b3ab1)[_0x4a1d('0xd')](function(_0x6410b4){logger[_0x4a1d('0xe')]('DeskField,\x20%s,\x20%s',_0x1092ba,_0x4a1d('0xf'));logger[_0x4a1d('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x1092ba,_0x4a1d('0xf'),JSON['stringify'](_0x6410b4));if(_0x6410b4[_0x4a1d('0x11')]){if(_0x6410b4['error'][_0x4a1d('0x12')]===0x1f4){logger[_0x4a1d('0x11')](_0x4a1d('0x13'),_0x1092ba,_0x6410b4[_0x4a1d('0x11')][_0x4a1d('0x14')]);return _0x53b905(_0x6410b4[_0x4a1d('0x11')][_0x4a1d('0x14')]);}logger[_0x4a1d('0x11')](_0x4a1d('0x13'),_0x1092ba,_0x6410b4['error']['message']);return _0x3e89c7(_0x6410b4[_0x4a1d('0x11')][_0x4a1d('0x14')]);}else{logger[_0x4a1d('0xe')](_0x4a1d('0x13'),_0x1092ba,'request\x20sent');_0x3e89c7(_0x6410b4[_0x4a1d('0x15')][_0x4a1d('0x14')]);}})['catch'](function(_0x331e9d){logger[_0x4a1d('0x11')](_0x4a1d('0x13'),_0x1092ba,_0x331e9d);_0x53b905(_0x331e9d);});});} \ No newline at end of file +var _0x2804=['message','request\x20sent','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','debug','stringify','error','DeskField,\x20%s,\x20%s'];(function(_0x377474,_0x675b1c){var _0x121af0=function(_0x1447c7){while(--_0x1447c7){_0x377474['push'](_0x377474['shift']());}};_0x121af0(++_0x675b1c);}(_0x2804,0x1a6));var _0x4280=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2804[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x4280('0x0'));var util=require('util');var moment=require(_0x4280('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4280('0x2'));var db=require(_0x4280('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4280('0x4'))(_0x4280('0x5'));var config=require(_0x4280('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4280('0x7')][_0x4280('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x352186,_0x3c0b24,_0x485137){return new BPromise(function(_0x40bff0,_0x50941a){return client[_0x4280('0x9')](_0x352186,_0x485137)['then'](function(_0x47f45a){logger[_0x4280('0xa')]('DeskField,\x20%s,\x20%s',_0x3c0b24,'request\x20sent');logger[_0x4280('0xb')]('DeskField,\x20%s,\x20%s,\x20%s',_0x3c0b24,'request\x20sent',JSON[_0x4280('0xc')](_0x47f45a));if(_0x47f45a[_0x4280('0xd')]){if(_0x47f45a[_0x4280('0xd')]['code']===0x1f4){logger[_0x4280('0xd')](_0x4280('0xe'),_0x3c0b24,_0x47f45a[_0x4280('0xd')][_0x4280('0xf')]);return _0x50941a(_0x47f45a[_0x4280('0xd')][_0x4280('0xf')]);}logger[_0x4280('0xd')](_0x4280('0xe'),_0x3c0b24,_0x47f45a[_0x4280('0xd')]['message']);return _0x40bff0(_0x47f45a[_0x4280('0xd')]['message']);}else{logger[_0x4280('0xa')](_0x4280('0xe'),_0x3c0b24,_0x4280('0x10'));_0x40bff0(_0x47f45a[_0x4280('0x11')][_0x4280('0xf')]);}})[_0x4280('0x12')](function(_0x189ee6){logger[_0x4280('0xd')](_0x4280('0xe'),_0x3c0b24,_0x189ee6);_0x50941a(_0x189ee6);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 743b9e6..1bc9311 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 _0xb10b=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x2201d5,_0x22c864){var _0x37e8d2=function(_0x11cad){while(--_0x11cad){_0x2201d5['push'](_0x2201d5['shift']());}};_0x37e8d2(++_0x22c864);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ea2b1,_0x50f848){_0x5ea2b1=_0x5ea2b1-0x0;var _0x1773c0=_0xb10b[_0x5ea2b1];return _0x1773c0;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getFields']);router['post']('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router[_0xbb10('0x10')]('/:id/configurations',auth[_0xbb10('0x9')](),controller['addConfiguration']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=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(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x8603,0x190));var _0x3860=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0x8603[_0x55a89e];return _0x3aa2bd;};'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 64c1251..139551f 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 _0xebb7=['exports','STRING','sequelize'];(function(_0x39e743,_0x37c791){var _0x30c6d8=function(_0x3392bf){while(--_0x3392bf){_0x39e743['push'](_0x39e743['shift']());}};_0x30c6d8(++_0x37c791);}(_0xebb7,0x1ee));var _0x7ebb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xebb7[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x7ebb('0x0'));module[_0x7ebb('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7ebb('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7ebb('0x2')]},'tenantId':{'type':Sequelize[_0x7ebb('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x7ebb('0x2')]},'serverUrl':{'type':Sequelize[_0x7ebb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7ebb('0x2')]}}; \ No newline at end of file +var _0x81a8=['STRING','sequelize'];(function(_0x4df2b1,_0x7eee31){var _0x18e6d5=function(_0x42cf87){while(--_0x42cf87){_0x4df2b1['push'](_0x4df2b1['shift']());}};_0x18e6d5(++_0x7eee31);}(_0x81a8,0x7b));var _0x881a=function(_0x29183b,_0x8296f3){_0x29183b=_0x29183b-0x0;var _0x3cdbbf=_0x81a8[_0x29183b];return _0x3cdbbf;};'use strict';var Sequelize=require(_0x881a('0x0'));module['exports']={'name':{'type':Sequelize[_0x881a('0x1')]},'username':{'type':Sequelize[_0x881a('0x1')]},'password':{'type':Sequelize[_0x881a('0x1')]},'remoteUri':{'type':Sequelize[_0x881a('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x881a('0x1')]},'clientSecret':{'type':Sequelize[_0x881a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x881a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 71f4baf..8a0ca50 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 _0x2a07=['description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','entitlementidname','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','concat','password','tenantId','remoteUri','slice','lastIndexOf','format','POST','/oauth2/token','clientId','username','clientSecret','access_token','GET','4.0','value','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','substring','BooleanAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','fields','options','create','body','findOne','Dynamics365Configuration','pick','nolimit','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Dynamics365Field','Descriptions','getFields','ticketType','Incident','title'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2a07,0x74));var _0x72a0=function(_0x4c403d,_0x5ef49f){_0x4c403d=_0x4c403d-0x0;var _0x5a0c35=_0x2a07[_0x4c403d];return _0x5a0c35;};'use strict';var pdf=require(_0x72a0('0x0'));var emlformat=require(_0x72a0('0x1'));var rimraf=require(_0x72a0('0x2'));var zipdir=require(_0x72a0('0x3'));var jsonpatch=require(_0x72a0('0x4'));var rp=require('request-promise');var moment=require(_0x72a0('0x5'));var BPromise=require(_0x72a0('0x6'));var Mustache=require(_0x72a0('0x7'));var util=require(_0x72a0('0x8'));var path=require(_0x72a0('0x9'));var sox=require(_0x72a0('0xa'));var csv=require(_0x72a0('0xb'));var ejs=require(_0x72a0('0xc'));var fs=require('fs');var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xb'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];var integrations=require(_0x72a0('0x1c'));var jayson=require(_0x72a0('0x1d'));var client=jayson[_0x72a0('0x1e')][_0x72a0('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x324cbd,_0xe73b5e,_0x5e0b5f,_0x4930c5){return new BPromise(function(_0xe103dc,_0x3cd89f){var _0x19eaf9=_0x4930c5||client;return _0x19eaf9[_0x72a0('0x20')](_0x324cbd,_0x5e0b5f)[_0x72a0('0x21')](function(_0x3f3d62){logger['info'](_0x72a0('0x22'),_0xe73b5e,_0x72a0('0x23'));logger[_0x72a0('0x24')](_0x72a0('0x25'),_0xe73b5e,_0x72a0('0x23'),JSON['stringify'](_0x3f3d62));if(_0x3f3d62[_0x72a0('0x26')]){if(_0x3f3d62[_0x72a0('0x26')][_0x72a0('0x27')]===0x1f4){logger['error'](_0x72a0('0x22'),_0xe73b5e,_0x3f3d62[_0x72a0('0x26')][_0x72a0('0x28')]);return _0x3cd89f(_0x3f3d62[_0x72a0('0x26')]['message']);}logger[_0x72a0('0x26')]('Dynamics365Account,\x20%s,\x20%s',_0xe73b5e,_0x3f3d62[_0x72a0('0x26')][_0x72a0('0x28')]);return _0xe103dc(_0x3f3d62[_0x72a0('0x26')]['message']);}else{logger[_0x72a0('0x29')](_0x72a0('0x22'),_0xe73b5e,_0x72a0('0x23'));_0xe103dc(_0x3f3d62[_0x72a0('0x2a')]['message']);}})[_0x72a0('0x2b')](function(_0x390464){logger[_0x72a0('0x26')](_0x72a0('0x22'),_0xe73b5e,_0x390464);_0x3cd89f(_0x390464);});});}function respondWithStatusCode(_0x3022b0,_0x174b1b){_0x174b1b=_0x174b1b||0xcc;return function(_0x5c4daf){if(_0x5c4daf){return _0x3022b0['sendStatus'](_0x174b1b);}return _0x3022b0[_0x72a0('0x2c')](_0x174b1b)[_0x72a0('0x2d')]();};}function respondWithResult(_0x123df4,_0x1504ed){_0x1504ed=_0x1504ed||0xc8;return function(_0xf5cb49){if(_0xf5cb49){return _0x123df4[_0x72a0('0x2c')](_0x1504ed)[_0x72a0('0x2e')](_0xf5cb49);}};}function respondWithFilteredResult(_0x15922a,_0xee99e2){return function(_0x12dcc9){if(_0x12dcc9){var _0x4f9718=_0x12dcc9[_0x72a0('0x2f')],_0x304b92=_0xee99e2[_0x72a0('0x30')],_0x553641=_0xee99e2[_0x72a0('0x30')]+_0xee99e2[_0x72a0('0x31')],_0xc22d18;if(_0x553641>=_0x4f9718){_0x553641=_0x4f9718;_0xc22d18=0xc8;}else{_0xc22d18=0xce;}_0x15922a[_0x72a0('0x2c')](_0xc22d18);return _0x15922a[_0x72a0('0x32')](_0x72a0('0x33'),_0x304b92+'-'+_0x553641+'/'+_0x4f9718)['json'](_0x12dcc9);}return null;};}function patchUpdates(_0x41efc1){return function(_0x17e955){try{jsonpatch[_0x72a0('0x34')](_0x17e955,_0x41efc1,!![]);}catch(_0xfbe9b3){return BPromise[_0x72a0('0x35')](_0xfbe9b3);}return _0x17e955[_0x72a0('0x36')]();};}function saveUpdates(_0x3a5e54,_0x592401){return function(_0x30878e){if(_0x30878e){return _0x30878e[_0x72a0('0x37')](_0x3a5e54)[_0x72a0('0x21')](function(_0x197591){return _0x197591;});}return null;};}function removeEntity(_0x89d598,_0x469c07){return function(_0x7c5d43){if(_0x7c5d43){return _0x7c5d43[_0x72a0('0x38')]()['then'](function(){_0x89d598[_0x72a0('0x2c')](0xcc)[_0x72a0('0x2d')]();});}};}function handleEntityNotFound(_0x2959af,_0x560ec3){return function(_0x2ae61c){if(!_0x2ae61c){_0x2959af['sendStatus'](0x194);}return _0x2ae61c;};}function handleError(_0x4b2b44,_0x277d8f){_0x277d8f=_0x277d8f||0x1f4;return function(_0x1d02c4){logger[_0x72a0('0x26')](_0x1d02c4[_0x72a0('0x39')]);if(_0x1d02c4[_0x72a0('0x3a')]){delete _0x1d02c4[_0x72a0('0x3a')];}_0x4b2b44[_0x72a0('0x2c')](_0x277d8f)[_0x72a0('0x3b')](_0x1d02c4);};}exports[_0x72a0('0x3c')]=function(_0x2ee3f8,_0x3ff191){var _0x5b6326={},_0x265d96={},_0x5eb8f1={'count':0x0,'rows':[]};var _0x1d0fa8=_[_0x72a0('0x3d')](db[_0x72a0('0x3e')][_0x72a0('0x3f')],function(_0xbb1f4){return{'name':_0xbb1f4[_0x72a0('0x40')],'type':_0xbb1f4[_0x72a0('0x41')][_0x72a0('0x42')]};});_0x265d96[_0x72a0('0x43')]=_['map'](_0x1d0fa8,'name');_0x265d96[_0x72a0('0x44')]=_[_0x72a0('0x45')](_0x2ee3f8[_0x72a0('0x44')]);_0x265d96[_0x72a0('0x46')]=_[_0x72a0('0x47')](_0x265d96['model'],_0x265d96[_0x72a0('0x44')]);_0x5b6326[_0x72a0('0x48')]=_['intersection'](_0x265d96[_0x72a0('0x43')],qs['fields'](_0x2ee3f8['query']['fields']));_0x5b6326[_0x72a0('0x48')]=_0x5b6326['attributes'][_0x72a0('0x49')]?_0x5b6326[_0x72a0('0x48')]:_0x265d96[_0x72a0('0x43')];if(!_0x2ee3f8[_0x72a0('0x44')]['hasOwnProperty']('nolimit')){_0x5b6326['limit']=qs['limit'](_0x2ee3f8[_0x72a0('0x44')][_0x72a0('0x31')]);_0x5b6326['offset']=qs[_0x72a0('0x30')](_0x2ee3f8[_0x72a0('0x44')]['offset']);}_0x5b6326[_0x72a0('0x4a')]=qs[_0x72a0('0x4b')](_0x2ee3f8[_0x72a0('0x44')][_0x72a0('0x4b')]);_0x5b6326[_0x72a0('0x4c')]=qs[_0x72a0('0x46')](_['pick'](_0x2ee3f8[_0x72a0('0x44')],_0x265d96['filters']),_0x1d0fa8);if(_0x2ee3f8[_0x72a0('0x44')]['filter']){_0x5b6326[_0x72a0('0x4c')]=_[_0x72a0('0x4d')](_0x5b6326['where'],{'$or':_[_0x72a0('0x3d')](_0x1d0fa8,function(_0x506d65){if(_0x506d65[_0x72a0('0x41')]!==_0x72a0('0x4e')){var _0x13254c={};_0x13254c[_0x506d65['name']]={'$like':'%'+_0x2ee3f8[_0x72a0('0x44')][_0x72a0('0x4f')]+'%'};return _0x13254c;}})});}_0x5b6326=_[_0x72a0('0x4d')]({},_0x5b6326,_0x2ee3f8['options']);var _0x5f1fcc={'where':_0x5b6326[_0x72a0('0x4c')]};return db['Dynamics365Account'][_0x72a0('0x2f')](_0x5f1fcc)[_0x72a0('0x21')](function(_0x1d2e44){_0x5eb8f1[_0x72a0('0x2f')]=_0x1d2e44;if(_0x2ee3f8[_0x72a0('0x44')][_0x72a0('0x50')]){_0x5b6326[_0x72a0('0x51')]=[{'all':!![]}];}return db[_0x72a0('0x3e')][_0x72a0('0x52')](_0x5b6326);})['then'](function(_0x4fae3d){_0x5eb8f1[_0x72a0('0x53')]=_0x4fae3d;return _0x5eb8f1;})[_0x72a0('0x21')](respondWithFilteredResult(_0x3ff191,_0x5b6326))[_0x72a0('0x2b')](handleError(_0x3ff191,null));};exports[_0x72a0('0x54')]=function(_0x304400,_0x2de809){var _0x4a72fd={'raw':![],'where':{'id':_0x304400[_0x72a0('0x55')]['id']}},_0x4f9091={};_0x4f9091[_0x72a0('0x43')]=_[_0x72a0('0x45')](db[_0x72a0('0x3e')][_0x72a0('0x3f')]);_0x4f9091[_0x72a0('0x44')]=_[_0x72a0('0x45')](_0x304400[_0x72a0('0x44')]);_0x4f9091[_0x72a0('0x46')]=_[_0x72a0('0x47')](_0x4f9091['model'],_0x4f9091[_0x72a0('0x44')]);_0x4a72fd[_0x72a0('0x48')]=_[_0x72a0('0x47')](_0x4f9091[_0x72a0('0x43')],qs[_0x72a0('0x56')](_0x304400['query'][_0x72a0('0x56')]));_0x4a72fd['attributes']=_0x4a72fd['attributes'][_0x72a0('0x49')]?_0x4a72fd[_0x72a0('0x48')]:_0x4f9091[_0x72a0('0x43')];if(_0x304400[_0x72a0('0x44')][_0x72a0('0x50')]){_0x4a72fd['include']=[{'all':!![]}];}_0x4a72fd=_[_0x72a0('0x4d')]({},_0x4a72fd,_0x304400[_0x72a0('0x57')]);return db['Dynamics365Account']['find'](_0x4a72fd)[_0x72a0('0x21')](handleEntityNotFound(_0x2de809,null))[_0x72a0('0x21')](respondWithResult(_0x2de809,null))[_0x72a0('0x2b')](handleError(_0x2de809,null));};exports[_0x72a0('0x58')]=function(_0x18b4b3,_0x3813ca){return db[_0x72a0('0x3e')][_0x72a0('0x58')](_0x18b4b3['body'],{})[_0x72a0('0x21')](respondWithResult(_0x3813ca,0xc9))['catch'](handleError(_0x3813ca,null));};exports['update']=function(_0x591dbc,_0x1f30e0){if(_0x591dbc[_0x72a0('0x59')]['id']){delete _0x591dbc['body']['id'];}return db[_0x72a0('0x3e')]['find']({'where':{'id':_0x591dbc[_0x72a0('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f30e0,null))['then'](saveUpdates(_0x591dbc[_0x72a0('0x59')],null))[_0x72a0('0x21')](respondWithResult(_0x1f30e0,null))['catch'](handleError(_0x1f30e0,null));};exports[_0x72a0('0x38')]=function(_0x4bb670,_0x106ec1){return db['Dynamics365Account']['find']({'where':{'id':_0x4bb670[_0x72a0('0x55')]['id']}})[_0x72a0('0x21')](handleEntityNotFound(_0x106ec1,null))[_0x72a0('0x21')](removeEntity(_0x106ec1,null))['catch'](handleError(_0x106ec1,null));};exports['getConfigurations']=function(_0xe49c8e,_0x48f178,_0x44b171){var _0x36d604={};var _0x1cea02={};var _0x4b03ab;var _0x11a750;return db[_0x72a0('0x3e')][_0x72a0('0x5a')]({'where':{'id':_0xe49c8e[_0x72a0('0x55')]['id']}})[_0x72a0('0x21')](handleEntityNotFound(_0x48f178,null))[_0x72a0('0x21')](function(_0x32a0bb){if(_0x32a0bb){_0x4b03ab=_0x32a0bb;_0x1cea02[_0x72a0('0x43')]=_['keys'](db[_0x72a0('0x5b')]['rawAttributes']);_0x1cea02['query']=_['keys'](_0xe49c8e['query']);_0x1cea02[_0x72a0('0x46')]=_[_0x72a0('0x47')](_0x1cea02[_0x72a0('0x43')],_0x1cea02['query']);_0x36d604[_0x72a0('0x48')]=_['intersection'](_0x1cea02[_0x72a0('0x43')],qs[_0x72a0('0x56')](_0xe49c8e['query'][_0x72a0('0x56')]));_0x36d604[_0x72a0('0x48')]=_0x36d604[_0x72a0('0x48')][_0x72a0('0x49')]?_0x36d604['attributes']:_0x1cea02[_0x72a0('0x43')];_0x36d604['order']=qs[_0x72a0('0x4b')](_0xe49c8e[_0x72a0('0x44')][_0x72a0('0x4b')]);_0x36d604['where']=qs[_0x72a0('0x46')](_[_0x72a0('0x5c')](_0xe49c8e[_0x72a0('0x44')],_0x1cea02[_0x72a0('0x46')]));if(_0xe49c8e[_0x72a0('0x44')]['filter']){_0x36d604['where']=_[_0x72a0('0x4d')](_0x36d604['where'],{'$or':_[_0x72a0('0x3d')](_0x36d604['attributes'],function(_0x3c7fa6){var _0xd9ae1a={};_0xd9ae1a[_0x3c7fa6]={'$like':'%'+_0xe49c8e['query'][_0x72a0('0x4f')]+'%'};return _0xd9ae1a;})});}_0x36d604=_[_0x72a0('0x4d')]({},_0x36d604,_0xe49c8e[_0x72a0('0x57')]);return _0x4b03ab['getConfigurations'](_0x36d604);}})[_0x72a0('0x21')](function(_0x48649e){if(_0x48649e){_0x11a750=_0x48649e[_0x72a0('0x49')];if(!_0xe49c8e[_0x72a0('0x44')]['hasOwnProperty'](_0x72a0('0x5d'))){_0x36d604['limit']=qs['limit'](_0xe49c8e['query'][_0x72a0('0x31')]);_0x36d604['offset']=qs[_0x72a0('0x30')](_0xe49c8e['query'][_0x72a0('0x30')]);}return _0x4b03ab[_0x72a0('0x5e')](_0x36d604);}})[_0x72a0('0x21')](function(_0x5b81d7){if(_0x5b81d7){return _0x5b81d7?{'count':_0x11a750,'rows':_0x5b81d7}:null;}})[_0x72a0('0x21')](respondWithResult(_0x48f178,null))[_0x72a0('0x2b')](handleError(_0x48f178,null));};exports[_0x72a0('0x5f')]=function(_0x28551a,_0x2c46dc,_0x58ef97){if(_0x28551a[_0x72a0('0x59')]['id']){delete _0x28551a[_0x72a0('0x59')]['id'];}return db[_0x72a0('0x3e')][_0x72a0('0x5a')]({'where':{'id':_0x28551a['params']['id']}})[_0x72a0('0x21')](handleEntityNotFound(_0x2c46dc,null))[_0x72a0('0x21')](function(_0x4ebce5){if(_0x4ebce5){_0x28551a[_0x72a0('0x59')]['AccountId']=_0x4ebce5['id'];_0x28551a[_0x72a0('0x59')][_0x72a0('0x60')]=integrations[_0x72a0('0x61')](_0x28551a[_0x72a0('0x59')][_0x72a0('0x62')],_0x28551a[_0x72a0('0x59')][_0x72a0('0x41')]);_0x28551a['body']['Descriptions']=integrations['getDescriptions'](_0x28551a[_0x72a0('0x59')][_0x72a0('0x62')],_0x28551a[_0x72a0('0x59')][_0x72a0('0x41')]);return db[_0x72a0('0x5b')][_0x72a0('0x58')](_0x28551a['body'],{'include':[{'model':db[_0x72a0('0x63')],'as':_0x72a0('0x60')},{'model':db[_0x72a0('0x63')],'as':_0x72a0('0x64')}]});}return null;})[_0x72a0('0x21')](respondWithResult(_0x2c46dc,null))[_0x72a0('0x2b')](handleError(_0x2c46dc,null));};exports[_0x72a0('0x65')]=function(_0x5d5dd8,_0x1e36b0,_0x9fc964){var _0x130c90=_0x5d5dd8[_0x72a0('0x44')][_0x72a0('0x66')];var _0x26e270=_0x130c90==='incident'?_0x72a0('0x67'):'PhoneCall';var _0x35fc2c='';var _0x1a51bb='';var _0x134c7d='';var _0x3d5edb='';var _0xed6c1b='';var _0x546646='';var _0x361f8f='';var _0x46a306='';var _0x4e52e4=[_0x72a0('0x68'),_0x72a0('0x69'),_0x72a0('0x6a'),_0x72a0('0x6b'),'caseorigincode',_0x72a0('0x6c'),_0x72a0('0x6d'),_0x72a0('0x6e'),_0x72a0('0x6f'),_0x72a0('0x70')];var _0xfef0b1=[_0x72a0('0x71'),_0x72a0('0x72'),_0x72a0('0x73'),_0x72a0('0x74'),_0x72a0('0x75'),_0x72a0('0x76'),'contractdetailidname',_0x72a0('0x77'),_0x72a0('0x78'),_0x72a0('0x79'),_0x72a0('0x7a'),_0x72a0('0x7b'),_0x72a0('0x7c'),_0x72a0('0x7d'),_0x72a0('0x7e'),'customeridname',_0x72a0('0x7f'),'customeridyominame','emailaddress',_0x72a0('0x80'),'entityimage_timestamp','entityimage_url',_0x72a0('0x81'),'exchangerate',_0x72a0('0x82'),_0x72a0('0x83'),_0x72a0('0x84'),'influencescore',_0x72a0('0x85'),_0x72a0('0x86'),_0x72a0('0x87'),_0x72a0('0x88'),_0x72a0('0x89'),'modifiedbyname',_0x72a0('0x8a'),_0x72a0('0x8b'),_0x72a0('0x8c'),'modifiedonbehalfbyyominame',_0x72a0('0x8d'),_0x72a0('0x8e'),_0x72a0('0x8f'),'onholdtime',_0x72a0('0x90'),_0x72a0('0x91'),_0x72a0('0x92'),_0x72a0('0x93'),_0x72a0('0x94'),_0x72a0('0x95'),_0x72a0('0x96'),_0x72a0('0x97'),_0x72a0('0x98'),'productserialnumber',_0x72a0('0x99'),_0x72a0('0x9a'),_0x72a0('0x9b'),_0x72a0('0x9c'),_0x72a0('0x9d'),'sentimentvalue',_0x72a0('0x9e'),_0x72a0('0x9f'),_0x72a0('0xa0'),_0x72a0('0xa1'),'statuscode',_0x72a0('0xa2'),_0x72a0('0xa3'),_0x72a0('0xa4'),'transactioncurrencyidname','traversedpath',_0x72a0('0xa5'),_0x72a0('0xa6')];var _0x17776e=_0x4e52e4[_0x72a0('0xa7')](_0xfef0b1);return db[_0x72a0('0x3e')]['findOne']({'where':{'id':_0x5d5dd8['params']['id']},'attributes':['id','username',_0x72a0('0xa8'),'remoteUri',_0x72a0('0xa9'),'clientId','clientSecret']})['then'](handleEntityNotFound(_0x1e36b0,null))['then'](function(_0x33c9dd){if(_0x33c9dd){_0x46a306=_0x33c9dd[_0x72a0('0xaa')];var _0x153802=_0x46a306[_0x72a0('0xab')](-0x1);if(_0x153802==='/'){_0x46a306=_0x46a306['substring'](0x0,_0x46a306[_0x72a0('0xac')](_0x153802));}_0x361f8f=util[_0x72a0('0xad')]('%s/api/data/v9.0/',_0x46a306);var _0xda549d={'method':_0x72a0('0xae'),'uri':'https://login.microsoftonline.com/'+_0x33c9dd[_0x72a0('0xa9')]+_0x72a0('0xaf'),'form':{'client_id':_0x33c9dd[_0x72a0('0xb0')],'resource':_0x46a306,'username':_0x33c9dd[_0x72a0('0xb1')],'password':_0x33c9dd['password'],'grant_type':'password','client_secret':_0x33c9dd[_0x72a0('0xb2')]},'json':!![]};return rp(_0xda549d);}})[_0x72a0('0x21')](function(_0x358f96){_0x546646=_0x358f96[_0x72a0('0xb3')];var _0x2ac5b0={'method':_0x72a0('0xb4'),'uri':encodeURI(_0x361f8f+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x26e270+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x546646,'If-None-Match':null,'OData-Version':_0x72a0('0xb5')},'json':!![]};return rp(_0x2ac5b0);})[_0x72a0('0x21')](function(_0x57550f){var _0x40f2e2=_0x57550f[_0x72a0('0xb6')][0x0];var _0xec7717=_0x40f2e2[_0x72a0('0xb7')];var _0x328c84={'method':_0x72a0('0xb4'),'uri':_0x361f8f+_0x72a0('0xb8')+_0xec7717+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x72a0('0xb9')+_0x546646,'If-None-Match':null,'OData-Version':_0x72a0('0xb5')},'json':!![]};return rp(_0x328c84);})[_0x72a0('0x21')](function(_0x5a0aa3){_0x35fc2c=_0x5a0aa3;_0x1a51bb=_0x35fc2c[_0x72a0('0xba')];_0x1a51bb=_[_0x72a0('0xbb')](_0x1a51bb,function(_0x346e03){return!_0x17776e[_0x72a0('0xbc')](_0x346e03[_0x72a0('0xbd')]);});var _0x49374f=[];var _0xc16765=[];_0x1a51bb[_0x72a0('0xbe')](function(_0x1f6d7d){if(_0x1f6d7d[_0x72a0('0xbf')]){var _0xfe62a1=_0x1f6d7d[_0x72a0('0xbf')]['substring'](_0x1f6d7d[_0x72a0('0xbf')][_0x72a0('0xac')]('.')+0x1);if(_0xfe62a1===_0x72a0('0xc0')){_0x49374f[_0x72a0('0xc1')](getSelectList(_0x361f8f,_0x130c90,_0xc16765,_0x35fc2c[_0x72a0('0xb7')],_0x1f6d7d[_0x72a0('0xb7')],_0x546646));}}});return Promise[_0x72a0('0xc2')](_0x49374f);})[_0x72a0('0x21')](function(_0x2c99f9){_0x134c7d=_0x2c99f9[0x0];var _0x49b0e8=[];var _0x2a2eaa=[];_0x1a51bb['forEach'](function(_0x1dcbcc){if(!_[_0x72a0('0xc3')](_0x1dcbcc[_0x72a0('0xbf')])){var _0x276cca=_0x1dcbcc[_0x72a0('0xbf')][_0x72a0('0xc4')](_0x1dcbcc['@odata.type']['lastIndexOf']('.')+0x1);if(_0x276cca===_0x72a0('0xc5')){_0x49b0e8[_0x72a0('0xc1')](getBooleanList(_0x361f8f,_0x130c90,_0x2a2eaa,_0x35fc2c[_0x72a0('0xb7')],_0x1dcbcc[_0x72a0('0xb7')],_0x546646));}}});return Promise[_0x72a0('0xc2')](_0x49b0e8);})[_0x72a0('0x21')](function(_0x3a8386){_0x3d5edb=_0x3a8386[0x0];var _0x1e7d8b=[];var _0xbad206=[];_0x1a51bb[_0x72a0('0xbe')](function(_0x227901){if(_0x227901[_0x72a0('0xbf')]){var _0x1fb03c=_0x227901[_0x72a0('0xbf')][_0x72a0('0xc4')](_0x227901['@odata.type'][_0x72a0('0xac')]('.')+0x1);if(_0x1fb03c==='StringAttributeMetadata'||_0x1fb03c===_0x72a0('0xc6')||_0x1fb03c==='BigIntAttributeMetadata'||_0x1fb03c===_0x72a0('0xc7')||_0x1fb03c==='MemoAttributeMetadata'||_0x1fb03c===_0x72a0('0xc8')||_0x1fb03c===_0x72a0('0xc9')||_0x1fb03c===_0x72a0('0xca')||_0x1fb03c===_0x72a0('0xcb')||_0x1fb03c===_0x72a0('0xcc')){_0x1e7d8b[_0x72a0('0xc1')](getInputList(_0x361f8f,_0x130c90,_0x1fb03c,_0xbad206,_0x35fc2c['MetadataId'],_0x227901[_0x72a0('0xb7')],_0x546646));}}});return Promise['all'](_0x1e7d8b);})[_0x72a0('0x21')](function(_0xf9e86a){_0xed6c1b=_0xf9e86a[0x0];var _0x10c1e2=_0x134c7d[_0x72a0('0xa7')](_0x3d5edb)[_0x72a0('0xa7')](_0xed6c1b);var _0x2ded38={'count':_0x10c1e2['length'],'rows':_0x10c1e2};return _0x2ded38;})[_0x72a0('0x21')](respondWithResult(_0x1e36b0,null))[_0x72a0('0x2b')](function(_0x431223){var _0x2130db=_0x5d5dd8[_0x72a0('0x44')][_0x72a0('0xcd')]?0x1f4:_0x431223[_0x72a0('0xce')]||0x1f4;logger[_0x72a0('0x26')](_0x431223[_0x72a0('0x39')]);delete _0x431223['name'];if(_0x2130db===0x191){_0x2130db=0x190;}_0x1e36b0[_0x72a0('0x2c')](_0x2130db)[_0x72a0('0x3b')](_0x5d5dd8[_0x72a0('0x44')][_0x72a0('0xcd')]?{'message':_0x72a0('0xcf'),'statusCode':_0x431223[_0x72a0('0xce')]}:_0x431223);});};function getSelectList(_0xd630ef,_0x67aef2,_0x4be4ed,_0x5d1e58,_0x485f13,_0x48f253){var _0x528f71={'method':'GET','uri':_0xd630ef+_0x72a0('0xb8')+_0x5d1e58+')/Attributes('+_0x485f13+_0x72a0('0xd0')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x72a0('0xb9')+_0x48f253,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x528f71)[_0x72a0('0x21')](function(_0x22fea4){var _0x501e72=[];var _0x19c6c3=_0x22fea4['OptionSet'][_0x72a0('0xd1')];_0x19c6c3[_0x72a0('0xbe')](function(_0x5ed10f){_0x501e72[_0x72a0('0xc1')]({'name':_0x5ed10f['Label'][_0x72a0('0xd2')][_0x72a0('0xd3')],'value':String(_0x5ed10f[_0x72a0('0xd4')])});});var _0x3b0c66={'id':_0x67aef2+'_'+_0x22fea4['LogicalName'],'name':_0x22fea4[_0x72a0('0xd5')]['UserLocalizedLabel'][_0x72a0('0xd3')],'custom':![],'options':_0x501e72};_0x4be4ed[_0x72a0('0xc1')](_0x3b0c66);return _0x4be4ed;});}function getBooleanList(_0x3ec3dd,_0x4389a6,_0x47012a,_0x2e7e17,_0x495e78,_0x38fb73){var _0x308f02={'method':'GET','uri':_0x3ec3dd+_0x72a0('0xb8')+_0x2e7e17+_0x72a0('0xd6')+_0x495e78+_0x72a0('0xd7'),'headers':{'Authorization':_0x72a0('0xb9')+_0x38fb73,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x308f02)[_0x72a0('0x21')](function(_0x23d348){var _0x1a78c2=[];_0x1a78c2[_0x72a0('0xc1')]({'name':_0x23d348[_0x72a0('0xd8')][_0x72a0('0xd9')]['Label'][_0x72a0('0xd2')][_0x72a0('0xd3')],'value':_0x72a0('0xda')},{'name':_0x23d348[_0x72a0('0xd8')][_0x72a0('0xdb')]['Label'][_0x72a0('0xd2')][_0x72a0('0xd3')],'value':'false'});var _0x19013b={'id':_0x4389a6+'_'+_0x23d348[_0x72a0('0xbd')],'name':_0x23d348[_0x72a0('0xd5')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x1a78c2};_0x47012a[_0x72a0('0xc1')](_0x19013b);return _0x47012a;});}function getInputList(_0x4592d1,_0x2c6a75,_0x5877f9,_0x4cd5b3,_0x1beace,_0x49b82a,_0x42b58d){var _0x1c0d20={'method':_0x72a0('0xb4'),'uri':_0x4592d1+_0x72a0('0xb8')+_0x1beace+_0x72a0('0xd6')+_0x49b82a+_0x72a0('0xdc')+_0x5877f9+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x72a0('0xb9')+_0x42b58d,'If-None-Match':null,'OData-Version':_0x72a0('0xb5')},'json':!![]};return rp(_0x1c0d20)[_0x72a0('0x21')](function(_0x4533a2){var _0x343c6a={'id':_0x2c6a75+'_'+_0x4533a2[_0x72a0('0xbd')],'name':_0x4533a2[_0x72a0('0xd5')][_0x72a0('0xd2')]?_0x4533a2[_0x72a0('0xd5')]['UserLocalizedLabel'][_0x72a0('0xd3')]:_0x4533a2[_0x72a0('0xbd')],'custom':![],'options':[]};_0x4cd5b3[_0x72a0('0xc1')](_0x343c6a);return _0x4cd5b3;});} \ No newline at end of file +var _0x1883=['status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','Dynamics365Account','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','keys','body','find','getConfigurations','findOne','Dynamics365Configuration','order','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','create','Dynamics365Field','Descriptions','ticketType','incident','Incident','PhoneCall','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','responseby','slaname','socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','substring','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false','DisplayName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end'];(function(_0x4a2e95,_0x3b3950){var _0x21e3eb=function(_0x51b3ed){while(--_0x51b3ed){_0x4a2e95['push'](_0x4a2e95['shift']());}};_0x21e3eb(++_0x3b3950);}(_0x1883,0xab));var _0x3188=function(_0x427420,_0x2a7e89){_0x427420=_0x427420-0x0;var _0x494903=_0x1883[_0x427420];return _0x494903;};'use strict';var pdf=require(_0x3188('0x0'));var emlformat=require(_0x3188('0x1'));var rimraf=require(_0x3188('0x2'));var zipdir=require(_0x3188('0x3'));var jsonpatch=require(_0x3188('0x4'));var rp=require(_0x3188('0x5'));var moment=require(_0x3188('0x6'));var BPromise=require(_0x3188('0x7'));var Mustache=require(_0x3188('0x8'));var util=require(_0x3188('0x9'));var path=require(_0x3188('0xa'));var sox=require(_0x3188('0xb'));var csv=require(_0x3188('0xc'));var ejs=require(_0x3188('0xd'));var fs=require('fs');var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xc'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];var integrations=require(_0x3188('0x1a'));var jayson=require(_0x3188('0x1b'));var client=jayson[_0x3188('0x1c')][_0x3188('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xc01ce6,_0x490104,_0x276d69,_0x5e0044){return new BPromise(function(_0x4a2f36,_0x1b8a18){var _0x53668b=_0x5e0044||client;return _0x53668b['request'](_0xc01ce6,_0x276d69)[_0x3188('0x1e')](function(_0x1beead){logger[_0x3188('0x1f')](_0x3188('0x20'),_0x490104,_0x3188('0x21'));logger[_0x3188('0x22')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x490104,_0x3188('0x21'),JSON[_0x3188('0x23')](_0x1beead));if(_0x1beead[_0x3188('0x24')]){if(_0x1beead[_0x3188('0x24')][_0x3188('0x25')]===0x1f4){logger[_0x3188('0x24')](_0x3188('0x20'),_0x490104,_0x1beead[_0x3188('0x24')]['message']);return _0x1b8a18(_0x1beead[_0x3188('0x24')][_0x3188('0x26')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x490104,_0x1beead['error'][_0x3188('0x26')]);return _0x4a2f36(_0x1beead[_0x3188('0x24')][_0x3188('0x26')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x490104,_0x3188('0x21'));_0x4a2f36(_0x1beead[_0x3188('0x27')][_0x3188('0x26')]);}})[_0x3188('0x28')](function(_0xb61717){logger['error'](_0x3188('0x20'),_0x490104,_0xb61717);_0x1b8a18(_0xb61717);});});}function respondWithStatusCode(_0x33f882,_0x5a2e67){_0x5a2e67=_0x5a2e67||0xcc;return function(_0xcbaec9){if(_0xcbaec9){return _0x33f882['sendStatus'](_0x5a2e67);}return _0x33f882['status'](_0x5a2e67)[_0x3188('0x29')]();};}function respondWithResult(_0x129bd7,_0x87d5a3){_0x87d5a3=_0x87d5a3||0xc8;return function(_0x1aeaba){if(_0x1aeaba){return _0x129bd7[_0x3188('0x2a')](_0x87d5a3)[_0x3188('0x2b')](_0x1aeaba);}};}function respondWithFilteredResult(_0xe57f73,_0x11021c){return function(_0x4b4675){if(_0x4b4675){var _0x2cc5d9=_0x4b4675[_0x3188('0x2c')],_0x2d000a=_0x11021c[_0x3188('0x2d')],_0x52bb13=_0x11021c[_0x3188('0x2d')]+_0x11021c[_0x3188('0x2e')],_0xd3ee40;if(_0x52bb13>=_0x2cc5d9){_0x52bb13=_0x2cc5d9;_0xd3ee40=0xc8;}else{_0xd3ee40=0xce;}_0xe57f73[_0x3188('0x2a')](_0xd3ee40);return _0xe57f73[_0x3188('0x2f')](_0x3188('0x30'),_0x2d000a+'-'+_0x52bb13+'/'+_0x2cc5d9)['json'](_0x4b4675);}return null;};}function patchUpdates(_0x44fa15){return function(_0x5d97d0){try{jsonpatch[_0x3188('0x31')](_0x5d97d0,_0x44fa15,!![]);}catch(_0x5623f1){return BPromise[_0x3188('0x32')](_0x5623f1);}return _0x5d97d0[_0x3188('0x33')]();};}function saveUpdates(_0x3be4f7,_0xacdad7){return function(_0x43b8ae){if(_0x43b8ae){return _0x43b8ae[_0x3188('0x34')](_0x3be4f7)[_0x3188('0x1e')](function(_0x279069){return _0x279069;});}return null;};}function removeEntity(_0x3188a1,_0x1adcf9){return function(_0x7c23b1){if(_0x7c23b1){return _0x7c23b1[_0x3188('0x35')]()[_0x3188('0x1e')](function(){_0x3188a1[_0x3188('0x2a')](0xcc)[_0x3188('0x29')]();});}};}function handleEntityNotFound(_0x41c4cd,_0x244f58){return function(_0x46ca80){if(!_0x46ca80){_0x41c4cd['sendStatus'](0x194);}return _0x46ca80;};}function handleError(_0x47374b,_0x4c9182){_0x4c9182=_0x4c9182||0x1f4;return function(_0x1c945e){logger[_0x3188('0x24')](_0x1c945e['stack']);if(_0x1c945e[_0x3188('0x36')]){delete _0x1c945e[_0x3188('0x36')];}_0x47374b[_0x3188('0x2a')](_0x4c9182)[_0x3188('0x37')](_0x1c945e);};}exports[_0x3188('0x38')]=function(_0x2c07c6,_0x2bef8e){var _0x51b7a9={},_0x4e4710={},_0xa876c8={'count':0x0,'rows':[]};var _0x231e2d=_[_0x3188('0x39')](db[_0x3188('0x3a')]['rawAttributes'],function(_0x2ca68c){return{'name':_0x2ca68c[_0x3188('0x3b')],'type':_0x2ca68c[_0x3188('0x3c')][_0x3188('0x3d')]};});_0x4e4710['model']=_[_0x3188('0x39')](_0x231e2d,'name');_0x4e4710[_0x3188('0x3e')]=_['keys'](_0x2c07c6[_0x3188('0x3e')]);_0x4e4710[_0x3188('0x3f')]=_[_0x3188('0x40')](_0x4e4710[_0x3188('0x41')],_0x4e4710[_0x3188('0x3e')]);_0x51b7a9[_0x3188('0x42')]=_[_0x3188('0x40')](_0x4e4710[_0x3188('0x41')],qs[_0x3188('0x43')](_0x2c07c6[_0x3188('0x3e')]['fields']));_0x51b7a9[_0x3188('0x42')]=_0x51b7a9[_0x3188('0x42')][_0x3188('0x44')]?_0x51b7a9[_0x3188('0x42')]:_0x4e4710[_0x3188('0x41')];if(!_0x2c07c6[_0x3188('0x3e')]['hasOwnProperty'](_0x3188('0x45'))){_0x51b7a9['limit']=qs[_0x3188('0x2e')](_0x2c07c6[_0x3188('0x3e')][_0x3188('0x2e')]);_0x51b7a9[_0x3188('0x2d')]=qs[_0x3188('0x2d')](_0x2c07c6['query']['offset']);}_0x51b7a9['order']=qs['sort'](_0x2c07c6['query'][_0x3188('0x46')]);_0x51b7a9[_0x3188('0x47')]=qs[_0x3188('0x3f')](_[_0x3188('0x48')](_0x2c07c6[_0x3188('0x3e')],_0x4e4710['filters']),_0x231e2d);if(_0x2c07c6[_0x3188('0x3e')]['filter']){_0x51b7a9[_0x3188('0x47')]=_[_0x3188('0x49')](_0x51b7a9[_0x3188('0x47')],{'$or':_[_0x3188('0x39')](_0x231e2d,function(_0x55bd61){if(_0x55bd61[_0x3188('0x3c')]!==_0x3188('0x4a')){var _0x19c5f4={};_0x19c5f4[_0x55bd61[_0x3188('0x36')]]={'$like':'%'+_0x2c07c6[_0x3188('0x3e')]['filter']+'%'};return _0x19c5f4;}})});}_0x51b7a9=_['merge']({},_0x51b7a9,_0x2c07c6[_0x3188('0x4b')]);var _0x24bc8a={'where':_0x51b7a9['where']};return db[_0x3188('0x3a')][_0x3188('0x2c')](_0x24bc8a)['then'](function(_0x3f05e9){_0xa876c8[_0x3188('0x2c')]=_0x3f05e9;if(_0x2c07c6[_0x3188('0x3e')][_0x3188('0x4c')]){_0x51b7a9[_0x3188('0x4d')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x3188('0x4e')](_0x51b7a9);})['then'](function(_0x44f133){_0xa876c8[_0x3188('0x4f')]=_0x44f133;return _0xa876c8;})[_0x3188('0x1e')](respondWithFilteredResult(_0x2bef8e,_0x51b7a9))[_0x3188('0x28')](handleError(_0x2bef8e,null));};exports[_0x3188('0x50')]=function(_0x315524,_0x2aa232){var _0x413a0b={'raw':![],'where':{'id':_0x315524[_0x3188('0x51')]['id']}},_0x5f7205={};_0x5f7205[_0x3188('0x41')]=_['keys'](db['Dynamics365Account'][_0x3188('0x52')]);_0x5f7205['query']=_[_0x3188('0x53')](_0x315524[_0x3188('0x3e')]);_0x5f7205['filters']=_[_0x3188('0x40')](_0x5f7205[_0x3188('0x41')],_0x5f7205[_0x3188('0x3e')]);_0x413a0b[_0x3188('0x42')]=_[_0x3188('0x40')](_0x5f7205[_0x3188('0x41')],qs[_0x3188('0x43')](_0x315524[_0x3188('0x3e')]['fields']));_0x413a0b[_0x3188('0x42')]=_0x413a0b[_0x3188('0x42')]['length']?_0x413a0b[_0x3188('0x42')]:_0x5f7205['model'];if(_0x315524[_0x3188('0x3e')][_0x3188('0x4c')]){_0x413a0b[_0x3188('0x4d')]=[{'all':!![]}];}_0x413a0b=_['merge']({},_0x413a0b,_0x315524['options']);return db['Dynamics365Account']['find'](_0x413a0b)['then'](handleEntityNotFound(_0x2aa232,null))[_0x3188('0x1e')](respondWithResult(_0x2aa232,null))[_0x3188('0x28')](handleError(_0x2aa232,null));};exports['create']=function(_0x1e72b7,_0x1b5465){return db['Dynamics365Account']['create'](_0x1e72b7['body'],{})['then'](respondWithResult(_0x1b5465,0xc9))['catch'](handleError(_0x1b5465,null));};exports[_0x3188('0x34')]=function(_0x4763a5,_0x9860ab){if(_0x4763a5[_0x3188('0x54')]['id']){delete _0x4763a5[_0x3188('0x54')]['id'];}return db['Dynamics365Account'][_0x3188('0x55')]({'where':{'id':_0x4763a5[_0x3188('0x51')]['id']}})['then'](handleEntityNotFound(_0x9860ab,null))['then'](saveUpdates(_0x4763a5['body'],null))[_0x3188('0x1e')](respondWithResult(_0x9860ab,null))[_0x3188('0x28')](handleError(_0x9860ab,null));};exports[_0x3188('0x35')]=function(_0x59fe5b,_0x206d10){return db[_0x3188('0x3a')][_0x3188('0x55')]({'where':{'id':_0x59fe5b[_0x3188('0x51')]['id']}})[_0x3188('0x1e')](handleEntityNotFound(_0x206d10,null))['then'](removeEntity(_0x206d10,null))[_0x3188('0x28')](handleError(_0x206d10,null));};exports[_0x3188('0x56')]=function(_0x1fdacf,_0x5b397d,_0x411d7b){var _0x138a0e={};var _0x29eb0d={};var _0x2a13bc;var _0x59249f;return db[_0x3188('0x3a')][_0x3188('0x57')]({'where':{'id':_0x1fdacf[_0x3188('0x51')]['id']}})[_0x3188('0x1e')](handleEntityNotFound(_0x5b397d,null))[_0x3188('0x1e')](function(_0x1b8c54){if(_0x1b8c54){_0x2a13bc=_0x1b8c54;_0x29eb0d[_0x3188('0x41')]=_['keys'](db[_0x3188('0x58')][_0x3188('0x52')]);_0x29eb0d[_0x3188('0x3e')]=_[_0x3188('0x53')](_0x1fdacf[_0x3188('0x3e')]);_0x29eb0d[_0x3188('0x3f')]=_[_0x3188('0x40')](_0x29eb0d['model'],_0x29eb0d[_0x3188('0x3e')]);_0x138a0e[_0x3188('0x42')]=_[_0x3188('0x40')](_0x29eb0d[_0x3188('0x41')],qs[_0x3188('0x43')](_0x1fdacf['query'][_0x3188('0x43')]));_0x138a0e[_0x3188('0x42')]=_0x138a0e['attributes']['length']?_0x138a0e[_0x3188('0x42')]:_0x29eb0d[_0x3188('0x41')];_0x138a0e[_0x3188('0x59')]=qs[_0x3188('0x46')](_0x1fdacf[_0x3188('0x3e')][_0x3188('0x46')]);_0x138a0e[_0x3188('0x47')]=qs[_0x3188('0x3f')](_[_0x3188('0x48')](_0x1fdacf[_0x3188('0x3e')],_0x29eb0d['filters']));if(_0x1fdacf[_0x3188('0x3e')]['filter']){_0x138a0e['where']=_[_0x3188('0x49')](_0x138a0e['where'],{'$or':_[_0x3188('0x39')](_0x138a0e[_0x3188('0x42')],function(_0x7aa116){var _0x8b6d37={};_0x8b6d37[_0x7aa116]={'$like':'%'+_0x1fdacf[_0x3188('0x3e')][_0x3188('0x5a')]+'%'};return _0x8b6d37;})});}_0x138a0e=_['merge']({},_0x138a0e,_0x1fdacf[_0x3188('0x4b')]);return _0x2a13bc[_0x3188('0x56')](_0x138a0e);}})['then'](function(_0x1db69c){if(_0x1db69c){_0x59249f=_0x1db69c[_0x3188('0x44')];if(!_0x1fdacf[_0x3188('0x3e')][_0x3188('0x5b')](_0x3188('0x45'))){_0x138a0e[_0x3188('0x2e')]=qs['limit'](_0x1fdacf[_0x3188('0x3e')][_0x3188('0x2e')]);_0x138a0e['offset']=qs[_0x3188('0x2d')](_0x1fdacf[_0x3188('0x3e')][_0x3188('0x2d')]);}return _0x2a13bc['getConfigurations'](_0x138a0e);}})[_0x3188('0x1e')](function(_0xfebf94){if(_0xfebf94){return _0xfebf94?{'count':_0x59249f,'rows':_0xfebf94}:null;}})[_0x3188('0x1e')](respondWithResult(_0x5b397d,null))[_0x3188('0x28')](handleError(_0x5b397d,null));};exports[_0x3188('0x5c')]=function(_0x1bfd9b,_0x192874,_0x54a8e1){if(_0x1bfd9b['body']['id']){delete _0x1bfd9b['body']['id'];}return db['Dynamics365Account'][_0x3188('0x57')]({'where':{'id':_0x1bfd9b[_0x3188('0x51')]['id']}})[_0x3188('0x1e')](handleEntityNotFound(_0x192874,null))[_0x3188('0x1e')](function(_0x2ef80c){if(_0x2ef80c){_0x1bfd9b['body'][_0x3188('0x5d')]=_0x2ef80c['id'];_0x1bfd9b['body'][_0x3188('0x5e')]=integrations[_0x3188('0x5f')](_0x1bfd9b['body'][_0x3188('0x60')],_0x1bfd9b['body'][_0x3188('0x3c')]);_0x1bfd9b[_0x3188('0x54')]['Descriptions']=integrations[_0x3188('0x61')](_0x1bfd9b['body'][_0x3188('0x60')],_0x1bfd9b[_0x3188('0x54')][_0x3188('0x3c')]);return db[_0x3188('0x58')][_0x3188('0x62')](_0x1bfd9b['body'],{'include':[{'model':db[_0x3188('0x63')],'as':_0x3188('0x5e')},{'model':db['Dynamics365Field'],'as':_0x3188('0x64')}]});}return null;})[_0x3188('0x1e')](respondWithResult(_0x192874,null))['catch'](handleError(_0x192874,null));};exports['getFields']=function(_0x1cc2cb,_0x42d64e,_0x1c98d1){var _0x3cd52f=_0x1cc2cb[_0x3188('0x3e')][_0x3188('0x65')];var _0x5c36ff=_0x3cd52f===_0x3188('0x66')?_0x3188('0x67'):_0x3188('0x68');var _0x5b2550='';var _0x3bc5f8='';var _0x3227a2='';var _0x46b368='';var _0x310f46='';var _0x67007='';var _0xa0f9fa='';var _0x53b834='';var _0x491db0=['title',_0x3188('0x69'),_0x3188('0x6a'),'ownerid',_0x3188('0x6b'),_0x3188('0x6c'),_0x3188('0x6d'),_0x3188('0x6e'),_0x3188('0x6f'),_0x3188('0x70')];var _0x5f33eb=[_0x3188('0x71'),_0x3188('0x72'),_0x3188('0x73'),_0x3188('0x74'),_0x3188('0x75'),_0x3188('0x76'),_0x3188('0x77'),_0x3188('0x78'),_0x3188('0x79'),_0x3188('0x7a'),_0x3188('0x7b'),_0x3188('0x7c'),_0x3188('0x7d'),_0x3188('0x7e'),_0x3188('0x7f'),_0x3188('0x80'),_0x3188('0x81'),_0x3188('0x82'),'emailaddress',_0x3188('0x83'),_0x3188('0x84'),_0x3188('0x85'),_0x3188('0x86'),_0x3188('0x87'),'firstresponsebykpiidname',_0x3188('0x88'),_0x3188('0x89'),'influencescore',_0x3188('0x8a'),_0x3188('0x8b'),_0x3188('0x8c'),'modifiedbyexternalpartyname',_0x3188('0x8d'),'modifiedbyname',_0x3188('0x8e'),_0x3188('0x8f'),_0x3188('0x90'),_0x3188('0x91'),_0x3188('0x92'),_0x3188('0x93'),'numberofchildincidents','onholdtime',_0x3188('0x94'),_0x3188('0x95'),_0x3188('0x96'),_0x3188('0x97'),_0x3188('0x98'),_0x3188('0x99'),'primarycontactidyominame',_0x3188('0x9a'),_0x3188('0x9b'),_0x3188('0x9c'),_0x3188('0x9d'),'resolvebykpiidname',_0x3188('0x9e'),'responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname',_0x3188('0x9f'),_0x3188('0xa0'),'statecode',_0x3188('0xa1'),_0x3188('0xa2'),'ticketnumber',_0x3188('0xa3'),'transactioncurrencyidname',_0x3188('0xa4'),_0x3188('0xa5'),'versionnumber'];var _0x3c2f14=_0x491db0[_0x3188('0xa6')](_0x5f33eb);return db[_0x3188('0x3a')][_0x3188('0x57')]({'where':{'id':_0x1cc2cb[_0x3188('0x51')]['id']},'attributes':['id',_0x3188('0xa7'),_0x3188('0xa8'),_0x3188('0xa9'),_0x3188('0xaa'),_0x3188('0xab'),'clientSecret']})[_0x3188('0x1e')](handleEntityNotFound(_0x42d64e,null))[_0x3188('0x1e')](function(_0x298121){if(_0x298121){_0x53b834=_0x298121['remoteUri'];var _0x96eda5=_0x53b834['slice'](-0x1);if(_0x96eda5==='/'){_0x53b834=_0x53b834[_0x3188('0xac')](0x0,_0x53b834['lastIndexOf'](_0x96eda5));}_0xa0f9fa=util['format']('%s/api/data/v9.0/',_0x53b834);var _0x48da15={'method':_0x3188('0xad'),'uri':_0x3188('0xae')+_0x298121[_0x3188('0xaa')]+_0x3188('0xaf'),'form':{'client_id':_0x298121[_0x3188('0xab')],'resource':_0x53b834,'username':_0x298121['username'],'password':_0x298121[_0x3188('0xa8')],'grant_type':'password','client_secret':_0x298121['clientSecret']},'json':!![]};return rp(_0x48da15);}})[_0x3188('0x1e')](function(_0x1fbf5f){_0x67007=_0x1fbf5f['access_token'];var _0x14d35b={'method':_0x3188('0xb0'),'uri':encodeURI(_0xa0f9fa+_0x3188('0xb1')+_0x5c36ff+'\x27'),'headers':{'Authorization':_0x3188('0xb2')+_0x67007,'If-None-Match':null,'OData-Version':_0x3188('0xb3')},'json':!![]};return rp(_0x14d35b);})[_0x3188('0x1e')](function(_0x309125){var _0x5df789=_0x309125[_0x3188('0xb4')][0x0];var _0xa54e8a=_0x5df789[_0x3188('0xb5')];var _0x1df7db={'method':_0x3188('0xb0'),'uri':_0xa0f9fa+_0x3188('0xb6')+_0xa54e8a+_0x3188('0xb7'),'headers':{'Authorization':_0x3188('0xb2')+_0x67007,'If-None-Match':null,'OData-Version':_0x3188('0xb3')},'json':!![]};return rp(_0x1df7db);})['then'](function(_0x114131){_0x5b2550=_0x114131;_0x3bc5f8=_0x5b2550['Attributes'];_0x3bc5f8=_[_0x3188('0xb8')](_0x3bc5f8,function(_0x1f123c){return!_0x3c2f14[_0x3188('0xb9')](_0x1f123c[_0x3188('0xba')]);});var _0x446a5b=[];var _0x41ca86=[];_0x3bc5f8[_0x3188('0xbb')](function(_0x1d657f){if(_0x1d657f[_0x3188('0xbc')]){var _0x378a11=_0x1d657f[_0x3188('0xbc')][_0x3188('0xac')](_0x1d657f['@odata.type'][_0x3188('0xbd')]('.')+0x1);if(_0x378a11===_0x3188('0xbe')){_0x446a5b[_0x3188('0xbf')](getSelectList(_0xa0f9fa,_0x3cd52f,_0x41ca86,_0x5b2550[_0x3188('0xb5')],_0x1d657f[_0x3188('0xb5')],_0x67007));}}});return Promise[_0x3188('0xc0')](_0x446a5b);})[_0x3188('0x1e')](function(_0x5a2819){_0x3227a2=_0x5a2819[0x0];var _0x97f747=[];var _0x35c1b6=[];_0x3bc5f8[_0x3188('0xbb')](function(_0x186898){if(!_[_0x3188('0xc1')](_0x186898['@odata.type'])){var _0x4d5668=_0x186898[_0x3188('0xbc')][_0x3188('0xac')](_0x186898[_0x3188('0xbc')][_0x3188('0xbd')]('.')+0x1);if(_0x4d5668===_0x3188('0xc2')){_0x97f747['push'](getBooleanList(_0xa0f9fa,_0x3cd52f,_0x35c1b6,_0x5b2550[_0x3188('0xb5')],_0x186898[_0x3188('0xb5')],_0x67007));}}});return Promise[_0x3188('0xc0')](_0x97f747);})['then'](function(_0x2806de){_0x46b368=_0x2806de[0x0];var _0x1edfe7=[];var _0x1038ab=[];_0x3bc5f8[_0x3188('0xbb')](function(_0x18b674){if(_0x18b674[_0x3188('0xbc')]){var _0x2156ea=_0x18b674['@odata.type'][_0x3188('0xac')](_0x18b674[_0x3188('0xbc')][_0x3188('0xbd')]('.')+0x1);if(_0x2156ea==='StringAttributeMetadata'||_0x2156ea==='DoubleAttributeMetadata'||_0x2156ea===_0x3188('0xc3')||_0x2156ea===_0x3188('0xc4')||_0x2156ea==='MemoAttributeMetadata'||_0x2156ea==='DateTimeAttributeMetadata'||_0x2156ea==='StatusAttributeMetadata'||_0x2156ea==='EntityNameAttributeMetadata'||_0x2156ea==='StateAttributeMetadata'||_0x2156ea===_0x3188('0xc5')){_0x1edfe7[_0x3188('0xbf')](getInputList(_0xa0f9fa,_0x3cd52f,_0x2156ea,_0x1038ab,_0x5b2550['MetadataId'],_0x18b674['MetadataId'],_0x67007));}}});return Promise[_0x3188('0xc0')](_0x1edfe7);})['then'](function(_0xb4e34e){_0x310f46=_0xb4e34e[0x0];var _0x68b29a=_0x3227a2['concat'](_0x46b368)[_0x3188('0xa6')](_0x310f46);var _0x932fa5={'count':_0x68b29a[_0x3188('0x44')],'rows':_0x68b29a};return _0x932fa5;})[_0x3188('0x1e')](respondWithResult(_0x42d64e,null))[_0x3188('0x28')](function(_0x54a1b8){var _0x4ae7d2=_0x1cc2cb['query'][_0x3188('0xc6')]?0x1f4:_0x54a1b8[_0x3188('0xc7')]||0x1f4;logger[_0x3188('0x24')](_0x54a1b8['stack']);delete _0x54a1b8[_0x3188('0x36')];if(_0x4ae7d2===0x191){_0x4ae7d2=0x190;}_0x42d64e[_0x3188('0x2a')](_0x4ae7d2)['send'](_0x1cc2cb[_0x3188('0x3e')]['test']?{'message':_0x3188('0xc8'),'statusCode':_0x54a1b8['statusCode']}:_0x54a1b8);});};function getSelectList(_0x10bcfe,_0x19c3cd,_0x35a885,_0x5755de,_0x4a3d15,_0x42c678){var _0x5f453e={'method':_0x3188('0xb0'),'uri':_0x10bcfe+_0x3188('0xb6')+_0x5755de+_0x3188('0xc9')+_0x4a3d15+_0x3188('0xca')+_0x3188('0xcb'),'headers':{'Authorization':_0x3188('0xb2')+_0x42c678,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5f453e)[_0x3188('0x1e')](function(_0x398b06){var _0x5b8403=[];var _0x3865ca=_0x398b06[_0x3188('0xcc')][_0x3188('0xcd')];_0x3865ca['forEach'](function(_0x2be193){_0x5b8403[_0x3188('0xbf')]({'name':_0x2be193[_0x3188('0xce')][_0x3188('0xcf')][_0x3188('0xce')],'value':String(_0x2be193['Value'])});});var _0x3b0510={'id':_0x19c3cd+'_'+_0x398b06[_0x3188('0xba')],'name':_0x398b06['DisplayName'][_0x3188('0xcf')][_0x3188('0xce')],'custom':![],'options':_0x5b8403};_0x35a885['push'](_0x3b0510);return _0x35a885;});}function getBooleanList(_0x1d14fd,_0x43b185,_0x43815d,_0x4d70fa,_0x140105,_0x2ddf08){var _0xaa6779={'method':'GET','uri':_0x1d14fd+_0x3188('0xb6')+_0x4d70fa+')/Attributes('+_0x140105+_0x3188('0xd0'),'headers':{'Authorization':_0x3188('0xb2')+_0x2ddf08,'If-None-Match':null,'OData-Version':_0x3188('0xb3')},'json':!![]};return rp(_0xaa6779)[_0x3188('0x1e')](function(_0x235a3b){var _0x7a0fac=[];_0x7a0fac[_0x3188('0xbf')]({'name':_0x235a3b[_0x3188('0xcc')][_0x3188('0xd1')][_0x3188('0xce')][_0x3188('0xcf')][_0x3188('0xce')],'value':_0x3188('0xd2')},{'name':_0x235a3b[_0x3188('0xcc')]['FalseOption'][_0x3188('0xce')][_0x3188('0xcf')]['Label'],'value':_0x3188('0xd3')});var _0x2e872a={'id':_0x43b185+'_'+_0x235a3b['LogicalName'],'name':_0x235a3b['DisplayName'][_0x3188('0xcf')][_0x3188('0xce')],'custom':![],'options':_0x7a0fac};_0x43815d[_0x3188('0xbf')](_0x2e872a);return _0x43815d;});}function getInputList(_0x8607bf,_0x4a2d1f,_0x3b6a63,_0x746153,_0x485669,_0x3ced8c,_0x3ac617){var _0x5d4997={'method':_0x3188('0xb0'),'uri':_0x8607bf+_0x3188('0xb6')+_0x485669+')/Attributes('+_0x3ced8c+')/Microsoft.Dynamics.CRM.'+_0x3b6a63+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x3ac617,'If-None-Match':null,'OData-Version':_0x3188('0xb3')},'json':!![]};return rp(_0x5d4997)[_0x3188('0x1e')](function(_0x32481a){var _0x14d66e={'id':_0x4a2d1f+'_'+_0x32481a[_0x3188('0xba')],'name':_0x32481a[_0x3188('0xd4')]['UserLocalizedLabel']?_0x32481a[_0x3188('0xd4')]['UserLocalizedLabel'][_0x3188('0xce')]:_0x32481a[_0x3188('0xba')],'custom':![],'options':[]};_0x746153[_0x3188('0xbf')](_0x14d66e);return _0x746153;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 6c08da6..39b47c2 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 _0x4bbb=['Dynamics365Account','int_dynamics365_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports'];(function(_0x3fad45,_0x1a3c5a){var _0x17eb8c=function(_0x5f543b){while(--_0x5f543b){_0x3fad45['push'](_0x3fad45['shift']());}};_0x17eb8c(++_0x1a3c5a);}(_0x4bbb,0x106));var _0xb4bb=function(_0x2e7dcb,_0x41d6e1){_0x2e7dcb=_0x2e7dcb-0x0;var _0x3b4771=_0x4bbb[_0x2e7dcb];return _0x3b4771;};'use strict';var _=require(_0xb4bb('0x0'));var util=require(_0xb4bb('0x1'));var logger=require('../../config/logger')(_0xb4bb('0x2'));var moment=require(_0xb4bb('0x3'));var BPromise=require(_0xb4bb('0x4'));var rp=require(_0xb4bb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4bb('0x6'));var config=require(_0xb4bb('0x7'));var attributes=require(_0xb4bb('0x8'));var integrations=require(_0xb4bb('0x9'));module[_0xb4bb('0xa')]=function(_0x17f398,_0xf89d7e){return _0x17f398['define'](_0xb4bb('0xb'),attributes,{'tableName':_0xb4bb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2db=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x1ef1fa,_0x49a5ab){var _0x19d9a5=function(_0x13988b){while(--_0x13988b){_0x1ef1fa['push'](_0x1ef1fa['shift']());}};_0x19d9a5(++_0x49a5ab);}(_0xf2db,0x1ab));var _0xbf2d=function(_0xb7c1e5,_0x6d903e){_0xb7c1e5=_0xb7c1e5-0x0;var _0x3b72d5=_0xf2db[_0xb7c1e5];return _0x3b72d5;};'use strict';var _=require(_0xbf2d('0x0'));var util=require(_0xbf2d('0x1'));var logger=require(_0xbf2d('0x2'))(_0xbf2d('0x3'));var moment=require(_0xbf2d('0x4'));var BPromise=require(_0xbf2d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf2d('0x6'));var rimraf=require(_0xbf2d('0x7'));var config=require(_0xbf2d('0x8'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0xbf2d('0x9')]=function(_0x27bbd0,_0x454b11){return _0x27bbd0[_0xbf2d('0xa')](_0xbf2d('0xb'),attributes,{'tableName':_0xbf2d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 0abf9f3..6dbdf3b 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 _0x94ba=['client','http','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x3c6971,_0x2580ee){var _0x18622d=function(_0x5454ab){while(--_0x5454ab){_0x3c6971['push'](_0x3c6971['shift']());}};_0x18622d(++_0x2580ee);}(_0x94ba,0xbe));var _0xa94b=function(_0x29ccfc,_0x311422){_0x29ccfc=_0x29ccfc-0x0;var _0x4f919b=_0x94ba[_0x29ccfc];return _0x4f919b;};'use strict';var _=require(_0xa94b('0x0'));var util=require(_0xa94b('0x1'));var moment=require(_0xa94b('0x2'));var BPromise=require(_0xa94b('0x3'));var rs=require(_0xa94b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa94b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa94b('0x6'))(_0xa94b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa94b('0x8')][_0xa94b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x363129,_0x262c09,_0x54c158){return new BPromise(function(_0x41aca1,_0x2165ae){return client['request'](_0x363129,_0x54c158)['then'](function(_0x1aaa45){logger[_0xa94b('0xa')](_0xa94b('0xb'),_0x262c09,'request\x20sent');logger[_0xa94b('0xc')](_0xa94b('0xd'),_0x262c09,_0xa94b('0xe'),JSON[_0xa94b('0xf')](_0x1aaa45));if(_0x1aaa45[_0xa94b('0x10')]){if(_0x1aaa45[_0xa94b('0x10')]['code']===0x1f4){logger[_0xa94b('0x10')](_0xa94b('0xb'),_0x262c09,_0x1aaa45[_0xa94b('0x10')][_0xa94b('0x11')]);return _0x2165ae(_0x1aaa45[_0xa94b('0x10')][_0xa94b('0x11')]);}logger[_0xa94b('0x10')](_0xa94b('0xb'),_0x262c09,_0x1aaa45['error'][_0xa94b('0x11')]);return _0x41aca1(_0x1aaa45[_0xa94b('0x10')]['message']);}else{logger[_0xa94b('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x262c09,'request\x20sent');_0x41aca1(_0x1aaa45['result'][_0xa94b('0x11')]);}})[_0xa94b('0x12')](function(_0x401e69){logger[_0xa94b('0x10')](_0xa94b('0xb'),_0x262c09,_0x401e69);_0x2165ae(_0x401e69);});});}exports[_0xa94b('0x13')]=function(_0x37a08d){var _0x1b0e14=this;return new Promise(function(_0x34049f,_0x32406e){return db[_0xa94b('0x14')][_0xa94b('0x15')]({'raw':_0x37a08d[_0xa94b('0x16')]?_0x37a08d[_0xa94b('0x16')][_0xa94b('0x17')]===undefined?!![]:![]:!![],'where':_0x37a08d[_0xa94b('0x16')]?_0x37a08d[_0xa94b('0x16')][_0xa94b('0x18')]||null:null,'attributes':_0x37a08d[_0xa94b('0x16')]?_0x37a08d[_0xa94b('0x16')][_0xa94b('0x19')]||null:null,'limit':_0x37a08d['options']?_0x37a08d[_0xa94b('0x16')][_0xa94b('0x1a')]||null:null,'include':_0x37a08d[_0xa94b('0x16')]?_0x37a08d[_0xa94b('0x16')][_0xa94b('0x1b')]?_[_0xa94b('0x1c')](_0x37a08d[_0xa94b('0x16')]['include'],function(_0x426ded){return{'model':db[_0x426ded[_0xa94b('0x1d')]],'as':_0x426ded['as'],'attributes':_0x426ded[_0xa94b('0x19')],'include':_0x426ded[_0xa94b('0x1b')]?_[_0xa94b('0x1c')](_0x426ded[_0xa94b('0x1b')],function(_0x6aa3e1){return{'model':db[_0x6aa3e1[_0xa94b('0x1d')]],'as':_0x6aa3e1['as'],'attributes':_0x6aa3e1[_0xa94b('0x19')],'include':_0x6aa3e1['include']?_['map'](_0x6aa3e1[_0xa94b('0x1b')],function(_0x88d43f){return{'model':db[_0x88d43f[_0xa94b('0x1d')]],'as':_0x88d43f['as'],'attributes':_0x88d43f[_0xa94b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa94b('0x1e')](function(_0x439d96){logger[_0xa94b('0xa')]('GetDynamics365Account',_0x37a08d);logger['debug'](_0xa94b('0x13'),_0x37a08d,JSON['stringify'](_0x439d96));_0x34049f(_0x439d96);})[_0xa94b('0x12')](function(_0x475566){logger[_0xa94b('0x10')](_0xa94b('0x13'),_0x475566[_0xa94b('0x11')],_0x37a08d);_0x32406e(_0x1b0e14['error'](0x1f4,_0x475566[_0xa94b('0x11')]));});});};exports[_0xa94b('0x1f')]=function(_0x5783cf){var _0x38c9e2=this;return new Promise(function(_0x548b86,_0x173027){return db[_0xa94b('0x14')][_0xa94b('0x20')]({'raw':_0x5783cf[_0xa94b('0x16')]?_0x5783cf[_0xa94b('0x16')][_0xa94b('0x17')]===undefined?!![]:![]:!![],'where':_0x5783cf[_0xa94b('0x16')]?_0x5783cf[_0xa94b('0x16')][_0xa94b('0x18')]||null:null,'attributes':_0x5783cf[_0xa94b('0x16')]?_0x5783cf[_0xa94b('0x16')]['attributes']||null:null,'include':_0x5783cf[_0xa94b('0x16')]?_0x5783cf[_0xa94b('0x16')][_0xa94b('0x1b')]?_[_0xa94b('0x1c')](_0x5783cf[_0xa94b('0x16')][_0xa94b('0x1b')],function(_0xa6f4ca){return{'model':db[_0xa6f4ca[_0xa94b('0x1d')]],'as':_0xa6f4ca['as'],'attributes':_0xa6f4ca[_0xa94b('0x19')],'include':_0xa6f4ca[_0xa94b('0x1b')]?_[_0xa94b('0x1c')](_0xa6f4ca[_0xa94b('0x1b')],function(_0x324b1e){return{'model':db[_0x324b1e[_0xa94b('0x1d')]],'as':_0x324b1e['as'],'attributes':_0x324b1e[_0xa94b('0x19')],'include':_0x324b1e[_0xa94b('0x1b')]?_[_0xa94b('0x1c')](_0x324b1e['include'],function(_0x487d13){return{'model':db[_0x487d13[_0xa94b('0x1d')]],'as':_0x487d13['as'],'attributes':_0x487d13[_0xa94b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa94b('0x1e')](function(_0x557214){logger[_0xa94b('0xa')](_0xa94b('0x1f'),_0x5783cf);logger['debug'](_0xa94b('0x1f'),_0x5783cf,JSON[_0xa94b('0xf')](_0x557214));_0x548b86(_0x557214);})['catch'](function(_0x6ce53b){logger[_0xa94b('0x10')](_0xa94b('0x1f'),_0x6ce53b[_0xa94b('0x11')],_0x5783cf);_0x173027(_0x38c9e2[_0xa94b('0x10')](0x1f4,_0x6ce53b[_0xa94b('0x11')]));});});}; \ No newline at end of file +var _0x22e3=['code','Dynamics365Account,\x20%s,\x20%s','message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','model','map','debug','ShowDynamics365Account','find','where','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x22e3,0xf3));var _0x322e=function(_0x4153a8,_0x2a2ccc){_0x4153a8=_0x4153a8-0x0;var _0x30bdab=_0x22e3[_0x4153a8];return _0x30bdab;};'use strict';var _=require(_0x322e('0x0'));var util=require(_0x322e('0x1'));var moment=require(_0x322e('0x2'));var BPromise=require('bluebird');var rs=require(_0x322e('0x3'));var fs=require('fs');var Redis=require(_0x322e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x322e('0x5'));var logger=require(_0x322e('0x6'))(_0x322e('0x7'));var config=require(_0x322e('0x8'));var jayson=require(_0x322e('0x9'));var client=jayson['client'][_0x322e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b8360,_0xe2d09a,_0x2fcd6b){return new BPromise(function(_0xaba26c,_0x3cbb57){return client[_0x322e('0xb')](_0x2b8360,_0x2fcd6b)[_0x322e('0xc')](function(_0x32bfeb){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0xe2d09a,_0x322e('0xd'));logger['debug'](_0x322e('0xe'),_0xe2d09a,'request\x20sent',JSON['stringify'](_0x32bfeb));if(_0x32bfeb['error']){if(_0x32bfeb[_0x322e('0xf')][_0x322e('0x10')]===0x1f4){logger['error'](_0x322e('0x11'),_0xe2d09a,_0x32bfeb[_0x322e('0xf')][_0x322e('0x12')]);return _0x3cbb57(_0x32bfeb['error'][_0x322e('0x12')]);}logger[_0x322e('0xf')](_0x322e('0x11'),_0xe2d09a,_0x32bfeb[_0x322e('0xf')]['message']);return _0xaba26c(_0x32bfeb['error'][_0x322e('0x12')]);}else{logger[_0x322e('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0xe2d09a,_0x322e('0xd'));_0xaba26c(_0x32bfeb[_0x322e('0x14')][_0x322e('0x12')]);}})[_0x322e('0x15')](function(_0x119c2b){logger['error'](_0x322e('0x11'),_0xe2d09a,_0x119c2b);_0x3cbb57(_0x119c2b);});});}exports[_0x322e('0x16')]=function(_0x340f78){var _0x275e9d=this;return new Promise(function(_0x5042c6,_0x1ef52c){return db[_0x322e('0x17')][_0x322e('0x18')]({'raw':_0x340f78[_0x322e('0x19')]?_0x340f78[_0x322e('0x19')][_0x322e('0x1a')]===undefined?!![]:![]:!![],'where':_0x340f78[_0x322e('0x19')]?_0x340f78[_0x322e('0x19')]['where']||null:null,'attributes':_0x340f78[_0x322e('0x19')]?_0x340f78[_0x322e('0x19')][_0x322e('0x1b')]||null:null,'limit':_0x340f78[_0x322e('0x19')]?_0x340f78[_0x322e('0x19')][_0x322e('0x1c')]||null:null,'include':_0x340f78[_0x322e('0x19')]?_0x340f78[_0x322e('0x19')][_0x322e('0x1d')]?_['map'](_0x340f78[_0x322e('0x19')][_0x322e('0x1d')],function(_0x2d1678){return{'model':db[_0x2d1678[_0x322e('0x1e')]],'as':_0x2d1678['as'],'attributes':_0x2d1678['attributes'],'include':_0x2d1678[_0x322e('0x1d')]?_['map'](_0x2d1678['include'],function(_0x4db967){return{'model':db[_0x4db967[_0x322e('0x1e')]],'as':_0x4db967['as'],'attributes':_0x4db967[_0x322e('0x1b')],'include':_0x4db967['include']?_[_0x322e('0x1f')](_0x4db967[_0x322e('0x1d')],function(_0x5e1590){return{'model':db[_0x5e1590[_0x322e('0x1e')]],'as':_0x5e1590['as'],'attributes':_0x5e1590[_0x322e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x322e('0xc')](function(_0xc07823){logger[_0x322e('0x13')](_0x322e('0x16'),_0x340f78);logger[_0x322e('0x20')](_0x322e('0x16'),_0x340f78,JSON['stringify'](_0xc07823));_0x5042c6(_0xc07823);})[_0x322e('0x15')](function(_0x5d2e82){logger[_0x322e('0xf')](_0x322e('0x16'),_0x5d2e82[_0x322e('0x12')],_0x340f78);_0x1ef52c(_0x275e9d['error'](0x1f4,_0x5d2e82[_0x322e('0x12')]));});});};exports[_0x322e('0x21')]=function(_0x3ddd56){var _0x4fc652=this;return new Promise(function(_0x264b8d,_0x20b807){return db['Dynamics365Account'][_0x322e('0x22')]({'raw':_0x3ddd56['options']?_0x3ddd56['options'][_0x322e('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ddd56[_0x322e('0x19')]?_0x3ddd56[_0x322e('0x19')][_0x322e('0x23')]||null:null,'attributes':_0x3ddd56[_0x322e('0x19')]?_0x3ddd56['options'][_0x322e('0x1b')]||null:null,'include':_0x3ddd56[_0x322e('0x19')]?_0x3ddd56['options'][_0x322e('0x1d')]?_[_0x322e('0x1f')](_0x3ddd56[_0x322e('0x19')]['include'],function(_0x361dbd){return{'model':db[_0x361dbd['model']],'as':_0x361dbd['as'],'attributes':_0x361dbd[_0x322e('0x1b')],'include':_0x361dbd['include']?_[_0x322e('0x1f')](_0x361dbd[_0x322e('0x1d')],function(_0x52e2e0){return{'model':db[_0x52e2e0[_0x322e('0x1e')]],'as':_0x52e2e0['as'],'attributes':_0x52e2e0[_0x322e('0x1b')],'include':_0x52e2e0[_0x322e('0x1d')]?_[_0x322e('0x1f')](_0x52e2e0['include'],function(_0xf2152c){return{'model':db[_0xf2152c['model']],'as':_0xf2152c['as'],'attributes':_0xf2152c['attributes']};}):[]};}):[]};}):[]:[]})[_0x322e('0xc')](function(_0x40382c){logger[_0x322e('0x13')](_0x322e('0x21'),_0x3ddd56);logger[_0x322e('0x20')](_0x322e('0x21'),_0x3ddd56,JSON[_0x322e('0x24')](_0x40382c));_0x264b8d(_0x40382c);})['catch'](function(_0x3e5141){logger[_0x322e('0xf')](_0x322e('0x21'),_0x3e5141[_0x322e('0x12')],_0x3ddd56);_0x20b807(_0x4fc652['error'](0x1f4,_0x3e5141[_0x322e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 6250a81..54d68e3 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 _0x80dc=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id','show','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete'];(function(_0x1968e6,_0x160d99){var _0x5a4621=function(_0x35a361){while(--_0x35a361){_0x1968e6['push'](_0x1968e6['shift']());}};_0x5a4621(++_0x160d99);}(_0x80dc,0x79));var _0xc80d=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x80dc[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0xc80d('0x0'));var util=require(_0xc80d('0x1'));var path=require(_0xc80d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc80d('0x3')]();var auth=require(_0xc80d('0x4'));var interaction=require(_0xc80d('0x5'));var config=require(_0xc80d('0x6'));var controller=require(_0xc80d('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc80d('0x8')](_0xc80d('0x9'),auth['isAuthenticated'](),controller[_0xc80d('0xa')]);router[_0xc80d('0x8')]('/:id/fields',auth[_0xc80d('0xb')](),controller['getFields']);router[_0xc80d('0x8')](_0xc80d('0xc'),auth['isAuthenticated'](),controller[_0xc80d('0xd')]);router[_0xc80d('0x8')](_0xc80d('0xe'),auth['isAuthenticated'](),controller[_0xc80d('0xf')]);router[_0xc80d('0x10')]('/',auth['isAuthenticated'](),controller[_0xc80d('0x11')]);router['put'](_0xc80d('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xc80d('0x12')](_0xc80d('0x9'),auth[_0xc80d('0xb')](),controller['destroy']);module[_0xc80d('0x13')]=router; \ No newline at end of file +var _0xc056=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x50ee83,_0x106751){var _0x3099ea=function(_0x1d38a4){while(--_0x1d38a4){_0x50ee83['push'](_0x50ee83['shift']());}};_0x3099ea(++_0x106751);}(_0xc056,0x156));var _0x6c05=function(_0x1f931b,_0x262c44){_0x1f931b=_0x1f931b-0x0;var _0xf9d8da=_0xc056[_0x1f931b];return _0xf9d8da;};'use strict';var multer=require(_0x6c05('0x0'));var util=require(_0x6c05('0x1'));var path=require(_0x6c05('0x2'));var timeout=require(_0x6c05('0x3'));var express=require('express');var router=express[_0x6c05('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6c05('0x5'));var config=require('../../config/environment');var controller=require(_0x6c05('0x6'));router[_0x6c05('0x7')]('/',auth[_0x6c05('0x8')](),controller[_0x6c05('0x9')]);router['get'](_0x6c05('0xa'),auth[_0x6c05('0x8')](),controller[_0x6c05('0xb')]);router[_0x6c05('0x7')](_0x6c05('0xc'),auth[_0x6c05('0x8')](),controller[_0x6c05('0xd')]);router[_0x6c05('0x7')](_0x6c05('0xe'),auth['isAuthenticated'](),controller[_0x6c05('0xf')]);router[_0x6c05('0x7')](_0x6c05('0x10'),auth[_0x6c05('0x8')](),controller[_0x6c05('0x11')]);router[_0x6c05('0x12')]('/',auth['isAuthenticated'](),controller[_0x6c05('0x13')]);router['put'](_0x6c05('0xa'),auth[_0x6c05('0x8')](),controller[_0x6c05('0x14')]);router['delete']('/:id',auth[_0x6c05('0x8')](),controller['destroy']);module[_0x6c05('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 88a2de3..46e04f8 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 _0x79a4=['incident','phonecall','sequelize','exports','STRING'];(function(_0x1f4de7,_0x564f4e){var _0x3eca15=function(_0x10bb54){while(--_0x10bb54){_0x1f4de7['push'](_0x1f4de7['shift']());}};_0x3eca15(++_0x564f4e);}(_0x79a4,0xd4));var _0x479a=function(_0x4ac335,_0x23f63f){_0x4ac335=_0x4ac335-0x0;var _0x132044=_0x79a4[_0x4ac335];return _0x132044;};'use strict';var Sequelize=require(_0x479a('0x0'));module[_0x479a('0x1')]={'name':{'type':Sequelize[_0x479a('0x2')]},'description':{'type':Sequelize[_0x479a('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x479a('0x3'),_0x479a('0x4')),'defaultValue':'incident'}}; \ No newline at end of file +var _0xd84a=['exports','STRING','ENUM','incident','phonecall','sequelize'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xd84a,0x65));var _0xad84=function(_0x233f3a,_0x302d42){_0x233f3a=_0x233f3a-0x0;var _0x2346da=_0xd84a[_0x233f3a];return _0x2346da;};'use strict';var Sequelize=require(_0xad84('0x0'));module[_0xad84('0x1')]={'name':{'type':Sequelize[_0xad84('0x2')]},'description':{'type':Sequelize[_0xad84('0x2')]},'ticketType':{'type':Sequelize[_0xad84('0x3')](_0xad84('0x4'),_0xad84('0x5')),'defaultValue':_0xad84('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 3fb91a0..ad3e458 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 _0x8d21=['sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','create','body','find','destroy','getFields','findOne','Dynamics365Field','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','apply','stack','name','send','map','Dynamics365Configuration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order'];(function(_0x474492,_0x254e12){var _0x44480b=function(_0x107839){while(--_0x107839){_0x474492['push'](_0x474492['shift']());}};_0x44480b(++_0x254e12);}(_0x8d21,0x16c));var _0x18d2=function(_0x46e2d1,_0x1ac94e){_0x46e2d1=_0x46e2d1-0x0;var _0x1e9b91=_0x8d21[_0x46e2d1];return _0x1e9b91;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x18d2('0x0'));var rimraf=require(_0x18d2('0x1'));var zipdir=require(_0x18d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18d2('0x3'));var moment=require(_0x18d2('0x4'));var BPromise=require(_0x18d2('0x5'));var Mustache=require(_0x18d2('0x6'));var util=require(_0x18d2('0x7'));var path=require(_0x18d2('0x8'));var sox=require('sox');var csv=require(_0x18d2('0x9'));var ejs=require(_0x18d2('0xa'));var fs=require('fs');var _=require(_0x18d2('0xb'));var squel=require(_0x18d2('0xc'));var crypto=require(_0x18d2('0xd'));var jsforce=require(_0x18d2('0xe'));var deskjs=require(_0x18d2('0xf'));var toCsv=require(_0x18d2('0x9'));var querystring=require('querystring');var Papa=require(_0x18d2('0x10'));var Redis=require(_0x18d2('0x11'));var authService=require(_0x18d2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x18d2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18d2('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x18d2('0x15'));var db=require(_0x18d2('0x16'))['db'];var jayson=require(_0x18d2('0x17'));var client=jayson[_0x18d2('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x182082,_0x18fe89,_0x50eea1,_0x49a94a){return new BPromise(function(_0x4ac885,_0x154f7a){var _0x21c8ab=_0x49a94a||client;return _0x21c8ab['request'](_0x182082,_0x50eea1)[_0x18d2('0x19')](function(_0xcf2e4f){logger[_0x18d2('0x1a')](_0x18d2('0x1b'),_0x18fe89,_0x18d2('0x1c'));logger[_0x18d2('0x1d')](_0x18d2('0x1e'),_0x18fe89,_0x18d2('0x1c'),JSON[_0x18d2('0x1f')](_0xcf2e4f));if(_0xcf2e4f['error']){if(_0xcf2e4f[_0x18d2('0x20')][_0x18d2('0x21')]===0x1f4){logger[_0x18d2('0x20')](_0x18d2('0x1b'),_0x18fe89,_0xcf2e4f[_0x18d2('0x20')][_0x18d2('0x22')]);return _0x154f7a(_0xcf2e4f[_0x18d2('0x20')][_0x18d2('0x22')]);}logger[_0x18d2('0x20')](_0x18d2('0x1b'),_0x18fe89,_0xcf2e4f[_0x18d2('0x20')][_0x18d2('0x22')]);return _0x4ac885(_0xcf2e4f[_0x18d2('0x20')][_0x18d2('0x22')]);}else{logger[_0x18d2('0x1a')](_0x18d2('0x1b'),_0x18fe89,'request\x20sent');_0x4ac885(_0xcf2e4f['result']['message']);}})[_0x18d2('0x23')](function(_0x976f92){logger[_0x18d2('0x20')](_0x18d2('0x1b'),_0x18fe89,_0x976f92);_0x154f7a(_0x976f92);});});}function respondWithStatusCode(_0x4a4ed3,_0x560204){_0x560204=_0x560204||0xcc;return function(_0x478059){if(_0x478059){return _0x4a4ed3[_0x18d2('0x24')](_0x560204);}return _0x4a4ed3[_0x18d2('0x25')](_0x560204)[_0x18d2('0x26')]();};}function respondWithResult(_0x3e5dea,_0xf9aa9a){_0xf9aa9a=_0xf9aa9a||0xc8;return function(_0x395121){if(_0x395121){return _0x3e5dea[_0x18d2('0x25')](_0xf9aa9a)[_0x18d2('0x27')](_0x395121);}};}function respondWithFilteredResult(_0x1fdce3,_0xa04925){return function(_0x184d53){if(_0x184d53){var _0x387eba=_0x184d53['count'],_0xb75bb=_0xa04925['offset'],_0x417375=_0xa04925[_0x18d2('0x28')]+_0xa04925['limit'],_0xc0fd73;if(_0x417375>=_0x387eba){_0x417375=_0x387eba;_0xc0fd73=0xc8;}else{_0xc0fd73=0xce;}_0x1fdce3[_0x18d2('0x25')](_0xc0fd73);return _0x1fdce3['set']('Content-Range',_0xb75bb+'-'+_0x417375+'/'+_0x387eba)[_0x18d2('0x27')](_0x184d53);}return null;};}function patchUpdates(_0x20abf9){return function(_0x5bfe9e){try{jsonpatch[_0x18d2('0x29')](_0x5bfe9e,_0x20abf9,!![]);}catch(_0x21e21d){return BPromise['reject'](_0x21e21d);}return _0x5bfe9e['save']();};}function saveUpdates(_0x5e6ed2,_0x128fc7){return function(_0x5496fe){if(_0x5496fe){return _0x5496fe['update'](_0x5e6ed2)[_0x18d2('0x19')](function(_0x5407e1){return _0x5407e1;});}return null;};}function removeEntity(_0x437638,_0xdf404a){return function(_0x2bda13){if(_0x2bda13){return _0x2bda13['destroy']()['then'](function(){_0x437638['status'](0xcc)[_0x18d2('0x26')]();});}};}function handleEntityNotFound(_0x8cb022,_0x544298){return function(_0x159b1e){if(!_0x159b1e){_0x8cb022[_0x18d2('0x24')](0x194);}return _0x159b1e;};}function handleError(_0x236da9,_0x15f3e8){_0x15f3e8=_0x15f3e8||0x1f4;return function(_0x1c9e7e){logger[_0x18d2('0x20')](_0x1c9e7e[_0x18d2('0x2a')]);if(_0x1c9e7e[_0x18d2('0x2b')]){delete _0x1c9e7e[_0x18d2('0x2b')];}_0x236da9[_0x18d2('0x25')](_0x15f3e8)[_0x18d2('0x2c')](_0x1c9e7e);};}exports['index']=function(_0xcf545d,_0x5cfa0c){var _0x5bc6f2={},_0x4c57a1={},_0x2517f6={'count':0x0,'rows':[]};var _0x24fd30=_[_0x18d2('0x2d')](db[_0x18d2('0x2e')][_0x18d2('0x2f')],function(_0x5d36c4){return{'name':_0x5d36c4['fieldName'],'type':_0x5d36c4[_0x18d2('0x30')][_0x18d2('0x31')]};});_0x4c57a1[_0x18d2('0x32')]=_['map'](_0x24fd30,'name');_0x4c57a1[_0x18d2('0x33')]=_[_0x18d2('0x34')](_0xcf545d[_0x18d2('0x33')]);_0x4c57a1[_0x18d2('0x35')]=_[_0x18d2('0x36')](_0x4c57a1[_0x18d2('0x32')],_0x4c57a1[_0x18d2('0x33')]);_0x5bc6f2['attributes']=_[_0x18d2('0x36')](_0x4c57a1[_0x18d2('0x32')],qs[_0x18d2('0x37')](_0xcf545d['query'][_0x18d2('0x37')]));_0x5bc6f2[_0x18d2('0x38')]=_0x5bc6f2[_0x18d2('0x38')][_0x18d2('0x39')]?_0x5bc6f2[_0x18d2('0x38')]:_0x4c57a1[_0x18d2('0x32')];if(!_0xcf545d['query']['hasOwnProperty'](_0x18d2('0x3a'))){_0x5bc6f2['limit']=qs[_0x18d2('0x3b')](_0xcf545d[_0x18d2('0x33')][_0x18d2('0x3b')]);_0x5bc6f2[_0x18d2('0x28')]=qs[_0x18d2('0x28')](_0xcf545d['query'][_0x18d2('0x28')]);}_0x5bc6f2[_0x18d2('0x3c')]=qs[_0x18d2('0x3d')](_0xcf545d[_0x18d2('0x33')][_0x18d2('0x3d')]);_0x5bc6f2[_0x18d2('0x3e')]=qs['filters'](_[_0x18d2('0x3f')](_0xcf545d[_0x18d2('0x33')],_0x4c57a1[_0x18d2('0x35')]),_0x24fd30);if(_0xcf545d['query'][_0x18d2('0x40')]){_0x5bc6f2[_0x18d2('0x3e')]=_[_0x18d2('0x41')](_0x5bc6f2[_0x18d2('0x3e')],{'$or':_['map'](_0x24fd30,function(_0x40739a){if(_0x40739a['type']!==_0x18d2('0x42')){var _0x322def={};_0x322def[_0x40739a['name']]={'$like':'%'+_0xcf545d[_0x18d2('0x33')]['filter']+'%'};return _0x322def;}})});}_0x5bc6f2=_['merge']({},_0x5bc6f2,_0xcf545d[_0x18d2('0x43')]);var _0x4d60a6={'where':_0x5bc6f2[_0x18d2('0x3e')]};return db[_0x18d2('0x2e')][_0x18d2('0x44')](_0x4d60a6)[_0x18d2('0x19')](function(_0x4eba10){_0x2517f6['count']=_0x4eba10;if(_0xcf545d[_0x18d2('0x33')][_0x18d2('0x45')]){_0x5bc6f2[_0x18d2('0x46')]=[{'all':!![]}];}return db[_0x18d2('0x2e')][_0x18d2('0x47')](_0x5bc6f2);})[_0x18d2('0x19')](function(_0xfa371e){_0x2517f6[_0x18d2('0x48')]=_0xfa371e;return _0x2517f6;})[_0x18d2('0x19')](respondWithFilteredResult(_0x5cfa0c,_0x5bc6f2))[_0x18d2('0x23')](handleError(_0x5cfa0c,null));};exports[_0x18d2('0x49')]=function(_0xeda433,_0x105892){var _0x459984={'raw':![],'where':{'id':_0xeda433[_0x18d2('0x4a')]['id']}},_0x1c8d19={};_0x1c8d19[_0x18d2('0x32')]=_['keys'](db[_0x18d2('0x2e')]['rawAttributes']);_0x1c8d19[_0x18d2('0x33')]=_[_0x18d2('0x34')](_0xeda433[_0x18d2('0x33')]);_0x1c8d19[_0x18d2('0x35')]=_['intersection'](_0x1c8d19[_0x18d2('0x32')],_0x1c8d19['query']);_0x459984[_0x18d2('0x38')]=_[_0x18d2('0x36')](_0x1c8d19[_0x18d2('0x32')],qs[_0x18d2('0x37')](_0xeda433[_0x18d2('0x33')]['fields']));_0x459984[_0x18d2('0x38')]=_0x459984[_0x18d2('0x38')]['length']?_0x459984[_0x18d2('0x38')]:_0x1c8d19[_0x18d2('0x32')];if(_0xeda433[_0x18d2('0x33')][_0x18d2('0x45')]){_0x459984['include']=[{'all':!![]}];}_0x459984=_[_0x18d2('0x41')]({},_0x459984,_0xeda433[_0x18d2('0x43')]);return db[_0x18d2('0x2e')]['find'](_0x459984)['then'](handleEntityNotFound(_0x105892,null))[_0x18d2('0x19')](respondWithResult(_0x105892,null))[_0x18d2('0x23')](handleError(_0x105892,null));};exports[_0x18d2('0x4b')]=function(_0x25834d,_0x2b249b){return db[_0x18d2('0x2e')][_0x18d2('0x4b')](_0x25834d[_0x18d2('0x4c')],{})[_0x18d2('0x19')](respondWithResult(_0x2b249b,0xc9))['catch'](handleError(_0x2b249b,null));};exports['update']=function(_0x59bc60,_0x2d82ba){if(_0x59bc60[_0x18d2('0x4c')]['id']){delete _0x59bc60[_0x18d2('0x4c')]['id'];}return db['Dynamics365Configuration'][_0x18d2('0x4d')]({'where':{'id':_0x59bc60[_0x18d2('0x4a')]['id']}})[_0x18d2('0x19')](handleEntityNotFound(_0x2d82ba,null))['then'](saveUpdates(_0x59bc60[_0x18d2('0x4c')],null))[_0x18d2('0x19')](respondWithResult(_0x2d82ba,null))[_0x18d2('0x23')](handleError(_0x2d82ba,null));};exports[_0x18d2('0x4e')]=function(_0x47e761,_0x409186){return db[_0x18d2('0x2e')][_0x18d2('0x4d')]({'where':{'id':_0x47e761['params']['id']}})['then'](handleEntityNotFound(_0x409186,null))[_0x18d2('0x19')](removeEntity(_0x409186,null))[_0x18d2('0x23')](handleError(_0x409186,null));};exports[_0x18d2('0x4f')]=function(_0x44afd,_0xd65d4d,_0x447980){var _0x2dbc0c={};var _0x3405de={};var _0x14df6e;var _0x50d576;return db['Dynamics365Configuration'][_0x18d2('0x50')]({'where':{'id':_0x44afd[_0x18d2('0x4a')]['id']}})[_0x18d2('0x19')](handleEntityNotFound(_0xd65d4d,null))[_0x18d2('0x19')](function(_0x1139fe){if(_0x1139fe){_0x14df6e=_0x1139fe;_0x3405de['model']=_[_0x18d2('0x34')](db[_0x18d2('0x51')]['rawAttributes']);_0x3405de['query']=_[_0x18d2('0x34')](_0x44afd[_0x18d2('0x33')]);_0x3405de[_0x18d2('0x35')]=_[_0x18d2('0x36')](_0x3405de[_0x18d2('0x32')],_0x3405de[_0x18d2('0x33')]);_0x2dbc0c['attributes']=_[_0x18d2('0x36')](_0x3405de[_0x18d2('0x32')],qs['fields'](_0x44afd[_0x18d2('0x33')]['fields']));_0x2dbc0c['attributes']=_0x2dbc0c[_0x18d2('0x38')][_0x18d2('0x39')]?_0x2dbc0c['attributes']:_0x3405de['model'];_0x2dbc0c[_0x18d2('0x3c')]=qs[_0x18d2('0x3d')](_0x44afd[_0x18d2('0x33')][_0x18d2('0x3d')]);_0x2dbc0c[_0x18d2('0x3e')]=qs['filters'](_[_0x18d2('0x3f')](_0x44afd[_0x18d2('0x33')],_0x3405de[_0x18d2('0x35')]));if(_0x44afd[_0x18d2('0x33')]['filter']){_0x2dbc0c[_0x18d2('0x3e')]=_[_0x18d2('0x41')](_0x2dbc0c[_0x18d2('0x3e')],{'$or':_['map'](_0x2dbc0c[_0x18d2('0x38')],function(_0xeb1e92){var _0x2b3b07={};_0x2b3b07[_0xeb1e92]={'$like':'%'+_0x44afd[_0x18d2('0x33')][_0x18d2('0x40')]+'%'};return _0x2b3b07;})});}_0x2dbc0c=_['merge']({},_0x2dbc0c,_0x44afd[_0x18d2('0x43')]);return _0x14df6e[_0x18d2('0x4f')](_0x2dbc0c);}})[_0x18d2('0x19')](function(_0x28a5b4){if(_0x28a5b4){_0x50d576=_0x28a5b4[_0x18d2('0x39')];if(!_0x44afd['query'][_0x18d2('0x52')](_0x18d2('0x3a'))){_0x2dbc0c[_0x18d2('0x3b')]=qs[_0x18d2('0x3b')](_0x44afd[_0x18d2('0x33')]['limit']);_0x2dbc0c[_0x18d2('0x28')]=qs['offset'](_0x44afd['query']['offset']);}return _0x14df6e[_0x18d2('0x4f')](_0x2dbc0c);}})['then'](function(_0x544774){if(_0x544774){return _0x544774?{'count':_0x50d576,'rows':_0x544774}:null;}})['then'](respondWithResult(_0xd65d4d,null))[_0x18d2('0x23')](handleError(_0xd65d4d,null));};exports[_0x18d2('0x53')]=function(_0x5c275e,_0x4edf1e,_0x562bd0){var _0x1b1b7c={};var _0x5734e9={};var _0x3a638c;var _0x985e17;return db[_0x18d2('0x2e')][_0x18d2('0x50')]({'where':{'id':_0x5c275e[_0x18d2('0x4a')]['id']}})[_0x18d2('0x19')](handleEntityNotFound(_0x4edf1e,null))[_0x18d2('0x19')](function(_0x71e5cb){if(_0x71e5cb){_0x3a638c=_0x71e5cb;_0x5734e9['model']=_[_0x18d2('0x34')](db['Dynamics365Field'][_0x18d2('0x2f')]);_0x5734e9[_0x18d2('0x33')]=_[_0x18d2('0x34')](_0x5c275e[_0x18d2('0x33')]);_0x5734e9[_0x18d2('0x35')]=_[_0x18d2('0x36')](_0x5734e9[_0x18d2('0x32')],_0x5734e9[_0x18d2('0x33')]);_0x1b1b7c[_0x18d2('0x38')]=_[_0x18d2('0x36')](_0x5734e9['model'],qs[_0x18d2('0x37')](_0x5c275e[_0x18d2('0x33')][_0x18d2('0x37')]));_0x1b1b7c[_0x18d2('0x38')]=_0x1b1b7c[_0x18d2('0x38')]['length']?_0x1b1b7c[_0x18d2('0x38')]:_0x5734e9['model'];_0x1b1b7c[_0x18d2('0x3c')]=qs[_0x18d2('0x3d')](_0x5c275e['query']['sort']);_0x1b1b7c['where']=qs[_0x18d2('0x35')](_[_0x18d2('0x3f')](_0x5c275e['query'],_0x5734e9[_0x18d2('0x35')]));if(_0x5c275e[_0x18d2('0x33')][_0x18d2('0x40')]){_0x1b1b7c[_0x18d2('0x3e')]=_[_0x18d2('0x41')](_0x1b1b7c[_0x18d2('0x3e')],{'$or':_[_0x18d2('0x2d')](_0x1b1b7c[_0x18d2('0x38')],function(_0x50be6c){var _0x23af9c={};_0x23af9c[_0x50be6c]={'$like':'%'+_0x5c275e[_0x18d2('0x33')]['filter']+'%'};return _0x23af9c;})});}_0x1b1b7c=_[_0x18d2('0x41')]({},_0x1b1b7c,_0x5c275e[_0x18d2('0x43')]);return _0x3a638c['getSubjects'](_0x1b1b7c);}})['then'](function(_0x41ba8c){if(_0x41ba8c){_0x985e17=_0x41ba8c[_0x18d2('0x39')];if(!_0x5c275e['query']['hasOwnProperty'](_0x18d2('0x3a'))){_0x1b1b7c[_0x18d2('0x3b')]=qs['limit'](_0x5c275e[_0x18d2('0x33')][_0x18d2('0x3b')]);_0x1b1b7c[_0x18d2('0x28')]=qs[_0x18d2('0x28')](_0x5c275e[_0x18d2('0x33')][_0x18d2('0x28')]);}return _0x3a638c[_0x18d2('0x53')](_0x1b1b7c);}})['then'](function(_0x13a8d5){if(_0x13a8d5){return _0x13a8d5?{'count':_0x985e17,'rows':_0x13a8d5}:null;}})[_0x18d2('0x19')](respondWithResult(_0x4edf1e,null))[_0x18d2('0x23')](handleError(_0x4edf1e,null));};exports[_0x18d2('0x54')]=function(_0x5ab63d,_0x103532,_0x2831b9){var _0xf217d4={};var _0x4110a2={};var _0x201629;var _0x4fa92a;return db[_0x18d2('0x2e')][_0x18d2('0x50')]({'where':{'id':_0x5ab63d[_0x18d2('0x4a')]['id']}})[_0x18d2('0x19')](handleEntityNotFound(_0x103532,null))[_0x18d2('0x19')](function(_0x464a3a){if(_0x464a3a){_0x201629=_0x464a3a;_0x4110a2[_0x18d2('0x32')]=_['keys'](db[_0x18d2('0x51')][_0x18d2('0x2f')]);_0x4110a2['query']=_['keys'](_0x5ab63d[_0x18d2('0x33')]);_0x4110a2[_0x18d2('0x35')]=_[_0x18d2('0x36')](_0x4110a2[_0x18d2('0x32')],_0x4110a2[_0x18d2('0x33')]);_0xf217d4[_0x18d2('0x38')]=_[_0x18d2('0x36')](_0x4110a2[_0x18d2('0x32')],qs[_0x18d2('0x37')](_0x5ab63d[_0x18d2('0x33')]['fields']));_0xf217d4['attributes']=_0xf217d4[_0x18d2('0x38')]['length']?_0xf217d4['attributes']:_0x4110a2[_0x18d2('0x32')];_0xf217d4['order']=qs['sort'](_0x5ab63d[_0x18d2('0x33')]['sort']);_0xf217d4[_0x18d2('0x3e')]=qs['filters'](_[_0x18d2('0x3f')](_0x5ab63d[_0x18d2('0x33')],_0x4110a2['filters']));if(_0x5ab63d[_0x18d2('0x33')][_0x18d2('0x40')]){_0xf217d4[_0x18d2('0x3e')]=_[_0x18d2('0x41')](_0xf217d4[_0x18d2('0x3e')],{'$or':_[_0x18d2('0x2d')](_0xf217d4[_0x18d2('0x38')],function(_0x46ad05){var _0x387c41={};_0x387c41[_0x46ad05]={'$like':'%'+_0x5ab63d['query'][_0x18d2('0x40')]+'%'};return _0x387c41;})});}_0xf217d4=_[_0x18d2('0x41')]({},_0xf217d4,_0x5ab63d[_0x18d2('0x43')]);return _0x201629[_0x18d2('0x54')](_0xf217d4);}})[_0x18d2('0x19')](function(_0x1bfbce){if(_0x1bfbce){_0x4fa92a=_0x1bfbce[_0x18d2('0x39')];if(!_0x5ab63d[_0x18d2('0x33')][_0x18d2('0x52')](_0x18d2('0x3a'))){_0xf217d4['limit']=qs['limit'](_0x5ab63d[_0x18d2('0x33')][_0x18d2('0x3b')]);_0xf217d4[_0x18d2('0x28')]=qs['offset'](_0x5ab63d[_0x18d2('0x33')][_0x18d2('0x28')]);}return _0x201629['getDescriptions'](_0xf217d4);}})[_0x18d2('0x19')](function(_0x14cffb){if(_0x14cffb){return _0x14cffb?{'count':_0x4fa92a,'rows':_0x14cffb}:null;}})[_0x18d2('0x19')](respondWithResult(_0x103532,null))[_0x18d2('0x23')](handleError(_0x103532,null));}; \ No newline at end of file +var _0x3af6=['offset','limit','apply','reject','update','destroy','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','Dynamics365Configuration','findAll','show','params','find','create','body','findOne','order','getFields','hasOwnProperty','Dynamics365Field','getSubjects','getDescriptions','eml-format','request-promise','moment','bluebird','util','path','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/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','catch','sendStatus','status','count'];(function(_0x21c0f9,_0x44bea7){var _0x5d6205=function(_0x3d16af){while(--_0x3d16af){_0x21c0f9['push'](_0x21c0f9['shift']());}};_0x5d6205(++_0x44bea7);}(_0x3af6,0x17c));var _0x63af=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3af6[_0x432682];return _0x463d05;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x63af('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x63af('0x1'));var moment=require(_0x63af('0x2'));var BPromise=require(_0x63af('0x3'));var Mustache=require('mustache');var util=require(_0x63af('0x4'));var path=require(_0x63af('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x63af('0x6'));var squel=require('squel');var crypto=require(_0x63af('0x7'));var jsforce=require(_0x63af('0x8'));var deskjs=require(_0x63af('0x9'));var toCsv=require(_0x63af('0xa'));var querystring=require(_0x63af('0xb'));var Papa=require(_0x63af('0xc'));var Redis=require(_0x63af('0xd'));var authService=require(_0x63af('0xe'));var qs=require(_0x63af('0xf'));var as=require(_0x63af('0x10'));var hardwareService=require(_0x63af('0x11'));var logger=require(_0x63af('0x12'))(_0x63af('0x13'));var utils=require(_0x63af('0x14'));var config=require(_0x63af('0x15'));var licenseUtil=require(_0x63af('0x16'));var db=require(_0x63af('0x17'))['db'];var jayson=require(_0x63af('0x18'));var client=jayson[_0x63af('0x19')][_0x63af('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x8a0be6,_0x1fd374,_0x1f31cb,_0x5a6663){return new BPromise(function(_0x5aad16,_0x413d8a){var _0x55a7da=_0x5a6663||client;return _0x55a7da[_0x63af('0x1b')](_0x8a0be6,_0x1f31cb)[_0x63af('0x1c')](function(_0x40cee2){logger[_0x63af('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1fd374,_0x63af('0x1e'));logger[_0x63af('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1fd374,_0x63af('0x1e'),JSON['stringify'](_0x40cee2));if(_0x40cee2['error']){if(_0x40cee2[_0x63af('0x20')][_0x63af('0x21')]===0x1f4){logger[_0x63af('0x20')](_0x63af('0x22'),_0x1fd374,_0x40cee2[_0x63af('0x20')][_0x63af('0x23')]);return _0x413d8a(_0x40cee2[_0x63af('0x20')][_0x63af('0x23')]);}logger[_0x63af('0x20')](_0x63af('0x22'),_0x1fd374,_0x40cee2['error'][_0x63af('0x23')]);return _0x5aad16(_0x40cee2[_0x63af('0x20')][_0x63af('0x23')]);}else{logger['info'](_0x63af('0x22'),_0x1fd374,_0x63af('0x1e'));_0x5aad16(_0x40cee2['result']['message']);}})[_0x63af('0x24')](function(_0x37bc57){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1fd374,_0x37bc57);_0x413d8a(_0x37bc57);});});}function respondWithStatusCode(_0xd34ad5,_0x52d3d9){_0x52d3d9=_0x52d3d9||0xcc;return function(_0xb15d1b){if(_0xb15d1b){return _0xd34ad5[_0x63af('0x25')](_0x52d3d9);}return _0xd34ad5[_0x63af('0x26')](_0x52d3d9)['end']();};}function respondWithResult(_0x513f75,_0x85c5fc){_0x85c5fc=_0x85c5fc||0xc8;return function(_0x3352b1){if(_0x3352b1){return _0x513f75[_0x63af('0x26')](_0x85c5fc)['json'](_0x3352b1);}};}function respondWithFilteredResult(_0x3513ef,_0x1ab6d6){return function(_0x4b1db2){if(_0x4b1db2){var _0x59cd7e=_0x4b1db2[_0x63af('0x27')],_0x118922=_0x1ab6d6[_0x63af('0x28')],_0x5aa932=_0x1ab6d6[_0x63af('0x28')]+_0x1ab6d6[_0x63af('0x29')],_0x4e8f3e;if(_0x5aa932>=_0x59cd7e){_0x5aa932=_0x59cd7e;_0x4e8f3e=0xc8;}else{_0x4e8f3e=0xce;}_0x3513ef[_0x63af('0x26')](_0x4e8f3e);return _0x3513ef['set']('Content-Range',_0x118922+'-'+_0x5aa932+'/'+_0x59cd7e)['json'](_0x4b1db2);}return null;};}function patchUpdates(_0x4113af){return function(_0x255920){try{jsonpatch[_0x63af('0x2a')](_0x255920,_0x4113af,!![]);}catch(_0xd45c3b){return BPromise[_0x63af('0x2b')](_0xd45c3b);}return _0x255920['save']();};}function saveUpdates(_0xeeb6cb,_0x565b09){return function(_0x6b70b0){if(_0x6b70b0){return _0x6b70b0[_0x63af('0x2c')](_0xeeb6cb)[_0x63af('0x1c')](function(_0x496e5a){return _0x496e5a;});}return null;};}function removeEntity(_0x2dacb2,_0x1929f6){return function(_0x4efab9){if(_0x4efab9){return _0x4efab9[_0x63af('0x2d')]()[_0x63af('0x1c')](function(){_0x2dacb2[_0x63af('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x295f24,_0x30723a){return function(_0x35ad2c){if(!_0x35ad2c){_0x295f24[_0x63af('0x25')](0x194);}return _0x35ad2c;};}function handleError(_0x248217,_0x5899bc){_0x5899bc=_0x5899bc||0x1f4;return function(_0xbba4c4){logger[_0x63af('0x20')](_0xbba4c4['stack']);if(_0xbba4c4['name']){delete _0xbba4c4[_0x63af('0x2e')];}_0x248217[_0x63af('0x26')](_0x5899bc)['send'](_0xbba4c4);};}exports[_0x63af('0x2f')]=function(_0x104720,_0x319052){var _0x156bbd={},_0x872e0={},_0x29c6f0={'count':0x0,'rows':[]};var _0x25f0bc=_[_0x63af('0x30')](db['Dynamics365Configuration'][_0x63af('0x31')],function(_0x469750){return{'name':_0x469750[_0x63af('0x32')],'type':_0x469750[_0x63af('0x33')][_0x63af('0x34')]};});_0x872e0[_0x63af('0x35')]=_['map'](_0x25f0bc,_0x63af('0x2e'));_0x872e0[_0x63af('0x36')]=_[_0x63af('0x37')](_0x104720['query']);_0x872e0[_0x63af('0x38')]=_['intersection'](_0x872e0[_0x63af('0x35')],_0x872e0[_0x63af('0x36')]);_0x156bbd[_0x63af('0x39')]=_[_0x63af('0x3a')](_0x872e0[_0x63af('0x35')],qs[_0x63af('0x3b')](_0x104720[_0x63af('0x36')][_0x63af('0x3b')]));_0x156bbd[_0x63af('0x39')]=_0x156bbd[_0x63af('0x39')][_0x63af('0x3c')]?_0x156bbd[_0x63af('0x39')]:_0x872e0[_0x63af('0x35')];if(!_0x104720[_0x63af('0x36')]['hasOwnProperty'](_0x63af('0x3d'))){_0x156bbd[_0x63af('0x29')]=qs['limit'](_0x104720[_0x63af('0x36')][_0x63af('0x29')]);_0x156bbd['offset']=qs['offset'](_0x104720['query'][_0x63af('0x28')]);}_0x156bbd['order']=qs[_0x63af('0x3e')](_0x104720['query']['sort']);_0x156bbd[_0x63af('0x3f')]=qs[_0x63af('0x38')](_[_0x63af('0x40')](_0x104720[_0x63af('0x36')],_0x872e0[_0x63af('0x38')]),_0x25f0bc);if(_0x104720[_0x63af('0x36')][_0x63af('0x41')]){_0x156bbd[_0x63af('0x3f')]=_['merge'](_0x156bbd[_0x63af('0x3f')],{'$or':_[_0x63af('0x30')](_0x25f0bc,function(_0x3d05f8){if(_0x3d05f8[_0x63af('0x33')]!=='VIRTUAL'){var _0x1412e2={};_0x1412e2[_0x3d05f8[_0x63af('0x2e')]]={'$like':'%'+_0x104720['query']['filter']+'%'};return _0x1412e2;}})});}_0x156bbd=_[_0x63af('0x42')]({},_0x156bbd,_0x104720[_0x63af('0x43')]);var _0x105d9f={'where':_0x156bbd[_0x63af('0x3f')]};return db['Dynamics365Configuration'][_0x63af('0x27')](_0x105d9f)[_0x63af('0x1c')](function(_0x8054dc){_0x29c6f0[_0x63af('0x27')]=_0x8054dc;if(_0x104720[_0x63af('0x36')][_0x63af('0x44')]){_0x156bbd[_0x63af('0x45')]=[{'all':!![]}];}return db[_0x63af('0x46')][_0x63af('0x47')](_0x156bbd);})[_0x63af('0x1c')](function(_0x4aa562){_0x29c6f0['rows']=_0x4aa562;return _0x29c6f0;})['then'](respondWithFilteredResult(_0x319052,_0x156bbd))[_0x63af('0x24')](handleError(_0x319052,null));};exports[_0x63af('0x48')]=function(_0x1f5e7e,_0x48c64d){var _0x189e7b={'raw':![],'where':{'id':_0x1f5e7e[_0x63af('0x49')]['id']}},_0x3bb42f={};_0x3bb42f[_0x63af('0x35')]=_[_0x63af('0x37')](db[_0x63af('0x46')][_0x63af('0x31')]);_0x3bb42f['query']=_[_0x63af('0x37')](_0x1f5e7e['query']);_0x3bb42f['filters']=_['intersection'](_0x3bb42f[_0x63af('0x35')],_0x3bb42f['query']);_0x189e7b[_0x63af('0x39')]=_[_0x63af('0x3a')](_0x3bb42f[_0x63af('0x35')],qs[_0x63af('0x3b')](_0x1f5e7e['query']['fields']));_0x189e7b[_0x63af('0x39')]=_0x189e7b[_0x63af('0x39')][_0x63af('0x3c')]?_0x189e7b[_0x63af('0x39')]:_0x3bb42f[_0x63af('0x35')];if(_0x1f5e7e[_0x63af('0x36')]['includeAll']){_0x189e7b['include']=[{'all':!![]}];}_0x189e7b=_[_0x63af('0x42')]({},_0x189e7b,_0x1f5e7e['options']);return db[_0x63af('0x46')][_0x63af('0x4a')](_0x189e7b)['then'](handleEntityNotFound(_0x48c64d,null))[_0x63af('0x1c')](respondWithResult(_0x48c64d,null))[_0x63af('0x24')](handleError(_0x48c64d,null));};exports[_0x63af('0x4b')]=function(_0x38bccd,_0x1375e8){return db['Dynamics365Configuration'][_0x63af('0x4b')](_0x38bccd[_0x63af('0x4c')],{})[_0x63af('0x1c')](respondWithResult(_0x1375e8,0xc9))[_0x63af('0x24')](handleError(_0x1375e8,null));};exports['update']=function(_0x2c8755,_0x4e240e){if(_0x2c8755['body']['id']){delete _0x2c8755['body']['id'];}return db[_0x63af('0x46')][_0x63af('0x4a')]({'where':{'id':_0x2c8755[_0x63af('0x49')]['id']}})[_0x63af('0x1c')](handleEntityNotFound(_0x4e240e,null))[_0x63af('0x1c')](saveUpdates(_0x2c8755[_0x63af('0x4c')],null))[_0x63af('0x1c')](respondWithResult(_0x4e240e,null))[_0x63af('0x24')](handleError(_0x4e240e,null));};exports[_0x63af('0x2d')]=function(_0x3e96ea,_0x40a914){return db[_0x63af('0x46')][_0x63af('0x4a')]({'where':{'id':_0x3e96ea['params']['id']}})[_0x63af('0x1c')](handleEntityNotFound(_0x40a914,null))[_0x63af('0x1c')](removeEntity(_0x40a914,null))[_0x63af('0x24')](handleError(_0x40a914,null));};exports['getFields']=function(_0x389c70,_0x354849,_0x55164e){var _0x23ebdb={};var _0x2b9f90={};var _0x2e90c8;var _0x3e9f66;return db[_0x63af('0x46')][_0x63af('0x4d')]({'where':{'id':_0x389c70[_0x63af('0x49')]['id']}})['then'](handleEntityNotFound(_0x354849,null))['then'](function(_0x242051){if(_0x242051){_0x2e90c8=_0x242051;_0x2b9f90[_0x63af('0x35')]=_[_0x63af('0x37')](db['Dynamics365Field'][_0x63af('0x31')]);_0x2b9f90['query']=_[_0x63af('0x37')](_0x389c70[_0x63af('0x36')]);_0x2b9f90['filters']=_['intersection'](_0x2b9f90[_0x63af('0x35')],_0x2b9f90[_0x63af('0x36')]);_0x23ebdb[_0x63af('0x39')]=_[_0x63af('0x3a')](_0x2b9f90['model'],qs[_0x63af('0x3b')](_0x389c70[_0x63af('0x36')][_0x63af('0x3b')]));_0x23ebdb['attributes']=_0x23ebdb['attributes'][_0x63af('0x3c')]?_0x23ebdb[_0x63af('0x39')]:_0x2b9f90[_0x63af('0x35')];_0x23ebdb[_0x63af('0x4e')]=qs['sort'](_0x389c70[_0x63af('0x36')]['sort']);_0x23ebdb[_0x63af('0x3f')]=qs[_0x63af('0x38')](_['pick'](_0x389c70[_0x63af('0x36')],_0x2b9f90[_0x63af('0x38')]));if(_0x389c70['query'][_0x63af('0x41')]){_0x23ebdb[_0x63af('0x3f')]=_[_0x63af('0x42')](_0x23ebdb[_0x63af('0x3f')],{'$or':_[_0x63af('0x30')](_0x23ebdb[_0x63af('0x39')],function(_0x37dea1){var _0xc23661={};_0xc23661[_0x37dea1]={'$like':'%'+_0x389c70[_0x63af('0x36')][_0x63af('0x41')]+'%'};return _0xc23661;})});}_0x23ebdb=_[_0x63af('0x42')]({},_0x23ebdb,_0x389c70['options']);return _0x2e90c8[_0x63af('0x4f')](_0x23ebdb);}})[_0x63af('0x1c')](function(_0x505f84){if(_0x505f84){_0x3e9f66=_0x505f84[_0x63af('0x3c')];if(!_0x389c70[_0x63af('0x36')][_0x63af('0x50')]('nolimit')){_0x23ebdb[_0x63af('0x29')]=qs[_0x63af('0x29')](_0x389c70['query'][_0x63af('0x29')]);_0x23ebdb[_0x63af('0x28')]=qs[_0x63af('0x28')](_0x389c70[_0x63af('0x36')][_0x63af('0x28')]);}return _0x2e90c8[_0x63af('0x4f')](_0x23ebdb);}})[_0x63af('0x1c')](function(_0x2ba44a){if(_0x2ba44a){return _0x2ba44a?{'count':_0x3e9f66,'rows':_0x2ba44a}:null;}})['then'](respondWithResult(_0x354849,null))[_0x63af('0x24')](handleError(_0x354849,null));};exports['getSubjects']=function(_0x40fdb2,_0x17cadc,_0xd659c5){var _0x4e060={};var _0x5118c8={};var _0x2e287e;var _0x55b49c;return db[_0x63af('0x46')]['findOne']({'where':{'id':_0x40fdb2[_0x63af('0x49')]['id']}})[_0x63af('0x1c')](handleEntityNotFound(_0x17cadc,null))[_0x63af('0x1c')](function(_0x22a731){if(_0x22a731){_0x2e287e=_0x22a731;_0x5118c8['model']=_[_0x63af('0x37')](db[_0x63af('0x51')][_0x63af('0x31')]);_0x5118c8[_0x63af('0x36')]=_[_0x63af('0x37')](_0x40fdb2[_0x63af('0x36')]);_0x5118c8[_0x63af('0x38')]=_['intersection'](_0x5118c8[_0x63af('0x35')],_0x5118c8[_0x63af('0x36')]);_0x4e060[_0x63af('0x39')]=_[_0x63af('0x3a')](_0x5118c8[_0x63af('0x35')],qs['fields'](_0x40fdb2[_0x63af('0x36')]['fields']));_0x4e060[_0x63af('0x39')]=_0x4e060[_0x63af('0x39')][_0x63af('0x3c')]?_0x4e060[_0x63af('0x39')]:_0x5118c8[_0x63af('0x35')];_0x4e060[_0x63af('0x4e')]=qs[_0x63af('0x3e')](_0x40fdb2['query'][_0x63af('0x3e')]);_0x4e060[_0x63af('0x3f')]=qs['filters'](_['pick'](_0x40fdb2['query'],_0x5118c8['filters']));if(_0x40fdb2['query'][_0x63af('0x41')]){_0x4e060['where']=_[_0x63af('0x42')](_0x4e060[_0x63af('0x3f')],{'$or':_[_0x63af('0x30')](_0x4e060[_0x63af('0x39')],function(_0x39c639){var _0x14dcb3={};_0x14dcb3[_0x39c639]={'$like':'%'+_0x40fdb2[_0x63af('0x36')][_0x63af('0x41')]+'%'};return _0x14dcb3;})});}_0x4e060=_[_0x63af('0x42')]({},_0x4e060,_0x40fdb2['options']);return _0x2e287e['getSubjects'](_0x4e060);}})[_0x63af('0x1c')](function(_0xdcb3c4){if(_0xdcb3c4){_0x55b49c=_0xdcb3c4['length'];if(!_0x40fdb2[_0x63af('0x36')][_0x63af('0x50')](_0x63af('0x3d'))){_0x4e060[_0x63af('0x29')]=qs[_0x63af('0x29')](_0x40fdb2[_0x63af('0x36')][_0x63af('0x29')]);_0x4e060['offset']=qs['offset'](_0x40fdb2['query'][_0x63af('0x28')]);}return _0x2e287e[_0x63af('0x52')](_0x4e060);}})[_0x63af('0x1c')](function(_0x59d603){if(_0x59d603){return _0x59d603?{'count':_0x55b49c,'rows':_0x59d603}:null;}})[_0x63af('0x1c')](respondWithResult(_0x17cadc,null))[_0x63af('0x24')](handleError(_0x17cadc,null));};exports['getDescriptions']=function(_0x303991,_0x397743,_0x2c597d){var _0x57bfbd={};var _0x5a36b9={};var _0xcce0f0;var _0x3f650d;return db[_0x63af('0x46')]['findOne']({'where':{'id':_0x303991[_0x63af('0x49')]['id']}})['then'](handleEntityNotFound(_0x397743,null))[_0x63af('0x1c')](function(_0x286f8d){if(_0x286f8d){_0xcce0f0=_0x286f8d;_0x5a36b9[_0x63af('0x35')]=_['keys'](db[_0x63af('0x51')][_0x63af('0x31')]);_0x5a36b9[_0x63af('0x36')]=_[_0x63af('0x37')](_0x303991[_0x63af('0x36')]);_0x5a36b9[_0x63af('0x38')]=_['intersection'](_0x5a36b9[_0x63af('0x35')],_0x5a36b9[_0x63af('0x36')]);_0x57bfbd[_0x63af('0x39')]=_[_0x63af('0x3a')](_0x5a36b9[_0x63af('0x35')],qs[_0x63af('0x3b')](_0x303991[_0x63af('0x36')]['fields']));_0x57bfbd[_0x63af('0x39')]=_0x57bfbd[_0x63af('0x39')][_0x63af('0x3c')]?_0x57bfbd['attributes']:_0x5a36b9[_0x63af('0x35')];_0x57bfbd[_0x63af('0x4e')]=qs[_0x63af('0x3e')](_0x303991[_0x63af('0x36')][_0x63af('0x3e')]);_0x57bfbd[_0x63af('0x3f')]=qs['filters'](_[_0x63af('0x40')](_0x303991['query'],_0x5a36b9['filters']));if(_0x303991[_0x63af('0x36')]['filter']){_0x57bfbd['where']=_[_0x63af('0x42')](_0x57bfbd[_0x63af('0x3f')],{'$or':_[_0x63af('0x30')](_0x57bfbd['attributes'],function(_0x2577be){var _0xf4303f={};_0xf4303f[_0x2577be]={'$like':'%'+_0x303991[_0x63af('0x36')][_0x63af('0x41')]+'%'};return _0xf4303f;})});}_0x57bfbd=_[_0x63af('0x42')]({},_0x57bfbd,_0x303991['options']);return _0xcce0f0[_0x63af('0x53')](_0x57bfbd);}})[_0x63af('0x1c')](function(_0x39de67){if(_0x39de67){_0x3f650d=_0x39de67[_0x63af('0x3c')];if(!_0x303991[_0x63af('0x36')]['hasOwnProperty'](_0x63af('0x3d'))){_0x57bfbd[_0x63af('0x29')]=qs[_0x63af('0x29')](_0x303991['query'][_0x63af('0x29')]);_0x57bfbd[_0x63af('0x28')]=qs['offset'](_0x303991[_0x63af('0x36')]['offset']);}return _0xcce0f0[_0x63af('0x53')](_0x57bfbd);}})[_0x63af('0x1c')](function(_0x33d77c){if(_0x33d77c){return _0x33d77c?{'count':_0x3f650d,'rows':_0x33d77c}:null;}})[_0x63af('0x1c')](respondWithResult(_0x397743,null))[_0x63af('0x24')](handleError(_0x397743,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 44d71c9..a0380e9 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 _0xa6b0=['util','../../config/logger','api','moment','bluebird','request-promise','exports','define','Dynamics365Configuration','lodash'];(function(_0xdb4ffe,_0x5f0de7){var _0xb3119a=function(_0x383b6a){while(--_0x383b6a){_0xdb4ffe['push'](_0xdb4ffe['shift']());}};_0xb3119a(++_0x5f0de7);}(_0xa6b0,0xb3));var _0x0a6b=function(_0x32239e,_0x1c153e){_0x32239e=_0x32239e-0x0;var _0x4ac4bb=_0xa6b0[_0x32239e];return _0x4ac4bb;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require(_0x0a6b('0x2'))(_0x0a6b('0x3'));var moment=require(_0x0a6b('0x4'));var BPromise=require(_0x0a6b('0x5'));var rp=require(_0x0a6b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module[_0x0a6b('0x7')]=function(_0x3f47c9,_0x547158){return _0x3f47c9[_0x0a6b('0x8')](_0x0a6b('0x9'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d84=['int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x2887af,_0x3d8430){var _0x1f7f55=function(_0x22da7b){while(--_0x22da7b){_0x2887af['push'](_0x2887af['shift']());}};_0x1f7f55(++_0x3d8430);}(_0x0d84,0x198));var _0x40d8=function(_0x102436,_0x1bc9ad){_0x102436=_0x102436-0x0;var _0x581f20=_0x0d84[_0x102436];return _0x581f20;};'use strict';var _=require(_0x40d8('0x0'));var util=require(_0x40d8('0x1'));var logger=require(_0x40d8('0x2'))(_0x40d8('0x3'));var moment=require(_0x40d8('0x4'));var BPromise=require(_0x40d8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40d8('0x6'));var rimraf=require(_0x40d8('0x7'));var config=require(_0x40d8('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0x40d8('0x9')]=function(_0xa7ed7b,_0x19717e){return _0xa7ed7b['define']('Dynamics365Configuration',attributes,{'tableName':_0x40d8('0xa'),'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 ccc3d90..2a5a32d 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 _0x201b=['client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x5ec634,_0xa835b9){var _0x5b94a9=function(_0x3a720e){while(--_0x3a720e){_0x5ec634['push'](_0x5ec634['shift']());}};_0x5b94a9(++_0xa835b9);}(_0x201b,0xf5));var _0xb201=function(_0x5b5ff0,_0x449d4c){_0x5b5ff0=_0x5b5ff0-0x0;var _0x3a80f6=_0x201b[_0x5b5ff0];return _0x3a80f6;};'use strict';var _=require('lodash');var util=require(_0xb201('0x0'));var moment=require(_0xb201('0x1'));var BPromise=require(_0xb201('0x2'));var rs=require(_0xb201('0x3'));var fs=require('fs');var Redis=require(_0xb201('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb201('0x5'))(_0xb201('0x6'));var config=require(_0xb201('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb201('0x8')][_0xb201('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33ae57,_0x426e5e,_0x552943){return new BPromise(function(_0x4bb787,_0x58a67f){return client[_0xb201('0xa')](_0x33ae57,_0x552943)[_0xb201('0xb')](function(_0x5c1f2f){logger['info'](_0xb201('0xc'),_0x426e5e,_0xb201('0xd'));logger[_0xb201('0xe')](_0xb201('0xf'),_0x426e5e,_0xb201('0xd'),JSON[_0xb201('0x10')](_0x5c1f2f));if(_0x5c1f2f['error']){if(_0x5c1f2f[_0xb201('0x11')][_0xb201('0x12')]===0x1f4){logger[_0xb201('0x11')](_0xb201('0xc'),_0x426e5e,_0x5c1f2f[_0xb201('0x11')][_0xb201('0x13')]);return _0x58a67f(_0x5c1f2f[_0xb201('0x11')][_0xb201('0x13')]);}logger[_0xb201('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x426e5e,_0x5c1f2f['error'][_0xb201('0x13')]);return _0x4bb787(_0x5c1f2f[_0xb201('0x11')][_0xb201('0x13')]);}else{logger[_0xb201('0x14')](_0xb201('0xc'),_0x426e5e,_0xb201('0xd'));_0x4bb787(_0x5c1f2f[_0xb201('0x15')][_0xb201('0x13')]);}})[_0xb201('0x16')](function(_0xd4ea12){logger[_0xb201('0x11')](_0xb201('0xc'),_0x426e5e,_0xd4ea12);_0x58a67f(_0xd4ea12);});});} \ No newline at end of file +var _0x09ae=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x14f16e,_0x75f5fc){var _0x39f46b=function(_0x19ab98){while(--_0x19ab98){_0x14f16e['push'](_0x14f16e['shift']());}};_0x39f46b(++_0x75f5fc);}(_0x09ae,0xc5));var _0xe09a=function(_0x1171f4,_0x1541cb){_0x1171f4=_0x1171f4-0x0;var _0x29b65a=_0x09ae[_0x1171f4];return _0x29b65a;};'use strict';var _=require(_0xe09a('0x0'));var util=require('util');var moment=require(_0xe09a('0x1'));var BPromise=require(_0xe09a('0x2'));var rs=require(_0xe09a('0x3'));var fs=require('fs');var Redis=require(_0xe09a('0x4'));var db=require(_0xe09a('0x5'))['db'];var utils=require(_0xe09a('0x6'));var logger=require('../../config/logger')(_0xe09a('0x7'));var config=require(_0xe09a('0x8'));var jayson=require(_0xe09a('0x9'));var client=jayson[_0xe09a('0xa')][_0xe09a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4073ab,_0x5541e1,_0x2c77f2){return new BPromise(function(_0x2151ed,_0x4400ff){return client['request'](_0x4073ab,_0x2c77f2)[_0xe09a('0xc')](function(_0x7145df){logger[_0xe09a('0xd')](_0xe09a('0xe'),_0x5541e1,_0xe09a('0xf'));logger['debug'](_0xe09a('0x10'),_0x5541e1,_0xe09a('0xf'),JSON['stringify'](_0x7145df));if(_0x7145df[_0xe09a('0x11')]){if(_0x7145df[_0xe09a('0x11')][_0xe09a('0x12')]===0x1f4){logger[_0xe09a('0x11')](_0xe09a('0xe'),_0x5541e1,_0x7145df[_0xe09a('0x11')]['message']);return _0x4400ff(_0x7145df['error']['message']);}logger[_0xe09a('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5541e1,_0x7145df[_0xe09a('0x11')]['message']);return _0x2151ed(_0x7145df['error'][_0xe09a('0x13')]);}else{logger[_0xe09a('0xd')](_0xe09a('0xe'),_0x5541e1,_0xe09a('0xf'));_0x2151ed(_0x7145df[_0xe09a('0x14')][_0xe09a('0x13')]);}})[_0xe09a('0x15')](function(_0xf952f7){logger[_0xe09a('0x11')](_0xe09a('0xe'),_0x5541e1,_0xf952f7);_0x4400ff(_0xf952f7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 3be054b..f3be096 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 _0x0a9a=['get','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index'];(function(_0x57d7b7,_0x166638){var _0xbe368f=function(_0x1842fa){while(--_0x1842fa){_0x57d7b7['push'](_0x57d7b7['shift']());}};_0xbe368f(++_0x166638);}(_0x0a9a,0x183));var _0xa0a9=function(_0x1b5fc3,_0x1dbfa1){_0x1b5fc3=_0x1b5fc3-0x0;var _0x13ab8f=_0x0a9a[_0x1b5fc3];return _0x13ab8f;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var auth=require(_0xa0a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0a9('0x5'));var controller=require(_0xa0a9('0x6'));router['get']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0x8')]);router[_0xa0a9('0x9')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0xc')]);router[_0xa0a9('0xd')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);router[_0xa0a9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa0a9('0x10')]);module[_0xa0a9('0x11')]=router; \ No newline at end of file +var _0xec56=['put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0xa6d15c,_0x4c80bc){var _0x14296a=function(_0x869ab1){while(--_0x869ab1){_0xa6d15c['push'](_0xa6d15c['shift']());}};_0x14296a(++_0x4c80bc);}(_0xec56,0x1bd));var _0x6ec5=function(_0x1a247f,_0x592ed8){_0x1a247f=_0x1a247f-0x0;var _0x2b2aee=_0xec56[_0x1a247f];return _0x2b2aee;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var auth=require(_0x6ec5('0x4'));var interaction=require(_0x6ec5('0x5'));var config=require(_0x6ec5('0x6'));var controller=require(_0x6ec5('0x7'));router[_0x6ec5('0x8')]('/',auth[_0x6ec5('0x9')](),controller[_0x6ec5('0xa')]);router[_0x6ec5('0x8')](_0x6ec5('0xb'),auth[_0x6ec5('0x9')](),controller[_0x6ec5('0xc')]);router[_0x6ec5('0xd')]('/',auth[_0x6ec5('0x9')](),controller[_0x6ec5('0xe')]);router[_0x6ec5('0xf')](_0x6ec5('0xb'),auth['isAuthenticated'](),controller[_0x6ec5('0x10')]);router[_0x6ec5('0x11')](_0x6ec5('0xb'),auth[_0x6ec5('0x9')](),controller[_0x6ec5('0x12')]);module[_0x6ec5('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 5aacd8f..9e4c859 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 _0x5961=['string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x5961,0x6f));var _0x1596=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0x5961[_0x532112];return _0x23e5fb;};'use strict';var Sequelize=require(_0x1596('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x1596('0x1'),_0x1596('0x2'),'customVariable',_0x1596('0x3')),'defaultValue':_0x1596('0x1')},'content':{'type':Sequelize[_0x1596('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x1596('0x2'),_0x1596('0x5'))},'keyContent':{'type':Sequelize[_0x1596('0x4')]},'idField':{'type':Sequelize[_0x1596('0x4')]},'nameField':{'type':Sequelize[_0x1596('0x4')]},'customField':{'type':Sequelize[_0x1596('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1596('0x4')]}}; \ No newline at end of file +var _0x42bd=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x56608c,_0x29eb74){var _0x3c7fb0=function(_0x154b1c){while(--_0x154b1c){_0x56608c['push'](_0x56608c['shift']());}};_0x3c7fb0(++_0x29eb74);}(_0x42bd,0xd9));var _0xd42b=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x42bd[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xd42b('0x0')](_0xd42b('0x1'),_0xd42b('0x2'),_0xd42b('0x3'),_0xd42b('0x4')),'defaultValue':_0xd42b('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xd42b('0x1'),'variable',_0xd42b('0x3'))},'keyContent':{'type':Sequelize[_0xd42b('0x5')]},'idField':{'type':Sequelize[_0xd42b('0x5')]},'nameField':{'type':Sequelize[_0xd42b('0x5')]},'customField':{'type':Sequelize[_0xd42b('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd42b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 85aa229..f39d7af 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 _0xf150=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','Dynamics365Field','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x5174f6,_0x378808){var _0x2acf8e=function(_0x292da6){while(--_0x292da6){_0x5174f6['push'](_0x5174f6['shift']());}};_0x2acf8e(++_0x378808);}(_0xf150,0x196));var _0x0f15=function(_0x2f1cf8,_0x3fff4f){_0x2f1cf8=_0x2f1cf8-0x0;var _0x5455d6=_0xf150[_0x2f1cf8];return _0x5455d6;};'use strict';var pdf=require(_0x0f15('0x0'));var emlformat=require(_0x0f15('0x1'));var rimraf=require(_0x0f15('0x2'));var zipdir=require(_0x0f15('0x3'));var jsonpatch=require(_0x0f15('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0f15('0x5'));var Mustache=require(_0x0f15('0x6'));var util=require(_0x0f15('0x7'));var path=require(_0x0f15('0x8'));var sox=require('sox');var csv=require(_0x0f15('0x9'));var ejs=require(_0x0f15('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0f15('0xb'));var crypto=require('crypto');var jsforce=require(_0x0f15('0xc'));var deskjs=require(_0x0f15('0xd'));var toCsv=require(_0x0f15('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0f15('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f15('0xf'));var logger=require(_0x0f15('0x10'))(_0x0f15('0x11'));var utils=require(_0x0f15('0x12'));var config=require(_0x0f15('0x13'));var licenseUtil=require(_0x0f15('0x14'));var db=require(_0x0f15('0x15'))['db'];function respondWithStatusCode(_0x3ae76e,_0x227852){_0x227852=_0x227852||0xcc;return function(_0x1b31c1){if(_0x1b31c1){return _0x3ae76e[_0x0f15('0x16')](_0x227852);}return _0x3ae76e[_0x0f15('0x17')](_0x227852)[_0x0f15('0x18')]();};}function respondWithResult(_0x476769,_0x110269){_0x110269=_0x110269||0xc8;return function(_0x552fae){if(_0x552fae){return _0x476769[_0x0f15('0x17')](_0x110269)[_0x0f15('0x19')](_0x552fae);}};}function respondWithFilteredResult(_0x15e185,_0x5e71dc){return function(_0x11f200){if(_0x11f200){var _0x15b66b=_0x11f200[_0x0f15('0x1a')],_0x4ada0b=_0x5e71dc['offset'],_0x3746ee=_0x5e71dc[_0x0f15('0x1b')]+_0x5e71dc[_0x0f15('0x1c')],_0x308757;if(_0x3746ee>=_0x15b66b){_0x3746ee=_0x15b66b;_0x308757=0xc8;}else{_0x308757=0xce;}_0x15e185['status'](_0x308757);return _0x15e185[_0x0f15('0x1d')](_0x0f15('0x1e'),_0x4ada0b+'-'+_0x3746ee+'/'+_0x15b66b)[_0x0f15('0x19')](_0x11f200);}return null;};}function patchUpdates(_0x508820){return function(_0x2aeaeb){try{jsonpatch[_0x0f15('0x1f')](_0x2aeaeb,_0x508820,!![]);}catch(_0x667a6b){return BPromise[_0x0f15('0x20')](_0x667a6b);}return _0x2aeaeb[_0x0f15('0x21')]();};}function saveUpdates(_0x1a9ce6,_0x3b6df7){return function(_0x44ac86){if(_0x44ac86){return _0x44ac86[_0x0f15('0x22')](_0x1a9ce6)[_0x0f15('0x23')](function(_0x9ce5b3){return _0x9ce5b3;});}return null;};}function removeEntity(_0x23bd29,_0x4b0676){return function(_0xc9f79a){if(_0xc9f79a){return _0xc9f79a[_0x0f15('0x24')]()['then'](function(){_0x23bd29['status'](0xcc)[_0x0f15('0x18')]();});}};}function handleEntityNotFound(_0x5e4784,_0x150e62){return function(_0x213d72){if(!_0x213d72){_0x5e4784[_0x0f15('0x16')](0x194);}return _0x213d72;};}function handleError(_0x2e7fd1,_0x5c6945){_0x5c6945=_0x5c6945||0x1f4;return function(_0x528668){logger[_0x0f15('0x25')](_0x528668[_0x0f15('0x26')]);if(_0x528668[_0x0f15('0x27')]){delete _0x528668[_0x0f15('0x27')];}_0x2e7fd1[_0x0f15('0x17')](_0x5c6945)[_0x0f15('0x28')](_0x528668);};}exports[_0x0f15('0x29')]=function(_0x5c1c97,_0x5e5cec){var _0x35062b={},_0x308329={},_0x124fb6={'count':0x0,'rows':[]};var _0x573e25=_[_0x0f15('0x2a')](db['Dynamics365Field']['rawAttributes'],function(_0x24d0d5){return{'name':_0x24d0d5[_0x0f15('0x2b')],'type':_0x24d0d5[_0x0f15('0x2c')][_0x0f15('0x2d')]};});_0x308329[_0x0f15('0x2e')]=_['map'](_0x573e25,'name');_0x308329[_0x0f15('0x2f')]=_['keys'](_0x5c1c97['query']);_0x308329[_0x0f15('0x30')]=_[_0x0f15('0x31')](_0x308329['model'],_0x308329[_0x0f15('0x2f')]);_0x35062b['attributes']=_[_0x0f15('0x31')](_0x308329[_0x0f15('0x2e')],qs[_0x0f15('0x32')](_0x5c1c97['query'][_0x0f15('0x32')]));_0x35062b['attributes']=_0x35062b[_0x0f15('0x33')][_0x0f15('0x34')]?_0x35062b[_0x0f15('0x33')]:_0x308329[_0x0f15('0x2e')];if(!_0x5c1c97[_0x0f15('0x2f')][_0x0f15('0x35')](_0x0f15('0x36'))){_0x35062b[_0x0f15('0x1c')]=qs[_0x0f15('0x1c')](_0x5c1c97['query'][_0x0f15('0x1c')]);_0x35062b[_0x0f15('0x1b')]=qs[_0x0f15('0x1b')](_0x5c1c97[_0x0f15('0x2f')][_0x0f15('0x1b')]);}_0x35062b['order']=qs['sort'](_0x5c1c97[_0x0f15('0x2f')]['sort']);_0x35062b[_0x0f15('0x37')]=qs['filters'](_[_0x0f15('0x38')](_0x5c1c97[_0x0f15('0x2f')],_0x308329['filters']),_0x573e25);if(_0x5c1c97[_0x0f15('0x2f')][_0x0f15('0x39')]){_0x35062b['where']=_[_0x0f15('0x3a')](_0x35062b[_0x0f15('0x37')],{'$or':_['map'](_0x573e25,function(_0x54a687){if(_0x54a687['type']!==_0x0f15('0x3b')){var _0x397e1d={};_0x397e1d[_0x54a687[_0x0f15('0x27')]]={'$like':'%'+_0x5c1c97[_0x0f15('0x2f')][_0x0f15('0x39')]+'%'};return _0x397e1d;}})});}_0x35062b=_[_0x0f15('0x3a')]({},_0x35062b,_0x5c1c97[_0x0f15('0x3c')]);var _0x3d3bb4={'where':_0x35062b[_0x0f15('0x37')]};return db[_0x0f15('0x3d')]['count'](_0x3d3bb4)[_0x0f15('0x23')](function(_0x4dea56){_0x124fb6[_0x0f15('0x1a')]=_0x4dea56;if(_0x5c1c97[_0x0f15('0x2f')][_0x0f15('0x3e')]){_0x35062b['include']=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x35062b);})[_0x0f15('0x23')](function(_0x5c351c){_0x124fb6[_0x0f15('0x3f')]=_0x5c351c;return _0x124fb6;})[_0x0f15('0x23')](respondWithFilteredResult(_0x5e5cec,_0x35062b))[_0x0f15('0x40')](handleError(_0x5e5cec,null));};exports[_0x0f15('0x41')]=function(_0xc81d34,_0x370a08){var _0x515c76={'raw':!![],'where':{'id':_0xc81d34[_0x0f15('0x42')]['id']}},_0x19ccd2={};_0x19ccd2[_0x0f15('0x2e')]=_[_0x0f15('0x43')](db['Dynamics365Field'][_0x0f15('0x44')]);_0x19ccd2[_0x0f15('0x2f')]=_['keys'](_0xc81d34['query']);_0x19ccd2[_0x0f15('0x30')]=_[_0x0f15('0x31')](_0x19ccd2[_0x0f15('0x2e')],_0x19ccd2[_0x0f15('0x2f')]);_0x515c76[_0x0f15('0x33')]=_[_0x0f15('0x31')](_0x19ccd2[_0x0f15('0x2e')],qs[_0x0f15('0x32')](_0xc81d34['query'][_0x0f15('0x32')]));_0x515c76[_0x0f15('0x33')]=_0x515c76[_0x0f15('0x33')][_0x0f15('0x34')]?_0x515c76['attributes']:_0x19ccd2[_0x0f15('0x2e')];if(_0xc81d34[_0x0f15('0x2f')][_0x0f15('0x3e')]){_0x515c76[_0x0f15('0x45')]=[{'all':!![]}];}_0x515c76=_[_0x0f15('0x3a')]({},_0x515c76,_0xc81d34[_0x0f15('0x3c')]);return db[_0x0f15('0x3d')]['find'](_0x515c76)[_0x0f15('0x23')](handleEntityNotFound(_0x370a08,null))[_0x0f15('0x23')](respondWithResult(_0x370a08,null))[_0x0f15('0x40')](handleError(_0x370a08,null));};exports[_0x0f15('0x46')]=function(_0x156ddd,_0xc5a111){return db[_0x0f15('0x3d')][_0x0f15('0x46')](_0x156ddd[_0x0f15('0x47')],{})[_0x0f15('0x23')](respondWithResult(_0xc5a111,0xc9))['catch'](handleError(_0xc5a111,null));};exports[_0x0f15('0x22')]=function(_0xec5e2a,_0x403e22){if(_0xec5e2a[_0x0f15('0x47')]['id']){delete _0xec5e2a['body']['id'];}return db[_0x0f15('0x3d')]['find']({'where':{'id':_0xec5e2a[_0x0f15('0x42')]['id']}})['then'](handleEntityNotFound(_0x403e22,null))[_0x0f15('0x23')](saveUpdates(_0xec5e2a[_0x0f15('0x47')],null))['then'](respondWithResult(_0x403e22,null))[_0x0f15('0x40')](handleError(_0x403e22,null));};exports[_0x0f15('0x24')]=function(_0x5ef149,_0x5d888a){return db['Dynamics365Field']['find']({'where':{'id':_0x5ef149['params']['id']}})[_0x0f15('0x23')](handleEntityNotFound(_0x5d888a,null))['then'](removeEntity(_0x5d888a,null))[_0x0f15('0x40')](handleError(_0x5d888a,null));}; \ No newline at end of file +var _0xe0da=['jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','html-pdf','eml-format','zip-dir','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto'];(function(_0x2dbd26,_0x398dcd){var _0x1744ad=function(_0x1e2592){while(--_0x1e2592){_0x2dbd26['push'](_0x2dbd26['shift']());}};_0x1744ad(++_0x398dcd);}(_0xe0da,0xd0));var _0xae0d=function(_0x29aed4,_0x4c1d19){_0x29aed4=_0x29aed4-0x0;var _0x3cd329=_0xe0da[_0x29aed4];return _0x3cd329;};'use strict';var pdf=require(_0xae0d('0x0'));var emlformat=require(_0xae0d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xae0d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae0d('0x3'));var moment=require('moment');var BPromise=require(_0xae0d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xae0d('0x5'));var sox=require(_0xae0d('0x6'));var csv=require('to-csv');var ejs=require(_0xae0d('0x7'));var fs=require('fs');var _=require(_0xae0d('0x8'));var squel=require(_0xae0d('0x9'));var crypto=require(_0xae0d('0xa'));var jsforce=require(_0xae0d('0xb'));var deskjs=require(_0xae0d('0xc'));var toCsv=require(_0xae0d('0xd'));var querystring=require(_0xae0d('0xe'));var Papa=require(_0xae0d('0xf'));var Redis=require('ioredis');var authService=require(_0xae0d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xae0d('0x11'));var hardwareService=require(_0xae0d('0x12'));var logger=require(_0xae0d('0x13'))(_0xae0d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xae0d('0x15'));var db=require(_0xae0d('0x16'))['db'];function respondWithStatusCode(_0x98b23b,_0x43ac32){_0x43ac32=_0x43ac32||0xcc;return function(_0x5d2e0b){if(_0x5d2e0b){return _0x98b23b['sendStatus'](_0x43ac32);}return _0x98b23b[_0xae0d('0x17')](_0x43ac32)[_0xae0d('0x18')]();};}function respondWithResult(_0x43b9c6,_0x5e6a18){_0x5e6a18=_0x5e6a18||0xc8;return function(_0x513181){if(_0x513181){return _0x43b9c6[_0xae0d('0x17')](_0x5e6a18)[_0xae0d('0x19')](_0x513181);}};}function respondWithFilteredResult(_0x45942c,_0x15c960){return function(_0x388f89){if(_0x388f89){var _0x1442de=_0x388f89['count'],_0x147cc7=_0x15c960[_0xae0d('0x1a')],_0x32487c=_0x15c960[_0xae0d('0x1a')]+_0x15c960[_0xae0d('0x1b')],_0x3fbaf9;if(_0x32487c>=_0x1442de){_0x32487c=_0x1442de;_0x3fbaf9=0xc8;}else{_0x3fbaf9=0xce;}_0x45942c[_0xae0d('0x17')](_0x3fbaf9);return _0x45942c[_0xae0d('0x1c')](_0xae0d('0x1d'),_0x147cc7+'-'+_0x32487c+'/'+_0x1442de)[_0xae0d('0x19')](_0x388f89);}return null;};}function patchUpdates(_0x2e9d04){return function(_0xd5ea05){try{jsonpatch['apply'](_0xd5ea05,_0x2e9d04,!![]);}catch(_0x5a1286){return BPromise[_0xae0d('0x1e')](_0x5a1286);}return _0xd5ea05[_0xae0d('0x1f')]();};}function saveUpdates(_0x13b783,_0x1a7957){return function(_0x11453f){if(_0x11453f){return _0x11453f[_0xae0d('0x20')](_0x13b783)[_0xae0d('0x21')](function(_0x56dada){return _0x56dada;});}return null;};}function removeEntity(_0x7204bc,_0x24e785){return function(_0x106439){if(_0x106439){return _0x106439[_0xae0d('0x22')]()['then'](function(){_0x7204bc[_0xae0d('0x17')](0xcc)[_0xae0d('0x18')]();});}};}function handleEntityNotFound(_0x37a8ee,_0x33116f){return function(_0x12dcaa){if(!_0x12dcaa){_0x37a8ee[_0xae0d('0x23')](0x194);}return _0x12dcaa;};}function handleError(_0x2a4b86,_0xde3145){_0xde3145=_0xde3145||0x1f4;return function(_0x232c32){logger[_0xae0d('0x24')](_0x232c32[_0xae0d('0x25')]);if(_0x232c32['name']){delete _0x232c32[_0xae0d('0x26')];}_0x2a4b86[_0xae0d('0x17')](_0xde3145)[_0xae0d('0x27')](_0x232c32);};}exports['index']=function(_0x5ea252,_0x16328e){var _0x116610={},_0x299204={},_0x8346b7={'count':0x0,'rows':[]};var _0x4913b7=_[_0xae0d('0x28')](db[_0xae0d('0x29')][_0xae0d('0x2a')],function(_0x57c0b1){return{'name':_0x57c0b1[_0xae0d('0x2b')],'type':_0x57c0b1[_0xae0d('0x2c')][_0xae0d('0x2d')]};});_0x299204[_0xae0d('0x2e')]=_['map'](_0x4913b7,_0xae0d('0x26'));_0x299204[_0xae0d('0x2f')]=_['keys'](_0x5ea252[_0xae0d('0x2f')]);_0x299204[_0xae0d('0x30')]=_[_0xae0d('0x31')](_0x299204['model'],_0x299204[_0xae0d('0x2f')]);_0x116610['attributes']=_[_0xae0d('0x31')](_0x299204['model'],qs[_0xae0d('0x32')](_0x5ea252[_0xae0d('0x2f')][_0xae0d('0x32')]));_0x116610[_0xae0d('0x33')]=_0x116610[_0xae0d('0x33')][_0xae0d('0x34')]?_0x116610[_0xae0d('0x33')]:_0x299204[_0xae0d('0x2e')];if(!_0x5ea252['query'][_0xae0d('0x35')](_0xae0d('0x36'))){_0x116610[_0xae0d('0x1b')]=qs['limit'](_0x5ea252[_0xae0d('0x2f')][_0xae0d('0x1b')]);_0x116610[_0xae0d('0x1a')]=qs[_0xae0d('0x1a')](_0x5ea252['query'][_0xae0d('0x1a')]);}_0x116610[_0xae0d('0x37')]=qs[_0xae0d('0x38')](_0x5ea252[_0xae0d('0x2f')][_0xae0d('0x38')]);_0x116610[_0xae0d('0x39')]=qs['filters'](_[_0xae0d('0x3a')](_0x5ea252[_0xae0d('0x2f')],_0x299204[_0xae0d('0x30')]),_0x4913b7);if(_0x5ea252[_0xae0d('0x2f')]['filter']){_0x116610['where']=_[_0xae0d('0x3b')](_0x116610[_0xae0d('0x39')],{'$or':_['map'](_0x4913b7,function(_0x805dcd){if(_0x805dcd[_0xae0d('0x2c')]!==_0xae0d('0x3c')){var _0x5e1cd4={};_0x5e1cd4[_0x805dcd['name']]={'$like':'%'+_0x5ea252[_0xae0d('0x2f')]['filter']+'%'};return _0x5e1cd4;}})});}_0x116610=_['merge']({},_0x116610,_0x5ea252[_0xae0d('0x3d')]);var _0x5d4523={'where':_0x116610[_0xae0d('0x39')]};return db[_0xae0d('0x29')]['count'](_0x5d4523)[_0xae0d('0x21')](function(_0x3aef7d){_0x8346b7['count']=_0x3aef7d;if(_0x5ea252['query'][_0xae0d('0x3e')]){_0x116610[_0xae0d('0x3f')]=[{'all':!![]}];}return db[_0xae0d('0x29')][_0xae0d('0x40')](_0x116610);})['then'](function(_0x11abca){_0x8346b7[_0xae0d('0x41')]=_0x11abca;return _0x8346b7;})[_0xae0d('0x21')](respondWithFilteredResult(_0x16328e,_0x116610))[_0xae0d('0x42')](handleError(_0x16328e,null));};exports[_0xae0d('0x43')]=function(_0x16c301,_0x2f59bf){var _0x135e25={'raw':!![],'where':{'id':_0x16c301[_0xae0d('0x44')]['id']}},_0xfc21c3={};_0xfc21c3[_0xae0d('0x2e')]=_[_0xae0d('0x45')](db[_0xae0d('0x29')]['rawAttributes']);_0xfc21c3[_0xae0d('0x2f')]=_[_0xae0d('0x45')](_0x16c301['query']);_0xfc21c3[_0xae0d('0x30')]=_[_0xae0d('0x31')](_0xfc21c3[_0xae0d('0x2e')],_0xfc21c3[_0xae0d('0x2f')]);_0x135e25[_0xae0d('0x33')]=_[_0xae0d('0x31')](_0xfc21c3[_0xae0d('0x2e')],qs[_0xae0d('0x32')](_0x16c301[_0xae0d('0x2f')][_0xae0d('0x32')]));_0x135e25['attributes']=_0x135e25[_0xae0d('0x33')][_0xae0d('0x34')]?_0x135e25[_0xae0d('0x33')]:_0xfc21c3[_0xae0d('0x2e')];if(_0x16c301['query']['includeAll']){_0x135e25['include']=[{'all':!![]}];}_0x135e25=_[_0xae0d('0x3b')]({},_0x135e25,_0x16c301[_0xae0d('0x3d')]);return db[_0xae0d('0x29')][_0xae0d('0x46')](_0x135e25)[_0xae0d('0x21')](handleEntityNotFound(_0x2f59bf,null))[_0xae0d('0x21')](respondWithResult(_0x2f59bf,null))[_0xae0d('0x42')](handleError(_0x2f59bf,null));};exports[_0xae0d('0x47')]=function(_0x354177,_0x365544){return db['Dynamics365Field'][_0xae0d('0x47')](_0x354177[_0xae0d('0x48')],{})[_0xae0d('0x21')](respondWithResult(_0x365544,0xc9))[_0xae0d('0x42')](handleError(_0x365544,null));};exports[_0xae0d('0x20')]=function(_0x466963,_0x791fa3){if(_0x466963[_0xae0d('0x48')]['id']){delete _0x466963[_0xae0d('0x48')]['id'];}return db[_0xae0d('0x29')][_0xae0d('0x46')]({'where':{'id':_0x466963[_0xae0d('0x44')]['id']}})['then'](handleEntityNotFound(_0x791fa3,null))['then'](saveUpdates(_0x466963['body'],null))[_0xae0d('0x21')](respondWithResult(_0x791fa3,null))['catch'](handleError(_0x791fa3,null));};exports[_0xae0d('0x22')]=function(_0x152c92,_0x3e9515){return db[_0xae0d('0x29')][_0xae0d('0x46')]({'where':{'id':_0x152c92['params']['id']}})['then'](handleEntityNotFound(_0x3e9515,null))[_0xae0d('0x21')](removeEntity(_0x3e9515,null))[_0xae0d('0x42')](handleError(_0x3e9515,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 916c4ed..9486e8d 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 _0x4719=['exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x38935d,_0x17154a){var _0x23aa83=function(_0x389b0e){while(--_0x389b0e){_0x38935d['push'](_0x38935d['shift']());}};_0x23aa83(++_0x17154a);}(_0x4719,0x19f));var _0x9471=function(_0x2d7df3,_0x2f8c6f){_0x2d7df3=_0x2d7df3-0x0;var _0x1a9847=_0x4719[_0x2d7df3];return _0x1a9847;};'use strict';var _=require(_0x9471('0x0'));var util=require(_0x9471('0x1'));var logger=require(_0x9471('0x2'))(_0x9471('0x3'));var moment=require(_0x9471('0x4'));var BPromise=require('bluebird');var rp=require(_0x9471('0x5'));var fs=require('fs');var path=require(_0x9471('0x6'));var rimraf=require(_0x9471('0x7'));var config=require(_0x9471('0x8'));var attributes=require(_0x9471('0x9'));module[_0x9471('0xa')]=function(_0x3a7944,_0x31e22a){return _0x3a7944[_0x9471('0xb')](_0x9471('0xc'),attributes,{'tableName':_0x9471('0xd'),'paranoid':![],'indexes':[{'name':_0x9471('0xe'),'fields':[_0x9471('0xf'),_0x9471('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ef5=['./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2a27eb,_0x2451c8){var _0x3e8594=function(_0x4ef9aa){while(--_0x4ef9aa){_0x2a27eb['push'](_0x2a27eb['shift']());}};_0x3e8594(++_0x2451c8);}(_0x7ef5,0x124));var _0x57ef=function(_0x22decc,_0x100238){_0x22decc=_0x22decc-0x0;var _0x2865de=_0x7ef5[_0x22decc];return _0x2865de;};'use strict';var _=require(_0x57ef('0x0'));var util=require('util');var logger=require(_0x57ef('0x1'))(_0x57ef('0x2'));var moment=require(_0x57ef('0x3'));var BPromise=require(_0x57ef('0x4'));var rp=require(_0x57ef('0x5'));var fs=require('fs');var path=require(_0x57ef('0x6'));var rimraf=require('rimraf');var config=require(_0x57ef('0x7'));var attributes=require(_0x57ef('0x8'));module[_0x57ef('0x9')]=function(_0x1c3dbc,_0x5814d0){return _0x1c3dbc[_0x57ef('0xa')](_0x57ef('0xb'),attributes,{'tableName':_0x57ef('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x57ef('0xd'),_0x57ef('0xe')],'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 53aa57a..33b424b 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 _0x16ce=['request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x16ce,0xfb));var _0xe16c=function(_0x4327a8,_0x24c5e1){_0x4327a8=_0x4327a8-0x0;var _0x4dd91e=_0x16ce[_0x4327a8];return _0x4dd91e;};'use strict';var _=require('lodash');var util=require(_0xe16c('0x0'));var moment=require(_0xe16c('0x1'));var BPromise=require(_0xe16c('0x2'));var rs=require(_0xe16c('0x3'));var fs=require('fs');var Redis=require(_0xe16c('0x4'));var db=require(_0xe16c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe16c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe16c('0x7')][_0xe16c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b149c,_0x1cf3f9,_0x1d8b72){return new BPromise(function(_0x14d6d4,_0x37f822){return client[_0xe16c('0x9')](_0x3b149c,_0x1d8b72)['then'](function(_0x30feb4){logger[_0xe16c('0xa')](_0xe16c('0xb'),_0x1cf3f9,_0xe16c('0xc'));logger[_0xe16c('0xd')](_0xe16c('0xe'),_0x1cf3f9,_0xe16c('0xc'),JSON[_0xe16c('0xf')](_0x30feb4));if(_0x30feb4[_0xe16c('0x10')]){if(_0x30feb4[_0xe16c('0x10')][_0xe16c('0x11')]===0x1f4){logger['error'](_0xe16c('0xb'),_0x1cf3f9,_0x30feb4[_0xe16c('0x10')][_0xe16c('0x12')]);return _0x37f822(_0x30feb4[_0xe16c('0x10')]['message']);}logger['error'](_0xe16c('0xb'),_0x1cf3f9,_0x30feb4[_0xe16c('0x10')][_0xe16c('0x12')]);return _0x14d6d4(_0x30feb4[_0xe16c('0x10')]['message']);}else{logger[_0xe16c('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x1cf3f9,_0xe16c('0xc'));_0x14d6d4(_0x30feb4[_0xe16c('0x13')][_0xe16c('0x12')]);}})['catch'](function(_0x72f37f){logger[_0xe16c('0x10')](_0xe16c('0xb'),_0x1cf3f9,_0x72f37f);_0x37f822(_0x72f37f);});});} \ No newline at end of file +var _0x2581=['request','then','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','Dynamics365Field,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2134ec,_0x630647){var _0x6f6f15=function(_0x263f50){while(--_0x263f50){_0x2134ec['push'](_0x2134ec['shift']());}};_0x6f6f15(++_0x630647);}(_0x2581,0xcb));var _0x1258=function(_0x45ff95,_0x4c138e){_0x45ff95=_0x45ff95-0x0;var _0x3ff0a7=_0x2581[_0x45ff95];return _0x3ff0a7;};'use strict';var _=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var moment=require(_0x1258('0x2'));var BPromise=require(_0x1258('0x3'));var rs=require(_0x1258('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1258('0x5'))['db'];var utils=require(_0x1258('0x6'));var logger=require(_0x1258('0x7'))(_0x1258('0x8'));var config=require(_0x1258('0x9'));var jayson=require(_0x1258('0xa'));var client=jayson[_0x1258('0xb')][_0x1258('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x582ed7,_0x3e1044,_0x21cd98){return new BPromise(function(_0x468494,_0x18bbac){return client[_0x1258('0xd')](_0x582ed7,_0x21cd98)[_0x1258('0xe')](function(_0x429efc){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x3e1044,_0x1258('0xf'));logger[_0x1258('0x10')](_0x1258('0x11'),_0x3e1044,_0x1258('0xf'),JSON['stringify'](_0x429efc));if(_0x429efc[_0x1258('0x12')]){if(_0x429efc[_0x1258('0x12')][_0x1258('0x13')]===0x1f4){logger[_0x1258('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x3e1044,_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);return _0x18bbac(_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);}logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x429efc[_0x1258('0x12')]['message']);return _0x468494(_0x429efc[_0x1258('0x12')]['message']);}else{logger[_0x1258('0x16')](_0x1258('0x15'),_0x3e1044,_0x1258('0xf'));_0x468494(_0x429efc[_0x1258('0x17')][_0x1258('0x14')]);}})['catch'](function(_0x1645a6){logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x1645a6);_0x18bbac(_0x1645a6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 6b7e49b..784e8ea 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 _0x089c=['Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','/:id','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x38cd3b,_0x5bd3d3){var _0x47ba81=function(_0x1ff191){while(--_0x1ff191){_0x38cd3b['push'](_0x38cd3b['shift']());}};_0x47ba81(++_0x5bd3d3);}(_0x089c,0x137));var _0xc089=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x089c[_0x119d5a];return _0x15bff4;};'use strict';var multer=require(_0xc089('0x0'));var util=require(_0xc089('0x1'));var path=require('path');var timeout=require(_0xc089('0x2'));var express=require(_0xc089('0x3'));var router=express[_0xc089('0x4')]();var auth=require(_0xc089('0x5'));var interaction=require(_0xc089('0x6'));var config=require('../../config/environment');var controller=require(_0xc089('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc089('0x8'),auth[_0xc089('0x9')](),controller['show']);router[_0xc089('0xa')](_0xc089('0xb'),auth['isAuthenticated'](),controller[_0xc089('0xc')]);router[_0xc089('0xa')](_0xc089('0xd'),auth[_0xc089('0x9')](),controller['getFields']);router[_0xc089('0xe')]('/',auth[_0xc089('0x9')](),controller[_0xc089('0xf')]);router[_0xc089('0xe')]('/:id/configurations',auth[_0xc089('0x9')](),controller[_0xc089('0x10')]);router[_0xc089('0x11')](_0xc089('0x8'),auth['isAuthenticated'](),controller[_0xc089('0x12')]);router[_0xc089('0x13')](_0xc089('0x8'),auth[_0xc089('0x9')](),controller[_0xc089('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5b04=['getFields','post','put','/:id','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x4024c2,_0x540a45){var _0x25425f=function(_0x470b42){while(--_0x470b42){_0x4024c2['push'](_0x4024c2['shift']());}};_0x25425f(++_0x540a45);}(_0x5b04,0xcc));var _0x45b0=function(_0x5b1de2,_0x341f61){_0x5b1de2=_0x5b1de2-0x0;var _0x13d13e=_0x5b04[_0x5b1de2];return _0x13d13e;};'use strict';var multer=require('multer');var util=require(_0x45b0('0x0'));var path=require(_0x45b0('0x1'));var timeout=require(_0x45b0('0x2'));var express=require(_0x45b0('0x3'));var router=express[_0x45b0('0x4')]();var auth=require(_0x45b0('0x5'));var interaction=require(_0x45b0('0x6'));var config=require(_0x45b0('0x7'));var controller=require(_0x45b0('0x8'));router[_0x45b0('0x9')]('/',auth[_0x45b0('0xa')](),controller[_0x45b0('0xb')]);router['get']('/:id',auth[_0x45b0('0xa')](),controller[_0x45b0('0xc')]);router[_0x45b0('0x9')](_0x45b0('0xd'),auth['isAuthenticated'](),controller[_0x45b0('0xe')]);router['get'](_0x45b0('0xf'),auth[_0x45b0('0xa')](),controller[_0x45b0('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x45b0('0x11')](_0x45b0('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x45b0('0x12')](_0x45b0('0x13'),auth[_0x45b0('0xa')](),controller['update']);router[_0x45b0('0x14')](_0x45b0('0x13'),auth['isAuthenticated'](),controller[_0x45b0('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index a5140dc..cf2c9c5 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 _0x42b3=['sequelize','STRING','username','remoteUri'];(function(_0x5e9689,_0x48e034){var _0x2fac94=function(_0x1e8f97){while(--_0x1e8f97){_0x5e9689['push'](_0x5e9689['shift']());}};_0x2fac94(++_0x48e034);}(_0x42b3,0xf0));var _0x342b=function(_0x2fefdc,_0x8160c9){_0x2fefdc=_0x2fefdc-0x0;var _0xf3823a=_0x42b3[_0x2fefdc];return _0xf3823a;};'use strict';var Sequelize=require(_0x342b('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x342b('0x1')],'unique':_0x342b('0x2')},'apiKey':{'type':Sequelize[_0x342b('0x1')]},'remoteUri':{'type':Sequelize[_0x342b('0x1')],'unique':_0x342b('0x3')},'serverUrl':{'type':Sequelize[_0x342b('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x1a03=['username','sequelize','exports','STRING'];(function(_0xd0622,_0x47452c){var _0x15e82a=function(_0x578a31){while(--_0x578a31){_0xd0622['push'](_0xd0622['shift']());}};_0x15e82a(++_0x47452c);}(_0x1a03,0x135));var _0x31a0=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0x1a03[_0x3a2118];return _0x1d181d;};'use strict';var Sequelize=require(_0x31a0('0x0'));module[_0x31a0('0x1')]={'name':{'type':Sequelize[_0x31a0('0x2')]},'description':{'type':Sequelize[_0x31a0('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x31a0('0x3')},'apiKey':{'type':Sequelize[_0x31a0('0x2')]},'remoteUri':{'type':Sequelize[_0x31a0('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x31a0('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 6295b53..af6ff87 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 _0x7a62=['create','body','params','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','findOne','remoteUri','apiKey','slice','lastIndexOf','%s/%s','Basic\x20%s','format','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','default','custom_text','custom_dropdown','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','find'];(function(_0x40ad50,_0x2f5891){var _0x2ede7d=function(_0x4352a3){while(--_0x4352a3){_0x40ad50['push'](_0x40ad50['shift']());}};_0x2ede7d(++_0x2f5891);}(_0x7a62,0x12f));var _0x27a6=function(_0x5a3b8f,_0x4dda35){_0x5a3b8f=_0x5a3b8f-0x0;var _0x28e198=_0x7a62[_0x5a3b8f];return _0x28e198;};'use strict';var pdf=require(_0x27a6('0x0'));var emlformat=require(_0x27a6('0x1'));var rimraf=require(_0x27a6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x27a6('0x3'));var BPromise=require(_0x27a6('0x4'));var Mustache=require(_0x27a6('0x5'));var util=require(_0x27a6('0x6'));var path=require(_0x27a6('0x7'));var sox=require(_0x27a6('0x8'));var csv=require(_0x27a6('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x27a6('0xa'));var squel=require(_0x27a6('0xb'));var crypto=require(_0x27a6('0xc'));var jsforce=require(_0x27a6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x27a6('0x9'));var querystring=require(_0x27a6('0xe'));var Papa=require(_0x27a6('0xf'));var Redis=require(_0x27a6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x27a6('0x11'));var as=require(_0x27a6('0x12'));var hardwareService=require(_0x27a6('0x13'));var logger=require(_0x27a6('0x14'))('api');var utils=require(_0x27a6('0x15'));var config=require(_0x27a6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x27a6('0x17'))['db'];var integrations=require(_0x27a6('0x18'));var jayson=require(_0x27a6('0x19'));var client=jayson[_0x27a6('0x1a')][_0x27a6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3a3a8d,_0x3dc4b3,_0x2fac3a,_0x2b4fed){return new BPromise(function(_0x58bc6a,_0x3a5ba1){var _0x383082=_0x2b4fed||client;return _0x383082[_0x27a6('0x1c')](_0x3a3a8d,_0x2fac3a)[_0x27a6('0x1d')](function(_0x1986c0){logger[_0x27a6('0x1e')](_0x27a6('0x1f'),_0x3dc4b3,_0x27a6('0x20'));logger['debug'](_0x27a6('0x21'),_0x3dc4b3,'request\x20sent',JSON[_0x27a6('0x22')](_0x1986c0));if(_0x1986c0[_0x27a6('0x23')]){if(_0x1986c0[_0x27a6('0x23')]['code']===0x1f4){logger[_0x27a6('0x23')](_0x27a6('0x1f'),_0x3dc4b3,_0x1986c0['error'][_0x27a6('0x24')]);return _0x3a5ba1(_0x1986c0['error']['message']);}logger[_0x27a6('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x3dc4b3,_0x1986c0['error'][_0x27a6('0x24')]);return _0x58bc6a(_0x1986c0[_0x27a6('0x23')][_0x27a6('0x24')]);}else{logger[_0x27a6('0x1e')](_0x27a6('0x1f'),_0x3dc4b3,'request\x20sent');_0x58bc6a(_0x1986c0['result'][_0x27a6('0x24')]);}})[_0x27a6('0x25')](function(_0x272a1a){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x3dc4b3,_0x272a1a);_0x3a5ba1(_0x272a1a);});});}function respondWithStatusCode(_0xd3b403,_0x363994){_0x363994=_0x363994||0xcc;return function(_0x1cc98a){if(_0x1cc98a){return _0xd3b403[_0x27a6('0x26')](_0x363994);}return _0xd3b403[_0x27a6('0x27')](_0x363994)[_0x27a6('0x28')]();};}function respondWithResult(_0x5f25f4,_0x932feb){_0x932feb=_0x932feb||0xc8;return function(_0x28fd9d){if(_0x28fd9d){return _0x5f25f4[_0x27a6('0x27')](_0x932feb)[_0x27a6('0x29')](_0x28fd9d);}};}function respondWithFilteredResult(_0x36de42,_0x4db7ba){return function(_0x19fa22){if(_0x19fa22){var _0x58786d=_0x19fa22['count'],_0x4ce49f=_0x4db7ba[_0x27a6('0x2a')],_0x2c5e1f=_0x4db7ba[_0x27a6('0x2a')]+_0x4db7ba[_0x27a6('0x2b')],_0x4eef68;if(_0x2c5e1f>=_0x58786d){_0x2c5e1f=_0x58786d;_0x4eef68=0xc8;}else{_0x4eef68=0xce;}_0x36de42[_0x27a6('0x27')](_0x4eef68);return _0x36de42[_0x27a6('0x2c')](_0x27a6('0x2d'),_0x4ce49f+'-'+_0x2c5e1f+'/'+_0x58786d)[_0x27a6('0x29')](_0x19fa22);}return null;};}function patchUpdates(_0x4c8a09){return function(_0x39fcaf){try{jsonpatch[_0x27a6('0x2e')](_0x39fcaf,_0x4c8a09,!![]);}catch(_0x2fd4d6){return BPromise[_0x27a6('0x2f')](_0x2fd4d6);}return _0x39fcaf[_0x27a6('0x30')]();};}function saveUpdates(_0xc8b1a,_0x27321b){return function(_0x47689a){if(_0x47689a){return _0x47689a[_0x27a6('0x31')](_0xc8b1a)[_0x27a6('0x1d')](function(_0x2618c0){return _0x2618c0;});}return null;};}function removeEntity(_0x39d2d2,_0x3c4d85){return function(_0x5298d0){if(_0x5298d0){return _0x5298d0[_0x27a6('0x32')]()[_0x27a6('0x1d')](function(){_0x39d2d2['status'](0xcc)[_0x27a6('0x28')]();});}};}function handleEntityNotFound(_0x93661b,_0x2e4639){return function(_0xbdc149){if(!_0xbdc149){_0x93661b[_0x27a6('0x26')](0x194);}return _0xbdc149;};}function handleError(_0x5aa5de,_0x45593a){_0x45593a=_0x45593a||0x1f4;return function(_0x30d5bf){logger[_0x27a6('0x23')](_0x30d5bf[_0x27a6('0x33')]);if(_0x30d5bf[_0x27a6('0x34')]){delete _0x30d5bf[_0x27a6('0x34')];}_0x5aa5de[_0x27a6('0x27')](_0x45593a)[_0x27a6('0x35')](_0x30d5bf);};}exports['index']=function(_0x34a8f2,_0x5dd4d3){var _0x40a5f0={},_0xd121a7={},_0x376fb1={'count':0x0,'rows':[]};var _0x5bbfc3=_[_0x27a6('0x36')](db[_0x27a6('0x37')][_0x27a6('0x38')],function(_0x332664){return{'name':_0x332664[_0x27a6('0x39')],'type':_0x332664[_0x27a6('0x3a')][_0x27a6('0x3b')]};});_0xd121a7[_0x27a6('0x3c')]=_[_0x27a6('0x36')](_0x5bbfc3,_0x27a6('0x34'));_0xd121a7[_0x27a6('0x3d')]=_[_0x27a6('0x3e')](_0x34a8f2[_0x27a6('0x3d')]);_0xd121a7[_0x27a6('0x3f')]=_[_0x27a6('0x40')](_0xd121a7[_0x27a6('0x3c')],_0xd121a7[_0x27a6('0x3d')]);_0x40a5f0[_0x27a6('0x41')]=_[_0x27a6('0x40')](_0xd121a7[_0x27a6('0x3c')],qs[_0x27a6('0x42')](_0x34a8f2['query'][_0x27a6('0x42')]));_0x40a5f0[_0x27a6('0x41')]=_0x40a5f0[_0x27a6('0x41')][_0x27a6('0x43')]?_0x40a5f0[_0x27a6('0x41')]:_0xd121a7['model'];if(!_0x34a8f2[_0x27a6('0x3d')]['hasOwnProperty'](_0x27a6('0x44'))){_0x40a5f0[_0x27a6('0x2b')]=qs[_0x27a6('0x2b')](_0x34a8f2['query'][_0x27a6('0x2b')]);_0x40a5f0['offset']=qs[_0x27a6('0x2a')](_0x34a8f2['query']['offset']);}_0x40a5f0[_0x27a6('0x45')]=qs[_0x27a6('0x46')](_0x34a8f2[_0x27a6('0x3d')][_0x27a6('0x46')]);_0x40a5f0[_0x27a6('0x47')]=qs[_0x27a6('0x3f')](_[_0x27a6('0x48')](_0x34a8f2['query'],_0xd121a7[_0x27a6('0x3f')]),_0x5bbfc3);if(_0x34a8f2[_0x27a6('0x3d')][_0x27a6('0x49')]){_0x40a5f0['where']=_['merge'](_0x40a5f0[_0x27a6('0x47')],{'$or':_['map'](_0x5bbfc3,function(_0x9a25be){if(_0x9a25be[_0x27a6('0x3a')]!==_0x27a6('0x4a')){var _0x2ae958={};_0x2ae958[_0x9a25be[_0x27a6('0x34')]]={'$like':'%'+_0x34a8f2[_0x27a6('0x3d')]['filter']+'%'};return _0x2ae958;}})});}_0x40a5f0=_[_0x27a6('0x4b')]({},_0x40a5f0,_0x34a8f2[_0x27a6('0x4c')]);var _0x361ab7={'where':_0x40a5f0[_0x27a6('0x47')]};return db[_0x27a6('0x37')][_0x27a6('0x4d')](_0x361ab7)['then'](function(_0x283186){_0x376fb1[_0x27a6('0x4d')]=_0x283186;if(_0x34a8f2['query'][_0x27a6('0x4e')]){_0x40a5f0[_0x27a6('0x4f')]=[{'all':!![]}];}return db[_0x27a6('0x37')][_0x27a6('0x50')](_0x40a5f0);})[_0x27a6('0x1d')](function(_0x2c285e){_0x376fb1[_0x27a6('0x51')]=_0x2c285e;return _0x376fb1;})['then'](respondWithFilteredResult(_0x5dd4d3,_0x40a5f0))[_0x27a6('0x25')](handleError(_0x5dd4d3,null));};exports[_0x27a6('0x52')]=function(_0x3d57fb,_0xa15988){var _0x1b6396={'raw':![],'where':{'id':_0x3d57fb['params']['id']}},_0x30c77e={};_0x30c77e['model']=_['keys'](db[_0x27a6('0x37')]['rawAttributes']);_0x30c77e[_0x27a6('0x3d')]=_['keys'](_0x3d57fb['query']);_0x30c77e[_0x27a6('0x3f')]=_[_0x27a6('0x40')](_0x30c77e[_0x27a6('0x3c')],_0x30c77e[_0x27a6('0x3d')]);_0x1b6396[_0x27a6('0x41')]=_['intersection'](_0x30c77e[_0x27a6('0x3c')],qs['fields'](_0x3d57fb[_0x27a6('0x3d')][_0x27a6('0x42')]));_0x1b6396['attributes']=_0x1b6396[_0x27a6('0x41')][_0x27a6('0x43')]?_0x1b6396['attributes']:_0x30c77e['model'];if(_0x3d57fb[_0x27a6('0x3d')]['includeAll']){_0x1b6396[_0x27a6('0x4f')]=[{'all':!![]}];}_0x1b6396=_['merge']({},_0x1b6396,_0x3d57fb['options']);return db[_0x27a6('0x37')][_0x27a6('0x53')](_0x1b6396)[_0x27a6('0x1d')](handleEntityNotFound(_0xa15988,null))[_0x27a6('0x1d')](respondWithResult(_0xa15988,null))[_0x27a6('0x25')](handleError(_0xa15988,null));};exports[_0x27a6('0x54')]=function(_0x2ebda9,_0x2c8f0a){return db[_0x27a6('0x37')][_0x27a6('0x54')](_0x2ebda9['body'],{})[_0x27a6('0x1d')](respondWithResult(_0x2c8f0a,0xc9))[_0x27a6('0x25')](handleError(_0x2c8f0a,null));};exports[_0x27a6('0x31')]=function(_0x3ac728,_0x27f10b){if(_0x3ac728[_0x27a6('0x55')]['id']){delete _0x3ac728[_0x27a6('0x55')]['id'];}return db[_0x27a6('0x37')][_0x27a6('0x53')]({'where':{'id':_0x3ac728[_0x27a6('0x56')]['id']}})[_0x27a6('0x1d')](handleEntityNotFound(_0x27f10b,null))[_0x27a6('0x1d')](saveUpdates(_0x3ac728['body'],null))['then'](respondWithResult(_0x27f10b,null))[_0x27a6('0x25')](handleError(_0x27f10b,null));};exports['destroy']=function(_0x5c7195,_0x33d173){return db[_0x27a6('0x37')][_0x27a6('0x53')]({'where':{'id':_0x5c7195[_0x27a6('0x56')]['id']}})[_0x27a6('0x1d')](handleEntityNotFound(_0x33d173,null))['then'](removeEntity(_0x33d173,null))[_0x27a6('0x25')](handleError(_0x33d173,null));};exports['getConfigurations']=function(_0x54af7b,_0x4611ce,_0x43d867){var _0x19aeea={};var _0x5e5ed0={};var _0x44f38f;var _0x469b6f;return db[_0x27a6('0x37')]['findOne']({'where':{'id':_0x54af7b['params']['id']}})['then'](handleEntityNotFound(_0x4611ce,null))[_0x27a6('0x1d')](function(_0x564bd5){if(_0x564bd5){_0x44f38f=_0x564bd5;_0x5e5ed0['model']=_[_0x27a6('0x3e')](db['FreshdeskConfiguration'][_0x27a6('0x38')]);_0x5e5ed0[_0x27a6('0x3d')]=_['keys'](_0x54af7b[_0x27a6('0x3d')]);_0x5e5ed0[_0x27a6('0x3f')]=_[_0x27a6('0x40')](_0x5e5ed0[_0x27a6('0x3c')],_0x5e5ed0['query']);_0x19aeea[_0x27a6('0x41')]=_[_0x27a6('0x40')](_0x5e5ed0[_0x27a6('0x3c')],qs['fields'](_0x54af7b[_0x27a6('0x3d')]['fields']));_0x19aeea[_0x27a6('0x41')]=_0x19aeea[_0x27a6('0x41')][_0x27a6('0x43')]?_0x19aeea[_0x27a6('0x41')]:_0x5e5ed0[_0x27a6('0x3c')];_0x19aeea[_0x27a6('0x45')]=qs['sort'](_0x54af7b[_0x27a6('0x3d')][_0x27a6('0x46')]);_0x19aeea['where']=qs[_0x27a6('0x3f')](_[_0x27a6('0x48')](_0x54af7b[_0x27a6('0x3d')],_0x5e5ed0['filters']));if(_0x54af7b[_0x27a6('0x3d')][_0x27a6('0x49')]){_0x19aeea[_0x27a6('0x47')]=_[_0x27a6('0x4b')](_0x19aeea[_0x27a6('0x47')],{'$or':_[_0x27a6('0x36')](_0x19aeea[_0x27a6('0x41')],function(_0xbdf342){var _0xfffc19={};_0xfffc19[_0xbdf342]={'$like':'%'+_0x54af7b[_0x27a6('0x3d')][_0x27a6('0x49')]+'%'};return _0xfffc19;})});}_0x19aeea=_[_0x27a6('0x4b')]({},_0x19aeea,_0x54af7b['options']);return _0x44f38f[_0x27a6('0x57')](_0x19aeea);}})[_0x27a6('0x1d')](function(_0x1930d7){if(_0x1930d7){_0x469b6f=_0x1930d7[_0x27a6('0x43')];if(!_0x54af7b['query'][_0x27a6('0x58')](_0x27a6('0x44'))){_0x19aeea[_0x27a6('0x2b')]=qs['limit'](_0x54af7b[_0x27a6('0x3d')][_0x27a6('0x2b')]);_0x19aeea[_0x27a6('0x2a')]=qs[_0x27a6('0x2a')](_0x54af7b[_0x27a6('0x3d')][_0x27a6('0x2a')]);}return _0x44f38f[_0x27a6('0x57')](_0x19aeea);}})['then'](function(_0x150143){if(_0x150143){return _0x150143?{'count':_0x469b6f,'rows':_0x150143}:null;}})[_0x27a6('0x1d')](respondWithResult(_0x4611ce,null))[_0x27a6('0x25')](handleError(_0x4611ce,null));};exports[_0x27a6('0x59')]=function(_0xd5cbf3,_0x4e4818,_0x4538a7){if(_0xd5cbf3[_0x27a6('0x55')]['id']){delete _0xd5cbf3[_0x27a6('0x55')]['id'];}return db[_0x27a6('0x37')]['findOne']({'where':{'id':_0xd5cbf3[_0x27a6('0x56')]['id']}})['then'](handleEntityNotFound(_0x4e4818,null))[_0x27a6('0x1d')](function(_0x493f44){if(_0x493f44){_0xd5cbf3[_0x27a6('0x55')][_0x27a6('0x5a')]=_0x493f44['id'];_0xd5cbf3[_0x27a6('0x55')][_0x27a6('0x5b')]=integrations[_0x27a6('0x5c')](_0xd5cbf3[_0x27a6('0x55')][_0x27a6('0x5d')],_0xd5cbf3[_0x27a6('0x55')][_0x27a6('0x3a')]);_0xd5cbf3['body'][_0x27a6('0x5e')]=integrations[_0x27a6('0x5f')](_0xd5cbf3[_0x27a6('0x55')]['channel'],_0xd5cbf3[_0x27a6('0x55')][_0x27a6('0x3a')]);return db[_0x27a6('0x60')]['create'](_0xd5cbf3[_0x27a6('0x55')],{'include':[{'model':db['FreshdeskField'],'as':_0x27a6('0x5b')},{'model':db[_0x27a6('0x61')],'as':_0x27a6('0x5e')}]});}return null;})[_0x27a6('0x1d')](respondWithResult(_0x4e4818,null))[_0x27a6('0x25')](handleError(_0x4e4818,null));};exports[_0x27a6('0x62')]=function(_0x244540,_0x1204f5,_0x2c0b35){var _0x404cb9='';return db['FreshdeskAccount'][_0x27a6('0x63')]({'where':{'id':_0x244540[_0x27a6('0x56')]['id']},'attributes':['id',_0x27a6('0x64'),_0x27a6('0x65')]})[_0x27a6('0x1d')](handleEntityNotFound(_0x1204f5,null))[_0x27a6('0x1d')](function(_0x2a5b72){if(_0x2a5b72){_0x404cb9=_0x2a5b72[_0x27a6('0x64')];var _0x4a8222=_0x404cb9[_0x27a6('0x66')](-0x1);if(_0x4a8222==='/'){_0x404cb9=_0x404cb9['substring'](0x0,_0x404cb9[_0x27a6('0x67')](_0x4a8222));}return rp({'method':'GET','uri':util['format'](_0x27a6('0x68'),_0x404cb9,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0x27a6('0x69'),new Buffer(util[_0x27a6('0x6a')](_0x27a6('0x6b'),_0x2a5b72[_0x27a6('0x65')]))[_0x27a6('0x6c')](_0x27a6('0x6d')))},'json':!![]});}})[_0x27a6('0x1d')](function(_0x34b624){if(_0x34b624){var _0x49aabf=[_0x27a6('0x6e'),_0x27a6('0x6f'),_0x27a6('0x70'),_0x27a6('0x71'),_0x27a6('0x27'),_0x27a6('0x72'),_0x27a6('0x73'),_0x27a6('0x74'),_0x27a6('0x75'),_0x27a6('0x73'),_0x27a6('0x76')];_[_0x27a6('0x77')](_0x34b624,function(_0x11f624){return _0x49aabf['includes'](_0x11f624[_0x27a6('0x34')])||!_0x11f624[_0x27a6('0x78')]&&_0x11f624[_0x27a6('0x3a')]!==_0x27a6('0x79')&&_0x11f624['type']!==_0x27a6('0x7a');});return{'count':_0x34b624['length'],'rows':_[_0x27a6('0x36')](_0x34b624,function(_0x4b40ee){return{'id':_0x4b40ee[_0x27a6('0x34')],'name':_0x4b40ee[_0x27a6('0x7b')],'custom':!_0x4b40ee['default'],'options':_0x4b40ee[_0x27a6('0x7c')]?_[_0x27a6('0x36')](_0x4b40ee[_0x27a6('0x7c')],function(_0x343045){return{'name':_['capitalize'](_0x343045),'value':_0x343045};}):[]};})};}})[_0x27a6('0x1d')](respondWithResult(_0x1204f5,null))[_0x27a6('0x25')](function(_0x1f86fe){var _0x33933a=_0x244540[_0x27a6('0x3d')]['test']?0x1f4:_0x1f86fe[_0x27a6('0x7d')]||0x1f4;logger[_0x27a6('0x23')](_0x27a6('0x7e'),_0x27a6('0x62'),_0x33933a,JSON[_0x27a6('0x22')](_0x1f86fe));delete _0x1f86fe['name'];if(_0x33933a===0x191){_0x33933a=0x190;}_0x1204f5[_0x27a6('0x27')](_0x33933a)[_0x27a6('0x35')](_0x244540['query'][_0x27a6('0x7f')]?{'message':_0x27a6('0x80'),'statusCode':_0x1f86fe['statusCode']}:_0x1f86fe);});}; \ No newline at end of file +var _0x0c3c=['AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','slice','lastIndexOf','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','base64','requester','subject','agent','description','priority','group','source','company','remove','default','custom_text','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','destroy','stack','name','send','index','FreshdeskAccount','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','getConfigurations','findOne','addConfiguration'];(function(_0x54b907,_0x29ff96){var _0x363d89=function(_0x184d8f){while(--_0x184d8f){_0x54b907['push'](_0x54b907['shift']());}};_0x363d89(++_0x29ff96);}(_0x0c3c,0x9a));var _0xc0c3=function(_0x54f493,_0x385811){_0x54f493=_0x54f493-0x0;var _0x5f2b47=_0x0c3c[_0x54f493];return _0x5f2b47;};'use strict';var pdf=require(_0xc0c3('0x0'));var emlformat=require(_0xc0c3('0x1'));var rimraf=require(_0xc0c3('0x2'));var zipdir=require(_0xc0c3('0x3'));var jsonpatch=require(_0xc0c3('0x4'));var rp=require(_0xc0c3('0x5'));var moment=require(_0xc0c3('0x6'));var BPromise=require(_0xc0c3('0x7'));var Mustache=require(_0xc0c3('0x8'));var util=require(_0xc0c3('0x9'));var path=require(_0xc0c3('0xa'));var sox=require(_0xc0c3('0xb'));var csv=require('to-csv');var ejs=require(_0xc0c3('0xc'));var fs=require('fs');var _=require(_0xc0c3('0xd'));var squel=require(_0xc0c3('0xe'));var crypto=require(_0xc0c3('0xf'));var jsforce=require(_0xc0c3('0x10'));var deskjs=require(_0xc0c3('0x11'));var toCsv=require(_0xc0c3('0x12'));var querystring=require(_0xc0c3('0x13'));var Papa=require('papaparse');var Redis=require(_0xc0c3('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc0c3('0x15'));var as=require(_0xc0c3('0x16'));var hardwareService=require(_0xc0c3('0x17'));var logger=require(_0xc0c3('0x18'))(_0xc0c3('0x19'));var utils=require(_0xc0c3('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xc0c3('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc0c3('0x1c'));var jayson=require(_0xc0c3('0x1d'));var client=jayson[_0xc0c3('0x1e')][_0xc0c3('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x440a0f,_0x53d4be,_0xfdbb18,_0x2acf5e){return new BPromise(function(_0x568bd8,_0x59b7c7){var _0xcaa4e4=_0x2acf5e||client;return _0xcaa4e4[_0xc0c3('0x20')](_0x440a0f,_0xfdbb18)[_0xc0c3('0x21')](function(_0x57ac05){logger[_0xc0c3('0x22')](_0xc0c3('0x23'),_0x53d4be,'request\x20sent');logger[_0xc0c3('0x24')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x53d4be,_0xc0c3('0x25'),JSON[_0xc0c3('0x26')](_0x57ac05));if(_0x57ac05[_0xc0c3('0x27')]){if(_0x57ac05[_0xc0c3('0x27')]['code']===0x1f4){logger[_0xc0c3('0x27')](_0xc0c3('0x23'),_0x53d4be,_0x57ac05['error'][_0xc0c3('0x28')]);return _0x59b7c7(_0x57ac05[_0xc0c3('0x27')]['message']);}logger[_0xc0c3('0x27')](_0xc0c3('0x23'),_0x53d4be,_0x57ac05[_0xc0c3('0x27')]['message']);return _0x568bd8(_0x57ac05[_0xc0c3('0x27')]['message']);}else{logger[_0xc0c3('0x22')](_0xc0c3('0x23'),_0x53d4be,'request\x20sent');_0x568bd8(_0x57ac05[_0xc0c3('0x29')][_0xc0c3('0x28')]);}})[_0xc0c3('0x2a')](function(_0x51800c){logger[_0xc0c3('0x27')](_0xc0c3('0x23'),_0x53d4be,_0x51800c);_0x59b7c7(_0x51800c);});});}function respondWithStatusCode(_0x9117e0,_0x2b6424){_0x2b6424=_0x2b6424||0xcc;return function(_0x39fbc8){if(_0x39fbc8){return _0x9117e0[_0xc0c3('0x2b')](_0x2b6424);}return _0x9117e0[_0xc0c3('0x2c')](_0x2b6424)[_0xc0c3('0x2d')]();};}function respondWithResult(_0x5e227a,_0x5aee70){_0x5aee70=_0x5aee70||0xc8;return function(_0x455dd1){if(_0x455dd1){return _0x5e227a[_0xc0c3('0x2c')](_0x5aee70)[_0xc0c3('0x2e')](_0x455dd1);}};}function respondWithFilteredResult(_0x5ce61f,_0x3820ea){return function(_0x97b921){if(_0x97b921){var _0x52b4c8=_0x97b921['count'],_0x1ddf65=_0x3820ea[_0xc0c3('0x2f')],_0x482eb4=_0x3820ea['offset']+_0x3820ea[_0xc0c3('0x30')],_0x37346a;if(_0x482eb4>=_0x52b4c8){_0x482eb4=_0x52b4c8;_0x37346a=0xc8;}else{_0x37346a=0xce;}_0x5ce61f[_0xc0c3('0x2c')](_0x37346a);return _0x5ce61f['set'](_0xc0c3('0x31'),_0x1ddf65+'-'+_0x482eb4+'/'+_0x52b4c8)[_0xc0c3('0x2e')](_0x97b921);}return null;};}function patchUpdates(_0x5ce19e){return function(_0x1b24b9){try{jsonpatch['apply'](_0x1b24b9,_0x5ce19e,!![]);}catch(_0x35b319){return BPromise[_0xc0c3('0x32')](_0x35b319);}return _0x1b24b9[_0xc0c3('0x33')]();};}function saveUpdates(_0x11434f,_0x582b1f){return function(_0x52a0b5){if(_0x52a0b5){return _0x52a0b5[_0xc0c3('0x34')](_0x11434f)[_0xc0c3('0x21')](function(_0x3edfa7){return _0x3edfa7;});}return null;};}function removeEntity(_0x33b320,_0x29309e){return function(_0x512e0f){if(_0x512e0f){return _0x512e0f[_0xc0c3('0x35')]()[_0xc0c3('0x21')](function(){_0x33b320[_0xc0c3('0x2c')](0xcc)[_0xc0c3('0x2d')]();});}};}function handleEntityNotFound(_0x3e9622,_0x3ef710){return function(_0x4437d9){if(!_0x4437d9){_0x3e9622['sendStatus'](0x194);}return _0x4437d9;};}function handleError(_0x543411,_0x428270){_0x428270=_0x428270||0x1f4;return function(_0x4a19bc){logger[_0xc0c3('0x27')](_0x4a19bc[_0xc0c3('0x36')]);if(_0x4a19bc[_0xc0c3('0x37')]){delete _0x4a19bc['name'];}_0x543411[_0xc0c3('0x2c')](_0x428270)[_0xc0c3('0x38')](_0x4a19bc);};}exports[_0xc0c3('0x39')]=function(_0x4d52ae,_0x345dd1){var _0x4c9726={},_0xea0fff={},_0x36f443={'count':0x0,'rows':[]};var _0x2b5990=_['map'](db[_0xc0c3('0x3a')]['rawAttributes'],function(_0x3ca11b){return{'name':_0x3ca11b[_0xc0c3('0x3b')],'type':_0x3ca11b[_0xc0c3('0x3c')]['key']};});_0xea0fff[_0xc0c3('0x3d')]=_[_0xc0c3('0x3e')](_0x2b5990,_0xc0c3('0x37'));_0xea0fff[_0xc0c3('0x3f')]=_[_0xc0c3('0x40')](_0x4d52ae['query']);_0xea0fff[_0xc0c3('0x41')]=_[_0xc0c3('0x42')](_0xea0fff['model'],_0xea0fff[_0xc0c3('0x3f')]);_0x4c9726[_0xc0c3('0x43')]=_['intersection'](_0xea0fff[_0xc0c3('0x3d')],qs[_0xc0c3('0x44')](_0x4d52ae[_0xc0c3('0x3f')][_0xc0c3('0x44')]));_0x4c9726[_0xc0c3('0x43')]=_0x4c9726[_0xc0c3('0x43')][_0xc0c3('0x45')]?_0x4c9726[_0xc0c3('0x43')]:_0xea0fff[_0xc0c3('0x3d')];if(!_0x4d52ae[_0xc0c3('0x3f')][_0xc0c3('0x46')](_0xc0c3('0x47'))){_0x4c9726[_0xc0c3('0x30')]=qs['limit'](_0x4d52ae[_0xc0c3('0x3f')][_0xc0c3('0x30')]);_0x4c9726[_0xc0c3('0x2f')]=qs['offset'](_0x4d52ae[_0xc0c3('0x3f')][_0xc0c3('0x2f')]);}_0x4c9726[_0xc0c3('0x48')]=qs['sort'](_0x4d52ae[_0xc0c3('0x3f')][_0xc0c3('0x49')]);_0x4c9726[_0xc0c3('0x4a')]=qs['filters'](_[_0xc0c3('0x4b')](_0x4d52ae[_0xc0c3('0x3f')],_0xea0fff['filters']),_0x2b5990);if(_0x4d52ae[_0xc0c3('0x3f')][_0xc0c3('0x4c')]){_0x4c9726[_0xc0c3('0x4a')]=_['merge'](_0x4c9726[_0xc0c3('0x4a')],{'$or':_[_0xc0c3('0x3e')](_0x2b5990,function(_0x155ba1){if(_0x155ba1[_0xc0c3('0x3c')]!==_0xc0c3('0x4d')){var _0x2e77c9={};_0x2e77c9[_0x155ba1[_0xc0c3('0x37')]]={'$like':'%'+_0x4d52ae[_0xc0c3('0x3f')][_0xc0c3('0x4c')]+'%'};return _0x2e77c9;}})});}_0x4c9726=_[_0xc0c3('0x4e')]({},_0x4c9726,_0x4d52ae[_0xc0c3('0x4f')]);var _0x1c6478={'where':_0x4c9726[_0xc0c3('0x4a')]};return db[_0xc0c3('0x3a')][_0xc0c3('0x50')](_0x1c6478)[_0xc0c3('0x21')](function(_0x413bee){_0x36f443[_0xc0c3('0x50')]=_0x413bee;if(_0x4d52ae[_0xc0c3('0x3f')][_0xc0c3('0x51')]){_0x4c9726[_0xc0c3('0x52')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xc0c3('0x53')](_0x4c9726);})[_0xc0c3('0x21')](function(_0x1ab24d){_0x36f443[_0xc0c3('0x54')]=_0x1ab24d;return _0x36f443;})['then'](respondWithFilteredResult(_0x345dd1,_0x4c9726))['catch'](handleError(_0x345dd1,null));};exports[_0xc0c3('0x55')]=function(_0x5d9d3a,_0x1ed65b){var _0x55a589={'raw':![],'where':{'id':_0x5d9d3a[_0xc0c3('0x56')]['id']}},_0xfc7e6f={};_0xfc7e6f[_0xc0c3('0x3d')]=_[_0xc0c3('0x40')](db['FreshdeskAccount'][_0xc0c3('0x57')]);_0xfc7e6f[_0xc0c3('0x3f')]=_[_0xc0c3('0x40')](_0x5d9d3a[_0xc0c3('0x3f')]);_0xfc7e6f['filters']=_[_0xc0c3('0x42')](_0xfc7e6f[_0xc0c3('0x3d')],_0xfc7e6f['query']);_0x55a589[_0xc0c3('0x43')]=_[_0xc0c3('0x42')](_0xfc7e6f[_0xc0c3('0x3d')],qs[_0xc0c3('0x44')](_0x5d9d3a['query']['fields']));_0x55a589['attributes']=_0x55a589[_0xc0c3('0x43')][_0xc0c3('0x45')]?_0x55a589[_0xc0c3('0x43')]:_0xfc7e6f[_0xc0c3('0x3d')];if(_0x5d9d3a[_0xc0c3('0x3f')]['includeAll']){_0x55a589[_0xc0c3('0x52')]=[{'all':!![]}];}_0x55a589=_['merge']({},_0x55a589,_0x5d9d3a['options']);return db[_0xc0c3('0x3a')][_0xc0c3('0x58')](_0x55a589)[_0xc0c3('0x21')](handleEntityNotFound(_0x1ed65b,null))[_0xc0c3('0x21')](respondWithResult(_0x1ed65b,null))[_0xc0c3('0x2a')](handleError(_0x1ed65b,null));};exports[_0xc0c3('0x59')]=function(_0xe1cb2b,_0x431253){return db[_0xc0c3('0x3a')][_0xc0c3('0x59')](_0xe1cb2b[_0xc0c3('0x5a')],{})['then'](respondWithResult(_0x431253,0xc9))[_0xc0c3('0x2a')](handleError(_0x431253,null));};exports[_0xc0c3('0x34')]=function(_0x37a99b,_0x200f44){if(_0x37a99b[_0xc0c3('0x5a')]['id']){delete _0x37a99b[_0xc0c3('0x5a')]['id'];}return db[_0xc0c3('0x3a')][_0xc0c3('0x58')]({'where':{'id':_0x37a99b[_0xc0c3('0x56')]['id']}})[_0xc0c3('0x21')](handleEntityNotFound(_0x200f44,null))[_0xc0c3('0x21')](saveUpdates(_0x37a99b[_0xc0c3('0x5a')],null))[_0xc0c3('0x21')](respondWithResult(_0x200f44,null))[_0xc0c3('0x2a')](handleError(_0x200f44,null));};exports[_0xc0c3('0x35')]=function(_0x1e162f,_0x3595b6){return db[_0xc0c3('0x3a')][_0xc0c3('0x58')]({'where':{'id':_0x1e162f[_0xc0c3('0x56')]['id']}})[_0xc0c3('0x21')](handleEntityNotFound(_0x3595b6,null))[_0xc0c3('0x21')](removeEntity(_0x3595b6,null))[_0xc0c3('0x2a')](handleError(_0x3595b6,null));};exports[_0xc0c3('0x5b')]=function(_0x36c101,_0x3d980b,_0x3a8d4b){var _0x34f8ac={};var _0x224175={};var _0xb66e72;var _0x51eb85;return db[_0xc0c3('0x3a')][_0xc0c3('0x5c')]({'where':{'id':_0x36c101['params']['id']}})[_0xc0c3('0x21')](handleEntityNotFound(_0x3d980b,null))[_0xc0c3('0x21')](function(_0x4d92e2){if(_0x4d92e2){_0xb66e72=_0x4d92e2;_0x224175[_0xc0c3('0x3d')]=_[_0xc0c3('0x40')](db['FreshdeskConfiguration'][_0xc0c3('0x57')]);_0x224175['query']=_['keys'](_0x36c101[_0xc0c3('0x3f')]);_0x224175[_0xc0c3('0x41')]=_[_0xc0c3('0x42')](_0x224175[_0xc0c3('0x3d')],_0x224175[_0xc0c3('0x3f')]);_0x34f8ac[_0xc0c3('0x43')]=_[_0xc0c3('0x42')](_0x224175[_0xc0c3('0x3d')],qs['fields'](_0x36c101[_0xc0c3('0x3f')][_0xc0c3('0x44')]));_0x34f8ac[_0xc0c3('0x43')]=_0x34f8ac[_0xc0c3('0x43')][_0xc0c3('0x45')]?_0x34f8ac[_0xc0c3('0x43')]:_0x224175['model'];_0x34f8ac[_0xc0c3('0x48')]=qs[_0xc0c3('0x49')](_0x36c101[_0xc0c3('0x3f')][_0xc0c3('0x49')]);_0x34f8ac[_0xc0c3('0x4a')]=qs[_0xc0c3('0x41')](_[_0xc0c3('0x4b')](_0x36c101[_0xc0c3('0x3f')],_0x224175[_0xc0c3('0x41')]));if(_0x36c101[_0xc0c3('0x3f')]['filter']){_0x34f8ac['where']=_[_0xc0c3('0x4e')](_0x34f8ac[_0xc0c3('0x4a')],{'$or':_[_0xc0c3('0x3e')](_0x34f8ac[_0xc0c3('0x43')],function(_0x1de4e5){var _0x55a0d7={};_0x55a0d7[_0x1de4e5]={'$like':'%'+_0x36c101[_0xc0c3('0x3f')][_0xc0c3('0x4c')]+'%'};return _0x55a0d7;})});}_0x34f8ac=_[_0xc0c3('0x4e')]({},_0x34f8ac,_0x36c101[_0xc0c3('0x4f')]);return _0xb66e72['getConfigurations'](_0x34f8ac);}})[_0xc0c3('0x21')](function(_0x157750){if(_0x157750){_0x51eb85=_0x157750['length'];if(!_0x36c101[_0xc0c3('0x3f')][_0xc0c3('0x46')](_0xc0c3('0x47'))){_0x34f8ac[_0xc0c3('0x30')]=qs[_0xc0c3('0x30')](_0x36c101['query'][_0xc0c3('0x30')]);_0x34f8ac[_0xc0c3('0x2f')]=qs[_0xc0c3('0x2f')](_0x36c101['query'][_0xc0c3('0x2f')]);}return _0xb66e72[_0xc0c3('0x5b')](_0x34f8ac);}})[_0xc0c3('0x21')](function(_0x45bbfd){if(_0x45bbfd){return _0x45bbfd?{'count':_0x51eb85,'rows':_0x45bbfd}:null;}})['then'](respondWithResult(_0x3d980b,null))[_0xc0c3('0x2a')](handleError(_0x3d980b,null));};exports[_0xc0c3('0x5d')]=function(_0x144b76,_0x54de2d,_0x40c74e){if(_0x144b76[_0xc0c3('0x5a')]['id']){delete _0x144b76[_0xc0c3('0x5a')]['id'];}return db['FreshdeskAccount'][_0xc0c3('0x5c')]({'where':{'id':_0x144b76['params']['id']}})[_0xc0c3('0x21')](handleEntityNotFound(_0x54de2d,null))['then'](function(_0x297321){if(_0x297321){_0x144b76[_0xc0c3('0x5a')][_0xc0c3('0x5e')]=_0x297321['id'];_0x144b76[_0xc0c3('0x5a')][_0xc0c3('0x5f')]=integrations[_0xc0c3('0x60')](_0x144b76[_0xc0c3('0x5a')]['channel'],_0x144b76[_0xc0c3('0x5a')][_0xc0c3('0x3c')]);_0x144b76['body'][_0xc0c3('0x61')]=integrations[_0xc0c3('0x62')](_0x144b76[_0xc0c3('0x5a')]['channel'],_0x144b76[_0xc0c3('0x5a')][_0xc0c3('0x3c')]);return db['FreshdeskConfiguration'][_0xc0c3('0x59')](_0x144b76[_0xc0c3('0x5a')],{'include':[{'model':db[_0xc0c3('0x63')],'as':'Subjects'},{'model':db[_0xc0c3('0x63')],'as':_0xc0c3('0x61')}]});}return null;})[_0xc0c3('0x21')](respondWithResult(_0x54de2d,null))[_0xc0c3('0x2a')](handleError(_0x54de2d,null));};exports[_0xc0c3('0x64')]=function(_0x18dcc2,_0xdf9365,_0x4045df){var _0x5882ce='';return db[_0xc0c3('0x3a')][_0xc0c3('0x5c')]({'where':{'id':_0x18dcc2[_0xc0c3('0x56')]['id']},'attributes':['id','remoteUri',_0xc0c3('0x65')]})[_0xc0c3('0x21')](handleEntityNotFound(_0xdf9365,null))['then'](function(_0x1809a7){if(_0x1809a7){_0x5882ce=_0x1809a7['remoteUri'];var _0x216dc3=_0x5882ce[_0xc0c3('0x66')](-0x1);if(_0x216dc3==='/'){_0x5882ce=_0x5882ce['substring'](0x0,_0x5882ce[_0xc0c3('0x67')](_0x216dc3));}return rp({'method':'GET','uri':util['format'](_0xc0c3('0x68'),_0x5882ce,_0xc0c3('0x69')),'headers':{'Authorization':util[_0xc0c3('0x6a')](_0xc0c3('0x6b'),new Buffer(util[_0xc0c3('0x6a')]('%s:X',_0x1809a7[_0xc0c3('0x65')]))['toString'](_0xc0c3('0x6c')))},'json':!![]});}})[_0xc0c3('0x21')](function(_0x34375e){if(_0x34375e){var _0x4efbfe=[_0xc0c3('0x6d'),_0xc0c3('0x6e'),_0xc0c3('0x6f'),_0xc0c3('0x70'),_0xc0c3('0x2c'),_0xc0c3('0x71'),_0xc0c3('0x72'),_0xc0c3('0x73'),'ticket_type',_0xc0c3('0x72'),_0xc0c3('0x74')];_[_0xc0c3('0x75')](_0x34375e,function(_0x46c857){return _0x4efbfe['includes'](_0x46c857['name'])||!_0x46c857[_0xc0c3('0x76')]&&_0x46c857['type']!==_0xc0c3('0x77')&&_0x46c857[_0xc0c3('0x3c')]!=='custom_dropdown';});return{'count':_0x34375e[_0xc0c3('0x45')],'rows':_[_0xc0c3('0x3e')](_0x34375e,function(_0x307463){return{'id':_0x307463[_0xc0c3('0x37')],'name':_0x307463['label'],'custom':!_0x307463[_0xc0c3('0x76')],'options':_0x307463[_0xc0c3('0x78')]?_[_0xc0c3('0x3e')](_0x307463['choices'],function(_0x37dbd9){return{'name':_['capitalize'](_0x37dbd9),'value':_0x37dbd9};}):[]};})};}})['then'](respondWithResult(_0xdf9365,null))['catch'](function(_0x361f9c){var _0x5b341e=_0x18dcc2[_0xc0c3('0x3f')][_0xc0c3('0x79')]?0x1f4:_0x361f9c[_0xc0c3('0x7a')]||0x1f4;logger[_0xc0c3('0x27')](_0xc0c3('0x7b'),_0xc0c3('0x64'),_0x5b341e,JSON[_0xc0c3('0x26')](_0x361f9c));delete _0x361f9c[_0xc0c3('0x37')];if(_0x5b341e===0x191){_0x5b341e=0x190;}_0xdf9365[_0xc0c3('0x2c')](_0x5b341e)[_0xc0c3('0x38')](_0x18dcc2['query'][_0xc0c3('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x361f9c[_0xc0c3('0x7a')]}:_0x361f9c);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index c20bf6f..8c03d10 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 _0xfec7=['int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define'];(function(_0x374f00,_0x56045c){var _0x58abd6=function(_0x1a929b){while(--_0x1a929b){_0x374f00['push'](_0x374f00['shift']());}};_0x58abd6(++_0x56045c);}(_0xfec7,0x11f));var _0x7fec=function(_0x4ecc0f,_0x13afbf){_0x4ecc0f=_0x4ecc0f-0x0;var _0x2bc271=_0xfec7[_0x4ecc0f];return _0x2bc271;};'use strict';var _=require(_0x7fec('0x0'));var util=require('util');var logger=require(_0x7fec('0x1'))(_0x7fec('0x2'));var moment=require(_0x7fec('0x3'));var BPromise=require(_0x7fec('0x4'));var rp=require(_0x7fec('0x5'));var fs=require('fs');var path=require(_0x7fec('0x6'));var rimraf=require(_0x7fec('0x7'));var config=require(_0x7fec('0x8'));var attributes=require(_0x7fec('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7fec('0xa')]=function(_0x216ec6,_0x1899ff){return _0x216ec6[_0x7fec('0xb')]('FreshdeskAccount',attributes,{'tableName':_0x7fec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b10=['int_freshdesk_accounts','lodash','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x8b10,0xc7));var _0x08b1=function(_0x18e42f,_0x24c3bf){_0x18e42f=_0x18e42f-0x0;var _0x28e072=_0x8b10[_0x18e42f];return _0x28e072;};'use strict';var _=require(_0x08b1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x08b1('0x1'));var BPromise=require('bluebird');var rp=require(_0x08b1('0x2'));var fs=require('fs');var path=require(_0x08b1('0x3'));var rimraf=require(_0x08b1('0x4'));var config=require(_0x08b1('0x5'));var attributes=require(_0x08b1('0x6'));var integrations=require(_0x08b1('0x7'));module['exports']=function(_0x497f2e,_0x56a762){return _0x497f2e[_0x08b1('0x8')](_0x08b1('0x9'),attributes,{'tableName':_0x08b1('0xa'),'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 2128673..8f9189c 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 _0xaa79=['FreshdeskAccount','options','raw','where','limit','include','model','attributes','map','ShowFreshdeskAccount','find','lodash','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount'];(function(_0x21481c,_0x1b51ba){var _0x5dd77a=function(_0x4ee13c){while(--_0x4ee13c){_0x21481c['push'](_0x21481c['shift']());}};_0x5dd77a(++_0x1b51ba);}(_0xaa79,0xf2));var _0x9aa7=function(_0xc71df4,_0x4e1435){_0xc71df4=_0xc71df4-0x0;var _0x203e52=_0xaa79[_0xc71df4];return _0x203e52;};'use strict';var _=require(_0x9aa7('0x0'));var util=require('util');var moment=require(_0x9aa7('0x1'));var BPromise=require(_0x9aa7('0x2'));var rs=require(_0x9aa7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9aa7('0x4'));var logger=require('../../config/logger')(_0x9aa7('0x5'));var config=require('../../config/environment');var jayson=require(_0x9aa7('0x6'));var client=jayson['client'][_0x9aa7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3acf9b,_0x38abda,_0x7b6cb){return new BPromise(function(_0x1e2ff6,_0x41308d){return client[_0x9aa7('0x8')](_0x3acf9b,_0x7b6cb)[_0x9aa7('0x9')](function(_0x3d3657){logger[_0x9aa7('0xa')](_0x9aa7('0xb'),_0x38abda,_0x9aa7('0xc'));logger[_0x9aa7('0xd')](_0x9aa7('0xe'),_0x38abda,_0x9aa7('0xc'),JSON[_0x9aa7('0xf')](_0x3d3657));if(_0x3d3657[_0x9aa7('0x10')]){if(_0x3d3657[_0x9aa7('0x10')][_0x9aa7('0x11')]===0x1f4){logger[_0x9aa7('0x10')](_0x9aa7('0xb'),_0x38abda,_0x3d3657['error'][_0x9aa7('0x12')]);return _0x41308d(_0x3d3657[_0x9aa7('0x10')][_0x9aa7('0x12')]);}logger[_0x9aa7('0x10')](_0x9aa7('0xb'),_0x38abda,_0x3d3657[_0x9aa7('0x10')][_0x9aa7('0x12')]);return _0x1e2ff6(_0x3d3657[_0x9aa7('0x10')][_0x9aa7('0x12')]);}else{logger[_0x9aa7('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x38abda,_0x9aa7('0xc'));_0x1e2ff6(_0x3d3657[_0x9aa7('0x13')][_0x9aa7('0x12')]);}})[_0x9aa7('0x14')](function(_0x590da7){logger[_0x9aa7('0x10')](_0x9aa7('0xb'),_0x38abda,_0x590da7);_0x41308d(_0x590da7);});});}exports[_0x9aa7('0x15')]=function(_0x2fc7bf){var _0x4420ed=this;return new Promise(function(_0x350c6a,_0x26a9a2){return db[_0x9aa7('0x16')]['findAll']({'raw':_0x2fc7bf[_0x9aa7('0x17')]?_0x2fc7bf[_0x9aa7('0x17')][_0x9aa7('0x18')]===undefined?!![]:![]:!![],'where':_0x2fc7bf['options']?_0x2fc7bf[_0x9aa7('0x17')][_0x9aa7('0x19')]||null:null,'attributes':_0x2fc7bf[_0x9aa7('0x17')]?_0x2fc7bf[_0x9aa7('0x17')]['attributes']||null:null,'limit':_0x2fc7bf[_0x9aa7('0x17')]?_0x2fc7bf[_0x9aa7('0x17')][_0x9aa7('0x1a')]||null:null,'include':_0x2fc7bf['options']?_0x2fc7bf[_0x9aa7('0x17')][_0x9aa7('0x1b')]?_['map'](_0x2fc7bf[_0x9aa7('0x17')][_0x9aa7('0x1b')],function(_0x5e1788){return{'model':db[_0x5e1788[_0x9aa7('0x1c')]],'as':_0x5e1788['as'],'attributes':_0x5e1788['attributes'],'include':_0x5e1788[_0x9aa7('0x1b')]?_['map'](_0x5e1788[_0x9aa7('0x1b')],function(_0x516409){return{'model':db[_0x516409[_0x9aa7('0x1c')]],'as':_0x516409['as'],'attributes':_0x516409[_0x9aa7('0x1d')],'include':_0x516409['include']?_[_0x9aa7('0x1e')](_0x516409[_0x9aa7('0x1b')],function(_0x3a18c9){return{'model':db[_0x3a18c9['model']],'as':_0x3a18c9['as'],'attributes':_0x3a18c9[_0x9aa7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9aa7('0x9')](function(_0x1f8c38){logger['info'](_0x9aa7('0x15'),_0x2fc7bf);logger[_0x9aa7('0xd')]('GetFreshdeskAccount',_0x2fc7bf,JSON[_0x9aa7('0xf')](_0x1f8c38));_0x350c6a(_0x1f8c38);})[_0x9aa7('0x14')](function(_0xd6290e){logger['error'](_0x9aa7('0x15'),_0xd6290e[_0x9aa7('0x12')],_0x2fc7bf);_0x26a9a2(_0x4420ed[_0x9aa7('0x10')](0x1f4,_0xd6290e['message']));});});};exports[_0x9aa7('0x1f')]=function(_0x424da9){var _0x438154=this;return new Promise(function(_0x178177,_0x4d8a8e){return db[_0x9aa7('0x16')][_0x9aa7('0x20')]({'raw':_0x424da9['options']?_0x424da9[_0x9aa7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x424da9[_0x9aa7('0x17')]?_0x424da9['options']['where']||null:null,'attributes':_0x424da9[_0x9aa7('0x17')]?_0x424da9[_0x9aa7('0x17')][_0x9aa7('0x1d')]||null:null,'include':_0x424da9[_0x9aa7('0x17')]?_0x424da9[_0x9aa7('0x17')]['include']?_[_0x9aa7('0x1e')](_0x424da9[_0x9aa7('0x17')][_0x9aa7('0x1b')],function(_0x4fbc08){return{'model':db[_0x4fbc08[_0x9aa7('0x1c')]],'as':_0x4fbc08['as'],'attributes':_0x4fbc08[_0x9aa7('0x1d')],'include':_0x4fbc08[_0x9aa7('0x1b')]?_['map'](_0x4fbc08[_0x9aa7('0x1b')],function(_0x1b06e2){return{'model':db[_0x1b06e2[_0x9aa7('0x1c')]],'as':_0x1b06e2['as'],'attributes':_0x1b06e2['attributes'],'include':_0x1b06e2['include']?_[_0x9aa7('0x1e')](_0x1b06e2['include'],function(_0x5403e5){return{'model':db[_0x5403e5[_0x9aa7('0x1c')]],'as':_0x5403e5['as'],'attributes':_0x5403e5[_0x9aa7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9aa7('0x9')](function(_0x230d76){logger['info'](_0x9aa7('0x1f'),_0x424da9);logger[_0x9aa7('0xd')](_0x9aa7('0x1f'),_0x424da9,JSON[_0x9aa7('0xf')](_0x230d76));_0x178177(_0x230d76);})[_0x9aa7('0x14')](function(_0x4ad6f0){logger[_0x9aa7('0x10')](_0x9aa7('0x1f'),_0x4ad6f0[_0x9aa7('0x12')],_0x424da9);_0x4d8a8e(_0x438154['error'](0x1f4,_0x4ad6f0[_0x9aa7('0x12')]));});});}; \ No newline at end of file +var _0x0534=['FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowFreshdeskAccount','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFreshdeskAccount'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x0534,0x79));var _0x4053=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0x0534[_0x549278];return _0x1ea9a1;};'use strict';var _=require(_0x4053('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4053('0x1'));var rs=require(_0x4053('0x2'));var fs=require('fs');var Redis=require(_0x4053('0x3'));var db=require(_0x4053('0x4'))['db'];var utils=require(_0x4053('0x5'));var logger=require('../../config/logger')(_0x4053('0x6'));var config=require(_0x4053('0x7'));var jayson=require(_0x4053('0x8'));var client=jayson[_0x4053('0x9')][_0x4053('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x423474,_0x2c06c8,_0x461620){return new BPromise(function(_0x2f11a4,_0x595126){return client[_0x4053('0xb')](_0x423474,_0x461620)[_0x4053('0xc')](function(_0x164054){logger['info'](_0x4053('0xd'),_0x2c06c8,_0x4053('0xe'));logger[_0x4053('0xf')](_0x4053('0x10'),_0x2c06c8,_0x4053('0xe'),JSON['stringify'](_0x164054));if(_0x164054[_0x4053('0x11')]){if(_0x164054[_0x4053('0x11')][_0x4053('0x12')]===0x1f4){logger[_0x4053('0x11')](_0x4053('0xd'),_0x2c06c8,_0x164054[_0x4053('0x11')][_0x4053('0x13')]);return _0x595126(_0x164054[_0x4053('0x11')][_0x4053('0x13')]);}logger['error'](_0x4053('0xd'),_0x2c06c8,_0x164054[_0x4053('0x11')][_0x4053('0x13')]);return _0x2f11a4(_0x164054['error'][_0x4053('0x13')]);}else{logger[_0x4053('0x14')](_0x4053('0xd'),_0x2c06c8,_0x4053('0xe'));_0x2f11a4(_0x164054['result'][_0x4053('0x13')]);}})[_0x4053('0x15')](function(_0x3763c1){logger[_0x4053('0x11')](_0x4053('0xd'),_0x2c06c8,_0x3763c1);_0x595126(_0x3763c1);});});}exports[_0x4053('0x16')]=function(_0xe04f68){var _0x5d5287=this;return new Promise(function(_0x42fa9b,_0x431e74){return db[_0x4053('0x17')][_0x4053('0x18')]({'raw':_0xe04f68[_0x4053('0x19')]?_0xe04f68[_0x4053('0x19')][_0x4053('0x1a')]===undefined?!![]:![]:!![],'where':_0xe04f68['options']?_0xe04f68[_0x4053('0x19')][_0x4053('0x1b')]||null:null,'attributes':_0xe04f68[_0x4053('0x19')]?_0xe04f68[_0x4053('0x19')][_0x4053('0x1c')]||null:null,'limit':_0xe04f68[_0x4053('0x19')]?_0xe04f68['options'][_0x4053('0x1d')]||null:null,'include':_0xe04f68[_0x4053('0x19')]?_0xe04f68[_0x4053('0x19')][_0x4053('0x1e')]?_[_0x4053('0x1f')](_0xe04f68['options'][_0x4053('0x1e')],function(_0x52dd9c){return{'model':db[_0x52dd9c[_0x4053('0x20')]],'as':_0x52dd9c['as'],'attributes':_0x52dd9c['attributes'],'include':_0x52dd9c[_0x4053('0x1e')]?_[_0x4053('0x1f')](_0x52dd9c['include'],function(_0x47a126){return{'model':db[_0x47a126[_0x4053('0x20')]],'as':_0x47a126['as'],'attributes':_0x47a126[_0x4053('0x1c')],'include':_0x47a126[_0x4053('0x1e')]?_['map'](_0x47a126['include'],function(_0x5ec435){return{'model':db[_0x5ec435[_0x4053('0x20')]],'as':_0x5ec435['as'],'attributes':_0x5ec435[_0x4053('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4053('0xc')](function(_0x12c7fd){logger[_0x4053('0x14')](_0x4053('0x16'),_0xe04f68);logger[_0x4053('0xf')](_0x4053('0x16'),_0xe04f68,JSON[_0x4053('0x21')](_0x12c7fd));_0x42fa9b(_0x12c7fd);})[_0x4053('0x15')](function(_0x40f6c){logger[_0x4053('0x11')](_0x4053('0x16'),_0x40f6c[_0x4053('0x13')],_0xe04f68);_0x431e74(_0x5d5287[_0x4053('0x11')](0x1f4,_0x40f6c[_0x4053('0x13')]));});});};exports[_0x4053('0x22')]=function(_0x5cdb14){var _0x498228=this;return new Promise(function(_0x35723d,_0x45feb3){return db[_0x4053('0x17')][_0x4053('0x23')]({'raw':_0x5cdb14['options']?_0x5cdb14[_0x4053('0x19')][_0x4053('0x1a')]===undefined?!![]:![]:!![],'where':_0x5cdb14['options']?_0x5cdb14['options'][_0x4053('0x1b')]||null:null,'attributes':_0x5cdb14[_0x4053('0x19')]?_0x5cdb14['options'][_0x4053('0x1c')]||null:null,'include':_0x5cdb14[_0x4053('0x19')]?_0x5cdb14[_0x4053('0x19')][_0x4053('0x1e')]?_[_0x4053('0x1f')](_0x5cdb14[_0x4053('0x19')]['include'],function(_0x49920b){return{'model':db[_0x49920b[_0x4053('0x20')]],'as':_0x49920b['as'],'attributes':_0x49920b[_0x4053('0x1c')],'include':_0x49920b[_0x4053('0x1e')]?_[_0x4053('0x1f')](_0x49920b[_0x4053('0x1e')],function(_0x203203){return{'model':db[_0x203203[_0x4053('0x20')]],'as':_0x203203['as'],'attributes':_0x203203['attributes'],'include':_0x203203[_0x4053('0x1e')]?_[_0x4053('0x1f')](_0x203203[_0x4053('0x1e')],function(_0x4c90e2){return{'model':db[_0x4c90e2['model']],'as':_0x4c90e2['as'],'attributes':_0x4c90e2[_0x4053('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4053('0xc')](function(_0x8af6d1){logger['info'](_0x4053('0x22'),_0x5cdb14);logger['debug']('ShowFreshdeskAccount',_0x5cdb14,JSON[_0x4053('0x21')](_0x8af6d1));_0x35723d(_0x8af6d1);})[_0x4053('0x15')](function(_0x28d685){logger['error'](_0x4053('0x22'),_0x28d685[_0x4053('0x13')],_0x5cdb14);_0x45feb3(_0x498228[_0x4053('0x11')](0x1f4,_0x28d685[_0x4053('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 2aa9ed3..cbd07b4 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 _0x71b0=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','show','isAuthenticated','/:id/subjects'];(function(_0x2c1f11,_0x23338e){var _0x1d81d1=function(_0x2ff9f1){while(--_0x2ff9f1){_0x2c1f11['push'](_0x2c1f11['shift']());}};_0x1d81d1(++_0x23338e);}(_0x71b0,0x19c));var _0x071b=function(_0x234472,_0x1e08bd){_0x234472=_0x234472-0x0;var _0x4144aa=_0x71b0[_0x234472];return _0x4144aa;};'use strict';var multer=require(_0x071b('0x0'));var util=require(_0x071b('0x1'));var path=require(_0x071b('0x2'));var timeout=require(_0x071b('0x3'));var express=require(_0x071b('0x4'));var router=express[_0x071b('0x5')]();var auth=require(_0x071b('0x6'));var interaction=require(_0x071b('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x071b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x071b('0x8')](_0x071b('0x9'),auth['isAuthenticated'](),controller[_0x071b('0xa')]);router[_0x071b('0x8')]('/:id/fields',auth[_0x071b('0xb')](),controller['getFields']);router[_0x071b('0x8')](_0x071b('0xc'),auth[_0x071b('0xb')](),controller[_0x071b('0xd')]);router[_0x071b('0x8')](_0x071b('0xe'),auth[_0x071b('0xb')](),controller[_0x071b('0xf')]);router[_0x071b('0x8')]('/:id/tags',auth[_0x071b('0xb')](),controller[_0x071b('0x10')]);router[_0x071b('0x11')]('/',auth['isAuthenticated'](),controller[_0x071b('0x12')]);router[_0x071b('0x11')](_0x071b('0x13'),auth[_0x071b('0xb')](),controller['setTags']);router[_0x071b('0x14')](_0x071b('0x9'),auth['isAuthenticated'](),controller[_0x071b('0x15')]);router[_0x071b('0x16')](_0x071b('0x9'),auth['isAuthenticated'](),controller[_0x071b('0x17')]);module[_0x071b('0x18')]=router; \ No newline at end of file +var _0x02c0=['create','setTags','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post'];(function(_0x27f452,_0x21287){var _0x934554=function(_0x709f5c){while(--_0x709f5c){_0x27f452['push'](_0x27f452['shift']());}};_0x934554(++_0x21287);}(_0x02c0,0xc4));var _0x002c=function(_0x4dc480,_0x651c85){_0x4dc480=_0x4dc480-0x0;var _0x2444c5=_0x02c0[_0x4dc480];return _0x2444c5;};'use strict';var multer=require(_0x002c('0x0'));var util=require(_0x002c('0x1'));var path=require('path');var timeout=require(_0x002c('0x2'));var express=require(_0x002c('0x3'));var router=express[_0x002c('0x4')]();var auth=require(_0x002c('0x5'));var interaction=require(_0x002c('0x6'));var config=require(_0x002c('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x002c('0x8')](),controller[_0x002c('0x9')]);router['get'](_0x002c('0xa'),auth[_0x002c('0x8')](),controller[_0x002c('0xb')]);router[_0x002c('0xc')]('/:id/fields',auth[_0x002c('0x8')](),controller[_0x002c('0xd')]);router['get'](_0x002c('0xe'),auth[_0x002c('0x8')](),controller['getSubjects']);router[_0x002c('0xc')](_0x002c('0xf'),auth[_0x002c('0x8')](),controller[_0x002c('0x10')]);router[_0x002c('0xc')](_0x002c('0x11'),auth[_0x002c('0x8')](),controller[_0x002c('0x12')]);router[_0x002c('0x13')]('/',auth['isAuthenticated'](),controller[_0x002c('0x14')]);router['post'](_0x002c('0x11'),auth['isAuthenticated'](),controller[_0x002c('0x15')]);router[_0x002c('0x16')](_0x002c('0xa'),auth[_0x002c('0x8')](),controller[_0x002c('0x17')]);router[_0x002c('0x18')](_0x002c('0xa'),auth['isAuthenticated'](),controller[_0x002c('0x19')]);module[_0x002c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 2d6bf3e..48060cf 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 _0x6d14=['exports','sequelize'];(function(_0x293a20,_0x2537e3){var _0x3c84f9=function(_0x2e52e4){while(--_0x2e52e4){_0x293a20['push'](_0x293a20['shift']());}};_0x3c84f9(++_0x2537e3);}(_0x6d14,0x83));var _0x46d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d14[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x46d1('0x0'));module[_0x46d1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0aa0=['exports','sequelize'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0x0aa0,0x127));var _0x00aa=function(_0x142039,_0x47028a){_0x142039=_0x142039-0x0;var _0x49a20b=_0x0aa0[_0x142039];return _0x49a20b;};'use strict';var Sequelize=require(_0x00aa('0x0'));module[_0x00aa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index f38f6d3..ebf4f0d 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 _0x04d3=['name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','where','filter','merge','type','VIRTUAL','include','catch','params','find','body','findOne','FreshdeskField','sort','pick','options','getFields','getSubjects','order','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then'];(function(_0x2ac048,_0x1a5057){var _0x1a8e4f=function(_0x555126){while(--_0x555126){_0x2ac048['push'](_0x2ac048['shift']());}};_0x1a8e4f(++_0x1a5057);}(_0x04d3,0x1d0));var _0x304d=function(_0x151702,_0x3751b9){_0x151702=_0x151702-0x0;var _0x16eca4=_0x04d3[_0x151702];return _0x16eca4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x304d('0x0'));var rimraf=require(_0x304d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x304d('0x2'));var rp=require(_0x304d('0x3'));var moment=require('moment');var BPromise=require(_0x304d('0x4'));var Mustache=require(_0x304d('0x5'));var util=require(_0x304d('0x6'));var path=require(_0x304d('0x7'));var sox=require(_0x304d('0x8'));var csv=require('to-csv');var ejs=require(_0x304d('0x9'));var fs=require('fs');var _=require(_0x304d('0xa'));var squel=require('squel');var crypto=require(_0x304d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x304d('0xc'));var toCsv=require(_0x304d('0xd'));var querystring=require('querystring');var Papa=require(_0x304d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x304d('0xf'));var hardwareService=require(_0x304d('0x10'));var logger=require(_0x304d('0x11'))('api');var utils=require(_0x304d('0x12'));var config=require(_0x304d('0x13'));var licenseUtil=require(_0x304d('0x14'));var db=require(_0x304d('0x15'))['db'];var jayson=require(_0x304d('0x16'));var client=jayson[_0x304d('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1278ea,_0xdf84e6,_0x1cc16c,_0x589fa5){return new BPromise(function(_0x1168d1,_0x13d91d){var _0x2e5c36=_0x589fa5||client;return _0x2e5c36[_0x304d('0x18')](_0x1278ea,_0x1cc16c)['then'](function(_0x2e61c6){logger['info'](_0x304d('0x19'),_0xdf84e6,_0x304d('0x1a'));logger[_0x304d('0x1b')](_0x304d('0x1c'),_0xdf84e6,_0x304d('0x1a'),JSON['stringify'](_0x2e61c6));if(_0x2e61c6[_0x304d('0x1d')]){if(_0x2e61c6[_0x304d('0x1d')][_0x304d('0x1e')]===0x1f4){logger[_0x304d('0x1d')](_0x304d('0x19'),_0xdf84e6,_0x2e61c6['error']['message']);return _0x13d91d(_0x2e61c6['error'][_0x304d('0x1f')]);}logger[_0x304d('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xdf84e6,_0x2e61c6[_0x304d('0x1d')]['message']);return _0x1168d1(_0x2e61c6[_0x304d('0x1d')][_0x304d('0x1f')]);}else{logger['info'](_0x304d('0x19'),_0xdf84e6,_0x304d('0x1a'));_0x1168d1(_0x2e61c6[_0x304d('0x20')][_0x304d('0x1f')]);}})['catch'](function(_0x5dab83){logger[_0x304d('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xdf84e6,_0x5dab83);_0x13d91d(_0x5dab83);});});}function respondWithStatusCode(_0x29d939,_0x40b495){_0x40b495=_0x40b495||0xcc;return function(_0x179b6b){if(_0x179b6b){return _0x29d939[_0x304d('0x21')](_0x40b495);}return _0x29d939[_0x304d('0x22')](_0x40b495)[_0x304d('0x23')]();};}function respondWithResult(_0x1a173e,_0x41425a){_0x41425a=_0x41425a||0xc8;return function(_0x4ffec9){if(_0x4ffec9){return _0x1a173e[_0x304d('0x22')](_0x41425a)[_0x304d('0x24')](_0x4ffec9);}};}function respondWithFilteredResult(_0x4269b8,_0x285d8e){return function(_0xc0c793){if(_0xc0c793){var _0x1a4a71=_0xc0c793[_0x304d('0x25')],_0x31ac6f=_0x285d8e['offset'],_0x481cf4=_0x285d8e[_0x304d('0x26')]+_0x285d8e[_0x304d('0x27')],_0x3b7d60;if(_0x481cf4>=_0x1a4a71){_0x481cf4=_0x1a4a71;_0x3b7d60=0xc8;}else{_0x3b7d60=0xce;}_0x4269b8[_0x304d('0x22')](_0x3b7d60);return _0x4269b8['set'](_0x304d('0x28'),_0x31ac6f+'-'+_0x481cf4+'/'+_0x1a4a71)['json'](_0xc0c793);}return null;};}function patchUpdates(_0xafa8ad){return function(_0x95258b){try{jsonpatch[_0x304d('0x29')](_0x95258b,_0xafa8ad,!![]);}catch(_0x394324){return BPromise[_0x304d('0x2a')](_0x394324);}return _0x95258b['save']();};}function saveUpdates(_0x177814,_0x253c13){return function(_0x3e0bf2){if(_0x3e0bf2){return _0x3e0bf2[_0x304d('0x2b')](_0x177814)['then'](function(_0x575987){return _0x575987;});}return null;};}function removeEntity(_0x364288,_0x1f6a58){return function(_0x2c966a){if(_0x2c966a){return _0x2c966a[_0x304d('0x2c')]()[_0x304d('0x2d')](function(){_0x364288['status'](0xcc)[_0x304d('0x23')]();});}};}function handleEntityNotFound(_0x3fbdb8,_0xae30ca){return function(_0x591e68){if(!_0x591e68){_0x3fbdb8[_0x304d('0x21')](0x194);}return _0x591e68;};}function handleError(_0xcd0b84,_0x2c0037){_0x2c0037=_0x2c0037||0x1f4;return function(_0x1bec4e){logger[_0x304d('0x1d')](_0x1bec4e['stack']);if(_0x1bec4e[_0x304d('0x2e')]){delete _0x1bec4e[_0x304d('0x2e')];}_0xcd0b84[_0x304d('0x22')](_0x2c0037)[_0x304d('0x2f')](_0x1bec4e);};}exports[_0x304d('0x30')]=function(_0x514421,_0x355030){var _0x252634={},_0x59bc27={},_0x4dfaf6={'count':0x0,'rows':[]};var _0x25ef9e=_[_0x304d('0x31')](db[_0x304d('0x32')][_0x304d('0x33')],function(_0x35748f){return{'name':_0x35748f[_0x304d('0x34')],'type':_0x35748f['type']['key']};});_0x59bc27[_0x304d('0x35')]=_[_0x304d('0x31')](_0x25ef9e,'name');_0x59bc27['query']=_[_0x304d('0x36')](_0x514421['query']);_0x59bc27[_0x304d('0x37')]=_[_0x304d('0x38')](_0x59bc27[_0x304d('0x35')],_0x59bc27[_0x304d('0x39')]);_0x252634['attributes']=_[_0x304d('0x38')](_0x59bc27[_0x304d('0x35')],qs[_0x304d('0x3a')](_0x514421['query'][_0x304d('0x3a')]));_0x252634[_0x304d('0x3b')]=_0x252634['attributes'][_0x304d('0x3c')]?_0x252634[_0x304d('0x3b')]:_0x59bc27[_0x304d('0x35')];if(!_0x514421[_0x304d('0x39')][_0x304d('0x3d')](_0x304d('0x3e'))){_0x252634[_0x304d('0x27')]=qs['limit'](_0x514421[_0x304d('0x39')][_0x304d('0x27')]);_0x252634[_0x304d('0x26')]=qs[_0x304d('0x26')](_0x514421[_0x304d('0x39')][_0x304d('0x26')]);}_0x252634['order']=qs['sort'](_0x514421['query']['sort']);_0x252634[_0x304d('0x3f')]=qs[_0x304d('0x37')](_['pick'](_0x514421[_0x304d('0x39')],_0x59bc27['filters']),_0x25ef9e);if(_0x514421['query'][_0x304d('0x40')]){_0x252634[_0x304d('0x3f')]=_[_0x304d('0x41')](_0x252634[_0x304d('0x3f')],{'$or':_['map'](_0x25ef9e,function(_0x4bdd3c){if(_0x4bdd3c[_0x304d('0x42')]!==_0x304d('0x43')){var _0x562ad4={};_0x562ad4[_0x4bdd3c['name']]={'$like':'%'+_0x514421[_0x304d('0x39')][_0x304d('0x40')]+'%'};return _0x562ad4;}})});}_0x252634=_[_0x304d('0x41')]({},_0x252634,_0x514421['options']);var _0x5b5663={'where':_0x252634[_0x304d('0x3f')]};return db[_0x304d('0x32')][_0x304d('0x25')](_0x5b5663)[_0x304d('0x2d')](function(_0x597e8c){_0x4dfaf6['count']=_0x597e8c;if(_0x514421[_0x304d('0x39')]['includeAll']){_0x252634[_0x304d('0x44')]=[{'all':!![]}];}return db[_0x304d('0x32')]['findAll'](_0x252634);})[_0x304d('0x2d')](function(_0x2c4cfe){_0x4dfaf6['rows']=_0x2c4cfe;return _0x4dfaf6;})['then'](respondWithFilteredResult(_0x355030,_0x252634))[_0x304d('0x45')](handleError(_0x355030,null));};exports['show']=function(_0x419264,_0x2122c4){var _0x2b8507={'raw':![],'where':{'id':_0x419264[_0x304d('0x46')]['id']}},_0x325cbe={};_0x325cbe[_0x304d('0x35')]=_[_0x304d('0x36')](db[_0x304d('0x32')][_0x304d('0x33')]);_0x325cbe['query']=_[_0x304d('0x36')](_0x419264[_0x304d('0x39')]);_0x325cbe[_0x304d('0x37')]=_['intersection'](_0x325cbe['model'],_0x325cbe[_0x304d('0x39')]);_0x2b8507[_0x304d('0x3b')]=_[_0x304d('0x38')](_0x325cbe[_0x304d('0x35')],qs[_0x304d('0x3a')](_0x419264[_0x304d('0x39')][_0x304d('0x3a')]));_0x2b8507[_0x304d('0x3b')]=_0x2b8507['attributes']['length']?_0x2b8507[_0x304d('0x3b')]:_0x325cbe['model'];if(_0x419264[_0x304d('0x39')]['includeAll']){_0x2b8507[_0x304d('0x44')]=[{'all':!![]}];}_0x2b8507=_[_0x304d('0x41')]({},_0x2b8507,_0x419264['options']);return db[_0x304d('0x32')][_0x304d('0x47')](_0x2b8507)[_0x304d('0x2d')](handleEntityNotFound(_0x2122c4,null))[_0x304d('0x2d')](respondWithResult(_0x2122c4,null))['catch'](handleError(_0x2122c4,null));};exports['create']=function(_0x1357e3,_0x310303){return db[_0x304d('0x32')]['create'](_0x1357e3[_0x304d('0x48')],{})[_0x304d('0x2d')](respondWithResult(_0x310303,0xc9))[_0x304d('0x45')](handleError(_0x310303,null));};exports[_0x304d('0x2b')]=function(_0x73d8ce,_0x30246b){if(_0x73d8ce[_0x304d('0x48')]['id']){delete _0x73d8ce[_0x304d('0x48')]['id'];}return db['FreshdeskConfiguration'][_0x304d('0x47')]({'where':{'id':_0x73d8ce[_0x304d('0x46')]['id']}})[_0x304d('0x2d')](handleEntityNotFound(_0x30246b,null))[_0x304d('0x2d')](saveUpdates(_0x73d8ce[_0x304d('0x48')],null))[_0x304d('0x2d')](respondWithResult(_0x30246b,null))[_0x304d('0x45')](handleError(_0x30246b,null));};exports[_0x304d('0x2c')]=function(_0x1a0fd4,_0x4c4816){return db[_0x304d('0x32')][_0x304d('0x47')]({'where':{'id':_0x1a0fd4[_0x304d('0x46')]['id']}})[_0x304d('0x2d')](handleEntityNotFound(_0x4c4816,null))[_0x304d('0x2d')](removeEntity(_0x4c4816,null))[_0x304d('0x45')](handleError(_0x4c4816,null));};exports['getFields']=function(_0x3194e9,_0xbd44d6,_0x202c8b){var _0x1d7442={};var _0x9a2ada={};var _0x48a13b;var _0x44a166;return db[_0x304d('0x32')][_0x304d('0x49')]({'where':{'id':_0x3194e9['params']['id']}})['then'](handleEntityNotFound(_0xbd44d6,null))[_0x304d('0x2d')](function(_0x5cc738){if(_0x5cc738){_0x48a13b=_0x5cc738;_0x9a2ada['model']=_[_0x304d('0x36')](db[_0x304d('0x4a')]['rawAttributes']);_0x9a2ada[_0x304d('0x39')]=_[_0x304d('0x36')](_0x3194e9[_0x304d('0x39')]);_0x9a2ada[_0x304d('0x37')]=_['intersection'](_0x9a2ada[_0x304d('0x35')],_0x9a2ada[_0x304d('0x39')]);_0x1d7442[_0x304d('0x3b')]=_['intersection'](_0x9a2ada[_0x304d('0x35')],qs[_0x304d('0x3a')](_0x3194e9[_0x304d('0x39')]['fields']));_0x1d7442['attributes']=_0x1d7442['attributes']['length']?_0x1d7442['attributes']:_0x9a2ada[_0x304d('0x35')];_0x1d7442['order']=qs[_0x304d('0x4b')](_0x3194e9[_0x304d('0x39')][_0x304d('0x4b')]);_0x1d7442['where']=qs[_0x304d('0x37')](_[_0x304d('0x4c')](_0x3194e9[_0x304d('0x39')],_0x9a2ada[_0x304d('0x37')]));if(_0x3194e9['query'][_0x304d('0x40')]){_0x1d7442[_0x304d('0x3f')]=_['merge'](_0x1d7442[_0x304d('0x3f')],{'$or':_['map'](_0x1d7442[_0x304d('0x3b')],function(_0xc9cf){var _0x2acb23={};_0x2acb23[_0xc9cf]={'$like':'%'+_0x3194e9['query']['filter']+'%'};return _0x2acb23;})});}_0x1d7442=_[_0x304d('0x41')]({},_0x1d7442,_0x3194e9[_0x304d('0x4d')]);return _0x48a13b['getFields'](_0x1d7442);}})[_0x304d('0x2d')](function(_0x578fbd){if(_0x578fbd){_0x44a166=_0x578fbd['length'];if(!_0x3194e9[_0x304d('0x39')][_0x304d('0x3d')](_0x304d('0x3e'))){_0x1d7442[_0x304d('0x27')]=qs[_0x304d('0x27')](_0x3194e9[_0x304d('0x39')][_0x304d('0x27')]);_0x1d7442[_0x304d('0x26')]=qs[_0x304d('0x26')](_0x3194e9[_0x304d('0x39')]['offset']);}return _0x48a13b[_0x304d('0x4e')](_0x1d7442);}})[_0x304d('0x2d')](function(_0x5cb101){if(_0x5cb101){return _0x5cb101?{'count':_0x44a166,'rows':_0x5cb101}:null;}})[_0x304d('0x2d')](respondWithResult(_0xbd44d6,null))['catch'](handleError(_0xbd44d6,null));};exports[_0x304d('0x4f')]=function(_0x2ebd38,_0x7c0c60,_0x53b6cc){var _0x346416={};var _0x46b9a0={};var _0x310743;var _0x4a3929;return db[_0x304d('0x32')][_0x304d('0x49')]({'where':{'id':_0x2ebd38[_0x304d('0x46')]['id']}})[_0x304d('0x2d')](handleEntityNotFound(_0x7c0c60,null))['then'](function(_0x2a810d){if(_0x2a810d){_0x310743=_0x2a810d;_0x46b9a0[_0x304d('0x35')]=_[_0x304d('0x36')](db[_0x304d('0x4a')]['rawAttributes']);_0x46b9a0[_0x304d('0x39')]=_[_0x304d('0x36')](_0x2ebd38['query']);_0x46b9a0[_0x304d('0x37')]=_[_0x304d('0x38')](_0x46b9a0[_0x304d('0x35')],_0x46b9a0[_0x304d('0x39')]);_0x346416[_0x304d('0x3b')]=_['intersection'](_0x46b9a0['model'],qs[_0x304d('0x3a')](_0x2ebd38[_0x304d('0x39')][_0x304d('0x3a')]));_0x346416['attributes']=_0x346416['attributes']['length']?_0x346416[_0x304d('0x3b')]:_0x46b9a0[_0x304d('0x35')];_0x346416[_0x304d('0x50')]=qs[_0x304d('0x4b')](_0x2ebd38[_0x304d('0x39')][_0x304d('0x4b')]);_0x346416[_0x304d('0x3f')]=qs['filters'](_['pick'](_0x2ebd38[_0x304d('0x39')],_0x46b9a0[_0x304d('0x37')]));if(_0x2ebd38[_0x304d('0x39')][_0x304d('0x40')]){_0x346416['where']=_[_0x304d('0x41')](_0x346416[_0x304d('0x3f')],{'$or':_[_0x304d('0x31')](_0x346416[_0x304d('0x3b')],function(_0x1d4b58){var _0x1a8582={};_0x1a8582[_0x1d4b58]={'$like':'%'+_0x2ebd38['query'][_0x304d('0x40')]+'%'};return _0x1a8582;})});}_0x346416=_[_0x304d('0x41')]({},_0x346416,_0x2ebd38['options']);return _0x310743[_0x304d('0x4f')](_0x346416);}})[_0x304d('0x2d')](function(_0xe585d6){if(_0xe585d6){_0x4a3929=_0xe585d6[_0x304d('0x3c')];if(!_0x2ebd38[_0x304d('0x39')][_0x304d('0x3d')](_0x304d('0x3e'))){_0x346416[_0x304d('0x27')]=qs[_0x304d('0x27')](_0x2ebd38[_0x304d('0x39')][_0x304d('0x27')]);_0x346416['offset']=qs[_0x304d('0x26')](_0x2ebd38['query'][_0x304d('0x26')]);}return _0x310743['getSubjects'](_0x346416);}})[_0x304d('0x2d')](function(_0x58c8bc){if(_0x58c8bc){return _0x58c8bc?{'count':_0x4a3929,'rows':_0x58c8bc}:null;}})['then'](respondWithResult(_0x7c0c60,null))[_0x304d('0x45')](handleError(_0x7c0c60,null));};exports[_0x304d('0x51')]=function(_0x3cabf9,_0x236974,_0x202578){var _0x2c139e={};var _0x1e606c={};var _0x1b2a36;var _0x5f3eca;return db[_0x304d('0x32')][_0x304d('0x49')]({'where':{'id':_0x3cabf9[_0x304d('0x46')]['id']}})[_0x304d('0x2d')](handleEntityNotFound(_0x236974,null))['then'](function(_0x2a5951){if(_0x2a5951){_0x1b2a36=_0x2a5951;_0x1e606c[_0x304d('0x35')]=_[_0x304d('0x36')](db[_0x304d('0x4a')][_0x304d('0x33')]);_0x1e606c[_0x304d('0x39')]=_[_0x304d('0x36')](_0x3cabf9[_0x304d('0x39')]);_0x1e606c[_0x304d('0x37')]=_[_0x304d('0x38')](_0x1e606c[_0x304d('0x35')],_0x1e606c[_0x304d('0x39')]);_0x2c139e[_0x304d('0x3b')]=_[_0x304d('0x38')](_0x1e606c['model'],qs['fields'](_0x3cabf9[_0x304d('0x39')][_0x304d('0x3a')]));_0x2c139e[_0x304d('0x3b')]=_0x2c139e[_0x304d('0x3b')]['length']?_0x2c139e['attributes']:_0x1e606c[_0x304d('0x35')];_0x2c139e[_0x304d('0x50')]=qs[_0x304d('0x4b')](_0x3cabf9[_0x304d('0x39')][_0x304d('0x4b')]);_0x2c139e['where']=qs[_0x304d('0x37')](_['pick'](_0x3cabf9[_0x304d('0x39')],_0x1e606c[_0x304d('0x37')]));if(_0x3cabf9[_0x304d('0x39')][_0x304d('0x40')]){_0x2c139e[_0x304d('0x3f')]=_[_0x304d('0x41')](_0x2c139e[_0x304d('0x3f')],{'$or':_[_0x304d('0x31')](_0x2c139e[_0x304d('0x3b')],function(_0x56f293){var _0x268aaa={};_0x268aaa[_0x56f293]={'$like':'%'+_0x3cabf9[_0x304d('0x39')][_0x304d('0x40')]+'%'};return _0x268aaa;})});}_0x2c139e=_[_0x304d('0x41')]({},_0x2c139e,_0x3cabf9[_0x304d('0x4d')]);return _0x1b2a36[_0x304d('0x51')](_0x2c139e);}})['then'](function(_0x120d3c){if(_0x120d3c){_0x5f3eca=_0x120d3c['length'];if(!_0x3cabf9['query'][_0x304d('0x3d')](_0x304d('0x3e'))){_0x2c139e['limit']=qs[_0x304d('0x27')](_0x3cabf9['query'][_0x304d('0x27')]);_0x2c139e[_0x304d('0x26')]=qs[_0x304d('0x26')](_0x3cabf9['query'][_0x304d('0x26')]);}return _0x1b2a36[_0x304d('0x51')](_0x2c139e);}})[_0x304d('0x2d')](function(_0x1b6794){if(_0x1b6794){return _0x1b6794?{'count':_0x5f3eca,'rows':_0x1b6794}:null;}})[_0x304d('0x2d')](respondWithResult(_0x236974,null))[_0x304d('0x45')](handleError(_0x236974,null));};exports[_0x304d('0x52')]=function(_0x34ffcb,_0x598c2b,_0xda9838){var _0x1ec157={};var _0xa84098={};var _0x753e3b;var _0x751198;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x34ffcb[_0x304d('0x46')]['id']}})[_0x304d('0x2d')](handleEntityNotFound(_0x598c2b,null))[_0x304d('0x2d')](function(_0x5ef910){if(_0x5ef910){_0x753e3b=_0x5ef910;_0xa84098['model']=_['keys'](db[_0x304d('0x53')]['rawAttributes']);_0xa84098[_0x304d('0x39')]=_[_0x304d('0x36')](_0x34ffcb[_0x304d('0x39')]);_0xa84098[_0x304d('0x37')]=_[_0x304d('0x38')](_0xa84098[_0x304d('0x35')],_0xa84098[_0x304d('0x39')]);_0x1ec157['attributes']=_[_0x304d('0x38')](_0xa84098[_0x304d('0x35')],qs['fields'](_0x34ffcb[_0x304d('0x39')][_0x304d('0x3a')]));_0x1ec157[_0x304d('0x3b')]=_0x1ec157[_0x304d('0x3b')][_0x304d('0x3c')]?_0x1ec157[_0x304d('0x3b')]:_0xa84098['model'];_0x1ec157[_0x304d('0x50')]=qs['sort'](_0x34ffcb['query'][_0x304d('0x4b')]);_0x1ec157['where']=qs[_0x304d('0x37')](_[_0x304d('0x4c')](_0x34ffcb[_0x304d('0x39')],_0xa84098[_0x304d('0x37')]));if(_0x34ffcb['query'][_0x304d('0x40')]){_0x1ec157['where']=_['merge'](_0x1ec157[_0x304d('0x3f')],{'$or':_[_0x304d('0x31')](_0x1ec157[_0x304d('0x3b')],function(_0x153e82){var _0x7bd11d={};_0x7bd11d[_0x153e82]={'$like':'%'+_0x34ffcb[_0x304d('0x39')][_0x304d('0x40')]+'%'};return _0x7bd11d;})});}_0x1ec157=_[_0x304d('0x41')]({},_0x1ec157,_0x34ffcb[_0x304d('0x4d')]);return _0x753e3b[_0x304d('0x52')](_0x1ec157);}})[_0x304d('0x2d')](function(_0x2578f){if(_0x2578f){_0x751198=_0x2578f[_0x304d('0x3c')];if(!_0x34ffcb[_0x304d('0x39')][_0x304d('0x3d')](_0x304d('0x3e'))){_0x1ec157['limit']=qs['limit'](_0x34ffcb[_0x304d('0x39')][_0x304d('0x27')]);_0x1ec157[_0x304d('0x26')]=qs[_0x304d('0x26')](_0x34ffcb['query']['offset']);}return _0x753e3b[_0x304d('0x52')](_0x1ec157);}})[_0x304d('0x2d')](function(_0x737176){if(_0x737176){return _0x737176?{'count':_0x751198,'rows':_0x737176}:null;}})[_0x304d('0x2d')](respondWithResult(_0x598c2b,null))['catch'](handleError(_0x598c2b,null));};exports[_0x304d('0x54')]=function(_0xe4b435,_0x1f583d,_0x3c38d5){if(_0xe4b435[_0x304d('0x48')]['id']){delete _0xe4b435[_0x304d('0x48')]['id'];}return db[_0x304d('0x32')]['findOne']({'where':{'id':_0xe4b435['params']['id']}})['then'](handleEntityNotFound(_0x1f583d,null))['then'](function(_0x3ba160){if(_0x3ba160){return _0x3ba160[_0x304d('0x54')](_0xe4b435[_0x304d('0x48')]['ids']||[]);}return null;})[_0x304d('0x2d')](respondWithResult(_0x1f583d,null))['catch'](handleError(_0x1f583d,null));}; \ No newline at end of file +var _0xd091=['params','keys','includeAll','create','body','find','getFields','findOne','where','getSubjects','nolimit','getDescriptions','FreshdeskField','Tag','getTags','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','sendStatus','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','key','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show'];(function(_0xefd64d,_0xd1ad8b){var _0x3dbca5=function(_0x5dd543){while(--_0x5dd543){_0xefd64d['push'](_0xefd64d['shift']());}};_0x3dbca5(++_0xd1ad8b);}(_0xd091,0xca));var _0x1d09=function(_0x42fced,_0x55d428){_0x42fced=_0x42fced-0x0;var _0x12c61e=_0xd091[_0x42fced];return _0x12c61e;};'use strict';var pdf=require(_0x1d09('0x0'));var emlformat=require(_0x1d09('0x1'));var rimraf=require(_0x1d09('0x2'));var zipdir=require(_0x1d09('0x3'));var jsonpatch=require(_0x1d09('0x4'));var rp=require(_0x1d09('0x5'));var moment=require(_0x1d09('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1d09('0x7'));var util=require(_0x1d09('0x8'));var path=require(_0x1d09('0x9'));var sox=require(_0x1d09('0xa'));var csv=require(_0x1d09('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1d09('0xc'));var jsforce=require(_0x1d09('0xd'));var deskjs=require(_0x1d09('0xe'));var toCsv=require(_0x1d09('0xb'));var querystring=require(_0x1d09('0xf'));var Papa=require(_0x1d09('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1d09('0x11'));var as=require(_0x1d09('0x12'));var hardwareService=require(_0x1d09('0x13'));var logger=require(_0x1d09('0x14'))('api');var utils=require(_0x1d09('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1d09('0x16'));var db=require(_0x1d09('0x17'))['db'];var jayson=require(_0x1d09('0x18'));var client=jayson[_0x1d09('0x19')][_0x1d09('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x228257,_0x222bd3,_0x2b7ec9,_0x24be15){return new BPromise(function(_0x4d845e,_0x113711){var _0x3b67b9=_0x24be15||client;return _0x3b67b9[_0x1d09('0x1b')](_0x228257,_0x2b7ec9)[_0x1d09('0x1c')](function(_0x44e196){logger[_0x1d09('0x1d')](_0x1d09('0x1e'),_0x222bd3,_0x1d09('0x1f'));logger['debug'](_0x1d09('0x20'),_0x222bd3,_0x1d09('0x1f'),JSON['stringify'](_0x44e196));if(_0x44e196[_0x1d09('0x21')]){if(_0x44e196['error']['code']===0x1f4){logger[_0x1d09('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x222bd3,_0x44e196[_0x1d09('0x21')][_0x1d09('0x22')]);return _0x113711(_0x44e196['error'][_0x1d09('0x22')]);}logger['error'](_0x1d09('0x1e'),_0x222bd3,_0x44e196[_0x1d09('0x21')][_0x1d09('0x22')]);return _0x4d845e(_0x44e196[_0x1d09('0x21')]['message']);}else{logger[_0x1d09('0x1d')](_0x1d09('0x1e'),_0x222bd3,_0x1d09('0x1f'));_0x4d845e(_0x44e196[_0x1d09('0x23')][_0x1d09('0x22')]);}})[_0x1d09('0x24')](function(_0x292ad8){logger[_0x1d09('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x222bd3,_0x292ad8);_0x113711(_0x292ad8);});});}function respondWithStatusCode(_0x10c8fd,_0x4ea8f5){_0x4ea8f5=_0x4ea8f5||0xcc;return function(_0x3e468c){if(_0x3e468c){return _0x10c8fd['sendStatus'](_0x4ea8f5);}return _0x10c8fd[_0x1d09('0x25')](_0x4ea8f5)[_0x1d09('0x26')]();};}function respondWithResult(_0x450fcc,_0x23717c){_0x23717c=_0x23717c||0xc8;return function(_0x572059){if(_0x572059){return _0x450fcc[_0x1d09('0x25')](_0x23717c)[_0x1d09('0x27')](_0x572059);}};}function respondWithFilteredResult(_0x24154a,_0x1dad53){return function(_0x197884){if(_0x197884){var _0x46daf8=_0x197884[_0x1d09('0x28')],_0x76aba8=_0x1dad53[_0x1d09('0x29')],_0x5d349e=_0x1dad53[_0x1d09('0x29')]+_0x1dad53[_0x1d09('0x2a')],_0x47869b;if(_0x5d349e>=_0x46daf8){_0x5d349e=_0x46daf8;_0x47869b=0xc8;}else{_0x47869b=0xce;}_0x24154a[_0x1d09('0x25')](_0x47869b);return _0x24154a[_0x1d09('0x2b')](_0x1d09('0x2c'),_0x76aba8+'-'+_0x5d349e+'/'+_0x46daf8)[_0x1d09('0x27')](_0x197884);}return null;};}function patchUpdates(_0x1b3c03){return function(_0x30d33e){try{jsonpatch['apply'](_0x30d33e,_0x1b3c03,!![]);}catch(_0x43d35e){return BPromise[_0x1d09('0x2d')](_0x43d35e);}return _0x30d33e['save']();};}function saveUpdates(_0x270467,_0x40ccef){return function(_0x3b6a30){if(_0x3b6a30){return _0x3b6a30[_0x1d09('0x2e')](_0x270467)['then'](function(_0x1a6c1b){return _0x1a6c1b;});}return null;};}function removeEntity(_0x250b9f,_0x57cd3b){return function(_0x49daec){if(_0x49daec){return _0x49daec[_0x1d09('0x2f')]()[_0x1d09('0x1c')](function(){_0x250b9f[_0x1d09('0x25')](0xcc)[_0x1d09('0x26')]();});}};}function handleEntityNotFound(_0x4b5bd7,_0x38e62f){return function(_0x47abae){if(!_0x47abae){_0x4b5bd7[_0x1d09('0x30')](0x194);}return _0x47abae;};}function handleError(_0x238b96,_0x860ce3){_0x860ce3=_0x860ce3||0x1f4;return function(_0x4d61e2){logger[_0x1d09('0x21')](_0x4d61e2[_0x1d09('0x31')]);if(_0x4d61e2[_0x1d09('0x32')]){delete _0x4d61e2[_0x1d09('0x32')];}_0x238b96[_0x1d09('0x25')](_0x860ce3)[_0x1d09('0x33')](_0x4d61e2);};}exports['index']=function(_0x55da49,_0x9f490d){var _0x39bb80={},_0x1cd472={},_0xaf5296={'count':0x0,'rows':[]};var _0x46e5e0=_[_0x1d09('0x34')](db[_0x1d09('0x35')][_0x1d09('0x36')],function(_0x3c3176){return{'name':_0x3c3176[_0x1d09('0x37')],'type':_0x3c3176['type'][_0x1d09('0x38')]};});_0x1cd472['model']=_[_0x1d09('0x34')](_0x46e5e0,_0x1d09('0x32'));_0x1cd472['query']=_['keys'](_0x55da49['query']);_0x1cd472[_0x1d09('0x39')]=_[_0x1d09('0x3a')](_0x1cd472[_0x1d09('0x3b')],_0x1cd472[_0x1d09('0x3c')]);_0x39bb80['attributes']=_[_0x1d09('0x3a')](_0x1cd472['model'],qs[_0x1d09('0x3d')](_0x55da49[_0x1d09('0x3c')][_0x1d09('0x3d')]));_0x39bb80[_0x1d09('0x3e')]=_0x39bb80[_0x1d09('0x3e')][_0x1d09('0x3f')]?_0x39bb80['attributes']:_0x1cd472[_0x1d09('0x3b')];if(!_0x55da49[_0x1d09('0x3c')][_0x1d09('0x40')]('nolimit')){_0x39bb80[_0x1d09('0x2a')]=qs['limit'](_0x55da49[_0x1d09('0x3c')][_0x1d09('0x2a')]);_0x39bb80[_0x1d09('0x29')]=qs['offset'](_0x55da49[_0x1d09('0x3c')][_0x1d09('0x29')]);}_0x39bb80[_0x1d09('0x41')]=qs['sort'](_0x55da49[_0x1d09('0x3c')][_0x1d09('0x42')]);_0x39bb80['where']=qs['filters'](_[_0x1d09('0x43')](_0x55da49[_0x1d09('0x3c')],_0x1cd472[_0x1d09('0x39')]),_0x46e5e0);if(_0x55da49['query'][_0x1d09('0x44')]){_0x39bb80['where']=_[_0x1d09('0x45')](_0x39bb80['where'],{'$or':_['map'](_0x46e5e0,function(_0x12263e){if(_0x12263e[_0x1d09('0x46')]!==_0x1d09('0x47')){var _0x325cf8={};_0x325cf8[_0x12263e[_0x1d09('0x32')]]={'$like':'%'+_0x55da49[_0x1d09('0x3c')][_0x1d09('0x44')]+'%'};return _0x325cf8;}})});}_0x39bb80=_['merge']({},_0x39bb80,_0x55da49[_0x1d09('0x48')]);var _0x148e0d={'where':_0x39bb80['where']};return db[_0x1d09('0x35')][_0x1d09('0x28')](_0x148e0d)['then'](function(_0x25cb39){_0xaf5296['count']=_0x25cb39;if(_0x55da49['query']['includeAll']){_0x39bb80[_0x1d09('0x49')]=[{'all':!![]}];}return db[_0x1d09('0x35')][_0x1d09('0x4a')](_0x39bb80);})[_0x1d09('0x1c')](function(_0xc70892){_0xaf5296[_0x1d09('0x4b')]=_0xc70892;return _0xaf5296;})[_0x1d09('0x1c')](respondWithFilteredResult(_0x9f490d,_0x39bb80))[_0x1d09('0x24')](handleError(_0x9f490d,null));};exports[_0x1d09('0x4c')]=function(_0xa75b20,_0x247a25){var _0xce9ba2={'raw':![],'where':{'id':_0xa75b20[_0x1d09('0x4d')]['id']}},_0x22ceca={};_0x22ceca['model']=_['keys'](db[_0x1d09('0x35')][_0x1d09('0x36')]);_0x22ceca[_0x1d09('0x3c')]=_[_0x1d09('0x4e')](_0xa75b20[_0x1d09('0x3c')]);_0x22ceca['filters']=_[_0x1d09('0x3a')](_0x22ceca['model'],_0x22ceca[_0x1d09('0x3c')]);_0xce9ba2[_0x1d09('0x3e')]=_[_0x1d09('0x3a')](_0x22ceca[_0x1d09('0x3b')],qs[_0x1d09('0x3d')](_0xa75b20[_0x1d09('0x3c')][_0x1d09('0x3d')]));_0xce9ba2['attributes']=_0xce9ba2['attributes']['length']?_0xce9ba2[_0x1d09('0x3e')]:_0x22ceca[_0x1d09('0x3b')];if(_0xa75b20[_0x1d09('0x3c')][_0x1d09('0x4f')]){_0xce9ba2[_0x1d09('0x49')]=[{'all':!![]}];}_0xce9ba2=_[_0x1d09('0x45')]({},_0xce9ba2,_0xa75b20[_0x1d09('0x48')]);return db['FreshdeskConfiguration']['find'](_0xce9ba2)[_0x1d09('0x1c')](handleEntityNotFound(_0x247a25,null))[_0x1d09('0x1c')](respondWithResult(_0x247a25,null))[_0x1d09('0x24')](handleError(_0x247a25,null));};exports['create']=function(_0x4e2841,_0x4ea1da){return db[_0x1d09('0x35')][_0x1d09('0x50')](_0x4e2841[_0x1d09('0x51')],{})[_0x1d09('0x1c')](respondWithResult(_0x4ea1da,0xc9))[_0x1d09('0x24')](handleError(_0x4ea1da,null));};exports[_0x1d09('0x2e')]=function(_0x4ceae2,_0xfc08d){if(_0x4ceae2[_0x1d09('0x51')]['id']){delete _0x4ceae2[_0x1d09('0x51')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x4ceae2[_0x1d09('0x4d')]['id']}})['then'](handleEntityNotFound(_0xfc08d,null))[_0x1d09('0x1c')](saveUpdates(_0x4ceae2['body'],null))[_0x1d09('0x1c')](respondWithResult(_0xfc08d,null))[_0x1d09('0x24')](handleError(_0xfc08d,null));};exports[_0x1d09('0x2f')]=function(_0x5353bb,_0x3ee2e3){return db[_0x1d09('0x35')][_0x1d09('0x52')]({'where':{'id':_0x5353bb[_0x1d09('0x4d')]['id']}})[_0x1d09('0x1c')](handleEntityNotFound(_0x3ee2e3,null))[_0x1d09('0x1c')](removeEntity(_0x3ee2e3,null))[_0x1d09('0x24')](handleError(_0x3ee2e3,null));};exports[_0x1d09('0x53')]=function(_0x59013a,_0xf9b778,_0x1d32ee){var _0x49f2d8={};var _0x274022={};var _0x5ede05;var _0x2761e9;return db[_0x1d09('0x35')][_0x1d09('0x54')]({'where':{'id':_0x59013a[_0x1d09('0x4d')]['id']}})[_0x1d09('0x1c')](handleEntityNotFound(_0xf9b778,null))[_0x1d09('0x1c')](function(_0x3140b1){if(_0x3140b1){_0x5ede05=_0x3140b1;_0x274022[_0x1d09('0x3b')]=_[_0x1d09('0x4e')](db['FreshdeskField'][_0x1d09('0x36')]);_0x274022[_0x1d09('0x3c')]=_['keys'](_0x59013a[_0x1d09('0x3c')]);_0x274022[_0x1d09('0x39')]=_['intersection'](_0x274022[_0x1d09('0x3b')],_0x274022[_0x1d09('0x3c')]);_0x49f2d8['attributes']=_[_0x1d09('0x3a')](_0x274022[_0x1d09('0x3b')],qs[_0x1d09('0x3d')](_0x59013a[_0x1d09('0x3c')]['fields']));_0x49f2d8['attributes']=_0x49f2d8['attributes'][_0x1d09('0x3f')]?_0x49f2d8[_0x1d09('0x3e')]:_0x274022['model'];_0x49f2d8['order']=qs[_0x1d09('0x42')](_0x59013a[_0x1d09('0x3c')][_0x1d09('0x42')]);_0x49f2d8[_0x1d09('0x55')]=qs[_0x1d09('0x39')](_[_0x1d09('0x43')](_0x59013a[_0x1d09('0x3c')],_0x274022[_0x1d09('0x39')]));if(_0x59013a[_0x1d09('0x3c')][_0x1d09('0x44')]){_0x49f2d8[_0x1d09('0x55')]=_[_0x1d09('0x45')](_0x49f2d8[_0x1d09('0x55')],{'$or':_[_0x1d09('0x34')](_0x49f2d8[_0x1d09('0x3e')],function(_0x57a27c){var _0x3974aa={};_0x3974aa[_0x57a27c]={'$like':'%'+_0x59013a['query'][_0x1d09('0x44')]+'%'};return _0x3974aa;})});}_0x49f2d8=_['merge']({},_0x49f2d8,_0x59013a['options']);return _0x5ede05[_0x1d09('0x53')](_0x49f2d8);}})[_0x1d09('0x1c')](function(_0x4679af){if(_0x4679af){_0x2761e9=_0x4679af[_0x1d09('0x3f')];if(!_0x59013a[_0x1d09('0x3c')][_0x1d09('0x40')]('nolimit')){_0x49f2d8['limit']=qs[_0x1d09('0x2a')](_0x59013a[_0x1d09('0x3c')][_0x1d09('0x2a')]);_0x49f2d8[_0x1d09('0x29')]=qs[_0x1d09('0x29')](_0x59013a[_0x1d09('0x3c')][_0x1d09('0x29')]);}return _0x5ede05[_0x1d09('0x53')](_0x49f2d8);}})[_0x1d09('0x1c')](function(_0x4c6665){if(_0x4c6665){return _0x4c6665?{'count':_0x2761e9,'rows':_0x4c6665}:null;}})[_0x1d09('0x1c')](respondWithResult(_0xf9b778,null))[_0x1d09('0x24')](handleError(_0xf9b778,null));};exports['getSubjects']=function(_0xfdcb0b,_0x4ea7bc,_0x17088e){var _0x8ab6ae={};var _0xc26674={};var _0x5a788e;var _0x56ff3b;return db[_0x1d09('0x35')][_0x1d09('0x54')]({'where':{'id':_0xfdcb0b[_0x1d09('0x4d')]['id']}})[_0x1d09('0x1c')](handleEntityNotFound(_0x4ea7bc,null))['then'](function(_0x5c8749){if(_0x5c8749){_0x5a788e=_0x5c8749;_0xc26674[_0x1d09('0x3b')]=_[_0x1d09('0x4e')](db['FreshdeskField']['rawAttributes']);_0xc26674[_0x1d09('0x3c')]=_[_0x1d09('0x4e')](_0xfdcb0b['query']);_0xc26674['filters']=_['intersection'](_0xc26674[_0x1d09('0x3b')],_0xc26674[_0x1d09('0x3c')]);_0x8ab6ae['attributes']=_['intersection'](_0xc26674[_0x1d09('0x3b')],qs['fields'](_0xfdcb0b[_0x1d09('0x3c')][_0x1d09('0x3d')]));_0x8ab6ae[_0x1d09('0x3e')]=_0x8ab6ae[_0x1d09('0x3e')]['length']?_0x8ab6ae[_0x1d09('0x3e')]:_0xc26674[_0x1d09('0x3b')];_0x8ab6ae['order']=qs[_0x1d09('0x42')](_0xfdcb0b['query']['sort']);_0x8ab6ae[_0x1d09('0x55')]=qs['filters'](_['pick'](_0xfdcb0b[_0x1d09('0x3c')],_0xc26674[_0x1d09('0x39')]));if(_0xfdcb0b[_0x1d09('0x3c')][_0x1d09('0x44')]){_0x8ab6ae['where']=_[_0x1d09('0x45')](_0x8ab6ae['where'],{'$or':_[_0x1d09('0x34')](_0x8ab6ae['attributes'],function(_0x4b44e9){var _0x100d5e={};_0x100d5e[_0x4b44e9]={'$like':'%'+_0xfdcb0b[_0x1d09('0x3c')][_0x1d09('0x44')]+'%'};return _0x100d5e;})});}_0x8ab6ae=_[_0x1d09('0x45')]({},_0x8ab6ae,_0xfdcb0b[_0x1d09('0x48')]);return _0x5a788e[_0x1d09('0x56')](_0x8ab6ae);}})[_0x1d09('0x1c')](function(_0x24e235){if(_0x24e235){_0x56ff3b=_0x24e235['length'];if(!_0xfdcb0b['query'][_0x1d09('0x40')](_0x1d09('0x57'))){_0x8ab6ae[_0x1d09('0x2a')]=qs[_0x1d09('0x2a')](_0xfdcb0b[_0x1d09('0x3c')]['limit']);_0x8ab6ae['offset']=qs['offset'](_0xfdcb0b['query'][_0x1d09('0x29')]);}return _0x5a788e[_0x1d09('0x56')](_0x8ab6ae);}})[_0x1d09('0x1c')](function(_0x5d53b4){if(_0x5d53b4){return _0x5d53b4?{'count':_0x56ff3b,'rows':_0x5d53b4}:null;}})[_0x1d09('0x1c')](respondWithResult(_0x4ea7bc,null))['catch'](handleError(_0x4ea7bc,null));};exports[_0x1d09('0x58')]=function(_0x68bce1,_0x503020,_0x1ec833){var _0x272ebc={};var _0x1f785a={};var _0x2168b2;var _0x5c798f;return db[_0x1d09('0x35')][_0x1d09('0x54')]({'where':{'id':_0x68bce1[_0x1d09('0x4d')]['id']}})[_0x1d09('0x1c')](handleEntityNotFound(_0x503020,null))[_0x1d09('0x1c')](function(_0x1ae20c){if(_0x1ae20c){_0x2168b2=_0x1ae20c;_0x1f785a[_0x1d09('0x3b')]=_[_0x1d09('0x4e')](db[_0x1d09('0x59')][_0x1d09('0x36')]);_0x1f785a[_0x1d09('0x3c')]=_[_0x1d09('0x4e')](_0x68bce1['query']);_0x1f785a['filters']=_['intersection'](_0x1f785a[_0x1d09('0x3b')],_0x1f785a['query']);_0x272ebc[_0x1d09('0x3e')]=_[_0x1d09('0x3a')](_0x1f785a['model'],qs[_0x1d09('0x3d')](_0x68bce1[_0x1d09('0x3c')][_0x1d09('0x3d')]));_0x272ebc[_0x1d09('0x3e')]=_0x272ebc[_0x1d09('0x3e')][_0x1d09('0x3f')]?_0x272ebc['attributes']:_0x1f785a['model'];_0x272ebc['order']=qs[_0x1d09('0x42')](_0x68bce1[_0x1d09('0x3c')]['sort']);_0x272ebc[_0x1d09('0x55')]=qs[_0x1d09('0x39')](_[_0x1d09('0x43')](_0x68bce1['query'],_0x1f785a[_0x1d09('0x39')]));if(_0x68bce1['query'][_0x1d09('0x44')]){_0x272ebc[_0x1d09('0x55')]=_[_0x1d09('0x45')](_0x272ebc[_0x1d09('0x55')],{'$or':_[_0x1d09('0x34')](_0x272ebc['attributes'],function(_0x1d3979){var _0x1ffaef={};_0x1ffaef[_0x1d3979]={'$like':'%'+_0x68bce1[_0x1d09('0x3c')][_0x1d09('0x44')]+'%'};return _0x1ffaef;})});}_0x272ebc=_[_0x1d09('0x45')]({},_0x272ebc,_0x68bce1[_0x1d09('0x48')]);return _0x2168b2[_0x1d09('0x58')](_0x272ebc);}})['then'](function(_0xfcb650){if(_0xfcb650){_0x5c798f=_0xfcb650['length'];if(!_0x68bce1['query'][_0x1d09('0x40')](_0x1d09('0x57'))){_0x272ebc[_0x1d09('0x2a')]=qs['limit'](_0x68bce1['query'][_0x1d09('0x2a')]);_0x272ebc[_0x1d09('0x29')]=qs['offset'](_0x68bce1[_0x1d09('0x3c')][_0x1d09('0x29')]);}return _0x2168b2['getDescriptions'](_0x272ebc);}})[_0x1d09('0x1c')](function(_0xfe4b98){if(_0xfe4b98){return _0xfe4b98?{'count':_0x5c798f,'rows':_0xfe4b98}:null;}})[_0x1d09('0x1c')](respondWithResult(_0x503020,null))[_0x1d09('0x24')](handleError(_0x503020,null));};exports['getTags']=function(_0x23a9d9,_0x3a3f72,_0x259be9){var _0x1eaa64={};var _0x5ebe49={};var _0x3df31d;var _0x418524;return db[_0x1d09('0x35')][_0x1d09('0x54')]({'where':{'id':_0x23a9d9['params']['id']}})[_0x1d09('0x1c')](handleEntityNotFound(_0x3a3f72,null))['then'](function(_0x38a862){if(_0x38a862){_0x3df31d=_0x38a862;_0x5ebe49['model']=_[_0x1d09('0x4e')](db[_0x1d09('0x5a')][_0x1d09('0x36')]);_0x5ebe49[_0x1d09('0x3c')]=_[_0x1d09('0x4e')](_0x23a9d9[_0x1d09('0x3c')]);_0x5ebe49[_0x1d09('0x39')]=_['intersection'](_0x5ebe49[_0x1d09('0x3b')],_0x5ebe49[_0x1d09('0x3c')]);_0x1eaa64[_0x1d09('0x3e')]=_[_0x1d09('0x3a')](_0x5ebe49['model'],qs[_0x1d09('0x3d')](_0x23a9d9['query'][_0x1d09('0x3d')]));_0x1eaa64[_0x1d09('0x3e')]=_0x1eaa64[_0x1d09('0x3e')]['length']?_0x1eaa64['attributes']:_0x5ebe49[_0x1d09('0x3b')];_0x1eaa64[_0x1d09('0x41')]=qs[_0x1d09('0x42')](_0x23a9d9['query'][_0x1d09('0x42')]);_0x1eaa64['where']=qs['filters'](_[_0x1d09('0x43')](_0x23a9d9[_0x1d09('0x3c')],_0x5ebe49['filters']));if(_0x23a9d9[_0x1d09('0x3c')][_0x1d09('0x44')]){_0x1eaa64['where']=_[_0x1d09('0x45')](_0x1eaa64[_0x1d09('0x55')],{'$or':_[_0x1d09('0x34')](_0x1eaa64[_0x1d09('0x3e')],function(_0x1f79b7){var _0x497bca={};_0x497bca[_0x1f79b7]={'$like':'%'+_0x23a9d9[_0x1d09('0x3c')][_0x1d09('0x44')]+'%'};return _0x497bca;})});}_0x1eaa64=_['merge']({},_0x1eaa64,_0x23a9d9[_0x1d09('0x48')]);return _0x3df31d[_0x1d09('0x5b')](_0x1eaa64);}})[_0x1d09('0x1c')](function(_0x201507){if(_0x201507){_0x418524=_0x201507['length'];if(!_0x23a9d9[_0x1d09('0x3c')][_0x1d09('0x40')](_0x1d09('0x57'))){_0x1eaa64[_0x1d09('0x2a')]=qs['limit'](_0x23a9d9[_0x1d09('0x3c')]['limit']);_0x1eaa64[_0x1d09('0x29')]=qs[_0x1d09('0x29')](_0x23a9d9[_0x1d09('0x3c')][_0x1d09('0x29')]);}return _0x3df31d['getTags'](_0x1eaa64);}})[_0x1d09('0x1c')](function(_0x24edd2){if(_0x24edd2){return _0x24edd2?{'count':_0x418524,'rows':_0x24edd2}:null;}})[_0x1d09('0x1c')](respondWithResult(_0x3a3f72,null))[_0x1d09('0x24')](handleError(_0x3a3f72,null));};exports[_0x1d09('0x5c')]=function(_0xfe28ae,_0x257d05,_0x33ebf2){if(_0xfe28ae['body']['id']){delete _0xfe28ae[_0x1d09('0x51')]['id'];}return db[_0x1d09('0x35')]['findOne']({'where':{'id':_0xfe28ae['params']['id']}})[_0x1d09('0x1c')](handleEntityNotFound(_0x257d05,null))[_0x1d09('0x1c')](function(_0xcd14c4){if(_0xcd14c4){return _0xcd14c4[_0x1d09('0x5c')](_0xfe28ae['body']['ids']||[]);}return null;})[_0x1d09('0x1c')](respondWithResult(_0x257d05,null))[_0x1d09('0x24')](handleError(_0x257d05,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 8130ffc..a181385 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 _0xcd69=['request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcd69,0xb0));var _0x9cd6=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xcd69[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x9cd6('0x0'));var util=require(_0x9cd6('0x1'));var logger=require(_0x9cd6('0x2'))(_0x9cd6('0x3'));var moment=require(_0x9cd6('0x4'));var BPromise=require(_0x9cd6('0x5'));var rp=require(_0x9cd6('0x6'));var fs=require('fs');var path=require(_0x9cd6('0x7'));var rimraf=require('rimraf');var config=require(_0x9cd6('0x8'));var attributes=require(_0x9cd6('0x9'));module[_0x9cd6('0xa')]=function(_0x2a58e5,_0x4dfd74){return _0x2a58e5[_0x9cd6('0xb')](_0x9cd6('0xc'),attributes,{'tableName':_0x9cd6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafac=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','lodash','util'];(function(_0x5d9242,_0x433286){var _0x28797e=function(_0x29398c){while(--_0x29398c){_0x5d9242['push'](_0x5d9242['shift']());}};_0x28797e(++_0x433286);}(_0xafac,0x6a));var _0xcafa=function(_0x38db77,_0x18239f){_0x38db77=_0x38db77-0x0;var _0x916e60=_0xafac[_0x38db77];return _0x916e60;};'use strict';var _=require(_0xcafa('0x0'));var util=require(_0xcafa('0x1'));var logger=require(_0xcafa('0x2'))(_0xcafa('0x3'));var moment=require(_0xcafa('0x4'));var BPromise=require(_0xcafa('0x5'));var rp=require(_0xcafa('0x6'));var fs=require('fs');var path=require(_0xcafa('0x7'));var rimraf=require(_0xcafa('0x8'));var config=require('../../config/environment');var attributes=require(_0xcafa('0x9'));module['exports']=function(_0x188be6,_0x4821c4){return _0x188be6[_0xcafa('0xa')](_0xcafa('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 58e3bbe..1bf6f6c 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 _0xc05b=['../../config/utils','../../config/logger','../../config/environment','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1aba0f,_0x242a5d){var _0xf6e33d=function(_0x508922){while(--_0x508922){_0x1aba0f['push'](_0x1aba0f['shift']());}};_0xf6e33d(++_0x242a5d);}(_0xc05b,0x1dc));var _0xbc05=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0xc05b[_0x381379];return _0x3e1063;};'use strict';var _=require(_0xbc05('0x0'));var util=require(_0xbc05('0x1'));var moment=require(_0xbc05('0x2'));var BPromise=require(_0xbc05('0x3'));var rs=require(_0xbc05('0x4'));var fs=require('fs');var Redis=require(_0xbc05('0x5'));var db=require(_0xbc05('0x6'))['db'];var utils=require(_0xbc05('0x7'));var logger=require(_0xbc05('0x8'))('rpc');var config=require(_0xbc05('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x971af5,_0x1ab25c,_0x2f2254){return new BPromise(function(_0x2a2cf0,_0x3e91f3){return client[_0xbc05('0xa')](_0x971af5,_0x2f2254)[_0xbc05('0xb')](function(_0x6c7d13){logger['info'](_0xbc05('0xc'),_0x1ab25c,_0xbc05('0xd'));logger[_0xbc05('0xe')](_0xbc05('0xf'),_0x1ab25c,_0xbc05('0xd'),JSON['stringify'](_0x6c7d13));if(_0x6c7d13[_0xbc05('0x10')]){if(_0x6c7d13['error']['code']===0x1f4){logger[_0xbc05('0x10')](_0xbc05('0xc'),_0x1ab25c,_0x6c7d13[_0xbc05('0x10')][_0xbc05('0x11')]);return _0x3e91f3(_0x6c7d13[_0xbc05('0x10')][_0xbc05('0x11')]);}logger['error'](_0xbc05('0xc'),_0x1ab25c,_0x6c7d13[_0xbc05('0x10')]['message']);return _0x2a2cf0(_0x6c7d13[_0xbc05('0x10')][_0xbc05('0x11')]);}else{logger[_0xbc05('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1ab25c,_0xbc05('0xd'));_0x2a2cf0(_0x6c7d13[_0xbc05('0x13')]['message']);}})[_0xbc05('0x14')](function(_0x33a163){logger[_0xbc05('0x10')](_0xbc05('0xc'),_0x1ab25c,_0x33a163);_0x3e91f3(_0x33a163);});});} \ No newline at end of file +var _0x225e=['code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x202fdb,_0x18fcee){var _0x24f72d=function(_0x3667af){while(--_0x3667af){_0x202fdb['push'](_0x202fdb['shift']());}};_0x24f72d(++_0x18fcee);}(_0x225e,0xa5));var _0xe225=function(_0x496e57,_0x3f69db){_0x496e57=_0x496e57-0x0;var _0x5b0ba8=_0x225e[_0x496e57];return _0x5b0ba8;};'use strict';var _=require(_0xe225('0x0'));var util=require(_0xe225('0x1'));var moment=require(_0xe225('0x2'));var BPromise=require(_0xe225('0x3'));var rs=require(_0xe225('0x4'));var fs=require('fs');var Redis=require(_0xe225('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe225('0x6'));var logger=require(_0xe225('0x7'))(_0xe225('0x8'));var config=require(_0xe225('0x9'));var jayson=require(_0xe225('0xa'));var client=jayson['client'][_0xe225('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x354d78,_0x26d7b7,_0x39b38b){return new BPromise(function(_0x2e554b,_0x333b4a){return client[_0xe225('0xc')](_0x354d78,_0x39b38b)[_0xe225('0xd')](function(_0x5d77c4){logger['info'](_0xe225('0xe'),_0x26d7b7,'request\x20sent');logger['debug'](_0xe225('0xf'),_0x26d7b7,_0xe225('0x10'),JSON[_0xe225('0x11')](_0x5d77c4));if(_0x5d77c4['error']){if(_0x5d77c4[_0xe225('0x12')][_0xe225('0x13')]===0x1f4){logger[_0xe225('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x26d7b7,_0x5d77c4['error'][_0xe225('0x14')]);return _0x333b4a(_0x5d77c4['error'][_0xe225('0x14')]);}logger[_0xe225('0x12')](_0xe225('0xe'),_0x26d7b7,_0x5d77c4['error'][_0xe225('0x14')]);return _0x2e554b(_0x5d77c4[_0xe225('0x12')]['message']);}else{logger[_0xe225('0x15')](_0xe225('0xe'),_0x26d7b7,_0xe225('0x10'));_0x2e554b(_0x5d77c4['result'][_0xe225('0x14')]);}})[_0xe225('0x16')](function(_0x17c4e6){logger[_0xe225('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x26d7b7,_0x17c4e6);_0x333b4a(_0x17c4e6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index b80d5cb..1beb43d 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 _0x3e74=['connect-timeout','express','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','multer','path'];(function(_0x447127,_0xbe4ade){var _0x358a25=function(_0x44fead){while(--_0x44fead){_0x447127['push'](_0x447127['shift']());}};_0x358a25(++_0xbe4ade);}(_0x3e74,0x175));var _0x43e7=function(_0x54053f,_0x5645b9){_0x54053f=_0x54053f-0x0;var _0x466531=_0x3e74[_0x54053f];return _0x466531;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['put'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0xd')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x1fb96e,_0x129a1e){var _0x5cfce3=function(_0x3f6e44){while(--_0x3f6e44){_0x1fb96e['push'](_0x1fb96e['shift']());}};_0x5cfce3(++_0x129a1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index f22ea80..26e2364 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 _0xfd8f=['exports','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x3aee4b,_0x3ee55c){var _0x26a74e=function(_0x327b1a){while(--_0x327b1a){_0x3aee4b['push'](_0x3aee4b['shift']());}};_0x26a74e(++_0x3ee55c);}(_0xfd8f,0xae));var _0xffd8=function(_0x6f9850,_0x117115){_0x6f9850=_0x6f9850-0x0;var _0x4bd72a=_0xfd8f[_0x6f9850];return _0x4bd72a;};'use strict';var Sequelize=require(_0xffd8('0x0'));module[_0xffd8('0x1')]={'type':{'type':Sequelize['ENUM'](_0xffd8('0x2'),_0xffd8('0x3'),_0xffd8('0x4'),_0xffd8('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xffd8('0x6')]},'key':{'type':Sequelize[_0xffd8('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xffd8('0x2'),_0xffd8('0x3'),_0xffd8('0x4'))},'keyContent':{'type':Sequelize[_0xffd8('0x6')]},'idField':{'type':Sequelize[_0xffd8('0x6')]},'nameField':{'type':Sequelize[_0xffd8('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xffd8('0x6')]}}; \ No newline at end of file +var _0xe9b9=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x3ecd5f,_0x58e740){var _0xf44559=function(_0x408297){while(--_0x408297){_0x3ecd5f['push'](_0x3ecd5f['shift']());}};_0xf44559(++_0x58e740);}(_0xe9b9,0xd4));var _0x9e9b=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0xe9b9[_0x254d9f];return _0x1eedb9;};'use strict';var Sequelize=require(_0x9e9b('0x0'));module[_0x9e9b('0x1')]={'type':{'type':Sequelize[_0x9e9b('0x2')](_0x9e9b('0x3'),_0x9e9b('0x4'),_0x9e9b('0x5'),_0x9e9b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9e9b('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x9e9b('0x3'),_0x9e9b('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9e9b('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9e9b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9e9b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 21ab420..83e4fa9 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 _0xea6c=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','where','pick','filter','merge','type','VIRTUAL','options','count','include','catch','show','params','includeAll','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0x5134c0,_0x211628){var _0x22548c=function(_0x2ef405){while(--_0x2ef405){_0x5134c0['push'](_0x5134c0['shift']());}};_0x22548c(++_0x211628);}(_0xea6c,0x164));var _0xcea6=function(_0x100ffb,_0x5a8adc){_0x100ffb=_0x100ffb-0x0;var _0x54e870=_0xea6c[_0x100ffb];return _0x54e870;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcea6('0x0'));var rimraf=require(_0xcea6('0x1'));var zipdir=require(_0xcea6('0x2'));var jsonpatch=require(_0xcea6('0x3'));var rp=require(_0xcea6('0x4'));var moment=require(_0xcea6('0x5'));var BPromise=require(_0xcea6('0x6'));var Mustache=require(_0xcea6('0x7'));var util=require(_0xcea6('0x8'));var path=require(_0xcea6('0x9'));var sox=require(_0xcea6('0xa'));var csv=require('to-csv');var ejs=require(_0xcea6('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcea6('0xc'));var crypto=require(_0xcea6('0xd'));var jsforce=require(_0xcea6('0xe'));var deskjs=require(_0xcea6('0xf'));var toCsv=require(_0xcea6('0x10'));var querystring=require('querystring');var Papa=require(_0xcea6('0x11'));var Redis=require(_0xcea6('0x12'));var authService=require(_0xcea6('0x13'));var qs=require(_0xcea6('0x14'));var as=require(_0xcea6('0x15'));var hardwareService=require(_0xcea6('0x16'));var logger=require(_0xcea6('0x17'))(_0xcea6('0x18'));var utils=require(_0xcea6('0x19'));var config=require(_0xcea6('0x1a'));var licenseUtil=require(_0xcea6('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ae704,_0x44b6d3){_0x44b6d3=_0x44b6d3||0xcc;return function(_0x4dd936){if(_0x4dd936){return _0x1ae704[_0xcea6('0x1c')](_0x44b6d3);}return _0x1ae704[_0xcea6('0x1d')](_0x44b6d3)[_0xcea6('0x1e')]();};}function respondWithResult(_0x2d4967,_0x109f9c){_0x109f9c=_0x109f9c||0xc8;return function(_0xdc17){if(_0xdc17){return _0x2d4967['status'](_0x109f9c)[_0xcea6('0x1f')](_0xdc17);}};}function respondWithFilteredResult(_0x1bea40,_0x61fa13){return function(_0x56d51e){if(_0x56d51e){var _0x209afd=_0x56d51e['count'],_0x5c0532=_0x61fa13[_0xcea6('0x20')],_0x4744dc=_0x61fa13[_0xcea6('0x20')]+_0x61fa13[_0xcea6('0x21')],_0x233b3d;if(_0x4744dc>=_0x209afd){_0x4744dc=_0x209afd;_0x233b3d=0xc8;}else{_0x233b3d=0xce;}_0x1bea40[_0xcea6('0x1d')](_0x233b3d);return _0x1bea40[_0xcea6('0x22')](_0xcea6('0x23'),_0x5c0532+'-'+_0x4744dc+'/'+_0x209afd)[_0xcea6('0x1f')](_0x56d51e);}return null;};}function patchUpdates(_0x22afbb){return function(_0x2c5060){try{jsonpatch['apply'](_0x2c5060,_0x22afbb,!![]);}catch(_0x1b520e){return BPromise[_0xcea6('0x24')](_0x1b520e);}return _0x2c5060[_0xcea6('0x25')]();};}function saveUpdates(_0x54524c,_0x30a78){return function(_0x17dd0d){if(_0x17dd0d){return _0x17dd0d['update'](_0x54524c)['then'](function(_0x5564a8){return _0x5564a8;});}return null;};}function removeEntity(_0x20f063,_0x522619){return function(_0x58a148){if(_0x58a148){return _0x58a148['destroy']()[_0xcea6('0x26')](function(){_0x20f063[_0xcea6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaf9cf9,_0x4c56c5){return function(_0x5cf628){if(!_0x5cf628){_0xaf9cf9['sendStatus'](0x194);}return _0x5cf628;};}function handleError(_0x7f98bb,_0x3eda5f){_0x3eda5f=_0x3eda5f||0x1f4;return function(_0xdf22da){logger[_0xcea6('0x27')](_0xdf22da['stack']);if(_0xdf22da[_0xcea6('0x28')]){delete _0xdf22da[_0xcea6('0x28')];}_0x7f98bb[_0xcea6('0x1d')](_0x3eda5f)[_0xcea6('0x29')](_0xdf22da);};}exports[_0xcea6('0x2a')]=function(_0x3f0f21,_0x57cb5){var _0x2c46ed={},_0x33ac52={},_0xd0efce={'count':0x0,'rows':[]};var _0x295c40=_[_0xcea6('0x2b')](db[_0xcea6('0x2c')][_0xcea6('0x2d')],function(_0x2e3f4d){return{'name':_0x2e3f4d[_0xcea6('0x2e')],'type':_0x2e3f4d['type'][_0xcea6('0x2f')]};});_0x33ac52[_0xcea6('0x30')]=_['map'](_0x295c40,_0xcea6('0x28'));_0x33ac52[_0xcea6('0x31')]=_[_0xcea6('0x32')](_0x3f0f21['query']);_0x33ac52[_0xcea6('0x33')]=_['intersection'](_0x33ac52[_0xcea6('0x30')],_0x33ac52[_0xcea6('0x31')]);_0x2c46ed[_0xcea6('0x34')]=_[_0xcea6('0x35')](_0x33ac52[_0xcea6('0x30')],qs[_0xcea6('0x36')](_0x3f0f21['query'][_0xcea6('0x36')]));_0x2c46ed[_0xcea6('0x34')]=_0x2c46ed[_0xcea6('0x34')][_0xcea6('0x37')]?_0x2c46ed['attributes']:_0x33ac52[_0xcea6('0x30')];if(!_0x3f0f21[_0xcea6('0x31')][_0xcea6('0x38')]('nolimit')){_0x2c46ed[_0xcea6('0x21')]=qs['limit'](_0x3f0f21[_0xcea6('0x31')][_0xcea6('0x21')]);_0x2c46ed['offset']=qs[_0xcea6('0x20')](_0x3f0f21['query'][_0xcea6('0x20')]);}_0x2c46ed['order']=qs['sort'](_0x3f0f21['query']['sort']);_0x2c46ed[_0xcea6('0x39')]=qs[_0xcea6('0x33')](_[_0xcea6('0x3a')](_0x3f0f21[_0xcea6('0x31')],_0x33ac52['filters']),_0x295c40);if(_0x3f0f21[_0xcea6('0x31')][_0xcea6('0x3b')]){_0x2c46ed[_0xcea6('0x39')]=_[_0xcea6('0x3c')](_0x2c46ed['where'],{'$or':_['map'](_0x295c40,function(_0x375ac4){if(_0x375ac4[_0xcea6('0x3d')]!==_0xcea6('0x3e')){var _0x40181d={};_0x40181d[_0x375ac4[_0xcea6('0x28')]]={'$like':'%'+_0x3f0f21[_0xcea6('0x31')][_0xcea6('0x3b')]+'%'};return _0x40181d;}})});}_0x2c46ed=_[_0xcea6('0x3c')]({},_0x2c46ed,_0x3f0f21[_0xcea6('0x3f')]);var _0xaa7a58={'where':_0x2c46ed['where']};return db['FreshdeskField'][_0xcea6('0x40')](_0xaa7a58)[_0xcea6('0x26')](function(_0x2ce2eb){_0xd0efce[_0xcea6('0x40')]=_0x2ce2eb;if(_0x3f0f21[_0xcea6('0x31')]['includeAll']){_0x2c46ed[_0xcea6('0x41')]=[{'all':!![]}];}return db[_0xcea6('0x2c')]['findAll'](_0x2c46ed);})[_0xcea6('0x26')](function(_0x22011e){_0xd0efce['rows']=_0x22011e;return _0xd0efce;})[_0xcea6('0x26')](respondWithFilteredResult(_0x57cb5,_0x2c46ed))[_0xcea6('0x42')](handleError(_0x57cb5,null));};exports[_0xcea6('0x43')]=function(_0x3c5320,_0x3cffd3){var _0x2df4a5={'raw':!![],'where':{'id':_0x3c5320[_0xcea6('0x44')]['id']}},_0x5db762={};_0x5db762[_0xcea6('0x30')]=_['keys'](db[_0xcea6('0x2c')][_0xcea6('0x2d')]);_0x5db762[_0xcea6('0x31')]=_[_0xcea6('0x32')](_0x3c5320[_0xcea6('0x31')]);_0x5db762[_0xcea6('0x33')]=_[_0xcea6('0x35')](_0x5db762['model'],_0x5db762[_0xcea6('0x31')]);_0x2df4a5['attributes']=_[_0xcea6('0x35')](_0x5db762['model'],qs[_0xcea6('0x36')](_0x3c5320[_0xcea6('0x31')][_0xcea6('0x36')]));_0x2df4a5['attributes']=_0x2df4a5[_0xcea6('0x34')]['length']?_0x2df4a5[_0xcea6('0x34')]:_0x5db762[_0xcea6('0x30')];if(_0x3c5320[_0xcea6('0x31')][_0xcea6('0x45')]){_0x2df4a5[_0xcea6('0x41')]=[{'all':!![]}];}_0x2df4a5=_[_0xcea6('0x3c')]({},_0x2df4a5,_0x3c5320[_0xcea6('0x3f')]);return db['FreshdeskField'][_0xcea6('0x46')](_0x2df4a5)['then'](handleEntityNotFound(_0x3cffd3,null))[_0xcea6('0x26')](respondWithResult(_0x3cffd3,null))[_0xcea6('0x42')](handleError(_0x3cffd3,null));};exports[_0xcea6('0x47')]=function(_0x1b1232,_0x22ef28){return db[_0xcea6('0x2c')][_0xcea6('0x47')](_0x1b1232[_0xcea6('0x48')],{})[_0xcea6('0x26')](respondWithResult(_0x22ef28,0xc9))[_0xcea6('0x42')](handleError(_0x22ef28,null));};exports[_0xcea6('0x49')]=function(_0x462555,_0xec3e59){if(_0x462555[_0xcea6('0x48')]['id']){delete _0x462555[_0xcea6('0x48')]['id'];}return db[_0xcea6('0x2c')]['find']({'where':{'id':_0x462555[_0xcea6('0x44')]['id']}})['then'](handleEntityNotFound(_0xec3e59,null))[_0xcea6('0x26')](saveUpdates(_0x462555[_0xcea6('0x48')],null))[_0xcea6('0x26')](respondWithResult(_0xec3e59,null))[_0xcea6('0x42')](handleError(_0xec3e59,null));};exports[_0xcea6('0x4a')]=function(_0x204e67,_0x4a3fc3){return db[_0xcea6('0x2c')][_0xcea6('0x46')]({'where':{'id':_0x204e67[_0xcea6('0x44')]['id']}})[_0xcea6('0x26')](handleEntityNotFound(_0x4a3fc3,null))[_0xcea6('0x26')](removeEntity(_0x4a3fc3,null))[_0xcea6('0x42')](handleError(_0x4a3fc3,null));}; \ No newline at end of file +var _0xf2a5=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','rows','show','params','intersection','find','catch','create','update','body','eml-format','rimraf','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x25c867,_0x4a5e56){var _0x1334e2=function(_0x386ce8){while(--_0x386ce8){_0x25c867['push'](_0x25c867['shift']());}};_0x1334e2(++_0x4a5e56);}(_0xf2a5,0xc8));var _0x5f2a=function(_0x149c2a,_0x1bdd10){_0x149c2a=_0x149c2a-0x0;var _0x40eb88=_0xf2a5[_0x149c2a];return _0x40eb88;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5f2a('0x0'));var rimraf=require(_0x5f2a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5f2a('0x2'));var Mustache=require(_0x5f2a('0x3'));var util=require(_0x5f2a('0x4'));var path=require(_0x5f2a('0x5'));var sox=require('sox');var csv=require(_0x5f2a('0x6'));var ejs=require(_0x5f2a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5f2a('0x8'));var crypto=require(_0x5f2a('0x9'));var jsforce=require(_0x5f2a('0xa'));var deskjs=require(_0x5f2a('0xb'));var toCsv=require(_0x5f2a('0x6'));var querystring=require(_0x5f2a('0xc'));var Papa=require(_0x5f2a('0xd'));var Redis=require(_0x5f2a('0xe'));var authService=require(_0x5f2a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5f2a('0x10'));var hardwareService=require(_0x5f2a('0x11'));var logger=require(_0x5f2a('0x12'))(_0x5f2a('0x13'));var utils=require('../../config/utils');var config=require(_0x5f2a('0x14'));var licenseUtil=require(_0x5f2a('0x15'));var db=require(_0x5f2a('0x16'))['db'];function respondWithStatusCode(_0x3149bb,_0x26d235){_0x26d235=_0x26d235||0xcc;return function(_0x39e637){if(_0x39e637){return _0x3149bb[_0x5f2a('0x17')](_0x26d235);}return _0x3149bb[_0x5f2a('0x18')](_0x26d235)['end']();};}function respondWithResult(_0x5da0c0,_0x254851){_0x254851=_0x254851||0xc8;return function(_0x1e84da){if(_0x1e84da){return _0x5da0c0['status'](_0x254851)['json'](_0x1e84da);}};}function respondWithFilteredResult(_0xaa543f,_0x4c2196){return function(_0x2aacef){if(_0x2aacef){var _0x301e18=_0x2aacef[_0x5f2a('0x19')],_0x3cf48a=_0x4c2196[_0x5f2a('0x1a')],_0x2ea6b0=_0x4c2196[_0x5f2a('0x1a')]+_0x4c2196[_0x5f2a('0x1b')],_0x277984;if(_0x2ea6b0>=_0x301e18){_0x2ea6b0=_0x301e18;_0x277984=0xc8;}else{_0x277984=0xce;}_0xaa543f[_0x5f2a('0x18')](_0x277984);return _0xaa543f[_0x5f2a('0x1c')](_0x5f2a('0x1d'),_0x3cf48a+'-'+_0x2ea6b0+'/'+_0x301e18)[_0x5f2a('0x1e')](_0x2aacef);}return null;};}function patchUpdates(_0x5a10f4){return function(_0x4b8086){try{jsonpatch[_0x5f2a('0x1f')](_0x4b8086,_0x5a10f4,!![]);}catch(_0x1b4866){return BPromise[_0x5f2a('0x20')](_0x1b4866);}return _0x4b8086[_0x5f2a('0x21')]();};}function saveUpdates(_0x154bfb,_0x1f58fe){return function(_0x589e12){if(_0x589e12){return _0x589e12['update'](_0x154bfb)[_0x5f2a('0x22')](function(_0x807dad){return _0x807dad;});}return null;};}function removeEntity(_0x39ca64,_0xcfcbb8){return function(_0x21ece1){if(_0x21ece1){return _0x21ece1[_0x5f2a('0x23')]()[_0x5f2a('0x22')](function(){_0x39ca64[_0x5f2a('0x18')](0xcc)[_0x5f2a('0x24')]();});}};}function handleEntityNotFound(_0x1ff840,_0x5e5866){return function(_0x18150f){if(!_0x18150f){_0x1ff840[_0x5f2a('0x17')](0x194);}return _0x18150f;};}function handleError(_0xbf1ae4,_0xdcdf59){_0xdcdf59=_0xdcdf59||0x1f4;return function(_0x31d9f6){logger['error'](_0x31d9f6[_0x5f2a('0x25')]);if(_0x31d9f6[_0x5f2a('0x26')]){delete _0x31d9f6['name'];}_0xbf1ae4[_0x5f2a('0x18')](_0xdcdf59)[_0x5f2a('0x27')](_0x31d9f6);};}exports[_0x5f2a('0x28')]=function(_0x2eb086,_0x32fc28){var _0x3a17eb={},_0x470a56={},_0x4e0fc2={'count':0x0,'rows':[]};var _0x318052=_[_0x5f2a('0x29')](db[_0x5f2a('0x2a')][_0x5f2a('0x2b')],function(_0x45ea80){return{'name':_0x45ea80[_0x5f2a('0x2c')],'type':_0x45ea80[_0x5f2a('0x2d')][_0x5f2a('0x2e')]};});_0x470a56['model']=_[_0x5f2a('0x29')](_0x318052,'name');_0x470a56[_0x5f2a('0x2f')]=_[_0x5f2a('0x30')](_0x2eb086[_0x5f2a('0x2f')]);_0x470a56[_0x5f2a('0x31')]=_['intersection'](_0x470a56['model'],_0x470a56[_0x5f2a('0x2f')]);_0x3a17eb[_0x5f2a('0x32')]=_['intersection'](_0x470a56[_0x5f2a('0x33')],qs[_0x5f2a('0x34')](_0x2eb086[_0x5f2a('0x2f')][_0x5f2a('0x34')]));_0x3a17eb[_0x5f2a('0x32')]=_0x3a17eb[_0x5f2a('0x32')][_0x5f2a('0x35')]?_0x3a17eb[_0x5f2a('0x32')]:_0x470a56['model'];if(!_0x2eb086[_0x5f2a('0x2f')][_0x5f2a('0x36')](_0x5f2a('0x37'))){_0x3a17eb[_0x5f2a('0x1b')]=qs[_0x5f2a('0x1b')](_0x2eb086[_0x5f2a('0x2f')][_0x5f2a('0x1b')]);_0x3a17eb[_0x5f2a('0x1a')]=qs[_0x5f2a('0x1a')](_0x2eb086[_0x5f2a('0x2f')]['offset']);}_0x3a17eb[_0x5f2a('0x38')]=qs['sort'](_0x2eb086[_0x5f2a('0x2f')][_0x5f2a('0x39')]);_0x3a17eb[_0x5f2a('0x3a')]=qs[_0x5f2a('0x31')](_['pick'](_0x2eb086[_0x5f2a('0x2f')],_0x470a56[_0x5f2a('0x31')]),_0x318052);if(_0x2eb086['query']['filter']){_0x3a17eb[_0x5f2a('0x3a')]=_[_0x5f2a('0x3b')](_0x3a17eb[_0x5f2a('0x3a')],{'$or':_[_0x5f2a('0x29')](_0x318052,function(_0x191ddc){if(_0x191ddc[_0x5f2a('0x2d')]!=='VIRTUAL'){var _0x3e5365={};_0x3e5365[_0x191ddc['name']]={'$like':'%'+_0x2eb086[_0x5f2a('0x2f')][_0x5f2a('0x3c')]+'%'};return _0x3e5365;}})});}_0x3a17eb=_[_0x5f2a('0x3b')]({},_0x3a17eb,_0x2eb086[_0x5f2a('0x3d')]);var _0x53541c={'where':_0x3a17eb['where']};return db['FreshdeskField'][_0x5f2a('0x19')](_0x53541c)[_0x5f2a('0x22')](function(_0x99fa50){_0x4e0fc2['count']=_0x99fa50;if(_0x2eb086[_0x5f2a('0x2f')][_0x5f2a('0x3e')]){_0x3a17eb[_0x5f2a('0x3f')]=[{'all':!![]}];}return db[_0x5f2a('0x2a')]['findAll'](_0x3a17eb);})[_0x5f2a('0x22')](function(_0x2edaa5){_0x4e0fc2[_0x5f2a('0x40')]=_0x2edaa5;return _0x4e0fc2;})[_0x5f2a('0x22')](respondWithFilteredResult(_0x32fc28,_0x3a17eb))['catch'](handleError(_0x32fc28,null));};exports[_0x5f2a('0x41')]=function(_0xc4b8ee,_0x5b74f7){var _0x520ce6={'raw':!![],'where':{'id':_0xc4b8ee[_0x5f2a('0x42')]['id']}},_0x3fb622={};_0x3fb622[_0x5f2a('0x33')]=_['keys'](db[_0x5f2a('0x2a')][_0x5f2a('0x2b')]);_0x3fb622[_0x5f2a('0x2f')]=_[_0x5f2a('0x30')](_0xc4b8ee[_0x5f2a('0x2f')]);_0x3fb622['filters']=_[_0x5f2a('0x43')](_0x3fb622[_0x5f2a('0x33')],_0x3fb622[_0x5f2a('0x2f')]);_0x520ce6['attributes']=_['intersection'](_0x3fb622[_0x5f2a('0x33')],qs[_0x5f2a('0x34')](_0xc4b8ee[_0x5f2a('0x2f')]['fields']));_0x520ce6[_0x5f2a('0x32')]=_0x520ce6[_0x5f2a('0x32')][_0x5f2a('0x35')]?_0x520ce6['attributes']:_0x3fb622[_0x5f2a('0x33')];if(_0xc4b8ee['query'][_0x5f2a('0x3e')]){_0x520ce6[_0x5f2a('0x3f')]=[{'all':!![]}];}_0x520ce6=_[_0x5f2a('0x3b')]({},_0x520ce6,_0xc4b8ee['options']);return db[_0x5f2a('0x2a')][_0x5f2a('0x44')](_0x520ce6)[_0x5f2a('0x22')](handleEntityNotFound(_0x5b74f7,null))[_0x5f2a('0x22')](respondWithResult(_0x5b74f7,null))[_0x5f2a('0x45')](handleError(_0x5b74f7,null));};exports[_0x5f2a('0x46')]=function(_0xb6285f,_0x35baa7){return db[_0x5f2a('0x2a')]['create'](_0xb6285f['body'],{})[_0x5f2a('0x22')](respondWithResult(_0x35baa7,0xc9))['catch'](handleError(_0x35baa7,null));};exports[_0x5f2a('0x47')]=function(_0x6cacf9,_0x47d752){if(_0x6cacf9[_0x5f2a('0x48')]['id']){delete _0x6cacf9[_0x5f2a('0x48')]['id'];}return db[_0x5f2a('0x2a')][_0x5f2a('0x44')]({'where':{'id':_0x6cacf9['params']['id']}})[_0x5f2a('0x22')](handleEntityNotFound(_0x47d752,null))[_0x5f2a('0x22')](saveUpdates(_0x6cacf9[_0x5f2a('0x48')],null))[_0x5f2a('0x22')](respondWithResult(_0x47d752,null))[_0x5f2a('0x45')](handleError(_0x47d752,null));};exports[_0x5f2a('0x23')]=function(_0x4ccd0e,_0x2ae552){return db['FreshdeskField'][_0x5f2a('0x44')]({'where':{'id':_0x4ccd0e[_0x5f2a('0x42')]['id']}})['then'](handleEntityNotFound(_0x2ae552,null))[_0x5f2a('0x22')](removeEntity(_0x2ae552,null))['catch'](handleError(_0x2ae552,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 132fb2c..ec891e6 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 _0x674c=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x674c,0xc5));var _0xc674=function(_0xa88469,_0x23f949){_0xa88469=_0xa88469-0x0;var _0x4e72a0=_0x674c[_0xa88469];return _0x4e72a0;};'use strict';var _=require(_0xc674('0x0'));var util=require(_0xc674('0x1'));var logger=require(_0xc674('0x2'))(_0xc674('0x3'));var moment=require(_0xc674('0x4'));var BPromise=require(_0xc674('0x5'));var rp=require(_0xc674('0x6'));var fs=require('fs');var path=require(_0xc674('0x7'));var rimraf=require('rimraf');var config=require(_0xc674('0x8'));var attributes=require(_0xc674('0x9'));module[_0xc674('0xa')]=function(_0x225696,_0x3fbaf8){return _0x225696['define'](_0xc674('0xb'),attributes,{'tableName':_0xc674('0xc'),'paranoid':![],'indexes':[{'name':_0xc674('0xd'),'fields':[_0xc674('0xe'),_0xc674('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe870=['int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FreshdeskField'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xe870,0xc6));var _0x0e87=function(_0x2ea5a4,_0x22f600){_0x2ea5a4=_0x2ea5a4-0x0;var _0x12be13=_0xe870[_0x2ea5a4];return _0x12be13;};'use strict';var _=require(_0x0e87('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0e87('0x1'));var moment=require(_0x0e87('0x2'));var BPromise=require(_0x0e87('0x3'));var rp=require(_0x0e87('0x4'));var fs=require('fs');var path=require(_0x0e87('0x5'));var rimraf=require(_0x0e87('0x6'));var config=require(_0x0e87('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x0e87('0x8')]=function(_0x1f12c0,_0x443246){return _0x1f12c0['define'](_0x0e87('0x9'),attributes,{'tableName':_0x0e87('0xa'),'paranoid':![],'indexes':[{'name':_0x0e87('0xb'),'fields':['idField',_0x0e87('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 a0c2159..c7b6da0 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x2568fd,_0xb9fbd5){_0x2568fd=_0x2568fd-0x0;var _0x22fff7=_0x7a54[_0x2568fd];return _0x22fff7;};'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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x29fd55,_0x5c8cf7){_0x29fd55=_0x29fd55-0x0;var _0xbfa156=_0x7a54[_0x29fd55];return _0xbfa156;};'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 4e3536b..293ec9f 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 _0x6bc1=['post','create','addConfiguration','/:id','update','delete','destroy','multer','path','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','get','show','/:id/fields','getFields'];(function(_0xe93e59,_0x4535d8){var _0x1cc428=function(_0x505a3f){while(--_0x505a3f){_0xe93e59['push'](_0xe93e59['shift']());}};_0x1cc428(++_0x4535d8);}(_0x6bc1,0x115));var _0x16bc=function(_0x261f14,_0x48bca8){_0x261f14=_0x261f14-0x0;var _0x358626=_0x6bc1[_0x261f14];return _0x358626;};'use strict';var multer=require(_0x16bc('0x0'));var util=require('util');var path=require(_0x16bc('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x16bc('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x16bc('0x3'));var config=require(_0x16bc('0x4'));var controller=require(_0x16bc('0x5'));router['get']('/',auth[_0x16bc('0x6')](),controller['index']);router[_0x16bc('0x7')]('/:id',auth[_0x16bc('0x6')](),controller[_0x16bc('0x8')]);router[_0x16bc('0x7')]('/:id/configurations',auth[_0x16bc('0x6')](),controller['getConfigurations']);router[_0x16bc('0x7')](_0x16bc('0x9'),auth['isAuthenticated'](),controller[_0x16bc('0xa')]);router[_0x16bc('0xb')]('/',auth[_0x16bc('0x6')](),controller[_0x16bc('0xc')]);router['post']('/:id/configurations',auth[_0x16bc('0x6')](),controller[_0x16bc('0xd')]);router['put'](_0x16bc('0xe'),auth[_0x16bc('0x6')](),controller[_0x16bc('0xf')]);router[_0x16bc('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x16bc('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5b77=['/:id','getConfigurations','post','create','/:id/configurations','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get'];(function(_0x3d8c36,_0x4cf4e7){var _0x3856f2=function(_0xf0c8c3){while(--_0xf0c8c3){_0x3d8c36['push'](_0x3d8c36['shift']());}};_0x3856f2(++_0x4cf4e7);}(_0x5b77,0xa0));var _0x75b7=function(_0xa59fd9,_0x1dcaf9){_0xa59fd9=_0xa59fd9-0x0;var _0x13bdc7=_0x5b77[_0xa59fd9];return _0x13bdc7;};'use strict';var multer=require('multer');var util=require(_0x75b7('0x0'));var path=require(_0x75b7('0x1'));var timeout=require(_0x75b7('0x2'));var express=require(_0x75b7('0x3'));var router=express[_0x75b7('0x4')]();var auth=require(_0x75b7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x75b7('0x6'));var controller=require(_0x75b7('0x7'));router['get']('/',auth[_0x75b7('0x8')](),controller[_0x75b7('0x9')]);router[_0x75b7('0xa')](_0x75b7('0xb'),auth[_0x75b7('0x8')](),controller['show']);router[_0x75b7('0xa')]('/:id/configurations',auth[_0x75b7('0x8')](),controller[_0x75b7('0xc')]);router['get']('/:id/fields',auth[_0x75b7('0x8')](),controller['getFields']);router[_0x75b7('0xd')]('/',auth[_0x75b7('0x8')](),controller[_0x75b7('0xe')]);router['post'](_0x75b7('0xf'),auth[_0x75b7('0x8')](),controller['addConfiguration']);router['put']('/:id',auth[_0x75b7('0x8')](),controller[_0x75b7('0x10')]);router['delete'](_0x75b7('0xb'),auth[_0x75b7('0x8')](),controller[_0x75b7('0x11')]);module[_0x75b7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index b93d74e..6b36a76 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 _0x9219=['STRING'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0x9219,0x19e));var _0x9921=function(_0x12f6f4,_0x1a84ed){_0x12f6f4=_0x12f6f4-0x0;var _0xed3688=_0x9219[_0x12f6f4];return _0xed3688;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9921('0x0')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9921('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xad3c=['username','sequelize','exports','STRING'];(function(_0x2b9d5a,_0x43c43f){var _0x4f2dfd=function(_0x34ff6d){while(--_0x34ff6d){_0x2b9d5a['push'](_0x2b9d5a['shift']());}};_0x4f2dfd(++_0x43c43f);}(_0xad3c,0x1d9));var _0xcad3=function(_0x1b4bef,_0x5bb6be){_0x1b4bef=_0x1b4bef-0x0;var _0xf377eb=_0xad3c[_0x1b4bef];return _0xf377eb;};'use strict';var Sequelize=require(_0xcad3('0x0'));module[_0xcad3('0x1')]={'name':{'type':Sequelize[_0xcad3('0x2')]},'description':{'type':Sequelize[_0xcad3('0x2')]},'username':{'type':Sequelize[_0xcad3('0x2')],'unique':_0xcad3('0x3')},'apiKey':{'type':Sequelize[_0xcad3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xcad3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 1e48b14..193ba84 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 _0x76dc=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FreshsalesAccount','count','includeAll','include','findAll','rows','params','create','body','find','destroy','findOne','FreshsalesConfiguration','keys','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../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','then','info','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','set','apply','reject','save','update','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes'];(function(_0x16662c,_0x53f319){var _0x541a02=function(_0x196ae9){while(--_0x196ae9){_0x16662c['push'](_0x16662c['shift']());}};_0x541a02(++_0x53f319);}(_0x76dc,0x1f2));var _0xc76d=function(_0x192d41,_0x5133ac){_0x192d41=_0x192d41-0x0;var _0x1232af=_0x76dc[_0x192d41];return _0x1232af;};'use strict';var pdf=require(_0xc76d('0x0'));var emlformat=require(_0xc76d('0x1'));var rimraf=require(_0xc76d('0x2'));var zipdir=require(_0xc76d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc76d('0x4'));var moment=require(_0xc76d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc76d('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc76d('0x7'));var csv=require(_0xc76d('0x8'));var ejs=require(_0xc76d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc76d('0xa'));var jsforce=require(_0xc76d('0xb'));var deskjs=require(_0xc76d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc76d('0xd'));var Redis=require(_0xc76d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc76d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc76d('0x10'));var logger=require(_0xc76d('0x11'))(_0xc76d('0x12'));var utils=require(_0xc76d('0x13'));var config=require(_0xc76d('0x14'));var licenseUtil=require(_0xc76d('0x15'));var db=require(_0xc76d('0x16'))['db'];var integrations=require(_0xc76d('0x17'));var jayson=require(_0xc76d('0x18'));var client=jayson[_0xc76d('0x19')][_0xc76d('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x24e88e,_0x1904ef,_0x3ed1bd,_0x5cda20){return new BPromise(function(_0x8696db,_0x2e9ec7){var _0x5bbed9=_0x5cda20||client;return _0x5bbed9[_0xc76d('0x1b')](_0x24e88e,_0x3ed1bd)[_0xc76d('0x1c')](function(_0x47a4ee){logger[_0xc76d('0x1d')]('FreshsalesAccount,\x20%s,\x20%s',_0x1904ef,_0xc76d('0x1e'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x1904ef,_0xc76d('0x1e'),JSON[_0xc76d('0x1f')](_0x47a4ee));if(_0x47a4ee[_0xc76d('0x20')]){if(_0x47a4ee[_0xc76d('0x20')][_0xc76d('0x21')]===0x1f4){logger['error'](_0xc76d('0x22'),_0x1904ef,_0x47a4ee[_0xc76d('0x20')][_0xc76d('0x23')]);return _0x2e9ec7(_0x47a4ee[_0xc76d('0x20')][_0xc76d('0x23')]);}logger['error'](_0xc76d('0x22'),_0x1904ef,_0x47a4ee[_0xc76d('0x20')]['message']);return _0x8696db(_0x47a4ee[_0xc76d('0x20')][_0xc76d('0x23')]);}else{logger[_0xc76d('0x1d')](_0xc76d('0x22'),_0x1904ef,_0xc76d('0x1e'));_0x8696db(_0x47a4ee[_0xc76d('0x24')][_0xc76d('0x23')]);}})[_0xc76d('0x25')](function(_0xbebde6){logger[_0xc76d('0x20')](_0xc76d('0x22'),_0x1904ef,_0xbebde6);_0x2e9ec7(_0xbebde6);});});}function respondWithStatusCode(_0x5de11f,_0x11b42f){_0x11b42f=_0x11b42f||0xcc;return function(_0x17b46f){if(_0x17b46f){return _0x5de11f['sendStatus'](_0x11b42f);}return _0x5de11f[_0xc76d('0x26')](_0x11b42f)[_0xc76d('0x27')]();};}function respondWithResult(_0x55ca79,_0x374b9e){_0x374b9e=_0x374b9e||0xc8;return function(_0x476aee){if(_0x476aee){return _0x55ca79[_0xc76d('0x26')](_0x374b9e)[_0xc76d('0x28')](_0x476aee);}};}function respondWithFilteredResult(_0xfc4aea,_0x1949c4){return function(_0x89ee5){if(_0x89ee5){var _0x59ebd1=_0x89ee5['count'],_0x59dabf=_0x1949c4[_0xc76d('0x29')],_0x285430=_0x1949c4[_0xc76d('0x29')]+_0x1949c4[_0xc76d('0x2a')],_0x287ae4;if(_0x285430>=_0x59ebd1){_0x285430=_0x59ebd1;_0x287ae4=0xc8;}else{_0x287ae4=0xce;}_0xfc4aea['status'](_0x287ae4);return _0xfc4aea[_0xc76d('0x2b')]('Content-Range',_0x59dabf+'-'+_0x285430+'/'+_0x59ebd1)[_0xc76d('0x28')](_0x89ee5);}return null;};}function patchUpdates(_0x18a7fa){return function(_0x4d896c){try{jsonpatch[_0xc76d('0x2c')](_0x4d896c,_0x18a7fa,!![]);}catch(_0x1c68f3){return BPromise[_0xc76d('0x2d')](_0x1c68f3);}return _0x4d896c[_0xc76d('0x2e')]();};}function saveUpdates(_0x4feeda,_0x283e16){return function(_0x4a7e4c){if(_0x4a7e4c){return _0x4a7e4c[_0xc76d('0x2f')](_0x4feeda)['then'](function(_0x30769f){return _0x30769f;});}return null;};}function removeEntity(_0x39127c,_0x5dc369){return function(_0x4b4dfc){if(_0x4b4dfc){return _0x4b4dfc['destroy']()['then'](function(){_0x39127c[_0xc76d('0x26')](0xcc)[_0xc76d('0x27')]();});}};}function handleEntityNotFound(_0x5c13f2,_0x28236c){return function(_0x1b2ed1){if(!_0x1b2ed1){_0x5c13f2['sendStatus'](0x194);}return _0x1b2ed1;};}function handleError(_0x18523e,_0x55e825){_0x55e825=_0x55e825||0x1f4;return function(_0x854920){logger['error'](_0x854920[_0xc76d('0x30')]);if(_0x854920[_0xc76d('0x31')]){delete _0x854920[_0xc76d('0x31')];}_0x18523e[_0xc76d('0x26')](_0x55e825)[_0xc76d('0x32')](_0x854920);};}exports['index']=function(_0xc2765c,_0x371306){var _0x32d04c={},_0x4ed918={},_0x2f69c1={'count':0x0,'rows':[]};var _0x10a6b1=_[_0xc76d('0x33')](db['FreshsalesAccount'][_0xc76d('0x34')],function(_0x567a2c){return{'name':_0x567a2c[_0xc76d('0x35')],'type':_0x567a2c[_0xc76d('0x36')][_0xc76d('0x37')]};});_0x4ed918[_0xc76d('0x38')]=_['map'](_0x10a6b1,'name');_0x4ed918[_0xc76d('0x39')]=_['keys'](_0xc2765c[_0xc76d('0x39')]);_0x4ed918[_0xc76d('0x3a')]=_[_0xc76d('0x3b')](_0x4ed918[_0xc76d('0x38')],_0x4ed918['query']);_0x32d04c['attributes']=_[_0xc76d('0x3b')](_0x4ed918[_0xc76d('0x38')],qs[_0xc76d('0x3c')](_0xc2765c[_0xc76d('0x39')][_0xc76d('0x3c')]));_0x32d04c['attributes']=_0x32d04c[_0xc76d('0x3d')][_0xc76d('0x3e')]?_0x32d04c[_0xc76d('0x3d')]:_0x4ed918[_0xc76d('0x38')];if(!_0xc2765c[_0xc76d('0x39')][_0xc76d('0x3f')](_0xc76d('0x40'))){_0x32d04c[_0xc76d('0x2a')]=qs[_0xc76d('0x2a')](_0xc2765c[_0xc76d('0x39')]['limit']);_0x32d04c['offset']=qs[_0xc76d('0x29')](_0xc2765c[_0xc76d('0x39')][_0xc76d('0x29')]);}_0x32d04c[_0xc76d('0x41')]=qs['sort'](_0xc2765c['query'][_0xc76d('0x42')]);_0x32d04c[_0xc76d('0x43')]=qs[_0xc76d('0x3a')](_[_0xc76d('0x44')](_0xc2765c[_0xc76d('0x39')],_0x4ed918[_0xc76d('0x3a')]),_0x10a6b1);if(_0xc2765c[_0xc76d('0x39')][_0xc76d('0x45')]){_0x32d04c['where']=_[_0xc76d('0x46')](_0x32d04c[_0xc76d('0x43')],{'$or':_[_0xc76d('0x33')](_0x10a6b1,function(_0x243af5){if(_0x243af5['type']!=='VIRTUAL'){var _0x4bf591={};_0x4bf591[_0x243af5['name']]={'$like':'%'+_0xc2765c['query']['filter']+'%'};return _0x4bf591;}})});}_0x32d04c=_['merge']({},_0x32d04c,_0xc2765c[_0xc76d('0x47')]);var _0x122a52={'where':_0x32d04c[_0xc76d('0x43')]};return db[_0xc76d('0x48')][_0xc76d('0x49')](_0x122a52)[_0xc76d('0x1c')](function(_0x7ba760){_0x2f69c1[_0xc76d('0x49')]=_0x7ba760;if(_0xc2765c['query'][_0xc76d('0x4a')]){_0x32d04c[_0xc76d('0x4b')]=[{'all':!![]}];}return db[_0xc76d('0x48')][_0xc76d('0x4c')](_0x32d04c);})[_0xc76d('0x1c')](function(_0x166be4){_0x2f69c1[_0xc76d('0x4d')]=_0x166be4;return _0x2f69c1;})[_0xc76d('0x1c')](respondWithFilteredResult(_0x371306,_0x32d04c))[_0xc76d('0x25')](handleError(_0x371306,null));};exports['show']=function(_0x5b41d3,_0x144d09){var _0x170f47={'raw':![],'where':{'id':_0x5b41d3[_0xc76d('0x4e')]['id']}},_0x2fa905={};_0x2fa905[_0xc76d('0x38')]=_['keys'](db[_0xc76d('0x48')][_0xc76d('0x34')]);_0x2fa905['query']=_['keys'](_0x5b41d3[_0xc76d('0x39')]);_0x2fa905[_0xc76d('0x3a')]=_['intersection'](_0x2fa905[_0xc76d('0x38')],_0x2fa905[_0xc76d('0x39')]);_0x170f47[_0xc76d('0x3d')]=_[_0xc76d('0x3b')](_0x2fa905[_0xc76d('0x38')],qs[_0xc76d('0x3c')](_0x5b41d3[_0xc76d('0x39')][_0xc76d('0x3c')]));_0x170f47[_0xc76d('0x3d')]=_0x170f47[_0xc76d('0x3d')]['length']?_0x170f47[_0xc76d('0x3d')]:_0x2fa905[_0xc76d('0x38')];if(_0x5b41d3[_0xc76d('0x39')]['includeAll']){_0x170f47[_0xc76d('0x4b')]=[{'all':!![]}];}_0x170f47=_[_0xc76d('0x46')]({},_0x170f47,_0x5b41d3['options']);return db[_0xc76d('0x48')]['find'](_0x170f47)[_0xc76d('0x1c')](handleEntityNotFound(_0x144d09,null))[_0xc76d('0x1c')](respondWithResult(_0x144d09,null))[_0xc76d('0x25')](handleError(_0x144d09,null));};exports[_0xc76d('0x4f')]=function(_0x14ef42,_0x4a1e17){return db['FreshsalesAccount']['create'](_0x14ef42[_0xc76d('0x50')],{})[_0xc76d('0x1c')](respondWithResult(_0x4a1e17,0xc9))[_0xc76d('0x25')](handleError(_0x4a1e17,null));};exports[_0xc76d('0x2f')]=function(_0x3465c4,_0x38bf54){if(_0x3465c4['body']['id']){delete _0x3465c4[_0xc76d('0x50')]['id'];}return db[_0xc76d('0x48')][_0xc76d('0x51')]({'where':{'id':_0x3465c4[_0xc76d('0x4e')]['id']}})[_0xc76d('0x1c')](handleEntityNotFound(_0x38bf54,null))['then'](saveUpdates(_0x3465c4[_0xc76d('0x50')],null))[_0xc76d('0x1c')](respondWithResult(_0x38bf54,null))[_0xc76d('0x25')](handleError(_0x38bf54,null));};exports[_0xc76d('0x52')]=function(_0x36b002,_0x2b289d){return db['FreshsalesAccount'][_0xc76d('0x51')]({'where':{'id':_0x36b002[_0xc76d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2b289d,null))['then'](removeEntity(_0x2b289d,null))[_0xc76d('0x25')](handleError(_0x2b289d,null));};exports['getConfigurations']=function(_0xcd5f35,_0x41e514,_0x12b287){var _0xfe2be1={};var _0x254128={};var _0x4746a5;var _0x106c85;return db[_0xc76d('0x48')][_0xc76d('0x53')]({'where':{'id':_0xcd5f35[_0xc76d('0x4e')]['id']}})[_0xc76d('0x1c')](handleEntityNotFound(_0x41e514,null))[_0xc76d('0x1c')](function(_0x2a9247){if(_0x2a9247){_0x4746a5=_0x2a9247;_0x254128[_0xc76d('0x38')]=_['keys'](db[_0xc76d('0x54')][_0xc76d('0x34')]);_0x254128[_0xc76d('0x39')]=_[_0xc76d('0x55')](_0xcd5f35[_0xc76d('0x39')]);_0x254128['filters']=_[_0xc76d('0x3b')](_0x254128[_0xc76d('0x38')],_0x254128['query']);_0xfe2be1['attributes']=_['intersection'](_0x254128[_0xc76d('0x38')],qs[_0xc76d('0x3c')](_0xcd5f35[_0xc76d('0x39')][_0xc76d('0x3c')]));_0xfe2be1[_0xc76d('0x3d')]=_0xfe2be1[_0xc76d('0x3d')][_0xc76d('0x3e')]?_0xfe2be1[_0xc76d('0x3d')]:_0x254128['model'];_0xfe2be1[_0xc76d('0x41')]=qs['sort'](_0xcd5f35['query'][_0xc76d('0x42')]);_0xfe2be1[_0xc76d('0x43')]=qs[_0xc76d('0x3a')](_['pick'](_0xcd5f35[_0xc76d('0x39')],_0x254128['filters']));if(_0xcd5f35['query']['filter']){_0xfe2be1[_0xc76d('0x43')]=_[_0xc76d('0x46')](_0xfe2be1['where'],{'$or':_[_0xc76d('0x33')](_0xfe2be1[_0xc76d('0x3d')],function(_0x20d7cf){var _0x3f07f9={};_0x3f07f9[_0x20d7cf]={'$like':'%'+_0xcd5f35[_0xc76d('0x39')][_0xc76d('0x45')]+'%'};return _0x3f07f9;})});}_0xfe2be1=_[_0xc76d('0x46')]({},_0xfe2be1,_0xcd5f35['options']);return _0x4746a5['getConfigurations'](_0xfe2be1);}})['then'](function(_0x2474a7){if(_0x2474a7){_0x106c85=_0x2474a7[_0xc76d('0x3e')];if(!_0xcd5f35[_0xc76d('0x39')][_0xc76d('0x3f')](_0xc76d('0x40'))){_0xfe2be1['limit']=qs[_0xc76d('0x2a')](_0xcd5f35[_0xc76d('0x39')][_0xc76d('0x2a')]);_0xfe2be1[_0xc76d('0x29')]=qs[_0xc76d('0x29')](_0xcd5f35[_0xc76d('0x39')][_0xc76d('0x29')]);}return _0x4746a5[_0xc76d('0x56')](_0xfe2be1);}})['then'](function(_0x4240cb){if(_0x4240cb){return _0x4240cb?{'count':_0x106c85,'rows':_0x4240cb}:null;}})['then'](respondWithResult(_0x41e514,null))[_0xc76d('0x25')](handleError(_0x41e514,null));};exports[_0xc76d('0x57')]=function(_0x35c60f,_0x55dd93,_0x58c3ce){if(_0x35c60f[_0xc76d('0x50')]['id']){delete _0x35c60f['body']['id'];}return db['FreshsalesAccount'][_0xc76d('0x53')]({'where':{'id':_0x35c60f[_0xc76d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x55dd93,null))[_0xc76d('0x1c')](function(_0x1062ea){if(_0x1062ea){_0x35c60f['body'][_0xc76d('0x58')]=_0x1062ea['id'];_0x35c60f[_0xc76d('0x50')]['Subjects']=integrations[_0xc76d('0x59')](_0x35c60f['body'][_0xc76d('0x5a')],_0x35c60f[_0xc76d('0x50')]['type']);_0x35c60f[_0xc76d('0x50')][_0xc76d('0x5b')]=integrations['getDescriptions'](_0x35c60f[_0xc76d('0x50')][_0xc76d('0x5a')],_0x35c60f[_0xc76d('0x50')]['type']);return db[_0xc76d('0x54')]['create'](_0x35c60f['body'],{'include':[{'model':db[_0xc76d('0x5c')],'as':_0xc76d('0x5d')},{'model':db['FreshsalesField'],'as':_0xc76d('0x5b')}]});}return null;})[_0xc76d('0x1c')](respondWithResult(_0x55dd93,null))[_0xc76d('0x25')](handleError(_0x55dd93,null));};exports[_0xc76d('0x5e')]=function(_0x1bcd83,_0x1d3582,_0x210617){var _0x263570='';var _0x26855a='';return db[_0xc76d('0x48')][_0xc76d('0x53')]({'where':{'id':_0x1bcd83[_0xc76d('0x4e')]['id']},'attributes':['id',_0xc76d('0x5f'),_0xc76d('0x60'),_0xc76d('0x61')]})[_0xc76d('0x1c')](handleEntityNotFound(_0x1d3582,null))[_0xc76d('0x1c')](function(_0xd16232){if(_0xd16232){_0x26855a=_0xd16232[_0xc76d('0x5f')];_0x263570=_0xd16232[_0xc76d('0x60')];var _0x5b9e24=_0xd16232[_0xc76d('0x60')][_0xc76d('0x62')](-0x1);if(_0x5b9e24==='/'){_0x263570=_0x263570[_0xc76d('0x63')](0x0,_0x263570[_0xc76d('0x64')](_0x5b9e24));}return rp({'method':_0xc76d('0x65'),'uri':util[_0xc76d('0x66')](_0xc76d('0x67'),_0x263570,_0xc76d('0x68')),'headers':{'Authorization':_0xc76d('0x69')+_0xd16232[_0xc76d('0x61')]},'json':!![]});}})[_0xc76d('0x1c')](function(_0x1b8550){if(_0x1b8550){var _0x290db1=_0x1b8550[_0xc76d('0x6a')];var _0x11e6fd=![];var _0x464a02=null;for(_0x464a02=0x0;_0x464a02<_0x290db1[_0xc76d('0x3e')];_0x464a02++){if(_0x290db1[_0x464a02][_0xc76d('0x6b')]===_0x26855a){_0x11e6fd=!![];}}if(_0x11e6fd){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xc76d('0x6c')});}}})[_0xc76d('0x1c')](respondWithResult(_0x1d3582,null))[_0xc76d('0x25')](function(_0x260874){var _0x508348=_0x1bcd83[_0xc76d('0x39')]['test']?0x1f4:_0x260874[_0xc76d('0x6d')]||0x1f4;logger[_0xc76d('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0xc76d('0x5e'),_0x508348,JSON[_0xc76d('0x1f')](_0x260874));delete _0x260874['name'];if(_0x508348===0x191){_0x508348=0x190;}_0x1d3582[_0xc76d('0x26')](_0x508348)[_0xc76d('0x32')](_0x1bcd83[_0xc76d('0x39')][_0xc76d('0x6e')]?{'message':_0xc76d('0x6f'),'statusCode':_0x260874[_0xc76d('0x6d')]}:_0x260874);});}; \ No newline at end of file +var _0xbee3=['bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','end','json','count','offset','limit','Content-Range','apply','save','destroy','then','sendStatus','stack','send','index','map','FreshsalesAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','name','options','includeAll','findAll','show','rawAttributes','merge','create','body','update','find','getConfigurations','findOne','params','FreshsalesConfiguration','pick','filter','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','format','%s%s','/api/selector/owners','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','fast-json-patch','request-promise'];(function(_0x9b52a5,_0x3f2ec2){var _0x3717f4=function(_0x42ec5e){while(--_0x42ec5e){_0x9b52a5['push'](_0x9b52a5['shift']());}};_0x3717f4(++_0x3f2ec2);}(_0xbee3,0xd5));var _0x3bee=function(_0x13b536,_0x3dad8f){_0x13b536=_0x13b536-0x0;var _0x3d37d5=_0xbee3[_0x13b536];return _0x3d37d5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3bee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3bee('0x1'));var rp=require(_0x3bee('0x2'));var moment=require('moment');var BPromise=require(_0x3bee('0x3'));var Mustache=require(_0x3bee('0x4'));var util=require(_0x3bee('0x5'));var path=require('path');var sox=require(_0x3bee('0x6'));var csv=require(_0x3bee('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x7'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];var integrations=require(_0x3bee('0x17'));var jayson=require(_0x3bee('0x18'));var client=jayson[_0x3bee('0x19')][_0x3bee('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xc8c1f0,_0x49b721,_0xad01f9,_0x33504d){return new BPromise(function(_0x31ac52,_0x237110){var _0x3a0396=_0x33504d||client;return _0x3a0396['request'](_0xc8c1f0,_0xad01f9)['then'](function(_0x346767){logger['info'](_0x3bee('0x1b'),_0x49b721,_0x3bee('0x1c'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x49b721,_0x3bee('0x1c'),JSON[_0x3bee('0x1d')](_0x346767));if(_0x346767[_0x3bee('0x1e')]){if(_0x346767[_0x3bee('0x1e')]['code']===0x1f4){logger[_0x3bee('0x1e')](_0x3bee('0x1b'),_0x49b721,_0x346767[_0x3bee('0x1e')][_0x3bee('0x1f')]);return _0x237110(_0x346767[_0x3bee('0x1e')][_0x3bee('0x1f')]);}logger[_0x3bee('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x49b721,_0x346767['error'][_0x3bee('0x1f')]);return _0x31ac52(_0x346767[_0x3bee('0x1e')]['message']);}else{logger[_0x3bee('0x20')](_0x3bee('0x1b'),_0x49b721,_0x3bee('0x1c'));_0x31ac52(_0x346767[_0x3bee('0x21')][_0x3bee('0x1f')]);}})[_0x3bee('0x22')](function(_0x473d61){logger['error'](_0x3bee('0x1b'),_0x49b721,_0x473d61);_0x237110(_0x473d61);});});}function respondWithStatusCode(_0x1ed0c1,_0x1fed5a){_0x1fed5a=_0x1fed5a||0xcc;return function(_0x3bb884){if(_0x3bb884){return _0x1ed0c1['sendStatus'](_0x1fed5a);}return _0x1ed0c1[_0x3bee('0x23')](_0x1fed5a)[_0x3bee('0x24')]();};}function respondWithResult(_0x1e0111,_0x4b4cd4){_0x4b4cd4=_0x4b4cd4||0xc8;return function(_0x5ed022){if(_0x5ed022){return _0x1e0111[_0x3bee('0x23')](_0x4b4cd4)[_0x3bee('0x25')](_0x5ed022);}};}function respondWithFilteredResult(_0x5341e2,_0x2c0e50){return function(_0x1b4ce0){if(_0x1b4ce0){var _0x2e666a=_0x1b4ce0[_0x3bee('0x26')],_0x5b1eec=_0x2c0e50['offset'],_0x1984c4=_0x2c0e50[_0x3bee('0x27')]+_0x2c0e50[_0x3bee('0x28')],_0x355b64;if(_0x1984c4>=_0x2e666a){_0x1984c4=_0x2e666a;_0x355b64=0xc8;}else{_0x355b64=0xce;}_0x5341e2[_0x3bee('0x23')](_0x355b64);return _0x5341e2['set'](_0x3bee('0x29'),_0x5b1eec+'-'+_0x1984c4+'/'+_0x2e666a)[_0x3bee('0x25')](_0x1b4ce0);}return null;};}function patchUpdates(_0x27ed99){return function(_0xda5745){try{jsonpatch[_0x3bee('0x2a')](_0xda5745,_0x27ed99,!![]);}catch(_0x559c2b){return BPromise['reject'](_0x559c2b);}return _0xda5745[_0x3bee('0x2b')]();};}function saveUpdates(_0x1e1529,_0x10bae0){return function(_0x11e07d){if(_0x11e07d){return _0x11e07d['update'](_0x1e1529)['then'](function(_0x38f93c){return _0x38f93c;});}return null;};}function removeEntity(_0x42cb58,_0x4f5b58){return function(_0x51be99){if(_0x51be99){return _0x51be99[_0x3bee('0x2c')]()[_0x3bee('0x2d')](function(){_0x42cb58[_0x3bee('0x23')](0xcc)[_0x3bee('0x24')]();});}};}function handleEntityNotFound(_0x845f21,_0x2cfb4b){return function(_0x2790ce){if(!_0x2790ce){_0x845f21[_0x3bee('0x2e')](0x194);}return _0x2790ce;};}function handleError(_0xd6fd53,_0x42291d){_0x42291d=_0x42291d||0x1f4;return function(_0x569675){logger['error'](_0x569675[_0x3bee('0x2f')]);if(_0x569675['name']){delete _0x569675['name'];}_0xd6fd53[_0x3bee('0x23')](_0x42291d)[_0x3bee('0x30')](_0x569675);};}exports[_0x3bee('0x31')]=function(_0x474cf5,_0xd926f8){var _0x232fac={},_0x2a50a6={},_0x10ace5={'count':0x0,'rows':[]};var _0x56917a=_[_0x3bee('0x32')](db[_0x3bee('0x33')]['rawAttributes'],function(_0x3711e4){return{'name':_0x3711e4[_0x3bee('0x34')],'type':_0x3711e4[_0x3bee('0x35')][_0x3bee('0x36')]};});_0x2a50a6[_0x3bee('0x37')]=_['map'](_0x56917a,'name');_0x2a50a6[_0x3bee('0x38')]=_[_0x3bee('0x39')](_0x474cf5[_0x3bee('0x38')]);_0x2a50a6[_0x3bee('0x3a')]=_[_0x3bee('0x3b')](_0x2a50a6[_0x3bee('0x37')],_0x2a50a6[_0x3bee('0x38')]);_0x232fac[_0x3bee('0x3c')]=_[_0x3bee('0x3b')](_0x2a50a6[_0x3bee('0x37')],qs[_0x3bee('0x3d')](_0x474cf5[_0x3bee('0x38')]['fields']));_0x232fac[_0x3bee('0x3c')]=_0x232fac[_0x3bee('0x3c')][_0x3bee('0x3e')]?_0x232fac[_0x3bee('0x3c')]:_0x2a50a6[_0x3bee('0x37')];if(!_0x474cf5[_0x3bee('0x38')][_0x3bee('0x3f')](_0x3bee('0x40'))){_0x232fac[_0x3bee('0x28')]=qs[_0x3bee('0x28')](_0x474cf5[_0x3bee('0x38')][_0x3bee('0x28')]);_0x232fac[_0x3bee('0x27')]=qs['offset'](_0x474cf5[_0x3bee('0x38')][_0x3bee('0x27')]);}_0x232fac[_0x3bee('0x41')]=qs[_0x3bee('0x42')](_0x474cf5[_0x3bee('0x38')][_0x3bee('0x42')]);_0x232fac[_0x3bee('0x43')]=qs[_0x3bee('0x3a')](_['pick'](_0x474cf5[_0x3bee('0x38')],_0x2a50a6[_0x3bee('0x3a')]),_0x56917a);if(_0x474cf5[_0x3bee('0x38')]['filter']){_0x232fac[_0x3bee('0x43')]=_['merge'](_0x232fac[_0x3bee('0x43')],{'$or':_['map'](_0x56917a,function(_0x5717d3){if(_0x5717d3[_0x3bee('0x35')]!==_0x3bee('0x44')){var _0x2b5c93={};_0x2b5c93[_0x5717d3[_0x3bee('0x45')]]={'$like':'%'+_0x474cf5[_0x3bee('0x38')]['filter']+'%'};return _0x2b5c93;}})});}_0x232fac=_['merge']({},_0x232fac,_0x474cf5[_0x3bee('0x46')]);var _0x5a9db2={'where':_0x232fac[_0x3bee('0x43')]};return db['FreshsalesAccount'][_0x3bee('0x26')](_0x5a9db2)['then'](function(_0x1b8218){_0x10ace5[_0x3bee('0x26')]=_0x1b8218;if(_0x474cf5[_0x3bee('0x38')][_0x3bee('0x47')]){_0x232fac['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x3bee('0x48')](_0x232fac);})['then'](function(_0x51c0bf){_0x10ace5['rows']=_0x51c0bf;return _0x10ace5;})[_0x3bee('0x2d')](respondWithFilteredResult(_0xd926f8,_0x232fac))['catch'](handleError(_0xd926f8,null));};exports[_0x3bee('0x49')]=function(_0x33d615,_0xd87fd2){var _0x593427={'raw':![],'where':{'id':_0x33d615['params']['id']}},_0x449f0a={};_0x449f0a[_0x3bee('0x37')]=_['keys'](db[_0x3bee('0x33')][_0x3bee('0x4a')]);_0x449f0a[_0x3bee('0x38')]=_['keys'](_0x33d615[_0x3bee('0x38')]);_0x449f0a[_0x3bee('0x3a')]=_[_0x3bee('0x3b')](_0x449f0a['model'],_0x449f0a['query']);_0x593427[_0x3bee('0x3c')]=_[_0x3bee('0x3b')](_0x449f0a[_0x3bee('0x37')],qs[_0x3bee('0x3d')](_0x33d615[_0x3bee('0x38')][_0x3bee('0x3d')]));_0x593427[_0x3bee('0x3c')]=_0x593427['attributes'][_0x3bee('0x3e')]?_0x593427[_0x3bee('0x3c')]:_0x449f0a['model'];if(_0x33d615['query'][_0x3bee('0x47')]){_0x593427['include']=[{'all':!![]}];}_0x593427=_[_0x3bee('0x4b')]({},_0x593427,_0x33d615[_0x3bee('0x46')]);return db[_0x3bee('0x33')]['find'](_0x593427)[_0x3bee('0x2d')](handleEntityNotFound(_0xd87fd2,null))[_0x3bee('0x2d')](respondWithResult(_0xd87fd2,null))[_0x3bee('0x22')](handleError(_0xd87fd2,null));};exports['create']=function(_0x1ee4f0,_0x33850e){return db['FreshsalesAccount'][_0x3bee('0x4c')](_0x1ee4f0[_0x3bee('0x4d')],{})['then'](respondWithResult(_0x33850e,0xc9))[_0x3bee('0x22')](handleError(_0x33850e,null));};exports[_0x3bee('0x4e')]=function(_0x15fc34,_0x25cb9d){if(_0x15fc34[_0x3bee('0x4d')]['id']){delete _0x15fc34[_0x3bee('0x4d')]['id'];}return db[_0x3bee('0x33')][_0x3bee('0x4f')]({'where':{'id':_0x15fc34['params']['id']}})['then'](handleEntityNotFound(_0x25cb9d,null))[_0x3bee('0x2d')](saveUpdates(_0x15fc34['body'],null))[_0x3bee('0x2d')](respondWithResult(_0x25cb9d,null))[_0x3bee('0x22')](handleError(_0x25cb9d,null));};exports[_0x3bee('0x2c')]=function(_0x488cf8,_0x23fce3){return db[_0x3bee('0x33')][_0x3bee('0x4f')]({'where':{'id':_0x488cf8['params']['id']}})[_0x3bee('0x2d')](handleEntityNotFound(_0x23fce3,null))['then'](removeEntity(_0x23fce3,null))[_0x3bee('0x22')](handleError(_0x23fce3,null));};exports[_0x3bee('0x50')]=function(_0x404730,_0x4facff,_0x2cb9cd){var _0x19123e={};var _0x282300={};var _0x526551;var _0x5d95a7;return db[_0x3bee('0x33')][_0x3bee('0x51')]({'where':{'id':_0x404730[_0x3bee('0x52')]['id']}})['then'](handleEntityNotFound(_0x4facff,null))['then'](function(_0x2799e3){if(_0x2799e3){_0x526551=_0x2799e3;_0x282300['model']=_['keys'](db[_0x3bee('0x53')][_0x3bee('0x4a')]);_0x282300[_0x3bee('0x38')]=_['keys'](_0x404730['query']);_0x282300[_0x3bee('0x3a')]=_[_0x3bee('0x3b')](_0x282300['model'],_0x282300[_0x3bee('0x38')]);_0x19123e['attributes']=_[_0x3bee('0x3b')](_0x282300[_0x3bee('0x37')],qs[_0x3bee('0x3d')](_0x404730[_0x3bee('0x38')][_0x3bee('0x3d')]));_0x19123e[_0x3bee('0x3c')]=_0x19123e[_0x3bee('0x3c')][_0x3bee('0x3e')]?_0x19123e[_0x3bee('0x3c')]:_0x282300[_0x3bee('0x37')];_0x19123e[_0x3bee('0x41')]=qs['sort'](_0x404730['query']['sort']);_0x19123e[_0x3bee('0x43')]=qs[_0x3bee('0x3a')](_[_0x3bee('0x54')](_0x404730[_0x3bee('0x38')],_0x282300['filters']));if(_0x404730[_0x3bee('0x38')][_0x3bee('0x55')]){_0x19123e['where']=_['merge'](_0x19123e[_0x3bee('0x43')],{'$or':_[_0x3bee('0x32')](_0x19123e[_0x3bee('0x3c')],function(_0x5c3b2c){var _0x44212e={};_0x44212e[_0x5c3b2c]={'$like':'%'+_0x404730[_0x3bee('0x38')][_0x3bee('0x55')]+'%'};return _0x44212e;})});}_0x19123e=_['merge']({},_0x19123e,_0x404730[_0x3bee('0x46')]);return _0x526551[_0x3bee('0x50')](_0x19123e);}})[_0x3bee('0x2d')](function(_0x2d6715){if(_0x2d6715){_0x5d95a7=_0x2d6715['length'];if(!_0x404730['query'][_0x3bee('0x3f')](_0x3bee('0x40'))){_0x19123e[_0x3bee('0x28')]=qs[_0x3bee('0x28')](_0x404730[_0x3bee('0x38')]['limit']);_0x19123e[_0x3bee('0x27')]=qs['offset'](_0x404730[_0x3bee('0x38')][_0x3bee('0x27')]);}return _0x526551[_0x3bee('0x50')](_0x19123e);}})[_0x3bee('0x2d')](function(_0x15ec8d){if(_0x15ec8d){return _0x15ec8d?{'count':_0x5d95a7,'rows':_0x15ec8d}:null;}})[_0x3bee('0x2d')](respondWithResult(_0x4facff,null))[_0x3bee('0x22')](handleError(_0x4facff,null));};exports['addConfiguration']=function(_0x25f936,_0x28c16e,_0x42045d){if(_0x25f936[_0x3bee('0x4d')]['id']){delete _0x25f936['body']['id'];}return db[_0x3bee('0x33')][_0x3bee('0x51')]({'where':{'id':_0x25f936[_0x3bee('0x52')]['id']}})[_0x3bee('0x2d')](handleEntityNotFound(_0x28c16e,null))[_0x3bee('0x2d')](function(_0x2d71fa){if(_0x2d71fa){_0x25f936[_0x3bee('0x4d')][_0x3bee('0x56')]=_0x2d71fa['id'];_0x25f936['body'][_0x3bee('0x57')]=integrations[_0x3bee('0x58')](_0x25f936[_0x3bee('0x4d')]['channel'],_0x25f936[_0x3bee('0x4d')][_0x3bee('0x35')]);_0x25f936[_0x3bee('0x4d')][_0x3bee('0x59')]=integrations[_0x3bee('0x5a')](_0x25f936[_0x3bee('0x4d')][_0x3bee('0x5b')],_0x25f936[_0x3bee('0x4d')][_0x3bee('0x35')]);return db[_0x3bee('0x53')][_0x3bee('0x4c')](_0x25f936[_0x3bee('0x4d')],{'include':[{'model':db[_0x3bee('0x5c')],'as':_0x3bee('0x57')},{'model':db[_0x3bee('0x5c')],'as':_0x3bee('0x59')}]});}return null;})[_0x3bee('0x2d')](respondWithResult(_0x28c16e,null))[_0x3bee('0x22')](handleError(_0x28c16e,null));};exports[_0x3bee('0x5d')]=function(_0x30e979,_0x3c5600,_0x464355){var _0x316a5a='';var _0x44c0c3='';return db[_0x3bee('0x33')]['findOne']({'where':{'id':_0x30e979[_0x3bee('0x52')]['id']},'attributes':['id',_0x3bee('0x5e'),_0x3bee('0x5f'),_0x3bee('0x60')]})[_0x3bee('0x2d')](handleEntityNotFound(_0x3c5600,null))[_0x3bee('0x2d')](function(_0x2d6a3d){if(_0x2d6a3d){_0x44c0c3=_0x2d6a3d[_0x3bee('0x5e')];_0x316a5a=_0x2d6a3d[_0x3bee('0x5f')];var _0x4e5bf6=_0x2d6a3d[_0x3bee('0x5f')][_0x3bee('0x61')](-0x1);if(_0x4e5bf6==='/'){_0x316a5a=_0x316a5a['substring'](0x0,_0x316a5a[_0x3bee('0x62')](_0x4e5bf6));}return rp({'method':'GET','uri':util[_0x3bee('0x63')](_0x3bee('0x64'),_0x316a5a,_0x3bee('0x65')),'headers':{'Authorization':'Token\x20token='+_0x2d6a3d['apiKey']},'json':!![]});}})[_0x3bee('0x2d')](function(_0x2220a6){if(_0x2220a6){var _0x3c055b=_0x2220a6[_0x3bee('0x66')];var _0x29950f=![];var _0x337d75=null;for(_0x337d75=0x0;_0x337d75<_0x3c055b[_0x3bee('0x3e')];_0x337d75++){if(_0x3c055b[_0x337d75][_0x3bee('0x67')]===_0x44c0c3){_0x29950f=!![];}}if(_0x29950f){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x3bee('0x2d')](respondWithResult(_0x3c5600,null))[_0x3bee('0x22')](function(_0x22d336){var _0x470ea8=_0x30e979[_0x3bee('0x38')][_0x3bee('0x68')]?0x1f4:_0x22d336[_0x3bee('0x69')]||0x1f4;logger['error'](_0x3bee('0x6a'),_0x3bee('0x5d'),_0x470ea8,JSON['stringify'](_0x22d336));delete _0x22d336[_0x3bee('0x45')];if(_0x470ea8===0x191){_0x470ea8=0x190;}_0x3c5600[_0x3bee('0x23')](_0x470ea8)['send'](_0x30e979[_0x3bee('0x38')]['test']?{'message':_0x3bee('0x6b'),'statusCode':_0x22d336[_0x3bee('0x69')]}:_0x22d336);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 594975a..8f4bef9 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 _0x1a08=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger'];(function(_0xda742b,_0x5d9462){var _0x198b88=function(_0x7eb56){while(--_0x7eb56){_0xda742b['push'](_0xda742b['shift']());}};_0x198b88(++_0x5d9462);}(_0x1a08,0x15d));var _0x81a0=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x1a08[_0x19ac6e];return _0x1cdcf3;};'use strict';var _=require(_0x81a0('0x0'));var util=require(_0x81a0('0x1'));var logger=require(_0x81a0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x81a0('0x3'));var fs=require('fs');var path=require(_0x81a0('0x4'));var rimraf=require(_0x81a0('0x5'));var config=require(_0x81a0('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x81a0('0x7'));module[_0x81a0('0x8')]=function(_0x59a62c,_0x1412d3){return _0x59a62c[_0x81a0('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x81a0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc19f=['../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0xc19f,0x164));var _0xfc19=function(_0x483a7b,_0x240795){_0x483a7b=_0x483a7b-0x0;var _0x3122d1=_0xc19f[_0x483a7b];return _0x3122d1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfc19('0x0'))(_0xfc19('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc19('0x2'));var fs=require('fs');var path=require(_0xfc19('0x3'));var rimraf=require(_0xfc19('0x4'));var config=require(_0xfc19('0x5'));var attributes=require(_0xfc19('0x6'));var integrations=require(_0xfc19('0x7'));module[_0xfc19('0x8')]=function(_0x56332d,_0x4b914d){return _0x56332d['define'](_0xfc19('0x9'),attributes,{'tableName':_0xfc19('0xa'),'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 f49ae7f..037bbb4 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 _0x1b0e=['error','code','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','include','model','map','stringify','FreshsalesAccount','find','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3cff6a,_0x215a3e){var _0xbbcdd8=function(_0xe3b0a9){while(--_0xe3b0a9){_0x3cff6a['push'](_0x3cff6a['shift']());}};_0xbbcdd8(++_0x215a3e);}(_0x1b0e,0x132));var _0xe1b0=function(_0x5b03b2,_0x21aff3){_0x5b03b2=_0x5b03b2-0x0;var _0x4e88c8=_0x1b0e[_0x5b03b2];return _0x4e88c8;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var moment=require(_0xe1b0('0x2'));var BPromise=require(_0xe1b0('0x3'));var rs=require(_0xe1b0('0x4'));var fs=require('fs');var Redis=require(_0xe1b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe1b0('0x6'))(_0xe1b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1b0('0x8'));var client=jayson[_0xe1b0('0x9')][_0xe1b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e806,_0x36f5cd,_0x1eef2a){return new BPromise(function(_0x5aacc2,_0x123268){return client[_0xe1b0('0xb')](_0x52e806,_0x1eef2a)[_0xe1b0('0xc')](function(_0x400eee){logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));logger[_0xe1b0('0x10')](_0xe1b0('0x11'),_0x36f5cd,_0xe1b0('0xf'),JSON['stringify'](_0x400eee));if(_0x400eee[_0xe1b0('0x12')]){if(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x13')]===0x1f4){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x123268(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);}logger['error'](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x5aacc2(_0x400eee['error']['message']);}else{logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));_0x5aacc2(_0x400eee[_0xe1b0('0x15')][_0xe1b0('0x14')]);}})[_0xe1b0('0x16')](function(_0x5dfd78){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x5dfd78);_0x123268(_0x5dfd78);});});}exports[_0xe1b0('0x17')]=function(_0x2928b6){var _0x349f90=this;return new Promise(function(_0x5c195f,_0x5b300e){return db['FreshsalesAccount'][_0xe1b0('0x18')]({'raw':_0x2928b6['options']?_0x2928b6[_0xe1b0('0x19')][_0xe1b0('0x1a')]===undefined?!![]:![]:!![],'where':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6['options'][_0xe1b0('0x1b')]||null:null,'attributes':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6['options'][_0xe1b0('0x1c')]||null:null,'limit':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6[_0xe1b0('0x19')]['limit']||null:null,'include':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6['options']['include']?_['map'](_0x2928b6['options'][_0xe1b0('0x1d')],function(_0x4a387d){return{'model':db[_0x4a387d[_0xe1b0('0x1e')]],'as':_0x4a387d['as'],'attributes':_0x4a387d[_0xe1b0('0x1c')],'include':_0x4a387d[_0xe1b0('0x1d')]?_['map'](_0x4a387d[_0xe1b0('0x1d')],function(_0x3ef159){return{'model':db[_0x3ef159['model']],'as':_0x3ef159['as'],'attributes':_0x3ef159[_0xe1b0('0x1c')],'include':_0x3ef159[_0xe1b0('0x1d')]?_[_0xe1b0('0x1f')](_0x3ef159[_0xe1b0('0x1d')],function(_0x11e4b2){return{'model':db[_0x11e4b2['model']],'as':_0x11e4b2['as'],'attributes':_0x11e4b2[_0xe1b0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe1b0('0xc')](function(_0x1a30d0){logger[_0xe1b0('0xd')](_0xe1b0('0x17'),_0x2928b6);logger[_0xe1b0('0x10')](_0xe1b0('0x17'),_0x2928b6,JSON[_0xe1b0('0x20')](_0x1a30d0));_0x5c195f(_0x1a30d0);})['catch'](function(_0x2f7b35){logger[_0xe1b0('0x12')]('GetFreshsalesAccount',_0x2f7b35[_0xe1b0('0x14')],_0x2928b6);_0x5b300e(_0x349f90[_0xe1b0('0x12')](0x1f4,_0x2f7b35['message']));});});};exports['ShowFreshsalesAccount']=function(_0x5cc8e3){var _0x9c4710=this;return new Promise(function(_0x3f2f25,_0xae9a36){return db[_0xe1b0('0x21')][_0xe1b0('0x22')]({'raw':_0x5cc8e3[_0xe1b0('0x19')]?_0x5cc8e3['options']['raw']===undefined?!![]:![]:!![],'where':_0x5cc8e3[_0xe1b0('0x19')]?_0x5cc8e3[_0xe1b0('0x19')][_0xe1b0('0x1b')]||null:null,'attributes':_0x5cc8e3[_0xe1b0('0x19')]?_0x5cc8e3[_0xe1b0('0x19')][_0xe1b0('0x1c')]||null:null,'include':_0x5cc8e3[_0xe1b0('0x19')]?_0x5cc8e3[_0xe1b0('0x19')][_0xe1b0('0x1d')]?_[_0xe1b0('0x1f')](_0x5cc8e3['options']['include'],function(_0x58b897){return{'model':db[_0x58b897[_0xe1b0('0x1e')]],'as':_0x58b897['as'],'attributes':_0x58b897['attributes'],'include':_0x58b897[_0xe1b0('0x1d')]?_[_0xe1b0('0x1f')](_0x58b897[_0xe1b0('0x1d')],function(_0x3c414b){return{'model':db[_0x3c414b[_0xe1b0('0x1e')]],'as':_0x3c414b['as'],'attributes':_0x3c414b[_0xe1b0('0x1c')],'include':_0x3c414b[_0xe1b0('0x1d')]?_['map'](_0x3c414b['include'],function(_0x49df4d){return{'model':db[_0x49df4d[_0xe1b0('0x1e')]],'as':_0x49df4d['as'],'attributes':_0x49df4d['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1b0('0xc')](function(_0x518202){logger['info']('ShowFreshsalesAccount',_0x5cc8e3);logger[_0xe1b0('0x10')](_0xe1b0('0x23'),_0x5cc8e3,JSON[_0xe1b0('0x20')](_0x518202));_0x3f2f25(_0x518202);})[_0xe1b0('0x16')](function(_0x15fd34){logger[_0xe1b0('0x12')]('ShowFreshsalesAccount',_0x15fd34['message'],_0x5cc8e3);_0xae9a36(_0x9c4710[_0xe1b0('0x12')](0x1f4,_0x15fd34[_0xe1b0('0x14')]));});});}; \ No newline at end of file +var _0xad07=['GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshsalesAccount','options','raw','where','limit','include','attributes','map','model','then'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ad0('0x0'));var util=require(_0x7ad0('0x1'));var moment=require('moment');var BPromise=require(_0x7ad0('0x2'));var rs=require(_0x7ad0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7ad0('0x4'));var logger=require(_0x7ad0('0x5'))(_0x7ad0('0x6'));var config=require('../../config/environment');var jayson=require(_0x7ad0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d09f9,_0x458ffd,_0x533282){return new BPromise(function(_0x50b4e7,_0x8684e2){return client[_0x7ad0('0x8')](_0x2d09f9,_0x533282)['then'](function(_0x5afa7c){logger[_0x7ad0('0x9')](_0x7ad0('0xa'),_0x458ffd,_0x7ad0('0xb'));logger['debug'](_0x7ad0('0xc'),_0x458ffd,_0x7ad0('0xb'),JSON[_0x7ad0('0xd')](_0x5afa7c));if(_0x5afa7c[_0x7ad0('0xe')]){if(_0x5afa7c[_0x7ad0('0xe')][_0x7ad0('0xf')]===0x1f4){logger[_0x7ad0('0xe')](_0x7ad0('0xa'),_0x458ffd,_0x5afa7c[_0x7ad0('0xe')]['message']);return _0x8684e2(_0x5afa7c[_0x7ad0('0xe')][_0x7ad0('0x10')]);}logger[_0x7ad0('0xe')](_0x7ad0('0xa'),_0x458ffd,_0x5afa7c['error']['message']);return _0x50b4e7(_0x5afa7c[_0x7ad0('0xe')][_0x7ad0('0x10')]);}else{logger[_0x7ad0('0x9')](_0x7ad0('0xa'),_0x458ffd,_0x7ad0('0xb'));_0x50b4e7(_0x5afa7c[_0x7ad0('0x11')][_0x7ad0('0x10')]);}})[_0x7ad0('0x12')](function(_0x52c802){logger[_0x7ad0('0xe')](_0x7ad0('0xa'),_0x458ffd,_0x52c802);_0x8684e2(_0x52c802);});});}exports['GetFreshsalesAccount']=function(_0x4f45e4){var _0x412578=this;return new Promise(function(_0x4f9d6b,_0x2dae00){return db[_0x7ad0('0x13')]['findAll']({'raw':_0x4f45e4[_0x7ad0('0x14')]?_0x4f45e4['options'][_0x7ad0('0x15')]===undefined?!![]:![]:!![],'where':_0x4f45e4['options']?_0x4f45e4[_0x7ad0('0x14')][_0x7ad0('0x16')]||null:null,'attributes':_0x4f45e4[_0x7ad0('0x14')]?_0x4f45e4[_0x7ad0('0x14')]['attributes']||null:null,'limit':_0x4f45e4[_0x7ad0('0x14')]?_0x4f45e4['options'][_0x7ad0('0x17')]||null:null,'include':_0x4f45e4[_0x7ad0('0x14')]?_0x4f45e4['options'][_0x7ad0('0x18')]?_['map'](_0x4f45e4['options']['include'],function(_0x1d9a26){return{'model':db[_0x1d9a26['model']],'as':_0x1d9a26['as'],'attributes':_0x1d9a26[_0x7ad0('0x19')],'include':_0x1d9a26['include']?_[_0x7ad0('0x1a')](_0x1d9a26[_0x7ad0('0x18')],function(_0x3894a7){return{'model':db[_0x3894a7[_0x7ad0('0x1b')]],'as':_0x3894a7['as'],'attributes':_0x3894a7[_0x7ad0('0x19')],'include':_0x3894a7[_0x7ad0('0x18')]?_['map'](_0x3894a7[_0x7ad0('0x18')],function(_0xf9c854){return{'model':db[_0xf9c854[_0x7ad0('0x1b')]],'as':_0xf9c854['as'],'attributes':_0xf9c854[_0x7ad0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7ad0('0x1c')](function(_0x116e11){logger[_0x7ad0('0x9')](_0x7ad0('0x1d'),_0x4f45e4);logger['debug']('GetFreshsalesAccount',_0x4f45e4,JSON[_0x7ad0('0xd')](_0x116e11));_0x4f9d6b(_0x116e11);})[_0x7ad0('0x12')](function(_0x8150f5){logger[_0x7ad0('0xe')](_0x7ad0('0x1d'),_0x8150f5['message'],_0x4f45e4);_0x2dae00(_0x412578['error'](0x1f4,_0x8150f5[_0x7ad0('0x10')]));});});};exports[_0x7ad0('0x1e')]=function(_0x2b497b){var _0x30bf59=this;return new Promise(function(_0x14b021,_0x3b471a){return db[_0x7ad0('0x13')][_0x7ad0('0x1f')]({'raw':_0x2b497b[_0x7ad0('0x14')]?_0x2b497b[_0x7ad0('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2b497b['options']?_0x2b497b[_0x7ad0('0x14')][_0x7ad0('0x16')]||null:null,'attributes':_0x2b497b[_0x7ad0('0x14')]?_0x2b497b[_0x7ad0('0x14')][_0x7ad0('0x19')]||null:null,'include':_0x2b497b[_0x7ad0('0x14')]?_0x2b497b[_0x7ad0('0x14')][_0x7ad0('0x18')]?_[_0x7ad0('0x1a')](_0x2b497b[_0x7ad0('0x14')][_0x7ad0('0x18')],function(_0x1f9c3e){return{'model':db[_0x1f9c3e[_0x7ad0('0x1b')]],'as':_0x1f9c3e['as'],'attributes':_0x1f9c3e['attributes'],'include':_0x1f9c3e[_0x7ad0('0x18')]?_[_0x7ad0('0x1a')](_0x1f9c3e[_0x7ad0('0x18')],function(_0x1e86b8){return{'model':db[_0x1e86b8[_0x7ad0('0x1b')]],'as':_0x1e86b8['as'],'attributes':_0x1e86b8[_0x7ad0('0x19')],'include':_0x1e86b8[_0x7ad0('0x18')]?_[_0x7ad0('0x1a')](_0x1e86b8[_0x7ad0('0x18')],function(_0x329753){return{'model':db[_0x329753['model']],'as':_0x329753['as'],'attributes':_0x329753[_0x7ad0('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a21e1){logger[_0x7ad0('0x9')](_0x7ad0('0x1e'),_0x2b497b);logger['debug'](_0x7ad0('0x1e'),_0x2b497b,JSON[_0x7ad0('0xd')](_0x4a21e1));_0x14b021(_0x4a21e1);})[_0x7ad0('0x12')](function(_0x13ff73){logger['error'](_0x7ad0('0x1e'),_0x13ff73['message'],_0x2b497b);_0x3b471a(_0x30bf59['error'](0x1f4,_0x13ff73[_0x7ad0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 45f1959..3295310 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 _0xc5a0=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete'];(function(_0x159fb8,_0x1e934c){var _0x3ed863=function(_0x2fa9a5){while(--_0x2fa9a5){_0x159fb8['push'](_0x159fb8['shift']());}};_0x3ed863(++_0x1e934c);}(_0xc5a0,0xa2));var _0x0c5a=function(_0x4ce6c7,_0x1b1e0c){_0x4ce6c7=_0x4ce6c7-0x0;var _0x49fa8b=_0xc5a0[_0x4ce6c7];return _0x49fa8b;};'use strict';var multer=require(_0x0c5a('0x0'));var util=require(_0x0c5a('0x1'));var path=require(_0x0c5a('0x2'));var timeout=require(_0x0c5a('0x3'));var express=require(_0x0c5a('0x4'));var router=express[_0x0c5a('0x5')]();var auth=require(_0x0c5a('0x6'));var interaction=require(_0x0c5a('0x7'));var config=require(_0x0c5a('0x8'));var controller=require(_0x0c5a('0x9'));router['get']('/',auth[_0x0c5a('0xa')](),controller[_0x0c5a('0xb')]);router[_0x0c5a('0xc')](_0x0c5a('0xd'),auth[_0x0c5a('0xa')](),controller[_0x0c5a('0xe')]);router['get'](_0x0c5a('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x0c5a('0xc')](_0x0c5a('0x10'),auth[_0x0c5a('0xa')](),controller[_0x0c5a('0x11')]);router[_0x0c5a('0xc')]('/:id/fields',auth[_0x0c5a('0xa')](),controller['getFields']);router['post']('/',auth[_0x0c5a('0xa')](),controller[_0x0c5a('0x12')]);router[_0x0c5a('0x13')]('/:id',auth[_0x0c5a('0xa')](),controller[_0x0c5a('0x14')]);router[_0x0c5a('0x15')](_0x0c5a('0xd'),auth[_0x0c5a('0xa')](),controller[_0x0c5a('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf0c7=['put','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','post','create'];(function(_0x3d6606,_0x1e9ed3){var _0x241e05=function(_0x22e869){while(--_0x22e869){_0x3d6606['push'](_0x3d6606['shift']());}};_0x241e05(++_0x1e9ed3);}(_0xf0c7,0x1a1));var _0x7f0c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf0c7[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x7f0c('0x0'));var util=require('util');var path=require(_0x7f0c('0x1'));var timeout=require('connect-timeout');var express=require(_0x7f0c('0x2'));var router=express[_0x7f0c('0x3')]();var auth=require(_0x7f0c('0x4'));var interaction=require(_0x7f0c('0x5'));var config=require(_0x7f0c('0x6'));var controller=require(_0x7f0c('0x7'));router[_0x7f0c('0x8')]('/',auth[_0x7f0c('0x9')](),controller[_0x7f0c('0xa')]);router[_0x7f0c('0x8')](_0x7f0c('0xb'),auth[_0x7f0c('0x9')](),controller[_0x7f0c('0xc')]);router[_0x7f0c('0x8')](_0x7f0c('0xd'),auth['isAuthenticated'](),controller[_0x7f0c('0xe')]);router['get'](_0x7f0c('0xf'),auth[_0x7f0c('0x9')](),controller[_0x7f0c('0x10')]);router['get']('/:id/fields',auth[_0x7f0c('0x9')](),controller[_0x7f0c('0x11')]);router[_0x7f0c('0x12')]('/',auth['isAuthenticated'](),controller[_0x7f0c('0x13')]);router[_0x7f0c('0x14')]('/:id',auth[_0x7f0c('0x9')](),controller['update']);router['delete'](_0x7f0c('0xb'),auth[_0x7f0c('0x9')](),controller[_0x7f0c('0x15')]);module[_0x7f0c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 141b1ff..1622ed5 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 _0x6914=['STRING','sequelize','exports'];(function(_0x5c72de,_0x18496d){var _0x54d12c=function(_0x3dd31d){while(--_0x3dd31d){_0x5c72de['push'](_0x5c72de['shift']());}};_0x54d12c(++_0x18496d);}(_0x6914,0x19c));var _0x4691=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x6914[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x4691('0x0'));module[_0x4691('0x1')]={'name':{'type':Sequelize[_0x4691('0x2')]},'description':{'type':Sequelize[_0x4691('0x2')]}}; \ No newline at end of file +var _0xee34=['exports','sequelize'];(function(_0x9d8335,_0x2ca5e1){var _0x256473=function(_0xe29969){while(--_0xe29969){_0x9d8335['push'](_0x9d8335['shift']());}};_0x256473(++_0x2ca5e1);}(_0xee34,0x199));var _0x4ee3=function(_0x2ababe,_0x485598){_0x2ababe=_0x2ababe-0x0;var _0x8d76ee=_0xee34[_0x2ababe];return _0x8d76ee;};'use strict';var Sequelize=require(_0x4ee3('0x0'));module[_0x4ee3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 5410689..32b6084 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 _0xf494=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','http','request','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','FreshsalesConfiguration,\x20%s,\x20%s','end','status','json','offset','limit','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','options','FreshsalesConfiguration','count','includeAll','include','show','params','find','create','body','catch','getSubjects','nolimit','getDescriptions','findOne','FreshsalesField','getFields','html-pdf'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xf494,0x1c6));var _0x4f49=function(_0x1252cd,_0x2ecc01){_0x1252cd=_0x1252cd-0x0;var _0x5b770a=_0xf494[_0x1252cd];return _0x5b770a;};'use strict';var pdf=require(_0x4f49('0x0'));var emlformat=require(_0x4f49('0x1'));var rimraf=require(_0x4f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var moment=require(_0x4f49('0x5'));var BPromise=require(_0x4f49('0x6'));var Mustache=require(_0x4f49('0x7'));var util=require(_0x4f49('0x8'));var path=require(_0x4f49('0x9'));var sox=require(_0x4f49('0xa'));var csv=require(_0x4f49('0xb'));var ejs=require(_0x4f49('0xc'));var fs=require('fs');var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xb'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var jayson=require(_0x4f49('0x19'));var client=jayson['client'][_0x4f49('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x111a8b,_0x1b9145,_0x2efe49,_0x1a0f1e){return new BPromise(function(_0x2f0131,_0xfdb477){var _0x5c373e=_0x1a0f1e||client;return _0x5c373e[_0x4f49('0x1b')](_0x111a8b,_0x2efe49)[_0x4f49('0x1c')](function(_0x415e83){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b9145,_0x4f49('0x1d'));logger[_0x4f49('0x1e')](_0x4f49('0x1f'),_0x1b9145,'request\x20sent',JSON[_0x4f49('0x20')](_0x415e83));if(_0x415e83[_0x4f49('0x21')]){if(_0x415e83[_0x4f49('0x21')]['code']===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b9145,_0x415e83['error'][_0x4f49('0x22')]);return _0xfdb477(_0x415e83[_0x4f49('0x21')][_0x4f49('0x22')]);}logger[_0x4f49('0x21')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b9145,_0x415e83[_0x4f49('0x21')][_0x4f49('0x22')]);return _0x2f0131(_0x415e83[_0x4f49('0x21')][_0x4f49('0x22')]);}else{logger[_0x4f49('0x23')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b9145,_0x4f49('0x1d'));_0x2f0131(_0x415e83[_0x4f49('0x24')][_0x4f49('0x22')]);}})['catch'](function(_0x40755e){logger[_0x4f49('0x21')](_0x4f49('0x25'),_0x1b9145,_0x40755e);_0xfdb477(_0x40755e);});});}function respondWithStatusCode(_0x43c458,_0x9d30aa){_0x9d30aa=_0x9d30aa||0xcc;return function(_0x36187b){if(_0x36187b){return _0x43c458['sendStatus'](_0x9d30aa);}return _0x43c458['status'](_0x9d30aa)[_0x4f49('0x26')]();};}function respondWithResult(_0x429de7,_0x4fedbb){_0x4fedbb=_0x4fedbb||0xc8;return function(_0x408552){if(_0x408552){return _0x429de7[_0x4f49('0x27')](_0x4fedbb)[_0x4f49('0x28')](_0x408552);}};}function respondWithFilteredResult(_0x525950,_0xc54070){return function(_0x2eed1c){if(_0x2eed1c){var _0x298785=_0x2eed1c['count'],_0x148153=_0xc54070['offset'],_0xfefbab=_0xc54070[_0x4f49('0x29')]+_0xc54070[_0x4f49('0x2a')],_0x122404;if(_0xfefbab>=_0x298785){_0xfefbab=_0x298785;_0x122404=0xc8;}else{_0x122404=0xce;}_0x525950[_0x4f49('0x27')](_0x122404);return _0x525950['set'](_0x4f49('0x2b'),_0x148153+'-'+_0xfefbab+'/'+_0x298785)[_0x4f49('0x28')](_0x2eed1c);}return null;};}function patchUpdates(_0x43d8e3){return function(_0x506b20){try{jsonpatch['apply'](_0x506b20,_0x43d8e3,!![]);}catch(_0x3e207f){return BPromise[_0x4f49('0x2c')](_0x3e207f);}return _0x506b20[_0x4f49('0x2d')]();};}function saveUpdates(_0x5e7076,_0x1eaac6){return function(_0x35aa33){if(_0x35aa33){return _0x35aa33[_0x4f49('0x2e')](_0x5e7076)[_0x4f49('0x1c')](function(_0x3e103b){return _0x3e103b;});}return null;};}function removeEntity(_0x37bfee,_0x32c066){return function(_0x45ae19){if(_0x45ae19){return _0x45ae19[_0x4f49('0x2f')]()[_0x4f49('0x1c')](function(){_0x37bfee[_0x4f49('0x27')](0xcc)[_0x4f49('0x26')]();});}};}function handleEntityNotFound(_0x29ff83,_0x6625cd){return function(_0x135d17){if(!_0x135d17){_0x29ff83[_0x4f49('0x30')](0x194);}return _0x135d17;};}function handleError(_0x376a7d,_0x14ca52){_0x14ca52=_0x14ca52||0x1f4;return function(_0x3e7a08){logger['error'](_0x3e7a08[_0x4f49('0x31')]);if(_0x3e7a08[_0x4f49('0x32')]){delete _0x3e7a08[_0x4f49('0x32')];}_0x376a7d[_0x4f49('0x27')](_0x14ca52)[_0x4f49('0x33')](_0x3e7a08);};}exports[_0x4f49('0x34')]=function(_0x2cbe4e,_0x3ad6a7){var _0x43f72f={},_0x338db8={},_0x44e6a0={'count':0x0,'rows':[]};var _0x343365=_[_0x4f49('0x35')](db['FreshsalesConfiguration'][_0x4f49('0x36')],function(_0x27b7a9){return{'name':_0x27b7a9[_0x4f49('0x37')],'type':_0x27b7a9[_0x4f49('0x38')][_0x4f49('0x39')]};});_0x338db8[_0x4f49('0x3a')]=_[_0x4f49('0x35')](_0x343365,_0x4f49('0x32'));_0x338db8[_0x4f49('0x3b')]=_[_0x4f49('0x3c')](_0x2cbe4e[_0x4f49('0x3b')]);_0x338db8[_0x4f49('0x3d')]=_[_0x4f49('0x3e')](_0x338db8[_0x4f49('0x3a')],_0x338db8['query']);_0x43f72f[_0x4f49('0x3f')]=_[_0x4f49('0x3e')](_0x338db8['model'],qs[_0x4f49('0x40')](_0x2cbe4e[_0x4f49('0x3b')]['fields']));_0x43f72f[_0x4f49('0x3f')]=_0x43f72f[_0x4f49('0x3f')][_0x4f49('0x41')]?_0x43f72f[_0x4f49('0x3f')]:_0x338db8[_0x4f49('0x3a')];if(!_0x2cbe4e[_0x4f49('0x3b')][_0x4f49('0x42')]('nolimit')){_0x43f72f['limit']=qs['limit'](_0x2cbe4e[_0x4f49('0x3b')][_0x4f49('0x2a')]);_0x43f72f[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x2cbe4e[_0x4f49('0x3b')][_0x4f49('0x29')]);}_0x43f72f[_0x4f49('0x43')]=qs[_0x4f49('0x44')](_0x2cbe4e[_0x4f49('0x3b')]['sort']);_0x43f72f['where']=qs[_0x4f49('0x3d')](_[_0x4f49('0x45')](_0x2cbe4e[_0x4f49('0x3b')],_0x338db8['filters']),_0x343365);if(_0x2cbe4e[_0x4f49('0x3b')]['filter']){_0x43f72f['where']=_[_0x4f49('0x46')](_0x43f72f[_0x4f49('0x47')],{'$or':_[_0x4f49('0x35')](_0x343365,function(_0x497cb8){if(_0x497cb8[_0x4f49('0x38')]!==_0x4f49('0x48')){var _0x5e9f60={};_0x5e9f60[_0x497cb8[_0x4f49('0x32')]]={'$like':'%'+_0x2cbe4e['query'][_0x4f49('0x49')]+'%'};return _0x5e9f60;}})});}_0x43f72f=_[_0x4f49('0x46')]({},_0x43f72f,_0x2cbe4e[_0x4f49('0x4a')]);var _0x5e6632={'where':_0x43f72f[_0x4f49('0x47')]};return db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x5e6632)[_0x4f49('0x1c')](function(_0x29dfdb){_0x44e6a0[_0x4f49('0x4c')]=_0x29dfdb;if(_0x2cbe4e[_0x4f49('0x3b')][_0x4f49('0x4d')]){_0x43f72f[_0x4f49('0x4e')]=[{'all':!![]}];}return db[_0x4f49('0x4b')]['findAll'](_0x43f72f);})[_0x4f49('0x1c')](function(_0x44bf1d){_0x44e6a0['rows']=_0x44bf1d;return _0x44e6a0;})[_0x4f49('0x1c')](respondWithFilteredResult(_0x3ad6a7,_0x43f72f))['catch'](handleError(_0x3ad6a7,null));};exports[_0x4f49('0x4f')]=function(_0x41c580,_0x2d3dcd){var _0x300230={'raw':![],'where':{'id':_0x41c580[_0x4f49('0x50')]['id']}},_0x4a91ec={};_0x4a91ec[_0x4f49('0x3a')]=_[_0x4f49('0x3c')](db[_0x4f49('0x4b')][_0x4f49('0x36')]);_0x4a91ec[_0x4f49('0x3b')]=_[_0x4f49('0x3c')](_0x41c580[_0x4f49('0x3b')]);_0x4a91ec[_0x4f49('0x3d')]=_[_0x4f49('0x3e')](_0x4a91ec[_0x4f49('0x3a')],_0x4a91ec[_0x4f49('0x3b')]);_0x300230[_0x4f49('0x3f')]=_[_0x4f49('0x3e')](_0x4a91ec[_0x4f49('0x3a')],qs[_0x4f49('0x40')](_0x41c580['query']['fields']));_0x300230[_0x4f49('0x3f')]=_0x300230[_0x4f49('0x3f')][_0x4f49('0x41')]?_0x300230[_0x4f49('0x3f')]:_0x4a91ec[_0x4f49('0x3a')];if(_0x41c580[_0x4f49('0x3b')][_0x4f49('0x4d')]){_0x300230['include']=[{'all':!![]}];}_0x300230=_[_0x4f49('0x46')]({},_0x300230,_0x41c580['options']);return db[_0x4f49('0x4b')][_0x4f49('0x51')](_0x300230)[_0x4f49('0x1c')](handleEntityNotFound(_0x2d3dcd,null))[_0x4f49('0x1c')](respondWithResult(_0x2d3dcd,null))['catch'](handleError(_0x2d3dcd,null));};exports[_0x4f49('0x52')]=function(_0x5e75f5,_0x52d18c){return db[_0x4f49('0x4b')][_0x4f49('0x52')](_0x5e75f5[_0x4f49('0x53')],{})[_0x4f49('0x1c')](respondWithResult(_0x52d18c,0xc9))['catch'](handleError(_0x52d18c,null));};exports['update']=function(_0xd7f47b,_0x291a45){if(_0xd7f47b['body']['id']){delete _0xd7f47b[_0x4f49('0x53')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0xd7f47b[_0x4f49('0x50')]['id']}})['then'](handleEntityNotFound(_0x291a45,null))[_0x4f49('0x1c')](saveUpdates(_0xd7f47b['body'],null))[_0x4f49('0x1c')](respondWithResult(_0x291a45,null))[_0x4f49('0x54')](handleError(_0x291a45,null));};exports[_0x4f49('0x2f')]=function(_0x883408,_0x16a591){return db[_0x4f49('0x4b')][_0x4f49('0x51')]({'where':{'id':_0x883408[_0x4f49('0x50')]['id']}})['then'](handleEntityNotFound(_0x16a591,null))[_0x4f49('0x1c')](removeEntity(_0x16a591,null))['catch'](handleError(_0x16a591,null));};exports[_0x4f49('0x55')]=function(_0x1f640d,_0xc4fc6b,_0x467f12){var _0x1981e0={};var _0xb7538c={};var _0x553981;var _0x426c50;return db[_0x4f49('0x4b')]['findOne']({'where':{'id':_0x1f640d['params']['id']}})[_0x4f49('0x1c')](handleEntityNotFound(_0xc4fc6b,null))[_0x4f49('0x1c')](function(_0x2e0df5){if(_0x2e0df5){_0x553981=_0x2e0df5;_0xb7538c[_0x4f49('0x3a')]=_[_0x4f49('0x3c')](db['FreshsalesField'][_0x4f49('0x36')]);_0xb7538c['query']=_[_0x4f49('0x3c')](_0x1f640d[_0x4f49('0x3b')]);_0xb7538c[_0x4f49('0x3d')]=_['intersection'](_0xb7538c[_0x4f49('0x3a')],_0xb7538c[_0x4f49('0x3b')]);_0x1981e0[_0x4f49('0x3f')]=_[_0x4f49('0x3e')](_0xb7538c['model'],qs[_0x4f49('0x40')](_0x1f640d[_0x4f49('0x3b')]['fields']));_0x1981e0[_0x4f49('0x3f')]=_0x1981e0[_0x4f49('0x3f')][_0x4f49('0x41')]?_0x1981e0[_0x4f49('0x3f')]:_0xb7538c[_0x4f49('0x3a')];_0x1981e0[_0x4f49('0x43')]=qs[_0x4f49('0x44')](_0x1f640d[_0x4f49('0x3b')]['sort']);_0x1981e0[_0x4f49('0x47')]=qs[_0x4f49('0x3d')](_[_0x4f49('0x45')](_0x1f640d[_0x4f49('0x3b')],_0xb7538c[_0x4f49('0x3d')]));if(_0x1f640d[_0x4f49('0x3b')][_0x4f49('0x49')]){_0x1981e0['where']=_[_0x4f49('0x46')](_0x1981e0['where'],{'$or':_[_0x4f49('0x35')](_0x1981e0[_0x4f49('0x3f')],function(_0x4714c7){var _0xf29378={};_0xf29378[_0x4714c7]={'$like':'%'+_0x1f640d[_0x4f49('0x3b')][_0x4f49('0x49')]+'%'};return _0xf29378;})});}_0x1981e0=_[_0x4f49('0x46')]({},_0x1981e0,_0x1f640d[_0x4f49('0x4a')]);return _0x553981[_0x4f49('0x55')](_0x1981e0);}})[_0x4f49('0x1c')](function(_0x545552){if(_0x545552){_0x426c50=_0x545552[_0x4f49('0x41')];if(!_0x1f640d[_0x4f49('0x3b')][_0x4f49('0x42')](_0x4f49('0x56'))){_0x1981e0['limit']=qs['limit'](_0x1f640d[_0x4f49('0x3b')]['limit']);_0x1981e0[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x1f640d[_0x4f49('0x3b')][_0x4f49('0x29')]);}return _0x553981[_0x4f49('0x55')](_0x1981e0);}})[_0x4f49('0x1c')](function(_0x179431){if(_0x179431){return _0x179431?{'count':_0x426c50,'rows':_0x179431}:null;}})[_0x4f49('0x1c')](respondWithResult(_0xc4fc6b,null))[_0x4f49('0x54')](handleError(_0xc4fc6b,null));};exports[_0x4f49('0x57')]=function(_0x71ea58,_0x1ba97e,_0x2b3484){var _0xd53de8={};var _0x234984={};var _0x412d84;var _0x30afed;return db[_0x4f49('0x4b')][_0x4f49('0x58')]({'where':{'id':_0x71ea58[_0x4f49('0x50')]['id']}})[_0x4f49('0x1c')](handleEntityNotFound(_0x1ba97e,null))[_0x4f49('0x1c')](function(_0xf6d04b){if(_0xf6d04b){_0x412d84=_0xf6d04b;_0x234984[_0x4f49('0x3a')]=_[_0x4f49('0x3c')](db['FreshsalesField'][_0x4f49('0x36')]);_0x234984['query']=_[_0x4f49('0x3c')](_0x71ea58[_0x4f49('0x3b')]);_0x234984[_0x4f49('0x3d')]=_[_0x4f49('0x3e')](_0x234984[_0x4f49('0x3a')],_0x234984[_0x4f49('0x3b')]);_0xd53de8[_0x4f49('0x3f')]=_[_0x4f49('0x3e')](_0x234984[_0x4f49('0x3a')],qs['fields'](_0x71ea58['query'][_0x4f49('0x40')]));_0xd53de8['attributes']=_0xd53de8[_0x4f49('0x3f')][_0x4f49('0x41')]?_0xd53de8[_0x4f49('0x3f')]:_0x234984[_0x4f49('0x3a')];_0xd53de8[_0x4f49('0x43')]=qs['sort'](_0x71ea58['query'][_0x4f49('0x44')]);_0xd53de8[_0x4f49('0x47')]=qs['filters'](_[_0x4f49('0x45')](_0x71ea58[_0x4f49('0x3b')],_0x234984['filters']));if(_0x71ea58[_0x4f49('0x3b')]['filter']){_0xd53de8[_0x4f49('0x47')]=_[_0x4f49('0x46')](_0xd53de8['where'],{'$or':_[_0x4f49('0x35')](_0xd53de8[_0x4f49('0x3f')],function(_0x944375){var _0x1ae1e3={};_0x1ae1e3[_0x944375]={'$like':'%'+_0x71ea58[_0x4f49('0x3b')][_0x4f49('0x49')]+'%'};return _0x1ae1e3;})});}_0xd53de8=_['merge']({},_0xd53de8,_0x71ea58[_0x4f49('0x4a')]);return _0x412d84['getDescriptions'](_0xd53de8);}})[_0x4f49('0x1c')](function(_0x574343){if(_0x574343){_0x30afed=_0x574343[_0x4f49('0x41')];if(!_0x71ea58['query'][_0x4f49('0x42')](_0x4f49('0x56'))){_0xd53de8[_0x4f49('0x2a')]=qs[_0x4f49('0x2a')](_0x71ea58['query'][_0x4f49('0x2a')]);_0xd53de8['offset']=qs[_0x4f49('0x29')](_0x71ea58['query'][_0x4f49('0x29')]);}return _0x412d84['getDescriptions'](_0xd53de8);}})['then'](function(_0x329a49){if(_0x329a49){return _0x329a49?{'count':_0x30afed,'rows':_0x329a49}:null;}})[_0x4f49('0x1c')](respondWithResult(_0x1ba97e,null))[_0x4f49('0x54')](handleError(_0x1ba97e,null));};exports['getFields']=function(_0x289810,_0x431c15,_0x5c33c9){var _0x5d52ae={};var _0x5c2acd={};var _0x3fb913;var _0x18d37f;return db[_0x4f49('0x4b')][_0x4f49('0x58')]({'where':{'id':_0x289810[_0x4f49('0x50')]['id']}})['then'](handleEntityNotFound(_0x431c15,null))[_0x4f49('0x1c')](function(_0x1b922e){if(_0x1b922e){_0x3fb913=_0x1b922e;_0x5c2acd[_0x4f49('0x3a')]=_['keys'](db[_0x4f49('0x59')][_0x4f49('0x36')]);_0x5c2acd[_0x4f49('0x3b')]=_[_0x4f49('0x3c')](_0x289810['query']);_0x5c2acd[_0x4f49('0x3d')]=_[_0x4f49('0x3e')](_0x5c2acd[_0x4f49('0x3a')],_0x5c2acd[_0x4f49('0x3b')]);_0x5d52ae[_0x4f49('0x3f')]=_['intersection'](_0x5c2acd[_0x4f49('0x3a')],qs[_0x4f49('0x40')](_0x289810['query'][_0x4f49('0x40')]));_0x5d52ae['attributes']=_0x5d52ae[_0x4f49('0x3f')]['length']?_0x5d52ae[_0x4f49('0x3f')]:_0x5c2acd[_0x4f49('0x3a')];_0x5d52ae[_0x4f49('0x43')]=qs[_0x4f49('0x44')](_0x289810[_0x4f49('0x3b')]['sort']);_0x5d52ae[_0x4f49('0x47')]=qs[_0x4f49('0x3d')](_[_0x4f49('0x45')](_0x289810[_0x4f49('0x3b')],_0x5c2acd['filters']));if(_0x289810[_0x4f49('0x3b')]['filter']){_0x5d52ae[_0x4f49('0x47')]=_['merge'](_0x5d52ae[_0x4f49('0x47')],{'$or':_[_0x4f49('0x35')](_0x5d52ae[_0x4f49('0x3f')],function(_0x34fca3){var _0x111e90={};_0x111e90[_0x34fca3]={'$like':'%'+_0x289810[_0x4f49('0x3b')][_0x4f49('0x49')]+'%'};return _0x111e90;})});}_0x5d52ae=_[_0x4f49('0x46')]({},_0x5d52ae,_0x289810[_0x4f49('0x4a')]);return _0x3fb913[_0x4f49('0x5a')](_0x5d52ae);}})['then'](function(_0x33098a){if(_0x33098a){_0x18d37f=_0x33098a[_0x4f49('0x41')];if(!_0x289810[_0x4f49('0x3b')][_0x4f49('0x42')](_0x4f49('0x56'))){_0x5d52ae[_0x4f49('0x2a')]=qs['limit'](_0x289810[_0x4f49('0x3b')][_0x4f49('0x2a')]);_0x5d52ae[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x289810['query'][_0x4f49('0x29')]);}return _0x3fb913['getFields'](_0x5d52ae);}})[_0x4f49('0x1c')](function(_0x2be139){if(_0x2be139){return _0x2be139?{'count':_0x18d37f,'rows':_0x2be139}:null;}})[_0x4f49('0x1c')](respondWithResult(_0x431c15,null))[_0x4f49('0x54')](handleError(_0x431c15,null));}; \ No newline at end of file +var _0x1cb9=['http','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','request\x20sent','result','catch','sendStatus','status','end','offset','limit','set','json','apply','save','update','then','destroy','stack','send','map','FreshsalesConfiguration','fieldName','type','key','name','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','options','count','include','findAll','rows','keys','rawAttributes','includeAll','merge','find','create','body','params','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise'];(function(_0x1a7310,_0x446e90){var _0x3dc179=function(_0x24a542){while(--_0x24a542){_0x1a7310['push'](_0x1a7310['shift']());}};_0x3dc179(++_0x446e90);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2ffc4a,_0x5462c7){_0x2ffc4a=_0x2ffc4a-0x0;var _0x4188cc=_0x1cb9[_0x2ffc4a];return _0x4188cc;};'use strict';var pdf=require(_0x91cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91cb('0x1'));var zipdir=require(_0x91cb('0x2'));var jsonpatch=require(_0x91cb('0x3'));var rp=require(_0x91cb('0x4'));var moment=require('moment');var BPromise=require(_0x91cb('0x5'));var Mustache=require(_0x91cb('0x6'));var util=require('util');var path=require(_0x91cb('0x7'));var sox=require(_0x91cb('0x8'));var csv=require(_0x91cb('0x9'));var ejs=require(_0x91cb('0xa'));var fs=require('fs');var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x9'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var jayson=require(_0x91cb('0x19'));var client=jayson['client'][_0x91cb('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3ea707,_0x44f2e9,_0x2c7d40,_0x4a7d45){return new BPromise(function(_0x4cc6ef,_0x4aae25){var _0x3d22b7=_0x4a7d45||client;return _0x3d22b7['request'](_0x3ea707,_0x2c7d40)['then'](function(_0x576369){logger[_0x91cb('0x1b')](_0x91cb('0x1c'),_0x44f2e9,'request\x20sent');logger[_0x91cb('0x1d')](_0x91cb('0x1e'),_0x44f2e9,'request\x20sent',JSON[_0x91cb('0x1f')](_0x576369));if(_0x576369[_0x91cb('0x20')]){if(_0x576369[_0x91cb('0x20')][_0x91cb('0x21')]===0x1f4){logger['error'](_0x91cb('0x1c'),_0x44f2e9,_0x576369[_0x91cb('0x20')]['message']);return _0x4aae25(_0x576369[_0x91cb('0x20')]['message']);}logger['error'](_0x91cb('0x1c'),_0x44f2e9,_0x576369[_0x91cb('0x20')]['message']);return _0x4cc6ef(_0x576369['error']['message']);}else{logger[_0x91cb('0x1b')](_0x91cb('0x1c'),_0x44f2e9,_0x91cb('0x22'));_0x4cc6ef(_0x576369[_0x91cb('0x23')]['message']);}})[_0x91cb('0x24')](function(_0x43881c){logger[_0x91cb('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x44f2e9,_0x43881c);_0x4aae25(_0x43881c);});});}function respondWithStatusCode(_0x26f18f,_0x1a7a54){_0x1a7a54=_0x1a7a54||0xcc;return function(_0x2447e7){if(_0x2447e7){return _0x26f18f[_0x91cb('0x25')](_0x1a7a54);}return _0x26f18f[_0x91cb('0x26')](_0x1a7a54)[_0x91cb('0x27')]();};}function respondWithResult(_0x414e60,_0x423c4f){_0x423c4f=_0x423c4f||0xc8;return function(_0x264e9b){if(_0x264e9b){return _0x414e60['status'](_0x423c4f)['json'](_0x264e9b);}};}function respondWithFilteredResult(_0x234eb1,_0x554350){return function(_0x1c67d2){if(_0x1c67d2){var _0x34d372=_0x1c67d2['count'],_0x318031=_0x554350[_0x91cb('0x28')],_0x5595c5=_0x554350[_0x91cb('0x28')]+_0x554350[_0x91cb('0x29')],_0x9b26a6;if(_0x5595c5>=_0x34d372){_0x5595c5=_0x34d372;_0x9b26a6=0xc8;}else{_0x9b26a6=0xce;}_0x234eb1[_0x91cb('0x26')](_0x9b26a6);return _0x234eb1[_0x91cb('0x2a')]('Content-Range',_0x318031+'-'+_0x5595c5+'/'+_0x34d372)[_0x91cb('0x2b')](_0x1c67d2);}return null;};}function patchUpdates(_0x52670a){return function(_0x196385){try{jsonpatch[_0x91cb('0x2c')](_0x196385,_0x52670a,!![]);}catch(_0x445fe1){return BPromise['reject'](_0x445fe1);}return _0x196385[_0x91cb('0x2d')]();};}function saveUpdates(_0x146e1f,_0x25bbf9){return function(_0x361e4c){if(_0x361e4c){return _0x361e4c[_0x91cb('0x2e')](_0x146e1f)[_0x91cb('0x2f')](function(_0x1e5bf1){return _0x1e5bf1;});}return null;};}function removeEntity(_0x3bbde3,_0x1a10b1){return function(_0x5e6ed3){if(_0x5e6ed3){return _0x5e6ed3[_0x91cb('0x30')]()[_0x91cb('0x2f')](function(){_0x3bbde3[_0x91cb('0x26')](0xcc)[_0x91cb('0x27')]();});}};}function handleEntityNotFound(_0x440060,_0x4e70cd){return function(_0x2409d3){if(!_0x2409d3){_0x440060[_0x91cb('0x25')](0x194);}return _0x2409d3;};}function handleError(_0x2e317c,_0x46db02){_0x46db02=_0x46db02||0x1f4;return function(_0x39dd11){logger['error'](_0x39dd11[_0x91cb('0x31')]);if(_0x39dd11['name']){delete _0x39dd11['name'];}_0x2e317c['status'](_0x46db02)[_0x91cb('0x32')](_0x39dd11);};}exports['index']=function(_0x341ebe,_0x5604ba){var _0x59faf6={},_0x2ec8e1={},_0x2b15a1={'count':0x0,'rows':[]};var _0x1deabb=_[_0x91cb('0x33')](db[_0x91cb('0x34')]['rawAttributes'],function(_0x8beb3a){return{'name':_0x8beb3a[_0x91cb('0x35')],'type':_0x8beb3a[_0x91cb('0x36')][_0x91cb('0x37')]};});_0x2ec8e1['model']=_['map'](_0x1deabb,_0x91cb('0x38'));_0x2ec8e1[_0x91cb('0x39')]=_['keys'](_0x341ebe[_0x91cb('0x39')]);_0x2ec8e1[_0x91cb('0x3a')]=_['intersection'](_0x2ec8e1[_0x91cb('0x3b')],_0x2ec8e1[_0x91cb('0x39')]);_0x59faf6['attributes']=_[_0x91cb('0x3c')](_0x2ec8e1['model'],qs[_0x91cb('0x3d')](_0x341ebe[_0x91cb('0x39')][_0x91cb('0x3d')]));_0x59faf6[_0x91cb('0x3e')]=_0x59faf6[_0x91cb('0x3e')][_0x91cb('0x3f')]?_0x59faf6['attributes']:_0x2ec8e1[_0x91cb('0x3b')];if(!_0x341ebe[_0x91cb('0x39')]['hasOwnProperty'](_0x91cb('0x40'))){_0x59faf6['limit']=qs[_0x91cb('0x29')](_0x341ebe[_0x91cb('0x39')][_0x91cb('0x29')]);_0x59faf6[_0x91cb('0x28')]=qs['offset'](_0x341ebe[_0x91cb('0x39')][_0x91cb('0x28')]);}_0x59faf6[_0x91cb('0x41')]=qs[_0x91cb('0x42')](_0x341ebe[_0x91cb('0x39')][_0x91cb('0x42')]);_0x59faf6[_0x91cb('0x43')]=qs[_0x91cb('0x3a')](_[_0x91cb('0x44')](_0x341ebe[_0x91cb('0x39')],_0x2ec8e1['filters']),_0x1deabb);if(_0x341ebe[_0x91cb('0x39')]['filter']){_0x59faf6[_0x91cb('0x43')]=_['merge'](_0x59faf6[_0x91cb('0x43')],{'$or':_['map'](_0x1deabb,function(_0x138f48){if(_0x138f48[_0x91cb('0x36')]!==_0x91cb('0x45')){var _0x31c966={};_0x31c966[_0x138f48['name']]={'$like':'%'+_0x341ebe[_0x91cb('0x39')][_0x91cb('0x46')]+'%'};return _0x31c966;}})});}_0x59faf6=_['merge']({},_0x59faf6,_0x341ebe[_0x91cb('0x47')]);var _0x2f1749={'where':_0x59faf6[_0x91cb('0x43')]};return db[_0x91cb('0x34')][_0x91cb('0x48')](_0x2f1749)[_0x91cb('0x2f')](function(_0x17d319){_0x2b15a1[_0x91cb('0x48')]=_0x17d319;if(_0x341ebe[_0x91cb('0x39')]['includeAll']){_0x59faf6[_0x91cb('0x49')]=[{'all':!![]}];}return db[_0x91cb('0x34')][_0x91cb('0x4a')](_0x59faf6);})[_0x91cb('0x2f')](function(_0x3314cc){_0x2b15a1[_0x91cb('0x4b')]=_0x3314cc;return _0x2b15a1;})[_0x91cb('0x2f')](respondWithFilteredResult(_0x5604ba,_0x59faf6))[_0x91cb('0x24')](handleError(_0x5604ba,null));};exports['show']=function(_0x348d78,_0x46caf1){var _0x2b8b7f={'raw':![],'where':{'id':_0x348d78['params']['id']}},_0x3b8cfd={};_0x3b8cfd[_0x91cb('0x3b')]=_[_0x91cb('0x4c')](db['FreshsalesConfiguration'][_0x91cb('0x4d')]);_0x3b8cfd['query']=_[_0x91cb('0x4c')](_0x348d78['query']);_0x3b8cfd['filters']=_['intersection'](_0x3b8cfd[_0x91cb('0x3b')],_0x3b8cfd[_0x91cb('0x39')]);_0x2b8b7f[_0x91cb('0x3e')]=_[_0x91cb('0x3c')](_0x3b8cfd[_0x91cb('0x3b')],qs['fields'](_0x348d78['query'][_0x91cb('0x3d')]));_0x2b8b7f[_0x91cb('0x3e')]=_0x2b8b7f[_0x91cb('0x3e')][_0x91cb('0x3f')]?_0x2b8b7f['attributes']:_0x3b8cfd['model'];if(_0x348d78['query'][_0x91cb('0x4e')]){_0x2b8b7f['include']=[{'all':!![]}];}_0x2b8b7f=_[_0x91cb('0x4f')]({},_0x2b8b7f,_0x348d78['options']);return db[_0x91cb('0x34')][_0x91cb('0x50')](_0x2b8b7f)[_0x91cb('0x2f')](handleEntityNotFound(_0x46caf1,null))[_0x91cb('0x2f')](respondWithResult(_0x46caf1,null))[_0x91cb('0x24')](handleError(_0x46caf1,null));};exports[_0x91cb('0x51')]=function(_0x3ec250,_0x30fd4e){return db[_0x91cb('0x34')][_0x91cb('0x51')](_0x3ec250[_0x91cb('0x52')],{})['then'](respondWithResult(_0x30fd4e,0xc9))[_0x91cb('0x24')](handleError(_0x30fd4e,null));};exports[_0x91cb('0x2e')]=function(_0x4d7a34,_0x3f719b){if(_0x4d7a34[_0x91cb('0x52')]['id']){delete _0x4d7a34['body']['id'];}return db[_0x91cb('0x34')][_0x91cb('0x50')]({'where':{'id':_0x4d7a34[_0x91cb('0x53')]['id']}})[_0x91cb('0x2f')](handleEntityNotFound(_0x3f719b,null))[_0x91cb('0x2f')](saveUpdates(_0x4d7a34[_0x91cb('0x52')],null))[_0x91cb('0x2f')](respondWithResult(_0x3f719b,null))[_0x91cb('0x24')](handleError(_0x3f719b,null));};exports[_0x91cb('0x30')]=function(_0x93ef52,_0x847164){return db['FreshsalesConfiguration'][_0x91cb('0x50')]({'where':{'id':_0x93ef52['params']['id']}})[_0x91cb('0x2f')](handleEntityNotFound(_0x847164,null))['then'](removeEntity(_0x847164,null))[_0x91cb('0x24')](handleError(_0x847164,null));};exports[_0x91cb('0x54')]=function(_0x1986d7,_0x47a6cd,_0xe49d42){var _0x3648c1={};var _0x48dcf7={};var _0xef4754;var _0x102025;return db[_0x91cb('0x34')][_0x91cb('0x55')]({'where':{'id':_0x1986d7['params']['id']}})[_0x91cb('0x2f')](handleEntityNotFound(_0x47a6cd,null))[_0x91cb('0x2f')](function(_0x4250c2){if(_0x4250c2){_0xef4754=_0x4250c2;_0x48dcf7[_0x91cb('0x3b')]=_['keys'](db[_0x91cb('0x56')][_0x91cb('0x4d')]);_0x48dcf7['query']=_['keys'](_0x1986d7[_0x91cb('0x39')]);_0x48dcf7['filters']=_[_0x91cb('0x3c')](_0x48dcf7[_0x91cb('0x3b')],_0x48dcf7['query']);_0x3648c1['attributes']=_[_0x91cb('0x3c')](_0x48dcf7['model'],qs[_0x91cb('0x3d')](_0x1986d7[_0x91cb('0x39')][_0x91cb('0x3d')]));_0x3648c1['attributes']=_0x3648c1[_0x91cb('0x3e')]['length']?_0x3648c1[_0x91cb('0x3e')]:_0x48dcf7[_0x91cb('0x3b')];_0x3648c1[_0x91cb('0x41')]=qs[_0x91cb('0x42')](_0x1986d7['query'][_0x91cb('0x42')]);_0x3648c1[_0x91cb('0x43')]=qs[_0x91cb('0x3a')](_[_0x91cb('0x44')](_0x1986d7[_0x91cb('0x39')],_0x48dcf7[_0x91cb('0x3a')]));if(_0x1986d7[_0x91cb('0x39')][_0x91cb('0x46')]){_0x3648c1[_0x91cb('0x43')]=_[_0x91cb('0x4f')](_0x3648c1[_0x91cb('0x43')],{'$or':_[_0x91cb('0x33')](_0x3648c1['attributes'],function(_0x2cf4d0){var _0x2e301a={};_0x2e301a[_0x2cf4d0]={'$like':'%'+_0x1986d7[_0x91cb('0x39')][_0x91cb('0x46')]+'%'};return _0x2e301a;})});}_0x3648c1=_[_0x91cb('0x4f')]({},_0x3648c1,_0x1986d7[_0x91cb('0x47')]);return _0xef4754[_0x91cb('0x54')](_0x3648c1);}})['then'](function(_0x325b2d){if(_0x325b2d){_0x102025=_0x325b2d['length'];if(!_0x1986d7[_0x91cb('0x39')][_0x91cb('0x57')](_0x91cb('0x40'))){_0x3648c1[_0x91cb('0x29')]=qs['limit'](_0x1986d7[_0x91cb('0x39')][_0x91cb('0x29')]);_0x3648c1[_0x91cb('0x28')]=qs[_0x91cb('0x28')](_0x1986d7[_0x91cb('0x39')][_0x91cb('0x28')]);}return _0xef4754['getSubjects'](_0x3648c1);}})[_0x91cb('0x2f')](function(_0x28bfe5){if(_0x28bfe5){return _0x28bfe5?{'count':_0x102025,'rows':_0x28bfe5}:null;}})[_0x91cb('0x2f')](respondWithResult(_0x47a6cd,null))[_0x91cb('0x24')](handleError(_0x47a6cd,null));};exports[_0x91cb('0x58')]=function(_0xc58b4a,_0x18b812,_0x2721cb){var _0x43629b={};var _0x457f81={};var _0x1347df;var _0x1f128b;return db[_0x91cb('0x34')][_0x91cb('0x55')]({'where':{'id':_0xc58b4a[_0x91cb('0x53')]['id']}})[_0x91cb('0x2f')](handleEntityNotFound(_0x18b812,null))[_0x91cb('0x2f')](function(_0x4866aa){if(_0x4866aa){_0x1347df=_0x4866aa;_0x457f81[_0x91cb('0x3b')]=_[_0x91cb('0x4c')](db['FreshsalesField'][_0x91cb('0x4d')]);_0x457f81[_0x91cb('0x39')]=_[_0x91cb('0x4c')](_0xc58b4a['query']);_0x457f81[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x457f81['model'],_0x457f81['query']);_0x43629b[_0x91cb('0x3e')]=_['intersection'](_0x457f81[_0x91cb('0x3b')],qs[_0x91cb('0x3d')](_0xc58b4a['query'][_0x91cb('0x3d')]));_0x43629b['attributes']=_0x43629b[_0x91cb('0x3e')][_0x91cb('0x3f')]?_0x43629b['attributes']:_0x457f81['model'];_0x43629b[_0x91cb('0x41')]=qs[_0x91cb('0x42')](_0xc58b4a[_0x91cb('0x39')]['sort']);_0x43629b[_0x91cb('0x43')]=qs[_0x91cb('0x3a')](_[_0x91cb('0x44')](_0xc58b4a[_0x91cb('0x39')],_0x457f81['filters']));if(_0xc58b4a[_0x91cb('0x39')]['filter']){_0x43629b[_0x91cb('0x43')]=_[_0x91cb('0x4f')](_0x43629b[_0x91cb('0x43')],{'$or':_[_0x91cb('0x33')](_0x43629b['attributes'],function(_0x5cd11e){var _0x1c8cf9={};_0x1c8cf9[_0x5cd11e]={'$like':'%'+_0xc58b4a['query'][_0x91cb('0x46')]+'%'};return _0x1c8cf9;})});}_0x43629b=_[_0x91cb('0x4f')]({},_0x43629b,_0xc58b4a[_0x91cb('0x47')]);return _0x1347df[_0x91cb('0x58')](_0x43629b);}})[_0x91cb('0x2f')](function(_0x46874e){if(_0x46874e){_0x1f128b=_0x46874e[_0x91cb('0x3f')];if(!_0xc58b4a['query'][_0x91cb('0x57')](_0x91cb('0x40'))){_0x43629b['limit']=qs[_0x91cb('0x29')](_0xc58b4a['query'][_0x91cb('0x29')]);_0x43629b[_0x91cb('0x28')]=qs[_0x91cb('0x28')](_0xc58b4a[_0x91cb('0x39')][_0x91cb('0x28')]);}return _0x1347df[_0x91cb('0x58')](_0x43629b);}})[_0x91cb('0x2f')](function(_0x30259d){if(_0x30259d){return _0x30259d?{'count':_0x1f128b,'rows':_0x30259d}:null;}})[_0x91cb('0x2f')](respondWithResult(_0x18b812,null))[_0x91cb('0x24')](handleError(_0x18b812,null));};exports[_0x91cb('0x59')]=function(_0x11411d,_0x684202,_0x14882d){var _0x22ba54={};var _0x4142eb={};var _0x4bc040;var _0x372270;return db['FreshsalesConfiguration'][_0x91cb('0x55')]({'where':{'id':_0x11411d[_0x91cb('0x53')]['id']}})[_0x91cb('0x2f')](handleEntityNotFound(_0x684202,null))[_0x91cb('0x2f')](function(_0x319289){if(_0x319289){_0x4bc040=_0x319289;_0x4142eb[_0x91cb('0x3b')]=_[_0x91cb('0x4c')](db[_0x91cb('0x56')]['rawAttributes']);_0x4142eb[_0x91cb('0x39')]=_[_0x91cb('0x4c')](_0x11411d['query']);_0x4142eb['filters']=_[_0x91cb('0x3c')](_0x4142eb['model'],_0x4142eb['query']);_0x22ba54[_0x91cb('0x3e')]=_['intersection'](_0x4142eb[_0x91cb('0x3b')],qs['fields'](_0x11411d[_0x91cb('0x39')][_0x91cb('0x3d')]));_0x22ba54[_0x91cb('0x3e')]=_0x22ba54[_0x91cb('0x3e')]['length']?_0x22ba54[_0x91cb('0x3e')]:_0x4142eb[_0x91cb('0x3b')];_0x22ba54[_0x91cb('0x41')]=qs[_0x91cb('0x42')](_0x11411d[_0x91cb('0x39')][_0x91cb('0x42')]);_0x22ba54[_0x91cb('0x43')]=qs[_0x91cb('0x3a')](_[_0x91cb('0x44')](_0x11411d[_0x91cb('0x39')],_0x4142eb[_0x91cb('0x3a')]));if(_0x11411d[_0x91cb('0x39')][_0x91cb('0x46')]){_0x22ba54[_0x91cb('0x43')]=_[_0x91cb('0x4f')](_0x22ba54[_0x91cb('0x43')],{'$or':_[_0x91cb('0x33')](_0x22ba54[_0x91cb('0x3e')],function(_0x30640e){var _0x39b5bd={};_0x39b5bd[_0x30640e]={'$like':'%'+_0x11411d[_0x91cb('0x39')][_0x91cb('0x46')]+'%'};return _0x39b5bd;})});}_0x22ba54=_[_0x91cb('0x4f')]({},_0x22ba54,_0x11411d[_0x91cb('0x47')]);return _0x4bc040[_0x91cb('0x59')](_0x22ba54);}})['then'](function(_0x1c8ca7){if(_0x1c8ca7){_0x372270=_0x1c8ca7[_0x91cb('0x3f')];if(!_0x11411d[_0x91cb('0x39')][_0x91cb('0x57')](_0x91cb('0x40'))){_0x22ba54[_0x91cb('0x29')]=qs[_0x91cb('0x29')](_0x11411d[_0x91cb('0x39')][_0x91cb('0x29')]);_0x22ba54[_0x91cb('0x28')]=qs[_0x91cb('0x28')](_0x11411d['query'][_0x91cb('0x28')]);}return _0x4bc040['getFields'](_0x22ba54);}})['then'](function(_0x4023f5){if(_0x4023f5){return _0x4023f5?{'count':_0x372270,'rows':_0x4023f5}:null;}})[_0x91cb('0x2f')](respondWithResult(_0x684202,null))[_0x91cb('0x24')](handleError(_0x684202,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 16e7afc..4b308dd 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 _0x3d15=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3d15,0x127));var _0x53d1=function(_0x1654e,_0x31262b){_0x1654e=_0x1654e-0x0;var _0x544920=_0x3d15[_0x1654e];return _0x544920;};'use strict';var _=require('lodash');var util=require(_0x53d1('0x0'));var logger=require(_0x53d1('0x1'))('api');var moment=require(_0x53d1('0x2'));var BPromise=require(_0x53d1('0x3'));var rp=require(_0x53d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53d1('0x5'));var config=require(_0x53d1('0x6'));var attributes=require(_0x53d1('0x7'));module['exports']=function(_0x3b3e81,_0x74eec6){return _0x3b3e81['define'](_0x53d1('0x8'),attributes,{'tableName':_0x53d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e30=['./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x1d8444,_0x445840){var _0x450570=function(_0x4aea18){while(--_0x4aea18){_0x1d8444['push'](_0x1d8444['shift']());}};_0x450570(++_0x445840);}(_0x5e30,0x7b));var _0x05e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e30[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x05e3('0x0'));var util=require(_0x05e3('0x1'));var logger=require(_0x05e3('0x2'))(_0x05e3('0x3'));var moment=require(_0x05e3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x05e3('0x5'));var config=require(_0x05e3('0x6'));var attributes=require(_0x05e3('0x7'));module[_0x05e3('0x8')]=function(_0x348e2c,_0x2dd025){return _0x348e2c['define']('FreshsalesConfiguration',attributes,{'tableName':_0x05e3('0x9'),'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 710383b..60e8b63 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 _0x97c1=['../../config/logger','rpc','../../config/environment','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x47dff0,_0x19c0f1){var _0x4cbdcd=function(_0x498e5f){while(--_0x498e5f){_0x47dff0['push'](_0x47dff0['shift']());}};_0x4cbdcd(++_0x19c0f1);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437214,_0x60fab2,_0xfcee35){return new BPromise(function(_0x5cf5cb,_0x5d42c5){return client[_0x197c('0x9')](_0x437214,_0xfcee35)['then'](function(_0x339fab){logger[_0x197c('0xa')](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));logger['debug'](_0x197c('0xd'),_0x60fab2,_0x197c('0xc'),JSON[_0x197c('0xe')](_0x339fab));if(_0x339fab[_0x197c('0xf')]){if(_0x339fab[_0x197c('0xf')]['code']===0x1f4){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5d42c5(_0x339fab['error'][_0x197c('0x10')]);}logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5cf5cb(_0x339fab[_0x197c('0xf')]['message']);}else{logger['info'](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));_0x5cf5cb(_0x339fab[_0x197c('0x11')][_0x197c('0x10')]);}})[_0x197c('0x12')](function(_0x7e302f){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x7e302f);_0x5d42c5(_0x7e302f);});});} \ No newline at end of file +var _0xdc25=['http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdc25,0x128));var _0x5dc2=function(_0x4041af,_0x939e58){_0x4041af=_0x4041af-0x0;var _0x5cf310=_0xdc25[_0x4041af];return _0x5cf310;};'use strict';var _=require(_0x5dc2('0x0'));var util=require(_0x5dc2('0x1'));var moment=require(_0x5dc2('0x2'));var BPromise=require(_0x5dc2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dc2('0x4'));var db=require(_0x5dc2('0x5'))['db'];var utils=require(_0x5dc2('0x6'));var logger=require(_0x5dc2('0x7'))(_0x5dc2('0x8'));var config=require(_0x5dc2('0x9'));var jayson=require(_0x5dc2('0xa'));var client=jayson[_0x5dc2('0xb')][_0x5dc2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37ae21,_0x116bab,_0xa4f8a6){return new BPromise(function(_0x11c861,_0x3d111f){return client['request'](_0x37ae21,_0xa4f8a6)[_0x5dc2('0xd')](function(_0x4c9f63){logger[_0x5dc2('0xe')](_0x5dc2('0xf'),_0x116bab,_0x5dc2('0x10'));logger['debug'](_0x5dc2('0x11'),_0x116bab,_0x5dc2('0x10'),JSON['stringify'](_0x4c9f63));if(_0x4c9f63[_0x5dc2('0x12')]){if(_0x4c9f63[_0x5dc2('0x12')]['code']===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x116bab,_0x4c9f63[_0x5dc2('0x12')][_0x5dc2('0x13')]);return _0x3d111f(_0x4c9f63[_0x5dc2('0x12')][_0x5dc2('0x13')]);}logger[_0x5dc2('0x12')](_0x5dc2('0xf'),_0x116bab,_0x4c9f63['error'][_0x5dc2('0x13')]);return _0x11c861(_0x4c9f63['error'][_0x5dc2('0x13')]);}else{logger[_0x5dc2('0xe')](_0x5dc2('0xf'),_0x116bab,_0x5dc2('0x10'));_0x11c861(_0x4c9f63[_0x5dc2('0x14')][_0x5dc2('0x13')]);}})[_0x5dc2('0x15')](function(_0x137da2){logger['error'](_0x5dc2('0xf'),_0x116bab,_0x137da2);_0x3d111f(_0x137da2);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 0a5620e..68808ac 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 _0x55e1=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x55e1,0x98));var _0x155e=function(_0x14e5cd,_0x3d95ef){_0x14e5cd=_0x14e5cd-0x0;var _0x5c1094=_0x55e1[_0x14e5cd];return _0x5c1094;};'use strict';var multer=require(_0x155e('0x0'));var util=require('util');var path=require(_0x155e('0x1'));var timeout=require(_0x155e('0x2'));var express=require(_0x155e('0x3'));var router=express[_0x155e('0x4')]();var auth=require(_0x155e('0x5'));var interaction=require(_0x155e('0x6'));var config=require(_0x155e('0x7'));var controller=require(_0x155e('0x8'));router[_0x155e('0x9')]('/',auth[_0x155e('0xa')](),controller['index']);router[_0x155e('0x9')](_0x155e('0xb'),auth[_0x155e('0xa')](),controller[_0x155e('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x155e('0xd')]);router[_0x155e('0xe')](_0x155e('0xb'),auth[_0x155e('0xa')](),controller[_0x155e('0xf')]);router[_0x155e('0x10')](_0x155e('0xb'),auth['isAuthenticated'](),controller[_0x155e('0x11')]);module[_0x155e('0x12')]=router; \ No newline at end of file +var _0x0789=['../../components/interaction/service','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0789,0x11a));var _0x9078=function(_0x4b40ec,_0x22aac1){_0x4b40ec=_0x4b40ec-0x0;var _0x507971=_0x0789[_0x4b40ec];return _0x507971;};'use strict';var multer=require(_0x9078('0x0'));var util=require(_0x9078('0x1'));var path=require('path');var timeout=require(_0x9078('0x2'));var express=require(_0x9078('0x3'));var router=express[_0x9078('0x4')]();var auth=require(_0x9078('0x5'));var interaction=require(_0x9078('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x9078('0x7')]('/',auth[_0x9078('0x8')](),controller[_0x9078('0x9')]);router[_0x9078('0x7')]('/:id',auth[_0x9078('0x8')](),controller['show']);router[_0x9078('0xa')]('/',auth[_0x9078('0x8')](),controller[_0x9078('0xb')]);router[_0x9078('0xc')](_0x9078('0xd'),auth['isAuthenticated'](),controller[_0x9078('0xe')]);router[_0x9078('0xf')]('/:id',auth[_0x9078('0x8')](),controller[_0x9078('0x10')]);module[_0x9078('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 7c2785a..dee5f2d 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 _0xf8bb=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xf8bb,0xd6));var _0xbf8b=function(_0x4c5da8,_0x59bffa){_0x4c5da8=_0x4c5da8-0x0;var _0x1a8cef=_0xf8bb[_0x4c5da8];return _0x1a8cef;};'use strict';var Sequelize=require(_0xbf8b('0x0'));module[_0xbf8b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbf8b('0x2'),_0xbf8b('0x3'),_0xbf8b('0x4'),_0xbf8b('0x5')),'defaultValue':_0xbf8b('0x2')},'content':{'type':Sequelize[_0xbf8b('0x6')]},'key':{'type':Sequelize[_0xbf8b('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xbf8b('0x3'),_0xbf8b('0x4'))},'keyContent':{'type':Sequelize[_0xbf8b('0x6')]},'idField':{'type':Sequelize[_0xbf8b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbf8b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbf8b('0x6')]}}; \ No newline at end of file +var _0x7e07=['string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0x179e98,_0xdc217d){var _0x4f5e7e=function(_0x569e77){while(--_0x569e77){_0x179e98['push'](_0x179e98['shift']());}};_0x4f5e7e(++_0xdc217d);}(_0x7e07,0x8e));var _0x77e0=function(_0x196257,_0x35d5b9){_0x196257=_0x196257-0x0;var _0x3145c7=_0x7e07[_0x196257];return _0x3145c7;};'use strict';var Sequelize=require(_0x77e0('0x0'));module[_0x77e0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x77e0('0x2'),_0x77e0('0x3'),_0x77e0('0x4'),_0x77e0('0x5')),'defaultValue':_0x77e0('0x2')},'content':{'type':Sequelize[_0x77e0('0x6')]},'key':{'type':Sequelize[_0x77e0('0x6')]},'keyType':{'type':Sequelize[_0x77e0('0x7')]('string',_0x77e0('0x3'),_0x77e0('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x77e0('0x6')]},'customField':{'type':Sequelize[_0x77e0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x77e0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 7e24914..cbfb78b 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 _0xc1f6=['stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','then','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','destroy'];(function(_0x485888,_0x44d477){var _0x3e5f47=function(_0x3ed74a){while(--_0x3ed74a){_0x485888['push'](_0x485888['shift']());}};_0x3e5f47(++_0x44d477);}(_0xc1f6,0xb9));var _0x6c1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1f6[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x6c1f('0x0'));var emlformat=require(_0x6c1f('0x1'));var rimraf=require(_0x6c1f('0x2'));var zipdir=require(_0x6c1f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6c1f('0x4'));var BPromise=require(_0x6c1f('0x5'));var Mustache=require(_0x6c1f('0x6'));var util=require(_0x6c1f('0x7'));var path=require(_0x6c1f('0x8'));var sox=require(_0x6c1f('0x9'));var csv=require(_0x6c1f('0xa'));var ejs=require(_0x6c1f('0xb'));var fs=require('fs');var _=require(_0x6c1f('0xc'));var squel=require('squel');var crypto=require(_0x6c1f('0xd'));var jsforce=require(_0x6c1f('0xe'));var deskjs=require(_0x6c1f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6c1f('0x10'));var Papa=require('papaparse');var Redis=require(_0x6c1f('0x11'));var authService=require(_0x6c1f('0x12'));var qs=require(_0x6c1f('0x13'));var as=require(_0x6c1f('0x14'));var hardwareService=require(_0x6c1f('0x15'));var logger=require('../../config/logger')(_0x6c1f('0x16'));var utils=require(_0x6c1f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6c1f('0x18'));var db=require(_0x6c1f('0x19'))['db'];function respondWithStatusCode(_0xcaebd0,_0x1b4ccb){_0x1b4ccb=_0x1b4ccb||0xcc;return function(_0x16c80e){if(_0x16c80e){return _0xcaebd0[_0x6c1f('0x1a')](_0x1b4ccb);}return _0xcaebd0[_0x6c1f('0x1b')](_0x1b4ccb)['end']();};}function respondWithResult(_0x3ef74b,_0x4b1572){_0x4b1572=_0x4b1572||0xc8;return function(_0x446940){if(_0x446940){return _0x3ef74b[_0x6c1f('0x1b')](_0x4b1572)[_0x6c1f('0x1c')](_0x446940);}};}function respondWithFilteredResult(_0x2a2e0b,_0x1e7bd6){return function(_0x42e541){if(_0x42e541){var _0x4f0632=_0x42e541[_0x6c1f('0x1d')],_0x569bb5=_0x1e7bd6[_0x6c1f('0x1e')],_0x133836=_0x1e7bd6[_0x6c1f('0x1e')]+_0x1e7bd6[_0x6c1f('0x1f')],_0x315632;if(_0x133836>=_0x4f0632){_0x133836=_0x4f0632;_0x315632=0xc8;}else{_0x315632=0xce;}_0x2a2e0b['status'](_0x315632);return _0x2a2e0b[_0x6c1f('0x20')](_0x6c1f('0x21'),_0x569bb5+'-'+_0x133836+'/'+_0x4f0632)['json'](_0x42e541);}return null;};}function patchUpdates(_0x17b9bf){return function(_0x490a05){try{jsonpatch['apply'](_0x490a05,_0x17b9bf,!![]);}catch(_0x1e0a66){return BPromise[_0x6c1f('0x22')](_0x1e0a66);}return _0x490a05['save']();};}function saveUpdates(_0x2ee4d2,_0x8cd4ff){return function(_0x3b44e8){if(_0x3b44e8){return _0x3b44e8[_0x6c1f('0x23')](_0x2ee4d2)['then'](function(_0x409691){return _0x409691;});}return null;};}function removeEntity(_0x3ed5e1,_0x4d325a){return function(_0x223aa9){if(_0x223aa9){return _0x223aa9[_0x6c1f('0x24')]()['then'](function(){_0x3ed5e1[_0x6c1f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aabc8,_0x466f51){return function(_0x575f70){if(!_0x575f70){_0x4aabc8['sendStatus'](0x194);}return _0x575f70;};}function handleError(_0x748b70,_0x2d90dc){_0x2d90dc=_0x2d90dc||0x1f4;return function(_0xc485cc){logger['error'](_0xc485cc[_0x6c1f('0x25')]);if(_0xc485cc[_0x6c1f('0x26')]){delete _0xc485cc[_0x6c1f('0x26')];}_0x748b70[_0x6c1f('0x1b')](_0x2d90dc)[_0x6c1f('0x27')](_0xc485cc);};}exports[_0x6c1f('0x28')]=function(_0x107705,_0x4db9d4){var _0x2012ed={},_0x10e705={},_0x57a036={'count':0x0,'rows':[]};var _0x228273=_[_0x6c1f('0x29')](db[_0x6c1f('0x2a')][_0x6c1f('0x2b')],function(_0x56bc6e){return{'name':_0x56bc6e[_0x6c1f('0x2c')],'type':_0x56bc6e[_0x6c1f('0x2d')]['key']};});_0x10e705[_0x6c1f('0x2e')]=_[_0x6c1f('0x29')](_0x228273,'name');_0x10e705['query']=_[_0x6c1f('0x2f')](_0x107705[_0x6c1f('0x30')]);_0x10e705['filters']=_[_0x6c1f('0x31')](_0x10e705['model'],_0x10e705[_0x6c1f('0x30')]);_0x2012ed['attributes']=_['intersection'](_0x10e705[_0x6c1f('0x2e')],qs[_0x6c1f('0x32')](_0x107705['query'][_0x6c1f('0x32')]));_0x2012ed[_0x6c1f('0x33')]=_0x2012ed[_0x6c1f('0x33')][_0x6c1f('0x34')]?_0x2012ed[_0x6c1f('0x33')]:_0x10e705[_0x6c1f('0x2e')];if(!_0x107705[_0x6c1f('0x30')][_0x6c1f('0x35')](_0x6c1f('0x36'))){_0x2012ed[_0x6c1f('0x1f')]=qs[_0x6c1f('0x1f')](_0x107705['query'][_0x6c1f('0x1f')]);_0x2012ed[_0x6c1f('0x1e')]=qs[_0x6c1f('0x1e')](_0x107705[_0x6c1f('0x30')]['offset']);}_0x2012ed[_0x6c1f('0x37')]=qs[_0x6c1f('0x38')](_0x107705[_0x6c1f('0x30')][_0x6c1f('0x38')]);_0x2012ed[_0x6c1f('0x39')]=qs[_0x6c1f('0x3a')](_[_0x6c1f('0x3b')](_0x107705[_0x6c1f('0x30')],_0x10e705[_0x6c1f('0x3a')]),_0x228273);if(_0x107705['query'][_0x6c1f('0x3c')]){_0x2012ed[_0x6c1f('0x39')]=_[_0x6c1f('0x3d')](_0x2012ed['where'],{'$or':_[_0x6c1f('0x29')](_0x228273,function(_0xdc57f2){if(_0xdc57f2['type']!=='VIRTUAL'){var _0x56a238={};_0x56a238[_0xdc57f2[_0x6c1f('0x26')]]={'$like':'%'+_0x107705[_0x6c1f('0x30')]['filter']+'%'};return _0x56a238;}})});}_0x2012ed=_[_0x6c1f('0x3d')]({},_0x2012ed,_0x107705[_0x6c1f('0x3e')]);var _0x165dbf={'where':_0x2012ed[_0x6c1f('0x39')]};return db['FreshsalesField']['count'](_0x165dbf)['then'](function(_0x142dd7){_0x57a036[_0x6c1f('0x1d')]=_0x142dd7;if(_0x107705[_0x6c1f('0x30')][_0x6c1f('0x3f')]){_0x2012ed['include']=[{'all':!![]}];}return db[_0x6c1f('0x2a')][_0x6c1f('0x40')](_0x2012ed);})['then'](function(_0x1f17ed){_0x57a036[_0x6c1f('0x41')]=_0x1f17ed;return _0x57a036;})[_0x6c1f('0x42')](respondWithFilteredResult(_0x4db9d4,_0x2012ed))[_0x6c1f('0x43')](handleError(_0x4db9d4,null));};exports[_0x6c1f('0x44')]=function(_0x55e5e4,_0x4f2f1d){var _0x2284b3={'raw':!![],'where':{'id':_0x55e5e4[_0x6c1f('0x45')]['id']}},_0x34b7b6={};_0x34b7b6[_0x6c1f('0x2e')]=_['keys'](db[_0x6c1f('0x2a')][_0x6c1f('0x2b')]);_0x34b7b6[_0x6c1f('0x30')]=_[_0x6c1f('0x2f')](_0x55e5e4[_0x6c1f('0x30')]);_0x34b7b6['filters']=_[_0x6c1f('0x31')](_0x34b7b6[_0x6c1f('0x2e')],_0x34b7b6[_0x6c1f('0x30')]);_0x2284b3[_0x6c1f('0x33')]=_[_0x6c1f('0x31')](_0x34b7b6[_0x6c1f('0x2e')],qs[_0x6c1f('0x32')](_0x55e5e4[_0x6c1f('0x30')][_0x6c1f('0x32')]));_0x2284b3[_0x6c1f('0x33')]=_0x2284b3[_0x6c1f('0x33')][_0x6c1f('0x34')]?_0x2284b3[_0x6c1f('0x33')]:_0x34b7b6[_0x6c1f('0x2e')];if(_0x55e5e4[_0x6c1f('0x30')][_0x6c1f('0x3f')]){_0x2284b3[_0x6c1f('0x46')]=[{'all':!![]}];}_0x2284b3=_[_0x6c1f('0x3d')]({},_0x2284b3,_0x55e5e4[_0x6c1f('0x3e')]);return db[_0x6c1f('0x2a')][_0x6c1f('0x47')](_0x2284b3)[_0x6c1f('0x42')](handleEntityNotFound(_0x4f2f1d,null))[_0x6c1f('0x42')](respondWithResult(_0x4f2f1d,null))['catch'](handleError(_0x4f2f1d,null));};exports[_0x6c1f('0x48')]=function(_0x1ae324,_0x9d206c){return db['FreshsalesField'][_0x6c1f('0x48')](_0x1ae324[_0x6c1f('0x49')],{})[_0x6c1f('0x42')](respondWithResult(_0x9d206c,0xc9))[_0x6c1f('0x43')](handleError(_0x9d206c,null));};exports[_0x6c1f('0x23')]=function(_0x23882c,_0x2c161e){if(_0x23882c[_0x6c1f('0x49')]['id']){delete _0x23882c['body']['id'];}return db['FreshsalesField'][_0x6c1f('0x47')]({'where':{'id':_0x23882c[_0x6c1f('0x45')]['id']}})[_0x6c1f('0x42')](handleEntityNotFound(_0x2c161e,null))[_0x6c1f('0x42')](saveUpdates(_0x23882c['body'],null))['then'](respondWithResult(_0x2c161e,null))[_0x6c1f('0x43')](handleError(_0x2c161e,null));};exports['destroy']=function(_0x13a6e5,_0x245877){return db[_0x6c1f('0x2a')][_0x6c1f('0x47')]({'where':{'id':_0x13a6e5[_0x6c1f('0x45')]['id']}})[_0x6c1f('0x42')](handleEntityNotFound(_0x245877,null))[_0x6c1f('0x42')](removeEntity(_0x245877,null))[_0x6c1f('0x43')](handleError(_0x245877,null));}; \ No newline at end of file +var _0x3f88=['rawAttributes','key','model','query','keys','filters','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','FreshsalesField'];(function(_0x2b370b,_0x15e83c){var _0xd36ba0=function(_0x206b47){while(--_0x206b47){_0x2b370b['push'](_0x2b370b['shift']());}};_0xd36ba0(++_0x15e83c);}(_0x3f88,0x13d));var _0x83f8=function(_0x469fd0,_0x43c3ce){_0x469fd0=_0x469fd0-0x0;var _0x1961ed=_0x3f88[_0x469fd0];return _0x1961ed;};'use strict';var pdf=require(_0x83f8('0x0'));var emlformat=require(_0x83f8('0x1'));var rimraf=require(_0x83f8('0x2'));var zipdir=require(_0x83f8('0x3'));var jsonpatch=require(_0x83f8('0x4'));var rp=require(_0x83f8('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x83f8('0x6'));var path=require(_0x83f8('0x7'));var sox=require(_0x83f8('0x8'));var csv=require(_0x83f8('0x9'));var ejs=require(_0x83f8('0xa'));var fs=require('fs');var _=require(_0x83f8('0xb'));var squel=require(_0x83f8('0xc'));var crypto=require('crypto');var jsforce=require(_0x83f8('0xd'));var deskjs=require(_0x83f8('0xe'));var toCsv=require(_0x83f8('0x9'));var querystring=require(_0x83f8('0xf'));var Papa=require('papaparse');var Redis=require(_0x83f8('0x10'));var authService=require(_0x83f8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x83f8('0x12'));var hardwareService=require(_0x83f8('0x13'));var logger=require('../../config/logger')(_0x83f8('0x14'));var utils=require(_0x83f8('0x15'));var config=require(_0x83f8('0x16'));var licenseUtil=require(_0x83f8('0x17'));var db=require(_0x83f8('0x18'))['db'];function respondWithStatusCode(_0x34f739,_0x56c48d){_0x56c48d=_0x56c48d||0xcc;return function(_0x2bfd11){if(_0x2bfd11){return _0x34f739[_0x83f8('0x19')](_0x56c48d);}return _0x34f739[_0x83f8('0x1a')](_0x56c48d)['end']();};}function respondWithResult(_0x213d6f,_0x3ad96f){_0x3ad96f=_0x3ad96f||0xc8;return function(_0x3ec206){if(_0x3ec206){return _0x213d6f[_0x83f8('0x1a')](_0x3ad96f)[_0x83f8('0x1b')](_0x3ec206);}};}function respondWithFilteredResult(_0x426597,_0x24f959){return function(_0x2cc6fa){if(_0x2cc6fa){var _0x49a193=_0x2cc6fa['count'],_0x3433bc=_0x24f959['offset'],_0x3ea02f=_0x24f959[_0x83f8('0x1c')]+_0x24f959['limit'],_0x419225;if(_0x3ea02f>=_0x49a193){_0x3ea02f=_0x49a193;_0x419225=0xc8;}else{_0x419225=0xce;}_0x426597[_0x83f8('0x1a')](_0x419225);return _0x426597['set'](_0x83f8('0x1d'),_0x3433bc+'-'+_0x3ea02f+'/'+_0x49a193)[_0x83f8('0x1b')](_0x2cc6fa);}return null;};}function patchUpdates(_0x37922b){return function(_0x39bb6e){try{jsonpatch[_0x83f8('0x1e')](_0x39bb6e,_0x37922b,!![]);}catch(_0x5ee150){return BPromise[_0x83f8('0x1f')](_0x5ee150);}return _0x39bb6e[_0x83f8('0x20')]();};}function saveUpdates(_0x29f69b,_0x5daa6a){return function(_0x1c27b8){if(_0x1c27b8){return _0x1c27b8[_0x83f8('0x21')](_0x29f69b)[_0x83f8('0x22')](function(_0x90c2a6){return _0x90c2a6;});}return null;};}function removeEntity(_0x22c955,_0x97698c){return function(_0x50c709){if(_0x50c709){return _0x50c709['destroy']()[_0x83f8('0x22')](function(){_0x22c955['status'](0xcc)[_0x83f8('0x23')]();});}};}function handleEntityNotFound(_0x26241a,_0x1c1f6a){return function(_0x3613bd){if(!_0x3613bd){_0x26241a[_0x83f8('0x19')](0x194);}return _0x3613bd;};}function handleError(_0x11e1a9,_0x12c8e1){_0x12c8e1=_0x12c8e1||0x1f4;return function(_0x5da7b5){logger[_0x83f8('0x24')](_0x5da7b5[_0x83f8('0x25')]);if(_0x5da7b5['name']){delete _0x5da7b5[_0x83f8('0x26')];}_0x11e1a9[_0x83f8('0x1a')](_0x12c8e1)[_0x83f8('0x27')](_0x5da7b5);};}exports[_0x83f8('0x28')]=function(_0x48601b,_0x44de99){var _0x4f4c42={},_0x127218={},_0x3946db={'count':0x0,'rows':[]};var _0x18f493=_[_0x83f8('0x29')](db[_0x83f8('0x2a')][_0x83f8('0x2b')],function(_0x5bfafb){return{'name':_0x5bfafb['fieldName'],'type':_0x5bfafb['type'][_0x83f8('0x2c')]};});_0x127218[_0x83f8('0x2d')]=_[_0x83f8('0x29')](_0x18f493,_0x83f8('0x26'));_0x127218[_0x83f8('0x2e')]=_[_0x83f8('0x2f')](_0x48601b[_0x83f8('0x2e')]);_0x127218[_0x83f8('0x30')]=_['intersection'](_0x127218[_0x83f8('0x2d')],_0x127218['query']);_0x4f4c42[_0x83f8('0x31')]=_['intersection'](_0x127218[_0x83f8('0x2d')],qs[_0x83f8('0x32')](_0x48601b[_0x83f8('0x2e')][_0x83f8('0x32')]));_0x4f4c42[_0x83f8('0x31')]=_0x4f4c42['attributes']['length']?_0x4f4c42['attributes']:_0x127218['model'];if(!_0x48601b[_0x83f8('0x2e')][_0x83f8('0x33')]('nolimit')){_0x4f4c42[_0x83f8('0x34')]=qs['limit'](_0x48601b[_0x83f8('0x2e')][_0x83f8('0x34')]);_0x4f4c42[_0x83f8('0x1c')]=qs[_0x83f8('0x1c')](_0x48601b[_0x83f8('0x2e')][_0x83f8('0x1c')]);}_0x4f4c42[_0x83f8('0x35')]=qs[_0x83f8('0x36')](_0x48601b[_0x83f8('0x2e')][_0x83f8('0x36')]);_0x4f4c42[_0x83f8('0x37')]=qs[_0x83f8('0x30')](_[_0x83f8('0x38')](_0x48601b['query'],_0x127218[_0x83f8('0x30')]),_0x18f493);if(_0x48601b[_0x83f8('0x2e')][_0x83f8('0x39')]){_0x4f4c42[_0x83f8('0x37')]=_[_0x83f8('0x3a')](_0x4f4c42[_0x83f8('0x37')],{'$or':_[_0x83f8('0x29')](_0x18f493,function(_0x5b9698){if(_0x5b9698[_0x83f8('0x3b')]!=='VIRTUAL'){var _0x42feec={};_0x42feec[_0x5b9698[_0x83f8('0x26')]]={'$like':'%'+_0x48601b[_0x83f8('0x2e')][_0x83f8('0x39')]+'%'};return _0x42feec;}})});}_0x4f4c42=_[_0x83f8('0x3a')]({},_0x4f4c42,_0x48601b[_0x83f8('0x3c')]);var _0x3ff33d={'where':_0x4f4c42[_0x83f8('0x37')]};return db[_0x83f8('0x2a')]['count'](_0x3ff33d)['then'](function(_0x191747){_0x3946db[_0x83f8('0x3d')]=_0x191747;if(_0x48601b['query'][_0x83f8('0x3e')]){_0x4f4c42[_0x83f8('0x3f')]=[{'all':!![]}];}return db['FreshsalesField'][_0x83f8('0x40')](_0x4f4c42);})['then'](function(_0x4f4f08){_0x3946db[_0x83f8('0x41')]=_0x4f4f08;return _0x3946db;})[_0x83f8('0x22')](respondWithFilteredResult(_0x44de99,_0x4f4c42))[_0x83f8('0x42')](handleError(_0x44de99,null));};exports['show']=function(_0x157971,_0x3b8f98){var _0x4810f3={'raw':!![],'where':{'id':_0x157971[_0x83f8('0x43')]['id']}},_0x240c53={};_0x240c53[_0x83f8('0x2d')]=_[_0x83f8('0x2f')](db['FreshsalesField'][_0x83f8('0x2b')]);_0x240c53['query']=_[_0x83f8('0x2f')](_0x157971[_0x83f8('0x2e')]);_0x240c53[_0x83f8('0x30')]=_[_0x83f8('0x44')](_0x240c53[_0x83f8('0x2d')],_0x240c53[_0x83f8('0x2e')]);_0x4810f3['attributes']=_[_0x83f8('0x44')](_0x240c53[_0x83f8('0x2d')],qs[_0x83f8('0x32')](_0x157971['query'][_0x83f8('0x32')]));_0x4810f3[_0x83f8('0x31')]=_0x4810f3[_0x83f8('0x31')]['length']?_0x4810f3[_0x83f8('0x31')]:_0x240c53[_0x83f8('0x2d')];if(_0x157971[_0x83f8('0x2e')][_0x83f8('0x3e')]){_0x4810f3[_0x83f8('0x3f')]=[{'all':!![]}];}_0x4810f3=_[_0x83f8('0x3a')]({},_0x4810f3,_0x157971[_0x83f8('0x3c')]);return db[_0x83f8('0x2a')][_0x83f8('0x45')](_0x4810f3)[_0x83f8('0x22')](handleEntityNotFound(_0x3b8f98,null))['then'](respondWithResult(_0x3b8f98,null))[_0x83f8('0x42')](handleError(_0x3b8f98,null));};exports[_0x83f8('0x46')]=function(_0x46f52d,_0x10cbd9){return db['FreshsalesField']['create'](_0x46f52d[_0x83f8('0x47')],{})[_0x83f8('0x22')](respondWithResult(_0x10cbd9,0xc9))[_0x83f8('0x42')](handleError(_0x10cbd9,null));};exports['update']=function(_0x278bc7,_0x588e48){if(_0x278bc7[_0x83f8('0x47')]['id']){delete _0x278bc7[_0x83f8('0x47')]['id'];}return db[_0x83f8('0x2a')][_0x83f8('0x45')]({'where':{'id':_0x278bc7[_0x83f8('0x43')]['id']}})[_0x83f8('0x22')](handleEntityNotFound(_0x588e48,null))[_0x83f8('0x22')](saveUpdates(_0x278bc7[_0x83f8('0x47')],null))[_0x83f8('0x22')](respondWithResult(_0x588e48,null))['catch'](handleError(_0x588e48,null));};exports['destroy']=function(_0x4ea5a0,_0x529340){return db[_0x83f8('0x2a')][_0x83f8('0x45')]({'where':{'id':_0x4ea5a0[_0x83f8('0x43')]['id']}})['then'](handleEntityNotFound(_0x529340,null))[_0x83f8('0x22')](removeEntity(_0x529340,null))[_0x83f8('0x42')](handleError(_0x529340,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 0334639..6cb7d32 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 _0x4fe5=['../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1284bb,_0x527c1b){var _0x360e82=function(_0x37a6b4){while(--_0x37a6b4){_0x1284bb['push'](_0x1284bb['shift']());}};_0x360e82(++_0x527c1b);}(_0x4fe5,0x1e8));var _0x54fe=function(_0x2171c3,_0x268912){_0x2171c3=_0x2171c3-0x0;var _0x4f3768=_0x4fe5[_0x2171c3];return _0x4f3768;};'use strict';var _=require(_0x54fe('0x0'));var util=require(_0x54fe('0x1'));var logger=require(_0x54fe('0x2'))(_0x54fe('0x3'));var moment=require(_0x54fe('0x4'));var BPromise=require(_0x54fe('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x54fe('0x6'));var attributes=require(_0x54fe('0x7'));module[_0x54fe('0x8')]=function(_0x20762e,_0x14699d){return _0x20762e['define'](_0x54fe('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x54fe('0xa'),'fields':[_0x54fe('0xb'),_0x54fe('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b2d=['request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0x7b2d,0x1d7));var _0xd7b2=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7b2d[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0xd7b2('0x0'));var logger=require(_0xd7b2('0x1'))(_0xd7b2('0x2'));var moment=require(_0xd7b2('0x3'));var BPromise=require(_0xd7b2('0x4'));var rp=require(_0xd7b2('0x5'));var fs=require('fs');var path=require(_0xd7b2('0x6'));var rimraf=require(_0xd7b2('0x7'));var config=require(_0xd7b2('0x8'));var attributes=require(_0xd7b2('0x9'));module[_0xd7b2('0xa')]=function(_0x14f8a8,_0x5bb857){return _0x14f8a8[_0xd7b2('0xb')](_0xd7b2('0xc'),attributes,{'tableName':_0xd7b2('0xd'),'paranoid':![],'indexes':[{'name':_0xd7b2('0xe'),'fields':[_0xd7b2('0xf'),_0xd7b2('0x10')],'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 95e0d79..c7c9dfe 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 _0x956b=['jayson/promise','http','request','then','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x463b9a,_0x2a9eba){var _0x5f5186=function(_0xb1f6cc){while(--_0xb1f6cc){_0x463b9a['push'](_0x463b9a['shift']());}};_0x5f5186(++_0x2a9eba);}(_0x956b,0x16e));var _0xb956=function(_0x196d97,_0x92282d){_0x196d97=_0x196d97-0x0;var _0x3110f3=_0x956b[_0x196d97];return _0x3110f3;};'use strict';var _=require(_0xb956('0x0'));var util=require(_0xb956('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb956('0x2'));var fs=require('fs');var Redis=require(_0xb956('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb956('0x4'));var logger=require(_0xb956('0x5'))(_0xb956('0x6'));var config=require(_0xb956('0x7'));var jayson=require(_0xb956('0x8'));var client=jayson['client'][_0xb956('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26eedd,_0x37f7b7,_0x335d9f){return new BPromise(function(_0x11e653,_0x240541){return client[_0xb956('0xa')](_0x26eedd,_0x335d9f)[_0xb956('0xb')](function(_0x590c37){logger[_0xb956('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x37f7b7,_0xb956('0xd'));logger[_0xb956('0xe')](_0xb956('0xf'),_0x37f7b7,_0xb956('0xd'),JSON[_0xb956('0x10')](_0x590c37));if(_0x590c37[_0xb956('0x11')]){if(_0x590c37['error']['code']===0x1f4){logger[_0xb956('0x11')](_0xb956('0x12'),_0x37f7b7,_0x590c37[_0xb956('0x11')][_0xb956('0x13')]);return _0x240541(_0x590c37[_0xb956('0x11')][_0xb956('0x13')]);}logger[_0xb956('0x11')](_0xb956('0x12'),_0x37f7b7,_0x590c37['error']['message']);return _0x11e653(_0x590c37['error'][_0xb956('0x13')]);}else{logger['info'](_0xb956('0x12'),_0x37f7b7,'request\x20sent');_0x11e653(_0x590c37[_0xb956('0x14')]['message']);}})[_0xb956('0x15')](function(_0xc09054){logger[_0xb956('0x11')](_0xb956('0x12'),_0x37f7b7,_0xc09054);_0x240541(_0xc09054);});});} \ No newline at end of file +var _0x0ea7=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x1d8cc3,_0xad5bed){var _0x20f0e4=function(_0x20e13b){while(--_0x20e13b){_0x1d8cc3['push'](_0x1d8cc3['shift']());}};_0x20f0e4(++_0xad5bed);}(_0x0ea7,0x8b));var _0x70ea=function(_0x3bd123,_0x2d69f4){_0x3bd123=_0x3bd123-0x0;var _0xbdf7ab=_0x0ea7[_0x3bd123];return _0xbdf7ab;};'use strict';var _=require(_0x70ea('0x0'));var util=require(_0x70ea('0x1'));var moment=require('moment');var BPromise=require(_0x70ea('0x2'));var rs=require(_0x70ea('0x3'));var fs=require('fs');var Redis=require(_0x70ea('0x4'));var db=require(_0x70ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x70ea('0x6'))(_0x70ea('0x7'));var config=require(_0x70ea('0x8'));var jayson=require(_0x70ea('0x9'));var client=jayson[_0x70ea('0xa')][_0x70ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x151759,_0x272046,_0x2f17a5){return new BPromise(function(_0x39688d,_0x41ac94){return client[_0x70ea('0xc')](_0x151759,_0x2f17a5)[_0x70ea('0xd')](function(_0x781f29){logger['info'](_0x70ea('0xe'),_0x272046,_0x70ea('0xf'));logger[_0x70ea('0x10')](_0x70ea('0x11'),_0x272046,'request\x20sent',JSON[_0x70ea('0x12')](_0x781f29));if(_0x781f29[_0x70ea('0x13')]){if(_0x781f29[_0x70ea('0x13')]['code']===0x1f4){logger['error'](_0x70ea('0xe'),_0x272046,_0x781f29['error'][_0x70ea('0x14')]);return _0x41ac94(_0x781f29['error'][_0x70ea('0x14')]);}logger[_0x70ea('0x13')](_0x70ea('0xe'),_0x272046,_0x781f29['error'][_0x70ea('0x14')]);return _0x39688d(_0x781f29[_0x70ea('0x13')][_0x70ea('0x14')]);}else{logger[_0x70ea('0x15')]('FreshsalesField,\x20%s,\x20%s',_0x272046,_0x70ea('0xf'));_0x39688d(_0x781f29[_0x70ea('0x16')][_0x70ea('0x14')]);}})['catch'](function(_0x23149b){logger['error'](_0x70ea('0xe'),_0x272046,_0x23149b);_0x41ac94(_0x23149b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f163694..5f17abc 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 _0x9db9=['/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x253843,_0x33c012){var _0xe2b5ef=function(_0x39c4cb){while(--_0x39c4cb){_0x253843['push'](_0x253843['shift']());}};_0xe2b5ef(++_0x33c012);}(_0x9db9,0xf2));var _0x99db=function(_0x36166f,_0x234c8c){_0x36166f=_0x36166f-0x0;var _0x3f40ee=_0x9db9[_0x36166f];return _0x3f40ee;};'use strict';var multer=require(_0x99db('0x0'));var util=require('util');var path=require(_0x99db('0x1'));var timeout=require(_0x99db('0x2'));var express=require(_0x99db('0x3'));var router=express[_0x99db('0x4')]();var auth=require(_0x99db('0x5'));var interaction=require(_0x99db('0x6'));var config=require(_0x99db('0x7'));var controller=require('./intSalesforceAccount.controller');router[_0x99db('0x8')]('/',auth[_0x99db('0x9')](),controller[_0x99db('0xa')]);router['get'](_0x99db('0xb'),auth['isAuthenticated'](),controller[_0x99db('0xc')]);router['get'](_0x99db('0xd'),auth[_0x99db('0x9')](),controller[_0x99db('0xe')]);router[_0x99db('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x99db('0xf')]);router[_0x99db('0x10')]('/',auth['isAuthenticated'](),controller[_0x99db('0x11')]);router[_0x99db('0x10')]('/:id/configurations',auth[_0x99db('0x9')](),controller[_0x99db('0x12')]);router[_0x99db('0x13')](_0x99db('0xb'),auth['isAuthenticated'](),controller[_0x99db('0x14')]);router['delete'](_0x99db('0xb'),auth[_0x99db('0x9')](),controller[_0x99db('0x15')]);module[_0x99db('0x16')]=router; \ No newline at end of file +var _0x8a66=['delete','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','/:id','/:id/fields','post','create','addConfiguration','put'];(function(_0x1564f6,_0x284cb9){var _0x4cf39e=function(_0x2805b0){while(--_0x2805b0){_0x1564f6['push'](_0x1564f6['shift']());}};_0x4cf39e(++_0x284cb9);}(_0x8a66,0x1dd));var _0x68a6=function(_0x130209,_0x2cc129){_0x130209=_0x130209-0x0;var _0x155fb7=_0x8a66[_0x130209];return _0x155fb7;};'use strict';var multer=require('multer');var util=require(_0x68a6('0x0'));var path=require(_0x68a6('0x1'));var timeout=require('connect-timeout');var express=require(_0x68a6('0x2'));var router=express[_0x68a6('0x3')]();var auth=require(_0x68a6('0x4'));var interaction=require(_0x68a6('0x5'));var config=require(_0x68a6('0x6'));var controller=require(_0x68a6('0x7'));router[_0x68a6('0x8')]('/',auth[_0x68a6('0x9')](),controller['index']);router[_0x68a6('0x8')](_0x68a6('0xa'),auth[_0x68a6('0x9')](),controller['show']);router['get']('/:id/configurations',auth[_0x68a6('0x9')](),controller['getConfigurations']);router[_0x68a6('0x8')](_0x68a6('0xb'),auth[_0x68a6('0x9')](),controller['getFields']);router[_0x68a6('0xc')]('/',auth[_0x68a6('0x9')](),controller[_0x68a6('0xd')]);router['post']('/:id/configurations',auth[_0x68a6('0x9')](),controller[_0x68a6('0xe')]);router[_0x68a6('0xf')](_0x68a6('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x68a6('0x10')](_0x68a6('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 03c5b71..8d24d1b 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 _0x4955=['sequelize','exports','STRING','ENUM','integrationTab','newTab'];(function(_0x4b6420,_0x126201){var _0x37076f=function(_0x3ee471){while(--_0x3ee471){_0x4b6420['push'](_0x4b6420['shift']());}};_0x37076f(++_0x126201);}(_0x4955,0x120));var _0x5495=function(_0x3e81b2,_0x3acc94){_0x3e81b2=_0x3e81b2-0x0;var _0x168b6f=_0x4955[_0x3e81b2];return _0x168b6f;};'use strict';var Sequelize=require(_0x5495('0x0'));module[_0x5495('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5495('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0x5495('0x2')]},'password':{'type':Sequelize[_0x5495('0x2')]},'clientId':{'type':Sequelize[_0x5495('0x2')]},'clientSecret':{'type':Sequelize[_0x5495('0x2')]},'securityToken':{'type':Sequelize[_0x5495('0x2')]},'serverUrl':{'type':Sequelize[_0x5495('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5495('0x3')](_0x5495('0x4'),_0x5495('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xa57c=['username','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa57c,0x15a));var _0xca57=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xa57c[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0xca57('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xca57('0x1')]},'username':{'type':Sequelize[_0xca57('0x1')],'unique':_0xca57('0x2')},'remoteUri':{'type':Sequelize[_0xca57('0x1')]},'password':{'type':Sequelize[_0xca57('0x1')]},'clientId':{'type':Sequelize[_0xca57('0x1')]},'clientSecret':{'type':Sequelize[_0xca57('0x1')]},'securityToken':{'type':Sequelize[_0xca57('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xca57('0x3')](_0xca57('0x4'),_0xca57('0x5')),'defaultValue':_0xca57('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 3c257f1..bdcec54 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 _0x758c=['send','index','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','options','SalesforceAccount','count','includeAll','include','catch','params','rawAttributes','find','create','body','getConfigurations','SalesforceConfiguration','sort','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','securityToken','substring','lastIndexOf','Connection','password','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','int','picklist','boolean','email','phone','remove','includes','label','custom','picklistValues','value','True','true','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','debug','stringify','error','message','result','sendStatus','status','end','offset','limit','Content-Range','json','apply','save','update','stack','name'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0x758c,0xd2));var _0xc758=function(_0x37f84f,_0x1060d2){_0x37f84f=_0x37f84f-0x0;var _0xf436e9=_0x758c[_0x37f84f];return _0xf436e9;};'use strict';var pdf=require(_0xc758('0x0'));var emlformat=require(_0xc758('0x1'));var rimraf=require(_0xc758('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc758('0x3'));var moment=require('moment');var BPromise=require(_0xc758('0x4'));var Mustache=require('mustache');var util=require(_0xc758('0x5'));var path=require(_0xc758('0x6'));var sox=require(_0xc758('0x7'));var csv=require('to-csv');var ejs=require(_0xc758('0x8'));var fs=require('fs');var _=require(_0xc758('0x9'));var squel=require(_0xc758('0xa'));var crypto=require(_0xc758('0xb'));var jsforce=require(_0xc758('0xc'));var deskjs=require(_0xc758('0xd'));var toCsv=require(_0xc758('0xe'));var querystring=require(_0xc758('0xf'));var Papa=require(_0xc758('0x10'));var Redis=require('ioredis');var authService=require(_0xc758('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc758('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc758('0x13'));var utils=require(_0xc758('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc758('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc758('0x16'));var jayson=require(_0xc758('0x17'));var client=jayson[_0xc758('0x18')][_0xc758('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4ce115,_0x18acad,_0x2a0d02,_0x120f18){return new BPromise(function(_0x433a70,_0x24b29b){var _0x28870b=_0x120f18||client;return _0x28870b['request'](_0x4ce115,_0x2a0d02)[_0xc758('0x1a')](function(_0x410835){logger[_0xc758('0x1b')](_0xc758('0x1c'),_0x18acad,'request\x20sent');logger[_0xc758('0x1d')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x18acad,'request\x20sent',JSON[_0xc758('0x1e')](_0x410835));if(_0x410835[_0xc758('0x1f')]){if(_0x410835[_0xc758('0x1f')]['code']===0x1f4){logger['error'](_0xc758('0x1c'),_0x18acad,_0x410835[_0xc758('0x1f')][_0xc758('0x20')]);return _0x24b29b(_0x410835[_0xc758('0x1f')]['message']);}logger[_0xc758('0x1f')](_0xc758('0x1c'),_0x18acad,_0x410835[_0xc758('0x1f')][_0xc758('0x20')]);return _0x433a70(_0x410835['error'][_0xc758('0x20')]);}else{logger['info'](_0xc758('0x1c'),_0x18acad,'request\x20sent');_0x433a70(_0x410835[_0xc758('0x21')][_0xc758('0x20')]);}})['catch'](function(_0x28a755){logger[_0xc758('0x1f')](_0xc758('0x1c'),_0x18acad,_0x28a755);_0x24b29b(_0x28a755);});});}function respondWithStatusCode(_0x3f2c81,_0x27bb73){_0x27bb73=_0x27bb73||0xcc;return function(_0x47ac2e){if(_0x47ac2e){return _0x3f2c81[_0xc758('0x22')](_0x27bb73);}return _0x3f2c81[_0xc758('0x23')](_0x27bb73)[_0xc758('0x24')]();};}function respondWithResult(_0x197888,_0x314a8b){_0x314a8b=_0x314a8b||0xc8;return function(_0x393b40){if(_0x393b40){return _0x197888[_0xc758('0x23')](_0x314a8b)['json'](_0x393b40);}};}function respondWithFilteredResult(_0x4f2460,_0x28c5ed){return function(_0x1b2b97){if(_0x1b2b97){var _0x283b7e=_0x1b2b97['count'],_0x54d09b=_0x28c5ed[_0xc758('0x25')],_0x4b6d0a=_0x28c5ed['offset']+_0x28c5ed[_0xc758('0x26')],_0x2c8942;if(_0x4b6d0a>=_0x283b7e){_0x4b6d0a=_0x283b7e;_0x2c8942=0xc8;}else{_0x2c8942=0xce;}_0x4f2460['status'](_0x2c8942);return _0x4f2460['set'](_0xc758('0x27'),_0x54d09b+'-'+_0x4b6d0a+'/'+_0x283b7e)[_0xc758('0x28')](_0x1b2b97);}return null;};}function patchUpdates(_0x104d25){return function(_0x18c9b9){try{jsonpatch[_0xc758('0x29')](_0x18c9b9,_0x104d25,!![]);}catch(_0x4785cc){return BPromise['reject'](_0x4785cc);}return _0x18c9b9[_0xc758('0x2a')]();};}function saveUpdates(_0x5231c3,_0x4402c3){return function(_0x5c6b69){if(_0x5c6b69){return _0x5c6b69[_0xc758('0x2b')](_0x5231c3)['then'](function(_0x466355){return _0x466355;});}return null;};}function removeEntity(_0x411aba,_0x31f304){return function(_0xde52cd){if(_0xde52cd){return _0xde52cd['destroy']()[_0xc758('0x1a')](function(){_0x411aba[_0xc758('0x23')](0xcc)[_0xc758('0x24')]();});}};}function handleEntityNotFound(_0x2b0d4d,_0x51ef45){return function(_0x1a4195){if(!_0x1a4195){_0x2b0d4d[_0xc758('0x22')](0x194);}return _0x1a4195;};}function handleError(_0x3b113c,_0x442659){_0x442659=_0x442659||0x1f4;return function(_0x3fae24){logger[_0xc758('0x1f')](_0x3fae24[_0xc758('0x2c')]);if(_0x3fae24[_0xc758('0x2d')]){delete _0x3fae24['name'];}_0x3b113c['status'](_0x442659)[_0xc758('0x2e')](_0x3fae24);};}exports[_0xc758('0x2f')]=function(_0xf9c174,_0x42689d){var _0x3b64e6={},_0x509fa5={},_0x3fbfce={'count':0x0,'rows':[]};var _0xcc0cfc=_['map'](db['SalesforceAccount']['rawAttributes'],function(_0x361093){return{'name':_0x361093[_0xc758('0x30')],'type':_0x361093['type']['key']};});_0x509fa5[_0xc758('0x31')]=_[_0xc758('0x32')](_0xcc0cfc,_0xc758('0x2d'));_0x509fa5[_0xc758('0x33')]=_[_0xc758('0x34')](_0xf9c174[_0xc758('0x33')]);_0x509fa5['filters']=_[_0xc758('0x35')](_0x509fa5['model'],_0x509fa5[_0xc758('0x33')]);_0x3b64e6[_0xc758('0x36')]=_['intersection'](_0x509fa5['model'],qs[_0xc758('0x37')](_0xf9c174[_0xc758('0x33')][_0xc758('0x37')]));_0x3b64e6[_0xc758('0x36')]=_0x3b64e6['attributes'][_0xc758('0x38')]?_0x3b64e6[_0xc758('0x36')]:_0x509fa5['model'];if(!_0xf9c174[_0xc758('0x33')][_0xc758('0x39')](_0xc758('0x3a'))){_0x3b64e6[_0xc758('0x26')]=qs['limit'](_0xf9c174[_0xc758('0x33')]['limit']);_0x3b64e6['offset']=qs[_0xc758('0x25')](_0xf9c174[_0xc758('0x33')][_0xc758('0x25')]);}_0x3b64e6[_0xc758('0x3b')]=qs['sort'](_0xf9c174['query']['sort']);_0x3b64e6[_0xc758('0x3c')]=qs[_0xc758('0x3d')](_[_0xc758('0x3e')](_0xf9c174[_0xc758('0x33')],_0x509fa5[_0xc758('0x3d')]),_0xcc0cfc);if(_0xf9c174[_0xc758('0x33')][_0xc758('0x3f')]){_0x3b64e6[_0xc758('0x3c')]=_[_0xc758('0x40')](_0x3b64e6[_0xc758('0x3c')],{'$or':_[_0xc758('0x32')](_0xcc0cfc,function(_0x509121){if(_0x509121[_0xc758('0x41')]!==_0xc758('0x42')){var _0x16cc7f={};_0x16cc7f[_0x509121['name']]={'$like':'%'+_0xf9c174['query'][_0xc758('0x3f')]+'%'};return _0x16cc7f;}})});}_0x3b64e6=_[_0xc758('0x40')]({},_0x3b64e6,_0xf9c174[_0xc758('0x43')]);var _0x3c2534={'where':_0x3b64e6['where']};return db[_0xc758('0x44')][_0xc758('0x45')](_0x3c2534)[_0xc758('0x1a')](function(_0x407873){_0x3fbfce[_0xc758('0x45')]=_0x407873;if(_0xf9c174[_0xc758('0x33')][_0xc758('0x46')]){_0x3b64e6[_0xc758('0x47')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x3b64e6);})['then'](function(_0x337c88){_0x3fbfce['rows']=_0x337c88;return _0x3fbfce;})[_0xc758('0x1a')](respondWithFilteredResult(_0x42689d,_0x3b64e6))[_0xc758('0x48')](handleError(_0x42689d,null));};exports['show']=function(_0xe6c52b,_0x5c9952){var _0x1ee174={'raw':![],'where':{'id':_0xe6c52b[_0xc758('0x49')]['id']}},_0x149f29={};_0x149f29[_0xc758('0x31')]=_[_0xc758('0x34')](db[_0xc758('0x44')][_0xc758('0x4a')]);_0x149f29[_0xc758('0x33')]=_[_0xc758('0x34')](_0xe6c52b[_0xc758('0x33')]);_0x149f29['filters']=_[_0xc758('0x35')](_0x149f29[_0xc758('0x31')],_0x149f29[_0xc758('0x33')]);_0x1ee174[_0xc758('0x36')]=_[_0xc758('0x35')](_0x149f29['model'],qs[_0xc758('0x37')](_0xe6c52b[_0xc758('0x33')]['fields']));_0x1ee174[_0xc758('0x36')]=_0x1ee174['attributes'][_0xc758('0x38')]?_0x1ee174[_0xc758('0x36')]:_0x149f29[_0xc758('0x31')];if(_0xe6c52b['query'][_0xc758('0x46')]){_0x1ee174[_0xc758('0x47')]=[{'all':!![]}];}_0x1ee174=_[_0xc758('0x40')]({},_0x1ee174,_0xe6c52b['options']);return db[_0xc758('0x44')][_0xc758('0x4b')](_0x1ee174)[_0xc758('0x1a')](handleEntityNotFound(_0x5c9952,null))[_0xc758('0x1a')](respondWithResult(_0x5c9952,null))[_0xc758('0x48')](handleError(_0x5c9952,null));};exports[_0xc758('0x4c')]=function(_0x52ee79,_0x428fe7){return db['SalesforceAccount']['create'](_0x52ee79[_0xc758('0x4d')],{})['then'](respondWithResult(_0x428fe7,0xc9))[_0xc758('0x48')](handleError(_0x428fe7,null));};exports[_0xc758('0x2b')]=function(_0x308ae4,_0x147acb){if(_0x308ae4[_0xc758('0x4d')]['id']){delete _0x308ae4[_0xc758('0x4d')]['id'];}return db[_0xc758('0x44')][_0xc758('0x4b')]({'where':{'id':_0x308ae4[_0xc758('0x49')]['id']}})[_0xc758('0x1a')](handleEntityNotFound(_0x147acb,null))[_0xc758('0x1a')](saveUpdates(_0x308ae4[_0xc758('0x4d')],null))[_0xc758('0x1a')](respondWithResult(_0x147acb,null))[_0xc758('0x48')](handleError(_0x147acb,null));};exports['destroy']=function(_0x335391,_0x1c6710){return db['SalesforceAccount']['find']({'where':{'id':_0x335391[_0xc758('0x49')]['id']}})[_0xc758('0x1a')](handleEntityNotFound(_0x1c6710,null))['then'](removeEntity(_0x1c6710,null))[_0xc758('0x48')](handleError(_0x1c6710,null));};exports[_0xc758('0x4e')]=function(_0xb21d81,_0x534584,_0x15f77e){var _0x595a31={};var _0x20a3c5={};var _0x28febf;var _0x375165;return db[_0xc758('0x44')]['findOne']({'where':{'id':_0xb21d81[_0xc758('0x49')]['id']}})[_0xc758('0x1a')](handleEntityNotFound(_0x534584,null))[_0xc758('0x1a')](function(_0xc6e0fc){if(_0xc6e0fc){_0x28febf=_0xc6e0fc;_0x20a3c5[_0xc758('0x31')]=_['keys'](db[_0xc758('0x4f')]['rawAttributes']);_0x20a3c5['query']=_[_0xc758('0x34')](_0xb21d81[_0xc758('0x33')]);_0x20a3c5[_0xc758('0x3d')]=_['intersection'](_0x20a3c5[_0xc758('0x31')],_0x20a3c5[_0xc758('0x33')]);_0x595a31[_0xc758('0x36')]=_[_0xc758('0x35')](_0x20a3c5[_0xc758('0x31')],qs[_0xc758('0x37')](_0xb21d81[_0xc758('0x33')]['fields']));_0x595a31[_0xc758('0x36')]=_0x595a31[_0xc758('0x36')][_0xc758('0x38')]?_0x595a31[_0xc758('0x36')]:_0x20a3c5[_0xc758('0x31')];_0x595a31[_0xc758('0x3b')]=qs[_0xc758('0x50')](_0xb21d81[_0xc758('0x33')]['sort']);_0x595a31[_0xc758('0x3c')]=qs[_0xc758('0x3d')](_[_0xc758('0x3e')](_0xb21d81['query'],_0x20a3c5[_0xc758('0x3d')]));if(_0xb21d81[_0xc758('0x33')][_0xc758('0x3f')]){_0x595a31[_0xc758('0x3c')]=_[_0xc758('0x40')](_0x595a31[_0xc758('0x3c')],{'$or':_[_0xc758('0x32')](_0x595a31[_0xc758('0x36')],function(_0x49f06b){var _0x346fee={};_0x346fee[_0x49f06b]={'$like':'%'+_0xb21d81[_0xc758('0x33')]['filter']+'%'};return _0x346fee;})});}_0x595a31=_[_0xc758('0x40')]({},_0x595a31,_0xb21d81[_0xc758('0x43')]);return _0x28febf[_0xc758('0x4e')](_0x595a31);}})[_0xc758('0x1a')](function(_0x2f217b){if(_0x2f217b){_0x375165=_0x2f217b[_0xc758('0x38')];if(!_0xb21d81[_0xc758('0x33')][_0xc758('0x39')](_0xc758('0x3a'))){_0x595a31['limit']=qs['limit'](_0xb21d81['query'][_0xc758('0x26')]);_0x595a31[_0xc758('0x25')]=qs[_0xc758('0x25')](_0xb21d81['query']['offset']);}return _0x28febf[_0xc758('0x4e')](_0x595a31);}})[_0xc758('0x1a')](function(_0x2dfd00){if(_0x2dfd00){return _0x2dfd00?{'count':_0x375165,'rows':_0x2dfd00}:null;}})[_0xc758('0x1a')](respondWithResult(_0x534584,null))['catch'](handleError(_0x534584,null));};exports['addConfiguration']=function(_0x140d2c,_0x2797bb,_0x5ec8f0){if(_0x140d2c['body']['id']){delete _0x140d2c[_0xc758('0x4d')]['id'];}return db[_0xc758('0x44')][_0xc758('0x51')]({'where':{'id':_0x140d2c[_0xc758('0x49')]['id']}})['then'](handleEntityNotFound(_0x2797bb,null))[_0xc758('0x1a')](function(_0x588092){if(_0x588092){_0x140d2c['body'][_0xc758('0x52')]=_0x588092['id'];_0x140d2c['body'][_0xc758('0x53')]=integrations[_0xc758('0x54')](_0x140d2c['body'][_0xc758('0x55')],_0x140d2c[_0xc758('0x4d')][_0xc758('0x41')]);_0x140d2c[_0xc758('0x4d')]['Descriptions']=integrations[_0xc758('0x56')](_0x140d2c[_0xc758('0x4d')][_0xc758('0x55')],_0x140d2c[_0xc758('0x4d')][_0xc758('0x41')]);return db[_0xc758('0x4f')][_0xc758('0x4c')](_0x140d2c[_0xc758('0x4d')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0xc758('0x57')],'as':_0xc758('0x58')}]});}return null;})[_0xc758('0x1a')](respondWithResult(_0x2797bb,null))[_0xc758('0x48')](handleError(_0x2797bb,null));};exports[_0xc758('0x59')]=function(_0x30e35a,_0x396227,_0x4c18b6){var _0x4e6d48;var _0x5a3913='';var _0x14edf8=_0xc758('0x5a');return db[_0xc758('0x44')]['findOne']({'where':{'id':_0x30e35a[_0xc758('0x49')]['id']},'attributes':['id',_0xc758('0x5b'),_0xc758('0x5c'),_0xc758('0x5d'),_0xc758('0x5e'),'password',_0xc758('0x5f')]})[_0xc758('0x1a')](handleEntityNotFound(_0x396227,null))[_0xc758('0x1a')](function(_0x2b4c50){if(_0x2b4c50){_0x5a3913=_0x2b4c50['remoteUri'];var _0x55ae81=_0x5a3913['slice'](-0x1);if(_0x55ae81==='/'){_0x5a3913=_0x5a3913[_0xc758('0x60')](0x0,_0x5a3913[_0xc758('0x61')](_0x55ae81));}_0x4e6d48=new jsforce[(_0xc758('0x62'))]({'oauth2':{'loginUrl':_0x5a3913,'clientId':_0x2b4c50[_0xc758('0x5c')],'clientSecret':_0x2b4c50[_0xc758('0x5d')]}});return _0x4e6d48['login'](_0x2b4c50[_0xc758('0x5e')],_0x2b4c50[_0xc758('0x63')][_0xc758('0x64')](_0x2b4c50[_0xc758('0x5f')]));}})[_0xc758('0x1a')](function(_0x50ddcf){if(_0x50ddcf){if(!_[_0xc758('0x65')](_0x30e35a[_0xc758('0x33')][_0xc758('0x66')])){_0x14edf8=_0x30e35a[_0xc758('0x33')][_0xc758('0x66')];}return _0x4e6d48[_0xc758('0x67')](_0x14edf8)[_0xc758('0x68')]();}})[_0xc758('0x1a')](function(_0x143c6a){var _0x5b3639=[_0xc758('0x69'),_0xc758('0x6a'),_0xc758('0x6b'),'IsRecurrence',_0xc758('0x6c'),_0xc758('0x6d')];var _0x23b06d=['string',_0xc758('0x6e'),_0xc758('0x6f'),_0xc758('0x70'),_0xc758('0x71'),'textarea',_0xc758('0x72')];if(_0x143c6a){_[_0xc758('0x73')](_0x143c6a[_0xc758('0x37')],function(_0x300e41){return _0x5b3639['includes'](_0x300e41[_0xc758('0x2d')])||!_0x23b06d[_0xc758('0x74')](_0x300e41[_0xc758('0x41')]);});return{'count':_0x143c6a[_0xc758('0x37')][_0xc758('0x38')],'rows':_[_0xc758('0x32')](_0x143c6a[_0xc758('0x37')],function(_0x57eb2c){return{'id':_0x57eb2c[_0xc758('0x2d')],'name':_0x57eb2c[_0xc758('0x75')],'custom':_0x57eb2c[_0xc758('0x76')],'options':_0x57eb2c[_0xc758('0x77')]['length']>0x0?_[_0xc758('0x32')](_0x57eb2c[_0xc758('0x77')],function(_0xb808c7){return{'name':_0xb808c7[_0xc758('0x75')],'value':_0xb808c7[_0xc758('0x78')]};}):_0x57eb2c[_0xc758('0x41')]==_0xc758('0x70')?[{'name':_0xc758('0x79'),'value':_0xc758('0x7a')},{'name':'False','value':_0xc758('0x7b')}]:[]};})};}})['then'](respondWithResult(_0x396227,null))[_0xc758('0x48')](function(_0x56c526){var _0x5be658=_0x30e35a[_0xc758('0x33')]['test']?0x1f4:_0x56c526[_0xc758('0x7c')]||0x1f4;logger['error'](_0xc758('0x7d'),_0xc758('0x59'),_0x5be658,JSON['stringify'](_0x56c526));delete _0x56c526['name'];if(_0x5be658===0x191){_0x5be658=0x190;}_0x396227[_0xc758('0x23')](_0x5be658)[_0xc758('0x2e')](_0x30e35a[_0xc758('0x33')][_0xc758('0x7e')]?{'message':_0xc758('0x7f'),'statusCode':_0x56c526[_0xc758('0x7c')]}:_0x56c526);});}; \ No newline at end of file +var _0x087b=['picklistValues','value','True','true','False','false','test','statusCode','stringify','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','params','fields','length','includeAll','options','find','create','body','getConfigurations','findOne','SalesforceConfiguration','order','addConfiguration','Subjects','Descriptions','getFields','Task','remoteUri','clientId','securityToken','substring','lastIndexOf','Connection','clientSecret','login','username','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Subject','Description','string','int','boolean','email','textarea','phone','remove','includes','label','custom'];(function(_0x98d987,_0x8035f9){var _0x371b08=function(_0x42e768){while(--_0x42e768){_0x98d987['push'](_0x98d987['shift']());}};_0x371b08(++_0x8035f9);}(_0x087b,0x11a));var _0xb087=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x087b[_0x22b68a];return _0x1ac67a;};'use strict';var pdf=require(_0xb087('0x0'));var emlformat=require(_0xb087('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb087('0x2'));var rp=require('request-promise');var moment=require(_0xb087('0x3'));var BPromise=require(_0xb087('0x4'));var Mustache=require(_0xb087('0x5'));var util=require(_0xb087('0x6'));var path=require(_0xb087('0x7'));var sox=require(_0xb087('0x8'));var csv=require(_0xb087('0x9'));var ejs=require(_0xb087('0xa'));var fs=require('fs');var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x9'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];var integrations=require(_0xb087('0x1b'));var jayson=require(_0xb087('0x1c'));var client=jayson['client'][_0xb087('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3f145e,_0x43f136,_0x46410b,_0x11784c){return new BPromise(function(_0x12d0db,_0x5e9757){var _0x5147e3=_0x11784c||client;return _0x5147e3[_0xb087('0x1e')](_0x3f145e,_0x46410b)[_0xb087('0x1f')](function(_0x5193a4){logger[_0xb087('0x20')](_0xb087('0x21'),_0x43f136,'request\x20sent');logger[_0xb087('0x22')](_0xb087('0x23'),_0x43f136,_0xb087('0x24'),JSON['stringify'](_0x5193a4));if(_0x5193a4[_0xb087('0x25')]){if(_0x5193a4[_0xb087('0x25')][_0xb087('0x26')]===0x1f4){logger[_0xb087('0x25')]('SalesforceAccount,\x20%s,\x20%s',_0x43f136,_0x5193a4[_0xb087('0x25')][_0xb087('0x27')]);return _0x5e9757(_0x5193a4[_0xb087('0x25')][_0xb087('0x27')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x43f136,_0x5193a4['error']['message']);return _0x12d0db(_0x5193a4[_0xb087('0x25')][_0xb087('0x27')]);}else{logger[_0xb087('0x20')](_0xb087('0x21'),_0x43f136,_0xb087('0x24'));_0x12d0db(_0x5193a4[_0xb087('0x28')][_0xb087('0x27')]);}})['catch'](function(_0x1d1424){logger[_0xb087('0x25')](_0xb087('0x21'),_0x43f136,_0x1d1424);_0x5e9757(_0x1d1424);});});}function respondWithStatusCode(_0x1cfb3e,_0x3ad74e){_0x3ad74e=_0x3ad74e||0xcc;return function(_0x4d9028){if(_0x4d9028){return _0x1cfb3e[_0xb087('0x29')](_0x3ad74e);}return _0x1cfb3e[_0xb087('0x2a')](_0x3ad74e)['end']();};}function respondWithResult(_0x5a2dc6,_0x50745a){_0x50745a=_0x50745a||0xc8;return function(_0x598b99){if(_0x598b99){return _0x5a2dc6['status'](_0x50745a)[_0xb087('0x2b')](_0x598b99);}};}function respondWithFilteredResult(_0x45685d,_0x1d124f){return function(_0x3ca2df){if(_0x3ca2df){var _0xd9ec66=_0x3ca2df[_0xb087('0x2c')],_0xb72173=_0x1d124f[_0xb087('0x2d')],_0xf3f41f=_0x1d124f[_0xb087('0x2d')]+_0x1d124f[_0xb087('0x2e')],_0x35a52c;if(_0xf3f41f>=_0xd9ec66){_0xf3f41f=_0xd9ec66;_0x35a52c=0xc8;}else{_0x35a52c=0xce;}_0x45685d[_0xb087('0x2a')](_0x35a52c);return _0x45685d[_0xb087('0x2f')]('Content-Range',_0xb72173+'-'+_0xf3f41f+'/'+_0xd9ec66)[_0xb087('0x2b')](_0x3ca2df);}return null;};}function patchUpdates(_0x1335d9){return function(_0x20183f){try{jsonpatch[_0xb087('0x30')](_0x20183f,_0x1335d9,!![]);}catch(_0x22d441){return BPromise[_0xb087('0x31')](_0x22d441);}return _0x20183f[_0xb087('0x32')]();};}function saveUpdates(_0x13fb2f,_0x53a535){return function(_0x4c48f8){if(_0x4c48f8){return _0x4c48f8[_0xb087('0x33')](_0x13fb2f)[_0xb087('0x1f')](function(_0x4cb5a8){return _0x4cb5a8;});}return null;};}function removeEntity(_0x60bfe2,_0x7d3776){return function(_0x2a48d3){if(_0x2a48d3){return _0x2a48d3[_0xb087('0x34')]()[_0xb087('0x1f')](function(){_0x60bfe2[_0xb087('0x2a')](0xcc)[_0xb087('0x35')]();});}};}function handleEntityNotFound(_0x3b7ace,_0x8f4f02){return function(_0xdc7033){if(!_0xdc7033){_0x3b7ace[_0xb087('0x29')](0x194);}return _0xdc7033;};}function handleError(_0x3069b5,_0x57ae94){_0x57ae94=_0x57ae94||0x1f4;return function(_0x3bec03){logger['error'](_0x3bec03[_0xb087('0x36')]);if(_0x3bec03[_0xb087('0x37')]){delete _0x3bec03[_0xb087('0x37')];}_0x3069b5[_0xb087('0x2a')](_0x57ae94)[_0xb087('0x38')](_0x3bec03);};}exports[_0xb087('0x39')]=function(_0x32c3e8,_0x29df58){var _0x8a4c3c={},_0x521c3f={},_0x5814c2={'count':0x0,'rows':[]};var _0x35f900=_[_0xb087('0x3a')](db[_0xb087('0x3b')][_0xb087('0x3c')],function(_0x1982a8){return{'name':_0x1982a8['fieldName'],'type':_0x1982a8[_0xb087('0x3d')][_0xb087('0x3e')]};});_0x521c3f['model']=_['map'](_0x35f900,_0xb087('0x37'));_0x521c3f[_0xb087('0x3f')]=_[_0xb087('0x40')](_0x32c3e8['query']);_0x521c3f[_0xb087('0x41')]=_[_0xb087('0x42')](_0x521c3f[_0xb087('0x43')],_0x521c3f[_0xb087('0x3f')]);_0x8a4c3c[_0xb087('0x44')]=_['intersection'](_0x521c3f[_0xb087('0x43')],qs['fields'](_0x32c3e8[_0xb087('0x3f')]['fields']));_0x8a4c3c[_0xb087('0x44')]=_0x8a4c3c[_0xb087('0x44')]['length']?_0x8a4c3c[_0xb087('0x44')]:_0x521c3f['model'];if(!_0x32c3e8[_0xb087('0x3f')]['hasOwnProperty'](_0xb087('0x45'))){_0x8a4c3c[_0xb087('0x2e')]=qs[_0xb087('0x2e')](_0x32c3e8[_0xb087('0x3f')][_0xb087('0x2e')]);_0x8a4c3c[_0xb087('0x2d')]=qs[_0xb087('0x2d')](_0x32c3e8['query'][_0xb087('0x2d')]);}_0x8a4c3c['order']=qs[_0xb087('0x46')](_0x32c3e8[_0xb087('0x3f')]['sort']);_0x8a4c3c[_0xb087('0x47')]=qs[_0xb087('0x41')](_[_0xb087('0x48')](_0x32c3e8['query'],_0x521c3f[_0xb087('0x41')]),_0x35f900);if(_0x32c3e8['query'][_0xb087('0x49')]){_0x8a4c3c[_0xb087('0x47')]=_['merge'](_0x8a4c3c[_0xb087('0x47')],{'$or':_[_0xb087('0x3a')](_0x35f900,function(_0x4addbd){if(_0x4addbd[_0xb087('0x3d')]!==_0xb087('0x4a')){var _0x54eb11={};_0x54eb11[_0x4addbd[_0xb087('0x37')]]={'$like':'%'+_0x32c3e8[_0xb087('0x3f')][_0xb087('0x49')]+'%'};return _0x54eb11;}})});}_0x8a4c3c=_[_0xb087('0x4b')]({},_0x8a4c3c,_0x32c3e8['options']);var _0x47902e={'where':_0x8a4c3c[_0xb087('0x47')]};return db[_0xb087('0x3b')][_0xb087('0x2c')](_0x47902e)[_0xb087('0x1f')](function(_0x36a88f){_0x5814c2[_0xb087('0x2c')]=_0x36a88f;if(_0x32c3e8['query']['includeAll']){_0x8a4c3c[_0xb087('0x4c')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xb087('0x4d')](_0x8a4c3c);})[_0xb087('0x1f')](function(_0x2a1823){_0x5814c2[_0xb087('0x4e')]=_0x2a1823;return _0x5814c2;})['then'](respondWithFilteredResult(_0x29df58,_0x8a4c3c))[_0xb087('0x4f')](handleError(_0x29df58,null));};exports['show']=function(_0x2fe8a0,_0x73413b){var _0xcb56c7={'raw':![],'where':{'id':_0x2fe8a0[_0xb087('0x50')]['id']}},_0x212021={};_0x212021['model']=_[_0xb087('0x40')](db[_0xb087('0x3b')][_0xb087('0x3c')]);_0x212021['query']=_[_0xb087('0x40')](_0x2fe8a0['query']);_0x212021['filters']=_[_0xb087('0x42')](_0x212021[_0xb087('0x43')],_0x212021['query']);_0xcb56c7[_0xb087('0x44')]=_[_0xb087('0x42')](_0x212021[_0xb087('0x43')],qs['fields'](_0x2fe8a0['query'][_0xb087('0x51')]));_0xcb56c7['attributes']=_0xcb56c7['attributes'][_0xb087('0x52')]?_0xcb56c7[_0xb087('0x44')]:_0x212021[_0xb087('0x43')];if(_0x2fe8a0[_0xb087('0x3f')][_0xb087('0x53')]){_0xcb56c7[_0xb087('0x4c')]=[{'all':!![]}];}_0xcb56c7=_[_0xb087('0x4b')]({},_0xcb56c7,_0x2fe8a0[_0xb087('0x54')]);return db[_0xb087('0x3b')][_0xb087('0x55')](_0xcb56c7)[_0xb087('0x1f')](handleEntityNotFound(_0x73413b,null))[_0xb087('0x1f')](respondWithResult(_0x73413b,null))['catch'](handleError(_0x73413b,null));};exports[_0xb087('0x56')]=function(_0x46548e,_0x5cac89){return db[_0xb087('0x3b')][_0xb087('0x56')](_0x46548e[_0xb087('0x57')],{})[_0xb087('0x1f')](respondWithResult(_0x5cac89,0xc9))[_0xb087('0x4f')](handleError(_0x5cac89,null));};exports[_0xb087('0x33')]=function(_0x167e90,_0x298169){if(_0x167e90[_0xb087('0x57')]['id']){delete _0x167e90[_0xb087('0x57')]['id'];}return db[_0xb087('0x3b')]['find']({'where':{'id':_0x167e90[_0xb087('0x50')]['id']}})['then'](handleEntityNotFound(_0x298169,null))[_0xb087('0x1f')](saveUpdates(_0x167e90['body'],null))[_0xb087('0x1f')](respondWithResult(_0x298169,null))[_0xb087('0x4f')](handleError(_0x298169,null));};exports[_0xb087('0x34')]=function(_0x1fe773,_0x62e7cc){return db[_0xb087('0x3b')][_0xb087('0x55')]({'where':{'id':_0x1fe773[_0xb087('0x50')]['id']}})[_0xb087('0x1f')](handleEntityNotFound(_0x62e7cc,null))[_0xb087('0x1f')](removeEntity(_0x62e7cc,null))[_0xb087('0x4f')](handleError(_0x62e7cc,null));};exports[_0xb087('0x58')]=function(_0x3834a6,_0x22be05,_0x3f6fd7){var _0x122103={};var _0x217f26={};var _0x3185c4;var _0x40ff74;return db[_0xb087('0x3b')][_0xb087('0x59')]({'where':{'id':_0x3834a6[_0xb087('0x50')]['id']}})['then'](handleEntityNotFound(_0x22be05,null))[_0xb087('0x1f')](function(_0x1f893a){if(_0x1f893a){_0x3185c4=_0x1f893a;_0x217f26[_0xb087('0x43')]=_['keys'](db[_0xb087('0x5a')][_0xb087('0x3c')]);_0x217f26['query']=_[_0xb087('0x40')](_0x3834a6[_0xb087('0x3f')]);_0x217f26[_0xb087('0x41')]=_['intersection'](_0x217f26[_0xb087('0x43')],_0x217f26[_0xb087('0x3f')]);_0x122103[_0xb087('0x44')]=_[_0xb087('0x42')](_0x217f26[_0xb087('0x43')],qs[_0xb087('0x51')](_0x3834a6[_0xb087('0x3f')][_0xb087('0x51')]));_0x122103['attributes']=_0x122103[_0xb087('0x44')][_0xb087('0x52')]?_0x122103[_0xb087('0x44')]:_0x217f26['model'];_0x122103[_0xb087('0x5b')]=qs['sort'](_0x3834a6['query'][_0xb087('0x46')]);_0x122103[_0xb087('0x47')]=qs['filters'](_[_0xb087('0x48')](_0x3834a6['query'],_0x217f26[_0xb087('0x41')]));if(_0x3834a6[_0xb087('0x3f')]['filter']){_0x122103['where']=_[_0xb087('0x4b')](_0x122103['where'],{'$or':_['map'](_0x122103[_0xb087('0x44')],function(_0x52d72a){var _0x34ad78={};_0x34ad78[_0x52d72a]={'$like':'%'+_0x3834a6['query'][_0xb087('0x49')]+'%'};return _0x34ad78;})});}_0x122103=_[_0xb087('0x4b')]({},_0x122103,_0x3834a6[_0xb087('0x54')]);return _0x3185c4[_0xb087('0x58')](_0x122103);}})[_0xb087('0x1f')](function(_0x3174bb){if(_0x3174bb){_0x40ff74=_0x3174bb['length'];if(!_0x3834a6[_0xb087('0x3f')]['hasOwnProperty'](_0xb087('0x45'))){_0x122103[_0xb087('0x2e')]=qs[_0xb087('0x2e')](_0x3834a6['query'][_0xb087('0x2e')]);_0x122103['offset']=qs[_0xb087('0x2d')](_0x3834a6[_0xb087('0x3f')][_0xb087('0x2d')]);}return _0x3185c4[_0xb087('0x58')](_0x122103);}})[_0xb087('0x1f')](function(_0xe9e103){if(_0xe9e103){return _0xe9e103?{'count':_0x40ff74,'rows':_0xe9e103}:null;}})['then'](respondWithResult(_0x22be05,null))[_0xb087('0x4f')](handleError(_0x22be05,null));};exports[_0xb087('0x5c')]=function(_0x4bedbd,_0x25a45f,_0x58de88){if(_0x4bedbd[_0xb087('0x57')]['id']){delete _0x4bedbd[_0xb087('0x57')]['id'];}return db[_0xb087('0x3b')][_0xb087('0x59')]({'where':{'id':_0x4bedbd[_0xb087('0x50')]['id']}})[_0xb087('0x1f')](handleEntityNotFound(_0x25a45f,null))[_0xb087('0x1f')](function(_0x186b40){if(_0x186b40){_0x4bedbd['body']['AccountId']=_0x186b40['id'];_0x4bedbd['body'][_0xb087('0x5d')]=integrations['getSubjects'](_0x4bedbd[_0xb087('0x57')]['channel'],_0x4bedbd[_0xb087('0x57')][_0xb087('0x3d')]);_0x4bedbd[_0xb087('0x57')][_0xb087('0x5e')]=integrations['getDescriptions'](_0x4bedbd[_0xb087('0x57')]['channel'],_0x4bedbd[_0xb087('0x57')][_0xb087('0x3d')]);return db[_0xb087('0x5a')][_0xb087('0x56')](_0x4bedbd['body'],{'include':[{'model':db['SalesforceField'],'as':_0xb087('0x5d')},{'model':db['SalesforceField'],'as':_0xb087('0x5e')}]});}return null;})[_0xb087('0x1f')](respondWithResult(_0x25a45f,null))[_0xb087('0x4f')](handleError(_0x25a45f,null));};exports[_0xb087('0x5f')]=function(_0x4a9193,_0x4bdd30,_0x2580e2){var _0x551f56;var _0x34e72c='';var _0x1c7cd7=_0xb087('0x60');return db[_0xb087('0x3b')][_0xb087('0x59')]({'where':{'id':_0x4a9193['params']['id']},'attributes':['id',_0xb087('0x61'),_0xb087('0x62'),'clientSecret','username','password',_0xb087('0x63')]})[_0xb087('0x1f')](handleEntityNotFound(_0x4bdd30,null))[_0xb087('0x1f')](function(_0x247b7e){if(_0x247b7e){_0x34e72c=_0x247b7e[_0xb087('0x61')];var _0x19d7ae=_0x34e72c['slice'](-0x1);if(_0x19d7ae==='/'){_0x34e72c=_0x34e72c[_0xb087('0x64')](0x0,_0x34e72c[_0xb087('0x65')](_0x19d7ae));}_0x551f56=new jsforce[(_0xb087('0x66'))]({'oauth2':{'loginUrl':_0x34e72c,'clientId':_0x247b7e[_0xb087('0x62')],'clientSecret':_0x247b7e[_0xb087('0x67')]}});return _0x551f56[_0xb087('0x68')](_0x247b7e[_0xb087('0x69')],_0x247b7e['password'][_0xb087('0x6a')](_0x247b7e[_0xb087('0x63')]));}})[_0xb087('0x1f')](function(_0x5439f4){if(_0x5439f4){if(!_[_0xb087('0x6b')](_0x4a9193['query'][_0xb087('0x6c')])){_0x1c7cd7=_0x4a9193[_0xb087('0x3f')][_0xb087('0x6c')];}return _0x551f56[_0xb087('0x6d')](_0x1c7cd7)[_0xb087('0x6e')]();}})[_0xb087('0x1f')](function(_0x5d3107){var _0x4ae3bb=[_0xb087('0x6f'),_0xb087('0x70'),'IsReminderSet',_0xb087('0x71'),_0xb087('0x72'),_0xb087('0x73')];var _0x2618d6=[_0xb087('0x74'),_0xb087('0x75'),'picklist',_0xb087('0x76'),_0xb087('0x77'),_0xb087('0x78'),_0xb087('0x79')];if(_0x5d3107){_[_0xb087('0x7a')](_0x5d3107[_0xb087('0x51')],function(_0xf286de){return _0x4ae3bb[_0xb087('0x7b')](_0xf286de[_0xb087('0x37')])||!_0x2618d6['includes'](_0xf286de[_0xb087('0x3d')]);});return{'count':_0x5d3107['fields'][_0xb087('0x52')],'rows':_[_0xb087('0x3a')](_0x5d3107['fields'],function(_0x219e70){return{'id':_0x219e70[_0xb087('0x37')],'name':_0x219e70[_0xb087('0x7c')],'custom':_0x219e70[_0xb087('0x7d')],'options':_0x219e70[_0xb087('0x7e')][_0xb087('0x52')]>0x0?_['map'](_0x219e70[_0xb087('0x7e')],function(_0x28dcea){return{'name':_0x28dcea[_0xb087('0x7c')],'value':_0x28dcea[_0xb087('0x7f')]};}):_0x219e70[_0xb087('0x3d')]=='boolean'?[{'name':_0xb087('0x80'),'value':_0xb087('0x81')},{'name':_0xb087('0x82'),'value':_0xb087('0x83')}]:[]};})};}})[_0xb087('0x1f')](respondWithResult(_0x4bdd30,null))[_0xb087('0x4f')](function(_0xa228cf){var _0x3b970f=_0x4a9193[_0xb087('0x3f')][_0xb087('0x84')]?0x1f4:_0xa228cf[_0xb087('0x85')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb087('0x5f'),_0x3b970f,JSON[_0xb087('0x86')](_0xa228cf));delete _0xa228cf[_0xb087('0x37')];if(_0x3b970f===0x191){_0x3b970f=0x190;}_0x4bdd30[_0xb087('0x2a')](_0x3b970f)[_0xb087('0x38')](_0x4a9193['query'][_0xb087('0x84')]?{'message':_0xb087('0x87'),'statusCode':_0xa228cf[_0xb087('0x85')]}:_0xa228cf);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index e77c1c0..6682947 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 _0x55d2=['bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_salesforce_accounts','lodash','../../config/logger','api','moment'];(function(_0xed2e17,_0x53c0b5){var _0xd7f2a1=function(_0x24246b){while(--_0x24246b){_0xed2e17['push'](_0xed2e17['shift']());}};_0xd7f2a1(++_0x53c0b5);}(_0x55d2,0xd8));var _0x255d=function(_0x4a3864,_0x245ccc){_0x4a3864=_0x4a3864-0x0;var _0x45f2a3=_0x55d2[_0x4a3864];return _0x45f2a3;};'use strict';var _=require(_0x255d('0x0'));var util=require('util');var logger=require(_0x255d('0x1'))(_0x255d('0x2'));var moment=require(_0x255d('0x3'));var BPromise=require(_0x255d('0x4'));var rp=require(_0x255d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x255d('0x6'));var config=require(_0x255d('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x255d('0x8'));module[_0x255d('0x9')]=function(_0x24cbd4,_0x3fa18b){return _0x24cbd4['define']('SalesforceAccount',attributes,{'tableName':_0x255d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa5=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x592b63,_0x1a73cc){var _0x5c9fa3=function(_0x417513){while(--_0x417513){_0x592b63['push'](_0x592b63['shift']());}};_0x5c9fa3(++_0x1a73cc);}(_0x6aa5,0x14f));var _0x56aa=function(_0x2f18a4,_0x452991){_0x2f18a4=_0x2f18a4-0x0;var _0x42e31e=_0x6aa5[_0x2f18a4];return _0x42e31e;};'use strict';var _=require(_0x56aa('0x0'));var util=require(_0x56aa('0x1'));var logger=require(_0x56aa('0x2'))(_0x56aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x56aa('0x4'));var fs=require('fs');var path=require(_0x56aa('0x5'));var rimraf=require(_0x56aa('0x6'));var config=require(_0x56aa('0x7'));var attributes=require(_0x56aa('0x8'));var integrations=require(_0x56aa('0x9'));module[_0x56aa('0xa')]=function(_0x5eb4cc,_0x51d07b){return _0x5eb4cc[_0x56aa('0xb')](_0x56aa('0xc'),attributes,{'tableName':_0x56aa('0xd'),'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 f56ddb6..039cee9 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 _0xbdb7=['model','map','ShowSalesforceAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include'];(function(_0x4279c4,_0x1783af){var _0xfe2d0c=function(_0x24fa0c){while(--_0x24fa0c){_0x4279c4['push'](_0x4279c4['shift']());}};_0xfe2d0c(++_0x1783af);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x169996,_0x4b59b5){_0x169996=_0x169996-0x0;var _0x28d7e6=_0xbdb7[_0x169996];return _0x28d7e6;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}exports[_0x7bdb('0x15')]=function(_0x5723f4){var _0x2aff6a=this;return new Promise(function(_0x4ffd4b,_0x41f540){return db[_0x7bdb('0x16')]['findAll']({'raw':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')]['where']||null:null,'attributes':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x19')]||null:null,'limit':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1a')]||null:null,'include':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_['map'](_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')],function(_0x40c447){return{'model':db[_0x40c447[_0x7bdb('0x1c')]],'as':_0x40c447['as'],'attributes':_0x40c447['attributes'],'include':_0x40c447['include']?_[_0x7bdb('0x1d')](_0x40c447['include'],function(_0x47abaf){return{'model':db[_0x47abaf['model']],'as':_0x47abaf['as'],'attributes':_0x47abaf[_0x7bdb('0x19')],'include':_0x47abaf['include']?_[_0x7bdb('0x1d')](_0x47abaf[_0x7bdb('0x1b')],function(_0x3ec129){return{'model':db[_0x3ec129[_0x7bdb('0x1c')]],'as':_0x3ec129['as'],'attributes':_0x3ec129[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10e818){logger[_0x7bdb('0xb')](_0x7bdb('0x15'),_0x5723f4);logger[_0x7bdb('0xe')](_0x7bdb('0x15'),_0x5723f4,JSON[_0x7bdb('0x10')](_0x10e818));_0x4ffd4b(_0x10e818);})[_0x7bdb('0x14')](function(_0xd2d7be){logger[_0x7bdb('0x11')](_0x7bdb('0x15'),_0xd2d7be[_0x7bdb('0x12')],_0x5723f4);_0x41f540(_0x2aff6a[_0x7bdb('0x11')](0x1f4,_0xd2d7be['message']));});});};exports[_0x7bdb('0x1e')]=function(_0x23fc3a){var _0x8f7672=this;return new Promise(function(_0x9f5c1,_0x29eac5){return db['SalesforceAccount'][_0x7bdb('0x1f')]({'raw':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x23fc3a['options']?_0x23fc3a['options']['where']||null:null,'attributes':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a['options'][_0x7bdb('0x19')]||null:null,'include':_0x23fc3a['options']?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x23fc3a['options'][_0x7bdb('0x1b')],function(_0x514713){return{'model':db[_0x514713['model']],'as':_0x514713['as'],'attributes':_0x514713[_0x7bdb('0x19')],'include':_0x514713['include']?_[_0x7bdb('0x1d')](_0x514713['include'],function(_0x5ee47d){return{'model':db[_0x5ee47d[_0x7bdb('0x1c')]],'as':_0x5ee47d['as'],'attributes':_0x5ee47d[_0x7bdb('0x19')],'include':_0x5ee47d[_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x5ee47d[_0x7bdb('0x1b')],function(_0x2bb28a){return{'model':db[_0x2bb28a['model']],'as':_0x2bb28a['as'],'attributes':_0x2bb28a[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7bdb('0x20')](function(_0x329ecf){logger[_0x7bdb('0xb')](_0x7bdb('0x1e'),_0x23fc3a);logger[_0x7bdb('0xe')](_0x7bdb('0x1e'),_0x23fc3a,JSON[_0x7bdb('0x10')](_0x329ecf));_0x9f5c1(_0x329ecf);})[_0x7bdb('0x14')](function(_0x4e1c97){logger['error'](_0x7bdb('0x1e'),_0x4e1c97[_0x7bdb('0x12')],_0x23fc3a);_0x29eac5(_0x8f7672[_0x7bdb('0x11')](0x1f4,_0x4e1c97[_0x7bdb('0x12')]));});});}; \ No newline at end of file +var _0x41bb=['../../config/environment','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetSalesforceAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowSalesforceAccount','SalesforceAccount','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2d43f2,_0x1c4d51){var _0x598fcb=function(_0x47c01b){while(--_0x47c01b){_0x2d43f2['push'](_0x2d43f2['shift']());}};_0x598fcb(++_0x1c4d51);}(_0x41bb,0xc5));var _0xb41b=function(_0x35e558,_0x100f0a){_0x35e558=_0x35e558-0x0;var _0x25ee43=_0x41bb[_0x35e558];return _0x25ee43;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5455ce,_0x497242,_0x2704f0){return new BPromise(function(_0x29c30d,_0x53722a){return client[_0xb41b('0xa')](_0x5455ce,_0x2704f0)[_0xb41b('0xb')](function(_0x11b8b2){logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));logger[_0xb41b('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x497242,_0xb41b('0xe'),JSON['stringify'](_0x11b8b2));if(_0x11b8b2[_0xb41b('0x10')]){if(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error'][_0xb41b('0x12')]);return _0x53722a(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error']['message']);return _0x29c30d(_0x11b8b2['error'][_0xb41b('0x12')]);}else{logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));_0x29c30d(_0x11b8b2[_0xb41b('0x13')]['message']);}})[_0xb41b('0x14')](function(_0xd0b6b5){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0xd0b6b5);_0x53722a(_0xd0b6b5);});});}exports[_0xb41b('0x15')]=function(_0x47154d){var _0x198783=this;return new Promise(function(_0x5df8c2,_0x4b3580){return db['SalesforceAccount'][_0xb41b('0x16')]({'raw':_0x47154d['options']?_0x47154d[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x47154d[_0xb41b('0x17')]?_0x47154d['options']['where']||null:null,'attributes':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'limit':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x1a')]||null:null,'include':_0x47154d['options']?_0x47154d['options'][_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x47154d[_0xb41b('0x17')]['include'],function(_0x14e9c8){return{'model':db[_0x14e9c8[_0xb41b('0x1d')]],'as':_0x14e9c8['as'],'attributes':_0x14e9c8['attributes'],'include':_0x14e9c8[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x14e9c8['include'],function(_0xed3c7e){return{'model':db[_0xed3c7e['model']],'as':_0xed3c7e['as'],'attributes':_0xed3c7e[_0xb41b('0x19')],'include':_0xed3c7e[_0xb41b('0x1b')]?_['map'](_0xed3c7e[_0xb41b('0x1b')],function(_0x4265b8){return{'model':db[_0x4265b8['model']],'as':_0x4265b8['as'],'attributes':_0x4265b8['attributes']};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x46aecf){logger[_0xb41b('0xc')](_0xb41b('0x15'),_0x47154d);logger[_0xb41b('0xf')](_0xb41b('0x15'),_0x47154d,JSON[_0xb41b('0x1e')](_0x46aecf));_0x5df8c2(_0x46aecf);})['catch'](function(_0x26ef96){logger[_0xb41b('0x10')]('GetSalesforceAccount',_0x26ef96[_0xb41b('0x12')],_0x47154d);_0x4b3580(_0x198783['error'](0x1f4,_0x26ef96[_0xb41b('0x12')]));});});};exports[_0xb41b('0x1f')]=function(_0x597a35){var _0x23a6ed=this;return new Promise(function(_0x4a95e7,_0x29da9f){return db[_0xb41b('0x20')]['find']({'raw':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x21')]||null:null,'attributes':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'include':_0x597a35[_0xb41b('0x17')]?_0x597a35['options'][_0xb41b('0x1b')]?_['map'](_0x597a35['options'][_0xb41b('0x1b')],function(_0x192ceb){return{'model':db[_0x192ceb[_0xb41b('0x1d')]],'as':_0x192ceb['as'],'attributes':_0x192ceb[_0xb41b('0x19')],'include':_0x192ceb[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x192ceb[_0xb41b('0x1b')],function(_0x197197){return{'model':db[_0x197197[_0xb41b('0x1d')]],'as':_0x197197['as'],'attributes':_0x197197[_0xb41b('0x19')],'include':_0x197197[_0xb41b('0x1b')]?_['map'](_0x197197[_0xb41b('0x1b')],function(_0x27990d){return{'model':db[_0x27990d[_0xb41b('0x1d')]],'as':_0x27990d['as'],'attributes':_0x27990d[_0xb41b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x10b3f6){logger['info']('ShowSalesforceAccount',_0x597a35);logger[_0xb41b('0xf')](_0xb41b('0x1f'),_0x597a35,JSON['stringify'](_0x10b3f6));_0x4a95e7(_0x10b3f6);})[_0xb41b('0x14')](function(_0x47363e){logger[_0xb41b('0x10')](_0xb41b('0x1f'),_0x47363e[_0xb41b('0x12')],_0x597a35);_0x29da9f(_0x23a6ed['error'](0x1f4,_0x47363e[_0xb41b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 9709169..e0b399e 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 _0x0f6e=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated','get','/:id'];(function(_0x43c345,_0x4efb4d){var _0x138bfc=function(_0x248984){while(--_0x248984){_0x43c345['push'](_0x43c345['shift']());}};_0x138bfc(++_0x4efb4d);}(_0x0f6e,0xd1));var _0xe0f6=function(_0x1d246a,_0x49be62){_0x1d246a=_0x1d246a-0x0;var _0x4f233b=_0x0f6e[_0x1d246a];return _0x4f233b;};'use strict';var multer=require(_0xe0f6('0x0'));var util=require('util');var path=require(_0xe0f6('0x1'));var timeout=require(_0xe0f6('0x2'));var express=require(_0xe0f6('0x3'));var router=express[_0xe0f6('0x4')]();var auth=require(_0xe0f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe0f6('0x6'));var controller=require(_0xe0f6('0x7'));router['get']('/',auth[_0xe0f6('0x8')](),controller['index']);router[_0xe0f6('0x9')](_0xe0f6('0xa'),auth[_0xe0f6('0x8')](),controller[_0xe0f6('0xb')]);router['get'](_0xe0f6('0xc'),auth[_0xe0f6('0x8')](),controller[_0xe0f6('0xd')]);router[_0xe0f6('0x9')](_0xe0f6('0xe'),auth[_0xe0f6('0x8')](),controller[_0xe0f6('0xf')]);router[_0xe0f6('0x9')](_0xe0f6('0x10'),auth[_0xe0f6('0x8')](),controller['getDescriptions']);router[_0xe0f6('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0f6('0x12')]);router['put'](_0xe0f6('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe0f6('0x13')]('/:id',auth[_0xe0f6('0x8')](),controller[_0xe0f6('0x14')]);module[_0xe0f6('0x15')]=router; \ No newline at end of file +var _0x4d66=['show','getFields','/:id/subjects','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x58ee52,_0x5b9d79){var _0x3d2d4e=function(_0x2c7bfd){while(--_0x2c7bfd){_0x58ee52['push'](_0x58ee52['shift']());}};_0x3d2d4e(++_0x5b9d79);}(_0x4d66,0x1ac));var _0x64d6=function(_0x3f3f40,_0x4e745f){_0x3f3f40=_0x3f3f40-0x0;var _0x32c366=_0x4d66[_0x3f3f40];return _0x32c366;};'use strict';var multer=require('multer');var util=require(_0x64d6('0x0'));var path=require(_0x64d6('0x1'));var timeout=require(_0x64d6('0x2'));var express=require('express');var router=express[_0x64d6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x64d6('0x4'));var controller=require('./intSalesforceConfiguration.controller');router[_0x64d6('0x5')]('/',auth[_0x64d6('0x6')](),controller[_0x64d6('0x7')]);router[_0x64d6('0x5')](_0x64d6('0x8'),auth[_0x64d6('0x6')](),controller[_0x64d6('0x9')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x64d6('0xa')]);router[_0x64d6('0x5')](_0x64d6('0xb'),auth[_0x64d6('0x6')](),controller['getSubjects']);router[_0x64d6('0x5')]('/:id/descriptions',auth[_0x64d6('0x6')](),controller['getDescriptions']);router[_0x64d6('0xc')]('/',auth[_0x64d6('0x6')](),controller[_0x64d6('0xd')]);router[_0x64d6('0xe')]('/:id',auth[_0x64d6('0x6')](),controller[_0x64d6('0xf')]);router[_0x64d6('0x10')](_0x64d6('0x8'),auth[_0x64d6('0x6')](),controller[_0x64d6('0x11')]);module[_0x64d6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 5077fdf..898db19 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 _0xf192=['nothing','sequelize','exports','Task','Case','ENUM','contact_lead','contact','lead'];(function(_0x4e0843,_0x5224b5){var _0x40d38d=function(_0x4da742){while(--_0x4da742){_0x4e0843['push'](_0x4e0843['shift']());}};_0x40d38d(++_0x5224b5);}(_0xf192,0x1de));var _0x2f19=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xf192[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x2f19('0x0'));module[_0x2f19('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x2f19('0x2'),_0x2f19('0x3')),'defaultValue':_0x2f19('0x2')},'moduleSearch':{'type':Sequelize[_0x2f19('0x4')](_0x2f19('0x5'),_0x2f19('0x6'),_0x2f19('0x7')),'defaultValue':_0x2f19('0x5')},'moduleCreate':{'type':Sequelize[_0x2f19('0x4')](_0x2f19('0x8'),_0x2f19('0x6'),_0x2f19('0x7')),'defaultValue':_0x2f19('0x7')}}; \ No newline at end of file +var _0xcc2f=['contact_lead','contact','lead','exports','STRING','ENUM','Task'];(function(_0x1b42e8,_0x2e419f){var _0x521c28=function(_0x203451){while(--_0x203451){_0x1b42e8['push'](_0x1b42e8['shift']());}};_0x521c28(++_0x2e419f);}(_0xcc2f,0x1ae));var _0xfcc2=function(_0x53928d,_0x3c4265){_0x53928d=_0x53928d-0x0;var _0x3686b5=_0xcc2f[_0x53928d];return _0x3686b5;};'use strict';var Sequelize=require('sequelize');module[_0xfcc2('0x0')]={'name':{'type':Sequelize[_0xfcc2('0x1')]},'description':{'type':Sequelize[_0xfcc2('0x1')]},'ticketType':{'type':Sequelize[_0xfcc2('0x2')](_0xfcc2('0x3'),'Case'),'defaultValue':_0xfcc2('0x3')},'moduleSearch':{'type':Sequelize[_0xfcc2('0x2')](_0xfcc2('0x4'),_0xfcc2('0x5'),_0xfcc2('0x6')),'defaultValue':_0xfcc2('0x4')},'moduleCreate':{'type':Sequelize[_0xfcc2('0x2')]('nothing','contact','lead'),'defaultValue':_0xfcc2('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 8491f8d..f71291b 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 _0x9d22=['SalesforceField','pick','nolimit','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','destroy','stack','send','index','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','SalesforceConfiguration','count','includeAll','include','rows','params','rawAttributes','merge','find','create','body','findOne'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9d22,0x1be));var _0x29d2=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x9d22[_0x39e283];return _0x7de89f;};'use strict';var pdf=require(_0x29d2('0x0'));var emlformat=require(_0x29d2('0x1'));var rimraf=require(_0x29d2('0x2'));var zipdir=require(_0x29d2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x29d2('0x4'));var BPromise=require(_0x29d2('0x5'));var Mustache=require(_0x29d2('0x6'));var util=require('util');var path=require(_0x29d2('0x7'));var sox=require(_0x29d2('0x8'));var csv=require(_0x29d2('0x9'));var ejs=require(_0x29d2('0xa'));var fs=require('fs');var _=require(_0x29d2('0xb'));var squel=require(_0x29d2('0xc'));var crypto=require('crypto');var jsforce=require(_0x29d2('0xd'));var deskjs=require(_0x29d2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x29d2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x29d2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x29d2('0x11'));var hardwareService=require(_0x29d2('0x12'));var logger=require(_0x29d2('0x13'))('api');var utils=require(_0x29d2('0x14'));var config=require(_0x29d2('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x29d2('0x16')][_0x29d2('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5ad1b6,_0x4f2083,_0x1a92d,_0x5be822){return new BPromise(function(_0x556600,_0x1914a9){var _0x4e4d56=_0x5be822||client;return _0x4e4d56[_0x29d2('0x18')](_0x5ad1b6,_0x1a92d)[_0x29d2('0x19')](function(_0xc6ce80){logger[_0x29d2('0x1a')](_0x29d2('0x1b'),_0x4f2083,'request\x20sent');logger[_0x29d2('0x1c')](_0x29d2('0x1d'),_0x4f2083,'request\x20sent',JSON[_0x29d2('0x1e')](_0xc6ce80));if(_0xc6ce80[_0x29d2('0x1f')]){if(_0xc6ce80['error'][_0x29d2('0x20')]===0x1f4){logger['error'](_0x29d2('0x1b'),_0x4f2083,_0xc6ce80[_0x29d2('0x1f')][_0x29d2('0x21')]);return _0x1914a9(_0xc6ce80['error']['message']);}logger[_0x29d2('0x1f')](_0x29d2('0x1b'),_0x4f2083,_0xc6ce80['error']['message']);return _0x556600(_0xc6ce80[_0x29d2('0x1f')][_0x29d2('0x21')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x4f2083,_0x29d2('0x22'));_0x556600(_0xc6ce80[_0x29d2('0x23')]['message']);}})[_0x29d2('0x24')](function(_0x1f2c17){logger[_0x29d2('0x1f')](_0x29d2('0x1b'),_0x4f2083,_0x1f2c17);_0x1914a9(_0x1f2c17);});});}function respondWithStatusCode(_0x23fbda,_0x5e64bc){_0x5e64bc=_0x5e64bc||0xcc;return function(_0x378242){if(_0x378242){return _0x23fbda[_0x29d2('0x25')](_0x5e64bc);}return _0x23fbda[_0x29d2('0x26')](_0x5e64bc)[_0x29d2('0x27')]();};}function respondWithResult(_0x3db1c6,_0x3d3573){_0x3d3573=_0x3d3573||0xc8;return function(_0x1af44d){if(_0x1af44d){return _0x3db1c6[_0x29d2('0x26')](_0x3d3573)[_0x29d2('0x28')](_0x1af44d);}};}function respondWithFilteredResult(_0x103f51,_0x1fbf47){return function(_0xbdeb9b){if(_0xbdeb9b){var _0x1916e2=_0xbdeb9b['count'],_0x4d7c7f=_0x1fbf47[_0x29d2('0x29')],_0x1648a4=_0x1fbf47[_0x29d2('0x29')]+_0x1fbf47[_0x29d2('0x2a')],_0x25fd3a;if(_0x1648a4>=_0x1916e2){_0x1648a4=_0x1916e2;_0x25fd3a=0xc8;}else{_0x25fd3a=0xce;}_0x103f51['status'](_0x25fd3a);return _0x103f51['set'](_0x29d2('0x2b'),_0x4d7c7f+'-'+_0x1648a4+'/'+_0x1916e2)[_0x29d2('0x28')](_0xbdeb9b);}return null;};}function patchUpdates(_0x40ff02){return function(_0x3b9614){try{jsonpatch['apply'](_0x3b9614,_0x40ff02,!![]);}catch(_0x58760a){return BPromise[_0x29d2('0x2c')](_0x58760a);}return _0x3b9614[_0x29d2('0x2d')]();};}function saveUpdates(_0x2de625,_0x2d858e){return function(_0x117a1e){if(_0x117a1e){return _0x117a1e[_0x29d2('0x2e')](_0x2de625)[_0x29d2('0x19')](function(_0x208fbb){return _0x208fbb;});}return null;};}function removeEntity(_0x228297,_0x5a6843){return function(_0x20fbf8){if(_0x20fbf8){return _0x20fbf8[_0x29d2('0x2f')]()[_0x29d2('0x19')](function(){_0x228297[_0x29d2('0x26')](0xcc)[_0x29d2('0x27')]();});}};}function handleEntityNotFound(_0x131ae5,_0x80458b){return function(_0x203154){if(!_0x203154){_0x131ae5['sendStatus'](0x194);}return _0x203154;};}function handleError(_0x2de72d,_0x445d0e){_0x445d0e=_0x445d0e||0x1f4;return function(_0x492aa5){logger[_0x29d2('0x1f')](_0x492aa5[_0x29d2('0x30')]);if(_0x492aa5['name']){delete _0x492aa5['name'];}_0x2de72d[_0x29d2('0x26')](_0x445d0e)[_0x29d2('0x31')](_0x492aa5);};}exports[_0x29d2('0x32')]=function(_0x34e02c,_0x1d556c){var _0x4fb4c8={},_0x25cf0a={},_0x2a712a={'count':0x0,'rows':[]};var _0x5d5f52=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x55e092){return{'name':_0x55e092[_0x29d2('0x33')],'type':_0x55e092[_0x29d2('0x34')]['key']};});_0x25cf0a[_0x29d2('0x35')]=_[_0x29d2('0x36')](_0x5d5f52,_0x29d2('0x37'));_0x25cf0a[_0x29d2('0x38')]=_[_0x29d2('0x39')](_0x34e02c[_0x29d2('0x38')]);_0x25cf0a[_0x29d2('0x3a')]=_[_0x29d2('0x3b')](_0x25cf0a[_0x29d2('0x35')],_0x25cf0a[_0x29d2('0x38')]);_0x4fb4c8[_0x29d2('0x3c')]=_['intersection'](_0x25cf0a[_0x29d2('0x35')],qs[_0x29d2('0x3d')](_0x34e02c[_0x29d2('0x38')][_0x29d2('0x3d')]));_0x4fb4c8['attributes']=_0x4fb4c8[_0x29d2('0x3c')][_0x29d2('0x3e')]?_0x4fb4c8[_0x29d2('0x3c')]:_0x25cf0a[_0x29d2('0x35')];if(!_0x34e02c[_0x29d2('0x38')][_0x29d2('0x3f')]('nolimit')){_0x4fb4c8[_0x29d2('0x2a')]=qs[_0x29d2('0x2a')](_0x34e02c[_0x29d2('0x38')][_0x29d2('0x2a')]);_0x4fb4c8[_0x29d2('0x29')]=qs[_0x29d2('0x29')](_0x34e02c[_0x29d2('0x38')][_0x29d2('0x29')]);}_0x4fb4c8[_0x29d2('0x40')]=qs[_0x29d2('0x41')](_0x34e02c['query'][_0x29d2('0x41')]);_0x4fb4c8[_0x29d2('0x42')]=qs[_0x29d2('0x3a')](_['pick'](_0x34e02c[_0x29d2('0x38')],_0x25cf0a[_0x29d2('0x3a')]),_0x5d5f52);if(_0x34e02c[_0x29d2('0x38')][_0x29d2('0x43')]){_0x4fb4c8['where']=_['merge'](_0x4fb4c8[_0x29d2('0x42')],{'$or':_[_0x29d2('0x36')](_0x5d5f52,function(_0x3bbba1){if(_0x3bbba1[_0x29d2('0x34')]!==_0x29d2('0x44')){var _0x2a33b8={};_0x2a33b8[_0x3bbba1[_0x29d2('0x37')]]={'$like':'%'+_0x34e02c[_0x29d2('0x38')]['filter']+'%'};return _0x2a33b8;}})});}_0x4fb4c8=_['merge']({},_0x4fb4c8,_0x34e02c[_0x29d2('0x45')]);var _0x5996ff={'where':_0x4fb4c8[_0x29d2('0x42')]};return db[_0x29d2('0x46')][_0x29d2('0x47')](_0x5996ff)[_0x29d2('0x19')](function(_0x1eceb9){_0x2a712a[_0x29d2('0x47')]=_0x1eceb9;if(_0x34e02c[_0x29d2('0x38')][_0x29d2('0x48')]){_0x4fb4c8[_0x29d2('0x49')]=[{'all':!![]}];}return db[_0x29d2('0x46')]['findAll'](_0x4fb4c8);})[_0x29d2('0x19')](function(_0x41dad0){_0x2a712a[_0x29d2('0x4a')]=_0x41dad0;return _0x2a712a;})[_0x29d2('0x19')](respondWithFilteredResult(_0x1d556c,_0x4fb4c8))[_0x29d2('0x24')](handleError(_0x1d556c,null));};exports['show']=function(_0x40022d,_0x5662fc){var _0x8da29a={'raw':![],'where':{'id':_0x40022d[_0x29d2('0x4b')]['id']}},_0x9f0206={};_0x9f0206[_0x29d2('0x35')]=_[_0x29d2('0x39')](db[_0x29d2('0x46')][_0x29d2('0x4c')]);_0x9f0206[_0x29d2('0x38')]=_['keys'](_0x40022d[_0x29d2('0x38')]);_0x9f0206[_0x29d2('0x3a')]=_[_0x29d2('0x3b')](_0x9f0206[_0x29d2('0x35')],_0x9f0206['query']);_0x8da29a['attributes']=_[_0x29d2('0x3b')](_0x9f0206[_0x29d2('0x35')],qs[_0x29d2('0x3d')](_0x40022d[_0x29d2('0x38')][_0x29d2('0x3d')]));_0x8da29a['attributes']=_0x8da29a[_0x29d2('0x3c')][_0x29d2('0x3e')]?_0x8da29a[_0x29d2('0x3c')]:_0x9f0206['model'];if(_0x40022d[_0x29d2('0x38')][_0x29d2('0x48')]){_0x8da29a['include']=[{'all':!![]}];}_0x8da29a=_[_0x29d2('0x4d')]({},_0x8da29a,_0x40022d[_0x29d2('0x45')]);return db['SalesforceConfiguration'][_0x29d2('0x4e')](_0x8da29a)[_0x29d2('0x19')](handleEntityNotFound(_0x5662fc,null))[_0x29d2('0x19')](respondWithResult(_0x5662fc,null))[_0x29d2('0x24')](handleError(_0x5662fc,null));};exports[_0x29d2('0x4f')]=function(_0x512dde,_0x9f961b){return db[_0x29d2('0x46')]['create'](_0x512dde[_0x29d2('0x50')],{})[_0x29d2('0x19')](respondWithResult(_0x9f961b,0xc9))['catch'](handleError(_0x9f961b,null));};exports['update']=function(_0xb97c83,_0x47d943){if(_0xb97c83[_0x29d2('0x50')]['id']){delete _0xb97c83['body']['id'];}return db[_0x29d2('0x46')][_0x29d2('0x4e')]({'where':{'id':_0xb97c83[_0x29d2('0x4b')]['id']}})[_0x29d2('0x19')](handleEntityNotFound(_0x47d943,null))[_0x29d2('0x19')](saveUpdates(_0xb97c83[_0x29d2('0x50')],null))[_0x29d2('0x19')](respondWithResult(_0x47d943,null))[_0x29d2('0x24')](handleError(_0x47d943,null));};exports[_0x29d2('0x2f')]=function(_0x4e4778,_0x4d39b1){return db[_0x29d2('0x46')]['find']({'where':{'id':_0x4e4778[_0x29d2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d39b1,null))[_0x29d2('0x19')](removeEntity(_0x4d39b1,null))[_0x29d2('0x24')](handleError(_0x4d39b1,null));};exports['getFields']=function(_0x9e3eeb,_0x44dedc,_0x49431c){var _0x34b8c1={};var _0x3373a5={};var _0x5c0be1;var _0x1fcc10;return db[_0x29d2('0x46')][_0x29d2('0x51')]({'where':{'id':_0x9e3eeb['params']['id']}})['then'](handleEntityNotFound(_0x44dedc,null))[_0x29d2('0x19')](function(_0x82a636){if(_0x82a636){_0x5c0be1=_0x82a636;_0x3373a5[_0x29d2('0x35')]=_[_0x29d2('0x39')](db[_0x29d2('0x52')][_0x29d2('0x4c')]);_0x3373a5[_0x29d2('0x38')]=_[_0x29d2('0x39')](_0x9e3eeb[_0x29d2('0x38')]);_0x3373a5[_0x29d2('0x3a')]=_[_0x29d2('0x3b')](_0x3373a5[_0x29d2('0x35')],_0x3373a5[_0x29d2('0x38')]);_0x34b8c1[_0x29d2('0x3c')]=_[_0x29d2('0x3b')](_0x3373a5[_0x29d2('0x35')],qs['fields'](_0x9e3eeb[_0x29d2('0x38')][_0x29d2('0x3d')]));_0x34b8c1[_0x29d2('0x3c')]=_0x34b8c1[_0x29d2('0x3c')][_0x29d2('0x3e')]?_0x34b8c1[_0x29d2('0x3c')]:_0x3373a5['model'];_0x34b8c1[_0x29d2('0x40')]=qs['sort'](_0x9e3eeb[_0x29d2('0x38')]['sort']);_0x34b8c1['where']=qs['filters'](_[_0x29d2('0x53')](_0x9e3eeb[_0x29d2('0x38')],_0x3373a5[_0x29d2('0x3a')]));if(_0x9e3eeb[_0x29d2('0x38')][_0x29d2('0x43')]){_0x34b8c1[_0x29d2('0x42')]=_[_0x29d2('0x4d')](_0x34b8c1[_0x29d2('0x42')],{'$or':_[_0x29d2('0x36')](_0x34b8c1[_0x29d2('0x3c')],function(_0x512727){var _0x2c354e={};_0x2c354e[_0x512727]={'$like':'%'+_0x9e3eeb['query'][_0x29d2('0x43')]+'%'};return _0x2c354e;})});}_0x34b8c1=_[_0x29d2('0x4d')]({},_0x34b8c1,_0x9e3eeb[_0x29d2('0x45')]);return _0x5c0be1['getFields'](_0x34b8c1);}})[_0x29d2('0x19')](function(_0x2ad83b){if(_0x2ad83b){_0x1fcc10=_0x2ad83b['length'];if(!_0x9e3eeb[_0x29d2('0x38')][_0x29d2('0x3f')](_0x29d2('0x54'))){_0x34b8c1[_0x29d2('0x2a')]=qs['limit'](_0x9e3eeb[_0x29d2('0x38')][_0x29d2('0x2a')]);_0x34b8c1[_0x29d2('0x29')]=qs[_0x29d2('0x29')](_0x9e3eeb[_0x29d2('0x38')][_0x29d2('0x29')]);}return _0x5c0be1[_0x29d2('0x55')](_0x34b8c1);}})[_0x29d2('0x19')](function(_0xa2b42a){if(_0xa2b42a){return _0xa2b42a?{'count':_0x1fcc10,'rows':_0xa2b42a}:null;}})['then'](respondWithResult(_0x44dedc,null))['catch'](handleError(_0x44dedc,null));};exports[_0x29d2('0x56')]=function(_0x506dd5,_0x24cbad,_0x39cdc4){var _0x58bff6={};var _0x15a105={};var _0x50e8e2;var _0x3f3715;return db[_0x29d2('0x46')]['findOne']({'where':{'id':_0x506dd5[_0x29d2('0x4b')]['id']}})[_0x29d2('0x19')](handleEntityNotFound(_0x24cbad,null))[_0x29d2('0x19')](function(_0x188285){if(_0x188285){_0x50e8e2=_0x188285;_0x15a105[_0x29d2('0x35')]=_['keys'](db[_0x29d2('0x52')][_0x29d2('0x4c')]);_0x15a105['query']=_['keys'](_0x506dd5[_0x29d2('0x38')]);_0x15a105[_0x29d2('0x3a')]=_[_0x29d2('0x3b')](_0x15a105['model'],_0x15a105[_0x29d2('0x38')]);_0x58bff6[_0x29d2('0x3c')]=_[_0x29d2('0x3b')](_0x15a105[_0x29d2('0x35')],qs['fields'](_0x506dd5[_0x29d2('0x38')][_0x29d2('0x3d')]));_0x58bff6[_0x29d2('0x3c')]=_0x58bff6[_0x29d2('0x3c')][_0x29d2('0x3e')]?_0x58bff6[_0x29d2('0x3c')]:_0x15a105[_0x29d2('0x35')];_0x58bff6['order']=qs[_0x29d2('0x41')](_0x506dd5[_0x29d2('0x38')][_0x29d2('0x41')]);_0x58bff6[_0x29d2('0x42')]=qs[_0x29d2('0x3a')](_[_0x29d2('0x53')](_0x506dd5[_0x29d2('0x38')],_0x15a105[_0x29d2('0x3a')]));if(_0x506dd5[_0x29d2('0x38')][_0x29d2('0x43')]){_0x58bff6[_0x29d2('0x42')]=_[_0x29d2('0x4d')](_0x58bff6['where'],{'$or':_[_0x29d2('0x36')](_0x58bff6[_0x29d2('0x3c')],function(_0x3cdb44){var _0x33763c={};_0x33763c[_0x3cdb44]={'$like':'%'+_0x506dd5['query'][_0x29d2('0x43')]+'%'};return _0x33763c;})});}_0x58bff6=_[_0x29d2('0x4d')]({},_0x58bff6,_0x506dd5[_0x29d2('0x45')]);return _0x50e8e2[_0x29d2('0x56')](_0x58bff6);}})[_0x29d2('0x19')](function(_0x53b46d){if(_0x53b46d){_0x3f3715=_0x53b46d[_0x29d2('0x3e')];if(!_0x506dd5[_0x29d2('0x38')][_0x29d2('0x3f')](_0x29d2('0x54'))){_0x58bff6[_0x29d2('0x2a')]=qs[_0x29d2('0x2a')](_0x506dd5['query'][_0x29d2('0x2a')]);_0x58bff6['offset']=qs['offset'](_0x506dd5[_0x29d2('0x38')][_0x29d2('0x29')]);}return _0x50e8e2[_0x29d2('0x56')](_0x58bff6);}})[_0x29d2('0x19')](function(_0x4316f3){if(_0x4316f3){return _0x4316f3?{'count':_0x3f3715,'rows':_0x4316f3}:null;}})[_0x29d2('0x19')](respondWithResult(_0x24cbad,null))[_0x29d2('0x24')](handleError(_0x24cbad,null));};exports[_0x29d2('0x57')]=function(_0x18540d,_0x457095,_0x26c60e){var _0x47be1f={};var _0x26ad92={};var _0x31cdd8;var _0x2a08da;return db[_0x29d2('0x46')][_0x29d2('0x51')]({'where':{'id':_0x18540d[_0x29d2('0x4b')]['id']}})[_0x29d2('0x19')](handleEntityNotFound(_0x457095,null))[_0x29d2('0x19')](function(_0x4b977c){if(_0x4b977c){_0x31cdd8=_0x4b977c;_0x26ad92[_0x29d2('0x35')]=_[_0x29d2('0x39')](db[_0x29d2('0x52')][_0x29d2('0x4c')]);_0x26ad92[_0x29d2('0x38')]=_[_0x29d2('0x39')](_0x18540d[_0x29d2('0x38')]);_0x26ad92[_0x29d2('0x3a')]=_[_0x29d2('0x3b')](_0x26ad92[_0x29d2('0x35')],_0x26ad92[_0x29d2('0x38')]);_0x47be1f['attributes']=_[_0x29d2('0x3b')](_0x26ad92[_0x29d2('0x35')],qs[_0x29d2('0x3d')](_0x18540d[_0x29d2('0x38')]['fields']));_0x47be1f[_0x29d2('0x3c')]=_0x47be1f[_0x29d2('0x3c')]['length']?_0x47be1f[_0x29d2('0x3c')]:_0x26ad92['model'];_0x47be1f[_0x29d2('0x40')]=qs['sort'](_0x18540d[_0x29d2('0x38')][_0x29d2('0x41')]);_0x47be1f[_0x29d2('0x42')]=qs[_0x29d2('0x3a')](_[_0x29d2('0x53')](_0x18540d['query'],_0x26ad92[_0x29d2('0x3a')]));if(_0x18540d[_0x29d2('0x38')][_0x29d2('0x43')]){_0x47be1f['where']=_[_0x29d2('0x4d')](_0x47be1f[_0x29d2('0x42')],{'$or':_[_0x29d2('0x36')](_0x47be1f[_0x29d2('0x3c')],function(_0x4fcd89){var _0x545c81={};_0x545c81[_0x4fcd89]={'$like':'%'+_0x18540d[_0x29d2('0x38')][_0x29d2('0x43')]+'%'};return _0x545c81;})});}_0x47be1f=_[_0x29d2('0x4d')]({},_0x47be1f,_0x18540d[_0x29d2('0x45')]);return _0x31cdd8[_0x29d2('0x57')](_0x47be1f);}})['then'](function(_0x1d7933){if(_0x1d7933){_0x2a08da=_0x1d7933[_0x29d2('0x3e')];if(!_0x18540d[_0x29d2('0x38')][_0x29d2('0x3f')]('nolimit')){_0x47be1f[_0x29d2('0x2a')]=qs[_0x29d2('0x2a')](_0x18540d[_0x29d2('0x38')][_0x29d2('0x2a')]);_0x47be1f['offset']=qs[_0x29d2('0x29')](_0x18540d[_0x29d2('0x38')]['offset']);}return _0x31cdd8[_0x29d2('0x57')](_0x47be1f);}})[_0x29d2('0x19')](function(_0x8c0080){if(_0x8c0080){return _0x8c0080?{'count':_0x2a08da,'rows':_0x8c0080}:null;}})[_0x29d2('0x19')](respondWithResult(_0x457095,null))[_0x29d2('0x24')](handleError(_0x457095,null));}; \ No newline at end of file +var _0xdf48=['../../config/license/util','jayson/promise','client','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','count','includeAll','include','rows','show','params','SalesforceConfiguration','merge','options','find','catch','body','getFields','SalesforceField','nolimit','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x3ad133,_0x377068){var _0x33b86a=function(_0xda36c2){while(--_0xda36c2){_0x3ad133['push'](_0x3ad133['shift']());}};_0x33b86a(++_0x377068);}(_0xdf48,0x1f3));var _0x8df4=function(_0x1aef7f,_0x301b8c){_0x1aef7f=_0x1aef7f-0x0;var _0x44b4a8=_0xdf48[_0x1aef7f];return _0x44b4a8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8df4('0x0'));var zipdir=require(_0x8df4('0x1'));var jsonpatch=require(_0x8df4('0x2'));var rp=require(_0x8df4('0x3'));var moment=require(_0x8df4('0x4'));var BPromise=require(_0x8df4('0x5'));var Mustache=require(_0x8df4('0x6'));var util=require(_0x8df4('0x7'));var path=require(_0x8df4('0x8'));var sox=require('sox');var csv=require(_0x8df4('0x9'));var ejs=require(_0x8df4('0xa'));var fs=require('fs');var _=require(_0x8df4('0xb'));var squel=require(_0x8df4('0xc'));var crypto=require('crypto');var jsforce=require(_0x8df4('0xd'));var deskjs=require(_0x8df4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8df4('0xf'));var Papa=require('papaparse');var Redis=require(_0x8df4('0x10'));var authService=require(_0x8df4('0x11'));var qs=require(_0x8df4('0x12'));var as=require(_0x8df4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8df4('0x14'))(_0x8df4('0x15'));var utils=require(_0x8df4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8df4('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8df4('0x18'));var client=jayson[_0x8df4('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56deb1,_0x129903,_0xff8cc,_0xea66e4){return new BPromise(function(_0x1833bf,_0x528475){var _0x2b4c4c=_0xea66e4||client;return _0x2b4c4c[_0x8df4('0x1a')](_0x56deb1,_0xff8cc)['then'](function(_0x56f3f5){logger['info'](_0x8df4('0x1b'),_0x129903,_0x8df4('0x1c'));logger['debug'](_0x8df4('0x1d'),_0x129903,_0x8df4('0x1c'),JSON['stringify'](_0x56f3f5));if(_0x56f3f5[_0x8df4('0x1e')]){if(_0x56f3f5[_0x8df4('0x1e')]['code']===0x1f4){logger['error'](_0x8df4('0x1b'),_0x129903,_0x56f3f5[_0x8df4('0x1e')][_0x8df4('0x1f')]);return _0x528475(_0x56f3f5[_0x8df4('0x1e')]['message']);}logger['error'](_0x8df4('0x1b'),_0x129903,_0x56f3f5[_0x8df4('0x1e')][_0x8df4('0x1f')]);return _0x1833bf(_0x56f3f5[_0x8df4('0x1e')][_0x8df4('0x1f')]);}else{logger['info'](_0x8df4('0x1b'),_0x129903,'request\x20sent');_0x1833bf(_0x56f3f5[_0x8df4('0x20')]['message']);}})['catch'](function(_0x3f9282){logger[_0x8df4('0x1e')](_0x8df4('0x1b'),_0x129903,_0x3f9282);_0x528475(_0x3f9282);});});}function respondWithStatusCode(_0x1e112c,_0x33307a){_0x33307a=_0x33307a||0xcc;return function(_0x2b806e){if(_0x2b806e){return _0x1e112c[_0x8df4('0x21')](_0x33307a);}return _0x1e112c[_0x8df4('0x22')](_0x33307a)[_0x8df4('0x23')]();};}function respondWithResult(_0xf87aad,_0x4e78bd){_0x4e78bd=_0x4e78bd||0xc8;return function(_0x50c889){if(_0x50c889){return _0xf87aad['status'](_0x4e78bd)[_0x8df4('0x24')](_0x50c889);}};}function respondWithFilteredResult(_0x4dbe0a,_0xa00f5f){return function(_0x4f8133){if(_0x4f8133){var _0x1e8aa3=_0x4f8133['count'],_0x1a08c2=_0xa00f5f[_0x8df4('0x25')],_0x1a319d=_0xa00f5f['offset']+_0xa00f5f[_0x8df4('0x26')],_0x2a37ec;if(_0x1a319d>=_0x1e8aa3){_0x1a319d=_0x1e8aa3;_0x2a37ec=0xc8;}else{_0x2a37ec=0xce;}_0x4dbe0a[_0x8df4('0x22')](_0x2a37ec);return _0x4dbe0a[_0x8df4('0x27')](_0x8df4('0x28'),_0x1a08c2+'-'+_0x1a319d+'/'+_0x1e8aa3)[_0x8df4('0x24')](_0x4f8133);}return null;};}function patchUpdates(_0xb0fdf9){return function(_0x36a4b2){try{jsonpatch[_0x8df4('0x29')](_0x36a4b2,_0xb0fdf9,!![]);}catch(_0x31badd){return BPromise['reject'](_0x31badd);}return _0x36a4b2[_0x8df4('0x2a')]();};}function saveUpdates(_0x780639,_0x3de259){return function(_0x4c2f17){if(_0x4c2f17){return _0x4c2f17['update'](_0x780639)['then'](function(_0x404427){return _0x404427;});}return null;};}function removeEntity(_0x1c1aef,_0x2aee35){return function(_0x36b209){if(_0x36b209){return _0x36b209[_0x8df4('0x2b')]()[_0x8df4('0x2c')](function(){_0x1c1aef[_0x8df4('0x22')](0xcc)[_0x8df4('0x23')]();});}};}function handleEntityNotFound(_0x8ea296,_0x17e59c){return function(_0x18d2a2){if(!_0x18d2a2){_0x8ea296[_0x8df4('0x21')](0x194);}return _0x18d2a2;};}function handleError(_0x5f43a4,_0x111784){_0x111784=_0x111784||0x1f4;return function(_0x1b528c){logger[_0x8df4('0x1e')](_0x1b528c[_0x8df4('0x2d')]);if(_0x1b528c[_0x8df4('0x2e')]){delete _0x1b528c['name'];}_0x5f43a4[_0x8df4('0x22')](_0x111784)[_0x8df4('0x2f')](_0x1b528c);};}exports[_0x8df4('0x30')]=function(_0x4a6feb,_0x4d97a3){var _0x333047={},_0x456a26={},_0x54f4cf={'count':0x0,'rows':[]};var _0x27dad9=_[_0x8df4('0x31')](db['SalesforceConfiguration'][_0x8df4('0x32')],function(_0x1a54f1){return{'name':_0x1a54f1[_0x8df4('0x33')],'type':_0x1a54f1[_0x8df4('0x34')][_0x8df4('0x35')]};});_0x456a26[_0x8df4('0x36')]=_[_0x8df4('0x31')](_0x27dad9,_0x8df4('0x2e'));_0x456a26[_0x8df4('0x37')]=_[_0x8df4('0x38')](_0x4a6feb[_0x8df4('0x37')]);_0x456a26[_0x8df4('0x39')]=_[_0x8df4('0x3a')](_0x456a26[_0x8df4('0x36')],_0x456a26['query']);_0x333047[_0x8df4('0x3b')]=_[_0x8df4('0x3a')](_0x456a26[_0x8df4('0x36')],qs[_0x8df4('0x3c')](_0x4a6feb[_0x8df4('0x37')][_0x8df4('0x3c')]));_0x333047[_0x8df4('0x3b')]=_0x333047[_0x8df4('0x3b')][_0x8df4('0x3d')]?_0x333047[_0x8df4('0x3b')]:_0x456a26[_0x8df4('0x36')];if(!_0x4a6feb[_0x8df4('0x37')][_0x8df4('0x3e')]('nolimit')){_0x333047['limit']=qs['limit'](_0x4a6feb[_0x8df4('0x37')][_0x8df4('0x26')]);_0x333047[_0x8df4('0x25')]=qs[_0x8df4('0x25')](_0x4a6feb[_0x8df4('0x37')]['offset']);}_0x333047[_0x8df4('0x3f')]=qs[_0x8df4('0x40')](_0x4a6feb['query'][_0x8df4('0x40')]);_0x333047['where']=qs[_0x8df4('0x39')](_[_0x8df4('0x41')](_0x4a6feb[_0x8df4('0x37')],_0x456a26[_0x8df4('0x39')]),_0x27dad9);if(_0x4a6feb[_0x8df4('0x37')][_0x8df4('0x42')]){_0x333047['where']=_['merge'](_0x333047[_0x8df4('0x43')],{'$or':_[_0x8df4('0x31')](_0x27dad9,function(_0x4b5e20){if(_0x4b5e20['type']!==_0x8df4('0x44')){var _0x3660be={};_0x3660be[_0x4b5e20[_0x8df4('0x2e')]]={'$like':'%'+_0x4a6feb[_0x8df4('0x37')][_0x8df4('0x42')]+'%'};return _0x3660be;}})});}_0x333047=_['merge']({},_0x333047,_0x4a6feb['options']);var _0x4b6428={'where':_0x333047[_0x8df4('0x43')]};return db['SalesforceConfiguration']['count'](_0x4b6428)[_0x8df4('0x2c')](function(_0x17ed90){_0x54f4cf[_0x8df4('0x45')]=_0x17ed90;if(_0x4a6feb[_0x8df4('0x37')][_0x8df4('0x46')]){_0x333047[_0x8df4('0x47')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x333047);})[_0x8df4('0x2c')](function(_0x39749c){_0x54f4cf[_0x8df4('0x48')]=_0x39749c;return _0x54f4cf;})[_0x8df4('0x2c')](respondWithFilteredResult(_0x4d97a3,_0x333047))['catch'](handleError(_0x4d97a3,null));};exports[_0x8df4('0x49')]=function(_0x2826ea,_0x489e48){var _0x31cfe2={'raw':![],'where':{'id':_0x2826ea[_0x8df4('0x4a')]['id']}},_0x167c89={};_0x167c89['model']=_['keys'](db[_0x8df4('0x4b')][_0x8df4('0x32')]);_0x167c89['query']=_['keys'](_0x2826ea[_0x8df4('0x37')]);_0x167c89[_0x8df4('0x39')]=_['intersection'](_0x167c89[_0x8df4('0x36')],_0x167c89[_0x8df4('0x37')]);_0x31cfe2[_0x8df4('0x3b')]=_[_0x8df4('0x3a')](_0x167c89[_0x8df4('0x36')],qs[_0x8df4('0x3c')](_0x2826ea[_0x8df4('0x37')][_0x8df4('0x3c')]));_0x31cfe2[_0x8df4('0x3b')]=_0x31cfe2['attributes']['length']?_0x31cfe2[_0x8df4('0x3b')]:_0x167c89[_0x8df4('0x36')];if(_0x2826ea[_0x8df4('0x37')][_0x8df4('0x46')]){_0x31cfe2['include']=[{'all':!![]}];}_0x31cfe2=_[_0x8df4('0x4c')]({},_0x31cfe2,_0x2826ea[_0x8df4('0x4d')]);return db['SalesforceConfiguration'][_0x8df4('0x4e')](_0x31cfe2)[_0x8df4('0x2c')](handleEntityNotFound(_0x489e48,null))[_0x8df4('0x2c')](respondWithResult(_0x489e48,null))['catch'](handleError(_0x489e48,null));};exports['create']=function(_0x104970,_0x466960){return db[_0x8df4('0x4b')]['create'](_0x104970['body'],{})['then'](respondWithResult(_0x466960,0xc9))[_0x8df4('0x4f')](handleError(_0x466960,null));};exports['update']=function(_0x75efdb,_0x148cd8){if(_0x75efdb[_0x8df4('0x50')]['id']){delete _0x75efdb['body']['id'];}return db[_0x8df4('0x4b')][_0x8df4('0x4e')]({'where':{'id':_0x75efdb[_0x8df4('0x4a')]['id']}})[_0x8df4('0x2c')](handleEntityNotFound(_0x148cd8,null))[_0x8df4('0x2c')](saveUpdates(_0x75efdb[_0x8df4('0x50')],null))[_0x8df4('0x2c')](respondWithResult(_0x148cd8,null))[_0x8df4('0x4f')](handleError(_0x148cd8,null));};exports['destroy']=function(_0x1216b1,_0x2b0e6f){return db[_0x8df4('0x4b')]['find']({'where':{'id':_0x1216b1[_0x8df4('0x4a')]['id']}})[_0x8df4('0x2c')](handleEntityNotFound(_0x2b0e6f,null))[_0x8df4('0x2c')](removeEntity(_0x2b0e6f,null))['catch'](handleError(_0x2b0e6f,null));};exports[_0x8df4('0x51')]=function(_0x510265,_0x3e31fa,_0x2104e9){var _0x4c179b={};var _0x471e65={};var _0x1457d2;var _0x1911fd;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x510265[_0x8df4('0x4a')]['id']}})[_0x8df4('0x2c')](handleEntityNotFound(_0x3e31fa,null))['then'](function(_0x8f456d){if(_0x8f456d){_0x1457d2=_0x8f456d;_0x471e65['model']=_[_0x8df4('0x38')](db[_0x8df4('0x52')][_0x8df4('0x32')]);_0x471e65[_0x8df4('0x37')]=_[_0x8df4('0x38')](_0x510265[_0x8df4('0x37')]);_0x471e65[_0x8df4('0x39')]=_[_0x8df4('0x3a')](_0x471e65[_0x8df4('0x36')],_0x471e65[_0x8df4('0x37')]);_0x4c179b[_0x8df4('0x3b')]=_[_0x8df4('0x3a')](_0x471e65[_0x8df4('0x36')],qs[_0x8df4('0x3c')](_0x510265[_0x8df4('0x37')]['fields']));_0x4c179b[_0x8df4('0x3b')]=_0x4c179b['attributes'][_0x8df4('0x3d')]?_0x4c179b[_0x8df4('0x3b')]:_0x471e65['model'];_0x4c179b[_0x8df4('0x3f')]=qs[_0x8df4('0x40')](_0x510265[_0x8df4('0x37')][_0x8df4('0x40')]);_0x4c179b[_0x8df4('0x43')]=qs['filters'](_[_0x8df4('0x41')](_0x510265[_0x8df4('0x37')],_0x471e65['filters']));if(_0x510265[_0x8df4('0x37')]['filter']){_0x4c179b[_0x8df4('0x43')]=_[_0x8df4('0x4c')](_0x4c179b['where'],{'$or':_[_0x8df4('0x31')](_0x4c179b['attributes'],function(_0x194449){var _0x59817e={};_0x59817e[_0x194449]={'$like':'%'+_0x510265[_0x8df4('0x37')][_0x8df4('0x42')]+'%'};return _0x59817e;})});}_0x4c179b=_['merge']({},_0x4c179b,_0x510265[_0x8df4('0x4d')]);return _0x1457d2[_0x8df4('0x51')](_0x4c179b);}})['then'](function(_0x32c788){if(_0x32c788){_0x1911fd=_0x32c788[_0x8df4('0x3d')];if(!_0x510265[_0x8df4('0x37')][_0x8df4('0x3e')](_0x8df4('0x53'))){_0x4c179b[_0x8df4('0x26')]=qs[_0x8df4('0x26')](_0x510265['query']['limit']);_0x4c179b['offset']=qs['offset'](_0x510265[_0x8df4('0x37')][_0x8df4('0x25')]);}return _0x1457d2[_0x8df4('0x51')](_0x4c179b);}})[_0x8df4('0x2c')](function(_0x404b93){if(_0x404b93){return _0x404b93?{'count':_0x1911fd,'rows':_0x404b93}:null;}})[_0x8df4('0x2c')](respondWithResult(_0x3e31fa,null))['catch'](handleError(_0x3e31fa,null));};exports[_0x8df4('0x54')]=function(_0xe6ccd4,_0x4a85d9,_0x36e482){var _0x3750e5={};var _0x1716e5={};var _0x132fc0;var _0x1153aa;return db[_0x8df4('0x4b')][_0x8df4('0x55')]({'where':{'id':_0xe6ccd4[_0x8df4('0x4a')]['id']}})[_0x8df4('0x2c')](handleEntityNotFound(_0x4a85d9,null))[_0x8df4('0x2c')](function(_0x13f8eb){if(_0x13f8eb){_0x132fc0=_0x13f8eb;_0x1716e5[_0x8df4('0x36')]=_[_0x8df4('0x38')](db[_0x8df4('0x52')][_0x8df4('0x32')]);_0x1716e5['query']=_[_0x8df4('0x38')](_0xe6ccd4[_0x8df4('0x37')]);_0x1716e5[_0x8df4('0x39')]=_[_0x8df4('0x3a')](_0x1716e5[_0x8df4('0x36')],_0x1716e5[_0x8df4('0x37')]);_0x3750e5['attributes']=_[_0x8df4('0x3a')](_0x1716e5['model'],qs['fields'](_0xe6ccd4['query'][_0x8df4('0x3c')]));_0x3750e5['attributes']=_0x3750e5[_0x8df4('0x3b')][_0x8df4('0x3d')]?_0x3750e5[_0x8df4('0x3b')]:_0x1716e5[_0x8df4('0x36')];_0x3750e5['order']=qs['sort'](_0xe6ccd4['query'][_0x8df4('0x40')]);_0x3750e5[_0x8df4('0x43')]=qs[_0x8df4('0x39')](_[_0x8df4('0x41')](_0xe6ccd4[_0x8df4('0x37')],_0x1716e5['filters']));if(_0xe6ccd4['query'][_0x8df4('0x42')]){_0x3750e5[_0x8df4('0x43')]=_[_0x8df4('0x4c')](_0x3750e5[_0x8df4('0x43')],{'$or':_['map'](_0x3750e5[_0x8df4('0x3b')],function(_0x2252bd){var _0x2aa6ee={};_0x2aa6ee[_0x2252bd]={'$like':'%'+_0xe6ccd4['query'][_0x8df4('0x42')]+'%'};return _0x2aa6ee;})});}_0x3750e5=_[_0x8df4('0x4c')]({},_0x3750e5,_0xe6ccd4[_0x8df4('0x4d')]);return _0x132fc0[_0x8df4('0x54')](_0x3750e5);}})['then'](function(_0x44859c){if(_0x44859c){_0x1153aa=_0x44859c['length'];if(!_0xe6ccd4[_0x8df4('0x37')][_0x8df4('0x3e')](_0x8df4('0x53'))){_0x3750e5['limit']=qs[_0x8df4('0x26')](_0xe6ccd4[_0x8df4('0x37')][_0x8df4('0x26')]);_0x3750e5['offset']=qs[_0x8df4('0x25')](_0xe6ccd4[_0x8df4('0x37')][_0x8df4('0x25')]);}return _0x132fc0[_0x8df4('0x54')](_0x3750e5);}})[_0x8df4('0x2c')](function(_0x3e9eea){if(_0x3e9eea){return _0x3e9eea?{'count':_0x1153aa,'rows':_0x3e9eea}:null;}})['then'](respondWithResult(_0x4a85d9,null))[_0x8df4('0x4f')](handleError(_0x4a85d9,null));};exports[_0x8df4('0x56')]=function(_0x2ee642,_0x59e616,_0x1cad7c){var _0x25453a={};var _0xdd1418={};var _0x41fce8;var _0x300048;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x2ee642[_0x8df4('0x4a')]['id']}})[_0x8df4('0x2c')](handleEntityNotFound(_0x59e616,null))[_0x8df4('0x2c')](function(_0x5ef2b7){if(_0x5ef2b7){_0x41fce8=_0x5ef2b7;_0xdd1418[_0x8df4('0x36')]=_['keys'](db['SalesforceField']['rawAttributes']);_0xdd1418[_0x8df4('0x37')]=_['keys'](_0x2ee642['query']);_0xdd1418[_0x8df4('0x39')]=_[_0x8df4('0x3a')](_0xdd1418[_0x8df4('0x36')],_0xdd1418[_0x8df4('0x37')]);_0x25453a[_0x8df4('0x3b')]=_[_0x8df4('0x3a')](_0xdd1418[_0x8df4('0x36')],qs[_0x8df4('0x3c')](_0x2ee642[_0x8df4('0x37')][_0x8df4('0x3c')]));_0x25453a[_0x8df4('0x3b')]=_0x25453a['attributes'][_0x8df4('0x3d')]?_0x25453a[_0x8df4('0x3b')]:_0xdd1418['model'];_0x25453a[_0x8df4('0x3f')]=qs[_0x8df4('0x40')](_0x2ee642[_0x8df4('0x37')][_0x8df4('0x40')]);_0x25453a[_0x8df4('0x43')]=qs[_0x8df4('0x39')](_[_0x8df4('0x41')](_0x2ee642['query'],_0xdd1418[_0x8df4('0x39')]));if(_0x2ee642['query']['filter']){_0x25453a[_0x8df4('0x43')]=_[_0x8df4('0x4c')](_0x25453a[_0x8df4('0x43')],{'$or':_['map'](_0x25453a[_0x8df4('0x3b')],function(_0x456602){var _0x2f7d2a={};_0x2f7d2a[_0x456602]={'$like':'%'+_0x2ee642['query'][_0x8df4('0x42')]+'%'};return _0x2f7d2a;})});}_0x25453a=_[_0x8df4('0x4c')]({},_0x25453a,_0x2ee642[_0x8df4('0x4d')]);return _0x41fce8[_0x8df4('0x56')](_0x25453a);}})[_0x8df4('0x2c')](function(_0x38f9b9){if(_0x38f9b9){_0x300048=_0x38f9b9[_0x8df4('0x3d')];if(!_0x2ee642['query'][_0x8df4('0x3e')](_0x8df4('0x53'))){_0x25453a['limit']=qs[_0x8df4('0x26')](_0x2ee642[_0x8df4('0x37')]['limit']);_0x25453a['offset']=qs[_0x8df4('0x25')](_0x2ee642[_0x8df4('0x37')][_0x8df4('0x25')]);}return _0x41fce8[_0x8df4('0x56')](_0x25453a);}})[_0x8df4('0x2c')](function(_0x296871){if(_0x296871){return _0x296871?{'count':_0x300048,'rows':_0x296871}:null;}})[_0x8df4('0x2c')](respondWithResult(_0x59e616,null))[_0x8df4('0x4f')](handleError(_0x59e616,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index ed110f3..9359127 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 _0x2754=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','int_salesforce_configurations','lodash','util'];(function(_0x1e5adb,_0x1b7a61){var _0x1af18d=function(_0x33a3cc){while(--_0x33a3cc){_0x1e5adb['push'](_0x1e5adb['shift']());}};_0x1af18d(++_0x1b7a61);}(_0x2754,0x148));var _0x4275=function(_0x30755e,_0x4d06f8){_0x30755e=_0x30755e-0x0;var _0x3ef4b1=_0x2754[_0x30755e];return _0x3ef4b1;};'use strict';var _=require(_0x4275('0x0'));var util=require(_0x4275('0x1'));var logger=require(_0x4275('0x2'))('api');var moment=require(_0x4275('0x3'));var BPromise=require(_0x4275('0x4'));var rp=require(_0x4275('0x5'));var fs=require('fs');var path=require(_0x4275('0x6'));var rimraf=require(_0x4275('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0x4275('0x8')]=function(_0x415057,_0x5e5f14){return _0x415057[_0x4275('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0x4275('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcb2=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','util','api','moment','bluebird','request-promise'];(function(_0xb7bcd2,_0x390f1a){var _0x535771=function(_0x222e83){while(--_0x222e83){_0xb7bcd2['push'](_0xb7bcd2['shift']());}};_0x535771(++_0x390f1a);}(_0xbcb2,0x73));var _0x2bcb=function(_0x1645b0,_0x13d822){_0x1645b0=_0x1645b0-0x0;var _0x3f8da8=_0xbcb2[_0x1645b0];return _0x3f8da8;};'use strict';var _=require('lodash');var util=require(_0x2bcb('0x0'));var logger=require('../../config/logger')(_0x2bcb('0x1'));var moment=require(_0x2bcb('0x2'));var BPromise=require(_0x2bcb('0x3'));var rp=require(_0x2bcb('0x4'));var fs=require('fs');var path=require(_0x2bcb('0x5'));var rimraf=require(_0x2bcb('0x6'));var config=require(_0x2bcb('0x7'));var attributes=require(_0x2bcb('0x8'));module[_0x2bcb('0x9')]=function(_0x4e2c78,_0x538156){return _0x4e2c78[_0x2bcb('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x2bcb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 589554c..a2cc7e7 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 _0x5ce7=['http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x5ce7,0x110));var _0x75ce=function(_0x4e8022,_0x53229d){_0x4e8022=_0x4e8022-0x0;var _0xf5e73f=_0x5ce7[_0x4e8022];return _0xf5e73f;};'use strict';var _=require(_0x75ce('0x0'));var util=require(_0x75ce('0x1'));var moment=require(_0x75ce('0x2'));var BPromise=require(_0x75ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75ce('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x75ce('0x5'))(_0x75ce('0x6'));var config=require('../../config/environment');var jayson=require(_0x75ce('0x7'));var client=jayson['client'][_0x75ce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c0309,_0x5c4b51,_0x18fc6b){return new BPromise(function(_0x46a1be,_0x5c72a0){return client[_0x75ce('0x9')](_0x1c0309,_0x18fc6b)[_0x75ce('0xa')](function(_0x2c8618){logger[_0x75ce('0xb')](_0x75ce('0xc'),_0x5c4b51,_0x75ce('0xd'));logger['debug'](_0x75ce('0xe'),_0x5c4b51,'request\x20sent',JSON['stringify'](_0x2c8618));if(_0x2c8618[_0x75ce('0xf')]){if(_0x2c8618[_0x75ce('0xf')][_0x75ce('0x10')]===0x1f4){logger[_0x75ce('0xf')](_0x75ce('0xc'),_0x5c4b51,_0x2c8618['error'][_0x75ce('0x11')]);return _0x5c72a0(_0x2c8618[_0x75ce('0xf')][_0x75ce('0x11')]);}logger['error'](_0x75ce('0xc'),_0x5c4b51,_0x2c8618[_0x75ce('0xf')][_0x75ce('0x11')]);return _0x46a1be(_0x2c8618[_0x75ce('0xf')]['message']);}else{logger[_0x75ce('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5c4b51,_0x75ce('0xd'));_0x46a1be(_0x2c8618[_0x75ce('0x12')]['message']);}})[_0x75ce('0x13')](function(_0x414708){logger['error'](_0x75ce('0xc'),_0x5c4b51,_0x414708);_0x5c72a0(_0x414708);});});} \ No newline at end of file +var _0x9717=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0xdcc3c2,_0xa52871){var _0x4862e9=function(_0x28d356){while(--_0x28d356){_0xdcc3c2['push'](_0xdcc3c2['shift']());}};_0x4862e9(++_0xa52871);}(_0x9717,0xad));var _0x7971=function(_0x1120e6,_0xb4d51b){_0x1120e6=_0x1120e6-0x0;var _0x2d7477=_0x9717[_0x1120e6];return _0x2d7477;};'use strict';var _=require(_0x7971('0x0'));var util=require('util');var moment=require(_0x7971('0x1'));var BPromise=require('bluebird');var rs=require(_0x7971('0x2'));var fs=require('fs');var Redis=require(_0x7971('0x3'));var db=require(_0x7971('0x4'))['db'];var utils=require(_0x7971('0x5'));var logger=require('../../config/logger')(_0x7971('0x6'));var config=require('../../config/environment');var jayson=require(_0x7971('0x7'));var client=jayson['client'][_0x7971('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a7062,_0x117e8a,_0x276f79){return new BPromise(function(_0x135a8d,_0x5d84f1){return client['request'](_0x2a7062,_0x276f79)['then'](function(_0x47acaa){logger['info'](_0x7971('0x9'),_0x117e8a,_0x7971('0xa'));logger[_0x7971('0xb')](_0x7971('0xc'),_0x117e8a,_0x7971('0xa'),JSON['stringify'](_0x47acaa));if(_0x47acaa[_0x7971('0xd')]){if(_0x47acaa[_0x7971('0xd')][_0x7971('0xe')]===0x1f4){logger[_0x7971('0xd')](_0x7971('0x9'),_0x117e8a,_0x47acaa['error'][_0x7971('0xf')]);return _0x5d84f1(_0x47acaa[_0x7971('0xd')][_0x7971('0xf')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x117e8a,_0x47acaa[_0x7971('0xd')][_0x7971('0xf')]);return _0x135a8d(_0x47acaa[_0x7971('0xd')]['message']);}else{logger[_0x7971('0x10')](_0x7971('0x9'),_0x117e8a,_0x7971('0xa'));_0x135a8d(_0x47acaa[_0x7971('0x11')][_0x7971('0xf')]);}})[_0x7971('0x12')](function(_0x526c90){logger[_0x7971('0xd')](_0x7971('0x9'),_0x117e8a,_0x526c90);_0x5d84f1(_0x526c90);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4284cb6..f8b8cb4 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 _0xcd59=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0xd5f774,_0x1dd36e){var _0x49da10=function(_0x540221){while(--_0x540221){_0xd5f774['push'](_0xd5f774['shift']());}};_0x49da10(++_0x1dd36e);}(_0xcd59,0x14b));var _0x9cd5=function(_0xa1e2fd,_0x1c9305){_0xa1e2fd=_0xa1e2fd-0x0;var _0x218880=_0xcd59[_0xa1e2fd];return _0x218880;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9cd5('0x6'));var config=require(_0x9cd5('0x7'));var controller=require(_0x9cd5('0x8'));router[_0x9cd5('0x9')]('/',auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xb')]);router[_0x9cd5('0x9')](_0x9cd5('0xc'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xd')]);router['post']('/',auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xe')]);router[_0x9cd5('0xf')](_0x9cd5('0xc'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x10')]);router[_0x9cd5('0x11')](_0x9cd5('0xc'),auth['isAuthenticated'](),controller[_0x9cd5('0x12')]);module[_0x9cd5('0x13')]=router; \ No newline at end of file +var _0x01d9=['../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x18b344,_0x271f68){var _0x5ef6bb=function(_0x3345b3){while(--_0x3345b3){_0x18b344['push'](_0x18b344['shift']());}};_0x5ef6bb(++_0x271f68);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var auth=require(_0x901d('0x5'));var interaction=require(_0x901d('0x6'));var config=require(_0x901d('0x7'));var controller=require(_0x901d('0x8'));router[_0x901d('0x9')]('/',auth[_0x901d('0xa')](),controller['index']);router[_0x901d('0x9')](_0x901d('0xb'),auth[_0x901d('0xa')](),controller[_0x901d('0xc')]);router[_0x901d('0xd')]('/',auth[_0x901d('0xa')](),controller[_0x901d('0xe')]);router[_0x901d('0xf')](_0x901d('0xb'),auth[_0x901d('0xa')](),controller[_0x901d('0x10')]);router[_0x901d('0x11')](_0x901d('0xb'),auth['isAuthenticated'](),controller[_0x901d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 53546e6..df54a06 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 _0x581d=['string','variable','keyValue','STRING','customVariable','sequelize','exports','ENUM'];(function(_0x17f344,_0xa09d21){var _0x38bd16=function(_0x533cfc){while(--_0x533cfc){_0x17f344['push'](_0x17f344['shift']());}};_0x38bd16(++_0xa09d21);}(_0x581d,0x18d));var _0xd581=function(_0x576b10,_0x4644d8){_0x576b10=_0x576b10-0x0;var _0x225613=_0x581d[_0x576b10];return _0x225613;};'use strict';var Sequelize=require(_0xd581('0x0'));module[_0xd581('0x1')]={'type':{'type':Sequelize[_0xd581('0x2')](_0xd581('0x3'),_0xd581('0x4'),'customVariable',_0xd581('0x5')),'defaultValue':_0xd581('0x3')},'content':{'type':Sequelize[_0xd581('0x6')]},'key':{'type':Sequelize[_0xd581('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xd581('0x4'),_0xd581('0x7'))},'keyContent':{'type':Sequelize[_0xd581('0x6')]},'idField':{'type':Sequelize[_0xd581('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7de7=['ENUM','string','sequelize','exports','variable','customVariable','keyValue','STRING'];(function(_0x199b33,_0x160867){var _0x138e85=function(_0x1d6814){while(--_0x1d6814){_0x199b33['push'](_0x199b33['shift']());}};_0x138e85(++_0x160867);}(_0x7de7,0x13a));var _0x77de=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x7de7[_0x5bd4f6];return _0x33a165;};'use strict';var Sequelize=require(_0x77de('0x0'));module[_0x77de('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x77de('0x2'),_0x77de('0x3'),_0x77de('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x77de('0x5')]},'key':{'type':Sequelize[_0x77de('0x5')]},'keyType':{'type':Sequelize[_0x77de('0x6')](_0x77de('0x7'),_0x77de('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x77de('0x5')]},'idField':{'type':Sequelize[_0x77de('0x5')]},'variableName':{'type':Sequelize[_0x77de('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 7f41cb8..f934be4 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 _0x5065=['end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','status'];(function(_0x40a816,_0x1b5043){var _0xd3ce15=function(_0x38d825){while(--_0x38d825){_0x40a816['push'](_0x40a816['shift']());}};_0xd3ce15(++_0x1b5043);}(_0x5065,0x107));var _0x5506=function(_0x56bff3,_0x108f4f){_0x56bff3=_0x56bff3-0x0;var _0xec8d8b=_0x5065[_0x56bff3];return _0xec8d8b;};'use strict';var pdf=require(_0x5506('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5506('0x1'));var zipdir=require(_0x5506('0x2'));var jsonpatch=require(_0x5506('0x3'));var rp=require(_0x5506('0x4'));var moment=require(_0x5506('0x5'));var BPromise=require(_0x5506('0x6'));var Mustache=require(_0x5506('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5506('0x8'));var csv=require(_0x5506('0x9'));var ejs=require(_0x5506('0xa'));var fs=require('fs');var _=require(_0x5506('0xb'));var squel=require(_0x5506('0xc'));var crypto=require('crypto');var jsforce=require(_0x5506('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5506('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5506('0xe'));var authService=require(_0x5506('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5506('0x10'));var logger=require(_0x5506('0x11'))(_0x5506('0x12'));var utils=require('../../config/utils');var config=require(_0x5506('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x303738,_0x4062bc){_0x4062bc=_0x4062bc||0xcc;return function(_0x2d7da8){if(_0x2d7da8){return _0x303738['sendStatus'](_0x4062bc);}return _0x303738[_0x5506('0x14')](_0x4062bc)[_0x5506('0x15')]();};}function respondWithResult(_0x2fed0b,_0x2f9581){_0x2f9581=_0x2f9581||0xc8;return function(_0x24ec2b){if(_0x24ec2b){return _0x2fed0b[_0x5506('0x14')](_0x2f9581)[_0x5506('0x16')](_0x24ec2b);}};}function respondWithFilteredResult(_0x1ba8df,_0x1438b0){return function(_0xb65d60){if(_0xb65d60){var _0x5f4508=_0xb65d60[_0x5506('0x17')],_0x9d3ac4=_0x1438b0[_0x5506('0x18')],_0x4eff02=_0x1438b0['offset']+_0x1438b0[_0x5506('0x19')],_0x11e20c;if(_0x4eff02>=_0x5f4508){_0x4eff02=_0x5f4508;_0x11e20c=0xc8;}else{_0x11e20c=0xce;}_0x1ba8df[_0x5506('0x14')](_0x11e20c);return _0x1ba8df[_0x5506('0x1a')](_0x5506('0x1b'),_0x9d3ac4+'-'+_0x4eff02+'/'+_0x5f4508)[_0x5506('0x16')](_0xb65d60);}return null;};}function patchUpdates(_0x48f2ff){return function(_0x3e44cd){try{jsonpatch[_0x5506('0x1c')](_0x3e44cd,_0x48f2ff,!![]);}catch(_0x21c307){return BPromise['reject'](_0x21c307);}return _0x3e44cd[_0x5506('0x1d')]();};}function saveUpdates(_0x589f0d,_0x58a726){return function(_0x5d3220){if(_0x5d3220){return _0x5d3220[_0x5506('0x1e')](_0x589f0d)[_0x5506('0x1f')](function(_0x4401e4){return _0x4401e4;});}return null;};}function removeEntity(_0x124c1c,_0x425715){return function(_0x4b2e6a){if(_0x4b2e6a){return _0x4b2e6a[_0x5506('0x20')]()['then'](function(){_0x124c1c[_0x5506('0x14')](0xcc)[_0x5506('0x15')]();});}};}function handleEntityNotFound(_0x3dd38d,_0x51a2b2){return function(_0x39e763){if(!_0x39e763){_0x3dd38d[_0x5506('0x21')](0x194);}return _0x39e763;};}function handleError(_0x4b564c,_0x4bb2f6){_0x4bb2f6=_0x4bb2f6||0x1f4;return function(_0x1db541){logger[_0x5506('0x22')](_0x1db541[_0x5506('0x23')]);if(_0x1db541['name']){delete _0x1db541[_0x5506('0x24')];}_0x4b564c['status'](_0x4bb2f6)[_0x5506('0x25')](_0x1db541);};}exports[_0x5506('0x26')]=function(_0x157415,_0x24679f){var _0x1ee9fa={},_0x13f118={},_0x26e5bb={'count':0x0,'rows':[]};var _0x5c3b43=_['map'](db[_0x5506('0x27')][_0x5506('0x28')],function(_0x51f6c4){return{'name':_0x51f6c4[_0x5506('0x29')],'type':_0x51f6c4['type'][_0x5506('0x2a')]};});_0x13f118[_0x5506('0x2b')]=_[_0x5506('0x2c')](_0x5c3b43,_0x5506('0x24'));_0x13f118[_0x5506('0x2d')]=_['keys'](_0x157415[_0x5506('0x2d')]);_0x13f118[_0x5506('0x2e')]=_[_0x5506('0x2f')](_0x13f118[_0x5506('0x2b')],_0x13f118[_0x5506('0x2d')]);_0x1ee9fa[_0x5506('0x30')]=_[_0x5506('0x2f')](_0x13f118[_0x5506('0x2b')],qs['fields'](_0x157415[_0x5506('0x2d')][_0x5506('0x31')]));_0x1ee9fa['attributes']=_0x1ee9fa[_0x5506('0x30')][_0x5506('0x32')]?_0x1ee9fa[_0x5506('0x30')]:_0x13f118['model'];if(!_0x157415[_0x5506('0x2d')][_0x5506('0x33')](_0x5506('0x34'))){_0x1ee9fa[_0x5506('0x19')]=qs[_0x5506('0x19')](_0x157415[_0x5506('0x2d')][_0x5506('0x19')]);_0x1ee9fa[_0x5506('0x18')]=qs['offset'](_0x157415[_0x5506('0x2d')]['offset']);}_0x1ee9fa['order']=qs[_0x5506('0x35')](_0x157415[_0x5506('0x2d')]['sort']);_0x1ee9fa[_0x5506('0x36')]=qs['filters'](_[_0x5506('0x37')](_0x157415[_0x5506('0x2d')],_0x13f118[_0x5506('0x2e')]),_0x5c3b43);if(_0x157415['query'][_0x5506('0x38')]){_0x1ee9fa[_0x5506('0x36')]=_[_0x5506('0x39')](_0x1ee9fa[_0x5506('0x36')],{'$or':_[_0x5506('0x2c')](_0x5c3b43,function(_0x5e0adc){if(_0x5e0adc[_0x5506('0x3a')]!==_0x5506('0x3b')){var _0x1cad48={};_0x1cad48[_0x5e0adc[_0x5506('0x24')]]={'$like':'%'+_0x157415[_0x5506('0x2d')][_0x5506('0x38')]+'%'};return _0x1cad48;}})});}_0x1ee9fa=_[_0x5506('0x39')]({},_0x1ee9fa,_0x157415[_0x5506('0x3c')]);var _0x4b9204={'where':_0x1ee9fa[_0x5506('0x36')]};return db[_0x5506('0x27')][_0x5506('0x17')](_0x4b9204)[_0x5506('0x1f')](function(_0x31c0a7){_0x26e5bb[_0x5506('0x17')]=_0x31c0a7;if(_0x157415['query'][_0x5506('0x3d')]){_0x1ee9fa[_0x5506('0x3e')]=[{'all':!![]}];}return db[_0x5506('0x27')][_0x5506('0x3f')](_0x1ee9fa);})[_0x5506('0x1f')](function(_0x2c5f3d){_0x26e5bb['rows']=_0x2c5f3d;return _0x26e5bb;})['then'](respondWithFilteredResult(_0x24679f,_0x1ee9fa))[_0x5506('0x40')](handleError(_0x24679f,null));};exports[_0x5506('0x41')]=function(_0x793084,_0x9b8b0c){var _0x54d5d0={'raw':!![],'where':{'id':_0x793084[_0x5506('0x42')]['id']}},_0x43e507={};_0x43e507[_0x5506('0x2b')]=_['keys'](db[_0x5506('0x27')][_0x5506('0x28')]);_0x43e507['query']=_[_0x5506('0x43')](_0x793084[_0x5506('0x2d')]);_0x43e507[_0x5506('0x2e')]=_[_0x5506('0x2f')](_0x43e507[_0x5506('0x2b')],_0x43e507[_0x5506('0x2d')]);_0x54d5d0[_0x5506('0x30')]=_['intersection'](_0x43e507['model'],qs[_0x5506('0x31')](_0x793084[_0x5506('0x2d')]['fields']));_0x54d5d0['attributes']=_0x54d5d0[_0x5506('0x30')][_0x5506('0x32')]?_0x54d5d0[_0x5506('0x30')]:_0x43e507[_0x5506('0x2b')];if(_0x793084['query'][_0x5506('0x3d')]){_0x54d5d0[_0x5506('0x3e')]=[{'all':!![]}];}_0x54d5d0=_[_0x5506('0x39')]({},_0x54d5d0,_0x793084[_0x5506('0x3c')]);return db[_0x5506('0x27')][_0x5506('0x44')](_0x54d5d0)[_0x5506('0x1f')](handleEntityNotFound(_0x9b8b0c,null))[_0x5506('0x1f')](respondWithResult(_0x9b8b0c,null))[_0x5506('0x40')](handleError(_0x9b8b0c,null));};exports[_0x5506('0x45')]=function(_0x548c57,_0x57d727){return db['SalesforceField']['create'](_0x548c57[_0x5506('0x46')],{})[_0x5506('0x1f')](respondWithResult(_0x57d727,0xc9))['catch'](handleError(_0x57d727,null));};exports['update']=function(_0x2f09dd,_0x4826c8){if(_0x2f09dd[_0x5506('0x46')]['id']){delete _0x2f09dd[_0x5506('0x46')]['id'];}return db[_0x5506('0x27')]['find']({'where':{'id':_0x2f09dd['params']['id']}})[_0x5506('0x1f')](handleEntityNotFound(_0x4826c8,null))['then'](saveUpdates(_0x2f09dd[_0x5506('0x46')],null))[_0x5506('0x1f')](respondWithResult(_0x4826c8,null))[_0x5506('0x40')](handleError(_0x4826c8,null));};exports[_0x5506('0x20')]=function(_0x36d4db,_0x29a2a2){return db[_0x5506('0x27')][_0x5506('0x44')]({'where':{'id':_0x36d4db[_0x5506('0x42')]['id']}})[_0x5506('0x1f')](handleEntityNotFound(_0x29a2a2,null))['then'](removeEntity(_0x29a2a2,null))[_0x5506('0x40')](handleError(_0x29a2a2,null));}; \ No newline at end of file +var _0xaa03=['desk.js','querystring','papaparse','../../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','Content-Range','apply','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','options','SalesforceField','include','findAll','catch','show','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto'];(function(_0x4039a2,_0x23242e){var _0x3d5892=function(_0x444129){while(--_0x444129){_0x4039a2['push'](_0x4039a2['shift']());}};_0x3d5892(++_0x23242e);}(_0xaa03,0x155));var _0x3aa0=function(_0x17cdb0,_0x280457){_0x17cdb0=_0x17cdb0-0x0;var _0x4ca1b9=_0xaa03[_0x17cdb0];return _0x4ca1b9;};'use strict';var pdf=require(_0x3aa0('0x0'));var emlformat=require(_0x3aa0('0x1'));var rimraf=require(_0x3aa0('0x2'));var zipdir=require(_0x3aa0('0x3'));var jsonpatch=require(_0x3aa0('0x4'));var rp=require(_0x3aa0('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3aa0('0x6'));var util=require(_0x3aa0('0x7'));var path=require(_0x3aa0('0x8'));var sox=require(_0x3aa0('0x9'));var csv=require(_0x3aa0('0xa'));var ejs=require(_0x3aa0('0xb'));var fs=require('fs');var _=require(_0x3aa0('0xc'));var squel=require('squel');var crypto=require(_0x3aa0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3aa0('0xe'));var toCsv=require(_0x3aa0('0xa'));var querystring=require(_0x3aa0('0xf'));var Papa=require(_0x3aa0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3aa0('0x11'));var as=require(_0x3aa0('0x12'));var hardwareService=require(_0x3aa0('0x13'));var logger=require(_0x3aa0('0x14'))(_0x3aa0('0x15'));var utils=require(_0x3aa0('0x16'));var config=require(_0x3aa0('0x17'));var licenseUtil=require(_0x3aa0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d31d5,_0x3ef33d){_0x3ef33d=_0x3ef33d||0xcc;return function(_0x8cdb1d){if(_0x8cdb1d){return _0x4d31d5[_0x3aa0('0x19')](_0x3ef33d);}return _0x4d31d5['status'](_0x3ef33d)['end']();};}function respondWithResult(_0x2cc215,_0x263991){_0x263991=_0x263991||0xc8;return function(_0xbe0be9){if(_0xbe0be9){return _0x2cc215[_0x3aa0('0x1a')](_0x263991)[_0x3aa0('0x1b')](_0xbe0be9);}};}function respondWithFilteredResult(_0x20e70d,_0x5b6e32){return function(_0x1e7aa5){if(_0x1e7aa5){var _0x6032bc=_0x1e7aa5[_0x3aa0('0x1c')],_0x4ce931=_0x5b6e32[_0x3aa0('0x1d')],_0x156af5=_0x5b6e32[_0x3aa0('0x1d')]+_0x5b6e32[_0x3aa0('0x1e')],_0x1a433c;if(_0x156af5>=_0x6032bc){_0x156af5=_0x6032bc;_0x1a433c=0xc8;}else{_0x1a433c=0xce;}_0x20e70d[_0x3aa0('0x1a')](_0x1a433c);return _0x20e70d['set'](_0x3aa0('0x1f'),_0x4ce931+'-'+_0x156af5+'/'+_0x6032bc)[_0x3aa0('0x1b')](_0x1e7aa5);}return null;};}function patchUpdates(_0x2f4b7c){return function(_0x182b64){try{jsonpatch[_0x3aa0('0x20')](_0x182b64,_0x2f4b7c,!![]);}catch(_0x1c0295){return BPromise['reject'](_0x1c0295);}return _0x182b64[_0x3aa0('0x21')]();};}function saveUpdates(_0xc0ff,_0x5afcb7){return function(_0x4cf205){if(_0x4cf205){return _0x4cf205[_0x3aa0('0x22')](_0xc0ff)[_0x3aa0('0x23')](function(_0x36053e){return _0x36053e;});}return null;};}function removeEntity(_0x5423e2,_0x236105){return function(_0x137ce5){if(_0x137ce5){return _0x137ce5[_0x3aa0('0x24')]()[_0x3aa0('0x23')](function(){_0x5423e2[_0x3aa0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e00b7,_0x30a60f){return function(_0x3c8be9){if(!_0x3c8be9){_0x3e00b7[_0x3aa0('0x19')](0x194);}return _0x3c8be9;};}function handleError(_0x5f1b1e,_0x181104){_0x181104=_0x181104||0x1f4;return function(_0xc8295e){logger[_0x3aa0('0x25')](_0xc8295e[_0x3aa0('0x26')]);if(_0xc8295e[_0x3aa0('0x27')]){delete _0xc8295e[_0x3aa0('0x27')];}_0x5f1b1e['status'](_0x181104)[_0x3aa0('0x28')](_0xc8295e);};}exports['index']=function(_0x218448,_0x35aa8c){var _0x302dfb={},_0x3fd781={},_0x5d9b5c={'count':0x0,'rows':[]};var _0x36c058=_['map'](db['SalesforceField'][_0x3aa0('0x29')],function(_0x123a61){return{'name':_0x123a61[_0x3aa0('0x2a')],'type':_0x123a61[_0x3aa0('0x2b')]['key']};});_0x3fd781[_0x3aa0('0x2c')]=_[_0x3aa0('0x2d')](_0x36c058,'name');_0x3fd781[_0x3aa0('0x2e')]=_[_0x3aa0('0x2f')](_0x218448[_0x3aa0('0x2e')]);_0x3fd781['filters']=_[_0x3aa0('0x30')](_0x3fd781[_0x3aa0('0x2c')],_0x3fd781[_0x3aa0('0x2e')]);_0x302dfb[_0x3aa0('0x31')]=_['intersection'](_0x3fd781['model'],qs['fields'](_0x218448[_0x3aa0('0x2e')][_0x3aa0('0x32')]));_0x302dfb[_0x3aa0('0x31')]=_0x302dfb[_0x3aa0('0x31')][_0x3aa0('0x33')]?_0x302dfb[_0x3aa0('0x31')]:_0x3fd781[_0x3aa0('0x2c')];if(!_0x218448[_0x3aa0('0x2e')][_0x3aa0('0x34')]('nolimit')){_0x302dfb[_0x3aa0('0x1e')]=qs['limit'](_0x218448[_0x3aa0('0x2e')][_0x3aa0('0x1e')]);_0x302dfb[_0x3aa0('0x1d')]=qs[_0x3aa0('0x1d')](_0x218448[_0x3aa0('0x2e')]['offset']);}_0x302dfb[_0x3aa0('0x35')]=qs['sort'](_0x218448[_0x3aa0('0x2e')][_0x3aa0('0x36')]);_0x302dfb[_0x3aa0('0x37')]=qs[_0x3aa0('0x38')](_['pick'](_0x218448[_0x3aa0('0x2e')],_0x3fd781[_0x3aa0('0x38')]),_0x36c058);if(_0x218448[_0x3aa0('0x2e')]['filter']){_0x302dfb[_0x3aa0('0x37')]=_[_0x3aa0('0x39')](_0x302dfb[_0x3aa0('0x37')],{'$or':_[_0x3aa0('0x2d')](_0x36c058,function(_0x1cdf58){if(_0x1cdf58['type']!==_0x3aa0('0x3a')){var _0x37ebb0={};_0x37ebb0[_0x1cdf58[_0x3aa0('0x27')]]={'$like':'%'+_0x218448[_0x3aa0('0x2e')][_0x3aa0('0x3b')]+'%'};return _0x37ebb0;}})});}_0x302dfb=_[_0x3aa0('0x39')]({},_0x302dfb,_0x218448[_0x3aa0('0x3c')]);var _0x1862b6={'where':_0x302dfb['where']};return db[_0x3aa0('0x3d')][_0x3aa0('0x1c')](_0x1862b6)[_0x3aa0('0x23')](function(_0x142cec){_0x5d9b5c[_0x3aa0('0x1c')]=_0x142cec;if(_0x218448[_0x3aa0('0x2e')]['includeAll']){_0x302dfb[_0x3aa0('0x3e')]=[{'all':!![]}];}return db[_0x3aa0('0x3d')][_0x3aa0('0x3f')](_0x302dfb);})[_0x3aa0('0x23')](function(_0x5935a2){_0x5d9b5c['rows']=_0x5935a2;return _0x5d9b5c;})[_0x3aa0('0x23')](respondWithFilteredResult(_0x35aa8c,_0x302dfb))[_0x3aa0('0x40')](handleError(_0x35aa8c,null));};exports[_0x3aa0('0x41')]=function(_0x31ea28,_0x36bef1){var _0xeffc8b={'raw':!![],'where':{'id':_0x31ea28[_0x3aa0('0x42')]['id']}},_0x334cf0={};_0x334cf0['model']=_[_0x3aa0('0x2f')](db['SalesforceField'][_0x3aa0('0x29')]);_0x334cf0[_0x3aa0('0x2e')]=_['keys'](_0x31ea28[_0x3aa0('0x2e')]);_0x334cf0[_0x3aa0('0x38')]=_[_0x3aa0('0x30')](_0x334cf0[_0x3aa0('0x2c')],_0x334cf0[_0x3aa0('0x2e')]);_0xeffc8b[_0x3aa0('0x31')]=_[_0x3aa0('0x30')](_0x334cf0[_0x3aa0('0x2c')],qs[_0x3aa0('0x32')](_0x31ea28['query'][_0x3aa0('0x32')]));_0xeffc8b[_0x3aa0('0x31')]=_0xeffc8b['attributes'][_0x3aa0('0x33')]?_0xeffc8b[_0x3aa0('0x31')]:_0x334cf0[_0x3aa0('0x2c')];if(_0x31ea28['query'][_0x3aa0('0x43')]){_0xeffc8b[_0x3aa0('0x3e')]=[{'all':!![]}];}_0xeffc8b=_['merge']({},_0xeffc8b,_0x31ea28['options']);return db[_0x3aa0('0x3d')][_0x3aa0('0x44')](_0xeffc8b)[_0x3aa0('0x23')](handleEntityNotFound(_0x36bef1,null))[_0x3aa0('0x23')](respondWithResult(_0x36bef1,null))[_0x3aa0('0x40')](handleError(_0x36bef1,null));};exports[_0x3aa0('0x45')]=function(_0x15f205,_0x267911){return db['SalesforceField']['create'](_0x15f205[_0x3aa0('0x46')],{})[_0x3aa0('0x23')](respondWithResult(_0x267911,0xc9))['catch'](handleError(_0x267911,null));};exports[_0x3aa0('0x22')]=function(_0x20ab32,_0x39a07a){if(_0x20ab32[_0x3aa0('0x46')]['id']){delete _0x20ab32[_0x3aa0('0x46')]['id'];}return db[_0x3aa0('0x3d')][_0x3aa0('0x44')]({'where':{'id':_0x20ab32[_0x3aa0('0x42')]['id']}})[_0x3aa0('0x23')](handleEntityNotFound(_0x39a07a,null))[_0x3aa0('0x23')](saveUpdates(_0x20ab32['body'],null))[_0x3aa0('0x23')](respondWithResult(_0x39a07a,null))['catch'](handleError(_0x39a07a,null));};exports[_0x3aa0('0x24')]=function(_0xf4f019,_0x5dbb28){return db[_0x3aa0('0x3d')][_0x3aa0('0x44')]({'where':{'id':_0xf4f019[_0x3aa0('0x42')]['id']}})[_0x3aa0('0x23')](handleEntityNotFound(_0x5dbb28,null))[_0x3aa0('0x23')](removeEntity(_0x5dbb28,null))[_0x3aa0('0x40')](handleError(_0x5dbb28,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 1b6a57c..33f4015 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 _0x4e40=['rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','lodash','util','api','moment','path'];(function(_0x570eb3,_0x53060b){var _0x4e6242=function(_0x29571f){while(--_0x29571f){_0x570eb3['push'](_0x570eb3['shift']());}};_0x4e6242(++_0x53060b);}(_0x4e40,0x1a8));var _0x04e4=function(_0x55b637,_0x425ec9){_0x55b637=_0x55b637-0x0;var _0x4b4828=_0x4e40[_0x55b637];return _0x4b4828;};'use strict';var _=require(_0x04e4('0x0'));var util=require(_0x04e4('0x1'));var logger=require('../../config/logger')(_0x04e4('0x2'));var moment=require(_0x04e4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x04e4('0x4'));var rimraf=require(_0x04e4('0x5'));var config=require(_0x04e4('0x6'));var attributes=require(_0x04e4('0x7'));module[_0x04e4('0x8')]=function(_0x5449cb,_0x548e85){return _0x5449cb[_0x04e4('0x9')](_0x04e4('0xa'),attributes,{'tableName':_0x04e4('0xb'),'paranoid':![],'indexes':[{'name':_0x04e4('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b69=['idField','FieldId','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x24b477,_0x30393b){var _0x4041a6=function(_0x2d64de){while(--_0x2d64de){_0x24b477['push'](_0x24b477['shift']());}};_0x4041a6(++_0x30393b);}(_0x1b69,0x1d0));var _0x91b6=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x1b69[_0x15c421];return _0x5e5ed5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x91b6('0x0'));var moment=require(_0x91b6('0x1'));var BPromise=require(_0x91b6('0x2'));var rp=require(_0x91b6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91b6('0x4'));var config=require(_0x91b6('0x5'));var attributes=require(_0x91b6('0x6'));module[_0x91b6('0x7')]=function(_0x1c4412,_0xa67563){return _0x1c4412[_0x91b6('0x8')](_0x91b6('0x9'),attributes,{'tableName':_0x91b6('0xa'),'paranoid':![],'indexes':[{'name':_0x91b6('0xb'),'fields':[_0x91b6('0xc'),_0x91b6('0xd')],'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 2f7e095..d993dfd 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 _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(_0x191b1a,_0x48e0e6){var _0x283089=function(_0x4f6574){while(--_0x4f6574){_0x191b1a['push'](_0x191b1a['shift']());}};_0x283089(++_0x48e0e6);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0xb4e6[_0x54a2e4];return _0x4742d0;};'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 +var _0x750a=['error','code','SalesforceField,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify'];(function(_0x4adcd1,_0x299933){var _0x1b8d85=function(_0x5e0d4b){while(--_0x5e0d4b){_0x4adcd1['push'](_0x4adcd1['shift']());}};_0x1b8d85(++_0x299933);}(_0x750a,0x140));var _0xa750=function(_0x59d321,_0x567920){_0x59d321=_0x59d321-0x0;var _0xd7a39b=_0x750a[_0x59d321];return _0xd7a39b;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('SalesforceField,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 53c52d9..9c764f8 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 _0x9823=['/:id/fields','getFields','create','/:id/configurations','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id','show'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x9823,0xf8));var _0x3982=function(_0x20952d,_0x4eddd5){_0x20952d=_0x20952d-0x0;var _0x3b24d5=_0x9823[_0x20952d];return _0x3b24d5;};'use strict';var multer=require(_0x3982('0x0'));var util=require(_0x3982('0x1'));var path=require(_0x3982('0x2'));var timeout=require(_0x3982('0x3'));var express=require('express');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['index']);router[_0x3982('0x8')](_0x3982('0xa'),auth['isAuthenticated'](),controller[_0x3982('0xb')]);router[_0x3982('0x8')]('/:id/configurations',auth[_0x3982('0x9')](),controller['getConfigurations']);router['get'](_0x3982('0xc'),auth['isAuthenticated'](),controller[_0x3982('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3982('0xe')]);router['post'](_0x3982('0xf'),auth[_0x3982('0x9')](),controller['addConfiguration']);router[_0x3982('0x10')]('/:id',auth[_0x3982('0x9')](),controller['update']);router[_0x3982('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3982('0x12')]);module[_0x3982('0x13')]=router; \ No newline at end of file +var _0x00ca=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00ca,0x96));var _0xa00c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x00ca[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xa00c('0x0'));var util=require(_0xa00c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa00c('0x2'));var router=express['Router']();var auth=require(_0xa00c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa00c('0x4'));var controller=require(_0xa00c('0x5'));router[_0xa00c('0x6')]('/',auth[_0xa00c('0x7')](),controller[_0xa00c('0x8')]);router[_0xa00c('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xa00c('0x9')]);router[_0xa00c('0x6')](_0xa00c('0xa'),auth[_0xa00c('0x7')](),controller[_0xa00c('0xb')]);router[_0xa00c('0x6')](_0xa00c('0xc'),auth['isAuthenticated'](),controller[_0xa00c('0xd')]);router[_0xa00c('0xe')]('/',auth['isAuthenticated'](),controller[_0xa00c('0xf')]);router[_0xa00c('0xe')](_0xa00c('0xa'),auth[_0xa00c('0x7')](),controller[_0xa00c('0x10')]);router[_0xa00c('0x11')](_0xa00c('0x12'),auth[_0xa00c('0x7')](),controller[_0xa00c('0x13')]);router[_0xa00c('0x14')]('/:id',auth[_0xa00c('0x7')](),controller[_0xa00c('0x15')]);module[_0xa00c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b831308..caf9b75 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 _0x94f7=['sequelize','exports','STRING','username','remoteUri'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0x94f7,0x16d));var _0x794f=function(_0x424c3d,_0x477328){_0x424c3d=_0x424c3d-0x0;var _0x52f3a8=_0x94f7[_0x424c3d];return _0x52f3a8;};'use strict';var Sequelize=require(_0x794f('0x0'));module[_0x794f('0x1')]={'name':{'type':Sequelize[_0x794f('0x2')]},'description':{'type':Sequelize[_0x794f('0x2')]},'username':{'type':Sequelize[_0x794f('0x2')],'unique':_0x794f('0x3')},'password':{'type':Sequelize[_0x794f('0x2')]},'email':{'type':Sequelize[_0x794f('0x2')]},'remoteUri':{'type':Sequelize[_0x794f('0x2')],'unique':_0x794f('0x4')},'serverUrl':{'type':Sequelize[_0x794f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5fc2=['remoteUri','sequelize','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5fc2,0xb5));var _0x25fc=function(_0x22a3f0,_0x513d0e){_0x22a3f0=_0x22a3f0-0x0;var _0x2d8a9c=_0x5fc2[_0x22a3f0];return _0x2d8a9c;};'use strict';var Sequelize=require(_0x25fc('0x0'));module[_0x25fc('0x1')]={'name':{'type':Sequelize[_0x25fc('0x2')]},'description':{'type':Sequelize[_0x25fc('0x2')]},'username':{'type':Sequelize[_0x25fc('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x25fc('0x2')]},'email':{'type':Sequelize[_0x25fc('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x25fc('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index b598063..958d4c0 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 _0x6a43=['sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','count','includeAll','include','findAll','rows','show','params','length','find','create','body','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','calendar_stc','closed_at','cmdb_ci','active','business_service','sys_domain_path','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','delivery_task','business_stc','description','calendar_duration','sys_class_name','follow_up','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','all','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','false','sys_choice?sysparm_query=name=incident^element=','value','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch'];(function(_0x3e03b5,_0x108dac){var _0x2f6e47=function(_0x1148d7){while(--_0x1148d7){_0x3e03b5['push'](_0x3e03b5['shift']());}};_0x2f6e47(++_0x108dac);}(_0x6a43,0x151));var _0x36a4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6a43[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x36a4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x36a4('0x1'));var zipdir=require(_0x36a4('0x2'));var jsonpatch=require(_0x36a4('0x3'));var rp=require('request-promise');var moment=require(_0x36a4('0x4'));var BPromise=require(_0x36a4('0x5'));var Mustache=require(_0x36a4('0x6'));var util=require(_0x36a4('0x7'));var path=require(_0x36a4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x36a4('0x9'));var fs=require('fs');var _=require(_0x36a4('0xa'));var squel=require(_0x36a4('0xb'));var crypto=require(_0x36a4('0xc'));var jsforce=require(_0x36a4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x36a4('0xe'));var querystring=require(_0x36a4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x36a4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x36a4('0x11'))(_0x36a4('0x12'));var utils=require(_0x36a4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x36a4('0x14'));var db=require(_0x36a4('0x15'))['db'];var integrations=require(_0x36a4('0x16'));var jayson=require(_0x36a4('0x17'));var client=jayson['client'][_0x36a4('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5c7655,_0xbc1102,_0x1abe9a,_0x4b9d2f){return new BPromise(function(_0x5c9a18,_0x469532){var _0x5d672e=_0x4b9d2f||client;return _0x5d672e[_0x36a4('0x19')](_0x5c7655,_0x1abe9a)[_0x36a4('0x1a')](function(_0x217881){logger[_0x36a4('0x1b')](_0x36a4('0x1c'),_0xbc1102,'request\x20sent');logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0xbc1102,'request\x20sent',JSON[_0x36a4('0x1d')](_0x217881));if(_0x217881[_0x36a4('0x1e')]){if(_0x217881[_0x36a4('0x1e')][_0x36a4('0x1f')]===0x1f4){logger[_0x36a4('0x1e')](_0x36a4('0x1c'),_0xbc1102,_0x217881[_0x36a4('0x1e')][_0x36a4('0x20')]);return _0x469532(_0x217881[_0x36a4('0x1e')][_0x36a4('0x20')]);}logger[_0x36a4('0x1e')](_0x36a4('0x1c'),_0xbc1102,_0x217881[_0x36a4('0x1e')][_0x36a4('0x20')]);return _0x5c9a18(_0x217881[_0x36a4('0x1e')][_0x36a4('0x20')]);}else{logger['info'](_0x36a4('0x1c'),_0xbc1102,_0x36a4('0x21'));_0x5c9a18(_0x217881['result'][_0x36a4('0x20')]);}})[_0x36a4('0x22')](function(_0x26c979){logger[_0x36a4('0x1e')](_0x36a4('0x1c'),_0xbc1102,_0x26c979);_0x469532(_0x26c979);});});}function respondWithStatusCode(_0x1f571a,_0x143cb0){_0x143cb0=_0x143cb0||0xcc;return function(_0x57e534){if(_0x57e534){return _0x1f571a[_0x36a4('0x23')](_0x143cb0);}return _0x1f571a[_0x36a4('0x24')](_0x143cb0)['end']();};}function respondWithResult(_0x28f21f,_0x278152){_0x278152=_0x278152||0xc8;return function(_0x53e123){if(_0x53e123){return _0x28f21f['status'](_0x278152)[_0x36a4('0x25')](_0x53e123);}};}function respondWithFilteredResult(_0x3091c4,_0x3ff0e1){return function(_0x1a42d6){if(_0x1a42d6){var _0x3226e5=_0x1a42d6['count'],_0x3ccc1a=_0x3ff0e1['offset'],_0x44cb87=_0x3ff0e1[_0x36a4('0x26')]+_0x3ff0e1[_0x36a4('0x27')],_0x234b6a;if(_0x44cb87>=_0x3226e5){_0x44cb87=_0x3226e5;_0x234b6a=0xc8;}else{_0x234b6a=0xce;}_0x3091c4['status'](_0x234b6a);return _0x3091c4[_0x36a4('0x28')](_0x36a4('0x29'),_0x3ccc1a+'-'+_0x44cb87+'/'+_0x3226e5)[_0x36a4('0x25')](_0x1a42d6);}return null;};}function patchUpdates(_0x636b19){return function(_0x4ccd8a){try{jsonpatch[_0x36a4('0x2a')](_0x4ccd8a,_0x636b19,!![]);}catch(_0x141020){return BPromise['reject'](_0x141020);}return _0x4ccd8a[_0x36a4('0x2b')]();};}function saveUpdates(_0x2064be,_0x27b3bf){return function(_0x29830f){if(_0x29830f){return _0x29830f[_0x36a4('0x2c')](_0x2064be)['then'](function(_0x3a5311){return _0x3a5311;});}return null;};}function removeEntity(_0x481253,_0x5db3f2){return function(_0x273bc8){if(_0x273bc8){return _0x273bc8[_0x36a4('0x2d')]()['then'](function(){_0x481253[_0x36a4('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f9ad,_0x3efb44){return function(_0x17cd96){if(!_0x17cd96){_0x43f9ad[_0x36a4('0x23')](0x194);}return _0x17cd96;};}function handleError(_0x3ab6d2,_0x2ab7f8){_0x2ab7f8=_0x2ab7f8||0x1f4;return function(_0x2ebcec){logger[_0x36a4('0x1e')](_0x2ebcec[_0x36a4('0x2e')]);if(_0x2ebcec[_0x36a4('0x2f')]){delete _0x2ebcec[_0x36a4('0x2f')];}_0x3ab6d2[_0x36a4('0x24')](_0x2ab7f8)[_0x36a4('0x30')](_0x2ebcec);};}exports['index']=function(_0x37988d,_0x45fe4b){var _0x3c8507={},_0x2666a8={},_0x3db7dc={'count':0x0,'rows':[]};var _0x320e11=_[_0x36a4('0x31')](db['ServicenowAccount'][_0x36a4('0x32')],function(_0x58d3a0){return{'name':_0x58d3a0[_0x36a4('0x33')],'type':_0x58d3a0[_0x36a4('0x34')]['key']};});_0x2666a8['model']=_[_0x36a4('0x31')](_0x320e11,'name');_0x2666a8['query']=_[_0x36a4('0x35')](_0x37988d[_0x36a4('0x36')]);_0x2666a8[_0x36a4('0x37')]=_[_0x36a4('0x38')](_0x2666a8[_0x36a4('0x39')],_0x2666a8['query']);_0x3c8507[_0x36a4('0x3a')]=_[_0x36a4('0x38')](_0x2666a8[_0x36a4('0x39')],qs[_0x36a4('0x3b')](_0x37988d[_0x36a4('0x36')][_0x36a4('0x3b')]));_0x3c8507[_0x36a4('0x3a')]=_0x3c8507[_0x36a4('0x3a')]['length']?_0x3c8507[_0x36a4('0x3a')]:_0x2666a8['model'];if(!_0x37988d[_0x36a4('0x36')][_0x36a4('0x3c')](_0x36a4('0x3d'))){_0x3c8507['limit']=qs[_0x36a4('0x27')](_0x37988d[_0x36a4('0x36')][_0x36a4('0x27')]);_0x3c8507['offset']=qs[_0x36a4('0x26')](_0x37988d[_0x36a4('0x36')][_0x36a4('0x26')]);}_0x3c8507[_0x36a4('0x3e')]=qs['sort'](_0x37988d[_0x36a4('0x36')][_0x36a4('0x3f')]);_0x3c8507[_0x36a4('0x40')]=qs['filters'](_[_0x36a4('0x41')](_0x37988d['query'],_0x2666a8[_0x36a4('0x37')]),_0x320e11);if(_0x37988d['query'][_0x36a4('0x42')]){_0x3c8507[_0x36a4('0x40')]=_[_0x36a4('0x43')](_0x3c8507[_0x36a4('0x40')],{'$or':_['map'](_0x320e11,function(_0x237145){if(_0x237145[_0x36a4('0x34')]!==_0x36a4('0x44')){var _0x2b4551={};_0x2b4551[_0x237145[_0x36a4('0x2f')]]={'$like':'%'+_0x37988d[_0x36a4('0x36')][_0x36a4('0x42')]+'%'};return _0x2b4551;}})});}_0x3c8507=_[_0x36a4('0x43')]({},_0x3c8507,_0x37988d[_0x36a4('0x45')]);var _0x22f33c={'where':_0x3c8507[_0x36a4('0x40')]};return db[_0x36a4('0x46')][_0x36a4('0x47')](_0x22f33c)[_0x36a4('0x1a')](function(_0x5a26f3){_0x3db7dc[_0x36a4('0x47')]=_0x5a26f3;if(_0x37988d[_0x36a4('0x36')][_0x36a4('0x48')]){_0x3c8507[_0x36a4('0x49')]=[{'all':!![]}];}return db[_0x36a4('0x46')][_0x36a4('0x4a')](_0x3c8507);})[_0x36a4('0x1a')](function(_0x15521a){_0x3db7dc[_0x36a4('0x4b')]=_0x15521a;return _0x3db7dc;})[_0x36a4('0x1a')](respondWithFilteredResult(_0x45fe4b,_0x3c8507))[_0x36a4('0x22')](handleError(_0x45fe4b,null));};exports[_0x36a4('0x4c')]=function(_0x2a5026,_0x2221c4){var _0xfa5d8a={'raw':![],'where':{'id':_0x2a5026[_0x36a4('0x4d')]['id']}},_0x2f9e23={};_0x2f9e23['model']=_[_0x36a4('0x35')](db[_0x36a4('0x46')][_0x36a4('0x32')]);_0x2f9e23[_0x36a4('0x36')]=_[_0x36a4('0x35')](_0x2a5026[_0x36a4('0x36')]);_0x2f9e23['filters']=_[_0x36a4('0x38')](_0x2f9e23[_0x36a4('0x39')],_0x2f9e23[_0x36a4('0x36')]);_0xfa5d8a[_0x36a4('0x3a')]=_[_0x36a4('0x38')](_0x2f9e23[_0x36a4('0x39')],qs['fields'](_0x2a5026['query'][_0x36a4('0x3b')]));_0xfa5d8a['attributes']=_0xfa5d8a[_0x36a4('0x3a')][_0x36a4('0x4e')]?_0xfa5d8a[_0x36a4('0x3a')]:_0x2f9e23[_0x36a4('0x39')];if(_0x2a5026[_0x36a4('0x36')]['includeAll']){_0xfa5d8a['include']=[{'all':!![]}];}_0xfa5d8a=_[_0x36a4('0x43')]({},_0xfa5d8a,_0x2a5026['options']);return db[_0x36a4('0x46')][_0x36a4('0x4f')](_0xfa5d8a)[_0x36a4('0x1a')](handleEntityNotFound(_0x2221c4,null))[_0x36a4('0x1a')](respondWithResult(_0x2221c4,null))[_0x36a4('0x22')](handleError(_0x2221c4,null));};exports[_0x36a4('0x50')]=function(_0x4f7502,_0x520f5d){return db[_0x36a4('0x46')][_0x36a4('0x50')](_0x4f7502['body'],{})[_0x36a4('0x1a')](respondWithResult(_0x520f5d,0xc9))['catch'](handleError(_0x520f5d,null));};exports[_0x36a4('0x2c')]=function(_0xa6723c,_0x50537c){if(_0xa6723c[_0x36a4('0x51')]['id']){delete _0xa6723c['body']['id'];}return db[_0x36a4('0x46')][_0x36a4('0x4f')]({'where':{'id':_0xa6723c[_0x36a4('0x4d')]['id']}})[_0x36a4('0x1a')](handleEntityNotFound(_0x50537c,null))[_0x36a4('0x1a')](saveUpdates(_0xa6723c['body'],null))[_0x36a4('0x1a')](respondWithResult(_0x50537c,null))[_0x36a4('0x22')](handleError(_0x50537c,null));};exports[_0x36a4('0x2d')]=function(_0x566948,_0x26ed17){return db[_0x36a4('0x46')][_0x36a4('0x4f')]({'where':{'id':_0x566948[_0x36a4('0x4d')]['id']}})[_0x36a4('0x1a')](handleEntityNotFound(_0x26ed17,null))[_0x36a4('0x1a')](removeEntity(_0x26ed17,null))[_0x36a4('0x22')](handleError(_0x26ed17,null));};exports['getConfigurations']=function(_0x24d994,_0x24551c,_0x3f3d10){var _0x1569f9={};var _0x34fd1a={};var _0x51f761;var _0x262094;return db['ServicenowAccount'][_0x36a4('0x52')]({'where':{'id':_0x24d994[_0x36a4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x24551c,null))[_0x36a4('0x1a')](function(_0x51928f){if(_0x51928f){_0x51f761=_0x51928f;_0x34fd1a[_0x36a4('0x39')]=_[_0x36a4('0x35')](db[_0x36a4('0x53')][_0x36a4('0x32')]);_0x34fd1a[_0x36a4('0x36')]=_[_0x36a4('0x35')](_0x24d994[_0x36a4('0x36')]);_0x34fd1a['filters']=_[_0x36a4('0x38')](_0x34fd1a['model'],_0x34fd1a[_0x36a4('0x36')]);_0x1569f9[_0x36a4('0x3a')]=_[_0x36a4('0x38')](_0x34fd1a[_0x36a4('0x39')],qs[_0x36a4('0x3b')](_0x24d994[_0x36a4('0x36')]['fields']));_0x1569f9[_0x36a4('0x3a')]=_0x1569f9[_0x36a4('0x3a')]['length']?_0x1569f9[_0x36a4('0x3a')]:_0x34fd1a[_0x36a4('0x39')];_0x1569f9['order']=qs[_0x36a4('0x3f')](_0x24d994[_0x36a4('0x36')][_0x36a4('0x3f')]);_0x1569f9[_0x36a4('0x40')]=qs[_0x36a4('0x37')](_['pick'](_0x24d994[_0x36a4('0x36')],_0x34fd1a[_0x36a4('0x37')]));if(_0x24d994['query']['filter']){_0x1569f9[_0x36a4('0x40')]=_[_0x36a4('0x43')](_0x1569f9[_0x36a4('0x40')],{'$or':_[_0x36a4('0x31')](_0x1569f9[_0x36a4('0x3a')],function(_0x42e241){var _0x2e8fb2={};_0x2e8fb2[_0x42e241]={'$like':'%'+_0x24d994['query']['filter']+'%'};return _0x2e8fb2;})});}_0x1569f9=_[_0x36a4('0x43')]({},_0x1569f9,_0x24d994[_0x36a4('0x45')]);return _0x51f761[_0x36a4('0x54')](_0x1569f9);}})[_0x36a4('0x1a')](function(_0x37b9f7){if(_0x37b9f7){_0x262094=_0x37b9f7[_0x36a4('0x4e')];if(!_0x24d994['query'][_0x36a4('0x3c')](_0x36a4('0x3d'))){_0x1569f9[_0x36a4('0x27')]=qs['limit'](_0x24d994[_0x36a4('0x36')][_0x36a4('0x27')]);_0x1569f9['offset']=qs[_0x36a4('0x26')](_0x24d994[_0x36a4('0x36')][_0x36a4('0x26')]);}return _0x51f761[_0x36a4('0x54')](_0x1569f9);}})[_0x36a4('0x1a')](function(_0x2638ca){if(_0x2638ca){return _0x2638ca?{'count':_0x262094,'rows':_0x2638ca}:null;}})['then'](respondWithResult(_0x24551c,null))[_0x36a4('0x22')](handleError(_0x24551c,null));};exports[_0x36a4('0x55')]=function(_0x208b56,_0x5c2ff5,_0x16b9f4){if(_0x208b56[_0x36a4('0x51')]['id']){delete _0x208b56['body']['id'];}return db[_0x36a4('0x46')][_0x36a4('0x52')]({'where':{'id':_0x208b56['params']['id']}})['then'](handleEntityNotFound(_0x5c2ff5,null))['then'](function(_0x2d6b60){if(_0x2d6b60){_0x208b56[_0x36a4('0x51')]['AccountId']=_0x2d6b60['id'];_0x208b56['body'][_0x36a4('0x56')]=integrations[_0x36a4('0x57')](_0x208b56['body'][_0x36a4('0x58')],_0x208b56['body'][_0x36a4('0x34')]);_0x208b56[_0x36a4('0x51')][_0x36a4('0x59')]=integrations['getDescriptions'](_0x208b56[_0x36a4('0x51')][_0x36a4('0x58')],_0x208b56[_0x36a4('0x51')][_0x36a4('0x34')]);return db['ServicenowConfiguration'][_0x36a4('0x50')](_0x208b56[_0x36a4('0x51')],{'include':[{'model':db[_0x36a4('0x5a')],'as':_0x36a4('0x56')},{'model':db[_0x36a4('0x5a')],'as':_0x36a4('0x59')}]});}return null;})['then'](respondWithResult(_0x5c2ff5,null))[_0x36a4('0x22')](handleError(_0x5c2ff5,null));};exports[_0x36a4('0x5b')]=function(_0x2cc25d,_0x22330f,_0x484b1a){var _0x27d79a=[_0x36a4('0x5c'),_0x36a4('0x5d'),_0x36a4('0x5e'),_0x36a4('0x5f'),_0x36a4('0x60'),_0x36a4('0x61'),'incident_state','severity',_0x36a4('0x62')];var _0x286fc0=[_0x36a4('0x63'),_0x36a4('0x5c'),_0x36a4('0x64'),_0x36a4('0x65'),_0x36a4('0x66'),_0x36a4('0x67'),_0x36a4('0x68'),_0x36a4('0x5d'),'approval_history','number',_0x36a4('0x69'),_0x36a4('0x6a'),_0x36a4('0x6b'),_0x36a4('0x6c'),'sys_created_on',_0x36a4('0x6d'),_0x36a4('0x6e'),'sys_created_by','knowledge',_0x36a4('0x3e'),_0x36a4('0x6f'),_0x36a4('0x70'),_0x36a4('0x71'),'delivery_plan','impact',_0x36a4('0x72'),'work_notes_list',_0x36a4('0x73'),'priority',_0x36a4('0x74'),'rfc',_0x36a4('0x75'),_0x36a4('0x76'),_0x36a4('0x77'),'business_duration',_0x36a4('0x78'),_0x36a4('0x79'),_0x36a4('0x7a'),'resolved_at',_0x36a4('0x7b'),_0x36a4('0x7c'),_0x36a4('0x5f'),_0x36a4('0x7d'),_0x36a4('0x7e'),_0x36a4('0x60'),'correlation_display',_0x36a4('0x7f'),'work_start','assignment_group',_0x36a4('0x80'),'additional_assignee_list',_0x36a4('0x81'),_0x36a4('0x82'),_0x36a4('0x61'),_0x36a4('0x83'),'close_notes','closed_by',_0x36a4('0x84'),_0x36a4('0x85'),_0x36a4('0x86'),_0x36a4('0x87'),'reopened_by',_0x36a4('0x88'),_0x36a4('0x89'),_0x36a4('0x8a'),'company','reassignment_count',_0x36a4('0x8b'),_0x36a4('0x8c'),_0x36a4('0x8d'),_0x36a4('0x8e'),_0x36a4('0x8f'),_0x36a4('0x90'),_0x36a4('0x91'),_0x36a4('0x92'),_0x36a4('0x93'),'reopen_count',_0x36a4('0x94'),'escalation',_0x36a4('0x95'),_0x36a4('0x96'),_0x36a4('0x97'),_0x36a4('0x62')];var _0x27df2c='';var _0x9a900d='';var _0x223d5f=[];var _0x5126d1='';var _0x4f6927='';var _0x2d162f=[];var _0x21b49e='';var _0x13d129='';var _0x1fca0c={};var _0x266f77='';return db['ServicenowAccount'][_0x36a4('0x52')]({'where':{'id':_0x2cc25d[_0x36a4('0x4d')]['id']},'attributes':['id',_0x36a4('0x98'),_0x36a4('0x99'),_0x36a4('0x9a'),_0x36a4('0x9b'),_0x36a4('0x9c')]})[_0x36a4('0x1a')](handleEntityNotFound(_0x22330f,null))[_0x36a4('0x1a')](function(_0x2f4abb){if(_0x2f4abb){_0x266f77=_0x2f4abb['remoteUri'];var _0x1bcd18=_0x266f77[_0x36a4('0x9d')](-0x1);if(_0x1bcd18==='/'){_0x266f77=_0x266f77['substring'](0x0,_0x266f77[_0x36a4('0x9e')](_0x1bcd18));}_0x13d129=util['format'](_0x36a4('0x9f'),_0x266f77);_0x21b49e=util[_0x36a4('0xa0')](_0x36a4('0xa1'),_0x266f77);_0x1fca0c={'user':_0x2f4abb['username'],'pass':_0x2f4abb[_0x36a4('0x99')]};var _0x200de3={'method':_0x36a4('0xa2'),'uri':_0x13d129+'incident?sysparm_display_value=all','auth':_0x1fca0c,'json':!![]};return rp(_0x200de3);}})[_0x36a4('0x1a')](function(_0x20b204){if(_0x20b204['result'][_0x36a4('0x4e')]>0x0){_0x27df2c=_0x20b204[_0x36a4('0xa3')];}console[_0x36a4('0xa4')](_0x36a4('0xa5'),_0x27df2c);_0x2d162f=[];_0x9a900d=Object[_0x36a4('0xa6')]([],_0x27df2c);_[_0x36a4('0xa7')](_0x9a900d,function(_0x39bfa5){return!_0x27d79a[_0x36a4('0xa8')](_0x39bfa5[_0x36a4('0x2f')]);});_0x9a900d[_0x36a4('0xa9')](function(_0xb3dec4){var _0x31245b=createFieldObject(_0x21b49e,_0x1fca0c,_0xb3dec4[_0x36a4('0xaa')],_0xb3dec4['name'],_0xb3dec4['label'],![]);_0x2d162f[_0x36a4('0xab')](_0x31245b);});return Promise['all'](_0x2d162f);})[_0x36a4('0x1a')](function(_0x253067){_0x223d5f=_0x253067;_0x5126d1=Object[_0x36a4('0xa6')]([],_0x27df2c);console[_0x36a4('0xa4')](_0x36a4('0xac'),_0x27df2c);_[_0x36a4('0xa7')](_0x5126d1,function(_0x413cf7){return _0x286fc0[_0x36a4('0xa8')](_0x413cf7[_0x36a4('0x2f')]);});console[_0x36a4('0xa4')](_0x36a4('0xad'),_0x5126d1);_0x2d162f=[];_0x5126d1[_0x36a4('0xa9')](function(_0x5a00ed){var _0x329031=createFieldObject(_0x21b49e,_0x1fca0c,_0x5a00ed[_0x36a4('0xaa')],_0x5a00ed[_0x36a4('0x2f')],_0x5a00ed[_0x36a4('0xae')],!![]);_0x2d162f[_0x36a4('0xab')](_0x329031);});return Promise[_0x36a4('0xaf')](_0x2d162f);})['then'](function(_0x9e539e){_0x4f6927=_0x9e539e;var _0x3c24b4=_0x223d5f[_0x36a4('0xb0')](_0x4f6927);return{'count':_0x3c24b4['length'],'rows':_0x3c24b4};})['then'](respondWithResult(_0x22330f,null))['catch'](function(_0x50342b){console[_0x36a4('0xa4')](_0x36a4('0xb1')+_0x50342b);var _0x1ab59e=_0x2cc25d['query'][_0x36a4('0xb2')]?0x1f4:_0x50342b[_0x36a4('0xb3')]||0x1f4;logger[_0x36a4('0x1e')](_0x50342b['stack']);delete _0x50342b['name'];if(_0x1ab59e===0x191){_0x1ab59e=0x190;}_0x22330f[_0x36a4('0x24')](_0x1ab59e)[_0x36a4('0x30')](_0x2cc25d[_0x36a4('0x36')][_0x36a4('0xb2')]?{'message':_0x36a4('0xb4'),'statusCode':_0x50342b[_0x36a4('0xb3')]}:_0x50342b);});};function createFieldObject(_0x44d7b1,_0x2836b2,_0x2cea80,_0x198492,_0x18ccb4,_0x2f6530){return new Promise(function(_0x2581e7,_0x194fc7){var _0x29b9c5={'id':_0x198492,'name':_0x18ccb4,'custom':_0x2f6530};if(_0x2cea80===_0x36a4('0xb5')){_0x29b9c5[_0x36a4('0x45')]=[{'name':_0x36a4('0xb6'),'value':'true'},{'name':'False','value':_0x36a4('0xb7')}];_0x2581e7(_0x29b9c5);}else{var _0x184d38={'method':_0x36a4('0xa2'),'uri':_0x44d7b1+_0x36a4('0xb8')+_0x198492,'auth':_0x2836b2,'json':!![]};return rp(_0x184d38)[_0x36a4('0x1a')](function(_0x42ef80){var _0x4d3aa4=[];if(_0x42ef80[_0x36a4('0xa3')]['length']>0x0){_0x42ef80[_0x36a4('0xa3')][_0x36a4('0xa9')](function(_0x554edf){if(_0x554edf['inactive']===_0x36a4('0xb7')){var _0x34a4af={'name':_0x554edf[_0x36a4('0xae')],'value':_0x554edf[_0x36a4('0xb9')]};_0x4d3aa4[_0x36a4('0xab')](_0x34a4af);}});}_0x29b9c5['options']=_0x4d3aa4;if(_0x29b9c5[_0x36a4('0x45')][_0x36a4('0x4e')]>0x0){_0x2581e7(_0x29b9c5);}else{if(_0x2f6530==![]){_0x2581e7();}else{_0x2581e7(_0x29b9c5);}}});}});} \ No newline at end of file +var _0x2d9d=['ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','limit','set','apply','save','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ServicenowAccount','count','findAll','rows','show','params','includeAll','include','find','create','body','getConfigurations','findOne','ServicenowConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','knowledge','close_code','notify','incident_state','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','sys_updated_by','opened_by','user_input','state','sys_created_by','closed_at','cmdb_ci','impact','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','log','assign','remove','internalType','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','boolean','true','False','sys_choice?sysparm_query=name=incident^element=','forEach','inactive','false','label','value','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','info'];(function(_0x34b934,_0x6df5f0){var _0x4b6701=function(_0x1735b5){while(--_0x1735b5){_0x34b934['push'](_0x34b934['shift']());}};_0x4b6701(++_0x6df5f0);}(_0x2d9d,0xa0));var _0xd2d9=function(_0x1db968,_0x153ca1){_0x1db968=_0x1db968-0x0;var _0x18a9db=_0x2d9d[_0x1db968];return _0x18a9db;};'use strict';var pdf=require(_0xd2d9('0x0'));var emlformat=require(_0xd2d9('0x1'));var rimraf=require(_0xd2d9('0x2'));var zipdir=require(_0xd2d9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd2d9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd2d9('0x5'));var util=require(_0xd2d9('0x6'));var path=require(_0xd2d9('0x7'));var sox=require(_0xd2d9('0x8'));var csv=require(_0xd2d9('0x9'));var ejs=require(_0xd2d9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd2d9('0xb'));var jsforce=require(_0xd2d9('0xc'));var deskjs=require(_0xd2d9('0xd'));var toCsv=require(_0xd2d9('0x9'));var querystring=require(_0xd2d9('0xe'));var Papa=require('papaparse');var Redis=require(_0xd2d9('0xf'));var authService=require(_0xd2d9('0x10'));var qs=require(_0xd2d9('0x11'));var as=require(_0xd2d9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2d9('0x13'))('api');var utils=require(_0xd2d9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd2d9('0x15'));var db=require(_0xd2d9('0x16'))['db'];var integrations=require(_0xd2d9('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xd2d9('0x18')][_0xd2d9('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x75931,_0x2db038,_0x328809,_0x33f620){return new BPromise(function(_0x4a154d,_0x35aadc){var _0x15aaac=_0x33f620||client;return _0x15aaac[_0xd2d9('0x1a')](_0x75931,_0x328809)['then'](function(_0x1db224){logger[_0xd2d9('0x1b')](_0xd2d9('0x1c'),_0x2db038,_0xd2d9('0x1d'));logger['debug'](_0xd2d9('0x1e'),_0x2db038,'request\x20sent',JSON['stringify'](_0x1db224));if(_0x1db224['error']){if(_0x1db224[_0xd2d9('0x1f')][_0xd2d9('0x20')]===0x1f4){logger[_0xd2d9('0x1f')](_0xd2d9('0x1c'),_0x2db038,_0x1db224[_0xd2d9('0x1f')][_0xd2d9('0x21')]);return _0x35aadc(_0x1db224[_0xd2d9('0x1f')][_0xd2d9('0x21')]);}logger['error'](_0xd2d9('0x1c'),_0x2db038,_0x1db224['error'][_0xd2d9('0x21')]);return _0x4a154d(_0x1db224[_0xd2d9('0x1f')][_0xd2d9('0x21')]);}else{logger[_0xd2d9('0x1b')](_0xd2d9('0x1c'),_0x2db038,'request\x20sent');_0x4a154d(_0x1db224[_0xd2d9('0x22')]['message']);}})[_0xd2d9('0x23')](function(_0x2fee77){logger['error'](_0xd2d9('0x1c'),_0x2db038,_0x2fee77);_0x35aadc(_0x2fee77);});});}function respondWithStatusCode(_0x1f9d58,_0x2d9d57){_0x2d9d57=_0x2d9d57||0xcc;return function(_0x2a4aa3){if(_0x2a4aa3){return _0x1f9d58['sendStatus'](_0x2d9d57);}return _0x1f9d58[_0xd2d9('0x24')](_0x2d9d57)[_0xd2d9('0x25')]();};}function respondWithResult(_0xde86b2,_0x36cf83){_0x36cf83=_0x36cf83||0xc8;return function(_0x28b21a){if(_0x28b21a){return _0xde86b2[_0xd2d9('0x24')](_0x36cf83)[_0xd2d9('0x26')](_0x28b21a);}};}function respondWithFilteredResult(_0x3d6a1a,_0xd31b63){return function(_0x15e782){if(_0x15e782){var _0x473f30=_0x15e782['count'],_0x4b3cc0=_0xd31b63[_0xd2d9('0x27')],_0x163242=_0xd31b63[_0xd2d9('0x27')]+_0xd31b63[_0xd2d9('0x28')],_0x2f4f5d;if(_0x163242>=_0x473f30){_0x163242=_0x473f30;_0x2f4f5d=0xc8;}else{_0x2f4f5d=0xce;}_0x3d6a1a['status'](_0x2f4f5d);return _0x3d6a1a[_0xd2d9('0x29')]('Content-Range',_0x4b3cc0+'-'+_0x163242+'/'+_0x473f30)[_0xd2d9('0x26')](_0x15e782);}return null;};}function patchUpdates(_0x10ff75){return function(_0x56978e){try{jsonpatch[_0xd2d9('0x2a')](_0x56978e,_0x10ff75,!![]);}catch(_0x1e37a4){return BPromise['reject'](_0x1e37a4);}return _0x56978e[_0xd2d9('0x2b')]();};}function saveUpdates(_0x532a1b,_0x145f9b){return function(_0xbfedae){if(_0xbfedae){return _0xbfedae[_0xd2d9('0x2c')](_0x532a1b)[_0xd2d9('0x2d')](function(_0x33df34){return _0x33df34;});}return null;};}function removeEntity(_0x48f2ef,_0x302f42){return function(_0x441e25){if(_0x441e25){return _0x441e25[_0xd2d9('0x2e')]()['then'](function(){_0x48f2ef[_0xd2d9('0x24')](0xcc)[_0xd2d9('0x25')]();});}};}function handleEntityNotFound(_0x515d6e,_0x4ee95f){return function(_0x5a2511){if(!_0x5a2511){_0x515d6e[_0xd2d9('0x2f')](0x194);}return _0x5a2511;};}function handleError(_0x417eb5,_0x45ee17){_0x45ee17=_0x45ee17||0x1f4;return function(_0x2f227f){logger[_0xd2d9('0x1f')](_0x2f227f[_0xd2d9('0x30')]);if(_0x2f227f[_0xd2d9('0x31')]){delete _0x2f227f[_0xd2d9('0x31')];}_0x417eb5[_0xd2d9('0x24')](_0x45ee17)[_0xd2d9('0x32')](_0x2f227f);};}exports['index']=function(_0x2a4023,_0x7c0bff){var _0x2e676d={},_0xffe207={},_0xcb7024={'count':0x0,'rows':[]};var _0x5ec83e=_[_0xd2d9('0x33')](db['ServicenowAccount'][_0xd2d9('0x34')],function(_0x2bbdd3){return{'name':_0x2bbdd3['fieldName'],'type':_0x2bbdd3[_0xd2d9('0x35')]['key']};});_0xffe207[_0xd2d9('0x36')]=_[_0xd2d9('0x33')](_0x5ec83e,'name');_0xffe207[_0xd2d9('0x37')]=_[_0xd2d9('0x38')](_0x2a4023['query']);_0xffe207[_0xd2d9('0x39')]=_[_0xd2d9('0x3a')](_0xffe207[_0xd2d9('0x36')],_0xffe207['query']);_0x2e676d[_0xd2d9('0x3b')]=_[_0xd2d9('0x3a')](_0xffe207[_0xd2d9('0x36')],qs[_0xd2d9('0x3c')](_0x2a4023[_0xd2d9('0x37')]['fields']));_0x2e676d[_0xd2d9('0x3b')]=_0x2e676d[_0xd2d9('0x3b')][_0xd2d9('0x3d')]?_0x2e676d[_0xd2d9('0x3b')]:_0xffe207[_0xd2d9('0x36')];if(!_0x2a4023[_0xd2d9('0x37')][_0xd2d9('0x3e')](_0xd2d9('0x3f'))){_0x2e676d[_0xd2d9('0x28')]=qs[_0xd2d9('0x28')](_0x2a4023['query'][_0xd2d9('0x28')]);_0x2e676d[_0xd2d9('0x27')]=qs[_0xd2d9('0x27')](_0x2a4023[_0xd2d9('0x37')]['offset']);}_0x2e676d[_0xd2d9('0x40')]=qs[_0xd2d9('0x41')](_0x2a4023[_0xd2d9('0x37')][_0xd2d9('0x41')]);_0x2e676d[_0xd2d9('0x42')]=qs[_0xd2d9('0x39')](_[_0xd2d9('0x43')](_0x2a4023[_0xd2d9('0x37')],_0xffe207[_0xd2d9('0x39')]),_0x5ec83e);if(_0x2a4023[_0xd2d9('0x37')]['filter']){_0x2e676d[_0xd2d9('0x42')]=_[_0xd2d9('0x44')](_0x2e676d[_0xd2d9('0x42')],{'$or':_[_0xd2d9('0x33')](_0x5ec83e,function(_0x1d317e){if(_0x1d317e[_0xd2d9('0x35')]!==_0xd2d9('0x45')){var _0x49e895={};_0x49e895[_0x1d317e[_0xd2d9('0x31')]]={'$like':'%'+_0x2a4023[_0xd2d9('0x37')][_0xd2d9('0x46')]+'%'};return _0x49e895;}})});}_0x2e676d=_[_0xd2d9('0x44')]({},_0x2e676d,_0x2a4023[_0xd2d9('0x47')]);var _0x30788b={'where':_0x2e676d['where']};return db[_0xd2d9('0x48')][_0xd2d9('0x49')](_0x30788b)['then'](function(_0x10a9d2){_0xcb7024[_0xd2d9('0x49')]=_0x10a9d2;if(_0x2a4023[_0xd2d9('0x37')]['includeAll']){_0x2e676d['include']=[{'all':!![]}];}return db[_0xd2d9('0x48')][_0xd2d9('0x4a')](_0x2e676d);})['then'](function(_0x145f7){_0xcb7024[_0xd2d9('0x4b')]=_0x145f7;return _0xcb7024;})[_0xd2d9('0x2d')](respondWithFilteredResult(_0x7c0bff,_0x2e676d))[_0xd2d9('0x23')](handleError(_0x7c0bff,null));};exports[_0xd2d9('0x4c')]=function(_0x295522,_0x11bc86){var _0x1069c1={'raw':![],'where':{'id':_0x295522[_0xd2d9('0x4d')]['id']}},_0x258951={};_0x258951[_0xd2d9('0x36')]=_[_0xd2d9('0x38')](db[_0xd2d9('0x48')]['rawAttributes']);_0x258951[_0xd2d9('0x37')]=_[_0xd2d9('0x38')](_0x295522['query']);_0x258951['filters']=_[_0xd2d9('0x3a')](_0x258951[_0xd2d9('0x36')],_0x258951[_0xd2d9('0x37')]);_0x1069c1[_0xd2d9('0x3b')]=_[_0xd2d9('0x3a')](_0x258951[_0xd2d9('0x36')],qs[_0xd2d9('0x3c')](_0x295522[_0xd2d9('0x37')]['fields']));_0x1069c1[_0xd2d9('0x3b')]=_0x1069c1[_0xd2d9('0x3b')][_0xd2d9('0x3d')]?_0x1069c1[_0xd2d9('0x3b')]:_0x258951[_0xd2d9('0x36')];if(_0x295522[_0xd2d9('0x37')][_0xd2d9('0x4e')]){_0x1069c1[_0xd2d9('0x4f')]=[{'all':!![]}];}_0x1069c1=_[_0xd2d9('0x44')]({},_0x1069c1,_0x295522[_0xd2d9('0x47')]);return db[_0xd2d9('0x48')][_0xd2d9('0x50')](_0x1069c1)[_0xd2d9('0x2d')](handleEntityNotFound(_0x11bc86,null))[_0xd2d9('0x2d')](respondWithResult(_0x11bc86,null))[_0xd2d9('0x23')](handleError(_0x11bc86,null));};exports[_0xd2d9('0x51')]=function(_0x2db850,_0x3a0500){return db[_0xd2d9('0x48')][_0xd2d9('0x51')](_0x2db850[_0xd2d9('0x52')],{})[_0xd2d9('0x2d')](respondWithResult(_0x3a0500,0xc9))[_0xd2d9('0x23')](handleError(_0x3a0500,null));};exports[_0xd2d9('0x2c')]=function(_0x36cc49,_0x32a914){if(_0x36cc49[_0xd2d9('0x52')]['id']){delete _0x36cc49[_0xd2d9('0x52')]['id'];}return db[_0xd2d9('0x48')][_0xd2d9('0x50')]({'where':{'id':_0x36cc49[_0xd2d9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x32a914,null))[_0xd2d9('0x2d')](saveUpdates(_0x36cc49[_0xd2d9('0x52')],null))[_0xd2d9('0x2d')](respondWithResult(_0x32a914,null))['catch'](handleError(_0x32a914,null));};exports['destroy']=function(_0x37b2d3,_0x5b0a07){return db['ServicenowAccount'][_0xd2d9('0x50')]({'where':{'id':_0x37b2d3[_0xd2d9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5b0a07,null))[_0xd2d9('0x2d')](removeEntity(_0x5b0a07,null))[_0xd2d9('0x23')](handleError(_0x5b0a07,null));};exports[_0xd2d9('0x53')]=function(_0x421e78,_0x97970a,_0x5123ee){var _0x1a20b0={};var _0x35e95f={};var _0x4650f2;var _0x3b1a67;return db['ServicenowAccount'][_0xd2d9('0x54')]({'where':{'id':_0x421e78[_0xd2d9('0x4d')]['id']}})[_0xd2d9('0x2d')](handleEntityNotFound(_0x97970a,null))[_0xd2d9('0x2d')](function(_0x34ca9e){if(_0x34ca9e){_0x4650f2=_0x34ca9e;_0x35e95f['model']=_[_0xd2d9('0x38')](db[_0xd2d9('0x55')][_0xd2d9('0x34')]);_0x35e95f[_0xd2d9('0x37')]=_['keys'](_0x421e78[_0xd2d9('0x37')]);_0x35e95f['filters']=_[_0xd2d9('0x3a')](_0x35e95f['model'],_0x35e95f[_0xd2d9('0x37')]);_0x1a20b0[_0xd2d9('0x3b')]=_[_0xd2d9('0x3a')](_0x35e95f['model'],qs[_0xd2d9('0x3c')](_0x421e78[_0xd2d9('0x37')][_0xd2d9('0x3c')]));_0x1a20b0[_0xd2d9('0x3b')]=_0x1a20b0['attributes'][_0xd2d9('0x3d')]?_0x1a20b0[_0xd2d9('0x3b')]:_0x35e95f[_0xd2d9('0x36')];_0x1a20b0['order']=qs[_0xd2d9('0x41')](_0x421e78[_0xd2d9('0x37')][_0xd2d9('0x41')]);_0x1a20b0[_0xd2d9('0x42')]=qs[_0xd2d9('0x39')](_['pick'](_0x421e78['query'],_0x35e95f[_0xd2d9('0x39')]));if(_0x421e78[_0xd2d9('0x37')]['filter']){_0x1a20b0['where']=_[_0xd2d9('0x44')](_0x1a20b0[_0xd2d9('0x42')],{'$or':_[_0xd2d9('0x33')](_0x1a20b0[_0xd2d9('0x3b')],function(_0x1a318d){var _0xfda13f={};_0xfda13f[_0x1a318d]={'$like':'%'+_0x421e78[_0xd2d9('0x37')][_0xd2d9('0x46')]+'%'};return _0xfda13f;})});}_0x1a20b0=_[_0xd2d9('0x44')]({},_0x1a20b0,_0x421e78['options']);return _0x4650f2[_0xd2d9('0x53')](_0x1a20b0);}})[_0xd2d9('0x2d')](function(_0x6ff0eb){if(_0x6ff0eb){_0x3b1a67=_0x6ff0eb[_0xd2d9('0x3d')];if(!_0x421e78[_0xd2d9('0x37')][_0xd2d9('0x3e')](_0xd2d9('0x3f'))){_0x1a20b0[_0xd2d9('0x28')]=qs[_0xd2d9('0x28')](_0x421e78[_0xd2d9('0x37')]['limit']);_0x1a20b0[_0xd2d9('0x27')]=qs[_0xd2d9('0x27')](_0x421e78[_0xd2d9('0x37')][_0xd2d9('0x27')]);}return _0x4650f2[_0xd2d9('0x53')](_0x1a20b0);}})[_0xd2d9('0x2d')](function(_0x124b8d){if(_0x124b8d){return _0x124b8d?{'count':_0x3b1a67,'rows':_0x124b8d}:null;}})[_0xd2d9('0x2d')](respondWithResult(_0x97970a,null))[_0xd2d9('0x23')](handleError(_0x97970a,null));};exports['addConfiguration']=function(_0x190f3d,_0xa108c9,_0x4ca917){if(_0x190f3d[_0xd2d9('0x52')]['id']){delete _0x190f3d[_0xd2d9('0x52')]['id'];}return db[_0xd2d9('0x48')][_0xd2d9('0x54')]({'where':{'id':_0x190f3d['params']['id']}})[_0xd2d9('0x2d')](handleEntityNotFound(_0xa108c9,null))[_0xd2d9('0x2d')](function(_0xdf2e91){if(_0xdf2e91){_0x190f3d[_0xd2d9('0x52')][_0xd2d9('0x56')]=_0xdf2e91['id'];_0x190f3d['body']['Subjects']=integrations[_0xd2d9('0x57')](_0x190f3d[_0xd2d9('0x52')][_0xd2d9('0x58')],_0x190f3d['body']['type']);_0x190f3d[_0xd2d9('0x52')][_0xd2d9('0x59')]=integrations[_0xd2d9('0x5a')](_0x190f3d[_0xd2d9('0x52')][_0xd2d9('0x58')],_0x190f3d[_0xd2d9('0x52')][_0xd2d9('0x35')]);return db[_0xd2d9('0x55')][_0xd2d9('0x51')](_0x190f3d['body'],{'include':[{'model':db[_0xd2d9('0x5b')],'as':_0xd2d9('0x5c')},{'model':db[_0xd2d9('0x5b')],'as':'Descriptions'}]});}return null;})[_0xd2d9('0x2d')](respondWithResult(_0xa108c9,null))[_0xd2d9('0x23')](handleError(_0xa108c9,null));};exports['getFields']=function(_0x2e29d9,_0x1346ce,_0x128b4f){var _0x4eef63=['made_sla','hold_reason',_0xd2d9('0x5d'),'subcategory',_0xd2d9('0x5e'),_0xd2d9('0x5f'),_0xd2d9('0x60'),_0xd2d9('0x61'),_0xd2d9('0x62')];var _0x5a12d4=[_0xd2d9('0x63'),'made_sla',_0xd2d9('0x64'),'watch_list',_0xd2d9('0x65'),_0xd2d9('0x66'),_0xd2d9('0x67'),'hold_reason',_0xd2d9('0x68'),'number','resolved_by',_0xd2d9('0x69'),_0xd2d9('0x6a'),_0xd2d9('0x6b'),'sys_created_on','sys_domain',_0xd2d9('0x6c'),_0xd2d9('0x6d'),'knowledge',_0xd2d9('0x40'),'calendar_stc',_0xd2d9('0x6e'),_0xd2d9('0x6f'),'delivery_plan',_0xd2d9('0x70'),'active','work_notes_list',_0xd2d9('0x71'),_0xd2d9('0x72'),_0xd2d9('0x73'),'rfc',_0xd2d9('0x74'),_0xd2d9('0x75'),_0xd2d9('0x76'),'business_duration','group_list',_0xd2d9('0x77'),_0xd2d9('0x78'),_0xd2d9('0x79'),_0xd2d9('0x7a'),_0xd2d9('0x7b'),_0xd2d9('0x7c'),_0xd2d9('0x7d'),_0xd2d9('0x7e'),_0xd2d9('0x5e'),_0xd2d9('0x7f'),_0xd2d9('0x80'),_0xd2d9('0x81'),_0xd2d9('0x82'),_0xd2d9('0x83'),_0xd2d9('0x84'),_0xd2d9('0x85'),_0xd2d9('0x86'),_0xd2d9('0x5f'),_0xd2d9('0x87'),_0xd2d9('0x88'),_0xd2d9('0x89'),'follow_up',_0xd2d9('0x8a'),'sys_id','contact_type',_0xd2d9('0x8b'),_0xd2d9('0x60'),'urgency',_0xd2d9('0x8c'),_0xd2d9('0x8d'),_0xd2d9('0x8e'),_0xd2d9('0x8f'),_0xd2d9('0x90'),_0xd2d9('0x61'),_0xd2d9('0x91'),_0xd2d9('0x92'),_0xd2d9('0x93'),_0xd2d9('0x94'),_0xd2d9('0x95'),_0xd2d9('0x96'),_0xd2d9('0x97'),'sys_tags',_0xd2d9('0x98'),_0xd2d9('0x99'),'correlation_id',_0xd2d9('0x9a'),_0xd2d9('0x62')];var _0x42e8bd='';var _0x4ac22a='';var _0x50c375=[];var _0x5f41d5='';var _0x5acd12='';var _0x516511=[];var _0x2b0080='';var _0x3e4cc1='';var _0x2341c3={};var _0x79c032='';return db['ServicenowAccount'][_0xd2d9('0x54')]({'where':{'id':_0x2e29d9[_0xd2d9('0x4d')]['id']},'attributes':['id',_0xd2d9('0x9b'),_0xd2d9('0x9c'),_0xd2d9('0x9d'),_0xd2d9('0x9e'),_0xd2d9('0x9f')]})['then'](handleEntityNotFound(_0x1346ce,null))[_0xd2d9('0x2d')](function(_0x35d33c){if(_0x35d33c){_0x79c032=_0x35d33c[_0xd2d9('0x9e')];var _0x564757=_0x79c032[_0xd2d9('0xa0')](-0x1);if(_0x564757==='/'){_0x79c032=_0x79c032[_0xd2d9('0xa1')](0x0,_0x79c032[_0xd2d9('0xa2')](_0x564757));}_0x3e4cc1=util['format'](_0xd2d9('0xa3'),_0x79c032);_0x2b0080=util['format']('%s/api/now/table/',_0x79c032);_0x2341c3={'user':_0x35d33c[_0xd2d9('0x9b')],'pass':_0x35d33c[_0xd2d9('0x9c')]};var _0x75bc4={'method':_0xd2d9('0xa4'),'uri':_0x3e4cc1+_0xd2d9('0xa5'),'auth':_0x2341c3,'json':!![]};return rp(_0x75bc4);}})[_0xd2d9('0x2d')](function(_0x10b10c){if(_0x10b10c[_0xd2d9('0x22')]['length']>0x0){_0x42e8bd=_0x10b10c['result'];}console[_0xd2d9('0xa6')]('incident\x20table\x20objects',_0x42e8bd);_0x516511=[];_0x4ac22a=Object[_0xd2d9('0xa7')]([],_0x42e8bd);_[_0xd2d9('0xa8')](_0x4ac22a,function(_0x5f1bad){return!_0x4eef63['includes'](_0x5f1bad[_0xd2d9('0x31')]);});_0x4ac22a['forEach'](function(_0x4a2524){var _0x2f2080=createFieldObject(_0x2b0080,_0x2341c3,_0x4a2524[_0xd2d9('0xa9')],_0x4a2524[_0xd2d9('0x31')],_0x4a2524['label'],![]);_0x516511['push'](_0x2f2080);});return Promise[_0xd2d9('0xaa')](_0x516511);})[_0xd2d9('0x2d')](function(_0x1adb94){_0x50c375=_0x1adb94;_0x5f41d5=Object[_0xd2d9('0xa7')]([],_0x42e8bd);console[_0xd2d9('0xa6')](_0xd2d9('0xab'),_0x42e8bd);_[_0xd2d9('0xa8')](_0x5f41d5,function(_0x27e492){return _0x5a12d4[_0xd2d9('0xac')](_0x27e492[_0xd2d9('0x31')]);});console[_0xd2d9('0xa6')](_0xd2d9('0xad'),_0x5f41d5);_0x516511=[];_0x5f41d5['forEach'](function(_0x40f5ae){var _0x164199=createFieldObject(_0x2b0080,_0x2341c3,_0x40f5ae[_0xd2d9('0xa9')],_0x40f5ae[_0xd2d9('0x31')],_0x40f5ae['label'],!![]);_0x516511[_0xd2d9('0xae')](_0x164199);});return Promise[_0xd2d9('0xaa')](_0x516511);})[_0xd2d9('0x2d')](function(_0x381fb7){_0x5acd12=_0x381fb7;var _0x170554=_0x50c375[_0xd2d9('0xaf')](_0x5acd12);return{'count':_0x170554[_0xd2d9('0x3d')],'rows':_0x170554};})[_0xd2d9('0x2d')](respondWithResult(_0x1346ce,null))[_0xd2d9('0x23')](function(_0x1728dc){console[_0xd2d9('0xa6')](_0xd2d9('0xb0')+_0x1728dc);var _0xd30d48=_0x2e29d9[_0xd2d9('0x37')]['test']?0x1f4:_0x1728dc['statusCode']||0x1f4;logger[_0xd2d9('0x1f')](_0x1728dc[_0xd2d9('0x30')]);delete _0x1728dc[_0xd2d9('0x31')];if(_0xd30d48===0x191){_0xd30d48=0x190;}_0x1346ce[_0xd2d9('0x24')](_0xd30d48)[_0xd2d9('0x32')](_0x2e29d9[_0xd2d9('0x37')][_0xd2d9('0xb1')]?{'message':_0xd2d9('0xb2'),'statusCode':_0x1728dc['statusCode']}:_0x1728dc);});};function createFieldObject(_0x2c4167,_0x4bff4d,_0x341fea,_0x13949a,_0x5591a1,_0x522ae0){return new Promise(function(_0x50a27b,_0x2e4886){var _0x5bace1={'id':_0x13949a,'name':_0x5591a1,'custom':_0x522ae0};if(_0x341fea===_0xd2d9('0xb3')){_0x5bace1[_0xd2d9('0x47')]=[{'name':'True','value':_0xd2d9('0xb4')},{'name':_0xd2d9('0xb5'),'value':'false'}];_0x50a27b(_0x5bace1);}else{var _0x4c3fa1={'method':_0xd2d9('0xa4'),'uri':_0x2c4167+_0xd2d9('0xb6')+_0x13949a,'auth':_0x4bff4d,'json':!![]};return rp(_0x4c3fa1)[_0xd2d9('0x2d')](function(_0x4ed0e9){var _0x31f9e4=[];if(_0x4ed0e9[_0xd2d9('0x22')][_0xd2d9('0x3d')]>0x0){_0x4ed0e9[_0xd2d9('0x22')][_0xd2d9('0xb7')](function(_0x16713a){if(_0x16713a[_0xd2d9('0xb8')]===_0xd2d9('0xb9')){var _0x43be3a={'name':_0x16713a[_0xd2d9('0xba')],'value':_0x16713a[_0xd2d9('0xbb')]};_0x31f9e4['push'](_0x43be3a);}});}_0x5bace1[_0xd2d9('0x47')]=_0x31f9e4;if(_0x5bace1[_0xd2d9('0x47')]['length']>0x0){_0x50a27b(_0x5bace1);}else{if(_0x522ae0==![]){_0x50a27b();}else{_0x50a27b(_0x5bace1);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 7979b24..4676a15 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 _0xcd59=['bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0xcd59,0x14b));var _0x9cd5=function(_0x4a3f51,_0x3d9868){_0x4a3f51=_0x4a3f51-0x0;var _0x4d48d6=_0xcd59[_0x4a3f51];return _0x4d48d6;};'use strict';var _=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var logger=require(_0x9cd5('0x2'))(_0x9cd5('0x3'));var moment=require(_0x9cd5('0x4'));var BPromise=require(_0x9cd5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9cd5('0x6'));var rimraf=require(_0x9cd5('0x7'));var config=require(_0x9cd5('0x8'));var attributes=require(_0x9cd5('0x9'));var integrations=require(_0x9cd5('0xa'));module[_0x9cd5('0xb')]=function(_0x46277c,_0x2cd19a){return _0x46277c[_0x9cd5('0xc')](_0x9cd5('0xd'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0309=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','lodash','../../config/logger','moment'];(function(_0x380649,_0x2ac7dc){var _0x2f3d01=function(_0xa70df2){while(--_0xa70df2){_0x380649['push'](_0x380649['shift']());}};_0x2f3d01(++_0x2ac7dc);}(_0x0309,0x165));var _0x9030=function(_0x2f5ead,_0x26007a){_0x2f5ead=_0x2f5ead-0x0;var _0x23d5aa=_0x0309[_0x2f5ead];return _0x23d5aa;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var fs=require('fs');var path=require(_0x9030('0x5'));var rimraf=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var attributes=require(_0x9030('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1c9c7b,_0x105c15){return _0x1c9c7b['define'](_0x9030('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index ccd0751..aaf6407 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 _0xa9c7=['result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x54db30,_0x45f417){var _0x5535e6=function(_0xc5f978){while(--_0xc5f978){_0x54db30['push'](_0x54db30['shift']());}};_0x5535e6(++_0x45f417);}(_0xa9c7,0x1b3));var _0x7a9c=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0xa9c7[_0x5ef55a];return _0x20ae40;};'use strict';var _=require(_0x7a9c('0x0'));var util=require(_0x7a9c('0x1'));var moment=require(_0x7a9c('0x2'));var BPromise=require(_0x7a9c('0x3'));var rs=require(_0x7a9c('0x4'));var fs=require('fs');var Redis=require(_0x7a9c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a9c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7a9c('0x7'));var jayson=require(_0x7a9c('0x8'));var client=jayson['client'][_0x7a9c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d6d72,_0x261e0e,_0x4d7c30){return new BPromise(function(_0x28c1f0,_0x4d69c7){return client['request'](_0x4d6d72,_0x4d7c30)[_0x7a9c('0xa')](function(_0x559094){logger[_0x7a9c('0xb')](_0x7a9c('0xc'),_0x261e0e,_0x7a9c('0xd'));logger[_0x7a9c('0xe')](_0x7a9c('0xf'),_0x261e0e,_0x7a9c('0xd'),JSON[_0x7a9c('0x10')](_0x559094));if(_0x559094[_0x7a9c('0x11')]){if(_0x559094[_0x7a9c('0x11')][_0x7a9c('0x12')]===0x1f4){logger[_0x7a9c('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x261e0e,_0x559094['error']['message']);return _0x4d69c7(_0x559094[_0x7a9c('0x11')][_0x7a9c('0x13')]);}logger[_0x7a9c('0x11')](_0x7a9c('0xc'),_0x261e0e,_0x559094[_0x7a9c('0x11')][_0x7a9c('0x13')]);return _0x28c1f0(_0x559094[_0x7a9c('0x11')][_0x7a9c('0x13')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x261e0e,_0x7a9c('0xd'));_0x28c1f0(_0x559094[_0x7a9c('0x14')][_0x7a9c('0x13')]);}})[_0x7a9c('0x15')](function(_0x2623a7){logger[_0x7a9c('0x11')](_0x7a9c('0xc'),_0x261e0e,_0x2623a7);_0x4d69c7(_0x2623a7);});});}exports[_0x7a9c('0x16')]=function(_0x3f0330){var _0x484c58=this;return new Promise(function(_0x54a1b0,_0x4efeb3){return db[_0x7a9c('0x17')][_0x7a9c('0x18')]({'raw':_0x3f0330[_0x7a9c('0x19')]?_0x3f0330[_0x7a9c('0x19')][_0x7a9c('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f0330[_0x7a9c('0x19')]?_0x3f0330[_0x7a9c('0x19')]['where']||null:null,'attributes':_0x3f0330[_0x7a9c('0x19')]?_0x3f0330[_0x7a9c('0x19')][_0x7a9c('0x1b')]||null:null,'limit':_0x3f0330[_0x7a9c('0x19')]?_0x3f0330[_0x7a9c('0x19')][_0x7a9c('0x1c')]||null:null,'include':_0x3f0330[_0x7a9c('0x19')]?_0x3f0330[_0x7a9c('0x19')][_0x7a9c('0x1d')]?_[_0x7a9c('0x1e')](_0x3f0330['options'][_0x7a9c('0x1d')],function(_0x23ae66){return{'model':db[_0x23ae66['model']],'as':_0x23ae66['as'],'attributes':_0x23ae66[_0x7a9c('0x1b')],'include':_0x23ae66[_0x7a9c('0x1d')]?_[_0x7a9c('0x1e')](_0x23ae66['include'],function(_0x304d90){return{'model':db[_0x304d90[_0x7a9c('0x1f')]],'as':_0x304d90['as'],'attributes':_0x304d90['attributes'],'include':_0x304d90['include']?_[_0x7a9c('0x1e')](_0x304d90[_0x7a9c('0x1d')],function(_0x59b49c){return{'model':db[_0x59b49c[_0x7a9c('0x1f')]],'as':_0x59b49c['as'],'attributes':_0x59b49c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a9c('0xa')](function(_0xad5567){logger[_0x7a9c('0xb')](_0x7a9c('0x16'),_0x3f0330);logger[_0x7a9c('0xe')](_0x7a9c('0x16'),_0x3f0330,JSON[_0x7a9c('0x10')](_0xad5567));_0x54a1b0(_0xad5567);})[_0x7a9c('0x15')](function(_0x9fe1d5){logger[_0x7a9c('0x11')](_0x7a9c('0x16'),_0x9fe1d5[_0x7a9c('0x13')],_0x3f0330);_0x4efeb3(_0x484c58['error'](0x1f4,_0x9fe1d5[_0x7a9c('0x13')]));});});};exports[_0x7a9c('0x20')]=function(_0x546f90){var _0x4af3c0=this;return new Promise(function(_0x13aec7,_0x3e5f8f){return db['ServicenowAccount'][_0x7a9c('0x21')]({'raw':_0x546f90['options']?_0x546f90[_0x7a9c('0x19')][_0x7a9c('0x1a')]===undefined?!![]:![]:!![],'where':_0x546f90[_0x7a9c('0x19')]?_0x546f90['options'][_0x7a9c('0x22')]||null:null,'attributes':_0x546f90[_0x7a9c('0x19')]?_0x546f90[_0x7a9c('0x19')][_0x7a9c('0x1b')]||null:null,'include':_0x546f90['options']?_0x546f90[_0x7a9c('0x19')][_0x7a9c('0x1d')]?_[_0x7a9c('0x1e')](_0x546f90['options'][_0x7a9c('0x1d')],function(_0x5444f1){return{'model':db[_0x5444f1[_0x7a9c('0x1f')]],'as':_0x5444f1['as'],'attributes':_0x5444f1[_0x7a9c('0x1b')],'include':_0x5444f1[_0x7a9c('0x1d')]?_['map'](_0x5444f1[_0x7a9c('0x1d')],function(_0x4f9b26){return{'model':db[_0x4f9b26['model']],'as':_0x4f9b26['as'],'attributes':_0x4f9b26[_0x7a9c('0x1b')],'include':_0x4f9b26['include']?_[_0x7a9c('0x1e')](_0x4f9b26[_0x7a9c('0x1d')],function(_0x42218d){return{'model':db[_0x42218d[_0x7a9c('0x1f')]],'as':_0x42218d['as'],'attributes':_0x42218d[_0x7a9c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7a9c('0xa')](function(_0x3a3547){logger[_0x7a9c('0xb')]('ShowServicenowAccount',_0x546f90);logger[_0x7a9c('0xe')](_0x7a9c('0x20'),_0x546f90,JSON[_0x7a9c('0x10')](_0x3a3547));_0x13aec7(_0x3a3547);})['catch'](function(_0x1b2d70){logger['error'](_0x7a9c('0x20'),_0x1b2d70[_0x7a9c('0x13')],_0x546f90);_0x3e5f8f(_0x4af3c0[_0x7a9c('0x11')](0x1f4,_0x1b2d70['message']));});});}; \ No newline at end of file +var _0xf26c=['jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetServicenowAccount','findAll','options','where','attributes','limit','include','map','model','stringify','ShowServicenowAccount','ServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2e2ce9,_0x39945f){var _0x30f2f6=function(_0x186959){while(--_0x186959){_0x2e2ce9['push'](_0x2e2ce9['shift']());}};_0x30f2f6(++_0x39945f);}(_0xf26c,0x144));var _0xcf26=function(_0x46e3d7,_0xbbd484){_0x46e3d7=_0x46e3d7-0x0;var _0x34c3e4=_0xf26c[_0x46e3d7];return _0x34c3e4;};'use strict';var _=require(_0xcf26('0x0'));var util=require(_0xcf26('0x1'));var moment=require(_0xcf26('0x2'));var BPromise=require(_0xcf26('0x3'));var rs=require(_0xcf26('0x4'));var fs=require('fs');var Redis=require(_0xcf26('0x5'));var db=require(_0xcf26('0x6'))['db'];var utils=require(_0xcf26('0x7'));var logger=require(_0xcf26('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf26('0x9'));var client=jayson[_0xcf26('0xa')][_0xcf26('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ddd5b,_0x782752,_0x593a54){return new BPromise(function(_0x4cb85b,_0x3df54f){return client[_0xcf26('0xc')](_0x4ddd5b,_0x593a54)[_0xcf26('0xd')](function(_0x35d8a2){logger[_0xcf26('0xe')](_0xcf26('0xf'),_0x782752,'request\x20sent');logger[_0xcf26('0x10')](_0xcf26('0x11'),_0x782752,_0xcf26('0x12'),JSON['stringify'](_0x35d8a2));if(_0x35d8a2['error']){if(_0x35d8a2[_0xcf26('0x13')][_0xcf26('0x14')]===0x1f4){logger[_0xcf26('0x13')](_0xcf26('0xf'),_0x782752,_0x35d8a2['error'][_0xcf26('0x15')]);return _0x3df54f(_0x35d8a2[_0xcf26('0x13')]['message']);}logger['error'](_0xcf26('0xf'),_0x782752,_0x35d8a2['error']['message']);return _0x4cb85b(_0x35d8a2[_0xcf26('0x13')]['message']);}else{logger[_0xcf26('0xe')](_0xcf26('0xf'),_0x782752,_0xcf26('0x12'));_0x4cb85b(_0x35d8a2[_0xcf26('0x16')]['message']);}})[_0xcf26('0x17')](function(_0x47b823){logger[_0xcf26('0x13')](_0xcf26('0xf'),_0x782752,_0x47b823);_0x3df54f(_0x47b823);});});}exports[_0xcf26('0x18')]=function(_0x198adc){var _0x47a392=this;return new Promise(function(_0x159ba2,_0x217be6){return db['ServicenowAccount'][_0xcf26('0x19')]({'raw':_0x198adc['options']?_0x198adc[_0xcf26('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x198adc['options']?_0x198adc['options'][_0xcf26('0x1b')]||null:null,'attributes':_0x198adc[_0xcf26('0x1a')]?_0x198adc['options'][_0xcf26('0x1c')]||null:null,'limit':_0x198adc['options']?_0x198adc[_0xcf26('0x1a')][_0xcf26('0x1d')]||null:null,'include':_0x198adc['options']?_0x198adc['options'][_0xcf26('0x1e')]?_[_0xcf26('0x1f')](_0x198adc['options']['include'],function(_0x19b761){return{'model':db[_0x19b761[_0xcf26('0x20')]],'as':_0x19b761['as'],'attributes':_0x19b761[_0xcf26('0x1c')],'include':_0x19b761[_0xcf26('0x1e')]?_[_0xcf26('0x1f')](_0x19b761[_0xcf26('0x1e')],function(_0x4bcf01){return{'model':db[_0x4bcf01[_0xcf26('0x20')]],'as':_0x4bcf01['as'],'attributes':_0x4bcf01[_0xcf26('0x1c')],'include':_0x4bcf01['include']?_[_0xcf26('0x1f')](_0x4bcf01['include'],function(_0x58b62c){return{'model':db[_0x58b62c[_0xcf26('0x20')]],'as':_0x58b62c['as'],'attributes':_0x58b62c[_0xcf26('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcf26('0xd')](function(_0x1e42e7){logger[_0xcf26('0xe')](_0xcf26('0x18'),_0x198adc);logger['debug'](_0xcf26('0x18'),_0x198adc,JSON[_0xcf26('0x21')](_0x1e42e7));_0x159ba2(_0x1e42e7);})[_0xcf26('0x17')](function(_0x59451a){logger[_0xcf26('0x13')]('GetServicenowAccount',_0x59451a[_0xcf26('0x15')],_0x198adc);_0x217be6(_0x47a392['error'](0x1f4,_0x59451a['message']));});});};exports[_0xcf26('0x22')]=function(_0x301d80){var _0xc32b23=this;return new Promise(function(_0x19b67a,_0x38b45c){return db[_0xcf26('0x23')][_0xcf26('0x24')]({'raw':_0x301d80[_0xcf26('0x1a')]?_0x301d80[_0xcf26('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x301d80[_0xcf26('0x1a')]?_0x301d80['options'][_0xcf26('0x1b')]||null:null,'attributes':_0x301d80[_0xcf26('0x1a')]?_0x301d80['options'][_0xcf26('0x1c')]||null:null,'include':_0x301d80[_0xcf26('0x1a')]?_0x301d80[_0xcf26('0x1a')][_0xcf26('0x1e')]?_[_0xcf26('0x1f')](_0x301d80[_0xcf26('0x1a')][_0xcf26('0x1e')],function(_0x51014b){return{'model':db[_0x51014b[_0xcf26('0x20')]],'as':_0x51014b['as'],'attributes':_0x51014b[_0xcf26('0x1c')],'include':_0x51014b[_0xcf26('0x1e')]?_[_0xcf26('0x1f')](_0x51014b[_0xcf26('0x1e')],function(_0x40fca7){return{'model':db[_0x40fca7[_0xcf26('0x20')]],'as':_0x40fca7['as'],'attributes':_0x40fca7['attributes'],'include':_0x40fca7[_0xcf26('0x1e')]?_['map'](_0x40fca7[_0xcf26('0x1e')],function(_0x1c6a6b){return{'model':db[_0x1c6a6b[_0xcf26('0x20')]],'as':_0x1c6a6b['as'],'attributes':_0x1c6a6b[_0xcf26('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcf26('0xd')](function(_0x2dc0f3){logger[_0xcf26('0xe')](_0xcf26('0x22'),_0x301d80);logger[_0xcf26('0x10')](_0xcf26('0x22'),_0x301d80,JSON[_0xcf26('0x21')](_0x2dc0f3));_0x19b67a(_0x2dc0f3);})['catch'](function(_0x15b97f){logger[_0xcf26('0x13')](_0xcf26('0x22'),_0x15b97f[_0xcf26('0x15')],_0x301d80);_0x38b45c(_0xc32b23['error'](0x1f4,_0x15b97f[_0xcf26('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 9578bb6..25ac0c9 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 _0x6253=['isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x3e0aa6,_0x1a542b){var _0x2443cb=function(_0x3578ec){while(--_0x3578ec){_0x3e0aa6['push'](_0x3e0aa6['shift']());}};_0x2443cb(++_0x1a542b);}(_0x6253,0x19a));var _0x3625=function(_0xcb0730,_0x2338c5){_0xcb0730=_0xcb0730-0x0;var _0x2e61df=_0x6253[_0xcb0730];return _0x2e61df;};'use strict';var multer=require(_0x3625('0x0'));var util=require('util');var path=require(_0x3625('0x1'));var timeout=require(_0x3625('0x2'));var express=require(_0x3625('0x3'));var router=express[_0x3625('0x4')]();var auth=require(_0x3625('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3625('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x3625('0x7')]('/',auth[_0x3625('0x8')](),controller[_0x3625('0x9')]);router[_0x3625('0x7')]('/:id',auth[_0x3625('0x8')](),controller[_0x3625('0xa')]);router['get'](_0x3625('0xb'),auth[_0x3625('0x8')](),controller[_0x3625('0xc')]);router[_0x3625('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x3625('0xd')]);router[_0x3625('0x7')](_0x3625('0xe'),auth[_0x3625('0x8')](),controller['getDescriptions']);router[_0x3625('0xf')]('/',auth[_0x3625('0x8')](),controller[_0x3625('0x10')]);router[_0x3625('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3625('0x12')]);router[_0x3625('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3625('0x14')]);module[_0x3625('0x15')]=router; \ No newline at end of file +var _0xe68d=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x465137,_0x3ec0b0){var _0xd61384=function(_0x2f2fa3){while(--_0x2f2fa3){_0x465137['push'](_0x465137['shift']());}};_0xd61384(++_0x3ec0b0);}(_0xe68d,0xef));var _0xde68=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0xe68d[_0x5e6bec];return _0x5dc5cf;};'use strict';var multer=require(_0xde68('0x0'));var util=require(_0xde68('0x1'));var path=require(_0xde68('0x2'));var timeout=require(_0xde68('0x3'));var express=require(_0xde68('0x4'));var router=express[_0xde68('0x5')]();var auth=require(_0xde68('0x6'));var interaction=require(_0xde68('0x7'));var config=require(_0xde68('0x8'));var controller=require('./intServicenowConfiguration.controller');router[_0xde68('0x9')]('/',auth[_0xde68('0xa')](),controller['index']);router[_0xde68('0x9')](_0xde68('0xb'),auth[_0xde68('0xa')](),controller['show']);router[_0xde68('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xde68('0xc')]);router[_0xde68('0x9')](_0xde68('0xd'),auth[_0xde68('0xa')](),controller['getSubjects']);router[_0xde68('0x9')](_0xde68('0xe'),auth[_0xde68('0xa')](),controller[_0xde68('0xf')]);router[_0xde68('0x10')]('/',auth[_0xde68('0xa')](),controller[_0xde68('0x11')]);router[_0xde68('0x12')](_0xde68('0xb'),auth[_0xde68('0xa')](),controller[_0xde68('0x13')]);router[_0xde68('0x14')](_0xde68('0xb'),auth[_0xde68('0xa')](),controller[_0xde68('0x15')]);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 42f0877..ff185a8 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 _0xda2e=['sequelize','exports','STRING'];(function(_0x1f24f8,_0x1235fb){var _0x2554d8=function(_0x20e826){while(--_0x20e826){_0x1f24f8['push'](_0x1f24f8['shift']());}};_0x2554d8(++_0x1235fb);}(_0xda2e,0xae));var _0xeda2=function(_0x373daf,_0x18b9a8){_0x373daf=_0x373daf-0x0;var _0x1fa416=_0xda2e[_0x373daf];return _0x1fa416;};'use strict';var Sequelize=require(_0xeda2('0x0'));module[_0xeda2('0x1')]={'name':{'type':Sequelize[_0xeda2('0x2')]},'description':{'type':Sequelize[_0xeda2('0x2')]}}; \ No newline at end of file +var _0xb84b=['exports','STRING','sequelize'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xb84b,0x89));var _0xbb84=function(_0x40c768,_0x231879){_0x40c768=_0x40c768-0x0;var _0x416504=_0xb84b[_0x40c768];return _0x416504;};'use strict';var Sequelize=require(_0xbb84('0x0'));module[_0xbb84('0x1')]={'name':{'type':Sequelize[_0xbb84('0x2')]},'description':{'type':Sequelize[_0xbb84('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index fe90ecc..59df140 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 _0xc6b5=['reject','save','update','then','destroy','end','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','show','params','rawAttributes','intersection','options','create','body','find','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','html-pdf','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply'];(function(_0x5d1761,_0x5057c2){var _0x5dccb=function(_0x5a446d){while(--_0x5a446d){_0x5d1761['push'](_0x5d1761['shift']());}};_0x5dccb(++_0x5057c2);}(_0xc6b5,0x81));var _0x5c6b=function(_0x5a62f1,_0x50a384){_0x5a62f1=_0x5a62f1-0x0;var _0x42c93c=_0xc6b5[_0x5a62f1];return _0x42c93c;};'use strict';var pdf=require(_0x5c6b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5c6b('0x1'));var rp=require(_0x5c6b('0x2'));var moment=require(_0x5c6b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5c6b('0x4'));var sox=require(_0x5c6b('0x5'));var csv=require('to-csv');var ejs=require(_0x5c6b('0x6'));var fs=require('fs');var _=require(_0x5c6b('0x7'));var squel=require(_0x5c6b('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5c6b('0x9'));var toCsv=require(_0x5c6b('0xa'));var querystring=require(_0x5c6b('0xb'));var Papa=require(_0x5c6b('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5c6b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c6b('0xe'))(_0x5c6b('0xf'));var utils=require(_0x5c6b('0x10'));var config=require(_0x5c6b('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5c6b('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x6f0770,_0x46c9a6,_0x2bdac9,_0x787425){return new BPromise(function(_0x2d5482,_0x58d1a2){var _0x22d4f2=_0x787425||client;return _0x22d4f2[_0x5c6b('0x13')](_0x6f0770,_0x2bdac9)['then'](function(_0x1dca01){logger[_0x5c6b('0x14')](_0x5c6b('0x15'),_0x46c9a6,'request\x20sent');logger[_0x5c6b('0x16')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x46c9a6,'request\x20sent',JSON['stringify'](_0x1dca01));if(_0x1dca01['error']){if(_0x1dca01[_0x5c6b('0x17')][_0x5c6b('0x18')]===0x1f4){logger['error'](_0x5c6b('0x15'),_0x46c9a6,_0x1dca01['error'][_0x5c6b('0x19')]);return _0x58d1a2(_0x1dca01[_0x5c6b('0x17')][_0x5c6b('0x19')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x46c9a6,_0x1dca01[_0x5c6b('0x17')][_0x5c6b('0x19')]);return _0x2d5482(_0x1dca01[_0x5c6b('0x17')][_0x5c6b('0x19')]);}else{logger[_0x5c6b('0x14')](_0x5c6b('0x15'),_0x46c9a6,_0x5c6b('0x1a'));_0x2d5482(_0x1dca01[_0x5c6b('0x1b')]['message']);}})[_0x5c6b('0x1c')](function(_0x322ba1){logger[_0x5c6b('0x17')](_0x5c6b('0x15'),_0x46c9a6,_0x322ba1);_0x58d1a2(_0x322ba1);});});}function respondWithStatusCode(_0x2ac161,_0x1eef4a){_0x1eef4a=_0x1eef4a||0xcc;return function(_0x56ecc7){if(_0x56ecc7){return _0x2ac161[_0x5c6b('0x1d')](_0x1eef4a);}return _0x2ac161[_0x5c6b('0x1e')](_0x1eef4a)['end']();};}function respondWithResult(_0x599888,_0x31d18d){_0x31d18d=_0x31d18d||0xc8;return function(_0x2fcd1d){if(_0x2fcd1d){return _0x599888[_0x5c6b('0x1e')](_0x31d18d)[_0x5c6b('0x1f')](_0x2fcd1d);}};}function respondWithFilteredResult(_0x1e531e,_0x1ee152){return function(_0x43abe0){if(_0x43abe0){var _0x282803=_0x43abe0[_0x5c6b('0x20')],_0x215249=_0x1ee152[_0x5c6b('0x21')],_0x17a3ec=_0x1ee152[_0x5c6b('0x21')]+_0x1ee152[_0x5c6b('0x22')],_0x495b29;if(_0x17a3ec>=_0x282803){_0x17a3ec=_0x282803;_0x495b29=0xc8;}else{_0x495b29=0xce;}_0x1e531e[_0x5c6b('0x1e')](_0x495b29);return _0x1e531e['set'](_0x5c6b('0x23'),_0x215249+'-'+_0x17a3ec+'/'+_0x282803)[_0x5c6b('0x1f')](_0x43abe0);}return null;};}function patchUpdates(_0xb922fd){return function(_0x582b0d){try{jsonpatch[_0x5c6b('0x24')](_0x582b0d,_0xb922fd,!![]);}catch(_0x3de117){return BPromise[_0x5c6b('0x25')](_0x3de117);}return _0x582b0d[_0x5c6b('0x26')]();};}function saveUpdates(_0x1c35c9,_0x4fe0b6){return function(_0x30b22c){if(_0x30b22c){return _0x30b22c[_0x5c6b('0x27')](_0x1c35c9)[_0x5c6b('0x28')](function(_0xa3871a){return _0xa3871a;});}return null;};}function removeEntity(_0x184140,_0x3a906e){return function(_0x43eda8){if(_0x43eda8){return _0x43eda8[_0x5c6b('0x29')]()[_0x5c6b('0x28')](function(){_0x184140[_0x5c6b('0x1e')](0xcc)[_0x5c6b('0x2a')]();});}};}function handleEntityNotFound(_0x1aa9f3,_0x3e5afb){return function(_0x5575e0){if(!_0x5575e0){_0x1aa9f3['sendStatus'](0x194);}return _0x5575e0;};}function handleError(_0xd8245c,_0x152e27){_0x152e27=_0x152e27||0x1f4;return function(_0x199491){logger[_0x5c6b('0x17')](_0x199491[_0x5c6b('0x2b')]);if(_0x199491[_0x5c6b('0x2c')]){delete _0x199491[_0x5c6b('0x2c')];}_0xd8245c[_0x5c6b('0x1e')](_0x152e27)[_0x5c6b('0x2d')](_0x199491);};}exports[_0x5c6b('0x2e')]=function(_0x36c56d,_0x4c8289){var _0x50dc59={},_0x3bddf1={},_0x45cdfb={'count':0x0,'rows':[]};var _0x4b5fbf=_[_0x5c6b('0x2f')](db[_0x5c6b('0x30')]['rawAttributes'],function(_0x4d631b){return{'name':_0x4d631b[_0x5c6b('0x31')],'type':_0x4d631b[_0x5c6b('0x32')][_0x5c6b('0x33')]};});_0x3bddf1[_0x5c6b('0x34')]=_[_0x5c6b('0x2f')](_0x4b5fbf,_0x5c6b('0x2c'));_0x3bddf1['query']=_[_0x5c6b('0x35')](_0x36c56d[_0x5c6b('0x36')]);_0x3bddf1[_0x5c6b('0x37')]=_['intersection'](_0x3bddf1[_0x5c6b('0x34')],_0x3bddf1['query']);_0x50dc59[_0x5c6b('0x38')]=_['intersection'](_0x3bddf1[_0x5c6b('0x34')],qs['fields'](_0x36c56d[_0x5c6b('0x36')][_0x5c6b('0x39')]));_0x50dc59[_0x5c6b('0x38')]=_0x50dc59[_0x5c6b('0x38')][_0x5c6b('0x3a')]?_0x50dc59['attributes']:_0x3bddf1['model'];if(!_0x36c56d[_0x5c6b('0x36')][_0x5c6b('0x3b')]('nolimit')){_0x50dc59[_0x5c6b('0x22')]=qs['limit'](_0x36c56d['query'][_0x5c6b('0x22')]);_0x50dc59[_0x5c6b('0x21')]=qs[_0x5c6b('0x21')](_0x36c56d[_0x5c6b('0x36')][_0x5c6b('0x21')]);}_0x50dc59[_0x5c6b('0x3c')]=qs[_0x5c6b('0x3d')](_0x36c56d[_0x5c6b('0x36')]['sort']);_0x50dc59[_0x5c6b('0x3e')]=qs[_0x5c6b('0x37')](_[_0x5c6b('0x3f')](_0x36c56d[_0x5c6b('0x36')],_0x3bddf1[_0x5c6b('0x37')]),_0x4b5fbf);if(_0x36c56d[_0x5c6b('0x36')]['filter']){_0x50dc59[_0x5c6b('0x3e')]=_[_0x5c6b('0x40')](_0x50dc59[_0x5c6b('0x3e')],{'$or':_[_0x5c6b('0x2f')](_0x4b5fbf,function(_0x503339){if(_0x503339[_0x5c6b('0x32')]!==_0x5c6b('0x41')){var _0x4cc3cd={};_0x4cc3cd[_0x503339[_0x5c6b('0x2c')]]={'$like':'%'+_0x36c56d[_0x5c6b('0x36')][_0x5c6b('0x42')]+'%'};return _0x4cc3cd;}})});}_0x50dc59=_[_0x5c6b('0x40')]({},_0x50dc59,_0x36c56d['options']);var _0x2a3b3a={'where':_0x50dc59[_0x5c6b('0x3e')]};return db['ServicenowConfiguration'][_0x5c6b('0x20')](_0x2a3b3a)['then'](function(_0x30cd4f){_0x45cdfb[_0x5c6b('0x20')]=_0x30cd4f;if(_0x36c56d[_0x5c6b('0x36')][_0x5c6b('0x43')]){_0x50dc59[_0x5c6b('0x44')]=[{'all':!![]}];}return db[_0x5c6b('0x30')]['findAll'](_0x50dc59);})[_0x5c6b('0x28')](function(_0x6aaab7){_0x45cdfb['rows']=_0x6aaab7;return _0x45cdfb;})['then'](respondWithFilteredResult(_0x4c8289,_0x50dc59))[_0x5c6b('0x1c')](handleError(_0x4c8289,null));};exports[_0x5c6b('0x45')]=function(_0x3e51c6,_0x57279c){var _0xa58eca={'raw':![],'where':{'id':_0x3e51c6[_0x5c6b('0x46')]['id']}},_0x3a6753={};_0x3a6753[_0x5c6b('0x34')]=_[_0x5c6b('0x35')](db[_0x5c6b('0x30')][_0x5c6b('0x47')]);_0x3a6753[_0x5c6b('0x36')]=_[_0x5c6b('0x35')](_0x3e51c6[_0x5c6b('0x36')]);_0x3a6753[_0x5c6b('0x37')]=_['intersection'](_0x3a6753[_0x5c6b('0x34')],_0x3a6753['query']);_0xa58eca[_0x5c6b('0x38')]=_[_0x5c6b('0x48')](_0x3a6753[_0x5c6b('0x34')],qs[_0x5c6b('0x39')](_0x3e51c6[_0x5c6b('0x36')][_0x5c6b('0x39')]));_0xa58eca[_0x5c6b('0x38')]=_0xa58eca[_0x5c6b('0x38')]['length']?_0xa58eca[_0x5c6b('0x38')]:_0x3a6753[_0x5c6b('0x34')];if(_0x3e51c6['query'][_0x5c6b('0x43')]){_0xa58eca[_0x5c6b('0x44')]=[{'all':!![]}];}_0xa58eca=_[_0x5c6b('0x40')]({},_0xa58eca,_0x3e51c6[_0x5c6b('0x49')]);return db['ServicenowConfiguration']['find'](_0xa58eca)['then'](handleEntityNotFound(_0x57279c,null))[_0x5c6b('0x28')](respondWithResult(_0x57279c,null))[_0x5c6b('0x1c')](handleError(_0x57279c,null));};exports['create']=function(_0x1add24,_0x49c2ca){return db[_0x5c6b('0x30')][_0x5c6b('0x4a')](_0x1add24[_0x5c6b('0x4b')],{})['then'](respondWithResult(_0x49c2ca,0xc9))['catch'](handleError(_0x49c2ca,null));};exports['update']=function(_0x2c8cc7,_0x3785c1){if(_0x2c8cc7[_0x5c6b('0x4b')]['id']){delete _0x2c8cc7[_0x5c6b('0x4b')]['id'];}return db[_0x5c6b('0x30')][_0x5c6b('0x4c')]({'where':{'id':_0x2c8cc7[_0x5c6b('0x46')]['id']}})[_0x5c6b('0x28')](handleEntityNotFound(_0x3785c1,null))['then'](saveUpdates(_0x2c8cc7[_0x5c6b('0x4b')],null))[_0x5c6b('0x28')](respondWithResult(_0x3785c1,null))[_0x5c6b('0x1c')](handleError(_0x3785c1,null));};exports[_0x5c6b('0x29')]=function(_0xb496ac,_0x2a1a54){return db[_0x5c6b('0x30')][_0x5c6b('0x4c')]({'where':{'id':_0xb496ac[_0x5c6b('0x46')]['id']}})[_0x5c6b('0x28')](handleEntityNotFound(_0x2a1a54,null))[_0x5c6b('0x28')](removeEntity(_0x2a1a54,null))[_0x5c6b('0x1c')](handleError(_0x2a1a54,null));};exports[_0x5c6b('0x4d')]=function(_0x44cb0d,_0x156377,_0x45bff0){var _0x47f504={};var _0x15e6bb={};var _0x3d1272;var _0x3082fb;return db[_0x5c6b('0x30')][_0x5c6b('0x4e')]({'where':{'id':_0x44cb0d['params']['id']}})['then'](handleEntityNotFound(_0x156377,null))[_0x5c6b('0x28')](function(_0x6416de){if(_0x6416de){_0x3d1272=_0x6416de;_0x15e6bb[_0x5c6b('0x34')]=_[_0x5c6b('0x35')](db[_0x5c6b('0x4f')][_0x5c6b('0x47')]);_0x15e6bb[_0x5c6b('0x36')]=_[_0x5c6b('0x35')](_0x44cb0d[_0x5c6b('0x36')]);_0x15e6bb[_0x5c6b('0x37')]=_[_0x5c6b('0x48')](_0x15e6bb[_0x5c6b('0x34')],_0x15e6bb['query']);_0x47f504[_0x5c6b('0x38')]=_['intersection'](_0x15e6bb[_0x5c6b('0x34')],qs[_0x5c6b('0x39')](_0x44cb0d['query'][_0x5c6b('0x39')]));_0x47f504[_0x5c6b('0x38')]=_0x47f504[_0x5c6b('0x38')][_0x5c6b('0x3a')]?_0x47f504[_0x5c6b('0x38')]:_0x15e6bb[_0x5c6b('0x34')];_0x47f504['order']=qs[_0x5c6b('0x3d')](_0x44cb0d[_0x5c6b('0x36')][_0x5c6b('0x3d')]);_0x47f504[_0x5c6b('0x3e')]=qs['filters'](_[_0x5c6b('0x3f')](_0x44cb0d['query'],_0x15e6bb[_0x5c6b('0x37')]));if(_0x44cb0d[_0x5c6b('0x36')][_0x5c6b('0x42')]){_0x47f504[_0x5c6b('0x3e')]=_[_0x5c6b('0x40')](_0x47f504[_0x5c6b('0x3e')],{'$or':_[_0x5c6b('0x2f')](_0x47f504[_0x5c6b('0x38')],function(_0x514623){var _0x97ef16={};_0x97ef16[_0x514623]={'$like':'%'+_0x44cb0d[_0x5c6b('0x36')]['filter']+'%'};return _0x97ef16;})});}_0x47f504=_[_0x5c6b('0x40')]({},_0x47f504,_0x44cb0d[_0x5c6b('0x49')]);return _0x3d1272[_0x5c6b('0x4d')](_0x47f504);}})[_0x5c6b('0x28')](function(_0xa97eeb){if(_0xa97eeb){_0x3082fb=_0xa97eeb['length'];if(!_0x44cb0d[_0x5c6b('0x36')][_0x5c6b('0x3b')](_0x5c6b('0x50'))){_0x47f504[_0x5c6b('0x22')]=qs['limit'](_0x44cb0d['query']['limit']);_0x47f504[_0x5c6b('0x21')]=qs['offset'](_0x44cb0d[_0x5c6b('0x36')][_0x5c6b('0x21')]);}return _0x3d1272[_0x5c6b('0x4d')](_0x47f504);}})['then'](function(_0x526c17){if(_0x526c17){return _0x526c17?{'count':_0x3082fb,'rows':_0x526c17}:null;}})[_0x5c6b('0x28')](respondWithResult(_0x156377,null))[_0x5c6b('0x1c')](handleError(_0x156377,null));};exports[_0x5c6b('0x51')]=function(_0x3f9659,_0xb9afe3,_0x53216f){var _0x4c61c5={};var _0x267d6c={};var _0x18d271;var _0x5329e1;return db['ServicenowConfiguration'][_0x5c6b('0x4e')]({'where':{'id':_0x3f9659[_0x5c6b('0x46')]['id']}})[_0x5c6b('0x28')](handleEntityNotFound(_0xb9afe3,null))[_0x5c6b('0x28')](function(_0x2de5c3){if(_0x2de5c3){_0x18d271=_0x2de5c3;_0x267d6c['model']=_[_0x5c6b('0x35')](db[_0x5c6b('0x4f')]['rawAttributes']);_0x267d6c[_0x5c6b('0x36')]=_[_0x5c6b('0x35')](_0x3f9659['query']);_0x267d6c[_0x5c6b('0x37')]=_['intersection'](_0x267d6c['model'],_0x267d6c[_0x5c6b('0x36')]);_0x4c61c5[_0x5c6b('0x38')]=_[_0x5c6b('0x48')](_0x267d6c[_0x5c6b('0x34')],qs['fields'](_0x3f9659['query'][_0x5c6b('0x39')]));_0x4c61c5[_0x5c6b('0x38')]=_0x4c61c5[_0x5c6b('0x38')][_0x5c6b('0x3a')]?_0x4c61c5[_0x5c6b('0x38')]:_0x267d6c[_0x5c6b('0x34')];_0x4c61c5[_0x5c6b('0x3c')]=qs['sort'](_0x3f9659[_0x5c6b('0x36')]['sort']);_0x4c61c5[_0x5c6b('0x3e')]=qs[_0x5c6b('0x37')](_[_0x5c6b('0x3f')](_0x3f9659[_0x5c6b('0x36')],_0x267d6c[_0x5c6b('0x37')]));if(_0x3f9659[_0x5c6b('0x36')]['filter']){_0x4c61c5[_0x5c6b('0x3e')]=_['merge'](_0x4c61c5[_0x5c6b('0x3e')],{'$or':_[_0x5c6b('0x2f')](_0x4c61c5['attributes'],function(_0x4d2a5a){var _0x61523a={};_0x61523a[_0x4d2a5a]={'$like':'%'+_0x3f9659['query']['filter']+'%'};return _0x61523a;})});}_0x4c61c5=_[_0x5c6b('0x40')]({},_0x4c61c5,_0x3f9659[_0x5c6b('0x49')]);return _0x18d271[_0x5c6b('0x51')](_0x4c61c5);}})['then'](function(_0x44b82d){if(_0x44b82d){_0x5329e1=_0x44b82d[_0x5c6b('0x3a')];if(!_0x3f9659[_0x5c6b('0x36')][_0x5c6b('0x3b')]('nolimit')){_0x4c61c5[_0x5c6b('0x22')]=qs[_0x5c6b('0x22')](_0x3f9659[_0x5c6b('0x36')]['limit']);_0x4c61c5[_0x5c6b('0x21')]=qs[_0x5c6b('0x21')](_0x3f9659[_0x5c6b('0x36')][_0x5c6b('0x21')]);}return _0x18d271[_0x5c6b('0x51')](_0x4c61c5);}})[_0x5c6b('0x28')](function(_0x51f96f){if(_0x51f96f){return _0x51f96f?{'count':_0x5329e1,'rows':_0x51f96f}:null;}})[_0x5c6b('0x28')](respondWithResult(_0xb9afe3,null))[_0x5c6b('0x1c')](handleError(_0xb9afe3,null));};exports[_0x5c6b('0x52')]=function(_0x583d78,_0x3f06a2,_0x197ad7){var _0x4259e3={};var _0x4edb84={};var _0x4a0c8b;var _0x3b8835;return db[_0x5c6b('0x30')]['findOne']({'where':{'id':_0x583d78['params']['id']}})[_0x5c6b('0x28')](handleEntityNotFound(_0x3f06a2,null))[_0x5c6b('0x28')](function(_0x1bfe8f){if(_0x1bfe8f){_0x4a0c8b=_0x1bfe8f;_0x4edb84[_0x5c6b('0x34')]=_[_0x5c6b('0x35')](db['ServicenowField'][_0x5c6b('0x47')]);_0x4edb84[_0x5c6b('0x36')]=_[_0x5c6b('0x35')](_0x583d78['query']);_0x4edb84['filters']=_[_0x5c6b('0x48')](_0x4edb84[_0x5c6b('0x34')],_0x4edb84[_0x5c6b('0x36')]);_0x4259e3['attributes']=_[_0x5c6b('0x48')](_0x4edb84['model'],qs['fields'](_0x583d78[_0x5c6b('0x36')]['fields']));_0x4259e3[_0x5c6b('0x38')]=_0x4259e3['attributes']['length']?_0x4259e3[_0x5c6b('0x38')]:_0x4edb84['model'];_0x4259e3[_0x5c6b('0x3c')]=qs[_0x5c6b('0x3d')](_0x583d78[_0x5c6b('0x36')]['sort']);_0x4259e3['where']=qs[_0x5c6b('0x37')](_[_0x5c6b('0x3f')](_0x583d78[_0x5c6b('0x36')],_0x4edb84[_0x5c6b('0x37')]));if(_0x583d78[_0x5c6b('0x36')][_0x5c6b('0x42')]){_0x4259e3[_0x5c6b('0x3e')]=_[_0x5c6b('0x40')](_0x4259e3[_0x5c6b('0x3e')],{'$or':_[_0x5c6b('0x2f')](_0x4259e3[_0x5c6b('0x38')],function(_0xf6875a){var _0x2bfe07={};_0x2bfe07[_0xf6875a]={'$like':'%'+_0x583d78[_0x5c6b('0x36')]['filter']+'%'};return _0x2bfe07;})});}_0x4259e3=_[_0x5c6b('0x40')]({},_0x4259e3,_0x583d78[_0x5c6b('0x49')]);return _0x4a0c8b[_0x5c6b('0x52')](_0x4259e3);}})['then'](function(_0x3fe1db){if(_0x3fe1db){_0x3b8835=_0x3fe1db[_0x5c6b('0x3a')];if(!_0x583d78[_0x5c6b('0x36')][_0x5c6b('0x3b')](_0x5c6b('0x50'))){_0x4259e3[_0x5c6b('0x22')]=qs[_0x5c6b('0x22')](_0x583d78[_0x5c6b('0x36')][_0x5c6b('0x22')]);_0x4259e3[_0x5c6b('0x21')]=qs[_0x5c6b('0x21')](_0x583d78['query'][_0x5c6b('0x21')]);}return _0x4a0c8b[_0x5c6b('0x52')](_0x4259e3);}})['then'](function(_0x290894){if(_0x290894){return _0x290894?{'count':_0x3b8835,'rows':_0x290894}:null;}})[_0x5c6b('0x28')](respondWithResult(_0x3f06a2,null))[_0x5c6b('0x1c')](handleError(_0x3f06a2,null));}; \ No newline at end of file +var _0x2942=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','update','destroy','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','getFields','findOne','getSubjects','ServicenowField','getDescriptions','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0x1a1b6e,_0x3a07a9){var _0x571e2c=function(_0x6cea62){while(--_0x6cea62){_0x1a1b6e['push'](_0x1a1b6e['shift']());}};_0x571e2c(++_0x3a07a9);}(_0x2942,0x15f));var _0x2294=function(_0x1da6f8,_0x393458){_0x1da6f8=_0x1da6f8-0x0;var _0x24cf84=_0x2942[_0x1da6f8];return _0x24cf84;};'use strict';var pdf=require(_0x2294('0x0'));var emlformat=require(_0x2294('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2294('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2294('0x3'));var Mustache=require(_0x2294('0x4'));var util=require(_0x2294('0x5'));var path=require(_0x2294('0x6'));var sox=require('sox');var csv=require(_0x2294('0x7'));var ejs=require(_0x2294('0x8'));var fs=require('fs');var _=require(_0x2294('0x9'));var squel=require(_0x2294('0xa'));var crypto=require(_0x2294('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2294('0xc'));var toCsv=require(_0x2294('0x7'));var querystring=require(_0x2294('0xd'));var Papa=require(_0x2294('0xe'));var Redis=require(_0x2294('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2294('0x10'));var as=require(_0x2294('0x11'));var hardwareService=require(_0x2294('0x12'));var logger=require(_0x2294('0x13'))('api');var utils=require(_0x2294('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2294('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2294('0x16'));var client=jayson[_0x2294('0x17')][_0x2294('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x47fe63,_0x28349d,_0x297a87,_0x52a1c8){return new BPromise(function(_0x163443,_0x592a04){var _0x51d5cd=_0x52a1c8||client;return _0x51d5cd[_0x2294('0x19')](_0x47fe63,_0x297a87)[_0x2294('0x1a')](function(_0x48ed9a){logger[_0x2294('0x1b')](_0x2294('0x1c'),_0x28349d,_0x2294('0x1d'));logger[_0x2294('0x1e')](_0x2294('0x1f'),_0x28349d,'request\x20sent',JSON[_0x2294('0x20')](_0x48ed9a));if(_0x48ed9a[_0x2294('0x21')]){if(_0x48ed9a['error'][_0x2294('0x22')]===0x1f4){logger[_0x2294('0x21')](_0x2294('0x1c'),_0x28349d,_0x48ed9a[_0x2294('0x21')][_0x2294('0x23')]);return _0x592a04(_0x48ed9a[_0x2294('0x21')]['message']);}logger[_0x2294('0x21')](_0x2294('0x1c'),_0x28349d,_0x48ed9a[_0x2294('0x21')][_0x2294('0x23')]);return _0x163443(_0x48ed9a['error'][_0x2294('0x23')]);}else{logger['info'](_0x2294('0x1c'),_0x28349d,'request\x20sent');_0x163443(_0x48ed9a[_0x2294('0x24')]['message']);}})[_0x2294('0x25')](function(_0x4ba1fe){logger[_0x2294('0x21')](_0x2294('0x1c'),_0x28349d,_0x4ba1fe);_0x592a04(_0x4ba1fe);});});}function respondWithStatusCode(_0x2da27f,_0x4fae05){_0x4fae05=_0x4fae05||0xcc;return function(_0x57a873){if(_0x57a873){return _0x2da27f[_0x2294('0x26')](_0x4fae05);}return _0x2da27f[_0x2294('0x27')](_0x4fae05)[_0x2294('0x28')]();};}function respondWithResult(_0x326f8c,_0xf79efe){_0xf79efe=_0xf79efe||0xc8;return function(_0xa67a){if(_0xa67a){return _0x326f8c['status'](_0xf79efe)['json'](_0xa67a);}};}function respondWithFilteredResult(_0xf94f97,_0x3acc80){return function(_0x54a075){if(_0x54a075){var _0x1fcbfb=_0x54a075[_0x2294('0x29')],_0x1e8900=_0x3acc80[_0x2294('0x2a')],_0x5ce53e=_0x3acc80[_0x2294('0x2a')]+_0x3acc80['limit'],_0x5d6f9d;if(_0x5ce53e>=_0x1fcbfb){_0x5ce53e=_0x1fcbfb;_0x5d6f9d=0xc8;}else{_0x5d6f9d=0xce;}_0xf94f97[_0x2294('0x27')](_0x5d6f9d);return _0xf94f97[_0x2294('0x2b')](_0x2294('0x2c'),_0x1e8900+'-'+_0x5ce53e+'/'+_0x1fcbfb)[_0x2294('0x2d')](_0x54a075);}return null;};}function patchUpdates(_0x3cd2bd){return function(_0x1408f3){try{jsonpatch[_0x2294('0x2e')](_0x1408f3,_0x3cd2bd,!![]);}catch(_0x2b04e3){return BPromise[_0x2294('0x2f')](_0x2b04e3);}return _0x1408f3['save']();};}function saveUpdates(_0x2035ac,_0x27d26d){return function(_0x561fea){if(_0x561fea){return _0x561fea[_0x2294('0x30')](_0x2035ac)[_0x2294('0x1a')](function(_0x2e570c){return _0x2e570c;});}return null;};}function removeEntity(_0xbe4903,_0x501698){return function(_0x54c6bf){if(_0x54c6bf){return _0x54c6bf[_0x2294('0x31')]()[_0x2294('0x1a')](function(){_0xbe4903[_0x2294('0x27')](0xcc)[_0x2294('0x28')]();});}};}function handleEntityNotFound(_0x1bcd07,_0xc37a1c){return function(_0x3ce625){if(!_0x3ce625){_0x1bcd07[_0x2294('0x26')](0x194);}return _0x3ce625;};}function handleError(_0x59f7ce,_0x5109ad){_0x5109ad=_0x5109ad||0x1f4;return function(_0x13b8fa){logger[_0x2294('0x21')](_0x13b8fa['stack']);if(_0x13b8fa[_0x2294('0x32')]){delete _0x13b8fa[_0x2294('0x32')];}_0x59f7ce[_0x2294('0x27')](_0x5109ad)[_0x2294('0x33')](_0x13b8fa);};}exports['index']=function(_0x3253da,_0x20b13e){var _0x5aad45={},_0x4dc1a4={},_0xa5bce5={'count':0x0,'rows':[]};var _0x29a9bb=_[_0x2294('0x34')](db[_0x2294('0x35')][_0x2294('0x36')],function(_0x39c810){return{'name':_0x39c810[_0x2294('0x37')],'type':_0x39c810[_0x2294('0x38')][_0x2294('0x39')]};});_0x4dc1a4['model']=_[_0x2294('0x34')](_0x29a9bb,_0x2294('0x32'));_0x4dc1a4[_0x2294('0x3a')]=_[_0x2294('0x3b')](_0x3253da[_0x2294('0x3a')]);_0x4dc1a4[_0x2294('0x3c')]=_[_0x2294('0x3d')](_0x4dc1a4[_0x2294('0x3e')],_0x4dc1a4['query']);_0x5aad45['attributes']=_['intersection'](_0x4dc1a4[_0x2294('0x3e')],qs[_0x2294('0x3f')](_0x3253da[_0x2294('0x3a')]['fields']));_0x5aad45['attributes']=_0x5aad45[_0x2294('0x40')][_0x2294('0x41')]?_0x5aad45['attributes']:_0x4dc1a4[_0x2294('0x3e')];if(!_0x3253da[_0x2294('0x3a')][_0x2294('0x42')](_0x2294('0x43'))){_0x5aad45[_0x2294('0x44')]=qs[_0x2294('0x44')](_0x3253da[_0x2294('0x3a')][_0x2294('0x44')]);_0x5aad45[_0x2294('0x2a')]=qs[_0x2294('0x2a')](_0x3253da['query'][_0x2294('0x2a')]);}_0x5aad45[_0x2294('0x45')]=qs[_0x2294('0x46')](_0x3253da[_0x2294('0x3a')][_0x2294('0x46')]);_0x5aad45[_0x2294('0x47')]=qs[_0x2294('0x3c')](_[_0x2294('0x48')](_0x3253da[_0x2294('0x3a')],_0x4dc1a4[_0x2294('0x3c')]),_0x29a9bb);if(_0x3253da[_0x2294('0x3a')][_0x2294('0x49')]){_0x5aad45[_0x2294('0x47')]=_[_0x2294('0x4a')](_0x5aad45[_0x2294('0x47')],{'$or':_[_0x2294('0x34')](_0x29a9bb,function(_0x3eed6f){if(_0x3eed6f[_0x2294('0x38')]!==_0x2294('0x4b')){var _0x4d7b1b={};_0x4d7b1b[_0x3eed6f['name']]={'$like':'%'+_0x3253da[_0x2294('0x3a')]['filter']+'%'};return _0x4d7b1b;}})});}_0x5aad45=_['merge']({},_0x5aad45,_0x3253da[_0x2294('0x4c')]);var _0x569787={'where':_0x5aad45[_0x2294('0x47')]};return db[_0x2294('0x35')][_0x2294('0x29')](_0x569787)[_0x2294('0x1a')](function(_0x2e8b5f){_0xa5bce5[_0x2294('0x29')]=_0x2e8b5f;if(_0x3253da[_0x2294('0x3a')][_0x2294('0x4d')]){_0x5aad45[_0x2294('0x4e')]=[{'all':!![]}];}return db[_0x2294('0x35')][_0x2294('0x4f')](_0x5aad45);})[_0x2294('0x1a')](function(_0x300d77){_0xa5bce5[_0x2294('0x50')]=_0x300d77;return _0xa5bce5;})['then'](respondWithFilteredResult(_0x20b13e,_0x5aad45))[_0x2294('0x25')](handleError(_0x20b13e,null));};exports[_0x2294('0x51')]=function(_0x20c3b5,_0x4786f4){var _0x36c8ec={'raw':![],'where':{'id':_0x20c3b5[_0x2294('0x52')]['id']}},_0x2bd579={};_0x2bd579[_0x2294('0x3e')]=_[_0x2294('0x3b')](db[_0x2294('0x35')][_0x2294('0x36')]);_0x2bd579[_0x2294('0x3a')]=_[_0x2294('0x3b')](_0x20c3b5['query']);_0x2bd579[_0x2294('0x3c')]=_[_0x2294('0x3d')](_0x2bd579[_0x2294('0x3e')],_0x2bd579[_0x2294('0x3a')]);_0x36c8ec[_0x2294('0x40')]=_['intersection'](_0x2bd579[_0x2294('0x3e')],qs[_0x2294('0x3f')](_0x20c3b5['query'][_0x2294('0x3f')]));_0x36c8ec[_0x2294('0x40')]=_0x36c8ec[_0x2294('0x40')][_0x2294('0x41')]?_0x36c8ec['attributes']:_0x2bd579[_0x2294('0x3e')];if(_0x20c3b5['query'][_0x2294('0x4d')]){_0x36c8ec[_0x2294('0x4e')]=[{'all':!![]}];}_0x36c8ec=_[_0x2294('0x4a')]({},_0x36c8ec,_0x20c3b5[_0x2294('0x4c')]);return db[_0x2294('0x35')][_0x2294('0x53')](_0x36c8ec)[_0x2294('0x1a')](handleEntityNotFound(_0x4786f4,null))[_0x2294('0x1a')](respondWithResult(_0x4786f4,null))['catch'](handleError(_0x4786f4,null));};exports[_0x2294('0x54')]=function(_0x54dd63,_0x315145){return db[_0x2294('0x35')][_0x2294('0x54')](_0x54dd63[_0x2294('0x55')],{})[_0x2294('0x1a')](respondWithResult(_0x315145,0xc9))[_0x2294('0x25')](handleError(_0x315145,null));};exports[_0x2294('0x30')]=function(_0x3655ec,_0x6ab75e){if(_0x3655ec[_0x2294('0x55')]['id']){delete _0x3655ec['body']['id'];}return db['ServicenowConfiguration'][_0x2294('0x53')]({'where':{'id':_0x3655ec[_0x2294('0x52')]['id']}})[_0x2294('0x1a')](handleEntityNotFound(_0x6ab75e,null))[_0x2294('0x1a')](saveUpdates(_0x3655ec['body'],null))[_0x2294('0x1a')](respondWithResult(_0x6ab75e,null))['catch'](handleError(_0x6ab75e,null));};exports[_0x2294('0x31')]=function(_0x4ff47b,_0x5d2b1f){return db[_0x2294('0x35')][_0x2294('0x53')]({'where':{'id':_0x4ff47b[_0x2294('0x52')]['id']}})[_0x2294('0x1a')](handleEntityNotFound(_0x5d2b1f,null))[_0x2294('0x1a')](removeEntity(_0x5d2b1f,null))['catch'](handleError(_0x5d2b1f,null));};exports[_0x2294('0x56')]=function(_0x163a97,_0x2244f3,_0x51b993){var _0x22e754={};var _0x103d40={};var _0x1a133d;var _0x103cb1;return db[_0x2294('0x35')][_0x2294('0x57')]({'where':{'id':_0x163a97[_0x2294('0x52')]['id']}})[_0x2294('0x1a')](handleEntityNotFound(_0x2244f3,null))[_0x2294('0x1a')](function(_0x25aab9){if(_0x25aab9){_0x1a133d=_0x25aab9;_0x103d40[_0x2294('0x3e')]=_[_0x2294('0x3b')](db['ServicenowField'][_0x2294('0x36')]);_0x103d40['query']=_[_0x2294('0x3b')](_0x163a97['query']);_0x103d40[_0x2294('0x3c')]=_[_0x2294('0x3d')](_0x103d40[_0x2294('0x3e')],_0x103d40['query']);_0x22e754[_0x2294('0x40')]=_['intersection'](_0x103d40[_0x2294('0x3e')],qs[_0x2294('0x3f')](_0x163a97[_0x2294('0x3a')][_0x2294('0x3f')]));_0x22e754['attributes']=_0x22e754['attributes']['length']?_0x22e754[_0x2294('0x40')]:_0x103d40[_0x2294('0x3e')];_0x22e754[_0x2294('0x45')]=qs['sort'](_0x163a97['query'][_0x2294('0x46')]);_0x22e754[_0x2294('0x47')]=qs['filters'](_[_0x2294('0x48')](_0x163a97[_0x2294('0x3a')],_0x103d40[_0x2294('0x3c')]));if(_0x163a97[_0x2294('0x3a')]['filter']){_0x22e754['where']=_['merge'](_0x22e754[_0x2294('0x47')],{'$or':_[_0x2294('0x34')](_0x22e754[_0x2294('0x40')],function(_0x338da3){var _0x225e6f={};_0x225e6f[_0x338da3]={'$like':'%'+_0x163a97[_0x2294('0x3a')][_0x2294('0x49')]+'%'};return _0x225e6f;})});}_0x22e754=_['merge']({},_0x22e754,_0x163a97['options']);return _0x1a133d[_0x2294('0x56')](_0x22e754);}})[_0x2294('0x1a')](function(_0x336d96){if(_0x336d96){_0x103cb1=_0x336d96[_0x2294('0x41')];if(!_0x163a97[_0x2294('0x3a')][_0x2294('0x42')](_0x2294('0x43'))){_0x22e754[_0x2294('0x44')]=qs[_0x2294('0x44')](_0x163a97[_0x2294('0x3a')][_0x2294('0x44')]);_0x22e754[_0x2294('0x2a')]=qs['offset'](_0x163a97[_0x2294('0x3a')][_0x2294('0x2a')]);}return _0x1a133d[_0x2294('0x56')](_0x22e754);}})[_0x2294('0x1a')](function(_0x28c419){if(_0x28c419){return _0x28c419?{'count':_0x103cb1,'rows':_0x28c419}:null;}})['then'](respondWithResult(_0x2244f3,null))[_0x2294('0x25')](handleError(_0x2244f3,null));};exports[_0x2294('0x58')]=function(_0x2dd00d,_0x4a18cc,_0x2180d4){var _0x56f6b5={};var _0x44daec={};var _0xb85071;var _0x1512ce;return db[_0x2294('0x35')][_0x2294('0x57')]({'where':{'id':_0x2dd00d[_0x2294('0x52')]['id']}})['then'](handleEntityNotFound(_0x4a18cc,null))[_0x2294('0x1a')](function(_0x25e5c5){if(_0x25e5c5){_0xb85071=_0x25e5c5;_0x44daec[_0x2294('0x3e')]=_[_0x2294('0x3b')](db[_0x2294('0x59')]['rawAttributes']);_0x44daec[_0x2294('0x3a')]=_[_0x2294('0x3b')](_0x2dd00d['query']);_0x44daec['filters']=_[_0x2294('0x3d')](_0x44daec[_0x2294('0x3e')],_0x44daec['query']);_0x56f6b5[_0x2294('0x40')]=_[_0x2294('0x3d')](_0x44daec[_0x2294('0x3e')],qs[_0x2294('0x3f')](_0x2dd00d[_0x2294('0x3a')][_0x2294('0x3f')]));_0x56f6b5[_0x2294('0x40')]=_0x56f6b5[_0x2294('0x40')]['length']?_0x56f6b5[_0x2294('0x40')]:_0x44daec[_0x2294('0x3e')];_0x56f6b5['order']=qs[_0x2294('0x46')](_0x2dd00d[_0x2294('0x3a')][_0x2294('0x46')]);_0x56f6b5[_0x2294('0x47')]=qs['filters'](_[_0x2294('0x48')](_0x2dd00d['query'],_0x44daec[_0x2294('0x3c')]));if(_0x2dd00d[_0x2294('0x3a')][_0x2294('0x49')]){_0x56f6b5[_0x2294('0x47')]=_[_0x2294('0x4a')](_0x56f6b5[_0x2294('0x47')],{'$or':_['map'](_0x56f6b5[_0x2294('0x40')],function(_0x3c4518){var _0x4e4a7a={};_0x4e4a7a[_0x3c4518]={'$like':'%'+_0x2dd00d[_0x2294('0x3a')][_0x2294('0x49')]+'%'};return _0x4e4a7a;})});}_0x56f6b5=_[_0x2294('0x4a')]({},_0x56f6b5,_0x2dd00d[_0x2294('0x4c')]);return _0xb85071[_0x2294('0x58')](_0x56f6b5);}})[_0x2294('0x1a')](function(_0x1d4fba){if(_0x1d4fba){_0x1512ce=_0x1d4fba[_0x2294('0x41')];if(!_0x2dd00d[_0x2294('0x3a')][_0x2294('0x42')](_0x2294('0x43'))){_0x56f6b5[_0x2294('0x44')]=qs[_0x2294('0x44')](_0x2dd00d['query'][_0x2294('0x44')]);_0x56f6b5[_0x2294('0x2a')]=qs[_0x2294('0x2a')](_0x2dd00d[_0x2294('0x3a')][_0x2294('0x2a')]);}return _0xb85071[_0x2294('0x58')](_0x56f6b5);}})['then'](function(_0x3d2c18){if(_0x3d2c18){return _0x3d2c18?{'count':_0x1512ce,'rows':_0x3d2c18}:null;}})[_0x2294('0x1a')](respondWithResult(_0x4a18cc,null))[_0x2294('0x25')](handleError(_0x4a18cc,null));};exports[_0x2294('0x5a')]=function(_0x4257e8,_0x31e86c,_0x57e08a){var _0x31155b={};var _0x2b91b4={};var _0x2eb20e;var _0x579f7e;return db[_0x2294('0x35')][_0x2294('0x57')]({'where':{'id':_0x4257e8[_0x2294('0x52')]['id']}})[_0x2294('0x1a')](handleEntityNotFound(_0x31e86c,null))['then'](function(_0x3107cf){if(_0x3107cf){_0x2eb20e=_0x3107cf;_0x2b91b4['model']=_['keys'](db[_0x2294('0x59')][_0x2294('0x36')]);_0x2b91b4[_0x2294('0x3a')]=_[_0x2294('0x3b')](_0x4257e8[_0x2294('0x3a')]);_0x2b91b4[_0x2294('0x3c')]=_[_0x2294('0x3d')](_0x2b91b4[_0x2294('0x3e')],_0x2b91b4[_0x2294('0x3a')]);_0x31155b[_0x2294('0x40')]=_['intersection'](_0x2b91b4[_0x2294('0x3e')],qs[_0x2294('0x3f')](_0x4257e8[_0x2294('0x3a')][_0x2294('0x3f')]));_0x31155b[_0x2294('0x40')]=_0x31155b[_0x2294('0x40')]['length']?_0x31155b[_0x2294('0x40')]:_0x2b91b4[_0x2294('0x3e')];_0x31155b[_0x2294('0x45')]=qs['sort'](_0x4257e8['query'][_0x2294('0x46')]);_0x31155b[_0x2294('0x47')]=qs[_0x2294('0x3c')](_[_0x2294('0x48')](_0x4257e8['query'],_0x2b91b4[_0x2294('0x3c')]));if(_0x4257e8[_0x2294('0x3a')][_0x2294('0x49')]){_0x31155b[_0x2294('0x47')]=_[_0x2294('0x4a')](_0x31155b['where'],{'$or':_[_0x2294('0x34')](_0x31155b[_0x2294('0x40')],function(_0x57ba3d){var _0x524ff={};_0x524ff[_0x57ba3d]={'$like':'%'+_0x4257e8[_0x2294('0x3a')]['filter']+'%'};return _0x524ff;})});}_0x31155b=_['merge']({},_0x31155b,_0x4257e8[_0x2294('0x4c')]);return _0x2eb20e[_0x2294('0x5a')](_0x31155b);}})[_0x2294('0x1a')](function(_0x462821){if(_0x462821){_0x579f7e=_0x462821[_0x2294('0x41')];if(!_0x4257e8[_0x2294('0x3a')]['hasOwnProperty']('nolimit')){_0x31155b[_0x2294('0x44')]=qs[_0x2294('0x44')](_0x4257e8[_0x2294('0x3a')][_0x2294('0x44')]);_0x31155b[_0x2294('0x2a')]=qs['offset'](_0x4257e8[_0x2294('0x3a')][_0x2294('0x2a')]);}return _0x2eb20e['getDescriptions'](_0x31155b);}})['then'](function(_0x5a2575){if(_0x5a2575){return _0x5a2575?{'count':_0x579f7e,'rows':_0x5a2575}:null;}})['then'](respondWithResult(_0x31e86c,null))['catch'](handleError(_0x31e86c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 7bc6d7a..687e474 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 _0xbd98=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x2892ad,_0x103e12){var _0x523df1=function(_0x133d11){while(--_0x133d11){_0x2892ad['push'](_0x2892ad['shift']());}};_0x523df1(++_0x103e12);}(_0xbd98,0x147));var _0x8bd9=function(_0x5bc4f6,_0x2f62dc){_0x5bc4f6=_0x5bc4f6-0x0;var _0x36a71b=_0xbd98[_0x5bc4f6];return _0x36a71b;};'use strict';var _=require(_0x8bd9('0x0'));var util=require('util');var logger=require('../../config/logger')('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(_0x8bd9('0x1'));var config=require(_0x8bd9('0x2'));var attributes=require(_0x8bd9('0x3'));module[_0x8bd9('0x4')]=function(_0x29e977,_0x114f1c){return _0x29e977[_0x8bd9('0x5')](_0x8bd9('0x6'),attributes,{'tableName':_0x8bd9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8459=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x20e986,_0x445a88){var _0x4929df=function(_0x32ff70){while(--_0x32ff70){_0x20e986['push'](_0x20e986['shift']());}};_0x4929df(++_0x445a88);}(_0x8459,0x12b));var _0x9845=function(_0x2fcdaa,_0x52dcca){_0x2fcdaa=_0x2fcdaa-0x0;var _0x2df70b=_0x8459[_0x2fcdaa];return _0x2df70b;};'use strict';var _=require('lodash');var util=require(_0x9845('0x0'));var logger=require(_0x9845('0x1'))(_0x9845('0x2'));var moment=require('moment');var BPromise=require(_0x9845('0x3'));var rp=require(_0x9845('0x4'));var fs=require('fs');var path=require(_0x9845('0x5'));var rimraf=require(_0x9845('0x6'));var config=require(_0x9845('0x7'));var attributes=require(_0x9845('0x8'));module[_0x9845('0x9')]=function(_0x300cb9,_0x4f2635){return _0x300cb9[_0x9845('0xa')](_0x9845('0xb'),attributes,{'tableName':_0x9845('0xc'),'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 16a2640..accd7dd 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 _0x66bc=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xc5ca83,_0x54e387){var _0x337663=function(_0x311b08){while(--_0x311b08){_0xc5ca83['push'](_0xc5ca83['shift']());}};_0x337663(++_0x54e387);}(_0x66bc,0x197));var _0xc66b=function(_0x188a5c,_0xf97352){_0x188a5c=_0x188a5c-0x0;var _0x3c0901=_0x66bc[_0x188a5c];return _0x3c0901;};'use strict';var _=require(_0xc66b('0x0'));var util=require(_0xc66b('0x1'));var moment=require('moment');var BPromise=require(_0xc66b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc66b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc66b('0x4'))(_0xc66b('0x5'));var config=require(_0xc66b('0x6'));var jayson=require(_0xc66b('0x7'));var client=jayson[_0xc66b('0x8')][_0xc66b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b3f04,_0x481128,_0x6af1ba){return new BPromise(function(_0x19f4cf,_0x54b0a3){return client[_0xc66b('0xa')](_0x4b3f04,_0x6af1ba)[_0xc66b('0xb')](function(_0x1002f6){logger[_0xc66b('0xc')](_0xc66b('0xd'),_0x481128,'request\x20sent');logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x481128,_0xc66b('0xe'),JSON[_0xc66b('0xf')](_0x1002f6));if(_0x1002f6[_0xc66b('0x10')]){if(_0x1002f6['error']['code']===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x481128,_0x1002f6[_0xc66b('0x10')][_0xc66b('0x11')]);return _0x54b0a3(_0x1002f6[_0xc66b('0x10')]['message']);}logger[_0xc66b('0x10')](_0xc66b('0xd'),_0x481128,_0x1002f6[_0xc66b('0x10')][_0xc66b('0x11')]);return _0x19f4cf(_0x1002f6[_0xc66b('0x10')][_0xc66b('0x11')]);}else{logger[_0xc66b('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x481128,_0xc66b('0xe'));_0x19f4cf(_0x1002f6[_0xc66b('0x12')][_0xc66b('0x11')]);}})[_0xc66b('0x13')](function(_0xe8f1e5){logger[_0xc66b('0x10')](_0xc66b('0xd'),_0x481128,_0xe8f1e5);_0x54b0a3(_0xe8f1e5);});});} \ No newline at end of file +var _0x28d3=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2f4565,_0x5ed91c){var _0x555412=function(_0x59553b){while(--_0x59553b){_0x2f4565['push'](_0x2f4565['shift']());}};_0x555412(++_0x5ed91c);}(_0x28d3,0x154));var _0x328d=function(_0x19f519,_0x18a957){_0x19f519=_0x19f519-0x0;var _0x1b028a=_0x28d3[_0x19f519];return _0x1b028a;};'use strict';var _=require(_0x328d('0x0'));var util=require(_0x328d('0x1'));var moment=require(_0x328d('0x2'));var BPromise=require(_0x328d('0x3'));var rs=require(_0x328d('0x4'));var fs=require('fs');var Redis=require(_0x328d('0x5'));var db=require(_0x328d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x328d('0x7'))('rpc');var config=require(_0x328d('0x8'));var jayson=require(_0x328d('0x9'));var client=jayson[_0x328d('0xa')][_0x328d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5159a5,_0x762d7e,_0x12095b){return new BPromise(function(_0x18fab9,_0x49df30){return client[_0x328d('0xc')](_0x5159a5,_0x12095b)[_0x328d('0xd')](function(_0x1db82f){logger[_0x328d('0xe')](_0x328d('0xf'),_0x762d7e,'request\x20sent');logger[_0x328d('0x10')](_0x328d('0x11'),_0x762d7e,'request\x20sent',JSON[_0x328d('0x12')](_0x1db82f));if(_0x1db82f[_0x328d('0x13')]){if(_0x1db82f['error'][_0x328d('0x14')]===0x1f4){logger['error'](_0x328d('0xf'),_0x762d7e,_0x1db82f[_0x328d('0x13')][_0x328d('0x15')]);return _0x49df30(_0x1db82f[_0x328d('0x13')][_0x328d('0x15')]);}logger[_0x328d('0x13')](_0x328d('0xf'),_0x762d7e,_0x1db82f[_0x328d('0x13')][_0x328d('0x15')]);return _0x18fab9(_0x1db82f[_0x328d('0x13')][_0x328d('0x15')]);}else{logger[_0x328d('0xe')](_0x328d('0xf'),_0x762d7e,'request\x20sent');_0x18fab9(_0x1db82f['result'][_0x328d('0x15')]);}})[_0x328d('0x16')](function(_0x839d3c){logger[_0x328d('0x13')](_0x328d('0xf'),_0x762d7e,_0x839d3c);_0x49df30(_0x839d3c);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index bd138d0..75d0d96 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 _0xb26d=['post','create','put','delete','destroy','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x8922b1,_0x1eb4c5){var _0xfb4fb4=function(_0x255715){while(--_0x255715){_0x8922b1['push'](_0x8922b1['shift']());}};_0xfb4fb4(++_0x1eb4c5);}(_0xb26d,0x127));var _0xdb26=function(_0xd4603b,_0x2324d5){_0xd4603b=_0xd4603b-0x0;var _0xaafe2f=_0xb26d[_0xd4603b];return _0xaafe2f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdb26('0x0'));var timeout=require(_0xdb26('0x1'));var express=require(_0xdb26('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdb26('0x3'));var config=require(_0xdb26('0x4'));var controller=require(_0xdb26('0x5'));router[_0xdb26('0x6')]('/',auth[_0xdb26('0x7')](),controller[_0xdb26('0x8')]);router['get'](_0xdb26('0x9'),auth[_0xdb26('0x7')](),controller[_0xdb26('0xa')]);router[_0xdb26('0xb')]('/',auth[_0xdb26('0x7')](),controller[_0xdb26('0xc')]);router[_0xdb26('0xd')]('/:id',auth[_0xdb26('0x7')](),controller['update']);router[_0xdb26('0xe')](_0xdb26('0x9'),auth[_0xdb26('0x7')](),controller[_0xdb26('0xf')]);module[_0xdb26('0x10')]=router; \ No newline at end of file +var _0xde86=['update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','create'];(function(_0x57c1bb,_0x18e7aa){var _0x5557c9=function(_0x4c7a6f){while(--_0x4c7a6f){_0x57c1bb['push'](_0x57c1bb['shift']());}};_0x5557c9(++_0x18e7aa);}(_0xde86,0x7b));var _0x6de8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde86[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6de8('0x0'));var util=require('util');var path=require(_0x6de8('0x1'));var timeout=require(_0x6de8('0x2'));var express=require('express');var router=express[_0x6de8('0x3')]();var auth=require(_0x6de8('0x4'));var interaction=require(_0x6de8('0x5'));var config=require(_0x6de8('0x6'));var controller=require(_0x6de8('0x7'));router[_0x6de8('0x8')]('/',auth['isAuthenticated'](),controller[_0x6de8('0x9')]);router[_0x6de8('0x8')](_0x6de8('0xa'),auth[_0x6de8('0xb')](),controller['show']);router['post']('/',auth[_0x6de8('0xb')](),controller[_0x6de8('0xc')]);router['put'](_0x6de8('0xa'),auth[_0x6de8('0xb')](),controller[_0x6de8('0xd')]);router[_0x6de8('0xe')](_0x6de8('0xa'),auth[_0x6de8('0xb')](),controller[_0x6de8('0xf')]);module[_0x6de8('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index b30d157..9f8a62b 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 _0x8323=['STRING','customVariable','BOOLEAN','sequelize','variable','keyValue','string'];(function(_0x333008,_0x534d06){var _0x4ba0d4=function(_0x3adb94){while(--_0x3adb94){_0x333008['push'](_0x333008['shift']());}};_0x4ba0d4(++_0x534d06);}(_0x8323,0x8f));var _0x3832=function(_0x20bd62,_0x256cee){_0x20bd62=_0x20bd62-0x0;var _0xe1d038=_0x8323[_0x20bd62];return _0xe1d038;};'use strict';var Sequelize=require(_0x3832('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x3832('0x1'),'customVariable',_0x3832('0x2')),'defaultValue':_0x3832('0x3')},'content':{'type':Sequelize[_0x3832('0x4')]},'key':{'type':Sequelize[_0x3832('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x3832('0x3'),_0x3832('0x1'),_0x3832('0x5'))},'keyContent':{'type':Sequelize[_0x3832('0x4')]},'idField':{'type':Sequelize[_0x3832('0x4')]},'nameField':{'type':Sequelize[_0x3832('0x4')]},'customField':{'type':Sequelize[_0x3832('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3832('0x4')]}}; \ No newline at end of file +var _0xacb8=['BOOLEAN','sequelize','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x36e240,_0x204cbc){var _0x77b586=function(_0x45a8e8){while(--_0x45a8e8){_0x36e240['push'](_0x36e240['shift']());}};_0x77b586(++_0x204cbc);}(_0xacb8,0x119));var _0x8acb=function(_0x2d14b0,_0x362cb4){_0x2d14b0=_0x2d14b0-0x0;var _0x4395ac=_0xacb8[_0x2d14b0];return _0x4395ac;};'use strict';var Sequelize=require(_0x8acb('0x0'));module['exports']={'type':{'type':Sequelize[_0x8acb('0x1')](_0x8acb('0x2'),_0x8acb('0x3'),'customVariable',_0x8acb('0x4')),'defaultValue':_0x8acb('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8acb('0x5')]},'keyType':{'type':Sequelize[_0x8acb('0x1')](_0x8acb('0x2'),_0x8acb('0x3'),_0x8acb('0x6'))},'keyContent':{'type':Sequelize[_0x8acb('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8acb('0x5')]},'customField':{'type':Sequelize[_0x8acb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8acb('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 841f54a..15ef091 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 _0x3746=['sort','where','pick','filters','filter','merge','type','options','includeAll','include','findAll','catch','show','params','keys','ServicenowField','create','body','find','html-pdf','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x9f7af3,_0xcbe532){var _0x64fafa=function(_0x1a3cfe){while(--_0x1a3cfe){_0x9f7af3['push'](_0x9f7af3['shift']());}};_0x64fafa(++_0xcbe532);}(_0x3746,0xa9));var _0x6374=function(_0x1dd5b0,_0x460076){_0x1dd5b0=_0x1dd5b0-0x0;var _0x31c2f8=_0x3746[_0x1dd5b0];return _0x31c2f8;};'use strict';var pdf=require(_0x6374('0x0'));var emlformat=require(_0x6374('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6374('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6374('0x3'));var moment=require(_0x6374('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6374('0x5'));var path=require(_0x6374('0x6'));var sox=require(_0x6374('0x7'));var csv=require(_0x6374('0x8'));var ejs=require(_0x6374('0x9'));var fs=require('fs');var _=require(_0x6374('0xa'));var squel=require(_0x6374('0xb'));var crypto=require(_0x6374('0xc'));var jsforce=require(_0x6374('0xd'));var deskjs=require(_0x6374('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6374('0xf'));var Papa=require('papaparse');var Redis=require(_0x6374('0x10'));var authService=require(_0x6374('0x11'));var qs=require(_0x6374('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6374('0x13'));var logger=require(_0x6374('0x14'))(_0x6374('0x15'));var utils=require('../../config/utils');var config=require(_0x6374('0x16'));var licenseUtil=require(_0x6374('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8c230,_0x2b88fa){_0x2b88fa=_0x2b88fa||0xcc;return function(_0xd2ca){if(_0xd2ca){return _0x8c230['sendStatus'](_0x2b88fa);}return _0x8c230[_0x6374('0x18')](_0x2b88fa)[_0x6374('0x19')]();};}function respondWithResult(_0x3916b5,_0x54b408){_0x54b408=_0x54b408||0xc8;return function(_0x202d55){if(_0x202d55){return _0x3916b5['status'](_0x54b408)['json'](_0x202d55);}};}function respondWithFilteredResult(_0x22c866,_0x4ffe00){return function(_0x17d71b){if(_0x17d71b){var _0x3a2b3a=_0x17d71b[_0x6374('0x1a')],_0x1fdaa6=_0x4ffe00[_0x6374('0x1b')],_0x1de4c2=_0x4ffe00[_0x6374('0x1b')]+_0x4ffe00[_0x6374('0x1c')],_0x287981;if(_0x1de4c2>=_0x3a2b3a){_0x1de4c2=_0x3a2b3a;_0x287981=0xc8;}else{_0x287981=0xce;}_0x22c866[_0x6374('0x18')](_0x287981);return _0x22c866[_0x6374('0x1d')](_0x6374('0x1e'),_0x1fdaa6+'-'+_0x1de4c2+'/'+_0x3a2b3a)[_0x6374('0x1f')](_0x17d71b);}return null;};}function patchUpdates(_0x7f4ea3){return function(_0x435ab6){try{jsonpatch[_0x6374('0x20')](_0x435ab6,_0x7f4ea3,!![]);}catch(_0x46fdc2){return BPromise[_0x6374('0x21')](_0x46fdc2);}return _0x435ab6[_0x6374('0x22')]();};}function saveUpdates(_0x101d49,_0x499fa1){return function(_0x4f6542){if(_0x4f6542){return _0x4f6542[_0x6374('0x23')](_0x101d49)['then'](function(_0x465c25){return _0x465c25;});}return null;};}function removeEntity(_0x43d559,_0x16bfd5){return function(_0x2741b4){if(_0x2741b4){return _0x2741b4['destroy']()[_0x6374('0x24')](function(){_0x43d559[_0x6374('0x18')](0xcc)[_0x6374('0x19')]();});}};}function handleEntityNotFound(_0x1148e5,_0x293cf2){return function(_0xd0a6b5){if(!_0xd0a6b5){_0x1148e5[_0x6374('0x25')](0x194);}return _0xd0a6b5;};}function handleError(_0x1a8808,_0x549da1){_0x549da1=_0x549da1||0x1f4;return function(_0x115729){logger[_0x6374('0x26')](_0x115729[_0x6374('0x27')]);if(_0x115729['name']){delete _0x115729[_0x6374('0x28')];}_0x1a8808['status'](_0x549da1)[_0x6374('0x29')](_0x115729);};}exports[_0x6374('0x2a')]=function(_0x8d5419,_0x1cb029){var _0x42bc95={},_0x3cf16d={},_0x3bf066={'count':0x0,'rows':[]};var _0xf032e3=_[_0x6374('0x2b')](db['ServicenowField'][_0x6374('0x2c')],function(_0x37b74a){return{'name':_0x37b74a[_0x6374('0x2d')],'type':_0x37b74a['type'][_0x6374('0x2e')]};});_0x3cf16d[_0x6374('0x2f')]=_['map'](_0xf032e3,_0x6374('0x28'));_0x3cf16d['query']=_['keys'](_0x8d5419['query']);_0x3cf16d['filters']=_['intersection'](_0x3cf16d[_0x6374('0x2f')],_0x3cf16d['query']);_0x42bc95['attributes']=_[_0x6374('0x30')](_0x3cf16d[_0x6374('0x2f')],qs[_0x6374('0x31')](_0x8d5419[_0x6374('0x32')]['fields']));_0x42bc95[_0x6374('0x33')]=_0x42bc95['attributes'][_0x6374('0x34')]?_0x42bc95[_0x6374('0x33')]:_0x3cf16d[_0x6374('0x2f')];if(!_0x8d5419[_0x6374('0x32')][_0x6374('0x35')](_0x6374('0x36'))){_0x42bc95[_0x6374('0x1c')]=qs[_0x6374('0x1c')](_0x8d5419[_0x6374('0x32')]['limit']);_0x42bc95[_0x6374('0x1b')]=qs[_0x6374('0x1b')](_0x8d5419['query'][_0x6374('0x1b')]);}_0x42bc95[_0x6374('0x37')]=qs[_0x6374('0x38')](_0x8d5419[_0x6374('0x32')][_0x6374('0x38')]);_0x42bc95[_0x6374('0x39')]=qs['filters'](_[_0x6374('0x3a')](_0x8d5419[_0x6374('0x32')],_0x3cf16d[_0x6374('0x3b')]),_0xf032e3);if(_0x8d5419[_0x6374('0x32')][_0x6374('0x3c')]){_0x42bc95[_0x6374('0x39')]=_[_0x6374('0x3d')](_0x42bc95['where'],{'$or':_[_0x6374('0x2b')](_0xf032e3,function(_0x366aaf){if(_0x366aaf[_0x6374('0x3e')]!=='VIRTUAL'){var _0x3a11f6={};_0x3a11f6[_0x366aaf[_0x6374('0x28')]]={'$like':'%'+_0x8d5419['query'][_0x6374('0x3c')]+'%'};return _0x3a11f6;}})});}_0x42bc95=_[_0x6374('0x3d')]({},_0x42bc95,_0x8d5419[_0x6374('0x3f')]);var _0x1de6aa={'where':_0x42bc95[_0x6374('0x39')]};return db['ServicenowField'][_0x6374('0x1a')](_0x1de6aa)[_0x6374('0x24')](function(_0x1cc134){_0x3bf066['count']=_0x1cc134;if(_0x8d5419[_0x6374('0x32')][_0x6374('0x40')]){_0x42bc95[_0x6374('0x41')]=[{'all':!![]}];}return db['ServicenowField'][_0x6374('0x42')](_0x42bc95);})['then'](function(_0x100d53){_0x3bf066['rows']=_0x100d53;return _0x3bf066;})['then'](respondWithFilteredResult(_0x1cb029,_0x42bc95))[_0x6374('0x43')](handleError(_0x1cb029,null));};exports[_0x6374('0x44')]=function(_0x5e1c80,_0x6c4f80){var _0xcd5411={'raw':!![],'where':{'id':_0x5e1c80[_0x6374('0x45')]['id']}},_0x4e530d={};_0x4e530d[_0x6374('0x2f')]=_[_0x6374('0x46')](db[_0x6374('0x47')][_0x6374('0x2c')]);_0x4e530d[_0x6374('0x32')]=_[_0x6374('0x46')](_0x5e1c80['query']);_0x4e530d['filters']=_['intersection'](_0x4e530d['model'],_0x4e530d['query']);_0xcd5411['attributes']=_[_0x6374('0x30')](_0x4e530d['model'],qs[_0x6374('0x31')](_0x5e1c80[_0x6374('0x32')]['fields']));_0xcd5411[_0x6374('0x33')]=_0xcd5411[_0x6374('0x33')][_0x6374('0x34')]?_0xcd5411[_0x6374('0x33')]:_0x4e530d[_0x6374('0x2f')];if(_0x5e1c80[_0x6374('0x32')]['includeAll']){_0xcd5411[_0x6374('0x41')]=[{'all':!![]}];}_0xcd5411=_[_0x6374('0x3d')]({},_0xcd5411,_0x5e1c80[_0x6374('0x3f')]);return db[_0x6374('0x47')]['find'](_0xcd5411)[_0x6374('0x24')](handleEntityNotFound(_0x6c4f80,null))['then'](respondWithResult(_0x6c4f80,null))[_0x6374('0x43')](handleError(_0x6c4f80,null));};exports['create']=function(_0x3877b0,_0x5cdb59){return db[_0x6374('0x47')][_0x6374('0x48')](_0x3877b0['body'],{})[_0x6374('0x24')](respondWithResult(_0x5cdb59,0xc9))[_0x6374('0x43')](handleError(_0x5cdb59,null));};exports[_0x6374('0x23')]=function(_0x2c052b,_0x2f94d0){if(_0x2c052b[_0x6374('0x49')]['id']){delete _0x2c052b[_0x6374('0x49')]['id'];}return db[_0x6374('0x47')][_0x6374('0x4a')]({'where':{'id':_0x2c052b[_0x6374('0x45')]['id']}})[_0x6374('0x24')](handleEntityNotFound(_0x2f94d0,null))[_0x6374('0x24')](saveUpdates(_0x2c052b[_0x6374('0x49')],null))[_0x6374('0x24')](respondWithResult(_0x2f94d0,null))['catch'](handleError(_0x2f94d0,null));};exports['destroy']=function(_0x55dcc2,_0x11c98b){return db[_0x6374('0x47')][_0x6374('0x4a')]({'where':{'id':_0x55dcc2[_0x6374('0x45')]['id']}})[_0x6374('0x24')](handleEntityNotFound(_0x11c98b,null))[_0x6374('0x24')](removeEntity(_0x11c98b,null))['catch'](handleError(_0x11c98b,null));}; \ No newline at end of file +var _0x4af8=['name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','pick','filter','merge','where','options','ServicenowField','includeAll','include','findAll','rows','catch','show','params','create','body','find','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','json','apply','reject','save','update','then','destroy','end','error','stack'];(function(_0x26554b,_0x59e39b){var _0x14efe3=function(_0x5d400b){while(--_0x5d400b){_0x26554b['push'](_0x26554b['shift']());}};_0x14efe3(++_0x59e39b);}(_0x4af8,0x1ad));var _0x84af=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x4af8[_0x494d1f];return _0x457b6e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x84af('0x0'));var rp=require(_0x84af('0x1'));var moment=require(_0x84af('0x2'));var BPromise=require(_0x84af('0x3'));var Mustache=require('mustache');var util=require(_0x84af('0x4'));var path=require(_0x84af('0x5'));var sox=require('sox');var csv=require(_0x84af('0x6'));var ejs=require(_0x84af('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x84af('0x8'));var crypto=require(_0x84af('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x84af('0x6'));var querystring=require(_0x84af('0xa'));var Papa=require('papaparse');var Redis=require(_0x84af('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x84af('0xc'));var as=require(_0x84af('0xd'));var hardwareService=require(_0x84af('0xe'));var logger=require(_0x84af('0xf'))('api');var utils=require(_0x84af('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x84af('0x11'));var db=require(_0x84af('0x12'))['db'];function respondWithStatusCode(_0x588eec,_0x3df8fa){_0x3df8fa=_0x3df8fa||0xcc;return function(_0x499c7e){if(_0x499c7e){return _0x588eec[_0x84af('0x13')](_0x3df8fa);}return _0x588eec[_0x84af('0x14')](_0x3df8fa)['end']();};}function respondWithResult(_0x24fe78,_0x5664c7){_0x5664c7=_0x5664c7||0xc8;return function(_0xedc1b9){if(_0xedc1b9){return _0x24fe78[_0x84af('0x14')](_0x5664c7)['json'](_0xedc1b9);}};}function respondWithFilteredResult(_0x43449b,_0x33af0e){return function(_0x49c38d){if(_0x49c38d){var _0x4490a9=_0x49c38d['count'],_0x505476=_0x33af0e['offset'],_0x3c7b43=_0x33af0e[_0x84af('0x15')]+_0x33af0e[_0x84af('0x16')],_0x33baf1;if(_0x3c7b43>=_0x4490a9){_0x3c7b43=_0x4490a9;_0x33baf1=0xc8;}else{_0x33baf1=0xce;}_0x43449b[_0x84af('0x14')](_0x33baf1);return _0x43449b['set']('Content-Range',_0x505476+'-'+_0x3c7b43+'/'+_0x4490a9)[_0x84af('0x17')](_0x49c38d);}return null;};}function patchUpdates(_0x1d91d7){return function(_0x2a4b34){try{jsonpatch[_0x84af('0x18')](_0x2a4b34,_0x1d91d7,!![]);}catch(_0x3af632){return BPromise[_0x84af('0x19')](_0x3af632);}return _0x2a4b34[_0x84af('0x1a')]();};}function saveUpdates(_0x334875,_0x2ec16e){return function(_0x52b819){if(_0x52b819){return _0x52b819[_0x84af('0x1b')](_0x334875)[_0x84af('0x1c')](function(_0x166aac){return _0x166aac;});}return null;};}function removeEntity(_0x4ee3d1,_0x2f40d6){return function(_0xaea1ea){if(_0xaea1ea){return _0xaea1ea[_0x84af('0x1d')]()['then'](function(){_0x4ee3d1['status'](0xcc)[_0x84af('0x1e')]();});}};}function handleEntityNotFound(_0x2a73ff,_0xf72093){return function(_0x24aa07){if(!_0x24aa07){_0x2a73ff[_0x84af('0x13')](0x194);}return _0x24aa07;};}function handleError(_0x1b23fb,_0x2e5ff4){_0x2e5ff4=_0x2e5ff4||0x1f4;return function(_0x40a84a){logger[_0x84af('0x1f')](_0x40a84a[_0x84af('0x20')]);if(_0x40a84a[_0x84af('0x21')]){delete _0x40a84a['name'];}_0x1b23fb[_0x84af('0x14')](_0x2e5ff4)[_0x84af('0x22')](_0x40a84a);};}exports[_0x84af('0x23')]=function(_0x432d80,_0x405bfb){var _0x881a95={},_0x6e50b={},_0x4c01e3={'count':0x0,'rows':[]};var _0x253df4=_[_0x84af('0x24')](db['ServicenowField'][_0x84af('0x25')],function(_0x1f5d85){return{'name':_0x1f5d85[_0x84af('0x26')],'type':_0x1f5d85[_0x84af('0x27')]['key']};});_0x6e50b['model']=_[_0x84af('0x24')](_0x253df4,_0x84af('0x21'));_0x6e50b[_0x84af('0x28')]=_[_0x84af('0x29')](_0x432d80[_0x84af('0x28')]);_0x6e50b[_0x84af('0x2a')]=_['intersection'](_0x6e50b[_0x84af('0x2b')],_0x6e50b[_0x84af('0x28')]);_0x881a95['attributes']=_[_0x84af('0x2c')](_0x6e50b[_0x84af('0x2b')],qs['fields'](_0x432d80['query'][_0x84af('0x2d')]));_0x881a95['attributes']=_0x881a95[_0x84af('0x2e')][_0x84af('0x2f')]?_0x881a95['attributes']:_0x6e50b[_0x84af('0x2b')];if(!_0x432d80[_0x84af('0x28')][_0x84af('0x30')](_0x84af('0x31'))){_0x881a95[_0x84af('0x16')]=qs[_0x84af('0x16')](_0x432d80[_0x84af('0x28')][_0x84af('0x16')]);_0x881a95[_0x84af('0x15')]=qs[_0x84af('0x15')](_0x432d80['query'][_0x84af('0x15')]);}_0x881a95['order']=qs['sort'](_0x432d80[_0x84af('0x28')]['sort']);_0x881a95['where']=qs[_0x84af('0x2a')](_[_0x84af('0x32')](_0x432d80[_0x84af('0x28')],_0x6e50b['filters']),_0x253df4);if(_0x432d80[_0x84af('0x28')][_0x84af('0x33')]){_0x881a95['where']=_[_0x84af('0x34')](_0x881a95[_0x84af('0x35')],{'$or':_['map'](_0x253df4,function(_0x4f88a7){if(_0x4f88a7[_0x84af('0x27')]!=='VIRTUAL'){var _0x2dca64={};_0x2dca64[_0x4f88a7[_0x84af('0x21')]]={'$like':'%'+_0x432d80['query']['filter']+'%'};return _0x2dca64;}})});}_0x881a95=_[_0x84af('0x34')]({},_0x881a95,_0x432d80[_0x84af('0x36')]);var _0x33fe50={'where':_0x881a95['where']};return db[_0x84af('0x37')]['count'](_0x33fe50)['then'](function(_0x30c8f4){_0x4c01e3['count']=_0x30c8f4;if(_0x432d80[_0x84af('0x28')][_0x84af('0x38')]){_0x881a95[_0x84af('0x39')]=[{'all':!![]}];}return db['ServicenowField'][_0x84af('0x3a')](_0x881a95);})[_0x84af('0x1c')](function(_0x548aa2){_0x4c01e3[_0x84af('0x3b')]=_0x548aa2;return _0x4c01e3;})[_0x84af('0x1c')](respondWithFilteredResult(_0x405bfb,_0x881a95))[_0x84af('0x3c')](handleError(_0x405bfb,null));};exports[_0x84af('0x3d')]=function(_0x4f096b,_0x14608f){var _0xc60ea0={'raw':!![],'where':{'id':_0x4f096b[_0x84af('0x3e')]['id']}},_0x490b7d={};_0x490b7d[_0x84af('0x2b')]=_[_0x84af('0x29')](db[_0x84af('0x37')]['rawAttributes']);_0x490b7d[_0x84af('0x28')]=_[_0x84af('0x29')](_0x4f096b[_0x84af('0x28')]);_0x490b7d[_0x84af('0x2a')]=_[_0x84af('0x2c')](_0x490b7d[_0x84af('0x2b')],_0x490b7d['query']);_0xc60ea0[_0x84af('0x2e')]=_['intersection'](_0x490b7d[_0x84af('0x2b')],qs[_0x84af('0x2d')](_0x4f096b['query'][_0x84af('0x2d')]));_0xc60ea0[_0x84af('0x2e')]=_0xc60ea0[_0x84af('0x2e')][_0x84af('0x2f')]?_0xc60ea0[_0x84af('0x2e')]:_0x490b7d[_0x84af('0x2b')];if(_0x4f096b[_0x84af('0x28')][_0x84af('0x38')]){_0xc60ea0[_0x84af('0x39')]=[{'all':!![]}];}_0xc60ea0=_[_0x84af('0x34')]({},_0xc60ea0,_0x4f096b[_0x84af('0x36')]);return db['ServicenowField']['find'](_0xc60ea0)[_0x84af('0x1c')](handleEntityNotFound(_0x14608f,null))['then'](respondWithResult(_0x14608f,null))['catch'](handleError(_0x14608f,null));};exports['create']=function(_0x2542bb,_0x42a681){return db[_0x84af('0x37')][_0x84af('0x3f')](_0x2542bb[_0x84af('0x40')],{})[_0x84af('0x1c')](respondWithResult(_0x42a681,0xc9))[_0x84af('0x3c')](handleError(_0x42a681,null));};exports['update']=function(_0x2a33fa,_0x3d9f5d){if(_0x2a33fa['body']['id']){delete _0x2a33fa[_0x84af('0x40')]['id'];}return db[_0x84af('0x37')]['find']({'where':{'id':_0x2a33fa[_0x84af('0x3e')]['id']}})[_0x84af('0x1c')](handleEntityNotFound(_0x3d9f5d,null))[_0x84af('0x1c')](saveUpdates(_0x2a33fa[_0x84af('0x40')],null))[_0x84af('0x1c')](respondWithResult(_0x3d9f5d,null))[_0x84af('0x3c')](handleError(_0x3d9f5d,null));};exports[_0x84af('0x1d')]=function(_0x581fda,_0xc8c480){return db['ServicenowField'][_0x84af('0x41')]({'where':{'id':_0x581fda[_0x84af('0x3e')]['id']}})[_0x84af('0x1c')](handleEntityNotFound(_0xc8c480,null))[_0x84af('0x1c')](removeEntity(_0xc8c480,null))[_0x84af('0x3c')](handleError(_0xc8c480,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 072e205..2fad503 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 _0x27f6=['ServicenowField','servicenow_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0x21c283,_0x4f748a){var _0x25bc0d=function(_0x293b59){while(--_0x293b59){_0x21c283['push'](_0x21c283['shift']());}};_0x25bc0d(++_0x4f748a);}(_0x27f6,0x170));var _0x627f=function(_0x2020c1,_0x37b45a){_0x2020c1=_0x2020c1-0x0;var _0x139998=_0x27f6[_0x2020c1];return _0x139998;};'use strict';var _=require('lodash');var util=require(_0x627f('0x0'));var logger=require(_0x627f('0x1'))('api');var moment=require(_0x627f('0x2'));var BPromise=require(_0x627f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x627f('0x4'));var rimraf=require(_0x627f('0x5'));var config=require(_0x627f('0x6'));var attributes=require(_0x627f('0x7'));module[_0x627f('0x8')]=function(_0x180513,_0x250ddf){return _0x180513[_0x627f('0x9')](_0x627f('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x627f('0xb'),'fields':[_0x627f('0xc'),_0x627f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x362d=['int_servicenow_fields','idField','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x362d,0x92));var _0xd362=function(_0x2b4212,_0x4f5260){_0x2b4212=_0x2b4212-0x0;var _0x5259fc=_0x362d[_0x2b4212];return _0x5259fc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd362('0x0'))('api');var moment=require(_0xd362('0x1'));var BPromise=require(_0xd362('0x2'));var rp=require(_0xd362('0x3'));var fs=require('fs');var path=require(_0xd362('0x4'));var rimraf=require(_0xd362('0x5'));var config=require(_0xd362('0x6'));var attributes=require(_0xd362('0x7'));module['exports']=function(_0xcea08b,_0x3fc423){return _0xcea08b[_0xd362('0x8')](_0xd362('0x9'),attributes,{'tableName':_0xd362('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xd362('0xb'),'FieldId'],'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 27132ba..26bd96e 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 _0xa4cd=['info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','code','message','error','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x5a2299,_0x3e2922){var _0xedff0f=function(_0x1624cb){while(--_0x1624cb){_0x5a2299['push'](_0x5a2299['shift']());}};_0xedff0f(++_0x3e2922);}(_0xa4cd,0xb1));var _0xda4c=function(_0x261b6c,_0x564698){_0x261b6c=_0x261b6c-0x0;var _0x317163=_0xa4cd[_0x261b6c];return _0x317163;};'use strict';var _=require(_0xda4c('0x0'));var util=require(_0xda4c('0x1'));var moment=require('moment');var BPromise=require(_0xda4c('0x2'));var rs=require(_0xda4c('0x3'));var fs=require('fs');var Redis=require(_0xda4c('0x4'));var db=require(_0xda4c('0x5'))['db'];var utils=require(_0xda4c('0x6'));var logger=require(_0xda4c('0x7'))('rpc');var config=require(_0xda4c('0x8'));var jayson=require(_0xda4c('0x9'));var client=jayson[_0xda4c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x255139,_0x3129fc,_0x5296b9){return new BPromise(function(_0x1dfcc7,_0x5dc656){return client[_0xda4c('0xb')](_0x255139,_0x5296b9)['then'](function(_0x384db0){logger[_0xda4c('0xc')](_0xda4c('0xd'),_0x3129fc,_0xda4c('0xe'));logger[_0xda4c('0xf')](_0xda4c('0x10'),_0x3129fc,_0xda4c('0xe'),JSON[_0xda4c('0x11')](_0x384db0));if(_0x384db0['error']){if(_0x384db0['error'][_0xda4c('0x12')]===0x1f4){logger['error'](_0xda4c('0xd'),_0x3129fc,_0x384db0['error'][_0xda4c('0x13')]);return _0x5dc656(_0x384db0[_0xda4c('0x14')]['message']);}logger[_0xda4c('0x14')](_0xda4c('0xd'),_0x3129fc,_0x384db0['error'][_0xda4c('0x13')]);return _0x1dfcc7(_0x384db0[_0xda4c('0x14')][_0xda4c('0x13')]);}else{logger[_0xda4c('0xc')](_0xda4c('0xd'),_0x3129fc,_0xda4c('0xe'));_0x1dfcc7(_0x384db0['result'][_0xda4c('0x13')]);}})['catch'](function(_0x170a5f){logger['error'](_0xda4c('0xd'),_0x3129fc,_0x170a5f);_0x5dc656(_0x170a5f);});});} \ No newline at end of file +var _0x57a6=['catch','lodash','moment','randomstring','../../config/utils','../../config/logger','client','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowField,\x20%s,\x20%s','message','result'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x57a6,0x1a3));var _0x657a=function(_0x1dd829,_0x698bcb){_0x1dd829=_0x1dd829-0x0;var _0x1014f9=_0x57a6[_0x1dd829];return _0x1014f9;};'use strict';var _=require(_0x657a('0x0'));var util=require('util');var moment=require(_0x657a('0x1'));var BPromise=require('bluebird');var rs=require(_0x657a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x657a('0x3'));var logger=require(_0x657a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x657a('0x5')][_0x657a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4e99ac,_0x54952f,_0x6bfd3c){return new BPromise(function(_0x5ea203,_0x2f7135){return client['request'](_0x4e99ac,_0x6bfd3c)[_0x657a('0x7')](function(_0x419061){logger[_0x657a('0x8')]('ServicenowField,\x20%s,\x20%s',_0x54952f,_0x657a('0x9'));logger[_0x657a('0xa')](_0x657a('0xb'),_0x54952f,_0x657a('0x9'),JSON[_0x657a('0xc')](_0x419061));if(_0x419061[_0x657a('0xd')]){if(_0x419061['error'][_0x657a('0xe')]===0x1f4){logger['error'](_0x657a('0xf'),_0x54952f,_0x419061['error'][_0x657a('0x10')]);return _0x2f7135(_0x419061[_0x657a('0xd')][_0x657a('0x10')]);}logger[_0x657a('0xd')](_0x657a('0xf'),_0x54952f,_0x419061[_0x657a('0xd')][_0x657a('0x10')]);return _0x5ea203(_0x419061[_0x657a('0xd')][_0x657a('0x10')]);}else{logger['info'](_0x657a('0xf'),_0x54952f,_0x657a('0x9'));_0x5ea203(_0x419061[_0x657a('0x11')]['message']);}})[_0x657a('0x12')](function(_0x180413){logger[_0x657a('0xd')](_0x657a('0xf'),_0x54952f,_0x180413);_0x2f7135(_0x180413);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index b66245f..c4a27c5 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 _0xea70=['get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./intSugarcrmAccount.controller'];(function(_0x509b9d,_0x234651){var _0x5a755f=function(_0xd20aa1){while(--_0xd20aa1){_0x509b9d['push'](_0x509b9d['shift']());}};_0x5a755f(++_0x234651);}(_0xea70,0x175));var _0x0ea7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xea70[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var path=require(_0x0ea7('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ea7('0x3'));var router=express['Router']();var auth=require(_0x0ea7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0ea7('0x5'));var controller=require(_0x0ea7('0x6'));router[_0x0ea7('0x7')]('/',auth[_0x0ea7('0x8')](),controller[_0x0ea7('0x9')]);router['get'](_0x0ea7('0xa'),auth[_0x0ea7('0x8')](),controller['show']);router[_0x0ea7('0x7')](_0x0ea7('0xb'),auth['isAuthenticated'](),controller[_0x0ea7('0xc')]);router[_0x0ea7('0x7')](_0x0ea7('0xd'),auth[_0x0ea7('0x8')](),controller['getFields']);router[_0x0ea7('0xe')]('/',auth[_0x0ea7('0x8')](),controller[_0x0ea7('0xf')]);router[_0x0ea7('0xe')](_0x0ea7('0xb'),auth['isAuthenticated'](),controller[_0x0ea7('0x10')]);router[_0x0ea7('0x11')](_0x0ea7('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0ea7('0xa'),auth[_0x0ea7('0x8')](),controller[_0x0ea7('0x12')]);module[_0x0ea7('0x13')]=router; \ No newline at end of file +var _0x38a5=['/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations'];(function(_0x3bb682,_0x2fa20e){var _0x466baa=function(_0x1b2726){while(--_0x1b2726){_0x3bb682['push'](_0x3bb682['shift']());}};_0x466baa(++_0x2fa20e);}(_0x38a5,0x69));var _0x538a=function(_0x4f3fce,_0x394ec9){_0x4f3fce=_0x4f3fce-0x0;var _0x2d79a8=_0x38a5[_0x4f3fce];return _0x2d79a8;};'use strict';var multer=require(_0x538a('0x0'));var util=require(_0x538a('0x1'));var path=require(_0x538a('0x2'));var timeout=require(_0x538a('0x3'));var express=require('express');var router=express[_0x538a('0x4')]();var auth=require(_0x538a('0x5'));var interaction=require(_0x538a('0x6'));var config=require(_0x538a('0x7'));var controller=require(_0x538a('0x8'));router[_0x538a('0x9')]('/',auth[_0x538a('0xa')](),controller[_0x538a('0xb')]);router[_0x538a('0x9')](_0x538a('0xc'),auth[_0x538a('0xa')](),controller[_0x538a('0xd')]);router[_0x538a('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x538a('0xe')]);router[_0x538a('0x9')](_0x538a('0xf'),auth['isAuthenticated'](),controller[_0x538a('0x10')]);router[_0x538a('0x11')]('/',auth[_0x538a('0xa')](),controller[_0x538a('0x12')]);router[_0x538a('0x11')](_0x538a('0x13'),auth[_0x538a('0xa')](),controller[_0x538a('0x14')]);router['put']('/:id',auth[_0x538a('0xa')](),controller[_0x538a('0x15')]);router['delete']('/:id',auth[_0x538a('0xa')](),controller[_0x538a('0x16')]);module[_0x538a('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 fc960b9..2079d20 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 _0x781e=['exports','STRING','remoteUri','sequelize'];(function(_0x1a07a0,_0x131f14){var _0x1cb92f=function(_0x45320e){while(--_0x45320e){_0x1a07a0['push'](_0x1a07a0['shift']());}};_0x1cb92f(++_0x131f14);}(_0x781e,0x183));var _0xe781=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x781e[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xe781('0x0'));module[_0xe781('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe781('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe781('0x2')],'unique':_0xe781('0x3')},'serverUrl':{'type':Sequelize[_0xe781('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd671=['exports','STRING','username','sequelize'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xd671,0x1df));var _0x1d67=function(_0x4e7abc,_0x2aeca1){_0x4e7abc=_0x4e7abc-0x0;var _0x428796=_0xd671[_0x4e7abc];return _0x428796;};'use strict';var Sequelize=require(_0x1d67('0x0'));module[_0x1d67('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1d67('0x2')]},'username':{'type':Sequelize[_0x1d67('0x2')],'unique':_0x1d67('0x3')},'password':{'type':Sequelize[_0x1d67('0x2')]},'remoteUri':{'type':Sequelize[_0x1d67('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x1d67('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index b77b84c..62b4e56 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 _0xf12e=['value','statusCode','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','rows','catch','params','keys','includeAll','options','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','description','date_start','duration_hours','duration_minutes','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','Calls','module_fields','remove','includes','endsWith','values'];(function(_0x379d27,_0x15ae43){var _0x5adf39=function(_0x11df29){while(--_0x11df29){_0x379d27['push'](_0x379d27['shift']());}};_0x5adf39(++_0x15ae43);}(_0xf12e,0x8b));var _0xef12=function(_0x9d39e9,_0x3aebc9){_0x9d39e9=_0x9d39e9-0x0;var _0x4ac75b=_0xf12e[_0x9d39e9];return _0x4ac75b;};'use strict';var pdf=require(_0xef12('0x0'));var emlformat=require(_0xef12('0x1'));var rimraf=require(_0xef12('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef12('0x3'));var rp=require(_0xef12('0x4'));var moment=require(_0xef12('0x5'));var BPromise=require(_0xef12('0x6'));var Mustache=require(_0xef12('0x7'));var util=require(_0xef12('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xef12('0x9'));var ejs=require(_0xef12('0xa'));var fs=require('fs');var _=require(_0xef12('0xb'));var squel=require(_0xef12('0xc'));var crypto=require(_0xef12('0xd'));var jsforce=require(_0xef12('0xe'));var deskjs=require(_0xef12('0xf'));var toCsv=require(_0xef12('0x9'));var querystring=require(_0xef12('0x10'));var Papa=require(_0xef12('0x11'));var Redis=require(_0xef12('0x12'));var authService=require(_0xef12('0x13'));var qs=require(_0xef12('0x14'));var as=require(_0xef12('0x15'));var hardwareService=require(_0xef12('0x16'));var logger=require(_0xef12('0x17'))(_0xef12('0x18'));var utils=require(_0xef12('0x19'));var config=require(_0xef12('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xef12('0x1b'));var jayson=require(_0xef12('0x1c'));var client=jayson[_0xef12('0x1d')][_0xef12('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x55eccc,_0x295bb3,_0x1ced9f,_0x47ebb9){return new BPromise(function(_0x32557e,_0x55e97a){var _0x13cfd5=_0x47ebb9||client;return _0x13cfd5[_0xef12('0x1f')](_0x55eccc,_0x1ced9f)[_0xef12('0x20')](function(_0x2bfd06){logger[_0xef12('0x21')](_0xef12('0x22'),_0x295bb3,_0xef12('0x23'));logger[_0xef12('0x24')](_0xef12('0x25'),_0x295bb3,'request\x20sent',JSON['stringify'](_0x2bfd06));if(_0x2bfd06['error']){if(_0x2bfd06[_0xef12('0x26')][_0xef12('0x27')]===0x1f4){logger[_0xef12('0x26')](_0xef12('0x22'),_0x295bb3,_0x2bfd06[_0xef12('0x26')]['message']);return _0x55e97a(_0x2bfd06[_0xef12('0x26')][_0xef12('0x28')]);}logger[_0xef12('0x26')](_0xef12('0x22'),_0x295bb3,_0x2bfd06[_0xef12('0x26')][_0xef12('0x28')]);return _0x32557e(_0x2bfd06['error'][_0xef12('0x28')]);}else{logger[_0xef12('0x21')](_0xef12('0x22'),_0x295bb3,'request\x20sent');_0x32557e(_0x2bfd06[_0xef12('0x29')][_0xef12('0x28')]);}})['catch'](function(_0x5f0169){logger['error'](_0xef12('0x22'),_0x295bb3,_0x5f0169);_0x55e97a(_0x5f0169);});});}function respondWithStatusCode(_0x3c66ad,_0x201fd9){_0x201fd9=_0x201fd9||0xcc;return function(_0x225475){if(_0x225475){return _0x3c66ad[_0xef12('0x2a')](_0x201fd9);}return _0x3c66ad[_0xef12('0x2b')](_0x201fd9)[_0xef12('0x2c')]();};}function respondWithResult(_0x301f8e,_0x17ca80){_0x17ca80=_0x17ca80||0xc8;return function(_0x3a5726){if(_0x3a5726){return _0x301f8e[_0xef12('0x2b')](_0x17ca80)['json'](_0x3a5726);}};}function respondWithFilteredResult(_0x470811,_0x4ca22e){return function(_0x4f6201){if(_0x4f6201){var _0x5701e6=_0x4f6201[_0xef12('0x2d')],_0x13665c=_0x4ca22e[_0xef12('0x2e')],_0x2aac86=_0x4ca22e[_0xef12('0x2e')]+_0x4ca22e[_0xef12('0x2f')],_0x1ab30f;if(_0x2aac86>=_0x5701e6){_0x2aac86=_0x5701e6;_0x1ab30f=0xc8;}else{_0x1ab30f=0xce;}_0x470811['status'](_0x1ab30f);return _0x470811[_0xef12('0x30')](_0xef12('0x31'),_0x13665c+'-'+_0x2aac86+'/'+_0x5701e6)[_0xef12('0x32')](_0x4f6201);}return null;};}function patchUpdates(_0x589489){return function(_0x5cc94c){try{jsonpatch[_0xef12('0x33')](_0x5cc94c,_0x589489,!![]);}catch(_0x3085f0){return BPromise[_0xef12('0x34')](_0x3085f0);}return _0x5cc94c['save']();};}function saveUpdates(_0x104c0b,_0x3065e4){return function(_0x153954){if(_0x153954){return _0x153954[_0xef12('0x35')](_0x104c0b)['then'](function(_0x19de93){return _0x19de93;});}return null;};}function removeEntity(_0x33eef5,_0x435fcb){return function(_0x5e716d){if(_0x5e716d){return _0x5e716d[_0xef12('0x36')]()[_0xef12('0x20')](function(){_0x33eef5[_0xef12('0x2b')](0xcc)[_0xef12('0x2c')]();});}};}function handleEntityNotFound(_0x1f2246,_0x49402c){return function(_0x1081b4){if(!_0x1081b4){_0x1f2246[_0xef12('0x2a')](0x194);}return _0x1081b4;};}function handleError(_0x2c2093,_0x351f2b){_0x351f2b=_0x351f2b||0x1f4;return function(_0x262099){logger[_0xef12('0x26')](_0x262099[_0xef12('0x37')]);if(_0x262099['name']){delete _0x262099[_0xef12('0x38')];}_0x2c2093[_0xef12('0x2b')](_0x351f2b)[_0xef12('0x39')](_0x262099);};}exports[_0xef12('0x3a')]=function(_0x43b501,_0x2a82ab){var _0x2f02f1={},_0x44f32f={},_0x1a1408={'count':0x0,'rows':[]};var _0x576bd0=_[_0xef12('0x3b')](db[_0xef12('0x3c')][_0xef12('0x3d')],function(_0x3523d4){return{'name':_0x3523d4[_0xef12('0x3e')],'type':_0x3523d4[_0xef12('0x3f')]['key']};});_0x44f32f['model']=_[_0xef12('0x3b')](_0x576bd0,_0xef12('0x38'));_0x44f32f[_0xef12('0x40')]=_['keys'](_0x43b501[_0xef12('0x40')]);_0x44f32f[_0xef12('0x41')]=_[_0xef12('0x42')](_0x44f32f[_0xef12('0x43')],_0x44f32f[_0xef12('0x40')]);_0x2f02f1[_0xef12('0x44')]=_[_0xef12('0x42')](_0x44f32f['model'],qs[_0xef12('0x45')](_0x43b501[_0xef12('0x40')][_0xef12('0x45')]));_0x2f02f1[_0xef12('0x44')]=_0x2f02f1['attributes'][_0xef12('0x46')]?_0x2f02f1[_0xef12('0x44')]:_0x44f32f[_0xef12('0x43')];if(!_0x43b501[_0xef12('0x40')]['hasOwnProperty'](_0xef12('0x47'))){_0x2f02f1[_0xef12('0x2f')]=qs[_0xef12('0x2f')](_0x43b501[_0xef12('0x40')][_0xef12('0x2f')]);_0x2f02f1[_0xef12('0x2e')]=qs['offset'](_0x43b501[_0xef12('0x40')][_0xef12('0x2e')]);}_0x2f02f1[_0xef12('0x48')]=qs[_0xef12('0x49')](_0x43b501[_0xef12('0x40')][_0xef12('0x49')]);_0x2f02f1['where']=qs['filters'](_[_0xef12('0x4a')](_0x43b501[_0xef12('0x40')],_0x44f32f[_0xef12('0x41')]),_0x576bd0);if(_0x43b501['query'][_0xef12('0x4b')]){_0x2f02f1[_0xef12('0x4c')]=_[_0xef12('0x4d')](_0x2f02f1[_0xef12('0x4c')],{'$or':_[_0xef12('0x3b')](_0x576bd0,function(_0x3da43c){if(_0x3da43c[_0xef12('0x3f')]!==_0xef12('0x4e')){var _0x34d0cc={};_0x34d0cc[_0x3da43c['name']]={'$like':'%'+_0x43b501[_0xef12('0x40')]['filter']+'%'};return _0x34d0cc;}})});}_0x2f02f1=_[_0xef12('0x4d')]({},_0x2f02f1,_0x43b501['options']);var _0x14cf83={'where':_0x2f02f1[_0xef12('0x4c')]};return db[_0xef12('0x3c')][_0xef12('0x2d')](_0x14cf83)[_0xef12('0x20')](function(_0x35af1b){_0x1a1408[_0xef12('0x2d')]=_0x35af1b;if(_0x43b501['query']['includeAll']){_0x2f02f1[_0xef12('0x4f')]=[{'all':!![]}];}return db[_0xef12('0x3c')]['findAll'](_0x2f02f1);})[_0xef12('0x20')](function(_0x1a314d){_0x1a1408[_0xef12('0x50')]=_0x1a314d;return _0x1a1408;})[_0xef12('0x20')](respondWithFilteredResult(_0x2a82ab,_0x2f02f1))[_0xef12('0x51')](handleError(_0x2a82ab,null));};exports['show']=function(_0x36714f,_0xeb5698){var _0x2a1c38={'raw':![],'where':{'id':_0x36714f[_0xef12('0x52')]['id']}},_0x3e9859={};_0x3e9859[_0xef12('0x43')]=_[_0xef12('0x53')](db['SugarcrmAccount']['rawAttributes']);_0x3e9859[_0xef12('0x40')]=_[_0xef12('0x53')](_0x36714f[_0xef12('0x40')]);_0x3e9859[_0xef12('0x41')]=_[_0xef12('0x42')](_0x3e9859['model'],_0x3e9859[_0xef12('0x40')]);_0x2a1c38[_0xef12('0x44')]=_[_0xef12('0x42')](_0x3e9859[_0xef12('0x43')],qs[_0xef12('0x45')](_0x36714f[_0xef12('0x40')][_0xef12('0x45')]));_0x2a1c38[_0xef12('0x44')]=_0x2a1c38[_0xef12('0x44')][_0xef12('0x46')]?_0x2a1c38[_0xef12('0x44')]:_0x3e9859[_0xef12('0x43')];if(_0x36714f['query'][_0xef12('0x54')]){_0x2a1c38[_0xef12('0x4f')]=[{'all':!![]}];}_0x2a1c38=_[_0xef12('0x4d')]({},_0x2a1c38,_0x36714f[_0xef12('0x55')]);return db[_0xef12('0x3c')][_0xef12('0x56')](_0x2a1c38)[_0xef12('0x20')](handleEntityNotFound(_0xeb5698,null))[_0xef12('0x20')](respondWithResult(_0xeb5698,null))[_0xef12('0x51')](handleError(_0xeb5698,null));};exports[_0xef12('0x57')]=function(_0x5e6b6d,_0x3418b8){return db[_0xef12('0x3c')][_0xef12('0x57')](_0x5e6b6d[_0xef12('0x58')],{})[_0xef12('0x20')](respondWithResult(_0x3418b8,0xc9))[_0xef12('0x51')](handleError(_0x3418b8,null));};exports[_0xef12('0x35')]=function(_0x139581,_0x553e3f){if(_0x139581[_0xef12('0x58')]['id']){delete _0x139581['body']['id'];}return db[_0xef12('0x3c')][_0xef12('0x56')]({'where':{'id':_0x139581[_0xef12('0x52')]['id']}})['then'](handleEntityNotFound(_0x553e3f,null))[_0xef12('0x20')](saveUpdates(_0x139581[_0xef12('0x58')],null))[_0xef12('0x20')](respondWithResult(_0x553e3f,null))[_0xef12('0x51')](handleError(_0x553e3f,null));};exports[_0xef12('0x36')]=function(_0xdffc72,_0x17d633){return db['SugarcrmAccount'][_0xef12('0x56')]({'where':{'id':_0xdffc72['params']['id']}})[_0xef12('0x20')](handleEntityNotFound(_0x17d633,null))['then'](removeEntity(_0x17d633,null))[_0xef12('0x51')](handleError(_0x17d633,null));};exports[_0xef12('0x59')]=function(_0x5ddf24,_0x542da3,_0x4ec852){var _0x58a48b={};var _0x26b1fa={};var _0x56eea5;var _0x412166;return db['SugarcrmAccount'][_0xef12('0x5a')]({'where':{'id':_0x5ddf24[_0xef12('0x52')]['id']}})[_0xef12('0x20')](handleEntityNotFound(_0x542da3,null))[_0xef12('0x20')](function(_0x5d57a5){if(_0x5d57a5){_0x56eea5=_0x5d57a5;_0x26b1fa[_0xef12('0x43')]=_['keys'](db[_0xef12('0x5b')]['rawAttributes']);_0x26b1fa[_0xef12('0x40')]=_[_0xef12('0x53')](_0x5ddf24[_0xef12('0x40')]);_0x26b1fa[_0xef12('0x41')]=_['intersection'](_0x26b1fa[_0xef12('0x43')],_0x26b1fa[_0xef12('0x40')]);_0x58a48b['attributes']=_[_0xef12('0x42')](_0x26b1fa[_0xef12('0x43')],qs[_0xef12('0x45')](_0x5ddf24['query'][_0xef12('0x45')]));_0x58a48b[_0xef12('0x44')]=_0x58a48b[_0xef12('0x44')][_0xef12('0x46')]?_0x58a48b[_0xef12('0x44')]:_0x26b1fa[_0xef12('0x43')];_0x58a48b['order']=qs[_0xef12('0x49')](_0x5ddf24['query'][_0xef12('0x49')]);_0x58a48b[_0xef12('0x4c')]=qs[_0xef12('0x41')](_[_0xef12('0x4a')](_0x5ddf24['query'],_0x26b1fa[_0xef12('0x41')]));if(_0x5ddf24['query'][_0xef12('0x4b')]){_0x58a48b['where']=_[_0xef12('0x4d')](_0x58a48b['where'],{'$or':_[_0xef12('0x3b')](_0x58a48b[_0xef12('0x44')],function(_0x3ab3ff){var _0x3330a2={};_0x3330a2[_0x3ab3ff]={'$like':'%'+_0x5ddf24['query']['filter']+'%'};return _0x3330a2;})});}_0x58a48b=_['merge']({},_0x58a48b,_0x5ddf24[_0xef12('0x55')]);return _0x56eea5[_0xef12('0x59')](_0x58a48b);}})[_0xef12('0x20')](function(_0x450851){if(_0x450851){_0x412166=_0x450851['length'];if(!_0x5ddf24['query'][_0xef12('0x5c')](_0xef12('0x47'))){_0x58a48b[_0xef12('0x2f')]=qs['limit'](_0x5ddf24[_0xef12('0x40')][_0xef12('0x2f')]);_0x58a48b[_0xef12('0x2e')]=qs['offset'](_0x5ddf24[_0xef12('0x40')]['offset']);}return _0x56eea5['getConfigurations'](_0x58a48b);}})[_0xef12('0x20')](function(_0x32d3a1){if(_0x32d3a1){return _0x32d3a1?{'count':_0x412166,'rows':_0x32d3a1}:null;}})[_0xef12('0x20')](respondWithResult(_0x542da3,null))[_0xef12('0x51')](handleError(_0x542da3,null));};exports[_0xef12('0x5d')]=function(_0x19bf36,_0x4b4c7f,_0x38b5a3){if(_0x19bf36[_0xef12('0x58')]['id']){delete _0x19bf36[_0xef12('0x58')]['id'];}return db[_0xef12('0x3c')][_0xef12('0x5a')]({'where':{'id':_0x19bf36['params']['id']}})['then'](handleEntityNotFound(_0x4b4c7f,null))[_0xef12('0x20')](function(_0x596d96){if(_0x596d96){_0x19bf36[_0xef12('0x58')][_0xef12('0x5e')]=_0x596d96['id'];_0x19bf36[_0xef12('0x58')][_0xef12('0x5f')]=integrations[_0xef12('0x60')](_0x19bf36[_0xef12('0x58')][_0xef12('0x61')],_0x19bf36[_0xef12('0x58')][_0xef12('0x3f')]);_0x19bf36[_0xef12('0x58')][_0xef12('0x62')]=integrations[_0xef12('0x63')](_0x19bf36[_0xef12('0x58')]['channel'],_0x19bf36['body']['type']);return db[_0xef12('0x5b')][_0xef12('0x57')](_0x19bf36[_0xef12('0x58')],{'include':[{'model':db[_0xef12('0x64')],'as':_0xef12('0x5f')},{'model':db[_0xef12('0x64')],'as':_0xef12('0x62')}]});}return null;})[_0xef12('0x20')](respondWithResult(_0x4b4c7f,null))[_0xef12('0x51')](handleError(_0x4b4c7f,null));};exports[_0xef12('0x65')]=function(_0x11cad6,_0x581ff6,_0x57a5bc){var _0x39ae98='';var _0x26b529=['id','name','assigned_user_id','created_by',_0xef12('0x66'),_0xef12('0x67'),_0xef12('0x68'),_0xef12('0x69'),'parent_id','parent_type',_0xef12('0x6a'),_0xef12('0x6b')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x11cad6[_0xef12('0x52')]['id']},'attributes':['id',_0xef12('0x6c'),_0xef12('0x6d'),_0xef12('0x6e')]})[_0xef12('0x20')](handleEntityNotFound(_0x581ff6,null))[_0xef12('0x20')](function(_0x5ab3af){if(_0x5ab3af){_0x39ae98=_0x5ab3af[_0xef12('0x6e')];var _0x4d11d3=_0x39ae98[_0xef12('0x6f')](-0x1);if(_0x4d11d3==='/'){_0x39ae98=_0x39ae98[_0xef12('0x70')](0x0,_0x39ae98[_0xef12('0x71')](_0x4d11d3));}return rp({'method':_0xef12('0x72'),'uri':util['format'](_0xef12('0x73'),_0x39ae98,_0xef12('0x74')),'json':!![],'form':{'method':_0xef12('0x75'),'input_type':_0xef12('0x76'),'response_type':_0xef12('0x76'),'rest_data':JSON[_0xef12('0x77')]({'user_auth':{'user_name':_0x5ab3af[_0xef12('0x6c')],'password':_0x5ab3af[_0xef12('0x6d')],'encryption':'PLAIN'},'application':_0xef12('0x78')})}});}})[_0xef12('0x20')](function(_0x5196c6){if(_0x5196c6&&_0x5196c6[_0xef12('0x38')]!==_0xef12('0x79')&&_0x5196c6['name']!==_0xef12('0x7a')){return rp({'method':'POST','uri':util[_0xef12('0x7b')]('%s%s',_0x39ae98,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xef12('0x7c'),'input_type':_0xef12('0x76'),'response_type':_0xef12('0x76'),'rest_data':JSON[_0xef12('0x77')]({'session':_0x5196c6['id'],'module_name':_0xef12('0x7d')})}})[_0xef12('0x20')](function(_0x1f1506){if(_0x1f1506){var _0x4614a8=_['values'](_0x1f1506[_0xef12('0x7e')]);_[_0xef12('0x7f')](_0x4614a8,function(_0x305a8d){return _0x26b529[_0xef12('0x80')](_0x305a8d[_0xef12('0x38')]);});return{'count':_0x4614a8[_0xef12('0x46')],'rows':_[_0xef12('0x3b')](_0x4614a8,function(_0x590013){return{'id':_0x590013['name'],'name':_0x590013['label'],'custom':_[_0xef12('0x81')](_0x590013[_0xef12('0x38')],'_c')?!![]:![],'options':_0x590013['options']?_[_0xef12('0x3b')](_[_0xef12('0x82')](_0x590013[_0xef12('0x55')]),function(_0x1709a5){return{'name':_0x1709a5[_0xef12('0x83')],'value':_0x1709a5[_0xef12('0x38')]};}):[]};})};}})['then'](respondWithResult(_0x581ff6,null))[_0xef12('0x51')](function(_0x361a90){var _0x178067=_0x11cad6['query']['test']?0x1f4:_0x361a90[_0xef12('0x84')]||0x1f4;logger[_0xef12('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xef12('0x65'),_0x178067,JSON['stringify'](_0x361a90));delete _0x361a90['name'];if(_0x178067===0x191){_0x178067=0x190;}_0x581ff6[_0xef12('0x2b')](_0x178067)[_0xef12('0x39')](_0x11cad6[_0xef12('0x40')][_0xef12('0x85')]?{'message':_0xef12('0x86'),'statusCode':_0x361a90[_0xef12('0x84')]}:_0x361a90);});}else{var _0x29b9ca=0x1f4;_0x581ff6['status'](_0x29b9ca)[_0xef12('0x39')]({'message':_0xef12('0x86'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x107f=['filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','find','body','getConfigurations','findOne','SugarcrmConfiguration','length','options','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','channel','create','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','Invalid\x20Login','get_module_fields','Calls','values','module_fields','includes','label','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick'];(function(_0xd143ab,_0x338592){var _0x457e5e=function(_0x3997f1){while(--_0x3997f1){_0xd143ab['push'](_0xd143ab['shift']());}};_0x457e5e(++_0x338592);}(_0x107f,0x144));var _0xf107=function(_0x11e11c,_0x4e088e){_0x11e11c=_0x11e11c-0x0;var _0x8ffaa4=_0x107f[_0x11e11c];return _0x8ffaa4;};'use strict';var pdf=require(_0xf107('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf107('0x1'));var zipdir=require(_0xf107('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf107('0x3'));var moment=require(_0xf107('0x4'));var BPromise=require(_0xf107('0x5'));var Mustache=require(_0xf107('0x6'));var util=require('util');var path=require(_0xf107('0x7'));var sox=require(_0xf107('0x8'));var csv=require(_0xf107('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf107('0xa'));var squel=require(_0xf107('0xb'));var crypto=require(_0xf107('0xc'));var jsforce=require(_0xf107('0xd'));var deskjs=require(_0xf107('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf107('0xf'));var Papa=require(_0xf107('0x10'));var Redis=require(_0xf107('0x11'));var authService=require(_0xf107('0x12'));var qs=require(_0xf107('0x13'));var as=require(_0xf107('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf107('0x15'))(_0xf107('0x16'));var utils=require(_0xf107('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xf107('0x18'));var client=jayson[_0xf107('0x19')][_0xf107('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2fdd7a,_0x4ba74e,_0x53b147,_0x191c8d){return new BPromise(function(_0x155268,_0x37c11b){var _0x33206f=_0x191c8d||client;return _0x33206f['request'](_0x2fdd7a,_0x53b147)[_0xf107('0x1b')](function(_0x389515){logger['info'](_0xf107('0x1c'),_0x4ba74e,_0xf107('0x1d'));logger[_0xf107('0x1e')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x4ba74e,'request\x20sent',JSON[_0xf107('0x1f')](_0x389515));if(_0x389515['error']){if(_0x389515[_0xf107('0x20')][_0xf107('0x21')]===0x1f4){logger[_0xf107('0x20')](_0xf107('0x1c'),_0x4ba74e,_0x389515[_0xf107('0x20')][_0xf107('0x22')]);return _0x37c11b(_0x389515[_0xf107('0x20')][_0xf107('0x22')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x4ba74e,_0x389515[_0xf107('0x20')][_0xf107('0x22')]);return _0x155268(_0x389515[_0xf107('0x20')][_0xf107('0x22')]);}else{logger['info'](_0xf107('0x1c'),_0x4ba74e,'request\x20sent');_0x155268(_0x389515[_0xf107('0x23')][_0xf107('0x22')]);}})[_0xf107('0x24')](function(_0x318b08){logger[_0xf107('0x20')](_0xf107('0x1c'),_0x4ba74e,_0x318b08);_0x37c11b(_0x318b08);});});}function respondWithStatusCode(_0xd7933,_0x3de671){_0x3de671=_0x3de671||0xcc;return function(_0x4e0053){if(_0x4e0053){return _0xd7933[_0xf107('0x25')](_0x3de671);}return _0xd7933['status'](_0x3de671)[_0xf107('0x26')]();};}function respondWithResult(_0x15e3df,_0x2ceeda){_0x2ceeda=_0x2ceeda||0xc8;return function(_0x1ca4a9){if(_0x1ca4a9){return _0x15e3df[_0xf107('0x27')](_0x2ceeda)[_0xf107('0x28')](_0x1ca4a9);}};}function respondWithFilteredResult(_0x1a7932,_0x237930){return function(_0x20c602){if(_0x20c602){var _0x8fd33b=_0x20c602[_0xf107('0x29')],_0x4c3ea2=_0x237930[_0xf107('0x2a')],_0x2dd48b=_0x237930[_0xf107('0x2a')]+_0x237930[_0xf107('0x2b')],_0x54e794;if(_0x2dd48b>=_0x8fd33b){_0x2dd48b=_0x8fd33b;_0x54e794=0xc8;}else{_0x54e794=0xce;}_0x1a7932[_0xf107('0x27')](_0x54e794);return _0x1a7932[_0xf107('0x2c')](_0xf107('0x2d'),_0x4c3ea2+'-'+_0x2dd48b+'/'+_0x8fd33b)[_0xf107('0x28')](_0x20c602);}return null;};}function patchUpdates(_0x364f78){return function(_0x45fa42){try{jsonpatch[_0xf107('0x2e')](_0x45fa42,_0x364f78,!![]);}catch(_0x4fc323){return BPromise[_0xf107('0x2f')](_0x4fc323);}return _0x45fa42[_0xf107('0x30')]();};}function saveUpdates(_0x7ab07e,_0x51f8c4){return function(_0x57c672){if(_0x57c672){return _0x57c672[_0xf107('0x31')](_0x7ab07e)[_0xf107('0x1b')](function(_0x1102d9){return _0x1102d9;});}return null;};}function removeEntity(_0xd049ab,_0x47c454){return function(_0x4b00f6){if(_0x4b00f6){return _0x4b00f6[_0xf107('0x32')]()[_0xf107('0x1b')](function(){_0xd049ab[_0xf107('0x27')](0xcc)[_0xf107('0x26')]();});}};}function handleEntityNotFound(_0x35cc77,_0x3eac0f){return function(_0x5e6f73){if(!_0x5e6f73){_0x35cc77[_0xf107('0x25')](0x194);}return _0x5e6f73;};}function handleError(_0x163e73,_0x242402){_0x242402=_0x242402||0x1f4;return function(_0x5bb6fc){logger[_0xf107('0x20')](_0x5bb6fc['stack']);if(_0x5bb6fc['name']){delete _0x5bb6fc[_0xf107('0x33')];}_0x163e73[_0xf107('0x27')](_0x242402)[_0xf107('0x34')](_0x5bb6fc);};}exports[_0xf107('0x35')]=function(_0x52d7f7,_0x495251){var _0x471870={},_0x11e62d={},_0x1e60ee={'count':0x0,'rows':[]};var _0x63a0ad=_[_0xf107('0x36')](db[_0xf107('0x37')][_0xf107('0x38')],function(_0x5948cf){return{'name':_0x5948cf[_0xf107('0x39')],'type':_0x5948cf['type'][_0xf107('0x3a')]};});_0x11e62d[_0xf107('0x3b')]=_[_0xf107('0x36')](_0x63a0ad,'name');_0x11e62d[_0xf107('0x3c')]=_['keys'](_0x52d7f7[_0xf107('0x3c')]);_0x11e62d['filters']=_[_0xf107('0x3d')](_0x11e62d['model'],_0x11e62d['query']);_0x471870[_0xf107('0x3e')]=_[_0xf107('0x3d')](_0x11e62d['model'],qs['fields'](_0x52d7f7[_0xf107('0x3c')][_0xf107('0x3f')]));_0x471870[_0xf107('0x3e')]=_0x471870['attributes']['length']?_0x471870[_0xf107('0x3e')]:_0x11e62d['model'];if(!_0x52d7f7[_0xf107('0x3c')][_0xf107('0x40')](_0xf107('0x41'))){_0x471870[_0xf107('0x2b')]=qs[_0xf107('0x2b')](_0x52d7f7[_0xf107('0x3c')][_0xf107('0x2b')]);_0x471870[_0xf107('0x2a')]=qs['offset'](_0x52d7f7[_0xf107('0x3c')]['offset']);}_0x471870[_0xf107('0x42')]=qs[_0xf107('0x43')](_0x52d7f7[_0xf107('0x3c')]['sort']);_0x471870['where']=qs['filters'](_[_0xf107('0x44')](_0x52d7f7[_0xf107('0x3c')],_0x11e62d[_0xf107('0x45')]),_0x63a0ad);if(_0x52d7f7[_0xf107('0x3c')][_0xf107('0x46')]){_0x471870[_0xf107('0x47')]=_[_0xf107('0x48')](_0x471870['where'],{'$or':_[_0xf107('0x36')](_0x63a0ad,function(_0x3d9542){if(_0x3d9542['type']!==_0xf107('0x49')){var _0x3aeed4={};_0x3aeed4[_0x3d9542[_0xf107('0x33')]]={'$like':'%'+_0x52d7f7[_0xf107('0x3c')][_0xf107('0x46')]+'%'};return _0x3aeed4;}})});}_0x471870=_[_0xf107('0x48')]({},_0x471870,_0x52d7f7['options']);var _0x2b4dce={'where':_0x471870[_0xf107('0x47')]};return db[_0xf107('0x37')][_0xf107('0x29')](_0x2b4dce)[_0xf107('0x1b')](function(_0x963aca){_0x1e60ee[_0xf107('0x29')]=_0x963aca;if(_0x52d7f7[_0xf107('0x3c')][_0xf107('0x4a')]){_0x471870[_0xf107('0x4b')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xf107('0x4c')](_0x471870);})[_0xf107('0x1b')](function(_0x34aa5f){_0x1e60ee[_0xf107('0x4d')]=_0x34aa5f;return _0x1e60ee;})['then'](respondWithFilteredResult(_0x495251,_0x471870))[_0xf107('0x24')](handleError(_0x495251,null));};exports[_0xf107('0x4e')]=function(_0x169d67,_0x277ac1){var _0x248886={'raw':![],'where':{'id':_0x169d67[_0xf107('0x4f')]['id']}},_0x40922d={};_0x40922d['model']=_[_0xf107('0x50')](db[_0xf107('0x37')][_0xf107('0x38')]);_0x40922d[_0xf107('0x3c')]=_[_0xf107('0x50')](_0x169d67[_0xf107('0x3c')]);_0x40922d[_0xf107('0x45')]=_['intersection'](_0x40922d['model'],_0x40922d[_0xf107('0x3c')]);_0x248886['attributes']=_[_0xf107('0x3d')](_0x40922d[_0xf107('0x3b')],qs['fields'](_0x169d67[_0xf107('0x3c')][_0xf107('0x3f')]));_0x248886['attributes']=_0x248886[_0xf107('0x3e')]['length']?_0x248886[_0xf107('0x3e')]:_0x40922d['model'];if(_0x169d67[_0xf107('0x3c')][_0xf107('0x4a')]){_0x248886[_0xf107('0x4b')]=[{'all':!![]}];}_0x248886=_['merge']({},_0x248886,_0x169d67['options']);return db[_0xf107('0x37')][_0xf107('0x51')](_0x248886)['then'](handleEntityNotFound(_0x277ac1,null))[_0xf107('0x1b')](respondWithResult(_0x277ac1,null))[_0xf107('0x24')](handleError(_0x277ac1,null));};exports['create']=function(_0x4312ac,_0x46f51b){return db[_0xf107('0x37')]['create'](_0x4312ac['body'],{})[_0xf107('0x1b')](respondWithResult(_0x46f51b,0xc9))[_0xf107('0x24')](handleError(_0x46f51b,null));};exports[_0xf107('0x31')]=function(_0x267914,_0x1c2385){if(_0x267914['body']['id']){delete _0x267914[_0xf107('0x52')]['id'];}return db[_0xf107('0x37')][_0xf107('0x51')]({'where':{'id':_0x267914[_0xf107('0x4f')]['id']}})[_0xf107('0x1b')](handleEntityNotFound(_0x1c2385,null))[_0xf107('0x1b')](saveUpdates(_0x267914[_0xf107('0x52')],null))['then'](respondWithResult(_0x1c2385,null))[_0xf107('0x24')](handleError(_0x1c2385,null));};exports[_0xf107('0x32')]=function(_0x115579,_0x5243af){return db['SugarcrmAccount']['find']({'where':{'id':_0x115579[_0xf107('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5243af,null))[_0xf107('0x1b')](removeEntity(_0x5243af,null))['catch'](handleError(_0x5243af,null));};exports[_0xf107('0x53')]=function(_0x1d94fb,_0xa45cef,_0xe5c8d8){var _0x57055b={};var _0x274a9a={};var _0x1a2b9e;var _0x507199;return db[_0xf107('0x37')][_0xf107('0x54')]({'where':{'id':_0x1d94fb[_0xf107('0x4f')]['id']}})['then'](handleEntityNotFound(_0xa45cef,null))[_0xf107('0x1b')](function(_0x231604){if(_0x231604){_0x1a2b9e=_0x231604;_0x274a9a['model']=_[_0xf107('0x50')](db[_0xf107('0x55')][_0xf107('0x38')]);_0x274a9a[_0xf107('0x3c')]=_[_0xf107('0x50')](_0x1d94fb[_0xf107('0x3c')]);_0x274a9a[_0xf107('0x45')]=_[_0xf107('0x3d')](_0x274a9a[_0xf107('0x3b')],_0x274a9a[_0xf107('0x3c')]);_0x57055b[_0xf107('0x3e')]=_[_0xf107('0x3d')](_0x274a9a[_0xf107('0x3b')],qs[_0xf107('0x3f')](_0x1d94fb[_0xf107('0x3c')][_0xf107('0x3f')]));_0x57055b[_0xf107('0x3e')]=_0x57055b[_0xf107('0x3e')][_0xf107('0x56')]?_0x57055b[_0xf107('0x3e')]:_0x274a9a['model'];_0x57055b[_0xf107('0x42')]=qs[_0xf107('0x43')](_0x1d94fb[_0xf107('0x3c')]['sort']);_0x57055b[_0xf107('0x47')]=qs['filters'](_[_0xf107('0x44')](_0x1d94fb[_0xf107('0x3c')],_0x274a9a[_0xf107('0x45')]));if(_0x1d94fb[_0xf107('0x3c')]['filter']){_0x57055b['where']=_['merge'](_0x57055b[_0xf107('0x47')],{'$or':_[_0xf107('0x36')](_0x57055b['attributes'],function(_0x134842){var _0x20173c={};_0x20173c[_0x134842]={'$like':'%'+_0x1d94fb[_0xf107('0x3c')][_0xf107('0x46')]+'%'};return _0x20173c;})});}_0x57055b=_['merge']({},_0x57055b,_0x1d94fb[_0xf107('0x57')]);return _0x1a2b9e['getConfigurations'](_0x57055b);}})['then'](function(_0x38451c){if(_0x38451c){_0x507199=_0x38451c['length'];if(!_0x1d94fb[_0xf107('0x3c')]['hasOwnProperty'](_0xf107('0x41'))){_0x57055b[_0xf107('0x2b')]=qs[_0xf107('0x2b')](_0x1d94fb[_0xf107('0x3c')][_0xf107('0x2b')]);_0x57055b[_0xf107('0x2a')]=qs[_0xf107('0x2a')](_0x1d94fb[_0xf107('0x3c')][_0xf107('0x2a')]);}return _0x1a2b9e[_0xf107('0x53')](_0x57055b);}})['then'](function(_0x2cb6c3){if(_0x2cb6c3){return _0x2cb6c3?{'count':_0x507199,'rows':_0x2cb6c3}:null;}})[_0xf107('0x1b')](respondWithResult(_0xa45cef,null))[_0xf107('0x24')](handleError(_0xa45cef,null));};exports[_0xf107('0x58')]=function(_0x517af5,_0x2af8d6,_0x2821be){if(_0x517af5['body']['id']){delete _0x517af5[_0xf107('0x52')]['id'];}return db[_0xf107('0x37')][_0xf107('0x54')]({'where':{'id':_0x517af5[_0xf107('0x4f')]['id']}})[_0xf107('0x1b')](handleEntityNotFound(_0x2af8d6,null))['then'](function(_0x5386b9){if(_0x5386b9){_0x517af5['body'][_0xf107('0x59')]=_0x5386b9['id'];_0x517af5[_0xf107('0x52')][_0xf107('0x5a')]=integrations[_0xf107('0x5b')](_0x517af5[_0xf107('0x52')]['channel'],_0x517af5['body'][_0xf107('0x5c')]);_0x517af5[_0xf107('0x52')][_0xf107('0x5d')]=integrations['getDescriptions'](_0x517af5[_0xf107('0x52')][_0xf107('0x5e')],_0x517af5[_0xf107('0x52')]['type']);return db[_0xf107('0x55')][_0xf107('0x5f')](_0x517af5[_0xf107('0x52')],{'include':[{'model':db[_0xf107('0x60')],'as':_0xf107('0x5a')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0xf107('0x1b')](respondWithResult(_0x2af8d6,null))[_0xf107('0x24')](handleError(_0x2af8d6,null));};exports[_0xf107('0x61')]=function(_0x2be659,_0x97bf5,_0x431c78){var _0x1ecba4='';var _0x131447=['id',_0xf107('0x33'),_0xf107('0x62'),_0xf107('0x63'),_0xf107('0x64'),_0xf107('0x65'),_0xf107('0x66'),'duration_minutes',_0xf107('0x67'),_0xf107('0x68'),_0xf107('0x69'),_0xf107('0x6a')];return db[_0xf107('0x37')][_0xf107('0x54')]({'where':{'id':_0x2be659[_0xf107('0x4f')]['id']},'attributes':['id',_0xf107('0x6b'),_0xf107('0x6c'),_0xf107('0x6d')]})[_0xf107('0x1b')](handleEntityNotFound(_0x97bf5,null))[_0xf107('0x1b')](function(_0x561376){if(_0x561376){_0x1ecba4=_0x561376[_0xf107('0x6d')];var _0x3b3013=_0x1ecba4[_0xf107('0x6e')](-0x1);if(_0x3b3013==='/'){_0x1ecba4=_0x1ecba4[_0xf107('0x6f')](0x0,_0x1ecba4['lastIndexOf'](_0x3b3013));}return rp({'method':_0xf107('0x70'),'uri':util[_0xf107('0x71')](_0xf107('0x72'),_0x1ecba4,_0xf107('0x73')),'json':!![],'form':{'method':_0xf107('0x74'),'input_type':_0xf107('0x75'),'response_type':_0xf107('0x75'),'rest_data':JSON[_0xf107('0x1f')]({'user_auth':{'user_name':_0x561376[_0xf107('0x6b')],'password':_0x561376[_0xf107('0x6c')],'encryption':_0xf107('0x76')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xf107('0x1b')](function(_0x245804){if(_0x245804&&_0x245804[_0xf107('0x33')]!==_0xf107('0x77')&&_0x245804[_0xf107('0x33')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0xf107('0x71')](_0xf107('0x72'),_0x1ecba4,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xf107('0x78'),'input_type':_0xf107('0x75'),'response_type':_0xf107('0x75'),'rest_data':JSON[_0xf107('0x1f')]({'session':_0x245804['id'],'module_name':_0xf107('0x79')})}})['then'](function(_0x4df847){if(_0x4df847){var _0x41b0ae=_[_0xf107('0x7a')](_0x4df847[_0xf107('0x7b')]);_['remove'](_0x41b0ae,function(_0x17eddc){return _0x131447[_0xf107('0x7c')](_0x17eddc[_0xf107('0x33')]);});return{'count':_0x41b0ae[_0xf107('0x56')],'rows':_['map'](_0x41b0ae,function(_0x1d84a6){return{'id':_0x1d84a6[_0xf107('0x33')],'name':_0x1d84a6[_0xf107('0x7d')],'custom':_['endsWith'](_0x1d84a6[_0xf107('0x33')],'_c')?!![]:![],'options':_0x1d84a6[_0xf107('0x57')]?_[_0xf107('0x36')](_[_0xf107('0x7a')](_0x1d84a6[_0xf107('0x57')]),function(_0x41ebd7){return{'name':_0x41ebd7[_0xf107('0x7e')],'value':_0x41ebd7[_0xf107('0x33')]};}):[]};})};}})['then'](respondWithResult(_0x97bf5,null))[_0xf107('0x24')](function(_0x59db20){var _0x3a93e7=_0x2be659[_0xf107('0x3c')][_0xf107('0x7f')]?0x1f4:_0x59db20['statusCode']||0x1f4;logger[_0xf107('0x20')](_0xf107('0x80'),_0xf107('0x61'),_0x3a93e7,JSON[_0xf107('0x1f')](_0x59db20));delete _0x59db20[_0xf107('0x33')];if(_0x3a93e7===0x191){_0x3a93e7=0x190;}_0x97bf5[_0xf107('0x27')](_0x3a93e7)[_0xf107('0x34')](_0x2be659[_0xf107('0x3c')][_0xf107('0x7f')]?{'message':_0xf107('0x81'),'statusCode':_0x59db20[_0xf107('0x82')]}:_0x59db20);});}else{var _0x229c29=0x1f4;_0x97bf5[_0xf107('0x27')](_0x229c29)[_0xf107('0x34')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 782bd96..80d3872 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 _0x5246=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x333b8c,_0x8c792d){var _0x3af725=function(_0x3ca04f){while(--_0x3ca04f){_0x333b8c['push'](_0x333b8c['shift']());}};_0x3af725(++_0x8c792d);}(_0x5246,0x1e7));var _0x6524=function(_0x3e42d3,_0x50c274){_0x3e42d3=_0x3e42d3-0x0;var _0x39a80d=_0x5246[_0x3e42d3];return _0x39a80d;};'use strict';var _=require('lodash');var util=require(_0x6524('0x0'));var logger=require(_0x6524('0x1'))('api');var moment=require(_0x6524('0x2'));var BPromise=require(_0x6524('0x3'));var rp=require(_0x6524('0x4'));var fs=require('fs');var path=require(_0x6524('0x5'));var rimraf=require(_0x6524('0x6'));var config=require('../../config/environment');var attributes=require(_0x6524('0x7'));var integrations=require(_0x6524('0x8'));module[_0x6524('0x9')]=function(_0x428d6b,_0x3a6324){return _0x428d6b[_0x6524('0xa')](_0x6524('0xb'),attributes,{'tableName':_0x6524('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef24=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x34d343,_0x1f5141){var _0x4f1e20=function(_0x35b8eb){while(--_0x35b8eb){_0x34d343['push'](_0x34d343['shift']());}};_0x4f1e20(++_0x1f5141);}(_0xef24,0xf0));var _0x4ef2=function(_0x12de32,_0x4ac828){_0x12de32=_0x12de32-0x0;var _0x3383f1=_0xef24[_0x12de32];return _0x3383f1;};'use strict';var _=require(_0x4ef2('0x0'));var util=require(_0x4ef2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4ef2('0x2'));var BPromise=require(_0x4ef2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ef2('0x4'));var rimraf=require(_0x4ef2('0x5'));var config=require(_0x4ef2('0x6'));var attributes=require(_0x4ef2('0x7'));var integrations=require(_0x4ef2('0x8'));module[_0x4ef2('0x9')]=function(_0x529152,_0x249892){return _0x529152[_0x4ef2('0xa')](_0x4ef2('0xb'),attributes,{'tableName':_0x4ef2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 77f39c6..0c1ad84 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 _0x35ab=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','attributes','model','info','debug','ShowSugarcrmAccount','find','then'];(function(_0x26b35d,_0x5036ab){var _0x549d4d=function(_0x467d2e){while(--_0x467d2e){_0x26b35d['push'](_0x26b35d['shift']());}};_0x549d4d(++_0x5036ab);}(_0x35ab,0x168));var _0xb35a=function(_0x44c583,_0xdc4d48){_0x44c583=_0x44c583-0x0;var _0x396a41=_0x35ab[_0x44c583];return _0x396a41;};'use strict';var _=require('lodash');var util=require(_0xb35a('0x0'));var moment=require('moment');var BPromise=require(_0xb35a('0x1'));var rs=require(_0xb35a('0x2'));var fs=require('fs');var Redis=require(_0xb35a('0x3'));var db=require(_0xb35a('0x4'))['db'];var utils=require(_0xb35a('0x5'));var logger=require(_0xb35a('0x6'))(_0xb35a('0x7'));var config=require('../../config/environment');var jayson=require(_0xb35a('0x8'));var client=jayson[_0xb35a('0x9')][_0xb35a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58441d,_0x18970b,_0x5fb009){return new BPromise(function(_0x57f55a,_0x1547f3){return client[_0xb35a('0xb')](_0x58441d,_0x5fb009)['then'](function(_0x277903){logger['info'](_0xb35a('0xc'),_0x18970b,'request\x20sent');logger['debug'](_0xb35a('0xd'),_0x18970b,'request\x20sent',JSON[_0xb35a('0xe')](_0x277903));if(_0x277903['error']){if(_0x277903[_0xb35a('0xf')]['code']===0x1f4){logger[_0xb35a('0xf')](_0xb35a('0xc'),_0x18970b,_0x277903[_0xb35a('0xf')][_0xb35a('0x10')]);return _0x1547f3(_0x277903['error'][_0xb35a('0x10')]);}logger[_0xb35a('0xf')](_0xb35a('0xc'),_0x18970b,_0x277903[_0xb35a('0xf')][_0xb35a('0x10')]);return _0x57f55a(_0x277903[_0xb35a('0xf')]['message']);}else{logger['info'](_0xb35a('0xc'),_0x18970b,_0xb35a('0x11'));_0x57f55a(_0x277903[_0xb35a('0x12')][_0xb35a('0x10')]);}})[_0xb35a('0x13')](function(_0x3dafcb){logger[_0xb35a('0xf')](_0xb35a('0xc'),_0x18970b,_0x3dafcb);_0x1547f3(_0x3dafcb);});});}exports[_0xb35a('0x14')]=function(_0x32a2b0){var _0x45b6ba=this;return new Promise(function(_0x51c1fd,_0x2b0ec8){return db[_0xb35a('0x15')][_0xb35a('0x16')]({'raw':_0x32a2b0[_0xb35a('0x17')]?_0x32a2b0[_0xb35a('0x17')][_0xb35a('0x18')]===undefined?!![]:![]:!![],'where':_0x32a2b0[_0xb35a('0x17')]?_0x32a2b0[_0xb35a('0x17')][_0xb35a('0x19')]||null:null,'attributes':_0x32a2b0[_0xb35a('0x17')]?_0x32a2b0['options']['attributes']||null:null,'limit':_0x32a2b0[_0xb35a('0x17')]?_0x32a2b0[_0xb35a('0x17')][_0xb35a('0x1a')]||null:null,'include':_0x32a2b0['options']?_0x32a2b0[_0xb35a('0x17')][_0xb35a('0x1b')]?_[_0xb35a('0x1c')](_0x32a2b0['options'][_0xb35a('0x1b')],function(_0x583432){return{'model':db[_0x583432['model']],'as':_0x583432['as'],'attributes':_0x583432[_0xb35a('0x1d')],'include':_0x583432[_0xb35a('0x1b')]?_[_0xb35a('0x1c')](_0x583432['include'],function(_0x4b1223){return{'model':db[_0x4b1223[_0xb35a('0x1e')]],'as':_0x4b1223['as'],'attributes':_0x4b1223['attributes'],'include':_0x4b1223[_0xb35a('0x1b')]?_[_0xb35a('0x1c')](_0x4b1223[_0xb35a('0x1b')],function(_0x46775d){return{'model':db[_0x46775d[_0xb35a('0x1e')]],'as':_0x46775d['as'],'attributes':_0x46775d[_0xb35a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34b87b){logger[_0xb35a('0x1f')](_0xb35a('0x14'),_0x32a2b0);logger[_0xb35a('0x20')]('GetSugarcrmAccount',_0x32a2b0,JSON[_0xb35a('0xe')](_0x34b87b));_0x51c1fd(_0x34b87b);})[_0xb35a('0x13')](function(_0x55583b){logger[_0xb35a('0xf')](_0xb35a('0x14'),_0x55583b[_0xb35a('0x10')],_0x32a2b0);_0x2b0ec8(_0x45b6ba['error'](0x1f4,_0x55583b['message']));});});};exports[_0xb35a('0x21')]=function(_0x4f9813){var _0x29af43=this;return new Promise(function(_0x1cf817,_0x3bf20c){return db[_0xb35a('0x15')][_0xb35a('0x22')]({'raw':_0x4f9813[_0xb35a('0x17')]?_0x4f9813['options'][_0xb35a('0x18')]===undefined?!![]:![]:!![],'where':_0x4f9813[_0xb35a('0x17')]?_0x4f9813[_0xb35a('0x17')][_0xb35a('0x19')]||null:null,'attributes':_0x4f9813[_0xb35a('0x17')]?_0x4f9813[_0xb35a('0x17')][_0xb35a('0x1d')]||null:null,'include':_0x4f9813[_0xb35a('0x17')]?_0x4f9813['options'][_0xb35a('0x1b')]?_['map'](_0x4f9813[_0xb35a('0x17')]['include'],function(_0x11f417){return{'model':db[_0x11f417[_0xb35a('0x1e')]],'as':_0x11f417['as'],'attributes':_0x11f417[_0xb35a('0x1d')],'include':_0x11f417['include']?_['map'](_0x11f417[_0xb35a('0x1b')],function(_0x7053fb){return{'model':db[_0x7053fb[_0xb35a('0x1e')]],'as':_0x7053fb['as'],'attributes':_0x7053fb[_0xb35a('0x1d')],'include':_0x7053fb[_0xb35a('0x1b')]?_['map'](_0x7053fb[_0xb35a('0x1b')],function(_0x182640){return{'model':db[_0x182640[_0xb35a('0x1e')]],'as':_0x182640['as'],'attributes':_0x182640[_0xb35a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb35a('0x23')](function(_0x72eb6b){logger['info'](_0xb35a('0x21'),_0x4f9813);logger[_0xb35a('0x20')](_0xb35a('0x21'),_0x4f9813,JSON[_0xb35a('0xe')](_0x72eb6b));_0x1cf817(_0x72eb6b);})[_0xb35a('0x13')](function(_0x4cbbe9){logger[_0xb35a('0xf')](_0xb35a('0x21'),_0x4cbbe9['message'],_0x4f9813);_0x3bf20c(_0x29af43['error'](0x1f4,_0x4cbbe9[_0xb35a('0x10')]));});});}; \ No newline at end of file +var _0x7f3e=['where','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','attributes','limit','include','map','model','ShowSugarcrmAccount','raw'];(function(_0x59935e,_0x1ab542){var _0x50832c=function(_0x49594b){while(--_0x49594b){_0x59935e['push'](_0x59935e['shift']());}};_0x50832c(++_0x1ab542);}(_0x7f3e,0xa6));var _0xe7f3=function(_0x3a9940,_0x1de435){_0x3a9940=_0x3a9940-0x0;var _0x28aba5=_0x7f3e[_0x3a9940];return _0x28aba5;};'use strict';var _=require('lodash');var util=require(_0xe7f3('0x0'));var moment=require('moment');var BPromise=require(_0xe7f3('0x1'));var rs=require(_0xe7f3('0x2'));var fs=require('fs');var Redis=require(_0xe7f3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7f3('0x4'));var logger=require('../../config/logger')(_0xe7f3('0x5'));var config=require('../../config/environment');var jayson=require(_0xe7f3('0x6'));var client=jayson[_0xe7f3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ac3ec,_0x5f2643,_0x5820dc){return new BPromise(function(_0x45bdca,_0xe43616){return client[_0xe7f3('0x8')](_0x2ac3ec,_0x5820dc)[_0xe7f3('0x9')](function(_0xda1331){logger[_0xe7f3('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x5f2643,_0xe7f3('0xb'));logger[_0xe7f3('0xc')](_0xe7f3('0xd'),_0x5f2643,_0xe7f3('0xb'),JSON[_0xe7f3('0xe')](_0xda1331));if(_0xda1331['error']){if(_0xda1331[_0xe7f3('0xf')][_0xe7f3('0x10')]===0x1f4){logger['error'](_0xe7f3('0x11'),_0x5f2643,_0xda1331[_0xe7f3('0xf')][_0xe7f3('0x12')]);return _0xe43616(_0xda1331['error'][_0xe7f3('0x12')]);}logger[_0xe7f3('0xf')](_0xe7f3('0x11'),_0x5f2643,_0xda1331[_0xe7f3('0xf')][_0xe7f3('0x12')]);return _0x45bdca(_0xda1331['error'][_0xe7f3('0x12')]);}else{logger[_0xe7f3('0xa')](_0xe7f3('0x11'),_0x5f2643,_0xe7f3('0xb'));_0x45bdca(_0xda1331[_0xe7f3('0x13')][_0xe7f3('0x12')]);}})[_0xe7f3('0x14')](function(_0x5b67d8){logger[_0xe7f3('0xf')](_0xe7f3('0x11'),_0x5f2643,_0x5b67d8);_0xe43616(_0x5b67d8);});});}exports[_0xe7f3('0x15')]=function(_0x3082f7){var _0x2abade=this;return new Promise(function(_0x25c6c2,_0x3cbd81){return db[_0xe7f3('0x16')][_0xe7f3('0x17')]({'raw':_0x3082f7[_0xe7f3('0x18')]?_0x3082f7['options']['raw']===undefined?!![]:![]:!![],'where':_0x3082f7['options']?_0x3082f7[_0xe7f3('0x18')]['where']||null:null,'attributes':_0x3082f7[_0xe7f3('0x18')]?_0x3082f7[_0xe7f3('0x18')][_0xe7f3('0x19')]||null:null,'limit':_0x3082f7[_0xe7f3('0x18')]?_0x3082f7['options'][_0xe7f3('0x1a')]||null:null,'include':_0x3082f7[_0xe7f3('0x18')]?_0x3082f7['options'][_0xe7f3('0x1b')]?_[_0xe7f3('0x1c')](_0x3082f7['options'][_0xe7f3('0x1b')],function(_0x1c4c81){return{'model':db[_0x1c4c81[_0xe7f3('0x1d')]],'as':_0x1c4c81['as'],'attributes':_0x1c4c81[_0xe7f3('0x19')],'include':_0x1c4c81['include']?_[_0xe7f3('0x1c')](_0x1c4c81[_0xe7f3('0x1b')],function(_0x3f7101){return{'model':db[_0x3f7101[_0xe7f3('0x1d')]],'as':_0x3f7101['as'],'attributes':_0x3f7101['attributes'],'include':_0x3f7101[_0xe7f3('0x1b')]?_[_0xe7f3('0x1c')](_0x3f7101[_0xe7f3('0x1b')],function(_0x50faa3){return{'model':db[_0x50faa3['model']],'as':_0x50faa3['as'],'attributes':_0x50faa3[_0xe7f3('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ead42){logger[_0xe7f3('0xa')](_0xe7f3('0x15'),_0x3082f7);logger[_0xe7f3('0xc')](_0xe7f3('0x15'),_0x3082f7,JSON['stringify'](_0x2ead42));_0x25c6c2(_0x2ead42);})[_0xe7f3('0x14')](function(_0x58e3e5){logger[_0xe7f3('0xf')](_0xe7f3('0x15'),_0x58e3e5[_0xe7f3('0x12')],_0x3082f7);_0x3cbd81(_0x2abade[_0xe7f3('0xf')](0x1f4,_0x58e3e5[_0xe7f3('0x12')]));});});};exports[_0xe7f3('0x1e')]=function(_0x12c8a0){var _0x59af39=this;return new Promise(function(_0x48e0a1,_0x58ca18){return db['SugarcrmAccount']['find']({'raw':_0x12c8a0[_0xe7f3('0x18')]?_0x12c8a0['options'][_0xe7f3('0x1f')]===undefined?!![]:![]:!![],'where':_0x12c8a0[_0xe7f3('0x18')]?_0x12c8a0['options'][_0xe7f3('0x20')]||null:null,'attributes':_0x12c8a0[_0xe7f3('0x18')]?_0x12c8a0[_0xe7f3('0x18')][_0xe7f3('0x19')]||null:null,'include':_0x12c8a0[_0xe7f3('0x18')]?_0x12c8a0['options'][_0xe7f3('0x1b')]?_[_0xe7f3('0x1c')](_0x12c8a0[_0xe7f3('0x18')]['include'],function(_0x776a8){return{'model':db[_0x776a8['model']],'as':_0x776a8['as'],'attributes':_0x776a8[_0xe7f3('0x19')],'include':_0x776a8[_0xe7f3('0x1b')]?_[_0xe7f3('0x1c')](_0x776a8[_0xe7f3('0x1b')],function(_0x4984f4){return{'model':db[_0x4984f4['model']],'as':_0x4984f4['as'],'attributes':_0x4984f4[_0xe7f3('0x19')],'include':_0x4984f4['include']?_[_0xe7f3('0x1c')](_0x4984f4['include'],function(_0x171aa5){return{'model':db[_0x171aa5[_0xe7f3('0x1d')]],'as':_0x171aa5['as'],'attributes':_0x171aa5['attributes']};}):[]};}):[]};}):[]:[]})[_0xe7f3('0x9')](function(_0x313a6c){logger[_0xe7f3('0xa')]('ShowSugarcrmAccount',_0x12c8a0);logger['debug'](_0xe7f3('0x1e'),_0x12c8a0,JSON['stringify'](_0x313a6c));_0x48e0a1(_0x313a6c);})[_0xe7f3('0x14')](function(_0x1edc5f){logger[_0xe7f3('0xf')](_0xe7f3('0x1e'),_0x1edc5f['message'],_0x12c8a0);_0x58ca18(_0x59af39[_0xe7f3('0xf')](0x1f4,_0x1edc5f[_0xe7f3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 76c055d..29c1d16 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 _0xda6b=['./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x33e4f7,_0x3c8f5d){var _0x379b29=function(_0x575f4e){while(--_0x575f4e){_0x33e4f7['push'](_0x33e4f7['shift']());}};_0x379b29(++_0x3c8f5d);}(_0xda6b,0x19c));var _0xbda6=function(_0x2527dc,_0x46e645){_0x2527dc=_0x2527dc-0x0;var _0x11eb55=_0xda6b[_0x2527dc];return _0x11eb55;};'use strict';var multer=require(_0xbda6('0x0'));var util=require('util');var path=require(_0xbda6('0x1'));var timeout=require(_0xbda6('0x2'));var express=require(_0xbda6('0x3'));var router=express[_0xbda6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbda6('0x5'));var config=require('../../config/environment');var controller=require(_0xbda6('0x6'));router[_0xbda6('0x7')]('/',auth[_0xbda6('0x8')](),controller[_0xbda6('0x9')]);router['get'](_0xbda6('0xa'),auth[_0xbda6('0x8')](),controller[_0xbda6('0xb')]);router[_0xbda6('0x7')](_0xbda6('0xc'),auth[_0xbda6('0x8')](),controller[_0xbda6('0xd')]);router[_0xbda6('0x7')]('/:id/subjects',auth[_0xbda6('0x8')](),controller[_0xbda6('0xe')]);router[_0xbda6('0x7')](_0xbda6('0xf'),auth[_0xbda6('0x8')](),controller[_0xbda6('0x10')]);router[_0xbda6('0x11')]('/',auth[_0xbda6('0x8')](),controller[_0xbda6('0x12')]);router[_0xbda6('0x13')](_0xbda6('0xa'),auth[_0xbda6('0x8')](),controller['update']);router['delete'](_0xbda6('0xa'),auth['isAuthenticated'](),controller[_0xbda6('0x14')]);module[_0xbda6('0x15')]=router; \ No newline at end of file +var _0xdcf1=['put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create'];(function(_0x2f5369,_0x2e891a){var _0x30bc32=function(_0x58f9ec){while(--_0x58f9ec){_0x2f5369['push'](_0x2f5369['shift']());}};_0x30bc32(++_0x2e891a);}(_0xdcf1,0x1e7));var _0x1dcf=function(_0x47199b,_0x16e824){_0x47199b=_0x47199b-0x0;var _0x390911=_0xdcf1[_0x47199b];return _0x390911;};'use strict';var multer=require(_0x1dcf('0x0'));var util=require('util');var path=require(_0x1dcf('0x1'));var timeout=require(_0x1dcf('0x2'));var express=require(_0x1dcf('0x3'));var router=express[_0x1dcf('0x4')]();var auth=require(_0x1dcf('0x5'));var interaction=require(_0x1dcf('0x6'));var config=require(_0x1dcf('0x7'));var controller=require(_0x1dcf('0x8'));router[_0x1dcf('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1dcf('0x9')](_0x1dcf('0xa'),auth[_0x1dcf('0xb')](),controller[_0x1dcf('0xc')]);router[_0x1dcf('0x9')]('/:id/fields',auth[_0x1dcf('0xb')](),controller[_0x1dcf('0xd')]);router['get'](_0x1dcf('0xe'),auth['isAuthenticated'](),controller[_0x1dcf('0xf')]);router[_0x1dcf('0x9')](_0x1dcf('0x10'),auth[_0x1dcf('0xb')](),controller['getDescriptions']);router[_0x1dcf('0x11')]('/',auth[_0x1dcf('0xb')](),controller[_0x1dcf('0x12')]);router[_0x1dcf('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1dcf('0x14')](_0x1dcf('0xa'),auth['isAuthenticated'](),controller[_0x1dcf('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index be3831d..f3fd813 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 _0xc1bc=['exports','STRING'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0xc1bc,0x11e));var _0xcc1b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1bc[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xcc1b('0x0')]={'name':{'type':Sequelize[_0xcc1b('0x1')]},'description':{'type':Sequelize[_0xcc1b('0x1')]}}; \ No newline at end of file +var _0x062e=['STRING','sequelize','exports'];(function(_0x2d7712,_0x39aba4){var _0x2efa08=function(_0xfbe847){while(--_0xfbe847){_0x2d7712['push'](_0x2d7712['shift']());}};_0x2efa08(++_0x39aba4);}(_0x062e,0x190));var _0xe062=function(_0x380ace,_0x1fd747){_0x380ace=_0x380ace-0x0;var _0x1aff9b=_0x062e[_0x380ace];return _0x1aff9b;};'use strict';var Sequelize=require(_0xe062('0x0'));module[_0xe062('0x1')]={'name':{'type':Sequelize[_0xe062('0x2')]},'description':{'type':Sequelize[_0xe062('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 2cb9671..2e3953d 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 _0x751a=['../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','SugarcrmConfiguration','rawAttributes','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','getFields','SugarcrmField','order','pick','getSubjects','findOne','getDescriptions','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x216008,_0x2d1023){var _0x4d384f=function(_0x3fd7e2){while(--_0x3fd7e2){_0x216008['push'](_0x216008['shift']());}};_0x4d384f(++_0x2d1023);}(_0x751a,0x9e));var _0xa751=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x751a[_0x506d83];return _0x335e8b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa751('0x0'));var rimraf=require(_0xa751('0x1'));var zipdir=require(_0xa751('0x2'));var jsonpatch=require(_0xa751('0x3'));var rp=require(_0xa751('0x4'));var moment=require(_0xa751('0x5'));var BPromise=require(_0xa751('0x6'));var Mustache=require(_0xa751('0x7'));var util=require(_0xa751('0x8'));var path=require(_0xa751('0x9'));var sox=require(_0xa751('0xa'));var csv=require(_0xa751('0xb'));var ejs=require(_0xa751('0xc'));var fs=require('fs');var _=require(_0xa751('0xd'));var squel=require(_0xa751('0xe'));var crypto=require(_0xa751('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa751('0x10'));var toCsv=require(_0xa751('0xb'));var querystring=require(_0xa751('0x11'));var Papa=require(_0xa751('0x12'));var Redis=require(_0xa751('0x13'));var authService=require(_0xa751('0x14'));var qs=require(_0xa751('0x15'));var as=require(_0xa751('0x16'));var hardwareService=require(_0xa751('0x17'));var logger=require(_0xa751('0x18'))('api');var utils=require(_0xa751('0x19'));var config=require(_0xa751('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xa751('0x1b')][_0xa751('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x8a9a5d,_0x2ee81c,_0xead4b8,_0x34e33f){return new BPromise(function(_0x7d708c,_0x1c03bb){var _0x316550=_0x34e33f||client;return _0x316550[_0xa751('0x1d')](_0x8a9a5d,_0xead4b8)[_0xa751('0x1e')](function(_0x5c48d2){logger[_0xa751('0x1f')](_0xa751('0x20'),_0x2ee81c,_0xa751('0x21'));logger[_0xa751('0x22')](_0xa751('0x23'),_0x2ee81c,_0xa751('0x21'),JSON['stringify'](_0x5c48d2));if(_0x5c48d2[_0xa751('0x24')]){if(_0x5c48d2['error'][_0xa751('0x25')]===0x1f4){logger['error'](_0xa751('0x20'),_0x2ee81c,_0x5c48d2[_0xa751('0x24')]['message']);return _0x1c03bb(_0x5c48d2[_0xa751('0x24')]['message']);}logger[_0xa751('0x24')](_0xa751('0x20'),_0x2ee81c,_0x5c48d2['error']['message']);return _0x7d708c(_0x5c48d2[_0xa751('0x24')]['message']);}else{logger[_0xa751('0x1f')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ee81c,'request\x20sent');_0x7d708c(_0x5c48d2['result']['message']);}})[_0xa751('0x26')](function(_0x3a83f0){logger['error'](_0xa751('0x20'),_0x2ee81c,_0x3a83f0);_0x1c03bb(_0x3a83f0);});});}function respondWithStatusCode(_0x44bd62,_0x24ac0b){_0x24ac0b=_0x24ac0b||0xcc;return function(_0x4ad61f){if(_0x4ad61f){return _0x44bd62[_0xa751('0x27')](_0x24ac0b);}return _0x44bd62[_0xa751('0x28')](_0x24ac0b)[_0xa751('0x29')]();};}function respondWithResult(_0x15a214,_0x4ead8e){_0x4ead8e=_0x4ead8e||0xc8;return function(_0x5eab1e){if(_0x5eab1e){return _0x15a214[_0xa751('0x28')](_0x4ead8e)[_0xa751('0x2a')](_0x5eab1e);}};}function respondWithFilteredResult(_0x1a6f9c,_0x219ae5){return function(_0x490a74){if(_0x490a74){var _0x40529a=_0x490a74[_0xa751('0x2b')],_0x356616=_0x219ae5[_0xa751('0x2c')],_0x499212=_0x219ae5[_0xa751('0x2c')]+_0x219ae5[_0xa751('0x2d')],_0x2947aa;if(_0x499212>=_0x40529a){_0x499212=_0x40529a;_0x2947aa=0xc8;}else{_0x2947aa=0xce;}_0x1a6f9c[_0xa751('0x28')](_0x2947aa);return _0x1a6f9c[_0xa751('0x2e')](_0xa751('0x2f'),_0x356616+'-'+_0x499212+'/'+_0x40529a)['json'](_0x490a74);}return null;};}function patchUpdates(_0x539e97){return function(_0x28d901){try{jsonpatch[_0xa751('0x30')](_0x28d901,_0x539e97,!![]);}catch(_0x102393){return BPromise[_0xa751('0x31')](_0x102393);}return _0x28d901['save']();};}function saveUpdates(_0x53b252,_0x27cfa7){return function(_0x47152a){if(_0x47152a){return _0x47152a[_0xa751('0x32')](_0x53b252)[_0xa751('0x1e')](function(_0x34c81e){return _0x34c81e;});}return null;};}function removeEntity(_0x5912ec,_0x602429){return function(_0x598aed){if(_0x598aed){return _0x598aed[_0xa751('0x33')]()[_0xa751('0x1e')](function(){_0x5912ec[_0xa751('0x28')](0xcc)[_0xa751('0x29')]();});}};}function handleEntityNotFound(_0xe65ec4,_0x4b31b1){return function(_0x3a16f9){if(!_0x3a16f9){_0xe65ec4['sendStatus'](0x194);}return _0x3a16f9;};}function handleError(_0x311ba4,_0x5715d5){_0x5715d5=_0x5715d5||0x1f4;return function(_0x1123f0){logger['error'](_0x1123f0[_0xa751('0x34')]);if(_0x1123f0['name']){delete _0x1123f0[_0xa751('0x35')];}_0x311ba4[_0xa751('0x28')](_0x5715d5)[_0xa751('0x36')](_0x1123f0);};}exports[_0xa751('0x37')]=function(_0x454134,_0x1ce273){var _0x564b5b={},_0x45e875={},_0x14d531={'count':0x0,'rows':[]};var _0x38414d=_['map'](db[_0xa751('0x38')][_0xa751('0x39')],function(_0x2ba9ef){return{'name':_0x2ba9ef['fieldName'],'type':_0x2ba9ef[_0xa751('0x3a')]['key']};});_0x45e875[_0xa751('0x3b')]=_[_0xa751('0x3c')](_0x38414d,_0xa751('0x35'));_0x45e875[_0xa751('0x3d')]=_[_0xa751('0x3e')](_0x454134[_0xa751('0x3d')]);_0x45e875['filters']=_[_0xa751('0x3f')](_0x45e875[_0xa751('0x3b')],_0x45e875[_0xa751('0x3d')]);_0x564b5b[_0xa751('0x40')]=_['intersection'](_0x45e875[_0xa751('0x3b')],qs[_0xa751('0x41')](_0x454134[_0xa751('0x3d')]['fields']));_0x564b5b[_0xa751('0x40')]=_0x564b5b[_0xa751('0x40')][_0xa751('0x42')]?_0x564b5b[_0xa751('0x40')]:_0x45e875[_0xa751('0x3b')];if(!_0x454134[_0xa751('0x3d')][_0xa751('0x43')](_0xa751('0x44'))){_0x564b5b[_0xa751('0x2d')]=qs['limit'](_0x454134[_0xa751('0x3d')][_0xa751('0x2d')]);_0x564b5b[_0xa751('0x2c')]=qs[_0xa751('0x2c')](_0x454134[_0xa751('0x3d')][_0xa751('0x2c')]);}_0x564b5b['order']=qs[_0xa751('0x45')](_0x454134[_0xa751('0x3d')][_0xa751('0x45')]);_0x564b5b['where']=qs[_0xa751('0x46')](_['pick'](_0x454134['query'],_0x45e875[_0xa751('0x46')]),_0x38414d);if(_0x454134[_0xa751('0x3d')][_0xa751('0x47')]){_0x564b5b[_0xa751('0x48')]=_[_0xa751('0x49')](_0x564b5b[_0xa751('0x48')],{'$or':_[_0xa751('0x3c')](_0x38414d,function(_0x3dec0f){if(_0x3dec0f[_0xa751('0x3a')]!==_0xa751('0x4a')){var _0x1054eb={};_0x1054eb[_0x3dec0f[_0xa751('0x35')]]={'$like':'%'+_0x454134['query'][_0xa751('0x47')]+'%'};return _0x1054eb;}})});}_0x564b5b=_[_0xa751('0x49')]({},_0x564b5b,_0x454134[_0xa751('0x4b')]);var _0x11ea6d={'where':_0x564b5b[_0xa751('0x48')]};return db[_0xa751('0x38')]['count'](_0x11ea6d)[_0xa751('0x1e')](function(_0x3bdced){_0x14d531[_0xa751('0x2b')]=_0x3bdced;if(_0x454134[_0xa751('0x3d')]['includeAll']){_0x564b5b[_0xa751('0x4c')]=[{'all':!![]}];}return db[_0xa751('0x38')][_0xa751('0x4d')](_0x564b5b);})[_0xa751('0x1e')](function(_0x3dc88d){_0x14d531[_0xa751('0x4e')]=_0x3dc88d;return _0x14d531;})[_0xa751('0x1e')](respondWithFilteredResult(_0x1ce273,_0x564b5b))[_0xa751('0x26')](handleError(_0x1ce273,null));};exports[_0xa751('0x4f')]=function(_0x3fbdaf,_0x307b34){var _0x4b15f5={'raw':![],'where':{'id':_0x3fbdaf[_0xa751('0x50')]['id']}},_0x18ff80={};_0x18ff80[_0xa751('0x3b')]=_[_0xa751('0x3e')](db[_0xa751('0x38')][_0xa751('0x39')]);_0x18ff80[_0xa751('0x3d')]=_[_0xa751('0x3e')](_0x3fbdaf[_0xa751('0x3d')]);_0x18ff80['filters']=_[_0xa751('0x3f')](_0x18ff80[_0xa751('0x3b')],_0x18ff80['query']);_0x4b15f5[_0xa751('0x40')]=_[_0xa751('0x3f')](_0x18ff80['model'],qs[_0xa751('0x41')](_0x3fbdaf['query'][_0xa751('0x41')]));_0x4b15f5[_0xa751('0x40')]=_0x4b15f5['attributes'][_0xa751('0x42')]?_0x4b15f5['attributes']:_0x18ff80[_0xa751('0x3b')];if(_0x3fbdaf[_0xa751('0x3d')][_0xa751('0x51')]){_0x4b15f5['include']=[{'all':!![]}];}_0x4b15f5=_[_0xa751('0x49')]({},_0x4b15f5,_0x3fbdaf['options']);return db['SugarcrmConfiguration'][_0xa751('0x52')](_0x4b15f5)['then'](handleEntityNotFound(_0x307b34,null))[_0xa751('0x1e')](respondWithResult(_0x307b34,null))[_0xa751('0x26')](handleError(_0x307b34,null));};exports[_0xa751('0x53')]=function(_0x28e01f,_0x1b7428){return db['SugarcrmConfiguration'][_0xa751('0x53')](_0x28e01f['body'],{})['then'](respondWithResult(_0x1b7428,0xc9))[_0xa751('0x26')](handleError(_0x1b7428,null));};exports['update']=function(_0x18279a,_0x319f6a){if(_0x18279a['body']['id']){delete _0x18279a[_0xa751('0x54')]['id'];}return db[_0xa751('0x38')][_0xa751('0x52')]({'where':{'id':_0x18279a[_0xa751('0x50')]['id']}})[_0xa751('0x1e')](handleEntityNotFound(_0x319f6a,null))[_0xa751('0x1e')](saveUpdates(_0x18279a[_0xa751('0x54')],null))[_0xa751('0x1e')](respondWithResult(_0x319f6a,null))[_0xa751('0x26')](handleError(_0x319f6a,null));};exports[_0xa751('0x33')]=function(_0x3de20d,_0x2bda29){return db['SugarcrmConfiguration'][_0xa751('0x52')]({'where':{'id':_0x3de20d[_0xa751('0x50')]['id']}})[_0xa751('0x1e')](handleEntityNotFound(_0x2bda29,null))[_0xa751('0x1e')](removeEntity(_0x2bda29,null))[_0xa751('0x26')](handleError(_0x2bda29,null));};exports[_0xa751('0x55')]=function(_0x455294,_0x3ea84a,_0x5ae5d5){var _0xf315c4={};var _0x15505b={};var _0x479b24;var _0x1accca;return db[_0xa751('0x38')]['findOne']({'where':{'id':_0x455294[_0xa751('0x50')]['id']}})['then'](handleEntityNotFound(_0x3ea84a,null))[_0xa751('0x1e')](function(_0xf184f9){if(_0xf184f9){_0x479b24=_0xf184f9;_0x15505b['model']=_[_0xa751('0x3e')](db[_0xa751('0x56')][_0xa751('0x39')]);_0x15505b[_0xa751('0x3d')]=_[_0xa751('0x3e')](_0x455294[_0xa751('0x3d')]);_0x15505b[_0xa751('0x46')]=_[_0xa751('0x3f')](_0x15505b['model'],_0x15505b[_0xa751('0x3d')]);_0xf315c4[_0xa751('0x40')]=_[_0xa751('0x3f')](_0x15505b[_0xa751('0x3b')],qs[_0xa751('0x41')](_0x455294[_0xa751('0x3d')][_0xa751('0x41')]));_0xf315c4['attributes']=_0xf315c4['attributes'][_0xa751('0x42')]?_0xf315c4[_0xa751('0x40')]:_0x15505b[_0xa751('0x3b')];_0xf315c4[_0xa751('0x57')]=qs[_0xa751('0x45')](_0x455294[_0xa751('0x3d')][_0xa751('0x45')]);_0xf315c4['where']=qs[_0xa751('0x46')](_[_0xa751('0x58')](_0x455294[_0xa751('0x3d')],_0x15505b[_0xa751('0x46')]));if(_0x455294[_0xa751('0x3d')]['filter']){_0xf315c4[_0xa751('0x48')]=_[_0xa751('0x49')](_0xf315c4[_0xa751('0x48')],{'$or':_['map'](_0xf315c4[_0xa751('0x40')],function(_0x5e0431){var _0x3bd72b={};_0x3bd72b[_0x5e0431]={'$like':'%'+_0x455294[_0xa751('0x3d')][_0xa751('0x47')]+'%'};return _0x3bd72b;})});}_0xf315c4=_[_0xa751('0x49')]({},_0xf315c4,_0x455294[_0xa751('0x4b')]);return _0x479b24['getFields'](_0xf315c4);}})[_0xa751('0x1e')](function(_0x3cd666){if(_0x3cd666){_0x1accca=_0x3cd666[_0xa751('0x42')];if(!_0x455294['query'][_0xa751('0x43')](_0xa751('0x44'))){_0xf315c4[_0xa751('0x2d')]=qs[_0xa751('0x2d')](_0x455294[_0xa751('0x3d')]['limit']);_0xf315c4[_0xa751('0x2c')]=qs[_0xa751('0x2c')](_0x455294[_0xa751('0x3d')][_0xa751('0x2c')]);}return _0x479b24[_0xa751('0x55')](_0xf315c4);}})['then'](function(_0x45bc18){if(_0x45bc18){return _0x45bc18?{'count':_0x1accca,'rows':_0x45bc18}:null;}})[_0xa751('0x1e')](respondWithResult(_0x3ea84a,null))['catch'](handleError(_0x3ea84a,null));};exports[_0xa751('0x59')]=function(_0xc66f78,_0x56b5a6,_0x1d83e0){var _0x2e6d65={};var _0x5b2c25={};var _0x5c8bd9;var _0x541f9e;return db['SugarcrmConfiguration'][_0xa751('0x5a')]({'where':{'id':_0xc66f78[_0xa751('0x50')]['id']}})[_0xa751('0x1e')](handleEntityNotFound(_0x56b5a6,null))[_0xa751('0x1e')](function(_0x5ccddc){if(_0x5ccddc){_0x5c8bd9=_0x5ccddc;_0x5b2c25[_0xa751('0x3b')]=_[_0xa751('0x3e')](db[_0xa751('0x56')]['rawAttributes']);_0x5b2c25[_0xa751('0x3d')]=_[_0xa751('0x3e')](_0xc66f78[_0xa751('0x3d')]);_0x5b2c25[_0xa751('0x46')]=_[_0xa751('0x3f')](_0x5b2c25[_0xa751('0x3b')],_0x5b2c25['query']);_0x2e6d65[_0xa751('0x40')]=_[_0xa751('0x3f')](_0x5b2c25['model'],qs[_0xa751('0x41')](_0xc66f78[_0xa751('0x3d')][_0xa751('0x41')]));_0x2e6d65[_0xa751('0x40')]=_0x2e6d65['attributes'][_0xa751('0x42')]?_0x2e6d65[_0xa751('0x40')]:_0x5b2c25['model'];_0x2e6d65[_0xa751('0x57')]=qs[_0xa751('0x45')](_0xc66f78['query'][_0xa751('0x45')]);_0x2e6d65[_0xa751('0x48')]=qs[_0xa751('0x46')](_[_0xa751('0x58')](_0xc66f78[_0xa751('0x3d')],_0x5b2c25[_0xa751('0x46')]));if(_0xc66f78[_0xa751('0x3d')][_0xa751('0x47')]){_0x2e6d65['where']=_[_0xa751('0x49')](_0x2e6d65['where'],{'$or':_[_0xa751('0x3c')](_0x2e6d65[_0xa751('0x40')],function(_0x4440c6){var _0x411cad={};_0x411cad[_0x4440c6]={'$like':'%'+_0xc66f78['query'][_0xa751('0x47')]+'%'};return _0x411cad;})});}_0x2e6d65=_[_0xa751('0x49')]({},_0x2e6d65,_0xc66f78[_0xa751('0x4b')]);return _0x5c8bd9['getSubjects'](_0x2e6d65);}})[_0xa751('0x1e')](function(_0x7c801f){if(_0x7c801f){_0x541f9e=_0x7c801f[_0xa751('0x42')];if(!_0xc66f78[_0xa751('0x3d')][_0xa751('0x43')](_0xa751('0x44'))){_0x2e6d65[_0xa751('0x2d')]=qs[_0xa751('0x2d')](_0xc66f78[_0xa751('0x3d')][_0xa751('0x2d')]);_0x2e6d65[_0xa751('0x2c')]=qs[_0xa751('0x2c')](_0xc66f78['query']['offset']);}return _0x5c8bd9[_0xa751('0x59')](_0x2e6d65);}})['then'](function(_0x49d87d){if(_0x49d87d){return _0x49d87d?{'count':_0x541f9e,'rows':_0x49d87d}:null;}})[_0xa751('0x1e')](respondWithResult(_0x56b5a6,null))['catch'](handleError(_0x56b5a6,null));};exports[_0xa751('0x5b')]=function(_0x2bf1d5,_0x5c88d2,_0x21a7f9){var _0x6575eb={};var _0x22439d={};var _0x514305;var _0x49d8d2;return db['SugarcrmConfiguration'][_0xa751('0x5a')]({'where':{'id':_0x2bf1d5[_0xa751('0x50')]['id']}})['then'](handleEntityNotFound(_0x5c88d2,null))[_0xa751('0x1e')](function(_0x18e0ca){if(_0x18e0ca){_0x514305=_0x18e0ca;_0x22439d[_0xa751('0x3b')]=_[_0xa751('0x3e')](db[_0xa751('0x56')][_0xa751('0x39')]);_0x22439d[_0xa751('0x3d')]=_[_0xa751('0x3e')](_0x2bf1d5[_0xa751('0x3d')]);_0x22439d[_0xa751('0x46')]=_[_0xa751('0x3f')](_0x22439d[_0xa751('0x3b')],_0x22439d[_0xa751('0x3d')]);_0x6575eb[_0xa751('0x40')]=_[_0xa751('0x3f')](_0x22439d[_0xa751('0x3b')],qs[_0xa751('0x41')](_0x2bf1d5['query'][_0xa751('0x41')]));_0x6575eb[_0xa751('0x40')]=_0x6575eb[_0xa751('0x40')][_0xa751('0x42')]?_0x6575eb[_0xa751('0x40')]:_0x22439d[_0xa751('0x3b')];_0x6575eb[_0xa751('0x57')]=qs[_0xa751('0x45')](_0x2bf1d5['query'][_0xa751('0x45')]);_0x6575eb[_0xa751('0x48')]=qs[_0xa751('0x46')](_[_0xa751('0x58')](_0x2bf1d5[_0xa751('0x3d')],_0x22439d['filters']));if(_0x2bf1d5[_0xa751('0x3d')][_0xa751('0x47')]){_0x6575eb[_0xa751('0x48')]=_[_0xa751('0x49')](_0x6575eb[_0xa751('0x48')],{'$or':_[_0xa751('0x3c')](_0x6575eb[_0xa751('0x40')],function(_0x4db807){var _0x152836={};_0x152836[_0x4db807]={'$like':'%'+_0x2bf1d5[_0xa751('0x3d')][_0xa751('0x47')]+'%'};return _0x152836;})});}_0x6575eb=_[_0xa751('0x49')]({},_0x6575eb,_0x2bf1d5[_0xa751('0x4b')]);return _0x514305[_0xa751('0x5b')](_0x6575eb);}})[_0xa751('0x1e')](function(_0x20f957){if(_0x20f957){_0x49d8d2=_0x20f957[_0xa751('0x42')];if(!_0x2bf1d5['query'][_0xa751('0x43')](_0xa751('0x44'))){_0x6575eb['limit']=qs['limit'](_0x2bf1d5[_0xa751('0x3d')][_0xa751('0x2d')]);_0x6575eb[_0xa751('0x2c')]=qs['offset'](_0x2bf1d5[_0xa751('0x3d')][_0xa751('0x2c')]);}return _0x514305[_0xa751('0x5b')](_0x6575eb);}})[_0xa751('0x1e')](function(_0x4b3bfa){if(_0x4b3bfa){return _0x4b3bfa?{'count':_0x49d8d2,'rows':_0x4b3bfa}:null;}})[_0xa751('0x1e')](respondWithResult(_0x5c88d2,null))[_0xa751('0x26')](handleError(_0x5c88d2,null));}; \ No newline at end of file +var _0x7360=['eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','request','SugarcrmConfiguration,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','findOne','SugarcrmField','getSubjects','getDescriptions','html-pdf'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x7360,0xaf));var _0x0736=function(_0x371691,_0x1db208){_0x371691=_0x371691-0x0;var _0x11a925=_0x7360[_0x371691];return _0x11a925;};'use strict';var pdf=require(_0x0736('0x0'));var emlformat=require(_0x0736('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0736('0x2'));var rp=require(_0x0736('0x3'));var moment=require(_0x0736('0x4'));var BPromise=require(_0x0736('0x5'));var Mustache=require(_0x0736('0x6'));var util=require(_0x0736('0x7'));var path=require(_0x0736('0x8'));var sox=require('sox');var csv=require(_0x0736('0x9'));var ejs=require(_0x0736('0xa'));var fs=require('fs');var _=require(_0x0736('0xb'));var squel=require(_0x0736('0xc'));var crypto=require(_0x0736('0xd'));var jsforce=require(_0x0736('0xe'));var deskjs=require(_0x0736('0xf'));var toCsv=require(_0x0736('0x9'));var querystring=require('querystring');var Papa=require(_0x0736('0x10'));var Redis=require(_0x0736('0x11'));var authService=require(_0x0736('0x12'));var qs=require(_0x0736('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0736('0x14'));var logger=require(_0x0736('0x15'))('api');var utils=require(_0x0736('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0736('0x17'));var db=require(_0x0736('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x300fb1,_0x250c27,_0x8d3c16,_0xbe40c7){return new BPromise(function(_0x393f40,_0x16248d){var _0x1cfb53=_0xbe40c7||client;return _0x1cfb53[_0x0736('0x19')](_0x300fb1,_0x8d3c16)['then'](function(_0x2d8aa6){logger['info'](_0x0736('0x1a'),_0x250c27,'request\x20sent');logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x250c27,'request\x20sent',JSON[_0x0736('0x1b')](_0x2d8aa6));if(_0x2d8aa6[_0x0736('0x1c')]){if(_0x2d8aa6[_0x0736('0x1c')][_0x0736('0x1d')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x250c27,_0x2d8aa6[_0x0736('0x1c')]['message']);return _0x16248d(_0x2d8aa6[_0x0736('0x1c')][_0x0736('0x1e')]);}logger[_0x0736('0x1c')](_0x0736('0x1a'),_0x250c27,_0x2d8aa6['error']['message']);return _0x393f40(_0x2d8aa6[_0x0736('0x1c')][_0x0736('0x1e')]);}else{logger[_0x0736('0x1f')](_0x0736('0x1a'),_0x250c27,_0x0736('0x20'));_0x393f40(_0x2d8aa6[_0x0736('0x21')][_0x0736('0x1e')]);}})['catch'](function(_0x1818e7){logger['error'](_0x0736('0x1a'),_0x250c27,_0x1818e7);_0x16248d(_0x1818e7);});});}function respondWithStatusCode(_0xc50dfe,_0x198d94){_0x198d94=_0x198d94||0xcc;return function(_0x1cc15a){if(_0x1cc15a){return _0xc50dfe[_0x0736('0x22')](_0x198d94);}return _0xc50dfe[_0x0736('0x23')](_0x198d94)[_0x0736('0x24')]();};}function respondWithResult(_0xed1747,_0xc498ca){_0xc498ca=_0xc498ca||0xc8;return function(_0x28ca18){if(_0x28ca18){return _0xed1747[_0x0736('0x23')](_0xc498ca)['json'](_0x28ca18);}};}function respondWithFilteredResult(_0x40955a,_0x175215){return function(_0x139056){if(_0x139056){var _0x281bd4=_0x139056[_0x0736('0x25')],_0x19ecea=_0x175215[_0x0736('0x26')],_0x2026c4=_0x175215[_0x0736('0x26')]+_0x175215[_0x0736('0x27')],_0x4343fa;if(_0x2026c4>=_0x281bd4){_0x2026c4=_0x281bd4;_0x4343fa=0xc8;}else{_0x4343fa=0xce;}_0x40955a[_0x0736('0x23')](_0x4343fa);return _0x40955a[_0x0736('0x28')](_0x0736('0x29'),_0x19ecea+'-'+_0x2026c4+'/'+_0x281bd4)[_0x0736('0x2a')](_0x139056);}return null;};}function patchUpdates(_0xc6c039){return function(_0xf92a7e){try{jsonpatch[_0x0736('0x2b')](_0xf92a7e,_0xc6c039,!![]);}catch(_0x3ae4be){return BPromise[_0x0736('0x2c')](_0x3ae4be);}return _0xf92a7e['save']();};}function saveUpdates(_0x591de1,_0x1b2c62){return function(_0x3beb62){if(_0x3beb62){return _0x3beb62[_0x0736('0x2d')](_0x591de1)[_0x0736('0x2e')](function(_0x4c6013){return _0x4c6013;});}return null;};}function removeEntity(_0x18201d,_0x4b888e){return function(_0xf94689){if(_0xf94689){return _0xf94689[_0x0736('0x2f')]()[_0x0736('0x2e')](function(){_0x18201d[_0x0736('0x23')](0xcc)[_0x0736('0x24')]();});}};}function handleEntityNotFound(_0x3e3372,_0x47e3a5){return function(_0x416345){if(!_0x416345){_0x3e3372[_0x0736('0x22')](0x194);}return _0x416345;};}function handleError(_0x456ba2,_0x4404ef){_0x4404ef=_0x4404ef||0x1f4;return function(_0x47eb58){logger[_0x0736('0x1c')](_0x47eb58[_0x0736('0x30')]);if(_0x47eb58[_0x0736('0x31')]){delete _0x47eb58[_0x0736('0x31')];}_0x456ba2[_0x0736('0x23')](_0x4404ef)['send'](_0x47eb58);};}exports[_0x0736('0x32')]=function(_0x2dd18a,_0x6ba2e4){var _0x13e1de={},_0x42f45a={},_0x2e08a2={'count':0x0,'rows':[]};var _0x99323=_[_0x0736('0x33')](db[_0x0736('0x34')][_0x0736('0x35')],function(_0x525123){return{'name':_0x525123[_0x0736('0x36')],'type':_0x525123['type']['key']};});_0x42f45a[_0x0736('0x37')]=_[_0x0736('0x33')](_0x99323,_0x0736('0x31'));_0x42f45a[_0x0736('0x38')]=_[_0x0736('0x39')](_0x2dd18a[_0x0736('0x38')]);_0x42f45a[_0x0736('0x3a')]=_['intersection'](_0x42f45a[_0x0736('0x37')],_0x42f45a[_0x0736('0x38')]);_0x13e1de[_0x0736('0x3b')]=_[_0x0736('0x3c')](_0x42f45a[_0x0736('0x37')],qs[_0x0736('0x3d')](_0x2dd18a[_0x0736('0x38')][_0x0736('0x3d')]));_0x13e1de['attributes']=_0x13e1de[_0x0736('0x3b')]['length']?_0x13e1de[_0x0736('0x3b')]:_0x42f45a[_0x0736('0x37')];if(!_0x2dd18a[_0x0736('0x38')][_0x0736('0x3e')](_0x0736('0x3f'))){_0x13e1de[_0x0736('0x27')]=qs[_0x0736('0x27')](_0x2dd18a['query']['limit']);_0x13e1de[_0x0736('0x26')]=qs['offset'](_0x2dd18a[_0x0736('0x38')]['offset']);}_0x13e1de[_0x0736('0x40')]=qs[_0x0736('0x41')](_0x2dd18a[_0x0736('0x38')][_0x0736('0x41')]);_0x13e1de['where']=qs[_0x0736('0x3a')](_[_0x0736('0x42')](_0x2dd18a['query'],_0x42f45a[_0x0736('0x3a')]),_0x99323);if(_0x2dd18a['query'][_0x0736('0x43')]){_0x13e1de[_0x0736('0x44')]=_[_0x0736('0x45')](_0x13e1de[_0x0736('0x44')],{'$or':_['map'](_0x99323,function(_0x452bac){if(_0x452bac[_0x0736('0x46')]!==_0x0736('0x47')){var _0x423d92={};_0x423d92[_0x452bac[_0x0736('0x31')]]={'$like':'%'+_0x2dd18a[_0x0736('0x38')][_0x0736('0x43')]+'%'};return _0x423d92;}})});}_0x13e1de=_[_0x0736('0x45')]({},_0x13e1de,_0x2dd18a[_0x0736('0x48')]);var _0x40d950={'where':_0x13e1de[_0x0736('0x44')]};return db['SugarcrmConfiguration']['count'](_0x40d950)['then'](function(_0x35f8cd){_0x2e08a2['count']=_0x35f8cd;if(_0x2dd18a['query'][_0x0736('0x49')]){_0x13e1de[_0x0736('0x4a')]=[{'all':!![]}];}return db[_0x0736('0x34')][_0x0736('0x4b')](_0x13e1de);})[_0x0736('0x2e')](function(_0x1ccd40){_0x2e08a2[_0x0736('0x4c')]=_0x1ccd40;return _0x2e08a2;})[_0x0736('0x2e')](respondWithFilteredResult(_0x6ba2e4,_0x13e1de))[_0x0736('0x4d')](handleError(_0x6ba2e4,null));};exports[_0x0736('0x4e')]=function(_0xf7f261,_0xfcd132){var _0x1df9ef={'raw':![],'where':{'id':_0xf7f261[_0x0736('0x4f')]['id']}},_0x5e630a={};_0x5e630a['model']=_[_0x0736('0x39')](db[_0x0736('0x34')][_0x0736('0x35')]);_0x5e630a[_0x0736('0x38')]=_[_0x0736('0x39')](_0xf7f261[_0x0736('0x38')]);_0x5e630a[_0x0736('0x3a')]=_[_0x0736('0x3c')](_0x5e630a[_0x0736('0x37')],_0x5e630a[_0x0736('0x38')]);_0x1df9ef[_0x0736('0x3b')]=_[_0x0736('0x3c')](_0x5e630a[_0x0736('0x37')],qs['fields'](_0xf7f261[_0x0736('0x38')][_0x0736('0x3d')]));_0x1df9ef[_0x0736('0x3b')]=_0x1df9ef[_0x0736('0x3b')][_0x0736('0x50')]?_0x1df9ef['attributes']:_0x5e630a[_0x0736('0x37')];if(_0xf7f261['query'][_0x0736('0x49')]){_0x1df9ef[_0x0736('0x4a')]=[{'all':!![]}];}_0x1df9ef=_[_0x0736('0x45')]({},_0x1df9ef,_0xf7f261[_0x0736('0x48')]);return db[_0x0736('0x34')]['find'](_0x1df9ef)['then'](handleEntityNotFound(_0xfcd132,null))[_0x0736('0x2e')](respondWithResult(_0xfcd132,null))[_0x0736('0x4d')](handleError(_0xfcd132,null));};exports[_0x0736('0x51')]=function(_0x1dabfc,_0x63ebde){return db[_0x0736('0x34')][_0x0736('0x51')](_0x1dabfc[_0x0736('0x52')],{})[_0x0736('0x2e')](respondWithResult(_0x63ebde,0xc9))[_0x0736('0x4d')](handleError(_0x63ebde,null));};exports[_0x0736('0x2d')]=function(_0x59d27b,_0x43d067){if(_0x59d27b[_0x0736('0x52')]['id']){delete _0x59d27b['body']['id'];}return db[_0x0736('0x34')][_0x0736('0x53')]({'where':{'id':_0x59d27b[_0x0736('0x4f')]['id']}})['then'](handleEntityNotFound(_0x43d067,null))[_0x0736('0x2e')](saveUpdates(_0x59d27b[_0x0736('0x52')],null))['then'](respondWithResult(_0x43d067,null))['catch'](handleError(_0x43d067,null));};exports[_0x0736('0x2f')]=function(_0x3a9020,_0x25d0f8){return db['SugarcrmConfiguration'][_0x0736('0x53')]({'where':{'id':_0x3a9020['params']['id']}})['then'](handleEntityNotFound(_0x25d0f8,null))[_0x0736('0x2e')](removeEntity(_0x25d0f8,null))['catch'](handleError(_0x25d0f8,null));};exports['getFields']=function(_0x4be941,_0x4f81be,_0x24ebee){var _0x48854e={};var _0x4a15aa={};var _0x32a49f;var _0x330013;return db[_0x0736('0x34')][_0x0736('0x54')]({'where':{'id':_0x4be941['params']['id']}})['then'](handleEntityNotFound(_0x4f81be,null))[_0x0736('0x2e')](function(_0x1ca29e){if(_0x1ca29e){_0x32a49f=_0x1ca29e;_0x4a15aa[_0x0736('0x37')]=_[_0x0736('0x39')](db['SugarcrmField']['rawAttributes']);_0x4a15aa[_0x0736('0x38')]=_[_0x0736('0x39')](_0x4be941[_0x0736('0x38')]);_0x4a15aa['filters']=_[_0x0736('0x3c')](_0x4a15aa['model'],_0x4a15aa[_0x0736('0x38')]);_0x48854e[_0x0736('0x3b')]=_[_0x0736('0x3c')](_0x4a15aa[_0x0736('0x37')],qs[_0x0736('0x3d')](_0x4be941['query'][_0x0736('0x3d')]));_0x48854e['attributes']=_0x48854e[_0x0736('0x3b')]['length']?_0x48854e[_0x0736('0x3b')]:_0x4a15aa[_0x0736('0x37')];_0x48854e[_0x0736('0x40')]=qs['sort'](_0x4be941[_0x0736('0x38')][_0x0736('0x41')]);_0x48854e[_0x0736('0x44')]=qs['filters'](_['pick'](_0x4be941[_0x0736('0x38')],_0x4a15aa[_0x0736('0x3a')]));if(_0x4be941[_0x0736('0x38')][_0x0736('0x43')]){_0x48854e[_0x0736('0x44')]=_[_0x0736('0x45')](_0x48854e['where'],{'$or':_[_0x0736('0x33')](_0x48854e[_0x0736('0x3b')],function(_0x63ee12){var _0x1aa782={};_0x1aa782[_0x63ee12]={'$like':'%'+_0x4be941[_0x0736('0x38')][_0x0736('0x43')]+'%'};return _0x1aa782;})});}_0x48854e=_[_0x0736('0x45')]({},_0x48854e,_0x4be941[_0x0736('0x48')]);return _0x32a49f['getFields'](_0x48854e);}})[_0x0736('0x2e')](function(_0x34f1be){if(_0x34f1be){_0x330013=_0x34f1be[_0x0736('0x50')];if(!_0x4be941['query']['hasOwnProperty']('nolimit')){_0x48854e[_0x0736('0x27')]=qs['limit'](_0x4be941['query'][_0x0736('0x27')]);_0x48854e[_0x0736('0x26')]=qs[_0x0736('0x26')](_0x4be941[_0x0736('0x38')][_0x0736('0x26')]);}return _0x32a49f['getFields'](_0x48854e);}})[_0x0736('0x2e')](function(_0x21178d){if(_0x21178d){return _0x21178d?{'count':_0x330013,'rows':_0x21178d}:null;}})['then'](respondWithResult(_0x4f81be,null))[_0x0736('0x4d')](handleError(_0x4f81be,null));};exports['getSubjects']=function(_0xda288e,_0x3ff8fc,_0x34423c){var _0x3017e2={};var _0x35ed49={};var _0x33cf4a;var _0x2ea434;return db[_0x0736('0x34')][_0x0736('0x54')]({'where':{'id':_0xda288e[_0x0736('0x4f')]['id']}})[_0x0736('0x2e')](handleEntityNotFound(_0x3ff8fc,null))[_0x0736('0x2e')](function(_0xbee134){if(_0xbee134){_0x33cf4a=_0xbee134;_0x35ed49[_0x0736('0x37')]=_[_0x0736('0x39')](db[_0x0736('0x55')][_0x0736('0x35')]);_0x35ed49[_0x0736('0x38')]=_[_0x0736('0x39')](_0xda288e[_0x0736('0x38')]);_0x35ed49[_0x0736('0x3a')]=_[_0x0736('0x3c')](_0x35ed49['model'],_0x35ed49['query']);_0x3017e2['attributes']=_[_0x0736('0x3c')](_0x35ed49[_0x0736('0x37')],qs[_0x0736('0x3d')](_0xda288e[_0x0736('0x38')][_0x0736('0x3d')]));_0x3017e2[_0x0736('0x3b')]=_0x3017e2[_0x0736('0x3b')][_0x0736('0x50')]?_0x3017e2[_0x0736('0x3b')]:_0x35ed49['model'];_0x3017e2[_0x0736('0x40')]=qs[_0x0736('0x41')](_0xda288e[_0x0736('0x38')][_0x0736('0x41')]);_0x3017e2[_0x0736('0x44')]=qs[_0x0736('0x3a')](_[_0x0736('0x42')](_0xda288e[_0x0736('0x38')],_0x35ed49['filters']));if(_0xda288e['query'][_0x0736('0x43')]){_0x3017e2[_0x0736('0x44')]=_['merge'](_0x3017e2[_0x0736('0x44')],{'$or':_['map'](_0x3017e2[_0x0736('0x3b')],function(_0x5bd94e){var _0x49f36c={};_0x49f36c[_0x5bd94e]={'$like':'%'+_0xda288e['query'][_0x0736('0x43')]+'%'};return _0x49f36c;})});}_0x3017e2=_['merge']({},_0x3017e2,_0xda288e[_0x0736('0x48')]);return _0x33cf4a[_0x0736('0x56')](_0x3017e2);}})['then'](function(_0x3b0ee5){if(_0x3b0ee5){_0x2ea434=_0x3b0ee5[_0x0736('0x50')];if(!_0xda288e[_0x0736('0x38')]['hasOwnProperty'](_0x0736('0x3f'))){_0x3017e2['limit']=qs['limit'](_0xda288e[_0x0736('0x38')][_0x0736('0x27')]);_0x3017e2[_0x0736('0x26')]=qs[_0x0736('0x26')](_0xda288e[_0x0736('0x38')][_0x0736('0x26')]);}return _0x33cf4a['getSubjects'](_0x3017e2);}})[_0x0736('0x2e')](function(_0x3f5669){if(_0x3f5669){return _0x3f5669?{'count':_0x2ea434,'rows':_0x3f5669}:null;}})[_0x0736('0x2e')](respondWithResult(_0x3ff8fc,null))['catch'](handleError(_0x3ff8fc,null));};exports[_0x0736('0x57')]=function(_0x105dee,_0x4be182,_0x4062d1){var _0x2c5de9={};var _0x3faa53={};var _0x28b40a;var _0x1900b0;return db['SugarcrmConfiguration'][_0x0736('0x54')]({'where':{'id':_0x105dee[_0x0736('0x4f')]['id']}})[_0x0736('0x2e')](handleEntityNotFound(_0x4be182,null))[_0x0736('0x2e')](function(_0x43eb1a){if(_0x43eb1a){_0x28b40a=_0x43eb1a;_0x3faa53[_0x0736('0x37')]=_[_0x0736('0x39')](db['SugarcrmField']['rawAttributes']);_0x3faa53[_0x0736('0x38')]=_['keys'](_0x105dee[_0x0736('0x38')]);_0x3faa53[_0x0736('0x3a')]=_[_0x0736('0x3c')](_0x3faa53[_0x0736('0x37')],_0x3faa53[_0x0736('0x38')]);_0x2c5de9[_0x0736('0x3b')]=_[_0x0736('0x3c')](_0x3faa53[_0x0736('0x37')],qs['fields'](_0x105dee[_0x0736('0x38')][_0x0736('0x3d')]));_0x2c5de9[_0x0736('0x3b')]=_0x2c5de9[_0x0736('0x3b')][_0x0736('0x50')]?_0x2c5de9[_0x0736('0x3b')]:_0x3faa53[_0x0736('0x37')];_0x2c5de9[_0x0736('0x40')]=qs['sort'](_0x105dee[_0x0736('0x38')][_0x0736('0x41')]);_0x2c5de9['where']=qs[_0x0736('0x3a')](_['pick'](_0x105dee['query'],_0x3faa53[_0x0736('0x3a')]));if(_0x105dee[_0x0736('0x38')][_0x0736('0x43')]){_0x2c5de9['where']=_[_0x0736('0x45')](_0x2c5de9[_0x0736('0x44')],{'$or':_[_0x0736('0x33')](_0x2c5de9[_0x0736('0x3b')],function(_0x55e84f){var _0x54e459={};_0x54e459[_0x55e84f]={'$like':'%'+_0x105dee['query'][_0x0736('0x43')]+'%'};return _0x54e459;})});}_0x2c5de9=_[_0x0736('0x45')]({},_0x2c5de9,_0x105dee[_0x0736('0x48')]);return _0x28b40a['getDescriptions'](_0x2c5de9);}})[_0x0736('0x2e')](function(_0x49fde0){if(_0x49fde0){_0x1900b0=_0x49fde0[_0x0736('0x50')];if(!_0x105dee[_0x0736('0x38')][_0x0736('0x3e')](_0x0736('0x3f'))){_0x2c5de9[_0x0736('0x27')]=qs['limit'](_0x105dee[_0x0736('0x38')][_0x0736('0x27')]);_0x2c5de9[_0x0736('0x26')]=qs['offset'](_0x105dee[_0x0736('0x38')][_0x0736('0x26')]);}return _0x28b40a[_0x0736('0x57')](_0x2c5de9);}})['then'](function(_0x21aaec){if(_0x21aaec){return _0x21aaec?{'count':_0x1900b0,'rows':_0x21aaec}:null;}})[_0x0736('0x2e')](respondWithResult(_0x4be182,null))['catch'](handleError(_0x4be182,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 0675549..a1ea5aa 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 _0xb8f7=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0xb8f7,0x134));var _0x7b8f=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb8f7[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x7b8f('0x0'));var util=require(_0x7b8f('0x1'));var logger=require(_0x7b8f('0x2'))(_0x7b8f('0x3'));var moment=require(_0x7b8f('0x4'));var BPromise=require(_0x7b8f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b8f('0x6'));var rimraf=require('rimraf');var config=require(_0x7b8f('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x7b8f('0x8')]=function(_0x573ec3,_0x56a712){return _0x573ec3['define'](_0x7b8f('0x9'),attributes,{'tableName':_0x7b8f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26f8=['moment','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api'];(function(_0x240745,_0x176235){var _0x27d616=function(_0x5710d2){while(--_0x5710d2){_0x240745['push'](_0x240745['shift']());}};_0x27d616(++_0x176235);}(_0x26f8,0x1ea));var _0x826f=function(_0x4b7124,_0x206b7b){_0x4b7124=_0x4b7124-0x0;var _0x23e16d=_0x26f8[_0x4b7124];return _0x23e16d;};'use strict';var _=require(_0x826f('0x0'));var util=require(_0x826f('0x1'));var logger=require(_0x826f('0x2'))(_0x826f('0x3'));var moment=require(_0x826f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x826f('0x5'));var rimraf=require(_0x826f('0x6'));var config=require(_0x826f('0x7'));var attributes=require(_0x826f('0x8'));module[_0x826f('0x9')]=function(_0x3af47b,_0x1f2e73){return _0x3af47b[_0x826f('0xa')](_0x826f('0xb'),attributes,{'tableName':_0x826f('0xc'),'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 d817506..2166d6d 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 _0x9430=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','SugarcrmConfiguration,\x20%s,\x20%s','catch'];(function(_0x1e6e49,_0x38416e){var _0x488a08=function(_0x460db5){while(--_0x460db5){_0x1e6e49['push'](_0x1e6e49['shift']());}};_0x488a08(++_0x38416e);}(_0x9430,0x165));var _0x0943=function(_0x56a845,_0x2ecb45){_0x56a845=_0x56a845-0x0;var _0x346e39=_0x9430[_0x56a845];return _0x346e39;};'use strict';var _=require(_0x0943('0x0'));var util=require(_0x0943('0x1'));var moment=require(_0x0943('0x2'));var BPromise=require(_0x0943('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0943('0x4'))['db'];var utils=require(_0x0943('0x5'));var logger=require(_0x0943('0x6'))(_0x0943('0x7'));var config=require('../../config/environment');var jayson=require(_0x0943('0x8'));var client=jayson[_0x0943('0x9')][_0x0943('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ec5aa,_0x458f90,_0x15c2b9){return new BPromise(function(_0x2ddf8b,_0x8aaed5){return client['request'](_0x2ec5aa,_0x15c2b9)[_0x0943('0xb')](function(_0x3dcd42){logger[_0x0943('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x458f90,_0x0943('0xd'));logger[_0x0943('0xe')](_0x0943('0xf'),_0x458f90,_0x0943('0xd'),JSON[_0x0943('0x10')](_0x3dcd42));if(_0x3dcd42[_0x0943('0x11')]){if(_0x3dcd42['error']['code']===0x1f4){logger[_0x0943('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x458f90,_0x3dcd42[_0x0943('0x11')][_0x0943('0x12')]);return _0x8aaed5(_0x3dcd42['error'][_0x0943('0x12')]);}logger[_0x0943('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x458f90,_0x3dcd42[_0x0943('0x11')][_0x0943('0x12')]);return _0x2ddf8b(_0x3dcd42[_0x0943('0x11')][_0x0943('0x12')]);}else{logger['info'](_0x0943('0x13'),_0x458f90,_0x0943('0xd'));_0x2ddf8b(_0x3dcd42['result'][_0x0943('0x12')]);}})[_0x0943('0x14')](function(_0x4c157a){logger[_0x0943('0x11')](_0x0943('0x13'),_0x458f90,_0x4c157a);_0x8aaed5(_0x4c157a);});});} \ No newline at end of file +var _0xeedb=['util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x4f8226,_0x28a989){var _0x3a5822=function(_0x2eca37){while(--_0x2eca37){_0x4f8226['push'](_0x4f8226['shift']());}};_0x3a5822(++_0x28a989);}(_0xeedb,0x68));var _0xbeed=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xeedb[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0xbeed('0x0'));var util=require(_0xbeed('0x1'));var moment=require(_0xbeed('0x2'));var BPromise=require(_0xbeed('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbeed('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbeed('0x5'))(_0xbeed('0x6'));var config=require(_0xbeed('0x7'));var jayson=require(_0xbeed('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xffba4,_0x18e54e,_0x1fc7b9){return new BPromise(function(_0x3d0940,_0x29eb8a){return client[_0xbeed('0x9')](_0xffba4,_0x1fc7b9)['then'](function(_0x5ee959){logger[_0xbeed('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x18e54e,_0xbeed('0xb'));logger[_0xbeed('0xc')](_0xbeed('0xd'),_0x18e54e,'request\x20sent',JSON[_0xbeed('0xe')](_0x5ee959));if(_0x5ee959[_0xbeed('0xf')]){if(_0x5ee959[_0xbeed('0xf')][_0xbeed('0x10')]===0x1f4){logger[_0xbeed('0xf')](_0xbeed('0x11'),_0x18e54e,_0x5ee959[_0xbeed('0xf')][_0xbeed('0x12')]);return _0x29eb8a(_0x5ee959[_0xbeed('0xf')]['message']);}logger[_0xbeed('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x18e54e,_0x5ee959[_0xbeed('0xf')]['message']);return _0x3d0940(_0x5ee959['error'][_0xbeed('0x12')]);}else{logger[_0xbeed('0xa')](_0xbeed('0x11'),_0x18e54e,'request\x20sent');_0x3d0940(_0x5ee959[_0xbeed('0x13')]['message']);}})[_0xbeed('0x14')](function(_0x16224a){logger[_0xbeed('0xf')](_0xbeed('0x11'),_0x18e54e,_0x16224a);_0x29eb8a(_0x16224a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 0ae1b71..d688e24 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 _0x6ad9=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x1faeea,_0x2932b6){var _0x430526=function(_0x311689){while(--_0x311689){_0x1faeea['push'](_0x1faeea['shift']());}};_0x430526(++_0x2932b6);}(_0x6ad9,0x64));var _0x96ad=function(_0x464d76,_0x1dab3c){_0x464d76=_0x464d76-0x0;var _0x178e25=_0x6ad9[_0x464d76];return _0x178e25;};'use strict';var multer=require(_0x96ad('0x0'));var util=require(_0x96ad('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x96ad('0x2'));var router=express[_0x96ad('0x3')]();var auth=require(_0x96ad('0x4'));var interaction=require(_0x96ad('0x5'));var config=require(_0x96ad('0x6'));var controller=require(_0x96ad('0x7'));router[_0x96ad('0x8')]('/',auth[_0x96ad('0x9')](),controller[_0x96ad('0xa')]);router[_0x96ad('0x8')](_0x96ad('0xb'),auth['isAuthenticated'](),controller[_0x96ad('0xc')]);router[_0x96ad('0xd')]('/',auth['isAuthenticated'](),controller[_0x96ad('0xe')]);router['put'](_0x96ad('0xb'),auth[_0x96ad('0x9')](),controller[_0x96ad('0xf')]);router[_0x96ad('0x10')](_0x96ad('0xb'),auth[_0x96ad('0x9')](),controller[_0x96ad('0x11')]);module['exports']=router; \ No newline at end of file +var _0xcdc1=['express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','util','connect-timeout'];(function(_0x33244d,_0x4de0cf){var _0x48fd8e=function(_0x24bf8e){while(--_0x24bf8e){_0x33244d['push'](_0x33244d['shift']());}};_0x48fd8e(++_0x4de0cf);}(_0xcdc1,0xec));var _0x1cdc=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xcdc1[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x1cdc('0x0'));var path=require('path');var timeout=require(_0x1cdc('0x1'));var express=require(_0x1cdc('0x2'));var router=express[_0x1cdc('0x3')]();var auth=require(_0x1cdc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1cdc('0x5'));var controller=require(_0x1cdc('0x6'));router[_0x1cdc('0x7')]('/',auth[_0x1cdc('0x8')](),controller[_0x1cdc('0x9')]);router[_0x1cdc('0x7')](_0x1cdc('0xa'),auth[_0x1cdc('0x8')](),controller[_0x1cdc('0xb')]);router[_0x1cdc('0xc')]('/',auth['isAuthenticated'](),controller[_0x1cdc('0xd')]);router['put'](_0x1cdc('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x1cdc('0xe')](_0x1cdc('0xa'),auth['isAuthenticated'](),controller[_0x1cdc('0xf')]);module[_0x1cdc('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 3f039f9..8fc47d1 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 _0x8e94=['variable','STRING','sequelize','exports','string','customVariable'];(function(_0x3af956,_0x93bd81){var _0x173a82=function(_0x455b4a){while(--_0x455b4a){_0x3af956['push'](_0x3af956['shift']());}};_0x173a82(++_0x93bd81);}(_0x8e94,0xf8));var _0x48e9=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0x8e94[_0x45518f];return _0x198175;};'use strict';var Sequelize=require(_0x48e9('0x0'));module[_0x48e9('0x1')]={'type':{'type':Sequelize['ENUM'](_0x48e9('0x2'),'variable',_0x48e9('0x3'),'keyValue'),'defaultValue':_0x48e9('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x48e9('0x2'),_0x48e9('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x48e9('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x48e9('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x48e9('0x5')]}}; \ No newline at end of file +var _0xa22a=['string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa22a,0x153));var _0xaa22=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa22a[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xaa22('0x0'));module[_0xaa22('0x1')]={'type':{'type':Sequelize[_0xaa22('0x2')](_0xaa22('0x3'),_0xaa22('0x4'),'customVariable',_0xaa22('0x5')),'defaultValue':_0xaa22('0x3')},'content':{'type':Sequelize[_0xaa22('0x6')]},'key':{'type':Sequelize[_0xaa22('0x6')]},'keyType':{'type':Sequelize[_0xaa22('0x2')](_0xaa22('0x3'),'variable',_0xaa22('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xaa22('0x6')]},'nameField':{'type':Sequelize[_0xaa22('0x6')]},'customField':{'type':Sequelize[_0xaa22('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaa22('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 413b7f2..fd37a9d 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 _0xd8fb=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd8fb,0x99));var _0xbd8f=function(_0x5f2442,_0x39b833){_0x5f2442=_0x5f2442-0x0;var _0x2db768=_0xd8fb[_0x5f2442];return _0x2db768;};'use strict';var pdf=require(_0xbd8f('0x0'));var emlformat=require(_0xbd8f('0x1'));var rimraf=require(_0xbd8f('0x2'));var zipdir=require(_0xbd8f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbd8f('0x4'));var Mustache=require(_0xbd8f('0x5'));var util=require('util');var path=require(_0xbd8f('0x6'));var sox=require(_0xbd8f('0x7'));var csv=require('to-csv');var ejs=require(_0xbd8f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var licenseUtil=require(_0xbd8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xcc;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0x14')](_0x159f09);}return _0x230988[_0xbd8f('0x15')](_0x159f09)[_0xbd8f('0x16')]();};}function respondWithResult(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0xc8;return function(_0x14606c){if(_0x14606c){return _0x37d4d5['status'](_0x29ffe8)[_0xbd8f('0x17')](_0x14606c);}};}function respondWithFilteredResult(_0x829fb2,_0xa57e91){return function(_0x10d72e){if(_0x10d72e){var _0x4da96f=_0x10d72e[_0xbd8f('0x18')],_0x174929=_0xa57e91[_0xbd8f('0x19')],_0x63db18=_0xa57e91['offset']+_0xa57e91[_0xbd8f('0x1a')],_0x5ebf8b;if(_0x63db18>=_0x4da96f){_0x63db18=_0x4da96f;_0x5ebf8b=0xc8;}else{_0x5ebf8b=0xce;}_0x829fb2[_0xbd8f('0x15')](_0x5ebf8b);return _0x829fb2['set']('Content-Range',_0x174929+'-'+_0x63db18+'/'+_0x4da96f)[_0xbd8f('0x17')](_0x10d72e);}return null;};}function patchUpdates(_0x5d2fdb){return function(_0x5705c5){try{jsonpatch[_0xbd8f('0x1b')](_0x5705c5,_0x5d2fdb,!![]);}catch(_0x4b5fac){return BPromise[_0xbd8f('0x1c')](_0x4b5fac);}return _0x5705c5[_0xbd8f('0x1d')]();};}function saveUpdates(_0xb47c8e,_0x897f25){return function(_0xdc11cc){if(_0xdc11cc){return _0xdc11cc[_0xbd8f('0x1e')](_0xb47c8e)[_0xbd8f('0x1f')](function(_0x90eff8){return _0x90eff8;});}return null;};}function removeEntity(_0x2fbe3b,_0x775acc){return function(_0xfe4048){if(_0xfe4048){return _0xfe4048[_0xbd8f('0x20')]()[_0xbd8f('0x1f')](function(){_0x2fbe3b[_0xbd8f('0x15')](0xcc)[_0xbd8f('0x16')]();});}};}function handleEntityNotFound(_0xd11ae,_0x395b1b){return function(_0x4ba8db){if(!_0x4ba8db){_0xd11ae[_0xbd8f('0x14')](0x194);}return _0x4ba8db;};}function handleError(_0x9fa3b1,_0x1f9fcc){_0x1f9fcc=_0x1f9fcc||0x1f4;return function(_0x2f3df7){logger[_0xbd8f('0x21')](_0x2f3df7[_0xbd8f('0x22')]);if(_0x2f3df7[_0xbd8f('0x23')]){delete _0x2f3df7[_0xbd8f('0x23')];}_0x9fa3b1['status'](_0x1f9fcc)[_0xbd8f('0x24')](_0x2f3df7);};}exports[_0xbd8f('0x25')]=function(_0x5a3a8c,_0x339df7){var _0x557daa={},_0x41b2a6={},_0x30d62e={'count':0x0,'rows':[]};var _0x991401=_[_0xbd8f('0x26')](db[_0xbd8f('0x27')][_0xbd8f('0x28')],function(_0x4c4431){return{'name':_0x4c4431[_0xbd8f('0x29')],'type':_0x4c4431[_0xbd8f('0x2a')][_0xbd8f('0x2b')]};});_0x41b2a6[_0xbd8f('0x2c')]=_[_0xbd8f('0x26')](_0x991401,_0xbd8f('0x23'));_0x41b2a6[_0xbd8f('0x2d')]=_['keys'](_0x5a3a8c[_0xbd8f('0x2d')]);_0x41b2a6[_0xbd8f('0x2e')]=_[_0xbd8f('0x2f')](_0x41b2a6[_0xbd8f('0x2c')],_0x41b2a6['query']);_0x557daa['attributes']=_[_0xbd8f('0x2f')](_0x41b2a6[_0xbd8f('0x2c')],qs[_0xbd8f('0x30')](_0x5a3a8c[_0xbd8f('0x2d')]['fields']));_0x557daa[_0xbd8f('0x31')]=_0x557daa[_0xbd8f('0x31')][_0xbd8f('0x32')]?_0x557daa[_0xbd8f('0x31')]:_0x41b2a6[_0xbd8f('0x2c')];if(!_0x5a3a8c['query'][_0xbd8f('0x33')](_0xbd8f('0x34'))){_0x557daa[_0xbd8f('0x1a')]=qs[_0xbd8f('0x1a')](_0x5a3a8c[_0xbd8f('0x2d')]['limit']);_0x557daa[_0xbd8f('0x19')]=qs['offset'](_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x19')]);}_0x557daa[_0xbd8f('0x35')]=qs[_0xbd8f('0x36')](_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x36')]);_0x557daa['where']=qs['filters'](_['pick'](_0x5a3a8c[_0xbd8f('0x2d')],_0x41b2a6[_0xbd8f('0x2e')]),_0x991401);if(_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x37')]){_0x557daa[_0xbd8f('0x38')]=_[_0xbd8f('0x39')](_0x557daa[_0xbd8f('0x38')],{'$or':_[_0xbd8f('0x26')](_0x991401,function(_0x2d4882){if(_0x2d4882[_0xbd8f('0x2a')]!==_0xbd8f('0x3a')){var _0x339c70={};_0x339c70[_0x2d4882[_0xbd8f('0x23')]]={'$like':'%'+_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x37')]+'%'};return _0x339c70;}})});}_0x557daa=_['merge']({},_0x557daa,_0x5a3a8c[_0xbd8f('0x3b')]);var _0x4181e0={'where':_0x557daa['where']};return db[_0xbd8f('0x27')][_0xbd8f('0x18')](_0x4181e0)[_0xbd8f('0x1f')](function(_0x582bcf){_0x30d62e[_0xbd8f('0x18')]=_0x582bcf;if(_0x5a3a8c['query'][_0xbd8f('0x3c')]){_0x557daa[_0xbd8f('0x3d')]=[{'all':!![]}];}return db[_0xbd8f('0x27')]['findAll'](_0x557daa);})[_0xbd8f('0x1f')](function(_0x72fe99){_0x30d62e[_0xbd8f('0x3e')]=_0x72fe99;return _0x30d62e;})['then'](respondWithFilteredResult(_0x339df7,_0x557daa))[_0xbd8f('0x3f')](handleError(_0x339df7,null));};exports[_0xbd8f('0x40')]=function(_0x2c1397,_0x351027){var _0x280d95={'raw':!![],'where':{'id':_0x2c1397[_0xbd8f('0x41')]['id']}},_0x1db8c7={};_0x1db8c7[_0xbd8f('0x2c')]=_[_0xbd8f('0x42')](db['SugarcrmField']['rawAttributes']);_0x1db8c7[_0xbd8f('0x2d')]=_[_0xbd8f('0x42')](_0x2c1397[_0xbd8f('0x2d')]);_0x1db8c7[_0xbd8f('0x2e')]=_['intersection'](_0x1db8c7[_0xbd8f('0x2c')],_0x1db8c7[_0xbd8f('0x2d')]);_0x280d95[_0xbd8f('0x31')]=_[_0xbd8f('0x2f')](_0x1db8c7[_0xbd8f('0x2c')],qs['fields'](_0x2c1397['query'][_0xbd8f('0x30')]));_0x280d95['attributes']=_0x280d95[_0xbd8f('0x31')][_0xbd8f('0x32')]?_0x280d95[_0xbd8f('0x31')]:_0x1db8c7[_0xbd8f('0x2c')];if(_0x2c1397[_0xbd8f('0x2d')][_0xbd8f('0x3c')]){_0x280d95[_0xbd8f('0x3d')]=[{'all':!![]}];}_0x280d95=_[_0xbd8f('0x39')]({},_0x280d95,_0x2c1397['options']);return db[_0xbd8f('0x27')][_0xbd8f('0x43')](_0x280d95)[_0xbd8f('0x1f')](handleEntityNotFound(_0x351027,null))[_0xbd8f('0x1f')](respondWithResult(_0x351027,null))[_0xbd8f('0x3f')](handleError(_0x351027,null));};exports[_0xbd8f('0x44')]=function(_0x272f70,_0x3918a5){return db['SugarcrmField'][_0xbd8f('0x44')](_0x272f70[_0xbd8f('0x45')],{})[_0xbd8f('0x1f')](respondWithResult(_0x3918a5,0xc9))[_0xbd8f('0x3f')](handleError(_0x3918a5,null));};exports[_0xbd8f('0x1e')]=function(_0x1e40f2,_0x42bada){if(_0x1e40f2[_0xbd8f('0x45')]['id']){delete _0x1e40f2[_0xbd8f('0x45')]['id'];}return db[_0xbd8f('0x27')][_0xbd8f('0x43')]({'where':{'id':_0x1e40f2[_0xbd8f('0x41')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x42bada,null))[_0xbd8f('0x1f')](saveUpdates(_0x1e40f2[_0xbd8f('0x45')],null))[_0xbd8f('0x1f')](respondWithResult(_0x42bada,null))[_0xbd8f('0x3f')](handleError(_0x42bada,null));};exports[_0xbd8f('0x20')]=function(_0x2668a4,_0x4d32c4){return db[_0xbd8f('0x27')][_0xbd8f('0x43')]({'where':{'id':_0x2668a4[_0xbd8f('0x41')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x4d32c4,null))['then'](removeEntity(_0x4d32c4,null))[_0xbd8f('0x3f')](handleError(_0x4d32c4,null));}; \ No newline at end of file +var _0x98a8=['options','SugarcrmField','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','stack','send','index','map','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','merge'];(function(_0x4996a7,_0x41b1c5){var _0x5b0895=function(_0x46e7a6){while(--_0x46e7a6){_0x4996a7['push'](_0x4996a7['shift']());}};_0x5b0895(++_0x41b1c5);}(_0x98a8,0x12c));var _0x898a=function(_0x12c586,_0x120997){_0x12c586=_0x12c586-0x0;var _0x4369ee=_0x98a8[_0x12c586];return _0x4369ee;};'use strict';var pdf=require(_0x898a('0x0'));var emlformat=require(_0x898a('0x1'));var rimraf=require(_0x898a('0x2'));var zipdir=require(_0x898a('0x3'));var jsonpatch=require(_0x898a('0x4'));var rp=require(_0x898a('0x5'));var moment=require(_0x898a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x898a('0x7'));var util=require(_0x898a('0x8'));var path=require(_0x898a('0x9'));var sox=require(_0x898a('0xa'));var csv=require(_0x898a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xb'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=_0x53a4b8[_0x898a('0x1c')],_0x5c96a6=_0x47033c['offset'],_0x303321=_0x47033c[_0x898a('0x1d')]+_0x47033c[_0x898a('0x1e')],_0x4fb05b;if(_0x303321>=_0x3fec7a){_0x303321=_0x3fec7a;_0x4fb05b=0xc8;}else{_0x4fb05b=0xce;}_0x506023[_0x898a('0x1a')](_0x4fb05b);return _0x506023['set'](_0x898a('0x1f'),_0x5c96a6+'-'+_0x303321+'/'+_0x3fec7a)['json'](_0x53a4b8);}return null;};}function patchUpdates(_0x54c8f3){return function(_0x3f8af4){try{jsonpatch[_0x898a('0x20')](_0x3f8af4,_0x54c8f3,!![]);}catch(_0x58c3ab){return BPromise['reject'](_0x58c3ab);}return _0x3f8af4[_0x898a('0x21')]();};}function saveUpdates(_0x26449a,_0x38a8f0){return function(_0x2917ff){if(_0x2917ff){return _0x2917ff[_0x898a('0x22')](_0x26449a)[_0x898a('0x23')](function(_0x259541){return _0x259541;});}return null;};}function removeEntity(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x483212[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x4e254d,_0x274cdf){return function(_0x16c318){if(!_0x16c318){_0x4e254d[_0x898a('0x25')](0x194);}return _0x16c318;};}function handleError(_0x32eca5,_0x3901ab){_0x3901ab=_0x3901ab||0x1f4;return function(_0x1426e3){logger['error'](_0x1426e3[_0x898a('0x26')]);if(_0x1426e3['name']){delete _0x1426e3['name'];}_0x32eca5['status'](_0x3901ab)[_0x898a('0x27')](_0x1426e3);};}exports[_0x898a('0x28')]=function(_0x420b25,_0x40b3db){var _0x28ae6a={},_0x2efde2={},_0x398e98={'count':0x0,'rows':[]};var _0xac1fc4=_[_0x898a('0x29')](db['SugarcrmField']['rawAttributes'],function(_0x47f1ed){return{'name':_0x47f1ed[_0x898a('0x2a')],'type':_0x47f1ed[_0x898a('0x2b')][_0x898a('0x2c')]};});_0x2efde2[_0x898a('0x2d')]=_[_0x898a('0x29')](_0xac1fc4,_0x898a('0x2e'));_0x2efde2[_0x898a('0x2f')]=_[_0x898a('0x30')](_0x420b25[_0x898a('0x2f')]);_0x2efde2[_0x898a('0x31')]=_[_0x898a('0x32')](_0x2efde2[_0x898a('0x2d')],_0x2efde2['query']);_0x28ae6a[_0x898a('0x33')]=_[_0x898a('0x32')](_0x2efde2[_0x898a('0x2d')],qs[_0x898a('0x34')](_0x420b25[_0x898a('0x2f')]['fields']));_0x28ae6a['attributes']=_0x28ae6a[_0x898a('0x33')][_0x898a('0x35')]?_0x28ae6a[_0x898a('0x33')]:_0x2efde2['model'];if(!_0x420b25[_0x898a('0x2f')][_0x898a('0x36')](_0x898a('0x37'))){_0x28ae6a[_0x898a('0x1e')]=qs[_0x898a('0x1e')](_0x420b25[_0x898a('0x2f')][_0x898a('0x1e')]);_0x28ae6a[_0x898a('0x1d')]=qs['offset'](_0x420b25[_0x898a('0x2f')]['offset']);}_0x28ae6a['order']=qs[_0x898a('0x38')](_0x420b25['query'][_0x898a('0x38')]);_0x28ae6a['where']=qs[_0x898a('0x31')](_['pick'](_0x420b25[_0x898a('0x2f')],_0x2efde2[_0x898a('0x31')]),_0xac1fc4);if(_0x420b25[_0x898a('0x2f')]['filter']){_0x28ae6a['where']=_['merge'](_0x28ae6a[_0x898a('0x39')],{'$or':_[_0x898a('0x29')](_0xac1fc4,function(_0x5a228f){if(_0x5a228f[_0x898a('0x2b')]!==_0x898a('0x3a')){var _0xe84f7e={};_0xe84f7e[_0x5a228f[_0x898a('0x2e')]]={'$like':'%'+_0x420b25['query']['filter']+'%'};return _0xe84f7e;}})});}_0x28ae6a=_[_0x898a('0x3b')]({},_0x28ae6a,_0x420b25[_0x898a('0x3c')]);var _0x4d486b={'where':_0x28ae6a['where']};return db[_0x898a('0x3d')][_0x898a('0x1c')](_0x4d486b)[_0x898a('0x23')](function(_0xa45405){_0x398e98['count']=_0xa45405;if(_0x420b25[_0x898a('0x2f')][_0x898a('0x3e')]){_0x28ae6a['include']=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x28ae6a);})[_0x898a('0x23')](function(_0x477a9d){_0x398e98[_0x898a('0x3f')]=_0x477a9d;return _0x398e98;})[_0x898a('0x23')](respondWithFilteredResult(_0x40b3db,_0x28ae6a))[_0x898a('0x40')](handleError(_0x40b3db,null));};exports[_0x898a('0x41')]=function(_0x10daf6,_0x1432ec){var _0x3292c2={'raw':!![],'where':{'id':_0x10daf6[_0x898a('0x42')]['id']}},_0x235fcf={};_0x235fcf[_0x898a('0x2d')]=_[_0x898a('0x30')](db[_0x898a('0x3d')][_0x898a('0x43')]);_0x235fcf['query']=_[_0x898a('0x30')](_0x10daf6[_0x898a('0x2f')]);_0x235fcf[_0x898a('0x31')]=_['intersection'](_0x235fcf[_0x898a('0x2d')],_0x235fcf[_0x898a('0x2f')]);_0x3292c2[_0x898a('0x33')]=_[_0x898a('0x32')](_0x235fcf[_0x898a('0x2d')],qs[_0x898a('0x34')](_0x10daf6[_0x898a('0x2f')][_0x898a('0x34')]));_0x3292c2['attributes']=_0x3292c2[_0x898a('0x33')][_0x898a('0x35')]?_0x3292c2[_0x898a('0x33')]:_0x235fcf[_0x898a('0x2d')];if(_0x10daf6['query'][_0x898a('0x3e')]){_0x3292c2[_0x898a('0x44')]=[{'all':!![]}];}_0x3292c2=_['merge']({},_0x3292c2,_0x10daf6[_0x898a('0x3c')]);return db['SugarcrmField'][_0x898a('0x45')](_0x3292c2)['then'](handleEntityNotFound(_0x1432ec,null))['then'](respondWithResult(_0x1432ec,null))[_0x898a('0x40')](handleError(_0x1432ec,null));};exports['create']=function(_0x313fb4,_0x1edb26){return db['SugarcrmField'][_0x898a('0x46')](_0x313fb4[_0x898a('0x47')],{})['then'](respondWithResult(_0x1edb26,0xc9))[_0x898a('0x40')](handleError(_0x1edb26,null));};exports[_0x898a('0x22')]=function(_0x11a0a3,_0x118240){if(_0x11a0a3['body']['id']){delete _0x11a0a3[_0x898a('0x47')]['id'];}return db[_0x898a('0x3d')]['find']({'where':{'id':_0x11a0a3[_0x898a('0x42')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x118240,null))['then'](saveUpdates(_0x11a0a3[_0x898a('0x47')],null))['then'](respondWithResult(_0x118240,null))[_0x898a('0x40')](handleError(_0x118240,null));};exports[_0x898a('0x24')]=function(_0x32ccb9,_0x50f9e3){return db[_0x898a('0x3d')][_0x898a('0x45')]({'where':{'id':_0x32ccb9[_0x898a('0x42')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x50f9e3,null))['then'](removeEntity(_0x50f9e3,null))[_0x898a('0x40')](handleError(_0x50f9e3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 0a828d1..94ba5b1 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 _0x980a=['SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0x980a,0x1ad));var _0xa980=function(_0x456f9b,_0xc27568){_0x456f9b=_0x456f9b-0x0;var _0x2a2efe=_0x980a[_0x456f9b];return _0x2a2efe;};'use strict';var _=require(_0xa980('0x0'));var util=require(_0xa980('0x1'));var logger=require(_0xa980('0x2'))(_0xa980('0x3'));var moment=require(_0xa980('0x4'));var BPromise=require(_0xa980('0x5'));var rp=require(_0xa980('0x6'));var fs=require('fs');var path=require(_0xa980('0x7'));var rimraf=require(_0xa980('0x8'));var config=require(_0xa980('0x9'));var attributes=require(_0xa980('0xa'));module[_0xa980('0xb')]=function(_0x191766,_0x11a3a2){return _0x191766[_0xa980('0xc')](_0xa980('0xd'),attributes,{'tableName':_0xa980('0xe'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xa980('0xf'),_0xa980('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfaf=['api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','util','../../config/logger'];(function(_0x4d94d1,_0x258abc){var _0x4e96b3=function(_0xdd2774){while(--_0xdd2774){_0x4d94d1['push'](_0x4d94d1['shift']());}};_0x4e96b3(++_0x258abc);}(_0xbfaf,0x1b1));var _0xfbfa=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0xbfaf[_0x193e28];return _0x20ef59;};'use strict';var _=require('lodash');var util=require(_0xfbfa('0x0'));var logger=require(_0xfbfa('0x1'))(_0xfbfa('0x2'));var moment=require(_0xfbfa('0x3'));var BPromise=require(_0xfbfa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbfa('0x5'));var rimraf=require(_0xfbfa('0x6'));var config=require(_0xfbfa('0x7'));var attributes=require(_0xfbfa('0x8'));module[_0xfbfa('0x9')]=function(_0x5c1d5a,_0x221e55){return _0x5c1d5a[_0xfbfa('0xa')](_0xfbfa('0xb'),attributes,{'tableName':_0xfbfa('0xc'),'paranoid':![],'indexes':[{'name':_0xfbfa('0xd'),'fields':['idField',_0xfbfa('0xe')],'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 4cd8683..84ecbb8 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 _0x757a=['request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x60a84e,_0x250500){var _0x11828e=function(_0x3991f2){while(--_0x3991f2){_0x60a84e['push'](_0x60a84e['shift']());}};_0x11828e(++_0x250500);}(_0x757a,0xde));var _0xa757=function(_0x1d3a21,_0x3d7c59){_0x1d3a21=_0x1d3a21-0x0;var _0x25598f=_0x757a[_0x1d3a21];return _0x25598f;};'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']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('SugarcrmField,\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);});});} \ 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(_0x5e9168,_0x2dbde5){var _0x245e5f=function(_0x42511f){while(--_0x42511f){_0x5e9168['push'](_0x5e9168['shift']());}};_0x245e5f(++_0x2dbde5);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x5eb8[_0x1928c9];return _0x51b5fb;};'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 44d41a9..99b8a96 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 _0x2624=['delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','getConfigurations','post','create','/:id/configurations','addConfiguration','put'];(function(_0xc1ca9,_0xba0789){var _0xeb22a1=function(_0x20656c){while(--_0x20656c){_0xc1ca9['push'](_0xc1ca9['shift']());}};_0xeb22a1(++_0xba0789);}(_0x2624,0x1a5));var _0x4262=function(_0x51660a,_0x30077a){_0x51660a=_0x51660a-0x0;var _0x51fab0=_0x2624[_0x51660a];return _0x51fab0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4262('0x0'));var timeout=require('connect-timeout');var express=require(_0x4262('0x1'));var router=express[_0x4262('0x2')]();var auth=require(_0x4262('0x3'));var interaction=require(_0x4262('0x4'));var config=require(_0x4262('0x5'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x4262('0x6')](),controller['index']);router[_0x4262('0x7')](_0x4262('0x8'),auth['isAuthenticated'](),controller[_0x4262('0x9')]);router[_0x4262('0x7')]('/:id/configurations',auth[_0x4262('0x6')](),controller[_0x4262('0xa')]);router[_0x4262('0x7')]('/:id/fields',auth[_0x4262('0x6')](),controller['getFields']);router[_0x4262('0xb')]('/',auth[_0x4262('0x6')](),controller[_0x4262('0xc')]);router[_0x4262('0xb')](_0x4262('0xd'),auth[_0x4262('0x6')](),controller[_0x4262('0xe')]);router[_0x4262('0xf')]('/:id',auth[_0x4262('0x6')](),controller['update']);router[_0x4262('0x10')]('/:id',auth[_0x4262('0x6')](),controller[_0x4262('0x11')]);module[_0x4262('0x12')]=router; \ No newline at end of file +var _0x4f9d=['/:id/fields','getFields','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','/:id','isAuthenticated','/:id/configurations','getConfigurations'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0x4f9d,0x70));var _0xd4f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4f9d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd4f9('0x0'));var util=require(_0xd4f9('0x1'));var path=require(_0xd4f9('0x2'));var timeout=require(_0xd4f9('0x3'));var express=require(_0xd4f9('0x4'));var router=express[_0xd4f9('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd4f9('0x6'));var config=require(_0xd4f9('0x7'));var controller=require(_0xd4f9('0x8'));router[_0xd4f9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd4f9('0x9')](_0xd4f9('0xa'),auth[_0xd4f9('0xb')](),controller['show']);router[_0xd4f9('0x9')](_0xd4f9('0xc'),auth[_0xd4f9('0xb')](),controller[_0xd4f9('0xd')]);router[_0xd4f9('0x9')](_0xd4f9('0xe'),auth['isAuthenticated'](),controller[_0xd4f9('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd4f9('0x10')](_0xd4f9('0xc'),auth[_0xd4f9('0xb')](),controller['addConfiguration']);router['put'](_0xd4f9('0xa'),auth[_0xd4f9('0xb')](),controller[_0xd4f9('0x11')]);router[_0xd4f9('0x12')](_0xd4f9('0xa'),auth['isAuthenticated'](),controller[_0xd4f9('0x13')]);module[_0xd4f9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 1c0c9d7..46ef4a6 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 _0x6af6=['exports','STRING','HelpDesk'];(function(_0x4d475e,_0x1c2276){var _0x491576=function(_0x544dc9){while(--_0x544dc9){_0x4d475e['push'](_0x4d475e['shift']());}};_0x491576(++_0x1c2276);}(_0x6af6,0x1ce));var _0x66af=function(_0x1cc0ae,_0x194422){_0x1cc0ae=_0x1cc0ae-0x0;var _0x43393a=_0x6af6[_0x1cc0ae];return _0x43393a;};'use strict';var Sequelize=require('sequelize');module[_0x66af('0x0')]={'name':{'type':Sequelize[_0x66af('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x66af('0x1')]},'username':{'type':Sequelize[_0x66af('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x66af('0x1')],'allowNull':![],'defaultValue':_0x66af('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x66af('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x66af('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb754=['sequelize','exports','STRING'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xb754,0x1f2));var _0x4b75=function(_0x515cff,_0x27d4a5){_0x515cff=_0x515cff-0x0;var _0x419c0e=_0xb754[_0x515cff];return _0x419c0e;};'use strict';var Sequelize=require(_0x4b75('0x0'));module[_0x4b75('0x1')]={'name':{'type':Sequelize[_0x4b75('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4b75('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4b75('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x4b75('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4b75('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4b75('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 30c3771..7f7b5e1 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 _0xc15e=['picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','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','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VtigerAccount,\x20%s,\x20%s','result','catch','status','end','json','offset','limit','set','reject','save','update','destroy','name','index','map','VtigerAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','count','findAll','rows','show','params','rawAttributes','include','find','create','body','VtigerConfiguration','pick','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','token','success','describe','sessionName','autogenerated','reference','owner','remove','editable','startsWith'];(function(_0x2f91c4,_0x2041a4){var _0x92f521=function(_0x2a4161){while(--_0x2a4161){_0x2f91c4['push'](_0x2f91c4['shift']());}};_0x92f521(++_0x2041a4);}(_0xc15e,0x191));var _0xec15=function(_0x468c71,_0x4dc941){_0x468c71=_0x468c71-0x0;var _0x47aa5b=_0xc15e[_0x468c71];return _0x47aa5b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xec15('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xec15('0x1'));var moment=require(_0xec15('0x2'));var BPromise=require(_0xec15('0x3'));var Mustache=require(_0xec15('0x4'));var util=require(_0xec15('0x5'));var path=require(_0xec15('0x6'));var sox=require(_0xec15('0x7'));var csv=require(_0xec15('0x8'));var ejs=require(_0xec15('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xec15('0xa'));var crypto=require(_0xec15('0xb'));var jsforce=require(_0xec15('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xec15('0x8'));var querystring=require(_0xec15('0xd'));var Papa=require(_0xec15('0xe'));var Redis=require(_0xec15('0xf'));var authService=require(_0xec15('0x10'));var qs=require(_0xec15('0x11'));var as=require(_0xec15('0x12'));var hardwareService=require(_0xec15('0x13'));var logger=require(_0xec15('0x14'))(_0xec15('0x15'));var utils=require('../../config/utils');var config=require(_0xec15('0x16'));var licenseUtil=require(_0xec15('0x17'));var db=require(_0xec15('0x18'))['db'];var integrations=require(_0xec15('0x19'));var jayson=require(_0xec15('0x1a'));var client=jayson[_0xec15('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e999c,_0xe63c7e,_0x13e912,_0x4cfad8){return new BPromise(function(_0x435f27,_0x32a21c){var _0x23075b=_0x4cfad8||client;return _0x23075b[_0xec15('0x1c')](_0x1e999c,_0x13e912)[_0xec15('0x1d')](function(_0x22888c){logger[_0xec15('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0xe63c7e,'request\x20sent');logger[_0xec15('0x1f')](_0xec15('0x20'),_0xe63c7e,_0xec15('0x21'),JSON[_0xec15('0x22')](_0x22888c));if(_0x22888c[_0xec15('0x23')]){if(_0x22888c[_0xec15('0x23')][_0xec15('0x24')]===0x1f4){logger[_0xec15('0x23')]('VtigerAccount,\x20%s,\x20%s',_0xe63c7e,_0x22888c['error'][_0xec15('0x25')]);return _0x32a21c(_0x22888c[_0xec15('0x23')][_0xec15('0x25')]);}logger[_0xec15('0x23')](_0xec15('0x26'),_0xe63c7e,_0x22888c[_0xec15('0x23')][_0xec15('0x25')]);return _0x435f27(_0x22888c[_0xec15('0x23')]['message']);}else{logger[_0xec15('0x1e')](_0xec15('0x26'),_0xe63c7e,_0xec15('0x21'));_0x435f27(_0x22888c[_0xec15('0x27')][_0xec15('0x25')]);}})[_0xec15('0x28')](function(_0x3ae310){logger[_0xec15('0x23')](_0xec15('0x26'),_0xe63c7e,_0x3ae310);_0x32a21c(_0x3ae310);});});}function respondWithStatusCode(_0x28fad5,_0x53df4c){_0x53df4c=_0x53df4c||0xcc;return function(_0x3f9131){if(_0x3f9131){return _0x28fad5['sendStatus'](_0x53df4c);}return _0x28fad5[_0xec15('0x29')](_0x53df4c)[_0xec15('0x2a')]();};}function respondWithResult(_0x35601b,_0xbccde7){_0xbccde7=_0xbccde7||0xc8;return function(_0x166490){if(_0x166490){return _0x35601b[_0xec15('0x29')](_0xbccde7)[_0xec15('0x2b')](_0x166490);}};}function respondWithFilteredResult(_0x2fb384,_0x1a4496){return function(_0x472dbd){if(_0x472dbd){var _0x1b4436=_0x472dbd['count'],_0xd676e1=_0x1a4496[_0xec15('0x2c')],_0x39ddcd=_0x1a4496[_0xec15('0x2c')]+_0x1a4496[_0xec15('0x2d')],_0x3f2e39;if(_0x39ddcd>=_0x1b4436){_0x39ddcd=_0x1b4436;_0x3f2e39=0xc8;}else{_0x3f2e39=0xce;}_0x2fb384[_0xec15('0x29')](_0x3f2e39);return _0x2fb384[_0xec15('0x2e')]('Content-Range',_0xd676e1+'-'+_0x39ddcd+'/'+_0x1b4436)['json'](_0x472dbd);}return null;};}function patchUpdates(_0x25cb92){return function(_0x132f70){try{jsonpatch['apply'](_0x132f70,_0x25cb92,!![]);}catch(_0x5a01d7){return BPromise[_0xec15('0x2f')](_0x5a01d7);}return _0x132f70[_0xec15('0x30')]();};}function saveUpdates(_0x10991c,_0x272abf){return function(_0x18a966){if(_0x18a966){return _0x18a966[_0xec15('0x31')](_0x10991c)[_0xec15('0x1d')](function(_0x5b0ceb){return _0x5b0ceb;});}return null;};}function removeEntity(_0x589c7a,_0x5ada64){return function(_0x245581){if(_0x245581){return _0x245581[_0xec15('0x32')]()[_0xec15('0x1d')](function(){_0x589c7a['status'](0xcc)[_0xec15('0x2a')]();});}};}function handleEntityNotFound(_0x2e9955,_0x55705a){return function(_0x3422a7){if(!_0x3422a7){_0x2e9955['sendStatus'](0x194);}return _0x3422a7;};}function handleError(_0x117b4e,_0x4fc057){_0x4fc057=_0x4fc057||0x1f4;return function(_0x3153a2){logger[_0xec15('0x23')](_0x3153a2['stack']);if(_0x3153a2[_0xec15('0x33')]){delete _0x3153a2['name'];}_0x117b4e[_0xec15('0x29')](_0x4fc057)['send'](_0x3153a2);};}exports[_0xec15('0x34')]=function(_0x14e698,_0x1c25a1){var _0x488707={},_0x507b3b={},_0x5dcbc2={'count':0x0,'rows':[]};var _0x3abbb6=_[_0xec15('0x35')](db[_0xec15('0x36')]['rawAttributes'],function(_0x237774){return{'name':_0x237774[_0xec15('0x37')],'type':_0x237774[_0xec15('0x38')][_0xec15('0x39')]};});_0x507b3b[_0xec15('0x3a')]=_['map'](_0x3abbb6,'name');_0x507b3b[_0xec15('0x3b')]=_[_0xec15('0x3c')](_0x14e698[_0xec15('0x3b')]);_0x507b3b[_0xec15('0x3d')]=_['intersection'](_0x507b3b[_0xec15('0x3a')],_0x507b3b[_0xec15('0x3b')]);_0x488707[_0xec15('0x3e')]=_[_0xec15('0x3f')](_0x507b3b[_0xec15('0x3a')],qs[_0xec15('0x40')](_0x14e698[_0xec15('0x3b')][_0xec15('0x40')]));_0x488707[_0xec15('0x3e')]=_0x488707['attributes'][_0xec15('0x41')]?_0x488707[_0xec15('0x3e')]:_0x507b3b[_0xec15('0x3a')];if(!_0x14e698[_0xec15('0x3b')][_0xec15('0x42')](_0xec15('0x43'))){_0x488707[_0xec15('0x2d')]=qs[_0xec15('0x2d')](_0x14e698[_0xec15('0x3b')]['limit']);_0x488707[_0xec15('0x2c')]=qs[_0xec15('0x2c')](_0x14e698[_0xec15('0x3b')]['offset']);}_0x488707[_0xec15('0x44')]=qs['sort'](_0x14e698['query'][_0xec15('0x45')]);_0x488707['where']=qs[_0xec15('0x3d')](_['pick'](_0x14e698[_0xec15('0x3b')],_0x507b3b[_0xec15('0x3d')]),_0x3abbb6);if(_0x14e698['query']['filter']){_0x488707[_0xec15('0x46')]=_['merge'](_0x488707[_0xec15('0x46')],{'$or':_[_0xec15('0x35')](_0x3abbb6,function(_0xa88e41){if(_0xa88e41['type']!==_0xec15('0x47')){var _0x640dc3={};_0x640dc3[_0xa88e41[_0xec15('0x33')]]={'$like':'%'+_0x14e698[_0xec15('0x3b')][_0xec15('0x48')]+'%'};return _0x640dc3;}})});}_0x488707=_[_0xec15('0x49')]({},_0x488707,_0x14e698[_0xec15('0x4a')]);var _0x5c419c={'where':_0x488707[_0xec15('0x46')]};return db['VtigerAccount'][_0xec15('0x4b')](_0x5c419c)[_0xec15('0x1d')](function(_0x9ec3ed){_0x5dcbc2[_0xec15('0x4b')]=_0x9ec3ed;if(_0x14e698[_0xec15('0x3b')]['includeAll']){_0x488707['include']=[{'all':!![]}];}return db['VtigerAccount'][_0xec15('0x4c')](_0x488707);})[_0xec15('0x1d')](function(_0x5cfb27){_0x5dcbc2[_0xec15('0x4d')]=_0x5cfb27;return _0x5dcbc2;})[_0xec15('0x1d')](respondWithFilteredResult(_0x1c25a1,_0x488707))[_0xec15('0x28')](handleError(_0x1c25a1,null));};exports[_0xec15('0x4e')]=function(_0x2c1edc,_0x4b5868){var _0x29c809={'raw':![],'where':{'id':_0x2c1edc[_0xec15('0x4f')]['id']}},_0x147435={};_0x147435['model']=_[_0xec15('0x3c')](db['VtigerAccount'][_0xec15('0x50')]);_0x147435[_0xec15('0x3b')]=_[_0xec15('0x3c')](_0x2c1edc['query']);_0x147435[_0xec15('0x3d')]=_[_0xec15('0x3f')](_0x147435[_0xec15('0x3a')],_0x147435[_0xec15('0x3b')]);_0x29c809[_0xec15('0x3e')]=_[_0xec15('0x3f')](_0x147435[_0xec15('0x3a')],qs['fields'](_0x2c1edc[_0xec15('0x3b')]['fields']));_0x29c809[_0xec15('0x3e')]=_0x29c809[_0xec15('0x3e')]['length']?_0x29c809['attributes']:_0x147435[_0xec15('0x3a')];if(_0x2c1edc['query']['includeAll']){_0x29c809[_0xec15('0x51')]=[{'all':!![]}];}_0x29c809=_['merge']({},_0x29c809,_0x2c1edc['options']);return db[_0xec15('0x36')][_0xec15('0x52')](_0x29c809)[_0xec15('0x1d')](handleEntityNotFound(_0x4b5868,null))['then'](respondWithResult(_0x4b5868,null))['catch'](handleError(_0x4b5868,null));};exports[_0xec15('0x53')]=function(_0x50e377,_0x47331c){return db[_0xec15('0x36')][_0xec15('0x53')](_0x50e377['body'],{})[_0xec15('0x1d')](respondWithResult(_0x47331c,0xc9))['catch'](handleError(_0x47331c,null));};exports['update']=function(_0xb3c8e4,_0x2138c8){if(_0xb3c8e4[_0xec15('0x54')]['id']){delete _0xb3c8e4[_0xec15('0x54')]['id'];}return db[_0xec15('0x36')]['find']({'where':{'id':_0xb3c8e4[_0xec15('0x4f')]['id']}})[_0xec15('0x1d')](handleEntityNotFound(_0x2138c8,null))[_0xec15('0x1d')](saveUpdates(_0xb3c8e4[_0xec15('0x54')],null))[_0xec15('0x1d')](respondWithResult(_0x2138c8,null))[_0xec15('0x28')](handleError(_0x2138c8,null));};exports[_0xec15('0x32')]=function(_0xa5179c,_0x508324){return db[_0xec15('0x36')][_0xec15('0x52')]({'where':{'id':_0xa5179c[_0xec15('0x4f')]['id']}})[_0xec15('0x1d')](handleEntityNotFound(_0x508324,null))['then'](removeEntity(_0x508324,null))[_0xec15('0x28')](handleError(_0x508324,null));};exports['getConfigurations']=function(_0x451cb7,_0x3cd286,_0x86c704){var _0xc9758e={};var _0x11907f={};var _0x2ddb4c;var _0x5b6f8;return db[_0xec15('0x36')]['findOne']({'where':{'id':_0x451cb7['params']['id']}})['then'](handleEntityNotFound(_0x3cd286,null))['then'](function(_0x1c9f57){if(_0x1c9f57){_0x2ddb4c=_0x1c9f57;_0x11907f[_0xec15('0x3a')]=_['keys'](db[_0xec15('0x55')][_0xec15('0x50')]);_0x11907f[_0xec15('0x3b')]=_[_0xec15('0x3c')](_0x451cb7[_0xec15('0x3b')]);_0x11907f['filters']=_[_0xec15('0x3f')](_0x11907f[_0xec15('0x3a')],_0x11907f['query']);_0xc9758e[_0xec15('0x3e')]=_[_0xec15('0x3f')](_0x11907f[_0xec15('0x3a')],qs[_0xec15('0x40')](_0x451cb7[_0xec15('0x3b')][_0xec15('0x40')]));_0xc9758e['attributes']=_0xc9758e[_0xec15('0x3e')][_0xec15('0x41')]?_0xc9758e[_0xec15('0x3e')]:_0x11907f[_0xec15('0x3a')];_0xc9758e[_0xec15('0x44')]=qs['sort'](_0x451cb7[_0xec15('0x3b')][_0xec15('0x45')]);_0xc9758e['where']=qs[_0xec15('0x3d')](_[_0xec15('0x56')](_0x451cb7[_0xec15('0x3b')],_0x11907f[_0xec15('0x3d')]));if(_0x451cb7[_0xec15('0x3b')]['filter']){_0xc9758e[_0xec15('0x46')]=_[_0xec15('0x49')](_0xc9758e[_0xec15('0x46')],{'$or':_['map'](_0xc9758e[_0xec15('0x3e')],function(_0x46c9e5){var _0x406a81={};_0x406a81[_0x46c9e5]={'$like':'%'+_0x451cb7[_0xec15('0x3b')][_0xec15('0x48')]+'%'};return _0x406a81;})});}_0xc9758e=_[_0xec15('0x49')]({},_0xc9758e,_0x451cb7[_0xec15('0x4a')]);return _0x2ddb4c[_0xec15('0x57')](_0xc9758e);}})['then'](function(_0x2592b6){if(_0x2592b6){_0x5b6f8=_0x2592b6[_0xec15('0x41')];if(!_0x451cb7[_0xec15('0x3b')][_0xec15('0x42')](_0xec15('0x43'))){_0xc9758e['limit']=qs[_0xec15('0x2d')](_0x451cb7[_0xec15('0x3b')][_0xec15('0x2d')]);_0xc9758e['offset']=qs['offset'](_0x451cb7['query'][_0xec15('0x2c')]);}return _0x2ddb4c['getConfigurations'](_0xc9758e);}})[_0xec15('0x1d')](function(_0x5368f3){if(_0x5368f3){return _0x5368f3?{'count':_0x5b6f8,'rows':_0x5368f3}:null;}})[_0xec15('0x1d')](respondWithResult(_0x3cd286,null))[_0xec15('0x28')](handleError(_0x3cd286,null));};exports[_0xec15('0x58')]=function(_0x5a880e,_0x13a918,_0x5be6d6){if(_0x5a880e['body']['id']){delete _0x5a880e[_0xec15('0x54')]['id'];}return db['VtigerAccount'][_0xec15('0x59')]({'where':{'id':_0x5a880e[_0xec15('0x4f')]['id']}})[_0xec15('0x1d')](handleEntityNotFound(_0x13a918,null))[_0xec15('0x1d')](function(_0x21b577){if(_0x21b577){_0x5a880e[_0xec15('0x54')]['AccountId']=_0x21b577['id'];_0x5a880e[_0xec15('0x54')][_0xec15('0x5a')]=integrations[_0xec15('0x5b')](_0x5a880e[_0xec15('0x54')][_0xec15('0x5c')],_0x5a880e[_0xec15('0x54')][_0xec15('0x38')]);_0x5a880e['body']['Descriptions']=integrations[_0xec15('0x5d')](_0x5a880e['body'][_0xec15('0x5c')],_0x5a880e[_0xec15('0x54')][_0xec15('0x38')]);return db['VtigerConfiguration'][_0xec15('0x53')](_0x5a880e[_0xec15('0x54')],{'include':[{'model':db[_0xec15('0x5e')],'as':'Subjects'},{'model':db[_0xec15('0x5e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x13a918,null))[_0xec15('0x28')](handleError(_0x13a918,null));};var md5=require(_0xec15('0x5f'));exports[_0xec15('0x60')]=function(_0x4a2ba8,_0x7c48d0,_0xc7a3f9){var _0x923441=null;var _0x2d8c33=null;var _0x2c284f=null;var _0x3ce3a6=null;var _0x8dd40e='';return db[_0xec15('0x36')][_0xec15('0x59')]({'where':{'id':_0x4a2ba8[_0xec15('0x4f')]['id']},'attributes':['id',_0xec15('0x33'),_0xec15('0x61'),_0xec15('0x62'),_0xec15('0x63'),_0xec15('0x64'),_0xec15('0x65'),_0xec15('0x66')]})[_0xec15('0x1d')](handleEntityNotFound(_0x7c48d0,null))[_0xec15('0x1d')](function(_0xbf38dc){if(_0xbf38dc){_0x923441=_0xbf38dc[_0xec15('0x61')];_0x2d8c33=_0xbf38dc['accessKey'];_0x2c284f=_0xbf38dc[_0xec15('0x63')];_0x8dd40e=_0xbf38dc[_0xec15('0x64')];var _0x38a27c=_0x8dd40e[_0xec15('0x67')](-0x1);if(_0x38a27c==='/'){_0x8dd40e=_0x8dd40e[_0xec15('0x68')](0x0,_0x8dd40e[_0xec15('0x69')](_0x38a27c));}_0x3ce3a6=util[_0xec15('0x6a')](_0xec15('0x6b'),_0x8dd40e);var _0x36166e={'method':_0xec15('0x6c'),'uri':_0x3ce3a6,'qs':{'operation':'getchallenge','username':_0xbf38dc[_0xec15('0x61')]},'json':!![]};return rp(_0x36166e);}})['then'](function(_0x4f4ca9){if(_0x4f4ca9['success']){var _0x324c63={'method':'POST','uri':_0x3ce3a6,'form':{'operation':'login','username':_0x923441,'accessKey':md5(_0x4f4ca9[_0xec15('0x27')][_0xec15('0x6d')]+_0x2d8c33)},'json':!![]};return rp(_0x324c63);}})[_0xec15('0x1d')](function(_0x1c7776){if(_0x1c7776[_0xec15('0x6e')]){var _0x34040c={'method':_0xec15('0x6c'),'uri':_0x3ce3a6,'qs':{'operation':_0xec15('0x6f'),'username':_0x923441,'sessionName':_0x1c7776[_0xec15('0x27')][_0xec15('0x70')],'elementType':_0x2c284f},'json':!![]};return rp(_0x34040c);}})[_0xec15('0x1d')](function(_0x3e29a9){if(_0x3e29a9[_0xec15('0x6e')]){var _0x40c3a0=[_0xec15('0x71'),_0xec15('0x72'),_0xec15('0x73')];_['remove'](_0x3e29a9[_0xec15('0x27')]['fields'],function(_0x2ab00b){return _0x40c3a0['includes'](_0x2ab00b[_0xec15('0x38')][_0xec15('0x33')]);});_[_0xec15('0x74')](_0x3e29a9['result']['fields'],function(_0x1c59d2){return _0x1c59d2[_0xec15('0x75')]==='false';});return{'count':_0x3e29a9[_0xec15('0x27')][_0xec15('0x40')][_0xec15('0x41')],'rows':_[_0xec15('0x35')](_0x3e29a9[_0xec15('0x27')][_0xec15('0x40')],function(_0x16ab91){return{'id':_0x16ab91['name'],'name':_0x16ab91['label'],'custom':_[_0xec15('0x76')](_0x16ab91[_0xec15('0x33')],'cf_')?!![]:![],'options':_0x16ab91[_0xec15('0x38')]['name']===_0xec15('0x77')&&_0x16ab91['type'][_0xec15('0x78')][_0xec15('0x41')]>0x0?_[_0xec15('0x35')](_0x16ab91['type'][_0xec15('0x78')],function(_0x5e1f3a){return{'name':_0x5e1f3a[_0xec15('0x79')],'value':_0x5e1f3a[_0xec15('0x7a')]};}):[]};})};}})['then'](respondWithResult(_0x7c48d0,null))[_0xec15('0x28')](function(_0x583cc7){console[_0xec15('0x7b')](_0xec15('0x7c')+_0x583cc7);var _0x436eca=_0x4a2ba8[_0xec15('0x3b')][_0xec15('0x7d')]?0x1f4:_0x583cc7[_0xec15('0x7e')]||0x1f4;logger[_0xec15('0x23')](_0xec15('0x7f'),'getFields',_0x436eca,JSON[_0xec15('0x22')](_0x583cc7));delete _0x583cc7[_0xec15('0x33')];if(_0x436eca===0x191){_0x436eca=0x190;}_0x7c48d0[_0xec15('0x29')](_0x436eca)[_0xec15('0x80')](_0x4a2ba8['query']['test']?{'message':_0xec15('0x81'),'statusCode':_0x583cc7['statusCode']}:_0x583cc7);});}; \ No newline at end of file +var _0x9147=['statusCode','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','VtigerAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','VtigerAccount','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','getConfigurations','VtigerConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','channel','Descriptions','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','username','accessKey','lastIndexOf','%s/webservice.php','GET','getchallenge','success','login','token','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','cf_','picklistValues','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials'];(function(_0x3619,_0x1ac6b9){var _0x490897=function(_0x1ead4f){while(--_0x1ead4f){_0x3619['push'](_0x3619['shift']());}};_0x490897(++_0x1ac6b9);}(_0x9147,0x7f));var _0x7914=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x9147[_0x5c351c];return _0x26f3b3;};'use strict';var pdf=require(_0x7914('0x0'));var emlformat=require(_0x7914('0x1'));var rimraf=require(_0x7914('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7914('0x3'));var moment=require(_0x7914('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7914('0x5'));var util=require(_0x7914('0x6'));var path=require(_0x7914('0x7'));var sox=require(_0x7914('0x8'));var csv=require('to-csv');var ejs=require(_0x7914('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7914('0xa'));var crypto=require('crypto');var jsforce=require(_0x7914('0xb'));var deskjs=require(_0x7914('0xc'));var toCsv=require(_0x7914('0xd'));var querystring=require(_0x7914('0xe'));var Papa=require(_0x7914('0xf'));var Redis=require(_0x7914('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7914('0x11'));var as=require(_0x7914('0x12'));var hardwareService=require(_0x7914('0x13'));var logger=require(_0x7914('0x14'))('api');var utils=require(_0x7914('0x15'));var config=require(_0x7914('0x16'));var licenseUtil=require(_0x7914('0x17'));var db=require(_0x7914('0x18'))['db'];var integrations=require(_0x7914('0x19'));var jayson=require(_0x7914('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48bb08,_0x2089d7,_0x543680,_0x13c859){return new BPromise(function(_0x364785,_0x225a08){var _0x38da04=_0x13c859||client;return _0x38da04['request'](_0x48bb08,_0x543680)[_0x7914('0x1b')](function(_0x1be13a){logger[_0x7914('0x1c')]('VtigerAccount,\x20%s,\x20%s',_0x2089d7,_0x7914('0x1d'));logger[_0x7914('0x1e')](_0x7914('0x1f'),_0x2089d7,_0x7914('0x1d'),JSON['stringify'](_0x1be13a));if(_0x1be13a['error']){if(_0x1be13a[_0x7914('0x20')]['code']===0x1f4){logger['error'](_0x7914('0x21'),_0x2089d7,_0x1be13a[_0x7914('0x20')][_0x7914('0x22')]);return _0x225a08(_0x1be13a[_0x7914('0x20')][_0x7914('0x22')]);}logger[_0x7914('0x20')](_0x7914('0x21'),_0x2089d7,_0x1be13a[_0x7914('0x20')]['message']);return _0x364785(_0x1be13a[_0x7914('0x20')][_0x7914('0x22')]);}else{logger[_0x7914('0x1c')](_0x7914('0x21'),_0x2089d7,_0x7914('0x1d'));_0x364785(_0x1be13a[_0x7914('0x23')][_0x7914('0x22')]);}})['catch'](function(_0x274d33){logger[_0x7914('0x20')](_0x7914('0x21'),_0x2089d7,_0x274d33);_0x225a08(_0x274d33);});});}function respondWithStatusCode(_0x21763f,_0x60c7c6){_0x60c7c6=_0x60c7c6||0xcc;return function(_0x495541){if(_0x495541){return _0x21763f[_0x7914('0x24')](_0x60c7c6);}return _0x21763f[_0x7914('0x25')](_0x60c7c6)['end']();};}function respondWithResult(_0x1a27ba,_0x1d7948){_0x1d7948=_0x1d7948||0xc8;return function(_0x1786f8){if(_0x1786f8){return _0x1a27ba[_0x7914('0x25')](_0x1d7948)[_0x7914('0x26')](_0x1786f8);}};}function respondWithFilteredResult(_0x2d8ac4,_0x5f5609){return function(_0x3e1de5){if(_0x3e1de5){var _0x1adbe8=_0x3e1de5[_0x7914('0x27')],_0x3a62ff=_0x5f5609[_0x7914('0x28')],_0x124011=_0x5f5609[_0x7914('0x28')]+_0x5f5609[_0x7914('0x29')],_0x4f7281;if(_0x124011>=_0x1adbe8){_0x124011=_0x1adbe8;_0x4f7281=0xc8;}else{_0x4f7281=0xce;}_0x2d8ac4['status'](_0x4f7281);return _0x2d8ac4[_0x7914('0x2a')](_0x7914('0x2b'),_0x3a62ff+'-'+_0x124011+'/'+_0x1adbe8)[_0x7914('0x26')](_0x3e1de5);}return null;};}function patchUpdates(_0x3f59a8){return function(_0x19e237){try{jsonpatch['apply'](_0x19e237,_0x3f59a8,!![]);}catch(_0x5eaf3e){return BPromise[_0x7914('0x2c')](_0x5eaf3e);}return _0x19e237[_0x7914('0x2d')]();};}function saveUpdates(_0x1dd842,_0x57d32e){return function(_0x2d2306){if(_0x2d2306){return _0x2d2306[_0x7914('0x2e')](_0x1dd842)['then'](function(_0xf06fd2){return _0xf06fd2;});}return null;};}function removeEntity(_0x7f3742,_0x3974ce){return function(_0x497952){if(_0x497952){return _0x497952[_0x7914('0x2f')]()[_0x7914('0x1b')](function(){_0x7f3742['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30263a,_0x23f970){return function(_0xf9384b){if(!_0xf9384b){_0x30263a['sendStatus'](0x194);}return _0xf9384b;};}function handleError(_0x5c1fce,_0x17c9ce){_0x17c9ce=_0x17c9ce||0x1f4;return function(_0x3ac08c){logger[_0x7914('0x20')](_0x3ac08c[_0x7914('0x30')]);if(_0x3ac08c[_0x7914('0x31')]){delete _0x3ac08c[_0x7914('0x31')];}_0x5c1fce[_0x7914('0x25')](_0x17c9ce)[_0x7914('0x32')](_0x3ac08c);};}exports[_0x7914('0x33')]=function(_0x55abb4,_0x35106e){var _0x3ca53a={},_0x429461={},_0x4c96ed={'count':0x0,'rows':[]};var _0xdc7085=_[_0x7914('0x34')](db[_0x7914('0x35')]['rawAttributes'],function(_0x4132d7){return{'name':_0x4132d7[_0x7914('0x36')],'type':_0x4132d7[_0x7914('0x37')][_0x7914('0x38')]};});_0x429461['model']=_[_0x7914('0x34')](_0xdc7085,_0x7914('0x31'));_0x429461['query']=_[_0x7914('0x39')](_0x55abb4[_0x7914('0x3a')]);_0x429461[_0x7914('0x3b')]=_[_0x7914('0x3c')](_0x429461[_0x7914('0x3d')],_0x429461['query']);_0x3ca53a['attributes']=_['intersection'](_0x429461[_0x7914('0x3d')],qs[_0x7914('0x3e')](_0x55abb4[_0x7914('0x3a')][_0x7914('0x3e')]));_0x3ca53a[_0x7914('0x3f')]=_0x3ca53a['attributes'][_0x7914('0x40')]?_0x3ca53a[_0x7914('0x3f')]:_0x429461[_0x7914('0x3d')];if(!_0x55abb4['query']['hasOwnProperty'](_0x7914('0x41'))){_0x3ca53a[_0x7914('0x29')]=qs[_0x7914('0x29')](_0x55abb4['query'][_0x7914('0x29')]);_0x3ca53a[_0x7914('0x28')]=qs[_0x7914('0x28')](_0x55abb4[_0x7914('0x3a')][_0x7914('0x28')]);}_0x3ca53a[_0x7914('0x42')]=qs['sort'](_0x55abb4[_0x7914('0x3a')][_0x7914('0x43')]);_0x3ca53a[_0x7914('0x44')]=qs[_0x7914('0x3b')](_[_0x7914('0x45')](_0x55abb4['query'],_0x429461[_0x7914('0x3b')]),_0xdc7085);if(_0x55abb4[_0x7914('0x3a')][_0x7914('0x46')]){_0x3ca53a[_0x7914('0x44')]=_['merge'](_0x3ca53a[_0x7914('0x44')],{'$or':_[_0x7914('0x34')](_0xdc7085,function(_0x18ef87){if(_0x18ef87[_0x7914('0x37')]!==_0x7914('0x47')){var _0x188f54={};_0x188f54[_0x18ef87[_0x7914('0x31')]]={'$like':'%'+_0x55abb4['query']['filter']+'%'};return _0x188f54;}})});}_0x3ca53a=_['merge']({},_0x3ca53a,_0x55abb4[_0x7914('0x48')]);var _0x2ce4eb={'where':_0x3ca53a[_0x7914('0x44')]};return db['VtigerAccount'][_0x7914('0x27')](_0x2ce4eb)['then'](function(_0x134aeb){_0x4c96ed[_0x7914('0x27')]=_0x134aeb;if(_0x55abb4[_0x7914('0x3a')][_0x7914('0x49')]){_0x3ca53a[_0x7914('0x4a')]=[{'all':!![]}];}return db['VtigerAccount'][_0x7914('0x4b')](_0x3ca53a);})[_0x7914('0x1b')](function(_0x448ad7){_0x4c96ed[_0x7914('0x4c')]=_0x448ad7;return _0x4c96ed;})[_0x7914('0x1b')](respondWithFilteredResult(_0x35106e,_0x3ca53a))[_0x7914('0x4d')](handleError(_0x35106e,null));};exports[_0x7914('0x4e')]=function(_0x13b8b1,_0x210c3d){var _0x2397cb={'raw':![],'where':{'id':_0x13b8b1[_0x7914('0x4f')]['id']}},_0x1a1829={};_0x1a1829[_0x7914('0x3d')]=_[_0x7914('0x39')](db[_0x7914('0x35')][_0x7914('0x50')]);_0x1a1829[_0x7914('0x3a')]=_['keys'](_0x13b8b1[_0x7914('0x3a')]);_0x1a1829[_0x7914('0x3b')]=_[_0x7914('0x3c')](_0x1a1829[_0x7914('0x3d')],_0x1a1829[_0x7914('0x3a')]);_0x2397cb[_0x7914('0x3f')]=_[_0x7914('0x3c')](_0x1a1829[_0x7914('0x3d')],qs[_0x7914('0x3e')](_0x13b8b1[_0x7914('0x3a')]['fields']));_0x2397cb[_0x7914('0x3f')]=_0x2397cb[_0x7914('0x3f')][_0x7914('0x40')]?_0x2397cb[_0x7914('0x3f')]:_0x1a1829[_0x7914('0x3d')];if(_0x13b8b1[_0x7914('0x3a')][_0x7914('0x49')]){_0x2397cb[_0x7914('0x4a')]=[{'all':!![]}];}_0x2397cb=_[_0x7914('0x51')]({},_0x2397cb,_0x13b8b1['options']);return db['VtigerAccount'][_0x7914('0x52')](_0x2397cb)['then'](handleEntityNotFound(_0x210c3d,null))[_0x7914('0x1b')](respondWithResult(_0x210c3d,null))[_0x7914('0x4d')](handleError(_0x210c3d,null));};exports[_0x7914('0x53')]=function(_0x559d03,_0x1c628e){return db[_0x7914('0x35')][_0x7914('0x53')](_0x559d03['body'],{})[_0x7914('0x1b')](respondWithResult(_0x1c628e,0xc9))[_0x7914('0x4d')](handleError(_0x1c628e,null));};exports[_0x7914('0x2e')]=function(_0x393cb1,_0x2ea909){if(_0x393cb1[_0x7914('0x54')]['id']){delete _0x393cb1['body']['id'];}return db[_0x7914('0x35')]['find']({'where':{'id':_0x393cb1['params']['id']}})['then'](handleEntityNotFound(_0x2ea909,null))[_0x7914('0x1b')](saveUpdates(_0x393cb1[_0x7914('0x54')],null))[_0x7914('0x1b')](respondWithResult(_0x2ea909,null))[_0x7914('0x4d')](handleError(_0x2ea909,null));};exports[_0x7914('0x2f')]=function(_0x5f0e10,_0x1c48bc){return db[_0x7914('0x35')][_0x7914('0x52')]({'where':{'id':_0x5f0e10[_0x7914('0x4f')]['id']}})[_0x7914('0x1b')](handleEntityNotFound(_0x1c48bc,null))[_0x7914('0x1b')](removeEntity(_0x1c48bc,null))[_0x7914('0x4d')](handleError(_0x1c48bc,null));};exports[_0x7914('0x55')]=function(_0x39d277,_0x12f4ae,_0x395760){var _0x18190c={};var _0x589086={};var _0x2086d1;var _0x583a86;return db[_0x7914('0x35')]['findOne']({'where':{'id':_0x39d277[_0x7914('0x4f')]['id']}})[_0x7914('0x1b')](handleEntityNotFound(_0x12f4ae,null))[_0x7914('0x1b')](function(_0x4affbc){if(_0x4affbc){_0x2086d1=_0x4affbc;_0x589086['model']=_[_0x7914('0x39')](db[_0x7914('0x56')]['rawAttributes']);_0x589086[_0x7914('0x3a')]=_[_0x7914('0x39')](_0x39d277['query']);_0x589086[_0x7914('0x3b')]=_['intersection'](_0x589086[_0x7914('0x3d')],_0x589086[_0x7914('0x3a')]);_0x18190c[_0x7914('0x3f')]=_[_0x7914('0x3c')](_0x589086[_0x7914('0x3d')],qs[_0x7914('0x3e')](_0x39d277[_0x7914('0x3a')][_0x7914('0x3e')]));_0x18190c[_0x7914('0x3f')]=_0x18190c['attributes']['length']?_0x18190c[_0x7914('0x3f')]:_0x589086['model'];_0x18190c['order']=qs[_0x7914('0x43')](_0x39d277['query'][_0x7914('0x43')]);_0x18190c[_0x7914('0x44')]=qs[_0x7914('0x3b')](_[_0x7914('0x45')](_0x39d277[_0x7914('0x3a')],_0x589086['filters']));if(_0x39d277['query'][_0x7914('0x46')]){_0x18190c[_0x7914('0x44')]=_['merge'](_0x18190c[_0x7914('0x44')],{'$or':_['map'](_0x18190c[_0x7914('0x3f')],function(_0x2d4ec0){var _0x5477d5={};_0x5477d5[_0x2d4ec0]={'$like':'%'+_0x39d277[_0x7914('0x3a')][_0x7914('0x46')]+'%'};return _0x5477d5;})});}_0x18190c=_['merge']({},_0x18190c,_0x39d277['options']);return _0x2086d1[_0x7914('0x55')](_0x18190c);}})['then'](function(_0x4bd0c9){if(_0x4bd0c9){_0x583a86=_0x4bd0c9['length'];if(!_0x39d277[_0x7914('0x3a')][_0x7914('0x57')](_0x7914('0x41'))){_0x18190c[_0x7914('0x29')]=qs[_0x7914('0x29')](_0x39d277[_0x7914('0x3a')][_0x7914('0x29')]);_0x18190c[_0x7914('0x28')]=qs[_0x7914('0x28')](_0x39d277[_0x7914('0x3a')]['offset']);}return _0x2086d1[_0x7914('0x55')](_0x18190c);}})[_0x7914('0x1b')](function(_0x35a783){if(_0x35a783){return _0x35a783?{'count':_0x583a86,'rows':_0x35a783}:null;}})[_0x7914('0x1b')](respondWithResult(_0x12f4ae,null))['catch'](handleError(_0x12f4ae,null));};exports[_0x7914('0x58')]=function(_0x121bfa,_0x2d3b9c,_0x2c7070){if(_0x121bfa[_0x7914('0x54')]['id']){delete _0x121bfa['body']['id'];}return db[_0x7914('0x35')][_0x7914('0x59')]({'where':{'id':_0x121bfa[_0x7914('0x4f')]['id']}})[_0x7914('0x1b')](handleEntityNotFound(_0x2d3b9c,null))[_0x7914('0x1b')](function(_0x4edede){if(_0x4edede){_0x121bfa['body'][_0x7914('0x5a')]=_0x4edede['id'];_0x121bfa['body']['Subjects']=integrations['getSubjects'](_0x121bfa['body'][_0x7914('0x5b')],_0x121bfa['body'][_0x7914('0x37')]);_0x121bfa[_0x7914('0x54')][_0x7914('0x5c')]=integrations['getDescriptions'](_0x121bfa['body'][_0x7914('0x5b')],_0x121bfa[_0x7914('0x54')][_0x7914('0x37')]);return db[_0x7914('0x56')][_0x7914('0x53')](_0x121bfa[_0x7914('0x54')],{'include':[{'model':db[_0x7914('0x5d')],'as':'Subjects'},{'model':db[_0x7914('0x5d')],'as':_0x7914('0x5c')}]});}return null;})[_0x7914('0x1b')](respondWithResult(_0x2d3b9c,null))[_0x7914('0x4d')](handleError(_0x2d3b9c,null));};var md5=require(_0x7914('0x5e'));exports[_0x7914('0x5f')]=function(_0x1f552c,_0x2e7cdf,_0x584be7){var _0x9bbc55=null;var _0x3564dd=null;var _0x1e54b0=null;var _0x210b63=null;var _0x558820='';return db[_0x7914('0x35')][_0x7914('0x59')]({'where':{'id':_0x1f552c['params']['id']},'attributes':['id',_0x7914('0x31'),'username',_0x7914('0x60'),_0x7914('0x61'),_0x7914('0x62'),_0x7914('0x63'),'accessKey']})[_0x7914('0x1b')](handleEntityNotFound(_0x2e7cdf,null))[_0x7914('0x1b')](function(_0x478365){if(_0x478365){_0x9bbc55=_0x478365[_0x7914('0x64')];_0x3564dd=_0x478365[_0x7914('0x65')];_0x1e54b0=_0x478365[_0x7914('0x61')];_0x558820=_0x478365[_0x7914('0x62')];var _0x7d0a2e=_0x558820['slice'](-0x1);if(_0x7d0a2e==='/'){_0x558820=_0x558820['substring'](0x0,_0x558820[_0x7914('0x66')](_0x7d0a2e));}_0x210b63=util['format'](_0x7914('0x67'),_0x558820);var _0x34d101={'method':_0x7914('0x68'),'uri':_0x210b63,'qs':{'operation':_0x7914('0x69'),'username':_0x478365[_0x7914('0x64')]},'json':!![]};return rp(_0x34d101);}})[_0x7914('0x1b')](function(_0x192f98){if(_0x192f98[_0x7914('0x6a')]){var _0x29964f={'method':'POST','uri':_0x210b63,'form':{'operation':_0x7914('0x6b'),'username':_0x9bbc55,'accessKey':md5(_0x192f98['result'][_0x7914('0x6c')]+_0x3564dd)},'json':!![]};return rp(_0x29964f);}})['then'](function(_0x339c49){if(_0x339c49[_0x7914('0x6a')]){var _0x196d74={'method':_0x7914('0x68'),'uri':_0x210b63,'qs':{'operation':'describe','username':_0x9bbc55,'sessionName':_0x339c49[_0x7914('0x23')][_0x7914('0x6d')],'elementType':_0x1e54b0},'json':!![]};return rp(_0x196d74);}})[_0x7914('0x1b')](function(_0x2eb3cc){if(_0x2eb3cc[_0x7914('0x6a')]){var _0x39f1ba=[_0x7914('0x6e'),_0x7914('0x6f'),_0x7914('0x70')];_[_0x7914('0x71')](_0x2eb3cc['result'][_0x7914('0x3e')],function(_0x28d006){return _0x39f1ba[_0x7914('0x72')](_0x28d006[_0x7914('0x37')][_0x7914('0x31')]);});_[_0x7914('0x71')](_0x2eb3cc[_0x7914('0x23')][_0x7914('0x3e')],function(_0xae7e2f){return _0xae7e2f[_0x7914('0x73')]===_0x7914('0x74');});return{'count':_0x2eb3cc[_0x7914('0x23')][_0x7914('0x3e')][_0x7914('0x40')],'rows':_[_0x7914('0x34')](_0x2eb3cc[_0x7914('0x23')][_0x7914('0x3e')],function(_0x1ee330){return{'id':_0x1ee330[_0x7914('0x31')],'name':_0x1ee330[_0x7914('0x75')],'custom':_['startsWith'](_0x1ee330['name'],_0x7914('0x76'))?!![]:![],'options':_0x1ee330[_0x7914('0x37')][_0x7914('0x31')]==='picklist'&&_0x1ee330[_0x7914('0x37')][_0x7914('0x77')][_0x7914('0x40')]>0x0?_['map'](_0x1ee330[_0x7914('0x37')][_0x7914('0x77')],function(_0x1c0b06){return{'name':_0x1c0b06['label'],'value':_0x1c0b06['value']};}):[]};})};}})[_0x7914('0x1b')](respondWithResult(_0x2e7cdf,null))['catch'](function(_0x3f76ef){console['log'](_0x7914('0x78')+_0x3f76ef);var _0x2129a3=_0x1f552c[_0x7914('0x3a')][_0x7914('0x79')]?0x1f4:_0x3f76ef['statusCode']||0x1f4;logger[_0x7914('0x20')](_0x7914('0x7a'),_0x7914('0x5f'),_0x2129a3,JSON[_0x7914('0x7b')](_0x3f76ef));delete _0x3f76ef[_0x7914('0x31')];if(_0x2129a3===0x191){_0x2129a3=0x190;}_0x2e7cdf['status'](_0x2129a3)[_0x7914('0x32')](_0x1f552c['query'][_0x7914('0x79')]?{'message':_0x7914('0x7c'),'statusCode':_0x3f76ef[_0x7914('0x7d')]}:_0x3f76ef);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index ac402a3..f9936a2 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 _0xc6e4=['api','moment','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger'];(function(_0x1a1a3b,_0xc8ce3c){var _0x57bd21=function(_0x15a067){while(--_0x15a067){_0x1a1a3b['push'](_0x1a1a3b['shift']());}};_0x57bd21(++_0xc8ce3c);}(_0xc6e4,0x8e));var _0x4c6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc6e4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4c6e('0x0'));var util=require('util');var logger=require(_0x4c6e('0x1'))(_0x4c6e('0x2'));var moment=require(_0x4c6e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c6e('0x4'));var rimraf=require(_0x4c6e('0x5'));var config=require(_0x4c6e('0x6'));var attributes=require(_0x4c6e('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x4c6e('0x8')]=function(_0x485188,_0x3ae16a){return _0x485188[_0x4c6e('0x9')](_0x4c6e('0xa'),attributes,{'tableName':_0x4c6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cae=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','util','../../config/logger','bluebird','request-promise','path'];(function(_0x41575f,_0x588f6f){var _0x529953=function(_0x194295){while(--_0x194295){_0x41575f['push'](_0x41575f['shift']());}};_0x529953(++_0x588f6f);}(_0x8cae,0x7f));var _0xe8ca=function(_0x2db634,_0x2be5a0){_0x2db634=_0x2db634-0x0;var _0x2890da=_0x8cae[_0x2db634];return _0x2890da;};'use strict';var _=require('lodash');var util=require(_0xe8ca('0x0'));var logger=require(_0xe8ca('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe8ca('0x2'));var rp=require(_0xe8ca('0x3'));var fs=require('fs');var path=require(_0xe8ca('0x4'));var rimraf=require(_0xe8ca('0x5'));var config=require(_0xe8ca('0x6'));var attributes=require(_0xe8ca('0x7'));var integrations=require(_0xe8ca('0x8'));module[_0xe8ca('0x9')]=function(_0x3ca99e,_0x29da1e){return _0x3ca99e['define'](_0xe8ca('0xa'),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 a8a9964..1c1bb13 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 _0xb2f7=['catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','findAll','options','raw','attributes','include','model','GetVtigerAccount','VtigerAccount','where','info','ShowVtigerAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb2f7,0xa6));var _0x7b2f=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xb2f7[_0x12d033];return _0x3b4e80;};'use strict';var _=require('lodash');var util=require(_0x7b2f('0x0'));var moment=require(_0x7b2f('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b2f('0x2'));var fs=require('fs');var Redis=require(_0x7b2f('0x3'));var db=require(_0x7b2f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b2f('0x5'))('rpc');var config=require(_0x7b2f('0x6'));var jayson=require(_0x7b2f('0x7'));var client=jayson[_0x7b2f('0x8')][_0x7b2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ebd4a,_0x287cf4,_0x18824e){return new BPromise(function(_0x58212a,_0x47caa0){return client[_0x7b2f('0xa')](_0x3ebd4a,_0x18824e)[_0x7b2f('0xb')](function(_0x5b41ff){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x287cf4,_0x7b2f('0xc'));logger[_0x7b2f('0xd')](_0x7b2f('0xe'),_0x287cf4,_0x7b2f('0xc'),JSON[_0x7b2f('0xf')](_0x5b41ff));if(_0x5b41ff[_0x7b2f('0x10')]){if(_0x5b41ff[_0x7b2f('0x10')][_0x7b2f('0x11')]===0x1f4){logger[_0x7b2f('0x10')](_0x7b2f('0x12'),_0x287cf4,_0x5b41ff[_0x7b2f('0x10')][_0x7b2f('0x13')]);return _0x47caa0(_0x5b41ff['error'][_0x7b2f('0x13')]);}logger[_0x7b2f('0x10')](_0x7b2f('0x12'),_0x287cf4,_0x5b41ff[_0x7b2f('0x10')][_0x7b2f('0x13')]);return _0x58212a(_0x5b41ff[_0x7b2f('0x10')][_0x7b2f('0x13')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x287cf4,_0x7b2f('0xc'));_0x58212a(_0x5b41ff[_0x7b2f('0x14')]['message']);}})['catch'](function(_0x2b98f8){logger[_0x7b2f('0x10')](_0x7b2f('0x12'),_0x287cf4,_0x2b98f8);_0x47caa0(_0x2b98f8);});});}exports['GetVtigerAccount']=function(_0x25e43d){var _0x2ff0b9=this;return new Promise(function(_0x4f381a,_0x11d948){return db['VtigerAccount'][_0x7b2f('0x15')]({'raw':_0x25e43d[_0x7b2f('0x16')]?_0x25e43d[_0x7b2f('0x16')][_0x7b2f('0x17')]===undefined?!![]:![]:!![],'where':_0x25e43d[_0x7b2f('0x16')]?_0x25e43d[_0x7b2f('0x16')]['where']||null:null,'attributes':_0x25e43d['options']?_0x25e43d[_0x7b2f('0x16')][_0x7b2f('0x18')]||null:null,'limit':_0x25e43d[_0x7b2f('0x16')]?_0x25e43d[_0x7b2f('0x16')]['limit']||null:null,'include':_0x25e43d[_0x7b2f('0x16')]?_0x25e43d[_0x7b2f('0x16')][_0x7b2f('0x19')]?_['map'](_0x25e43d[_0x7b2f('0x16')][_0x7b2f('0x19')],function(_0x38036d){return{'model':db[_0x38036d[_0x7b2f('0x1a')]],'as':_0x38036d['as'],'attributes':_0x38036d[_0x7b2f('0x18')],'include':_0x38036d[_0x7b2f('0x19')]?_['map'](_0x38036d[_0x7b2f('0x19')],function(_0x48b03b){return{'model':db[_0x48b03b[_0x7b2f('0x1a')]],'as':_0x48b03b['as'],'attributes':_0x48b03b[_0x7b2f('0x18')],'include':_0x48b03b[_0x7b2f('0x19')]?_['map'](_0x48b03b['include'],function(_0x2df735){return{'model':db[_0x2df735[_0x7b2f('0x1a')]],'as':_0x2df735['as'],'attributes':_0x2df735[_0x7b2f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7b2f('0xb')](function(_0x33413e){logger['info'](_0x7b2f('0x1b'),_0x25e43d);logger['debug']('GetVtigerAccount',_0x25e43d,JSON[_0x7b2f('0xf')](_0x33413e));_0x4f381a(_0x33413e);})['catch'](function(_0x3d26ef){logger[_0x7b2f('0x10')](_0x7b2f('0x1b'),_0x3d26ef[_0x7b2f('0x13')],_0x25e43d);_0x11d948(_0x2ff0b9[_0x7b2f('0x10')](0x1f4,_0x3d26ef['message']));});});};exports['ShowVtigerAccount']=function(_0x31acc9){var _0x70a618=this;return new Promise(function(_0x528c89,_0x3afb01){return db[_0x7b2f('0x1c')]['find']({'raw':_0x31acc9[_0x7b2f('0x16')]?_0x31acc9[_0x7b2f('0x16')][_0x7b2f('0x17')]===undefined?!![]:![]:!![],'where':_0x31acc9[_0x7b2f('0x16')]?_0x31acc9[_0x7b2f('0x16')][_0x7b2f('0x1d')]||null:null,'attributes':_0x31acc9[_0x7b2f('0x16')]?_0x31acc9['options']['attributes']||null:null,'include':_0x31acc9['options']?_0x31acc9[_0x7b2f('0x16')][_0x7b2f('0x19')]?_['map'](_0x31acc9[_0x7b2f('0x16')][_0x7b2f('0x19')],function(_0x555843){return{'model':db[_0x555843[_0x7b2f('0x1a')]],'as':_0x555843['as'],'attributes':_0x555843[_0x7b2f('0x18')],'include':_0x555843[_0x7b2f('0x19')]?_['map'](_0x555843['include'],function(_0xdae049){return{'model':db[_0xdae049[_0x7b2f('0x1a')]],'as':_0xdae049['as'],'attributes':_0xdae049[_0x7b2f('0x18')],'include':_0xdae049['include']?_['map'](_0xdae049[_0x7b2f('0x19')],function(_0x735049){return{'model':db[_0x735049[_0x7b2f('0x1a')]],'as':_0x735049['as'],'attributes':_0x735049[_0x7b2f('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5382c0){logger[_0x7b2f('0x1e')]('ShowVtigerAccount',_0x31acc9);logger[_0x7b2f('0xd')](_0x7b2f('0x1f'),_0x31acc9,JSON[_0x7b2f('0xf')](_0x5382c0));_0x528c89(_0x5382c0);})[_0x7b2f('0x20')](function(_0x87c5fc){logger['error'](_0x7b2f('0x1f'),_0x87c5fc[_0x7b2f('0x13')],_0x31acc9);_0x3afb01(_0x70a618[_0x7b2f('0x10')](0x1f4,_0x87c5fc[_0x7b2f('0x13')]));});});}; \ No newline at end of file +var _0x4f83=['options','raw','where','attributes','include','map','model','then','info','catch','ShowVtigerAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerAccount,\x20%s,\x20%s','GetVtigerAccount','VtigerAccount','findAll'];(function(_0x1d000e,_0x1d34b2){var _0x1a9a5d=function(_0x138600){while(--_0x138600){_0x1d000e['push'](_0x1d000e['shift']());}};_0x1a9a5d(++_0x1d34b2);}(_0x4f83,0x124));var _0x34f8=function(_0x4625fc,_0x57c355){_0x4625fc=_0x4625fc-0x0;var _0x149edb=_0x4f83[_0x4625fc];return _0x149edb;};'use strict';var _=require(_0x34f8('0x0'));var util=require(_0x34f8('0x1'));var moment=require(_0x34f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x34f8('0x3'));var fs=require('fs');var Redis=require(_0x34f8('0x4'));var db=require(_0x34f8('0x5'))['db'];var utils=require(_0x34f8('0x6'));var logger=require(_0x34f8('0x7'))(_0x34f8('0x8'));var config=require('../../config/environment');var jayson=require(_0x34f8('0x9'));var client=jayson[_0x34f8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e1f44,_0x1ffff8,_0x374c0f){return new BPromise(function(_0x495eb9,_0x40630f){return client[_0x34f8('0xb')](_0x2e1f44,_0x374c0f)['then'](function(_0x13a2c0){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x1ffff8,_0x34f8('0xc'));logger[_0x34f8('0xd')](_0x34f8('0xe'),_0x1ffff8,_0x34f8('0xc'),JSON[_0x34f8('0xf')](_0x13a2c0));if(_0x13a2c0[_0x34f8('0x10')]){if(_0x13a2c0[_0x34f8('0x10')][_0x34f8('0x11')]===0x1f4){logger[_0x34f8('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x1ffff8,_0x13a2c0[_0x34f8('0x10')][_0x34f8('0x12')]);return _0x40630f(_0x13a2c0['error'][_0x34f8('0x12')]);}logger[_0x34f8('0x10')](_0x34f8('0x13'),_0x1ffff8,_0x13a2c0[_0x34f8('0x10')][_0x34f8('0x12')]);return _0x495eb9(_0x13a2c0[_0x34f8('0x10')][_0x34f8('0x12')]);}else{logger['info'](_0x34f8('0x13'),_0x1ffff8,_0x34f8('0xc'));_0x495eb9(_0x13a2c0['result'][_0x34f8('0x12')]);}})['catch'](function(_0x3ee8b6){logger[_0x34f8('0x10')](_0x34f8('0x13'),_0x1ffff8,_0x3ee8b6);_0x40630f(_0x3ee8b6);});});}exports[_0x34f8('0x14')]=function(_0x5cfe56){var _0x2cba7d=this;return new Promise(function(_0x1fd362,_0x1f2890){return db[_0x34f8('0x15')][_0x34f8('0x16')]({'raw':_0x5cfe56['options']?_0x5cfe56[_0x34f8('0x17')][_0x34f8('0x18')]===undefined?!![]:![]:!![],'where':_0x5cfe56[_0x34f8('0x17')]?_0x5cfe56['options'][_0x34f8('0x19')]||null:null,'attributes':_0x5cfe56[_0x34f8('0x17')]?_0x5cfe56['options'][_0x34f8('0x1a')]||null:null,'limit':_0x5cfe56['options']?_0x5cfe56[_0x34f8('0x17')]['limit']||null:null,'include':_0x5cfe56[_0x34f8('0x17')]?_0x5cfe56[_0x34f8('0x17')][_0x34f8('0x1b')]?_[_0x34f8('0x1c')](_0x5cfe56[_0x34f8('0x17')][_0x34f8('0x1b')],function(_0x3ba35b){return{'model':db[_0x3ba35b[_0x34f8('0x1d')]],'as':_0x3ba35b['as'],'attributes':_0x3ba35b['attributes'],'include':_0x3ba35b['include']?_[_0x34f8('0x1c')](_0x3ba35b[_0x34f8('0x1b')],function(_0x1c84d5){return{'model':db[_0x1c84d5['model']],'as':_0x1c84d5['as'],'attributes':_0x1c84d5[_0x34f8('0x1a')],'include':_0x1c84d5['include']?_[_0x34f8('0x1c')](_0x1c84d5[_0x34f8('0x1b')],function(_0x393eb7){return{'model':db[_0x393eb7[_0x34f8('0x1d')]],'as':_0x393eb7['as'],'attributes':_0x393eb7[_0x34f8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x34f8('0x1e')](function(_0x4f5cc7){logger[_0x34f8('0x1f')](_0x34f8('0x14'),_0x5cfe56);logger[_0x34f8('0xd')](_0x34f8('0x14'),_0x5cfe56,JSON[_0x34f8('0xf')](_0x4f5cc7));_0x1fd362(_0x4f5cc7);})[_0x34f8('0x20')](function(_0x11f6f1){logger['error'](_0x34f8('0x14'),_0x11f6f1[_0x34f8('0x12')],_0x5cfe56);_0x1f2890(_0x2cba7d['error'](0x1f4,_0x11f6f1[_0x34f8('0x12')]));});});};exports[_0x34f8('0x21')]=function(_0x22a128){var _0x4464fc=this;return new Promise(function(_0x434dd2,_0x1203fb){return db[_0x34f8('0x15')][_0x34f8('0x22')]({'raw':_0x22a128[_0x34f8('0x17')]?_0x22a128[_0x34f8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x22a128[_0x34f8('0x17')]?_0x22a128['options'][_0x34f8('0x19')]||null:null,'attributes':_0x22a128[_0x34f8('0x17')]?_0x22a128[_0x34f8('0x17')][_0x34f8('0x1a')]||null:null,'include':_0x22a128['options']?_0x22a128[_0x34f8('0x17')][_0x34f8('0x1b')]?_['map'](_0x22a128[_0x34f8('0x17')]['include'],function(_0x54ab94){return{'model':db[_0x54ab94[_0x34f8('0x1d')]],'as':_0x54ab94['as'],'attributes':_0x54ab94[_0x34f8('0x1a')],'include':_0x54ab94[_0x34f8('0x1b')]?_[_0x34f8('0x1c')](_0x54ab94[_0x34f8('0x1b')],function(_0x4d9c7d){return{'model':db[_0x4d9c7d['model']],'as':_0x4d9c7d['as'],'attributes':_0x4d9c7d[_0x34f8('0x1a')],'include':_0x4d9c7d[_0x34f8('0x1b')]?_[_0x34f8('0x1c')](_0x4d9c7d[_0x34f8('0x1b')],function(_0x3e667e){return{'model':db[_0x3e667e[_0x34f8('0x1d')]],'as':_0x3e667e['as'],'attributes':_0x3e667e[_0x34f8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d0485){logger[_0x34f8('0x1f')](_0x34f8('0x21'),_0x22a128);logger[_0x34f8('0xd')](_0x34f8('0x21'),_0x22a128,JSON[_0x34f8('0xf')](_0x1d0485));_0x434dd2(_0x1d0485);})['catch'](function(_0x12fdf4){logger[_0x34f8('0x10')](_0x34f8('0x21'),_0x12fdf4[_0x34f8('0x12')],_0x22a128);_0x1203fb(_0x4464fc['error'](0x1f4,_0x12fdf4[_0x34f8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 46459b6..1d258cc 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 _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(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file +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(_0x7b4397,_0x50ab04){var _0x16de0b=function(_0x26a130){while(--_0x26a130){_0x7b4397['push'](_0x7b4397['shift']());}};_0x16de0b(++_0x50ab04);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 25e926b..aaa9038 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 _0x163a=['sequelize','exports','STRING'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x163a,0xd2));var _0xa163=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x163a[_0x1f99a0];return _0x1e0849;};'use strict';var Sequelize=require(_0xa163('0x0'));module[_0xa163('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa163('0x2')]}}; \ No newline at end of file +var _0xf456=['sequelize','exports','STRING'];(function(_0x112a63,_0x60c48){var _0x402fdc=function(_0x46459a){while(--_0x46459a){_0x112a63['push'](_0x112a63['shift']());}};_0x402fdc(++_0x60c48);}(_0xf456,0x81));var _0x6f45=function(_0xe24ff7,_0x3f071b){_0xe24ff7=_0xe24ff7-0x0;var _0x30d497=_0xf456[_0xe24ff7];return _0x30d497;};'use strict';var Sequelize=require(_0x6f45('0x0'));module[_0x6f45('0x1')]={'name':{'type':Sequelize[_0x6f45('0x2')]},'description':{'type':Sequelize[_0x6f45('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index e7ea767..8834c90 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 _0xf2a0=['filter','options','VtigerConfiguration','includeAll','include','findAll','rows','keys','create','body','find','params','findOne','VtigerField','sort','pick','getFields','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','json','count','offset','limit','set','Content-Range','apply','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','merge','VIRTUAL'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xf2a0,0xc4));var _0x0f2a=function(_0x4812c9,_0x154b76){_0x4812c9=_0x4812c9-0x0;var _0x4de61f=_0xf2a0[_0x4812c9];return _0x4de61f;};'use strict';var pdf=require(_0x0f2a('0x0'));var emlformat=require(_0x0f2a('0x1'));var rimraf=require(_0x0f2a('0x2'));var zipdir=require(_0x0f2a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f2a('0x4'));var moment=require(_0x0f2a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0f2a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0f2a('0x7'));var csv=require(_0x0f2a('0x8'));var ejs=require(_0x0f2a('0x9'));var fs=require('fs');var _=require(_0x0f2a('0xa'));var squel=require(_0x0f2a('0xb'));var crypto=require(_0x0f2a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0f2a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0f2a('0xe'));var Redis=require(_0x0f2a('0xf'));var authService=require(_0x0f2a('0x10'));var qs=require(_0x0f2a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f2a('0x12'));var logger=require(_0x0f2a('0x13'))('api');var utils=require(_0x0f2a('0x14'));var config=require(_0x0f2a('0x15'));var licenseUtil=require(_0x0f2a('0x16'));var db=require(_0x0f2a('0x17'))['db'];var jayson=require(_0x0f2a('0x18'));var client=jayson[_0x0f2a('0x19')][_0x0f2a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2b7dec,_0x326339,_0x537f0c,_0x5e0f5f){return new BPromise(function(_0x3e936d,_0x4cef43){var _0x25be93=_0x5e0f5f||client;return _0x25be93[_0x0f2a('0x1b')](_0x2b7dec,_0x537f0c)[_0x0f2a('0x1c')](function(_0x4e980c){logger[_0x0f2a('0x1d')](_0x0f2a('0x1e'),_0x326339,'request\x20sent');logger[_0x0f2a('0x1f')](_0x0f2a('0x20'),_0x326339,_0x0f2a('0x21'),JSON[_0x0f2a('0x22')](_0x4e980c));if(_0x4e980c[_0x0f2a('0x23')]){if(_0x4e980c['error']['code']===0x1f4){logger[_0x0f2a('0x23')]('VtigerConfiguration,\x20%s,\x20%s',_0x326339,_0x4e980c[_0x0f2a('0x23')][_0x0f2a('0x24')]);return _0x4cef43(_0x4e980c[_0x0f2a('0x23')][_0x0f2a('0x24')]);}logger[_0x0f2a('0x23')](_0x0f2a('0x1e'),_0x326339,_0x4e980c[_0x0f2a('0x23')]['message']);return _0x3e936d(_0x4e980c[_0x0f2a('0x23')][_0x0f2a('0x24')]);}else{logger[_0x0f2a('0x1d')](_0x0f2a('0x1e'),_0x326339,_0x0f2a('0x21'));_0x3e936d(_0x4e980c['result'][_0x0f2a('0x24')]);}})[_0x0f2a('0x25')](function(_0x50e068){logger[_0x0f2a('0x23')]('VtigerConfiguration,\x20%s,\x20%s',_0x326339,_0x50e068);_0x4cef43(_0x50e068);});});}function respondWithStatusCode(_0x32acb6,_0x3a57fa){_0x3a57fa=_0x3a57fa||0xcc;return function(_0x5d57cf){if(_0x5d57cf){return _0x32acb6['sendStatus'](_0x3a57fa);}return _0x32acb6[_0x0f2a('0x26')](_0x3a57fa)['end']();};}function respondWithResult(_0x9b4b25,_0x1fe3bd){_0x1fe3bd=_0x1fe3bd||0xc8;return function(_0x3ed864){if(_0x3ed864){return _0x9b4b25[_0x0f2a('0x26')](_0x1fe3bd)[_0x0f2a('0x27')](_0x3ed864);}};}function respondWithFilteredResult(_0x4ed3cb,_0x497d62){return function(_0x32aead){if(_0x32aead){var _0x37ec4b=_0x32aead[_0x0f2a('0x28')],_0x498c96=_0x497d62[_0x0f2a('0x29')],_0x5c5a80=_0x497d62[_0x0f2a('0x29')]+_0x497d62[_0x0f2a('0x2a')],_0x30605e;if(_0x5c5a80>=_0x37ec4b){_0x5c5a80=_0x37ec4b;_0x30605e=0xc8;}else{_0x30605e=0xce;}_0x4ed3cb[_0x0f2a('0x26')](_0x30605e);return _0x4ed3cb[_0x0f2a('0x2b')](_0x0f2a('0x2c'),_0x498c96+'-'+_0x5c5a80+'/'+_0x37ec4b)['json'](_0x32aead);}return null;};}function patchUpdates(_0x1d299f){return function(_0xb307e7){try{jsonpatch[_0x0f2a('0x2d')](_0xb307e7,_0x1d299f,!![]);}catch(_0x49f05d){return BPromise['reject'](_0x49f05d);}return _0xb307e7['save']();};}function saveUpdates(_0x340427,_0x623a21){return function(_0x418d8c){if(_0x418d8c){return _0x418d8c['update'](_0x340427)[_0x0f2a('0x1c')](function(_0x8bf0a5){return _0x8bf0a5;});}return null;};}function removeEntity(_0x4636cb,_0x55d535){return function(_0x24e783){if(_0x24e783){return _0x24e783[_0x0f2a('0x2e')]()[_0x0f2a('0x1c')](function(){_0x4636cb[_0x0f2a('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa0127c,_0x162812){return function(_0x4ae586){if(!_0x4ae586){_0xa0127c[_0x0f2a('0x2f')](0x194);}return _0x4ae586;};}function handleError(_0x37f375,_0x3429c8){_0x3429c8=_0x3429c8||0x1f4;return function(_0x41af42){logger['error'](_0x41af42['stack']);if(_0x41af42['name']){delete _0x41af42[_0x0f2a('0x30')];}_0x37f375[_0x0f2a('0x26')](_0x3429c8)[_0x0f2a('0x31')](_0x41af42);};}exports[_0x0f2a('0x32')]=function(_0x4bcadd,_0x3849eb){var _0x41bb6c={},_0x6d42a9={},_0x29528e={'count':0x0,'rows':[]};var _0x33827e=_['map'](db['VtigerConfiguration'][_0x0f2a('0x33')],function(_0x2cd25d){return{'name':_0x2cd25d[_0x0f2a('0x34')],'type':_0x2cd25d[_0x0f2a('0x35')][_0x0f2a('0x36')]};});_0x6d42a9[_0x0f2a('0x37')]=_[_0x0f2a('0x38')](_0x33827e,_0x0f2a('0x30'));_0x6d42a9['query']=_['keys'](_0x4bcadd[_0x0f2a('0x39')]);_0x6d42a9[_0x0f2a('0x3a')]=_['intersection'](_0x6d42a9[_0x0f2a('0x37')],_0x6d42a9['query']);_0x41bb6c[_0x0f2a('0x3b')]=_[_0x0f2a('0x3c')](_0x6d42a9[_0x0f2a('0x37')],qs[_0x0f2a('0x3d')](_0x4bcadd[_0x0f2a('0x39')][_0x0f2a('0x3d')]));_0x41bb6c[_0x0f2a('0x3b')]=_0x41bb6c['attributes'][_0x0f2a('0x3e')]?_0x41bb6c[_0x0f2a('0x3b')]:_0x6d42a9[_0x0f2a('0x37')];if(!_0x4bcadd[_0x0f2a('0x39')][_0x0f2a('0x3f')]('nolimit')){_0x41bb6c[_0x0f2a('0x2a')]=qs['limit'](_0x4bcadd[_0x0f2a('0x39')][_0x0f2a('0x2a')]);_0x41bb6c[_0x0f2a('0x29')]=qs['offset'](_0x4bcadd[_0x0f2a('0x39')][_0x0f2a('0x29')]);}_0x41bb6c[_0x0f2a('0x40')]=qs['sort'](_0x4bcadd['query']['sort']);_0x41bb6c[_0x0f2a('0x41')]=qs[_0x0f2a('0x3a')](_['pick'](_0x4bcadd[_0x0f2a('0x39')],_0x6d42a9[_0x0f2a('0x3a')]),_0x33827e);if(_0x4bcadd['query']['filter']){_0x41bb6c[_0x0f2a('0x41')]=_[_0x0f2a('0x42')](_0x41bb6c[_0x0f2a('0x41')],{'$or':_[_0x0f2a('0x38')](_0x33827e,function(_0x8a1fcd){if(_0x8a1fcd['type']!==_0x0f2a('0x43')){var _0x1fe14e={};_0x1fe14e[_0x8a1fcd[_0x0f2a('0x30')]]={'$like':'%'+_0x4bcadd[_0x0f2a('0x39')][_0x0f2a('0x44')]+'%'};return _0x1fe14e;}})});}_0x41bb6c=_[_0x0f2a('0x42')]({},_0x41bb6c,_0x4bcadd[_0x0f2a('0x45')]);var _0x4314b8={'where':_0x41bb6c[_0x0f2a('0x41')]};return db[_0x0f2a('0x46')][_0x0f2a('0x28')](_0x4314b8)['then'](function(_0x4be069){_0x29528e[_0x0f2a('0x28')]=_0x4be069;if(_0x4bcadd[_0x0f2a('0x39')][_0x0f2a('0x47')]){_0x41bb6c[_0x0f2a('0x48')]=[{'all':!![]}];}return db[_0x0f2a('0x46')][_0x0f2a('0x49')](_0x41bb6c);})[_0x0f2a('0x1c')](function(_0x47f04c){_0x29528e[_0x0f2a('0x4a')]=_0x47f04c;return _0x29528e;})['then'](respondWithFilteredResult(_0x3849eb,_0x41bb6c))['catch'](handleError(_0x3849eb,null));};exports['show']=function(_0x399ae7,_0x3f926d){var _0x1f8e2d={'raw':![],'where':{'id':_0x399ae7['params']['id']}},_0x434796={};_0x434796[_0x0f2a('0x37')]=_['keys'](db[_0x0f2a('0x46')]['rawAttributes']);_0x434796[_0x0f2a('0x39')]=_[_0x0f2a('0x4b')](_0x399ae7['query']);_0x434796['filters']=_['intersection'](_0x434796[_0x0f2a('0x37')],_0x434796['query']);_0x1f8e2d[_0x0f2a('0x3b')]=_[_0x0f2a('0x3c')](_0x434796[_0x0f2a('0x37')],qs['fields'](_0x399ae7[_0x0f2a('0x39')][_0x0f2a('0x3d')]));_0x1f8e2d[_0x0f2a('0x3b')]=_0x1f8e2d[_0x0f2a('0x3b')]['length']?_0x1f8e2d[_0x0f2a('0x3b')]:_0x434796['model'];if(_0x399ae7[_0x0f2a('0x39')][_0x0f2a('0x47')]){_0x1f8e2d[_0x0f2a('0x48')]=[{'all':!![]}];}_0x1f8e2d=_[_0x0f2a('0x42')]({},_0x1f8e2d,_0x399ae7[_0x0f2a('0x45')]);return db[_0x0f2a('0x46')]['find'](_0x1f8e2d)[_0x0f2a('0x1c')](handleEntityNotFound(_0x3f926d,null))[_0x0f2a('0x1c')](respondWithResult(_0x3f926d,null))[_0x0f2a('0x25')](handleError(_0x3f926d,null));};exports[_0x0f2a('0x4c')]=function(_0x4b878c,_0x6f99b){return db[_0x0f2a('0x46')]['create'](_0x4b878c[_0x0f2a('0x4d')],{})[_0x0f2a('0x1c')](respondWithResult(_0x6f99b,0xc9))[_0x0f2a('0x25')](handleError(_0x6f99b,null));};exports['update']=function(_0x506b61,_0x4665d5){if(_0x506b61['body']['id']){delete _0x506b61[_0x0f2a('0x4d')]['id'];}return db[_0x0f2a('0x46')][_0x0f2a('0x4e')]({'where':{'id':_0x506b61[_0x0f2a('0x4f')]['id']}})[_0x0f2a('0x1c')](handleEntityNotFound(_0x4665d5,null))[_0x0f2a('0x1c')](saveUpdates(_0x506b61[_0x0f2a('0x4d')],null))[_0x0f2a('0x1c')](respondWithResult(_0x4665d5,null))[_0x0f2a('0x25')](handleError(_0x4665d5,null));};exports[_0x0f2a('0x2e')]=function(_0x3c43d8,_0x3a7201){return db['VtigerConfiguration'][_0x0f2a('0x4e')]({'where':{'id':_0x3c43d8[_0x0f2a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3a7201,null))['then'](removeEntity(_0x3a7201,null))[_0x0f2a('0x25')](handleError(_0x3a7201,null));};exports['getFields']=function(_0x1af6b9,_0x36a689,_0x4af834){var _0x1cd0b1={};var _0x159bba={};var _0x202029;var _0x231ee0;return db[_0x0f2a('0x46')][_0x0f2a('0x50')]({'where':{'id':_0x1af6b9[_0x0f2a('0x4f')]['id']}})[_0x0f2a('0x1c')](handleEntityNotFound(_0x36a689,null))[_0x0f2a('0x1c')](function(_0x8dd488){if(_0x8dd488){_0x202029=_0x8dd488;_0x159bba[_0x0f2a('0x37')]=_['keys'](db[_0x0f2a('0x51')][_0x0f2a('0x33')]);_0x159bba[_0x0f2a('0x39')]=_[_0x0f2a('0x4b')](_0x1af6b9[_0x0f2a('0x39')]);_0x159bba[_0x0f2a('0x3a')]=_[_0x0f2a('0x3c')](_0x159bba['model'],_0x159bba[_0x0f2a('0x39')]);_0x1cd0b1[_0x0f2a('0x3b')]=_['intersection'](_0x159bba[_0x0f2a('0x37')],qs[_0x0f2a('0x3d')](_0x1af6b9['query'][_0x0f2a('0x3d')]));_0x1cd0b1['attributes']=_0x1cd0b1[_0x0f2a('0x3b')][_0x0f2a('0x3e')]?_0x1cd0b1[_0x0f2a('0x3b')]:_0x159bba[_0x0f2a('0x37')];_0x1cd0b1[_0x0f2a('0x40')]=qs[_0x0f2a('0x52')](_0x1af6b9['query']['sort']);_0x1cd0b1[_0x0f2a('0x41')]=qs[_0x0f2a('0x3a')](_[_0x0f2a('0x53')](_0x1af6b9['query'],_0x159bba['filters']));if(_0x1af6b9[_0x0f2a('0x39')][_0x0f2a('0x44')]){_0x1cd0b1[_0x0f2a('0x41')]=_['merge'](_0x1cd0b1[_0x0f2a('0x41')],{'$or':_[_0x0f2a('0x38')](_0x1cd0b1['attributes'],function(_0x1452ec){var _0x37a1e1={};_0x37a1e1[_0x1452ec]={'$like':'%'+_0x1af6b9[_0x0f2a('0x39')][_0x0f2a('0x44')]+'%'};return _0x37a1e1;})});}_0x1cd0b1=_[_0x0f2a('0x42')]({},_0x1cd0b1,_0x1af6b9[_0x0f2a('0x45')]);return _0x202029[_0x0f2a('0x54')](_0x1cd0b1);}})[_0x0f2a('0x1c')](function(_0x2487fc){if(_0x2487fc){_0x231ee0=_0x2487fc[_0x0f2a('0x3e')];if(!_0x1af6b9[_0x0f2a('0x39')][_0x0f2a('0x3f')](_0x0f2a('0x55'))){_0x1cd0b1[_0x0f2a('0x2a')]=qs['limit'](_0x1af6b9['query'][_0x0f2a('0x2a')]);_0x1cd0b1[_0x0f2a('0x29')]=qs[_0x0f2a('0x29')](_0x1af6b9['query'][_0x0f2a('0x29')]);}return _0x202029[_0x0f2a('0x54')](_0x1cd0b1);}})['then'](function(_0x1ed43c){if(_0x1ed43c){return _0x1ed43c?{'count':_0x231ee0,'rows':_0x1ed43c}:null;}})[_0x0f2a('0x1c')](respondWithResult(_0x36a689,null))[_0x0f2a('0x25')](handleError(_0x36a689,null));};exports[_0x0f2a('0x56')]=function(_0x1d69df,_0x555abe,_0x17877a){var _0x3dd240={};var _0x1202ef={};var _0x422261;var _0x3df9a1;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x1d69df['params']['id']}})[_0x0f2a('0x1c')](handleEntityNotFound(_0x555abe,null))[_0x0f2a('0x1c')](function(_0x4589e1){if(_0x4589e1){_0x422261=_0x4589e1;_0x1202ef['model']=_[_0x0f2a('0x4b')](db[_0x0f2a('0x51')]['rawAttributes']);_0x1202ef[_0x0f2a('0x39')]=_[_0x0f2a('0x4b')](_0x1d69df[_0x0f2a('0x39')]);_0x1202ef[_0x0f2a('0x3a')]=_[_0x0f2a('0x3c')](_0x1202ef[_0x0f2a('0x37')],_0x1202ef[_0x0f2a('0x39')]);_0x3dd240[_0x0f2a('0x3b')]=_['intersection'](_0x1202ef[_0x0f2a('0x37')],qs[_0x0f2a('0x3d')](_0x1d69df[_0x0f2a('0x39')][_0x0f2a('0x3d')]));_0x3dd240['attributes']=_0x3dd240[_0x0f2a('0x3b')][_0x0f2a('0x3e')]?_0x3dd240['attributes']:_0x1202ef[_0x0f2a('0x37')];_0x3dd240[_0x0f2a('0x40')]=qs[_0x0f2a('0x52')](_0x1d69df['query'][_0x0f2a('0x52')]);_0x3dd240['where']=qs[_0x0f2a('0x3a')](_[_0x0f2a('0x53')](_0x1d69df[_0x0f2a('0x39')],_0x1202ef[_0x0f2a('0x3a')]));if(_0x1d69df[_0x0f2a('0x39')][_0x0f2a('0x44')]){_0x3dd240[_0x0f2a('0x41')]=_[_0x0f2a('0x42')](_0x3dd240[_0x0f2a('0x41')],{'$or':_[_0x0f2a('0x38')](_0x3dd240[_0x0f2a('0x3b')],function(_0x105524){var _0x97aa55={};_0x97aa55[_0x105524]={'$like':'%'+_0x1d69df[_0x0f2a('0x39')][_0x0f2a('0x44')]+'%'};return _0x97aa55;})});}_0x3dd240=_[_0x0f2a('0x42')]({},_0x3dd240,_0x1d69df[_0x0f2a('0x45')]);return _0x422261[_0x0f2a('0x56')](_0x3dd240);}})[_0x0f2a('0x1c')](function(_0x482791){if(_0x482791){_0x3df9a1=_0x482791[_0x0f2a('0x3e')];if(!_0x1d69df[_0x0f2a('0x39')]['hasOwnProperty'](_0x0f2a('0x55'))){_0x3dd240[_0x0f2a('0x2a')]=qs[_0x0f2a('0x2a')](_0x1d69df[_0x0f2a('0x39')][_0x0f2a('0x2a')]);_0x3dd240[_0x0f2a('0x29')]=qs[_0x0f2a('0x29')](_0x1d69df[_0x0f2a('0x39')][_0x0f2a('0x29')]);}return _0x422261['getSubjects'](_0x3dd240);}})[_0x0f2a('0x1c')](function(_0x539818){if(_0x539818){return _0x539818?{'count':_0x3df9a1,'rows':_0x539818}:null;}})[_0x0f2a('0x1c')](respondWithResult(_0x555abe,null))[_0x0f2a('0x25')](handleError(_0x555abe,null));};exports['getDescriptions']=function(_0x1d004c,_0x3bfb1f,_0x2327d2){var _0x58dcdc={};var _0x1c4c89={};var _0x232eab;var _0x191b74;return db['VtigerConfiguration'][_0x0f2a('0x50')]({'where':{'id':_0x1d004c[_0x0f2a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3bfb1f,null))['then'](function(_0x3c8476){if(_0x3c8476){_0x232eab=_0x3c8476;_0x1c4c89[_0x0f2a('0x37')]=_[_0x0f2a('0x4b')](db[_0x0f2a('0x51')]['rawAttributes']);_0x1c4c89[_0x0f2a('0x39')]=_[_0x0f2a('0x4b')](_0x1d004c[_0x0f2a('0x39')]);_0x1c4c89[_0x0f2a('0x3a')]=_['intersection'](_0x1c4c89[_0x0f2a('0x37')],_0x1c4c89['query']);_0x58dcdc[_0x0f2a('0x3b')]=_[_0x0f2a('0x3c')](_0x1c4c89[_0x0f2a('0x37')],qs[_0x0f2a('0x3d')](_0x1d004c[_0x0f2a('0x39')][_0x0f2a('0x3d')]));_0x58dcdc['attributes']=_0x58dcdc[_0x0f2a('0x3b')][_0x0f2a('0x3e')]?_0x58dcdc[_0x0f2a('0x3b')]:_0x1c4c89[_0x0f2a('0x37')];_0x58dcdc['order']=qs[_0x0f2a('0x52')](_0x1d004c[_0x0f2a('0x39')][_0x0f2a('0x52')]);_0x58dcdc[_0x0f2a('0x41')]=qs[_0x0f2a('0x3a')](_[_0x0f2a('0x53')](_0x1d004c[_0x0f2a('0x39')],_0x1c4c89[_0x0f2a('0x3a')]));if(_0x1d004c['query']['filter']){_0x58dcdc[_0x0f2a('0x41')]=_[_0x0f2a('0x42')](_0x58dcdc[_0x0f2a('0x41')],{'$or':_[_0x0f2a('0x38')](_0x58dcdc[_0x0f2a('0x3b')],function(_0x2eb570){var _0x519763={};_0x519763[_0x2eb570]={'$like':'%'+_0x1d004c['query']['filter']+'%'};return _0x519763;})});}_0x58dcdc=_[_0x0f2a('0x42')]({},_0x58dcdc,_0x1d004c['options']);return _0x232eab['getDescriptions'](_0x58dcdc);}})[_0x0f2a('0x1c')](function(_0x2a7b81){if(_0x2a7b81){_0x191b74=_0x2a7b81[_0x0f2a('0x3e')];if(!_0x1d004c[_0x0f2a('0x39')][_0x0f2a('0x3f')](_0x0f2a('0x55'))){_0x58dcdc['limit']=qs['limit'](_0x1d004c[_0x0f2a('0x39')][_0x0f2a('0x2a')]);_0x58dcdc[_0x0f2a('0x29')]=qs[_0x0f2a('0x29')](_0x1d004c['query'][_0x0f2a('0x29')]);}return _0x232eab[_0x0f2a('0x57')](_0x58dcdc);}})[_0x0f2a('0x1c')](function(_0x258b51){if(_0x258b51){return _0x258b51?{'count':_0x191b74,'rows':_0x258b51}:null;}})[_0x0f2a('0x1c')](respondWithResult(_0x3bfb1f,null))[_0x0f2a('0x25')](handleError(_0x3bfb1f,null));}; \ No newline at end of file +var _0x96ad=['show','params','keys','intersection','include','find','create','body','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','save','sendStatus','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows'];(function(_0xba2647,_0x951ff1){var _0x1e00d5=function(_0x26a292){while(--_0x26a292){_0xba2647['push'](_0xba2647['shift']());}};_0x1e00d5(++_0x951ff1);}(_0x96ad,0xbc));var _0xd96a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x96ad[_0x2070da];return _0x4f9fe1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd96a('0x0'));var zipdir=require(_0xd96a('0x1'));var jsonpatch=require(_0xd96a('0x2'));var rp=require('request-promise');var moment=require(_0xd96a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd96a('0x4'));var util=require(_0xd96a('0x5'));var path=require(_0xd96a('0x6'));var sox=require('sox');var csv=require(_0xd96a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd96a('0x8'));var squel=require(_0xd96a('0x9'));var crypto=require(_0xd96a('0xa'));var jsforce=require(_0xd96a('0xb'));var deskjs=require(_0xd96a('0xc'));var toCsv=require(_0xd96a('0x7'));var querystring=require(_0xd96a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd96a('0xe'));var qs=require(_0xd96a('0xf'));var as=require(_0xd96a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd96a('0x11'));var utils=require(_0xd96a('0x12'));var config=require(_0xd96a('0x13'));var licenseUtil=require(_0xd96a('0x14'));var db=require(_0xd96a('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd96a('0x16')][_0xd96a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xc7d341,_0x277a91,_0x58c96d,_0x2d5061){return new BPromise(function(_0x1d82c6,_0x27a776){var _0x228651=_0x2d5061||client;return _0x228651[_0xd96a('0x18')](_0xc7d341,_0x58c96d)[_0xd96a('0x19')](function(_0x4b50be){logger[_0xd96a('0x1a')](_0xd96a('0x1b'),_0x277a91,_0xd96a('0x1c'));logger[_0xd96a('0x1d')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x277a91,_0xd96a('0x1c'),JSON[_0xd96a('0x1e')](_0x4b50be));if(_0x4b50be['error']){if(_0x4b50be[_0xd96a('0x1f')]['code']===0x1f4){logger[_0xd96a('0x1f')]('VtigerConfiguration,\x20%s,\x20%s',_0x277a91,_0x4b50be['error'][_0xd96a('0x20')]);return _0x27a776(_0x4b50be[_0xd96a('0x1f')][_0xd96a('0x20')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x277a91,_0x4b50be['error'][_0xd96a('0x20')]);return _0x1d82c6(_0x4b50be['error'][_0xd96a('0x20')]);}else{logger[_0xd96a('0x1a')](_0xd96a('0x1b'),_0x277a91,_0xd96a('0x1c'));_0x1d82c6(_0x4b50be[_0xd96a('0x21')]['message']);}})[_0xd96a('0x22')](function(_0x44ac01){logger[_0xd96a('0x1f')](_0xd96a('0x1b'),_0x277a91,_0x44ac01);_0x27a776(_0x44ac01);});});}function respondWithStatusCode(_0x51892d,_0x5bbc39){_0x5bbc39=_0x5bbc39||0xcc;return function(_0x4db603){if(_0x4db603){return _0x51892d['sendStatus'](_0x5bbc39);}return _0x51892d[_0xd96a('0x23')](_0x5bbc39)[_0xd96a('0x24')]();};}function respondWithResult(_0x31d8b7,_0x132a3f){_0x132a3f=_0x132a3f||0xc8;return function(_0x500171){if(_0x500171){return _0x31d8b7['status'](_0x132a3f)[_0xd96a('0x25')](_0x500171);}};}function respondWithFilteredResult(_0x44871b,_0x2a3fb4){return function(_0x16f765){if(_0x16f765){var _0x3f3aa8=_0x16f765[_0xd96a('0x26')],_0x26c97b=_0x2a3fb4[_0xd96a('0x27')],_0x3b83aa=_0x2a3fb4['offset']+_0x2a3fb4[_0xd96a('0x28')],_0x209ba7;if(_0x3b83aa>=_0x3f3aa8){_0x3b83aa=_0x3f3aa8;_0x209ba7=0xc8;}else{_0x209ba7=0xce;}_0x44871b[_0xd96a('0x23')](_0x209ba7);return _0x44871b['set'](_0xd96a('0x29'),_0x26c97b+'-'+_0x3b83aa+'/'+_0x3f3aa8)[_0xd96a('0x25')](_0x16f765);}return null;};}function patchUpdates(_0xc00fc2){return function(_0x2de698){try{jsonpatch[_0xd96a('0x2a')](_0x2de698,_0xc00fc2,!![]);}catch(_0x4efdb9){return BPromise[_0xd96a('0x2b')](_0x4efdb9);}return _0x2de698[_0xd96a('0x2c')]();};}function saveUpdates(_0x5e76aa,_0x4fb6d5){return function(_0x354f89){if(_0x354f89){return _0x354f89['update'](_0x5e76aa)[_0xd96a('0x19')](function(_0x34f7e3){return _0x34f7e3;});}return null;};}function removeEntity(_0x95b85b,_0x4fc36a){return function(_0x2c1a1d){if(_0x2c1a1d){return _0x2c1a1d['destroy']()[_0xd96a('0x19')](function(){_0x95b85b['status'](0xcc)[_0xd96a('0x24')]();});}};}function handleEntityNotFound(_0x16d2ae,_0x1fded0){return function(_0x2d30ae){if(!_0x2d30ae){_0x16d2ae[_0xd96a('0x2d')](0x194);}return _0x2d30ae;};}function handleError(_0x28859e,_0x518f14){_0x518f14=_0x518f14||0x1f4;return function(_0x1da620){logger[_0xd96a('0x1f')](_0x1da620['stack']);if(_0x1da620[_0xd96a('0x2e')]){delete _0x1da620[_0xd96a('0x2e')];}_0x28859e['status'](_0x518f14)[_0xd96a('0x2f')](_0x1da620);};}exports['index']=function(_0x153956,_0xddda35){var _0x132c2f={},_0x13b98d={},_0x407bc9={'count':0x0,'rows':[]};var _0x3c4939=_[_0xd96a('0x30')](db[_0xd96a('0x31')][_0xd96a('0x32')],function(_0x3e5d14){return{'name':_0x3e5d14[_0xd96a('0x33')],'type':_0x3e5d14[_0xd96a('0x34')][_0xd96a('0x35')]};});_0x13b98d[_0xd96a('0x36')]=_[_0xd96a('0x30')](_0x3c4939,_0xd96a('0x2e'));_0x13b98d['query']=_['keys'](_0x153956[_0xd96a('0x37')]);_0x13b98d['filters']=_['intersection'](_0x13b98d['model'],_0x13b98d[_0xd96a('0x37')]);_0x132c2f[_0xd96a('0x38')]=_['intersection'](_0x13b98d['model'],qs[_0xd96a('0x39')](_0x153956['query'][_0xd96a('0x39')]));_0x132c2f['attributes']=_0x132c2f[_0xd96a('0x38')][_0xd96a('0x3a')]?_0x132c2f['attributes']:_0x13b98d['model'];if(!_0x153956[_0xd96a('0x37')][_0xd96a('0x3b')](_0xd96a('0x3c'))){_0x132c2f['limit']=qs[_0xd96a('0x28')](_0x153956[_0xd96a('0x37')]['limit']);_0x132c2f[_0xd96a('0x27')]=qs[_0xd96a('0x27')](_0x153956[_0xd96a('0x37')][_0xd96a('0x27')]);}_0x132c2f[_0xd96a('0x3d')]=qs[_0xd96a('0x3e')](_0x153956[_0xd96a('0x37')][_0xd96a('0x3e')]);_0x132c2f[_0xd96a('0x3f')]=qs[_0xd96a('0x40')](_[_0xd96a('0x41')](_0x153956[_0xd96a('0x37')],_0x13b98d[_0xd96a('0x40')]),_0x3c4939);if(_0x153956[_0xd96a('0x37')]['filter']){_0x132c2f[_0xd96a('0x3f')]=_[_0xd96a('0x42')](_0x132c2f[_0xd96a('0x3f')],{'$or':_['map'](_0x3c4939,function(_0x24decf){if(_0x24decf['type']!==_0xd96a('0x43')){var _0x48b66e={};_0x48b66e[_0x24decf[_0xd96a('0x2e')]]={'$like':'%'+_0x153956[_0xd96a('0x37')][_0xd96a('0x44')]+'%'};return _0x48b66e;}})});}_0x132c2f=_['merge']({},_0x132c2f,_0x153956[_0xd96a('0x45')]);var _0x1a8780={'where':_0x132c2f['where']};return db[_0xd96a('0x31')][_0xd96a('0x26')](_0x1a8780)[_0xd96a('0x19')](function(_0x3fbca8){_0x407bc9[_0xd96a('0x26')]=_0x3fbca8;if(_0x153956[_0xd96a('0x37')][_0xd96a('0x46')]){_0x132c2f['include']=[{'all':!![]}];}return db[_0xd96a('0x31')][_0xd96a('0x47')](_0x132c2f);})[_0xd96a('0x19')](function(_0x11fae6){_0x407bc9[_0xd96a('0x48')]=_0x11fae6;return _0x407bc9;})['then'](respondWithFilteredResult(_0xddda35,_0x132c2f))[_0xd96a('0x22')](handleError(_0xddda35,null));};exports[_0xd96a('0x49')]=function(_0x5ec431,_0x13f2ce){var _0x5ef263={'raw':![],'where':{'id':_0x5ec431[_0xd96a('0x4a')]['id']}},_0xba0a0={};_0xba0a0['model']=_[_0xd96a('0x4b')](db[_0xd96a('0x31')][_0xd96a('0x32')]);_0xba0a0[_0xd96a('0x37')]=_[_0xd96a('0x4b')](_0x5ec431[_0xd96a('0x37')]);_0xba0a0[_0xd96a('0x40')]=_[_0xd96a('0x4c')](_0xba0a0[_0xd96a('0x36')],_0xba0a0[_0xd96a('0x37')]);_0x5ef263[_0xd96a('0x38')]=_[_0xd96a('0x4c')](_0xba0a0[_0xd96a('0x36')],qs[_0xd96a('0x39')](_0x5ec431[_0xd96a('0x37')]['fields']));_0x5ef263[_0xd96a('0x38')]=_0x5ef263[_0xd96a('0x38')]['length']?_0x5ef263[_0xd96a('0x38')]:_0xba0a0[_0xd96a('0x36')];if(_0x5ec431[_0xd96a('0x37')]['includeAll']){_0x5ef263[_0xd96a('0x4d')]=[{'all':!![]}];}_0x5ef263=_[_0xd96a('0x42')]({},_0x5ef263,_0x5ec431[_0xd96a('0x45')]);return db['VtigerConfiguration'][_0xd96a('0x4e')](_0x5ef263)[_0xd96a('0x19')](handleEntityNotFound(_0x13f2ce,null))['then'](respondWithResult(_0x13f2ce,null))[_0xd96a('0x22')](handleError(_0x13f2ce,null));};exports[_0xd96a('0x4f')]=function(_0x25a0d1,_0x1e499f){return db[_0xd96a('0x31')][_0xd96a('0x4f')](_0x25a0d1['body'],{})[_0xd96a('0x19')](respondWithResult(_0x1e499f,0xc9))[_0xd96a('0x22')](handleError(_0x1e499f,null));};exports['update']=function(_0x51e3f1,_0x2227e1){if(_0x51e3f1[_0xd96a('0x50')]['id']){delete _0x51e3f1[_0xd96a('0x50')]['id'];}return db[_0xd96a('0x31')][_0xd96a('0x4e')]({'where':{'id':_0x51e3f1[_0xd96a('0x4a')]['id']}})[_0xd96a('0x19')](handleEntityNotFound(_0x2227e1,null))[_0xd96a('0x19')](saveUpdates(_0x51e3f1[_0xd96a('0x50')],null))[_0xd96a('0x19')](respondWithResult(_0x2227e1,null))['catch'](handleError(_0x2227e1,null));};exports[_0xd96a('0x51')]=function(_0x560f2a,_0x26c7ab){return db[_0xd96a('0x31')][_0xd96a('0x4e')]({'where':{'id':_0x560f2a[_0xd96a('0x4a')]['id']}})[_0xd96a('0x19')](handleEntityNotFound(_0x26c7ab,null))[_0xd96a('0x19')](removeEntity(_0x26c7ab,null))[_0xd96a('0x22')](handleError(_0x26c7ab,null));};exports[_0xd96a('0x52')]=function(_0x1ee7e1,_0x3945d7,_0x2d0dfd){var _0x549ee4={};var _0x5ae8be={};var _0x3c7eec;var _0x508df1;return db[_0xd96a('0x31')][_0xd96a('0x53')]({'where':{'id':_0x1ee7e1[_0xd96a('0x4a')]['id']}})[_0xd96a('0x19')](handleEntityNotFound(_0x3945d7,null))[_0xd96a('0x19')](function(_0x34b21c){if(_0x34b21c){_0x3c7eec=_0x34b21c;_0x5ae8be[_0xd96a('0x36')]=_[_0xd96a('0x4b')](db[_0xd96a('0x54')][_0xd96a('0x32')]);_0x5ae8be[_0xd96a('0x37')]=_['keys'](_0x1ee7e1[_0xd96a('0x37')]);_0x5ae8be[_0xd96a('0x40')]=_[_0xd96a('0x4c')](_0x5ae8be[_0xd96a('0x36')],_0x5ae8be['query']);_0x549ee4['attributes']=_[_0xd96a('0x4c')](_0x5ae8be[_0xd96a('0x36')],qs[_0xd96a('0x39')](_0x1ee7e1['query'][_0xd96a('0x39')]));_0x549ee4[_0xd96a('0x38')]=_0x549ee4[_0xd96a('0x38')]['length']?_0x549ee4['attributes']:_0x5ae8be[_0xd96a('0x36')];_0x549ee4[_0xd96a('0x3d')]=qs[_0xd96a('0x3e')](_0x1ee7e1[_0xd96a('0x37')][_0xd96a('0x3e')]);_0x549ee4[_0xd96a('0x3f')]=qs['filters'](_['pick'](_0x1ee7e1[_0xd96a('0x37')],_0x5ae8be[_0xd96a('0x40')]));if(_0x1ee7e1[_0xd96a('0x37')]['filter']){_0x549ee4['where']=_[_0xd96a('0x42')](_0x549ee4[_0xd96a('0x3f')],{'$or':_['map'](_0x549ee4[_0xd96a('0x38')],function(_0x5029cd){var _0x5a84c5={};_0x5a84c5[_0x5029cd]={'$like':'%'+_0x1ee7e1[_0xd96a('0x37')][_0xd96a('0x44')]+'%'};return _0x5a84c5;})});}_0x549ee4=_['merge']({},_0x549ee4,_0x1ee7e1[_0xd96a('0x45')]);return _0x3c7eec[_0xd96a('0x52')](_0x549ee4);}})[_0xd96a('0x19')](function(_0x503cca){if(_0x503cca){_0x508df1=_0x503cca[_0xd96a('0x3a')];if(!_0x1ee7e1[_0xd96a('0x37')][_0xd96a('0x3b')](_0xd96a('0x3c'))){_0x549ee4[_0xd96a('0x28')]=qs[_0xd96a('0x28')](_0x1ee7e1['query'][_0xd96a('0x28')]);_0x549ee4[_0xd96a('0x27')]=qs['offset'](_0x1ee7e1[_0xd96a('0x37')][_0xd96a('0x27')]);}return _0x3c7eec[_0xd96a('0x52')](_0x549ee4);}})[_0xd96a('0x19')](function(_0x1db177){if(_0x1db177){return _0x1db177?{'count':_0x508df1,'rows':_0x1db177}:null;}})[_0xd96a('0x19')](respondWithResult(_0x3945d7,null))[_0xd96a('0x22')](handleError(_0x3945d7,null));};exports[_0xd96a('0x55')]=function(_0x58852e,_0x26ad99,_0x2d5f79){var _0x46a651={};var _0x567ab0={};var _0x5c10bc;var _0x3efda4;return db[_0xd96a('0x31')][_0xd96a('0x53')]({'where':{'id':_0x58852e[_0xd96a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x26ad99,null))['then'](function(_0xe7400d){if(_0xe7400d){_0x5c10bc=_0xe7400d;_0x567ab0[_0xd96a('0x36')]=_[_0xd96a('0x4b')](db[_0xd96a('0x54')][_0xd96a('0x32')]);_0x567ab0[_0xd96a('0x37')]=_[_0xd96a('0x4b')](_0x58852e[_0xd96a('0x37')]);_0x567ab0['filters']=_[_0xd96a('0x4c')](_0x567ab0[_0xd96a('0x36')],_0x567ab0[_0xd96a('0x37')]);_0x46a651[_0xd96a('0x38')]=_['intersection'](_0x567ab0[_0xd96a('0x36')],qs[_0xd96a('0x39')](_0x58852e[_0xd96a('0x37')][_0xd96a('0x39')]));_0x46a651['attributes']=_0x46a651[_0xd96a('0x38')]['length']?_0x46a651[_0xd96a('0x38')]:_0x567ab0[_0xd96a('0x36')];_0x46a651[_0xd96a('0x3d')]=qs[_0xd96a('0x3e')](_0x58852e['query'][_0xd96a('0x3e')]);_0x46a651['where']=qs[_0xd96a('0x40')](_[_0xd96a('0x41')](_0x58852e[_0xd96a('0x37')],_0x567ab0[_0xd96a('0x40')]));if(_0x58852e[_0xd96a('0x37')][_0xd96a('0x44')]){_0x46a651['where']=_['merge'](_0x46a651['where'],{'$or':_[_0xd96a('0x30')](_0x46a651[_0xd96a('0x38')],function(_0xb2335){var _0x10b09c={};_0x10b09c[_0xb2335]={'$like':'%'+_0x58852e['query']['filter']+'%'};return _0x10b09c;})});}_0x46a651=_['merge']({},_0x46a651,_0x58852e[_0xd96a('0x45')]);return _0x5c10bc['getSubjects'](_0x46a651);}})[_0xd96a('0x19')](function(_0x345e7b){if(_0x345e7b){_0x3efda4=_0x345e7b[_0xd96a('0x3a')];if(!_0x58852e[_0xd96a('0x37')][_0xd96a('0x3b')](_0xd96a('0x3c'))){_0x46a651[_0xd96a('0x28')]=qs[_0xd96a('0x28')](_0x58852e['query']['limit']);_0x46a651[_0xd96a('0x27')]=qs[_0xd96a('0x27')](_0x58852e[_0xd96a('0x37')][_0xd96a('0x27')]);}return _0x5c10bc[_0xd96a('0x55')](_0x46a651);}})[_0xd96a('0x19')](function(_0x2597e1){if(_0x2597e1){return _0x2597e1?{'count':_0x3efda4,'rows':_0x2597e1}:null;}})[_0xd96a('0x19')](respondWithResult(_0x26ad99,null))[_0xd96a('0x22')](handleError(_0x26ad99,null));};exports[_0xd96a('0x56')]=function(_0x29d4c1,_0x19ba92,_0x55f9e2){var _0x4c675a={};var _0x4db3ef={};var _0x33e08;var _0x34e6c2;return db[_0xd96a('0x31')]['findOne']({'where':{'id':_0x29d4c1[_0xd96a('0x4a')]['id']}})[_0xd96a('0x19')](handleEntityNotFound(_0x19ba92,null))[_0xd96a('0x19')](function(_0x4a0f01){if(_0x4a0f01){_0x33e08=_0x4a0f01;_0x4db3ef[_0xd96a('0x36')]=_[_0xd96a('0x4b')](db[_0xd96a('0x54')][_0xd96a('0x32')]);_0x4db3ef[_0xd96a('0x37')]=_[_0xd96a('0x4b')](_0x29d4c1[_0xd96a('0x37')]);_0x4db3ef[_0xd96a('0x40')]=_[_0xd96a('0x4c')](_0x4db3ef[_0xd96a('0x36')],_0x4db3ef[_0xd96a('0x37')]);_0x4c675a[_0xd96a('0x38')]=_['intersection'](_0x4db3ef[_0xd96a('0x36')],qs[_0xd96a('0x39')](_0x29d4c1[_0xd96a('0x37')][_0xd96a('0x39')]));_0x4c675a[_0xd96a('0x38')]=_0x4c675a[_0xd96a('0x38')][_0xd96a('0x3a')]?_0x4c675a[_0xd96a('0x38')]:_0x4db3ef[_0xd96a('0x36')];_0x4c675a[_0xd96a('0x3d')]=qs[_0xd96a('0x3e')](_0x29d4c1['query'][_0xd96a('0x3e')]);_0x4c675a[_0xd96a('0x3f')]=qs[_0xd96a('0x40')](_[_0xd96a('0x41')](_0x29d4c1[_0xd96a('0x37')],_0x4db3ef[_0xd96a('0x40')]));if(_0x29d4c1[_0xd96a('0x37')][_0xd96a('0x44')]){_0x4c675a[_0xd96a('0x3f')]=_['merge'](_0x4c675a[_0xd96a('0x3f')],{'$or':_[_0xd96a('0x30')](_0x4c675a['attributes'],function(_0x5b5aac){var _0x29e632={};_0x29e632[_0x5b5aac]={'$like':'%'+_0x29d4c1['query'][_0xd96a('0x44')]+'%'};return _0x29e632;})});}_0x4c675a=_[_0xd96a('0x42')]({},_0x4c675a,_0x29d4c1[_0xd96a('0x45')]);return _0x33e08[_0xd96a('0x56')](_0x4c675a);}})[_0xd96a('0x19')](function(_0x3d4e1){if(_0x3d4e1){_0x34e6c2=_0x3d4e1['length'];if(!_0x29d4c1['query'][_0xd96a('0x3b')]('nolimit')){_0x4c675a[_0xd96a('0x28')]=qs[_0xd96a('0x28')](_0x29d4c1[_0xd96a('0x37')][_0xd96a('0x28')]);_0x4c675a[_0xd96a('0x27')]=qs['offset'](_0x29d4c1[_0xd96a('0x37')]['offset']);}return _0x33e08[_0xd96a('0x56')](_0x4c675a);}})[_0xd96a('0x19')](function(_0x4228cd){if(_0x4228cd){return _0x4228cd?{'count':_0x34e6c2,'rows':_0x4228cd}:null;}})['then'](respondWithResult(_0x19ba92,null))[_0xd96a('0x22')](handleError(_0x19ba92,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 08d82c8..ac780e3 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 _0xe7f3=['int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe7f3,0x105));var _0x3e7f=function(_0x503c39,_0x7be54a){_0x503c39=_0x503c39-0x0;var _0x2b0de2=_0xe7f3[_0x503c39];return _0x2b0de2;};'use strict';var _=require('lodash');var util=require(_0x3e7f('0x0'));var logger=require(_0x3e7f('0x1'))(_0x3e7f('0x2'));var moment=require(_0x3e7f('0x3'));var BPromise=require(_0x3e7f('0x4'));var rp=require(_0x3e7f('0x5'));var fs=require('fs');var path=require(_0x3e7f('0x6'));var rimraf=require(_0x3e7f('0x7'));var config=require(_0x3e7f('0x8'));var attributes=require(_0x3e7f('0x9'));module[_0x3e7f('0xa')]=function(_0x3cee0b,_0x80edc){return _0x3cee0b[_0x3e7f('0xb')]('VtigerConfiguration',attributes,{'tableName':_0x3e7f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6f8=['int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration'];(function(_0x27ceb7,_0x3e2666){var _0x456a8b=function(_0x58eaeb){while(--_0x58eaeb){_0x27ceb7['push'](_0x27ceb7['shift']());}};_0x456a8b(++_0x3e2666);}(_0xe6f8,0x17a));var _0x8e6f=function(_0x1c7494,_0x366f1f){_0x1c7494=_0x1c7494-0x0;var _0x43d3e9=_0xe6f8[_0x1c7494];return _0x43d3e9;};'use strict';var _=require(_0x8e6f('0x0'));var util=require(_0x8e6f('0x1'));var logger=require(_0x8e6f('0x2'))(_0x8e6f('0x3'));var moment=require(_0x8e6f('0x4'));var BPromise=require(_0x8e6f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e6f('0x6'));var rimraf=require(_0x8e6f('0x7'));var config=require(_0x8e6f('0x8'));var attributes=require(_0x8e6f('0x9'));module[_0x8e6f('0xa')]=function(_0xf1bf7d,_0xaf0931){return _0xf1bf7d['define'](_0x8e6f('0xb'),attributes,{'tableName':_0x8e6f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 9509c69..bec380f 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 _0xe4de=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x5bdb53,_0x427d10){var _0x15250a=function(_0x5f19d0){while(--_0x5f19d0){_0x5bdb53['push'](_0x5bdb53['shift']());}};_0x15250a(++_0x427d10);}(_0xe4de,0xb3));var _0xee4d=function(_0x4b1137,_0x56a35a){_0x4b1137=_0x4b1137-0x0;var _0x3a1713=_0xe4de[_0x4b1137];return _0x3a1713;};'use strict';var _=require(_0xee4d('0x0'));var util=require(_0xee4d('0x1'));var moment=require(_0xee4d('0x2'));var BPromise=require(_0xee4d('0x3'));var rs=require(_0xee4d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee4d('0x5'))['db'];var utils=require(_0xee4d('0x6'));var logger=require(_0xee4d('0x7'))(_0xee4d('0x8'));var config=require(_0xee4d('0x9'));var jayson=require(_0xee4d('0xa'));var client=jayson[_0xee4d('0xb')][_0xee4d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x469f1a,_0x29133e,_0x278c42){return new BPromise(function(_0x1094e1,_0x4c74bc){return client[_0xee4d('0xd')](_0x469f1a,_0x278c42)[_0xee4d('0xe')](function(_0x4200b3){logger[_0xee4d('0xf')](_0xee4d('0x10'),_0x29133e,_0xee4d('0x11'));logger[_0xee4d('0x12')](_0xee4d('0x13'),_0x29133e,_0xee4d('0x11'),JSON[_0xee4d('0x14')](_0x4200b3));if(_0x4200b3[_0xee4d('0x15')]){if(_0x4200b3['error'][_0xee4d('0x16')]===0x1f4){logger[_0xee4d('0x15')](_0xee4d('0x10'),_0x29133e,_0x4200b3[_0xee4d('0x15')][_0xee4d('0x17')]);return _0x4c74bc(_0x4200b3[_0xee4d('0x15')][_0xee4d('0x17')]);}logger[_0xee4d('0x15')]('VtigerConfiguration,\x20%s,\x20%s',_0x29133e,_0x4200b3[_0xee4d('0x15')][_0xee4d('0x17')]);return _0x1094e1(_0x4200b3[_0xee4d('0x15')][_0xee4d('0x17')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x29133e,_0xee4d('0x11'));_0x1094e1(_0x4200b3[_0xee4d('0x18')]['message']);}})[_0xee4d('0x19')](function(_0x49b768){logger[_0xee4d('0x15')](_0xee4d('0x10'),_0x29133e,_0x49b768);_0x4c74bc(_0x49b768);});});} \ No newline at end of file +var _0x2153=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','util','bluebird'];(function(_0x569817,_0x3f6254){var _0x71c1b4=function(_0x3816b1){while(--_0x3816b1){_0x569817['push'](_0x569817['shift']());}};_0x71c1b4(++_0x3f6254);}(_0x2153,0x1a0));var _0x3215=function(_0x228239,_0x3a051f){_0x228239=_0x228239-0x0;var _0x2024c1=_0x2153[_0x228239];return _0x2024c1;};'use strict';var _=require('lodash');var util=require(_0x3215('0x0'));var moment=require('moment');var BPromise=require(_0x3215('0x1'));var rs=require(_0x3215('0x2'));var fs=require('fs');var Redis=require(_0x3215('0x3'));var db=require(_0x3215('0x4'))['db'];var utils=require(_0x3215('0x5'));var logger=require(_0x3215('0x6'))('rpc');var config=require(_0x3215('0x7'));var jayson=require(_0x3215('0x8'));var client=jayson['client'][_0x3215('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fccd2,_0x5e65b8,_0x4a0cf4){return new BPromise(function(_0x533b8c,_0x1d573b){return client['request'](_0x1fccd2,_0x4a0cf4)['then'](function(_0x145f8d){logger['info'](_0x3215('0xa'),_0x5e65b8,_0x3215('0xb'));logger[_0x3215('0xc')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x5e65b8,_0x3215('0xb'),JSON[_0x3215('0xd')](_0x145f8d));if(_0x145f8d[_0x3215('0xe')]){if(_0x145f8d[_0x3215('0xe')][_0x3215('0xf')]===0x1f4){logger[_0x3215('0xe')](_0x3215('0xa'),_0x5e65b8,_0x145f8d['error']['message']);return _0x1d573b(_0x145f8d['error'][_0x3215('0x10')]);}logger['error'](_0x3215('0xa'),_0x5e65b8,_0x145f8d['error']['message']);return _0x533b8c(_0x145f8d[_0x3215('0xe')]['message']);}else{logger[_0x3215('0x11')](_0x3215('0xa'),_0x5e65b8,_0x3215('0xb'));_0x533b8c(_0x145f8d['result'][_0x3215('0x10')]);}})[_0x3215('0x12')](function(_0x57be04){logger[_0x3215('0xe')](_0x3215('0xa'),_0x5e65b8,_0x57be04);_0x1d573b(_0x57be04);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 28bf747..0abc933 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 _0xc144=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','update','delete','destroy','exports','multer','util'];(function(_0x3e7649,_0x514260){var _0x5afe90=function(_0x5d7765){while(--_0x5d7765){_0x3e7649['push'](_0x3e7649['shift']());}};_0x5afe90(++_0x514260);}(_0xc144,0x67));var _0x4c14=function(_0x58d7eb,_0x3b2190){_0x58d7eb=_0x58d7eb-0x0;var _0x5e5dfc=_0xc144[_0x58d7eb];return _0x5e5dfc;};'use strict';var multer=require(_0x4c14('0x0'));var util=require(_0x4c14('0x1'));var path=require(_0x4c14('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4c14('0x3')]();var auth=require(_0x4c14('0x4'));var interaction=require(_0x4c14('0x5'));var config=require(_0x4c14('0x6'));var controller=require(_0x4c14('0x7'));router[_0x4c14('0x8')]('/',auth[_0x4c14('0x9')](),controller['index']);router[_0x4c14('0x8')]('/:id',auth[_0x4c14('0x9')](),controller['show']);router['post']('/',auth[_0x4c14('0x9')](),controller['create']);router['put'](_0x4c14('0xa'),auth[_0x4c14('0x9')](),controller[_0x4c14('0xb')]);router[_0x4c14('0xc')](_0x4c14('0xa'),auth[_0x4c14('0x9')](),controller[_0x4c14('0xd')]);module[_0x4c14('0xe')]=router; \ No newline at end of file +var _0xc6ec=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','/:id','show','post'];(function(_0x37e772,_0xeab53c){var _0x28caa5=function(_0x2ef5aa){while(--_0x2ef5aa){_0x37e772['push'](_0x37e772['shift']());}};_0x28caa5(++_0xeab53c);}(_0xc6ec,0x1a8));var _0xcc6e=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0xc6ec[_0x47e93d];return _0xe86c46;};'use strict';var multer=require(_0xcc6e('0x0'));var util=require(_0xcc6e('0x1'));var path=require(_0xcc6e('0x2'));var timeout=require('connect-timeout');var express=require(_0xcc6e('0x3'));var router=express[_0xcc6e('0x4')]();var auth=require(_0xcc6e('0x5'));var interaction=require(_0xcc6e('0x6'));var config=require('../../config/environment');var controller=require(_0xcc6e('0x7'));router[_0xcc6e('0x8')]('/',auth[_0xcc6e('0x9')](),controller['index']);router[_0xcc6e('0x8')](_0xcc6e('0xa'),auth['isAuthenticated'](),controller[_0xcc6e('0xb')]);router[_0xcc6e('0xc')]('/',auth[_0xcc6e('0x9')](),controller[_0xcc6e('0xd')]);router[_0xcc6e('0xe')]('/:id',auth[_0xcc6e('0x9')](),controller[_0xcc6e('0xf')]);router[_0xcc6e('0x10')](_0xcc6e('0xa'),auth[_0xcc6e('0x9')](),controller[_0xcc6e('0x11')]);module[_0xcc6e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 41f8df7..1a309fb 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 _0xbc9d=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x1a4cb2,_0x32a85a){var _0x202c6b=function(_0x217305){while(--_0x217305){_0x1a4cb2['push'](_0x1a4cb2['shift']());}};_0x202c6b(++_0x32a85a);}(_0xbc9d,0xcc));var _0xdbc9=function(_0x57a464,_0xca6f3b){_0x57a464=_0x57a464-0x0;var _0x4514ef=_0xbc9d[_0x57a464];return _0x4514ef;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'type':{'type':Sequelize[_0xdbc9('0x2')](_0xdbc9('0x3'),'variable',_0xdbc9('0x4'),_0xdbc9('0x5')),'defaultValue':_0xdbc9('0x3')},'content':{'type':Sequelize[_0xdbc9('0x6')]},'key':{'type':Sequelize[_0xdbc9('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xdbc9('0x3'),'variable',_0xdbc9('0x4'))},'keyContent':{'type':Sequelize[_0xdbc9('0x6')]},'idField':{'type':Sequelize[_0xdbc9('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdbc9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdbc9('0x6')]}}; \ No newline at end of file +var _0xe64a=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x26a44e,_0x18c43f){var _0x566fc4=function(_0x1fd0cb){while(--_0x1fd0cb){_0x26a44e['push'](_0x26a44e['shift']());}};_0x566fc4(++_0x18c43f);}(_0xe64a,0x1e0));var _0xae64=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe64a[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xae64('0x0'));module[_0xae64('0x1')]={'type':{'type':Sequelize[_0xae64('0x2')](_0xae64('0x3'),_0xae64('0x4'),_0xae64('0x5'),_0xae64('0x6')),'defaultValue':_0xae64('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xae64('0x4'),_0xae64('0x5'))},'keyContent':{'type':Sequelize[_0xae64('0x7')]},'idField':{'type':Sequelize[_0xae64('0x7')]},'nameField':{'type':Sequelize[_0xae64('0x7')]},'customField':{'type':Sequelize[_0xae64('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xae64('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 73ba653..4670bd2 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 _0x41d0=['key','keys','intersection','query','attributes','model','fields','length','nolimit','sort','where','pick','filters','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0x41d0,0x1c6));var _0x041d=function(_0x4a77e4,_0x556f71){_0x4a77e4=_0x4a77e4-0x0;var _0x1c68d8=_0x41d0[_0x4a77e4];return _0x1c68d8;};'use strict';var pdf=require(_0x041d('0x0'));var emlformat=require(_0x041d('0x1'));var rimraf=require(_0x041d('0x2'));var zipdir=require(_0x041d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x041d('0x4'));var moment=require(_0x041d('0x5'));var BPromise=require(_0x041d('0x6'));var Mustache=require(_0x041d('0x7'));var util=require(_0x041d('0x8'));var path=require(_0x041d('0x9'));var sox=require(_0x041d('0xa'));var csv=require(_0x041d('0xb'));var ejs=require(_0x041d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x041d('0xd'));var crypto=require('crypto');var jsforce=require(_0x041d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x041d('0xb'));var querystring=require(_0x041d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x041d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x041d('0x11'));var logger=require('../../config/logger')(_0x041d('0x12'));var utils=require(_0x041d('0x13'));var config=require(_0x041d('0x14'));var licenseUtil=require(_0x041d('0x15'));var db=require(_0x041d('0x16'))['db'];function respondWithStatusCode(_0x51b1d1,_0x34b0f9){_0x34b0f9=_0x34b0f9||0xcc;return function(_0x111e9b){if(_0x111e9b){return _0x51b1d1[_0x041d('0x17')](_0x34b0f9);}return _0x51b1d1['status'](_0x34b0f9)[_0x041d('0x18')]();};}function respondWithResult(_0x3205ea,_0x61dc3b){_0x61dc3b=_0x61dc3b||0xc8;return function(_0x1efe79){if(_0x1efe79){return _0x3205ea[_0x041d('0x19')](_0x61dc3b)[_0x041d('0x1a')](_0x1efe79);}};}function respondWithFilteredResult(_0x481221,_0xaadc6f){return function(_0x167cfe){if(_0x167cfe){var _0x362289=_0x167cfe['count'],_0x1f7ef6=_0xaadc6f['offset'],_0x287fde=_0xaadc6f[_0x041d('0x1b')]+_0xaadc6f[_0x041d('0x1c')],_0x1c581b;if(_0x287fde>=_0x362289){_0x287fde=_0x362289;_0x1c581b=0xc8;}else{_0x1c581b=0xce;}_0x481221['status'](_0x1c581b);return _0x481221[_0x041d('0x1d')]('Content-Range',_0x1f7ef6+'-'+_0x287fde+'/'+_0x362289)[_0x041d('0x1a')](_0x167cfe);}return null;};}function patchUpdates(_0x2d51dc){return function(_0x137878){try{jsonpatch['apply'](_0x137878,_0x2d51dc,!![]);}catch(_0x3505e7){return BPromise['reject'](_0x3505e7);}return _0x137878['save']();};}function saveUpdates(_0x22a8d9,_0x597c1d){return function(_0x211bb6){if(_0x211bb6){return _0x211bb6[_0x041d('0x1e')](_0x22a8d9)[_0x041d('0x1f')](function(_0x3c4417){return _0x3c4417;});}return null;};}function removeEntity(_0xb6ec9a,_0x6ee379){return function(_0x437841){if(_0x437841){return _0x437841[_0x041d('0x20')]()['then'](function(){_0xb6ec9a[_0x041d('0x19')](0xcc)[_0x041d('0x18')]();});}};}function handleEntityNotFound(_0x6058d7,_0x6c8547){return function(_0x7f80d6){if(!_0x7f80d6){_0x6058d7['sendStatus'](0x194);}return _0x7f80d6;};}function handleError(_0x3c8715,_0x31481d){_0x31481d=_0x31481d||0x1f4;return function(_0x3e04e3){logger[_0x041d('0x21')](_0x3e04e3[_0x041d('0x22')]);if(_0x3e04e3[_0x041d('0x23')]){delete _0x3e04e3[_0x041d('0x23')];}_0x3c8715[_0x041d('0x19')](_0x31481d)[_0x041d('0x24')](_0x3e04e3);};}exports[_0x041d('0x25')]=function(_0x366fe8,_0xaa3bc0){var _0x9d3655={},_0x2383ef={},_0x417411={'count':0x0,'rows':[]};var _0x3d89c6=_[_0x041d('0x26')](db[_0x041d('0x27')][_0x041d('0x28')],function(_0x18b06b){return{'name':_0x18b06b[_0x041d('0x29')],'type':_0x18b06b[_0x041d('0x2a')][_0x041d('0x2b')]};});_0x2383ef['model']=_[_0x041d('0x26')](_0x3d89c6,_0x041d('0x23'));_0x2383ef['query']=_[_0x041d('0x2c')](_0x366fe8['query']);_0x2383ef['filters']=_[_0x041d('0x2d')](_0x2383ef['model'],_0x2383ef[_0x041d('0x2e')]);_0x9d3655[_0x041d('0x2f')]=_['intersection'](_0x2383ef[_0x041d('0x30')],qs[_0x041d('0x31')](_0x366fe8[_0x041d('0x2e')][_0x041d('0x31')]));_0x9d3655['attributes']=_0x9d3655[_0x041d('0x2f')][_0x041d('0x32')]?_0x9d3655[_0x041d('0x2f')]:_0x2383ef[_0x041d('0x30')];if(!_0x366fe8[_0x041d('0x2e')]['hasOwnProperty'](_0x041d('0x33'))){_0x9d3655['limit']=qs[_0x041d('0x1c')](_0x366fe8[_0x041d('0x2e')]['limit']);_0x9d3655['offset']=qs[_0x041d('0x1b')](_0x366fe8[_0x041d('0x2e')][_0x041d('0x1b')]);}_0x9d3655['order']=qs[_0x041d('0x34')](_0x366fe8[_0x041d('0x2e')][_0x041d('0x34')]);_0x9d3655[_0x041d('0x35')]=qs['filters'](_[_0x041d('0x36')](_0x366fe8['query'],_0x2383ef[_0x041d('0x37')]),_0x3d89c6);if(_0x366fe8[_0x041d('0x2e')]['filter']){_0x9d3655[_0x041d('0x35')]=_['merge'](_0x9d3655[_0x041d('0x35')],{'$or':_[_0x041d('0x26')](_0x3d89c6,function(_0x4bf62e){if(_0x4bf62e[_0x041d('0x2a')]!==_0x041d('0x38')){var _0x4bdfcb={};_0x4bdfcb[_0x4bf62e[_0x041d('0x23')]]={'$like':'%'+_0x366fe8[_0x041d('0x2e')][_0x041d('0x39')]+'%'};return _0x4bdfcb;}})});}_0x9d3655=_[_0x041d('0x3a')]({},_0x9d3655,_0x366fe8[_0x041d('0x3b')]);var _0xf32448={'where':_0x9d3655[_0x041d('0x35')]};return db[_0x041d('0x27')][_0x041d('0x3c')](_0xf32448)[_0x041d('0x1f')](function(_0x3ba33a){_0x417411[_0x041d('0x3c')]=_0x3ba33a;if(_0x366fe8['query'][_0x041d('0x3d')]){_0x9d3655[_0x041d('0x3e')]=[{'all':!![]}];}return db[_0x041d('0x27')][_0x041d('0x3f')](_0x9d3655);})['then'](function(_0x2c1430){_0x417411[_0x041d('0x40')]=_0x2c1430;return _0x417411;})[_0x041d('0x1f')](respondWithFilteredResult(_0xaa3bc0,_0x9d3655))[_0x041d('0x41')](handleError(_0xaa3bc0,null));};exports[_0x041d('0x42')]=function(_0x10156e,_0x27745c){var _0x47004a={'raw':!![],'where':{'id':_0x10156e['params']['id']}},_0x979449={};_0x979449[_0x041d('0x30')]=_[_0x041d('0x2c')](db['VtigerField']['rawAttributes']);_0x979449['query']=_['keys'](_0x10156e['query']);_0x979449[_0x041d('0x37')]=_[_0x041d('0x2d')](_0x979449['model'],_0x979449['query']);_0x47004a[_0x041d('0x2f')]=_[_0x041d('0x2d')](_0x979449[_0x041d('0x30')],qs[_0x041d('0x31')](_0x10156e['query']['fields']));_0x47004a[_0x041d('0x2f')]=_0x47004a[_0x041d('0x2f')][_0x041d('0x32')]?_0x47004a[_0x041d('0x2f')]:_0x979449[_0x041d('0x30')];if(_0x10156e[_0x041d('0x2e')][_0x041d('0x3d')]){_0x47004a['include']=[{'all':!![]}];}_0x47004a=_[_0x041d('0x3a')]({},_0x47004a,_0x10156e[_0x041d('0x3b')]);return db[_0x041d('0x27')][_0x041d('0x43')](_0x47004a)[_0x041d('0x1f')](handleEntityNotFound(_0x27745c,null))['then'](respondWithResult(_0x27745c,null))['catch'](handleError(_0x27745c,null));};exports['create']=function(_0x4be216,_0x1b761b){return db[_0x041d('0x27')][_0x041d('0x44')](_0x4be216['body'],{})['then'](respondWithResult(_0x1b761b,0xc9))[_0x041d('0x41')](handleError(_0x1b761b,null));};exports[_0x041d('0x1e')]=function(_0x3e06e9,_0x59e60d){if(_0x3e06e9['body']['id']){delete _0x3e06e9[_0x041d('0x45')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x3e06e9['params']['id']}})[_0x041d('0x1f')](handleEntityNotFound(_0x59e60d,null))[_0x041d('0x1f')](saveUpdates(_0x3e06e9[_0x041d('0x45')],null))[_0x041d('0x1f')](respondWithResult(_0x59e60d,null))[_0x041d('0x41')](handleError(_0x59e60d,null));};exports['destroy']=function(_0x548073,_0x7dd672){return db[_0x041d('0x27')][_0x041d('0x43')]({'where':{'id':_0x548073[_0x041d('0x46')]['id']}})['then'](handleEntityNotFound(_0x7dd672,null))[_0x041d('0x1f')](removeEntity(_0x7dd672,null))[_0x041d('0x41')](handleError(_0x7dd672,null));}; \ No newline at end of file +var _0xcf98=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','count','offset','limit','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create'];(function(_0x510743,_0xdb5ce5){var _0x3c2dbe=function(_0x6839ba){while(--_0x6839ba){_0x510743['push'](_0x510743['shift']());}};_0x3c2dbe(++_0xdb5ce5);}(_0xcf98,0x8d));var _0x8cf9=function(_0x1a8da6,_0x436b1e){_0x1a8da6=_0x1a8da6-0x0;var _0x37ef66=_0xcf98[_0x1a8da6];return _0x37ef66;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8cf9('0x0'));var rimraf=require(_0x8cf9('0x1'));var zipdir=require(_0x8cf9('0x2'));var jsonpatch=require(_0x8cf9('0x3'));var rp=require(_0x8cf9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8cf9('0x5'));var util=require(_0x8cf9('0x6'));var path=require(_0x8cf9('0x7'));var sox=require(_0x8cf9('0x8'));var csv=require(_0x8cf9('0x9'));var ejs=require(_0x8cf9('0xa'));var fs=require('fs');var _=require(_0x8cf9('0xb'));var squel=require(_0x8cf9('0xc'));var crypto=require(_0x8cf9('0xd'));var jsforce=require(_0x8cf9('0xe'));var deskjs=require(_0x8cf9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8cf9('0x10'));var Papa=require(_0x8cf9('0x11'));var Redis=require('ioredis');var authService=require(_0x8cf9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8cf9('0x13'));var hardwareService=require(_0x8cf9('0x14'));var logger=require(_0x8cf9('0x15'))(_0x8cf9('0x16'));var utils=require(_0x8cf9('0x17'));var config=require(_0x8cf9('0x18'));var licenseUtil=require(_0x8cf9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bfed9,_0x4c9466){_0x4c9466=_0x4c9466||0xcc;return function(_0x564241){if(_0x564241){return _0x2bfed9['sendStatus'](_0x4c9466);}return _0x2bfed9[_0x8cf9('0x1a')](_0x4c9466)['end']();};}function respondWithResult(_0x5c3482,_0x41b825){_0x41b825=_0x41b825||0xc8;return function(_0x133b59){if(_0x133b59){return _0x5c3482[_0x8cf9('0x1a')](_0x41b825)['json'](_0x133b59);}};}function respondWithFilteredResult(_0x202b83,_0x42d10a){return function(_0x5ac918){if(_0x5ac918){var _0x349187=_0x5ac918[_0x8cf9('0x1b')],_0xc13eeb=_0x42d10a[_0x8cf9('0x1c')],_0x2417d8=_0x42d10a[_0x8cf9('0x1c')]+_0x42d10a[_0x8cf9('0x1d')],_0x46a573;if(_0x2417d8>=_0x349187){_0x2417d8=_0x349187;_0x46a573=0xc8;}else{_0x46a573=0xce;}_0x202b83[_0x8cf9('0x1a')](_0x46a573);return _0x202b83[_0x8cf9('0x1e')](_0x8cf9('0x1f'),_0xc13eeb+'-'+_0x2417d8+'/'+_0x349187)[_0x8cf9('0x20')](_0x5ac918);}return null;};}function patchUpdates(_0x3c4641){return function(_0x44e6d7){try{jsonpatch[_0x8cf9('0x21')](_0x44e6d7,_0x3c4641,!![]);}catch(_0x3a6a21){return BPromise['reject'](_0x3a6a21);}return _0x44e6d7['save']();};}function saveUpdates(_0x13bf21,_0x5cc647){return function(_0x34c07d){if(_0x34c07d){return _0x34c07d[_0x8cf9('0x22')](_0x13bf21)[_0x8cf9('0x23')](function(_0x275a0e){return _0x275a0e;});}return null;};}function removeEntity(_0x448f4f,_0xe7f8b4){return function(_0x207f32){if(_0x207f32){return _0x207f32[_0x8cf9('0x24')]()['then'](function(){_0x448f4f[_0x8cf9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5be3ae,_0x29801b){return function(_0x166fe2){if(!_0x166fe2){_0x5be3ae['sendStatus'](0x194);}return _0x166fe2;};}function handleError(_0x284c2d,_0x57aa3a){_0x57aa3a=_0x57aa3a||0x1f4;return function(_0x4d07fa){logger[_0x8cf9('0x25')](_0x4d07fa[_0x8cf9('0x26')]);if(_0x4d07fa['name']){delete _0x4d07fa[_0x8cf9('0x27')];}_0x284c2d[_0x8cf9('0x1a')](_0x57aa3a)[_0x8cf9('0x28')](_0x4d07fa);};}exports[_0x8cf9('0x29')]=function(_0x475566,_0x500b8e){var _0x53b580={},_0x2aaff0={},_0x30f245={'count':0x0,'rows':[]};var _0x2a4466=_[_0x8cf9('0x2a')](db[_0x8cf9('0x2b')][_0x8cf9('0x2c')],function(_0x13fa60){return{'name':_0x13fa60[_0x8cf9('0x2d')],'type':_0x13fa60[_0x8cf9('0x2e')]['key']};});_0x2aaff0['model']=_[_0x8cf9('0x2a')](_0x2a4466,'name');_0x2aaff0[_0x8cf9('0x2f')]=_[_0x8cf9('0x30')](_0x475566[_0x8cf9('0x2f')]);_0x2aaff0[_0x8cf9('0x31')]=_['intersection'](_0x2aaff0[_0x8cf9('0x32')],_0x2aaff0[_0x8cf9('0x2f')]);_0x53b580[_0x8cf9('0x33')]=_[_0x8cf9('0x34')](_0x2aaff0[_0x8cf9('0x32')],qs[_0x8cf9('0x35')](_0x475566[_0x8cf9('0x2f')]['fields']));_0x53b580['attributes']=_0x53b580[_0x8cf9('0x33')][_0x8cf9('0x36')]?_0x53b580[_0x8cf9('0x33')]:_0x2aaff0[_0x8cf9('0x32')];if(!_0x475566[_0x8cf9('0x2f')][_0x8cf9('0x37')]('nolimit')){_0x53b580[_0x8cf9('0x1d')]=qs[_0x8cf9('0x1d')](_0x475566[_0x8cf9('0x2f')][_0x8cf9('0x1d')]);_0x53b580[_0x8cf9('0x1c')]=qs[_0x8cf9('0x1c')](_0x475566[_0x8cf9('0x2f')][_0x8cf9('0x1c')]);}_0x53b580['order']=qs[_0x8cf9('0x38')](_0x475566[_0x8cf9('0x2f')][_0x8cf9('0x38')]);_0x53b580['where']=qs[_0x8cf9('0x31')](_['pick'](_0x475566[_0x8cf9('0x2f')],_0x2aaff0['filters']),_0x2a4466);if(_0x475566[_0x8cf9('0x2f')]['filter']){_0x53b580[_0x8cf9('0x39')]=_['merge'](_0x53b580[_0x8cf9('0x39')],{'$or':_['map'](_0x2a4466,function(_0x4f318c){if(_0x4f318c[_0x8cf9('0x2e')]!=='VIRTUAL'){var _0x45f701={};_0x45f701[_0x4f318c['name']]={'$like':'%'+_0x475566[_0x8cf9('0x2f')]['filter']+'%'};return _0x45f701;}})});}_0x53b580=_[_0x8cf9('0x3a')]({},_0x53b580,_0x475566[_0x8cf9('0x3b')]);var _0x14fdc1={'where':_0x53b580[_0x8cf9('0x39')]};return db[_0x8cf9('0x2b')][_0x8cf9('0x1b')](_0x14fdc1)[_0x8cf9('0x23')](function(_0x1f4c52){_0x30f245[_0x8cf9('0x1b')]=_0x1f4c52;if(_0x475566[_0x8cf9('0x2f')][_0x8cf9('0x3c')]){_0x53b580[_0x8cf9('0x3d')]=[{'all':!![]}];}return db[_0x8cf9('0x2b')][_0x8cf9('0x3e')](_0x53b580);})['then'](function(_0x2d4b14){_0x30f245[_0x8cf9('0x3f')]=_0x2d4b14;return _0x30f245;})[_0x8cf9('0x23')](respondWithFilteredResult(_0x500b8e,_0x53b580))[_0x8cf9('0x40')](handleError(_0x500b8e,null));};exports[_0x8cf9('0x41')]=function(_0x106a39,_0x2ed713){var _0x5d4c08={'raw':!![],'where':{'id':_0x106a39[_0x8cf9('0x42')]['id']}},_0x3a6f5f={};_0x3a6f5f[_0x8cf9('0x32')]=_[_0x8cf9('0x30')](db['VtigerField'][_0x8cf9('0x2c')]);_0x3a6f5f[_0x8cf9('0x2f')]=_[_0x8cf9('0x30')](_0x106a39[_0x8cf9('0x2f')]);_0x3a6f5f[_0x8cf9('0x31')]=_[_0x8cf9('0x34')](_0x3a6f5f[_0x8cf9('0x32')],_0x3a6f5f['query']);_0x5d4c08[_0x8cf9('0x33')]=_[_0x8cf9('0x34')](_0x3a6f5f[_0x8cf9('0x32')],qs[_0x8cf9('0x35')](_0x106a39['query']['fields']));_0x5d4c08[_0x8cf9('0x33')]=_0x5d4c08[_0x8cf9('0x33')]['length']?_0x5d4c08[_0x8cf9('0x33')]:_0x3a6f5f[_0x8cf9('0x32')];if(_0x106a39[_0x8cf9('0x2f')][_0x8cf9('0x3c')]){_0x5d4c08[_0x8cf9('0x3d')]=[{'all':!![]}];}_0x5d4c08=_[_0x8cf9('0x3a')]({},_0x5d4c08,_0x106a39['options']);return db[_0x8cf9('0x2b')][_0x8cf9('0x43')](_0x5d4c08)['then'](handleEntityNotFound(_0x2ed713,null))[_0x8cf9('0x23')](respondWithResult(_0x2ed713,null))[_0x8cf9('0x40')](handleError(_0x2ed713,null));};exports[_0x8cf9('0x44')]=function(_0x543172,_0x42755e){return db[_0x8cf9('0x2b')]['create'](_0x543172[_0x8cf9('0x45')],{})['then'](respondWithResult(_0x42755e,0xc9))['catch'](handleError(_0x42755e,null));};exports[_0x8cf9('0x22')]=function(_0x2af1ed,_0x1324dd){if(_0x2af1ed[_0x8cf9('0x45')]['id']){delete _0x2af1ed[_0x8cf9('0x45')]['id'];}return db[_0x8cf9('0x2b')][_0x8cf9('0x43')]({'where':{'id':_0x2af1ed['params']['id']}})[_0x8cf9('0x23')](handleEntityNotFound(_0x1324dd,null))[_0x8cf9('0x23')](saveUpdates(_0x2af1ed[_0x8cf9('0x45')],null))[_0x8cf9('0x23')](respondWithResult(_0x1324dd,null))['catch'](handleError(_0x1324dd,null));};exports[_0x8cf9('0x24')]=function(_0x29c17b,_0x18c93e){return db['VtigerField']['find']({'where':{'id':_0x29c17b['params']['id']}})[_0x8cf9('0x23')](handleEntityNotFound(_0x18c93e,null))[_0x8cf9('0x23')](removeEntity(_0x18c93e,null))['catch'](handleError(_0x18c93e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 84b0e62..12ce2a2 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(_0xe8e0d5,_0x6dc83a){var _0x22786e=function(_0x9dfbb1){while(--_0x9dfbb1){_0xe8e0d5['push'](_0xe8e0d5['shift']());}};_0x22786e(++_0x6dc83a);}(_0x7a54,0x106));var _0x47a5=function(_0x2cd703,_0x13e43b){_0x2cd703=_0x2cd703-0x0;var _0xeb3fe0=_0x7a54[_0x2cd703];return _0xeb3fe0;};'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(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_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 7352189..e04ae96 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 _0x18c9=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','lodash','util','moment','bluebird'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x18c9,0x13c));var _0x918c=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x18c9[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x918c('0x0'));var util=require(_0x918c('0x1'));var moment=require(_0x918c('0x2'));var BPromise=require(_0x918c('0x3'));var rs=require(_0x918c('0x4'));var fs=require('fs');var Redis=require(_0x918c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x918c('0x6'));var logger=require(_0x918c('0x7'))('rpc');var config=require(_0x918c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x918c('0x9')][_0x918c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x467d0b,_0x2aa435,_0x2a8add){return new BPromise(function(_0x4ad426,_0x2845d2){return client['request'](_0x467d0b,_0x2a8add)['then'](function(_0xc0b338){logger[_0x918c('0xb')](_0x918c('0xc'),_0x2aa435,_0x918c('0xd'));logger[_0x918c('0xe')](_0x918c('0xf'),_0x2aa435,_0x918c('0xd'),JSON[_0x918c('0x10')](_0xc0b338));if(_0xc0b338['error']){if(_0xc0b338['error'][_0x918c('0x11')]===0x1f4){logger[_0x918c('0x12')](_0x918c('0xc'),_0x2aa435,_0xc0b338[_0x918c('0x12')][_0x918c('0x13')]);return _0x2845d2(_0xc0b338['error'][_0x918c('0x13')]);}logger[_0x918c('0x12')](_0x918c('0xc'),_0x2aa435,_0xc0b338[_0x918c('0x12')][_0x918c('0x13')]);return _0x4ad426(_0xc0b338[_0x918c('0x12')][_0x918c('0x13')]);}else{logger[_0x918c('0xb')](_0x918c('0xc'),_0x2aa435,'request\x20sent');_0x4ad426(_0xc0b338['result']['message']);}})['catch'](function(_0x4fa363){logger[_0x918c('0x12')]('VtigerField,\x20%s,\x20%s',_0x2aa435,_0x4fa363);_0x2845d2(_0x4fa363);});});} \ No newline at end of file +var _0xb264=['code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x59e356,_0x1b3204){var _0x298e08=function(_0x48881d){while(--_0x48881d){_0x59e356['push'](_0x59e356['shift']());}};_0x298e08(++_0x1b3204);}(_0xb264,0x108));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4b26('0x0'));var util=require(_0x4b26('0x1'));var moment=require('moment');var BPromise=require(_0x4b26('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b26('0x3'))['db'];var utils=require(_0x4b26('0x4'));var logger=require(_0x4b26('0x5'))(_0x4b26('0x6'));var config=require(_0x4b26('0x7'));var jayson=require(_0x4b26('0x8'));var client=jayson[_0x4b26('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x165096,_0x337ddc,_0x5a8c67){return new BPromise(function(_0x1edb7c,_0xec9f8a){return client[_0x4b26('0xa')](_0x165096,_0x5a8c67)['then'](function(_0x2ab5e2){logger[_0x4b26('0xb')](_0x4b26('0xc'),_0x337ddc,_0x4b26('0xd'));logger[_0x4b26('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x337ddc,_0x4b26('0xd'),JSON['stringify'](_0x2ab5e2));if(_0x2ab5e2[_0x4b26('0xf')]){if(_0x2ab5e2[_0x4b26('0xf')][_0x4b26('0x10')]===0x1f4){logger[_0x4b26('0xf')](_0x4b26('0xc'),_0x337ddc,_0x2ab5e2['error'][_0x4b26('0x11')]);return _0xec9f8a(_0x2ab5e2[_0x4b26('0xf')]['message']);}logger['error'](_0x4b26('0xc'),_0x337ddc,_0x2ab5e2['error'][_0x4b26('0x11')]);return _0x1edb7c(_0x2ab5e2[_0x4b26('0xf')][_0x4b26('0x11')]);}else{logger['info'](_0x4b26('0xc'),_0x337ddc,_0x4b26('0xd'));_0x1edb7c(_0x2ab5e2[_0x4b26('0x12')][_0x4b26('0x11')]);}})[_0x4b26('0x13')](function(_0x1582a3){logger[_0x4b26('0xf')](_0x4b26('0xc'),_0x337ddc,_0x1582a3);_0xec9f8a(_0x1582a3);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index cdabf45..9f89e4e 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 _0xc224=['isAuthenticated','index','get','/:id','show','getFields','post','/:id/configurations','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller'];(function(_0x27ffa0,_0x3e6c4a){var _0x37c18b=function(_0x3accb1){while(--_0x3accb1){_0x27ffa0['push'](_0x27ffa0['shift']());}};_0x37c18b(++_0x3e6c4a);}(_0xc224,0x15c));var _0x4c22=function(_0x40e13a,_0x5672b6){_0x40e13a=_0x40e13a-0x0;var _0x4bd9ef=_0xc224[_0x40e13a];return _0x4bd9ef;};'use strict';var multer=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var path=require(_0x4c22('0x2'));var timeout=require(_0x4c22('0x3'));var express=require(_0x4c22('0x4'));var router=express[_0x4c22('0x5')]();var auth=require(_0x4c22('0x6'));var interaction=require(_0x4c22('0x7'));var config=require('../../config/environment');var controller=require(_0x4c22('0x8'));router['get']('/',auth[_0x4c22('0x9')](),controller[_0x4c22('0xa')]);router[_0x4c22('0xb')](_0x4c22('0xc'),auth[_0x4c22('0x9')](),controller[_0x4c22('0xd')]);router[_0x4c22('0xb')]('/:id/configurations',auth[_0x4c22('0x9')](),controller['getConfigurations']);router[_0x4c22('0xb')]('/:id/fields',auth[_0x4c22('0x9')](),controller[_0x4c22('0xe')]);router[_0x4c22('0xf')]('/',auth[_0x4c22('0x9')](),controller['create']);router[_0x4c22('0xf')](_0x4c22('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4c22('0x11')](_0x4c22('0xc'),auth[_0x4c22('0x9')](),controller[_0x4c22('0x12')]);router[_0x4c22('0x13')](_0x4c22('0xc'),auth[_0x4c22('0x9')](),controller[_0x4c22('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd261=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete'];(function(_0x5bef1f,_0x1c0048){var _0x539cd1=function(_0x1f9059){while(--_0x1f9059){_0x5bef1f['push'](_0x5bef1f['shift']());}};_0x539cd1(++_0x1c0048);}(_0xd261,0x86));var _0x1d26=function(_0x5719d8,_0x22a01a){_0x5719d8=_0x5719d8-0x0;var _0x5b9f6b=_0xd261[_0x5719d8];return _0x5b9f6b;};'use strict';var multer=require(_0x1d26('0x0'));var util=require(_0x1d26('0x1'));var path=require(_0x1d26('0x2'));var timeout=require(_0x1d26('0x3'));var express=require('express');var router=express[_0x1d26('0x4')]();var auth=require(_0x1d26('0x5'));var interaction=require(_0x1d26('0x6'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x1d26('0x7')]('/',auth['isAuthenticated'](),controller[_0x1d26('0x8')]);router[_0x1d26('0x7')](_0x1d26('0x9'),auth[_0x1d26('0xa')](),controller[_0x1d26('0xb')]);router[_0x1d26('0x7')](_0x1d26('0xc'),auth[_0x1d26('0xa')](),controller[_0x1d26('0xd')]);router[_0x1d26('0x7')](_0x1d26('0xe'),auth[_0x1d26('0xa')](),controller[_0x1d26('0xf')]);router[_0x1d26('0x10')]('/',auth[_0x1d26('0xa')](),controller['create']);router[_0x1d26('0x10')](_0x1d26('0xc'),auth[_0x1d26('0xa')](),controller[_0x1d26('0x11')]);router[_0x1d26('0x12')](_0x1d26('0x9'),auth[_0x1d26('0xa')](),controller['update']);router[_0x1d26('0x13')](_0x1d26('0x9'),auth['isAuthenticated'](),controller[_0x1d26('0x14')]);module[_0x1d26('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 82c086b..0c7a9d3 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 _0xc2f3=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','token'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc2f3,0x124));var _0x3c2f=function(_0x1338a1,_0x1537bc){_0x1338a1=_0x1338a1-0x0;var _0x4d582c=_0xc2f3[_0x1338a1];return _0x4d582c;};'use strict';var Sequelize=require(_0x3c2f('0x0'));module[_0x3c2f('0x1')]={'name':{'type':Sequelize[_0x3c2f('0x2')]},'description':{'type':Sequelize[_0x3c2f('0x2')]},'username':{'type':Sequelize[_0x3c2f('0x2')],'unique':_0x3c2f('0x3')},'password':{'type':Sequelize[_0x3c2f('0x2')]},'token':{'type':Sequelize[_0x3c2f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3c2f('0x4')},'authType':{'type':Sequelize[_0x3c2f('0x5')](_0x3c2f('0x6'),_0x3c2f('0x7')),'defaultValue':_0x3c2f('0x6')},'serverUrl':{'type':Sequelize[_0x3c2f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3c2f('0x5')](_0x3c2f('0x8'),_0x3c2f('0x9')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x510c=['ENUM','integrationTab','newTab','sequelize','STRING','remoteUri','password','token'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x510c,0x16b));var _0xc510=function(_0x3cd295,_0x21ed7b){_0x3cd295=_0x3cd295-0x0;var _0x7dbc3f=_0x510c[_0x3cd295];return _0x7dbc3f;};'use strict';var Sequelize=require(_0xc510('0x0'));module['exports']={'name':{'type':Sequelize[_0xc510('0x1')]},'description':{'type':Sequelize[_0xc510('0x1')]},'username':{'type':Sequelize[_0xc510('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xc510('0x1')]},'token':{'type':Sequelize[_0xc510('0x1')]},'remoteUri':{'type':Sequelize[_0xc510('0x1')],'unique':_0xc510('0x2')},'authType':{'type':Sequelize['ENUM'](_0xc510('0x3'),_0xc510('0x4')),'defaultValue':_0xc510('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc510('0x5')](_0xc510('0x6'),_0xc510('0x7')),'defaultValue':_0xc510('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 4131a48..514b36f 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 _0x85ed=['../../mysqldb','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','Content-Range','update','then','stack','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','find','getConfigurations','ZendeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','%s/token:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','position','title','custom_field_options','statusCode','send','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util'];(function(_0x23cd34,_0xe7e8f7){var _0x1e1e48=function(_0x820992){while(--_0x820992){_0x23cd34['push'](_0x23cd34['shift']());}};_0x1e1e48(++_0xe7e8f7);}(_0x85ed,0x66));var _0xd85e=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0x85ed[_0x2962d5];return _0x273406;};'use strict';var pdf=require(_0xd85e('0x0'));var emlformat=require(_0xd85e('0x1'));var rimraf=require(_0xd85e('0x2'));var zipdir=require(_0xd85e('0x3'));var jsonpatch=require(_0xd85e('0x4'));var rp=require(_0xd85e('0x5'));var moment=require(_0xd85e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd85e('0x7'));var util=require(_0xd85e('0x8'));var path=require(_0xd85e('0x9'));var sox=require(_0xd85e('0xa'));var csv=require('to-csv');var ejs=require(_0xd85e('0xb'));var fs=require('fs');var _=require(_0xd85e('0xc'));var squel=require('squel');var crypto=require(_0xd85e('0xd'));var jsforce=require(_0xd85e('0xe'));var deskjs=require(_0xd85e('0xf'));var toCsv=require(_0xd85e('0x10'));var querystring=require('querystring');var Papa=require(_0xd85e('0x11'));var Redis=require(_0xd85e('0x12'));var authService=require(_0xd85e('0x13'));var qs=require(_0xd85e('0x14'));var as=require(_0xd85e('0x15'));var hardwareService=require(_0xd85e('0x16'));var logger=require('../../config/logger')(_0xd85e('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd85e('0x18'));var db=require(_0xd85e('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xd85e('0x1a'));var client=jayson[_0xd85e('0x1b')][_0xd85e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4afee1,_0x2194cd,_0x33addd,_0xe0c8df){return new BPromise(function(_0x32a52c,_0x1765d5){var _0x541696=_0xe0c8df||client;return _0x541696[_0xd85e('0x1d')](_0x4afee1,_0x33addd)['then'](function(_0x3aa5f6){logger[_0xd85e('0x1e')](_0xd85e('0x1f'),_0x2194cd,'request\x20sent');logger[_0xd85e('0x20')](_0xd85e('0x21'),_0x2194cd,'request\x20sent',JSON[_0xd85e('0x22')](_0x3aa5f6));if(_0x3aa5f6[_0xd85e('0x23')]){if(_0x3aa5f6[_0xd85e('0x23')]['code']===0x1f4){logger[_0xd85e('0x23')](_0xd85e('0x1f'),_0x2194cd,_0x3aa5f6[_0xd85e('0x23')][_0xd85e('0x24')]);return _0x1765d5(_0x3aa5f6[_0xd85e('0x23')][_0xd85e('0x24')]);}logger[_0xd85e('0x23')](_0xd85e('0x1f'),_0x2194cd,_0x3aa5f6[_0xd85e('0x23')][_0xd85e('0x24')]);return _0x32a52c(_0x3aa5f6['error'][_0xd85e('0x24')]);}else{logger[_0xd85e('0x1e')](_0xd85e('0x1f'),_0x2194cd,_0xd85e('0x25'));_0x32a52c(_0x3aa5f6[_0xd85e('0x26')]['message']);}})[_0xd85e('0x27')](function(_0x16b133){logger[_0xd85e('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x2194cd,_0x16b133);_0x1765d5(_0x16b133);});});}function respondWithStatusCode(_0x45c727,_0x44168e){_0x44168e=_0x44168e||0xcc;return function(_0x250dce){if(_0x250dce){return _0x45c727[_0xd85e('0x28')](_0x44168e);}return _0x45c727[_0xd85e('0x29')](_0x44168e)[_0xd85e('0x2a')]();};}function respondWithResult(_0x5604ae,_0x176a58){_0x176a58=_0x176a58||0xc8;return function(_0x91b328){if(_0x91b328){return _0x5604ae[_0xd85e('0x29')](_0x176a58)[_0xd85e('0x2b')](_0x91b328);}};}function respondWithFilteredResult(_0xe89be1,_0x400ffd){return function(_0x338445){if(_0x338445){var _0x1d659e=_0x338445[_0xd85e('0x2c')],_0x540149=_0x400ffd[_0xd85e('0x2d')],_0x5e0914=_0x400ffd['offset']+_0x400ffd['limit'],_0x3357b8;if(_0x5e0914>=_0x1d659e){_0x5e0914=_0x1d659e;_0x3357b8=0xc8;}else{_0x3357b8=0xce;}_0xe89be1[_0xd85e('0x29')](_0x3357b8);return _0xe89be1['set'](_0xd85e('0x2e'),_0x540149+'-'+_0x5e0914+'/'+_0x1d659e)[_0xd85e('0x2b')](_0x338445);}return null;};}function patchUpdates(_0x3f760e){return function(_0xadc995){try{jsonpatch['apply'](_0xadc995,_0x3f760e,!![]);}catch(_0x5ec4e9){return BPromise['reject'](_0x5ec4e9);}return _0xadc995['save']();};}function saveUpdates(_0x5d4154,_0x385823){return function(_0xb0ea8d){if(_0xb0ea8d){return _0xb0ea8d[_0xd85e('0x2f')](_0x5d4154)['then'](function(_0x6a901d){return _0x6a901d;});}return null;};}function removeEntity(_0x2fa2ec,_0x3c79e5){return function(_0x232e8b){if(_0x232e8b){return _0x232e8b['destroy']()[_0xd85e('0x30')](function(){_0x2fa2ec[_0xd85e('0x29')](0xcc)[_0xd85e('0x2a')]();});}};}function handleEntityNotFound(_0x39a959,_0x933325){return function(_0x554f0d){if(!_0x554f0d){_0x39a959[_0xd85e('0x28')](0x194);}return _0x554f0d;};}function handleError(_0x4ea736,_0x4ff62b){_0x4ff62b=_0x4ff62b||0x1f4;return function(_0x1b13fc){logger[_0xd85e('0x23')](_0x1b13fc[_0xd85e('0x31')]);if(_0x1b13fc['name']){delete _0x1b13fc['name'];}_0x4ea736[_0xd85e('0x29')](_0x4ff62b)['send'](_0x1b13fc);};}exports[_0xd85e('0x32')]=function(_0x4addb4,_0x56145f){var _0x207a59={},_0x8430a1={},_0x4a7e0d={'count':0x0,'rows':[]};var _0x141d02=_[_0xd85e('0x33')](db[_0xd85e('0x34')][_0xd85e('0x35')],function(_0x3f8089){return{'name':_0x3f8089[_0xd85e('0x36')],'type':_0x3f8089[_0xd85e('0x37')][_0xd85e('0x38')]};});_0x8430a1[_0xd85e('0x39')]=_[_0xd85e('0x33')](_0x141d02,_0xd85e('0x3a'));_0x8430a1[_0xd85e('0x3b')]=_[_0xd85e('0x3c')](_0x4addb4[_0xd85e('0x3b')]);_0x8430a1['filters']=_[_0xd85e('0x3d')](_0x8430a1[_0xd85e('0x39')],_0x8430a1[_0xd85e('0x3b')]);_0x207a59[_0xd85e('0x3e')]=_[_0xd85e('0x3d')](_0x8430a1[_0xd85e('0x39')],qs[_0xd85e('0x3f')](_0x4addb4[_0xd85e('0x3b')][_0xd85e('0x3f')]));_0x207a59[_0xd85e('0x3e')]=_0x207a59[_0xd85e('0x3e')][_0xd85e('0x40')]?_0x207a59[_0xd85e('0x3e')]:_0x8430a1[_0xd85e('0x39')];if(!_0x4addb4['query'][_0xd85e('0x41')](_0xd85e('0x42'))){_0x207a59[_0xd85e('0x43')]=qs['limit'](_0x4addb4['query'][_0xd85e('0x43')]);_0x207a59[_0xd85e('0x2d')]=qs[_0xd85e('0x2d')](_0x4addb4['query'][_0xd85e('0x2d')]);}_0x207a59[_0xd85e('0x44')]=qs[_0xd85e('0x45')](_0x4addb4[_0xd85e('0x3b')][_0xd85e('0x45')]);_0x207a59[_0xd85e('0x46')]=qs[_0xd85e('0x47')](_[_0xd85e('0x48')](_0x4addb4[_0xd85e('0x3b')],_0x8430a1[_0xd85e('0x47')]),_0x141d02);if(_0x4addb4['query'][_0xd85e('0x49')]){_0x207a59['where']=_[_0xd85e('0x4a')](_0x207a59[_0xd85e('0x46')],{'$or':_[_0xd85e('0x33')](_0x141d02,function(_0x3afbb1){if(_0x3afbb1[_0xd85e('0x37')]!==_0xd85e('0x4b')){var _0x1dd55c={};_0x1dd55c[_0x3afbb1[_0xd85e('0x3a')]]={'$like':'%'+_0x4addb4[_0xd85e('0x3b')][_0xd85e('0x49')]+'%'};return _0x1dd55c;}})});}_0x207a59=_[_0xd85e('0x4a')]({},_0x207a59,_0x4addb4['options']);var _0x50d041={'where':_0x207a59[_0xd85e('0x46')]};return db[_0xd85e('0x34')][_0xd85e('0x2c')](_0x50d041)[_0xd85e('0x30')](function(_0x21f6fe){_0x4a7e0d['count']=_0x21f6fe;if(_0x4addb4['query'][_0xd85e('0x4c')]){_0x207a59[_0xd85e('0x4d')]=[{'all':!![]}];}return db[_0xd85e('0x34')][_0xd85e('0x4e')](_0x207a59);})[_0xd85e('0x30')](function(_0x46ecee){_0x4a7e0d[_0xd85e('0x4f')]=_0x46ecee;return _0x4a7e0d;})['then'](respondWithFilteredResult(_0x56145f,_0x207a59))[_0xd85e('0x27')](handleError(_0x56145f,null));};exports[_0xd85e('0x50')]=function(_0x17f3da,_0x1f85ca){var _0xe02a47={'raw':![],'where':{'id':_0x17f3da[_0xd85e('0x51')]['id']}},_0x9ea71f={};_0x9ea71f[_0xd85e('0x39')]=_[_0xd85e('0x3c')](db[_0xd85e('0x34')][_0xd85e('0x35')]);_0x9ea71f[_0xd85e('0x3b')]=_[_0xd85e('0x3c')](_0x17f3da[_0xd85e('0x3b')]);_0x9ea71f[_0xd85e('0x47')]=_[_0xd85e('0x3d')](_0x9ea71f['model'],_0x9ea71f[_0xd85e('0x3b')]);_0xe02a47[_0xd85e('0x3e')]=_[_0xd85e('0x3d')](_0x9ea71f[_0xd85e('0x39')],qs['fields'](_0x17f3da[_0xd85e('0x3b')][_0xd85e('0x3f')]));_0xe02a47[_0xd85e('0x3e')]=_0xe02a47['attributes'][_0xd85e('0x40')]?_0xe02a47[_0xd85e('0x3e')]:_0x9ea71f[_0xd85e('0x39')];if(_0x17f3da['query'][_0xd85e('0x4c')]){_0xe02a47[_0xd85e('0x4d')]=[{'all':!![]}];}_0xe02a47=_['merge']({},_0xe02a47,_0x17f3da[_0xd85e('0x52')]);return db[_0xd85e('0x34')]['find'](_0xe02a47)[_0xd85e('0x30')](handleEntityNotFound(_0x1f85ca,null))[_0xd85e('0x30')](respondWithResult(_0x1f85ca,null))[_0xd85e('0x27')](handleError(_0x1f85ca,null));};exports[_0xd85e('0x53')]=function(_0xa491d3,_0x275f00){return db[_0xd85e('0x34')]['create'](_0xa491d3[_0xd85e('0x54')],{})[_0xd85e('0x30')](respondWithResult(_0x275f00,0xc9))[_0xd85e('0x27')](handleError(_0x275f00,null));};exports[_0xd85e('0x2f')]=function(_0x1c94a6,_0x5a92c9){if(_0x1c94a6[_0xd85e('0x54')]['id']){delete _0x1c94a6['body']['id'];}return db[_0xd85e('0x34')]['find']({'where':{'id':_0x1c94a6['params']['id']}})[_0xd85e('0x30')](handleEntityNotFound(_0x5a92c9,null))[_0xd85e('0x30')](saveUpdates(_0x1c94a6[_0xd85e('0x54')],null))['then'](respondWithResult(_0x5a92c9,null))[_0xd85e('0x27')](handleError(_0x5a92c9,null));};exports['destroy']=function(_0x109b76,_0x5d8036){return db['ZendeskAccount'][_0xd85e('0x55')]({'where':{'id':_0x109b76[_0xd85e('0x51')]['id']}})[_0xd85e('0x30')](handleEntityNotFound(_0x5d8036,null))[_0xd85e('0x30')](removeEntity(_0x5d8036,null))[_0xd85e('0x27')](handleError(_0x5d8036,null));};exports[_0xd85e('0x56')]=function(_0x4b0b1,_0x1278a7,_0xf0180e){var _0x4be7d6={};var _0x4985b6={};var _0x2a8703;var _0x239ed0;return db[_0xd85e('0x34')]['findOne']({'where':{'id':_0x4b0b1[_0xd85e('0x51')]['id']}})[_0xd85e('0x30')](handleEntityNotFound(_0x1278a7,null))[_0xd85e('0x30')](function(_0x27a8a3){if(_0x27a8a3){_0x2a8703=_0x27a8a3;_0x4985b6['model']=_[_0xd85e('0x3c')](db[_0xd85e('0x57')][_0xd85e('0x35')]);_0x4985b6['query']=_['keys'](_0x4b0b1[_0xd85e('0x3b')]);_0x4985b6[_0xd85e('0x47')]=_[_0xd85e('0x3d')](_0x4985b6['model'],_0x4985b6[_0xd85e('0x3b')]);_0x4be7d6[_0xd85e('0x3e')]=_['intersection'](_0x4985b6[_0xd85e('0x39')],qs[_0xd85e('0x3f')](_0x4b0b1[_0xd85e('0x3b')][_0xd85e('0x3f')]));_0x4be7d6[_0xd85e('0x3e')]=_0x4be7d6[_0xd85e('0x3e')]['length']?_0x4be7d6['attributes']:_0x4985b6[_0xd85e('0x39')];_0x4be7d6['order']=qs[_0xd85e('0x45')](_0x4b0b1[_0xd85e('0x3b')][_0xd85e('0x45')]);_0x4be7d6[_0xd85e('0x46')]=qs[_0xd85e('0x47')](_['pick'](_0x4b0b1[_0xd85e('0x3b')],_0x4985b6['filters']));if(_0x4b0b1[_0xd85e('0x3b')][_0xd85e('0x49')]){_0x4be7d6['where']=_[_0xd85e('0x4a')](_0x4be7d6[_0xd85e('0x46')],{'$or':_['map'](_0x4be7d6[_0xd85e('0x3e')],function(_0x118420){var _0x3bf16b={};_0x3bf16b[_0x118420]={'$like':'%'+_0x4b0b1['query'][_0xd85e('0x49')]+'%'};return _0x3bf16b;})});}_0x4be7d6=_[_0xd85e('0x4a')]({},_0x4be7d6,_0x4b0b1[_0xd85e('0x52')]);return _0x2a8703[_0xd85e('0x56')](_0x4be7d6);}})[_0xd85e('0x30')](function(_0xe151c0){if(_0xe151c0){_0x239ed0=_0xe151c0[_0xd85e('0x40')];if(!_0x4b0b1['query'][_0xd85e('0x41')](_0xd85e('0x42'))){_0x4be7d6['limit']=qs['limit'](_0x4b0b1[_0xd85e('0x3b')][_0xd85e('0x43')]);_0x4be7d6['offset']=qs[_0xd85e('0x2d')](_0x4b0b1[_0xd85e('0x3b')][_0xd85e('0x2d')]);}return _0x2a8703[_0xd85e('0x56')](_0x4be7d6);}})[_0xd85e('0x30')](function(_0x496156){if(_0x496156){return _0x496156?{'count':_0x239ed0,'rows':_0x496156}:null;}})[_0xd85e('0x30')](respondWithResult(_0x1278a7,null))[_0xd85e('0x27')](handleError(_0x1278a7,null));};exports[_0xd85e('0x58')]=function(_0x261d6c,_0x1e808f,_0xe3bdfb){if(_0x261d6c[_0xd85e('0x54')]['id']){delete _0x261d6c[_0xd85e('0x54')]['id'];}return db[_0xd85e('0x34')][_0xd85e('0x59')]({'where':{'id':_0x261d6c[_0xd85e('0x51')]['id']}})[_0xd85e('0x30')](handleEntityNotFound(_0x1e808f,null))[_0xd85e('0x30')](function(_0x12035f){if(_0x12035f){_0x261d6c['body'][_0xd85e('0x5a')]=_0x12035f['id'];_0x261d6c['body'][_0xd85e('0x5b')]=integrations[_0xd85e('0x5c')](_0x261d6c[_0xd85e('0x54')][_0xd85e('0x5d')],_0x261d6c[_0xd85e('0x54')][_0xd85e('0x37')]);_0x261d6c[_0xd85e('0x54')]['Descriptions']=integrations[_0xd85e('0x5e')](_0x261d6c[_0xd85e('0x54')][_0xd85e('0x5d')],_0x261d6c[_0xd85e('0x54')][_0xd85e('0x37')]);return db[_0xd85e('0x57')][_0xd85e('0x53')](_0x261d6c[_0xd85e('0x54')],{'include':[{'model':db['ZendeskField'],'as':_0xd85e('0x5b')},{'model':db[_0xd85e('0x5f')],'as':_0xd85e('0x60')}]});}return null;})[_0xd85e('0x30')](respondWithResult(_0x1e808f,null))[_0xd85e('0x27')](handleError(_0x1e808f,null));};exports[_0xd85e('0x61')]=function(_0x305ece,_0x9c9554,_0x4e8e82){var _0x278128='';return db[_0xd85e('0x34')]['findOne']({'where':{'id':_0x305ece[_0xd85e('0x51')]['id']},'attributes':['id',_0xd85e('0x62'),_0xd85e('0x63'),_0xd85e('0x64'),_0xd85e('0x65'),_0xd85e('0x66')]})[_0xd85e('0x30')](handleEntityNotFound(_0x9c9554,null))[_0xd85e('0x30')](function(_0x27be09){if(_0x27be09){_0x278128=_0x27be09['remoteUri'];var _0x274727=_0x278128[_0xd85e('0x67')](-0x1);if(_0x274727==='/'){_0x278128=_0x278128[_0xd85e('0x68')](0x0,_0x278128[_0xd85e('0x69')](_0x274727));}var _0x4892f2={'method':_0xd85e('0x6a'),'uri':util['format'](_0xd85e('0x6b'),_0x278128,_0xd85e('0x6c')),'json':!![]};switch(_0x27be09['authType']){case _0xd85e('0x63'):_0x4892f2[_0xd85e('0x6d')]={'Authorization':util[_0xd85e('0x6e')](_0xd85e('0x6f'),new Buffer(util[_0xd85e('0x6e')](_0xd85e('0x70'),_0x27be09['username'],_0x27be09[_0xd85e('0x63')]))['toString']('base64'))};break;case _0xd85e('0x64'):_0x4892f2[_0xd85e('0x6d')]={'Authorization':util[_0xd85e('0x6e')](_0xd85e('0x6f'),new Buffer(util[_0xd85e('0x6e')](_0xd85e('0x71'),_0x27be09[_0xd85e('0x62')],_0x27be09[_0xd85e('0x64')]))[_0xd85e('0x72')](_0xd85e('0x73')))};break;default:throw new db[(_0xd85e('0x74'))][(_0xd85e('0x75'))](_0xd85e('0x76'));}return rp(_0x4892f2);}})[_0xd85e('0x30')](function(_0x303684){if(_0x303684){var _0x2a74a7=[_0xd85e('0x77'),_0xd85e('0x78'),'group',_0xd85e('0x79')];_['remove'](_0x303684[_0xd85e('0x6c')],function(_0x2ecacc){return _0x2a74a7['includes'](_0x2ecacc[_0xd85e('0x37')]);});return{'count':_0x303684[_0xd85e('0x6c')][_0xd85e('0x40')],'rows':_[_0xd85e('0x33')](_0x303684['ticket_fields'],function(_0xe93111){return{'id':_0xe93111['id'],'name':_0xe93111[_0xd85e('0x7a')]>0x7?_0xe93111[_0xd85e('0x7b')]:_0xe93111[_0xd85e('0x37')],'custom':_0xe93111[_0xd85e('0x7a')]>0x7?!![]:![],'options':_0xe93111['system_field_options']?_0xe93111['system_field_options']:_0xe93111[_0xd85e('0x7c')]?_0xe93111['custom_field_options']:[]};})};}})[_0xd85e('0x30')](respondWithResult(_0x9c9554,null))[_0xd85e('0x27')](function(_0x364c76){var _0x2e745b=_0x305ece[_0xd85e('0x3b')]['test']?0x1f4:_0x364c76[_0xd85e('0x7d')]||0x1f4;logger[_0xd85e('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xd85e('0x61'),_0x2e745b,JSON['stringify'](_0x364c76));delete _0x364c76[_0xd85e('0x3a')];if(_0x2e745b===0x191){_0x2e745b=0x190;}_0x9c9554['status'](_0x2e745b)[_0xd85e('0x7e')](_0x305ece[_0xd85e('0x3b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x364c76[_0xd85e('0x7d')]}:_0x364c76);});}; \ No newline at end of file +var _0xe0c0=['ZendeskConfiguration','Subjects','getSubjects','getDescriptions','channel','ZendeskField','Descriptions','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne'];(function(_0x279702,_0x12e9b5){var _0x34f62e=function(_0x3f65e8){while(--_0x3f65e8){_0x279702['push'](_0x279702['shift']());}};_0x34f62e(++_0x12e9b5);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x3f0464,_0x5cebdf){_0x3f0464=_0x3f0464-0x0;var _0x3372e6=_0xe0c0[_0x3f0464];return _0x3372e6;};'use strict';var pdf=require(_0x0e0c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0e0c('0x1'));var zipdir=require(_0x0e0c('0x2'));var jsonpatch=require(_0x0e0c('0x3'));var rp=require(_0x0e0c('0x4'));var moment=require('moment');var BPromise=require(_0x0e0c('0x5'));var Mustache=require(_0x0e0c('0x6'));var util=require(_0x0e0c('0x7'));var path=require('path');var sox=require(_0x0e0c('0x8'));var csv=require(_0x0e0c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e0c('0xa'));var squel=require(_0x0e0c('0xb'));var crypto=require(_0x0e0c('0xc'));var jsforce=require(_0x0e0c('0xd'));var deskjs=require(_0x0e0c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0e0c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0e0c('0x10'));var as=require(_0x0e0c('0x11'));var hardwareService=require(_0x0e0c('0x12'));var logger=require(_0x0e0c('0x13'))(_0x0e0c('0x14'));var utils=require(_0x0e0c('0x15'));var config=require(_0x0e0c('0x16'));var licenseUtil=require(_0x0e0c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0e0c('0x18'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0e0c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x190751,_0x2cb79c,_0x305042,_0x1b598b){return new BPromise(function(_0x19f315,_0x599def){var _0x3fdc00=_0x1b598b||client;return _0x3fdc00[_0x0e0c('0x1a')](_0x190751,_0x305042)[_0x0e0c('0x1b')](function(_0x4ebe33){logger[_0x0e0c('0x1c')](_0x0e0c('0x1d'),_0x2cb79c,_0x0e0c('0x1e'));logger[_0x0e0c('0x1f')](_0x0e0c('0x20'),_0x2cb79c,_0x0e0c('0x1e'),JSON[_0x0e0c('0x21')](_0x4ebe33));if(_0x4ebe33[_0x0e0c('0x22')]){if(_0x4ebe33[_0x0e0c('0x22')]['code']===0x1f4){logger[_0x0e0c('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x2cb79c,_0x4ebe33['error']['message']);return _0x599def(_0x4ebe33[_0x0e0c('0x22')][_0x0e0c('0x23')]);}logger[_0x0e0c('0x22')](_0x0e0c('0x1d'),_0x2cb79c,_0x4ebe33[_0x0e0c('0x22')][_0x0e0c('0x23')]);return _0x19f315(_0x4ebe33['error'][_0x0e0c('0x23')]);}else{logger['info'](_0x0e0c('0x1d'),_0x2cb79c,_0x0e0c('0x1e'));_0x19f315(_0x4ebe33[_0x0e0c('0x24')][_0x0e0c('0x23')]);}})[_0x0e0c('0x25')](function(_0x4ccf11){logger[_0x0e0c('0x22')](_0x0e0c('0x1d'),_0x2cb79c,_0x4ccf11);_0x599def(_0x4ccf11);});});}function respondWithStatusCode(_0x315b35,_0x29ff87){_0x29ff87=_0x29ff87||0xcc;return function(_0x3871b0){if(_0x3871b0){return _0x315b35[_0x0e0c('0x26')](_0x29ff87);}return _0x315b35[_0x0e0c('0x27')](_0x29ff87)[_0x0e0c('0x28')]();};}function respondWithResult(_0x426bf1,_0x3ae1b4){_0x3ae1b4=_0x3ae1b4||0xc8;return function(_0x5a7519){if(_0x5a7519){return _0x426bf1[_0x0e0c('0x27')](_0x3ae1b4)[_0x0e0c('0x29')](_0x5a7519);}};}function respondWithFilteredResult(_0x48a33a,_0x59f3e8){return function(_0x18ddcb){if(_0x18ddcb){var _0x581c6d=_0x18ddcb[_0x0e0c('0x2a')],_0x3ae573=_0x59f3e8[_0x0e0c('0x2b')],_0x1a00a9=_0x59f3e8[_0x0e0c('0x2b')]+_0x59f3e8[_0x0e0c('0x2c')],_0x4bc2f4;if(_0x1a00a9>=_0x581c6d){_0x1a00a9=_0x581c6d;_0x4bc2f4=0xc8;}else{_0x4bc2f4=0xce;}_0x48a33a[_0x0e0c('0x27')](_0x4bc2f4);return _0x48a33a[_0x0e0c('0x2d')](_0x0e0c('0x2e'),_0x3ae573+'-'+_0x1a00a9+'/'+_0x581c6d)[_0x0e0c('0x29')](_0x18ddcb);}return null;};}function patchUpdates(_0x126052){return function(_0x475f3f){try{jsonpatch[_0x0e0c('0x2f')](_0x475f3f,_0x126052,!![]);}catch(_0x2c7d33){return BPromise[_0x0e0c('0x30')](_0x2c7d33);}return _0x475f3f['save']();};}function saveUpdates(_0x226b0e,_0x3a6702){return function(_0x352c6f){if(_0x352c6f){return _0x352c6f[_0x0e0c('0x31')](_0x226b0e)[_0x0e0c('0x1b')](function(_0x55f78d){return _0x55f78d;});}return null;};}function removeEntity(_0x2736df,_0x546ff9){return function(_0x32fb11){if(_0x32fb11){return _0x32fb11[_0x0e0c('0x32')]()['then'](function(){_0x2736df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e3b2e,_0x1c83f7){return function(_0x11ace3){if(!_0x11ace3){_0x5e3b2e[_0x0e0c('0x26')](0x194);}return _0x11ace3;};}function handleError(_0x572c09,_0x4a838c){_0x4a838c=_0x4a838c||0x1f4;return function(_0x11ce3b){logger[_0x0e0c('0x22')](_0x11ce3b['stack']);if(_0x11ce3b['name']){delete _0x11ce3b[_0x0e0c('0x33')];}_0x572c09['status'](_0x4a838c)[_0x0e0c('0x34')](_0x11ce3b);};}exports[_0x0e0c('0x35')]=function(_0x463e62,_0x11e4e7){var _0x2fcf33={},_0x390fa3={},_0x375807={'count':0x0,'rows':[]};var _0x4f7f22=_[_0x0e0c('0x36')](db[_0x0e0c('0x37')][_0x0e0c('0x38')],function(_0x453e8c){return{'name':_0x453e8c[_0x0e0c('0x39')],'type':_0x453e8c[_0x0e0c('0x3a')][_0x0e0c('0x3b')]};});_0x390fa3[_0x0e0c('0x3c')]=_['map'](_0x4f7f22,'name');_0x390fa3[_0x0e0c('0x3d')]=_[_0x0e0c('0x3e')](_0x463e62[_0x0e0c('0x3d')]);_0x390fa3[_0x0e0c('0x3f')]=_['intersection'](_0x390fa3[_0x0e0c('0x3c')],_0x390fa3['query']);_0x2fcf33['attributes']=_[_0x0e0c('0x40')](_0x390fa3[_0x0e0c('0x3c')],qs[_0x0e0c('0x41')](_0x463e62[_0x0e0c('0x3d')][_0x0e0c('0x41')]));_0x2fcf33[_0x0e0c('0x42')]=_0x2fcf33[_0x0e0c('0x42')][_0x0e0c('0x43')]?_0x2fcf33[_0x0e0c('0x42')]:_0x390fa3[_0x0e0c('0x3c')];if(!_0x463e62['query'][_0x0e0c('0x44')](_0x0e0c('0x45'))){_0x2fcf33['limit']=qs[_0x0e0c('0x2c')](_0x463e62[_0x0e0c('0x3d')][_0x0e0c('0x2c')]);_0x2fcf33[_0x0e0c('0x2b')]=qs[_0x0e0c('0x2b')](_0x463e62[_0x0e0c('0x3d')]['offset']);}_0x2fcf33[_0x0e0c('0x46')]=qs[_0x0e0c('0x47')](_0x463e62[_0x0e0c('0x3d')][_0x0e0c('0x47')]);_0x2fcf33[_0x0e0c('0x48')]=qs[_0x0e0c('0x3f')](_[_0x0e0c('0x49')](_0x463e62['query'],_0x390fa3['filters']),_0x4f7f22);if(_0x463e62[_0x0e0c('0x3d')]['filter']){_0x2fcf33['where']=_['merge'](_0x2fcf33[_0x0e0c('0x48')],{'$or':_[_0x0e0c('0x36')](_0x4f7f22,function(_0x41d228){if(_0x41d228[_0x0e0c('0x3a')]!==_0x0e0c('0x4a')){var _0xb2588e={};_0xb2588e[_0x41d228[_0x0e0c('0x33')]]={'$like':'%'+_0x463e62[_0x0e0c('0x3d')][_0x0e0c('0x4b')]+'%'};return _0xb2588e;}})});}_0x2fcf33=_[_0x0e0c('0x4c')]({},_0x2fcf33,_0x463e62[_0x0e0c('0x4d')]);var _0x3dab91={'where':_0x2fcf33['where']};return db[_0x0e0c('0x37')][_0x0e0c('0x2a')](_0x3dab91)[_0x0e0c('0x1b')](function(_0x1c2ca5){_0x375807['count']=_0x1c2ca5;if(_0x463e62[_0x0e0c('0x3d')][_0x0e0c('0x4e')]){_0x2fcf33[_0x0e0c('0x4f')]=[{'all':!![]}];}return db[_0x0e0c('0x37')][_0x0e0c('0x50')](_0x2fcf33);})[_0x0e0c('0x1b')](function(_0x354048){_0x375807[_0x0e0c('0x51')]=_0x354048;return _0x375807;})[_0x0e0c('0x1b')](respondWithFilteredResult(_0x11e4e7,_0x2fcf33))['catch'](handleError(_0x11e4e7,null));};exports[_0x0e0c('0x52')]=function(_0xcabc6a,_0x5eaa9d){var _0x5ab3e0={'raw':![],'where':{'id':_0xcabc6a[_0x0e0c('0x53')]['id']}},_0x30d9d2={};_0x30d9d2[_0x0e0c('0x3c')]=_['keys'](db[_0x0e0c('0x37')][_0x0e0c('0x38')]);_0x30d9d2[_0x0e0c('0x3d')]=_[_0x0e0c('0x3e')](_0xcabc6a['query']);_0x30d9d2['filters']=_[_0x0e0c('0x40')](_0x30d9d2[_0x0e0c('0x3c')],_0x30d9d2[_0x0e0c('0x3d')]);_0x5ab3e0[_0x0e0c('0x42')]=_[_0x0e0c('0x40')](_0x30d9d2['model'],qs['fields'](_0xcabc6a[_0x0e0c('0x3d')]['fields']));_0x5ab3e0[_0x0e0c('0x42')]=_0x5ab3e0[_0x0e0c('0x42')][_0x0e0c('0x43')]?_0x5ab3e0[_0x0e0c('0x42')]:_0x30d9d2['model'];if(_0xcabc6a[_0x0e0c('0x3d')]['includeAll']){_0x5ab3e0[_0x0e0c('0x4f')]=[{'all':!![]}];}_0x5ab3e0=_[_0x0e0c('0x4c')]({},_0x5ab3e0,_0xcabc6a[_0x0e0c('0x4d')]);return db[_0x0e0c('0x37')][_0x0e0c('0x54')](_0x5ab3e0)[_0x0e0c('0x1b')](handleEntityNotFound(_0x5eaa9d,null))['then'](respondWithResult(_0x5eaa9d,null))['catch'](handleError(_0x5eaa9d,null));};exports[_0x0e0c('0x55')]=function(_0x2c0081,_0x3c26b1){return db[_0x0e0c('0x37')]['create'](_0x2c0081[_0x0e0c('0x56')],{})[_0x0e0c('0x1b')](respondWithResult(_0x3c26b1,0xc9))['catch'](handleError(_0x3c26b1,null));};exports['update']=function(_0x3be9d0,_0x166427){if(_0x3be9d0[_0x0e0c('0x56')]['id']){delete _0x3be9d0['body']['id'];}return db[_0x0e0c('0x37')][_0x0e0c('0x54')]({'where':{'id':_0x3be9d0[_0x0e0c('0x53')]['id']}})[_0x0e0c('0x1b')](handleEntityNotFound(_0x166427,null))[_0x0e0c('0x1b')](saveUpdates(_0x3be9d0[_0x0e0c('0x56')],null))[_0x0e0c('0x1b')](respondWithResult(_0x166427,null))['catch'](handleError(_0x166427,null));};exports['destroy']=function(_0x1987ac,_0x2371ad){return db['ZendeskAccount']['find']({'where':{'id':_0x1987ac[_0x0e0c('0x53')]['id']}})[_0x0e0c('0x1b')](handleEntityNotFound(_0x2371ad,null))[_0x0e0c('0x1b')](removeEntity(_0x2371ad,null))['catch'](handleError(_0x2371ad,null));};exports[_0x0e0c('0x57')]=function(_0x46edaf,_0x3073dc,_0x589f99){var _0x590ace={};var _0xba21af={};var _0x4bf018;var _0x12b0c2;return db[_0x0e0c('0x37')][_0x0e0c('0x58')]({'where':{'id':_0x46edaf[_0x0e0c('0x53')]['id']}})['then'](handleEntityNotFound(_0x3073dc,null))[_0x0e0c('0x1b')](function(_0x43ad0b){if(_0x43ad0b){_0x4bf018=_0x43ad0b;_0xba21af[_0x0e0c('0x3c')]=_['keys'](db[_0x0e0c('0x59')][_0x0e0c('0x38')]);_0xba21af[_0x0e0c('0x3d')]=_[_0x0e0c('0x3e')](_0x46edaf[_0x0e0c('0x3d')]);_0xba21af[_0x0e0c('0x3f')]=_['intersection'](_0xba21af[_0x0e0c('0x3c')],_0xba21af[_0x0e0c('0x3d')]);_0x590ace['attributes']=_[_0x0e0c('0x40')](_0xba21af[_0x0e0c('0x3c')],qs[_0x0e0c('0x41')](_0x46edaf['query'][_0x0e0c('0x41')]));_0x590ace[_0x0e0c('0x42')]=_0x590ace[_0x0e0c('0x42')][_0x0e0c('0x43')]?_0x590ace['attributes']:_0xba21af[_0x0e0c('0x3c')];_0x590ace['order']=qs[_0x0e0c('0x47')](_0x46edaf[_0x0e0c('0x3d')][_0x0e0c('0x47')]);_0x590ace[_0x0e0c('0x48')]=qs[_0x0e0c('0x3f')](_[_0x0e0c('0x49')](_0x46edaf[_0x0e0c('0x3d')],_0xba21af[_0x0e0c('0x3f')]));if(_0x46edaf[_0x0e0c('0x3d')]['filter']){_0x590ace[_0x0e0c('0x48')]=_['merge'](_0x590ace[_0x0e0c('0x48')],{'$or':_[_0x0e0c('0x36')](_0x590ace['attributes'],function(_0x1d7976){var _0x4f5e04={};_0x4f5e04[_0x1d7976]={'$like':'%'+_0x46edaf[_0x0e0c('0x3d')][_0x0e0c('0x4b')]+'%'};return _0x4f5e04;})});}_0x590ace=_[_0x0e0c('0x4c')]({},_0x590ace,_0x46edaf[_0x0e0c('0x4d')]);return _0x4bf018[_0x0e0c('0x57')](_0x590ace);}})['then'](function(_0x50abd5){if(_0x50abd5){_0x12b0c2=_0x50abd5[_0x0e0c('0x43')];if(!_0x46edaf[_0x0e0c('0x3d')][_0x0e0c('0x44')](_0x0e0c('0x45'))){_0x590ace['limit']=qs[_0x0e0c('0x2c')](_0x46edaf[_0x0e0c('0x3d')][_0x0e0c('0x2c')]);_0x590ace[_0x0e0c('0x2b')]=qs[_0x0e0c('0x2b')](_0x46edaf[_0x0e0c('0x3d')]['offset']);}return _0x4bf018[_0x0e0c('0x57')](_0x590ace);}})[_0x0e0c('0x1b')](function(_0x14b1ae){if(_0x14b1ae){return _0x14b1ae?{'count':_0x12b0c2,'rows':_0x14b1ae}:null;}})[_0x0e0c('0x1b')](respondWithResult(_0x3073dc,null))[_0x0e0c('0x25')](handleError(_0x3073dc,null));};exports['addConfiguration']=function(_0xbcf3a0,_0x87a992,_0x4ecaad){if(_0xbcf3a0['body']['id']){delete _0xbcf3a0[_0x0e0c('0x56')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0xbcf3a0[_0x0e0c('0x53')]['id']}})[_0x0e0c('0x1b')](handleEntityNotFound(_0x87a992,null))[_0x0e0c('0x1b')](function(_0x3ff240){if(_0x3ff240){_0xbcf3a0[_0x0e0c('0x56')]['AccountId']=_0x3ff240['id'];_0xbcf3a0['body'][_0x0e0c('0x5a')]=integrations[_0x0e0c('0x5b')](_0xbcf3a0[_0x0e0c('0x56')]['channel'],_0xbcf3a0[_0x0e0c('0x56')][_0x0e0c('0x3a')]);_0xbcf3a0[_0x0e0c('0x56')]['Descriptions']=integrations[_0x0e0c('0x5c')](_0xbcf3a0[_0x0e0c('0x56')][_0x0e0c('0x5d')],_0xbcf3a0[_0x0e0c('0x56')][_0x0e0c('0x3a')]);return db[_0x0e0c('0x59')][_0x0e0c('0x55')](_0xbcf3a0[_0x0e0c('0x56')],{'include':[{'model':db[_0x0e0c('0x5e')],'as':_0x0e0c('0x5a')},{'model':db[_0x0e0c('0x5e')],'as':_0x0e0c('0x5f')}]});}return null;})['then'](respondWithResult(_0x87a992,null))[_0x0e0c('0x25')](handleError(_0x87a992,null));};exports['getFields']=function(_0x5eed90,_0x3bb2bb,_0x5924ef){var _0x29da5a='';return db[_0x0e0c('0x37')]['findOne']({'where':{'id':_0x5eed90['params']['id']},'attributes':['id','username',_0x0e0c('0x60'),_0x0e0c('0x61'),_0x0e0c('0x62'),_0x0e0c('0x63')]})['then'](handleEntityNotFound(_0x3bb2bb,null))[_0x0e0c('0x1b')](function(_0x3e44d0){if(_0x3e44d0){_0x29da5a=_0x3e44d0[_0x0e0c('0x63')];var _0x2a7d5d=_0x29da5a[_0x0e0c('0x64')](-0x1);if(_0x2a7d5d==='/'){_0x29da5a=_0x29da5a[_0x0e0c('0x65')](0x0,_0x29da5a[_0x0e0c('0x66')](_0x2a7d5d));}var _0x3869f0={'method':_0x0e0c('0x67'),'uri':util['format'](_0x0e0c('0x68'),_0x29da5a,_0x0e0c('0x69')),'json':!![]};switch(_0x3e44d0[_0x0e0c('0x62')]){case'password':_0x3869f0[_0x0e0c('0x6a')]={'Authorization':util[_0x0e0c('0x6b')](_0x0e0c('0x6c'),new Buffer(util[_0x0e0c('0x6b')](_0x0e0c('0x6d'),_0x3e44d0['username'],_0x3e44d0[_0x0e0c('0x60')]))['toString'](_0x0e0c('0x6e')))};break;case _0x0e0c('0x61'):_0x3869f0[_0x0e0c('0x6a')]={'Authorization':util[_0x0e0c('0x6b')](_0x0e0c('0x6c'),new Buffer(util[_0x0e0c('0x6b')](_0x0e0c('0x6f'),_0x3e44d0['username'],_0x3e44d0[_0x0e0c('0x61')]))['toString'](_0x0e0c('0x6e')))};break;default:throw new db[(_0x0e0c('0x70'))][(_0x0e0c('0x71'))](_0x0e0c('0x72'));}return rp(_0x3869f0);}})[_0x0e0c('0x1b')](function(_0x1622ef){if(_0x1622ef){var _0x207250=['subject',_0x0e0c('0x73'),_0x0e0c('0x74'),_0x0e0c('0x75')];_[_0x0e0c('0x76')](_0x1622ef[_0x0e0c('0x69')],function(_0x38206e){return _0x207250[_0x0e0c('0x77')](_0x38206e[_0x0e0c('0x3a')]);});return{'count':_0x1622ef[_0x0e0c('0x69')][_0x0e0c('0x43')],'rows':_[_0x0e0c('0x36')](_0x1622ef[_0x0e0c('0x69')],function(_0x4a0a6b){return{'id':_0x4a0a6b['id'],'name':_0x4a0a6b[_0x0e0c('0x78')]>0x7?_0x4a0a6b['title']:_0x4a0a6b[_0x0e0c('0x3a')],'custom':_0x4a0a6b[_0x0e0c('0x78')]>0x7?!![]:![],'options':_0x4a0a6b[_0x0e0c('0x79')]?_0x4a0a6b[_0x0e0c('0x79')]:_0x4a0a6b['custom_field_options']?_0x4a0a6b[_0x0e0c('0x7a')]:[]};})};}})[_0x0e0c('0x1b')](respondWithResult(_0x3bb2bb,null))[_0x0e0c('0x25')](function(_0x5104cf){var _0x4c7262=_0x5eed90[_0x0e0c('0x3d')][_0x0e0c('0x7b')]?0x1f4:_0x5104cf[_0x0e0c('0x7c')]||0x1f4;logger[_0x0e0c('0x22')](_0x0e0c('0x7d'),_0x0e0c('0x7e'),_0x4c7262,JSON[_0x0e0c('0x21')](_0x5104cf));delete _0x5104cf[_0x0e0c('0x33')];if(_0x4c7262===0x191){_0x4c7262=0x190;}_0x3bb2bb['status'](_0x4c7262)[_0x0e0c('0x34')](_0x5eed90['query'][_0x0e0c('0x7b')]?{'message':_0x0e0c('0x7f'),'statusCode':_0x5104cf[_0x0e0c('0x7c')]}:_0x5104cf);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e440ccf..c5f2bed 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 _0x945a=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','ZendeskAccount','lodash','util'];(function(_0x381797,_0x3ca9df){var _0x5787b8=function(_0x48cd62){while(--_0x48cd62){_0x381797['push'](_0x381797['shift']());}};_0x5787b8(++_0x3ca9df);}(_0x945a,0x111));var _0xa945=function(_0x4694d9,_0x4b935b){_0x4694d9=_0x4694d9-0x0;var _0x370f3f=_0x945a[_0x4694d9];return _0x370f3f;};'use strict';var _=require(_0xa945('0x0'));var util=require(_0xa945('0x1'));var logger=require(_0xa945('0x2'))(_0xa945('0x3'));var moment=require(_0xa945('0x4'));var BPromise=require(_0xa945('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa945('0x6'));var config=require(_0xa945('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xa945('0x8')]=function(_0x39f8f3,_0x245f65){return _0x39f8f3[_0xa945('0x9')](_0xa945('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65a1=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0x65a1,0x144));var _0x165a=function(_0x1b96ee,_0x32ffef){_0x1b96ee=_0x1b96ee-0x0;var _0x1aef42=_0x65a1[_0x1b96ee];return _0x1aef42;};'use strict';var _=require('lodash');var util=require(_0x165a('0x0'));var logger=require(_0x165a('0x1'))(_0x165a('0x2'));var moment=require(_0x165a('0x3'));var BPromise=require('bluebird');var rp=require(_0x165a('0x4'));var fs=require('fs');var path=require(_0x165a('0x5'));var rimraf=require('rimraf');var config=require(_0x165a('0x6'));var attributes=require(_0x165a('0x7'));var integrations=require(_0x165a('0x8'));module[_0x165a('0x9')]=function(_0x26e02b,_0x1c8ff5){return _0x26e02b['define'](_0x165a('0xa'),attributes,{'tableName':_0x165a('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 3b385e3..5fa767e 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 _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0xa73f70,_0x12add9){var _0x484278=function(_0x2cab68){while(--_0x2cab68){_0xa73f70['push'](_0xa73f70['shift']());}};_0x484278(++_0x12add9);}(_0x757a,0xde));var _0xa757=function(_0x4bc976,_0x5a42ac){_0x4bc976=_0x4bc976-0x0;var _0x441b95=_0x757a[_0x4bc976];return _0x441b95;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +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(_0x561e90,_0xcb3754){var _0x2ef02f=function(_0x1f714d){while(--_0x1f714d){_0x561e90['push'](_0x561e90['shift']());}};_0x2ef02f(++_0xcb3754);}(_0xe706,0xa3));var _0x6e70=function(_0x32f250,_0x1fbca3){_0x32f250=_0x32f250-0x0;var _0x39ead3=_0xe706[_0x32f250];return _0x39ead3;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index fd34940..8608d20 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 _0x1848=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','index','get','show','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','put','/:id','destroy','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1848,0x11d));var _0x8184=function(_0x35c39f,_0x1e6e48){_0x35c39f=_0x35c39f-0x0;var _0x2cb991=_0x1848[_0x35c39f];return _0x2cb991;};'use strict';var multer=require(_0x8184('0x0'));var util=require(_0x8184('0x1'));var path=require(_0x8184('0x2'));var timeout=require(_0x8184('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8184('0x4'));var config=require(_0x8184('0x5'));var controller=require(_0x8184('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x8184('0x7')]);router[_0x8184('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8184('0x9')]);router['get']('/:id/fields',auth[_0x8184('0xa')](),controller[_0x8184('0xb')]);router['get'](_0x8184('0xc'),auth[_0x8184('0xa')](),controller[_0x8184('0xd')]);router['get'](_0x8184('0xe'),auth[_0x8184('0xa')](),controller['getDescriptions']);router[_0x8184('0x8')](_0x8184('0xf'),auth[_0x8184('0xa')](),controller[_0x8184('0x10')]);router[_0x8184('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8184('0x11')](_0x8184('0xf'),auth[_0x8184('0xa')](),controller['setTags']);router[_0x8184('0x12')](_0x8184('0x13'),auth[_0x8184('0xa')](),controller['update']);router['delete']('/:id',auth[_0x8184('0xa')](),controller[_0x8184('0x14')]);module[_0x8184('0x15')]=router; \ No newline at end of file +var _0x764e=['get','isAuthenticated','index','/:id','show','getFields','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x3d6c35,_0x21d757){var _0x4f5563=function(_0x48380f){while(--_0x48380f){_0x3d6c35['push'](_0x3d6c35['shift']());}};_0x4f5563(++_0x21d757);}(_0x764e,0x10d));var _0xe764=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x764e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xe764('0x0'));var path=require(_0xe764('0x1'));var timeout=require(_0xe764('0x2'));var express=require(_0xe764('0x3'));var router=express[_0xe764('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe764('0x5'));var config=require(_0xe764('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0xe764('0x7')]('/',auth[_0xe764('0x8')](),controller[_0xe764('0x9')]);router['get'](_0xe764('0xa'),auth[_0xe764('0x8')](),controller[_0xe764('0xb')]);router['get']('/:id/fields',auth[_0xe764('0x8')](),controller[_0xe764('0xc')]);router[_0xe764('0x7')]('/:id/subjects',auth[_0xe764('0x8')](),controller['getSubjects']);router[_0xe764('0x7')]('/:id/descriptions',auth[_0xe764('0x8')](),controller[_0xe764('0xd')]);router[_0xe764('0x7')](_0xe764('0xe'),auth['isAuthenticated'](),controller[_0xe764('0xf')]);router[_0xe764('0x10')]('/',auth[_0xe764('0x8')](),controller[_0xe764('0x11')]);router[_0xe764('0x10')](_0xe764('0xe'),auth[_0xe764('0x8')](),controller[_0xe764('0x12')]);router[_0xe764('0x13')](_0xe764('0xa'),auth[_0xe764('0x8')](),controller[_0xe764('0x14')]);router['delete']('/:id',auth[_0xe764('0x8')](),controller[_0xe764('0x15')]);module[_0xe764('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index e41ab73..c639ca6 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 _0x11a8=['STRING','sequelize','exports'];(function(_0x457a5d,_0x13673f){var _0x10a79e=function(_0xd4184d){while(--_0xd4184d){_0x457a5d['push'](_0x457a5d['shift']());}};_0x10a79e(++_0x13673f);}(_0x11a8,0x13f));var _0x811a=function(_0x410321,_0x356317){_0x410321=_0x410321-0x0;var _0x3de168=_0x11a8[_0x410321];return _0x3de168;};'use strict';var Sequelize=require(_0x811a('0x0'));module[_0x811a('0x1')]={'name':{'type':Sequelize[_0x811a('0x2')]},'description':{'type':Sequelize[_0x811a('0x2')]}}; \ No newline at end of file +var _0xaf5b=['sequelize','STRING'];(function(_0x5d3688,_0x85c435){var _0x1d778a=function(_0x5646b1){while(--_0x5646b1){_0x5d3688['push'](_0x5d3688['shift']());}};_0x1d778a(++_0x85c435);}(_0xaf5b,0x106));var _0xbaf5=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xaf5b[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xbaf5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbaf5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 5d021cf..20196aa 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 _0xc2ee=['rawAttributes','key','map','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','merge','type','filter','options','count','includeAll','include','findAll','rows','show','params','find','create','body','destroy','getFields','ZendeskField','order','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','set','Content-Range','apply','reject','save','update','end','sendStatus','stack','name','send','index','ZendeskConfiguration'];(function(_0x3773da,_0xa6fa81){var _0x1a607d=function(_0x382299){while(--_0x382299){_0x3773da['push'](_0x3773da['shift']());}};_0x1a607d(++_0xa6fa81);}(_0xc2ee,0xe2));var _0xec2e=function(_0x13013a,_0x2ff754){_0x13013a=_0x13013a-0x0;var _0x5ef930=_0xc2ee[_0x13013a];return _0x5ef930;};'use strict';var pdf=require(_0xec2e('0x0'));var emlformat=require(_0xec2e('0x1'));var rimraf=require(_0xec2e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec2e('0x3'));var rp=require(_0xec2e('0x4'));var moment=require(_0xec2e('0x5'));var BPromise=require(_0xec2e('0x6'));var Mustache=require(_0xec2e('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xec2e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xec2e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xec2e('0xa'));var deskjs=require(_0xec2e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xec2e('0xc'));var Papa=require(_0xec2e('0xd'));var Redis=require(_0xec2e('0xe'));var authService=require(_0xec2e('0xf'));var qs=require(_0xec2e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec2e('0x11'));var logger=require(_0xec2e('0x12'))('api');var utils=require(_0xec2e('0x13'));var config=require(_0xec2e('0x14'));var licenseUtil=require(_0xec2e('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xec2e('0x16'));var client=jayson[_0xec2e('0x17')][_0xec2e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x6b7468,_0x114b1e,_0x58fbef,_0x289cd9){return new BPromise(function(_0x39f6fa,_0x42ce1d){var _0x57a8cb=_0x289cd9||client;return _0x57a8cb['request'](_0x6b7468,_0x58fbef)[_0xec2e('0x19')](function(_0x37420d){logger[_0xec2e('0x1a')](_0xec2e('0x1b'),_0x114b1e,_0xec2e('0x1c'));logger['debug'](_0xec2e('0x1d'),_0x114b1e,_0xec2e('0x1c'),JSON[_0xec2e('0x1e')](_0x37420d));if(_0x37420d[_0xec2e('0x1f')]){if(_0x37420d['error'][_0xec2e('0x20')]===0x1f4){logger[_0xec2e('0x1f')](_0xec2e('0x1b'),_0x114b1e,_0x37420d[_0xec2e('0x1f')][_0xec2e('0x21')]);return _0x42ce1d(_0x37420d['error'][_0xec2e('0x21')]);}logger[_0xec2e('0x1f')](_0xec2e('0x1b'),_0x114b1e,_0x37420d[_0xec2e('0x1f')][_0xec2e('0x21')]);return _0x39f6fa(_0x37420d[_0xec2e('0x1f')][_0xec2e('0x21')]);}else{logger[_0xec2e('0x1a')](_0xec2e('0x1b'),_0x114b1e,_0xec2e('0x1c'));_0x39f6fa(_0x37420d[_0xec2e('0x22')][_0xec2e('0x21')]);}})[_0xec2e('0x23')](function(_0x2de73c){logger[_0xec2e('0x1f')](_0xec2e('0x1b'),_0x114b1e,_0x2de73c);_0x42ce1d(_0x2de73c);});});}function respondWithStatusCode(_0x4b669e,_0x3e578d){_0x3e578d=_0x3e578d||0xcc;return function(_0x366704){if(_0x366704){return _0x4b669e['sendStatus'](_0x3e578d);}return _0x4b669e[_0xec2e('0x24')](_0x3e578d)['end']();};}function respondWithResult(_0x4422e0,_0x899f19){_0x899f19=_0x899f19||0xc8;return function(_0x22f371){if(_0x22f371){return _0x4422e0[_0xec2e('0x24')](_0x899f19)[_0xec2e('0x25')](_0x22f371);}};}function respondWithFilteredResult(_0x32b677,_0x988521){return function(_0x45bd07){if(_0x45bd07){var _0x3b9ad7=_0x45bd07['count'],_0x37c4f5=_0x988521[_0xec2e('0x26')],_0x613615=_0x988521[_0xec2e('0x26')]+_0x988521[_0xec2e('0x27')],_0x1e2900;if(_0x613615>=_0x3b9ad7){_0x613615=_0x3b9ad7;_0x1e2900=0xc8;}else{_0x1e2900=0xce;}_0x32b677['status'](_0x1e2900);return _0x32b677[_0xec2e('0x28')](_0xec2e('0x29'),_0x37c4f5+'-'+_0x613615+'/'+_0x3b9ad7)[_0xec2e('0x25')](_0x45bd07);}return null;};}function patchUpdates(_0x3fd814){return function(_0x2a60f0){try{jsonpatch[_0xec2e('0x2a')](_0x2a60f0,_0x3fd814,!![]);}catch(_0x44079b){return BPromise[_0xec2e('0x2b')](_0x44079b);}return _0x2a60f0[_0xec2e('0x2c')]();};}function saveUpdates(_0x595d69,_0x29e690){return function(_0x33dcf6){if(_0x33dcf6){return _0x33dcf6[_0xec2e('0x2d')](_0x595d69)[_0xec2e('0x19')](function(_0x51c92e){return _0x51c92e;});}return null;};}function removeEntity(_0x4d2358,_0x22991a){return function(_0x1fa684){if(_0x1fa684){return _0x1fa684['destroy']()['then'](function(){_0x4d2358['status'](0xcc)[_0xec2e('0x2e')]();});}};}function handleEntityNotFound(_0x3ebdca,_0x4f50af){return function(_0x1a0146){if(!_0x1a0146){_0x3ebdca[_0xec2e('0x2f')](0x194);}return _0x1a0146;};}function handleError(_0x4767f3,_0xbe8458){_0xbe8458=_0xbe8458||0x1f4;return function(_0x4e0267){logger[_0xec2e('0x1f')](_0x4e0267[_0xec2e('0x30')]);if(_0x4e0267[_0xec2e('0x31')]){delete _0x4e0267[_0xec2e('0x31')];}_0x4767f3[_0xec2e('0x24')](_0xbe8458)[_0xec2e('0x32')](_0x4e0267);};}exports[_0xec2e('0x33')]=function(_0x5a4c43,_0xedd52e){var _0x1106e7={},_0xaca438={},_0x45d6b3={'count':0x0,'rows':[]};var _0x52447d=_['map'](db[_0xec2e('0x34')][_0xec2e('0x35')],function(_0x4197cc){return{'name':_0x4197cc['fieldName'],'type':_0x4197cc['type'][_0xec2e('0x36')]};});_0xaca438['model']=_[_0xec2e('0x37')](_0x52447d,_0xec2e('0x31'));_0xaca438[_0xec2e('0x38')]=_[_0xec2e('0x39')](_0x5a4c43['query']);_0xaca438[_0xec2e('0x3a')]=_[_0xec2e('0x3b')](_0xaca438['model'],_0xaca438[_0xec2e('0x38')]);_0x1106e7[_0xec2e('0x3c')]=_[_0xec2e('0x3b')](_0xaca438[_0xec2e('0x3d')],qs[_0xec2e('0x3e')](_0x5a4c43[_0xec2e('0x38')]['fields']));_0x1106e7[_0xec2e('0x3c')]=_0x1106e7[_0xec2e('0x3c')][_0xec2e('0x3f')]?_0x1106e7[_0xec2e('0x3c')]:_0xaca438['model'];if(!_0x5a4c43[_0xec2e('0x38')]['hasOwnProperty'](_0xec2e('0x40'))){_0x1106e7[_0xec2e('0x27')]=qs[_0xec2e('0x27')](_0x5a4c43[_0xec2e('0x38')][_0xec2e('0x27')]);_0x1106e7[_0xec2e('0x26')]=qs[_0xec2e('0x26')](_0x5a4c43[_0xec2e('0x38')][_0xec2e('0x26')]);}_0x1106e7['order']=qs[_0xec2e('0x41')](_0x5a4c43['query']['sort']);_0x1106e7[_0xec2e('0x42')]=qs[_0xec2e('0x3a')](_[_0xec2e('0x43')](_0x5a4c43[_0xec2e('0x38')],_0xaca438['filters']),_0x52447d);if(_0x5a4c43[_0xec2e('0x38')]['filter']){_0x1106e7['where']=_[_0xec2e('0x44')](_0x1106e7['where'],{'$or':_[_0xec2e('0x37')](_0x52447d,function(_0x5dceaa){if(_0x5dceaa[_0xec2e('0x45')]!=='VIRTUAL'){var _0x3bbdc0={};_0x3bbdc0[_0x5dceaa['name']]={'$like':'%'+_0x5a4c43[_0xec2e('0x38')][_0xec2e('0x46')]+'%'};return _0x3bbdc0;}})});}_0x1106e7=_[_0xec2e('0x44')]({},_0x1106e7,_0x5a4c43[_0xec2e('0x47')]);var _0x279277={'where':_0x1106e7[_0xec2e('0x42')]};return db[_0xec2e('0x34')][_0xec2e('0x48')](_0x279277)[_0xec2e('0x19')](function(_0x30d515){_0x45d6b3[_0xec2e('0x48')]=_0x30d515;if(_0x5a4c43[_0xec2e('0x38')][_0xec2e('0x49')]){_0x1106e7[_0xec2e('0x4a')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xec2e('0x4b')](_0x1106e7);})['then'](function(_0x139d5d){_0x45d6b3[_0xec2e('0x4c')]=_0x139d5d;return _0x45d6b3;})[_0xec2e('0x19')](respondWithFilteredResult(_0xedd52e,_0x1106e7))[_0xec2e('0x23')](handleError(_0xedd52e,null));};exports[_0xec2e('0x4d')]=function(_0x2fdd97,_0x33bd55){var _0xcf57c2={'raw':![],'where':{'id':_0x2fdd97[_0xec2e('0x4e')]['id']}},_0x2698be={};_0x2698be['model']=_['keys'](db[_0xec2e('0x34')][_0xec2e('0x35')]);_0x2698be[_0xec2e('0x38')]=_['keys'](_0x2fdd97[_0xec2e('0x38')]);_0x2698be[_0xec2e('0x3a')]=_[_0xec2e('0x3b')](_0x2698be[_0xec2e('0x3d')],_0x2698be[_0xec2e('0x38')]);_0xcf57c2[_0xec2e('0x3c')]=_[_0xec2e('0x3b')](_0x2698be[_0xec2e('0x3d')],qs[_0xec2e('0x3e')](_0x2fdd97[_0xec2e('0x38')][_0xec2e('0x3e')]));_0xcf57c2[_0xec2e('0x3c')]=_0xcf57c2[_0xec2e('0x3c')][_0xec2e('0x3f')]?_0xcf57c2[_0xec2e('0x3c')]:_0x2698be[_0xec2e('0x3d')];if(_0x2fdd97['query'][_0xec2e('0x49')]){_0xcf57c2[_0xec2e('0x4a')]=[{'all':!![]}];}_0xcf57c2=_[_0xec2e('0x44')]({},_0xcf57c2,_0x2fdd97[_0xec2e('0x47')]);return db[_0xec2e('0x34')][_0xec2e('0x4f')](_0xcf57c2)['then'](handleEntityNotFound(_0x33bd55,null))['then'](respondWithResult(_0x33bd55,null))[_0xec2e('0x23')](handleError(_0x33bd55,null));};exports[_0xec2e('0x50')]=function(_0x119478,_0x4c16dd){return db[_0xec2e('0x34')][_0xec2e('0x50')](_0x119478[_0xec2e('0x51')],{})[_0xec2e('0x19')](respondWithResult(_0x4c16dd,0xc9))[_0xec2e('0x23')](handleError(_0x4c16dd,null));};exports[_0xec2e('0x2d')]=function(_0xe8c3a2,_0x2c49a0){if(_0xe8c3a2['body']['id']){delete _0xe8c3a2[_0xec2e('0x51')]['id'];}return db[_0xec2e('0x34')][_0xec2e('0x4f')]({'where':{'id':_0xe8c3a2['params']['id']}})[_0xec2e('0x19')](handleEntityNotFound(_0x2c49a0,null))[_0xec2e('0x19')](saveUpdates(_0xe8c3a2[_0xec2e('0x51')],null))[_0xec2e('0x19')](respondWithResult(_0x2c49a0,null))['catch'](handleError(_0x2c49a0,null));};exports[_0xec2e('0x52')]=function(_0x678a86,_0x317747){return db['ZendeskConfiguration'][_0xec2e('0x4f')]({'where':{'id':_0x678a86['params']['id']}})[_0xec2e('0x19')](handleEntityNotFound(_0x317747,null))[_0xec2e('0x19')](removeEntity(_0x317747,null))[_0xec2e('0x23')](handleError(_0x317747,null));};exports[_0xec2e('0x53')]=function(_0x25746a,_0x2e34a0,_0x43c0c5){var _0x3cea59={};var _0x2a8171={};var _0x3e07cb;var _0x3ba03d;return db[_0xec2e('0x34')]['findOne']({'where':{'id':_0x25746a[_0xec2e('0x4e')]['id']}})[_0xec2e('0x19')](handleEntityNotFound(_0x2e34a0,null))['then'](function(_0x1c1bc5){if(_0x1c1bc5){_0x3e07cb=_0x1c1bc5;_0x2a8171[_0xec2e('0x3d')]=_[_0xec2e('0x39')](db[_0xec2e('0x54')][_0xec2e('0x35')]);_0x2a8171['query']=_[_0xec2e('0x39')](_0x25746a[_0xec2e('0x38')]);_0x2a8171[_0xec2e('0x3a')]=_[_0xec2e('0x3b')](_0x2a8171[_0xec2e('0x3d')],_0x2a8171['query']);_0x3cea59[_0xec2e('0x3c')]=_['intersection'](_0x2a8171['model'],qs['fields'](_0x25746a[_0xec2e('0x38')][_0xec2e('0x3e')]));_0x3cea59['attributes']=_0x3cea59[_0xec2e('0x3c')][_0xec2e('0x3f')]?_0x3cea59[_0xec2e('0x3c')]:_0x2a8171[_0xec2e('0x3d')];_0x3cea59[_0xec2e('0x55')]=qs[_0xec2e('0x41')](_0x25746a[_0xec2e('0x38')][_0xec2e('0x41')]);_0x3cea59[_0xec2e('0x42')]=qs[_0xec2e('0x3a')](_[_0xec2e('0x43')](_0x25746a[_0xec2e('0x38')],_0x2a8171['filters']));if(_0x25746a[_0xec2e('0x38')][_0xec2e('0x46')]){_0x3cea59['where']=_['merge'](_0x3cea59[_0xec2e('0x42')],{'$or':_['map'](_0x3cea59[_0xec2e('0x3c')],function(_0x4d10ac){var _0x3ca05d={};_0x3ca05d[_0x4d10ac]={'$like':'%'+_0x25746a[_0xec2e('0x38')][_0xec2e('0x46')]+'%'};return _0x3ca05d;})});}_0x3cea59=_[_0xec2e('0x44')]({},_0x3cea59,_0x25746a[_0xec2e('0x47')]);return _0x3e07cb[_0xec2e('0x53')](_0x3cea59);}})[_0xec2e('0x19')](function(_0x28d889){if(_0x28d889){_0x3ba03d=_0x28d889[_0xec2e('0x3f')];if(!_0x25746a['query'][_0xec2e('0x56')](_0xec2e('0x40'))){_0x3cea59[_0xec2e('0x27')]=qs['limit'](_0x25746a[_0xec2e('0x38')]['limit']);_0x3cea59['offset']=qs[_0xec2e('0x26')](_0x25746a[_0xec2e('0x38')]['offset']);}return _0x3e07cb[_0xec2e('0x53')](_0x3cea59);}})[_0xec2e('0x19')](function(_0x537503){if(_0x537503){return _0x537503?{'count':_0x3ba03d,'rows':_0x537503}:null;}})[_0xec2e('0x19')](respondWithResult(_0x2e34a0,null))['catch'](handleError(_0x2e34a0,null));};exports[_0xec2e('0x57')]=function(_0x22df0f,_0x3f5dad,_0x53bcd3){var _0x3ac060={};var _0x2e16d6={};var _0x3998f2;var _0x17f477;return db[_0xec2e('0x34')][_0xec2e('0x58')]({'where':{'id':_0x22df0f[_0xec2e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f5dad,null))['then'](function(_0x704f8){if(_0x704f8){_0x3998f2=_0x704f8;_0x2e16d6[_0xec2e('0x3d')]=_[_0xec2e('0x39')](db[_0xec2e('0x54')][_0xec2e('0x35')]);_0x2e16d6[_0xec2e('0x38')]=_[_0xec2e('0x39')](_0x22df0f[_0xec2e('0x38')]);_0x2e16d6[_0xec2e('0x3a')]=_['intersection'](_0x2e16d6[_0xec2e('0x3d')],_0x2e16d6[_0xec2e('0x38')]);_0x3ac060[_0xec2e('0x3c')]=_[_0xec2e('0x3b')](_0x2e16d6[_0xec2e('0x3d')],qs[_0xec2e('0x3e')](_0x22df0f[_0xec2e('0x38')][_0xec2e('0x3e')]));_0x3ac060[_0xec2e('0x3c')]=_0x3ac060['attributes']['length']?_0x3ac060['attributes']:_0x2e16d6['model'];_0x3ac060['order']=qs[_0xec2e('0x41')](_0x22df0f['query'][_0xec2e('0x41')]);_0x3ac060['where']=qs[_0xec2e('0x3a')](_[_0xec2e('0x43')](_0x22df0f[_0xec2e('0x38')],_0x2e16d6[_0xec2e('0x3a')]));if(_0x22df0f[_0xec2e('0x38')][_0xec2e('0x46')]){_0x3ac060[_0xec2e('0x42')]=_['merge'](_0x3ac060[_0xec2e('0x42')],{'$or':_[_0xec2e('0x37')](_0x3ac060[_0xec2e('0x3c')],function(_0x29218f){var _0x5f2fe1={};_0x5f2fe1[_0x29218f]={'$like':'%'+_0x22df0f['query'][_0xec2e('0x46')]+'%'};return _0x5f2fe1;})});}_0x3ac060=_[_0xec2e('0x44')]({},_0x3ac060,_0x22df0f[_0xec2e('0x47')]);return _0x3998f2['getSubjects'](_0x3ac060);}})[_0xec2e('0x19')](function(_0x2b7f1d){if(_0x2b7f1d){_0x17f477=_0x2b7f1d['length'];if(!_0x22df0f[_0xec2e('0x38')][_0xec2e('0x56')](_0xec2e('0x40'))){_0x3ac060['limit']=qs[_0xec2e('0x27')](_0x22df0f[_0xec2e('0x38')][_0xec2e('0x27')]);_0x3ac060[_0xec2e('0x26')]=qs[_0xec2e('0x26')](_0x22df0f[_0xec2e('0x38')]['offset']);}return _0x3998f2['getSubjects'](_0x3ac060);}})['then'](function(_0x59c4f1){if(_0x59c4f1){return _0x59c4f1?{'count':_0x17f477,'rows':_0x59c4f1}:null;}})[_0xec2e('0x19')](respondWithResult(_0x3f5dad,null))['catch'](handleError(_0x3f5dad,null));};exports[_0xec2e('0x59')]=function(_0x494e7d,_0x4f41ec,_0x5edf07){var _0x2d1a8b={};var _0x440284={};var _0x1d8d78;var _0x17e160;return db['ZendeskConfiguration'][_0xec2e('0x58')]({'where':{'id':_0x494e7d[_0xec2e('0x4e')]['id']}})[_0xec2e('0x19')](handleEntityNotFound(_0x4f41ec,null))[_0xec2e('0x19')](function(_0x374731){if(_0x374731){_0x1d8d78=_0x374731;_0x440284[_0xec2e('0x3d')]=_[_0xec2e('0x39')](db[_0xec2e('0x54')][_0xec2e('0x35')]);_0x440284[_0xec2e('0x38')]=_[_0xec2e('0x39')](_0x494e7d['query']);_0x440284[_0xec2e('0x3a')]=_[_0xec2e('0x3b')](_0x440284[_0xec2e('0x3d')],_0x440284[_0xec2e('0x38')]);_0x2d1a8b['attributes']=_[_0xec2e('0x3b')](_0x440284[_0xec2e('0x3d')],qs['fields'](_0x494e7d[_0xec2e('0x38')][_0xec2e('0x3e')]));_0x2d1a8b[_0xec2e('0x3c')]=_0x2d1a8b['attributes'][_0xec2e('0x3f')]?_0x2d1a8b[_0xec2e('0x3c')]:_0x440284[_0xec2e('0x3d')];_0x2d1a8b['order']=qs[_0xec2e('0x41')](_0x494e7d[_0xec2e('0x38')][_0xec2e('0x41')]);_0x2d1a8b[_0xec2e('0x42')]=qs[_0xec2e('0x3a')](_['pick'](_0x494e7d[_0xec2e('0x38')],_0x440284[_0xec2e('0x3a')]));if(_0x494e7d[_0xec2e('0x38')][_0xec2e('0x46')]){_0x2d1a8b['where']=_[_0xec2e('0x44')](_0x2d1a8b[_0xec2e('0x42')],{'$or':_[_0xec2e('0x37')](_0x2d1a8b[_0xec2e('0x3c')],function(_0x3cc5c6){var _0x546fdb={};_0x546fdb[_0x3cc5c6]={'$like':'%'+_0x494e7d[_0xec2e('0x38')]['filter']+'%'};return _0x546fdb;})});}_0x2d1a8b=_[_0xec2e('0x44')]({},_0x2d1a8b,_0x494e7d['options']);return _0x1d8d78['getDescriptions'](_0x2d1a8b);}})['then'](function(_0x36278c){if(_0x36278c){_0x17e160=_0x36278c['length'];if(!_0x494e7d[_0xec2e('0x38')]['hasOwnProperty']('nolimit')){_0x2d1a8b[_0xec2e('0x27')]=qs[_0xec2e('0x27')](_0x494e7d[_0xec2e('0x38')][_0xec2e('0x27')]);_0x2d1a8b[_0xec2e('0x26')]=qs[_0xec2e('0x26')](_0x494e7d[_0xec2e('0x38')]['offset']);}return _0x1d8d78['getDescriptions'](_0x2d1a8b);}})[_0xec2e('0x19')](function(_0x17a8d1){if(_0x17a8d1){return _0x17a8d1?{'count':_0x17e160,'rows':_0x17a8d1}:null;}})[_0xec2e('0x19')](respondWithResult(_0x4f41ec,null))[_0xec2e('0x23')](handleError(_0x4f41ec,null));};exports[_0xec2e('0x5a')]=function(_0x266223,_0x240fba,_0x1ae391){var _0x1901a7={};var _0x57d490={};var _0x287bc2;var _0x5b7805;return db['ZendeskConfiguration'][_0xec2e('0x58')]({'where':{'id':_0x266223[_0xec2e('0x4e')]['id']}})[_0xec2e('0x19')](handleEntityNotFound(_0x240fba,null))['then'](function(_0x5c67c4){if(_0x5c67c4){_0x287bc2=_0x5c67c4;_0x57d490[_0xec2e('0x3d')]=_[_0xec2e('0x39')](db['Tag']['rawAttributes']);_0x57d490['query']=_[_0xec2e('0x39')](_0x266223[_0xec2e('0x38')]);_0x57d490[_0xec2e('0x3a')]=_[_0xec2e('0x3b')](_0x57d490[_0xec2e('0x3d')],_0x57d490[_0xec2e('0x38')]);_0x1901a7[_0xec2e('0x3c')]=_[_0xec2e('0x3b')](_0x57d490[_0xec2e('0x3d')],qs[_0xec2e('0x3e')](_0x266223['query'][_0xec2e('0x3e')]));_0x1901a7[_0xec2e('0x3c')]=_0x1901a7[_0xec2e('0x3c')][_0xec2e('0x3f')]?_0x1901a7[_0xec2e('0x3c')]:_0x57d490['model'];_0x1901a7['order']=qs[_0xec2e('0x41')](_0x266223[_0xec2e('0x38')]['sort']);_0x1901a7[_0xec2e('0x42')]=qs[_0xec2e('0x3a')](_['pick'](_0x266223[_0xec2e('0x38')],_0x57d490[_0xec2e('0x3a')]));if(_0x266223[_0xec2e('0x38')][_0xec2e('0x46')]){_0x1901a7[_0xec2e('0x42')]=_['merge'](_0x1901a7[_0xec2e('0x42')],{'$or':_[_0xec2e('0x37')](_0x1901a7[_0xec2e('0x3c')],function(_0x22bc39){var _0xb261f0={};_0xb261f0[_0x22bc39]={'$like':'%'+_0x266223[_0xec2e('0x38')][_0xec2e('0x46')]+'%'};return _0xb261f0;})});}_0x1901a7=_[_0xec2e('0x44')]({},_0x1901a7,_0x266223[_0xec2e('0x47')]);return _0x287bc2[_0xec2e('0x5a')](_0x1901a7);}})[_0xec2e('0x19')](function(_0x75fcab){if(_0x75fcab){_0x5b7805=_0x75fcab[_0xec2e('0x3f')];if(!_0x266223['query'][_0xec2e('0x56')](_0xec2e('0x40'))){_0x1901a7[_0xec2e('0x27')]=qs[_0xec2e('0x27')](_0x266223[_0xec2e('0x38')][_0xec2e('0x27')]);_0x1901a7['offset']=qs[_0xec2e('0x26')](_0x266223[_0xec2e('0x38')][_0xec2e('0x26')]);}return _0x287bc2[_0xec2e('0x5a')](_0x1901a7);}})['then'](function(_0x401843){if(_0x401843){return _0x401843?{'count':_0x5b7805,'rows':_0x401843}:null;}})[_0xec2e('0x19')](respondWithResult(_0x240fba,null))['catch'](handleError(_0x240fba,null));};exports[_0xec2e('0x5b')]=function(_0x1d9b3d,_0x536a48,_0x11adb2){if(_0x1d9b3d['body']['id']){delete _0x1d9b3d[_0xec2e('0x51')]['id'];}return db[_0xec2e('0x34')]['findOne']({'where':{'id':_0x1d9b3d[_0xec2e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x536a48,null))[_0xec2e('0x19')](function(_0x4d625d){if(_0x4d625d){return _0x4d625d[_0xec2e('0x5b')](_0x1d9b3d[_0xec2e('0x51')][_0xec2e('0x5c')]||[]);}return null;})[_0xec2e('0x19')](respondWithResult(_0x536a48,null))[_0xec2e('0x23')](handleError(_0x536a48,null));}; \ No newline at end of file +var _0x719b=['merge','VIRTUAL','options','ZendeskConfiguration','count','includeAll','include','findAll','catch','show','params','rawAttributes','fields','find','body','ZendeskField','order','getFields','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','result','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where'];(function(_0x110f29,_0xd0ad06){var _0x557a1f=function(_0xbb3a4f){while(--_0xbb3a4f){_0x110f29['push'](_0x110f29['shift']());}};_0x557a1f(++_0xd0ad06);}(_0x719b,0x13c));var _0xb719=function(_0x15be15,_0x4ae8a9){_0x15be15=_0x15be15-0x0;var _0x3de592=_0x719b[_0x15be15];return _0x3de592;};'use strict';var pdf=require(_0xb719('0x0'));var emlformat=require(_0xb719('0x1'));var rimraf=require(_0xb719('0x2'));var zipdir=require(_0xb719('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb719('0x4'));var moment=require('moment');var BPromise=require(_0xb719('0x5'));var Mustache=require('mustache');var util=require(_0xb719('0x6'));var path=require(_0xb719('0x7'));var sox=require(_0xb719('0x8'));var csv=require(_0xb719('0x9'));var ejs=require(_0xb719('0xa'));var fs=require('fs');var _=require(_0xb719('0xb'));var squel=require(_0xb719('0xc'));var crypto=require(_0xb719('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb719('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb719('0xf'));var Papa=require('papaparse');var Redis=require(_0xb719('0x10'));var authService=require(_0xb719('0x11'));var qs=require(_0xb719('0x12'));var as=require(_0xb719('0x13'));var hardwareService=require(_0xb719('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb719('0x15'));var config=require(_0xb719('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb719('0x17'))['db'];var jayson=require(_0xb719('0x18'));var client=jayson[_0xb719('0x19')][_0xb719('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x208104,_0xa5d18e,_0x466400,_0x2b82d0){return new BPromise(function(_0x2b937c,_0x104a3d){var _0x2d6e40=_0x2b82d0||client;return _0x2d6e40[_0xb719('0x1b')](_0x208104,_0x466400)[_0xb719('0x1c')](function(_0x991a93){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0xa5d18e,_0xb719('0x1d'));logger['debug'](_0xb719('0x1e'),_0xa5d18e,'request\x20sent',JSON[_0xb719('0x1f')](_0x991a93));if(_0x991a93[_0xb719('0x20')]){if(_0x991a93[_0xb719('0x20')][_0xb719('0x21')]===0x1f4){logger[_0xb719('0x20')](_0xb719('0x22'),_0xa5d18e,_0x991a93[_0xb719('0x20')]['message']);return _0x104a3d(_0x991a93[_0xb719('0x20')][_0xb719('0x23')]);}logger[_0xb719('0x20')](_0xb719('0x22'),_0xa5d18e,_0x991a93['error'][_0xb719('0x23')]);return _0x2b937c(_0x991a93[_0xb719('0x20')][_0xb719('0x23')]);}else{logger[_0xb719('0x24')](_0xb719('0x22'),_0xa5d18e,'request\x20sent');_0x2b937c(_0x991a93[_0xb719('0x25')][_0xb719('0x23')]);}})['catch'](function(_0x369f9e){logger[_0xb719('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0xa5d18e,_0x369f9e);_0x104a3d(_0x369f9e);});});}function respondWithStatusCode(_0x203b3f,_0x4a5b14){_0x4a5b14=_0x4a5b14||0xcc;return function(_0x2e6855){if(_0x2e6855){return _0x203b3f[_0xb719('0x26')](_0x4a5b14);}return _0x203b3f['status'](_0x4a5b14)['end']();};}function respondWithResult(_0x501680,_0x284988){_0x284988=_0x284988||0xc8;return function(_0x4dde4b){if(_0x4dde4b){return _0x501680[_0xb719('0x27')](_0x284988)[_0xb719('0x28')](_0x4dde4b);}};}function respondWithFilteredResult(_0x1cfdfa,_0xe735ef){return function(_0x2ab40e){if(_0x2ab40e){var _0x28244a=_0x2ab40e['count'],_0x10172c=_0xe735ef[_0xb719('0x29')],_0x19b025=_0xe735ef[_0xb719('0x29')]+_0xe735ef[_0xb719('0x2a')],_0xe1b974;if(_0x19b025>=_0x28244a){_0x19b025=_0x28244a;_0xe1b974=0xc8;}else{_0xe1b974=0xce;}_0x1cfdfa[_0xb719('0x27')](_0xe1b974);return _0x1cfdfa[_0xb719('0x2b')](_0xb719('0x2c'),_0x10172c+'-'+_0x19b025+'/'+_0x28244a)[_0xb719('0x28')](_0x2ab40e);}return null;};}function patchUpdates(_0x3c1e69){return function(_0x3e6f69){try{jsonpatch[_0xb719('0x2d')](_0x3e6f69,_0x3c1e69,!![]);}catch(_0x1e793f){return BPromise[_0xb719('0x2e')](_0x1e793f);}return _0x3e6f69[_0xb719('0x2f')]();};}function saveUpdates(_0x35f2c1,_0x5d66dd){return function(_0x58d2b1){if(_0x58d2b1){return _0x58d2b1[_0xb719('0x30')](_0x35f2c1)['then'](function(_0x47cffd){return _0x47cffd;});}return null;};}function removeEntity(_0x87c38d,_0x2b882c){return function(_0x4ecd57){if(_0x4ecd57){return _0x4ecd57[_0xb719('0x31')]()[_0xb719('0x1c')](function(){_0x87c38d[_0xb719('0x27')](0xcc)[_0xb719('0x32')]();});}};}function handleEntityNotFound(_0x39c62e,_0x160c05){return function(_0x3967e9){if(!_0x3967e9){_0x39c62e[_0xb719('0x26')](0x194);}return _0x3967e9;};}function handleError(_0x54eabf,_0x161b6c){_0x161b6c=_0x161b6c||0x1f4;return function(_0x1ddae1){logger[_0xb719('0x20')](_0x1ddae1[_0xb719('0x33')]);if(_0x1ddae1['name']){delete _0x1ddae1[_0xb719('0x34')];}_0x54eabf[_0xb719('0x27')](_0x161b6c)[_0xb719('0x35')](_0x1ddae1);};}exports[_0xb719('0x36')]=function(_0x115029,_0x4bd0f5){var _0x381735={},_0x477d41={},_0x1a8f55={'count':0x0,'rows':[]};var _0x4317af=_[_0xb719('0x37')](db['ZendeskConfiguration']['rawAttributes'],function(_0x1c51b2){return{'name':_0x1c51b2[_0xb719('0x38')],'type':_0x1c51b2[_0xb719('0x39')][_0xb719('0x3a')]};});_0x477d41[_0xb719('0x3b')]=_['map'](_0x4317af,'name');_0x477d41['query']=_[_0xb719('0x3c')](_0x115029[_0xb719('0x3d')]);_0x477d41[_0xb719('0x3e')]=_[_0xb719('0x3f')](_0x477d41[_0xb719('0x3b')],_0x477d41['query']);_0x381735[_0xb719('0x40')]=_['intersection'](_0x477d41[_0xb719('0x3b')],qs['fields'](_0x115029['query']['fields']));_0x381735[_0xb719('0x40')]=_0x381735[_0xb719('0x40')][_0xb719('0x41')]?_0x381735[_0xb719('0x40')]:_0x477d41[_0xb719('0x3b')];if(!_0x115029[_0xb719('0x3d')][_0xb719('0x42')](_0xb719('0x43'))){_0x381735[_0xb719('0x2a')]=qs[_0xb719('0x2a')](_0x115029['query'][_0xb719('0x2a')]);_0x381735[_0xb719('0x29')]=qs[_0xb719('0x29')](_0x115029[_0xb719('0x3d')][_0xb719('0x29')]);}_0x381735['order']=qs['sort'](_0x115029[_0xb719('0x3d')][_0xb719('0x44')]);_0x381735['where']=qs[_0xb719('0x3e')](_[_0xb719('0x45')](_0x115029[_0xb719('0x3d')],_0x477d41[_0xb719('0x3e')]),_0x4317af);if(_0x115029[_0xb719('0x3d')][_0xb719('0x46')]){_0x381735[_0xb719('0x47')]=_[_0xb719('0x48')](_0x381735[_0xb719('0x47')],{'$or':_[_0xb719('0x37')](_0x4317af,function(_0xa2df09){if(_0xa2df09[_0xb719('0x39')]!==_0xb719('0x49')){var _0x3f21d4={};_0x3f21d4[_0xa2df09[_0xb719('0x34')]]={'$like':'%'+_0x115029['query'][_0xb719('0x46')]+'%'};return _0x3f21d4;}})});}_0x381735=_[_0xb719('0x48')]({},_0x381735,_0x115029[_0xb719('0x4a')]);var _0x141434={'where':_0x381735[_0xb719('0x47')]};return db[_0xb719('0x4b')][_0xb719('0x4c')](_0x141434)[_0xb719('0x1c')](function(_0x1cd67f){_0x1a8f55[_0xb719('0x4c')]=_0x1cd67f;if(_0x115029[_0xb719('0x3d')][_0xb719('0x4d')]){_0x381735[_0xb719('0x4e')]=[{'all':!![]}];}return db[_0xb719('0x4b')][_0xb719('0x4f')](_0x381735);})[_0xb719('0x1c')](function(_0x547519){_0x1a8f55['rows']=_0x547519;return _0x1a8f55;})['then'](respondWithFilteredResult(_0x4bd0f5,_0x381735))[_0xb719('0x50')](handleError(_0x4bd0f5,null));};exports[_0xb719('0x51')]=function(_0x1d4335,_0x941613){var _0x41cefa={'raw':![],'where':{'id':_0x1d4335[_0xb719('0x52')]['id']}},_0x5a6365={};_0x5a6365[_0xb719('0x3b')]=_[_0xb719('0x3c')](db[_0xb719('0x4b')][_0xb719('0x53')]);_0x5a6365['query']=_['keys'](_0x1d4335[_0xb719('0x3d')]);_0x5a6365['filters']=_[_0xb719('0x3f')](_0x5a6365[_0xb719('0x3b')],_0x5a6365[_0xb719('0x3d')]);_0x41cefa[_0xb719('0x40')]=_[_0xb719('0x3f')](_0x5a6365[_0xb719('0x3b')],qs[_0xb719('0x54')](_0x1d4335[_0xb719('0x3d')][_0xb719('0x54')]));_0x41cefa['attributes']=_0x41cefa['attributes'][_0xb719('0x41')]?_0x41cefa[_0xb719('0x40')]:_0x5a6365[_0xb719('0x3b')];if(_0x1d4335['query'][_0xb719('0x4d')]){_0x41cefa[_0xb719('0x4e')]=[{'all':!![]}];}_0x41cefa=_[_0xb719('0x48')]({},_0x41cefa,_0x1d4335[_0xb719('0x4a')]);return db[_0xb719('0x4b')][_0xb719('0x55')](_0x41cefa)[_0xb719('0x1c')](handleEntityNotFound(_0x941613,null))['then'](respondWithResult(_0x941613,null))[_0xb719('0x50')](handleError(_0x941613,null));};exports['create']=function(_0x2348b2,_0x2a17d7){return db[_0xb719('0x4b')]['create'](_0x2348b2[_0xb719('0x56')],{})[_0xb719('0x1c')](respondWithResult(_0x2a17d7,0xc9))[_0xb719('0x50')](handleError(_0x2a17d7,null));};exports['update']=function(_0x12c541,_0x36c3b0){if(_0x12c541[_0xb719('0x56')]['id']){delete _0x12c541[_0xb719('0x56')]['id'];}return db['ZendeskConfiguration'][_0xb719('0x55')]({'where':{'id':_0x12c541[_0xb719('0x52')]['id']}})[_0xb719('0x1c')](handleEntityNotFound(_0x36c3b0,null))[_0xb719('0x1c')](saveUpdates(_0x12c541['body'],null))[_0xb719('0x1c')](respondWithResult(_0x36c3b0,null))[_0xb719('0x50')](handleError(_0x36c3b0,null));};exports[_0xb719('0x31')]=function(_0x48df12,_0x5eab37){return db[_0xb719('0x4b')][_0xb719('0x55')]({'where':{'id':_0x48df12['params']['id']}})[_0xb719('0x1c')](handleEntityNotFound(_0x5eab37,null))[_0xb719('0x1c')](removeEntity(_0x5eab37,null))[_0xb719('0x50')](handleError(_0x5eab37,null));};exports['getFields']=function(_0x597f05,_0x44ddd7,_0x41624c){var _0x417d74={};var _0x488e81={};var _0x2a28b9;var _0x1c9deb;return db[_0xb719('0x4b')]['findOne']({'where':{'id':_0x597f05['params']['id']}})['then'](handleEntityNotFound(_0x44ddd7,null))[_0xb719('0x1c')](function(_0xd573b7){if(_0xd573b7){_0x2a28b9=_0xd573b7;_0x488e81['model']=_[_0xb719('0x3c')](db[_0xb719('0x57')][_0xb719('0x53')]);_0x488e81[_0xb719('0x3d')]=_[_0xb719('0x3c')](_0x597f05['query']);_0x488e81[_0xb719('0x3e')]=_[_0xb719('0x3f')](_0x488e81[_0xb719('0x3b')],_0x488e81[_0xb719('0x3d')]);_0x417d74['attributes']=_[_0xb719('0x3f')](_0x488e81[_0xb719('0x3b')],qs[_0xb719('0x54')](_0x597f05[_0xb719('0x3d')]['fields']));_0x417d74[_0xb719('0x40')]=_0x417d74[_0xb719('0x40')]['length']?_0x417d74[_0xb719('0x40')]:_0x488e81['model'];_0x417d74[_0xb719('0x58')]=qs['sort'](_0x597f05[_0xb719('0x3d')][_0xb719('0x44')]);_0x417d74['where']=qs['filters'](_['pick'](_0x597f05['query'],_0x488e81[_0xb719('0x3e')]));if(_0x597f05[_0xb719('0x3d')][_0xb719('0x46')]){_0x417d74[_0xb719('0x47')]=_[_0xb719('0x48')](_0x417d74[_0xb719('0x47')],{'$or':_[_0xb719('0x37')](_0x417d74[_0xb719('0x40')],function(_0x2e78d2){var _0x4dc67b={};_0x4dc67b[_0x2e78d2]={'$like':'%'+_0x597f05[_0xb719('0x3d')][_0xb719('0x46')]+'%'};return _0x4dc67b;})});}_0x417d74=_[_0xb719('0x48')]({},_0x417d74,_0x597f05['options']);return _0x2a28b9[_0xb719('0x59')](_0x417d74);}})[_0xb719('0x1c')](function(_0xdd5ea6){if(_0xdd5ea6){_0x1c9deb=_0xdd5ea6[_0xb719('0x41')];if(!_0x597f05[_0xb719('0x3d')][_0xb719('0x42')](_0xb719('0x43'))){_0x417d74[_0xb719('0x2a')]=qs[_0xb719('0x2a')](_0x597f05[_0xb719('0x3d')][_0xb719('0x2a')]);_0x417d74['offset']=qs['offset'](_0x597f05[_0xb719('0x3d')][_0xb719('0x29')]);}return _0x2a28b9[_0xb719('0x59')](_0x417d74);}})[_0xb719('0x1c')](function(_0x586c68){if(_0x586c68){return _0x586c68?{'count':_0x1c9deb,'rows':_0x586c68}:null;}})['then'](respondWithResult(_0x44ddd7,null))[_0xb719('0x50')](handleError(_0x44ddd7,null));};exports['getSubjects']=function(_0x168751,_0x14414f,_0x5c912f){var _0x3ff061={};var _0x2a44e1={};var _0x29ae6f;var _0x1ad813;return db[_0xb719('0x4b')][_0xb719('0x5a')]({'where':{'id':_0x168751[_0xb719('0x52')]['id']}})[_0xb719('0x1c')](handleEntityNotFound(_0x14414f,null))[_0xb719('0x1c')](function(_0x3c14d7){if(_0x3c14d7){_0x29ae6f=_0x3c14d7;_0x2a44e1[_0xb719('0x3b')]=_['keys'](db[_0xb719('0x57')][_0xb719('0x53')]);_0x2a44e1[_0xb719('0x3d')]=_[_0xb719('0x3c')](_0x168751[_0xb719('0x3d')]);_0x2a44e1['filters']=_[_0xb719('0x3f')](_0x2a44e1[_0xb719('0x3b')],_0x2a44e1[_0xb719('0x3d')]);_0x3ff061[_0xb719('0x40')]=_[_0xb719('0x3f')](_0x2a44e1[_0xb719('0x3b')],qs[_0xb719('0x54')](_0x168751['query'][_0xb719('0x54')]));_0x3ff061['attributes']=_0x3ff061[_0xb719('0x40')][_0xb719('0x41')]?_0x3ff061[_0xb719('0x40')]:_0x2a44e1[_0xb719('0x3b')];_0x3ff061[_0xb719('0x58')]=qs[_0xb719('0x44')](_0x168751[_0xb719('0x3d')][_0xb719('0x44')]);_0x3ff061[_0xb719('0x47')]=qs[_0xb719('0x3e')](_['pick'](_0x168751['query'],_0x2a44e1[_0xb719('0x3e')]));if(_0x168751[_0xb719('0x3d')][_0xb719('0x46')]){_0x3ff061[_0xb719('0x47')]=_['merge'](_0x3ff061['where'],{'$or':_['map'](_0x3ff061['attributes'],function(_0x374571){var _0x12d967={};_0x12d967[_0x374571]={'$like':'%'+_0x168751[_0xb719('0x3d')][_0xb719('0x46')]+'%'};return _0x12d967;})});}_0x3ff061=_[_0xb719('0x48')]({},_0x3ff061,_0x168751[_0xb719('0x4a')]);return _0x29ae6f[_0xb719('0x5b')](_0x3ff061);}})[_0xb719('0x1c')](function(_0x1a69e9){if(_0x1a69e9){_0x1ad813=_0x1a69e9[_0xb719('0x41')];if(!_0x168751[_0xb719('0x3d')]['hasOwnProperty'](_0xb719('0x43'))){_0x3ff061['limit']=qs[_0xb719('0x2a')](_0x168751[_0xb719('0x3d')][_0xb719('0x2a')]);_0x3ff061[_0xb719('0x29')]=qs['offset'](_0x168751[_0xb719('0x3d')][_0xb719('0x29')]);}return _0x29ae6f['getSubjects'](_0x3ff061);}})[_0xb719('0x1c')](function(_0x4ae6f0){if(_0x4ae6f0){return _0x4ae6f0?{'count':_0x1ad813,'rows':_0x4ae6f0}:null;}})[_0xb719('0x1c')](respondWithResult(_0x14414f,null))['catch'](handleError(_0x14414f,null));};exports[_0xb719('0x5c')]=function(_0x9a2e7e,_0x302788,_0x1abe56){var _0x3d9705={};var _0x2bb72b={};var _0x56c5f0;var _0x385efb;return db[_0xb719('0x4b')]['findOne']({'where':{'id':_0x9a2e7e['params']['id']}})[_0xb719('0x1c')](handleEntityNotFound(_0x302788,null))[_0xb719('0x1c')](function(_0x439c0d){if(_0x439c0d){_0x56c5f0=_0x439c0d;_0x2bb72b['model']=_[_0xb719('0x3c')](db['ZendeskField'][_0xb719('0x53')]);_0x2bb72b['query']=_[_0xb719('0x3c')](_0x9a2e7e['query']);_0x2bb72b[_0xb719('0x3e')]=_['intersection'](_0x2bb72b[_0xb719('0x3b')],_0x2bb72b[_0xb719('0x3d')]);_0x3d9705[_0xb719('0x40')]=_[_0xb719('0x3f')](_0x2bb72b[_0xb719('0x3b')],qs[_0xb719('0x54')](_0x9a2e7e[_0xb719('0x3d')][_0xb719('0x54')]));_0x3d9705['attributes']=_0x3d9705[_0xb719('0x40')][_0xb719('0x41')]?_0x3d9705[_0xb719('0x40')]:_0x2bb72b[_0xb719('0x3b')];_0x3d9705[_0xb719('0x58')]=qs[_0xb719('0x44')](_0x9a2e7e[_0xb719('0x3d')]['sort']);_0x3d9705[_0xb719('0x47')]=qs[_0xb719('0x3e')](_[_0xb719('0x45')](_0x9a2e7e['query'],_0x2bb72b[_0xb719('0x3e')]));if(_0x9a2e7e[_0xb719('0x3d')][_0xb719('0x46')]){_0x3d9705[_0xb719('0x47')]=_['merge'](_0x3d9705['where'],{'$or':_[_0xb719('0x37')](_0x3d9705[_0xb719('0x40')],function(_0x3e822c){var _0x27944c={};_0x27944c[_0x3e822c]={'$like':'%'+_0x9a2e7e['query'][_0xb719('0x46')]+'%'};return _0x27944c;})});}_0x3d9705=_['merge']({},_0x3d9705,_0x9a2e7e[_0xb719('0x4a')]);return _0x56c5f0[_0xb719('0x5c')](_0x3d9705);}})[_0xb719('0x1c')](function(_0x35ac13){if(_0x35ac13){_0x385efb=_0x35ac13[_0xb719('0x41')];if(!_0x9a2e7e['query'][_0xb719('0x42')]('nolimit')){_0x3d9705[_0xb719('0x2a')]=qs[_0xb719('0x2a')](_0x9a2e7e[_0xb719('0x3d')]['limit']);_0x3d9705[_0xb719('0x29')]=qs[_0xb719('0x29')](_0x9a2e7e[_0xb719('0x3d')]['offset']);}return _0x56c5f0[_0xb719('0x5c')](_0x3d9705);}})[_0xb719('0x1c')](function(_0x124c18){if(_0x124c18){return _0x124c18?{'count':_0x385efb,'rows':_0x124c18}:null;}})['then'](respondWithResult(_0x302788,null))[_0xb719('0x50')](handleError(_0x302788,null));};exports[_0xb719('0x5d')]=function(_0xe0764f,_0x213e99,_0x9de80f){var _0x1e7574={};var _0x15f1b7={};var _0x3f95d6;var _0x303fbb;return db[_0xb719('0x4b')][_0xb719('0x5a')]({'where':{'id':_0xe0764f[_0xb719('0x52')]['id']}})['then'](handleEntityNotFound(_0x213e99,null))[_0xb719('0x1c')](function(_0x4c8ac8){if(_0x4c8ac8){_0x3f95d6=_0x4c8ac8;_0x15f1b7['model']=_[_0xb719('0x3c')](db[_0xb719('0x5e')][_0xb719('0x53')]);_0x15f1b7[_0xb719('0x3d')]=_[_0xb719('0x3c')](_0xe0764f['query']);_0x15f1b7['filters']=_[_0xb719('0x3f')](_0x15f1b7['model'],_0x15f1b7[_0xb719('0x3d')]);_0x1e7574[_0xb719('0x40')]=_[_0xb719('0x3f')](_0x15f1b7[_0xb719('0x3b')],qs[_0xb719('0x54')](_0xe0764f[_0xb719('0x3d')][_0xb719('0x54')]));_0x1e7574[_0xb719('0x40')]=_0x1e7574[_0xb719('0x40')][_0xb719('0x41')]?_0x1e7574[_0xb719('0x40')]:_0x15f1b7[_0xb719('0x3b')];_0x1e7574[_0xb719('0x58')]=qs['sort'](_0xe0764f[_0xb719('0x3d')][_0xb719('0x44')]);_0x1e7574[_0xb719('0x47')]=qs[_0xb719('0x3e')](_[_0xb719('0x45')](_0xe0764f[_0xb719('0x3d')],_0x15f1b7[_0xb719('0x3e')]));if(_0xe0764f[_0xb719('0x3d')][_0xb719('0x46')]){_0x1e7574[_0xb719('0x47')]=_['merge'](_0x1e7574[_0xb719('0x47')],{'$or':_['map'](_0x1e7574[_0xb719('0x40')],function(_0x4c9e91){var _0x24e8dc={};_0x24e8dc[_0x4c9e91]={'$like':'%'+_0xe0764f[_0xb719('0x3d')][_0xb719('0x46')]+'%'};return _0x24e8dc;})});}_0x1e7574=_[_0xb719('0x48')]({},_0x1e7574,_0xe0764f[_0xb719('0x4a')]);return _0x3f95d6[_0xb719('0x5d')](_0x1e7574);}})[_0xb719('0x1c')](function(_0x2ef3c0){if(_0x2ef3c0){_0x303fbb=_0x2ef3c0['length'];if(!_0xe0764f[_0xb719('0x3d')][_0xb719('0x42')]('nolimit')){_0x1e7574[_0xb719('0x2a')]=qs[_0xb719('0x2a')](_0xe0764f['query'][_0xb719('0x2a')]);_0x1e7574[_0xb719('0x29')]=qs[_0xb719('0x29')](_0xe0764f['query'][_0xb719('0x29')]);}return _0x3f95d6[_0xb719('0x5d')](_0x1e7574);}})[_0xb719('0x1c')](function(_0x47a25f){if(_0x47a25f){return _0x47a25f?{'count':_0x303fbb,'rows':_0x47a25f}:null;}})[_0xb719('0x1c')](respondWithResult(_0x213e99,null))[_0xb719('0x50')](handleError(_0x213e99,null));};exports[_0xb719('0x5f')]=function(_0x491541,_0x46c078,_0x264862){if(_0x491541[_0xb719('0x56')]['id']){delete _0x491541[_0xb719('0x56')]['id'];}return db[_0xb719('0x4b')]['findOne']({'where':{'id':_0x491541[_0xb719('0x52')]['id']}})[_0xb719('0x1c')](handleEntityNotFound(_0x46c078,null))['then'](function(_0x4df0e7){if(_0x4df0e7){return _0x4df0e7[_0xb719('0x5f')](_0x491541[_0xb719('0x56')][_0xb719('0x60')]||[]);}return null;})[_0xb719('0x1c')](respondWithResult(_0x46c078,null))[_0xb719('0x50')](handleError(_0x46c078,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 56e05c3..669151a 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 _0xebb1=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d92f9,_0x5c5e2f){var _0x5136b9=function(_0x1a31b4){while(--_0x1a31b4){_0x1d92f9['push'](_0x1d92f9['shift']());}};_0x5136b9(++_0x5c5e2f);}(_0xebb1,0x165));var _0x1ebb=function(_0xf7af07,_0x2f6db1){_0xf7af07=_0xf7af07-0x0;var _0x92995b=_0xebb1[_0xf7af07];return _0x92995b;};'use strict';var _=require(_0x1ebb('0x0'));var util=require(_0x1ebb('0x1'));var logger=require(_0x1ebb('0x2'))(_0x1ebb('0x3'));var moment=require(_0x1ebb('0x4'));var BPromise=require(_0x1ebb('0x5'));var rp=require(_0x1ebb('0x6'));var fs=require('fs');var path=require(_0x1ebb('0x7'));var rimraf=require(_0x1ebb('0x8'));var config=require(_0x1ebb('0x9'));var attributes=require(_0x1ebb('0xa'));module[_0x1ebb('0xb')]=function(_0x4ca41f,_0x2e124c){return _0x4ca41f[_0x1ebb('0xc')]('ZendeskConfiguration',attributes,{'tableName':_0x1ebb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7ab=['int_zendesk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','ZendeskConfiguration'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe7ab,0x1f0));var _0xbe7a=function(_0xd41380,_0x20fdf1){_0xd41380=_0xd41380-0x0;var _0x2943e8=_0xe7ab[_0xd41380];return _0x2943e8;};'use strict';var _=require(_0xbe7a('0x0'));var util=require(_0xbe7a('0x1'));var logger=require(_0xbe7a('0x2'))(_0xbe7a('0x3'));var moment=require('moment');var BPromise=require(_0xbe7a('0x4'));var rp=require(_0xbe7a('0x5'));var fs=require('fs');var path=require(_0xbe7a('0x6'));var rimraf=require('rimraf');var config=require(_0xbe7a('0x7'));var attributes=require(_0xbe7a('0x8'));module['exports']=function(_0x2972ac,_0x36381a){return _0x2972ac['define'](_0xbe7a('0x9'),attributes,{'tableName':_0xbe7a('0xa'),'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 97f28f3..49ffad7 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 _0xb9d4=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x73eb6,_0x25c71c){var _0x49b851=function(_0x2bbf75){while(--_0x2bbf75){_0x73eb6['push'](_0x73eb6['shift']());}};_0x49b851(++_0x25c71c);}(_0xb9d4,0x19b));var _0x4b9d=function(_0x1e6548,_0x2e0c51){_0x1e6548=_0x1e6548-0x0;var _0x344535=_0xb9d4[_0x1e6548];return _0x344535;};'use strict';var _=require(_0x4b9d('0x0'));var util=require(_0x4b9d('0x1'));var moment=require(_0x4b9d('0x2'));var BPromise=require(_0x4b9d('0x3'));var rs=require(_0x4b9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b9d('0x5'))['db'];var utils=require(_0x4b9d('0x6'));var logger=require(_0x4b9d('0x7'))('rpc');var config=require(_0x4b9d('0x8'));var jayson=require(_0x4b9d('0x9'));var client=jayson[_0x4b9d('0xa')][_0x4b9d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9e8f,_0x523dc3,_0x43052f){return new BPromise(function(_0x6ffa58,_0xcaee9c){return client[_0x4b9d('0xc')](_0x3f9e8f,_0x43052f)[_0x4b9d('0xd')](function(_0x6ee8c7){logger[_0x4b9d('0xe')](_0x4b9d('0xf'),_0x523dc3,_0x4b9d('0x10'));logger[_0x4b9d('0x11')](_0x4b9d('0x12'),_0x523dc3,_0x4b9d('0x10'),JSON[_0x4b9d('0x13')](_0x6ee8c7));if(_0x6ee8c7[_0x4b9d('0x14')]){if(_0x6ee8c7[_0x4b9d('0x14')]['code']===0x1f4){logger[_0x4b9d('0x14')](_0x4b9d('0xf'),_0x523dc3,_0x6ee8c7[_0x4b9d('0x14')]['message']);return _0xcaee9c(_0x6ee8c7[_0x4b9d('0x14')][_0x4b9d('0x15')]);}logger[_0x4b9d('0x14')](_0x4b9d('0xf'),_0x523dc3,_0x6ee8c7[_0x4b9d('0x14')][_0x4b9d('0x15')]);return _0x6ffa58(_0x6ee8c7[_0x4b9d('0x14')][_0x4b9d('0x15')]);}else{logger[_0x4b9d('0xe')](_0x4b9d('0xf'),_0x523dc3,_0x4b9d('0x10'));_0x6ffa58(_0x6ee8c7[_0x4b9d('0x16')][_0x4b9d('0x15')]);}})[_0x4b9d('0x17')](function(_0xe0f9c){logger[_0x4b9d('0x14')](_0x4b9d('0xf'),_0x523dc3,_0xe0f9c);_0xcaee9c(_0xe0f9c);});});} \ No newline at end of file +var _0xdbeb=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x1d2b51,_0x52e7b4){var _0x3b4710=function(_0x456579){while(--_0x456579){_0x1d2b51['push'](_0x1d2b51['shift']());}};_0x3b4710(++_0x52e7b4);}(_0xdbeb,0x1c9));var _0xbdbe=function(_0x1c19c2,_0x312a4d){_0x1c19c2=_0x1c19c2-0x0;var _0x5ad4df=_0xdbeb[_0x1c19c2];return _0x5ad4df;};'use strict';var _=require('lodash');var util=require(_0xbdbe('0x0'));var moment=require('moment');var BPromise=require(_0xbdbe('0x1'));var rs=require(_0xbdbe('0x2'));var fs=require('fs');var Redis=require(_0xbdbe('0x3'));var db=require(_0xbdbe('0x4'))['db'];var utils=require(_0xbdbe('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbdbe('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ed08e,_0x1bff8c,_0x13acd7){return new BPromise(function(_0x584ace,_0x5e1457){return client[_0xbdbe('0x7')](_0x5ed08e,_0x13acd7)[_0xbdbe('0x8')](function(_0x60605f){logger['info'](_0xbdbe('0x9'),_0x1bff8c,_0xbdbe('0xa'));logger['debug'](_0xbdbe('0xb'),_0x1bff8c,_0xbdbe('0xa'),JSON[_0xbdbe('0xc')](_0x60605f));if(_0x60605f[_0xbdbe('0xd')]){if(_0x60605f[_0xbdbe('0xd')][_0xbdbe('0xe')]===0x1f4){logger['error'](_0xbdbe('0x9'),_0x1bff8c,_0x60605f[_0xbdbe('0xd')]['message']);return _0x5e1457(_0x60605f[_0xbdbe('0xd')]['message']);}logger['error'](_0xbdbe('0x9'),_0x1bff8c,_0x60605f[_0xbdbe('0xd')]['message']);return _0x584ace(_0x60605f['error'][_0xbdbe('0xf')]);}else{logger[_0xbdbe('0x10')](_0xbdbe('0x9'),_0x1bff8c,'request\x20sent');_0x584ace(_0x60605f[_0xbdbe('0x11')][_0xbdbe('0xf')]);}})[_0xbdbe('0x12')](function(_0x4a3f70){logger[_0xbdbe('0xd')](_0xbdbe('0x9'),_0x1bff8c,_0x4a3f70);_0x5e1457(_0x4a3f70);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 5f12035..76d694a 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 _0x531e=['../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x9f9816,_0x579b0e){var _0x40a913=function(_0x5340c4){while(--_0x5340c4){_0x9f9816['push'](_0x9f9816['shift']());}};_0x40a913(++_0x579b0e);}(_0x531e,0x93));var _0xe531=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x531e[_0x4394b6];return _0x360244;};'use strict';var multer=require('multer');var util=require(_0xe531('0x0'));var path=require('path');var timeout=require(_0xe531('0x1'));var express=require(_0xe531('0x2'));var router=express[_0xe531('0x3')]();var auth=require(_0xe531('0x4'));var interaction=require(_0xe531('0x5'));var config=require(_0xe531('0x6'));var controller=require(_0xe531('0x7'));router[_0xe531('0x8')]('/',auth['isAuthenticated'](),controller[_0xe531('0x9')]);router[_0xe531('0x8')](_0xe531('0xa'),auth[_0xe531('0xb')](),controller[_0xe531('0xc')]);router['post']('/',auth[_0xe531('0xb')](),controller[_0xe531('0xd')]);router[_0xe531('0xe')](_0xe531('0xa'),auth[_0xe531('0xb')](),controller[_0xe531('0xf')]);router[_0xe531('0x10')](_0xe531('0xa'),auth['isAuthenticated'](),controller[_0xe531('0x11')]);module[_0xe531('0x12')]=router; \ No newline at end of file +var _0x279c=['/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x50edcc,_0x258deb){var _0x513281=function(_0x536045){while(--_0x536045){_0x50edcc['push'](_0x50edcc['shift']());}};_0x513281(++_0x258deb);}(_0x279c,0x193));var _0xc279=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x279c[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0xc279('0x0'));var util=require(_0xc279('0x1'));var path=require(_0xc279('0x2'));var timeout=require(_0xc279('0x3'));var express=require(_0xc279('0x4'));var router=express[_0xc279('0x5')]();var auth=require(_0xc279('0x6'));var interaction=require(_0xc279('0x7'));var config=require(_0xc279('0x8'));var controller=require(_0xc279('0x9'));router[_0xc279('0xa')]('/',auth[_0xc279('0xb')](),controller[_0xc279('0xc')]);router[_0xc279('0xa')]('/:id',auth[_0xc279('0xb')](),controller[_0xc279('0xd')]);router[_0xc279('0xe')]('/',auth[_0xc279('0xb')](),controller[_0xc279('0xf')]);router[_0xc279('0x10')](_0xc279('0x11'),auth['isAuthenticated'](),controller[_0xc279('0x12')]);router[_0xc279('0x13')](_0xc279('0x11'),auth[_0xc279('0xb')](),controller['destroy']);module[_0xc279('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 92ad530..ec72ec3 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 _0x06cb=['ENUM','string','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x5b9876,_0x293130){var _0x58538b=function(_0x54912d){while(--_0x54912d){_0x5b9876['push'](_0x5b9876['shift']());}};_0x58538b(++_0x293130);}(_0x06cb,0x1c6));var _0xb06c=function(_0x2bb0ee,_0x3e33c0){_0x2bb0ee=_0x2bb0ee-0x0;var _0x2f00e0=_0x06cb[_0x2bb0ee];return _0x2f00e0;};'use strict';var Sequelize=require(_0xb06c('0x0'));module[_0xb06c('0x1')]={'type':{'type':Sequelize[_0xb06c('0x2')](_0xb06c('0x3'),'variable','customVariable',_0xb06c('0x4')),'defaultValue':_0xb06c('0x3')},'content':{'type':Sequelize[_0xb06c('0x5')]},'key':{'type':Sequelize[_0xb06c('0x5')]},'keyType':{'type':Sequelize[_0xb06c('0x2')](_0xb06c('0x3'),'variable',_0xb06c('0x6'))},'keyContent':{'type':Sequelize[_0xb06c('0x5')]},'idField':{'type':Sequelize[_0xb06c('0x5')]},'nameField':{'type':Sequelize[_0xb06c('0x5')]},'customField':{'type':Sequelize[_0xb06c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb06c('0x5')]}}; \ No newline at end of file +var _0x05dc=['string','variable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x05dc,0xcd));var _0xc05d=function(_0x18e80c,_0x4077f7){_0x18e80c=_0x18e80c-0x0;var _0x183ba9=_0x05dc[_0x18e80c];return _0x183ba9;};'use strict';var Sequelize=require(_0xc05d('0x0'));module[_0xc05d('0x1')]={'type':{'type':Sequelize[_0xc05d('0x2')](_0xc05d('0x3'),_0xc05d('0x4'),'customVariable',_0xc05d('0x5')),'defaultValue':_0xc05d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc05d('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xc05d('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xc05d('0x6')]},'idField':{'type':Sequelize[_0xc05d('0x6')]},'nameField':{'type':Sequelize[_0xc05d('0x6')]},'customField':{'type':Sequelize[_0xc05d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc05d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 8241edb..35400e4 100644 --- a/server/api/intZendeskField/intZendeskField.controller.js +++ b/server/api/intZendeskField/intZendeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1623=['name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','ZendeskField','includeAll','include','catch','show','params','create','body','update','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','destroy','then','sendStatus','error','stack'];(function(_0x1346e7,_0x3e21e3){var _0x2fbd14=function(_0x37c040){while(--_0x37c040){_0x1346e7['push'](_0x1346e7['shift']());}};_0x2fbd14(++_0x3e21e3);}(_0x1623,0xab));var _0x3162=function(_0x1b4f98,_0x5a62b3){_0x1b4f98=_0x1b4f98-0x0;var _0xe74f5=_0x1623[_0x1b4f98];return _0xe74f5;};'use strict';var pdf=require(_0x3162('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3162('0x1'));var jsonpatch=require(_0x3162('0x2'));var rp=require(_0x3162('0x3'));var moment=require(_0x3162('0x4'));var BPromise=require(_0x3162('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3162('0x6'));var sox=require('sox');var csv=require(_0x3162('0x7'));var ejs=require(_0x3162('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0x7'));var querystring=require(_0x3162('0xd'));var Papa=require(_0x3162('0xe'));var Redis=require(_0x3162('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x10'));var hardwareService=require(_0x3162('0x11'));var logger=require(_0x3162('0x12'))(_0x3162('0x13'));var utils=require(_0x3162('0x14'));var config=require(_0x3162('0x15'));var licenseUtil=require(_0x3162('0x16'));var db=require(_0x3162('0x17'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x18')](_0x4c3625)[_0x3162('0x19')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x18')](_0x4a393a)[_0x3162('0x1a')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=_0x3d0bea[_0x3162('0x1b')],_0x490371=_0x15e348[_0x3162('0x1c')],_0x78a56c=_0x15e348[_0x3162('0x1c')]+_0x15e348[_0x3162('0x1d')],_0x42cf7d;if(_0x78a56c>=_0x2705d1){_0x78a56c=_0x2705d1;_0x42cf7d=0xc8;}else{_0x42cf7d=0xce;}_0x4b8a3b[_0x3162('0x18')](_0x42cf7d);return _0x4b8a3b['set'](_0x3162('0x1e'),_0x490371+'-'+_0x78a56c+'/'+_0x2705d1)[_0x3162('0x1a')](_0x3d0bea);}return null;};}function patchUpdates(_0x460b7b){return function(_0x36ca97){try{jsonpatch['apply'](_0x36ca97,_0x460b7b,!![]);}catch(_0x1dfd5c){return BPromise['reject'](_0x1dfd5c);}return _0x36ca97['save']();};}function saveUpdates(_0xa5c62b,_0x3e4d23){return function(_0x31946d){if(_0x31946d){return _0x31946d['update'](_0xa5c62b)['then'](function(_0x27133e){return _0x27133e;});}return null;};}function removeEntity(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x1f')]()[_0x3162('0x20')](function(){_0x396372[_0x3162('0x18')](0xcc)[_0x3162('0x19')]();});}};}function handleEntityNotFound(_0x5a4994,_0xd283d6){return function(_0x2433f8){if(!_0x2433f8){_0x5a4994[_0x3162('0x21')](0x194);}return _0x2433f8;};}function handleError(_0x1fd76f,_0x1c9992){_0x1c9992=_0x1c9992||0x1f4;return function(_0x3c543e){logger[_0x3162('0x22')](_0x3c543e[_0x3162('0x23')]);if(_0x3c543e[_0x3162('0x24')]){delete _0x3c543e[_0x3162('0x24')];}_0x1fd76f[_0x3162('0x18')](_0x1c9992)[_0x3162('0x25')](_0x3c543e);};}exports[_0x3162('0x26')]=function(_0x48de45,_0x4025c3){var _0x552469={},_0x37acdd={},_0x31f7fd={'count':0x0,'rows':[]};var _0x10c90b=_['map'](db['ZendeskField'][_0x3162('0x27')],function(_0xaa1f35){return{'name':_0xaa1f35[_0x3162('0x28')],'type':_0xaa1f35[_0x3162('0x29')][_0x3162('0x2a')]};});_0x37acdd['model']=_[_0x3162('0x2b')](_0x10c90b,'name');_0x37acdd[_0x3162('0x2c')]=_[_0x3162('0x2d')](_0x48de45[_0x3162('0x2c')]);_0x37acdd[_0x3162('0x2e')]=_[_0x3162('0x2f')](_0x37acdd[_0x3162('0x30')],_0x37acdd[_0x3162('0x2c')]);_0x552469[_0x3162('0x31')]=_['intersection'](_0x37acdd[_0x3162('0x30')],qs[_0x3162('0x32')](_0x48de45['query'][_0x3162('0x32')]));_0x552469[_0x3162('0x31')]=_0x552469['attributes']['length']?_0x552469[_0x3162('0x31')]:_0x37acdd['model'];if(!_0x48de45[_0x3162('0x2c')][_0x3162('0x33')](_0x3162('0x34'))){_0x552469['limit']=qs['limit'](_0x48de45[_0x3162('0x2c')][_0x3162('0x1d')]);_0x552469['offset']=qs[_0x3162('0x1c')](_0x48de45['query'][_0x3162('0x1c')]);}_0x552469[_0x3162('0x35')]=qs[_0x3162('0x36')](_0x48de45[_0x3162('0x2c')][_0x3162('0x36')]);_0x552469[_0x3162('0x37')]=qs[_0x3162('0x2e')](_[_0x3162('0x38')](_0x48de45[_0x3162('0x2c')],_0x37acdd[_0x3162('0x2e')]),_0x10c90b);if(_0x48de45[_0x3162('0x2c')]['filter']){_0x552469[_0x3162('0x37')]=_[_0x3162('0x39')](_0x552469[_0x3162('0x37')],{'$or':_['map'](_0x10c90b,function(_0x59759d){if(_0x59759d[_0x3162('0x29')]!==_0x3162('0x3a')){var _0x2e1ab5={};_0x2e1ab5[_0x59759d[_0x3162('0x24')]]={'$like':'%'+_0x48de45['query'][_0x3162('0x3b')]+'%'};return _0x2e1ab5;}})});}_0x552469=_['merge']({},_0x552469,_0x48de45['options']);var _0x5dee49={'where':_0x552469[_0x3162('0x37')]};return db[_0x3162('0x3c')][_0x3162('0x1b')](_0x5dee49)['then'](function(_0xbf9e0c){_0x31f7fd[_0x3162('0x1b')]=_0xbf9e0c;if(_0x48de45[_0x3162('0x2c')][_0x3162('0x3d')]){_0x552469[_0x3162('0x3e')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x552469);})[_0x3162('0x20')](function(_0x3783bd){_0x31f7fd['rows']=_0x3783bd;return _0x31f7fd;})['then'](respondWithFilteredResult(_0x4025c3,_0x552469))[_0x3162('0x3f')](handleError(_0x4025c3,null));};exports[_0x3162('0x40')]=function(_0x379756,_0x4883ac){var _0x3502ba={'raw':!![],'where':{'id':_0x379756[_0x3162('0x41')]['id']}},_0x3efd0d={};_0x3efd0d[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3c')][_0x3162('0x27')]);_0x3efd0d['query']=_[_0x3162('0x2d')](_0x379756[_0x3162('0x2c')]);_0x3efd0d['filters']=_[_0x3162('0x2f')](_0x3efd0d[_0x3162('0x30')],_0x3efd0d['query']);_0x3502ba[_0x3162('0x31')]=_['intersection'](_0x3efd0d[_0x3162('0x30')],qs[_0x3162('0x32')](_0x379756[_0x3162('0x2c')][_0x3162('0x32')]));_0x3502ba[_0x3162('0x31')]=_0x3502ba[_0x3162('0x31')]['length']?_0x3502ba[_0x3162('0x31')]:_0x3efd0d[_0x3162('0x30')];if(_0x379756[_0x3162('0x2c')]['includeAll']){_0x3502ba[_0x3162('0x3e')]=[{'all':!![]}];}_0x3502ba=_[_0x3162('0x39')]({},_0x3502ba,_0x379756['options']);return db[_0x3162('0x3c')]['find'](_0x3502ba)['then'](handleEntityNotFound(_0x4883ac,null))['then'](respondWithResult(_0x4883ac,null))[_0x3162('0x3f')](handleError(_0x4883ac,null));};exports[_0x3162('0x42')]=function(_0x2f68a0,_0x2dfc2e){return db[_0x3162('0x3c')][_0x3162('0x42')](_0x2f68a0[_0x3162('0x43')],{})[_0x3162('0x20')](respondWithResult(_0x2dfc2e,0xc9))[_0x3162('0x3f')](handleError(_0x2dfc2e,null));};exports[_0x3162('0x44')]=function(_0x1c81b5,_0x3a167f){if(_0x1c81b5[_0x3162('0x43')]['id']){delete _0x1c81b5['body']['id'];}return db[_0x3162('0x3c')]['find']({'where':{'id':_0x1c81b5['params']['id']}})[_0x3162('0x20')](handleEntityNotFound(_0x3a167f,null))[_0x3162('0x20')](saveUpdates(_0x1c81b5[_0x3162('0x43')],null))[_0x3162('0x20')](respondWithResult(_0x3a167f,null))['catch'](handleError(_0x3a167f,null));};exports[_0x3162('0x1f')]=function(_0x54941b,_0xa11c6e){return db[_0x3162('0x3c')]['find']({'where':{'id':_0x54941b[_0x3162('0x41')]['id']}})['then'](handleEntityNotFound(_0xa11c6e,null))['then'](removeEntity(_0xa11c6e,null))[_0x3162('0x3f')](handleError(_0xa11c6e,null));}; \ No newline at end of file +var _0x0120=['sendStatus','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end'];(function(_0x21700f,_0x31fa31){var _0x64b5fb=function(_0x12b879){while(--_0x12b879){_0x21700f['push'](_0x21700f['shift']());}};_0x64b5fb(++_0x31fa31);}(_0x0120,0x6f));var _0x0012=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x0120[_0x3ab9ee];return _0x82ee88;};'use strict';var pdf=require(_0x0012('0x0'));var emlformat=require(_0x0012('0x1'));var rimraf=require(_0x0012('0x2'));var zipdir=require(_0x0012('0x3'));var jsonpatch=require(_0x0012('0x4'));var rp=require(_0x0012('0x5'));var moment=require(_0x0012('0x6'));var BPromise=require(_0x0012('0x7'));var Mustache=require(_0x0012('0x8'));var util=require(_0x0012('0x9'));var path=require(_0x0012('0xa'));var sox=require(_0x0012('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0012('0xc'));var crypto=require(_0x0012('0xd'));var jsforce=require(_0x0012('0xe'));var deskjs=require(_0x0012('0xf'));var toCsv=require(_0x0012('0x10'));var querystring=require('querystring');var Papa=require(_0x0012('0x11'));var Redis=require(_0x0012('0x12'));var authService=require(_0x0012('0x13'));var qs=require(_0x0012('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0012('0x15'));var logger=require('../../config/logger')(_0x0012('0x16'));var utils=require(_0x0012('0x17'));var config=require(_0x0012('0x18'));var licenseUtil=require(_0x0012('0x19'));var db=require(_0x0012('0x1a'))['db'];function respondWithStatusCode(_0x4d3e7a,_0x6d4a1a){_0x6d4a1a=_0x6d4a1a||0xcc;return function(_0x4f0ee1){if(_0x4f0ee1){return _0x4d3e7a['sendStatus'](_0x6d4a1a);}return _0x4d3e7a['status'](_0x6d4a1a)['end']();};}function respondWithResult(_0x3a7d50,_0x496a2b){_0x496a2b=_0x496a2b||0xc8;return function(_0x3995fd){if(_0x3995fd){return _0x3a7d50[_0x0012('0x1b')](_0x496a2b)['json'](_0x3995fd);}};}function respondWithFilteredResult(_0x24f4ed,_0x1a0c0d){return function(_0x348810){if(_0x348810){var _0x3b8dfc=_0x348810[_0x0012('0x1c')],_0x522e9b=_0x1a0c0d[_0x0012('0x1d')],_0x4e72da=_0x1a0c0d[_0x0012('0x1d')]+_0x1a0c0d[_0x0012('0x1e')],_0x1e7fbe;if(_0x4e72da>=_0x3b8dfc){_0x4e72da=_0x3b8dfc;_0x1e7fbe=0xc8;}else{_0x1e7fbe=0xce;}_0x24f4ed[_0x0012('0x1b')](_0x1e7fbe);return _0x24f4ed[_0x0012('0x1f')](_0x0012('0x20'),_0x522e9b+'-'+_0x4e72da+'/'+_0x3b8dfc)['json'](_0x348810);}return null;};}function patchUpdates(_0x226968){return function(_0x56b0e1){try{jsonpatch['apply'](_0x56b0e1,_0x226968,!![]);}catch(_0x45d00b){return BPromise[_0x0012('0x21')](_0x45d00b);}return _0x56b0e1[_0x0012('0x22')]();};}function saveUpdates(_0x2c837e,_0x53ac2d){return function(_0x4d56ff){if(_0x4d56ff){return _0x4d56ff[_0x0012('0x23')](_0x2c837e)[_0x0012('0x24')](function(_0x35f9ee){return _0x35f9ee;});}return null;};}function removeEntity(_0x7177bc,_0x190f07){return function(_0x2e6a2c){if(_0x2e6a2c){return _0x2e6a2c[_0x0012('0x25')]()[_0x0012('0x24')](function(){_0x7177bc['status'](0xcc)[_0x0012('0x26')]();});}};}function handleEntityNotFound(_0x24a280,_0x4cf4bd){return function(_0x36cf42){if(!_0x36cf42){_0x24a280[_0x0012('0x27')](0x194);}return _0x36cf42;};}function handleError(_0x340622,_0x46c260){_0x46c260=_0x46c260||0x1f4;return function(_0x42bcd7){logger['error'](_0x42bcd7[_0x0012('0x28')]);if(_0x42bcd7[_0x0012('0x29')]){delete _0x42bcd7[_0x0012('0x29')];}_0x340622[_0x0012('0x1b')](_0x46c260)[_0x0012('0x2a')](_0x42bcd7);};}exports[_0x0012('0x2b')]=function(_0x15d48a,_0xf3781e){var _0x300e13={},_0x29a577={},_0x34efc7={'count':0x0,'rows':[]};var _0x20b78f=_[_0x0012('0x2c')](db[_0x0012('0x2d')][_0x0012('0x2e')],function(_0x276389){return{'name':_0x276389[_0x0012('0x2f')],'type':_0x276389[_0x0012('0x30')][_0x0012('0x31')]};});_0x29a577[_0x0012('0x32')]=_[_0x0012('0x2c')](_0x20b78f,'name');_0x29a577[_0x0012('0x33')]=_[_0x0012('0x34')](_0x15d48a['query']);_0x29a577[_0x0012('0x35')]=_[_0x0012('0x36')](_0x29a577[_0x0012('0x32')],_0x29a577[_0x0012('0x33')]);_0x300e13[_0x0012('0x37')]=_['intersection'](_0x29a577[_0x0012('0x32')],qs[_0x0012('0x38')](_0x15d48a[_0x0012('0x33')]['fields']));_0x300e13[_0x0012('0x37')]=_0x300e13[_0x0012('0x37')][_0x0012('0x39')]?_0x300e13[_0x0012('0x37')]:_0x29a577[_0x0012('0x32')];if(!_0x15d48a[_0x0012('0x33')]['hasOwnProperty'](_0x0012('0x3a'))){_0x300e13[_0x0012('0x1e')]=qs[_0x0012('0x1e')](_0x15d48a[_0x0012('0x33')]['limit']);_0x300e13['offset']=qs[_0x0012('0x1d')](_0x15d48a[_0x0012('0x33')][_0x0012('0x1d')]);}_0x300e13[_0x0012('0x3b')]=qs[_0x0012('0x3c')](_0x15d48a[_0x0012('0x33')][_0x0012('0x3c')]);_0x300e13['where']=qs[_0x0012('0x35')](_[_0x0012('0x3d')](_0x15d48a['query'],_0x29a577[_0x0012('0x35')]),_0x20b78f);if(_0x15d48a[_0x0012('0x33')][_0x0012('0x3e')]){_0x300e13[_0x0012('0x3f')]=_[_0x0012('0x40')](_0x300e13[_0x0012('0x3f')],{'$or':_[_0x0012('0x2c')](_0x20b78f,function(_0x4a4af8){if(_0x4a4af8[_0x0012('0x30')]!=='VIRTUAL'){var _0xaf7315={};_0xaf7315[_0x4a4af8['name']]={'$like':'%'+_0x15d48a['query'][_0x0012('0x3e')]+'%'};return _0xaf7315;}})});}_0x300e13=_[_0x0012('0x40')]({},_0x300e13,_0x15d48a[_0x0012('0x41')]);var _0x4e4424={'where':_0x300e13[_0x0012('0x3f')]};return db[_0x0012('0x2d')][_0x0012('0x1c')](_0x4e4424)[_0x0012('0x24')](function(_0x3d81ed){_0x34efc7[_0x0012('0x1c')]=_0x3d81ed;if(_0x15d48a[_0x0012('0x33')][_0x0012('0x42')]){_0x300e13['include']=[{'all':!![]}];}return db[_0x0012('0x2d')][_0x0012('0x43')](_0x300e13);})[_0x0012('0x24')](function(_0x1799f2){_0x34efc7[_0x0012('0x44')]=_0x1799f2;return _0x34efc7;})[_0x0012('0x24')](respondWithFilteredResult(_0xf3781e,_0x300e13))[_0x0012('0x45')](handleError(_0xf3781e,null));};exports['show']=function(_0x56782d,_0x1c54de){var _0x574ece={'raw':!![],'where':{'id':_0x56782d[_0x0012('0x46')]['id']}},_0x10a2df={};_0x10a2df[_0x0012('0x32')]=_[_0x0012('0x34')](db[_0x0012('0x2d')]['rawAttributes']);_0x10a2df[_0x0012('0x33')]=_[_0x0012('0x34')](_0x56782d['query']);_0x10a2df[_0x0012('0x35')]=_[_0x0012('0x36')](_0x10a2df[_0x0012('0x32')],_0x10a2df[_0x0012('0x33')]);_0x574ece['attributes']=_['intersection'](_0x10a2df[_0x0012('0x32')],qs['fields'](_0x56782d[_0x0012('0x33')]['fields']));_0x574ece[_0x0012('0x37')]=_0x574ece[_0x0012('0x37')][_0x0012('0x39')]?_0x574ece[_0x0012('0x37')]:_0x10a2df['model'];if(_0x56782d[_0x0012('0x33')]['includeAll']){_0x574ece[_0x0012('0x47')]=[{'all':!![]}];}_0x574ece=_[_0x0012('0x40')]({},_0x574ece,_0x56782d[_0x0012('0x41')]);return db[_0x0012('0x2d')][_0x0012('0x48')](_0x574ece)[_0x0012('0x24')](handleEntityNotFound(_0x1c54de,null))[_0x0012('0x24')](respondWithResult(_0x1c54de,null))['catch'](handleError(_0x1c54de,null));};exports[_0x0012('0x49')]=function(_0x34d592,_0x2855cd){return db[_0x0012('0x2d')][_0x0012('0x49')](_0x34d592[_0x0012('0x4a')],{})['then'](respondWithResult(_0x2855cd,0xc9))['catch'](handleError(_0x2855cd,null));};exports['update']=function(_0x5b6370,_0x475407){if(_0x5b6370[_0x0012('0x4a')]['id']){delete _0x5b6370[_0x0012('0x4a')]['id'];}return db[_0x0012('0x2d')][_0x0012('0x48')]({'where':{'id':_0x5b6370['params']['id']}})[_0x0012('0x24')](handleEntityNotFound(_0x475407,null))[_0x0012('0x24')](saveUpdates(_0x5b6370[_0x0012('0x4a')],null))[_0x0012('0x24')](respondWithResult(_0x475407,null))[_0x0012('0x45')](handleError(_0x475407,null));};exports[_0x0012('0x25')]=function(_0x156490,_0x26fb2b){return db[_0x0012('0x2d')][_0x0012('0x48')]({'where':{'id':_0x156490[_0x0012('0x46')]['id']}})['then'](handleEntityNotFound(_0x26fb2b,null))[_0x0012('0x24')](removeEntity(_0x26fb2b,null))[_0x0012('0x45')](handleError(_0x26fb2b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index c4f1f4a..4b0fd6d 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 _0x4f3c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x58cb21,_0x4737cc){_0x58cb21=_0x58cb21-0x0;var _0x37e679=_0x4f3c[_0x58cb21];return _0x37e679;};'use strict';var _=require(_0xc4f3('0x0'));var util=require(_0xc4f3('0x1'));var logger=require(_0xc4f3('0x2'))(_0xc4f3('0x3'));var moment=require(_0xc4f3('0x4'));var BPromise=require(_0xc4f3('0x5'));var rp=require(_0xc4f3('0x6'));var fs=require('fs');var path=require(_0xc4f3('0x7'));var rimraf=require(_0xc4f3('0x8'));var config=require(_0xc4f3('0x9'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x21d027,_0x14f1cc){return _0x21d027[_0xc4f3('0xa')](_0xc4f3('0xb'),attributes,{'tableName':_0xc4f3('0xc'),'paranoid':![],'indexes':[{'name':_0xc4f3('0xd'),'fields':[_0xc4f3('0xe'),_0xc4f3('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ba2=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField'];(function(_0x487060,_0x224dc7){var _0x2d75a8=function(_0x227f94){while(--_0x227f94){_0x487060['push'](_0x487060['shift']());}};_0x2d75a8(++_0x224dc7);}(_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':'zendesk_unique_index','fields':[_0x21ba('0xb'),'FieldId'],'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 87f6fad..9613151 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 _0xf9b7=['request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\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','client','http'];(function(_0x3be658,_0x5b5905){var _0x8382ed=function(_0x361b7d){while(--_0x361b7d){_0x3be658['push'](_0x3be658['shift']());}};_0x8382ed(++_0x5b5905);}(_0xf9b7,0x11e));var _0x7f9b=function(_0x2ad84d,_0x44b2e3){_0x2ad84d=_0x2ad84d-0x0;var _0x153f55=_0xf9b7[_0x2ad84d];return _0x153f55;};'use strict';var _=require(_0x7f9b('0x0'));var util=require(_0x7f9b('0x1'));var moment=require(_0x7f9b('0x2'));var BPromise=require(_0x7f9b('0x3'));var rs=require(_0x7f9b('0x4'));var fs=require('fs');var Redis=require(_0x7f9b('0x5'));var db=require(_0x7f9b('0x6'))['db'];var utils=require(_0x7f9b('0x7'));var logger=require(_0x7f9b('0x8'))(_0x7f9b('0x9'));var config=require(_0x7f9b('0xa'));var jayson=require(_0x7f9b('0xb'));var client=jayson[_0x7f9b('0xc')][_0x7f9b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4e73c6,_0x5151a2,_0x260626){return new BPromise(function(_0x3d67fd,_0x365f56){return client[_0x7f9b('0xe')](_0x4e73c6,_0x260626)[_0x7f9b('0xf')](function(_0x5b852f){logger[_0x7f9b('0x10')](_0x7f9b('0x11'),_0x5151a2,_0x7f9b('0x12'));logger['debug'](_0x7f9b('0x13'),_0x5151a2,_0x7f9b('0x12'),JSON['stringify'](_0x5b852f));if(_0x5b852f[_0x7f9b('0x14')]){if(_0x5b852f[_0x7f9b('0x14')][_0x7f9b('0x15')]===0x1f4){logger[_0x7f9b('0x14')](_0x7f9b('0x11'),_0x5151a2,_0x5b852f[_0x7f9b('0x14')][_0x7f9b('0x16')]);return _0x365f56(_0x5b852f[_0x7f9b('0x14')]['message']);}logger[_0x7f9b('0x14')]('ZendeskField,\x20%s,\x20%s',_0x5151a2,_0x5b852f[_0x7f9b('0x14')]['message']);return _0x3d67fd(_0x5b852f['error'][_0x7f9b('0x16')]);}else{logger[_0x7f9b('0x10')](_0x7f9b('0x11'),_0x5151a2,_0x7f9b('0x12'));_0x3d67fd(_0x5b852f[_0x7f9b('0x17')][_0x7f9b('0x16')]);}})[_0x7f9b('0x18')](function(_0x5d284f){logger[_0x7f9b('0x14')]('ZendeskField,\x20%s,\x20%s',_0x5151a2,_0x5d284f);_0x365f56(_0x5d284f);});});} \ No newline at end of file +var _0x1ed7=['request\x20sent','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','debug','ZendeskField,\x20%s,\x20%s,\x20%s'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x1ed7,0x15b));var _0x71ed=function(_0x124687,_0x2b59fc){_0x124687=_0x124687-0x0;var _0x3deb30=_0x1ed7[_0x124687];return _0x3deb30;};'use strict';var _=require(_0x71ed('0x0'));var util=require('util');var moment=require(_0x71ed('0x1'));var BPromise=require('bluebird');var rs=require(_0x71ed('0x2'));var fs=require('fs');var Redis=require(_0x71ed('0x3'));var db=require(_0x71ed('0x4'))['db'];var utils=require(_0x71ed('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x71ed('0x6'));var jayson=require(_0x71ed('0x7'));var client=jayson['client'][_0x71ed('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x464be2,_0x554881,_0x2d4fa1){return new BPromise(function(_0xfa9eac,_0x4b9eb2){return client['request'](_0x464be2,_0x2d4fa1)[_0x71ed('0x9')](function(_0xb43bd1){logger[_0x71ed('0xa')]('ZendeskField,\x20%s,\x20%s',_0x554881,'request\x20sent');logger[_0x71ed('0xb')](_0x71ed('0xc'),_0x554881,_0x71ed('0xd'),JSON['stringify'](_0xb43bd1));if(_0xb43bd1[_0x71ed('0xe')]){if(_0xb43bd1[_0x71ed('0xe')][_0x71ed('0xf')]===0x1f4){logger[_0x71ed('0xe')](_0x71ed('0x10'),_0x554881,_0xb43bd1[_0x71ed('0xe')]['message']);return _0x4b9eb2(_0xb43bd1[_0x71ed('0xe')][_0x71ed('0x11')]);}logger[_0x71ed('0xe')](_0x71ed('0x10'),_0x554881,_0xb43bd1[_0x71ed('0xe')][_0x71ed('0x11')]);return _0xfa9eac(_0xb43bd1['error'][_0x71ed('0x11')]);}else{logger['info'](_0x71ed('0x10'),_0x554881,_0x71ed('0xd'));_0xfa9eac(_0xb43bd1[_0x71ed('0x12')][_0x71ed('0x11')]);}})[_0x71ed('0x13')](function(_0x3408b6){logger[_0x71ed('0xe')](_0x71ed('0x10'),_0x554881,_0x3408b6);_0x4b9eb2(_0x3408b6);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index bc44058..7b99822 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(_0x5e8e19,_0x32fbf2){var _0x469267=function(_0x36a5ca){while(--_0x36a5ca){_0x5e8e19['push'](_0x5e8e19['shift']());}};_0x469267(++_0x32fbf2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x21f118,_0x577c99){var _0x3c8562=function(_0x5c3d8b){while(--_0x5c3d8b){_0x21f118['push'](_0x21f118['shift']());}};_0x3c8562(++_0x577c99);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 64e0528..8487288 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 _0x422a=['sequelize','exports','STRING'];(function(_0x2600b3,_0x27b5c3){var _0x59f150=function(_0x12c873){while(--_0x12c873){_0x2600b3['push'](_0x2600b3['shift']());}};_0x59f150(++_0x27b5c3);}(_0x422a,0x195));var _0xa422=function(_0x2a1d8c,_0x491526){_0x2a1d8c=_0x2a1d8c-0x0;var _0x20b1a8=_0x422a[_0x2a1d8c];return _0x20b1a8;};'use strict';var Sequelize=require(_0xa422('0x0'));module[_0xa422('0x1')]={'name':{'type':Sequelize[_0xa422('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa422('0x2')]},'zone':{'type':Sequelize[_0xa422('0x2')]},'clientId':{'type':Sequelize[_0xa422('0x2')]},'clientSecret':{'type':Sequelize[_0xa422('0x2')]},'serverUrl':{'type':Sequelize[_0xa422('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xa422('0x2')]},'refreshToken':{'type':Sequelize[_0xa422('0x2')]}}; \ No newline at end of file +var _0x382e=['sequelize','exports','STRING'];(function(_0x490ac1,_0x3be9ac){var _0x4e051d=function(_0xe385da){while(--_0xe385da){_0x490ac1['push'](_0x490ac1['shift']());}};_0x4e051d(++_0x3be9ac);}(_0x382e,0x1e9));var _0xe382=function(_0x8f50e0,_0x3c12f2){_0x8f50e0=_0x8f50e0-0x0;var _0x51abcf=_0x382e[_0x8f50e0];return _0x51abcf;};'use strict';var Sequelize=require(_0xe382('0x0'));module[_0xe382('0x1')]={'name':{'type':Sequelize[_0xe382('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe382('0x2')]},'zone':{'type':Sequelize[_0xe382('0x2')]},'clientId':{'type':Sequelize[_0xe382('0x2')]},'clientSecret':{'type':Sequelize[_0xe382('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xe382('0x2')]},'refreshToken':{'type':Sequelize[_0xe382('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 6ac53ba..1e7437c 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 _0x86dc=['Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Result','Call_Start_Time','remove','includes','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','crypto','desk.js','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','client','http','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','count','offset','limit','json','apply','reject','save','update','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','rows','show','keys','length','includeAll','options','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId'];(function(_0x5c3c4f,_0x50a675){var _0x3dd693=function(_0x52fb4a){while(--_0x52fb4a){_0x5c3c4f['push'](_0x5c3c4f['shift']());}};_0x3dd693(++_0x50a675);}(_0x86dc,0x13e));var _0xc86d=function(_0x24a97c,_0xf7f941){_0x24a97c=_0x24a97c-0x0;var _0x187447=_0x86dc[_0x24a97c];return _0x187447;};'use strict';var pdf=require(_0xc86d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc86d('0x1'));var jsonpatch=require(_0xc86d('0x2'));var rp=require(_0xc86d('0x3'));var moment=require(_0xc86d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc86d('0x5'));var util=require('util');var path=require(_0xc86d('0x6'));var sox=require('sox');var csv=require(_0xc86d('0x7'));var ejs=require(_0xc86d('0x8'));var fs=require('fs');var _=require(_0xc86d('0x9'));var squel=require('squel');var crypto=require(_0xc86d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc86d('0xb'));var toCsv=require(_0xc86d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc86d('0xc'));var authService=require(_0xc86d('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc86d('0xe'));var hardwareService=require(_0xc86d('0xf'));var logger=require(_0xc86d('0x10'))(_0xc86d('0x11'));var utils=require(_0xc86d('0x12'));var config=require(_0xc86d('0x13'));var licenseUtil=require(_0xc86d('0x14'));var db=require(_0xc86d('0x15'))['db'];var integrations=require(_0xc86d('0x16'));var jayson=require(_0xc86d('0x17'));var client=jayson[_0xc86d('0x18')][_0xc86d('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x33b1a0,_0xccef31,_0x450fb1,_0x2a963c){return new BPromise(function(_0x176ce1,_0x313c16){var _0x2bc469=_0x2a963c||client;return _0x2bc469[_0xc86d('0x1a')](_0x33b1a0,_0x450fb1)[_0xc86d('0x1b')](function(_0x5e58aa){logger['info']('ZohoAccount,\x20%s,\x20%s',_0xccef31,_0xc86d('0x1c'));logger[_0xc86d('0x1d')](_0xc86d('0x1e'),_0xccef31,_0xc86d('0x1c'),JSON[_0xc86d('0x1f')](_0x5e58aa));if(_0x5e58aa[_0xc86d('0x20')]){if(_0x5e58aa[_0xc86d('0x20')]['code']===0x1f4){logger['error'](_0xc86d('0x21'),_0xccef31,_0x5e58aa[_0xc86d('0x20')][_0xc86d('0x22')]);return _0x313c16(_0x5e58aa['error'][_0xc86d('0x22')]);}logger[_0xc86d('0x20')](_0xc86d('0x21'),_0xccef31,_0x5e58aa['error'][_0xc86d('0x22')]);return _0x176ce1(_0x5e58aa[_0xc86d('0x20')]['message']);}else{logger[_0xc86d('0x23')](_0xc86d('0x21'),_0xccef31,_0xc86d('0x1c'));_0x176ce1(_0x5e58aa[_0xc86d('0x24')]['message']);}})[_0xc86d('0x25')](function(_0x350cda){logger[_0xc86d('0x20')](_0xc86d('0x21'),_0xccef31,_0x350cda);_0x313c16(_0x350cda);});});}function respondWithStatusCode(_0xbeed40,_0x56278d){_0x56278d=_0x56278d||0xcc;return function(_0x38fb11){if(_0x38fb11){return _0xbeed40[_0xc86d('0x26')](_0x56278d);}return _0xbeed40[_0xc86d('0x27')](_0x56278d)[_0xc86d('0x28')]();};}function respondWithResult(_0x27d636,_0x5347f7){_0x5347f7=_0x5347f7||0xc8;return function(_0x1458fe){if(_0x1458fe){return _0x27d636['status'](_0x5347f7)['json'](_0x1458fe);}};}function respondWithFilteredResult(_0x533cce,_0x2782b8){return function(_0x3948c4){if(_0x3948c4){var _0x273c5a=_0x3948c4[_0xc86d('0x29')],_0x1e29be=_0x2782b8[_0xc86d('0x2a')],_0xd8b255=_0x2782b8['offset']+_0x2782b8[_0xc86d('0x2b')],_0x1ad978;if(_0xd8b255>=_0x273c5a){_0xd8b255=_0x273c5a;_0x1ad978=0xc8;}else{_0x1ad978=0xce;}_0x533cce[_0xc86d('0x27')](_0x1ad978);return _0x533cce['set']('Content-Range',_0x1e29be+'-'+_0xd8b255+'/'+_0x273c5a)[_0xc86d('0x2c')](_0x3948c4);}return null;};}function patchUpdates(_0x1f5772){return function(_0x54a9f6){try{jsonpatch[_0xc86d('0x2d')](_0x54a9f6,_0x1f5772,!![]);}catch(_0x384bc9){return BPromise[_0xc86d('0x2e')](_0x384bc9);}return _0x54a9f6[_0xc86d('0x2f')]();};}function saveUpdates(_0x5a4ef1,_0x5bda1c){return function(_0x205a2b){if(_0x205a2b){return _0x205a2b[_0xc86d('0x30')](_0x5a4ef1)[_0xc86d('0x1b')](function(_0x219673){return _0x219673;});}return null;};}function removeEntity(_0x28dd82,_0x5b80cb){return function(_0x3ca99a){if(_0x3ca99a){return _0x3ca99a['destroy']()[_0xc86d('0x1b')](function(){_0x28dd82[_0xc86d('0x27')](0xcc)[_0xc86d('0x28')]();});}};}function handleEntityNotFound(_0x21377a,_0x3a469d){return function(_0x1d7fe8){if(!_0x1d7fe8){_0x21377a[_0xc86d('0x26')](0x194);}return _0x1d7fe8;};}function handleError(_0x100258,_0x12ea63){_0x12ea63=_0x12ea63||0x1f4;return function(_0x4e51bd){logger['error'](_0x4e51bd['stack']);if(_0x4e51bd['name']){delete _0x4e51bd['name'];}_0x100258['status'](_0x12ea63)[_0xc86d('0x31')](_0x4e51bd);};}exports[_0xc86d('0x32')]=function(_0x3fa1dd,_0x118007){var _0x2cba68={},_0x225a25={},_0x51924c={'count':0x0,'rows':[]};var _0x3b0940=_[_0xc86d('0x33')](db[_0xc86d('0x34')][_0xc86d('0x35')],function(_0x10f6a1){return{'name':_0x10f6a1[_0xc86d('0x36')],'type':_0x10f6a1[_0xc86d('0x37')][_0xc86d('0x38')]};});_0x225a25[_0xc86d('0x39')]=_[_0xc86d('0x33')](_0x3b0940,'name');_0x225a25[_0xc86d('0x3a')]=_['keys'](_0x3fa1dd[_0xc86d('0x3a')]);_0x225a25[_0xc86d('0x3b')]=_[_0xc86d('0x3c')](_0x225a25['model'],_0x225a25[_0xc86d('0x3a')]);_0x2cba68[_0xc86d('0x3d')]=_[_0xc86d('0x3c')](_0x225a25['model'],qs[_0xc86d('0x3e')](_0x3fa1dd[_0xc86d('0x3a')][_0xc86d('0x3e')]));_0x2cba68[_0xc86d('0x3d')]=_0x2cba68[_0xc86d('0x3d')]['length']?_0x2cba68[_0xc86d('0x3d')]:_0x225a25[_0xc86d('0x39')];if(!_0x3fa1dd[_0xc86d('0x3a')][_0xc86d('0x3f')](_0xc86d('0x40'))){_0x2cba68[_0xc86d('0x2b')]=qs['limit'](_0x3fa1dd[_0xc86d('0x3a')]['limit']);_0x2cba68[_0xc86d('0x2a')]=qs[_0xc86d('0x2a')](_0x3fa1dd[_0xc86d('0x3a')][_0xc86d('0x2a')]);}_0x2cba68['order']=qs['sort'](_0x3fa1dd['query'][_0xc86d('0x41')]);_0x2cba68[_0xc86d('0x42')]=qs[_0xc86d('0x3b')](_[_0xc86d('0x43')](_0x3fa1dd['query'],_0x225a25[_0xc86d('0x3b')]),_0x3b0940);if(_0x3fa1dd[_0xc86d('0x3a')][_0xc86d('0x44')]){_0x2cba68[_0xc86d('0x42')]=_[_0xc86d('0x45')](_0x2cba68['where'],{'$or':_[_0xc86d('0x33')](_0x3b0940,function(_0x32fd2e){if(_0x32fd2e[_0xc86d('0x37')]!==_0xc86d('0x46')){var _0x515b18={};_0x515b18[_0x32fd2e[_0xc86d('0x47')]]={'$like':'%'+_0x3fa1dd['query']['filter']+'%'};return _0x515b18;}})});}_0x2cba68=_[_0xc86d('0x45')]({},_0x2cba68,_0x3fa1dd['options']);var _0x2f3fa6={'where':_0x2cba68[_0xc86d('0x42')]};return db[_0xc86d('0x34')][_0xc86d('0x29')](_0x2f3fa6)['then'](function(_0x207999){_0x51924c[_0xc86d('0x29')]=_0x207999;if(_0x3fa1dd[_0xc86d('0x3a')]['includeAll']){_0x2cba68['include']=[{'all':!![]}];}return db[_0xc86d('0x34')]['findAll'](_0x2cba68);})[_0xc86d('0x1b')](function(_0x281007){_0x51924c[_0xc86d('0x48')]=_0x281007;return _0x51924c;})['then'](respondWithFilteredResult(_0x118007,_0x2cba68))['catch'](handleError(_0x118007,null));};exports[_0xc86d('0x49')]=function(_0x21b745,_0x39c3db){var _0x574663={'raw':![],'where':{'id':_0x21b745['params']['id']}},_0xb9c6e8={};_0xb9c6e8[_0xc86d('0x39')]=_[_0xc86d('0x4a')](db['ZohoAccount'][_0xc86d('0x35')]);_0xb9c6e8[_0xc86d('0x3a')]=_['keys'](_0x21b745[_0xc86d('0x3a')]);_0xb9c6e8['filters']=_[_0xc86d('0x3c')](_0xb9c6e8[_0xc86d('0x39')],_0xb9c6e8[_0xc86d('0x3a')]);_0x574663['attributes']=_['intersection'](_0xb9c6e8[_0xc86d('0x39')],qs[_0xc86d('0x3e')](_0x21b745[_0xc86d('0x3a')][_0xc86d('0x3e')]));_0x574663['attributes']=_0x574663[_0xc86d('0x3d')][_0xc86d('0x4b')]?_0x574663[_0xc86d('0x3d')]:_0xb9c6e8[_0xc86d('0x39')];if(_0x21b745[_0xc86d('0x3a')][_0xc86d('0x4c')]){_0x574663['include']=[{'all':!![]}];}_0x574663=_[_0xc86d('0x45')]({},_0x574663,_0x21b745[_0xc86d('0x4d')]);return db[_0xc86d('0x34')][_0xc86d('0x4e')](_0x574663)[_0xc86d('0x1b')](handleEntityNotFound(_0x39c3db,null))[_0xc86d('0x1b')](respondWithResult(_0x39c3db,null))[_0xc86d('0x25')](handleError(_0x39c3db,null));};exports[_0xc86d('0x4f')]=function(_0x5b6fdb,_0x4f57f7){return db[_0xc86d('0x34')]['create'](_0x5b6fdb[_0xc86d('0x50')],{})[_0xc86d('0x1b')](respondWithResult(_0x4f57f7,0xc9))['catch'](handleError(_0x4f57f7,null));};exports[_0xc86d('0x30')]=function(_0x64d4f7,_0x2bf181){if(_0x64d4f7[_0xc86d('0x50')]['id']){delete _0x64d4f7[_0xc86d('0x50')]['id'];}return db[_0xc86d('0x34')][_0xc86d('0x4e')]({'where':{'id':_0x64d4f7[_0xc86d('0x51')]['id']}})['then'](handleEntityNotFound(_0x2bf181,null))[_0xc86d('0x1b')](saveUpdates(_0x64d4f7[_0xc86d('0x50')],null))[_0xc86d('0x1b')](respondWithResult(_0x2bf181,null))[_0xc86d('0x25')](handleError(_0x2bf181,null));};exports['destroy']=function(_0x246021,_0x5cfb45){return db[_0xc86d('0x34')][_0xc86d('0x4e')]({'where':{'id':_0x246021[_0xc86d('0x51')]['id']}})['then'](handleEntityNotFound(_0x5cfb45,null))[_0xc86d('0x1b')](removeEntity(_0x5cfb45,null))[_0xc86d('0x25')](handleError(_0x5cfb45,null));};exports[_0xc86d('0x52')]=function(_0x45e763,_0x4fa36a,_0x4f30e2){var _0x135f26={};var _0x529926={};var _0xbe263a;var _0x569ac9;return db[_0xc86d('0x34')][_0xc86d('0x53')]({'where':{'id':_0x45e763[_0xc86d('0x51')]['id']}})['then'](handleEntityNotFound(_0x4fa36a,null))['then'](function(_0x4f0d12){if(_0x4f0d12){_0xbe263a=_0x4f0d12;_0x529926[_0xc86d('0x39')]=_[_0xc86d('0x4a')](db[_0xc86d('0x54')][_0xc86d('0x35')]);_0x529926[_0xc86d('0x3a')]=_[_0xc86d('0x4a')](_0x45e763['query']);_0x529926['filters']=_[_0xc86d('0x3c')](_0x529926[_0xc86d('0x39')],_0x529926[_0xc86d('0x3a')]);_0x135f26[_0xc86d('0x3d')]=_[_0xc86d('0x3c')](_0x529926[_0xc86d('0x39')],qs[_0xc86d('0x3e')](_0x45e763[_0xc86d('0x3a')][_0xc86d('0x3e')]));_0x135f26['attributes']=_0x135f26[_0xc86d('0x3d')][_0xc86d('0x4b')]?_0x135f26['attributes']:_0x529926['model'];_0x135f26['order']=qs[_0xc86d('0x41')](_0x45e763[_0xc86d('0x3a')][_0xc86d('0x41')]);_0x135f26[_0xc86d('0x42')]=qs[_0xc86d('0x3b')](_[_0xc86d('0x43')](_0x45e763[_0xc86d('0x3a')],_0x529926[_0xc86d('0x3b')]));if(_0x45e763['query'][_0xc86d('0x44')]){_0x135f26['where']=_[_0xc86d('0x45')](_0x135f26[_0xc86d('0x42')],{'$or':_[_0xc86d('0x33')](_0x135f26[_0xc86d('0x3d')],function(_0x36497f){var _0x267d2a={};_0x267d2a[_0x36497f]={'$like':'%'+_0x45e763[_0xc86d('0x3a')][_0xc86d('0x44')]+'%'};return _0x267d2a;})});}_0x135f26=_[_0xc86d('0x45')]({},_0x135f26,_0x45e763[_0xc86d('0x4d')]);return _0xbe263a[_0xc86d('0x52')](_0x135f26);}})[_0xc86d('0x1b')](function(_0x5b6abc){if(_0x5b6abc){_0x569ac9=_0x5b6abc[_0xc86d('0x4b')];if(!_0x45e763[_0xc86d('0x3a')][_0xc86d('0x3f')](_0xc86d('0x40'))){_0x135f26[_0xc86d('0x2b')]=qs[_0xc86d('0x2b')](_0x45e763['query']['limit']);_0x135f26[_0xc86d('0x2a')]=qs[_0xc86d('0x2a')](_0x45e763[_0xc86d('0x3a')]['offset']);}return _0xbe263a[_0xc86d('0x52')](_0x135f26);}})[_0xc86d('0x1b')](function(_0x542d27){if(_0x542d27){return _0x542d27?{'count':_0x569ac9,'rows':_0x542d27}:null;}})['then'](respondWithResult(_0x4fa36a,null))[_0xc86d('0x25')](handleError(_0x4fa36a,null));};exports[_0xc86d('0x55')]=function(_0x332cae,_0x2263dc,_0x21d56f){if(_0x332cae[_0xc86d('0x50')]['id']){delete _0x332cae[_0xc86d('0x50')]['id'];}return db[_0xc86d('0x34')][_0xc86d('0x53')]({'where':{'id':_0x332cae[_0xc86d('0x51')]['id']}})[_0xc86d('0x1b')](handleEntityNotFound(_0x2263dc,null))[_0xc86d('0x1b')](function(_0x362614){if(_0x362614){_0x332cae[_0xc86d('0x50')][_0xc86d('0x56')]=_0x362614['id'];_0x332cae[_0xc86d('0x50')][_0xc86d('0x57')]=integrations[_0xc86d('0x58')](_0x332cae['body'][_0xc86d('0x59')],_0x332cae[_0xc86d('0x50')]['type']);_0x332cae['body'][_0xc86d('0x5a')]=integrations['getDescriptions'](_0x332cae[_0xc86d('0x50')][_0xc86d('0x59')],_0x332cae[_0xc86d('0x50')]['type']);return db[_0xc86d('0x54')][_0xc86d('0x4f')](_0x332cae[_0xc86d('0x50')],{'include':[{'model':db[_0xc86d('0x5b')],'as':_0xc86d('0x57')},{'model':db[_0xc86d('0x5b')],'as':_0xc86d('0x5a')}]});}return null;})['then'](respondWithResult(_0x2263dc,null))[_0xc86d('0x25')](handleError(_0x2263dc,null));};function getAccessToken(_0x224b33){return new Promise(function(_0x61ca65,_0x48224e){var _0xd6d9f;switch(_0x224b33[_0xc86d('0x5c')]){case'US':_0xd6d9f=_0xc86d('0x5d');break;case'AU':_0xd6d9f=_0xc86d('0x5e');break;case'EU':_0xd6d9f=_0xc86d('0x5f');break;case'IN':_0xd6d9f=_0xc86d('0x60');break;case'CN':_0xd6d9f=_0xc86d('0x61');break;default:_0xd6d9f=_0xc86d('0x5f');break;}var _0x30113a={'method':_0xc86d('0x62'),'uri':_0xd6d9f+_0xc86d('0x63'),'qs':{'refresh_token':_0x224b33[_0xc86d('0x64')],'client_id':_0x224b33[_0xc86d('0x65')],'client_secret':_0x224b33[_0xc86d('0x66')],'grant_type':_0xc86d('0x67')},'json':!![]};return rp(_0x30113a)['then'](function(_0x34e77e){if(_0x34e77e[_0xc86d('0x68')]){_0x61ca65(_0x34e77e[_0xc86d('0x68')]);}else{_0x48224e('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xc86d('0x25')](function(_0x1115db){_0x48224e(_0x1115db);});});}exports[_0xc86d('0x69')]=function(_0x3e9f50,_0x322e30,_0x90a73f){var _0x504b67,_0xce0099,_0x45d52e,_0x4aee9f,_0x28a69c;return db[_0xc86d('0x34')][_0xc86d('0x53')]({'where':{'id':_0x3e9f50['params']['id']},'attributes':['id',_0xc86d('0x6a'),_0xc86d('0x5c'),_0xc86d('0x65'),_0xc86d('0x66'),_0xc86d('0x6b'),'code','refreshToken']})[_0xc86d('0x1b')](handleEntityNotFound(_0x322e30,null))['then'](function(_0x4bbac8){_0x28a69c=_0x4bbac8;_0x504b67=_0x28a69c[_0xc86d('0x6a')];_0xce0099=_0x504b67==='zoho.eu'?'eu':_0xc86d('0x6c');_0x45d52e=_0x28a69c[_0xc86d('0x6b')];var _0xa17588=_0x45d52e[_0xc86d('0x6d')](-0x1);if(_0xa17588==='/'||_0xa17588==='\x5c'||_0xa17588===':'){_0x45d52e=_0x45d52e[_0xc86d('0x6e')](0x0,_0x45d52e[_0xc86d('0x6f')](_0xa17588));}if(!_0x28a69c[_0xc86d('0x64')]){throw new Error(_0xc86d('0x70'));}return getAccessToken(_0x28a69c);})[_0xc86d('0x1b')](function(_0x3944c3){if(_0x3944c3){return rp({'method':_0xc86d('0x71'),'uri':util[_0xc86d('0x72')](_0xc86d('0x73'),_0xce0099),'qs':{'module':'Calls'},'headers':{'Authorization':_0xc86d('0x74')+_0x3944c3},'json':!![]});}})[_0xc86d('0x1b')](function(_0x5ace7e){if(_0x5ace7e){if(_0x5ace7e['response']&&_0x5ace7e['response'][_0xc86d('0x20')]){throw new Error(_0x5ace7e[_0xc86d('0x75')][_0xc86d('0x20')][_0xc86d('0x22')]);}var _0x2029ab=[];var _0xbba47f=[];var _0x3ef3cb=['Owner',_0xc86d('0x76'),_0xc86d('0x77'),_0xc86d('0x78'),'Call_Duration',_0xc86d('0x79'),_0xc86d('0x7a'),'Call_Type'];_0xbba47f=_[_0xc86d('0x7b')](_0x5ace7e[_0xc86d('0x3e')],function(_0x568467){return _0x3ef3cb[_0xc86d('0x7c')](_0x568467['api_name']);});for(var _0x192761=0x0;_0x192761<_0xbba47f[_0xc86d('0x4b')];_0x192761++){if(_0xbba47f[_0x192761][_0xc86d('0x7d')]===![]){_0x2029ab['push']({'id':_0xbba47f[_0x192761]['id'],'name':_0xbba47f[_0x192761][_0xc86d('0x7e')],'custom':_0xbba47f[_0x192761][_0xc86d('0x7f')],'options':_0xbba47f[_0x192761][_0xc86d('0x80')]===_0xc86d('0x81')&&_0xbba47f[_0x192761][_0xc86d('0x82')][_0xc86d('0x4b')]>-0x1?_[_0xc86d('0x33')](_0xbba47f[_0x192761]['pick_list_values'],function(_0x48efe3){return{'name':_0x48efe3,'value':_0x48efe3};}):[]});}}return{'count':_0x2029ab[_0xc86d('0x4b')],'rows':_0x2029ab};}else{return{'count':0x0,'rows':[]};}})[_0xc86d('0x1b')](respondWithResult(_0x322e30,null))['catch'](function(_0x2ffbc7){var _0x1baa4b=_0x3e9f50[_0xc86d('0x3a')][_0xc86d('0x83')]?0x1f4:_0x2ffbc7['statusCode']||0x1f4;logger[_0xc86d('0x20')](_0xc86d('0x84'),'getFields',_0x1baa4b,JSON['stringify'](_0x2ffbc7));delete _0x2ffbc7[_0xc86d('0x47')];if(_0x1baa4b===0x191){_0x1baa4b=0x190;}_0x322e30[_0xc86d('0x27')](_0x1baa4b)['send'](_0x3e9f50[_0xc86d('0x3a')][_0xc86d('0x83')]?{'message':_0xc86d('0x85'),'statusCode':_0x2ffbc7[_0xc86d('0x86')]}:_0x2ffbc7);});}; \ No newline at end of file +var _0x905a=['json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','ZohoAccount','include','rows','show','params','find','create','body','getConfigurations','ZohoConfiguration','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','jayson/promise','client','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x905a,0xeb));var _0xa905=function(_0x2ef1db,_0x431a28){_0x2ef1db=_0x2ef1db-0x0;var _0x548147=_0x905a[_0x2ef1db];return _0x548147;};'use strict';var pdf=require(_0xa905('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa905('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa905('0x2'));var moment=require(_0xa905('0x3'));var BPromise=require(_0xa905('0x4'));var Mustache=require(_0xa905('0x5'));var util=require(_0xa905('0x6'));var path=require(_0xa905('0x7'));var sox=require(_0xa905('0x8'));var csv=require(_0xa905('0x9'));var ejs=require(_0xa905('0xa'));var fs=require('fs');var _=require(_0xa905('0xb'));var squel=require(_0xa905('0xc'));var crypto=require(_0xa905('0xd'));var jsforce=require(_0xa905('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa905('0x9'));var querystring=require('querystring');var Papa=require(_0xa905('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa905('0x10'));var as=require(_0xa905('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa905('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa905('0x13'));var licenseUtil=require(_0xa905('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xa905('0x15'));var client=jayson[_0xa905('0x16')][_0xa905('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xe2c90c,_0x1a2cb2,_0xbe0d64,_0x4c42a4){return new BPromise(function(_0x3ec259,_0x5f2072){var _0x356cfb=_0x4c42a4||client;return _0x356cfb[_0xa905('0x18')](_0xe2c90c,_0xbe0d64)['then'](function(_0x58341f){logger['info'](_0xa905('0x19'),_0x1a2cb2,_0xa905('0x1a'));logger[_0xa905('0x1b')](_0xa905('0x1c'),_0x1a2cb2,_0xa905('0x1a'),JSON[_0xa905('0x1d')](_0x58341f));if(_0x58341f[_0xa905('0x1e')]){if(_0x58341f[_0xa905('0x1e')][_0xa905('0x1f')]===0x1f4){logger[_0xa905('0x1e')](_0xa905('0x19'),_0x1a2cb2,_0x58341f[_0xa905('0x1e')]['message']);return _0x5f2072(_0x58341f[_0xa905('0x1e')][_0xa905('0x20')]);}logger[_0xa905('0x1e')](_0xa905('0x19'),_0x1a2cb2,_0x58341f[_0xa905('0x1e')][_0xa905('0x20')]);return _0x3ec259(_0x58341f['error'][_0xa905('0x20')]);}else{logger[_0xa905('0x21')](_0xa905('0x19'),_0x1a2cb2,_0xa905('0x1a'));_0x3ec259(_0x58341f['result'][_0xa905('0x20')]);}})[_0xa905('0x22')](function(_0x32760e){logger[_0xa905('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0x1a2cb2,_0x32760e);_0x5f2072(_0x32760e);});});}function respondWithStatusCode(_0x53d476,_0x23fb4e){_0x23fb4e=_0x23fb4e||0xcc;return function(_0x43e2f6){if(_0x43e2f6){return _0x53d476['sendStatus'](_0x23fb4e);}return _0x53d476[_0xa905('0x23')](_0x23fb4e)[_0xa905('0x24')]();};}function respondWithResult(_0x447f6c,_0x182967){_0x182967=_0x182967||0xc8;return function(_0x59fb12){if(_0x59fb12){return _0x447f6c[_0xa905('0x23')](_0x182967)[_0xa905('0x25')](_0x59fb12);}};}function respondWithFilteredResult(_0x4bed6e,_0x3e3067){return function(_0x399f07){if(_0x399f07){var _0x172129=_0x399f07[_0xa905('0x26')],_0x2ff254=_0x3e3067['offset'],_0x2768c0=_0x3e3067[_0xa905('0x27')]+_0x3e3067[_0xa905('0x28')],_0x131421;if(_0x2768c0>=_0x172129){_0x2768c0=_0x172129;_0x131421=0xc8;}else{_0x131421=0xce;}_0x4bed6e[_0xa905('0x23')](_0x131421);return _0x4bed6e[_0xa905('0x29')](_0xa905('0x2a'),_0x2ff254+'-'+_0x2768c0+'/'+_0x172129)['json'](_0x399f07);}return null;};}function patchUpdates(_0x4c7ac3){return function(_0x1426b7){try{jsonpatch[_0xa905('0x2b')](_0x1426b7,_0x4c7ac3,!![]);}catch(_0x951d2e){return BPromise[_0xa905('0x2c')](_0x951d2e);}return _0x1426b7['save']();};}function saveUpdates(_0x3ae3b6,_0x1243aa){return function(_0x1ca49e){if(_0x1ca49e){return _0x1ca49e[_0xa905('0x2d')](_0x3ae3b6)[_0xa905('0x2e')](function(_0x50734b){return _0x50734b;});}return null;};}function removeEntity(_0x433b78,_0x27abe1){return function(_0x395a85){if(_0x395a85){return _0x395a85[_0xa905('0x2f')]()[_0xa905('0x2e')](function(){_0x433b78[_0xa905('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x135290,_0x450e9b){return function(_0x302241){if(!_0x302241){_0x135290[_0xa905('0x30')](0x194);}return _0x302241;};}function handleError(_0x1a835b,_0x4e1ca2){_0x4e1ca2=_0x4e1ca2||0x1f4;return function(_0x31afa8){logger['error'](_0x31afa8[_0xa905('0x31')]);if(_0x31afa8[_0xa905('0x32')]){delete _0x31afa8[_0xa905('0x32')];}_0x1a835b[_0xa905('0x23')](_0x4e1ca2)['send'](_0x31afa8);};}exports[_0xa905('0x33')]=function(_0x2a9b86,_0x5465a6){var _0x226588={},_0x4ae643={},_0x275f64={'count':0x0,'rows':[]};var _0x4b5ffe=_[_0xa905('0x34')](db['ZohoAccount'][_0xa905('0x35')],function(_0x182029){return{'name':_0x182029[_0xa905('0x36')],'type':_0x182029[_0xa905('0x37')][_0xa905('0x38')]};});_0x4ae643[_0xa905('0x39')]=_[_0xa905('0x34')](_0x4b5ffe,_0xa905('0x32'));_0x4ae643[_0xa905('0x3a')]=_[_0xa905('0x3b')](_0x2a9b86[_0xa905('0x3a')]);_0x4ae643['filters']=_[_0xa905('0x3c')](_0x4ae643[_0xa905('0x39')],_0x4ae643['query']);_0x226588[_0xa905('0x3d')]=_[_0xa905('0x3c')](_0x4ae643['model'],qs[_0xa905('0x3e')](_0x2a9b86[_0xa905('0x3a')]['fields']));_0x226588[_0xa905('0x3d')]=_0x226588['attributes'][_0xa905('0x3f')]?_0x226588[_0xa905('0x3d')]:_0x4ae643['model'];if(!_0x2a9b86[_0xa905('0x3a')]['hasOwnProperty'](_0xa905('0x40'))){_0x226588['limit']=qs[_0xa905('0x28')](_0x2a9b86[_0xa905('0x3a')][_0xa905('0x28')]);_0x226588[_0xa905('0x27')]=qs[_0xa905('0x27')](_0x2a9b86[_0xa905('0x3a')][_0xa905('0x27')]);}_0x226588[_0xa905('0x41')]=qs['sort'](_0x2a9b86[_0xa905('0x3a')][_0xa905('0x42')]);_0x226588['where']=qs[_0xa905('0x43')](_[_0xa905('0x44')](_0x2a9b86['query'],_0x4ae643[_0xa905('0x43')]),_0x4b5ffe);if(_0x2a9b86[_0xa905('0x3a')]['filter']){_0x226588[_0xa905('0x45')]=_[_0xa905('0x46')](_0x226588[_0xa905('0x45')],{'$or':_[_0xa905('0x34')](_0x4b5ffe,function(_0x2bb282){if(_0x2bb282[_0xa905('0x37')]!==_0xa905('0x47')){var _0x191205={};_0x191205[_0x2bb282[_0xa905('0x32')]]={'$like':'%'+_0x2a9b86[_0xa905('0x3a')][_0xa905('0x48')]+'%'};return _0x191205;}})});}_0x226588=_['merge']({},_0x226588,_0x2a9b86[_0xa905('0x49')]);var _0x55f030={'where':_0x226588['where']};return db[_0xa905('0x4a')]['count'](_0x55f030)[_0xa905('0x2e')](function(_0x5cd836){_0x275f64['count']=_0x5cd836;if(_0x2a9b86[_0xa905('0x3a')]['includeAll']){_0x226588[_0xa905('0x4b')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x226588);})['then'](function(_0x50d120){_0x275f64[_0xa905('0x4c')]=_0x50d120;return _0x275f64;})[_0xa905('0x2e')](respondWithFilteredResult(_0x5465a6,_0x226588))[_0xa905('0x22')](handleError(_0x5465a6,null));};exports[_0xa905('0x4d')]=function(_0x5c9e8a,_0x3ff89f){var _0x5d3f29={'raw':![],'where':{'id':_0x5c9e8a[_0xa905('0x4e')]['id']}},_0x5f219c={};_0x5f219c[_0xa905('0x39')]=_[_0xa905('0x3b')](db[_0xa905('0x4a')][_0xa905('0x35')]);_0x5f219c[_0xa905('0x3a')]=_[_0xa905('0x3b')](_0x5c9e8a[_0xa905('0x3a')]);_0x5f219c[_0xa905('0x43')]=_[_0xa905('0x3c')](_0x5f219c[_0xa905('0x39')],_0x5f219c[_0xa905('0x3a')]);_0x5d3f29[_0xa905('0x3d')]=_[_0xa905('0x3c')](_0x5f219c[_0xa905('0x39')],qs[_0xa905('0x3e')](_0x5c9e8a[_0xa905('0x3a')][_0xa905('0x3e')]));_0x5d3f29[_0xa905('0x3d')]=_0x5d3f29[_0xa905('0x3d')][_0xa905('0x3f')]?_0x5d3f29[_0xa905('0x3d')]:_0x5f219c[_0xa905('0x39')];if(_0x5c9e8a[_0xa905('0x3a')]['includeAll']){_0x5d3f29[_0xa905('0x4b')]=[{'all':!![]}];}_0x5d3f29=_[_0xa905('0x46')]({},_0x5d3f29,_0x5c9e8a['options']);return db['ZohoAccount'][_0xa905('0x4f')](_0x5d3f29)[_0xa905('0x2e')](handleEntityNotFound(_0x3ff89f,null))[_0xa905('0x2e')](respondWithResult(_0x3ff89f,null))[_0xa905('0x22')](handleError(_0x3ff89f,null));};exports[_0xa905('0x50')]=function(_0xac85e5,_0x53560d){return db[_0xa905('0x4a')][_0xa905('0x50')](_0xac85e5['body'],{})[_0xa905('0x2e')](respondWithResult(_0x53560d,0xc9))[_0xa905('0x22')](handleError(_0x53560d,null));};exports[_0xa905('0x2d')]=function(_0x364401,_0x5f3fc9){if(_0x364401[_0xa905('0x51')]['id']){delete _0x364401[_0xa905('0x51')]['id'];}return db[_0xa905('0x4a')]['find']({'where':{'id':_0x364401[_0xa905('0x4e')]['id']}})[_0xa905('0x2e')](handleEntityNotFound(_0x5f3fc9,null))[_0xa905('0x2e')](saveUpdates(_0x364401[_0xa905('0x51')],null))[_0xa905('0x2e')](respondWithResult(_0x5f3fc9,null))[_0xa905('0x22')](handleError(_0x5f3fc9,null));};exports[_0xa905('0x2f')]=function(_0x45191c,_0x378585){return db[_0xa905('0x4a')]['find']({'where':{'id':_0x45191c['params']['id']}})['then'](handleEntityNotFound(_0x378585,null))[_0xa905('0x2e')](removeEntity(_0x378585,null))[_0xa905('0x22')](handleError(_0x378585,null));};exports[_0xa905('0x52')]=function(_0x11e3a1,_0xe26e07,_0x2ba305){var _0x3b3d17={};var _0x27f8ce={};var _0x4e806c;var _0x325b37;return db['ZohoAccount']['findOne']({'where':{'id':_0x11e3a1[_0xa905('0x4e')]['id']}})[_0xa905('0x2e')](handleEntityNotFound(_0xe26e07,null))[_0xa905('0x2e')](function(_0x1c7ef2){if(_0x1c7ef2){_0x4e806c=_0x1c7ef2;_0x27f8ce[_0xa905('0x39')]=_['keys'](db[_0xa905('0x53')]['rawAttributes']);_0x27f8ce[_0xa905('0x3a')]=_[_0xa905('0x3b')](_0x11e3a1['query']);_0x27f8ce[_0xa905('0x43')]=_[_0xa905('0x3c')](_0x27f8ce[_0xa905('0x39')],_0x27f8ce[_0xa905('0x3a')]);_0x3b3d17[_0xa905('0x3d')]=_[_0xa905('0x3c')](_0x27f8ce['model'],qs[_0xa905('0x3e')](_0x11e3a1['query'][_0xa905('0x3e')]));_0x3b3d17['attributes']=_0x3b3d17[_0xa905('0x3d')][_0xa905('0x3f')]?_0x3b3d17['attributes']:_0x27f8ce['model'];_0x3b3d17[_0xa905('0x41')]=qs['sort'](_0x11e3a1['query'][_0xa905('0x42')]);_0x3b3d17['where']=qs[_0xa905('0x43')](_['pick'](_0x11e3a1['query'],_0x27f8ce[_0xa905('0x43')]));if(_0x11e3a1[_0xa905('0x3a')][_0xa905('0x48')]){_0x3b3d17[_0xa905('0x45')]=_[_0xa905('0x46')](_0x3b3d17[_0xa905('0x45')],{'$or':_[_0xa905('0x34')](_0x3b3d17['attributes'],function(_0x33b5cd){var _0x3e5339={};_0x3e5339[_0x33b5cd]={'$like':'%'+_0x11e3a1[_0xa905('0x3a')][_0xa905('0x48')]+'%'};return _0x3e5339;})});}_0x3b3d17=_[_0xa905('0x46')]({},_0x3b3d17,_0x11e3a1[_0xa905('0x49')]);return _0x4e806c[_0xa905('0x52')](_0x3b3d17);}})[_0xa905('0x2e')](function(_0x1b6173){if(_0x1b6173){_0x325b37=_0x1b6173[_0xa905('0x3f')];if(!_0x11e3a1[_0xa905('0x3a')][_0xa905('0x54')](_0xa905('0x40'))){_0x3b3d17[_0xa905('0x28')]=qs['limit'](_0x11e3a1['query'][_0xa905('0x28')]);_0x3b3d17['offset']=qs[_0xa905('0x27')](_0x11e3a1[_0xa905('0x3a')]['offset']);}return _0x4e806c[_0xa905('0x52')](_0x3b3d17);}})[_0xa905('0x2e')](function(_0x5c48c0){if(_0x5c48c0){return _0x5c48c0?{'count':_0x325b37,'rows':_0x5c48c0}:null;}})[_0xa905('0x2e')](respondWithResult(_0xe26e07,null))[_0xa905('0x22')](handleError(_0xe26e07,null));};exports['addConfiguration']=function(_0xc58416,_0x4bee36,_0x48142e){if(_0xc58416['body']['id']){delete _0xc58416[_0xa905('0x51')]['id'];}return db['ZohoAccount'][_0xa905('0x55')]({'where':{'id':_0xc58416['params']['id']}})[_0xa905('0x2e')](handleEntityNotFound(_0x4bee36,null))[_0xa905('0x2e')](function(_0x2c8875){if(_0x2c8875){_0xc58416['body'][_0xa905('0x56')]=_0x2c8875['id'];_0xc58416[_0xa905('0x51')][_0xa905('0x57')]=integrations[_0xa905('0x58')](_0xc58416[_0xa905('0x51')][_0xa905('0x59')],_0xc58416[_0xa905('0x51')][_0xa905('0x37')]);_0xc58416[_0xa905('0x51')][_0xa905('0x5a')]=integrations[_0xa905('0x5b')](_0xc58416['body'][_0xa905('0x59')],_0xc58416['body']['type']);return db['ZohoConfiguration'][_0xa905('0x50')](_0xc58416[_0xa905('0x51')],{'include':[{'model':db[_0xa905('0x5c')],'as':_0xa905('0x57')},{'model':db['ZohoField'],'as':_0xa905('0x5a')}]});}return null;})[_0xa905('0x2e')](respondWithResult(_0x4bee36,null))[_0xa905('0x22')](handleError(_0x4bee36,null));};function getAccessToken(_0x495a17){return new Promise(function(_0x2f202d,_0x1c4dbd){var _0x59d7e2;switch(_0x495a17['zone']){case'US':_0x59d7e2=_0xa905('0x5d');break;case'AU':_0x59d7e2=_0xa905('0x5e');break;case'EU':_0x59d7e2=_0xa905('0x5f');break;case'IN':_0x59d7e2='https://accounts.zoho.in';break;case'CN':_0x59d7e2=_0xa905('0x60');break;default:_0x59d7e2=_0xa905('0x5f');break;}var _0x4abc12={'method':_0xa905('0x61'),'uri':_0x59d7e2+_0xa905('0x62'),'qs':{'refresh_token':_0x495a17[_0xa905('0x63')],'client_id':_0x495a17[_0xa905('0x64')],'client_secret':_0x495a17[_0xa905('0x65')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4abc12)[_0xa905('0x2e')](function(_0x1c9f30){if(_0x1c9f30[_0xa905('0x66')]){_0x2f202d(_0x1c9f30[_0xa905('0x66')]);}else{_0x1c4dbd(_0xa905('0x67'));}})[_0xa905('0x22')](function(_0x4b8582){_0x1c4dbd(_0x4b8582);});});}exports[_0xa905('0x68')]=function(_0x314390,_0x46ef12,_0x3e3616){var _0x411bfc,_0x376efe,_0x527503,_0x512c57,_0x187997;return db[_0xa905('0x4a')][_0xa905('0x55')]({'where':{'id':_0x314390['params']['id']},'attributes':['id',_0xa905('0x69'),'zone','clientId','clientSecret',_0xa905('0x6a'),_0xa905('0x1f'),_0xa905('0x63')]})['then'](handleEntityNotFound(_0x46ef12,null))['then'](function(_0x5654d0){_0x187997=_0x5654d0;_0x411bfc=_0x187997['host'];_0x376efe=_0x411bfc==='zoho.eu'?'eu':'com';_0x527503=_0x187997['serverUrl'];var _0x31f841=_0x527503[_0xa905('0x6b')](-0x1);if(_0x31f841==='/'||_0x31f841==='\x5c'||_0x31f841===':'){_0x527503=_0x527503['substring'](0x0,_0x527503['lastIndexOf'](_0x31f841));}if(!_0x187997[_0xa905('0x63')]){throw new Error(_0xa905('0x6c'));}return getAccessToken(_0x187997);})[_0xa905('0x2e')](function(_0xd3d191){if(_0xd3d191){return rp({'method':'GET','uri':util[_0xa905('0x6d')](_0xa905('0x6e'),_0x376efe),'qs':{'module':_0xa905('0x6f')},'headers':{'Authorization':_0xa905('0x70')+_0xd3d191},'json':!![]});}})[_0xa905('0x2e')](function(_0x25df91){if(_0x25df91){if(_0x25df91[_0xa905('0x71')]&&_0x25df91[_0xa905('0x71')][_0xa905('0x1e')]){throw new Error(_0x25df91['response']['error'][_0xa905('0x20')]);}var _0x118459=[];var _0x242270=[];var _0x37f82c=[_0xa905('0x72'),_0xa905('0x73'),_0xa905('0x74'),_0xa905('0x75'),'Call_Duration',_0xa905('0x76'),_0xa905('0x77'),_0xa905('0x78')];_0x242270=_[_0xa905('0x79')](_0x25df91['fields'],function(_0x38e1c8){return _0x37f82c[_0xa905('0x7a')](_0x38e1c8[_0xa905('0x7b')]);});for(var _0xcbb6b5=0x0;_0xcbb6b5<_0x242270['length'];_0xcbb6b5++){if(_0x242270[_0xcbb6b5][_0xa905('0x7c')]===![]){_0x118459[_0xa905('0x7d')]({'id':_0x242270[_0xcbb6b5]['id'],'name':_0x242270[_0xcbb6b5][_0xa905('0x7e')],'custom':_0x242270[_0xcbb6b5][_0xa905('0x7f')],'options':_0x242270[_0xcbb6b5][_0xa905('0x80')]===_0xa905('0x81')&&_0x242270[_0xcbb6b5][_0xa905('0x82')]['length']>-0x1?_['map'](_0x242270[_0xcbb6b5][_0xa905('0x82')],function(_0x5ad7eb){return{'name':_0x5ad7eb,'value':_0x5ad7eb};}):[]});}}return{'count':_0x118459[_0xa905('0x3f')],'rows':_0x118459};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x46ef12,null))[_0xa905('0x22')](function(_0x2a9876){var _0x836797=_0x314390[_0xa905('0x3a')]['test']?0x1f4:_0x2a9876[_0xa905('0x83')]||0x1f4;logger[_0xa905('0x1e')](_0xa905('0x84'),_0xa905('0x68'),_0x836797,JSON['stringify'](_0x2a9876));delete _0x2a9876[_0xa905('0x32')];if(_0x836797===0x191){_0x836797=0x190;}_0x46ef12[_0xa905('0x23')](_0x836797)[_0xa905('0x85')](_0x314390[_0xa905('0x3a')][_0xa905('0x86')]?{'message':_0xa905('0x87'),'statusCode':_0x2a9876['statusCode']}:_0x2a9876);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 5c542ec..cdd20f0 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 _0x92a0=['./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_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','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','https://accounts.zoho.in','POST','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5cf940,_0x28a7de){var _0x2535e8=function(_0xb478db){while(--_0xb478db){_0x5cf940['push'](_0x5cf940['shift']());}};_0x2535e8(++_0x28a7de);}(_0x92a0,0x10b));var _0x092a=function(_0x1977c2,_0x19446a){_0x1977c2=_0x1977c2-0x0;var _0x1f591c=_0x92a0[_0x1977c2];return _0x1f591c;};'use strict';var _=require(_0x092a('0x0'));var util=require(_0x092a('0x1'));var logger=require(_0x092a('0x2'))(_0x092a('0x3'));var moment=require('moment');var BPromise=require(_0x092a('0x4'));var rp=require(_0x092a('0x5'));var fs=require('fs');var path=require(_0x092a('0x6'));var rimraf=require(_0x092a('0x7'));var config=require(_0x092a('0x8'));var attributes=require(_0x092a('0x9'));var integrations=require(_0x092a('0xa'));module[_0x092a('0xb')]=function(_0x45890d,_0x3c80f5){return _0x45890d[_0x092a('0xc')](_0x092a('0xd'),attributes,{'tableName':_0x092a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x59e646,_0x108e5a,_0x4a2ae4){if(_0x59e646[_0x092a('0xf')](_0x092a('0x10'))||_0x59e646['changed'](_0x092a('0x11'))||_0x59e646['changed'](_0x092a('0x12'))||_0x59e646['changed'](_0x092a('0x13'))||_0x59e646[_0x092a('0xf')](_0x092a('0x14'))||_0x59e646[_0x092a('0xf')](_0x092a('0x15'))){var _0x3fd5e1,_0x455292;_0x3fd5e1=_0x59e646['serverUrl'];var _0x572ba2=_0x3fd5e1[_0x092a('0x16')](-0x1);if(_0x572ba2==='/'||_0x572ba2==='\x5c'||_0x572ba2===':'){_0x3fd5e1=_0x3fd5e1[_0x092a('0x17')](0x0,_0x3fd5e1[_0x092a('0x18')](_0x572ba2));}switch(_0x59e646[_0x092a('0x10')]){case'US':_0x455292=_0x092a('0x19');break;case'AU':_0x455292=_0x092a('0x1a');break;case'IN':_0x455292='https://accounts.zoho.in';break;case'CN':_0x455292=_0x092a('0x1b');break;default:_0x455292=_0x092a('0x1c');break;}var _0x9da015={'method':'POST','uri':_0x455292+_0x092a('0x1d'),'form':{'grant_type':_0x092a('0x1e'),'client_id':_0x59e646[_0x092a('0x12')],'client_secret':_0x59e646[_0x092a('0x13')],'redirect_uri':_0x59e646['serverUrl'],'code':_0x59e646['code']},'headers':{'Content-Type':_0x092a('0x1f')}};return rp(_0x9da015)[_0x092a('0x20')](function(_0x5f4fe0){var _0x3b269d=JSON[_0x092a('0x21')](_0x5f4fe0);if(_0x3b269d[_0x092a('0x22')]){_0x59e646[_0x092a('0x23')]=_0x3b269d[_0x092a('0x22')];logger[_0x092a('0x24')](util[_0x092a('0x25')](_0x092a('0x26'),_0x59e646['name'],_0x59e646['id']));}else{logger[_0x092a('0x27')](util[_0x092a('0x25')](_0x092a('0x28'),_0x59e646[_0x092a('0x29')],_0x59e646['id']),util[_0x092a('0x2a')](_0x3b269d,{'showHidden':![],'depth':null}));}return _0x4a2ae4(null,_0x108e5a);})[_0x092a('0x2b')](function(_0x30bfd){logger[_0x092a('0x27')](util[_0x092a('0x25')](_0x092a('0x28'),_0x59e646[_0x092a('0x29')],_0x59e646['id']),util[_0x092a('0x2a')](parsedResult,{'showHidden':![],'depth':null}));return _0x4a2ae4(_0x30bfd);});}else{return _0x4a2ae4(null,_0x108e5a);}},'beforeUpdate':function(_0x4125fc,_0x27910d,_0x555fa5){if(_0x4125fc[_0x092a('0xf')](_0x092a('0x10'))||_0x4125fc[_0x092a('0xf')](_0x092a('0x11'))||_0x4125fc[_0x092a('0xf')](_0x092a('0x12'))||_0x4125fc['changed'](_0x092a('0x13'))||_0x4125fc[_0x092a('0xf')](_0x092a('0x14'))||_0x4125fc[_0x092a('0xf')](_0x092a('0x15'))){var _0x583fab,_0x1f0f4b;_0x583fab=_0x4125fc[_0x092a('0x11')];var _0x319039=_0x583fab['slice'](-0x1);if(_0x319039==='/'||_0x319039==='\x5c'||_0x319039===':'){_0x583fab=_0x583fab['substring'](0x0,_0x583fab[_0x092a('0x18')](_0x319039));}switch(_0x4125fc[_0x092a('0x10')]){case'US':_0x1f0f4b='https://accounts.zoho.com';break;case'AU':_0x1f0f4b=_0x092a('0x1a');break;case'IN':_0x1f0f4b=_0x092a('0x2c');break;case'CN':_0x1f0f4b=_0x092a('0x1b');break;default:_0x1f0f4b=_0x092a('0x1c');break;}var _0x5793d8={'method':_0x092a('0x2d'),'uri':_0x1f0f4b+_0x092a('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x4125fc[_0x092a('0x12')],'client_secret':_0x4125fc[_0x092a('0x13')],'redirect_uri':_0x4125fc[_0x092a('0x11')],'code':_0x4125fc[_0x092a('0x14')]},'headers':{'Content-Type':_0x092a('0x1f')}};return rp(_0x5793d8)[_0x092a('0x20')](function(_0x1d4ced){var _0xedfa8=JSON[_0x092a('0x21')](_0x1d4ced);if(_0xedfa8[_0x092a('0x22')]){_0x4125fc[_0x092a('0x23')]=_0xedfa8[_0x092a('0x22')];logger[_0x092a('0x24')](util['format'](_0x092a('0x26'),_0x4125fc[_0x092a('0x29')],_0x4125fc['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4125fc[_0x092a('0x29')],_0x4125fc['id']),util[_0x092a('0x2a')](_0xedfa8,{'showHidden':![],'depth':null}));}return _0x555fa5(null,_0x27910d);})['catch'](function(_0x2e5362){logger[_0x092a('0x27')](util['format'](_0x092a('0x28'),_0x4125fc['name'],_0x4125fc['id']),util[_0x092a('0x2a')](parsedResult,{'showHidden':![],'depth':null}));return _0x555fa5(_0x2e5362);});}else{return _0x555fa5(null,_0x27910d);}}}});}; \ No newline at end of file +var _0xc082=['clientId','clientSecret','code','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','changed','serverUrl'];(function(_0x63c794,_0x14f52c){var _0x16f319=function(_0x149940){while(--_0x149940){_0x63c794['push'](_0x63c794['shift']());}};_0x16f319(++_0x14f52c);}(_0xc082,0xfe));var _0x2c08=function(_0x54b977,_0x4a98e4){_0x54b977=_0x54b977-0x0;var _0x48d8e9=_0xc082[_0x54b977];return _0x48d8e9;};'use strict';var _=require('lodash');var util=require(_0x2c08('0x0'));var logger=require(_0x2c08('0x1'))(_0x2c08('0x2'));var moment=require('moment');var BPromise=require(_0x2c08('0x3'));var rp=require(_0x2c08('0x4'));var fs=require('fs');var path=require(_0x2c08('0x5'));var rimraf=require(_0x2c08('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x2c08('0x7'));module['exports']=function(_0x5b89bc,_0x29c8b1){return _0x5b89bc['define'](_0x2c08('0x8'),attributes,{'tableName':_0x2c08('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x198dcd,_0x53ecbb,_0xee8af5){if(_0x198dcd[_0x2c08('0xa')]('zone')||_0x198dcd[_0x2c08('0xa')](_0x2c08('0xb'))||_0x198dcd['changed'](_0x2c08('0xc'))||_0x198dcd[_0x2c08('0xa')](_0x2c08('0xd'))||_0x198dcd[_0x2c08('0xa')](_0x2c08('0xe'))||_0x198dcd['changed']('host')){var _0x113363,_0x2ba11d;_0x113363=_0x198dcd[_0x2c08('0xb')];var _0x13807d=_0x113363[_0x2c08('0xf')](-0x1);if(_0x13807d==='/'||_0x13807d==='\x5c'||_0x13807d===':'){_0x113363=_0x113363[_0x2c08('0x10')](0x0,_0x113363[_0x2c08('0x11')](_0x13807d));}switch(_0x198dcd[_0x2c08('0x12')]){case'US':_0x2ba11d=_0x2c08('0x13');break;case'AU':_0x2ba11d=_0x2c08('0x14');break;case'IN':_0x2ba11d=_0x2c08('0x15');break;case'CN':_0x2ba11d=_0x2c08('0x16');break;default:_0x2ba11d=_0x2c08('0x17');break;}var _0x4781c7={'method':_0x2c08('0x18'),'uri':_0x2ba11d+_0x2c08('0x19'),'form':{'grant_type':_0x2c08('0x1a'),'client_id':_0x198dcd[_0x2c08('0xc')],'client_secret':_0x198dcd[_0x2c08('0xd')],'redirect_uri':_0x198dcd[_0x2c08('0xb')],'code':_0x198dcd[_0x2c08('0xe')]},'headers':{'Content-Type':_0x2c08('0x1b')}};return rp(_0x4781c7)[_0x2c08('0x1c')](function(_0x42d6ef){var _0x5faab2=JSON[_0x2c08('0x1d')](_0x42d6ef);if(_0x5faab2['refresh_token']){_0x198dcd[_0x2c08('0x1e')]=_0x5faab2[_0x2c08('0x1f')];logger[_0x2c08('0x20')](util[_0x2c08('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x198dcd[_0x2c08('0x22')],_0x198dcd['id']));}else{logger[_0x2c08('0x23')](util[_0x2c08('0x21')](_0x2c08('0x24'),_0x198dcd[_0x2c08('0x22')],_0x198dcd['id']),util[_0x2c08('0x25')](_0x5faab2,{'showHidden':![],'depth':null}));}return _0xee8af5(null,_0x53ecbb);})['catch'](function(_0x36ef27){logger[_0x2c08('0x23')](util['format'](_0x2c08('0x24'),_0x198dcd[_0x2c08('0x22')],_0x198dcd['id']),util[_0x2c08('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0xee8af5(_0x36ef27);});}else{return _0xee8af5(null,_0x53ecbb);}},'beforeUpdate':function(_0x49e756,_0xfe13ff,_0x2c7164){if(_0x49e756['changed'](_0x2c08('0x12'))||_0x49e756[_0x2c08('0xa')]('serverUrl')||_0x49e756[_0x2c08('0xa')](_0x2c08('0xc'))||_0x49e756[_0x2c08('0xa')](_0x2c08('0xd'))||_0x49e756[_0x2c08('0xa')](_0x2c08('0xe'))||_0x49e756['changed']('host')){var _0x822845,_0x1a1987;_0x822845=_0x49e756['serverUrl'];var _0x188eef=_0x822845['slice'](-0x1);if(_0x188eef==='/'||_0x188eef==='\x5c'||_0x188eef===':'){_0x822845=_0x822845[_0x2c08('0x10')](0x0,_0x822845[_0x2c08('0x11')](_0x188eef));}switch(_0x49e756['zone']){case'US':_0x1a1987=_0x2c08('0x13');break;case'AU':_0x1a1987=_0x2c08('0x14');break;case'IN':_0x1a1987=_0x2c08('0x15');break;case'CN':_0x1a1987=_0x2c08('0x16');break;default:_0x1a1987=_0x2c08('0x17');break;}var _0x38d850={'method':_0x2c08('0x18'),'uri':_0x1a1987+_0x2c08('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x49e756[_0x2c08('0xc')],'client_secret':_0x49e756[_0x2c08('0xd')],'redirect_uri':_0x49e756[_0x2c08('0xb')],'code':_0x49e756[_0x2c08('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x38d850)['then'](function(_0x5d430a){var _0x195f4e=JSON[_0x2c08('0x1d')](_0x5d430a);if(_0x195f4e[_0x2c08('0x1f')]){_0x49e756['refreshToken']=_0x195f4e[_0x2c08('0x1f')];logger[_0x2c08('0x20')](util[_0x2c08('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x49e756[_0x2c08('0x22')],_0x49e756['id']));}else{logger[_0x2c08('0x23')](util[_0x2c08('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x49e756[_0x2c08('0x22')],_0x49e756['id']),util[_0x2c08('0x25')](_0x195f4e,{'showHidden':![],'depth':null}));}return _0x2c7164(null,_0xfe13ff);})['catch'](function(_0x36ea3b){logger['error'](util[_0x2c08('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x49e756[_0x2c08('0x22')],_0x49e756['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2c7164(_0x36ea3b);});}else{return _0x2c7164(null,_0xfe13ff);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index bd84129..30cad99 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 _0x4016=['catch','GetZohoAccount','findAll','options','raw','where','attributes','include','map','model','debug','stringify','ShowZohoAccount','ZohoAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x1f3135,_0x2c5097){var _0x48f9a1=function(_0x36f5b3){while(--_0x36f5b3){_0x1f3135['push'](_0x1f3135['shift']());}};_0x48f9a1(++_0x2c5097);}(_0x4016,0x1a2));var _0x6401=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4016[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x6401('0x0'));var moment=require(_0x6401('0x1'));var BPromise=require(_0x6401('0x2'));var rs=require(_0x6401('0x3'));var fs=require('fs');var Redis=require(_0x6401('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6401('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6401('0x6'));var client=jayson['client'][_0x6401('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x20f62a,_0x2fbe74,_0x51fd86){return new BPromise(function(_0x5f4179,_0x2f7051){return client[_0x6401('0x8')](_0x20f62a,_0x51fd86)[_0x6401('0x9')](function(_0x54e537){logger[_0x6401('0xa')](_0x6401('0xb'),_0x2fbe74,_0x6401('0xc'));logger['debug'](_0x6401('0xd'),_0x2fbe74,'request\x20sent',JSON['stringify'](_0x54e537));if(_0x54e537['error']){if(_0x54e537['error']['code']===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x2fbe74,_0x54e537[_0x6401('0xe')][_0x6401('0xf')]);return _0x2f7051(_0x54e537[_0x6401('0xe')][_0x6401('0xf')]);}logger[_0x6401('0xe')](_0x6401('0xb'),_0x2fbe74,_0x54e537[_0x6401('0xe')][_0x6401('0xf')]);return _0x5f4179(_0x54e537['error'][_0x6401('0xf')]);}else{logger[_0x6401('0xa')](_0x6401('0xb'),_0x2fbe74,_0x6401('0xc'));_0x5f4179(_0x54e537['result'][_0x6401('0xf')]);}})[_0x6401('0x10')](function(_0x5b2039){logger[_0x6401('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x2fbe74,_0x5b2039);_0x2f7051(_0x5b2039);});});}exports[_0x6401('0x11')]=function(_0x58466a){var _0x5826c5=this;return new Promise(function(_0x16a7a6,_0x14f551){return db['ZohoAccount'][_0x6401('0x12')]({'raw':_0x58466a[_0x6401('0x13')]?_0x58466a[_0x6401('0x13')][_0x6401('0x14')]===undefined?!![]:![]:!![],'where':_0x58466a['options']?_0x58466a[_0x6401('0x13')][_0x6401('0x15')]||null:null,'attributes':_0x58466a[_0x6401('0x13')]?_0x58466a[_0x6401('0x13')][_0x6401('0x16')]||null:null,'limit':_0x58466a[_0x6401('0x13')]?_0x58466a[_0x6401('0x13')]['limit']||null:null,'include':_0x58466a[_0x6401('0x13')]?_0x58466a[_0x6401('0x13')][_0x6401('0x17')]?_[_0x6401('0x18')](_0x58466a[_0x6401('0x13')][_0x6401('0x17')],function(_0x1e58cd){return{'model':db[_0x1e58cd[_0x6401('0x19')]],'as':_0x1e58cd['as'],'attributes':_0x1e58cd[_0x6401('0x16')],'include':_0x1e58cd[_0x6401('0x17')]?_['map'](_0x1e58cd[_0x6401('0x17')],function(_0x462771){return{'model':db[_0x462771[_0x6401('0x19')]],'as':_0x462771['as'],'attributes':_0x462771[_0x6401('0x16')],'include':_0x462771[_0x6401('0x17')]?_[_0x6401('0x18')](_0x462771[_0x6401('0x17')],function(_0x261640){return{'model':db[_0x261640[_0x6401('0x19')]],'as':_0x261640['as'],'attributes':_0x261640[_0x6401('0x16')]};}):[]};}):[]};}):[]:[]})[_0x6401('0x9')](function(_0x1655dc){logger[_0x6401('0xa')](_0x6401('0x11'),_0x58466a);logger[_0x6401('0x1a')]('GetZohoAccount',_0x58466a,JSON[_0x6401('0x1b')](_0x1655dc));_0x16a7a6(_0x1655dc);})[_0x6401('0x10')](function(_0x66419d){logger[_0x6401('0xe')]('GetZohoAccount',_0x66419d[_0x6401('0xf')],_0x58466a);_0x14f551(_0x5826c5['error'](0x1f4,_0x66419d[_0x6401('0xf')]));});});};exports[_0x6401('0x1c')]=function(_0x190894){var _0x553254=this;return new Promise(function(_0xc8911f,_0x3cf07f){return db[_0x6401('0x1d')][_0x6401('0x1e')]({'raw':_0x190894['options']?_0x190894[_0x6401('0x13')][_0x6401('0x14')]===undefined?!![]:![]:!![],'where':_0x190894['options']?_0x190894[_0x6401('0x13')][_0x6401('0x15')]||null:null,'attributes':_0x190894['options']?_0x190894[_0x6401('0x13')][_0x6401('0x16')]||null:null,'include':_0x190894[_0x6401('0x13')]?_0x190894[_0x6401('0x13')][_0x6401('0x17')]?_[_0x6401('0x18')](_0x190894['options'][_0x6401('0x17')],function(_0x5501d9){return{'model':db[_0x5501d9['model']],'as':_0x5501d9['as'],'attributes':_0x5501d9[_0x6401('0x16')],'include':_0x5501d9[_0x6401('0x17')]?_[_0x6401('0x18')](_0x5501d9[_0x6401('0x17')],function(_0x5743e8){return{'model':db[_0x5743e8['model']],'as':_0x5743e8['as'],'attributes':_0x5743e8[_0x6401('0x16')],'include':_0x5743e8['include']?_[_0x6401('0x18')](_0x5743e8['include'],function(_0x1aff5e){return{'model':db[_0x1aff5e[_0x6401('0x19')]],'as':_0x1aff5e['as'],'attributes':_0x1aff5e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6401('0x9')](function(_0x2e98bb){logger['info'](_0x6401('0x1c'),_0x190894);logger[_0x6401('0x1a')](_0x6401('0x1c'),_0x190894,JSON[_0x6401('0x1b')](_0x2e98bb));_0xc8911f(_0x2e98bb);})['catch'](function(_0xd4a1e3){logger['error'](_0x6401('0x1c'),_0xd4a1e3[_0x6401('0xf')],_0x190894);_0x3cf07f(_0x553254[_0x6401('0xe')](0x1f4,_0xd4a1e3['message']));});});}; \ No newline at end of file +var _0x3f74=['ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetZohoAccount','find'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3f74,0x121));var _0x43f7=function(_0x268882,_0xc8f590){_0x268882=_0x268882-0x0;var _0x2548d8=_0x3f74[_0x268882];return _0x2548d8;};'use strict';var _=require(_0x43f7('0x0'));var util=require(_0x43f7('0x1'));var moment=require(_0x43f7('0x2'));var BPromise=require(_0x43f7('0x3'));var rs=require(_0x43f7('0x4'));var fs=require('fs');var Redis=require(_0x43f7('0x5'));var db=require(_0x43f7('0x6'))['db'];var utils=require(_0x43f7('0x7'));var logger=require('../../config/logger')(_0x43f7('0x8'));var config=require(_0x43f7('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x43f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f64a6,_0x1998e3,_0x574b8a){return new BPromise(function(_0x115f89,_0x65bccb){return client[_0x43f7('0xb')](_0x4f64a6,_0x574b8a)[_0x43f7('0xc')](function(_0x452e91){logger['info'](_0x43f7('0xd'),_0x1998e3,'request\x20sent');logger[_0x43f7('0xe')](_0x43f7('0xf'),_0x1998e3,'request\x20sent',JSON[_0x43f7('0x10')](_0x452e91));if(_0x452e91[_0x43f7('0x11')]){if(_0x452e91[_0x43f7('0x11')]['code']===0x1f4){logger[_0x43f7('0x11')](_0x43f7('0xd'),_0x1998e3,_0x452e91[_0x43f7('0x11')][_0x43f7('0x12')]);return _0x65bccb(_0x452e91[_0x43f7('0x11')][_0x43f7('0x12')]);}logger[_0x43f7('0x11')](_0x43f7('0xd'),_0x1998e3,_0x452e91[_0x43f7('0x11')][_0x43f7('0x12')]);return _0x115f89(_0x452e91[_0x43f7('0x11')][_0x43f7('0x12')]);}else{logger[_0x43f7('0x13')](_0x43f7('0xd'),_0x1998e3,_0x43f7('0x14'));_0x115f89(_0x452e91[_0x43f7('0x15')][_0x43f7('0x12')]);}})[_0x43f7('0x16')](function(_0x5ba55e){logger[_0x43f7('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x1998e3,_0x5ba55e);_0x65bccb(_0x5ba55e);});});}exports['GetZohoAccount']=function(_0x3d8571){var _0x5ce4ed=this;return new Promise(function(_0x44380f,_0x8c976a){return db[_0x43f7('0x17')][_0x43f7('0x18')]({'raw':_0x3d8571[_0x43f7('0x19')]?_0x3d8571['options'][_0x43f7('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d8571[_0x43f7('0x19')]?_0x3d8571['options'][_0x43f7('0x1b')]||null:null,'attributes':_0x3d8571['options']?_0x3d8571[_0x43f7('0x19')][_0x43f7('0x1c')]||null:null,'limit':_0x3d8571[_0x43f7('0x19')]?_0x3d8571[_0x43f7('0x19')][_0x43f7('0x1d')]||null:null,'include':_0x3d8571[_0x43f7('0x19')]?_0x3d8571[_0x43f7('0x19')][_0x43f7('0x1e')]?_[_0x43f7('0x1f')](_0x3d8571[_0x43f7('0x19')][_0x43f7('0x1e')],function(_0x4e6e98){return{'model':db[_0x4e6e98[_0x43f7('0x20')]],'as':_0x4e6e98['as'],'attributes':_0x4e6e98[_0x43f7('0x1c')],'include':_0x4e6e98[_0x43f7('0x1e')]?_[_0x43f7('0x1f')](_0x4e6e98['include'],function(_0x2d7b3a){return{'model':db[_0x2d7b3a['model']],'as':_0x2d7b3a['as'],'attributes':_0x2d7b3a[_0x43f7('0x1c')],'include':_0x2d7b3a[_0x43f7('0x1e')]?_[_0x43f7('0x1f')](_0x2d7b3a[_0x43f7('0x1e')],function(_0x339775){return{'model':db[_0x339775[_0x43f7('0x20')]],'as':_0x339775['as'],'attributes':_0x339775[_0x43f7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x43f7('0xc')](function(_0x1d3ee5){logger[_0x43f7('0x13')](_0x43f7('0x21'),_0x3d8571);logger[_0x43f7('0xe')]('GetZohoAccount',_0x3d8571,JSON[_0x43f7('0x10')](_0x1d3ee5));_0x44380f(_0x1d3ee5);})[_0x43f7('0x16')](function(_0x16f48c){logger[_0x43f7('0x11')](_0x43f7('0x21'),_0x16f48c['message'],_0x3d8571);_0x8c976a(_0x5ce4ed[_0x43f7('0x11')](0x1f4,_0x16f48c['message']));});});};exports['ShowZohoAccount']=function(_0xb0f888){var _0x1b9ca5=this;return new Promise(function(_0x5dd95a,_0x490561){return db[_0x43f7('0x17')][_0x43f7('0x22')]({'raw':_0xb0f888[_0x43f7('0x19')]?_0xb0f888[_0x43f7('0x19')][_0x43f7('0x1a')]===undefined?!![]:![]:!![],'where':_0xb0f888[_0x43f7('0x19')]?_0xb0f888[_0x43f7('0x19')]['where']||null:null,'attributes':_0xb0f888[_0x43f7('0x19')]?_0xb0f888[_0x43f7('0x19')][_0x43f7('0x1c')]||null:null,'include':_0xb0f888[_0x43f7('0x19')]?_0xb0f888[_0x43f7('0x19')][_0x43f7('0x1e')]?_['map'](_0xb0f888[_0x43f7('0x19')][_0x43f7('0x1e')],function(_0x3fab91){return{'model':db[_0x3fab91[_0x43f7('0x20')]],'as':_0x3fab91['as'],'attributes':_0x3fab91[_0x43f7('0x1c')],'include':_0x3fab91[_0x43f7('0x1e')]?_[_0x43f7('0x1f')](_0x3fab91['include'],function(_0x25c521){return{'model':db[_0x25c521[_0x43f7('0x20')]],'as':_0x25c521['as'],'attributes':_0x25c521['attributes'],'include':_0x25c521['include']?_['map'](_0x25c521[_0x43f7('0x1e')],function(_0x4c48ad){return{'model':db[_0x4c48ad[_0x43f7('0x20')]],'as':_0x4c48ad['as'],'attributes':_0x4c48ad[_0x43f7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x43f7('0xc')](function(_0x38e52a){logger['info'](_0x43f7('0x23'),_0xb0f888);logger[_0x43f7('0xe')](_0x43f7('0x23'),_0xb0f888,JSON[_0x43f7('0x10')](_0x38e52a));_0x5dd95a(_0x38e52a);})[_0x43f7('0x16')](function(_0x3fe7b9){logger[_0x43f7('0x11')](_0x43f7('0x23'),_0x3fe7b9[_0x43f7('0x12')],_0xb0f888);_0x490561(_0x1b9ca5[_0x43f7('0x11')](0x1f4,_0x3fe7b9[_0x43f7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 0f7ed19..64e56ba 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 _0x1707=['post','delete','destroy','exports','multer','express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions'];(function(_0x561d81,_0x41f03f){var _0x51e09e=function(_0x59c554){while(--_0x59c554){_0x561d81['push'](_0x561d81['shift']());}};_0x51e09e(++_0x41f03f);}(_0x1707,0x1df));var _0x7170=function(_0x49b036,_0x2941e9){_0x49b036=_0x49b036-0x0;var _0x4953bb=_0x1707[_0x49b036];return _0x4953bb;};'use strict';var multer=require(_0x7170('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7170('0x1'));var router=express[_0x7170('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x7170('0x3'));var config=require(_0x7170('0x4'));var controller=require(_0x7170('0x5'));router[_0x7170('0x6')]('/',auth[_0x7170('0x7')](),controller[_0x7170('0x8')]);router[_0x7170('0x6')](_0x7170('0x9'),auth[_0x7170('0x7')](),controller[_0x7170('0xa')]);router[_0x7170('0x6')](_0x7170('0xb'),auth[_0x7170('0x7')](),controller[_0x7170('0xc')]);router[_0x7170('0x6')](_0x7170('0xd'),auth[_0x7170('0x7')](),controller['getSubjects']);router[_0x7170('0x6')]('/:id/descriptions',auth[_0x7170('0x7')](),controller[_0x7170('0xe')]);router[_0x7170('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7170('0x9'),auth[_0x7170('0x7')](),controller['update']);router[_0x7170('0x10')](_0x7170('0x9'),auth[_0x7170('0x7')](),controller[_0x7170('0x11')]);module[_0x7170('0x12')]=router; \ No newline at end of file +var _0xd4dc=['update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/fields','/:id/subjects','/:id/descriptions','post','create','put','/:id'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xd4dc,0xff));var _0xcd4d=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xd4dc[_0x7e2eb0];return _0xd92de4;};'use strict';var multer=require(_0xcd4d('0x0'));var util=require('util');var path=require(_0xcd4d('0x1'));var timeout=require(_0xcd4d('0x2'));var express=require(_0xcd4d('0x3'));var router=express[_0xcd4d('0x4')]();var auth=require(_0xcd4d('0x5'));var interaction=require(_0xcd4d('0x6'));var config=require(_0xcd4d('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0xcd4d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcd4d('0x8')]('/:id',auth[_0xcd4d('0x9')](),controller[_0xcd4d('0xa')]);router[_0xcd4d('0x8')](_0xcd4d('0xb'),auth[_0xcd4d('0x9')](),controller['getFields']);router['get'](_0xcd4d('0xc'),auth[_0xcd4d('0x9')](),controller['getSubjects']);router[_0xcd4d('0x8')](_0xcd4d('0xd'),auth[_0xcd4d('0x9')](),controller['getDescriptions']);router[_0xcd4d('0xe')]('/',auth['isAuthenticated'](),controller[_0xcd4d('0xf')]);router[_0xcd4d('0x10')](_0xcd4d('0x11'),auth[_0xcd4d('0x9')](),controller[_0xcd4d('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xcd4d('0x13')]);module[_0xcd4d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 31800c4..cbbe9e1 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 _0x88cc=['ENUM','lead','contact','nothing','contact_lead','STRING','exports'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x88cc,0x7d));var _0xc88c=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0x88cc[_0x1034bb];return _0x453fdb;};'use strict';var Sequelize=require('sequelize');module[_0xc88c('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xc88c('0x1')](_0xc88c('0x2'),_0xc88c('0x3'),_0xc88c('0x4')),'defaultValue':_0xc88c('0x2')},'moduleSearch':{'type':Sequelize[_0xc88c('0x1')](_0xc88c('0x5'),_0xc88c('0x3'),'lead'),'defaultValue':_0xc88c('0x5')},'description':{'type':Sequelize[_0xc88c('0x6')]}}; \ No newline at end of file +var _0xba03=['ENUM','lead','contact','nothing','contact_lead','sequelize','STRING'];(function(_0x563261,_0x552d98){var _0x12d5ee=function(_0x38ad00){while(--_0x38ad00){_0x563261['push'](_0x563261['shift']());}};_0x12d5ee(++_0x552d98);}(_0xba03,0xd0));var _0x3ba0=function(_0x1d51be,_0x5a79ed){_0x1d51be=_0x1d51be-0x0;var _0x756ff3=_0xba03[_0x1d51be];return _0x756ff3;};'use strict';var Sequelize=require(_0x3ba0('0x0'));module['exports']={'name':{'type':Sequelize[_0x3ba0('0x1')]},'moduleCreate':{'type':Sequelize[_0x3ba0('0x2')](_0x3ba0('0x3'),_0x3ba0('0x4'),_0x3ba0('0x5')),'defaultValue':_0x3ba0('0x3')},'moduleSearch':{'type':Sequelize[_0x3ba0('0x2')](_0x3ba0('0x6'),_0x3ba0('0x4'),_0x3ba0('0x3')),'defaultValue':_0x3ba0('0x6')},'description':{'type':Sequelize[_0x3ba0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index d5938d2..4cf639e 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(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 ab9e266..b509e03 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 _0xfe12=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger'];(function(_0x42f154,_0x32110c){var _0x471993=function(_0x29154a){while(--_0x29154a){_0x42f154['push'](_0x42f154['shift']());}};_0x471993(++_0x32110c);}(_0xfe12,0x66));var _0x2fe1=function(_0x47d56f,_0x4115dc){_0x47d56f=_0x47d56f-0x0;var _0x4c66a1=_0xfe12[_0x47d56f];return _0x4c66a1;};'use strict';var _=require('lodash');var util=require(_0x2fe1('0x0'));var logger=require(_0x2fe1('0x1'))('api');var moment=require(_0x2fe1('0x2'));var BPromise=require(_0x2fe1('0x3'));var rp=require(_0x2fe1('0x4'));var fs=require('fs');var path=require(_0x2fe1('0x5'));var rimraf=require(_0x2fe1('0x6'));var config=require(_0x2fe1('0x7'));var attributes=require(_0x2fe1('0x8'));module[_0x2fe1('0x9')]=function(_0x2b486c,_0x5ec7c2){return _0x2b486c[_0x2fe1('0xa')](_0x2fe1('0xb'),attributes,{'tableName':_0x2fe1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12b5=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','ZohoConfiguration','int_zoho_configurations','lodash'];(function(_0x3a9e3f,_0x39063f){var _0x45acac=function(_0x1a7141){while(--_0x1a7141){_0x3a9e3f['push'](_0x3a9e3f['shift']());}};_0x45acac(++_0x39063f);}(_0x12b5,0xdb));var _0x512b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x12b5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x512b('0x0'));var util=require('util');var logger=require(_0x512b('0x1'))(_0x512b('0x2'));var moment=require(_0x512b('0x3'));var BPromise=require('bluebird');var rp=require(_0x512b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x512b('0x5'));var config=require(_0x512b('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x512b('0x7')]=function(_0x515f25,_0xb033cc){return _0x515f25[_0x512b('0x8')](_0x512b('0x9'),attributes,{'tableName':_0x512b('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 f36254e..773d8e0 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 _0xa9a4=['rpc','../../config/environment','jayson/promise','client','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9a4,0x14a));var _0x4a9a=function(_0x513357,_0x3d0ecf){_0x513357=_0x513357-0x0;var _0x375256=_0xa9a4[_0x513357];return _0x375256;};'use strict';var _=require(_0x4a9a('0x0'));var util=require(_0x4a9a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4a9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a9a('0x3'))['db'];var utils=require(_0x4a9a('0x4'));var logger=require(_0x4a9a('0x5'))(_0x4a9a('0x6'));var config=require(_0x4a9a('0x7'));var jayson=require(_0x4a9a('0x8'));var client=jayson[_0x4a9a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3665b6,_0x5bc3a4,_0x2f5cc5){return new BPromise(function(_0x2995c1,_0x4207a4){return client['request'](_0x3665b6,_0x2f5cc5)[_0x4a9a('0xa')](function(_0x208bc0){logger[_0x4a9a('0xb')](_0x4a9a('0xc'),_0x5bc3a4,'request\x20sent');logger[_0x4a9a('0xd')](_0x4a9a('0xe'),_0x5bc3a4,_0x4a9a('0xf'),JSON[_0x4a9a('0x10')](_0x208bc0));if(_0x208bc0['error']){if(_0x208bc0[_0x4a9a('0x11')][_0x4a9a('0x12')]===0x1f4){logger[_0x4a9a('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x5bc3a4,_0x208bc0[_0x4a9a('0x11')]['message']);return _0x4207a4(_0x208bc0[_0x4a9a('0x11')]['message']);}logger[_0x4a9a('0x11')](_0x4a9a('0xc'),_0x5bc3a4,_0x208bc0[_0x4a9a('0x11')][_0x4a9a('0x13')]);return _0x2995c1(_0x208bc0['error'][_0x4a9a('0x13')]);}else{logger[_0x4a9a('0xb')](_0x4a9a('0xc'),_0x5bc3a4,_0x4a9a('0xf'));_0x2995c1(_0x208bc0[_0x4a9a('0x14')]['message']);}})['catch'](function(_0x1cc5f1){logger[_0x4a9a('0x11')](_0x4a9a('0xc'),_0x5bc3a4,_0x1cc5f1);_0x4207a4(_0x1cc5f1);});});} \ No newline at end of file +var _0xb792=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3048ea,_0x3838c2){var _0x1a13c4=function(_0x2c6a6b){while(--_0x2c6a6b){_0x3048ea['push'](_0x3048ea['shift']());}};_0x1a13c4(++_0x3838c2);}(_0xb792,0x1d1));var _0x2b79=function(_0x3f65a6,_0x440914){_0x3f65a6=_0x3f65a6-0x0;var _0x33db99=_0xb792[_0x3f65a6];return _0x33db99;};'use strict';var _=require(_0x2b79('0x0'));var util=require(_0x2b79('0x1'));var moment=require(_0x2b79('0x2'));var BPromise=require(_0x2b79('0x3'));var rs=require(_0x2b79('0x4'));var fs=require('fs');var Redis=require(_0x2b79('0x5'));var db=require(_0x2b79('0x6'))['db'];var utils=require(_0x2b79('0x7'));var logger=require(_0x2b79('0x8'))(_0x2b79('0x9'));var config=require(_0x2b79('0xa'));var jayson=require(_0x2b79('0xb'));var client=jayson[_0x2b79('0xc')][_0x2b79('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x103079,_0x450034,_0x2be67f){return new BPromise(function(_0x5e446c,_0x347df9){return client['request'](_0x103079,_0x2be67f)['then'](function(_0x2eb21c){logger[_0x2b79('0xe')](_0x2b79('0xf'),_0x450034,_0x2b79('0x10'));logger[_0x2b79('0x11')](_0x2b79('0x12'),_0x450034,'request\x20sent',JSON[_0x2b79('0x13')](_0x2eb21c));if(_0x2eb21c[_0x2b79('0x14')]){if(_0x2eb21c[_0x2b79('0x14')]['code']===0x1f4){logger[_0x2b79('0x14')](_0x2b79('0xf'),_0x450034,_0x2eb21c[_0x2b79('0x14')][_0x2b79('0x15')]);return _0x347df9(_0x2eb21c[_0x2b79('0x14')][_0x2b79('0x15')]);}logger[_0x2b79('0x14')](_0x2b79('0xf'),_0x450034,_0x2eb21c[_0x2b79('0x14')][_0x2b79('0x15')]);return _0x5e446c(_0x2eb21c[_0x2b79('0x14')][_0x2b79('0x15')]);}else{logger['info'](_0x2b79('0xf'),_0x450034,_0x2b79('0x10'));_0x5e446c(_0x2eb21c['result'][_0x2b79('0x15')]);}})[_0x2b79('0x16')](function(_0x1014a1){logger[_0x2b79('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x450034,_0x1014a1);_0x347df9(_0x1014a1);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 09631fc..ccc2e58 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 _0x3423=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','path','connect-timeout','express','Router'];(function(_0x59c0a6,_0x216f3a){var _0x14561d=function(_0x19e3f6){while(--_0x19e3f6){_0x59c0a6['push'](_0x59c0a6['shift']());}};_0x14561d(++_0x216f3a);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var auth=require(_0x3342('0x4'));var interaction=require(_0x3342('0x5'));var config=require(_0x3342('0x6'));var controller=require(_0x3342('0x7'));router[_0x3342('0x8')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xa')]);router[_0x3342('0x8')](_0x3342('0xb'),auth[_0x3342('0x9')](),controller[_0x3342('0xc')]);router[_0x3342('0xd')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xe')]);router[_0x3342('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3342('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3342('0x11')]=router; \ No newline at end of file +var _0x4137=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2670ac,_0x416f90){var _0x75b69e=function(_0x307fd2){while(--_0x307fd2){_0x2670ac['push'](_0x2670ac['shift']());}};_0x75b69e(++_0x416f90);}(_0x4137,0xf8));var _0x7413=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4137[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var auth=require(_0x7413('0x6'));var interaction=require(_0x7413('0x7'));var config=require(_0x7413('0x8'));var controller=require(_0x7413('0x9'));router[_0x7413('0xa')]('/',auth[_0x7413('0xb')](),controller['index']);router[_0x7413('0xa')](_0x7413('0xc'),auth[_0x7413('0xb')](),controller[_0x7413('0xd')]);router['post']('/',auth[_0x7413('0xb')](),controller[_0x7413('0xe')]);router['put'](_0x7413('0xc'),auth[_0x7413('0xb')](),controller['update']);router[_0x7413('0xf')](_0x7413('0xc'),auth[_0x7413('0xb')](),controller[_0x7413('0x10')]);module[_0x7413('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 6a863d0..312b251 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 _0x6732=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2673('0x0'));module[_0x2673('0x1')]={'type':{'type':Sequelize[_0x2673('0x2')](_0x2673('0x3'),'variable',_0x2673('0x4'),_0x2673('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2673('0x6')]},'key':{'type':Sequelize[_0x2673('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x2673('0x7'),_0x2673('0x4'))},'keyContent':{'type':Sequelize[_0x2673('0x6')]},'idField':{'type':Sequelize[_0x2673('0x6')]},'nameField':{'type':Sequelize[_0x2673('0x6')]},'customField':{'type':Sequelize[_0x2673('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2673('0x6')]}}; \ No newline at end of file +var _0xc99e=['ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize','exports'];(function(_0x50bb05,_0x2567d9){var _0x3fa560=function(_0x403c98){while(--_0x403c98){_0x50bb05['push'](_0x50bb05['shift']());}};_0x3fa560(++_0x2567d9);}(_0xc99e,0x6e));var _0xec99=function(_0x7f0a4e,_0x477668){_0x7f0a4e=_0x7f0a4e-0x0;var _0x36ee6c=_0xc99e[_0x7f0a4e];return _0x36ee6c;};'use strict';var Sequelize=require(_0xec99('0x0'));module[_0xec99('0x1')]={'type':{'type':Sequelize[_0xec99('0x2')](_0xec99('0x3'),_0xec99('0x4'),_0xec99('0x5'),'keyValue'),'defaultValue':_0xec99('0x3')},'content':{'type':Sequelize[_0xec99('0x6')]},'key':{'type':Sequelize[_0xec99('0x6')]},'keyType':{'type':Sequelize[_0xec99('0x2')](_0xec99('0x3'),_0xec99('0x4'),_0xec99('0x5'))},'keyContent':{'type':Sequelize[_0xec99('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xec99('0x6')]},'customField':{'type':Sequelize[_0xec99('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 2f47b6a..1f4ac57 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 _0x9c05=['moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','then','destroy','error','name','index','map','ZohoField','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','merge','type','VIRTUAL','filter','options','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x4c60a5,_0x991968){var _0x4727d3=function(_0x34ac92){while(--_0x34ac92){_0x4c60a5['push'](_0x4c60a5['shift']());}};_0x4727d3(++_0x991968);}(_0x9c05,0x168));var _0x59c0=function(_0x11e285,_0x4c5ff1){_0x11e285=_0x11e285-0x0;var _0x4a44ff=_0x9c05[_0x11e285];return _0x4a44ff;};'use strict';var pdf=require(_0x59c0('0x0'));var emlformat=require(_0x59c0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x59c0('0x2'));var jsonpatch=require(_0x59c0('0x3'));var rp=require(_0x59c0('0x4'));var moment=require(_0x59c0('0x5'));var BPromise=require(_0x59c0('0x6'));var Mustache=require(_0x59c0('0x7'));var util=require(_0x59c0('0x8'));var path=require(_0x59c0('0x9'));var sox=require('sox');var csv=require(_0x59c0('0xa'));var ejs=require(_0x59c0('0xb'));var fs=require('fs');var _=require(_0x59c0('0xc'));var squel=require(_0x59c0('0xd'));var crypto=require(_0x59c0('0xe'));var jsforce=require(_0x59c0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x59c0('0xa'));var querystring=require(_0x59c0('0x10'));var Papa=require('papaparse');var Redis=require(_0x59c0('0x11'));var authService=require(_0x59c0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x59c0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59c0('0x14'))(_0x59c0('0x15'));var utils=require(_0x59c0('0x16'));var config=require(_0x59c0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x59c0('0x18'))['db'];function respondWithStatusCode(_0x417d01,_0x531d50){_0x531d50=_0x531d50||0xcc;return function(_0x1c0d66){if(_0x1c0d66){return _0x417d01[_0x59c0('0x19')](_0x531d50);}return _0x417d01[_0x59c0('0x1a')](_0x531d50)[_0x59c0('0x1b')]();};}function respondWithResult(_0x339c2a,_0x3a2c62){_0x3a2c62=_0x3a2c62||0xc8;return function(_0x3f11e7){if(_0x3f11e7){return _0x339c2a[_0x59c0('0x1a')](_0x3a2c62)[_0x59c0('0x1c')](_0x3f11e7);}};}function respondWithFilteredResult(_0x2e16ee,_0x4ac4b2){return function(_0x48baef){if(_0x48baef){var _0x2def6d=_0x48baef[_0x59c0('0x1d')],_0x461c8a=_0x4ac4b2[_0x59c0('0x1e')],_0x22dd01=_0x4ac4b2['offset']+_0x4ac4b2['limit'],_0x594ce8;if(_0x22dd01>=_0x2def6d){_0x22dd01=_0x2def6d;_0x594ce8=0xc8;}else{_0x594ce8=0xce;}_0x2e16ee[_0x59c0('0x1a')](_0x594ce8);return _0x2e16ee['set'](_0x59c0('0x1f'),_0x461c8a+'-'+_0x22dd01+'/'+_0x2def6d)[_0x59c0('0x1c')](_0x48baef);}return null;};}function patchUpdates(_0x2e9257){return function(_0x29a5ca){try{jsonpatch[_0x59c0('0x20')](_0x29a5ca,_0x2e9257,!![]);}catch(_0x14b4c4){return BPromise[_0x59c0('0x21')](_0x14b4c4);}return _0x29a5ca['save']();};}function saveUpdates(_0xd22b07,_0x3ec59e){return function(_0x321b37){if(_0x321b37){return _0x321b37['update'](_0xd22b07)[_0x59c0('0x22')](function(_0x4b59d9){return _0x4b59d9;});}return null;};}function removeEntity(_0x5599e9,_0xfdc6db){return function(_0x8f962c){if(_0x8f962c){return _0x8f962c[_0x59c0('0x23')]()[_0x59c0('0x22')](function(){_0x5599e9[_0x59c0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e629f,_0x46edc7){return function(_0x3d39cf){if(!_0x3d39cf){_0x4e629f[_0x59c0('0x19')](0x194);}return _0x3d39cf;};}function handleError(_0xcc5c57,_0x28de2a){_0x28de2a=_0x28de2a||0x1f4;return function(_0x29bf59){logger[_0x59c0('0x24')](_0x29bf59['stack']);if(_0x29bf59[_0x59c0('0x25')]){delete _0x29bf59[_0x59c0('0x25')];}_0xcc5c57['status'](_0x28de2a)['send'](_0x29bf59);};}exports[_0x59c0('0x26')]=function(_0x4aee7b,_0x5c8aff){var _0x136f4e={},_0x29cf1a={},_0x4ac79b={'count':0x0,'rows':[]};var _0xb66c1=_[_0x59c0('0x27')](db[_0x59c0('0x28')][_0x59c0('0x29')],function(_0x5f5d48){return{'name':_0x5f5d48['fieldName'],'type':_0x5f5d48['type'][_0x59c0('0x2a')]};});_0x29cf1a['model']=_[_0x59c0('0x27')](_0xb66c1,_0x59c0('0x25'));_0x29cf1a[_0x59c0('0x2b')]=_[_0x59c0('0x2c')](_0x4aee7b[_0x59c0('0x2b')]);_0x29cf1a[_0x59c0('0x2d')]=_[_0x59c0('0x2e')](_0x29cf1a[_0x59c0('0x2f')],_0x29cf1a[_0x59c0('0x2b')]);_0x136f4e[_0x59c0('0x30')]=_[_0x59c0('0x2e')](_0x29cf1a[_0x59c0('0x2f')],qs[_0x59c0('0x31')](_0x4aee7b[_0x59c0('0x2b')][_0x59c0('0x31')]));_0x136f4e[_0x59c0('0x30')]=_0x136f4e[_0x59c0('0x30')]['length']?_0x136f4e[_0x59c0('0x30')]:_0x29cf1a[_0x59c0('0x2f')];if(!_0x4aee7b[_0x59c0('0x2b')][_0x59c0('0x32')](_0x59c0('0x33'))){_0x136f4e[_0x59c0('0x34')]=qs[_0x59c0('0x34')](_0x4aee7b[_0x59c0('0x2b')]['limit']);_0x136f4e['offset']=qs[_0x59c0('0x1e')](_0x4aee7b[_0x59c0('0x2b')][_0x59c0('0x1e')]);}_0x136f4e[_0x59c0('0x35')]=qs[_0x59c0('0x36')](_0x4aee7b[_0x59c0('0x2b')][_0x59c0('0x36')]);_0x136f4e[_0x59c0('0x37')]=qs['filters'](_['pick'](_0x4aee7b[_0x59c0('0x2b')],_0x29cf1a[_0x59c0('0x2d')]),_0xb66c1);if(_0x4aee7b['query']['filter']){_0x136f4e[_0x59c0('0x37')]=_[_0x59c0('0x38')](_0x136f4e['where'],{'$or':_[_0x59c0('0x27')](_0xb66c1,function(_0x4ae7b8){if(_0x4ae7b8[_0x59c0('0x39')]!==_0x59c0('0x3a')){var _0x47b271={};_0x47b271[_0x4ae7b8['name']]={'$like':'%'+_0x4aee7b[_0x59c0('0x2b')][_0x59c0('0x3b')]+'%'};return _0x47b271;}})});}_0x136f4e=_[_0x59c0('0x38')]({},_0x136f4e,_0x4aee7b[_0x59c0('0x3c')]);var _0x38f202={'where':_0x136f4e[_0x59c0('0x37')]};return db[_0x59c0('0x28')]['count'](_0x38f202)[_0x59c0('0x22')](function(_0x248920){_0x4ac79b[_0x59c0('0x1d')]=_0x248920;if(_0x4aee7b[_0x59c0('0x2b')]['includeAll']){_0x136f4e['include']=[{'all':!![]}];}return db['ZohoField'][_0x59c0('0x3d')](_0x136f4e);})[_0x59c0('0x22')](function(_0x590b5c){_0x4ac79b[_0x59c0('0x3e')]=_0x590b5c;return _0x4ac79b;})['then'](respondWithFilteredResult(_0x5c8aff,_0x136f4e))[_0x59c0('0x3f')](handleError(_0x5c8aff,null));};exports[_0x59c0('0x40')]=function(_0x4483a7,_0x20379d){var _0x17542f={'raw':!![],'where':{'id':_0x4483a7[_0x59c0('0x41')]['id']}},_0x4fd458={};_0x4fd458[_0x59c0('0x2f')]=_[_0x59c0('0x2c')](db['ZohoField'][_0x59c0('0x29')]);_0x4fd458['query']=_[_0x59c0('0x2c')](_0x4483a7[_0x59c0('0x2b')]);_0x4fd458[_0x59c0('0x2d')]=_['intersection'](_0x4fd458['model'],_0x4fd458['query']);_0x17542f[_0x59c0('0x30')]=_[_0x59c0('0x2e')](_0x4fd458['model'],qs[_0x59c0('0x31')](_0x4483a7[_0x59c0('0x2b')]['fields']));_0x17542f[_0x59c0('0x30')]=_0x17542f['attributes'][_0x59c0('0x42')]?_0x17542f['attributes']:_0x4fd458[_0x59c0('0x2f')];if(_0x4483a7[_0x59c0('0x2b')][_0x59c0('0x43')]){_0x17542f[_0x59c0('0x44')]=[{'all':!![]}];}_0x17542f=_[_0x59c0('0x38')]({},_0x17542f,_0x4483a7[_0x59c0('0x3c')]);return db[_0x59c0('0x28')][_0x59c0('0x45')](_0x17542f)[_0x59c0('0x22')](handleEntityNotFound(_0x20379d,null))[_0x59c0('0x22')](respondWithResult(_0x20379d,null))['catch'](handleError(_0x20379d,null));};exports['create']=function(_0x5a8ed9,_0x47b412){return db[_0x59c0('0x28')][_0x59c0('0x46')](_0x5a8ed9[_0x59c0('0x47')],{})[_0x59c0('0x22')](respondWithResult(_0x47b412,0xc9))[_0x59c0('0x3f')](handleError(_0x47b412,null));};exports[_0x59c0('0x48')]=function(_0x411c69,_0x40120b){if(_0x411c69['body']['id']){delete _0x411c69[_0x59c0('0x47')]['id'];}return db[_0x59c0('0x28')]['find']({'where':{'id':_0x411c69[_0x59c0('0x41')]['id']}})['then'](handleEntityNotFound(_0x40120b,null))[_0x59c0('0x22')](saveUpdates(_0x411c69[_0x59c0('0x47')],null))[_0x59c0('0x22')](respondWithResult(_0x40120b,null))[_0x59c0('0x3f')](handleError(_0x40120b,null));};exports['destroy']=function(_0x912d0b,_0x22cd1e){return db[_0x59c0('0x28')][_0x59c0('0x45')]({'where':{'id':_0x912d0b['params']['id']}})[_0x59c0('0x22')](handleEntityNotFound(_0x22cd1e,null))['then'](removeEntity(_0x22cd1e,null))[_0x59c0('0x3f')](handleError(_0x22cd1e,null));}; \ No newline at end of file +var _0x21d4=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','ZohoField','findAll','params','rawAttributes','include','find','catch','create','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x58adae,_0x5c78eb){var _0xa29995=function(_0x1d5c49){while(--_0x1d5c49){_0x58adae['push'](_0x58adae['shift']());}};_0xa29995(++_0x5c78eb);}(_0x21d4,0x11e));var _0x421d=function(_0x50de8b,_0x50bc47){_0x50de8b=_0x50de8b-0x0;var _0x465b92=_0x21d4[_0x50de8b];return _0x465b92;};'use strict';var pdf=require(_0x421d('0x0'));var emlformat=require(_0x421d('0x1'));var rimraf=require(_0x421d('0x2'));var zipdir=require(_0x421d('0x3'));var jsonpatch=require(_0x421d('0x4'));var rp=require(_0x421d('0x5'));var moment=require('moment');var BPromise=require(_0x421d('0x6'));var Mustache=require(_0x421d('0x7'));var util=require(_0x421d('0x8'));var path=require('path');var sox=require(_0x421d('0x9'));var csv=require(_0x421d('0xa'));var ejs=require(_0x421d('0xb'));var fs=require('fs');var _=require(_0x421d('0xc'));var squel=require(_0x421d('0xd'));var crypto=require('crypto');var jsforce=require(_0x421d('0xe'));var deskjs=require(_0x421d('0xf'));var toCsv=require(_0x421d('0xa'));var querystring=require(_0x421d('0x10'));var Papa=require(_0x421d('0x11'));var Redis=require(_0x421d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x421d('0x13'));var hardwareService=require(_0x421d('0x14'));var logger=require(_0x421d('0x15'))('api');var utils=require(_0x421d('0x16'));var config=require(_0x421d('0x17'));var licenseUtil=require(_0x421d('0x18'));var db=require(_0x421d('0x19'))['db'];function respondWithStatusCode(_0x724d6,_0x444448){_0x444448=_0x444448||0xcc;return function(_0x3cc85b){if(_0x3cc85b){return _0x724d6['sendStatus'](_0x444448);}return _0x724d6[_0x421d('0x1a')](_0x444448)['end']();};}function respondWithResult(_0x2490c3,_0xe46298){_0xe46298=_0xe46298||0xc8;return function(_0x1f01ad){if(_0x1f01ad){return _0x2490c3['status'](_0xe46298)[_0x421d('0x1b')](_0x1f01ad);}};}function respondWithFilteredResult(_0x1338d9,_0x3abdd9){return function(_0x468b6f){if(_0x468b6f){var _0x201df9=_0x468b6f[_0x421d('0x1c')],_0x3d0700=_0x3abdd9[_0x421d('0x1d')],_0x3ea040=_0x3abdd9[_0x421d('0x1d')]+_0x3abdd9['limit'],_0x4dfdc4;if(_0x3ea040>=_0x201df9){_0x3ea040=_0x201df9;_0x4dfdc4=0xc8;}else{_0x4dfdc4=0xce;}_0x1338d9[_0x421d('0x1a')](_0x4dfdc4);return _0x1338d9[_0x421d('0x1e')](_0x421d('0x1f'),_0x3d0700+'-'+_0x3ea040+'/'+_0x201df9)[_0x421d('0x1b')](_0x468b6f);}return null;};}function patchUpdates(_0xe9308c){return function(_0x296239){try{jsonpatch[_0x421d('0x20')](_0x296239,_0xe9308c,!![]);}catch(_0x3dff78){return BPromise[_0x421d('0x21')](_0x3dff78);}return _0x296239[_0x421d('0x22')]();};}function saveUpdates(_0x33d6c6,_0x3617af){return function(_0x2854de){if(_0x2854de){return _0x2854de['update'](_0x33d6c6)[_0x421d('0x23')](function(_0xc789c4){return _0xc789c4;});}return null;};}function removeEntity(_0x2df619,_0x4767b0){return function(_0x1d40d4){if(_0x1d40d4){return _0x1d40d4[_0x421d('0x24')]()[_0x421d('0x23')](function(){_0x2df619['status'](0xcc)[_0x421d('0x25')]();});}};}function handleEntityNotFound(_0x3c6d52,_0x1e900e){return function(_0x3ef07e){if(!_0x3ef07e){_0x3c6d52[_0x421d('0x26')](0x194);}return _0x3ef07e;};}function handleError(_0x54dd2d,_0x408946){_0x408946=_0x408946||0x1f4;return function(_0x4b5bb5){logger[_0x421d('0x27')](_0x4b5bb5[_0x421d('0x28')]);if(_0x4b5bb5[_0x421d('0x29')]){delete _0x4b5bb5[_0x421d('0x29')];}_0x54dd2d[_0x421d('0x1a')](_0x408946)[_0x421d('0x2a')](_0x4b5bb5);};}exports[_0x421d('0x2b')]=function(_0x2415a9,_0x81b0c9){var _0x2e2476={},_0x494662={},_0x240ab2={'count':0x0,'rows':[]};var _0x523d12=_[_0x421d('0x2c')](db['ZohoField']['rawAttributes'],function(_0xf4fc9e){return{'name':_0xf4fc9e[_0x421d('0x2d')],'type':_0xf4fc9e['type']['key']};});_0x494662[_0x421d('0x2e')]=_[_0x421d('0x2c')](_0x523d12,_0x421d('0x29'));_0x494662[_0x421d('0x2f')]=_[_0x421d('0x30')](_0x2415a9[_0x421d('0x2f')]);_0x494662[_0x421d('0x31')]=_[_0x421d('0x32')](_0x494662[_0x421d('0x2e')],_0x494662[_0x421d('0x2f')]);_0x2e2476[_0x421d('0x33')]=_['intersection'](_0x494662[_0x421d('0x2e')],qs[_0x421d('0x34')](_0x2415a9[_0x421d('0x2f')]['fields']));_0x2e2476['attributes']=_0x2e2476[_0x421d('0x33')][_0x421d('0x35')]?_0x2e2476[_0x421d('0x33')]:_0x494662[_0x421d('0x2e')];if(!_0x2415a9['query'][_0x421d('0x36')](_0x421d('0x37'))){_0x2e2476[_0x421d('0x38')]=qs['limit'](_0x2415a9['query'][_0x421d('0x38')]);_0x2e2476['offset']=qs['offset'](_0x2415a9['query'][_0x421d('0x1d')]);}_0x2e2476['order']=qs[_0x421d('0x39')](_0x2415a9['query'][_0x421d('0x39')]);_0x2e2476[_0x421d('0x3a')]=qs[_0x421d('0x31')](_[_0x421d('0x3b')](_0x2415a9['query'],_0x494662[_0x421d('0x31')]),_0x523d12);if(_0x2415a9['query'][_0x421d('0x3c')]){_0x2e2476[_0x421d('0x3a')]=_[_0x421d('0x3d')](_0x2e2476[_0x421d('0x3a')],{'$or':_[_0x421d('0x2c')](_0x523d12,function(_0x23bd76){if(_0x23bd76[_0x421d('0x3e')]!==_0x421d('0x3f')){var _0x7b5cc3={};_0x7b5cc3[_0x23bd76[_0x421d('0x29')]]={'$like':'%'+_0x2415a9[_0x421d('0x2f')][_0x421d('0x3c')]+'%'};return _0x7b5cc3;}})});}_0x2e2476=_[_0x421d('0x3d')]({},_0x2e2476,_0x2415a9[_0x421d('0x40')]);var _0x59d5d8={'where':_0x2e2476[_0x421d('0x3a')]};return db[_0x421d('0x41')][_0x421d('0x1c')](_0x59d5d8)['then'](function(_0x437070){_0x240ab2[_0x421d('0x1c')]=_0x437070;if(_0x2415a9[_0x421d('0x2f')]['includeAll']){_0x2e2476['include']=[{'all':!![]}];}return db[_0x421d('0x41')][_0x421d('0x42')](_0x2e2476);})[_0x421d('0x23')](function(_0x8be504){_0x240ab2['rows']=_0x8be504;return _0x240ab2;})[_0x421d('0x23')](respondWithFilteredResult(_0x81b0c9,_0x2e2476))['catch'](handleError(_0x81b0c9,null));};exports['show']=function(_0x8ff4ef,_0x410a2f){var _0x16759f={'raw':!![],'where':{'id':_0x8ff4ef[_0x421d('0x43')]['id']}},_0x29607e={};_0x29607e[_0x421d('0x2e')]=_['keys'](db['ZohoField'][_0x421d('0x44')]);_0x29607e[_0x421d('0x2f')]=_[_0x421d('0x30')](_0x8ff4ef[_0x421d('0x2f')]);_0x29607e[_0x421d('0x31')]=_[_0x421d('0x32')](_0x29607e[_0x421d('0x2e')],_0x29607e[_0x421d('0x2f')]);_0x16759f[_0x421d('0x33')]=_[_0x421d('0x32')](_0x29607e[_0x421d('0x2e')],qs['fields'](_0x8ff4ef[_0x421d('0x2f')]['fields']));_0x16759f[_0x421d('0x33')]=_0x16759f[_0x421d('0x33')][_0x421d('0x35')]?_0x16759f[_0x421d('0x33')]:_0x29607e['model'];if(_0x8ff4ef[_0x421d('0x2f')]['includeAll']){_0x16759f[_0x421d('0x45')]=[{'all':!![]}];}_0x16759f=_[_0x421d('0x3d')]({},_0x16759f,_0x8ff4ef['options']);return db[_0x421d('0x41')][_0x421d('0x46')](_0x16759f)[_0x421d('0x23')](handleEntityNotFound(_0x410a2f,null))[_0x421d('0x23')](respondWithResult(_0x410a2f,null))[_0x421d('0x47')](handleError(_0x410a2f,null));};exports['create']=function(_0x5115cf,_0x478ca5){return db[_0x421d('0x41')][_0x421d('0x48')](_0x5115cf['body'],{})[_0x421d('0x23')](respondWithResult(_0x478ca5,0xc9))[_0x421d('0x47')](handleError(_0x478ca5,null));};exports[_0x421d('0x49')]=function(_0x5c9e00,_0x5630ee){if(_0x5c9e00['body']['id']){delete _0x5c9e00[_0x421d('0x4a')]['id'];}return db[_0x421d('0x41')][_0x421d('0x46')]({'where':{'id':_0x5c9e00[_0x421d('0x43')]['id']}})[_0x421d('0x23')](handleEntityNotFound(_0x5630ee,null))['then'](saveUpdates(_0x5c9e00['body'],null))[_0x421d('0x23')](respondWithResult(_0x5630ee,null))['catch'](handleError(_0x5630ee,null));};exports[_0x421d('0x24')]=function(_0x29de33,_0x39fc7e){return db[_0x421d('0x41')][_0x421d('0x46')]({'where':{'id':_0x29de33[_0x421d('0x43')]['id']}})[_0x421d('0x23')](handleEntityNotFound(_0x39fc7e,null))[_0x421d('0x23')](removeEntity(_0x39fc7e,null))[_0x421d('0x47')](handleError(_0x39fc7e,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 62e4f00..beec5fa 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 _0x547f=['zoho_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields'];(function(_0x1d7183,_0x32288c){var _0x1c8e24=function(_0x23dcbe){while(--_0x23dcbe){_0x1d7183['push'](_0x1d7183['shift']());}};_0x1c8e24(++_0x32288c);}(_0x547f,0xf3));var _0xf547=function(_0x10756c,_0xf50e88){_0x10756c=_0x10756c-0x0;var _0x93180b=_0x547f[_0x10756c];return _0x93180b;};'use strict';var _=require('lodash');var util=require(_0xf547('0x0'));var logger=require(_0xf547('0x1'))(_0xf547('0x2'));var moment=require(_0xf547('0x3'));var BPromise=require(_0xf547('0x4'));var rp=require(_0xf547('0x5'));var fs=require('fs');var path=require(_0xf547('0x6'));var rimraf=require(_0xf547('0x7'));var config=require(_0xf547('0x8'));var attributes=require(_0xf547('0x9'));module[_0xf547('0xa')]=function(_0x2f3a54,_0x4f9dc4){return _0x2f3a54[_0xf547('0xb')]('ZohoField',attributes,{'tableName':_0xf547('0xc'),'paranoid':![],'indexes':[{'name':_0xf547('0xd'),'fields':[_0xf547('0xe'),_0xf547('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6c7b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util'];(function(_0x37eca7,_0x3e016e){var _0x222bce=function(_0xebd0b7){while(--_0xebd0b7){_0x37eca7['push'](_0x37eca7['shift']());}};_0x222bce(++_0x3e016e);}(_0x6c7b,0xff));var _0xb6c7=function(_0x38fee0,_0x47819a){_0x38fee0=_0x38fee0-0x0;var _0x64b444=_0x6c7b[_0x38fee0];return _0x64b444;};'use strict';var _=require('lodash');var util=require(_0xb6c7('0x0'));var logger=require(_0xb6c7('0x1'))(_0xb6c7('0x2'));var moment=require(_0xb6c7('0x3'));var BPromise=require('bluebird');var rp=require(_0xb6c7('0x4'));var fs=require('fs');var path=require(_0xb6c7('0x5'));var rimraf=require(_0xb6c7('0x6'));var config=require(_0xb6c7('0x7'));var attributes=require(_0xb6c7('0x8'));module[_0xb6c7('0x9')]=function(_0x160b8c,_0x3773ba){return _0x160b8c[_0xb6c7('0xa')](_0xb6c7('0xb'),attributes,{'tableName':_0xb6c7('0xc'),'paranoid':![],'indexes':[{'name':_0xb6c7('0xd'),'fields':[_0xb6c7('0xe'),_0xb6c7('0xf')],'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 cb0831b..9cee2b2 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 _0xb458=['ZohoField,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','ZohoField,\x20%s,\x20%s','debug'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xb458,0x103));var _0x8b45=function(_0x2640fa,_0xaeaf32){_0x2640fa=_0x2640fa-0x0;var _0x5aa2cd=_0xb458[_0x2640fa];return _0x5aa2cd;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x8efd27,_0x4f11c0){var _0x614982=function(_0x2f653c){while(--_0x2f653c){_0x8efd27['push'](_0x8efd27['shift']());}};_0x614982(++_0x4f11c0);}(_0x34e8,0x12c));var _0x834e=function(_0x326a09,_0x94a326){_0x326a09=_0x326a09-0x0;var _0x535d14=_0x34e8[_0x326a09];return _0x535d14;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('ZohoField,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('ZohoField,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 17192ab..d9824e6 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 _0x076e=['express','Router','../../components/interaction/service','exports','multer','util','path','connect-timeout'];(function(_0xaf37a5,_0x417430){var _0x4f6f02=function(_0x259839){while(--_0x259839){_0xaf37a5['push'](_0xaf37a5['shift']());}};_0x4f6f02(++_0x417430);}(_0x076e,0x114));var _0xe076=function(_0x26a5cf,_0x31be5f){_0x26a5cf=_0x26a5cf-0x0;var _0x4c5568=_0x076e[_0x26a5cf];return _0x4c5568;};'use strict';var multer=require(_0xe076('0x0'));var util=require(_0xe076('0x1'));var path=require(_0xe076('0x2'));var timeout=require(_0xe076('0x3'));var express=require(_0xe076('0x4'));var router=express[_0xe076('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe076('0x6'));var config=require('../../config/environment');module[_0xe076('0x7')]=router; \ No newline at end of file +var _0x2df6=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path'];(function(_0x296ffe,_0x37e039){var _0x2d71f5=function(_0x123462){while(--_0x123462){_0x296ffe['push'](_0x296ffe['shift']());}};_0x2d71f5(++_0x37e039);}(_0x2df6,0xce));var _0x62df=function(_0x385ba1,_0x380b3c){_0x385ba1=_0x385ba1-0x0;var _0x5472b6=_0x2df6[_0x385ba1];return _0x5472b6;};'use strict';var multer=require('multer');var util=require(_0x62df('0x0'));var path=require(_0x62df('0x1'));var timeout=require(_0x62df('0x2'));var express=require(_0x62df('0x3'));var router=express['Router']();var auth=require(_0x62df('0x4'));var interaction=require(_0x62df('0x5'));var config=require(_0x62df('0x6'));module[_0x62df('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 55d18dc..cb9f076 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 _0x9ea9=['INTEGER','BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x9ea9,0x73));var _0x99ea=function(_0x2d8607,_0x2c444a){_0x2d8607=_0x2d8607-0x0;var _0x4c1cb3=_0x9ea9[_0x2d8607];return _0x4c1cb3;};'use strict';var Sequelize=require(_0x99ea('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x99ea('0x1')],'allowNull':![],'unique':_0x99ea('0x2')},'main':{'type':Sequelize[_0x99ea('0x1')],'defaultValue':_0x99ea('0x3')},'filename':{'type':Sequelize[_0x99ea('0x1')]},'path':{'type':Sequelize[_0x99ea('0x1')]},'type':{'type':Sequelize[_0x99ea('0x1')]},'size':{'type':Sequelize[_0x99ea('0x4')]},'active':{'type':Sequelize[_0x99ea('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x99ea('0x1')]},'logo':{'type':Sequelize[_0x99ea('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x99ea('0x6')},'description':{'type':Sequelize[_0x99ea('0x1')]},'title':{'type':Sequelize[_0x99ea('0x1')]},'remoteUri':{'type':Sequelize[_0x99ea('0x1')]},'link':{'type':Sequelize[_0x99ea('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xd4db=['sequelize','exports','STRING','unique_name_and_version','BOOLEAN','state'];(function(_0x294b6,_0x2907ae){var _0x38bb97=function(_0x5aaa76){while(--_0x5aaa76){_0x294b6['push'](_0x294b6['shift']());}};_0x38bb97(++_0x2907ae);}(_0xd4db,0x18c));var _0xbd4d=function(_0x22a260,_0x49ccfc){_0x22a260=_0x22a260-0x0;var _0x5382ef=_0xd4db[_0x22a260];return _0x5382ef;};'use strict';var Sequelize=require(_0xbd4d('0x0'));module[_0xbd4d('0x1')]={'name':{'type':Sequelize[_0xbd4d('0x2')],'allowNull':![],'unique':_0xbd4d('0x3')},'version':{'type':Sequelize[_0xbd4d('0x2')],'allowNull':![],'unique':_0xbd4d('0x3')},'main':{'type':Sequelize[_0xbd4d('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xbd4d('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xbd4d('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xbd4d('0x2')]},'logo':{'type':Sequelize[_0xbd4d('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xbd4d('0x5')},'description':{'type':Sequelize[_0xbd4d('0x2')]},'title':{'type':Sequelize[_0xbd4d('0x2')]},'remoteUri':{'type':Sequelize[_0xbd4d('0x2')]},'link':{'type':Sequelize[_0xbd4d('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index e67114f..514b3d5 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 _0xdb2b=['sort','pick','filter','where','map','type','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','reject','save','update','destroy','then','error','stack','name','Integration','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order'];(function(_0x5c490c,_0x17cc06){var _0x344996=function(_0x446176){while(--_0x446176){_0x5c490c['push'](_0x5c490c['shift']());}};_0x344996(++_0x17cc06);}(_0xdb2b,0xa2));var _0xbdb2=function(_0x4cdecc,_0x321d1a){_0x4cdecc=_0x4cdecc-0x0;var _0x3948a9=_0xdb2b[_0x4cdecc];return _0x3948a9;};'use strict';var pdf=require(_0xbdb2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbdb2('0x1'));var zipdir=require(_0xbdb2('0x2'));var jsonpatch=require(_0xbdb2('0x3'));var rp=require(_0xbdb2('0x4'));var moment=require(_0xbdb2('0x5'));var BPromise=require(_0xbdb2('0x6'));var Mustache=require(_0xbdb2('0x7'));var util=require(_0xbdb2('0x8'));var path=require(_0xbdb2('0x9'));var sox=require(_0xbdb2('0xa'));var csv=require(_0xbdb2('0xb'));var ejs=require(_0xbdb2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbdb2('0xd'));var jsforce=require(_0xbdb2('0xe'));var deskjs=require(_0xbdb2('0xf'));var toCsv=require(_0xbdb2('0xb'));var querystring=require(_0xbdb2('0x10'));var Papa=require(_0xbdb2('0x11'));var Redis=require('ioredis');var authService=require(_0xbdb2('0x12'));var qs=require(_0xbdb2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbdb2('0x14'));var logger=require(_0xbdb2('0x15'))('api');var utils=require(_0xbdb2('0x16'));var config=require(_0xbdb2('0x17'));var licenseUtil=require(_0xbdb2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c9d96,_0xb5cd89){_0xb5cd89=_0xb5cd89||0xcc;return function(_0xca2f9){if(_0xca2f9){return _0x2c9d96[_0xbdb2('0x19')](_0xb5cd89);}return _0x2c9d96['status'](_0xb5cd89)[_0xbdb2('0x1a')]();};}function respondWithResult(_0x475ffd,_0x500f1c){_0x500f1c=_0x500f1c||0xc8;return function(_0x5a6acf){if(_0x5a6acf){return _0x475ffd[_0xbdb2('0x1b')](_0x500f1c)[_0xbdb2('0x1c')](_0x5a6acf);}};}function respondWithFilteredResult(_0x15cfc0,_0x3c7e7e){return function(_0x767ab6){if(_0x767ab6){var _0xc38bda=_0x767ab6[_0xbdb2('0x1d')],_0x197822=_0x3c7e7e['offset'],_0x41c2ce=_0x3c7e7e[_0xbdb2('0x1e')]+_0x3c7e7e[_0xbdb2('0x1f')],_0x49f013;if(_0x41c2ce>=_0xc38bda){_0x41c2ce=_0xc38bda;_0x49f013=0xc8;}else{_0x49f013=0xce;}_0x15cfc0[_0xbdb2('0x1b')](_0x49f013);return _0x15cfc0['set']('Content-Range',_0x197822+'-'+_0x41c2ce+'/'+_0xc38bda)[_0xbdb2('0x1c')](_0x767ab6);}return null;};}function patchUpdates(_0x2e9c01){return function(_0x5619e8){try{jsonpatch['apply'](_0x5619e8,_0x2e9c01,!![]);}catch(_0x59ac40){return BPromise[_0xbdb2('0x20')](_0x59ac40);}return _0x5619e8[_0xbdb2('0x21')]();};}function saveUpdates(_0x3a9629,_0x228881){return function(_0x4062d7){if(_0x4062d7){return _0x4062d7[_0xbdb2('0x22')](_0x3a9629)['then'](function(_0x31eb52){return _0x31eb52;});}return null;};}function removeEntity(_0x557117,_0x2e8697){return function(_0x5c21c4){if(_0x5c21c4){return _0x5c21c4[_0xbdb2('0x23')]()[_0xbdb2('0x24')](function(){_0x557117['status'](0xcc)[_0xbdb2('0x1a')]();});}};}function handleEntityNotFound(_0x1efb1d,_0x48a477){return function(_0x4481d5){if(!_0x4481d5){_0x1efb1d[_0xbdb2('0x19')](0x194);}return _0x4481d5;};}function handleError(_0xdbfbbb,_0x48dc74){_0x48dc74=_0x48dc74||0x1f4;return function(_0x560feb){logger[_0xbdb2('0x25')](_0x560feb[_0xbdb2('0x26')]);if(_0x560feb['name']){delete _0x560feb[_0xbdb2('0x27')];}_0xdbfbbb[_0xbdb2('0x1b')](_0x48dc74)['send'](_0x560feb);};}exports['index']=function(_0x4bb221,_0x50d69b){var _0x596704={},_0x45d1a1={},_0x442b94={'count':0x0,'rows':[]};var _0x121312=_['map'](db[_0xbdb2('0x28')][_0xbdb2('0x29')],function(_0x1ad65a){return{'name':_0x1ad65a[_0xbdb2('0x2a')],'type':_0x1ad65a['type']['key']};});_0x45d1a1['model']=_['map'](_0x121312,_0xbdb2('0x27'));_0x45d1a1[_0xbdb2('0x2b')]=_[_0xbdb2('0x2c')](_0x4bb221[_0xbdb2('0x2b')]);_0x45d1a1[_0xbdb2('0x2d')]=_[_0xbdb2('0x2e')](_0x45d1a1['model'],_0x45d1a1['query']);_0x596704[_0xbdb2('0x2f')]=_[_0xbdb2('0x2e')](_0x45d1a1[_0xbdb2('0x30')],qs[_0xbdb2('0x31')](_0x4bb221['query'][_0xbdb2('0x31')]));_0x596704[_0xbdb2('0x2f')]=_0x596704[_0xbdb2('0x2f')][_0xbdb2('0x32')]?_0x596704['attributes']:_0x45d1a1[_0xbdb2('0x30')];if(!_0x4bb221[_0xbdb2('0x2b')][_0xbdb2('0x33')](_0xbdb2('0x34'))){_0x596704[_0xbdb2('0x1f')]=qs[_0xbdb2('0x1f')](_0x4bb221[_0xbdb2('0x2b')]['limit']);_0x596704[_0xbdb2('0x1e')]=qs['offset'](_0x4bb221[_0xbdb2('0x2b')][_0xbdb2('0x1e')]);}_0x596704[_0xbdb2('0x35')]=qs[_0xbdb2('0x36')](_0x4bb221[_0xbdb2('0x2b')][_0xbdb2('0x36')]);_0x596704['where']=qs[_0xbdb2('0x2d')](_[_0xbdb2('0x37')](_0x4bb221[_0xbdb2('0x2b')],_0x45d1a1['filters']),_0x121312);if(_0x4bb221['query'][_0xbdb2('0x38')]){_0x596704[_0xbdb2('0x39')]=_['merge'](_0x596704[_0xbdb2('0x39')],{'$or':_[_0xbdb2('0x3a')](_0x121312,function(_0xf3b945){if(_0xf3b945[_0xbdb2('0x3b')]!=='VIRTUAL'){var _0x53f7e5={};_0x53f7e5[_0xf3b945[_0xbdb2('0x27')]]={'$like':'%'+_0x4bb221[_0xbdb2('0x2b')]['filter']+'%'};return _0x53f7e5;}})});}_0x596704=_[_0xbdb2('0x3c')]({},_0x596704,_0x4bb221[_0xbdb2('0x3d')]);var _0x33e735={'where':_0x596704[_0xbdb2('0x39')]};return db['Integration'][_0xbdb2('0x1d')](_0x33e735)[_0xbdb2('0x24')](function(_0x3b4b09){_0x442b94['count']=_0x3b4b09;if(_0x4bb221[_0xbdb2('0x2b')]['includeAll']){_0x596704[_0xbdb2('0x3e')]=[{'all':!![]}];}return db[_0xbdb2('0x28')][_0xbdb2('0x3f')](_0x596704);})['then'](function(_0x169a21){_0x442b94[_0xbdb2('0x40')]=_0x169a21;return _0x442b94;})[_0xbdb2('0x24')](respondWithFilteredResult(_0x50d69b,_0x596704))[_0xbdb2('0x41')](handleError(_0x50d69b,null));};exports[_0xbdb2('0x42')]=function(_0x36fba6,_0x272447){var _0x4e7b17={'raw':![],'where':{'id':_0x36fba6[_0xbdb2('0x43')]['id']}},_0x37ec13={};_0x37ec13['model']=_['keys'](db[_0xbdb2('0x28')][_0xbdb2('0x29')]);_0x37ec13[_0xbdb2('0x2b')]=_[_0xbdb2('0x2c')](_0x36fba6[_0xbdb2('0x2b')]);_0x37ec13[_0xbdb2('0x2d')]=_[_0xbdb2('0x2e')](_0x37ec13['model'],_0x37ec13['query']);_0x4e7b17['attributes']=_[_0xbdb2('0x2e')](_0x37ec13[_0xbdb2('0x30')],qs['fields'](_0x36fba6[_0xbdb2('0x2b')][_0xbdb2('0x31')]));_0x4e7b17[_0xbdb2('0x2f')]=_0x4e7b17[_0xbdb2('0x2f')][_0xbdb2('0x32')]?_0x4e7b17['attributes']:_0x37ec13['model'];if(_0x36fba6[_0xbdb2('0x2b')][_0xbdb2('0x44')]){_0x4e7b17['include']=[{'all':!![]}];}_0x4e7b17=_['merge']({},_0x4e7b17,_0x36fba6[_0xbdb2('0x3d')]);return db[_0xbdb2('0x28')][_0xbdb2('0x45')](_0x4e7b17)[_0xbdb2('0x24')](handleEntityNotFound(_0x272447,null))[_0xbdb2('0x24')](respondWithResult(_0x272447,null))[_0xbdb2('0x41')](handleError(_0x272447,null));};exports['create']=function(_0x13cd6b,_0x114085){return db['Integration'][_0xbdb2('0x46')](_0x13cd6b[_0xbdb2('0x47')],{})[_0xbdb2('0x24')](respondWithResult(_0x114085,0xc9))['catch'](handleError(_0x114085,null));};exports['update']=function(_0x452d05,_0x105582){if(_0x452d05[_0xbdb2('0x47')]['id']){delete _0x452d05[_0xbdb2('0x47')]['id'];}return db[_0xbdb2('0x28')][_0xbdb2('0x45')]({'where':{'id':_0x452d05[_0xbdb2('0x43')]['id']}})['then'](handleEntityNotFound(_0x105582,null))[_0xbdb2('0x24')](saveUpdates(_0x452d05[_0xbdb2('0x47')],null))[_0xbdb2('0x24')](respondWithResult(_0x105582,null))[_0xbdb2('0x41')](handleError(_0x105582,null));};exports['destroy']=function(_0x4d9f4d,_0x1c6159){return db[_0xbdb2('0x28')][_0xbdb2('0x45')]({'where':{'id':_0x4d9f4d['params']['id']}})[_0xbdb2('0x24')](handleEntityNotFound(_0x1c6159,null))[_0xbdb2('0x24')](removeEntity(_0x1c6159,null))[_0xbdb2('0x41')](handleError(_0x1c6159,null));}; \ No newline at end of file +var _0xea0a=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Integration','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','pick','filter','where','merge','type','options','count','includeAll','include','findAll','rows','catch','show','create','body','find','params','html-pdf','zip-dir','fast-json-patch'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0xea0a,0x99));var _0xaea0=function(_0xe6beba,_0x3f15d1){_0xe6beba=_0xe6beba-0x0;var _0x2f1c08=_0xea0a[_0xe6beba];return _0x2f1c08;};'use strict';var pdf=require(_0xaea0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaea0('0x1'));var jsonpatch=require(_0xaea0('0x2'));var rp=require(_0xaea0('0x3'));var moment=require(_0xaea0('0x4'));var BPromise=require(_0xaea0('0x5'));var Mustache=require(_0xaea0('0x6'));var util=require(_0xaea0('0x7'));var path=require(_0xaea0('0x8'));var sox=require(_0xaea0('0x9'));var csv=require(_0xaea0('0xa'));var ejs=require(_0xaea0('0xb'));var fs=require('fs');var _=require(_0xaea0('0xc'));var squel=require(_0xaea0('0xd'));var crypto=require(_0xaea0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xaea0('0xf'));var toCsv=require(_0xaea0('0xa'));var querystring=require(_0xaea0('0x10'));var Papa=require(_0xaea0('0x11'));var Redis=require(_0xaea0('0x12'));var authService=require(_0xaea0('0x13'));var qs=require(_0xaea0('0x14'));var as=require(_0xaea0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaea0('0x16'))(_0xaea0('0x17'));var utils=require(_0xaea0('0x18'));var config=require(_0xaea0('0x19'));var licenseUtil=require(_0xaea0('0x1a'));var db=require(_0xaea0('0x1b'))['db'];function respondWithStatusCode(_0x417bda,_0x3b60be){_0x3b60be=_0x3b60be||0xcc;return function(_0x17601e){if(_0x17601e){return _0x417bda[_0xaea0('0x1c')](_0x3b60be);}return _0x417bda[_0xaea0('0x1d')](_0x3b60be)['end']();};}function respondWithResult(_0x31ece8,_0x21c35c){_0x21c35c=_0x21c35c||0xc8;return function(_0x414e78){if(_0x414e78){return _0x31ece8[_0xaea0('0x1d')](_0x21c35c)[_0xaea0('0x1e')](_0x414e78);}};}function respondWithFilteredResult(_0x42dff9,_0x45b8e9){return function(_0x4781a1){if(_0x4781a1){var _0x544bc5=_0x4781a1['count'],_0x52ef85=_0x45b8e9['offset'],_0x3e763d=_0x45b8e9['offset']+_0x45b8e9[_0xaea0('0x1f')],_0x7183d9;if(_0x3e763d>=_0x544bc5){_0x3e763d=_0x544bc5;_0x7183d9=0xc8;}else{_0x7183d9=0xce;}_0x42dff9['status'](_0x7183d9);return _0x42dff9[_0xaea0('0x20')](_0xaea0('0x21'),_0x52ef85+'-'+_0x3e763d+'/'+_0x544bc5)['json'](_0x4781a1);}return null;};}function patchUpdates(_0x20a8ae){return function(_0x4c249b){try{jsonpatch['apply'](_0x4c249b,_0x20a8ae,!![]);}catch(_0x5cdfca){return BPromise[_0xaea0('0x22')](_0x5cdfca);}return _0x4c249b[_0xaea0('0x23')]();};}function saveUpdates(_0x39cf7d,_0x3b7c76){return function(_0x402381){if(_0x402381){return _0x402381[_0xaea0('0x24')](_0x39cf7d)[_0xaea0('0x25')](function(_0x4a26f3){return _0x4a26f3;});}return null;};}function removeEntity(_0x4c9475,_0x259e80){return function(_0x520572){if(_0x520572){return _0x520572[_0xaea0('0x26')]()[_0xaea0('0x25')](function(){_0x4c9475[_0xaea0('0x1d')](0xcc)[_0xaea0('0x27')]();});}};}function handleEntityNotFound(_0x3090e5,_0x41b6cf){return function(_0x3d5f4d){if(!_0x3d5f4d){_0x3090e5[_0xaea0('0x1c')](0x194);}return _0x3d5f4d;};}function handleError(_0x5b5b54,_0x463410){_0x463410=_0x463410||0x1f4;return function(_0x5d1519){logger[_0xaea0('0x28')](_0x5d1519[_0xaea0('0x29')]);if(_0x5d1519[_0xaea0('0x2a')]){delete _0x5d1519[_0xaea0('0x2a')];}_0x5b5b54[_0xaea0('0x1d')](_0x463410)[_0xaea0('0x2b')](_0x5d1519);};}exports[_0xaea0('0x2c')]=function(_0x5d558e,_0x1cc74b){var _0x407d48={},_0x4ea449={},_0x3bb32b={'count':0x0,'rows':[]};var _0x539732=_[_0xaea0('0x2d')](db[_0xaea0('0x2e')][_0xaea0('0x2f')],function(_0x254f10){return{'name':_0x254f10['fieldName'],'type':_0x254f10['type'][_0xaea0('0x30')]};});_0x4ea449['model']=_['map'](_0x539732,'name');_0x4ea449[_0xaea0('0x31')]=_[_0xaea0('0x32')](_0x5d558e[_0xaea0('0x31')]);_0x4ea449[_0xaea0('0x33')]=_[_0xaea0('0x34')](_0x4ea449[_0xaea0('0x35')],_0x4ea449['query']);_0x407d48['attributes']=_['intersection'](_0x4ea449['model'],qs[_0xaea0('0x36')](_0x5d558e[_0xaea0('0x31')][_0xaea0('0x36')]));_0x407d48[_0xaea0('0x37')]=_0x407d48[_0xaea0('0x37')][_0xaea0('0x38')]?_0x407d48[_0xaea0('0x37')]:_0x4ea449['model'];if(!_0x5d558e[_0xaea0('0x31')][_0xaea0('0x39')](_0xaea0('0x3a'))){_0x407d48[_0xaea0('0x1f')]=qs[_0xaea0('0x1f')](_0x5d558e[_0xaea0('0x31')][_0xaea0('0x1f')]);_0x407d48[_0xaea0('0x3b')]=qs['offset'](_0x5d558e[_0xaea0('0x31')][_0xaea0('0x3b')]);}_0x407d48['order']=qs[_0xaea0('0x3c')](_0x5d558e['query'][_0xaea0('0x3c')]);_0x407d48['where']=qs[_0xaea0('0x33')](_[_0xaea0('0x3d')](_0x5d558e[_0xaea0('0x31')],_0x4ea449['filters']),_0x539732);if(_0x5d558e['query'][_0xaea0('0x3e')]){_0x407d48[_0xaea0('0x3f')]=_[_0xaea0('0x40')](_0x407d48[_0xaea0('0x3f')],{'$or':_['map'](_0x539732,function(_0x30c938){if(_0x30c938[_0xaea0('0x41')]!=='VIRTUAL'){var _0x3c18b9={};_0x3c18b9[_0x30c938[_0xaea0('0x2a')]]={'$like':'%'+_0x5d558e[_0xaea0('0x31')][_0xaea0('0x3e')]+'%'};return _0x3c18b9;}})});}_0x407d48=_[_0xaea0('0x40')]({},_0x407d48,_0x5d558e[_0xaea0('0x42')]);var _0x4dea0e={'where':_0x407d48['where']};return db[_0xaea0('0x2e')][_0xaea0('0x43')](_0x4dea0e)[_0xaea0('0x25')](function(_0x2fdc6b){_0x3bb32b[_0xaea0('0x43')]=_0x2fdc6b;if(_0x5d558e['query'][_0xaea0('0x44')]){_0x407d48[_0xaea0('0x45')]=[{'all':!![]}];}return db['Integration'][_0xaea0('0x46')](_0x407d48);})[_0xaea0('0x25')](function(_0xc05166){_0x3bb32b[_0xaea0('0x47')]=_0xc05166;return _0x3bb32b;})[_0xaea0('0x25')](respondWithFilteredResult(_0x1cc74b,_0x407d48))[_0xaea0('0x48')](handleError(_0x1cc74b,null));};exports[_0xaea0('0x49')]=function(_0x2674e9,_0x414b1b){var _0x4d93f2={'raw':![],'where':{'id':_0x2674e9['params']['id']}},_0x54f552={};_0x54f552[_0xaea0('0x35')]=_['keys'](db[_0xaea0('0x2e')][_0xaea0('0x2f')]);_0x54f552['query']=_[_0xaea0('0x32')](_0x2674e9[_0xaea0('0x31')]);_0x54f552[_0xaea0('0x33')]=_[_0xaea0('0x34')](_0x54f552[_0xaea0('0x35')],_0x54f552[_0xaea0('0x31')]);_0x4d93f2['attributes']=_['intersection'](_0x54f552[_0xaea0('0x35')],qs['fields'](_0x2674e9['query']['fields']));_0x4d93f2['attributes']=_0x4d93f2['attributes']['length']?_0x4d93f2[_0xaea0('0x37')]:_0x54f552[_0xaea0('0x35')];if(_0x2674e9['query']['includeAll']){_0x4d93f2[_0xaea0('0x45')]=[{'all':!![]}];}_0x4d93f2=_[_0xaea0('0x40')]({},_0x4d93f2,_0x2674e9[_0xaea0('0x42')]);return db[_0xaea0('0x2e')]['find'](_0x4d93f2)['then'](handleEntityNotFound(_0x414b1b,null))[_0xaea0('0x25')](respondWithResult(_0x414b1b,null))[_0xaea0('0x48')](handleError(_0x414b1b,null));};exports[_0xaea0('0x4a')]=function(_0xee2411,_0x3acb02){return db[_0xaea0('0x2e')][_0xaea0('0x4a')](_0xee2411[_0xaea0('0x4b')],{})['then'](respondWithResult(_0x3acb02,0xc9))[_0xaea0('0x48')](handleError(_0x3acb02,null));};exports[_0xaea0('0x24')]=function(_0x966ccf,_0x4758c5){if(_0x966ccf[_0xaea0('0x4b')]['id']){delete _0x966ccf[_0xaea0('0x4b')]['id'];}return db['Integration'][_0xaea0('0x4c')]({'where':{'id':_0x966ccf['params']['id']}})[_0xaea0('0x25')](handleEntityNotFound(_0x4758c5,null))['then'](saveUpdates(_0x966ccf['body'],null))['then'](respondWithResult(_0x4758c5,null))[_0xaea0('0x48')](handleError(_0x4758c5,null));};exports[_0xaea0('0x26')]=function(_0x1902a5,_0x328617){return db[_0xaea0('0x2e')][_0xaea0('0x4c')]({'where':{'id':_0x1902a5[_0xaea0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x328617,null))[_0xaea0('0x25')](removeEntity(_0x328617,null))[_0xaea0('0x48')](handleError(_0x328617,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 20459b5..d27494e 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 _0x593b=['define','integrations','lodash','api','bluebird','../../config/environment'];(function(_0x3e6016,_0x46f40f){var _0x2f2190=function(_0x288f26){while(--_0x288f26){_0x3e6016['push'](_0x3e6016['shift']());}};_0x2f2190(++_0x46f40f);}(_0x593b,0x1a6));var _0xb593=function(_0x160780,_0x30d0d3){_0x160780=_0x160780-0x0;var _0x45ae9e=_0x593b[_0x160780];return _0x45ae9e;};'use strict';var _=require(_0xb593('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb593('0x1'));var moment=require('moment');var BPromise=require(_0xb593('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb593('0x3'));var attributes=require('./integration.attributes');module['exports']=function(_0x5cf301,_0x214861){return _0x5cf301[_0xb593('0x4')]('Integration',attributes,{'tableName':_0xb593('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fc8=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','define','integrations','lodash'];(function(_0x52ae34,_0x512c57){var _0x598a28=function(_0x2c5049){while(--_0x2c5049){_0x52ae34['push'](_0x52ae34['shift']());}};_0x598a28(++_0x512c57);}(_0x2fc8,0x1ac));var _0x82fc=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x2fc8[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x82fc('0x0'));var util=require(_0x82fc('0x1'));var logger=require(_0x82fc('0x2'))(_0x82fc('0x3'));var moment=require(_0x82fc('0x4'));var BPromise=require(_0x82fc('0x5'));var rp=require(_0x82fc('0x6'));var fs=require('fs');var path=require(_0x82fc('0x7'));var rimraf=require(_0x82fc('0x8'));var config=require(_0x82fc('0x9'));var attributes=require(_0x82fc('0xa'));module['exports']=function(_0x10014a,_0x236849){return _0x10014a[_0x82fc('0xb')]('Integration',attributes,{'tableName':_0x82fc('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 e174f26..08d8c7c 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 _0xac47=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x7a42d9,_0x5a0c72){var _0x278b78=function(_0x1fa030){while(--_0x1fa030){_0x7a42d9['push'](_0x7a42d9['shift']());}};_0x278b78(++_0x5a0c72);}(_0xac47,0x1af));var _0x7ac4=function(_0x3bcb7c,_0x5af870){_0x3bcb7c=_0x3bcb7c-0x0;var _0x584411=_0xac47[_0x3bcb7c];return _0x584411;};'use strict';var _=require(_0x7ac4('0x0'));var util=require(_0x7ac4('0x1'));var moment=require(_0x7ac4('0x2'));var BPromise=require(_0x7ac4('0x3'));var rs=require(_0x7ac4('0x4'));var fs=require('fs');var Redis=require(_0x7ac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ac4('0x6'));var logger=require(_0x7ac4('0x7'))('rpc');var config=require(_0x7ac4('0x8'));var jayson=require(_0x7ac4('0x9'));var client=jayson[_0x7ac4('0xa')][_0x7ac4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x438c8e,_0x5c3623,_0x18c34d){return new BPromise(function(_0x435e68,_0xd8ec5f){return client[_0x7ac4('0xc')](_0x438c8e,_0x18c34d)[_0x7ac4('0xd')](function(_0x112fa0){logger[_0x7ac4('0xe')](_0x7ac4('0xf'),_0x5c3623,_0x7ac4('0x10'));logger[_0x7ac4('0x11')](_0x7ac4('0x12'),_0x5c3623,'request\x20sent',JSON[_0x7ac4('0x13')](_0x112fa0));if(_0x112fa0[_0x7ac4('0x14')]){if(_0x112fa0[_0x7ac4('0x14')]['code']===0x1f4){logger[_0x7ac4('0x14')](_0x7ac4('0xf'),_0x5c3623,_0x112fa0[_0x7ac4('0x14')]['message']);return _0xd8ec5f(_0x112fa0['error'][_0x7ac4('0x15')]);}logger[_0x7ac4('0x14')]('Integration,\x20%s,\x20%s',_0x5c3623,_0x112fa0[_0x7ac4('0x14')][_0x7ac4('0x15')]);return _0x435e68(_0x112fa0[_0x7ac4('0x14')][_0x7ac4('0x15')]);}else{logger['info'](_0x7ac4('0xf'),_0x5c3623,_0x7ac4('0x10'));_0x435e68(_0x112fa0[_0x7ac4('0x16')][_0x7ac4('0x15')]);}})[_0x7ac4('0x17')](function(_0x334141){logger[_0x7ac4('0x14')](_0x7ac4('0xf'),_0x5c3623,_0x334141);_0xd8ec5f(_0x334141);});});} \ No newline at end of file +var _0x3a0f=['info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x22c409,_0x11f723){var _0x14e88e=function(_0x10c595){while(--_0x10c595){_0x22c409['push'](_0x22c409['shift']());}};_0x14e88e(++_0x11f723);}(_0x3a0f,0x145));var _0xf3a0=function(_0x50d777,_0x5ebd2e){_0x50d777=_0x50d777-0x0;var _0x4a99c9=_0x3a0f[_0x50d777];return _0x4a99c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf3a0('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3a0('0x1'));var db=require(_0xf3a0('0x2'))['db'];var utils=require(_0xf3a0('0x3'));var logger=require(_0xf3a0('0x4'))(_0xf3a0('0x5'));var config=require(_0xf3a0('0x6'));var jayson=require(_0xf3a0('0x7'));var client=jayson[_0xf3a0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4736b7,_0x313b13,_0x3e550f){return new BPromise(function(_0xb2784d,_0x5d64bc){return client[_0xf3a0('0x9')](_0x4736b7,_0x3e550f)[_0xf3a0('0xa')](function(_0x214171){logger[_0xf3a0('0xb')](_0xf3a0('0xc'),_0x313b13,_0xf3a0('0xd'));logger[_0xf3a0('0xe')](_0xf3a0('0xf'),_0x313b13,'request\x20sent',JSON[_0xf3a0('0x10')](_0x214171));if(_0x214171[_0xf3a0('0x11')]){if(_0x214171[_0xf3a0('0x11')]['code']===0x1f4){logger[_0xf3a0('0x11')](_0xf3a0('0xc'),_0x313b13,_0x214171[_0xf3a0('0x11')]['message']);return _0x5d64bc(_0x214171['error'][_0xf3a0('0x12')]);}logger[_0xf3a0('0x11')](_0xf3a0('0xc'),_0x313b13,_0x214171[_0xf3a0('0x11')]['message']);return _0xb2784d(_0x214171[_0xf3a0('0x11')][_0xf3a0('0x12')]);}else{logger[_0xf3a0('0xb')](_0xf3a0('0xc'),_0x313b13,_0xf3a0('0xd'));_0xb2784d(_0x214171[_0xf3a0('0x13')][_0xf3a0('0x12')]);}})[_0xf3a0('0x14')](function(_0x59061a){logger['error'](_0xf3a0('0xc'),_0x313b13,_0x59061a);_0x5d64bc(_0x59061a);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 6947aff..2c3736d 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 _0xaea2=['../../components/auth/service','isAuthenticated','index','/describe','describe','get','/:id','post','put','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x4f683e,_0x353322){var _0xc3cc7c=function(_0x2ee5eb){while(--_0x2ee5eb){_0x4f683e['push'](_0x4f683e['shift']());}};_0xc3cc7c(++_0x353322);}(_0xaea2,0x12c));var _0x2aea=function(_0x1e1d07,_0x299b1e){_0x1e1d07=_0x1e1d07-0x0;var _0x225dce=_0xaea2[_0x1e1d07];return _0x225dce;};'use strict';var multer=require(_0x2aea('0x0'));var util=require(_0x2aea('0x1'));var path=require(_0x2aea('0x2'));var timeout=require(_0x2aea('0x3'));var express=require(_0x2aea('0x4'));var router=express[_0x2aea('0x5')]();var auth=require(_0x2aea('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./integrationReport.controller');router['get']('/',auth[_0x2aea('0x7')](),controller[_0x2aea('0x8')]);router['get'](_0x2aea('0x9'),auth[_0x2aea('0x7')](),controller[_0x2aea('0xa')]);router[_0x2aea('0xb')](_0x2aea('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2aea('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2aea('0xe')]('/:id',auth[_0x2aea('0x7')](),controller['update']);router[_0x2aea('0xf')]('/:id',auth[_0x2aea('0x7')](),controller[_0x2aea('0x10')]);module['exports']=router; \ No newline at end of file +var _0xaab8=['create','put','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','show'];(function(_0x152bf1,_0x21aef3){var _0x33d955=function(_0x327076){while(--_0x327076){_0x152bf1['push'](_0x152bf1['shift']());}};_0x33d955(++_0x21aef3);}(_0xaab8,0x1a8));var _0x8aab=function(_0x130143,_0x2f35cb){_0x130143=_0x130143-0x0;var _0x2eb08e=_0xaab8[_0x130143];return _0x2eb08e;};'use strict';var multer=require(_0x8aab('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8aab('0x1'));var express=require(_0x8aab('0x2'));var router=express[_0x8aab('0x3')]();var auth=require(_0x8aab('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8aab('0x5'));var controller=require('./integrationReport.controller');router[_0x8aab('0x6')]('/',auth[_0x8aab('0x7')](),controller['index']);router[_0x8aab('0x6')](_0x8aab('0x8'),auth[_0x8aab('0x7')](),controller['describe']);router['get'](_0x8aab('0x9'),auth[_0x8aab('0x7')](),controller[_0x8aab('0xa')]);router['post']('/',auth[_0x8aab('0x7')](),controller[_0x8aab('0xb')]);router[_0x8aab('0xc')](_0x8aab('0x9'),auth[_0x8aab('0x7')](),controller['update']);router[_0x8aab('0xd')](_0x8aab('0x9'),auth[_0x8aab('0x7')](),controller[_0x8aab('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 02527fc..f0e1010 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 _0x0627=['INTEGER','BOOLEAN','DATE','TEXT','ENUM','SENT','SENDING','FAILED','sequelize','exports','STRING'];(function(_0x62ee5e,_0x5be856){var _0x1a1785=function(_0x33d801){while(--_0x33d801){_0x62ee5e['push'](_0x62ee5e['shift']());}};_0x1a1785(++_0x5be856);}(_0x0627,0x1ec));var _0x7062=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x0627[_0x2eb5bc];return _0x51c7b1;};'use strict';var Sequelize=require(_0x7062('0x0'));module[_0x7062('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x7062('0x2')]},'exitStatus':{'type':Sequelize[_0x7062('0x2')]},'ticketId':{'type':Sequelize[_0x7062('0x2')]},'integrationId':{'type':Sequelize[_0x7062('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7062('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7062('0x2')]},'queue':{'type':Sequelize[_0x7062('0x2')]},'interface':{'type':Sequelize[_0x7062('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x7062('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7062('0x5')]},'talktime':{'type':Sequelize[_0x7062('0x3')]},'agentacw':{'type':Sequelize[_0x7062('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7062('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x7062('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7062('0x5')]},'agentdump':{'type':Sequelize[_0x7062('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7062('0x2')]},'channelstate':{'type':Sequelize[_0x7062('0x3')]},'channelstatedesc':{'type':Sequelize[_0x7062('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7062('0x2')]},'language':{'type':Sequelize[_0x7062('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7062('0x2')]},'exten':{'type':Sequelize[_0x7062('0x2')]},'priority':{'type':Sequelize[_0x7062('0x2')]},'destchannel':{'type':Sequelize[_0x7062('0x2')]},'destchannelstate':{'type':Sequelize[_0x7062('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7062('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7062('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x7062('0x2')]},'destlanguage':{'type':Sequelize[_0x7062('0x2')]},'destaccountcode':{'type':Sequelize[_0x7062('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x7062('0x2')]},'destpriority':{'type':Sequelize[_0x7062('0x2')]},'destuniqueid':{'type':Sequelize[_0x7062('0x2')]},'messageId':{'type':Sequelize[_0x7062('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x7062('0x2')]},'to':{'type':Sequelize[_0x7062('0x2')]},'cc':{'type':Sequelize[_0x7062('0x2')]},'attachment':{'type':Sequelize[_0x7062('0x6')]},'html':{'type':Sequelize[_0x7062('0x6')]},'text':{'type':Sequelize[_0x7062('0x6')]},'status':{'type':Sequelize[_0x7062('0x7')](_0x7062('0x8'),_0x7062('0x9'),'RECEIVED',_0x7062('0xa'))},'url':{'type':Sequelize[_0x7062('0x2')]},'app':{'type':Sequelize[_0x7062('0x2')]},'appdata':{'type':Sequelize[_0x7062('0x2')]},'projectId':{'type':Sequelize[_0x7062('0x3')]}}; \ No newline at end of file +var _0x3d7f=['DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x3d7f,0xef));var _0xf3d7=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x3d7f[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0xf3d7('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xf3d7('0x1')]},'exitStatus':{'type':Sequelize[_0xf3d7('0x1')]},'ticketId':{'type':Sequelize[_0xf3d7('0x1')]},'integrationId':{'type':Sequelize[_0xf3d7('0x2')]},'contacts':{'type':Sequelize[_0xf3d7('0x1')]},'uniqueid':{'type':Sequelize[_0xf3d7('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf3d7('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf3d7('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xf3d7('0x3')]},'holdtime':{'type':Sequelize[_0xf3d7('0x2')]},'agentcomplete':{'type':Sequelize[_0xf3d7('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf3d7('0x3')]},'talktime':{'type':Sequelize[_0xf3d7('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf3d7('0x2')]},'reason':{'type':Sequelize[_0xf3d7('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xf3d7('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf3d7('0x3')]},'agentdump':{'type':Sequelize[_0xf3d7('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf3d7('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf3d7('0x2')]},'channelstatedesc':{'type':Sequelize[_0xf3d7('0x1')]},'connectedlinenum':{'type':Sequelize[_0xf3d7('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf3d7('0x1')]},'exten':{'type':Sequelize[_0xf3d7('0x1')]},'priority':{'type':Sequelize[_0xf3d7('0x1')]},'destchannel':{'type':Sequelize[_0xf3d7('0x1')]},'destchannelstate':{'type':Sequelize[_0xf3d7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xf3d7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xf3d7('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf3d7('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf3d7('0x1')]},'destlanguage':{'type':Sequelize[_0xf3d7('0x1')]},'destaccountcode':{'type':Sequelize[_0xf3d7('0x1')]},'destcontext':{'type':Sequelize[_0xf3d7('0x1')]},'destexten':{'type':Sequelize[_0xf3d7('0x1')]},'destpriority':{'type':Sequelize[_0xf3d7('0x1')]},'destuniqueid':{'type':Sequelize[_0xf3d7('0x1')]},'messageId':{'type':Sequelize[_0xf3d7('0x1')]},'inReplyTo':{'type':Sequelize[_0xf3d7('0x1')]},'subject':{'type':Sequelize[_0xf3d7('0x1')]},'from':{'type':Sequelize[_0xf3d7('0x1')]},'to':{'type':Sequelize[_0xf3d7('0x1')]},'cc':{'type':Sequelize[_0xf3d7('0x1')]},'attachment':{'type':Sequelize[_0xf3d7('0x5')]},'html':{'type':Sequelize[_0xf3d7('0x5')]},'text':{'type':Sequelize[_0xf3d7('0x5')]},'status':{'type':Sequelize[_0xf3d7('0x6')](_0xf3d7('0x7'),_0xf3d7('0x8'),_0xf3d7('0x9'),_0xf3d7('0xa'))},'url':{'type':Sequelize[_0xf3d7('0x1')]},'app':{'type':Sequelize[_0xf3d7('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xf3d7('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 57654db..576452d 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 _0xc9f3=['error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy'];(function(_0x55e7ae,_0x328d98){var _0x4c19bd=function(_0x52a04c){while(--_0x52a04c){_0x55e7ae['push'](_0x55e7ae['shift']());}};_0x4c19bd(++_0x328d98);}(_0xc9f3,0x103));var _0x3c9f=function(_0x304fe3,_0x4d4fe8){_0x304fe3=_0x304fe3-0x0;var _0xad2fde=_0xc9f3[_0x304fe3];return _0xad2fde;};'use strict';var pdf=require(_0x3c9f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3c9f('0x1'));var zipdir=require(_0x3c9f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c9f('0x3'));var moment=require(_0x3c9f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3c9f('0x5'));var path=require(_0x3c9f('0x6'));var sox=require(_0x3c9f('0x7'));var csv=require(_0x3c9f('0x8'));var ejs=require(_0x3c9f('0x9'));var fs=require('fs');var _=require(_0x3c9f('0xa'));var squel=require(_0x3c9f('0xb'));var crypto=require(_0x3c9f('0xc'));var jsforce=require(_0x3c9f('0xd'));var deskjs=require(_0x3c9f('0xe'));var toCsv=require(_0x3c9f('0x8'));var querystring=require(_0x3c9f('0xf'));var Papa=require(_0x3c9f('0x10'));var Redis=require('ioredis');var authService=require(_0x3c9f('0x11'));var qs=require(_0x3c9f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3c9f('0x13'));var utils=require(_0x3c9f('0x14'));var config=require(_0x3c9f('0x15'));var licenseUtil=require(_0x3c9f('0x16'));var db=require(_0x3c9f('0x17'))['db'];function respondWithStatusCode(_0x3ecbdc,_0x173895){_0x173895=_0x173895||0xcc;return function(_0x31f891){if(_0x31f891){return _0x3ecbdc[_0x3c9f('0x18')](_0x173895);}return _0x3ecbdc[_0x3c9f('0x19')](_0x173895)[_0x3c9f('0x1a')]();};}function respondWithResult(_0x27d746,_0x4ddc9d){_0x4ddc9d=_0x4ddc9d||0xc8;return function(_0x541c45){if(_0x541c45){return _0x27d746[_0x3c9f('0x19')](_0x4ddc9d)[_0x3c9f('0x1b')](_0x541c45);}};}function respondWithFilteredResult(_0x1531d9,_0x3da72c){return function(_0x46f83a){if(_0x46f83a){var _0x3bf95b=_0x46f83a[_0x3c9f('0x1c')],_0x3ec8ff=_0x3da72c[_0x3c9f('0x1d')],_0x3211ed=_0x3da72c['offset']+_0x3da72c['limit'],_0x6ff13b;if(_0x3211ed>=_0x3bf95b){_0x3211ed=_0x3bf95b;_0x6ff13b=0xc8;}else{_0x6ff13b=0xce;}_0x1531d9[_0x3c9f('0x19')](_0x6ff13b);return _0x1531d9[_0x3c9f('0x1e')](_0x3c9f('0x1f'),_0x3ec8ff+'-'+_0x3211ed+'/'+_0x3bf95b)[_0x3c9f('0x1b')](_0x46f83a);}return null;};}function patchUpdates(_0x40d6c5){return function(_0x1913a8){try{jsonpatch['apply'](_0x1913a8,_0x40d6c5,!![]);}catch(_0x1de46f){return BPromise[_0x3c9f('0x20')](_0x1de46f);}return _0x1913a8[_0x3c9f('0x21')]();};}function saveUpdates(_0x332b90,_0x56ed86){return function(_0x4a83a9){if(_0x4a83a9){return _0x4a83a9[_0x3c9f('0x22')](_0x332b90)[_0x3c9f('0x23')](function(_0x4bfae9){return _0x4bfae9;});}return null;};}function removeEntity(_0x50414c,_0x1227dc){return function(_0x99589b){if(_0x99589b){return _0x99589b[_0x3c9f('0x24')]()[_0x3c9f('0x23')](function(){_0x50414c[_0x3c9f('0x19')](0xcc)[_0x3c9f('0x1a')]();});}};}function handleEntityNotFound(_0x5a2025,_0x2e8187){return function(_0x465f74){if(!_0x465f74){_0x5a2025[_0x3c9f('0x18')](0x194);}return _0x465f74;};}function handleError(_0xc9b2a0,_0x18cd87){_0x18cd87=_0x18cd87||0x1f4;return function(_0x54ad3c){logger[_0x3c9f('0x25')](_0x54ad3c['stack']);if(_0x54ad3c[_0x3c9f('0x26')]){delete _0x54ad3c[_0x3c9f('0x26')];}_0xc9b2a0['status'](_0x18cd87)[_0x3c9f('0x27')](_0x54ad3c);};}exports[_0x3c9f('0x28')]=function(_0x53a3e2,_0x4fbc90){var _0x168b01={},_0x3ae352={},_0x2e74eb={'count':0x0,'rows':[]};var _0x26f8b5=_[_0x3c9f('0x29')](db[_0x3c9f('0x2a')][_0x3c9f('0x2b')],function(_0x489d4e){return{'name':_0x489d4e[_0x3c9f('0x2c')],'type':_0x489d4e[_0x3c9f('0x2d')]['key']};});_0x3ae352[_0x3c9f('0x2e')]=_['map'](_0x26f8b5,_0x3c9f('0x26'));_0x3ae352[_0x3c9f('0x2f')]=_[_0x3c9f('0x30')](_0x53a3e2[_0x3c9f('0x2f')]);_0x3ae352[_0x3c9f('0x31')]=_[_0x3c9f('0x32')](_0x3ae352[_0x3c9f('0x2e')],_0x3ae352[_0x3c9f('0x2f')]);_0x168b01[_0x3c9f('0x33')]=_[_0x3c9f('0x32')](_0x3ae352[_0x3c9f('0x2e')],qs[_0x3c9f('0x34')](_0x53a3e2[_0x3c9f('0x2f')]['fields']));_0x168b01[_0x3c9f('0x33')]=_0x168b01[_0x3c9f('0x33')][_0x3c9f('0x35')]?_0x168b01['attributes']:_0x3ae352['model'];if(!_0x53a3e2['query'][_0x3c9f('0x36')](_0x3c9f('0x37'))){_0x168b01[_0x3c9f('0x38')]=qs['limit'](_0x53a3e2[_0x3c9f('0x2f')]['limit']);_0x168b01[_0x3c9f('0x1d')]=qs[_0x3c9f('0x1d')](_0x53a3e2[_0x3c9f('0x2f')][_0x3c9f('0x1d')]);}_0x168b01['order']=qs[_0x3c9f('0x39')](_0x53a3e2['query'][_0x3c9f('0x39')]);_0x168b01['where']=qs[_0x3c9f('0x31')](_['pick'](_0x53a3e2[_0x3c9f('0x2f')],_0x3ae352['filters']),_0x26f8b5);if(_0x53a3e2[_0x3c9f('0x2f')][_0x3c9f('0x3a')]){_0x168b01[_0x3c9f('0x3b')]=_[_0x3c9f('0x3c')](_0x168b01[_0x3c9f('0x3b')],{'$or':_[_0x3c9f('0x29')](_0x26f8b5,function(_0x1788fc){if(_0x1788fc[_0x3c9f('0x2d')]!==_0x3c9f('0x3d')){var _0x70a3e6={};_0x70a3e6[_0x1788fc[_0x3c9f('0x26')]]={'$like':'%'+_0x53a3e2[_0x3c9f('0x2f')][_0x3c9f('0x3a')]+'%'};return _0x70a3e6;}})});}_0x168b01=_[_0x3c9f('0x3c')]({},_0x168b01,_0x53a3e2[_0x3c9f('0x3e')]);var _0x4555fa={'where':_0x168b01[_0x3c9f('0x3b')]};return db[_0x3c9f('0x2a')][_0x3c9f('0x1c')](_0x4555fa)[_0x3c9f('0x23')](function(_0x12ca57){_0x2e74eb[_0x3c9f('0x1c')]=_0x12ca57;if(_0x53a3e2['query'][_0x3c9f('0x3f')]){_0x168b01[_0x3c9f('0x40')]=[{'all':!![]}];}return db[_0x3c9f('0x2a')][_0x3c9f('0x41')](_0x168b01);})['then'](function(_0x9f938){_0x2e74eb[_0x3c9f('0x42')]=_0x9f938;return _0x2e74eb;})['then'](respondWithFilteredResult(_0x4fbc90,_0x168b01))[_0x3c9f('0x43')](handleError(_0x4fbc90,null));};exports[_0x3c9f('0x44')]=function(_0x22ce38,_0x22b788){var _0x2db057={'raw':![],'where':{'id':_0x22ce38[_0x3c9f('0x45')]['id']}},_0x408a6d={};_0x408a6d[_0x3c9f('0x2e')]=_['keys'](db[_0x3c9f('0x2a')][_0x3c9f('0x2b')]);_0x408a6d['query']=_[_0x3c9f('0x30')](_0x22ce38['query']);_0x408a6d['filters']=_['intersection'](_0x408a6d['model'],_0x408a6d[_0x3c9f('0x2f')]);_0x2db057[_0x3c9f('0x33')]=_[_0x3c9f('0x32')](_0x408a6d[_0x3c9f('0x2e')],qs[_0x3c9f('0x34')](_0x22ce38[_0x3c9f('0x2f')]['fields']));_0x2db057[_0x3c9f('0x33')]=_0x2db057['attributes']['length']?_0x2db057[_0x3c9f('0x33')]:_0x408a6d[_0x3c9f('0x2e')];if(_0x22ce38['query'][_0x3c9f('0x3f')]){_0x2db057['include']=[{'all':!![]}];}_0x2db057=_[_0x3c9f('0x3c')]({},_0x2db057,_0x22ce38[_0x3c9f('0x3e')]);return db[_0x3c9f('0x2a')]['find'](_0x2db057)[_0x3c9f('0x23')](handleEntityNotFound(_0x22b788,null))[_0x3c9f('0x23')](respondWithResult(_0x22b788,null))[_0x3c9f('0x43')](handleError(_0x22b788,null));};exports[_0x3c9f('0x46')]=function(_0x3a231,_0x452587){return db[_0x3c9f('0x2a')][_0x3c9f('0x46')](_0x3a231[_0x3c9f('0x47')],{})[_0x3c9f('0x23')](respondWithResult(_0x452587,0xc9))[_0x3c9f('0x43')](handleError(_0x452587,null));};exports['update']=function(_0x472be4,_0x414cc4){if(_0x472be4[_0x3c9f('0x47')]['id']){delete _0x472be4[_0x3c9f('0x47')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x472be4[_0x3c9f('0x45')]['id']}})[_0x3c9f('0x23')](handleEntityNotFound(_0x414cc4,null))[_0x3c9f('0x23')](saveUpdates(_0x472be4['body'],null))['then'](respondWithResult(_0x414cc4,null))[_0x3c9f('0x43')](handleError(_0x414cc4,null));};exports[_0x3c9f('0x24')]=function(_0x4e5d11,_0x7794e8){return db[_0x3c9f('0x2a')][_0x3c9f('0x48')]({'where':{'id':_0x4e5d11[_0x3c9f('0x45')]['id']}})['then'](handleEntityNotFound(_0x7794e8,null))[_0x3c9f('0x23')](removeEntity(_0x7794e8,null))[_0x3c9f('0x43')](handleError(_0x7794e8,null));};exports[_0x3c9f('0x49')]=function(_0x4c5838,_0x38b167){return db[_0x3c9f('0x2a')]['describe']()['then'](respondWithResult(_0x38b167,null))['catch'](handleError(_0x38b167,null));}; \ No newline at end of file +var _0x871c=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','findAll','catch','show','include','find','create','body','update','params','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x33c791,_0x49eb4c){var _0x58d29a=function(_0x544363){while(--_0x544363){_0x33c791['push'](_0x33c791['shift']());}};_0x58d29a(++_0x49eb4c);}(_0x871c,0x97));var _0xc871=function(_0x480260,_0x11fa66){_0x480260=_0x480260-0x0;var _0x343415=_0x871c[_0x480260];return _0x343415;};'use strict';var pdf=require(_0xc871('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc871('0x1'));var zipdir=require(_0xc871('0x2'));var jsonpatch=require(_0xc871('0x3'));var rp=require(_0xc871('0x4'));var moment=require(_0xc871('0x5'));var BPromise=require(_0xc871('0x6'));var Mustache=require(_0xc871('0x7'));var util=require(_0xc871('0x8'));var path=require(_0xc871('0x9'));var sox=require(_0xc871('0xa'));var csv=require(_0xc871('0xb'));var ejs=require(_0xc871('0xc'));var fs=require('fs');var _=require(_0xc871('0xd'));var squel=require(_0xc871('0xe'));var crypto=require(_0xc871('0xf'));var jsforce=require(_0xc871('0x10'));var deskjs=require(_0xc871('0x11'));var toCsv=require(_0xc871('0xb'));var querystring=require(_0xc871('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc871('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc871('0x14'))(_0xc871('0x15'));var utils=require(_0xc871('0x16'));var config=require(_0xc871('0x17'));var licenseUtil=require(_0xc871('0x18'));var db=require(_0xc871('0x19'))['db'];function respondWithStatusCode(_0x436da8,_0x5be6df){_0x5be6df=_0x5be6df||0xcc;return function(_0x10551f){if(_0x10551f){return _0x436da8[_0xc871('0x1a')](_0x5be6df);}return _0x436da8[_0xc871('0x1b')](_0x5be6df)[_0xc871('0x1c')]();};}function respondWithResult(_0x150ece,_0xbf1113){_0xbf1113=_0xbf1113||0xc8;return function(_0x30657b){if(_0x30657b){return _0x150ece[_0xc871('0x1b')](_0xbf1113)[_0xc871('0x1d')](_0x30657b);}};}function respondWithFilteredResult(_0x2d1e22,_0x50961f){return function(_0x5a27af){if(_0x5a27af){var _0x4f1635=_0x5a27af['count'],_0x5392d9=_0x50961f[_0xc871('0x1e')],_0x5a0fd1=_0x50961f[_0xc871('0x1e')]+_0x50961f[_0xc871('0x1f')],_0x2944ee;if(_0x5a0fd1>=_0x4f1635){_0x5a0fd1=_0x4f1635;_0x2944ee=0xc8;}else{_0x2944ee=0xce;}_0x2d1e22[_0xc871('0x1b')](_0x2944ee);return _0x2d1e22['set'](_0xc871('0x20'),_0x5392d9+'-'+_0x5a0fd1+'/'+_0x4f1635)['json'](_0x5a27af);}return null;};}function patchUpdates(_0x26b723){return function(_0x3a4ce4){try{jsonpatch[_0xc871('0x21')](_0x3a4ce4,_0x26b723,!![]);}catch(_0x5634a5){return BPromise[_0xc871('0x22')](_0x5634a5);}return _0x3a4ce4[_0xc871('0x23')]();};}function saveUpdates(_0x29faa0,_0x24a218){return function(_0x37f92e){if(_0x37f92e){return _0x37f92e['update'](_0x29faa0)['then'](function(_0x3ed5f3){return _0x3ed5f3;});}return null;};}function removeEntity(_0xc0700a,_0x5e9994){return function(_0x14f97e){if(_0x14f97e){return _0x14f97e['destroy']()[_0xc871('0x24')](function(){_0xc0700a[_0xc871('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x348b2b,_0xc67321){return function(_0x1d94f5){if(!_0x1d94f5){_0x348b2b[_0xc871('0x1a')](0x194);}return _0x1d94f5;};}function handleError(_0x40bfa6,_0x533d32){_0x533d32=_0x533d32||0x1f4;return function(_0x9f5e62){logger[_0xc871('0x25')](_0x9f5e62[_0xc871('0x26')]);if(_0x9f5e62[_0xc871('0x27')]){delete _0x9f5e62[_0xc871('0x27')];}_0x40bfa6[_0xc871('0x1b')](_0x533d32)[_0xc871('0x28')](_0x9f5e62);};}exports[_0xc871('0x29')]=function(_0x5b312c,_0x36da83){var _0x11591e={},_0x9edb86={},_0x217fe6={'count':0x0,'rows':[]};var _0x5b6085=_[_0xc871('0x2a')](db[_0xc871('0x2b')][_0xc871('0x2c')],function(_0x5af1f2){return{'name':_0x5af1f2[_0xc871('0x2d')],'type':_0x5af1f2[_0xc871('0x2e')][_0xc871('0x2f')]};});_0x9edb86[_0xc871('0x30')]=_[_0xc871('0x2a')](_0x5b6085,_0xc871('0x27'));_0x9edb86['query']=_[_0xc871('0x31')](_0x5b312c['query']);_0x9edb86[_0xc871('0x32')]=_[_0xc871('0x33')](_0x9edb86['model'],_0x9edb86[_0xc871('0x34')]);_0x11591e[_0xc871('0x35')]=_[_0xc871('0x33')](_0x9edb86['model'],qs[_0xc871('0x36')](_0x5b312c['query'][_0xc871('0x36')]));_0x11591e[_0xc871('0x35')]=_0x11591e[_0xc871('0x35')][_0xc871('0x37')]?_0x11591e['attributes']:_0x9edb86[_0xc871('0x30')];if(!_0x5b312c[_0xc871('0x34')][_0xc871('0x38')](_0xc871('0x39'))){_0x11591e[_0xc871('0x1f')]=qs[_0xc871('0x1f')](_0x5b312c[_0xc871('0x34')]['limit']);_0x11591e[_0xc871('0x1e')]=qs[_0xc871('0x1e')](_0x5b312c['query'][_0xc871('0x1e')]);}_0x11591e[_0xc871('0x3a')]=qs[_0xc871('0x3b')](_0x5b312c[_0xc871('0x34')]['sort']);_0x11591e['where']=qs[_0xc871('0x32')](_[_0xc871('0x3c')](_0x5b312c['query'],_0x9edb86['filters']),_0x5b6085);if(_0x5b312c[_0xc871('0x34')][_0xc871('0x3d')]){_0x11591e[_0xc871('0x3e')]=_[_0xc871('0x3f')](_0x11591e[_0xc871('0x3e')],{'$or':_[_0xc871('0x2a')](_0x5b6085,function(_0xd35204){if(_0xd35204[_0xc871('0x2e')]!==_0xc871('0x40')){var _0x466de3={};_0x466de3[_0xd35204['name']]={'$like':'%'+_0x5b312c[_0xc871('0x34')][_0xc871('0x3d')]+'%'};return _0x466de3;}})});}_0x11591e=_[_0xc871('0x3f')]({},_0x11591e,_0x5b312c['options']);var _0x33c171={'where':_0x11591e['where']};return db[_0xc871('0x2b')][_0xc871('0x41')](_0x33c171)['then'](function(_0x10758f){_0x217fe6[_0xc871('0x41')]=_0x10758f;if(_0x5b312c[_0xc871('0x34')][_0xc871('0x42')]){_0x11591e['include']=[{'all':!![]}];}return db[_0xc871('0x2b')][_0xc871('0x43')](_0x11591e);})['then'](function(_0x221fa9){_0x217fe6['rows']=_0x221fa9;return _0x217fe6;})[_0xc871('0x24')](respondWithFilteredResult(_0x36da83,_0x11591e))[_0xc871('0x44')](handleError(_0x36da83,null));};exports[_0xc871('0x45')]=function(_0x228477,_0x5780fe){var _0x1bd5a8={'raw':![],'where':{'id':_0x228477['params']['id']}},_0x27f468={};_0x27f468[_0xc871('0x30')]=_[_0xc871('0x31')](db[_0xc871('0x2b')]['rawAttributes']);_0x27f468[_0xc871('0x34')]=_[_0xc871('0x31')](_0x228477[_0xc871('0x34')]);_0x27f468['filters']=_[_0xc871('0x33')](_0x27f468[_0xc871('0x30')],_0x27f468[_0xc871('0x34')]);_0x1bd5a8[_0xc871('0x35')]=_[_0xc871('0x33')](_0x27f468['model'],qs[_0xc871('0x36')](_0x228477[_0xc871('0x34')][_0xc871('0x36')]));_0x1bd5a8[_0xc871('0x35')]=_0x1bd5a8[_0xc871('0x35')]['length']?_0x1bd5a8[_0xc871('0x35')]:_0x27f468[_0xc871('0x30')];if(_0x228477[_0xc871('0x34')]['includeAll']){_0x1bd5a8[_0xc871('0x46')]=[{'all':!![]}];}_0x1bd5a8=_['merge']({},_0x1bd5a8,_0x228477['options']);return db[_0xc871('0x2b')][_0xc871('0x47')](_0x1bd5a8)[_0xc871('0x24')](handleEntityNotFound(_0x5780fe,null))[_0xc871('0x24')](respondWithResult(_0x5780fe,null))['catch'](handleError(_0x5780fe,null));};exports[_0xc871('0x48')]=function(_0x174bdf,_0x155dcb){return db[_0xc871('0x2b')][_0xc871('0x48')](_0x174bdf[_0xc871('0x49')],{})[_0xc871('0x24')](respondWithResult(_0x155dcb,0xc9))[_0xc871('0x44')](handleError(_0x155dcb,null));};exports[_0xc871('0x4a')]=function(_0x3d2c3d,_0x4df438){if(_0x3d2c3d[_0xc871('0x49')]['id']){delete _0x3d2c3d['body']['id'];}return db[_0xc871('0x2b')][_0xc871('0x47')]({'where':{'id':_0x3d2c3d[_0xc871('0x4b')]['id']}})[_0xc871('0x24')](handleEntityNotFound(_0x4df438,null))[_0xc871('0x24')](saveUpdates(_0x3d2c3d[_0xc871('0x49')],null))[_0xc871('0x24')](respondWithResult(_0x4df438,null))[_0xc871('0x44')](handleError(_0x4df438,null));};exports[_0xc871('0x4c')]=function(_0x1754e8,_0x20af4e){return db[_0xc871('0x2b')][_0xc871('0x47')]({'where':{'id':_0x1754e8[_0xc871('0x4b')]['id']}})[_0xc871('0x24')](handleEntityNotFound(_0x20af4e,null))['then'](removeEntity(_0x20af4e,null))[_0xc871('0x44')](handleError(_0x20af4e,null));};exports[_0xc871('0x4d')]=function(_0x3d9fb2,_0x24bd4d){return db[_0xc871('0x2b')]['describe']()[_0xc871('0x24')](respondWithResult(_0x24bd4d,null))[_0xc871('0x44')](handleError(_0x24bd4d,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index f8b75dc..a6e689a 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 _0x0d1e=['define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports'];(function(_0x3a3f0c,_0x174f79){var _0x184722=function(_0x4fb5c3){while(--_0x4fb5c3){_0x3a3f0c['push'](_0x3a3f0c['shift']());}};_0x184722(++_0x174f79);}(_0x0d1e,0x153));var _0xe0d1=function(_0x27dce9,_0x10d2f8){_0x27dce9=_0x27dce9-0x0;var _0x1fec31=_0x0d1e[_0x27dce9];return _0x1fec31;};'use strict';var _=require(_0xe0d1('0x0'));var util=require(_0xe0d1('0x1'));var logger=require(_0xe0d1('0x2'))(_0xe0d1('0x3'));var moment=require('moment');var BPromise=require(_0xe0d1('0x4'));var rp=require(_0xe0d1('0x5'));var fs=require('fs');var path=require(_0xe0d1('0x6'));var rimraf=require(_0xe0d1('0x7'));var config=require(_0xe0d1('0x8'));var attributes=require(_0xe0d1('0x9'));module[_0xe0d1('0xa')]=function(_0x27ad0a,_0x2567fd){return _0x27ad0a[_0xe0d1('0xb')](_0xe0d1('0xc'),attributes,{'tableName':_0xe0d1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c09=['exports','IntegrationReport','report_integration','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1f1305,_0x2435f5){var _0x571a9d=function(_0x411dfc){while(--_0x411dfc){_0x1f1305['push'](_0x1f1305['shift']());}};_0x571a9d(++_0x2435f5);}(_0x4c09,0x81));var _0x94c0=function(_0x1951de,_0x173387){_0x1951de=_0x1951de-0x0;var _0x418584=_0x4c09[_0x1951de];return _0x418584;};'use strict';var _=require('lodash');var util=require(_0x94c0('0x0'));var logger=require(_0x94c0('0x1'))(_0x94c0('0x2'));var moment=require('moment');var BPromise=require(_0x94c0('0x3'));var rp=require(_0x94c0('0x4'));var fs=require('fs');var path=require(_0x94c0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x94c0('0x6')]=function(_0x356ae5,_0x515f87){return _0x356ae5['define'](_0x94c0('0x7'),attributes,{'tableName':_0x94c0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 217315d..b820969 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 _0x757a=['request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x535284,_0xc17857){var _0x58c3fb=function(_0x39aa0c){while(--_0x39aa0c){_0x535284['push'](_0x535284['shift']());}};_0x58c3fb(++_0xc17857);}(_0x757a,0xde));var _0xa757=function(_0x389405,_0x58761e){_0x389405=_0x389405-0x0;var _0x5f12cc=_0x757a[_0x389405];return _0x5f12cc;};'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']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('IntegrationReport,\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);});});} \ No newline at end of file +var _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8603,0x190));var _0x3860=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0x8603[_0x559a80];return _0x42f555;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 5ffc746..8183742 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 _0xedd9=['getIntervals','post','addInterval','addIntervals','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sub_intervals'];(function(_0x4d3874,_0x2ba7b9){var _0x5aa0da=function(_0x20f68d){while(--_0x20f68d){_0x4d3874['push'](_0x4d3874['shift']());}};_0x5aa0da(++_0x2ba7b9);}(_0xedd9,0xfc));var _0x9edd=function(_0x1810b8,_0x3ad751){_0x1810b8=_0x1810b8-0x0;var _0x216864=_0xedd9[_0x1810b8];return _0x216864;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./interval.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xd')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xd')]('/:id/sub_intervals/create_many',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);router[_0x9edd('0x10')](_0x9edd('0x11'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0x11'),auth['isAuthenticated'](),controller[_0x9edd('0x14')]);module[_0x9edd('0x15')]=router; \ No newline at end of file +var _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x5ac84c,_0xdf7ba0){var _0x37a12f=function(_0x521e3f){while(--_0x521e3f){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x37a12f(++_0xdf7ba0);}(_0x008c,0x188));var _0xc008=function(_0x1e49ee,_0x3257b6){_0x1e49ee=_0x1e49ee-0x0;var _0x3dcf1e=_0x008c[_0x1e49ee];return _0x3dcf1e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index bc3c732..ac9ec43 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 _0x6ff5=['exports','STRING','sequelize'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6ff5,0x1eb));var _0x56ff=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x6ff5[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0x56ff('0x0'));module[_0x56ff('0x1')]={'name':{'type':Sequelize[_0x56ff('0x2')]},'description':{'type':Sequelize[_0x56ff('0x2')]},'interval':{'type':Sequelize[_0x56ff('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xcdf6=['STRING','exports'];(function(_0x1ea729,_0x3552bb){var _0x3576c4=function(_0xb12275){while(--_0xb12275){_0x1ea729['push'](_0x1ea729['shift']());}};_0x3576c4(++_0x3552bb);}(_0xcdf6,0x10b));var _0x6cdf=function(_0xa36415,_0xd4450d){_0xa36415=_0xa36415-0x0;var _0x5071b1=_0xcdf6[_0xa36415];return _0x5071b1;};'use strict';var Sequelize=require('sequelize');module[_0x6cdf('0x0')]={'name':{'type':Sequelize[_0x6cdf('0x1')]},'description':{'type':Sequelize[_0x6cdf('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 27c8bd2..3f20f11 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 _0xc1a9=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','error','name','send','index','map','Interval','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','count','include','catch','show','params','rawAttributes','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','addInterval','IntervalId','findOne','getIntervals','addIntervals','sequelize','transaction','bulkCreate','findAll','html-pdf','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc1a9,0x16f));var _0x9c1a=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0xc1a9[_0x398294];return _0x2a872d;};'use strict';var pdf=require(_0x9c1a('0x0'));var emlformat=require(_0x9c1a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9c1a('0x2'));var jsonpatch=require(_0x9c1a('0x3'));var rp=require('request-promise');var moment=require(_0x9c1a('0x4'));var BPromise=require(_0x9c1a('0x5'));var Mustache=require(_0x9c1a('0x6'));var util=require(_0x9c1a('0x7'));var path=require(_0x9c1a('0x8'));var sox=require(_0x9c1a('0x9'));var csv=require(_0x9c1a('0xa'));var ejs=require(_0x9c1a('0xb'));var fs=require('fs');var _=require(_0x9c1a('0xc'));var squel=require('squel');var crypto=require(_0x9c1a('0xd'));var jsforce=require(_0x9c1a('0xe'));var deskjs=require(_0x9c1a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9c1a('0x10'));var authService=require(_0x9c1a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c1a('0x12'));var logger=require(_0x9c1a('0x13'))('api');var utils=require(_0x9c1a('0x14'));var config=require(_0x9c1a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c1a('0x16'))['db'];var extensions=require(_0x9c1a('0x17'));function respondWithStatusCode(_0x478130,_0x2b96bf){_0x2b96bf=_0x2b96bf||0xcc;return function(_0xf296bc){if(_0xf296bc){return _0x478130[_0x9c1a('0x18')](_0x2b96bf);}return _0x478130[_0x9c1a('0x19')](_0x2b96bf)[_0x9c1a('0x1a')]();};}function respondWithResult(_0x2c6049,_0x17467a){_0x17467a=_0x17467a||0xc8;return function(_0x21e6d6){if(_0x21e6d6){return _0x2c6049[_0x9c1a('0x19')](_0x17467a)[_0x9c1a('0x1b')](_0x21e6d6);}};}function respondWithFilteredResult(_0x5e9eb4,_0x160465){return function(_0x54c644){if(_0x54c644){var _0x49a876=_0x54c644['count'],_0x1a4c02=_0x160465[_0x9c1a('0x1c')],_0x6f499a=_0x160465[_0x9c1a('0x1c')]+_0x160465['limit'],_0x5e3006;if(_0x6f499a>=_0x49a876){_0x6f499a=_0x49a876;_0x5e3006=0xc8;}else{_0x5e3006=0xce;}_0x5e9eb4[_0x9c1a('0x19')](_0x5e3006);return _0x5e9eb4[_0x9c1a('0x1d')](_0x9c1a('0x1e'),_0x1a4c02+'-'+_0x6f499a+'/'+_0x49a876)[_0x9c1a('0x1b')](_0x54c644);}return null;};}function patchUpdates(_0x214bfe){return function(_0x26a303){try{jsonpatch[_0x9c1a('0x1f')](_0x26a303,_0x214bfe,!![]);}catch(_0x296d54){return BPromise[_0x9c1a('0x20')](_0x296d54);}return _0x26a303[_0x9c1a('0x21')]();};}function saveUpdates(_0x8b418a,_0xa92266){return function(_0x572dab){if(_0x572dab){return _0x572dab[_0x9c1a('0x22')](_0x8b418a)[_0x9c1a('0x23')](function(_0x4a7022){return _0x4a7022;});}return null;};}function removeEntity(_0x17931a,_0x47b1c4){return function(_0x26b1bc){if(_0x26b1bc){return _0x26b1bc[_0x9c1a('0x24')]()['then'](function(){var _0x7f4076=_0x26b1bc[_0x9c1a('0x25')]({'plain':!![]});var _0x15772e=_0x9c1a('0x26');return db['UserProfileResource'][_0x9c1a('0x24')]({'where':{'type':_0x15772e,'resourceId':_0x7f4076['id']}})[_0x9c1a('0x23')](function(){return _0x26b1bc;});})[_0x9c1a('0x23')](function(){_0x17931a[_0x9c1a('0x19')](0xcc)[_0x9c1a('0x1a')]();});}};}function handleEntityNotFound(_0x24cd6b,_0x2f6b32){return function(_0xf1a3e1){if(!_0xf1a3e1){_0x24cd6b['sendStatus'](0x194);}return _0xf1a3e1;};}function handleError(_0x23c392,_0x29ce22){_0x29ce22=_0x29ce22||0x1f4;return function(_0x3c8a1a){logger[_0x9c1a('0x27')](_0x3c8a1a['stack']);if(_0x3c8a1a[_0x9c1a('0x28')]){delete _0x3c8a1a[_0x9c1a('0x28')];}_0x23c392[_0x9c1a('0x19')](_0x29ce22)[_0x9c1a('0x29')](_0x3c8a1a);};}exports[_0x9c1a('0x2a')]=function(_0x303b8d,_0x596a0f){var _0x54b396={},_0xe6f011={},_0x230b93={'count':0x0,'rows':[]};var _0x236434=_[_0x9c1a('0x2b')](db[_0x9c1a('0x2c')]['rawAttributes'],function(_0x5ea995){return{'name':_0x5ea995[_0x9c1a('0x2d')],'type':_0x5ea995[_0x9c1a('0x2e')][_0x9c1a('0x2f')]};});_0xe6f011[_0x9c1a('0x30')]=_['map'](_0x236434,_0x9c1a('0x28'));_0xe6f011[_0x9c1a('0x31')]=_[_0x9c1a('0x32')](_0x303b8d[_0x9c1a('0x31')]);_0xe6f011['filters']=_[_0x9c1a('0x33')](_0xe6f011[_0x9c1a('0x30')],_0xe6f011['query']);_0x54b396[_0x9c1a('0x34')]=_[_0x9c1a('0x33')](_0xe6f011[_0x9c1a('0x30')],qs['fields'](_0x303b8d['query'][_0x9c1a('0x35')]));_0x54b396['attributes']=_0x54b396[_0x9c1a('0x34')]['length']?_0x54b396['attributes']:_0xe6f011[_0x9c1a('0x30')];if(!_0x303b8d[_0x9c1a('0x31')][_0x9c1a('0x36')](_0x9c1a('0x37'))){_0x54b396[_0x9c1a('0x38')]=qs[_0x9c1a('0x38')](_0x303b8d[_0x9c1a('0x31')][_0x9c1a('0x38')]);_0x54b396['offset']=qs['offset'](_0x303b8d[_0x9c1a('0x31')]['offset']);}_0x54b396[_0x9c1a('0x39')]=qs[_0x9c1a('0x3a')](_0x303b8d[_0x9c1a('0x31')][_0x9c1a('0x3a')]);_0x54b396[_0x9c1a('0x3b')]=qs[_0x9c1a('0x3c')](_[_0x9c1a('0x3d')](_0x303b8d['query'],_0xe6f011[_0x9c1a('0x3c')]),_0x236434);if(_0x303b8d['query'][_0x9c1a('0x3e')]){_0x54b396[_0x9c1a('0x3b')]=_[_0x9c1a('0x3f')](_0x54b396[_0x9c1a('0x3b')],{'$or':_[_0x9c1a('0x2b')](_0x236434,function(_0x137050){if(_0x137050[_0x9c1a('0x2e')]!=='VIRTUAL'){var _0x53beea={};_0x53beea[_0x137050[_0x9c1a('0x28')]]={'$like':'%'+_0x303b8d[_0x9c1a('0x31')][_0x9c1a('0x3e')]+'%'};return _0x53beea;}})});}_0x54b396=_[_0x9c1a('0x3f')]({},_0x54b396,_0x303b8d[_0x9c1a('0x40')]);var _0x2a57c8={'where':_0x54b396[_0x9c1a('0x3b')]};return db[_0x9c1a('0x2c')][_0x9c1a('0x41')](_0x2a57c8)['then'](function(_0x597cfa){_0x230b93['count']=_0x597cfa;if(_0x303b8d[_0x9c1a('0x31')]['includeAll']){_0x54b396[_0x9c1a('0x42')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x54b396);})[_0x9c1a('0x23')](function(_0x7b1fc8){_0x230b93['rows']=_0x7b1fc8;return _0x230b93;})[_0x9c1a('0x23')](respondWithFilteredResult(_0x596a0f,_0x54b396))[_0x9c1a('0x43')](handleError(_0x596a0f,null));};exports[_0x9c1a('0x44')]=function(_0x4e24a9,_0xcee819){var _0x58ee9b={'raw':!![],'where':{'id':_0x4e24a9[_0x9c1a('0x45')]['id']}},_0x26dc43={};_0x26dc43[_0x9c1a('0x30')]=_['keys'](db[_0x9c1a('0x2c')][_0x9c1a('0x46')]);_0x26dc43['query']=_[_0x9c1a('0x32')](_0x4e24a9[_0x9c1a('0x31')]);_0x26dc43[_0x9c1a('0x3c')]=_['intersection'](_0x26dc43[_0x9c1a('0x30')],_0x26dc43[_0x9c1a('0x31')]);_0x58ee9b[_0x9c1a('0x34')]=_['intersection'](_0x26dc43[_0x9c1a('0x30')],qs[_0x9c1a('0x35')](_0x4e24a9[_0x9c1a('0x31')][_0x9c1a('0x35')]));_0x58ee9b[_0x9c1a('0x34')]=_0x58ee9b['attributes'][_0x9c1a('0x47')]?_0x58ee9b[_0x9c1a('0x34')]:_0x26dc43[_0x9c1a('0x30')];if(_0x4e24a9[_0x9c1a('0x31')][_0x9c1a('0x48')]){_0x58ee9b['include']=[{'all':!![]}];}_0x58ee9b=_['merge']({},_0x58ee9b,_0x4e24a9['options']);return db[_0x9c1a('0x2c')][_0x9c1a('0x49')](_0x58ee9b)['then'](handleEntityNotFound(_0xcee819,null))[_0x9c1a('0x23')](respondWithResult(_0xcee819,null))[_0x9c1a('0x43')](handleError(_0xcee819,null));};exports[_0x9c1a('0x4a')]=function(_0x570bee,_0x25756a){return db[_0x9c1a('0x2c')][_0x9c1a('0x4a')](_0x570bee[_0x9c1a('0x4b')],{})[_0x9c1a('0x23')](function(_0xda96a9){var _0x4f84bb=_0x570bee[_0x9c1a('0x4c')][_0x9c1a('0x25')]({'plain':!![]});if(!_0x4f84bb)throw new Error(_0x9c1a('0x4d'));if(_0x4f84bb[_0x9c1a('0x4e')]===_0x9c1a('0x4c')){var _0x1c61cf=_0xda96a9['get']({'plain':!![]});var _0x44fc69='Intervals';return db[_0x9c1a('0x4f')][_0x9c1a('0x49')]({'where':{'name':_0x44fc69,'userProfileId':_0x4f84bb[_0x9c1a('0x50')]},'raw':!![]})[_0x9c1a('0x23')](function(_0x186c1f){if(_0x186c1f&&_0x186c1f[_0x9c1a('0x51')]===0x0){return db[_0x9c1a('0x52')][_0x9c1a('0x4a')]({'name':_0x1c61cf[_0x9c1a('0x28')],'resourceId':_0x1c61cf['id'],'type':_0x186c1f[_0x9c1a('0x28')],'sectionId':_0x186c1f['id']},{})[_0x9c1a('0x23')](function(){return _0xda96a9;});}else{return _0xda96a9;}})[_0x9c1a('0x43')](function(_0x15eae6){logger[_0x9c1a('0x27')](_0x9c1a('0x53'),_0x15eae6);throw _0x15eae6;});}return _0xda96a9;})['then'](respondWithResult(_0x25756a,0xc9))[_0x9c1a('0x43')](handleError(_0x25756a,null));};exports['update']=function(_0x3bf9e5,_0x61f05){if(_0x3bf9e5['body']['id']){delete _0x3bf9e5[_0x9c1a('0x4b')]['id'];}return db[_0x9c1a('0x2c')]['find']({'where':{'id':_0x3bf9e5[_0x9c1a('0x45')]['id']}})[_0x9c1a('0x23')](handleEntityNotFound(_0x61f05,null))[_0x9c1a('0x23')](saveUpdates(_0x3bf9e5[_0x9c1a('0x4b')],null))[_0x9c1a('0x23')](respondWithResult(_0x61f05,null))[_0x9c1a('0x43')](handleError(_0x61f05,null));};exports[_0x9c1a('0x24')]=function(_0x25378f,_0x3fdaca){return db['Interval'][_0x9c1a('0x49')]({'where':{'id':_0x25378f[_0x9c1a('0x45')]['id']}})[_0x9c1a('0x23')](handleEntityNotFound(_0x3fdaca,null))[_0x9c1a('0x23')](removeEntity(_0x3fdaca,null))[_0x9c1a('0x43')](handleError(_0x3fdaca,null));};exports[_0x9c1a('0x54')]=function(_0x2d7ecf,_0x5709a4,_0x498991){if(_0x2d7ecf[_0x9c1a('0x4b')]['id']){delete _0x2d7ecf[_0x9c1a('0x4b')]['id'];}return db[_0x9c1a('0x2c')][_0x9c1a('0x49')]({'where':{'id':_0x2d7ecf[_0x9c1a('0x45')]['id']}})[_0x9c1a('0x23')](handleEntityNotFound(_0x5709a4,null))[_0x9c1a('0x23')](function(_0x3c24d7){if(_0x3c24d7){_0x2d7ecf[_0x9c1a('0x4b')][_0x9c1a('0x55')]=_0x3c24d7['id'];return db[_0x9c1a('0x2c')][_0x9c1a('0x4a')](_0x2d7ecf['body']);}})['then'](respondWithResult(_0x5709a4,null))[_0x9c1a('0x43')](handleError(_0x5709a4,null));};exports['getIntervals']=function(_0x4cda64,_0x18c27a,_0x113ca2){var _0x3db7d5={};var _0x5c9728={};var _0x56aa30;var _0xa22576;return db[_0x9c1a('0x2c')][_0x9c1a('0x56')]({'where':{'id':_0x4cda64[_0x9c1a('0x45')]['id']}})[_0x9c1a('0x23')](handleEntityNotFound(_0x18c27a,null))[_0x9c1a('0x23')](function(_0x195a0d){if(_0x195a0d){_0x56aa30=_0x195a0d;_0x5c9728[_0x9c1a('0x30')]=_[_0x9c1a('0x32')](db['Interval'][_0x9c1a('0x46')]);_0x5c9728[_0x9c1a('0x31')]=_['keys'](_0x4cda64[_0x9c1a('0x31')]);_0x5c9728[_0x9c1a('0x3c')]=_[_0x9c1a('0x33')](_0x5c9728[_0x9c1a('0x30')],_0x5c9728[_0x9c1a('0x31')]);_0x3db7d5[_0x9c1a('0x34')]=_[_0x9c1a('0x33')](_0x5c9728[_0x9c1a('0x30')],qs[_0x9c1a('0x35')](_0x4cda64[_0x9c1a('0x31')][_0x9c1a('0x35')]));_0x3db7d5[_0x9c1a('0x34')]=_0x3db7d5[_0x9c1a('0x34')][_0x9c1a('0x47')]?_0x3db7d5[_0x9c1a('0x34')]:_0x5c9728[_0x9c1a('0x30')];_0x3db7d5[_0x9c1a('0x39')]=qs['sort'](_0x4cda64[_0x9c1a('0x31')][_0x9c1a('0x3a')]);_0x3db7d5[_0x9c1a('0x3b')]=qs[_0x9c1a('0x3c')](_[_0x9c1a('0x3d')](_0x4cda64[_0x9c1a('0x31')],_0x5c9728[_0x9c1a('0x3c')]));if(_0x4cda64[_0x9c1a('0x31')][_0x9c1a('0x3e')]){_0x3db7d5['where']=_['merge'](_0x3db7d5['where'],{'$or':_[_0x9c1a('0x2b')](_0x3db7d5[_0x9c1a('0x34')],function(_0x303c59){var _0x3f8cfe={};_0x3f8cfe[_0x303c59]={'$like':'%'+_0x4cda64['query'][_0x9c1a('0x3e')]+'%'};return _0x3f8cfe;})});}_0x3db7d5=_[_0x9c1a('0x3f')]({},_0x3db7d5,_0x4cda64[_0x9c1a('0x40')]);return _0x56aa30[_0x9c1a('0x57')](_0x3db7d5);}})[_0x9c1a('0x23')](function(_0x98e1dd){if(_0x98e1dd){_0xa22576=_0x98e1dd[_0x9c1a('0x47')];if(!_0x4cda64[_0x9c1a('0x31')]['hasOwnProperty'](_0x9c1a('0x37'))){_0x3db7d5[_0x9c1a('0x38')]=qs[_0x9c1a('0x38')](_0x4cda64[_0x9c1a('0x31')][_0x9c1a('0x38')]);_0x3db7d5[_0x9c1a('0x1c')]=qs[_0x9c1a('0x1c')](_0x4cda64[_0x9c1a('0x31')][_0x9c1a('0x1c')]);}return _0x56aa30['getIntervals'](_0x3db7d5);}})[_0x9c1a('0x23')](function(_0x44f82c){if(_0x44f82c){return _0x44f82c?{'count':_0xa22576,'rows':_0x44f82c}:null;}})['then'](respondWithResult(_0x18c27a,null))[_0x9c1a('0x43')](handleError(_0x18c27a,null));};exports[_0x9c1a('0x58')]=function(_0x3beaac,_0x498bbc,_0x36f1cd){return db[_0x9c1a('0x2c')][_0x9c1a('0x56')]({'where':{'id':_0x3beaac[_0x9c1a('0x45')]['id']}})[_0x9c1a('0x23')](handleEntityNotFound(_0x498bbc,null))['then'](function(_0x2d1256){if(_0x2d1256){return db[_0x9c1a('0x59')][_0x9c1a('0x5a')](function(_0x37b3cf){return db[_0x9c1a('0x2c')]['destroy']({'where':{'IntervalId':_0x3beaac[_0x9c1a('0x45')]['id']},'transaction':_0x37b3cf})[_0x9c1a('0x23')](function(_0x440275){var _0x2f58ff=_[_0x9c1a('0x2b')](_0x3beaac[_0x9c1a('0x4b')],function(_0x733c19){delete _0x733c19['id'];_0x733c19['IntervalId']=_0x3beaac[_0x9c1a('0x45')]['id'];return _0x733c19;});return db[_0x9c1a('0x2c')][_0x9c1a('0x5b')](_0x2f58ff,{'transaction':_0x37b3cf});});})[_0x9c1a('0x23')](function(){return db[_0x9c1a('0x2c')][_0x9c1a('0x5c')]({'where':{'IntervalId':_0x3beaac[_0x9c1a('0x45')]['id']}});});}})[_0x9c1a('0x23')](respondWithResult(_0x498bbc,null))['catch'](handleError(_0x498bbc,null));}; \ No newline at end of file +var _0x5f9f=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','set','Content-Range','apply','save','then','destroy','get','Intervals','UserProfileResource','error','name','send','index','map','Interval','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','offset','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','IntervalId','getIntervals','findOne','rawAttributes','limit','addIntervals','sequelize','transaction','bulkCreate','findAll','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse'];(function(_0x15a26f,_0x36d6d7){var _0x384061=function(_0x2eb32b){while(--_0x2eb32b){_0x15a26f['push'](_0x15a26f['shift']());}};_0x384061(++_0x36d6d7);}(_0x5f9f,0xa5));var _0xf5f9=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x5f9f[_0x92c450];return _0x2a9599;};'use strict';var pdf=require(_0xf5f9('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf5f9('0x1'));var jsonpatch=require(_0xf5f9('0x2'));var rp=require('request-promise');var moment=require(_0xf5f9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf5f9('0x4'));var util=require(_0xf5f9('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf5f9('0x6'));var fs=require('fs');var _=require(_0xf5f9('0x7'));var squel=require(_0xf5f9('0x8'));var crypto=require(_0xf5f9('0x9'));var jsforce=require(_0xf5f9('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf5f9('0xb'));var querystring=require('querystring');var Papa=require(_0xf5f9('0xc'));var Redis=require('ioredis');var authService=require(_0xf5f9('0xd'));var qs=require(_0xf5f9('0xe'));var as=require(_0xf5f9('0xf'));var hardwareService=require(_0xf5f9('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xf5f9('0x11'));var config=require(_0xf5f9('0x12'));var licenseUtil=require(_0xf5f9('0x13'));var db=require(_0xf5f9('0x14'))['db'];var extensions=require(_0xf5f9('0x15'));function respondWithStatusCode(_0x30dc9c,_0x4336dd){_0x4336dd=_0x4336dd||0xcc;return function(_0x23e1c8){if(_0x23e1c8){return _0x30dc9c[_0xf5f9('0x16')](_0x4336dd);}return _0x30dc9c[_0xf5f9('0x17')](_0x4336dd)[_0xf5f9('0x18')]();};}function respondWithResult(_0x58c39b,_0x371084){_0x371084=_0x371084||0xc8;return function(_0x22af2e){if(_0x22af2e){return _0x58c39b[_0xf5f9('0x17')](_0x371084)[_0xf5f9('0x19')](_0x22af2e);}};}function respondWithFilteredResult(_0x5ed2e2,_0x539554){return function(_0x42681d){if(_0x42681d){var _0x3972c0=_0x42681d[_0xf5f9('0x1a')],_0x5203aa=_0x539554['offset'],_0x4578f1=_0x539554['offset']+_0x539554['limit'],_0x296f63;if(_0x4578f1>=_0x3972c0){_0x4578f1=_0x3972c0;_0x296f63=0xc8;}else{_0x296f63=0xce;}_0x5ed2e2[_0xf5f9('0x17')](_0x296f63);return _0x5ed2e2[_0xf5f9('0x1b')](_0xf5f9('0x1c'),_0x5203aa+'-'+_0x4578f1+'/'+_0x3972c0)[_0xf5f9('0x19')](_0x42681d);}return null;};}function patchUpdates(_0x31aca3){return function(_0x5dfb9b){try{jsonpatch[_0xf5f9('0x1d')](_0x5dfb9b,_0x31aca3,!![]);}catch(_0x3d5873){return BPromise['reject'](_0x3d5873);}return _0x5dfb9b[_0xf5f9('0x1e')]();};}function saveUpdates(_0x5cc1aa,_0x253d3c){return function(_0x1fa716){if(_0x1fa716){return _0x1fa716['update'](_0x5cc1aa)[_0xf5f9('0x1f')](function(_0x3fd2ef){return _0x3fd2ef;});}return null;};}function removeEntity(_0x35d36d,_0x18673c){return function(_0x93bfc){if(_0x93bfc){return _0x93bfc[_0xf5f9('0x20')]()['then'](function(){var _0x3ca28e=_0x93bfc[_0xf5f9('0x21')]({'plain':!![]});var _0x48def2=_0xf5f9('0x22');return db[_0xf5f9('0x23')][_0xf5f9('0x20')]({'where':{'type':_0x48def2,'resourceId':_0x3ca28e['id']}})[_0xf5f9('0x1f')](function(){return _0x93bfc;});})[_0xf5f9('0x1f')](function(){_0x35d36d[_0xf5f9('0x17')](0xcc)[_0xf5f9('0x18')]();});}};}function handleEntityNotFound(_0x5db04d,_0x1b788f){return function(_0x3ac615){if(!_0x3ac615){_0x5db04d[_0xf5f9('0x16')](0x194);}return _0x3ac615;};}function handleError(_0x509a03,_0x835017){_0x835017=_0x835017||0x1f4;return function(_0x11cf33){logger[_0xf5f9('0x24')](_0x11cf33['stack']);if(_0x11cf33['name']){delete _0x11cf33[_0xf5f9('0x25')];}_0x509a03['status'](_0x835017)[_0xf5f9('0x26')](_0x11cf33);};}exports[_0xf5f9('0x27')]=function(_0x34385b,_0x96212d){var _0x2d3ae6={},_0xdc366d={},_0x1e7e55={'count':0x0,'rows':[]};var _0x4dd4ec=_[_0xf5f9('0x28')](db[_0xf5f9('0x29')]['rawAttributes'],function(_0x2c3783){return{'name':_0x2c3783['fieldName'],'type':_0x2c3783[_0xf5f9('0x2a')][_0xf5f9('0x2b')]};});_0xdc366d[_0xf5f9('0x2c')]=_[_0xf5f9('0x28')](_0x4dd4ec,_0xf5f9('0x25'));_0xdc366d[_0xf5f9('0x2d')]=_['keys'](_0x34385b[_0xf5f9('0x2d')]);_0xdc366d[_0xf5f9('0x2e')]=_[_0xf5f9('0x2f')](_0xdc366d[_0xf5f9('0x2c')],_0xdc366d[_0xf5f9('0x2d')]);_0x2d3ae6['attributes']=_[_0xf5f9('0x2f')](_0xdc366d[_0xf5f9('0x2c')],qs[_0xf5f9('0x30')](_0x34385b['query'][_0xf5f9('0x30')]));_0x2d3ae6['attributes']=_0x2d3ae6['attributes'][_0xf5f9('0x31')]?_0x2d3ae6[_0xf5f9('0x32')]:_0xdc366d[_0xf5f9('0x2c')];if(!_0x34385b[_0xf5f9('0x2d')][_0xf5f9('0x33')](_0xf5f9('0x34'))){_0x2d3ae6['limit']=qs['limit'](_0x34385b[_0xf5f9('0x2d')]['limit']);_0x2d3ae6[_0xf5f9('0x35')]=qs['offset'](_0x34385b[_0xf5f9('0x2d')][_0xf5f9('0x35')]);}_0x2d3ae6[_0xf5f9('0x36')]=qs[_0xf5f9('0x37')](_0x34385b[_0xf5f9('0x2d')][_0xf5f9('0x37')]);_0x2d3ae6['where']=qs[_0xf5f9('0x2e')](_[_0xf5f9('0x38')](_0x34385b['query'],_0xdc366d['filters']),_0x4dd4ec);if(_0x34385b['query']['filter']){_0x2d3ae6['where']=_[_0xf5f9('0x39')](_0x2d3ae6[_0xf5f9('0x3a')],{'$or':_[_0xf5f9('0x28')](_0x4dd4ec,function(_0x4c1377){if(_0x4c1377[_0xf5f9('0x2a')]!==_0xf5f9('0x3b')){var _0x245b66={};_0x245b66[_0x4c1377['name']]={'$like':'%'+_0x34385b[_0xf5f9('0x2d')][_0xf5f9('0x3c')]+'%'};return _0x245b66;}})});}_0x2d3ae6=_[_0xf5f9('0x39')]({},_0x2d3ae6,_0x34385b[_0xf5f9('0x3d')]);var _0x2d8d30={'where':_0x2d3ae6[_0xf5f9('0x3a')]};return db[_0xf5f9('0x29')][_0xf5f9('0x1a')](_0x2d8d30)[_0xf5f9('0x1f')](function(_0x240a1c){_0x1e7e55[_0xf5f9('0x1a')]=_0x240a1c;if(_0x34385b[_0xf5f9('0x2d')][_0xf5f9('0x3e')]){_0x2d3ae6[_0xf5f9('0x3f')]=[{'all':!![]}];}return db[_0xf5f9('0x29')]['findAll'](_0x2d3ae6);})[_0xf5f9('0x1f')](function(_0x4fa831){_0x1e7e55[_0xf5f9('0x40')]=_0x4fa831;return _0x1e7e55;})[_0xf5f9('0x1f')](respondWithFilteredResult(_0x96212d,_0x2d3ae6))[_0xf5f9('0x41')](handleError(_0x96212d,null));};exports[_0xf5f9('0x42')]=function(_0x438d92,_0x205b59){var _0x3c808c={'raw':!![],'where':{'id':_0x438d92['params']['id']}},_0x35378d={};_0x35378d['model']=_[_0xf5f9('0x43')](db[_0xf5f9('0x29')]['rawAttributes']);_0x35378d[_0xf5f9('0x2d')]=_['keys'](_0x438d92[_0xf5f9('0x2d')]);_0x35378d[_0xf5f9('0x2e')]=_['intersection'](_0x35378d[_0xf5f9('0x2c')],_0x35378d[_0xf5f9('0x2d')]);_0x3c808c[_0xf5f9('0x32')]=_[_0xf5f9('0x2f')](_0x35378d[_0xf5f9('0x2c')],qs[_0xf5f9('0x30')](_0x438d92['query'][_0xf5f9('0x30')]));_0x3c808c[_0xf5f9('0x32')]=_0x3c808c[_0xf5f9('0x32')]['length']?_0x3c808c['attributes']:_0x35378d[_0xf5f9('0x2c')];if(_0x438d92[_0xf5f9('0x2d')][_0xf5f9('0x3e')]){_0x3c808c[_0xf5f9('0x3f')]=[{'all':!![]}];}_0x3c808c=_[_0xf5f9('0x39')]({},_0x3c808c,_0x438d92['options']);return db[_0xf5f9('0x29')]['find'](_0x3c808c)['then'](handleEntityNotFound(_0x205b59,null))[_0xf5f9('0x1f')](respondWithResult(_0x205b59,null))[_0xf5f9('0x41')](handleError(_0x205b59,null));};exports['create']=function(_0x1ae5f8,_0x150219){return db[_0xf5f9('0x29')][_0xf5f9('0x44')](_0x1ae5f8[_0xf5f9('0x45')],{})['then'](function(_0x4be472){var _0x241128=_0x1ae5f8[_0xf5f9('0x46')][_0xf5f9('0x21')]({'plain':!![]});if(!_0x241128)throw new Error(_0xf5f9('0x47'));if(_0x241128[_0xf5f9('0x48')]==='user'){var _0x5aff7f=_0x4be472[_0xf5f9('0x21')]({'plain':!![]});var _0x268ad1=_0xf5f9('0x22');return db[_0xf5f9('0x49')][_0xf5f9('0x4a')]({'where':{'name':_0x268ad1,'userProfileId':_0x241128['userProfileId']},'raw':!![]})[_0xf5f9('0x1f')](function(_0x5899c1){if(_0x5899c1&&_0x5899c1['autoAssociation']===0x0){return db[_0xf5f9('0x23')][_0xf5f9('0x44')]({'name':_0x5aff7f[_0xf5f9('0x25')],'resourceId':_0x5aff7f['id'],'type':_0x5899c1['name'],'sectionId':_0x5899c1['id']},{})[_0xf5f9('0x1f')](function(){return _0x4be472;});}else{return _0x4be472;}})['catch'](function(_0x150fbe){logger[_0xf5f9('0x24')](_0xf5f9('0x4b'),_0x150fbe);throw _0x150fbe;});}return _0x4be472;})['then'](respondWithResult(_0x150219,0xc9))[_0xf5f9('0x41')](handleError(_0x150219,null));};exports[_0xf5f9('0x4c')]=function(_0x87c9a7,_0x48323c){if(_0x87c9a7[_0xf5f9('0x45')]['id']){delete _0x87c9a7[_0xf5f9('0x45')]['id'];}return db['Interval']['find']({'where':{'id':_0x87c9a7['params']['id']}})[_0xf5f9('0x1f')](handleEntityNotFound(_0x48323c,null))[_0xf5f9('0x1f')](saveUpdates(_0x87c9a7[_0xf5f9('0x45')],null))[_0xf5f9('0x1f')](respondWithResult(_0x48323c,null))[_0xf5f9('0x41')](handleError(_0x48323c,null));};exports[_0xf5f9('0x20')]=function(_0x321174,_0x42c25c){return db[_0xf5f9('0x29')][_0xf5f9('0x4a')]({'where':{'id':_0x321174[_0xf5f9('0x4d')]['id']}})[_0xf5f9('0x1f')](handleEntityNotFound(_0x42c25c,null))['then'](removeEntity(_0x42c25c,null))[_0xf5f9('0x41')](handleError(_0x42c25c,null));};exports[_0xf5f9('0x4e')]=function(_0x57a1ce,_0xb4a84b,_0x70215e){if(_0x57a1ce['body']['id']){delete _0x57a1ce['body']['id'];}return db[_0xf5f9('0x29')]['find']({'where':{'id':_0x57a1ce[_0xf5f9('0x4d')]['id']}})[_0xf5f9('0x1f')](handleEntityNotFound(_0xb4a84b,null))['then'](function(_0x4a7ced){if(_0x4a7ced){_0x57a1ce[_0xf5f9('0x45')][_0xf5f9('0x4f')]=_0x4a7ced['id'];return db[_0xf5f9('0x29')][_0xf5f9('0x44')](_0x57a1ce[_0xf5f9('0x45')]);}})[_0xf5f9('0x1f')](respondWithResult(_0xb4a84b,null))[_0xf5f9('0x41')](handleError(_0xb4a84b,null));};exports[_0xf5f9('0x50')]=function(_0x5df9a7,_0x169c4f,_0x31711c){var _0x315236={};var _0x30d698={};var _0x4d1693;var _0x24989b;return db['Interval'][_0xf5f9('0x51')]({'where':{'id':_0x5df9a7['params']['id']}})[_0xf5f9('0x1f')](handleEntityNotFound(_0x169c4f,null))['then'](function(_0x8f03ed){if(_0x8f03ed){_0x4d1693=_0x8f03ed;_0x30d698[_0xf5f9('0x2c')]=_[_0xf5f9('0x43')](db[_0xf5f9('0x29')][_0xf5f9('0x52')]);_0x30d698[_0xf5f9('0x2d')]=_[_0xf5f9('0x43')](_0x5df9a7[_0xf5f9('0x2d')]);_0x30d698[_0xf5f9('0x2e')]=_[_0xf5f9('0x2f')](_0x30d698[_0xf5f9('0x2c')],_0x30d698['query']);_0x315236[_0xf5f9('0x32')]=_[_0xf5f9('0x2f')](_0x30d698[_0xf5f9('0x2c')],qs['fields'](_0x5df9a7[_0xf5f9('0x2d')][_0xf5f9('0x30')]));_0x315236[_0xf5f9('0x32')]=_0x315236[_0xf5f9('0x32')][_0xf5f9('0x31')]?_0x315236['attributes']:_0x30d698[_0xf5f9('0x2c')];_0x315236[_0xf5f9('0x36')]=qs[_0xf5f9('0x37')](_0x5df9a7[_0xf5f9('0x2d')][_0xf5f9('0x37')]);_0x315236['where']=qs['filters'](_[_0xf5f9('0x38')](_0x5df9a7[_0xf5f9('0x2d')],_0x30d698['filters']));if(_0x5df9a7[_0xf5f9('0x2d')]['filter']){_0x315236[_0xf5f9('0x3a')]=_['merge'](_0x315236[_0xf5f9('0x3a')],{'$or':_[_0xf5f9('0x28')](_0x315236[_0xf5f9('0x32')],function(_0x9602fb){var _0x36ac17={};_0x36ac17[_0x9602fb]={'$like':'%'+_0x5df9a7[_0xf5f9('0x2d')][_0xf5f9('0x3c')]+'%'};return _0x36ac17;})});}_0x315236=_[_0xf5f9('0x39')]({},_0x315236,_0x5df9a7[_0xf5f9('0x3d')]);return _0x4d1693[_0xf5f9('0x50')](_0x315236);}})['then'](function(_0x2d3501){if(_0x2d3501){_0x24989b=_0x2d3501[_0xf5f9('0x31')];if(!_0x5df9a7[_0xf5f9('0x2d')][_0xf5f9('0x33')](_0xf5f9('0x34'))){_0x315236[_0xf5f9('0x53')]=qs[_0xf5f9('0x53')](_0x5df9a7[_0xf5f9('0x2d')][_0xf5f9('0x53')]);_0x315236['offset']=qs[_0xf5f9('0x35')](_0x5df9a7[_0xf5f9('0x2d')][_0xf5f9('0x35')]);}return _0x4d1693[_0xf5f9('0x50')](_0x315236);}})[_0xf5f9('0x1f')](function(_0xa41e22){if(_0xa41e22){return _0xa41e22?{'count':_0x24989b,'rows':_0xa41e22}:null;}})[_0xf5f9('0x1f')](respondWithResult(_0x169c4f,null))[_0xf5f9('0x41')](handleError(_0x169c4f,null));};exports[_0xf5f9('0x54')]=function(_0x4a958e,_0x4175e3,_0x48e67a){return db[_0xf5f9('0x29')][_0xf5f9('0x51')]({'where':{'id':_0x4a958e[_0xf5f9('0x4d')]['id']}})[_0xf5f9('0x1f')](handleEntityNotFound(_0x4175e3,null))[_0xf5f9('0x1f')](function(_0x1f5de0){if(_0x1f5de0){return db[_0xf5f9('0x55')][_0xf5f9('0x56')](function(_0x36c707){return db[_0xf5f9('0x29')]['destroy']({'where':{'IntervalId':_0x4a958e['params']['id']},'transaction':_0x36c707})[_0xf5f9('0x1f')](function(_0x432299){var _0x1bc339=_[_0xf5f9('0x28')](_0x4a958e[_0xf5f9('0x45')],function(_0x3334e6){delete _0x3334e6['id'];_0x3334e6[_0xf5f9('0x4f')]=_0x4a958e[_0xf5f9('0x4d')]['id'];return _0x3334e6;});return db[_0xf5f9('0x29')][_0xf5f9('0x57')](_0x1bc339,{'transaction':_0x36c707});});})[_0xf5f9('0x1f')](function(){return db['Interval'][_0xf5f9('0x58')]({'where':{'IntervalId':_0x4a958e[_0xf5f9('0x4d')]['id']}});});}})[_0xf5f9('0x1f')](respondWithResult(_0x4175e3,null))[_0xf5f9('0x41')](handleError(_0x4175e3,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 0f7e5ce..13c79fe 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 _0x2bb0=['define','tools_intervals','rewrite','lodash','util','../../config/logger','moment','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports'];(function(_0x3439ea,_0x1d81d4){var _0x1a55f3=function(_0x33db17){while(--_0x33db17){_0x3439ea['push'](_0x3439ea['shift']());}};_0x1a55f3(++_0x1d81d4);}(_0x2bb0,0xf3));var _0x02bb=function(_0x49eed6,_0x3e49a1){_0x49eed6=_0x49eed6-0x0;var _0x154c1f=_0x2bb0[_0x49eed6];return _0x154c1f;};'use strict';var _=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var logger=require(_0x02bb('0x2'))('api');var moment=require(_0x02bb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x02bb('0x4'));var rimraf=require('rimraf');var config=require(_0x02bb('0x5'));var attributes=require(_0x02bb('0x6'));var extensions=require(_0x02bb('0x7'));module[_0x02bb('0x8')]=function(_0x43dbb7,_0x16bb7c){return _0x43dbb7[_0x02bb('0x9')]('Interval',attributes,{'tableName':_0x02bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x15e425,_0x23f816){extensions['rewrite'](_0x43dbb7,_0x15e425);},'afterBulkCreate':function(_0x3d28d5,_0x5a4a7f,_0x3edabe){_0x3edabe();extensions[_0x02bb('0xb')](_0x43dbb7,_0x3d28d5[0x0]);},'afterUpdate':function(_0x4d3418,_0x3f861e){extensions[_0x02bb('0xb')](_0x43dbb7,_0x4d3418);},'afterDestroy':function(_0x3c1149,_0x523480){extensions[_0x02bb('0xb')](_0x43dbb7,_0x3c1149);}}});}; \ No newline at end of file +var _0xe3ed=['rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','exports','define','tools_intervals'];(function(_0x56d1fe,_0xd17eda){var _0x1baf3e=function(_0x433a57){while(--_0x433a57){_0x56d1fe['push'](_0x56d1fe['shift']());}};_0x1baf3e(++_0xd17eda);}(_0xe3ed,0x8d));var _0xde3e=function(_0x125778,_0x3aeae7){_0x125778=_0x125778-0x0;var _0x59170d=_0xe3ed[_0x125778];return _0x59170d;};'use strict';var _=require(_0xde3e('0x0'));var util=require(_0xde3e('0x1'));var logger=require(_0xde3e('0x2'))(_0xde3e('0x3'));var moment=require(_0xde3e('0x4'));var BPromise=require(_0xde3e('0x5'));var rp=require(_0xde3e('0x6'));var fs=require('fs');var path=require(_0xde3e('0x7'));var rimraf=require('rimraf');var config=require(_0xde3e('0x8'));var attributes=require(_0xde3e('0x9'));var extensions=require('../../components/extensions/rewrite');module[_0xde3e('0xa')]=function(_0x5e9013,_0x184b02){return _0x5e9013[_0xde3e('0xb')]('Interval',attributes,{'tableName':_0xde3e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b1597,_0xceed52){extensions[_0xde3e('0xd')](_0x5e9013,_0x3b1597);},'afterBulkCreate':function(_0x76daf5,_0x4aec4d,_0x1ca45c){_0x1ca45c();extensions[_0xde3e('0xd')](_0x5e9013,_0x76daf5[0x0]);},'afterUpdate':function(_0x3e251b,_0x137bf2){extensions['rewrite'](_0x5e9013,_0x3e251b);},'afterDestroy':function(_0xf8e2c3,_0x3b50df){extensions['rewrite'](_0x5e9013,_0xf8e2c3);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index d41043a..b87fefc 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 _0x4f59=['code','message','result','catch','GetInterval','Interval','findAll','options','where','attributes','include','map','model','debug','stringify','ShowInterval','find','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','error'];(function(_0x3397fb,_0x2feb60){var _0x3ebdc2=function(_0x2a97fd){while(--_0x2a97fd){_0x3397fb['push'](_0x3397fb['shift']());}};_0x3ebdc2(++_0x2feb60);}(_0x4f59,0x17a));var _0x94f5=function(_0x5806c3,_0x5105d8){_0x5806c3=_0x5806c3-0x0;var _0x48ac77=_0x4f59[_0x5806c3];return _0x48ac77;};'use strict';var _=require('lodash');var util=require(_0x94f5('0x0'));var moment=require(_0x94f5('0x1'));var BPromise=require(_0x94f5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94f5('0x3'));var db=require(_0x94f5('0x4'))['db'];var utils=require(_0x94f5('0x5'));var logger=require(_0x94f5('0x6'))(_0x94f5('0x7'));var config=require('../../config/environment');var jayson=require(_0x94f5('0x8'));var client=jayson[_0x94f5('0x9')][_0x94f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f45b9,_0x38ffe8,_0x130403){return new BPromise(function(_0x3ab7de,_0x99edad){return client[_0x94f5('0xb')](_0x4f45b9,_0x130403)[_0x94f5('0xc')](function(_0x5b0485){logger[_0x94f5('0xd')](_0x94f5('0xe'),_0x38ffe8,_0x94f5('0xf'));logger['debug'](_0x94f5('0x10'),_0x38ffe8,_0x94f5('0xf'),JSON['stringify'](_0x5b0485));if(_0x5b0485[_0x94f5('0x11')]){if(_0x5b0485[_0x94f5('0x11')][_0x94f5('0x12')]===0x1f4){logger[_0x94f5('0x11')](_0x94f5('0xe'),_0x38ffe8,_0x5b0485[_0x94f5('0x11')][_0x94f5('0x13')]);return _0x99edad(_0x5b0485[_0x94f5('0x11')]['message']);}logger[_0x94f5('0x11')](_0x94f5('0xe'),_0x38ffe8,_0x5b0485[_0x94f5('0x11')][_0x94f5('0x13')]);return _0x3ab7de(_0x5b0485['error'][_0x94f5('0x13')]);}else{logger['info']('Interval,\x20%s,\x20%s',_0x38ffe8,_0x94f5('0xf'));_0x3ab7de(_0x5b0485[_0x94f5('0x14')][_0x94f5('0x13')]);}})[_0x94f5('0x15')](function(_0x16a48a){logger['error'](_0x94f5('0xe'),_0x38ffe8,_0x16a48a);_0x99edad(_0x16a48a);});});}exports[_0x94f5('0x16')]=function(_0x5e95be){var _0x5e7435=this;return new Promise(function(_0x4ab664,_0x30cb7c){return db[_0x94f5('0x17')][_0x94f5('0x18')]({'raw':_0x5e95be['options']?_0x5e95be[_0x94f5('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5e95be[_0x94f5('0x19')]?_0x5e95be[_0x94f5('0x19')][_0x94f5('0x1a')]||null:null,'attributes':_0x5e95be[_0x94f5('0x19')]?_0x5e95be['options'][_0x94f5('0x1b')]||null:null,'limit':_0x5e95be[_0x94f5('0x19')]?_0x5e95be[_0x94f5('0x19')]['limit']||null:null,'include':_0x5e95be['options']?_0x5e95be[_0x94f5('0x19')][_0x94f5('0x1c')]?_[_0x94f5('0x1d')](_0x5e95be[_0x94f5('0x19')][_0x94f5('0x1c')],function(_0x56731c){return{'model':db[_0x56731c['model']],'as':_0x56731c['as'],'attributes':_0x56731c[_0x94f5('0x1b')],'include':_0x56731c[_0x94f5('0x1c')]?_[_0x94f5('0x1d')](_0x56731c[_0x94f5('0x1c')],function(_0x4d7be9){return{'model':db[_0x4d7be9['model']],'as':_0x4d7be9['as'],'attributes':_0x4d7be9[_0x94f5('0x1b')],'include':_0x4d7be9['include']?_['map'](_0x4d7be9[_0x94f5('0x1c')],function(_0x3c8306){return{'model':db[_0x3c8306[_0x94f5('0x1e')]],'as':_0x3c8306['as'],'attributes':_0x3c8306[_0x94f5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x94f5('0xc')](function(_0x567f06){logger[_0x94f5('0xd')](_0x94f5('0x16'),_0x5e95be);logger[_0x94f5('0x1f')](_0x94f5('0x16'),_0x5e95be,JSON[_0x94f5('0x20')](_0x567f06));_0x4ab664(_0x567f06);})[_0x94f5('0x15')](function(_0x4a923b){logger[_0x94f5('0x11')](_0x94f5('0x16'),_0x4a923b['message'],_0x5e95be);_0x30cb7c(_0x5e7435[_0x94f5('0x11')](0x1f4,_0x4a923b['message']));});});};exports[_0x94f5('0x21')]=function(_0x2fdda0){var _0x39211d=this;return new Promise(function(_0x59115f,_0x5f0437){return db[_0x94f5('0x17')][_0x94f5('0x22')]({'raw':_0x2fdda0[_0x94f5('0x19')]?_0x2fdda0[_0x94f5('0x19')][_0x94f5('0x23')]===undefined?!![]:![]:!![],'where':_0x2fdda0[_0x94f5('0x19')]?_0x2fdda0[_0x94f5('0x19')][_0x94f5('0x1a')]||null:null,'attributes':_0x2fdda0[_0x94f5('0x19')]?_0x2fdda0['options']['attributes']||null:null,'include':_0x2fdda0[_0x94f5('0x19')]?_0x2fdda0[_0x94f5('0x19')][_0x94f5('0x1c')]?_['map'](_0x2fdda0[_0x94f5('0x19')][_0x94f5('0x1c')],function(_0x410855){return{'model':db[_0x410855['model']],'as':_0x410855['as'],'attributes':_0x410855[_0x94f5('0x1b')],'include':_0x410855[_0x94f5('0x1c')]?_[_0x94f5('0x1d')](_0x410855[_0x94f5('0x1c')],function(_0x2ab625){return{'model':db[_0x2ab625[_0x94f5('0x1e')]],'as':_0x2ab625['as'],'attributes':_0x2ab625[_0x94f5('0x1b')],'include':_0x2ab625[_0x94f5('0x1c')]?_['map'](_0x2ab625['include'],function(_0x3ce478){return{'model':db[_0x3ce478[_0x94f5('0x1e')]],'as':_0x3ce478['as'],'attributes':_0x3ce478['attributes']};}):[]};}):[]};}):[]:[]})[_0x94f5('0xc')](function(_0x16109a){logger['info']('ShowInterval',_0x2fdda0);logger[_0x94f5('0x1f')](_0x94f5('0x21'),_0x2fdda0,JSON[_0x94f5('0x20')](_0x16109a));_0x59115f(_0x16109a);})[_0x94f5('0x15')](function(_0x138f61){logger[_0x94f5('0x11')](_0x94f5('0x21'),_0x138f61[_0x94f5('0x13')],_0x2fdda0);_0x5f0437(_0x39211d[_0x94f5('0x11')](0x1f4,_0x138f61[_0x94f5('0x13')]));});});}; \ No newline at end of file +var _0x2751=['find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetInterval','Interval','findAll','raw','options','where','attributes','limit','map','include','model','then','ShowInterval'];(function(_0x306583,_0x26b8ee){var _0x7edb07=function(_0x3afa9e){while(--_0x3afa9e){_0x306583['push'](_0x306583['shift']());}};_0x7edb07(++_0x26b8ee);}(_0x2751,0x13c));var _0x1275=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2751[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1275('0x0'));var BPromise=require(_0x1275('0x1'));var rs=require(_0x1275('0x2'));var fs=require('fs');var Redis=require(_0x1275('0x3'));var db=require(_0x1275('0x4'))['db'];var utils=require(_0x1275('0x5'));var logger=require(_0x1275('0x6'))('rpc');var config=require(_0x1275('0x7'));var jayson=require(_0x1275('0x8'));var client=jayson[_0x1275('0x9')][_0x1275('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28d243,_0x6df73b,_0x38da47){return new BPromise(function(_0x524bb5,_0xbfb6c3){return client['request'](_0x28d243,_0x38da47)['then'](function(_0x367e05){logger['info'](_0x1275('0xb'),_0x6df73b,_0x1275('0xc'));logger[_0x1275('0xd')](_0x1275('0xe'),_0x6df73b,_0x1275('0xc'),JSON[_0x1275('0xf')](_0x367e05));if(_0x367e05[_0x1275('0x10')]){if(_0x367e05['error'][_0x1275('0x11')]===0x1f4){logger[_0x1275('0x10')](_0x1275('0xb'),_0x6df73b,_0x367e05[_0x1275('0x10')][_0x1275('0x12')]);return _0xbfb6c3(_0x367e05[_0x1275('0x10')][_0x1275('0x12')]);}logger[_0x1275('0x10')](_0x1275('0xb'),_0x6df73b,_0x367e05[_0x1275('0x10')]['message']);return _0x524bb5(_0x367e05['error']['message']);}else{logger[_0x1275('0x13')](_0x1275('0xb'),_0x6df73b,_0x1275('0xc'));_0x524bb5(_0x367e05['result']['message']);}})[_0x1275('0x14')](function(_0x26a1ba){logger[_0x1275('0x10')](_0x1275('0xb'),_0x6df73b,_0x26a1ba);_0xbfb6c3(_0x26a1ba);});});}exports[_0x1275('0x15')]=function(_0x2460d9){var _0x4b1ac2=this;return new Promise(function(_0x18aaec,_0x5cd8ce){return db[_0x1275('0x16')][_0x1275('0x17')]({'raw':_0x2460d9['options']?_0x2460d9['options'][_0x1275('0x18')]===undefined?!![]:![]:!![],'where':_0x2460d9[_0x1275('0x19')]?_0x2460d9[_0x1275('0x19')][_0x1275('0x1a')]||null:null,'attributes':_0x2460d9[_0x1275('0x19')]?_0x2460d9[_0x1275('0x19')][_0x1275('0x1b')]||null:null,'limit':_0x2460d9[_0x1275('0x19')]?_0x2460d9[_0x1275('0x19')][_0x1275('0x1c')]||null:null,'include':_0x2460d9[_0x1275('0x19')]?_0x2460d9[_0x1275('0x19')]['include']?_[_0x1275('0x1d')](_0x2460d9[_0x1275('0x19')][_0x1275('0x1e')],function(_0x38a927){return{'model':db[_0x38a927[_0x1275('0x1f')]],'as':_0x38a927['as'],'attributes':_0x38a927[_0x1275('0x1b')],'include':_0x38a927[_0x1275('0x1e')]?_[_0x1275('0x1d')](_0x38a927[_0x1275('0x1e')],function(_0x4e4453){return{'model':db[_0x4e4453[_0x1275('0x1f')]],'as':_0x4e4453['as'],'attributes':_0x4e4453[_0x1275('0x1b')],'include':_0x4e4453['include']?_[_0x1275('0x1d')](_0x4e4453[_0x1275('0x1e')],function(_0x12b973){return{'model':db[_0x12b973[_0x1275('0x1f')]],'as':_0x12b973['as'],'attributes':_0x12b973['attributes']};}):[]};}):[]};}):[]:[]})[_0x1275('0x20')](function(_0x5b4dea){logger['info'](_0x1275('0x15'),_0x2460d9);logger[_0x1275('0xd')](_0x1275('0x15'),_0x2460d9,JSON[_0x1275('0xf')](_0x5b4dea));_0x18aaec(_0x5b4dea);})['catch'](function(_0x56b671){logger[_0x1275('0x10')](_0x1275('0x15'),_0x56b671[_0x1275('0x12')],_0x2460d9);_0x5cd8ce(_0x4b1ac2[_0x1275('0x10')](0x1f4,_0x56b671[_0x1275('0x12')]));});});};exports[_0x1275('0x21')]=function(_0x214941){var _0x5d9269=this;return new Promise(function(_0x551a03,_0x57886a){return db[_0x1275('0x16')][_0x1275('0x22')]({'raw':_0x214941['options']?_0x214941[_0x1275('0x19')][_0x1275('0x18')]===undefined?!![]:![]:!![],'where':_0x214941[_0x1275('0x19')]?_0x214941[_0x1275('0x19')]['where']||null:null,'attributes':_0x214941[_0x1275('0x19')]?_0x214941[_0x1275('0x19')][_0x1275('0x1b')]||null:null,'include':_0x214941[_0x1275('0x19')]?_0x214941['options'][_0x1275('0x1e')]?_[_0x1275('0x1d')](_0x214941['options'][_0x1275('0x1e')],function(_0x46badd){return{'model':db[_0x46badd[_0x1275('0x1f')]],'as':_0x46badd['as'],'attributes':_0x46badd[_0x1275('0x1b')],'include':_0x46badd[_0x1275('0x1e')]?_[_0x1275('0x1d')](_0x46badd[_0x1275('0x1e')],function(_0x25f82b){return{'model':db[_0x25f82b[_0x1275('0x1f')]],'as':_0x25f82b['as'],'attributes':_0x25f82b['attributes'],'include':_0x25f82b[_0x1275('0x1e')]?_['map'](_0x25f82b[_0x1275('0x1e')],function(_0x154d64){return{'model':db[_0x154d64[_0x1275('0x1f')]],'as':_0x154d64['as'],'attributes':_0x154d64[_0x1275('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1275('0x20')](function(_0x26147e){logger[_0x1275('0x13')](_0x1275('0x21'),_0x214941);logger['debug'](_0x1275('0x21'),_0x214941,JSON[_0x1275('0xf')](_0x26147e));_0x551a03(_0x26147e);})[_0x1275('0x14')](function(_0x46bbcd){logger[_0x1275('0x10')](_0x1275('0x21'),_0x46bbcd[_0x1275('0x12')],_0x214941);_0x57886a(_0x5d9269[_0x1275('0x10')](0x1f4,_0x46bbcd[_0x1275('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index bc97381..d840543 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 _0x61a2=['isAuthenticated','send','exports','express','Router','./jira.controller','post'];(function(_0x24657d,_0x551c56){var _0xdc4b08=function(_0x3d0188){while(--_0x3d0188){_0x24657d['push'](_0x24657d['shift']());}};_0xdc4b08(++_0x551c56);}(_0x61a2,0x184));var _0x261a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x61a2[_0x432682];return _0x463d05;};'use strict';var express=require(_0x261a('0x0'));var router=express[_0x261a('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x261a('0x2'));router[_0x261a('0x3')]('/',auth[_0x261a('0x4')](),controller[_0x261a('0x5')]);module[_0x261a('0x6')]=router; \ No newline at end of file +var _0x741c=['./jira.controller','post','isAuthenticated','express','Router','../../components/auth/service'];(function(_0x52db3f,_0x37ab5f){var _0x41b731=function(_0x3f1c11){while(--_0x3f1c11){_0x52db3f['push'](_0x52db3f['shift']());}};_0x41b731(++_0x37ab5f);}(_0x741c,0x8d));var _0xc741=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x741c[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0xc741('0x0'));var router=express[_0xc741('0x1')]();var auth=require(_0xc741('0x2'));var controller=require(_0xc741('0x3'));router[_0xc741('0x4')]('/',auth[_0xc741('0x5')](),controller['send']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 79be7a3..b993d1d 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 _0xc36c=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','parse','error','json'];(function(_0xadd012,_0x510368){var _0x3cc371=function(_0xaa583d){while(--_0xaa583d){_0xadd012['push'](_0xadd012['shift']());}};_0x3cc371(++_0x510368);}(_0xc36c,0x1c4));var _0xcc36=function(_0x21c469,_0x53cb89){_0x21c469=_0x21c469-0x0;var _0x3ade36=_0xc36c[_0x21c469];return _0x3ade36;};'use strict';var BPromise=require('bluebird');var https=require(_0xcc36('0x0'));var logger=require(_0xcc36('0x1'))('api');var USERNAME=_0xcc36('0x2');var PASSWORD=_0xcc36('0x3');function openIssue(_0x411088,_0x4e8296){var _0x4763e7={'fields':{'project':{'key':_0x411088[_0xcc36('0x4')]||_0xcc36('0x5')},'summary':(_0x411088['summary']||_0xcc36('0x6'))+_0xcc36('0x7')+_0x411088['ip'],'description':_0x411088[_0xcc36('0x8')]||JSON[_0xcc36('0x9')](_0x411088),'issuetype':{'name':_0x411088['issuetype']||_0xcc36('0xa')}}};_0x4763e7[_0xcc36('0xb')][_0xcc36('0xc')]=_0x411088['email'];_0x4763e7[_0xcc36('0xb')][_0xcc36('0xd')]=_0x411088[_0xcc36('0xe')];_0x4763e7[_0xcc36('0xb')][_0xcc36('0xf')]=_0x411088[_0xcc36('0x10')];_0x4763e7[_0xcc36('0xb')][_0xcc36('0x11')]=_0x411088[_0xcc36('0x12')];_0x4763e7[_0xcc36('0xb')][_0xcc36('0x13')]=_0x411088[_0xcc36('0x14')];_0x4763e7[_0xcc36('0xb')][_0xcc36('0x15')]=_0x411088['ip'];var _0x40855b={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xcc36('0x16'),'method':_0xcc36('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xcc36('0x18'),'Authorization':_0xcc36('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xcc36('0x1a')](_0xcc36('0x1b'))}};var _0x45948e=JSON[_0xcc36('0x9')](_0x4763e7);var _0x225bca=https[_0xcc36('0x1c')](_0x40855b,function(_0x4dbd52){_0x4dbd52[_0xcc36('0x1d')](_0xcc36('0x1e'));var _0x36d1ff='';_0x4dbd52['on'](_0xcc36('0x1f'),function(_0x10fcbe){_0x36d1ff+=_0x10fcbe;});_0x4dbd52['on'](_0xcc36('0x20'),function(){if(_0x4e8296){return _0x4e8296[_0xcc36('0x21')](_0x4dbd52[_0xcc36('0x22')])['json'](JSON[_0xcc36('0x23')](_0x36d1ff));}});});_0x225bca['on'](_0xcc36('0x24'),function(_0x55add6){if(_0x4e8296){return _0x4e8296['status'](0x1f4)[_0xcc36('0x25')]({'errors':[{'message':_0xcc36('0x26'),'type':_0xcc36('0x27')}]});}});_0x225bca[_0xcc36('0x28')](_0x45948e);_0x225bca['end']();}exports[_0xcc36('0x29')]=openIssue;exports[_0xcc36('0x2a')]=function(_0x2efcdc,_0x18ccfc){_0x2efcdc['body']['ip']=_0x2efcdc[_0xcc36('0x2b')][_0xcc36('0x2c')]||_0x2efcdc[_0xcc36('0x2d')][_0xcc36('0x2e')]||_0x2efcdc['socket'][_0xcc36('0x2e')]||_0x2efcdc[_0xcc36('0x2d')][_0xcc36('0x2f')][_0xcc36('0x2e')];return openIssue(_0x2efcdc[_0xcc36('0x30')],_0x18ccfc);}; \ No newline at end of file +var _0x0f86=['description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','utf8','end','status','statusCode','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','key','MOTGUI','summary','Report','\x20from\x20'];(function(_0x3ae9ac,_0x21470b){var _0xea9e2a=function(_0x509248){while(--_0x509248){_0x3ae9ac['push'](_0x3ae9ac['shift']());}};_0xea9e2a(++_0x21470b);}(_0x0f86,0x157));var _0x60f8=function(_0x5af460,_0x515988){_0x5af460=_0x5af460-0x0;var _0x513454=_0x0f86[_0x5af460];return _0x513454;};'use strict';var BPromise=require(_0x60f8('0x0'));var https=require(_0x60f8('0x1'));var logger=require(_0x60f8('0x2'))(_0x60f8('0x3'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x17cb5d,_0x423b36){var _0x48d07c={'fields':{'project':{'key':_0x17cb5d[_0x60f8('0x4')]||_0x60f8('0x5')},'summary':(_0x17cb5d[_0x60f8('0x6')]||_0x60f8('0x7'))+_0x60f8('0x8')+_0x17cb5d['ip'],'description':_0x17cb5d[_0x60f8('0x9')]||JSON['stringify'](_0x17cb5d),'issuetype':{'name':_0x17cb5d[_0x60f8('0xa')]||_0x60f8('0xb')}}};_0x48d07c[_0x60f8('0xc')][_0x60f8('0xd')]=_0x17cb5d[_0x60f8('0xe')];_0x48d07c[_0x60f8('0xc')][_0x60f8('0xf')]=_0x17cb5d[_0x60f8('0x10')];_0x48d07c['fields'][_0x60f8('0x11')]=_0x17cb5d['newToken'];_0x48d07c[_0x60f8('0xc')][_0x60f8('0x12')]=_0x17cb5d[_0x60f8('0x13')];_0x48d07c[_0x60f8('0xc')]['customfield_11504']=_0x17cb5d['reason'];_0x48d07c[_0x60f8('0xc')][_0x60f8('0x14')]=_0x17cb5d['ip'];var _0x115288={'host':_0x60f8('0x15'),'port':0x1bb,'path':_0x60f8('0x16'),'method':_0x60f8('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x60f8('0x18'),'Authorization':_0x60f8('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x60f8('0x1a')](_0x60f8('0x1b'))}};var _0x17a66e=JSON[_0x60f8('0x1c')](_0x48d07c);var _0x5558bd=https['request'](_0x115288,function(_0x546316){_0x546316['setEncoding'](_0x60f8('0x1d'));var _0x1912a0='';_0x546316['on']('data',function(_0x11350b){_0x1912a0+=_0x11350b;});_0x546316['on'](_0x60f8('0x1e'),function(){if(_0x423b36){return _0x423b36[_0x60f8('0x1f')](_0x546316[_0x60f8('0x20')])['json'](JSON[_0x60f8('0x21')](_0x1912a0));}});});_0x5558bd['on'](_0x60f8('0x22'),function(_0x424fa4){if(_0x423b36){return _0x423b36[_0x60f8('0x1f')](0x1f4)['json']({'errors':[{'message':_0x60f8('0x23'),'type':'api.jira'}]});}});_0x5558bd[_0x60f8('0x24')](_0x17a66e);_0x5558bd[_0x60f8('0x1e')]();}exports[_0x60f8('0x25')]=openIssue;exports['send']=function(_0x36b352,_0x3f9b23){_0x36b352[_0x60f8('0x26')]['ip']=_0x36b352[_0x60f8('0x27')][_0x60f8('0x28')]||_0x36b352[_0x60f8('0x29')][_0x60f8('0x2a')]||_0x36b352[_0x60f8('0x2b')]['remoteAddress']||_0x36b352[_0x60f8('0x29')][_0x60f8('0x2b')][_0x60f8('0x2a')];return openIssue(_0x36b352['body'],_0x3f9b23);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 5b9ce46..98e3eac 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 _0xeb71=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0xeb71,0xb8));var _0x1eb7=function(_0x332e8a,_0x189cd1){_0x332e8a=_0x332e8a-0x0;var _0xd4b128=_0xeb71[_0x332e8a];return _0xd4b128;};'use strict';var multer=require(_0x1eb7('0x0'));var util=require(_0x1eb7('0x1'));var path=require(_0x1eb7('0x2'));var timeout=require(_0x1eb7('0x3'));var express=require(_0x1eb7('0x4'));var router=express[_0x1eb7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1eb7('0x6'));var config=require(_0x1eb7('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x1eb7('0x8')]('/',auth[_0x1eb7('0x9')](),controller[_0x1eb7('0xa')]);router[_0x1eb7('0x8')](_0x1eb7('0xb'),auth[_0x1eb7('0x9')](),controller[_0x1eb7('0xc')]);router[_0x1eb7('0x8')](_0x1eb7('0xd'),auth['isAuthenticated'](),controller[_0x1eb7('0xe')]);router[_0x1eb7('0xf')]('/',auth[_0x1eb7('0x9')](),controller[_0x1eb7('0x10')]);router[_0x1eb7('0x11')](_0x1eb7('0xd'),auth[_0x1eb7('0x9')](),controller[_0x1eb7('0x12')]);router['delete'](_0x1eb7('0xd'),auth[_0x1eb7('0x9')](),controller[_0x1eb7('0x13')]);module[_0x1eb7('0x14')]=router; \ No newline at end of file +var _0x55ce=['get','isAuthenticated','/describe','describe','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller'];(function(_0x109cd0,_0x51500b){var _0x2bd571=function(_0x42440e){while(--_0x42440e){_0x109cd0['push'](_0x109cd0['shift']());}};_0x2bd571(++_0x51500b);}(_0x55ce,0x14b));var _0xe55c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x55ce[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xe55c('0x0'));var util=require(_0xe55c('0x1'));var path=require(_0xe55c('0x2'));var timeout=require(_0xe55c('0x3'));var express=require(_0xe55c('0x4'));var router=express[_0xe55c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe55c('0x6'));var config=require(_0xe55c('0x7'));var controller=require(_0xe55c('0x8'));router[_0xe55c('0x9')]('/',auth[_0xe55c('0xa')](),controller['index']);router[_0xe55c('0x9')](_0xe55c('0xb'),auth[_0xe55c('0xa')](),controller[_0xe55c('0xc')]);router[_0xe55c('0x9')]('/:id',auth[_0xe55c('0xa')](),controller['show']);router[_0xe55c('0xd')]('/',auth[_0xe55c('0xa')](),controller['create']);router[_0xe55c('0xe')](_0xe55c('0xf'),auth[_0xe55c('0xa')](),controller[_0xe55c('0x10')]);router[_0xe55c('0x11')](_0xe55c('0xf'),auth[_0xe55c('0xa')](),controller[_0xe55c('0x12')]);module[_0xe55c('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index b2073ca..7cb3630 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 _0x5eb8=['long','STRING','TEXT'];(function(_0x408757,_0x20b1c8){var _0x23d15d=function(_0x5937a8){while(--_0x5937a8){_0x408757['push'](_0x408757['shift']());}};_0x23d15d(++_0x20b1c8);}(_0x5eb8,0xb0));var _0x85eb=function(_0xfb65aa,_0x1651a6){_0xfb65aa=_0xfb65aa-0x0;var _0x2aee31=_0x5eb8[_0xfb65aa];return _0x2aee31;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0x85eb('0x0')]},'answer':{'type':Sequelize[_0x85eb('0x0')](_0x85eb('0x1'))},'membername':{'type':Sequelize[_0x85eb('0x2')]},'projectname':{'type':Sequelize[_0x85eb('0x2')]},'queue':{'type':Sequelize[_0x85eb('0x2')]},'uniqueid':{'type':Sequelize[_0x85eb('0x2')]},'calleridname':{'type':Sequelize[_0x85eb('0x2')]},'calleridnum':{'type':Sequelize[_0x85eb('0x2')]},'questionId':{'type':Sequelize[_0x85eb('0x2')]}}; \ No newline at end of file +var _0xeb74=['long','STRING','sequelize','exports','TEXT'];(function(_0x5c7cea,_0xd4f7a6){var _0x37d8ec=function(_0x104a4e){while(--_0x104a4e){_0x5c7cea['push'](_0x5c7cea['shift']());}};_0x37d8ec(++_0xd4f7a6);}(_0xeb74,0xe3));var _0x4eb7=function(_0x3ce6fb,_0xf7f966){_0x3ce6fb=_0x3ce6fb-0x0;var _0x541657=_0xeb74[_0x3ce6fb];return _0x541657;};'use strict';var Sequelize=require(_0x4eb7('0x0'));module[_0x4eb7('0x1')]={'question':{'type':Sequelize[_0x4eb7('0x2')]},'answer':{'type':Sequelize[_0x4eb7('0x2')](_0x4eb7('0x3'))},'membername':{'type':Sequelize[_0x4eb7('0x4')]},'projectname':{'type':Sequelize[_0x4eb7('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4eb7('0x4')]},'calleridname':{'type':Sequelize[_0x4eb7('0x4')]},'calleridnum':{'type':Sequelize[_0x4eb7('0x4')]},'questionId':{'type':Sequelize[_0x4eb7('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 98f8294..10bf3f1 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 _0x98ca=['../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','save','update','destroy','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','then','show','params','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../config/license/hardware'];(function(_0x3f161e,_0x164102){var _0x142d66=function(_0x549a1c){while(--_0x549a1c){_0x3f161e['push'](_0x3f161e['shift']());}};_0x142d66(++_0x164102);}(_0x98ca,0x149));var _0xa98c=function(_0x4ac0bc,_0x54e10d){_0x4ac0bc=_0x4ac0bc-0x0;var _0x5cd1b2=_0x98ca[_0x4ac0bc];return _0x5cd1b2;};'use strict';var pdf=require(_0xa98c('0x0'));var emlformat=require(_0xa98c('0x1'));var rimraf=require(_0xa98c('0x2'));var zipdir=require(_0xa98c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa98c('0x4'));var BPromise=require(_0xa98c('0x5'));var Mustache=require(_0xa98c('0x6'));var util=require(_0xa98c('0x7'));var path=require('path');var sox=require(_0xa98c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa98c('0x9'));var jsforce=require(_0xa98c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa98c('0xb'));var querystring=require(_0xa98c('0xc'));var Papa=require(_0xa98c('0xd'));var Redis=require(_0xa98c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa98c('0xf'));var logger=require(_0xa98c('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xa98c('0x11'));var licenseUtil=require(_0xa98c('0x12'));var db=require(_0xa98c('0x13'))['db'];function respondWithStatusCode(_0x2c4fe8,_0x3ca906){_0x3ca906=_0x3ca906||0xcc;return function(_0x32ebf7){if(_0x32ebf7){return _0x2c4fe8[_0xa98c('0x14')](_0x3ca906);}return _0x2c4fe8[_0xa98c('0x15')](_0x3ca906)[_0xa98c('0x16')]();};}function respondWithResult(_0x3351b9,_0x242f3d){_0x242f3d=_0x242f3d||0xc8;return function(_0x100c57){if(_0x100c57){return _0x3351b9[_0xa98c('0x15')](_0x242f3d)['json'](_0x100c57);}};}function respondWithFilteredResult(_0x171654,_0x4d441f){return function(_0x362f1f){if(_0x362f1f){var _0x16baf0=_0x362f1f['count'],_0x55da8e=_0x4d441f[_0xa98c('0x17')],_0x116898=_0x4d441f[_0xa98c('0x17')]+_0x4d441f[_0xa98c('0x18')],_0x105e84;if(_0x116898>=_0x16baf0){_0x116898=_0x16baf0;_0x105e84=0xc8;}else{_0x105e84=0xce;}_0x171654['status'](_0x105e84);return _0x171654[_0xa98c('0x19')]('Content-Range',_0x55da8e+'-'+_0x116898+'/'+_0x16baf0)[_0xa98c('0x1a')](_0x362f1f);}return null;};}function patchUpdates(_0x1435a3){return function(_0x2ebd8b){try{jsonpatch[_0xa98c('0x1b')](_0x2ebd8b,_0x1435a3,!![]);}catch(_0x443ac7){return BPromise['reject'](_0x443ac7);}return _0x2ebd8b[_0xa98c('0x1c')]();};}function saveUpdates(_0x3b8588,_0x4ba5b0){return function(_0x248243){if(_0x248243){return _0x248243[_0xa98c('0x1d')](_0x3b8588)['then'](function(_0x1c1353){return _0x1c1353;});}return null;};}function removeEntity(_0x32f04d,_0x4e2d7f){return function(_0x1b1c6d){if(_0x1b1c6d){return _0x1b1c6d[_0xa98c('0x1e')]()['then'](function(){_0x32f04d[_0xa98c('0x15')](0xcc)[_0xa98c('0x16')]();});}};}function handleEntityNotFound(_0x4ef891,_0x4cd156){return function(_0x20918b){if(!_0x20918b){_0x4ef891[_0xa98c('0x14')](0x194);}return _0x20918b;};}function handleError(_0x5ed3b3,_0x557926){_0x557926=_0x557926||0x1f4;return function(_0x3314bd){logger[_0xa98c('0x1f')](_0x3314bd[_0xa98c('0x20')]);if(_0x3314bd['name']){delete _0x3314bd[_0xa98c('0x21')];}_0x5ed3b3[_0xa98c('0x15')](_0x557926)['send'](_0x3314bd);};}exports[_0xa98c('0x22')]=function(_0x41dcd1,_0x328ab7){var _0x4f729a={},_0x19f973={},_0x531900={'count':0x0,'rows':[]};var _0x2260bf=_[_0xa98c('0x23')](db[_0xa98c('0x24')][_0xa98c('0x25')],function(_0x1d7f49){return{'name':_0x1d7f49[_0xa98c('0x26')],'type':_0x1d7f49[_0xa98c('0x27')][_0xa98c('0x28')]};});_0x19f973[_0xa98c('0x29')]=_['map'](_0x2260bf,_0xa98c('0x21'));_0x19f973[_0xa98c('0x2a')]=_[_0xa98c('0x2b')](_0x41dcd1[_0xa98c('0x2a')]);_0x19f973[_0xa98c('0x2c')]=_['intersection'](_0x19f973[_0xa98c('0x29')],_0x19f973[_0xa98c('0x2a')]);_0x4f729a[_0xa98c('0x2d')]=_[_0xa98c('0x2e')](_0x19f973[_0xa98c('0x29')],qs[_0xa98c('0x2f')](_0x41dcd1[_0xa98c('0x2a')][_0xa98c('0x2f')]));_0x4f729a[_0xa98c('0x2d')]=_0x4f729a[_0xa98c('0x2d')][_0xa98c('0x30')]?_0x4f729a['attributes']:_0x19f973[_0xa98c('0x29')];if(!_0x41dcd1[_0xa98c('0x2a')]['hasOwnProperty'](_0xa98c('0x31'))){_0x4f729a['limit']=qs[_0xa98c('0x18')](_0x41dcd1['query'][_0xa98c('0x18')]);_0x4f729a[_0xa98c('0x17')]=qs['offset'](_0x41dcd1[_0xa98c('0x2a')][_0xa98c('0x17')]);}_0x4f729a[_0xa98c('0x32')]=qs[_0xa98c('0x33')](_0x41dcd1[_0xa98c('0x2a')][_0xa98c('0x33')]);_0x4f729a[_0xa98c('0x34')]=qs[_0xa98c('0x2c')](_['pick'](_0x41dcd1['query'],_0x19f973[_0xa98c('0x2c')]),_0x2260bf);if(_0x41dcd1['query'][_0xa98c('0x35')]){_0x4f729a['where']=_[_0xa98c('0x36')](_0x4f729a[_0xa98c('0x34')],{'$or':_['map'](_0x2260bf,function(_0x2c61d7){if(_0x2c61d7[_0xa98c('0x27')]!==_0xa98c('0x37')){var _0x2918a1={};_0x2918a1[_0x2c61d7[_0xa98c('0x21')]]={'$like':'%'+_0x41dcd1[_0xa98c('0x2a')][_0xa98c('0x35')]+'%'};return _0x2918a1;}})});}_0x4f729a=_['merge']({},_0x4f729a,_0x41dcd1[_0xa98c('0x38')]);var _0x4e9d63={'where':_0x4f729a[_0xa98c('0x34')]};return db[_0xa98c('0x24')][_0xa98c('0x39')](_0x4e9d63)['then'](function(_0x375e8a){_0x531900['count']=_0x375e8a;if(_0x41dcd1[_0xa98c('0x2a')][_0xa98c('0x3a')]){_0x4f729a[_0xa98c('0x3b')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa98c('0x3c')](_0x4f729a);})['then'](function(_0x82d53b){_0x531900['rows']=_0x82d53b;return _0x531900;})[_0xa98c('0x3d')](respondWithFilteredResult(_0x328ab7,_0x4f729a))['catch'](handleError(_0x328ab7,null));};exports[_0xa98c('0x3e')]=function(_0x49bac9,_0x40d398){var _0x30dd0e={'raw':!![],'where':{'id':_0x49bac9[_0xa98c('0x3f')]['id']}},_0x296cfc={};_0x296cfc['model']=_['keys'](db['JscriptyAnswerReport'][_0xa98c('0x25')]);_0x296cfc[_0xa98c('0x2a')]=_[_0xa98c('0x2b')](_0x49bac9[_0xa98c('0x2a')]);_0x296cfc[_0xa98c('0x2c')]=_[_0xa98c('0x2e')](_0x296cfc[_0xa98c('0x29')],_0x296cfc[_0xa98c('0x2a')]);_0x30dd0e['attributes']=_[_0xa98c('0x2e')](_0x296cfc[_0xa98c('0x29')],qs['fields'](_0x49bac9[_0xa98c('0x2a')]['fields']));_0x30dd0e[_0xa98c('0x2d')]=_0x30dd0e[_0xa98c('0x2d')]['length']?_0x30dd0e[_0xa98c('0x2d')]:_0x296cfc[_0xa98c('0x29')];if(_0x49bac9[_0xa98c('0x2a')][_0xa98c('0x3a')]){_0x30dd0e[_0xa98c('0x3b')]=[{'all':!![]}];}_0x30dd0e=_[_0xa98c('0x36')]({},_0x30dd0e,_0x49bac9[_0xa98c('0x38')]);return db['JscriptyAnswerReport'][_0xa98c('0x40')](_0x30dd0e)[_0xa98c('0x3d')](handleEntityNotFound(_0x40d398,null))[_0xa98c('0x3d')](respondWithResult(_0x40d398,null))['catch'](handleError(_0x40d398,null));};exports[_0xa98c('0x41')]=function(_0x58e7a7,_0x3828f0){return db[_0xa98c('0x24')][_0xa98c('0x41')](_0x58e7a7[_0xa98c('0x42')],{})['then'](respondWithResult(_0x3828f0,0xc9))[_0xa98c('0x43')](handleError(_0x3828f0,null));};exports['update']=function(_0x5d137f,_0x38c617){if(_0x5d137f['body']['id']){delete _0x5d137f[_0xa98c('0x42')]['id'];}return db['JscriptyAnswerReport'][_0xa98c('0x40')]({'where':{'id':_0x5d137f[_0xa98c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x38c617,null))[_0xa98c('0x3d')](saveUpdates(_0x5d137f['body'],null))[_0xa98c('0x3d')](respondWithResult(_0x38c617,null))[_0xa98c('0x43')](handleError(_0x38c617,null));};exports[_0xa98c('0x1e')]=function(_0xce031c,_0x18c8ea){return db[_0xa98c('0x24')]['find']({'where':{'id':_0xce031c[_0xa98c('0x3f')]['id']}})[_0xa98c('0x3d')](handleEntityNotFound(_0x18c8ea,null))[_0xa98c('0x3d')](removeEntity(_0x18c8ea,null))[_0xa98c('0x43')](handleError(_0x18c8ea,null));};exports[_0xa98c('0x44')]=function(_0x51b45d,_0x1fdb5b){return db[_0xa98c('0x24')][_0xa98c('0x44')]()[_0xa98c('0x3d')](respondWithResult(_0x1fdb5b,null))[_0xa98c('0x43')](handleError(_0x1fdb5b,null));}; \ No newline at end of file +var _0xd36f=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','Content-Range','json','update','then','destroy','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xd36f,0x1bc));var _0xfd36=function(_0x5e207a,_0x186264){_0x5e207a=_0x5e207a-0x0;var _0x519e48=_0xd36f[_0x5e207a];return _0x519e48;};'use strict';var pdf=require(_0xfd36('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfd36('0x1'));var zipdir=require(_0xfd36('0x2'));var jsonpatch=require(_0xfd36('0x3'));var rp=require(_0xfd36('0x4'));var moment=require('moment');var BPromise=require(_0xfd36('0x5'));var Mustache=require(_0xfd36('0x6'));var util=require(_0xfd36('0x7'));var path=require(_0xfd36('0x8'));var sox=require(_0xfd36('0x9'));var csv=require(_0xfd36('0xa'));var ejs=require(_0xfd36('0xb'));var fs=require('fs');var _=require(_0xfd36('0xc'));var squel=require(_0xfd36('0xd'));var crypto=require(_0xfd36('0xe'));var jsforce=require(_0xfd36('0xf'));var deskjs=require(_0xfd36('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfd36('0x11'));var Redis=require(_0xfd36('0x12'));var authService=require(_0xfd36('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfd36('0x14'));var hardwareService=require(_0xfd36('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xfd36('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfd36('0x17'));var db=require(_0xfd36('0x18'))['db'];function respondWithStatusCode(_0x19aab7,_0x2a5e4c){_0x2a5e4c=_0x2a5e4c||0xcc;return function(_0x3d74bc){if(_0x3d74bc){return _0x19aab7[_0xfd36('0x19')](_0x2a5e4c);}return _0x19aab7['status'](_0x2a5e4c)[_0xfd36('0x1a')]();};}function respondWithResult(_0x13e1e0,_0xc60308){_0xc60308=_0xc60308||0xc8;return function(_0x1e8274){if(_0x1e8274){return _0x13e1e0[_0xfd36('0x1b')](_0xc60308)['json'](_0x1e8274);}};}function respondWithFilteredResult(_0x258284,_0x481f0d){return function(_0x2c81c7){if(_0x2c81c7){var _0x435074=_0x2c81c7['count'],_0x4b9213=_0x481f0d[_0xfd36('0x1c')],_0x3d8cab=_0x481f0d[_0xfd36('0x1c')]+_0x481f0d['limit'],_0x170c23;if(_0x3d8cab>=_0x435074){_0x3d8cab=_0x435074;_0x170c23=0xc8;}else{_0x170c23=0xce;}_0x258284[_0xfd36('0x1b')](_0x170c23);return _0x258284['set'](_0xfd36('0x1d'),_0x4b9213+'-'+_0x3d8cab+'/'+_0x435074)[_0xfd36('0x1e')](_0x2c81c7);}return null;};}function patchUpdates(_0x45f9af){return function(_0x3cba64){try{jsonpatch['apply'](_0x3cba64,_0x45f9af,!![]);}catch(_0x248954){return BPromise['reject'](_0x248954);}return _0x3cba64['save']();};}function saveUpdates(_0x4e5da6,_0x1bd0c6){return function(_0x1c67d5){if(_0x1c67d5){return _0x1c67d5[_0xfd36('0x1f')](_0x4e5da6)[_0xfd36('0x20')](function(_0x1dcda6){return _0x1dcda6;});}return null;};}function removeEntity(_0x240b7a,_0xe0327e){return function(_0xc49736){if(_0xc49736){return _0xc49736[_0xfd36('0x21')]()[_0xfd36('0x20')](function(){_0x240b7a[_0xfd36('0x1b')](0xcc)[_0xfd36('0x1a')]();});}};}function handleEntityNotFound(_0x483ebd,_0x8dd9f4){return function(_0x497cff){if(!_0x497cff){_0x483ebd[_0xfd36('0x19')](0x194);}return _0x497cff;};}function handleError(_0x54fcfb,_0x276bd1){_0x276bd1=_0x276bd1||0x1f4;return function(_0x2a7b36){logger[_0xfd36('0x22')](_0x2a7b36[_0xfd36('0x23')]);if(_0x2a7b36['name']){delete _0x2a7b36[_0xfd36('0x24')];}_0x54fcfb[_0xfd36('0x1b')](_0x276bd1)[_0xfd36('0x25')](_0x2a7b36);};}exports['index']=function(_0x485855,_0x14c971){var _0x13b3d2={},_0x2c85d2={},_0x594054={'count':0x0,'rows':[]};var _0x17e833=_[_0xfd36('0x26')](db[_0xfd36('0x27')][_0xfd36('0x28')],function(_0x31d42a){return{'name':_0x31d42a[_0xfd36('0x29')],'type':_0x31d42a[_0xfd36('0x2a')][_0xfd36('0x2b')]};});_0x2c85d2[_0xfd36('0x2c')]=_[_0xfd36('0x26')](_0x17e833,_0xfd36('0x24'));_0x2c85d2[_0xfd36('0x2d')]=_[_0xfd36('0x2e')](_0x485855[_0xfd36('0x2d')]);_0x2c85d2[_0xfd36('0x2f')]=_[_0xfd36('0x30')](_0x2c85d2[_0xfd36('0x2c')],_0x2c85d2[_0xfd36('0x2d')]);_0x13b3d2[_0xfd36('0x31')]=_[_0xfd36('0x30')](_0x2c85d2[_0xfd36('0x2c')],qs[_0xfd36('0x32')](_0x485855[_0xfd36('0x2d')][_0xfd36('0x32')]));_0x13b3d2[_0xfd36('0x31')]=_0x13b3d2[_0xfd36('0x31')][_0xfd36('0x33')]?_0x13b3d2[_0xfd36('0x31')]:_0x2c85d2[_0xfd36('0x2c')];if(!_0x485855['query'][_0xfd36('0x34')](_0xfd36('0x35'))){_0x13b3d2[_0xfd36('0x36')]=qs[_0xfd36('0x36')](_0x485855[_0xfd36('0x2d')]['limit']);_0x13b3d2[_0xfd36('0x1c')]=qs['offset'](_0x485855[_0xfd36('0x2d')][_0xfd36('0x1c')]);}_0x13b3d2[_0xfd36('0x37')]=qs[_0xfd36('0x38')](_0x485855[_0xfd36('0x2d')][_0xfd36('0x38')]);_0x13b3d2[_0xfd36('0x39')]=qs[_0xfd36('0x2f')](_[_0xfd36('0x3a')](_0x485855[_0xfd36('0x2d')],_0x2c85d2[_0xfd36('0x2f')]),_0x17e833);if(_0x485855[_0xfd36('0x2d')][_0xfd36('0x3b')]){_0x13b3d2[_0xfd36('0x39')]=_[_0xfd36('0x3c')](_0x13b3d2[_0xfd36('0x39')],{'$or':_[_0xfd36('0x26')](_0x17e833,function(_0x457df9){if(_0x457df9[_0xfd36('0x2a')]!=='VIRTUAL'){var _0x567f69={};_0x567f69[_0x457df9[_0xfd36('0x24')]]={'$like':'%'+_0x485855['query']['filter']+'%'};return _0x567f69;}})});}_0x13b3d2=_[_0xfd36('0x3c')]({},_0x13b3d2,_0x485855[_0xfd36('0x3d')]);var _0x233e16={'where':_0x13b3d2[_0xfd36('0x39')]};return db[_0xfd36('0x27')][_0xfd36('0x3e')](_0x233e16)[_0xfd36('0x20')](function(_0x25e8fc){_0x594054[_0xfd36('0x3e')]=_0x25e8fc;if(_0x485855['query']['includeAll']){_0x13b3d2[_0xfd36('0x3f')]=[{'all':!![]}];}return db[_0xfd36('0x27')][_0xfd36('0x40')](_0x13b3d2);})['then'](function(_0x2f3412){_0x594054[_0xfd36('0x41')]=_0x2f3412;return _0x594054;})[_0xfd36('0x20')](respondWithFilteredResult(_0x14c971,_0x13b3d2))[_0xfd36('0x42')](handleError(_0x14c971,null));};exports[_0xfd36('0x43')]=function(_0x20da09,_0x2c9c6e){var _0x5f3c94={'raw':!![],'where':{'id':_0x20da09[_0xfd36('0x44')]['id']}},_0x36a8f3={};_0x36a8f3[_0xfd36('0x2c')]=_[_0xfd36('0x2e')](db[_0xfd36('0x27')][_0xfd36('0x28')]);_0x36a8f3['query']=_[_0xfd36('0x2e')](_0x20da09[_0xfd36('0x2d')]);_0x36a8f3[_0xfd36('0x2f')]=_['intersection'](_0x36a8f3[_0xfd36('0x2c')],_0x36a8f3[_0xfd36('0x2d')]);_0x5f3c94['attributes']=_[_0xfd36('0x30')](_0x36a8f3[_0xfd36('0x2c')],qs[_0xfd36('0x32')](_0x20da09['query'][_0xfd36('0x32')]));_0x5f3c94['attributes']=_0x5f3c94[_0xfd36('0x31')][_0xfd36('0x33')]?_0x5f3c94['attributes']:_0x36a8f3[_0xfd36('0x2c')];if(_0x20da09[_0xfd36('0x2d')][_0xfd36('0x45')]){_0x5f3c94[_0xfd36('0x3f')]=[{'all':!![]}];}_0x5f3c94=_[_0xfd36('0x3c')]({},_0x5f3c94,_0x20da09[_0xfd36('0x3d')]);return db['JscriptyAnswerReport'][_0xfd36('0x46')](_0x5f3c94)[_0xfd36('0x20')](handleEntityNotFound(_0x2c9c6e,null))[_0xfd36('0x20')](respondWithResult(_0x2c9c6e,null))[_0xfd36('0x42')](handleError(_0x2c9c6e,null));};exports[_0xfd36('0x47')]=function(_0x11b477,_0xa004a3){return db[_0xfd36('0x27')][_0xfd36('0x47')](_0x11b477[_0xfd36('0x48')],{})[_0xfd36('0x20')](respondWithResult(_0xa004a3,0xc9))[_0xfd36('0x42')](handleError(_0xa004a3,null));};exports[_0xfd36('0x1f')]=function(_0x4050a3,_0x33a145){if(_0x4050a3['body']['id']){delete _0x4050a3[_0xfd36('0x48')]['id'];}return db[_0xfd36('0x27')][_0xfd36('0x46')]({'where':{'id':_0x4050a3[_0xfd36('0x44')]['id']}})[_0xfd36('0x20')](handleEntityNotFound(_0x33a145,null))['then'](saveUpdates(_0x4050a3[_0xfd36('0x48')],null))['then'](respondWithResult(_0x33a145,null))[_0xfd36('0x42')](handleError(_0x33a145,null));};exports[_0xfd36('0x21')]=function(_0x160d19,_0x363eb6){return db['JscriptyAnswerReport'][_0xfd36('0x46')]({'where':{'id':_0x160d19['params']['id']}})[_0xfd36('0x20')](handleEntityNotFound(_0x363eb6,null))['then'](removeEntity(_0x363eb6,null))[_0xfd36('0x42')](handleError(_0x363eb6,null));};exports[_0xfd36('0x49')]=function(_0x7bb0c1,_0x2db742){return db[_0xfd36('0x27')]['describe']()[_0xfd36('0x20')](respondWithResult(_0x2db742,null))['catch'](handleError(_0x2db742,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 6ad300e..bd08f39 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 _0xf546=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x4203a0,_0x1ee83d){var _0x3b0a10=function(_0x564d85){while(--_0x564d85){_0x4203a0['push'](_0x4203a0['shift']());}};_0x3b0a10(++_0x1ee83d);}(_0xf546,0x1d0));var _0x6f54=function(_0x318e7f,_0x4920c5){_0x318e7f=_0x318e7f-0x0;var _0x5aefd9=_0xf546[_0x318e7f];return _0x5aefd9;};'use strict';var _=require(_0x6f54('0x0'));var util=require(_0x6f54('0x1'));var logger=require(_0x6f54('0x2'))(_0x6f54('0x3'));var moment=require(_0x6f54('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f54('0x5'));var rimraf=require(_0x6f54('0x6'));var config=require(_0x6f54('0x7'));var attributes=require(_0x6f54('0x8'));module['exports']=function(_0xefe07,_0x16deff){return _0xefe07['define'](_0x6f54('0x9'),attributes,{'tableName':_0x6f54('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2564=['request-promise','path','rimraf','./jscriptyAnswerReport.attributes','lodash','util','../../config/logger','api','bluebird'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x2564,0x190));var _0x4256=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2564[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4256('0x0'));var util=require(_0x4256('0x1'));var logger=require(_0x4256('0x2'))(_0x4256('0x3'));var moment=require('moment');var BPromise=require(_0x4256('0x4'));var rp=require(_0x4256('0x5'));var fs=require('fs');var path=require(_0x4256('0x6'));var rimraf=require(_0x4256('0x7'));var config=require('../../config/environment');var attributes=require(_0x4256('0x8'));module['exports']=function(_0x1e85e9,_0x2d1758){return _0x1e85e9['define']('JscriptyAnswerReport',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 aafbc74..b329535 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 _0xccf4=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x45e18e,_0x47cc4d){var _0x175e61=function(_0x23d6c4){while(--_0x23d6c4){_0x45e18e['push'](_0x45e18e['shift']());}};_0x175e61(++_0x47cc4d);}(_0xccf4,0x9b));var _0x4ccf=function(_0x49b5de,_0x57fbfc){_0x49b5de=_0x49b5de-0x0;var _0x5e96cb=_0xccf4[_0x49b5de];return _0x5e96cb;};'use strict';var _=require(_0x4ccf('0x0'));var util=require(_0x4ccf('0x1'));var moment=require(_0x4ccf('0x2'));var BPromise=require(_0x4ccf('0x3'));var rs=require(_0x4ccf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ccf('0x5'))['db'];var utils=require(_0x4ccf('0x6'));var logger=require(_0x4ccf('0x7'))(_0x4ccf('0x8'));var config=require(_0x4ccf('0x9'));var jayson=require(_0x4ccf('0xa'));var client=jayson[_0x4ccf('0xb')][_0x4ccf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x183c6a,_0x2fcc80,_0x1470bb){return new BPromise(function(_0xce3dee,_0x1f9508){return client[_0x4ccf('0xd')](_0x183c6a,_0x1470bb)[_0x4ccf('0xe')](function(_0x38d1db){logger[_0x4ccf('0xf')](_0x4ccf('0x10'),_0x2fcc80,_0x4ccf('0x11'));logger[_0x4ccf('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x2fcc80,'request\x20sent',JSON[_0x4ccf('0x13')](_0x38d1db));if(_0x38d1db[_0x4ccf('0x14')]){if(_0x38d1db[_0x4ccf('0x14')][_0x4ccf('0x15')]===0x1f4){logger[_0x4ccf('0x14')](_0x4ccf('0x10'),_0x2fcc80,_0x38d1db[_0x4ccf('0x14')][_0x4ccf('0x16')]);return _0x1f9508(_0x38d1db[_0x4ccf('0x14')][_0x4ccf('0x16')]);}logger[_0x4ccf('0x14')](_0x4ccf('0x10'),_0x2fcc80,_0x38d1db[_0x4ccf('0x14')]['message']);return _0xce3dee(_0x38d1db[_0x4ccf('0x14')]['message']);}else{logger[_0x4ccf('0xf')](_0x4ccf('0x10'),_0x2fcc80,_0x4ccf('0x11'));_0xce3dee(_0x38d1db[_0x4ccf('0x17')][_0x4ccf('0x16')]);}})[_0x4ccf('0x18')](function(_0x1cb785){logger['error'](_0x4ccf('0x10'),_0x2fcc80,_0x1cb785);_0x1f9508(_0x1cb785);});});} \ No newline at end of file +var _0xa52e=['client','http','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x2e6e7a,_0x498be8){var _0xf06058=function(_0x1f460c){while(--_0x1f460c){_0x2e6e7a['push'](_0x2e6e7a['shift']());}};_0xf06058(++_0x498be8);}(_0xa52e,0x98));var _0xea52=function(_0x37ce29,_0x11fa13){_0x37ce29=_0x37ce29-0x0;var _0x5136e0=_0xa52e[_0x37ce29];return _0x5136e0;};'use strict';var _=require(_0xea52('0x0'));var util=require('util');var moment=require(_0xea52('0x1'));var BPromise=require(_0xea52('0x2'));var rs=require(_0xea52('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea52('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xea52('0x5'));var config=require(_0xea52('0x6'));var jayson=require(_0xea52('0x7'));var client=jayson[_0xea52('0x8')][_0xea52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ebb39,_0x2c81c6,_0x5c6b46){return new BPromise(function(_0x112ad0,_0x1136d0){return client['request'](_0x3ebb39,_0x5c6b46)[_0xea52('0xa')](function(_0x29a1f5){logger['info'](_0xea52('0xb'),_0x2c81c6,_0xea52('0xc'));logger[_0xea52('0xd')](_0xea52('0xe'),_0x2c81c6,_0xea52('0xc'),JSON[_0xea52('0xf')](_0x29a1f5));if(_0x29a1f5[_0xea52('0x10')]){if(_0x29a1f5['error']['code']===0x1f4){logger[_0xea52('0x10')](_0xea52('0xb'),_0x2c81c6,_0x29a1f5[_0xea52('0x10')]['message']);return _0x1136d0(_0x29a1f5['error'][_0xea52('0x11')]);}logger['error'](_0xea52('0xb'),_0x2c81c6,_0x29a1f5[_0xea52('0x10')]['message']);return _0x112ad0(_0x29a1f5['error'][_0xea52('0x11')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x2c81c6,_0xea52('0xc'));_0x112ad0(_0x29a1f5[_0xea52('0x12')]['message']);}})[_0xea52('0x13')](function(_0x300169){logger[_0xea52('0x10')](_0xea52('0xb'),_0x2c81c6,_0x300169);_0x1136d0(_0x300169);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 0b6d6bf..7b7f5aa 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 _0x1f7e=['/:id','show','/:id/sessions','isAuthenticated','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','index','get'];(function(_0x36ac10,_0x10d60e){var _0xc3166b=function(_0xb9047e){while(--_0xb9047e){_0x36ac10['push'](_0x36ac10['shift']());}};_0xc3166b(++_0x10d60e);}(_0x1f7e,0xc6));var _0xe1f7=function(_0x3af153,_0x51258e){_0x3af153=_0x3af153-0x0;var _0xdfa90b=_0x1f7e[_0x3af153];return _0xdfa90b;};'use strict';var multer=require(_0xe1f7('0x0'));var util=require(_0xe1f7('0x1'));var path=require(_0xe1f7('0x2'));var timeout=require(_0xe1f7('0x3'));var express=require(_0xe1f7('0x4'));var router=express[_0xe1f7('0x5')]();var auth=require(_0xe1f7('0x6'));var interaction=require(_0xe1f7('0x7'));var config=require(_0xe1f7('0x8'));var controller=require(_0xe1f7('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe1f7('0xa')]);router[_0xe1f7('0xb')](_0xe1f7('0xc'),auth['isAuthenticated'](),controller[_0xe1f7('0xd')]);router[_0xe1f7('0xb')](_0xe1f7('0xe'),auth[_0xe1f7('0xf')](),controller[_0xe1f7('0x10')]);router[_0xe1f7('0xb')](_0xe1f7('0x11'),auth['isAuthenticated'](),controller[_0xe1f7('0x12')]);router[_0xe1f7('0xb')](_0xe1f7('0x13'),auth['isAuthenticated'](),timeout(_0xe1f7('0x14')),controller[_0xe1f7('0x15')]);router[_0xe1f7('0x16')]('/',auth['isAuthenticated'](),controller[_0xe1f7('0x17')]);router['post'](_0xe1f7('0x18'),auth['isAuthenticated'](),controller['clone']);router[_0xe1f7('0x19')](_0xe1f7('0xc'),auth[_0xe1f7('0xf')](),controller[_0xe1f7('0x1a')]);router[_0xe1f7('0x1b')](_0xe1f7('0xc'),auth['isAuthenticated'](),controller[_0xe1f7('0x1c')]);module[_0xe1f7('0x1d')]=router; \ No newline at end of file +var _0xe992=['getSummary','create','post','/:id/clone','clone','put','update','delete','destroy','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary'];(function(_0x19ee96,_0x48b7d5){var _0x57aaf0=function(_0x26f332){while(--_0x26f332){_0x19ee96['push'](_0x19ee96['shift']());}};_0x57aaf0(++_0x48b7d5);}(_0xe992,0x1e5));var _0x2e99=function(_0x132879,_0x4ea457){_0x132879=_0x132879-0x0;var _0x5c58b7=_0xe992[_0x132879];return _0x5c58b7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2e99('0x0'));var express=require(_0x2e99('0x1'));var router=express['Router']();var auth=require(_0x2e99('0x2'));var interaction=require(_0x2e99('0x3'));var config=require('../../config/environment');var controller=require(_0x2e99('0x4'));router[_0x2e99('0x5')]('/',auth['isAuthenticated'](),controller[_0x2e99('0x6')]);router[_0x2e99('0x5')](_0x2e99('0x7'),auth[_0x2e99('0x8')](),controller[_0x2e99('0x9')]);router['get'](_0x2e99('0xa'),auth[_0x2e99('0x8')](),controller[_0x2e99('0xb')]);router[_0x2e99('0x5')](_0x2e99('0xc'),auth[_0x2e99('0x8')](),controller[_0x2e99('0xd')]);router[_0x2e99('0x5')](_0x2e99('0xe'),auth['isAuthenticated'](),timeout('30s'),controller[_0x2e99('0xf')]);router['post']('/',auth[_0x2e99('0x8')](),controller[_0x2e99('0x10')]);router[_0x2e99('0x11')](_0x2e99('0x12'),auth['isAuthenticated'](),controller[_0x2e99('0x13')]);router[_0x2e99('0x14')](_0x2e99('0x7'),auth['isAuthenticated'](),controller[_0x2e99('0x15')]);router[_0x2e99('0x16')](_0x2e99('0x7'),auth[_0x2e99('0x8')](),controller[_0x2e99('0x17')]);module[_0x2e99('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 55ada6c..e8432b5 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 _0x23f3=['stringify','isString','formData','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','exports','STRING','name','long','isObjectLike'];(function(_0x1649ef,_0x588a91){var _0x2d31e5=function(_0xa7ea2c){while(--_0xa7ea2c){_0x1649ef['push'](_0x1649ef['shift']());}};_0x2d31e5(++_0x588a91);}(_0x23f3,0xea));var _0x323f=function(_0x3d3dfb,_0x562f7f){_0x3d3dfb=_0x3d3dfb-0x0;var _0x28a622=_0x23f3[_0x3d3dfb];return _0x28a622;};'use strict';var Sequelize=require('sequelize');var _=require(_0x323f('0x0'));var util=require('util');module[_0x323f('0x1')]={'name':{'type':Sequelize[_0x323f('0x2')],'unique':_0x323f('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x323f('0x4')),'set':function(_0x5a2e21){if(_[_0x323f('0x5')](_0x5a2e21)){this['setDataValue']('formData',JSON[_0x323f('0x6')](_0x5a2e21));}else if(_[_0x323f('0x7')](_0x5a2e21)){this['setDataValue'](_0x323f('0x8'),_0x5a2e21);}else{this[_0x323f('0x9')]('formData',util[_0x323f('0xa')](_0x323f('0xb'),this[_0x323f('0xc')]('name')||'',this[_0x323f('0xc')](_0x323f('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x323f('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x323f('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xbb58=['getDataValue','description','BOOLEAN','lodash','exports','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x3eca41,_0x4665c1){var _0x332066=function(_0x4dee50){while(--_0x4dee50){_0x3eca41['push'](_0x3eca41['shift']());}};_0x332066(++_0x4665c1);}(_0xbb58,0x1f2));var _0x8bb5=function(_0x4329f9,_0xe3c7cc){_0x4329f9=_0x4329f9-0x0;var _0x58985c=_0xbb58[_0x4329f9];return _0x58985c;};'use strict';var Sequelize=require('sequelize');var _=require(_0x8bb5('0x0'));var util=require('util');module[_0x8bb5('0x1')]={'name':{'type':Sequelize[_0x8bb5('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x8bb5('0x2')]},'formData':{'type':Sequelize[_0x8bb5('0x3')](_0x8bb5('0x4')),'set':function(_0x2fbf28){if(_[_0x8bb5('0x5')](_0x2fbf28)){this[_0x8bb5('0x6')](_0x8bb5('0x7'),JSON[_0x8bb5('0x8')](_0x2fbf28));}else if(_[_0x8bb5('0x9')](_0x2fbf28)){this[_0x8bb5('0x6')](_0x8bb5('0x7'),_0x2fbf28);}else{this[_0x8bb5('0x6')](_0x8bb5('0x7'),util[_0x8bb5('0xa')](_0x8bb5('0xb'),this[_0x8bb5('0xc')]('name')||'',this[_0x8bb5('0xc')](_0x8bb5('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x8bb5('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8bb5('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index bfe75fd..e5eb0fd 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 _0x52de=['hasOwnProperty','number','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','include','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','userProfileId','autoAssociation','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','createdAt','UserProfileSection','UserProfileResource','findOne','JscriptySessionReport','order','ProjectId','getAnswers','JscriptyAnswerReport'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x52de,0x1e7));var _0xe52d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x52de[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xe52d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe52d('0x1'));var zipdir=require(_0xe52d('0x2'));var jsonpatch=require(_0xe52d('0x3'));var rp=require(_0xe52d('0x4'));var moment=require('moment');var BPromise=require(_0xe52d('0x5'));var Mustache=require(_0xe52d('0x6'));var util=require(_0xe52d('0x7'));var path=require(_0xe52d('0x8'));var sox=require(_0xe52d('0x9'));var csv=require(_0xe52d('0xa'));var ejs=require(_0xe52d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe52d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe52d('0xa'));var querystring=require(_0xe52d('0xd'));var Papa=require('papaparse');var Redis=require(_0xe52d('0xe'));var authService=require(_0xe52d('0xf'));var qs=require(_0xe52d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe52d('0x11'))(_0xe52d('0x12'));var utils=require('../../config/utils');var config=require(_0xe52d('0x13'));var licenseUtil=require(_0xe52d('0x14'));var db=require(_0xe52d('0x15'))['db'];function respondWithStatusCode(_0x4b7996,_0x593041){_0x593041=_0x593041||0xcc;return function(_0x5e5081){if(_0x5e5081){return _0x4b7996[_0xe52d('0x16')](_0x593041);}return _0x4b7996[_0xe52d('0x17')](_0x593041)[_0xe52d('0x18')]();};}function respondWithResult(_0x193b75,_0x2bbf72){_0x2bbf72=_0x2bbf72||0xc8;return function(_0x5aea25){if(_0x5aea25){return _0x193b75[_0xe52d('0x17')](_0x2bbf72)[_0xe52d('0x19')](_0x5aea25);}};}function respondWithFilteredResult(_0x3528e5,_0x33a2a7){return function(_0x3c7374){if(_0x3c7374){var _0x30dc5d=_0x3c7374[_0xe52d('0x1a')],_0x4ec9fd=_0x33a2a7[_0xe52d('0x1b')],_0x4d93cb=_0x33a2a7[_0xe52d('0x1b')]+_0x33a2a7['limit'],_0x3a8375;if(_0x4d93cb>=_0x30dc5d){_0x4d93cb=_0x30dc5d;_0x3a8375=0xc8;}else{_0x3a8375=0xce;}_0x3528e5['status'](_0x3a8375);return _0x3528e5[_0xe52d('0x1c')](_0xe52d('0x1d'),_0x4ec9fd+'-'+_0x4d93cb+'/'+_0x30dc5d)[_0xe52d('0x19')](_0x3c7374);}return null;};}function patchUpdates(_0xed15a7){return function(_0x344b0c){try{jsonpatch['apply'](_0x344b0c,_0xed15a7,!![]);}catch(_0xb39682){return BPromise[_0xe52d('0x1e')](_0xb39682);}return _0x344b0c[_0xe52d('0x1f')]();};}function saveUpdates(_0x566cb0,_0x267390){return function(_0x5bdba5){if(_0x5bdba5){return _0x5bdba5[_0xe52d('0x20')](_0x566cb0)[_0xe52d('0x21')](function(_0x26a073){return _0x26a073;});}return null;};}function removeEntity(_0x436d30,_0x4491a4){return function(_0x4bf5a8){if(_0x4bf5a8){return _0x4bf5a8['destroy']()[_0xe52d('0x21')](function(){var _0x3e0e4d=_0x4bf5a8['get']({'plain':!![]});var _0x567326='Projects';return db['UserProfileResource']['destroy']({'where':{'type':_0x567326,'resourceId':_0x3e0e4d['id']}})['then'](function(){return _0x4bf5a8;});})[_0xe52d('0x21')](function(){_0x436d30[_0xe52d('0x17')](0xcc)[_0xe52d('0x18')]();});}};}function handleEntityNotFound(_0x5f1291,_0x260fa8){return function(_0x4c28ca){if(!_0x4c28ca){_0x5f1291[_0xe52d('0x16')](0x194);}return _0x4c28ca;};}function handleError(_0x231112,_0x35f3da){_0x35f3da=_0x35f3da||0x1f4;return function(_0x3243e6){logger[_0xe52d('0x22')](_0x3243e6[_0xe52d('0x23')]);if(_0x3243e6['name']){delete _0x3243e6[_0xe52d('0x24')];}_0x231112[_0xe52d('0x17')](_0x35f3da)[_0xe52d('0x25')](_0x3243e6);};}exports['index']=function(_0xdb86ea,_0x124708){var _0xf5f68d={},_0x33e86c={},_0x26ad04={'count':0x0,'rows':[]};var _0x332b5e=_[_0xe52d('0x26')](db[_0xe52d('0x27')][_0xe52d('0x28')],function(_0x3e03d3){return{'name':_0x3e03d3[_0xe52d('0x29')],'type':_0x3e03d3['type'][_0xe52d('0x2a')]};});_0x33e86c[_0xe52d('0x2b')]=_['map'](_0x332b5e,_0xe52d('0x24'));_0x33e86c[_0xe52d('0x2c')]=_[_0xe52d('0x2d')](_0xdb86ea[_0xe52d('0x2c')]);_0x33e86c[_0xe52d('0x2e')]=_[_0xe52d('0x2f')](_0x33e86c[_0xe52d('0x2b')],_0x33e86c['query']);_0xf5f68d['attributes']=_[_0xe52d('0x2f')](_0x33e86c[_0xe52d('0x2b')],qs[_0xe52d('0x30')](_0xdb86ea[_0xe52d('0x2c')][_0xe52d('0x30')]));_0xf5f68d[_0xe52d('0x31')]=_0xf5f68d[_0xe52d('0x31')][_0xe52d('0x32')]?_0xf5f68d[_0xe52d('0x31')]:_0x33e86c[_0xe52d('0x2b')];if(!_0xdb86ea['query']['hasOwnProperty']('nolimit')){_0xf5f68d['limit']=qs[_0xe52d('0x33')](_0xdb86ea[_0xe52d('0x2c')][_0xe52d('0x33')]);_0xf5f68d['offset']=qs[_0xe52d('0x1b')](_0xdb86ea[_0xe52d('0x2c')][_0xe52d('0x1b')]);}_0xf5f68d['order']=qs['sort'](_0xdb86ea['query'][_0xe52d('0x34')]);_0xf5f68d[_0xe52d('0x35')]=qs[_0xe52d('0x2e')](_[_0xe52d('0x36')](_0xdb86ea['query'],_0x33e86c[_0xe52d('0x2e')]),_0x332b5e);if(_0xdb86ea['query'][_0xe52d('0x37')]){_0xf5f68d['where']=_['merge'](_0xf5f68d[_0xe52d('0x35')],{'$or':_['map'](_0x332b5e,function(_0x261b3b){if(_0x261b3b['type']!==_0xe52d('0x38')){var _0x32f5a3={};_0x32f5a3[_0x261b3b[_0xe52d('0x24')]]={'$like':'%'+_0xdb86ea['query'][_0xe52d('0x37')]+'%'};return _0x32f5a3;}})});}_0xf5f68d=_[_0xe52d('0x39')]({},_0xf5f68d,_0xdb86ea[_0xe52d('0x3a')]);var _0xcf63c7={'where':_0xf5f68d[_0xe52d('0x35')]};return db[_0xe52d('0x27')][_0xe52d('0x1a')](_0xcf63c7)['then'](function(_0x1ac32e){_0x26ad04['count']=_0x1ac32e;if(_0xdb86ea[_0xe52d('0x2c')][_0xe52d('0x3b')]){_0xf5f68d['include']=[{'all':!![]}];}return db[_0xe52d('0x27')][_0xe52d('0x3c')](_0xf5f68d);})[_0xe52d('0x21')](function(_0x16a94a){_0x26ad04[_0xe52d('0x3d')]=_0x16a94a;return _0x26ad04;})['then'](respondWithFilteredResult(_0x124708,_0xf5f68d))['catch'](handleError(_0x124708,null));};exports['show']=function(_0x51e1f3,_0x837664){var _0x3e17ff={'raw':![],'where':{'id':_0x51e1f3[_0xe52d('0x3e')]['id']}},_0x49bc25={};_0x49bc25['model']=_[_0xe52d('0x2d')](db['JscriptyProject']['rawAttributes']);_0x49bc25[_0xe52d('0x2c')]=_[_0xe52d('0x2d')](_0x51e1f3['query']);_0x49bc25['filters']=_[_0xe52d('0x2f')](_0x49bc25[_0xe52d('0x2b')],_0x49bc25['query']);_0x3e17ff['attributes']=_[_0xe52d('0x2f')](_0x49bc25['model'],qs[_0xe52d('0x30')](_0x51e1f3[_0xe52d('0x2c')]['fields']));_0x3e17ff[_0xe52d('0x31')]=_0x3e17ff[_0xe52d('0x31')][_0xe52d('0x32')]?_0x3e17ff['attributes']:_0x49bc25[_0xe52d('0x2b')];if(_0x51e1f3['query'][_0xe52d('0x3b')]){_0x3e17ff[_0xe52d('0x3f')]=[{'all':!![]}];}_0x3e17ff=_[_0xe52d('0x39')]({},_0x3e17ff,_0x51e1f3[_0xe52d('0x3a')]);return db[_0xe52d('0x27')][_0xe52d('0x40')](_0x3e17ff)[_0xe52d('0x21')](handleEntityNotFound(_0x837664,null))[_0xe52d('0x21')](respondWithResult(_0x837664,null))['catch'](handleError(_0x837664,null));};exports['create']=function(_0x201048,_0x581893){return db[_0xe52d('0x27')]['create'](_0x201048[_0xe52d('0x41')],{})[_0xe52d('0x21')](function(_0x25ccf5){var _0x269088=_0x201048[_0xe52d('0x42')][_0xe52d('0x43')]({'plain':!![]});if(!_0x269088)throw new Error(_0xe52d('0x44'));if(_0x269088[_0xe52d('0x45')]===_0xe52d('0x42')){var _0x15f5ee=_0x25ccf5[_0xe52d('0x43')]({'plain':!![]});var _0x1b0b96=_0xe52d('0x46');return db['UserProfileSection'][_0xe52d('0x40')]({'where':{'name':_0x1b0b96,'userProfileId':_0x269088[_0xe52d('0x47')]},'raw':!![]})[_0xe52d('0x21')](function(_0x60d35){if(_0x60d35&&_0x60d35[_0xe52d('0x48')]===0x0){return db['UserProfileResource'][_0xe52d('0x49')]({'name':_0x15f5ee[_0xe52d('0x24')],'resourceId':_0x15f5ee['id'],'type':_0x60d35[_0xe52d('0x24')],'sectionId':_0x60d35['id']},{})[_0xe52d('0x21')](function(){return _0x25ccf5;});}else{return _0x25ccf5;}})[_0xe52d('0x4a')](function(_0x571776){logger[_0xe52d('0x22')](_0xe52d('0x4b'),_0x571776);throw _0x571776;});}return _0x25ccf5;})[_0xe52d('0x21')](respondWithResult(_0x581893,0xc9))[_0xe52d('0x4a')](handleError(_0x581893,null));};exports[_0xe52d('0x4c')]=function(_0x1c1228,_0x4160ce){var _0x2f8549={'where':{'id':_0x1c1228['params']['id']}},_0x4398bb={};_0x4398bb['model']=_[_0xe52d('0x2d')](db[_0xe52d('0x27')]['rawAttributes']);_0x2f8549[_0xe52d('0x31')]=_[_0xe52d('0x2f')](_0x4398bb[_0xe52d('0x2b')],qs['fields'](_0x1c1228['query'][_0xe52d('0x30')]));_0x2f8549[_0xe52d('0x31')]=_0x2f8549[_0xe52d('0x31')]['length']?_0x2f8549[_0xe52d('0x31')]:_0x4398bb[_0xe52d('0x2b')];if(_0x1c1228[_0xe52d('0x2c')][_0xe52d('0x3b')]){_0x2f8549[_0xe52d('0x3f')]=[{'all':!![]}];}_0x2f8549=_['merge']({},_0x2f8549,_0x1c1228[_0xe52d('0x3a')]);return db[_0xe52d('0x27')][_0xe52d('0x40')](_0x2f8549)[_0xe52d('0x21')](handleEntityNotFound(_0x4160ce,null))[_0xe52d('0x21')](function(_0x4fbb0b){if(_0x4fbb0b){var _0x3a6a05=_0x4fbb0b[_0xe52d('0x43')]({'plain':!![]});_0x3a6a05=qs['omit'](_0x3a6a05,['id','createdAt',_0xe52d('0x4d')]);_0x1c1228['body']=_[_0xe52d('0x4e')](_0x1c1228[_0xe52d('0x41')],['id',_0xe52d('0x4f'),_0xe52d('0x4d')]);return db[_0xe52d('0x27')][_0xe52d('0x49')](_[_0xe52d('0x39')](_0x3a6a05,_0x1c1228['body']),{'include':_0x1c1228[_0xe52d('0x2c')][_0xe52d('0x3b')]?[{'all':!![]}]:undefined})[_0xe52d('0x21')](function(_0x3e4f3){var _0x4796b7=_0x1c1228[_0xe52d('0x42')][_0xe52d('0x43')]({'plain':!![]});if(!_0x4796b7)throw new Error(_0xe52d('0x44'));if(_0x4796b7['role']==='user'){var _0x5547cb=_0x3e4f3['get']({'plain':!![]});var _0x4861c4=_0xe52d('0x46');return db[_0xe52d('0x50')][_0xe52d('0x40')]({'where':{'name':_0x4861c4,'userProfileId':_0x4796b7[_0xe52d('0x47')]},'raw':!![]})['then'](function(_0x4b18fb){if(_0x4b18fb&&_0x4b18fb[_0xe52d('0x48')]===0x0){return db[_0xe52d('0x51')][_0xe52d('0x49')]({'name':_0x5547cb[_0xe52d('0x24')],'resourceId':_0x5547cb['id'],'type':_0x4b18fb[_0xe52d('0x24')],'sectionId':_0x4b18fb['id']},{})[_0xe52d('0x21')](function(){return _0x3e4f3;});}else{return _0x3e4f3;}})[_0xe52d('0x4a')](function(_0x1a9833){logger['error'](_0xe52d('0x4b'),_0x1a9833);throw _0x1a9833;});}return _0x3e4f3;});}})[_0xe52d('0x21')](respondWithResult(_0x4160ce,0xc9))[_0xe52d('0x4a')](handleError(_0x4160ce,null));};exports[_0xe52d('0x20')]=function(_0xe78785,_0x3d624c){if(_0xe78785[_0xe52d('0x41')]['id']){delete _0xe78785[_0xe52d('0x41')]['id'];}return db[_0xe52d('0x27')][_0xe52d('0x40')]({'where':{'id':_0xe78785[_0xe52d('0x3e')]['id']}})[_0xe52d('0x21')](handleEntityNotFound(_0x3d624c,null))[_0xe52d('0x21')](saveUpdates(_0xe78785[_0xe52d('0x41')],null))[_0xe52d('0x21')](respondWithResult(_0x3d624c,null))['catch'](handleError(_0x3d624c,null));};exports['destroy']=function(_0x3e3e21,_0x21746a){return db[_0xe52d('0x27')][_0xe52d('0x40')]({'where':{'id':_0x3e3e21[_0xe52d('0x3e')]['id']}})[_0xe52d('0x21')](handleEntityNotFound(_0x21746a,null))[_0xe52d('0x21')](removeEntity(_0x21746a,null))[_0xe52d('0x4a')](handleError(_0x21746a,null));};exports['getSessions']=function(_0xe60e4a,_0x4d98a9,_0xc2d6a5){var _0x748ff5={'raw':!![],'where':{}};var _0x589959={};var _0x338639={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xe52d('0x52')]({'where':{'id':_0xe60e4a[_0xe52d('0x3e')]['id']}})[_0xe52d('0x21')](handleEntityNotFound(_0x4d98a9,null))['then'](function(_0x34d420){if(_0x34d420){_0x589959[_0xe52d('0x2b')]=_['keys'](db[_0xe52d('0x53')]['rawAttributes']);_0x589959['query']=_[_0xe52d('0x2d')](_0xe60e4a[_0xe52d('0x2c')]);_0x589959[_0xe52d('0x2e')]=_[_0xe52d('0x2f')](_0x589959[_0xe52d('0x2b')],_0x589959[_0xe52d('0x2c')]);_0x748ff5['attributes']=_[_0xe52d('0x2f')](_0x589959[_0xe52d('0x2b')],qs['fields'](_0xe60e4a[_0xe52d('0x2c')][_0xe52d('0x30')]));_0x748ff5[_0xe52d('0x31')]=_0x748ff5[_0xe52d('0x31')]['length']?_0x748ff5[_0xe52d('0x31')]:_0x589959[_0xe52d('0x2b')];if(!_0xe60e4a['query']['hasOwnProperty']('nolimit')){_0x748ff5[_0xe52d('0x33')]=qs[_0xe52d('0x33')](_0xe60e4a[_0xe52d('0x2c')][_0xe52d('0x33')]);_0x748ff5[_0xe52d('0x1b')]=qs[_0xe52d('0x1b')](_0xe60e4a[_0xe52d('0x2c')]['offset']);}_0x748ff5[_0xe52d('0x54')]=qs['sort'](_0xe60e4a[_0xe52d('0x2c')][_0xe52d('0x34')]);_0x748ff5['where']=qs['filters'](_[_0xe52d('0x36')](_0xe60e4a[_0xe52d('0x2c')],_0x589959[_0xe52d('0x2e')]));_0x748ff5[_0xe52d('0x35')][_0xe52d('0x55')]=_0x34d420['id'];if(_0xe60e4a[_0xe52d('0x2c')][_0xe52d('0x37')]){_0x748ff5[_0xe52d('0x35')]=_[_0xe52d('0x39')](_0x748ff5[_0xe52d('0x35')],{'$or':_[_0xe52d('0x26')](_0x748ff5['attributes'],function(_0x171aa6){var _0x418605={};_0x418605[_0x171aa6]={'$like':'%'+_0xe60e4a[_0xe52d('0x2c')][_0xe52d('0x37')]+'%'};return _0x418605;})});}_0x748ff5=_[_0xe52d('0x39')]({},_0x748ff5,_0xe60e4a['options']);return db['JscriptySessionReport'][_0xe52d('0x1a')]({'where':_0x748ff5[_0xe52d('0x35')]})[_0xe52d('0x21')](function(_0x504d7a){_0x338639[_0xe52d('0x1a')]=_0x504d7a;if(_0xe60e4a['query'][_0xe52d('0x3b')]){_0x748ff5[_0xe52d('0x3f')]=[{'all':!![]}];}return db[_0xe52d('0x53')][_0xe52d('0x3c')](_0x748ff5);})[_0xe52d('0x21')](function(_0x416f7f){_0x338639['rows']=_0x416f7f;return _0x338639;});}})[_0xe52d('0x21')](respondWithFilteredResult(_0x4d98a9,_0x748ff5))['catch'](handleError(_0x4d98a9,null));};exports[_0xe52d('0x56')]=function(_0x109bf7,_0x368a0f,_0x412893){var _0x3221cd={'raw':!![],'where':{}};var _0x53aec7={};var _0x3bb267={'count':0x0,'rows':[]};return db[_0xe52d('0x27')][_0xe52d('0x52')]({'where':{'id':_0x109bf7[_0xe52d('0x3e')]['id']}})[_0xe52d('0x21')](handleEntityNotFound(_0x368a0f,null))['then'](function(_0x2b872a){if(_0x2b872a){_0x53aec7[_0xe52d('0x2b')]=_[_0xe52d('0x2d')](db[_0xe52d('0x57')][_0xe52d('0x28')]);_0x53aec7[_0xe52d('0x2c')]=_[_0xe52d('0x2d')](_0x109bf7['query']);_0x53aec7[_0xe52d('0x2e')]=_[_0xe52d('0x2f')](_0x53aec7[_0xe52d('0x2b')],_0x53aec7[_0xe52d('0x2c')]);_0x3221cd['attributes']=_['intersection'](_0x53aec7['model'],qs[_0xe52d('0x30')](_0x109bf7[_0xe52d('0x2c')]['fields']));_0x3221cd['attributes']=_0x3221cd[_0xe52d('0x31')][_0xe52d('0x32')]?_0x3221cd['attributes']:_0x53aec7[_0xe52d('0x2b')];if(!_0x109bf7[_0xe52d('0x2c')][_0xe52d('0x58')]('nolimit')){_0x3221cd[_0xe52d('0x33')]=qs['limit'](_0x109bf7[_0xe52d('0x2c')]['limit']);_0x3221cd[_0xe52d('0x1b')]=qs[_0xe52d('0x1b')](_0x109bf7[_0xe52d('0x2c')][_0xe52d('0x1b')]);}_0x3221cd['order']=qs[_0xe52d('0x34')](_0x109bf7[_0xe52d('0x2c')][_0xe52d('0x34')]);_0x3221cd['where']=qs['filters'](_[_0xe52d('0x36')](_0x109bf7['query'],_0x53aec7[_0xe52d('0x2e')]));_0x3221cd[_0xe52d('0x35')][_0xe52d('0x55')]=_0x2b872a['id'];if(_0x109bf7['query'][_0xe52d('0x37')]){_0x3221cd[_0xe52d('0x35')]=_[_0xe52d('0x39')](_0x3221cd[_0xe52d('0x35')],{'$or':_[_0xe52d('0x26')](_0x3221cd[_0xe52d('0x31')],function(_0x21b8b2){var _0x504fe6={};_0x504fe6[_0x21b8b2]={'$like':'%'+_0x109bf7[_0xe52d('0x2c')][_0xe52d('0x37')]+'%'};return _0x504fe6;})});}_0x3221cd=_[_0xe52d('0x39')]({},_0x3221cd,_0x109bf7[_0xe52d('0x3a')]);return db['JscriptyAnswerReport'][_0xe52d('0x1a')]({'where':_0x3221cd[_0xe52d('0x35')]})[_0xe52d('0x21')](function(_0x441320){_0x3bb267['count']=_0x441320;if(_0x109bf7[_0xe52d('0x2c')][_0xe52d('0x3b')]){_0x3221cd[_0xe52d('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xe52d('0x3c')](_0x3221cd);})[_0xe52d('0x21')](function(_0x221e43){_0x3bb267[_0xe52d('0x3d')]=_0x221e43;return _0x3bb267;});}})[_0xe52d('0x21')](respondWithFilteredResult(_0x368a0f,_0x3221cd))[_0xe52d('0x4a')](handleError(_0x368a0f,null));};function char(_0x465938){return _0xe52d('0x59')===typeof _0x465938?String['fromCharCode'][_0xe52d('0x5a')](null,arguments):_0x465938;}function needsEncapsulation(_0x2ad57a){return!!_0x2ad57a&&(_0x2ad57a[_0xe52d('0x5b')]()['indexOf'](char(0xd))>=0x0||_0x2ad57a[_0xe52d('0x5b')]()[_0xe52d('0x5c')](char(0xa))>=0x0||_0x2ad57a[_0xe52d('0x5b')]()[_0xe52d('0x5c')](char(0x2c))>=0x0||_0x2ad57a['toString']()[_0xe52d('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x483ebb){var _0x2278c2=char(0x22),_0x259f04='\x5c'+char(0x22),_0x47e3c2=_0x483ebb[_0xe52d('0x5b')]()[_0xe52d('0x5d')](new RegExp(_0x2278c2,'g'),_0x259f04);return _0x2278c2+_0x47e3c2+_0x2278c2;}exports[_0xe52d('0x5e')]=function(_0xc66489,_0x45d599,_0x329ba8){var _0x2eab7b,_0x7a6a8f;var _0x2aedc1={'where':{'ProjectId':_0xc66489['params']['id']}};if(_0xc66489[_0xe52d('0x2c')][_0xe52d('0x5f')]){_0x2aedc1[_0xe52d('0x35')][_0xe52d('0x60')]=JSON[_0xe52d('0x61')](_0xc66489['query'][_0xe52d('0x5f')]);}return db['JscriptySessionReport'][_0xe52d('0x3c')](_0x2aedc1)[_0xe52d('0x21')](handleEntityNotFound(_0x45d599,null))[_0xe52d('0x21')](function(_0x4ba0d8){if(_0x4ba0d8){_0x2eab7b=_0x4ba0d8;return db[_0xe52d('0x62')][_0xe52d('0x3c')]({'where':{'SessionId':{'$in':_[_0xe52d('0x26')](_0x2eab7b,'id')},'ProjectId':_0xc66489[_0xe52d('0x3e')]['id']},'order':'-createdAt'});}})[_0xe52d('0x21')](handleEntityNotFound(_0x45d599,null))['then'](function(_0x46534e){if(_0x46534e){_0x7a6a8f=_0x46534e;var _0x4de4cb={};for(var _0x1e55c2=0x0,_0x2f6194=_0x7a6a8f[_0xe52d('0x32')];_0x1e55c2<_0x2f6194;_0x1e55c2++){if(!_0x4de4cb[_0xe52d('0x58')](_0x7a6a8f[_0x1e55c2][_0xe52d('0x63')])){_0x4de4cb[_0x7a6a8f[_0x1e55c2][_0xe52d('0x63')]]=needsEncapsulation(_0x7a6a8f[_0x1e55c2][_0xe52d('0x64')])?encapsulate(_0x7a6a8f[_0x1e55c2][_0xe52d('0x64')]):_0x7a6a8f[_0x1e55c2][_0xe52d('0x64')];}}var _0x9ec816=[],_0x4331e9={};for(var _0x3454cf=0x0,_0x8aa48d=_0x2eab7b['length'];_0x3454cf<_0x8aa48d;_0x3454cf++){_0x4331e9={'ProjectId':_0xc66489[_0xe52d('0x3e')]['id'],'SessionId':_0x2eab7b[_0x3454cf]['id'],'StartTime':moment(_0x2eab7b[_0x3454cf][_0xe52d('0x60')])['format'](_0xe52d('0x65'))};for(var _0x20ac66=0x0,_0x5bc98e=_0x7a6a8f[_0xe52d('0x32')];_0x20ac66<_0x5bc98e;_0x20ac66++){if(_0x7a6a8f[_0x20ac66]['SessionId']==_0x2eab7b[_0x3454cf]['id']&&_0x4de4cb['hasOwnProperty'](_0x7a6a8f[_0x20ac66][_0xe52d('0x63')])){_0x4331e9[_0x4de4cb[_0x7a6a8f[_0x20ac66][_0xe52d('0x63')]]]=_0x7a6a8f[_0x20ac66][_0xe52d('0x66')];}}for(var _0xcff65c in _0x4de4cb){if(!_0x4331e9[_0xe52d('0x58')](_0x4de4cb[_0xcff65c])){_0x4331e9[_0x4de4cb[_0xcff65c]]=null;}}_0x9ec816[_0xe52d('0x67')](_0x4331e9);}return _0x9ec816;}})['then'](function(_0x29cab2){if(!_[_0xe52d('0x68')](_0x29cab2)){var _0xe1f7e=toCsv(_0x29cab2);var _0x36a078=Date[_0xe52d('0x69')]();fs[_0xe52d('0x6a')](util[_0xe52d('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xc66489[_0xe52d('0x3e')]['id'],_0x36a078),_0xe1f7e);_0x45d599[_0xe52d('0x6c')](_0xe52d('0x6d'),_0xe52d('0x6e')+util[_0xe52d('0x6b')](_0xe52d('0x6f'),_0xc66489[_0xe52d('0x3e')]['id'],_0x36a078));_0x45d599['setHeader'](_0xe52d('0x70'),'text/csv');return _0x45d599[_0xe52d('0x71')](util[_0xe52d('0x6b')](_0xe52d('0x72'),_0xc66489[_0xe52d('0x3e')]['id'],_0x36a078));}else{return _0x45d599['sendStatus'](0xcc);}})[_0xe52d('0x4a')](handleError(_0x45d599,null));}; \ No newline at end of file +var _0x1e2c=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','get','Projects','UserProfileResource','destroy','error','name','index','map','JscriptyProject','rawAttributes','fieldName','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','include','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getSessions','findOne','hasOwnProperty','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x123dd0,_0x59473c){var _0x2df37f=function(_0x471ef0){while(--_0x471ef0){_0x123dd0['push'](_0x123dd0['shift']());}};_0x2df37f(++_0x59473c);}(_0x1e2c,0x69));var _0xc1e2=function(_0x2efae9,_0x36818d){_0x2efae9=_0x2efae9-0x0;var _0x585ffe=_0x1e2c[_0x2efae9];return _0x585ffe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc1e2('0x0'));var rimraf=require(_0xc1e2('0x1'));var zipdir=require(_0xc1e2('0x2'));var jsonpatch=require(_0xc1e2('0x3'));var rp=require(_0xc1e2('0x4'));var moment=require(_0xc1e2('0x5'));var BPromise=require(_0xc1e2('0x6'));var Mustache=require(_0xc1e2('0x7'));var util=require(_0xc1e2('0x8'));var path=require(_0xc1e2('0x9'));var sox=require(_0xc1e2('0xa'));var csv=require('to-csv');var ejs=require(_0xc1e2('0xb'));var fs=require('fs');var _=require(_0xc1e2('0xc'));var squel=require('squel');var crypto=require(_0xc1e2('0xd'));var jsforce=require(_0xc1e2('0xe'));var deskjs=require(_0xc1e2('0xf'));var toCsv=require(_0xc1e2('0x10'));var querystring=require(_0xc1e2('0x11'));var Papa=require(_0xc1e2('0x12'));var Redis=require(_0xc1e2('0x13'));var authService=require(_0xc1e2('0x14'));var qs=require(_0xc1e2('0x15'));var as=require(_0xc1e2('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1e2('0x17'))('api');var utils=require(_0xc1e2('0x18'));var config=require(_0xc1e2('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1e2('0x1a'))['db'];function respondWithStatusCode(_0xe8b660,_0x69c1ec){_0x69c1ec=_0x69c1ec||0xcc;return function(_0x2aba6a){if(_0x2aba6a){return _0xe8b660[_0xc1e2('0x1b')](_0x69c1ec);}return _0xe8b660[_0xc1e2('0x1c')](_0x69c1ec)[_0xc1e2('0x1d')]();};}function respondWithResult(_0x38f747,_0x5fa130){_0x5fa130=_0x5fa130||0xc8;return function(_0x26c1e8){if(_0x26c1e8){return _0x38f747['status'](_0x5fa130)['json'](_0x26c1e8);}};}function respondWithFilteredResult(_0x2f4b6a,_0xf61a4d){return function(_0x17c12c){if(_0x17c12c){var _0x551710=_0x17c12c[_0xc1e2('0x1e')],_0x3b833a=_0xf61a4d['offset'],_0xc36f1c=_0xf61a4d[_0xc1e2('0x1f')]+_0xf61a4d[_0xc1e2('0x20')],_0x2828ff;if(_0xc36f1c>=_0x551710){_0xc36f1c=_0x551710;_0x2828ff=0xc8;}else{_0x2828ff=0xce;}_0x2f4b6a[_0xc1e2('0x1c')](_0x2828ff);return _0x2f4b6a[_0xc1e2('0x21')](_0xc1e2('0x22'),_0x3b833a+'-'+_0xc36f1c+'/'+_0x551710)[_0xc1e2('0x23')](_0x17c12c);}return null;};}function patchUpdates(_0x37eab8){return function(_0x348b49){try{jsonpatch[_0xc1e2('0x24')](_0x348b49,_0x37eab8,!![]);}catch(_0x14b078){return BPromise['reject'](_0x14b078);}return _0x348b49[_0xc1e2('0x25')]();};}function saveUpdates(_0x4a3eaa,_0x11ae40){return function(_0x94ab43){if(_0x94ab43){return _0x94ab43[_0xc1e2('0x26')](_0x4a3eaa)['then'](function(_0x318434){return _0x318434;});}return null;};}function removeEntity(_0x3d7b22,_0x23b98d){return function(_0x53bb82){if(_0x53bb82){return _0x53bb82['destroy']()[_0xc1e2('0x27')](function(){var _0x8d0e5b=_0x53bb82[_0xc1e2('0x28')]({'plain':!![]});var _0x398bfc=_0xc1e2('0x29');return db[_0xc1e2('0x2a')][_0xc1e2('0x2b')]({'where':{'type':_0x398bfc,'resourceId':_0x8d0e5b['id']}})['then'](function(){return _0x53bb82;});})['then'](function(){_0x3d7b22[_0xc1e2('0x1c')](0xcc)[_0xc1e2('0x1d')]();});}};}function handleEntityNotFound(_0x1ff7b5,_0x26d4b1){return function(_0x465cbf){if(!_0x465cbf){_0x1ff7b5['sendStatus'](0x194);}return _0x465cbf;};}function handleError(_0x3ee3d4,_0x34afdb){_0x34afdb=_0x34afdb||0x1f4;return function(_0x30eb8a){logger[_0xc1e2('0x2c')](_0x30eb8a['stack']);if(_0x30eb8a[_0xc1e2('0x2d')]){delete _0x30eb8a[_0xc1e2('0x2d')];}_0x3ee3d4['status'](_0x34afdb)['send'](_0x30eb8a);};}exports[_0xc1e2('0x2e')]=function(_0x2e67b9,_0x31c626){var _0x177159={},_0x506bf4={},_0xf5c546={'count':0x0,'rows':[]};var _0x5211fd=_[_0xc1e2('0x2f')](db[_0xc1e2('0x30')][_0xc1e2('0x31')],function(_0x24c333){return{'name':_0x24c333[_0xc1e2('0x32')],'type':_0x24c333['type']['key']};});_0x506bf4[_0xc1e2('0x33')]=_['map'](_0x5211fd,'name');_0x506bf4['query']=_[_0xc1e2('0x34')](_0x2e67b9['query']);_0x506bf4[_0xc1e2('0x35')]=_[_0xc1e2('0x36')](_0x506bf4[_0xc1e2('0x33')],_0x506bf4[_0xc1e2('0x37')]);_0x177159['attributes']=_[_0xc1e2('0x36')](_0x506bf4[_0xc1e2('0x33')],qs[_0xc1e2('0x38')](_0x2e67b9['query'][_0xc1e2('0x38')]));_0x177159[_0xc1e2('0x39')]=_0x177159['attributes'][_0xc1e2('0x3a')]?_0x177159[_0xc1e2('0x39')]:_0x506bf4[_0xc1e2('0x33')];if(!_0x2e67b9[_0xc1e2('0x37')]['hasOwnProperty'](_0xc1e2('0x3b'))){_0x177159[_0xc1e2('0x20')]=qs[_0xc1e2('0x20')](_0x2e67b9[_0xc1e2('0x37')]['limit']);_0x177159[_0xc1e2('0x1f')]=qs[_0xc1e2('0x1f')](_0x2e67b9[_0xc1e2('0x37')][_0xc1e2('0x1f')]);}_0x177159[_0xc1e2('0x3c')]=qs[_0xc1e2('0x3d')](_0x2e67b9[_0xc1e2('0x37')][_0xc1e2('0x3d')]);_0x177159[_0xc1e2('0x3e')]=qs[_0xc1e2('0x35')](_[_0xc1e2('0x3f')](_0x2e67b9['query'],_0x506bf4[_0xc1e2('0x35')]),_0x5211fd);if(_0x2e67b9['query'][_0xc1e2('0x40')]){_0x177159[_0xc1e2('0x3e')]=_[_0xc1e2('0x41')](_0x177159[_0xc1e2('0x3e')],{'$or':_[_0xc1e2('0x2f')](_0x5211fd,function(_0x473688){if(_0x473688[_0xc1e2('0x42')]!=='VIRTUAL'){var _0x3f733a={};_0x3f733a[_0x473688[_0xc1e2('0x2d')]]={'$like':'%'+_0x2e67b9[_0xc1e2('0x37')][_0xc1e2('0x40')]+'%'};return _0x3f733a;}})});}_0x177159=_[_0xc1e2('0x41')]({},_0x177159,_0x2e67b9[_0xc1e2('0x43')]);var _0x5e3368={'where':_0x177159[_0xc1e2('0x3e')]};return db[_0xc1e2('0x30')][_0xc1e2('0x1e')](_0x5e3368)[_0xc1e2('0x27')](function(_0x1da7a4){_0xf5c546[_0xc1e2('0x1e')]=_0x1da7a4;if(_0x2e67b9[_0xc1e2('0x37')]['includeAll']){_0x177159['include']=[{'all':!![]}];}return db[_0xc1e2('0x30')][_0xc1e2('0x44')](_0x177159);})[_0xc1e2('0x27')](function(_0x4a0826){_0xf5c546[_0xc1e2('0x45')]=_0x4a0826;return _0xf5c546;})[_0xc1e2('0x27')](respondWithFilteredResult(_0x31c626,_0x177159))[_0xc1e2('0x46')](handleError(_0x31c626,null));};exports[_0xc1e2('0x47')]=function(_0x31dc46,_0xcd28d3){var _0x4035f1={'raw':![],'where':{'id':_0x31dc46['params']['id']}},_0x26a1bf={};_0x26a1bf[_0xc1e2('0x33')]=_[_0xc1e2('0x34')](db[_0xc1e2('0x30')][_0xc1e2('0x31')]);_0x26a1bf[_0xc1e2('0x37')]=_['keys'](_0x31dc46[_0xc1e2('0x37')]);_0x26a1bf[_0xc1e2('0x35')]=_['intersection'](_0x26a1bf[_0xc1e2('0x33')],_0x26a1bf['query']);_0x4035f1['attributes']=_[_0xc1e2('0x36')](_0x26a1bf['model'],qs[_0xc1e2('0x38')](_0x31dc46['query']['fields']));_0x4035f1[_0xc1e2('0x39')]=_0x4035f1[_0xc1e2('0x39')][_0xc1e2('0x3a')]?_0x4035f1[_0xc1e2('0x39')]:_0x26a1bf[_0xc1e2('0x33')];if(_0x31dc46[_0xc1e2('0x37')][_0xc1e2('0x48')]){_0x4035f1['include']=[{'all':!![]}];}_0x4035f1=_[_0xc1e2('0x41')]({},_0x4035f1,_0x31dc46['options']);return db['JscriptyProject'][_0xc1e2('0x49')](_0x4035f1)[_0xc1e2('0x27')](handleEntityNotFound(_0xcd28d3,null))[_0xc1e2('0x27')](respondWithResult(_0xcd28d3,null))[_0xc1e2('0x46')](handleError(_0xcd28d3,null));};exports[_0xc1e2('0x4a')]=function(_0x4800ee,_0x2eada6){return db['JscriptyProject'][_0xc1e2('0x4a')](_0x4800ee[_0xc1e2('0x4b')],{})[_0xc1e2('0x27')](function(_0x3fe7d6){var _0x4ed320=_0x4800ee[_0xc1e2('0x4c')][_0xc1e2('0x28')]({'plain':!![]});if(!_0x4ed320)throw new Error(_0xc1e2('0x4d'));if(_0x4ed320[_0xc1e2('0x4e')]===_0xc1e2('0x4c')){var _0x5930a8=_0x3fe7d6['get']({'plain':!![]});var _0x2d28c7='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x2d28c7,'userProfileId':_0x4ed320[_0xc1e2('0x4f')]},'raw':!![]})[_0xc1e2('0x27')](function(_0x1ccf1e){if(_0x1ccf1e&&_0x1ccf1e[_0xc1e2('0x50')]===0x0){return db[_0xc1e2('0x2a')][_0xc1e2('0x4a')]({'name':_0x5930a8[_0xc1e2('0x2d')],'resourceId':_0x5930a8['id'],'type':_0x1ccf1e[_0xc1e2('0x2d')],'sectionId':_0x1ccf1e['id']},{})[_0xc1e2('0x27')](function(){return _0x3fe7d6;});}else{return _0x3fe7d6;}})[_0xc1e2('0x46')](function(_0x40282d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40282d);throw _0x40282d;});}return _0x3fe7d6;})[_0xc1e2('0x27')](respondWithResult(_0x2eada6,0xc9))[_0xc1e2('0x46')](handleError(_0x2eada6,null));};exports[_0xc1e2('0x51')]=function(_0x400807,_0x377b4d){var _0x267361={'where':{'id':_0x400807['params']['id']}},_0x39c4c8={};_0x39c4c8[_0xc1e2('0x33')]=_[_0xc1e2('0x34')](db[_0xc1e2('0x30')][_0xc1e2('0x31')]);_0x267361[_0xc1e2('0x39')]=_[_0xc1e2('0x36')](_0x39c4c8[_0xc1e2('0x33')],qs[_0xc1e2('0x38')](_0x400807[_0xc1e2('0x37')][_0xc1e2('0x38')]));_0x267361[_0xc1e2('0x39')]=_0x267361[_0xc1e2('0x39')][_0xc1e2('0x3a')]?_0x267361['attributes']:_0x39c4c8[_0xc1e2('0x33')];if(_0x400807[_0xc1e2('0x37')][_0xc1e2('0x48')]){_0x267361[_0xc1e2('0x52')]=[{'all':!![]}];}_0x267361=_[_0xc1e2('0x41')]({},_0x267361,_0x400807[_0xc1e2('0x43')]);return db[_0xc1e2('0x30')][_0xc1e2('0x49')](_0x267361)[_0xc1e2('0x27')](handleEntityNotFound(_0x377b4d,null))[_0xc1e2('0x27')](function(_0x59190d){if(_0x59190d){var _0x1f8609=_0x59190d[_0xc1e2('0x28')]({'plain':!![]});_0x1f8609=qs['omit'](_0x1f8609,['id','createdAt','updatedAt']);_0x400807[_0xc1e2('0x4b')]=_[_0xc1e2('0x53')](_0x400807['body'],['id',_0xc1e2('0x54'),_0xc1e2('0x55')]);return db['JscriptyProject'][_0xc1e2('0x4a')](_[_0xc1e2('0x41')](_0x1f8609,_0x400807['body']),{'include':_0x400807[_0xc1e2('0x37')][_0xc1e2('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x3c53c9){var _0x3b3696=_0x400807[_0xc1e2('0x4c')]['get']({'plain':!![]});if(!_0x3b3696)throw new Error(_0xc1e2('0x4d'));if(_0x3b3696[_0xc1e2('0x4e')]===_0xc1e2('0x4c')){var _0x5a68de=_0x3c53c9['get']({'plain':!![]});var _0x2595f0=_0xc1e2('0x29');return db[_0xc1e2('0x56')][_0xc1e2('0x49')]({'where':{'name':_0x2595f0,'userProfileId':_0x3b3696[_0xc1e2('0x4f')]},'raw':!![]})[_0xc1e2('0x27')](function(_0x5f8a59){if(_0x5f8a59&&_0x5f8a59[_0xc1e2('0x50')]===0x0){return db[_0xc1e2('0x2a')][_0xc1e2('0x4a')]({'name':_0x5a68de[_0xc1e2('0x2d')],'resourceId':_0x5a68de['id'],'type':_0x5f8a59[_0xc1e2('0x2d')],'sectionId':_0x5f8a59['id']},{})[_0xc1e2('0x27')](function(){return _0x3c53c9;});}else{return _0x3c53c9;}})['catch'](function(_0x19a992){logger[_0xc1e2('0x2c')](_0xc1e2('0x57'),_0x19a992);throw _0x19a992;});}return _0x3c53c9;});}})['then'](respondWithResult(_0x377b4d,0xc9))[_0xc1e2('0x46')](handleError(_0x377b4d,null));};exports['update']=function(_0x2792ff,_0x195680){if(_0x2792ff[_0xc1e2('0x4b')]['id']){delete _0x2792ff[_0xc1e2('0x4b')]['id'];}return db[_0xc1e2('0x30')][_0xc1e2('0x49')]({'where':{'id':_0x2792ff['params']['id']}})[_0xc1e2('0x27')](handleEntityNotFound(_0x195680,null))['then'](saveUpdates(_0x2792ff[_0xc1e2('0x4b')],null))[_0xc1e2('0x27')](respondWithResult(_0x195680,null))['catch'](handleError(_0x195680,null));};exports[_0xc1e2('0x2b')]=function(_0x794b76,_0x1800f9){return db['JscriptyProject'][_0xc1e2('0x49')]({'where':{'id':_0x794b76[_0xc1e2('0x58')]['id']}})[_0xc1e2('0x27')](handleEntityNotFound(_0x1800f9,null))[_0xc1e2('0x27')](removeEntity(_0x1800f9,null))[_0xc1e2('0x46')](handleError(_0x1800f9,null));};exports[_0xc1e2('0x59')]=function(_0x2538da,_0x45c152,_0x25dc61){var _0x2e0c52={'raw':!![],'where':{}};var _0x4d978f={};var _0x51a603={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xc1e2('0x5a')]({'where':{'id':_0x2538da[_0xc1e2('0x58')]['id']}})['then'](handleEntityNotFound(_0x45c152,null))[_0xc1e2('0x27')](function(_0x5c4996){if(_0x5c4996){_0x4d978f[_0xc1e2('0x33')]=_[_0xc1e2('0x34')](db['JscriptySessionReport']['rawAttributes']);_0x4d978f[_0xc1e2('0x37')]=_[_0xc1e2('0x34')](_0x2538da[_0xc1e2('0x37')]);_0x4d978f[_0xc1e2('0x35')]=_[_0xc1e2('0x36')](_0x4d978f[_0xc1e2('0x33')],_0x4d978f[_0xc1e2('0x37')]);_0x2e0c52[_0xc1e2('0x39')]=_['intersection'](_0x4d978f[_0xc1e2('0x33')],qs[_0xc1e2('0x38')](_0x2538da[_0xc1e2('0x37')][_0xc1e2('0x38')]));_0x2e0c52[_0xc1e2('0x39')]=_0x2e0c52['attributes']['length']?_0x2e0c52['attributes']:_0x4d978f[_0xc1e2('0x33')];if(!_0x2538da[_0xc1e2('0x37')][_0xc1e2('0x5b')](_0xc1e2('0x3b'))){_0x2e0c52[_0xc1e2('0x20')]=qs['limit'](_0x2538da[_0xc1e2('0x37')][_0xc1e2('0x20')]);_0x2e0c52[_0xc1e2('0x1f')]=qs['offset'](_0x2538da[_0xc1e2('0x37')]['offset']);}_0x2e0c52[_0xc1e2('0x3c')]=qs['sort'](_0x2538da[_0xc1e2('0x37')][_0xc1e2('0x3d')]);_0x2e0c52[_0xc1e2('0x3e')]=qs[_0xc1e2('0x35')](_['pick'](_0x2538da[_0xc1e2('0x37')],_0x4d978f[_0xc1e2('0x35')]));_0x2e0c52[_0xc1e2('0x3e')][_0xc1e2('0x5c')]=_0x5c4996['id'];if(_0x2538da[_0xc1e2('0x37')]['filter']){_0x2e0c52[_0xc1e2('0x3e')]=_[_0xc1e2('0x41')](_0x2e0c52[_0xc1e2('0x3e')],{'$or':_['map'](_0x2e0c52[_0xc1e2('0x39')],function(_0x218150){var _0x5ac124={};_0x5ac124[_0x218150]={'$like':'%'+_0x2538da[_0xc1e2('0x37')]['filter']+'%'};return _0x5ac124;})});}_0x2e0c52=_[_0xc1e2('0x41')]({},_0x2e0c52,_0x2538da['options']);return db[_0xc1e2('0x5d')]['count']({'where':_0x2e0c52['where']})[_0xc1e2('0x27')](function(_0x5723a1){_0x51a603['count']=_0x5723a1;if(_0x2538da[_0xc1e2('0x37')][_0xc1e2('0x48')]){_0x2e0c52[_0xc1e2('0x52')]=[{'all':!![]}];}return db[_0xc1e2('0x5d')][_0xc1e2('0x44')](_0x2e0c52);})[_0xc1e2('0x27')](function(_0x3c9eeb){_0x51a603[_0xc1e2('0x45')]=_0x3c9eeb;return _0x51a603;});}})[_0xc1e2('0x27')](respondWithFilteredResult(_0x45c152,_0x2e0c52))['catch'](handleError(_0x45c152,null));};exports[_0xc1e2('0x5e')]=function(_0x1843e2,_0x36ac09,_0xd87dc4){var _0x3ffde4={'raw':!![],'where':{}};var _0x360e0a={};var _0x4f2cc8={'count':0x0,'rows':[]};return db[_0xc1e2('0x30')]['findOne']({'where':{'id':_0x1843e2[_0xc1e2('0x58')]['id']}})[_0xc1e2('0x27')](handleEntityNotFound(_0x36ac09,null))[_0xc1e2('0x27')](function(_0x18b9dd){if(_0x18b9dd){_0x360e0a[_0xc1e2('0x33')]=_[_0xc1e2('0x34')](db['JscriptyAnswerReport']['rawAttributes']);_0x360e0a[_0xc1e2('0x37')]=_[_0xc1e2('0x34')](_0x1843e2[_0xc1e2('0x37')]);_0x360e0a[_0xc1e2('0x35')]=_['intersection'](_0x360e0a[_0xc1e2('0x33')],_0x360e0a[_0xc1e2('0x37')]);_0x3ffde4['attributes']=_[_0xc1e2('0x36')](_0x360e0a[_0xc1e2('0x33')],qs[_0xc1e2('0x38')](_0x1843e2[_0xc1e2('0x37')]['fields']));_0x3ffde4['attributes']=_0x3ffde4[_0xc1e2('0x39')][_0xc1e2('0x3a')]?_0x3ffde4[_0xc1e2('0x39')]:_0x360e0a[_0xc1e2('0x33')];if(!_0x1843e2[_0xc1e2('0x37')][_0xc1e2('0x5b')](_0xc1e2('0x3b'))){_0x3ffde4[_0xc1e2('0x20')]=qs[_0xc1e2('0x20')](_0x1843e2[_0xc1e2('0x37')]['limit']);_0x3ffde4['offset']=qs['offset'](_0x1843e2['query'][_0xc1e2('0x1f')]);}_0x3ffde4[_0xc1e2('0x3c')]=qs[_0xc1e2('0x3d')](_0x1843e2['query']['sort']);_0x3ffde4[_0xc1e2('0x3e')]=qs[_0xc1e2('0x35')](_['pick'](_0x1843e2[_0xc1e2('0x37')],_0x360e0a['filters']));_0x3ffde4['where'][_0xc1e2('0x5c')]=_0x18b9dd['id'];if(_0x1843e2[_0xc1e2('0x37')][_0xc1e2('0x40')]){_0x3ffde4[_0xc1e2('0x3e')]=_['merge'](_0x3ffde4[_0xc1e2('0x3e')],{'$or':_[_0xc1e2('0x2f')](_0x3ffde4[_0xc1e2('0x39')],function(_0x38eef9){var _0xeaa155={};_0xeaa155[_0x38eef9]={'$like':'%'+_0x1843e2['query'][_0xc1e2('0x40')]+'%'};return _0xeaa155;})});}_0x3ffde4=_[_0xc1e2('0x41')]({},_0x3ffde4,_0x1843e2[_0xc1e2('0x43')]);return db['JscriptyAnswerReport'][_0xc1e2('0x1e')]({'where':_0x3ffde4[_0xc1e2('0x3e')]})['then'](function(_0x45ec55){_0x4f2cc8[_0xc1e2('0x1e')]=_0x45ec55;if(_0x1843e2[_0xc1e2('0x37')][_0xc1e2('0x48')]){_0x3ffde4[_0xc1e2('0x52')]=[{'all':!![]}];}return db[_0xc1e2('0x5f')][_0xc1e2('0x44')](_0x3ffde4);})[_0xc1e2('0x27')](function(_0x53971c){_0x4f2cc8[_0xc1e2('0x45')]=_0x53971c;return _0x4f2cc8;});}})[_0xc1e2('0x27')](respondWithFilteredResult(_0x36ac09,_0x3ffde4))[_0xc1e2('0x46')](handleError(_0x36ac09,null));};function char(_0xabdef3){return _0xc1e2('0x60')===typeof _0xabdef3?String['fromCharCode']['apply'](null,arguments):_0xabdef3;}function needsEncapsulation(_0x42ba70){return!!_0x42ba70&&(_0x42ba70[_0xc1e2('0x61')]()[_0xc1e2('0x62')](char(0xd))>=0x0||_0x42ba70[_0xc1e2('0x61')]()['indexOf'](char(0xa))>=0x0||_0x42ba70['toString']()[_0xc1e2('0x62')](char(0x2c))>=0x0||_0x42ba70[_0xc1e2('0x61')]()[_0xc1e2('0x62')](char(0x22))>=0x0);}function encapsulate(_0xffdee3){var _0x259248=char(0x22),_0x588731='\x5c'+char(0x22),_0x3e0907=_0xffdee3[_0xc1e2('0x61')]()[_0xc1e2('0x63')](new RegExp(_0x259248,'g'),_0x588731);return _0x259248+_0x3e0907+_0x259248;}exports[_0xc1e2('0x64')]=function(_0x3dad79,_0x83a128,_0x47a248){var _0x380e5c,_0xf5fe6a;var _0x3b47e1={'where':{'ProjectId':_0x3dad79[_0xc1e2('0x58')]['id']}};if(_0x3dad79[_0xc1e2('0x37')]['startTime']){_0x3b47e1['where'][_0xc1e2('0x65')]=JSON[_0xc1e2('0x66')](_0x3dad79[_0xc1e2('0x37')]['startTime']);}return db[_0xc1e2('0x5d')][_0xc1e2('0x44')](_0x3b47e1)['then'](handleEntityNotFound(_0x83a128,null))['then'](function(_0x38ef76){if(_0x38ef76){_0x380e5c=_0x38ef76;return db[_0xc1e2('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0xc1e2('0x2f')](_0x380e5c,'id')},'ProjectId':_0x3dad79[_0xc1e2('0x58')]['id']},'order':_0xc1e2('0x68')});}})[_0xc1e2('0x27')](handleEntityNotFound(_0x83a128,null))['then'](function(_0x2ce6ff){if(_0x2ce6ff){_0xf5fe6a=_0x2ce6ff;var _0x20ad9b={};for(var _0x5d68cf=0x0,_0x2123fe=_0xf5fe6a[_0xc1e2('0x3a')];_0x5d68cf<_0x2123fe;_0x5d68cf++){if(!_0x20ad9b[_0xc1e2('0x5b')](_0xf5fe6a[_0x5d68cf][_0xc1e2('0x69')])){_0x20ad9b[_0xf5fe6a[_0x5d68cf]['questionId']]=needsEncapsulation(_0xf5fe6a[_0x5d68cf]['question'])?encapsulate(_0xf5fe6a[_0x5d68cf][_0xc1e2('0x6a')]):_0xf5fe6a[_0x5d68cf][_0xc1e2('0x6a')];}}var _0x5eadf7=[],_0x40db7b={};for(var _0x39d283=0x0,_0x2e8d82=_0x380e5c['length'];_0x39d283<_0x2e8d82;_0x39d283++){_0x40db7b={'ProjectId':_0x3dad79[_0xc1e2('0x58')]['id'],'SessionId':_0x380e5c[_0x39d283]['id'],'StartTime':moment(_0x380e5c[_0x39d283][_0xc1e2('0x65')])[_0xc1e2('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4e5df1=0x0,_0x4fc24f=_0xf5fe6a[_0xc1e2('0x3a')];_0x4e5df1<_0x4fc24f;_0x4e5df1++){if(_0xf5fe6a[_0x4e5df1][_0xc1e2('0x6c')]==_0x380e5c[_0x39d283]['id']&&_0x20ad9b[_0xc1e2('0x5b')](_0xf5fe6a[_0x4e5df1]['questionId'])){_0x40db7b[_0x20ad9b[_0xf5fe6a[_0x4e5df1][_0xc1e2('0x69')]]]=_0xf5fe6a[_0x4e5df1][_0xc1e2('0x6d')];}}for(var _0xb49196 in _0x20ad9b){if(!_0x40db7b[_0xc1e2('0x5b')](_0x20ad9b[_0xb49196])){_0x40db7b[_0x20ad9b[_0xb49196]]=null;}}_0x5eadf7[_0xc1e2('0x6e')](_0x40db7b);}return _0x5eadf7;}})[_0xc1e2('0x27')](function(_0x12619d){if(!_['isEmpty'](_0x12619d)){var _0x5b6dc3=toCsv(_0x12619d);var _0x92eff=Date[_0xc1e2('0x6f')]();fs['writeFileSync'](util[_0xc1e2('0x6b')](_0xc1e2('0x70'),_0x3dad79[_0xc1e2('0x58')]['id'],_0x92eff),_0x5b6dc3);_0x83a128['setHeader'](_0xc1e2('0x71'),_0xc1e2('0x72')+util[_0xc1e2('0x6b')]('Jscripty_Project_%d_Summary_%s.csv',_0x3dad79[_0xc1e2('0x58')]['id'],_0x92eff));_0x83a128['setHeader'](_0xc1e2('0x73'),'text/csv');return _0x83a128[_0xc1e2('0x74')](util[_0xc1e2('0x6b')](_0xc1e2('0x70'),_0x3dad79[_0xc1e2('0x58')]['id'],_0x92eff));}else{return _0x83a128[_0xc1e2('0x1b')](0xcc);}})['catch'](handleError(_0x83a128,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 8bc490b..ad49b34 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 _0xdaf9=['util','../../config/logger','moment','request-promise','path','rimraf','./jscriptyProject.attributes','exports','jscripty_projects','lodash'];(function(_0xe733bd,_0x47e80f){var _0x396697=function(_0x22b242){while(--_0x22b242){_0xe733bd['push'](_0xe733bd['shift']());}};_0x396697(++_0x47e80f);}(_0xdaf9,0xe5));var _0x9daf=function(_0x5da93c,_0xc83e72){_0x5da93c=_0x5da93c-0x0;var _0x50f0f6=_0xdaf9[_0x5da93c];return _0x50f0f6;};'use strict';var _=require(_0x9daf('0x0'));var util=require(_0x9daf('0x1'));var logger=require(_0x9daf('0x2'))('api');var moment=require(_0x9daf('0x3'));var BPromise=require('bluebird');var rp=require(_0x9daf('0x4'));var fs=require('fs');var path=require(_0x9daf('0x5'));var rimraf=require(_0x9daf('0x6'));var config=require('../../config/environment');var attributes=require(_0x9daf('0x7'));module[_0x9daf('0x8')]=function(_0x11e944,_0x1b6adf){return _0x11e944['define']('JscriptyProject',attributes,{'tableName':_0x9daf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9375=['request-promise','path','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','../../config/logger','api','moment','bluebird'];(function(_0x2a6992,_0x4ab9ac){var _0x4a59c5=function(_0x718b52){while(--_0x718b52){_0x2a6992['push'](_0x2a6992['shift']());}};_0x4a59c5(++_0x4ab9ac);}(_0x9375,0xf8));var _0x5937=function(_0x296dae,_0x3182d7){_0x296dae=_0x296dae-0x0;var _0x2ebded=_0x9375[_0x296dae];return _0x2ebded;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5937('0x0'))(_0x5937('0x1'));var moment=require(_0x5937('0x2'));var BPromise=require(_0x5937('0x3'));var rp=require(_0x5937('0x4'));var fs=require('fs');var path=require(_0x5937('0x5'));var rimraf=require('rimraf');var config=require(_0x5937('0x6'));var attributes=require(_0x5937('0x7'));module[_0x5937('0x8')]=function(_0x175ed7,_0x5ec07c){return _0x175ed7[_0x5937('0x9')](_0x5937('0xa'),attributes,{'tableName':_0x5937('0xb'),'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 fac81a1..5fead25 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 _0x46b9=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','error','message','result'];(function(_0x5b2ee5,_0x2fd352){var _0x3e3eb2=function(_0x3b0325){while(--_0x3b0325){_0x5b2ee5['push'](_0x5b2ee5['shift']());}};_0x3e3eb2(++_0x2fd352);}(_0x46b9,0x144));var _0x946b=function(_0x4ffbf,_0x5255ba){_0x4ffbf=_0x4ffbf-0x0;var _0x4b7bb6=_0x46b9[_0x4ffbf];return _0x4b7bb6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x946b('0x0'));var BPromise=require(_0x946b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x946b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x946b('0x3'));var logger=require(_0x946b('0x4'))(_0x946b('0x5'));var config=require('../../config/environment');var jayson=require(_0x946b('0x6'));var client=jayson[_0x946b('0x7')][_0x946b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33f1e6,_0x14712d,_0x30ea6e){return new BPromise(function(_0x370a12,_0x5dd6c2){return client[_0x946b('0x9')](_0x33f1e6,_0x30ea6e)[_0x946b('0xa')](function(_0x505636){logger[_0x946b('0xb')](_0x946b('0xc'),_0x14712d,_0x946b('0xd'));logger[_0x946b('0xe')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x14712d,_0x946b('0xd'),JSON['stringify'](_0x505636));if(_0x505636[_0x946b('0xf')]){if(_0x505636['error']['code']===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x14712d,_0x505636[_0x946b('0xf')][_0x946b('0x10')]);return _0x5dd6c2(_0x505636[_0x946b('0xf')][_0x946b('0x10')]);}logger[_0x946b('0xf')](_0x946b('0xc'),_0x14712d,_0x505636[_0x946b('0xf')][_0x946b('0x10')]);return _0x370a12(_0x505636[_0x946b('0xf')][_0x946b('0x10')]);}else{logger['info'](_0x946b('0xc'),_0x14712d,_0x946b('0xd'));_0x370a12(_0x505636[_0x946b('0x11')][_0x946b('0x10')]);}})['catch'](function(_0x39e2b9){logger[_0x946b('0xf')](_0x946b('0xc'),_0x14712d,_0x39e2b9);_0x5dd6c2(_0x39e2b9);});});} \ No newline at end of file +var _0x2cfd=['then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request'];(function(_0x502ba7,_0x219ad4){var _0x35bc4c=function(_0x1abbe9){while(--_0x1abbe9){_0x502ba7['push'](_0x502ba7['shift']());}};_0x35bc4c(++_0x219ad4);}(_0x2cfd,0xab));var _0xd2cf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2cfd[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd2cf('0x0'));var util=require(_0xd2cf('0x1'));var moment=require('moment');var BPromise=require(_0xd2cf('0x2'));var rs=require(_0xd2cf('0x3'));var fs=require('fs');var Redis=require(_0xd2cf('0x4'));var db=require(_0xd2cf('0x5'))['db'];var utils=require(_0xd2cf('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd2cf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b374b,_0x4c67e4,_0x2e372a){return new BPromise(function(_0x5aac61,_0x7e2547){return client[_0xd2cf('0x8')](_0x3b374b,_0x2e372a)[_0xd2cf('0x9')](function(_0x357fdd){logger[_0xd2cf('0xa')](_0xd2cf('0xb'),_0x4c67e4,_0xd2cf('0xc'));logger[_0xd2cf('0xd')](_0xd2cf('0xe'),_0x4c67e4,_0xd2cf('0xc'),JSON['stringify'](_0x357fdd));if(_0x357fdd['error']){if(_0x357fdd[_0xd2cf('0xf')][_0xd2cf('0x10')]===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x4c67e4,_0x357fdd[_0xd2cf('0xf')][_0xd2cf('0x11')]);return _0x7e2547(_0x357fdd['error'][_0xd2cf('0x11')]);}logger['error'](_0xd2cf('0xb'),_0x4c67e4,_0x357fdd[_0xd2cf('0xf')][_0xd2cf('0x11')]);return _0x5aac61(_0x357fdd[_0xd2cf('0xf')][_0xd2cf('0x11')]);}else{logger[_0xd2cf('0xa')](_0xd2cf('0xb'),_0x4c67e4,_0xd2cf('0xc'));_0x5aac61(_0x357fdd[_0xd2cf('0x12')][_0xd2cf('0x11')]);}})[_0xd2cf('0x13')](function(_0x24d3dd){logger[_0xd2cf('0xf')](_0xd2cf('0xb'),_0x4c67e4,_0x24d3dd);_0x7e2547(_0x24d3dd);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 5de8b62..9d8cc9c 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 _0x0c07=['/:id','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','describe'];(function(_0x214023,_0x65e22b){var _0x10cf15=function(_0x3a05df){while(--_0x3a05df){_0x214023['push'](_0x214023['shift']());}};_0x10cf15(++_0x65e22b);}(_0x0c07,0x8b));var _0x70c0=function(_0x434467,_0x2c6a75){_0x434467=_0x434467-0x0;var _0x5248ba=_0x0c07[_0x434467];return _0x5248ba;};'use strict';var multer=require(_0x70c0('0x0'));var util=require(_0x70c0('0x1'));var path=require(_0x70c0('0x2'));var timeout=require(_0x70c0('0x3'));var express=require(_0x70c0('0x4'));var router=express[_0x70c0('0x5')]();var auth=require(_0x70c0('0x6'));var interaction=require(_0x70c0('0x7'));var config=require(_0x70c0('0x8'));var controller=require(_0x70c0('0x9'));router[_0x70c0('0xa')]('/',auth[_0x70c0('0xb')](),controller['index']);router[_0x70c0('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x70c0('0xc')]);router[_0x70c0('0xa')](_0x70c0('0xd'),auth[_0x70c0('0xb')](),controller['show']);router[_0x70c0('0xe')]('/',auth['isAuthenticated'](),controller[_0x70c0('0xf')]);router['put'](_0x70c0('0xd'),auth['isAuthenticated'](),controller[_0x70c0('0x10')]);router[_0x70c0('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x70c0('0x12')]=router; \ No newline at end of file +var _0x3940=['put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x3940,0xa6));var _0x0394=function(_0x2b0ae4,_0x1369dc){_0x2b0ae4=_0x2b0ae4-0x0;var _0x1ebd49=_0x3940[_0x2b0ae4];return _0x1ebd49;};'use strict';var multer=require(_0x0394('0x0'));var util=require(_0x0394('0x1'));var path=require('path');var timeout=require(_0x0394('0x2'));var express=require('express');var router=express[_0x0394('0x3')]();var auth=require(_0x0394('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0394('0x5'));var controller=require('./jscriptyQuestionReport.controller');router[_0x0394('0x6')]('/',auth[_0x0394('0x7')](),controller['index']);router[_0x0394('0x6')](_0x0394('0x8'),auth['isAuthenticated'](),controller[_0x0394('0x9')]);router['get'](_0x0394('0xa'),auth[_0x0394('0x7')](),controller[_0x0394('0xb')]);router[_0x0394('0xc')]('/',auth[_0x0394('0x7')](),controller[_0x0394('0xd')]);router[_0x0394('0xe')](_0x0394('0xa'),auth[_0x0394('0x7')](),controller[_0x0394('0xf')]);router['delete'](_0x0394('0xa'),auth[_0x0394('0x7')](),controller[_0x0394('0x10')]);module[_0x0394('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 30935a4..98c53db 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 _0x1ba2=['sequelize','TEXT','long','STRING'];(function(_0x53dee9,_0x1dc404){var _0x4c5da0=function(_0x540a63){while(--_0x540a63){_0x53dee9['push'](_0x53dee9['shift']());}};_0x4c5da0(++_0x1dc404);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'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 +var _0x1339=['STRING','TEXT','long'];(function(_0x52d3b7,_0x8db840){var _0x29e285=function(_0x4c63a6){while(--_0x4c63a6){_0x52d3b7['push'](_0x52d3b7['shift']());}};_0x29e285(++_0x8db840);}(_0x1339,0x1ed));var _0x9133=function(_0x67d764,_0x12d676){_0x67d764=_0x67d764-0x0;var _0x30036e=_0x1339[_0x67d764];return _0x30036e;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0x9133('0x0')]},'answer':{'type':Sequelize[_0x9133('0x0')](_0x9133('0x1'))},'membername':{'type':Sequelize[_0x9133('0x2')]},'projectname':{'type':Sequelize[_0x9133('0x2')]},'queue':{'type':Sequelize[_0x9133('0x2')]},'uniqueid':{'type':Sequelize[_0x9133('0x2')]},'calleridname':{'type':Sequelize[_0x9133('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x9133('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 2609f28..25238f3 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 _0xf150=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','JscriptyQuestionReport'];(function(_0x34c0bf,_0x3b8460){var _0x315559=function(_0x42f409){while(--_0x42f409){_0x34c0bf['push'](_0x34c0bf['shift']());}};_0x315559(++_0x3b8460);}(_0xf150,0xb7));var _0x0f15=function(_0x5a818a,_0x191edd){_0x5a818a=_0x5a818a-0x0;var _0x14353e=_0xf150[_0x5a818a];return _0x14353e;};'use strict';var pdf=require(_0x0f15('0x0'));var emlformat=require(_0x0f15('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0f15('0x2'));var jsonpatch=require(_0x0f15('0x3'));var rp=require(_0x0f15('0x4'));var moment=require(_0x0f15('0x5'));var BPromise=require(_0x0f15('0x6'));var Mustache=require('mustache');var util=require(_0x0f15('0x7'));var path=require(_0x0f15('0x8'));var sox=require(_0x0f15('0x9'));var csv=require('to-csv');var ejs=require(_0x0f15('0xa'));var fs=require('fs');var _=require(_0x0f15('0xb'));var squel=require(_0x0f15('0xc'));var crypto=require(_0x0f15('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0f15('0xe'));var querystring=require('querystring');var Papa=require(_0x0f15('0xf'));var Redis=require('ioredis');var authService=require(_0x0f15('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0f15('0x11'));var hardwareService=require(_0x0f15('0x12'));var logger=require(_0x0f15('0x13'))(_0x0f15('0x14'));var utils=require(_0x0f15('0x15'));var config=require(_0x0f15('0x16'));var licenseUtil=require(_0x0f15('0x17'));var db=require(_0x0f15('0x18'))['db'];function respondWithStatusCode(_0x284041,_0x115e1b){_0x115e1b=_0x115e1b||0xcc;return function(_0x169365){if(_0x169365){return _0x284041[_0x0f15('0x19')](_0x115e1b);}return _0x284041[_0x0f15('0x1a')](_0x115e1b)[_0x0f15('0x1b')]();};}function respondWithResult(_0x1eead7,_0x3c287c){_0x3c287c=_0x3c287c||0xc8;return function(_0x33f676){if(_0x33f676){return _0x1eead7['status'](_0x3c287c)[_0x0f15('0x1c')](_0x33f676);}};}function respondWithFilteredResult(_0x16aa9e,_0x4c0171){return function(_0x398025){if(_0x398025){var _0x21a147=_0x398025[_0x0f15('0x1d')],_0x330367=_0x4c0171[_0x0f15('0x1e')],_0x20f20d=_0x4c0171['offset']+_0x4c0171[_0x0f15('0x1f')],_0x57bf86;if(_0x20f20d>=_0x21a147){_0x20f20d=_0x21a147;_0x57bf86=0xc8;}else{_0x57bf86=0xce;}_0x16aa9e[_0x0f15('0x1a')](_0x57bf86);return _0x16aa9e[_0x0f15('0x20')](_0x0f15('0x21'),_0x330367+'-'+_0x20f20d+'/'+_0x21a147)[_0x0f15('0x1c')](_0x398025);}return null;};}function patchUpdates(_0xcf6a74){return function(_0x3619ae){try{jsonpatch[_0x0f15('0x22')](_0x3619ae,_0xcf6a74,!![]);}catch(_0x4d2302){return BPromise[_0x0f15('0x23')](_0x4d2302);}return _0x3619ae[_0x0f15('0x24')]();};}function saveUpdates(_0x7a00a7,_0x3842f3){return function(_0x142ac6){if(_0x142ac6){return _0x142ac6[_0x0f15('0x25')](_0x7a00a7)['then'](function(_0x16ed72){return _0x16ed72;});}return null;};}function removeEntity(_0x1cd7a9,_0xe34d9){return function(_0x10c5d2){if(_0x10c5d2){return _0x10c5d2['destroy']()[_0x0f15('0x26')](function(){_0x1cd7a9[_0x0f15('0x1a')](0xcc)[_0x0f15('0x1b')]();});}};}function handleEntityNotFound(_0x469bf9,_0x408bc1){return function(_0x2df028){if(!_0x2df028){_0x469bf9['sendStatus'](0x194);}return _0x2df028;};}function handleError(_0x1c293d,_0x488757){_0x488757=_0x488757||0x1f4;return function(_0x1510cb){logger[_0x0f15('0x27')](_0x1510cb[_0x0f15('0x28')]);if(_0x1510cb[_0x0f15('0x29')]){delete _0x1510cb['name'];}_0x1c293d[_0x0f15('0x1a')](_0x488757)['send'](_0x1510cb);};}exports[_0x0f15('0x2a')]=function(_0x3f3242,_0x471142){var _0xa72a57={},_0x21f4d9={},_0x1a2f04={'count':0x0,'rows':[]};var _0x486300=_[_0x0f15('0x2b')](db[_0x0f15('0x2c')][_0x0f15('0x2d')],function(_0xe959b1){return{'name':_0xe959b1[_0x0f15('0x2e')],'type':_0xe959b1[_0x0f15('0x2f')][_0x0f15('0x30')]};});_0x21f4d9[_0x0f15('0x31')]=_[_0x0f15('0x2b')](_0x486300,'name');_0x21f4d9[_0x0f15('0x32')]=_[_0x0f15('0x33')](_0x3f3242[_0x0f15('0x32')]);_0x21f4d9[_0x0f15('0x34')]=_[_0x0f15('0x35')](_0x21f4d9[_0x0f15('0x31')],_0x21f4d9[_0x0f15('0x32')]);_0xa72a57['attributes']=_[_0x0f15('0x35')](_0x21f4d9['model'],qs[_0x0f15('0x36')](_0x3f3242[_0x0f15('0x32')][_0x0f15('0x36')]));_0xa72a57[_0x0f15('0x37')]=_0xa72a57[_0x0f15('0x37')][_0x0f15('0x38')]?_0xa72a57[_0x0f15('0x37')]:_0x21f4d9[_0x0f15('0x31')];if(!_0x3f3242[_0x0f15('0x32')][_0x0f15('0x39')](_0x0f15('0x3a'))){_0xa72a57[_0x0f15('0x1f')]=qs[_0x0f15('0x1f')](_0x3f3242[_0x0f15('0x32')][_0x0f15('0x1f')]);_0xa72a57[_0x0f15('0x1e')]=qs[_0x0f15('0x1e')](_0x3f3242[_0x0f15('0x32')][_0x0f15('0x1e')]);}_0xa72a57['order']=qs['sort'](_0x3f3242['query'][_0x0f15('0x3b')]);_0xa72a57[_0x0f15('0x3c')]=qs[_0x0f15('0x34')](_[_0x0f15('0x3d')](_0x3f3242['query'],_0x21f4d9[_0x0f15('0x34')]),_0x486300);if(_0x3f3242['query']['filter']){_0xa72a57[_0x0f15('0x3c')]=_[_0x0f15('0x3e')](_0xa72a57[_0x0f15('0x3c')],{'$or':_[_0x0f15('0x2b')](_0x486300,function(_0x5a240e){if(_0x5a240e['type']!=='VIRTUAL'){var _0x1bfa54={};_0x1bfa54[_0x5a240e['name']]={'$like':'%'+_0x3f3242[_0x0f15('0x32')]['filter']+'%'};return _0x1bfa54;}})});}_0xa72a57=_[_0x0f15('0x3e')]({},_0xa72a57,_0x3f3242['options']);var _0xbf7af1={'where':_0xa72a57[_0x0f15('0x3c')]};return db[_0x0f15('0x2c')]['count'](_0xbf7af1)[_0x0f15('0x26')](function(_0x24197b){_0x1a2f04[_0x0f15('0x1d')]=_0x24197b;if(_0x3f3242[_0x0f15('0x32')][_0x0f15('0x3f')]){_0xa72a57[_0x0f15('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x0f15('0x41')](_0xa72a57);})[_0x0f15('0x26')](function(_0x4f04bc){_0x1a2f04[_0x0f15('0x42')]=_0x4f04bc;return _0x1a2f04;})[_0x0f15('0x26')](respondWithFilteredResult(_0x471142,_0xa72a57))[_0x0f15('0x43')](handleError(_0x471142,null));};exports[_0x0f15('0x44')]=function(_0x40443b,_0x3f3056){var _0xc41bf7={'raw':!![],'where':{'id':_0x40443b['params']['id']}},_0xff1d95={};_0xff1d95[_0x0f15('0x31')]=_[_0x0f15('0x33')](db[_0x0f15('0x2c')]['rawAttributes']);_0xff1d95[_0x0f15('0x32')]=_[_0x0f15('0x33')](_0x40443b[_0x0f15('0x32')]);_0xff1d95[_0x0f15('0x34')]=_['intersection'](_0xff1d95[_0x0f15('0x31')],_0xff1d95['query']);_0xc41bf7[_0x0f15('0x37')]=_[_0x0f15('0x35')](_0xff1d95['model'],qs[_0x0f15('0x36')](_0x40443b[_0x0f15('0x32')]['fields']));_0xc41bf7[_0x0f15('0x37')]=_0xc41bf7[_0x0f15('0x37')][_0x0f15('0x38')]?_0xc41bf7[_0x0f15('0x37')]:_0xff1d95[_0x0f15('0x31')];if(_0x40443b[_0x0f15('0x32')][_0x0f15('0x3f')]){_0xc41bf7[_0x0f15('0x40')]=[{'all':!![]}];}_0xc41bf7=_[_0x0f15('0x3e')]({},_0xc41bf7,_0x40443b[_0x0f15('0x45')]);return db[_0x0f15('0x2c')][_0x0f15('0x46')](_0xc41bf7)[_0x0f15('0x26')](handleEntityNotFound(_0x3f3056,null))[_0x0f15('0x26')](respondWithResult(_0x3f3056,null))[_0x0f15('0x43')](handleError(_0x3f3056,null));};exports[_0x0f15('0x47')]=function(_0x1b6d35,_0x7f3ccb){return db[_0x0f15('0x2c')]['create'](_0x1b6d35['body'],{})[_0x0f15('0x26')](respondWithResult(_0x7f3ccb,0xc9))[_0x0f15('0x43')](handleError(_0x7f3ccb,null));};exports[_0x0f15('0x25')]=function(_0x42eee5,_0x21f816){if(_0x42eee5[_0x0f15('0x48')]['id']){delete _0x42eee5[_0x0f15('0x48')]['id'];}return db[_0x0f15('0x2c')][_0x0f15('0x46')]({'where':{'id':_0x42eee5[_0x0f15('0x49')]['id']}})[_0x0f15('0x26')](handleEntityNotFound(_0x21f816,null))[_0x0f15('0x26')](saveUpdates(_0x42eee5[_0x0f15('0x48')],null))['then'](respondWithResult(_0x21f816,null))[_0x0f15('0x43')](handleError(_0x21f816,null));};exports[_0x0f15('0x4a')]=function(_0x54d40e,_0x5389b8){return db[_0x0f15('0x2c')][_0x0f15('0x46')]({'where':{'id':_0x54d40e[_0x0f15('0x49')]['id']}})[_0x0f15('0x26')](handleEntityNotFound(_0x5389b8,null))['then'](removeEntity(_0x5389b8,null))[_0x0f15('0x43')](handleError(_0x5389b8,null));};exports[_0x0f15('0x4b')]=function(_0x5a2b18,_0x495a93){return db[_0x0f15('0x2c')][_0x0f15('0x4b')]()[_0x0f15('0x26')](respondWithResult(_0x495a93,null))[_0x0f15('0x43')](handleError(_0x495a93,null));}; \ No newline at end of file +var _0xc263=['map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','JscriptyQuestionReport','includeAll','include','findAll','catch','show','params','create','body','find','describe','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','rawAttributes','fieldName','type','key'];(function(_0x2cae99,_0x2c4acb){var _0x2748b6=function(_0x277351){while(--_0x277351){_0x2cae99['push'](_0x2cae99['shift']());}};_0x2748b6(++_0x2c4acb);}(_0xc263,0x1d3));var _0x3c26=function(_0x1585e3,_0x17ea8a){_0x1585e3=_0x1585e3-0x0;var _0x2d5b0b=_0xc263[_0x1585e3];return _0x2d5b0b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3c26('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c26('0x1'));var rp=require(_0x3c26('0x2'));var moment=require('moment');var BPromise=require(_0x3c26('0x3'));var Mustache=require('mustache');var util=require(_0x3c26('0x4'));var path=require(_0x3c26('0x5'));var sox=require('sox');var csv=require(_0x3c26('0x6'));var ejs=require(_0x3c26('0x7'));var fs=require('fs');var _=require(_0x3c26('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3c26('0x9'));var deskjs=require(_0x3c26('0xa'));var toCsv=require(_0x3c26('0x6'));var querystring=require('querystring');var Papa=require(_0x3c26('0xb'));var Redis=require(_0x3c26('0xc'));var authService=require(_0x3c26('0xd'));var qs=require(_0x3c26('0xe'));var as=require(_0x3c26('0xf'));var hardwareService=require(_0x3c26('0x10'));var logger=require('../../config/logger')(_0x3c26('0x11'));var utils=require(_0x3c26('0x12'));var config=require(_0x3c26('0x13'));var licenseUtil=require(_0x3c26('0x14'));var db=require(_0x3c26('0x15'))['db'];function respondWithStatusCode(_0x572183,_0x438d68){_0x438d68=_0x438d68||0xcc;return function(_0x2a9c2f){if(_0x2a9c2f){return _0x572183[_0x3c26('0x16')](_0x438d68);}return _0x572183[_0x3c26('0x17')](_0x438d68)[_0x3c26('0x18')]();};}function respondWithResult(_0x4baf85,_0xd1642a){_0xd1642a=_0xd1642a||0xc8;return function(_0x504a5d){if(_0x504a5d){return _0x4baf85[_0x3c26('0x17')](_0xd1642a)[_0x3c26('0x19')](_0x504a5d);}};}function respondWithFilteredResult(_0x1cc9f4,_0x22cdf1){return function(_0x2c8fa4){if(_0x2c8fa4){var _0x1caa71=_0x2c8fa4[_0x3c26('0x1a')],_0x202c7a=_0x22cdf1[_0x3c26('0x1b')],_0x344368=_0x22cdf1[_0x3c26('0x1b')]+_0x22cdf1[_0x3c26('0x1c')],_0x2092d2;if(_0x344368>=_0x1caa71){_0x344368=_0x1caa71;_0x2092d2=0xc8;}else{_0x2092d2=0xce;}_0x1cc9f4[_0x3c26('0x17')](_0x2092d2);return _0x1cc9f4[_0x3c26('0x1d')](_0x3c26('0x1e'),_0x202c7a+'-'+_0x344368+'/'+_0x1caa71)['json'](_0x2c8fa4);}return null;};}function patchUpdates(_0x3238f6){return function(_0x541372){try{jsonpatch[_0x3c26('0x1f')](_0x541372,_0x3238f6,!![]);}catch(_0x5271de){return BPromise[_0x3c26('0x20')](_0x5271de);}return _0x541372[_0x3c26('0x21')]();};}function saveUpdates(_0x594370,_0x2ebce9){return function(_0x53e88b){if(_0x53e88b){return _0x53e88b[_0x3c26('0x22')](_0x594370)[_0x3c26('0x23')](function(_0x1f9794){return _0x1f9794;});}return null;};}function removeEntity(_0x3b113a,_0x2ef9ab){return function(_0x4ebaca){if(_0x4ebaca){return _0x4ebaca[_0x3c26('0x24')]()[_0x3c26('0x23')](function(){_0x3b113a[_0x3c26('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x200051,_0x37f838){return function(_0x16ef56){if(!_0x16ef56){_0x200051['sendStatus'](0x194);}return _0x16ef56;};}function handleError(_0x4d07bd,_0xb051ea){_0xb051ea=_0xb051ea||0x1f4;return function(_0x314c71){logger[_0x3c26('0x25')](_0x314c71['stack']);if(_0x314c71[_0x3c26('0x26')]){delete _0x314c71[_0x3c26('0x26')];}_0x4d07bd[_0x3c26('0x17')](_0xb051ea)[_0x3c26('0x27')](_0x314c71);};}exports['index']=function(_0x2df75d,_0x35f3af){var _0x5c5c86={},_0x1198f7={},_0x1ea5aa={'count':0x0,'rows':[]};var _0x2f43ae=_['map'](db['JscriptyQuestionReport'][_0x3c26('0x28')],function(_0x569d9b){return{'name':_0x569d9b[_0x3c26('0x29')],'type':_0x569d9b[_0x3c26('0x2a')][_0x3c26('0x2b')]};});_0x1198f7['model']=_[_0x3c26('0x2c')](_0x2f43ae,'name');_0x1198f7[_0x3c26('0x2d')]=_[_0x3c26('0x2e')](_0x2df75d['query']);_0x1198f7[_0x3c26('0x2f')]=_['intersection'](_0x1198f7[_0x3c26('0x30')],_0x1198f7[_0x3c26('0x2d')]);_0x5c5c86[_0x3c26('0x31')]=_[_0x3c26('0x32')](_0x1198f7['model'],qs[_0x3c26('0x33')](_0x2df75d[_0x3c26('0x2d')][_0x3c26('0x33')]));_0x5c5c86[_0x3c26('0x31')]=_0x5c5c86[_0x3c26('0x31')][_0x3c26('0x34')]?_0x5c5c86[_0x3c26('0x31')]:_0x1198f7['model'];if(!_0x2df75d[_0x3c26('0x2d')][_0x3c26('0x35')](_0x3c26('0x36'))){_0x5c5c86[_0x3c26('0x1c')]=qs[_0x3c26('0x1c')](_0x2df75d[_0x3c26('0x2d')][_0x3c26('0x1c')]);_0x5c5c86[_0x3c26('0x1b')]=qs['offset'](_0x2df75d[_0x3c26('0x2d')]['offset']);}_0x5c5c86[_0x3c26('0x37')]=qs['sort'](_0x2df75d[_0x3c26('0x2d')][_0x3c26('0x38')]);_0x5c5c86['where']=qs['filters'](_['pick'](_0x2df75d[_0x3c26('0x2d')],_0x1198f7['filters']),_0x2f43ae);if(_0x2df75d[_0x3c26('0x2d')]['filter']){_0x5c5c86[_0x3c26('0x39')]=_[_0x3c26('0x3a')](_0x5c5c86['where'],{'$or':_[_0x3c26('0x2c')](_0x2f43ae,function(_0x5a0e14){if(_0x5a0e14['type']!==_0x3c26('0x3b')){var _0xfc90c0={};_0xfc90c0[_0x5a0e14[_0x3c26('0x26')]]={'$like':'%'+_0x2df75d[_0x3c26('0x2d')][_0x3c26('0x3c')]+'%'};return _0xfc90c0;}})});}_0x5c5c86=_[_0x3c26('0x3a')]({},_0x5c5c86,_0x2df75d[_0x3c26('0x3d')]);var _0x2cc6d9={'where':_0x5c5c86['where']};return db[_0x3c26('0x3e')][_0x3c26('0x1a')](_0x2cc6d9)['then'](function(_0x1fae71){_0x1ea5aa[_0x3c26('0x1a')]=_0x1fae71;if(_0x2df75d['query'][_0x3c26('0x3f')]){_0x5c5c86[_0x3c26('0x40')]=[{'all':!![]}];}return db[_0x3c26('0x3e')][_0x3c26('0x41')](_0x5c5c86);})['then'](function(_0x10e4b6){_0x1ea5aa['rows']=_0x10e4b6;return _0x1ea5aa;})[_0x3c26('0x23')](respondWithFilteredResult(_0x35f3af,_0x5c5c86))[_0x3c26('0x42')](handleError(_0x35f3af,null));};exports[_0x3c26('0x43')]=function(_0xd2167e,_0x45bf47){var _0x547620={'raw':!![],'where':{'id':_0xd2167e[_0x3c26('0x44')]['id']}},_0x58ee74={};_0x58ee74[_0x3c26('0x30')]=_['keys'](db['JscriptyQuestionReport'][_0x3c26('0x28')]);_0x58ee74[_0x3c26('0x2d')]=_['keys'](_0xd2167e[_0x3c26('0x2d')]);_0x58ee74[_0x3c26('0x2f')]=_[_0x3c26('0x32')](_0x58ee74[_0x3c26('0x30')],_0x58ee74[_0x3c26('0x2d')]);_0x547620[_0x3c26('0x31')]=_[_0x3c26('0x32')](_0x58ee74[_0x3c26('0x30')],qs['fields'](_0xd2167e[_0x3c26('0x2d')][_0x3c26('0x33')]));_0x547620[_0x3c26('0x31')]=_0x547620[_0x3c26('0x31')][_0x3c26('0x34')]?_0x547620[_0x3c26('0x31')]:_0x58ee74[_0x3c26('0x30')];if(_0xd2167e[_0x3c26('0x2d')][_0x3c26('0x3f')]){_0x547620[_0x3c26('0x40')]=[{'all':!![]}];}_0x547620=_['merge']({},_0x547620,_0xd2167e[_0x3c26('0x3d')]);return db[_0x3c26('0x3e')]['find'](_0x547620)[_0x3c26('0x23')](handleEntityNotFound(_0x45bf47,null))[_0x3c26('0x23')](respondWithResult(_0x45bf47,null))['catch'](handleError(_0x45bf47,null));};exports['create']=function(_0x1b35a7,_0x4517fd){return db[_0x3c26('0x3e')][_0x3c26('0x45')](_0x1b35a7[_0x3c26('0x46')],{})[_0x3c26('0x23')](respondWithResult(_0x4517fd,0xc9))[_0x3c26('0x42')](handleError(_0x4517fd,null));};exports['update']=function(_0x4be889,_0x3462af){if(_0x4be889[_0x3c26('0x46')]['id']){delete _0x4be889[_0x3c26('0x46')]['id'];}return db[_0x3c26('0x3e')][_0x3c26('0x47')]({'where':{'id':_0x4be889[_0x3c26('0x44')]['id']}})[_0x3c26('0x23')](handleEntityNotFound(_0x3462af,null))['then'](saveUpdates(_0x4be889['body'],null))[_0x3c26('0x23')](respondWithResult(_0x3462af,null))[_0x3c26('0x42')](handleError(_0x3462af,null));};exports[_0x3c26('0x24')]=function(_0x53fa5d,_0x1a846b){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x53fa5d[_0x3c26('0x44')]['id']}})[_0x3c26('0x23')](handleEntityNotFound(_0x1a846b,null))[_0x3c26('0x23')](removeEntity(_0x1a846b,null))[_0x3c26('0x42')](handleError(_0x1a846b,null));};exports[_0x3c26('0x48')]=function(_0xe3f98d,_0x36fc8b){return db[_0x3c26('0x3e')][_0x3c26('0x48')]()['then'](respondWithResult(_0x36fc8b,null))[_0x3c26('0x42')](handleError(_0x36fc8b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index afefcb4..83ca916 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 _0x22f5=['rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','../../config/logger','api','moment','request-promise','path'];(function(_0x10d56a,_0x4746cd){var _0x17a405=function(_0x659108){while(--_0x659108){_0x10d56a['push'](_0x10d56a['shift']());}};_0x17a405(++_0x4746cd);}(_0x22f5,0xa0));var _0x522f=function(_0x182618,_0x53427e){_0x182618=_0x182618-0x0;var _0x73fc2f=_0x22f5[_0x182618];return _0x73fc2f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x522f('0x0'))(_0x522f('0x1'));var moment=require(_0x522f('0x2'));var BPromise=require('bluebird');var rp=require(_0x522f('0x3'));var fs=require('fs');var path=require(_0x522f('0x4'));var rimraf=require(_0x522f('0x5'));var config=require(_0x522f('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x522f('0x7')]=function(_0x5517bd,_0x213626){return _0x5517bd[_0x522f('0x8')](_0x522f('0x9'),attributes,{'tableName':_0x522f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66e7=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0xb013d1,_0x3bffcd){var _0x376364=function(_0x2c8e02){while(--_0x2c8e02){_0xb013d1['push'](_0xb013d1['shift']());}};_0x376364(++_0x3bffcd);}(_0x66e7,0x11f));var _0x766e=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0x66e7[_0x872b02];return _0x1a6b24;};'use strict';var _=require(_0x766e('0x0'));var util=require(_0x766e('0x1'));var logger=require(_0x766e('0x2'))(_0x766e('0x3'));var moment=require(_0x766e('0x4'));var BPromise=require(_0x766e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x766e('0x6'));var rimraf=require(_0x766e('0x7'));var config=require(_0x766e('0x8'));var attributes=require(_0x766e('0x9'));module[_0x766e('0xa')]=function(_0x5f3aa5,_0x26e591){return _0x5f3aa5[_0x766e('0xb')](_0x766e('0xc'),attributes,{'tableName':_0x766e('0xd'),'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 2ca7a6d..e4437db 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 _0xb434=['code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x56a9fa,_0x50bac1){var _0x47576f=function(_0x5343d0){while(--_0x5343d0){_0x56a9fa['push'](_0x56a9fa['shift']());}};_0x47576f(++_0x50bac1);}(_0xb434,0x101));var _0x4b43=function(_0x4c2f17,_0x5c6821){_0x4c2f17=_0x4c2f17-0x0;var _0x20919e=_0xb434[_0x4c2f17];return _0x20919e;};'use strict';var _=require('lodash');var util=require(_0x4b43('0x0'));var moment=require('moment');var BPromise=require(_0x4b43('0x1'));var rs=require(_0x4b43('0x2'));var fs=require('fs');var Redis=require(_0x4b43('0x3'));var db=require(_0x4b43('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4b43('0x5'));var config=require(_0x4b43('0x6'));var jayson=require(_0x4b43('0x7'));var client=jayson[_0x4b43('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20dc5b,_0xb7182e,_0x4b4a7f){return new BPromise(function(_0x20a789,_0x1fd94c){return client[_0x4b43('0x9')](_0x20dc5b,_0x4b4a7f)[_0x4b43('0xa')](function(_0x4887a3){logger['info'](_0x4b43('0xb'),_0xb7182e,_0x4b43('0xc'));logger['debug'](_0x4b43('0xd'),_0xb7182e,_0x4b43('0xc'),JSON[_0x4b43('0xe')](_0x4887a3));if(_0x4887a3[_0x4b43('0xf')]){if(_0x4887a3[_0x4b43('0xf')][_0x4b43('0x10')]===0x1f4){logger[_0x4b43('0xf')](_0x4b43('0xb'),_0xb7182e,_0x4887a3[_0x4b43('0xf')][_0x4b43('0x11')]);return _0x1fd94c(_0x4887a3[_0x4b43('0xf')][_0x4b43('0x11')]);}logger['error'](_0x4b43('0xb'),_0xb7182e,_0x4887a3['error'][_0x4b43('0x11')]);return _0x20a789(_0x4887a3[_0x4b43('0xf')][_0x4b43('0x11')]);}else{logger[_0x4b43('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xb7182e,_0x4b43('0xc'));_0x20a789(_0x4887a3[_0x4b43('0x13')][_0x4b43('0x11')]);}})[_0x4b43('0x14')](function(_0x44a8ef){logger[_0x4b43('0xf')](_0x4b43('0xb'),_0xb7182e,_0x44a8ef);_0x1fd94c(_0x44a8ef);});});} \ No newline at end of file +var _0x20b1=['../../config/utils','../../config/logger','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment'];(function(_0x4bdcd8,_0x5b4cd6){var _0x2bf60=function(_0x526da7){while(--_0x526da7){_0x4bdcd8['push'](_0x4bdcd8['shift']());}};_0x2bf60(++_0x5b4cd6);}(_0x20b1,0xa3));var _0x120b=function(_0x46d51c,_0x492de3){_0x46d51c=_0x46d51c-0x0;var _0x5dc062=_0x20b1[_0x46d51c];return _0x5dc062;};'use strict';var _=require('lodash');var util=require(_0x120b('0x0'));var moment=require(_0x120b('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(_0x120b('0x2'));var logger=require(_0x120b('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x120b('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a1557,_0x220c3d,_0x2b2099){return new BPromise(function(_0x49092c,_0x5b3dcd){return client[_0x120b('0x5')](_0x3a1557,_0x2b2099)['then'](function(_0x42bd98){logger[_0x120b('0x6')](_0x120b('0x7'),_0x220c3d,_0x120b('0x8'));logger[_0x120b('0x9')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x220c3d,_0x120b('0x8'),JSON[_0x120b('0xa')](_0x42bd98));if(_0x42bd98[_0x120b('0xb')]){if(_0x42bd98['error']['code']===0x1f4){logger[_0x120b('0xb')](_0x120b('0x7'),_0x220c3d,_0x42bd98[_0x120b('0xb')][_0x120b('0xc')]);return _0x5b3dcd(_0x42bd98[_0x120b('0xb')]['message']);}logger[_0x120b('0xb')](_0x120b('0x7'),_0x220c3d,_0x42bd98[_0x120b('0xb')]['message']);return _0x49092c(_0x42bd98[_0x120b('0xb')][_0x120b('0xc')]);}else{logger[_0x120b('0x6')](_0x120b('0x7'),_0x220c3d,'request\x20sent');_0x49092c(_0x42bd98[_0x120b('0xd')][_0x120b('0xc')]);}})[_0x120b('0xe')](function(_0x58e0bc){logger[_0x120b('0xb')](_0x120b('0x7'),_0x220c3d,_0x58e0bc);_0x5b3dcd(_0x58e0bc);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index d04d422..51c841a 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 _0x8b7c=['delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','getQuestions','post','update'];(function(_0x2597aa,_0x19ae67){var _0x58ac0c=function(_0x533788){while(--_0x533788){_0x2597aa['push'](_0x2597aa['shift']());}};_0x58ac0c(++_0x19ae67);}(_0x8b7c,0x119));var _0xc8b7=function(_0x54fdd8,_0x2e81ae){_0x54fdd8=_0x54fdd8-0x0;var _0x4f6f8a=_0x8b7c[_0x54fdd8];return _0x4f6f8a;};'use strict';var multer=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var path=require(_0xc8b7('0x2'));var timeout=require(_0xc8b7('0x3'));var express=require(_0xc8b7('0x4'));var router=express[_0xc8b7('0x5')]();var auth=require(_0xc8b7('0x6'));var interaction=require(_0xc8b7('0x7'));var config=require('../../config/environment');var controller=require(_0xc8b7('0x8'));router[_0xc8b7('0x9')]('/',auth[_0xc8b7('0xa')](),controller['index']);router[_0xc8b7('0x9')](_0xc8b7('0xb'),auth[_0xc8b7('0xa')](),controller[_0xc8b7('0xc')]);router[_0xc8b7('0x9')](_0xc8b7('0xd'),auth['isAuthenticated'](),controller[_0xc8b7('0xe')]);router['get'](_0xc8b7('0xf'),auth[_0xc8b7('0xa')](),controller[_0xc8b7('0x10')]);router[_0xc8b7('0x11')]('/',auth[_0xc8b7('0xa')](),controller['create']);router['put']('/:id',auth[_0xc8b7('0xa')](),controller[_0xc8b7('0x12')]);router[_0xc8b7('0x13')](_0xc8b7('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd2ea=['../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','getQuestions','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd2ea,0x15f));var _0xad2e=function(_0x198433,_0x496c7b){_0x198433=_0x198433-0x0;var _0x43418d=_0xd2ea[_0x198433];return _0x43418d;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var auth=require(_0xad2e('0x5'));var interaction=require(_0xad2e('0x6'));var config=require(_0xad2e('0x7'));var controller=require(_0xad2e('0x8'));router[_0xad2e('0x9')]('/',auth[_0xad2e('0xa')](),controller[_0xad2e('0xb')]);router['get'](_0xad2e('0xc'),auth[_0xad2e('0xa')](),controller[_0xad2e('0xd')]);router['get'](_0xad2e('0xe'),auth[_0xad2e('0xa')](),controller['show']);router[_0xad2e('0x9')]('/:id/questions',auth[_0xad2e('0xa')](),controller[_0xad2e('0xf')]);router[_0xad2e('0x10')]('/',auth[_0xad2e('0xa')](),controller['create']);router[_0xad2e('0x11')]('/:id',auth[_0xad2e('0xa')](),controller[_0xad2e('0x12')]);router[_0xad2e('0x13')](_0xad2e('0xe'),auth['isAuthenticated'](),controller[_0xad2e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 68b10ca..4a8e6fd 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 _0x830e=['endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports','DATE','starttime'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0x830e,0xcc));var _0xe830=function(_0x2f23fc,_0x50de14){_0x2f23fc=_0x2f23fc-0x0;var _0x4ebdbf=_0x830e[_0x2f23fc];return _0x4ebdbf;};'use strict';var moment=require(_0xe830('0x0'));var Sequelize=require('sequelize');module[_0xe830('0x1')]={'starttime':{'type':Sequelize[_0xe830('0x2')],'set':function(_0x3aa1d5){this['setDataValue'](_0xe830('0x3'),_0x3aa1d5);this['setDataValue'](_0xe830('0x4'),moment()['format'](_0xe830('0x5')));}},'endtime':{'type':Sequelize[_0xe830('0x2')]},'membername':{'type':Sequelize[_0xe830('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xe830('0x6')]},'uniqueid':{'type':Sequelize[_0xe830('0x6')]},'calleridname':{'type':Sequelize[_0xe830('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xe830('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x52a9=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','format'];(function(_0x1fb5a3,_0x3e7022){var _0x29c116=function(_0x2cab5e){while(--_0x2cab5e){_0x1fb5a3['push'](_0x1fb5a3['shift']());}};_0x29c116(++_0x3e7022);}(_0x52a9,0x189));var _0x952a=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x52a9[_0x3ea913];return _0x2b4f28;};'use strict';var moment=require(_0x952a('0x0'));var Sequelize=require(_0x952a('0x1'));module[_0x952a('0x2')]={'starttime':{'type':Sequelize[_0x952a('0x3')],'set':function(_0x3a1690){this[_0x952a('0x4')](_0x952a('0x5'),_0x3a1690);this[_0x952a('0x4')]('endtime',moment()[_0x952a('0x6')](_0x952a('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x952a('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x952a('0x8')]},'calleridnum':{'type':Sequelize[_0x952a('0x8')]},'completed':{'type':Sequelize[_0x952a('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index dad00d8..0b5895d 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 _0x81c9=['body','params','describe','getQuestions','findOne','JscriptyQuestionReport','map','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','sort','where','filters','pick','merge','VIRTUAL','filter','options','JscriptySessionReport','includeAll','include','findAll','rows','show','find','create','catch'];(function(_0x20d6f0,_0x33e54c){var _0x105ceb=function(_0x4927e9){while(--_0x4927e9){_0x20d6f0['push'](_0x20d6f0['shift']());}};_0x105ceb(++_0x33e54c);}(_0x81c9,0xa7));var _0x981c=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x81c9[_0x49ca18];return _0x145d54;};'use strict';var pdf=require(_0x981c('0x0'));var emlformat=require(_0x981c('0x1'));var rimraf=require(_0x981c('0x2'));var zipdir=require(_0x981c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x981c('0x4'));var moment=require('moment');var BPromise=require(_0x981c('0x5'));var Mustache=require(_0x981c('0x6'));var util=require(_0x981c('0x7'));var path=require('path');var sox=require(_0x981c('0x8'));var csv=require(_0x981c('0x9'));var ejs=require(_0x981c('0xa'));var fs=require('fs');var _=require(_0x981c('0xb'));var squel=require(_0x981c('0xc'));var crypto=require(_0x981c('0xd'));var jsforce=require(_0x981c('0xe'));var deskjs=require(_0x981c('0xf'));var toCsv=require(_0x981c('0x9'));var querystring=require(_0x981c('0x10'));var Papa=require('papaparse');var Redis=require(_0x981c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x981c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x981c('0x13'));var logger=require(_0x981c('0x14'))(_0x981c('0x15'));var utils=require(_0x981c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x981c('0x17'));var db=require(_0x981c('0x18'))['db'];function respondWithStatusCode(_0x14228e,_0x575cde){_0x575cde=_0x575cde||0xcc;return function(_0x1b0dee){if(_0x1b0dee){return _0x14228e[_0x981c('0x19')](_0x575cde);}return _0x14228e[_0x981c('0x1a')](_0x575cde)[_0x981c('0x1b')]();};}function respondWithResult(_0x422b81,_0x352125){_0x352125=_0x352125||0xc8;return function(_0x471fc0){if(_0x471fc0){return _0x422b81[_0x981c('0x1a')](_0x352125)['json'](_0x471fc0);}};}function respondWithFilteredResult(_0x178ac9,_0x5ef08d){return function(_0x49a654){if(_0x49a654){var _0x2d977d=_0x49a654[_0x981c('0x1c')],_0x213ade=_0x5ef08d['offset'],_0x4b06f3=_0x5ef08d['offset']+_0x5ef08d['limit'],_0x380613;if(_0x4b06f3>=_0x2d977d){_0x4b06f3=_0x2d977d;_0x380613=0xc8;}else{_0x380613=0xce;}_0x178ac9['status'](_0x380613);return _0x178ac9[_0x981c('0x1d')]('Content-Range',_0x213ade+'-'+_0x4b06f3+'/'+_0x2d977d)[_0x981c('0x1e')](_0x49a654);}return null;};}function patchUpdates(_0x3ec1ba){return function(_0x499bb6){try{jsonpatch[_0x981c('0x1f')](_0x499bb6,_0x3ec1ba,!![]);}catch(_0x44443c){return BPromise[_0x981c('0x20')](_0x44443c);}return _0x499bb6[_0x981c('0x21')]();};}function saveUpdates(_0x482d21,_0x23d48){return function(_0xf648a3){if(_0xf648a3){return _0xf648a3[_0x981c('0x22')](_0x482d21)[_0x981c('0x23')](function(_0x5cc190){return _0x5cc190;});}return null;};}function removeEntity(_0x305a53,_0x4ebdba){return function(_0x12d8b4){if(_0x12d8b4){return _0x12d8b4[_0x981c('0x24')]()['then'](function(){_0x305a53[_0x981c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56979c,_0x438ef8){return function(_0x54a10e){if(!_0x54a10e){_0x56979c[_0x981c('0x19')](0x194);}return _0x54a10e;};}function handleError(_0x5442a6,_0x1b6ec5){_0x1b6ec5=_0x1b6ec5||0x1f4;return function(_0x190527){logger[_0x981c('0x25')](_0x190527[_0x981c('0x26')]);if(_0x190527[_0x981c('0x27')]){delete _0x190527[_0x981c('0x27')];}_0x5442a6[_0x981c('0x1a')](_0x1b6ec5)[_0x981c('0x28')](_0x190527);};}exports[_0x981c('0x29')]=function(_0x5b8f33,_0x150db2){var _0x1f2fd3={},_0x356cd4={},_0xc69aae={'count':0x0,'rows':[]};var _0x3e2d7b=_['map'](db['JscriptySessionReport'][_0x981c('0x2a')],function(_0x58058c){return{'name':_0x58058c[_0x981c('0x2b')],'type':_0x58058c[_0x981c('0x2c')]['key']};});_0x356cd4[_0x981c('0x2d')]=_['map'](_0x3e2d7b,'name');_0x356cd4[_0x981c('0x2e')]=_[_0x981c('0x2f')](_0x5b8f33[_0x981c('0x2e')]);_0x356cd4['filters']=_[_0x981c('0x30')](_0x356cd4[_0x981c('0x2d')],_0x356cd4[_0x981c('0x2e')]);_0x1f2fd3['attributes']=_['intersection'](_0x356cd4[_0x981c('0x2d')],qs['fields'](_0x5b8f33['query'][_0x981c('0x31')]));_0x1f2fd3[_0x981c('0x32')]=_0x1f2fd3[_0x981c('0x32')][_0x981c('0x33')]?_0x1f2fd3[_0x981c('0x32')]:_0x356cd4[_0x981c('0x2d')];if(!_0x5b8f33[_0x981c('0x2e')][_0x981c('0x34')](_0x981c('0x35'))){_0x1f2fd3[_0x981c('0x36')]=qs[_0x981c('0x36')](_0x5b8f33[_0x981c('0x2e')][_0x981c('0x36')]);_0x1f2fd3[_0x981c('0x37')]=qs['offset'](_0x5b8f33[_0x981c('0x2e')][_0x981c('0x37')]);}_0x1f2fd3['order']=qs[_0x981c('0x38')](_0x5b8f33[_0x981c('0x2e')]['sort']);_0x1f2fd3[_0x981c('0x39')]=qs[_0x981c('0x3a')](_[_0x981c('0x3b')](_0x5b8f33[_0x981c('0x2e')],_0x356cd4['filters']),_0x3e2d7b);if(_0x5b8f33['query']['filter']){_0x1f2fd3[_0x981c('0x39')]=_[_0x981c('0x3c')](_0x1f2fd3[_0x981c('0x39')],{'$or':_['map'](_0x3e2d7b,function(_0xc2b755){if(_0xc2b755['type']!==_0x981c('0x3d')){var _0x529c10={};_0x529c10[_0xc2b755[_0x981c('0x27')]]={'$like':'%'+_0x5b8f33['query'][_0x981c('0x3e')]+'%'};return _0x529c10;}})});}_0x1f2fd3=_[_0x981c('0x3c')]({},_0x1f2fd3,_0x5b8f33[_0x981c('0x3f')]);var _0x33a5e6={'where':_0x1f2fd3[_0x981c('0x39')]};return db[_0x981c('0x40')][_0x981c('0x1c')](_0x33a5e6)[_0x981c('0x23')](function(_0x39f7ce){_0xc69aae[_0x981c('0x1c')]=_0x39f7ce;if(_0x5b8f33[_0x981c('0x2e')][_0x981c('0x41')]){_0x1f2fd3[_0x981c('0x42')]=[{'all':!![]}];}return db[_0x981c('0x40')][_0x981c('0x43')](_0x1f2fd3);})[_0x981c('0x23')](function(_0x35368f){_0xc69aae[_0x981c('0x44')]=_0x35368f;return _0xc69aae;})[_0x981c('0x23')](respondWithFilteredResult(_0x150db2,_0x1f2fd3))['catch'](handleError(_0x150db2,null));};exports[_0x981c('0x45')]=function(_0xa2a5f,_0x36b38b){var _0x58d4d9={'raw':!![],'where':{'id':_0xa2a5f['params']['id']}},_0x341096={};_0x341096[_0x981c('0x2d')]=_[_0x981c('0x2f')](db['JscriptySessionReport'][_0x981c('0x2a')]);_0x341096[_0x981c('0x2e')]=_[_0x981c('0x2f')](_0xa2a5f['query']);_0x341096[_0x981c('0x3a')]=_[_0x981c('0x30')](_0x341096[_0x981c('0x2d')],_0x341096[_0x981c('0x2e')]);_0x58d4d9[_0x981c('0x32')]=_[_0x981c('0x30')](_0x341096[_0x981c('0x2d')],qs[_0x981c('0x31')](_0xa2a5f['query'][_0x981c('0x31')]));_0x58d4d9[_0x981c('0x32')]=_0x58d4d9['attributes'][_0x981c('0x33')]?_0x58d4d9['attributes']:_0x341096[_0x981c('0x2d')];if(_0xa2a5f[_0x981c('0x2e')][_0x981c('0x41')]){_0x58d4d9[_0x981c('0x42')]=[{'all':!![]}];}_0x58d4d9=_[_0x981c('0x3c')]({},_0x58d4d9,_0xa2a5f['options']);return db[_0x981c('0x40')][_0x981c('0x46')](_0x58d4d9)['then'](handleEntityNotFound(_0x36b38b,null))[_0x981c('0x23')](respondWithResult(_0x36b38b,null))['catch'](handleError(_0x36b38b,null));};exports[_0x981c('0x47')]=function(_0xa13f25,_0x298c5f){return db[_0x981c('0x40')]['create'](_0xa13f25['body'],{})[_0x981c('0x23')](respondWithResult(_0x298c5f,0xc9))[_0x981c('0x48')](handleError(_0x298c5f,null));};exports[_0x981c('0x22')]=function(_0x56d06b,_0xa023d0){if(_0x56d06b['body']['id']){delete _0x56d06b[_0x981c('0x49')]['id'];}return db[_0x981c('0x40')][_0x981c('0x46')]({'where':{'id':_0x56d06b[_0x981c('0x4a')]['id']}})['then'](handleEntityNotFound(_0xa023d0,null))[_0x981c('0x23')](saveUpdates(_0x56d06b[_0x981c('0x49')],null))[_0x981c('0x23')](respondWithResult(_0xa023d0,null))[_0x981c('0x48')](handleError(_0xa023d0,null));};exports[_0x981c('0x24')]=function(_0x1d0c17,_0x18350b){return db['JscriptySessionReport'][_0x981c('0x46')]({'where':{'id':_0x1d0c17[_0x981c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x18350b,null))[_0x981c('0x23')](removeEntity(_0x18350b,null))['catch'](handleError(_0x18350b,null));};exports['describe']=function(_0x3fb4f8,_0x548bbb){return db[_0x981c('0x40')][_0x981c('0x4b')]()[_0x981c('0x23')](respondWithResult(_0x548bbb,null))['catch'](handleError(_0x548bbb,null));};exports[_0x981c('0x4c')]=function(_0x5e5643,_0x417111,_0xe09260){var _0x5a8d4f={'raw':!![],'where':{}};var _0x108c2e={};var _0x52fb05={'count':0x0,'rows':[]};return db[_0x981c('0x40')][_0x981c('0x4d')]({'where':{'id':_0x5e5643[_0x981c('0x4a')]['id']}})[_0x981c('0x23')](handleEntityNotFound(_0x417111,null))['then'](function(_0xa4bc7a){if(_0xa4bc7a){_0x108c2e[_0x981c('0x2d')]=_[_0x981c('0x2f')](db[_0x981c('0x4e')][_0x981c('0x2a')]);_0x108c2e['query']=_['keys'](_0x5e5643['query']);_0x108c2e['filters']=_['intersection'](_0x108c2e['model'],_0x108c2e[_0x981c('0x2e')]);_0x5a8d4f[_0x981c('0x32')]=_['intersection'](_0x108c2e['model'],qs['fields'](_0x5e5643[_0x981c('0x2e')][_0x981c('0x31')]));_0x5a8d4f[_0x981c('0x32')]=_0x5a8d4f['attributes'][_0x981c('0x33')]?_0x5a8d4f[_0x981c('0x32')]:_0x108c2e[_0x981c('0x2d')];if(!_0x5e5643[_0x981c('0x2e')][_0x981c('0x34')](_0x981c('0x35'))){_0x5a8d4f[_0x981c('0x36')]=qs[_0x981c('0x36')](_0x5e5643[_0x981c('0x2e')][_0x981c('0x36')]);_0x5a8d4f['offset']=qs['offset'](_0x5e5643[_0x981c('0x2e')]['offset']);}_0x5a8d4f['order']=qs[_0x981c('0x38')](_0x5e5643[_0x981c('0x2e')][_0x981c('0x38')]);_0x5a8d4f['where']=qs[_0x981c('0x3a')](_[_0x981c('0x3b')](_0x5e5643['query'],_0x108c2e[_0x981c('0x3a')]));_0x5a8d4f[_0x981c('0x39')]['SessionId']=_0xa4bc7a['id'];if(_0x5e5643[_0x981c('0x2e')][_0x981c('0x3e')]){_0x5a8d4f[_0x981c('0x39')]=_[_0x981c('0x3c')](_0x5a8d4f[_0x981c('0x39')],{'$or':_[_0x981c('0x4f')](_0x5a8d4f['attributes'],function(_0x7facfb){var _0x28e9f3={};_0x28e9f3[_0x7facfb]={'$like':'%'+_0x5e5643[_0x981c('0x2e')][_0x981c('0x3e')]+'%'};return _0x28e9f3;})});}_0x5a8d4f=_[_0x981c('0x3c')]({},_0x5a8d4f,_0x5e5643['options']);return db[_0x981c('0x4e')][_0x981c('0x1c')]({'where':_0x5a8d4f[_0x981c('0x39')]})[_0x981c('0x23')](function(_0x4a7279){_0x52fb05[_0x981c('0x1c')]=_0x4a7279;if(_0x5e5643['query'][_0x981c('0x41')]){_0x5a8d4f[_0x981c('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x981c('0x43')](_0x5a8d4f);})[_0x981c('0x23')](function(_0x4efac1){_0x52fb05['rows']=_0x4efac1;return _0x52fb05;});}})[_0x981c('0x23')](respondWithFilteredResult(_0x417111,_0x5a8d4f))[_0x981c('0x48')](handleError(_0x417111,null));}; \ No newline at end of file +var _0x890c=['map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','rows','show','include','merge','find','create','catch','update','body','destroy','params','describe','getQuestions','findOne','SessionId','JscriptyQuestionReport','findAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','then','error','stack','name','index'];(function(_0x52e0d3,_0x1cfc13){var _0x4a837a=function(_0x3e8267){while(--_0x3e8267){_0x52e0d3['push'](_0x52e0d3['shift']());}};_0x4a837a(++_0x1cfc13);}(_0x890c,0x119));var _0xc890=function(_0x403687,_0x10c094){_0x403687=_0x403687-0x0;var _0x27e03f=_0x890c[_0x403687];return _0x27e03f;};'use strict';var pdf=require(_0xc890('0x0'));var emlformat=require(_0xc890('0x1'));var rimraf=require(_0xc890('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc890('0x3'));var rp=require(_0xc890('0x4'));var moment=require(_0xc890('0x5'));var BPromise=require(_0xc890('0x6'));var Mustache=require(_0xc890('0x7'));var util=require('util');var path=require(_0xc890('0x8'));var sox=require(_0xc890('0x9'));var csv=require('to-csv');var ejs=require(_0xc890('0xa'));var fs=require('fs');var _=require(_0xc890('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc890('0xc'));var deskjs=require(_0xc890('0xd'));var toCsv=require(_0xc890('0xe'));var querystring=require(_0xc890('0xf'));var Papa=require(_0xc890('0x10'));var Redis=require(_0xc890('0x11'));var authService=require(_0xc890('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc890('0x13'));var logger=require(_0xc890('0x14'))(_0xc890('0x15'));var utils=require('../../config/utils');var config=require(_0xc890('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc890('0x17'))['db'];function respondWithStatusCode(_0x1899ed,_0x363ea5){_0x363ea5=_0x363ea5||0xcc;return function(_0x5dc5ae){if(_0x5dc5ae){return _0x1899ed[_0xc890('0x18')](_0x363ea5);}return _0x1899ed[_0xc890('0x19')](_0x363ea5)[_0xc890('0x1a')]();};}function respondWithResult(_0xc86897,_0x3f379d){_0x3f379d=_0x3f379d||0xc8;return function(_0x52cbc1){if(_0x52cbc1){return _0xc86897[_0xc890('0x19')](_0x3f379d)[_0xc890('0x1b')](_0x52cbc1);}};}function respondWithFilteredResult(_0x42e9c2,_0x307aa5){return function(_0x364ea1){if(_0x364ea1){var _0x45a1c0=_0x364ea1[_0xc890('0x1c')],_0x41b566=_0x307aa5[_0xc890('0x1d')],_0x51db95=_0x307aa5['offset']+_0x307aa5[_0xc890('0x1e')],_0x326752;if(_0x51db95>=_0x45a1c0){_0x51db95=_0x45a1c0;_0x326752=0xc8;}else{_0x326752=0xce;}_0x42e9c2[_0xc890('0x19')](_0x326752);return _0x42e9c2[_0xc890('0x1f')](_0xc890('0x20'),_0x41b566+'-'+_0x51db95+'/'+_0x45a1c0)[_0xc890('0x1b')](_0x364ea1);}return null;};}function patchUpdates(_0x944987){return function(_0x5d1d80){try{jsonpatch[_0xc890('0x21')](_0x5d1d80,_0x944987,!![]);}catch(_0xc94770){return BPromise['reject'](_0xc94770);}return _0x5d1d80['save']();};}function saveUpdates(_0x533e91,_0x286c67){return function(_0x5d446d){if(_0x5d446d){return _0x5d446d['update'](_0x533e91)[_0xc890('0x22')](function(_0xf21c5f){return _0xf21c5f;});}return null;};}function removeEntity(_0xaa58c3,_0x260d0a){return function(_0x540f39){if(_0x540f39){return _0x540f39['destroy']()['then'](function(){_0xaa58c3['status'](0xcc)[_0xc890('0x1a')]();});}};}function handleEntityNotFound(_0x477a03,_0x50ef87){return function(_0x4ee5ba){if(!_0x4ee5ba){_0x477a03[_0xc890('0x18')](0x194);}return _0x4ee5ba;};}function handleError(_0x333780,_0x1fcf10){_0x1fcf10=_0x1fcf10||0x1f4;return function(_0x40a7d0){logger[_0xc890('0x23')](_0x40a7d0[_0xc890('0x24')]);if(_0x40a7d0[_0xc890('0x25')]){delete _0x40a7d0[_0xc890('0x25')];}_0x333780[_0xc890('0x19')](_0x1fcf10)['send'](_0x40a7d0);};}exports[_0xc890('0x26')]=function(_0x22a555,_0x738785){var _0xe96587={},_0x2ad0a1={},_0x57480c={'count':0x0,'rows':[]};var _0x45492e=_[_0xc890('0x27')](db[_0xc890('0x28')][_0xc890('0x29')],function(_0x221741){return{'name':_0x221741[_0xc890('0x2a')],'type':_0x221741[_0xc890('0x2b')][_0xc890('0x2c')]};});_0x2ad0a1['model']=_[_0xc890('0x27')](_0x45492e,_0xc890('0x25'));_0x2ad0a1[_0xc890('0x2d')]=_[_0xc890('0x2e')](_0x22a555[_0xc890('0x2d')]);_0x2ad0a1[_0xc890('0x2f')]=_[_0xc890('0x30')](_0x2ad0a1['model'],_0x2ad0a1[_0xc890('0x2d')]);_0xe96587['attributes']=_['intersection'](_0x2ad0a1[_0xc890('0x31')],qs['fields'](_0x22a555[_0xc890('0x2d')][_0xc890('0x32')]));_0xe96587[_0xc890('0x33')]=_0xe96587['attributes'][_0xc890('0x34')]?_0xe96587[_0xc890('0x33')]:_0x2ad0a1['model'];if(!_0x22a555['query'][_0xc890('0x35')](_0xc890('0x36'))){_0xe96587[_0xc890('0x1e')]=qs['limit'](_0x22a555['query'][_0xc890('0x1e')]);_0xe96587['offset']=qs[_0xc890('0x1d')](_0x22a555['query'][_0xc890('0x1d')]);}_0xe96587[_0xc890('0x37')]=qs[_0xc890('0x38')](_0x22a555['query'][_0xc890('0x38')]);_0xe96587[_0xc890('0x39')]=qs['filters'](_[_0xc890('0x3a')](_0x22a555['query'],_0x2ad0a1['filters']),_0x45492e);if(_0x22a555[_0xc890('0x2d')][_0xc890('0x3b')]){_0xe96587['where']=_['merge'](_0xe96587[_0xc890('0x39')],{'$or':_['map'](_0x45492e,function(_0x4aa353){if(_0x4aa353[_0xc890('0x2b')]!==_0xc890('0x3c')){var _0x4e6edc={};_0x4e6edc[_0x4aa353[_0xc890('0x25')]]={'$like':'%'+_0x22a555[_0xc890('0x2d')]['filter']+'%'};return _0x4e6edc;}})});}_0xe96587=_['merge']({},_0xe96587,_0x22a555[_0xc890('0x3d')]);var _0x3108fd={'where':_0xe96587['where']};return db[_0xc890('0x28')][_0xc890('0x1c')](_0x3108fd)[_0xc890('0x22')](function(_0x2ab3b1){_0x57480c[_0xc890('0x1c')]=_0x2ab3b1;if(_0x22a555['query'][_0xc890('0x3e')]){_0xe96587['include']=[{'all':!![]}];}return db[_0xc890('0x28')]['findAll'](_0xe96587);})[_0xc890('0x22')](function(_0x25d22f){_0x57480c[_0xc890('0x3f')]=_0x25d22f;return _0x57480c;})['then'](respondWithFilteredResult(_0x738785,_0xe96587))['catch'](handleError(_0x738785,null));};exports[_0xc890('0x40')]=function(_0x122dee,_0x206f6c){var _0xc9ea56={'raw':!![],'where':{'id':_0x122dee['params']['id']}},_0x1be3bd={};_0x1be3bd[_0xc890('0x31')]=_[_0xc890('0x2e')](db[_0xc890('0x28')][_0xc890('0x29')]);_0x1be3bd[_0xc890('0x2d')]=_[_0xc890('0x2e')](_0x122dee[_0xc890('0x2d')]);_0x1be3bd[_0xc890('0x2f')]=_[_0xc890('0x30')](_0x1be3bd['model'],_0x1be3bd[_0xc890('0x2d')]);_0xc9ea56[_0xc890('0x33')]=_[_0xc890('0x30')](_0x1be3bd[_0xc890('0x31')],qs['fields'](_0x122dee[_0xc890('0x2d')][_0xc890('0x32')]));_0xc9ea56[_0xc890('0x33')]=_0xc9ea56[_0xc890('0x33')][_0xc890('0x34')]?_0xc9ea56[_0xc890('0x33')]:_0x1be3bd[_0xc890('0x31')];if(_0x122dee['query'][_0xc890('0x3e')]){_0xc9ea56[_0xc890('0x41')]=[{'all':!![]}];}_0xc9ea56=_[_0xc890('0x42')]({},_0xc9ea56,_0x122dee[_0xc890('0x3d')]);return db[_0xc890('0x28')][_0xc890('0x43')](_0xc9ea56)[_0xc890('0x22')](handleEntityNotFound(_0x206f6c,null))[_0xc890('0x22')](respondWithResult(_0x206f6c,null))['catch'](handleError(_0x206f6c,null));};exports[_0xc890('0x44')]=function(_0x278212,_0x3eaf7d){return db[_0xc890('0x28')][_0xc890('0x44')](_0x278212['body'],{})[_0xc890('0x22')](respondWithResult(_0x3eaf7d,0xc9))[_0xc890('0x45')](handleError(_0x3eaf7d,null));};exports[_0xc890('0x46')]=function(_0x4abffe,_0x528eb9){if(_0x4abffe[_0xc890('0x47')]['id']){delete _0x4abffe[_0xc890('0x47')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x4abffe['params']['id']}})[_0xc890('0x22')](handleEntityNotFound(_0x528eb9,null))['then'](saveUpdates(_0x4abffe[_0xc890('0x47')],null))[_0xc890('0x22')](respondWithResult(_0x528eb9,null))[_0xc890('0x45')](handleError(_0x528eb9,null));};exports[_0xc890('0x48')]=function(_0x3e40b1,_0x235d38){return db[_0xc890('0x28')][_0xc890('0x43')]({'where':{'id':_0x3e40b1[_0xc890('0x49')]['id']}})[_0xc890('0x22')](handleEntityNotFound(_0x235d38,null))[_0xc890('0x22')](removeEntity(_0x235d38,null))['catch'](handleError(_0x235d38,null));};exports[_0xc890('0x4a')]=function(_0x5b6cad,_0x291be2){return db[_0xc890('0x28')]['describe']()[_0xc890('0x22')](respondWithResult(_0x291be2,null))[_0xc890('0x45')](handleError(_0x291be2,null));};exports[_0xc890('0x4b')]=function(_0x4d87eb,_0x36b319,_0x4bbb6e){var _0x240dc8={'raw':!![],'where':{}};var _0x4104df={};var _0x3e1ed1={'count':0x0,'rows':[]};return db[_0xc890('0x28')][_0xc890('0x4c')]({'where':{'id':_0x4d87eb[_0xc890('0x49')]['id']}})[_0xc890('0x22')](handleEntityNotFound(_0x36b319,null))[_0xc890('0x22')](function(_0xb4972e){if(_0xb4972e){_0x4104df['model']=_[_0xc890('0x2e')](db['JscriptyQuestionReport']['rawAttributes']);_0x4104df[_0xc890('0x2d')]=_[_0xc890('0x2e')](_0x4d87eb['query']);_0x4104df['filters']=_[_0xc890('0x30')](_0x4104df['model'],_0x4104df['query']);_0x240dc8[_0xc890('0x33')]=_[_0xc890('0x30')](_0x4104df[_0xc890('0x31')],qs['fields'](_0x4d87eb[_0xc890('0x2d')][_0xc890('0x32')]));_0x240dc8[_0xc890('0x33')]=_0x240dc8[_0xc890('0x33')][_0xc890('0x34')]?_0x240dc8['attributes']:_0x4104df[_0xc890('0x31')];if(!_0x4d87eb['query'][_0xc890('0x35')](_0xc890('0x36'))){_0x240dc8['limit']=qs[_0xc890('0x1e')](_0x4d87eb['query'][_0xc890('0x1e')]);_0x240dc8['offset']=qs[_0xc890('0x1d')](_0x4d87eb[_0xc890('0x2d')][_0xc890('0x1d')]);}_0x240dc8[_0xc890('0x37')]=qs['sort'](_0x4d87eb[_0xc890('0x2d')][_0xc890('0x38')]);_0x240dc8[_0xc890('0x39')]=qs[_0xc890('0x2f')](_[_0xc890('0x3a')](_0x4d87eb[_0xc890('0x2d')],_0x4104df[_0xc890('0x2f')]));_0x240dc8[_0xc890('0x39')][_0xc890('0x4d')]=_0xb4972e['id'];if(_0x4d87eb[_0xc890('0x2d')][_0xc890('0x3b')]){_0x240dc8[_0xc890('0x39')]=_[_0xc890('0x42')](_0x240dc8[_0xc890('0x39')],{'$or':_[_0xc890('0x27')](_0x240dc8[_0xc890('0x33')],function(_0x339c42){var _0x3070d3={};_0x3070d3[_0x339c42]={'$like':'%'+_0x4d87eb[_0xc890('0x2d')][_0xc890('0x3b')]+'%'};return _0x3070d3;})});}_0x240dc8=_['merge']({},_0x240dc8,_0x4d87eb[_0xc890('0x3d')]);return db['JscriptyQuestionReport']['count']({'where':_0x240dc8[_0xc890('0x39')]})[_0xc890('0x22')](function(_0x4de49c){_0x3e1ed1['count']=_0x4de49c;if(_0x4d87eb['query']['includeAll']){_0x240dc8[_0xc890('0x41')]=[{'all':!![]}];}return db[_0xc890('0x4e')][_0xc890('0x4f')](_0x240dc8);})[_0xc890('0x22')](function(_0x28e50e){_0x3e1ed1[_0xc890('0x3f')]=_0x28e50e;return _0x3e1ed1;});}})[_0xc890('0x22')](respondWithFilteredResult(_0x36b319,_0x240dc8))[_0xc890('0x45')](handleError(_0x36b319,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 349eea5..ec0264f 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 _0x7605=['lodash','util','../../config/logger','moment','path','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x21786f,_0x5db1a2){var _0x1fc90a=function(_0x40197d){while(--_0x40197d){_0x21786f['push'](_0x21786f['shift']());}};_0x1fc90a(++_0x5db1a2);}(_0x7605,0x1dd));var _0x5760=function(_0x450809,_0x1452a7){_0x450809=_0x450809-0x0;var _0x38ecea=_0x7605[_0x450809];return _0x38ecea;};'use strict';var _=require(_0x5760('0x0'));var util=require(_0x5760('0x1'));var logger=require(_0x5760('0x2'))('api');var moment=require(_0x5760('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5760('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5760('0x5'));module[_0x5760('0x6')]=function(_0x3846d9,_0x135428){return _0x3846d9[_0x5760('0x7')](_0x5760('0x8'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f76=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0xf5276f,_0x1387b7){var _0x4e7834=function(_0x25cb10){while(--_0x25cb10){_0xf5276f['push'](_0xf5276f['shift']());}};_0x4e7834(++_0x1387b7);}(_0x6f76,0x1ef));var _0x66f7=function(_0x3daae8,_0x1d0a21){_0x3daae8=_0x3daae8-0x0;var _0x5412b2=_0x6f76[_0x3daae8];return _0x5412b2;};'use strict';var _=require(_0x66f7('0x0'));var util=require(_0x66f7('0x1'));var logger=require(_0x66f7('0x2'))(_0x66f7('0x3'));var moment=require(_0x66f7('0x4'));var BPromise=require(_0x66f7('0x5'));var rp=require(_0x66f7('0x6'));var fs=require('fs');var path=require(_0x66f7('0x7'));var rimraf=require(_0x66f7('0x8'));var config=require(_0x66f7('0x9'));var attributes=require(_0x66f7('0xa'));module[_0x66f7('0xb')]=function(_0x5a8175,_0x13e829){return _0x5a8175[_0x66f7('0xc')](_0x66f7('0xd'),attributes,{'tableName':_0x66f7('0xe'),'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 90b7d2f..9e35268 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 _0x7d51=['JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x535d2e,_0x5392e1){var _0x1bdca5=function(_0x920f8b){while(--_0x920f8b){_0x535d2e['push'](_0x535d2e['shift']());}};_0x1bdca5(++_0x5392e1);}(_0x7d51,0x1e9));var _0x17d5=function(_0x271397,_0x388be7){_0x271397=_0x271397-0x0;var _0xa73796=_0x7d51[_0x271397];return _0xa73796;};'use strict';var _=require(_0x17d5('0x0'));var util=require(_0x17d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17d5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17d5('0x3'))['db'];var utils=require(_0x17d5('0x4'));var logger=require(_0x17d5('0x5'))(_0x17d5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17d5('0x7')][_0x17d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28afa2,_0x1a8312,_0x44fbee){return new BPromise(function(_0x16e098,_0x533125){return client[_0x17d5('0x9')](_0x28afa2,_0x44fbee)[_0x17d5('0xa')](function(_0x3147c4){logger[_0x17d5('0xb')](_0x17d5('0xc'),_0x1a8312,_0x17d5('0xd'));logger[_0x17d5('0xe')](_0x17d5('0xf'),_0x1a8312,_0x17d5('0xd'),JSON[_0x17d5('0x10')](_0x3147c4));if(_0x3147c4[_0x17d5('0x11')]){if(_0x3147c4[_0x17d5('0x11')][_0x17d5('0x12')]===0x1f4){logger['error'](_0x17d5('0xc'),_0x1a8312,_0x3147c4[_0x17d5('0x11')]['message']);return _0x533125(_0x3147c4[_0x17d5('0x11')][_0x17d5('0x13')]);}logger[_0x17d5('0x11')](_0x17d5('0xc'),_0x1a8312,_0x3147c4[_0x17d5('0x11')][_0x17d5('0x13')]);return _0x16e098(_0x3147c4['error'][_0x17d5('0x13')]);}else{logger[_0x17d5('0xb')](_0x17d5('0xc'),_0x1a8312,_0x17d5('0xd'));_0x16e098(_0x3147c4[_0x17d5('0x14')][_0x17d5('0x13')]);}})['catch'](function(_0x57b62f){logger[_0x17d5('0x11')](_0x17d5('0xc'),_0x1a8312,_0x57b62f);_0x533125(_0x57b62f);});});} \ No newline at end of file +var _0x2d4d=['code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x173377,_0x3a940e){var _0xf46120=function(_0x5eaf41){while(--_0x5eaf41){_0x173377['push'](_0x173377['shift']());}};_0xf46120(++_0x3a940e);}(_0x2d4d,0x94));var _0xd2d4=function(_0x48ef50,_0x776acd){_0x48ef50=_0x48ef50-0x0;var _0x2c7b4f=_0x2d4d[_0x48ef50];return _0x2c7b4f;};'use strict';var _=require(_0xd2d4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd2d4('0x1'));var fs=require('fs');var Redis=require(_0xd2d4('0x2'));var db=require(_0xd2d4('0x3'))['db'];var utils=require(_0xd2d4('0x4'));var logger=require(_0xd2d4('0x5'))(_0xd2d4('0x6'));var config=require(_0xd2d4('0x7'));var jayson=require(_0xd2d4('0x8'));var client=jayson[_0xd2d4('0x9')][_0xd2d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56d1e3,_0x23e700,_0x57bae4){return new BPromise(function(_0x45176e,_0x89452c){return client[_0xd2d4('0xb')](_0x56d1e3,_0x57bae4)[_0xd2d4('0xc')](function(_0x2db655){logger[_0xd2d4('0xd')](_0xd2d4('0xe'),_0x23e700,_0xd2d4('0xf'));logger[_0xd2d4('0x10')](_0xd2d4('0x11'),_0x23e700,_0xd2d4('0xf'),JSON[_0xd2d4('0x12')](_0x2db655));if(_0x2db655[_0xd2d4('0x13')]){if(_0x2db655[_0xd2d4('0x13')][_0xd2d4('0x14')]===0x1f4){logger[_0xd2d4('0x13')](_0xd2d4('0xe'),_0x23e700,_0x2db655[_0xd2d4('0x13')][_0xd2d4('0x15')]);return _0x89452c(_0x2db655[_0xd2d4('0x13')][_0xd2d4('0x15')]);}logger[_0xd2d4('0x13')](_0xd2d4('0xe'),_0x23e700,_0x2db655[_0xd2d4('0x13')][_0xd2d4('0x15')]);return _0x45176e(_0x2db655[_0xd2d4('0x13')][_0xd2d4('0x15')]);}else{logger[_0xd2d4('0xd')](_0xd2d4('0xe'),_0x23e700,'request\x20sent');_0x45176e(_0x2db655[_0xd2d4('0x16')][_0xd2d4('0x15')]);}})[_0xd2d4('0x17')](function(_0x21e7a1){logger['error'](_0xd2d4('0xe'),_0x23e700,_0x21e7a1);_0x89452c(_0x21e7a1);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 4dca386..e1a0cf8 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 _0xb720=['put','/:id','update','exports','util','path','express','../../components/auth/service','../../components/interaction/service','./license.controller','get','index'];(function(_0x4c2bc5,_0x4984e2){var _0x487209=function(_0x3cabbf){while(--_0x3cabbf){_0x4c2bc5['push'](_0x4c2bc5['shift']());}};_0x487209(++_0x4984e2);}(_0xb720,0x118));var _0x0b72=function(_0x5dc755,_0x3254d0){_0x5dc755=_0x5dc755-0x0;var _0x24ce81=_0xb720[_0x5dc755];return _0x24ce81;};'use strict';var multer=require('multer');var util=require(_0x0b72('0x0'));var path=require(_0x0b72('0x1'));var timeout=require('connect-timeout');var express=require(_0x0b72('0x2'));var router=express['Router']();var auth=require(_0x0b72('0x3'));var interaction=require(_0x0b72('0x4'));var config=require('../../config/environment');var controller=require(_0x0b72('0x5'));router[_0x0b72('0x6')]('/',controller[_0x0b72('0x7')]);router[_0x0b72('0x8')](_0x0b72('0x9'),auth['isAuthenticated'](),controller[_0x0b72('0xa')]);module[_0x0b72('0xb')]=router; \ No newline at end of file +var _0xd20d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update','exports','util','express'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xd20d,0x136));var _0xdd20=function(_0x19d0a4,_0x275e29){_0x19d0a4=_0x19d0a4-0x0;var _0x41bbd0=_0xd20d[_0x19d0a4];return _0x41bbd0;};'use strict';var multer=require('multer');var util=require(_0xdd20('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdd20('0x1'));var router=express[_0xdd20('0x2')]();var auth=require(_0xdd20('0x3'));var interaction=require(_0xdd20('0x4'));var config=require(_0xdd20('0x5'));var controller=require(_0xdd20('0x6'));router[_0xdd20('0x7')]('/',controller['index']);router[_0xdd20('0x8')](_0xdd20('0x9'),auth[_0xdd20('0xa')](),controller[_0xdd20('0xb')]);module[_0xdd20('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 4932d8f..5abd188 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 _0x1261=['exports','TEXT','STRING','INTEGER'];(function(_0x125a19,_0x5b9054){var _0x431ae0=function(_0x4a85d8){while(--_0x4a85d8){_0x125a19['push'](_0x125a19['shift']());}};_0x431ae0(++_0x5b9054);}(_0x1261,0x144));var _0x1126=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x1261[_0x90a39a];return _0x2b62f7;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'license':{'type':Sequelize[_0x1126('0x1')]},'data1':{'type':Sequelize[_0x1126('0x2')]},'data2':{'type':Sequelize[_0x1126('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x1126('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x524e=['STRING','INTEGER','TEXT'];(function(_0x5ebc04,_0x14a363){var _0x17845c=function(_0x360850){while(--_0x360850){_0x5ebc04['push'](_0x5ebc04['shift']());}};_0x17845c(++_0x14a363);}(_0x524e,0x15e));var _0xe524=function(_0x246dec,_0x201571){_0x246dec=_0x246dec-0x0;var _0x329db5=_0x524e[_0x246dec];return _0x329db5;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0xe524('0x0')]},'data1':{'type':Sequelize[_0xe524('0x1')]},'data2':{'type':Sequelize[_0xe524('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xe524('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 54170c9..bd3b468 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 _0x6b4e=['json','count','status','apply','reject','save','then','destroy','stack','name','send','index','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','update','body','find','params','get','key','demo','eml-format','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x3fd074,_0x24c281){_0x3fd074=_0x3fd074-0x0;var _0xe823eb=_0x6b4e[_0x3fd074];return _0xe823eb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe6b4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe6b4('0x1'));var BPromise=require(_0xe6b4('0x2'));var Mustache=require(_0xe6b4('0x3'));var util=require(_0xe6b4('0x4'));var path=require(_0xe6b4('0x5'));var sox=require(_0xe6b4('0x6'));var csv=require('to-csv');var ejs=require(_0xe6b4('0x7'));var fs=require('fs');var _=require(_0xe6b4('0x8'));var squel=require(_0xe6b4('0x9'));var crypto=require(_0xe6b4('0xa'));var jsforce=require(_0xe6b4('0xb'));var deskjs=require(_0xe6b4('0xc'));var toCsv=require(_0xe6b4('0xd'));var querystring=require(_0xe6b4('0xe'));var Papa=require(_0xe6b4('0xf'));var Redis=require(_0xe6b4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe6b4('0x11'));var as=require(_0xe6b4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe6b4('0x13'));var config=require(_0xe6b4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6b4('0x15'))['db'];function respondWithStatusCode(_0x102306,_0x19fe43){_0x19fe43=_0x19fe43||0xcc;return function(_0x21ae59){if(_0x21ae59){return _0x102306[_0xe6b4('0x16')](_0x19fe43);}return _0x102306['status'](_0x19fe43)[_0xe6b4('0x17')]();};}function respondWithResult(_0x184353,_0x67ad14){_0x67ad14=_0x67ad14||0xc8;return function(_0x21ab5b){if(_0x21ab5b){return _0x184353['status'](_0x67ad14)[_0xe6b4('0x18')](_0x21ab5b);}};}function respondWithFilteredResult(_0x2022ca,_0x2e3eff){return function(_0x42876a){if(_0x42876a){var _0x25ad62=_0x42876a[_0xe6b4('0x19')],_0x5ec51c=_0x2e3eff['offset'],_0x3a64a5=_0x2e3eff['offset']+_0x2e3eff['limit'],_0x2c9335;if(_0x3a64a5>=_0x25ad62){_0x3a64a5=_0x25ad62;_0x2c9335=0xc8;}else{_0x2c9335=0xce;}_0x2022ca[_0xe6b4('0x1a')](_0x2c9335);return _0x2022ca['set']('Content-Range',_0x5ec51c+'-'+_0x3a64a5+'/'+_0x25ad62)[_0xe6b4('0x18')](_0x42876a);}return null;};}function patchUpdates(_0x4f7996){return function(_0x200c8f){try{jsonpatch[_0xe6b4('0x1b')](_0x200c8f,_0x4f7996,!![]);}catch(_0x38fb03){return BPromise[_0xe6b4('0x1c')](_0x38fb03);}return _0x200c8f[_0xe6b4('0x1d')]();};}function saveUpdates(_0x1899b4,_0xb7127){return function(_0x1013b8){if(_0x1013b8){return _0x1013b8['update'](_0x1899b4)[_0xe6b4('0x1e')](function(_0x51123e){return _0x51123e;});}return null;};}function removeEntity(_0x44648b,_0x1121cf){return function(_0x2dc1c5){if(_0x2dc1c5){return _0x2dc1c5[_0xe6b4('0x1f')]()[_0xe6b4('0x1e')](function(){_0x44648b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52ee39,_0x415b57){return function(_0x4aa07f){if(!_0x4aa07f){_0x52ee39[_0xe6b4('0x16')](0x194);}return _0x4aa07f;};}function handleError(_0x31b451,_0x21b07c){_0x21b07c=_0x21b07c||0x1f4;return function(_0x28bfef){logger['error'](_0x28bfef[_0xe6b4('0x20')]);if(_0x28bfef[_0xe6b4('0x21')]){delete _0x28bfef[_0xe6b4('0x21')];}_0x31b451['status'](_0x21b07c)[_0xe6b4('0x22')](_0x28bfef);};}var utilLicense=require('../../config/license/util');exports[_0xe6b4('0x23')]=function(_0x45168a,_0x5a4e25){var _0x332bbd={'raw':!![],'where':{'id':0x1}},_0x31df4a={};_0x31df4a[_0xe6b4('0x24')]=_['keys'](db['License'][_0xe6b4('0x25')]);_0x31df4a[_0xe6b4('0x26')]=_[_0xe6b4('0x27')](_0x45168a[_0xe6b4('0x26')]);_0x31df4a[_0xe6b4('0x28')]=_[_0xe6b4('0x29')](_0x31df4a[_0xe6b4('0x24')],_0x31df4a[_0xe6b4('0x26')]);_0x332bbd[_0xe6b4('0x2a')]=_['intersection'](_0x31df4a['model'],qs[_0xe6b4('0x2b')](_0x45168a[_0xe6b4('0x26')]['fields']));_0x332bbd[_0xe6b4('0x2a')]=_0x332bbd[_0xe6b4('0x2a')][_0xe6b4('0x2c')]?_0x332bbd['attributes']:_0x31df4a[_0xe6b4('0x24')];_0x332bbd=_[_0xe6b4('0x2d')]({},_0x332bbd,_0x45168a[_0xe6b4('0x2e')]);return utilLicense[_0xe6b4('0x2f')](_0x332bbd)[_0xe6b4('0x1e')](respondWithResult(_0x5a4e25,null))[_0xe6b4('0x30')](handleError(_0x5a4e25,null));};exports[_0xe6b4('0x31')]=function(_0x47c1ba,_0x195cb1){if(_0x47c1ba[_0xe6b4('0x32')]['id']){delete _0x47c1ba[_0xe6b4('0x32')]['id'];}return db['License'][_0xe6b4('0x33')]({'where':{'id':_0x47c1ba[_0xe6b4('0x34')]['id']}})['then'](handleEntityNotFound(_0x195cb1,null))[_0xe6b4('0x1e')](function(_0x425b84){var _0x2b846a=_0x425b84[_0xe6b4('0x35')]({'plain':!![]});return utilLicense['checkLicense'](_0x2b846a,_0x47c1ba[_0xe6b4('0x32')][_0xe6b4('0x36')]);})[_0xe6b4('0x1e')](function(_0x5d19c7){if(!_0x5d19c7[_0xe6b4('0x37')]){return saveUpdates(_0x47c1ba['body'],null);}return _0x5d19c7;})[_0xe6b4('0x1e')](respondWithResult(_0x195cb1,null))['catch'](handleError(_0x195cb1,null));}; \ No newline at end of file +var _0x1ffe=['Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','model','keys','rawAttributes','query','filters','attributes','intersection','fields','length','merge','options','getLicense','catch','body','License','find','params','get','checkLicense','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','sendStatus','status','json','count','offset','set'];(function(_0x1fc020,_0x21b776){var _0x328920=function(_0x326a53){while(--_0x326a53){_0x1fc020['push'](_0x1fc020['shift']());}};_0x328920(++_0x21b776);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x509d1f,_0x2fdf7b){_0x509d1f=_0x509d1f-0x0;var _0x58bafd=_0x1ffe[_0x509d1f];return _0x58bafd;};'use strict';var pdf=require(_0xe1ff('0x0'));var emlformat=require(_0xe1ff('0x1'));var rimraf=require(_0xe1ff('0x2'));var zipdir=require(_0xe1ff('0x3'));var jsonpatch=require(_0xe1ff('0x4'));var rp=require(_0xe1ff('0x5'));var moment=require(_0xe1ff('0x6'));var BPromise=require(_0xe1ff('0x7'));var Mustache=require(_0xe1ff('0x8'));var util=require(_0xe1ff('0x9'));var path=require(_0xe1ff('0xa'));var sox=require(_0xe1ff('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe1ff('0xc'));var squel=require(_0xe1ff('0xd'));var crypto=require(_0xe1ff('0xe'));var jsforce=require(_0xe1ff('0xf'));var deskjs=require(_0xe1ff('0x10'));var toCsv=require(_0xe1ff('0x11'));var querystring=require(_0xe1ff('0x12'));var Papa=require(_0xe1ff('0x13'));var Redis=require(_0xe1ff('0x14'));var authService=require(_0xe1ff('0x15'));var qs=require(_0xe1ff('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1ff('0x17'));var logger=require(_0xe1ff('0x18'))(_0xe1ff('0x19'));var utils=require(_0xe1ff('0x1a'));var config=require(_0xe1ff('0x1b'));var licenseUtil=require(_0xe1ff('0x1c'));var db=require(_0xe1ff('0x1d'))['db'];function respondWithStatusCode(_0x113114,_0x15cef7){_0x15cef7=_0x15cef7||0xcc;return function(_0x3bc3ef){if(_0x3bc3ef){return _0x113114[_0xe1ff('0x1e')](_0x15cef7);}return _0x113114[_0xe1ff('0x1f')](_0x15cef7)['end']();};}function respondWithResult(_0x205059,_0x31bcf8){_0x31bcf8=_0x31bcf8||0xc8;return function(_0x26511f){if(_0x26511f){return _0x205059['status'](_0x31bcf8)[_0xe1ff('0x20')](_0x26511f);}};}function respondWithFilteredResult(_0x45597a,_0x5a46cd){return function(_0x4b15c0){if(_0x4b15c0){var _0x5a9d67=_0x4b15c0[_0xe1ff('0x21')],_0x207234=_0x5a46cd[_0xe1ff('0x22')],_0x217f4d=_0x5a46cd[_0xe1ff('0x22')]+_0x5a46cd['limit'],_0x179205;if(_0x217f4d>=_0x5a9d67){_0x217f4d=_0x5a9d67;_0x179205=0xc8;}else{_0x179205=0xce;}_0x45597a['status'](_0x179205);return _0x45597a[_0xe1ff('0x23')](_0xe1ff('0x24'),_0x207234+'-'+_0x217f4d+'/'+_0x5a9d67)[_0xe1ff('0x20')](_0x4b15c0);}return null;};}function patchUpdates(_0x28c517){return function(_0x5c4ffc){try{jsonpatch[_0xe1ff('0x25')](_0x5c4ffc,_0x28c517,!![]);}catch(_0x223b2c){return BPromise[_0xe1ff('0x26')](_0x223b2c);}return _0x5c4ffc[_0xe1ff('0x27')]();};}function saveUpdates(_0x219796,_0x149cd7){return function(_0x17dd99){if(_0x17dd99){return _0x17dd99[_0xe1ff('0x28')](_0x219796)[_0xe1ff('0x29')](function(_0x373bbe){return _0x373bbe;});}return null;};}function removeEntity(_0x405f9e,_0x2e1a4c){return function(_0x186f6c){if(_0x186f6c){return _0x186f6c[_0xe1ff('0x2a')]()[_0xe1ff('0x29')](function(){_0x405f9e[_0xe1ff('0x1f')](0xcc)[_0xe1ff('0x2b')]();});}};}function handleEntityNotFound(_0x1bbbd1,_0x3ee7f4){return function(_0x2fb25e){if(!_0x2fb25e){_0x1bbbd1[_0xe1ff('0x1e')](0x194);}return _0x2fb25e;};}function handleError(_0x5d3be2,_0x3d05bf){_0x3d05bf=_0x3d05bf||0x1f4;return function(_0x440c83){logger[_0xe1ff('0x2c')](_0x440c83[_0xe1ff('0x2d')]);if(_0x440c83['name']){delete _0x440c83[_0xe1ff('0x2e')];}_0x5d3be2[_0xe1ff('0x1f')](_0x3d05bf)['send'](_0x440c83);};}var utilLicense=require(_0xe1ff('0x1c'));exports[_0xe1ff('0x2f')]=function(_0x328192,_0x21f6e0){var _0x6870b9={'raw':!![],'where':{'id':0x1}},_0x45babb={};_0x45babb[_0xe1ff('0x30')]=_[_0xe1ff('0x31')](db['License'][_0xe1ff('0x32')]);_0x45babb[_0xe1ff('0x33')]=_[_0xe1ff('0x31')](_0x328192[_0xe1ff('0x33')]);_0x45babb[_0xe1ff('0x34')]=_['intersection'](_0x45babb[_0xe1ff('0x30')],_0x45babb[_0xe1ff('0x33')]);_0x6870b9[_0xe1ff('0x35')]=_[_0xe1ff('0x36')](_0x45babb[_0xe1ff('0x30')],qs[_0xe1ff('0x37')](_0x328192[_0xe1ff('0x33')][_0xe1ff('0x37')]));_0x6870b9[_0xe1ff('0x35')]=_0x6870b9['attributes'][_0xe1ff('0x38')]?_0x6870b9['attributes']:_0x45babb[_0xe1ff('0x30')];_0x6870b9=_[_0xe1ff('0x39')]({},_0x6870b9,_0x328192[_0xe1ff('0x3a')]);return utilLicense[_0xe1ff('0x3b')](_0x6870b9)['then'](respondWithResult(_0x21f6e0,null))[_0xe1ff('0x3c')](handleError(_0x21f6e0,null));};exports['update']=function(_0x21a9e0,_0x3f0bc8){if(_0x21a9e0[_0xe1ff('0x3d')]['id']){delete _0x21a9e0[_0xe1ff('0x3d')]['id'];}return db[_0xe1ff('0x3e')][_0xe1ff('0x3f')]({'where':{'id':_0x21a9e0[_0xe1ff('0x40')]['id']}})[_0xe1ff('0x29')](handleEntityNotFound(_0x3f0bc8,null))[_0xe1ff('0x29')](function(_0x294180){var _0x2117d1=_0x294180[_0xe1ff('0x41')]({'plain':!![]});return utilLicense[_0xe1ff('0x42')](_0x2117d1,_0x21a9e0[_0xe1ff('0x3d')]['key']);})[_0xe1ff('0x29')](function(_0x2806a9){if(!_0x2806a9['demo']){return saveUpdates(_0x21a9e0[_0xe1ff('0x3d')],null);}return _0x2806a9;})[_0xe1ff('0x29')](respondWithResult(_0x3f0bc8,null))[_0xe1ff('0x3c')](handleError(_0x3f0bc8,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 5f8afb7..d5c5aad 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 _0x6484=['../../config/logger','api','moment','request-promise','path','../../config/environment','./license.attributes','exports','define','License','license','util'];(function(_0x128d4f,_0x47cd69){var _0x19826b=function(_0xb0bbd4){while(--_0xb0bbd4){_0x128d4f['push'](_0x128d4f['shift']());}};_0x19826b(++_0x47cd69);}(_0x6484,0x1bb));var _0x4648=function(_0x334307,_0x59264a){_0x334307=_0x334307-0x0;var _0x157333=_0x6484[_0x334307];return _0x157333;};'use strict';var _=require('lodash');var util=require(_0x4648('0x0'));var logger=require(_0x4648('0x1'))(_0x4648('0x2'));var moment=require(_0x4648('0x3'));var BPromise=require('bluebird');var rp=require(_0x4648('0x4'));var fs=require('fs');var path=require(_0x4648('0x5'));var rimraf=require('rimraf');var config=require(_0x4648('0x6'));var attributes=require(_0x4648('0x7'));module[_0x4648('0x8')]=function(_0x59a611,_0x85581e){return _0x59a611[_0x4648('0x9')](_0x4648('0xa'),attributes,{'tableName':_0x4648('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x131a=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','License','license','lodash'];(function(_0x54f4f1,_0x2e603b){var _0x14b71f=function(_0x410ca5){while(--_0x410ca5){_0x54f4f1['push'](_0x54f4f1['shift']());}};_0x14b71f(++_0x2e603b);}(_0x131a,0x18b));var _0xa131=function(_0x134a41,_0x2ff25a){_0x134a41=_0x134a41-0x0;var _0x40d790=_0x131a[_0x134a41];return _0x40d790;};'use strict';var _=require(_0xa131('0x0'));var util=require(_0xa131('0x1'));var logger=require(_0xa131('0x2'))(_0xa131('0x3'));var moment=require(_0xa131('0x4'));var BPromise=require('bluebird');var rp=require(_0xa131('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa131('0x6'));var config=require(_0xa131('0x7'));var attributes=require('./license.attributes');module[_0xa131('0x8')]=function(_0xdb263c,_0x1a51cf){return _0xdb263c[_0xa131('0x9')](_0xa131('0xa'),attributes,{'tableName':_0xa131('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 2d83d46..09dc2ab 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 _0xfbe2=['jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0xbcde1a,_0x221ea8){var _0x30edcc=function(_0x38b8dc){while(--_0x38b8dc){_0xbcde1a['push'](_0xbcde1a['shift']());}};_0x30edcc(++_0x221ea8);}(_0xfbe2,0x1da));var _0x2fbe=function(_0x301785,_0x506056){_0x301785=_0x301785-0x0;var _0x4ea53b=_0xfbe2[_0x301785];return _0x4ea53b;};'use strict';var _=require(_0x2fbe('0x0'));var util=require(_0x2fbe('0x1'));var moment=require(_0x2fbe('0x2'));var BPromise=require(_0x2fbe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fbe('0x4'));var db=require(_0x2fbe('0x5'))['db'];var utils=require(_0x2fbe('0x6'));var logger=require('../../config/logger')(_0x2fbe('0x7'));var config=require(_0x2fbe('0x8'));var jayson=require(_0x2fbe('0x9'));var client=jayson[_0x2fbe('0xa')][_0x2fbe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x221c08,_0x1f3340,_0x31f5da){return new BPromise(function(_0x1cd992,_0x1c32e9){return client[_0x2fbe('0xc')](_0x221c08,_0x31f5da)['then'](function(_0x4cf8b8){logger[_0x2fbe('0xd')](_0x2fbe('0xe'),_0x1f3340,_0x2fbe('0xf'));logger[_0x2fbe('0x10')](_0x2fbe('0x11'),_0x1f3340,_0x2fbe('0xf'),JSON[_0x2fbe('0x12')](_0x4cf8b8));if(_0x4cf8b8[_0x2fbe('0x13')]){if(_0x4cf8b8[_0x2fbe('0x13')][_0x2fbe('0x14')]===0x1f4){logger[_0x2fbe('0x13')](_0x2fbe('0xe'),_0x1f3340,_0x4cf8b8[_0x2fbe('0x13')][_0x2fbe('0x15')]);return _0x1c32e9(_0x4cf8b8['error'][_0x2fbe('0x15')]);}logger[_0x2fbe('0x13')](_0x2fbe('0xe'),_0x1f3340,_0x4cf8b8[_0x2fbe('0x13')][_0x2fbe('0x15')]);return _0x1cd992(_0x4cf8b8[_0x2fbe('0x13')]['message']);}else{logger[_0x2fbe('0xd')](_0x2fbe('0xe'),_0x1f3340,'request\x20sent');_0x1cd992(_0x4cf8b8[_0x2fbe('0x16')]['message']);}})['catch'](function(_0x33466c){logger[_0x2fbe('0x13')](_0x2fbe('0xe'),_0x1f3340,_0x33466c);_0x1c32e9(_0x33466c);});});} \ No newline at end of file +var _0x09dd=['code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error'];(function(_0x5c8541,_0x5a9822){var _0x145687=function(_0x500e4d){while(--_0x500e4d){_0x5c8541['push'](_0x5c8541['shift']());}};_0x145687(++_0x5a9822);}(_0x09dd,0x81));var _0xd09d=function(_0x3ed0ec,_0x44ece7){_0x3ed0ec=_0x3ed0ec-0x0;var _0x4b32f4=_0x09dd[_0x3ed0ec];return _0x4b32f4;};'use strict';var _=require(_0xd09d('0x0'));var util=require(_0xd09d('0x1'));var moment=require(_0xd09d('0x2'));var BPromise=require(_0xd09d('0x3'));var rs=require(_0xd09d('0x4'));var fs=require('fs');var Redis=require(_0xd09d('0x5'));var db=require(_0xd09d('0x6'))['db'];var utils=require(_0xd09d('0x7'));var logger=require(_0xd09d('0x8'))(_0xd09d('0x9'));var config=require(_0xd09d('0xa'));var jayson=require(_0xd09d('0xb'));var client=jayson[_0xd09d('0xc')][_0xd09d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5621cf,_0x2d4469,_0x1fce72){return new BPromise(function(_0x3e062b,_0x37a525){return client[_0xd09d('0xe')](_0x5621cf,_0x1fce72)[_0xd09d('0xf')](function(_0x2a26f7){logger['info'](_0xd09d('0x10'),_0x2d4469,_0xd09d('0x11'));logger[_0xd09d('0x12')](_0xd09d('0x13'),_0x2d4469,_0xd09d('0x11'),JSON['stringify'](_0x2a26f7));if(_0x2a26f7[_0xd09d('0x14')]){if(_0x2a26f7[_0xd09d('0x14')][_0xd09d('0x15')]===0x1f4){logger[_0xd09d('0x14')](_0xd09d('0x10'),_0x2d4469,_0x2a26f7[_0xd09d('0x14')][_0xd09d('0x16')]);return _0x37a525(_0x2a26f7['error'][_0xd09d('0x16')]);}logger['error']('License,\x20%s,\x20%s',_0x2d4469,_0x2a26f7['error'][_0xd09d('0x16')]);return _0x3e062b(_0x2a26f7[_0xd09d('0x14')][_0xd09d('0x16')]);}else{logger[_0xd09d('0x17')](_0xd09d('0x10'),_0x2d4469,'request\x20sent');_0x3e062b(_0x2a26f7[_0xd09d('0x18')][_0xd09d('0x16')]);}})['catch'](function(_0x1cb21d){logger['error'](_0xd09d('0x10'),_0x2d4469,_0x1cb21d);_0x37a525(_0x1cb21d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 1986e47..b2f1141 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 _0xed1f=['util','express','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/canned_answers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','getAgents','post','/:id/dispositions','addDisposition','create','addImap','/:id/out_servers','addInteraction','addApplications','send','/:id/users','addAgents','/:id','update','removeDispositions','delete','removeImap','removeSmtp','removeAgents','exports','multer'];(function(_0x259c8c,_0x2e76cf){var _0x5f49f3=function(_0xbead04){while(--_0xbead04){_0x259c8c['push'](_0x259c8c['shift']());}};_0x5f49f3(++_0x2e76cf);}(_0xed1f,0x170));var _0xfed1=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xed1f[_0x580647];return _0x5f0792;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfed1('0x2'));var router=express['Router']();var auth=require(_0xfed1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfed1('0x4'));var controller=require(_0xfed1('0x5'));router[_0xfed1('0x6')]('/',auth[_0xfed1('0x7')](),controller[_0xfed1('0x8')]);router[_0xfed1('0x6')](_0xfed1('0x9'),auth[_0xfed1('0x7')](),controller[_0xfed1('0xa')]);router[_0xfed1('0x6')]('/:id',auth[_0xfed1('0x7')](),controller[_0xfed1('0xb')]);router[_0xfed1('0x6')]('/:id/dispositions',auth[_0xfed1('0x7')](),controller['getDispositions']);router['get'](_0xfed1('0xc'),auth[_0xfed1('0x7')](),controller['getAnswers']);router['get'](_0xfed1('0xd'),auth[_0xfed1('0x7')](),controller['getImap']);router[_0xfed1('0x6')]('/:id/out_servers',auth[_0xfed1('0x7')](),controller[_0xfed1('0xe')]);router[_0xfed1('0x6')](_0xfed1('0xf'),auth['isAuthenticated'](),controller[_0xfed1('0x10')]);router[_0xfed1('0x6')]('/:id/applications',auth['isAuthenticated'](),controller[_0xfed1('0x11')]);router[_0xfed1('0x6')](_0xfed1('0x12'),auth['isAuthenticated'](),controller[_0xfed1('0x13')]);router[_0xfed1('0x6')](_0xfed1('0x14'),auth[_0xfed1('0x7')](),controller['verifySmtp']);router[_0xfed1('0x6')]('/:id/users',auth[_0xfed1('0x7')](),controller[_0xfed1('0x15')]);router[_0xfed1('0x16')](_0xfed1('0x17'),auth[_0xfed1('0x7')](),controller[_0xfed1('0x18')]);router[_0xfed1('0x16')](_0xfed1('0xc'),auth[_0xfed1('0x7')](),controller['addAnswer']);router[_0xfed1('0x16')]('/',auth['isAuthenticated'](),controller[_0xfed1('0x19')]);router[_0xfed1('0x16')](_0xfed1('0xd'),auth[_0xfed1('0x7')](),controller[_0xfed1('0x1a')]);router[_0xfed1('0x16')](_0xfed1('0x1b'),auth[_0xfed1('0x7')](),controller['addSmtp']);router['post'](_0xfed1('0xf'),auth['isAuthenticated'](),controller[_0xfed1('0x1c')]);router[_0xfed1('0x16')]('/:id/applications',auth[_0xfed1('0x7')](),controller[_0xfed1('0x1d')]);router[_0xfed1('0x16')]('/:id/send',auth[_0xfed1('0x7')](),controller[_0xfed1('0x1e')]);router['post'](_0xfed1('0x1f'),auth[_0xfed1('0x7')](),controller[_0xfed1('0x20')]);router['put'](_0xfed1('0x21'),auth[_0xfed1('0x7')](),controller[_0xfed1('0x22')]);router['delete'](_0xfed1('0x17'),auth[_0xfed1('0x7')](),controller[_0xfed1('0x23')]);router[_0xfed1('0x24')](_0xfed1('0xc'),auth[_0xfed1('0x7')](),controller['removeAnswers']);router[_0xfed1('0x24')](_0xfed1('0xd'),auth['isAuthenticated'](),controller[_0xfed1('0x25')]);router[_0xfed1('0x24')](_0xfed1('0x1b'),auth['isAuthenticated'](),controller[_0xfed1('0x26')]);router[_0xfed1('0x24')](_0xfed1('0x21'),auth[_0xfed1('0x7')](),controller['destroy']);router[_0xfed1('0x24')](_0xfed1('0x1f'),auth[_0xfed1('0x7')](),controller[_0xfed1('0x27')]);module[_0xfed1('0x28')]=router; \ No newline at end of file +var _0xb2ad=['/:id','show','getDispositions','getAnswers','getImap','getSmtp','/:id/interactions','/:id/messages','/:id/verify','verifySmtp','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','/:id/dispositions','removeDispositions','removeAnswers','/:id/in_servers','removeImap','removeSmtp','destroy','/:id/users','removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','describe'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb2ad,0x16d));var _0xdb2a=function(_0x1b50b7,_0x30f75d){_0x1b50b7=_0x1b50b7-0x0;var _0x413f3f=_0xb2ad[_0x1b50b7];return _0x413f3f;};'use strict';var multer=require('multer');var util=require(_0xdb2a('0x0'));var path=require('path');var timeout=require(_0xdb2a('0x1'));var express=require(_0xdb2a('0x2'));var router=express[_0xdb2a('0x3')]();var auth=require(_0xdb2a('0x4'));var interaction=require(_0xdb2a('0x5'));var config=require('../../config/environment');var controller=require(_0xdb2a('0x6'));router[_0xdb2a('0x7')]('/',auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x9')]);router[_0xdb2a('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xdb2a('0xa')]);router[_0xdb2a('0x7')](_0xdb2a('0xb'),auth['isAuthenticated'](),controller[_0xdb2a('0xc')]);router[_0xdb2a('0x7')]('/:id/dispositions',auth[_0xdb2a('0x8')](),controller[_0xdb2a('0xd')]);router['get']('/:id/canned_answers',auth[_0xdb2a('0x8')](),controller[_0xdb2a('0xe')]);router[_0xdb2a('0x7')]('/:id/in_servers',auth[_0xdb2a('0x8')](),controller[_0xdb2a('0xf')]);router['get']('/:id/out_servers',auth['isAuthenticated'](),controller[_0xdb2a('0x10')]);router['get'](_0xdb2a('0x11'),auth[_0xdb2a('0x8')](),controller['getInteractions']);router[_0xdb2a('0x7')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get'](_0xdb2a('0x12'),auth[_0xdb2a('0x8')](),controller['getMessages']);router['get'](_0xdb2a('0x13'),auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x14')]);router[_0xdb2a('0x7')]('/:id/users',auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x15')]);router[_0xdb2a('0x16')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xdb2a('0x17')]);router[_0xdb2a('0x16')](_0xdb2a('0x18'),auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x19')]);router['post']('/',auth[_0xdb2a('0x8')](),controller['create']);router[_0xdb2a('0x16')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xdb2a('0x1a')]);router[_0xdb2a('0x16')](_0xdb2a('0x1b'),auth['isAuthenticated'](),controller[_0xdb2a('0x1c')]);router[_0xdb2a('0x16')](_0xdb2a('0x11'),auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x1d')]);router[_0xdb2a('0x16')]('/:id/applications',auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x1e')]);router['post'](_0xdb2a('0x1f'),auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x20')]);router[_0xdb2a('0x16')]('/:id/users',auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x21')]);router[_0xdb2a('0x22')](_0xdb2a('0xb'),auth['isAuthenticated'](),controller[_0xdb2a('0x23')]);router[_0xdb2a('0x24')](_0xdb2a('0x25'),auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x26')]);router['delete'](_0xdb2a('0x18'),auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x27')]);router[_0xdb2a('0x24')](_0xdb2a('0x28'),auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x29')]);router[_0xdb2a('0x24')](_0xdb2a('0x1b'),auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x2a')]);router[_0xdb2a('0x24')](_0xdb2a('0xb'),auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x2b')]);router[_0xdb2a('0x24')](_0xdb2a('0x2c'),auth[_0xdb2a('0x8')](),controller[_0xdb2a('0x2d')]);module[_0xdb2a('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 6c9f4f6..d4a74f0 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 _0x472d=['sequelize','exports','STRING','TEXT','BOOLEAN','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0xb2f448,_0x126578){var _0xd56eb6=function(_0x4e5a02){while(--_0x4e5a02){_0xb2f448['push'](_0xb2f448['shift']());}};_0xd56eb6(++_0x126578);}(_0x472d,0x90));var _0xd472=function(_0x1ddd50,_0x53ba65){_0x1ddd50=_0x1ddd50-0x0;var _0x3d84bd=_0x472d[_0x1ddd50];return _0x3d84bd;};'use strict';var Sequelize=require(_0xd472('0x0'));module[_0xd472('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xd472('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xd472('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xd472('0x3')]},'markAsUnread':{'type':Sequelize[_0xd472('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd472('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xd472('0x5')](0x2)[_0xd472('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd472('0x3')],'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[_0xd472('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd472('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd472('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd472('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd472('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd472('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xd472('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd472('0x8'),'set':function(_0x3fc746){if(!_0x3fc746)this[_0xd472('0x9')](_0xd472('0xa'),null);this[_0xd472('0x9')](_0xd472('0xb'),_0x3fc746);}}}; \ No newline at end of file +var _0x1686=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x161c58,_0x1cc949){var _0x2e6a19=function(_0x571630){while(--_0x571630){_0x161c58['push'](_0x161c58['shift']());}};_0x2e6a19(++_0x1cc949);}(_0x1686,0x1a4));var _0x6168=function(_0x4c0261,_0xc591ca){_0x4c0261=_0x4c0261-0x0;var _0x484ae0=_0x1686[_0x4c0261];return _0x484ae0;};'use strict';var Sequelize=require(_0x6168('0x0'));module[_0x6168('0x1')]={'description':{'type':Sequelize[_0x6168('0x2')]},'name':{'type':Sequelize[_0x6168('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x6168('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6168('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x6168('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x6168('0x4')]},'markAsUnread':{'type':Sequelize[_0x6168('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6168('0x2')],'allowNull':![],'defaultValue':_0x6168('0x5')},'fontSize':{'type':Sequelize[_0x6168('0x6')](0x2)[_0x6168('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6168('0x8');}},'notificationSound':{'type':Sequelize[_0x6168('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6168('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6168('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6168('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6168('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6168('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x6168('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x6168('0x3')],'defaultValue':![],'comment':_0x6168('0xa'),'set':function(_0x4ea993){if(!_0x4ea993)this['setDataValue'](_0x6168('0xb'),null);this[_0x6168('0xc')]('mandatoryDisposition',_0x4ea993);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 7875202..2d6f881 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 _0x0260=['jsforce','desk.js','querystring','papaparse','html-to-text','../../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','register','client','http','then','info','request\x20sent','debug','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','MailAccounts','UserProfileResource','status','stack','name','send','index','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','includeAll','body','find','Pause','MailServerIn','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rows','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','ListId','active','description','isNil','cservice','cauthentication','user','password','pass','cpassword','authentication','host','port','service','cuser','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','Contact','User','fullname','internal','Tags','color','tag','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmContact','Contacts','updatedAt','DESC','from','attachments','join','root','server/files/attachments','basename','secure','auth','List\x20not\x20found','List','subject','attach','out','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto'];(function(_0x5386c3,_0x4471a2){var _0x2cfc1f=function(_0x2c091d){while(--_0x2c091d){_0x5386c3['push'](_0x5386c3['shift']());}};_0x2cfc1f(++_0x4471a2);}(_0x0260,0x178));var _0x0026=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x0260[_0x486f4a];return _0x135d99;};'use strict';var pdf=require(_0x0026('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0026('0x1'));var rp=require(_0x0026('0x2'));var moment=require(_0x0026('0x3'));var BPromise=require(_0x0026('0x4'));var Mustache=require(_0x0026('0x5'));var util=require('util');var path=require(_0x0026('0x6'));var sox=require(_0x0026('0x7'));var csv=require(_0x0026('0x8'));var ejs=require(_0x0026('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0026('0xa'));var crypto=require(_0x0026('0xb'));var jsforce=require(_0x0026('0xc'));var deskjs=require(_0x0026('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0026('0xe'));var Papa=require(_0x0026('0xf'));var htmlToText=require(_0x0026('0x10'));var juice=require('juice');var Redis=require('ioredis');var authService=require(_0x0026('0x11'));var qs=require(_0x0026('0x12'));var as=require(_0x0026('0x13'));var hardwareService=require(_0x0026('0x14'));var logger=require('../../config/logger')(_0x0026('0x15'));var utils=require(_0x0026('0x16'));var config=require(_0x0026('0x17'));var licenseUtil=require(_0x0026('0x18'));var db=require(_0x0026('0x19'))['db'];config[_0x0026('0x1a')]=_[_0x0026('0x1b')](config[_0x0026('0x1a')],{'host':_0x0026('0x1c'),'port':0x18eb});var socket=require(_0x0026('0x1d'))(new Redis(config['redis']));require(_0x0026('0x1e'))[_0x0026('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0026('0x20')][_0x0026('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x465baf,_0x2dc6e3,_0x21749c,_0x27d496){return new BPromise(function(_0x227435,_0x2423a4){var _0x150309=_0x27d496||client;return _0x150309['request'](_0x465baf,_0x21749c)[_0x0026('0x22')](function(_0x5495c7){logger[_0x0026('0x23')]('MailAccount,\x20%s,\x20%s',_0x2dc6e3,_0x0026('0x24'));logger[_0x0026('0x25')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2dc6e3,_0x0026('0x24'),JSON[_0x0026('0x26')](_0x5495c7));if(_0x5495c7[_0x0026('0x27')]){if(_0x5495c7[_0x0026('0x27')][_0x0026('0x28')]===0x1f4){logger[_0x0026('0x27')](_0x0026('0x29'),_0x2dc6e3,_0x5495c7[_0x0026('0x27')]['message']);return _0x2423a4(_0x5495c7[_0x0026('0x27')][_0x0026('0x2a')]);}logger['error'](_0x0026('0x29'),_0x2dc6e3,_0x5495c7['error'][_0x0026('0x2a')]);return _0x227435(_0x5495c7[_0x0026('0x27')]['message']);}else{logger[_0x0026('0x23')](_0x0026('0x29'),_0x2dc6e3,'request\x20sent');_0x227435(_0x5495c7[_0x0026('0x2b')][_0x0026('0x2a')]);}})[_0x0026('0x2c')](function(_0x3028e1){logger[_0x0026('0x27')](_0x0026('0x29'),_0x2dc6e3,_0x3028e1);_0x2423a4(_0x3028e1);});});}function respondWithStatusCode(_0x2e0d6c,_0x4b8f5f){_0x4b8f5f=_0x4b8f5f||0xcc;return function(_0x48dbb8){if(_0x48dbb8){return _0x2e0d6c[_0x0026('0x2d')](_0x4b8f5f);}return _0x2e0d6c['status'](_0x4b8f5f)[_0x0026('0x2e')]();};}function respondWithResult(_0x5639f4,_0x22c8d8){_0x22c8d8=_0x22c8d8||0xc8;return function(_0x9c6bb3){if(_0x9c6bb3){return _0x5639f4['status'](_0x22c8d8)[_0x0026('0x2f')](_0x9c6bb3);}};}function respondWithFilteredResult(_0x514b3c,_0x123cfe){return function(_0x4bb743){if(_0x4bb743){var _0xc4c2d2=_0x4bb743[_0x0026('0x30')],_0xce7d87=_0x123cfe[_0x0026('0x31')],_0x84fa1d=_0x123cfe[_0x0026('0x31')]+_0x123cfe[_0x0026('0x32')],_0x10b679;if(_0x84fa1d>=_0xc4c2d2){_0x84fa1d=_0xc4c2d2;_0x10b679=0xc8;}else{_0x10b679=0xce;}_0x514b3c['status'](_0x10b679);return _0x514b3c[_0x0026('0x33')](_0x0026('0x34'),_0xce7d87+'-'+_0x84fa1d+'/'+_0xc4c2d2)['json'](_0x4bb743);}return null;};}function patchUpdates(_0x160e10){return function(_0x151a2f){try{jsonpatch['apply'](_0x151a2f,_0x160e10,!![]);}catch(_0x285b47){return BPromise[_0x0026('0x35')](_0x285b47);}return _0x151a2f[_0x0026('0x36')]();};}function saveUpdates(_0x5b02ee,_0x2530cd){return function(_0x2b8b13){if(_0x2b8b13){return _0x2b8b13[_0x0026('0x37')](_0x5b02ee)['then'](function(_0x107458){return _0x107458;});}return null;};}function removeEntity(_0x11b22e,_0xd17cf1){return function(_0xab74c){if(_0xab74c){return _0xab74c[_0x0026('0x38')]()[_0x0026('0x22')](function(){var _0x151da7=_0xab74c['get']({'plain':!![]});var _0x36f752=_0x0026('0x39');return db[_0x0026('0x3a')]['destroy']({'where':{'type':_0x36f752,'resourceId':_0x151da7['id']}})[_0x0026('0x22')](function(){return _0xab74c;});})[_0x0026('0x22')](function(){_0x11b22e[_0x0026('0x3b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x349edf,_0x3a39bc){return function(_0x10c924){if(!_0x10c924){_0x349edf[_0x0026('0x2d')](0x194);}return _0x10c924;};}function handleError(_0x50763d,_0x364fe0){_0x364fe0=_0x364fe0||0x1f4;return function(_0x355213){logger['error'](_0x355213[_0x0026('0x3c')]);if(_0x355213['name']){delete _0x355213[_0x0026('0x3d')];}_0x50763d[_0x0026('0x3b')](_0x364fe0)[_0x0026('0x3e')](_0x355213);};}exports[_0x0026('0x3f')]=function(_0x342011,_0x4020c4){var _0x2857e1={'include':[{'model':db['MailServerIn'],'as':_0x0026('0x40')},{'model':db[_0x0026('0x41')],'as':_0x0026('0x42')},{'model':db['Pause'],'as':_0x0026('0x43')}]},_0xbed32e={},_0x359510={'count':0x0,'rows':[]};var _0x3d7d30=_[_0x0026('0x44')](db[_0x0026('0x45')][_0x0026('0x46')],function(_0x57b76c){return{'name':_0x57b76c[_0x0026('0x47')],'type':_0x57b76c[_0x0026('0x48')][_0x0026('0x49')]};});_0xbed32e[_0x0026('0x4a')]=_[_0x0026('0x44')](_0x3d7d30,'name');_0xbed32e[_0x0026('0x4b')]=_[_0x0026('0x4c')](_0x342011[_0x0026('0x4b')]);_0xbed32e[_0x0026('0x4d')]=_[_0x0026('0x4e')](_0xbed32e[_0x0026('0x4a')],_0xbed32e[_0x0026('0x4b')]);_0x2857e1['attributes']=_['intersection'](_0xbed32e['model'],qs[_0x0026('0x4f')](_0x342011[_0x0026('0x4b')][_0x0026('0x4f')]));_0x2857e1[_0x0026('0x50')]=_0x2857e1[_0x0026('0x50')][_0x0026('0x51')]?_0x2857e1['attributes']:_0xbed32e['model'];if(!_0x342011[_0x0026('0x4b')][_0x0026('0x52')](_0x0026('0x53'))){_0x2857e1[_0x0026('0x32')]=qs[_0x0026('0x32')](_0x342011['query'][_0x0026('0x32')]);_0x2857e1['offset']=qs[_0x0026('0x31')](_0x342011[_0x0026('0x4b')]['offset']);}_0x2857e1[_0x0026('0x54')]=qs[_0x0026('0x55')](_0x342011[_0x0026('0x4b')][_0x0026('0x55')]);_0x2857e1[_0x0026('0x56')]=qs[_0x0026('0x4d')](_[_0x0026('0x57')](_0x342011['query'],_0xbed32e[_0x0026('0x4d')]),_0x3d7d30);if(_0x342011[_0x0026('0x4b')][_0x0026('0x58')]){_0x2857e1[_0x0026('0x56')]=_[_0x0026('0x59')](_0x2857e1[_0x0026('0x56')],{'$or':_[_0x0026('0x44')](_0x3d7d30,function(_0x1e877e){if(_0x1e877e[_0x0026('0x48')]!==_0x0026('0x5a')){var _0x35236c={};_0x35236c[_0x1e877e[_0x0026('0x3d')]]={'$like':'%'+_0x342011[_0x0026('0x4b')]['filter']+'%'};return _0x35236c;}})});}_0x2857e1=_[_0x0026('0x59')]({},_0x2857e1,_0x342011[_0x0026('0x5b')]);var _0x288677={'where':_0x2857e1[_0x0026('0x56')]};return db[_0x0026('0x45')][_0x0026('0x30')](_0x288677)[_0x0026('0x22')](function(_0x49cdb6){_0x359510[_0x0026('0x30')]=_0x49cdb6;if(_0x342011[_0x0026('0x4b')]['includeAll']){_0x2857e1[_0x0026('0x5c')]=[{'all':!![]}];}return db[_0x0026('0x45')][_0x0026('0x5d')](_0x2857e1);})['then'](function(_0x5363aa){_0x359510['rows']=_0x5363aa;return _0x359510;})['then'](respondWithFilteredResult(_0x4020c4,_0x2857e1))['catch'](handleError(_0x4020c4,null));};exports[_0x0026('0x5e')]=function(_0x20c7a5,_0x16ecb7){var _0x664f4c={'raw':![],'where':{'id':_0x20c7a5[_0x0026('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x0026('0x42')},{'model':db['Pause'],'as':_0x0026('0x43')}]},_0x45bda0={};_0x45bda0[_0x0026('0x4a')]=_['keys'](db['MailAccount']['rawAttributes']);_0x45bda0[_0x0026('0x4b')]=_['keys'](_0x20c7a5[_0x0026('0x4b')]);_0x45bda0[_0x0026('0x4d')]=_['intersection'](_0x45bda0[_0x0026('0x4a')],_0x45bda0[_0x0026('0x4b')]);_0x664f4c[_0x0026('0x50')]=_[_0x0026('0x4e')](_0x45bda0[_0x0026('0x4a')],qs[_0x0026('0x4f')](_0x20c7a5[_0x0026('0x4b')][_0x0026('0x4f')]));_0x664f4c[_0x0026('0x50')]=_0x664f4c[_0x0026('0x50')]['length']?_0x664f4c[_0x0026('0x50')]:_0x45bda0[_0x0026('0x4a')];if(_0x20c7a5[_0x0026('0x4b')][_0x0026('0x60')]){_0x664f4c[_0x0026('0x5c')]=[{'all':!![]}];}_0x664f4c=_[_0x0026('0x59')]({},_0x664f4c,_0x20c7a5[_0x0026('0x5b')]);return db['MailAccount']['find'](_0x664f4c)[_0x0026('0x22')](handleEntityNotFound(_0x16ecb7,null))[_0x0026('0x22')](respondWithResult(_0x16ecb7,null))['catch'](handleError(_0x16ecb7,null));};exports['update']=function(_0x36e7ac,_0x116dd3){if(_0x36e7ac[_0x0026('0x61')]['id']){delete _0x36e7ac[_0x0026('0x61')]['id'];}return db[_0x0026('0x45')][_0x0026('0x62')]({'where':{'id':_0x36e7ac[_0x0026('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x0026('0x40')},{'model':db['MailServerOut'],'as':_0x0026('0x42')},{'model':db[_0x0026('0x63')],'as':_0x0026('0x43')}]})[_0x0026('0x22')](handleEntityNotFound(_0x116dd3,null))[_0x0026('0x22')](saveUpdates(_0x36e7ac[_0x0026('0x61')],null))['then'](function(_0x4bf396){if(_0x4bf396&&_0x36e7ac[_0x0026('0x61')][_0x0026('0x40')]){return db[_0x0026('0x64')][_0x0026('0x37')](_0x36e7ac['body'][_0x0026('0x40')],{'where':{'MailAccountId':_0x4bf396['id']}})[_0x0026('0x22')](function(){return _0x4bf396;});}return _0x4bf396;})[_0x0026('0x22')](function(_0x221ba2){if(_0x221ba2&&_0x36e7ac['body']['Smtp']){return db[_0x0026('0x41')][_0x0026('0x37')](_0x36e7ac[_0x0026('0x61')][_0x0026('0x42')],{'where':{'MailAccountId':_0x221ba2['id']}})[_0x0026('0x22')](function(){return _0x221ba2;});}return _0x221ba2;})[_0x0026('0x22')](respondWithResult(_0x116dd3,null))['catch'](handleError(_0x116dd3,null));};exports['describe']=function(_0x571bdb,_0x45b4e2){return db[_0x0026('0x45')][_0x0026('0x65')]()[_0x0026('0x22')](respondWithResult(_0x45b4e2,null))['catch'](handleError(_0x45b4e2,null));};exports[_0x0026('0x66')]=function(_0x2095cd,_0x4e42ad,_0x17a583){if(_0x2095cd[_0x0026('0x61')]['id']){delete _0x2095cd[_0x0026('0x61')]['id'];}return db['MailAccount'][_0x0026('0x62')]({'where':{'id':_0x2095cd[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x4e42ad,null))[_0x0026('0x22')](function(_0x41cab0){if(_0x41cab0){_0x2095cd['body'][_0x0026('0x67')]=_0x41cab0['id'];return db[_0x0026('0x68')][_0x0026('0x69')](_0x2095cd[_0x0026('0x61')]);}})[_0x0026('0x22')](respondWithResult(_0x4e42ad,null))[_0x0026('0x2c')](handleError(_0x4e42ad,null));};exports[_0x0026('0x6a')]=function(_0x39e83b,_0x57fa9c,_0x208517){var _0x5ab7c1={'raw':![],'where':{}};var _0x541ecd={};var _0x504df7={'count':0x0,'rows':[]};return db[_0x0026('0x45')][_0x0026('0x6b')]({'where':{'id':_0x39e83b[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x57fa9c,null))[_0x0026('0x22')](function(_0x2d740e){if(_0x2d740e){_0x541ecd[_0x0026('0x4a')]=_['keys'](db[_0x0026('0x68')]['rawAttributes']);_0x541ecd[_0x0026('0x4b')]=_[_0x0026('0x4c')](_0x39e83b[_0x0026('0x4b')]);_0x541ecd['filters']=_[_0x0026('0x4e')](_0x541ecd[_0x0026('0x4a')],_0x541ecd[_0x0026('0x4b')]);_0x5ab7c1['attributes']=_[_0x0026('0x4e')](_0x541ecd[_0x0026('0x4a')],qs[_0x0026('0x4f')](_0x39e83b['query'][_0x0026('0x4f')]));_0x5ab7c1['attributes']=_0x5ab7c1[_0x0026('0x50')][_0x0026('0x51')]?_0x5ab7c1[_0x0026('0x50')]:_0x541ecd['model'];if(!_0x39e83b[_0x0026('0x4b')]['hasOwnProperty'](_0x0026('0x53'))){_0x5ab7c1['limit']=qs[_0x0026('0x32')](_0x39e83b[_0x0026('0x4b')]['limit']);_0x5ab7c1['offset']=qs['offset'](_0x39e83b[_0x0026('0x4b')][_0x0026('0x31')]);}_0x5ab7c1['order']=qs[_0x0026('0x55')](_0x39e83b[_0x0026('0x4b')]['sort']);_0x5ab7c1[_0x0026('0x56')]=qs[_0x0026('0x4d')](_['pick'](_0x39e83b[_0x0026('0x4b')],_0x541ecd[_0x0026('0x4d')]));_0x5ab7c1[_0x0026('0x56')][_0x0026('0x67')]=_0x2d740e['id'];if(_0x39e83b[_0x0026('0x4b')]['filter']){_0x5ab7c1['where']=_[_0x0026('0x59')](_0x5ab7c1['where'],{'$or':_[_0x0026('0x44')](_0x5ab7c1[_0x0026('0x50')],function(_0x39bd25){var _0x379819={};_0x379819[_0x39bd25]={'$like':'%'+_0x39e83b[_0x0026('0x4b')][_0x0026('0x58')]+'%'};return _0x379819;})});}_0x5ab7c1=_[_0x0026('0x59')]({},_0x5ab7c1,_0x39e83b[_0x0026('0x5b')]);return db[_0x0026('0x68')][_0x0026('0x30')]({'where':_0x5ab7c1['where']})['then'](function(_0x536bd6){_0x504df7[_0x0026('0x30')]=_0x536bd6;if(_0x39e83b[_0x0026('0x4b')][_0x0026('0x60')]){_0x5ab7c1['include']=[{'all':!![]}];}return db[_0x0026('0x68')][_0x0026('0x5d')](_0x5ab7c1);})[_0x0026('0x22')](function(_0x77125f){_0x504df7[_0x0026('0x6c')]=_0x77125f;return _0x504df7;});}})[_0x0026('0x22')](respondWithFilteredResult(_0x57fa9c,_0x5ab7c1))[_0x0026('0x2c')](handleError(_0x57fa9c,null));};exports['removeDispositions']=function(_0x34c4ae,_0x31b6d3,_0x23a199){return db[_0x0026('0x45')]['find']({'where':{'id':_0x34c4ae[_0x0026('0x5f')]['id']}})['then'](handleEntityNotFound(_0x31b6d3,null))[_0x0026('0x22')](function(_0x5ccacb){if(_0x5ccacb){return _0x5ccacb[_0x0026('0x6d')](_0x34c4ae[_0x0026('0x4b')]['ids']);}})[_0x0026('0x22')](respondWithStatusCode(_0x31b6d3,null))[_0x0026('0x2c')](handleError(_0x31b6d3,null));};exports[_0x0026('0x6e')]=function(_0x19ce79,_0x4bb3a4,_0x274e55){if(_0x19ce79[_0x0026('0x61')]['id']){delete _0x19ce79['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x19ce79['params']['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x4bb3a4,null))[_0x0026('0x22')](function(_0x15fc03){if(_0x15fc03){_0x19ce79[_0x0026('0x61')][_0x0026('0x67')]=_0x15fc03['id'];return db['CannedAnswer'][_0x0026('0x69')](_0x19ce79[_0x0026('0x61')]);}})[_0x0026('0x22')](respondWithResult(_0x4bb3a4,null))[_0x0026('0x2c')](handleError(_0x4bb3a4,null));};exports[_0x0026('0x6f')]=function(_0x5e7f34,_0x1fbb24,_0x3b527d){var _0x412a4f={'raw':![],'where':{}};var _0x13850a={};var _0x39d76f={'count':0x0,'rows':[]};return db[_0x0026('0x45')]['findOne']({'where':{'id':_0x5e7f34[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x1fbb24,null))[_0x0026('0x22')](function(_0x1cd935){if(_0x1cd935){_0x13850a[_0x0026('0x4a')]=_[_0x0026('0x4c')](db[_0x0026('0x70')]['rawAttributes']);_0x13850a[_0x0026('0x4b')]=_[_0x0026('0x4c')](_0x5e7f34[_0x0026('0x4b')]);_0x13850a[_0x0026('0x4d')]=_[_0x0026('0x4e')](_0x13850a[_0x0026('0x4a')],_0x13850a[_0x0026('0x4b')]);_0x412a4f[_0x0026('0x50')]=_[_0x0026('0x4e')](_0x13850a[_0x0026('0x4a')],qs[_0x0026('0x4f')](_0x5e7f34[_0x0026('0x4b')][_0x0026('0x4f')]));_0x412a4f[_0x0026('0x50')]=_0x412a4f[_0x0026('0x50')]['length']?_0x412a4f[_0x0026('0x50')]:_0x13850a[_0x0026('0x4a')];if(!_0x5e7f34[_0x0026('0x4b')][_0x0026('0x52')](_0x0026('0x53'))){_0x412a4f['limit']=qs[_0x0026('0x32')](_0x5e7f34[_0x0026('0x4b')][_0x0026('0x32')]);_0x412a4f[_0x0026('0x31')]=qs[_0x0026('0x31')](_0x5e7f34[_0x0026('0x4b')][_0x0026('0x31')]);}_0x412a4f[_0x0026('0x54')]=qs[_0x0026('0x55')](_0x5e7f34['query'][_0x0026('0x55')]);_0x412a4f[_0x0026('0x56')]=qs[_0x0026('0x4d')](_['pick'](_0x5e7f34[_0x0026('0x4b')],_0x13850a[_0x0026('0x4d')]));_0x412a4f['where']['MailAccountId']=_0x1cd935['id'];if(_0x5e7f34[_0x0026('0x4b')]['filter']){_0x412a4f['where']=_[_0x0026('0x59')](_0x412a4f[_0x0026('0x56')],{'$or':_['map'](_0x412a4f['attributes'],function(_0x34eb61){var _0x45a26a={};_0x45a26a[_0x34eb61]={'$like':'%'+_0x5e7f34['query'][_0x0026('0x58')]+'%'};return _0x45a26a;})});}_0x412a4f=_['merge']({},_0x412a4f,_0x5e7f34[_0x0026('0x5b')]);return db['CannedAnswer']['count']({'where':_0x412a4f[_0x0026('0x56')]})['then'](function(_0x3d7ae4){_0x39d76f[_0x0026('0x30')]=_0x3d7ae4;if(_0x5e7f34['query'][_0x0026('0x60')]){_0x412a4f['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x0026('0x5d')](_0x412a4f);})[_0x0026('0x22')](function(_0x4ccc89){_0x39d76f[_0x0026('0x6c')]=_0x4ccc89;return _0x39d76f;});}})[_0x0026('0x22')](respondWithFilteredResult(_0x1fbb24,_0x412a4f))[_0x0026('0x2c')](handleError(_0x1fbb24,null));};exports[_0x0026('0x71')]=function(_0x20735c,_0x5572cf,_0xc903de){return db['MailAccount'][_0x0026('0x62')]({'where':{'id':_0x20735c['params']['id']}})['then'](handleEntityNotFound(_0x5572cf,null))[_0x0026('0x22')](function(_0x451f21){if(_0x451f21){return _0x451f21['removeAnswers'](_0x20735c[_0x0026('0x4b')][_0x0026('0x72')]);}})[_0x0026('0x22')](respondWithStatusCode(_0x5572cf,null))[_0x0026('0x2c')](handleError(_0x5572cf,null));};exports['create']=function(_0x205cfc,_0x3be841){var _0x232342={'name':_0x205cfc[_0x0026('0x61')][_0x0026('0x3d')],'key':_0x205cfc[_0x0026('0x61')][_0x0026('0x49')],'email':_0x205cfc[_0x0026('0x61')]['email'],'ListId':_0x205cfc[_0x0026('0x61')][_0x0026('0x73')],'active':!_['isNil'](_0x205cfc[_0x0026('0x61')][_0x0026('0x74')])?_0x205cfc[_0x0026('0x61')][_0x0026('0x74')]:!![],'description':_0x205cfc[_0x0026('0x61')][_0x0026('0x75')]||null,'Imap':{},'Smtp':{}};if(_[_0x0026('0x76')](_0x205cfc['body'][_0x0026('0x77')])){if(_0x205cfc[_0x0026('0x61')][_0x0026('0x78')]){_0x232342['Imap'][_0x0026('0x79')]=_0x232342[_0x0026('0x42')][_0x0026('0x79')]=_0x205cfc[_0x0026('0x61')]['cuser'];_0x232342[_0x0026('0x40')][_0x0026('0x7a')]=_0x232342['Smtp'][_0x0026('0x7b')]=_0x205cfc['body'][_0x0026('0x7c')];}else{_0x232342[_0x0026('0x40')][_0x0026('0x7d')]=_0x232342[_0x0026('0x42')][_0x0026('0x7d')]=![];}_0x232342[_0x0026('0x40')][_0x0026('0x7e')]=_0x205cfc[_0x0026('0x61')][_0x0026('0x40')][_0x0026('0x7e')];_0x232342[_0x0026('0x40')][_0x0026('0x7f')]=_0x205cfc['body'][_0x0026('0x40')]['port'];_0x232342[_0x0026('0x42')][_0x0026('0x7e')]=_0x205cfc[_0x0026('0x61')][_0x0026('0x42')][_0x0026('0x7e')];_0x232342[_0x0026('0x42')][_0x0026('0x7f')]=_0x205cfc[_0x0026('0x61')]['Smtp'][_0x0026('0x7f')];}else{_0x232342[_0x0026('0x40')][_0x0026('0x80')]=_0x232342[_0x0026('0x42')][_0x0026('0x80')]=_0x205cfc[_0x0026('0x61')][_0x0026('0x77')];_0x232342['Imap'][_0x0026('0x79')]=_0x232342[_0x0026('0x42')]['user']=_0x205cfc[_0x0026('0x61')][_0x0026('0x81')];_0x232342[_0x0026('0x40')]['password']=_0x232342[_0x0026('0x42')]['pass']=_0x205cfc['body']['cpassword'];}return db[_0x0026('0x45')][_0x0026('0x69')](_0x232342,{'include':[{'model':db[_0x0026('0x41')],'as':'Smtp'},{'model':db[_0x0026('0x64')],'as':_0x0026('0x40')}]})[_0x0026('0x22')](function(_0x51246c){var _0x246945=_0x205cfc['user'][_0x0026('0x82')]({'plain':!![]});if(!_0x246945)throw new Error(_0x0026('0x83'));if(_0x246945[_0x0026('0x84')]===_0x0026('0x79')){var _0x1687c4=_0x51246c[_0x0026('0x82')]({'plain':!![]});return db[_0x0026('0x85')][_0x0026('0x62')]({'where':{'name':'MailAccounts','userProfileId':_0x246945[_0x0026('0x86')]},'raw':!![]})['then'](function(_0x352cb9){if(_0x352cb9&&_0x352cb9[_0x0026('0x87')]===0x0){return db[_0x0026('0x3a')][_0x0026('0x69')]({'name':_0x1687c4['name'],'resourceId':_0x1687c4['id'],'type':_0x352cb9[_0x0026('0x3d')],'sectionId':_0x352cb9['id']},{})[_0x0026('0x22')](function(){return _0x51246c;});}else{return _0x51246c;}})[_0x0026('0x2c')](function(_0x3a89b4){logger[_0x0026('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a89b4);throw _0x3a89b4;});}return _0x51246c;})[_0x0026('0x22')](respondWithResult(_0x3be841,0xc9))[_0x0026('0x2c')](handleError(_0x3be841,null));};exports[_0x0026('0x88')]=function(_0x8bfa18,_0x1c9bab,_0x427a86){return db['MailAccount'][_0x0026('0x6b')]({'where':{'id':_0x8bfa18[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x1c9bab,null))[_0x0026('0x22')](function(_0x4115d5){if(_0x4115d5){return _0x4115d5[_0x0026('0x88')]();}return null;})['then'](respondWithResult(_0x1c9bab,null))[_0x0026('0x2c')](handleError(_0x1c9bab,null));};exports[_0x0026('0x89')]=function(_0x391c25,_0x4da749,_0x2408c9){if(_0x391c25[_0x0026('0x61')]['id']){delete _0x391c25['body']['id'];}return db[_0x0026('0x45')][_0x0026('0x62')]({'where':{'id':_0x391c25[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x4da749,null))[_0x0026('0x22')](function(_0x1e9d88){if(_0x1e9d88){_0x391c25[_0x0026('0x61')][_0x0026('0x67')]=_0x1e9d88['id'];return db[_0x0026('0x64')]['create'](_0x391c25['body']);}})[_0x0026('0x22')](respondWithResult(_0x4da749,null))[_0x0026('0x2c')](handleError(_0x4da749,null));};exports['removeImap']=function(_0x2e6cea,_0x494ee8,_0x3a1999){return db[_0x0026('0x45')][_0x0026('0x6b')]({'where':{'id':_0x2e6cea[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x494ee8,null))[_0x0026('0x22')](function(_0x465a1b){if(_0x465a1b){return _0x465a1b[_0x0026('0x8a')](null);}return null;})[_0x0026('0x22')](respondWithStatusCode(_0x494ee8,null))[_0x0026('0x2c')](handleError(_0x494ee8,null));};exports[_0x0026('0x8b')]=function(_0x355861,_0x3af0e1,_0x15f9ba){return db[_0x0026('0x45')][_0x0026('0x6b')]({'where':{'id':_0x355861[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x3af0e1,null))['then'](function(_0x495abf){if(_0x495abf){return _0x495abf[_0x0026('0x8b')]();}return null;})[_0x0026('0x22')](respondWithResult(_0x3af0e1,null))[_0x0026('0x2c')](handleError(_0x3af0e1,null));};exports['addSmtp']=function(_0x5e079a,_0x2f3abd,_0x6be90d){if(_0x5e079a['body']['id']){delete _0x5e079a[_0x0026('0x61')]['id'];}return db[_0x0026('0x45')]['find']({'where':{'id':_0x5e079a[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x2f3abd,null))[_0x0026('0x22')](function(_0x16049c){if(_0x16049c){_0x5e079a['body'][_0x0026('0x67')]=_0x16049c['id'];return db['MailServerOut'][_0x0026('0x69')](_0x5e079a[_0x0026('0x61')]);}})['then'](respondWithResult(_0x2f3abd,null))[_0x0026('0x2c')](handleError(_0x2f3abd,null));};exports[_0x0026('0x8c')]=function(_0x1c01e3,_0x3d1623,_0x2768bc){return db[_0x0026('0x45')][_0x0026('0x6b')]({'where':{'id':_0x1c01e3[_0x0026('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3d1623,null))['then'](function(_0x4d7307){if(_0x4d7307){return _0x4d7307[_0x0026('0x8d')](null);}return null;})[_0x0026('0x22')](respondWithStatusCode(_0x3d1623,null))[_0x0026('0x2c')](handleError(_0x3d1623,null));};exports[_0x0026('0x8e')]=function(_0x470bd1,_0x319e43,_0x3d4ee9){return db[_0x0026('0x8f')]['find']({'where':{'id':_0x470bd1[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x319e43,null))['then'](function(_0xb9d8a0){if(_0xb9d8a0){return _0xb9d8a0[_0x0026('0x8e')](_0x470bd1[_0x0026('0x61')][_0x0026('0x72')],_[_0x0026('0x90')](_0x470bd1[_0x0026('0x61')],[_0x0026('0x72'),'id'])||{});}})[_0x0026('0x22')](respondWithResult(_0x319e43,null))[_0x0026('0x2c')](handleError(_0x319e43,null));};exports['getInteractions']=function(_0x3e445b,_0x2ad60e,_0x5aea99){var _0xefb5b5={'raw':![],'where':{}};var _0x40c38d={};var _0x1d60ef={'count':0x0,'rows':[]};return db[_0x0026('0x45')]['findOne']({'where':{'id':_0x3e445b['params']['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x2ad60e,null))[_0x0026('0x22')](function(_0x3cc746){if(_0x3cc746){_0x40c38d[_0x0026('0x4a')]=_['keys'](db[_0x0026('0x8f')][_0x0026('0x46')]);_0x40c38d['query']=_[_0x0026('0x4c')](_0x3e445b[_0x0026('0x4b')]);_0x40c38d[_0x0026('0x4d')]=_[_0x0026('0x4e')](_0x40c38d[_0x0026('0x4a')],_0x40c38d[_0x0026('0x4b')]);_0xefb5b5['attributes']=_[_0x0026('0x4e')](_0x40c38d[_0x0026('0x4a')],qs['fields'](_0x3e445b[_0x0026('0x4b')]['fields']));_0xefb5b5[_0x0026('0x50')]=_0xefb5b5[_0x0026('0x50')][_0x0026('0x51')]?_0xefb5b5[_0x0026('0x50')]:_0x40c38d[_0x0026('0x4a')];if(!_0x3e445b['query'][_0x0026('0x52')](_0x0026('0x53'))){_0xefb5b5[_0x0026('0x32')]=qs['limit'](_0x3e445b[_0x0026('0x4b')][_0x0026('0x32')]);_0xefb5b5[_0x0026('0x31')]=qs[_0x0026('0x31')](_0x3e445b[_0x0026('0x4b')]['offset']);}_0xefb5b5[_0x0026('0x54')]=qs[_0x0026('0x55')](_0x3e445b['query']['sort']);_0xefb5b5[_0x0026('0x56')]=qs[_0x0026('0x4d')](_[_0x0026('0x57')](_0x3e445b[_0x0026('0x4b')],_0x40c38d['filters']));_0xefb5b5[_0x0026('0x56')][_0x0026('0x67')]=_0x3cc746['id'];if(_0x3e445b[_0x0026('0x4b')][_0x0026('0x58')]){_0xefb5b5[_0x0026('0x56')]=_[_0x0026('0x59')](_0xefb5b5[_0x0026('0x56')],{'$or':_['map'](_0xefb5b5[_0x0026('0x50')],function(_0x3bc8e5){var _0x2fdcd4={};_0x2fdcd4[_0x3bc8e5]={'$like':'%'+_0x3e445b[_0x0026('0x4b')][_0x0026('0x58')]+'%'};return _0x2fdcd4;})});}_0xefb5b5=_[_0x0026('0x59')]({},_0xefb5b5,_0x3e445b['options']);return db['MailInteraction'][_0x0026('0x30')]({'where':_0xefb5b5[_0x0026('0x56')]})[_0x0026('0x22')](function(_0x380733){_0x1d60ef[_0x0026('0x30')]=_0x380733;if(_0x3e445b[_0x0026('0x4b')][_0x0026('0x60')]){_0xefb5b5['include']=[{'model':db['CmContact'],'as':_0x0026('0x91'),'required':![]},{'model':db[_0x0026('0x92')],'as':'Owner','attributes':[_0x0026('0x3d'),_0x0026('0x93'),_0x0026('0x94')],'required':![]},{'model':db['Tag'],'as':_0x0026('0x95'),'attributes':['id',_0x0026('0x3d'),_0x0026('0x96')],'where':_0x3e445b[_0x0026('0x4b')][_0x0026('0x97')]?{'id':_0x3e445b['query'][_0x0026('0x97')]}:undefined,'required':_0x3e445b[_0x0026('0x4b')][_0x0026('0x97')]?!![]:![]}];}return db[_0x0026('0x8f')][_0x0026('0x5d')](_0xefb5b5);})[_0x0026('0x22')](function(_0x3df93e){_0x1d60ef['rows']=_0x3df93e;return _0x1d60ef;});}})[_0x0026('0x22')](respondWithFilteredResult(_0x2ad60e,_0xefb5b5))[_0x0026('0x2c')](handleError(_0x2ad60e,null));};exports['addApplications']=function(_0x198f8c,_0xbab166,_0x24bea6){return db['MailAccount'][_0x0026('0x6b')]({'where':{'id':_0x198f8c['params']['id']}})[_0x0026('0x22')](handleEntityNotFound(_0xbab166,null))['then'](function(_0x1d2344){if(_0x1d2344){return db[_0x0026('0x98')][_0x0026('0x99')](function(_0x5e42d5){return db[_0x0026('0x9a')][_0x0026('0x38')]({'where':{'MailAccountId':_0x198f8c['params']['id']},'transaction':_0x5e42d5})[_0x0026('0x22')](function(_0x3e31b5){var _0xacaf28=_['map'](_0x198f8c[_0x0026('0x61')],function(_0x50a7e2){_0x50a7e2[_0x0026('0x67')]=_0x198f8c[_0x0026('0x5f')]['id'];return _0x50a7e2;});return db[_0x0026('0x9a')][_0x0026('0x9b')](_0xacaf28,{'transaction':_0x5e42d5});});})['then'](function(){return db[_0x0026('0x9a')][_0x0026('0x9c')]({'where':{'MailAccountId':_0x198f8c[_0x0026('0x5f')]['id']},'order':'priority'});});}})[_0x0026('0x22')](respondWithResult(_0xbab166,null))[_0x0026('0x2c')](handleError(_0xbab166,null));};exports['getApplications']=function(_0x34ea07,_0x3c5d88,_0xf27cb6){var _0x5ca943={};var _0x13c72e={};var _0x3af79c;var _0x347e2e;return db[_0x0026('0x45')][_0x0026('0x6b')]({'where':{'id':_0x34ea07['params']['id']}})['then'](handleEntityNotFound(_0x3c5d88,null))[_0x0026('0x22')](function(_0x3b7594){if(_0x3b7594){_0x3af79c=_0x3b7594;_0x13c72e[_0x0026('0x4a')]=_[_0x0026('0x4c')](db[_0x0026('0x9a')][_0x0026('0x46')]);_0x13c72e['query']=_['keys'](_0x34ea07[_0x0026('0x4b')]);_0x13c72e[_0x0026('0x4d')]=_[_0x0026('0x4e')](_0x13c72e[_0x0026('0x4a')],_0x13c72e[_0x0026('0x4b')]);_0x5ca943[_0x0026('0x50')]=_['intersection'](_0x13c72e['model'],qs[_0x0026('0x4f')](_0x34ea07[_0x0026('0x4b')][_0x0026('0x4f')]));_0x5ca943[_0x0026('0x50')]=_0x5ca943[_0x0026('0x50')]['length']?_0x5ca943[_0x0026('0x50')]:_0x13c72e[_0x0026('0x4a')];_0x5ca943[_0x0026('0x54')]=qs[_0x0026('0x55')](_0x34ea07['query']['sort']);_0x5ca943[_0x0026('0x56')]=qs[_0x0026('0x4d')](_[_0x0026('0x57')](_0x34ea07[_0x0026('0x4b')],_0x13c72e[_0x0026('0x4d')]));if(_0x34ea07['query'][_0x0026('0x58')]){_0x5ca943[_0x0026('0x56')]=_[_0x0026('0x59')](_0x5ca943[_0x0026('0x56')],{'$or':_[_0x0026('0x44')](_0x5ca943[_0x0026('0x50')],function(_0x17b46a){var _0x43be1b={};_0x43be1b[_0x17b46a]={'$like':'%'+_0x34ea07[_0x0026('0x4b')][_0x0026('0x58')]+'%'};return _0x43be1b;})});}_0x5ca943=_[_0x0026('0x59')]({},_0x5ca943,_0x34ea07[_0x0026('0x5b')]);return _0x3af79c[_0x0026('0x9d')](_0x5ca943);}})[_0x0026('0x22')](function(_0x5bb8e7){if(_0x5bb8e7){_0x347e2e=_0x5bb8e7[_0x0026('0x51')];if(!_0x34ea07[_0x0026('0x4b')]['hasOwnProperty']('nolimit')){_0x5ca943[_0x0026('0x32')]=qs[_0x0026('0x32')](_0x34ea07[_0x0026('0x4b')][_0x0026('0x32')]);_0x5ca943[_0x0026('0x31')]=qs[_0x0026('0x31')](_0x34ea07[_0x0026('0x4b')]['offset']);}return _0x3af79c[_0x0026('0x9d')](_0x5ca943);}})[_0x0026('0x22')](function(_0x273e22){if(_0x273e22){return _0x273e22?{'count':_0x347e2e,'rows':_0x273e22}:null;}})[_0x0026('0x22')](respondWithResult(_0x3c5d88,null))['catch'](handleError(_0x3c5d88,null));};exports[_0x0026('0x9e')]=function(_0x94c907,_0x5d9d88,_0x113ff5){var _0x3bae1d={'raw':!![],'where':{}};var _0x24f74f={};var _0x242d50={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x94c907[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x5d9d88,null))['then'](function(_0x3d57ef){if(_0x3d57ef){_0x24f74f['model']=_[_0x0026('0x4c')](db[_0x0026('0x9f')][_0x0026('0x46')]);_0x24f74f[_0x0026('0x4b')]=_[_0x0026('0x4c')](_0x94c907[_0x0026('0x4b')]);_0x24f74f[_0x0026('0x4d')]=_['intersection'](_0x24f74f['model'],_0x24f74f['query']);_0x3bae1d['attributes']=_[_0x0026('0x4e')](_0x24f74f['model'],qs['fields'](_0x94c907[_0x0026('0x4b')][_0x0026('0x4f')]));_0x3bae1d[_0x0026('0x50')]=_0x3bae1d[_0x0026('0x50')]['length']?_0x3bae1d[_0x0026('0x50')]:_0x24f74f[_0x0026('0x4a')];if(!_0x94c907[_0x0026('0x4b')]['hasOwnProperty'](_0x0026('0x53'))){_0x3bae1d[_0x0026('0x32')]=qs[_0x0026('0x32')](_0x94c907[_0x0026('0x4b')][_0x0026('0x32')]);_0x3bae1d[_0x0026('0x31')]=qs[_0x0026('0x31')](_0x94c907[_0x0026('0x4b')][_0x0026('0x31')]);}_0x3bae1d[_0x0026('0x54')]=qs['sort'](_0x94c907[_0x0026('0x4b')][_0x0026('0x55')]);_0x3bae1d[_0x0026('0x56')]=qs[_0x0026('0x4d')](_['pick'](_0x94c907[_0x0026('0x4b')],_0x24f74f[_0x0026('0x4d')]));_0x3bae1d[_0x0026('0x56')][_0x0026('0x67')]=_0x3d57ef['id'];if(_0x94c907[_0x0026('0x4b')][_0x0026('0x58')]){_0x3bae1d[_0x0026('0x56')]=_[_0x0026('0x59')](_0x3bae1d['where'],{'$or':_['map'](_0x3bae1d[_0x0026('0x50')],function(_0x5a177b){var _0x36bbcc={};_0x36bbcc[_0x5a177b]={'$like':'%'+_0x94c907['query'][_0x0026('0x58')]+'%'};return _0x36bbcc;})});}if(_0x94c907['query'][_0x0026('0xa0')]){var _0x4d7c8e=_0x94c907[_0x0026('0x4b')][_0x0026('0xa0')][_0x0026('0xa1')](',');var _0x476df6={};_0x476df6[_0x4d7c8e[0x0]]={'$gte':moment(_0x4d7c8e[0x1])[_0x0026('0xa2')](_0x0026('0xa3'))};_0x3bae1d[_0x0026('0x56')]=_[_0x0026('0x59')](_0x3bae1d['where'],_0x476df6);}_0x3bae1d=_[_0x0026('0x59')]({},_0x3bae1d,_0x94c907[_0x0026('0x5b')]);return db[_0x0026('0x9f')][_0x0026('0x30')]({'where':_0x3bae1d[_0x0026('0x56')]})['then'](function(_0x1d1bd1){_0x242d50[_0x0026('0x30')]=_0x1d1bd1;if(_0x94c907[_0x0026('0x4b')]['includeAll']){_0x3bae1d['include']=[{'all':!![]}];}return db['MailMessage'][_0x0026('0x5d')](_0x3bae1d);})[_0x0026('0x22')](function(_0x1c454d){if(_0x94c907[_0x0026('0x4b')][_0x0026('0xa4')]==='true'){for(var _0x1c0553=0x0;_0x1c0553<_0x1c454d[_0x0026('0x51')];_0x1c0553++){_0x1c454d[_0x1c0553][_0x0026('0x61')]=juice(_0x1c454d[_0x1c0553][_0x0026('0x61')]);}}_0x242d50[_0x0026('0x6c')]=_0x1c454d;return _0x242d50;});}})[_0x0026('0x22')](respondWithFilteredResult(_0x5d9d88,_0x3bae1d))[_0x0026('0x2c')](handleError(_0x5d9d88,null));};exports[_0x0026('0x3e')]=function(_0x55d78c,_0x609188,_0x476070){var _0x142004,_0x20d5d0={},_0x1d6ed8;if(_0x55d78c['body']['to']){_0x1d6ed8=_0x55d78c[_0x0026('0x61')]['to'][_0x0026('0xa1')](',')[0x0];}return db[_0x0026('0x45')][_0x0026('0x62')]({'where':{'id':_0x55d78c[_0x0026('0x5f')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x0026('0xa5')],'as':_0x0026('0xa6'),'where':{'email':_0x1d6ed8},'limit':0x1,'order':[[_0x0026('0xa7'),_0x0026('0xa8')]]}]},{'model':db['MailServerOut'],'as':_0x0026('0x42'),'raw':!![]}]})[_0x0026('0x22')](handleEntityNotFound(_0x609188,null))[_0x0026('0x22')](function(_0x1aafa2){if(_0x1aafa2){_0x142004=_0x1aafa2;if(_0x1aafa2[_0x0026('0x42')]){if(_['isNil'](_0x55d78c[_0x0026('0x61')]['from'])){_0x55d78c[_0x0026('0x61')][_0x0026('0xa9')]=util['format']('%s\x20<%s>',_0x1aafa2[_0x0026('0x3d')],_0x1aafa2['email']||_0x1aafa2[_0x0026('0x42')]['user']);}if(_0x55d78c[_0x0026('0x61')]['attachments']&&_0x55d78c[_0x0026('0x61')][_0x0026('0xaa')][_0x0026('0x51')]){for(var _0xe92f07=0x0;_0xe92f07<_0x55d78c[_0x0026('0x61')]['attachments'][_0x0026('0x51')];_0xe92f07+=0x1){_0x55d78c[_0x0026('0x61')][_0x0026('0xaa')][_0xe92f07]={'filename':_0x55d78c[_0x0026('0x61')]['attachments'][_0xe92f07][_0x0026('0x3d')],'path':path[_0x0026('0xab')](config[_0x0026('0xac')],_0x0026('0xad'),_0x55d78c[_0x0026('0x61')][_0x0026('0xaa')][_0xe92f07][_0x0026('0xae')])};}}var _0x151253={'tls':{'rejectUnauthorized':![]}};if(_[_0x0026('0x76')](_0x1aafa2[_0x0026('0x42')]['service'])){if(_0x1aafa2['Smtp'][_0x0026('0x7d')]){_0x151253['auth']={'user':_0x1aafa2[_0x0026('0x42')][_0x0026('0x79')],'pass':_0x1aafa2[_0x0026('0x42')]['pass']};}_0x151253[_0x0026('0x7e')]=_0x1aafa2[_0x0026('0x42')][_0x0026('0x7e')];_0x151253[_0x0026('0x7f')]=_0x1aafa2[_0x0026('0x42')]['port'];_0x151253[_0x0026('0xaf')]=_0x1aafa2[_0x0026('0x42')][_0x0026('0xaf')];}else{_0x151253['service']=_0x1aafa2[_0x0026('0x42')][_0x0026('0x80')];_0x151253[_0x0026('0xb0')]={'user':_0x1aafa2[_0x0026('0x42')][_0x0026('0x79')],'pass':_0x1aafa2[_0x0026('0x42')]['pass']};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x151253,'message':_0x55d78c[_0x0026('0x61')]});}else{throw new Error(_0x0026('0xb1'));}}})[_0x0026('0x22')](function(_0x51e2cf){if(_0x51e2cf){_0x20d5d0=_0x51e2cf;if(_0x142004['List']){if(_0x142004[_0x0026('0xb2')]['Contacts']['length']){return _0x142004[_0x0026('0xb2')]['Contacts'][0x0];}else{return db['CmContact'][_0x0026('0x69')](_[_0x0026('0x1b')](_0x55d78c[_0x0026('0x61')],{'firstName':_0x55d78c[_0x0026('0x61')]['to'],'email':_0x55d78c[_0x0026('0x61')]['to'],'phone':_0x55d78c[_0x0026('0x61')]['to'],'ListId':_0x142004['ListId']}));}}else{throw new Error(_0x0026('0xb1'));}}})[_0x0026('0x22')](function(_0x1d4c94){if(_0x1d4c94){var _0x59fda1={'UserId':_0x55d78c[_0x0026('0x79')]['id'],'ContactId':_0x1d4c94['id'],'MailAccountId':_0x142004['id'],'inReplyTo':_0x20d5d0['messageId'],'to':_0x55d78c[_0x0026('0x61')]['from'],'cc':_0x55d78c['body']['cc'],'subject':_0x55d78c[_0x0026('0x61')][_0x0026('0xb3')],'attach':_0x55d78c['body'][_0x0026('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x0026('0xa2')](_0x0026('0xa3')),'lastMsgDirection':_0x0026('0xb5'),'lastMsgBody':_0x55d78c[_0x0026('0x61')][_0x0026('0x61')],'Messages':[_[_0x0026('0x59')](_0x55d78c['body'],{'messageId':_0x20d5d0[_0x0026('0xb6')],'sentAt':moment()[_0x0026('0xa2')](_0x0026('0xa3')),'read':!![],'MailAccountId':_0x142004['id'],'UserId':_0x55d78c[_0x0026('0x79')]['id'],'ContactId':_0x1d4c94['id']})]};if(_0x55d78c[_0x0026('0x61')]['Interaction']){_0x59fda1=_[_0x0026('0x59')](_0x59fda1,_0x55d78c[_0x0026('0x61')][_0x0026('0xb7')]);}return db[_0x0026('0x8f')][_0x0026('0x69')](_0x59fda1,{'include':[{'model':db[_0x0026('0x9f')],'as':'Messages'}]});}})[_0x0026('0x22')](respondWithResult(_0x609188,null))[_0x0026('0x2c')](handleError(_0x609188,null));};exports[_0x0026('0xb8')]=function(_0x3943cd,_0x5ee1c4,_0x1cd5cb){return db[_0x0026('0x45')]['find']({'where':{'id':_0x3943cd[_0x0026('0x5f')]['id']},'include':[{'model':db[_0x0026('0x41')],'as':'Smtp','raw':!![]}]})[_0x0026('0x22')](handleEntityNotFound(_0x5ee1c4,null))[_0x0026('0x22')](function(_0x26530d){if(_0x26530d&&_0x26530d['Smtp']){var _0x54e7f1={'id':_0x26530d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x26530d[_0x0026('0x42')][_0x0026('0x80')]){_0x54e7f1[_0x0026('0x80')]=_0x26530d[_0x0026('0x42')][_0x0026('0x80')];}else{_0x54e7f1['host']=_0x26530d[_0x0026('0x42')][_0x0026('0x7e')];_0x54e7f1['port']=_0x26530d['Smtp'][_0x0026('0x7f')];_0x54e7f1[_0x0026('0xaf')]=_0x26530d[_0x0026('0x42')][_0x0026('0xaf')];}if(_0x26530d['Smtp'][_0x0026('0x7d')]){_0x54e7f1[_0x0026('0xb0')]={'user':_0x26530d[_0x0026('0x42')][_0x0026('0x79')],'pass':_0x26530d['Smtp'][_0x0026('0x7b')]};}return respondWithRpcPromise(_0x0026('0xb9'),'verifySmtp',{'account':_0x54e7f1});}})[_0x0026('0x22')](respondWithResult(_0x5ee1c4,null))[_0x0026('0x2c')](handleError(_0x5ee1c4,null));};exports[_0x0026('0x38')]=function(_0xf74f36,_0x5afdc6){return db[_0x0026('0x45')]['find']({'where':{'id':_0xf74f36[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x5afdc6,null))['then'](function(_0x158749){if(_0x158749&&_0x158749['service']){throw new db[(_0x0026('0xba'))]['ValidationError'](_0x0026('0xbb'));}return _0x158749;})[_0x0026('0x22')](removeEntity(_0x5afdc6,null))[_0x0026('0x2c')](handleError(_0x5afdc6,null));};exports[_0x0026('0xbc')]=function(_0x2be024,_0x2bfdb0,_0x2bd531){return db['MailAccount'][_0x0026('0x62')]({'where':{'id':_0x2be024[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x2bfdb0,null))[_0x0026('0x22')](function(_0x4c2fbf){if(_0x4c2fbf){return _0x4c2fbf[_0x0026('0xbc')](_0x2be024[_0x0026('0x61')][_0x0026('0x72')],_[_0x0026('0x90')](_0x2be024[_0x0026('0x61')],[_0x0026('0x72'),'id'])||{})['spread'](function(_0x1aad42){for(var _0x8ed89=0x0;_0x8ed89<_0x2be024[_0x0026('0x61')][_0x0026('0x72')][_0x0026('0x51')];_0x8ed89+=0x1){socket[_0x0026('0xbd')](_0x0026('0xbe'),{'UserId':_0x2be024[_0x0026('0x61')][_0x0026('0x72')][_0x8ed89],'MailAccountId':_0x2be024['params']['id']});}return _0x1aad42;});}})[_0x0026('0x22')](respondWithResult(_0x2bfdb0,null))[_0x0026('0x2c')](handleError(_0x2bfdb0,null));};exports[_0x0026('0xbf')]=function(_0x4ee322,_0x50c3ce,_0x5b1ef9){return db[_0x0026('0x45')][_0x0026('0x62')]({'where':{'id':_0x4ee322[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x50c3ce,null))[_0x0026('0x22')](function(_0x585ad6){if(_0x585ad6){return _0x585ad6[_0x0026('0xbf')](_0x4ee322['query'][_0x0026('0x72')])[_0x0026('0x22')](function(){if(_[_0x0026('0xc0')](_0x4ee322[_0x0026('0x4b')][_0x0026('0x72')])){for(var _0x7923bc=0x0;_0x7923bc<_0x4ee322[_0x0026('0x4b')][_0x0026('0x72')][_0x0026('0x51')];_0x7923bc+=0x1){socket[_0x0026('0xbd')](_0x0026('0xc1'),{'UserId':Number(_0x4ee322['query']['ids'][_0x7923bc]),'MailAccountId':Number(_0x4ee322[_0x0026('0x5f')]['id'])});}}else{socket[_0x0026('0xbd')](_0x0026('0xc1'),{'UserId':Number(_0x4ee322[_0x0026('0x4b')][_0x0026('0x72')]),'MailAccountId':Number(_0x4ee322['params']['id'])});}});}})[_0x0026('0x22')](respondWithStatusCode(_0x50c3ce,null))[_0x0026('0x2c')](handleError(_0x50c3ce,null));};exports['getAgents']=function(_0x1315a1,_0x53eff6,_0x58c92b){var _0x45ef7e={};var _0x5a849f={};var _0x368a6c;var _0x30d321;return db[_0x0026('0x45')][_0x0026('0x6b')]({'where':{'id':_0x1315a1[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x53eff6,null))[_0x0026('0x22')](function(_0x2be9d4){if(_0x2be9d4){_0x368a6c=_0x2be9d4;_0x5a849f[_0x0026('0x4a')]=_[_0x0026('0x4c')](db[_0x0026('0x92')]['rawAttributes']);_0x5a849f[_0x0026('0x4b')]=_[_0x0026('0x4c')](_0x1315a1[_0x0026('0x4b')]);_0x5a849f[_0x0026('0x4d')]=_[_0x0026('0x4e')](_0x5a849f[_0x0026('0x4a')],_0x5a849f[_0x0026('0x4b')]);_0x45ef7e[_0x0026('0x50')]=_[_0x0026('0x4e')](_0x5a849f[_0x0026('0x4a')],qs[_0x0026('0x4f')](_0x1315a1[_0x0026('0x4b')]['fields']));_0x45ef7e[_0x0026('0x50')]=_0x45ef7e[_0x0026('0x50')]['length']?_0x45ef7e[_0x0026('0x50')]:_0x5a849f[_0x0026('0x4a')];_0x45ef7e['order']=qs[_0x0026('0x55')](_0x1315a1[_0x0026('0x4b')][_0x0026('0x55')]);_0x45ef7e[_0x0026('0x56')]=qs[_0x0026('0x4d')](_[_0x0026('0x57')](_0x1315a1[_0x0026('0x4b')],_0x5a849f[_0x0026('0x4d')]));if(_0x1315a1[_0x0026('0x4b')][_0x0026('0x58')]){_0x45ef7e[_0x0026('0x56')]=_['merge'](_0x45ef7e['where'],{'$or':_[_0x0026('0x44')](_0x45ef7e[_0x0026('0x50')],function(_0x37644d){var _0xf4efde={};_0xf4efde[_0x37644d]={'$like':'%'+_0x1315a1['query'][_0x0026('0x58')]+'%'};return _0xf4efde;})});}_0x45ef7e=_[_0x0026('0x59')]({},_0x45ef7e,_0x1315a1[_0x0026('0x5b')]);return _0x368a6c['getAgents'](_0x45ef7e);}})[_0x0026('0x22')](function(_0x5570e4){if(_0x5570e4){_0x30d321=_0x5570e4[_0x0026('0x51')];if(!_0x1315a1[_0x0026('0x4b')][_0x0026('0x52')](_0x0026('0x53'))){_0x45ef7e['limit']=qs[_0x0026('0x32')](_0x1315a1['query'][_0x0026('0x32')]);_0x45ef7e[_0x0026('0x31')]=qs[_0x0026('0x31')](_0x1315a1['query'][_0x0026('0x31')]);}return _0x368a6c['getAgents'](_0x45ef7e);}})[_0x0026('0x22')](function(_0x85aaa0){if(_0x85aaa0){return _0x85aaa0?{'count':_0x30d321,'rows':_0x85aaa0}:null;}})[_0x0026('0x22')](respondWithResult(_0x53eff6,null))['catch'](handleError(_0x53eff6,null));}; \ No newline at end of file +var _0x8152=['api','../../config/environment','../../config/license/util','redis','localhost','./mailAccount.socket','register','jayson/promise','http','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','MailAccounts','UserProfileResource','stack','name','send','MailServerIn','MailServerOut','Pause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','Imap','mandatoryDispositionPause','find','body','Smtp','describe','addDisposition','MailAccountId','Disposition','create','findOne','hasOwnProperty','nolimit','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','email','ListId','active','description','isNil','user','cuser','password','pass','cpassword','authentication','host','port','service','cservice','get','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','tag','addApplications','sequelize','transaction','bulkCreate','MailApplication','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','Contacts','defaults','List\x20not\x20found','messageId','subject','attach','out','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','omit','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','ejs','crypto','desk.js','to-csv','querystring','papaparse','juice','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3d610a,_0x4ee83b){var _0x5352b4=function(_0xd024eb){while(--_0xd024eb){_0x3d610a['push'](_0x3d610a['shift']());}};_0x5352b4(++_0x4ee83b);}(_0x8152,0x16d));var _0x2815=function(_0x4036b8,_0x4e146a){_0x4036b8=_0x4036b8-0x0;var _0xca4660=_0x8152[_0x4036b8];return _0xca4660;};'use strict';var pdf=require(_0x2815('0x0'));var emlformat=require(_0x2815('0x1'));var rimraf=require(_0x2815('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2815('0x3'));var rp=require(_0x2815('0x4'));var moment=require(_0x2815('0x5'));var BPromise=require(_0x2815('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2815('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2815('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2815('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x2815('0xa'));var toCsv=require(_0x2815('0xb'));var querystring=require(_0x2815('0xc'));var Papa=require(_0x2815('0xd'));var htmlToText=require('html-to-text');var juice=require(_0x2815('0xe'));var Redis=require('ioredis');var authService=require(_0x2815('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2815('0x10'));var hardwareService=require(_0x2815('0x11'));var logger=require(_0x2815('0x12'))(_0x2815('0x13'));var utils=require('../../config/utils');var config=require(_0x2815('0x14'));var licenseUtil=require(_0x2815('0x15'));var db=require('../../mysqldb')['db'];config[_0x2815('0x16')]=_['defaults'](config[_0x2815('0x16')],{'host':_0x2815('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2815('0x18'))[_0x2815('0x19')](socket);var jayson=require(_0x2815('0x1a'));var client=jayson['client'][_0x2815('0x1b')]({'port':0x232b});function respondWithRpcPromise(_0x23e7cc,_0x17513e,_0x3a08e1,_0x5371ca){return new BPromise(function(_0x278665,_0x113ee4){var _0x3b3b65=_0x5371ca||client;return _0x3b3b65[_0x2815('0x1c')](_0x23e7cc,_0x3a08e1)[_0x2815('0x1d')](function(_0x5208e1){logger['info']('MailAccount,\x20%s,\x20%s',_0x17513e,_0x2815('0x1e'));logger[_0x2815('0x1f')](_0x2815('0x20'),_0x17513e,_0x2815('0x1e'),JSON[_0x2815('0x21')](_0x5208e1));if(_0x5208e1['error']){if(_0x5208e1[_0x2815('0x22')][_0x2815('0x23')]===0x1f4){logger[_0x2815('0x22')](_0x2815('0x24'),_0x17513e,_0x5208e1[_0x2815('0x22')]['message']);return _0x113ee4(_0x5208e1[_0x2815('0x22')][_0x2815('0x25')]);}logger[_0x2815('0x22')](_0x2815('0x24'),_0x17513e,_0x5208e1[_0x2815('0x22')][_0x2815('0x25')]);return _0x278665(_0x5208e1['error']['message']);}else{logger[_0x2815('0x26')](_0x2815('0x24'),_0x17513e,'request\x20sent');_0x278665(_0x5208e1[_0x2815('0x27')][_0x2815('0x25')]);}})['catch'](function(_0x27f579){logger[_0x2815('0x22')]('MailAccount,\x20%s,\x20%s',_0x17513e,_0x27f579);_0x113ee4(_0x27f579);});});}function respondWithStatusCode(_0x4a93ed,_0xe0a62a){_0xe0a62a=_0xe0a62a||0xcc;return function(_0x1c7004){if(_0x1c7004){return _0x4a93ed[_0x2815('0x28')](_0xe0a62a);}return _0x4a93ed[_0x2815('0x29')](_0xe0a62a)[_0x2815('0x2a')]();};}function respondWithResult(_0x205c57,_0x3e7423){_0x3e7423=_0x3e7423||0xc8;return function(_0x5a68b3){if(_0x5a68b3){return _0x205c57[_0x2815('0x29')](_0x3e7423)[_0x2815('0x2b')](_0x5a68b3);}};}function respondWithFilteredResult(_0xb3ae97,_0x58ac0f){return function(_0x4660ea){if(_0x4660ea){var _0x4868fc=_0x4660ea['count'],_0x453cd1=_0x58ac0f[_0x2815('0x2c')],_0x550d2a=_0x58ac0f['offset']+_0x58ac0f[_0x2815('0x2d')],_0x10fd46;if(_0x550d2a>=_0x4868fc){_0x550d2a=_0x4868fc;_0x10fd46=0xc8;}else{_0x10fd46=0xce;}_0xb3ae97[_0x2815('0x29')](_0x10fd46);return _0xb3ae97[_0x2815('0x2e')](_0x2815('0x2f'),_0x453cd1+'-'+_0x550d2a+'/'+_0x4868fc)[_0x2815('0x2b')](_0x4660ea);}return null;};}function patchUpdates(_0x4a6e8e){return function(_0x187cb0){try{jsonpatch[_0x2815('0x30')](_0x187cb0,_0x4a6e8e,!![]);}catch(_0x4e5a0e){return BPromise['reject'](_0x4e5a0e);}return _0x187cb0[_0x2815('0x31')]();};}function saveUpdates(_0x2f9c37,_0x4256e5){return function(_0x360adf){if(_0x360adf){return _0x360adf[_0x2815('0x32')](_0x2f9c37)[_0x2815('0x1d')](function(_0x4769e5){return _0x4769e5;});}return null;};}function removeEntity(_0x3b1849,_0x541c29){return function(_0x445cd2){if(_0x445cd2){return _0x445cd2[_0x2815('0x33')]()[_0x2815('0x1d')](function(){var _0x220d35=_0x445cd2['get']({'plain':!![]});var _0x1ffde8=_0x2815('0x34');return db[_0x2815('0x35')]['destroy']({'where':{'type':_0x1ffde8,'resourceId':_0x220d35['id']}})['then'](function(){return _0x445cd2;});})[_0x2815('0x1d')](function(){_0x3b1849['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x499faa,_0x1be4ba){return function(_0x5a95a3){if(!_0x5a95a3){_0x499faa[_0x2815('0x28')](0x194);}return _0x5a95a3;};}function handleError(_0x2afc48,_0x26c03c){_0x26c03c=_0x26c03c||0x1f4;return function(_0x4e0167){logger['error'](_0x4e0167[_0x2815('0x36')]);if(_0x4e0167[_0x2815('0x37')]){delete _0x4e0167[_0x2815('0x37')];}_0x2afc48['status'](_0x26c03c)[_0x2815('0x38')](_0x4e0167);};}exports['index']=function(_0x5d9b7f,_0x18650b){var _0x3376d0={'include':[{'model':db[_0x2815('0x39')],'as':'Imap'},{'model':db[_0x2815('0x3a')],'as':'Smtp'},{'model':db[_0x2815('0x3b')],'as':'mandatoryDispositionPause'}]},_0x413271={},_0x28a23a={'count':0x0,'rows':[]};var _0x329378=_[_0x2815('0x3c')](db[_0x2815('0x3d')][_0x2815('0x3e')],function(_0x3e4e77){return{'name':_0x3e4e77[_0x2815('0x3f')],'type':_0x3e4e77[_0x2815('0x40')][_0x2815('0x41')]};});_0x413271[_0x2815('0x42')]=_['map'](_0x329378,_0x2815('0x37'));_0x413271[_0x2815('0x43')]=_[_0x2815('0x44')](_0x5d9b7f[_0x2815('0x43')]);_0x413271[_0x2815('0x45')]=_[_0x2815('0x46')](_0x413271[_0x2815('0x42')],_0x413271[_0x2815('0x43')]);_0x3376d0['attributes']=_[_0x2815('0x46')](_0x413271[_0x2815('0x42')],qs[_0x2815('0x47')](_0x5d9b7f[_0x2815('0x43')][_0x2815('0x47')]));_0x3376d0[_0x2815('0x48')]=_0x3376d0[_0x2815('0x48')][_0x2815('0x49')]?_0x3376d0[_0x2815('0x48')]:_0x413271[_0x2815('0x42')];if(!_0x5d9b7f[_0x2815('0x43')]['hasOwnProperty']('nolimit')){_0x3376d0[_0x2815('0x2d')]=qs['limit'](_0x5d9b7f[_0x2815('0x43')][_0x2815('0x2d')]);_0x3376d0[_0x2815('0x2c')]=qs[_0x2815('0x2c')](_0x5d9b7f[_0x2815('0x43')][_0x2815('0x2c')]);}_0x3376d0[_0x2815('0x4a')]=qs[_0x2815('0x4b')](_0x5d9b7f['query'][_0x2815('0x4b')]);_0x3376d0['where']=qs[_0x2815('0x45')](_[_0x2815('0x4c')](_0x5d9b7f[_0x2815('0x43')],_0x413271[_0x2815('0x45')]),_0x329378);if(_0x5d9b7f[_0x2815('0x43')][_0x2815('0x4d')]){_0x3376d0[_0x2815('0x4e')]=_[_0x2815('0x4f')](_0x3376d0['where'],{'$or':_[_0x2815('0x3c')](_0x329378,function(_0x519b1f){if(_0x519b1f[_0x2815('0x40')]!==_0x2815('0x50')){var _0x4a35b9={};_0x4a35b9[_0x519b1f[_0x2815('0x37')]]={'$like':'%'+_0x5d9b7f[_0x2815('0x43')][_0x2815('0x4d')]+'%'};return _0x4a35b9;}})});}_0x3376d0=_[_0x2815('0x4f')]({},_0x3376d0,_0x5d9b7f[_0x2815('0x51')]);var _0x156324={'where':_0x3376d0[_0x2815('0x4e')]};return db[_0x2815('0x3d')][_0x2815('0x52')](_0x156324)[_0x2815('0x1d')](function(_0x31dcba){_0x28a23a[_0x2815('0x52')]=_0x31dcba;if(_0x5d9b7f[_0x2815('0x43')][_0x2815('0x53')]){_0x3376d0[_0x2815('0x54')]=[{'all':!![]}];}return db[_0x2815('0x3d')][_0x2815('0x55')](_0x3376d0);})[_0x2815('0x1d')](function(_0x4d4755){_0x28a23a['rows']=_0x4d4755;return _0x28a23a;})[_0x2815('0x1d')](respondWithFilteredResult(_0x18650b,_0x3376d0))[_0x2815('0x56')](handleError(_0x18650b,null));};exports[_0x2815('0x57')]=function(_0x547370,_0x5c9b99){var _0x2d1611={'raw':![],'where':{'id':_0x547370[_0x2815('0x58')]['id']},'include':[{'model':db[_0x2815('0x39')],'as':_0x2815('0x59')},{'model':db[_0x2815('0x3a')],'as':'Smtp'},{'model':db[_0x2815('0x3b')],'as':_0x2815('0x5a')}]},_0x5e3f54={};_0x5e3f54[_0x2815('0x42')]=_[_0x2815('0x44')](db['MailAccount'][_0x2815('0x3e')]);_0x5e3f54[_0x2815('0x43')]=_[_0x2815('0x44')](_0x547370['query']);_0x5e3f54[_0x2815('0x45')]=_[_0x2815('0x46')](_0x5e3f54[_0x2815('0x42')],_0x5e3f54[_0x2815('0x43')]);_0x2d1611[_0x2815('0x48')]=_[_0x2815('0x46')](_0x5e3f54['model'],qs['fields'](_0x547370[_0x2815('0x43')]['fields']));_0x2d1611[_0x2815('0x48')]=_0x2d1611[_0x2815('0x48')]['length']?_0x2d1611['attributes']:_0x5e3f54['model'];if(_0x547370['query'][_0x2815('0x53')]){_0x2d1611[_0x2815('0x54')]=[{'all':!![]}];}_0x2d1611=_[_0x2815('0x4f')]({},_0x2d1611,_0x547370[_0x2815('0x51')]);return db[_0x2815('0x3d')][_0x2815('0x5b')](_0x2d1611)[_0x2815('0x1d')](handleEntityNotFound(_0x5c9b99,null))['then'](respondWithResult(_0x5c9b99,null))['catch'](handleError(_0x5c9b99,null));};exports[_0x2815('0x32')]=function(_0x160c1d,_0x239da8){if(_0x160c1d[_0x2815('0x5c')]['id']){delete _0x160c1d[_0x2815('0x5c')]['id'];}return db[_0x2815('0x3d')][_0x2815('0x5b')]({'where':{'id':_0x160c1d[_0x2815('0x58')]['id']},'include':[{'model':db[_0x2815('0x39')],'as':_0x2815('0x59')},{'model':db[_0x2815('0x3a')],'as':'Smtp'},{'model':db[_0x2815('0x3b')],'as':_0x2815('0x5a')}]})[_0x2815('0x1d')](handleEntityNotFound(_0x239da8,null))[_0x2815('0x1d')](saveUpdates(_0x160c1d['body'],null))[_0x2815('0x1d')](function(_0x1f47c5){if(_0x1f47c5&&_0x160c1d[_0x2815('0x5c')][_0x2815('0x59')]){return db[_0x2815('0x39')][_0x2815('0x32')](_0x160c1d[_0x2815('0x5c')]['Imap'],{'where':{'MailAccountId':_0x1f47c5['id']}})[_0x2815('0x1d')](function(){return _0x1f47c5;});}return _0x1f47c5;})[_0x2815('0x1d')](function(_0x17e53d){if(_0x17e53d&&_0x160c1d['body'][_0x2815('0x5d')]){return db['MailServerOut'][_0x2815('0x32')](_0x160c1d['body'][_0x2815('0x5d')],{'where':{'MailAccountId':_0x17e53d['id']}})[_0x2815('0x1d')](function(){return _0x17e53d;});}return _0x17e53d;})[_0x2815('0x1d')](respondWithResult(_0x239da8,null))[_0x2815('0x56')](handleError(_0x239da8,null));};exports[_0x2815('0x5e')]=function(_0xf22f7e,_0x214f66){return db[_0x2815('0x3d')][_0x2815('0x5e')]()['then'](respondWithResult(_0x214f66,null))['catch'](handleError(_0x214f66,null));};exports[_0x2815('0x5f')]=function(_0x6301fd,_0x216201,_0x31aa3f){if(_0x6301fd[_0x2815('0x5c')]['id']){delete _0x6301fd[_0x2815('0x5c')]['id'];}return db[_0x2815('0x3d')][_0x2815('0x5b')]({'where':{'id':_0x6301fd['params']['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x216201,null))[_0x2815('0x1d')](function(_0x475143){if(_0x475143){_0x6301fd[_0x2815('0x5c')][_0x2815('0x60')]=_0x475143['id'];return db[_0x2815('0x61')][_0x2815('0x62')](_0x6301fd['body']);}})[_0x2815('0x1d')](respondWithResult(_0x216201,null))[_0x2815('0x56')](handleError(_0x216201,null));};exports['getDispositions']=function(_0x4a7e5e,_0x55efd3,_0x5b5e3d){var _0x306528={'raw':![],'where':{}};var _0x2d1dba={};var _0x308e01={'count':0x0,'rows':[]};return db[_0x2815('0x3d')][_0x2815('0x63')]({'where':{'id':_0x4a7e5e[_0x2815('0x58')]['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x55efd3,null))[_0x2815('0x1d')](function(_0x3c3e27){if(_0x3c3e27){_0x2d1dba[_0x2815('0x42')]=_[_0x2815('0x44')](db[_0x2815('0x61')][_0x2815('0x3e')]);_0x2d1dba[_0x2815('0x43')]=_[_0x2815('0x44')](_0x4a7e5e[_0x2815('0x43')]);_0x2d1dba[_0x2815('0x45')]=_['intersection'](_0x2d1dba['model'],_0x2d1dba['query']);_0x306528[_0x2815('0x48')]=_['intersection'](_0x2d1dba[_0x2815('0x42')],qs['fields'](_0x4a7e5e[_0x2815('0x43')][_0x2815('0x47')]));_0x306528[_0x2815('0x48')]=_0x306528[_0x2815('0x48')]['length']?_0x306528[_0x2815('0x48')]:_0x2d1dba[_0x2815('0x42')];if(!_0x4a7e5e[_0x2815('0x43')][_0x2815('0x64')](_0x2815('0x65'))){_0x306528[_0x2815('0x2d')]=qs[_0x2815('0x2d')](_0x4a7e5e['query'][_0x2815('0x2d')]);_0x306528['offset']=qs[_0x2815('0x2c')](_0x4a7e5e[_0x2815('0x43')][_0x2815('0x2c')]);}_0x306528[_0x2815('0x4a')]=qs['sort'](_0x4a7e5e[_0x2815('0x43')][_0x2815('0x4b')]);_0x306528[_0x2815('0x4e')]=qs[_0x2815('0x45')](_['pick'](_0x4a7e5e['query'],_0x2d1dba[_0x2815('0x45')]));_0x306528[_0x2815('0x4e')][_0x2815('0x60')]=_0x3c3e27['id'];if(_0x4a7e5e[_0x2815('0x43')][_0x2815('0x4d')]){_0x306528[_0x2815('0x4e')]=_[_0x2815('0x4f')](_0x306528[_0x2815('0x4e')],{'$or':_[_0x2815('0x3c')](_0x306528[_0x2815('0x48')],function(_0x250e88){var _0x1a35e4={};_0x1a35e4[_0x250e88]={'$like':'%'+_0x4a7e5e[_0x2815('0x43')][_0x2815('0x4d')]+'%'};return _0x1a35e4;})});}_0x306528=_[_0x2815('0x4f')]({},_0x306528,_0x4a7e5e[_0x2815('0x51')]);return db[_0x2815('0x61')]['count']({'where':_0x306528[_0x2815('0x4e')]})[_0x2815('0x1d')](function(_0x39c200){_0x308e01[_0x2815('0x52')]=_0x39c200;if(_0x4a7e5e[_0x2815('0x43')][_0x2815('0x53')]){_0x306528['include']=[{'all':!![]}];}return db['Disposition'][_0x2815('0x55')](_0x306528);})['then'](function(_0x13f8be){_0x308e01[_0x2815('0x66')]=_0x13f8be;return _0x308e01;});}})[_0x2815('0x1d')](respondWithFilteredResult(_0x55efd3,_0x306528))[_0x2815('0x56')](handleError(_0x55efd3,null));};exports[_0x2815('0x67')]=function(_0x36592e,_0x404f1b,_0x3a8061){return db[_0x2815('0x3d')][_0x2815('0x5b')]({'where':{'id':_0x36592e['params']['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x404f1b,null))['then'](function(_0x540ae6){if(_0x540ae6){return _0x540ae6['removeDispositions'](_0x36592e[_0x2815('0x43')][_0x2815('0x68')]);}})[_0x2815('0x1d')](respondWithStatusCode(_0x404f1b,null))[_0x2815('0x56')](handleError(_0x404f1b,null));};exports['addAnswer']=function(_0x4b2fc7,_0x5c65cb,_0x448400){if(_0x4b2fc7[_0x2815('0x5c')]['id']){delete _0x4b2fc7[_0x2815('0x5c')]['id'];}return db['MailAccount'][_0x2815('0x5b')]({'where':{'id':_0x4b2fc7[_0x2815('0x58')]['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x5c65cb,null))[_0x2815('0x1d')](function(_0x24123f){if(_0x24123f){_0x4b2fc7[_0x2815('0x5c')]['MailAccountId']=_0x24123f['id'];return db[_0x2815('0x69')][_0x2815('0x62')](_0x4b2fc7[_0x2815('0x5c')]);}})[_0x2815('0x1d')](respondWithResult(_0x5c65cb,null))['catch'](handleError(_0x5c65cb,null));};exports[_0x2815('0x6a')]=function(_0xd9646f,_0x2aa23f,_0x37b07a){var _0x4b0592={'raw':![],'where':{}};var _0x8fe6ca={};var _0x433a4f={'count':0x0,'rows':[]};return db[_0x2815('0x3d')][_0x2815('0x63')]({'where':{'id':_0xd9646f['params']['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x2aa23f,null))[_0x2815('0x1d')](function(_0x441816){if(_0x441816){_0x8fe6ca[_0x2815('0x42')]=_[_0x2815('0x44')](db[_0x2815('0x69')][_0x2815('0x3e')]);_0x8fe6ca[_0x2815('0x43')]=_[_0x2815('0x44')](_0xd9646f['query']);_0x8fe6ca[_0x2815('0x45')]=_[_0x2815('0x46')](_0x8fe6ca[_0x2815('0x42')],_0x8fe6ca['query']);_0x4b0592[_0x2815('0x48')]=_['intersection'](_0x8fe6ca[_0x2815('0x42')],qs['fields'](_0xd9646f[_0x2815('0x43')]['fields']));_0x4b0592[_0x2815('0x48')]=_0x4b0592[_0x2815('0x48')]['length']?_0x4b0592[_0x2815('0x48')]:_0x8fe6ca['model'];if(!_0xd9646f[_0x2815('0x43')]['hasOwnProperty'](_0x2815('0x65'))){_0x4b0592[_0x2815('0x2d')]=qs[_0x2815('0x2d')](_0xd9646f['query']['limit']);_0x4b0592[_0x2815('0x2c')]=qs['offset'](_0xd9646f['query'][_0x2815('0x2c')]);}_0x4b0592[_0x2815('0x4a')]=qs[_0x2815('0x4b')](_0xd9646f['query'][_0x2815('0x4b')]);_0x4b0592['where']=qs['filters'](_[_0x2815('0x4c')](_0xd9646f[_0x2815('0x43')],_0x8fe6ca[_0x2815('0x45')]));_0x4b0592[_0x2815('0x4e')]['MailAccountId']=_0x441816['id'];if(_0xd9646f['query'][_0x2815('0x4d')]){_0x4b0592[_0x2815('0x4e')]=_[_0x2815('0x4f')](_0x4b0592['where'],{'$or':_[_0x2815('0x3c')](_0x4b0592[_0x2815('0x48')],function(_0x137e5e){var _0x309ecb={};_0x309ecb[_0x137e5e]={'$like':'%'+_0xd9646f[_0x2815('0x43')][_0x2815('0x4d')]+'%'};return _0x309ecb;})});}_0x4b0592=_[_0x2815('0x4f')]({},_0x4b0592,_0xd9646f[_0x2815('0x51')]);return db[_0x2815('0x69')][_0x2815('0x52')]({'where':_0x4b0592['where']})[_0x2815('0x1d')](function(_0x3769f6){_0x433a4f['count']=_0x3769f6;if(_0xd9646f[_0x2815('0x43')][_0x2815('0x53')]){_0x4b0592[_0x2815('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2815('0x55')](_0x4b0592);})[_0x2815('0x1d')](function(_0x434604){_0x433a4f['rows']=_0x434604;return _0x433a4f;});}})[_0x2815('0x1d')](respondWithFilteredResult(_0x2aa23f,_0x4b0592))[_0x2815('0x56')](handleError(_0x2aa23f,null));};exports[_0x2815('0x6b')]=function(_0x53c303,_0x2e78e3,_0xfb3a40){return db['MailAccount'][_0x2815('0x5b')]({'where':{'id':_0x53c303[_0x2815('0x58')]['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x2e78e3,null))['then'](function(_0x302d5c){if(_0x302d5c){return _0x302d5c[_0x2815('0x6b')](_0x53c303[_0x2815('0x43')]['ids']);}})[_0x2815('0x1d')](respondWithStatusCode(_0x2e78e3,null))[_0x2815('0x56')](handleError(_0x2e78e3,null));};exports['create']=function(_0x193f7e,_0x444d24){var _0x532b39={'name':_0x193f7e['body']['name'],'key':_0x193f7e[_0x2815('0x5c')][_0x2815('0x41')],'email':_0x193f7e[_0x2815('0x5c')][_0x2815('0x6c')],'ListId':_0x193f7e['body'][_0x2815('0x6d')],'active':!_['isNil'](_0x193f7e[_0x2815('0x5c')][_0x2815('0x6e')])?_0x193f7e[_0x2815('0x5c')][_0x2815('0x6e')]:!![],'description':_0x193f7e['body'][_0x2815('0x6f')]||null,'Imap':{},'Smtp':{}};if(_[_0x2815('0x70')](_0x193f7e[_0x2815('0x5c')]['cservice'])){if(_0x193f7e['body']['cauthentication']){_0x532b39[_0x2815('0x59')][_0x2815('0x71')]=_0x532b39[_0x2815('0x5d')]['user']=_0x193f7e[_0x2815('0x5c')][_0x2815('0x72')];_0x532b39[_0x2815('0x59')][_0x2815('0x73')]=_0x532b39[_0x2815('0x5d')][_0x2815('0x74')]=_0x193f7e[_0x2815('0x5c')][_0x2815('0x75')];}else{_0x532b39['Imap'][_0x2815('0x76')]=_0x532b39[_0x2815('0x5d')][_0x2815('0x76')]=![];}_0x532b39[_0x2815('0x59')][_0x2815('0x77')]=_0x193f7e[_0x2815('0x5c')][_0x2815('0x59')]['host'];_0x532b39[_0x2815('0x59')][_0x2815('0x78')]=_0x193f7e[_0x2815('0x5c')][_0x2815('0x59')][_0x2815('0x78')];_0x532b39[_0x2815('0x5d')][_0x2815('0x77')]=_0x193f7e[_0x2815('0x5c')][_0x2815('0x5d')][_0x2815('0x77')];_0x532b39[_0x2815('0x5d')][_0x2815('0x78')]=_0x193f7e[_0x2815('0x5c')][_0x2815('0x5d')]['port'];}else{_0x532b39[_0x2815('0x59')]['service']=_0x532b39[_0x2815('0x5d')][_0x2815('0x79')]=_0x193f7e[_0x2815('0x5c')][_0x2815('0x7a')];_0x532b39['Imap'][_0x2815('0x71')]=_0x532b39[_0x2815('0x5d')][_0x2815('0x71')]=_0x193f7e[_0x2815('0x5c')][_0x2815('0x72')];_0x532b39['Imap'][_0x2815('0x73')]=_0x532b39[_0x2815('0x5d')][_0x2815('0x74')]=_0x193f7e[_0x2815('0x5c')][_0x2815('0x75')];}return db['MailAccount'][_0x2815('0x62')](_0x532b39,{'include':[{'model':db[_0x2815('0x3a')],'as':'Smtp'},{'model':db[_0x2815('0x39')],'as':_0x2815('0x59')}]})['then'](function(_0x3da24f){var _0x2634af=_0x193f7e['user'][_0x2815('0x7b')]({'plain':!![]});if(!_0x2634af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2634af['role']===_0x2815('0x71')){var _0x5d5f45=_0x3da24f['get']({'plain':!![]});return db[_0x2815('0x7c')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x2634af[_0x2815('0x7d')]},'raw':!![]})[_0x2815('0x1d')](function(_0x37e655){if(_0x37e655&&_0x37e655[_0x2815('0x7e')]===0x0){return db[_0x2815('0x35')][_0x2815('0x62')]({'name':_0x5d5f45[_0x2815('0x37')],'resourceId':_0x5d5f45['id'],'type':_0x37e655[_0x2815('0x37')],'sectionId':_0x37e655['id']},{})[_0x2815('0x1d')](function(){return _0x3da24f;});}else{return _0x3da24f;}})[_0x2815('0x56')](function(_0x48d01e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48d01e);throw _0x48d01e;});}return _0x3da24f;})['then'](respondWithResult(_0x444d24,0xc9))[_0x2815('0x56')](handleError(_0x444d24,null));};exports[_0x2815('0x7f')]=function(_0x3b5a04,_0x49a747,_0x3f8a45){return db[_0x2815('0x3d')][_0x2815('0x63')]({'where':{'id':_0x3b5a04['params']['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x49a747,null))[_0x2815('0x1d')](function(_0x54ac88){if(_0x54ac88){return _0x54ac88[_0x2815('0x7f')]();}return null;})[_0x2815('0x1d')](respondWithResult(_0x49a747,null))[_0x2815('0x56')](handleError(_0x49a747,null));};exports[_0x2815('0x80')]=function(_0x3c6e29,_0x3b106c,_0x170536){if(_0x3c6e29[_0x2815('0x5c')]['id']){delete _0x3c6e29[_0x2815('0x5c')]['id'];}return db[_0x2815('0x3d')][_0x2815('0x5b')]({'where':{'id':_0x3c6e29['params']['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x3b106c,null))[_0x2815('0x1d')](function(_0x51661e){if(_0x51661e){_0x3c6e29[_0x2815('0x5c')][_0x2815('0x60')]=_0x51661e['id'];return db['MailServerIn'][_0x2815('0x62')](_0x3c6e29[_0x2815('0x5c')]);}})[_0x2815('0x1d')](respondWithResult(_0x3b106c,null))[_0x2815('0x56')](handleError(_0x3b106c,null));};exports[_0x2815('0x81')]=function(_0x17a0ba,_0x52fb07,_0x1ed825){return db[_0x2815('0x3d')][_0x2815('0x63')]({'where':{'id':_0x17a0ba[_0x2815('0x58')]['id']}})['then'](handleEntityNotFound(_0x52fb07,null))[_0x2815('0x1d')](function(_0x37b6c2){if(_0x37b6c2){return _0x37b6c2[_0x2815('0x82')](null);}return null;})[_0x2815('0x1d')](respondWithStatusCode(_0x52fb07,null))[_0x2815('0x56')](handleError(_0x52fb07,null));};exports[_0x2815('0x83')]=function(_0x495457,_0x35fa9a,_0x330236){return db['MailAccount'][_0x2815('0x63')]({'where':{'id':_0x495457[_0x2815('0x58')]['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x35fa9a,null))[_0x2815('0x1d')](function(_0x44e7ec){if(_0x44e7ec){return _0x44e7ec[_0x2815('0x83')]();}return null;})[_0x2815('0x1d')](respondWithResult(_0x35fa9a,null))['catch'](handleError(_0x35fa9a,null));};exports[_0x2815('0x84')]=function(_0x46dd67,_0x5cdb7c,_0x5d995b){if(_0x46dd67[_0x2815('0x5c')]['id']){delete _0x46dd67[_0x2815('0x5c')]['id'];}return db['MailAccount'][_0x2815('0x5b')]({'where':{'id':_0x46dd67[_0x2815('0x58')]['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x5cdb7c,null))[_0x2815('0x1d')](function(_0x148a59){if(_0x148a59){_0x46dd67['body'][_0x2815('0x60')]=_0x148a59['id'];return db['MailServerOut'][_0x2815('0x62')](_0x46dd67[_0x2815('0x5c')]);}})[_0x2815('0x1d')](respondWithResult(_0x5cdb7c,null))[_0x2815('0x56')](handleError(_0x5cdb7c,null));};exports[_0x2815('0x85')]=function(_0x527074,_0x37a2f9,_0x466861){return db[_0x2815('0x3d')][_0x2815('0x63')]({'where':{'id':_0x527074[_0x2815('0x58')]['id']}})['then'](handleEntityNotFound(_0x37a2f9,null))[_0x2815('0x1d')](function(_0x1ee6a5){if(_0x1ee6a5){return _0x1ee6a5[_0x2815('0x86')](null);}return null;})[_0x2815('0x1d')](respondWithStatusCode(_0x37a2f9,null))[_0x2815('0x56')](handleError(_0x37a2f9,null));};exports[_0x2815('0x87')]=function(_0x4a51c8,_0x1834c8,_0x542406){return db[_0x2815('0x88')][_0x2815('0x5b')]({'where':{'id':_0x4a51c8['params']['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x1834c8,null))[_0x2815('0x1d')](function(_0x506a87){if(_0x506a87){return _0x506a87['addInteraction'](_0x4a51c8[_0x2815('0x5c')][_0x2815('0x68')],_['omit'](_0x4a51c8[_0x2815('0x5c')],['ids','id'])||{});}})[_0x2815('0x1d')](respondWithResult(_0x1834c8,null))[_0x2815('0x56')](handleError(_0x1834c8,null));};exports[_0x2815('0x89')]=function(_0xa5c3ec,_0x1185fe,_0x5c188d){var _0x121dcb={'raw':![],'where':{}};var _0x5ec9e7={};var _0x235d63={'count':0x0,'rows':[]};return db[_0x2815('0x3d')][_0x2815('0x63')]({'where':{'id':_0xa5c3ec[_0x2815('0x58')]['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x1185fe,null))[_0x2815('0x1d')](function(_0x567b76){if(_0x567b76){_0x5ec9e7['model']=_['keys'](db[_0x2815('0x88')]['rawAttributes']);_0x5ec9e7[_0x2815('0x43')]=_[_0x2815('0x44')](_0xa5c3ec[_0x2815('0x43')]);_0x5ec9e7[_0x2815('0x45')]=_['intersection'](_0x5ec9e7[_0x2815('0x42')],_0x5ec9e7['query']);_0x121dcb['attributes']=_[_0x2815('0x46')](_0x5ec9e7[_0x2815('0x42')],qs[_0x2815('0x47')](_0xa5c3ec[_0x2815('0x43')]['fields']));_0x121dcb[_0x2815('0x48')]=_0x121dcb[_0x2815('0x48')][_0x2815('0x49')]?_0x121dcb[_0x2815('0x48')]:_0x5ec9e7['model'];if(!_0xa5c3ec[_0x2815('0x43')][_0x2815('0x64')](_0x2815('0x65'))){_0x121dcb[_0x2815('0x2d')]=qs[_0x2815('0x2d')](_0xa5c3ec[_0x2815('0x43')][_0x2815('0x2d')]);_0x121dcb[_0x2815('0x2c')]=qs['offset'](_0xa5c3ec['query']['offset']);}_0x121dcb['order']=qs[_0x2815('0x4b')](_0xa5c3ec[_0x2815('0x43')][_0x2815('0x4b')]);_0x121dcb[_0x2815('0x4e')]=qs['filters'](_[_0x2815('0x4c')](_0xa5c3ec[_0x2815('0x43')],_0x5ec9e7[_0x2815('0x45')]));_0x121dcb['where'][_0x2815('0x60')]=_0x567b76['id'];if(_0xa5c3ec[_0x2815('0x43')][_0x2815('0x4d')]){_0x121dcb[_0x2815('0x4e')]=_[_0x2815('0x4f')](_0x121dcb[_0x2815('0x4e')],{'$or':_[_0x2815('0x3c')](_0x121dcb[_0x2815('0x48')],function(_0x154949){var _0x928aea={};_0x928aea[_0x154949]={'$like':'%'+_0xa5c3ec[_0x2815('0x43')][_0x2815('0x4d')]+'%'};return _0x928aea;})});}_0x121dcb=_[_0x2815('0x4f')]({},_0x121dcb,_0xa5c3ec['options']);return db[_0x2815('0x88')][_0x2815('0x52')]({'where':_0x121dcb[_0x2815('0x4e')]})[_0x2815('0x1d')](function(_0x1e2b2b){_0x235d63[_0x2815('0x52')]=_0x1e2b2b;if(_0xa5c3ec[_0x2815('0x43')]['includeAll']){_0x121dcb[_0x2815('0x54')]=[{'model':db[_0x2815('0x8a')],'as':_0x2815('0x8b'),'required':![]},{'model':db['User'],'as':_0x2815('0x8c'),'attributes':[_0x2815('0x37'),_0x2815('0x8d'),_0x2815('0x8e')],'required':![]},{'model':db[_0x2815('0x8f')],'as':'Tags','attributes':['id',_0x2815('0x37'),'color'],'where':_0xa5c3ec[_0x2815('0x43')][_0x2815('0x90')]?{'id':_0xa5c3ec[_0x2815('0x43')][_0x2815('0x90')]}:undefined,'required':_0xa5c3ec[_0x2815('0x43')]['tag']?!![]:![]}];}return db[_0x2815('0x88')]['findAll'](_0x121dcb);})['then'](function(_0x32f497){_0x235d63[_0x2815('0x66')]=_0x32f497;return _0x235d63;});}})['then'](respondWithFilteredResult(_0x1185fe,_0x121dcb))[_0x2815('0x56')](handleError(_0x1185fe,null));};exports[_0x2815('0x91')]=function(_0x2cc6f6,_0x315c6d,_0x48dd94){return db[_0x2815('0x3d')][_0x2815('0x63')]({'where':{'id':_0x2cc6f6[_0x2815('0x58')]['id']}})['then'](handleEntityNotFound(_0x315c6d,null))[_0x2815('0x1d')](function(_0x3c412d){if(_0x3c412d){return db[_0x2815('0x92')][_0x2815('0x93')](function(_0x63a6d8){return db['MailApplication'][_0x2815('0x33')]({'where':{'MailAccountId':_0x2cc6f6['params']['id']},'transaction':_0x63a6d8})[_0x2815('0x1d')](function(_0x4dc196){var _0x4ed5bf=_[_0x2815('0x3c')](_0x2cc6f6[_0x2815('0x5c')],function(_0x2147f7){_0x2147f7['MailAccountId']=_0x2cc6f6[_0x2815('0x58')]['id'];return _0x2147f7;});return db['MailApplication'][_0x2815('0x94')](_0x4ed5bf,{'transaction':_0x63a6d8});});})[_0x2815('0x1d')](function(){return db[_0x2815('0x95')]['findAndCountAll']({'where':{'MailAccountId':_0x2cc6f6[_0x2815('0x58')]['id']},'order':_0x2815('0x96')});});}})[_0x2815('0x1d')](respondWithResult(_0x315c6d,null))[_0x2815('0x56')](handleError(_0x315c6d,null));};exports[_0x2815('0x97')]=function(_0x4bd1d0,_0x514170,_0x1de23a){var _0x3948c1={};var _0x1c400a={};var _0x5439f8;var _0x4e72d6;return db[_0x2815('0x3d')][_0x2815('0x63')]({'where':{'id':_0x4bd1d0['params']['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x514170,null))[_0x2815('0x1d')](function(_0x26f352){if(_0x26f352){_0x5439f8=_0x26f352;_0x1c400a[_0x2815('0x42')]=_[_0x2815('0x44')](db[_0x2815('0x95')]['rawAttributes']);_0x1c400a[_0x2815('0x43')]=_['keys'](_0x4bd1d0[_0x2815('0x43')]);_0x1c400a[_0x2815('0x45')]=_[_0x2815('0x46')](_0x1c400a[_0x2815('0x42')],_0x1c400a[_0x2815('0x43')]);_0x3948c1[_0x2815('0x48')]=_['intersection'](_0x1c400a[_0x2815('0x42')],qs['fields'](_0x4bd1d0[_0x2815('0x43')]['fields']));_0x3948c1[_0x2815('0x48')]=_0x3948c1['attributes'][_0x2815('0x49')]?_0x3948c1[_0x2815('0x48')]:_0x1c400a[_0x2815('0x42')];_0x3948c1['order']=qs['sort'](_0x4bd1d0[_0x2815('0x43')][_0x2815('0x4b')]);_0x3948c1[_0x2815('0x4e')]=qs['filters'](_[_0x2815('0x4c')](_0x4bd1d0[_0x2815('0x43')],_0x1c400a[_0x2815('0x45')]));if(_0x4bd1d0['query'][_0x2815('0x4d')]){_0x3948c1[_0x2815('0x4e')]=_[_0x2815('0x4f')](_0x3948c1[_0x2815('0x4e')],{'$or':_[_0x2815('0x3c')](_0x3948c1[_0x2815('0x48')],function(_0x48d0ff){var _0x3df4d6={};_0x3df4d6[_0x48d0ff]={'$like':'%'+_0x4bd1d0[_0x2815('0x43')]['filter']+'%'};return _0x3df4d6;})});}_0x3948c1=_[_0x2815('0x4f')]({},_0x3948c1,_0x4bd1d0[_0x2815('0x51')]);return _0x5439f8[_0x2815('0x97')](_0x3948c1);}})[_0x2815('0x1d')](function(_0x25875b){if(_0x25875b){_0x4e72d6=_0x25875b['length'];if(!_0x4bd1d0[_0x2815('0x43')]['hasOwnProperty'](_0x2815('0x65'))){_0x3948c1[_0x2815('0x2d')]=qs[_0x2815('0x2d')](_0x4bd1d0[_0x2815('0x43')]['limit']);_0x3948c1[_0x2815('0x2c')]=qs[_0x2815('0x2c')](_0x4bd1d0[_0x2815('0x43')][_0x2815('0x2c')]);}return _0x5439f8[_0x2815('0x97')](_0x3948c1);}})['then'](function(_0x4ecbe3){if(_0x4ecbe3){return _0x4ecbe3?{'count':_0x4e72d6,'rows':_0x4ecbe3}:null;}})[_0x2815('0x1d')](respondWithResult(_0x514170,null))[_0x2815('0x56')](handleError(_0x514170,null));};exports['getMessages']=function(_0x311acf,_0x5edfb7,_0x57413b){var _0x3c9bc1={'raw':!![],'where':{}};var _0x4c0bc7={};var _0xbb400e={'count':0x0,'rows':[]};return db[_0x2815('0x3d')][_0x2815('0x63')]({'where':{'id':_0x311acf[_0x2815('0x58')]['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x5edfb7,null))[_0x2815('0x1d')](function(_0xc4d649){if(_0xc4d649){_0x4c0bc7[_0x2815('0x42')]=_[_0x2815('0x44')](db[_0x2815('0x98')]['rawAttributes']);_0x4c0bc7[_0x2815('0x43')]=_[_0x2815('0x44')](_0x311acf['query']);_0x4c0bc7['filters']=_['intersection'](_0x4c0bc7[_0x2815('0x42')],_0x4c0bc7[_0x2815('0x43')]);_0x3c9bc1[_0x2815('0x48')]=_[_0x2815('0x46')](_0x4c0bc7[_0x2815('0x42')],qs[_0x2815('0x47')](_0x311acf[_0x2815('0x43')][_0x2815('0x47')]));_0x3c9bc1[_0x2815('0x48')]=_0x3c9bc1['attributes'][_0x2815('0x49')]?_0x3c9bc1[_0x2815('0x48')]:_0x4c0bc7[_0x2815('0x42')];if(!_0x311acf[_0x2815('0x43')][_0x2815('0x64')]('nolimit')){_0x3c9bc1[_0x2815('0x2d')]=qs[_0x2815('0x2d')](_0x311acf[_0x2815('0x43')][_0x2815('0x2d')]);_0x3c9bc1[_0x2815('0x2c')]=qs[_0x2815('0x2c')](_0x311acf['query'][_0x2815('0x2c')]);}_0x3c9bc1[_0x2815('0x4a')]=qs[_0x2815('0x4b')](_0x311acf[_0x2815('0x43')]['sort']);_0x3c9bc1[_0x2815('0x4e')]=qs[_0x2815('0x45')](_['pick'](_0x311acf[_0x2815('0x43')],_0x4c0bc7[_0x2815('0x45')]));_0x3c9bc1[_0x2815('0x4e')][_0x2815('0x60')]=_0xc4d649['id'];if(_0x311acf[_0x2815('0x43')][_0x2815('0x4d')]){_0x3c9bc1[_0x2815('0x4e')]=_[_0x2815('0x4f')](_0x3c9bc1[_0x2815('0x4e')],{'$or':_[_0x2815('0x3c')](_0x3c9bc1['attributes'],function(_0x215d7a){var _0x2d51a7={};_0x2d51a7[_0x215d7a]={'$like':'%'+_0x311acf[_0x2815('0x43')][_0x2815('0x4d')]+'%'};return _0x2d51a7;})});}if(_0x311acf[_0x2815('0x43')][_0x2815('0x99')]){var _0x29955b=_0x311acf[_0x2815('0x43')][_0x2815('0x99')][_0x2815('0x9a')](',');var _0x14d5f6={};_0x14d5f6[_0x29955b[0x0]]={'$gte':moment(_0x29955b[0x1])[_0x2815('0x9b')](_0x2815('0x9c'))};_0x3c9bc1[_0x2815('0x4e')]=_['merge'](_0x3c9bc1[_0x2815('0x4e')],_0x14d5f6);}_0x3c9bc1=_[_0x2815('0x4f')]({},_0x3c9bc1,_0x311acf['options']);return db[_0x2815('0x98')][_0x2815('0x52')]({'where':_0x3c9bc1[_0x2815('0x4e')]})[_0x2815('0x1d')](function(_0x2e2b9){_0xbb400e[_0x2815('0x52')]=_0x2e2b9;if(_0x311acf[_0x2815('0x43')][_0x2815('0x53')]){_0x3c9bc1[_0x2815('0x54')]=[{'all':!![]}];}return db[_0x2815('0x98')][_0x2815('0x55')](_0x3c9bc1);})[_0x2815('0x1d')](function(_0xc8dfcd){if(_0x311acf[_0x2815('0x43')]['inlineCss']===_0x2815('0x9d')){for(var _0xab9beb=0x0;_0xab9beb<_0xc8dfcd[_0x2815('0x49')];_0xab9beb++){_0xc8dfcd[_0xab9beb][_0x2815('0x5c')]=juice(_0xc8dfcd[_0xab9beb][_0x2815('0x5c')]);}}_0xbb400e[_0x2815('0x66')]=_0xc8dfcd;return _0xbb400e;});}})['then'](respondWithFilteredResult(_0x5edfb7,_0x3c9bc1))[_0x2815('0x56')](handleError(_0x5edfb7,null));};exports[_0x2815('0x38')]=function(_0x291ef0,_0x2c36bf,_0x4a1aee){var _0x38e080,_0x2fbdd5={},_0x1e9b2d;if(_0x291ef0[_0x2815('0x5c')]['to']){_0x1e9b2d=_0x291ef0[_0x2815('0x5c')]['to'][_0x2815('0x9a')](',')[0x0];}return db[_0x2815('0x3d')][_0x2815('0x5b')]({'where':{'id':_0x291ef0[_0x2815('0x58')]['id']},'include':[{'model':db[_0x2815('0x9e')],'as':_0x2815('0x9f'),'include':[{'model':db[_0x2815('0x8a')],'as':'Contacts','where':{'email':_0x1e9b2d},'limit':0x1,'order':[[_0x2815('0xa0'),_0x2815('0xa1')]]}]},{'model':db[_0x2815('0x3a')],'as':_0x2815('0x5d'),'raw':!![]}]})[_0x2815('0x1d')](handleEntityNotFound(_0x2c36bf,null))[_0x2815('0x1d')](function(_0x51e66e){if(_0x51e66e){_0x38e080=_0x51e66e;if(_0x51e66e[_0x2815('0x5d')]){if(_[_0x2815('0x70')](_0x291ef0[_0x2815('0x5c')]['from'])){_0x291ef0[_0x2815('0x5c')][_0x2815('0xa2')]=util[_0x2815('0x9b')](_0x2815('0xa3'),_0x51e66e[_0x2815('0x37')],_0x51e66e[_0x2815('0x6c')]||_0x51e66e[_0x2815('0x5d')][_0x2815('0x71')]);}if(_0x291ef0[_0x2815('0x5c')][_0x2815('0xa4')]&&_0x291ef0[_0x2815('0x5c')][_0x2815('0xa4')][_0x2815('0x49')]){for(var _0x3e8133=0x0;_0x3e8133<_0x291ef0[_0x2815('0x5c')][_0x2815('0xa4')]['length'];_0x3e8133+=0x1){_0x291ef0[_0x2815('0x5c')]['attachments'][_0x3e8133]={'filename':_0x291ef0['body'][_0x2815('0xa4')][_0x3e8133][_0x2815('0x37')],'path':path[_0x2815('0xa5')](config[_0x2815('0xa6')],_0x2815('0xa7'),_0x291ef0[_0x2815('0x5c')][_0x2815('0xa4')][_0x3e8133][_0x2815('0xa8')])};}}var _0x3f38de={'tls':{'rejectUnauthorized':![]}};if(_[_0x2815('0x70')](_0x51e66e['Smtp'][_0x2815('0x79')])){if(_0x51e66e[_0x2815('0x5d')][_0x2815('0x76')]){_0x3f38de[_0x2815('0xa9')]={'user':_0x51e66e[_0x2815('0x5d')][_0x2815('0x71')],'pass':_0x51e66e[_0x2815('0x5d')][_0x2815('0x74')]};}_0x3f38de[_0x2815('0x77')]=_0x51e66e[_0x2815('0x5d')][_0x2815('0x77')];_0x3f38de[_0x2815('0x78')]=_0x51e66e[_0x2815('0x5d')][_0x2815('0x78')];_0x3f38de[_0x2815('0xaa')]=_0x51e66e[_0x2815('0x5d')][_0x2815('0xaa')];}else{_0x3f38de['service']=_0x51e66e['Smtp'][_0x2815('0x79')];_0x3f38de[_0x2815('0xa9')]={'user':_0x51e66e[_0x2815('0x5d')][_0x2815('0x71')],'pass':_0x51e66e['Smtp'][_0x2815('0x74')]};}return respondWithRpcPromise(_0x2815('0xab'),'sendMail',{'account':_0x3f38de,'message':_0x291ef0[_0x2815('0x5c')]});}else{throw new Error('List\x20not\x20found');}}})[_0x2815('0x1d')](function(_0x33b05a){if(_0x33b05a){_0x2fbdd5=_0x33b05a;if(_0x38e080[_0x2815('0x9f')]){if(_0x38e080[_0x2815('0x9f')][_0x2815('0xac')][_0x2815('0x49')]){return _0x38e080[_0x2815('0x9f')]['Contacts'][0x0];}else{return db[_0x2815('0x8a')]['create'](_[_0x2815('0xad')](_0x291ef0[_0x2815('0x5c')],{'firstName':_0x291ef0['body']['to'],'email':_0x291ef0['body']['to'],'phone':_0x291ef0[_0x2815('0x5c')]['to'],'ListId':_0x38e080[_0x2815('0x6d')]}));}}else{throw new Error(_0x2815('0xae'));}}})[_0x2815('0x1d')](function(_0x4624dc){if(_0x4624dc){var _0x4ecd06={'UserId':_0x291ef0[_0x2815('0x71')]['id'],'ContactId':_0x4624dc['id'],'MailAccountId':_0x38e080['id'],'inReplyTo':_0x2fbdd5[_0x2815('0xaf')],'to':_0x291ef0[_0x2815('0x5c')][_0x2815('0xa2')],'cc':_0x291ef0[_0x2815('0x5c')]['cc'],'subject':_0x291ef0[_0x2815('0x5c')][_0x2815('0xb0')],'attach':_0x291ef0[_0x2815('0x5c')][_0x2815('0xb1')],'firstMsgDirection':_0x2815('0xb2'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x2815('0xb2'),'lastMsgBody':_0x291ef0[_0x2815('0x5c')][_0x2815('0x5c')],'Messages':[_[_0x2815('0x4f')](_0x291ef0[_0x2815('0x5c')],{'messageId':_0x2fbdd5[_0x2815('0xaf')],'sentAt':moment()[_0x2815('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x38e080['id'],'UserId':_0x291ef0[_0x2815('0x71')]['id'],'ContactId':_0x4624dc['id']})]};if(_0x291ef0[_0x2815('0x5c')]['Interaction']){_0x4ecd06=_[_0x2815('0x4f')](_0x4ecd06,_0x291ef0[_0x2815('0x5c')]['Interaction']);}return db[_0x2815('0x88')][_0x2815('0x62')](_0x4ecd06,{'include':[{'model':db[_0x2815('0x98')],'as':_0x2815('0xb3')}]});}})['then'](respondWithResult(_0x2c36bf,null))[_0x2815('0x56')](handleError(_0x2c36bf,null));};exports[_0x2815('0xb4')]=function(_0x41a18c,_0x39f5b5,_0x10f2dd){return db[_0x2815('0x3d')][_0x2815('0x5b')]({'where':{'id':_0x41a18c[_0x2815('0x58')]['id']},'include':[{'model':db[_0x2815('0x3a')],'as':_0x2815('0x5d'),'raw':!![]}]})[_0x2815('0x1d')](handleEntityNotFound(_0x39f5b5,null))[_0x2815('0x1d')](function(_0x1aa19e){if(_0x1aa19e&&_0x1aa19e['Smtp']){var _0x2f29c0={'id':_0x1aa19e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1aa19e[_0x2815('0x5d')][_0x2815('0x79')]){_0x2f29c0[_0x2815('0x79')]=_0x1aa19e[_0x2815('0x5d')][_0x2815('0x79')];}else{_0x2f29c0[_0x2815('0x77')]=_0x1aa19e[_0x2815('0x5d')][_0x2815('0x77')];_0x2f29c0[_0x2815('0x78')]=_0x1aa19e[_0x2815('0x5d')][_0x2815('0x78')];_0x2f29c0[_0x2815('0xaa')]=_0x1aa19e['Smtp'][_0x2815('0xaa')];}if(_0x1aa19e[_0x2815('0x5d')]['authentication']){_0x2f29c0[_0x2815('0xa9')]={'user':_0x1aa19e[_0x2815('0x5d')][_0x2815('0x71')],'pass':_0x1aa19e['Smtp'][_0x2815('0x74')]};}return respondWithRpcPromise(_0x2815('0xb5'),_0x2815('0xb4'),{'account':_0x2f29c0});}})['then'](respondWithResult(_0x39f5b5,null))[_0x2815('0x56')](handleError(_0x39f5b5,null));};exports[_0x2815('0x33')]=function(_0x32e712,_0x6a603d){return db[_0x2815('0x3d')][_0x2815('0x5b')]({'where':{'id':_0x32e712[_0x2815('0x58')]['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x6a603d,null))[_0x2815('0x1d')](function(_0x38b8ac){if(_0x38b8ac&&_0x38b8ac[_0x2815('0x79')]){throw new db[(_0x2815('0xb6'))][(_0x2815('0xb7'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x38b8ac;})[_0x2815('0x1d')](removeEntity(_0x6a603d,null))[_0x2815('0x56')](handleError(_0x6a603d,null));};exports[_0x2815('0xb8')]=function(_0x5dc10d,_0x122d03,_0x455826){return db[_0x2815('0x3d')]['find']({'where':{'id':_0x5dc10d[_0x2815('0x58')]['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x122d03,null))[_0x2815('0x1d')](function(_0x494f40){if(_0x494f40){return _0x494f40['addAgents'](_0x5dc10d[_0x2815('0x5c')][_0x2815('0x68')],_[_0x2815('0xb9')](_0x5dc10d[_0x2815('0x5c')],[_0x2815('0x68'),'id'])||{})[_0x2815('0xba')](function(_0x35f16b){for(var _0x1be156=0x0;_0x1be156<_0x5dc10d['body'][_0x2815('0x68')][_0x2815('0x49')];_0x1be156+=0x1){socket[_0x2815('0xbb')]('userMailAccount:save',{'UserId':_0x5dc10d['body'][_0x2815('0x68')][_0x1be156],'MailAccountId':_0x5dc10d[_0x2815('0x58')]['id']});}return _0x35f16b;});}})[_0x2815('0x1d')](respondWithResult(_0x122d03,null))[_0x2815('0x56')](handleError(_0x122d03,null));};exports[_0x2815('0xbc')]=function(_0xd9a26c,_0x56c05b,_0x4164c){return db[_0x2815('0x3d')][_0x2815('0x5b')]({'where':{'id':_0xd9a26c[_0x2815('0x58')]['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x56c05b,null))['then'](function(_0x7dc060){if(_0x7dc060){return _0x7dc060['removeAgents'](_0xd9a26c[_0x2815('0x43')][_0x2815('0x68')])['then'](function(){if(_[_0x2815('0xbd')](_0xd9a26c['query'][_0x2815('0x68')])){for(var _0x27cbf3=0x0;_0x27cbf3<_0xd9a26c[_0x2815('0x43')][_0x2815('0x68')][_0x2815('0x49')];_0x27cbf3+=0x1){socket[_0x2815('0xbb')](_0x2815('0xbe'),{'UserId':Number(_0xd9a26c[_0x2815('0x43')][_0x2815('0x68')][_0x27cbf3]),'MailAccountId':Number(_0xd9a26c[_0x2815('0x58')]['id'])});}}else{socket[_0x2815('0xbb')]('userMailAccount:remove',{'UserId':Number(_0xd9a26c['query']['ids']),'MailAccountId':Number(_0xd9a26c[_0x2815('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x56c05b,null))[_0x2815('0x56')](handleError(_0x56c05b,null));};exports['getAgents']=function(_0x122317,_0x9534a0,_0x3a7066){var _0x231cbb={};var _0x1139f7={};var _0x1b3aea;var _0x31f575;return db[_0x2815('0x3d')][_0x2815('0x63')]({'where':{'id':_0x122317[_0x2815('0x58')]['id']}})[_0x2815('0x1d')](handleEntityNotFound(_0x9534a0,null))[_0x2815('0x1d')](function(_0x471ebf){if(_0x471ebf){_0x1b3aea=_0x471ebf;_0x1139f7[_0x2815('0x42')]=_['keys'](db['User'][_0x2815('0x3e')]);_0x1139f7['query']=_['keys'](_0x122317[_0x2815('0x43')]);_0x1139f7['filters']=_[_0x2815('0x46')](_0x1139f7[_0x2815('0x42')],_0x1139f7[_0x2815('0x43')]);_0x231cbb[_0x2815('0x48')]=_[_0x2815('0x46')](_0x1139f7[_0x2815('0x42')],qs[_0x2815('0x47')](_0x122317[_0x2815('0x43')][_0x2815('0x47')]));_0x231cbb[_0x2815('0x48')]=_0x231cbb[_0x2815('0x48')]['length']?_0x231cbb[_0x2815('0x48')]:_0x1139f7[_0x2815('0x42')];_0x231cbb['order']=qs[_0x2815('0x4b')](_0x122317['query']['sort']);_0x231cbb['where']=qs[_0x2815('0x45')](_[_0x2815('0x4c')](_0x122317['query'],_0x1139f7[_0x2815('0x45')]));if(_0x122317[_0x2815('0x43')][_0x2815('0x4d')]){_0x231cbb[_0x2815('0x4e')]=_[_0x2815('0x4f')](_0x231cbb[_0x2815('0x4e')],{'$or':_[_0x2815('0x3c')](_0x231cbb[_0x2815('0x48')],function(_0x5e352a){var _0x5aef07={};_0x5aef07[_0x5e352a]={'$like':'%'+_0x122317[_0x2815('0x43')][_0x2815('0x4d')]+'%'};return _0x5aef07;})});}_0x231cbb=_[_0x2815('0x4f')]({},_0x231cbb,_0x122317[_0x2815('0x51')]);return _0x1b3aea['getAgents'](_0x231cbb);}})[_0x2815('0x1d')](function(_0x4a7b9f){if(_0x4a7b9f){_0x31f575=_0x4a7b9f[_0x2815('0x49')];if(!_0x122317[_0x2815('0x43')][_0x2815('0x64')]('nolimit')){_0x231cbb['limit']=qs[_0x2815('0x2d')](_0x122317[_0x2815('0x43')][_0x2815('0x2d')]);_0x231cbb[_0x2815('0x2c')]=qs['offset'](_0x122317[_0x2815('0x43')][_0x2815('0x2c')]);}return _0x1b3aea[_0x2815('0xbf')](_0x231cbb);}})[_0x2815('0x1d')](function(_0x51bb4b){if(_0x51bb4b){return _0x51bb4b?{'count':_0x31f575,'rows':_0x51bb4b}:null;}})['then'](respondWithResult(_0x9534a0,null))[_0x2815('0x56')](handleError(_0x9534a0,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index ea5dece..8db7424 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 _0x2318=['update','remove','emit','hook','exports','events','MailAccount','save'];(function(_0x51cbdc,_0x45dd09){var _0x34b885=function(_0x124f48){while(--_0x124f48){_0x51cbdc['push'](_0x51cbdc['shift']());}};_0x34b885(++_0x45dd09);}(_0x2318,0x175));var _0x8231=function(_0x2d8225,_0xcb0d71){_0x2d8225=_0x2d8225-0x0;var _0x5c2eea=_0x2318[_0x2d8225];return _0x5c2eea;};'use strict';var EventEmitter=require(_0x8231('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x8231('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8231('0x2'),'afterUpdate':_0x8231('0x3'),'afterDestroy':_0x8231('0x4')};function emitEvent(_0xbc1a5f){return function(_0x52ea2e,_0x22200d,_0x140588){MailAccountEvents['emit'](_0xbc1a5f+':'+_0x52ea2e['id'],_0x52ea2e);MailAccountEvents[_0x8231('0x5')](_0xbc1a5f,_0x52ea2e);_0x140588(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x8231('0x6')](e,emitEvent(event));}}module[_0x8231('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xdafe=['hook','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x4b89d9,_0x3a4a59){var _0x5648ac=function(_0x247968){while(--_0x247968){_0x4b89d9['push'](_0x4b89d9['shift']());}};_0x5648ac(++_0x3a4a59);}(_0xdafe,0xc1));var _0xedaf=function(_0x42058e,_0x38c627){_0x42058e=_0x42058e-0x0;var _0x2dc1f8=_0xdafe[_0x42058e];return _0x2dc1f8;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xedaf('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xedaf('0x1')](0x0);var events={'afterCreate':_0xedaf('0x2'),'afterUpdate':'update','afterDestroy':_0xedaf('0x3')};function emitEvent(_0x134b12){return function(_0x556171,_0x146d15,_0x37bec6){MailAccountEvents[_0xedaf('0x4')](_0x134b12+':'+_0x556171['id'],_0x556171);MailAccountEvents[_0xedaf('0x4')](_0x134b12,_0x556171);_0x37bec6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xedaf('0x5')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 5ff9bfc..52496c7 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 _0x4766=['MailAccount','mail_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailAccount.attributes','define'];(function(_0x328dc2,_0x2b9ef0){var _0x2ca728=function(_0x4a7ee8){while(--_0x4a7ee8){_0x328dc2['push'](_0x328dc2['shift']());}};_0x2ca728(++_0x2b9ef0);}(_0x4766,0xe6));var _0x6476=function(_0x4def14,_0x208e20){_0x4def14=_0x4def14-0x0;var _0x377e4c=_0x4766[_0x4def14];return _0x377e4c;};'use strict';var _=require(_0x6476('0x0'));var util=require(_0x6476('0x1'));var logger=require(_0x6476('0x2'))(_0x6476('0x3'));var moment=require(_0x6476('0x4'));var BPromise=require('bluebird');var rp=require(_0x6476('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6476('0x6'));var config=require(_0x6476('0x7'));var attributes=require(_0x6476('0x8'));module['exports']=function(_0x3e7733,_0x210548){return _0x3e7733[_0x6476('0x9')](_0x6476('0xa'),attributes,{'tableName':_0x6476('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77fd=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util'];(function(_0x52ddc8,_0xada5d6){var _0x41e9c3=function(_0x432441){while(--_0x432441){_0x52ddc8['push'](_0x52ddc8['shift']());}};_0x41e9c3(++_0xada5d6);}(_0x77fd,0xb4));var _0xd77f=function(_0x4d573c,_0x40c29e){_0x4d573c=_0x4d573c-0x0;var _0x3d8abe=_0x77fd[_0x4d573c];return _0x3d8abe;};'use strict';var _=require(_0xd77f('0x0'));var util=require(_0xd77f('0x1'));var logger=require(_0xd77f('0x2'))(_0xd77f('0x3'));var moment=require(_0xd77f('0x4'));var BPromise=require(_0xd77f('0x5'));var rp=require(_0xd77f('0x6'));var fs=require('fs');var path=require(_0xd77f('0x7'));var rimraf=require('rimraf');var config=require(_0xd77f('0x8'));var attributes=require(_0xd77f('0x9'));module[_0xd77f('0xa')]=function(_0x59564f,_0x24ca9d){return _0x59564f[_0xd77f('0xb')](_0xd77f('0xc'),attributes,{'tableName':_0xd77f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index afbe089..42a87ad 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 _0x4517=['catch','GetMailAccount','MailAccount','findAll','options','attributes','limit','include','map','model','ShowMailAccount','raw','where','NotifyMailAccount','keys','CmContact','updatedAt','ListId','body','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','omit','list','orderBy','applications','priority','asc','autoclose','push','length','close','*,*,*,*','from','create','List\x20not\x20found','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','update','format','interaction','get','contact','attachments','originCc','bcc','Attachment','UserId','User','find','name','agent','Start','startRouting','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4517,0x112));var _0x7451=function(_0x5e4f50,_0x486764){_0x5e4f50=_0x5e4f50-0x0;var _0x4536aa=_0x4517[_0x5e4f50];return _0x4536aa;};'use strict';var _=require('lodash');var util=require(_0x7451('0x0'));var moment=require(_0x7451('0x1'));var BPromise=require('bluebird');var rs=require(_0x7451('0x2'));var fs=require('fs');var Redis=require(_0x7451('0x3'));var db=require(_0x7451('0x4'))['db'];var utils=require(_0x7451('0x5'));var logger=require(_0x7451('0x6'))(_0x7451('0x7'));var config=require(_0x7451('0x8'));var jayson=require(_0x7451('0x9'));var client=jayson[_0x7451('0xa')][_0x7451('0xb')]({'port':0x232c});config[_0x7451('0xc')]=_[_0x7451('0xd')](config[_0x7451('0xc')],{'host':_0x7451('0xe'),'port':0x18eb});var socket=require(_0x7451('0xf'))(new Redis(config[_0x7451('0xc')]));require(_0x7451('0x10'))['register'](socket);function respondWithRpcPromise(_0x29f2e1,_0xc586c3,_0x310fd1){return new BPromise(function(_0x197f6d,_0x323ba5){return client[_0x7451('0x11')](_0x29f2e1,_0x310fd1)[_0x7451('0x12')](function(_0x4aab85){logger['info'](_0x7451('0x13'),_0xc586c3,'request\x20sent');logger[_0x7451('0x14')](_0x7451('0x15'),_0xc586c3,'request\x20sent',JSON[_0x7451('0x16')](_0x4aab85));if(_0x4aab85[_0x7451('0x17')]){if(_0x4aab85['error'][_0x7451('0x18')]===0x1f4){logger[_0x7451('0x17')](_0x7451('0x13'),_0xc586c3,_0x4aab85[_0x7451('0x17')]['message']);return _0x323ba5(_0x4aab85[_0x7451('0x17')][_0x7451('0x19')]);}logger[_0x7451('0x17')]('MailAccount,\x20%s,\x20%s',_0xc586c3,_0x4aab85['error'][_0x7451('0x19')]);return _0x197f6d(_0x4aab85[_0x7451('0x17')][_0x7451('0x19')]);}else{logger[_0x7451('0x1a')](_0x7451('0x13'),_0xc586c3,_0x7451('0x1b'));_0x197f6d(_0x4aab85[_0x7451('0x1c')][_0x7451('0x19')]);}})[_0x7451('0x1d')](function(_0x5e52fe){logger[_0x7451('0x17')](_0x7451('0x13'),_0xc586c3,_0x5e52fe);_0x323ba5(_0x5e52fe);});});}exports[_0x7451('0x1e')]=function(_0x59e07e){var _0x59562d=this;return new Promise(function(_0x33f01c,_0x3ffb08){return db[_0x7451('0x1f')][_0x7451('0x20')]({'raw':_0x59e07e[_0x7451('0x21')]?_0x59e07e[_0x7451('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x59e07e[_0x7451('0x21')]?_0x59e07e[_0x7451('0x21')]['where']||null:null,'attributes':_0x59e07e[_0x7451('0x21')]?_0x59e07e[_0x7451('0x21')][_0x7451('0x22')]||null:null,'limit':_0x59e07e['options']?_0x59e07e[_0x7451('0x21')][_0x7451('0x23')]||null:null,'include':_0x59e07e[_0x7451('0x21')]?_0x59e07e[_0x7451('0x21')][_0x7451('0x24')]?_[_0x7451('0x25')](_0x59e07e[_0x7451('0x21')][_0x7451('0x24')],function(_0x3c4eae){return{'model':db[_0x3c4eae['model']],'as':_0x3c4eae['as'],'attributes':_0x3c4eae[_0x7451('0x22')],'include':_0x3c4eae[_0x7451('0x24')]?_['map'](_0x3c4eae['include'],function(_0xcc793e){return{'model':db[_0xcc793e[_0x7451('0x26')]],'as':_0xcc793e['as'],'attributes':_0xcc793e[_0x7451('0x22')],'include':_0xcc793e[_0x7451('0x24')]?_[_0x7451('0x25')](_0xcc793e[_0x7451('0x24')],function(_0x4b5b26){return{'model':db[_0x4b5b26[_0x7451('0x26')]],'as':_0x4b5b26['as'],'attributes':_0x4b5b26['attributes']};}):[]};}):[]};}):[]:[]})[_0x7451('0x12')](function(_0x6c10ee){logger['info'](_0x7451('0x1e'),_0x59e07e);logger[_0x7451('0x14')](_0x7451('0x1e'),_0x59e07e,JSON[_0x7451('0x16')](_0x6c10ee));_0x33f01c(_0x6c10ee);})[_0x7451('0x1d')](function(_0x4e24f7){logger[_0x7451('0x17')](_0x7451('0x1e'),_0x4e24f7[_0x7451('0x19')],_0x59e07e);_0x3ffb08(_0x59562d['error'](0x1f4,_0x4e24f7[_0x7451('0x19')]));});});};exports[_0x7451('0x27')]=function(_0x5dfc5e){var _0x4caef4=this;return new Promise(function(_0x10ba2c,_0x1363a6){return db['MailAccount']['find']({'raw':_0x5dfc5e[_0x7451('0x21')]?_0x5dfc5e[_0x7451('0x21')][_0x7451('0x28')]===undefined?!![]:![]:!![],'where':_0x5dfc5e[_0x7451('0x21')]?_0x5dfc5e[_0x7451('0x21')][_0x7451('0x29')]||null:null,'attributes':_0x5dfc5e[_0x7451('0x21')]?_0x5dfc5e[_0x7451('0x21')]['attributes']||null:null,'include':_0x5dfc5e[_0x7451('0x21')]?_0x5dfc5e[_0x7451('0x21')]['include']?_[_0x7451('0x25')](_0x5dfc5e[_0x7451('0x21')][_0x7451('0x24')],function(_0x93269f){return{'model':db[_0x93269f[_0x7451('0x26')]],'as':_0x93269f['as'],'attributes':_0x93269f[_0x7451('0x22')],'include':_0x93269f['include']?_[_0x7451('0x25')](_0x93269f[_0x7451('0x24')],function(_0x49d59e){return{'model':db[_0x49d59e[_0x7451('0x26')]],'as':_0x49d59e['as'],'attributes':_0x49d59e[_0x7451('0x22')],'include':_0x49d59e['include']?_['map'](_0x49d59e['include'],function(_0x54b60f){return{'model':db[_0x54b60f['model']],'as':_0x54b60f['as'],'attributes':_0x54b60f[_0x7451('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7451('0x12')](function(_0x3647f8){logger[_0x7451('0x1a')](_0x7451('0x27'),_0x5dfc5e);logger['debug']('ShowMailAccount',_0x5dfc5e,JSON['stringify'](_0x3647f8));_0x10ba2c(_0x3647f8);})['catch'](function(_0x5d11f0){logger[_0x7451('0x17')](_0x7451('0x27'),_0x5d11f0[_0x7451('0x19')],_0x5dfc5e);_0x1363a6(_0x4caef4[_0x7451('0x17')](0x1f4,_0x5d11f0[_0x7451('0x19')]));});});};exports[_0x7451('0x2a')]=function(_0xdbbc08){var _0x305cd5=this;return new Promise(function(_0x201d96,_0x92840){var _0x264c74={'body':_0xdbbc08['body'],'channel':'mail'};var _0x169d18=_['difference'](_[_0x7451('0x2b')](db[_0x7451('0x2c')]['rawAttributes']),['createdAt',_0x7451('0x2d'),'CompanyId',_0x7451('0x2e')]);var _0x514a3c=![];if(_0xdbbc08[_0x7451('0x2f')]['id']){delete _0xdbbc08[_0x7451('0x2f')]['id'];}if(_['isNil'](_0xdbbc08[_0x7451('0x2f')]['from'])){return _0x92840(_0x305cd5[_0x7451('0x17')](0x1f4,_0x7451('0x30')));}if(_[_0x7451('0x31')](_0xdbbc08[_0x7451('0x2f')][_0x7451('0x2f')])||_0xdbbc08[_0x7451('0x2f')][_0x7451('0x2f')]===''){return _0x92840(_0x305cd5[_0x7451('0x17')](0x1f4,_0x7451('0x32')));}if(_[_0x7451('0x31')](_0xdbbc08[_0x7451('0x2f')][_0x7451('0x33')])){return _0x92840(_0x305cd5[_0x7451('0x17')](0x1f4,_0x7451('0x34')+_0x169d18));}if(!_['includes'](_0x169d18,_0xdbbc08[_0x7451('0x2f')][_0x7451('0x33')])){return _0x92840(_0x305cd5[_0x7451('0x17')](0x1f4,_0x7451('0x35')+_0x169d18));}var _0x5bca4d={};_0x5bca4d[_0xdbbc08[_0x7451('0x2f')]['mapKey']]=_0xdbbc08['body']['from'];return db['MailAccount']['find']({'where':{'id':_0xdbbc08[_0x7451('0x36')]['id']},'include':[{'model':db[_0x7451('0x37')],'as':_0x7451('0x38'),'include':[{'model':db['CmContact'],'as':_0x7451('0x39'),'where':_0x5bca4d,'limit':0x1,'order':[[_0x7451('0x2d'),_0x7451('0x3a')]]}]},{'model':db[_0x7451('0x3b')],'as':_0x7451('0x3c')},{'model':db[_0x7451('0x3d')],'as':_0x7451('0x3e')}]})[_0x7451('0x12')](function(_0x14e7dc){if(_0x14e7dc&&_0x14e7dc['List']){var _0x4c779f=_0x14e7dc['get']({'plain':!![]});_0x264c74[_0x7451('0x36')]=_[_0x7451('0x3f')](_0x4c779f,[_0x7451('0x3c'),'List']);_0x264c74['applications']=_0x4c779f['Applications'];_0x264c74[_0x7451('0x40')]=_0x4c779f['List'];_0x264c74['applications']=_[_0x7451('0x41')](_0x264c74[_0x7451('0x42')],[_0x7451('0x43')],[_0x7451('0x44')]);if(_0x264c74[_0x7451('0x36')]&&_0x264c74['account'][_0x7451('0x45')]){_0x264c74['applications'][_0x7451('0x46')]({'id':0x0,'priority':_0x264c74[_0x7451('0x42')][_0x7451('0x47')]+0x1,'app':_0x7451('0x48'),'appdata':_0x7451('0x45'),'interval':_0x7451('0x49')});}if(_0x264c74[_0x7451('0x36')][_0x7451('0x3c')]){delete _0x264c74[_0x7451('0x36')]['Applications'];}if(_0x264c74['account'][_0x7451('0x38')]){delete _0x264c74[_0x7451('0x36')]['List'];}if(_0x4c779f['List']['Contacts'][_0x7451('0x47')]){return _0x4c779f[_0x7451('0x38')][_0x7451('0x39')][0x0];}var _0x22c4db=_[_0x7451('0xd')](_0xdbbc08[_0x7451('0x2f')],{'firstName':_0xdbbc08['body'][_0x7451('0x4a')],'ListId':_0x4c779f['ListId']});_0x22c4db[_0xdbbc08['body']['mapKey']]=_0xdbbc08[_0x7451('0x2f')][_0x7451('0x4a')];return db[_0x7451('0x2c')][_0x7451('0x4b')](_0x22c4db);}else{throw new Error(_0x7451('0x4c'));}})[_0x7451('0x12')](function(_0x36add5){_0x264c74['contact']=_0x36add5;if(_0x36add5){if(!_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4d')]){_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4d')]=rs[_0x7451('0x4e')]()+'\x20'+_0xdbbc08['body'][_0x7451('0x19')][_0x7451('0x4a')];}var _0x20bb3c={'ContactId':_0x36add5['id'],'MailAccountId':_0xdbbc08[_0x7451('0x36')]['id'],'inReplyTo':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')]['messageId'],'to':_0xdbbc08[_0x7451('0x2f')]['message']['from'],'cc':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')]['cc'],'subject':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4f')],'attach':_0xdbbc08[_0x7451('0x2f')]['message'][_0x7451('0x50')],'lastMsgAt':moment()['format'](_0x7451('0x51')),'lastMsgDirection':'in','lastMsgBody':_0xdbbc08[_0x7451('0x2f')]['body']};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0xdbbc08['account']['id']},'include':[{'model':db[_0x7451('0x52')],'as':_0x7451('0x53'),'attributes':[_0x7451('0x4d')],'where':{'messageId':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x54')]}}]})['then'](function(_0x3de4c4){if(_0x3de4c4){return[_0x3de4c4,![]];}return db['MailInteraction'][_0x7451('0x4b')](_0x20bb3c)[_0x7451('0x12')](function(_0x184574){return[_0x184574,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x207593,_0x3cee16){if(_0x207593){_0x514a3c=_0x3cee16;if(!_0x3cee16){return _0x207593[_0x7451('0x55')]({'inReplyTo':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4d')],'to':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4a')],'cc':_0xdbbc08[_0x7451('0x2f')]['message']['cc'],'subject':_0xdbbc08['body'][_0x7451('0x19')][_0x7451('0x4f')],'attach':_0x207593[_0x7451('0x50')]?_0x207593['attach']:_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x50')],'substatus':null,'substatusAt':moment()['format'](_0x7451('0x51')),'lastMsgAt':moment()[_0x7451('0x56')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0xdbbc08['body'][_0x7451('0x2f')]});}else{return _0x207593;}}})[_0x7451('0x12')](function(_0x55d485){_0x264c74[_0x7451('0x57')]=_0x55d485[_0x7451('0x58')]({'plain':!![]});_0x264c74['interaction']['created']=_0x514a3c;return db['MailMessage'][_0x7451('0x4b')]({'body':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x2f')],'MailAccountId':_0xdbbc08[_0x7451('0x36')]['id'],'MailInteractionId':_0x55d485['id'],'direction':'in','ContactId':_0x264c74[_0x7451('0x59')]['id'],'messageId':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4d')],'from':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4a')],'to':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')]['to'],'cc':_0xdbbc08['body'][_0x7451('0x19')]['cc'],'subject':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4f')],'attach':_0xdbbc08['body'][_0x7451('0x19')]['attach'],'Attachments':_0xdbbc08['body'][_0x7451('0x19')][_0x7451('0x5a')],'originTo':_0xdbbc08['body'][_0x7451('0x19')]['originTo'],'originCc':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x5b')],'bcc':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x5c')]},{'include':[{'model':db[_0x7451('0x5d')],'as':'Attachments'}]});})['then'](function(_0x5e6139){_0x264c74[_0x7451('0x19')]=_0x5e6139;if(_0x264c74[_0x7451('0x57')][_0x7451('0x5e')]){return db[_0x7451('0x5f')][_0x7451('0x60')]({'attributes':['id',_0x7451('0x61')],'where':{'id':_0x264c74['interaction']['UserId']}})[_0x7451('0x12')](function(_0x3e3417){if(_0x3e3417){_0x264c74[_0x7451('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7451('0x62'),'appdata':_0x3e3417[_0x7451('0x61')]+','+(_0x264c74['account']['waitForTheAssignedAgent']||0xa),'interval':_0x7451('0x49')});}return respondWithRpcPromise(_0x7451('0x63'),_0x7451('0x64'),_0x264c74);});}return respondWithRpcPromise(_0x7451('0x63'),_0x7451('0x64'),_0x264c74);})[_0x7451('0x12')](function(_0x361e57){_0x201d96(_0x361e57);})[_0x7451('0x1d')](function(_0x1e02aa){_0x92840(_0x305cd5[_0x7451('0x17')](0x1f4,_0x1e02aa[_0x7451('0x19')]));});});}; \ No newline at end of file +var _0xa902=['List','list','priority','autoclose','applications','push','close','length','defaults','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','create','Contact\x20not\x20found','update','interaction','created','attachments','originCc','bcc','Attachment','Attachments','User','name','UserId','unshift','agent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','./mailAccount.socket','register','request','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','MailAccount,\x20%s,\x20%s','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','include','map','model','attributes','ShowMailAccount','find','debug','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','account','omit'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0xa902,0x8d));var _0x2a90=function(_0x5d00e6,_0x3539ab){_0x5d00e6=_0x5d00e6-0x0;var _0x70aaf=_0xa902[_0x5d00e6];return _0x70aaf;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232c});config[_0x2a90('0xb')]=_['defaults'](config[_0x2a90('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a90('0xb')]));require(_0x2a90('0xc'))[_0x2a90('0xd')](socket);function respondWithRpcPromise(_0x2b0a20,_0x18a60e,_0x56550f){return new BPromise(function(_0x361571,_0x3dadc2){return client[_0x2a90('0xe')](_0x2b0a20,_0x56550f)[_0x2a90('0xf')](function(_0x541e22){logger[_0x2a90('0x10')]('MailAccount,\x20%s,\x20%s',_0x18a60e,_0x2a90('0x11'));logger['debug'](_0x2a90('0x12'),_0x18a60e,'request\x20sent',JSON[_0x2a90('0x13')](_0x541e22));if(_0x541e22[_0x2a90('0x14')]){if(_0x541e22[_0x2a90('0x14')]['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x18a60e,_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);return _0x3dadc2(_0x541e22['error'][_0x2a90('0x15')]);}logger[_0x2a90('0x14')](_0x2a90('0x16'),_0x18a60e,_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);return _0x361571(_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);}else{logger[_0x2a90('0x10')](_0x2a90('0x16'),_0x18a60e,'request\x20sent');_0x361571(_0x541e22[_0x2a90('0x17')][_0x2a90('0x15')]);}})[_0x2a90('0x18')](function(_0x52622c){logger[_0x2a90('0x14')](_0x2a90('0x16'),_0x18a60e,_0x52622c);_0x3dadc2(_0x52622c);});});}exports[_0x2a90('0x19')]=function(_0x149a2f){var _0x13809a=this;return new Promise(function(_0x23d227,_0x312cd5){return db[_0x2a90('0x1a')][_0x2a90('0x1b')]({'raw':_0x149a2f[_0x2a90('0x1c')]?_0x149a2f[_0x2a90('0x1c')][_0x2a90('0x1d')]===undefined?!![]:![]:!![],'where':_0x149a2f['options']?_0x149a2f[_0x2a90('0x1c')][_0x2a90('0x1e')]||null:null,'attributes':_0x149a2f[_0x2a90('0x1c')]?_0x149a2f[_0x2a90('0x1c')]['attributes']||null:null,'limit':_0x149a2f[_0x2a90('0x1c')]?_0x149a2f[_0x2a90('0x1c')]['limit']||null:null,'include':_0x149a2f[_0x2a90('0x1c')]?_0x149a2f[_0x2a90('0x1c')][_0x2a90('0x1f')]?_[_0x2a90('0x20')](_0x149a2f[_0x2a90('0x1c')][_0x2a90('0x1f')],function(_0x29ed73){return{'model':db[_0x29ed73[_0x2a90('0x21')]],'as':_0x29ed73['as'],'attributes':_0x29ed73['attributes'],'include':_0x29ed73[_0x2a90('0x1f')]?_[_0x2a90('0x20')](_0x29ed73[_0x2a90('0x1f')],function(_0x40c61a){return{'model':db[_0x40c61a[_0x2a90('0x21')]],'as':_0x40c61a['as'],'attributes':_0x40c61a['attributes'],'include':_0x40c61a['include']?_[_0x2a90('0x20')](_0x40c61a['include'],function(_0x53391e){return{'model':db[_0x53391e['model']],'as':_0x53391e['as'],'attributes':_0x53391e[_0x2a90('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2a90('0xf')](function(_0x595638){logger['info'](_0x2a90('0x19'),_0x149a2f);logger['debug'](_0x2a90('0x19'),_0x149a2f,JSON[_0x2a90('0x13')](_0x595638));_0x23d227(_0x595638);})[_0x2a90('0x18')](function(_0x27b6b6){logger[_0x2a90('0x14')](_0x2a90('0x19'),_0x27b6b6[_0x2a90('0x15')],_0x149a2f);_0x312cd5(_0x13809a['error'](0x1f4,_0x27b6b6[_0x2a90('0x15')]));});});};exports[_0x2a90('0x23')]=function(_0xfa5ce8){var _0x5cdeb4=this;return new Promise(function(_0x770b19,_0x425d03){return db[_0x2a90('0x1a')][_0x2a90('0x24')]({'raw':_0xfa5ce8['options']?_0xfa5ce8[_0x2a90('0x1c')][_0x2a90('0x1d')]===undefined?!![]:![]:!![],'where':_0xfa5ce8[_0x2a90('0x1c')]?_0xfa5ce8[_0x2a90('0x1c')][_0x2a90('0x1e')]||null:null,'attributes':_0xfa5ce8[_0x2a90('0x1c')]?_0xfa5ce8['options'][_0x2a90('0x22')]||null:null,'include':_0xfa5ce8[_0x2a90('0x1c')]?_0xfa5ce8[_0x2a90('0x1c')][_0x2a90('0x1f')]?_['map'](_0xfa5ce8[_0x2a90('0x1c')][_0x2a90('0x1f')],function(_0x4a8870){return{'model':db[_0x4a8870[_0x2a90('0x21')]],'as':_0x4a8870['as'],'attributes':_0x4a8870[_0x2a90('0x22')],'include':_0x4a8870['include']?_['map'](_0x4a8870[_0x2a90('0x1f')],function(_0x75afe0){return{'model':db[_0x75afe0[_0x2a90('0x21')]],'as':_0x75afe0['as'],'attributes':_0x75afe0['attributes'],'include':_0x75afe0[_0x2a90('0x1f')]?_['map'](_0x75afe0[_0x2a90('0x1f')],function(_0x4a3e12){return{'model':db[_0x4a3e12[_0x2a90('0x21')]],'as':_0x4a3e12['as'],'attributes':_0x4a3e12['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x43ebb2){logger['info'](_0x2a90('0x23'),_0xfa5ce8);logger[_0x2a90('0x25')](_0x2a90('0x23'),_0xfa5ce8,JSON['stringify'](_0x43ebb2));_0x770b19(_0x43ebb2);})[_0x2a90('0x18')](function(_0x12f858){logger[_0x2a90('0x14')]('ShowMailAccount',_0x12f858[_0x2a90('0x15')],_0xfa5ce8);_0x425d03(_0x5cdeb4[_0x2a90('0x14')](0x1f4,_0x12f858[_0x2a90('0x15')]));});});};exports['NotifyMailAccount']=function(_0x1aa096){var _0x1db9d8=this;return new Promise(function(_0x504643,_0x2771e8){var _0x70ddcb={'body':_0x1aa096[_0x2a90('0x26')],'channel':_0x2a90('0x27')};var _0x1af955=_[_0x2a90('0x28')](_[_0x2a90('0x29')](db[_0x2a90('0x2a')][_0x2a90('0x2b')]),[_0x2a90('0x2c'),_0x2a90('0x2d'),_0x2a90('0x2e'),_0x2a90('0x2f')]);var _0x18a6ea=![];if(_0x1aa096['body']['id']){delete _0x1aa096[_0x2a90('0x26')]['id'];}if(_[_0x2a90('0x30')](_0x1aa096['body'][_0x2a90('0x31')])){return _0x2771e8(_0x1db9d8[_0x2a90('0x14')](0x1f4,_0x2a90('0x32')));}if(_[_0x2a90('0x30')](_0x1aa096[_0x2a90('0x26')]['body'])||_0x1aa096[_0x2a90('0x26')]['body']===''){return _0x2771e8(_0x1db9d8[_0x2a90('0x14')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x2a90('0x30')](_0x1aa096[_0x2a90('0x26')][_0x2a90('0x33')])){return _0x2771e8(_0x1db9d8[_0x2a90('0x14')](0x1f4,_0x2a90('0x34')+_0x1af955));}if(!_[_0x2a90('0x35')](_0x1af955,_0x1aa096[_0x2a90('0x26')]['mapKey'])){return _0x2771e8(_0x1db9d8['error'](0x1f4,_0x2a90('0x36')+_0x1af955));}var _0x388613={};_0x388613[_0x1aa096[_0x2a90('0x26')][_0x2a90('0x33')]]=_0x1aa096[_0x2a90('0x26')][_0x2a90('0x31')];return db[_0x2a90('0x1a')][_0x2a90('0x24')]({'where':{'id':_0x1aa096['account']['id']},'include':[{'model':db[_0x2a90('0x37')],'as':'List','include':[{'model':db[_0x2a90('0x2a')],'as':_0x2a90('0x38'),'where':_0x388613,'limit':0x1,'order':[['updatedAt',_0x2a90('0x39')]]}]},{'model':db[_0x2a90('0x3a')],'as':_0x2a90('0x3b')},{'model':db[_0x2a90('0x3c')],'as':_0x2a90('0x3d')}]})[_0x2a90('0xf')](function(_0x3ad6c2){if(_0x3ad6c2&&_0x3ad6c2['List']){var _0x553bf1=_0x3ad6c2[_0x2a90('0x3e')]({'plain':!![]});_0x70ddcb[_0x2a90('0x3f')]=_[_0x2a90('0x40')](_0x553bf1,[_0x2a90('0x3b'),_0x2a90('0x41')]);_0x70ddcb['applications']=_0x553bf1['Applications'];_0x70ddcb[_0x2a90('0x42')]=_0x553bf1[_0x2a90('0x41')];_0x70ddcb['applications']=_['orderBy'](_0x70ddcb['applications'],[_0x2a90('0x43')],['asc']);if(_0x70ddcb[_0x2a90('0x3f')]&&_0x70ddcb[_0x2a90('0x3f')][_0x2a90('0x44')]){_0x70ddcb[_0x2a90('0x45')][_0x2a90('0x46')]({'id':0x0,'priority':_0x70ddcb[_0x2a90('0x45')]['length']+0x1,'app':_0x2a90('0x47'),'appdata':_0x2a90('0x44'),'interval':'*,*,*,*'});}if(_0x70ddcb[_0x2a90('0x3f')]['Applications']){delete _0x70ddcb['account'][_0x2a90('0x3b')];}if(_0x70ddcb[_0x2a90('0x3f')]['List']){delete _0x70ddcb['account'][_0x2a90('0x41')];}if(_0x553bf1['List'][_0x2a90('0x38')][_0x2a90('0x48')]){return _0x553bf1['List'][_0x2a90('0x38')][0x0];}var _0x29bb7d=_[_0x2a90('0x49')](_0x1aa096['body'],{'firstName':_0x1aa096[_0x2a90('0x26')][_0x2a90('0x31')],'ListId':_0x553bf1['ListId']});_0x29bb7d[_0x1aa096['body'][_0x2a90('0x33')]]=_0x1aa096[_0x2a90('0x26')]['from'];return db[_0x2a90('0x2a')]['create'](_0x29bb7d);}else{throw new Error(_0x2a90('0x4a'));}})['then'](function(_0x13440e){_0x70ddcb[_0x2a90('0x4b')]=_0x13440e;if(_0x13440e){if(!_0x1aa096[_0x2a90('0x26')]['message']['messageId']){_0x1aa096['body'][_0x2a90('0x15')][_0x2a90('0x4c')]=rs[_0x2a90('0x4d')]()+'\x20'+_0x1aa096[_0x2a90('0x26')][_0x2a90('0x15')][_0x2a90('0x31')];}var _0x5148ce={'ContactId':_0x13440e['id'],'MailAccountId':_0x1aa096[_0x2a90('0x3f')]['id'],'inReplyTo':_0x1aa096[_0x2a90('0x26')][_0x2a90('0x15')][_0x2a90('0x4c')],'to':_0x1aa096[_0x2a90('0x26')][_0x2a90('0x15')]['from'],'cc':_0x1aa096['body']['message']['cc'],'subject':_0x1aa096[_0x2a90('0x26')][_0x2a90('0x15')][_0x2a90('0x4e')],'attach':_0x1aa096[_0x2a90('0x26')][_0x2a90('0x15')][_0x2a90('0x4f')],'lastMsgAt':moment()[_0x2a90('0x50')](_0x2a90('0x51')),'lastMsgDirection':'in','lastMsgBody':_0x1aa096[_0x2a90('0x26')][_0x2a90('0x26')]};return db[_0x2a90('0x52')][_0x2a90('0x24')]({'where':{'closed':![],'MailAccountId':_0x1aa096[_0x2a90('0x3f')]['id']},'include':[{'model':db[_0x2a90('0x53')],'as':_0x2a90('0x54'),'attributes':[_0x2a90('0x4c')],'where':{'messageId':_0x1aa096['body'][_0x2a90('0x15')]['inReplyTo']}}]})[_0x2a90('0xf')](function(_0x303aae){if(_0x303aae){return[_0x303aae,![]];}return db[_0x2a90('0x52')][_0x2a90('0x55')](_0x5148ce)[_0x2a90('0xf')](function(_0x10960c){return[_0x10960c,!![]];});});}else{throw new Error(_0x2a90('0x56'));}})['spread'](function(_0x34ca29,_0x12f842){if(_0x34ca29){_0x18a6ea=_0x12f842;if(!_0x12f842){return _0x34ca29[_0x2a90('0x57')]({'inReplyTo':_0x1aa096['body'][_0x2a90('0x15')][_0x2a90('0x4c')],'to':_0x1aa096[_0x2a90('0x26')][_0x2a90('0x15')]['from'],'cc':_0x1aa096[_0x2a90('0x26')]['message']['cc'],'subject':_0x1aa096[_0x2a90('0x26')][_0x2a90('0x15')][_0x2a90('0x4e')],'attach':_0x34ca29[_0x2a90('0x4f')]?_0x34ca29[_0x2a90('0x4f')]:_0x1aa096[_0x2a90('0x26')]['message'][_0x2a90('0x4f')],'substatus':null,'substatusAt':moment()[_0x2a90('0x50')](_0x2a90('0x51')),'lastMsgAt':moment()[_0x2a90('0x50')](_0x2a90('0x51')),'lastMsgDirection':'in','lastMsgBody':_0x1aa096[_0x2a90('0x26')][_0x2a90('0x26')]});}else{return _0x34ca29;}}})[_0x2a90('0xf')](function(_0x1ccf69){_0x70ddcb['interaction']=_0x1ccf69[_0x2a90('0x3e')]({'plain':!![]});_0x70ddcb[_0x2a90('0x58')][_0x2a90('0x59')]=_0x18a6ea;return db['MailMessage'][_0x2a90('0x55')]({'body':_0x1aa096[_0x2a90('0x26')][_0x2a90('0x26')],'MailAccountId':_0x1aa096[_0x2a90('0x3f')]['id'],'MailInteractionId':_0x1ccf69['id'],'direction':'in','ContactId':_0x70ddcb[_0x2a90('0x4b')]['id'],'messageId':_0x1aa096['body'][_0x2a90('0x15')]['messageId'],'from':_0x1aa096['body'][_0x2a90('0x15')]['from'],'to':_0x1aa096['body'][_0x2a90('0x15')]['to'],'cc':_0x1aa096['body'][_0x2a90('0x15')]['cc'],'subject':_0x1aa096[_0x2a90('0x26')]['message']['subject'],'attach':_0x1aa096[_0x2a90('0x26')]['message']['attach'],'Attachments':_0x1aa096[_0x2a90('0x26')][_0x2a90('0x15')][_0x2a90('0x5a')],'originTo':_0x1aa096[_0x2a90('0x26')]['message']['originTo'],'originCc':_0x1aa096[_0x2a90('0x26')][_0x2a90('0x15')][_0x2a90('0x5b')],'bcc':_0x1aa096[_0x2a90('0x26')][_0x2a90('0x15')][_0x2a90('0x5c')]},{'include':[{'model':db[_0x2a90('0x5d')],'as':_0x2a90('0x5e')}]});})[_0x2a90('0xf')](function(_0xe20002){_0x70ddcb[_0x2a90('0x15')]=_0xe20002;if(_0x70ddcb[_0x2a90('0x58')]['UserId']){return db[_0x2a90('0x5f')]['find']({'attributes':['id',_0x2a90('0x60')],'where':{'id':_0x70ddcb['interaction'][_0x2a90('0x61')]}})['then'](function(_0x4ea392){if(_0x4ea392){_0x70ddcb[_0x2a90('0x45')][_0x2a90('0x62')]({'id':0x0,'priority':0x0,'app':_0x2a90('0x63'),'appdata':_0x4ea392[_0x2a90('0x60')]+','+(_0x70ddcb['account']['waitForTheAssignedAgent']||0xa),'interval':_0x2a90('0x64')});}return respondWithRpcPromise(_0x2a90('0x65'),_0x2a90('0x66'),_0x70ddcb);});}return respondWithRpcPromise(_0x2a90('0x65'),_0x2a90('0x66'),_0x70ddcb);})[_0x2a90('0xf')](function(_0xf7527e){_0x504643(_0xf7527e);})[_0x2a90('0x18')](function(_0x42474d){_0x2771e8(_0x1db9d8[_0x2a90('0x14')](0x1f4,_0x42474d[_0x2a90('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 6f86277..9fbcf2d 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 _0x0967=['emit','register','length','mailAccount:','./mailAccount.events','remove','update'];(function(_0x3f389f,_0x3f29e0){var _0x1f8796=function(_0x1483b3){while(--_0x1483b3){_0x3f389f['push'](_0x3f389f['shift']());}};_0x1f8796(++_0x3f29e0);}(_0x0967,0x100));var _0x7096=function(_0x111be8,_0x16ab9c){_0x111be8=_0x111be8-0x0;var _0x1eab53=_0x0967[_0x111be8];return _0x1eab53;};'use strict';var MailAccountEvents=require(_0x7096('0x0'));var events=['save',_0x7096('0x1'),_0x7096('0x2')];function createListener(_0x29b2ba,_0xc0c6b1){return function(_0x31f0b1){_0xc0c6b1[_0x7096('0x3')](_0x29b2ba,_0x31f0b1);};}function removeListener(_0x4106a2,_0x2a50e2){return function(){MailAccountEvents['removeListener'](_0x4106a2,_0x2a50e2);};}exports[_0x7096('0x4')]=function(_0x10181c){for(var _0xadd502=0x0,_0x1344c3=events[_0x7096('0x5')];_0xadd502<_0x1344c3;_0xadd502++){var _0x20f7ef=events[_0xadd502];var _0x2832fc=createListener(_0x7096('0x6')+_0x20f7ef,_0x10181c);MailAccountEvents['on'](_0x20f7ef,_0x2832fc);}}; \ No newline at end of file +var _0x96aa=['update','emit','removeListener','length','mailAccount:','./mailAccount.events','save'];(function(_0x3215a7,_0x2a2e99){var _0x151602=function(_0x379caa){while(--_0x379caa){_0x3215a7['push'](_0x3215a7['shift']());}};_0x151602(++_0x2a2e99);}(_0x96aa,0x67));var _0xa96a=function(_0xb692f3,_0x184791){_0xb692f3=_0xb692f3-0x0;var _0x3eecda=_0x96aa[_0xb692f3];return _0x3eecda;};'use strict';var MailAccountEvents=require(_0xa96a('0x0'));var events=[_0xa96a('0x1'),'remove',_0xa96a('0x2')];function createListener(_0x32bff8,_0x227d50){return function(_0x12bbb7){_0x227d50[_0xa96a('0x3')](_0x32bff8,_0x12bbb7);};}function removeListener(_0x4911c8,_0x1ce4a1){return function(){MailAccountEvents[_0xa96a('0x4')](_0x4911c8,_0x1ce4a1);};}exports['register']=function(_0x464684){for(var _0x2e9a41=0x0,_0x282c8c=events[_0xa96a('0x5')];_0x2e9a41<_0x282c8c;_0x2e9a41++){var _0x44fb9d=events[_0x2e9a41];var _0x3c7329=createListener(_0xa96a('0x6')+_0x44fb9d,_0x464684);MailAccountEvents['on'](_0x44fb9d,_0x3c7329);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 593f3c9..2d9feec 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 _0xea28=['/:id','show','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xea28,0x13a));var _0x8ea2=function(_0x4df858,_0x24abe0){_0x4df858=_0x4df858-0x0;var _0x177d26=_0xea28[_0x4df858];return _0x177d26;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var auth=require(_0x8ea2('0x6'));var interaction=require(_0x8ea2('0x7'));var config=require('../../config/environment');var controller=require(_0x8ea2('0x8'));router[_0x8ea2('0x9')](_0x8ea2('0xa'),auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xc')](_0x8ea2('0xa'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xf')](_0x8ea2('0xa'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);module[_0x8ea2('0x11')]=router; \ No newline at end of file +var _0xc900=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','path'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xc900,0xb3));var _0x0c90=function(_0x25ee62,_0x3b4364){_0x25ee62=_0x25ee62-0x0;var _0x4dd60c=_0xc900[_0x25ee62];return _0x4dd60c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var auth=require(_0x0c90('0x3'));var interaction=require(_0x0c90('0x4'));var config=require('../../config/environment');var controller=require(_0x0c90('0x5'));router[_0x0c90('0x6')](_0x0c90('0x7'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0xa')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xb')]);router[_0x0c90('0xc')](_0x0c90('0x7'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xd')]);module[_0x0c90('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 6e3e1bc..c94f4ca 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 _0x1298=['STRING','noop'];(function(_0x4d9359,_0x59bd36){var _0x1d509a=function(_0x3a6947){while(--_0x3a6947){_0x4d9359['push'](_0x4d9359['shift']());}};_0x1d509a(++_0x59bd36);}(_0x1298,0x1a0));var _0x8129=function(_0x365b35,_0x4f0239){_0x365b35=_0x365b35-0x0;var _0x1ad5ce=_0x1298[_0x365b35];return _0x1ad5ce;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8129('0x0')],'allowNull':![],'defaultValue':_0x8129('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8129('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xffb1=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x34f5de,_0x5371a8){var _0x599ebb=function(_0x27e577){while(--_0x27e577){_0x34f5de['push'](_0x34f5de['shift']());}};_0x599ebb(++_0x5371a8);}(_0xffb1,0x1b0));var _0x1ffb=function(_0x5a1cc9,_0x28f54d){_0x5a1cc9=_0x5a1cc9-0x0;var _0x471761=_0xffb1[_0x5a1cc9];return _0x471761;};'use strict';var Sequelize=require(_0x1ffb('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1ffb('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1ffb('0x2')],'allowNull':![],'defaultValue':_0x1ffb('0x3')},'appdata':{'type':Sequelize[_0x1ffb('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1ffb('0x2')],'defaultValue':_0x1ffb('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index a08f206..c0ec395 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 _0xfc45=['body','MailApplication','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','params','query','keys','filters','intersection','attributes','model','fields','includeAll','include','merge','find','catch'];(function(_0x533437,_0x4d59d1){var _0x53f4ce=function(_0x483f6b){while(--_0x483f6b){_0x533437['push'](_0x533437['shift']());}};_0x53f4ce(++_0x4d59d1);}(_0xfc45,0x152));var _0x5fc4=function(_0x36d0f8,_0xa0f6d8){_0x36d0f8=_0x36d0f8-0x0;var _0x177352=_0xfc45[_0x36d0f8];return _0x177352;};'use strict';var pdf=require(_0x5fc4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5fc4('0x1'));var zipdir=require(_0x5fc4('0x2'));var jsonpatch=require(_0x5fc4('0x3'));var rp=require(_0x5fc4('0x4'));var moment=require('moment');var BPromise=require(_0x5fc4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5fc4('0x6'));var sox=require('sox');var csv=require(_0x5fc4('0x7'));var ejs=require(_0x5fc4('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5fc4('0x9'));var crypto=require(_0x5fc4('0xa'));var jsforce=require(_0x5fc4('0xb'));var deskjs=require(_0x5fc4('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5fc4('0xd'));var Redis=require('ioredis');var authService=require(_0x5fc4('0xe'));var qs=require(_0x5fc4('0xf'));var as=require(_0x5fc4('0x10'));var hardwareService=require(_0x5fc4('0x11'));var logger=require(_0x5fc4('0x12'))(_0x5fc4('0x13'));var utils=require(_0x5fc4('0x14'));var config=require(_0x5fc4('0x15'));var licenseUtil=require(_0x5fc4('0x16'));var db=require(_0x5fc4('0x17'))['db'];function respondWithStatusCode(_0x2b50ca,_0x437578){_0x437578=_0x437578||0xcc;return function(_0xde6cc){if(_0xde6cc){return _0x2b50ca['sendStatus'](_0x437578);}return _0x2b50ca[_0x5fc4('0x18')](_0x437578)[_0x5fc4('0x19')]();};}function respondWithResult(_0x5a820a,_0x42341){_0x42341=_0x42341||0xc8;return function(_0x545a8e){if(_0x545a8e){return _0x5a820a[_0x5fc4('0x18')](_0x42341)[_0x5fc4('0x1a')](_0x545a8e);}};}function respondWithFilteredResult(_0x2a00e0,_0x3881c0){return function(_0x862b23){if(_0x862b23){var _0x1abd77=_0x862b23[_0x5fc4('0x1b')],_0x56f6e4=_0x3881c0[_0x5fc4('0x1c')],_0x5153f3=_0x3881c0[_0x5fc4('0x1c')]+_0x3881c0['limit'],_0x28956;if(_0x5153f3>=_0x1abd77){_0x5153f3=_0x1abd77;_0x28956=0xc8;}else{_0x28956=0xce;}_0x2a00e0[_0x5fc4('0x18')](_0x28956);return _0x2a00e0['set'](_0x5fc4('0x1d'),_0x56f6e4+'-'+_0x5153f3+'/'+_0x1abd77)[_0x5fc4('0x1a')](_0x862b23);}return null;};}function patchUpdates(_0x33e966){return function(_0xd959f6){try{jsonpatch[_0x5fc4('0x1e')](_0xd959f6,_0x33e966,!![]);}catch(_0x11e00a){return BPromise[_0x5fc4('0x1f')](_0x11e00a);}return _0xd959f6[_0x5fc4('0x20')]();};}function saveUpdates(_0x5c0eaf,_0x415d0d){return function(_0x47a691){if(_0x47a691){return _0x47a691[_0x5fc4('0x21')](_0x5c0eaf)[_0x5fc4('0x22')](function(_0x511fd4){return _0x511fd4;});}return null;};}function removeEntity(_0x5f3262,_0x69dd2){return function(_0x91279c){if(_0x91279c){return _0x91279c[_0x5fc4('0x23')]()[_0x5fc4('0x22')](function(){_0x5f3262[_0x5fc4('0x18')](0xcc)[_0x5fc4('0x19')]();});}};}function handleEntityNotFound(_0x41f2a5,_0x400149){return function(_0x5a47b3){if(!_0x5a47b3){_0x41f2a5[_0x5fc4('0x24')](0x194);}return _0x5a47b3;};}function handleError(_0x1c8d38,_0xd49a3c){_0xd49a3c=_0xd49a3c||0x1f4;return function(_0x29e29d){logger[_0x5fc4('0x25')](_0x29e29d[_0x5fc4('0x26')]);if(_0x29e29d[_0x5fc4('0x27')]){delete _0x29e29d[_0x5fc4('0x27')];}_0x1c8d38['status'](_0xd49a3c)[_0x5fc4('0x28')](_0x29e29d);};}exports['show']=function(_0x1901e7,_0x7ebbaa){var _0x48e118={'raw':!![],'where':{'id':_0x1901e7[_0x5fc4('0x29')]['id']}},_0x215952={};_0x215952['model']=_['keys'](db['MailApplication']['rawAttributes']);_0x215952[_0x5fc4('0x2a')]=_[_0x5fc4('0x2b')](_0x1901e7[_0x5fc4('0x2a')]);_0x215952[_0x5fc4('0x2c')]=_[_0x5fc4('0x2d')](_0x215952['model'],_0x215952[_0x5fc4('0x2a')]);_0x48e118[_0x5fc4('0x2e')]=_[_0x5fc4('0x2d')](_0x215952[_0x5fc4('0x2f')],qs[_0x5fc4('0x30')](_0x1901e7[_0x5fc4('0x2a')][_0x5fc4('0x30')]));_0x48e118[_0x5fc4('0x2e')]=_0x48e118[_0x5fc4('0x2e')]['length']?_0x48e118['attributes']:_0x215952['model'];if(_0x1901e7[_0x5fc4('0x2a')][_0x5fc4('0x31')]){_0x48e118[_0x5fc4('0x32')]=[{'all':!![]}];}_0x48e118=_[_0x5fc4('0x33')]({},_0x48e118,_0x1901e7['options']);return db['MailApplication'][_0x5fc4('0x34')](_0x48e118)[_0x5fc4('0x22')](handleEntityNotFound(_0x7ebbaa,null))['then'](respondWithResult(_0x7ebbaa,null))[_0x5fc4('0x35')](handleError(_0x7ebbaa,null));};exports[_0x5fc4('0x21')]=function(_0x17b28d,_0x106854){if(_0x17b28d['body']['id']){delete _0x17b28d[_0x5fc4('0x36')]['id'];}return db[_0x5fc4('0x37')]['find']({'where':{'id':_0x17b28d['params']['id']}})['then'](handleEntityNotFound(_0x106854,null))[_0x5fc4('0x22')](saveUpdates(_0x17b28d[_0x5fc4('0x36')],null))[_0x5fc4('0x22')](respondWithResult(_0x106854,null))['catch'](handleError(_0x106854,null));};exports[_0x5fc4('0x23')]=function(_0x59e2a6,_0x4c6016){return db[_0x5fc4('0x37')][_0x5fc4('0x34')]({'where':{'id':_0x59e2a6[_0x5fc4('0x29')]['id']}})[_0x5fc4('0x22')](handleEntityNotFound(_0x4c6016,null))['then'](removeEntity(_0x4c6016,null))['catch'](handleError(_0x4c6016,null));}; \ No newline at end of file +var _0xe450=['filters','intersection','attributes','length','include','merge','options','find','catch','body','html-pdf','eml-format','zip-dir','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','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','keys','MailApplication','query'];(function(_0x2edd5f,_0x14d3b8){var _0xc8e9a8=function(_0xc67ef3){while(--_0xc67ef3){_0x2edd5f['push'](_0x2edd5f['shift']());}};_0xc8e9a8(++_0x14d3b8);}(_0xe450,0x82));var _0x0e45=function(_0x4febf5,_0x5b6c73){_0x4febf5=_0x4febf5-0x0;var _0x25895a=_0xe450[_0x4febf5];return _0x25895a;};'use strict';var pdf=require(_0x0e45('0x0'));var emlformat=require(_0x0e45('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0e45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e45('0x3'));var moment=require(_0x0e45('0x4'));var BPromise=require(_0x0e45('0x5'));var Mustache=require(_0x0e45('0x6'));var util=require(_0x0e45('0x7'));var path=require(_0x0e45('0x8'));var sox=require(_0x0e45('0x9'));var csv=require(_0x0e45('0xa'));var ejs=require(_0x0e45('0xb'));var fs=require('fs');var _=require(_0x0e45('0xc'));var squel=require(_0x0e45('0xd'));var crypto=require(_0x0e45('0xe'));var jsforce=require(_0x0e45('0xf'));var deskjs=require(_0x0e45('0x10'));var toCsv=require(_0x0e45('0xa'));var querystring=require(_0x0e45('0x11'));var Papa=require(_0x0e45('0x12'));var Redis=require(_0x0e45('0x13'));var authService=require(_0x0e45('0x14'));var qs=require(_0x0e45('0x15'));var as=require(_0x0e45('0x16'));var hardwareService=require(_0x0e45('0x17'));var logger=require('../../config/logger')(_0x0e45('0x18'));var utils=require('../../config/utils');var config=require(_0x0e45('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16aae6,_0x44a6f7){_0x44a6f7=_0x44a6f7||0xcc;return function(_0x212a7a){if(_0x212a7a){return _0x16aae6[_0x0e45('0x1a')](_0x44a6f7);}return _0x16aae6[_0x0e45('0x1b')](_0x44a6f7)[_0x0e45('0x1c')]();};}function respondWithResult(_0x28b2e1,_0x3c8aba){_0x3c8aba=_0x3c8aba||0xc8;return function(_0x3fa3f3){if(_0x3fa3f3){return _0x28b2e1['status'](_0x3c8aba)[_0x0e45('0x1d')](_0x3fa3f3);}};}function respondWithFilteredResult(_0x2ad757,_0x5ea915){return function(_0x246e6f){if(_0x246e6f){var _0x2f64e8=_0x246e6f[_0x0e45('0x1e')],_0x2e9cae=_0x5ea915[_0x0e45('0x1f')],_0x901de7=_0x5ea915[_0x0e45('0x1f')]+_0x5ea915[_0x0e45('0x20')],_0x590d31;if(_0x901de7>=_0x2f64e8){_0x901de7=_0x2f64e8;_0x590d31=0xc8;}else{_0x590d31=0xce;}_0x2ad757[_0x0e45('0x1b')](_0x590d31);return _0x2ad757[_0x0e45('0x21')](_0x0e45('0x22'),_0x2e9cae+'-'+_0x901de7+'/'+_0x2f64e8)['json'](_0x246e6f);}return null;};}function patchUpdates(_0x560dff){return function(_0x467f26){try{jsonpatch[_0x0e45('0x23')](_0x467f26,_0x560dff,!![]);}catch(_0x1dd419){return BPromise[_0x0e45('0x24')](_0x1dd419);}return _0x467f26[_0x0e45('0x25')]();};}function saveUpdates(_0x3d4320,_0x8fc409){return function(_0x2431a7){if(_0x2431a7){return _0x2431a7[_0x0e45('0x26')](_0x3d4320)[_0x0e45('0x27')](function(_0x32f3f8){return _0x32f3f8;});}return null;};}function removeEntity(_0x2026b7,_0x2efd78){return function(_0x3835cb){if(_0x3835cb){return _0x3835cb[_0x0e45('0x28')]()[_0x0e45('0x27')](function(){_0x2026b7[_0x0e45('0x1b')](0xcc)[_0x0e45('0x1c')]();});}};}function handleEntityNotFound(_0x1f9686,_0x3d4d44){return function(_0x1fc3cf){if(!_0x1fc3cf){_0x1f9686[_0x0e45('0x1a')](0x194);}return _0x1fc3cf;};}function handleError(_0x4d41c8,_0x4bb8e5){_0x4bb8e5=_0x4bb8e5||0x1f4;return function(_0x1c8818){logger['error'](_0x1c8818[_0x0e45('0x29')]);if(_0x1c8818[_0x0e45('0x2a')]){delete _0x1c8818['name'];}_0x4d41c8['status'](_0x4bb8e5)[_0x0e45('0x2b')](_0x1c8818);};}exports[_0x0e45('0x2c')]=function(_0x28591d,_0x2da4d5){var _0x52cd0f={'raw':!![],'where':{'id':_0x28591d[_0x0e45('0x2d')]['id']}},_0x13d8c5={};_0x13d8c5[_0x0e45('0x2e')]=_[_0x0e45('0x2f')](db[_0x0e45('0x30')]['rawAttributes']);_0x13d8c5[_0x0e45('0x31')]=_[_0x0e45('0x2f')](_0x28591d['query']);_0x13d8c5[_0x0e45('0x32')]=_[_0x0e45('0x33')](_0x13d8c5['model'],_0x13d8c5[_0x0e45('0x31')]);_0x52cd0f[_0x0e45('0x34')]=_[_0x0e45('0x33')](_0x13d8c5[_0x0e45('0x2e')],qs['fields'](_0x28591d[_0x0e45('0x31')]['fields']));_0x52cd0f[_0x0e45('0x34')]=_0x52cd0f[_0x0e45('0x34')][_0x0e45('0x35')]?_0x52cd0f[_0x0e45('0x34')]:_0x13d8c5['model'];if(_0x28591d[_0x0e45('0x31')]['includeAll']){_0x52cd0f[_0x0e45('0x36')]=[{'all':!![]}];}_0x52cd0f=_[_0x0e45('0x37')]({},_0x52cd0f,_0x28591d[_0x0e45('0x38')]);return db[_0x0e45('0x30')][_0x0e45('0x39')](_0x52cd0f)['then'](handleEntityNotFound(_0x2da4d5,null))['then'](respondWithResult(_0x2da4d5,null))[_0x0e45('0x3a')](handleError(_0x2da4d5,null));};exports['update']=function(_0x4e6553,_0x304bf1){if(_0x4e6553['body']['id']){delete _0x4e6553['body']['id'];}return db['MailApplication'][_0x0e45('0x39')]({'where':{'id':_0x4e6553[_0x0e45('0x2d')]['id']}})[_0x0e45('0x27')](handleEntityNotFound(_0x304bf1,null))[_0x0e45('0x27')](saveUpdates(_0x4e6553[_0x0e45('0x3b')],null))[_0x0e45('0x27')](respondWithResult(_0x304bf1,null))[_0x0e45('0x3a')](handleError(_0x304bf1,null));};exports[_0x0e45('0x28')]=function(_0x52eb9d,_0x3e4857){return db[_0x0e45('0x30')][_0x0e45('0x39')]({'where':{'id':_0x52eb9d[_0x0e45('0x2d')]['id']}})[_0x0e45('0x27')](handleEntityNotFound(_0x3e4857,null))['then'](removeEntity(_0x3e4857,null))[_0x0e45('0x3a')](handleError(_0x3e4857,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 78b31b0..6a9da63 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 _0xb0ee=['rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x387dc1,_0x3ba649){var _0x17567c=function(_0x4690aa){while(--_0x4690aa){_0x387dc1['push'](_0x387dc1['shift']());}};_0x17567c(++_0x3ba649);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xb0ee[_0x26f702];return _0x11417d;};'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':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb0e('0xc'),'collate':_0xeb0e('0xd')});}; \ No newline at end of file +var _0x78f4=['request-promise','rimraf','../../config/environment','./mailApplication.attributes','MailApplication','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x1b6bf8,_0x1add53){var _0x4fd625=function(_0x158567){while(--_0x158567){_0x1b6bf8['push'](_0x1b6bf8['shift']());}};_0x4fd625(++_0x1add53);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x478f('0x0'));var logger=require(_0x478f('0x1'))(_0x478f('0x2'));var moment=require(_0x478f('0x3'));var BPromise=require('bluebird');var rp=require(_0x478f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x478f('0x5'));var config=require(_0x478f('0x6'));var attributes=require(_0x478f('0x7'));module['exports']=function(_0xe4a2f9,_0x299af3){return _0xe4a2f9['define'](_0x478f('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x478f('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index d47f279..8ac4d3e 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 _0x08a2=['attributes','limit','UpdateMailApplication','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','MailApplication','update','body','options','raw','where'];(function(_0x314134,_0x28129f){var _0x49b69b=function(_0x3a53d3){while(--_0x3a53d3){_0x314134['push'](_0x314134['shift']());}};_0x49b69b(++_0x28129f);}(_0x08a2,0xec));var _0x208a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x08a2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x208a('0x0'));var util=require(_0x208a('0x1'));var moment=require(_0x208a('0x2'));var BPromise=require(_0x208a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x208a('0x4'));var db=require(_0x208a('0x5'))['db'];var utils=require(_0x208a('0x6'));var logger=require('../../config/logger')(_0x208a('0x7'));var config=require(_0x208a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x208a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ce3e6,_0x17b7ff,_0x5e6755){return new BPromise(function(_0x1e9676,_0x4dd043){return client[_0x208a('0xa')](_0x4ce3e6,_0x5e6755)[_0x208a('0xb')](function(_0x2636d1){logger[_0x208a('0xc')](_0x208a('0xd'),_0x17b7ff,_0x208a('0xe'));logger[_0x208a('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x17b7ff,_0x208a('0xe'),JSON['stringify'](_0x2636d1));if(_0x2636d1[_0x208a('0x10')]){if(_0x2636d1[_0x208a('0x10')]['code']===0x1f4){logger['error'](_0x208a('0xd'),_0x17b7ff,_0x2636d1['error'][_0x208a('0x11')]);return _0x4dd043(_0x2636d1[_0x208a('0x10')][_0x208a('0x11')]);}logger[_0x208a('0x10')](_0x208a('0xd'),_0x17b7ff,_0x2636d1[_0x208a('0x10')]['message']);return _0x1e9676(_0x2636d1[_0x208a('0x10')][_0x208a('0x11')]);}else{logger[_0x208a('0xc')](_0x208a('0xd'),_0x17b7ff,_0x208a('0xe'));_0x1e9676(_0x2636d1['result'][_0x208a('0x11')]);}})[_0x208a('0x12')](function(_0x193c99){logger[_0x208a('0x10')](_0x208a('0xd'),_0x17b7ff,_0x193c99);_0x4dd043(_0x193c99);});});}exports['UpdateMailApplication']=function(_0x1536a4){var _0x2e5a33=this;return new Promise(function(_0x1ca79d,_0x20360c){return db[_0x208a('0x13')][_0x208a('0x14')](_0x1536a4[_0x208a('0x15')],{'raw':_0x1536a4[_0x208a('0x16')]?_0x1536a4[_0x208a('0x16')][_0x208a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1536a4[_0x208a('0x16')]?_0x1536a4['options'][_0x208a('0x18')]||null:null,'attributes':_0x1536a4[_0x208a('0x16')]?_0x1536a4[_0x208a('0x16')][_0x208a('0x19')]||null:null,'limit':_0x1536a4[_0x208a('0x16')]?_0x1536a4[_0x208a('0x16')][_0x208a('0x1a')]||null:null})[_0x208a('0xb')](function(_0x54318c){logger[_0x208a('0xc')]('UpdateMailApplication',_0x1536a4);logger[_0x208a('0xf')](_0x208a('0x1b'),_0x1536a4,JSON[_0x208a('0x1c')](_0x54318c));_0x1ca79d(_0x54318c);})['catch'](function(_0x46d48a){logger[_0x208a('0x10')](_0x208a('0x1b'),_0x46d48a[_0x208a('0x11')],_0x1536a4);_0x20360c(_0x2e5a33[_0x208a('0x10')](0x1f4,_0x46d48a[_0x208a('0x11')]));});});}; \ No newline at end of file +var _0x9a57=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateMailApplication','update','body','options','raw','where','attributes','limit','then','catch'];(function(_0x913706,_0x89e1f){var _0x410ea9=function(_0x444246){while(--_0x444246){_0x913706['push'](_0x913706['shift']());}};_0x410ea9(++_0x89e1f);}(_0x9a57,0x1b3));var _0x79a5=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x9a57[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x79a5('0x0'));var util=require(_0x79a5('0x1'));var moment=require('moment');var BPromise=require(_0x79a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79a5('0x3'))['db'];var utils=require(_0x79a5('0x4'));var logger=require(_0x79a5('0x5'))(_0x79a5('0x6'));var config=require(_0x79a5('0x7'));var jayson=require(_0x79a5('0x8'));var client=jayson['client'][_0x79a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfa5b0a,_0x3eab3d,_0xaaebdc){return new BPromise(function(_0x46bd23,_0x951c32){return client[_0x79a5('0xa')](_0xfa5b0a,_0xaaebdc)['then'](function(_0x54837a){logger[_0x79a5('0xb')](_0x79a5('0xc'),_0x3eab3d,_0x79a5('0xd'));logger[_0x79a5('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x3eab3d,'request\x20sent',JSON['stringify'](_0x54837a));if(_0x54837a[_0x79a5('0xf')]){if(_0x54837a[_0x79a5('0xf')][_0x79a5('0x10')]===0x1f4){logger[_0x79a5('0xf')](_0x79a5('0xc'),_0x3eab3d,_0x54837a[_0x79a5('0xf')]['message']);return _0x951c32(_0x54837a['error']['message']);}logger[_0x79a5('0xf')](_0x79a5('0xc'),_0x3eab3d,_0x54837a[_0x79a5('0xf')][_0x79a5('0x11')]);return _0x46bd23(_0x54837a[_0x79a5('0xf')][_0x79a5('0x11')]);}else{logger[_0x79a5('0xb')](_0x79a5('0xc'),_0x3eab3d,_0x79a5('0xd'));_0x46bd23(_0x54837a[_0x79a5('0x12')][_0x79a5('0x11')]);}})['catch'](function(_0x5cec77){logger[_0x79a5('0xf')](_0x79a5('0xc'),_0x3eab3d,_0x5cec77);_0x951c32(_0x5cec77);});});}exports[_0x79a5('0x13')]=function(_0x2aeb79){var _0xda0644=this;return new Promise(function(_0x40ddbb,_0x3c94e4){return db['MailApplication'][_0x79a5('0x14')](_0x2aeb79[_0x79a5('0x15')],{'raw':_0x2aeb79[_0x79a5('0x16')]?_0x2aeb79[_0x79a5('0x16')][_0x79a5('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2aeb79[_0x79a5('0x16')]?_0x2aeb79['options'][_0x79a5('0x18')]||null:null,'attributes':_0x2aeb79['options']?_0x2aeb79[_0x79a5('0x16')][_0x79a5('0x19')]||null:null,'limit':_0x2aeb79[_0x79a5('0x16')]?_0x2aeb79[_0x79a5('0x16')][_0x79a5('0x1a')]||null:null})[_0x79a5('0x1b')](function(_0x287ff5){logger[_0x79a5('0xb')](_0x79a5('0x13'),_0x2aeb79);logger[_0x79a5('0xe')]('UpdateMailApplication',_0x2aeb79,JSON['stringify'](_0x287ff5));_0x40ddbb(_0x287ff5);})[_0x79a5('0x1c')](function(_0x3e8f7f){logger['error']('UpdateMailApplication',_0x3e8f7f[_0x79a5('0x11')],_0x2aeb79);_0x3c94e4(_0xda0644[_0x79a5('0xf')](0x1f4,_0x3e8f7f[_0x79a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 8b6f6c9..1035328 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 _0x9b67=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x1ca995,_0x458edc){var _0x6c1cbb=function(_0x109124){while(--_0x109124){_0x1ca995['push'](_0x1ca995['shift']());}};_0x6c1cbb(++_0x458edc);}(_0x9b67,0xf6));var _0x79b6=function(_0x2b5f15,_0x29c205){_0x2b5f15=_0x2b5f15-0x0;var _0x597874=_0x9b67[_0x2b5f15];return _0x597874;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express['Router']();var auth=require(_0x79b6('0x5'));var interaction=require(_0x79b6('0x6'));var config=require('../../config/environment');var controller=require('./mailInteraction.controller');router[_0x79b6('0x7')]('/',auth[_0x79b6('0x8')](),controller[_0x79b6('0x9')]);router[_0x79b6('0x7')](_0x79b6('0xa'),auth[_0x79b6('0x8')](),controller[_0x79b6('0xb')]);router['get'](_0x79b6('0xc'),auth[_0x79b6('0x8')](),controller[_0x79b6('0xd')]);router[_0x79b6('0x7')](_0x79b6('0xe'),auth['isAuthenticated'](),controller[_0x79b6('0xf')]);router[_0x79b6('0x7')](_0x79b6('0x10'),auth[_0x79b6('0x8')](),controller['download']);router['post']('/',auth[_0x79b6('0x8')](),controller[_0x79b6('0x11')]);router[_0x79b6('0x12')]('/:id/messages',auth[_0x79b6('0x8')](),controller[_0x79b6('0x13')]);router[_0x79b6('0x12')](_0x79b6('0x14'),auth[_0x79b6('0x8')](),interaction[_0x79b6('0x15')](_0x79b6('0x16'),_0x79b6('0x17')),controller[_0x79b6('0x18')]);router[_0x79b6('0x19')](_0x79b6('0xc'),auth[_0x79b6('0x8')](),interaction[_0x79b6('0x15')]('mail',_0x79b6('0x1a')),controller[_0x79b6('0x1b')]);router[_0x79b6('0x1c')](_0x79b6('0xc'),auth[_0x79b6('0x8')](),interaction[_0x79b6('0x15')](_0x79b6('0x16'),_0x79b6('0x1d')),controller[_0x79b6('0x1e')]);router[_0x79b6('0x1c')](_0x79b6('0x14'),auth[_0x79b6('0x8')](),controller[_0x79b6('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x90ae=['/:id/messages','getMessages','/:id/download','post','/:id/tags','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','tracked','mailinteraction:destroy','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x443090,_0x32dc42){var _0x1bbe64=function(_0x1611ac){while(--_0x1611ac){_0x443090['push'](_0x443090['shift']());}};_0x1bbe64(++_0x32dc42);}(_0x90ae,0x195));var _0xe90a=function(_0xdc613b,_0x503ef3){_0xdc613b=_0xdc613b-0x0;var _0x349a22=_0x90ae[_0xdc613b];return _0x349a22;};'use strict';var multer=require(_0xe90a('0x0'));var util=require(_0xe90a('0x1'));var path=require(_0xe90a('0x2'));var timeout=require('connect-timeout');var express=require(_0xe90a('0x3'));var router=express[_0xe90a('0x4')]();var auth=require(_0xe90a('0x5'));var interaction=require(_0xe90a('0x6'));var config=require(_0xe90a('0x7'));var controller=require(_0xe90a('0x8'));router[_0xe90a('0x9')]('/',auth[_0xe90a('0xa')](),controller[_0xe90a('0xb')]);router['get'](_0xe90a('0xc'),auth[_0xe90a('0xa')](),controller[_0xe90a('0xd')]);router[_0xe90a('0x9')](_0xe90a('0xe'),auth[_0xe90a('0xa')](),controller['show']);router[_0xe90a('0x9')](_0xe90a('0xf'),auth[_0xe90a('0xa')](),controller[_0xe90a('0x10')]);router[_0xe90a('0x9')](_0xe90a('0x11'),auth[_0xe90a('0xa')](),controller['download']);router[_0xe90a('0x12')]('/',auth[_0xe90a('0xa')](),controller['create']);router['post'](_0xe90a('0xf'),auth[_0xe90a('0xa')](),controller['addMessage']);router[_0xe90a('0x12')](_0xe90a('0x13'),auth[_0xe90a('0xa')](),interaction['tracked'](_0xe90a('0x14'),_0xe90a('0x15')),controller['addTags']);router[_0xe90a('0x16')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xe90a('0x14'),_0xe90a('0x17')),controller[_0xe90a('0x18')]);router[_0xe90a('0x19')](_0xe90a('0xe'),auth[_0xe90a('0xa')](),interaction[_0xe90a('0x1a')](_0xe90a('0x14'),_0xe90a('0x1b')),controller[_0xe90a('0x1c')]);router[_0xe90a('0x19')](_0xe90a('0x13'),auth[_0xe90a('0xa')](),controller['removeTags']);module[_0xe90a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index c43e03d..9311e33 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 _0x739c=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x276ee7,_0x2dbd47){var _0x2fc776=function(_0x2d6610){while(--_0x2d6610){_0x276ee7['push'](_0x276ee7['shift']());}};_0x2fc776(++_0x2dbd47);}(_0x739c,0x120));var _0xc739=function(_0x56949f,_0x54dd62){_0x56949f=_0x56949f-0x0;var _0x326f6d=_0x739c[_0x56949f];return _0x326f6d;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xc739('0x0'));module[_0xc739('0x1')]={'closed':{'type':Sequelize[_0xc739('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc739('0x3')]},'disposition':{'type':Sequelize[_0xc739('0x4')]},'secondDisposition':{'type':Sequelize[_0xc739('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc739('0x4')]},'note':{'type':Sequelize[_0xc739('0x4')]},'inReplyTo':{'type':Sequelize[_0xc739('0x4')](0x1fe)},'to':{'type':Sequelize[_0xc739('0x4')]},'cc':{'type':Sequelize[_0xc739('0x5')](_0xc739('0x6'))},'subject':{'type':Sequelize[_0xc739('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc739('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xc739('0x7')]('in',_0xc739('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc739('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc739('0x7')]('in',_0xc739('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xc739('0x5')](_0xc739('0x6'))},'lastMsgText':{'type':Sequelize['TEXT'](_0xc739('0x6'))}}; \ No newline at end of file +var _0x878d=['BOOLEAN','STRING','TEXT','long','DATE','ENUM','out','sequelize','exports'];(function(_0x2f4ee6,_0x24a540){var _0x28f20e=function(_0x239715){while(--_0x239715){_0x2f4ee6['push'](_0x2f4ee6['shift']());}};_0x28f20e(++_0x24a540);}(_0x878d,0x1db));var _0xd878=function(_0x11bf1b,_0x50581b){_0x11bf1b=_0x11bf1b-0x0;var _0x387d1c=_0x878d[_0x11bf1b];return _0x387d1c;};'use strict';var Sequelize=require(_0xd878('0x0'));var iconv=require('iconv');module[_0xd878('0x1')]={'closed':{'type':Sequelize[_0xd878('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd878('0x3')]},'secondDisposition':{'type':Sequelize[_0xd878('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd878('0x3')]},'note':{'type':Sequelize[_0xd878('0x3')]},'inReplyTo':{'type':Sequelize[_0xd878('0x3')](0x1fe)},'to':{'type':Sequelize[_0xd878('0x3')]},'cc':{'type':Sequelize[_0xd878('0x4')](_0xd878('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xd878('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd878('0x6')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xd878('0x6')]},'firstMsgDirection':{'type':Sequelize[_0xd878('0x7')]('in',_0xd878('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd878('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xd878('0x4')]('long')},'lastMsgText':{'type':Sequelize[_0xd878('0x4')](_0xd878('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 9ea140e..fd915ce 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 _0xb7e7=['destroy','describe','MailMessage','addMessage','ids','omit','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','setTags','emit','mailInteractionTags:save','removeTags','download','unix','join','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','readFileSync','build','writeFileSync','log','err','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','html-to-text','juice','../../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','./mailInteraction.socket','register','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','sendStatus','name','Users','fullname','Tags','TagIds','split','forEach','push','MailInteraction','findOne','lastMsgBody','then','lastMsgText','trimStart','fromString','catch','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','select','field','color','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','mail_interactions','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','$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','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','plainBody','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','merge','a.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.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.MailInteractionId\x20IN\x20?','sequelize','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','rawAttributes','include','options','create','body','update'];(function(_0x561d9f,_0x447dea){var _0x4ecca0=function(_0x51a659){while(--_0x51a659){_0x561d9f['push'](_0x561d9f['shift']());}};_0x4ecca0(++_0x447dea);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xb7e7[_0x2faddb];return _0x273c05;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var htmlToText=require(_0x7b7e('0xf'));var juice=require(_0x7b7e('0x10'));var Redis=require('ioredis');var authService=require(_0x7b7e('0x11'));var qs=require(_0x7b7e('0x12'));var as=require(_0x7b7e('0x13'));var hardwareService=require(_0x7b7e('0x14'));var logger=require(_0x7b7e('0x15'))(_0x7b7e('0x16'));var utils=require(_0x7b7e('0x17'));var config=require(_0x7b7e('0x18'));var licenseUtil=require(_0x7b7e('0x19'));var db=require('../../mysqldb')['db'];config[_0x7b7e('0x1a')]=_[_0x7b7e('0x1b')](config['redis'],{'host':_0x7b7e('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7b7e('0x1d'))[_0x7b7e('0x1e')](socket);function respondWithStatusCode(_0xf067da,_0x457ec5){_0x457ec5=_0x457ec5||0xcc;return function(_0x3d2fb2){if(_0x3d2fb2){return _0xf067da['sendStatus'](_0x457ec5);}return _0xf067da['status'](_0x457ec5)[_0x7b7e('0x1f')]();};}function respondWithResult(_0x36444d,_0x27f999){_0x27f999=_0x27f999||0xc8;return function(_0x26aaec){if(_0x26aaec){return _0x36444d[_0x7b7e('0x20')](_0x27f999)[_0x7b7e('0x21')](_0x26aaec);}};}function respondWithFilteredResult(_0x242368,_0x200ef7){return function(_0x2acb8c){if(_0x2acb8c){var _0x429a0e=_0x2acb8c[_0x7b7e('0x22')],_0x12e8e9=_0x200ef7[_0x7b7e('0x23')],_0x14f4fe=_0x200ef7[_0x7b7e('0x23')]+_0x200ef7[_0x7b7e('0x24')],_0x448980;if(_0x14f4fe>=_0x429a0e){_0x14f4fe=_0x429a0e;_0x448980=0xc8;}else{_0x448980=0xce;}_0x242368['status'](_0x448980);return _0x242368[_0x7b7e('0x25')](_0x7b7e('0x26'),_0x12e8e9+'-'+_0x14f4fe+'/'+_0x429a0e)[_0x7b7e('0x21')](_0x2acb8c);}return null;};}function patchUpdates(_0x4c0647){return function(_0x313122){try{jsonpatch[_0x7b7e('0x27')](_0x313122,_0x4c0647,!![]);}catch(_0x14243b){return BPromise[_0x7b7e('0x28')](_0x14243b);}return _0x313122[_0x7b7e('0x29')]();};}function saveUpdates(_0x303d8c,_0x28bf43){return function(_0x10a66a){if(_0x10a66a){return _0x10a66a['update'](_0x303d8c)['then'](function(_0x4a836a){return _0x4a836a;});}return null;};}function removeEntity(_0x26ee14,_0x22598e){return function(_0x23bfa3){if(_0x23bfa3){return _0x23bfa3['destroy']()['then'](function(){_0x26ee14['status'](0xcc)[_0x7b7e('0x1f')]();});}};}function handleEntityNotFound(_0x3c8192,_0x16a3c7){return function(_0x7aa71){if(!_0x7aa71){_0x3c8192[_0x7b7e('0x2a')](0x194);}return _0x7aa71;};}function handleError(_0x48fad1,_0x6a1e71){_0x6a1e71=_0x6a1e71||0x1f4;return function(_0x21a15){logger['error'](_0x21a15['stack']);if(_0x21a15['name']){delete _0x21a15[_0x7b7e('0x2b')];}_0x48fad1[_0x7b7e('0x20')](_0x6a1e71)['send'](_0x21a15);};}function getInteractionUsers(_0x3db8c4,_0x51d4b5){return new BPromise(function(_0x1b4341,_0xb9b6bf){try{if(_0x51d4b5[_0x3db8c4['id']]){_0x3db8c4[_0x7b7e('0x2c')]=_['map'](_0x51d4b5[_0x3db8c4['id']],function(_0x3960b8){return{'id':_0x3960b8['id'],'fullname':_0x3960b8[_0x7b7e('0x2d')]};});}}catch(_0x35602a){_0xb9b6bf(_0x35602a);}_0x1b4341(_0x3db8c4);});}function getInteractionTags(_0x326dd2,_0x33f9a1){return new BPromise(function(_0x5732ee,_0x41af57){try{if(_0x326dd2['TagIds']){_0x326dd2[_0x7b7e('0x2e')]=[];_0x326dd2[_0x7b7e('0x2f')][_0x7b7e('0x30')](',')[_0x7b7e('0x31')](function(_0x378faa){_0x326dd2[_0x7b7e('0x2e')][_0x7b7e('0x32')](_0x33f9a1[_0x378faa]);});}delete _0x326dd2['TagIds'];}catch(_0x5227a7){_0x41af57(_0x5227a7);}_0x5732ee(_0x326dd2);});}function getLastMessageText(_0xebcdbc){return new BPromise(function(_0x162b84,_0x5f25fe){return db[_0x7b7e('0x33')][_0x7b7e('0x34')]({'where':{'id':_0xebcdbc['id']},'attributes':[_0x7b7e('0x35'),'lastMsgText'],'raw':!![]})[_0x7b7e('0x36')](function(_0x256908){if(!_0x256908[_0x7b7e('0x37')]){_0xebcdbc[_0x7b7e('0x37')]=_[_0x7b7e('0x38')](htmlToText[_0x7b7e('0x39')](_0x256908[_0x7b7e('0x35')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0xebcdbc[_0x7b7e('0x37')]=_0x256908[_0x7b7e('0x37')];}_0x162b84(_0xebcdbc);})[_0x7b7e('0x3a')](function(_0xd5a64d){_0x5f25fe(_0xd5a64d);});});}function updateMailInteraction(_0x2d0620,_0x442366,_0xdcb8ef,_0x116563){return new BPromise(function(_0x279f46,_0x5a4f92){return getInteractionUsers(_0x2d0620,_0xdcb8ef)[_0x7b7e('0x36')](function(_0x156dca){return getInteractionTags(_0x156dca,_0x442366);})[_0x7b7e('0x36')](function(_0x242609){if(_0x116563){_0x279f46(getLastMessageText(_0x242609));}else{_0x279f46(_0x242609);}})[_0x7b7e('0x3a')](function(_0x909c65){_0x5a4f92(_0x909c65);});});}exports[_0x7b7e('0x3b')]=function(_0x1e6280,_0x1c6d11){var _0x18011c={},_0x5f3de5={},_0x3d6571={'count':0x0,'rows':[]};var _0x1fa75b=_[_0x7b7e('0x3c')](db[_0x7b7e('0x33')]['rawAttributes'],function(_0x280748){return{'name':_0x280748[_0x7b7e('0x3d')],'type':_0x280748[_0x7b7e('0x3e')]['key']};});_0x5f3de5['model']=_[_0x7b7e('0x3c')](_0x1fa75b,'name');_0x5f3de5[_0x7b7e('0x3f')]=_[_0x7b7e('0x40')](_0x1e6280['query']);_0x5f3de5[_0x7b7e('0x41')]=_[_0x7b7e('0x42')](_0x5f3de5[_0x7b7e('0x43')],_0x5f3de5[_0x7b7e('0x3f')]);_0x18011c[_0x7b7e('0x44')]=_[_0x7b7e('0x42')](_0x5f3de5[_0x7b7e('0x43')],qs[_0x7b7e('0x45')](_0x1e6280[_0x7b7e('0x3f')]['fields']));_0x18011c['attributes']=_0x18011c[_0x7b7e('0x44')]['length']?_0x18011c[_0x7b7e('0x44')]:_0x5f3de5['model'];if(!_0x1e6280['query'][_0x7b7e('0x46')]('nolimit')){_0x18011c[_0x7b7e('0x24')]=qs['limit'](_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x24')]);_0x18011c[_0x7b7e('0x23')]=qs[_0x7b7e('0x23')](_0x1e6280['query'][_0x7b7e('0x23')]);}_0x18011c[_0x7b7e('0x47')]=qs[_0x7b7e('0x48')](_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x48')]);_0x18011c[_0x7b7e('0x49')]=qs['filters'](_['pick'](_0x1e6280['query'],_0x5f3de5[_0x7b7e('0x41')]),_0x1fa75b);var _0x3576f1=[];var _0x2f9de2=squel[_0x7b7e('0x4a')]()[_0x7b7e('0x4b')]('id')[_0x7b7e('0x4b')]('name')[_0x7b7e('0x4b')](_0x7b7e('0x4c'))['from']('tools_tags');var _0x1dcb88=squel[_0x7b7e('0x4a')]()[_0x7b7e('0x4b')](_0x7b7e('0x4d'))[_0x7b7e('0x4b')](_0x7b7e('0x4e'))['field'](_0x7b7e('0x4f'))['from'](_0x7b7e('0x50'),'ui')[_0x7b7e('0x51')](_0x7b7e('0x52'),'u',_0x7b7e('0x53'));var _0x58e4e6=squel[_0x7b7e('0x4a')]()[_0x7b7e('0x54')](_0x7b7e('0x55'),'i')[_0x7b7e('0x51')](_0x7b7e('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x7b7e('0x51')](_0x7b7e('0x52'),'o',_0x7b7e('0x57'))[_0x7b7e('0x51')](_0x7b7e('0x58'),'a','a.id\x20=\x20i.MailAccountId')[_0x7b7e('0x51')](_0x7b7e('0x59'),'me',_0x7b7e('0x5a'))[_0x7b7e('0x51')](_0x7b7e('0x5b'),'it',_0x7b7e('0x5c'))[_0x7b7e('0x51')]('tools_tags','t',_0x7b7e('0x5d'));var _0x5d7c89=squel[_0x7b7e('0x5e')]();var _0x766a54=[];var _0x570303=squel[_0x7b7e('0x5e')]();var _0x44e3a0;if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x5f')]){_0x44e3a0=as[_0x7b7e('0x60')](_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x5f')]);var _0x5f15ce=_0x44e3a0[_0x7b7e('0x61')];for(var _0x3ff731=0x0;_0x3ff731<_0x44e3a0[_0x7b7e('0x62')][_0x7b7e('0x63')];_0x3ff731++){var _0x5b9ab5=_0x44e3a0['conditions'][_0x3ff731];var _0x5bdf1d='i';var _0x2471ad=_[_0x7b7e('0x64')](_0x1fa75b,[_0x7b7e('0x2b'),_0x5b9ab5['field']]);if(!_0x2471ad){switch(_0x5b9ab5['field']){case _0x7b7e('0x65'):if(_0x5b9ab5[_0x7b7e('0x66')]==0x1){_0x58e4e6['having']('`'+_0x5b9ab5[_0x7b7e('0x4b')]+_0x7b7e('0x67'));}else{_0x58e4e6[_0x7b7e('0x68')]('`'+_0x5b9ab5['field']+_0x7b7e('0x69'));}break;case _0x7b7e('0x6a'):if(_0x5b9ab5['operator']===_0x7b7e('0x6b')){if(_0x5b9ab5[_0x7b7e('0x66')][_0x7b7e('0x30')]('\x20')[_0x7b7e('0x63')]>0x1){_0x5d7c89[_0x5f15ce](_0x7b7e('0x6c'),qs[_0x7b7e('0x6d')](_0x5b9ab5[_0x7b7e('0x66')]),null);}else{var _0x2d1908='%'+_0x5b9ab5[_0x7b7e('0x66')]+'%';_0x5d7c89[_0x5f15ce]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2d1908,_0x2d1908,_0x2d1908);}}else{_0x2471ad=_[_0x7b7e('0x64')](_0x1fa75b,[_0x7b7e('0x2b'),'ContactId']);_0x5b9ab5[_0x7b7e('0x4b')]=_0x7b7e('0x6e');_0x1ebd58=as[_0x7b7e('0x6f')](_0x5bdf1d,_0x2471ad['type'],_0x5b9ab5);_0x5d7c89[_0x5f15ce](_0x1ebd58[_0x7b7e('0x70')],_0x1ebd58['value'][_0x7b7e('0x71')],_0x1ebd58[_0x7b7e('0x66')]['end']);}break;case _0x7b7e('0x72'):var _0x3b3168=_0x5b9ab5['value'][_0x7b7e('0x30')](',')[_0x7b7e('0x3c')](function(_0x1d43af){return Number(_0x1d43af);});_0x3b3168[_0x7b7e('0x31')](function(_0x5eb32c){_0x570303['or'](_0x7b7e('0x73'),'%,'+_0x5eb32c+',%');});_0x766a54=_[_0x7b7e('0x74')](_0x766a54,_0x3b3168);break;case _0x7b7e('0x75'):if(_0x5b9ab5[_0x7b7e('0x76')]===_0x7b7e('0x6b')){_0x5d7c89[_0x5f15ce](_0x7b7e('0x77'),'%'+_0x5b9ab5[_0x7b7e('0x66')]+'%',null);}else{_0x2471ad=_[_0x7b7e('0x64')](_0x1fa75b,[_0x7b7e('0x2b'),_0x7b7e('0x78')]);_0x5b9ab5['field']=_0x7b7e('0x78');_0x1ebd58=as['buildExpression'](_0x5bdf1d,_0x2471ad['type'],_0x5b9ab5);_0x5d7c89[_0x5f15ce](_0x1ebd58[_0x7b7e('0x70')],_0x1ebd58[_0x7b7e('0x66')][_0x7b7e('0x71')],_0x1ebd58[_0x7b7e('0x66')]['end']);}break;case _0x7b7e('0x79'):_0x1ebd58=as[_0x7b7e('0x6f')]('me',null,_0x5b9ab5);_0x5d7c89[_0x5f15ce](_0x1ebd58[_0x7b7e('0x70')],_0x1ebd58[_0x7b7e('0x66')][_0x7b7e('0x71')],_0x1ebd58[_0x7b7e('0x66')]['end']);break;}}else{var _0x1ebd58=as['buildExpression'](_0x5bdf1d,_0x2471ad['type'],_0x5b9ab5);_0x5d7c89[_0x5f15ce](_0x1ebd58[_0x7b7e('0x70')],_0x1ebd58['value'][_0x7b7e('0x71')],_0x1ebd58['value'][_0x7b7e('0x1f')]);}}}else{var _0x148dde=_(_0x1e6280['query'])[_0x7b7e('0x40')]()[_0x7b7e('0x3c')](function(_0x57e88f){return _[_0x7b7e('0x7a')](_0x1fa75b,[_0x7b7e('0x2b'),_0x57e88f])?_0x57e88f:undefined;})[_0x7b7e('0x7b')]()[_0x7b7e('0x66')]();if(!_[_0x7b7e('0x7c')](_0x148dde)){_0x148dde[_0x7b7e('0x31')](function(_0x8e9813){if(_0x8e9813===_0x7b7e('0x7d')){_0x58e4e6[_0x7b7e('0x49')](_0x7b7e('0x7e'),[]['concat'](_0x1e6280['query'][_0x8e9813]));}else if(_0x8e9813===_0x7b7e('0x7f')){var _0x46ac1f=JSON[_0x7b7e('0x80')](_0x1e6280[_0x7b7e('0x3f')][_0x8e9813])[_0x7b7e('0x81')];var _0x4e2c2b=JSON[_0x7b7e('0x80')](_0x1e6280['query'][_0x8e9813])[_0x7b7e('0x82')];_0x58e4e6[_0x7b7e('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x46ac1f,_0x4e2c2b);}else{if(_0x1e6280[_0x7b7e('0x3f')][_0x8e9813]===_0x7b7e('0x83')){_0x58e4e6[_0x7b7e('0x49')]('i.'+_0x8e9813+_0x7b7e('0x84'));}else{_0x58e4e6[_0x7b7e('0x49')]('i.'+_0x8e9813+_0x7b7e('0x85'),_0x1e6280[_0x7b7e('0x3f')][_0x8e9813]);}}});}if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x86')]){if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x86')]==0x1){_0x58e4e6['having'](_0x7b7e('0x87'));}else{_0x58e4e6[_0x7b7e('0x68')](_0x7b7e('0x88'));}}if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x89')]){_0x766a54=_[_0x7b7e('0x8a')](_0x1e6280[_0x7b7e('0x3f')]['tag'])?_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x89')]:new Array(_0x1e6280[_0x7b7e('0x3f')]['tag']);_0x766a54[_0x7b7e('0x31')](function(_0x195ae2){_0x570303['or'](_0x7b7e('0x73'),'%,'+_0x195ae2+',%');});}if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x8b')]){var _0x5ca9cd=_0x1e6280['query']['filter'][_0x7b7e('0x8c')]('\x5c','\x5c\x5c')[_0x7b7e('0x8c')](/'/g,'\x27\x27');if(qs[_0x7b7e('0x8d')](_0x5ca9cd)){_0x5d7c89['or']('i.id\x20LIKE\x20?',_0x5ca9cd+'%');}else if(qs[_0x7b7e('0x8e')](_0x5ca9cd)){_0x5d7c89['or'](_0x7b7e('0x8f'),_0x5ca9cd+'%');}else{_0x5d7c89['or'](_0x7b7e('0x90'),qs['getFullTextValue'](_0x5ca9cd))['or'](_0x7b7e('0x91'),qs[_0x7b7e('0x6d')](_0x5ca9cd));}}}_0x58e4e6[_0x7b7e('0x49')](_0x5d7c89);_0x58e4e6[_0x7b7e('0x92')]('i.id');var _0x315923={'type':db[_0x7b7e('0x93')][_0x7b7e('0x94')][_0x7b7e('0x95')],'raw':!![]};var _0x4f0745=_0x58e4e6['clone']();_0x4f0745[_0x7b7e('0x4b')]('i.id');_0x4f0745[_0x7b7e('0x4b')](_0x7b7e('0x96'),_0x7b7e('0x65'));if(_0x18011c[_0x7b7e('0x47')]){_0x18011c['order'][_0x7b7e('0x31')](function(_0x236b59){var _0x2e9cbc=_0x236b59[0x0]===_0x7b7e('0x97')?_0x236b59[0x0]:'i.'+_0x236b59[0x0];_0x58e4e6[_0x7b7e('0x47')](_0x2e9cbc,_0x236b59[0x1]===_0x7b7e('0x98')?![]:!![]);});}if(!_[_0x7b7e('0x7c')](_0x766a54)){_0x58e4e6[_0x7b7e('0x68')](_0x570303);_0x4f0745[_0x7b7e('0x49')](_0x7b7e('0x99'),_0x766a54);}BPromise[_0x7b7e('0x9a')]()[_0x7b7e('0x36')](function(){if(!_0x44e3a0){if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x7d')])return;_0x4f0745[_0x7b7e('0x49')](_0x7b7e('0x9b'));_0x58e4e6['where'](_0x7b7e('0x9b'));return;}if(_0x1e6280[_0x7b7e('0x9c')][_0x7b7e('0x9d')]!==_0x7b7e('0x9e'))return;return _0x1e6280[_0x7b7e('0x9c')][_0x7b7e('0x9f')]({'attributes':['id'],'raw':!![]})[_0x7b7e('0x36')](function(_0x5f075a){if(_[_0x7b7e('0x7c')](_0x5f075a)){_0x4f0745[_0x7b7e('0x49')](_0x7b7e('0xa0'));_0x58e4e6[_0x7b7e('0x49')](_0x7b7e('0xa0'));}else{_0x4f0745['where']('i.MailAccountId\x20IN\x20?',_[_0x7b7e('0x3c')](_0x5f075a,'id'));_0x58e4e6[_0x7b7e('0x49')](_0x7b7e('0x7e'),_[_0x7b7e('0x3c')](_0x5f075a,'id'));}});})[_0x7b7e('0x36')](function(){if(_0x1e6280[_0x7b7e('0x9c')][_0x7b7e('0x9d')]===_0x7b7e('0x9e')&&!_0x44e3a0&&!_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x7d')])return[];return db['sequelize'][_0x7b7e('0x3f')](_0x4f0745[_0x7b7e('0xa1')](),_0x315923);})[_0x7b7e('0x36')](function(_0x297a6f){_0x3d6571[_0x7b7e('0x22')]=_0x297a6f[_0x7b7e('0x63')];if(_0x3d6571[_0x7b7e('0x22')]===0x0)return[];return db['sequelize'][_0x7b7e('0x3f')](_0x2f9de2['toString'](),_0x315923)[_0x7b7e('0x36')](function(_0xdc6a5c){_0x3576f1=_['keyBy'](_0xdc6a5c,'id');_0x315923=_[_0x7b7e('0xa2')](_0x315923,{'model':db[_0x7b7e('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x45')]){_0x18011c[_0x7b7e('0x44')]['forEach'](function(_0x222b46){_0x58e4e6['field']('i.'+_0x222b46);});}else{_0x58e4e6['field'](_0x7b7e('0x96'),_0x7b7e('0x65'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xa3'),'Account.key');_0x58e4e6[_0x7b7e('0x4b')]('a.mandatoryDisposition',_0x7b7e('0xa4'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xa5'),_0x7b7e('0x97'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xa6'));_0x58e4e6[_0x7b7e('0x4b')]('i.createdAt');_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xa7'));_0x58e4e6['field'](_0x7b7e('0xa8'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xa9'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xaa'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xab'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xac'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xad'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xae'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xaf'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xb0'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xb1'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xb2'));_0x58e4e6[_0x7b7e('0x4b')]('i.ContactId');_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xb3'));_0x58e4e6['field'](_0x7b7e('0xb4'));_0x58e4e6['field']('c.firstName',_0x7b7e('0xb5'));_0x58e4e6['field']('c.lastName',_0x7b7e('0xb6'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xb7'),'Contact.email');_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xb8'),_0x7b7e('0xb9'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xba'),_0x7b7e('0xbb'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xbc'),_0x7b7e('0xbd'));_0x58e4e6['field'](_0x7b7e('0xbe'),_0x7b7e('0xbf'));_0x58e4e6[_0x7b7e('0x4b')]('o.internal',_0x7b7e('0xc0'));_0x58e4e6[_0x7b7e('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x7b7e('0x2f'));}if(_0x18011c['limit'])_0x58e4e6['limit'](_0x18011c[_0x7b7e('0x24')]);if(_0x18011c[_0x7b7e('0x23')])_0x58e4e6['offset'](_0x18011c[_0x7b7e('0x23')]);return db['sequelize']['query'](_0x58e4e6[_0x7b7e('0xa1')](),_0x315923);})[_0x7b7e('0x36')](function(_0x2fac17){_0x1dcb88[_0x7b7e('0x49')](_0x7b7e('0xc1'),_[_0x7b7e('0x3c')](_0x2fac17,'id'));return db[_0x7b7e('0xc2')][_0x7b7e('0x3f')](_0x1dcb88['toString'](),_0x315923)[_0x7b7e('0x36')](function(_0x1e2bb7){var _0x3cc9bd=_[_0x7b7e('0xc3')](_0x1e2bb7,_0x7b7e('0xc4'));var _0x13c910=[];return db[_0x7b7e('0xc5')][_0x7b7e('0x34')]({'attributes':[_0x7b7e('0xc6')],'raw':!![]})[_0x7b7e('0x36')](function(_0x2f9f24){var _0x16ca92=_0x2f9f24['enableEmailPreview'];_0x2fac17['forEach'](function(_0x7d61a6){_0x13c910[_0x7b7e('0x32')](updateMailInteraction(_0x7d61a6,_0x3576f1,_0x3cc9bd,_0x16ca92));});return BPromise[_0x7b7e('0xc7')](_0x13c910);});});});})[_0x7b7e('0x36')](function(_0xb5e531){_0x3d6571[_0x7b7e('0xc8')]=_0xb5e531;return _0x3d6571;})[_0x7b7e('0x36')](respondWithFilteredResult(_0x1c6d11,_0x18011c))[_0x7b7e('0x3a')](handleError(_0x1c6d11,null));};exports[_0x7b7e('0xc9')]=function(_0x845b44,_0x1dfd0d){var _0x336f40={'raw':![],'where':{'id':_0x845b44[_0x7b7e('0xca')]['id']}},_0x4f22c5={};_0x4f22c5['model']=_[_0x7b7e('0x40')](db[_0x7b7e('0x33')][_0x7b7e('0xcb')]);_0x4f22c5['query']=_['keys'](_0x845b44['query']);_0x4f22c5[_0x7b7e('0x41')]=_[_0x7b7e('0x42')](_0x4f22c5[_0x7b7e('0x43')],_0x4f22c5[_0x7b7e('0x3f')]);_0x336f40[_0x7b7e('0x44')]=_[_0x7b7e('0x42')](_0x4f22c5[_0x7b7e('0x43')],qs[_0x7b7e('0x45')](_0x845b44[_0x7b7e('0x3f')][_0x7b7e('0x45')]));_0x336f40[_0x7b7e('0x44')]=_0x336f40['attributes'][_0x7b7e('0x63')]?_0x336f40[_0x7b7e('0x44')]:_0x4f22c5[_0x7b7e('0x43')];if(_0x845b44[_0x7b7e('0x3f')]['includeAll']){_0x336f40[_0x7b7e('0xcc')]=[{'all':!![]}];}_0x336f40=_[_0x7b7e('0xa2')]({},_0x336f40,_0x845b44[_0x7b7e('0xcd')]);return db[_0x7b7e('0x33')][_0x7b7e('0x64')](_0x336f40)[_0x7b7e('0x36')](handleEntityNotFound(_0x1dfd0d,null))[_0x7b7e('0x36')](respondWithResult(_0x1dfd0d,null))[_0x7b7e('0x3a')](handleError(_0x1dfd0d,null));};exports[_0x7b7e('0xce')]=function(_0x34491e,_0x309a08){return db[_0x7b7e('0x33')][_0x7b7e('0xce')](_0x34491e[_0x7b7e('0xcf')],{})[_0x7b7e('0x36')](respondWithResult(_0x309a08,0xc9))[_0x7b7e('0x3a')](handleError(_0x309a08,null));};exports[_0x7b7e('0xd0')]=function(_0x451862,_0x1ba63b){if(_0x451862[_0x7b7e('0xcf')]['id']){delete _0x451862[_0x7b7e('0xcf')]['id'];}return db[_0x7b7e('0x33')][_0x7b7e('0x64')]({'where':{'id':_0x451862[_0x7b7e('0xca')]['id']}})[_0x7b7e('0x36')](handleEntityNotFound(_0x1ba63b,null))[_0x7b7e('0x36')](saveUpdates(_0x451862[_0x7b7e('0xcf')],null))[_0x7b7e('0x36')](respondWithResult(_0x1ba63b,null))['catch'](handleError(_0x1ba63b,null));};exports[_0x7b7e('0xd1')]=function(_0x4ebfa7,_0x48e6a3){return db['MailInteraction'][_0x7b7e('0x64')]({'where':{'id':_0x4ebfa7[_0x7b7e('0xca')]['id']}})['then'](handleEntityNotFound(_0x48e6a3,null))['then'](removeEntity(_0x48e6a3,null))[_0x7b7e('0x3a')](handleError(_0x48e6a3,null));};exports[_0x7b7e('0xd2')]=function(_0x3b1083,_0x5b0abe){return db[_0x7b7e('0x33')]['describe']()['then'](respondWithResult(_0x5b0abe,null))[_0x7b7e('0x3a')](handleError(_0x5b0abe,null));};exports['addMessage']=function(_0x4deac2,_0xc55b86,_0x32197a){return db[_0x7b7e('0xd3')]['find']({'where':{'id':_0x4deac2['params']['id']}})[_0x7b7e('0x36')](handleEntityNotFound(_0xc55b86,null))[_0x7b7e('0x36')](function(_0x3f5130){if(_0x3f5130){return _0x3f5130[_0x7b7e('0xd4')](_0x4deac2[_0x7b7e('0xcf')][_0x7b7e('0xd5')],_[_0x7b7e('0xd6')](_0x4deac2[_0x7b7e('0xcf')],[_0x7b7e('0xd5'),'id'])||{});}})['then'](respondWithResult(_0xc55b86,null))[_0x7b7e('0x3a')](handleError(_0xc55b86,null));};exports['getMessages']=function(_0x459b23,_0x46690c,_0x41568a){var _0x38fc4f={'raw':![],'where':{}};var _0xc8849f={};var _0x4dfe50={'count':0x0,'rows':[]};return db[_0x7b7e('0x33')][_0x7b7e('0x34')]({'where':{'id':_0x459b23[_0x7b7e('0xca')]['id']}})[_0x7b7e('0x36')](handleEntityNotFound(_0x46690c,null))['then'](function(_0x137ba6){if(_0x137ba6){_0xc8849f[_0x7b7e('0x43')]=_['keys'](db[_0x7b7e('0xd3')][_0x7b7e('0xcb')]);_0xc8849f[_0x7b7e('0x3f')]=_[_0x7b7e('0x40')](_0x459b23[_0x7b7e('0x3f')]);_0xc8849f[_0x7b7e('0x41')]=_[_0x7b7e('0x42')](_0xc8849f[_0x7b7e('0x43')],_0xc8849f[_0x7b7e('0x3f')]);_0x38fc4f[_0x7b7e('0x44')]=_[_0x7b7e('0x42')](_0xc8849f['model'],qs[_0x7b7e('0x45')](_0x459b23[_0x7b7e('0x3f')]['fields']));_0x38fc4f[_0x7b7e('0x44')]=_0x38fc4f['attributes'][_0x7b7e('0x63')]?_0x38fc4f[_0x7b7e('0x44')]:_0xc8849f[_0x7b7e('0x43')];if(!_0x459b23['query'][_0x7b7e('0x46')](_0x7b7e('0xd7'))){_0x38fc4f[_0x7b7e('0x24')]=qs[_0x7b7e('0x24')](_0x459b23[_0x7b7e('0x3f')][_0x7b7e('0x24')]);_0x38fc4f[_0x7b7e('0x23')]=qs[_0x7b7e('0x23')](_0x459b23[_0x7b7e('0x3f')][_0x7b7e('0x23')]);}_0x38fc4f['order']=qs[_0x7b7e('0x48')](_0x459b23[_0x7b7e('0x3f')][_0x7b7e('0x48')]);_0x38fc4f['where']=qs['filters'](_[_0x7b7e('0xd8')](_0x459b23['query'],_0xc8849f['filters']));_0x38fc4f[_0x7b7e('0x49')][_0x7b7e('0xc4')]=_0x137ba6['id'];if(_0x459b23[_0x7b7e('0x3f')]['filter']){_0x38fc4f[_0x7b7e('0x49')]=_[_0x7b7e('0xa2')](_0x38fc4f[_0x7b7e('0x49')],{'$or':_[_0x7b7e('0x3c')](_0x38fc4f[_0x7b7e('0x44')],function(_0x570345){var _0x294d0e={};_0x294d0e[_0x570345]={'$like':'%'+_0x459b23[_0x7b7e('0x3f')][_0x7b7e('0x8b')]+'%'};return _0x294d0e;})});}if(_0x459b23[_0x7b7e('0x3f')][_0x7b7e('0x81')]){var _0x4299dd=_0x459b23['query']['$gte'][_0x7b7e('0x30')](',');var _0x4a9784={};_0x4a9784[_0x4299dd[0x0]]={'$gte':moment(_0x4299dd[0x1])[_0x7b7e('0xd9')](_0x7b7e('0xda'))};_0x38fc4f[_0x7b7e('0x49')]=_[_0x7b7e('0xa2')](_0x38fc4f[_0x7b7e('0x49')],_0x4a9784);}_0x38fc4f=_[_0x7b7e('0xa2')]({},_0x38fc4f,_0x459b23[_0x7b7e('0xcd')]);return db['MailMessage']['count']({'where':_0x38fc4f[_0x7b7e('0x49')]})[_0x7b7e('0x36')](function(_0x57852b){_0x4dfe50[_0x7b7e('0x22')]=_0x57852b;if(_0x459b23[_0x7b7e('0x3f')]['includeAll']){_0x38fc4f['include']=[{'all':!![]}];}return db[_0x7b7e('0xd3')][_0x7b7e('0xdb')](_0x38fc4f);})[_0x7b7e('0x36')](function(_0x5c8b43){if(_0x459b23[_0x7b7e('0x3f')][_0x7b7e('0xdc')]===_0x7b7e('0xdd')){for(var _0x23bcbc=0x0;_0x23bcbc<_0x5c8b43[_0x7b7e('0x63')];_0x23bcbc++){_0x5c8b43[_0x23bcbc][_0x7b7e('0xcf')]=juice(_0x5c8b43[_0x23bcbc][_0x7b7e('0xcf')]);}}_0x4dfe50[_0x7b7e('0xc8')]=_0x5c8b43;return _0x4dfe50;});}})[_0x7b7e('0x36')](respondWithFilteredResult(_0x46690c,_0x38fc4f))[_0x7b7e('0x3a')](handleError(_0x46690c,null));};exports['addTags']=function(_0x4e7778,_0x5b190a,_0x38e8e6){return db['MailInteraction'][_0x7b7e('0x64')]({'where':{'id':_0x4e7778[_0x7b7e('0xca')]['id']}})[_0x7b7e('0x36')](handleEntityNotFound(_0x5b190a,null))['then'](function(_0xa058e6){if(_0xa058e6){return _0xa058e6[_0x7b7e('0xde')](_0x4e7778[_0x7b7e('0xcf')][_0x7b7e('0xd5')],_[_0x7b7e('0xd6')](_0x4e7778[_0x7b7e('0xcf')],[_0x7b7e('0xd5'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x7b7e('0x2b'),_0x7b7e('0x4c')],'where':{'id':_0x4e7778[_0x7b7e('0xcf')][_0x7b7e('0xd5')]}});})[_0x7b7e('0x36')](function(_0xfc2b35){socket[_0x7b7e('0xdf')](_0x7b7e('0xe0'),{'id':Number(_0x4e7778[_0x7b7e('0xca')]['id']),'tags':_0xfc2b35||[]});return{'id':Number(_0x4e7778['params']['id']),'tags':_0xfc2b35||[]};});}})[_0x7b7e('0x36')](respondWithResult(_0x5b190a,null))[_0x7b7e('0x3a')](handleError(_0x5b190a,null));};exports[_0x7b7e('0xe1')]=function(_0x593a09,_0x188c70,_0x57d6fe){return db[_0x7b7e('0x33')][_0x7b7e('0x64')]({'where':{'id':_0x593a09[_0x7b7e('0xca')]['id']}})[_0x7b7e('0x36')](handleEntityNotFound(_0x188c70,null))['then'](function(_0x40b101){if(_0x40b101){return _0x40b101[_0x7b7e('0xe1')](_0x593a09[_0x7b7e('0x3f')][_0x7b7e('0xd5')]);}})[_0x7b7e('0x36')](respondWithStatusCode(_0x188c70,null))['catch'](handleError(_0x188c70,null));};exports[_0x7b7e('0xe2')]=function(_0xffaeea,_0x1aa06f){var _0x270cb9=moment()[_0x7b7e('0xe3')]()[_0x7b7e('0xa1')]();var _0x2502c0=path[_0x7b7e('0xe4')](config['root'],_0x7b7e('0xe5'),_0x7b7e('0xe6'),_0x7b7e('0xe7'));var _0x3ac56f=path[_0x7b7e('0xe4')](config['root'],_0x7b7e('0xe5'),_0x7b7e('0xe6'),_0x7b7e('0xe8'));var _0x3b972e=path[_0x7b7e('0xe4')](_0x2502c0,_0x270cb9);var _0x7fe4fe=util[_0x7b7e('0xd9')](_0x7b7e('0xe9'),_0xffaeea[_0x7b7e('0xca')]['id'],_0x270cb9);var _0x368a2b=path['join'](_0x2502c0,_0x7fe4fe);var _0x44d724=[];if(_0xffaeea['query'][_0x7b7e('0xe8')]){_0x44d724[_0x7b7e('0x32')]({'model':db[_0x7b7e('0xea')],'as':_0x7b7e('0xeb'),'raw':!![]});}var _0x2b23bf=[{'model':db[_0x7b7e('0xd3')],'as':_0x7b7e('0xec'),'attributes':['id',_0x7b7e('0xcf'),_0x7b7e('0x54'),'to','cc',_0x7b7e('0xed'),_0x7b7e('0xee'),_0x7b7e('0x7f')],'where':{'secret':![]},'order':qs[_0x7b7e('0x48')]('id'),'include':_0x44d724}];return db['MailInteraction']['find']({'where':{'id':_0xffaeea[_0x7b7e('0xca')]['id']},'include':_0x2b23bf})['then'](handleEntityNotFound(_0x1aa06f,null))[_0x7b7e('0x36')](function(_0x229b43){if(_0x229b43&&_0x229b43[_0x7b7e('0xec')]){var _0x28fe8a=_0x229b43[_0x7b7e('0xef')]({'plain':!![]});fs['mkdirSync'](_0x3b972e);return BPromise[_0x7b7e('0xf0')](_0x28fe8a['Messages'],function(_0x4c79cd,_0x4fd511){var _0x4213ae={'from':_0x4c79cd[_0x7b7e('0x54')],'to':_0x4c79cd['to'],'subject':_0x4c79cd[_0x7b7e('0xee')],'html':_0x4c79cd[_0x7b7e('0xcf')],'headers':{'Date':moment(_0x4c79cd[_0x7b7e('0x7f')])[_0x7b7e('0xd9')](_0x7b7e('0xf1'))},'attachments':[]};if(_0x4c79cd['cc']){_0x4213ae['headers']['Cc']=_0x4c79cd['cc'];}if(_0x4c79cd[_0x7b7e('0xed')]){_0x4213ae[_0x7b7e('0xf2')][_0x7b7e('0xf3')]=_0x4c79cd[_0x7b7e('0xed')];}return new BPromise(function(_0x10a228,_0x1c4f7c){if(_0x4c79cd[_0x7b7e('0xeb')]){for(var _0x7025d7=0x0;_0x7025d7<_0x4c79cd[_0x7b7e('0xeb')][_0x7b7e('0x63')];_0x7025d7++){var _0x4510f6=_0x4c79cd[_0x7b7e('0xeb')][_0x7025d7];var _0x23e672=path[_0x7b7e('0xe4')](_0x3ac56f,_0x4510f6['basename']);if(fs['existsSync'](_0x23e672)){_0x4213ae[_0x7b7e('0xe8')][_0x7b7e('0x32')]({'name':_0x4510f6[_0x7b7e('0x2b')],'contentType':_0x4510f6['type'],'data':fs[_0x7b7e('0xf4')](_0x23e672)});}}}emlformat[_0x7b7e('0xf5')](_0x4213ae,function(_0x1fecfb,_0x40203f){if(_0x1fecfb)return _0x1c4f7c(_0x1fecfb);fs[_0x7b7e('0xf6')](path['join'](_0x3b972e,util['format']('message%d.eml',_0x4fd511)),_0x40203f);return _0x10a228(_0x40203f);});});})[_0x7b7e('0x36')](function(){return new BPromise(function(_0xec692d,_0x3a5b34){zipdir(_0x3b972e,{'saveTo':_0x368a2b},function(_0x929974,_0x3f0f57){if(_0x929974)return _0x3a5b34(_0x929974);return _0xec692d(_0x3f0f57);});})['then'](function(){return new BPromise(function(_0x27bd67,_0x4a491a){rimraf(_0x3b972e,function(_0x2d17ae){if(_0x2d17ae)_0x4a491a(_0x2d17ae);return _0x27bd67();});});})['then'](function(){return _0x1aa06f['download'](_0x368a2b,_0x7fe4fe,function(_0x4d5be8){if(_0x4d5be8){console[_0x7b7e('0xf7')](_0x7b7e('0xf8'),_0x4d5be8);}else{fs['unlinkSync'](_0x368a2b);}});});});}else{return _0x1aa06f[_0x7b7e('0x2a')](0xc8);}})[_0x7b7e('0x3a')](handleError(_0x1aa06f,null));}; \ No newline at end of file +var _0xa5fa=['destroy','then','error','name','send','map','fullname','TagIds','Tags','split','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','pick','color','from','tools_tags','field','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','search','parseSearch','conditions','length','find','having','`\x20>\x200','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','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','compact','isEmpty','MailAccountId','where','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','role','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','contactName','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','show','params','includeAll','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','emit','mailInteractionTags:save','removeTags','download','root','server','files','tmp','join','attachments','Attachment','bcc','Messages','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','html-to-text','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa5fa,0xc4));var _0xaa5f=function(_0xd93cbe,_0x11202e){_0xd93cbe=_0xd93cbe-0x0;var _0xe0bb40=_0xa5fa[_0xd93cbe];return _0xe0bb40;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaa5f('0x0'));var rimraf=require(_0xaa5f('0x1'));var zipdir=require(_0xaa5f('0x2'));var jsonpatch=require(_0xaa5f('0x3'));var rp=require('request-promise');var moment=require(_0xaa5f('0x4'));var BPromise=require(_0xaa5f('0x5'));var Mustache=require('mustache');var util=require(_0xaa5f('0x6'));var path=require(_0xaa5f('0x7'));var sox=require(_0xaa5f('0x8'));var csv=require(_0xaa5f('0x9'));var ejs=require(_0xaa5f('0xa'));var fs=require('fs');var _=require(_0xaa5f('0xb'));var squel=require(_0xaa5f('0xc'));var crypto=require(_0xaa5f('0xd'));var jsforce=require(_0xaa5f('0xe'));var deskjs=require(_0xaa5f('0xf'));var toCsv=require(_0xaa5f('0x9'));var querystring=require('querystring');var Papa=require(_0xaa5f('0x10'));var htmlToText=require(_0xaa5f('0x11'));var juice=require('juice');var Redis=require('ioredis');var authService=require(_0xaa5f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa5f('0x13'));var logger=require('../../config/logger')(_0xaa5f('0x14'));var utils=require(_0xaa5f('0x15'));var config=require(_0xaa5f('0x16'));var licenseUtil=require(_0xaa5f('0x17'));var db=require(_0xaa5f('0x18'))['db'];config['redis']=_[_0xaa5f('0x19')](config['redis'],{'host':_0xaa5f('0x1a'),'port':0x18eb});var socket=require(_0xaa5f('0x1b'))(new Redis(config[_0xaa5f('0x1c')]));require(_0xaa5f('0x1d'))[_0xaa5f('0x1e')](socket);function respondWithStatusCode(_0x5a4c41,_0x4fc828){_0x4fc828=_0x4fc828||0xcc;return function(_0x1f37fb){if(_0x1f37fb){return _0x5a4c41[_0xaa5f('0x1f')](_0x4fc828);}return _0x5a4c41[_0xaa5f('0x20')](_0x4fc828)[_0xaa5f('0x21')]();};}function respondWithResult(_0x27fdca,_0x1fa36a){_0x1fa36a=_0x1fa36a||0xc8;return function(_0x22a797){if(_0x22a797){return _0x27fdca[_0xaa5f('0x20')](_0x1fa36a)[_0xaa5f('0x22')](_0x22a797);}};}function respondWithFilteredResult(_0x3d874f,_0x22175f){return function(_0x1019e8){if(_0x1019e8){var _0x4f4cd5=_0x1019e8[_0xaa5f('0x23')],_0x1c072=_0x22175f[_0xaa5f('0x24')],_0x4c0a9d=_0x22175f[_0xaa5f('0x24')]+_0x22175f[_0xaa5f('0x25')],_0x1cbab5;if(_0x4c0a9d>=_0x4f4cd5){_0x4c0a9d=_0x4f4cd5;_0x1cbab5=0xc8;}else{_0x1cbab5=0xce;}_0x3d874f[_0xaa5f('0x20')](_0x1cbab5);return _0x3d874f[_0xaa5f('0x26')](_0xaa5f('0x27'),_0x1c072+'-'+_0x4c0a9d+'/'+_0x4f4cd5)[_0xaa5f('0x22')](_0x1019e8);}return null;};}function patchUpdates(_0x10f287){return function(_0x998ab5){try{jsonpatch['apply'](_0x998ab5,_0x10f287,!![]);}catch(_0x1e917d){return BPromise['reject'](_0x1e917d);}return _0x998ab5[_0xaa5f('0x28')]();};}function saveUpdates(_0x34ca72,_0x561381){return function(_0x1baa2e){if(_0x1baa2e){return _0x1baa2e[_0xaa5f('0x29')](_0x34ca72)['then'](function(_0xf6a8c3){return _0xf6a8c3;});}return null;};}function removeEntity(_0x15f70b,_0x32cd16){return function(_0xa09273){if(_0xa09273){return _0xa09273[_0xaa5f('0x2a')]()[_0xaa5f('0x2b')](function(){_0x15f70b[_0xaa5f('0x20')](0xcc)[_0xaa5f('0x21')]();});}};}function handleEntityNotFound(_0x51eb55,_0x2445a6){return function(_0x3a66e8){if(!_0x3a66e8){_0x51eb55[_0xaa5f('0x1f')](0x194);}return _0x3a66e8;};}function handleError(_0x5a7cf1,_0x3b17b6){_0x3b17b6=_0x3b17b6||0x1f4;return function(_0x269209){logger[_0xaa5f('0x2c')](_0x269209['stack']);if(_0x269209[_0xaa5f('0x2d')]){delete _0x269209['name'];}_0x5a7cf1['status'](_0x3b17b6)[_0xaa5f('0x2e')](_0x269209);};}function getInteractionUsers(_0x50998f,_0x1bffec){return new BPromise(function(_0x4e0ec9,_0x4c5dc0){try{if(_0x1bffec[_0x50998f['id']]){_0x50998f['Users']=_[_0xaa5f('0x2f')](_0x1bffec[_0x50998f['id']],function(_0x4ddebd){return{'id':_0x4ddebd['id'],'fullname':_0x4ddebd[_0xaa5f('0x30')]};});}}catch(_0xc0bb03){_0x4c5dc0(_0xc0bb03);}_0x4e0ec9(_0x50998f);});}function getInteractionTags(_0x555876,_0x58f608){return new BPromise(function(_0x169637,_0x5e858a){try{if(_0x555876[_0xaa5f('0x31')]){_0x555876[_0xaa5f('0x32')]=[];_0x555876['TagIds'][_0xaa5f('0x33')](',')[_0xaa5f('0x34')](function(_0x9c733b){_0x555876['Tags'][_0xaa5f('0x35')](_0x58f608[_0x9c733b]);});}delete _0x555876[_0xaa5f('0x31')];}catch(_0x527866){_0x5e858a(_0x527866);}_0x169637(_0x555876);});}function getLastMessageText(_0x57591f){return new BPromise(function(_0x586210,_0x4a0abe){return db[_0xaa5f('0x36')][_0xaa5f('0x37')]({'where':{'id':_0x57591f['id']},'attributes':[_0xaa5f('0x38'),_0xaa5f('0x39')],'raw':!![]})[_0xaa5f('0x2b')](function(_0x3bcaf6){if(!_0x3bcaf6[_0xaa5f('0x39')]){_0x57591f['lastMsgText']=_[_0xaa5f('0x3a')](htmlToText[_0xaa5f('0x3b')](_0x3bcaf6[_0xaa5f('0x38')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x57591f[_0xaa5f('0x39')]=_0x3bcaf6[_0xaa5f('0x39')];}_0x586210(_0x57591f);})[_0xaa5f('0x3c')](function(_0x49442c){_0x4a0abe(_0x49442c);});});}function updateMailInteraction(_0x5a7410,_0x3131c2,_0x200f6a,_0x2ac0f8){return new BPromise(function(_0x3dc2f5,_0x56ac45){return getInteractionUsers(_0x5a7410,_0x200f6a)['then'](function(_0x43126e){return getInteractionTags(_0x43126e,_0x3131c2);})[_0xaa5f('0x2b')](function(_0x2cb464){if(_0x2ac0f8){_0x3dc2f5(getLastMessageText(_0x2cb464));}else{_0x3dc2f5(_0x2cb464);}})[_0xaa5f('0x3c')](function(_0x56826c){_0x56ac45(_0x56826c);});});}exports[_0xaa5f('0x3d')]=function(_0x8f1583,_0x1a59d2){var _0xb16782={},_0x37db88={},_0x1869c2={'count':0x0,'rows':[]};var _0xc4735b=_[_0xaa5f('0x2f')](db[_0xaa5f('0x36')][_0xaa5f('0x3e')],function(_0x10b361){return{'name':_0x10b361['fieldName'],'type':_0x10b361[_0xaa5f('0x3f')][_0xaa5f('0x40')]};});_0x37db88[_0xaa5f('0x41')]=_[_0xaa5f('0x2f')](_0xc4735b,_0xaa5f('0x2d'));_0x37db88[_0xaa5f('0x42')]=_[_0xaa5f('0x43')](_0x8f1583[_0xaa5f('0x42')]);_0x37db88[_0xaa5f('0x44')]=_[_0xaa5f('0x45')](_0x37db88['model'],_0x37db88[_0xaa5f('0x42')]);_0xb16782['attributes']=_[_0xaa5f('0x45')](_0x37db88[_0xaa5f('0x41')],qs[_0xaa5f('0x46')](_0x8f1583['query'][_0xaa5f('0x46')]));_0xb16782[_0xaa5f('0x47')]=_0xb16782[_0xaa5f('0x47')]['length']?_0xb16782[_0xaa5f('0x47')]:_0x37db88[_0xaa5f('0x41')];if(!_0x8f1583[_0xaa5f('0x42')][_0xaa5f('0x48')]('nolimit')){_0xb16782[_0xaa5f('0x25')]=qs[_0xaa5f('0x25')](_0x8f1583[_0xaa5f('0x42')][_0xaa5f('0x25')]);_0xb16782[_0xaa5f('0x24')]=qs[_0xaa5f('0x24')](_0x8f1583[_0xaa5f('0x42')][_0xaa5f('0x24')]);}_0xb16782['order']=qs[_0xaa5f('0x49')](_0x8f1583['query'][_0xaa5f('0x49')]);_0xb16782['where']=qs[_0xaa5f('0x44')](_[_0xaa5f('0x4a')](_0x8f1583['query'],_0x37db88[_0xaa5f('0x44')]),_0xc4735b);var _0x1530a1=[];var _0x21cea0=squel['select']()['field']('id')['field'](_0xaa5f('0x2d'))['field'](_0xaa5f('0x4b'))[_0xaa5f('0x4c')](_0xaa5f('0x4d'));var _0x1bf6cc=squel['select']()[_0xaa5f('0x4e')](_0xaa5f('0x4f'))[_0xaa5f('0x4e')](_0xaa5f('0x50'))[_0xaa5f('0x4e')](_0xaa5f('0x51'))[_0xaa5f('0x4c')](_0xaa5f('0x52'),'ui')[_0xaa5f('0x53')](_0xaa5f('0x54'),'u',_0xaa5f('0x55'));var _0x2de737=squel[_0xaa5f('0x56')]()[_0xaa5f('0x4c')](_0xaa5f('0x57'),'i')[_0xaa5f('0x53')]('cm_contacts','c',_0xaa5f('0x58'))[_0xaa5f('0x53')](_0xaa5f('0x54'),'o',_0xaa5f('0x59'))[_0xaa5f('0x53')](_0xaa5f('0x5a'),'a',_0xaa5f('0x5b'))['left_join'](_0xaa5f('0x5c'),'me',_0xaa5f('0x5d'))[_0xaa5f('0x53')](_0xaa5f('0x5e'),'it','it.MailInteractionId\x20=\x20i.id')[_0xaa5f('0x53')](_0xaa5f('0x4d'),'t',_0xaa5f('0x5f'));var _0x575803=squel['expr']();var _0x506dce=[];var _0x56cdd6=squel['expr']();var _0x509c61;if(_0x8f1583[_0xaa5f('0x42')][_0xaa5f('0x60')]){_0x509c61=as[_0xaa5f('0x61')](_0x8f1583[_0xaa5f('0x42')][_0xaa5f('0x60')]);var _0x17b872=_0x509c61['sqlOperator'];for(var _0x584a3d=0x0;_0x584a3d<_0x509c61[_0xaa5f('0x62')][_0xaa5f('0x63')];_0x584a3d++){var _0x47bc41=_0x509c61[_0xaa5f('0x62')][_0x584a3d];var _0x2e6895='i';var _0x2b815d=_[_0xaa5f('0x64')](_0xc4735b,[_0xaa5f('0x2d'),_0x47bc41[_0xaa5f('0x4e')]]);if(!_0x2b815d){switch(_0x47bc41[_0xaa5f('0x4e')]){case'unreadMessages':if(_0x47bc41['value']==0x1){_0x2de737[_0xaa5f('0x65')]('`'+_0x47bc41[_0xaa5f('0x4e')]+'`\x20=\x200');}else{_0x2de737['having']('`'+_0x47bc41['field']+_0xaa5f('0x66'));}break;case'Contact':if(_0x47bc41[_0xaa5f('0x67')]==='$substring'){if(_0x47bc41['value'][_0xaa5f('0x33')]('\x20')[_0xaa5f('0x63')]>0x1){_0x575803[_0x17b872](_0xaa5f('0x68'),qs['getFullTextValue'](_0x47bc41[_0xaa5f('0x69')]),null);}else{var _0x239e51='%'+_0x47bc41[_0xaa5f('0x69')]+'%';_0x575803[_0x17b872]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x239e51,_0x239e51,_0x239e51);}}else{_0x2b815d=_[_0xaa5f('0x64')](_0xc4735b,[_0xaa5f('0x2d'),'ContactId']);_0x47bc41[_0xaa5f('0x4e')]=_0xaa5f('0x6a');_0x3df338=as[_0xaa5f('0x6b')](_0x2e6895,_0x2b815d[_0xaa5f('0x3f')],_0x47bc41);_0x575803[_0x17b872](_0x3df338[_0xaa5f('0x6c')],_0x3df338[_0xaa5f('0x69')][_0xaa5f('0x6d')],_0x3df338[_0xaa5f('0x69')][_0xaa5f('0x21')]);}break;case'Tag':var _0x7e4313=_0x47bc41[_0xaa5f('0x69')][_0xaa5f('0x33')](',')[_0xaa5f('0x2f')](function(_0x1cbc61){return Number(_0x1cbc61);});_0x7e4313[_0xaa5f('0x34')](function(_0x7af53e){_0x56cdd6['or'](_0xaa5f('0x6e'),'%,'+_0x7af53e+',%');});_0x506dce=_['union'](_0x506dce,_0x7e4313);break;case _0xaa5f('0x6f'):if(_0x47bc41['operator']===_0xaa5f('0x70')){_0x575803[_0x17b872](_0xaa5f('0x71'),'%'+_0x47bc41[_0xaa5f('0x69')]+'%',null);}else{_0x2b815d=_[_0xaa5f('0x64')](_0xc4735b,['name',_0xaa5f('0x72')]);_0x47bc41[_0xaa5f('0x4e')]=_0xaa5f('0x72');_0x3df338=as['buildExpression'](_0x2e6895,_0x2b815d[_0xaa5f('0x3f')],_0x47bc41);_0x575803[_0x17b872](_0x3df338['text'],_0x3df338[_0xaa5f('0x69')]['start'],_0x3df338[_0xaa5f('0x69')][_0xaa5f('0x21')]);}break;case _0xaa5f('0x73'):_0x3df338=as[_0xaa5f('0x6b')]('me',null,_0x47bc41);_0x575803[_0x17b872](_0x3df338['text'],_0x3df338[_0xaa5f('0x69')][_0xaa5f('0x6d')],_0x3df338['value']['end']);break;}}else{var _0x3df338=as[_0xaa5f('0x6b')](_0x2e6895,_0x2b815d['type'],_0x47bc41);_0x575803[_0x17b872](_0x3df338[_0xaa5f('0x6c')],_0x3df338[_0xaa5f('0x69')][_0xaa5f('0x6d')],_0x3df338['value'][_0xaa5f('0x21')]);}}}else{var _0x15af7c=_(_0x8f1583['query'])[_0xaa5f('0x43')]()[_0xaa5f('0x2f')](function(_0x47835d){return _['some'](_0xc4735b,[_0xaa5f('0x2d'),_0x47835d])?_0x47835d:undefined;})[_0xaa5f('0x74')]()['value']();if(!_[_0xaa5f('0x75')](_0x15af7c)){_0x15af7c[_0xaa5f('0x34')](function(_0x2f1f32){if(_0x2f1f32===_0xaa5f('0x76')){_0x2de737[_0xaa5f('0x77')]('i.MailAccountId\x20IN\x20?',[][_0xaa5f('0x78')](_0x8f1583[_0xaa5f('0x42')][_0x2f1f32]));}else if(_0x2f1f32===_0xaa5f('0x79')){var _0x216399=JSON[_0xaa5f('0x7a')](_0x8f1583['query'][_0x2f1f32])[_0xaa5f('0x7b')];var _0x597b33=JSON[_0xaa5f('0x7a')](_0x8f1583[_0xaa5f('0x42')][_0x2f1f32])[_0xaa5f('0x7c')];_0x2de737[_0xaa5f('0x77')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x216399,_0x597b33);}else{if(_0x8f1583[_0xaa5f('0x42')][_0x2f1f32]===_0xaa5f('0x7d')){_0x2de737[_0xaa5f('0x77')]('i.'+_0x2f1f32+_0xaa5f('0x7e'));}else{_0x2de737[_0xaa5f('0x77')]('i.'+_0x2f1f32+_0xaa5f('0x7f'),_0x8f1583['query'][_0x2f1f32]);}}});}if(_0x8f1583['query'][_0xaa5f('0x80')]){if(_0x8f1583[_0xaa5f('0x42')][_0xaa5f('0x80')]==0x1){_0x2de737[_0xaa5f('0x65')](_0xaa5f('0x81'));}else{_0x2de737['having']('`unreadMessages`\x20>\x200');}}if(_0x8f1583[_0xaa5f('0x42')][_0xaa5f('0x82')]){_0x506dce=_['isArray'](_0x8f1583[_0xaa5f('0x42')]['tag'])?_0x8f1583[_0xaa5f('0x42')][_0xaa5f('0x82')]:new Array(_0x8f1583['query'][_0xaa5f('0x82')]);_0x506dce[_0xaa5f('0x34')](function(_0x214f02){_0x56cdd6['or'](_0xaa5f('0x6e'),'%,'+_0x214f02+',%');});}if(_0x8f1583[_0xaa5f('0x42')][_0xaa5f('0x83')]){var _0x4530a9=_0x8f1583['query'][_0xaa5f('0x83')][_0xaa5f('0x84')]('\x5c','\x5c\x5c')[_0xaa5f('0x84')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4530a9)){_0x575803['or'](_0xaa5f('0x85'),_0x4530a9+'%');}else if(qs[_0xaa5f('0x86')](_0x4530a9)){_0x575803['or'](_0xaa5f('0x87'),_0x4530a9+'%');}else{_0x575803['or'](_0xaa5f('0x88'),qs[_0xaa5f('0x89')](_0x4530a9))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xaa5f('0x89')](_0x4530a9));}}}_0x2de737[_0xaa5f('0x77')](_0x575803);_0x2de737[_0xaa5f('0x8a')](_0xaa5f('0x8b'));var _0xb6385={'type':db[_0xaa5f('0x8c')][_0xaa5f('0x8d')][_0xaa5f('0x8e')],'raw':!![]};var _0x3893bf=_0x2de737[_0xaa5f('0x8f')]();_0x3893bf['field']('i.id');_0x3893bf[_0xaa5f('0x4e')](_0xaa5f('0x90'),_0xaa5f('0x91'));if(_0xb16782[_0xaa5f('0x92')]){_0xb16782[_0xaa5f('0x92')][_0xaa5f('0x34')](function(_0x38e920){var _0xdb2a8b=_0x38e920[0x0]==='contactName'?_0x38e920[0x0]:'i.'+_0x38e920[0x0];_0x2de737[_0xaa5f('0x92')](_0xdb2a8b,_0x38e920[0x1]===_0xaa5f('0x93')?![]:!![]);});}if(!_[_0xaa5f('0x75')](_0x506dce)){_0x2de737['having'](_0x56cdd6);_0x3893bf['where'](_0xaa5f('0x94'),_0x506dce);}BPromise[_0xaa5f('0x95')]()[_0xaa5f('0x2b')](function(){if(!_0x509c61){if(_0x8f1583[_0xaa5f('0x42')][_0xaa5f('0x76')])return;_0x3893bf[_0xaa5f('0x77')](_0xaa5f('0x96'));_0x2de737[_0xaa5f('0x77')](_0xaa5f('0x96'));return;}if(_0x8f1583[_0xaa5f('0x97')]['role']!==_0xaa5f('0x98'))return;return _0x8f1583[_0xaa5f('0x97')][_0xaa5f('0x99')]({'attributes':['id'],'raw':!![]})[_0xaa5f('0x2b')](function(_0x273d60){if(_['isEmpty'](_0x273d60)){_0x3893bf[_0xaa5f('0x77')](_0xaa5f('0x9a'));_0x2de737[_0xaa5f('0x77')]('i.MailAccountId\x20IS\x20NULL');}else{_0x3893bf['where']('i.MailAccountId\x20IN\x20?',_[_0xaa5f('0x2f')](_0x273d60,'id'));_0x2de737[_0xaa5f('0x77')](_0xaa5f('0x9b'),_[_0xaa5f('0x2f')](_0x273d60,'id'));}});})['then'](function(){if(_0x8f1583[_0xaa5f('0x97')][_0xaa5f('0x9c')]===_0xaa5f('0x98')&&!_0x509c61&&!_0x8f1583[_0xaa5f('0x42')][_0xaa5f('0x76')])return[];return db[_0xaa5f('0x9d')][_0xaa5f('0x42')](_0x3893bf[_0xaa5f('0x9e')](),_0xb6385);})[_0xaa5f('0x2b')](function(_0xaa49aa){_0x1869c2[_0xaa5f('0x23')]=_0xaa49aa[_0xaa5f('0x63')];if(_0x1869c2[_0xaa5f('0x23')]===0x0)return[];return db[_0xaa5f('0x9d')][_0xaa5f('0x42')](_0x21cea0[_0xaa5f('0x9e')](),_0xb6385)[_0xaa5f('0x2b')](function(_0x1a9353){_0x1530a1=_[_0xaa5f('0x9f')](_0x1a9353,'id');_0xb6385=_['merge'](_0xb6385,{'model':db[_0xaa5f('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x8f1583[_0xaa5f('0x42')][_0xaa5f('0x46')]){_0xb16782[_0xaa5f('0x47')][_0xaa5f('0x34')](function(_0x5d8fa6){_0x2de737[_0xaa5f('0x4e')]('i.'+_0x5d8fa6);});}else{_0x2de737['field'](_0xaa5f('0x90'),_0xaa5f('0x91'));_0x2de737[_0xaa5f('0x4e')](_0xaa5f('0xa0'),_0xaa5f('0xa1'));_0x2de737[_0xaa5f('0x4e')](_0xaa5f('0xa2'),'Account.mandatoryDisposition');_0x2de737[_0xaa5f('0x4e')]('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',_0xaa5f('0xa3'));_0x2de737[_0xaa5f('0x4e')](_0xaa5f('0x8b'));_0x2de737[_0xaa5f('0x4e')]('i.createdAt');_0x2de737[_0xaa5f('0x4e')]('i.updatedAt');_0x2de737[_0xaa5f('0x4e')]('i.closed');_0x2de737[_0xaa5f('0x4e')]('i.closedAt');_0x2de737[_0xaa5f('0x4e')](_0xaa5f('0xa4'));_0x2de737[_0xaa5f('0x4e')](_0xaa5f('0xa5'));_0x2de737['field'](_0xaa5f('0xa6'));_0x2de737['field'](_0xaa5f('0xa7'));_0x2de737[_0xaa5f('0x4e')](_0xaa5f('0xa8'));_0x2de737[_0xaa5f('0x4e')](_0xaa5f('0xa9'));_0x2de737['field'](_0xaa5f('0xaa'));_0x2de737[_0xaa5f('0x4e')](_0xaa5f('0xab'));_0x2de737[_0xaa5f('0x4e')](_0xaa5f('0xac'));_0x2de737[_0xaa5f('0x4e')](_0xaa5f('0xad'));_0x2de737[_0xaa5f('0x4e')](_0xaa5f('0xae'));_0x2de737['field'](_0xaa5f('0xaf'));_0x2de737[_0xaa5f('0x4e')](_0xaa5f('0xb0'),_0xaa5f('0xb1'));_0x2de737[_0xaa5f('0x4e')]('c.lastName',_0xaa5f('0xb2'));_0x2de737[_0xaa5f('0x4e')]('c.email',_0xaa5f('0xb3'));_0x2de737[_0xaa5f('0x4e')](_0xaa5f('0xb4'),'Contact.phone');_0x2de737['field'](_0xaa5f('0xb5'),'Contact.mobile');_0x2de737['field']('c.fax','Contact.fax');_0x2de737['field']('o.fullname','Owner.fullname');_0x2de737['field'](_0xaa5f('0xb6'),_0xaa5f('0xb7'));_0x2de737[_0xaa5f('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xaa5f('0x31'));}if(_0xb16782[_0xaa5f('0x25')])_0x2de737[_0xaa5f('0x25')](_0xb16782['limit']);if(_0xb16782[_0xaa5f('0x24')])_0x2de737[_0xaa5f('0x24')](_0xb16782[_0xaa5f('0x24')]);return db['sequelize'][_0xaa5f('0x42')](_0x2de737[_0xaa5f('0x9e')](),_0xb6385);})['then'](function(_0x38a341){_0x1bf6cc[_0xaa5f('0x77')](_0xaa5f('0xb8'),_[_0xaa5f('0x2f')](_0x38a341,'id'));return db[_0xaa5f('0x9d')][_0xaa5f('0x42')](_0x1bf6cc[_0xaa5f('0x9e')](),_0xb6385)[_0xaa5f('0x2b')](function(_0x1eec5f){var _0x54e347=_[_0xaa5f('0xb9')](_0x1eec5f,_0xaa5f('0xba'));var _0x5e8819=[];return db[_0xaa5f('0xbb')][_0xaa5f('0x37')]({'attributes':[_0xaa5f('0xbc')],'raw':!![]})[_0xaa5f('0x2b')](function(_0x5beef3){var _0x2acdd6=_0x5beef3[_0xaa5f('0xbc')];_0x38a341[_0xaa5f('0x34')](function(_0x1b6a49){_0x5e8819[_0xaa5f('0x35')](updateMailInteraction(_0x1b6a49,_0x1530a1,_0x54e347,_0x2acdd6));});return BPromise[_0xaa5f('0xbd')](_0x5e8819);});});});})[_0xaa5f('0x2b')](function(_0x4a228f){_0x1869c2['rows']=_0x4a228f;return _0x1869c2;})[_0xaa5f('0x2b')](respondWithFilteredResult(_0x1a59d2,_0xb16782))[_0xaa5f('0x3c')](handleError(_0x1a59d2,null));};exports[_0xaa5f('0xbe')]=function(_0x3a85ce,_0x1cea07){var _0x20ec72={'raw':![],'where':{'id':_0x3a85ce[_0xaa5f('0xbf')]['id']}},_0x31e038={};_0x31e038['model']=_['keys'](db[_0xaa5f('0x36')][_0xaa5f('0x3e')]);_0x31e038['query']=_[_0xaa5f('0x43')](_0x3a85ce[_0xaa5f('0x42')]);_0x31e038['filters']=_[_0xaa5f('0x45')](_0x31e038[_0xaa5f('0x41')],_0x31e038[_0xaa5f('0x42')]);_0x20ec72[_0xaa5f('0x47')]=_[_0xaa5f('0x45')](_0x31e038['model'],qs[_0xaa5f('0x46')](_0x3a85ce['query'][_0xaa5f('0x46')]));_0x20ec72[_0xaa5f('0x47')]=_0x20ec72[_0xaa5f('0x47')]['length']?_0x20ec72[_0xaa5f('0x47')]:_0x31e038[_0xaa5f('0x41')];if(_0x3a85ce[_0xaa5f('0x42')][_0xaa5f('0xc0')]){_0x20ec72[_0xaa5f('0xc1')]=[{'all':!![]}];}_0x20ec72=_[_0xaa5f('0xc2')]({},_0x20ec72,_0x3a85ce[_0xaa5f('0xc3')]);return db[_0xaa5f('0x36')][_0xaa5f('0x64')](_0x20ec72)[_0xaa5f('0x2b')](handleEntityNotFound(_0x1cea07,null))['then'](respondWithResult(_0x1cea07,null))[_0xaa5f('0x3c')](handleError(_0x1cea07,null));};exports[_0xaa5f('0xc4')]=function(_0x21c13b,_0x235b14){return db['MailInteraction'][_0xaa5f('0xc4')](_0x21c13b[_0xaa5f('0xc5')],{})[_0xaa5f('0x2b')](respondWithResult(_0x235b14,0xc9))[_0xaa5f('0x3c')](handleError(_0x235b14,null));};exports['update']=function(_0x583a60,_0xe1e150){if(_0x583a60[_0xaa5f('0xc5')]['id']){delete _0x583a60['body']['id'];}return db['MailInteraction'][_0xaa5f('0x64')]({'where':{'id':_0x583a60['params']['id']}})[_0xaa5f('0x2b')](handleEntityNotFound(_0xe1e150,null))[_0xaa5f('0x2b')](saveUpdates(_0x583a60[_0xaa5f('0xc5')],null))[_0xaa5f('0x2b')](respondWithResult(_0xe1e150,null))[_0xaa5f('0x3c')](handleError(_0xe1e150,null));};exports[_0xaa5f('0x2a')]=function(_0x4306d7,_0x9ffb61){return db[_0xaa5f('0x36')][_0xaa5f('0x64')]({'where':{'id':_0x4306d7['params']['id']}})[_0xaa5f('0x2b')](handleEntityNotFound(_0x9ffb61,null))[_0xaa5f('0x2b')](removeEntity(_0x9ffb61,null))['catch'](handleError(_0x9ffb61,null));};exports[_0xaa5f('0xc6')]=function(_0x56edcd,_0x5aefa7){return db[_0xaa5f('0x36')][_0xaa5f('0xc6')]()[_0xaa5f('0x2b')](respondWithResult(_0x5aefa7,null))[_0xaa5f('0x3c')](handleError(_0x5aefa7,null));};exports[_0xaa5f('0xc7')]=function(_0x316e19,_0x2127b3,_0x4e3417){return db[_0xaa5f('0xc8')][_0xaa5f('0x64')]({'where':{'id':_0x316e19['params']['id']}})[_0xaa5f('0x2b')](handleEntityNotFound(_0x2127b3,null))[_0xaa5f('0x2b')](function(_0x243022){if(_0x243022){return _0x243022[_0xaa5f('0xc7')](_0x316e19[_0xaa5f('0xc5')][_0xaa5f('0xc9')],_[_0xaa5f('0xca')](_0x316e19['body'],[_0xaa5f('0xc9'),'id'])||{});}})['then'](respondWithResult(_0x2127b3,null))[_0xaa5f('0x3c')](handleError(_0x2127b3,null));};exports['getMessages']=function(_0x36a7bd,_0x199e0b,_0x5943b7){var _0x495912={'raw':![],'where':{}};var _0x46d1b0={};var _0x589eca={'count':0x0,'rows':[]};return db[_0xaa5f('0x36')][_0xaa5f('0x37')]({'where':{'id':_0x36a7bd[_0xaa5f('0xbf')]['id']}})[_0xaa5f('0x2b')](handleEntityNotFound(_0x199e0b,null))['then'](function(_0x42ea6a){if(_0x42ea6a){_0x46d1b0[_0xaa5f('0x41')]=_[_0xaa5f('0x43')](db[_0xaa5f('0xc8')][_0xaa5f('0x3e')]);_0x46d1b0[_0xaa5f('0x42')]=_['keys'](_0x36a7bd['query']);_0x46d1b0[_0xaa5f('0x44')]=_[_0xaa5f('0x45')](_0x46d1b0[_0xaa5f('0x41')],_0x46d1b0[_0xaa5f('0x42')]);_0x495912['attributes']=_['intersection'](_0x46d1b0[_0xaa5f('0x41')],qs[_0xaa5f('0x46')](_0x36a7bd['query'][_0xaa5f('0x46')]));_0x495912[_0xaa5f('0x47')]=_0x495912[_0xaa5f('0x47')][_0xaa5f('0x63')]?_0x495912['attributes']:_0x46d1b0[_0xaa5f('0x41')];if(!_0x36a7bd[_0xaa5f('0x42')]['hasOwnProperty'](_0xaa5f('0xcb'))){_0x495912[_0xaa5f('0x25')]=qs[_0xaa5f('0x25')](_0x36a7bd[_0xaa5f('0x42')]['limit']);_0x495912['offset']=qs[_0xaa5f('0x24')](_0x36a7bd[_0xaa5f('0x42')][_0xaa5f('0x24')]);}_0x495912[_0xaa5f('0x92')]=qs[_0xaa5f('0x49')](_0x36a7bd['query']['sort']);_0x495912[_0xaa5f('0x77')]=qs['filters'](_[_0xaa5f('0x4a')](_0x36a7bd[_0xaa5f('0x42')],_0x46d1b0[_0xaa5f('0x44')]));_0x495912[_0xaa5f('0x77')]['MailInteractionId']=_0x42ea6a['id'];if(_0x36a7bd['query'][_0xaa5f('0x83')]){_0x495912['where']=_['merge'](_0x495912[_0xaa5f('0x77')],{'$or':_[_0xaa5f('0x2f')](_0x495912[_0xaa5f('0x47')],function(_0xd7424a){var _0x2abdc0={};_0x2abdc0[_0xd7424a]={'$like':'%'+_0x36a7bd['query']['filter']+'%'};return _0x2abdc0;})});}if(_0x36a7bd['query'][_0xaa5f('0x7b')]){var _0xf7c2fd=_0x36a7bd[_0xaa5f('0x42')][_0xaa5f('0x7b')][_0xaa5f('0x33')](',');var _0x3899ec={};_0x3899ec[_0xf7c2fd[0x0]]={'$gte':moment(_0xf7c2fd[0x1])[_0xaa5f('0xcc')](_0xaa5f('0xcd'))};_0x495912['where']=_[_0xaa5f('0xc2')](_0x495912[_0xaa5f('0x77')],_0x3899ec);}_0x495912=_[_0xaa5f('0xc2')]({},_0x495912,_0x36a7bd[_0xaa5f('0xc3')]);return db[_0xaa5f('0xc8')][_0xaa5f('0x23')]({'where':_0x495912[_0xaa5f('0x77')]})[_0xaa5f('0x2b')](function(_0x530fb4){_0x589eca[_0xaa5f('0x23')]=_0x530fb4;if(_0x36a7bd[_0xaa5f('0x42')][_0xaa5f('0xc0')]){_0x495912['include']=[{'all':!![]}];}return db[_0xaa5f('0xc8')][_0xaa5f('0xce')](_0x495912);})[_0xaa5f('0x2b')](function(_0x12a749){if(_0x36a7bd['query'][_0xaa5f('0xcf')]===_0xaa5f('0xd0')){for(var _0x520063=0x0;_0x520063<_0x12a749['length'];_0x520063++){_0x12a749[_0x520063][_0xaa5f('0xc5')]=juice(_0x12a749[_0x520063][_0xaa5f('0xc5')]);}}_0x589eca['rows']=_0x12a749;return _0x589eca;});}})[_0xaa5f('0x2b')](respondWithFilteredResult(_0x199e0b,_0x495912))[_0xaa5f('0x3c')](handleError(_0x199e0b,null));};exports[_0xaa5f('0xd1')]=function(_0x5343f2,_0x33bc39,_0x55cdb7){return db[_0xaa5f('0x36')]['find']({'where':{'id':_0x5343f2[_0xaa5f('0xbf')]['id']}})['then'](handleEntityNotFound(_0x33bc39,null))[_0xaa5f('0x2b')](function(_0x574a56){if(_0x574a56){return _0x574a56[_0xaa5f('0xd2')](_0x5343f2[_0xaa5f('0xc5')][_0xaa5f('0xc9')],_['omit'](_0x5343f2[_0xaa5f('0xc5')],['ids','id'])||{})['spread'](function(){return db[_0xaa5f('0xd3')][_0xaa5f('0xce')]({'attributes':['id',_0xaa5f('0x2d'),'color'],'where':{'id':_0x5343f2[_0xaa5f('0xc5')][_0xaa5f('0xc9')]}});})[_0xaa5f('0x2b')](function(_0x2b8701){socket[_0xaa5f('0xd4')](_0xaa5f('0xd5'),{'id':Number(_0x5343f2[_0xaa5f('0xbf')]['id']),'tags':_0x2b8701||[]});return{'id':Number(_0x5343f2[_0xaa5f('0xbf')]['id']),'tags':_0x2b8701||[]};});}})[_0xaa5f('0x2b')](respondWithResult(_0x33bc39,null))[_0xaa5f('0x3c')](handleError(_0x33bc39,null));};exports[_0xaa5f('0xd6')]=function(_0x4789df,_0x1d0553,_0x1fe276){return db[_0xaa5f('0x36')][_0xaa5f('0x64')]({'where':{'id':_0x4789df[_0xaa5f('0xbf')]['id']}})['then'](handleEntityNotFound(_0x1d0553,null))[_0xaa5f('0x2b')](function(_0x595773){if(_0x595773){return _0x595773[_0xaa5f('0xd6')](_0x4789df['query'][_0xaa5f('0xc9')]);}})['then'](respondWithStatusCode(_0x1d0553,null))[_0xaa5f('0x3c')](handleError(_0x1d0553,null));};exports[_0xaa5f('0xd7')]=function(_0x3e4843,_0x294900){var _0x51984a=moment()['unix']()[_0xaa5f('0x9e')]();var _0x1761b1=path['join'](config[_0xaa5f('0xd8')],_0xaa5f('0xd9'),_0xaa5f('0xda'),_0xaa5f('0xdb'));var _0x2e8ff9=path[_0xaa5f('0xdc')](config[_0xaa5f('0xd8')],_0xaa5f('0xd9'),_0xaa5f('0xda'),_0xaa5f('0xdd'));var _0x2980fe=path[_0xaa5f('0xdc')](_0x1761b1,_0x51984a);var _0x4f81b4=util['format']('transcript-%d-%s.zip',_0x3e4843[_0xaa5f('0xbf')]['id'],_0x51984a);var _0x443fcb=path[_0xaa5f('0xdc')](_0x1761b1,_0x4f81b4);var _0x4113c3=[];if(_0x3e4843['query'][_0xaa5f('0xdd')]){_0x4113c3[_0xaa5f('0x35')]({'model':db[_0xaa5f('0xde')],'as':'Attachments','raw':!![]});}var _0x58ff02=[{'model':db[_0xaa5f('0xc8')],'as':'Messages','attributes':['id','body','from','to','cc',_0xaa5f('0xdf'),'subject',_0xaa5f('0x79')],'where':{'secret':![]},'order':qs[_0xaa5f('0x49')]('id'),'include':_0x4113c3}];return db[_0xaa5f('0x36')][_0xaa5f('0x64')]({'where':{'id':_0x3e4843[_0xaa5f('0xbf')]['id']},'include':_0x58ff02})[_0xaa5f('0x2b')](handleEntityNotFound(_0x294900,null))[_0xaa5f('0x2b')](function(_0x24d098){if(_0x24d098&&_0x24d098[_0xaa5f('0xe0')]){var _0x26a0d4=_0x24d098['get']({'plain':!![]});fs[_0xaa5f('0xe1')](_0x2980fe);return BPromise[_0xaa5f('0xe2')](_0x26a0d4[_0xaa5f('0xe0')],function(_0x1d1ec1,_0x553d5b){var _0x432f40={'from':_0x1d1ec1[_0xaa5f('0x4c')],'to':_0x1d1ec1['to'],'subject':_0x1d1ec1['subject'],'html':_0x1d1ec1[_0xaa5f('0xc5')],'headers':{'Date':moment(_0x1d1ec1[_0xaa5f('0x79')])[_0xaa5f('0xcc')](_0xaa5f('0xe3'))},'attachments':[]};if(_0x1d1ec1['cc']){_0x432f40[_0xaa5f('0xe4')]['Cc']=_0x1d1ec1['cc'];}if(_0x1d1ec1[_0xaa5f('0xdf')]){_0x432f40[_0xaa5f('0xe4')][_0xaa5f('0xe5')]=_0x1d1ec1[_0xaa5f('0xdf')];}return new BPromise(function(_0x1346a9,_0x52939b){if(_0x1d1ec1['Attachments']){for(var _0x12ded3=0x0;_0x12ded3<_0x1d1ec1[_0xaa5f('0xe6')][_0xaa5f('0x63')];_0x12ded3++){var _0x35ec52=_0x1d1ec1[_0xaa5f('0xe6')][_0x12ded3];var _0xeb8e8d=path[_0xaa5f('0xdc')](_0x2e8ff9,_0x35ec52[_0xaa5f('0xe7')]);if(fs[_0xaa5f('0xe8')](_0xeb8e8d)){_0x432f40['attachments'][_0xaa5f('0x35')]({'name':_0x35ec52[_0xaa5f('0x2d')],'contentType':_0x35ec52['type'],'data':fs[_0xaa5f('0xe9')](_0xeb8e8d)});}}}emlformat[_0xaa5f('0xea')](_0x432f40,function(_0x1d76b9,_0x22eecc){if(_0x1d76b9)return _0x52939b(_0x1d76b9);fs[_0xaa5f('0xeb')](path[_0xaa5f('0xdc')](_0x2980fe,util[_0xaa5f('0xcc')]('message%d.eml',_0x553d5b)),_0x22eecc);return _0x1346a9(_0x22eecc);});});})[_0xaa5f('0x2b')](function(){return new BPromise(function(_0x460ac8,_0x28f04d){zipdir(_0x2980fe,{'saveTo':_0x443fcb},function(_0x3c9db3,_0x2b32e9){if(_0x3c9db3)return _0x28f04d(_0x3c9db3);return _0x460ac8(_0x2b32e9);});})[_0xaa5f('0x2b')](function(){return new BPromise(function(_0x35e1cc,_0x21e5d5){rimraf(_0x2980fe,function(_0x4de324){if(_0x4de324)_0x21e5d5(_0x4de324);return _0x35e1cc();});});})[_0xaa5f('0x2b')](function(){return _0x294900['download'](_0x443fcb,_0x4f81b4,function(_0x4637a3){if(_0x4637a3){console['log'](_0xaa5f('0xec'),_0x4637a3);}else{fs[_0xaa5f('0xed')](_0x443fcb);}});});});}else{return _0x294900[_0xaa5f('0x1f')](0xc8);}})['catch'](handleError(_0x294900,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2916014..6814bde 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 _0xf3fc=['Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','getUsers'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xf3fc,0x1a2));var _0xcf3f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf3fc[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0xcf3f('0x0'));var MailInteraction=require(_0xcf3f('0x1'))['db'][_0xcf3f('0x2')];var MailMessage=require(_0xcf3f('0x1'))['db'][_0xcf3f('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xcf3f('0x4')](0x0);var events={'afterCreate':_0xcf3f('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x8a6516){return function(_0xee0903,_0x406748,_0x1400cb){_0xee0903[_0xcf3f('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x277211){_0xee0903['setDataValue'](_0xcf3f('0x7'),_0x277211[_0xcf3f('0x8')](function(_0xc2d1a9){return{'id':_0xc2d1a9['id']};}));return MailMessage[_0xcf3f('0x9')]({'where':{'MailInteractionId':_0xee0903['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcf3f('0xa')](function(_0x2c1952){_0xee0903['setDataValue'](_0xcf3f('0xb'),_0x2c1952[_0xcf3f('0xc')]);MailInteractionEvents[_0xcf3f('0xd')](_0x8a6516+':'+_0xee0903['id'],_0xee0903);MailInteractionEvents[_0xcf3f('0xd')](_0x8a6516,_0xee0903);_0x1400cb(null);})[_0xcf3f('0xe')](_0x1400cb(null));};}for(var e in events){if(events[_0xcf3f('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xcf3f('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xf5e6=['update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save'];(function(_0x58ed0e,_0x5040e2){var _0x2dabdc=function(_0x1cfa2f){while(--_0x1cfa2f){_0x58ed0e['push'](_0x58ed0e['shift']());}};_0x2dabdc(++_0x5040e2);}(_0xf5e6,0x105));var _0x6f5e=function(_0xc5463e,_0x54f914){_0xc5463e=_0xc5463e-0x0;var _0x1c45f7=_0xf5e6[_0xc5463e];return _0x1c45f7;};'use strict';var EventEmitter=require(_0x6f5e('0x0'));var MailInteraction=require(_0x6f5e('0x1'))['db'][_0x6f5e('0x2')];var MailMessage=require(_0x6f5e('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6f5e('0x3')](0x0);var events={'afterCreate':_0x6f5e('0x4'),'afterUpdate':_0x6f5e('0x5'),'afterDestroy':_0x6f5e('0x6')};function emitEvent(_0x3ca3c2){return function(_0x980940,_0x584581,_0x9fa7ff){_0x980940[_0x6f5e('0x7')]({'attributes':['id'],'raw':!![]})[_0x6f5e('0x8')](function(_0x4edbdd){_0x980940[_0x6f5e('0x9')](_0x6f5e('0xa'),_0x4edbdd[_0x6f5e('0xb')](function(_0x28a74f){return{'id':_0x28a74f['id']};}));return MailMessage[_0x6f5e('0xc')]({'where':{'MailInteractionId':_0x980940['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6f5e('0x8')](function(_0x261b3e){_0x980940[_0x6f5e('0x9')]('unreadMessages',_0x261b3e[_0x6f5e('0xd')]);MailInteractionEvents[_0x6f5e('0xe')](_0x3ca3c2+':'+_0x980940['id'],_0x980940);MailInteractionEvents['emit'](_0x3ca3c2,_0x980940);_0x9fa7ff(null);})[_0x6f5e('0xf')](_0x9fa7ff(null));};}for(var e in events){if(events[_0x6f5e('0x10')](e)){var event=events[e];MailInteraction[_0x6f5e('0x11')](e,emitEvent(event));}}module[_0x6f5e('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 2b74199..1faa183 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 _0x0298=['YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x0298,0x74));var _0x8029=function(_0x809314,_0xaf27c0){_0x809314=_0x809314-0x0;var _0x1a94b6=_0x0298[_0x809314];return _0x1a94b6;};'use strict';var _=require(_0x8029('0x0'));var util=require(_0x8029('0x1'));var logger=require('../../config/logger')(_0x8029('0x2'));var moment=require('moment');var BPromise=require(_0x8029('0x3'));var rp=require(_0x8029('0x4'));var fs=require('fs');var path=require(_0x8029('0x5'));var rimraf=require(_0x8029('0x6'));var config=require(_0x8029('0x7'));var attributes=require(_0x8029('0x8'));module[_0x8029('0x9')]=function(_0x2be809,_0x5ddb9a){return _0x2be809[_0x8029('0xa')](_0x8029('0xb'),attributes,{'tableName':_0x8029('0xc'),'paranoid':![],'indexes':[{'name':_0x8029('0xd'),'fields':[_0x8029('0xe'),'to'],'type':_0x8029('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x276ca8,_0x5a0ddc,_0x11c672){if(_0x276ca8[_0x8029('0x10')]){_0x276ca8[_0x8029('0x11')]=moment()[_0x8029('0x12')](_0x8029('0x13'));}if(_0x276ca8[_0x8029('0x14')]){_0x276ca8[_0x8029('0x15')]=moment()[_0x8029('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x11c672(null,_0x5a0ddc);},'beforeUpdate':function(_0x19a926,_0x3ee1db,_0x3b9fef){if(_0x19a926[_0x8029('0x16')](_0x8029('0x10'))){_0x19a926[_0x8029('0x11')]=_0x19a926[_0x8029('0x10')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x19a926[_0x8029('0x16')](_0x8029('0x14'))){_0x19a926[_0x8029('0x15')]=moment()[_0x8029('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x19a926[_0x8029('0x10')]=null;_0x19a926[_0x8029('0x11')]=null;}_0x3b9fef(null,_0x19a926);},'afterUpdate':function(_0x5900d5,_0x80d0a7,_0x4fa3cc){var _0xaa28da=_0x2be809[_0x8029('0x17')];var _0x4ce24c=_0x5900d5[_0x8029('0x18')]({'plain':!![]});if(_0x4ce24c[_0x8029('0x14')]){return _0xaa28da['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x4ce24c['id']}})['then'](function(){_0x4fa3cc();})['catch'](function(_0x4863c7){_0x4fa3cc(_0x4863c7);});}else{_0x4fa3cc();}}},'charset':_0x8029('0x19'),'collate':_0x8029('0x1a')});}; \ No newline at end of file +var _0xd41f=['mail_interactions','subject','FULLTEXT','substatus','closedAt','changed','format','closed','YYYY-MM-DD\x20HH:mm:ss','substatusAt','models','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','exports','define','MailInteraction'];(function(_0x47a754,_0x288129){var _0x4131a6=function(_0x29de63){while(--_0x29de63){_0x47a754['push'](_0x47a754['shift']());}};_0x4131a6(++_0x288129);}(_0xd41f,0xf1));var _0xfd41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd41f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xfd41('0x0'));var logger=require(_0xfd41('0x1'))('api');var moment=require(_0xfd41('0x2'));var BPromise=require(_0xfd41('0x3'));var rp=require(_0xfd41('0x4'));var fs=require('fs');var path=require(_0xfd41('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0xfd41('0x6')]=function(_0x54c861,_0x3244d5){return _0x54c861[_0xfd41('0x7')](_0xfd41('0x8'),attributes,{'tableName':_0xfd41('0x9'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xfd41('0xa'),'to'],'type':_0xfd41('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xeda59,_0x4fdd6f,_0x159d1f){if(_0xeda59[_0xfd41('0xc')]){_0xeda59['substatusAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0xeda59['closed']){_0xeda59[_0xfd41('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x159d1f(null,_0x4fdd6f);},'beforeUpdate':function(_0x406516,_0x2f2c5c,_0x5526b7){if(_0x406516[_0xfd41('0xe')]('substatus')){_0x406516['substatusAt']=_0x406516[_0xfd41('0xc')]?moment()[_0xfd41('0xf')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x406516[_0xfd41('0xe')](_0xfd41('0x10'))){_0x406516[_0xfd41('0xd')]=moment()[_0xfd41('0xf')](_0xfd41('0x11'));_0x406516[_0xfd41('0xc')]=null;_0x406516[_0xfd41('0x12')]=null;}_0x5526b7(null,_0x406516);},'afterUpdate':function(_0x4034bf,_0x17a904,_0x18a783){var _0x5b9868=_0x54c861[_0xfd41('0x13')];var _0x3b83a=_0x4034bf['get']({'plain':!![]});if(_0x3b83a[_0xfd41('0x10')]){return _0x5b9868[_0xfd41('0x14')][_0xfd41('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x3b83a['id']}})['then'](function(){_0x18a783();})[_0xfd41('0x16')](function(_0x6c1f4b){_0x18a783(_0x6c1f4b);});}else{_0x18a783();}}},'charset':_0xfd41('0x17'),'collate':_0xfd41('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 415379b..b5902ac 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 _0xb04a=['info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','UpdateMailInteraction','MailInteraction','options','where','limit','catch','find','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','request','then'];(function(_0x43c268,_0x7d9f28){var _0x41c3a0=function(_0x443d5b){while(--_0x443d5b){_0x43c268['push'](_0x43c268['shift']());}};_0x41c3a0(++_0x7d9f28);}(_0xb04a,0xcf));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab04('0x0'));var util=require(_0xab04('0x1'));var moment=require(_0xab04('0x2'));var BPromise=require(_0xab04('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab04('0x4'));var db=require(_0xab04('0x5'))['db'];var utils=require(_0xab04('0x6'));var logger=require('../../config/logger')(_0xab04('0x7'));var config=require(_0xab04('0x8'));var jayson=require(_0xab04('0x9'));var client=jayson['client'][_0xab04('0xa')]({'port':0x232a});config[_0xab04('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xab04('0xc'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1d4a39,_0x183c53,_0x381c7a){return new BPromise(function(_0x342f0e,_0x3bbc4a){return client[_0xab04('0xd')](_0x1d4a39,_0x381c7a)[_0xab04('0xe')](function(_0x332501){logger[_0xab04('0xf')]('MailInteraction,\x20%s,\x20%s',_0x183c53,'request\x20sent');logger[_0xab04('0x10')](_0xab04('0x11'),_0x183c53,_0xab04('0x12'),JSON[_0xab04('0x13')](_0x332501));if(_0x332501['error']){if(_0x332501[_0xab04('0x14')][_0xab04('0x15')]===0x1f4){logger['error'](_0xab04('0x16'),_0x183c53,_0x332501[_0xab04('0x14')][_0xab04('0x17')]);return _0x3bbc4a(_0x332501[_0xab04('0x14')][_0xab04('0x17')]);}logger['error'](_0xab04('0x16'),_0x183c53,_0x332501[_0xab04('0x14')][_0xab04('0x17')]);return _0x342f0e(_0x332501[_0xab04('0x14')][_0xab04('0x17')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x183c53,_0xab04('0x12'));_0x342f0e(_0x332501[_0xab04('0x18')][_0xab04('0x17')]);}})['catch'](function(_0x597abc){logger[_0xab04('0x14')](_0xab04('0x16'),_0x183c53,_0x597abc);_0x3bbc4a(_0x597abc);});});}exports[_0xab04('0x19')]=function(_0x538056){var _0x44cd5b=this;return new Promise(function(_0x553ed5,_0x395c6b){return db[_0xab04('0x1a')]['update'](_0x538056['body'],{'raw':_0x538056[_0xab04('0x1b')]?_0x538056[_0xab04('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x538056[_0xab04('0x1b')]?_0x538056[_0xab04('0x1b')][_0xab04('0x1c')]||null:null,'attributes':_0x538056[_0xab04('0x1b')]?_0x538056[_0xab04('0x1b')]['attributes']||null:null,'limit':_0x538056[_0xab04('0x1b')]?_0x538056['options'][_0xab04('0x1d')]||null:null})[_0xab04('0xe')](function(_0x561525){logger[_0xab04('0xf')]('UpdateMailInteraction',_0x538056);logger['debug']('UpdateMailInteraction',_0x538056,JSON[_0xab04('0x13')](_0x561525));_0x553ed5(_0x561525);})[_0xab04('0x1e')](function(_0x2f5a8c){logger[_0xab04('0x14')](_0xab04('0x19'),_0x2f5a8c['message'],_0x538056);_0x395c6b(_0x44cd5b['error'](0x1f4,_0x2f5a8c[_0xab04('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0xb8e7b){return new Promise(function(_0xdf0b96,_0x15cae9){return db[_0xab04('0x1a')][_0xab04('0x1f')]({'where':_0xb8e7b[_0xab04('0x1b')]?_0xb8e7b['options'][_0xab04('0x1c')]||null:null})[_0xab04('0xe')](function(_0x5c8696){if(_0x5c8696){return _0x5c8696[_0xab04('0x20')](_0xb8e7b[_0xab04('0x21')][_0xab04('0x22')],_[_0xab04('0x23')](_0xb8e7b[_0xab04('0x21')],[_0xab04('0x22'),'id'])||{});}})['spread'](function(_0x326f2f){logger['info'](_0xab04('0x24'),_0xb8e7b);logger[_0xab04('0x10')](_0xab04('0x24'),_0xb8e7b,JSON[_0xab04('0x13')](_0x326f2f));_0xdf0b96(_0x326f2f);})['catch'](function(_0x3ab245){logger['error'](_0xab04('0x24'),_0x3ab245[_0xab04('0x17')],_0xb8e7b);_0x15cae9(_this[_0xab04('0x14')](0x1f4,_0x3ab245[_0xab04('0x17')]));});});}; \ No newline at end of file +var _0xd8b0=['register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','where','attributes','limit','AddTagsToMailInteraction','body','ids','omit','AddTags','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./mailInteraction.socket'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x196c0a['options']?_0x196c0a['options'][_0x0d8b('0x1d')]||null:null,'attributes':_0x196c0a[_0x0d8b('0x1c')]?_0x196c0a[_0x0d8b('0x1c')][_0x0d8b('0x1e')]||null:null,'limit':_0x196c0a[_0x0d8b('0x1c')]?_0x196c0a[_0x0d8b('0x1c')][_0x0d8b('0x1f')]||null:null})[_0x0d8b('0xd')](function(_0x27b695){logger['info'](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')]('UpdateMailInteraction',_0x196c0a,JSON[_0x0d8b('0x13')](_0x27b695));_0x24e8ed(_0x27b695);})['catch'](function(_0x3dd149){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x3dd149['message'],_0x196c0a);_0x5b709c(_0x143372['error'](0x1f4,_0x3dd149[_0x0d8b('0x16')]));});});};exports[_0x0d8b('0x20')]=function(_0x4c05ee){return new Promise(function(_0xcbc4ac,_0x59aa83){return db[_0x0d8b('0x1a')]['find']({'where':_0x4c05ee[_0x0d8b('0x1c')]?_0x4c05ee['options'][_0x0d8b('0x1d')]||null:null})['then'](function(_0x3829c6){if(_0x3829c6){return _0x3829c6['addTags'](_0x4c05ee[_0x0d8b('0x21')][_0x0d8b('0x22')],_[_0x0d8b('0x23')](_0x4c05ee['body'],['ids','id'])||{});}})['spread'](function(_0x4e8992){logger['info'](_0x0d8b('0x24'),_0x4c05ee);logger['debug']('AddTags',_0x4c05ee,JSON[_0x0d8b('0x13')](_0x4e8992));_0xcbc4ac(_0x4e8992);})[_0x0d8b('0x18')](function(_0x109c14){logger[_0x0d8b('0x14')](_0x0d8b('0x24'),_0x109c14[_0x0d8b('0x16')],_0x4c05ee);_0x59aa83(_this[_0x0d8b('0x14')](0x1f4,_0x109c14[_0x0d8b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a3063d5..1376607 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 _0x0055=['length','mailInteraction:','remove','emit','removeListener'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x0055,0x13d));var _0x5005=function(_0x2af501,_0x453862){_0x2af501=_0x2af501-0x0;var _0x30f661=_0x0055[_0x2af501];return _0x30f661;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x5005('0x0'),'update'];function createListener(_0x1a8cdc,_0xd99a0){return function(_0x4ec4bb){_0xd99a0[_0x5005('0x1')](_0x1a8cdc,_0x4ec4bb);};}function removeListener(_0x3464f5,_0x44f611){return function(){MailInteractionEvents[_0x5005('0x2')](_0x3464f5,_0x44f611);};}exports['register']=function(_0x51383f){for(var _0x1cceb5=0x0,_0x2c1349=events[_0x5005('0x3')];_0x1cceb5<_0x2c1349;_0x1cceb5++){var _0x3ccf41=events[_0x1cceb5];var _0x218100=createListener(_0x5005('0x4')+_0x3ccf41,_0x51383f);MailInteractionEvents['on'](_0x3ccf41,_0x218100);}}; \ No newline at end of file +var _0x7772=['update','emit','removeListener','register','length','save','remove'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x7772,0x101));var _0x2777=function(_0x3dca7f,_0x13294f){_0x3dca7f=_0x3dca7f-0x0;var _0x58d6c1=_0x7772[_0x3dca7f];return _0x58d6c1;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x2777('0x0'),_0x2777('0x1'),_0x2777('0x2')];function createListener(_0x1c08a5,_0x5d3254){return function(_0x4c8abe){_0x5d3254[_0x2777('0x3')](_0x1c08a5,_0x4c8abe);};}function removeListener(_0x39e493,_0x52952b){return function(){MailInteractionEvents[_0x2777('0x4')](_0x39e493,_0x52952b);};}exports[_0x2777('0x5')]=function(_0x3905a2){for(var _0x2130c9=0x0,_0x449aba=events[_0x2777('0x6')];_0x2130c9<_0x449aba;_0x2130c9++){var _0x3b368d=events[_0x2130c9];var _0x36a5d7=createListener('mailInteraction:'+_0x3b368d,_0x3905a2);MailInteractionEvents['on'](_0x3b368d,_0x36a5d7);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index b99a930..6ed30d8 100644 --- a/server/api/mailMessage/index.js +++ b/server/api/mailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ca=['../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','update','put','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x28a714,_0x49a848){var _0x500cf3=function(_0xde946b){while(--_0xde946b){_0x28a714['push'](_0x28a714['shift']());}};_0x500cf3(++_0x49a848);}(_0x24ca,0x1bc));var _0xa24c=function(_0x30f5bb,_0x4db4bd){_0x30f5bb=_0x30f5bb-0x0;var _0x1cfc00=_0x24ca[_0x30f5bb];return _0x1cfc00;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['get'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['get'](_0xa24c('0xf'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x10')]);router[_0xa24c('0x11')]('/',auth[_0xa24c('0x9')](),interaction[_0xa24c('0x12')](_0xa24c('0x13'),_0xa24c('0x14')),controller[_0xa24c('0x15')]);router['put'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x16')]);router[_0xa24c('0x17')]('/:id/accept',auth[_0xa24c('0x9')](),controller[_0xa24c('0x18')]);router[_0xa24c('0x17')](_0xa24c('0x19'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x1a')]);router[_0xa24c('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xa24c('0x1c')]);module[_0xa24c('0x1d')]=router; \ No newline at end of file +var _0x9c5a=['isAuthenticated','get','/describe','/:id','show','download','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller'];(function(_0x55dfd7,_0x52bd9a){var _0x1f4844=function(_0x1e929d){while(--_0x1e929d){_0x55dfd7['push'](_0x55dfd7['shift']());}};_0x1f4844(++_0x52bd9a);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5c88b9,_0x26c7cd){_0x5c88b9=_0x5c88b9-0x0;var _0x1346c5=_0x9c5a[_0x5c88b9];return _0x1346c5;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var auth=require(_0xa9c5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa9c5('0x6'));var controller=require(_0xa9c5('0x7'));router['get']('/',auth[_0xa9c5('0x8')](),controller['index']);router[_0xa9c5('0x9')](_0xa9c5('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xa9c5('0x9')](_0xa9c5('0xb'),auth['isAuthenticated'](),controller[_0xa9c5('0xc')]);router[_0xa9c5('0x9')]('/:id/download',auth[_0xa9c5('0x8')](),controller[_0xa9c5('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xa9c5('0xe')](_0xa9c5('0xf'),_0xa9c5('0x10')),controller[_0xa9c5('0x11')]);router[_0xa9c5('0x12')](_0xa9c5('0xb'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x13')]);router[_0xa9c5('0x12')](_0xa9c5('0x14'),auth['isAuthenticated'](),controller[_0xa9c5('0x15')]);router[_0xa9c5('0x12')](_0xa9c5('0x16'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x17')]);router[_0xa9c5('0x18')](_0xa9c5('0xb'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x19')]);module[_0xa9c5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 82e849e..4ba2372 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 _0x1893=['INTEGER','DATE','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x5b0659,_0xe8b23b){var _0x63a86f=function(_0x4736bc){while(--_0x4736bc){_0x5b0659['push'](_0x5b0659['shift']());}};_0x63a86f(++_0xe8b23b);}(_0x1893,0xa2));var _0x3189=function(_0x4217e5,_0x4b69e6){_0x4217e5=_0x4217e5-0x0;var _0xb02bc5=_0x1893[_0x4217e5];return _0xb02bc5;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x3189('0x0')]={'body':{'type':Sequelize[_0x3189('0x1')](_0x3189('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3189('0x1')](_0x3189('0x3'))},'read':{'type':Sequelize[_0x3189('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3189('0x5')]('in','out'),'defaultValue':_0x3189('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3189('0x7')](0x1fe)},'from':{'type':Sequelize[_0x3189('0x7')]},'to':{'type':Sequelize[_0x3189('0x1')](_0x3189('0x2'))},'cc':{'type':Sequelize[_0x3189('0x1')](_0x3189('0x2'))},'bcc':{'type':Sequelize[_0x3189('0x1')]('long')},'subject':{'type':Sequelize[_0x3189('0x1')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x3189('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3189('0x9')]},'originTo':{'type':Sequelize[_0x3189('0x1')](_0x3189('0x2'))},'originCc':{'type':Sequelize[_0x3189('0x1')]('long')}}; \ No newline at end of file +var _0x1f75=['BOOLEAN','ENUM','out','STRING','DATE','INTEGER','lodash','exports','TEXT','long'];(function(_0x4b4d59,_0x2a5f73){var _0x5d85f1=function(_0x4da424){while(--_0x4da424){_0x4b4d59['push'](_0x4b4d59['shift']());}};_0x5d85f1(++_0x2a5f73);}(_0x1f75,0x13c));var _0x51f7=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x1f75[_0x4ae625];return _0x31accf;};'use strict';var Sequelize=require('sequelize');var _=require(_0x51f7('0x0'));module[_0x51f7('0x1')]={'body':{'type':Sequelize[_0x51f7('0x2')](_0x51f7('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x51f7('0x2')]('medium')},'read':{'type':Sequelize[_0x51f7('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x51f7('0x5')]('in',_0x51f7('0x6')),'defaultValue':_0x51f7('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x51f7('0x7')](0x1fe)},'from':{'type':Sequelize[_0x51f7('0x7')]},'to':{'type':Sequelize[_0x51f7('0x2')](_0x51f7('0x3'))},'cc':{'type':Sequelize[_0x51f7('0x2')](_0x51f7('0x3'))},'bcc':{'type':Sequelize[_0x51f7('0x2')](_0x51f7('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x51f7('0x8')]},'attach':{'type':Sequelize[_0x51f7('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x51f7('0x8')]},'originTo':{'type':Sequelize[_0x51f7('0x2')]('long')},'originCc':{'type':Sequelize['TEXT'](_0x51f7('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 1042e3e..2192575 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(_0x1a89dc,_0x4ccfee){var _0x2a269f=function(_0x5ec68a){while(--_0x5ec68a){_0x1a89dc['push'](_0x1a89dc['shift']());}};_0x2a269f(++_0x4ccfee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x3dab59,_0x49008b){var _0x2b6d7e=function(_0x552d48){while(--_0x552d48){_0x3dab59['push'](_0x3dab59['shift']());}};_0x2b6d7e(++_0x49008b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 4651f27..75015da 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 _0xeaa9=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','update','remove'];(function(_0x79eeae,_0x4be496){var _0x4a7717=function(_0x54da49){while(--_0x54da49){_0x79eeae['push'](_0x79eeae['shift']());}};_0x4a7717(++_0x4be496);}(_0xeaa9,0x124));var _0x9eaa=function(_0xacf20c,_0x183c46){_0xacf20c=_0xacf20c-0x0;var _0x3948fd=_0xeaa9[_0xacf20c];return _0x3948fd;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x9eaa('0x0'))['db'][_0x9eaa('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9eaa('0x2'),'afterDestroy':_0x9eaa('0x3')};function emitEvent(_0x1ab0c9){return function(_0x146733,_0x384a68,_0x297731){MailMessageEvents[_0x9eaa('0x4')](_0x1ab0c9+':'+_0x146733['id'],_0x146733);MailMessageEvents['emit'](_0x1ab0c9,_0x146733);_0x297731(null);};}for(var e in events){if(events[_0x9eaa('0x5')](e)){var event=events[e];MailMessage[_0x9eaa('0x6')](e,emitEvent(event));}}module[_0x9eaa('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xdab5=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x1b5172,_0x3df7be){var _0x44a05b=function(_0x479dec){while(--_0x479dec){_0x1b5172['push'](_0x1b5172['shift']());}};_0x44a05b(++_0x3df7be);}(_0xdab5,0xdb));var _0x5dab=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xdab5[_0x36c5b0];return _0xf19333;};'use strict';var EventEmitter=require(_0x5dab('0x0'));var MailMessage=require(_0x5dab('0x1'))['db'][_0x5dab('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5dab('0x3')](0x0);var events={'afterCreate':_0x5dab('0x4'),'afterUpdate':_0x5dab('0x5'),'afterDestroy':_0x5dab('0x6')};function emitEvent(_0x4a2097){return function(_0x39afcb,_0x2b524a,_0x345c8d){MailMessageEvents['emit'](_0x4a2097+':'+_0x39afcb['id'],_0x39afcb);MailMessageEvents['emit'](_0x4a2097,_0x39afcb);_0x345c8d(null);};}for(var e in events){if(events[_0x5dab('0x7')](e)){var event=events[e];MailMessage[_0x5dab('0x8')](e,emitEvent(event));}}module[_0x5dab('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index e01baf1..20a1c2d 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 _0xa61b=['exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','./mailMessage.attributes'];(function(_0xe19f0e,_0x395d0e){var _0x43433a=function(_0x189e16){while(--_0x189e16){_0xe19f0e['push'](_0xe19f0e['shift']());}};_0x43433a(++_0x395d0e);}(_0xa61b,0x8a));var _0xba61=function(_0x20f048,_0x42aef8){_0x20f048=_0x20f048-0x0;var _0x3057e3=_0xa61b[_0x20f048];return _0x3057e3;};'use strict';var _=require(_0xba61('0x0'));var util=require(_0xba61('0x1'));var logger=require(_0xba61('0x2'))(_0xba61('0x3'));var moment=require(_0xba61('0x4'));var BPromise=require(_0xba61('0x5'));var rp=require(_0xba61('0x6'));var htmlToText=require(_0xba61('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba61('0x8'));var config=require('../../config/environment');var attributes=require(_0xba61('0x9'));module[_0xba61('0xa')]=function(_0x251e17,_0x2c1cf6){return _0x251e17[_0xba61('0xb')](_0xba61('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xba61('0xd'),'fields':[_0xba61('0xd')]},{'name':_0xba61('0xe'),'fields':[_0xba61('0xf'),_0xba61('0x10')],'type':_0xba61('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x325976,_0x4c070e,_0x341c6f){if(_0x325976['body']){_0x325976[_0xba61('0xf')]=htmlToText[_0xba61('0x12')](_0x325976[_0xba61('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x341c6f(null,_0x4c070e);},'afterCreate':function(_0x57dbcf,_0x4eb42a,_0x139ccc){var _0x3c0013=_0x251e17[_0xba61('0x14')];var _0x10cea2=_0x57dbcf[_0xba61('0x15')]({'plain':!![]});if(_0x10cea2[_0xba61('0x16')][_0xba61('0x17')]()==='in'||_0x10cea2[_0xba61('0x16')][_0xba61('0x17')]()===_0xba61('0x18')&&!_0x10cea2[_0xba61('0x19')]&&!_[_0xba61('0x1a')](_0x10cea2[_0xba61('0x1b')])){_0x3c0013[_0xba61('0x1c')][_0xba61('0x1d')]({'where':{'id':_0x10cea2[_0xba61('0x1e')]}})[_0xba61('0x1f')](function(_0x32bced){if(_0x32bced){_0x32bced[_0xba61('0x20')]({'lastMsgAt':_0x10cea2[_0xba61('0x21')],'lastMsgDirection':_0x10cea2[_0xba61('0x16')][_0xba61('0x17')](),'lastMsgBody':_0x10cea2[_0xba61('0x13')]});}})[_0xba61('0x22')](function(_0xa58b1e){console[_0xba61('0x23')](_0xa58b1e);});}_0x139ccc();}},'charset':'utf8mb4','collate':_0xba61('0x24')});}; \ No newline at end of file +var _0x0a7e=['MailInteraction','findOne','MailInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','FULLTEXT','body','fromString','models','toLowerCase','out','secret','isNil','UserId'];(function(_0xce4604,_0x5e98ad){var _0x474352=function(_0x9074e8){while(--_0x9074e8){_0xce4604['push'](_0xce4604['shift']());}};_0x474352(++_0x5e98ad);}(_0x0a7e,0x143));var _0xe0a7=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x0a7e[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xe0a7('0x0'));var util=require(_0xe0a7('0x1'));var logger=require(_0xe0a7('0x2'))(_0xe0a7('0x3'));var moment=require(_0xe0a7('0x4'));var BPromise=require(_0xe0a7('0x5'));var rp=require(_0xe0a7('0x6'));var htmlToText=require(_0xe0a7('0x7'));var fs=require('fs');var path=require(_0xe0a7('0x8'));var rimraf=require(_0xe0a7('0x9'));var config=require(_0xe0a7('0xa'));var attributes=require(_0xe0a7('0xb'));module[_0xe0a7('0xc')]=function(_0x263038,_0x5f18fe){return _0x263038[_0xe0a7('0xd')](_0xe0a7('0xe'),attributes,{'tableName':_0xe0a7('0xf'),'paranoid':![],'indexes':[{'name':_0xe0a7('0x10'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0xe0a7('0x11'),'subject'],'type':_0xe0a7('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47635a,_0x23d535,_0x1808fc){if(_0x47635a[_0xe0a7('0x13')]){_0x47635a[_0xe0a7('0x11')]=htmlToText[_0xe0a7('0x14')](_0x47635a[_0xe0a7('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1808fc(null,_0x23d535);},'afterCreate':function(_0x8e683c,_0x2ba3bb,_0x198505){var _0x8ddb4e=_0x263038[_0xe0a7('0x15')];var _0x1ed4f4=_0x8e683c['get']({'plain':!![]});if(_0x1ed4f4['direction'][_0xe0a7('0x16')]()==='in'||_0x1ed4f4['direction']['toLowerCase']()===_0xe0a7('0x17')&&!_0x1ed4f4[_0xe0a7('0x18')]&&!_[_0xe0a7('0x19')](_0x1ed4f4[_0xe0a7('0x1a')])){_0x8ddb4e[_0xe0a7('0x1b')][_0xe0a7('0x1c')]({'where':{'id':_0x1ed4f4[_0xe0a7('0x1d')]}})[_0xe0a7('0x1e')](function(_0x55d156){if(_0x55d156){_0x55d156['update']({'lastMsgAt':_0x1ed4f4['createdAt'],'lastMsgDirection':_0x1ed4f4['direction']['toLowerCase'](),'lastMsgBody':_0x1ed4f4[_0xe0a7('0x13')]});}})[_0xe0a7('0x1f')](function(_0x3ecf13){console[_0xe0a7('0x20')](_0x3ecf13);});}_0x198505();}},'charset':_0xe0a7('0x21'),'collate':_0xe0a7('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index fab9653..6355013 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 _0x389e=['then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','create','options','raw','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailMessage.socket','request'];(function(_0x4b7d7a,_0x560990){var _0x3d69ee=function(_0x50649d){while(--_0x50649d){_0x4b7d7a['push'](_0x4b7d7a['shift']());}};_0x3d69ee(++_0x560990);}(_0x389e,0x188));var _0xe389=function(_0x673dbf,_0x2f47f2){_0x673dbf=_0x673dbf-0x0;var _0x1e0318=_0x389e[_0x673dbf];return _0x1e0318;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe389('0x0'));var rs=require(_0xe389('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe389('0x2'))['db'];var utils=require(_0xe389('0x3'));var logger=require(_0xe389('0x4'))(_0xe389('0x5'));var config=require(_0xe389('0x6'));var jayson=require(_0xe389('0x7'));var client=jayson[_0xe389('0x8')]['http']({'port':0x232a});config[_0xe389('0x9')]=_[_0xe389('0xa')](config[_0xe389('0x9')],{'host':_0xe389('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe389('0x9')]));require(_0xe389('0xc'))['register'](socket);function respondWithRpcPromise(_0x5ce389,_0x2377fd,_0x3857b8){return new BPromise(function(_0x2dafb4,_0x14379d){return client[_0xe389('0xd')](_0x5ce389,_0x3857b8)[_0xe389('0xe')](function(_0x2a88de){logger[_0xe389('0xf')](_0xe389('0x10'),_0x2377fd,_0xe389('0x11'));logger['debug'](_0xe389('0x12'),_0x2377fd,_0xe389('0x11'),JSON[_0xe389('0x13')](_0x2a88de));if(_0x2a88de['error']){if(_0x2a88de[_0xe389('0x14')][_0xe389('0x15')]===0x1f4){logger[_0xe389('0x14')]('MailMessage,\x20%s,\x20%s',_0x2377fd,_0x2a88de['error'][_0xe389('0x16')]);return _0x14379d(_0x2a88de[_0xe389('0x14')][_0xe389('0x16')]);}logger[_0xe389('0x14')](_0xe389('0x10'),_0x2377fd,_0x2a88de[_0xe389('0x14')]['message']);return _0x2dafb4(_0x2a88de['error'][_0xe389('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x2377fd,'request\x20sent');_0x2dafb4(_0x2a88de[_0xe389('0x17')]['message']);}})[_0xe389('0x18')](function(_0x43d057){logger[_0xe389('0x14')](_0xe389('0x10'),_0x2377fd,_0x43d057);_0x14379d(_0x43d057);});});}exports[_0xe389('0x19')]=function(_0x4c67b2){var _0x407d4d=this;return new Promise(function(_0x4aff9d,_0x276b86){return db['MailMessage'][_0xe389('0x1a')](_0x4c67b2['body'],{'raw':_0x4c67b2[_0xe389('0x1b')]?_0x4c67b2[_0xe389('0x1b')][_0xe389('0x1c')]===undefined?!![]:![]:!![]})[_0xe389('0xe')](function(_0xb0dcea){logger['info'](_0xe389('0x19'),_0x4c67b2);logger['debug'](_0xe389('0x19'),_0x4c67b2,JSON[_0xe389('0x13')](_0xb0dcea));_0x4aff9d(_0xb0dcea);})[_0xe389('0x18')](function(_0x7cbea4){logger[_0xe389('0x14')](_0xe389('0x19'),_0x7cbea4[_0xe389('0x16')],_0x4c67b2);_0x276b86(_0x407d4d[_0xe389('0x14')](0x1f4,_0x7cbea4['message']));});});}; \ No newline at end of file +var _0xd9a7=['error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch','create','options','CreateMailMessage','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x10a904,_0x2bf292){var _0x53815a=function(_0x2e6ce4){while(--_0x2e6ce4){_0x10a904['push'](_0x10a904['shift']());}};_0x53815a(++_0x2bf292);}(_0xd9a7,0x12c));var _0x7d9a=function(_0x5b2b6c,_0x5e1ad7){_0x5b2b6c=_0x5b2b6c-0x0;var _0x37a919=_0xd9a7[_0x5b2b6c];return _0x37a919;};'use strict';var _=require('lodash');var util=require(_0x7d9a('0x0'));var moment=require(_0x7d9a('0x1'));var BPromise=require('bluebird');var rs=require(_0x7d9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d9a('0x3'))['db'];var utils=require(_0x7d9a('0x4'));var logger=require('../../config/logger')(_0x7d9a('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d9a('0x6')][_0x7d9a('0x7')]({'port':0x232a});config[_0x7d9a('0x8')]=_[_0x7d9a('0x9')](config[_0x7d9a('0x8')],{'host':_0x7d9a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d9a('0x8')]));require(_0x7d9a('0xb'))[_0x7d9a('0xc')](socket);function respondWithRpcPromise(_0x4193af,_0x986cca,_0x5e5009){return new BPromise(function(_0x427d90,_0x365ce5){return client[_0x7d9a('0xd')](_0x4193af,_0x5e5009)[_0x7d9a('0xe')](function(_0x4ec923){logger['info']('MailMessage,\x20%s,\x20%s',_0x986cca,_0x7d9a('0xf'));logger[_0x7d9a('0x10')](_0x7d9a('0x11'),_0x986cca,_0x7d9a('0xf'),JSON[_0x7d9a('0x12')](_0x4ec923));if(_0x4ec923[_0x7d9a('0x13')]){if(_0x4ec923[_0x7d9a('0x13')][_0x7d9a('0x14')]===0x1f4){logger[_0x7d9a('0x13')](_0x7d9a('0x15'),_0x986cca,_0x4ec923[_0x7d9a('0x13')][_0x7d9a('0x16')]);return _0x365ce5(_0x4ec923[_0x7d9a('0x13')][_0x7d9a('0x16')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x986cca,_0x4ec923['error']['message']);return _0x427d90(_0x4ec923[_0x7d9a('0x13')][_0x7d9a('0x16')]);}else{logger[_0x7d9a('0x17')](_0x7d9a('0x15'),_0x986cca,_0x7d9a('0xf'));_0x427d90(_0x4ec923[_0x7d9a('0x18')][_0x7d9a('0x16')]);}})[_0x7d9a('0x19')](function(_0x1d0cc0){logger[_0x7d9a('0x13')]('MailMessage,\x20%s,\x20%s',_0x986cca,_0x1d0cc0);_0x365ce5(_0x1d0cc0);});});}exports['CreateMailMessage']=function(_0x18a4e8){var _0x1efd2b=this;return new Promise(function(_0x2dbfe8,_0x4549cb){return db['MailMessage'][_0x7d9a('0x1a')](_0x18a4e8['body'],{'raw':_0x18a4e8[_0x7d9a('0x1b')]?_0x18a4e8[_0x7d9a('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x7d9a('0xe')](function(_0x289f99){logger[_0x7d9a('0x17')](_0x7d9a('0x1c'),_0x18a4e8);logger[_0x7d9a('0x10')](_0x7d9a('0x1c'),_0x18a4e8,JSON[_0x7d9a('0x12')](_0x289f99));_0x2dbfe8(_0x289f99);})[_0x7d9a('0x19')](function(_0x488b67){logger['error'](_0x7d9a('0x1c'),_0x488b67['message'],_0x18a4e8);_0x4549cb(_0x1efd2b[_0x7d9a('0x13')](0x1f4,_0x488b67[_0x7d9a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 5e9e007..e81b762 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 _0x4062=['emit','removeListener','register','length','save','update'];(function(_0x9ae685,_0x2c6652){var _0x4c492e=function(_0xde76ce){while(--_0xde76ce){_0x9ae685['push'](_0x9ae685['shift']());}};_0x4c492e(++_0x2c6652);}(_0x4062,0x1ae));var _0x2406=function(_0x3d92ba,_0x3b8424){_0x3d92ba=_0x3d92ba-0x0;var _0x2396db=_0x4062[_0x3d92ba];return _0x2396db;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x2406('0x0'),'remove',_0x2406('0x1')];function createListener(_0x4de7a0,_0xb00df7){return function(_0x4960da){_0xb00df7[_0x2406('0x2')](_0x4de7a0,_0x4960da);};}function removeListener(_0x5239c5,_0x1089ae){return function(){MailMessageEvents[_0x2406('0x3')](_0x5239c5,_0x1089ae);};}exports[_0x2406('0x4')]=function(_0x320b05){for(var _0x1e5450=0x0,_0x33fc20=events[_0x2406('0x5')];_0x1e5450<_0x33fc20;_0x1e5450++){var _0xc18f1b=events[_0x1e5450];var _0x49fd0a=createListener('mailMessage:'+_0xc18f1b,_0x320b05);MailMessageEvents['on'](_0xc18f1b,_0x49fd0a);}}; \ No newline at end of file +var _0x731f=['save','remove','update','emit','length','mailMessage:','./mailMessage.events'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0x731f,0xc3));var _0xf731=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x731f[_0x122ef9];return _0x42fba0;};'use strict';var MailMessageEvents=require(_0xf731('0x0'));var events=[_0xf731('0x1'),_0xf731('0x2'),_0xf731('0x3')];function createListener(_0x35b458,_0x412345){return function(_0x191bf2){_0x412345[_0xf731('0x4')](_0x35b458,_0x191bf2);};}function removeListener(_0x49ab6a,_0x4069fc){return function(){MailMessageEvents['removeListener'](_0x49ab6a,_0x4069fc);};}exports['register']=function(_0x573c11){for(var _0x54111b=0x0,_0xc6c774=events[_0xf731('0x5')];_0x54111b<_0xc6c774;_0x54111b++){var _0x58d665=events[_0x54111b];var _0x2f9e44=createListener(_0xf731('0x6')+_0x58d665,_0x573c11);MailMessageEvents['on'](_0x58d665,_0x2f9e44);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 70a9de7..1ffcbd8 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 _0x2130=['delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2130,0x1b5));var _0x0213=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x2130[_0x13ce0c];return _0x4388fb;};'use strict';var multer=require(_0x0213('0x0'));var util=require(_0x0213('0x1'));var path=require(_0x0213('0x2'));var timeout=require('connect-timeout');var express=require(_0x0213('0x3'));var router=express[_0x0213('0x4')]();var auth=require(_0x0213('0x5'));var interaction=require(_0x0213('0x6'));var config=require(_0x0213('0x7'));var controller=require(_0x0213('0x8'));router[_0x0213('0x9')]('/',auth[_0x0213('0xa')](),controller[_0x0213('0xb')]);router[_0x0213('0x9')](_0x0213('0xc'),auth['isAuthenticated'](),controller[_0x0213('0xd')]);router[_0x0213('0x9')](_0x0213('0xe'),auth[_0x0213('0xa')](),controller[_0x0213('0xf')]);router['get'](_0x0213('0x10'),auth['isAuthenticated'](),controller[_0x0213('0x11')]);router['get'](_0x0213('0x12'),auth[_0x0213('0xa')](),controller[_0x0213('0x13')]);router[_0x0213('0x9')](_0x0213('0x14'),auth[_0x0213('0xa')](),controller[_0x0213('0x15')]);router[_0x0213('0x16')]('/',auth['isAuthenticated'](),controller[_0x0213('0x17')]);router[_0x0213('0x16')](_0x0213('0x12'),auth[_0x0213('0xa')](),controller['addTeams']);router[_0x0213('0x16')](_0x0213('0x14'),auth['isAuthenticated'](),controller[_0x0213('0x18')]);router[_0x0213('0x19')](_0x0213('0xe'),auth[_0x0213('0xa')](),controller[_0x0213('0x1a')]);router['delete'](_0x0213('0xe'),auth[_0x0213('0xa')](),controller['destroy']);router[_0x0213('0x1b')]('/:id/teams',auth[_0x0213('0xa')](),controller['removeTeams']);router['delete'](_0x0213('0x14'),auth[_0x0213('0xa')](),controller['removeAgents']);module[_0x0213('0x1c')]=router; \ No newline at end of file +var _0x0db5=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','update','delete','removeTeams','removeAgents','exports','util'];(function(_0x20ea89,_0x1bfce6){var _0x1f06a8=function(_0xc541ce){while(--_0xc541ce){_0x20ea89['push'](_0x20ea89['shift']());}};_0x1f06a8(++_0x1bfce6);}(_0x0db5,0x90));var _0x50db=function(_0x2efb33,_0x1349d2){_0x2efb33=_0x2efb33-0x0;var _0x9cba60=_0x0db5[_0x2efb33];return _0x9cba60;};'use strict';var multer=require('multer');var util=require(_0x50db('0x0'));var path=require(_0x50db('0x1'));var timeout=require(_0x50db('0x2'));var express=require(_0x50db('0x3'));var router=express[_0x50db('0x4')]();var auth=require(_0x50db('0x5'));var interaction=require(_0x50db('0x6'));var config=require('../../config/environment');var controller=require(_0x50db('0x7'));router[_0x50db('0x8')]('/',auth[_0x50db('0x9')](),controller[_0x50db('0xa')]);router[_0x50db('0x8')](_0x50db('0xb'),auth[_0x50db('0x9')](),controller[_0x50db('0xc')]);router[_0x50db('0x8')](_0x50db('0xd'),auth[_0x50db('0x9')](),controller[_0x50db('0xe')]);router[_0x50db('0x8')](_0x50db('0xf'),auth[_0x50db('0x9')](),controller[_0x50db('0x10')]);router[_0x50db('0x8')](_0x50db('0x11'),auth[_0x50db('0x9')](),controller[_0x50db('0x12')]);router[_0x50db('0x8')](_0x50db('0x13'),auth[_0x50db('0x9')](),controller[_0x50db('0x14')]);router[_0x50db('0x15')]('/',auth[_0x50db('0x9')](),controller[_0x50db('0x16')]);router[_0x50db('0x15')](_0x50db('0x11'),auth[_0x50db('0x9')](),controller['addTeams']);router[_0x50db('0x15')](_0x50db('0x13'),auth['isAuthenticated'](),controller[_0x50db('0x17')]);router['put']('/:id',auth[_0x50db('0x9')](),controller[_0x50db('0x18')]);router[_0x50db('0x19')](_0x50db('0xd'),auth[_0x50db('0x9')](),controller['destroy']);router[_0x50db('0x19')]('/:id/teams',auth[_0x50db('0x9')](),controller[_0x50db('0x1a')]);router[_0x50db('0x19')](_0x50db('0x13'),auth[_0x50db('0x9')](),controller[_0x50db('0x1b')]);module[_0x50db('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 8d9bd82..b2eae97 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 _0xd06f=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x6bbc50,_0x26b8e9){var _0x5e8e93=function(_0x2dda79){while(--_0x2dda79){_0x6bbc50['push'](_0x6bbc50['shift']());}};_0x5e8e93(++_0x26b8e9);}(_0xd06f,0x13c));var _0xfd06=function(_0x1ecbd5,_0xf05f7c){_0x1ecbd5=_0x1ecbd5-0x0;var _0x1be527=_0xd06f[_0x1ecbd5];return _0x1be527;};'use strict';var Sequelize=require(_0xfd06('0x0'));module[_0xfd06('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfd06('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfd06('0x3')]},'timeout':{'type':Sequelize[_0xfd06('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfd06('0x5')](_0xfd06('0x6'),_0xfd06('0x7'),_0xfd06('0x8'))}}; \ No newline at end of file +var _0x685b=['INTEGER','ENUM','roundrobin','sequelize','exports','STRING','name'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x685b,0x199));var _0xb685=function(_0x2aa3ed,_0x21bb61){_0x2aa3ed=_0x2aa3ed-0x0;var _0x4e0881=_0x685b[_0x2aa3ed];return _0x4e0881;};'use strict';var Sequelize=require(_0xb685('0x0'));module[_0xb685('0x1')]={'name':{'type':Sequelize[_0xb685('0x2')],'unique':_0xb685('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb685('0x2')]},'timeout':{'type':Sequelize[_0xb685('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb685('0x5')]('rrmemory','beepall',_0xb685('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 620c61b..95cd76f 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 _0x5464=['length','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','pick','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','every','TeamId','all','value','transaction','isEmpty','userMailQueue:remove','addAgents','spread','removeAgents','isArray','emit','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','squel','crypto','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','../../mysqldb','redis','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','MailQueues','UserProfileResource','stack','name','send','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','nolimit','sort','where','merge','VIRTUAL','filter','MailQueue','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x5202ac,_0x4ca95a){var _0x27069a=function(_0x72923e){while(--_0x72923e){_0x5202ac['push'](_0x5202ac['shift']());}};_0x27069a(++_0x4ca95a);}(_0x5464,0x15d));var _0x4546=function(_0x168b93,_0x5bfe66){_0x168b93=_0x168b93-0x0;var _0x4d5ce8=_0x5464[_0x168b93];return _0x4d5ce8;};'use strict';var pdf=require(_0x4546('0x0'));var emlformat=require(_0x4546('0x1'));var rimraf=require(_0x4546('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4546('0x3'));var rp=require('request-promise');var moment=require(_0x4546('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4546('0x5'));var util=require(_0x4546('0x6'));var path=require(_0x4546('0x7'));var sox=require(_0x4546('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4546('0x9'));var crypto=require(_0x4546('0xa'));var jsforce=require(_0x4546('0xb'));var deskjs=require(_0x4546('0xc'));var toCsv=require(_0x4546('0xd'));var querystring=require(_0x4546('0xe'));var Papa=require(_0x4546('0xf'));var Redis=require(_0x4546('0x10'));var authService=require(_0x4546('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4546('0x12'));var hardwareService=require(_0x4546('0x13'));var logger=require(_0x4546('0x14'))('api');var utils=require(_0x4546('0x15'));var config=require(_0x4546('0x16'));var licenseUtil=require(_0x4546('0x17'));var db=require(_0x4546('0x18'))['db'];config['redis']=_['defaults'](config[_0x4546('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x4f5571,_0x102180){_0x102180=_0x102180||0xcc;return function(_0x51e279){if(_0x51e279){return _0x4f5571[_0x4546('0x1a')](_0x102180);}return _0x4f5571['status'](_0x102180)[_0x4546('0x1b')]();};}function respondWithResult(_0x564f3e,_0x3741f2){_0x3741f2=_0x3741f2||0xc8;return function(_0x18bc09){if(_0x18bc09){return _0x564f3e[_0x4546('0x1c')](_0x3741f2)[_0x4546('0x1d')](_0x18bc09);}};}function respondWithFilteredResult(_0x2a294b,_0x15e09e){return function(_0x57d8de){if(_0x57d8de){var _0x4ffd6b=_0x57d8de[_0x4546('0x1e')],_0x5780a7=_0x15e09e[_0x4546('0x1f')],_0x330235=_0x15e09e[_0x4546('0x1f')]+_0x15e09e[_0x4546('0x20')],_0x39f552;if(_0x330235>=_0x4ffd6b){_0x330235=_0x4ffd6b;_0x39f552=0xc8;}else{_0x39f552=0xce;}_0x2a294b[_0x4546('0x1c')](_0x39f552);return _0x2a294b[_0x4546('0x21')](_0x4546('0x22'),_0x5780a7+'-'+_0x330235+'/'+_0x4ffd6b)[_0x4546('0x1d')](_0x57d8de);}return null;};}function patchUpdates(_0x57d740){return function(_0x2d689f){try{jsonpatch[_0x4546('0x23')](_0x2d689f,_0x57d740,!![]);}catch(_0x52447c){return BPromise[_0x4546('0x24')](_0x52447c);}return _0x2d689f[_0x4546('0x25')]();};}function saveUpdates(_0x1a1984,_0x2f065d){return function(_0xc2997d){if(_0xc2997d){return _0xc2997d[_0x4546('0x26')](_0x1a1984)['then'](function(_0x3dab5c){return _0x3dab5c;});}return null;};}function removeEntity(_0x2cca8b,_0x4f9fcf){return function(_0x824698){if(_0x824698){return _0x824698[_0x4546('0x27')]()[_0x4546('0x28')](function(){var _0x4467ee=_0x824698[_0x4546('0x29')]({'plain':!![]});var _0x53ae5e=_0x4546('0x2a');return db[_0x4546('0x2b')][_0x4546('0x27')]({'where':{'type':_0x53ae5e,'resourceId':_0x4467ee['id']}})['then'](function(){return _0x824698;});})['then'](function(){_0x2cca8b[_0x4546('0x1c')](0xcc)[_0x4546('0x1b')]();});}};}function handleEntityNotFound(_0x15611c,_0x114963){return function(_0x29a3f0){if(!_0x29a3f0){_0x15611c[_0x4546('0x1a')](0x194);}return _0x29a3f0;};}function handleError(_0xcea7da,_0x586ff1){_0x586ff1=_0x586ff1||0x1f4;return function(_0x367b23){logger['error'](_0x367b23[_0x4546('0x2c')]);if(_0x367b23[_0x4546('0x2d')]){delete _0x367b23['name'];}_0xcea7da['status'](_0x586ff1)[_0x4546('0x2e')](_0x367b23);};}exports['index']=function(_0x3c7c7d,_0x58b69){var _0x480d8e={},_0x5f0226={},_0x1d20fc={'count':0x0,'rows':[]};var _0x3b673f=_[_0x4546('0x2f')](db['MailQueue'][_0x4546('0x30')],function(_0x2c8e44){return{'name':_0x2c8e44['fieldName'],'type':_0x2c8e44[_0x4546('0x31')]['key']};});_0x5f0226[_0x4546('0x32')]=_[_0x4546('0x2f')](_0x3b673f,_0x4546('0x2d'));_0x5f0226[_0x4546('0x33')]=_['keys'](_0x3c7c7d[_0x4546('0x33')]);_0x5f0226[_0x4546('0x34')]=_[_0x4546('0x35')](_0x5f0226[_0x4546('0x32')],_0x5f0226[_0x4546('0x33')]);_0x480d8e[_0x4546('0x36')]=_['intersection'](_0x5f0226[_0x4546('0x32')],qs[_0x4546('0x37')](_0x3c7c7d['query']['fields']));_0x480d8e[_0x4546('0x36')]=_0x480d8e[_0x4546('0x36')]['length']?_0x480d8e[_0x4546('0x36')]:_0x5f0226[_0x4546('0x32')];if(!_0x3c7c7d['query']['hasOwnProperty'](_0x4546('0x38'))){_0x480d8e[_0x4546('0x20')]=qs[_0x4546('0x20')](_0x3c7c7d[_0x4546('0x33')][_0x4546('0x20')]);_0x480d8e[_0x4546('0x1f')]=qs['offset'](_0x3c7c7d[_0x4546('0x33')][_0x4546('0x1f')]);}_0x480d8e['order']=qs[_0x4546('0x39')](_0x3c7c7d['query'][_0x4546('0x39')]);_0x480d8e[_0x4546('0x3a')]=qs['filters'](_['pick'](_0x3c7c7d[_0x4546('0x33')],_0x5f0226[_0x4546('0x34')]),_0x3b673f);if(_0x3c7c7d[_0x4546('0x33')]['filter']){_0x480d8e[_0x4546('0x3a')]=_[_0x4546('0x3b')](_0x480d8e[_0x4546('0x3a')],{'$or':_[_0x4546('0x2f')](_0x3b673f,function(_0x30649f){if(_0x30649f[_0x4546('0x31')]!==_0x4546('0x3c')){var _0xd589c5={};_0xd589c5[_0x30649f['name']]={'$like':'%'+_0x3c7c7d[_0x4546('0x33')][_0x4546('0x3d')]+'%'};return _0xd589c5;}})});}_0x480d8e=_['merge']({},_0x480d8e,_0x3c7c7d['options']);var _0x3bafee={'where':_0x480d8e[_0x4546('0x3a')]};return db[_0x4546('0x3e')][_0x4546('0x1e')](_0x3bafee)[_0x4546('0x28')](function(_0x482f29){_0x1d20fc[_0x4546('0x1e')]=_0x482f29;if(_0x3c7c7d[_0x4546('0x33')][_0x4546('0x3f')]){_0x480d8e[_0x4546('0x40')]=[{'all':!![]}];}return db[_0x4546('0x3e')][_0x4546('0x41')](_0x480d8e);})[_0x4546('0x28')](function(_0x39b27a){_0x1d20fc[_0x4546('0x42')]=_0x39b27a;return _0x1d20fc;})['then'](respondWithFilteredResult(_0x58b69,_0x480d8e))[_0x4546('0x43')](handleError(_0x58b69,null));};exports[_0x4546('0x44')]=function(_0x3510e0,_0x35b51e){var _0x1c8b5f={'raw':!![],'where':{'id':_0x3510e0[_0x4546('0x45')]['id']}},_0x1f65a8={};_0x1f65a8[_0x4546('0x32')]=_[_0x4546('0x46')](db[_0x4546('0x3e')][_0x4546('0x30')]);_0x1f65a8['query']=_[_0x4546('0x46')](_0x3510e0[_0x4546('0x33')]);_0x1f65a8['filters']=_[_0x4546('0x35')](_0x1f65a8[_0x4546('0x32')],_0x1f65a8[_0x4546('0x33')]);_0x1c8b5f['attributes']=_[_0x4546('0x35')](_0x1f65a8[_0x4546('0x32')],qs[_0x4546('0x37')](_0x3510e0[_0x4546('0x33')][_0x4546('0x37')]));_0x1c8b5f[_0x4546('0x36')]=_0x1c8b5f[_0x4546('0x36')][_0x4546('0x47')]?_0x1c8b5f[_0x4546('0x36')]:_0x1f65a8[_0x4546('0x32')];if(_0x3510e0['query'][_0x4546('0x3f')]){_0x1c8b5f[_0x4546('0x40')]=[{'all':!![]}];}_0x1c8b5f=_['merge']({},_0x1c8b5f,_0x3510e0[_0x4546('0x48')]);return db[_0x4546('0x3e')][_0x4546('0x49')](_0x1c8b5f)[_0x4546('0x28')](handleEntityNotFound(_0x35b51e,null))['then'](respondWithResult(_0x35b51e,null))[_0x4546('0x43')](handleError(_0x35b51e,null));};exports['create']=function(_0x3b6781,_0x27406c){return db[_0x4546('0x3e')]['create'](_0x3b6781[_0x4546('0x4a')],{})[_0x4546('0x28')](function(_0x13f705){var _0xc8a1f3=_0x3b6781[_0x4546('0x4b')][_0x4546('0x29')]({'plain':!![]});if(!_0xc8a1f3)throw new Error(_0x4546('0x4c'));if(_0xc8a1f3[_0x4546('0x4d')]===_0x4546('0x4b')){var _0x369dc3=_0x13f705[_0x4546('0x29')]({'plain':!![]});var _0x49b0d8=_0x4546('0x2a');return db[_0x4546('0x4e')]['find']({'where':{'name':_0x49b0d8,'userProfileId':_0xc8a1f3[_0x4546('0x4f')]},'raw':!![]})[_0x4546('0x28')](function(_0xca0f44){if(_0xca0f44&&_0xca0f44['autoAssociation']===0x0){return db[_0x4546('0x2b')][_0x4546('0x50')]({'name':_0x369dc3[_0x4546('0x2d')],'resourceId':_0x369dc3['id'],'type':_0xca0f44[_0x4546('0x2d')],'sectionId':_0xca0f44['id']},{})[_0x4546('0x28')](function(){return _0x13f705;});}else{return _0x13f705;}})[_0x4546('0x43')](function(_0x2ca7d8){logger[_0x4546('0x51')](_0x4546('0x52'),_0x2ca7d8);throw _0x2ca7d8;});}return _0x13f705;})[_0x4546('0x28')](respondWithResult(_0x27406c,0xc9))[_0x4546('0x43')](handleError(_0x27406c,null));};exports[_0x4546('0x26')]=function(_0x3d6094,_0x145284){if(_0x3d6094[_0x4546('0x4a')]['id']){delete _0x3d6094[_0x4546('0x4a')]['id'];}return db['MailQueue'][_0x4546('0x49')]({'where':{'id':_0x3d6094[_0x4546('0x45')]['id']}})['then'](handleEntityNotFound(_0x145284,null))[_0x4546('0x28')](saveUpdates(_0x3d6094[_0x4546('0x4a')],null))[_0x4546('0x28')](respondWithResult(_0x145284,null))[_0x4546('0x43')](handleError(_0x145284,null));};exports['destroy']=function(_0x2d3b5b,_0x32248c){return db[_0x4546('0x3e')][_0x4546('0x49')]({'where':{'id':_0x2d3b5b[_0x4546('0x45')]['id']}})[_0x4546('0x28')](handleEntityNotFound(_0x32248c,null))[_0x4546('0x28')](removeEntity(_0x32248c,null))[_0x4546('0x43')](handleError(_0x32248c,null));};exports[_0x4546('0x53')]=function(_0xcf682c,_0x67f40d){return db['MailQueue'][_0x4546('0x53')]()[_0x4546('0x28')](respondWithResult(_0x67f40d,null))[_0x4546('0x43')](handleError(_0x67f40d,null));};exports[_0x4546('0x54')]=function(_0x4890b4,_0x37d128,_0x4a1a00){var _0x28238f={'raw':!![],'where':{}},_0x24e66c={},_0x44e28e;return db[_0x4546('0x3e')][_0x4546('0x55')]({'where':{'id':_0x4890b4['params']['id']}})[_0x4546('0x28')](handleEntityNotFound(_0x37d128,null))['then'](function(_0x340d25){if(_0x340d25){_0x44e28e=_0x340d25['get']({'plain':!![]});_0x24e66c['model']=_['keys'](db[_0x4546('0x56')]['rawAttributes']);_0x24e66c[_0x4546('0x33')]=_[_0x4546('0x46')](_0x4890b4[_0x4546('0x33')]);_0x24e66c[_0x4546('0x34')]=_['intersection'](_0x24e66c[_0x4546('0x32')],_0x24e66c[_0x4546('0x33')]);_0x28238f[_0x4546('0x36')]=_[_0x4546('0x35')](_0x24e66c[_0x4546('0x32')],qs['fields'](_0x4890b4[_0x4546('0x33')][_0x4546('0x37')]));_0x28238f[_0x4546('0x36')]=_0x28238f['attributes'][_0x4546('0x47')]?_0x28238f[_0x4546('0x36')]:_0x24e66c[_0x4546('0x32')];if(!_0x4890b4['query'][_0x4546('0x57')](_0x4546('0x38'))){_0x28238f[_0x4546('0x20')]=qs[_0x4546('0x20')](_0x4890b4[_0x4546('0x33')][_0x4546('0x20')]);_0x28238f[_0x4546('0x1f')]=qs[_0x4546('0x1f')](_0x4890b4['query'][_0x4546('0x1f')]);}_0x28238f[_0x4546('0x58')]=qs[_0x4546('0x39')](_0x4890b4[_0x4546('0x33')][_0x4546('0x39')]);_0x28238f[_0x4546('0x3a')]=qs[_0x4546('0x34')](_[_0x4546('0x59')](_0x4890b4[_0x4546('0x33')],_0x24e66c[_0x4546('0x34')]));_0x28238f[_0x4546('0x3a')][_0x4546('0x5a')]=_0x340d25['id'];if(_0x4890b4[_0x4546('0x33')][_0x4546('0x3d')]){_0x28238f[_0x4546('0x3a')]=_['merge'](_0x28238f[_0x4546('0x3a')],{'$or':_['map'](_0x28238f[_0x4546('0x36')],function(_0xb938f9){var _0x4a5bd4={};_0x4a5bd4[_0xb938f9]={'$like':'%'+_0x4890b4[_0x4546('0x33')][_0x4546('0x3d')]+'%'};return _0x4a5bd4;})});}_0x28238f=_[_0x4546('0x3b')]({},_0x28238f,_0x4890b4[_0x4546('0x48')]);return db[_0x4546('0x56')][_0x4546('0x41')](_0x28238f);}})[_0x4546('0x28')](function(_0x2eb8a7){if(_0x2eb8a7){return db[_0x4546('0x5b')][_0x4546('0x5c')]({'where':{'id':_[_0x4546('0x2f')](_0x2eb8a7,_0x4546('0x5d')),'role':_0x4546('0x5e')},'attributes':['id','name',_0x4546('0x5f'),_0x4546('0x60'),_0x4546('0x61')]});}})['then'](function(_0xb6e936){if(_0xb6e936){return{'count':_0xb6e936[_0x4546('0x1e')],'rows':_[_0x4546('0x2f')](_0xb6e936[_0x4546('0x42')],function(_0x1b687a){return{'membername':_0x1b687a[_0x4546('0x2d')],'UserId':_0x1b687a['id'],'queue_name':_0x44e28e[_0x4546('0x2d')],'MailQueueId':_0x44e28e['id'],'interface':util['format'](_0x4546('0x62'),_0x4546('0x63'),_0x1b687a[_0x4546('0x2d')]),'penalty':0x0,'paused':_0x1b687a['mailPause'],'createdAt':_0x1b687a['createdAt'],'updatedAt':_0x1b687a[_0x4546('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4546('0x28')](respondWithFilteredResult(_0x37d128,_0x28238f))['catch'](handleError(_0x37d128,null));};exports[_0x4546('0x64')]=function(_0xdcd804,_0x121e51,_0x11e2e4){var _0x5e17a2={};var _0x4551a8={};var _0x2be477;var _0x345c7e;return db[_0x4546('0x3e')][_0x4546('0x55')]({'where':{'id':_0xdcd804[_0x4546('0x45')]['id']}})[_0x4546('0x28')](handleEntityNotFound(_0x121e51,null))[_0x4546('0x28')](function(_0x5666a3){if(_0x5666a3){_0x2be477=_0x5666a3;_0x4551a8[_0x4546('0x32')]=_[_0x4546('0x46')](db['Team'][_0x4546('0x30')]);_0x4551a8[_0x4546('0x33')]=_['keys'](_0xdcd804[_0x4546('0x33')]);_0x4551a8[_0x4546('0x34')]=_[_0x4546('0x35')](_0x4551a8['model'],_0x4551a8[_0x4546('0x33')]);_0x5e17a2[_0x4546('0x36')]=_[_0x4546('0x35')](_0x4551a8[_0x4546('0x32')],qs[_0x4546('0x37')](_0xdcd804[_0x4546('0x33')][_0x4546('0x37')]));_0x5e17a2['attributes']=_0x5e17a2['attributes'][_0x4546('0x47')]?_0x5e17a2[_0x4546('0x36')]:_0x4551a8[_0x4546('0x32')];_0x5e17a2[_0x4546('0x58')]=qs[_0x4546('0x39')](_0xdcd804[_0x4546('0x33')]['sort']);_0x5e17a2['where']=qs[_0x4546('0x34')](_[_0x4546('0x59')](_0xdcd804[_0x4546('0x33')],_0x4551a8[_0x4546('0x34')]));if(_0xdcd804[_0x4546('0x33')][_0x4546('0x3d')]){_0x5e17a2[_0x4546('0x3a')]=_[_0x4546('0x3b')](_0x5e17a2['where'],{'$or':_[_0x4546('0x2f')](_0x5e17a2['attributes'],function(_0x1590fc){var _0x4be378={};_0x4be378[_0x1590fc]={'$like':'%'+_0xdcd804[_0x4546('0x33')]['filter']+'%'};return _0x4be378;})});}_0x5e17a2=_[_0x4546('0x3b')]({},_0x5e17a2,_0xdcd804[_0x4546('0x48')]);return _0x2be477[_0x4546('0x64')](_0x5e17a2);}})[_0x4546('0x28')](function(_0xb07ca1){if(_0xb07ca1){_0x345c7e=_0xb07ca1[_0x4546('0x47')];if(!_0xdcd804[_0x4546('0x33')][_0x4546('0x57')](_0x4546('0x38'))){_0x5e17a2[_0x4546('0x20')]=qs['limit'](_0xdcd804[_0x4546('0x33')][_0x4546('0x20')]);_0x5e17a2['offset']=qs[_0x4546('0x1f')](_0xdcd804[_0x4546('0x33')][_0x4546('0x1f')]);}return _0x2be477[_0x4546('0x64')](_0x5e17a2);}})['then'](function(_0x5d8a33){if(_0x5d8a33){return _0x5d8a33?{'count':_0x345c7e,'rows':_0x5d8a33}:null;}})[_0x4546('0x28')](respondWithResult(_0x121e51,null))[_0x4546('0x43')](handleError(_0x121e51,null));};exports[_0x4546('0x65')]=function(_0x1ee186,_0x2b48a9,_0x4a7588){var _0x4ba66=_0x1ee186[_0x4546('0x4a')][_0x4546('0x66')];return db[_0x4546('0x67')][_0x4546('0x41')]({'where':{'id':_0x4ba66},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4546('0x68'),'attributes':['id','name',_0x4546('0x69'),_0x4546('0x6a'),_0x4546('0x6b')],'raw':!![]}]})[_0x4546('0x28')](function(_0x29e6e3){if(_0x29e6e3){var _0x19ff9b=_[_0x4546('0x6c')](_0x29e6e3,function(_0x210712){var _0x534f82=_0x210712[_0x4546('0x29')]({'plain':!![]});return _0x534f82[_0x4546('0x68')];});return db[_0x4546('0x3e')][_0x4546('0x49')]({'where':{'id':_0x1ee186[_0x4546('0x45')]['id']}})['then'](function(_0x39fbe2){return db['sequelize']['transaction'](function(_0x4c9e0b){return _0x39fbe2[_0x4546('0x65')](_0x4ba66,{'transaction':_0x4c9e0b})[_0x4546('0x28')](function(){return BPromise[_0x4546('0x6d')](_0x19ff9b,function(_0x13a29b){return db[_0x4546('0x56')][_0x4546('0x6e')]({'where':{'UserId':_0x13a29b['id'],'MailQueueId':_0x1ee186[_0x4546('0x45')]['id']},'transaction':_0x4c9e0b});});})[_0x4546('0x28')](function(){_0x19ff9b[_0x4546('0x6f')](function(_0x2df3d5){socket['emit'](_0x4546('0x70'),{'UserId':_0x2df3d5['id'],'MailQueueId':_0x39fbe2['id']});});});});});}})['then'](respondWithStatusCode(_0x2b48a9,null))[_0x4546('0x43')](handleError(_0x2b48a9,null));};exports[_0x4546('0x71')]=function(_0x3dbafd,_0x2d7999,_0xd25922){return db[_0x4546('0x67')][_0x4546('0x41')]({'where':{'id':_0x3dbafd['query'][_0x4546('0x66')]},'attributes':['id'],'include':[{'model':db[_0x4546('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4546('0x28')](handleEntityNotFound(_0x2d7999,null))[_0x4546('0x28')](function(_0xdb5b37){var _0x235f2d=_[_0x4546('0x2f')](_0xdb5b37,'id');var _0x2a9010=[];var _0x210d6d=[];var _0x23e34d=squel[_0x4546('0x72')]();_0x23e34d[_0x4546('0x73')](_0x4546('0x74'))[_0x4546('0x75')]('team_has_mail_queues','tq')[_0x4546('0x76')](_0x4546('0x77'),'ut',_0x4546('0x78'))[_0x4546('0x3a')](_0x4546('0x79'),_0x3dbafd[_0x4546('0x45')]['id']);for(var _0x3cc86c=0x0;_0x3cc86c<_0xdb5b37[_0x4546('0x47')];_0x3cc86c+=0x1){let _0x3855e9=_0xdb5b37[_0x3cc86c];for(var _0x27e99e=0x0;_0x27e99e<_0x3855e9[_0x4546('0x68')][_0x4546('0x47')];_0x27e99e+=0x1){let _0x3a5663=_0x3855e9[_0x4546('0x68')][_0x27e99e];var _0x1ebc4d=_0x23e34d[_0x4546('0x7a')]();_0x1ebc4d[_0x4546('0x3a')](_0x4546('0x7b'),_0x3a5663['id']);_0x210d6d[_0x4546('0x7c')](db[_0x4546('0x7d')][_0x4546('0x33')](_0x1ebc4d[_0x4546('0x7e')](),{'type':db[_0x4546('0x7d')]['QueryTypes']['SELECT']})[_0x4546('0x28')](function(_0x509745){if(_0x509745[_0x4546('0x47')]===0x1){return _0x3a5663['id'];}else{var _0x3ce918=_[_0x4546('0x7f')](_['map'](_0x509745,_0x4546('0x80')),function(_0x55010f){return _['includes'](_0x235f2d,_0x55010f);});if(_0x3ce918){return _0x3a5663['id'];}}}));}}return BPromise[_0x4546('0x81')](_0x210d6d)[_0x4546('0x28')](function(_0xad28f5){_0x2a9010=_(_0x2a9010)['union'](_0xad28f5)['compact']()[_0x4546('0x82')]();return db[_0x4546('0x3e')]['find']({'where':{'id':_0x3dbafd[_0x4546('0x45')]['id']}})[_0x4546('0x28')](function(_0x7157e6){return db[_0x4546('0x7d')][_0x4546('0x83')](function(_0x65a6a4){return _0x7157e6[_0x4546('0x71')](_0x3dbafd['query'][_0x4546('0x66')],{'transaction':_0x65a6a4})['then'](function(){if(!_[_0x4546('0x84')](_0x2a9010)){return _0x7157e6['removeAgents'](_0x2a9010,{'transaction':_0x65a6a4});}})['then'](function(){_0x2a9010[_0x4546('0x6f')](function(_0x4ceebf){socket['emit'](_0x4546('0x85'),{'UserId':_0x4ceebf,'MailQueueId':_0x7157e6['id']});});});});});});})[_0x4546('0x28')](respondWithStatusCode(_0x2d7999,null))[_0x4546('0x43')](handleError(_0x2d7999,null));};exports[_0x4546('0x86')]=function(_0x274341,_0x899186,_0x2b6b26){return db['MailQueue'][_0x4546('0x49')]({'where':{'id':_0x274341['params']['id']}})[_0x4546('0x28')](handleEntityNotFound(_0x899186,null))[_0x4546('0x28')](function(_0x24798b){if(_0x24798b){return _0x24798b[_0x4546('0x86')](_0x274341[_0x4546('0x4a')][_0x4546('0x66')],_['omit'](_0x274341[_0x4546('0x4a')],[_0x4546('0x66'),'id'])||{})[_0x4546('0x87')](function(_0xc0771c){for(var _0x53c40c=0x0;_0x53c40c<_0x274341[_0x4546('0x4a')][_0x4546('0x66')][_0x4546('0x47')];_0x53c40c+=0x1){socket['emit']('userMailQueue:save',{'UserId':_0x274341['body'][_0x4546('0x66')][_0x53c40c],'MailQueueId':_0x274341['params']['id']});}return _0xc0771c;});}})[_0x4546('0x28')](respondWithResult(_0x899186,null))['catch'](handleError(_0x899186,null));};exports[_0x4546('0x88')]=function(_0x55ec89,_0x43c37a,_0x645df3){return db['MailQueue'][_0x4546('0x49')]({'where':{'id':_0x55ec89['params']['id']}})[_0x4546('0x28')](handleEntityNotFound(_0x43c37a,null))[_0x4546('0x28')](function(_0x461231){if(_0x461231){return _0x461231[_0x4546('0x88')](_0x55ec89[_0x4546('0x33')]['ids'])[_0x4546('0x28')](function(){if(_[_0x4546('0x89')](_0x55ec89[_0x4546('0x33')][_0x4546('0x66')])){for(var _0x1b6f26=0x0;_0x1b6f26<_0x55ec89['query'][_0x4546('0x66')][_0x4546('0x47')];_0x1b6f26+=0x1){socket[_0x4546('0x8a')](_0x4546('0x85'),{'UserId':Number(_0x55ec89[_0x4546('0x33')][_0x4546('0x66')][_0x1b6f26]),'MailQueueId':Number(_0x55ec89['params']['id'])});}}else{socket['emit'](_0x4546('0x85'),{'UserId':Number(_0x55ec89[_0x4546('0x33')][_0x4546('0x66')]),'MailQueueId':Number(_0x55ec89[_0x4546('0x45')]['id'])});}});}})[_0x4546('0x28')](respondWithStatusCode(_0x43c37a,null))['catch'](handleError(_0x43c37a,null));};exports['getAgents']=function(_0x7f8632,_0x2c54ee,_0x697259){var _0x228e87={};var _0x1470c2={};var _0x18f264;var _0x93d675;return db[_0x4546('0x3e')][_0x4546('0x55')]({'where':{'id':_0x7f8632[_0x4546('0x45')]['id']}})[_0x4546('0x28')](handleEntityNotFound(_0x2c54ee,null))['then'](function(_0x4c1118){if(_0x4c1118){_0x18f264=_0x4c1118;_0x1470c2[_0x4546('0x32')]=_['keys'](db[_0x4546('0x5b')]['rawAttributes']);_0x1470c2['query']=_['keys'](_0x7f8632[_0x4546('0x33')]);_0x1470c2[_0x4546('0x34')]=_[_0x4546('0x35')](_0x1470c2[_0x4546('0x32')],_0x1470c2[_0x4546('0x33')]);_0x228e87['attributes']=_[_0x4546('0x35')](_0x1470c2[_0x4546('0x32')],qs[_0x4546('0x37')](_0x7f8632[_0x4546('0x33')][_0x4546('0x37')]));_0x228e87[_0x4546('0x36')]=_0x228e87[_0x4546('0x36')][_0x4546('0x47')]?_0x228e87[_0x4546('0x36')]:_0x1470c2[_0x4546('0x32')];_0x228e87['order']=qs[_0x4546('0x39')](_0x7f8632[_0x4546('0x33')]['sort']);_0x228e87['where']=qs[_0x4546('0x34')](_[_0x4546('0x59')](_0x7f8632['query'],_0x1470c2[_0x4546('0x34')]));if(_0x7f8632['query']['filter']){_0x228e87['where']=_[_0x4546('0x3b')](_0x228e87[_0x4546('0x3a')],{'$or':_['map'](_0x228e87[_0x4546('0x36')],function(_0x218edc){var _0x1bb34e={};_0x1bb34e[_0x218edc]={'$like':'%'+_0x7f8632[_0x4546('0x33')]['filter']+'%'};return _0x1bb34e;})});}_0x228e87=_[_0x4546('0x3b')]({},_0x228e87,_0x7f8632[_0x4546('0x48')]);return _0x18f264[_0x4546('0x8b')](_0x228e87);}})[_0x4546('0x28')](function(_0x10e2a3){if(_0x10e2a3){_0x93d675=_0x10e2a3[_0x4546('0x47')];if(!_0x7f8632['query'][_0x4546('0x57')]('nolimit')){_0x228e87['limit']=qs[_0x4546('0x20')](_0x7f8632['query'][_0x4546('0x20')]);_0x228e87[_0x4546('0x1f')]=qs[_0x4546('0x1f')](_0x7f8632[_0x4546('0x33')][_0x4546('0x1f')]);}return _0x18f264['getAgents'](_0x228e87);}})[_0x4546('0x28')](function(_0x3e9c0a){if(_0x3e9c0a){return _0x3e9c0a?{'count':_0x93d675,'rows':_0x3e9c0a}:null;}})['then'](respondWithResult(_0x2c54ee,null))[_0x4546('0x43')](handleError(_0x2c54ee,null));}; \ No newline at end of file +var _0xfff0=['getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','select','field','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','isEmpty','removeAgents','forEach','addAgents','spread','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./mailQueue.socket','register','status','json','count','offset','limit','set','apply','save','update','then','destroy','MailQueues','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','order','options','User','UserId','agent','mailPause','updatedAt','rows','%s/%s','SIP','createdAt'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0xfff0,0x139));var _0x0fff=function(_0x5a5d22,_0x495264){_0x5a5d22=_0x5a5d22-0x0;var _0x30f404=_0xfff0[_0x5a5d22];return _0x30f404;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0fff('0x0'));var rimraf=require(_0x0fff('0x1'));var zipdir=require(_0x0fff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0fff('0x3'));var moment=require(_0x0fff('0x4'));var BPromise=require(_0x0fff('0x5'));var Mustache=require('mustache');var util=require(_0x0fff('0x6'));var path=require(_0x0fff('0x7'));var sox=require('sox');var csv=require(_0x0fff('0x8'));var ejs=require(_0x0fff('0x9'));var fs=require('fs');var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];config[_0x0fff('0x19')]=_['defaults'](config[_0x0fff('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0x1a'))(new Redis(config[_0x0fff('0x19')]));require(_0x0fff('0x1b'))[_0x0fff('0x1c')](socket);function respondWithStatusCode(_0x55e5fa,_0x53bde9){_0x53bde9=_0x53bde9||0xcc;return function(_0x1daf30){if(_0x1daf30){return _0x55e5fa['sendStatus'](_0x53bde9);}return _0x55e5fa['status'](_0x53bde9)['end']();};}function respondWithResult(_0x1fb430,_0x41e2e7){_0x41e2e7=_0x41e2e7||0xc8;return function(_0x5eab2e){if(_0x5eab2e){return _0x1fb430[_0x0fff('0x1d')](_0x41e2e7)[_0x0fff('0x1e')](_0x5eab2e);}};}function respondWithFilteredResult(_0x540a67,_0x528071){return function(_0x48f36d){if(_0x48f36d){var _0x2337f=_0x48f36d[_0x0fff('0x1f')],_0x606792=_0x528071[_0x0fff('0x20')],_0x46a02d=_0x528071['offset']+_0x528071[_0x0fff('0x21')],_0x3762dc;if(_0x46a02d>=_0x2337f){_0x46a02d=_0x2337f;_0x3762dc=0xc8;}else{_0x3762dc=0xce;}_0x540a67[_0x0fff('0x1d')](_0x3762dc);return _0x540a67[_0x0fff('0x22')]('Content-Range',_0x606792+'-'+_0x46a02d+'/'+_0x2337f)['json'](_0x48f36d);}return null;};}function patchUpdates(_0x40831d){return function(_0x330e29){try{jsonpatch[_0x0fff('0x23')](_0x330e29,_0x40831d,!![]);}catch(_0x3c4f8f){return BPromise['reject'](_0x3c4f8f);}return _0x330e29[_0x0fff('0x24')]();};}function saveUpdates(_0x2f8665,_0x29d703){return function(_0x4669cc){if(_0x4669cc){return _0x4669cc[_0x0fff('0x25')](_0x2f8665)[_0x0fff('0x26')](function(_0x580b8e){return _0x580b8e;});}return null;};}function removeEntity(_0x6a116c,_0x29f702){return function(_0x37e090){if(_0x37e090){return _0x37e090[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){var _0x23d9f8=_0x37e090['get']({'plain':!![]});var _0x2c9725=_0x0fff('0x28');return db[_0x0fff('0x29')][_0x0fff('0x27')]({'where':{'type':_0x2c9725,'resourceId':_0x23d9f8['id']}})[_0x0fff('0x26')](function(){return _0x37e090;});})[_0x0fff('0x26')](function(){_0x6a116c[_0x0fff('0x1d')](0xcc)[_0x0fff('0x2a')]();});}};}function handleEntityNotFound(_0x44e54a,_0xc32a61){return function(_0x40651c){if(!_0x40651c){_0x44e54a[_0x0fff('0x2b')](0x194);}return _0x40651c;};}function handleError(_0x495734,_0x7046a3){_0x7046a3=_0x7046a3||0x1f4;return function(_0x2d1800){logger[_0x0fff('0x2c')](_0x2d1800[_0x0fff('0x2d')]);if(_0x2d1800[_0x0fff('0x2e')]){delete _0x2d1800[_0x0fff('0x2e')];}_0x495734['status'](_0x7046a3)[_0x0fff('0x2f')](_0x2d1800);};}exports[_0x0fff('0x30')]=function(_0x351102,_0x48f1d1){var _0x1016fa={},_0x3fa6fc={},_0x4bc2e0={'count':0x0,'rows':[]};var _0x3daf51=_[_0x0fff('0x31')](db[_0x0fff('0x32')][_0x0fff('0x33')],function(_0x25ab2a){return{'name':_0x25ab2a[_0x0fff('0x34')],'type':_0x25ab2a[_0x0fff('0x35')][_0x0fff('0x36')]};});_0x3fa6fc[_0x0fff('0x37')]=_[_0x0fff('0x31')](_0x3daf51,'name');_0x3fa6fc[_0x0fff('0x38')]=_[_0x0fff('0x39')](_0x351102[_0x0fff('0x38')]);_0x3fa6fc[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x3fa6fc['model'],_0x3fa6fc['query']);_0x1016fa[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x3fa6fc[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x351102['query'][_0x0fff('0x3d')]));_0x1016fa[_0x0fff('0x3c')]=_0x1016fa[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x1016fa['attributes']:_0x3fa6fc[_0x0fff('0x37')];if(!_0x351102[_0x0fff('0x38')][_0x0fff('0x3f')](_0x0fff('0x40'))){_0x1016fa[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x351102[_0x0fff('0x38')][_0x0fff('0x21')]);_0x1016fa[_0x0fff('0x20')]=qs[_0x0fff('0x20')](_0x351102[_0x0fff('0x38')][_0x0fff('0x20')]);}_0x1016fa['order']=qs[_0x0fff('0x41')](_0x351102[_0x0fff('0x38')][_0x0fff('0x41')]);_0x1016fa[_0x0fff('0x42')]=qs[_0x0fff('0x3a')](_[_0x0fff('0x43')](_0x351102['query'],_0x3fa6fc[_0x0fff('0x3a')]),_0x3daf51);if(_0x351102[_0x0fff('0x38')][_0x0fff('0x44')]){_0x1016fa[_0x0fff('0x42')]=_[_0x0fff('0x45')](_0x1016fa[_0x0fff('0x42')],{'$or':_[_0x0fff('0x31')](_0x3daf51,function(_0x425ec1){if(_0x425ec1[_0x0fff('0x35')]!=='VIRTUAL'){var _0x2cab47={};_0x2cab47[_0x425ec1['name']]={'$like':'%'+_0x351102[_0x0fff('0x38')][_0x0fff('0x44')]+'%'};return _0x2cab47;}})});}_0x1016fa=_[_0x0fff('0x45')]({},_0x1016fa,_0x351102['options']);var _0x5d4c24={'where':_0x1016fa[_0x0fff('0x42')]};return db[_0x0fff('0x32')][_0x0fff('0x1f')](_0x5d4c24)['then'](function(_0x536cc2){_0x4bc2e0[_0x0fff('0x1f')]=_0x536cc2;if(_0x351102['query'][_0x0fff('0x46')]){_0x1016fa[_0x0fff('0x47')]=[{'all':!![]}];}return db[_0x0fff('0x32')][_0x0fff('0x48')](_0x1016fa);})[_0x0fff('0x26')](function(_0x26fc5f){_0x4bc2e0['rows']=_0x26fc5f;return _0x4bc2e0;})[_0x0fff('0x26')](respondWithFilteredResult(_0x48f1d1,_0x1016fa))[_0x0fff('0x49')](handleError(_0x48f1d1,null));};exports[_0x0fff('0x4a')]=function(_0x41b4d5,_0x7157e5){var _0xebc17b={'raw':!![],'where':{'id':_0x41b4d5['params']['id']}},_0x353522={};_0x353522[_0x0fff('0x37')]=_[_0x0fff('0x39')](db[_0x0fff('0x32')]['rawAttributes']);_0x353522[_0x0fff('0x38')]=_[_0x0fff('0x39')](_0x41b4d5[_0x0fff('0x38')]);_0x353522[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x353522[_0x0fff('0x37')],_0x353522[_0x0fff('0x38')]);_0xebc17b[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x353522[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x41b4d5['query'][_0x0fff('0x3d')]));_0xebc17b[_0x0fff('0x3c')]=_0xebc17b['attributes'][_0x0fff('0x3e')]?_0xebc17b[_0x0fff('0x3c')]:_0x353522[_0x0fff('0x37')];if(_0x41b4d5['query']['includeAll']){_0xebc17b[_0x0fff('0x47')]=[{'all':!![]}];}_0xebc17b=_['merge']({},_0xebc17b,_0x41b4d5['options']);return db[_0x0fff('0x32')][_0x0fff('0x4b')](_0xebc17b)[_0x0fff('0x26')](handleEntityNotFound(_0x7157e5,null))[_0x0fff('0x26')](respondWithResult(_0x7157e5,null))[_0x0fff('0x49')](handleError(_0x7157e5,null));};exports[_0x0fff('0x4c')]=function(_0x552440,_0x350144){return db[_0x0fff('0x32')][_0x0fff('0x4c')](_0x552440[_0x0fff('0x4d')],{})[_0x0fff('0x26')](function(_0x2c725c){var _0x5d1739=_0x552440[_0x0fff('0x4e')][_0x0fff('0x4f')]({'plain':!![]});if(!_0x5d1739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d1739[_0x0fff('0x50')]==='user'){var _0x5f1943=_0x2c725c['get']({'plain':!![]});var _0x218e1c=_0x0fff('0x28');return db[_0x0fff('0x51')][_0x0fff('0x4b')]({'where':{'name':_0x218e1c,'userProfileId':_0x5d1739[_0x0fff('0x52')]},'raw':!![]})['then'](function(_0x2524ad){if(_0x2524ad&&_0x2524ad[_0x0fff('0x53')]===0x0){return db[_0x0fff('0x29')][_0x0fff('0x4c')]({'name':_0x5f1943[_0x0fff('0x2e')],'resourceId':_0x5f1943['id'],'type':_0x2524ad['name'],'sectionId':_0x2524ad['id']},{})[_0x0fff('0x26')](function(){return _0x2c725c;});}else{return _0x2c725c;}})[_0x0fff('0x49')](function(_0x2c18fd){logger[_0x0fff('0x2c')](_0x0fff('0x54'),_0x2c18fd);throw _0x2c18fd;});}return _0x2c725c;})[_0x0fff('0x26')](respondWithResult(_0x350144,0xc9))[_0x0fff('0x49')](handleError(_0x350144,null));};exports[_0x0fff('0x25')]=function(_0x306815,_0x216e12){if(_0x306815[_0x0fff('0x4d')]['id']){delete _0x306815[_0x0fff('0x4d')]['id'];}return db[_0x0fff('0x32')][_0x0fff('0x4b')]({'where':{'id':_0x306815[_0x0fff('0x55')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x216e12,null))[_0x0fff('0x26')](saveUpdates(_0x306815[_0x0fff('0x4d')],null))[_0x0fff('0x26')](respondWithResult(_0x216e12,null))[_0x0fff('0x49')](handleError(_0x216e12,null));};exports[_0x0fff('0x27')]=function(_0x50cfc9,_0x25d696){return db[_0x0fff('0x32')][_0x0fff('0x4b')]({'where':{'id':_0x50cfc9[_0x0fff('0x55')]['id']}})['then'](handleEntityNotFound(_0x25d696,null))[_0x0fff('0x26')](removeEntity(_0x25d696,null))['catch'](handleError(_0x25d696,null));};exports[_0x0fff('0x56')]=function(_0x1f216d,_0x131842){return db[_0x0fff('0x32')]['describe']()[_0x0fff('0x26')](respondWithResult(_0x131842,null))[_0x0fff('0x49')](handleError(_0x131842,null));};exports[_0x0fff('0x57')]=function(_0x226d6d,_0x4cf619,_0x5ba7e7){var _0x449da4={'raw':!![],'where':{}},_0x40b8f0={},_0x147939;return db[_0x0fff('0x32')][_0x0fff('0x58')]({'where':{'id':_0x226d6d[_0x0fff('0x55')]['id']}})['then'](handleEntityNotFound(_0x4cf619,null))['then'](function(_0x1efc0f){if(_0x1efc0f){_0x147939=_0x1efc0f[_0x0fff('0x4f')]({'plain':!![]});_0x40b8f0[_0x0fff('0x37')]=_[_0x0fff('0x39')](db[_0x0fff('0x59')][_0x0fff('0x33')]);_0x40b8f0[_0x0fff('0x38')]=_[_0x0fff('0x39')](_0x226d6d['query']);_0x40b8f0[_0x0fff('0x3a')]=_['intersection'](_0x40b8f0[_0x0fff('0x37')],_0x40b8f0[_0x0fff('0x38')]);_0x449da4[_0x0fff('0x3c')]=_['intersection'](_0x40b8f0['model'],qs[_0x0fff('0x3d')](_0x226d6d['query'][_0x0fff('0x3d')]));_0x449da4[_0x0fff('0x3c')]=_0x449da4[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x449da4['attributes']:_0x40b8f0[_0x0fff('0x37')];if(!_0x226d6d[_0x0fff('0x38')]['hasOwnProperty'](_0x0fff('0x40'))){_0x449da4[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x226d6d['query'][_0x0fff('0x21')]);_0x449da4[_0x0fff('0x20')]=qs[_0x0fff('0x20')](_0x226d6d[_0x0fff('0x38')][_0x0fff('0x20')]);}_0x449da4[_0x0fff('0x5a')]=qs[_0x0fff('0x41')](_0x226d6d[_0x0fff('0x38')][_0x0fff('0x41')]);_0x449da4[_0x0fff('0x42')]=qs[_0x0fff('0x3a')](_[_0x0fff('0x43')](_0x226d6d['query'],_0x40b8f0['filters']));_0x449da4[_0x0fff('0x42')]['MailQueueId']=_0x1efc0f['id'];if(_0x226d6d['query'][_0x0fff('0x44')]){_0x449da4[_0x0fff('0x42')]=_[_0x0fff('0x45')](_0x449da4['where'],{'$or':_['map'](_0x449da4[_0x0fff('0x3c')],function(_0x1f9869){var _0x2e996c={};_0x2e996c[_0x1f9869]={'$like':'%'+_0x226d6d[_0x0fff('0x38')]['filter']+'%'};return _0x2e996c;})});}_0x449da4=_[_0x0fff('0x45')]({},_0x449da4,_0x226d6d[_0x0fff('0x5b')]);return db[_0x0fff('0x59')][_0x0fff('0x48')](_0x449da4);}})['then'](function(_0x2b5d13){if(_0x2b5d13){return db[_0x0fff('0x5c')]['findAndCountAll']({'where':{'id':_['map'](_0x2b5d13,_0x0fff('0x5d')),'role':_0x0fff('0x5e')},'attributes':['id',_0x0fff('0x2e'),_0x0fff('0x5f'),_0x0fff('0x60'),'createdAt']});}})[_0x0fff('0x26')](function(_0x7b040){if(_0x7b040){return{'count':_0x7b040[_0x0fff('0x1f')],'rows':_[_0x0fff('0x31')](_0x7b040[_0x0fff('0x61')],function(_0x522a4c){return{'membername':_0x522a4c['name'],'UserId':_0x522a4c['id'],'queue_name':_0x147939[_0x0fff('0x2e')],'MailQueueId':_0x147939['id'],'interface':util['format'](_0x0fff('0x62'),_0x0fff('0x63'),_0x522a4c[_0x0fff('0x2e')]),'penalty':0x0,'paused':_0x522a4c[_0x0fff('0x5f')],'createdAt':_0x522a4c[_0x0fff('0x64')],'updatedAt':_0x522a4c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0fff('0x26')](respondWithFilteredResult(_0x4cf619,_0x449da4))[_0x0fff('0x49')](handleError(_0x4cf619,null));};exports[_0x0fff('0x65')]=function(_0xa97b12,_0x31ff4e,_0x15ab8e){var _0x38e2e9={};var _0x41c7a8={};var _0x1269a3;var _0xfac929;return db[_0x0fff('0x32')]['findOne']({'where':{'id':_0xa97b12[_0x0fff('0x55')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x31ff4e,null))['then'](function(_0x11a5b8){if(_0x11a5b8){_0x1269a3=_0x11a5b8;_0x41c7a8['model']=_[_0x0fff('0x39')](db[_0x0fff('0x66')][_0x0fff('0x33')]);_0x41c7a8[_0x0fff('0x38')]=_[_0x0fff('0x39')](_0xa97b12['query']);_0x41c7a8[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x41c7a8['model'],_0x41c7a8[_0x0fff('0x38')]);_0x38e2e9[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x41c7a8['model'],qs[_0x0fff('0x3d')](_0xa97b12[_0x0fff('0x38')]['fields']));_0x38e2e9['attributes']=_0x38e2e9[_0x0fff('0x3c')]['length']?_0x38e2e9['attributes']:_0x41c7a8[_0x0fff('0x37')];_0x38e2e9[_0x0fff('0x5a')]=qs[_0x0fff('0x41')](_0xa97b12['query']['sort']);_0x38e2e9[_0x0fff('0x42')]=qs['filters'](_[_0x0fff('0x43')](_0xa97b12[_0x0fff('0x38')],_0x41c7a8[_0x0fff('0x3a')]));if(_0xa97b12[_0x0fff('0x38')][_0x0fff('0x44')]){_0x38e2e9[_0x0fff('0x42')]=_[_0x0fff('0x45')](_0x38e2e9['where'],{'$or':_[_0x0fff('0x31')](_0x38e2e9[_0x0fff('0x3c')],function(_0x374701){var _0x5afc54={};_0x5afc54[_0x374701]={'$like':'%'+_0xa97b12[_0x0fff('0x38')][_0x0fff('0x44')]+'%'};return _0x5afc54;})});}_0x38e2e9=_['merge']({},_0x38e2e9,_0xa97b12[_0x0fff('0x5b')]);return _0x1269a3['getTeams'](_0x38e2e9);}})[_0x0fff('0x26')](function(_0xa932e2){if(_0xa932e2){_0xfac929=_0xa932e2[_0x0fff('0x3e')];if(!_0xa97b12[_0x0fff('0x38')]['hasOwnProperty']('nolimit')){_0x38e2e9[_0x0fff('0x21')]=qs['limit'](_0xa97b12[_0x0fff('0x38')][_0x0fff('0x21')]);_0x38e2e9['offset']=qs['offset'](_0xa97b12[_0x0fff('0x38')][_0x0fff('0x20')]);}return _0x1269a3[_0x0fff('0x65')](_0x38e2e9);}})[_0x0fff('0x26')](function(_0x5b8488){if(_0x5b8488){return _0x5b8488?{'count':_0xfac929,'rows':_0x5b8488}:null;}})[_0x0fff('0x26')](respondWithResult(_0x31ff4e,null))['catch'](handleError(_0x31ff4e,null));};exports[_0x0fff('0x67')]=function(_0x20d348,_0x184203,_0x5a6a66){var _0x5930bf=_0x20d348['body'][_0x0fff('0x68')];return db['Team'][_0x0fff('0x48')]({'where':{'id':_0x5930bf},'attributes':['id'],'include':[{'model':db[_0x0fff('0x5c')],'as':_0x0fff('0x69'),'attributes':['id',_0x0fff('0x2e'),_0x0fff('0x6a'),_0x0fff('0x6b'),_0x0fff('0x6c')],'raw':!![]}]})[_0x0fff('0x26')](function(_0x39ce3a){if(_0x39ce3a){var _0x189676=_[_0x0fff('0x6d')](_0x39ce3a,function(_0x55a9d2){var _0x46aae7=_0x55a9d2[_0x0fff('0x4f')]({'plain':!![]});return _0x46aae7[_0x0fff('0x69')];});return db[_0x0fff('0x32')][_0x0fff('0x4b')]({'where':{'id':_0x20d348['params']['id']}})[_0x0fff('0x26')](function(_0xd1ff47){return db['sequelize'][_0x0fff('0x6e')](function(_0x12673f){return _0xd1ff47[_0x0fff('0x67')](_0x5930bf,{'transaction':_0x12673f})[_0x0fff('0x26')](function(){return BPromise[_0x0fff('0x6f')](_0x189676,function(_0x2b1688){return db[_0x0fff('0x59')][_0x0fff('0x70')]({'where':{'UserId':_0x2b1688['id'],'MailQueueId':_0x20d348[_0x0fff('0x55')]['id']},'transaction':_0x12673f});});})[_0x0fff('0x26')](function(){_0x189676['forEach'](function(_0x797188){socket[_0x0fff('0x71')](_0x0fff('0x72'),{'UserId':_0x797188['id'],'MailQueueId':_0xd1ff47['id']});});});});});}})[_0x0fff('0x26')](respondWithStatusCode(_0x184203,null))[_0x0fff('0x49')](handleError(_0x184203,null));};exports[_0x0fff('0x73')]=function(_0x1d67be,_0x53fe4d,_0x1579e2){return db['Team'][_0x0fff('0x48')]({'where':{'id':_0x1d67be[_0x0fff('0x38')][_0x0fff('0x68')]},'attributes':['id'],'include':[{'model':db[_0x0fff('0x5c')],'as':_0x0fff('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x53fe4d,null))[_0x0fff('0x26')](function(_0x4df078){var _0x579094=_[_0x0fff('0x31')](_0x4df078,'id');var _0x173b44=[];var _0x3d8df3=[];var _0x28b7bd=squel[_0x0fff('0x74')]();_0x28b7bd[_0x0fff('0x75')]('tq.TeamId')['from']('team_has_mail_queues','tq')[_0x0fff('0x76')](_0x0fff('0x77'),'ut',_0x0fff('0x78'))[_0x0fff('0x42')](_0x0fff('0x79'),_0x1d67be[_0x0fff('0x55')]['id']);for(var _0x2138c3=0x0;_0x2138c3<_0x4df078[_0x0fff('0x3e')];_0x2138c3+=0x1){let _0xed7e93=_0x4df078[_0x2138c3];for(var _0x3e43f6=0x0;_0x3e43f6<_0xed7e93[_0x0fff('0x69')][_0x0fff('0x3e')];_0x3e43f6+=0x1){let _0x26de6c=_0xed7e93[_0x0fff('0x69')][_0x3e43f6];var _0x29cb1b=_0x28b7bd[_0x0fff('0x7a')]();_0x29cb1b[_0x0fff('0x42')]('ut.UserId\x20=\x20?',_0x26de6c['id']);_0x3d8df3[_0x0fff('0x7b')](db[_0x0fff('0x7c')][_0x0fff('0x38')](_0x29cb1b[_0x0fff('0x7d')](),{'type':db[_0x0fff('0x7c')][_0x0fff('0x7e')][_0x0fff('0x7f')]})['then'](function(_0x3a99b1){if(_0x3a99b1[_0x0fff('0x3e')]===0x1){return _0x26de6c['id'];}else{var _0x4e1039=_[_0x0fff('0x80')](_['map'](_0x3a99b1,_0x0fff('0x81')),function(_0x14525b){return _['includes'](_0x579094,_0x14525b);});if(_0x4e1039){return _0x26de6c['id'];}}}));}}return BPromise['all'](_0x3d8df3)['then'](function(_0x22da86){_0x173b44=_(_0x173b44)['union'](_0x22da86)['compact']()['value']();return db['MailQueue'][_0x0fff('0x4b')]({'where':{'id':_0x1d67be['params']['id']}})[_0x0fff('0x26')](function(_0x502215){return db[_0x0fff('0x7c')]['transaction'](function(_0x465dde){return _0x502215[_0x0fff('0x73')](_0x1d67be['query']['ids'],{'transaction':_0x465dde})[_0x0fff('0x26')](function(){if(!_[_0x0fff('0x82')](_0x173b44)){return _0x502215[_0x0fff('0x83')](_0x173b44,{'transaction':_0x465dde});}})[_0x0fff('0x26')](function(){_0x173b44[_0x0fff('0x84')](function(_0x259628){socket[_0x0fff('0x71')]('userMailQueue:remove',{'UserId':_0x259628,'MailQueueId':_0x502215['id']});});});});});});})[_0x0fff('0x26')](respondWithStatusCode(_0x53fe4d,null))[_0x0fff('0x49')](handleError(_0x53fe4d,null));};exports[_0x0fff('0x85')]=function(_0x8ef733,_0x54d6c4,_0x4157ab){return db[_0x0fff('0x32')][_0x0fff('0x4b')]({'where':{'id':_0x8ef733['params']['id']}})['then'](handleEntityNotFound(_0x54d6c4,null))[_0x0fff('0x26')](function(_0x37b5b4){if(_0x37b5b4){return _0x37b5b4['addAgents'](_0x8ef733[_0x0fff('0x4d')][_0x0fff('0x68')],_['omit'](_0x8ef733[_0x0fff('0x4d')],[_0x0fff('0x68'),'id'])||{})[_0x0fff('0x86')](function(_0x49da45){for(var _0x4cdaaf=0x0;_0x4cdaaf<_0x8ef733[_0x0fff('0x4d')][_0x0fff('0x68')]['length'];_0x4cdaaf+=0x1){socket[_0x0fff('0x71')](_0x0fff('0x72'),{'UserId':_0x8ef733[_0x0fff('0x4d')][_0x0fff('0x68')][_0x4cdaaf],'MailQueueId':_0x8ef733[_0x0fff('0x55')]['id']});}return _0x49da45;});}})[_0x0fff('0x26')](respondWithResult(_0x54d6c4,null))[_0x0fff('0x49')](handleError(_0x54d6c4,null));};exports[_0x0fff('0x83')]=function(_0x327b5,_0x320c2d,_0x10aa61){return db[_0x0fff('0x32')]['find']({'where':{'id':_0x327b5[_0x0fff('0x55')]['id']}})['then'](handleEntityNotFound(_0x320c2d,null))[_0x0fff('0x26')](function(_0x4e54cf){if(_0x4e54cf){return _0x4e54cf[_0x0fff('0x83')](_0x327b5[_0x0fff('0x38')][_0x0fff('0x68')])[_0x0fff('0x26')](function(){if(_[_0x0fff('0x87')](_0x327b5[_0x0fff('0x38')]['ids'])){for(var _0x3ed560=0x0;_0x3ed560<_0x327b5[_0x0fff('0x38')]['ids'][_0x0fff('0x3e')];_0x3ed560+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x327b5[_0x0fff('0x38')][_0x0fff('0x68')][_0x3ed560]),'MailQueueId':Number(_0x327b5[_0x0fff('0x55')]['id'])});}}else{socket[_0x0fff('0x71')](_0x0fff('0x88'),{'UserId':Number(_0x327b5[_0x0fff('0x38')]['ids']),'MailQueueId':Number(_0x327b5[_0x0fff('0x55')]['id'])});}});}})[_0x0fff('0x26')](respondWithStatusCode(_0x320c2d,null))[_0x0fff('0x49')](handleError(_0x320c2d,null));};exports[_0x0fff('0x89')]=function(_0x362b36,_0x5cb750,_0x25e9f2){var _0xf73eb6={};var _0x87df03={};var _0x302505;var _0x18462e;return db[_0x0fff('0x32')][_0x0fff('0x58')]({'where':{'id':_0x362b36['params']['id']}})['then'](handleEntityNotFound(_0x5cb750,null))[_0x0fff('0x26')](function(_0x59f9ca){if(_0x59f9ca){_0x302505=_0x59f9ca;_0x87df03[_0x0fff('0x37')]=_['keys'](db['User']['rawAttributes']);_0x87df03[_0x0fff('0x38')]=_[_0x0fff('0x39')](_0x362b36[_0x0fff('0x38')]);_0x87df03[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x87df03['model'],_0x87df03[_0x0fff('0x38')]);_0xf73eb6[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x87df03[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x362b36[_0x0fff('0x38')][_0x0fff('0x3d')]));_0xf73eb6[_0x0fff('0x3c')]=_0xf73eb6['attributes']['length']?_0xf73eb6[_0x0fff('0x3c')]:_0x87df03[_0x0fff('0x37')];_0xf73eb6[_0x0fff('0x5a')]=qs['sort'](_0x362b36[_0x0fff('0x38')][_0x0fff('0x41')]);_0xf73eb6[_0x0fff('0x42')]=qs['filters'](_[_0x0fff('0x43')](_0x362b36[_0x0fff('0x38')],_0x87df03[_0x0fff('0x3a')]));if(_0x362b36[_0x0fff('0x38')][_0x0fff('0x44')]){_0xf73eb6[_0x0fff('0x42')]=_[_0x0fff('0x45')](_0xf73eb6['where'],{'$or':_['map'](_0xf73eb6['attributes'],function(_0x247b3a){var _0x425412={};_0x425412[_0x247b3a]={'$like':'%'+_0x362b36[_0x0fff('0x38')][_0x0fff('0x44')]+'%'};return _0x425412;})});}_0xf73eb6=_[_0x0fff('0x45')]({},_0xf73eb6,_0x362b36[_0x0fff('0x5b')]);return _0x302505['getAgents'](_0xf73eb6);}})[_0x0fff('0x26')](function(_0x2f98b6){if(_0x2f98b6){_0x18462e=_0x2f98b6[_0x0fff('0x3e')];if(!_0x362b36['query']['hasOwnProperty'](_0x0fff('0x40'))){_0xf73eb6['limit']=qs[_0x0fff('0x21')](_0x362b36[_0x0fff('0x38')]['limit']);_0xf73eb6[_0x0fff('0x20')]=qs[_0x0fff('0x20')](_0x362b36['query'][_0x0fff('0x20')]);}return _0x302505[_0x0fff('0x89')](_0xf73eb6);}})[_0x0fff('0x26')](function(_0x443fac){if(_0x443fac){return _0x443fac?{'count':_0x18462e,'rows':_0x443fac}:null;}})[_0x0fff('0x26')](respondWithResult(_0x5cb750,null))[_0x0fff('0x49')](handleError(_0x5cb750,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 9678be8..70b515b 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 _0xefd7=['update','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x3f6a96,_0x58d9a0){var _0x3bf420=function(_0x9bc98e){while(--_0x9bc98e){_0x3f6a96['push'](_0x3f6a96['shift']());}};_0x3bf420(++_0x58d9a0);}(_0xefd7,0xd6));var _0x7efd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xefd7[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x7efd('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7efd('0x1')](0x0);var events={'afterCreate':_0x7efd('0x2'),'afterUpdate':_0x7efd('0x3'),'afterDestroy':'remove'};function emitEvent(_0x657c93){return function(_0x5eda3b,_0x32aaff,_0x281534){MailQueueEvents['emit'](_0x657c93+':'+_0x5eda3b['id'],_0x5eda3b);MailQueueEvents['emit'](_0x657c93,_0x5eda3b);_0x281534(null);};}for(var e in events){if(events[_0x7efd('0x4')](e)){var event=events[e];MailQueue[_0x7efd('0x5')](e,emitEvent(event));}}module[_0x7efd('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x5a85=['update','emit','hasOwnProperty','exports','../../mysqldb','MailQueue','setMaxListeners','save'];(function(_0x54fb0d,_0x2ae314){var _0x593b0a=function(_0xc807a1){while(--_0xc807a1){_0x54fb0d['push'](_0x54fb0d['shift']());}};_0x593b0a(++_0x2ae314);}(_0x5a85,0xf4));var _0x55a8=function(_0x4f79aa,_0x7dc9b2){_0x4f79aa=_0x4f79aa-0x0;var _0x5ccb31=_0x5a85[_0x4f79aa];return _0x5ccb31;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x55a8('0x0'))['db'][_0x55a8('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x55a8('0x2')](0x0);var events={'afterCreate':_0x55a8('0x3'),'afterUpdate':_0x55a8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x142a99){return function(_0x4a52f0,_0x4c88c4,_0x58aae0){MailQueueEvents['emit'](_0x142a99+':'+_0x4a52f0['id'],_0x4a52f0);MailQueueEvents[_0x55a8('0x5')](_0x142a99,_0x4a52f0);_0x58aae0(null);};}for(var e in events){if(events[_0x55a8('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x55a8('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 28ae9b4..a485bbb 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 _0xd3cf=['bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0xd3cf,0x1bb));var _0xfd3c=function(_0x3bce43,_0xab1441){_0x3bce43=_0x3bce43-0x0;var _0x139427=_0xd3cf[_0x3bce43];return _0x139427;};'use strict';var _=require(_0xfd3c('0x0'));var util=require(_0xfd3c('0x1'));var logger=require(_0xfd3c('0x2'))(_0xfd3c('0x3'));var moment=require(_0xfd3c('0x4'));var BPromise=require(_0xfd3c('0x5'));var rp=require(_0xfd3c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd3c('0x7'));var config=require(_0xfd3c('0x8'));var attributes=require(_0xfd3c('0x9'));module[_0xfd3c('0xa')]=function(_0x21686f,_0x14df7f){return _0x21686f[_0xfd3c('0xb')](_0xfd3c('0xc'),attributes,{'tableName':_0xfd3c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f1a=['path','rimraf','../../config/environment','exports','define','util','../../config/logger','moment','bluebird'];(function(_0x4778ca,_0x418a93){var _0x496fee=function(_0xc009a0){while(--_0xc009a0){_0x4778ca['push'](_0x4778ca['shift']());}};_0x496fee(++_0x418a93);}(_0x3f1a,0x1f4));var _0xa3f1=function(_0x372914,_0x455e96){_0x372914=_0x372914-0x0;var _0x5c2efc=_0x3f1a[_0x372914];return _0x5c2efc;};'use strict';var _=require('lodash');var util=require(_0xa3f1('0x0'));var logger=require(_0xa3f1('0x1'))('api');var moment=require(_0xa3f1('0x2'));var BPromise=require(_0xa3f1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3f1('0x4'));var rimraf=require(_0xa3f1('0x5'));var config=require(_0xa3f1('0x6'));var attributes=require('./mailQueue.attributes');module[_0xa3f1('0x7')]=function(_0x3e2f36,_0x26f10c){return _0x3e2f36[_0xa3f1('0x8')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index ec916f8..968bee9 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 _0xda84=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','info','ShowMailQueue','find','raw','lodash','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xda84,0x1ea));var _0x4da8=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xda84[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x4da8('0x0'));var util=require(_0x4da8('0x1'));var moment=require(_0x4da8('0x2'));var BPromise=require(_0x4da8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4da8('0x4'))['db'];var utils=require(_0x4da8('0x5'));var logger=require(_0x4da8('0x6'))('rpc');var config=require(_0x4da8('0x7'));var jayson=require(_0x4da8('0x8'));var client=jayson[_0x4da8('0x9')][_0x4da8('0xa')]({'port':0x232a});config[_0x4da8('0xb')]=_[_0x4da8('0xc')](config[_0x4da8('0xb')],{'host':_0x4da8('0xd'),'port':0x18eb});var socket=require(_0x4da8('0xe'))(new Redis(config[_0x4da8('0xb')]));require(_0x4da8('0xf'))[_0x4da8('0x10')](socket);function respondWithRpcPromise(_0x276b67,_0x19896b,_0x1ef2bd){return new BPromise(function(_0x5bf521,_0x3ae589){return client['request'](_0x276b67,_0x1ef2bd)[_0x4da8('0x11')](function(_0x14b0c4){logger['info'](_0x4da8('0x12'),_0x19896b,_0x4da8('0x13'));logger[_0x4da8('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x19896b,'request\x20sent',JSON[_0x4da8('0x15')](_0x14b0c4));if(_0x14b0c4[_0x4da8('0x16')]){if(_0x14b0c4['error'][_0x4da8('0x17')]===0x1f4){logger[_0x4da8('0x16')](_0x4da8('0x12'),_0x19896b,_0x14b0c4[_0x4da8('0x16')][_0x4da8('0x18')]);return _0x3ae589(_0x14b0c4['error']['message']);}logger[_0x4da8('0x16')]('MailQueue,\x20%s,\x20%s',_0x19896b,_0x14b0c4[_0x4da8('0x16')][_0x4da8('0x18')]);return _0x5bf521(_0x14b0c4['error'][_0x4da8('0x18')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x19896b,_0x4da8('0x13'));_0x5bf521(_0x14b0c4[_0x4da8('0x19')][_0x4da8('0x18')]);}})[_0x4da8('0x1a')](function(_0x3a4fba){logger[_0x4da8('0x16')](_0x4da8('0x12'),_0x19896b,_0x3a4fba);_0x3ae589(_0x3a4fba);});});}exports[_0x4da8('0x1b')]=function(_0x35d5d4){var _0x4b14b8=this;return new Promise(function(_0xb7af59,_0x38c689){return db[_0x4da8('0x1c')][_0x4da8('0x1d')]({'raw':_0x35d5d4[_0x4da8('0x1e')]?_0x35d5d4[_0x4da8('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x35d5d4[_0x4da8('0x1e')]?_0x35d5d4[_0x4da8('0x1e')][_0x4da8('0x1f')]||null:null,'attributes':_0x35d5d4[_0x4da8('0x1e')]?_0x35d5d4[_0x4da8('0x1e')][_0x4da8('0x20')]||null:null,'limit':_0x35d5d4[_0x4da8('0x1e')]?_0x35d5d4[_0x4da8('0x1e')][_0x4da8('0x21')]||null:null,'include':_0x35d5d4[_0x4da8('0x1e')]?_0x35d5d4[_0x4da8('0x1e')][_0x4da8('0x22')]?_[_0x4da8('0x23')](_0x35d5d4[_0x4da8('0x1e')]['include'],function(_0x85e523){return{'model':db[_0x85e523[_0x4da8('0x24')]],'as':_0x85e523['as'],'attributes':_0x85e523[_0x4da8('0x20')],'include':_0x85e523['include']?_[_0x4da8('0x23')](_0x85e523[_0x4da8('0x22')],function(_0x2baccb){return{'model':db[_0x2baccb[_0x4da8('0x24')]],'as':_0x2baccb['as'],'attributes':_0x2baccb[_0x4da8('0x20')],'include':_0x2baccb[_0x4da8('0x22')]?_[_0x4da8('0x23')](_0x2baccb['include'],function(_0xa36f53){return{'model':db[_0xa36f53[_0x4da8('0x24')]],'as':_0xa36f53['as'],'attributes':_0xa36f53[_0x4da8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4da8('0x11')](function(_0x44150d){logger[_0x4da8('0x25')](_0x4da8('0x1b'),_0x35d5d4);logger['debug'](_0x4da8('0x1b'),_0x35d5d4,JSON[_0x4da8('0x15')](_0x44150d));_0xb7af59(_0x44150d);})[_0x4da8('0x1a')](function(_0x2c2454){logger[_0x4da8('0x16')]('GetMailQueue',_0x2c2454['message'],_0x35d5d4);_0x38c689(_0x4b14b8[_0x4da8('0x16')](0x1f4,_0x2c2454['message']));});});};exports[_0x4da8('0x26')]=function(_0x3a5aaa){var _0x1f21c6=this;return new Promise(function(_0x5967fd,_0x460e73){return db[_0x4da8('0x1c')][_0x4da8('0x27')]({'raw':_0x3a5aaa[_0x4da8('0x1e')]?_0x3a5aaa[_0x4da8('0x1e')][_0x4da8('0x28')]===undefined?!![]:![]:!![],'where':_0x3a5aaa[_0x4da8('0x1e')]?_0x3a5aaa[_0x4da8('0x1e')]['where']||null:null,'attributes':_0x3a5aaa[_0x4da8('0x1e')]?_0x3a5aaa[_0x4da8('0x1e')][_0x4da8('0x20')]||null:null,'include':_0x3a5aaa[_0x4da8('0x1e')]?_0x3a5aaa[_0x4da8('0x1e')][_0x4da8('0x22')]?_[_0x4da8('0x23')](_0x3a5aaa[_0x4da8('0x1e')][_0x4da8('0x22')],function(_0x4c879b){return{'model':db[_0x4c879b[_0x4da8('0x24')]],'as':_0x4c879b['as'],'attributes':_0x4c879b['attributes'],'include':_0x4c879b[_0x4da8('0x22')]?_[_0x4da8('0x23')](_0x4c879b[_0x4da8('0x22')],function(_0x4291ad){return{'model':db[_0x4291ad[_0x4da8('0x24')]],'as':_0x4291ad['as'],'attributes':_0x4291ad['attributes'],'include':_0x4291ad['include']?_[_0x4da8('0x23')](_0x4291ad[_0x4da8('0x22')],function(_0x26db85){return{'model':db[_0x26db85[_0x4da8('0x24')]],'as':_0x26db85['as'],'attributes':_0x26db85[_0x4da8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4da8('0x11')](function(_0x16a357){logger[_0x4da8('0x25')](_0x4da8('0x26'),_0x3a5aaa);logger['debug']('ShowMailQueue',_0x3a5aaa,JSON[_0x4da8('0x15')](_0x16a357));_0x5967fd(_0x16a357);})['catch'](function(_0x7a1a88){logger[_0x4da8('0x16')](_0x4da8('0x26'),_0x7a1a88[_0x4da8('0x18')],_0x3a5aaa);_0x460e73(_0x1f21c6[_0x4da8('0x16')](0x1f4,_0x7a1a88[_0x4da8('0x18')]));});});}; \ No newline at end of file +var _0xd416=['error','message','catch','options','raw','where','limit','include','model','attributes','map','then','GetMailQueue','debug','ShowMailQueue','MailQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0xd416,0x170));var _0x6d41=function(_0x46088a,_0x12599c){_0x46088a=_0x46088a-0x0;var _0x15fa8f=_0xd416[_0x46088a];return _0x15fa8f;};'use strict';var _=require(_0x6d41('0x0'));var util=require(_0x6d41('0x1'));var moment=require('moment');var BPromise=require(_0x6d41('0x2'));var rs=require(_0x6d41('0x3'));var fs=require('fs');var Redis=require(_0x6d41('0x4'));var db=require(_0x6d41('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d41('0x6'))('rpc');var config=require(_0x6d41('0x7'));var jayson=require(_0x6d41('0x8'));var client=jayson['client'][_0x6d41('0x9')]({'port':0x232a});config[_0x6d41('0xa')]=_[_0x6d41('0xb')](config['redis'],{'host':_0x6d41('0xc'),'port':0x18eb});var socket=require(_0x6d41('0xd'))(new Redis(config[_0x6d41('0xa')]));require(_0x6d41('0xe'))[_0x6d41('0xf')](socket);function respondWithRpcPromise(_0x18ef35,_0x4a5fa2,_0xa4522a){return new BPromise(function(_0x46482d,_0x453d00){return client[_0x6d41('0x10')](_0x18ef35,_0xa4522a)['then'](function(_0x397dc4){logger[_0x6d41('0x11')](_0x6d41('0x12'),_0x4a5fa2,'request\x20sent');logger['debug'](_0x6d41('0x13'),_0x4a5fa2,_0x6d41('0x14'),JSON[_0x6d41('0x15')](_0x397dc4));if(_0x397dc4[_0x6d41('0x16')]){if(_0x397dc4['error']['code']===0x1f4){logger[_0x6d41('0x16')](_0x6d41('0x12'),_0x4a5fa2,_0x397dc4[_0x6d41('0x16')][_0x6d41('0x17')]);return _0x453d00(_0x397dc4['error'][_0x6d41('0x17')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x4a5fa2,_0x397dc4['error'][_0x6d41('0x17')]);return _0x46482d(_0x397dc4[_0x6d41('0x16')][_0x6d41('0x17')]);}else{logger[_0x6d41('0x11')](_0x6d41('0x12'),_0x4a5fa2,_0x6d41('0x14'));_0x46482d(_0x397dc4['result'][_0x6d41('0x17')]);}})[_0x6d41('0x18')](function(_0xa4fde7){logger[_0x6d41('0x16')](_0x6d41('0x12'),_0x4a5fa2,_0xa4fde7);_0x453d00(_0xa4fde7);});});}exports['GetMailQueue']=function(_0xe2b607){var _0x52319f=this;return new Promise(function(_0x5f58d6,_0x2811af){return db['MailQueue']['findAll']({'raw':_0xe2b607['options']?_0xe2b607[_0x6d41('0x19')][_0x6d41('0x1a')]===undefined?!![]:![]:!![],'where':_0xe2b607[_0x6d41('0x19')]?_0xe2b607[_0x6d41('0x19')][_0x6d41('0x1b')]||null:null,'attributes':_0xe2b607[_0x6d41('0x19')]?_0xe2b607[_0x6d41('0x19')]['attributes']||null:null,'limit':_0xe2b607[_0x6d41('0x19')]?_0xe2b607[_0x6d41('0x19')][_0x6d41('0x1c')]||null:null,'include':_0xe2b607[_0x6d41('0x19')]?_0xe2b607[_0x6d41('0x19')][_0x6d41('0x1d')]?_['map'](_0xe2b607['options'][_0x6d41('0x1d')],function(_0x5415cf){return{'model':db[_0x5415cf[_0x6d41('0x1e')]],'as':_0x5415cf['as'],'attributes':_0x5415cf[_0x6d41('0x1f')],'include':_0x5415cf[_0x6d41('0x1d')]?_[_0x6d41('0x20')](_0x5415cf[_0x6d41('0x1d')],function(_0xfd72e6){return{'model':db[_0xfd72e6['model']],'as':_0xfd72e6['as'],'attributes':_0xfd72e6[_0x6d41('0x1f')],'include':_0xfd72e6['include']?_[_0x6d41('0x20')](_0xfd72e6[_0x6d41('0x1d')],function(_0x3d6e8e){return{'model':db[_0x3d6e8e[_0x6d41('0x1e')]],'as':_0x3d6e8e['as'],'attributes':_0x3d6e8e[_0x6d41('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6d41('0x21')](function(_0x44a498){logger[_0x6d41('0x11')](_0x6d41('0x22'),_0xe2b607);logger[_0x6d41('0x23')](_0x6d41('0x22'),_0xe2b607,JSON[_0x6d41('0x15')](_0x44a498));_0x5f58d6(_0x44a498);})['catch'](function(_0x168f79){logger[_0x6d41('0x16')](_0x6d41('0x22'),_0x168f79[_0x6d41('0x17')],_0xe2b607);_0x2811af(_0x52319f[_0x6d41('0x16')](0x1f4,_0x168f79[_0x6d41('0x17')]));});});};exports[_0x6d41('0x24')]=function(_0x37c9a9){var _0xd0392a=this;return new Promise(function(_0x3052b3,_0x3cc152){return db[_0x6d41('0x25')][_0x6d41('0x26')]({'raw':_0x37c9a9[_0x6d41('0x19')]?_0x37c9a9[_0x6d41('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x37c9a9['options']?_0x37c9a9[_0x6d41('0x19')][_0x6d41('0x1b')]||null:null,'attributes':_0x37c9a9[_0x6d41('0x19')]?_0x37c9a9['options'][_0x6d41('0x1f')]||null:null,'include':_0x37c9a9[_0x6d41('0x19')]?_0x37c9a9[_0x6d41('0x19')][_0x6d41('0x1d')]?_[_0x6d41('0x20')](_0x37c9a9[_0x6d41('0x19')][_0x6d41('0x1d')],function(_0x19e077){return{'model':db[_0x19e077[_0x6d41('0x1e')]],'as':_0x19e077['as'],'attributes':_0x19e077['attributes'],'include':_0x19e077[_0x6d41('0x1d')]?_['map'](_0x19e077[_0x6d41('0x1d')],function(_0x4fb2c3){return{'model':db[_0x4fb2c3[_0x6d41('0x1e')]],'as':_0x4fb2c3['as'],'attributes':_0x4fb2c3['attributes'],'include':_0x4fb2c3[_0x6d41('0x1d')]?_['map'](_0x4fb2c3[_0x6d41('0x1d')],function(_0x4978d9){return{'model':db[_0x4978d9[_0x6d41('0x1e')]],'as':_0x4978d9['as'],'attributes':_0x4978d9['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d41('0x21')](function(_0x283825){logger[_0x6d41('0x11')](_0x6d41('0x24'),_0x37c9a9);logger[_0x6d41('0x23')]('ShowMailQueue',_0x37c9a9,JSON[_0x6d41('0x15')](_0x283825));_0x3052b3(_0x283825);})[_0x6d41('0x18')](function(_0x4a8d37){logger[_0x6d41('0x16')](_0x6d41('0x24'),_0x4a8d37[_0x6d41('0x17')],_0x37c9a9);_0x3cc152(_0xd0392a[_0x6d41('0x16')](0x1f4,_0x4a8d37[_0x6d41('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 8947ca9..2dfc5a3 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 _0xd1cc=['emit','removeListener','register','mailQueue:','./mailQueue.events','save'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xd1cc,0x10c));var _0xcd1c=function(_0x1c5502,_0x55269e){_0x1c5502=_0x1c5502-0x0;var _0x268ed4=_0xd1cc[_0x1c5502];return _0x268ed4;};'use strict';var MailQueueEvents=require(_0xcd1c('0x0'));var events=[_0xcd1c('0x1'),'remove','update'];function createListener(_0x51c5d0,_0x265fe2){return function(_0x1c41ed){_0x265fe2[_0xcd1c('0x2')](_0x51c5d0,_0x1c41ed);};}function removeListener(_0x593127,_0x2f79f6){return function(){MailQueueEvents[_0xcd1c('0x3')](_0x593127,_0x2f79f6);};}exports[_0xcd1c('0x4')]=function(_0x1f0451){for(var _0x13ae76=0x0,_0x2b54a8=events['length'];_0x13ae76<_0x2b54a8;_0x13ae76++){var _0x5b7ba5=events[_0x13ae76];var _0xd393a8=createListener(_0xcd1c('0x5')+_0x5b7ba5,_0x1f0451);MailQueueEvents['on'](_0x5b7ba5,_0xd393a8);}}; \ No newline at end of file +var _0x105d=['./mailQueue.events','save','update','emit','removeListener','register','mailQueue:'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0x105d,0x196));var _0xd105=function(_0x27dc8d,_0x1f0639){_0x27dc8d=_0x27dc8d-0x0;var _0x3f7fd4=_0x105d[_0x27dc8d];return _0x3f7fd4;};'use strict';var MailQueueEvents=require(_0xd105('0x0'));var events=[_0xd105('0x1'),'remove',_0xd105('0x2')];function createListener(_0x1a4aff,_0x94463f){return function(_0x2a5c60){_0x94463f[_0xd105('0x3')](_0x1a4aff,_0x2a5c60);};}function removeListener(_0x4a4589,_0x407b39){return function(){MailQueueEvents[_0xd105('0x4')](_0x4a4589,_0x407b39);};}exports[_0xd105('0x5')]=function(_0x2e1ac4){for(var _0x20e730=0x0,_0x395584=events['length'];_0x20e730<_0x395584;_0x20e730++){var _0x108f27=events[_0x20e730];var _0x371125=createListener(_0xd105('0x6')+_0x108f27,_0x2e1ac4);MailQueueEvents['on'](_0x108f27,_0x371125);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index aef4ffd..6058c2b 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 _0xf271=['Router','../../components/auth/service','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf271,0x1b0));var _0x1f27=function(_0x4228a9,_0x40d3a3){_0x4228a9=_0x4228a9-0x0;var _0xdbce4a=_0xf271[_0x4228a9];return _0xdbce4a;};'use strict';var multer=require(_0x1f27('0x0'));var util=require(_0x1f27('0x1'));var path=require(_0x1f27('0x2'));var timeout=require(_0x1f27('0x3'));var express=require(_0x1f27('0x4'));var router=express[_0x1f27('0x5')]();var auth=require(_0x1f27('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1f27('0x7'));router[_0x1f27('0x8')]('/',auth[_0x1f27('0x9')](),controller['index']);router[_0x1f27('0x8')](_0x1f27('0xa'),auth[_0x1f27('0x9')](),controller[_0x1f27('0xb')]);router[_0x1f27('0x8')](_0x1f27('0xc'),auth[_0x1f27('0x9')](),controller[_0x1f27('0xd')]);router[_0x1f27('0xe')]('/',auth[_0x1f27('0x9')](),controller[_0x1f27('0xf')]);router[_0x1f27('0x10')](_0x1f27('0xc'),auth['isAuthenticated'](),controller[_0x1f27('0x11')]);router['delete'](_0x1f27('0xc'),auth[_0x1f27('0x9')](),controller[_0x1f27('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa978=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','put','update'];(function(_0x105d2e,_0xefc0f9){var _0x44969d=function(_0x2fca67){while(--_0x2fca67){_0x105d2e['push'](_0x105d2e['shift']());}};_0x44969d(++_0xefc0f9);}(_0xa978,0xcb));var _0x8a97=function(_0x2e1ae0,_0x4d8d5a){_0x2e1ae0=_0x2e1ae0-0x0;var _0x23afc2=_0xa978[_0x2e1ae0];return _0x23afc2;};'use strict';var multer=require(_0x8a97('0x0'));var util=require(_0x8a97('0x1'));var path=require(_0x8a97('0x2'));var timeout=require('connect-timeout');var express=require(_0x8a97('0x3'));var router=express[_0x8a97('0x4')]();var auth=require(_0x8a97('0x5'));var interaction=require(_0x8a97('0x6'));var config=require(_0x8a97('0x7'));var controller=require(_0x8a97('0x8'));router[_0x8a97('0x9')]('/',auth[_0x8a97('0xa')](),controller[_0x8a97('0xb')]);router[_0x8a97('0x9')]('/describe',auth[_0x8a97('0xa')](),controller[_0x8a97('0xc')]);router['get'](_0x8a97('0xd'),auth['isAuthenticated'](),controller[_0x8a97('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8a97('0xf')](_0x8a97('0xd'),auth[_0x8a97('0xa')](),controller[_0x8a97('0x10')]);router[_0x8a97('0x11')]('/:id',auth[_0x8a97('0xa')](),controller[_0x8a97('0x12')]);module[_0x8a97('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index b781f50..5d72aa4 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 _0x86e9=['exports','STRING','DATE','moment'];(function(_0x529cd3,_0x38ddb9){var _0xc64417=function(_0x20b986){while(--_0x20b986){_0x529cd3['push'](_0x529cd3['shift']());}};_0xc64417(++_0x38ddb9);}(_0x86e9,0x1d3));var _0x986e=function(_0x19fc2f,_0x2509a1){_0x19fc2f=_0x19fc2f-0x0;var _0x24a68f=_0x86e9[_0x19fc2f];return _0x24a68f;};'use strict';var moment=require(_0x986e('0x0'));var Sequelize=require('sequelize');module[_0x986e('0x1')]={'uniqueid':{'type':Sequelize[_0x986e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x986e('0x2')]},'joinAt':{'type':Sequelize[_0x986e('0x3')]},'leaveAt':{'type':Sequelize[_0x986e('0x3')]},'acceptAt':{'type':Sequelize[_0x986e('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4024=['DATE','sequelize','exports','STRING'];(function(_0x40184a,_0x3d9f99){var _0x593d1c=function(_0x50ebd6){while(--_0x50ebd6){_0x40184a['push'](_0x40184a['shift']());}};_0x593d1c(++_0x3d9f99);}(_0x4024,0xcd));var _0x4402=function(_0xa232d,_0xa327fb){_0xa232d=_0xa232d-0x0;var _0x1c4e84=_0x4024[_0xa232d];return _0x1c4e84;};'use strict';var moment=require('moment');var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'uniqueid':{'type':Sequelize[_0x4402('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4402('0x3')]},'leaveAt':{'type':Sequelize[_0x4402('0x3')]},'acceptAt':{'type':Sequelize[_0x4402('0x3')]},'exitAt':{'type':Sequelize[_0x4402('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index e7c4e2f..f1918a9 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 _0x0416=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','MailQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x0416,0x85));var _0x6041=function(_0x19b6c7,_0x428884){_0x19b6c7=_0x19b6c7-0x0;var _0x30cfa9=_0x0416[_0x19b6c7];return _0x30cfa9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6041('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6041('0x1'));var jsonpatch=require(_0x6041('0x2'));var rp=require('request-promise');var moment=require(_0x6041('0x3'));var BPromise=require(_0x6041('0x4'));var Mustache=require(_0x6041('0x5'));var util=require(_0x6041('0x6'));var path=require('path');var sox=require(_0x6041('0x7'));var csv=require(_0x6041('0x8'));var ejs=require(_0x6041('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6041('0xa'));var crypto=require(_0x6041('0xb'));var jsforce=require(_0x6041('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6041('0x8'));var querystring=require('querystring');var Papa=require(_0x6041('0xd'));var Redis=require(_0x6041('0xe'));var authService=require(_0x6041('0xf'));var qs=require(_0x6041('0x10'));var as=require(_0x6041('0x11'));var hardwareService=require(_0x6041('0x12'));var logger=require('../../config/logger')(_0x6041('0x13'));var utils=require(_0x6041('0x14'));var config=require(_0x6041('0x15'));var licenseUtil=require(_0x6041('0x16'));var db=require(_0x6041('0x17'))['db'];function respondWithStatusCode(_0x30c949,_0x2aee09){_0x2aee09=_0x2aee09||0xcc;return function(_0xea2724){if(_0xea2724){return _0x30c949['sendStatus'](_0x2aee09);}return _0x30c949[_0x6041('0x18')](_0x2aee09)[_0x6041('0x19')]();};}function respondWithResult(_0x4c95a7,_0x2df7da){_0x2df7da=_0x2df7da||0xc8;return function(_0x28630d){if(_0x28630d){return _0x4c95a7[_0x6041('0x18')](_0x2df7da)[_0x6041('0x1a')](_0x28630d);}};}function respondWithFilteredResult(_0x3042ce,_0x3bebf6){return function(_0x3dc959){if(_0x3dc959){var _0x149fd1=_0x3dc959[_0x6041('0x1b')],_0xc35f35=_0x3bebf6['offset'],_0x18d1aa=_0x3bebf6[_0x6041('0x1c')]+_0x3bebf6[_0x6041('0x1d')],_0x20da83;if(_0x18d1aa>=_0x149fd1){_0x18d1aa=_0x149fd1;_0x20da83=0xc8;}else{_0x20da83=0xce;}_0x3042ce['status'](_0x20da83);return _0x3042ce['set']('Content-Range',_0xc35f35+'-'+_0x18d1aa+'/'+_0x149fd1)[_0x6041('0x1a')](_0x3dc959);}return null;};}function patchUpdates(_0x396cce){return function(_0xf615ee){try{jsonpatch[_0x6041('0x1e')](_0xf615ee,_0x396cce,!![]);}catch(_0x20f5ab){return BPromise[_0x6041('0x1f')](_0x20f5ab);}return _0xf615ee[_0x6041('0x20')]();};}function saveUpdates(_0x2f379d,_0x314598){return function(_0xf757cc){if(_0xf757cc){return _0xf757cc['update'](_0x2f379d)[_0x6041('0x21')](function(_0x7a0964){return _0x7a0964;});}return null;};}function removeEntity(_0x29dd5b,_0x2f996f){return function(_0x2c990a){if(_0x2c990a){return _0x2c990a[_0x6041('0x22')]()['then'](function(){_0x29dd5b[_0x6041('0x18')](0xcc)[_0x6041('0x19')]();});}};}function handleEntityNotFound(_0x1ae02a,_0x136100){return function(_0x215666){if(!_0x215666){_0x1ae02a[_0x6041('0x23')](0x194);}return _0x215666;};}function handleError(_0x526f20,_0x188788){_0x188788=_0x188788||0x1f4;return function(_0x30324d){logger[_0x6041('0x24')](_0x30324d[_0x6041('0x25')]);if(_0x30324d[_0x6041('0x26')]){delete _0x30324d[_0x6041('0x26')];}_0x526f20['status'](_0x188788)[_0x6041('0x27')](_0x30324d);};}exports[_0x6041('0x28')]=function(_0x3a783a,_0x29ae94){var _0xa67402={},_0x4e8aa9={},_0xc0bd0e={'count':0x0,'rows':[]};var _0x5874dd=_[_0x6041('0x29')](db['MailQueueReport'][_0x6041('0x2a')],function(_0x30f65a){return{'name':_0x30f65a['fieldName'],'type':_0x30f65a[_0x6041('0x2b')][_0x6041('0x2c')]};});_0x4e8aa9[_0x6041('0x2d')]=_[_0x6041('0x29')](_0x5874dd,'name');_0x4e8aa9[_0x6041('0x2e')]=_['keys'](_0x3a783a[_0x6041('0x2e')]);_0x4e8aa9['filters']=_['intersection'](_0x4e8aa9[_0x6041('0x2d')],_0x4e8aa9[_0x6041('0x2e')]);_0xa67402['attributes']=_[_0x6041('0x2f')](_0x4e8aa9[_0x6041('0x2d')],qs[_0x6041('0x30')](_0x3a783a[_0x6041('0x2e')][_0x6041('0x30')]));_0xa67402[_0x6041('0x31')]=_0xa67402[_0x6041('0x31')][_0x6041('0x32')]?_0xa67402[_0x6041('0x31')]:_0x4e8aa9[_0x6041('0x2d')];if(!_0x3a783a[_0x6041('0x2e')][_0x6041('0x33')](_0x6041('0x34'))){_0xa67402[_0x6041('0x1d')]=qs[_0x6041('0x1d')](_0x3a783a[_0x6041('0x2e')]['limit']);_0xa67402[_0x6041('0x1c')]=qs[_0x6041('0x1c')](_0x3a783a[_0x6041('0x2e')][_0x6041('0x1c')]);}_0xa67402[_0x6041('0x35')]=qs['sort'](_0x3a783a[_0x6041('0x2e')][_0x6041('0x36')]);_0xa67402[_0x6041('0x37')]=qs[_0x6041('0x38')](_[_0x6041('0x39')](_0x3a783a[_0x6041('0x2e')],_0x4e8aa9['filters']),_0x5874dd);if(_0x3a783a[_0x6041('0x2e')]['filter']){_0xa67402[_0x6041('0x37')]=_[_0x6041('0x3a')](_0xa67402[_0x6041('0x37')],{'$or':_[_0x6041('0x29')](_0x5874dd,function(_0x480b3b){if(_0x480b3b[_0x6041('0x2b')]!==_0x6041('0x3b')){var _0x51599a={};_0x51599a[_0x480b3b[_0x6041('0x26')]]={'$like':'%'+_0x3a783a[_0x6041('0x2e')][_0x6041('0x3c')]+'%'};return _0x51599a;}})});}_0xa67402=_['merge']({},_0xa67402,_0x3a783a[_0x6041('0x3d')]);var _0x4279c3={'where':_0xa67402[_0x6041('0x37')]};return db[_0x6041('0x3e')][_0x6041('0x1b')](_0x4279c3)[_0x6041('0x21')](function(_0x29fbe9){_0xc0bd0e['count']=_0x29fbe9;if(_0x3a783a[_0x6041('0x2e')][_0x6041('0x3f')]){_0xa67402[_0x6041('0x40')]=[{'all':!![]}];}return db[_0x6041('0x3e')][_0x6041('0x41')](_0xa67402);})[_0x6041('0x21')](function(_0x594622){_0xc0bd0e[_0x6041('0x42')]=_0x594622;return _0xc0bd0e;})[_0x6041('0x21')](respondWithFilteredResult(_0x29ae94,_0xa67402))[_0x6041('0x43')](handleError(_0x29ae94,null));};exports[_0x6041('0x44')]=function(_0x182184,_0x49e7ba){var _0x802610={'raw':!![],'where':{'id':_0x182184[_0x6041('0x45')]['id']}},_0x4611b7={};_0x4611b7[_0x6041('0x2d')]=_[_0x6041('0x46')](db[_0x6041('0x3e')][_0x6041('0x2a')]);_0x4611b7[_0x6041('0x2e')]=_[_0x6041('0x46')](_0x182184[_0x6041('0x2e')]);_0x4611b7[_0x6041('0x38')]=_[_0x6041('0x2f')](_0x4611b7[_0x6041('0x2d')],_0x4611b7[_0x6041('0x2e')]);_0x802610[_0x6041('0x31')]=_[_0x6041('0x2f')](_0x4611b7['model'],qs[_0x6041('0x30')](_0x182184[_0x6041('0x2e')][_0x6041('0x30')]));_0x802610[_0x6041('0x31')]=_0x802610[_0x6041('0x31')][_0x6041('0x32')]?_0x802610[_0x6041('0x31')]:_0x4611b7[_0x6041('0x2d')];if(_0x182184['query'][_0x6041('0x3f')]){_0x802610['include']=[{'all':!![]}];}_0x802610=_[_0x6041('0x3a')]({},_0x802610,_0x182184[_0x6041('0x3d')]);return db[_0x6041('0x3e')][_0x6041('0x47')](_0x802610)[_0x6041('0x21')](handleEntityNotFound(_0x49e7ba,null))['then'](respondWithResult(_0x49e7ba,null))['catch'](handleError(_0x49e7ba,null));};exports[_0x6041('0x48')]=function(_0xa65d59,_0x1e5d55){return db[_0x6041('0x3e')][_0x6041('0x48')](_0xa65d59[_0x6041('0x49')],{})[_0x6041('0x21')](respondWithResult(_0x1e5d55,0xc9))[_0x6041('0x43')](handleError(_0x1e5d55,null));};exports['update']=function(_0xfd7738,_0x203fd8){if(_0xfd7738[_0x6041('0x49')]['id']){delete _0xfd7738[_0x6041('0x49')]['id'];}return db[_0x6041('0x3e')]['find']({'where':{'id':_0xfd7738['params']['id']}})[_0x6041('0x21')](handleEntityNotFound(_0x203fd8,null))[_0x6041('0x21')](saveUpdates(_0xfd7738[_0x6041('0x49')],null))['then'](respondWithResult(_0x203fd8,null))['catch'](handleError(_0x203fd8,null));};exports['destroy']=function(_0x48de08,_0x733e0c){return db[_0x6041('0x3e')]['find']({'where':{'id':_0x48de08[_0x6041('0x45')]['id']}})[_0x6041('0x21')](handleEntityNotFound(_0x733e0c,null))[_0x6041('0x21')](removeEntity(_0x733e0c,null))[_0x6041('0x43')](handleError(_0x733e0c,null));};exports[_0x6041('0x4a')]=function(_0x35a1a4,_0x5d3227){return db[_0x6041('0x3e')][_0x6041('0x4a')]()[_0x6041('0x21')](respondWithResult(_0x5d3227,null))['catch'](handleError(_0x5d3227,null));}; \ No newline at end of file +var _0xb684=['attributes','fields','length','nolimit','limit','sort','where','filter','VIRTUAL','include','findAll','rows','catch','params','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','crypto','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','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x2b50e1,_0x27e314){var _0x2ac0fa=function(_0x7536c){while(--_0x7536c){_0x2b50e1['push'](_0x2b50e1['shift']());}};_0x2ac0fa(++_0x27e314);}(_0xb684,0x176));var _0x4b68=function(_0x275d30,_0x5c2851){_0x275d30=_0x275d30-0x0;var _0xc43be0=_0xb684[_0x275d30];return _0xc43be0;};'use strict';var pdf=require(_0x4b68('0x0'));var emlformat=require(_0x4b68('0x1'));var rimraf=require(_0x4b68('0x2'));var zipdir=require(_0x4b68('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b68('0x4'));var moment=require('moment');var BPromise=require(_0x4b68('0x5'));var Mustache=require(_0x4b68('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4b68('0x7'));var csv=require(_0x4b68('0x8'));var ejs=require(_0x4b68('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4b68('0xa'));var crypto=require(_0x4b68('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4b68('0x8'));var querystring=require(_0x4b68('0xc'));var Papa=require(_0x4b68('0xd'));var Redis=require(_0x4b68('0xe'));var authService=require(_0x4b68('0xf'));var qs=require(_0x4b68('0x10'));var as=require(_0x4b68('0x11'));var hardwareService=require(_0x4b68('0x12'));var logger=require(_0x4b68('0x13'))('api');var utils=require(_0x4b68('0x14'));var config=require(_0x4b68('0x15'));var licenseUtil=require(_0x4b68('0x16'));var db=require(_0x4b68('0x17'))['db'];function respondWithStatusCode(_0x532143,_0x409b45){_0x409b45=_0x409b45||0xcc;return function(_0x4998f9){if(_0x4998f9){return _0x532143['sendStatus'](_0x409b45);}return _0x532143[_0x4b68('0x18')](_0x409b45)[_0x4b68('0x19')]();};}function respondWithResult(_0x4d1330,_0x24c55c){_0x24c55c=_0x24c55c||0xc8;return function(_0x274d12){if(_0x274d12){return _0x4d1330[_0x4b68('0x18')](_0x24c55c)[_0x4b68('0x1a')](_0x274d12);}};}function respondWithFilteredResult(_0x5f52c6,_0x3fc6c3){return function(_0x21073){if(_0x21073){var _0x3e8d47=_0x21073[_0x4b68('0x1b')],_0x5ab4f8=_0x3fc6c3['offset'],_0x2a60a2=_0x3fc6c3[_0x4b68('0x1c')]+_0x3fc6c3['limit'],_0x512788;if(_0x2a60a2>=_0x3e8d47){_0x2a60a2=_0x3e8d47;_0x512788=0xc8;}else{_0x512788=0xce;}_0x5f52c6[_0x4b68('0x18')](_0x512788);return _0x5f52c6['set'](_0x4b68('0x1d'),_0x5ab4f8+'-'+_0x2a60a2+'/'+_0x3e8d47)[_0x4b68('0x1a')](_0x21073);}return null;};}function patchUpdates(_0x50865f){return function(_0x4d6588){try{jsonpatch[_0x4b68('0x1e')](_0x4d6588,_0x50865f,!![]);}catch(_0x30039f){return BPromise[_0x4b68('0x1f')](_0x30039f);}return _0x4d6588[_0x4b68('0x20')]();};}function saveUpdates(_0x401547,_0xf7f192){return function(_0x54c14f){if(_0x54c14f){return _0x54c14f[_0x4b68('0x21')](_0x401547)[_0x4b68('0x22')](function(_0x3c1290){return _0x3c1290;});}return null;};}function removeEntity(_0x1627ec,_0x82cbe5){return function(_0x5c1d96){if(_0x5c1d96){return _0x5c1d96[_0x4b68('0x23')]()[_0x4b68('0x22')](function(){_0x1627ec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x124912,_0x2016d7){return function(_0x96fbab){if(!_0x96fbab){_0x124912[_0x4b68('0x24')](0x194);}return _0x96fbab;};}function handleError(_0x127214,_0x3e0a1f){_0x3e0a1f=_0x3e0a1f||0x1f4;return function(_0x490bee){logger[_0x4b68('0x25')](_0x490bee[_0x4b68('0x26')]);if(_0x490bee[_0x4b68('0x27')]){delete _0x490bee[_0x4b68('0x27')];}_0x127214['status'](_0x3e0a1f)[_0x4b68('0x28')](_0x490bee);};}exports[_0x4b68('0x29')]=function(_0x1d6f8f,_0x4ec872){var _0x348460={},_0x4e866f={},_0x4cb183={'count':0x0,'rows':[]};var _0x840f8=_[_0x4b68('0x2a')](db[_0x4b68('0x2b')][_0x4b68('0x2c')],function(_0x3eebb8){return{'name':_0x3eebb8[_0x4b68('0x2d')],'type':_0x3eebb8[_0x4b68('0x2e')]['key']};});_0x4e866f[_0x4b68('0x2f')]=_[_0x4b68('0x2a')](_0x840f8,'name');_0x4e866f[_0x4b68('0x30')]=_[_0x4b68('0x31')](_0x1d6f8f[_0x4b68('0x30')]);_0x4e866f[_0x4b68('0x32')]=_[_0x4b68('0x33')](_0x4e866f['model'],_0x4e866f[_0x4b68('0x30')]);_0x348460[_0x4b68('0x34')]=_[_0x4b68('0x33')](_0x4e866f[_0x4b68('0x2f')],qs[_0x4b68('0x35')](_0x1d6f8f[_0x4b68('0x30')][_0x4b68('0x35')]));_0x348460['attributes']=_0x348460['attributes'][_0x4b68('0x36')]?_0x348460['attributes']:_0x4e866f['model'];if(!_0x1d6f8f['query']['hasOwnProperty'](_0x4b68('0x37'))){_0x348460[_0x4b68('0x38')]=qs['limit'](_0x1d6f8f[_0x4b68('0x30')][_0x4b68('0x38')]);_0x348460[_0x4b68('0x1c')]=qs['offset'](_0x1d6f8f[_0x4b68('0x30')]['offset']);}_0x348460['order']=qs[_0x4b68('0x39')](_0x1d6f8f[_0x4b68('0x30')][_0x4b68('0x39')]);_0x348460[_0x4b68('0x3a')]=qs[_0x4b68('0x32')](_['pick'](_0x1d6f8f[_0x4b68('0x30')],_0x4e866f['filters']),_0x840f8);if(_0x1d6f8f[_0x4b68('0x30')][_0x4b68('0x3b')]){_0x348460['where']=_['merge'](_0x348460[_0x4b68('0x3a')],{'$or':_[_0x4b68('0x2a')](_0x840f8,function(_0x4e57e3){if(_0x4e57e3[_0x4b68('0x2e')]!==_0x4b68('0x3c')){var _0x31ea90={};_0x31ea90[_0x4e57e3['name']]={'$like':'%'+_0x1d6f8f[_0x4b68('0x30')][_0x4b68('0x3b')]+'%'};return _0x31ea90;}})});}_0x348460=_['merge']({},_0x348460,_0x1d6f8f['options']);var _0x3bfc5a={'where':_0x348460[_0x4b68('0x3a')]};return db['MailQueueReport']['count'](_0x3bfc5a)[_0x4b68('0x22')](function(_0x22b813){_0x4cb183[_0x4b68('0x1b')]=_0x22b813;if(_0x1d6f8f[_0x4b68('0x30')]['includeAll']){_0x348460[_0x4b68('0x3d')]=[{'all':!![]}];}return db[_0x4b68('0x2b')][_0x4b68('0x3e')](_0x348460);})[_0x4b68('0x22')](function(_0x3cf567){_0x4cb183[_0x4b68('0x3f')]=_0x3cf567;return _0x4cb183;})['then'](respondWithFilteredResult(_0x4ec872,_0x348460))[_0x4b68('0x40')](handleError(_0x4ec872,null));};exports['show']=function(_0x13352c,_0xff9b7d){var _0x4ee53e={'raw':!![],'where':{'id':_0x13352c[_0x4b68('0x41')]['id']}},_0x4c3415={};_0x4c3415[_0x4b68('0x2f')]=_[_0x4b68('0x31')](db[_0x4b68('0x2b')][_0x4b68('0x2c')]);_0x4c3415[_0x4b68('0x30')]=_['keys'](_0x13352c['query']);_0x4c3415[_0x4b68('0x32')]=_['intersection'](_0x4c3415['model'],_0x4c3415[_0x4b68('0x30')]);_0x4ee53e[_0x4b68('0x34')]=_[_0x4b68('0x33')](_0x4c3415[_0x4b68('0x2f')],qs[_0x4b68('0x35')](_0x13352c[_0x4b68('0x30')][_0x4b68('0x35')]));_0x4ee53e[_0x4b68('0x34')]=_0x4ee53e[_0x4b68('0x34')][_0x4b68('0x36')]?_0x4ee53e[_0x4b68('0x34')]:_0x4c3415[_0x4b68('0x2f')];if(_0x13352c['query']['includeAll']){_0x4ee53e[_0x4b68('0x3d')]=[{'all':!![]}];}_0x4ee53e=_['merge']({},_0x4ee53e,_0x13352c[_0x4b68('0x42')]);return db[_0x4b68('0x2b')][_0x4b68('0x43')](_0x4ee53e)[_0x4b68('0x22')](handleEntityNotFound(_0xff9b7d,null))['then'](respondWithResult(_0xff9b7d,null))['catch'](handleError(_0xff9b7d,null));};exports[_0x4b68('0x44')]=function(_0x202d20,_0x22b8f7){return db[_0x4b68('0x2b')][_0x4b68('0x44')](_0x202d20[_0x4b68('0x45')],{})[_0x4b68('0x22')](respondWithResult(_0x22b8f7,0xc9))[_0x4b68('0x40')](handleError(_0x22b8f7,null));};exports[_0x4b68('0x21')]=function(_0x3d2fd5,_0x4930ca){if(_0x3d2fd5[_0x4b68('0x45')]['id']){delete _0x3d2fd5[_0x4b68('0x45')]['id'];}return db[_0x4b68('0x2b')][_0x4b68('0x43')]({'where':{'id':_0x3d2fd5[_0x4b68('0x41')]['id']}})[_0x4b68('0x22')](handleEntityNotFound(_0x4930ca,null))[_0x4b68('0x22')](saveUpdates(_0x3d2fd5[_0x4b68('0x45')],null))[_0x4b68('0x22')](respondWithResult(_0x4930ca,null))['catch'](handleError(_0x4930ca,null));};exports[_0x4b68('0x23')]=function(_0x1ed493,_0x59fffc){return db['MailQueueReport'][_0x4b68('0x43')]({'where':{'id':_0x1ed493['params']['id']}})[_0x4b68('0x22')](handleEntityNotFound(_0x59fffc,null))[_0x4b68('0x22')](removeEntity(_0x59fffc,null))[_0x4b68('0x40')](handleError(_0x59fffc,null));};exports[_0x4b68('0x46')]=function(_0x2824b9,_0x2f8737){return db['MailQueueReport'][_0x4b68('0x46')]()[_0x4b68('0x22')](respondWithResult(_0x2f8737,null))[_0x4b68('0x40')](handleError(_0x2f8737,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index a72ae39..bad4391 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 _0x5065=['rimraf','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x487424,_0x156a01){var _0x42bea6=function(_0x1aba63){while(--_0x1aba63){_0x487424['push'](_0x487424['shift']());}};_0x42bea6(++_0x156a01);}(_0x5065,0x19e));var _0x5506=function(_0x2547ed,_0x1d6236){_0x2547ed=_0x2547ed-0x0;var _0x35151a=_0x5065[_0x2547ed];return _0x35151a;};'use strict';var _=require(_0x5506('0x0'));var util=require(_0x5506('0x1'));var logger=require(_0x5506('0x2'))('api');var moment=require(_0x5506('0x3'));var BPromise=require(_0x5506('0x4'));var rp=require(_0x5506('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5506('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0x5506('0x7')]=function(_0x76cd8e,_0x512a67){return _0x76cd8e[_0x5506('0x8')](_0x5506('0x9'),attributes,{'tableName':_0x5506('0xa'),'paranoid':![],'indexes':[{'name':_0x5506('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a6d=['util','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash'];(function(_0x21a04d,_0x22497e){var _0x17ea0c=function(_0xc78d0a){while(--_0xc78d0a){_0x21a04d['push'](_0x21a04d['shift']());}};_0x17ea0c(++_0x22497e);}(_0x7a6d,0x99));var _0xd7a6=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0x7a6d[_0x48999d];return _0x1ad0d1;};'use strict';var _=require(_0xd7a6('0x0'));var util=require(_0xd7a6('0x1'));var logger=require('../../config/logger')(_0xd7a6('0x2'));var moment=require(_0xd7a6('0x3'));var BPromise=require(_0xd7a6('0x4'));var rp=require(_0xd7a6('0x5'));var fs=require('fs');var path=require(_0xd7a6('0x6'));var rimraf=require('rimraf');var config=require(_0xd7a6('0x7'));var attributes=require(_0xd7a6('0x8'));module[_0xd7a6('0x9')]=function(_0x3330b3,_0x1a2f1c){return _0x3330b3[_0xd7a6('0xa')](_0xd7a6('0xb'),attributes,{'tableName':_0xd7a6('0xc'),'paranoid':![],'indexes':[{'name':_0xd7a6('0xd'),'fields':[_0xd7a6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 573e108..33a8b7e 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 _0x84eb=['request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x84eb,0x1a0));var _0xb84e=function(_0x4f6c62,_0x5786a5){_0x4f6c62=_0x4f6c62-0x0;var _0x51f32b=_0x84eb[_0x4f6c62];return _0x51f32b;};'use strict';var _=require(_0xb84e('0x0'));var util=require(_0xb84e('0x1'));var moment=require(_0xb84e('0x2'));var BPromise=require(_0xb84e('0x3'));var rs=require(_0xb84e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84e('0x5'))['db'];var utils=require(_0xb84e('0x6'));var logger=require(_0xb84e('0x7'))(_0xb84e('0x8'));var config=require(_0xb84e('0x9'));var jayson=require(_0xb84e('0xa'));var client=jayson[_0xb84e('0xb')][_0xb84e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5de9a6,_0x3dd548,_0x2615ec){return new BPromise(function(_0x5c33af,_0x3d8ebe){return client[_0xb84e('0xd')](_0x5de9a6,_0x2615ec)[_0xb84e('0xe')](function(_0x3a4fcc){logger['info'](_0xb84e('0xf'),_0x3dd548,_0xb84e('0x10'));logger[_0xb84e('0x11')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3dd548,'request\x20sent',JSON[_0xb84e('0x12')](_0x3a4fcc));if(_0x3a4fcc[_0xb84e('0x13')]){if(_0x3a4fcc[_0xb84e('0x13')][_0xb84e('0x14')]===0x1f4){logger[_0xb84e('0x13')](_0xb84e('0xf'),_0x3dd548,_0x3a4fcc[_0xb84e('0x13')][_0xb84e('0x15')]);return _0x3d8ebe(_0x3a4fcc[_0xb84e('0x13')][_0xb84e('0x15')]);}logger[_0xb84e('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x3dd548,_0x3a4fcc[_0xb84e('0x13')][_0xb84e('0x15')]);return _0x5c33af(_0x3a4fcc[_0xb84e('0x13')][_0xb84e('0x15')]);}else{logger[_0xb84e('0x16')](_0xb84e('0xf'),_0x3dd548,_0xb84e('0x10'));_0x5c33af(_0x3a4fcc[_0xb84e('0x17')][_0xb84e('0x15')]);}})[_0xb84e('0x18')](function(_0x5d82a5){logger[_0xb84e('0x13')](_0xb84e('0xf'),_0x3dd548,_0x5d82a5);_0x3d8ebe(_0x5d82a5);});});}exports[_0xb84e('0x19')]=function(_0x47ceed){var _0x5e087e=this;return new Promise(function(_0x5da27a,_0x278e65){return db[_0xb84e('0x1a')][_0xb84e('0x1b')](_0x47ceed[_0xb84e('0x1c')],{'raw':_0x47ceed[_0xb84e('0x1d')]?_0x47ceed['options'][_0xb84e('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0xf0b467){logger[_0xb84e('0x16')](_0xb84e('0x19'),_0x47ceed);logger[_0xb84e('0x11')]('CreateMailQueueReport',_0x47ceed,JSON['stringify'](_0xf0b467));_0x5da27a(_0xf0b467);})[_0xb84e('0x18')](function(_0x3f39b2){logger[_0xb84e('0x13')]('CreateMailQueueReport',_0x3f39b2[_0xb84e('0x15')],_0x47ceed);_0x278e65(_0x5e087e[_0xb84e('0x13')](0x1f4,_0x3f39b2[_0xb84e('0x15')]));});});};exports['UpdateMailQueueReport']=function(_0x1e02c4){var _0x1cf395=this;return new Promise(function(_0x238a47,_0x429f5d){return db[_0xb84e('0x1a')][_0xb84e('0x1f')](_0x1e02c4[_0xb84e('0x1c')],{'raw':_0x1e02c4[_0xb84e('0x1d')]?_0x1e02c4[_0xb84e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e02c4[_0xb84e('0x1d')]?_0x1e02c4[_0xb84e('0x1d')][_0xb84e('0x20')]||null:null,'attributes':_0x1e02c4[_0xb84e('0x1d')]?_0x1e02c4[_0xb84e('0x1d')][_0xb84e('0x21')]||null:null,'limit':_0x1e02c4['options']?_0x1e02c4[_0xb84e('0x1d')][_0xb84e('0x22')]||null:null})[_0xb84e('0xe')](function(_0x3035b3){logger[_0xb84e('0x16')](_0xb84e('0x23'),_0x1e02c4);logger[_0xb84e('0x11')](_0xb84e('0x23'),_0x1e02c4,JSON[_0xb84e('0x12')](_0x3035b3));_0x238a47(_0x3035b3);})[_0xb84e('0x18')](function(_0x284111){logger['error'](_0xb84e('0x23'),_0x284111[_0xb84e('0x15')],_0x1e02c4);_0x429f5d(_0x1cf395[_0xb84e('0x13')](0x1f4,_0x284111['message']));});});}; \ No newline at end of file +var _0x1942=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateMailQueueReport','MailQueueReport','body','options','stringify','UpdateMailQueueReport','update','util','bluebird','randomstring'];(function(_0x1ef9df,_0x33ba5e){var _0x14847f=function(_0x4722d3){while(--_0x4722d3){_0x1ef9df['push'](_0x1ef9df['shift']());}};_0x14847f(++_0x33ba5e);}(_0x1942,0x169));var _0x2194=function(_0x4e7de8,_0xdffee0){_0x4e7de8=_0x4e7de8-0x0;var _0x3fd1aa=_0x1942[_0x4e7de8];return _0x3fd1aa;};'use strict';var _=require('lodash');var util=require(_0x2194('0x0'));var moment=require('moment');var BPromise=require(_0x2194('0x1'));var rs=require(_0x2194('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2194('0x3'));var logger=require(_0x2194('0x4'))(_0x2194('0x5'));var config=require(_0x2194('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2194('0x7')][_0x2194('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x590613,_0x20d1f7,_0x74c77){return new BPromise(function(_0x10c8a5,_0x3de9c2){return client[_0x2194('0x9')](_0x590613,_0x74c77)[_0x2194('0xa')](function(_0x36c3b8){logger['info'](_0x2194('0xb'),_0x20d1f7,_0x2194('0xc'));logger[_0x2194('0xd')](_0x2194('0xe'),_0x20d1f7,_0x2194('0xc'),JSON['stringify'](_0x36c3b8));if(_0x36c3b8[_0x2194('0xf')]){if(_0x36c3b8[_0x2194('0xf')][_0x2194('0x10')]===0x1f4){logger[_0x2194('0xf')](_0x2194('0xb'),_0x20d1f7,_0x36c3b8['error'][_0x2194('0x11')]);return _0x3de9c2(_0x36c3b8[_0x2194('0xf')][_0x2194('0x11')]);}logger['error'](_0x2194('0xb'),_0x20d1f7,_0x36c3b8[_0x2194('0xf')][_0x2194('0x11')]);return _0x10c8a5(_0x36c3b8['error'][_0x2194('0x11')]);}else{logger[_0x2194('0x12')](_0x2194('0xb'),_0x20d1f7,_0x2194('0xc'));_0x10c8a5(_0x36c3b8[_0x2194('0x13')][_0x2194('0x11')]);}})[_0x2194('0x14')](function(_0x1251b7){logger[_0x2194('0xf')](_0x2194('0xb'),_0x20d1f7,_0x1251b7);_0x3de9c2(_0x1251b7);});});}exports[_0x2194('0x15')]=function(_0x2ca6fc){var _0x41381c=this;return new Promise(function(_0x496388,_0xf8d311){return db[_0x2194('0x16')]['create'](_0x2ca6fc[_0x2194('0x17')],{'raw':_0x2ca6fc['options']?_0x2ca6fc[_0x2194('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3324ec){logger['info'](_0x2194('0x15'),_0x2ca6fc);logger[_0x2194('0xd')](_0x2194('0x15'),_0x2ca6fc,JSON[_0x2194('0x19')](_0x3324ec));_0x496388(_0x3324ec);})['catch'](function(_0x4d2a4d){logger[_0x2194('0xf')](_0x2194('0x15'),_0x4d2a4d[_0x2194('0x11')],_0x2ca6fc);_0xf8d311(_0x41381c[_0x2194('0xf')](0x1f4,_0x4d2a4d['message']));});});};exports[_0x2194('0x1a')]=function(_0x4ceb7){var _0x2bcb46=this;return new Promise(function(_0x2bcadb,_0x86044b){return db[_0x2194('0x16')][_0x2194('0x1b')](_0x4ceb7[_0x2194('0x17')],{'raw':_0x4ceb7[_0x2194('0x18')]?_0x4ceb7[_0x2194('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ceb7['options']?_0x4ceb7[_0x2194('0x18')]['where']||null:null,'attributes':_0x4ceb7[_0x2194('0x18')]?_0x4ceb7[_0x2194('0x18')]['attributes']||null:null,'limit':_0x4ceb7[_0x2194('0x18')]?_0x4ceb7['options']['limit']||null:null})[_0x2194('0xa')](function(_0x1ccde0){logger[_0x2194('0x12')](_0x2194('0x1a'),_0x4ceb7);logger[_0x2194('0xd')](_0x2194('0x1a'),_0x4ceb7,JSON['stringify'](_0x1ccde0));_0x2bcadb(_0x1ccde0);})[_0x2194('0x14')](function(_0x50c8aa){logger[_0x2194('0xf')](_0x2194('0x1a'),_0x50c8aa[_0x2194('0x11')],_0x4ceb7);_0x86044b(_0x2bcb46[_0x2194('0xf')](0x1f4,_0x50c8aa['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index a9b7919..cb2c7a5 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 _0xcf92=['../../config/environment','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x5919dd,_0x5abc5f){var _0x5b4209=function(_0x235ddb){while(--_0x235ddb){_0x5919dd['push'](_0x5919dd['shift']());}};_0x5b4209(++_0x5abc5f);}(_0xcf92,0xea));var _0x2cf9=function(_0x3a6f75,_0x241f4c){_0x3a6f75=_0x3a6f75-0x0;var _0x4958f7=_0xcf92[_0x3a6f75];return _0x4958f7;};'use strict';var multer=require(_0x2cf9('0x0'));var util=require(_0x2cf9('0x1'));var path=require(_0x2cf9('0x2'));var timeout=require('connect-timeout');var express=require(_0x2cf9('0x3'));var router=express[_0x2cf9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2cf9('0x5'));var config=require(_0x2cf9('0x6'));module[_0x2cf9('0x7')]=router; \ No newline at end of file +var _0xd64f=['../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x55e25f,_0x49af1e){var _0x4361d2=function(_0xff426f){while(--_0xff426f){_0x55e25f['push'](_0x55e25f['shift']());}};_0x4361d2(++_0x49af1e);}(_0xd64f,0x1b3));var _0xfd64=function(_0x2da6fa,_0x130078){_0x2da6fa=_0x2da6fa-0x0;var _0x1a9064=_0xd64f[_0x2da6fa];return _0x1a9064;};'use strict';var multer=require('multer');var util=require(_0xfd64('0x0'));var path=require(_0xfd64('0x1'));var timeout=require(_0xfd64('0x2'));var express=require(_0xfd64('0x3'));var router=express[_0xfd64('0x4')]();var auth=require(_0xfd64('0x5'));var interaction=require(_0xfd64('0x6'));var config=require(_0xfd64('0x7'));module[_0xfd64('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 18dfc43..e50e052 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 _0x896b=['BOOLEAN','username','INTEGER','sequelize','exports','STRING'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x896b,0x75));var _0xb896=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x896b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb896('0x0'));module[_0xb896('0x1')]={'description':{'type':Sequelize[_0xb896('0x2')]},'host':{'type':Sequelize[_0xb896('0x2')]},'authentication':{'type':Sequelize[_0xb896('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb896('0x2')],'unique':_0xb896('0x4')},'password':{'type':Sequelize[_0xb896('0x2')]},'port':{'type':Sequelize[_0xb896('0x5')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb896('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xb896('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb896('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb896('0x2')]}}; \ No newline at end of file +var _0xfc5a=['STRING','BOOLEAN','username','INTEGER','INBOX','exports'];(function(_0x2c190e,_0x204029){var _0x1bdfc4=function(_0x5c7bb5){while(--_0x5c7bb5){_0x2c190e['push'](_0x2c190e['shift']());}};_0x1bdfc4(++_0x204029);}(_0xfc5a,0x9b));var _0xafc5=function(_0x481366,_0x41e46b){_0x481366=_0x481366-0x0;var _0x229649=_0xfc5a[_0x481366];return _0x229649;};'use strict';var Sequelize=require('sequelize');module[_0xafc5('0x0')]={'description':{'type':Sequelize[_0xafc5('0x1')]},'host':{'type':Sequelize[_0xafc5('0x1')]},'authentication':{'type':Sequelize[_0xafc5('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xafc5('0x1')],'unique':_0xafc5('0x3')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xafc5('0x4')]},'tls':{'type':Sequelize[_0xafc5('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xafc5('0x5')},'connTimeout':{'type':Sequelize[_0xafc5('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xafc5('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xafc5('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 345d146..657d29d 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 _0x96cc=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x45a472,_0x3fd9f6){var _0x46a410=function(_0x53e574){while(--_0x53e574){_0x45a472['push'](_0x45a472['shift']());}};_0x46a410(++_0x3fd9f6);}(_0x96cc,0x16c));var _0xc96c=function(_0x57b6ae,_0x2ca66e){_0x57b6ae=_0x57b6ae-0x0;var _0x8d7f4a=_0x96cc[_0x57b6ae];return _0x8d7f4a;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var logger=require(_0xc96c('0x1'))('api');var moment=require(_0xc96c('0x2'));var BPromise=require(_0xc96c('0x3'));var rp=require(_0xc96c('0x4'));var fs=require('fs');var path=require(_0xc96c('0x5'));var rimraf=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var attributes=require(_0xc96c('0x8'));module[_0xc96c('0x9')]=function(_0x3b7f45,_0x5142cd){return _0x3b7f45[_0xc96c('0xa')](_0xc96c('0xb'),attributes,{'tableName':_0xc96c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6017=['../../config/environment','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x37a5cf,_0x27d6c7){var _0x1f442b=function(_0x4a3664){while(--_0x4a3664){_0x37a5cf['push'](_0x37a5cf['shift']());}};_0x1f442b(++_0x27d6c7);}(_0x6017,0xae));var _0x7601=function(_0x2ba835,_0x51a5bc){_0x2ba835=_0x2ba835-0x0;var _0x4e19f0=_0x6017[_0x2ba835];return _0x4e19f0;};'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('./mailServerIn.attributes');module['exports']=function(_0x425bf9,_0xc62b2c){return _0x425bf9[_0x7601('0x7')](_0x7601('0x8'),attributes,{'tableName':_0x7601('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index faf2020..b78b3a8 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 _0xb63a=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','map','model','then','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xb63a,0x147));var _0xab63=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xb63a[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xab63('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab63('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab63('0x2'));var db=require(_0xab63('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xab63('0x4'))(_0xab63('0x5'));var config=require(_0xab63('0x6'));var jayson=require(_0xab63('0x7'));var client=jayson[_0xab63('0x8')][_0xab63('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cf8ad,_0x561baf,_0x60d9a3){return new BPromise(function(_0x377eb5,_0x1bc231){return client[_0xab63('0xa')](_0x3cf8ad,_0x60d9a3)['then'](function(_0x5520c7){logger[_0xab63('0xb')](_0xab63('0xc'),_0x561baf,_0xab63('0xd'));logger[_0xab63('0xe')](_0xab63('0xf'),_0x561baf,_0xab63('0xd'),JSON[_0xab63('0x10')](_0x5520c7));if(_0x5520c7[_0xab63('0x11')]){if(_0x5520c7[_0xab63('0x11')]['code']===0x1f4){logger[_0xab63('0x11')](_0xab63('0xc'),_0x561baf,_0x5520c7[_0xab63('0x11')][_0xab63('0x12')]);return _0x1bc231(_0x5520c7[_0xab63('0x11')][_0xab63('0x12')]);}logger[_0xab63('0x11')](_0xab63('0xc'),_0x561baf,_0x5520c7['error']['message']);return _0x377eb5(_0x5520c7[_0xab63('0x11')][_0xab63('0x12')]);}else{logger[_0xab63('0xb')]('MailServerIn,\x20%s,\x20%s',_0x561baf,_0xab63('0xd'));_0x377eb5(_0x5520c7[_0xab63('0x13')]['message']);}})[_0xab63('0x14')](function(_0xde12d4){logger[_0xab63('0x11')](_0xab63('0xc'),_0x561baf,_0xde12d4);_0x1bc231(_0xde12d4);});});}exports[_0xab63('0x15')]=function(_0x305e79){var _0x2d9fea=this;return new Promise(function(_0x1b2d56,_0x1dbaef){return db[_0xab63('0x16')][_0xab63('0x17')]({'raw':_0x305e79['options']?_0x305e79[_0xab63('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x305e79[_0xab63('0x18')]?_0x305e79[_0xab63('0x18')]['where']||null:null,'attributes':_0x305e79[_0xab63('0x18')]?_0x305e79[_0xab63('0x18')][_0xab63('0x19')]||null:null,'limit':_0x305e79['options']?_0x305e79[_0xab63('0x18')][_0xab63('0x1a')]||null:null,'include':_0x305e79[_0xab63('0x18')]?_0x305e79[_0xab63('0x18')][_0xab63('0x1b')]?_['map'](_0x305e79[_0xab63('0x18')][_0xab63('0x1b')],function(_0x346030){return{'model':db[_0x346030['model']],'as':_0x346030['as'],'attributes':_0x346030[_0xab63('0x19')],'include':_0x346030[_0xab63('0x1b')]?_['map'](_0x346030[_0xab63('0x1b')],function(_0x16a2e5){return{'model':db[_0x16a2e5['model']],'as':_0x16a2e5['as'],'attributes':_0x16a2e5['attributes'],'include':_0x16a2e5['include']?_[_0xab63('0x1c')](_0x16a2e5['include'],function(_0x59c27e){return{'model':db[_0x59c27e[_0xab63('0x1d')]],'as':_0x59c27e['as'],'attributes':_0x59c27e[_0xab63('0x19')]};}):[]};}):[]};}):[]:[]})[_0xab63('0x1e')](function(_0x9177c8){logger[_0xab63('0xb')](_0xab63('0x15'),_0x305e79);logger[_0xab63('0xe')](_0xab63('0x15'),_0x305e79,JSON[_0xab63('0x10')](_0x9177c8));_0x1b2d56(_0x9177c8);})[_0xab63('0x14')](function(_0x5da7fc){logger[_0xab63('0x11')](_0xab63('0x15'),_0x5da7fc[_0xab63('0x12')],_0x305e79);_0x1dbaef(_0x2d9fea[_0xab63('0x11')](0x1f4,_0x5da7fc[_0xab63('0x12')]));});});}; \ No newline at end of file +var _0x1a34=['jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','attributes','model','include','GetMailServerIn','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1d24a3,_0x14fd30){var _0x844985=function(_0x49aac9){while(--_0x49aac9){_0x1d24a3['push'](_0x1d24a3['shift']());}};_0x844985(++_0x14fd30);}(_0x1a34,0x77));var _0x41a3=function(_0x43319f,_0x172e6f){_0x43319f=_0x43319f-0x0;var _0x43cd50=_0x1a34[_0x43319f];return _0x43cd50;};'use strict';var _=require(_0x41a3('0x0'));var util=require('util');var moment=require(_0x41a3('0x1'));var BPromise=require('bluebird');var rs=require(_0x41a3('0x2'));var fs=require('fs');var Redis=require(_0x41a3('0x3'));var db=require(_0x41a3('0x4'))['db'];var utils=require(_0x41a3('0x5'));var logger=require(_0x41a3('0x6'))(_0x41a3('0x7'));var config=require(_0x41a3('0x8'));var jayson=require(_0x41a3('0x9'));var client=jayson[_0x41a3('0xa')][_0x41a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dbdad,_0x3f72fa,_0x13b768){return new BPromise(function(_0x3bc169,_0x30b6d0){return client[_0x41a3('0xc')](_0x4dbdad,_0x13b768)[_0x41a3('0xd')](function(_0x53be14){logger[_0x41a3('0xe')](_0x41a3('0xf'),_0x3f72fa,_0x41a3('0x10'));logger[_0x41a3('0x11')](_0x41a3('0x12'),_0x3f72fa,_0x41a3('0x10'),JSON[_0x41a3('0x13')](_0x53be14));if(_0x53be14[_0x41a3('0x14')]){if(_0x53be14[_0x41a3('0x14')][_0x41a3('0x15')]===0x1f4){logger[_0x41a3('0x14')]('MailServerIn,\x20%s,\x20%s',_0x3f72fa,_0x53be14['error'][_0x41a3('0x16')]);return _0x30b6d0(_0x53be14[_0x41a3('0x14')][_0x41a3('0x16')]);}logger['error'](_0x41a3('0xf'),_0x3f72fa,_0x53be14['error'][_0x41a3('0x16')]);return _0x3bc169(_0x53be14[_0x41a3('0x14')][_0x41a3('0x16')]);}else{logger['info'](_0x41a3('0xf'),_0x3f72fa,'request\x20sent');_0x3bc169(_0x53be14[_0x41a3('0x17')][_0x41a3('0x16')]);}})['catch'](function(_0x208df5){logger[_0x41a3('0x14')]('MailServerIn,\x20%s,\x20%s',_0x3f72fa,_0x208df5);_0x30b6d0(_0x208df5);});});}exports['GetMailServerIn']=function(_0x65c44b){var _0x3e1780=this;return new Promise(function(_0x1007b2,_0x2202f0){return db['MailServerIn'][_0x41a3('0x18')]({'raw':_0x65c44b[_0x41a3('0x19')]?_0x65c44b[_0x41a3('0x19')][_0x41a3('0x1a')]===undefined?!![]:![]:!![],'where':_0x65c44b[_0x41a3('0x19')]?_0x65c44b[_0x41a3('0x19')]['where']||null:null,'attributes':_0x65c44b[_0x41a3('0x19')]?_0x65c44b[_0x41a3('0x19')][_0x41a3('0x1b')]||null:null,'limit':_0x65c44b[_0x41a3('0x19')]?_0x65c44b[_0x41a3('0x19')]['limit']||null:null,'include':_0x65c44b[_0x41a3('0x19')]?_0x65c44b[_0x41a3('0x19')]['include']?_['map'](_0x65c44b[_0x41a3('0x19')]['include'],function(_0x6d0ac3){return{'model':db[_0x6d0ac3[_0x41a3('0x1c')]],'as':_0x6d0ac3['as'],'attributes':_0x6d0ac3[_0x41a3('0x1b')],'include':_0x6d0ac3[_0x41a3('0x1d')]?_['map'](_0x6d0ac3[_0x41a3('0x1d')],function(_0x5b9f44){return{'model':db[_0x5b9f44[_0x41a3('0x1c')]],'as':_0x5b9f44['as'],'attributes':_0x5b9f44[_0x41a3('0x1b')],'include':_0x5b9f44['include']?_['map'](_0x5b9f44[_0x41a3('0x1d')],function(_0x57fd28){return{'model':db[_0x57fd28['model']],'as':_0x57fd28['as'],'attributes':_0x57fd28['attributes']};}):[]};}):[]};}):[]:[]})[_0x41a3('0xd')](function(_0x306e4e){logger['info'](_0x41a3('0x1e'),_0x65c44b);logger['debug'](_0x41a3('0x1e'),_0x65c44b,JSON[_0x41a3('0x13')](_0x306e4e));_0x1007b2(_0x306e4e);})[_0x41a3('0x1f')](function(_0x35c881){logger['error'](_0x41a3('0x1e'),_0x35c881[_0x41a3('0x16')],_0x65c44b);_0x2202f0(_0x3e1780['error'](0x1f4,_0x35c881['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index c0f0d7c..0081d8e 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 _0xf517=['Router','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','post','create','destroy','exports','util','path'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xf517,0x14e));var _0x7f51=function(_0x4b7c95,_0x11efd1){_0x4b7c95=_0x4b7c95-0x0;var _0x4b7ab5=_0xf517[_0x4b7c95];return _0x4b7ab5;};'use strict';var multer=require('multer');var util=require(_0x7f51('0x0'));var path=require(_0x7f51('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7f51('0x2')]();var auth=require(_0x7f51('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7f51('0x4'));var controller=require(_0x7f51('0x5'));router[_0x7f51('0x6')]('/',auth[_0x7f51('0x7')](),controller[_0x7f51('0x8')]);router[_0x7f51('0x6')](_0x7f51('0x9'),auth[_0x7f51('0x7')](),controller['show']);router[_0x7f51('0xa')]('/',auth[_0x7f51('0x7')](),controller[_0x7f51('0xb')]);router['put'](_0x7f51('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7f51('0x9'),auth['isAuthenticated'](),controller[_0x7f51('0xc')]);module[_0x7f51('0xd')]=router; \ No newline at end of file +var _0x9893=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','/:id','update','delete','exports','multer','path','express'];(function(_0xefe8df,_0x399303){var _0x55b239=function(_0xd0ba4f){while(--_0xd0ba4f){_0xefe8df['push'](_0xefe8df['shift']());}};_0x55b239(++_0x399303);}(_0x9893,0x192));var _0x3989=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9893[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x3989('0x0'));var util=require('util');var path=require(_0x3989('0x1'));var timeout=require('connect-timeout');var express=require(_0x3989('0x2'));var router=express['Router']();var auth=require(_0x3989('0x3'));var interaction=require(_0x3989('0x4'));var config=require(_0x3989('0x5'));var controller=require('./mailServerOut.controller');router[_0x3989('0x6')]('/',auth[_0x3989('0x7')](),controller['index']);router[_0x3989('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x3989('0x8')]);router[_0x3989('0x9')]('/',auth[_0x3989('0x7')](),controller[_0x3989('0xa')]);router['put'](_0x3989('0xb'),auth['isAuthenticated'](),controller[_0x3989('0xc')]);router[_0x3989('0xd')](_0x3989('0xb'),auth[_0x3989('0x7')](),controller['destroy']);module[_0x3989('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 3269046..2ffe4a6 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 _0xf31b=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x53f02f,_0x179f5b){var _0x584a5e=function(_0x368e1b){while(--_0x368e1b){_0x53f02f['push'](_0x53f02f['shift']());}};_0x584a5e(++_0x179f5b);}(_0xf31b,0x1a0));var _0xbf31=function(_0x17e02a,_0x454ffb){_0x17e02a=_0x17e02a-0x0;var _0x7dbbfc=_0xf31b[_0x17e02a];return _0x7dbbfc;};'use strict';var Sequelize=require(_0xbf31('0x0'));module[_0xbf31('0x1')]={'description':{'type':Sequelize[_0xbf31('0x2')]},'host':{'type':Sequelize[_0xbf31('0x2')]},'user':{'type':Sequelize[_0xbf31('0x2')]},'pass':{'type':Sequelize[_0xbf31('0x2')]},'port':{'type':Sequelize[_0xbf31('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xbf31('0x2')]},'authentication':{'type':Sequelize[_0xbf31('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc963=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x41b935,_0x4a0170){var _0x1fdb85=function(_0x5b46c7){while(--_0x5b46c7){_0x41b935['push'](_0x41b935['shift']());}};_0x1fdb85(++_0x4a0170);}(_0xc963,0x17f));var _0x3c96=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0xc963[_0x2d982d];return _0x4f36b0;};'use strict';var Sequelize=require(_0x3c96('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3c96('0x1')]},'user':{'type':Sequelize[_0x3c96('0x1')]},'pass':{'type':Sequelize[_0x3c96('0x1')]},'port':{'type':Sequelize[_0x3c96('0x2')]},'secure':{'type':Sequelize[_0x3c96('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x3c96('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 5236d15..f7d3c23 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 _0xbaee=['find','destroy','html-pdf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','name','index','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','filter','MailServerOut','count','include','findAll','catch','show','params','keys','rawAttributes','includeAll','options','create','body'];(function(_0x42e97b,_0x59b053){var _0x247ef7=function(_0x3c52fb){while(--_0x3c52fb){_0x42e97b['push'](_0x42e97b['shift']());}};_0x247ef7(++_0x59b053);}(_0xbaee,0x1b2));var _0xebae=function(_0x65f7d6,_0x46b7e8){_0x65f7d6=_0x65f7d6-0x0;var _0xc6d4d5=_0xbaee[_0x65f7d6];return _0xc6d4d5;};'use strict';var pdf=require(_0xebae('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xebae('0x1'));var moment=require(_0xebae('0x2'));var BPromise=require(_0xebae('0x3'));var Mustache=require(_0xebae('0x4'));var util=require('util');var path=require(_0xebae('0x5'));var sox=require(_0xebae('0x6'));var csv=require(_0xebae('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xebae('0x8'));var squel=require(_0xebae('0x9'));var crypto=require(_0xebae('0xa'));var jsforce=require(_0xebae('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xebae('0x7'));var querystring=require(_0xebae('0xc'));var Papa=require(_0xebae('0xd'));var Redis=require(_0xebae('0xe'));var authService=require(_0xebae('0xf'));var qs=require(_0xebae('0x10'));var as=require(_0xebae('0x11'));var hardwareService=require(_0xebae('0x12'));var logger=require('../../config/logger')(_0xebae('0x13'));var utils=require(_0xebae('0x14'));var config=require(_0xebae('0x15'));var licenseUtil=require(_0xebae('0x16'));var db=require(_0xebae('0x17'))['db'];function respondWithStatusCode(_0x3cea97,_0x591474){_0x591474=_0x591474||0xcc;return function(_0x48ff5f){if(_0x48ff5f){return _0x3cea97[_0xebae('0x18')](_0x591474);}return _0x3cea97[_0xebae('0x19')](_0x591474)['end']();};}function respondWithResult(_0x547b0c,_0x719b92){_0x719b92=_0x719b92||0xc8;return function(_0x3ff375){if(_0x3ff375){return _0x547b0c[_0xebae('0x19')](_0x719b92)['json'](_0x3ff375);}};}function respondWithFilteredResult(_0xe7f2fc,_0x42fe77){return function(_0x1d82c7){if(_0x1d82c7){var _0x55ea2f=_0x1d82c7['count'],_0x37a07d=_0x42fe77[_0xebae('0x1a')],_0x1e750c=_0x42fe77[_0xebae('0x1a')]+_0x42fe77[_0xebae('0x1b')],_0x40fd06;if(_0x1e750c>=_0x55ea2f){_0x1e750c=_0x55ea2f;_0x40fd06=0xc8;}else{_0x40fd06=0xce;}_0xe7f2fc[_0xebae('0x19')](_0x40fd06);return _0xe7f2fc[_0xebae('0x1c')](_0xebae('0x1d'),_0x37a07d+'-'+_0x1e750c+'/'+_0x55ea2f)[_0xebae('0x1e')](_0x1d82c7);}return null;};}function patchUpdates(_0x47c111){return function(_0x2a1daf){try{jsonpatch[_0xebae('0x1f')](_0x2a1daf,_0x47c111,!![]);}catch(_0x21f160){return BPromise[_0xebae('0x20')](_0x21f160);}return _0x2a1daf[_0xebae('0x21')]();};}function saveUpdates(_0x1bcaf3,_0x4a081b){return function(_0x5b0240){if(_0x5b0240){return _0x5b0240[_0xebae('0x22')](_0x1bcaf3)['then'](function(_0x34323c){return _0x34323c;});}return null;};}function removeEntity(_0x3e0609,_0x1ad916){return function(_0x3d4af8){if(_0x3d4af8){return _0x3d4af8['destroy']()[_0xebae('0x23')](function(){_0x3e0609[_0xebae('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2166c9,_0x1ffa42){return function(_0x1dcdfc){if(!_0x1dcdfc){_0x2166c9[_0xebae('0x18')](0x194);}return _0x1dcdfc;};}function handleError(_0x334d15,_0x3e6fe5){_0x3e6fe5=_0x3e6fe5||0x1f4;return function(_0x3781e3){logger[_0xebae('0x24')](_0x3781e3['stack']);if(_0x3781e3['name']){delete _0x3781e3[_0xebae('0x25')];}_0x334d15[_0xebae('0x19')](_0x3e6fe5)['send'](_0x3781e3);};}exports[_0xebae('0x26')]=function(_0x39ae43,_0x34afac){var _0x267df9={},_0x28d0a0={},_0x504864={'count':0x0,'rows':[]};var _0x9a13d6=_['map'](db['MailServerOut']['rawAttributes'],function(_0x1bf4fb){return{'name':_0x1bf4fb[_0xebae('0x27')],'type':_0x1bf4fb[_0xebae('0x28')][_0xebae('0x29')]};});_0x28d0a0[_0xebae('0x2a')]=_['map'](_0x9a13d6,_0xebae('0x25'));_0x28d0a0['query']=_['keys'](_0x39ae43[_0xebae('0x2b')]);_0x28d0a0[_0xebae('0x2c')]=_[_0xebae('0x2d')](_0x28d0a0['model'],_0x28d0a0[_0xebae('0x2b')]);_0x267df9[_0xebae('0x2e')]=_['intersection'](_0x28d0a0['model'],qs[_0xebae('0x2f')](_0x39ae43[_0xebae('0x2b')]['fields']));_0x267df9['attributes']=_0x267df9['attributes']['length']?_0x267df9[_0xebae('0x2e')]:_0x28d0a0[_0xebae('0x2a')];if(!_0x39ae43['query'][_0xebae('0x30')]('nolimit')){_0x267df9[_0xebae('0x1b')]=qs[_0xebae('0x1b')](_0x39ae43[_0xebae('0x2b')][_0xebae('0x1b')]);_0x267df9['offset']=qs['offset'](_0x39ae43[_0xebae('0x2b')]['offset']);}_0x267df9[_0xebae('0x31')]=qs[_0xebae('0x32')](_0x39ae43['query'][_0xebae('0x32')]);_0x267df9[_0xebae('0x33')]=qs[_0xebae('0x2c')](_[_0xebae('0x34')](_0x39ae43[_0xebae('0x2b')],_0x28d0a0[_0xebae('0x2c')]),_0x9a13d6);if(_0x39ae43[_0xebae('0x2b')]['filter']){_0x267df9[_0xebae('0x33')]=_[_0xebae('0x35')](_0x267df9['where'],{'$or':_[_0xebae('0x36')](_0x9a13d6,function(_0x142c30){if(_0x142c30[_0xebae('0x28')]!==_0xebae('0x37')){var _0x1778cf={};_0x1778cf[_0x142c30[_0xebae('0x25')]]={'$like':'%'+_0x39ae43[_0xebae('0x2b')][_0xebae('0x38')]+'%'};return _0x1778cf;}})});}_0x267df9=_[_0xebae('0x35')]({},_0x267df9,_0x39ae43['options']);var _0x2a0df8={'where':_0x267df9[_0xebae('0x33')]};return db[_0xebae('0x39')][_0xebae('0x3a')](_0x2a0df8)[_0xebae('0x23')](function(_0x264d4a){_0x504864[_0xebae('0x3a')]=_0x264d4a;if(_0x39ae43[_0xebae('0x2b')]['includeAll']){_0x267df9[_0xebae('0x3b')]=[{'all':!![]}];}return db[_0xebae('0x39')][_0xebae('0x3c')](_0x267df9);})['then'](function(_0x1f21da){_0x504864['rows']=_0x1f21da;return _0x504864;})['then'](respondWithFilteredResult(_0x34afac,_0x267df9))[_0xebae('0x3d')](handleError(_0x34afac,null));};exports[_0xebae('0x3e')]=function(_0x6fdee1,_0x46df2d){var _0x506c86={'raw':!![],'where':{'id':_0x6fdee1[_0xebae('0x3f')]['id']}},_0x2f693e={};_0x2f693e['model']=_[_0xebae('0x40')](db['MailServerOut'][_0xebae('0x41')]);_0x2f693e[_0xebae('0x2b')]=_[_0xebae('0x40')](_0x6fdee1[_0xebae('0x2b')]);_0x2f693e[_0xebae('0x2c')]=_[_0xebae('0x2d')](_0x2f693e[_0xebae('0x2a')],_0x2f693e[_0xebae('0x2b')]);_0x506c86[_0xebae('0x2e')]=_[_0xebae('0x2d')](_0x2f693e[_0xebae('0x2a')],qs['fields'](_0x6fdee1[_0xebae('0x2b')][_0xebae('0x2f')]));_0x506c86[_0xebae('0x2e')]=_0x506c86[_0xebae('0x2e')]['length']?_0x506c86[_0xebae('0x2e')]:_0x2f693e[_0xebae('0x2a')];if(_0x6fdee1[_0xebae('0x2b')][_0xebae('0x42')]){_0x506c86[_0xebae('0x3b')]=[{'all':!![]}];}_0x506c86=_[_0xebae('0x35')]({},_0x506c86,_0x6fdee1[_0xebae('0x43')]);return db['MailServerOut']['find'](_0x506c86)['then'](handleEntityNotFound(_0x46df2d,null))[_0xebae('0x23')](respondWithResult(_0x46df2d,null))[_0xebae('0x3d')](handleError(_0x46df2d,null));};exports[_0xebae('0x44')]=function(_0x486d01,_0x56837c){return db[_0xebae('0x39')][_0xebae('0x44')](_0x486d01[_0xebae('0x45')],{})[_0xebae('0x23')](respondWithResult(_0x56837c,0xc9))['catch'](handleError(_0x56837c,null));};exports[_0xebae('0x22')]=function(_0x5e3f5e,_0x1a1b47){if(_0x5e3f5e[_0xebae('0x45')]['id']){delete _0x5e3f5e[_0xebae('0x45')]['id'];}return db[_0xebae('0x39')][_0xebae('0x46')]({'where':{'id':_0x5e3f5e[_0xebae('0x3f')]['id']}})[_0xebae('0x23')](handleEntityNotFound(_0x1a1b47,null))[_0xebae('0x23')](saveUpdates(_0x5e3f5e[_0xebae('0x45')],null))[_0xebae('0x23')](respondWithResult(_0x1a1b47,null))[_0xebae('0x3d')](handleError(_0x1a1b47,null));};exports[_0xebae('0x47')]=function(_0x254051,_0x17d939){return db[_0xebae('0x39')][_0xebae('0x46')]({'where':{'id':_0x254051[_0xebae('0x3f')]['id']}})[_0xebae('0x23')](handleEntityNotFound(_0x17d939,null))[_0xebae('0x23')](removeEntity(_0x17d939,null))[_0xebae('0x3d')](handleError(_0x17d939,null));}; \ No newline at end of file +var _0xe8aa=['findAll','rows','catch','show','params','create','body','update','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','MailServerOut','includeAll','include'];(function(_0xe3cc0,_0x3c8e7c){var _0x210520=function(_0x3870fa){while(--_0x3870fa){_0xe3cc0['push'](_0xe3cc0['shift']());}};_0x210520(++_0x3c8e7c);}(_0xe8aa,0xa3));var _0xae8a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe8aa[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xae8a('0x0'));var emlformat=require(_0xae8a('0x1'));var rimraf=require(_0xae8a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae8a('0x3'));var rp=require(_0xae8a('0x4'));var moment=require('moment');var BPromise=require(_0xae8a('0x5'));var Mustache=require(_0xae8a('0x6'));var util=require(_0xae8a('0x7'));var path=require(_0xae8a('0x8'));var sox=require(_0xae8a('0x9'));var csv=require(_0xae8a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xae8a('0xb'));var squel=require(_0xae8a('0xc'));var crypto=require(_0xae8a('0xd'));var jsforce=require(_0xae8a('0xe'));var deskjs=require(_0xae8a('0xf'));var toCsv=require(_0xae8a('0xa'));var querystring=require(_0xae8a('0x10'));var Papa=require(_0xae8a('0x11'));var Redis=require(_0xae8a('0x12'));var authService=require(_0xae8a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xae8a('0x14'));var hardwareService=require(_0xae8a('0x15'));var logger=require(_0xae8a('0x16'))(_0xae8a('0x17'));var utils=require(_0xae8a('0x18'));var config=require(_0xae8a('0x19'));var licenseUtil=require(_0xae8a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf40e9e,_0x204983){_0x204983=_0x204983||0xcc;return function(_0x9bf989){if(_0x9bf989){return _0xf40e9e[_0xae8a('0x1b')](_0x204983);}return _0xf40e9e[_0xae8a('0x1c')](_0x204983)[_0xae8a('0x1d')]();};}function respondWithResult(_0x59a6ab,_0x3bc784){_0x3bc784=_0x3bc784||0xc8;return function(_0x6f83ac){if(_0x6f83ac){return _0x59a6ab['status'](_0x3bc784)[_0xae8a('0x1e')](_0x6f83ac);}};}function respondWithFilteredResult(_0x576df5,_0x301f61){return function(_0x3e1635){if(_0x3e1635){var _0x2e9cec=_0x3e1635[_0xae8a('0x1f')],_0xcaf90d=_0x301f61[_0xae8a('0x20')],_0x3c421f=_0x301f61['offset']+_0x301f61[_0xae8a('0x21')],_0x14bdfe;if(_0x3c421f>=_0x2e9cec){_0x3c421f=_0x2e9cec;_0x14bdfe=0xc8;}else{_0x14bdfe=0xce;}_0x576df5[_0xae8a('0x1c')](_0x14bdfe);return _0x576df5[_0xae8a('0x22')](_0xae8a('0x23'),_0xcaf90d+'-'+_0x3c421f+'/'+_0x2e9cec)[_0xae8a('0x1e')](_0x3e1635);}return null;};}function patchUpdates(_0x3f25e8){return function(_0x4cf5f4){try{jsonpatch[_0xae8a('0x24')](_0x4cf5f4,_0x3f25e8,!![]);}catch(_0x2a7bd3){return BPromise[_0xae8a('0x25')](_0x2a7bd3);}return _0x4cf5f4[_0xae8a('0x26')]();};}function saveUpdates(_0x49d5a2,_0x212dc0){return function(_0x1388d1){if(_0x1388d1){return _0x1388d1['update'](_0x49d5a2)['then'](function(_0x5d7d3c){return _0x5d7d3c;});}return null;};}function removeEntity(_0x31289f,_0x11afb6){return function(_0x25bb3e){if(_0x25bb3e){return _0x25bb3e[_0xae8a('0x27')]()[_0xae8a('0x28')](function(){_0x31289f[_0xae8a('0x1c')](0xcc)[_0xae8a('0x1d')]();});}};}function handleEntityNotFound(_0x9a32f0,_0x4037c4){return function(_0x3f824b){if(!_0x3f824b){_0x9a32f0[_0xae8a('0x1b')](0x194);}return _0x3f824b;};}function handleError(_0x32b44c,_0x4fdf20){_0x4fdf20=_0x4fdf20||0x1f4;return function(_0x254160){logger[_0xae8a('0x29')](_0x254160[_0xae8a('0x2a')]);if(_0x254160[_0xae8a('0x2b')]){delete _0x254160[_0xae8a('0x2b')];}_0x32b44c[_0xae8a('0x1c')](_0x4fdf20)['send'](_0x254160);};}exports['index']=function(_0x12f960,_0x112bf6){var _0x1ce12f={},_0x520bbf={},_0x34d024={'count':0x0,'rows':[]};var _0x5c8f4f=_[_0xae8a('0x2c')](db['MailServerOut'][_0xae8a('0x2d')],function(_0x22faf3){return{'name':_0x22faf3[_0xae8a('0x2e')],'type':_0x22faf3[_0xae8a('0x2f')][_0xae8a('0x30')]};});_0x520bbf['model']=_[_0xae8a('0x2c')](_0x5c8f4f,_0xae8a('0x2b'));_0x520bbf[_0xae8a('0x31')]=_[_0xae8a('0x32')](_0x12f960[_0xae8a('0x31')]);_0x520bbf[_0xae8a('0x33')]=_[_0xae8a('0x34')](_0x520bbf[_0xae8a('0x35')],_0x520bbf[_0xae8a('0x31')]);_0x1ce12f[_0xae8a('0x36')]=_[_0xae8a('0x34')](_0x520bbf[_0xae8a('0x35')],qs[_0xae8a('0x37')](_0x12f960['query'][_0xae8a('0x37')]));_0x1ce12f[_0xae8a('0x36')]=_0x1ce12f[_0xae8a('0x36')][_0xae8a('0x38')]?_0x1ce12f[_0xae8a('0x36')]:_0x520bbf['model'];if(!_0x12f960['query'][_0xae8a('0x39')]('nolimit')){_0x1ce12f[_0xae8a('0x21')]=qs[_0xae8a('0x21')](_0x12f960['query'][_0xae8a('0x21')]);_0x1ce12f[_0xae8a('0x20')]=qs['offset'](_0x12f960[_0xae8a('0x31')][_0xae8a('0x20')]);}_0x1ce12f[_0xae8a('0x3a')]=qs[_0xae8a('0x3b')](_0x12f960[_0xae8a('0x31')]['sort']);_0x1ce12f[_0xae8a('0x3c')]=qs['filters'](_['pick'](_0x12f960[_0xae8a('0x31')],_0x520bbf[_0xae8a('0x33')]),_0x5c8f4f);if(_0x12f960['query'][_0xae8a('0x3d')]){_0x1ce12f[_0xae8a('0x3c')]=_[_0xae8a('0x3e')](_0x1ce12f[_0xae8a('0x3c')],{'$or':_['map'](_0x5c8f4f,function(_0x54ed01){if(_0x54ed01[_0xae8a('0x2f')]!==_0xae8a('0x3f')){var _0x417a0c={};_0x417a0c[_0x54ed01[_0xae8a('0x2b')]]={'$like':'%'+_0x12f960[_0xae8a('0x31')][_0xae8a('0x3d')]+'%'};return _0x417a0c;}})});}_0x1ce12f=_[_0xae8a('0x3e')]({},_0x1ce12f,_0x12f960[_0xae8a('0x40')]);var _0x1fa361={'where':_0x1ce12f[_0xae8a('0x3c')]};return db[_0xae8a('0x41')][_0xae8a('0x1f')](_0x1fa361)[_0xae8a('0x28')](function(_0x589fe2){_0x34d024[_0xae8a('0x1f')]=_0x589fe2;if(_0x12f960[_0xae8a('0x31')][_0xae8a('0x42')]){_0x1ce12f[_0xae8a('0x43')]=[{'all':!![]}];}return db[_0xae8a('0x41')][_0xae8a('0x44')](_0x1ce12f);})['then'](function(_0x2bf0ac){_0x34d024[_0xae8a('0x45')]=_0x2bf0ac;return _0x34d024;})[_0xae8a('0x28')](respondWithFilteredResult(_0x112bf6,_0x1ce12f))[_0xae8a('0x46')](handleError(_0x112bf6,null));};exports[_0xae8a('0x47')]=function(_0x158c9d,_0x10cf45){var _0x1cb800={'raw':!![],'where':{'id':_0x158c9d[_0xae8a('0x48')]['id']}},_0x253d94={};_0x253d94[_0xae8a('0x35')]=_[_0xae8a('0x32')](db['MailServerOut'][_0xae8a('0x2d')]);_0x253d94[_0xae8a('0x31')]=_['keys'](_0x158c9d[_0xae8a('0x31')]);_0x253d94[_0xae8a('0x33')]=_[_0xae8a('0x34')](_0x253d94[_0xae8a('0x35')],_0x253d94[_0xae8a('0x31')]);_0x1cb800[_0xae8a('0x36')]=_[_0xae8a('0x34')](_0x253d94['model'],qs[_0xae8a('0x37')](_0x158c9d[_0xae8a('0x31')][_0xae8a('0x37')]));_0x1cb800[_0xae8a('0x36')]=_0x1cb800['attributes']['length']?_0x1cb800[_0xae8a('0x36')]:_0x253d94['model'];if(_0x158c9d[_0xae8a('0x31')][_0xae8a('0x42')]){_0x1cb800[_0xae8a('0x43')]=[{'all':!![]}];}_0x1cb800=_[_0xae8a('0x3e')]({},_0x1cb800,_0x158c9d[_0xae8a('0x40')]);return db['MailServerOut']['find'](_0x1cb800)[_0xae8a('0x28')](handleEntityNotFound(_0x10cf45,null))[_0xae8a('0x28')](respondWithResult(_0x10cf45,null))[_0xae8a('0x46')](handleError(_0x10cf45,null));};exports[_0xae8a('0x49')]=function(_0x2ede62,_0x1abaee){return db[_0xae8a('0x41')][_0xae8a('0x49')](_0x2ede62[_0xae8a('0x4a')],{})[_0xae8a('0x28')](respondWithResult(_0x1abaee,0xc9))[_0xae8a('0x46')](handleError(_0x1abaee,null));};exports[_0xae8a('0x4b')]=function(_0x400b5b,_0x1cf4b6){if(_0x400b5b[_0xae8a('0x4a')]['id']){delete _0x400b5b[_0xae8a('0x4a')]['id'];}return db[_0xae8a('0x41')][_0xae8a('0x4c')]({'where':{'id':_0x400b5b[_0xae8a('0x48')]['id']}})[_0xae8a('0x28')](handleEntityNotFound(_0x1cf4b6,null))[_0xae8a('0x28')](saveUpdates(_0x400b5b[_0xae8a('0x4a')],null))[_0xae8a('0x28')](respondWithResult(_0x1cf4b6,null))['catch'](handleError(_0x1cf4b6,null));};exports[_0xae8a('0x27')]=function(_0x458b1b,_0x8c338a){return db[_0xae8a('0x41')]['find']({'where':{'id':_0x458b1b['params']['id']}})[_0xae8a('0x28')](handleEntityNotFound(_0x8c338a,null))[_0xae8a('0x28')](removeEntity(_0x8c338a,null))['catch'](handleError(_0x8c338a,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index cf60938..4f45b6f 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 _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x307a07,_0x48b641){var _0x120421=function(_0x38c7b8){while(--_0x38c7b8){_0x307a07['push'](_0x307a07['shift']());}};_0x120421(++_0x48b641);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2ec330,_0x4ccde2){_0x2ec330=_0x2ec330-0x0;var _0x49ff0e=_0x9c5a[_0x2ec330];return _0x49ff0e;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./mailServerOut.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dba82,_0xf04b3b){var _0x3786dd=function(_0x12f948){while(--_0x12f948){_0x3dba82['push'](_0x3dba82['shift']());}};_0x3786dd(++_0xf04b3b);}(_0x4975,0x86));var _0x5497=function(_0x51d603,_0x338922){_0x51d603=_0x51d603-0x0;var _0x4791a5=_0x4975[_0x51d603];return _0x4791a5;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('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 28059b5..9b45df7 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 _0x2ca5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment'];(function(_0x58e1d8,_0x376aa8){var _0x566728=function(_0x436e43){while(--_0x436e43){_0x58e1d8['push'](_0x58e1d8['shift']());}};_0x566728(++_0x376aa8);}(_0x2ca5,0x139));var _0x52ca=function(_0x451ef3,_0x4331d7){_0x451ef3=_0x451ef3-0x0;var _0x257295=_0x2ca5[_0x451ef3];return _0x257295;};'use strict';var _=require('lodash');var util=require(_0x52ca('0x0'));var moment=require(_0x52ca('0x1'));var BPromise=require('bluebird');var rs=require(_0x52ca('0x2'));var fs=require('fs');var Redis=require(_0x52ca('0x3'));var db=require(_0x52ca('0x4'))['db'];var utils=require(_0x52ca('0x5'));var logger=require(_0x52ca('0x6'))(_0x52ca('0x7'));var config=require(_0x52ca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x52ca('0x9')][_0x52ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4287d0,_0x285391,_0x1d0445){return new BPromise(function(_0x4eb3dd,_0x1ec885){return client['request'](_0x4287d0,_0x1d0445)['then'](function(_0x5e05c1){logger['info'](_0x52ca('0xb'),_0x285391,_0x52ca('0xc'));logger[_0x52ca('0xd')](_0x52ca('0xe'),_0x285391,_0x52ca('0xc'),JSON[_0x52ca('0xf')](_0x5e05c1));if(_0x5e05c1['error']){if(_0x5e05c1[_0x52ca('0x10')][_0x52ca('0x11')]===0x1f4){logger[_0x52ca('0x10')](_0x52ca('0xb'),_0x285391,_0x5e05c1[_0x52ca('0x10')][_0x52ca('0x12')]);return _0x1ec885(_0x5e05c1[_0x52ca('0x10')][_0x52ca('0x12')]);}logger['error'](_0x52ca('0xb'),_0x285391,_0x5e05c1[_0x52ca('0x10')]['message']);return _0x4eb3dd(_0x5e05c1[_0x52ca('0x10')]['message']);}else{logger[_0x52ca('0x13')](_0x52ca('0xb'),_0x285391,_0x52ca('0xc'));_0x4eb3dd(_0x5e05c1['result'][_0x52ca('0x12')]);}})[_0x52ca('0x14')](function(_0x3cb48d){logger[_0x52ca('0x10')](_0x52ca('0xb'),_0x285391,_0x3cb48d);_0x1ec885(_0x3cb48d);});});} \ No newline at end of file +var _0x8602=['MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8602,0x1bd));var _0x2860=function(_0xf35bc1,_0x510803){_0xf35bc1=_0xf35bc1-0x0;var _0xa6b162=_0x8602[_0xf35bc1];return _0xa6b162;};'use strict';var _=require(_0x2860('0x0'));var util=require(_0x2860('0x1'));var moment=require(_0x2860('0x2'));var BPromise=require(_0x2860('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2860('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2860('0x5'));var config=require(_0x2860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2860('0x7')][_0x2860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1563ec,_0x3fb302,_0x26b53d){return new BPromise(function(_0x9c8259,_0x61128a){return client[_0x2860('0x9')](_0x1563ec,_0x26b53d)[_0x2860('0xa')](function(_0x107df4){logger[_0x2860('0xb')](_0x2860('0xc'),_0x3fb302,_0x2860('0xd'));logger[_0x2860('0xe')](_0x2860('0xf'),_0x3fb302,_0x2860('0xd'),JSON[_0x2860('0x10')](_0x107df4));if(_0x107df4[_0x2860('0x11')]){if(_0x107df4[_0x2860('0x11')]['code']===0x1f4){logger[_0x2860('0x11')](_0x2860('0xc'),_0x3fb302,_0x107df4['error'][_0x2860('0x12')]);return _0x61128a(_0x107df4[_0x2860('0x11')][_0x2860('0x12')]);}logger['error'](_0x2860('0xc'),_0x3fb302,_0x107df4['error']['message']);return _0x9c8259(_0x107df4[_0x2860('0x11')][_0x2860('0x12')]);}else{logger[_0x2860('0xb')]('MailServerOut,\x20%s,\x20%s',_0x3fb302,_0x2860('0xd'));_0x9c8259(_0x107df4[_0x2860('0x13')]['message']);}})['catch'](function(_0x4cddb1){logger[_0x2860('0x11')](_0x2860('0xc'),_0x3fb302,_0x4cddb1);_0x61128a(_0x4cddb1);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 2f49a7f..35bf450 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 _0xb3bb=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','delete','destroy','exports','util','path'];(function(_0x44f5e3,_0x580ec0){var _0x581ea9=function(_0x5e1640){while(--_0x5e1640){_0x44f5e3['push'](_0x44f5e3['shift']());}};_0x581ea9(++_0x580ec0);}(_0xb3bb,0x142));var _0xbb3b=function(_0x227187,_0x5e0666){_0x227187=_0x227187-0x0;var _0x16ebf4=_0xb3bb[_0x227187];return _0x16ebf4;};'use strict';var multer=require('multer');var util=require(_0xbb3b('0x0'));var path=require(_0xbb3b('0x1'));var timeout=require(_0xbb3b('0x2'));var express=require(_0xbb3b('0x3'));var router=express[_0xbb3b('0x4')]();var auth=require(_0xbb3b('0x5'));var interaction=require(_0xbb3b('0x6'));var config=require(_0xbb3b('0x7'));var controller=require(_0xbb3b('0x8'));router[_0xbb3b('0x9')]('/',auth[_0xbb3b('0xa')](),controller['index']);router['get'](_0xbb3b('0xb'),auth[_0xbb3b('0xa')](),controller[_0xbb3b('0xc')]);router['get'](_0xbb3b('0xd'),auth[_0xbb3b('0xa')](),controller[_0xbb3b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbb3b('0xd'),auth[_0xbb3b('0xa')](),controller['update']);router[_0xbb3b('0xf')](_0xbb3b('0xd'),auth[_0xbb3b('0xa')](),controller[_0xbb3b('0x10')]);module[_0xbb3b('0x11')]=router; \ No newline at end of file +var _0x48f5=['exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x2d892a,_0x59e61a){var _0x367765=function(_0x1c9901){while(--_0x1c9901){_0x2d892a['push'](_0x2d892a['shift']());}};_0x367765(++_0x59e61a);}(_0x48f5,0x79));var _0x548f=function(_0x1bee3a,_0x2f6a68){_0x1bee3a=_0x1bee3a-0x0;var _0x323f7a=_0x48f5[_0x1bee3a];return _0x323f7a;};'use strict';var multer=require(_0x548f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x548f('0x1'));var express=require(_0x548f('0x2'));var router=express[_0x548f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x548f('0x4'));var config=require(_0x548f('0x5'));var controller=require(_0x548f('0x6'));router['get']('/',auth[_0x548f('0x7')](),controller[_0x548f('0x8')]);router[_0x548f('0x9')]('/describe',auth[_0x548f('0x7')](),controller[_0x548f('0xa')]);router['get'](_0x548f('0xb'),auth[_0x548f('0x7')](),controller[_0x548f('0xc')]);router[_0x548f('0xd')]('/',auth[_0x548f('0x7')](),controller[_0x548f('0xe')]);router[_0x548f('0xf')](_0x548f('0xb'),auth[_0x548f('0x7')](),controller[_0x548f('0x10')]);router[_0x548f('0x11')](_0x548f('0xb'),auth[_0x548f('0x7')](),controller[_0x548f('0x12')]);module[_0x548f('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index f15225f..c305da3 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 _0x0324=['exports','STRING','name'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0324,0x90));var _0x4032=function(_0x3233de,_0x34415c){_0x3233de=_0x3233de-0x0;var _0x24e46b=_0x0324[_0x3233de];return _0x24e46b;};'use strict';var Sequelize=require('sequelize');module[_0x4032('0x0')]={'name':{'type':Sequelize[_0x4032('0x1')],'unique':_0x4032('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4032('0x1')]}}; \ No newline at end of file +var _0x1751=['STRING','name','sequelize','exports'];(function(_0x7290bf,_0x10acee){var _0x1027b6=function(_0x4a7324){while(--_0x4a7324){_0x7290bf['push'](_0x7290bf['shift']());}};_0x1027b6(++_0x10acee);}(_0x1751,0x76));var _0x1175=function(_0x145adf,_0x244f59){_0x145adf=_0x145adf-0x0;var _0x5d45a8=_0x1751[_0x145adf];return _0x5d45a8;};'use strict';var Sequelize=require(_0x1175('0x0'));module[_0x1175('0x1')]={'name':{'type':Sequelize[_0x1175('0x2')],'unique':_0x1175('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 16dd6df..6c13b93 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 _0xe4ed=['include','findAll','rows','catch','params','length','includeAll','create','body','update','describe','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','MailSubstatus'];(function(_0x320e94,_0x4140b1){var _0x1002be=function(_0x3244e2){while(--_0x3244e2){_0x320e94['push'](_0x320e94['shift']());}};_0x1002be(++_0x4140b1);}(_0xe4ed,0x187));var _0xde4e=function(_0x233e57,_0x4a7ae2){_0x233e57=_0x233e57-0x0;var _0x463c2c=_0xe4ed[_0x233e57];return _0x463c2c;};'use strict';var pdf=require(_0xde4e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xde4e('0x1'));var jsonpatch=require(_0xde4e('0x2'));var rp=require(_0xde4e('0x3'));var moment=require('moment');var BPromise=require(_0xde4e('0x4'));var Mustache=require(_0xde4e('0x5'));var util=require(_0xde4e('0x6'));var path=require(_0xde4e('0x7'));var sox=require(_0xde4e('0x8'));var csv=require('to-csv');var ejs=require(_0xde4e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xde4e('0xa'));var crypto=require('crypto');var jsforce=require(_0xde4e('0xb'));var deskjs=require(_0xde4e('0xc'));var toCsv=require(_0xde4e('0xd'));var querystring=require(_0xde4e('0xe'));var Papa=require(_0xde4e('0xf'));var Redis=require(_0xde4e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xde4e('0x11'));var as=require(_0xde4e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde4e('0x13'))(_0xde4e('0x14'));var utils=require(_0xde4e('0x15'));var config=require(_0xde4e('0x16'));var licenseUtil=require(_0xde4e('0x17'));var db=require(_0xde4e('0x18'))['db'];function respondWithStatusCode(_0x56ecac,_0x2a9f81){_0x2a9f81=_0x2a9f81||0xcc;return function(_0x26cc14){if(_0x26cc14){return _0x56ecac['sendStatus'](_0x2a9f81);}return _0x56ecac[_0xde4e('0x19')](_0x2a9f81)[_0xde4e('0x1a')]();};}function respondWithResult(_0x384c26,_0x2a8611){_0x2a8611=_0x2a8611||0xc8;return function(_0x1129a7){if(_0x1129a7){return _0x384c26[_0xde4e('0x19')](_0x2a8611)[_0xde4e('0x1b')](_0x1129a7);}};}function respondWithFilteredResult(_0x12588e,_0x616df9){return function(_0x5f0ca8){if(_0x5f0ca8){var _0x111989=_0x5f0ca8[_0xde4e('0x1c')],_0xec92f5=_0x616df9[_0xde4e('0x1d')],_0x42ad90=_0x616df9[_0xde4e('0x1d')]+_0x616df9['limit'],_0x2d953d;if(_0x42ad90>=_0x111989){_0x42ad90=_0x111989;_0x2d953d=0xc8;}else{_0x2d953d=0xce;}_0x12588e[_0xde4e('0x19')](_0x2d953d);return _0x12588e['set'](_0xde4e('0x1e'),_0xec92f5+'-'+_0x42ad90+'/'+_0x111989)['json'](_0x5f0ca8);}return null;};}function patchUpdates(_0x538c4a){return function(_0x1cde7d){try{jsonpatch[_0xde4e('0x1f')](_0x1cde7d,_0x538c4a,!![]);}catch(_0xcd945b){return BPromise[_0xde4e('0x20')](_0xcd945b);}return _0x1cde7d[_0xde4e('0x21')]();};}function saveUpdates(_0xffe4a0,_0x325000){return function(_0x4c6d15){if(_0x4c6d15){return _0x4c6d15['update'](_0xffe4a0)['then'](function(_0x11a665){return _0x11a665;});}return null;};}function removeEntity(_0x199cbb,_0x54c9a3){return function(_0xfc9d42){if(_0xfc9d42){return _0xfc9d42[_0xde4e('0x22')]()[_0xde4e('0x23')](function(){_0x199cbb[_0xde4e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3449f2,_0xe83de1){return function(_0x5d3a44){if(!_0x5d3a44){_0x3449f2[_0xde4e('0x24')](0x194);}return _0x5d3a44;};}function handleError(_0x1ce6bc,_0x3f7a54){_0x3f7a54=_0x3f7a54||0x1f4;return function(_0x54d4f5){logger[_0xde4e('0x25')](_0x54d4f5[_0xde4e('0x26')]);if(_0x54d4f5[_0xde4e('0x27')]){delete _0x54d4f5[_0xde4e('0x27')];}_0x1ce6bc[_0xde4e('0x19')](_0x3f7a54)[_0xde4e('0x28')](_0x54d4f5);};}exports[_0xde4e('0x29')]=function(_0x17ed59,_0x14c7f8){var _0x1bddef={},_0x3fdd44={},_0x56283b={'count':0x0,'rows':[]};var _0x340a02=_[_0xde4e('0x2a')](db['MailSubstatus'][_0xde4e('0x2b')],function(_0x1f7026){return{'name':_0x1f7026[_0xde4e('0x2c')],'type':_0x1f7026[_0xde4e('0x2d')]['key']};});_0x3fdd44[_0xde4e('0x2e')]=_['map'](_0x340a02,_0xde4e('0x27'));_0x3fdd44['query']=_[_0xde4e('0x2f')](_0x17ed59['query']);_0x3fdd44[_0xde4e('0x30')]=_[_0xde4e('0x31')](_0x3fdd44[_0xde4e('0x2e')],_0x3fdd44[_0xde4e('0x32')]);_0x1bddef['attributes']=_[_0xde4e('0x31')](_0x3fdd44[_0xde4e('0x2e')],qs[_0xde4e('0x33')](_0x17ed59['query']['fields']));_0x1bddef['attributes']=_0x1bddef['attributes']['length']?_0x1bddef[_0xde4e('0x34')]:_0x3fdd44[_0xde4e('0x2e')];if(!_0x17ed59[_0xde4e('0x32')][_0xde4e('0x35')](_0xde4e('0x36'))){_0x1bddef[_0xde4e('0x37')]=qs[_0xde4e('0x37')](_0x17ed59['query']['limit']);_0x1bddef[_0xde4e('0x1d')]=qs[_0xde4e('0x1d')](_0x17ed59[_0xde4e('0x32')][_0xde4e('0x1d')]);}_0x1bddef[_0xde4e('0x38')]=qs[_0xde4e('0x39')](_0x17ed59[_0xde4e('0x32')]['sort']);_0x1bddef[_0xde4e('0x3a')]=qs[_0xde4e('0x30')](_[_0xde4e('0x3b')](_0x17ed59[_0xde4e('0x32')],_0x3fdd44[_0xde4e('0x30')]),_0x340a02);if(_0x17ed59['query']['filter']){_0x1bddef[_0xde4e('0x3a')]=_[_0xde4e('0x3c')](_0x1bddef['where'],{'$or':_[_0xde4e('0x2a')](_0x340a02,function(_0x1c9439){if(_0x1c9439[_0xde4e('0x2d')]!==_0xde4e('0x3d')){var _0x10de22={};_0x10de22[_0x1c9439[_0xde4e('0x27')]]={'$like':'%'+_0x17ed59[_0xde4e('0x32')][_0xde4e('0x3e')]+'%'};return _0x10de22;}})});}_0x1bddef=_[_0xde4e('0x3c')]({},_0x1bddef,_0x17ed59[_0xde4e('0x3f')]);var _0x2a7cd0={'where':_0x1bddef[_0xde4e('0x3a')]};return db[_0xde4e('0x40')][_0xde4e('0x1c')](_0x2a7cd0)['then'](function(_0x54baf9){_0x56283b['count']=_0x54baf9;if(_0x17ed59[_0xde4e('0x32')]['includeAll']){_0x1bddef[_0xde4e('0x41')]=[{'all':!![]}];}return db[_0xde4e('0x40')][_0xde4e('0x42')](_0x1bddef);})['then'](function(_0x2858f8){_0x56283b[_0xde4e('0x43')]=_0x2858f8;return _0x56283b;})['then'](respondWithFilteredResult(_0x14c7f8,_0x1bddef))[_0xde4e('0x44')](handleError(_0x14c7f8,null));};exports['show']=function(_0x415b71,_0x13a3b0){var _0x1c1770={'raw':!![],'where':{'id':_0x415b71[_0xde4e('0x45')]['id']}},_0x57abeb={};_0x57abeb['model']=_[_0xde4e('0x2f')](db['MailSubstatus'][_0xde4e('0x2b')]);_0x57abeb['query']=_[_0xde4e('0x2f')](_0x415b71[_0xde4e('0x32')]);_0x57abeb[_0xde4e('0x30')]=_[_0xde4e('0x31')](_0x57abeb[_0xde4e('0x2e')],_0x57abeb[_0xde4e('0x32')]);_0x1c1770[_0xde4e('0x34')]=_[_0xde4e('0x31')](_0x57abeb[_0xde4e('0x2e')],qs[_0xde4e('0x33')](_0x415b71['query']['fields']));_0x1c1770[_0xde4e('0x34')]=_0x1c1770[_0xde4e('0x34')][_0xde4e('0x46')]?_0x1c1770[_0xde4e('0x34')]:_0x57abeb['model'];if(_0x415b71[_0xde4e('0x32')][_0xde4e('0x47')]){_0x1c1770['include']=[{'all':!![]}];}_0x1c1770=_[_0xde4e('0x3c')]({},_0x1c1770,_0x415b71[_0xde4e('0x3f')]);return db['MailSubstatus']['find'](_0x1c1770)['then'](handleEntityNotFound(_0x13a3b0,null))[_0xde4e('0x23')](respondWithResult(_0x13a3b0,null))[_0xde4e('0x44')](handleError(_0x13a3b0,null));};exports[_0xde4e('0x48')]=function(_0x47ead4,_0x30af8b){return db[_0xde4e('0x40')][_0xde4e('0x48')](_0x47ead4[_0xde4e('0x49')],{})['then'](respondWithResult(_0x30af8b,0xc9))[_0xde4e('0x44')](handleError(_0x30af8b,null));};exports[_0xde4e('0x4a')]=function(_0xf549dd,_0x353ab5){if(_0xf549dd['body']['id']){delete _0xf549dd[_0xde4e('0x49')]['id'];}return db[_0xde4e('0x40')]['find']({'where':{'id':_0xf549dd[_0xde4e('0x45')]['id']}})['then'](handleEntityNotFound(_0x353ab5,null))['then'](saveUpdates(_0xf549dd[_0xde4e('0x49')],null))['then'](respondWithResult(_0x353ab5,null))[_0xde4e('0x44')](handleError(_0x353ab5,null));};exports['destroy']=function(_0x43d693,_0x289a43){return db[_0xde4e('0x40')]['find']({'where':{'id':_0x43d693[_0xde4e('0x45')]['id']}})[_0xde4e('0x23')](handleEntityNotFound(_0x289a43,null))[_0xde4e('0x23')](removeEntity(_0x289a43,null))[_0xde4e('0x44')](handleError(_0x289a43,null));};exports[_0xde4e('0x4b')]=function(_0x4be2a8,_0x451fc3){return db[_0xde4e('0x40')][_0xde4e('0x4b')]()['then'](respondWithResult(_0x451fc3,null))[_0xde4e('0x44')](handleError(_0x451fc3,null));}; \ No newline at end of file +var _0x69d9=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','end','status','offset','set','json','apply','reject','update','destroy','then','sendStatus','name','send','index','map','MailSubstatus','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0x3e777a,_0x574fe9){var _0x10e4f8=function(_0x4343ff){while(--_0x4343ff){_0x3e777a['push'](_0x3e777a['shift']());}};_0x10e4f8(++_0x574fe9);}(_0x69d9,0x7f));var _0x969d=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0x69d9[_0x23f8c8];return _0x3dc718;};'use strict';var pdf=require(_0x969d('0x0'));var emlformat=require(_0x969d('0x1'));var rimraf=require(_0x969d('0x2'));var zipdir=require(_0x969d('0x3'));var jsonpatch=require(_0x969d('0x4'));var rp=require(_0x969d('0x5'));var moment=require('moment');var BPromise=require(_0x969d('0x6'));var Mustache=require('mustache');var util=require(_0x969d('0x7'));var path=require(_0x969d('0x8'));var sox=require(_0x969d('0x9'));var csv=require(_0x969d('0xa'));var ejs=require(_0x969d('0xb'));var fs=require('fs');var _=require(_0x969d('0xc'));var squel=require(_0x969d('0xd'));var crypto=require('crypto');var jsforce=require(_0x969d('0xe'));var deskjs=require(_0x969d('0xf'));var toCsv=require(_0x969d('0xa'));var querystring=require(_0x969d('0x10'));var Papa=require(_0x969d('0x11'));var Redis=require('ioredis');var authService=require(_0x969d('0x12'));var qs=require(_0x969d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x969d('0x14'));var logger=require(_0x969d('0x15'))(_0x969d('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x969d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5752cd,_0x4b522){_0x4b522=_0x4b522||0xcc;return function(_0x1765a6){if(_0x1765a6){return _0x5752cd['sendStatus'](_0x4b522);}return _0x5752cd['status'](_0x4b522)[_0x969d('0x18')]();};}function respondWithResult(_0x47a3a2,_0xd4199f){_0xd4199f=_0xd4199f||0xc8;return function(_0x3ca153){if(_0x3ca153){return _0x47a3a2[_0x969d('0x19')](_0xd4199f)['json'](_0x3ca153);}};}function respondWithFilteredResult(_0x4d9868,_0x5a6131){return function(_0x3fc8d4){if(_0x3fc8d4){var _0x19c1ac=_0x3fc8d4['count'],_0x532993=_0x5a6131['offset'],_0x4c9e7c=_0x5a6131[_0x969d('0x1a')]+_0x5a6131['limit'],_0xd21a37;if(_0x4c9e7c>=_0x19c1ac){_0x4c9e7c=_0x19c1ac;_0xd21a37=0xc8;}else{_0xd21a37=0xce;}_0x4d9868[_0x969d('0x19')](_0xd21a37);return _0x4d9868[_0x969d('0x1b')]('Content-Range',_0x532993+'-'+_0x4c9e7c+'/'+_0x19c1ac)[_0x969d('0x1c')](_0x3fc8d4);}return null;};}function patchUpdates(_0x2b1961){return function(_0x317c17){try{jsonpatch[_0x969d('0x1d')](_0x317c17,_0x2b1961,!![]);}catch(_0x48c232){return BPromise[_0x969d('0x1e')](_0x48c232);}return _0x317c17['save']();};}function saveUpdates(_0x5afee1,_0x2d00b7){return function(_0x5cc54f){if(_0x5cc54f){return _0x5cc54f[_0x969d('0x1f')](_0x5afee1)['then'](function(_0x5349a3){return _0x5349a3;});}return null;};}function removeEntity(_0x2f124b,_0x446819){return function(_0xbae893){if(_0xbae893){return _0xbae893[_0x969d('0x20')]()[_0x969d('0x21')](function(){_0x2f124b['status'](0xcc)[_0x969d('0x18')]();});}};}function handleEntityNotFound(_0x4e17f1,_0x12da27){return function(_0x5333e5){if(!_0x5333e5){_0x4e17f1[_0x969d('0x22')](0x194);}return _0x5333e5;};}function handleError(_0x1e48af,_0x7d4259){_0x7d4259=_0x7d4259||0x1f4;return function(_0x291fbb){logger['error'](_0x291fbb['stack']);if(_0x291fbb[_0x969d('0x23')]){delete _0x291fbb[_0x969d('0x23')];}_0x1e48af[_0x969d('0x19')](_0x7d4259)[_0x969d('0x24')](_0x291fbb);};}exports[_0x969d('0x25')]=function(_0x34f31e,_0x48861d){var _0x30fa54={},_0x18dd45={},_0x46b70b={'count':0x0,'rows':[]};var _0x1d706e=_[_0x969d('0x26')](db[_0x969d('0x27')]['rawAttributes'],function(_0x523489){return{'name':_0x523489['fieldName'],'type':_0x523489['type']['key']};});_0x18dd45[_0x969d('0x28')]=_['map'](_0x1d706e,_0x969d('0x23'));_0x18dd45[_0x969d('0x29')]=_[_0x969d('0x2a')](_0x34f31e['query']);_0x18dd45[_0x969d('0x2b')]=_[_0x969d('0x2c')](_0x18dd45['model'],_0x18dd45[_0x969d('0x29')]);_0x30fa54[_0x969d('0x2d')]=_[_0x969d('0x2c')](_0x18dd45['model'],qs[_0x969d('0x2e')](_0x34f31e[_0x969d('0x29')]['fields']));_0x30fa54[_0x969d('0x2d')]=_0x30fa54[_0x969d('0x2d')][_0x969d('0x2f')]?_0x30fa54['attributes']:_0x18dd45[_0x969d('0x28')];if(!_0x34f31e[_0x969d('0x29')][_0x969d('0x30')]('nolimit')){_0x30fa54[_0x969d('0x31')]=qs[_0x969d('0x31')](_0x34f31e[_0x969d('0x29')][_0x969d('0x31')]);_0x30fa54[_0x969d('0x1a')]=qs[_0x969d('0x1a')](_0x34f31e[_0x969d('0x29')][_0x969d('0x1a')]);}_0x30fa54[_0x969d('0x32')]=qs['sort'](_0x34f31e[_0x969d('0x29')][_0x969d('0x33')]);_0x30fa54[_0x969d('0x34')]=qs['filters'](_[_0x969d('0x35')](_0x34f31e[_0x969d('0x29')],_0x18dd45[_0x969d('0x2b')]),_0x1d706e);if(_0x34f31e[_0x969d('0x29')][_0x969d('0x36')]){_0x30fa54[_0x969d('0x34')]=_['merge'](_0x30fa54[_0x969d('0x34')],{'$or':_[_0x969d('0x26')](_0x1d706e,function(_0x48b794){if(_0x48b794[_0x969d('0x37')]!==_0x969d('0x38')){var _0x3fe052={};_0x3fe052[_0x48b794['name']]={'$like':'%'+_0x34f31e[_0x969d('0x29')][_0x969d('0x36')]+'%'};return _0x3fe052;}})});}_0x30fa54=_[_0x969d('0x39')]({},_0x30fa54,_0x34f31e[_0x969d('0x3a')]);var _0x17878b={'where':_0x30fa54['where']};return db[_0x969d('0x27')][_0x969d('0x3b')](_0x17878b)[_0x969d('0x21')](function(_0xe971f4){_0x46b70b[_0x969d('0x3b')]=_0xe971f4;if(_0x34f31e[_0x969d('0x29')][_0x969d('0x3c')]){_0x30fa54[_0x969d('0x3d')]=[{'all':!![]}];}return db[_0x969d('0x27')][_0x969d('0x3e')](_0x30fa54);})[_0x969d('0x21')](function(_0x36198e){_0x46b70b[_0x969d('0x3f')]=_0x36198e;return _0x46b70b;})[_0x969d('0x21')](respondWithFilteredResult(_0x48861d,_0x30fa54))[_0x969d('0x40')](handleError(_0x48861d,null));};exports[_0x969d('0x41')]=function(_0x472451,_0x2214f8){var _0xfae046={'raw':!![],'where':{'id':_0x472451['params']['id']}},_0x580a5d={};_0x580a5d[_0x969d('0x28')]=_[_0x969d('0x2a')](db[_0x969d('0x27')][_0x969d('0x42')]);_0x580a5d[_0x969d('0x29')]=_['keys'](_0x472451[_0x969d('0x29')]);_0x580a5d[_0x969d('0x2b')]=_[_0x969d('0x2c')](_0x580a5d['model'],_0x580a5d[_0x969d('0x29')]);_0xfae046[_0x969d('0x2d')]=_[_0x969d('0x2c')](_0x580a5d[_0x969d('0x28')],qs['fields'](_0x472451['query'][_0x969d('0x2e')]));_0xfae046[_0x969d('0x2d')]=_0xfae046['attributes'][_0x969d('0x2f')]?_0xfae046[_0x969d('0x2d')]:_0x580a5d[_0x969d('0x28')];if(_0x472451[_0x969d('0x29')]['includeAll']){_0xfae046['include']=[{'all':!![]}];}_0xfae046=_['merge']({},_0xfae046,_0x472451['options']);return db[_0x969d('0x27')][_0x969d('0x43')](_0xfae046)['then'](handleEntityNotFound(_0x2214f8,null))['then'](respondWithResult(_0x2214f8,null))[_0x969d('0x40')](handleError(_0x2214f8,null));};exports[_0x969d('0x44')]=function(_0x8b88a3,_0x19f3b2){return db[_0x969d('0x27')]['create'](_0x8b88a3[_0x969d('0x45')],{})[_0x969d('0x21')](respondWithResult(_0x19f3b2,0xc9))[_0x969d('0x40')](handleError(_0x19f3b2,null));};exports[_0x969d('0x1f')]=function(_0x5198c0,_0xcdf849){if(_0x5198c0[_0x969d('0x45')]['id']){delete _0x5198c0['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x5198c0['params']['id']}})[_0x969d('0x21')](handleEntityNotFound(_0xcdf849,null))['then'](saveUpdates(_0x5198c0['body'],null))['then'](respondWithResult(_0xcdf849,null))[_0x969d('0x40')](handleError(_0xcdf849,null));};exports[_0x969d('0x20')]=function(_0x261b68,_0x1ebde9){return db[_0x969d('0x27')][_0x969d('0x43')]({'where':{'id':_0x261b68[_0x969d('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ebde9,null))['then'](removeEntity(_0x1ebde9,null))['catch'](handleError(_0x1ebde9,null));};exports[_0x969d('0x47')]=function(_0x3b253e,_0x1b21e8){return db['MailSubstatus'][_0x969d('0x47')]()[_0x969d('0x21')](respondWithResult(_0x1b21e8,null))[_0x969d('0x40')](handleError(_0x1b21e8,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 03f5276..23309f0 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 _0x73a1=['mail_substatuses','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailSubstatus'];(function(_0x223409,_0x25af64){var _0x31fa8d=function(_0x2ab57d){while(--_0x2ab57d){_0x223409['push'](_0x223409['shift']());}};_0x31fa8d(++_0x25af64);}(_0x73a1,0x161));var _0x173a=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0x73a1[_0x44f974];return _0x805dbd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x173a('0x0'))(_0x173a('0x1'));var moment=require('moment');var BPromise=require(_0x173a('0x2'));var rp=require(_0x173a('0x3'));var fs=require('fs');var path=require(_0x173a('0x4'));var rimraf=require(_0x173a('0x5'));var config=require(_0x173a('0x6'));var attributes=require('./mailSubstatus.attributes');module[_0x173a('0x7')]=function(_0x1a8b94,_0xac84a){return _0x1a8b94[_0x173a('0x8')](_0x173a('0x9'),attributes,{'tableName':_0x173a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','MailSubstatus','mail_substatuses','util','api','moment'];(function(_0x5c7386,_0x460402){var _0x38e7cc=function(_0x15119b){while(--_0x15119b){_0x5c7386['push'](_0x5c7386['shift']());}};_0x38e7cc(++_0x460402);}(_0xadb5,0xad));var _0x5adb=function(_0xb640c5,_0x2e3f74){_0xb640c5=_0xb640c5-0x0;var _0x25b5ce=_0xadb5[_0xb640c5];return _0x25b5ce;};'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('./mailSubstatus.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'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 99ea720..1007277 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 _0x0a9a=['MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x343090,_0x433a80){var _0x3ff3e8=function(_0x16c811){while(--_0x16c811){_0x343090['push'](_0x343090['shift']());}};_0x3ff3e8(++_0x433a80);}(_0x0a9a,0x183));var _0xa0a9=function(_0x279e5f,_0x467a82){_0x279e5f=_0x279e5f-0x0;var _0x5399ec=_0x0a9a[_0x279e5f];return _0x5399ec;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x12d2c1,_0x1da205){var _0x15bc1f=function(_0x1743b9){while(--_0x1743b9){_0x12d2c1['push'](_0x12d2c1['shift']());}};_0x15bc1f(++_0x1da205);}(_0xe706,0xa3));var _0x6e70=function(_0x26f4a4,_0xeb0dc6){_0x26f4a4=_0x26f4a4-0x0;var _0x437404=_0xe706[_0x26f4a4];return _0x437404;};'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']('MailSubstatus,\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']('MailSubstatus,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index ccf6620..32d7bec 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 _0x46e8=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x11ce39,_0x3ac6a0){var _0x426a41=function(_0x855944){while(--_0x855944){_0x11ce39['push'](_0x11ce39['shift']());}};_0x426a41(++_0x3ac6a0);}(_0x46e8,0x88));var _0x846e=function(_0xc72193,_0x25626a){_0xc72193=_0xc72193-0x0;var _0x5f48b2=_0x46e8[_0xc72193];return _0x5f48b2;};'use strict';var multer=require(_0x846e('0x0'));var util=require(_0x846e('0x1'));var path=require('path');var timeout=require(_0x846e('0x2'));var express=require(_0x846e('0x3'));var router=express['Router']();var auth=require(_0x846e('0x4'));var interaction=require(_0x846e('0x5'));var config=require(_0x846e('0x6'));var controller=require('./mailTransferReport.controller');router[_0x846e('0x7')]('/',auth[_0x846e('0x8')](),controller[_0x846e('0x9')]);router[_0x846e('0x7')](_0x846e('0xa'),auth[_0x846e('0x8')](),controller['describe']);router[_0x846e('0x7')]('/:id',auth[_0x846e('0x8')](),controller[_0x846e('0xb')]);router[_0x846e('0xc')]('/',auth[_0x846e('0x8')](),controller[_0x846e('0xd')]);router[_0x846e('0xe')](_0x846e('0xf'),auth[_0x846e('0x8')](),controller[_0x846e('0x10')]);router[_0x846e('0x11')](_0x846e('0xf'),auth[_0x846e('0x8')](),controller[_0x846e('0x12')]);module[_0x846e('0x13')]=router; \ No newline at end of file +var _0x4f38=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','create'];(function(_0x2575fd,_0x2e6a15){var _0x503674=function(_0x154bcd){while(--_0x154bcd){_0x2575fd['push'](_0x2575fd['shift']());}};_0x503674(++_0x2e6a15);}(_0x4f38,0x1d2));var _0x84f3=function(_0x41b3b2,_0x310d57){_0x41b3b2=_0x41b3b2-0x0;var _0x4bdc83=_0x4f38[_0x41b3b2];return _0x4bdc83;};'use strict';var multer=require(_0x84f3('0x0'));var util=require(_0x84f3('0x1'));var path=require(_0x84f3('0x2'));var timeout=require(_0x84f3('0x3'));var express=require(_0x84f3('0x4'));var router=express[_0x84f3('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x84f3('0x6'));var config=require(_0x84f3('0x7'));var controller=require(_0x84f3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x84f3('0x9')]);router[_0x84f3('0xa')](_0x84f3('0xb'),auth[_0x84f3('0xc')](),controller[_0x84f3('0xd')]);router['get'](_0x84f3('0xe'),auth[_0x84f3('0xc')](),controller[_0x84f3('0xf')]);router['post']('/',auth[_0x84f3('0xc')](),controller[_0x84f3('0x10')]);router[_0x84f3('0x11')](_0x84f3('0xe'),auth[_0x84f3('0xc')](),controller[_0x84f3('0x12')]);router[_0x84f3('0x13')]('/:id',auth[_0x84f3('0xc')](),controller['destroy']);module[_0x84f3('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index a86e3bb..faf29d6 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 _0x3fdf=['ENUM','account','agent','queue','NOW','moment','exports'];(function(_0x148c62,_0x10c795){var _0x4b7f8e=function(_0x27f649){while(--_0x27f649){_0x148c62['push'](_0x148c62['shift']());}};_0x4b7f8e(++_0x10c795);}(_0x3fdf,0x75));var _0xf3fd=function(_0x1f5ffd,_0x3bc33c){_0x1f5ffd=_0x1f5ffd-0x0;var _0x4f5695=_0x3fdf[_0x1f5ffd];return _0x4f5695;};'use strict';var moment=require(_0xf3fd('0x0'));var Sequelize=require('sequelize');module[_0xf3fd('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf3fd('0x2')](_0xf3fd('0x3'),_0xf3fd('0x4'),_0xf3fd('0x5')),'allowNull':![],'defaultValue':_0xf3fd('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf3fd('0x6')]}}; \ No newline at end of file +var _0xb818=['ENUM','account','queue','moment','sequelize','exports','STRING'];(function(_0x16730f,_0xcee12e){var _0x1998a9=function(_0x34044d){while(--_0x34044d){_0x16730f['push'](_0x16730f['shift']());}};_0x1998a9(++_0xcee12e);}(_0xb818,0xf8));var _0x8b81=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xb818[_0x5f0089];return _0x193892;};'use strict';var moment=require(_0x8b81('0x0'));var Sequelize=require(_0x8b81('0x1'));module[_0x8b81('0x2')]={'uniqueid':{'type':Sequelize[_0x8b81('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8b81('0x4')](_0x8b81('0x5'),'agent',_0x8b81('0x6')),'allowNull':![],'defaultValue':_0x8b81('0x6')},'transferredAt':{'type':Sequelize['DATE'],'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 20b2734..cdd44b8 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 _0x8900=['../../config/license/util','../../mysqldb','sendStatus','end','offset','status','set','Content-Range','save','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','fields','create','body','update','find','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x83a327,_0x53f000){var _0x54ca98=function(_0x3a43ed){while(--_0x3a43ed){_0x83a327['push'](_0x83a327['shift']());}};_0x54ca98(++_0x53f000);}(_0x8900,0x161));var _0x0890=function(_0x1bd04e,_0x6281bd){_0x1bd04e=_0x1bd04e-0x0;var _0x4d6ea0=_0x8900[_0x1bd04e];return _0x4d6ea0;};'use strict';var pdf=require(_0x0890('0x0'));var emlformat=require(_0x0890('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0890('0x2'));var jsonpatch=require(_0x0890('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0890('0x4'));var Mustache=require(_0x0890('0x5'));var util=require(_0x0890('0x6'));var path=require(_0x0890('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0890('0x8'));var squel=require(_0x0890('0x9'));var crypto=require(_0x0890('0xa'));var jsforce=require(_0x0890('0xb'));var deskjs=require(_0x0890('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0890('0xd'));var Papa=require(_0x0890('0xe'));var Redis=require(_0x0890('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0890('0x10'));var as=require(_0x0890('0x11'));var hardwareService=require(_0x0890('0x12'));var logger=require(_0x0890('0x13'))(_0x0890('0x14'));var utils=require('../../config/utils');var config=require(_0x0890('0x15'));var licenseUtil=require(_0x0890('0x16'));var db=require(_0x0890('0x17'))['db'];function respondWithStatusCode(_0x128c2d,_0x13b514){_0x13b514=_0x13b514||0xcc;return function(_0x51c6fc){if(_0x51c6fc){return _0x128c2d[_0x0890('0x18')](_0x13b514);}return _0x128c2d['status'](_0x13b514)[_0x0890('0x19')]();};}function respondWithResult(_0x1f7f2d,_0x11865b){_0x11865b=_0x11865b||0xc8;return function(_0x5e3855){if(_0x5e3855){return _0x1f7f2d['status'](_0x11865b)['json'](_0x5e3855);}};}function respondWithFilteredResult(_0x47cab2,_0x34c5ae){return function(_0x357bb1){if(_0x357bb1){var _0x3494a9=_0x357bb1['count'],_0x2c38d5=_0x34c5ae[_0x0890('0x1a')],_0x1437b9=_0x34c5ae[_0x0890('0x1a')]+_0x34c5ae['limit'],_0x26222c;if(_0x1437b9>=_0x3494a9){_0x1437b9=_0x3494a9;_0x26222c=0xc8;}else{_0x26222c=0xce;}_0x47cab2[_0x0890('0x1b')](_0x26222c);return _0x47cab2[_0x0890('0x1c')](_0x0890('0x1d'),_0x2c38d5+'-'+_0x1437b9+'/'+_0x3494a9)['json'](_0x357bb1);}return null;};}function patchUpdates(_0x29005c){return function(_0x243dfa){try{jsonpatch['apply'](_0x243dfa,_0x29005c,!![]);}catch(_0x29b782){return BPromise['reject'](_0x29b782);}return _0x243dfa[_0x0890('0x1e')]();};}function saveUpdates(_0x278e31,_0x1e382a){return function(_0x58ff05){if(_0x58ff05){return _0x58ff05['update'](_0x278e31)['then'](function(_0x4f8c37){return _0x4f8c37;});}return null;};}function removeEntity(_0x3d1593,_0x10be18){return function(_0x47ab16){if(_0x47ab16){return _0x47ab16['destroy']()['then'](function(){_0x3d1593[_0x0890('0x1b')](0xcc)[_0x0890('0x19')]();});}};}function handleEntityNotFound(_0x1cd02b,_0xf5bcf4){return function(_0xc1fdbe){if(!_0xc1fdbe){_0x1cd02b[_0x0890('0x18')](0x194);}return _0xc1fdbe;};}function handleError(_0x24dc49,_0x22d7d5){_0x22d7d5=_0x22d7d5||0x1f4;return function(_0x1a4fe0){logger[_0x0890('0x1f')](_0x1a4fe0[_0x0890('0x20')]);if(_0x1a4fe0[_0x0890('0x21')]){delete _0x1a4fe0[_0x0890('0x21')];}_0x24dc49['status'](_0x22d7d5)[_0x0890('0x22')](_0x1a4fe0);};}exports[_0x0890('0x23')]=function(_0x5d71cc,_0x31b51e){var _0x42b7ae={},_0x20ca41={},_0x2ab7e6={'count':0x0,'rows':[]};var _0x5cce8a=_[_0x0890('0x24')](db[_0x0890('0x25')][_0x0890('0x26')],function(_0x3cd487){return{'name':_0x3cd487[_0x0890('0x27')],'type':_0x3cd487['type'][_0x0890('0x28')]};});_0x20ca41['model']=_[_0x0890('0x24')](_0x5cce8a,_0x0890('0x21'));_0x20ca41[_0x0890('0x29')]=_[_0x0890('0x2a')](_0x5d71cc['query']);_0x20ca41[_0x0890('0x2b')]=_[_0x0890('0x2c')](_0x20ca41[_0x0890('0x2d')],_0x20ca41[_0x0890('0x29')]);_0x42b7ae[_0x0890('0x2e')]=_[_0x0890('0x2c')](_0x20ca41[_0x0890('0x2d')],qs['fields'](_0x5d71cc[_0x0890('0x29')]['fields']));_0x42b7ae['attributes']=_0x42b7ae[_0x0890('0x2e')][_0x0890('0x2f')]?_0x42b7ae[_0x0890('0x2e')]:_0x20ca41[_0x0890('0x2d')];if(!_0x5d71cc[_0x0890('0x29')][_0x0890('0x30')](_0x0890('0x31'))){_0x42b7ae[_0x0890('0x32')]=qs[_0x0890('0x32')](_0x5d71cc['query'][_0x0890('0x32')]);_0x42b7ae[_0x0890('0x1a')]=qs[_0x0890('0x1a')](_0x5d71cc['query']['offset']);}_0x42b7ae[_0x0890('0x33')]=qs[_0x0890('0x34')](_0x5d71cc[_0x0890('0x29')][_0x0890('0x34')]);_0x42b7ae[_0x0890('0x35')]=qs[_0x0890('0x2b')](_[_0x0890('0x36')](_0x5d71cc[_0x0890('0x29')],_0x20ca41[_0x0890('0x2b')]),_0x5cce8a);if(_0x5d71cc['query'][_0x0890('0x37')]){_0x42b7ae['where']=_[_0x0890('0x38')](_0x42b7ae[_0x0890('0x35')],{'$or':_['map'](_0x5cce8a,function(_0x49b583){if(_0x49b583[_0x0890('0x39')]!==_0x0890('0x3a')){var _0x4beac9={};_0x4beac9[_0x49b583[_0x0890('0x21')]]={'$like':'%'+_0x5d71cc[_0x0890('0x29')][_0x0890('0x37')]+'%'};return _0x4beac9;}})});}_0x42b7ae=_[_0x0890('0x38')]({},_0x42b7ae,_0x5d71cc[_0x0890('0x3b')]);var _0x4dffad={'where':_0x42b7ae[_0x0890('0x35')]};return db[_0x0890('0x25')]['count'](_0x4dffad)['then'](function(_0x35e370){_0x2ab7e6['count']=_0x35e370;if(_0x5d71cc[_0x0890('0x29')][_0x0890('0x3c')]){_0x42b7ae[_0x0890('0x3d')]=[{'all':!![]}];}return db[_0x0890('0x25')][_0x0890('0x3e')](_0x42b7ae);})[_0x0890('0x3f')](function(_0x14a755){_0x2ab7e6[_0x0890('0x40')]=_0x14a755;return _0x2ab7e6;})[_0x0890('0x3f')](respondWithFilteredResult(_0x31b51e,_0x42b7ae))[_0x0890('0x41')](handleError(_0x31b51e,null));};exports[_0x0890('0x42')]=function(_0x5a495d,_0x1dc213){var _0x5bbb1e={'raw':!![],'where':{'id':_0x5a495d[_0x0890('0x43')]['id']}},_0x5dfda9={};_0x5dfda9[_0x0890('0x2d')]=_[_0x0890('0x2a')](db[_0x0890('0x25')][_0x0890('0x26')]);_0x5dfda9['query']=_[_0x0890('0x2a')](_0x5a495d[_0x0890('0x29')]);_0x5dfda9[_0x0890('0x2b')]=_[_0x0890('0x2c')](_0x5dfda9[_0x0890('0x2d')],_0x5dfda9[_0x0890('0x29')]);_0x5bbb1e[_0x0890('0x2e')]=_['intersection'](_0x5dfda9['model'],qs[_0x0890('0x44')](_0x5a495d[_0x0890('0x29')]['fields']));_0x5bbb1e['attributes']=_0x5bbb1e[_0x0890('0x2e')][_0x0890('0x2f')]?_0x5bbb1e['attributes']:_0x5dfda9[_0x0890('0x2d')];if(_0x5a495d['query'][_0x0890('0x3c')]){_0x5bbb1e['include']=[{'all':!![]}];}_0x5bbb1e=_[_0x0890('0x38')]({},_0x5bbb1e,_0x5a495d[_0x0890('0x3b')]);return db[_0x0890('0x25')]['find'](_0x5bbb1e)[_0x0890('0x3f')](handleEntityNotFound(_0x1dc213,null))[_0x0890('0x3f')](respondWithResult(_0x1dc213,null))[_0x0890('0x41')](handleError(_0x1dc213,null));};exports[_0x0890('0x45')]=function(_0x3e0752,_0x17a87d){return db[_0x0890('0x25')][_0x0890('0x45')](_0x3e0752[_0x0890('0x46')],{})[_0x0890('0x3f')](respondWithResult(_0x17a87d,0xc9))[_0x0890('0x41')](handleError(_0x17a87d,null));};exports[_0x0890('0x47')]=function(_0x4147dd,_0x4f2ce8){if(_0x4147dd[_0x0890('0x46')]['id']){delete _0x4147dd[_0x0890('0x46')]['id'];}return db[_0x0890('0x25')][_0x0890('0x48')]({'where':{'id':_0x4147dd[_0x0890('0x43')]['id']}})[_0x0890('0x3f')](handleEntityNotFound(_0x4f2ce8,null))[_0x0890('0x3f')](saveUpdates(_0x4147dd[_0x0890('0x46')],null))[_0x0890('0x3f')](respondWithResult(_0x4f2ce8,null))[_0x0890('0x41')](handleError(_0x4f2ce8,null));};exports[_0x0890('0x49')]=function(_0x2e13f5,_0x5d101e){return db['MailTransferReport'][_0x0890('0x48')]({'where':{'id':_0x2e13f5[_0x0890('0x43')]['id']}})['then'](handleEntityNotFound(_0x5d101e,null))['then'](removeEntity(_0x5d101e,null))[_0x0890('0x41')](handleError(_0x5d101e,null));};exports[_0x0890('0x4a')]=function(_0x254e66,_0x29cd0a){return db[_0x0890('0x25')]['describe']()[_0x0890('0x3f')](respondWithResult(_0x29cd0a,null))[_0x0890('0x41')](handleError(_0x29cd0a,null));}; \ No newline at end of file +var _0x6ce5=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','set','reject','save','then','destroy','error','name','send','map','MailTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x58565a,_0x5c9f4d){var _0x4335c6=function(_0x5b200e){while(--_0x5b200e){_0x58565a['push'](_0x58565a['shift']());}};_0x4335c6(++_0x5c9f4d);}(_0x6ce5,0x1b9));var _0x56ce=function(_0x39e006,_0x8a2b8e){_0x39e006=_0x39e006-0x0;var _0x4f039b=_0x6ce5[_0x39e006];return _0x4f039b;};'use strict';var pdf=require(_0x56ce('0x0'));var emlformat=require(_0x56ce('0x1'));var rimraf=require(_0x56ce('0x2'));var zipdir=require(_0x56ce('0x3'));var jsonpatch=require(_0x56ce('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x56ce('0x5'));var Mustache=require(_0x56ce('0x6'));var util=require(_0x56ce('0x7'));var path=require(_0x56ce('0x8'));var sox=require(_0x56ce('0x9'));var csv=require(_0x56ce('0xa'));var ejs=require(_0x56ce('0xb'));var fs=require('fs');var _=require(_0x56ce('0xc'));var squel=require(_0x56ce('0xd'));var crypto=require(_0x56ce('0xe'));var jsforce=require(_0x56ce('0xf'));var deskjs=require(_0x56ce('0x10'));var toCsv=require(_0x56ce('0xa'));var querystring=require(_0x56ce('0x11'));var Papa=require(_0x56ce('0x12'));var Redis=require(_0x56ce('0x13'));var authService=require(_0x56ce('0x14'));var qs=require(_0x56ce('0x15'));var as=require(_0x56ce('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x56ce('0x17'))(_0x56ce('0x18'));var utils=require('../../config/utils');var config=require(_0x56ce('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x56ce('0x1a'))['db'];function respondWithStatusCode(_0x133298,_0x365527){_0x365527=_0x365527||0xcc;return function(_0x5a52bf){if(_0x5a52bf){return _0x133298[_0x56ce('0x1b')](_0x365527);}return _0x133298['status'](_0x365527)[_0x56ce('0x1c')]();};}function respondWithResult(_0x6987a7,_0x14dd14){_0x14dd14=_0x14dd14||0xc8;return function(_0x117646){if(_0x117646){return _0x6987a7[_0x56ce('0x1d')](_0x14dd14)[_0x56ce('0x1e')](_0x117646);}};}function respondWithFilteredResult(_0xa05210,_0x1db0d2){return function(_0x1d50b4){if(_0x1d50b4){var _0x4e53c6=_0x1d50b4[_0x56ce('0x1f')],_0x1bac58=_0x1db0d2['offset'],_0x1bb3f8=_0x1db0d2['offset']+_0x1db0d2[_0x56ce('0x20')],_0x34887d;if(_0x1bb3f8>=_0x4e53c6){_0x1bb3f8=_0x4e53c6;_0x34887d=0xc8;}else{_0x34887d=0xce;}_0xa05210[_0x56ce('0x1d')](_0x34887d);return _0xa05210[_0x56ce('0x21')]('Content-Range',_0x1bac58+'-'+_0x1bb3f8+'/'+_0x4e53c6)['json'](_0x1d50b4);}return null;};}function patchUpdates(_0x27db89){return function(_0x52c2ea){try{jsonpatch['apply'](_0x52c2ea,_0x27db89,!![]);}catch(_0x31647e){return BPromise[_0x56ce('0x22')](_0x31647e);}return _0x52c2ea[_0x56ce('0x23')]();};}function saveUpdates(_0x274b99,_0x3c9b8b){return function(_0x1252f8){if(_0x1252f8){return _0x1252f8['update'](_0x274b99)[_0x56ce('0x24')](function(_0x5ba1a7){return _0x5ba1a7;});}return null;};}function removeEntity(_0x44396f,_0x57d423){return function(_0x1ee8d2){if(_0x1ee8d2){return _0x1ee8d2[_0x56ce('0x25')]()[_0x56ce('0x24')](function(){_0x44396f[_0x56ce('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cc6fe,_0x47b9dc){return function(_0x3a6fda){if(!_0x3a6fda){_0x2cc6fe[_0x56ce('0x1b')](0x194);}return _0x3a6fda;};}function handleError(_0x5def81,_0x57d222){_0x57d222=_0x57d222||0x1f4;return function(_0x42a55c){logger[_0x56ce('0x26')](_0x42a55c['stack']);if(_0x42a55c[_0x56ce('0x27')]){delete _0x42a55c[_0x56ce('0x27')];}_0x5def81[_0x56ce('0x1d')](_0x57d222)[_0x56ce('0x28')](_0x42a55c);};}exports['index']=function(_0xd1948c,_0x3510f0){var _0x3c7716={},_0x515332={},_0x4d2898={'count':0x0,'rows':[]};var _0x5e8ca7=_[_0x56ce('0x29')](db[_0x56ce('0x2a')][_0x56ce('0x2b')],function(_0x4b1b52){return{'name':_0x4b1b52['fieldName'],'type':_0x4b1b52[_0x56ce('0x2c')][_0x56ce('0x2d')]};});_0x515332[_0x56ce('0x2e')]=_[_0x56ce('0x29')](_0x5e8ca7,_0x56ce('0x27'));_0x515332[_0x56ce('0x2f')]=_[_0x56ce('0x30')](_0xd1948c[_0x56ce('0x2f')]);_0x515332[_0x56ce('0x31')]=_[_0x56ce('0x32')](_0x515332[_0x56ce('0x2e')],_0x515332[_0x56ce('0x2f')]);_0x3c7716[_0x56ce('0x33')]=_[_0x56ce('0x32')](_0x515332[_0x56ce('0x2e')],qs[_0x56ce('0x34')](_0xd1948c[_0x56ce('0x2f')][_0x56ce('0x34')]));_0x3c7716['attributes']=_0x3c7716[_0x56ce('0x33')][_0x56ce('0x35')]?_0x3c7716[_0x56ce('0x33')]:_0x515332['model'];if(!_0xd1948c[_0x56ce('0x2f')][_0x56ce('0x36')](_0x56ce('0x37'))){_0x3c7716['limit']=qs[_0x56ce('0x20')](_0xd1948c[_0x56ce('0x2f')][_0x56ce('0x20')]);_0x3c7716[_0x56ce('0x38')]=qs[_0x56ce('0x38')](_0xd1948c[_0x56ce('0x2f')][_0x56ce('0x38')]);}_0x3c7716[_0x56ce('0x39')]=qs[_0x56ce('0x3a')](_0xd1948c[_0x56ce('0x2f')][_0x56ce('0x3a')]);_0x3c7716['where']=qs['filters'](_[_0x56ce('0x3b')](_0xd1948c[_0x56ce('0x2f')],_0x515332[_0x56ce('0x31')]),_0x5e8ca7);if(_0xd1948c[_0x56ce('0x2f')][_0x56ce('0x3c')]){_0x3c7716[_0x56ce('0x3d')]=_[_0x56ce('0x3e')](_0x3c7716[_0x56ce('0x3d')],{'$or':_['map'](_0x5e8ca7,function(_0x45c620){if(_0x45c620['type']!==_0x56ce('0x3f')){var _0x190f27={};_0x190f27[_0x45c620[_0x56ce('0x27')]]={'$like':'%'+_0xd1948c[_0x56ce('0x2f')]['filter']+'%'};return _0x190f27;}})});}_0x3c7716=_[_0x56ce('0x3e')]({},_0x3c7716,_0xd1948c[_0x56ce('0x40')]);var _0x118071={'where':_0x3c7716['where']};return db['MailTransferReport'][_0x56ce('0x1f')](_0x118071)[_0x56ce('0x24')](function(_0x5db8ae){_0x4d2898[_0x56ce('0x1f')]=_0x5db8ae;if(_0xd1948c[_0x56ce('0x2f')][_0x56ce('0x41')]){_0x3c7716[_0x56ce('0x42')]=[{'all':!![]}];}return db[_0x56ce('0x2a')][_0x56ce('0x43')](_0x3c7716);})['then'](function(_0x3d1078){_0x4d2898[_0x56ce('0x44')]=_0x3d1078;return _0x4d2898;})[_0x56ce('0x24')](respondWithFilteredResult(_0x3510f0,_0x3c7716))[_0x56ce('0x45')](handleError(_0x3510f0,null));};exports[_0x56ce('0x46')]=function(_0x40ab94,_0x3de437){var _0x1d8ed9={'raw':!![],'where':{'id':_0x40ab94[_0x56ce('0x47')]['id']}},_0x2219d4={};_0x2219d4['model']=_[_0x56ce('0x30')](db[_0x56ce('0x2a')][_0x56ce('0x2b')]);_0x2219d4[_0x56ce('0x2f')]=_[_0x56ce('0x30')](_0x40ab94['query']);_0x2219d4[_0x56ce('0x31')]=_[_0x56ce('0x32')](_0x2219d4[_0x56ce('0x2e')],_0x2219d4['query']);_0x1d8ed9['attributes']=_[_0x56ce('0x32')](_0x2219d4[_0x56ce('0x2e')],qs[_0x56ce('0x34')](_0x40ab94['query'][_0x56ce('0x34')]));_0x1d8ed9[_0x56ce('0x33')]=_0x1d8ed9[_0x56ce('0x33')][_0x56ce('0x35')]?_0x1d8ed9[_0x56ce('0x33')]:_0x2219d4[_0x56ce('0x2e')];if(_0x40ab94[_0x56ce('0x2f')][_0x56ce('0x41')]){_0x1d8ed9[_0x56ce('0x42')]=[{'all':!![]}];}_0x1d8ed9=_[_0x56ce('0x3e')]({},_0x1d8ed9,_0x40ab94['options']);return db[_0x56ce('0x2a')][_0x56ce('0x48')](_0x1d8ed9)[_0x56ce('0x24')](handleEntityNotFound(_0x3de437,null))[_0x56ce('0x24')](respondWithResult(_0x3de437,null))[_0x56ce('0x45')](handleError(_0x3de437,null));};exports[_0x56ce('0x49')]=function(_0x9752bf,_0x12f3ea){return db['MailTransferReport'][_0x56ce('0x49')](_0x9752bf['body'],{})[_0x56ce('0x24')](respondWithResult(_0x12f3ea,0xc9))[_0x56ce('0x45')](handleError(_0x12f3ea,null));};exports[_0x56ce('0x4a')]=function(_0x580003,_0x464398){if(_0x580003[_0x56ce('0x4b')]['id']){delete _0x580003[_0x56ce('0x4b')]['id'];}return db['MailTransferReport'][_0x56ce('0x48')]({'where':{'id':_0x580003[_0x56ce('0x47')]['id']}})[_0x56ce('0x24')](handleEntityNotFound(_0x464398,null))[_0x56ce('0x24')](saveUpdates(_0x580003[_0x56ce('0x4b')],null))['then'](respondWithResult(_0x464398,null))['catch'](handleError(_0x464398,null));};exports[_0x56ce('0x25')]=function(_0x463370,_0x3cb94c){return db[_0x56ce('0x2a')][_0x56ce('0x48')]({'where':{'id':_0x463370[_0x56ce('0x47')]['id']}})[_0x56ce('0x24')](handleEntityNotFound(_0x3cb94c,null))['then'](removeEntity(_0x3cb94c,null))[_0x56ce('0x45')](handleError(_0x3cb94c,null));};exports[_0x56ce('0x4c')]=function(_0x822b17,_0x1fa13e){return db['MailTransferReport'][_0x56ce('0x4c')]()['then'](respondWithResult(_0x1fa13e,null))['catch'](handleError(_0x1fa13e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 1e5776d..e8d8e22 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 _0x729b=['request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x35ce1a,_0xe56d59){var _0x33cb6a=function(_0x1215d8){while(--_0x1215d8){_0x35ce1a['push'](_0x35ce1a['shift']());}};_0x33cb6a(++_0xe56d59);}(_0x729b,0x105));var _0xb729=function(_0x49ca35,_0x15f6aa){_0x49ca35=_0x49ca35-0x0;var _0x5842f4=_0x729b[_0x49ca35];return _0x5842f4;};'use strict';var _=require(_0xb729('0x0'));var util=require(_0xb729('0x1'));var logger=require(_0xb729('0x2'))(_0xb729('0x3'));var moment=require(_0xb729('0x4'));var BPromise=require('bluebird');var rp=require(_0xb729('0x5'));var fs=require('fs');var path=require(_0xb729('0x6'));var rimraf=require('rimraf');var config=require(_0xb729('0x7'));var attributes=require(_0xb729('0x8'));module[_0xb729('0x9')]=function(_0x3a3fce,_0x2b20d8){return _0x3a3fce[_0xb729('0xa')](_0xb729('0xb'),attributes,{'tableName':_0xb729('0xc'),'paranoid':![],'indexes':[{'name':_0xb729('0xd'),'fields':[_0xb729('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x095c=['report_mail_transfer','uniqueid','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailTransferReport.attributes','define'];(function(_0x590290,_0x10663b){var _0xc9a247=function(_0x473afc){while(--_0x473afc){_0x590290['push'](_0x590290['shift']());}};_0xc9a247(++_0x10663b);}(_0x095c,0x1e6));var _0xc095=function(_0x5ac607,_0x2de543){_0x5ac607=_0x5ac607-0x0;var _0x106beb=_0x095c[_0x5ac607];return _0x106beb;};'use strict';var _=require('lodash');var util=require(_0xc095('0x0'));var logger=require(_0xc095('0x1'))('api');var moment=require(_0xc095('0x2'));var BPromise=require(_0xc095('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc095('0x4'));var rimraf=require(_0xc095('0x5'));var config=require(_0xc095('0x6'));var attributes=require(_0xc095('0x7'));module['exports']=function(_0x3566ad,_0x41fcd9){return _0x3566ad[_0xc095('0x8')]('MailTransferReport',attributes,{'tableName':_0xc095('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc095('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 389d99e..fef692b 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 _0x9eae=['../../config/environment','request','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x9dea3f,_0x3ace7e){var _0x42dbdb=function(_0x492030){while(--_0x492030){_0x9dea3f['push'](_0x9dea3f['shift']());}};_0x42dbdb(++_0x3ace7e);}(_0x9eae,0x149));var _0xe9ea=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9eae[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xe9ea('0x0'));var util=require(_0xe9ea('0x1'));var moment=require(_0xe9ea('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9ea('0x3'));var db=require(_0xe9ea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9ea('0x5'))(_0xe9ea('0x6'));var config=require(_0xe9ea('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ecf0a,_0x1d04ac,_0x4bf4ba){return new BPromise(function(_0x5ed036,_0x39a42d){return client[_0xe9ea('0x8')](_0x4ecf0a,_0x4bf4ba)[_0xe9ea('0x9')](function(_0x218460){logger['info'](_0xe9ea('0xa'),_0x1d04ac,'request\x20sent');logger[_0xe9ea('0xb')](_0xe9ea('0xc'),_0x1d04ac,'request\x20sent',JSON[_0xe9ea('0xd')](_0x218460));if(_0x218460[_0xe9ea('0xe')]){if(_0x218460[_0xe9ea('0xe')][_0xe9ea('0xf')]===0x1f4){logger[_0xe9ea('0xe')](_0xe9ea('0xa'),_0x1d04ac,_0x218460[_0xe9ea('0xe')][_0xe9ea('0x10')]);return _0x39a42d(_0x218460[_0xe9ea('0xe')][_0xe9ea('0x10')]);}logger[_0xe9ea('0xe')](_0xe9ea('0xa'),_0x1d04ac,_0x218460[_0xe9ea('0xe')][_0xe9ea('0x10')]);return _0x5ed036(_0x218460[_0xe9ea('0xe')][_0xe9ea('0x10')]);}else{logger[_0xe9ea('0x11')](_0xe9ea('0xa'),_0x1d04ac,_0xe9ea('0x12'));_0x5ed036(_0x218460[_0xe9ea('0x13')]['message']);}})[_0xe9ea('0x14')](function(_0x1c3ab9){logger[_0xe9ea('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x1d04ac,_0x1c3ab9);_0x39a42d(_0x1c3ab9);});});} \ No newline at end of file +var _0xa9a3=['error','code','message','MailTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','request\x20sent'];(function(_0x13e2fe,_0x4194d7){var _0x38eac4=function(_0x3e8911){while(--_0x3e8911){_0x13e2fe['push'](_0x13e2fe['shift']());}};_0x38eac4(++_0x4194d7);}(_0xa9a3,0x1d4));var _0x3a9a=function(_0x27031e,_0x1eb8cd){_0x27031e=_0x27031e-0x0;var _0xfd46b3=_0xa9a3[_0x27031e];return _0xfd46b3;};'use strict';var _=require(_0x3a9a('0x0'));var util=require(_0x3a9a('0x1'));var moment=require(_0x3a9a('0x2'));var BPromise=require('bluebird');var rs=require(_0x3a9a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a9a('0x4'))['db'];var utils=require(_0x3a9a('0x5'));var logger=require(_0x3a9a('0x6'))(_0x3a9a('0x7'));var config=require(_0x3a9a('0x8'));var jayson=require(_0x3a9a('0x9'));var client=jayson['client'][_0x3a9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ef13a,_0x3fec78,_0x5ed986){return new BPromise(function(_0x1a8932,_0x47f4cc){return client[_0x3a9a('0xb')](_0x5ef13a,_0x5ed986)[_0x3a9a('0xc')](function(_0xf9a1fb){logger[_0x3a9a('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x3fec78,'request\x20sent');logger[_0x3a9a('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x3fec78,_0x3a9a('0xf'),JSON['stringify'](_0xf9a1fb));if(_0xf9a1fb['error']){if(_0xf9a1fb[_0x3a9a('0x10')][_0x3a9a('0x11')]===0x1f4){logger[_0x3a9a('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x3fec78,_0xf9a1fb[_0x3a9a('0x10')]['message']);return _0x47f4cc(_0xf9a1fb['error'][_0x3a9a('0x12')]);}logger[_0x3a9a('0x10')](_0x3a9a('0x13'),_0x3fec78,_0xf9a1fb[_0x3a9a('0x10')]['message']);return _0x1a8932(_0xf9a1fb[_0x3a9a('0x10')][_0x3a9a('0x12')]);}else{logger[_0x3a9a('0xd')](_0x3a9a('0x13'),_0x3fec78,'request\x20sent');_0x1a8932(_0xf9a1fb[_0x3a9a('0x14')][_0x3a9a('0x12')]);}})[_0x3a9a('0x15')](function(_0x4ee611){logger[_0x3a9a('0x10')](_0x3a9a('0x13'),_0x3fec78,_0x4ee611);_0x47f4cc(_0x4ee611);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 90d5073..154fc68 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 _0xd9bf=['/describe','describe','/:id','show','post','create','put','update','delete','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated'];(function(_0x3e6c8a,_0x422a26){var _0x401889=function(_0x27cf6f){while(--_0x27cf6f){_0x3e6c8a['push'](_0x3e6c8a['shift']());}};_0x401889(++_0x422a26);}(_0xd9bf,0xda));var _0xfd9b=function(_0x4c9304,_0x4a67da){_0x4c9304=_0x4c9304-0x0;var _0x21e678=_0xd9bf[_0x4c9304];return _0x21e678;};'use strict';var multer=require(_0xfd9b('0x0'));var util=require(_0xfd9b('0x1'));var path=require(_0xfd9b('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd9b('0x3'));var router=express[_0xfd9b('0x4')]();var auth=require(_0xfd9b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfd9b('0x6'));var controller=require(_0xfd9b('0x7'));router[_0xfd9b('0x8')]('/',auth[_0xfd9b('0x9')](),controller['index']);router[_0xfd9b('0x8')](_0xfd9b('0xa'),auth['isAuthenticated'](),controller[_0xfd9b('0xb')]);router[_0xfd9b('0x8')](_0xfd9b('0xc'),auth[_0xfd9b('0x9')](),controller[_0xfd9b('0xd')]);router[_0xfd9b('0xe')]('/',auth['isAuthenticated'](),controller[_0xfd9b('0xf')]);router[_0xfd9b('0x10')]('/:id',auth[_0xfd9b('0x9')](),controller[_0xfd9b('0x11')]);router[_0xfd9b('0x12')]('/:id',auth[_0xfd9b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xaa92=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x254b18,_0xdaf185){var _0x596438=function(_0x1ba07a){while(--_0x1ba07a){_0x254b18['push'](_0x254b18['shift']());}};_0x596438(++_0xdaf185);}(_0xaa92,0xef));var _0x2aa9=function(_0x1c470d,_0x81d66b){_0x1c470d=_0x1c470d-0x0;var _0x12141b=_0xaa92[_0x1c470d];return _0x12141b;};'use strict';var multer=require(_0x2aa9('0x0'));var util=require(_0x2aa9('0x1'));var path=require(_0x2aa9('0x2'));var timeout=require(_0x2aa9('0x3'));var express=require('express');var router=express[_0x2aa9('0x4')]();var auth=require(_0x2aa9('0x5'));var interaction=require(_0x2aa9('0x6'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x2aa9('0x7')]('/',auth[_0x2aa9('0x8')](),controller[_0x2aa9('0x9')]);router[_0x2aa9('0x7')](_0x2aa9('0xa'),auth[_0x2aa9('0x8')](),controller[_0x2aa9('0xb')]);router[_0x2aa9('0x7')](_0x2aa9('0xc'),auth[_0x2aa9('0x8')](),controller[_0x2aa9('0xd')]);router[_0x2aa9('0xe')]('/',auth[_0x2aa9('0x8')](),controller[_0x2aa9('0xf')]);router[_0x2aa9('0x10')](_0x2aa9('0xc'),auth[_0x2aa9('0x8')](),controller[_0x2aa9('0x11')]);router[_0x2aa9('0x12')](_0x2aa9('0xc'),auth[_0x2aa9('0x8')](),controller['destroy']);module[_0x2aa9('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index b89d70f..6412c9e 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 _0xd505=['talk:[destination]','talk:[dial\x20string]','INTEGER','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x2ef714,_0x49e1c4){var _0x252ab0=function(_0x868e73){while(--_0x868e73){_0x2ef714['push'](_0x2ef714['shift']());}};_0x252ab0(++_0x49e1c4);}(_0xd505,0x143));var _0x5d50=function(_0x3f9525,_0x45e92a){_0x3f9525=_0x3f9525-0x0;var _0x158607=_0xd505[_0x3f9525];return _0x158607;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5d50('0x0'));module[_0x5d50('0x1')]={'channel':{'type':Sequelize[_0x5d50('0x2')]},'membername':{'type':Sequelize[_0x5d50('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5d50('0x2')],'defaultValue':_0x5d50('0x3'),'comment':_0x5d50('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x5d50('0x5')]},'exitAt':{'type':Sequelize[_0x5d50('0x5')],'set':function(_0x10e3b6){var _0x5e9e39=moment(_0x10e3b6);var _0x53ee0c=moment(this['getDataValue'](_0x5d50('0x6')));var _0x267f7a=_0x5e9e39['diff'](_0x53ee0c,_0x5d50('0x7'));this[_0x5d50('0x8')](_0x5d50('0x9'),_0x10e3b6);this['setDataValue'](_0x5d50('0xa'),_0x267f7a||null);}},'data1':{'type':Sequelize[_0x5d50('0x2')],'comment':_0x5d50('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0x5d50('0xc')},'data3':{'type':Sequelize[_0x5d50('0x2')],'comment':_0x5d50('0xd')},'data4':{'type':Sequelize[_0x5d50('0x2')],'comment':_0x5d50('0xe')},'data5':{'type':Sequelize[_0x5d50('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x5d50('0x2')]},'internal':{'type':Sequelize[_0x5d50('0xf')]},'uniqueid':{'type':Sequelize[_0x5d50('0x2')]}}; \ No newline at end of file +var _0x2144=['INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','DATE','getDataValue','diff','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[queue]'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x2144,0x14b));var _0x4214=function(_0x277d61,_0xab8c96){_0x277d61=_0x277d61-0x0;var _0x34f6e1=_0x2144[_0x277d61];return _0x34f6e1;};'use strict';var Sequelize=require(_0x4214('0x0'));var moment=require(_0x4214('0x1'));module[_0x4214('0x2')]={'channel':{'type':Sequelize[_0x4214('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4214('0x3')]},'type':{'type':Sequelize[_0x4214('0x3')],'defaultValue':_0x4214('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x4214('0x5')]},'exitAt':{'type':Sequelize[_0x4214('0x5')],'set':function(_0x23c99a){var _0x2b6996=moment(_0x23c99a);var _0x5aa961=moment(this[_0x4214('0x6')]('enterAt'));var _0x4f3c0c=_0x2b6996[_0x4214('0x7')](_0x5aa961,_0x4214('0x8'));this['setDataValue'](_0x4214('0x9'),_0x23c99a);this[_0x4214('0xa')](_0x4214('0xb'),_0x4f3c0c||null);}},'data1':{'type':Sequelize[_0x4214('0x3')],'comment':_0x4214('0xc')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x4214('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x4214('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x4214('0x3')],'comment':_0x4214('0xd')},'role':{'type':Sequelize[_0x4214('0x3')]},'internal':{'type':Sequelize[_0x4214('0xe')]},'uniqueid':{'type':Sequelize[_0x4214('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 56e93cf..2f3d0e9 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 _0xbfea=['type','map','query','keys','filters','intersection','model','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','send','index','MemberReport','rawAttributes','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfea,0xac));var _0xabfe=function(_0x1437f6,_0x2bd652){_0x1437f6=_0x1437f6-0x0;var _0x3c61d8=_0xbfea[_0x1437f6];return _0x3c61d8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xabfe('0x0'));var rimraf=require(_0xabfe('0x1'));var zipdir=require(_0xabfe('0x2'));var jsonpatch=require(_0xabfe('0x3'));var rp=require(_0xabfe('0x4'));var moment=require(_0xabfe('0x5'));var BPromise=require(_0xabfe('0x6'));var Mustache=require('mustache');var util=require(_0xabfe('0x7'));var path=require(_0xabfe('0x8'));var sox=require(_0xabfe('0x9'));var csv=require(_0xabfe('0xa'));var ejs=require(_0xabfe('0xb'));var fs=require('fs');var _=require(_0xabfe('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xabfe('0xd'));var deskjs=require(_0xabfe('0xe'));var toCsv=require(_0xabfe('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xabfe('0xf'));var as=require(_0xabfe('0x10'));var hardwareService=require(_0xabfe('0x11'));var logger=require(_0xabfe('0x12'))(_0xabfe('0x13'));var utils=require('../../config/utils');var config=require(_0xabfe('0x14'));var licenseUtil=require(_0xabfe('0x15'));var db=require(_0xabfe('0x16'))['db'];function respondWithStatusCode(_0x46efd7,_0x1f2161){_0x1f2161=_0x1f2161||0xcc;return function(_0x2a815f){if(_0x2a815f){return _0x46efd7['sendStatus'](_0x1f2161);}return _0x46efd7[_0xabfe('0x17')](_0x1f2161)['end']();};}function respondWithResult(_0x27fa1a,_0x18d331){_0x18d331=_0x18d331||0xc8;return function(_0x3cd4cf){if(_0x3cd4cf){return _0x27fa1a['status'](_0x18d331)[_0xabfe('0x18')](_0x3cd4cf);}};}function respondWithFilteredResult(_0x5f395c,_0x1f0184){return function(_0x4a96c3){if(_0x4a96c3){var _0x5c0cb1=_0x4a96c3[_0xabfe('0x19')],_0x224ec8=_0x1f0184[_0xabfe('0x1a')],_0x31b0a5=_0x1f0184['offset']+_0x1f0184[_0xabfe('0x1b')],_0x2b3e3c;if(_0x31b0a5>=_0x5c0cb1){_0x31b0a5=_0x5c0cb1;_0x2b3e3c=0xc8;}else{_0x2b3e3c=0xce;}_0x5f395c[_0xabfe('0x17')](_0x2b3e3c);return _0x5f395c[_0xabfe('0x1c')](_0xabfe('0x1d'),_0x224ec8+'-'+_0x31b0a5+'/'+_0x5c0cb1)['json'](_0x4a96c3);}return null;};}function patchUpdates(_0x4e154e){return function(_0x5a06e8){try{jsonpatch[_0xabfe('0x1e')](_0x5a06e8,_0x4e154e,!![]);}catch(_0x531767){return BPromise[_0xabfe('0x1f')](_0x531767);}return _0x5a06e8[_0xabfe('0x20')]();};}function saveUpdates(_0x370427,_0x50342b){return function(_0x5273a1){if(_0x5273a1){return _0x5273a1[_0xabfe('0x21')](_0x370427)[_0xabfe('0x22')](function(_0x329fd6){return _0x329fd6;});}return null;};}function removeEntity(_0x9fb744,_0x3ae13c){return function(_0x37bfa1){if(_0x37bfa1){return _0x37bfa1['destroy']()[_0xabfe('0x22')](function(){_0x9fb744[_0xabfe('0x17')](0xcc)[_0xabfe('0x23')]();});}};}function handleEntityNotFound(_0x537fb1,_0x53d488){return function(_0x105287){if(!_0x105287){_0x537fb1[_0xabfe('0x24')](0x194);}return _0x105287;};}function handleError(_0x37a3a3,_0x1b123e){_0x1b123e=_0x1b123e||0x1f4;return function(_0x15e895){logger['error'](_0x15e895[_0xabfe('0x25')]);if(_0x15e895[_0xabfe('0x26')]){delete _0x15e895[_0xabfe('0x26')];}_0x37a3a3[_0xabfe('0x17')](_0x1b123e)[_0xabfe('0x27')](_0x15e895);};}exports[_0xabfe('0x28')]=function(_0x5d3ec9,_0x4fb2e3){var _0x44eb28={},_0x22abc4={},_0x4cfb90={'count':0x0,'rows':[]};var _0x5b848c=_['map'](db[_0xabfe('0x29')][_0xabfe('0x2a')],function(_0x164cb9){return{'name':_0x164cb9[_0xabfe('0x2b')],'type':_0x164cb9[_0xabfe('0x2c')]['key']};});_0x22abc4['model']=_[_0xabfe('0x2d')](_0x5b848c,_0xabfe('0x26'));_0x22abc4[_0xabfe('0x2e')]=_[_0xabfe('0x2f')](_0x5d3ec9[_0xabfe('0x2e')]);_0x22abc4[_0xabfe('0x30')]=_[_0xabfe('0x31')](_0x22abc4[_0xabfe('0x32')],_0x22abc4[_0xabfe('0x2e')]);_0x44eb28['attributes']=_[_0xabfe('0x31')](_0x22abc4[_0xabfe('0x32')],qs['fields'](_0x5d3ec9[_0xabfe('0x2e')][_0xabfe('0x33')]));_0x44eb28['attributes']=_0x44eb28['attributes']['length']?_0x44eb28[_0xabfe('0x34')]:_0x22abc4['model'];if(!_0x5d3ec9['query']['hasOwnProperty']('nolimit')){_0x44eb28[_0xabfe('0x1b')]=qs[_0xabfe('0x1b')](_0x5d3ec9[_0xabfe('0x2e')][_0xabfe('0x1b')]);_0x44eb28[_0xabfe('0x1a')]=qs[_0xabfe('0x1a')](_0x5d3ec9[_0xabfe('0x2e')][_0xabfe('0x1a')]);}_0x44eb28[_0xabfe('0x35')]=qs[_0xabfe('0x36')](_0x5d3ec9[_0xabfe('0x2e')]['sort']);_0x44eb28[_0xabfe('0x37')]=qs[_0xabfe('0x30')](_[_0xabfe('0x38')](_0x5d3ec9[_0xabfe('0x2e')],_0x22abc4['filters']),_0x5b848c);if(_0x5d3ec9[_0xabfe('0x2e')][_0xabfe('0x39')]){_0x44eb28[_0xabfe('0x37')]=_[_0xabfe('0x3a')](_0x44eb28[_0xabfe('0x37')],{'$or':_[_0xabfe('0x2d')](_0x5b848c,function(_0x3da672){if(_0x3da672['type']!==_0xabfe('0x3b')){var _0x4987f8={};_0x4987f8[_0x3da672['name']]={'$like':'%'+_0x5d3ec9[_0xabfe('0x2e')]['filter']+'%'};return _0x4987f8;}})});}_0x44eb28=_[_0xabfe('0x3a')]({},_0x44eb28,_0x5d3ec9['options']);var _0x5ed37b={'where':_0x44eb28[_0xabfe('0x37')]};return db[_0xabfe('0x29')][_0xabfe('0x19')](_0x5ed37b)[_0xabfe('0x22')](function(_0x15ab57){_0x4cfb90[_0xabfe('0x19')]=_0x15ab57;if(_0x5d3ec9[_0xabfe('0x2e')]['includeAll']){_0x44eb28[_0xabfe('0x3c')]=[{'all':!![]}];}return db[_0xabfe('0x29')][_0xabfe('0x3d')](_0x44eb28);})[_0xabfe('0x22')](function(_0x15b666){_0x4cfb90[_0xabfe('0x3e')]=_0x15b666;return _0x4cfb90;})['then'](respondWithFilteredResult(_0x4fb2e3,_0x44eb28))[_0xabfe('0x3f')](handleError(_0x4fb2e3,null));};exports[_0xabfe('0x40')]=function(_0x587eb4,_0x6eb783){var _0xae9e3d={'raw':!![],'where':{'id':_0x587eb4[_0xabfe('0x41')]['id']}},_0x1a27c1={};_0x1a27c1[_0xabfe('0x32')]=_[_0xabfe('0x2f')](db[_0xabfe('0x29')][_0xabfe('0x2a')]);_0x1a27c1[_0xabfe('0x2e')]=_['keys'](_0x587eb4['query']);_0x1a27c1['filters']=_['intersection'](_0x1a27c1[_0xabfe('0x32')],_0x1a27c1[_0xabfe('0x2e')]);_0xae9e3d[_0xabfe('0x34')]=_['intersection'](_0x1a27c1[_0xabfe('0x32')],qs['fields'](_0x587eb4[_0xabfe('0x2e')]['fields']));_0xae9e3d[_0xabfe('0x34')]=_0xae9e3d[_0xabfe('0x34')]['length']?_0xae9e3d[_0xabfe('0x34')]:_0x1a27c1[_0xabfe('0x32')];if(_0x587eb4[_0xabfe('0x2e')][_0xabfe('0x42')]){_0xae9e3d[_0xabfe('0x3c')]=[{'all':!![]}];}_0xae9e3d=_[_0xabfe('0x3a')]({},_0xae9e3d,_0x587eb4['options']);return db[_0xabfe('0x29')]['find'](_0xae9e3d)[_0xabfe('0x22')](handleEntityNotFound(_0x6eb783,null))['then'](respondWithResult(_0x6eb783,null))['catch'](handleError(_0x6eb783,null));};exports[_0xabfe('0x43')]=function(_0x4435d4,_0x13bf78){return db[_0xabfe('0x29')][_0xabfe('0x43')](_0x4435d4['body'],{})[_0xabfe('0x22')](respondWithResult(_0x13bf78,0xc9))['catch'](handleError(_0x13bf78,null));};exports[_0xabfe('0x21')]=function(_0x59af9e,_0x8c43f3){if(_0x59af9e[_0xabfe('0x44')]['id']){delete _0x59af9e[_0xabfe('0x44')]['id'];}return db[_0xabfe('0x29')]['find']({'where':{'id':_0x59af9e[_0xabfe('0x41')]['id']}})['then'](handleEntityNotFound(_0x8c43f3,null))['then'](saveUpdates(_0x59af9e[_0xabfe('0x44')],null))[_0xabfe('0x22')](respondWithResult(_0x8c43f3,null))[_0xabfe('0x3f')](handleError(_0x8c43f3,null));};exports[_0xabfe('0x45')]=function(_0xc14453,_0x4b755c){return db[_0xabfe('0x29')][_0xabfe('0x46')]({'where':{'id':_0xc14453['params']['id']}})[_0xabfe('0x22')](handleEntityNotFound(_0x4b755c,null))['then'](removeEntity(_0x4b755c,null))['catch'](handleError(_0x4b755c,null));};exports[_0xabfe('0x47')]=function(_0x28c204,_0x4a98a1){return db[_0xabfe('0x29')][_0xabfe('0x47')]()[_0xabfe('0x22')](respondWithResult(_0x4a98a1,null))[_0xabfe('0x3f')](handleError(_0x4a98a1,null));}; \ No newline at end of file +var _0x8287=['hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','map','options','include','findAll','rows','catch','show','length','includeAll','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','update','then','destroy','sendStatus','error','send','MemberReport','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','fields','attributes'];(function(_0x24b3db,_0x405f52){var _0x15fed5=function(_0x4880d6){while(--_0x4880d6){_0x24b3db['push'](_0x24b3db['shift']());}};_0x15fed5(++_0x405f52);}(_0x8287,0x1d8));var _0x7828=function(_0x2a53ad,_0x234135){_0x2a53ad=_0x2a53ad-0x0;var _0x31b3b6=_0x8287[_0x2a53ad];return _0x31b3b6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7828('0x0'));var rimraf=require(_0x7828('0x1'));var zipdir=require(_0x7828('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7828('0x3'));var moment=require(_0x7828('0x4'));var BPromise=require(_0x7828('0x5'));var Mustache=require(_0x7828('0x6'));var util=require(_0x7828('0x7'));var path=require(_0x7828('0x8'));var sox=require(_0x7828('0x9'));var csv=require('to-csv');var ejs=require(_0x7828('0xa'));var fs=require('fs');var _=require(_0x7828('0xb'));var squel=require('squel');var crypto=require(_0x7828('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7828('0xd'));var toCsv=require(_0x7828('0xe'));var querystring=require(_0x7828('0xf'));var Papa=require(_0x7828('0x10'));var Redis=require(_0x7828('0x11'));var authService=require(_0x7828('0x12'));var qs=require(_0x7828('0x13'));var as=require(_0x7828('0x14'));var hardwareService=require(_0x7828('0x15'));var logger=require(_0x7828('0x16'))(_0x7828('0x17'));var utils=require(_0x7828('0x18'));var config=require(_0x7828('0x19'));var licenseUtil=require(_0x7828('0x1a'));var db=require(_0x7828('0x1b'))['db'];function respondWithStatusCode(_0x1698ce,_0x489459){_0x489459=_0x489459||0xcc;return function(_0x41fb1c){if(_0x41fb1c){return _0x1698ce['sendStatus'](_0x489459);}return _0x1698ce[_0x7828('0x1c')](_0x489459)[_0x7828('0x1d')]();};}function respondWithResult(_0x1f2809,_0xc76a88){_0xc76a88=_0xc76a88||0xc8;return function(_0x5c3f1){if(_0x5c3f1){return _0x1f2809[_0x7828('0x1c')](_0xc76a88)[_0x7828('0x1e')](_0x5c3f1);}};}function respondWithFilteredResult(_0x33d98d,_0x1bf392){return function(_0x306ad8){if(_0x306ad8){var _0x5ef2ff=_0x306ad8[_0x7828('0x1f')],_0x28ea55=_0x1bf392[_0x7828('0x20')],_0x59dd8b=_0x1bf392[_0x7828('0x20')]+_0x1bf392[_0x7828('0x21')],_0x14e5a3;if(_0x59dd8b>=_0x5ef2ff){_0x59dd8b=_0x5ef2ff;_0x14e5a3=0xc8;}else{_0x14e5a3=0xce;}_0x33d98d[_0x7828('0x1c')](_0x14e5a3);return _0x33d98d[_0x7828('0x22')]('Content-Range',_0x28ea55+'-'+_0x59dd8b+'/'+_0x5ef2ff)[_0x7828('0x1e')](_0x306ad8);}return null;};}function patchUpdates(_0x329860){return function(_0x436e14){try{jsonpatch['apply'](_0x436e14,_0x329860,!![]);}catch(_0x3a02dd){return BPromise['reject'](_0x3a02dd);}return _0x436e14['save']();};}function saveUpdates(_0x358ab6,_0x583eae){return function(_0xe20747){if(_0xe20747){return _0xe20747[_0x7828('0x23')](_0x358ab6)[_0x7828('0x24')](function(_0x36df25){return _0x36df25;});}return null;};}function removeEntity(_0x5ffa60,_0xf1f343){return function(_0x3e0d12){if(_0x3e0d12){return _0x3e0d12[_0x7828('0x25')]()[_0x7828('0x24')](function(){_0x5ffa60[_0x7828('0x1c')](0xcc)[_0x7828('0x1d')]();});}};}function handleEntityNotFound(_0x77cede,_0x279c73){return function(_0x55c0db){if(!_0x55c0db){_0x77cede[_0x7828('0x26')](0x194);}return _0x55c0db;};}function handleError(_0x1c1afd,_0x38203c){_0x38203c=_0x38203c||0x1f4;return function(_0x4e8c74){logger[_0x7828('0x27')](_0x4e8c74['stack']);if(_0x4e8c74['name']){delete _0x4e8c74['name'];}_0x1c1afd[_0x7828('0x1c')](_0x38203c)[_0x7828('0x28')](_0x4e8c74);};}exports['index']=function(_0x17dc47,_0x455b22){var _0xa9317f={},_0x46aec8={},_0x153a9c={'count':0x0,'rows':[]};var _0x178daa=_['map'](db[_0x7828('0x29')][_0x7828('0x2a')],function(_0x416d48){return{'name':_0x416d48[_0x7828('0x2b')],'type':_0x416d48[_0x7828('0x2c')][_0x7828('0x2d')]};});_0x46aec8['model']=_['map'](_0x178daa,_0x7828('0x2e'));_0x46aec8[_0x7828('0x2f')]=_[_0x7828('0x30')](_0x17dc47[_0x7828('0x2f')]);_0x46aec8['filters']=_[_0x7828('0x31')](_0x46aec8[_0x7828('0x32')],_0x46aec8['query']);_0xa9317f['attributes']=_[_0x7828('0x31')](_0x46aec8['model'],qs['fields'](_0x17dc47[_0x7828('0x2f')][_0x7828('0x33')]));_0xa9317f['attributes']=_0xa9317f[_0x7828('0x34')]['length']?_0xa9317f[_0x7828('0x34')]:_0x46aec8[_0x7828('0x32')];if(!_0x17dc47[_0x7828('0x2f')][_0x7828('0x35')](_0x7828('0x36'))){_0xa9317f[_0x7828('0x21')]=qs[_0x7828('0x21')](_0x17dc47[_0x7828('0x2f')][_0x7828('0x21')]);_0xa9317f[_0x7828('0x20')]=qs[_0x7828('0x20')](_0x17dc47[_0x7828('0x2f')][_0x7828('0x20')]);}_0xa9317f[_0x7828('0x37')]=qs[_0x7828('0x38')](_0x17dc47['query'][_0x7828('0x38')]);_0xa9317f['where']=qs['filters'](_[_0x7828('0x39')](_0x17dc47[_0x7828('0x2f')],_0x46aec8[_0x7828('0x3a')]),_0x178daa);if(_0x17dc47[_0x7828('0x2f')]['filter']){_0xa9317f[_0x7828('0x3b')]=_[_0x7828('0x3c')](_0xa9317f[_0x7828('0x3b')],{'$or':_[_0x7828('0x3d')](_0x178daa,function(_0xbdbe82){if(_0xbdbe82[_0x7828('0x2c')]!=='VIRTUAL'){var _0x253239={};_0x253239[_0xbdbe82['name']]={'$like':'%'+_0x17dc47[_0x7828('0x2f')]['filter']+'%'};return _0x253239;}})});}_0xa9317f=_[_0x7828('0x3c')]({},_0xa9317f,_0x17dc47[_0x7828('0x3e')]);var _0x50ae9f={'where':_0xa9317f[_0x7828('0x3b')]};return db[_0x7828('0x29')][_0x7828('0x1f')](_0x50ae9f)[_0x7828('0x24')](function(_0x532061){_0x153a9c['count']=_0x532061;if(_0x17dc47[_0x7828('0x2f')]['includeAll']){_0xa9317f[_0x7828('0x3f')]=[{'all':!![]}];}return db[_0x7828('0x29')][_0x7828('0x40')](_0xa9317f);})[_0x7828('0x24')](function(_0x5ee422){_0x153a9c[_0x7828('0x41')]=_0x5ee422;return _0x153a9c;})[_0x7828('0x24')](respondWithFilteredResult(_0x455b22,_0xa9317f))[_0x7828('0x42')](handleError(_0x455b22,null));};exports[_0x7828('0x43')]=function(_0x471670,_0x566bea){var _0x3fa3d0={'raw':!![],'where':{'id':_0x471670['params']['id']}},_0x4ca669={};_0x4ca669[_0x7828('0x32')]=_[_0x7828('0x30')](db[_0x7828('0x29')][_0x7828('0x2a')]);_0x4ca669['query']=_[_0x7828('0x30')](_0x471670[_0x7828('0x2f')]);_0x4ca669[_0x7828('0x3a')]=_[_0x7828('0x31')](_0x4ca669[_0x7828('0x32')],_0x4ca669[_0x7828('0x2f')]);_0x3fa3d0[_0x7828('0x34')]=_['intersection'](_0x4ca669[_0x7828('0x32')],qs[_0x7828('0x33')](_0x471670[_0x7828('0x2f')][_0x7828('0x33')]));_0x3fa3d0[_0x7828('0x34')]=_0x3fa3d0[_0x7828('0x34')][_0x7828('0x44')]?_0x3fa3d0[_0x7828('0x34')]:_0x4ca669[_0x7828('0x32')];if(_0x471670[_0x7828('0x2f')][_0x7828('0x45')]){_0x3fa3d0[_0x7828('0x3f')]=[{'all':!![]}];}_0x3fa3d0=_[_0x7828('0x3c')]({},_0x3fa3d0,_0x471670[_0x7828('0x3e')]);return db[_0x7828('0x29')]['find'](_0x3fa3d0)[_0x7828('0x24')](handleEntityNotFound(_0x566bea,null))[_0x7828('0x24')](respondWithResult(_0x566bea,null))['catch'](handleError(_0x566bea,null));};exports[_0x7828('0x46')]=function(_0x2edba7,_0x486924){return db[_0x7828('0x29')][_0x7828('0x46')](_0x2edba7[_0x7828('0x47')],{})['then'](respondWithResult(_0x486924,0xc9))[_0x7828('0x42')](handleError(_0x486924,null));};exports[_0x7828('0x23')]=function(_0x1b8a8e,_0x1c7599){if(_0x1b8a8e[_0x7828('0x47')]['id']){delete _0x1b8a8e['body']['id'];}return db[_0x7828('0x29')][_0x7828('0x48')]({'where':{'id':_0x1b8a8e[_0x7828('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c7599,null))[_0x7828('0x24')](saveUpdates(_0x1b8a8e[_0x7828('0x47')],null))['then'](respondWithResult(_0x1c7599,null))[_0x7828('0x42')](handleError(_0x1c7599,null));};exports['destroy']=function(_0x5ad625,_0x4d34e1){return db[_0x7828('0x29')][_0x7828('0x48')]({'where':{'id':_0x5ad625[_0x7828('0x49')]['id']}})[_0x7828('0x24')](handleEntityNotFound(_0x4d34e1,null))['then'](removeEntity(_0x4d34e1,null))[_0x7828('0x42')](handleError(_0x4d34e1,null));};exports[_0x7828('0x4a')]=function(_0x2b69a7,_0x17bb21){return db['MemberReport'][_0x7828('0x4a')]()[_0x7828('0x24')](respondWithResult(_0x17bb21,null))[_0x7828('0x42')](handleError(_0x17bb21,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d2f5dce..678a8c3 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 _0x0245=['membername_interface','util','../../config/logger','api','moment','bluebird','rimraf','./memberReport.attributes','MemberReport','report_member'];(function(_0x2545b1,_0x4a8e22){var _0x5592e1=function(_0x1158d9){while(--_0x1158d9){_0x2545b1['push'](_0x2545b1['shift']());}};_0x5592e1(++_0x4a8e22);}(_0x0245,0x1cd));var _0x5024=function(_0x5ad8fb,_0x4a4145){_0x5ad8fb=_0x5ad8fb-0x0;var _0xa57ff6=_0x0245[_0x5ad8fb];return _0xa57ff6;};'use strict';var _=require('lodash');var util=require(_0x5024('0x0'));var logger=require(_0x5024('0x1'))(_0x5024('0x2'));var moment=require(_0x5024('0x3'));var BPromise=require(_0x5024('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5024('0x5'));var config=require('../../config/environment');var attributes=require(_0x5024('0x6'));module['exports']=function(_0x4e4815,_0x1aeaad){return _0x4e4815['define'](_0x5024('0x7'),attributes,{'tableName':_0x5024('0x8'),'paranoid':![],'indexes':[{'name':_0x5024('0x9'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7f9=['lodash','util','../../config/logger','api','moment','request-promise','path','membername_interface'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xb7f9,0x170));var _0x9b7f=function(_0x24a97b,_0x2feac0){_0x24a97b=_0x24a97b-0x0;var _0x186301=_0xb7f9[_0x24a97b];return _0x186301;};'use strict';var _=require(_0x9b7f('0x0'));var util=require(_0x9b7f('0x1'));var logger=require(_0x9b7f('0x2'))(_0x9b7f('0x3'));var moment=require(_0x9b7f('0x4'));var BPromise=require('bluebird');var rp=require(_0x9b7f('0x5'));var fs=require('fs');var path=require(_0x9b7f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module['exports']=function(_0xff8827,_0x264475){return _0xff8827['define']('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x9b7f('0x7'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 296b12d..257bb29 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 _0x1af1=['MemberReport,\x20%s,\x20%s','message','info','result','catch','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','stringify','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0x1af1,0x6a));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11af('0x0'));var util=require(_0x11af('0x1'));var moment=require(_0x11af('0x2'));var BPromise=require(_0x11af('0x3'));var rs=require(_0x11af('0x4'));var fs=require('fs');var Redis=require(_0x11af('0x5'));var db=require(_0x11af('0x6'))['db'];var utils=require(_0x11af('0x7'));var logger=require(_0x11af('0x8'))(_0x11af('0x9'));var config=require(_0x11af('0xa'));var jayson=require(_0x11af('0xb'));var client=jayson[_0x11af('0xc')][_0x11af('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x564a2e,_0x220125,_0x2e12b0){return new BPromise(function(_0x35ff0f,_0x45bcdb){return client[_0x11af('0xe')](_0x564a2e,_0x2e12b0)[_0x11af('0xf')](function(_0x1b2b32){logger['info']('MemberReport,\x20%s,\x20%s',_0x220125,_0x11af('0x10'));logger[_0x11af('0x11')](_0x11af('0x12'),_0x220125,_0x11af('0x10'),JSON['stringify'](_0x1b2b32));if(_0x1b2b32[_0x11af('0x13')]){if(_0x1b2b32[_0x11af('0x13')]['code']===0x1f4){logger[_0x11af('0x13')](_0x11af('0x14'),_0x220125,_0x1b2b32[_0x11af('0x13')][_0x11af('0x15')]);return _0x45bcdb(_0x1b2b32[_0x11af('0x13')][_0x11af('0x15')]);}logger[_0x11af('0x13')](_0x11af('0x14'),_0x220125,_0x1b2b32[_0x11af('0x13')][_0x11af('0x15')]);return _0x35ff0f(_0x1b2b32[_0x11af('0x13')][_0x11af('0x15')]);}else{logger[_0x11af('0x16')](_0x11af('0x14'),_0x220125,_0x11af('0x10'));_0x35ff0f(_0x1b2b32[_0x11af('0x17')]['message']);}})[_0x11af('0x18')](function(_0x207e47){logger['error']('MemberReport,\x20%s,\x20%s',_0x220125,_0x207e47);_0x45bcdb(_0x207e47);});});}exports['GetMemberReport']=function(_0x14cb57){var _0x1f2910=this;return new Promise(function(_0x47177e,_0x412aea){return db[_0x11af('0x19')][_0x11af('0x1a')]({'raw':_0x14cb57[_0x11af('0x1b')]?_0x14cb57[_0x11af('0x1b')][_0x11af('0x1c')]===undefined?!![]:![]:!![],'where':_0x14cb57[_0x11af('0x1b')]?_0x14cb57['options'][_0x11af('0x1d')]||null:null,'attributes':_0x14cb57[_0x11af('0x1b')]?_0x14cb57['options'][_0x11af('0x1e')]||null:null,'limit':_0x14cb57[_0x11af('0x1b')]?_0x14cb57['options'][_0x11af('0x1f')]||null:null,'include':_0x14cb57[_0x11af('0x1b')]?_0x14cb57[_0x11af('0x1b')][_0x11af('0x20')]?_[_0x11af('0x21')](_0x14cb57[_0x11af('0x1b')][_0x11af('0x20')],function(_0x3450f4){return{'model':db[_0x3450f4[_0x11af('0x22')]],'as':_0x3450f4['as'],'attributes':_0x3450f4[_0x11af('0x1e')],'include':_0x3450f4[_0x11af('0x20')]?_[_0x11af('0x21')](_0x3450f4[_0x11af('0x20')],function(_0x55641c){return{'model':db[_0x55641c[_0x11af('0x22')]],'as':_0x55641c['as'],'attributes':_0x55641c[_0x11af('0x1e')],'include':_0x55641c[_0x11af('0x20')]?_[_0x11af('0x21')](_0x55641c[_0x11af('0x20')],function(_0x1d2900){return{'model':db[_0x1d2900[_0x11af('0x22')]],'as':_0x1d2900['as'],'attributes':_0x1d2900[_0x11af('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x11af('0xf')](function(_0x5ed8a4){logger[_0x11af('0x16')](_0x11af('0x23'),_0x14cb57);logger[_0x11af('0x11')](_0x11af('0x23'),_0x14cb57,JSON[_0x11af('0x24')](_0x5ed8a4));_0x47177e(_0x5ed8a4);})[_0x11af('0x18')](function(_0x48a8bb){logger[_0x11af('0x13')](_0x11af('0x23'),_0x48a8bb[_0x11af('0x15')],_0x14cb57);_0x412aea(_0x1f2910[_0x11af('0x13')](0x1f4,_0x48a8bb[_0x11af('0x15')]));});});};exports[_0x11af('0x25')]=function(_0xf9a8db){var _0x2669e1=this;return new Promise(function(_0x2006a0,_0x3398f7){return db[_0x11af('0x19')][_0x11af('0x26')](_0xf9a8db[_0x11af('0x27')],{'raw':_0xf9a8db[_0x11af('0x1b')]?_0xf9a8db['options'][_0x11af('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x48bfd8){logger['info']('CreateMemberReport',_0xf9a8db);logger[_0x11af('0x11')](_0x11af('0x25'),_0xf9a8db,JSON[_0x11af('0x24')](_0x48bfd8));_0x2006a0(_0x48bfd8);})[_0x11af('0x18')](function(_0x58b89a){logger[_0x11af('0x13')](_0x11af('0x25'),_0x58b89a['message'],_0xf9a8db);_0x3398f7(_0x2669e1['error'](0x1f4,_0x58b89a[_0x11af('0x15')]));});});};exports[_0x11af('0x28')]=function(_0x31ac86){var _0x4b7e9b=this;return new Promise(function(_0x31cdfb,_0x3e8bd8){return db[_0x11af('0x19')][_0x11af('0x29')](_0x31ac86[_0x11af('0x27')],{'raw':_0x31ac86['options']?_0x31ac86['options'][_0x11af('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31ac86[_0x11af('0x1b')]?_0x31ac86[_0x11af('0x1b')][_0x11af('0x1d')]||null:null,'attributes':_0x31ac86['options']?_0x31ac86[_0x11af('0x1b')]['attributes']||null:null,'limit':_0x31ac86['options']?_0x31ac86[_0x11af('0x1b')][_0x11af('0x1f')]||null:null})[_0x11af('0xf')](function(_0x334769){logger[_0x11af('0x16')](_0x11af('0x28'),_0x31ac86);logger[_0x11af('0x11')]('UpdateMemberReport',_0x31ac86,JSON[_0x11af('0x24')](_0x334769));_0x31cdfb(_0x334769);})[_0x11af('0x18')](function(_0x4d58b2){logger['error']('UpdateMemberReport',_0x4d58b2[_0x11af('0x15')],_0x31ac86);_0x3e8bd8(_0x4b7e9b[_0x11af('0x13')](0x1f4,_0x4d58b2[_0x11af('0x15')]));});});}; \ No newline at end of file +var _0x3b7e=['MemberReport','create','body','UpdateMemberReport','update','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','request\x20sent','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetMemberReport','CreateMemberReport'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3b7e,0x181));var _0xe3b7=function(_0x2777a1,_0x4ac184){_0x2777a1=_0x2777a1-0x0;var _0x2eb2bb=_0x3b7e[_0x2777a1];return _0x2eb2bb;};'use strict';var _=require('lodash');var util=require(_0xe3b7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe3b7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3b7('0x2'))['db'];var utils=require(_0xe3b7('0x3'));var logger=require(_0xe3b7('0x4'))('rpc');var config=require(_0xe3b7('0x5'));var jayson=require(_0xe3b7('0x6'));var client=jayson[_0xe3b7('0x7')][_0xe3b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d3296,_0x566fce,_0x1f0cee){return new BPromise(function(_0x423e45,_0x3a8ab5){return client[_0xe3b7('0x9')](_0x2d3296,_0x1f0cee)['then'](function(_0x5320eb){logger[_0xe3b7('0xa')]('MemberReport,\x20%s,\x20%s',_0x566fce,'request\x20sent');logger[_0xe3b7('0xb')](_0xe3b7('0xc'),_0x566fce,'request\x20sent',JSON[_0xe3b7('0xd')](_0x5320eb));if(_0x5320eb[_0xe3b7('0xe')]){if(_0x5320eb[_0xe3b7('0xe')][_0xe3b7('0xf')]===0x1f4){logger[_0xe3b7('0xe')](_0xe3b7('0x10'),_0x566fce,_0x5320eb[_0xe3b7('0xe')][_0xe3b7('0x11')]);return _0x3a8ab5(_0x5320eb[_0xe3b7('0xe')]['message']);}logger[_0xe3b7('0xe')](_0xe3b7('0x10'),_0x566fce,_0x5320eb[_0xe3b7('0xe')][_0xe3b7('0x11')]);return _0x423e45(_0x5320eb['error'][_0xe3b7('0x11')]);}else{logger['info'](_0xe3b7('0x10'),_0x566fce,_0xe3b7('0x12'));_0x423e45(_0x5320eb[_0xe3b7('0x13')][_0xe3b7('0x11')]);}})[_0xe3b7('0x14')](function(_0x28b4b8){logger[_0xe3b7('0xe')](_0xe3b7('0x10'),_0x566fce,_0x28b4b8);_0x3a8ab5(_0x28b4b8);});});}exports['GetMemberReport']=function(_0x1305fb){var _0x357109=this;return new Promise(function(_0x35909a,_0x845470){return db['MemberReport'][_0xe3b7('0x15')]({'raw':_0x1305fb[_0xe3b7('0x16')]?_0x1305fb['options'][_0xe3b7('0x17')]===undefined?!![]:![]:!![],'where':_0x1305fb[_0xe3b7('0x16')]?_0x1305fb[_0xe3b7('0x16')][_0xe3b7('0x18')]||null:null,'attributes':_0x1305fb[_0xe3b7('0x16')]?_0x1305fb[_0xe3b7('0x16')][_0xe3b7('0x19')]||null:null,'limit':_0x1305fb[_0xe3b7('0x16')]?_0x1305fb['options'][_0xe3b7('0x1a')]||null:null,'include':_0x1305fb[_0xe3b7('0x16')]?_0x1305fb[_0xe3b7('0x16')][_0xe3b7('0x1b')]?_[_0xe3b7('0x1c')](_0x1305fb[_0xe3b7('0x16')][_0xe3b7('0x1b')],function(_0x469da4){return{'model':db[_0x469da4['model']],'as':_0x469da4['as'],'attributes':_0x469da4['attributes'],'include':_0x469da4[_0xe3b7('0x1b')]?_[_0xe3b7('0x1c')](_0x469da4[_0xe3b7('0x1b')],function(_0x414e5f){return{'model':db[_0x414e5f[_0xe3b7('0x1d')]],'as':_0x414e5f['as'],'attributes':_0x414e5f[_0xe3b7('0x19')],'include':_0x414e5f[_0xe3b7('0x1b')]?_[_0xe3b7('0x1c')](_0x414e5f[_0xe3b7('0x1b')],function(_0x128c1c){return{'model':db[_0x128c1c[_0xe3b7('0x1d')]],'as':_0x128c1c['as'],'attributes':_0x128c1c[_0xe3b7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe3b7('0x1e')](function(_0xb2cccc){logger[_0xe3b7('0xa')](_0xe3b7('0x1f'),_0x1305fb);logger[_0xe3b7('0xb')]('GetMemberReport',_0x1305fb,JSON[_0xe3b7('0xd')](_0xb2cccc));_0x35909a(_0xb2cccc);})[_0xe3b7('0x14')](function(_0x1db76c){logger['error'](_0xe3b7('0x1f'),_0x1db76c[_0xe3b7('0x11')],_0x1305fb);_0x845470(_0x357109[_0xe3b7('0xe')](0x1f4,_0x1db76c['message']));});});};exports[_0xe3b7('0x20')]=function(_0x19bc7a){var _0x3c5a25=this;return new Promise(function(_0x17f034,_0x3293fa){return db[_0xe3b7('0x21')][_0xe3b7('0x22')](_0x19bc7a[_0xe3b7('0x23')],{'raw':_0x19bc7a[_0xe3b7('0x16')]?_0x19bc7a[_0xe3b7('0x16')][_0xe3b7('0x17')]===undefined?!![]:![]:!![]})[_0xe3b7('0x1e')](function(_0x108469){logger['info'](_0xe3b7('0x20'),_0x19bc7a);logger[_0xe3b7('0xb')](_0xe3b7('0x20'),_0x19bc7a,JSON[_0xe3b7('0xd')](_0x108469));_0x17f034(_0x108469);})['catch'](function(_0x462a5c){logger['error'](_0xe3b7('0x20'),_0x462a5c[_0xe3b7('0x11')],_0x19bc7a);_0x3293fa(_0x3c5a25[_0xe3b7('0xe')](0x1f4,_0x462a5c[_0xe3b7('0x11')]));});});};exports[_0xe3b7('0x24')]=function(_0x53171b){var _0x23626f=this;return new Promise(function(_0x1b2047,_0x26a76a){return db['MemberReport'][_0xe3b7('0x25')](_0x53171b[_0xe3b7('0x23')],{'raw':_0x53171b[_0xe3b7('0x16')]?_0x53171b['options'][_0xe3b7('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53171b[_0xe3b7('0x16')]?_0x53171b[_0xe3b7('0x16')][_0xe3b7('0x18')]||null:null,'attributes':_0x53171b[_0xe3b7('0x16')]?_0x53171b['options']['attributes']||null:null,'limit':_0x53171b[_0xe3b7('0x16')]?_0x53171b['options'][_0xe3b7('0x1a')]||null:null})[_0xe3b7('0x1e')](function(_0x451718){logger[_0xe3b7('0xa')](_0xe3b7('0x24'),_0x53171b);logger[_0xe3b7('0xb')](_0xe3b7('0x24'),_0x53171b,JSON[_0xe3b7('0xd')](_0x451718));_0x1b2047(_0x451718);})['catch'](function(_0x20b9e5){logger[_0xe3b7('0xe')](_0xe3b7('0x24'),_0x20b9e5[_0xe3b7('0x11')],_0x53171b);_0x26a76a(_0x23626f[_0xe3b7('0xe')](0x1f4,_0x20b9e5[_0xe3b7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 9dd483c..5f0b583 100644 --- a/server/api/migration/index.js +++ b/server/api/migration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c00=['index','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x5d9e22,_0x24dd29){var _0x37a4f2=function(_0xc93d9b){while(--_0xc93d9b){_0x5d9e22['push'](_0x5d9e22['shift']());}};_0x37a4f2(++_0x24dd29);}(_0x5c00,0x17e));var _0x05c0=function(_0x98ac1f,_0x2effb0){_0x98ac1f=_0x98ac1f-0x0;var _0x1579d1=_0x5c00[_0x98ac1f];return _0x1579d1;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var auth=require(_0x05c0('0x4'));var interaction=require(_0x05c0('0x5'));var config=require(_0x05c0('0x6'));var controller=require(_0x05c0('0x7'));router['get']('/',controller[_0x05c0('0x8')]);module[_0x05c0('0x9')]=router; \ No newline at end of file +var _0x4cf8=['index','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0x1aafbd,_0x294066){var _0x4a4ae5=function(_0x45b098){while(--_0x45b098){_0x1aafbd['push'](_0x1aafbd['shift']());}};_0x4a4ae5(++_0x294066);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0x4cf8[_0x587693];return _0x510a1a;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var auth=require(_0x84cf('0x6'));var interaction=require(_0x84cf('0x7'));var config=require(_0x84cf('0x8'));var controller=require(_0x84cf('0x9'));router[_0x84cf('0xa')]('/',controller[_0x84cf('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index dfad493..d183c76 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 _0xc5a4=['sequelize','exports','STRING','version'];(function(_0x540315,_0x5e4286){var _0x45b752=function(_0x42f23e){while(--_0x42f23e){_0x540315['push'](_0x540315['shift']());}};_0x45b752(++_0x5e4286);}(_0xc5a4,0x184));var _0x4c5a=function(_0x113708,_0x3b72d5){_0x113708=_0x113708-0x0;var _0x33fc82=_0xc5a4[_0x113708];return _0x33fc82;};'use strict';var Sequelize=require(_0x4c5a('0x0'));module[_0x4c5a('0x1')]={'version':{'type':Sequelize[_0x4c5a('0x2')],'unique':_0x4c5a('0x3')}}; \ No newline at end of file +var _0x88ac=['version','sequelize','exports'];(function(_0x1e808f,_0x19a057){var _0x6d3ccf=function(_0x907c6f){while(--_0x907c6f){_0x1e808f['push'](_0x1e808f['shift']());}};_0x6d3ccf(++_0x19a057);}(_0x88ac,0x157));var _0xc88a=function(_0x40edbb,_0x4b8e85){_0x40edbb=_0x40edbb-0x0;var _0x1c34e1=_0x88ac[_0x40edbb];return _0x1c34e1;};'use strict';var Sequelize=require(_0xc88a('0x0'));module[_0xc88a('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0xc88a('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 47cf8c3..083f1cc 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 _0x0655=['fast-json-patch','request-promise','moment','bluebird','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x5db3ac,_0x3bc46f){var _0x43aab4=function(_0x1aeadc){while(--_0x1aeadc){_0x5db3ac['push'](_0x5db3ac['shift']());}};_0x43aab4(++_0x3bc46f);}(_0x0655,0x10c));var _0x5065=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x0655[_0x3b1b23];return _0x1efc85;};'use strict';var pdf=require(_0x5065('0x0'));var emlformat=require(_0x5065('0x1'));var rimraf=require(_0x5065('0x2'));var zipdir=require(_0x5065('0x3'));var jsonpatch=require(_0x5065('0x4'));var rp=require(_0x5065('0x5'));var moment=require(_0x5065('0x6'));var BPromise=require(_0x5065('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5065('0x8'));var fs=require('fs');var _=require(_0x5065('0x9'));var squel=require(_0x5065('0xa'));var crypto=require(_0x5065('0xb'));var jsforce=require(_0x5065('0xc'));var deskjs=require(_0x5065('0xd'));var toCsv=require(_0x5065('0xe'));var querystring=require(_0x5065('0xf'));var Papa=require(_0x5065('0x10'));var Redis=require('ioredis');var authService=require(_0x5065('0x11'));var qs=require(_0x5065('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5065('0x13'));var logger=require('../../config/logger')(_0x5065('0x14'));var utils=require(_0x5065('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5065('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5333cc,_0x7fa4f1){_0x7fa4f1=_0x7fa4f1||0xcc;return function(_0x5dc02c){if(_0x5dc02c){return _0x5333cc['sendStatus'](_0x7fa4f1);}return _0x5333cc[_0x5065('0x17')](_0x7fa4f1)[_0x5065('0x18')]();};}function respondWithResult(_0x4e4564,_0x227bae){_0x227bae=_0x227bae||0xc8;return function(_0x4e0a1c){if(_0x4e0a1c){return _0x4e4564[_0x5065('0x17')](_0x227bae)[_0x5065('0x19')](_0x4e0a1c);}};}function respondWithFilteredResult(_0x1284d3,_0x5ae197){return function(_0x3f400b){if(_0x3f400b){var _0x1d4d2e=_0x3f400b['count'],_0x572b29=_0x5ae197[_0x5065('0x1a')],_0x2bd058=_0x5ae197['offset']+_0x5ae197[_0x5065('0x1b')],_0x18de33;if(_0x2bd058>=_0x1d4d2e){_0x2bd058=_0x1d4d2e;_0x18de33=0xc8;}else{_0x18de33=0xce;}_0x1284d3[_0x5065('0x17')](_0x18de33);return _0x1284d3['set'](_0x5065('0x1c'),_0x572b29+'-'+_0x2bd058+'/'+_0x1d4d2e)['json'](_0x3f400b);}return null;};}function patchUpdates(_0x3d90f9){return function(_0x4f6529){try{jsonpatch[_0x5065('0x1d')](_0x4f6529,_0x3d90f9,!![]);}catch(_0x1d714d){return BPromise[_0x5065('0x1e')](_0x1d714d);}return _0x4f6529[_0x5065('0x1f')]();};}function saveUpdates(_0x491793,_0x48ecfb){return function(_0x5cbd84){if(_0x5cbd84){return _0x5cbd84['update'](_0x491793)[_0x5065('0x20')](function(_0x2ba9d4){return _0x2ba9d4;});}return null;};}function removeEntity(_0x518010,_0x565c3b){return function(_0x3887d8){if(_0x3887d8){return _0x3887d8[_0x5065('0x21')]()[_0x5065('0x20')](function(){_0x518010[_0x5065('0x17')](0xcc)[_0x5065('0x18')]();});}};}function handleEntityNotFound(_0x48a517,_0x2882db){return function(_0x431d67){if(!_0x431d67){_0x48a517[_0x5065('0x22')](0x194);}return _0x431d67;};}function handleError(_0x2e6b0e,_0x2430d1){_0x2430d1=_0x2430d1||0x1f4;return function(_0x3995c1){logger[_0x5065('0x23')](_0x3995c1[_0x5065('0x24')]);if(_0x3995c1[_0x5065('0x25')]){delete _0x3995c1[_0x5065('0x25')];}_0x2e6b0e[_0x5065('0x17')](_0x2430d1)[_0x5065('0x26')](_0x3995c1);};}exports[_0x5065('0x27')]=function(_0xc26a8d,_0x509eab){var _0x4c3c1a={},_0x57303a={},_0x5b1488={'count':0x0,'rows':[]};var _0x478e19=_[_0x5065('0x28')](db[_0x5065('0x29')][_0x5065('0x2a')],function(_0x2c8046){return{'name':_0x2c8046[_0x5065('0x2b')],'type':_0x2c8046[_0x5065('0x2c')][_0x5065('0x2d')]};});_0x57303a[_0x5065('0x2e')]=_['map'](_0x478e19,_0x5065('0x25'));_0x57303a[_0x5065('0x2f')]=_[_0x5065('0x30')](_0xc26a8d['query']);_0x57303a[_0x5065('0x31')]=_[_0x5065('0x32')](_0x57303a[_0x5065('0x2e')],_0x57303a[_0x5065('0x2f')]);_0x4c3c1a[_0x5065('0x33')]=_[_0x5065('0x32')](_0x57303a[_0x5065('0x2e')],qs[_0x5065('0x34')](_0xc26a8d[_0x5065('0x2f')][_0x5065('0x34')]));_0x4c3c1a[_0x5065('0x33')]=_0x4c3c1a[_0x5065('0x33')]['length']?_0x4c3c1a[_0x5065('0x33')]:_0x57303a['model'];if(!_0xc26a8d[_0x5065('0x2f')]['hasOwnProperty'](_0x5065('0x35'))){_0x4c3c1a['limit']=qs[_0x5065('0x1b')](_0xc26a8d[_0x5065('0x2f')][_0x5065('0x1b')]);_0x4c3c1a[_0x5065('0x1a')]=qs[_0x5065('0x1a')](_0xc26a8d[_0x5065('0x2f')][_0x5065('0x1a')]);}_0x4c3c1a[_0x5065('0x36')]=qs['sort'](_0xc26a8d[_0x5065('0x2f')][_0x5065('0x37')]);_0x4c3c1a[_0x5065('0x38')]=qs[_0x5065('0x31')](_[_0x5065('0x39')](_0xc26a8d[_0x5065('0x2f')],_0x57303a[_0x5065('0x31')]),_0x478e19);if(_0xc26a8d[_0x5065('0x2f')][_0x5065('0x3a')]){_0x4c3c1a['where']=_['merge'](_0x4c3c1a[_0x5065('0x38')],{'$or':_[_0x5065('0x28')](_0x478e19,function(_0x25e773){if(_0x25e773[_0x5065('0x2c')]!==_0x5065('0x3b')){var _0x11e7ea={};_0x11e7ea[_0x25e773['name']]={'$like':'%'+_0xc26a8d[_0x5065('0x2f')][_0x5065('0x3a')]+'%'};return _0x11e7ea;}})});}_0x4c3c1a=_[_0x5065('0x3c')]({},_0x4c3c1a,_0xc26a8d[_0x5065('0x3d')]);var _0xc3e8f7={'where':_0x4c3c1a[_0x5065('0x38')]};return db[_0x5065('0x29')][_0x5065('0x3e')](_0xc3e8f7)[_0x5065('0x20')](function(_0x27ff87){_0x5b1488[_0x5065('0x3e')]=_0x27ff87;if(_0xc26a8d[_0x5065('0x2f')][_0x5065('0x3f')]){_0x4c3c1a[_0x5065('0x40')]=[{'all':!![]}];}return db[_0x5065('0x29')][_0x5065('0x41')](_0x4c3c1a);})[_0x5065('0x20')](function(_0x51c60e){_0x5b1488[_0x5065('0x42')]=_0x51c60e;return _0x5b1488;})[_0x5065('0x20')](respondWithFilteredResult(_0x509eab,_0x4c3c1a))[_0x5065('0x43')](handleError(_0x509eab,null));}; \ No newline at end of file +var _0x19a1=['json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Migration','rawAttributes','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','count','offset','limit','Content-Range'];(function(_0x5cb3c7,_0x5b2a38){var _0x16dc78=function(_0x5828e4){while(--_0x5828e4){_0x5cb3c7['push'](_0x5cb3c7['shift']());}};_0x16dc78(++_0x5b2a38);}(_0x19a1,0x66));var _0x119a=function(_0x4ea809,_0x5416a6){_0x4ea809=_0x4ea809-0x0;var _0x31be45=_0x19a1[_0x4ea809];return _0x31be45;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x119a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x119a('0x1'));var rp=require('request-promise');var moment=require(_0x119a('0x2'));var BPromise=require(_0x119a('0x3'));var Mustache=require(_0x119a('0x4'));var util=require(_0x119a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x119a('0x6'));var ejs=require(_0x119a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x119a('0x8'));var crypto=require(_0x119a('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x119a('0xa'));var Redis=require(_0x119a('0xb'));var authService=require(_0x119a('0xc'));var qs=require(_0x119a('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x119a('0xe'));var logger=require(_0x119a('0xf'))(_0x119a('0x10'));var utils=require('../../config/utils');var config=require(_0x119a('0x11'));var licenseUtil=require(_0x119a('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e2de7,_0x49cb4d){_0x49cb4d=_0x49cb4d||0xcc;return function(_0xc3c9af){if(_0xc3c9af){return _0x3e2de7['sendStatus'](_0x49cb4d);}return _0x3e2de7[_0x119a('0x13')](_0x49cb4d)['end']();};}function respondWithResult(_0x5db212,_0x1fc692){_0x1fc692=_0x1fc692||0xc8;return function(_0x35fe07){if(_0x35fe07){return _0x5db212[_0x119a('0x13')](_0x1fc692)['json'](_0x35fe07);}};}function respondWithFilteredResult(_0x5952f6,_0xc43e53){return function(_0x15a846){if(_0x15a846){var _0x266be8=_0x15a846[_0x119a('0x14')],_0x554b37=_0xc43e53['offset'],_0x2427f9=_0xc43e53[_0x119a('0x15')]+_0xc43e53[_0x119a('0x16')],_0x3bcf34;if(_0x2427f9>=_0x266be8){_0x2427f9=_0x266be8;_0x3bcf34=0xc8;}else{_0x3bcf34=0xce;}_0x5952f6[_0x119a('0x13')](_0x3bcf34);return _0x5952f6['set'](_0x119a('0x17'),_0x554b37+'-'+_0x2427f9+'/'+_0x266be8)[_0x119a('0x18')](_0x15a846);}return null;};}function patchUpdates(_0x304b81){return function(_0x2815fc){try{jsonpatch[_0x119a('0x19')](_0x2815fc,_0x304b81,!![]);}catch(_0x5f2f3b){return BPromise[_0x119a('0x1a')](_0x5f2f3b);}return _0x2815fc[_0x119a('0x1b')]();};}function saveUpdates(_0x2c9758,_0x3fc183){return function(_0x183210){if(_0x183210){return _0x183210[_0x119a('0x1c')](_0x2c9758)[_0x119a('0x1d')](function(_0x2fb1e3){return _0x2fb1e3;});}return null;};}function removeEntity(_0x160d3c,_0x2e077c){return function(_0x57830c){if(_0x57830c){return _0x57830c[_0x119a('0x1e')]()[_0x119a('0x1d')](function(){_0x160d3c[_0x119a('0x13')](0xcc)[_0x119a('0x1f')]();});}};}function handleEntityNotFound(_0x51dcf4,_0x22c178){return function(_0x2fe55b){if(!_0x2fe55b){_0x51dcf4[_0x119a('0x20')](0x194);}return _0x2fe55b;};}function handleError(_0x2669eb,_0xbd1fe5){_0xbd1fe5=_0xbd1fe5||0x1f4;return function(_0x479592){logger[_0x119a('0x21')](_0x479592[_0x119a('0x22')]);if(_0x479592[_0x119a('0x23')]){delete _0x479592['name'];}_0x2669eb[_0x119a('0x13')](_0xbd1fe5)[_0x119a('0x24')](_0x479592);};}exports[_0x119a('0x25')]=function(_0x54d409,_0x33c17a){var _0x3ed1fa={},_0x47903c={},_0x4abe91={'count':0x0,'rows':[]};var _0x137263=_[_0x119a('0x26')](db[_0x119a('0x27')][_0x119a('0x28')],function(_0x7d36ba){return{'name':_0x7d36ba['fieldName'],'type':_0x7d36ba[_0x119a('0x29')]['key']};});_0x47903c[_0x119a('0x2a')]=_[_0x119a('0x26')](_0x137263,_0x119a('0x23'));_0x47903c['query']=_[_0x119a('0x2b')](_0x54d409[_0x119a('0x2c')]);_0x47903c['filters']=_[_0x119a('0x2d')](_0x47903c['model'],_0x47903c['query']);_0x3ed1fa[_0x119a('0x2e')]=_[_0x119a('0x2d')](_0x47903c[_0x119a('0x2a')],qs[_0x119a('0x2f')](_0x54d409[_0x119a('0x2c')][_0x119a('0x2f')]));_0x3ed1fa['attributes']=_0x3ed1fa[_0x119a('0x2e')]['length']?_0x3ed1fa[_0x119a('0x2e')]:_0x47903c[_0x119a('0x2a')];if(!_0x54d409[_0x119a('0x2c')][_0x119a('0x30')](_0x119a('0x31'))){_0x3ed1fa[_0x119a('0x16')]=qs['limit'](_0x54d409['query'][_0x119a('0x16')]);_0x3ed1fa['offset']=qs['offset'](_0x54d409['query'][_0x119a('0x15')]);}_0x3ed1fa[_0x119a('0x32')]=qs[_0x119a('0x33')](_0x54d409[_0x119a('0x2c')]['sort']);_0x3ed1fa[_0x119a('0x34')]=qs[_0x119a('0x35')](_[_0x119a('0x36')](_0x54d409['query'],_0x47903c[_0x119a('0x35')]),_0x137263);if(_0x54d409[_0x119a('0x2c')][_0x119a('0x37')]){_0x3ed1fa['where']=_[_0x119a('0x38')](_0x3ed1fa[_0x119a('0x34')],{'$or':_['map'](_0x137263,function(_0x1bdf65){if(_0x1bdf65[_0x119a('0x29')]!==_0x119a('0x39')){var _0x1821df={};_0x1821df[_0x1bdf65[_0x119a('0x23')]]={'$like':'%'+_0x54d409[_0x119a('0x2c')][_0x119a('0x37')]+'%'};return _0x1821df;}})});}_0x3ed1fa=_[_0x119a('0x38')]({},_0x3ed1fa,_0x54d409[_0x119a('0x3a')]);var _0x46dbf0={'where':_0x3ed1fa[_0x119a('0x34')]};return db[_0x119a('0x27')]['count'](_0x46dbf0)[_0x119a('0x1d')](function(_0x24ce94){_0x4abe91['count']=_0x24ce94;if(_0x54d409['query'][_0x119a('0x3b')]){_0x3ed1fa['include']=[{'all':!![]}];}return db[_0x119a('0x27')][_0x119a('0x3c')](_0x3ed1fa);})[_0x119a('0x1d')](function(_0xc245ab){_0x4abe91[_0x119a('0x3d')]=_0xc245ab;return _0x4abe91;})[_0x119a('0x1d')](respondWithFilteredResult(_0x33c17a,_0x3ed1fa))[_0x119a('0x3e')](handleError(_0x33c17a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index eaae279..bc15bf7 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 _0x2189=['rimraf','./migration.attributes','exports','define','Migration','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x281db5,_0x286121){var _0x29f4bb=function(_0x57abaf){while(--_0x57abaf){_0x281db5['push'](_0x281db5['shift']());}};_0x29f4bb(++_0x286121);}(_0x2189,0x101));var _0x9218=function(_0x14c997,_0x23ba9b){_0x14c997=_0x14c997-0x0;var _0x5474d1=_0x2189[_0x14c997];return _0x5474d1;};'use strict';var _=require('lodash');var util=require(_0x9218('0x0'));var logger=require(_0x9218('0x1'))(_0x9218('0x2'));var moment=require(_0x9218('0x3'));var BPromise=require(_0x9218('0x4'));var rp=require(_0x9218('0x5'));var fs=require('fs');var path=require(_0x9218('0x6'));var rimraf=require(_0x9218('0x7'));var config=require('../../config/environment');var attributes=require(_0x9218('0x8'));module[_0x9218('0x9')]=function(_0x54e7a4,_0x3b9197){return _0x54e7a4[_0x9218('0xa')](_0x9218('0xb'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd387=['moment','bluebird','../../config/environment','./migration.attributes','exports','define','Migration','../../config/logger'];(function(_0x571bbc,_0x242132){var _0x3e8edb=function(_0x5cc0a2){while(--_0x5cc0a2){_0x571bbc['push'](_0x571bbc['shift']());}};_0x3e8edb(++_0x242132);}(_0xd387,0x197));var _0x7d38=function(_0x43ae14,_0xd2cce0){_0x43ae14=_0x43ae14-0x0;var _0x51ef24=_0xd387[_0x43ae14];return _0x51ef24;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d38('0x0'))('api');var moment=require(_0x7d38('0x1'));var BPromise=require(_0x7d38('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d38('0x3'));var attributes=require(_0x7d38('0x4'));module[_0x7d38('0x5')]=function(_0x53311a,_0x411cf2){return _0x53311a[_0x7d38('0x6')](_0x7d38('0x7'),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 52c09dc..30fbc0b 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 _0x5aaa=['Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','Migration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x54e73b,_0x3956ae){var _0x357c4f=function(_0x3315d3){while(--_0x3315d3){_0x54e73b['push'](_0x54e73b['shift']());}};_0x357c4f(++_0x3956ae);}(_0x5aaa,0xeb));var _0xa5aa=function(_0xc206e4,_0x3467f6){_0xc206e4=_0xc206e4-0x0;var _0x46c3f6=_0x5aaa[_0xc206e4];return _0x46c3f6;};'use strict';var _=require(_0xa5aa('0x0'));var util=require(_0xa5aa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa5aa('0x2'));var fs=require('fs');var Redis=require(_0xa5aa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5aa('0x4'));var logger=require(_0xa5aa('0x5'))('rpc');var config=require(_0xa5aa('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa5aa('0x7')][_0xa5aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48b057,_0x1338c4,_0x1e63f3){return new BPromise(function(_0x342598,_0x16e8bf){return client['request'](_0x48b057,_0x1e63f3)['then'](function(_0x46fa86){logger['info'](_0xa5aa('0x9'),_0x1338c4,_0xa5aa('0xa'));logger[_0xa5aa('0xb')](_0xa5aa('0xc'),_0x1338c4,_0xa5aa('0xa'),JSON[_0xa5aa('0xd')](_0x46fa86));if(_0x46fa86[_0xa5aa('0xe')]){if(_0x46fa86[_0xa5aa('0xe')][_0xa5aa('0xf')]===0x1f4){logger[_0xa5aa('0xe')]('Migration,\x20%s,\x20%s',_0x1338c4,_0x46fa86[_0xa5aa('0xe')][_0xa5aa('0x10')]);return _0x16e8bf(_0x46fa86['error'][_0xa5aa('0x10')]);}logger['error'](_0xa5aa('0x9'),_0x1338c4,_0x46fa86[_0xa5aa('0xe')]['message']);return _0x342598(_0x46fa86[_0xa5aa('0xe')]['message']);}else{logger['info']('Migration,\x20%s,\x20%s',_0x1338c4,_0xa5aa('0xa'));_0x342598(_0x46fa86[_0xa5aa('0x11')]['message']);}})[_0xa5aa('0x12')](function(_0x12cf15){logger['error'](_0xa5aa('0x9'),_0x1338c4,_0x12cf15);_0x16e8bf(_0x12cf15);});});} \ No newline at end of file +var _0x89a4=['result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message'];(function(_0x3ed091,_0x3491d4){var _0x49f07c=function(_0x296cbc){while(--_0x296cbc){_0x3ed091['push'](_0x3ed091['shift']());}};_0x49f07c(++_0x3491d4);}(_0x89a4,0x1e4));var _0x489a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x89a4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x489a('0x0'));var moment=require(_0x489a('0x1'));var BPromise=require(_0x489a('0x2'));var rs=require(_0x489a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x489a('0x4'))['db'];var utils=require(_0x489a('0x5'));var logger=require(_0x489a('0x6'))(_0x489a('0x7'));var config=require(_0x489a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x489a('0x9')][_0x489a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2289d7,_0xc9f8b5,_0xdb09d7){return new BPromise(function(_0x2bb1cf,_0x3b3425){return client[_0x489a('0xb')](_0x2289d7,_0xdb09d7)[_0x489a('0xc')](function(_0x3fd509){logger[_0x489a('0xd')]('Migration,\x20%s,\x20%s',_0xc9f8b5,_0x489a('0xe'));logger[_0x489a('0xf')](_0x489a('0x10'),_0xc9f8b5,_0x489a('0xe'),JSON[_0x489a('0x11')](_0x3fd509));if(_0x3fd509[_0x489a('0x12')]){if(_0x3fd509[_0x489a('0x12')][_0x489a('0x13')]===0x1f4){logger['error'](_0x489a('0x14'),_0xc9f8b5,_0x3fd509[_0x489a('0x12')][_0x489a('0x15')]);return _0x3b3425(_0x3fd509[_0x489a('0x12')][_0x489a('0x15')]);}logger[_0x489a('0x12')]('Migration,\x20%s,\x20%s',_0xc9f8b5,_0x3fd509[_0x489a('0x12')]['message']);return _0x2bb1cf(_0x3fd509['error'][_0x489a('0x15')]);}else{logger[_0x489a('0xd')]('Migration,\x20%s,\x20%s',_0xc9f8b5,_0x489a('0xe'));_0x2bb1cf(_0x3fd509[_0x489a('0x16')]['message']);}})['catch'](function(_0x539bda){logger[_0x489a('0x12')](_0x489a('0x14'),_0xc9f8b5,_0x539bda);_0x3b3425(_0x539bda);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index a980556..95a74ac 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 _0x9269=['show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','../../config/environment','./network.controller','get','isAuthenticated','index'];(function(_0x2e537c,_0x13408a){var _0x13d3b7=function(_0x5a2382){while(--_0x5a2382){_0x2e537c['push'](_0x2e537c['shift']());}};_0x13d3b7(++_0x13408a);}(_0x9269,0x147));var _0x9926=function(_0x2ac5de,_0x2cebca){_0x2ac5de=_0x2ac5de-0x0;var _0x1415b2=_0x9269[_0x2ac5de];return _0x1415b2;};'use strict';var multer=require(_0x9926('0x0'));var util=require('util');var path=require(_0x9926('0x1'));var timeout=require(_0x9926('0x2'));var express=require(_0x9926('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9926('0x4'));var controller=require(_0x9926('0x5'));router[_0x9926('0x6')]('/',auth[_0x9926('0x7')](),controller[_0x9926('0x8')]);router[_0x9926('0x6')]('/:id',auth[_0x9926('0x7')](),controller[_0x9926('0x9')]);router[_0x9926('0xa')]('/',auth[_0x9926('0x7')](),controller[_0x9926('0xb')]);router[_0x9926('0xc')]('/:id',auth[_0x9926('0x7')](),controller[_0x9926('0xd')]);router['delete']('/:id',auth[_0x9926('0x7')](),controller[_0x9926('0xe')]);module[_0x9926('0xf')]=router; \ No newline at end of file +var _0x6050=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./network.controller','get','post','isAuthenticated'];(function(_0x1cbf4f,_0x80661f){var _0xc03237=function(_0x35e7fb){while(--_0x35e7fb){_0x1cbf4f['push'](_0x1cbf4f['shift']());}};_0xc03237(++_0x80661f);}(_0x6050,0x196));var _0x0605=function(_0x413678,_0x27fad3){_0x413678=_0x413678-0x0;var _0x167d0=_0x6050[_0x413678];return _0x167d0;};'use strict';var multer=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var path=require(_0x0605('0x2'));var timeout=require(_0x0605('0x3'));var express=require(_0x0605('0x4'));var router=express[_0x0605('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0605('0x6'));var config=require(_0x0605('0x7'));var controller=require(_0x0605('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0605('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0605('0xa')]('/',auth[_0x0605('0xb')](),controller[_0x0605('0xc')]);router[_0x0605('0xd')](_0x0605('0xe'),auth['isAuthenticated'](),controller[_0x0605('0xf')]);router[_0x0605('0x10')](_0x0605('0xe'),auth[_0x0605('0xb')](),controller[_0x0605('0x11')]);module[_0x0605('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 6986808..5ff43c3 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(_0x237dde,_0x21f1f4){var _0x7734f8=function(_0x484dcd){while(--_0x484dcd){_0x237dde['push'](_0x237dde['shift']());}};_0x7734f8(++_0x21f1f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x2f314a,_0x5d28ee){var _0x3078a0=function(_0x5ba1c3){while(--_0x5ba1c3){_0x2f314a['push'](_0x2f314a['shift']());}};_0x3078a0(++_0x5d28ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 148dc22..e977657 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 _0x62ef=['fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','params','keys','find','create','transaction','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','join','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','render','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','Reload','update','TURN','server/files/templates/network.ejs','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','Network','rawAttributes'];(function(_0x4927ea,_0xd8e606){var _0x49fe44=function(_0x2e8da9){while(--_0x2e8da9){_0x4927ea['push'](_0x4927ea['shift']());}};_0x49fe44(++_0xd8e606);}(_0x62ef,0x173));var _0xf62e=function(_0x136dbb,_0x2b0666){_0x136dbb=_0x136dbb-0x0;var _0x6a5309=_0x62ef[_0x136dbb];return _0x6a5309;};'use strict';var pdf=require(_0xf62e('0x0'));var emlformat=require(_0xf62e('0x1'));var rimraf=require(_0xf62e('0x2'));var zipdir=require(_0xf62e('0x3'));var jsonpatch=require(_0xf62e('0x4'));var rp=require(_0xf62e('0x5'));var moment=require(_0xf62e('0x6'));var BPromise=require(_0xf62e('0x7'));var Mustache=require(_0xf62e('0x8'));var util=require(_0xf62e('0x9'));var path=require(_0xf62e('0xa'));var sox=require(_0xf62e('0xb'));var csv=require(_0xf62e('0xc'));var ejs=require(_0xf62e('0xd'));var fs=require('fs');var _=require(_0xf62e('0xe'));var squel=require(_0xf62e('0xf'));var crypto=require('crypto');var jsforce=require(_0xf62e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf62e('0xc'));var querystring=require(_0xf62e('0x11'));var Papa=require(_0xf62e('0x12'));var Redis=require(_0xf62e('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf62e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf62e('0x15'))(_0xf62e('0x16'));var utils=require(_0xf62e('0x17'));var config=require(_0xf62e('0x18'));var licenseUtil=require(_0xf62e('0x19'));var db=require(_0xf62e('0x1a'))['db'];var jayson=require(_0xf62e('0x1b'));var client=jayson[_0xf62e('0x1c')][_0xf62e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x46ea9f,_0xe3f951,_0x4aa9be,_0xbfcff2){return new BPromise(function(_0x545775,_0x46de2e){var _0x343b48=_0xbfcff2||client;return _0x343b48[_0xf62e('0x1e')](_0x46ea9f,_0x4aa9be)[_0xf62e('0x1f')](function(_0x263fac){logger[_0xf62e('0x20')](_0xf62e('0x21'),_0xe3f951,_0xf62e('0x22'));logger[_0xf62e('0x23')](_0xf62e('0x24'),_0xe3f951,_0xf62e('0x22'),JSON['stringify'](_0x263fac));if(_0x263fac[_0xf62e('0x25')]){if(_0x263fac[_0xf62e('0x25')][_0xf62e('0x26')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0xe3f951,_0x263fac[_0xf62e('0x25')][_0xf62e('0x27')]);return _0x46de2e(_0x263fac[_0xf62e('0x25')]['message']);}logger[_0xf62e('0x25')]('Network,\x20%s,\x20%s',_0xe3f951,_0x263fac[_0xf62e('0x25')][_0xf62e('0x27')]);return _0x545775(_0x263fac[_0xf62e('0x25')][_0xf62e('0x27')]);}else{logger[_0xf62e('0x20')]('Network,\x20%s,\x20%s',_0xe3f951,_0xf62e('0x22'));_0x545775(_0x263fac[_0xf62e('0x28')]['message']);}})[_0xf62e('0x29')](function(_0x506f41){logger[_0xf62e('0x25')](_0xf62e('0x21'),_0xe3f951,_0x506f41);_0x46de2e(_0x506f41);});});}function respondWithStatusCode(_0x8f5ada,_0xab64aa){_0xab64aa=_0xab64aa||0xcc;return function(_0x55c495){if(_0x55c495){return _0x8f5ada[_0xf62e('0x2a')](_0xab64aa);}return _0x8f5ada['status'](_0xab64aa)[_0xf62e('0x2b')]();};}function respondWithResult(_0x3140d9,_0x4f6480){_0x4f6480=_0x4f6480||0xc8;return function(_0x655182){if(_0x655182){return _0x3140d9[_0xf62e('0x2c')](_0x4f6480)[_0xf62e('0x2d')](_0x655182);}};}function respondWithFilteredResult(_0x30393a,_0x176ebd){return function(_0x3c42f6){if(_0x3c42f6){var _0x5f1ad3=_0x3c42f6[_0xf62e('0x2e')],_0xa98dd1=_0x176ebd[_0xf62e('0x2f')],_0x2fc729=_0x176ebd['offset']+_0x176ebd['limit'],_0x38ef7e;if(_0x2fc729>=_0x5f1ad3){_0x2fc729=_0x5f1ad3;_0x38ef7e=0xc8;}else{_0x38ef7e=0xce;}_0x30393a['status'](_0x38ef7e);return _0x30393a[_0xf62e('0x30')](_0xf62e('0x31'),_0xa98dd1+'-'+_0x2fc729+'/'+_0x5f1ad3)[_0xf62e('0x2d')](_0x3c42f6);}return null;};}function patchUpdates(_0x265c1f){return function(_0x81d4f6){try{jsonpatch[_0xf62e('0x32')](_0x81d4f6,_0x265c1f,!![]);}catch(_0x531efa){return BPromise[_0xf62e('0x33')](_0x531efa);}return _0x81d4f6[_0xf62e('0x34')]();};}function saveUpdates(_0x51ac13,_0x191100){return function(_0x2843f6){if(_0x2843f6){return _0x2843f6['update'](_0x51ac13)[_0xf62e('0x1f')](function(_0x174828){return _0x174828;});}return null;};}function removeEntity(_0x4abe2a,_0x55db24){return function(_0x332bc1){if(_0x332bc1){return _0x332bc1[_0xf62e('0x35')]()['then'](function(){_0x4abe2a['status'](0xcc)[_0xf62e('0x2b')]();});}};}function handleEntityNotFound(_0x4a1f61,_0x4ba605){return function(_0x3dd74e){if(!_0x3dd74e){_0x4a1f61['sendStatus'](0x194);}return _0x3dd74e;};}function handleError(_0x458c21,_0x4365fc){_0x4365fc=_0x4365fc||0x1f4;return function(_0x50d364){logger[_0xf62e('0x25')](_0x50d364[_0xf62e('0x36')]);if(_0x50d364[_0xf62e('0x37')]){delete _0x50d364['name'];}_0x458c21[_0xf62e('0x2c')](_0x4365fc)[_0xf62e('0x38')](_0x50d364);};}exports[_0xf62e('0x39')]=function(_0x3c3201,_0x47591e){var _0x9d707={},_0x4709ac={},_0x4ab2b6={'count':0x0,'rows':[]};var _0x2dda84=_[_0xf62e('0x3a')](db[_0xf62e('0x3b')][_0xf62e('0x3c')],function(_0x389aef){return{'name':_0x389aef[_0xf62e('0x3d')],'type':_0x389aef[_0xf62e('0x3e')][_0xf62e('0x3f')]};});_0x4709ac[_0xf62e('0x40')]=_[_0xf62e('0x3a')](_0x2dda84,'name');_0x4709ac['query']=_['keys'](_0x3c3201[_0xf62e('0x41')]);_0x4709ac['filters']=_[_0xf62e('0x42')](_0x4709ac[_0xf62e('0x40')],_0x4709ac[_0xf62e('0x41')]);_0x9d707[_0xf62e('0x43')]=_['intersection'](_0x4709ac[_0xf62e('0x40')],qs['fields'](_0x3c3201[_0xf62e('0x41')][_0xf62e('0x44')]));_0x9d707[_0xf62e('0x43')]=_0x9d707[_0xf62e('0x43')][_0xf62e('0x45')]?_0x9d707['attributes']:_0x4709ac[_0xf62e('0x40')];if(!_0x3c3201[_0xf62e('0x41')][_0xf62e('0x46')]('nolimit')){_0x9d707[_0xf62e('0x47')]=qs[_0xf62e('0x47')](_0x3c3201[_0xf62e('0x41')]['limit']);_0x9d707['offset']=qs[_0xf62e('0x2f')](_0x3c3201['query']['offset']);}_0x9d707['order']=qs['sort'](_0x3c3201[_0xf62e('0x41')]['sort']);_0x9d707['where']=qs[_0xf62e('0x48')](_['pick'](_0x3c3201[_0xf62e('0x41')],_0x4709ac[_0xf62e('0x48')]),_0x2dda84);if(_0x3c3201[_0xf62e('0x41')][_0xf62e('0x49')]){_0x9d707['where']=_[_0xf62e('0x4a')](_0x9d707[_0xf62e('0x4b')],{'$or':_[_0xf62e('0x3a')](_0x2dda84,function(_0x1c73d6){if(_0x1c73d6[_0xf62e('0x3e')]!==_0xf62e('0x4c')){var _0x4f731e={};_0x4f731e[_0x1c73d6[_0xf62e('0x37')]]={'$like':'%'+_0x3c3201['query'][_0xf62e('0x49')]+'%'};return _0x4f731e;}})});}_0x9d707=_[_0xf62e('0x4a')]({},_0x9d707,_0x3c3201[_0xf62e('0x4d')]);var _0x233507={'where':_0x9d707['where']};return db[_0xf62e('0x3b')][_0xf62e('0x2e')](_0x233507)[_0xf62e('0x1f')](function(_0x5d0531){_0x4ab2b6[_0xf62e('0x2e')]=_0x5d0531;if(_0x3c3201[_0xf62e('0x41')][_0xf62e('0x4e')]){_0x9d707[_0xf62e('0x4f')]=[{'all':!![]}];}return db['Network'][_0xf62e('0x50')](_0x9d707);})[_0xf62e('0x1f')](function(_0x2fdf4f){_0x4ab2b6['rows']=_0x2fdf4f;return _0x4ab2b6;})[_0xf62e('0x1f')](respondWithFilteredResult(_0x47591e,_0x9d707))[_0xf62e('0x29')](handleError(_0x47591e,null));};exports['show']=function(_0x15bd0a,_0x47015e){var _0x1ed49b={'raw':!![],'where':{'id':_0x15bd0a[_0xf62e('0x51')]['id']}},_0x13c60b={};_0x13c60b['model']=_[_0xf62e('0x52')](db['Network'][_0xf62e('0x3c')]);_0x13c60b[_0xf62e('0x41')]=_[_0xf62e('0x52')](_0x15bd0a[_0xf62e('0x41')]);_0x13c60b['filters']=_[_0xf62e('0x42')](_0x13c60b[_0xf62e('0x40')],_0x13c60b[_0xf62e('0x41')]);_0x1ed49b[_0xf62e('0x43')]=_[_0xf62e('0x42')](_0x13c60b[_0xf62e('0x40')],qs[_0xf62e('0x44')](_0x15bd0a[_0xf62e('0x41')][_0xf62e('0x44')]));_0x1ed49b['attributes']=_0x1ed49b['attributes']['length']?_0x1ed49b[_0xf62e('0x43')]:_0x13c60b[_0xf62e('0x40')];if(_0x15bd0a[_0xf62e('0x41')][_0xf62e('0x4e')]){_0x1ed49b[_0xf62e('0x4f')]=[{'all':!![]}];}_0x1ed49b=_['merge']({},_0x1ed49b,_0x15bd0a['options']);return db[_0xf62e('0x3b')][_0xf62e('0x53')](_0x1ed49b)[_0xf62e('0x1f')](handleEntityNotFound(_0x47015e,null))[_0xf62e('0x1f')](respondWithResult(_0x47015e,null))[_0xf62e('0x29')](handleError(_0x47015e,null));};exports[_0xf62e('0x54')]=function(_0x97adb4,_0x3552b6,_0x4536fb){var _0x34bda6;return db['sequelize'][_0xf62e('0x55')](function(_0x5bd104){return db[_0xf62e('0x3b')][_0xf62e('0x54')](_0x97adb4[_0xf62e('0x56')],{'raw':!![]})[_0xf62e('0x1f')](function(_0x57df98){_0x34bda6=_0x57df98;return db[_0xf62e('0x3b')][_0xf62e('0x50')]({'where':{'type':_0x97adb4[_0xf62e('0x56')][_0xf62e('0x3e')]},'raw':!![]});})[_0xf62e('0x1f')](function(_0xc5edf2){if(_0x34bda6['type'][_0xf62e('0x57')]()==_0xf62e('0x58')){var _0x3829fe=fs[_0xf62e('0x59')](path['join'](config[_0xf62e('0x5a')],_0xf62e('0x5b')),_0xf62e('0x5c'));var _0x530562=ejs['render'](_0x3829fe,{'networks':_0xc5edf2||[]});fs['writeFileSync'](_0xf62e('0x5d'),_0x530562);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else if(_0x34bda6['type'][_0xf62e('0x57')]()=='TURN'){var _0x41fcf0=fs['readFileSync'](path[_0xf62e('0x5e')](config[_0xf62e('0x5a')],'server/files/templates/turn_multiple.ejs'),_0xf62e('0x5c'));var _0x14d616=ejs['render'](_0x41fcf0,{'networks':_0xc5edf2||[]});fs['writeFileSync'](_0xf62e('0x5f'),_0x14d616);return respondWithRpcPromise('Reload',_0xf62e('0x54'),{'module':_0xf62e('0x60')});}else{var _0x221a4e=fs[_0xf62e('0x59')](path['join'](config['root'],'server/files/templates/network.ejs'),_0xf62e('0x5c'));var _0xa7cefb=ejs[_0xf62e('0x61')](_0x221a4e,{'networks':_0xc5edf2||[]});fs[_0xf62e('0x62')](util[_0xf62e('0x63')](_0xf62e('0x64'),_0x97adb4['body'][_0xf62e('0x3e')]['toLowerCase']()),_0xa7cefb);return respondWithRpcPromise(_0xf62e('0x65'),_0xf62e('0x54'),{'module':'chan_sip.so'});}return null;})[_0xf62e('0x1f')](function(){return _0x34bda6;});})[_0xf62e('0x1f')](respondWithResult(_0x3552b6,0xc9))[_0xf62e('0x29')](handleError(_0x3552b6,null));};exports[_0xf62e('0x66')]=function(_0x16808d,_0x17a5bb,_0xbd7a72){var _0x5264f0;return db['sequelize'][_0xf62e('0x55')](function(_0x3b73e5){return db[_0xf62e('0x3b')]['find']({'where':{'id':_0x16808d[_0xf62e('0x51')]['id']}})[_0xf62e('0x1f')](handleEntityNotFound(_0x17a5bb,null))[_0xf62e('0x1f')](saveUpdates(_0x16808d[_0xf62e('0x56')],null))[_0xf62e('0x1f')](function(_0x6d5faf){if(_0x6d5faf){_0x5264f0=_0x6d5faf;return db['Network']['findAll']({'where':{'type':_0x5264f0[_0xf62e('0x3e')]},'raw':!![]});}return null;})[_0xf62e('0x1f')](function(_0x6f5448){if(_0x5264f0[_0xf62e('0x3e')]['toUpperCase']()=='STUN'){var _0x42f671=fs[_0xf62e('0x59')](path[_0xf62e('0x5e')](config[_0xf62e('0x5a')],_0xf62e('0x5b')),_0xf62e('0x5c'));var _0x52710d=ejs[_0xf62e('0x61')](_0x42f671,{'networks':_0x6f5448||[]});fs['writeFileSync'](_0xf62e('0x5d'),_0x52710d);return respondWithRpcPromise(_0xf62e('0x65'),_0xf62e('0x66'),{'module':'res_stun_monitor.so'});}else if(_0x5264f0[_0xf62e('0x3e')][_0xf62e('0x57')]()==_0xf62e('0x67')){var _0x1bbf73=fs[_0xf62e('0x59')](path[_0xf62e('0x5e')](config[_0xf62e('0x5a')],'server/files/templates/turn_multiple.ejs'),_0xf62e('0x5c'));var _0x4386a6=ejs[_0xf62e('0x61')](_0x1bbf73,{'networks':_0x6f5448||[]});fs['writeFileSync'](_0xf62e('0x5f'),_0x4386a6);return respondWithRpcPromise(_0xf62e('0x65'),'update',{'module':'res_stun_monitor.so'});}else{var _0x184f30=fs['readFileSync'](path[_0xf62e('0x5e')](config[_0xf62e('0x5a')],_0xf62e('0x68')),_0xf62e('0x5c'));var _0x419a03=ejs[_0xf62e('0x61')](_0x184f30,{'networks':_0x6f5448||[]});fs[_0xf62e('0x62')](util[_0xf62e('0x63')](_0xf62e('0x64'),_0x16808d[_0xf62e('0x56')]['type'][_0xf62e('0x69')]()),_0x419a03);return respondWithRpcPromise('Reload','update',{'module':_0xf62e('0x6a')});}return null;})[_0xf62e('0x1f')](function(_0x523705){if(_0x523705){return _0x5264f0;}return null;});})[_0xf62e('0x1f')](respondWithResult(_0x17a5bb,null))[_0xf62e('0x29')](handleError(_0x17a5bb,null));};exports[_0xf62e('0x35')]=function(_0x93be13,_0x33b8ea,_0x8a6d38){var _0xf620a3;return db['Network'][_0xf62e('0x53')]({'where':{'id':_0x93be13[_0xf62e('0x51')]['id']}})[_0xf62e('0x1f')](function(_0x44cf10){_0xf620a3=_0x44cf10;return _0x44cf10;})[_0xf62e('0x1f')](handleEntityNotFound(_0x33b8ea,null))['then'](removeEntity(_0x33b8ea,null))['then'](function(){if(_0xf620a3){return db[_0xf62e('0x3b')][_0xf62e('0x50')]({'where':{'type':_0xf620a3[_0xf62e('0x3e')]},'raw':!![]});}})['then'](function(_0x292845){if(_0xf620a3[_0xf62e('0x3e')][_0xf62e('0x57')]()==_0xf62e('0x58')){var _0x2e2649=fs[_0xf62e('0x59')](path[_0xf62e('0x5e')](config[_0xf62e('0x5a')],_0xf62e('0x5b')),_0xf62e('0x5c'));var _0x127c02=ejs[_0xf62e('0x61')](_0x2e2649,{'networks':_0x292845||[]});fs[_0xf62e('0x62')]('/etc/asterisk/stun_xcally.conf',_0x127c02);return respondWithRpcPromise('Reload',_0xf62e('0x35'),{'module':_0xf62e('0x60')});}else if(_0xf620a3['type'][_0xf62e('0x57')]()==_0xf62e('0x67')){var _0x125433=fs['readFileSync'](path[_0xf62e('0x5e')](config['root'],_0xf62e('0x6b')),'utf8');var _0xf199b6=ejs[_0xf62e('0x61')](_0x125433,{'networks':_0x292845||[]});fs[_0xf62e('0x62')](_0xf62e('0x5f'),_0xf199b6);return respondWithRpcPromise(_0xf62e('0x65'),'destroy',{'module':_0xf62e('0x60')});}else{var _0x4a3c1e=fs['readFileSync'](path[_0xf62e('0x5e')](config['root'],_0xf62e('0x68')),'utf8');var _0x43c0e1=ejs[_0xf62e('0x61')](_0x4a3c1e,{'networks':_0x292845||[]});fs[_0xf62e('0x62')](util[_0xf62e('0x63')](_0xf62e('0x64'),_0x93be13['body'][_0xf62e('0x3e')]['toLowerCase']()),_0x43c0e1);return respondWithRpcPromise(_0xf62e('0x65'),_0xf62e('0x35'),{'module':'chan_sip.so'});}return null;})[_0xf62e('0x29')](handleError(_0x33b8ea,null));}; \ No newline at end of file +var _0x3bbd=['res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','toLowerCase','chan_sip.so','sequelize','params','render','/etc/asterisk/stun_xcally.conf','Reload','format','/etc/asterisk/sip_xcally_%s.conf','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','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','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','Network','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','create','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','writeFileSync'];(function(_0x31139e,_0x5cb33d){var _0x4926fe=function(_0x66b0cb){while(--_0x66b0cb){_0x31139e['push'](_0x31139e['shift']());}};_0x4926fe(++_0x5cb33d);}(_0x3bbd,0xeb));var _0xd3bb=function(_0x23cdc7,_0x1d448a){_0x23cdc7=_0x23cdc7-0x0;var _0x455308=_0x3bbd[_0x23cdc7];return _0x455308;};'use strict';var pdf=require(_0xd3bb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd3bb('0x1'));var zipdir=require(_0xd3bb('0x2'));var jsonpatch=require(_0xd3bb('0x3'));var rp=require(_0xd3bb('0x4'));var moment=require(_0xd3bb('0x5'));var BPromise=require(_0xd3bb('0x6'));var Mustache=require('mustache');var util=require(_0xd3bb('0x7'));var path=require(_0xd3bb('0x8'));var sox=require(_0xd3bb('0x9'));var csv=require(_0xd3bb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd3bb('0xb'));var squel=require(_0xd3bb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd3bb('0xd'));var toCsv=require(_0xd3bb('0xa'));var querystring=require(_0xd3bb('0xe'));var Papa=require(_0xd3bb('0xf'));var Redis=require(_0xd3bb('0x10'));var authService=require(_0xd3bb('0x11'));var qs=require(_0xd3bb('0x12'));var as=require(_0xd3bb('0x13'));var hardwareService=require(_0xd3bb('0x14'));var logger=require(_0xd3bb('0x15'))(_0xd3bb('0x16'));var utils=require(_0xd3bb('0x17'));var config=require(_0xd3bb('0x18'));var licenseUtil=require(_0xd3bb('0x19'));var db=require(_0xd3bb('0x1a'))['db'];var jayson=require(_0xd3bb('0x1b'));var client=jayson[_0xd3bb('0x1c')][_0xd3bb('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x29fd23,_0x48299e,_0x1b06af,_0x3582b1){return new BPromise(function(_0x4d4617,_0x527b4c){var _0x3b50f5=_0x3582b1||client;return _0x3b50f5['request'](_0x29fd23,_0x1b06af)[_0xd3bb('0x1e')](function(_0x589292){logger[_0xd3bb('0x1f')](_0xd3bb('0x20'),_0x48299e,_0xd3bb('0x21'));logger['debug'](_0xd3bb('0x22'),_0x48299e,_0xd3bb('0x21'),JSON[_0xd3bb('0x23')](_0x589292));if(_0x589292[_0xd3bb('0x24')]){if(_0x589292[_0xd3bb('0x24')][_0xd3bb('0x25')]===0x1f4){logger[_0xd3bb('0x24')](_0xd3bb('0x20'),_0x48299e,_0x589292[_0xd3bb('0x24')]['message']);return _0x527b4c(_0x589292[_0xd3bb('0x24')][_0xd3bb('0x26')]);}logger['error'](_0xd3bb('0x20'),_0x48299e,_0x589292[_0xd3bb('0x24')][_0xd3bb('0x26')]);return _0x4d4617(_0x589292[_0xd3bb('0x24')][_0xd3bb('0x26')]);}else{logger[_0xd3bb('0x1f')](_0xd3bb('0x20'),_0x48299e,'request\x20sent');_0x4d4617(_0x589292[_0xd3bb('0x27')][_0xd3bb('0x26')]);}})[_0xd3bb('0x28')](function(_0x5dc162){logger[_0xd3bb('0x24')](_0xd3bb('0x20'),_0x48299e,_0x5dc162);_0x527b4c(_0x5dc162);});});}function respondWithStatusCode(_0x244d84,_0x52595d){_0x52595d=_0x52595d||0xcc;return function(_0x12f3ff){if(_0x12f3ff){return _0x244d84[_0xd3bb('0x29')](_0x52595d);}return _0x244d84['status'](_0x52595d)[_0xd3bb('0x2a')]();};}function respondWithResult(_0xbeb68f,_0x45b54f){_0x45b54f=_0x45b54f||0xc8;return function(_0x201763){if(_0x201763){return _0xbeb68f[_0xd3bb('0x2b')](_0x45b54f)['json'](_0x201763);}};}function respondWithFilteredResult(_0x1d564c,_0x2544f4){return function(_0x373a5){if(_0x373a5){var _0x4568a6=_0x373a5[_0xd3bb('0x2c')],_0x310982=_0x2544f4['offset'],_0x49c1f0=_0x2544f4[_0xd3bb('0x2d')]+_0x2544f4['limit'],_0x53e149;if(_0x49c1f0>=_0x4568a6){_0x49c1f0=_0x4568a6;_0x53e149=0xc8;}else{_0x53e149=0xce;}_0x1d564c[_0xd3bb('0x2b')](_0x53e149);return _0x1d564c['set'](_0xd3bb('0x2e'),_0x310982+'-'+_0x49c1f0+'/'+_0x4568a6)[_0xd3bb('0x2f')](_0x373a5);}return null;};}function patchUpdates(_0x2dd8a0){return function(_0x51bd64){try{jsonpatch[_0xd3bb('0x30')](_0x51bd64,_0x2dd8a0,!![]);}catch(_0x434e07){return BPromise[_0xd3bb('0x31')](_0x434e07);}return _0x51bd64[_0xd3bb('0x32')]();};}function saveUpdates(_0x2a18f1,_0x486d3c){return function(_0x3b58ae){if(_0x3b58ae){return _0x3b58ae[_0xd3bb('0x33')](_0x2a18f1)[_0xd3bb('0x1e')](function(_0xfd1014){return _0xfd1014;});}return null;};}function removeEntity(_0x84a059,_0x2c8d3b){return function(_0x4f6cd7){if(_0x4f6cd7){return _0x4f6cd7[_0xd3bb('0x34')]()[_0xd3bb('0x1e')](function(){_0x84a059['status'](0xcc)[_0xd3bb('0x2a')]();});}};}function handleEntityNotFound(_0x5991e6,_0x4bc622){return function(_0x35ce15){if(!_0x35ce15){_0x5991e6[_0xd3bb('0x29')](0x194);}return _0x35ce15;};}function handleError(_0x156f00,_0x250e0f){_0x250e0f=_0x250e0f||0x1f4;return function(_0x628736){logger[_0xd3bb('0x24')](_0x628736[_0xd3bb('0x35')]);if(_0x628736[_0xd3bb('0x36')]){delete _0x628736[_0xd3bb('0x36')];}_0x156f00['status'](_0x250e0f)[_0xd3bb('0x37')](_0x628736);};}exports[_0xd3bb('0x38')]=function(_0x256489,_0x169976){var _0x2e51ee={},_0x3aa565={},_0x2d9b9c={'count':0x0,'rows':[]};var _0x3b2878=_['map'](db[_0xd3bb('0x39')][_0xd3bb('0x3a')],function(_0x3aeb12){return{'name':_0x3aeb12['fieldName'],'type':_0x3aeb12[_0xd3bb('0x3b')][_0xd3bb('0x3c')]};});_0x3aa565[_0xd3bb('0x3d')]=_[_0xd3bb('0x3e')](_0x3b2878,'name');_0x3aa565[_0xd3bb('0x3f')]=_[_0xd3bb('0x40')](_0x256489['query']);_0x3aa565[_0xd3bb('0x41')]=_[_0xd3bb('0x42')](_0x3aa565[_0xd3bb('0x3d')],_0x3aa565[_0xd3bb('0x3f')]);_0x2e51ee[_0xd3bb('0x43')]=_[_0xd3bb('0x42')](_0x3aa565[_0xd3bb('0x3d')],qs[_0xd3bb('0x44')](_0x256489[_0xd3bb('0x3f')]['fields']));_0x2e51ee[_0xd3bb('0x43')]=_0x2e51ee['attributes'][_0xd3bb('0x45')]?_0x2e51ee['attributes']:_0x3aa565[_0xd3bb('0x3d')];if(!_0x256489['query']['hasOwnProperty'](_0xd3bb('0x46'))){_0x2e51ee['limit']=qs[_0xd3bb('0x47')](_0x256489[_0xd3bb('0x3f')][_0xd3bb('0x47')]);_0x2e51ee['offset']=qs[_0xd3bb('0x2d')](_0x256489[_0xd3bb('0x3f')]['offset']);}_0x2e51ee['order']=qs[_0xd3bb('0x48')](_0x256489[_0xd3bb('0x3f')][_0xd3bb('0x48')]);_0x2e51ee[_0xd3bb('0x49')]=qs[_0xd3bb('0x41')](_[_0xd3bb('0x4a')](_0x256489[_0xd3bb('0x3f')],_0x3aa565[_0xd3bb('0x41')]),_0x3b2878);if(_0x256489[_0xd3bb('0x3f')][_0xd3bb('0x4b')]){_0x2e51ee[_0xd3bb('0x49')]=_[_0xd3bb('0x4c')](_0x2e51ee[_0xd3bb('0x49')],{'$or':_[_0xd3bb('0x3e')](_0x3b2878,function(_0x5e4181){if(_0x5e4181[_0xd3bb('0x3b')]!==_0xd3bb('0x4d')){var _0x589987={};_0x589987[_0x5e4181[_0xd3bb('0x36')]]={'$like':'%'+_0x256489[_0xd3bb('0x3f')][_0xd3bb('0x4b')]+'%'};return _0x589987;}})});}_0x2e51ee=_[_0xd3bb('0x4c')]({},_0x2e51ee,_0x256489[_0xd3bb('0x4e')]);var _0x4579ca={'where':_0x2e51ee['where']};return db['Network'][_0xd3bb('0x2c')](_0x4579ca)['then'](function(_0x3b1351){_0x2d9b9c['count']=_0x3b1351;if(_0x256489[_0xd3bb('0x3f')]['includeAll']){_0x2e51ee[_0xd3bb('0x4f')]=[{'all':!![]}];}return db['Network'][_0xd3bb('0x50')](_0x2e51ee);})['then'](function(_0x58aa85){_0x2d9b9c[_0xd3bb('0x51')]=_0x58aa85;return _0x2d9b9c;})['then'](respondWithFilteredResult(_0x169976,_0x2e51ee))[_0xd3bb('0x28')](handleError(_0x169976,null));};exports[_0xd3bb('0x52')]=function(_0x2ff2b0,_0x5c7194){var _0x5abab5={'raw':!![],'where':{'id':_0x2ff2b0['params']['id']}},_0x495621={};_0x495621[_0xd3bb('0x3d')]=_['keys'](db['Network'][_0xd3bb('0x3a')]);_0x495621['query']=_[_0xd3bb('0x40')](_0x2ff2b0['query']);_0x495621[_0xd3bb('0x41')]=_[_0xd3bb('0x42')](_0x495621['model'],_0x495621['query']);_0x5abab5[_0xd3bb('0x43')]=_[_0xd3bb('0x42')](_0x495621[_0xd3bb('0x3d')],qs[_0xd3bb('0x44')](_0x2ff2b0[_0xd3bb('0x3f')][_0xd3bb('0x44')]));_0x5abab5[_0xd3bb('0x43')]=_0x5abab5[_0xd3bb('0x43')][_0xd3bb('0x45')]?_0x5abab5['attributes']:_0x495621['model'];if(_0x2ff2b0[_0xd3bb('0x3f')][_0xd3bb('0x53')]){_0x5abab5['include']=[{'all':!![]}];}_0x5abab5=_[_0xd3bb('0x4c')]({},_0x5abab5,_0x2ff2b0[_0xd3bb('0x4e')]);return db['Network'][_0xd3bb('0x54')](_0x5abab5)['then'](handleEntityNotFound(_0x5c7194,null))[_0xd3bb('0x1e')](respondWithResult(_0x5c7194,null))[_0xd3bb('0x28')](handleError(_0x5c7194,null));};exports[_0xd3bb('0x55')]=function(_0x376f3b,_0x106813,_0x5d8c7d){var _0x32e27e;return db['sequelize'][_0xd3bb('0x56')](function(_0x18e933){return db[_0xd3bb('0x39')][_0xd3bb('0x55')](_0x376f3b[_0xd3bb('0x57')],{'raw':!![]})[_0xd3bb('0x1e')](function(_0x1ccb4c){_0x32e27e=_0x1ccb4c;return db[_0xd3bb('0x39')][_0xd3bb('0x50')]({'where':{'type':_0x376f3b[_0xd3bb('0x57')][_0xd3bb('0x3b')]},'raw':!![]});})[_0xd3bb('0x1e')](function(_0x22b4cb){if(_0x32e27e[_0xd3bb('0x3b')][_0xd3bb('0x58')]()==_0xd3bb('0x59')){var _0x4fa7a5=fs[_0xd3bb('0x5a')](path[_0xd3bb('0x5b')](config[_0xd3bb('0x5c')],_0xd3bb('0x5d')),'utf8');var _0x29a575=ejs['render'](_0x4fa7a5,{'networks':_0x22b4cb||[]});fs[_0xd3bb('0x5e')]('/etc/asterisk/stun_xcally.conf',_0x29a575);return respondWithRpcPromise('Reload',_0xd3bb('0x55'),{'module':_0xd3bb('0x5f')});}else if(_0x32e27e['type'][_0xd3bb('0x58')]()==_0xd3bb('0x60')){var _0x58a458=fs[_0xd3bb('0x5a')](path[_0xd3bb('0x5b')](config[_0xd3bb('0x5c')],_0xd3bb('0x61')),_0xd3bb('0x62'));var _0x4a4405=ejs['render'](_0x58a458,{'networks':_0x22b4cb||[]});fs[_0xd3bb('0x5e')](_0xd3bb('0x63'),_0x4a4405);return respondWithRpcPromise('Reload',_0xd3bb('0x55'),{'module':_0xd3bb('0x5f')});}else{var _0x521209=fs['readFileSync'](path[_0xd3bb('0x5b')](config['root'],_0xd3bb('0x64')),_0xd3bb('0x62'));var _0x305029=ejs['render'](_0x521209,{'networks':_0x22b4cb||[]});fs[_0xd3bb('0x5e')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x376f3b['body'][_0xd3bb('0x3b')][_0xd3bb('0x65')]()),_0x305029);return respondWithRpcPromise('Reload',_0xd3bb('0x55'),{'module':_0xd3bb('0x66')});}return null;})[_0xd3bb('0x1e')](function(){return _0x32e27e;});})[_0xd3bb('0x1e')](respondWithResult(_0x106813,0xc9))[_0xd3bb('0x28')](handleError(_0x106813,null));};exports[_0xd3bb('0x33')]=function(_0x8827cb,_0x5f2f1f,_0x532749){var _0x27e2d2;return db[_0xd3bb('0x67')][_0xd3bb('0x56')](function(_0x58e45b){return db[_0xd3bb('0x39')][_0xd3bb('0x54')]({'where':{'id':_0x8827cb[_0xd3bb('0x68')]['id']}})[_0xd3bb('0x1e')](handleEntityNotFound(_0x5f2f1f,null))[_0xd3bb('0x1e')](saveUpdates(_0x8827cb[_0xd3bb('0x57')],null))[_0xd3bb('0x1e')](function(_0x538d67){if(_0x538d67){_0x27e2d2=_0x538d67;return db[_0xd3bb('0x39')][_0xd3bb('0x50')]({'where':{'type':_0x27e2d2['type']},'raw':!![]});}return null;})['then'](function(_0x1293db){if(_0x27e2d2[_0xd3bb('0x3b')][_0xd3bb('0x58')]()=='STUN'){var _0x57c54a=fs[_0xd3bb('0x5a')](path[_0xd3bb('0x5b')](config[_0xd3bb('0x5c')],_0xd3bb('0x5d')),_0xd3bb('0x62'));var _0x33df16=ejs[_0xd3bb('0x69')](_0x57c54a,{'networks':_0x1293db||[]});fs[_0xd3bb('0x5e')](_0xd3bb('0x6a'),_0x33df16);return respondWithRpcPromise(_0xd3bb('0x6b'),_0xd3bb('0x33'),{'module':_0xd3bb('0x5f')});}else if(_0x27e2d2[_0xd3bb('0x3b')]['toUpperCase']()==_0xd3bb('0x60')){var _0x216096=fs[_0xd3bb('0x5a')](path[_0xd3bb('0x5b')](config[_0xd3bb('0x5c')],_0xd3bb('0x61')),'utf8');var _0x1221f5=ejs[_0xd3bb('0x69')](_0x216096,{'networks':_0x1293db||[]});fs[_0xd3bb('0x5e')](_0xd3bb('0x63'),_0x1221f5);return respondWithRpcPromise(_0xd3bb('0x6b'),_0xd3bb('0x33'),{'module':_0xd3bb('0x5f')});}else{var _0x2e29a7=fs[_0xd3bb('0x5a')](path['join'](config['root'],_0xd3bb('0x64')),_0xd3bb('0x62'));var _0x5deba5=ejs[_0xd3bb('0x69')](_0x2e29a7,{'networks':_0x1293db||[]});fs['writeFileSync'](util[_0xd3bb('0x6c')](_0xd3bb('0x6d'),_0x8827cb[_0xd3bb('0x57')][_0xd3bb('0x3b')]['toLowerCase']()),_0x5deba5);return respondWithRpcPromise(_0xd3bb('0x6b'),_0xd3bb('0x33'),{'module':_0xd3bb('0x66')});}return null;})[_0xd3bb('0x1e')](function(_0xa037d0){if(_0xa037d0){return _0x27e2d2;}return null;});})[_0xd3bb('0x1e')](respondWithResult(_0x5f2f1f,null))[_0xd3bb('0x28')](handleError(_0x5f2f1f,null));};exports[_0xd3bb('0x34')]=function(_0x387c69,_0x5958ab,_0x3ca10d){var _0x48f07d;return db[_0xd3bb('0x39')][_0xd3bb('0x54')]({'where':{'id':_0x387c69['params']['id']}})['then'](function(_0x147469){_0x48f07d=_0x147469;return _0x147469;})[_0xd3bb('0x1e')](handleEntityNotFound(_0x5958ab,null))[_0xd3bb('0x1e')](removeEntity(_0x5958ab,null))[_0xd3bb('0x1e')](function(){if(_0x48f07d){return db[_0xd3bb('0x39')][_0xd3bb('0x50')]({'where':{'type':_0x48f07d['type']},'raw':!![]});}})['then'](function(_0x411ba6){if(_0x48f07d['type'][_0xd3bb('0x58')]()==_0xd3bb('0x59')){var _0x2f7e04=fs[_0xd3bb('0x5a')](path['join'](config[_0xd3bb('0x5c')],_0xd3bb('0x5d')),_0xd3bb('0x62'));var _0x5d9306=ejs['render'](_0x2f7e04,{'networks':_0x411ba6||[]});fs['writeFileSync'](_0xd3bb('0x6a'),_0x5d9306);return respondWithRpcPromise(_0xd3bb('0x6b'),_0xd3bb('0x34'),{'module':_0xd3bb('0x5f')});}else if(_0x48f07d['type'][_0xd3bb('0x58')]()==_0xd3bb('0x60')){var _0x55f420=fs[_0xd3bb('0x5a')](path[_0xd3bb('0x5b')](config['root'],_0xd3bb('0x61')),_0xd3bb('0x62'));var _0x2f032f=ejs[_0xd3bb('0x69')](_0x55f420,{'networks':_0x411ba6||[]});fs[_0xd3bb('0x5e')](_0xd3bb('0x63'),_0x2f032f);return respondWithRpcPromise(_0xd3bb('0x6b'),_0xd3bb('0x34'),{'module':_0xd3bb('0x5f')});}else{var _0x4b84c0=fs[_0xd3bb('0x5a')](path[_0xd3bb('0x5b')](config[_0xd3bb('0x5c')],_0xd3bb('0x64')),'utf8');var _0x2b7163=ejs[_0xd3bb('0x69')](_0x4b84c0,{'networks':_0x411ba6||[]});fs[_0xd3bb('0x5e')](util[_0xd3bb('0x6c')]('/etc/asterisk/sip_xcally_%s.conf',_0x387c69[_0xd3bb('0x57')]['type'][_0xd3bb('0x65')]()),_0x2b7163);return respondWithRpcPromise('Reload','destroy',{'module':_0xd3bb('0x66')});}return null;})[_0xd3bb('0x28')](handleError(_0x5958ab,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 9f8a198..17b86f5 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 _0xc929=['exports','define','Network','network','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./network.attributes'];(function(_0x418ad2,_0xeae93b){var _0x4f4fe5=function(_0x424e28){while(--_0x424e28){_0x418ad2['push'](_0x418ad2['shift']());}};_0x4f4fe5(++_0xeae93b);}(_0xc929,0x1b4));var _0x9c92=function(_0x2696b9,_0x3f6ccb){_0x2696b9=_0x2696b9-0x0;var _0x375d1a=_0xc929[_0x2696b9];return _0x375d1a;};'use strict';var _=require(_0x9c92('0x0'));var util=require(_0x9c92('0x1'));var logger=require(_0x9c92('0x2'))(_0x9c92('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9c92('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c92('0x5'));var config=require(_0x9c92('0x6'));var attributes=require(_0x9c92('0x7'));module[_0x9c92('0x8')]=function(_0x4a2019,_0x17fbea){return _0x4a2019[_0x9c92('0x9')](_0x9c92('0xa'),attributes,{'tableName':_0x9c92('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2325=['lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x2325,0xfc));var _0x5232=function(_0x7b8a87,_0x2f2523){_0x7b8a87=_0x7b8a87-0x0;var _0x2131a1=_0x2325[_0x7b8a87];return _0x2131a1;};'use strict';var _=require(_0x5232('0x0'));var util=require('util');var logger=require(_0x5232('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5232('0x2'));var rp=require(_0x5232('0x3'));var fs=require('fs');var path=require(_0x5232('0x4'));var rimraf=require(_0x5232('0x5'));var config=require(_0x5232('0x6'));var attributes=require(_0x5232('0x7'));module[_0x5232('0x8')]=function(_0x2fd9ef,_0x12682d){return _0x2fd9ef[_0x5232('0x9')](_0x5232('0xa'),attributes,{'tableName':_0x5232('0xb'),'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 1be7b25..6b005a0 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 _0x9686=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','lodash'];(function(_0x4debdd,_0x114aab){var _0x4a83e6=function(_0x4e8ed8){while(--_0x4e8ed8){_0x4debdd['push'](_0x4debdd['shift']());}};_0x4a83e6(++_0x114aab);}(_0x9686,0x1b8));var _0x6968=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9686[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6968('0x0'));var util=require('util');var moment=require(_0x6968('0x1'));var BPromise=require(_0x6968('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6968('0x3'));var db=require(_0x6968('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6968('0x5'))(_0x6968('0x6'));var config=require('../../config/environment');var jayson=require(_0x6968('0x7'));var client=jayson[_0x6968('0x8')][_0x6968('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x365f89,_0x54a2f8,_0x17e4b6){return new BPromise(function(_0x1b2307,_0x57f9aa){return client[_0x6968('0xa')](_0x365f89,_0x17e4b6)[_0x6968('0xb')](function(_0x2da59e){logger[_0x6968('0xc')]('Network,\x20%s,\x20%s',_0x54a2f8,_0x6968('0xd'));logger[_0x6968('0xe')](_0x6968('0xf'),_0x54a2f8,'request\x20sent',JSON[_0x6968('0x10')](_0x2da59e));if(_0x2da59e[_0x6968('0x11')]){if(_0x2da59e[_0x6968('0x11')][_0x6968('0x12')]===0x1f4){logger[_0x6968('0x11')](_0x6968('0x13'),_0x54a2f8,_0x2da59e[_0x6968('0x11')][_0x6968('0x14')]);return _0x57f9aa(_0x2da59e['error']['message']);}logger[_0x6968('0x11')]('Network,\x20%s,\x20%s',_0x54a2f8,_0x2da59e[_0x6968('0x11')][_0x6968('0x14')]);return _0x1b2307(_0x2da59e['error'][_0x6968('0x14')]);}else{logger[_0x6968('0xc')](_0x6968('0x13'),_0x54a2f8,_0x6968('0xd'));_0x1b2307(_0x2da59e['result'][_0x6968('0x14')]);}})['catch'](function(_0x406012){logger[_0x6968('0x11')](_0x6968('0x13'),_0x54a2f8,_0x406012);_0x57f9aa(_0x406012);});});} \ No newline at end of file +var _0x6299=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','../../mysqldb'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x6299,0x146));var _0x9629=function(_0x461d01,_0x14d67e){_0x461d01=_0x461d01-0x0;var _0x93e1d=_0x6299[_0x461d01];return _0x93e1d;};'use strict';var _=require('lodash');var util=require(_0x9629('0x0'));var moment=require(_0x9629('0x1'));var BPromise=require(_0x9629('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9629('0x3'))['db'];var utils=require(_0x9629('0x4'));var logger=require(_0x9629('0x5'))(_0x9629('0x6'));var config=require(_0x9629('0x7'));var jayson=require(_0x9629('0x8'));var client=jayson[_0x9629('0x9')][_0x9629('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4727f1,_0x2d0f72,_0x55f81a){return new BPromise(function(_0xb430dd,_0x5deeb0){return client[_0x9629('0xb')](_0x4727f1,_0x55f81a)[_0x9629('0xc')](function(_0x2024ef){logger[_0x9629('0xd')](_0x9629('0xe'),_0x2d0f72,'request\x20sent');logger[_0x9629('0xf')](_0x9629('0x10'),_0x2d0f72,_0x9629('0x11'),JSON['stringify'](_0x2024ef));if(_0x2024ef['error']){if(_0x2024ef[_0x9629('0x12')]['code']===0x1f4){logger[_0x9629('0x12')](_0x9629('0xe'),_0x2d0f72,_0x2024ef[_0x9629('0x12')][_0x9629('0x13')]);return _0x5deeb0(_0x2024ef['error']['message']);}logger[_0x9629('0x12')](_0x9629('0xe'),_0x2d0f72,_0x2024ef[_0x9629('0x12')][_0x9629('0x13')]);return _0xb430dd(_0x2024ef[_0x9629('0x12')][_0x9629('0x13')]);}else{logger[_0x9629('0xd')](_0x9629('0xe'),_0x2d0f72,_0x9629('0x11'));_0xb430dd(_0x2024ef[_0x9629('0x14')][_0x9629('0x13')]);}})[_0x9629('0x15')](function(_0x235931){logger[_0x9629('0x12')](_0x9629('0xe'),_0x2d0f72,_0x235931);_0x5deeb0(_0x235931);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 5b0c187..491bd96 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 _0x857f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports','util'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x857f,0x8e));var _0xf857=function(_0x4a30cf,_0x312dd4){_0x4a30cf=_0x4a30cf-0x0;var _0x4d975b=_0x857f[_0x4a30cf];return _0x4d975b;};'use strict';var multer=require('multer');var util=require(_0xf857('0x0'));var path=require(_0xf857('0x1'));var timeout=require(_0xf857('0x2'));var express=require(_0xf857('0x3'));var router=express[_0xf857('0x4')]();var auth=require(_0xf857('0x5'));var interaction=require(_0xf857('0x6'));var config=require(_0xf857('0x7'));var controller=require(_0xf857('0x8'));router[_0xf857('0x9')]('/',auth[_0xf857('0xa')](),controller[_0xf857('0xb')]);module[_0xf857('0xc')]=router; \ No newline at end of file +var _0x5002=['isAuthenticated','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./notification.controller','post'];(function(_0x2c72ac,_0x15b0aa){var _0x4c45e0=function(_0x4224d8){while(--_0x4224d8){_0x2c72ac['push'](_0x2c72ac['shift']());}};_0x4c45e0(++_0x15b0aa);}(_0x5002,0x178));var _0x2500=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x5002[_0x4bd06e];return _0x85ebb;};'use strict';var multer=require('multer');var util=require(_0x2500('0x0'));var path=require(_0x2500('0x1'));var timeout=require(_0x2500('0x2'));var express=require(_0x2500('0x3'));var router=express[_0x2500('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2500('0x5'));var config=require(_0x2500('0x6'));var controller=require(_0x2500('0x7'));router[_0x2500('0x8')]('/',auth[_0x2500('0x9')](),controller['sendNotification']);module[_0x2500('0xa')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 2d015e1..92bfa55 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 _0x140a=['TEXT','BOOLEAN','exports','STRING'];(function(_0x592409,_0xaa8b43){var _0x26e9aa=function(_0x223212){while(--_0x223212){_0x592409['push'](_0x592409['shift']());}};_0x26e9aa(++_0xaa8b43);}(_0x140a,0x6e));var _0xa140=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x140a[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require('sequelize');module[_0xa140('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xa140('0x1')]},'recipientsId':{'type':Sequelize[_0xa140('0x2')]},'recipientsDescription':{'type':Sequelize[_0xa140('0x1')]},'beep':{'type':Sequelize[_0xa140('0x3')]}}; \ No newline at end of file +var _0x15a0=['exports','TEXT','STRING','sequelize'];(function(_0x3f2082,_0x1d2c77){var _0x555473=function(_0x201278){while(--_0x201278){_0x3f2082['push'](_0x3f2082['shift']());}};_0x555473(++_0x1d2c77);}(_0x15a0,0x6f));var _0x015a=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x15a0[_0x9cd4c3];return _0x4c9025;};'use strict';var Sequelize=require(_0x015a('0x0'));module[_0x015a('0x1')]={'body':{'type':Sequelize[_0x015a('0x2')]},'senderName':{'type':Sequelize[_0x015a('0x3')]},'recipientsId':{'type':Sequelize[_0x015a('0x2')]},'recipientsDescription':{'type':Sequelize[_0x015a('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 4e1e1b4..541f803 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 _0x6b3d=['socket.io-emitter','./notification.socket','register','sendStatus','status','count','offset','Content-Range','json','reject','save','destroy','then','end','error','send','text','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','catch','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','union','queue','replace','Queue','push','all','flatten','getAgents','map','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','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0x6b3d,0x173));var _0xd6b3=function(_0x2bb59a,_0x3815c6){_0x2bb59a=_0x2bb59a-0x0;var _0xae827a=_0x6b3d[_0x2bb59a];return _0xae827a;};'use strict';var pdf=require(_0xd6b3('0x0'));var emlformat=require(_0xd6b3('0x1'));var rimraf=require(_0xd6b3('0x2'));var zipdir=require(_0xd6b3('0x3'));var jsonpatch=require(_0xd6b3('0x4'));var rp=require(_0xd6b3('0x5'));var moment=require(_0xd6b3('0x6'));var BPromise=require(_0xd6b3('0x7'));var Mustache=require(_0xd6b3('0x8'));var util=require(_0xd6b3('0x9'));var path=require(_0xd6b3('0xa'));var sox=require(_0xd6b3('0xb'));var csv=require(_0xd6b3('0xc'));var ejs=require(_0xd6b3('0xd'));var fs=require('fs');var _=require(_0xd6b3('0xe'));var squel=require(_0xd6b3('0xf'));var crypto=require(_0xd6b3('0x10'));var jsforce=require(_0xd6b3('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xd6b3('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd6b3('0x12'));var authService=require(_0xd6b3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd6b3('0x14'));var hardwareService=require(_0xd6b3('0x15'));var logger=require(_0xd6b3('0x16'))('api');var utils=require(_0xd6b3('0x17'));var config=require(_0xd6b3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6b3('0x19'))['db'];config[_0xd6b3('0x1a')]=_[_0xd6b3('0x1b')](config['redis'],{'host':_0xd6b3('0x1c'),'port':0x18eb});var socket=require(_0xd6b3('0x1d'))(new Redis(config[_0xd6b3('0x1a')]));require(_0xd6b3('0x1e'))[_0xd6b3('0x1f')](socket);function respondWithStatusCode(_0x1687ff,_0x5ddc07){_0x5ddc07=_0x5ddc07||0xcc;return function(_0x5a55b2){if(_0x5a55b2){return _0x1687ff[_0xd6b3('0x20')](_0x5ddc07);}return _0x1687ff[_0xd6b3('0x21')](_0x5ddc07)['end']();};}function respondWithResult(_0x2a0cac,_0x21a7d5){_0x21a7d5=_0x21a7d5||0xc8;return function(_0x262507){if(_0x262507){return _0x2a0cac['status'](_0x21a7d5)['json'](_0x262507);}};}function respondWithFilteredResult(_0x537c5e,_0x1ce573){return function(_0x5654b8){if(_0x5654b8){var _0x513748=_0x5654b8[_0xd6b3('0x22')],_0x4265f4=_0x1ce573[_0xd6b3('0x23')],_0x39e334=_0x1ce573[_0xd6b3('0x23')]+_0x1ce573['limit'],_0x3c1bc0;if(_0x39e334>=_0x513748){_0x39e334=_0x513748;_0x3c1bc0=0xc8;}else{_0x3c1bc0=0xce;}_0x537c5e[_0xd6b3('0x21')](_0x3c1bc0);return _0x537c5e['set'](_0xd6b3('0x24'),_0x4265f4+'-'+_0x39e334+'/'+_0x513748)[_0xd6b3('0x25')](_0x5654b8);}return null;};}function patchUpdates(_0x175247){return function(_0xf00376){try{jsonpatch['apply'](_0xf00376,_0x175247,!![]);}catch(_0x4c3261){return BPromise[_0xd6b3('0x26')](_0x4c3261);}return _0xf00376[_0xd6b3('0x27')]();};}function saveUpdates(_0x121310,_0x3b4696){return function(_0x26d1fa){if(_0x26d1fa){return _0x26d1fa['update'](_0x121310)['then'](function(_0x575176){return _0x575176;});}return null;};}function removeEntity(_0x2fc83a,_0x20cf0c){return function(_0x757ed0){if(_0x757ed0){return _0x757ed0[_0xd6b3('0x28')]()[_0xd6b3('0x29')](function(){_0x2fc83a[_0xd6b3('0x21')](0xcc)[_0xd6b3('0x2a')]();});}};}function handleEntityNotFound(_0x2e9c96,_0x366ede){return function(_0x2ec9df){if(!_0x2ec9df){_0x2e9c96[_0xd6b3('0x20')](0x194);}return _0x2ec9df;};}function handleError(_0x293b9f,_0x1d3919){_0x1d3919=_0x1d3919||0x1f4;return function(_0x1a2046){logger[_0xd6b3('0x2b')](_0x1a2046['stack']);if(_0x1a2046['name']){delete _0x1a2046['name'];}_0x293b9f[_0xd6b3('0x21')](_0x1d3919)[_0xd6b3('0x2c')](_0x1a2046);};}exports['sendNotification']=function(_0x120a8b,_0x4c2afa,_0x4a00b3){if(!_0x120a8b['body']['hasOwnProperty'](_0xd6b3('0x2d'))&&!_0x120a8b['body'][_0xd6b3('0x2e')](_0xd6b3('0x2f'))){throw new db[(_0xd6b3('0x30'))]['ValidationError'](_0xd6b3('0x31'));}else{if(_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x2e')](_0xd6b3('0x2f'))&&!_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x2e')](_0xd6b3('0x33'))){throw new db[(_0xd6b3('0x30'))][(_0xd6b3('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x120a8b[_0xd6b3('0x32')]['hasOwnProperty']('recipients')){throw new db[(_0xd6b3('0x30'))][(_0xd6b3('0x34'))](_0xd6b3('0x35'));}else{try{var _0x991f58=JSON[_0xd6b3('0x36')](_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x37')]);}catch(_0x467c06){logger[_0xd6b3('0x2b')](_0x467c06);throw new db['Sequelize'][(_0xd6b3('0x34'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x350e8b=[_0xd6b3('0x38'),_0xd6b3('0x39'),_0xd6b3('0x3a'),_0xd6b3('0x3b'),_0xd6b3('0x3c'),_0xd6b3('0x3d'),_0xd6b3('0x3e'),_0xd6b3('0x3f'),'user'];if(_[_0xd6b3('0x40')](_0x991f58,function(_0x5d86bc){return!_[_0xd6b3('0x41')](_0x350e8b,_0x5d86bc[_0xd6b3('0x42')]['toLowerCase']());})){throw new db[(_0xd6b3('0x30'))][(_0xd6b3('0x34'))](_0xd6b3('0x43'));}}}var _0x2458ce={};_0x2458ce[_0xd6b3('0x44')]=_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x2e')](_0xd6b3('0x44'))?_0x120a8b[_0xd6b3('0x32')]['senderName']:_0x120a8b[_0xd6b3('0x45')]['fullname'];_0x2458ce[_0xd6b3('0x46')]=_[_0xd6b3('0x47')](_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x46')])?null:_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x46')];_0x2458ce[_0xd6b3('0x48')]=_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x48')]||![];_0x2458ce['SenderId']=_0x120a8b['user']['id'];return getContent(_0x120a8b['body'])[_0xd6b3('0x29')](function(_0x25894a){_0x2458ce[_0xd6b3('0x32')]=_0x25894a;return getRecipients(_0x991f58);})[_0xd6b3('0x29')](function(_0x21d09d){_0x2458ce[_0xd6b3('0x49')]=_[_0xd6b3('0x4a')](_0x21d09d)[_0xd6b3('0x4b')](',');return db[_0xd6b3('0x4c')][_0xd6b3('0x4d')](function(_0x439896){return db[_0xd6b3('0x4e')][_0xd6b3('0x4f')](_0x2458ce,{'raw':!![],'transaction':_0x439896})[_0xd6b3('0x29')](function(_0x3efcd8){var _0x16e129={'sender':_0x2458ce[_0xd6b3('0x44')],'description':_0x2458ce[_0xd6b3('0x46')],'content':_0x2458ce[_0xd6b3('0x32')],'beep':_0x2458ce[_0xd6b3('0x48')]};_0x21d09d[_0xd6b3('0x50')](function(_0x10b23a){_0x16e129[_0xd6b3('0x51')]=_0x10b23a;socket[_0xd6b3('0x52')](_0xd6b3('0x53'),_0x16e129);});return _0x3efcd8;});});})[_0xd6b3('0x29')](respondWithResult(_0x4c2afa,0xc9))[_0xd6b3('0x54')](handleError(_0x4c2afa,null));};function getContent(_0x198f81){return new BPromise(function(_0x45ea5b,_0x2a4b93){if(_0x198f81[_0xd6b3('0x2d')]){_0x45ea5b(_0x198f81['text']);return;}return db['Template']['findOne']({'attributes':[_0xd6b3('0x55')],'where':{'id':_0x198f81[_0xd6b3('0x2f')]},'raw':!![]})[_0xd6b3('0x29')](function(_0x4a5f60){if(!_0x4a5f60)throw new db[(_0xd6b3('0x30'))][(_0xd6b3('0x34'))](_0xd6b3('0x56'));var _0x1fdc52=Mustache[_0xd6b3('0x57')](_0x4a5f60[_0xd6b3('0x55')],_0x198f81[_0xd6b3('0x33')]);_0x45ea5b(_0x1fdc52);})['catch'](function(_0x1736f0){_0x2a4b93(_0x1736f0);});});}function getRecipients(_0x16867){return new BPromise(function(_0x2a3bd5,_0x2bd899){var _0x4b94bf=[];var _0x6e431f=[];_0x16867[_0xd6b3('0x50')](function(_0x1ae056){var _0x48c6c9=_[_0xd6b3('0x58')](_0x1ae056[_0xd6b3('0x42')][_0xd6b3('0x59')]());if(_0x48c6c9===_0xd6b3('0x5a')){_0x4b94bf=_[_0xd6b3('0x5b')](_0x4b94bf,_0x1ae056['ids']);}else{if(_[_0xd6b3('0x41')](_0x48c6c9,_0xd6b3('0x5c')))_0x48c6c9=_0x48c6c9[_0xd6b3('0x5d')](_0xd6b3('0x5c'),_0xd6b3('0x5e'));_0x1ae056['ids'][_0xd6b3('0x50')](function(_0x481961){_0x6e431f[_0xd6b3('0x5f')](getAgents(_0x48c6c9,_0x481961));});}});return BPromise[_0xd6b3('0x60')](_0x6e431f)[_0xd6b3('0x29')](function(_0x5c96eb){_0x4b94bf=_[_0xd6b3('0x5b')](_0x4b94bf,_[_0xd6b3('0x61')](_0x5c96eb));_0x2a3bd5(_0x4b94bf);})[_0xd6b3('0x54')](function(_0x45c47a){_0x2bd899(_0x45c47a);});});}function getAgents(_0x1af71d,_0x1cfa25){return new BPromise(function(_0xdefc9d,_0x3d29c4){return db[_0x1af71d]['findOne']({'where':{'id':_0x1cfa25}})['then'](function(_0x23229f){return _0x23229f[_0xd6b3('0x62')]({'attributes':['id'],'raw':!![]})['then'](function(_0x848e6b){var _0x23d44b=_[_0xd6b3('0x63')](_0x848e6b,'id');_0xdefc9d(_0x23d44b);});})['catch'](function(_0xcab11d){_0x3d29c4(_0xcab11d);});});} \ No newline at end of file +var _0x463d=['findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./notification.socket','register','sendStatus','status','end','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','sendNotification','body','text','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','recipientsId','join','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','catch','Template','html','render','view','startCase','User','ids','queue','replace','Queue','push','all','union'];(function(_0x51269b,_0x165d30){var _0x354969=function(_0x45aa13){while(--_0x45aa13){_0x51269b['push'](_0x51269b['shift']());}};_0x354969(++_0x165d30);}(_0x463d,0xc7));var _0xd463=function(_0x190145,_0x434ef1){_0x190145=_0x190145-0x0;var _0x540a75=_0x463d[_0x190145];return _0x540a75;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd463('0x0'));var rimraf=require(_0xd463('0x1'));var zipdir=require(_0xd463('0x2'));var jsonpatch=require(_0xd463('0x3'));var rp=require(_0xd463('0x4'));var moment=require(_0xd463('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd463('0x6'));var util=require('util');var path=require(_0xd463('0x7'));var sox=require(_0xd463('0x8'));var csv=require(_0xd463('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd463('0xa'));var jsforce=require(_0xd463('0xb'));var deskjs=require(_0xd463('0xc'));var toCsv=require(_0xd463('0x9'));var querystring=require(_0xd463('0xd'));var Papa=require(_0xd463('0xe'));var Redis=require(_0xd463('0xf'));var authService=require(_0xd463('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd463('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd463('0x12'));var utils=require(_0xd463('0x13'));var config=require(_0xd463('0x14'));var licenseUtil=require(_0xd463('0x15'));var db=require(_0xd463('0x16'))['db'];config[_0xd463('0x17')]=_[_0xd463('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd463('0x19'))(new Redis(config[_0xd463('0x17')]));require(_0xd463('0x1a'))[_0xd463('0x1b')](socket);function respondWithStatusCode(_0x5f3da1,_0x5d10f9){_0x5d10f9=_0x5d10f9||0xcc;return function(_0x3a3032){if(_0x3a3032){return _0x5f3da1[_0xd463('0x1c')](_0x5d10f9);}return _0x5f3da1[_0xd463('0x1d')](_0x5d10f9)[_0xd463('0x1e')]();};}function respondWithResult(_0x4d2688,_0x12cc01){_0x12cc01=_0x12cc01||0xc8;return function(_0x5d6ae6){if(_0x5d6ae6){return _0x4d2688[_0xd463('0x1d')](_0x12cc01)['json'](_0x5d6ae6);}};}function respondWithFilteredResult(_0xfa8f6b,_0x421900){return function(_0x1e6b3b){if(_0x1e6b3b){var _0x40dcb8=_0x1e6b3b['count'],_0x1edf60=_0x421900['offset'],_0x4fe44a=_0x421900['offset']+_0x421900[_0xd463('0x1f')],_0x485e2d;if(_0x4fe44a>=_0x40dcb8){_0x4fe44a=_0x40dcb8;_0x485e2d=0xc8;}else{_0x485e2d=0xce;}_0xfa8f6b[_0xd463('0x1d')](_0x485e2d);return _0xfa8f6b[_0xd463('0x20')](_0xd463('0x21'),_0x1edf60+'-'+_0x4fe44a+'/'+_0x40dcb8)[_0xd463('0x22')](_0x1e6b3b);}return null;};}function patchUpdates(_0x519c69){return function(_0x40cb06){try{jsonpatch['apply'](_0x40cb06,_0x519c69,!![]);}catch(_0x4800cb){return BPromise[_0xd463('0x23')](_0x4800cb);}return _0x40cb06[_0xd463('0x24')]();};}function saveUpdates(_0x420643,_0x46e9fd){return function(_0x50f110){if(_0x50f110){return _0x50f110[_0xd463('0x25')](_0x420643)[_0xd463('0x26')](function(_0x47ccd6){return _0x47ccd6;});}return null;};}function removeEntity(_0x3fe823,_0x4f83b4){return function(_0x1d16cf){if(_0x1d16cf){return _0x1d16cf[_0xd463('0x27')]()['then'](function(){_0x3fe823['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24b359,_0x21e961){return function(_0x155740){if(!_0x155740){_0x24b359['sendStatus'](0x194);}return _0x155740;};}function handleError(_0x57f2a7,_0x4f7c46){_0x4f7c46=_0x4f7c46||0x1f4;return function(_0x3d8709){logger[_0xd463('0x28')](_0x3d8709[_0xd463('0x29')]);if(_0x3d8709[_0xd463('0x2a')]){delete _0x3d8709[_0xd463('0x2a')];}_0x57f2a7[_0xd463('0x1d')](_0x4f7c46)['send'](_0x3d8709);};}exports[_0xd463('0x2b')]=function(_0x49f495,_0x4888df,_0x1bdce1){if(!_0x49f495[_0xd463('0x2c')]['hasOwnProperty'](_0xd463('0x2d'))&&!_0x49f495['body'][_0xd463('0x2e')](_0xd463('0x2f'))){throw new db[(_0xd463('0x30'))]['ValidationError'](_0xd463('0x31'));}else{if(_0x49f495[_0xd463('0x2c')][_0xd463('0x2e')](_0xd463('0x2f'))&&!_0x49f495[_0xd463('0x2c')][_0xd463('0x2e')]('view')){throw new db[(_0xd463('0x30'))][(_0xd463('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x49f495['body'][_0xd463('0x2e')]('recipients')){throw new db[(_0xd463('0x30'))][(_0xd463('0x32'))](_0xd463('0x33'));}else{try{var _0x5289fc=JSON[_0xd463('0x34')](_0x49f495[_0xd463('0x2c')][_0xd463('0x35')]);}catch(_0x2d520d){logger[_0xd463('0x28')](_0x2d520d);throw new db['Sequelize'][(_0xd463('0x32'))](_0xd463('0x36'));}var _0xc60952=[_0xd463('0x37'),_0xd463('0x38'),_0xd463('0x39'),_0xd463('0x3a'),_0xd463('0x3b'),_0xd463('0x3c'),_0xd463('0x3d'),_0xd463('0x3e'),_0xd463('0x3f')];if(_[_0xd463('0x40')](_0x5289fc,function(_0x5010c4){return!_[_0xd463('0x41')](_0xc60952,_0x5010c4[_0xd463('0x42')][_0xd463('0x43')]());})){throw new db['Sequelize'][(_0xd463('0x32'))](_0xd463('0x44'));}}}var _0x82257c={};_0x82257c['senderName']=_0x49f495[_0xd463('0x2c')]['hasOwnProperty'](_0xd463('0x45'))?_0x49f495['body'][_0xd463('0x45')]:_0x49f495[_0xd463('0x3f')][_0xd463('0x46')];_0x82257c['recipientsDescription']=_[_0xd463('0x47')](_0x49f495[_0xd463('0x2c')][_0xd463('0x48')])?null:_0x49f495[_0xd463('0x2c')]['recipientsDescription'];_0x82257c[_0xd463('0x49')]=_0x49f495[_0xd463('0x2c')][_0xd463('0x49')]||![];_0x82257c['SenderId']=_0x49f495['user']['id'];return getContent(_0x49f495[_0xd463('0x2c')])[_0xd463('0x26')](function(_0x572cee){_0x82257c[_0xd463('0x2c')]=_0x572cee;return getRecipients(_0x5289fc);})['then'](function(_0xdf221d){_0x82257c[_0xd463('0x4a')]=_['sortBy'](_0xdf221d)[_0xd463('0x4b')](',');return db[_0xd463('0x4c')][_0xd463('0x4d')](function(_0x2fd495){return db[_0xd463('0x4e')][_0xd463('0x4f')](_0x82257c,{'raw':!![],'transaction':_0x2fd495})[_0xd463('0x26')](function(_0x4708b2){var _0x21909c={'sender':_0x82257c[_0xd463('0x45')],'description':_0x82257c[_0xd463('0x48')],'content':_0x82257c[_0xd463('0x2c')],'beep':_0x82257c['beep']};_0xdf221d[_0xd463('0x50')](function(_0x623662){_0x21909c[_0xd463('0x51')]=_0x623662;socket[_0xd463('0x52')](_0xd463('0x53'),_0x21909c);});return _0x4708b2;});});})['then'](respondWithResult(_0x4888df,0xc9))[_0xd463('0x54')](handleError(_0x4888df,null));};function getContent(_0x3c2d70){return new BPromise(function(_0x14dd73,_0x393b6c){if(_0x3c2d70[_0xd463('0x2d')]){_0x14dd73(_0x3c2d70['text']);return;}return db[_0xd463('0x55')]['findOne']({'attributes':[_0xd463('0x56')],'where':{'id':_0x3c2d70[_0xd463('0x2f')]},'raw':!![]})[_0xd463('0x26')](function(_0x3a14df){if(!_0x3a14df)throw new db['Sequelize'][(_0xd463('0x32'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0xae6876=Mustache[_0xd463('0x57')](_0x3a14df[_0xd463('0x56')],_0x3c2d70[_0xd463('0x58')]);_0x14dd73(_0xae6876);})[_0xd463('0x54')](function(_0x21fdf5){_0x393b6c(_0x21fdf5);});});}function getRecipients(_0x4009fa){return new BPromise(function(_0x16b9b1,_0x5512e6){var _0x23f24d=[];var _0x22abe8=[];_0x4009fa['forEach'](function(_0x546e27){var _0x30de22=_[_0xd463('0x59')](_0x546e27[_0xd463('0x42')][_0xd463('0x43')]());if(_0x30de22===_0xd463('0x5a')){_0x23f24d=_['union'](_0x23f24d,_0x546e27[_0xd463('0x5b')]);}else{if(_['includes'](_0x30de22,_0xd463('0x5c')))_0x30de22=_0x30de22[_0xd463('0x5d')](_0xd463('0x5c'),_0xd463('0x5e'));_0x546e27[_0xd463('0x5b')][_0xd463('0x50')](function(_0x59e3d1){_0x22abe8[_0xd463('0x5f')](getAgents(_0x30de22,_0x59e3d1));});}});return BPromise[_0xd463('0x60')](_0x22abe8)[_0xd463('0x26')](function(_0x3b1fc9){_0x23f24d=_[_0xd463('0x61')](_0x23f24d,_['flatten'](_0x3b1fc9));_0x16b9b1(_0x23f24d);})[_0xd463('0x54')](function(_0x3cd914){_0x5512e6(_0x3cd914);});});}function getAgents(_0x15400e,_0x3018ff){return new BPromise(function(_0x40667c,_0x4dc3a5){return db[_0x15400e][_0xd463('0x62')]({'where':{'id':_0x3018ff}})[_0xd463('0x26')](function(_0x40177d){return _0x40177d['getAgents']({'attributes':['id'],'raw':!![]})[_0xd463('0x26')](function(_0x14664e){var _0x1021a5=_['map'](_0x14664e,'id');_0x40667c(_0x1021a5);});})[_0xd463('0x54')](function(_0x1c806d){_0x4dc3a5(_0x1c806d);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 652b938..c9275ae 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 _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x2a6227,_0x603c31){var _0x5b186c=function(_0x45de3f){while(--_0x45de3f){_0x2a6227['push'](_0x2a6227['shift']());}};_0x5b186c(++_0x603c31);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','Notification','setMaxListeners','save','remove','emit'];(function(_0x8dd9ac,_0x23be2e){var _0x96ecdc=function(_0x514e37){while(--_0x514e37){_0x8dd9ac['push'](_0x8dd9ac['shift']());}};_0x96ecdc(++_0x23be2e);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a9bdd,_0x5098f5){_0x4a9bdd=_0x4a9bdd-0x0;var _0x1ba3a4=_0xb10b[_0x4a9bdd];return _0x1ba3a4;};'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 a3217cd..477a70b 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 _0xc18c=['../../config/environment','./notification.attributes','exports','define','Notification','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x3df1fe,_0x1d2ae3){var _0x4e6d59=function(_0x1871b5){while(--_0x1871b5){_0x3df1fe['push'](_0x3df1fe['shift']());}};_0x4e6d59(++_0x1d2ae3);}(_0xc18c,0x13b));var _0xcc18=function(_0x4d5b88,_0x373a2d){_0x4d5b88=_0x4d5b88-0x0;var _0x297b8e=_0xc18c[_0x4d5b88];return _0x297b8e;};'use strict';var _=require(_0xcc18('0x0'));var util=require(_0xcc18('0x1'));var logger=require(_0xcc18('0x2'))(_0xcc18('0x3'));var moment=require(_0xcc18('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc18('0x5'));var rimraf=require(_0xcc18('0x6'));var config=require(_0xcc18('0x7'));var attributes=require(_0xcc18('0x8'));module[_0xcc18('0x9')]=function(_0x347a8b,_0x17e848){return _0x347a8b[_0xcc18('0xa')](_0xcc18('0xb'),attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcc18('0xc'),'collate':_0xcc18('0xd')});}; \ No newline at end of file +var _0x600a=['./notification.attributes','exports','define','notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x594805,_0x1fa42d){var _0x1f8fdd=function(_0x1bd252){while(--_0x1bd252){_0x594805['push'](_0x594805['shift']());}};_0x1f8fdd(++_0x1fa42d);}(_0x600a,0xc9));var _0xa600=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0x600a[_0x231dda];return _0x3f88cb;};'use strict';var _=require(_0xa600('0x0'));var util=require(_0xa600('0x1'));var logger=require(_0xa600('0x2'))(_0xa600('0x3'));var moment=require(_0xa600('0x4'));var BPromise=require(_0xa600('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa600('0x6'));var rimraf=require(_0xa600('0x7'));var config=require(_0xa600('0x8'));var attributes=require(_0xa600('0x9'));module[_0xa600('0xa')]=function(_0xf11b6f,_0x1fea89){return _0xf11b6f[_0xa600('0xb')]('Notification',attributes,{'tableName':_0xa600('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa600('0xd'),'collate':_0xa600('0xe')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index a7cad2c..e064fd7 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 _0xf5b0=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','request','then','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','Notification,\x20%s,\x20%s','message','info','lodash'];(function(_0x2d18c2,_0x4e76a2){var _0xda4b31=function(_0x197a24){while(--_0x197a24){_0x2d18c2['push'](_0x2d18c2['shift']());}};_0xda4b31(++_0x4e76a2);}(_0xf5b0,0x9b));var _0x0f5b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xf5b0[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x0f5b('0x0'));var util=require('util');var moment=require(_0x0f5b('0x1'));var BPromise=require(_0x0f5b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f5b('0x3'));var db=require(_0x0f5b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f5b('0x5'))(_0x0f5b('0x6'));var config=require(_0x0f5b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0f5b('0x8')][_0x0f5b('0x9')]({'port':0x232a});config[_0x0f5b('0xa')]=_[_0x0f5b('0xb')](config['redis'],{'host':_0x0f5b('0xc'),'port':0x18eb});var socket=require(_0x0f5b('0xd'))(new Redis(config[_0x0f5b('0xa')]));require(_0x0f5b('0xe'))[_0x0f5b('0xf')](socket);function respondWithRpcPromise(_0x2cbc66,_0x58bba3,_0x38efef){return new BPromise(function(_0xa57758,_0x29e9a2){return client[_0x0f5b('0x10')](_0x2cbc66,_0x38efef)[_0x0f5b('0x11')](function(_0x557a57){logger['info']('Notification,\x20%s,\x20%s',_0x58bba3,_0x0f5b('0x12'));logger[_0x0f5b('0x13')](_0x0f5b('0x14'),_0x58bba3,'request\x20sent',JSON[_0x0f5b('0x15')](_0x557a57));if(_0x557a57['error']){if(_0x557a57[_0x0f5b('0x16')]['code']===0x1f4){logger[_0x0f5b('0x16')](_0x0f5b('0x17'),_0x58bba3,_0x557a57[_0x0f5b('0x16')][_0x0f5b('0x18')]);return _0x29e9a2(_0x557a57[_0x0f5b('0x16')][_0x0f5b('0x18')]);}logger[_0x0f5b('0x16')](_0x0f5b('0x17'),_0x58bba3,_0x557a57[_0x0f5b('0x16')][_0x0f5b('0x18')]);return _0xa57758(_0x557a57[_0x0f5b('0x16')][_0x0f5b('0x18')]);}else{logger[_0x0f5b('0x19')]('Notification,\x20%s,\x20%s',_0x58bba3,_0x0f5b('0x12'));_0xa57758(_0x557a57['result'][_0x0f5b('0x18')]);}})['catch'](function(_0x4235e1){logger['error'](_0x0f5b('0x17'),_0x58bba3,_0x4235e1);_0x29e9a2(_0x4235e1);});});} \ No newline at end of file +var _0x2ed8=['debug','Notification,\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','client','http','defaults','redis','localhost','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent'];(function(_0x4a795c,_0x25327d){var _0x32eea8=function(_0x89f8f1){while(--_0x89f8f1){_0x4a795c['push'](_0x4a795c['shift']());}};_0x32eea8(++_0x25327d);}(_0x2ed8,0x1e7));var _0x82ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ed8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x82ed('0x0'));var util=require(_0x82ed('0x1'));var moment=require(_0x82ed('0x2'));var BPromise=require(_0x82ed('0x3'));var rs=require(_0x82ed('0x4'));var fs=require('fs');var Redis=require(_0x82ed('0x5'));var db=require(_0x82ed('0x6'))['db'];var utils=require(_0x82ed('0x7'));var logger=require(_0x82ed('0x8'))(_0x82ed('0x9'));var config=require(_0x82ed('0xa'));var jayson=require(_0x82ed('0xb'));var client=jayson[_0x82ed('0xc')][_0x82ed('0xd')]({'port':0x232a});config['redis']=_[_0x82ed('0xe')](config[_0x82ed('0xf')],{'host':_0x82ed('0x10'),'port':0x18eb});var socket=require(_0x82ed('0x11'))(new Redis(config[_0x82ed('0xf')]));require(_0x82ed('0x12'))[_0x82ed('0x13')](socket);function respondWithRpcPromise(_0x587e1d,_0x436108,_0x568281){return new BPromise(function(_0x5b32a9,_0x19537d){return client[_0x82ed('0x14')](_0x587e1d,_0x568281)[_0x82ed('0x15')](function(_0x47981b){logger[_0x82ed('0x16')](_0x82ed('0x17'),_0x436108,_0x82ed('0x18'));logger[_0x82ed('0x19')](_0x82ed('0x1a'),_0x436108,_0x82ed('0x18'),JSON['stringify'](_0x47981b));if(_0x47981b[_0x82ed('0x1b')]){if(_0x47981b[_0x82ed('0x1b')][_0x82ed('0x1c')]===0x1f4){logger[_0x82ed('0x1b')]('Notification,\x20%s,\x20%s',_0x436108,_0x47981b[_0x82ed('0x1b')][_0x82ed('0x1d')]);return _0x19537d(_0x47981b[_0x82ed('0x1b')]['message']);}logger[_0x82ed('0x1b')]('Notification,\x20%s,\x20%s',_0x436108,_0x47981b['error'][_0x82ed('0x1d')]);return _0x5b32a9(_0x47981b[_0x82ed('0x1b')]['message']);}else{logger[_0x82ed('0x16')](_0x82ed('0x17'),_0x436108,_0x82ed('0x18'));_0x5b32a9(_0x47981b[_0x82ed('0x1e')]['message']);}})[_0x82ed('0x1f')](function(_0x183c19){logger['error']('Notification,\x20%s,\x20%s',_0x436108,_0x183c19);_0x19537d(_0x183c19);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 356d188..2327773 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 _0x5151=['./notification.events','save','update','emit','removeListener'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x5151,0x131));var _0x1515=function(_0x383cd5,_0x1f4b3c){_0x383cd5=_0x383cd5-0x0;var _0x205cf8=_0x5151[_0x383cd5];return _0x205cf8;};'use strict';var NotificationEvents=require(_0x1515('0x0'));var events=[_0x1515('0x1'),'remove',_0x1515('0x2')];function createListener(_0x223c2f,_0x5d2881){return function(_0x3fdf5e){_0x5d2881[_0x1515('0x3')](_0x223c2f,_0x3fdf5e);};}function removeListener(_0x3bdc09,_0x2ab069){return function(){NotificationEvents[_0x1515('0x4')](_0x3bdc09,_0x2ab069);};}exports['register']=function(_0x7d2697){for(var _0x2c592f=0x0,_0x4e169f=events['length'];_0x2c592f<_0x4e169f;_0x2c592f++){var _0x4d31eb=events[_0x2c592f];var _0x3503d0=createListener('notification:'+_0x4d31eb,_0x7d2697);NotificationEvents['on'](_0x4d31eb,_0x3503d0);}}; \ No newline at end of file +var _0x263b=['emit','removeListener','register','./notification.events','remove','update'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x263b,0xb1));var _0xb263=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x263b[_0x5b644e];return _0x49c6bf;};'use strict';var NotificationEvents=require(_0xb263('0x0'));var events=['save',_0xb263('0x1'),_0xb263('0x2')];function createListener(_0x5221bf,_0x3b0812){return function(_0x15c8a0){_0x3b0812[_0xb263('0x3')](_0x5221bf,_0x15c8a0);};}function removeListener(_0x1d8c00,_0x33dd75){return function(){NotificationEvents[_0xb263('0x4')](_0x1d8c00,_0x33dd75);};}exports[_0xb263('0x5')]=function(_0x47f017){for(var _0x438b95=0x0,_0x364fdc=events['length'];_0x438b95<_0x364fdc;_0x438b95++){var _0x3028a8=events[_0x438b95];var _0x2f1c4e=createListener('notification:'+_0x3028a8,_0x47f017);NotificationEvents['on'](_0x3028a8,_0x2f1c4e);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 8e87337..61066eb 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 _0x4b30=['addApplications','/:id/users','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','/:id/interactions','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','/:id/applications'];(function(_0x2a490f,_0x3cb94b){var _0x4683ff=function(_0x8fe63a){while(--_0x8fe63a){_0x2a490f['push'](_0x2a490f['shift']());}};_0x4683ff(++_0x3cb94b);}(_0x4b30,0x1a2));var _0x04b3=function(_0x17d928,_0x15f099){_0x17d928=_0x17d928-0x0;var _0x2c812c=_0x4b30[_0x17d928];return _0x2c812c;};'use strict';var multer=require(_0x04b3('0x0'));var util=require(_0x04b3('0x1'));var path=require('path');var timeout=require(_0x04b3('0x2'));var express=require(_0x04b3('0x3'));var router=express['Router']();var auth=require(_0x04b3('0x4'));var interaction=require(_0x04b3('0x5'));var config=require(_0x04b3('0x6'));var controller=require(_0x04b3('0x7'));router[_0x04b3('0x8')]('/',auth[_0x04b3('0x9')](),controller[_0x04b3('0xa')]);router[_0x04b3('0x8')]('/describe',auth[_0x04b3('0x9')](),controller[_0x04b3('0xb')]);router['get'](_0x04b3('0xc'),auth[_0x04b3('0x9')](),controller[_0x04b3('0xd')]);router[_0x04b3('0x8')](_0x04b3('0xe'),auth['isAuthenticated'](),controller[_0x04b3('0xf')]);router[_0x04b3('0x8')](_0x04b3('0x10'),auth[_0x04b3('0x9')](),controller['getAnswers']);router[_0x04b3('0x8')]('/:id/applications',auth[_0x04b3('0x9')](),controller[_0x04b3('0x11')]);router[_0x04b3('0x8')](_0x04b3('0x12'),auth[_0x04b3('0x9')](),controller['getInteractions']);router[_0x04b3('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x04b3('0x13')]);router['post']('/',auth[_0x04b3('0x9')](),controller['create']);router[_0x04b3('0x14')](_0x04b3('0xe'),auth[_0x04b3('0x9')](),controller[_0x04b3('0x15')]);router[_0x04b3('0x14')](_0x04b3('0x10'),auth[_0x04b3('0x9')](),controller[_0x04b3('0x16')]);router[_0x04b3('0x14')](_0x04b3('0x17'),controller[_0x04b3('0x18')]);router[_0x04b3('0x14')](_0x04b3('0x19'),auth[_0x04b3('0x9')](),controller[_0x04b3('0x1a')]);router['post'](_0x04b3('0x1b'),auth[_0x04b3('0x9')](),controller[_0x04b3('0x1c')]);router['post'](_0x04b3('0x1d'),auth[_0x04b3('0x9')](),controller[_0x04b3('0x1e')]);router[_0x04b3('0x1f')](_0x04b3('0xc'),auth['isAuthenticated'](),controller[_0x04b3('0x20')]);router[_0x04b3('0x21')]('/:id',auth[_0x04b3('0x9')](),controller[_0x04b3('0x22')]);router[_0x04b3('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x04b3('0x10'),auth[_0x04b3('0x9')](),controller[_0x04b3('0x23')]);router[_0x04b3('0x21')](_0x04b3('0x1b'),auth[_0x04b3('0x9')](),controller['removeAgents']);module[_0x04b3('0x24')]=router; \ No newline at end of file +var _0x3a39=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','/:id/interactions','/:id/users','post','addDisposition','addAnswer','/:id/notify','notify','addAgents','/:id/send','send','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports'];(function(_0x12f1e0,_0x5e1353){var _0x48a611=function(_0x10fd55){while(--_0x10fd55){_0x12f1e0['push'](_0x12f1e0['shift']());}};_0x48a611(++_0x5e1353);}(_0x3a39,0x120));var _0x93a3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x3a39[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0x93a3('0x0'));var util=require(_0x93a3('0x1'));var path=require(_0x93a3('0x2'));var timeout=require('connect-timeout');var express=require(_0x93a3('0x3'));var router=express[_0x93a3('0x4')]();var auth=require(_0x93a3('0x5'));var interaction=require(_0x93a3('0x6'));var config=require(_0x93a3('0x7'));var controller=require(_0x93a3('0x8'));router[_0x93a3('0x9')]('/',auth['isAuthenticated'](),controller[_0x93a3('0xa')]);router[_0x93a3('0x9')](_0x93a3('0xb'),auth[_0x93a3('0xc')](),controller[_0x93a3('0xd')]);router[_0x93a3('0x9')](_0x93a3('0xe'),auth['isAuthenticated'](),controller[_0x93a3('0xf')]);router[_0x93a3('0x9')](_0x93a3('0x10'),auth['isAuthenticated'](),controller[_0x93a3('0x11')]);router[_0x93a3('0x9')](_0x93a3('0x12'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x93a3('0x9')](_0x93a3('0x13'),auth[_0x93a3('0xc')](),controller['getApplications']);router['get'](_0x93a3('0x14'),auth[_0x93a3('0xc')](),controller['getInteractions']);router[_0x93a3('0x9')](_0x93a3('0x15'),auth[_0x93a3('0xc')](),controller['getAgents']);router['post']('/',auth[_0x93a3('0xc')](),controller['create']);router[_0x93a3('0x16')](_0x93a3('0x10'),auth[_0x93a3('0xc')](),controller[_0x93a3('0x17')]);router[_0x93a3('0x16')](_0x93a3('0x12'),auth[_0x93a3('0xc')](),controller[_0x93a3('0x18')]);router[_0x93a3('0x16')](_0x93a3('0x19'),controller[_0x93a3('0x1a')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x93a3('0x16')](_0x93a3('0x15'),auth[_0x93a3('0xc')](),controller[_0x93a3('0x1b')]);router['post'](_0x93a3('0x1c'),auth[_0x93a3('0xc')](),controller[_0x93a3('0x1d')]);router['put'](_0x93a3('0xe'),auth[_0x93a3('0xc')](),controller['update']);router[_0x93a3('0x1e')]('/:id',auth[_0x93a3('0xc')](),controller[_0x93a3('0x1f')]);router[_0x93a3('0x1e')](_0x93a3('0x10'),auth['isAuthenticated'](),controller[_0x93a3('0x20')]);router[_0x93a3('0x1e')]('/:id/canned_answers',auth[_0x93a3('0xc')](),controller[_0x93a3('0x21')]);router[_0x93a3('0x1e')](_0x93a3('0x15'),auth[_0x93a3('0xc')](),controller[_0x93a3('0x22')]);module[_0x93a3('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 6c0142b..58b0dc2 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 _0x1156=['mandatoryDisposition','sequelize','exports','STRING','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','setDataValue'];(function(_0x4eeb1b,_0x3ffc9e){var _0x353931=function(_0x413dd3){while(--_0x413dd3){_0x4eeb1b['push'](_0x4eeb1b['shift']());}};_0x353931(++_0x3ffc9e);}(_0x1156,0x182));var _0x6115=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x1156[_0x3b231a];return _0x18d67a;};'use strict';var Sequelize=require(_0x6115('0x0'));var rs=require('randomstring');module[_0x6115('0x1')]={'name':{'type':Sequelize[_0x6115('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6115('0x2')]},'token':{'type':Sequelize[_0x6115('0x2')],'defaultValue':function(){return rs[_0x6115('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6115('0x4')],'defaultValue':function(){return _0x6115('0x5');}},'notificationSound':{'type':Sequelize[_0x6115('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6115('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6115('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6115('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6115('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6115('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6115('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x6115('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6115('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2bc5dc){if(!_0x2bc5dc)this[_0x6115('0x9')]('mandatoryDispositionPauseId',null);this[_0x6115('0x9')](_0x6115('0xa'),_0x2bc5dc);}}}; \ No newline at end of file +var _0x8731=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','name','generate','TEXT','INTEGER','BOOLEAN'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x8731,0x7b));var _0x1873=function(_0x463cd5,_0x59eb94){_0x463cd5=_0x463cd5-0x0;var _0xc2dd24=_0x8731[_0x463cd5];return _0xc2dd24;};'use strict';var Sequelize=require(_0x1873('0x0'));var rs=require(_0x1873('0x1'));module[_0x1873('0x2')]={'name':{'type':Sequelize[_0x1873('0x3')],'unique':_0x1873('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x1873('0x3')]},'token':{'type':Sequelize[_0x1873('0x3')],'defaultValue':function(){return rs[_0x1873('0x5')]();}},'replyUri':{'type':Sequelize[_0x1873('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1873('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1873('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x1873('0x3')]},'queueTransfer':{'type':Sequelize[_0x1873('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1873('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1873('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1873('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1873('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1873('0x8')],'defaultValue':![],'comment':_0x1873('0x9'),'set':function(_0x4a3d23){if(!_0x4a3d23)this[_0x1873('0xa')]('mandatoryDispositionPauseId',null);this[_0x1873('0xa')]('mandatoryDisposition',_0x4a3d23);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 6855be7..43b5ba7 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 _0x84bb=['request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','sendStatus','json','count','limit','set','Content-Range','reject','save','update','destroy','get','UserProfileResource','stack','name','status','index','mandatoryDispositionPause','map','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','offset','order','where','filters','filter','merge','VIRTUAL','options','includeAll','OpenchannelAccount','findAll','rows','show','params','Pause','include','find','create','body','role','OpenchannelAccounts','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','rawAttributes','sort','pick','removeDispositions','getAnswers','CannedAnswer','hasOwnProperty','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','priority','asc','Contacts','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','isArray','getAgents','send','defaults','user','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','http'];(function(_0xe1b102,_0x542a72){var _0xed6dcc=function(_0x3191a6){while(--_0x3191a6){_0xe1b102['push'](_0xe1b102['shift']());}};_0xed6dcc(++_0x542a72);}(_0x84bb,0x9b));var _0xb84b=function(_0x20f4af,_0x4163e6){_0x20f4af=_0x20f4af-0x0;var _0x20b7ed=_0x84bb[_0x20f4af];return _0x20b7ed;};'use strict';var pdf=require(_0xb84b('0x0'));var emlformat=require(_0xb84b('0x1'));var rimraf=require(_0xb84b('0x2'));var zipdir=require(_0xb84b('0x3'));var jsonpatch=require(_0xb84b('0x4'));var rp=require(_0xb84b('0x5'));var moment=require('moment');var BPromise=require(_0xb84b('0x6'));var Mustache=require(_0xb84b('0x7'));var util=require(_0xb84b('0x8'));var path=require(_0xb84b('0x9'));var sox=require(_0xb84b('0xa'));var csv=require(_0xb84b('0xb'));var ejs=require(_0xb84b('0xc'));var fs=require('fs');var _=require(_0xb84b('0xd'));var squel=require(_0xb84b('0xe'));var crypto=require(_0xb84b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xb84b('0x10'));var toCsv=require(_0xb84b('0xb'));var querystring=require(_0xb84b('0x11'));var Papa=require(_0xb84b('0x12'));var Redis=require(_0xb84b('0x13'));var authService=require(_0xb84b('0x14'));var qs=require(_0xb84b('0x15'));var as=require(_0xb84b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb84b('0x17'));var config=require(_0xb84b('0x18'));var licenseUtil=require(_0xb84b('0x19'));var db=require(_0xb84b('0x1a'))['db'];config[_0xb84b('0x1b')]=_['defaults'](config[_0xb84b('0x1b')],{'host':_0xb84b('0x1c'),'port':0x18eb});var socket=require(_0xb84b('0x1d'))(new Redis(config[_0xb84b('0x1b')]));require(_0xb84b('0x1e'))['register'](socket);var jayson=require(_0xb84b('0x1f'));var client=jayson['client'][_0xb84b('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xb84b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3729e2,_0x32ef65,_0x13cd94,_0x332c6f){return new BPromise(function(_0x527946,_0x383119){var _0x3045c3=_0x332c6f||client;return _0x3045c3[_0xb84b('0x21')](_0x3729e2,_0x13cd94)[_0xb84b('0x22')](function(_0xfb356b){logger[_0xb84b('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x32ef65,_0xb84b('0x24'));logger[_0xb84b('0x25')](_0xb84b('0x26'),_0x32ef65,_0xb84b('0x24'),JSON[_0xb84b('0x27')](_0xfb356b));if(_0xfb356b[_0xb84b('0x28')]){if(_0xfb356b[_0xb84b('0x28')][_0xb84b('0x29')]===0x1f4){logger[_0xb84b('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x32ef65,_0xfb356b['error'][_0xb84b('0x2a')]);return _0x383119(_0xfb356b[_0xb84b('0x28')][_0xb84b('0x2a')]);}logger[_0xb84b('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x32ef65,_0xfb356b['error'][_0xb84b('0x2a')]);return _0x527946(_0xfb356b[_0xb84b('0x28')][_0xb84b('0x2a')]);}else{logger[_0xb84b('0x23')](_0xb84b('0x2b'),_0x32ef65,_0xb84b('0x24'));_0x527946(_0xfb356b[_0xb84b('0x2c')][_0xb84b('0x2a')]);}})[_0xb84b('0x2d')](function(_0xd98c7c){logger[_0xb84b('0x28')](_0xb84b('0x2b'),_0x32ef65,_0xd98c7c);_0x383119(_0xd98c7c);});});}function respondWithStatusCode(_0x459e12,_0x6148c4){_0x6148c4=_0x6148c4||0xcc;return function(_0x36d05f){if(_0x36d05f){return _0x459e12[_0xb84b('0x2e')](_0x6148c4);}return _0x459e12['status'](_0x6148c4)['end']();};}function respondWithResult(_0x185fd1,_0x4b51c2){_0x4b51c2=_0x4b51c2||0xc8;return function(_0x5493a8){if(_0x5493a8){return _0x185fd1['status'](_0x4b51c2)[_0xb84b('0x2f')](_0x5493a8);}};}function respondWithFilteredResult(_0x1b68df,_0x5b6795){return function(_0x5b8619){if(_0x5b8619){var _0x1a68d4=_0x5b8619[_0xb84b('0x30')],_0x382792=_0x5b6795['offset'],_0x286d21=_0x5b6795['offset']+_0x5b6795[_0xb84b('0x31')],_0x2a0372;if(_0x286d21>=_0x1a68d4){_0x286d21=_0x1a68d4;_0x2a0372=0xc8;}else{_0x2a0372=0xce;}_0x1b68df['status'](_0x2a0372);return _0x1b68df[_0xb84b('0x32')](_0xb84b('0x33'),_0x382792+'-'+_0x286d21+'/'+_0x1a68d4)[_0xb84b('0x2f')](_0x5b8619);}return null;};}function patchUpdates(_0x3edef1){return function(_0x9a77f2){try{jsonpatch['apply'](_0x9a77f2,_0x3edef1,!![]);}catch(_0x48a980){return BPromise[_0xb84b('0x34')](_0x48a980);}return _0x9a77f2[_0xb84b('0x35')]();};}function saveUpdates(_0x5b03d3,_0x26196f){return function(_0x458dff){if(_0x458dff){return _0x458dff[_0xb84b('0x36')](_0x5b03d3)[_0xb84b('0x22')](function(_0x490315){return _0x490315;});}return null;};}function removeEntity(_0x3628f3,_0x3b8895){return function(_0x16bfe6){if(_0x16bfe6){return _0x16bfe6[_0xb84b('0x37')]()['then'](function(){var _0x531d8c=_0x16bfe6[_0xb84b('0x38')]({'plain':!![]});var _0xa1d89b='OpenchannelAccounts';return db[_0xb84b('0x39')][_0xb84b('0x37')]({'where':{'type':_0xa1d89b,'resourceId':_0x531d8c['id']}})[_0xb84b('0x22')](function(){return _0x16bfe6;});})[_0xb84b('0x22')](function(){_0x3628f3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcf08eb,_0x33c80c){return function(_0x490a38){if(!_0x490a38){_0xcf08eb[_0xb84b('0x2e')](0x194);}return _0x490a38;};}function handleError(_0x2a59fd,_0x470fe4){_0x470fe4=_0x470fe4||0x1f4;return function(_0x1d0696){logger[_0xb84b('0x28')](_0x1d0696[_0xb84b('0x3a')]);if(_0x1d0696['name']){delete _0x1d0696[_0xb84b('0x3b')];}_0x2a59fd[_0xb84b('0x3c')](_0x470fe4)['send'](_0x1d0696);};}exports[_0xb84b('0x3d')]=function(_0x28cc31,_0x1e4325){var _0x5bf924={'include':[{'model':db['Pause'],'as':_0xb84b('0x3e')}]},_0x4a89c8={},_0xcfa37f={'count':0x0,'rows':[]};var _0x1eccec=_[_0xb84b('0x3f')](db['OpenchannelAccount']['rawAttributes'],function(_0x540eec){return{'name':_0x540eec['fieldName'],'type':_0x540eec[_0xb84b('0x40')][_0xb84b('0x41')]};});_0x4a89c8[_0xb84b('0x42')]=_['map'](_0x1eccec,_0xb84b('0x3b'));_0x4a89c8['query']=_[_0xb84b('0x43')](_0x28cc31[_0xb84b('0x44')]);_0x4a89c8['filters']=_['intersection'](_0x4a89c8[_0xb84b('0x42')],_0x4a89c8[_0xb84b('0x44')]);_0x5bf924['attributes']=_[_0xb84b('0x45')](_0x4a89c8[_0xb84b('0x42')],qs[_0xb84b('0x46')](_0x28cc31[_0xb84b('0x44')][_0xb84b('0x46')]));_0x5bf924[_0xb84b('0x47')]=_0x5bf924[_0xb84b('0x47')][_0xb84b('0x48')]?_0x5bf924[_0xb84b('0x47')]:_0x4a89c8[_0xb84b('0x42')];if(!_0x28cc31[_0xb84b('0x44')]['hasOwnProperty'](_0xb84b('0x49'))){_0x5bf924['limit']=qs[_0xb84b('0x31')](_0x28cc31[_0xb84b('0x44')]['limit']);_0x5bf924['offset']=qs[_0xb84b('0x4a')](_0x28cc31[_0xb84b('0x44')][_0xb84b('0x4a')]);}_0x5bf924[_0xb84b('0x4b')]=qs['sort'](_0x28cc31[_0xb84b('0x44')]['sort']);_0x5bf924[_0xb84b('0x4c')]=qs['filters'](_['pick'](_0x28cc31[_0xb84b('0x44')],_0x4a89c8[_0xb84b('0x4d')]),_0x1eccec);if(_0x28cc31[_0xb84b('0x44')][_0xb84b('0x4e')]){_0x5bf924['where']=_[_0xb84b('0x4f')](_0x5bf924[_0xb84b('0x4c')],{'$or':_['map'](_0x1eccec,function(_0x1706c8){if(_0x1706c8[_0xb84b('0x40')]!==_0xb84b('0x50')){var _0x50f960={};_0x50f960[_0x1706c8[_0xb84b('0x3b')]]={'$like':'%'+_0x28cc31[_0xb84b('0x44')][_0xb84b('0x4e')]+'%'};return _0x50f960;}})});}_0x5bf924=_[_0xb84b('0x4f')]({},_0x5bf924,_0x28cc31[_0xb84b('0x51')]);var _0x2ea4d1={'where':_0x5bf924[_0xb84b('0x4c')]};return db['OpenchannelAccount'][_0xb84b('0x30')](_0x2ea4d1)[_0xb84b('0x22')](function(_0x53e0e8){_0xcfa37f[_0xb84b('0x30')]=_0x53e0e8;if(_0x28cc31['query'][_0xb84b('0x52')]){_0x5bf924['include']=[{'all':!![]}];}return db[_0xb84b('0x53')][_0xb84b('0x54')](_0x5bf924);})[_0xb84b('0x22')](function(_0x2878c4){_0xcfa37f[_0xb84b('0x55')]=_0x2878c4;return _0xcfa37f;})[_0xb84b('0x22')](respondWithFilteredResult(_0x1e4325,_0x5bf924))[_0xb84b('0x2d')](handleError(_0x1e4325,null));};exports[_0xb84b('0x56')]=function(_0x4b81ec,_0x12391f){var _0x2d17bf={'raw':![],'where':{'id':_0x4b81ec[_0xb84b('0x57')]['id']},'include':[{'model':db[_0xb84b('0x58')],'as':'mandatoryDispositionPause'}]},_0x3a8f57={};_0x3a8f57['model']=_['keys'](db[_0xb84b('0x53')]['rawAttributes']);_0x3a8f57[_0xb84b('0x44')]=_[_0xb84b('0x43')](_0x4b81ec[_0xb84b('0x44')]);_0x3a8f57['filters']=_[_0xb84b('0x45')](_0x3a8f57[_0xb84b('0x42')],_0x3a8f57[_0xb84b('0x44')]);_0x2d17bf[_0xb84b('0x47')]=_[_0xb84b('0x45')](_0x3a8f57['model'],qs[_0xb84b('0x46')](_0x4b81ec[_0xb84b('0x44')][_0xb84b('0x46')]));_0x2d17bf['attributes']=_0x2d17bf['attributes'][_0xb84b('0x48')]?_0x2d17bf[_0xb84b('0x47')]:_0x3a8f57[_0xb84b('0x42')];if(_0x4b81ec[_0xb84b('0x44')]['includeAll']){_0x2d17bf[_0xb84b('0x59')]=[{'all':!![]}];}_0x2d17bf=_[_0xb84b('0x4f')]({},_0x2d17bf,_0x4b81ec[_0xb84b('0x51')]);return db[_0xb84b('0x53')][_0xb84b('0x5a')](_0x2d17bf)[_0xb84b('0x22')](handleEntityNotFound(_0x12391f,null))[_0xb84b('0x22')](respondWithResult(_0x12391f,null))[_0xb84b('0x2d')](handleError(_0x12391f,null));};exports[_0xb84b('0x5b')]=function(_0xd248b8,_0x47defa){return db[_0xb84b('0x53')][_0xb84b('0x5b')](_0xd248b8[_0xb84b('0x5c')],{})[_0xb84b('0x22')](function(_0x4d1535){var _0x6e287a=_0xd248b8['user'][_0xb84b('0x38')]({'plain':!![]});if(!_0x6e287a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6e287a[_0xb84b('0x5d')]==='user'){var _0x76b790=_0x4d1535[_0xb84b('0x38')]({'plain':!![]});var _0x510182=_0xb84b('0x5e');return db[_0xb84b('0x5f')][_0xb84b('0x5a')]({'where':{'name':_0x510182,'userProfileId':_0x6e287a['userProfileId']},'raw':!![]})['then'](function(_0x2a95ac){if(_0x2a95ac&&_0x2a95ac['autoAssociation']===0x0){return db[_0xb84b('0x39')]['create']({'name':_0x76b790[_0xb84b('0x3b')],'resourceId':_0x76b790['id'],'type':_0x2a95ac[_0xb84b('0x3b')],'sectionId':_0x2a95ac['id']},{})['then'](function(){return _0x4d1535;});}else{return _0x4d1535;}})['catch'](function(_0x528c9f){logger['error'](_0xb84b('0x60'),_0x528c9f);throw _0x528c9f;});}return _0x4d1535;})[_0xb84b('0x22')](respondWithResult(_0x47defa,0xc9))['catch'](handleError(_0x47defa,null));};exports[_0xb84b('0x36')]=function(_0x30884e,_0x71d2d5){if(_0x30884e[_0xb84b('0x5c')]['id']){delete _0x30884e['body']['id'];}return db[_0xb84b('0x53')]['find']({'where':{'id':_0x30884e[_0xb84b('0x57')]['id']},'include':[{'model':db[_0xb84b('0x58')],'as':_0xb84b('0x3e')}]})[_0xb84b('0x22')](handleEntityNotFound(_0x71d2d5,null))['then'](saveUpdates(_0x30884e[_0xb84b('0x5c')],null))[_0xb84b('0x22')](respondWithResult(_0x71d2d5,null))[_0xb84b('0x2d')](handleError(_0x71d2d5,null));};exports['destroy']=function(_0x315b11,_0x174d4f){return db['OpenchannelAccount'][_0xb84b('0x5a')]({'where':{'id':_0x315b11[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x174d4f,null))['then'](removeEntity(_0x174d4f,null))[_0xb84b('0x2d')](handleError(_0x174d4f,null));};exports[_0xb84b('0x61')]=function(_0x535fee,_0x5261c9){return db[_0xb84b('0x53')][_0xb84b('0x61')]()[_0xb84b('0x22')](respondWithResult(_0x5261c9,null))[_0xb84b('0x2d')](handleError(_0x5261c9,null));};exports['addDisposition']=function(_0x2e05ff,_0x44c56e,_0x577d4d){if(_0x2e05ff['body']['id']){delete _0x2e05ff[_0xb84b('0x5c')]['id'];}return db[_0xb84b('0x53')]['find']({'where':{'id':_0x2e05ff[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x44c56e,null))[_0xb84b('0x22')](function(_0x40d4df){if(_0x40d4df){_0x2e05ff[_0xb84b('0x5c')][_0xb84b('0x62')]=_0x40d4df['id'];return db[_0xb84b('0x63')][_0xb84b('0x5b')](_0x2e05ff[_0xb84b('0x5c')]);}})[_0xb84b('0x22')](respondWithResult(_0x44c56e,null))[_0xb84b('0x2d')](handleError(_0x44c56e,null));};exports[_0xb84b('0x64')]=function(_0x49244f,_0x56ebe9,_0x3259fb){var _0x440bba={'raw':![],'where':{}};var _0x103e2b={};var _0x45fb6f={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb84b('0x65')]({'where':{'id':_0x49244f[_0xb84b('0x57')]['id']}})['then'](handleEntityNotFound(_0x56ebe9,null))[_0xb84b('0x22')](function(_0x2c4920){if(_0x2c4920){_0x103e2b[_0xb84b('0x42')]=_[_0xb84b('0x43')](db[_0xb84b('0x63')][_0xb84b('0x66')]);_0x103e2b[_0xb84b('0x44')]=_['keys'](_0x49244f[_0xb84b('0x44')]);_0x103e2b[_0xb84b('0x4d')]=_[_0xb84b('0x45')](_0x103e2b[_0xb84b('0x42')],_0x103e2b[_0xb84b('0x44')]);_0x440bba[_0xb84b('0x47')]=_['intersection'](_0x103e2b[_0xb84b('0x42')],qs[_0xb84b('0x46')](_0x49244f['query'][_0xb84b('0x46')]));_0x440bba[_0xb84b('0x47')]=_0x440bba[_0xb84b('0x47')][_0xb84b('0x48')]?_0x440bba[_0xb84b('0x47')]:_0x103e2b[_0xb84b('0x42')];if(!_0x49244f[_0xb84b('0x44')]['hasOwnProperty']('nolimit')){_0x440bba['limit']=qs[_0xb84b('0x31')](_0x49244f[_0xb84b('0x44')][_0xb84b('0x31')]);_0x440bba[_0xb84b('0x4a')]=qs[_0xb84b('0x4a')](_0x49244f[_0xb84b('0x44')]['offset']);}_0x440bba[_0xb84b('0x4b')]=qs['sort'](_0x49244f['query'][_0xb84b('0x67')]);_0x440bba[_0xb84b('0x4c')]=qs['filters'](_[_0xb84b('0x68')](_0x49244f[_0xb84b('0x44')],_0x103e2b['filters']));_0x440bba[_0xb84b('0x4c')]['OpenchannelAccountId']=_0x2c4920['id'];if(_0x49244f['query'][_0xb84b('0x4e')]){_0x440bba[_0xb84b('0x4c')]=_['merge'](_0x440bba[_0xb84b('0x4c')],{'$or':_[_0xb84b('0x3f')](_0x440bba['attributes'],function(_0x17dc0e){var _0x419c0f={};_0x419c0f[_0x17dc0e]={'$like':'%'+_0x49244f[_0xb84b('0x44')]['filter']+'%'};return _0x419c0f;})});}_0x440bba=_['merge']({},_0x440bba,_0x49244f[_0xb84b('0x51')]);return db[_0xb84b('0x63')][_0xb84b('0x30')]({'where':_0x440bba[_0xb84b('0x4c')]})[_0xb84b('0x22')](function(_0x43ca13){_0x45fb6f[_0xb84b('0x30')]=_0x43ca13;if(_0x49244f[_0xb84b('0x44')][_0xb84b('0x52')]){_0x440bba[_0xb84b('0x59')]=[{'all':!![]}];}return db['Disposition'][_0xb84b('0x54')](_0x440bba);})[_0xb84b('0x22')](function(_0x41aae3){_0x45fb6f[_0xb84b('0x55')]=_0x41aae3;return _0x45fb6f;});}})[_0xb84b('0x22')](respondWithFilteredResult(_0x56ebe9,_0x440bba))[_0xb84b('0x2d')](handleError(_0x56ebe9,null));};exports[_0xb84b('0x69')]=function(_0x575c95,_0x3b5a20,_0x30e9b9){return db[_0xb84b('0x53')][_0xb84b('0x5a')]({'where':{'id':_0x575c95[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x3b5a20,null))[_0xb84b('0x22')](function(_0x36cf6b){if(_0x36cf6b){return _0x36cf6b[_0xb84b('0x69')](_0x575c95[_0xb84b('0x44')]['ids']);}})[_0xb84b('0x22')](respondWithStatusCode(_0x3b5a20,null))[_0xb84b('0x2d')](handleError(_0x3b5a20,null));};exports['addAnswer']=function(_0x37e064,_0xe38444,_0x1618d2){if(_0x37e064[_0xb84b('0x5c')]['id']){delete _0x37e064['body']['id'];}return db['OpenchannelAccount'][_0xb84b('0x5a')]({'where':{'id':_0x37e064[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0xe38444,null))[_0xb84b('0x22')](function(_0x40d982){if(_0x40d982){_0x37e064[_0xb84b('0x5c')][_0xb84b('0x62')]=_0x40d982['id'];return db['CannedAnswer'][_0xb84b('0x5b')](_0x37e064[_0xb84b('0x5c')]);}})[_0xb84b('0x22')](respondWithResult(_0xe38444,null))[_0xb84b('0x2d')](handleError(_0xe38444,null));};exports[_0xb84b('0x6a')]=function(_0x26641c,_0x3ce2da,_0x375272){var _0x1a37df={'raw':![],'where':{}};var _0x25c9ce={};var _0x21987b={'count':0x0,'rows':[]};return db[_0xb84b('0x53')][_0xb84b('0x65')]({'where':{'id':_0x26641c['params']['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x3ce2da,null))[_0xb84b('0x22')](function(_0x3cdd31){if(_0x3cdd31){_0x25c9ce[_0xb84b('0x42')]=_[_0xb84b('0x43')](db[_0xb84b('0x6b')][_0xb84b('0x66')]);_0x25c9ce[_0xb84b('0x44')]=_['keys'](_0x26641c['query']);_0x25c9ce[_0xb84b('0x4d')]=_[_0xb84b('0x45')](_0x25c9ce[_0xb84b('0x42')],_0x25c9ce[_0xb84b('0x44')]);_0x1a37df[_0xb84b('0x47')]=_[_0xb84b('0x45')](_0x25c9ce[_0xb84b('0x42')],qs['fields'](_0x26641c['query'][_0xb84b('0x46')]));_0x1a37df['attributes']=_0x1a37df[_0xb84b('0x47')][_0xb84b('0x48')]?_0x1a37df[_0xb84b('0x47')]:_0x25c9ce['model'];if(!_0x26641c[_0xb84b('0x44')][_0xb84b('0x6c')](_0xb84b('0x49'))){_0x1a37df[_0xb84b('0x31')]=qs['limit'](_0x26641c['query'][_0xb84b('0x31')]);_0x1a37df['offset']=qs[_0xb84b('0x4a')](_0x26641c['query'][_0xb84b('0x4a')]);}_0x1a37df[_0xb84b('0x4b')]=qs[_0xb84b('0x67')](_0x26641c[_0xb84b('0x44')]['sort']);_0x1a37df[_0xb84b('0x4c')]=qs[_0xb84b('0x4d')](_[_0xb84b('0x68')](_0x26641c[_0xb84b('0x44')],_0x25c9ce[_0xb84b('0x4d')]));_0x1a37df[_0xb84b('0x4c')][_0xb84b('0x62')]=_0x3cdd31['id'];if(_0x26641c[_0xb84b('0x44')][_0xb84b('0x4e')]){_0x1a37df[_0xb84b('0x4c')]=_[_0xb84b('0x4f')](_0x1a37df[_0xb84b('0x4c')],{'$or':_[_0xb84b('0x3f')](_0x1a37df[_0xb84b('0x47')],function(_0x12e94f){var _0x1d8a9a={};_0x1d8a9a[_0x12e94f]={'$like':'%'+_0x26641c[_0xb84b('0x44')][_0xb84b('0x4e')]+'%'};return _0x1d8a9a;})});}_0x1a37df=_[_0xb84b('0x4f')]({},_0x1a37df,_0x26641c[_0xb84b('0x51')]);return db[_0xb84b('0x6b')][_0xb84b('0x30')]({'where':_0x1a37df['where']})[_0xb84b('0x22')](function(_0x4ad17a){_0x21987b['count']=_0x4ad17a;if(_0x26641c[_0xb84b('0x44')]['includeAll']){_0x1a37df[_0xb84b('0x59')]=[{'all':!![]}];}return db[_0xb84b('0x6b')][_0xb84b('0x54')](_0x1a37df);})[_0xb84b('0x22')](function(_0x30fbd6){_0x21987b[_0xb84b('0x55')]=_0x30fbd6;return _0x21987b;});}})[_0xb84b('0x22')](respondWithFilteredResult(_0x3ce2da,_0x1a37df))[_0xb84b('0x2d')](handleError(_0x3ce2da,null));};exports[_0xb84b('0x6d')]=function(_0x43fd02,_0x7b4ad8,_0x40db7f){return db['OpenchannelAccount'][_0xb84b('0x5a')]({'where':{'id':_0x43fd02['params']['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x7b4ad8,null))[_0xb84b('0x22')](function(_0x5441f8){if(_0x5441f8){return _0x5441f8['removeAnswers'](_0x43fd02['query'][_0xb84b('0x6e')]);}})['then'](respondWithStatusCode(_0x7b4ad8,null))[_0xb84b('0x2d')](handleError(_0x7b4ad8,null));};exports[_0xb84b('0x6f')]=function(_0x1fc12f,_0x2d7a56,_0x3aef96){var _0x175dc6={'body':_0x1fc12f[_0xb84b('0x5c')],'channel':_0xb84b('0x70')};var _0x5238c2=[];var _0x90fb08=[];var _0xcf038e={};var _0x55927c=![];return db[_0xb84b('0x71')][_0xb84b('0x61')]()['then'](function(_0x221ad4){if(!_0x221ad4){throw new db[(_0xb84b('0x72'))][(_0xb84b('0x73'))](_0xb84b('0x74'));}_0x5238c2=_[_0xb84b('0x75')](_[_0xb84b('0x43')](_0x221ad4),['createdAt',_0xb84b('0x76')]);_0x90fb08=_[_0xb84b('0x75')](_[_0xb84b('0x43')](_0x221ad4),[_0xb84b('0x77'),_0xb84b('0x76'),_0xb84b('0x78'),_0xb84b('0x79')]);if(_0x1fc12f[_0xb84b('0x5c')]['id']){delete _0x1fc12f[_0xb84b('0x5c')]['id'];}if(_['isNil'](_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7a')])){throw new db[(_0xb84b('0x72'))]['ValidationError'](_0xb84b('0x7b'));}if(_[_0xb84b('0x7c')](_0x1fc12f['body'][_0xb84b('0x5c')])||_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x5c')]===''){throw new db[(_0xb84b('0x72'))][(_0xb84b('0x73'))](_0xb84b('0x7d'));}if(_[_0xb84b('0x7c')](_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7e')])){throw new db[(_0xb84b('0x72'))]['ValidationError'](_0xb84b('0x7f')+_0x90fb08);}if(!_[_0xb84b('0x80')](_0x90fb08,_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7e')])){throw new db[(_0xb84b('0x72'))][(_0xb84b('0x73'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x90fb08);}_0xcf038e[_0x1fc12f[_0xb84b('0x5c')]['mapKey']]=_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7a')];})[_0xb84b('0x22')](function(){return db['OpenchannelAccount'][_0xb84b('0x5a')]({'where':{'id':_0x1fc12f['params']['id']},'include':[{'model':db[_0xb84b('0x81')],'as':_0xb84b('0x82'),'include':[{'model':db[_0xb84b('0x71')],'as':'Contacts','where':_0xcf038e,'limit':0x1,'order':[[_0xb84b('0x76'),_0xb84b('0x83')]]}]},{'model':db[_0xb84b('0x84')],'as':_0xb84b('0x85')}]});})[_0xb84b('0x22')](handleEntityNotFound(_0x2d7a56,null))['then'](function(_0x15ae32){if(_0x15ae32&&_0x15ae32[_0xb84b('0x82')]){_0x175dc6[_0xb84b('0x86')]=_0x15ae32;_0x175dc6[_0xb84b('0x87')]=_0x15ae32['Applications'];_0x175dc6['list']=_0x15ae32[_0xb84b('0x82')];_0x175dc6[_0xb84b('0x87')]=_['orderBy'](_0x175dc6[_0xb84b('0x87')],[_0xb84b('0x88')],[_0xb84b('0x89')]);if(_0x175dc6[_0xb84b('0x86')][_0xb84b('0x85')]){delete _0x175dc6['account'][_0xb84b('0x85')];}if(_0x175dc6['account'][_0xb84b('0x82')]&&_0x175dc6['account'][_0xb84b('0x82')][_0xb84b('0x8a')][_0xb84b('0x48')]){return _0x175dc6[_0xb84b('0x86')][_0xb84b('0x82')][_0xb84b('0x8a')][0x0];}var _0x3b80bb=_['defaults'](_0x1fc12f[_0xb84b('0x5c')],{'firstName':_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7a')],'ListId':_0x15ae32[_0xb84b('0x79')]});_0x3b80bb[_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7e')]]=_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7a')];return db[_0xb84b('0x71')][_0xb84b('0x5b')](_0x3b80bb,{'fields':_0x5238c2,'raw':!![]});}})[_0xb84b('0x22')](handleEntityNotFound(_0x2d7a56,null))[_0xb84b('0x22')](function(_0x22bf47){_0x175dc6[_0xb84b('0x8b')]=_0x22bf47;if(_0x22bf47){var _0x3df504={'ContactId':_0x22bf47['id'],'OpenchannelAccountId':_0x1fc12f[_0xb84b('0x57')]['id'],'from':(_0x22bf47['firstName']||'')+'\x20'+(_0x22bf47[_0xb84b('0x8c')]||'')};var _0x38c448={'OpenchannelAccountId':_0x1fc12f['params']['id'],'closed':![]};if(_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x8d')]){_0x38c448[_0xb84b('0x8d')]=_0x1fc12f['body'][_0xb84b('0x8d')];return db[_0xb84b('0x8e')][_0xb84b('0x5a')]({'where':_0x38c448})[_0xb84b('0x22')](function(_0x1362c8){if(_0x1362c8){return[_0x1362c8,![]];}_0x3df504[_0xb84b('0x8d')]=_0x1fc12f[_0xb84b('0x5c')]['threadId'];_0x3df504[_0xb84b('0x8f')]=_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x8f')];return db[_0xb84b('0x8e')]['create'](_0x3df504)[_0xb84b('0x22')](function(_0x1c269f){return[_0x1c269f,!![]];});});}else{_0x38c448['threadId']=null;}_0x38c448[_0xb84b('0x90')]=_0x22bf47['id'];return db['OpenchannelInteraction'][_0xb84b('0x5a')]({'where':_0x38c448})['then'](function(_0x306ed7){if(_0x306ed7){return[_0x306ed7,![]];}return db[_0xb84b('0x8e')][_0xb84b('0x5b')](_0x3df504)[_0xb84b('0x22')](function(_0x38e5d5){return[_0x38e5d5,!![]];});});}})[_0xb84b('0x91')](function(_0x3a6408,_0x3dcea7){if(_0x3a6408){_0x55927c=_0x3dcea7;if(!_0x3dcea7){var _0x15961c={'from':(_0x175dc6[_0xb84b('0x8b')][_0xb84b('0x92')]||'')+'\x20'+(_0x175dc6['contact'][_0xb84b('0x8c')]||'')};if(_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x8d')]&&_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x93')]&&_0x1fc12f[_0xb84b('0x5c')]['threadId']!=_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x93')]){_0x15961c[_0xb84b('0x8d')]=_0x1fc12f['body']['messageId'];}return _0x3a6408['update'](_0x15961c);}else{return _0x3a6408;}}})[_0xb84b('0x22')](function(_0x5c3da8){_0x175dc6[_0xb84b('0x94')]=_0x5c3da8[_0xb84b('0x38')]({'plain':!![]});_0x175dc6['interaction'][_0xb84b('0x95')]=_0x55927c;if(_0x175dc6[_0xb84b('0x94')][_0xb84b('0x95')]){if(_0x175dc6[_0xb84b('0x86')][_0xb84b('0x96')]){_0x175dc6[_0xb84b('0x87')][_0xb84b('0x97')]({'id':0x0,'priority':_0x175dc6[_0xb84b('0x87')][_0xb84b('0x48')]+0x1,'app':_0xb84b('0x98'),'appdata':_0xb84b('0x99'),'interval':_0xb84b('0x9a')});}}return db[_0xb84b('0x9b')][_0xb84b('0x5b')]({'body':_0x1fc12f[_0xb84b('0x5c')]['body'],'OpenchannelAccountId':_0x1fc12f[_0xb84b('0x57')]['id'],'OpenchannelInteractionId':_0x5c3da8['id'],'direction':'in','ContactId':_0x175dc6[_0xb84b('0x8b')]['id'],'AttachmentId':_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x9c')]});})[_0xb84b('0x22')](function(_0x3ee82c){_0x175dc6[_0xb84b('0x2a')]=_0x3ee82c;if(_0x175dc6['interaction'][_0xb84b('0x9d')]){return db[_0xb84b('0x9e')][_0xb84b('0x5a')]({'attributes':['id',_0xb84b('0x3b')],'where':{'id':_0x175dc6[_0xb84b('0x94')]['UserId']}})[_0xb84b('0x22')](function(_0x412801){if(_0x412801){_0x175dc6[_0xb84b('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb84b('0x9f'),'appdata':_0x412801[_0xb84b('0x3b')]+','+(_0x175dc6[_0xb84b('0x86')][_0xb84b('0xa0')]||0xa),'interval':'*,*,*,*'});_0x175dc6[_0xb84b('0xa1')]=![];}return respondWithRpcPromise(_0xb84b('0xa2'),_0xb84b('0xa3'),_0x175dc6);});}return respondWithRpcPromise('Start',_0xb84b('0xa3'),_0x175dc6);})[_0xb84b('0x22')](function(_0x5dd5dc){respondWithRpcPromise('EventManager',_0xb84b('0xa4'),{'event':_0xb84b('0x6f'),'message':_0x5dd5dc},client9002);return _0x5dd5dc;})[_0xb84b('0x22')](respondWithResult(_0x2d7a56,null))[_0xb84b('0x2d')](handleError(_0x2d7a56,null));};exports[_0xb84b('0xa5')]=function(_0x5d1004,_0x29c91b,_0x4a01dd){return db['OpenchannelAccount'][_0xb84b('0x65')]({'where':{'id':_0x5d1004[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x29c91b,null))[_0xb84b('0x22')](function(_0x301291){if(_0x301291){return db[_0xb84b('0xa6')][_0xb84b('0xa7')](function(_0x1d261b){return db[_0xb84b('0x84')]['destroy']({'where':{'OpenchannelAccountId':_0x5d1004[_0xb84b('0x57')]['id']},'transaction':_0x1d261b})[_0xb84b('0x22')](function(_0x13903d){var _0x2f5da8=_['map'](_0x5d1004[_0xb84b('0x5c')],function(_0x280a78){_0x280a78[_0xb84b('0x62')]=_0x5d1004[_0xb84b('0x57')]['id'];return _0x280a78;});return db[_0xb84b('0x84')][_0xb84b('0xa8')](_0x2f5da8,{'transaction':_0x1d261b});});})[_0xb84b('0x22')](function(){return db[_0xb84b('0x84')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x5d1004[_0xb84b('0x57')]['id']},'order':_0xb84b('0x88')});});}})[_0xb84b('0x22')](respondWithResult(_0x29c91b,null))[_0xb84b('0x2d')](handleError(_0x29c91b,null));};exports[_0xb84b('0xa9')]=function(_0x52321e,_0x44a90a,_0x1d68ef){var _0x1c5fc7={};var _0x344c98={};var _0x550adc;var _0xa4c0fb;return db[_0xb84b('0x53')][_0xb84b('0x65')]({'where':{'id':_0x52321e[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x44a90a,null))[_0xb84b('0x22')](function(_0x50a5e8){if(_0x50a5e8){_0x550adc=_0x50a5e8;_0x344c98[_0xb84b('0x42')]=_['keys'](db[_0xb84b('0x84')][_0xb84b('0x66')]);_0x344c98['query']=_[_0xb84b('0x43')](_0x52321e['query']);_0x344c98['filters']=_['intersection'](_0x344c98['model'],_0x344c98[_0xb84b('0x44')]);_0x1c5fc7[_0xb84b('0x47')]=_[_0xb84b('0x45')](_0x344c98[_0xb84b('0x42')],qs[_0xb84b('0x46')](_0x52321e['query'][_0xb84b('0x46')]));_0x1c5fc7[_0xb84b('0x47')]=_0x1c5fc7['attributes'][_0xb84b('0x48')]?_0x1c5fc7['attributes']:_0x344c98[_0xb84b('0x42')];_0x1c5fc7['order']=qs['sort'](_0x52321e[_0xb84b('0x44')]['sort']);_0x1c5fc7[_0xb84b('0x4c')]=qs['filters'](_[_0xb84b('0x68')](_0x52321e[_0xb84b('0x44')],_0x344c98[_0xb84b('0x4d')]));if(_0x52321e[_0xb84b('0x44')][_0xb84b('0x4e')]){_0x1c5fc7[_0xb84b('0x4c')]=_[_0xb84b('0x4f')](_0x1c5fc7['where'],{'$or':_['map'](_0x1c5fc7['attributes'],function(_0x3fca30){var _0x577520={};_0x577520[_0x3fca30]={'$like':'%'+_0x52321e['query'][_0xb84b('0x4e')]+'%'};return _0x577520;})});}_0x1c5fc7=_['merge']({},_0x1c5fc7,_0x52321e['options']);return _0x550adc[_0xb84b('0xa9')](_0x1c5fc7);}})[_0xb84b('0x22')](function(_0x2ccca6){if(_0x2ccca6){_0xa4c0fb=_0x2ccca6[_0xb84b('0x48')];if(!_0x52321e[_0xb84b('0x44')][_0xb84b('0x6c')]('nolimit')){_0x1c5fc7[_0xb84b('0x31')]=qs[_0xb84b('0x31')](_0x52321e['query'][_0xb84b('0x31')]);_0x1c5fc7[_0xb84b('0x4a')]=qs[_0xb84b('0x4a')](_0x52321e[_0xb84b('0x44')][_0xb84b('0x4a')]);}return _0x550adc[_0xb84b('0xa9')](_0x1c5fc7);}})[_0xb84b('0x22')](function(_0xbe0012){if(_0xbe0012){return _0xbe0012?{'count':_0xa4c0fb,'rows':_0xbe0012}:null;}})[_0xb84b('0x22')](respondWithResult(_0x44a90a,null))[_0xb84b('0x2d')](handleError(_0x44a90a,null));};exports['getInteractions']=function(_0x49a137,_0x68b53,_0x4ccd43){var _0x3646c5={'raw':![],'where':{}};var _0x2b0e6b={};var _0x10b6bc={'count':0x0,'rows':[]};return db[_0xb84b('0x53')][_0xb84b('0x65')]({'where':{'id':_0x49a137[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x68b53,null))[_0xb84b('0x22')](function(_0x39a9c0){if(_0x39a9c0){_0x2b0e6b[_0xb84b('0x42')]=_[_0xb84b('0x43')](db[_0xb84b('0x8e')][_0xb84b('0x66')]);_0x2b0e6b[_0xb84b('0x44')]=_[_0xb84b('0x43')](_0x49a137['query']);_0x2b0e6b['filters']=_[_0xb84b('0x45')](_0x2b0e6b[_0xb84b('0x42')],_0x2b0e6b[_0xb84b('0x44')]);_0x3646c5[_0xb84b('0x47')]=_[_0xb84b('0x45')](_0x2b0e6b[_0xb84b('0x42')],qs[_0xb84b('0x46')](_0x49a137[_0xb84b('0x44')][_0xb84b('0x46')]));_0x3646c5[_0xb84b('0x47')]=_0x3646c5[_0xb84b('0x47')][_0xb84b('0x48')]?_0x3646c5['attributes']:_0x2b0e6b[_0xb84b('0x42')];if(!_0x49a137[_0xb84b('0x44')][_0xb84b('0x6c')]('nolimit')){_0x3646c5[_0xb84b('0x31')]=qs[_0xb84b('0x31')](_0x49a137[_0xb84b('0x44')][_0xb84b('0x31')]);_0x3646c5[_0xb84b('0x4a')]=qs[_0xb84b('0x4a')](_0x49a137[_0xb84b('0x44')][_0xb84b('0x4a')]);}_0x3646c5[_0xb84b('0x4b')]=qs[_0xb84b('0x67')](_0x49a137[_0xb84b('0x44')]['sort']);_0x3646c5[_0xb84b('0x4c')]=qs[_0xb84b('0x4d')](_['pick'](_0x49a137['query'],_0x2b0e6b[_0xb84b('0x4d')]));_0x3646c5['where']['OpenchannelAccountId']=_0x39a9c0['id'];if(_0x49a137[_0xb84b('0x44')]['filter']){_0x3646c5[_0xb84b('0x4c')]=_[_0xb84b('0x4f')](_0x3646c5[_0xb84b('0x4c')],{'$or':_[_0xb84b('0x3f')](_0x3646c5[_0xb84b('0x47')],function(_0x422d76){var _0x5f41f6={};_0x5f41f6[_0x422d76]={'$like':'%'+_0x49a137[_0xb84b('0x44')][_0xb84b('0x4e')]+'%'};return _0x5f41f6;})});}_0x3646c5=_[_0xb84b('0x4f')]({},_0x3646c5,_0x49a137[_0xb84b('0x51')]);return db[_0xb84b('0x8e')]['count']({'where':_0x3646c5[_0xb84b('0x4c')]})['then'](function(_0x2ed405){_0x10b6bc['count']=_0x2ed405;if(_0x49a137[_0xb84b('0x44')]['includeAll']){_0x3646c5[_0xb84b('0x59')]=[{'model':db[_0xb84b('0x71')],'as':_0xb84b('0xaa'),'required':![]},{'model':db[_0xb84b('0x9e')],'as':_0xb84b('0xab'),'attributes':[_0xb84b('0x3b'),_0xb84b('0xac'),_0xb84b('0xad')],'required':![]},{'model':db[_0xb84b('0xae')],'as':'Tags','attributes':['id',_0xb84b('0x3b'),_0xb84b('0xaf')],'where':_0x49a137['query'][_0xb84b('0xb0')]?{'id':_0x49a137[_0xb84b('0x44')]['tag']}:undefined,'required':_0x49a137[_0xb84b('0x44')][_0xb84b('0xb0')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xb84b('0x54')](_0x3646c5);})[_0xb84b('0x22')](function(_0x1b6d16){_0x10b6bc[_0xb84b('0x55')]=_0x1b6d16;return _0x10b6bc;});}})[_0xb84b('0x22')](respondWithFilteredResult(_0x68b53,_0x3646c5))[_0xb84b('0x2d')](handleError(_0x68b53,null));};exports['addAgents']=function(_0x4a04ca,_0x5ea08c,_0x24fffe){return db[_0xb84b('0x53')][_0xb84b('0x5a')]({'where':{'id':_0x4a04ca[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x5ea08c,null))[_0xb84b('0x22')](function(_0x55773d){if(_0x55773d){return _0x55773d[_0xb84b('0xb1')](_0x4a04ca[_0xb84b('0x5c')][_0xb84b('0x6e')],_[_0xb84b('0xb2')](_0x4a04ca[_0xb84b('0x5c')],[_0xb84b('0x6e'),'id'])||{})[_0xb84b('0x91')](function(_0x492e00){for(var _0x579cbb=0x0;_0x579cbb<_0x4a04ca[_0xb84b('0x5c')]['ids']['length'];_0x579cbb+=0x1){socket[_0xb84b('0xb3')](_0xb84b('0xb4'),{'UserId':_0x4a04ca[_0xb84b('0x5c')][_0xb84b('0x6e')][_0x579cbb],'OpenchannelAccountId':_0x4a04ca[_0xb84b('0x57')]['id']});}return _0x492e00;});}})[_0xb84b('0x22')](respondWithResult(_0x5ea08c,null))['catch'](handleError(_0x5ea08c,null));};exports['removeAgents']=function(_0x7e1222,_0xb6e5fc,_0x271b8f){return db[_0xb84b('0x53')][_0xb84b('0x5a')]({'where':{'id':_0x7e1222['params']['id']}})['then'](handleEntityNotFound(_0xb6e5fc,null))[_0xb84b('0x22')](function(_0x5db9fb){if(_0x5db9fb){return _0x5db9fb['removeAgents'](_0x7e1222[_0xb84b('0x44')]['ids'])['then'](function(){if(_[_0xb84b('0xb5')](_0x7e1222[_0xb84b('0x44')][_0xb84b('0x6e')])){for(var _0x24630f=0x0;_0x24630f<_0x7e1222['query'][_0xb84b('0x6e')]['length'];_0x24630f+=0x1){socket[_0xb84b('0xb3')]('userOpenchannelAccount:remove',{'UserId':Number(_0x7e1222[_0xb84b('0x44')][_0xb84b('0x6e')][_0x24630f]),'OpenchannelAccountId':Number(_0x7e1222[_0xb84b('0x57')]['id'])});}}else{socket[_0xb84b('0xb3')]('userOpenchannelAccount:remove',{'UserId':Number(_0x7e1222['query'][_0xb84b('0x6e')]),'OpenchannelAccountId':Number(_0x7e1222['params']['id'])});}});}})[_0xb84b('0x22')](respondWithStatusCode(_0xb6e5fc,null))[_0xb84b('0x2d')](handleError(_0xb6e5fc,null));};exports[_0xb84b('0xb6')]=function(_0x46df7c,_0x520118,_0x3a4285){var _0x12d796={};var _0x5bc04d={};var _0x36f5a1;var _0x186202;return db['OpenchannelAccount'][_0xb84b('0x65')]({'where':{'id':_0x46df7c[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x520118,null))[_0xb84b('0x22')](function(_0x18117c){if(_0x18117c){_0x36f5a1=_0x18117c;_0x5bc04d[_0xb84b('0x42')]=_[_0xb84b('0x43')](db['User'][_0xb84b('0x66')]);_0x5bc04d[_0xb84b('0x44')]=_[_0xb84b('0x43')](_0x46df7c[_0xb84b('0x44')]);_0x5bc04d[_0xb84b('0x4d')]=_[_0xb84b('0x45')](_0x5bc04d[_0xb84b('0x42')],_0x5bc04d[_0xb84b('0x44')]);_0x12d796[_0xb84b('0x47')]=_[_0xb84b('0x45')](_0x5bc04d[_0xb84b('0x42')],qs[_0xb84b('0x46')](_0x46df7c[_0xb84b('0x44')][_0xb84b('0x46')]));_0x12d796[_0xb84b('0x47')]=_0x12d796[_0xb84b('0x47')]['length']?_0x12d796['attributes']:_0x5bc04d[_0xb84b('0x42')];_0x12d796['order']=qs['sort'](_0x46df7c[_0xb84b('0x44')][_0xb84b('0x67')]);_0x12d796[_0xb84b('0x4c')]=qs[_0xb84b('0x4d')](_[_0xb84b('0x68')](_0x46df7c['query'],_0x5bc04d[_0xb84b('0x4d')]));if(_0x46df7c[_0xb84b('0x44')][_0xb84b('0x4e')]){_0x12d796[_0xb84b('0x4c')]=_[_0xb84b('0x4f')](_0x12d796[_0xb84b('0x4c')],{'$or':_[_0xb84b('0x3f')](_0x12d796[_0xb84b('0x47')],function(_0x599dda){var _0x3415fc={};_0x3415fc[_0x599dda]={'$like':'%'+_0x46df7c['query'][_0xb84b('0x4e')]+'%'};return _0x3415fc;})});}_0x12d796=_[_0xb84b('0x4f')]({},_0x12d796,_0x46df7c[_0xb84b('0x51')]);return _0x36f5a1['getAgents'](_0x12d796);}})['then'](function(_0x46f9bd){if(_0x46f9bd){_0x186202=_0x46f9bd['length'];if(!_0x46df7c['query'][_0xb84b('0x6c')]('nolimit')){_0x12d796[_0xb84b('0x31')]=qs[_0xb84b('0x31')](_0x46df7c[_0xb84b('0x44')][_0xb84b('0x31')]);_0x12d796[_0xb84b('0x4a')]=qs[_0xb84b('0x4a')](_0x46df7c['query'][_0xb84b('0x4a')]);}return _0x36f5a1[_0xb84b('0xb6')](_0x12d796);}})[_0xb84b('0x22')](function(_0x1fea7e){if(_0x1fea7e){return _0x1fea7e?{'count':_0x186202,'rows':_0x1fea7e}:null;}})[_0xb84b('0x22')](respondWithResult(_0x520118,null))[_0xb84b('0x2d')](handleError(_0x520118,null));};exports[_0xb84b('0xb7')]=function(_0x1980da,_0x55628f,_0x380ee2){var _0x2e6507,_0x13ac50,_0x3a9a3e;if(_['isNil'](_0x1980da[_0xb84b('0x5c')][_0xb84b('0x5c')])||_0x1980da[_0xb84b('0x5c')][_0xb84b('0x5c')]===''){throw new db['Sequelize'][(_0xb84b('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb84b('0x7c')](_0x1980da[_0xb84b('0x5c')]['to'])){}_0x2e6507=_0x1980da['body']['to'];return db[_0xb84b('0x53')]['findOne']({'where':{'id':_0x1980da[_0xb84b('0x57')]['id']}})['then'](handleEntityNotFound(_0x55628f,null))[_0xb84b('0x22')](function(_0xf07ee9){if(_0xf07ee9){return db['OpenchannelAccount'][_0xb84b('0x5a')]({'where':{'id':_0xf07ee9['id']},'include':[{'model':db['CmList'],'as':_0xb84b('0x82'),'include':[{'model':db[_0xb84b('0x71')],'as':_0xb84b('0x8a'),'where':{[_0xf07ee9[_0xb84b('0x7e')]]:_0x2e6507},'limit':0x1,'order':[['updatedAt',_0xb84b('0x83')]]}]}]})['then'](handleEntityNotFound(_0x55628f,null))['then'](function(_0x255a69){if(_0x255a69&&_0x255a69[_0xb84b('0x82')]){_0x13ac50=_0x255a69[_0xb84b('0x38')]({'plain':!![]});if(_0x13ac50[_0xb84b('0x82')]&&_0x13ac50[_0xb84b('0x82')][_0xb84b('0x8a')]['length']){return _0x13ac50[_0xb84b('0x82')][_0xb84b('0x8a')][0x0];}return db[_0xb84b('0x71')]['create'](_[_0xb84b('0xb8')](_0x1980da[_0xb84b('0x5c')],{'firstName':_0x2e6507,[_0x255a69['mapKey']]:_0x2e6507,'phone':_0x2e6507,'ListId':_0x13ac50['ListId']}));}})[_0xb84b('0x22')](handleEntityNotFound(_0x55628f,null))[_0xb84b('0x22')](function(_0x4f9135){if(_0x4f9135){_0x3a9a3e=_0x4f9135;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x3a9a3e['id'],'closed':![],'OpenchannelAccountId':_0x13ac50['id']}})['then'](function(_0x396ebe){if(_0x396ebe){return[_0x396ebe,![]];}return db['OpenchannelInteraction'][_0xb84b('0x5b')]({'UserId':_0x1980da[_0xb84b('0xb9')]['id'],'ContactId':_0x3a9a3e['id'],'OpenchannelAccountId':_0x13ac50['id'],'lastMsgDirection':'out','Messages':[_[_0xb84b('0x4f')](_0x1980da[_0xb84b('0x5c')],{'read':![],'body':_0x1980da['body'][_0xb84b('0x5c')],'OpenchannelAccountId':_0x13ac50['id'],'UserId':_0x1980da[_0xb84b('0xb9')]['id'],'ContactId':_0x3a9a3e['id']})]},{'include':[{'model':db[_0xb84b('0x9b')],'as':_0xb84b('0xba')}]})[_0xb84b('0x22')](function(_0x5a9c55){return[_0x5a9c55,!![]];});});}})[_0xb84b('0x91')](function(_0x13ae44,_0x7bfb9b){if(_0x7bfb9b){return _0x13ae44;}return db[_0xb84b('0x9b')][_0xb84b('0x5b')](_[_0xb84b('0x4f')](_0x1980da[_0xb84b('0x5c')],{'read':![],'body':_0x1980da[_0xb84b('0x5c')][_0xb84b('0x5c')],'OpenchannelAccountId':_0x13ac50['id'],'OpenchannelInteractionId':_0x13ae44['id'],'UserId':_0x1980da['user']['id'],'ContactId':_0x3a9a3e['id']}))[_0xb84b('0x22')](function(_0x391654){_0x13ae44[_0xb84b('0xbb')][_0xb84b('0xba')]=[];_0x13ae44[_0xb84b('0xbb')][_0xb84b('0xba')][_0xb84b('0x97')](_0x391654[_0xb84b('0xbb')]);return _0x13ae44;});});}})[_0xb84b('0x22')](respondWithResult(_0x55628f,null))[_0xb84b('0x2d')](handleError(_0x55628f,null));}; \ No newline at end of file +var _0xa527=['internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','user','out','OpenchannelMessage','Messages','spread','dataValues','eml-format','rimraf','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','request\x20sent','catch','status','end','json','count','offset','limit','Content-Range','apply','save','OpenchannelAccounts','UserProfileResource','destroy','sendStatus','stack','send','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','key','model','map','name','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','filter','includeAll','findAll','rows','show','Pause','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','update','params','describe','getDispositions','findOne','Disposition','OpenchannelAccountId','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','include','removeAnswers','notify','openchannel','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','get','created','autoclose','push','unmanaged','*,*,*,*','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','bulkCreate','findAndCountAll','getApplications','order','getInteractions','User','fullname'];(function(_0x6579e6,_0x745d22){var _0x4f796f=function(_0x576fba){while(--_0x576fba){_0x6579e6['push'](_0x6579e6['shift']());}};_0x4f796f(++_0x745d22);}(_0xa527,0x182));var _0x7a52=function(_0x9979f9,_0x22dba0){_0x9979f9=_0x9979f9-0x0;var _0x53b7fe=_0xa527[_0x9979f9];return _0x53b7fe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7a52('0x0'));var rimraf=require(_0x7a52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7a52('0x2'));var moment=require(_0x7a52('0x3'));var BPromise=require(_0x7a52('0x4'));var Mustache=require(_0x7a52('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7a52('0x6'));var fs=require('fs');var _=require(_0x7a52('0x7'));var squel=require(_0x7a52('0x8'));var crypto=require(_0x7a52('0x9'));var jsforce=require(_0x7a52('0xa'));var deskjs=require(_0x7a52('0xb'));var toCsv=require(_0x7a52('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7a52('0xd'));var authService=require(_0x7a52('0xe'));var qs=require(_0x7a52('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a52('0x10'));var logger=require('../../config/logger')(_0x7a52('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7a52('0x12'));var db=require(_0x7a52('0x13'))['db'];config[_0x7a52('0x14')]=_[_0x7a52('0x15')](config[_0x7a52('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x7a52('0x16'))(new Redis(config[_0x7a52('0x14')]));require(_0x7a52('0x17'))[_0x7a52('0x18')](socket);var jayson=require(_0x7a52('0x19'));var client=jayson[_0x7a52('0x1a')][_0x7a52('0x1b')]({'port':0x232c});var client9002=jayson[_0x7a52('0x1a')][_0x7a52('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x92d8c6,_0x2c9ba6,_0xcfc634,_0xe68482){return new BPromise(function(_0x267253,_0x216a4f){var _0x10b3cf=_0xe68482||client;return _0x10b3cf[_0x7a52('0x1c')](_0x92d8c6,_0xcfc634)[_0x7a52('0x1d')](function(_0x4bf8de){logger[_0x7a52('0x1e')]('OpenchannelAccount,\x20%s,\x20%s',_0x2c9ba6,'request\x20sent');logger[_0x7a52('0x1f')](_0x7a52('0x20'),_0x2c9ba6,'request\x20sent',JSON[_0x7a52('0x21')](_0x4bf8de));if(_0x4bf8de[_0x7a52('0x22')]){if(_0x4bf8de[_0x7a52('0x22')][_0x7a52('0x23')]===0x1f4){logger[_0x7a52('0x22')](_0x7a52('0x24'),_0x2c9ba6,_0x4bf8de['error'][_0x7a52('0x25')]);return _0x216a4f(_0x4bf8de[_0x7a52('0x22')][_0x7a52('0x25')]);}logger['error'](_0x7a52('0x24'),_0x2c9ba6,_0x4bf8de[_0x7a52('0x22')][_0x7a52('0x25')]);return _0x267253(_0x4bf8de[_0x7a52('0x22')][_0x7a52('0x25')]);}else{logger[_0x7a52('0x1e')](_0x7a52('0x24'),_0x2c9ba6,_0x7a52('0x26'));_0x267253(_0x4bf8de['result'][_0x7a52('0x25')]);}})[_0x7a52('0x27')](function(_0x26539f){logger[_0x7a52('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x2c9ba6,_0x26539f);_0x216a4f(_0x26539f);});});}function respondWithStatusCode(_0x2fb963,_0xbcab4b){_0xbcab4b=_0xbcab4b||0xcc;return function(_0x1172d2){if(_0x1172d2){return _0x2fb963['sendStatus'](_0xbcab4b);}return _0x2fb963[_0x7a52('0x28')](_0xbcab4b)[_0x7a52('0x29')]();};}function respondWithResult(_0x26bfc,_0x5cd19f){_0x5cd19f=_0x5cd19f||0xc8;return function(_0xa5e9fa){if(_0xa5e9fa){return _0x26bfc['status'](_0x5cd19f)[_0x7a52('0x2a')](_0xa5e9fa);}};}function respondWithFilteredResult(_0x485c4a,_0x5052bd){return function(_0xfe7501){if(_0xfe7501){var _0x4108f1=_0xfe7501[_0x7a52('0x2b')],_0x376a9c=_0x5052bd['offset'],_0xaab352=_0x5052bd[_0x7a52('0x2c')]+_0x5052bd[_0x7a52('0x2d')],_0x461f5c;if(_0xaab352>=_0x4108f1){_0xaab352=_0x4108f1;_0x461f5c=0xc8;}else{_0x461f5c=0xce;}_0x485c4a[_0x7a52('0x28')](_0x461f5c);return _0x485c4a['set'](_0x7a52('0x2e'),_0x376a9c+'-'+_0xaab352+'/'+_0x4108f1)[_0x7a52('0x2a')](_0xfe7501);}return null;};}function patchUpdates(_0x35a5c3){return function(_0x4a87de){try{jsonpatch[_0x7a52('0x2f')](_0x4a87de,_0x35a5c3,!![]);}catch(_0x50b4d4){return BPromise['reject'](_0x50b4d4);}return _0x4a87de[_0x7a52('0x30')]();};}function saveUpdates(_0x4d311f,_0x25e9b7){return function(_0x19c3ce){if(_0x19c3ce){return _0x19c3ce['update'](_0x4d311f)[_0x7a52('0x1d')](function(_0x5bf986){return _0x5bf986;});}return null;};}function removeEntity(_0x59b546,_0x2dd4ae){return function(_0x23bc1b){if(_0x23bc1b){return _0x23bc1b['destroy']()[_0x7a52('0x1d')](function(){var _0x5ff0ba=_0x23bc1b['get']({'plain':!![]});var _0x29d880=_0x7a52('0x31');return db[_0x7a52('0x32')][_0x7a52('0x33')]({'where':{'type':_0x29d880,'resourceId':_0x5ff0ba['id']}})['then'](function(){return _0x23bc1b;});})[_0x7a52('0x1d')](function(){_0x59b546[_0x7a52('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x360842,_0x2b1342){return function(_0x3666d9){if(!_0x3666d9){_0x360842[_0x7a52('0x34')](0x194);}return _0x3666d9;};}function handleError(_0x3a129d,_0x11c028){_0x11c028=_0x11c028||0x1f4;return function(_0x76fbfa){logger[_0x7a52('0x22')](_0x76fbfa[_0x7a52('0x35')]);if(_0x76fbfa['name']){delete _0x76fbfa['name'];}_0x3a129d[_0x7a52('0x28')](_0x11c028)[_0x7a52('0x36')](_0x76fbfa);};}exports[_0x7a52('0x37')]=function(_0x3b12c5,_0x5ee80c){var _0x3d9b67={'include':[{'model':db['Pause'],'as':_0x7a52('0x38')}]},_0x1f39f9={},_0x28543e={'count':0x0,'rows':[]};var _0x1b1ce5=_['map'](db[_0x7a52('0x39')][_0x7a52('0x3a')],function(_0x596995){return{'name':_0x596995[_0x7a52('0x3b')],'type':_0x596995['type'][_0x7a52('0x3c')]};});_0x1f39f9[_0x7a52('0x3d')]=_[_0x7a52('0x3e')](_0x1b1ce5,_0x7a52('0x3f'));_0x1f39f9['query']=_[_0x7a52('0x40')](_0x3b12c5[_0x7a52('0x41')]);_0x1f39f9['filters']=_[_0x7a52('0x42')](_0x1f39f9[_0x7a52('0x3d')],_0x1f39f9['query']);_0x3d9b67[_0x7a52('0x43')]=_[_0x7a52('0x42')](_0x1f39f9[_0x7a52('0x3d')],qs[_0x7a52('0x44')](_0x3b12c5[_0x7a52('0x41')]['fields']));_0x3d9b67[_0x7a52('0x43')]=_0x3d9b67['attributes']['length']?_0x3d9b67[_0x7a52('0x43')]:_0x1f39f9[_0x7a52('0x3d')];if(!_0x3b12c5[_0x7a52('0x41')][_0x7a52('0x45')](_0x7a52('0x46'))){_0x3d9b67[_0x7a52('0x2d')]=qs[_0x7a52('0x2d')](_0x3b12c5[_0x7a52('0x41')][_0x7a52('0x2d')]);_0x3d9b67[_0x7a52('0x2c')]=qs[_0x7a52('0x2c')](_0x3b12c5['query'][_0x7a52('0x2c')]);}_0x3d9b67['order']=qs[_0x7a52('0x47')](_0x3b12c5['query']['sort']);_0x3d9b67[_0x7a52('0x48')]=qs[_0x7a52('0x49')](_[_0x7a52('0x4a')](_0x3b12c5['query'],_0x1f39f9['filters']),_0x1b1ce5);if(_0x3b12c5[_0x7a52('0x41')]['filter']){_0x3d9b67[_0x7a52('0x48')]=_[_0x7a52('0x4b')](_0x3d9b67[_0x7a52('0x48')],{'$or':_['map'](_0x1b1ce5,function(_0x426b63){if(_0x426b63[_0x7a52('0x4c')]!=='VIRTUAL'){var _0x46dfc7={};_0x46dfc7[_0x426b63[_0x7a52('0x3f')]]={'$like':'%'+_0x3b12c5[_0x7a52('0x41')][_0x7a52('0x4d')]+'%'};return _0x46dfc7;}})});}_0x3d9b67=_[_0x7a52('0x4b')]({},_0x3d9b67,_0x3b12c5['options']);var _0x18d20f={'where':_0x3d9b67[_0x7a52('0x48')]};return db[_0x7a52('0x39')][_0x7a52('0x2b')](_0x18d20f)[_0x7a52('0x1d')](function(_0x3ee845){_0x28543e['count']=_0x3ee845;if(_0x3b12c5[_0x7a52('0x41')][_0x7a52('0x4e')]){_0x3d9b67['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x7a52('0x4f')](_0x3d9b67);})[_0x7a52('0x1d')](function(_0x91127a){_0x28543e[_0x7a52('0x50')]=_0x91127a;return _0x28543e;})[_0x7a52('0x1d')](respondWithFilteredResult(_0x5ee80c,_0x3d9b67))[_0x7a52('0x27')](handleError(_0x5ee80c,null));};exports[_0x7a52('0x51')]=function(_0x37859d,_0x15cf3f){var _0x2c135c={'raw':![],'where':{'id':_0x37859d['params']['id']},'include':[{'model':db[_0x7a52('0x52')],'as':_0x7a52('0x38')}]},_0x21b5b6={};_0x21b5b6[_0x7a52('0x3d')]=_['keys'](db[_0x7a52('0x39')][_0x7a52('0x3a')]);_0x21b5b6[_0x7a52('0x41')]=_[_0x7a52('0x40')](_0x37859d[_0x7a52('0x41')]);_0x21b5b6[_0x7a52('0x49')]=_['intersection'](_0x21b5b6[_0x7a52('0x3d')],_0x21b5b6['query']);_0x2c135c[_0x7a52('0x43')]=_[_0x7a52('0x42')](_0x21b5b6['model'],qs['fields'](_0x37859d[_0x7a52('0x41')]['fields']));_0x2c135c[_0x7a52('0x43')]=_0x2c135c[_0x7a52('0x43')][_0x7a52('0x53')]?_0x2c135c[_0x7a52('0x43')]:_0x21b5b6[_0x7a52('0x3d')];if(_0x37859d[_0x7a52('0x41')][_0x7a52('0x4e')]){_0x2c135c['include']=[{'all':!![]}];}_0x2c135c=_[_0x7a52('0x4b')]({},_0x2c135c,_0x37859d['options']);return db[_0x7a52('0x39')]['find'](_0x2c135c)[_0x7a52('0x1d')](handleEntityNotFound(_0x15cf3f,null))[_0x7a52('0x1d')](respondWithResult(_0x15cf3f,null))[_0x7a52('0x27')](handleError(_0x15cf3f,null));};exports[_0x7a52('0x54')]=function(_0x37dc6b,_0x2802db){return db['OpenchannelAccount']['create'](_0x37dc6b[_0x7a52('0x55')],{})[_0x7a52('0x1d')](function(_0x50ea0c){var _0x19f33c=_0x37dc6b['user']['get']({'plain':!![]});if(!_0x19f33c)throw new Error(_0x7a52('0x56'));if(_0x19f33c['role']==='user'){var _0x2fbf47=_0x50ea0c['get']({'plain':!![]});var _0x439840=_0x7a52('0x31');return db[_0x7a52('0x57')][_0x7a52('0x58')]({'where':{'name':_0x439840,'userProfileId':_0x19f33c['userProfileId']},'raw':!![]})[_0x7a52('0x1d')](function(_0x477ee5){if(_0x477ee5&&_0x477ee5[_0x7a52('0x59')]===0x0){return db[_0x7a52('0x32')][_0x7a52('0x54')]({'name':_0x2fbf47['name'],'resourceId':_0x2fbf47['id'],'type':_0x477ee5['name'],'sectionId':_0x477ee5['id']},{})[_0x7a52('0x1d')](function(){return _0x50ea0c;});}else{return _0x50ea0c;}})[_0x7a52('0x27')](function(_0x4f04f7){logger[_0x7a52('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f04f7);throw _0x4f04f7;});}return _0x50ea0c;})['then'](respondWithResult(_0x2802db,0xc9))['catch'](handleError(_0x2802db,null));};exports[_0x7a52('0x5a')]=function(_0x399ab0,_0x1a139f){if(_0x399ab0[_0x7a52('0x55')]['id']){delete _0x399ab0[_0x7a52('0x55')]['id'];}return db[_0x7a52('0x39')][_0x7a52('0x58')]({'where':{'id':_0x399ab0['params']['id']},'include':[{'model':db[_0x7a52('0x52')],'as':_0x7a52('0x38')}]})[_0x7a52('0x1d')](handleEntityNotFound(_0x1a139f,null))['then'](saveUpdates(_0x399ab0[_0x7a52('0x55')],null))['then'](respondWithResult(_0x1a139f,null))[_0x7a52('0x27')](handleError(_0x1a139f,null));};exports[_0x7a52('0x33')]=function(_0x2f5b37,_0x2a5c57){return db[_0x7a52('0x39')][_0x7a52('0x58')]({'where':{'id':_0x2f5b37[_0x7a52('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2a5c57,null))[_0x7a52('0x1d')](removeEntity(_0x2a5c57,null))[_0x7a52('0x27')](handleError(_0x2a5c57,null));};exports[_0x7a52('0x5c')]=function(_0x1e4d23,_0x34f435){return db['OpenchannelAccount']['describe']()[_0x7a52('0x1d')](respondWithResult(_0x34f435,null))['catch'](handleError(_0x34f435,null));};exports['addDisposition']=function(_0x3170ce,_0x4632fb,_0x13d7be){if(_0x3170ce[_0x7a52('0x55')]['id']){delete _0x3170ce[_0x7a52('0x55')]['id'];}return db[_0x7a52('0x39')][_0x7a52('0x58')]({'where':{'id':_0x3170ce[_0x7a52('0x5b')]['id']}})[_0x7a52('0x1d')](handleEntityNotFound(_0x4632fb,null))['then'](function(_0x4d44de){if(_0x4d44de){_0x3170ce[_0x7a52('0x55')]['OpenchannelAccountId']=_0x4d44de['id'];return db['Disposition'][_0x7a52('0x54')](_0x3170ce[_0x7a52('0x55')]);}})[_0x7a52('0x1d')](respondWithResult(_0x4632fb,null))[_0x7a52('0x27')](handleError(_0x4632fb,null));};exports[_0x7a52('0x5d')]=function(_0x28493a,_0x12f0ae,_0x2326d2){var _0xb5fe33={'raw':![],'where':{}};var _0x3efdbe={};var _0x4e369e={'count':0x0,'rows':[]};return db[_0x7a52('0x39')][_0x7a52('0x5e')]({'where':{'id':_0x28493a['params']['id']}})[_0x7a52('0x1d')](handleEntityNotFound(_0x12f0ae,null))['then'](function(_0x4452b9){if(_0x4452b9){_0x3efdbe[_0x7a52('0x3d')]=_[_0x7a52('0x40')](db[_0x7a52('0x5f')][_0x7a52('0x3a')]);_0x3efdbe['query']=_['keys'](_0x28493a[_0x7a52('0x41')]);_0x3efdbe[_0x7a52('0x49')]=_['intersection'](_0x3efdbe[_0x7a52('0x3d')],_0x3efdbe[_0x7a52('0x41')]);_0xb5fe33[_0x7a52('0x43')]=_[_0x7a52('0x42')](_0x3efdbe['model'],qs[_0x7a52('0x44')](_0x28493a[_0x7a52('0x41')][_0x7a52('0x44')]));_0xb5fe33[_0x7a52('0x43')]=_0xb5fe33[_0x7a52('0x43')][_0x7a52('0x53')]?_0xb5fe33[_0x7a52('0x43')]:_0x3efdbe[_0x7a52('0x3d')];if(!_0x28493a[_0x7a52('0x41')]['hasOwnProperty']('nolimit')){_0xb5fe33[_0x7a52('0x2d')]=qs[_0x7a52('0x2d')](_0x28493a['query']['limit']);_0xb5fe33[_0x7a52('0x2c')]=qs['offset'](_0x28493a[_0x7a52('0x41')][_0x7a52('0x2c')]);}_0xb5fe33['order']=qs['sort'](_0x28493a['query'][_0x7a52('0x47')]);_0xb5fe33[_0x7a52('0x48')]=qs[_0x7a52('0x49')](_[_0x7a52('0x4a')](_0x28493a[_0x7a52('0x41')],_0x3efdbe[_0x7a52('0x49')]));_0xb5fe33[_0x7a52('0x48')][_0x7a52('0x60')]=_0x4452b9['id'];if(_0x28493a[_0x7a52('0x41')][_0x7a52('0x4d')]){_0xb5fe33[_0x7a52('0x48')]=_['merge'](_0xb5fe33[_0x7a52('0x48')],{'$or':_[_0x7a52('0x3e')](_0xb5fe33[_0x7a52('0x43')],function(_0x219a29){var _0x6c17a6={};_0x6c17a6[_0x219a29]={'$like':'%'+_0x28493a[_0x7a52('0x41')][_0x7a52('0x4d')]+'%'};return _0x6c17a6;})});}_0xb5fe33=_[_0x7a52('0x4b')]({},_0xb5fe33,_0x28493a[_0x7a52('0x61')]);return db['Disposition'][_0x7a52('0x2b')]({'where':_0xb5fe33[_0x7a52('0x48')]})[_0x7a52('0x1d')](function(_0x4fd8bc){_0x4e369e[_0x7a52('0x2b')]=_0x4fd8bc;if(_0x28493a[_0x7a52('0x41')][_0x7a52('0x4e')]){_0xb5fe33['include']=[{'all':!![]}];}return db[_0x7a52('0x5f')][_0x7a52('0x4f')](_0xb5fe33);})[_0x7a52('0x1d')](function(_0x2915b5){_0x4e369e[_0x7a52('0x50')]=_0x2915b5;return _0x4e369e;});}})[_0x7a52('0x1d')](respondWithFilteredResult(_0x12f0ae,_0xb5fe33))[_0x7a52('0x27')](handleError(_0x12f0ae,null));};exports[_0x7a52('0x62')]=function(_0x200496,_0x35adbf,_0x19d406){return db['OpenchannelAccount'][_0x7a52('0x58')]({'where':{'id':_0x200496['params']['id']}})[_0x7a52('0x1d')](handleEntityNotFound(_0x35adbf,null))[_0x7a52('0x1d')](function(_0x184352){if(_0x184352){return _0x184352[_0x7a52('0x62')](_0x200496[_0x7a52('0x41')][_0x7a52('0x63')]);}})[_0x7a52('0x1d')](respondWithStatusCode(_0x35adbf,null))[_0x7a52('0x27')](handleError(_0x35adbf,null));};exports[_0x7a52('0x64')]=function(_0x20775a,_0x8175e1,_0x154d02){if(_0x20775a[_0x7a52('0x55')]['id']){delete _0x20775a['body']['id'];}return db['OpenchannelAccount'][_0x7a52('0x58')]({'where':{'id':_0x20775a[_0x7a52('0x5b')]['id']}})[_0x7a52('0x1d')](handleEntityNotFound(_0x8175e1,null))[_0x7a52('0x1d')](function(_0x348946){if(_0x348946){_0x20775a[_0x7a52('0x55')][_0x7a52('0x60')]=_0x348946['id'];return db[_0x7a52('0x65')][_0x7a52('0x54')](_0x20775a[_0x7a52('0x55')]);}})['then'](respondWithResult(_0x8175e1,null))[_0x7a52('0x27')](handleError(_0x8175e1,null));};exports[_0x7a52('0x66')]=function(_0x52edea,_0xdc36bc,_0xc34a70){var _0x2ee1d4={'raw':![],'where':{}};var _0x1d7955={};var _0x2e5fcd={'count':0x0,'rows':[]};return db[_0x7a52('0x39')][_0x7a52('0x5e')]({'where':{'id':_0x52edea[_0x7a52('0x5b')]['id']}})[_0x7a52('0x1d')](handleEntityNotFound(_0xdc36bc,null))[_0x7a52('0x1d')](function(_0x3b93c8){if(_0x3b93c8){_0x1d7955['model']=_['keys'](db[_0x7a52('0x65')]['rawAttributes']);_0x1d7955[_0x7a52('0x41')]=_[_0x7a52('0x40')](_0x52edea['query']);_0x1d7955[_0x7a52('0x49')]=_[_0x7a52('0x42')](_0x1d7955[_0x7a52('0x3d')],_0x1d7955['query']);_0x2ee1d4['attributes']=_[_0x7a52('0x42')](_0x1d7955[_0x7a52('0x3d')],qs[_0x7a52('0x44')](_0x52edea[_0x7a52('0x41')]['fields']));_0x2ee1d4['attributes']=_0x2ee1d4[_0x7a52('0x43')][_0x7a52('0x53')]?_0x2ee1d4['attributes']:_0x1d7955[_0x7a52('0x3d')];if(!_0x52edea[_0x7a52('0x41')][_0x7a52('0x45')](_0x7a52('0x46'))){_0x2ee1d4['limit']=qs[_0x7a52('0x2d')](_0x52edea[_0x7a52('0x41')][_0x7a52('0x2d')]);_0x2ee1d4['offset']=qs[_0x7a52('0x2c')](_0x52edea[_0x7a52('0x41')][_0x7a52('0x2c')]);}_0x2ee1d4['order']=qs[_0x7a52('0x47')](_0x52edea[_0x7a52('0x41')][_0x7a52('0x47')]);_0x2ee1d4[_0x7a52('0x48')]=qs[_0x7a52('0x49')](_['pick'](_0x52edea['query'],_0x1d7955['filters']));_0x2ee1d4[_0x7a52('0x48')][_0x7a52('0x60')]=_0x3b93c8['id'];if(_0x52edea[_0x7a52('0x41')]['filter']){_0x2ee1d4[_0x7a52('0x48')]=_[_0x7a52('0x4b')](_0x2ee1d4['where'],{'$or':_[_0x7a52('0x3e')](_0x2ee1d4[_0x7a52('0x43')],function(_0x496ace){var _0x50369d={};_0x50369d[_0x496ace]={'$like':'%'+_0x52edea[_0x7a52('0x41')][_0x7a52('0x4d')]+'%'};return _0x50369d;})});}_0x2ee1d4=_[_0x7a52('0x4b')]({},_0x2ee1d4,_0x52edea['options']);return db[_0x7a52('0x65')][_0x7a52('0x2b')]({'where':_0x2ee1d4[_0x7a52('0x48')]})[_0x7a52('0x1d')](function(_0x438a07){_0x2e5fcd[_0x7a52('0x2b')]=_0x438a07;if(_0x52edea[_0x7a52('0x41')][_0x7a52('0x4e')]){_0x2ee1d4[_0x7a52('0x67')]=[{'all':!![]}];}return db[_0x7a52('0x65')][_0x7a52('0x4f')](_0x2ee1d4);})[_0x7a52('0x1d')](function(_0x13bc1f){_0x2e5fcd[_0x7a52('0x50')]=_0x13bc1f;return _0x2e5fcd;});}})[_0x7a52('0x1d')](respondWithFilteredResult(_0xdc36bc,_0x2ee1d4))[_0x7a52('0x27')](handleError(_0xdc36bc,null));};exports[_0x7a52('0x68')]=function(_0x1f2b09,_0x3cfbb3,_0xd6853e){return db[_0x7a52('0x39')][_0x7a52('0x58')]({'where':{'id':_0x1f2b09['params']['id']}})[_0x7a52('0x1d')](handleEntityNotFound(_0x3cfbb3,null))[_0x7a52('0x1d')](function(_0x54755f){if(_0x54755f){return _0x54755f['removeAnswers'](_0x1f2b09[_0x7a52('0x41')][_0x7a52('0x63')]);}})['then'](respondWithStatusCode(_0x3cfbb3,null))[_0x7a52('0x27')](handleError(_0x3cfbb3,null));};exports[_0x7a52('0x69')]=function(_0x203040,_0x432ad7,_0x2c8c5c){var _0x3018b5={'body':_0x203040[_0x7a52('0x55')],'channel':_0x7a52('0x6a')};var _0x5162c6=[];var _0xbcb967=[];var _0x1f46e2={};var _0x569e2a=![];return db[_0x7a52('0x6b')][_0x7a52('0x5c')]()[_0x7a52('0x1d')](function(_0x33f0a2){if(!_0x33f0a2){throw new db['Sequelize'][(_0x7a52('0x6c'))]('no\x20available\x20attributes');}_0x5162c6=_[_0x7a52('0x6d')](_[_0x7a52('0x40')](_0x33f0a2),[_0x7a52('0x6e'),_0x7a52('0x6f')]);_0xbcb967=_['difference'](_[_0x7a52('0x40')](_0x33f0a2),['createdAt','updatedAt',_0x7a52('0x70'),_0x7a52('0x71')]);if(_0x203040['body']['id']){delete _0x203040['body']['id'];}if(_[_0x7a52('0x72')](_0x203040[_0x7a52('0x55')][_0x7a52('0x73')])){throw new db[(_0x7a52('0x74'))][(_0x7a52('0x6c'))](_0x7a52('0x75'));}if(_[_0x7a52('0x72')](_0x203040[_0x7a52('0x55')][_0x7a52('0x55')])||_0x203040[_0x7a52('0x55')][_0x7a52('0x55')]===''){throw new db[(_0x7a52('0x74'))][(_0x7a52('0x6c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x203040['body'][_0x7a52('0x76')])){throw new db['Sequelize'][(_0x7a52('0x6c'))](_0x7a52('0x77')+_0xbcb967);}if(!_[_0x7a52('0x78')](_0xbcb967,_0x203040[_0x7a52('0x55')][_0x7a52('0x76')])){throw new db[(_0x7a52('0x74'))][(_0x7a52('0x6c'))](_0x7a52('0x79')+_0xbcb967);}_0x1f46e2[_0x203040[_0x7a52('0x55')][_0x7a52('0x76')]]=_0x203040['body'][_0x7a52('0x73')];})['then'](function(){return db[_0x7a52('0x39')][_0x7a52('0x58')]({'where':{'id':_0x203040['params']['id']},'include':[{'model':db[_0x7a52('0x7a')],'as':_0x7a52('0x7b'),'include':[{'model':db[_0x7a52('0x6b')],'as':_0x7a52('0x7c'),'where':_0x1f46e2,'limit':0x1,'order':[[_0x7a52('0x6f'),_0x7a52('0x7d')]]}]},{'model':db[_0x7a52('0x7e')],'as':_0x7a52('0x7f')}]});})[_0x7a52('0x1d')](handleEntityNotFound(_0x432ad7,null))[_0x7a52('0x1d')](function(_0x59276e){if(_0x59276e&&_0x59276e[_0x7a52('0x7b')]){_0x3018b5[_0x7a52('0x80')]=_0x59276e;_0x3018b5[_0x7a52('0x81')]=_0x59276e['Applications'];_0x3018b5[_0x7a52('0x82')]=_0x59276e[_0x7a52('0x7b')];_0x3018b5['applications']=_[_0x7a52('0x83')](_0x3018b5[_0x7a52('0x81')],[_0x7a52('0x84')],['asc']);if(_0x3018b5[_0x7a52('0x80')][_0x7a52('0x7f')]){delete _0x3018b5['account']['Applications'];}if(_0x3018b5[_0x7a52('0x80')][_0x7a52('0x7b')]&&_0x3018b5[_0x7a52('0x80')][_0x7a52('0x7b')][_0x7a52('0x7c')][_0x7a52('0x53')]){return _0x3018b5['account'][_0x7a52('0x7b')][_0x7a52('0x7c')][0x0];}var _0x3c3514=_['defaults'](_0x203040['body'],{'firstName':_0x203040['body'][_0x7a52('0x73')],'ListId':_0x59276e[_0x7a52('0x71')]});_0x3c3514[_0x203040[_0x7a52('0x55')][_0x7a52('0x76')]]=_0x203040[_0x7a52('0x55')][_0x7a52('0x73')];return db['CmContact'][_0x7a52('0x54')](_0x3c3514,{'fields':_0x5162c6,'raw':!![]});}})[_0x7a52('0x1d')](handleEntityNotFound(_0x432ad7,null))[_0x7a52('0x1d')](function(_0xa1fc10){_0x3018b5[_0x7a52('0x85')]=_0xa1fc10;if(_0xa1fc10){var _0x481ba7={'ContactId':_0xa1fc10['id'],'OpenchannelAccountId':_0x203040[_0x7a52('0x5b')]['id'],'from':(_0xa1fc10['firstName']||'')+'\x20'+(_0xa1fc10[_0x7a52('0x86')]||'')};var _0x10d8b0={'OpenchannelAccountId':_0x203040['params']['id'],'closed':![]};if(_0x203040[_0x7a52('0x55')][_0x7a52('0x87')]){_0x10d8b0[_0x7a52('0x87')]=_0x203040[_0x7a52('0x55')][_0x7a52('0x87')];return db[_0x7a52('0x88')]['find']({'where':_0x10d8b0})[_0x7a52('0x1d')](function(_0x4ce4d2){if(_0x4ce4d2){return[_0x4ce4d2,![]];}_0x481ba7['threadId']=_0x203040[_0x7a52('0x55')][_0x7a52('0x87')];_0x481ba7['externalUrl']=_0x203040[_0x7a52('0x55')][_0x7a52('0x89')];return db[_0x7a52('0x88')][_0x7a52('0x54')](_0x481ba7)[_0x7a52('0x1d')](function(_0x1aee96){return[_0x1aee96,!![]];});});}else{_0x10d8b0[_0x7a52('0x87')]=null;}_0x10d8b0[_0x7a52('0x8a')]=_0xa1fc10['id'];return db[_0x7a52('0x88')]['find']({'where':_0x10d8b0})['then'](function(_0x2d3dfe){if(_0x2d3dfe){return[_0x2d3dfe,![]];}return db[_0x7a52('0x88')][_0x7a52('0x54')](_0x481ba7)[_0x7a52('0x1d')](function(_0x5369cf){return[_0x5369cf,!![]];});});}})['spread'](function(_0x633c6a,_0x15bd4e){if(_0x633c6a){_0x569e2a=_0x15bd4e;if(!_0x15bd4e){var _0x415a98={'from':(_0x3018b5['contact']['firstName']||'')+'\x20'+(_0x3018b5['contact'][_0x7a52('0x86')]||'')};if(_0x203040[_0x7a52('0x55')][_0x7a52('0x87')]&&_0x203040[_0x7a52('0x55')]['messageId']&&_0x203040[_0x7a52('0x55')][_0x7a52('0x87')]!=_0x203040[_0x7a52('0x55')][_0x7a52('0x8b')]){_0x415a98[_0x7a52('0x87')]=_0x203040[_0x7a52('0x55')]['messageId'];}return _0x633c6a[_0x7a52('0x5a')](_0x415a98);}else{return _0x633c6a;}}})[_0x7a52('0x1d')](function(_0x21f0e1){_0x3018b5[_0x7a52('0x8c')]=_0x21f0e1[_0x7a52('0x8d')]({'plain':!![]});_0x3018b5[_0x7a52('0x8c')]['created']=_0x569e2a;if(_0x3018b5[_0x7a52('0x8c')][_0x7a52('0x8e')]){if(_0x3018b5['account'][_0x7a52('0x8f')]){_0x3018b5['applications'][_0x7a52('0x90')]({'id':0x0,'priority':_0x3018b5['applications'][_0x7a52('0x53')]+0x1,'app':'close','appdata':_0x7a52('0x91'),'interval':_0x7a52('0x92')});}}return db['OpenchannelMessage'][_0x7a52('0x54')]({'body':_0x203040['body']['body'],'OpenchannelAccountId':_0x203040['params']['id'],'OpenchannelInteractionId':_0x21f0e1['id'],'direction':'in','ContactId':_0x3018b5['contact']['id'],'AttachmentId':_0x203040[_0x7a52('0x55')]['AttachmentId']});})[_0x7a52('0x1d')](function(_0x30d12d){_0x3018b5[_0x7a52('0x25')]=_0x30d12d;if(_0x3018b5['interaction'][_0x7a52('0x93')]){return db['User'][_0x7a52('0x58')]({'attributes':['id',_0x7a52('0x3f')],'where':{'id':_0x3018b5[_0x7a52('0x8c')][_0x7a52('0x93')]}})['then'](function(_0x5620fd){if(_0x5620fd){_0x3018b5[_0x7a52('0x81')][_0x7a52('0x94')]({'id':0x0,'priority':0x0,'app':_0x7a52('0x95'),'appdata':_0x5620fd['name']+','+(_0x3018b5[_0x7a52('0x80')][_0x7a52('0x96')]||0xa),'interval':_0x7a52('0x92')});_0x3018b5[_0x7a52('0x97')]=![];}return respondWithRpcPromise(_0x7a52('0x98'),_0x7a52('0x99'),_0x3018b5);});}return respondWithRpcPromise('Start',_0x7a52('0x99'),_0x3018b5);})['then'](function(_0x35bba4){respondWithRpcPromise('EventManager',_0x7a52('0x9a'),{'event':_0x7a52('0x69'),'message':_0x35bba4},client9002);return _0x35bba4;})[_0x7a52('0x1d')](respondWithResult(_0x432ad7,null))[_0x7a52('0x27')](handleError(_0x432ad7,null));};exports[_0x7a52('0x9b')]=function(_0x55d600,_0x425af1,_0x270e81){return db['OpenchannelAccount'][_0x7a52('0x5e')]({'where':{'id':_0x55d600[_0x7a52('0x5b')]['id']}})['then'](handleEntityNotFound(_0x425af1,null))[_0x7a52('0x1d')](function(_0x5b08ed){if(_0x5b08ed){return db['sequelize']['transaction'](function(_0x5c0bae){return db[_0x7a52('0x7e')][_0x7a52('0x33')]({'where':{'OpenchannelAccountId':_0x55d600[_0x7a52('0x5b')]['id']},'transaction':_0x5c0bae})[_0x7a52('0x1d')](function(_0x84d29f){var _0x20cff0=_['map'](_0x55d600[_0x7a52('0x55')],function(_0x227977){_0x227977['OpenchannelAccountId']=_0x55d600[_0x7a52('0x5b')]['id'];return _0x227977;});return db[_0x7a52('0x7e')][_0x7a52('0x9c')](_0x20cff0,{'transaction':_0x5c0bae});});})[_0x7a52('0x1d')](function(){return db['OpenchannelApplication'][_0x7a52('0x9d')]({'where':{'OpenchannelAccountId':_0x55d600['params']['id']},'order':_0x7a52('0x84')});});}})['then'](respondWithResult(_0x425af1,null))[_0x7a52('0x27')](handleError(_0x425af1,null));};exports[_0x7a52('0x9e')]=function(_0x49179b,_0x13bdf5,_0x2aa792){var _0x3fc170={};var _0x3d6a37={};var _0x210975;var _0x40a27d;return db[_0x7a52('0x39')][_0x7a52('0x5e')]({'where':{'id':_0x49179b[_0x7a52('0x5b')]['id']}})[_0x7a52('0x1d')](handleEntityNotFound(_0x13bdf5,null))[_0x7a52('0x1d')](function(_0x26745c){if(_0x26745c){_0x210975=_0x26745c;_0x3d6a37[_0x7a52('0x3d')]=_[_0x7a52('0x40')](db['OpenchannelApplication'][_0x7a52('0x3a')]);_0x3d6a37[_0x7a52('0x41')]=_[_0x7a52('0x40')](_0x49179b[_0x7a52('0x41')]);_0x3d6a37[_0x7a52('0x49')]=_[_0x7a52('0x42')](_0x3d6a37[_0x7a52('0x3d')],_0x3d6a37[_0x7a52('0x41')]);_0x3fc170[_0x7a52('0x43')]=_[_0x7a52('0x42')](_0x3d6a37['model'],qs[_0x7a52('0x44')](_0x49179b['query'][_0x7a52('0x44')]));_0x3fc170[_0x7a52('0x43')]=_0x3fc170[_0x7a52('0x43')][_0x7a52('0x53')]?_0x3fc170[_0x7a52('0x43')]:_0x3d6a37['model'];_0x3fc170[_0x7a52('0x9f')]=qs[_0x7a52('0x47')](_0x49179b[_0x7a52('0x41')]['sort']);_0x3fc170[_0x7a52('0x48')]=qs['filters'](_[_0x7a52('0x4a')](_0x49179b['query'],_0x3d6a37[_0x7a52('0x49')]));if(_0x49179b[_0x7a52('0x41')]['filter']){_0x3fc170[_0x7a52('0x48')]=_[_0x7a52('0x4b')](_0x3fc170['where'],{'$or':_[_0x7a52('0x3e')](_0x3fc170['attributes'],function(_0x26cc51){var _0x5d4d3e={};_0x5d4d3e[_0x26cc51]={'$like':'%'+_0x49179b[_0x7a52('0x41')][_0x7a52('0x4d')]+'%'};return _0x5d4d3e;})});}_0x3fc170=_[_0x7a52('0x4b')]({},_0x3fc170,_0x49179b[_0x7a52('0x61')]);return _0x210975[_0x7a52('0x9e')](_0x3fc170);}})[_0x7a52('0x1d')](function(_0x20d630){if(_0x20d630){_0x40a27d=_0x20d630[_0x7a52('0x53')];if(!_0x49179b[_0x7a52('0x41')][_0x7a52('0x45')](_0x7a52('0x46'))){_0x3fc170[_0x7a52('0x2d')]=qs[_0x7a52('0x2d')](_0x49179b[_0x7a52('0x41')][_0x7a52('0x2d')]);_0x3fc170[_0x7a52('0x2c')]=qs[_0x7a52('0x2c')](_0x49179b[_0x7a52('0x41')][_0x7a52('0x2c')]);}return _0x210975[_0x7a52('0x9e')](_0x3fc170);}})[_0x7a52('0x1d')](function(_0x57b0e6){if(_0x57b0e6){return _0x57b0e6?{'count':_0x40a27d,'rows':_0x57b0e6}:null;}})[_0x7a52('0x1d')](respondWithResult(_0x13bdf5,null))[_0x7a52('0x27')](handleError(_0x13bdf5,null));};exports[_0x7a52('0xa0')]=function(_0x2773d9,_0x1e6d00,_0x3fedad){var _0xd3286e={'raw':![],'where':{}};var _0x41e2d2={};var _0x13d1ee={'count':0x0,'rows':[]};return db[_0x7a52('0x39')]['findOne']({'where':{'id':_0x2773d9[_0x7a52('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1e6d00,null))[_0x7a52('0x1d')](function(_0x23448d){if(_0x23448d){_0x41e2d2[_0x7a52('0x3d')]=_[_0x7a52('0x40')](db[_0x7a52('0x88')][_0x7a52('0x3a')]);_0x41e2d2[_0x7a52('0x41')]=_[_0x7a52('0x40')](_0x2773d9[_0x7a52('0x41')]);_0x41e2d2[_0x7a52('0x49')]=_[_0x7a52('0x42')](_0x41e2d2[_0x7a52('0x3d')],_0x41e2d2[_0x7a52('0x41')]);_0xd3286e[_0x7a52('0x43')]=_['intersection'](_0x41e2d2[_0x7a52('0x3d')],qs['fields'](_0x2773d9[_0x7a52('0x41')][_0x7a52('0x44')]));_0xd3286e['attributes']=_0xd3286e[_0x7a52('0x43')][_0x7a52('0x53')]?_0xd3286e[_0x7a52('0x43')]:_0x41e2d2['model'];if(!_0x2773d9['query'][_0x7a52('0x45')]('nolimit')){_0xd3286e[_0x7a52('0x2d')]=qs[_0x7a52('0x2d')](_0x2773d9[_0x7a52('0x41')][_0x7a52('0x2d')]);_0xd3286e[_0x7a52('0x2c')]=qs['offset'](_0x2773d9[_0x7a52('0x41')]['offset']);}_0xd3286e[_0x7a52('0x9f')]=qs[_0x7a52('0x47')](_0x2773d9[_0x7a52('0x41')][_0x7a52('0x47')]);_0xd3286e[_0x7a52('0x48')]=qs[_0x7a52('0x49')](_[_0x7a52('0x4a')](_0x2773d9[_0x7a52('0x41')],_0x41e2d2[_0x7a52('0x49')]));_0xd3286e[_0x7a52('0x48')]['OpenchannelAccountId']=_0x23448d['id'];if(_0x2773d9['query'][_0x7a52('0x4d')]){_0xd3286e['where']=_[_0x7a52('0x4b')](_0xd3286e[_0x7a52('0x48')],{'$or':_[_0x7a52('0x3e')](_0xd3286e['attributes'],function(_0x2aeb01){var _0x53b2dc={};_0x53b2dc[_0x2aeb01]={'$like':'%'+_0x2773d9['query'][_0x7a52('0x4d')]+'%'};return _0x53b2dc;})});}_0xd3286e=_[_0x7a52('0x4b')]({},_0xd3286e,_0x2773d9[_0x7a52('0x61')]);return db[_0x7a52('0x88')][_0x7a52('0x2b')]({'where':_0xd3286e[_0x7a52('0x48')]})[_0x7a52('0x1d')](function(_0x10cb80){_0x13d1ee[_0x7a52('0x2b')]=_0x10cb80;if(_0x2773d9[_0x7a52('0x41')][_0x7a52('0x4e')]){_0xd3286e[_0x7a52('0x67')]=[{'model':db[_0x7a52('0x6b')],'as':'Contact','required':![]},{'model':db[_0x7a52('0xa1')],'as':'Owner','attributes':[_0x7a52('0x3f'),_0x7a52('0xa2'),_0x7a52('0xa3')],'required':![]},{'model':db[_0x7a52('0xa4')],'as':_0x7a52('0xa5'),'attributes':['id',_0x7a52('0x3f'),_0x7a52('0xa6')],'where':_0x2773d9[_0x7a52('0x41')][_0x7a52('0xa7')]?{'id':_0x2773d9['query'][_0x7a52('0xa7')]}:undefined,'required':_0x2773d9[_0x7a52('0x41')][_0x7a52('0xa7')]?!![]:![]}];}return db[_0x7a52('0x88')][_0x7a52('0x4f')](_0xd3286e);})[_0x7a52('0x1d')](function(_0x4c77a9){_0x13d1ee[_0x7a52('0x50')]=_0x4c77a9;return _0x13d1ee;});}})['then'](respondWithFilteredResult(_0x1e6d00,_0xd3286e))[_0x7a52('0x27')](handleError(_0x1e6d00,null));};exports['addAgents']=function(_0x437415,_0x575316,_0x2fbd91){return db[_0x7a52('0x39')][_0x7a52('0x58')]({'where':{'id':_0x437415[_0x7a52('0x5b')]['id']}})[_0x7a52('0x1d')](handleEntityNotFound(_0x575316,null))[_0x7a52('0x1d')](function(_0x1581fa){if(_0x1581fa){return _0x1581fa[_0x7a52('0xa8')](_0x437415[_0x7a52('0x55')][_0x7a52('0x63')],_[_0x7a52('0xa9')](_0x437415[_0x7a52('0x55')],['ids','id'])||{})['spread'](function(_0x490ed7){for(var _0x38cb22=0x0;_0x38cb22<_0x437415[_0x7a52('0x55')][_0x7a52('0x63')][_0x7a52('0x53')];_0x38cb22+=0x1){socket[_0x7a52('0xaa')](_0x7a52('0xab'),{'UserId':_0x437415[_0x7a52('0x55')][_0x7a52('0x63')][_0x38cb22],'OpenchannelAccountId':_0x437415[_0x7a52('0x5b')]['id']});}return _0x490ed7;});}})['then'](respondWithResult(_0x575316,null))['catch'](handleError(_0x575316,null));};exports[_0x7a52('0xac')]=function(_0x519a25,_0xb77f74,_0xfb02e6){return db[_0x7a52('0x39')][_0x7a52('0x58')]({'where':{'id':_0x519a25['params']['id']}})['then'](handleEntityNotFound(_0xb77f74,null))[_0x7a52('0x1d')](function(_0x53b6c6){if(_0x53b6c6){return _0x53b6c6[_0x7a52('0xac')](_0x519a25[_0x7a52('0x41')]['ids'])[_0x7a52('0x1d')](function(){if(_[_0x7a52('0xad')](_0x519a25[_0x7a52('0x41')]['ids'])){for(var _0x312651=0x0;_0x312651<_0x519a25['query']['ids'][_0x7a52('0x53')];_0x312651+=0x1){socket[_0x7a52('0xaa')]('userOpenchannelAccount:remove',{'UserId':Number(_0x519a25['query']['ids'][_0x312651]),'OpenchannelAccountId':Number(_0x519a25['params']['id'])});}}else{socket['emit'](_0x7a52('0xae'),{'UserId':Number(_0x519a25['query'][_0x7a52('0x63')]),'OpenchannelAccountId':Number(_0x519a25[_0x7a52('0x5b')]['id'])});}});}})[_0x7a52('0x1d')](respondWithStatusCode(_0xb77f74,null))['catch'](handleError(_0xb77f74,null));};exports[_0x7a52('0xaf')]=function(_0x1bcb5b,_0x13130d,_0x18745e){var _0x2b2bc8={};var _0x1e1ca4={};var _0x10b75b;var _0x363c5c;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1bcb5b[_0x7a52('0x5b')]['id']}})[_0x7a52('0x1d')](handleEntityNotFound(_0x13130d,null))[_0x7a52('0x1d')](function(_0x2b19cd){if(_0x2b19cd){_0x10b75b=_0x2b19cd;_0x1e1ca4[_0x7a52('0x3d')]=_['keys'](db[_0x7a52('0xa1')]['rawAttributes']);_0x1e1ca4['query']=_[_0x7a52('0x40')](_0x1bcb5b[_0x7a52('0x41')]);_0x1e1ca4[_0x7a52('0x49')]=_[_0x7a52('0x42')](_0x1e1ca4['model'],_0x1e1ca4['query']);_0x2b2bc8[_0x7a52('0x43')]=_['intersection'](_0x1e1ca4[_0x7a52('0x3d')],qs[_0x7a52('0x44')](_0x1bcb5b[_0x7a52('0x41')][_0x7a52('0x44')]));_0x2b2bc8[_0x7a52('0x43')]=_0x2b2bc8['attributes'][_0x7a52('0x53')]?_0x2b2bc8[_0x7a52('0x43')]:_0x1e1ca4[_0x7a52('0x3d')];_0x2b2bc8[_0x7a52('0x9f')]=qs[_0x7a52('0x47')](_0x1bcb5b[_0x7a52('0x41')][_0x7a52('0x47')]);_0x2b2bc8[_0x7a52('0x48')]=qs[_0x7a52('0x49')](_[_0x7a52('0x4a')](_0x1bcb5b[_0x7a52('0x41')],_0x1e1ca4[_0x7a52('0x49')]));if(_0x1bcb5b[_0x7a52('0x41')]['filter']){_0x2b2bc8[_0x7a52('0x48')]=_[_0x7a52('0x4b')](_0x2b2bc8[_0x7a52('0x48')],{'$or':_['map'](_0x2b2bc8[_0x7a52('0x43')],function(_0x455562){var _0x493671={};_0x493671[_0x455562]={'$like':'%'+_0x1bcb5b[_0x7a52('0x41')]['filter']+'%'};return _0x493671;})});}_0x2b2bc8=_[_0x7a52('0x4b')]({},_0x2b2bc8,_0x1bcb5b[_0x7a52('0x61')]);return _0x10b75b[_0x7a52('0xaf')](_0x2b2bc8);}})[_0x7a52('0x1d')](function(_0x1e3854){if(_0x1e3854){_0x363c5c=_0x1e3854[_0x7a52('0x53')];if(!_0x1bcb5b[_0x7a52('0x41')]['hasOwnProperty']('nolimit')){_0x2b2bc8[_0x7a52('0x2d')]=qs['limit'](_0x1bcb5b[_0x7a52('0x41')][_0x7a52('0x2d')]);_0x2b2bc8[_0x7a52('0x2c')]=qs[_0x7a52('0x2c')](_0x1bcb5b['query'][_0x7a52('0x2c')]);}return _0x10b75b[_0x7a52('0xaf')](_0x2b2bc8);}})[_0x7a52('0x1d')](function(_0x28b6b0){if(_0x28b6b0){return _0x28b6b0?{'count':_0x363c5c,'rows':_0x28b6b0}:null;}})[_0x7a52('0x1d')](respondWithResult(_0x13130d,null))[_0x7a52('0x27')](handleError(_0x13130d,null));};exports[_0x7a52('0x36')]=function(_0x5645b0,_0x14be4f,_0x22f24a){var _0x48413b,_0x3d37e3,_0x3ffa73;if(_[_0x7a52('0x72')](_0x5645b0[_0x7a52('0x55')][_0x7a52('0x55')])||_0x5645b0['body'][_0x7a52('0x55')]===''){throw new db[(_0x7a52('0x74'))][(_0x7a52('0x6c'))](_0x7a52('0xb0'));}if(_[_0x7a52('0x72')](_0x5645b0[_0x7a52('0x55')]['to'])){}_0x48413b=_0x5645b0[_0x7a52('0x55')]['to'];return db['OpenchannelAccount'][_0x7a52('0x5e')]({'where':{'id':_0x5645b0[_0x7a52('0x5b')]['id']}})[_0x7a52('0x1d')](handleEntityNotFound(_0x14be4f,null))['then'](function(_0x5d7054){if(_0x5d7054){return db[_0x7a52('0x39')][_0x7a52('0x58')]({'where':{'id':_0x5d7054['id']},'include':[{'model':db[_0x7a52('0x7a')],'as':_0x7a52('0x7b'),'include':[{'model':db[_0x7a52('0x6b')],'as':_0x7a52('0x7c'),'where':{[_0x5d7054[_0x7a52('0x76')]]:_0x48413b},'limit':0x1,'order':[[_0x7a52('0x6f'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x14be4f,null))[_0x7a52('0x1d')](function(_0x5bdaa2){if(_0x5bdaa2&&_0x5bdaa2['List']){_0x3d37e3=_0x5bdaa2['get']({'plain':!![]});if(_0x3d37e3['List']&&_0x3d37e3[_0x7a52('0x7b')]['Contacts']['length']){return _0x3d37e3[_0x7a52('0x7b')][_0x7a52('0x7c')][0x0];}return db['CmContact'][_0x7a52('0x54')](_['defaults'](_0x5645b0[_0x7a52('0x55')],{'firstName':_0x48413b,[_0x5bdaa2[_0x7a52('0x76')]]:_0x48413b,'phone':_0x48413b,'ListId':_0x3d37e3[_0x7a52('0x71')]}));}})[_0x7a52('0x1d')](handleEntityNotFound(_0x14be4f,null))[_0x7a52('0x1d')](function(_0x3aacbd){if(_0x3aacbd){_0x3ffa73=_0x3aacbd;return db['OpenchannelInteraction'][_0x7a52('0x58')]({'where':{'ContactId':_0x3ffa73['id'],'closed':![],'OpenchannelAccountId':_0x3d37e3['id']}})[_0x7a52('0x1d')](function(_0x2b952f){if(_0x2b952f){return[_0x2b952f,![]];}return db[_0x7a52('0x88')][_0x7a52('0x54')]({'UserId':_0x5645b0[_0x7a52('0xb1')]['id'],'ContactId':_0x3ffa73['id'],'OpenchannelAccountId':_0x3d37e3['id'],'lastMsgDirection':_0x7a52('0xb2'),'Messages':[_[_0x7a52('0x4b')](_0x5645b0[_0x7a52('0x55')],{'read':![],'body':_0x5645b0[_0x7a52('0x55')]['body'],'OpenchannelAccountId':_0x3d37e3['id'],'UserId':_0x5645b0[_0x7a52('0xb1')]['id'],'ContactId':_0x3ffa73['id']})]},{'include':[{'model':db[_0x7a52('0xb3')],'as':_0x7a52('0xb4')}]})[_0x7a52('0x1d')](function(_0x59279e){return[_0x59279e,!![]];});});}})[_0x7a52('0xb5')](function(_0x64e4de,_0x74b525){if(_0x74b525){return _0x64e4de;}return db[_0x7a52('0xb3')]['create'](_['merge'](_0x5645b0['body'],{'read':![],'body':_0x5645b0[_0x7a52('0x55')][_0x7a52('0x55')],'OpenchannelAccountId':_0x3d37e3['id'],'OpenchannelInteractionId':_0x64e4de['id'],'UserId':_0x5645b0[_0x7a52('0xb1')]['id'],'ContactId':_0x3ffa73['id']}))[_0x7a52('0x1d')](function(_0x315902){_0x64e4de[_0x7a52('0xb6')]['Messages']=[];_0x64e4de['dataValues']['Messages'][_0x7a52('0x90')](_0x315902[_0x7a52('0xb6')]);return _0x64e4de;});});}})[_0x7a52('0x1d')](respondWithResult(_0x14be4f,null))[_0x7a52('0x27')](handleError(_0x14be4f,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 387395b..6e79f71 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 _0xc520=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0xc520,0x146));var _0x0c52=function(_0xbab103,_0x1ca6e0){_0xbab103=_0xbab103-0x0;var _0x42541a=_0xc520[_0xbab103];return _0x42541a;};'use strict';var EventEmitter=require(_0x0c52('0x0'));var OpenchannelAccount=require(_0x0c52('0x1'))['db'][_0x0c52('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x0c52('0x3')](0x0);var events={'afterCreate':_0x0c52('0x4'),'afterUpdate':_0x0c52('0x5'),'afterDestroy':_0x0c52('0x6')};function emitEvent(_0x29bc58){return function(_0x4f2346,_0x3c3e13,_0x3660f2){OpenchannelAccountEvents[_0x0c52('0x7')](_0x29bc58+':'+_0x4f2346['id'],_0x4f2346);OpenchannelAccountEvents[_0x0c52('0x7')](_0x29bc58,_0x4f2346);_0x3660f2(null);};}for(var e in events){if(events[_0x0c52('0x8')](e)){var event=events[e];OpenchannelAccount[_0x0c52('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x02ee=['update','emit','hasOwnProperty','hook','exports','setMaxListeners','save'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x02ee,0x75));var _0xe02e=function(_0x2a4f45,_0x43975c){_0x2a4f45=_0x2a4f45-0x0;var _0x1c097e=_0x02ee[_0x2a4f45];return _0x1c097e;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe02e('0x0')](0x0);var events={'afterCreate':_0xe02e('0x1'),'afterUpdate':_0xe02e('0x2'),'afterDestroy':'remove'};function emitEvent(_0x469924){return function(_0x139bac,_0xe7632b,_0x5ad74c){OpenchannelAccountEvents[_0xe02e('0x3')](_0x469924+':'+_0x139bac['id'],_0x139bac);OpenchannelAccountEvents[_0xe02e('0x3')](_0x469924,_0x139bac);_0x5ad74c(null);};}for(var e in events){if(events[_0xe02e('0x4')](e)){var event=events[e];OpenchannelAccount[_0xe02e('0x5')](e,emitEvent(event));}}module[_0xe02e('0x6')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 4fe68a1..a708419 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 _0x6e82=['path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3beb4e,_0x2d1a69){var _0xd40198=function(_0x4a1f72){while(--_0x4a1f72){_0x3beb4e['push'](_0x3beb4e['shift']());}};_0xd40198(++_0x2d1a69);}(_0x6e82,0x1a7));var _0x26e8=function(_0x1b5256,_0x10179d){_0x1b5256=_0x1b5256-0x0;var _0x2ffa09=_0x6e82[_0x1b5256];return _0x2ffa09;};'use strict';var _=require('lodash');var util=require(_0x26e8('0x0'));var logger=require(_0x26e8('0x1'))(_0x26e8('0x2'));var moment=require(_0x26e8('0x3'));var BPromise=require(_0x26e8('0x4'));var rp=require(_0x26e8('0x5'));var fs=require('fs');var path=require(_0x26e8('0x6'));var rimraf=require(_0x26e8('0x7'));var config=require(_0x26e8('0x8'));var attributes=require(_0x26e8('0x9'));module[_0x26e8('0xa')]=function(_0x56a7e3,_0x4c287a){return _0x56a7e3[_0x26e8('0xb')](_0x26e8('0xc'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd8e=['rimraf','define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4d521e,_0x58ba39){var _0x3beb42=function(_0x1a7bd2){while(--_0x1a7bd2){_0x4d521e['push'](_0x4d521e['shift']());}};_0x3beb42(++_0x58ba39);}(_0xfd8e,0xa4));var _0xefd8=function(_0x50779e,_0xa07f09){_0x50779e=_0x50779e-0x0;var _0xc08e57=_0xfd8e[_0x50779e];return _0xc08e57;};'use strict';var _=require(_0xefd8('0x0'));var util=require(_0xefd8('0x1'));var logger=require(_0xefd8('0x2'))(_0xefd8('0x3'));var moment=require(_0xefd8('0x4'));var BPromise=require(_0xefd8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xefd8('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelAccount.attributes');module['exports']=function(_0x57b155,_0xd31d77){return _0x57b155[_0xefd8('0x7')](_0xefd8('0x8'),attributes,{'tableName':_0xefd8('0x9'),'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 853626d..7181ecd 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 _0x1950=['OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4f39af,_0x3ba41a){var _0x134223=function(_0x191fee){while(--_0x191fee){_0x4f39af['push'](_0x4f39af['shift']());}};_0x134223(++_0x3ba41a);}(_0x1950,0xce));var _0x0195=function(_0x35b9f9,_0x31e2cd){_0x35b9f9=_0x35b9f9-0x0;var _0x5e5ebb=_0x1950[_0x35b9f9];return _0x5e5ebb;};'use strict';var _=require(_0x0195('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0195('0x1'));var rs=require(_0x0195('0x2'));var fs=require('fs');var Redis=require(_0x0195('0x3'));var db=require(_0x0195('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0195('0x5'))(_0x0195('0x6'));var config=require('../../config/environment');var jayson=require(_0x0195('0x7'));var client=jayson[_0x0195('0x8')][_0x0195('0x9')]({'port':0x232a});config[_0x0195('0xa')]=_[_0x0195('0xb')](config[_0x0195('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0195('0xc'))(new Redis(config['redis']));require(_0x0195('0xd'))['register'](socket);function respondWithRpcPromise(_0x4f61ba,_0x4339b0,_0x1e39b3){return new BPromise(function(_0x36154b,_0x116459){return client[_0x0195('0xe')](_0x4f61ba,_0x1e39b3)['then'](function(_0x12ec11){logger[_0x0195('0xf')](_0x0195('0x10'),_0x4339b0,_0x0195('0x11'));logger[_0x0195('0x12')](_0x0195('0x13'),_0x4339b0,_0x0195('0x11'),JSON[_0x0195('0x14')](_0x12ec11));if(_0x12ec11['error']){if(_0x12ec11[_0x0195('0x15')][_0x0195('0x16')]===0x1f4){logger['error'](_0x0195('0x10'),_0x4339b0,_0x12ec11['error'][_0x0195('0x17')]);return _0x116459(_0x12ec11[_0x0195('0x15')]['message']);}logger[_0x0195('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x4339b0,_0x12ec11[_0x0195('0x15')][_0x0195('0x17')]);return _0x36154b(_0x12ec11[_0x0195('0x15')][_0x0195('0x17')]);}else{logger[_0x0195('0xf')](_0x0195('0x10'),_0x4339b0,_0x0195('0x11'));_0x36154b(_0x12ec11['result'][_0x0195('0x17')]);}})[_0x0195('0x18')](function(_0x45bb6f){logger[_0x0195('0x15')](_0x0195('0x10'),_0x4339b0,_0x45bb6f);_0x116459(_0x45bb6f);});});} \ No newline at end of file +var _0x1668=['./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','socket.io-emitter'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x1668,0x12d));var _0x8166=function(_0x40e38a,_0x4ae98c){_0x40e38a=_0x40e38a-0x0;var _0x306283=_0x1668[_0x40e38a];return _0x306283;};'use strict';var _=require(_0x8166('0x0'));var util=require(_0x8166('0x1'));var moment=require(_0x8166('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8166('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8166('0x4'));var logger=require(_0x8166('0x5'))(_0x8166('0x6'));var config=require('../../config/environment');var jayson=require(_0x8166('0x7'));var client=jayson['client'][_0x8166('0x8')]({'port':0x232a});config[_0x8166('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8166('0xa'))(new Redis(config['redis']));require(_0x8166('0xb'))['register'](socket);function respondWithRpcPromise(_0x32629d,_0x4f28b0,_0x5cfb4d){return new BPromise(function(_0x25ea06,_0x2be503){return client[_0x8166('0xc')](_0x32629d,_0x5cfb4d)[_0x8166('0xd')](function(_0x5b7551){logger[_0x8166('0xe')](_0x8166('0xf'),_0x4f28b0,_0x8166('0x10'));logger[_0x8166('0x11')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4f28b0,_0x8166('0x10'),JSON[_0x8166('0x12')](_0x5b7551));if(_0x5b7551[_0x8166('0x13')]){if(_0x5b7551[_0x8166('0x13')][_0x8166('0x14')]===0x1f4){logger[_0x8166('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x4f28b0,_0x5b7551['error']['message']);return _0x2be503(_0x5b7551[_0x8166('0x13')][_0x8166('0x15')]);}logger['error'](_0x8166('0xf'),_0x4f28b0,_0x5b7551[_0x8166('0x13')][_0x8166('0x15')]);return _0x25ea06(_0x5b7551['error'][_0x8166('0x15')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4f28b0,_0x8166('0x10'));_0x25ea06(_0x5b7551[_0x8166('0x16')][_0x8166('0x15')]);}})[_0x8166('0x17')](function(_0x262478){logger[_0x8166('0x13')](_0x8166('0xf'),_0x4f28b0,_0x262478);_0x2be503(_0x262478);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 8ded4e7..fae1523 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 _0xcb2b=['length','openchannelAccount:','./openchannelAccount.events','update','register'];(function(_0x2f823f,_0x464f7c){var _0x44df3c=function(_0x1ba9cf){while(--_0x1ba9cf){_0x2f823f['push'](_0x2f823f['shift']());}};_0x44df3c(++_0x464f7c);}(_0xcb2b,0x129));var _0xbcb2=function(_0xf18cc,_0x41e268){_0xf18cc=_0xf18cc-0x0;var _0x2f8777=_0xcb2b[_0xf18cc];return _0x2f8777;};'use strict';var OpenchannelAccountEvents=require(_0xbcb2('0x0'));var events=['save','remove',_0xbcb2('0x1')];function createListener(_0x3f6f20,_0x9900a6){return function(_0xb1f29c){_0x9900a6['emit'](_0x3f6f20,_0xb1f29c);};}function removeListener(_0x3e34da,_0x90d995){return function(){OpenchannelAccountEvents['removeListener'](_0x3e34da,_0x90d995);};}exports[_0xbcb2('0x2')]=function(_0x2cfa45){for(var _0x206a7a=0x0,_0x25e6fc=events[_0xbcb2('0x3')];_0x206a7a<_0x25e6fc;_0x206a7a++){var _0x3a8efc=events[_0x206a7a];var _0x198c88=createListener(_0xbcb2('0x4')+_0x3a8efc,_0x2cfa45);OpenchannelAccountEvents['on'](_0x3a8efc,_0x198c88);}}; \ No newline at end of file +var _0x7639=['update','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x9a5f3b,_0x557b1d){var _0x2ad160=function(_0x54bd8f){while(--_0x54bd8f){_0x9a5f3b['push'](_0x9a5f3b['shift']());}};_0x2ad160(++_0x557b1d);}(_0x7639,0x67));var _0x9763=function(_0x1e5a06,_0x5097a5){_0x1e5a06=_0x1e5a06-0x0;var _0x11b8f0=_0x7639[_0x1e5a06];return _0x11b8f0;};'use strict';var OpenchannelAccountEvents=require(_0x9763('0x0'));var events=[_0x9763('0x1'),'remove',_0x9763('0x2')];function createListener(_0x1b3501,_0x402a05){return function(_0xd2c00c){_0x402a05['emit'](_0x1b3501,_0xd2c00c);};}function removeListener(_0x280206,_0x58d2b2){return function(){OpenchannelAccountEvents[_0x9763('0x3')](_0x280206,_0x58d2b2);};}exports[_0x9763('0x4')]=function(_0x12bf04){for(var _0x2e5b63=0x0,_0x4bc1ce=events[_0x9763('0x5')];_0x2e5b63<_0x4bc1ce;_0x2e5b63++){var _0x2e99bf=events[_0x2e5b63];var _0x463fff=createListener(_0x9763('0x6')+_0x2e99bf,_0x12bf04);OpenchannelAccountEvents['on'](_0x2e99bf,_0x463fff);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index a7eab1a..da800a2 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 _0x941f=['Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','put','update','destroy','exports','path','connect-timeout','express'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x941f,0x6d));var _0xf941=function(_0x26012b,_0x2124bc){_0x26012b=_0x26012b-0x0;var _0x121489=_0x941f[_0x26012b];return _0x121489;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf941('0x0'));var timeout=require(_0xf941('0x1'));var express=require(_0xf941('0x2'));var router=express[_0xf941('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf941('0x4'));var config=require(_0xf941('0x5'));var controller=require(_0xf941('0x6'));router[_0xf941('0x7')]('/',auth[_0xf941('0x8')](),controller['index']);router[_0xf941('0x7')](_0xf941('0x9'),auth['isAuthenticated'](),controller[_0xf941('0xa')]);router[_0xf941('0xb')]('/',auth[_0xf941('0x8')](),controller['create']);router[_0xf941('0xc')](_0xf941('0x9'),auth['isAuthenticated'](),controller[_0xf941('0xd')]);router['delete'](_0xf941('0x9'),auth['isAuthenticated'](),controller[_0xf941('0xe')]);module[_0xf941('0xf')]=router; \ No newline at end of file +var _0x1f27=['express','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x21807e,_0x4020eb){var _0x1110de=function(_0x10e479){while(--_0x10e479){_0x21807e['push'](_0x21807e['shift']());}};_0x1110de(++_0x4020eb);}(_0x1f27,0x1c5));var _0x71f2=function(_0x2fc0d3,_0xfaf8ab){_0x2fc0d3=_0x2fc0d3-0x0;var _0x514ec0=_0x1f27[_0x2fc0d3];return _0x514ec0;};'use strict';var multer=require(_0x71f2('0x0'));var util=require(_0x71f2('0x1'));var path=require(_0x71f2('0x2'));var timeout=require('connect-timeout');var express=require(_0x71f2('0x3'));var router=express[_0x71f2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x71f2('0x5'));var config=require(_0x71f2('0x6'));var controller=require(_0x71f2('0x7'));router[_0x71f2('0x8')]('/',auth[_0x71f2('0x9')](),controller[_0x71f2('0xa')]);router['get'](_0x71f2('0xb'),auth[_0x71f2('0x9')](),controller[_0x71f2('0xc')]);router[_0x71f2('0xd')]('/',auth[_0x71f2('0x9')](),controller[_0x71f2('0xe')]);router[_0x71f2('0xf')](_0x71f2('0xb'),auth['isAuthenticated'](),controller[_0x71f2('0x10')]);router['delete'](_0x71f2('0xb'),auth[_0x71f2('0x9')](),controller[_0x71f2('0x11')]);module[_0x71f2('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 97734e8..a82b314 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 _0x34d2=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0xad5ac0,_0x45df5a){var _0x544129=function(_0x4db235){while(--_0x4db235){_0xad5ac0['push'](_0xad5ac0['shift']());}};_0x544129(++_0x45df5a);}(_0x34d2,0x89));var _0x234d=function(_0x27fab3,_0x5c0f50){_0x27fab3=_0x27fab3-0x0;var _0x31bfa5=_0x34d2[_0x27fab3];return _0x31bfa5;};'use strict';var Sequelize=require(_0x234d('0x0'));module[_0x234d('0x1')]={'priority':{'type':Sequelize[_0x234d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x234d('0x3')],'allowNull':![],'defaultValue':_0x234d('0x4')},'appdata':{'type':Sequelize[_0x234d('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x234d('0x3')],'defaultValue':_0x234d('0x6')}}; \ No newline at end of file +var _0x3fbc=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x173e90,_0x5f5292){var _0x53e06a=function(_0x348227){while(--_0x348227){_0x173e90['push'](_0x173e90['shift']());}};_0x53e06a(++_0x5f5292);}(_0x3fbc,0x14e));var _0xc3fb=function(_0x23771b,_0x5817fb){_0x23771b=_0x23771b-0x0;var _0x3413e2=_0x3fbc[_0x23771b];return _0x3413e2;};'use strict';var Sequelize=require(_0xc3fb('0x0'));module[_0xc3fb('0x1')]={'priority':{'type':Sequelize[_0xc3fb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc3fb('0x3')],'allowNull':![],'defaultValue':_0xc3fb('0x4')},'appdata':{'type':Sequelize[_0xc3fb('0x5')]()},'description':{'type':Sequelize[_0xc3fb('0x3')]},'interval':{'type':Sequelize[_0xc3fb('0x3')],'defaultValue':_0xc3fb('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e9547b8..c748d15 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 _0xdb7d=['html-pdf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','update','then','destroy','error','stack','name','map','OpenchannelApplication','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','options','include','rows','catch','show','params','fields','find','create','body'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xdb7d,0x13b));var _0xddb7=function(_0x2bb30a,_0x13c669){_0x2bb30a=_0x2bb30a-0x0;var _0x1d0ae8=_0xdb7d[_0x2bb30a];return _0x1d0ae8;};'use strict';var pdf=require(_0xddb7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xddb7('0x1'));var jsonpatch=require(_0xddb7('0x2'));var rp=require(_0xddb7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xddb7('0x4'));var path=require(_0xddb7('0x5'));var sox=require(_0xddb7('0x6'));var csv=require(_0xddb7('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xddb7('0x8'));var squel=require(_0xddb7('0x9'));var crypto=require('crypto');var jsforce=require(_0xddb7('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xddb7('0x7'));var querystring=require(_0xddb7('0xb'));var Papa=require('papaparse');var Redis=require(_0xddb7('0xc'));var authService=require(_0xddb7('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xddb7('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xddb7('0xf'));var utils=require(_0xddb7('0x10'));var config=require(_0xddb7('0x11'));var licenseUtil=require(_0xddb7('0x12'));var db=require(_0xddb7('0x13'))['db'];function respondWithStatusCode(_0x370f83,_0x2dd4aa){_0x2dd4aa=_0x2dd4aa||0xcc;return function(_0x59af1a){if(_0x59af1a){return _0x370f83[_0xddb7('0x14')](_0x2dd4aa);}return _0x370f83[_0xddb7('0x15')](_0x2dd4aa)[_0xddb7('0x16')]();};}function respondWithResult(_0x2fd30d,_0x8bb943){_0x8bb943=_0x8bb943||0xc8;return function(_0x3138a7){if(_0x3138a7){return _0x2fd30d[_0xddb7('0x15')](_0x8bb943)['json'](_0x3138a7);}};}function respondWithFilteredResult(_0x4794b9,_0x3b4787){return function(_0x34f187){if(_0x34f187){var _0xbb7c67=_0x34f187[_0xddb7('0x17')],_0x21c068=_0x3b4787['offset'],_0x30950c=_0x3b4787[_0xddb7('0x18')]+_0x3b4787['limit'],_0x1f648b;if(_0x30950c>=_0xbb7c67){_0x30950c=_0xbb7c67;_0x1f648b=0xc8;}else{_0x1f648b=0xce;}_0x4794b9[_0xddb7('0x15')](_0x1f648b);return _0x4794b9[_0xddb7('0x19')](_0xddb7('0x1a'),_0x21c068+'-'+_0x30950c+'/'+_0xbb7c67)['json'](_0x34f187);}return null;};}function patchUpdates(_0x404d76){return function(_0x82fcd2){try{jsonpatch['apply'](_0x82fcd2,_0x404d76,!![]);}catch(_0x425906){return BPromise['reject'](_0x425906);}return _0x82fcd2['save']();};}function saveUpdates(_0x435ad4,_0x2350bf){return function(_0x3b8e23){if(_0x3b8e23){return _0x3b8e23[_0xddb7('0x1b')](_0x435ad4)[_0xddb7('0x1c')](function(_0x4e5d54){return _0x4e5d54;});}return null;};}function removeEntity(_0x5c9ff4,_0x3fc76a){return function(_0x1f982e){if(_0x1f982e){return _0x1f982e[_0xddb7('0x1d')]()[_0xddb7('0x1c')](function(){_0x5c9ff4[_0xddb7('0x15')](0xcc)[_0xddb7('0x16')]();});}};}function handleEntityNotFound(_0x2a05dc,_0x3deead){return function(_0x55dbef){if(!_0x55dbef){_0x2a05dc[_0xddb7('0x14')](0x194);}return _0x55dbef;};}function handleError(_0x56187,_0x7abccf){_0x7abccf=_0x7abccf||0x1f4;return function(_0x65d4cb){logger[_0xddb7('0x1e')](_0x65d4cb[_0xddb7('0x1f')]);if(_0x65d4cb[_0xddb7('0x20')]){delete _0x65d4cb[_0xddb7('0x20')];}_0x56187[_0xddb7('0x15')](_0x7abccf)['send'](_0x65d4cb);};}exports['index']=function(_0x40cda1,_0x9f9256){var _0x562405={},_0x97f932={},_0x15f1b6={'count':0x0,'rows':[]};var _0x529388=_[_0xddb7('0x21')](db[_0xddb7('0x22')][_0xddb7('0x23')],function(_0x1cf269){return{'name':_0x1cf269['fieldName'],'type':_0x1cf269['type'][_0xddb7('0x24')]};});_0x97f932['model']=_['map'](_0x529388,'name');_0x97f932[_0xddb7('0x25')]=_[_0xddb7('0x26')](_0x40cda1[_0xddb7('0x25')]);_0x97f932[_0xddb7('0x27')]=_[_0xddb7('0x28')](_0x97f932[_0xddb7('0x29')],_0x97f932[_0xddb7('0x25')]);_0x562405[_0xddb7('0x2a')]=_[_0xddb7('0x28')](_0x97f932[_0xddb7('0x29')],qs['fields'](_0x40cda1[_0xddb7('0x25')]['fields']));_0x562405[_0xddb7('0x2a')]=_0x562405['attributes'][_0xddb7('0x2b')]?_0x562405[_0xddb7('0x2a')]:_0x97f932[_0xddb7('0x29')];if(!_0x40cda1[_0xddb7('0x25')][_0xddb7('0x2c')](_0xddb7('0x2d'))){_0x562405['limit']=qs[_0xddb7('0x2e')](_0x40cda1[_0xddb7('0x25')][_0xddb7('0x2e')]);_0x562405[_0xddb7('0x18')]=qs[_0xddb7('0x18')](_0x40cda1[_0xddb7('0x25')][_0xddb7('0x18')]);}_0x562405[_0xddb7('0x2f')]=qs[_0xddb7('0x30')](_0x40cda1[_0xddb7('0x25')]['sort']);_0x562405[_0xddb7('0x31')]=qs[_0xddb7('0x27')](_['pick'](_0x40cda1['query'],_0x97f932[_0xddb7('0x27')]),_0x529388);if(_0x40cda1[_0xddb7('0x25')][_0xddb7('0x32')]){_0x562405[_0xddb7('0x31')]=_[_0xddb7('0x33')](_0x562405[_0xddb7('0x31')],{'$or':_[_0xddb7('0x21')](_0x529388,function(_0xc6ed8c){if(_0xc6ed8c[_0xddb7('0x34')]!=='VIRTUAL'){var _0x1dabf0={};_0x1dabf0[_0xc6ed8c[_0xddb7('0x20')]]={'$like':'%'+_0x40cda1[_0xddb7('0x25')][_0xddb7('0x32')]+'%'};return _0x1dabf0;}})});}_0x562405=_[_0xddb7('0x33')]({},_0x562405,_0x40cda1[_0xddb7('0x35')]);var _0x5ba310={'where':_0x562405['where']};return db[_0xddb7('0x22')]['count'](_0x5ba310)[_0xddb7('0x1c')](function(_0x29092e){_0x15f1b6[_0xddb7('0x17')]=_0x29092e;if(_0x40cda1[_0xddb7('0x25')]['includeAll']){_0x562405[_0xddb7('0x36')]=[{'all':!![]}];}return db[_0xddb7('0x22')]['findAll'](_0x562405);})['then'](function(_0x531e72){_0x15f1b6[_0xddb7('0x37')]=_0x531e72;return _0x15f1b6;})[_0xddb7('0x1c')](respondWithFilteredResult(_0x9f9256,_0x562405))[_0xddb7('0x38')](handleError(_0x9f9256,null));};exports[_0xddb7('0x39')]=function(_0xdac4eb,_0xca3dfa){var _0x34db3e={'raw':!![],'where':{'id':_0xdac4eb[_0xddb7('0x3a')]['id']}},_0x23b93f={};_0x23b93f[_0xddb7('0x29')]=_[_0xddb7('0x26')](db['OpenchannelApplication'][_0xddb7('0x23')]);_0x23b93f[_0xddb7('0x25')]=_[_0xddb7('0x26')](_0xdac4eb['query']);_0x23b93f['filters']=_[_0xddb7('0x28')](_0x23b93f[_0xddb7('0x29')],_0x23b93f[_0xddb7('0x25')]);_0x34db3e[_0xddb7('0x2a')]=_[_0xddb7('0x28')](_0x23b93f[_0xddb7('0x29')],qs[_0xddb7('0x3b')](_0xdac4eb[_0xddb7('0x25')][_0xddb7('0x3b')]));_0x34db3e[_0xddb7('0x2a')]=_0x34db3e[_0xddb7('0x2a')]['length']?_0x34db3e[_0xddb7('0x2a')]:_0x23b93f[_0xddb7('0x29')];if(_0xdac4eb[_0xddb7('0x25')]['includeAll']){_0x34db3e[_0xddb7('0x36')]=[{'all':!![]}];}_0x34db3e=_[_0xddb7('0x33')]({},_0x34db3e,_0xdac4eb[_0xddb7('0x35')]);return db['OpenchannelApplication'][_0xddb7('0x3c')](_0x34db3e)[_0xddb7('0x1c')](handleEntityNotFound(_0xca3dfa,null))[_0xddb7('0x1c')](respondWithResult(_0xca3dfa,null))[_0xddb7('0x38')](handleError(_0xca3dfa,null));};exports['create']=function(_0x18c95b,_0x131be1){return db[_0xddb7('0x22')][_0xddb7('0x3d')](_0x18c95b[_0xddb7('0x3e')],{})[_0xddb7('0x1c')](respondWithResult(_0x131be1,0xc9))[_0xddb7('0x38')](handleError(_0x131be1,null));};exports['update']=function(_0x1c7bf7,_0x4e3583){if(_0x1c7bf7[_0xddb7('0x3e')]['id']){delete _0x1c7bf7[_0xddb7('0x3e')]['id'];}return db[_0xddb7('0x22')][_0xddb7('0x3c')]({'where':{'id':_0x1c7bf7[_0xddb7('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4e3583,null))[_0xddb7('0x1c')](saveUpdates(_0x1c7bf7['body'],null))[_0xddb7('0x1c')](respondWithResult(_0x4e3583,null))['catch'](handleError(_0x4e3583,null));};exports[_0xddb7('0x1d')]=function(_0x2d9c95,_0x36fd9a){return db['OpenchannelApplication']['find']({'where':{'id':_0x2d9c95['params']['id']}})[_0xddb7('0x1c')](handleEntityNotFound(_0x36fd9a,null))[_0xddb7('0x1c')](removeEntity(_0x36fd9a,null))[_0xddb7('0x38')](handleError(_0x36fd9a,null));}; \ No newline at end of file +var _0x4b2f=['path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','count','includeAll','include','rows','catch','show','keys','options','find','create','body','params','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x35b3ea,_0x3cb832){var _0x1ddbe9=function(_0x1b87ce){while(--_0x1b87ce){_0x35b3ea['push'](_0x35b3ea['shift']());}};_0x1ddbe9(++_0x3cb832);}(_0x4b2f,0x1f0));var _0xf4b2=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x4b2f[_0x220f3f];return _0x1f170e;};'use strict';var pdf=require(_0xf4b2('0x0'));var emlformat=require(_0xf4b2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf4b2('0x2'));var jsonpatch=require(_0xf4b2('0x3'));var rp=require(_0xf4b2('0x4'));var moment=require('moment');var BPromise=require(_0xf4b2('0x5'));var Mustache=require(_0xf4b2('0x6'));var util=require(_0xf4b2('0x7'));var path=require(_0xf4b2('0x8'));var sox=require('sox');var csv=require(_0xf4b2('0x9'));var ejs=require(_0xf4b2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf4b2('0xb'));var crypto=require(_0xf4b2('0xc'));var jsforce=require(_0xf4b2('0xd'));var deskjs=require(_0xf4b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf4b2('0xf'));var Papa=require(_0xf4b2('0x10'));var Redis=require(_0xf4b2('0x11'));var authService=require(_0xf4b2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf4b2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4b2('0x14'))('api');var utils=require(_0xf4b2('0x15'));var config=require(_0xf4b2('0x16'));var licenseUtil=require(_0xf4b2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x378e5c,_0x2302d0){_0x2302d0=_0x2302d0||0xcc;return function(_0x4abbdd){if(_0x4abbdd){return _0x378e5c[_0xf4b2('0x18')](_0x2302d0);}return _0x378e5c[_0xf4b2('0x19')](_0x2302d0)[_0xf4b2('0x1a')]();};}function respondWithResult(_0x45cb32,_0x5a435b){_0x5a435b=_0x5a435b||0xc8;return function(_0x109f46){if(_0x109f46){return _0x45cb32[_0xf4b2('0x19')](_0x5a435b)[_0xf4b2('0x1b')](_0x109f46);}};}function respondWithFilteredResult(_0x1e8a76,_0x19ba60){return function(_0x22679c){if(_0x22679c){var _0x2355fd=_0x22679c['count'],_0x1104a0=_0x19ba60[_0xf4b2('0x1c')],_0x1a1dc3=_0x19ba60[_0xf4b2('0x1c')]+_0x19ba60[_0xf4b2('0x1d')],_0x13fb56;if(_0x1a1dc3>=_0x2355fd){_0x1a1dc3=_0x2355fd;_0x13fb56=0xc8;}else{_0x13fb56=0xce;}_0x1e8a76['status'](_0x13fb56);return _0x1e8a76['set'](_0xf4b2('0x1e'),_0x1104a0+'-'+_0x1a1dc3+'/'+_0x2355fd)[_0xf4b2('0x1b')](_0x22679c);}return null;};}function patchUpdates(_0x387a20){return function(_0x49ce87){try{jsonpatch[_0xf4b2('0x1f')](_0x49ce87,_0x387a20,!![]);}catch(_0x26bf63){return BPromise[_0xf4b2('0x20')](_0x26bf63);}return _0x49ce87[_0xf4b2('0x21')]();};}function saveUpdates(_0x4cabfe,_0x1c6a96){return function(_0x16d79d){if(_0x16d79d){return _0x16d79d[_0xf4b2('0x22')](_0x4cabfe)[_0xf4b2('0x23')](function(_0xf5169c){return _0xf5169c;});}return null;};}function removeEntity(_0x116a5b,_0x3e3474){return function(_0xd0f5ae){if(_0xd0f5ae){return _0xd0f5ae['destroy']()[_0xf4b2('0x23')](function(){_0x116a5b[_0xf4b2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2188fd,_0x10ff5a){return function(_0x62a19f){if(!_0x62a19f){_0x2188fd[_0xf4b2('0x18')](0x194);}return _0x62a19f;};}function handleError(_0x56518d,_0x32eab8){_0x32eab8=_0x32eab8||0x1f4;return function(_0x589e6f){logger['error'](_0x589e6f[_0xf4b2('0x24')]);if(_0x589e6f[_0xf4b2('0x25')]){delete _0x589e6f[_0xf4b2('0x25')];}_0x56518d[_0xf4b2('0x19')](_0x32eab8)[_0xf4b2('0x26')](_0x589e6f);};}exports[_0xf4b2('0x27')]=function(_0x3d73d3,_0x4ef82a){var _0xf6c494={},_0x38fff1={},_0x1cea7c={'count':0x0,'rows':[]};var _0x1d67eb=_[_0xf4b2('0x28')](db[_0xf4b2('0x29')][_0xf4b2('0x2a')],function(_0x13bd8f){return{'name':_0x13bd8f[_0xf4b2('0x2b')],'type':_0x13bd8f[_0xf4b2('0x2c')][_0xf4b2('0x2d')]};});_0x38fff1[_0xf4b2('0x2e')]=_[_0xf4b2('0x28')](_0x1d67eb,'name');_0x38fff1[_0xf4b2('0x2f')]=_['keys'](_0x3d73d3[_0xf4b2('0x2f')]);_0x38fff1['filters']=_[_0xf4b2('0x30')](_0x38fff1['model'],_0x38fff1[_0xf4b2('0x2f')]);_0xf6c494[_0xf4b2('0x31')]=_[_0xf4b2('0x30')](_0x38fff1['model'],qs[_0xf4b2('0x32')](_0x3d73d3[_0xf4b2('0x2f')]['fields']));_0xf6c494['attributes']=_0xf6c494[_0xf4b2('0x31')][_0xf4b2('0x33')]?_0xf6c494['attributes']:_0x38fff1['model'];if(!_0x3d73d3[_0xf4b2('0x2f')][_0xf4b2('0x34')]('nolimit')){_0xf6c494[_0xf4b2('0x1d')]=qs[_0xf4b2('0x1d')](_0x3d73d3[_0xf4b2('0x2f')][_0xf4b2('0x1d')]);_0xf6c494[_0xf4b2('0x1c')]=qs['offset'](_0x3d73d3[_0xf4b2('0x2f')][_0xf4b2('0x1c')]);}_0xf6c494[_0xf4b2('0x35')]=qs['sort'](_0x3d73d3[_0xf4b2('0x2f')]['sort']);_0xf6c494[_0xf4b2('0x36')]=qs[_0xf4b2('0x37')](_[_0xf4b2('0x38')](_0x3d73d3['query'],_0x38fff1[_0xf4b2('0x37')]),_0x1d67eb);if(_0x3d73d3[_0xf4b2('0x2f')][_0xf4b2('0x39')]){_0xf6c494[_0xf4b2('0x36')]=_[_0xf4b2('0x3a')](_0xf6c494[_0xf4b2('0x36')],{'$or':_['map'](_0x1d67eb,function(_0x9717c4){if(_0x9717c4['type']!=='VIRTUAL'){var _0x153939={};_0x153939[_0x9717c4[_0xf4b2('0x25')]]={'$like':'%'+_0x3d73d3[_0xf4b2('0x2f')][_0xf4b2('0x39')]+'%'};return _0x153939;}})});}_0xf6c494=_[_0xf4b2('0x3a')]({},_0xf6c494,_0x3d73d3['options']);var _0x210548={'where':_0xf6c494[_0xf4b2('0x36')]};return db[_0xf4b2('0x29')][_0xf4b2('0x3b')](_0x210548)[_0xf4b2('0x23')](function(_0x2526ee){_0x1cea7c['count']=_0x2526ee;if(_0x3d73d3['query'][_0xf4b2('0x3c')]){_0xf6c494[_0xf4b2('0x3d')]=[{'all':!![]}];}return db[_0xf4b2('0x29')]['findAll'](_0xf6c494);})[_0xf4b2('0x23')](function(_0x45b6fa){_0x1cea7c[_0xf4b2('0x3e')]=_0x45b6fa;return _0x1cea7c;})[_0xf4b2('0x23')](respondWithFilteredResult(_0x4ef82a,_0xf6c494))[_0xf4b2('0x3f')](handleError(_0x4ef82a,null));};exports[_0xf4b2('0x40')]=function(_0x40b58f,_0x26a53c){var _0x4778b7={'raw':!![],'where':{'id':_0x40b58f['params']['id']}},_0x17a9c8={};_0x17a9c8[_0xf4b2('0x2e')]=_['keys'](db[_0xf4b2('0x29')][_0xf4b2('0x2a')]);_0x17a9c8['query']=_[_0xf4b2('0x41')](_0x40b58f[_0xf4b2('0x2f')]);_0x17a9c8[_0xf4b2('0x37')]=_[_0xf4b2('0x30')](_0x17a9c8['model'],_0x17a9c8[_0xf4b2('0x2f')]);_0x4778b7[_0xf4b2('0x31')]=_['intersection'](_0x17a9c8['model'],qs[_0xf4b2('0x32')](_0x40b58f['query']['fields']));_0x4778b7[_0xf4b2('0x31')]=_0x4778b7[_0xf4b2('0x31')][_0xf4b2('0x33')]?_0x4778b7[_0xf4b2('0x31')]:_0x17a9c8['model'];if(_0x40b58f['query'][_0xf4b2('0x3c')]){_0x4778b7[_0xf4b2('0x3d')]=[{'all':!![]}];}_0x4778b7=_[_0xf4b2('0x3a')]({},_0x4778b7,_0x40b58f[_0xf4b2('0x42')]);return db['OpenchannelApplication'][_0xf4b2('0x43')](_0x4778b7)[_0xf4b2('0x23')](handleEntityNotFound(_0x26a53c,null))[_0xf4b2('0x23')](respondWithResult(_0x26a53c,null))[_0xf4b2('0x3f')](handleError(_0x26a53c,null));};exports[_0xf4b2('0x44')]=function(_0x53a78a,_0x2ea133){return db['OpenchannelApplication']['create'](_0x53a78a[_0xf4b2('0x45')],{})[_0xf4b2('0x23')](respondWithResult(_0x2ea133,0xc9))[_0xf4b2('0x3f')](handleError(_0x2ea133,null));};exports[_0xf4b2('0x22')]=function(_0xf8464d,_0x25ca96){if(_0xf8464d[_0xf4b2('0x45')]['id']){delete _0xf8464d[_0xf4b2('0x45')]['id'];}return db[_0xf4b2('0x29')]['find']({'where':{'id':_0xf8464d[_0xf4b2('0x46')]['id']}})['then'](handleEntityNotFound(_0x25ca96,null))[_0xf4b2('0x23')](saveUpdates(_0xf8464d[_0xf4b2('0x45')],null))['then'](respondWithResult(_0x25ca96,null))['catch'](handleError(_0x25ca96,null));};exports[_0xf4b2('0x47')]=function(_0x5f3b2e,_0xea93e4){return db[_0xf4b2('0x29')]['find']({'where':{'id':_0x5f3b2e['params']['id']}})['then'](handleEntityNotFound(_0xea93e4,null))[_0xf4b2('0x23')](removeEntity(_0xea93e4,null))[_0xf4b2('0x3f')](handleError(_0xea93e4,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index d49a25a..8f56d9c 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 _0x91de=['define','openchannel_applications','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports'];(function(_0x207910,_0x4450bc){var _0x487c56=function(_0x166d4b){while(--_0x166d4b){_0x207910['push'](_0x207910['shift']());}};_0x487c56(++_0x4450bc);}(_0x91de,0x115));var _0xe91d=function(_0x34ab95,_0x5e4bfb){_0x34ab95=_0x34ab95-0x0;var _0x7a3f82=_0x91de[_0x34ab95];return _0x7a3f82;};'use strict';var _=require(_0xe91d('0x0'));var util=require(_0xe91d('0x1'));var logger=require(_0xe91d('0x2'))(_0xe91d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe91d('0x4'));var fs=require('fs');var path=require(_0xe91d('0x5'));var rimraf=require('rimraf');var config=require(_0xe91d('0x6'));var attributes=require(_0xe91d('0x7'));module[_0xe91d('0x8')]=function(_0x4bff5a,_0x2d513e){return _0x4bff5a[_0xe91d('0x9')]('OpenchannelApplication',attributes,{'tableName':_0xe91d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x68a9=['utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x68a9,0x176));var _0x968a=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x68a9[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x968a('0x0'));var util=require(_0x968a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x968a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x968a('0x3'));var config=require(_0x968a('0x4'));var attributes=require(_0x968a('0x5'));module[_0x968a('0x6')]=function(_0x1f94da,_0x1889f4){return _0x1f94da[_0x968a('0x7')](_0x968a('0x8'),attributes,{'tableName':_0x968a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x968a('0xa'),'collate':_0x968a('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 6020159..283f4e1 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(_0x3ca1c4,_0x4f0fc9){var _0x122abe=function(_0x179d3f){while(--_0x179d3f){_0x3ca1c4['push'](_0x3ca1c4['shift']());}};_0x122abe(++_0x4f0fc9);}(_0xb10b,0x12a));var _0xbb10=function(_0x392368,_0x1e14a5){_0x392368=_0x392368-0x0;var _0x33efe7=_0xb10b[_0x392368];return _0x33efe7;};'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(_0x66fc1,_0x552a9e){var _0x6b3e60=function(_0x498dbc){while(--_0x498dbc){_0x66fc1['push'](_0x66fc1['shift']());}};_0x6b3e60(++_0x552a9e);}(_0xb10b,0x12a));var _0xbb10=function(_0xd5709b,_0x101823){_0xd5709b=_0xd5709b-0x0;var _0x3dc484=_0xb10b[_0xd5709b];return _0x3dc484;};'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 2e45d59..f3b239a 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 _0x9049=['destroy','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/messages','download','addMessage','post','/:id/tags','tracked','openchannel','addTags','put','openchannelinteraction:update','delete','/:id','openchannelinteraction:destroy'];(function(_0xd81a1c,_0x2737ed){var _0x4d40f4=function(_0x2eba45){while(--_0x2eba45){_0xd81a1c['push'](_0xd81a1c['shift']());}};_0x4d40f4(++_0x2737ed);}(_0x9049,0xfe));var _0x9904=function(_0x5709d4,_0x4b5c60){_0x5709d4=_0x5709d4-0x0;var _0x5a38fb=_0x9049[_0x5709d4];return _0x5a38fb;};'use strict';var multer=require(_0x9904('0x0'));var util=require(_0x9904('0x1'));var path=require(_0x9904('0x2'));var timeout=require(_0x9904('0x3'));var express=require(_0x9904('0x4'));var router=express[_0x9904('0x5')]();var auth=require(_0x9904('0x6'));var interaction=require(_0x9904('0x7'));var config=require(_0x9904('0x8'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x9904('0x9')](),controller['index']);router[_0x9904('0xa')]('/describe',auth[_0x9904('0x9')](),controller[_0x9904('0xb')]);router[_0x9904('0xa')]('/:id',auth[_0x9904('0x9')](),controller[_0x9904('0xc')]);router[_0x9904('0xa')](_0x9904('0xd'),auth[_0x9904('0x9')](),controller['getMessages']);router[_0x9904('0xa')]('/:id/download',auth[_0x9904('0x9')](),controller[_0x9904('0xe')]);router['post']('/',auth[_0x9904('0x9')](),controller['create']);router['post']('/:id/messages',auth[_0x9904('0x9')](),controller[_0x9904('0xf')]);router[_0x9904('0x10')](_0x9904('0x11'),auth[_0x9904('0x9')](),interaction[_0x9904('0x12')](_0x9904('0x13'),'openchannelinteraction:addtags'),controller[_0x9904('0x14')]);router[_0x9904('0x15')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x9904('0x13'),_0x9904('0x16')),controller['update']);router[_0x9904('0x17')](_0x9904('0x18'),auth['isAuthenticated'](),interaction['tracked'](_0x9904('0x13'),_0x9904('0x19')),controller[_0x9904('0x1a')]);router[_0x9904('0x17')](_0x9904('0x11'),auth[_0x9904('0x9')](),controller[_0x9904('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xed56=['tracked','openchannelinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./openchannelInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','openchannel','openchannelinteraction:addtags','addTags','put','update'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xed56,0x7f));var _0x6ed5=function(_0x522073,_0x5a5085){_0x522073=_0x522073-0x0;var _0x1a3c50=_0xed56[_0x522073];return _0x1a3c50;};'use strict';var multer=require(_0x6ed5('0x0'));var util=require(_0x6ed5('0x1'));var path=require(_0x6ed5('0x2'));var timeout=require(_0x6ed5('0x3'));var express=require(_0x6ed5('0x4'));var router=express['Router']();var auth=require(_0x6ed5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6ed5('0x6'));router['get']('/',auth[_0x6ed5('0x7')](),controller['index']);router[_0x6ed5('0x8')](_0x6ed5('0x9'),auth['isAuthenticated'](),controller[_0x6ed5('0xa')]);router[_0x6ed5('0x8')](_0x6ed5('0xb'),auth[_0x6ed5('0x7')](),controller[_0x6ed5('0xc')]);router['get'](_0x6ed5('0xd'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x6ed5('0xe'),auth[_0x6ed5('0x7')](),controller[_0x6ed5('0xf')]);router[_0x6ed5('0x10')]('/',auth[_0x6ed5('0x7')](),controller[_0x6ed5('0x11')]);router[_0x6ed5('0x10')](_0x6ed5('0xd'),auth[_0x6ed5('0x7')](),controller['addMessage']);router[_0x6ed5('0x10')]('/:id/tags',auth[_0x6ed5('0x7')](),interaction['tracked'](_0x6ed5('0x12'),_0x6ed5('0x13')),controller[_0x6ed5('0x14')]);router[_0x6ed5('0x15')]('/:id',auth[_0x6ed5('0x7')](),interaction['tracked'](_0x6ed5('0x12'),'openchannelinteraction:update'),controller[_0x6ed5('0x16')]);router['delete'](_0x6ed5('0xb'),auth[_0x6ed5('0x7')](),interaction[_0x6ed5('0x17')]('openchannel',_0x6ed5('0x18')),controller[_0x6ed5('0x19')]);router[_0x6ed5('0x1a')](_0x6ed5('0x1b'),auth[_0x6ed5('0x7')](),controller[_0x6ed5('0x1c')]);module[_0x6ed5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ff85431..bcf3158 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 _0x5e30=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0xff87f1,_0xadc52d){var _0x598e99=function(_0x44213a){while(--_0x44213a){_0xff87f1['push'](_0xff87f1['shift']());}};_0x598e99(++_0xadc52d);}(_0x5e30,0x7b));var _0x05e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e30[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x05e3('0x0'));module[_0x05e3('0x1')]={'closed':{'type':Sequelize[_0x05e3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x05e3('0x3')]},'disposition':{'type':Sequelize[_0x05e3('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x05e3('0x3')]},'threadId':{'type':Sequelize[_0x05e3('0x4')]},'externalUrl':{'type':Sequelize[_0x05e3('0x4')]},'lastMsgAt':{'type':Sequelize[_0x05e3('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x05e3('0x5')]('in',_0x05e3('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x38a5=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x38a5,0x69));var _0x538a=function(_0x3f0c6a,_0xd8e5c0){_0x3f0c6a=_0x3f0c6a-0x0;var _0xeb4d3c=_0x38a5[_0x3f0c6a];return _0xeb4d3c;};'use strict';var Sequelize=require(_0x538a('0x0'));module[_0x538a('0x1')]={'closed':{'type':Sequelize[_0x538a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x538a('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x538a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x538a('0x4')]},'note':{'type':Sequelize[_0x538a('0x4')]},'read1stAt':{'type':Sequelize[_0x538a('0x3')]},'threadId':{'type':Sequelize[_0x538a('0x4')]},'externalUrl':{'type':Sequelize[_0x538a('0x4')]},'lastMsgAt':{'type':Sequelize[_0x538a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x538a('0x5')]('in',_0x538a('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x538a('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index cc3d8c5..5307416 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 _0xd4dd=['type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','select','field','color','from','tools_tags','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','show','params','includeAll','include','merge','options','create','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','tmp','server','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','OpenchannelAccount','Account','Owner','get','10px','40px','30px','%s\x20#%d','Openchannel','YYYY-MM-DD','closed','closedAt','disposition','threadId','Public','Private','basename','pipe','createWriteStream','out','System','direction','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','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/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','index','rawAttributes'];(function(_0x400322,_0x4353a8){var _0xfdd597=function(_0xd914b6){while(--_0xd914b6){_0x400322['push'](_0x400322['shift']());}};_0xfdd597(++_0x4353a8);}(_0xd4dd,0x1ad));var _0xdd4d=function(_0xa8010,_0x1b6797){_0xa8010=_0xa8010-0x0;var _0x80080a=_0xd4dd[_0xa8010];return _0x80080a;};'use strict';var pdf=require(_0xdd4d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdd4d('0x1'));var zipdir=require(_0xdd4d('0x2'));var jsonpatch=require(_0xdd4d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdd4d('0x4'));var Mustache=require('mustache');var util=require(_0xdd4d('0x5'));var path=require(_0xdd4d('0x6'));var sox=require(_0xdd4d('0x7'));var csv=require(_0xdd4d('0x8'));var ejs=require(_0xdd4d('0x9'));var fs=require('fs');var _=require(_0xdd4d('0xa'));var squel=require(_0xdd4d('0xb'));var crypto=require(_0xdd4d('0xc'));var jsforce=require(_0xdd4d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdd4d('0x8'));var querystring=require(_0xdd4d('0xe'));var Papa=require(_0xdd4d('0xf'));var Redis=require(_0xdd4d('0x10'));var authService=require(_0xdd4d('0x11'));var qs=require(_0xdd4d('0x12'));var as=require(_0xdd4d('0x13'));var hardwareService=require(_0xdd4d('0x14'));var logger=require(_0xdd4d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xdd4d('0x16'));var licenseUtil=require(_0xdd4d('0x17'));var db=require(_0xdd4d('0x18'))['db'];config[_0xdd4d('0x19')]=_[_0xdd4d('0x1a')](config[_0xdd4d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd4d('0x1b'))(new Redis(config[_0xdd4d('0x19')]));require('./openchannelInteraction.socket')[_0xdd4d('0x1c')](socket);function respondWithStatusCode(_0x30e9c6,_0x3456cd){_0x3456cd=_0x3456cd||0xcc;return function(_0x180eb5){if(_0x180eb5){return _0x30e9c6['sendStatus'](_0x3456cd);}return _0x30e9c6['status'](_0x3456cd)[_0xdd4d('0x1d')]();};}function respondWithResult(_0x5301b3,_0x3b1ba2){_0x3b1ba2=_0x3b1ba2||0xc8;return function(_0x83f230){if(_0x83f230){return _0x5301b3[_0xdd4d('0x1e')](_0x3b1ba2)[_0xdd4d('0x1f')](_0x83f230);}};}function respondWithFilteredResult(_0x51ac16,_0xa8a25d){return function(_0x2d05ab){if(_0x2d05ab){var _0x49d1ff=_0x2d05ab[_0xdd4d('0x20')],_0x1f6449=_0xa8a25d[_0xdd4d('0x21')],_0xc394e0=_0xa8a25d[_0xdd4d('0x21')]+_0xa8a25d[_0xdd4d('0x22')],_0x27eee7;if(_0xc394e0>=_0x49d1ff){_0xc394e0=_0x49d1ff;_0x27eee7=0xc8;}else{_0x27eee7=0xce;}_0x51ac16[_0xdd4d('0x1e')](_0x27eee7);return _0x51ac16[_0xdd4d('0x23')](_0xdd4d('0x24'),_0x1f6449+'-'+_0xc394e0+'/'+_0x49d1ff)[_0xdd4d('0x1f')](_0x2d05ab);}return null;};}function patchUpdates(_0x1c3083){return function(_0x3fd7b3){try{jsonpatch['apply'](_0x3fd7b3,_0x1c3083,!![]);}catch(_0x52f860){return BPromise[_0xdd4d('0x25')](_0x52f860);}return _0x3fd7b3[_0xdd4d('0x26')]();};}function saveUpdates(_0x45c30e,_0x3f0fe0){return function(_0x330078){if(_0x330078){return _0x330078[_0xdd4d('0x27')](_0x45c30e)['then'](function(_0x8237c2){return _0x8237c2;});}return null;};}function removeEntity(_0x30c16d,_0x175ea6){return function(_0x3f7ce1){if(_0x3f7ce1){return _0x3f7ce1[_0xdd4d('0x28')]()[_0xdd4d('0x29')](function(){_0x30c16d['status'](0xcc)[_0xdd4d('0x1d')]();});}};}function handleEntityNotFound(_0x2b0ec7,_0x137341){return function(_0x8b0bef){if(!_0x8b0bef){_0x2b0ec7[_0xdd4d('0x2a')](0x194);}return _0x8b0bef;};}function handleError(_0x5cb5b7,_0x538f12){_0x538f12=_0x538f12||0x1f4;return function(_0x81a06c){logger['error'](_0x81a06c[_0xdd4d('0x2b')]);if(_0x81a06c[_0xdd4d('0x2c')]){delete _0x81a06c[_0xdd4d('0x2c')];}_0x5cb5b7[_0xdd4d('0x1e')](_0x538f12)[_0xdd4d('0x2d')](_0x81a06c);};}function getInteractionUsers(_0x5a6def,_0x3090ee){return new BPromise(function(_0x5cae6d,_0x353259){try{if(_0x3090ee[_0x5a6def['id']]){_0x5a6def[_0xdd4d('0x2e')]=_[_0xdd4d('0x2f')](_0x3090ee[_0x5a6def['id']],function(_0x594955){return{'id':_0x594955['id'],'fullname':_0x594955[_0xdd4d('0x30')]};});}}catch(_0x1b748d){_0x353259(_0x1b748d);}_0x5cae6d(_0x5a6def);});}function getInteractionTags(_0xf6f3dc,_0x498303){return new BPromise(function(_0x4526c1,_0x4fa00a){try{if(_0xf6f3dc['TagIds']){_0xf6f3dc['Tags']=[];_0xf6f3dc[_0xdd4d('0x31')][_0xdd4d('0x32')](',')[_0xdd4d('0x33')](function(_0xbc17ad){_0xf6f3dc[_0xdd4d('0x34')][_0xdd4d('0x35')](_0x498303[_0xbc17ad]);});}delete _0xf6f3dc[_0xdd4d('0x31')];}catch(_0x34b178){_0x4fa00a(_0x34b178);}_0x4526c1(_0xf6f3dc);});}function updateOpenchannelInteraction(_0x4cf1ae,_0x29831f,_0x1a0024){return new BPromise(function(_0x4072f2,_0x4eeb56){return getInteractionUsers(_0x4cf1ae,_0x1a0024)[_0xdd4d('0x29')](function(_0x2b400b){return getInteractionTags(_0x2b400b,_0x29831f);})[_0xdd4d('0x29')](function(_0x563783){_0x4072f2(_0x563783);})[_0xdd4d('0x36')](function(_0x14b12e){_0x4eeb56(_0x14b12e);});});}exports[_0xdd4d('0x37')]=function(_0x3f6c54,_0x2d618c){var _0x4e0f3e={},_0x46c312={},_0x55f121={'count':0x0,'rows':[]};var _0x293f06=_[_0xdd4d('0x2f')](db['OpenchannelInteraction'][_0xdd4d('0x38')],function(_0x52b706){return{'name':_0x52b706['fieldName'],'type':_0x52b706[_0xdd4d('0x39')][_0xdd4d('0x3a')]};});_0x46c312[_0xdd4d('0x3b')]=_[_0xdd4d('0x2f')](_0x293f06,_0xdd4d('0x2c'));_0x46c312[_0xdd4d('0x3c')]=_[_0xdd4d('0x3d')](_0x3f6c54[_0xdd4d('0x3c')]);_0x46c312[_0xdd4d('0x3e')]=_[_0xdd4d('0x3f')](_0x46c312['model'],_0x46c312[_0xdd4d('0x3c')]);_0x4e0f3e['attributes']=_[_0xdd4d('0x3f')](_0x46c312[_0xdd4d('0x3b')],qs[_0xdd4d('0x40')](_0x3f6c54[_0xdd4d('0x3c')]['fields']));_0x4e0f3e[_0xdd4d('0x41')]=_0x4e0f3e[_0xdd4d('0x41')][_0xdd4d('0x42')]?_0x4e0f3e[_0xdd4d('0x41')]:_0x46c312[_0xdd4d('0x3b')];if(!_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x43')]('nolimit')){_0x4e0f3e['limit']=qs[_0xdd4d('0x22')](_0x3f6c54['query'][_0xdd4d('0x22')]);_0x4e0f3e[_0xdd4d('0x21')]=qs[_0xdd4d('0x21')](_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x21')]);}_0x4e0f3e[_0xdd4d('0x44')]=qs[_0xdd4d('0x45')](_0x3f6c54['query'][_0xdd4d('0x45')]);_0x4e0f3e['where']=qs[_0xdd4d('0x3e')](_[_0xdd4d('0x46')](_0x3f6c54[_0xdd4d('0x3c')],_0x46c312[_0xdd4d('0x3e')]),_0x293f06);var _0x507326=[];var _0x72936d=squel[_0xdd4d('0x47')]()[_0xdd4d('0x48')]('id')[_0xdd4d('0x48')](_0xdd4d('0x2c'))[_0xdd4d('0x48')](_0xdd4d('0x49'))[_0xdd4d('0x4a')](_0xdd4d('0x4b'));var _0x274b07=squel[_0xdd4d('0x47')]()['field']('u.id')[_0xdd4d('0x48')]('u.fullname')[_0xdd4d('0x48')](_0xdd4d('0x4c'))['from'](_0xdd4d('0x4d'),'ui')[_0xdd4d('0x4e')](_0xdd4d('0x4f'),'u',_0xdd4d('0x50'));var _0x1b5a83=squel['select']()['from'](_0xdd4d('0x51'),'i')[_0xdd4d('0x4e')](_0xdd4d('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xdd4d('0x4e')]('users','o',_0xdd4d('0x53'))['left_join'](_0xdd4d('0x54'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xdd4d('0x4e')](_0xdd4d('0x55'),'me',_0xdd4d('0x56'))['left_join'](_0xdd4d('0x57'),'it',_0xdd4d('0x58'))['left_join'](_0xdd4d('0x4b'),'t',_0xdd4d('0x59'));var _0x620688=squel[_0xdd4d('0x5a')]();var _0x313b72=[];var _0x1bc0b3=squel[_0xdd4d('0x5a')]();var _0x10fc7b;if(_0x3f6c54[_0xdd4d('0x3c')]['search']){_0x10fc7b=as[_0xdd4d('0x5b')](_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x5c')]);var _0x540871=_0x10fc7b['sqlOperator'];for(var _0x44f19a=0x0;_0x44f19a<_0x10fc7b[_0xdd4d('0x5d')][_0xdd4d('0x42')];_0x44f19a++){var _0x4ab413=_0x10fc7b[_0xdd4d('0x5d')][_0x44f19a];var _0x2cf8ee='i';var _0x3c14ad=_[_0xdd4d('0x5e')](_0x293f06,[_0xdd4d('0x2c'),_0x4ab413['field']]);if(!_0x3c14ad){switch(_0x4ab413[_0xdd4d('0x48')]){case _0xdd4d('0x5f'):if(_0x4ab413[_0xdd4d('0x60')]==0x1){_0x1b5a83[_0xdd4d('0x61')]('`'+_0x4ab413[_0xdd4d('0x48')]+_0xdd4d('0x62'));}else{_0x1b5a83[_0xdd4d('0x61')]('`'+_0x4ab413['field']+_0xdd4d('0x63'));}break;case _0xdd4d('0x64'):if(_0x4ab413[_0xdd4d('0x65')]===_0xdd4d('0x66')){if(_0x4ab413[_0xdd4d('0x60')]['split']('\x20')[_0xdd4d('0x42')]>0x1){_0x620688[_0x540871]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xdd4d('0x67')](_0x4ab413[_0xdd4d('0x60')]),null);}else{var _0x229904='%'+_0x4ab413[_0xdd4d('0x60')]+'%';_0x620688[_0x540871](_0xdd4d('0x68'),_0x229904,_0x229904,_0x229904);}}else{_0x3c14ad=_[_0xdd4d('0x5e')](_0x293f06,[_0xdd4d('0x2c'),_0xdd4d('0x69')]);_0x4ab413[_0xdd4d('0x48')]=_0xdd4d('0x69');_0x475860=as['buildExpression'](_0x2cf8ee,_0x3c14ad[_0xdd4d('0x39')],_0x4ab413);_0x620688[_0x540871](_0x475860[_0xdd4d('0x6a')],_0x475860[_0xdd4d('0x60')][_0xdd4d('0x6b')],_0x475860[_0xdd4d('0x60')][_0xdd4d('0x1d')]);}break;case _0xdd4d('0x6c'):var _0x477ae0=_0x4ab413[_0xdd4d('0x60')][_0xdd4d('0x32')](',')['map'](function(_0x30bd05){return Number(_0x30bd05);});_0x477ae0[_0xdd4d('0x33')](function(_0x3296df){_0x1bc0b3['or'](_0xdd4d('0x6d'),'%,'+_0x3296df+',%');});_0x313b72=_[_0xdd4d('0x6e')](_0x313b72,_0x477ae0);break;case _0xdd4d('0x6f'):if(_0x4ab413[_0xdd4d('0x65')]===_0xdd4d('0x66')){_0x620688[_0x540871](_0xdd4d('0x70'),'%'+_0x4ab413['value']+'%',null);}else{_0x3c14ad=_[_0xdd4d('0x5e')](_0x293f06,[_0xdd4d('0x2c'),_0xdd4d('0x71')]);_0x4ab413[_0xdd4d('0x48')]=_0xdd4d('0x71');_0x475860=as[_0xdd4d('0x72')](_0x2cf8ee,_0x3c14ad[_0xdd4d('0x39')],_0x4ab413);_0x620688[_0x540871](_0x475860[_0xdd4d('0x6a')],_0x475860[_0xdd4d('0x60')]['start'],_0x475860[_0xdd4d('0x60')][_0xdd4d('0x1d')]);}break;case _0xdd4d('0x73'):_0x475860=as[_0xdd4d('0x72')]('me',null,_0x4ab413);_0x620688[_0x540871](_0x475860[_0xdd4d('0x6a')],_0x475860[_0xdd4d('0x60')][_0xdd4d('0x6b')],_0x475860[_0xdd4d('0x60')][_0xdd4d('0x1d')]);break;}}else{var _0x475860=as[_0xdd4d('0x72')](_0x2cf8ee,_0x3c14ad[_0xdd4d('0x39')],_0x4ab413);_0x620688[_0x540871](_0x475860[_0xdd4d('0x6a')],_0x475860[_0xdd4d('0x60')][_0xdd4d('0x6b')],_0x475860['value'][_0xdd4d('0x1d')]);}}}else{var _0x287409=_(_0x3f6c54['query'])[_0xdd4d('0x3d')]()['map'](function(_0x464604){return _[_0xdd4d('0x74')](_0x293f06,[_0xdd4d('0x2c'),_0x464604])?_0x464604:undefined;})[_0xdd4d('0x75')]()[_0xdd4d('0x60')]();if(!_[_0xdd4d('0x76')](_0x287409)){_0x287409[_0xdd4d('0x33')](function(_0x4f727a){if(_0x4f727a===_0xdd4d('0x77')){_0x1b5a83[_0xdd4d('0x78')](_0xdd4d('0x79'),[][_0xdd4d('0x7a')](_0x3f6c54[_0xdd4d('0x3c')][_0x4f727a]));}else if(_0x4f727a===_0xdd4d('0x7b')){var _0x43a10f=JSON[_0xdd4d('0x7c')](_0x3f6c54[_0xdd4d('0x3c')][_0x4f727a])[_0xdd4d('0x7d')];var _0x3a28fd=JSON[_0xdd4d('0x7c')](_0x3f6c54[_0xdd4d('0x3c')][_0x4f727a])['$lte'];_0x1b5a83['where'](_0xdd4d('0x7e'),_0x43a10f,_0x3a28fd);}else{if(_0x3f6c54[_0xdd4d('0x3c')][_0x4f727a]===_0xdd4d('0x7f')){_0x1b5a83[_0xdd4d('0x78')]('i.'+_0x4f727a+_0xdd4d('0x80'));}else{_0x1b5a83['where']('i.'+_0x4f727a+_0xdd4d('0x81'),_0x3f6c54[_0xdd4d('0x3c')][_0x4f727a]);}}});}if(_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x82')]){if(_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x82')]==0x1){_0x1b5a83['having']('`unreadMessages`\x20=\x200');}else{_0x1b5a83[_0xdd4d('0x61')](_0xdd4d('0x83'));}}if(_0x3f6c54[_0xdd4d('0x3c')]['tag']){_0x313b72=_[_0xdd4d('0x84')](_0x3f6c54['query'][_0xdd4d('0x85')])?_0x3f6c54['query'][_0xdd4d('0x85')]:new Array(_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x85')]);_0x313b72[_0xdd4d('0x33')](function(_0xfce34c){_0x1bc0b3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xfce34c+',%');});}if(_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x86')]){var _0x3d8aaf=_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x86')]['replace']('\x5c','\x5c\x5c')[_0xdd4d('0x87')](/'/g,'\x27\x27');if(qs[_0xdd4d('0x88')](_0x3d8aaf)){_0x620688['or'](_0xdd4d('0x89'),_0x3d8aaf+'%');}else{_0x620688['or'](_0xdd4d('0x8a'),qs[_0xdd4d('0x67')](_0x3d8aaf))['or'](_0xdd4d('0x8b'),_0x3d8aaf+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3d8aaf+'%');}}}_0x1b5a83[_0xdd4d('0x78')](_0x620688);_0x1b5a83[_0xdd4d('0x8c')](_0xdd4d('0x8d'));var _0x1edbfb={'type':db['Sequelize']['QueryTypes'][_0xdd4d('0x8e')],'raw':!![]};var _0x126316=_0x1b5a83[_0xdd4d('0x8f')]();_0x126316['field'](_0xdd4d('0x8d'));_0x126316[_0xdd4d('0x48')](_0xdd4d('0x90'),'unreadMessages');if(_0x4e0f3e['order']){_0x4e0f3e[_0xdd4d('0x44')]['forEach'](function(_0x535c27){var _0x36ea25=_0x535c27[0x0]===_0xdd4d('0x91')?_0x535c27[0x0]:'i.'+_0x535c27[0x0];_0x1b5a83[_0xdd4d('0x44')](_0x36ea25,_0x535c27[0x1]===_0xdd4d('0x92')?![]:!![]);});}if(!_[_0xdd4d('0x76')](_0x313b72)){_0x1b5a83[_0xdd4d('0x61')](_0x1bc0b3);_0x126316[_0xdd4d('0x78')]('t.id\x20IN\x20?',_0x313b72);}BPromise['resolve']()[_0xdd4d('0x29')](function(){if(!_0x10fc7b){if(_0x3f6c54['query'][_0xdd4d('0x77')])return;_0x126316[_0xdd4d('0x78')](_0xdd4d('0x93'));_0x1b5a83['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3f6c54[_0xdd4d('0x94')][_0xdd4d('0x95')]!==_0xdd4d('0x96'))return;return _0x3f6c54[_0xdd4d('0x94')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xdd4d('0x29')](function(_0x38c7bf){if(_['isEmpty'](_0x38c7bf)){_0x126316[_0xdd4d('0x78')](_0xdd4d('0x97'));_0x1b5a83[_0xdd4d('0x78')](_0xdd4d('0x97'));}else{_0x126316['where']('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x38c7bf,'id'));_0x1b5a83[_0xdd4d('0x78')](_0xdd4d('0x79'),_['map'](_0x38c7bf,'id'));}});})[_0xdd4d('0x29')](function(){if(_0x3f6c54[_0xdd4d('0x94')][_0xdd4d('0x95')]===_0xdd4d('0x96')&&!_0x10fc7b&&!_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x77')])return[];return db['sequelize'][_0xdd4d('0x3c')](_0x126316[_0xdd4d('0x98')](),_0x1edbfb);})[_0xdd4d('0x29')](function(_0x3439d0){_0x55f121[_0xdd4d('0x20')]=_0x3439d0[_0xdd4d('0x42')];if(_0x55f121[_0xdd4d('0x20')]===0x0)return[];return db[_0xdd4d('0x99')][_0xdd4d('0x3c')](_0x72936d['toString'](),_0x1edbfb)[_0xdd4d('0x29')](function(_0x322b4b){_0x507326=_[_0xdd4d('0x9a')](_0x322b4b,'id');_0x1edbfb=_['merge'](_0x1edbfb,{'model':db[_0xdd4d('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f6c54['query'][_0xdd4d('0x40')]){_0x4e0f3e[_0xdd4d('0x41')][_0xdd4d('0x33')](function(_0x579658){_0x1b5a83['field']('i.'+_0x579658);});}else{_0x1b5a83[_0xdd4d('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x1b5a83['field'](_0xdd4d('0x9c'),_0xdd4d('0x9d'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0x9e'),_0xdd4d('0x9f'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xa0'),_0xdd4d('0x91'));_0x1b5a83['field'](_0xdd4d('0xa1'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xa2'),_0xdd4d('0xa3'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xa4'),_0xdd4d('0xa5'));_0x1b5a83['field'](_0xdd4d('0xa6'),_0xdd4d('0xa7'));_0x1b5a83[_0xdd4d('0x48')]('c.phone',_0xdd4d('0xa8'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xa9'),'Contact.mobile');_0x1b5a83[_0xdd4d('0x48')]('c.fax',_0xdd4d('0xaa'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xab'),_0xdd4d('0xac'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xad'),_0xdd4d('0xae'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xaf'),'TagIds');}if(_0x4e0f3e[_0xdd4d('0x22')])_0x1b5a83[_0xdd4d('0x22')](_0x4e0f3e[_0xdd4d('0x22')]);if(_0x4e0f3e[_0xdd4d('0x21')])_0x1b5a83[_0xdd4d('0x21')](_0x4e0f3e['offset']);return db[_0xdd4d('0x99')][_0xdd4d('0x3c')](_0x1b5a83['toString'](),_0x1edbfb);})[_0xdd4d('0x29')](function(_0x147486){_0x274b07[_0xdd4d('0x78')](_0xdd4d('0xb0'),_['map'](_0x147486,'id'));return db[_0xdd4d('0x99')][_0xdd4d('0x3c')](_0x274b07[_0xdd4d('0x98')](),_0x1edbfb)[_0xdd4d('0x29')](function(_0x12225e){var _0x3f4d12=_['groupBy'](_0x12225e,_0xdd4d('0xb1'));var _0x3b1a8c=[];_0x147486[_0xdd4d('0x33')](function(_0x4d2bf0){_0x3b1a8c[_0xdd4d('0x35')](updateOpenchannelInteraction(_0x4d2bf0,_0x507326,_0x3f4d12));});return BPromise[_0xdd4d('0xb2')](_0x3b1a8c);});});})[_0xdd4d('0x29')](function(_0x29ac03){_0x55f121[_0xdd4d('0xb3')]=_0x29ac03;return _0x55f121;})[_0xdd4d('0x29')](respondWithFilteredResult(_0x2d618c,_0x4e0f3e))[_0xdd4d('0x36')](handleError(_0x2d618c,null));};exports[_0xdd4d('0xb4')]=function(_0x27929e,_0x2ca6f4){var _0x2e2512={};if(_0x27929e['query'][_0xdd4d('0x39')]&&_0x27929e['query'][_0xdd4d('0x39')]===_0xdd4d('0x4a')){_0x2e2512['from']=_0x27929e[_0xdd4d('0xb5')]['id'];}else{_0x2e2512['id']=_0x27929e['params']['id'];}var _0x2830cf={'raw':![],'where':_0x2e2512},_0x51456a={};_0x51456a[_0xdd4d('0x3b')]=_[_0xdd4d('0x3d')](db[_0xdd4d('0x9b')]['rawAttributes']);_0x51456a[_0xdd4d('0x3c')]=_['keys'](_0x27929e[_0xdd4d('0x3c')]);_0x51456a['filters']=_['intersection'](_0x51456a['model'],_0x51456a[_0xdd4d('0x3c')]);_0x2830cf[_0xdd4d('0x41')]=_['intersection'](_0x51456a['model'],qs[_0xdd4d('0x40')](_0x27929e['query'][_0xdd4d('0x40')]));_0x2830cf['attributes']=_0x2830cf[_0xdd4d('0x41')][_0xdd4d('0x42')]?_0x2830cf[_0xdd4d('0x41')]:_0x51456a[_0xdd4d('0x3b')];if(_0x27929e['query'][_0xdd4d('0xb6')]){_0x2830cf[_0xdd4d('0xb7')]=[{'all':!![]}];}_0x2830cf=_[_0xdd4d('0xb8')]({},_0x2830cf,_0x27929e[_0xdd4d('0xb9')]);return db['OpenchannelInteraction'][_0xdd4d('0x5e')](_0x2830cf)['then'](handleEntityNotFound(_0x2ca6f4,null))[_0xdd4d('0x29')](respondWithResult(_0x2ca6f4,null))[_0xdd4d('0x36')](handleError(_0x2ca6f4,null));};exports[_0xdd4d('0xba')]=function(_0x1241cb,_0x311daf){return db[_0xdd4d('0x9b')][_0xdd4d('0xba')](_0x1241cb[_0xdd4d('0x73')],{})['then'](respondWithResult(_0x311daf,0xc9))[_0xdd4d('0x36')](handleError(_0x311daf,null));};exports[_0xdd4d('0x27')]=function(_0x5c4fc0,_0x4df9fa){if(_0x5c4fc0[_0xdd4d('0x73')]['id']){delete _0x5c4fc0[_0xdd4d('0x73')]['id'];}return db[_0xdd4d('0x9b')][_0xdd4d('0x5e')]({'where':{'id':_0x5c4fc0[_0xdd4d('0xb5')]['id']}})[_0xdd4d('0x29')](handleEntityNotFound(_0x4df9fa,null))[_0xdd4d('0x29')](saveUpdates(_0x5c4fc0[_0xdd4d('0x73')],null))[_0xdd4d('0x29')](respondWithResult(_0x4df9fa,null))['catch'](handleError(_0x4df9fa,null));};exports[_0xdd4d('0x28')]=function(_0x4dba14,_0x3b475d){return db[_0xdd4d('0x9b')][_0xdd4d('0x5e')]({'where':{'id':_0x4dba14[_0xdd4d('0xb5')]['id']}})[_0xdd4d('0x29')](handleEntityNotFound(_0x3b475d,null))[_0xdd4d('0x29')](removeEntity(_0x3b475d,null))[_0xdd4d('0x36')](handleError(_0x3b475d,null));};exports[_0xdd4d('0xbb')]=function(_0x2ef92e,_0x44156b){return db[_0xdd4d('0x9b')][_0xdd4d('0xbb')]()['then'](respondWithResult(_0x44156b,null))[_0xdd4d('0x36')](handleError(_0x44156b,null));};exports['addMessage']=function(_0x5aeeeb,_0x2acb5f,_0x2c81cc){return db[_0xdd4d('0xbc')]['find']({'where':{'id':_0x5aeeeb['params']['id']}})['then'](handleEntityNotFound(_0x2acb5f,null))[_0xdd4d('0x29')](function(_0x5b7244){if(_0x5b7244){return _0x5b7244[_0xdd4d('0xbd')](_0x5aeeeb[_0xdd4d('0x73')][_0xdd4d('0xbe')],_[_0xdd4d('0xbf')](_0x5aeeeb[_0xdd4d('0x73')],[_0xdd4d('0xbe'),'id'])||{});}})['then'](respondWithResult(_0x2acb5f,null))[_0xdd4d('0x36')](handleError(_0x2acb5f,null));};exports[_0xdd4d('0xc0')]=function(_0x56d1ed,_0x4c4753,_0x4fc16c){var _0x3c4021={'raw':![],'where':{}};var _0x1df0e4={};var _0x176aeb={'count':0x0,'rows':[]};return db[_0xdd4d('0x9b')][_0xdd4d('0xc1')]({'where':{'id':_0x56d1ed[_0xdd4d('0xb5')]['id']}})[_0xdd4d('0x29')](handleEntityNotFound(_0x4c4753,null))[_0xdd4d('0x29')](function(_0x15b377){if(_0x15b377){_0x1df0e4[_0xdd4d('0x3b')]=_[_0xdd4d('0x3d')](db[_0xdd4d('0xbc')][_0xdd4d('0x38')]);_0x1df0e4[_0xdd4d('0x3c')]=_['keys'](_0x56d1ed[_0xdd4d('0x3c')]);_0x1df0e4[_0xdd4d('0x3e')]=_['intersection'](_0x1df0e4[_0xdd4d('0x3b')],_0x1df0e4[_0xdd4d('0x3c')]);_0x3c4021[_0xdd4d('0x41')]=_[_0xdd4d('0x3f')](_0x1df0e4[_0xdd4d('0x3b')],qs['fields'](_0x56d1ed[_0xdd4d('0x3c')][_0xdd4d('0x40')]));_0x3c4021[_0xdd4d('0x41')]=_0x3c4021['attributes'][_0xdd4d('0x42')]?_0x3c4021[_0xdd4d('0x41')]:_0x1df0e4['model'];if(!_0x56d1ed[_0xdd4d('0x3c')]['hasOwnProperty']('nolimit')){_0x3c4021[_0xdd4d('0x22')]=qs[_0xdd4d('0x22')](_0x56d1ed[_0xdd4d('0x3c')][_0xdd4d('0x22')]);_0x3c4021[_0xdd4d('0x21')]=qs[_0xdd4d('0x21')](_0x56d1ed[_0xdd4d('0x3c')][_0xdd4d('0x21')]);}_0x3c4021[_0xdd4d('0x44')]=qs[_0xdd4d('0x45')](_0x56d1ed['query'][_0xdd4d('0x45')]);_0x3c4021['where']=qs['filters'](_[_0xdd4d('0x46')](_0x56d1ed[_0xdd4d('0x3c')],_0x1df0e4['filters']));_0x3c4021['where'][_0xdd4d('0xb1')]=_0x15b377['id'];if(_0x56d1ed['query'][_0xdd4d('0x86')]){_0x3c4021['where']=_['merge'](_0x3c4021['where'],{'$or':_['map'](_0x3c4021[_0xdd4d('0x41')],function(_0x24bd9e){var _0x534700={};_0x534700[_0x24bd9e]={'$like':'%'+_0x56d1ed[_0xdd4d('0x3c')]['filter']+'%'};return _0x534700;})});}if(_0x56d1ed['query'][_0xdd4d('0x7d')]){var _0x1a8738=_0x56d1ed[_0xdd4d('0x3c')][_0xdd4d('0x7d')][_0xdd4d('0x32')](',');var _0x23f3e8={};_0x23f3e8[_0x1a8738[0x0]]={'$gte':moment(_0x1a8738[0x1])[_0xdd4d('0xc2')](_0xdd4d('0xc3'))};_0x3c4021[_0xdd4d('0x78')]=_[_0xdd4d('0xb8')](_0x3c4021[_0xdd4d('0x78')],_0x23f3e8);}_0x3c4021=_[_0xdd4d('0xb8')]({},_0x3c4021,_0x56d1ed[_0xdd4d('0xb9')]);return db[_0xdd4d('0xbc')]['count']({'where':_0x3c4021[_0xdd4d('0x78')]})[_0xdd4d('0x29')](function(_0x4befa2){_0x176aeb[_0xdd4d('0x20')]=_0x4befa2;if(_0x56d1ed[_0xdd4d('0x3c')][_0xdd4d('0xb6')]){_0x3c4021[_0xdd4d('0xb7')]=[{'all':!![]}];}return db[_0xdd4d('0xbc')]['findAll'](_0x3c4021);})['then'](function(_0xcfb76a){_0x176aeb[_0xdd4d('0xb3')]=_0xcfb76a;return _0x176aeb;});}})[_0xdd4d('0x29')](respondWithFilteredResult(_0x4c4753,_0x3c4021))[_0xdd4d('0x36')](handleError(_0x4c4753,null));};exports['addTags']=function(_0x293d14,_0x42c270,_0x121a1d){return db[_0xdd4d('0x9b')][_0xdd4d('0x5e')]({'where':{'id':_0x293d14[_0xdd4d('0xb5')]['id']}})[_0xdd4d('0x29')](handleEntityNotFound(_0x42c270,null))[_0xdd4d('0x29')](function(_0x2caa73){if(_0x2caa73){return _0x2caa73[_0xdd4d('0xc4')](_0x293d14['body'][_0xdd4d('0xbe')],_[_0xdd4d('0xbf')](_0x293d14[_0xdd4d('0x73')],[_0xdd4d('0xbe'),'id'])||{})[_0xdd4d('0xc5')](function(){return db['Tag']['findAll']({'attributes':['id',_0xdd4d('0x2c'),'color'],'where':{'id':_0x293d14['body'][_0xdd4d('0xbe')]}});})[_0xdd4d('0x29')](function(_0x45e5e2){socket[_0xdd4d('0xc6')](_0xdd4d('0xc7'),{'id':Number(_0x293d14[_0xdd4d('0xb5')]['id']),'tags':_0x45e5e2||[]});return{'id':Number(_0x293d14[_0xdd4d('0xb5')]['id']),'tags':_0x45e5e2||[]};});}})[_0xdd4d('0x29')](respondWithResult(_0x42c270,null))[_0xdd4d('0x36')](handleError(_0x42c270,null));};exports[_0xdd4d('0xc8')]=function(_0x59b833,_0x5ef4d4,_0x44e7b2){return db['OpenchannelInteraction'][_0xdd4d('0x5e')]({'where':{'id':_0x59b833[_0xdd4d('0xb5')]['id']}})[_0xdd4d('0x29')](handleEntityNotFound(_0x5ef4d4,null))[_0xdd4d('0x29')](function(_0xb1e11c){if(_0xb1e11c){return _0xb1e11c[_0xdd4d('0xc8')](_0x59b833[_0xdd4d('0x3c')][_0xdd4d('0xbe')]);}})['then'](respondWithStatusCode(_0x5ef4d4,null))[_0xdd4d('0x36')](handleError(_0x5ef4d4,null));};exports[_0xdd4d('0xc9')]=function(_0x405784,_0x55ccf7){var _0x52e8c5=moment()[_0xdd4d('0xca')]()['toString']();var _0x4eca89=path[_0xdd4d('0xcb')](config[_0xdd4d('0xcc')],'server','files',_0xdd4d('0xcd'));var _0x318924=path[_0xdd4d('0xcb')](config['root'],_0xdd4d('0xce'),'files',_0xdd4d('0xcf'));var _0x43d1c6=path[_0xdd4d('0xcb')](_0x4eca89,_0x52e8c5);var _0x19d61d=util[_0xdd4d('0xc2')](_0xdd4d('0xd0'),_0x405784[_0xdd4d('0xb5')]['id'],_0x52e8c5);var _0x3efa2f=path[_0xdd4d('0xcb')](_0x4eca89,_0x19d61d);var _0xe6945f=[];_0xe6945f[_0xdd4d('0x35')]({'model':db[_0xdd4d('0x6f')],'as':'User','attributes':['id',_0xdd4d('0x30')],'raw':!![]});_0xe6945f[_0xdd4d('0x35')]({'model':db[_0xdd4d('0xd1')],'as':'Contact','attributes':['id',_0xdd4d('0xd2'),_0xdd4d('0xd3')],'raw':!![]});if(_0x405784[_0xdd4d('0x3c')][_0xdd4d('0xcf')]){_0xe6945f[_0xdd4d('0x35')]({'model':db[_0xdd4d('0xd4')],'as':_0xdd4d('0xd4'),'raw':!![]});}var _0x54f28=[{'model':db[_0xdd4d('0xbc')],'as':_0xdd4d('0xd5'),'attributes':['id',_0xdd4d('0x73'),_0xdd4d('0x7b'),'direction','secret',_0xdd4d('0x82')],'include':_0xe6945f}];_0x54f28[_0xdd4d('0x35')]({'model':db[_0xdd4d('0xd6')],'as':_0xdd4d('0xd7'),'attributes':['id',_0xdd4d('0x2c')]});_0x54f28[_0xdd4d('0x35')]({'model':db[_0xdd4d('0x6f')],'as':_0xdd4d('0xd8'),'attributes':['id','fullname']});return db[_0xdd4d('0x9b')][_0xdd4d('0x5e')]({'where':{'id':_0x405784[_0xdd4d('0xb5')]['id']},'include':_0x54f28})[_0xdd4d('0x29')](handleEntityNotFound(_0x55ccf7,null))[_0xdd4d('0x29')](function(_0x4db2da){if(_0x4db2da){var _0x5c2661=_0x4db2da[_0xdd4d('0xd9')]({'plain':!![]});fs['mkdirSync'](_0x43d1c6);var _0x2b1752={'format':'A4','border':_0xdd4d('0xda'),'header':{'height':_0xdd4d('0xdb'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0xdd4d('0xdc'),'contents':{'default':util[_0xdd4d('0xc2')]('\x0a\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[_0xdd4d('0xc2')](_0xdd4d('0xdd'),_0xdd4d('0xde'),_0x5c2661['id']),moment()[_0xdd4d('0xc2')](_0xdd4d('0xdf'))['toString']())}}};var _0x529d10={'channel':_0xdd4d('0xde'),'account':_0x5c2661[_0xdd4d('0xd7')][_0xdd4d('0x2c')],'agent':_0x5c2661[_0xdd4d('0xd8')]?_0x5c2661[_0xdd4d('0xd8')][_0xdd4d('0x30')]:'N.A.','createdAt':moment(_0x5c2661[_0xdd4d('0x7b')])[_0xdd4d('0xc2')](_0xdd4d('0xc3'))[_0xdd4d('0x98')](),'closedAt':_0x5c2661[_0xdd4d('0xe0')]?moment(_0x5c2661[_0xdd4d('0xe1')])[_0xdd4d('0xc2')](_0xdd4d('0xc3'))['toString']():'','disposition':_0x5c2661[_0xdd4d('0xe2')],'visibility':_0x5c2661[_0xdd4d('0xe3')]?_0xdd4d('0xe4'):_0xdd4d('0xe5'),'messages':_(_0x5c2661[_0xdd4d('0xd5')])['filter']({'secret':![]})[_0xdd4d('0x2f')](function(_0x4c3361){if(_0x4c3361[_0xdd4d('0xd4')]){var _0x3da272=path[_0xdd4d('0xcb')](_0x318924,_0x4c3361['Attachment'][_0xdd4d('0xe6')]);if(fs['existsSync'](_0x3da272)){fs['createReadStream'](_0x3da272)[_0xdd4d('0xe7')](fs[_0xdd4d('0xe8')](path[_0xdd4d('0xcb')](_0x43d1c6,_0x4c3361['Attachment'][_0xdd4d('0xe6')])));}}return{'date':moment(_0x4c3361[_0xdd4d('0x7b')])[_0xdd4d('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdd4d('0x98')](),'sender':_0x4c3361['direction']===_0xdd4d('0xe9')?_0x4c3361[_0xdd4d('0x6f')]?_0x4c3361[_0xdd4d('0x6f')][_0xdd4d('0x30')]:_0xdd4d('0xea'):_0x4c3361['Contact']['firstName']+(_0x4c3361[_0xdd4d('0x64')][_0xdd4d('0xd3')]?'\x20'+_0x4c3361['Contact']['lastName']:''),'body':_0x4c3361[_0xdd4d('0xd4')]?_0x4c3361[_0xdd4d('0xd4')][_0xdd4d('0xe6')]:_0x4c3361[_0xdd4d('0x73')],'direction':_0x4c3361[_0xdd4d('0xeb')]===_0xdd4d('0xe9')?'A':'C','secret':_0x4c3361['secret'],'read':_0x4c3361['read'],'attachment':_0x4c3361[_0xdd4d('0xd4')]};})[_0xdd4d('0x60')]()};return ejs['renderFile'](path[_0xdd4d('0xcb')](config['root'],_0xdd4d('0xce'),_0xdd4d('0xec'),_0xdd4d('0xed')),{'interaction':_0x529d10})[_0xdd4d('0x29')](function(_0x59fe5f){return new BPromise(function(_0x219cea,_0x5f0cbf){pdf[_0xdd4d('0xba')](_0x59fe5f,_0x2b1752)[_0xdd4d('0xee')](path['join'](_0x43d1c6,_0xdd4d('0xef')+_0x5c2661['id']+'-'+_0x52e8c5+_0xdd4d('0xf0')),function(_0x49c5f3,_0x32e184){if(_0x49c5f3)return _0x5f0cbf(_0x49c5f3);_0x219cea(_0x32e184);});});})[_0xdd4d('0x29')](function(){return new BPromise(function(_0x29b2fe,_0x2a5f9f){zipdir(_0x43d1c6,{'saveTo':_0x3efa2f},function(_0x46dd88,_0x551de5){if(_0x46dd88)return _0x2a5f9f(_0x46dd88);return _0x29b2fe(_0x551de5);});})['then'](function(){return new BPromise(function(_0x29091d,_0x30e356){rimraf(_0x43d1c6,function(_0x1a4fdd){if(_0x1a4fdd)_0x30e356(_0x1a4fdd);return _0x29091d();});});})[_0xdd4d('0x29')](function(){return _0x55ccf7[_0xdd4d('0xc9')](_0x3efa2f,_0x19d61d,function(_0x4fe50c){if(_0x4fe50c){console[_0xdd4d('0xf1')](_0xdd4d('0xf2'),_0x4fe50c);}else{fs['unlinkSync'](_0x3efa2f);}});});});}else{return _0x55ccf7['sendStatus'](0xc8);}})[_0xdd4d('0x36')](handleError(_0x55ccf7,null));}; \ No newline at end of file +var _0xb4cd=['OpenchannelInteraction','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','u.id','u.fullname','user_has_openchannel_interactions','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','length','find','unreadMessages','value','`\x20=\x200','having','operator','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','text','start','Tag','union','User','$substring','UserId','buildExpression','some','compact','OpenchannelAccountId','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','count','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','rows','catch','show','params','include','options','create','body','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','merge','includeAll','findAll','addTags','emit','removeTags','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','CmContact','Contact','firstName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','fullname','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','threadId','Public','Private','Messages','basename','createReadStream','pipe','createWriteStream','out','lastName','views','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','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','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','offset','limit','set','Content-Range','json','save','update','then','error','stack','name','send','Users','map','Tags','TagIds','forEach','index'];(function(_0x726624,_0x21f598){var _0x14fb9f=function(_0x11b31a){while(--_0x11b31a){_0x726624['push'](_0x726624['shift']());}};_0x14fb9f(++_0x21f598);}(_0xb4cd,0x1be));var _0xdb4c=function(_0x29a149,_0x169446){_0x29a149=_0x29a149-0x0;var _0x2d3497=_0xb4cd[_0x29a149];return _0x2d3497;};'use strict';var pdf=require(_0xdb4c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdb4c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb4c('0x2'));var rp=require(_0xdb4c('0x3'));var moment=require('moment');var BPromise=require(_0xdb4c('0x4'));var Mustache=require(_0xdb4c('0x5'));var util=require(_0xdb4c('0x6'));var path=require(_0xdb4c('0x7'));var sox=require('sox');var csv=require(_0xdb4c('0x8'));var ejs=require(_0xdb4c('0x9'));var fs=require('fs');var _=require(_0xdb4c('0xa'));var squel=require('squel');var crypto=require(_0xdb4c('0xb'));var jsforce=require(_0xdb4c('0xc'));var deskjs=require(_0xdb4c('0xd'));var toCsv=require(_0xdb4c('0x8'));var querystring=require(_0xdb4c('0xe'));var Papa=require(_0xdb4c('0xf'));var Redis=require(_0xdb4c('0x10'));var authService=require(_0xdb4c('0x11'));var qs=require(_0xdb4c('0x12'));var as=require(_0xdb4c('0x13'));var hardwareService=require(_0xdb4c('0x14'));var logger=require(_0xdb4c('0x15'))('api');var utils=require(_0xdb4c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdb4c('0x17'));var db=require(_0xdb4c('0x18'))['db'];config[_0xdb4c('0x19')]=_[_0xdb4c('0x1a')](config['redis'],{'host':_0xdb4c('0x1b'),'port':0x18eb});var socket=require(_0xdb4c('0x1c'))(new Redis(config[_0xdb4c('0x19')]));require(_0xdb4c('0x1d'))[_0xdb4c('0x1e')](socket);function respondWithStatusCode(_0x59d6fd,_0x5e6e53){_0x5e6e53=_0x5e6e53||0xcc;return function(_0x49884b){if(_0x49884b){return _0x59d6fd[_0xdb4c('0x1f')](_0x5e6e53);}return _0x59d6fd['status'](_0x5e6e53)[_0xdb4c('0x20')]();};}function respondWithResult(_0x4ca37d,_0xf2406b){_0xf2406b=_0xf2406b||0xc8;return function(_0x354c1f){if(_0x354c1f){return _0x4ca37d[_0xdb4c('0x21')](_0xf2406b)['json'](_0x354c1f);}};}function respondWithFilteredResult(_0x1ea5f8,_0x5ea065){return function(_0x3818ca){if(_0x3818ca){var _0x4a759d=_0x3818ca['count'],_0x2a1701=_0x5ea065[_0xdb4c('0x22')],_0x5e6405=_0x5ea065[_0xdb4c('0x22')]+_0x5ea065[_0xdb4c('0x23')],_0x5482c0;if(_0x5e6405>=_0x4a759d){_0x5e6405=_0x4a759d;_0x5482c0=0xc8;}else{_0x5482c0=0xce;}_0x1ea5f8[_0xdb4c('0x21')](_0x5482c0);return _0x1ea5f8[_0xdb4c('0x24')](_0xdb4c('0x25'),_0x2a1701+'-'+_0x5e6405+'/'+_0x4a759d)[_0xdb4c('0x26')](_0x3818ca);}return null;};}function patchUpdates(_0x2d6284){return function(_0x493473){try{jsonpatch['apply'](_0x493473,_0x2d6284,!![]);}catch(_0x6a027e){return BPromise['reject'](_0x6a027e);}return _0x493473[_0xdb4c('0x27')]();};}function saveUpdates(_0x111b17,_0x11c090){return function(_0xbd87ec){if(_0xbd87ec){return _0xbd87ec[_0xdb4c('0x28')](_0x111b17)['then'](function(_0x181257){return _0x181257;});}return null;};}function removeEntity(_0x1e62e2,_0x25d1c8){return function(_0x29e9d6){if(_0x29e9d6){return _0x29e9d6['destroy']()[_0xdb4c('0x29')](function(){_0x1e62e2[_0xdb4c('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x594e7e,_0xc2c60a){return function(_0x4bb5ff){if(!_0x4bb5ff){_0x594e7e['sendStatus'](0x194);}return _0x4bb5ff;};}function handleError(_0xebbeaf,_0x359c9d){_0x359c9d=_0x359c9d||0x1f4;return function(_0x1840a9){logger[_0xdb4c('0x2a')](_0x1840a9[_0xdb4c('0x2b')]);if(_0x1840a9[_0xdb4c('0x2c')]){delete _0x1840a9['name'];}_0xebbeaf[_0xdb4c('0x21')](_0x359c9d)[_0xdb4c('0x2d')](_0x1840a9);};}function getInteractionUsers(_0x1d9f52,_0x302268){return new BPromise(function(_0x48a21b,_0x50134c){try{if(_0x302268[_0x1d9f52['id']]){_0x1d9f52[_0xdb4c('0x2e')]=_[_0xdb4c('0x2f')](_0x302268[_0x1d9f52['id']],function(_0x2274fa){return{'id':_0x2274fa['id'],'fullname':_0x2274fa['fullname']};});}}catch(_0x1f42dc){_0x50134c(_0x1f42dc);}_0x48a21b(_0x1d9f52);});}function getInteractionTags(_0x5ddd27,_0x3d230f){return new BPromise(function(_0x382bfe,_0xfd6323){try{if(_0x5ddd27['TagIds']){_0x5ddd27[_0xdb4c('0x30')]=[];_0x5ddd27[_0xdb4c('0x31')]['split'](',')[_0xdb4c('0x32')](function(_0x330b53){_0x5ddd27[_0xdb4c('0x30')]['push'](_0x3d230f[_0x330b53]);});}delete _0x5ddd27[_0xdb4c('0x31')];}catch(_0x6f20b0){_0xfd6323(_0x6f20b0);}_0x382bfe(_0x5ddd27);});}function updateOpenchannelInteraction(_0x1d22b7,_0x2e05bf,_0x536353){return new BPromise(function(_0x5a25e6,_0x4eb9a1){return getInteractionUsers(_0x1d22b7,_0x536353)[_0xdb4c('0x29')](function(_0x4fed50){return getInteractionTags(_0x4fed50,_0x2e05bf);})['then'](function(_0x1792e3){_0x5a25e6(_0x1792e3);})['catch'](function(_0x239885){_0x4eb9a1(_0x239885);});});}exports[_0xdb4c('0x33')]=function(_0x30bcc5,_0x3b7e05){var _0x5a2028={},_0x2b988e={},_0x4c56ee={'count':0x0,'rows':[]};var _0x57c32c=_[_0xdb4c('0x2f')](db[_0xdb4c('0x34')][_0xdb4c('0x35')],function(_0x15ff79){return{'name':_0x15ff79[_0xdb4c('0x36')],'type':_0x15ff79[_0xdb4c('0x37')][_0xdb4c('0x38')]};});_0x2b988e['model']=_['map'](_0x57c32c,_0xdb4c('0x2c'));_0x2b988e[_0xdb4c('0x39')]=_[_0xdb4c('0x3a')](_0x30bcc5[_0xdb4c('0x39')]);_0x2b988e['filters']=_[_0xdb4c('0x3b')](_0x2b988e[_0xdb4c('0x3c')],_0x2b988e['query']);_0x5a2028['attributes']=_[_0xdb4c('0x3b')](_0x2b988e['model'],qs['fields'](_0x30bcc5[_0xdb4c('0x39')][_0xdb4c('0x3d')]));_0x5a2028[_0xdb4c('0x3e')]=_0x5a2028[_0xdb4c('0x3e')]['length']?_0x5a2028[_0xdb4c('0x3e')]:_0x2b988e[_0xdb4c('0x3c')];if(!_0x30bcc5[_0xdb4c('0x39')][_0xdb4c('0x3f')](_0xdb4c('0x40'))){_0x5a2028[_0xdb4c('0x23')]=qs['limit'](_0x30bcc5['query']['limit']);_0x5a2028[_0xdb4c('0x22')]=qs['offset'](_0x30bcc5[_0xdb4c('0x39')][_0xdb4c('0x22')]);}_0x5a2028[_0xdb4c('0x41')]=qs[_0xdb4c('0x42')](_0x30bcc5[_0xdb4c('0x39')][_0xdb4c('0x42')]);_0x5a2028[_0xdb4c('0x43')]=qs[_0xdb4c('0x44')](_[_0xdb4c('0x45')](_0x30bcc5[_0xdb4c('0x39')],_0x2b988e[_0xdb4c('0x44')]),_0x57c32c);var _0x53ea3e=[];var _0x484783=squel[_0xdb4c('0x46')]()[_0xdb4c('0x47')]('id')[_0xdb4c('0x47')]('name')[_0xdb4c('0x47')](_0xdb4c('0x48'))[_0xdb4c('0x49')]('tools_tags');var _0x3c34c1=squel[_0xdb4c('0x46')]()[_0xdb4c('0x47')](_0xdb4c('0x4a'))[_0xdb4c('0x47')](_0xdb4c('0x4b'))[_0xdb4c('0x47')]('ui.OpenchannelInteractionId')[_0xdb4c('0x49')](_0xdb4c('0x4c'),'ui')['left_join']('users','u',_0xdb4c('0x4d'));var _0x5b32d0=squel[_0xdb4c('0x46')]()['from'](_0xdb4c('0x4e'),'i')[_0xdb4c('0x4f')]('cm_contacts','c',_0xdb4c('0x50'))[_0xdb4c('0x4f')](_0xdb4c('0x51'),'o',_0xdb4c('0x52'))['left_join'](_0xdb4c('0x53'),'a',_0xdb4c('0x54'))['left_join'](_0xdb4c('0x55'),'me',_0xdb4c('0x56'))[_0xdb4c('0x4f')](_0xdb4c('0x57'),'it',_0xdb4c('0x58'))[_0xdb4c('0x4f')](_0xdb4c('0x59'),'t','t.id\x20=\x20it.TagId');var _0x24f962=squel[_0xdb4c('0x5a')]();var _0x3df3fb=[];var _0x4f513b=squel[_0xdb4c('0x5a')]();var _0x424388;if(_0x30bcc5[_0xdb4c('0x39')][_0xdb4c('0x5b')]){_0x424388=as[_0xdb4c('0x5c')](_0x30bcc5[_0xdb4c('0x39')]['search']);var _0x2eb12c=_0x424388['sqlOperator'];for(var _0x44b651=0x0;_0x44b651<_0x424388['conditions'][_0xdb4c('0x5d')];_0x44b651++){var _0x1add95=_0x424388['conditions'][_0x44b651];var _0x45c12b='i';var _0x2580db=_[_0xdb4c('0x5e')](_0x57c32c,[_0xdb4c('0x2c'),_0x1add95['field']]);if(!_0x2580db){switch(_0x1add95['field']){case _0xdb4c('0x5f'):if(_0x1add95[_0xdb4c('0x60')]==0x1){_0x5b32d0['having']('`'+_0x1add95[_0xdb4c('0x47')]+_0xdb4c('0x61'));}else{_0x5b32d0[_0xdb4c('0x62')]('`'+_0x1add95[_0xdb4c('0x47')]+'`\x20>\x200');}break;case'Contact':if(_0x1add95[_0xdb4c('0x63')]==='$substring'){if(_0x1add95[_0xdb4c('0x60')][_0xdb4c('0x64')]('\x20')[_0xdb4c('0x5d')]>0x1){_0x24f962[_0x2eb12c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1add95[_0xdb4c('0x60')]),null);}else{var _0x2d87d8='%'+_0x1add95[_0xdb4c('0x60')]+'%';_0x24f962[_0x2eb12c](_0xdb4c('0x65'),_0x2d87d8,_0x2d87d8,_0x2d87d8);}}else{_0x2580db=_['find'](_0x57c32c,['name','ContactId']);_0x1add95[_0xdb4c('0x47')]='ContactId';_0x35d011=as['buildExpression'](_0x45c12b,_0x2580db[_0xdb4c('0x37')],_0x1add95);_0x24f962[_0x2eb12c](_0x35d011[_0xdb4c('0x66')],_0x35d011['value'][_0xdb4c('0x67')],_0x35d011['value']['end']);}break;case _0xdb4c('0x68'):var _0x1c7c4b=_0x1add95[_0xdb4c('0x60')]['split'](',')['map'](function(_0xee0539){return Number(_0xee0539);});_0x1c7c4b[_0xdb4c('0x32')](function(_0x76303f){_0x4f513b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x76303f+',%');});_0x3df3fb=_[_0xdb4c('0x69')](_0x3df3fb,_0x1c7c4b);break;case _0xdb4c('0x6a'):if(_0x1add95[_0xdb4c('0x63')]===_0xdb4c('0x6b')){_0x24f962[_0x2eb12c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1add95[_0xdb4c('0x60')]+'%',null);}else{_0x2580db=_[_0xdb4c('0x5e')](_0x57c32c,[_0xdb4c('0x2c'),_0xdb4c('0x6c')]);_0x1add95['field']=_0xdb4c('0x6c');_0x35d011=as[_0xdb4c('0x6d')](_0x45c12b,_0x2580db[_0xdb4c('0x37')],_0x1add95);_0x24f962[_0x2eb12c](_0x35d011['text'],_0x35d011[_0xdb4c('0x60')][_0xdb4c('0x67')],_0x35d011[_0xdb4c('0x60')][_0xdb4c('0x20')]);}break;case'body':_0x35d011=as[_0xdb4c('0x6d')]('me',null,_0x1add95);_0x24f962[_0x2eb12c](_0x35d011[_0xdb4c('0x66')],_0x35d011[_0xdb4c('0x60')]['start'],_0x35d011[_0xdb4c('0x60')][_0xdb4c('0x20')]);break;}}else{var _0x35d011=as[_0xdb4c('0x6d')](_0x45c12b,_0x2580db[_0xdb4c('0x37')],_0x1add95);_0x24f962[_0x2eb12c](_0x35d011[_0xdb4c('0x66')],_0x35d011[_0xdb4c('0x60')][_0xdb4c('0x67')],_0x35d011[_0xdb4c('0x60')][_0xdb4c('0x20')]);}}}else{var _0x1f3796=_(_0x30bcc5[_0xdb4c('0x39')])[_0xdb4c('0x3a')]()[_0xdb4c('0x2f')](function(_0x4ccdb8){return _[_0xdb4c('0x6e')](_0x57c32c,[_0xdb4c('0x2c'),_0x4ccdb8])?_0x4ccdb8:undefined;})[_0xdb4c('0x6f')]()[_0xdb4c('0x60')]();if(!_['isEmpty'](_0x1f3796)){_0x1f3796[_0xdb4c('0x32')](function(_0x317763){if(_0x317763===_0xdb4c('0x70')){_0x5b32d0[_0xdb4c('0x43')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xdb4c('0x71')](_0x30bcc5[_0xdb4c('0x39')][_0x317763]));}else if(_0x317763===_0xdb4c('0x72')){var _0x1e9507=JSON[_0xdb4c('0x73')](_0x30bcc5['query'][_0x317763])[_0xdb4c('0x74')];var _0x3554c7=JSON['parse'](_0x30bcc5[_0xdb4c('0x39')][_0x317763])[_0xdb4c('0x75')];_0x5b32d0[_0xdb4c('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1e9507,_0x3554c7);}else{if(_0x30bcc5[_0xdb4c('0x39')][_0x317763]===_0xdb4c('0x76')){_0x5b32d0[_0xdb4c('0x43')]('i.'+_0x317763+_0xdb4c('0x77'));}else{_0x5b32d0[_0xdb4c('0x43')]('i.'+_0x317763+_0xdb4c('0x78'),_0x30bcc5[_0xdb4c('0x39')][_0x317763]);}}});}if(_0x30bcc5[_0xdb4c('0x39')][_0xdb4c('0x79')]){if(_0x30bcc5[_0xdb4c('0x39')][_0xdb4c('0x79')]==0x1){_0x5b32d0[_0xdb4c('0x62')](_0xdb4c('0x7a'));}else{_0x5b32d0[_0xdb4c('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x30bcc5[_0xdb4c('0x39')][_0xdb4c('0x7b')]){_0x3df3fb=_[_0xdb4c('0x7c')](_0x30bcc5[_0xdb4c('0x39')]['tag'])?_0x30bcc5[_0xdb4c('0x39')]['tag']:new Array(_0x30bcc5[_0xdb4c('0x39')]['tag']);_0x3df3fb['forEach'](function(_0x51e041){_0x4f513b['or'](_0xdb4c('0x7d'),'%,'+_0x51e041+',%');});}if(_0x30bcc5['query'][_0xdb4c('0x7e')]){var _0x4cb755=_0x30bcc5[_0xdb4c('0x39')][_0xdb4c('0x7e')][_0xdb4c('0x7f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xdb4c('0x80')](_0x4cb755)){_0x24f962['or'](_0xdb4c('0x81'),_0x4cb755+'%');}else{_0x24f962['or'](_0xdb4c('0x82'),qs[_0xdb4c('0x83')](_0x4cb755))['or'](_0xdb4c('0x84'),_0x4cb755+'%')['or'](_0xdb4c('0x85'),_0x4cb755+'%');}}}_0x5b32d0[_0xdb4c('0x43')](_0x24f962);_0x5b32d0[_0xdb4c('0x86')](_0xdb4c('0x87'));var _0x57f208={'type':db['Sequelize'][_0xdb4c('0x88')][_0xdb4c('0x89')],'raw':!![]};var _0x4220d3=_0x5b32d0['clone']();_0x4220d3[_0xdb4c('0x47')](_0xdb4c('0x87'));_0x4220d3[_0xdb4c('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xdb4c('0x5f'));if(_0x5a2028[_0xdb4c('0x41')]){_0x5a2028['order']['forEach'](function(_0xbc9ed4){var _0x4affd5=_0xbc9ed4[0x0]===_0xdb4c('0x8a')?_0xbc9ed4[0x0]:'i.'+_0xbc9ed4[0x0];_0x5b32d0[_0xdb4c('0x41')](_0x4affd5,_0xbc9ed4[0x1]===_0xdb4c('0x8b')?![]:!![]);});}if(!_[_0xdb4c('0x8c')](_0x3df3fb)){_0x5b32d0[_0xdb4c('0x62')](_0x4f513b);_0x4220d3[_0xdb4c('0x43')](_0xdb4c('0x8d'),_0x3df3fb);}BPromise[_0xdb4c('0x8e')]()[_0xdb4c('0x29')](function(){if(!_0x424388){if(_0x30bcc5[_0xdb4c('0x39')][_0xdb4c('0x70')])return;_0x4220d3[_0xdb4c('0x43')](_0xdb4c('0x8f'));_0x5b32d0['where'](_0xdb4c('0x8f'));return;}if(_0x30bcc5[_0xdb4c('0x90')][_0xdb4c('0x91')]!==_0xdb4c('0x92'))return;return _0x30bcc5[_0xdb4c('0x90')][_0xdb4c('0x93')]({'attributes':['id'],'raw':!![]})[_0xdb4c('0x29')](function(_0x3fd29f){if(_[_0xdb4c('0x8c')](_0x3fd29f)){_0x4220d3[_0xdb4c('0x43')](_0xdb4c('0x94'));_0x5b32d0[_0xdb4c('0x43')](_0xdb4c('0x94'));}else{_0x4220d3['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0xdb4c('0x2f')](_0x3fd29f,'id'));_0x5b32d0[_0xdb4c('0x43')](_0xdb4c('0x95'),_['map'](_0x3fd29f,'id'));}});})[_0xdb4c('0x29')](function(){if(_0x30bcc5[_0xdb4c('0x90')]['role']===_0xdb4c('0x92')&&!_0x424388&&!_0x30bcc5[_0xdb4c('0x39')][_0xdb4c('0x70')])return[];return db[_0xdb4c('0x96')]['query'](_0x4220d3['toString'](),_0x57f208);})[_0xdb4c('0x29')](function(_0x2ae47b){_0x4c56ee['count']=_0x2ae47b[_0xdb4c('0x5d')];if(_0x4c56ee[_0xdb4c('0x97')]===0x0)return[];return db[_0xdb4c('0x96')][_0xdb4c('0x39')](_0x484783[_0xdb4c('0x98')](),_0x57f208)[_0xdb4c('0x29')](function(_0x491447){_0x53ea3e=_['keyBy'](_0x491447,'id');_0x57f208=_['merge'](_0x57f208,{'model':db[_0xdb4c('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30bcc5['query']['fields']){_0x5a2028[_0xdb4c('0x3e')][_0xdb4c('0x32')](function(_0x222056){_0x5b32d0['field']('i.'+_0x222056);});}else{_0x5b32d0[_0xdb4c('0x47')](_0xdb4c('0x99'),_0xdb4c('0x5f'));_0x5b32d0[_0xdb4c('0x47')](_0xdb4c('0x9a'),_0xdb4c('0x9b'));_0x5b32d0[_0xdb4c('0x47')](_0xdb4c('0x9c'),_0xdb4c('0x9d'));_0x5b32d0['field']('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5b32d0[_0xdb4c('0x47')](_0xdb4c('0x9e'));_0x5b32d0[_0xdb4c('0x47')](_0xdb4c('0x9f'),_0xdb4c('0xa0'));_0x5b32d0[_0xdb4c('0x47')](_0xdb4c('0xa1'),_0xdb4c('0xa2'));_0x5b32d0[_0xdb4c('0x47')](_0xdb4c('0xa3'),_0xdb4c('0xa4'));_0x5b32d0[_0xdb4c('0x47')](_0xdb4c('0xa5'),_0xdb4c('0xa6'));_0x5b32d0['field'](_0xdb4c('0xa7'),'Contact.mobile');_0x5b32d0[_0xdb4c('0x47')](_0xdb4c('0xa8'),_0xdb4c('0xa9'));_0x5b32d0[_0xdb4c('0x47')](_0xdb4c('0xaa'),_0xdb4c('0xab'));_0x5b32d0['field'](_0xdb4c('0xac'),'Owner.internal');_0x5b32d0['field'](_0xdb4c('0xad'),_0xdb4c('0x31'));}if(_0x5a2028[_0xdb4c('0x23')])_0x5b32d0[_0xdb4c('0x23')](_0x5a2028[_0xdb4c('0x23')]);if(_0x5a2028[_0xdb4c('0x22')])_0x5b32d0[_0xdb4c('0x22')](_0x5a2028[_0xdb4c('0x22')]);return db['sequelize'][_0xdb4c('0x39')](_0x5b32d0[_0xdb4c('0x98')](),_0x57f208);})[_0xdb4c('0x29')](function(_0x429660){_0x3c34c1[_0xdb4c('0x43')](_0xdb4c('0xae'),_[_0xdb4c('0x2f')](_0x429660,'id'));return db[_0xdb4c('0x96')][_0xdb4c('0x39')](_0x3c34c1[_0xdb4c('0x98')](),_0x57f208)[_0xdb4c('0x29')](function(_0x310eaf){var _0x426bb3=_[_0xdb4c('0xaf')](_0x310eaf,_0xdb4c('0xb0'));var _0xe12eb=[];_0x429660[_0xdb4c('0x32')](function(_0x2355ce){_0xe12eb[_0xdb4c('0xb1')](updateOpenchannelInteraction(_0x2355ce,_0x53ea3e,_0x426bb3));});return BPromise[_0xdb4c('0xb2')](_0xe12eb);});});})[_0xdb4c('0x29')](function(_0x224a0f){_0x4c56ee[_0xdb4c('0xb3')]=_0x224a0f;return _0x4c56ee;})['then'](respondWithFilteredResult(_0x3b7e05,_0x5a2028))[_0xdb4c('0xb4')](handleError(_0x3b7e05,null));};exports[_0xdb4c('0xb5')]=function(_0x3ba321,_0x17d7e1){var _0x26a71e={};if(_0x3ba321[_0xdb4c('0x39')][_0xdb4c('0x37')]&&_0x3ba321[_0xdb4c('0x39')]['type']===_0xdb4c('0x49')){_0x26a71e[_0xdb4c('0x49')]=_0x3ba321[_0xdb4c('0xb6')]['id'];}else{_0x26a71e['id']=_0x3ba321[_0xdb4c('0xb6')]['id'];}var _0x1e7556={'raw':![],'where':_0x26a71e},_0x30b4d7={};_0x30b4d7['model']=_[_0xdb4c('0x3a')](db[_0xdb4c('0x34')][_0xdb4c('0x35')]);_0x30b4d7[_0xdb4c('0x39')]=_['keys'](_0x3ba321['query']);_0x30b4d7[_0xdb4c('0x44')]=_['intersection'](_0x30b4d7[_0xdb4c('0x3c')],_0x30b4d7['query']);_0x1e7556[_0xdb4c('0x3e')]=_[_0xdb4c('0x3b')](_0x30b4d7['model'],qs[_0xdb4c('0x3d')](_0x3ba321[_0xdb4c('0x39')]['fields']));_0x1e7556[_0xdb4c('0x3e')]=_0x1e7556['attributes'][_0xdb4c('0x5d')]?_0x1e7556[_0xdb4c('0x3e')]:_0x30b4d7['model'];if(_0x3ba321['query']['includeAll']){_0x1e7556[_0xdb4c('0xb7')]=[{'all':!![]}];}_0x1e7556=_['merge']({},_0x1e7556,_0x3ba321[_0xdb4c('0xb8')]);return db[_0xdb4c('0x34')]['find'](_0x1e7556)[_0xdb4c('0x29')](handleEntityNotFound(_0x17d7e1,null))['then'](respondWithResult(_0x17d7e1,null))[_0xdb4c('0xb4')](handleError(_0x17d7e1,null));};exports[_0xdb4c('0xb9')]=function(_0x21e3b0,_0x22d524){return db[_0xdb4c('0x34')][_0xdb4c('0xb9')](_0x21e3b0[_0xdb4c('0xba')],{})['then'](respondWithResult(_0x22d524,0xc9))[_0xdb4c('0xb4')](handleError(_0x22d524,null));};exports[_0xdb4c('0x28')]=function(_0x306746,_0x5a42f8){if(_0x306746[_0xdb4c('0xba')]['id']){delete _0x306746[_0xdb4c('0xba')]['id'];}return db[_0xdb4c('0x34')][_0xdb4c('0x5e')]({'where':{'id':_0x306746[_0xdb4c('0xb6')]['id']}})[_0xdb4c('0x29')](handleEntityNotFound(_0x5a42f8,null))[_0xdb4c('0x29')](saveUpdates(_0x306746['body'],null))['then'](respondWithResult(_0x5a42f8,null))[_0xdb4c('0xb4')](handleError(_0x5a42f8,null));};exports[_0xdb4c('0xbb')]=function(_0x2435d1,_0xa34b50){return db[_0xdb4c('0x34')][_0xdb4c('0x5e')]({'where':{'id':_0x2435d1['params']['id']}})[_0xdb4c('0x29')](handleEntityNotFound(_0xa34b50,null))['then'](removeEntity(_0xa34b50,null))[_0xdb4c('0xb4')](handleError(_0xa34b50,null));};exports[_0xdb4c('0xbc')]=function(_0x69a515,_0xdcf2b0){return db[_0xdb4c('0x34')][_0xdb4c('0xbc')]()['then'](respondWithResult(_0xdcf2b0,null))[_0xdb4c('0xb4')](handleError(_0xdcf2b0,null));};exports[_0xdb4c('0xbd')]=function(_0x55a124,_0x1aadce,_0x5219e8){return db[_0xdb4c('0xbe')]['find']({'where':{'id':_0x55a124[_0xdb4c('0xb6')]['id']}})[_0xdb4c('0x29')](handleEntityNotFound(_0x1aadce,null))[_0xdb4c('0x29')](function(_0xecd33e){if(_0xecd33e){return _0xecd33e[_0xdb4c('0xbd')](_0x55a124[_0xdb4c('0xba')][_0xdb4c('0xbf')],_[_0xdb4c('0xc0')](_0x55a124[_0xdb4c('0xba')],[_0xdb4c('0xbf'),'id'])||{});}})[_0xdb4c('0x29')](respondWithResult(_0x1aadce,null))['catch'](handleError(_0x1aadce,null));};exports[_0xdb4c('0xc1')]=function(_0xd714b9,_0x4c1859,_0x10cb07){var _0x2a728c={'raw':![],'where':{}};var _0x331459={};var _0x2e1464={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xdb4c('0xc2')]({'where':{'id':_0xd714b9[_0xdb4c('0xb6')]['id']}})[_0xdb4c('0x29')](handleEntityNotFound(_0x4c1859,null))[_0xdb4c('0x29')](function(_0x5f0cc8){if(_0x5f0cc8){_0x331459[_0xdb4c('0x3c')]=_[_0xdb4c('0x3a')](db[_0xdb4c('0xbe')][_0xdb4c('0x35')]);_0x331459[_0xdb4c('0x39')]=_[_0xdb4c('0x3a')](_0xd714b9['query']);_0x331459[_0xdb4c('0x44')]=_[_0xdb4c('0x3b')](_0x331459[_0xdb4c('0x3c')],_0x331459[_0xdb4c('0x39')]);_0x2a728c[_0xdb4c('0x3e')]=_[_0xdb4c('0x3b')](_0x331459['model'],qs[_0xdb4c('0x3d')](_0xd714b9[_0xdb4c('0x39')][_0xdb4c('0x3d')]));_0x2a728c[_0xdb4c('0x3e')]=_0x2a728c[_0xdb4c('0x3e')]['length']?_0x2a728c[_0xdb4c('0x3e')]:_0x331459[_0xdb4c('0x3c')];if(!_0xd714b9[_0xdb4c('0x39')][_0xdb4c('0x3f')]('nolimit')){_0x2a728c[_0xdb4c('0x23')]=qs[_0xdb4c('0x23')](_0xd714b9[_0xdb4c('0x39')][_0xdb4c('0x23')]);_0x2a728c['offset']=qs[_0xdb4c('0x22')](_0xd714b9[_0xdb4c('0x39')][_0xdb4c('0x22')]);}_0x2a728c['order']=qs['sort'](_0xd714b9[_0xdb4c('0x39')][_0xdb4c('0x42')]);_0x2a728c[_0xdb4c('0x43')]=qs[_0xdb4c('0x44')](_[_0xdb4c('0x45')](_0xd714b9[_0xdb4c('0x39')],_0x331459[_0xdb4c('0x44')]));_0x2a728c['where'][_0xdb4c('0xb0')]=_0x5f0cc8['id'];if(_0xd714b9['query'][_0xdb4c('0x7e')]){_0x2a728c[_0xdb4c('0x43')]=_[_0xdb4c('0xc3')](_0x2a728c[_0xdb4c('0x43')],{'$or':_['map'](_0x2a728c[_0xdb4c('0x3e')],function(_0x36490c){var _0x3d59d0={};_0x3d59d0[_0x36490c]={'$like':'%'+_0xd714b9[_0xdb4c('0x39')][_0xdb4c('0x7e')]+'%'};return _0x3d59d0;})});}if(_0xd714b9[_0xdb4c('0x39')][_0xdb4c('0x74')]){var _0x917883=_0xd714b9[_0xdb4c('0x39')][_0xdb4c('0x74')][_0xdb4c('0x64')](',');var _0x4097ce={};_0x4097ce[_0x917883[0x0]]={'$gte':moment(_0x917883[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2a728c[_0xdb4c('0x43')]=_[_0xdb4c('0xc3')](_0x2a728c['where'],_0x4097ce);}_0x2a728c=_[_0xdb4c('0xc3')]({},_0x2a728c,_0xd714b9['options']);return db[_0xdb4c('0xbe')][_0xdb4c('0x97')]({'where':_0x2a728c[_0xdb4c('0x43')]})['then'](function(_0x249666){_0x2e1464[_0xdb4c('0x97')]=_0x249666;if(_0xd714b9[_0xdb4c('0x39')][_0xdb4c('0xc4')]){_0x2a728c[_0xdb4c('0xb7')]=[{'all':!![]}];}return db[_0xdb4c('0xbe')][_0xdb4c('0xc5')](_0x2a728c);})[_0xdb4c('0x29')](function(_0x5a41d8){_0x2e1464['rows']=_0x5a41d8;return _0x2e1464;});}})[_0xdb4c('0x29')](respondWithFilteredResult(_0x4c1859,_0x2a728c))[_0xdb4c('0xb4')](handleError(_0x4c1859,null));};exports[_0xdb4c('0xc6')]=function(_0x330bcb,_0x3dfb2e,_0x1b4410){return db[_0xdb4c('0x34')][_0xdb4c('0x5e')]({'where':{'id':_0x330bcb[_0xdb4c('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3dfb2e,null))[_0xdb4c('0x29')](function(_0x102c67){if(_0x102c67){return _0x102c67['setTags'](_0x330bcb[_0xdb4c('0xba')]['ids'],_['omit'](_0x330bcb['body'],['ids','id'])||{})['spread'](function(){return db[_0xdb4c('0x68')]['findAll']({'attributes':['id','name',_0xdb4c('0x48')],'where':{'id':_0x330bcb[_0xdb4c('0xba')][_0xdb4c('0xbf')]}});})[_0xdb4c('0x29')](function(_0x20962f){socket[_0xdb4c('0xc7')]('openchannelInteractionTags:save',{'id':Number(_0x330bcb[_0xdb4c('0xb6')]['id']),'tags':_0x20962f||[]});return{'id':Number(_0x330bcb['params']['id']),'tags':_0x20962f||[]};});}})['then'](respondWithResult(_0x3dfb2e,null))['catch'](handleError(_0x3dfb2e,null));};exports[_0xdb4c('0xc8')]=function(_0x4c333b,_0x2906ad,_0x12d708){return db[_0xdb4c('0x34')]['find']({'where':{'id':_0x4c333b[_0xdb4c('0xb6')]['id']}})[_0xdb4c('0x29')](handleEntityNotFound(_0x2906ad,null))[_0xdb4c('0x29')](function(_0x33c07c){if(_0x33c07c){return _0x33c07c[_0xdb4c('0xc8')](_0x4c333b['query'][_0xdb4c('0xbf')]);}})['then'](respondWithStatusCode(_0x2906ad,null))[_0xdb4c('0xb4')](handleError(_0x2906ad,null));};exports['download']=function(_0x2717b1,_0x3a4ee0){var _0x2abfef=moment()['unix']()[_0xdb4c('0x98')]();var _0x310b6a=path[_0xdb4c('0xc9')](config[_0xdb4c('0xca')],_0xdb4c('0xcb'),_0xdb4c('0xcc'),_0xdb4c('0xcd'));var _0x8db462=path[_0xdb4c('0xc9')](config[_0xdb4c('0xca')],_0xdb4c('0xcb'),_0xdb4c('0xcc'),_0xdb4c('0xce'));var _0x244460=path[_0xdb4c('0xc9')](_0x310b6a,_0x2abfef);var _0x17ad4d=util[_0xdb4c('0xcf')](_0xdb4c('0xd0'),_0x2717b1[_0xdb4c('0xb6')]['id'],_0x2abfef);var _0x22925b=path[_0xdb4c('0xc9')](_0x310b6a,_0x17ad4d);var _0x220886=[];_0x220886['push']({'model':db[_0xdb4c('0x6a')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x220886[_0xdb4c('0xb1')]({'model':db[_0xdb4c('0xd1')],'as':_0xdb4c('0xd2'),'attributes':['id',_0xdb4c('0xd3'),'lastName'],'raw':!![]});if(_0x2717b1[_0xdb4c('0x39')][_0xdb4c('0xce')]){_0x220886[_0xdb4c('0xb1')]({'model':db[_0xdb4c('0xd4')],'as':_0xdb4c('0xd4'),'raw':!![]});}var _0x1b6ded=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id','body',_0xdb4c('0x72'),_0xdb4c('0xd5'),_0xdb4c('0xd6'),_0xdb4c('0x79')],'include':_0x220886}];_0x1b6ded['push']({'model':db[_0xdb4c('0xd7')],'as':_0xdb4c('0xd8'),'attributes':['id',_0xdb4c('0x2c')]});_0x1b6ded['push']({'model':db['User'],'as':_0xdb4c('0xd9'),'attributes':['id',_0xdb4c('0xda')]});return db[_0xdb4c('0x34')][_0xdb4c('0x5e')]({'where':{'id':_0x2717b1[_0xdb4c('0xb6')]['id']},'include':_0x1b6ded})['then'](handleEntityNotFound(_0x3a4ee0,null))[_0xdb4c('0x29')](function(_0x1087fd){if(_0x1087fd){var _0x11d13b=_0x1087fd[_0xdb4c('0xdb')]({'plain':!![]});fs[_0xdb4c('0xdc')](_0x244460);var _0x491136={'format':'A4','border':_0xdb4c('0xdd'),'header':{'height':'40px','contents':{'first':_0xdb4c('0xde')}},'footer':{'height':_0xdb4c('0xdf'),'contents':{'default':util[_0xdb4c('0xcf')](_0xdb4c('0xe0'),util[_0xdb4c('0xcf')](_0xdb4c('0xe1'),_0xdb4c('0xe2'),_0x11d13b['id']),moment()[_0xdb4c('0xcf')](_0xdb4c('0xe3'))[_0xdb4c('0x98')]())}}};var _0xe3e7e3={'channel':_0xdb4c('0xe2'),'account':_0x11d13b[_0xdb4c('0xd8')][_0xdb4c('0x2c')],'agent':_0x11d13b[_0xdb4c('0xd9')]?_0x11d13b[_0xdb4c('0xd9')][_0xdb4c('0xda')]:_0xdb4c('0xe4'),'createdAt':moment(_0x11d13b['createdAt'])[_0xdb4c('0xcf')](_0xdb4c('0xe5'))[_0xdb4c('0x98')](),'closedAt':_0x11d13b[_0xdb4c('0xe6')]?moment(_0x11d13b['closedAt'])[_0xdb4c('0xcf')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdb4c('0x98')]():'','disposition':_0x11d13b[_0xdb4c('0xe7')],'visibility':_0x11d13b[_0xdb4c('0xe8')]?_0xdb4c('0xe9'):_0xdb4c('0xea'),'messages':_(_0x11d13b[_0xdb4c('0xeb')])[_0xdb4c('0x7e')]({'secret':![]})[_0xdb4c('0x2f')](function(_0x5834f1){if(_0x5834f1['Attachment']){var _0x4d173b=path[_0xdb4c('0xc9')](_0x8db462,_0x5834f1['Attachment'][_0xdb4c('0xec')]);if(fs['existsSync'](_0x4d173b)){fs[_0xdb4c('0xed')](_0x4d173b)[_0xdb4c('0xee')](fs[_0xdb4c('0xef')](path[_0xdb4c('0xc9')](_0x244460,_0x5834f1['Attachment'][_0xdb4c('0xec')])));}}return{'date':moment(_0x5834f1[_0xdb4c('0x72')])['format'](_0xdb4c('0xe5'))[_0xdb4c('0x98')](),'sender':_0x5834f1[_0xdb4c('0xd5')]===_0xdb4c('0xf0')?_0x5834f1[_0xdb4c('0x6a')]?_0x5834f1[_0xdb4c('0x6a')][_0xdb4c('0xda')]:'System':_0x5834f1[_0xdb4c('0xd2')][_0xdb4c('0xd3')]+(_0x5834f1[_0xdb4c('0xd2')][_0xdb4c('0xf1')]?'\x20'+_0x5834f1[_0xdb4c('0xd2')]['lastName']:''),'body':_0x5834f1[_0xdb4c('0xd4')]?_0x5834f1['Attachment'][_0xdb4c('0xec')]:_0x5834f1[_0xdb4c('0xba')],'direction':_0x5834f1[_0xdb4c('0xd5')]===_0xdb4c('0xf0')?'A':'C','secret':_0x5834f1[_0xdb4c('0xd6')],'read':_0x5834f1[_0xdb4c('0x79')],'attachment':_0x5834f1[_0xdb4c('0xd4')]};})[_0xdb4c('0x60')]()};return ejs['renderFile'](path['join'](config[_0xdb4c('0xca')],_0xdb4c('0xcb'),_0xdb4c('0xf2'),'downloadInteraction.html'),{'interaction':_0xe3e7e3})[_0xdb4c('0x29')](function(_0x30bacc){return new BPromise(function(_0x57f621,_0x49a192){pdf[_0xdb4c('0xb9')](_0x30bacc,_0x491136)['toFile'](path[_0xdb4c('0xc9')](_0x244460,_0xdb4c('0xf3')+_0x11d13b['id']+'-'+_0x2abfef+_0xdb4c('0xf4')),function(_0x3f8400,_0x5f095b){if(_0x3f8400)return _0x49a192(_0x3f8400);_0x57f621(_0x5f095b);});});})['then'](function(){return new BPromise(function(_0x1fa4fb,_0x5b0b46){zipdir(_0x244460,{'saveTo':_0x22925b},function(_0x24dc59,_0x4523ce){if(_0x24dc59)return _0x5b0b46(_0x24dc59);return _0x1fa4fb(_0x4523ce);});})[_0xdb4c('0x29')](function(){return new BPromise(function(_0x3c57f7,_0x1818b4){rimraf(_0x244460,function(_0x339aeb){if(_0x339aeb)_0x1818b4(_0x339aeb);return _0x3c57f7();});});})[_0xdb4c('0x29')](function(){return _0x3a4ee0[_0xdb4c('0xf5')](_0x22925b,_0x17ad4d,function(_0x5977ca){if(_0x5977ca){console[_0xdb4c('0xf6')](_0xdb4c('0xf7'),_0x5977ca);}else{fs[_0xdb4c('0xf8')](_0x22925b);}});});});}else{return _0x3a4ee0[_0xdb4c('0x1f')](0xc8);}})[_0xdb4c('0xb4')](handleError(_0x3a4ee0,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index a443b22..2349a34 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 _0x08a2=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0xd15a1b,_0x3d6cbe){var _0x2ab062=function(_0x2b09bf){while(--_0x2b09bf){_0xd15a1b['push'](_0xd15a1b['shift']());}};_0x2ab062(++_0x3d6cbe);}(_0x08a2,0x17e));var _0x208a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x08a2[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x208a('0x0'))['db'][_0x208a('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x208a('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x208a('0x3')](0x0);var events={'afterCreate':_0x208a('0x4'),'afterUpdate':_0x208a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x233159){return function(_0x8ed456,_0x23911c,_0x565a9d){_0x8ed456[_0x208a('0x6')]({'attributes':['id'],'raw':!![]})[_0x208a('0x7')](function(_0x1fc385){_0x8ed456[_0x208a('0x8')]('Users',_0x1fc385[_0x208a('0x9')](function(_0x1d5186){return{'id':_0x1d5186['id']};}));return OpenchannelMessage[_0x208a('0xa')]({'where':{'OpenchannelInteractionId':_0x8ed456['id'],'direction':'in','read':![]},'raw':!![]});})[_0x208a('0x7')](function(_0x347deb){_0x8ed456[_0x208a('0x8')](_0x208a('0xb'),_0x347deb[_0x208a('0xc')]);OpenchannelInteractionEvents[_0x208a('0xd')](_0x233159+':'+_0x8ed456['id'],_0x8ed456);OpenchannelInteractionEvents[_0x208a('0xd')](_0x233159,_0x8ed456);_0x565a9d(null);})[_0x208a('0xe')](_0x565a9d(null));};}for(var e in events){if(events[_0x208a('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x208a('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xea0e=['Users','map','findAll','length','emit','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue'];(function(_0x3cf3ea,_0x39ea7e){var _0x4cd6c0=function(_0x4f1aeb){while(--_0x4f1aeb){_0x3cf3ea['push'](_0x3cf3ea['shift']());}};_0x4cd6c0(++_0x39ea7e);}(_0xea0e,0x17d));var _0xeea0=function(_0x1056fc,_0x2f8445){_0x1056fc=_0x1056fc-0x0;var _0x9d08ef=_0xea0e[_0x1056fc];return _0x9d08ef;};'use strict';var EventEmitter=require(_0xeea0('0x0'));var OpenchannelInteraction=require(_0xeea0('0x1'))['db'][_0xeea0('0x2')];var OpenchannelMessage=require(_0xeea0('0x1'))['db'][_0xeea0('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xeea0('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xeea0('0x5'),'afterDestroy':_0xeea0('0x6')};function emitEvent(_0x12ed6c){return function(_0xffe346,_0x30c9fc,_0x36ddf5){_0xffe346[_0xeea0('0x7')]({'attributes':['id'],'raw':!![]})[_0xeea0('0x8')](function(_0x3f61d6){_0xffe346[_0xeea0('0x9')](_0xeea0('0xa'),_0x3f61d6[_0xeea0('0xb')](function(_0x4cc5a0){return{'id':_0x4cc5a0['id']};}));return OpenchannelMessage[_0xeea0('0xc')]({'where':{'OpenchannelInteractionId':_0xffe346['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5aa94e){_0xffe346['setDataValue']('unreadMessages',_0x5aa94e[_0xeea0('0xd')]);OpenchannelInteractionEvents['emit'](_0x12ed6c+':'+_0xffe346['id'],_0xffe346);OpenchannelInteractionEvents[_0xeea0('0xe')](_0x12ed6c,_0xffe346);_0x36ddf5(null);})['catch'](_0x36ddf5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xeea0('0xf')](e,emitEvent(event));}}module[_0xeea0('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 68ced71..3d5090f 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 _0x02a7=['define','OpenchannelInteraction','openchannel_interactions','changed','closedAt','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x02a7,0x7a));var _0x702a=function(_0x2261b0,_0x2155e6){_0x2261b0=_0x2261b0-0x0;var _0x49b3b4=_0x02a7[_0x2261b0];return _0x49b3b4;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rp=require(_0x702a('0x3'));var fs=require('fs');var path=require(_0x702a('0x4'));var rimraf=require(_0x702a('0x5'));var config=require(_0x702a('0x6'));var attributes=require(_0x702a('0x7'));module['exports']=function(_0x1bcfe5,_0x5b7d8c){return _0x1bcfe5[_0x702a('0x8')](_0x702a('0x9'),attributes,{'tableName':_0x702a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x161dee,_0x430cf3,_0x20c009){if(_0x161dee[_0x702a('0xb')]('closed')){_0x161dee[_0x702a('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x20c009(null,_0x161dee);}}});}; \ No newline at end of file +var _0x29d4=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','changed','closed','format'];(function(_0xab3853,_0x8cd940){var _0x13302c=function(_0xcf5c5a){while(--_0xcf5c5a){_0xab3853['push'](_0xab3853['shift']());}};_0x13302c(++_0x8cd940);}(_0x29d4,0x1a1));var _0x429d=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x29d4[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var logger=require(_0x429d('0x1'))(_0x429d('0x2'));var moment=require(_0x429d('0x3'));var BPromise=require(_0x429d('0x4'));var rp=require(_0x429d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var attributes=require(_0x429d('0x8'));module[_0x429d('0x9')]=function(_0x1c55aa,_0xa71445){return _0x1c55aa[_0x429d('0xa')](_0x429d('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9fc337,_0x47cb29,_0x471129){if(_0x9fc337[_0x429d('0xc')](_0x429d('0xd'))){_0x9fc337['closedAt']=moment()[_0x429d('0xe')](_0x429d('0xf'));}_0x471129(null,_0x9fc337);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 4b66337..f5ca8b8 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 _0xb7d8=['AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','spread'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xb7d8,0x7c));var _0x8b7d=function(_0x2f6f17,_0x4a5c08){_0x2f6f17=_0x2f6f17-0x0;var _0x5ea888=_0xb7d8[_0x2f6f17];return _0x5ea888;};'use strict';var _=require(_0x8b7d('0x0'));var util=require(_0x8b7d('0x1'));var moment=require(_0x8b7d('0x2'));var BPromise=require('bluebird');var rs=require(_0x8b7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b7d('0x4'))['db'];var utils=require(_0x8b7d('0x5'));var logger=require(_0x8b7d('0x6'))(_0x8b7d('0x7'));var config=require('../../config/environment');var jayson=require(_0x8b7d('0x8'));var client=jayson[_0x8b7d('0x9')][_0x8b7d('0xa')]({'port':0x232a});config['redis']=_[_0x8b7d('0xb')](config[_0x8b7d('0xc')],{'host':_0x8b7d('0xd'),'port':0x18eb});var socket=require(_0x8b7d('0xe'))(new Redis(config[_0x8b7d('0xc')]));require(_0x8b7d('0xf'))[_0x8b7d('0x10')](socket);function respondWithRpcPromise(_0x2046ac,_0x50b875,_0x48c624){return new BPromise(function(_0x35912f,_0xcf9791){return client[_0x8b7d('0x11')](_0x2046ac,_0x48c624)[_0x8b7d('0x12')](function(_0x16310b){logger[_0x8b7d('0x13')](_0x8b7d('0x14'),_0x50b875,'request\x20sent');logger[_0x8b7d('0x15')](_0x8b7d('0x16'),_0x50b875,'request\x20sent',JSON[_0x8b7d('0x17')](_0x16310b));if(_0x16310b[_0x8b7d('0x18')]){if(_0x16310b[_0x8b7d('0x18')][_0x8b7d('0x19')]===0x1f4){logger[_0x8b7d('0x18')](_0x8b7d('0x14'),_0x50b875,_0x16310b[_0x8b7d('0x18')]['message']);return _0xcf9791(_0x16310b[_0x8b7d('0x18')]['message']);}logger[_0x8b7d('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x50b875,_0x16310b['error'][_0x8b7d('0x1a')]);return _0x35912f(_0x16310b[_0x8b7d('0x18')]['message']);}else{logger[_0x8b7d('0x13')](_0x8b7d('0x14'),_0x50b875,'request\x20sent');_0x35912f(_0x16310b[_0x8b7d('0x1b')][_0x8b7d('0x1a')]);}})['catch'](function(_0x52a1ed){logger[_0x8b7d('0x18')](_0x8b7d('0x14'),_0x50b875,_0x52a1ed);_0xcf9791(_0x52a1ed);});});}exports[_0x8b7d('0x1c')]=function(_0xc1e611){var _0x3127c7=this;return new Promise(function(_0x74b2e8,_0x5a5cf3){return db[_0x8b7d('0x1d')][_0x8b7d('0x1e')](_0xc1e611[_0x8b7d('0x1f')],{'raw':_0xc1e611[_0x8b7d('0x20')]?_0xc1e611[_0x8b7d('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc1e611[_0x8b7d('0x20')]?_0xc1e611['options'][_0x8b7d('0x21')]||null:null,'attributes':_0xc1e611[_0x8b7d('0x20')]?_0xc1e611[_0x8b7d('0x20')]['attributes']||null:null,'limit':_0xc1e611['options']?_0xc1e611['options']['limit']||null:null})['then'](function(_0x2aac45){logger['info'](_0x8b7d('0x1c'),_0xc1e611);logger[_0x8b7d('0x15')]('UpdateOpenchannelInteraction',_0xc1e611,JSON[_0x8b7d('0x17')](_0x2aac45));_0x74b2e8(_0x2aac45);})[_0x8b7d('0x22')](function(_0xde1b1e){logger[_0x8b7d('0x18')](_0x8b7d('0x1c'),_0xde1b1e[_0x8b7d('0x1a')],_0xc1e611);_0x5a5cf3(_0x3127c7[_0x8b7d('0x18')](0x1f4,_0xde1b1e['message']));});});};exports[_0x8b7d('0x23')]=function(_0xc0d3a3){return new Promise(function(_0x16b061,_0xbfb691){return db[_0x8b7d('0x1d')][_0x8b7d('0x24')]({'where':_0xc0d3a3['options']?_0xc0d3a3[_0x8b7d('0x20')][_0x8b7d('0x21')]||null:null})[_0x8b7d('0x12')](function(_0x4548e7){if(_0x4548e7){return _0x4548e7[_0x8b7d('0x25')](_0xc0d3a3[_0x8b7d('0x1f')][_0x8b7d('0x26')],_['omit'](_0xc0d3a3[_0x8b7d('0x1f')],[_0x8b7d('0x26'),'id'])||{});}})[_0x8b7d('0x27')](function(_0x138e02){logger[_0x8b7d('0x13')](_0x8b7d('0x28'),_0xc0d3a3);logger[_0x8b7d('0x15')](_0x8b7d('0x28'),_0xc0d3a3,JSON['stringify'](_0x138e02));_0x16b061(_0x138e02);})['catch'](function(_0x47bb62){logger['error'](_0x8b7d('0x28'),_0x47bb62['message'],_0xc0d3a3);_0xbfb691(_this[_0x8b7d('0x18')](0x1f4,_0x47bb62[_0x8b7d('0x1a')]));});});}; \ No newline at end of file +var _0x3f4e=['where','attributes','limit','then','info','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./openchannelInteraction.socket','register','request','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','update','body','options','raw'];(function(_0x3f30bb,_0x147ea7){var _0x370835=function(_0x459ff6){while(--_0x459ff6){_0x3f30bb['push'](_0x3f30bb['shift']());}};_0x370835(++_0x147ea7);}(_0x3f4e,0xb6));var _0xe3f4=function(_0x325e1e,_0x903510){_0x325e1e=_0x325e1e-0x0;var _0x33aa0f=_0x3f4e[_0x325e1e];return _0x33aa0f;};'use strict';var _=require(_0xe3f4('0x0'));var util=require('util');var moment=require(_0xe3f4('0x1'));var BPromise=require(_0xe3f4('0x2'));var rs=require(_0xe3f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3f4('0x4'))['db'];var utils=require(_0xe3f4('0x5'));var logger=require('../../config/logger')(_0xe3f4('0x6'));var config=require(_0xe3f4('0x7'));var jayson=require(_0xe3f4('0x8'));var client=jayson[_0xe3f4('0x9')][_0xe3f4('0xa')]({'port':0x232a});config[_0xe3f4('0xb')]=_['defaults'](config[_0xe3f4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe3f4('0xc'))(new Redis(config[_0xe3f4('0xb')]));require(_0xe3f4('0xd'))[_0xe3f4('0xe')](socket);function respondWithRpcPromise(_0x4b5044,_0x27e450,_0xed22a9){return new BPromise(function(_0x35b538,_0xba4c8e){return client[_0xe3f4('0xf')](_0x4b5044,_0xed22a9)['then'](function(_0x55bd4c){logger['info'](_0xe3f4('0x10'),_0x27e450,'request\x20sent');logger[_0xe3f4('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x27e450,_0xe3f4('0x12'),JSON[_0xe3f4('0x13')](_0x55bd4c));if(_0x55bd4c[_0xe3f4('0x14')]){if(_0x55bd4c['error'][_0xe3f4('0x15')]===0x1f4){logger['error'](_0xe3f4('0x10'),_0x27e450,_0x55bd4c['error'][_0xe3f4('0x16')]);return _0xba4c8e(_0x55bd4c['error'][_0xe3f4('0x16')]);}logger['error'](_0xe3f4('0x10'),_0x27e450,_0x55bd4c[_0xe3f4('0x14')][_0xe3f4('0x16')]);return _0x35b538(_0x55bd4c[_0xe3f4('0x14')]['message']);}else{logger['info'](_0xe3f4('0x10'),_0x27e450,'request\x20sent');_0x35b538(_0x55bd4c[_0xe3f4('0x17')][_0xe3f4('0x16')]);}})['catch'](function(_0x168dd9){logger[_0xe3f4('0x14')](_0xe3f4('0x10'),_0x27e450,_0x168dd9);_0xba4c8e(_0x168dd9);});});}exports['UpdateOpenchannelInteraction']=function(_0x5442bd){var _0x2b5453=this;return new Promise(function(_0x3e6840,_0x570ad6){return db['OpenchannelInteraction'][_0xe3f4('0x18')](_0x5442bd[_0xe3f4('0x19')],{'raw':_0x5442bd['options']?_0x5442bd[_0xe3f4('0x1a')][_0xe3f4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5442bd[_0xe3f4('0x1a')]?_0x5442bd[_0xe3f4('0x1a')][_0xe3f4('0x1c')]||null:null,'attributes':_0x5442bd[_0xe3f4('0x1a')]?_0x5442bd[_0xe3f4('0x1a')][_0xe3f4('0x1d')]||null:null,'limit':_0x5442bd[_0xe3f4('0x1a')]?_0x5442bd['options'][_0xe3f4('0x1e')]||null:null})[_0xe3f4('0x1f')](function(_0x3d1425){logger[_0xe3f4('0x20')]('UpdateOpenchannelInteraction',_0x5442bd);logger[_0xe3f4('0x11')](_0xe3f4('0x21'),_0x5442bd,JSON[_0xe3f4('0x13')](_0x3d1425));_0x3e6840(_0x3d1425);})[_0xe3f4('0x22')](function(_0x2812c9){logger[_0xe3f4('0x14')](_0xe3f4('0x21'),_0x2812c9[_0xe3f4('0x16')],_0x5442bd);_0x570ad6(_0x2b5453['error'](0x1f4,_0x2812c9['message']));});});};exports[_0xe3f4('0x23')]=function(_0x1e5e3c){return new Promise(function(_0x4f75c4,_0x25d75a){return db[_0xe3f4('0x24')][_0xe3f4('0x25')]({'where':_0x1e5e3c[_0xe3f4('0x1a')]?_0x1e5e3c[_0xe3f4('0x1a')][_0xe3f4('0x1c')]||null:null})[_0xe3f4('0x1f')](function(_0x39ce0c){if(_0x39ce0c){return _0x39ce0c['addTags'](_0x1e5e3c[_0xe3f4('0x19')][_0xe3f4('0x26')],_[_0xe3f4('0x27')](_0x1e5e3c[_0xe3f4('0x19')],[_0xe3f4('0x26'),'id'])||{});}})[_0xe3f4('0x28')](function(_0x4ba324){logger[_0xe3f4('0x20')](_0xe3f4('0x29'),_0x1e5e3c);logger[_0xe3f4('0x11')](_0xe3f4('0x29'),_0x1e5e3c,JSON[_0xe3f4('0x13')](_0x4ba324));_0x4f75c4(_0x4ba324);})[_0xe3f4('0x22')](function(_0x56f711){logger['error'](_0xe3f4('0x29'),_0x56f711[_0xe3f4('0x16')],_0x1e5e3c);_0x25d75a(_this[_0xe3f4('0x14')](0x1f4,_0x56f711[_0xe3f4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 4c5fd36..0b0d0cd 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 _0x1b04=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','update'];(function(_0x3c0edc,_0xeccbdd){var _0xd7fd1b=function(_0x18e128){while(--_0x18e128){_0x3c0edc['push'](_0x3c0edc['shift']());}};_0xd7fd1b(++_0xeccbdd);}(_0x1b04,0x169));var _0x41b0=function(_0x891c55,_0x233fe8){_0x891c55=_0x891c55-0x0;var _0x260823=_0x1b04[_0x891c55];return _0x260823;};'use strict';var OpenchannelInteractionEvents=require(_0x41b0('0x0'));var events=[_0x41b0('0x1'),'remove',_0x41b0('0x2')];function createListener(_0x34688e,_0x411cc4){return function(_0x114f69){_0x411cc4['emit'](_0x34688e,_0x114f69);};}function removeListener(_0x5b6270,_0x396ca4){return function(){OpenchannelInteractionEvents[_0x41b0('0x3')](_0x5b6270,_0x396ca4);};}exports[_0x41b0('0x4')]=function(_0x3ceafd){for(var _0x2f1dbe=0x0,_0x4789fe=events[_0x41b0('0x5')];_0x2f1dbe<_0x4789fe;_0x2f1dbe++){var _0x3a92d7=events[_0x2f1dbe];var _0x2527f9=createListener(_0x41b0('0x6')+_0x3a92d7,_0x3ceafd);OpenchannelInteractionEvents['on'](_0x3a92d7,_0x2527f9);}}; \ No newline at end of file +var _0xee2d=['register','openchannelInteraction:','./openchannelInteraction.events','save','remove','emit','removeListener'];(function(_0x3000e,_0x55054b){var _0x1de05a=function(_0x2a6c6e){while(--_0x2a6c6e){_0x3000e['push'](_0x3000e['shift']());}};_0x1de05a(++_0x55054b);}(_0xee2d,0x19f));var _0xdee2=function(_0x4ee6eb,_0x2b0e9b){_0x4ee6eb=_0x4ee6eb-0x0;var _0x5aeefe=_0xee2d[_0x4ee6eb];return _0x5aeefe;};'use strict';var OpenchannelInteractionEvents=require(_0xdee2('0x0'));var events=[_0xdee2('0x1'),_0xdee2('0x2'),'update'];function createListener(_0x2eb9eb,_0x73376d){return function(_0x24a4c3){_0x73376d[_0xdee2('0x3')](_0x2eb9eb,_0x24a4c3);};}function removeListener(_0x4ffd63,_0xcb19f2){return function(){OpenchannelInteractionEvents[_0xdee2('0x4')](_0x4ffd63,_0xcb19f2);};}exports[_0xdee2('0x5')]=function(_0x420a7d){for(var _0x4f3388=0x0,_0x776f37=events['length'];_0x4f3388<_0x776f37;_0x4f3388++){var _0x3e34ef=events[_0x4f3388];var _0x396353=createListener(_0xdee2('0x6')+_0x3e34ef,_0x420a7d);OpenchannelInteractionEvents['on'](_0x3e34ef,_0x396353);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 413ba13..7b7868f 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 _0x5ff4=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x5ff4,0x14e));var _0x45ff=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x5ff4[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0x45ff('0x0'));var util=require(_0x45ff('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x45ff('0x2')]();var auth=require(_0x45ff('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x45ff('0x4'));var controller=require('./openchannelMessage.controller');router[_0x45ff('0x5')]('/',auth[_0x45ff('0x6')](),controller['index']);router[_0x45ff('0x5')]('/describe',auth[_0x45ff('0x6')](),controller['describe']);router[_0x45ff('0x5')](_0x45ff('0x7'),auth[_0x45ff('0x6')](),controller['show']);router[_0x45ff('0x8')]('/',auth[_0x45ff('0x6')](),interaction[_0x45ff('0x9')](_0x45ff('0xa'),'openchannelmessage:create'),controller[_0x45ff('0xb')]);router[_0x45ff('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x45ff('0xd')]);router[_0x45ff('0xc')](_0x45ff('0xe'),auth['isAuthenticated'](),controller[_0x45ff('0xf')]);router[_0x45ff('0xc')](_0x45ff('0x10'),auth['isAuthenticated'](),controller[_0x45ff('0x11')]);router[_0x45ff('0x12')](_0x45ff('0x7'),auth['isAuthenticated'](),controller[_0x45ff('0x13')]);module[_0x45ff('0x14')]=router; \ No newline at end of file +var _0x389a=['../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','put','update','/:id/accept','accept','reject','delete','multer','path','connect-timeout','express','Router'];(function(_0x50dd63,_0x4861ab){var _0x69ce5a=function(_0x2c3e1c){while(--_0x2c3e1c){_0x50dd63['push'](_0x50dd63['shift']());}};_0x69ce5a(++_0x4861ab);}(_0x389a,0x163));var _0xa389=function(_0x5d0395,_0x54230a){_0x5d0395=_0x5d0395-0x0;var _0x1338de=_0x389a[_0x5d0395];return _0x1338de;};'use strict';var multer=require(_0xa389('0x0'));var util=require('util');var path=require(_0xa389('0x1'));var timeout=require(_0xa389('0x2'));var express=require(_0xa389('0x3'));var router=express[_0xa389('0x4')]();var auth=require(_0xa389('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa389('0x6'));var controller=require('./openchannelMessage.controller');router[_0xa389('0x7')]('/',auth[_0xa389('0x8')](),controller['index']);router[_0xa389('0x7')](_0xa389('0x9'),auth['isAuthenticated'](),controller[_0xa389('0xa')]);router['get'](_0xa389('0xb'),auth[_0xa389('0x8')](),controller[_0xa389('0xc')]);router[_0xa389('0xd')]('/',auth[_0xa389('0x8')](),interaction[_0xa389('0xe')](_0xa389('0xf'),_0xa389('0x10')),controller[_0xa389('0x11')]);router[_0xa389('0x12')](_0xa389('0xb'),auth['isAuthenticated'](),controller[_0xa389('0x13')]);router['put'](_0xa389('0x14'),auth[_0xa389('0x8')](),controller[_0xa389('0x15')]);router['put']('/:id/reject',auth[_0xa389('0x8')](),controller[_0xa389('0x16')]);router[_0xa389('0x17')](_0xa389('0xb'),auth[_0xa389('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 9460a4f..32d8e21 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 _0xd744=['out','DATE','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x27052d,_0x42f7fe){var _0x552681=function(_0x37c597){while(--_0x37c597){_0x27052d['push'](_0x27052d['shift']());}};_0x552681(++_0x42f7fe);}(_0xd744,0x1e6));var _0x4d74=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd744[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x4d74('0x0')]={'body':{'type':Sequelize[_0x4d74('0x1')](_0x4d74('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4d74('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4d74('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4d74('0x4')),'defaultValue':_0x4d74('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4d74('0x5')]},'providerName':{'type':Sequelize[_0x4d74('0x6')]},'providerResponse':{'type':Sequelize[_0x4d74('0x1')]}}; \ No newline at end of file +var _0x964d=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x964d,0x190));var _0xd964=function(_0xcf8c3f,_0x17d30c){_0xcf8c3f=_0xcf8c3f-0x0;var _0x39f030=_0x964d[_0xcf8c3f];return _0x39f030;};'use strict';var Sequelize=require(_0xd964('0x0'));module[_0xd964('0x1')]={'body':{'type':Sequelize[_0xd964('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xd964('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd964('0x4')]('in',_0xd964('0x5')),'defaultValue':_0xd964('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd964('0x6')]},'providerName':{'type':Sequelize[_0xd964('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index d60a817..7dbdb58 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 _0x0734=['register','jayson/promise','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','destroy','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','length','include','create','body','find','params','describe','../../config/logger','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','channel','EventManager','acceptmessage','reject','openchannel','role','RejectMessage','rejectMessage','SIP/%s','event','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelMessage.socket'];(function(_0x4429d0,_0x209ae7){var _0x2c7403=function(_0x5f2342){while(--_0x5f2342){_0x4429d0['push'](_0x4429d0['shift']());}};_0x2c7403(++_0x209ae7);}(_0x0734,0xd4));var _0x4073=function(_0x6308f7,_0x9cfa98){_0x6308f7=_0x6308f7-0x0;var _0x4c2e6a=_0x0734[_0x6308f7];return _0x4c2e6a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4073('0x0'));var rp=require(_0x4073('0x1'));var moment=require(_0x4073('0x2'));var BPromise=require(_0x4073('0x3'));var Mustache=require(_0x4073('0x4'));var util=require('util');var path=require(_0x4073('0x5'));var sox=require('sox');var csv=require(_0x4073('0x6'));var ejs=require(_0x4073('0x7'));var fs=require('fs');var _=require(_0x4073('0x8'));var squel=require('squel');var crypto=require(_0x4073('0x9'));var jsforce=require(_0x4073('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4073('0x6'));var querystring=require(_0x4073('0xb'));var Papa=require(_0x4073('0xc'));var Redis=require(_0x4073('0xd'));var authService=require(_0x4073('0xe'));var qs=require(_0x4073('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4073('0x10'));var utils=require(_0x4073('0x11'));var config=require(_0x4073('0x12'));var licenseUtil=require(_0x4073('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x4073('0x14')],{'host':_0x4073('0x15'),'port':0x18eb});var socket=require(_0x4073('0x16'))(new Redis(config[_0x4073('0x14')]));require(_0x4073('0x17'))[_0x4073('0x18')](socket);var jayson=require(_0x4073('0x19'));var client=jayson['client'][_0x4073('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0x4073('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4df4f5,_0x14faf7,_0x49901d,_0x2900f0){return new BPromise(function(_0x1d0017,_0x47a86d){var _0x405576=_0x2900f0||client;return _0x405576[_0x4073('0x1b')](_0x4df4f5,_0x49901d)[_0x4073('0x1c')](function(_0x53132a){logger[_0x4073('0x1d')](_0x4073('0x1e'),_0x14faf7,_0x4073('0x1f'));logger[_0x4073('0x20')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x14faf7,'request\x20sent',JSON[_0x4073('0x21')](_0x53132a));if(_0x53132a[_0x4073('0x22')]){if(_0x53132a[_0x4073('0x22')][_0x4073('0x23')]===0x1f4){logger[_0x4073('0x22')](_0x4073('0x1e'),_0x14faf7,_0x53132a[_0x4073('0x22')][_0x4073('0x24')]);return _0x47a86d(_0x53132a[_0x4073('0x22')][_0x4073('0x24')]);}logger[_0x4073('0x22')](_0x4073('0x1e'),_0x14faf7,_0x53132a[_0x4073('0x22')][_0x4073('0x24')]);return _0x1d0017(_0x53132a[_0x4073('0x22')][_0x4073('0x24')]);}else{logger[_0x4073('0x1d')](_0x4073('0x1e'),_0x14faf7,_0x4073('0x1f'));_0x1d0017(_0x53132a[_0x4073('0x25')][_0x4073('0x24')]);}})['catch'](function(_0x76d39d){logger[_0x4073('0x22')](_0x4073('0x1e'),_0x14faf7,_0x76d39d);_0x47a86d(_0x76d39d);});});}function respondWithStatusCode(_0x3ece7a,_0x3e67cf){_0x3e67cf=_0x3e67cf||0xcc;return function(_0xb5671f){if(_0xb5671f){return _0x3ece7a[_0x4073('0x26')](_0x3e67cf);}return _0x3ece7a[_0x4073('0x27')](_0x3e67cf)[_0x4073('0x28')]();};}function respondWithResult(_0x1caae4,_0x3faf13){_0x3faf13=_0x3faf13||0xc8;return function(_0x1ccef8){if(_0x1ccef8){return _0x1caae4[_0x4073('0x27')](_0x3faf13)[_0x4073('0x29')](_0x1ccef8);}};}function respondWithFilteredResult(_0x5b532f,_0x14b172){return function(_0x2202ed){if(_0x2202ed){var _0x4277e0=_0x2202ed[_0x4073('0x2a')],_0x4171cc=_0x14b172[_0x4073('0x2b')],_0x3ffc4f=_0x14b172[_0x4073('0x2b')]+_0x14b172[_0x4073('0x2c')],_0x59fb15;if(_0x3ffc4f>=_0x4277e0){_0x3ffc4f=_0x4277e0;_0x59fb15=0xc8;}else{_0x59fb15=0xce;}_0x5b532f[_0x4073('0x27')](_0x59fb15);return _0x5b532f[_0x4073('0x2d')](_0x4073('0x2e'),_0x4171cc+'-'+_0x3ffc4f+'/'+_0x4277e0)[_0x4073('0x29')](_0x2202ed);}return null;};}function patchUpdates(_0x26f255){return function(_0x102025){try{jsonpatch['apply'](_0x102025,_0x26f255,!![]);}catch(_0xd2fdb9){return BPromise['reject'](_0xd2fdb9);}return _0x102025['save']();};}function saveUpdates(_0x36d16a,_0x1d50fd){return function(_0xb31467){if(_0xb31467){return _0xb31467[_0x4073('0x2f')](_0x36d16a)['then'](function(_0x364a8a){return _0x364a8a;});}return null;};}function removeEntity(_0xda8bea,_0x5cc7a1){return function(_0x4825c1){if(_0x4825c1){return _0x4825c1[_0x4073('0x30')]()[_0x4073('0x1c')](function(){_0xda8bea['status'](0xcc)[_0x4073('0x28')]();});}};}function handleEntityNotFound(_0x57bf2e,_0x29dd0d){return function(_0x52b20e){if(!_0x52b20e){_0x57bf2e[_0x4073('0x26')](0x194);}return _0x52b20e;};}function handleError(_0x4b3ef7,_0x496f5f){_0x496f5f=_0x496f5f||0x1f4;return function(_0x269d57){logger[_0x4073('0x22')](_0x269d57[_0x4073('0x31')]);if(_0x269d57[_0x4073('0x32')]){delete _0x269d57['name'];}_0x4b3ef7['status'](_0x496f5f)['send'](_0x269d57);};}exports[_0x4073('0x33')]=function(_0x12827c,_0x4622f2){var _0x4bff6d={},_0x35832b={},_0xd7772a={'count':0x0,'rows':[]};var _0x2ec147=_[_0x4073('0x34')](db[_0x4073('0x35')][_0x4073('0x36')],function(_0x192c3d){return{'name':_0x192c3d[_0x4073('0x37')],'type':_0x192c3d[_0x4073('0x38')][_0x4073('0x39')]};});_0x35832b[_0x4073('0x3a')]=_[_0x4073('0x34')](_0x2ec147,_0x4073('0x32'));_0x35832b[_0x4073('0x3b')]=_[_0x4073('0x3c')](_0x12827c[_0x4073('0x3b')]);_0x35832b[_0x4073('0x3d')]=_[_0x4073('0x3e')](_0x35832b['model'],_0x35832b[_0x4073('0x3b')]);_0x4bff6d['attributes']=_['intersection'](_0x35832b[_0x4073('0x3a')],qs[_0x4073('0x3f')](_0x12827c[_0x4073('0x3b')][_0x4073('0x3f')]));_0x4bff6d[_0x4073('0x40')]=_0x4bff6d['attributes']['length']?_0x4bff6d[_0x4073('0x40')]:_0x35832b[_0x4073('0x3a')];if(!_0x12827c['query']['hasOwnProperty'](_0x4073('0x41'))){_0x4bff6d['limit']=qs[_0x4073('0x2c')](_0x12827c[_0x4073('0x3b')][_0x4073('0x2c')]);_0x4bff6d[_0x4073('0x2b')]=qs[_0x4073('0x2b')](_0x12827c[_0x4073('0x3b')]['offset']);}_0x4bff6d[_0x4073('0x42')]=qs[_0x4073('0x43')](_0x12827c[_0x4073('0x3b')][_0x4073('0x43')]);_0x4bff6d[_0x4073('0x44')]=qs[_0x4073('0x3d')](_[_0x4073('0x45')](_0x12827c['query'],_0x35832b[_0x4073('0x3d')]),_0x2ec147);if(_0x12827c[_0x4073('0x3b')][_0x4073('0x46')]){_0x4bff6d[_0x4073('0x44')]=_[_0x4073('0x47')](_0x4bff6d[_0x4073('0x44')],{'$or':_[_0x4073('0x34')](_0x2ec147,function(_0xd0f652){if(_0xd0f652[_0x4073('0x38')]!==_0x4073('0x48')){var _0x39d416={};_0x39d416[_0xd0f652[_0x4073('0x32')]]={'$like':'%'+_0x12827c[_0x4073('0x3b')][_0x4073('0x46')]+'%'};return _0x39d416;}})});}_0x4bff6d=_[_0x4073('0x47')]({},_0x4bff6d,_0x12827c[_0x4073('0x49')]);var _0x4e4f65={'where':_0x4bff6d[_0x4073('0x44')]};return db[_0x4073('0x35')][_0x4073('0x2a')](_0x4e4f65)[_0x4073('0x1c')](function(_0x4276d5){_0xd7772a[_0x4073('0x2a')]=_0x4276d5;if(_0x12827c[_0x4073('0x3b')][_0x4073('0x4a')]){_0x4bff6d['include']=[{'all':!![]}];}return db[_0x4073('0x35')][_0x4073('0x4b')](_0x4bff6d);})['then'](function(_0x4f29b4){_0xd7772a[_0x4073('0x4c')]=_0x4f29b4;return _0xd7772a;})[_0x4073('0x1c')](respondWithFilteredResult(_0x4622f2,_0x4bff6d))[_0x4073('0x4d')](handleError(_0x4622f2,null));};exports['show']=function(_0x2c0cae,_0x21083b){var _0xa52173={'raw':!![],'where':{'id':_0x2c0cae['params']['id']}},_0x13887b={};_0x13887b[_0x4073('0x3a')]=_['keys'](db[_0x4073('0x35')][_0x4073('0x36')]);_0x13887b['query']=_[_0x4073('0x3c')](_0x2c0cae[_0x4073('0x3b')]);_0x13887b[_0x4073('0x3d')]=_[_0x4073('0x3e')](_0x13887b[_0x4073('0x3a')],_0x13887b[_0x4073('0x3b')]);_0xa52173['attributes']=_[_0x4073('0x3e')](_0x13887b[_0x4073('0x3a')],qs['fields'](_0x2c0cae[_0x4073('0x3b')]['fields']));_0xa52173[_0x4073('0x40')]=_0xa52173['attributes'][_0x4073('0x4e')]?_0xa52173[_0x4073('0x40')]:_0x13887b['model'];if(_0x2c0cae['query'][_0x4073('0x4a')]){_0xa52173[_0x4073('0x4f')]=[{'all':!![]}];}_0xa52173=_[_0x4073('0x47')]({},_0xa52173,_0x2c0cae[_0x4073('0x49')]);return db[_0x4073('0x35')]['find'](_0xa52173)['then'](handleEntityNotFound(_0x21083b,null))[_0x4073('0x1c')](respondWithResult(_0x21083b,null))['catch'](handleError(_0x21083b,null));};exports['create']=function(_0x297b2a,_0x1fe317){return db[_0x4073('0x35')][_0x4073('0x50')](_0x297b2a[_0x4073('0x51')],{})[_0x4073('0x1c')](respondWithResult(_0x1fe317,0xc9))[_0x4073('0x4d')](handleError(_0x1fe317,null));};exports[_0x4073('0x2f')]=function(_0x2855c8,_0x1e54cc){if(_0x2855c8[_0x4073('0x51')]['id']){delete _0x2855c8['body']['id'];}return db[_0x4073('0x35')][_0x4073('0x52')]({'where':{'id':_0x2855c8[_0x4073('0x53')]['id']}})[_0x4073('0x1c')](handleEntityNotFound(_0x1e54cc,null))[_0x4073('0x1c')](saveUpdates(_0x2855c8['body'],null))[_0x4073('0x1c')](respondWithResult(_0x1e54cc,null))['catch'](handleError(_0x1e54cc,null));};exports[_0x4073('0x30')]=function(_0x498fb6,_0x4efc5b){return db['OpenchannelMessage'][_0x4073('0x52')]({'where':{'id':_0x498fb6[_0x4073('0x53')]['id']}})[_0x4073('0x1c')](handleEntityNotFound(_0x4efc5b,null))[_0x4073('0x1c')](removeEntity(_0x4efc5b,null))[_0x4073('0x4d')](handleError(_0x4efc5b,null));};exports[_0x4073('0x54')]=function(_0x3e0536,_0x5b7077){return db[_0x4073('0x35')][_0x4073('0x54')]()['then'](respondWithResult(_0x5b7077,null))[_0x4073('0x4d')](handleError(_0x5b7077,null));};var interaction_log=require(_0x4073('0x55'))(_0x4073('0x56'));exports[_0x4073('0x57')]=function(_0x5d3f23,_0x213ed9,_0x3a85bf){var _0x2bbd54={'agent':{},'channel':'openchannel'};if(_0x5d3f23['body']['id']){delete _0x5d3f23['body']['id'];}_0x5d3f23['body'][_0x4073('0x58')]=!![];_0x5d3f23[_0x4073('0x51')][_0x4073('0x59')]=moment()[_0x4073('0x5a')](_0x4073('0x5b'));_0x5d3f23[_0x4073('0x51')]['UserId']=_0x5d3f23['body'][_0x4073('0x5c')]||_0x5d3f23[_0x4073('0x5d')]['id'];_0x2bbd54[_0x4073('0x5e')]['id']=_0x5d3f23[_0x4073('0x51')][_0x4073('0x5c')];return db[_0x4073('0x35')][_0x4073('0x52')]({'where':{'id':_0x5d3f23[_0x4073('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x4073('0x5f')}]})[_0x4073('0x1c')](handleEntityNotFound(_0x213ed9,null))['then'](saveUpdates(_0x5d3f23[_0x4073('0x51')],null))[_0x4073('0x1c')](function(_0xbc79d4){if(_0xbc79d4){_0x2bbd54[_0x4073('0x24')]=_0xbc79d4['get']({'plain':!![]});return db[_0x4073('0x60')][_0x4073('0x52')]({'where':{'id':_0xbc79d4[_0x4073('0x61')]}});}return null;})[_0x4073('0x1c')](handleEntityNotFound(_0x213ed9,null))[_0x4073('0x1c')](function(_0x5c8180){if(_0x5c8180){return _0x5c8180[_0x4073('0x2f')]({'UserId':_0x5d3f23[_0x4073('0x51')]['UserId'],'read1stAt':_[_0x4073('0x62')](_0x5c8180[_0x4073('0x63')])?moment()[_0x4073('0x5a')](_0x4073('0x5b')):undefined});}return null;})[_0x4073('0x1c')](function(_0x428657){if(_0x428657){_0x2bbd54[_0x4073('0x64')]=_0x428657[_0x4073('0x65')]({'plain':!![]});interaction_log[_0x4073('0x1d')](_0x4073('0x66'),_0x5d3f23[_0x4073('0x5d')]['id'],_0x5d3f23[_0x4073('0x5d')][_0x4073('0x32')],_0x5d3f23['user']['role'],_0x2bbd54[_0x4073('0x64')]['id'],_0x5d3f23[_0x4073('0x51')]?JSON[_0x4073('0x21')](_0x5d3f23[_0x4073('0x51')]):_0x4073('0x67'));return respondWithRpcPromise(_0x4073('0x68'),_0x4073('0x69'),_0x2bbd54);}return null;})[_0x4073('0x1c')](function(_0x5a772d){if(_0x5a772d){if(_0x5d3f23[_0x4073('0x51')][_0x4073('0x6a')]){_0x2bbd54[_0x4073('0x24')][_0x4073('0x6b')]=util[_0x4073('0x5a')]('SIP/%s',_0x5d3f23[_0x4073('0x5d')][_0x4073('0x32')]);_0x2bbd54[_0x4073('0x24')]['channel']=_0x2bbd54[_0x4073('0x6c')];_0x2bbd54[_0x4073('0x24')]['event']='accept';return respondWithRpcPromise(_0x4073('0x6d'),_0x4073('0x6d'),{'event':_0x4073('0x6e'),'message':_0x2bbd54[_0x4073('0x24')]},client9002)[_0x4073('0x1c')](function(){return _0x2bbd54;});}return _0x2bbd54;}return null;})['then'](respondWithResult(_0x213ed9,null))[_0x4073('0x4d')](handleError(_0x213ed9,null));};var interaction_log=require(_0x4073('0x55'))(_0x4073('0x56'));exports[_0x4073('0x6f')]=function(_0x3e8796,_0x466362,_0x49206e){var _0x39471d={'agent':{},'channel':_0x4073('0x70')};if(_0x3e8796[_0x4073('0x51')]['id']){delete _0x3e8796['body']['id'];}_0x3e8796['body'][_0x4073('0x5c')]=_0x3e8796['body'][_0x4073('0x5c')]||_0x3e8796[_0x4073('0x5d')]['id'];_0x39471d['agent']['id']=_0x3e8796[_0x4073('0x51')]['UserId'];return db[_0x4073('0x35')]['find']({'where':{'id':_0x3e8796[_0x4073('0x53')]['id'],'UserId':null}})[_0x4073('0x1c')](handleEntityNotFound(_0x466362,null))[_0x4073('0x1c')](function(_0x2d0adb){if(_0x2d0adb){_0x39471d['message']=_0x2d0adb[_0x4073('0x65')]({'plain':!![]});return db[_0x4073('0x60')]['find']({'where':{'id':_0x2d0adb[_0x4073('0x61')]}});}return null;})[_0x4073('0x1c')](handleEntityNotFound(_0x466362,null))['then'](function(_0x5b7fe1){if(_0x5b7fe1){_0x39471d[_0x4073('0x64')]=_0x5b7fe1[_0x4073('0x65')]({'plain':!![]});interaction_log[_0x4073('0x1d')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e8796[_0x4073('0x5d')]['id'],_0x3e8796['user'][_0x4073('0x32')],_0x3e8796[_0x4073('0x5d')][_0x4073('0x71')],_0x39471d[_0x4073('0x64')]['id'],_0x3e8796['body']?JSON[_0x4073('0x21')](_0x3e8796['body']):_0x4073('0x67'));return respondWithRpcPromise(_0x4073('0x72'),_0x4073('0x73'),_0x39471d);}return null;})[_0x4073('0x1c')](function(_0x25707f){if(_0x25707f){_0x25707f[_0x4073('0x24')][_0x4073('0x6b')]=util['format'](_0x4073('0x74'),_0x3e8796[_0x4073('0x5d')][_0x4073('0x32')]);_0x25707f[_0x4073('0x24')]['channel']=_0x39471d['channel'];_0x25707f[_0x4073('0x24')][_0x4073('0x75')]='reject';respondWithRpcPromise('EventManager',_0x4073('0x6d'),{'event':'rejectmessage','message':_0x25707f[_0x4073('0x24')]},client9002);return _0x39471d;}return null;})[_0x4073('0x1c')](respondWithResult(_0x466362,null))['catch'](handleError(_0x466362,null));}; \ No newline at end of file +var _0xac09=['type','key','model','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','include','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','manual','interface','SIP/%s','channel','event','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','EventManager','rejectmessage','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','client','http','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','OpenchannelMessage','fieldName'];(function(_0x11cb91,_0x5ef17c){var _0x2bc42f=function(_0x481ea2){while(--_0x481ea2){_0x11cb91['push'](_0x11cb91['shift']());}};_0x2bc42f(++_0x5ef17c);}(_0xac09,0x1bb));var _0x9ac0=function(_0x5311e4,_0x110e28){_0x5311e4=_0x5311e4-0x0;var _0x4c759b=_0xac09[_0x5311e4];return _0x4c759b;};'use strict';var pdf=require(_0x9ac0('0x0'));var emlformat=require(_0x9ac0('0x1'));var rimraf=require(_0x9ac0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9ac0('0x3'));var moment=require('moment');var BPromise=require(_0x9ac0('0x4'));var Mustache=require(_0x9ac0('0x5'));var util=require(_0x9ac0('0x6'));var path=require(_0x9ac0('0x7'));var sox=require(_0x9ac0('0x8'));var csv=require(_0x9ac0('0x9'));var ejs=require(_0x9ac0('0xa'));var fs=require('fs');var _=require(_0x9ac0('0xb'));var squel=require(_0x9ac0('0xc'));var crypto=require(_0x9ac0('0xd'));var jsforce=require(_0x9ac0('0xe'));var deskjs=require(_0x9ac0('0xf'));var toCsv=require(_0x9ac0('0x9'));var querystring=require(_0x9ac0('0x10'));var Papa=require(_0x9ac0('0x11'));var Redis=require(_0x9ac0('0x12'));var authService=require(_0x9ac0('0x13'));var qs=require(_0x9ac0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ac0('0x15'));var logger=require(_0x9ac0('0x16'))(_0x9ac0('0x17'));var utils=require(_0x9ac0('0x18'));var config=require(_0x9ac0('0x19'));var licenseUtil=require(_0x9ac0('0x1a'));var db=require('../../mysqldb')['db'];config[_0x9ac0('0x1b')]=_[_0x9ac0('0x1c')](config[_0x9ac0('0x1b')],{'host':_0x9ac0('0x1d'),'port':0x18eb});var socket=require(_0x9ac0('0x1e'))(new Redis(config[_0x9ac0('0x1b')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9ac0('0x1f')][_0x9ac0('0x20')]({'port':0x232c});var client9002=jayson[_0x9ac0('0x1f')][_0x9ac0('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2382ef,_0x2c2c6d,_0x73052d,_0x4d0e0f){return new BPromise(function(_0x966d81,_0x3ad596){var _0x2a1c0e=_0x4d0e0f||client;return _0x2a1c0e['request'](_0x2382ef,_0x73052d)['then'](function(_0x329fd9){logger['info'](_0x9ac0('0x21'),_0x2c2c6d,_0x9ac0('0x22'));logger[_0x9ac0('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2c2c6d,_0x9ac0('0x22'),JSON['stringify'](_0x329fd9));if(_0x329fd9[_0x9ac0('0x24')]){if(_0x329fd9[_0x9ac0('0x24')][_0x9ac0('0x25')]===0x1f4){logger[_0x9ac0('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x2c2c6d,_0x329fd9['error']['message']);return _0x3ad596(_0x329fd9[_0x9ac0('0x24')][_0x9ac0('0x26')]);}logger['error'](_0x9ac0('0x21'),_0x2c2c6d,_0x329fd9[_0x9ac0('0x24')]['message']);return _0x966d81(_0x329fd9[_0x9ac0('0x24')][_0x9ac0('0x26')]);}else{logger[_0x9ac0('0x27')](_0x9ac0('0x21'),_0x2c2c6d,_0x9ac0('0x22'));_0x966d81(_0x329fd9[_0x9ac0('0x28')][_0x9ac0('0x26')]);}})['catch'](function(_0x5d29a8){logger[_0x9ac0('0x24')](_0x9ac0('0x21'),_0x2c2c6d,_0x5d29a8);_0x3ad596(_0x5d29a8);});});}function respondWithStatusCode(_0x30f071,_0x14e764){_0x14e764=_0x14e764||0xcc;return function(_0x1f57c3){if(_0x1f57c3){return _0x30f071[_0x9ac0('0x29')](_0x14e764);}return _0x30f071[_0x9ac0('0x2a')](_0x14e764)[_0x9ac0('0x2b')]();};}function respondWithResult(_0x24219d,_0x2fc9f8){_0x2fc9f8=_0x2fc9f8||0xc8;return function(_0x3ba9d0){if(_0x3ba9d0){return _0x24219d['status'](_0x2fc9f8)[_0x9ac0('0x2c')](_0x3ba9d0);}};}function respondWithFilteredResult(_0x479b95,_0x27e2eb){return function(_0x299358){if(_0x299358){var _0x1968c6=_0x299358[_0x9ac0('0x2d')],_0x375701=_0x27e2eb['offset'],_0xaeb2a0=_0x27e2eb[_0x9ac0('0x2e')]+_0x27e2eb[_0x9ac0('0x2f')],_0x5930d9;if(_0xaeb2a0>=_0x1968c6){_0xaeb2a0=_0x1968c6;_0x5930d9=0xc8;}else{_0x5930d9=0xce;}_0x479b95[_0x9ac0('0x2a')](_0x5930d9);return _0x479b95[_0x9ac0('0x30')](_0x9ac0('0x31'),_0x375701+'-'+_0xaeb2a0+'/'+_0x1968c6)[_0x9ac0('0x2c')](_0x299358);}return null;};}function patchUpdates(_0xc48426){return function(_0x6825c0){try{jsonpatch['apply'](_0x6825c0,_0xc48426,!![]);}catch(_0xde345a){return BPromise[_0x9ac0('0x32')](_0xde345a);}return _0x6825c0[_0x9ac0('0x33')]();};}function saveUpdates(_0x2184de,_0x317cae){return function(_0x376257){if(_0x376257){return _0x376257[_0x9ac0('0x34')](_0x2184de)[_0x9ac0('0x35')](function(_0x2a3a11){return _0x2a3a11;});}return null;};}function removeEntity(_0x1254af,_0x440f62){return function(_0x115e01){if(_0x115e01){return _0x115e01[_0x9ac0('0x36')]()['then'](function(){_0x1254af['status'](0xcc)[_0x9ac0('0x2b')]();});}};}function handleEntityNotFound(_0xdfa2ee,_0x104fff){return function(_0x554c9f){if(!_0x554c9f){_0xdfa2ee['sendStatus'](0x194);}return _0x554c9f;};}function handleError(_0x2593ec,_0xfb790d){_0xfb790d=_0xfb790d||0x1f4;return function(_0x4f3f4a){logger[_0x9ac0('0x24')](_0x4f3f4a[_0x9ac0('0x37')]);if(_0x4f3f4a['name']){delete _0x4f3f4a[_0x9ac0('0x38')];}_0x2593ec[_0x9ac0('0x2a')](_0xfb790d)[_0x9ac0('0x39')](_0x4f3f4a);};}exports[_0x9ac0('0x3a')]=function(_0x25700a,_0x2fe7da){var _0x4b3846={},_0x5a2418={},_0x2e649f={'count':0x0,'rows':[]};var _0x1854b0=_['map'](db[_0x9ac0('0x3b')]['rawAttributes'],function(_0x47457b){return{'name':_0x47457b[_0x9ac0('0x3c')],'type':_0x47457b[_0x9ac0('0x3d')][_0x9ac0('0x3e')]};});_0x5a2418[_0x9ac0('0x3f')]=_['map'](_0x1854b0,'name');_0x5a2418[_0x9ac0('0x40')]=_['keys'](_0x25700a[_0x9ac0('0x40')]);_0x5a2418['filters']=_[_0x9ac0('0x41')](_0x5a2418[_0x9ac0('0x3f')],_0x5a2418['query']);_0x4b3846['attributes']=_[_0x9ac0('0x41')](_0x5a2418[_0x9ac0('0x3f')],qs[_0x9ac0('0x42')](_0x25700a[_0x9ac0('0x40')][_0x9ac0('0x42')]));_0x4b3846[_0x9ac0('0x43')]=_0x4b3846[_0x9ac0('0x43')]['length']?_0x4b3846[_0x9ac0('0x43')]:_0x5a2418[_0x9ac0('0x3f')];if(!_0x25700a[_0x9ac0('0x40')]['hasOwnProperty'](_0x9ac0('0x44'))){_0x4b3846[_0x9ac0('0x2f')]=qs[_0x9ac0('0x2f')](_0x25700a[_0x9ac0('0x40')]['limit']);_0x4b3846[_0x9ac0('0x2e')]=qs[_0x9ac0('0x2e')](_0x25700a[_0x9ac0('0x40')][_0x9ac0('0x2e')]);}_0x4b3846[_0x9ac0('0x45')]=qs[_0x9ac0('0x46')](_0x25700a[_0x9ac0('0x40')]['sort']);_0x4b3846[_0x9ac0('0x47')]=qs[_0x9ac0('0x48')](_[_0x9ac0('0x49')](_0x25700a[_0x9ac0('0x40')],_0x5a2418[_0x9ac0('0x48')]),_0x1854b0);if(_0x25700a[_0x9ac0('0x40')][_0x9ac0('0x4a')]){_0x4b3846[_0x9ac0('0x47')]=_[_0x9ac0('0x4b')](_0x4b3846['where'],{'$or':_[_0x9ac0('0x4c')](_0x1854b0,function(_0x24044a){if(_0x24044a[_0x9ac0('0x3d')]!==_0x9ac0('0x4d')){var _0x2f8a71={};_0x2f8a71[_0x24044a[_0x9ac0('0x38')]]={'$like':'%'+_0x25700a['query'][_0x9ac0('0x4a')]+'%'};return _0x2f8a71;}})});}_0x4b3846=_[_0x9ac0('0x4b')]({},_0x4b3846,_0x25700a['options']);var _0x439b2a={'where':_0x4b3846['where']};return db['OpenchannelMessage'][_0x9ac0('0x2d')](_0x439b2a)['then'](function(_0x194876){_0x2e649f[_0x9ac0('0x2d')]=_0x194876;if(_0x25700a['query']['includeAll']){_0x4b3846[_0x9ac0('0x4e')]=[{'all':!![]}];}return db[_0x9ac0('0x3b')][_0x9ac0('0x4f')](_0x4b3846);})[_0x9ac0('0x35')](function(_0x4b9b05){_0x2e649f[_0x9ac0('0x50')]=_0x4b9b05;return _0x2e649f;})['then'](respondWithFilteredResult(_0x2fe7da,_0x4b3846))[_0x9ac0('0x51')](handleError(_0x2fe7da,null));};exports[_0x9ac0('0x52')]=function(_0x352ffe,_0xe90e3e){var _0x3b52fa={'raw':!![],'where':{'id':_0x352ffe[_0x9ac0('0x53')]['id']}},_0x121613={};_0x121613[_0x9ac0('0x3f')]=_[_0x9ac0('0x54')](db[_0x9ac0('0x3b')][_0x9ac0('0x55')]);_0x121613[_0x9ac0('0x40')]=_[_0x9ac0('0x54')](_0x352ffe['query']);_0x121613[_0x9ac0('0x48')]=_[_0x9ac0('0x41')](_0x121613[_0x9ac0('0x3f')],_0x121613[_0x9ac0('0x40')]);_0x3b52fa[_0x9ac0('0x43')]=_[_0x9ac0('0x41')](_0x121613[_0x9ac0('0x3f')],qs[_0x9ac0('0x42')](_0x352ffe[_0x9ac0('0x40')][_0x9ac0('0x42')]));_0x3b52fa[_0x9ac0('0x43')]=_0x3b52fa[_0x9ac0('0x43')][_0x9ac0('0x56')]?_0x3b52fa['attributes']:_0x121613[_0x9ac0('0x3f')];if(_0x352ffe[_0x9ac0('0x40')][_0x9ac0('0x57')]){_0x3b52fa[_0x9ac0('0x4e')]=[{'all':!![]}];}_0x3b52fa=_[_0x9ac0('0x4b')]({},_0x3b52fa,_0x352ffe[_0x9ac0('0x58')]);return db[_0x9ac0('0x3b')][_0x9ac0('0x59')](_0x3b52fa)[_0x9ac0('0x35')](handleEntityNotFound(_0xe90e3e,null))['then'](respondWithResult(_0xe90e3e,null))['catch'](handleError(_0xe90e3e,null));};exports[_0x9ac0('0x5a')]=function(_0x260643,_0x1c8717){return db[_0x9ac0('0x3b')][_0x9ac0('0x5a')](_0x260643[_0x9ac0('0x5b')],{})['then'](respondWithResult(_0x1c8717,0xc9))['catch'](handleError(_0x1c8717,null));};exports['update']=function(_0x17f433,_0x49824b){if(_0x17f433['body']['id']){delete _0x17f433[_0x9ac0('0x5b')]['id'];}return db[_0x9ac0('0x3b')][_0x9ac0('0x59')]({'where':{'id':_0x17f433[_0x9ac0('0x53')]['id']}})['then'](handleEntityNotFound(_0x49824b,null))[_0x9ac0('0x35')](saveUpdates(_0x17f433[_0x9ac0('0x5b')],null))['then'](respondWithResult(_0x49824b,null))[_0x9ac0('0x51')](handleError(_0x49824b,null));};exports[_0x9ac0('0x36')]=function(_0x1394cf,_0x104c97){return db['OpenchannelMessage']['find']({'where':{'id':_0x1394cf[_0x9ac0('0x53')]['id']}})[_0x9ac0('0x35')](handleEntityNotFound(_0x104c97,null))['then'](removeEntity(_0x104c97,null))[_0x9ac0('0x51')](handleError(_0x104c97,null));};exports[_0x9ac0('0x5c')]=function(_0x1fa676,_0x4e3cd2){return db[_0x9ac0('0x3b')]['describe']()[_0x9ac0('0x35')](respondWithResult(_0x4e3cd2,null))[_0x9ac0('0x51')](handleError(_0x4e3cd2,null));};var interaction_log=require(_0x9ac0('0x16'))(_0x9ac0('0x5d'));exports[_0x9ac0('0x5e')]=function(_0x5a1a91,_0x4253b1,_0x490273){var _0x4e4b0b={'agent':{},'channel':_0x9ac0('0x5f')};if(_0x5a1a91[_0x9ac0('0x5b')]['id']){delete _0x5a1a91[_0x9ac0('0x5b')]['id'];}_0x5a1a91[_0x9ac0('0x5b')][_0x9ac0('0x60')]=!![];_0x5a1a91[_0x9ac0('0x5b')][_0x9ac0('0x61')]=moment()[_0x9ac0('0x62')](_0x9ac0('0x63'));_0x5a1a91[_0x9ac0('0x5b')][_0x9ac0('0x64')]=_0x5a1a91[_0x9ac0('0x5b')]['UserId']||_0x5a1a91[_0x9ac0('0x65')]['id'];_0x4e4b0b[_0x9ac0('0x66')]['id']=_0x5a1a91['body'][_0x9ac0('0x64')];return db['OpenchannelMessage'][_0x9ac0('0x59')]({'where':{'id':_0x5a1a91[_0x9ac0('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x9ac0('0x67')}]})[_0x9ac0('0x35')](handleEntityNotFound(_0x4253b1,null))[_0x9ac0('0x35')](saveUpdates(_0x5a1a91[_0x9ac0('0x5b')],null))[_0x9ac0('0x35')](function(_0xe4a725){if(_0xe4a725){_0x4e4b0b[_0x9ac0('0x26')]=_0xe4a725['get']({'plain':!![]});return db[_0x9ac0('0x68')][_0x9ac0('0x59')]({'where':{'id':_0xe4a725[_0x9ac0('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x4253b1,null))[_0x9ac0('0x35')](function(_0x3d4d72){if(_0x3d4d72){return _0x3d4d72[_0x9ac0('0x34')]({'UserId':_0x5a1a91[_0x9ac0('0x5b')]['UserId'],'read1stAt':_[_0x9ac0('0x6a')](_0x3d4d72[_0x9ac0('0x6b')])?moment()[_0x9ac0('0x62')](_0x9ac0('0x63')):undefined});}return null;})[_0x9ac0('0x35')](function(_0x531783){if(_0x531783){_0x4e4b0b[_0x9ac0('0x6c')]=_0x531783[_0x9ac0('0x6d')]({'plain':!![]});interaction_log[_0x9ac0('0x27')](_0x9ac0('0x6e'),_0x5a1a91[_0x9ac0('0x65')]['id'],_0x5a1a91[_0x9ac0('0x65')][_0x9ac0('0x38')],_0x5a1a91[_0x9ac0('0x65')][_0x9ac0('0x6f')],_0x4e4b0b['interaction']['id'],_0x5a1a91[_0x9ac0('0x5b')]?JSON[_0x9ac0('0x70')](_0x5a1a91[_0x9ac0('0x5b')]):_0x9ac0('0x71'));return respondWithRpcPromise(_0x9ac0('0x72'),'acceptMessage',_0x4e4b0b);}return null;})[_0x9ac0('0x35')](function(_0x14b81e){if(_0x14b81e){if(_0x5a1a91[_0x9ac0('0x5b')][_0x9ac0('0x73')]){_0x4e4b0b[_0x9ac0('0x26')][_0x9ac0('0x74')]=util['format'](_0x9ac0('0x75'),_0x5a1a91[_0x9ac0('0x65')][_0x9ac0('0x38')]);_0x4e4b0b[_0x9ac0('0x26')][_0x9ac0('0x76')]=_0x4e4b0b[_0x9ac0('0x76')];_0x4e4b0b['message'][_0x9ac0('0x77')]=_0x9ac0('0x5e');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x9ac0('0x78'),'message':_0x4e4b0b[_0x9ac0('0x26')]},client9002)['then'](function(){return _0x4e4b0b;});}return _0x4e4b0b;}return null;})[_0x9ac0('0x35')](respondWithResult(_0x4253b1,null))['catch'](handleError(_0x4253b1,null));};var interaction_log=require(_0x9ac0('0x16'))('openchannel-interactions');exports['reject']=function(_0x5428f7,_0xc2ad6a,_0x55a942){var _0xe25f5b={'agent':{},'channel':_0x9ac0('0x5f')};if(_0x5428f7['body']['id']){delete _0x5428f7[_0x9ac0('0x5b')]['id'];}_0x5428f7[_0x9ac0('0x5b')]['UserId']=_0x5428f7['body'][_0x9ac0('0x64')]||_0x5428f7[_0x9ac0('0x65')]['id'];_0xe25f5b['agent']['id']=_0x5428f7[_0x9ac0('0x5b')][_0x9ac0('0x64')];return db[_0x9ac0('0x3b')][_0x9ac0('0x59')]({'where':{'id':_0x5428f7[_0x9ac0('0x53')]['id'],'UserId':null}})[_0x9ac0('0x35')](handleEntityNotFound(_0xc2ad6a,null))['then'](function(_0x171539){if(_0x171539){_0xe25f5b['message']=_0x171539['get']({'plain':!![]});return db[_0x9ac0('0x68')][_0x9ac0('0x59')]({'where':{'id':_0x171539[_0x9ac0('0x69')]}});}return null;})[_0x9ac0('0x35')](handleEntityNotFound(_0xc2ad6a,null))[_0x9ac0('0x35')](function(_0x284507){if(_0x284507){_0xe25f5b[_0x9ac0('0x6c')]=_0x284507[_0x9ac0('0x6d')]({'plain':!![]});interaction_log[_0x9ac0('0x27')](_0x9ac0('0x79'),_0x5428f7[_0x9ac0('0x65')]['id'],_0x5428f7[_0x9ac0('0x65')]['name'],_0x5428f7[_0x9ac0('0x65')][_0x9ac0('0x6f')],_0xe25f5b[_0x9ac0('0x6c')]['id'],_0x5428f7['body']?JSON[_0x9ac0('0x70')](_0x5428f7[_0x9ac0('0x5b')]):'null');return respondWithRpcPromise(_0x9ac0('0x7a'),_0x9ac0('0x7b'),_0xe25f5b);}return null;})[_0x9ac0('0x35')](function(_0x4c3896){if(_0x4c3896){_0x4c3896[_0x9ac0('0x26')][_0x9ac0('0x74')]=util[_0x9ac0('0x62')](_0x9ac0('0x75'),_0x5428f7[_0x9ac0('0x65')]['name']);_0x4c3896['message'][_0x9ac0('0x76')]=_0xe25f5b[_0x9ac0('0x76')];_0x4c3896['message']['event']='reject';respondWithRpcPromise(_0x9ac0('0x7c'),_0x9ac0('0x7c'),{'event':_0x9ac0('0x7d'),'message':_0x4c3896[_0x9ac0('0x26')]},client9002);return _0xe25f5b;}return null;})['then'](respondWithResult(_0xc2ad6a,null))[_0x9ac0('0x51')](handleError(_0xc2ad6a,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 431fdbd..1d5678c 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 _0x4df9=['emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','remove'];(function(_0xd90969,_0x538fd9){var _0xa05989=function(_0x572fe3){while(--_0x572fe3){_0xd90969['push'](_0xd90969['shift']());}};_0xa05989(++_0x538fd9);}(_0x4df9,0x73));var _0x94df=function(_0x3e93e2,_0xd6999e){_0x3e93e2=_0x3e93e2-0x0;var _0x150f7d=_0x4df9[_0x3e93e2];return _0x150f7d;};'use strict';var EventEmitter=require(_0x94df('0x0'));var OpenchannelMessage=require(_0x94df('0x1'))['db'][_0x94df('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x94df('0x3')};function emitEvent(_0x1b21b0){return function(_0x1f4ab5,_0x13b3f6,_0x53d440){OpenchannelMessageEvents[_0x94df('0x4')](_0x1b21b0+':'+_0x1f4ab5['id'],_0x1f4ab5);OpenchannelMessageEvents[_0x94df('0x4')](_0x1b21b0,_0x1f4ab5);_0x53d440(null);};}for(var e in events){if(events[_0x94df('0x5')](e)){var event=events[e];OpenchannelMessage[_0x94df('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xd224=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','OpenchannelMessage'];(function(_0x44ec14,_0x8a1bb6){var _0x2ffa38=function(_0x4a2ea1){while(--_0x4a2ea1){_0x44ec14['push'](_0x44ec14['shift']());}};_0x2ffa38(++_0x8a1bb6);}(_0xd224,0x126));var _0x4d22=function(_0x5e4818,_0x2f3335){_0x5e4818=_0x5e4818-0x0;var _0x280b13=_0xd224[_0x5e4818];return _0x280b13;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x4d22('0x0'))['db'][_0x4d22('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4d22('0x2'),'afterUpdate':_0x4d22('0x3'),'afterDestroy':_0x4d22('0x4')};function emitEvent(_0x391264){return function(_0x13fe54,_0x19c9ba,_0x38f9f6){OpenchannelMessageEvents[_0x4d22('0x5')](_0x391264+':'+_0x13fe54['id'],_0x13fe54);OpenchannelMessageEvents['emit'](_0x391264,_0x13fe54);_0x38f9f6(null);};}for(var e in events){if(events[_0x4d22('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x4d22('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index f31a7c8..158ddde 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 _0x375d=['Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','error','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','models','get','toLowerCase','direction','out','secret','isNil','OpenchannelInteraction','OpenchannelInteractionId','then','update','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','method','info','afterCreate','format'];(function(_0x3f9f0f,_0x531b30){var _0x2eb31d=function(_0x43feb1){while(--_0x43feb1){_0x3f9f0f['push'](_0x3f9f0f['shift']());}};_0x2eb31d(++_0x531b30);}(_0x375d,0x9a));var _0xd375=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x375d[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xd375('0x0'));var logger=require(_0xd375('0x1'))(_0xd375('0x2'));var moment=require(_0xd375('0x3'));var BPromise=require(_0xd375('0x4'));var rp=require(_0xd375('0x5'));var fs=require('fs');var path=require(_0xd375('0x6'));var rimraf=require(_0xd375('0x7'));var config=require('../../config/environment');var attributes=require(_0xd375('0x8'));module[_0xd375('0x9')]=function(_0x28606e,_0x193ece){return _0x28606e[_0xd375('0xa')]('OpenchannelMessage',attributes,{'tableName':_0xd375('0xb'),'paranoid':![],'indexes':[{'name':_0xd375('0xc'),'fields':[_0xd375('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x66a455,_0x264c1c,_0x253c4d){var _0x1c0ad1=_0x28606e[_0xd375('0xe')];var _0x594c42=_0x66a455[_0xd375('0xf')]({'plain':!![]});if(_0x594c42['direction'][_0xd375('0x10')]()==='in'||_0x594c42[_0xd375('0x11')][_0xd375('0x10')]()===_0xd375('0x12')&&!_0x594c42[_0xd375('0x13')]&&!_[_0xd375('0x14')](_0x594c42['UserId'])){_0x1c0ad1[_0xd375('0x15')]['findOne']({'where':{'id':_0x594c42[_0xd375('0x16')]}})[_0xd375('0x17')](function(_0x5443c2){if(_0x5443c2){_0x5443c2[_0xd375('0x18')]({'lastMsgAt':_0x594c42['createdAt'],'lastMsgDirection':_0x594c42[_0xd375('0x11')][_0xd375('0x10')]()});}})['catch'](function(_0x21159f){console['error'](_0x21159f);});}if(_0x594c42['direction']===_0xd375('0x12')&&!_0x594c42[_0xd375('0x13')]){var _0x5877cd;_0x1c0ad1['CmContact']['describe']()[_0xd375('0x17')](function(_0xa605e1){return _0x1c0ad1[_0xd375('0x19')][_0xd375('0x1a')]({'where':{'id':_0x594c42[_0xd375('0x1b')]},'include':[{'model':_0x1c0ad1[_0xd375('0x15')],'as':_0xd375('0x1c'),'where':{'id':_0x594c42['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x1c0ad1[_0xd375('0x1d')],'as':_0xd375('0x1e'),'attributes':_[_0xd375('0x1f')](_0xa605e1)}]}]});})[_0xd375('0x17')](function(_0x403a0b){_0x5877cd=_0x403a0b[_0xd375('0xf')]({'plain':!![]});if(_0x5877cd&&_0x5877cd[_0xd375('0x20')]){logger['info'](_0xd375('0x21'),'afterCreate',util['format'](_0xd375('0x22'),_0x594c42['id'],_0x5877cd[_0xd375('0x20')]));if(_0x5877cd['Interactions']&&_0x5877cd['Interactions'][_0xd375('0x23')]){_0x594c42[_0xd375('0x24')]=_['omit'](_0x5877cd[_0xd375('0x1c')][0x0],_0xd375('0x1e'));_0x594c42[_0xd375('0x1e')]=_0x5877cd['Interactions'][0x0][_0xd375('0x1e')];}var _0x264c1c={'method':_0xd375('0x25'),'uri':encodeURI(_0x5877cd['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x264c1c[_0xd375('0x26')]){case'GET':_0x264c1c['qs']=_0x594c42;break;case'POST':_0x264c1c[_0xd375('0xd')]=_0x594c42;break;}return rp(_0x264c1c)[_0xd375('0x17')](function(_0x2ac3b7){logger[_0xd375('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0xd375('0x28'),util[_0xd375('0x29')](_0xd375('0x2a'),_0x594c42['id'],_0x5877cd[_0xd375('0x20')]));if(_0x2ac3b7[_0xd375('0xd')][_0xd375('0x2b')]&&_0x2ac3b7['body'][_0xd375('0x2b')]!=_0x594c42[_0xd375('0x24')][_0xd375('0x2b')]){return _0x1c0ad1[_0xd375('0x15')][_0xd375('0x18')]({'threadId':_0x2ac3b7['body'][_0xd375('0x2b')]},{'logging':!![],'where':{'id':_0x594c42[_0xd375('0x24')]['id']}});}else{return;}})[_0xd375('0x17')](function(){return _0x66a455[_0xd375('0x18')]({'read':!![]});})[_0xd375('0x2c')](function(_0x25c54d){logger[_0xd375('0x2d')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xd375('0x2e')](_0x25c54d,{'showHidden':![],'depth':null}));_0x253c4d();});}else{_0x253c4d();}})[_0xd375('0x2f')](function(){_0x253c4d();});}else{_0x253c4d();}}},'charset':'utf8mb4','collate':_0xd375('0x30')});}; \ No newline at end of file +var _0x76a4=['direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','error','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','keys','info','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','GET','body','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','get'];(function(_0x3223de,_0x4f8782){var _0x39067a=function(_0x32b164){while(--_0x32b164){_0x3223de['push'](_0x3223de['shift']());}};_0x39067a(++_0x4f8782);}(_0x76a4,0x90));var _0x476a=function(_0x440ec4,_0x4f4205){_0x440ec4=_0x440ec4-0x0;var _0x1f433b=_0x76a4[_0x440ec4];return _0x1f433b;};'use strict';var _=require(_0x476a('0x0'));var util=require(_0x476a('0x1'));var logger=require(_0x476a('0x2'))(_0x476a('0x3'));var moment=require('moment');var BPromise=require(_0x476a('0x4'));var rp=require(_0x476a('0x5'));var fs=require('fs');var path=require(_0x476a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x476a('0x7'));module[_0x476a('0x8')]=function(_0x46323f,_0x2c31e7){return _0x46323f[_0x476a('0x9')](_0x476a('0xa'),attributes,{'tableName':_0x476a('0xb'),'paranoid':![],'indexes':[{'name':_0x476a('0xc'),'fields':['body'],'type':_0x476a('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e7477,_0x2a3e7d,_0x36ea0f){var _0x347a68=_0x46323f['models'];var _0x3e8820=_0x1e7477[_0x476a('0xe')]({'plain':!![]});if(_0x3e8820[_0x476a('0xf')]['toLowerCase']()==='in'||_0x3e8820[_0x476a('0xf')][_0x476a('0x10')]()===_0x476a('0x11')&&!_0x3e8820[_0x476a('0x12')]&&!_[_0x476a('0x13')](_0x3e8820[_0x476a('0x14')])){_0x347a68[_0x476a('0x15')][_0x476a('0x16')]({'where':{'id':_0x3e8820[_0x476a('0x17')]}})[_0x476a('0x18')](function(_0x2b4a42){if(_0x2b4a42){_0x2b4a42[_0x476a('0x19')]({'lastMsgAt':_0x3e8820[_0x476a('0x1a')],'lastMsgDirection':_0x3e8820[_0x476a('0xf')][_0x476a('0x10')]()});}})['catch'](function(_0xf896a5){console[_0x476a('0x1b')](_0xf896a5);});}if(_0x3e8820['direction']==='out'&&!_0x3e8820[_0x476a('0x12')]){var _0x33d024;_0x347a68[_0x476a('0x1c')][_0x476a('0x1d')]()[_0x476a('0x18')](function(_0x3008b5){return _0x347a68[_0x476a('0x1e')][_0x476a('0x1f')]({'where':{'id':_0x3e8820['OpenchannelAccountId']},'include':[{'model':_0x347a68[_0x476a('0x15')],'as':_0x476a('0x20'),'where':{'id':_0x3e8820[_0x476a('0x17')]},'limit':0x1,'include':[{'model':_0x347a68[_0x476a('0x1c')],'as':_0x476a('0x21'),'attributes':_[_0x476a('0x22')](_0x3008b5)}]}]});})[_0x476a('0x18')](function(_0x50cced){_0x33d024=_0x50cced[_0x476a('0xe')]({'plain':!![]});if(_0x33d024&&_0x33d024['replyUri']){logger[_0x476a('0x23')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0x476a('0x24'),_0x3e8820['id'],_0x33d024[_0x476a('0x25')]));if(_0x33d024[_0x476a('0x20')]&&_0x33d024[_0x476a('0x20')][_0x476a('0x26')]){_0x3e8820[_0x476a('0x27')]=_[_0x476a('0x28')](_0x33d024[_0x476a('0x20')][0x0],'Contact');_0x3e8820[_0x476a('0x21')]=_0x33d024['Interactions'][0x0][_0x476a('0x21')];}var _0x2a3e7d={'method':_0x476a('0x29'),'uri':encodeURI(_0x33d024[_0x476a('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2a3e7d[_0x476a('0x2a')]){case _0x476a('0x2b'):_0x2a3e7d['qs']=_0x3e8820;break;case _0x476a('0x29'):_0x2a3e7d[_0x476a('0x2c')]=_0x3e8820;break;}return rp(_0x2a3e7d)[_0x476a('0x18')](function(_0x500248){logger[_0x476a('0x23')](_0x476a('0x2d'),_0x476a('0x2e'),util['format'](_0x476a('0x2f'),_0x3e8820['id'],_0x33d024[_0x476a('0x25')]));if(_0x500248['body']['threadId']&&_0x500248[_0x476a('0x2c')][_0x476a('0x30')]!=_0x3e8820[_0x476a('0x27')]['threadId']){return _0x347a68[_0x476a('0x15')]['update']({'threadId':_0x500248['body']['threadId']},{'logging':!![],'where':{'id':_0x3e8820['Interaction']['id']}});}else{return;}})[_0x476a('0x18')](function(){return _0x1e7477['update']({'read':!![]});})[_0x476a('0x31')](function(_0x39e768){logger['error'](_0x476a('0x2d'),'afterCreate',util[_0x476a('0x32')](_0x39e768,{'showHidden':![],'depth':null}));_0x36ea0f();});}else{_0x36ea0f();}})[_0x476a('0x33')](function(){_0x36ea0f();});}else{_0x36ea0f();}}},'charset':_0x476a('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 13b4993..8fd6d4f 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(_0x5b3ef5,_0x4199a7){var _0x185542=function(_0x5166bd){while(--_0x5166bd){_0x5b3ef5['push'](_0x5b3ef5['shift']());}};_0x185542(++_0x4199a7);}(_0xb10b,0x12a));var _0xbb10=function(_0x49ab20,_0x204482){_0x49ab20=_0x49ab20-0x0;var _0x3c10b4=_0xb10b[_0x49ab20];return _0x3c10b4;};'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 _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(_0x5a4e2c,_0x58ff0a){var _0x32112c=function(_0x33a0b1){while(--_0x33a0b1){_0x5a4e2c['push'](_0x5a4e2c['shift']());}};_0x32112c(++_0x58ff0a);}(_0xb10b,0x12a));var _0xbb10=function(_0x4008de,_0x15f2e9){_0x4008de=_0x4008de-0x0;var _0x596738=_0xb10b[_0x4008de];return _0x596738;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 95a7d37..7ed71cb 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 _0x9bde=['openchannelMessage:','save','update','emit','removeListener','register','length'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5d765a,_0x24b15e){_0x5d765a=_0x5d765a-0x0;var _0x7ad8f2=_0x9bde[_0x5d765a];return _0x7ad8f2;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xe9bd('0x0'),'remove',_0xe9bd('0x1')];function createListener(_0x4c63ca,_0x51786f){return function(_0x3005aa){_0x51786f[_0xe9bd('0x2')](_0x4c63ca,_0x3005aa);};}function removeListener(_0x1c1b34,_0x10822d){return function(){OpenchannelMessageEvents[_0xe9bd('0x3')](_0x1c1b34,_0x10822d);};}exports[_0xe9bd('0x4')]=function(_0x4fd7b8){for(var _0x4763e9=0x0,_0x5f18fe=events[_0xe9bd('0x5')];_0x4763e9<_0x5f18fe;_0x4763e9++){var _0xa66ae2=events[_0x4763e9];var _0x2d5c75=createListener(_0xe9bd('0x6')+_0xa66ae2,_0x4fd7b8);OpenchannelMessageEvents['on'](_0xa66ae2,_0x2d5c75);}}; \ No newline at end of file +var _0xac4a=['save','remove','update','removeListener','./openchannelMessage.events'];(function(_0x1331b2,_0x3df22b){var _0x10f741=function(_0x16e85e){while(--_0x16e85e){_0x1331b2['push'](_0x1331b2['shift']());}};_0x10f741(++_0x3df22b);}(_0xac4a,0x13f));var _0xaac4=function(_0x6e0d6d,_0x5a696e){_0x6e0d6d=_0x6e0d6d-0x0;var _0x35b8bc=_0xac4a[_0x6e0d6d];return _0x35b8bc;};'use strict';var OpenchannelMessageEvents=require(_0xaac4('0x0'));var events=[_0xaac4('0x1'),_0xaac4('0x2'),_0xaac4('0x3')];function createListener(_0x38f4f4,_0x1dc251){return function(_0x5aeb7d){_0x1dc251['emit'](_0x38f4f4,_0x5aeb7d);};}function removeListener(_0x2af0f6,_0x2a5762){return function(){OpenchannelMessageEvents[_0xaac4('0x4')](_0x2af0f6,_0x2a5762);};}exports['register']=function(_0x1283a5){for(var _0x53d03a=0x0,_0x1cdfc5=events['length'];_0x53d03a<_0x1cdfc5;_0x53d03a++){var _0x1e4283=events[_0x53d03a];var _0x27354c=createListener('openchannelMessage:'+_0x1e4283,_0x1283a5);OpenchannelMessageEvents['on'](_0x1e4283,_0x27354c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 25f80e4..e7d2579 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 _0x51f2=['describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x39de0c,_0x33efb4){var _0x161315=function(_0x1e752d){while(--_0x1e752d){_0x39de0c['push'](_0x39de0c['shift']());}};_0x161315(++_0x33efb4);}(_0x51f2,0xeb));var _0x251f=function(_0x17d9a0,_0x18e847){_0x17d9a0=_0x17d9a0-0x0;var _0x1f1420=_0x51f2[_0x17d9a0];return _0x1f1420;};'use strict';var multer=require(_0x251f('0x0'));var util=require(_0x251f('0x1'));var path=require(_0x251f('0x2'));var timeout=require(_0x251f('0x3'));var express=require(_0x251f('0x4'));var router=express[_0x251f('0x5')]();var auth=require(_0x251f('0x6'));var interaction=require(_0x251f('0x7'));var config=require(_0x251f('0x8'));var controller=require('./openchannelQueue.controller');router[_0x251f('0x9')]('/',auth[_0x251f('0xa')](),controller[_0x251f('0xb')]);router[_0x251f('0x9')](_0x251f('0xc'),auth['isAuthenticated'](),controller[_0x251f('0xd')]);router[_0x251f('0x9')](_0x251f('0xe'),auth[_0x251f('0xa')](),controller['show']);router[_0x251f('0x9')](_0x251f('0xf'),auth[_0x251f('0xa')](),controller[_0x251f('0x10')]);router['get'](_0x251f('0x11'),auth[_0x251f('0xa')](),controller[_0x251f('0x12')]);router[_0x251f('0x9')]('/:id/users',auth[_0x251f('0xa')](),controller[_0x251f('0x13')]);router[_0x251f('0x14')]('/',auth[_0x251f('0xa')](),controller[_0x251f('0x15')]);router[_0x251f('0x14')](_0x251f('0x11'),auth[_0x251f('0xa')](),controller[_0x251f('0x16')]);router[_0x251f('0x14')](_0x251f('0x17'),auth['isAuthenticated'](),controller[_0x251f('0x18')]);router[_0x251f('0x19')]('/:id',auth[_0x251f('0xa')](),controller[_0x251f('0x1a')]);router[_0x251f('0x1b')](_0x251f('0xe'),auth[_0x251f('0xa')](),controller['destroy']);router['delete'](_0x251f('0x11'),auth[_0x251f('0xa')](),controller[_0x251f('0x1c')]);router[_0x251f('0x1b')](_0x251f('0x17'),auth['isAuthenticated'](),controller[_0x251f('0x1d')]);module[_0x251f('0x1e')]=router; \ No newline at end of file +var _0xaaee=['/:id','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put'];(function(_0x188256,_0x29c445){var _0x493ee3=function(_0x55fbd5){while(--_0x55fbd5){_0x188256['push'](_0x188256['shift']());}};_0x493ee3(++_0x29c445);}(_0xaaee,0x132));var _0xeaae=function(_0x25d9f5,_0x3c9615){_0x25d9f5=_0x25d9f5-0x0;var _0x45f106=_0xaaee[_0x25d9f5];return _0x45f106;};'use strict';var multer=require(_0xeaae('0x0'));var util=require(_0xeaae('0x1'));var path=require(_0xeaae('0x2'));var timeout=require(_0xeaae('0x3'));var express=require(_0xeaae('0x4'));var router=express['Router']();var auth=require(_0xeaae('0x5'));var interaction=require(_0xeaae('0x6'));var config=require(_0xeaae('0x7'));var controller=require(_0xeaae('0x8'));router[_0xeaae('0x9')]('/',auth[_0xeaae('0xa')](),controller[_0xeaae('0xb')]);router[_0xeaae('0x9')](_0xeaae('0xc'),auth[_0xeaae('0xa')](),controller[_0xeaae('0xd')]);router[_0xeaae('0x9')]('/:id',auth[_0xeaae('0xa')](),controller[_0xeaae('0xe')]);router['get'](_0xeaae('0xf'),auth[_0xeaae('0xa')](),controller[_0xeaae('0x10')]);router[_0xeaae('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0xeaae('0x11')]);router[_0xeaae('0x9')]('/:id/users',auth[_0xeaae('0xa')](),controller[_0xeaae('0x12')]);router[_0xeaae('0x13')]('/',auth[_0xeaae('0xa')](),controller['create']);router[_0xeaae('0x13')]('/:id/teams',auth[_0xeaae('0xa')](),controller[_0xeaae('0x14')]);router[_0xeaae('0x13')](_0xeaae('0x15'),auth[_0xeaae('0xa')](),controller[_0xeaae('0x16')]);router[_0xeaae('0x17')](_0xeaae('0x18'),auth[_0xeaae('0xa')](),controller[_0xeaae('0x19')]);router[_0xeaae('0x1a')](_0xeaae('0x18'),auth[_0xeaae('0xa')](),controller['destroy']);router[_0xeaae('0x1a')]('/:id/teams',auth[_0xeaae('0xa')](),controller[_0xeaae('0x1b')]);router[_0xeaae('0x1a')](_0xeaae('0x15'),auth[_0xeaae('0xa')](),controller[_0xeaae('0x1c')]);module[_0xeaae('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 594a0ab..bb83209 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 _0xa884=['rrmemory','sequelize','exports','STRING','name'];(function(_0xb540ba,_0x22d81f){var _0x20b84c=function(_0x5249ef){while(--_0x5249ef){_0xb540ba['push'](_0xb540ba['shift']());}};_0x20b84c(++_0x22d81f);}(_0xa884,0x1b4));var _0x4a88=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0xa884[_0x71b765];return _0x34cb24;};'use strict';var Sequelize=require(_0x4a88('0x0'));module[_0x4a88('0x1')]={'name':{'type':Sequelize[_0x4a88('0x2')],'unique':_0x4a88('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4a88('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4a88('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x36e1=['STRING','INTEGER','ENUM','beepall','sequelize','exports'];(function(_0x605aca,_0xf78230){var _0x5700fb=function(_0x26c5f3){while(--_0x26c5f3){_0x605aca['push'](_0x605aca['shift']());}};_0x5700fb(++_0xf78230);}(_0x36e1,0xe2));var _0x136e=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0x36e1[_0x559a80];return _0x42f555;};'use strict';var Sequelize=require(_0x136e('0x0'));module[_0x136e('0x1')]={'name':{'type':Sequelize[_0x136e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x136e('0x2')]},'timeout':{'type':Sequelize[_0x136e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x136e('0x4')]('rrmemory',_0x136e('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 2bcdcf8..d09180c 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 _0xa923=['../../config/logger','api','redis','defaults','socket.io-emitter','register','sendStatus','status','json','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','OpenchannelQueue','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','UserId','openchannelPause','updatedAt','format','%s/%s','getTeams','ids','Team','Agents','online','interface','flatMap','sequelize','transaction','forEach','userOpenchannelQueue:save','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3a0a3a,_0x505db0){var _0x22b760=function(_0x5a5e5c){while(--_0x5a5e5c){_0x3a0a3a['push'](_0x3a0a3a['shift']());}};_0x22b760(++_0x505db0);}(_0xa923,0x17a));var _0x3a92=function(_0xb8a12,_0x49b2c8){_0xb8a12=_0xb8a12-0x0;var _0x1a950c=_0xa923[_0xb8a12];return _0x1a950c;};'use strict';var pdf=require(_0x3a92('0x0'));var emlformat=require(_0x3a92('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3a92('0x2'));var jsonpatch=require(_0x3a92('0x3'));var rp=require('request-promise');var moment=require(_0x3a92('0x4'));var BPromise=require(_0x3a92('0x5'));var Mustache=require('mustache');var util=require(_0x3a92('0x6'));var path=require(_0x3a92('0x7'));var sox=require(_0x3a92('0x8'));var csv=require(_0x3a92('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3a92('0xa'));var crypto=require(_0x3a92('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3a92('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3a92('0xd'));var Redis=require('ioredis');var authService=require(_0x3a92('0xe'));var qs=require(_0x3a92('0xf'));var as=require(_0x3a92('0x10'));var hardwareService=require(_0x3a92('0x11'));var logger=require(_0x3a92('0x12'))(_0x3a92('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3a92('0x14')]=_[_0x3a92('0x15')](config[_0x3a92('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a92('0x16'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x3a92('0x17')](socket);function respondWithStatusCode(_0x4fc5a0,_0x2e6599){_0x2e6599=_0x2e6599||0xcc;return function(_0x25c919){if(_0x25c919){return _0x4fc5a0[_0x3a92('0x18')](_0x2e6599);}return _0x4fc5a0[_0x3a92('0x19')](_0x2e6599)['end']();};}function respondWithResult(_0x5d8e48,_0x4c0cff){_0x4c0cff=_0x4c0cff||0xc8;return function(_0xac6f09){if(_0xac6f09){return _0x5d8e48[_0x3a92('0x19')](_0x4c0cff)[_0x3a92('0x1a')](_0xac6f09);}};}function respondWithFilteredResult(_0x290dbd,_0x404b6b){return function(_0x42347b){if(_0x42347b){var _0x29ab7c=_0x42347b['count'],_0xeb748=_0x404b6b['offset'],_0x542e12=_0x404b6b['offset']+_0x404b6b[_0x3a92('0x1b')],_0x28d4f;if(_0x542e12>=_0x29ab7c){_0x542e12=_0x29ab7c;_0x28d4f=0xc8;}else{_0x28d4f=0xce;}_0x290dbd['status'](_0x28d4f);return _0x290dbd[_0x3a92('0x1c')](_0x3a92('0x1d'),_0xeb748+'-'+_0x542e12+'/'+_0x29ab7c)[_0x3a92('0x1a')](_0x42347b);}return null;};}function patchUpdates(_0x3027c5){return function(_0x4ce717){try{jsonpatch[_0x3a92('0x1e')](_0x4ce717,_0x3027c5,!![]);}catch(_0x24e86e){return BPromise[_0x3a92('0x1f')](_0x24e86e);}return _0x4ce717['save']();};}function saveUpdates(_0x3b3554,_0x35c723){return function(_0x1eaa08){if(_0x1eaa08){return _0x1eaa08[_0x3a92('0x20')](_0x3b3554)[_0x3a92('0x21')](function(_0x5a9696){return _0x5a9696;});}return null;};}function removeEntity(_0x575d30,_0x5a2c22){return function(_0x2254ac){if(_0x2254ac){return _0x2254ac[_0x3a92('0x22')]()[_0x3a92('0x21')](function(){var _0x42a1d2=_0x2254ac[_0x3a92('0x23')]({'plain':!![]});var _0x40d3fe='OpenchannelQueues';return db[_0x3a92('0x24')][_0x3a92('0x22')]({'where':{'type':_0x40d3fe,'resourceId':_0x42a1d2['id']}})[_0x3a92('0x21')](function(){return _0x2254ac;});})['then'](function(){_0x575d30[_0x3a92('0x19')](0xcc)[_0x3a92('0x25')]();});}};}function handleEntityNotFound(_0x3176f4,_0x269831){return function(_0xc63dcb){if(!_0xc63dcb){_0x3176f4[_0x3a92('0x18')](0x194);}return _0xc63dcb;};}function handleError(_0x4f59ab,_0xcd4a7a){_0xcd4a7a=_0xcd4a7a||0x1f4;return function(_0x3801bb){logger[_0x3a92('0x26')](_0x3801bb[_0x3a92('0x27')]);if(_0x3801bb[_0x3a92('0x28')]){delete _0x3801bb[_0x3a92('0x28')];}_0x4f59ab['status'](_0xcd4a7a)[_0x3a92('0x29')](_0x3801bb);};}exports[_0x3a92('0x2a')]=function(_0x2d646a,_0xd1d8de){var _0x408743={},_0x412efb={},_0x588bce={'count':0x0,'rows':[]};var _0xc80798=_['map'](db[_0x3a92('0x2b')]['rawAttributes'],function(_0x5923e1){return{'name':_0x5923e1[_0x3a92('0x2c')],'type':_0x5923e1[_0x3a92('0x2d')][_0x3a92('0x2e')]};});_0x412efb['model']=_[_0x3a92('0x2f')](_0xc80798,'name');_0x412efb[_0x3a92('0x30')]=_['keys'](_0x2d646a['query']);_0x412efb[_0x3a92('0x31')]=_[_0x3a92('0x32')](_0x412efb['model'],_0x412efb['query']);_0x408743[_0x3a92('0x33')]=_[_0x3a92('0x32')](_0x412efb[_0x3a92('0x34')],qs[_0x3a92('0x35')](_0x2d646a['query']['fields']));_0x408743[_0x3a92('0x33')]=_0x408743[_0x3a92('0x33')]['length']?_0x408743[_0x3a92('0x33')]:_0x412efb['model'];if(!_0x2d646a[_0x3a92('0x30')][_0x3a92('0x36')](_0x3a92('0x37'))){_0x408743[_0x3a92('0x1b')]=qs['limit'](_0x2d646a['query'][_0x3a92('0x1b')]);_0x408743[_0x3a92('0x38')]=qs[_0x3a92('0x38')](_0x2d646a['query'][_0x3a92('0x38')]);}_0x408743[_0x3a92('0x39')]=qs[_0x3a92('0x3a')](_0x2d646a[_0x3a92('0x30')][_0x3a92('0x3a')]);_0x408743[_0x3a92('0x3b')]=qs['filters'](_[_0x3a92('0x3c')](_0x2d646a[_0x3a92('0x30')],_0x412efb['filters']),_0xc80798);if(_0x2d646a[_0x3a92('0x30')][_0x3a92('0x3d')]){_0x408743[_0x3a92('0x3b')]=_['merge'](_0x408743[_0x3a92('0x3b')],{'$or':_[_0x3a92('0x2f')](_0xc80798,function(_0x5226c1){if(_0x5226c1[_0x3a92('0x2d')]!=='VIRTUAL'){var _0x421e78={};_0x421e78[_0x5226c1[_0x3a92('0x28')]]={'$like':'%'+_0x2d646a[_0x3a92('0x30')][_0x3a92('0x3d')]+'%'};return _0x421e78;}})});}_0x408743=_[_0x3a92('0x3e')]({},_0x408743,_0x2d646a[_0x3a92('0x3f')]);var _0x1d2942={'where':_0x408743[_0x3a92('0x3b')]};return db[_0x3a92('0x2b')][_0x3a92('0x40')](_0x1d2942)[_0x3a92('0x21')](function(_0x3b47b2){_0x588bce['count']=_0x3b47b2;if(_0x2d646a[_0x3a92('0x30')][_0x3a92('0x41')]){_0x408743[_0x3a92('0x42')]=[{'all':!![]}];}return db[_0x3a92('0x2b')][_0x3a92('0x43')](_0x408743);})[_0x3a92('0x21')](function(_0x1fb4d0){_0x588bce[_0x3a92('0x44')]=_0x1fb4d0;return _0x588bce;})[_0x3a92('0x21')](respondWithFilteredResult(_0xd1d8de,_0x408743))[_0x3a92('0x45')](handleError(_0xd1d8de,null));};exports['show']=function(_0x129d54,_0x2a1489){var _0x5e7743={'raw':!![],'where':{'id':_0x129d54[_0x3a92('0x46')]['id']}},_0x1129ca={};_0x1129ca[_0x3a92('0x34')]=_[_0x3a92('0x47')](db['OpenchannelQueue'][_0x3a92('0x48')]);_0x1129ca['query']=_[_0x3a92('0x47')](_0x129d54['query']);_0x1129ca[_0x3a92('0x31')]=_['intersection'](_0x1129ca[_0x3a92('0x34')],_0x1129ca[_0x3a92('0x30')]);_0x5e7743['attributes']=_[_0x3a92('0x32')](_0x1129ca[_0x3a92('0x34')],qs['fields'](_0x129d54[_0x3a92('0x30')]['fields']));_0x5e7743[_0x3a92('0x33')]=_0x5e7743[_0x3a92('0x33')][_0x3a92('0x49')]?_0x5e7743[_0x3a92('0x33')]:_0x1129ca['model'];if(_0x129d54[_0x3a92('0x30')][_0x3a92('0x41')]){_0x5e7743['include']=[{'all':!![]}];}_0x5e7743=_[_0x3a92('0x3e')]({},_0x5e7743,_0x129d54[_0x3a92('0x3f')]);return db['OpenchannelQueue'][_0x3a92('0x4a')](_0x5e7743)[_0x3a92('0x21')](handleEntityNotFound(_0x2a1489,null))[_0x3a92('0x21')](respondWithResult(_0x2a1489,null))['catch'](handleError(_0x2a1489,null));};exports[_0x3a92('0x4b')]=function(_0x3c2b86,_0x324de2){return db[_0x3a92('0x2b')][_0x3a92('0x4b')](_0x3c2b86['body'],{})[_0x3a92('0x21')](function(_0x2a1140){var _0x34b267=_0x3c2b86[_0x3a92('0x4c')][_0x3a92('0x23')]({'plain':!![]});if(!_0x34b267)throw new Error(_0x3a92('0x4d'));if(_0x34b267[_0x3a92('0x4e')]===_0x3a92('0x4c')){var _0x6ddff6=_0x2a1140[_0x3a92('0x23')]({'plain':!![]});var _0xe4bca9='OpenchannelQueues';return db[_0x3a92('0x4f')][_0x3a92('0x4a')]({'where':{'name':_0xe4bca9,'userProfileId':_0x34b267[_0x3a92('0x50')]},'raw':!![]})['then'](function(_0x769f76){if(_0x769f76&&_0x769f76['autoAssociation']===0x0){return db[_0x3a92('0x24')][_0x3a92('0x4b')]({'name':_0x6ddff6[_0x3a92('0x28')],'resourceId':_0x6ddff6['id'],'type':_0x769f76[_0x3a92('0x28')],'sectionId':_0x769f76['id']},{})['then'](function(){return _0x2a1140;});}else{return _0x2a1140;}})['catch'](function(_0x1d409e){logger[_0x3a92('0x26')](_0x3a92('0x51'),_0x1d409e);throw _0x1d409e;});}return _0x2a1140;})[_0x3a92('0x21')](respondWithResult(_0x324de2,0xc9))[_0x3a92('0x45')](handleError(_0x324de2,null));};exports[_0x3a92('0x20')]=function(_0xa6659d,_0x58acda){if(_0xa6659d[_0x3a92('0x52')]['id']){delete _0xa6659d[_0x3a92('0x52')]['id'];}return db[_0x3a92('0x2b')]['find']({'where':{'id':_0xa6659d[_0x3a92('0x46')]['id']}})['then'](handleEntityNotFound(_0x58acda,null))['then'](saveUpdates(_0xa6659d['body'],null))[_0x3a92('0x21')](respondWithResult(_0x58acda,null))['catch'](handleError(_0x58acda,null));};exports[_0x3a92('0x22')]=function(_0x46a7f1,_0x45e2ba){return db['OpenchannelQueue'][_0x3a92('0x4a')]({'where':{'id':_0x46a7f1[_0x3a92('0x46')]['id']}})[_0x3a92('0x21')](handleEntityNotFound(_0x45e2ba,null))['then'](removeEntity(_0x45e2ba,null))[_0x3a92('0x45')](handleError(_0x45e2ba,null));};exports[_0x3a92('0x53')]=function(_0x3a18e7,_0x267b1b){return db[_0x3a92('0x2b')][_0x3a92('0x53')]()[_0x3a92('0x21')](respondWithResult(_0x267b1b,null))['catch'](handleError(_0x267b1b,null));};exports['getMembers']=function(_0x56851a,_0x2457aa,_0x34fb69){var _0x2a5ea9={'raw':!![],'where':{}},_0x47fe3a={},_0x5a5a1f;return db[_0x3a92('0x2b')][_0x3a92('0x54')]({'where':{'id':_0x56851a['params']['id']}})['then'](handleEntityNotFound(_0x2457aa,null))[_0x3a92('0x21')](function(_0x7ffb3d){if(_0x7ffb3d){_0x5a5a1f=_0x7ffb3d[_0x3a92('0x23')]({'plain':!![]});_0x47fe3a[_0x3a92('0x34')]=_['keys'](db[_0x3a92('0x55')][_0x3a92('0x48')]);_0x47fe3a[_0x3a92('0x30')]=_[_0x3a92('0x47')](_0x56851a[_0x3a92('0x30')]);_0x47fe3a[_0x3a92('0x31')]=_[_0x3a92('0x32')](_0x47fe3a[_0x3a92('0x34')],_0x47fe3a[_0x3a92('0x30')]);_0x2a5ea9['attributes']=_['intersection'](_0x47fe3a['model'],qs[_0x3a92('0x35')](_0x56851a[_0x3a92('0x30')][_0x3a92('0x35')]));_0x2a5ea9[_0x3a92('0x33')]=_0x2a5ea9[_0x3a92('0x33')][_0x3a92('0x49')]?_0x2a5ea9[_0x3a92('0x33')]:_0x47fe3a[_0x3a92('0x34')];if(!_0x56851a[_0x3a92('0x30')][_0x3a92('0x36')](_0x3a92('0x37'))){_0x2a5ea9[_0x3a92('0x1b')]=qs[_0x3a92('0x1b')](_0x56851a['query']['limit']);_0x2a5ea9['offset']=qs[_0x3a92('0x38')](_0x56851a[_0x3a92('0x30')][_0x3a92('0x38')]);}_0x2a5ea9[_0x3a92('0x39')]=qs[_0x3a92('0x3a')](_0x56851a[_0x3a92('0x30')]['sort']);_0x2a5ea9['where']=qs['filters'](_[_0x3a92('0x3c')](_0x56851a[_0x3a92('0x30')],_0x47fe3a[_0x3a92('0x31')]));_0x2a5ea9['where'][_0x3a92('0x56')]=_0x7ffb3d['id'];if(_0x56851a[_0x3a92('0x30')]['filter']){_0x2a5ea9[_0x3a92('0x3b')]=_[_0x3a92('0x3e')](_0x2a5ea9[_0x3a92('0x3b')],{'$or':_['map'](_0x2a5ea9[_0x3a92('0x33')],function(_0x32f615){var _0x2daf5d={};_0x2daf5d[_0x32f615]={'$like':'%'+_0x56851a[_0x3a92('0x30')][_0x3a92('0x3d')]+'%'};return _0x2daf5d;})});}_0x2a5ea9=_[_0x3a92('0x3e')]({},_0x2a5ea9,_0x56851a[_0x3a92('0x3f')]);return db['UserOpenchannelQueue'][_0x3a92('0x43')](_0x2a5ea9);}})['then'](function(_0x50e108){if(_0x50e108){return db[_0x3a92('0x57')]['findAndCountAll']({'where':{'id':_[_0x3a92('0x2f')](_0x50e108,_0x3a92('0x58')),'role':'agent'},'attributes':['id',_0x3a92('0x28'),_0x3a92('0x59'),_0x3a92('0x5a'),'createdAt']});}})[_0x3a92('0x21')](function(_0x19b271){if(_0x19b271){return{'count':_0x19b271[_0x3a92('0x40')],'rows':_[_0x3a92('0x2f')](_0x19b271['rows'],function(_0xab7adf){return{'membername':_0xab7adf[_0x3a92('0x28')],'UserId':_0xab7adf['id'],'queue_name':_0x5a5a1f[_0x3a92('0x28')],'OpenchannelQueueId':_0x5a5a1f['id'],'interface':util[_0x3a92('0x5b')](_0x3a92('0x5c'),'SIP',_0xab7adf[_0x3a92('0x28')]),'penalty':0x0,'paused':_0xab7adf[_0x3a92('0x59')],'createdAt':_0xab7adf['createdAt'],'updatedAt':_0xab7adf['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3a92('0x21')](respondWithFilteredResult(_0x2457aa,_0x2a5ea9))[_0x3a92('0x45')](handleError(_0x2457aa,null));};exports['getTeams']=function(_0x44add7,_0x1f0bd2,_0x30b666){var _0x16f102={};var _0x31d527={};var _0xd86647;var _0x23afc2;return db['OpenchannelQueue'][_0x3a92('0x54')]({'where':{'id':_0x44add7[_0x3a92('0x46')]['id']}})[_0x3a92('0x21')](handleEntityNotFound(_0x1f0bd2,null))[_0x3a92('0x21')](function(_0x1c8260){if(_0x1c8260){_0xd86647=_0x1c8260;_0x31d527['model']=_[_0x3a92('0x47')](db['Team']['rawAttributes']);_0x31d527[_0x3a92('0x30')]=_[_0x3a92('0x47')](_0x44add7['query']);_0x31d527[_0x3a92('0x31')]=_[_0x3a92('0x32')](_0x31d527[_0x3a92('0x34')],_0x31d527[_0x3a92('0x30')]);_0x16f102[_0x3a92('0x33')]=_[_0x3a92('0x32')](_0x31d527[_0x3a92('0x34')],qs[_0x3a92('0x35')](_0x44add7['query'][_0x3a92('0x35')]));_0x16f102['attributes']=_0x16f102[_0x3a92('0x33')][_0x3a92('0x49')]?_0x16f102['attributes']:_0x31d527['model'];_0x16f102['order']=qs[_0x3a92('0x3a')](_0x44add7[_0x3a92('0x30')][_0x3a92('0x3a')]);_0x16f102[_0x3a92('0x3b')]=qs[_0x3a92('0x31')](_[_0x3a92('0x3c')](_0x44add7[_0x3a92('0x30')],_0x31d527[_0x3a92('0x31')]));if(_0x44add7[_0x3a92('0x30')][_0x3a92('0x3d')]){_0x16f102[_0x3a92('0x3b')]=_[_0x3a92('0x3e')](_0x16f102[_0x3a92('0x3b')],{'$or':_['map'](_0x16f102[_0x3a92('0x33')],function(_0x32539b){var _0x5513fb={};_0x5513fb[_0x32539b]={'$like':'%'+_0x44add7[_0x3a92('0x30')]['filter']+'%'};return _0x5513fb;})});}_0x16f102=_[_0x3a92('0x3e')]({},_0x16f102,_0x44add7['options']);return _0xd86647['getTeams'](_0x16f102);}})[_0x3a92('0x21')](function(_0x554fb8){if(_0x554fb8){_0x23afc2=_0x554fb8[_0x3a92('0x49')];if(!_0x44add7['query']['hasOwnProperty'](_0x3a92('0x37'))){_0x16f102[_0x3a92('0x1b')]=qs[_0x3a92('0x1b')](_0x44add7[_0x3a92('0x30')][_0x3a92('0x1b')]);_0x16f102[_0x3a92('0x38')]=qs[_0x3a92('0x38')](_0x44add7['query'][_0x3a92('0x38')]);}return _0xd86647[_0x3a92('0x5d')](_0x16f102);}})['then'](function(_0xc21bec){if(_0xc21bec){return _0xc21bec?{'count':_0x23afc2,'rows':_0xc21bec}:null;}})[_0x3a92('0x21')](respondWithResult(_0x1f0bd2,null))[_0x3a92('0x45')](handleError(_0x1f0bd2,null));};exports['addTeams']=function(_0x97a540,_0x3fbdba,_0x4f7c13){var _0x385621=_0x97a540[_0x3a92('0x52')][_0x3a92('0x5e')];return db[_0x3a92('0x5f')][_0x3a92('0x43')]({'where':{'id':_0x385621},'attributes':['id'],'include':[{'model':db[_0x3a92('0x57')],'as':_0x3a92('0x60'),'attributes':['id',_0x3a92('0x28'),_0x3a92('0x61'),'voicePause',_0x3a92('0x62')],'raw':!![]}]})['then'](function(_0x98e444){if(_0x98e444){var _0x598563=_[_0x3a92('0x63')](_0x98e444,function(_0x2d24f8){var _0x41431c=_0x2d24f8['get']({'plain':!![]});return _0x41431c['Agents'];});return db[_0x3a92('0x2b')][_0x3a92('0x4a')]({'where':{'id':_0x97a540[_0x3a92('0x46')]['id']}})[_0x3a92('0x21')](function(_0x1e154e){return db[_0x3a92('0x64')][_0x3a92('0x65')](function(_0x44350d){return _0x1e154e['addTeams'](_0x385621,{'transaction':_0x44350d})[_0x3a92('0x21')](function(){return BPromise['each'](_0x598563,function(_0x10d161){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x10d161['id'],'OpenchannelQueueId':_0x97a540[_0x3a92('0x46')]['id']},'transaction':_0x44350d});});})[_0x3a92('0x21')](function(){_0x598563[_0x3a92('0x66')](function(_0x5c08c8){socket['emit'](_0x3a92('0x67'),{'UserId':_0x5c08c8['id'],'OpenchannelQueueId':_0x1e154e['id']});});});});});}})[_0x3a92('0x21')](respondWithStatusCode(_0x3fbdba,null))[_0x3a92('0x45')](handleError(_0x3fbdba,null));};exports['removeTeams']=function(_0x5f4034,_0x100df7,_0x247d3e){return db[_0x3a92('0x5f')]['findAll']({'where':{'id':_0x5f4034[_0x3a92('0x30')][_0x3a92('0x5e')]},'attributes':['id'],'include':[{'model':db[_0x3a92('0x57')],'as':_0x3a92('0x60'),'attributes':['id'],'raw':!![]}]})[_0x3a92('0x21')](handleEntityNotFound(_0x100df7,null))['then'](function(_0x50c551){var _0x14d34c=_[_0x3a92('0x2f')](_0x50c551,'id');var _0xb9bc91=[];var _0x4596e8=[];var _0x18a642=squel[_0x3a92('0x68')]();_0x18a642[_0x3a92('0x69')](_0x3a92('0x6a'))[_0x3a92('0x6b')](_0x3a92('0x6c'),'tq')[_0x3a92('0x6d')]('user_has_teams','ut',_0x3a92('0x6e'))[_0x3a92('0x3b')](_0x3a92('0x6f'),_0x5f4034[_0x3a92('0x46')]['id']);for(var _0x5b0ac9=0x0;_0x5b0ac9<_0x50c551[_0x3a92('0x49')];_0x5b0ac9+=0x1){let _0x48ce98=_0x50c551[_0x5b0ac9];for(var _0x34d0da=0x0;_0x34d0da<_0x48ce98[_0x3a92('0x60')][_0x3a92('0x49')];_0x34d0da+=0x1){let _0x3ca3d5=_0x48ce98[_0x3a92('0x60')][_0x34d0da];var _0x505ffc=_0x18a642['clone']();_0x505ffc[_0x3a92('0x3b')](_0x3a92('0x70'),_0x3ca3d5['id']);_0x4596e8[_0x3a92('0x71')](db[_0x3a92('0x64')][_0x3a92('0x30')](_0x505ffc[_0x3a92('0x72')](),{'type':db[_0x3a92('0x64')][_0x3a92('0x73')]['SELECT']})[_0x3a92('0x21')](function(_0x286aed){if(_0x286aed['length']===0x1){return _0x3ca3d5['id'];}else{var _0x406f73=_[_0x3a92('0x74')](_[_0x3a92('0x2f')](_0x286aed,_0x3a92('0x75')),function(_0x58a8c5){return _[_0x3a92('0x76')](_0x14d34c,_0x58a8c5);});if(_0x406f73){return _0x3ca3d5['id'];}}}));}}return BPromise[_0x3a92('0x77')](_0x4596e8)[_0x3a92('0x21')](function(_0x61ef6a){_0xb9bc91=_(_0xb9bc91)[_0x3a92('0x78')](_0x61ef6a)[_0x3a92('0x79')]()['value']();return db[_0x3a92('0x2b')]['find']({'where':{'id':_0x5f4034['params']['id']}})['then'](function(_0x2e5e49){return db[_0x3a92('0x64')]['transaction'](function(_0x9be808){return _0x2e5e49[_0x3a92('0x7a')](_0x5f4034[_0x3a92('0x30')][_0x3a92('0x5e')],{'transaction':_0x9be808})[_0x3a92('0x21')](function(){if(!_[_0x3a92('0x7b')](_0xb9bc91)){return _0x2e5e49[_0x3a92('0x7c')](_0xb9bc91,{'transaction':_0x9be808});}})['then'](function(){_0xb9bc91[_0x3a92('0x66')](function(_0x44d61b){socket['emit'](_0x3a92('0x7d'),{'UserId':_0x44d61b,'OpenchannelQueueId':_0x2e5e49['id']});});});});});});})[_0x3a92('0x21')](respondWithStatusCode(_0x100df7,null))[_0x3a92('0x45')](handleError(_0x100df7,null));};exports[_0x3a92('0x7e')]=function(_0x1f495e,_0x33606e,_0x79cbca){return db['OpenchannelQueue'][_0x3a92('0x4a')]({'where':{'id':_0x1f495e['params']['id']}})[_0x3a92('0x21')](handleEntityNotFound(_0x33606e,null))[_0x3a92('0x21')](function(_0x590547){if(_0x590547){return _0x590547[_0x3a92('0x7e')](_0x1f495e[_0x3a92('0x52')][_0x3a92('0x5e')],_[_0x3a92('0x7f')](_0x1f495e[_0x3a92('0x52')],[_0x3a92('0x5e'),'id'])||{})[_0x3a92('0x80')](function(_0x4c5c4b){for(var _0x1006b7=0x0;_0x1006b7<_0x1f495e[_0x3a92('0x52')][_0x3a92('0x5e')][_0x3a92('0x49')];_0x1006b7+=0x1){socket[_0x3a92('0x81')]('userOpenchannelQueue:save',{'UserId':_0x1f495e[_0x3a92('0x52')][_0x3a92('0x5e')][_0x1006b7],'OpenchannelQueueId':_0x1f495e[_0x3a92('0x46')]['id']});}return _0x4c5c4b;});}})[_0x3a92('0x21')](respondWithResult(_0x33606e,null))[_0x3a92('0x45')](handleError(_0x33606e,null));};exports[_0x3a92('0x7c')]=function(_0x3d439c,_0x4d21af,_0x20d554){return db[_0x3a92('0x2b')][_0x3a92('0x4a')]({'where':{'id':_0x3d439c[_0x3a92('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d21af,null))[_0x3a92('0x21')](function(_0x3986d6){if(_0x3986d6){return _0x3986d6['removeAgents'](_0x3d439c['query'][_0x3a92('0x5e')])[_0x3a92('0x21')](function(){if(_[_0x3a92('0x82')](_0x3d439c[_0x3a92('0x30')][_0x3a92('0x5e')])){for(var _0x4d0b24=0x0;_0x4d0b24<_0x3d439c[_0x3a92('0x30')][_0x3a92('0x5e')][_0x3a92('0x49')];_0x4d0b24+=0x1){socket[_0x3a92('0x81')](_0x3a92('0x7d'),{'UserId':Number(_0x3d439c[_0x3a92('0x30')][_0x3a92('0x5e')][_0x4d0b24]),'OpenchannelQueueId':Number(_0x3d439c[_0x3a92('0x46')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x3d439c[_0x3a92('0x30')]['ids']),'OpenchannelQueueId':Number(_0x3d439c[_0x3a92('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x4d21af,null))[_0x3a92('0x45')](handleError(_0x4d21af,null));};exports['getAgents']=function(_0x5cd985,_0x54de60,_0x388055){var _0x2d6e6b={};var _0xd2f24a={};var _0x5657aa;var _0x5b36c8;return db[_0x3a92('0x2b')][_0x3a92('0x54')]({'where':{'id':_0x5cd985[_0x3a92('0x46')]['id']}})['then'](handleEntityNotFound(_0x54de60,null))[_0x3a92('0x21')](function(_0x477bc8){if(_0x477bc8){_0x5657aa=_0x477bc8;_0xd2f24a[_0x3a92('0x34')]=_['keys'](db[_0x3a92('0x57')][_0x3a92('0x48')]);_0xd2f24a[_0x3a92('0x30')]=_[_0x3a92('0x47')](_0x5cd985[_0x3a92('0x30')]);_0xd2f24a['filters']=_[_0x3a92('0x32')](_0xd2f24a[_0x3a92('0x34')],_0xd2f24a[_0x3a92('0x30')]);_0x2d6e6b[_0x3a92('0x33')]=_[_0x3a92('0x32')](_0xd2f24a[_0x3a92('0x34')],qs[_0x3a92('0x35')](_0x5cd985['query'][_0x3a92('0x35')]));_0x2d6e6b[_0x3a92('0x33')]=_0x2d6e6b['attributes'][_0x3a92('0x49')]?_0x2d6e6b[_0x3a92('0x33')]:_0xd2f24a[_0x3a92('0x34')];_0x2d6e6b['order']=qs[_0x3a92('0x3a')](_0x5cd985[_0x3a92('0x30')][_0x3a92('0x3a')]);_0x2d6e6b[_0x3a92('0x3b')]=qs[_0x3a92('0x31')](_[_0x3a92('0x3c')](_0x5cd985[_0x3a92('0x30')],_0xd2f24a[_0x3a92('0x31')]));if(_0x5cd985[_0x3a92('0x30')]['filter']){_0x2d6e6b[_0x3a92('0x3b')]=_[_0x3a92('0x3e')](_0x2d6e6b[_0x3a92('0x3b')],{'$or':_[_0x3a92('0x2f')](_0x2d6e6b[_0x3a92('0x33')],function(_0x2a6444){var _0x1cecf1={};_0x1cecf1[_0x2a6444]={'$like':'%'+_0x5cd985[_0x3a92('0x30')][_0x3a92('0x3d')]+'%'};return _0x1cecf1;})});}_0x2d6e6b=_[_0x3a92('0x3e')]({},_0x2d6e6b,_0x5cd985[_0x3a92('0x3f')]);return _0x5657aa['getAgents'](_0x2d6e6b);}})['then'](function(_0x3daadd){if(_0x3daadd){_0x5b36c8=_0x3daadd[_0x3a92('0x49')];if(!_0x5cd985[_0x3a92('0x30')]['hasOwnProperty'](_0x3a92('0x37'))){_0x2d6e6b['limit']=qs['limit'](_0x5cd985[_0x3a92('0x30')][_0x3a92('0x1b')]);_0x2d6e6b[_0x3a92('0x38')]=qs[_0x3a92('0x38')](_0x5cd985[_0x3a92('0x30')]['offset']);}return _0x5657aa[_0x3a92('0x83')](_0x2d6e6b);}})[_0x3a92('0x21')](function(_0x262a38){if(_0x262a38){return _0x262a38?{'count':_0x5b36c8,'rows':_0x262a38}:null;}})['then'](respondWithResult(_0x54de60,null))[_0x3a92('0x45')](handleError(_0x54de60,null));}; \ No newline at end of file +var _0xe36f=['voicePause','interface','flatMap','sequelize','transaction','each','UserOpenchannelQueue','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','UserProfileResource','destroy','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','findOne','hasOwnProperty','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe36f,0x150));var _0xfe36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe36f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xfe36('0x0'));var emlformat=require(_0xfe36('0x1'));var rimraf=require(_0xfe36('0x2'));var zipdir=require(_0xfe36('0x3'));var jsonpatch=require(_0xfe36('0x4'));var rp=require(_0xfe36('0x5'));var moment=require(_0xfe36('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xfe36('0x7'));var util=require(_0xfe36('0x8'));var path=require(_0xfe36('0x9'));var sox=require('sox');var csv=require(_0xfe36('0xa'));var ejs=require(_0xfe36('0xb'));var fs=require('fs');var _=require(_0xfe36('0xc'));var squel=require(_0xfe36('0xd'));var crypto=require(_0xfe36('0xe'));var jsforce=require(_0xfe36('0xf'));var deskjs=require(_0xfe36('0x10'));var toCsv=require(_0xfe36('0xa'));var querystring=require(_0xfe36('0x11'));var Papa=require(_0xfe36('0x12'));var Redis=require(_0xfe36('0x13'));var authService=require(_0xfe36('0x14'));var qs=require(_0xfe36('0x15'));var as=require(_0xfe36('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe36('0x17'))(_0xfe36('0x18'));var utils=require(_0xfe36('0x19'));var config=require(_0xfe36('0x1a'));var licenseUtil=require(_0xfe36('0x1b'));var db=require(_0xfe36('0x1c'))['db'];config[_0xfe36('0x1d')]=_[_0xfe36('0x1e')](config['redis'],{'host':_0xfe36('0x1f'),'port':0x18eb});var socket=require(_0xfe36('0x20'))(new Redis(config[_0xfe36('0x1d')]));require(_0xfe36('0x21'))[_0xfe36('0x22')](socket);function respondWithStatusCode(_0x41c0e8,_0x4cd751){_0x4cd751=_0x4cd751||0xcc;return function(_0x26a744){if(_0x26a744){return _0x41c0e8[_0xfe36('0x23')](_0x4cd751);}return _0x41c0e8[_0xfe36('0x24')](_0x4cd751)[_0xfe36('0x25')]();};}function respondWithResult(_0x26a542,_0x26784d){_0x26784d=_0x26784d||0xc8;return function(_0x74aa4e){if(_0x74aa4e){return _0x26a542[_0xfe36('0x24')](_0x26784d)[_0xfe36('0x26')](_0x74aa4e);}};}function respondWithFilteredResult(_0x4c357d,_0x5e4089){return function(_0x470697){if(_0x470697){var _0x51e248=_0x470697[_0xfe36('0x27')],_0x37fe50=_0x5e4089[_0xfe36('0x28')],_0x1efeb1=_0x5e4089[_0xfe36('0x28')]+_0x5e4089['limit'],_0x3d26d8;if(_0x1efeb1>=_0x51e248){_0x1efeb1=_0x51e248;_0x3d26d8=0xc8;}else{_0x3d26d8=0xce;}_0x4c357d['status'](_0x3d26d8);return _0x4c357d[_0xfe36('0x29')](_0xfe36('0x2a'),_0x37fe50+'-'+_0x1efeb1+'/'+_0x51e248)['json'](_0x470697);}return null;};}function patchUpdates(_0x4b92ea){return function(_0x4d7dc8){try{jsonpatch[_0xfe36('0x2b')](_0x4d7dc8,_0x4b92ea,!![]);}catch(_0x5cce0f){return BPromise['reject'](_0x5cce0f);}return _0x4d7dc8[_0xfe36('0x2c')]();};}function saveUpdates(_0x4baf2f,_0x1bdebd){return function(_0x2cce00){if(_0x2cce00){return _0x2cce00[_0xfe36('0x2d')](_0x4baf2f)[_0xfe36('0x2e')](function(_0x735277){return _0x735277;});}return null;};}function removeEntity(_0x389f3a,_0x3de8d8){return function(_0x33bfed){if(_0x33bfed){return _0x33bfed['destroy']()[_0xfe36('0x2e')](function(){var _0x595c49=_0x33bfed['get']({'plain':!![]});var _0x1bdc52='OpenchannelQueues';return db[_0xfe36('0x2f')][_0xfe36('0x30')]({'where':{'type':_0x1bdc52,'resourceId':_0x595c49['id']}})[_0xfe36('0x2e')](function(){return _0x33bfed;});})['then'](function(){_0x389f3a[_0xfe36('0x24')](0xcc)[_0xfe36('0x25')]();});}};}function handleEntityNotFound(_0x1c554e,_0x244b91){return function(_0x4762a5){if(!_0x4762a5){_0x1c554e[_0xfe36('0x23')](0x194);}return _0x4762a5;};}function handleError(_0x29b974,_0x53c9f8){_0x53c9f8=_0x53c9f8||0x1f4;return function(_0x199835){logger['error'](_0x199835[_0xfe36('0x31')]);if(_0x199835[_0xfe36('0x32')]){delete _0x199835[_0xfe36('0x32')];}_0x29b974[_0xfe36('0x24')](_0x53c9f8)[_0xfe36('0x33')](_0x199835);};}exports[_0xfe36('0x34')]=function(_0x1e86d8,_0x2e201c){var _0x3021db={},_0x1df853={},_0x11039a={'count':0x0,'rows':[]};var _0x70ed1=_[_0xfe36('0x35')](db[_0xfe36('0x36')][_0xfe36('0x37')],function(_0x5e9133){return{'name':_0x5e9133[_0xfe36('0x38')],'type':_0x5e9133[_0xfe36('0x39')][_0xfe36('0x3a')]};});_0x1df853[_0xfe36('0x3b')]=_[_0xfe36('0x35')](_0x70ed1,_0xfe36('0x32'));_0x1df853[_0xfe36('0x3c')]=_[_0xfe36('0x3d')](_0x1e86d8[_0xfe36('0x3c')]);_0x1df853[_0xfe36('0x3e')]=_[_0xfe36('0x3f')](_0x1df853['model'],_0x1df853['query']);_0x3021db[_0xfe36('0x40')]=_[_0xfe36('0x3f')](_0x1df853[_0xfe36('0x3b')],qs[_0xfe36('0x41')](_0x1e86d8[_0xfe36('0x3c')]['fields']));_0x3021db[_0xfe36('0x40')]=_0x3021db[_0xfe36('0x40')]['length']?_0x3021db[_0xfe36('0x40')]:_0x1df853['model'];if(!_0x1e86d8['query']['hasOwnProperty'](_0xfe36('0x42'))){_0x3021db[_0xfe36('0x43')]=qs['limit'](_0x1e86d8[_0xfe36('0x3c')][_0xfe36('0x43')]);_0x3021db[_0xfe36('0x28')]=qs[_0xfe36('0x28')](_0x1e86d8[_0xfe36('0x3c')][_0xfe36('0x28')]);}_0x3021db[_0xfe36('0x44')]=qs[_0xfe36('0x45')](_0x1e86d8[_0xfe36('0x3c')]['sort']);_0x3021db[_0xfe36('0x46')]=qs[_0xfe36('0x3e')](_[_0xfe36('0x47')](_0x1e86d8[_0xfe36('0x3c')],_0x1df853['filters']),_0x70ed1);if(_0x1e86d8[_0xfe36('0x3c')]['filter']){_0x3021db['where']=_[_0xfe36('0x48')](_0x3021db['where'],{'$or':_['map'](_0x70ed1,function(_0x28dc3){if(_0x28dc3[_0xfe36('0x39')]!==_0xfe36('0x49')){var _0xea3051={};_0xea3051[_0x28dc3[_0xfe36('0x32')]]={'$like':'%'+_0x1e86d8[_0xfe36('0x3c')][_0xfe36('0x4a')]+'%'};return _0xea3051;}})});}_0x3021db=_['merge']({},_0x3021db,_0x1e86d8[_0xfe36('0x4b')]);var _0x29ac4b={'where':_0x3021db[_0xfe36('0x46')]};return db['OpenchannelQueue'][_0xfe36('0x27')](_0x29ac4b)[_0xfe36('0x2e')](function(_0x506fc4){_0x11039a[_0xfe36('0x27')]=_0x506fc4;if(_0x1e86d8[_0xfe36('0x3c')]['includeAll']){_0x3021db[_0xfe36('0x4c')]=[{'all':!![]}];}return db[_0xfe36('0x36')][_0xfe36('0x4d')](_0x3021db);})[_0xfe36('0x2e')](function(_0x42d29e){_0x11039a[_0xfe36('0x4e')]=_0x42d29e;return _0x11039a;})['then'](respondWithFilteredResult(_0x2e201c,_0x3021db))[_0xfe36('0x4f')](handleError(_0x2e201c,null));};exports[_0xfe36('0x50')]=function(_0x3b2b38,_0x43b5f7){var _0x16525b={'raw':!![],'where':{'id':_0x3b2b38[_0xfe36('0x51')]['id']}},_0x323c44={};_0x323c44[_0xfe36('0x3b')]=_[_0xfe36('0x3d')](db['OpenchannelQueue']['rawAttributes']);_0x323c44[_0xfe36('0x3c')]=_[_0xfe36('0x3d')](_0x3b2b38['query']);_0x323c44['filters']=_[_0xfe36('0x3f')](_0x323c44[_0xfe36('0x3b')],_0x323c44[_0xfe36('0x3c')]);_0x16525b[_0xfe36('0x40')]=_[_0xfe36('0x3f')](_0x323c44[_0xfe36('0x3b')],qs[_0xfe36('0x41')](_0x3b2b38[_0xfe36('0x3c')][_0xfe36('0x41')]));_0x16525b['attributes']=_0x16525b[_0xfe36('0x40')][_0xfe36('0x52')]?_0x16525b[_0xfe36('0x40')]:_0x323c44[_0xfe36('0x3b')];if(_0x3b2b38[_0xfe36('0x3c')]['includeAll']){_0x16525b[_0xfe36('0x4c')]=[{'all':!![]}];}_0x16525b=_[_0xfe36('0x48')]({},_0x16525b,_0x3b2b38[_0xfe36('0x4b')]);return db['OpenchannelQueue']['find'](_0x16525b)[_0xfe36('0x2e')](handleEntityNotFound(_0x43b5f7,null))[_0xfe36('0x2e')](respondWithResult(_0x43b5f7,null))['catch'](handleError(_0x43b5f7,null));};exports[_0xfe36('0x53')]=function(_0x366e80,_0x37d9e2){return db[_0xfe36('0x36')][_0xfe36('0x53')](_0x366e80[_0xfe36('0x54')],{})[_0xfe36('0x2e')](function(_0x271b51){var _0x4c7ca3=_0x366e80[_0xfe36('0x55')]['get']({'plain':!![]});if(!_0x4c7ca3)throw new Error(_0xfe36('0x56'));if(_0x4c7ca3[_0xfe36('0x57')]===_0xfe36('0x55')){var _0x2130e9=_0x271b51[_0xfe36('0x58')]({'plain':!![]});var _0x102859=_0xfe36('0x59');return db[_0xfe36('0x5a')]['find']({'where':{'name':_0x102859,'userProfileId':_0x4c7ca3[_0xfe36('0x5b')]},'raw':!![]})['then'](function(_0x179cd2){if(_0x179cd2&&_0x179cd2[_0xfe36('0x5c')]===0x0){return db['UserProfileResource'][_0xfe36('0x53')]({'name':_0x2130e9[_0xfe36('0x32')],'resourceId':_0x2130e9['id'],'type':_0x179cd2[_0xfe36('0x32')],'sectionId':_0x179cd2['id']},{})[_0xfe36('0x2e')](function(){return _0x271b51;});}else{return _0x271b51;}})[_0xfe36('0x4f')](function(_0x51cab2){logger['error'](_0xfe36('0x5d'),_0x51cab2);throw _0x51cab2;});}return _0x271b51;})['then'](respondWithResult(_0x37d9e2,0xc9))[_0xfe36('0x4f')](handleError(_0x37d9e2,null));};exports[_0xfe36('0x2d')]=function(_0x3aef9c,_0x59ff1b){if(_0x3aef9c[_0xfe36('0x54')]['id']){delete _0x3aef9c[_0xfe36('0x54')]['id'];}return db[_0xfe36('0x36')]['find']({'where':{'id':_0x3aef9c[_0xfe36('0x51')]['id']}})[_0xfe36('0x2e')](handleEntityNotFound(_0x59ff1b,null))[_0xfe36('0x2e')](saveUpdates(_0x3aef9c[_0xfe36('0x54')],null))[_0xfe36('0x2e')](respondWithResult(_0x59ff1b,null))['catch'](handleError(_0x59ff1b,null));};exports[_0xfe36('0x30')]=function(_0x3749fd,_0x335c7f){return db[_0xfe36('0x36')][_0xfe36('0x5e')]({'where':{'id':_0x3749fd[_0xfe36('0x51')]['id']}})[_0xfe36('0x2e')](handleEntityNotFound(_0x335c7f,null))[_0xfe36('0x2e')](removeEntity(_0x335c7f,null))[_0xfe36('0x4f')](handleError(_0x335c7f,null));};exports[_0xfe36('0x5f')]=function(_0x3f27db,_0x22de38){return db[_0xfe36('0x36')][_0xfe36('0x5f')]()[_0xfe36('0x2e')](respondWithResult(_0x22de38,null))[_0xfe36('0x4f')](handleError(_0x22de38,null));};exports[_0xfe36('0x60')]=function(_0x72e10,_0x135c44,_0x382000){var _0x3f6149={'raw':!![],'where':{}},_0x3dee07={},_0x30087c;return db[_0xfe36('0x36')][_0xfe36('0x61')]({'where':{'id':_0x72e10[_0xfe36('0x51')]['id']}})[_0xfe36('0x2e')](handleEntityNotFound(_0x135c44,null))['then'](function(_0x50ebe3){if(_0x50ebe3){_0x30087c=_0x50ebe3[_0xfe36('0x58')]({'plain':!![]});_0x3dee07[_0xfe36('0x3b')]=_[_0xfe36('0x3d')](db['UserOpenchannelQueue'][_0xfe36('0x37')]);_0x3dee07[_0xfe36('0x3c')]=_[_0xfe36('0x3d')](_0x72e10[_0xfe36('0x3c')]);_0x3dee07[_0xfe36('0x3e')]=_[_0xfe36('0x3f')](_0x3dee07[_0xfe36('0x3b')],_0x3dee07[_0xfe36('0x3c')]);_0x3f6149['attributes']=_[_0xfe36('0x3f')](_0x3dee07[_0xfe36('0x3b')],qs[_0xfe36('0x41')](_0x72e10['query'][_0xfe36('0x41')]));_0x3f6149[_0xfe36('0x40')]=_0x3f6149[_0xfe36('0x40')][_0xfe36('0x52')]?_0x3f6149['attributes']:_0x3dee07[_0xfe36('0x3b')];if(!_0x72e10[_0xfe36('0x3c')][_0xfe36('0x62')](_0xfe36('0x42'))){_0x3f6149[_0xfe36('0x43')]=qs[_0xfe36('0x43')](_0x72e10['query'][_0xfe36('0x43')]);_0x3f6149[_0xfe36('0x28')]=qs['offset'](_0x72e10['query'][_0xfe36('0x28')]);}_0x3f6149[_0xfe36('0x44')]=qs[_0xfe36('0x45')](_0x72e10[_0xfe36('0x3c')]['sort']);_0x3f6149[_0xfe36('0x46')]=qs['filters'](_[_0xfe36('0x47')](_0x72e10[_0xfe36('0x3c')],_0x3dee07[_0xfe36('0x3e')]));_0x3f6149['where']['OpenchannelQueueId']=_0x50ebe3['id'];if(_0x72e10[_0xfe36('0x3c')][_0xfe36('0x4a')]){_0x3f6149[_0xfe36('0x46')]=_['merge'](_0x3f6149[_0xfe36('0x46')],{'$or':_['map'](_0x3f6149[_0xfe36('0x40')],function(_0x32f0c1){var _0x496f27={};_0x496f27[_0x32f0c1]={'$like':'%'+_0x72e10[_0xfe36('0x3c')]['filter']+'%'};return _0x496f27;})});}_0x3f6149=_[_0xfe36('0x48')]({},_0x3f6149,_0x72e10[_0xfe36('0x4b')]);return db['UserOpenchannelQueue']['findAll'](_0x3f6149);}})['then'](function(_0x531857){if(_0x531857){return db['User'][_0xfe36('0x63')]({'where':{'id':_[_0xfe36('0x35')](_0x531857,_0xfe36('0x64')),'role':_0xfe36('0x65')},'attributes':['id','name',_0xfe36('0x66'),_0xfe36('0x67'),_0xfe36('0x68')]});}})[_0xfe36('0x2e')](function(_0x2d5e91){if(_0x2d5e91){return{'count':_0x2d5e91[_0xfe36('0x27')],'rows':_['map'](_0x2d5e91[_0xfe36('0x4e')],function(_0x4f5ae0){return{'membername':_0x4f5ae0[_0xfe36('0x32')],'UserId':_0x4f5ae0['id'],'queue_name':_0x30087c[_0xfe36('0x32')],'OpenchannelQueueId':_0x30087c['id'],'interface':util[_0xfe36('0x69')](_0xfe36('0x6a'),_0xfe36('0x6b'),_0x4f5ae0[_0xfe36('0x32')]),'penalty':0x0,'paused':_0x4f5ae0[_0xfe36('0x66')],'createdAt':_0x4f5ae0['createdAt'],'updatedAt':_0x4f5ae0[_0xfe36('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfe36('0x2e')](respondWithFilteredResult(_0x135c44,_0x3f6149))[_0xfe36('0x4f')](handleError(_0x135c44,null));};exports[_0xfe36('0x6c')]=function(_0x66857b,_0xef23f2,_0x2ab8d3){var _0x1a2b05={};var _0x44e6ef={};var _0x4aa58f;var _0x53ad1e;return db['OpenchannelQueue'][_0xfe36('0x61')]({'where':{'id':_0x66857b['params']['id']}})[_0xfe36('0x2e')](handleEntityNotFound(_0xef23f2,null))[_0xfe36('0x2e')](function(_0x50030d){if(_0x50030d){_0x4aa58f=_0x50030d;_0x44e6ef[_0xfe36('0x3b')]=_['keys'](db[_0xfe36('0x6d')][_0xfe36('0x37')]);_0x44e6ef[_0xfe36('0x3c')]=_['keys'](_0x66857b[_0xfe36('0x3c')]);_0x44e6ef[_0xfe36('0x3e')]=_[_0xfe36('0x3f')](_0x44e6ef[_0xfe36('0x3b')],_0x44e6ef[_0xfe36('0x3c')]);_0x1a2b05[_0xfe36('0x40')]=_['intersection'](_0x44e6ef['model'],qs['fields'](_0x66857b[_0xfe36('0x3c')][_0xfe36('0x41')]));_0x1a2b05['attributes']=_0x1a2b05[_0xfe36('0x40')][_0xfe36('0x52')]?_0x1a2b05['attributes']:_0x44e6ef[_0xfe36('0x3b')];_0x1a2b05[_0xfe36('0x44')]=qs['sort'](_0x66857b[_0xfe36('0x3c')][_0xfe36('0x45')]);_0x1a2b05[_0xfe36('0x46')]=qs[_0xfe36('0x3e')](_[_0xfe36('0x47')](_0x66857b[_0xfe36('0x3c')],_0x44e6ef[_0xfe36('0x3e')]));if(_0x66857b[_0xfe36('0x3c')]['filter']){_0x1a2b05[_0xfe36('0x46')]=_[_0xfe36('0x48')](_0x1a2b05['where'],{'$or':_['map'](_0x1a2b05['attributes'],function(_0x3fb27b){var _0x21676d={};_0x21676d[_0x3fb27b]={'$like':'%'+_0x66857b['query']['filter']+'%'};return _0x21676d;})});}_0x1a2b05=_[_0xfe36('0x48')]({},_0x1a2b05,_0x66857b[_0xfe36('0x4b')]);return _0x4aa58f[_0xfe36('0x6c')](_0x1a2b05);}})[_0xfe36('0x2e')](function(_0x142150){if(_0x142150){_0x53ad1e=_0x142150[_0xfe36('0x52')];if(!_0x66857b[_0xfe36('0x3c')][_0xfe36('0x62')](_0xfe36('0x42'))){_0x1a2b05[_0xfe36('0x43')]=qs[_0xfe36('0x43')](_0x66857b[_0xfe36('0x3c')][_0xfe36('0x43')]);_0x1a2b05[_0xfe36('0x28')]=qs[_0xfe36('0x28')](_0x66857b[_0xfe36('0x3c')][_0xfe36('0x28')]);}return _0x4aa58f['getTeams'](_0x1a2b05);}})[_0xfe36('0x2e')](function(_0xd5fcaa){if(_0xd5fcaa){return _0xd5fcaa?{'count':_0x53ad1e,'rows':_0xd5fcaa}:null;}})[_0xfe36('0x2e')](respondWithResult(_0xef23f2,null))[_0xfe36('0x4f')](handleError(_0xef23f2,null));};exports[_0xfe36('0x6e')]=function(_0x423b8f,_0x2b0ba,_0x24b736){var _0x30fc64=_0x423b8f[_0xfe36('0x54')][_0xfe36('0x6f')];return db['Team'][_0xfe36('0x4d')]({'where':{'id':_0x30fc64},'attributes':['id'],'include':[{'model':db[_0xfe36('0x70')],'as':_0xfe36('0x71'),'attributes':['id',_0xfe36('0x32'),'online',_0xfe36('0x72'),_0xfe36('0x73')],'raw':!![]}]})[_0xfe36('0x2e')](function(_0x430c95){if(_0x430c95){var _0x2acd31=_[_0xfe36('0x74')](_0x430c95,function(_0x4ee033){var _0x499d23=_0x4ee033['get']({'plain':!![]});return _0x499d23['Agents'];});return db[_0xfe36('0x36')]['find']({'where':{'id':_0x423b8f[_0xfe36('0x51')]['id']}})[_0xfe36('0x2e')](function(_0x4db55d){return db[_0xfe36('0x75')][_0xfe36('0x76')](function(_0x571144){return _0x4db55d[_0xfe36('0x6e')](_0x30fc64,{'transaction':_0x571144})[_0xfe36('0x2e')](function(){return BPromise[_0xfe36('0x77')](_0x2acd31,function(_0x149f72){return db[_0xfe36('0x78')][_0xfe36('0x79')]({'where':{'UserId':_0x149f72['id'],'OpenchannelQueueId':_0x423b8f[_0xfe36('0x51')]['id']},'transaction':_0x571144});});})[_0xfe36('0x2e')](function(){_0x2acd31[_0xfe36('0x7a')](function(_0x4cb2b1){socket['emit'](_0xfe36('0x7b'),{'UserId':_0x4cb2b1['id'],'OpenchannelQueueId':_0x4db55d['id']});});});});});}})['then'](respondWithStatusCode(_0x2b0ba,null))['catch'](handleError(_0x2b0ba,null));};exports[_0xfe36('0x7c')]=function(_0x51e46c,_0x5ce2f3,_0x3835e8){return db[_0xfe36('0x6d')]['findAll']({'where':{'id':_0x51e46c[_0xfe36('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfe36('0x70')],'as':_0xfe36('0x71'),'attributes':['id'],'raw':!![]}]})[_0xfe36('0x2e')](handleEntityNotFound(_0x5ce2f3,null))[_0xfe36('0x2e')](function(_0x3a5c7f){var _0x2cc4a6=_[_0xfe36('0x35')](_0x3a5c7f,'id');var _0x20107c=[];var _0x2a10f4=[];var _0x2dce76=squel[_0xfe36('0x7d')]();_0x2dce76['field'](_0xfe36('0x7e'))[_0xfe36('0x7f')](_0xfe36('0x80'),'tq')[_0xfe36('0x81')](_0xfe36('0x82'),'ut',_0xfe36('0x83'))[_0xfe36('0x46')](_0xfe36('0x84'),_0x51e46c[_0xfe36('0x51')]['id']);for(var _0x131e10=0x0;_0x131e10<_0x3a5c7f[_0xfe36('0x52')];_0x131e10+=0x1){let _0x152d8a=_0x3a5c7f[_0x131e10];for(var _0x44c055=0x0;_0x44c055<_0x152d8a[_0xfe36('0x71')]['length'];_0x44c055+=0x1){let _0x1c9ddc=_0x152d8a[_0xfe36('0x71')][_0x44c055];var _0x23f273=_0x2dce76['clone']();_0x23f273[_0xfe36('0x46')](_0xfe36('0x85'),_0x1c9ddc['id']);_0x2a10f4[_0xfe36('0x86')](db[_0xfe36('0x75')]['query'](_0x23f273[_0xfe36('0x87')](),{'type':db[_0xfe36('0x75')]['QueryTypes'][_0xfe36('0x88')]})[_0xfe36('0x2e')](function(_0x24af37){if(_0x24af37[_0xfe36('0x52')]===0x1){return _0x1c9ddc['id'];}else{var _0x41e4fc=_[_0xfe36('0x89')](_[_0xfe36('0x35')](_0x24af37,_0xfe36('0x8a')),function(_0x57cca4){return _[_0xfe36('0x8b')](_0x2cc4a6,_0x57cca4);});if(_0x41e4fc){return _0x1c9ddc['id'];}}}));}}return BPromise[_0xfe36('0x8c')](_0x2a10f4)[_0xfe36('0x2e')](function(_0xc3543c){_0x20107c=_(_0x20107c)[_0xfe36('0x8d')](_0xc3543c)['compact']()['value']();return db[_0xfe36('0x36')]['find']({'where':{'id':_0x51e46c[_0xfe36('0x51')]['id']}})[_0xfe36('0x2e')](function(_0x3940ad){return db[_0xfe36('0x75')][_0xfe36('0x76')](function(_0x402dbe){return _0x3940ad[_0xfe36('0x7c')](_0x51e46c[_0xfe36('0x3c')][_0xfe36('0x6f')],{'transaction':_0x402dbe})[_0xfe36('0x2e')](function(){if(!_['isEmpty'](_0x20107c)){return _0x3940ad[_0xfe36('0x8e')](_0x20107c,{'transaction':_0x402dbe});}})[_0xfe36('0x2e')](function(){_0x20107c[_0xfe36('0x7a')](function(_0x13a66f){socket[_0xfe36('0x8f')](_0xfe36('0x90'),{'UserId':_0x13a66f,'OpenchannelQueueId':_0x3940ad['id']});});});});});});})[_0xfe36('0x2e')](respondWithStatusCode(_0x5ce2f3,null))[_0xfe36('0x4f')](handleError(_0x5ce2f3,null));};exports['addAgents']=function(_0x1a7249,_0x27e8e5,_0x4b5df2){return db['OpenchannelQueue'][_0xfe36('0x5e')]({'where':{'id':_0x1a7249[_0xfe36('0x51')]['id']}})[_0xfe36('0x2e')](handleEntityNotFound(_0x27e8e5,null))[_0xfe36('0x2e')](function(_0x327c05){if(_0x327c05){return _0x327c05[_0xfe36('0x91')](_0x1a7249[_0xfe36('0x54')][_0xfe36('0x6f')],_[_0xfe36('0x92')](_0x1a7249[_0xfe36('0x54')],[_0xfe36('0x6f'),'id'])||{})[_0xfe36('0x93')](function(_0x3d1253){for(var _0x1b278a=0x0;_0x1b278a<_0x1a7249[_0xfe36('0x54')][_0xfe36('0x6f')][_0xfe36('0x52')];_0x1b278a+=0x1){socket[_0xfe36('0x8f')](_0xfe36('0x7b'),{'UserId':_0x1a7249['body']['ids'][_0x1b278a],'OpenchannelQueueId':_0x1a7249[_0xfe36('0x51')]['id']});}return _0x3d1253;});}})[_0xfe36('0x2e')](respondWithResult(_0x27e8e5,null))['catch'](handleError(_0x27e8e5,null));};exports[_0xfe36('0x8e')]=function(_0xa812e2,_0x7ac91e,_0x176a50){return db[_0xfe36('0x36')]['find']({'where':{'id':_0xa812e2[_0xfe36('0x51')]['id']}})[_0xfe36('0x2e')](handleEntityNotFound(_0x7ac91e,null))[_0xfe36('0x2e')](function(_0x4fa045){if(_0x4fa045){return _0x4fa045[_0xfe36('0x8e')](_0xa812e2['query'][_0xfe36('0x6f')])[_0xfe36('0x2e')](function(){if(_[_0xfe36('0x94')](_0xa812e2['query'][_0xfe36('0x6f')])){for(var _0x110596=0x0;_0x110596<_0xa812e2[_0xfe36('0x3c')][_0xfe36('0x6f')][_0xfe36('0x52')];_0x110596+=0x1){socket[_0xfe36('0x8f')]('userOpenchannelQueue:remove',{'UserId':Number(_0xa812e2[_0xfe36('0x3c')][_0xfe36('0x6f')][_0x110596]),'OpenchannelQueueId':Number(_0xa812e2[_0xfe36('0x51')]['id'])});}}else{socket[_0xfe36('0x8f')](_0xfe36('0x90'),{'UserId':Number(_0xa812e2[_0xfe36('0x3c')]['ids']),'OpenchannelQueueId':Number(_0xa812e2['params']['id'])});}});}})[_0xfe36('0x2e')](respondWithStatusCode(_0x7ac91e,null))[_0xfe36('0x4f')](handleError(_0x7ac91e,null));};exports[_0xfe36('0x95')]=function(_0x49e86c,_0x43ae10,_0x529075){var _0x2a5b91={};var _0xb503e5={};var _0x1e25b6;var _0x2b05a7;return db[_0xfe36('0x36')][_0xfe36('0x61')]({'where':{'id':_0x49e86c[_0xfe36('0x51')]['id']}})['then'](handleEntityNotFound(_0x43ae10,null))['then'](function(_0x13af88){if(_0x13af88){_0x1e25b6=_0x13af88;_0xb503e5[_0xfe36('0x3b')]=_[_0xfe36('0x3d')](db[_0xfe36('0x70')][_0xfe36('0x37')]);_0xb503e5[_0xfe36('0x3c')]=_[_0xfe36('0x3d')](_0x49e86c['query']);_0xb503e5['filters']=_[_0xfe36('0x3f')](_0xb503e5[_0xfe36('0x3b')],_0xb503e5[_0xfe36('0x3c')]);_0x2a5b91['attributes']=_[_0xfe36('0x3f')](_0xb503e5[_0xfe36('0x3b')],qs[_0xfe36('0x41')](_0x49e86c[_0xfe36('0x3c')][_0xfe36('0x41')]));_0x2a5b91[_0xfe36('0x40')]=_0x2a5b91['attributes'][_0xfe36('0x52')]?_0x2a5b91['attributes']:_0xb503e5[_0xfe36('0x3b')];_0x2a5b91['order']=qs[_0xfe36('0x45')](_0x49e86c[_0xfe36('0x3c')][_0xfe36('0x45')]);_0x2a5b91['where']=qs[_0xfe36('0x3e')](_['pick'](_0x49e86c[_0xfe36('0x3c')],_0xb503e5[_0xfe36('0x3e')]));if(_0x49e86c[_0xfe36('0x3c')]['filter']){_0x2a5b91[_0xfe36('0x46')]=_[_0xfe36('0x48')](_0x2a5b91[_0xfe36('0x46')],{'$or':_[_0xfe36('0x35')](_0x2a5b91['attributes'],function(_0x153fd2){var _0x209468={};_0x209468[_0x153fd2]={'$like':'%'+_0x49e86c[_0xfe36('0x3c')][_0xfe36('0x4a')]+'%'};return _0x209468;})});}_0x2a5b91=_[_0xfe36('0x48')]({},_0x2a5b91,_0x49e86c[_0xfe36('0x4b')]);return _0x1e25b6[_0xfe36('0x95')](_0x2a5b91);}})[_0xfe36('0x2e')](function(_0x1d89c0){if(_0x1d89c0){_0x2b05a7=_0x1d89c0[_0xfe36('0x52')];if(!_0x49e86c[_0xfe36('0x3c')][_0xfe36('0x62')](_0xfe36('0x42'))){_0x2a5b91[_0xfe36('0x43')]=qs[_0xfe36('0x43')](_0x49e86c[_0xfe36('0x3c')]['limit']);_0x2a5b91[_0xfe36('0x28')]=qs['offset'](_0x49e86c[_0xfe36('0x3c')]['offset']);}return _0x1e25b6[_0xfe36('0x95')](_0x2a5b91);}})[_0xfe36('0x2e')](function(_0x2085c1){if(_0x2085c1){return _0x2085c1?{'count':_0x2b05a7,'rows':_0x2085c1}:null;}})[_0xfe36('0x2e')](respondWithResult(_0x43ae10,null))['catch'](handleError(_0x43ae10,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 988b1cf..1f52343 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 _0x1f8c=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0x1f8c,0x11e));var _0xc1f8=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0x1f8c[_0x38ce4c];return _0x5d4544;};'use strict';var EventEmitter=require(_0xc1f8('0x0'));var OpenchannelQueue=require(_0xc1f8('0x1'))['db'][_0xc1f8('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc1f8('0x3')](0x0);var events={'afterCreate':_0xc1f8('0x4'),'afterUpdate':_0xc1f8('0x5'),'afterDestroy':_0xc1f8('0x6')};function emitEvent(_0x1cc535){return function(_0x3ec183,_0x2dc3c2,_0x2475af){OpenchannelQueueEvents[_0xc1f8('0x7')](_0x1cc535+':'+_0x3ec183['id'],_0x3ec183);OpenchannelQueueEvents['emit'](_0x1cc535,_0x3ec183);_0x2475af(null);};}for(var e in events){if(events[_0xc1f8('0x8')](e)){var event=events[e];OpenchannelQueue[_0xc1f8('0x9')](e,emitEvent(event));}}module[_0xc1f8('0xa')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x824b=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5d45a4,_0x380968){var _0x1466b1=function(_0x1a7e2e){while(--_0x1a7e2e){_0x5d45a4['push'](_0x5d45a4['shift']());}};_0x1466b1(++_0x380968);}(_0x824b,0xbb));var _0xb824=function(_0x1a0194,_0x51a7c8){_0x1a0194=_0x1a0194-0x0;var _0x4e28b3=_0x824b[_0x1a0194];return _0x4e28b3;};'use strict';var EventEmitter=require(_0xb824('0x0'));var OpenchannelQueue=require(_0xb824('0x1'))['db'][_0xb824('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb824('0x3')](0x0);var events={'afterCreate':_0xb824('0x4'),'afterUpdate':_0xb824('0x5'),'afterDestroy':_0xb824('0x6')};function emitEvent(_0x11336c){return function(_0x547a6d,_0x12246b,_0x344393){OpenchannelQueueEvents[_0xb824('0x7')](_0x11336c+':'+_0x547a6d['id'],_0x547a6d);OpenchannelQueueEvents[_0xb824('0x7')](_0x11336c,_0x547a6d);_0x344393(null);};}for(var e in events){if(events[_0xb824('0x8')](e)){var event=events[e];OpenchannelQueue[_0xb824('0x9')](e,emitEvent(event));}}module[_0xb824('0xa')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 6bce202..04c1d71 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 _0xb2d4=['OpenchannelQueue','openchannel_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0xb2d4,0x10a));var _0x4b2d=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xb2d4[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x4b2d('0x0'));var util=require('util');var logger=require(_0x4b2d('0x1'))('api');var moment=require(_0x4b2d('0x2'));var BPromise=require(_0x4b2d('0x3'));var rp=require(_0x4b2d('0x4'));var fs=require('fs');var path=require(_0x4b2d('0x5'));var rimraf=require(_0x4b2d('0x6'));var config=require(_0x4b2d('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x4b2d('0x8')]=function(_0x4b88a3,_0x5b0564){return _0x4b88a3[_0x4b2d('0x9')](_0x4b2d('0xa'),attributes,{'tableName':_0x4b2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f43=['bluebird','path','../../config/environment','exports','define','openchannel_queues','lodash','util','../../config/logger','moment'];(function(_0x43036b,_0x2d7816){var _0x25c868=function(_0x49d01e){while(--_0x49d01e){_0x43036b['push'](_0x43036b['shift']());}};_0x25c868(++_0x2d7816);}(_0x3f43,0x1e6));var _0x33f4=function(_0x58bb61,_0x1b31fd){_0x58bb61=_0x58bb61-0x0;var _0x11f4b8=_0x3f43[_0x58bb61];return _0x11f4b8;};'use strict';var _=require(_0x33f4('0x0'));var util=require(_0x33f4('0x1'));var logger=require(_0x33f4('0x2'))('api');var moment=require(_0x33f4('0x3'));var BPromise=require(_0x33f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33f4('0x5'));var rimraf=require('rimraf');var config=require(_0x33f4('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0x33f4('0x7')]=function(_0x5e1105,_0x1a6ae9){return _0x5e1105[_0x33f4('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x33f4('0x9'),'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 28c09dc..f605153 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 _0x34d8=['../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','map','model','include','then','find','where','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x212fcc,_0x1a8867){var _0x4d8190=function(_0x347f7b){while(--_0x347f7b){_0x212fcc['push'](_0x212fcc['shift']());}};_0x4d8190(++_0x1a8867);}(_0x34d8,0x69));var _0x834d=function(_0x223e27,_0x4b9133){_0x223e27=_0x223e27-0x0;var _0x35f4db=_0x34d8[_0x223e27];return _0x35f4db;};'use strict';var _=require(_0x834d('0x0'));var util=require('util');var moment=require(_0x834d('0x1'));var BPromise=require(_0x834d('0x2'));var rs=require(_0x834d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x834d('0x4'))['db'];var utils=require(_0x834d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x834d('0x6'));var jayson=require(_0x834d('0x7'));var client=jayson['client'][_0x834d('0x8')]({'port':0x232a});config[_0x834d('0x9')]=_['defaults'](config[_0x834d('0x9')],{'host':_0x834d('0xa'),'port':0x18eb});var socket=require(_0x834d('0xb'))(new Redis(config[_0x834d('0x9')]));require(_0x834d('0xc'))['register'](socket);function respondWithRpcPromise(_0x189df5,_0x60ee68,_0x24abda){return new BPromise(function(_0x589c0b,_0x972e68){return client[_0x834d('0xd')](_0x189df5,_0x24abda)['then'](function(_0x953504){logger[_0x834d('0xe')](_0x834d('0xf'),_0x60ee68,_0x834d('0x10'));logger[_0x834d('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x60ee68,_0x834d('0x10'),JSON[_0x834d('0x12')](_0x953504));if(_0x953504[_0x834d('0x13')]){if(_0x953504[_0x834d('0x13')][_0x834d('0x14')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x60ee68,_0x953504[_0x834d('0x13')][_0x834d('0x15')]);return _0x972e68(_0x953504[_0x834d('0x13')]['message']);}logger[_0x834d('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x60ee68,_0x953504[_0x834d('0x13')][_0x834d('0x15')]);return _0x589c0b(_0x953504[_0x834d('0x13')][_0x834d('0x15')]);}else{logger['info'](_0x834d('0xf'),_0x60ee68,_0x834d('0x10'));_0x589c0b(_0x953504['result'][_0x834d('0x15')]);}})[_0x834d('0x16')](function(_0x29ce70){logger[_0x834d('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x60ee68,_0x29ce70);_0x972e68(_0x29ce70);});});}exports[_0x834d('0x17')]=function(_0x3d7f5){var _0xa3c64a=this;return new Promise(function(_0x451035,_0x324352){return db[_0x834d('0x18')][_0x834d('0x19')]({'raw':_0x3d7f5[_0x834d('0x1a')]?_0x3d7f5[_0x834d('0x1a')][_0x834d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d7f5[_0x834d('0x1a')]?_0x3d7f5['options']['where']||null:null,'attributes':_0x3d7f5[_0x834d('0x1a')]?_0x3d7f5[_0x834d('0x1a')][_0x834d('0x1c')]||null:null,'limit':_0x3d7f5[_0x834d('0x1a')]?_0x3d7f5[_0x834d('0x1a')][_0x834d('0x1d')]||null:null,'include':_0x3d7f5[_0x834d('0x1a')]?_0x3d7f5[_0x834d('0x1a')]['include']?_[_0x834d('0x1e')](_0x3d7f5[_0x834d('0x1a')]['include'],function(_0x159c74){return{'model':db[_0x159c74[_0x834d('0x1f')]],'as':_0x159c74['as'],'attributes':_0x159c74[_0x834d('0x1c')],'include':_0x159c74[_0x834d('0x20')]?_['map'](_0x159c74[_0x834d('0x20')],function(_0x31d356){return{'model':db[_0x31d356[_0x834d('0x1f')]],'as':_0x31d356['as'],'attributes':_0x31d356[_0x834d('0x1c')],'include':_0x31d356['include']?_[_0x834d('0x1e')](_0x31d356[_0x834d('0x20')],function(_0x443808){return{'model':db[_0x443808[_0x834d('0x1f')]],'as':_0x443808['as'],'attributes':_0x443808[_0x834d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x834d('0x21')](function(_0x5490a1){logger[_0x834d('0xe')](_0x834d('0x17'),_0x3d7f5);logger[_0x834d('0x11')]('GetOpenchannelQueue',_0x3d7f5,JSON[_0x834d('0x12')](_0x5490a1));_0x451035(_0x5490a1);})['catch'](function(_0xd54f3f){logger[_0x834d('0x13')](_0x834d('0x17'),_0xd54f3f[_0x834d('0x15')],_0x3d7f5);_0x324352(_0xa3c64a[_0x834d('0x13')](0x1f4,_0xd54f3f[_0x834d('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x19ba12){var _0x5d3c30=this;return new Promise(function(_0x4740e0,_0x5d223d){return db[_0x834d('0x18')][_0x834d('0x22')]({'raw':_0x19ba12[_0x834d('0x1a')]?_0x19ba12[_0x834d('0x1a')][_0x834d('0x1b')]===undefined?!![]:![]:!![],'where':_0x19ba12[_0x834d('0x1a')]?_0x19ba12[_0x834d('0x1a')][_0x834d('0x23')]||null:null,'attributes':_0x19ba12[_0x834d('0x1a')]?_0x19ba12[_0x834d('0x1a')][_0x834d('0x1c')]||null:null,'include':_0x19ba12[_0x834d('0x1a')]?_0x19ba12[_0x834d('0x1a')][_0x834d('0x20')]?_[_0x834d('0x1e')](_0x19ba12[_0x834d('0x1a')][_0x834d('0x20')],function(_0x5115a7){return{'model':db[_0x5115a7[_0x834d('0x1f')]],'as':_0x5115a7['as'],'attributes':_0x5115a7[_0x834d('0x1c')],'include':_0x5115a7[_0x834d('0x20')]?_[_0x834d('0x1e')](_0x5115a7[_0x834d('0x20')],function(_0x4a2b66){return{'model':db[_0x4a2b66[_0x834d('0x1f')]],'as':_0x4a2b66['as'],'attributes':_0x4a2b66['attributes'],'include':_0x4a2b66['include']?_[_0x834d('0x1e')](_0x4a2b66[_0x834d('0x20')],function(_0x1f409e){return{'model':db[_0x1f409e['model']],'as':_0x1f409e['as'],'attributes':_0x1f409e[_0x834d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x834d('0x21')](function(_0x2c31e2){logger[_0x834d('0xe')](_0x834d('0x24'),_0x19ba12);logger[_0x834d('0x11')](_0x834d('0x24'),_0x19ba12,JSON[_0x834d('0x12')](_0x2c31e2));_0x4740e0(_0x2c31e2);})[_0x834d('0x16')](function(_0x55026d){logger[_0x834d('0x13')]('ShowOpenchannelQueue',_0x55026d[_0x834d('0x15')],_0x19ba12);_0x5d223d(_0x5d3c30[_0x834d('0x13')](0x1f4,_0x55026d['message']));});});}; \ No newline at end of file +var _0xe7e1=['redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetOpenchannelQueue','findAll','options','where','attributes','include','map','model','debug','stringify','ShowOpenchannelQueue','OpenchannelQueue','find','raw','lodash','moment','randomstring','ioredis','../../config/logger','client'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0xe7e1,0x1b4));var _0x1e7e=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xe7e1[_0x576170];return _0x397c70;};'use strict';var _=require(_0x1e7e('0x0'));var util=require('util');var moment=require(_0x1e7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e7e('0x2'));var fs=require('fs');var Redis=require(_0x1e7e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1e7e('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1e7e('0x5')]['http']({'port':0x232a});config[_0x1e7e('0x6')]=_[_0x1e7e('0x7')](config[_0x1e7e('0x6')],{'host':_0x1e7e('0x8'),'port':0x18eb});var socket=require(_0x1e7e('0x9'))(new Redis(config[_0x1e7e('0x6')]));require(_0x1e7e('0xa'))[_0x1e7e('0xb')](socket);function respondWithRpcPromise(_0x7d540c,_0x33f545,_0x5be08a){return new BPromise(function(_0x1f7b39,_0x2d9520){return client['request'](_0x7d540c,_0x5be08a)[_0x1e7e('0xc')](function(_0x166401){logger[_0x1e7e('0xd')](_0x1e7e('0xe'),_0x33f545,'request\x20sent');logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x33f545,_0x1e7e('0xf'),JSON['stringify'](_0x166401));if(_0x166401[_0x1e7e('0x10')]){if(_0x166401[_0x1e7e('0x10')][_0x1e7e('0x11')]===0x1f4){logger[_0x1e7e('0x10')](_0x1e7e('0xe'),_0x33f545,_0x166401[_0x1e7e('0x10')]['message']);return _0x2d9520(_0x166401[_0x1e7e('0x10')][_0x1e7e('0x12')]);}logger[_0x1e7e('0x10')](_0x1e7e('0xe'),_0x33f545,_0x166401[_0x1e7e('0x10')]['message']);return _0x1f7b39(_0x166401[_0x1e7e('0x10')][_0x1e7e('0x12')]);}else{logger[_0x1e7e('0xd')](_0x1e7e('0xe'),_0x33f545,'request\x20sent');_0x1f7b39(_0x166401['result'][_0x1e7e('0x12')]);}})[_0x1e7e('0x13')](function(_0x19d61e){logger[_0x1e7e('0x10')](_0x1e7e('0xe'),_0x33f545,_0x19d61e);_0x2d9520(_0x19d61e);});});}exports[_0x1e7e('0x14')]=function(_0xbedd10){var _0x4c54db=this;return new Promise(function(_0x491629,_0x349336){return db['OpenchannelQueue'][_0x1e7e('0x15')]({'raw':_0xbedd10[_0x1e7e('0x16')]?_0xbedd10['options']['raw']===undefined?!![]:![]:!![],'where':_0xbedd10['options']?_0xbedd10[_0x1e7e('0x16')][_0x1e7e('0x17')]||null:null,'attributes':_0xbedd10[_0x1e7e('0x16')]?_0xbedd10['options'][_0x1e7e('0x18')]||null:null,'limit':_0xbedd10['options']?_0xbedd10[_0x1e7e('0x16')]['limit']||null:null,'include':_0xbedd10[_0x1e7e('0x16')]?_0xbedd10['options'][_0x1e7e('0x19')]?_[_0x1e7e('0x1a')](_0xbedd10[_0x1e7e('0x16')][_0x1e7e('0x19')],function(_0x3f0db3){return{'model':db[_0x3f0db3['model']],'as':_0x3f0db3['as'],'attributes':_0x3f0db3[_0x1e7e('0x18')],'include':_0x3f0db3[_0x1e7e('0x19')]?_[_0x1e7e('0x1a')](_0x3f0db3[_0x1e7e('0x19')],function(_0x26ac08){return{'model':db[_0x26ac08['model']],'as':_0x26ac08['as'],'attributes':_0x26ac08[_0x1e7e('0x18')],'include':_0x26ac08[_0x1e7e('0x19')]?_['map'](_0x26ac08[_0x1e7e('0x19')],function(_0x661481){return{'model':db[_0x661481[_0x1e7e('0x1b')]],'as':_0x661481['as'],'attributes':_0x661481[_0x1e7e('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31f955){logger[_0x1e7e('0xd')](_0x1e7e('0x14'),_0xbedd10);logger[_0x1e7e('0x1c')](_0x1e7e('0x14'),_0xbedd10,JSON[_0x1e7e('0x1d')](_0x31f955));_0x491629(_0x31f955);})[_0x1e7e('0x13')](function(_0x4a4bc6){logger[_0x1e7e('0x10')](_0x1e7e('0x14'),_0x4a4bc6['message'],_0xbedd10);_0x349336(_0x4c54db[_0x1e7e('0x10')](0x1f4,_0x4a4bc6[_0x1e7e('0x12')]));});});};exports[_0x1e7e('0x1e')]=function(_0x3a8f4d){var _0x3a7591=this;return new Promise(function(_0x1f9bdc,_0x4f84c9){return db[_0x1e7e('0x1f')][_0x1e7e('0x20')]({'raw':_0x3a8f4d[_0x1e7e('0x16')]?_0x3a8f4d[_0x1e7e('0x16')][_0x1e7e('0x21')]===undefined?!![]:![]:!![],'where':_0x3a8f4d[_0x1e7e('0x16')]?_0x3a8f4d[_0x1e7e('0x16')]['where']||null:null,'attributes':_0x3a8f4d[_0x1e7e('0x16')]?_0x3a8f4d[_0x1e7e('0x16')][_0x1e7e('0x18')]||null:null,'include':_0x3a8f4d[_0x1e7e('0x16')]?_0x3a8f4d[_0x1e7e('0x16')][_0x1e7e('0x19')]?_[_0x1e7e('0x1a')](_0x3a8f4d['options'][_0x1e7e('0x19')],function(_0x4c3aa8){return{'model':db[_0x4c3aa8['model']],'as':_0x4c3aa8['as'],'attributes':_0x4c3aa8[_0x1e7e('0x18')],'include':_0x4c3aa8['include']?_[_0x1e7e('0x1a')](_0x4c3aa8['include'],function(_0x3c3355){return{'model':db[_0x3c3355['model']],'as':_0x3c3355['as'],'attributes':_0x3c3355[_0x1e7e('0x18')],'include':_0x3c3355['include']?_[_0x1e7e('0x1a')](_0x3c3355[_0x1e7e('0x19')],function(_0x4e1c21){return{'model':db[_0x4e1c21['model']],'as':_0x4e1c21['as'],'attributes':_0x4e1c21[_0x1e7e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1e7e('0xc')](function(_0x183b42){logger[_0x1e7e('0xd')](_0x1e7e('0x1e'),_0x3a8f4d);logger[_0x1e7e('0x1c')]('ShowOpenchannelQueue',_0x3a8f4d,JSON[_0x1e7e('0x1d')](_0x183b42));_0x1f9bdc(_0x183b42);})['catch'](function(_0x271d94){logger['error']('ShowOpenchannelQueue',_0x271d94[_0x1e7e('0x12')],_0x3a8f4d);_0x4f84c9(_0x3a7591['error'](0x1f4,_0x271d94[_0x1e7e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 5b0ef79..6cf6ea0 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 _0x7938=['emit','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x4af3fb,_0x210d00){var _0x2fff9d=function(_0x2bac78){while(--_0x2bac78){_0x4af3fb['push'](_0x4af3fb['shift']());}};_0x2fff9d(++_0x210d00);}(_0x7938,0xd6));var _0x8793=function(_0x28f156,_0xd6ecbc){_0x28f156=_0x28f156-0x0;var _0x5276e8=_0x7938[_0x28f156];return _0x5276e8;};'use strict';var OpenchannelQueueEvents=require(_0x8793('0x0'));var events=[_0x8793('0x1'),'remove','update'];function createListener(_0xefcd77,_0x3101f7){return function(_0x4e7c75){_0x3101f7[_0x8793('0x2')](_0xefcd77,_0x4e7c75);};}function removeListener(_0x219344,_0x14bc9f){return function(){OpenchannelQueueEvents['removeListener'](_0x219344,_0x14bc9f);};}exports[_0x8793('0x3')]=function(_0x2dfa65){for(var _0x5a8291=0x0,_0x590949=events[_0x8793('0x4')];_0x5a8291<_0x590949;_0x5a8291++){var _0x315ded=events[_0x5a8291];var _0x1a6bf6=createListener(_0x8793('0x5')+_0x315ded,_0x2dfa65);OpenchannelQueueEvents['on'](_0x315ded,_0x1a6bf6);}}; \ No newline at end of file +var _0x3c9c=['register','length','openchannelQueue:','save','remove','update','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3c9c,0x130));var _0xc3c9=function(_0x2c05ee,_0x3ee59b){_0x2c05ee=_0x2c05ee-0x0;var _0x108382=_0x3c9c[_0x2c05ee];return _0x108382;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xc3c9('0x0'),_0xc3c9('0x1'),_0xc3c9('0x2')];function createListener(_0x24ec7f,_0x55629e){return function(_0x18838a){_0x55629e['emit'](_0x24ec7f,_0x18838a);};}function removeListener(_0x3daf5d,_0x3be34a){return function(){OpenchannelQueueEvents[_0xc3c9('0x3')](_0x3daf5d,_0x3be34a);};}exports[_0xc3c9('0x4')]=function(_0x2f3ce7){for(var _0x27cbe7=0x0,_0x46c050=events[_0xc3c9('0x5')];_0x27cbe7<_0x46c050;_0x27cbe7++){var _0x56796c=events[_0x27cbe7];var _0xea58a4=createListener(_0xc3c9('0x6')+_0x56796c,_0x2f3ce7);OpenchannelQueueEvents['on'](_0x56796c,_0xea58a4);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index de9cc80..f8fc15f 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 _0x7db0=['multer','util','connect-timeout','express','Router','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0xfc478,_0x171be9){var _0x41375d=function(_0x44f136){while(--_0x44f136){_0xfc478['push'](_0xfc478['shift']());}};_0x41375d(++_0x171be9);}(_0x7db0,0x64));var _0x07db=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0x7db0[_0x1a1b6e];return _0x571e2c;};'use strict';var multer=require(_0x07db('0x0'));var util=require(_0x07db('0x1'));var path=require('path');var timeout=require(_0x07db('0x2'));var express=require(_0x07db('0x3'));var router=express[_0x07db('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x07db('0x5'));var controller=require(_0x07db('0x6'));router['get']('/',auth[_0x07db('0x7')](),controller[_0x07db('0x8')]);router[_0x07db('0x9')](_0x07db('0xa'),auth[_0x07db('0x7')](),controller[_0x07db('0xb')]);router[_0x07db('0x9')](_0x07db('0xc'),auth['isAuthenticated'](),controller[_0x07db('0xd')]);router['post']('/',auth[_0x07db('0x7')](),controller[_0x07db('0xe')]);router[_0x07db('0xf')](_0x07db('0xc'),auth[_0x07db('0x7')](),controller[_0x07db('0x10')]);router[_0x07db('0x11')](_0x07db('0xc'),auth[_0x07db('0x7')](),controller[_0x07db('0x12')]);module[_0x07db('0x13')]=router; \ No newline at end of file +var _0x8e70=['/describe','show','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x3fd05f,_0x3d00dd){var _0x4141e8=function(_0x5183e7){while(--_0x5183e7){_0x3fd05f['push'](_0x3fd05f['shift']());}};_0x4141e8(++_0x3d00dd);}(_0x8e70,0x9c));var _0x08e7=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x8e70[_0x3740fe];return _0x55492b;};'use strict';var multer=require(_0x08e7('0x0'));var util=require(_0x08e7('0x1'));var path=require('path');var timeout=require(_0x08e7('0x2'));var express=require(_0x08e7('0x3'));var router=express[_0x08e7('0x4')]();var auth=require(_0x08e7('0x5'));var interaction=require(_0x08e7('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0x08e7('0x7')]('/',auth[_0x08e7('0x8')](),controller['index']);router[_0x08e7('0x7')](_0x08e7('0x9'),auth[_0x08e7('0x8')](),controller['describe']);router[_0x08e7('0x7')]('/:id',auth[_0x08e7('0x8')](),controller[_0x08e7('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x08e7('0xb')]);router[_0x08e7('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x08e7('0xd')]('/:id',auth[_0x08e7('0x8')](),controller['destroy']);module[_0x08e7('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 43d98d4..30bf51b 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 _0x3882=['STRING','DATE','moment','sequelize','exports'];(function(_0x68c24f,_0x1eeec8){var _0xf3d83c=function(_0x45ca6e){while(--_0x45ca6e){_0x68c24f['push'](_0x68c24f['shift']());}};_0xf3d83c(++_0x1eeec8);}(_0x3882,0x89));var _0x2388=function(_0x140715,_0x2486ff){_0x140715=_0x140715-0x0;var _0x1324a0=_0x3882[_0x140715];return _0x1324a0;};'use strict';var moment=require(_0x2388('0x0'));var Sequelize=require(_0x2388('0x1'));module[_0x2388('0x2')]={'uniqueid':{'type':Sequelize[_0x2388('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2388('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2388('0x4')]},'exitAt':{'type':Sequelize[_0x2388('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3e8a=['sequelize','STRING','DATE'];(function(_0x5edda1,_0x9bbca5){var _0x5dc30d=function(_0x569a21){while(--_0x569a21){_0x5edda1['push'](_0x5edda1['shift']());}};_0x5dc30d(++_0x9bbca5);}(_0x3e8a,0x1c5));var _0xa3e8=function(_0xad4fb7,_0x1a9e71){_0xad4fb7=_0xad4fb7-0x0;var _0x14828b=_0x3e8a[_0xad4fb7];return _0x14828b;};'use strict';var moment=require('moment');var Sequelize=require(_0xa3e8('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa3e8('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xa3e8('0x1')]},'joinAt':{'type':Sequelize[_0xa3e8('0x2')]},'leaveAt':{'type':Sequelize[_0xa3e8('0x2')]},'acceptAt':{'type':Sequelize[_0xa3e8('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 53dbcd3..a9bd161 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 _0x3a32=['rows','catch','show','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x2ea6c4,_0x5bb790){var _0x33200f=function(_0x4981ef){while(--_0x4981ef){_0x2ea6c4['push'](_0x2ea6c4['shift']());}};_0x33200f(++_0x5bb790);}(_0x3a32,0x9b));var _0x23a3=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x3a32[_0x53cf8e];return _0x459197;};'use strict';var pdf=require(_0x23a3('0x0'));var emlformat=require(_0x23a3('0x1'));var rimraf=require(_0x23a3('0x2'));var zipdir=require(_0x23a3('0x3'));var jsonpatch=require(_0x23a3('0x4'));var rp=require(_0x23a3('0x5'));var moment=require(_0x23a3('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x23a3('0x7'));var path=require(_0x23a3('0x8'));var sox=require('sox');var csv=require(_0x23a3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x23a3('0xa'));var squel=require(_0x23a3('0xb'));var crypto=require(_0x23a3('0xc'));var jsforce=require(_0x23a3('0xd'));var deskjs=require(_0x23a3('0xe'));var toCsv=require(_0x23a3('0x9'));var querystring=require('querystring');var Papa=require(_0x23a3('0xf'));var Redis=require(_0x23a3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x23a3('0x11'));var hardwareService=require(_0x23a3('0x12'));var logger=require(_0x23a3('0x13'))('api');var utils=require(_0x23a3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x23a3('0x15'));var db=require(_0x23a3('0x16'))['db'];function respondWithStatusCode(_0x1ebeae,_0x4b65d9){_0x4b65d9=_0x4b65d9||0xcc;return function(_0x5f31f2){if(_0x5f31f2){return _0x1ebeae[_0x23a3('0x17')](_0x4b65d9);}return _0x1ebeae[_0x23a3('0x18')](_0x4b65d9)[_0x23a3('0x19')]();};}function respondWithResult(_0x2af741,_0x52243b){_0x52243b=_0x52243b||0xc8;return function(_0x3c0e0e){if(_0x3c0e0e){return _0x2af741[_0x23a3('0x18')](_0x52243b)['json'](_0x3c0e0e);}};}function respondWithFilteredResult(_0x73759f,_0xcd0167){return function(_0x480bcd){if(_0x480bcd){var _0x2e9730=_0x480bcd[_0x23a3('0x1a')],_0x23ed6d=_0xcd0167[_0x23a3('0x1b')],_0x1a52ff=_0xcd0167[_0x23a3('0x1b')]+_0xcd0167[_0x23a3('0x1c')],_0x3e3cc1;if(_0x1a52ff>=_0x2e9730){_0x1a52ff=_0x2e9730;_0x3e3cc1=0xc8;}else{_0x3e3cc1=0xce;}_0x73759f['status'](_0x3e3cc1);return _0x73759f[_0x23a3('0x1d')](_0x23a3('0x1e'),_0x23ed6d+'-'+_0x1a52ff+'/'+_0x2e9730)['json'](_0x480bcd);}return null;};}function patchUpdates(_0x502144){return function(_0x289eb7){try{jsonpatch[_0x23a3('0x1f')](_0x289eb7,_0x502144,!![]);}catch(_0x453bf3){return BPromise[_0x23a3('0x20')](_0x453bf3);}return _0x289eb7[_0x23a3('0x21')]();};}function saveUpdates(_0x1dd837,_0x1a4cfc){return function(_0x3efa00){if(_0x3efa00){return _0x3efa00[_0x23a3('0x22')](_0x1dd837)[_0x23a3('0x23')](function(_0x436871){return _0x436871;});}return null;};}function removeEntity(_0x53ccdf,_0x51885){return function(_0x2bfe31){if(_0x2bfe31){return _0x2bfe31[_0x23a3('0x24')]()[_0x23a3('0x23')](function(){_0x53ccdf[_0x23a3('0x18')](0xcc)[_0x23a3('0x19')]();});}};}function handleEntityNotFound(_0x509aa3,_0x48a73c){return function(_0x4eefe5){if(!_0x4eefe5){_0x509aa3[_0x23a3('0x17')](0x194);}return _0x4eefe5;};}function handleError(_0x515be1,_0x38b014){_0x38b014=_0x38b014||0x1f4;return function(_0x525b5f){logger[_0x23a3('0x25')](_0x525b5f['stack']);if(_0x525b5f[_0x23a3('0x26')]){delete _0x525b5f[_0x23a3('0x26')];}_0x515be1['status'](_0x38b014)[_0x23a3('0x27')](_0x525b5f);};}exports[_0x23a3('0x28')]=function(_0xb84c6c,_0x21db90){var _0x2ace31={},_0x5510d1={},_0x1ceaf0={'count':0x0,'rows':[]};var _0x748cda=_[_0x23a3('0x29')](db[_0x23a3('0x2a')][_0x23a3('0x2b')],function(_0x35519f){return{'name':_0x35519f[_0x23a3('0x2c')],'type':_0x35519f[_0x23a3('0x2d')]['key']};});_0x5510d1[_0x23a3('0x2e')]=_[_0x23a3('0x29')](_0x748cda,_0x23a3('0x26'));_0x5510d1[_0x23a3('0x2f')]=_[_0x23a3('0x30')](_0xb84c6c['query']);_0x5510d1[_0x23a3('0x31')]=_[_0x23a3('0x32')](_0x5510d1[_0x23a3('0x2e')],_0x5510d1[_0x23a3('0x2f')]);_0x2ace31[_0x23a3('0x33')]=_[_0x23a3('0x32')](_0x5510d1[_0x23a3('0x2e')],qs[_0x23a3('0x34')](_0xb84c6c[_0x23a3('0x2f')][_0x23a3('0x34')]));_0x2ace31[_0x23a3('0x33')]=_0x2ace31[_0x23a3('0x33')]['length']?_0x2ace31[_0x23a3('0x33')]:_0x5510d1[_0x23a3('0x2e')];if(!_0xb84c6c[_0x23a3('0x2f')][_0x23a3('0x35')]('nolimit')){_0x2ace31[_0x23a3('0x1c')]=qs[_0x23a3('0x1c')](_0xb84c6c['query']['limit']);_0x2ace31[_0x23a3('0x1b')]=qs[_0x23a3('0x1b')](_0xb84c6c[_0x23a3('0x2f')][_0x23a3('0x1b')]);}_0x2ace31[_0x23a3('0x36')]=qs['sort'](_0xb84c6c[_0x23a3('0x2f')][_0x23a3('0x37')]);_0x2ace31[_0x23a3('0x38')]=qs['filters'](_[_0x23a3('0x39')](_0xb84c6c['query'],_0x5510d1[_0x23a3('0x31')]),_0x748cda);if(_0xb84c6c['query'][_0x23a3('0x3a')]){_0x2ace31[_0x23a3('0x38')]=_[_0x23a3('0x3b')](_0x2ace31[_0x23a3('0x38')],{'$or':_[_0x23a3('0x29')](_0x748cda,function(_0x1ff3ed){if(_0x1ff3ed[_0x23a3('0x2d')]!==_0x23a3('0x3c')){var _0xda40cd={};_0xda40cd[_0x1ff3ed['name']]={'$like':'%'+_0xb84c6c[_0x23a3('0x2f')][_0x23a3('0x3a')]+'%'};return _0xda40cd;}})});}_0x2ace31=_[_0x23a3('0x3b')]({},_0x2ace31,_0xb84c6c[_0x23a3('0x3d')]);var _0x353d55={'where':_0x2ace31[_0x23a3('0x38')]};return db[_0x23a3('0x2a')][_0x23a3('0x1a')](_0x353d55)[_0x23a3('0x23')](function(_0x34eb89){_0x1ceaf0[_0x23a3('0x1a')]=_0x34eb89;if(_0xb84c6c[_0x23a3('0x2f')][_0x23a3('0x3e')]){_0x2ace31['include']=[{'all':!![]}];}return db[_0x23a3('0x2a')][_0x23a3('0x3f')](_0x2ace31);})[_0x23a3('0x23')](function(_0x7c7923){_0x1ceaf0[_0x23a3('0x40')]=_0x7c7923;return _0x1ceaf0;})[_0x23a3('0x23')](respondWithFilteredResult(_0x21db90,_0x2ace31))[_0x23a3('0x41')](handleError(_0x21db90,null));};exports[_0x23a3('0x42')]=function(_0x4c0b81,_0x1f89ce){var _0x19e0ef={'raw':!![],'where':{'id':_0x4c0b81[_0x23a3('0x43')]['id']}},_0x1e56f1={};_0x1e56f1[_0x23a3('0x2e')]=_[_0x23a3('0x30')](db[_0x23a3('0x2a')][_0x23a3('0x2b')]);_0x1e56f1[_0x23a3('0x2f')]=_[_0x23a3('0x30')](_0x4c0b81[_0x23a3('0x2f')]);_0x1e56f1[_0x23a3('0x31')]=_[_0x23a3('0x32')](_0x1e56f1[_0x23a3('0x2e')],_0x1e56f1[_0x23a3('0x2f')]);_0x19e0ef[_0x23a3('0x33')]=_[_0x23a3('0x32')](_0x1e56f1[_0x23a3('0x2e')],qs['fields'](_0x4c0b81[_0x23a3('0x2f')][_0x23a3('0x34')]));_0x19e0ef[_0x23a3('0x33')]=_0x19e0ef[_0x23a3('0x33')][_0x23a3('0x44')]?_0x19e0ef[_0x23a3('0x33')]:_0x1e56f1[_0x23a3('0x2e')];if(_0x4c0b81[_0x23a3('0x2f')][_0x23a3('0x3e')]){_0x19e0ef['include']=[{'all':!![]}];}_0x19e0ef=_[_0x23a3('0x3b')]({},_0x19e0ef,_0x4c0b81[_0x23a3('0x3d')]);return db[_0x23a3('0x2a')][_0x23a3('0x45')](_0x19e0ef)[_0x23a3('0x23')](handleEntityNotFound(_0x1f89ce,null))[_0x23a3('0x23')](respondWithResult(_0x1f89ce,null))[_0x23a3('0x41')](handleError(_0x1f89ce,null));};exports[_0x23a3('0x46')]=function(_0xc9dd3b,_0x26bfd2){return db[_0x23a3('0x2a')][_0x23a3('0x46')](_0xc9dd3b[_0x23a3('0x47')],{})['then'](respondWithResult(_0x26bfd2,0xc9))['catch'](handleError(_0x26bfd2,null));};exports[_0x23a3('0x22')]=function(_0x50ef1c,_0x433a6e){if(_0x50ef1c[_0x23a3('0x47')]['id']){delete _0x50ef1c['body']['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x50ef1c[_0x23a3('0x43')]['id']}})['then'](handleEntityNotFound(_0x433a6e,null))[_0x23a3('0x23')](saveUpdates(_0x50ef1c[_0x23a3('0x47')],null))[_0x23a3('0x23')](respondWithResult(_0x433a6e,null))[_0x23a3('0x41')](handleError(_0x433a6e,null));};exports[_0x23a3('0x24')]=function(_0x308b50,_0x773725){return db[_0x23a3('0x2a')]['find']({'where':{'id':_0x308b50[_0x23a3('0x43')]['id']}})['then'](handleEntityNotFound(_0x773725,null))[_0x23a3('0x23')](removeEntity(_0x773725,null))['catch'](handleError(_0x773725,null));};exports[_0x23a3('0x48')]=function(_0x27f43a,_0x3cbd2f){return db['OpenchannelQueueReport'][_0x23a3('0x48')]()['then'](respondWithResult(_0x3cbd2f,null))['catch'](handleError(_0x3cbd2f,null));}; \ No newline at end of file +var _0x67a2=['util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','Content-Range','json','reject','save','update','then','destroy','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','filter','where','options','OpenchannelQueueReport','includeAll','include','findAll','show','params','keys','catch','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4e0fc8,_0x12e503){var _0x2416be=function(_0x10be8){while(--_0x10be8){_0x4e0fc8['push'](_0x4e0fc8['shift']());}};_0x2416be(++_0x12e503);}(_0x67a2,0xd3));var _0x267a=function(_0x4e33a7,_0xb90524){_0x4e33a7=_0x4e33a7-0x0;var _0x537f1c=_0x67a2[_0x4e33a7];return _0x537f1c;};'use strict';var pdf=require(_0x267a('0x0'));var emlformat=require(_0x267a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x267a('0x2'));var jsonpatch=require(_0x267a('0x3'));var rp=require(_0x267a('0x4'));var moment=require(_0x267a('0x5'));var BPromise=require(_0x267a('0x6'));var Mustache=require(_0x267a('0x7'));var util=require(_0x267a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x267a('0x9'));var ejs=require(_0x267a('0xa'));var fs=require('fs');var _=require(_0x267a('0xb'));var squel=require('squel');var crypto=require(_0x267a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x267a('0xd'));var toCsv=require(_0x267a('0x9'));var querystring=require(_0x267a('0xe'));var Papa=require(_0x267a('0xf'));var Redis=require(_0x267a('0x10'));var authService=require(_0x267a('0x11'));var qs=require(_0x267a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x267a('0x13'));var logger=require(_0x267a('0x14'))(_0x267a('0x15'));var utils=require(_0x267a('0x16'));var config=require(_0x267a('0x17'));var licenseUtil=require(_0x267a('0x18'));var db=require(_0x267a('0x19'))['db'];function respondWithStatusCode(_0x14da06,_0x429efa){_0x429efa=_0x429efa||0xcc;return function(_0x29517a){if(_0x29517a){return _0x14da06[_0x267a('0x1a')](_0x429efa);}return _0x14da06['status'](_0x429efa)[_0x267a('0x1b')]();};}function respondWithResult(_0x558c88,_0x3bfb34){_0x3bfb34=_0x3bfb34||0xc8;return function(_0x7e6513){if(_0x7e6513){return _0x558c88[_0x267a('0x1c')](_0x3bfb34)['json'](_0x7e6513);}};}function respondWithFilteredResult(_0x50ca8d,_0x44ed17){return function(_0x1bf03b){if(_0x1bf03b){var _0x2dfcb1=_0x1bf03b[_0x267a('0x1d')],_0x5d1a05=_0x44ed17[_0x267a('0x1e')],_0xa7881=_0x44ed17[_0x267a('0x1e')]+_0x44ed17['limit'],_0x168d29;if(_0xa7881>=_0x2dfcb1){_0xa7881=_0x2dfcb1;_0x168d29=0xc8;}else{_0x168d29=0xce;}_0x50ca8d[_0x267a('0x1c')](_0x168d29);return _0x50ca8d['set'](_0x267a('0x1f'),_0x5d1a05+'-'+_0xa7881+'/'+_0x2dfcb1)[_0x267a('0x20')](_0x1bf03b);}return null;};}function patchUpdates(_0x4c52c9){return function(_0x1004f){try{jsonpatch['apply'](_0x1004f,_0x4c52c9,!![]);}catch(_0x37541a){return BPromise[_0x267a('0x21')](_0x37541a);}return _0x1004f[_0x267a('0x22')]();};}function saveUpdates(_0x5017b3,_0x1b7c88){return function(_0x380fe3){if(_0x380fe3){return _0x380fe3[_0x267a('0x23')](_0x5017b3)[_0x267a('0x24')](function(_0x504820){return _0x504820;});}return null;};}function removeEntity(_0xd26837,_0x44cb4f){return function(_0x2a894e){if(_0x2a894e){return _0x2a894e[_0x267a('0x25')]()[_0x267a('0x24')](function(){_0xd26837[_0x267a('0x1c')](0xcc)[_0x267a('0x1b')]();});}};}function handleEntityNotFound(_0xe11bd5,_0x5101b5){return function(_0xfa55b9){if(!_0xfa55b9){_0xe11bd5[_0x267a('0x1a')](0x194);}return _0xfa55b9;};}function handleError(_0x1eec4f,_0x557c87){_0x557c87=_0x557c87||0x1f4;return function(_0x4e7531){logger['error'](_0x4e7531['stack']);if(_0x4e7531[_0x267a('0x26')]){delete _0x4e7531[_0x267a('0x26')];}_0x1eec4f[_0x267a('0x1c')](_0x557c87)[_0x267a('0x27')](_0x4e7531);};}exports[_0x267a('0x28')]=function(_0x35c021,_0x24e29d){var _0x4dd1b3={},_0x2f5431={},_0x44feba={'count':0x0,'rows':[]};var _0x441937=_['map'](db['OpenchannelQueueReport'][_0x267a('0x29')],function(_0x5934fc){return{'name':_0x5934fc[_0x267a('0x2a')],'type':_0x5934fc[_0x267a('0x2b')][_0x267a('0x2c')]};});_0x2f5431[_0x267a('0x2d')]=_[_0x267a('0x2e')](_0x441937,'name');_0x2f5431[_0x267a('0x2f')]=_['keys'](_0x35c021[_0x267a('0x2f')]);_0x2f5431[_0x267a('0x30')]=_[_0x267a('0x31')](_0x2f5431[_0x267a('0x2d')],_0x2f5431['query']);_0x4dd1b3['attributes']=_[_0x267a('0x31')](_0x2f5431[_0x267a('0x2d')],qs[_0x267a('0x32')](_0x35c021['query'][_0x267a('0x32')]));_0x4dd1b3[_0x267a('0x33')]=_0x4dd1b3[_0x267a('0x33')][_0x267a('0x34')]?_0x4dd1b3[_0x267a('0x33')]:_0x2f5431[_0x267a('0x2d')];if(!_0x35c021[_0x267a('0x2f')]['hasOwnProperty'](_0x267a('0x35'))){_0x4dd1b3['limit']=qs[_0x267a('0x36')](_0x35c021['query'][_0x267a('0x36')]);_0x4dd1b3[_0x267a('0x1e')]=qs[_0x267a('0x1e')](_0x35c021[_0x267a('0x2f')][_0x267a('0x1e')]);}_0x4dd1b3[_0x267a('0x37')]=qs[_0x267a('0x38')](_0x35c021[_0x267a('0x2f')][_0x267a('0x38')]);_0x4dd1b3['where']=qs[_0x267a('0x30')](_[_0x267a('0x39')](_0x35c021[_0x267a('0x2f')],_0x2f5431[_0x267a('0x30')]),_0x441937);if(_0x35c021['query'][_0x267a('0x3a')]){_0x4dd1b3[_0x267a('0x3b')]=_['merge'](_0x4dd1b3[_0x267a('0x3b')],{'$or':_['map'](_0x441937,function(_0x3e4578){if(_0x3e4578[_0x267a('0x2b')]!=='VIRTUAL'){var _0x3a39ad={};_0x3a39ad[_0x3e4578['name']]={'$like':'%'+_0x35c021[_0x267a('0x2f')][_0x267a('0x3a')]+'%'};return _0x3a39ad;}})});}_0x4dd1b3=_['merge']({},_0x4dd1b3,_0x35c021[_0x267a('0x3c')]);var _0x24b03b={'where':_0x4dd1b3[_0x267a('0x3b')]};return db[_0x267a('0x3d')][_0x267a('0x1d')](_0x24b03b)[_0x267a('0x24')](function(_0x52972b){_0x44feba[_0x267a('0x1d')]=_0x52972b;if(_0x35c021[_0x267a('0x2f')][_0x267a('0x3e')]){_0x4dd1b3[_0x267a('0x3f')]=[{'all':!![]}];}return db[_0x267a('0x3d')][_0x267a('0x40')](_0x4dd1b3);})[_0x267a('0x24')](function(_0x229607){_0x44feba['rows']=_0x229607;return _0x44feba;})[_0x267a('0x24')](respondWithFilteredResult(_0x24e29d,_0x4dd1b3))['catch'](handleError(_0x24e29d,null));};exports[_0x267a('0x41')]=function(_0x4d1d28,_0x182304){var _0x4349d2={'raw':!![],'where':{'id':_0x4d1d28[_0x267a('0x42')]['id']}},_0x20d1c0={};_0x20d1c0[_0x267a('0x2d')]=_[_0x267a('0x43')](db[_0x267a('0x3d')][_0x267a('0x29')]);_0x20d1c0[_0x267a('0x2f')]=_[_0x267a('0x43')](_0x4d1d28[_0x267a('0x2f')]);_0x20d1c0[_0x267a('0x30')]=_[_0x267a('0x31')](_0x20d1c0[_0x267a('0x2d')],_0x20d1c0[_0x267a('0x2f')]);_0x4349d2['attributes']=_[_0x267a('0x31')](_0x20d1c0[_0x267a('0x2d')],qs[_0x267a('0x32')](_0x4d1d28[_0x267a('0x2f')][_0x267a('0x32')]));_0x4349d2[_0x267a('0x33')]=_0x4349d2['attributes'][_0x267a('0x34')]?_0x4349d2['attributes']:_0x20d1c0[_0x267a('0x2d')];if(_0x4d1d28['query'][_0x267a('0x3e')]){_0x4349d2[_0x267a('0x3f')]=[{'all':!![]}];}_0x4349d2=_['merge']({},_0x4349d2,_0x4d1d28[_0x267a('0x3c')]);return db[_0x267a('0x3d')]['find'](_0x4349d2)[_0x267a('0x24')](handleEntityNotFound(_0x182304,null))[_0x267a('0x24')](respondWithResult(_0x182304,null))[_0x267a('0x44')](handleError(_0x182304,null));};exports[_0x267a('0x45')]=function(_0x2a1d6d,_0x4840d){return db[_0x267a('0x3d')][_0x267a('0x45')](_0x2a1d6d[_0x267a('0x46')],{})[_0x267a('0x24')](respondWithResult(_0x4840d,0xc9))['catch'](handleError(_0x4840d,null));};exports['update']=function(_0x356e8e,_0x3cf803){if(_0x356e8e[_0x267a('0x46')]['id']){delete _0x356e8e[_0x267a('0x46')]['id'];}return db[_0x267a('0x3d')]['find']({'where':{'id':_0x356e8e[_0x267a('0x42')]['id']}})['then'](handleEntityNotFound(_0x3cf803,null))[_0x267a('0x24')](saveUpdates(_0x356e8e[_0x267a('0x46')],null))[_0x267a('0x24')](respondWithResult(_0x3cf803,null))[_0x267a('0x44')](handleError(_0x3cf803,null));};exports[_0x267a('0x25')]=function(_0x4459a9,_0x8a350a){return db[_0x267a('0x3d')][_0x267a('0x47')]({'where':{'id':_0x4459a9['params']['id']}})[_0x267a('0x24')](handleEntityNotFound(_0x8a350a,null))[_0x267a('0x24')](removeEntity(_0x8a350a,null))[_0x267a('0x44')](handleError(_0x8a350a,null));};exports[_0x267a('0x48')]=function(_0x51394d,_0x2c5904){return db['OpenchannelQueueReport'][_0x267a('0x48')]()[_0x267a('0x24')](respondWithResult(_0x2c5904,null))[_0x267a('0x44')](handleError(_0x2c5904,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4e2c400..32fdf3d 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 _0x87df=['bluebird','request-promise','path','rimraf','../../config/environment','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x87df,0x167));var _0xf87d=function(_0x5a6d3b,_0x15a93b){_0x5a6d3b=_0x5a6d3b-0x0;var _0x3aaf17=_0x87df[_0x5a6d3b];return _0x3aaf17;};'use strict';var _=require(_0xf87d('0x0'));var util=require(_0xf87d('0x1'));var logger=require(_0xf87d('0x2'))(_0xf87d('0x3'));var moment=require(_0xf87d('0x4'));var BPromise=require(_0xf87d('0x5'));var rp=require(_0xf87d('0x6'));var fs=require('fs');var path=require(_0xf87d('0x7'));var rimraf=require(_0xf87d('0x8'));var config=require(_0xf87d('0x9'));var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0x38045e,_0x40a15b){return _0x38045e['define'](_0xf87d('0xa'),attributes,{'tableName':_0xf87d('0xb'),'paranoid':![],'indexes':[{'name':_0xf87d('0xc'),'fields':[_0xf87d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8ca=['./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x45d453,_0x264d41){var _0x5b0bfe=function(_0x39418c){while(--_0x39418c){_0x45d453['push'](_0x45d453['shift']());}};_0x5b0bfe(++_0x264d41);}(_0xb8ca,0x89));var _0xab8c=function(_0x2e6fdb,_0x3b1c1){_0x2e6fdb=_0x2e6fdb-0x0;var _0x5473b2=_0xb8ca[_0x2e6fdb];return _0x5473b2;};'use strict';var _=require(_0xab8c('0x0'));var util=require(_0xab8c('0x1'));var logger=require(_0xab8c('0x2'))('api');var moment=require(_0xab8c('0x3'));var BPromise=require(_0xab8c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab8c('0x5'));var config=require(_0xab8c('0x6'));var attributes=require(_0xab8c('0x7'));module[_0xab8c('0x8')]=function(_0x31cc24,_0x340159){return _0x31cc24[_0xab8c('0x9')]('OpenchannelQueueReport',attributes,{'tableName':_0xab8c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xab8c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 2f72774..9a11b74 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 _0x2487=['code','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','stringify','update','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x297b8b,_0x10031d){var _0x4566e9=function(_0x45062b){while(--_0x45062b){_0x297b8b['push'](_0x297b8b['shift']());}};_0x4566e9(++_0x10031d);}(_0x2487,0x164));var _0x7248=function(_0x4dd7e8,_0x406d92){_0x4dd7e8=_0x4dd7e8-0x0;var _0x53939a=_0x2487[_0x4dd7e8];return _0x53939a;};'use strict';var _=require(_0x7248('0x0'));var util=require(_0x7248('0x1'));var moment=require(_0x7248('0x2'));var BPromise=require('bluebird');var rs=require(_0x7248('0x3'));var fs=require('fs');var Redis=require(_0x7248('0x4'));var db=require(_0x7248('0x5'))['db'];var utils=require(_0x7248('0x6'));var logger=require(_0x7248('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7248('0x8'));var client=jayson[_0x7248('0x9')][_0x7248('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59ba76,_0x4c0dd8,_0x28662a){return new BPromise(function(_0x3162c3,_0x2ff6fc){return client[_0x7248('0xb')](_0x59ba76,_0x28662a)[_0x7248('0xc')](function(_0x57f716){logger[_0x7248('0xd')](_0x7248('0xe'),_0x4c0dd8,_0x7248('0xf'));logger[_0x7248('0x10')](_0x7248('0x11'),_0x4c0dd8,_0x7248('0xf'),JSON['stringify'](_0x57f716));if(_0x57f716['error']){if(_0x57f716['error'][_0x7248('0x12')]===0x1f4){logger[_0x7248('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4c0dd8,_0x57f716[_0x7248('0x13')][_0x7248('0x14')]);return _0x2ff6fc(_0x57f716[_0x7248('0x13')][_0x7248('0x14')]);}logger[_0x7248('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4c0dd8,_0x57f716[_0x7248('0x13')]['message']);return _0x3162c3(_0x57f716[_0x7248('0x13')]['message']);}else{logger['info'](_0x7248('0xe'),_0x4c0dd8,_0x7248('0xf'));_0x3162c3(_0x57f716[_0x7248('0x15')][_0x7248('0x14')]);}})[_0x7248('0x16')](function(_0x2594c0){logger[_0x7248('0x13')](_0x7248('0xe'),_0x4c0dd8,_0x2594c0);_0x2ff6fc(_0x2594c0);});});}exports[_0x7248('0x17')]=function(_0x43d888){var _0x2d00ab=this;return new Promise(function(_0x1c180b,_0x251cb2){return db[_0x7248('0x18')][_0x7248('0x19')](_0x43d888['body'],{'raw':_0x43d888['options']?_0x43d888[_0x7248('0x1a')][_0x7248('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x524eeb){logger[_0x7248('0xd')](_0x7248('0x17'),_0x43d888);logger[_0x7248('0x10')]('CreateOpenchannelQueueReport',_0x43d888,JSON[_0x7248('0x1c')](_0x524eeb));_0x1c180b(_0x524eeb);})[_0x7248('0x16')](function(_0x3f48ad){logger[_0x7248('0x13')](_0x7248('0x17'),_0x3f48ad[_0x7248('0x14')],_0x43d888);_0x251cb2(_0x2d00ab['error'](0x1f4,_0x3f48ad[_0x7248('0x14')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3888fa){var _0x40c09b=this;return new Promise(function(_0x4d87f5,_0x5bdbb3){return db['OpenchannelQueueReport'][_0x7248('0x1d')](_0x3888fa['body'],{'raw':_0x3888fa[_0x7248('0x1a')]?_0x3888fa['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3888fa['options']?_0x3888fa['options'][_0x7248('0x1e')]||null:null,'attributes':_0x3888fa[_0x7248('0x1a')]?_0x3888fa[_0x7248('0x1a')][_0x7248('0x1f')]||null:null,'limit':_0x3888fa['options']?_0x3888fa['options'][_0x7248('0x20')]||null:null})[_0x7248('0xc')](function(_0x5a919c){logger[_0x7248('0xd')](_0x7248('0x21'),_0x3888fa);logger['debug'](_0x7248('0x21'),_0x3888fa,JSON[_0x7248('0x1c')](_0x5a919c));_0x4d87f5(_0x5a919c);})['catch'](function(_0x87f707){logger[_0x7248('0x13')](_0x7248('0x21'),_0x87f707[_0x7248('0x14')],_0x3888fa);_0x5bdbb3(_0x40c09b[_0x7248('0x13')](0x1f4,_0x87f707['message']));});});}; \ No newline at end of file +var _0x2384=['info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','debug','UpdateOpenchannelQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2384,0xc4));var _0x4238=function(_0x34d648,_0x4694d2){_0x34d648=_0x34d648-0x0;var _0x1a47e5=_0x2384[_0x34d648];return _0x1a47e5;};'use strict';var _=require('lodash');var util=require(_0x4238('0x0'));var moment=require(_0x4238('0x1'));var BPromise=require(_0x4238('0x2'));var rs=require(_0x4238('0x3'));var fs=require('fs');var Redis=require(_0x4238('0x4'));var db=require(_0x4238('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4238('0x6'))(_0x4238('0x7'));var config=require(_0x4238('0x8'));var jayson=require(_0x4238('0x9'));var client=jayson[_0x4238('0xa')][_0x4238('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24523f,_0x1368f0,_0x27c24f){return new BPromise(function(_0x4f8745,_0x5a44e6){return client[_0x4238('0xc')](_0x24523f,_0x27c24f)[_0x4238('0xd')](function(_0x809909){logger[_0x4238('0xe')](_0x4238('0xf'),_0x1368f0,_0x4238('0x10'));logger['debug'](_0x4238('0x11'),_0x1368f0,_0x4238('0x10'),JSON[_0x4238('0x12')](_0x809909));if(_0x809909[_0x4238('0x13')]){if(_0x809909['error'][_0x4238('0x14')]===0x1f4){logger[_0x4238('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1368f0,_0x809909[_0x4238('0x13')][_0x4238('0x15')]);return _0x5a44e6(_0x809909['error'][_0x4238('0x15')]);}logger[_0x4238('0x13')](_0x4238('0xf'),_0x1368f0,_0x809909[_0x4238('0x13')][_0x4238('0x15')]);return _0x4f8745(_0x809909[_0x4238('0x13')][_0x4238('0x15')]);}else{logger[_0x4238('0xe')](_0x4238('0xf'),_0x1368f0,_0x4238('0x10'));_0x4f8745(_0x809909[_0x4238('0x16')]['message']);}})[_0x4238('0x17')](function(_0x3bab7b){logger[_0x4238('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1368f0,_0x3bab7b);_0x5a44e6(_0x3bab7b);});});}exports[_0x4238('0x18')]=function(_0xfd9626){var _0x38d71c=this;return new Promise(function(_0x198dbe,_0x5cf998){return db[_0x4238('0x19')][_0x4238('0x1a')](_0xfd9626['body'],{'raw':_0xfd9626[_0x4238('0x1b')]?_0xfd9626[_0x4238('0x1b')][_0x4238('0x1c')]===undefined?!![]:![]:!![]})[_0x4238('0xd')](function(_0x186480){logger[_0x4238('0xe')](_0x4238('0x18'),_0xfd9626);logger[_0x4238('0x1d')]('CreateOpenchannelQueueReport',_0xfd9626,JSON['stringify'](_0x186480));_0x198dbe(_0x186480);})['catch'](function(_0x20e5fd){logger[_0x4238('0x13')](_0x4238('0x18'),_0x20e5fd[_0x4238('0x15')],_0xfd9626);_0x5cf998(_0x38d71c[_0x4238('0x13')](0x1f4,_0x20e5fd[_0x4238('0x15')]));});});};exports[_0x4238('0x1e')]=function(_0x394c53){var _0x35b66b=this;return new Promise(function(_0x3adba2,_0x5f7a0c){return db['OpenchannelQueueReport'][_0x4238('0x1f')](_0x394c53['body'],{'raw':_0x394c53[_0x4238('0x1b')]?_0x394c53[_0x4238('0x1b')][_0x4238('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x394c53[_0x4238('0x1b')]?_0x394c53[_0x4238('0x1b')][_0x4238('0x20')]||null:null,'attributes':_0x394c53[_0x4238('0x1b')]?_0x394c53['options'][_0x4238('0x21')]||null:null,'limit':_0x394c53[_0x4238('0x1b')]?_0x394c53[_0x4238('0x1b')][_0x4238('0x22')]||null:null})[_0x4238('0xd')](function(_0x27f412){logger[_0x4238('0xe')](_0x4238('0x1e'),_0x394c53);logger['debug'](_0x4238('0x1e'),_0x394c53,JSON[_0x4238('0x12')](_0x27f412));_0x3adba2(_0x27f412);})[_0x4238('0x17')](function(_0x2c1d70){logger[_0x4238('0x13')](_0x4238('0x1e'),_0x2c1d70[_0x4238('0x15')],_0x394c53);_0x5f7a0c(_0x35b66b[_0x4238('0x13')](0x1f4,_0x2c1d70[_0x4238('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 73347ed..97f97ac 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(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x3a6e4b,_0x118cd9){var _0x36572d=function(_0x2a53cf){while(--_0x2a53cf){_0x3a6e4b['push'](_0x3a6e4b['shift']());}};_0x36572d(++_0x118cd9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 0c77aa4..beb6716 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 _0x932c=['agent','queue','DATE','NOW','moment','exports','STRING','account'];(function(_0x2c6af3,_0x3ce442){var _0x4895bf=function(_0x5566cf){while(--_0x5566cf){_0x2c6af3['push'](_0x2c6af3['shift']());}};_0x4895bf(++_0x3ce442);}(_0x932c,0x1c4));var _0xc932=function(_0x5b4615,_0x3fad71){_0x5b4615=_0x5b4615-0x0;var _0x44eb78=_0x932c[_0x5b4615];return _0x44eb78;};'use strict';var moment=require(_0xc932('0x0'));var Sequelize=require('sequelize');module[_0xc932('0x1')]={'uniqueid':{'type':Sequelize[_0xc932('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc932('0x3'),_0xc932('0x4'),_0xc932('0x5')),'allowNull':![],'defaultValue':_0xc932('0x5')},'transferredAt':{'type':Sequelize[_0xc932('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xc932('0x7')]}}; \ No newline at end of file +var _0xc677=['DATE','NOW','moment','sequelize','STRING','ENUM','agent','queue'];(function(_0x58a6d8,_0x1a4783){var _0x4c6baf=function(_0xe6c1b9){while(--_0xe6c1b9){_0x58a6d8['push'](_0x58a6d8['shift']());}};_0x4c6baf(++_0x1a4783);}(_0xc677,0x14a));var _0x7c67=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc677[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x7c67('0x0'));var Sequelize=require(_0x7c67('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x7c67('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7c67('0x3')]('account',_0x7c67('0x4'),_0x7c67('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x7c67('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x7c67('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 63d8271..141bd79 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 _0x1958=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','OpenchannelTransferReport','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','describe','html-pdf','eml-format'];(function(_0x1d45ac,_0x9199a6){var _0x21b6f7=function(_0x54c3ca){while(--_0x54c3ca){_0x1d45ac['push'](_0x1d45ac['shift']());}};_0x21b6f7(++_0x9199a6);}(_0x1958,0x12e));var _0x8195=function(_0x5b142f,_0x10815a){_0x5b142f=_0x5b142f-0x0;var _0x327bbd=_0x1958[_0x5b142f];return _0x327bbd;};'use strict';var pdf=require(_0x8195('0x0'));var emlformat=require(_0x8195('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8195('0x2'));var jsonpatch=require(_0x8195('0x3'));var rp=require(_0x8195('0x4'));var moment=require(_0x8195('0x5'));var BPromise=require(_0x8195('0x6'));var Mustache=require(_0x8195('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8195('0x8'));var csv=require(_0x8195('0x9'));var ejs=require(_0x8195('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8195('0xb'));var crypto=require(_0x8195('0xc'));var jsforce=require(_0x8195('0xd'));var deskjs=require(_0x8195('0xe'));var toCsv=require(_0x8195('0x9'));var querystring=require('querystring');var Papa=require(_0x8195('0xf'));var Redis=require(_0x8195('0x10'));var authService=require(_0x8195('0x11'));var qs=require(_0x8195('0x12'));var as=require(_0x8195('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8195('0x14'))(_0x8195('0x15'));var utils=require('../../config/utils');var config=require(_0x8195('0x16'));var licenseUtil=require(_0x8195('0x17'));var db=require(_0x8195('0x18'))['db'];function respondWithStatusCode(_0x1b1d56,_0x42c84f){_0x42c84f=_0x42c84f||0xcc;return function(_0x4f0735){if(_0x4f0735){return _0x1b1d56[_0x8195('0x19')](_0x42c84f);}return _0x1b1d56[_0x8195('0x1a')](_0x42c84f)['end']();};}function respondWithResult(_0x1f955d,_0xfc72aa){_0xfc72aa=_0xfc72aa||0xc8;return function(_0x48aac5){if(_0x48aac5){return _0x1f955d[_0x8195('0x1a')](_0xfc72aa)[_0x8195('0x1b')](_0x48aac5);}};}function respondWithFilteredResult(_0x259a6d,_0xff684b){return function(_0x1ce998){if(_0x1ce998){var _0x3db1e5=_0x1ce998['count'],_0x263687=_0xff684b[_0x8195('0x1c')],_0x25558c=_0xff684b[_0x8195('0x1c')]+_0xff684b['limit'],_0x543143;if(_0x25558c>=_0x3db1e5){_0x25558c=_0x3db1e5;_0x543143=0xc8;}else{_0x543143=0xce;}_0x259a6d[_0x8195('0x1a')](_0x543143);return _0x259a6d[_0x8195('0x1d')](_0x8195('0x1e'),_0x263687+'-'+_0x25558c+'/'+_0x3db1e5)[_0x8195('0x1b')](_0x1ce998);}return null;};}function patchUpdates(_0x9fe1c1){return function(_0x396591){try{jsonpatch[_0x8195('0x1f')](_0x396591,_0x9fe1c1,!![]);}catch(_0x2daffd){return BPromise[_0x8195('0x20')](_0x2daffd);}return _0x396591[_0x8195('0x21')]();};}function saveUpdates(_0x1c496f,_0xd8f36e){return function(_0x509ff0){if(_0x509ff0){return _0x509ff0[_0x8195('0x22')](_0x1c496f)[_0x8195('0x23')](function(_0x9f1103){return _0x9f1103;});}return null;};}function removeEntity(_0x507f27,_0x4401bd){return function(_0x5cea8b){if(_0x5cea8b){return _0x5cea8b[_0x8195('0x24')]()['then'](function(){_0x507f27[_0x8195('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x74e709,_0xbd3d3e){return function(_0x1a35c8){if(!_0x1a35c8){_0x74e709['sendStatus'](0x194);}return _0x1a35c8;};}function handleError(_0x280219,_0x443e97){_0x443e97=_0x443e97||0x1f4;return function(_0x31e175){logger[_0x8195('0x25')](_0x31e175['stack']);if(_0x31e175[_0x8195('0x26')]){delete _0x31e175[_0x8195('0x26')];}_0x280219[_0x8195('0x1a')](_0x443e97)[_0x8195('0x27')](_0x31e175);};}exports['index']=function(_0x198651,_0x1db1dc){var _0x3959ae={},_0x27d89e={},_0x1fb3a1={'count':0x0,'rows':[]};var _0x5f53c5=_['map'](db[_0x8195('0x28')]['rawAttributes'],function(_0x4147b1){return{'name':_0x4147b1[_0x8195('0x29')],'type':_0x4147b1[_0x8195('0x2a')][_0x8195('0x2b')]};});_0x27d89e[_0x8195('0x2c')]=_[_0x8195('0x2d')](_0x5f53c5,_0x8195('0x26'));_0x27d89e[_0x8195('0x2e')]=_['keys'](_0x198651[_0x8195('0x2e')]);_0x27d89e[_0x8195('0x2f')]=_[_0x8195('0x30')](_0x27d89e[_0x8195('0x2c')],_0x27d89e[_0x8195('0x2e')]);_0x3959ae[_0x8195('0x31')]=_[_0x8195('0x30')](_0x27d89e['model'],qs[_0x8195('0x32')](_0x198651[_0x8195('0x2e')]['fields']));_0x3959ae[_0x8195('0x31')]=_0x3959ae[_0x8195('0x31')]['length']?_0x3959ae['attributes']:_0x27d89e['model'];if(!_0x198651[_0x8195('0x2e')][_0x8195('0x33')](_0x8195('0x34'))){_0x3959ae[_0x8195('0x35')]=qs[_0x8195('0x35')](_0x198651[_0x8195('0x2e')][_0x8195('0x35')]);_0x3959ae[_0x8195('0x1c')]=qs[_0x8195('0x1c')](_0x198651[_0x8195('0x2e')][_0x8195('0x1c')]);}_0x3959ae[_0x8195('0x36')]=qs[_0x8195('0x37')](_0x198651[_0x8195('0x2e')][_0x8195('0x37')]);_0x3959ae['where']=qs['filters'](_[_0x8195('0x38')](_0x198651[_0x8195('0x2e')],_0x27d89e['filters']),_0x5f53c5);if(_0x198651[_0x8195('0x2e')][_0x8195('0x39')]){_0x3959ae[_0x8195('0x3a')]=_[_0x8195('0x3b')](_0x3959ae[_0x8195('0x3a')],{'$or':_['map'](_0x5f53c5,function(_0x2ae7a2){if(_0x2ae7a2[_0x8195('0x2a')]!==_0x8195('0x3c')){var _0x3fbd3c={};_0x3fbd3c[_0x2ae7a2['name']]={'$like':'%'+_0x198651[_0x8195('0x2e')]['filter']+'%'};return _0x3fbd3c;}})});}_0x3959ae=_['merge']({},_0x3959ae,_0x198651[_0x8195('0x3d')]);var _0x5377b2={'where':_0x3959ae[_0x8195('0x3a')]};return db[_0x8195('0x28')][_0x8195('0x3e')](_0x5377b2)[_0x8195('0x23')](function(_0xe8420){_0x1fb3a1[_0x8195('0x3e')]=_0xe8420;if(_0x198651['query'][_0x8195('0x3f')]){_0x3959ae[_0x8195('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x8195('0x41')](_0x3959ae);})[_0x8195('0x23')](function(_0x283c85){_0x1fb3a1[_0x8195('0x42')]=_0x283c85;return _0x1fb3a1;})['then'](respondWithFilteredResult(_0x1db1dc,_0x3959ae))['catch'](handleError(_0x1db1dc,null));};exports[_0x8195('0x43')]=function(_0x4512b5,_0xe26bc3){var _0x2b7f2c={'raw':!![],'where':{'id':_0x4512b5[_0x8195('0x44')]['id']}},_0x32c01d={};_0x32c01d[_0x8195('0x2c')]=_[_0x8195('0x45')](db[_0x8195('0x28')]['rawAttributes']);_0x32c01d[_0x8195('0x2e')]=_['keys'](_0x4512b5['query']);_0x32c01d[_0x8195('0x2f')]=_[_0x8195('0x30')](_0x32c01d['model'],_0x32c01d[_0x8195('0x2e')]);_0x2b7f2c[_0x8195('0x31')]=_[_0x8195('0x30')](_0x32c01d[_0x8195('0x2c')],qs[_0x8195('0x32')](_0x4512b5['query'][_0x8195('0x32')]));_0x2b7f2c[_0x8195('0x31')]=_0x2b7f2c[_0x8195('0x31')][_0x8195('0x46')]?_0x2b7f2c['attributes']:_0x32c01d[_0x8195('0x2c')];if(_0x4512b5[_0x8195('0x2e')]['includeAll']){_0x2b7f2c[_0x8195('0x40')]=[{'all':!![]}];}_0x2b7f2c=_[_0x8195('0x3b')]({},_0x2b7f2c,_0x4512b5[_0x8195('0x3d')]);return db[_0x8195('0x28')][_0x8195('0x47')](_0x2b7f2c)[_0x8195('0x23')](handleEntityNotFound(_0xe26bc3,null))[_0x8195('0x23')](respondWithResult(_0xe26bc3,null))[_0x8195('0x48')](handleError(_0xe26bc3,null));};exports['create']=function(_0x137cd2,_0x348aa1){return db[_0x8195('0x28')][_0x8195('0x49')](_0x137cd2[_0x8195('0x4a')],{})[_0x8195('0x23')](respondWithResult(_0x348aa1,0xc9))[_0x8195('0x48')](handleError(_0x348aa1,null));};exports[_0x8195('0x22')]=function(_0x1ad51d,_0x3e09bf){if(_0x1ad51d[_0x8195('0x4a')]['id']){delete _0x1ad51d[_0x8195('0x4a')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x1ad51d[_0x8195('0x44')]['id']}})[_0x8195('0x23')](handleEntityNotFound(_0x3e09bf,null))[_0x8195('0x23')](saveUpdates(_0x1ad51d['body'],null))['then'](respondWithResult(_0x3e09bf,null))[_0x8195('0x48')](handleError(_0x3e09bf,null));};exports[_0x8195('0x24')]=function(_0x3aaa79,_0x17fb54){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x3aaa79[_0x8195('0x44')]['id']}})[_0x8195('0x23')](handleEntityNotFound(_0x17fb54,null))['then'](removeEntity(_0x17fb54,null))[_0x8195('0x48')](handleError(_0x17fb54,null));};exports[_0x8195('0x4b')]=function(_0x59985a,_0x5a8834){return db[_0x8195('0x28')][_0x8195('0x4b')]()[_0x8195('0x23')](respondWithResult(_0x5a8834,null))[_0x8195('0x48')](handleError(_0x5a8834,null));}; \ No newline at end of file +var _0x84c3=['end','status','json','offset','set','Content-Range','apply','reject','save','destroy','then','error','name','send','map','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','OpenchannelTransferReport','count','catch','show','params','rawAttributes','includeAll','include','options','update','body','find','describe','html-pdf','eml-format','request-promise','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','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'];(function(_0x6db6e4,_0x4dbeea){var _0x8055db=function(_0x21bf75){while(--_0x21bf75){_0x6db6e4['push'](_0x6db6e4['shift']());}};_0x8055db(++_0x4dbeea);}(_0x84c3,0x147));var _0x384c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x84c3[_0x432682];return _0x463d05;};'use strict';var pdf=require(_0x384c('0x0'));var emlformat=require(_0x384c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x384c('0x2'));var moment=require('moment');var BPromise=require(_0x384c('0x3'));var Mustache=require(_0x384c('0x4'));var util=require(_0x384c('0x5'));var path=require(_0x384c('0x6'));var sox=require('sox');var csv=require(_0x384c('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x384c('0x8'));var crypto=require(_0x384c('0x9'));var jsforce=require(_0x384c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x384c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x384c('0xb'));var authService=require(_0x384c('0xc'));var qs=require(_0x384c('0xd'));var as=require(_0x384c('0xe'));var hardwareService=require(_0x384c('0xf'));var logger=require(_0x384c('0x10'))(_0x384c('0x11'));var utils=require(_0x384c('0x12'));var config=require(_0x384c('0x13'));var licenseUtil=require(_0x384c('0x14'));var db=require(_0x384c('0x15'))['db'];function respondWithStatusCode(_0x2bf1ef,_0x3e7df3){_0x3e7df3=_0x3e7df3||0xcc;return function(_0x24cf26){if(_0x24cf26){return _0x2bf1ef[_0x384c('0x16')](_0x3e7df3);}return _0x2bf1ef['status'](_0x3e7df3)[_0x384c('0x17')]();};}function respondWithResult(_0x202c8e,_0x4d642e){_0x4d642e=_0x4d642e||0xc8;return function(_0x13699f){if(_0x13699f){return _0x202c8e[_0x384c('0x18')](_0x4d642e)[_0x384c('0x19')](_0x13699f);}};}function respondWithFilteredResult(_0x5026d1,_0x2fb843){return function(_0x59db06){if(_0x59db06){var _0x364777=_0x59db06['count'],_0x4f6383=_0x2fb843[_0x384c('0x1a')],_0x4161bd=_0x2fb843['offset']+_0x2fb843['limit'],_0x47f624;if(_0x4161bd>=_0x364777){_0x4161bd=_0x364777;_0x47f624=0xc8;}else{_0x47f624=0xce;}_0x5026d1['status'](_0x47f624);return _0x5026d1[_0x384c('0x1b')](_0x384c('0x1c'),_0x4f6383+'-'+_0x4161bd+'/'+_0x364777)['json'](_0x59db06);}return null;};}function patchUpdates(_0x1535e7){return function(_0x5d8bd0){try{jsonpatch[_0x384c('0x1d')](_0x5d8bd0,_0x1535e7,!![]);}catch(_0xad0550){return BPromise[_0x384c('0x1e')](_0xad0550);}return _0x5d8bd0[_0x384c('0x1f')]();};}function saveUpdates(_0x10c9c9,_0x483435){return function(_0x1c1776){if(_0x1c1776){return _0x1c1776['update'](_0x10c9c9)['then'](function(_0x30fc4d){return _0x30fc4d;});}return null;};}function removeEntity(_0xc16ba2,_0x41aa8c){return function(_0x32f3f7){if(_0x32f3f7){return _0x32f3f7[_0x384c('0x20')]()[_0x384c('0x21')](function(){_0xc16ba2['status'](0xcc)[_0x384c('0x17')]();});}};}function handleEntityNotFound(_0x17b45c,_0x552f0a){return function(_0x2a7c77){if(!_0x2a7c77){_0x17b45c[_0x384c('0x16')](0x194);}return _0x2a7c77;};}function handleError(_0x91db14,_0x202546){_0x202546=_0x202546||0x1f4;return function(_0x1208d6){logger[_0x384c('0x22')](_0x1208d6['stack']);if(_0x1208d6[_0x384c('0x23')]){delete _0x1208d6[_0x384c('0x23')];}_0x91db14[_0x384c('0x18')](_0x202546)[_0x384c('0x24')](_0x1208d6);};}exports['index']=function(_0x263c68,_0x111523){var _0x8d7cd5={},_0x51cf83={},_0x2f569e={'count':0x0,'rows':[]};var _0x1d3bef=_[_0x384c('0x25')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x4a117f){return{'name':_0x4a117f['fieldName'],'type':_0x4a117f[_0x384c('0x26')][_0x384c('0x27')]};});_0x51cf83['model']=_[_0x384c('0x25')](_0x1d3bef,_0x384c('0x23'));_0x51cf83[_0x384c('0x28')]=_[_0x384c('0x29')](_0x263c68[_0x384c('0x28')]);_0x51cf83['filters']=_[_0x384c('0x2a')](_0x51cf83[_0x384c('0x2b')],_0x51cf83['query']);_0x8d7cd5['attributes']=_[_0x384c('0x2a')](_0x51cf83[_0x384c('0x2b')],qs[_0x384c('0x2c')](_0x263c68[_0x384c('0x28')][_0x384c('0x2c')]));_0x8d7cd5[_0x384c('0x2d')]=_0x8d7cd5[_0x384c('0x2d')][_0x384c('0x2e')]?_0x8d7cd5['attributes']:_0x51cf83[_0x384c('0x2b')];if(!_0x263c68[_0x384c('0x28')][_0x384c('0x2f')]('nolimit')){_0x8d7cd5[_0x384c('0x30')]=qs[_0x384c('0x30')](_0x263c68['query'][_0x384c('0x30')]);_0x8d7cd5[_0x384c('0x1a')]=qs[_0x384c('0x1a')](_0x263c68['query'][_0x384c('0x1a')]);}_0x8d7cd5[_0x384c('0x31')]=qs[_0x384c('0x32')](_0x263c68[_0x384c('0x28')][_0x384c('0x32')]);_0x8d7cd5[_0x384c('0x33')]=qs['filters'](_[_0x384c('0x34')](_0x263c68[_0x384c('0x28')],_0x51cf83[_0x384c('0x35')]),_0x1d3bef);if(_0x263c68['query'][_0x384c('0x36')]){_0x8d7cd5[_0x384c('0x33')]=_[_0x384c('0x37')](_0x8d7cd5[_0x384c('0x33')],{'$or':_[_0x384c('0x25')](_0x1d3bef,function(_0x5dc83c){if(_0x5dc83c['type']!==_0x384c('0x38')){var _0x36197a={};_0x36197a[_0x5dc83c[_0x384c('0x23')]]={'$like':'%'+_0x263c68[_0x384c('0x28')][_0x384c('0x36')]+'%'};return _0x36197a;}})});}_0x8d7cd5=_[_0x384c('0x37')]({},_0x8d7cd5,_0x263c68['options']);var _0x19dce3={'where':_0x8d7cd5[_0x384c('0x33')]};return db[_0x384c('0x39')]['count'](_0x19dce3)[_0x384c('0x21')](function(_0x3fa082){_0x2f569e[_0x384c('0x3a')]=_0x3fa082;if(_0x263c68[_0x384c('0x28')]['includeAll']){_0x8d7cd5['include']=[{'all':!![]}];}return db[_0x384c('0x39')]['findAll'](_0x8d7cd5);})['then'](function(_0x4be4d4){_0x2f569e['rows']=_0x4be4d4;return _0x2f569e;})[_0x384c('0x21')](respondWithFilteredResult(_0x111523,_0x8d7cd5))[_0x384c('0x3b')](handleError(_0x111523,null));};exports[_0x384c('0x3c')]=function(_0x24f6eb,_0x49a0cf){var _0x4bb9e3={'raw':!![],'where':{'id':_0x24f6eb[_0x384c('0x3d')]['id']}},_0x125be8={};_0x125be8[_0x384c('0x2b')]=_[_0x384c('0x29')](db['OpenchannelTransferReport'][_0x384c('0x3e')]);_0x125be8[_0x384c('0x28')]=_[_0x384c('0x29')](_0x24f6eb[_0x384c('0x28')]);_0x125be8[_0x384c('0x35')]=_[_0x384c('0x2a')](_0x125be8[_0x384c('0x2b')],_0x125be8[_0x384c('0x28')]);_0x4bb9e3['attributes']=_['intersection'](_0x125be8['model'],qs['fields'](_0x24f6eb[_0x384c('0x28')][_0x384c('0x2c')]));_0x4bb9e3[_0x384c('0x2d')]=_0x4bb9e3[_0x384c('0x2d')][_0x384c('0x2e')]?_0x4bb9e3[_0x384c('0x2d')]:_0x125be8['model'];if(_0x24f6eb[_0x384c('0x28')][_0x384c('0x3f')]){_0x4bb9e3[_0x384c('0x40')]=[{'all':!![]}];}_0x4bb9e3=_['merge']({},_0x4bb9e3,_0x24f6eb[_0x384c('0x41')]);return db['OpenchannelTransferReport']['find'](_0x4bb9e3)[_0x384c('0x21')](handleEntityNotFound(_0x49a0cf,null))[_0x384c('0x21')](respondWithResult(_0x49a0cf,null))['catch'](handleError(_0x49a0cf,null));};exports['create']=function(_0x53c315,_0x46caf6){return db[_0x384c('0x39')]['create'](_0x53c315['body'],{})['then'](respondWithResult(_0x46caf6,0xc9))[_0x384c('0x3b')](handleError(_0x46caf6,null));};exports[_0x384c('0x42')]=function(_0x30e86e,_0x4b2df1){if(_0x30e86e[_0x384c('0x43')]['id']){delete _0x30e86e[_0x384c('0x43')]['id'];}return db[_0x384c('0x39')][_0x384c('0x44')]({'where':{'id':_0x30e86e['params']['id']}})[_0x384c('0x21')](handleEntityNotFound(_0x4b2df1,null))[_0x384c('0x21')](saveUpdates(_0x30e86e[_0x384c('0x43')],null))[_0x384c('0x21')](respondWithResult(_0x4b2df1,null))['catch'](handleError(_0x4b2df1,null));};exports[_0x384c('0x20')]=function(_0x4443dd,_0x4f35be){return db[_0x384c('0x39')][_0x384c('0x44')]({'where':{'id':_0x4443dd['params']['id']}})[_0x384c('0x21')](handleEntityNotFound(_0x4f35be,null))['then'](removeEntity(_0x4f35be,null))['catch'](handleError(_0x4f35be,null));};exports[_0x384c('0x45')]=function(_0x305328,_0x483611){return db[_0x384c('0x39')][_0x384c('0x45')]()[_0x384c('0x21')](respondWithResult(_0x483611,null))[_0x384c('0x3b')](handleError(_0x483611,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 5ac6647..7b98163 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 _0x5645=['../../config/environment','exports','define','OpenchannelTransferReport','lodash','../../config/logger','api','moment','path'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x5645,0x163));var _0x5564=function(_0x151ed4,_0x23cfb8){_0x151ed4=_0x151ed4-0x0;var _0x1c6f7e=_0x5645[_0x151ed4];return _0x1c6f7e;};'use strict';var _=require(_0x5564('0x0'));var util=require('util');var logger=require(_0x5564('0x1'))(_0x5564('0x2'));var moment=require(_0x5564('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5564('0x4'));var rimraf=require('rimraf');var config=require(_0x5564('0x5'));var attributes=require('./openchannelTransferReport.attributes');module[_0x5564('0x6')]=function(_0x44a3da,_0x28dcd0){return _0x44a3da[_0x5564('0x7')](_0x5564('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9af5=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','request-promise'];(function(_0x53bb35,_0xccb458){var _0x4b26f9=function(_0x49733a){while(--_0x49733a){_0x53bb35['push'](_0x53bb35['shift']());}};_0x4b26f9(++_0xccb458);}(_0x9af5,0x6b));var _0x59af=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9af5[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x59af('0x0'));var logger=require(_0x59af('0x1'))(_0x59af('0x2'));var moment=require(_0x59af('0x3'));var BPromise=require('bluebird');var rp=require(_0x59af('0x4'));var fs=require('fs');var path=require(_0x59af('0x5'));var rimraf=require(_0x59af('0x6'));var config=require(_0x59af('0x7'));var attributes=require(_0x59af('0x8'));module[_0x59af('0x9')]=function(_0x4f95ad,_0x9e8f4e){return _0x4f95ad[_0x59af('0xa')](_0x59af('0xb'),attributes,{'tableName':_0x59af('0xc'),'paranoid':![],'indexes':[{'name':_0x59af('0xd'),'fields':[_0x59af('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index e0c79ad..2272364 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 _0x6a54=['debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2e8cab,_0x28b8e9){var _0x1c2448=function(_0x4f8f9e){while(--_0x4f8f9e){_0x2e8cab['push'](_0x2e8cab['shift']());}};_0x1c2448(++_0x28b8e9);}(_0x6a54,0xe1));var _0x46a5=function(_0x5a4af4,_0x1d21e7){_0x5a4af4=_0x5a4af4-0x0;var _0x31c9bd=_0x6a54[_0x5a4af4];return _0x31c9bd;};'use strict';var _=require(_0x46a5('0x0'));var util=require(_0x46a5('0x1'));var moment=require(_0x46a5('0x2'));var BPromise=require(_0x46a5('0x3'));var rs=require(_0x46a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46a5('0x5'))['db'];var utils=require(_0x46a5('0x6'));var logger=require(_0x46a5('0x7'))(_0x46a5('0x8'));var config=require('../../config/environment');var jayson=require(_0x46a5('0x9'));var client=jayson[_0x46a5('0xa')][_0x46a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d8d49,_0x361201,_0x1f7562){return new BPromise(function(_0x3969aa,_0x47db02){return client[_0x46a5('0xc')](_0x1d8d49,_0x1f7562)[_0x46a5('0xd')](function(_0x490445){logger[_0x46a5('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x361201,'request\x20sent');logger[_0x46a5('0xf')](_0x46a5('0x10'),_0x361201,'request\x20sent',JSON[_0x46a5('0x11')](_0x490445));if(_0x490445[_0x46a5('0x12')]){if(_0x490445[_0x46a5('0x12')][_0x46a5('0x13')]===0x1f4){logger[_0x46a5('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x361201,_0x490445[_0x46a5('0x12')][_0x46a5('0x14')]);return _0x47db02(_0x490445['error'][_0x46a5('0x14')]);}logger[_0x46a5('0x12')](_0x46a5('0x15'),_0x361201,_0x490445[_0x46a5('0x12')][_0x46a5('0x14')]);return _0x3969aa(_0x490445[_0x46a5('0x12')][_0x46a5('0x14')]);}else{logger[_0x46a5('0xe')](_0x46a5('0x15'),_0x361201,_0x46a5('0x16'));_0x3969aa(_0x490445['result']['message']);}})[_0x46a5('0x17')](function(_0x7f136d){logger['error'](_0x46a5('0x15'),_0x361201,_0x7f136d);_0x47db02(_0x7f136d);});});} \ No newline at end of file +var _0x66e2=['request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x66e2,0x105));var _0x266e=function(_0x334578,_0x4f68f1){_0x334578=_0x334578-0x0;var _0x11d272=_0x66e2[_0x334578];return _0x11d272;};'use strict';var _=require(_0x266e('0x0'));var util=require(_0x266e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x266e('0x2'));var fs=require('fs');var Redis=require(_0x266e('0x3'));var db=require(_0x266e('0x4'))['db'];var utils=require(_0x266e('0x5'));var logger=require(_0x266e('0x6'))(_0x266e('0x7'));var config=require('../../config/environment');var jayson=require(_0x266e('0x8'));var client=jayson[_0x266e('0x9')][_0x266e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1107d0,_0x22e475,_0x2ddd10){return new BPromise(function(_0x51442e,_0x325279){return client[_0x266e('0xb')](_0x1107d0,_0x2ddd10)[_0x266e('0xc')](function(_0x1e7de0){logger[_0x266e('0xd')](_0x266e('0xe'),_0x22e475,_0x266e('0xf'));logger[_0x266e('0x10')](_0x266e('0x11'),_0x22e475,'request\x20sent',JSON[_0x266e('0x12')](_0x1e7de0));if(_0x1e7de0[_0x266e('0x13')]){if(_0x1e7de0[_0x266e('0x13')][_0x266e('0x14')]===0x1f4){logger[_0x266e('0x13')](_0x266e('0xe'),_0x22e475,_0x1e7de0[_0x266e('0x13')][_0x266e('0x15')]);return _0x325279(_0x1e7de0[_0x266e('0x13')][_0x266e('0x15')]);}logger[_0x266e('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x22e475,_0x1e7de0['error']['message']);return _0x51442e(_0x1e7de0[_0x266e('0x13')][_0x266e('0x15')]);}else{logger[_0x266e('0xd')](_0x266e('0xe'),_0x22e475,_0x266e('0xf'));_0x51442e(_0x1e7de0[_0x266e('0x16')][_0x266e('0x15')]);}})['catch'](function(_0x48c265){logger[_0x266e('0x13')](_0x266e('0xe'),_0x22e475,_0x48c265);_0x325279(_0x48c265);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index b759a28..3723707 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 _0x9e23=['create','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x504ddc,_0x41b40d){var _0x12aaee=function(_0x5182be){while(--_0x5182be){_0x504ddc['push'](_0x504ddc['shift']());}};_0x12aaee(++_0x41b40d);}(_0x9e23,0xa0));var _0x39e2=function(_0x38334e,_0x298750){_0x38334e=_0x38334e-0x0;var _0x30aa60=_0x9e23[_0x38334e];return _0x30aa60;};'use strict';var multer=require('multer');var util=require(_0x39e2('0x0'));var path=require(_0x39e2('0x1'));var timeout=require('connect-timeout');var express=require(_0x39e2('0x2'));var router=express[_0x39e2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x39e2('0x4'));var config=require(_0x39e2('0x5'));var controller=require('./pause.controller');router[_0x39e2('0x6')]('/',auth[_0x39e2('0x7')](),controller[_0x39e2('0x8')]);router[_0x39e2('0x6')]('/:id',auth[_0x39e2('0x7')](),controller[_0x39e2('0x9')]);router['post']('/',auth[_0x39e2('0x7')](),controller[_0x39e2('0xa')]);router[_0x39e2('0xb')](_0x39e2('0xc'),auth['isAuthenticated'](),controller[_0x39e2('0xd')]);router[_0x39e2('0xe')](_0x39e2('0xc'),auth['isAuthenticated'](),controller[_0x39e2('0xf')]);module[_0x39e2('0x10')]=router; \ No newline at end of file +var _0x9d98=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x241c0d,_0x574322){var _0x480ae3=function(_0x3351bd){while(--_0x3351bd){_0x241c0d['push'](_0x241c0d['shift']());}};_0x480ae3(++_0x574322);}(_0x9d98,0x157));var _0x89d9=function(_0x34af1d,_0x4a5bad){_0x34af1d=_0x34af1d-0x0;var _0x5cbabf=_0x9d98[_0x34af1d];return _0x5cbabf;};'use strict';var multer=require(_0x89d9('0x0'));var util=require(_0x89d9('0x1'));var path=require('path');var timeout=require(_0x89d9('0x2'));var express=require(_0x89d9('0x3'));var router=express[_0x89d9('0x4')]();var auth=require(_0x89d9('0x5'));var interaction=require(_0x89d9('0x6'));var config=require(_0x89d9('0x7'));var controller=require(_0x89d9('0x8'));router[_0x89d9('0x9')]('/',auth[_0x89d9('0xa')](),controller[_0x89d9('0xb')]);router[_0x89d9('0x9')](_0x89d9('0xc'),auth['isAuthenticated'](),controller[_0x89d9('0xd')]);router[_0x89d9('0xe')]('/',auth[_0x89d9('0xa')](),controller[_0x89d9('0xf')]);router[_0x89d9('0x10')](_0x89d9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x89d9('0x11')](_0x89d9('0xc'),auth[_0x89d9('0xa')](),controller[_0x89d9('0x12')]);module[_0x89d9('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 aa813f7..290d6b1 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 _0x0a4a=['STRING','sequelize','exports','name'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0x0a4a,0x1ad));var _0xa0a4=function(_0x3550ab,_0x4a3df9){_0x3550ab=_0x3550ab-0x0;var _0x4e53d0=_0x0a4a[_0x3550ab];return _0x4e53d0;};'use strict';var Sequelize=require(_0xa0a4('0x0'));module[_0xa0a4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa0a4('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa0a4('0x3')]}}; \ No newline at end of file +var _0x6a4d=['STRING','name','sequelize','exports'];(function(_0x2b7b93,_0x58adc9){var _0x2aaaf8=function(_0x55b10f){while(--_0x55b10f){_0x2b7b93['push'](_0x2b7b93['shift']());}};_0x2aaaf8(++_0x58adc9);}(_0x6a4d,0x82));var _0xd6a4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x6a4d[_0x6cf19c];return _0xce14f3;};'use strict';var Sequelize=require(_0xd6a4('0x0'));module[_0xd6a4('0x1')]={'name':{'type':Sequelize[_0xd6a4('0x2')],'unique':_0xd6a4('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index c12aa49..27b40c1 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 _0xee70=['get','Pauses','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','offset','sort','where','filters','pick','filter','merge','count','includeAll','include','Pause','findAll','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','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','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee70,0xc9));var _0x0ee7=function(_0x162e5d,_0x38eaa2){_0x162e5d=_0x162e5d-0x0;var _0x196e98=_0xee70[_0x162e5d];return _0x196e98;};'use strict';var pdf=require(_0x0ee7('0x0'));var emlformat=require(_0x0ee7('0x1'));var rimraf=require(_0x0ee7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ee7('0x3'));var rp=require(_0x0ee7('0x4'));var moment=require('moment');var BPromise=require(_0x0ee7('0x5'));var Mustache=require(_0x0ee7('0x6'));var util=require(_0x0ee7('0x7'));var path=require(_0x0ee7('0x8'));var sox=require('sox');var csv=require(_0x0ee7('0x9'));var ejs=require(_0x0ee7('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0ee7('0xb'));var crypto=require(_0x0ee7('0xc'));var jsforce=require(_0x0ee7('0xd'));var deskjs=require(_0x0ee7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0ee7('0xf'));var Papa=require(_0x0ee7('0x10'));var Redis=require(_0x0ee7('0x11'));var authService=require(_0x0ee7('0x12'));var qs=require(_0x0ee7('0x13'));var as=require(_0x0ee7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ee7('0x15'));var utils=require(_0x0ee7('0x16'));var config=require(_0x0ee7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ee7('0x18'))['db'];function respondWithStatusCode(_0x436773,_0x45d1fb){_0x45d1fb=_0x45d1fb||0xcc;return function(_0x1d1424){if(_0x1d1424){return _0x436773[_0x0ee7('0x19')](_0x45d1fb);}return _0x436773[_0x0ee7('0x1a')](_0x45d1fb)['end']();};}function respondWithResult(_0x3943aa,_0x409c3d){_0x409c3d=_0x409c3d||0xc8;return function(_0x19b3f1){if(_0x19b3f1){return _0x3943aa['status'](_0x409c3d)['json'](_0x19b3f1);}};}function respondWithFilteredResult(_0x3f8092,_0x37bc2d){return function(_0x161128){if(_0x161128){var _0x53a0ed=_0x161128['count'],_0x4b8839=_0x37bc2d['offset'],_0x1d6e48=_0x37bc2d['offset']+_0x37bc2d[_0x0ee7('0x1b')],_0x155160;if(_0x1d6e48>=_0x53a0ed){_0x1d6e48=_0x53a0ed;_0x155160=0xc8;}else{_0x155160=0xce;}_0x3f8092[_0x0ee7('0x1a')](_0x155160);return _0x3f8092[_0x0ee7('0x1c')](_0x0ee7('0x1d'),_0x4b8839+'-'+_0x1d6e48+'/'+_0x53a0ed)['json'](_0x161128);}return null;};}function patchUpdates(_0x242118){return function(_0x4224fa){try{jsonpatch[_0x0ee7('0x1e')](_0x4224fa,_0x242118,!![]);}catch(_0x487d67){return BPromise[_0x0ee7('0x1f')](_0x487d67);}return _0x4224fa[_0x0ee7('0x20')]();};}function saveUpdates(_0x23c177,_0x219127){return function(_0x274876){if(_0x274876){return _0x274876[_0x0ee7('0x21')](_0x23c177)[_0x0ee7('0x22')](function(_0x1d979a){return _0x1d979a;});}return null;};}function removeEntity(_0x4ac430,_0x355541){return function(_0x9e6688){if(_0x9e6688){return _0x9e6688[_0x0ee7('0x23')]()[_0x0ee7('0x22')](function(){var _0x1bd660=_0x9e6688[_0x0ee7('0x24')]({'plain':!![]});var _0x113072=_0x0ee7('0x25');return db[_0x0ee7('0x26')]['destroy']({'where':{'type':_0x113072,'resourceId':_0x1bd660['id']}})[_0x0ee7('0x22')](function(){return _0x9e6688;});})[_0x0ee7('0x22')](function(){_0x4ac430[_0x0ee7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47f3f9,_0x4af547){return function(_0x5307a9){if(!_0x5307a9){_0x47f3f9[_0x0ee7('0x19')](0x194);}return _0x5307a9;};}function handleError(_0x7bdde4,_0x59462c){_0x59462c=_0x59462c||0x1f4;return function(_0x35f645){logger['error'](_0x35f645[_0x0ee7('0x27')]);if(_0x35f645[_0x0ee7('0x28')]){delete _0x35f645[_0x0ee7('0x28')];}_0x7bdde4[_0x0ee7('0x1a')](_0x59462c)[_0x0ee7('0x29')](_0x35f645);};}exports[_0x0ee7('0x2a')]=function(_0x25bb40,_0x1d06bb){var _0x2f18c3={},_0x1c06f2={},_0x287282={'count':0x0,'rows':[]};var _0x2d7b14=_[_0x0ee7('0x2b')](db['Pause'][_0x0ee7('0x2c')],function(_0x37b193){return{'name':_0x37b193[_0x0ee7('0x2d')],'type':_0x37b193[_0x0ee7('0x2e')][_0x0ee7('0x2f')]};});_0x1c06f2[_0x0ee7('0x30')]=_[_0x0ee7('0x2b')](_0x2d7b14,_0x0ee7('0x28'));_0x1c06f2[_0x0ee7('0x31')]=_[_0x0ee7('0x32')](_0x25bb40[_0x0ee7('0x31')]);_0x1c06f2['filters']=_['intersection'](_0x1c06f2[_0x0ee7('0x30')],_0x1c06f2[_0x0ee7('0x31')]);_0x2f18c3[_0x0ee7('0x33')]=_[_0x0ee7('0x34')](_0x1c06f2[_0x0ee7('0x30')],qs[_0x0ee7('0x35')](_0x25bb40['query'][_0x0ee7('0x35')]));_0x2f18c3[_0x0ee7('0x33')]=_0x2f18c3[_0x0ee7('0x33')][_0x0ee7('0x36')]?_0x2f18c3[_0x0ee7('0x33')]:_0x1c06f2['model'];if(!_0x25bb40[_0x0ee7('0x31')]['hasOwnProperty'](_0x0ee7('0x37'))){_0x2f18c3[_0x0ee7('0x1b')]=qs['limit'](_0x25bb40[_0x0ee7('0x31')]['limit']);_0x2f18c3[_0x0ee7('0x38')]=qs[_0x0ee7('0x38')](_0x25bb40[_0x0ee7('0x31')][_0x0ee7('0x38')]);}_0x2f18c3['order']=qs['sort'](_0x25bb40[_0x0ee7('0x31')][_0x0ee7('0x39')]);_0x2f18c3[_0x0ee7('0x3a')]=qs[_0x0ee7('0x3b')](_[_0x0ee7('0x3c')](_0x25bb40['query'],_0x1c06f2[_0x0ee7('0x3b')]),_0x2d7b14);if(_0x25bb40[_0x0ee7('0x31')][_0x0ee7('0x3d')]){_0x2f18c3[_0x0ee7('0x3a')]=_['merge'](_0x2f18c3[_0x0ee7('0x3a')],{'$or':_[_0x0ee7('0x2b')](_0x2d7b14,function(_0x1d5ff5){if(_0x1d5ff5['type']!=='VIRTUAL'){var _0x571f59={};_0x571f59[_0x1d5ff5['name']]={'$like':'%'+_0x25bb40[_0x0ee7('0x31')][_0x0ee7('0x3d')]+'%'};return _0x571f59;}})});}_0x2f18c3=_[_0x0ee7('0x3e')]({},_0x2f18c3,_0x25bb40['options']);var _0x4a6a76={'where':_0x2f18c3[_0x0ee7('0x3a')]};return db['Pause'][_0x0ee7('0x3f')](_0x4a6a76)[_0x0ee7('0x22')](function(_0x5e4149){_0x287282[_0x0ee7('0x3f')]=_0x5e4149;if(_0x25bb40[_0x0ee7('0x31')][_0x0ee7('0x40')]){_0x2f18c3[_0x0ee7('0x41')]=[{'all':!![]}];}return db[_0x0ee7('0x42')][_0x0ee7('0x43')](_0x2f18c3);})[_0x0ee7('0x22')](function(_0x5273e4){_0x287282['rows']=_0x5273e4;return _0x287282;})[_0x0ee7('0x22')](respondWithFilteredResult(_0x1d06bb,_0x2f18c3))['catch'](handleError(_0x1d06bb,null));};exports[_0x0ee7('0x44')]=function(_0x4e2b2c,_0x561851){var _0x1c4be7={'raw':!![],'where':{'id':_0x4e2b2c['params']['id']}},_0x2c80ea={};_0x2c80ea[_0x0ee7('0x30')]=_[_0x0ee7('0x32')](db[_0x0ee7('0x42')][_0x0ee7('0x2c')]);_0x2c80ea[_0x0ee7('0x31')]=_['keys'](_0x4e2b2c['query']);_0x2c80ea[_0x0ee7('0x3b')]=_[_0x0ee7('0x34')](_0x2c80ea[_0x0ee7('0x30')],_0x2c80ea[_0x0ee7('0x31')]);_0x1c4be7[_0x0ee7('0x33')]=_['intersection'](_0x2c80ea[_0x0ee7('0x30')],qs['fields'](_0x4e2b2c[_0x0ee7('0x31')][_0x0ee7('0x35')]));_0x1c4be7['attributes']=_0x1c4be7[_0x0ee7('0x33')]['length']?_0x1c4be7[_0x0ee7('0x33')]:_0x2c80ea[_0x0ee7('0x30')];if(_0x4e2b2c[_0x0ee7('0x31')][_0x0ee7('0x40')]){_0x1c4be7['include']=[{'all':!![]}];}_0x1c4be7=_['merge']({},_0x1c4be7,_0x4e2b2c['options']);return db[_0x0ee7('0x42')][_0x0ee7('0x45')](_0x1c4be7)['then'](handleEntityNotFound(_0x561851,null))[_0x0ee7('0x22')](respondWithResult(_0x561851,null))[_0x0ee7('0x46')](handleError(_0x561851,null));};exports[_0x0ee7('0x47')]=function(_0x496fb3,_0x4c3e71){return db[_0x0ee7('0x42')][_0x0ee7('0x47')](_0x496fb3[_0x0ee7('0x48')],{})['then'](function(_0x5a2ac7){var _0x42d9b8=_0x496fb3[_0x0ee7('0x49')][_0x0ee7('0x24')]({'plain':!![]});if(!_0x42d9b8)throw new Error(_0x0ee7('0x4a'));if(_0x42d9b8[_0x0ee7('0x4b')]==='user'){var _0x19ce7b=_0x5a2ac7[_0x0ee7('0x24')]({'plain':!![]});var _0x50683d='Pauses';return db['UserProfileSection'][_0x0ee7('0x45')]({'where':{'name':_0x50683d,'userProfileId':_0x42d9b8['userProfileId']},'raw':!![]})[_0x0ee7('0x22')](function(_0x419e12){if(_0x419e12&&_0x419e12[_0x0ee7('0x4c')]===0x0){return db[_0x0ee7('0x26')]['create']({'name':_0x19ce7b[_0x0ee7('0x28')],'resourceId':_0x19ce7b['id'],'type':_0x419e12[_0x0ee7('0x28')],'sectionId':_0x419e12['id']},{})[_0x0ee7('0x22')](function(){return _0x5a2ac7;});}else{return _0x5a2ac7;}})[_0x0ee7('0x46')](function(_0x37d1bd){logger['error'](_0x0ee7('0x4d'),_0x37d1bd);throw _0x37d1bd;});}return _0x5a2ac7;})[_0x0ee7('0x22')](respondWithResult(_0x4c3e71,0xc9))['catch'](handleError(_0x4c3e71,null));};exports[_0x0ee7('0x21')]=function(_0x534127,_0x27b10c){if(_0x534127[_0x0ee7('0x48')]['id']){delete _0x534127['body']['id'];}return db[_0x0ee7('0x42')][_0x0ee7('0x45')]({'where':{'id':_0x534127['params']['id']}})['then'](handleEntityNotFound(_0x27b10c,null))[_0x0ee7('0x22')](saveUpdates(_0x534127[_0x0ee7('0x48')],null))[_0x0ee7('0x22')](respondWithResult(_0x27b10c,null))[_0x0ee7('0x46')](handleError(_0x27b10c,null));};exports[_0x0ee7('0x23')]=function(_0x1ff92f,_0x1c0b96){return db['Pause']['find']({'where':{'id':_0x1ff92f[_0x0ee7('0x4e')]['id']}})[_0x0ee7('0x22')](handleEntityNotFound(_0x1c0b96,null))[_0x0ee7('0x22')](removeEntity(_0x1c0b96,null))[_0x0ee7('0x46')](handleError(_0x1c0b96,null));}; \ No newline at end of file +var _0x6a6c=['UserProfileResource','error','stack','send','index','Pause','rawAttributes','key','map','query','keys','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','include','rows','catch','show','params','intersection','includeAll','options','create','user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','squel','crypto','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','status','end','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','Pauses'];(function(_0x17ace2,_0x582cff){var _0x4ff41f=function(_0x16166c){while(--_0x16166c){_0x17ace2['push'](_0x17ace2['shift']());}};_0x4ff41f(++_0x582cff);}(_0x6a6c,0xc7));var _0xc6a6=function(_0x39601f,_0x43e31d){_0x39601f=_0x39601f-0x0;var _0x44f609=_0x6a6c[_0x39601f];return _0x44f609;};'use strict';var pdf=require(_0xc6a6('0x0'));var emlformat=require(_0xc6a6('0x1'));var rimraf=require(_0xc6a6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6a6('0x3'));var rp=require(_0xc6a6('0x4'));var moment=require('moment');var BPromise=require(_0xc6a6('0x5'));var Mustache=require(_0xc6a6('0x6'));var util=require('util');var path=require(_0xc6a6('0x7'));var sox=require('sox');var csv=require(_0xc6a6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc6a6('0x9'));var crypto=require(_0xc6a6('0xa'));var jsforce=require(_0xc6a6('0xb'));var deskjs=require(_0xc6a6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc6a6('0xd'));var Papa=require(_0xc6a6('0xe'));var Redis=require(_0xc6a6('0xf'));var authService=require(_0xc6a6('0x10'));var qs=require(_0xc6a6('0x11'));var as=require(_0xc6a6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6a6('0x13'))(_0xc6a6('0x14'));var utils=require(_0xc6a6('0x15'));var config=require(_0xc6a6('0x16'));var licenseUtil=require(_0xc6a6('0x17'));var db=require(_0xc6a6('0x18'))['db'];function respondWithStatusCode(_0x37d4b1,_0x1a1d7c){_0x1a1d7c=_0x1a1d7c||0xcc;return function(_0x133d10){if(_0x133d10){return _0x37d4b1['sendStatus'](_0x1a1d7c);}return _0x37d4b1[_0xc6a6('0x19')](_0x1a1d7c)[_0xc6a6('0x1a')]();};}function respondWithResult(_0x31ee05,_0x51ee04){_0x51ee04=_0x51ee04||0xc8;return function(_0x332790){if(_0x332790){return _0x31ee05[_0xc6a6('0x19')](_0x51ee04)['json'](_0x332790);}};}function respondWithFilteredResult(_0x426f12,_0x4c61af){return function(_0xd2aa09){if(_0xd2aa09){var _0x2c39f0=_0xd2aa09[_0xc6a6('0x1b')],_0x84603=_0x4c61af[_0xc6a6('0x1c')],_0x5e5da2=_0x4c61af[_0xc6a6('0x1c')]+_0x4c61af[_0xc6a6('0x1d')],_0x53205e;if(_0x5e5da2>=_0x2c39f0){_0x5e5da2=_0x2c39f0;_0x53205e=0xc8;}else{_0x53205e=0xce;}_0x426f12['status'](_0x53205e);return _0x426f12[_0xc6a6('0x1e')](_0xc6a6('0x1f'),_0x84603+'-'+_0x5e5da2+'/'+_0x2c39f0)['json'](_0xd2aa09);}return null;};}function patchUpdates(_0x543d8a){return function(_0x5b9564){try{jsonpatch['apply'](_0x5b9564,_0x543d8a,!![]);}catch(_0x26140f){return BPromise[_0xc6a6('0x20')](_0x26140f);}return _0x5b9564['save']();};}function saveUpdates(_0x399ab3,_0x166b6d){return function(_0x9bf43d){if(_0x9bf43d){return _0x9bf43d[_0xc6a6('0x21')](_0x399ab3)[_0xc6a6('0x22')](function(_0x18b9a2){return _0x18b9a2;});}return null;};}function removeEntity(_0x4df42e,_0x4e9bfb){return function(_0x287404){if(_0x287404){return _0x287404[_0xc6a6('0x23')]()[_0xc6a6('0x22')](function(){var _0x44e014=_0x287404[_0xc6a6('0x24')]({'plain':!![]});var _0x19efaf=_0xc6a6('0x25');return db[_0xc6a6('0x26')][_0xc6a6('0x23')]({'where':{'type':_0x19efaf,'resourceId':_0x44e014['id']}})[_0xc6a6('0x22')](function(){return _0x287404;});})[_0xc6a6('0x22')](function(){_0x4df42e[_0xc6a6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x536e12,_0x31936e){return function(_0x41da30){if(!_0x41da30){_0x536e12['sendStatus'](0x194);}return _0x41da30;};}function handleError(_0x4f7ae1,_0xa3ed11){_0xa3ed11=_0xa3ed11||0x1f4;return function(_0xf3bfb4){logger[_0xc6a6('0x27')](_0xf3bfb4[_0xc6a6('0x28')]);if(_0xf3bfb4['name']){delete _0xf3bfb4['name'];}_0x4f7ae1[_0xc6a6('0x19')](_0xa3ed11)[_0xc6a6('0x29')](_0xf3bfb4);};}exports[_0xc6a6('0x2a')]=function(_0x11fc48,_0x4b6877){var _0xb4d53b={},_0x8902e6={},_0x4cde83={'count':0x0,'rows':[]};var _0x4c46a9=_['map'](db[_0xc6a6('0x2b')][_0xc6a6('0x2c')],function(_0x5f4c63){return{'name':_0x5f4c63['fieldName'],'type':_0x5f4c63['type'][_0xc6a6('0x2d')]};});_0x8902e6['model']=_[_0xc6a6('0x2e')](_0x4c46a9,'name');_0x8902e6[_0xc6a6('0x2f')]=_[_0xc6a6('0x30')](_0x11fc48[_0xc6a6('0x2f')]);_0x8902e6[_0xc6a6('0x31')]=_['intersection'](_0x8902e6[_0xc6a6('0x32')],_0x8902e6[_0xc6a6('0x2f')]);_0xb4d53b[_0xc6a6('0x33')]=_['intersection'](_0x8902e6[_0xc6a6('0x32')],qs[_0xc6a6('0x34')](_0x11fc48[_0xc6a6('0x2f')][_0xc6a6('0x34')]));_0xb4d53b[_0xc6a6('0x33')]=_0xb4d53b[_0xc6a6('0x33')][_0xc6a6('0x35')]?_0xb4d53b[_0xc6a6('0x33')]:_0x8902e6[_0xc6a6('0x32')];if(!_0x11fc48[_0xc6a6('0x2f')]['hasOwnProperty'](_0xc6a6('0x36'))){_0xb4d53b[_0xc6a6('0x1d')]=qs[_0xc6a6('0x1d')](_0x11fc48[_0xc6a6('0x2f')][_0xc6a6('0x1d')]);_0xb4d53b['offset']=qs[_0xc6a6('0x1c')](_0x11fc48[_0xc6a6('0x2f')][_0xc6a6('0x1c')]);}_0xb4d53b[_0xc6a6('0x37')]=qs[_0xc6a6('0x38')](_0x11fc48[_0xc6a6('0x2f')][_0xc6a6('0x38')]);_0xb4d53b[_0xc6a6('0x39')]=qs[_0xc6a6('0x31')](_[_0xc6a6('0x3a')](_0x11fc48[_0xc6a6('0x2f')],_0x8902e6[_0xc6a6('0x31')]),_0x4c46a9);if(_0x11fc48[_0xc6a6('0x2f')][_0xc6a6('0x3b')]){_0xb4d53b['where']=_[_0xc6a6('0x3c')](_0xb4d53b['where'],{'$or':_['map'](_0x4c46a9,function(_0x57a924){if(_0x57a924[_0xc6a6('0x3d')]!==_0xc6a6('0x3e')){var _0x561325={};_0x561325[_0x57a924[_0xc6a6('0x3f')]]={'$like':'%'+_0x11fc48[_0xc6a6('0x2f')][_0xc6a6('0x3b')]+'%'};return _0x561325;}})});}_0xb4d53b=_[_0xc6a6('0x3c')]({},_0xb4d53b,_0x11fc48['options']);var _0x28e746={'where':_0xb4d53b[_0xc6a6('0x39')]};return db['Pause']['count'](_0x28e746)[_0xc6a6('0x22')](function(_0x2d5f52){_0x4cde83[_0xc6a6('0x1b')]=_0x2d5f52;if(_0x11fc48[_0xc6a6('0x2f')]['includeAll']){_0xb4d53b[_0xc6a6('0x40')]=[{'all':!![]}];}return db[_0xc6a6('0x2b')]['findAll'](_0xb4d53b);})[_0xc6a6('0x22')](function(_0x277271){_0x4cde83[_0xc6a6('0x41')]=_0x277271;return _0x4cde83;})[_0xc6a6('0x22')](respondWithFilteredResult(_0x4b6877,_0xb4d53b))[_0xc6a6('0x42')](handleError(_0x4b6877,null));};exports[_0xc6a6('0x43')]=function(_0x4baa82,_0x1c9289){var _0x3aed8d={'raw':!![],'where':{'id':_0x4baa82[_0xc6a6('0x44')]['id']}},_0x1394e3={};_0x1394e3[_0xc6a6('0x32')]=_['keys'](db[_0xc6a6('0x2b')][_0xc6a6('0x2c')]);_0x1394e3[_0xc6a6('0x2f')]=_[_0xc6a6('0x30')](_0x4baa82[_0xc6a6('0x2f')]);_0x1394e3[_0xc6a6('0x31')]=_[_0xc6a6('0x45')](_0x1394e3[_0xc6a6('0x32')],_0x1394e3[_0xc6a6('0x2f')]);_0x3aed8d['attributes']=_[_0xc6a6('0x45')](_0x1394e3[_0xc6a6('0x32')],qs[_0xc6a6('0x34')](_0x4baa82[_0xc6a6('0x2f')][_0xc6a6('0x34')]));_0x3aed8d[_0xc6a6('0x33')]=_0x3aed8d['attributes'][_0xc6a6('0x35')]?_0x3aed8d[_0xc6a6('0x33')]:_0x1394e3[_0xc6a6('0x32')];if(_0x4baa82[_0xc6a6('0x2f')][_0xc6a6('0x46')]){_0x3aed8d[_0xc6a6('0x40')]=[{'all':!![]}];}_0x3aed8d=_['merge']({},_0x3aed8d,_0x4baa82[_0xc6a6('0x47')]);return db[_0xc6a6('0x2b')]['find'](_0x3aed8d)['then'](handleEntityNotFound(_0x1c9289,null))[_0xc6a6('0x22')](respondWithResult(_0x1c9289,null))[_0xc6a6('0x42')](handleError(_0x1c9289,null));};exports[_0xc6a6('0x48')]=function(_0x1ae1c9,_0x18a310){return db[_0xc6a6('0x2b')][_0xc6a6('0x48')](_0x1ae1c9['body'],{})['then'](function(_0x3f0ed8){var _0x1fa7d5=_0x1ae1c9[_0xc6a6('0x49')][_0xc6a6('0x24')]({'plain':!![]});if(!_0x1fa7d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fa7d5[_0xc6a6('0x4a')]==='user'){var _0x3286a6=_0x3f0ed8[_0xc6a6('0x24')]({'plain':!![]});var _0x219447='Pauses';return db['UserProfileSection'][_0xc6a6('0x4b')]({'where':{'name':_0x219447,'userProfileId':_0x1fa7d5[_0xc6a6('0x4c')]},'raw':!![]})[_0xc6a6('0x22')](function(_0x512618){if(_0x512618&&_0x512618['autoAssociation']===0x0){return db[_0xc6a6('0x26')][_0xc6a6('0x48')]({'name':_0x3286a6[_0xc6a6('0x3f')],'resourceId':_0x3286a6['id'],'type':_0x512618[_0xc6a6('0x3f')],'sectionId':_0x512618['id']},{})[_0xc6a6('0x22')](function(){return _0x3f0ed8;});}else{return _0x3f0ed8;}})[_0xc6a6('0x42')](function(_0x8b1f3e){logger['error'](_0xc6a6('0x4d'),_0x8b1f3e);throw _0x8b1f3e;});}return _0x3f0ed8;})['then'](respondWithResult(_0x18a310,0xc9))[_0xc6a6('0x42')](handleError(_0x18a310,null));};exports[_0xc6a6('0x21')]=function(_0x100459,_0x50a2dc){if(_0x100459[_0xc6a6('0x4e')]['id']){delete _0x100459[_0xc6a6('0x4e')]['id'];}return db[_0xc6a6('0x2b')]['find']({'where':{'id':_0x100459[_0xc6a6('0x44')]['id']}})[_0xc6a6('0x22')](handleEntityNotFound(_0x50a2dc,null))[_0xc6a6('0x22')](saveUpdates(_0x100459[_0xc6a6('0x4e')],null))[_0xc6a6('0x22')](respondWithResult(_0x50a2dc,null))['catch'](handleError(_0x50a2dc,null));};exports['destroy']=function(_0x3b279d,_0x16f5a5){return db['Pause']['find']({'where':{'id':_0x3b279d[_0xc6a6('0x44')]['id']}})['then'](handleEntityNotFound(_0x16f5a5,null))[_0xc6a6('0x22')](removeEntity(_0x16f5a5,null))[_0xc6a6('0x42')](handleError(_0x16f5a5,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index e86b605..eef5f7e 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 _0x5ed9=['moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes','define','Pause','tools_pauses','lodash','util','api'];(function(_0x599346,_0x412daf){var _0x39f8c4=function(_0x3b445d){while(--_0x3b445d){_0x599346['push'](_0x599346['shift']());}};_0x39f8c4(++_0x412daf);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5ed9[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var logger=require('../../config/logger')(_0x95ed('0x2'));var moment=require(_0x95ed('0x3'));var BPromise=require(_0x95ed('0x4'));var rp=require(_0x95ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95ed('0x6'));var config=require(_0x95ed('0x7'));var attributes=require(_0x95ed('0x8'));module['exports']=function(_0x2c9009,_0x5a5117){return _0x2c9009[_0x95ed('0x9')](_0x95ed('0xa'),attributes,{'tableName':_0x95ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6ea=['./pause.attributes','exports','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3c6a7d,_0x27fc04){var _0x417e98=function(_0x1e73b0){while(--_0x1e73b0){_0x3c6a7d['push'](_0x3c6a7d['shift']());}};_0x417e98(++_0x27fc04);}(_0xa6ea,0x122));var _0xaa6e=function(_0x556676,_0x3b6389){_0x556676=_0x556676-0x0;var _0x5ad1ed=_0xa6ea[_0x556676];return _0x5ad1ed;};'use strict';var _=require(_0xaa6e('0x0'));var util=require(_0xaa6e('0x1'));var logger=require(_0xaa6e('0x2'))(_0xaa6e('0x3'));var moment=require(_0xaa6e('0x4'));var BPromise=require(_0xaa6e('0x5'));var rp=require(_0xaa6e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa6e('0x7'));var config=require(_0xaa6e('0x8'));var attributes=require(_0xaa6e('0x9'));module[_0xaa6e('0xa')]=function(_0xb01d1d,_0x53d333){return _0xb01d1d['define'](_0xaa6e('0xb'),attributes,{'tableName':_0xaa6e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 0aea526..a3b0251 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 _0x663c=['model','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowPause','find','options','where','attributes','include'];(function(_0x4593df,_0x3a4901){var _0x57bbbc=function(_0xe5169b){while(--_0xe5169b){_0x4593df['push'](_0x4593df['shift']());}};_0x57bbbc(++_0x3a4901);}(_0x663c,0x1ef));var _0xc663=function(_0x42ebba,_0x4cbf87){_0x42ebba=_0x42ebba-0x0;var _0x3fd2af=_0x663c[_0x42ebba];return _0x3fd2af;};'use strict';var _=require(_0xc663('0x0'));var util=require('util');var moment=require(_0xc663('0x1'));var BPromise=require(_0xc663('0x2'));var rs=require(_0xc663('0x3'));var fs=require('fs');var Redis=require(_0xc663('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc663('0x5'));var logger=require(_0xc663('0x6'))(_0xc663('0x7'));var config=require('../../config/environment');var jayson=require(_0xc663('0x8'));var client=jayson[_0xc663('0x9')][_0xc663('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x943e2a,_0x4ba065,_0x5cd8c4){return new BPromise(function(_0x129139,_0x25f74a){return client[_0xc663('0xb')](_0x943e2a,_0x5cd8c4)[_0xc663('0xc')](function(_0x24df22){logger[_0xc663('0xd')](_0xc663('0xe'),_0x4ba065,_0xc663('0xf'));logger['debug'](_0xc663('0x10'),_0x4ba065,_0xc663('0xf'),JSON[_0xc663('0x11')](_0x24df22));if(_0x24df22['error']){if(_0x24df22[_0xc663('0x12')]['code']===0x1f4){logger[_0xc663('0x12')](_0xc663('0xe'),_0x4ba065,_0x24df22[_0xc663('0x12')][_0xc663('0x13')]);return _0x25f74a(_0x24df22[_0xc663('0x12')][_0xc663('0x13')]);}logger[_0xc663('0x12')](_0xc663('0xe'),_0x4ba065,_0x24df22[_0xc663('0x12')][_0xc663('0x13')]);return _0x129139(_0x24df22[_0xc663('0x12')][_0xc663('0x13')]);}else{logger[_0xc663('0xd')](_0xc663('0xe'),_0x4ba065,'request\x20sent');_0x129139(_0x24df22[_0xc663('0x14')][_0xc663('0x13')]);}})['catch'](function(_0x2ee920){logger[_0xc663('0x12')](_0xc663('0xe'),_0x4ba065,_0x2ee920);_0x25f74a(_0x2ee920);});});}exports[_0xc663('0x15')]=function(_0x2e8d66){var _0x1cb16d=this;return new Promise(function(_0x40edca,_0x539e70){return db['Pause'][_0xc663('0x16')]({'raw':_0x2e8d66['options']?_0x2e8d66[_0xc663('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2e8d66[_0xc663('0x17')]?_0x2e8d66['options'][_0xc663('0x18')]||null:null,'attributes':_0x2e8d66['options']?_0x2e8d66[_0xc663('0x17')][_0xc663('0x19')]||null:null,'include':_0x2e8d66[_0xc663('0x17')]?_0x2e8d66[_0xc663('0x17')][_0xc663('0x1a')]?_['map'](_0x2e8d66[_0xc663('0x17')][_0xc663('0x1a')],function(_0x5f0202){return{'model':db[_0x5f0202[_0xc663('0x1b')]],'as':_0x5f0202['as'],'attributes':_0x5f0202[_0xc663('0x19')],'include':_0x5f0202['include']?_[_0xc663('0x1c')](_0x5f0202[_0xc663('0x1a')],function(_0x200ee7){return{'model':db[_0x200ee7[_0xc663('0x1b')]],'as':_0x200ee7['as'],'attributes':_0x200ee7[_0xc663('0x19')],'include':_0x200ee7['include']?_[_0xc663('0x1c')](_0x200ee7[_0xc663('0x1a')],function(_0x460467){return{'model':db[_0x460467[_0xc663('0x1b')]],'as':_0x460467['as'],'attributes':_0x460467[_0xc663('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc663('0xc')](function(_0x201997){logger[_0xc663('0xd')](_0xc663('0x15'),_0x2e8d66);logger['debug'](_0xc663('0x15'),_0x2e8d66,JSON[_0xc663('0x11')](_0x201997));_0x40edca(_0x201997);})['catch'](function(_0xe47572){logger[_0xc663('0x12')](_0xc663('0x15'),_0xe47572[_0xc663('0x13')],_0x2e8d66);_0x539e70(_0x1cb16d[_0xc663('0x12')](0x1f4,_0xe47572[_0xc663('0x13')]));});});}; \ No newline at end of file +var _0xfd8a=['attributes','map','model','include','ShowPause','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','options','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd8a,0x7e));var _0xafd8=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xfd8a[_0x270adf];return _0x29eda9;};'use strict';var _=require(_0xafd8('0x0'));var util=require(_0xafd8('0x1'));var moment=require('moment');var BPromise=require(_0xafd8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafd8('0x3'));var db=require(_0xafd8('0x4'))['db'];var utils=require(_0xafd8('0x5'));var logger=require(_0xafd8('0x6'))('rpc');var config=require(_0xafd8('0x7'));var jayson=require(_0xafd8('0x8'));var client=jayson[_0xafd8('0x9')][_0xafd8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f1989,_0x233265,_0x3137b6){return new BPromise(function(_0x4fe4f6,_0x1aa1d7){return client['request'](_0x2f1989,_0x3137b6)[_0xafd8('0xb')](function(_0x1f0aef){logger[_0xafd8('0xc')](_0xafd8('0xd'),_0x233265,_0xafd8('0xe'));logger[_0xafd8('0xf')](_0xafd8('0x10'),_0x233265,_0xafd8('0xe'),JSON[_0xafd8('0x11')](_0x1f0aef));if(_0x1f0aef[_0xafd8('0x12')]){if(_0x1f0aef[_0xafd8('0x12')][_0xafd8('0x13')]===0x1f4){logger[_0xafd8('0x12')]('Pause,\x20%s,\x20%s',_0x233265,_0x1f0aef[_0xafd8('0x12')][_0xafd8('0x14')]);return _0x1aa1d7(_0x1f0aef[_0xafd8('0x12')][_0xafd8('0x14')]);}logger['error'](_0xafd8('0xd'),_0x233265,_0x1f0aef[_0xafd8('0x12')][_0xafd8('0x14')]);return _0x4fe4f6(_0x1f0aef[_0xafd8('0x12')][_0xafd8('0x14')]);}else{logger['info'](_0xafd8('0xd'),_0x233265,_0xafd8('0xe'));_0x4fe4f6(_0x1f0aef['result']['message']);}})['catch'](function(_0x2d89c1){logger['error'](_0xafd8('0xd'),_0x233265,_0x2d89c1);_0x1aa1d7(_0x2d89c1);});});}exports['ShowPause']=function(_0x134e6a){var _0x37e9dc=this;return new Promise(function(_0x160bc6,_0x33038d){return db['Pause']['find']({'raw':_0x134e6a[_0xafd8('0x15')]?_0x134e6a['options'][_0xafd8('0x16')]===undefined?!![]:![]:!![],'where':_0x134e6a[_0xafd8('0x15')]?_0x134e6a['options'][_0xafd8('0x17')]||null:null,'attributes':_0x134e6a[_0xafd8('0x15')]?_0x134e6a['options'][_0xafd8('0x18')]||null:null,'include':_0x134e6a[_0xafd8('0x15')]?_0x134e6a['options']['include']?_[_0xafd8('0x19')](_0x134e6a['options']['include'],function(_0x4af935){return{'model':db[_0x4af935[_0xafd8('0x1a')]],'as':_0x4af935['as'],'attributes':_0x4af935['attributes'],'include':_0x4af935[_0xafd8('0x1b')]?_['map'](_0x4af935[_0xafd8('0x1b')],function(_0xf6f41d){return{'model':db[_0xf6f41d[_0xafd8('0x1a')]],'as':_0xf6f41d['as'],'attributes':_0xf6f41d[_0xafd8('0x18')],'include':_0xf6f41d['include']?_[_0xafd8('0x19')](_0xf6f41d['include'],function(_0x41e3d8){return{'model':db[_0x41e3d8['model']],'as':_0x41e3d8['as'],'attributes':_0x41e3d8[_0xafd8('0x18')]};}):[]};}):[]};}):[]:[]})[_0xafd8('0xb')](function(_0x36b1b9){logger['info']('ShowPause',_0x134e6a);logger[_0xafd8('0xf')](_0xafd8('0x1c'),_0x134e6a,JSON[_0xafd8('0x11')](_0x36b1b9));_0x160bc6(_0x36b1b9);})[_0xafd8('0x1d')](function(_0x646d6){logger[_0xafd8('0x12')]('ShowPause',_0x646d6[_0xafd8('0x14')],_0x134e6a);_0x33038d(_0x37e9dc['error'](0x1f4,_0x646d6[_0xafd8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 4d2267f..ad5c3ba 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 _0x29c3=['file','webhookPost','put','update','delete','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','join','root','originalname','replace','format','%s-%s%s','extname','now','post','single'];(function(_0x336d11,_0x12f3fa){var _0x326636=function(_0x63575c){while(--_0x63575c){_0x336d11['push'](_0x336d11['shift']());}};_0x326636(++_0x12f3fa);}(_0x29c3,0x165));var _0x329c=function(_0x5efb92,_0x9fc12f){_0x5efb92=_0x5efb92-0x0;var _0x2d0729=_0x29c3[_0x5efb92];return _0x2d0729;};'use strict';var multer=require(_0x329c('0x0'));var util=require('util');var path=require(_0x329c('0x1'));var timeout=require('connect-timeout');var express=require(_0x329c('0x2'));var router=express[_0x329c('0x3')]();var auth=require(_0x329c('0x4'));var interaction=require(_0x329c('0x5'));var config=require(_0x329c('0x6'));var controller=require(_0x329c('0x7'));router[_0x329c('0x8')]('/',auth[_0x329c('0x9')](),controller[_0x329c('0xa')]);router[_0x329c('0x8')](_0x329c('0xb'),controller[_0x329c('0xc')]);router['get'](_0x329c('0xd'),auth[_0x329c('0x9')](),controller[_0x329c('0xe')]);router[_0x329c('0x8')](_0x329c('0xf'),auth[_0x329c('0x9')](),controller[_0x329c('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5787f4,_0x303b14,_0x5c3c24){_0x5c3c24(null,path[_0x329c('0x11')](config[_0x329c('0x12')],'server/files/plugins'));},'filename':function(_0x44ff30,_0x1b55fd,_0x2ec42a){_0x1b55fd[_0x329c('0x13')]=_0x1b55fd[_0x329c('0x13')][_0x329c('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2ec42a(null,util[_0x329c('0x15')](_0x329c('0x16'),path['basename'](_0x1b55fd['originalname'],path[_0x329c('0x17')](_0x1b55fd[_0x329c('0x13')])),Date[_0x329c('0x18')](),path[_0x329c('0x17')](_0x1b55fd[_0x329c('0x13')])));}})});router[_0x329c('0x19')]('/',upload[_0x329c('0x1a')](_0x329c('0x1b')),controller['upload']);router['post']('/webhook',controller[_0x329c('0x1c')]);router[_0x329c('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x329c('0x1e')]);router[_0x329c('0x1f')](_0x329c('0xd'),auth[_0x329c('0x9')](),controller[_0x329c('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xf371=['file','upload','webhookPost','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now'];(function(_0x1928c2,_0x18f901){var _0x3ea197=function(_0x256bb0){while(--_0x256bb0){_0x1928c2['push'](_0x1928c2['shift']());}};_0x3ea197(++_0x18f901);}(_0xf371,0x188));var _0x1f37=function(_0x4b1caf,_0x5f3c7b){_0x4b1caf=_0x4b1caf-0x0;var _0x9f71ac=_0xf371[_0x4b1caf];return _0x9f71ac;};'use strict';var multer=require(_0x1f37('0x0'));var util=require(_0x1f37('0x1'));var path=require(_0x1f37('0x2'));var timeout=require(_0x1f37('0x3'));var express=require(_0x1f37('0x4'));var router=express[_0x1f37('0x5')]();var auth=require(_0x1f37('0x6'));var interaction=require(_0x1f37('0x7'));var config=require(_0x1f37('0x8'));var controller=require(_0x1f37('0x9'));router[_0x1f37('0xa')]('/',auth[_0x1f37('0xb')](),controller[_0x1f37('0xc')]);router[_0x1f37('0xa')](_0x1f37('0xd'),controller[_0x1f37('0xe')]);router[_0x1f37('0xa')]('/:id',auth[_0x1f37('0xb')](),controller[_0x1f37('0xf')]);router[_0x1f37('0xa')](_0x1f37('0x10'),auth[_0x1f37('0xb')](),controller[_0x1f37('0x11')]);var upload=multer({'storage':multer[_0x1f37('0x12')]({'destination':function(_0x3534ac,_0x1f4315,_0x1c070c){_0x1c070c(null,path[_0x1f37('0x13')](config[_0x1f37('0x14')],_0x1f37('0x15')));},'filename':function(_0x70ea97,_0x1367a9,_0x892710){_0x1367a9[_0x1f37('0x16')]=_0x1367a9['originalname'][_0x1f37('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x892710(null,util[_0x1f37('0x18')](_0x1f37('0x19'),path['basename'](_0x1367a9['originalname'],path[_0x1f37('0x1a')](_0x1367a9['originalname'])),Date[_0x1f37('0x1b')](),path[_0x1f37('0x1a')](_0x1367a9[_0x1f37('0x16')])));}})});router['post']('/',upload['single'](_0x1f37('0x1c')),controller[_0x1f37('0x1d')]);router['post'](_0x1f37('0xd'),controller[_0x1f37('0x1e')]);router[_0x1f37('0x1f')](_0x1f37('0x20'),auth['isAuthenticated'](),controller[_0x1f37('0x21')]);router['delete']('/:id',auth[_0x1f37('0xb')](),controller[_0x1f37('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index c9a9ed1..bece727 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 _0x8776=['ENUM','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x1a5d62,_0x508f3b){var _0x4987de=function(_0x2a5efa){while(--_0x2a5efa){_0x1a5d62['push'](_0x1a5d62['shift']());}};_0x4987de(++_0x508f3b);}(_0x8776,0x136));var _0x6877=function(_0xf946b3,_0x204bb3){_0xf946b3=_0xf946b3-0x0;var _0x508854=_0x8776[_0xf946b3];return _0x508854;};'use strict';var Sequelize=require(_0x6877('0x0'));module[_0x6877('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6877('0x2')]('html',_0x6877('0x3'))},'description':{'type':Sequelize[_0x6877('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x6877('0x5')],'comment':_0x6877('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x6877('0x7')},'sidebar':{'type':Sequelize[_0x6877('0x2')](_0x6877('0x8'),_0x6877('0x9'),_0x6877('0xa'),_0x6877('0xb')),'defaultValue':'always','comment':_0x6877('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x6877('0x5')]},'agentUrl':{'type':Sequelize[_0x6877('0x5')]},'scriptName':{'type':Sequelize[_0x6877('0x5')]},'scriptPath':{'type':Sequelize[_0x6877('0x5')]}}; \ No newline at end of file +var _0x8cd5=['STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x221eae,_0x2a3fa6){var _0x86f9f3=function(_0x59b699){while(--_0x59b699){_0x221eae['push'](_0x221eae['shift']());}};_0x86f9f3(++_0x2a3fa6);}(_0x8cd5,0x1b0));var _0x58cd=function(_0x1637c6,_0x19b783){_0x1637c6=_0x1637c6-0x0;var _0x516b15=_0x8cd5[_0x1637c6];return _0x516b15;};'use strict';var Sequelize=require(_0x58cd('0x0'));module[_0x58cd('0x1')]={'name':{'type':Sequelize[_0x58cd('0x2')]},'type':{'type':Sequelize[_0x58cd('0x3')]('html',_0x58cd('0x4'))},'description':{'type':Sequelize[_0x58cd('0x5')]},'version':{'type':Sequelize[_0x58cd('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x58cd('0x6')},'active':{'type':Sequelize[_0x58cd('0x7')],'defaultValue':0x0,'comment':_0x58cd('0x8')},'sidebar':{'type':Sequelize[_0x58cd('0x3')](_0x58cd('0x9'),_0x58cd('0xa'),_0x58cd('0xb'),_0x58cd('0xc')),'defaultValue':_0x58cd('0xb'),'comment':_0x58cd('0xd')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x58cd('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x58cd('0x2')]},'scriptPath':{'type':Sequelize[_0x58cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index d4ddc5f..49654cd 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 _0x7409=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','%s%s','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','ejs','lodash','jsforce','desk.js','to-csv','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','update','destroy','then','get','UserProfileResource','error','stack','name','index','Plugin','rawAttributes','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','map','options','includeAll','findAll','catch','show','params','intersection','length','download','path','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','dirname','attachments/**/*','finalize','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','type','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','version','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','agent','create','body','role','user','UserProfileSection','find'];(function(_0xa6180a,_0x508ff9){var _0x10f626=function(_0x1bf882){while(--_0x1bf882){_0xa6180a['push'](_0xa6180a['shift']());}};_0x10f626(++_0x508ff9);}(_0x7409,0x15d));var _0x9740=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0x7409[_0x38a3d6];return _0x3768d7;};'use strict';var pdf=require(_0x9740('0x0'));var emlformat=require(_0x9740('0x1'));var rimraf=require(_0x9740('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9740('0x3'));var moment=require(_0x9740('0x4'));var BPromise=require(_0x9740('0x5'));var Mustache=require(_0x9740('0x6'));var util=require(_0x9740('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9740('0x8'));var fs=require('fs');var _=require(_0x9740('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9740('0xa'));var deskjs=require(_0x9740('0xb'));var toCsv=require(_0x9740('0xc'));var querystring=require(_0x9740('0xd'));var Papa=require('papaparse');var extract=require(_0x9740('0xe'));var rimraf=require('rimraf');var archiver=require(_0x9740('0xf'));var Redis=require(_0x9740('0x10'));var authService=require(_0x9740('0x11'));var qs=require(_0x9740('0x12'));var as=require(_0x9740('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9740('0x14'))('api');var utils=require(_0x9740('0x15'));var config=require(_0x9740('0x16'));var licenseUtil=require(_0x9740('0x17'));var db=require(_0x9740('0x18'))['db'];config[_0x9740('0x19')]=_['defaults'](config[_0x9740('0x19')],{'host':_0x9740('0x1a'),'port':0x18eb});var socket=require(_0x9740('0x1b'))(new Redis(config[_0x9740('0x19')]));require('./plugin.socket')[_0x9740('0x1c')](socket);function respondWithStatusCode(_0x286671,_0x4b3827){_0x4b3827=_0x4b3827||0xcc;return function(_0x4bc1ec){if(_0x4bc1ec){return _0x286671[_0x9740('0x1d')](_0x4b3827);}return _0x286671[_0x9740('0x1e')](_0x4b3827)[_0x9740('0x1f')]();};}function respondWithResult(_0x43bb35,_0x30c1f1){_0x30c1f1=_0x30c1f1||0xc8;return function(_0x53fe37){if(_0x53fe37){return _0x43bb35[_0x9740('0x1e')](_0x30c1f1)['json'](_0x53fe37);}};}function respondWithFilteredResult(_0x27a7a0,_0x162d5f){return function(_0x3f458f){if(_0x3f458f){var _0x2168a8=_0x3f458f[_0x9740('0x20')],_0x4c361c=_0x162d5f['offset'],_0x3ccc99=_0x162d5f[_0x9740('0x21')]+_0x162d5f[_0x9740('0x22')],_0x38ac62;if(_0x3ccc99>=_0x2168a8){_0x3ccc99=_0x2168a8;_0x38ac62=0xc8;}else{_0x38ac62=0xce;}_0x27a7a0['status'](_0x38ac62);return _0x27a7a0['set'](_0x9740('0x23'),_0x4c361c+'-'+_0x3ccc99+'/'+_0x2168a8)[_0x9740('0x24')](_0x3f458f);}return null;};}function patchUpdates(_0x4c99cf){return function(_0x10d46d){try{jsonpatch[_0x9740('0x25')](_0x10d46d,_0x4c99cf,!![]);}catch(_0x3ef127){return BPromise['reject'](_0x3ef127);}return _0x10d46d['save']();};}function saveUpdates(_0x130d65,_0x699837){return function(_0x29e12c){if(_0x29e12c){return _0x29e12c[_0x9740('0x26')](_0x130d65)['then'](function(_0x20d16a){return _0x20d16a;});}return null;};}function removeEntity(_0x29cbd3,_0x5c3de6){return function(_0x5a50ef){if(_0x5a50ef){return _0x5a50ef[_0x9740('0x27')]()[_0x9740('0x28')](function(){var _0x4316c4=_0x5a50ef[_0x9740('0x29')]({'plain':!![]});var _0x47bfa1='Plugins';return db[_0x9740('0x2a')]['destroy']({'where':{'type':_0x47bfa1,'resourceId':_0x4316c4['id']}})[_0x9740('0x28')](function(){return _0x5a50ef;});})['then'](function(){_0x29cbd3[_0x9740('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d7656,_0x1d96ad){return function(_0x282f2d){if(!_0x282f2d){_0x1d7656[_0x9740('0x1d')](0x194);}return _0x282f2d;};}function handleError(_0x3987bd,_0x18800e){_0x18800e=_0x18800e||0x1f4;return function(_0x174dc9){logger[_0x9740('0x2b')](_0x174dc9[_0x9740('0x2c')]);if(_0x174dc9['name']){delete _0x174dc9[_0x9740('0x2d')];}_0x3987bd[_0x9740('0x1e')](_0x18800e)['send'](_0x174dc9);};}exports[_0x9740('0x2e')]=function(_0x284ec2,_0x4edc41){var _0x1a8ba8={},_0x436f8f={},_0x4b9ad0={'count':0x0,'rows':[]};var _0x3f1d4d=_['map'](db[_0x9740('0x2f')][_0x9740('0x30')],function(_0x521a87){return{'name':_0x521a87[_0x9740('0x31')],'type':_0x521a87['type']['key']};});_0x436f8f[_0x9740('0x32')]=_['map'](_0x3f1d4d,'name');_0x436f8f[_0x9740('0x33')]=_[_0x9740('0x34')](_0x284ec2[_0x9740('0x33')]);_0x436f8f[_0x9740('0x35')]=_['intersection'](_0x436f8f['model'],_0x436f8f[_0x9740('0x33')]);_0x1a8ba8['attributes']=_['intersection'](_0x436f8f[_0x9740('0x32')],qs[_0x9740('0x36')](_0x284ec2[_0x9740('0x33')][_0x9740('0x36')]));_0x1a8ba8['attributes']=_0x1a8ba8[_0x9740('0x37')]['length']?_0x1a8ba8[_0x9740('0x37')]:_0x436f8f[_0x9740('0x32')];if(!_0x284ec2[_0x9740('0x33')][_0x9740('0x38')]('nolimit')){_0x1a8ba8[_0x9740('0x22')]=qs[_0x9740('0x22')](_0x284ec2[_0x9740('0x33')][_0x9740('0x22')]);_0x1a8ba8[_0x9740('0x21')]=qs['offset'](_0x284ec2[_0x9740('0x33')][_0x9740('0x21')]);}_0x1a8ba8[_0x9740('0x39')]=qs[_0x9740('0x3a')](_0x284ec2[_0x9740('0x33')][_0x9740('0x3a')]);_0x1a8ba8[_0x9740('0x3b')]=qs[_0x9740('0x35')](_['pick'](_0x284ec2[_0x9740('0x33')],_0x436f8f[_0x9740('0x35')]),_0x3f1d4d);if(_0x284ec2[_0x9740('0x33')][_0x9740('0x3c')]){_0x1a8ba8[_0x9740('0x3b')]=_[_0x9740('0x3d')](_0x1a8ba8[_0x9740('0x3b')],{'$or':_[_0x9740('0x3e')](_0x3f1d4d,function(_0x35aa75){if(_0x35aa75['type']!=='VIRTUAL'){var _0x52b721={};_0x52b721[_0x35aa75[_0x9740('0x2d')]]={'$like':'%'+_0x284ec2[_0x9740('0x33')][_0x9740('0x3c')]+'%'};return _0x52b721;}})});}_0x1a8ba8=_[_0x9740('0x3d')]({},_0x1a8ba8,_0x284ec2[_0x9740('0x3f')]);var _0x541ac0={'where':_0x1a8ba8['where']};return db[_0x9740('0x2f')]['count'](_0x541ac0)[_0x9740('0x28')](function(_0x4f7e63){_0x4b9ad0[_0x9740('0x20')]=_0x4f7e63;if(_0x284ec2['query'][_0x9740('0x40')]){_0x1a8ba8['include']=[{'all':!![]}];}return db[_0x9740('0x2f')][_0x9740('0x41')](_0x1a8ba8);})[_0x9740('0x28')](function(_0x19c822){_0x4b9ad0['rows']=_0x19c822;return _0x4b9ad0;})['then'](respondWithFilteredResult(_0x4edc41,_0x1a8ba8))[_0x9740('0x42')](handleError(_0x4edc41,null));};exports[_0x9740('0x43')]=function(_0x3168d0,_0x591468){var _0x312b6d={'raw':!![],'where':{'id':_0x3168d0[_0x9740('0x44')]['id']}},_0x4f98f6={};_0x4f98f6[_0x9740('0x32')]=_[_0x9740('0x34')](db[_0x9740('0x2f')][_0x9740('0x30')]);_0x4f98f6[_0x9740('0x33')]=_[_0x9740('0x34')](_0x3168d0[_0x9740('0x33')]);_0x4f98f6['filters']=_[_0x9740('0x45')](_0x4f98f6[_0x9740('0x32')],_0x4f98f6[_0x9740('0x33')]);_0x312b6d[_0x9740('0x37')]=_[_0x9740('0x45')](_0x4f98f6[_0x9740('0x32')],qs[_0x9740('0x36')](_0x3168d0['query'][_0x9740('0x36')]));_0x312b6d['attributes']=_0x312b6d[_0x9740('0x37')][_0x9740('0x46')]?_0x312b6d['attributes']:_0x4f98f6['model'];if(_0x3168d0[_0x9740('0x33')][_0x9740('0x40')]){_0x312b6d['include']=[{'all':!![]}];}_0x312b6d=_['merge']({},_0x312b6d,_0x3168d0[_0x9740('0x3f')]);return db['Plugin']['find'](_0x312b6d)[_0x9740('0x28')](handleEntityNotFound(_0x591468,null))[_0x9740('0x28')](respondWithResult(_0x591468,null))[_0x9740('0x42')](handleError(_0x591468,null));};exports[_0x9740('0x47')]=function(_0x42f15c,_0x3ae813,_0x1272d4){return db[_0x9740('0x2f')]['find']({'where':{'id':_0x42f15c[_0x9740('0x44')]['id']},'attributes':[_0x9740('0x2d'),_0x9740('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x3ae813,null))[_0x9740('0x28')](function(_0x24a1db){if(_0x24a1db){var _0xea72ec=path[_0x9740('0x49')](config[_0x9740('0x4a')],_0x9740('0x4b'),util[_0x9740('0x4c')](_0x9740('0x4d'),path[_0x9740('0x4e')](_0x24a1db[_0x9740('0x48')])));var _0x163cb3=fs[_0x9740('0x4f')](_0xea72ec);var _0x46695d=archiver('zip',{'zlib':{'level':0x9}});_0x46695d['on'](_0x9740('0x50'),function(_0x37fa37){if(_0x37fa37[_0x9740('0x51')]===_0x9740('0x52')){logger[_0x9740('0x2b')](_0x37fa37);}else{throw new db[(_0x9740('0x53'))]['Error'](_0x9740('0x54'));}});_0x46695d['on'](_0x9740('0x2b'),function(_0x3dd8a1){throw new db['Sequelize'][(_0x9740('0x55'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x46695d[_0x9740('0x56')](_0x163cb3);_0x46695d[_0x9740('0x57')]('**/*',{'cwd':path[_0x9740('0x49')](config['root'],'server/files/plugins',path[_0x9740('0x58')](_0x24a1db[_0x9740('0x48')])),'ignore':[path[_0x9740('0x49')](path[_0x9740('0x4e')](_0x24a1db[_0x9740('0x48')]),'node_modules/**/*'),path[_0x9740('0x49')](path[_0x9740('0x4e')](_0x24a1db['path']),_0x9740('0x59'))],'nodir':!![]})[_0x9740('0x5a')]();_0x163cb3['on']('close',function(){if(!fs['existsSync'](_0xea72ec)){throw new db['Sequelize']['Error'](_0x9740('0x5b'));}return _0x3ae813['download'](_0xea72ec,util[_0x9740('0x4c')](_0x9740('0x4d'),path[_0x9740('0x4e')](_0x24a1db[_0x9740('0x48')])),function(_0x244642){if(_0x244642){throw new db[(_0x9740('0x53'))]['Error'](_0x9740('0x5c'));}fs['unlinkSync'](_0xea72ec);logger[_0x9740('0x5d')](_0x9740('0x5e'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x9740('0x42')](handleError(_0x3ae813,null));};exports[_0x9740('0x5f')]=function(_0x465803,_0x53fe96,_0x4c3f61){var _0x2bb12e=path[_0x9740('0x4e')](_0x465803[_0x9740('0x60')][_0x9740('0x61')],path[_0x9740('0x62')](_0x465803[_0x9740('0x60')][_0x9740('0x61')]));var _0x561ce1=path[_0x9740('0x49')](config[_0x9740('0x4a')],_0x9740('0x4b'),_0x465803['file']['filename']);var _0x326aeb=path[_0x9740('0x49')](config[_0x9740('0x4a')],'server/files/plugins',_0x2bb12e);logger[_0x9740('0x5d')]('Plugin\x20upload\x20filepath:\x20%s',_0x561ce1);logger[_0x9740('0x5d')](_0x9740('0x63'),_0x326aeb);try{fs[_0x9740('0x64')](_0x561ce1,parseInt('0777',0x8));extract(_0x561ce1,{'dir':_0x326aeb},function(_0x14d04f){if(_0x14d04f){logger['error'](_0x14d04f);handleError(_0x14d04f,!![]);};var _0x334750=fs[_0x9740('0x65')](_0x326aeb);if(_0x334750[_0x9740('0x46')]>0x1){removeReferences(_0x561ce1,_0x326aeb);logger['error']('Invalid\x20plugin\x20structure');return _0x4c3f61(new Error(_0x9740('0x66')));}var _0x29d4c2=fs[_0x9740('0x67')](path[_0x9740('0x49')](_0x326aeb,_0x334750[0x0]));if(_0x29d4c2[_0x9740('0x68')]()){removeReferences(_0x561ce1,_0x326aeb);logger[_0x9740('0x2b')](_0x9740('0x66'));return _0x4c3f61(new Error(_0x9740('0x66')));}if(_0x29d4c2[_0x9740('0x69')]()){var _0x3884a4=fs[_0x9740('0x65')](path[_0x9740('0x49')](_0x326aeb,_0x334750[0x0]));if(_0x3884a4[_0x9740('0x46')]===0x0){removeReferences(_0x561ce1,_0x326aeb);logger[_0x9740('0x2b')]('Invalid\x20plugin\x20structure');return _0x4c3f61(new Error('Invalid\x20plugin\x20structure'));}var _0x2292f6=_0x3884a4['some'](function(_0x1f894b){return _0x1f894b===_0x9740('0x6a');});if(!_0x2292f6){return _0x4c3f61(new Error(_0x9740('0x6b')));}var _0x207096=fs[_0x9740('0x6c')](path['join'](_0x326aeb,_0x334750[0x0],_0x9740('0x6a')));var _0x413fb6=JSON[_0x9740('0x6d')](_0x207096);if(_0x9740('0x6e')==typeof _0x413fb6[_0x9740('0x2d')]){return _0x4c3f61(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x9740('0x6e')==typeof _0x413fb6[_0x9740('0x6f')]){return _0x4c3f61(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x9740('0x6e')==typeof _0x413fb6['version']){return _0x4c3f61(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x413fb6[_0x9740('0x70')]){return _0x4c3f61(new Error(_0x9740('0x71')));}if(_0x413fb6[_0x9740('0x6f')]===_0x9740('0x72')){if(_0x9740('0x6e')==typeof _0x413fb6[_0x9740('0x70')][_0x9740('0x73')]){return _0x4c3f61(new Error(_0x9740('0x74')));}if(_0x9740('0x6e')==typeof _0x413fb6[_0x9740('0x70')]['views']['admin']&&'undefined'==typeof _0x413fb6[_0x9740('0x70')]['views']['agent']){return _0x4c3f61(new Error(_0x9740('0x75')));}}else if(_0x413fb6[_0x9740('0x6f')]===_0x9740('0x76')){if(_0x9740('0x6e')==typeof _0x413fb6['parameters'][_0x9740('0x77')]){return _0x4c3f61(new Error(_0x9740('0x78')));}if(_0x9740('0x6e')==typeof _0x413fb6[_0x9740('0x70')][_0x9740('0x79')]){return _0x4c3f61(new Error(_0x9740('0x7a')));}}else{return _0x4c3f61(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x3a4f5a=_0x413fb6[_0x9740('0x2d')];var _0x4316a5=_0x413fb6['description'];var _0x4a09f0=_0x413fb6[_0x9740('0x6f')];var _0xb497ae=_0x413fb6[_0x9740('0x7b')]?_0x413fb6['sidebar']:_0x9740('0x7c');var _0x30748f=_0x413fb6[_0x9740('0x7d')]?_0x413fb6[_0x9740('0x7d')]:_0x9740('0x7e');var _0x158827='';var _0x60c907='';var _0x2069fc='';var _0x39ddcb='';var _0x3b3c60=_0x413fb6[_0x9740('0x7f')];if(_0x4a09f0===_0x9740('0x72')){if(_0x9740('0x6e')!=typeof _0x413fb6['parameters'][_0x9740('0x73')]['admin']){var _0x53711f=_0x413fb6['parameters'][_0x9740('0x73')][_0x9740('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x9740('0x81')](_0x53711f)){_0x158827=path[_0x9740('0x49')](_0x9740('0x82'),_0x2bb12e,_0x334750[0x0],_0x53711f);}else{_0x158827=_0x53711f;}}else{logger[_0x9740('0x5d')](_0x9740('0x83'));}if('undefined'!=typeof _0x413fb6[_0x9740('0x70')][_0x9740('0x73')]['agent']){var _0x31a363=_0x413fb6[_0x9740('0x70')][_0x9740('0x73')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9740('0x81')](_0x31a363)){_0x60c907=path['join'](_0x9740('0x82'),_0x2bb12e,_0x334750[0x0],_0x31a363);}else{_0x60c907=_0x31a363;}}else{logger[_0x9740('0x5d')](_0x9740('0x84'));}}else if(_0x4a09f0===_0x9740('0x76')){_0x2069fc=_0x413fb6[_0x9740('0x70')][_0x9740('0x77')];_0x39ddcb=_0x413fb6[_0x9740('0x70')]['scriptPath'];if(_0x9740('0x6e')!=typeof _0x413fb6['parameters'][_0x9740('0x73')]){if(_0x9740('0x6e')!=typeof _0x413fb6[_0x9740('0x70')][_0x9740('0x73')][_0x9740('0x80')]){var _0x53711f=_0x413fb6['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x9740('0x81')](_0x53711f)){_0x158827=path[_0x9740('0x49')]('plugins',_0x2bb12e,_0x334750[0x0],_0x53711f);}else{_0x158827=_0x53711f;}}if(_0x9740('0x6e')!=typeof _0x413fb6[_0x9740('0x70')][_0x9740('0x73')][_0x9740('0x85')]){var _0x31a363=_0x413fb6[_0x9740('0x70')][_0x9740('0x73')][_0x9740('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x9740('0x81')](_0x31a363)){_0x60c907=path['join'](_0x9740('0x82'),_0x2bb12e,_0x334750[0x0],_0x31a363);}else{_0x60c907=_0x31a363;}}}}var _0x5e0b4b={'name':_0x3a4f5a,'description':_0x4316a5,'path':path[_0x9740('0x49')](_0x2bb12e,_0x334750[0x0]),'type':_0x4a09f0,'sidebar':_0xb497ae,'icon':_0x30748f,'adminUrl':_0x158827,'agentUrl':_0x60c907,'scriptName':_0x2069fc,'scriptPath':_0x39ddcb,'version':_0x3b3c60};removeReferences(_0x561ce1,null);return db[_0x9740('0x2f')][_0x9740('0x86')](_0x5e0b4b)[_0x9740('0x28')](function(_0x196db1){var _0x2efa5e={'role':_0x465803['body']['role'],'userProfileId':_0x465803[_0x9740('0x87')]['userProfileId']};if(!_0x2efa5e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2efa5e[_0x9740('0x88')]===_0x9740('0x89')){var _0x4b8b3b=_0x196db1[_0x9740('0x29')]({'plain':!![]});return db[_0x9740('0x8a')][_0x9740('0x8b')]({'where':{'name':'Plugins','userProfileId':_0x2efa5e[_0x9740('0x8c')]},'raw':!![]})['then'](function(_0x41c32b){if(_0x41c32b&&_0x41c32b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4b8b3b['name'],'resourceId':_0x4b8b3b['id'],'type':_0x41c32b[_0x9740('0x2d')],'sectionId':_0x41c32b['id']},{})[_0x9740('0x28')](function(){return _0x196db1;});}else{return _0x196db1;}})[_0x9740('0x42')](function(_0x1c54ca){logger['error'](_0x9740('0x8d'),_0x1c54ca);throw _0x1c54ca;});}return _0x196db1;})[_0x9740('0x28')](respondWithResult(_0x53fe96,null))[_0x9740('0x42')](handleError(_0x53fe96,null));}});}catch(_0x234b3b){_0x53fe96[_0x9740('0x1e')](0x1f4)[_0x9740('0x8e')](_0x234b3b);}};function removeReferences(_0x106193,_0x132d59){try{if(_0x106193){fs[_0x9740('0x8f')](_0x106193);logger['info'](_0x9740('0x90'));}if(_0x132d59){rimraf(_0x132d59,function(){});logger['info'](_0x9740('0x91'));}}catch(_0x2cda01){logger[_0x9740('0x2b')](_0x2cda01);}}exports[_0x9740('0x26')]=function(_0x2018e0,_0x43efe4,_0x2bc839){return db[_0x9740('0x2f')][_0x9740('0x8b')]({'where':{'id':_0x2018e0[_0x9740('0x44')]['id']}})[_0x9740('0x28')](handleEntityNotFound(_0x43efe4,null))[_0x9740('0x28')](saveUpdates(_0x2018e0[_0x9740('0x87')],null))[_0x9740('0x28')](respondWithResult(_0x43efe4,null))[_0x9740('0x42')](handleError(_0x43efe4,null));};exports[_0x9740('0x92')]=function(_0x395494,_0x216f40,_0x485ee5){return db[_0x9740('0x2f')][_0x9740('0x8b')]({'where':{'id':_0x395494[_0x9740('0x44')]['id']}})['then'](function(_0x2b5fda){if(_0x2b5fda){return _0x2b5fda[_0x9740('0x27')]();}})[_0x9740('0x28')](function(_0x3e028f){rimraf(path[_0x9740('0x49')](config[_0x9740('0x4a')],_0x9740('0x4b'),path['dirname'](_0x3e028f[_0x9740('0x48')])),function(){});return _0x3e028f;})[_0x9740('0x28')](handleEntityNotFound(_0x216f40,null))[_0x9740('0x28')](respondWithStatusCode(_0x216f40,null))['catch'](handleError(_0x216f40,null));};exports['webhookGet']=function(_0x11e79b,_0x55ceef,_0x4931c2){return BPromise[_0x9740('0x93')]()[_0x9740('0x28')](function(){if(!_0x11e79b['query'][_0x9740('0x48')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x11e79b[_0x9740('0x33')][_0x9740('0x94')]){throw new Error(_0x9740('0x95'));}var _0x566472=_0x11e79b[_0x9740('0x33')][_0x9740('0x96')]?_0x11e79b[_0x9740('0x33')][_0x9740('0x96')]+':'+_0x11e79b['query'][_0x9740('0x94')]:_0x9740('0x97')+_0x11e79b[_0x9740('0x33')][_0x9740('0x94')];var _0x577856=_0x11e79b['query']['json']?_0x11e79b['query'][_0x9740('0x24')]:!![];var _0x271d9d=_0x11e79b[_0x9740('0x33')]['encoding']?_0x11e79b[_0x9740('0x33')][_0x9740('0x98')]:null;var _0x54ef91={'method':_0x11e79b[_0x9740('0x99')],'uri':util[_0x9740('0x4c')]('%s%s',_0x566472,_0x11e79b[_0x9740('0x33')][_0x9740('0x48')]),'json':_0x577856,'resolveWithFullResponse':!![],'encoding':_0x271d9d,'qs':_0x11e79b[_0x9740('0x33')]};if(_0x11e79b[_0x9740('0x9a')]){_0x54ef91[_0x9740('0x9a')]=_0x11e79b['headers'];if(_0x54ef91['headers'][_0x9740('0x9b')]){delete _0x54ef91['headers'][_0x9740('0x9b')];}}if(_0x54ef91['headers'][_0x9740('0x9c')]){delete _0x54ef91[_0x9740('0x9a')][_0x9740('0x9c')];}return rp(_0x54ef91);})[_0x9740('0x28')](function(_0x3e64b3){if(_0x3e64b3){_0x55ceef[_0x9740('0x9d')](_0x3e64b3[_0x9740('0x9a')]);logger[_0x9740('0x5d')](_0x3e64b3[_0x9740('0x87')]);if(_[_0x9740('0x9e')](_0x11e79b['query'][_0x9740('0x48')],'download')&&_0x3e64b3[_0x9740('0x9f')]==0x1f4){return _0x55ceef['sendStatus'](_0x3e64b3[_0x9740('0x9f')]);}else{return _0x55ceef['status'](_0x3e64b3['statusCode'])[_0x9740('0x8e')](_0x3e64b3['body']);}}else{return _0x55ceef[_0x9740('0x1d')](0xc8);}})['catch'](handleError(_0x55ceef,null));};exports[_0x9740('0xa0')]=function(_0x3c5c19,_0x1dd9fd,_0x228fdd){return BPromise[_0x9740('0x93')]()['then'](function(){if(!_0x3c5c19[_0x9740('0x33')][_0x9740('0x48')]){throw new Error(_0x9740('0xa1'));}if(!_0x3c5c19[_0x9740('0x33')][_0x9740('0x94')]){throw new Error(_0x9740('0x95'));}var _0x27f3a6=_0x3c5c19[_0x9740('0x33')][_0x9740('0x96')]?_0x3c5c19[_0x9740('0x33')][_0x9740('0x96')]+':'+_0x3c5c19[_0x9740('0x33')]['port']:_0x9740('0x97')+_0x3c5c19[_0x9740('0x33')]['port'];var _0x39a79e=_0x3c5c19[_0x9740('0x33')]['json']?_0x3c5c19[_0x9740('0x33')][_0x9740('0x24')]:!![];var _0x2a5b44=_0x3c5c19['query'][_0x9740('0x98')]?_0x3c5c19[_0x9740('0x33')][_0x9740('0x98')]:null;var _0x391071={'method':_0x3c5c19[_0x9740('0x99')],'uri':util[_0x9740('0x4c')](_0x9740('0xa2'),_0x27f3a6,_0x3c5c19['query'][_0x9740('0x48')]),'json':_0x39a79e,'resolveWithFullResponse':!![],'encoding':_0x2a5b44,'body':_0x3c5c19['body']};if(_0x3c5c19[_0x9740('0x9a')]){_0x391071[_0x9740('0x9a')]=_0x3c5c19[_0x9740('0x9a')];if(_0x391071['headers'][_0x9740('0x9b')]){delete _0x391071[_0x9740('0x9a')][_0x9740('0x9b')];}}if(_0x391071['headers'][_0x9740('0x9c')]){delete _0x391071['headers'][_0x9740('0x9c')];}return rp(_0x391071);})['then'](function(_0x7da873){if(_0x7da873){_0x1dd9fd['set'](_0x7da873['headers']);logger[_0x9740('0x5d')](_0x7da873['body']);return _0x1dd9fd['status'](_0x7da873[_0x9740('0x9f')])[_0x9740('0x8e')](_0x7da873[_0x9740('0x87')]);}else{return _0x1dd9fd[_0x9740('0x1d')](0xc8);}})[_0x9740('0x42')](handleError(_0x1dd9fd,null));}; \ No newline at end of file +var _0x9f68=['server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','length','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','html','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','%s%s','headers','content-length','content-type','statusCode','webhookPost','http://localhost:','method','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','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','./plugin.socket','register','sendStatus','json','count','offset','limit','set','Content-Range','apply','reject','update','then','Plugins','UserProfileResource','destroy','status','end','stack','name','send','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','options','find','download','join','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','root'];(function(_0x1da2e0,_0x38b910){var _0x4d7947=function(_0x457322){while(--_0x457322){_0x1da2e0['push'](_0x1da2e0['shift']());}};_0x4d7947(++_0x38b910);}(_0x9f68,0x1bc));var _0x89f6=function(_0x196771,_0x2b711a){_0x196771=_0x196771-0x0;var _0x1a052e=_0x9f68[_0x196771];return _0x1a052e;};'use strict';var pdf=require(_0x89f6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x89f6('0x1'));var zipdir=require(_0x89f6('0x2'));var jsonpatch=require(_0x89f6('0x3'));var rp=require(_0x89f6('0x4'));var moment=require('moment');var BPromise=require(_0x89f6('0x5'));var Mustache=require(_0x89f6('0x6'));var util=require(_0x89f6('0x7'));var path=require(_0x89f6('0x8'));var sox=require(_0x89f6('0x9'));var csv=require(_0x89f6('0xa'));var ejs=require(_0x89f6('0xb'));var fs=require('fs');var _=require(_0x89f6('0xc'));var squel=require(_0x89f6('0xd'));var crypto=require('crypto');var jsforce=require(_0x89f6('0xe'));var deskjs=require(_0x89f6('0xf'));var toCsv=require(_0x89f6('0xa'));var querystring=require(_0x89f6('0x10'));var Papa=require(_0x89f6('0x11'));var extract=require(_0x89f6('0x12'));var rimraf=require('rimraf');var archiver=require(_0x89f6('0x13'));var Redis=require(_0x89f6('0x14'));var authService=require(_0x89f6('0x15'));var qs=require(_0x89f6('0x16'));var as=require(_0x89f6('0x17'));var hardwareService=require(_0x89f6('0x18'));var logger=require(_0x89f6('0x19'))(_0x89f6('0x1a'));var utils=require(_0x89f6('0x1b'));var config=require(_0x89f6('0x1c'));var licenseUtil=require(_0x89f6('0x1d'));var db=require(_0x89f6('0x1e'))['db'];config[_0x89f6('0x1f')]=_[_0x89f6('0x20')](config[_0x89f6('0x1f')],{'host':_0x89f6('0x21'),'port':0x18eb});var socket=require(_0x89f6('0x22'))(new Redis(config['redis']));require(_0x89f6('0x23'))[_0x89f6('0x24')](socket);function respondWithStatusCode(_0x4bab51,_0x233b27){_0x233b27=_0x233b27||0xcc;return function(_0x4b2d82){if(_0x4b2d82){return _0x4bab51[_0x89f6('0x25')](_0x233b27);}return _0x4bab51['status'](_0x233b27)['end']();};}function respondWithResult(_0x3b064f,_0x3d546b){_0x3d546b=_0x3d546b||0xc8;return function(_0x171497){if(_0x171497){return _0x3b064f['status'](_0x3d546b)[_0x89f6('0x26')](_0x171497);}};}function respondWithFilteredResult(_0x3c8cc7,_0xa7b329){return function(_0x55f7ba){if(_0x55f7ba){var _0x510316=_0x55f7ba[_0x89f6('0x27')],_0x188144=_0xa7b329[_0x89f6('0x28')],_0x492311=_0xa7b329[_0x89f6('0x28')]+_0xa7b329[_0x89f6('0x29')],_0x2cb7c7;if(_0x492311>=_0x510316){_0x492311=_0x510316;_0x2cb7c7=0xc8;}else{_0x2cb7c7=0xce;}_0x3c8cc7['status'](_0x2cb7c7);return _0x3c8cc7[_0x89f6('0x2a')](_0x89f6('0x2b'),_0x188144+'-'+_0x492311+'/'+_0x510316)['json'](_0x55f7ba);}return null;};}function patchUpdates(_0x29be9b){return function(_0x9afd8f){try{jsonpatch[_0x89f6('0x2c')](_0x9afd8f,_0x29be9b,!![]);}catch(_0x398e68){return BPromise[_0x89f6('0x2d')](_0x398e68);}return _0x9afd8f['save']();};}function saveUpdates(_0x5b494d,_0x3c5de8){return function(_0x2bdd83){if(_0x2bdd83){return _0x2bdd83[_0x89f6('0x2e')](_0x5b494d)[_0x89f6('0x2f')](function(_0x1f3a2d){return _0x1f3a2d;});}return null;};}function removeEntity(_0x43dabb,_0x2bb743){return function(_0x1b5d33){if(_0x1b5d33){return _0x1b5d33['destroy']()[_0x89f6('0x2f')](function(){var _0x3169e2=_0x1b5d33['get']({'plain':!![]});var _0x4148d1=_0x89f6('0x30');return db[_0x89f6('0x31')][_0x89f6('0x32')]({'where':{'type':_0x4148d1,'resourceId':_0x3169e2['id']}})[_0x89f6('0x2f')](function(){return _0x1b5d33;});})[_0x89f6('0x2f')](function(){_0x43dabb[_0x89f6('0x33')](0xcc)[_0x89f6('0x34')]();});}};}function handleEntityNotFound(_0x1c88a6,_0x1dc188){return function(_0x53e69d){if(!_0x53e69d){_0x1c88a6[_0x89f6('0x25')](0x194);}return _0x53e69d;};}function handleError(_0x24f3fe,_0x5e154c){_0x5e154c=_0x5e154c||0x1f4;return function(_0x1d2294){logger['error'](_0x1d2294[_0x89f6('0x35')]);if(_0x1d2294[_0x89f6('0x36')]){delete _0x1d2294[_0x89f6('0x36')];}_0x24f3fe['status'](_0x5e154c)[_0x89f6('0x37')](_0x1d2294);};}exports['index']=function(_0x335810,_0x22061d){var _0x43fbea={},_0x3667e3={},_0x4bf34d={'count':0x0,'rows':[]};var _0x43bbd1=_[_0x89f6('0x38')](db[_0x89f6('0x39')][_0x89f6('0x3a')],function(_0x523043){return{'name':_0x523043[_0x89f6('0x3b')],'type':_0x523043[_0x89f6('0x3c')][_0x89f6('0x3d')]};});_0x3667e3[_0x89f6('0x3e')]=_['map'](_0x43bbd1,_0x89f6('0x36'));_0x3667e3[_0x89f6('0x3f')]=_[_0x89f6('0x40')](_0x335810['query']);_0x3667e3['filters']=_['intersection'](_0x3667e3[_0x89f6('0x3e')],_0x3667e3[_0x89f6('0x3f')]);_0x43fbea['attributes']=_[_0x89f6('0x41')](_0x3667e3['model'],qs['fields'](_0x335810[_0x89f6('0x3f')][_0x89f6('0x42')]));_0x43fbea['attributes']=_0x43fbea['attributes']['length']?_0x43fbea[_0x89f6('0x43')]:_0x3667e3[_0x89f6('0x3e')];if(!_0x335810[_0x89f6('0x3f')]['hasOwnProperty'](_0x89f6('0x44'))){_0x43fbea['limit']=qs[_0x89f6('0x29')](_0x335810[_0x89f6('0x3f')][_0x89f6('0x29')]);_0x43fbea['offset']=qs[_0x89f6('0x28')](_0x335810[_0x89f6('0x3f')][_0x89f6('0x28')]);}_0x43fbea[_0x89f6('0x45')]=qs['sort'](_0x335810[_0x89f6('0x3f')][_0x89f6('0x46')]);_0x43fbea[_0x89f6('0x47')]=qs[_0x89f6('0x48')](_[_0x89f6('0x49')](_0x335810[_0x89f6('0x3f')],_0x3667e3[_0x89f6('0x48')]),_0x43bbd1);if(_0x335810[_0x89f6('0x3f')]['filter']){_0x43fbea[_0x89f6('0x47')]=_[_0x89f6('0x4a')](_0x43fbea['where'],{'$or':_[_0x89f6('0x38')](_0x43bbd1,function(_0x132716){if(_0x132716[_0x89f6('0x3c')]!==_0x89f6('0x4b')){var _0x20c93f={};_0x20c93f[_0x132716[_0x89f6('0x36')]]={'$like':'%'+_0x335810['query'][_0x89f6('0x4c')]+'%'};return _0x20c93f;}})});}_0x43fbea=_[_0x89f6('0x4a')]({},_0x43fbea,_0x335810['options']);var _0x2475bb={'where':_0x43fbea[_0x89f6('0x47')]};return db[_0x89f6('0x39')]['count'](_0x2475bb)[_0x89f6('0x2f')](function(_0x4382b9){_0x4bf34d[_0x89f6('0x27')]=_0x4382b9;if(_0x335810[_0x89f6('0x3f')][_0x89f6('0x4d')]){_0x43fbea[_0x89f6('0x4e')]=[{'all':!![]}];}return db['Plugin'][_0x89f6('0x4f')](_0x43fbea);})[_0x89f6('0x2f')](function(_0x3cf37b){_0x4bf34d['rows']=_0x3cf37b;return _0x4bf34d;})[_0x89f6('0x2f')](respondWithFilteredResult(_0x22061d,_0x43fbea))[_0x89f6('0x50')](handleError(_0x22061d,null));};exports[_0x89f6('0x51')]=function(_0x27b274,_0x123630){var _0x125adc={'raw':!![],'where':{'id':_0x27b274[_0x89f6('0x52')]['id']}},_0x5b1c6a={};_0x5b1c6a[_0x89f6('0x3e')]=_['keys'](db[_0x89f6('0x39')][_0x89f6('0x3a')]);_0x5b1c6a[_0x89f6('0x3f')]=_[_0x89f6('0x40')](_0x27b274[_0x89f6('0x3f')]);_0x5b1c6a[_0x89f6('0x48')]=_['intersection'](_0x5b1c6a[_0x89f6('0x3e')],_0x5b1c6a[_0x89f6('0x3f')]);_0x125adc[_0x89f6('0x43')]=_[_0x89f6('0x41')](_0x5b1c6a[_0x89f6('0x3e')],qs[_0x89f6('0x42')](_0x27b274['query']['fields']));_0x125adc[_0x89f6('0x43')]=_0x125adc[_0x89f6('0x43')]['length']?_0x125adc[_0x89f6('0x43')]:_0x5b1c6a[_0x89f6('0x3e')];if(_0x27b274[_0x89f6('0x3f')][_0x89f6('0x4d')]){_0x125adc[_0x89f6('0x4e')]=[{'all':!![]}];}_0x125adc=_[_0x89f6('0x4a')]({},_0x125adc,_0x27b274[_0x89f6('0x53')]);return db[_0x89f6('0x39')][_0x89f6('0x54')](_0x125adc)['then'](handleEntityNotFound(_0x123630,null))[_0x89f6('0x2f')](respondWithResult(_0x123630,null))[_0x89f6('0x50')](handleError(_0x123630,null));};exports[_0x89f6('0x55')]=function(_0x5e1e65,_0x17153e,_0x3b409e){return db['Plugin'][_0x89f6('0x54')]({'where':{'id':_0x5e1e65[_0x89f6('0x52')]['id']},'attributes':['name',_0x89f6('0x8')],'raw':!![]})[_0x89f6('0x2f')](handleEntityNotFound(_0x17153e,null))[_0x89f6('0x2f')](function(_0x33467d){if(_0x33467d){var _0x2d6d79=path[_0x89f6('0x56')](config['root'],'server/files/plugins',util[_0x89f6('0x57')](_0x89f6('0x58'),path[_0x89f6('0x59')](_0x33467d['path'])));var _0x1131a0=fs[_0x89f6('0x5a')](_0x2d6d79);var _0x488a86=archiver(_0x89f6('0x5b'),{'zlib':{'level':0x9}});_0x488a86['on'](_0x89f6('0x5c'),function(_0x3fc862){if(_0x3fc862[_0x89f6('0x5d')]===_0x89f6('0x5e')){logger[_0x89f6('0x5f')](_0x3fc862);}else{throw new db[(_0x89f6('0x60'))][(_0x89f6('0x61'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x488a86['on'](_0x89f6('0x5f'),function(_0x5bdb03){throw new db[(_0x89f6('0x60'))]['Error'](_0x89f6('0x62'));});_0x488a86['pipe'](_0x1131a0);_0x488a86[_0x89f6('0x63')](_0x89f6('0x64'),{'cwd':path[_0x89f6('0x56')](config[_0x89f6('0x65')],_0x89f6('0x66'),path[_0x89f6('0x67')](_0x33467d[_0x89f6('0x8')])),'ignore':[path[_0x89f6('0x56')](path[_0x89f6('0x59')](_0x33467d[_0x89f6('0x8')]),_0x89f6('0x68')),path['join'](path[_0x89f6('0x59')](_0x33467d['path']),_0x89f6('0x69'))],'nodir':!![]})[_0x89f6('0x6a')]();_0x1131a0['on'](_0x89f6('0x6b'),function(){if(!fs[_0x89f6('0x6c')](_0x2d6d79)){throw new db[(_0x89f6('0x60'))][(_0x89f6('0x61'))](_0x89f6('0x6d'));}return _0x17153e['download'](_0x2d6d79,util[_0x89f6('0x57')](_0x89f6('0x58'),path[_0x89f6('0x59')](_0x33467d[_0x89f6('0x8')])),function(_0xd8889){if(_0xd8889){throw new db[(_0x89f6('0x60'))][(_0x89f6('0x61'))](_0x89f6('0x6e'));}fs[_0x89f6('0x6f')](_0x2d6d79);logger[_0x89f6('0x70')](_0x89f6('0x71'));logger[_0x89f6('0x70')](_0x89f6('0x72'));});});}return null;})['catch'](handleError(_0x17153e,null));};exports[_0x89f6('0x73')]=function(_0x59fb27,_0x3d0137,_0x884b3a){var _0x4df137=path[_0x89f6('0x59')](_0x59fb27[_0x89f6('0x74')][_0x89f6('0x75')],path[_0x89f6('0x76')](_0x59fb27[_0x89f6('0x74')][_0x89f6('0x75')]));var _0x34979e=path[_0x89f6('0x56')](config['root'],_0x89f6('0x66'),_0x59fb27[_0x89f6('0x74')][_0x89f6('0x75')]);var _0x137f60=path[_0x89f6('0x56')](config[_0x89f6('0x65')],_0x89f6('0x66'),_0x4df137);logger[_0x89f6('0x70')](_0x89f6('0x77'),_0x34979e);logger[_0x89f6('0x70')](_0x89f6('0x78'),_0x137f60);try{fs[_0x89f6('0x79')](_0x34979e,parseInt(_0x89f6('0x7a'),0x8));extract(_0x34979e,{'dir':_0x137f60},function(_0x5d8d94){if(_0x5d8d94){logger[_0x89f6('0x5f')](_0x5d8d94);handleError(_0x5d8d94,!![]);};var _0x26a2ee=fs['readdirSync'](_0x137f60);if(_0x26a2ee[_0x89f6('0x7b')]>0x1){removeReferences(_0x34979e,_0x137f60);logger[_0x89f6('0x5f')](_0x89f6('0x7c'));return _0x884b3a(new Error(_0x89f6('0x7c')));}var _0x10626e=fs[_0x89f6('0x7d')](path[_0x89f6('0x56')](_0x137f60,_0x26a2ee[0x0]));if(_0x10626e[_0x89f6('0x7e')]()){removeReferences(_0x34979e,_0x137f60);logger[_0x89f6('0x5f')]('Invalid\x20plugin\x20structure');return _0x884b3a(new Error(_0x89f6('0x7c')));}if(_0x10626e[_0x89f6('0x7f')]()){var _0x6e9826=fs['readdirSync'](path['join'](_0x137f60,_0x26a2ee[0x0]));if(_0x6e9826['length']===0x0){removeReferences(_0x34979e,_0x137f60);logger[_0x89f6('0x5f')](_0x89f6('0x7c'));return _0x884b3a(new Error(_0x89f6('0x7c')));}var _0x113178=_0x6e9826[_0x89f6('0x80')](function(_0x514a4d){return _0x514a4d===_0x89f6('0x81');});if(!_0x113178){return _0x884b3a(new Error('Plugin\x20manifest\x20missing'));}var _0x83591b=fs['readFileSync'](path[_0x89f6('0x56')](_0x137f60,_0x26a2ee[0x0],_0x89f6('0x81')));var _0x30c556=JSON[_0x89f6('0x82')](_0x83591b);if(_0x89f6('0x83')==typeof _0x30c556['name']){return _0x884b3a(new Error(_0x89f6('0x84')));}if(_0x89f6('0x83')==typeof _0x30c556[_0x89f6('0x3c')]){return _0x884b3a(new Error(_0x89f6('0x85')));}if('undefined'==typeof _0x30c556[_0x89f6('0x86')]){return _0x884b3a(new Error(_0x89f6('0x87')));}if(_0x89f6('0x83')==typeof _0x30c556[_0x89f6('0x88')]){return _0x884b3a(new Error(_0x89f6('0x89')));}if(_0x30c556[_0x89f6('0x3c')]==='html'){if('undefined'==typeof _0x30c556[_0x89f6('0x88')][_0x89f6('0x8a')]){return _0x884b3a(new Error(_0x89f6('0x8b')));}if(_0x89f6('0x83')==typeof _0x30c556[_0x89f6('0x88')][_0x89f6('0x8a')][_0x89f6('0x8c')]&&_0x89f6('0x83')==typeof _0x30c556[_0x89f6('0x88')]['views'][_0x89f6('0x8d')]){return _0x884b3a(new Error(_0x89f6('0x8e')));}}else if(_0x30c556[_0x89f6('0x3c')]===_0x89f6('0x8f')){if(_0x89f6('0x83')==typeof _0x30c556['parameters'][_0x89f6('0x90')]){return _0x884b3a(new Error(_0x89f6('0x91')));}if('undefined'==typeof _0x30c556['parameters']['scriptPath']){return _0x884b3a(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x884b3a(new Error(_0x89f6('0x92')));}var _0x685623=_0x30c556['name'];var _0x17a42d=_0x30c556[_0x89f6('0x93')];var _0x303c75=_0x30c556[_0x89f6('0x3c')];var _0x2f1ab8=_0x30c556[_0x89f6('0x94')]?_0x30c556['sidebar']:_0x89f6('0x95');var _0x334ed3=_0x30c556['icon']?_0x30c556['icon']:'icon-apps';var _0x4d1099='';var _0x3e86ec='';var _0x2e1f50='';var _0x93070f='';var _0x4e634f=_0x30c556[_0x89f6('0x86')];if(_0x303c75===_0x89f6('0x96')){if('undefined'!=typeof _0x30c556['parameters'][_0x89f6('0x8a')]['admin']){var _0x5b88d8=_0x30c556[_0x89f6('0x88')]['views'][_0x89f6('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5b88d8)){_0x4d1099=path[_0x89f6('0x56')](_0x89f6('0x97'),_0x4df137,_0x26a2ee[0x0],_0x5b88d8);}else{_0x4d1099=_0x5b88d8;}}else{logger['info'](_0x89f6('0x98'));}if(_0x89f6('0x83')!=typeof _0x30c556[_0x89f6('0x88')]['views']['agent']){var _0x2eba17=_0x30c556[_0x89f6('0x88')][_0x89f6('0x8a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x89f6('0x99')](_0x2eba17)){_0x3e86ec=path[_0x89f6('0x56')]('plugins',_0x4df137,_0x26a2ee[0x0],_0x2eba17);}else{_0x3e86ec=_0x2eba17;}}else{logger[_0x89f6('0x70')](_0x89f6('0x9a'));}}else if(_0x303c75==='script'){_0x2e1f50=_0x30c556[_0x89f6('0x88')][_0x89f6('0x90')];_0x93070f=_0x30c556[_0x89f6('0x88')][_0x89f6('0x9b')];if(_0x89f6('0x83')!=typeof _0x30c556[_0x89f6('0x88')]['views']){if(_0x89f6('0x83')!=typeof _0x30c556[_0x89f6('0x88')][_0x89f6('0x8a')]['admin']){var _0x5b88d8=_0x30c556['parameters'][_0x89f6('0x8a')][_0x89f6('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5b88d8)){_0x4d1099=path['join'](_0x89f6('0x97'),_0x4df137,_0x26a2ee[0x0],_0x5b88d8);}else{_0x4d1099=_0x5b88d8;}}if(_0x89f6('0x83')!=typeof _0x30c556['parameters']['views'][_0x89f6('0x8d')]){var _0x2eba17=_0x30c556[_0x89f6('0x88')][_0x89f6('0x8a')][_0x89f6('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x89f6('0x99')](_0x2eba17)){_0x3e86ec=path[_0x89f6('0x56')]('plugins',_0x4df137,_0x26a2ee[0x0],_0x2eba17);}else{_0x3e86ec=_0x2eba17;}}}}var _0x4058e9={'name':_0x685623,'description':_0x17a42d,'path':path[_0x89f6('0x56')](_0x4df137,_0x26a2ee[0x0]),'type':_0x303c75,'sidebar':_0x2f1ab8,'icon':_0x334ed3,'adminUrl':_0x4d1099,'agentUrl':_0x3e86ec,'scriptName':_0x2e1f50,'scriptPath':_0x93070f,'version':_0x4e634f};removeReferences(_0x34979e,null);return db[_0x89f6('0x39')]['create'](_0x4058e9)[_0x89f6('0x2f')](function(_0x3fdd45){var _0x3aee77={'role':_0x59fb27['body']['role'],'userProfileId':_0x59fb27[_0x89f6('0x9c')][_0x89f6('0x9d')]};if(!_0x3aee77)throw new Error(_0x89f6('0x9e'));if(_0x3aee77[_0x89f6('0x9f')]===_0x89f6('0xa0')){var _0xd4fb5f=_0x3fdd45[_0x89f6('0xa1')]({'plain':!![]});return db['UserProfileSection'][_0x89f6('0x54')]({'where':{'name':_0x89f6('0x30'),'userProfileId':_0x3aee77[_0x89f6('0x9d')]},'raw':!![]})[_0x89f6('0x2f')](function(_0x43b249){if(_0x43b249&&_0x43b249[_0x89f6('0xa2')]===0x0){return db[_0x89f6('0x31')]['create']({'name':_0xd4fb5f[_0x89f6('0x36')],'resourceId':_0xd4fb5f['id'],'type':_0x43b249['name'],'sectionId':_0x43b249['id']},{})[_0x89f6('0x2f')](function(){return _0x3fdd45;});}else{return _0x3fdd45;}})[_0x89f6('0x50')](function(_0x5bb646){logger['error'](_0x89f6('0xa3'),_0x5bb646);throw _0x5bb646;});}return _0x3fdd45;})[_0x89f6('0x2f')](respondWithResult(_0x3d0137,null))[_0x89f6('0x50')](handleError(_0x3d0137,null));}});}catch(_0x1ca972){_0x3d0137[_0x89f6('0x33')](0x1f4)['send'](_0x1ca972);}};function removeReferences(_0x324052,_0x715454){try{if(_0x324052){fs[_0x89f6('0x6f')](_0x324052);logger[_0x89f6('0x70')](_0x89f6('0xa4'));}if(_0x715454){rimraf(_0x715454,function(){});logger[_0x89f6('0x70')](_0x89f6('0xa5'));}}catch(_0x4a2abe){logger['error'](_0x4a2abe);}}exports[_0x89f6('0x2e')]=function(_0x2fb184,_0x372bd3,_0x31e41f){return db[_0x89f6('0x39')][_0x89f6('0x54')]({'where':{'id':_0x2fb184['params']['id']}})[_0x89f6('0x2f')](handleEntityNotFound(_0x372bd3,null))[_0x89f6('0x2f')](saveUpdates(_0x2fb184[_0x89f6('0x9c')],null))[_0x89f6('0x2f')](respondWithResult(_0x372bd3,null))['catch'](handleError(_0x372bd3,null));};exports[_0x89f6('0xa6')]=function(_0x1538c5,_0x3d0fea,_0xf96beb){return db[_0x89f6('0x39')][_0x89f6('0x54')]({'where':{'id':_0x1538c5[_0x89f6('0x52')]['id']}})[_0x89f6('0x2f')](function(_0x2f5548){if(_0x2f5548){return _0x2f5548[_0x89f6('0x32')]();}})[_0x89f6('0x2f')](function(_0x1af159){rimraf(path[_0x89f6('0x56')](config['root'],_0x89f6('0x66'),path['dirname'](_0x1af159['path'])),function(){});return _0x1af159;})[_0x89f6('0x2f')](handleEntityNotFound(_0x3d0fea,null))[_0x89f6('0x2f')](respondWithStatusCode(_0x3d0fea,null))[_0x89f6('0x50')](handleError(_0x3d0fea,null));};exports[_0x89f6('0xa7')]=function(_0xbe8e02,_0x165e8a,_0xfd56ad){return BPromise[_0x89f6('0xa8')]()[_0x89f6('0x2f')](function(){if(!_0xbe8e02[_0x89f6('0x3f')][_0x89f6('0x8')]){throw new Error(_0x89f6('0xa9'));}if(!_0xbe8e02[_0x89f6('0x3f')][_0x89f6('0xaa')]){throw new Error(_0x89f6('0xab'));}var _0x2fe80a=_0xbe8e02['query'][_0x89f6('0xac')]?_0xbe8e02[_0x89f6('0x3f')][_0x89f6('0xac')]+':'+_0xbe8e02[_0x89f6('0x3f')][_0x89f6('0xaa')]:'http://localhost:'+_0xbe8e02[_0x89f6('0x3f')][_0x89f6('0xaa')];var _0xfb525=_0xbe8e02[_0x89f6('0x3f')][_0x89f6('0x26')]?_0xbe8e02[_0x89f6('0x3f')]['json']:!![];var _0x559bea=_0xbe8e02['query'][_0x89f6('0xad')]?_0xbe8e02['query']['encoding']:null;var _0x321214={'method':_0xbe8e02['method'],'uri':util[_0x89f6('0x57')](_0x89f6('0xae'),_0x2fe80a,_0xbe8e02[_0x89f6('0x3f')][_0x89f6('0x8')]),'json':_0xfb525,'resolveWithFullResponse':!![],'encoding':_0x559bea,'qs':_0xbe8e02[_0x89f6('0x3f')]};if(_0xbe8e02['headers']){_0x321214[_0x89f6('0xaf')]=_0xbe8e02[_0x89f6('0xaf')];if(_0x321214[_0x89f6('0xaf')][_0x89f6('0xb0')]){delete _0x321214['headers'][_0x89f6('0xb0')];}}if(_0x321214[_0x89f6('0xaf')]['content-type']){delete _0x321214['headers'][_0x89f6('0xb1')];}return rp(_0x321214);})[_0x89f6('0x2f')](function(_0x1d3ae2){if(_0x1d3ae2){_0x165e8a[_0x89f6('0x2a')](_0x1d3ae2[_0x89f6('0xaf')]);logger[_0x89f6('0x70')](_0x1d3ae2['body']);if(_['endsWith'](_0xbe8e02[_0x89f6('0x3f')][_0x89f6('0x8')],_0x89f6('0x55'))&&_0x1d3ae2[_0x89f6('0xb2')]==0x1f4){return _0x165e8a[_0x89f6('0x25')](_0x1d3ae2[_0x89f6('0xb2')]);}else{return _0x165e8a[_0x89f6('0x33')](_0x1d3ae2[_0x89f6('0xb2')])[_0x89f6('0x37')](_0x1d3ae2[_0x89f6('0x9c')]);}}else{return _0x165e8a[_0x89f6('0x25')](0xc8);}})['catch'](handleError(_0x165e8a,null));};exports[_0x89f6('0xb3')]=function(_0x182e56,_0x1ed4c8,_0x2befc3){return BPromise[_0x89f6('0xa8')]()[_0x89f6('0x2f')](function(){if(!_0x182e56[_0x89f6('0x3f')][_0x89f6('0x8')]){throw new Error(_0x89f6('0xa9'));}if(!_0x182e56[_0x89f6('0x3f')][_0x89f6('0xaa')]){throw new Error(_0x89f6('0xab'));}var _0x338eb1=_0x182e56[_0x89f6('0x3f')][_0x89f6('0xac')]?_0x182e56['query'][_0x89f6('0xac')]+':'+_0x182e56[_0x89f6('0x3f')]['port']:_0x89f6('0xb4')+_0x182e56['query'][_0x89f6('0xaa')];var _0x17d61b=_0x182e56[_0x89f6('0x3f')][_0x89f6('0x26')]?_0x182e56[_0x89f6('0x3f')]['json']:!![];var _0x4b0967=_0x182e56['query']['encoding']?_0x182e56['query'][_0x89f6('0xad')]:null;var _0x2c26d6={'method':_0x182e56[_0x89f6('0xb5')],'uri':util['format']('%s%s',_0x338eb1,_0x182e56[_0x89f6('0x3f')][_0x89f6('0x8')]),'json':_0x17d61b,'resolveWithFullResponse':!![],'encoding':_0x4b0967,'body':_0x182e56[_0x89f6('0x9c')]};if(_0x182e56['headers']){_0x2c26d6[_0x89f6('0xaf')]=_0x182e56[_0x89f6('0xaf')];if(_0x2c26d6['headers']['content-length']){delete _0x2c26d6[_0x89f6('0xaf')][_0x89f6('0xb0')];}}if(_0x2c26d6['headers'][_0x89f6('0xb1')]){delete _0x2c26d6[_0x89f6('0xaf')][_0x89f6('0xb1')];}return rp(_0x2c26d6);})[_0x89f6('0x2f')](function(_0x13d358){if(_0x13d358){_0x1ed4c8[_0x89f6('0x2a')](_0x13d358['headers']);logger[_0x89f6('0x70')](_0x13d358[_0x89f6('0x9c')]);return _0x1ed4c8[_0x89f6('0x33')](_0x13d358['statusCode'])[_0x89f6('0x37')](_0x13d358[_0x89f6('0x9c')]);}else{return _0x1ed4c8[_0x89f6('0x25')](0xc8);}})[_0x89f6('0x50')](handleError(_0x1ed4c8,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index fc12625..d228116 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 _0xeb3b=['events','../../mysqldb','Plugin','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x33187f,_0x477656){var _0xd3c0d=function(_0x185186){while(--_0x185186){_0x33187f['push'](_0x33187f['shift']());}};_0xd3c0d(++_0x477656);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0xeb3b[_0x173452];return _0xee3fd0;};'use strict';var EventEmitter=require(_0xbeb3('0x0'));var Plugin=require(_0xbeb3('0x1'))['db'][_0xbeb3('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xbeb3('0x3')](0x0);var events={'afterCreate':_0xbeb3('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4734b5){return function(_0x5b0e3b,_0x2e8ce3,_0x4852ca){PluginEvents[_0xbeb3('0x5')](_0x4734b5+':'+_0x5b0e3b['id'],_0x5b0e3b);PluginEvents[_0xbeb3('0x5')](_0x4734b5,_0x5b0e3b);_0x4852ca(null);};}for(var e in events){if(events[_0xbeb3('0x6')](e)){var event=events[e];Plugin[_0xbeb3('0x7')](e,emitEvent(event));}}module[_0xbeb3('0x8')]=PluginEvents; \ No newline at end of file +var _0x7b84=['events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7b84,0x17c));var _0x47b8=function(_0x42d6f3,_0x1f94c3){_0x42d6f3=_0x42d6f3-0x0;var _0x583825=_0x7b84[_0x42d6f3];return _0x583825;};'use strict';var EventEmitter=require(_0x47b8('0x0'));var Plugin=require(_0x47b8('0x1'))['db'][_0x47b8('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x47b8('0x3')](0x0);var events={'afterCreate':_0x47b8('0x4'),'afterUpdate':_0x47b8('0x5'),'afterDestroy':_0x47b8('0x6')};function emitEvent(_0x5c7cda){return function(_0x445a5f,_0x1fa41a,_0x2279ea){PluginEvents[_0x47b8('0x7')](_0x5c7cda+':'+_0x445a5f['id'],_0x445a5f);PluginEvents[_0x47b8('0x7')](_0x5c7cda,_0x445a5f);_0x2279ea(null);};}for(var e in events){if(events[_0x47b8('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x47b8('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index bdfbc09..6e96486 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 _0x207c=['api','moment','bluebird','request-promise','path','../../config/environment','define','Plugin','util','../../config/logger'];(function(_0xea9e1c,_0x577088){var _0x3bdb61=function(_0x35e3c1){while(--_0x35e3c1){_0xea9e1c['push'](_0xea9e1c['shift']());}};_0x3bdb61(++_0x577088);}(_0x207c,0x1e8));var _0xc207=function(_0x1d5a18,_0x585dc8){_0x1d5a18=_0x1d5a18-0x0;var _0x411450=_0x207c[_0x1d5a18];return _0x411450;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var logger=require(_0xc207('0x1'))(_0xc207('0x2'));var moment=require(_0xc207('0x3'));var BPromise=require(_0xc207('0x4'));var rp=require(_0xc207('0x5'));var fs=require('fs');var path=require(_0xc207('0x6'));var rimraf=require('rimraf');var config=require(_0xc207('0x7'));var attributes=require('./plugin.attributes');module['exports']=function(_0x55023e,_0xc88789){return _0x55023e[_0xc207('0x8')](_0xc207('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x1afba4,_0x5d98af){var _0x327017=function(_0x571402){while(--_0x571402){_0x1afba4['push'](_0x1afba4['shift']());}};_0x327017(++_0x5d98af);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x345947,_0xc4314c){_0x345947=_0x345947-0x0;var _0x2a557f=_0x9c5a[_0x345947];return _0x2a557f;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./plugin.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 6809486..91e95b3 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 _0x4ca1=['rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','register','request','then','request\x20sent','debug','stringify','code','error','Plugin,\x20%s,\x20%s','message','result','catch','create','body','options','CreatePlugin','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x4ca1,0xa7));var _0x14ca=function(_0x4a7fd1,_0x4bdde1){_0x4a7fd1=_0x4a7fd1-0x0;var _0x12ef10=_0x4ca1[_0x4a7fd1];return _0x12ef10;};'use strict';var _=require(_0x14ca('0x0'));var util=require('util');var moment=require(_0x14ca('0x1'));var BPromise=require('bluebird');var rs=require(_0x14ca('0x2'));var fs=require('fs');var Redis=require(_0x14ca('0x3'));var db=require(_0x14ca('0x4'))['db'];var utils=require(_0x14ca('0x5'));var logger=require(_0x14ca('0x6'))(_0x14ca('0x7'));var config=require(_0x14ca('0x8'));var jayson=require(_0x14ca('0x9'));var client=jayson['client'][_0x14ca('0xa')]({'port':0x232a});config[_0x14ca('0xb')]=_['defaults'](config[_0x14ca('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x14ca('0xc'))(new Redis(config[_0x14ca('0xb')]));require('./plugin.socket')[_0x14ca('0xd')](socket);function respondWithRpcPromise(_0x3bdef5,_0x1df9c0,_0x1e4956){return new BPromise(function(_0x4d9767,_0x420e20){return client[_0x14ca('0xe')](_0x3bdef5,_0x1e4956)[_0x14ca('0xf')](function(_0x541459){logger['info']('Plugin,\x20%s,\x20%s',_0x1df9c0,_0x14ca('0x10'));logger[_0x14ca('0x11')]('Plugin,\x20%s,\x20%s,\x20%s',_0x1df9c0,'request\x20sent',JSON[_0x14ca('0x12')](_0x541459));if(_0x541459['error']){if(_0x541459['error'][_0x14ca('0x13')]===0x1f4){logger[_0x14ca('0x14')](_0x14ca('0x15'),_0x1df9c0,_0x541459[_0x14ca('0x14')][_0x14ca('0x16')]);return _0x420e20(_0x541459[_0x14ca('0x14')]['message']);}logger['error'](_0x14ca('0x15'),_0x1df9c0,_0x541459[_0x14ca('0x14')]['message']);return _0x4d9767(_0x541459[_0x14ca('0x14')][_0x14ca('0x16')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x1df9c0,_0x14ca('0x10'));_0x4d9767(_0x541459[_0x14ca('0x17')][_0x14ca('0x16')]);}})[_0x14ca('0x18')](function(_0x29a74b){logger[_0x14ca('0x14')]('Plugin,\x20%s,\x20%s',_0x1df9c0,_0x29a74b);_0x420e20(_0x29a74b);});});}exports['CreatePlugin']=function(_0x4934a0){var _0x41acc1=this;return new Promise(function(_0x1bd968,_0x5df536){return db['Plugin'][_0x14ca('0x19')](_0x4934a0[_0x14ca('0x1a')],{'raw':_0x4934a0[_0x14ca('0x1b')]?_0x4934a0[_0x14ca('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x14ca('0xf')](function(_0x5510f7){logger['info'](_0x14ca('0x1c'),_0x4934a0);logger[_0x14ca('0x11')](_0x14ca('0x1c'),_0x4934a0,JSON[_0x14ca('0x12')](_0x5510f7));_0x1bd968(_0x5510f7);})[_0x14ca('0x18')](function(_0x43c4c8){logger[_0x14ca('0x14')](_0x14ca('0x1c'),_0x43c4c8[_0x14ca('0x16')],_0x4934a0);_0x5df536(_0x41acc1[_0x14ca('0x14')](0x1f4,_0x43c4c8[_0x14ca('0x16')]));});});}; \ No newline at end of file +var _0x0914=['rpc','../../config/environment','client','http','redis','socket.io-emitter','./plugin.socket','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','Plugin,\x20%s,\x20%s','message','catch','Plugin','create','options','raw','CreatePlugin','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x0914,0x1e8));var _0x4091=function(_0x429735,_0x1dd8bc){_0x429735=_0x429735-0x0;var _0x4fe269=_0x0914[_0x429735];return _0x4fe269;};'use strict';var _=require(_0x4091('0x0'));var util=require(_0x4091('0x1'));var moment=require(_0x4091('0x2'));var BPromise=require(_0x4091('0x3'));var rs=require(_0x4091('0x4'));var fs=require('fs');var Redis=require(_0x4091('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4091('0x6'));var logger=require(_0x4091('0x7'))(_0x4091('0x8'));var config=require(_0x4091('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4091('0xa')][_0x4091('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4091('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4091('0xd'))(new Redis(config[_0x4091('0xc')]));require(_0x4091('0xe'))['register'](socket);function respondWithRpcPromise(_0x2e563d,_0x2dd525,_0x3894af){return new BPromise(function(_0x3ea822,_0x193fb3){return client['request'](_0x2e563d,_0x3894af)[_0x4091('0xf')](function(_0x23a0a3){logger[_0x4091('0x10')]('Plugin,\x20%s,\x20%s',_0x2dd525,_0x4091('0x11'));logger[_0x4091('0x12')](_0x4091('0x13'),_0x2dd525,_0x4091('0x11'),JSON['stringify'](_0x23a0a3));if(_0x23a0a3[_0x4091('0x14')]){if(_0x23a0a3[_0x4091('0x14')][_0x4091('0x15')]===0x1f4){logger[_0x4091('0x14')](_0x4091('0x16'),_0x2dd525,_0x23a0a3[_0x4091('0x14')][_0x4091('0x17')]);return _0x193fb3(_0x23a0a3[_0x4091('0x14')][_0x4091('0x17')]);}logger[_0x4091('0x14')](_0x4091('0x16'),_0x2dd525,_0x23a0a3['error'][_0x4091('0x17')]);return _0x3ea822(_0x23a0a3[_0x4091('0x14')]['message']);}else{logger[_0x4091('0x10')](_0x4091('0x16'),_0x2dd525,_0x4091('0x11'));_0x3ea822(_0x23a0a3['result'][_0x4091('0x17')]);}})[_0x4091('0x18')](function(_0x392a68){logger[_0x4091('0x14')](_0x4091('0x16'),_0x2dd525,_0x392a68);_0x193fb3(_0x392a68);});});}exports['CreatePlugin']=function(_0x1a1ad6){var _0x2c4220=this;return new Promise(function(_0x5e319,_0x5bc931){return db[_0x4091('0x19')][_0x4091('0x1a')](_0x1a1ad6['body'],{'raw':_0x1a1ad6[_0x4091('0x1b')]?_0x1a1ad6['options'][_0x4091('0x1c')]===undefined?!![]:![]:!![]})[_0x4091('0xf')](function(_0x1b25f6){logger['info'](_0x4091('0x1d'),_0x1a1ad6);logger[_0x4091('0x12')](_0x4091('0x1d'),_0x1a1ad6,JSON[_0x4091('0x1e')](_0x1b25f6));_0x5e319(_0x1b25f6);})[_0x4091('0x18')](function(_0x4ea622){logger['error'](_0x4091('0x1d'),_0x4ea622[_0x4091('0x17')],_0x1a1ad6);_0x5bc931(_0x2c4220[_0x4091('0x14')](0x1f4,_0x4ea622['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 90d8e4c..b602988 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 _0x0b95=['update','emit','length','save','remove'];(function(_0x2b93f5,_0x235dad){var _0x5859e1=function(_0x320f25){while(--_0x320f25){_0x2b93f5['push'](_0x2b93f5['shift']());}};_0x5859e1(++_0x235dad);}(_0x0b95,0x198));var _0x50b9=function(_0x50ae81,_0x31a9ea){_0x50ae81=_0x50ae81-0x0;var _0x1b58b7=_0x0b95[_0x50ae81];return _0x1b58b7;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x50b9('0x0'),_0x50b9('0x1'),_0x50b9('0x2')];function createListener(_0x366e6e,_0x203952){return function(_0xd05b11){_0x203952[_0x50b9('0x3')](_0x366e6e,_0xd05b11);};}function removeListener(_0xc6e273,_0x52c068){return function(){PluginEvents['removeListener'](_0xc6e273,_0x52c068);};}exports['register']=function(_0x284b34){for(var _0x19f3af=0x0,_0x892061=events[_0x50b9('0x4')];_0x19f3af<_0x892061;_0x19f3af++){var _0x4ffdd8=events[_0x19f3af];var _0x2b5fbb=createListener('plugin:'+_0x4ffdd8,_0x284b34);PluginEvents['on'](_0x4ffdd8,_0x2b5fbb);}}; \ No newline at end of file +var _0x76d2=['./plugin.events','save','remove','emit','removeListener','register','length','plugin:'];(function(_0x10ce8e,_0x4aca0e){var _0x9468c2=function(_0x2062bf){while(--_0x2062bf){_0x10ce8e['push'](_0x10ce8e['shift']());}};_0x9468c2(++_0x4aca0e);}(_0x76d2,0xf8));var _0x276d=function(_0x123be2,_0x547a9e){_0x123be2=_0x123be2-0x0;var _0x47fd4c=_0x76d2[_0x123be2];return _0x47fd4c;};'use strict';var PluginEvents=require(_0x276d('0x0'));var events=[_0x276d('0x1'),_0x276d('0x2'),'update'];function createListener(_0x1d0b17,_0x125834){return function(_0x2d4d90){_0x125834[_0x276d('0x3')](_0x1d0b17,_0x2d4d90);};}function removeListener(_0x57422a,_0x5f21ff){return function(){PluginEvents[_0x276d('0x4')](_0x57422a,_0x5f21ff);};}exports[_0x276d('0x5')]=function(_0x27729d){for(var _0x1904bf=0x0,_0x138f9f=events[_0x276d('0x6')];_0x1904bf<_0x138f9f;_0x1904bf++){var _0x357d9a=events[_0x1904bf];var _0x233a6c=createListener(_0x276d('0x7')+_0x357d9a,_0x27729d);PluginEvents['on'](_0x357d9a,_0x233a6c);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index f88f6a1..e7f6e02 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 _0x2900=['post','create','update','delete','exports','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','/:id','show'];(function(_0x4f72d4,_0x416985){var _0xe6d78b=function(_0x9e2161){while(--_0x9e2161){_0x4f72d4['push'](_0x4f72d4['shift']());}};_0xe6d78b(++_0x416985);}(_0x2900,0xfc));var _0x0290=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0x2900[_0x37a9d7];return _0x1343d3;};'use strict';var express=require(_0x0290('0x0'));var router=express[_0x0290('0x1')]();var auth=require(_0x0290('0x2'));var controller=require(_0x0290('0x3'));router[_0x0290('0x4')]('/',auth[_0x0290('0x5')](),controller['index']);router[_0x0290('0x4')](_0x0290('0x6'),auth[_0x0290('0x5')](),controller[_0x0290('0x7')]);router[_0x0290('0x8')]('/',auth['isAuthenticated'](),controller[_0x0290('0x9')]);router['put'](_0x0290('0x6'),auth[_0x0290('0x5')](),controller[_0x0290('0xa')]);router[_0x0290('0xb')](_0x0290('0x6'),auth[_0x0290('0x5')](),controller['destroy']);module[_0x0290('0xc')]=router; \ No newline at end of file +var _0x5543=['create','update','exports','express','Router','../../components/auth/service','get','/:id','isAuthenticated','show','post'];(function(_0x106b13,_0x208489){var _0x5a7145=function(_0x8973bc){while(--_0x8973bc){_0x106b13['push'](_0x106b13['shift']());}};_0x5a7145(++_0x208489);}(_0x5543,0x184));var _0x3554=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0x5543[_0x207d2f];return _0x3c3498;};'use strict';var express=require(_0x3554('0x0'));var router=express[_0x3554('0x1')]();var auth=require(_0x3554('0x2'));var controller=require('./pm2.controller');router[_0x3554('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3554('0x3')](_0x3554('0x4'),auth[_0x3554('0x5')](),controller[_0x3554('0x6')]);router[_0x3554('0x7')]('/',auth[_0x3554('0x5')](),controller[_0x3554('0x8')]);router['put'](_0x3554('0x4'),auth[_0x3554('0x5')](),controller[_0x3554('0x9')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3554('0xa')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 7c83667..ac64056 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 _0x3aa2=['dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','then','reject','motion2','length','catch','show','describe','params','create','body','join','script','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','Unknown\x20status','destroy'];(function(_0x3400ca,_0x27c04d){var _0x26e8d1=function(_0x2284e9){while(--_0x2284e9){_0x3400ca['push'](_0x3400ca['shift']());}};_0x26e8d1(++_0x27c04d);}(_0x3aa2,0x7a));var _0x23aa=function(_0x1da8f5,_0xc052c4){_0x1da8f5=_0x1da8f5-0x0;var _0x2973a4=_0x3aa2[_0x1da8f5];return _0x2973a4;};'use strict';var _=require(_0x23aa('0x0'));var pm2=require(_0x23aa('0x1'));var logger=require(_0x23aa('0x2'))(_0x23aa('0x3'));var path=require(_0x23aa('0x4'));var exec=require(_0x23aa('0x5'))['exec'];var BPromise=require(_0x23aa('0x6'));function handleEntityNotFound(_0x62dafa,_0x390c81){return function(_0x512878){if(!_0x512878){_0x62dafa[_0x23aa('0x7')](0x194);;}return _0x512878;};}function respondWithResult(_0x349a41,_0x9bf763){_0x9bf763=_0x9bf763||0xc8;return function(_0x362cf7){if(_0x362cf7){return _0x349a41[_0x23aa('0x8')](_0x9bf763)[_0x23aa('0x9')](_0x362cf7);}return null;};}function handleError(_0x4171ab,_0x474e0d){_0x474e0d=_0x474e0d||0x1f4;return function(_0x75690a){logger[_0x23aa('0xa')](_0x75690a['stack']);if(_0x75690a[_0x23aa('0xb')]){delete _0x75690a[_0x23aa('0xb')];}_0x4171ab[_0x23aa('0x8')](_0x474e0d)[_0x23aa('0xc')](_0x75690a);};}function execChildProcess(){return new BPromise(function(_0x425d9d,_0x621227){exec(_0x23aa('0xd'),function(_0x238a47,_0x447ad5,_0x47d01e){logger[_0x23aa('0xe')](_0x447ad5);logger[_0x23aa('0xe')](_0x47d01e);if(_0x238a47){logger['error'](_0x238a47);return _0x621227(_0x238a47);}return _0x425d9d(_0x447ad5);});});}exports[_0x23aa('0xf')]=function(_0xd583d7,_0x8118f){return pm2[_0x23aa('0x10')]()[_0x23aa('0x11')](function(_0x4aaf43){if(_0x4aaf43){var _0x32f5fe=_[_0x23aa('0x12')](_0x4aaf43,function(_0x374d04){return _0x374d04['name']==='express'||_0x374d04[_0x23aa('0xb')]===_0x23aa('0x13');});return{'rows':_0x32f5fe,'count':_0x32f5fe[_0x23aa('0x14')]};}return null;})[_0x23aa('0x11')](respondWithResult(_0x8118f,null))[_0x23aa('0x15')](handleError(_0x8118f,null));};exports[_0x23aa('0x16')]=function(_0x25f4b4,_0x2531a2){return pm2[_0x23aa('0x17')](_0x25f4b4[_0x23aa('0x18')]['id'])[_0x23aa('0x11')](respondWithResult(_0x2531a2,null))[_0x23aa('0x11')](handleEntityNotFound(_0x2531a2,null))[_0x23aa('0x15')](handleError(_0x2531a2,null));};exports[_0x23aa('0x19')]=function(_0x3cca40,_0x3183f2){if(_0x3cca40[_0x23aa('0x1a')][_0x23aa('0xb')]&&_0x3cca40[_0x23aa('0x1a')]['script']){var _0x31f26f=path[_0x23aa('0x1b')](__dirname,'../../files/plugins',_0x3cca40[_0x23aa('0x1a')][_0x23aa('0x1c')]);var _0x26d1c4=process[_0x23aa('0x1d')]();process[_0x23aa('0x1e')](path[_0x23aa('0x1f')](_0x31f26f));return execChildProcess()[_0x23aa('0x11')](function(_0x570a13){process['chdir'](_0x26d1c4);return pm2[_0x23aa('0x20')]({'name':_0x3cca40[_0x23aa('0x1a')][_0x23aa('0xb')],'script':_0x31f26f});})[_0x23aa('0x11')](function(_0xda8bf8){pm2['dump']();return _0xda8bf8[0x0];})[_0x23aa('0x11')](respondWithResult(_0x3183f2,0xc9))['catch'](handleError(_0x3183f2,null));}else{return _0x3183f2['status'](0x1f4)[_0x23aa('0xc')]({'message':_0x23aa('0x21')});}};exports[_0x23aa('0x22')]=function(_0x6c7ff6,_0x4f79c0){if(_0x6c7ff6[_0x23aa('0x1a')]['id']){delete _0x6c7ff6[_0x23aa('0x1a')]['id'];}var _0x507e60={'online':_0x23aa('0x23'),'stopped':'stop'};if(_0x507e60['hasOwnProperty'](_0x6c7ff6[_0x23aa('0x1a')][_0x23aa('0x8')])){return pm2[_0x507e60[_0x6c7ff6['body'][_0x23aa('0x8')]]](_0x6c7ff6[_0x23aa('0x18')]['id'])['then'](respondWithResult(_0x4f79c0,0xc8))[_0x23aa('0x15')](handleError(_0x4f79c0,null));}else{return _0x4f79c0[_0x23aa('0x8')](0x1f4)[_0x23aa('0xc')]({'message':_0x23aa('0x24')});}};exports[_0x23aa('0x25')]=function(_0x5ad2bc,_0x5b254c){if(_0x5ad2bc[_0x23aa('0x1a')]['id']){delete _0x5ad2bc[_0x23aa('0x1a')]['id'];}if(_0x5ad2bc[_0x23aa('0x18')]['id']){return pm2['delete'](_0x5ad2bc[_0x23aa('0x18')]['id'])[_0x23aa('0x11')](function(_0x581042){pm2[_0x23aa('0x26')]();return _0x581042[0x0];})[_0x23aa('0x11')](respondWithResult(_0x5b254c,null))[_0x23aa('0x15')](handleError(_0x5b254c,null));}else{return _0x5b254c[_0x23aa('0x8')](0x1f4)[_0x23aa('0xc')]({'message':_0x23aa('0x27')});}}; \ No newline at end of file +var _0xd222=['hasOwnProperty','Unknown\x20status','delete','lodash','../../config/pm2','path','exec','bluebird','sendStatus','status','json','stack','name','send','info','error','index','then','reject','express','motion2','length','catch','params','create','body','script','join','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','restart','stop'];(function(_0x259c7e,_0x96223a){var _0x15d791=function(_0x5f4198){while(--_0x5f4198){_0x259c7e['push'](_0x259c7e['shift']());}};_0x15d791(++_0x96223a);}(_0xd222,0xd5));var _0x2d22=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xd222[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0x2d22('0x0'));var pm2=require(_0x2d22('0x1'));var logger=require('../../config/logger')('api');var path=require(_0x2d22('0x2'));var exec=require('child_process')[_0x2d22('0x3')];var BPromise=require(_0x2d22('0x4'));function handleEntityNotFound(_0xada43,_0x4c7b65){return function(_0x2b90b3){if(!_0x2b90b3){_0xada43[_0x2d22('0x5')](0x194);;}return _0x2b90b3;};}function respondWithResult(_0x5157ce,_0x515f2e){_0x515f2e=_0x515f2e||0xc8;return function(_0x1bdc29){if(_0x1bdc29){return _0x5157ce[_0x2d22('0x6')](_0x515f2e)[_0x2d22('0x7')](_0x1bdc29);}return null;};}function handleError(_0x1f20a6,_0x50b2da){_0x50b2da=_0x50b2da||0x1f4;return function(_0x33b65f){logger['error'](_0x33b65f[_0x2d22('0x8')]);if(_0x33b65f[_0x2d22('0x9')]){delete _0x33b65f['name'];}_0x1f20a6[_0x2d22('0x6')](_0x50b2da)[_0x2d22('0xa')](_0x33b65f);};}function execChildProcess(){return new BPromise(function(_0x545a12,_0xd2a699){exec('npm\x20install',function(_0x12a45d,_0x153ab7,_0x195b5d){logger[_0x2d22('0xb')](_0x153ab7);logger[_0x2d22('0xb')](_0x195b5d);if(_0x12a45d){logger[_0x2d22('0xc')](_0x12a45d);return _0xd2a699(_0x12a45d);}return _0x545a12(_0x153ab7);});});}exports[_0x2d22('0xd')]=function(_0x2e1bd5,_0x256d2f){return pm2['list']()[_0x2d22('0xe')](function(_0x5d4031){if(_0x5d4031){var _0x138a67=_[_0x2d22('0xf')](_0x5d4031,function(_0x5ea455){return _0x5ea455[_0x2d22('0x9')]===_0x2d22('0x10')||_0x5ea455[_0x2d22('0x9')]===_0x2d22('0x11');});return{'rows':_0x138a67,'count':_0x138a67[_0x2d22('0x12')]};}return null;})[_0x2d22('0xe')](respondWithResult(_0x256d2f,null))[_0x2d22('0x13')](handleError(_0x256d2f,null));};exports['show']=function(_0x5f08b3,_0x5f41b6){return pm2['describe'](_0x5f08b3[_0x2d22('0x14')]['id'])[_0x2d22('0xe')](respondWithResult(_0x5f41b6,null))[_0x2d22('0xe')](handleEntityNotFound(_0x5f41b6,null))[_0x2d22('0x13')](handleError(_0x5f41b6,null));};exports[_0x2d22('0x15')]=function(_0x55deb9,_0x471096){if(_0x55deb9[_0x2d22('0x16')][_0x2d22('0x9')]&&_0x55deb9[_0x2d22('0x16')][_0x2d22('0x17')]){var _0x265df1=path[_0x2d22('0x18')](__dirname,'../../files/plugins',_0x55deb9[_0x2d22('0x16')]['script']);var _0x5122be=process[_0x2d22('0x19')]();process[_0x2d22('0x1a')](path[_0x2d22('0x1b')](_0x265df1));return execChildProcess()[_0x2d22('0xe')](function(_0x2365a7){process['chdir'](_0x5122be);return pm2[_0x2d22('0x1c')]({'name':_0x55deb9[_0x2d22('0x16')]['name'],'script':_0x265df1});})['then'](function(_0x4b66ac){pm2['dump']();return _0x4b66ac[0x0];})[_0x2d22('0xe')](respondWithResult(_0x471096,0xc9))[_0x2d22('0x13')](handleError(_0x471096,null));}else{return _0x471096['status'](0x1f4)[_0x2d22('0xa')]({'message':_0x2d22('0x1d')});}};exports['update']=function(_0x586ab6,_0x54b98f){if(_0x586ab6[_0x2d22('0x16')]['id']){delete _0x586ab6[_0x2d22('0x16')]['id'];}var _0x532c0f={'online':_0x2d22('0x1e'),'stopped':_0x2d22('0x1f')};if(_0x532c0f[_0x2d22('0x20')](_0x586ab6[_0x2d22('0x16')][_0x2d22('0x6')])){return pm2[_0x532c0f[_0x586ab6[_0x2d22('0x16')][_0x2d22('0x6')]]](_0x586ab6[_0x2d22('0x14')]['id'])[_0x2d22('0xe')](respondWithResult(_0x54b98f,0xc8))[_0x2d22('0x13')](handleError(_0x54b98f,null));}else{return _0x54b98f[_0x2d22('0x6')](0x1f4)[_0x2d22('0xa')]({'message':_0x2d22('0x21')});}};exports['destroy']=function(_0x3910bc,_0x53d5e){if(_0x3910bc[_0x2d22('0x16')]['id']){delete _0x3910bc[_0x2d22('0x16')]['id'];}if(_0x3910bc['params']['id']){return pm2[_0x2d22('0x22')](_0x3910bc[_0x2d22('0x14')]['id'])[_0x2d22('0xe')](function(_0x3464cb){pm2['dump']();return _0x3464cb[0x0];})[_0x2d22('0xe')](respondWithResult(_0x53d5e,null))['catch'](handleError(_0x53d5e,null));}else{return _0x53d5e[_0x2d22('0x6')](0x1f4)[_0x2d22('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index ad0f27b..bb48925 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 _0x3543=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x3e762f,_0x52155f){var _0x5277a3=function(_0x26d7f4){while(--_0x26d7f4){_0x3e762f['push'](_0x3e762f['shift']());}};_0x5277a3(++_0x52155f);}(_0x3543,0x196));var _0x3354=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3543[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x3354('0x0'));var util=require(_0x3354('0x1'));var path=require(_0x3354('0x2'));var timeout=require(_0x3354('0x3'));var express=require(_0x3354('0x4'));var router=express[_0x3354('0x5')]();var auth=require(_0x3354('0x6'));var interaction=require(_0x3354('0x7'));var config=require(_0x3354('0x8'));module[_0x3354('0x9')]=router; \ No newline at end of file +var _0xabac=['connect-timeout','express','Router','../../components/auth/service','util','path'];(function(_0x3f7f2e,_0x24f969){var _0xbc7678=function(_0x5c595b){while(--_0x5c595b){_0x3f7f2e['push'](_0x3f7f2e['shift']());}};_0xbc7678(++_0x24f969);}(_0xabac,0xf4));var _0xcaba=function(_0x46fca6,_0x545d38){_0x46fca6=_0x46fca6-0x0;var _0x32148f=_0xabac[_0x46fca6];return _0x32148f;};'use strict';var multer=require('multer');var util=require(_0xcaba('0x0'));var path=require(_0xcaba('0x1'));var timeout=require(_0xcaba('0x2'));var express=require(_0xcaba('0x3'));var router=express[_0xcaba('0x4')]();var auth=require(_0xcaba('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index a29599a..92fc586 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 _0xa665=['STRING','DATE','exports','INTEGER'];(function(_0x422a2a,_0x413600){var _0xbc9bb3=function(_0x382441){while(--_0x382441){_0x422a2a['push'](_0x422a2a['shift']());}};_0xbc9bb3(++_0x413600);}(_0xa665,0xb2));var _0x5a66=function(_0x1f5ab3,_0x2d2473){_0x1f5ab3=_0x1f5ab3-0x0;var _0x2bd0d7=_0xa665[_0x1f5ab3];return _0x2bd0d7;};'use strict';var Sequelize=require('sequelize');module[_0x5a66('0x0')]={'state':{'type':Sequelize[_0x5a66('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x5a66('0x2')]},'scheduledat':{'type':Sequelize[_0x5a66('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x5a66('0x3')]},'responsetime':{'type':Sequelize[_0x5a66('0x3')]},'ringtime':{'type':Sequelize[_0x5a66('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5a66('0x2')]},'campaigntype':{'type':Sequelize[_0x5a66('0x2')]},'membername':{'type':Sequelize[_0x5a66('0x2')]}}; \ No newline at end of file +var _0x4a4e=['INTEGER','DATE','STRING','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4a4e,0x13b));var _0xe4a4=function(_0x239b31,_0x44a64d){_0x239b31=_0x239b31-0x0;var _0x41c8be=_0x4a4e[_0x239b31];return _0x41c8be;};'use strict';var Sequelize=require('sequelize');module[_0xe4a4('0x0')]={'state':{'type':Sequelize[_0xe4a4('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe4a4('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe4a4('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xe4a4('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xe4a4('0x3')]},'campaigntype':{'type':Sequelize[_0xe4a4('0x3')]},'membername':{'type':Sequelize[_0xe4a4('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index db95cd6..b22cc07 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 _0xd0e9=['report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview'];(function(_0x29f625,_0x445ba8){var _0x189378=function(_0x215c79){while(--_0x215c79){_0x29f625['push'](_0x29f625['shift']());}};_0x189378(++_0x445ba8);}(_0xd0e9,0x16d));var _0x9d0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0e9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d0e('0x0'));var util=require(_0x9d0e('0x1'));var logger=require(_0x9d0e('0x2'))(_0x9d0e('0x3'));var moment=require(_0x9d0e('0x4'));var BPromise=require(_0x9d0e('0x5'));var rp=require(_0x9d0e('0x6'));var fs=require('fs');var path=require(_0x9d0e('0x7'));var rimraf=require(_0x9d0e('0x8'));var config=require(_0x9d0e('0x9'));var attributes=require(_0x9d0e('0xa'));module['exports']=function(_0x37059e,_0x3cfcd1){return _0x37059e['define'](_0x9d0e('0xb'),attributes,{'tableName':_0x9d0e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e17=['api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x0e17,0x106));var _0x70e1=function(_0x1ff232,_0x1143bd){_0x1ff232=_0x1ff232-0x0;var _0x460544=_0x0e17[_0x1ff232];return _0x460544;};'use strict';var _=require(_0x70e1('0x0'));var util=require(_0x70e1('0x1'));var logger=require('../../config/logger')(_0x70e1('0x2'));var moment=require(_0x70e1('0x3'));var BPromise=require(_0x70e1('0x4'));var rp=require(_0x70e1('0x5'));var fs=require('fs');var path=require(_0x70e1('0x6'));var rimraf=require('rimraf');var config=require(_0x70e1('0x7'));var attributes=require(_0x70e1('0x8'));module[_0x70e1('0x9')]=function(_0x27fa77,_0x21d2ac){return _0x27fa77[_0x70e1('0xa')]('ReportAgentPreview',attributes,{'tableName':_0x70e1('0xb'),'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 5ef1862..ff6275e 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 _0x326d=['code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error'];(function(_0x3c118b,_0x4b6937){var _0x587725=function(_0x3ac6cf){while(--_0x3ac6cf){_0x3c118b['push'](_0x3c118b['shift']());}};_0x587725(++_0x4b6937);}(_0x326d,0x107));var _0xd326=function(_0x577026,_0x4a48ef){_0x577026=_0x577026-0x0;var _0x10477a=_0x326d[_0x577026];return _0x10477a;};'use strict';var _=require(_0xd326('0x0'));var util=require(_0xd326('0x1'));var moment=require('moment');var BPromise=require(_0xd326('0x2'));var rs=require(_0xd326('0x3'));var fs=require('fs');var Redis=require(_0xd326('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd326('0x5'));var logger=require(_0xd326('0x6'))(_0xd326('0x7'));var config=require(_0xd326('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd326('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb0e7,_0x3fb5d9,_0x640b63){return new BPromise(function(_0x22b00d,_0x4d4cce){return client['request'](_0x2eb0e7,_0x640b63)[_0xd326('0xa')](function(_0x2b86f7){logger[_0xd326('0xb')](_0xd326('0xc'),_0x3fb5d9,_0xd326('0xd'));logger[_0xd326('0xe')](_0xd326('0xf'),_0x3fb5d9,_0xd326('0xd'),JSON['stringify'](_0x2b86f7));if(_0x2b86f7[_0xd326('0x10')]){if(_0x2b86f7['error'][_0xd326('0x11')]===0x1f4){logger['error'](_0xd326('0xc'),_0x3fb5d9,_0x2b86f7[_0xd326('0x10')]['message']);return _0x4d4cce(_0x2b86f7['error'][_0xd326('0x12')]);}logger[_0xd326('0x10')](_0xd326('0xc'),_0x3fb5d9,_0x2b86f7[_0xd326('0x10')][_0xd326('0x12')]);return _0x22b00d(_0x2b86f7['error'][_0xd326('0x12')]);}else{logger[_0xd326('0xb')](_0xd326('0xc'),_0x3fb5d9,'request\x20sent');_0x22b00d(_0x2b86f7[_0xd326('0x13')]['message']);}})[_0xd326('0x14')](function(_0x9d1129){logger[_0xd326('0x10')](_0xd326('0xc'),_0x3fb5d9,_0x9d1129);_0x4d4cce(_0x9d1129);});});}exports[_0xd326('0x15')]=function(_0x468f3f){var _0x47902e=this;return new Promise(function(_0x57348d,_0x45dd1b){return db[_0xd326('0x16')][_0xd326('0x17')](_0x468f3f[_0xd326('0x18')],{'raw':_0x468f3f[_0xd326('0x19')]?_0x468f3f[_0xd326('0x19')][_0xd326('0x1a')]===undefined?!![]:![]:!![]})[_0xd326('0xa')](function(_0x52e4d1){logger[_0xd326('0xb')](_0xd326('0x15'),_0x468f3f);logger[_0xd326('0xe')]('CreateReportAgentPreview',_0x468f3f,JSON[_0xd326('0x1b')](_0x52e4d1));_0x57348d(_0x52e4d1);})[_0xd326('0x14')](function(_0x2f6bf7){logger['error'](_0xd326('0x15'),_0x2f6bf7['message'],_0x468f3f);_0x45dd1b(_0x47902e[_0xd326('0x10')](0x1f4,_0x2f6bf7[_0xd326('0x12')]));});});}; \ No newline at end of file +var _0xc532=['error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x504707,_0x9bd0c9){var _0x24f124=function(_0x16e27e){while(--_0x16e27e){_0x504707['push'](_0x504707['shift']());}};_0x24f124(++_0x9bd0c9);}(_0xc532,0x1d6));var _0x2c53=function(_0x18ba25,_0x2d1bbc){_0x18ba25=_0x18ba25-0x0;var _0x1fcf69=_0xc532[_0x18ba25];return _0x1fcf69;};'use strict';var _=require('lodash');var util=require(_0x2c53('0x0'));var moment=require('moment');var BPromise=require(_0x2c53('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c53('0x2'));var db=require(_0x2c53('0x3'))['db'];var utils=require(_0x2c53('0x4'));var logger=require(_0x2c53('0x5'))(_0x2c53('0x6'));var config=require(_0x2c53('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2c53('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x109cfc,_0x3eebf8,_0x241a7c){return new BPromise(function(_0x50b38b,_0x10ca0c){return client[_0x2c53('0x9')](_0x109cfc,_0x241a7c)[_0x2c53('0xa')](function(_0x2d0413){logger[_0x2c53('0xb')](_0x2c53('0xc'),_0x3eebf8,_0x2c53('0xd'));logger[_0x2c53('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x3eebf8,_0x2c53('0xd'),JSON[_0x2c53('0xf')](_0x2d0413));if(_0x2d0413[_0x2c53('0x10')]){if(_0x2d0413['error'][_0x2c53('0x11')]===0x1f4){logger[_0x2c53('0x10')](_0x2c53('0xc'),_0x3eebf8,_0x2d0413['error'][_0x2c53('0x12')]);return _0x10ca0c(_0x2d0413['error'][_0x2c53('0x12')]);}logger['error'](_0x2c53('0xc'),_0x3eebf8,_0x2d0413[_0x2c53('0x10')][_0x2c53('0x12')]);return _0x50b38b(_0x2d0413['error'][_0x2c53('0x12')]);}else{logger['info'](_0x2c53('0xc'),_0x3eebf8,_0x2c53('0xd'));_0x50b38b(_0x2d0413[_0x2c53('0x13')][_0x2c53('0x12')]);}})[_0x2c53('0x14')](function(_0x2154d7){logger[_0x2c53('0x10')](_0x2c53('0xc'),_0x3eebf8,_0x2154d7);_0x10ca0c(_0x2154d7);});});}exports[_0x2c53('0x15')]=function(_0x4fd755){var _0x1c47a2=this;return new Promise(function(_0x18e7cb,_0x312477){return db[_0x2c53('0x16')][_0x2c53('0x17')](_0x4fd755[_0x2c53('0x18')],{'raw':_0x4fd755[_0x2c53('0x19')]?_0x4fd755[_0x2c53('0x19')][_0x2c53('0x1a')]===undefined?!![]:![]:!![]})[_0x2c53('0xa')](function(_0x2981d7){logger['info']('CreateReportAgentPreview',_0x4fd755);logger[_0x2c53('0xe')](_0x2c53('0x15'),_0x4fd755,JSON[_0x2c53('0xf')](_0x2981d7));_0x18e7cb(_0x2981d7);})[_0x2c53('0x14')](function(_0x167488){logger[_0x2c53('0x10')]('CreateReportAgentPreview',_0x167488['message'],_0x4fd755);_0x312477(_0x1c47a2[_0x2c53('0x10')](0x1f4,_0x167488[_0x2c53('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index c26e33b..f7bdaa9 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 _0x2c1a=['faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','agentCapacity','telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','queueNotify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0x2c1a,0x12d));var _0xa2c1=function(_0xd42797,_0x108065){_0xd42797=_0xd42797-0x0;var _0x2d27ee=_0x2c1a[_0xd42797];return _0x2d27ee;};'use strict';var multer=require(_0xa2c1('0x0'));var util=require('util');var path=require(_0xa2c1('0x1'));var express=require('express');var router=express[_0xa2c1('0x2')]();var auth=require(_0xa2c1('0x3'));var controller=require(_0xa2c1('0x4'));router[_0xa2c1('0x5')]('/voice/channels',auth['isAuthenticated'](),controller['voiceChannels']);router['get'](_0xa2c1('0x6'),auth['isAuthenticated'](),controller[_0xa2c1('0x7')]);router[_0xa2c1('0x5')](_0xa2c1('0x8'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0xa')]);router[_0xa2c1('0x5')](_0xa2c1('0xb'),auth['isAuthenticated'](),controller[_0xa2c1('0xc')]);router[_0xa2c1('0x5')]('/chat/queues',auth['isAuthenticated'](),controller[_0xa2c1('0xd')]);router[_0xa2c1('0x5')](_0xa2c1('0xe'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0xf')]);router['get'](_0xa2c1('0x10'),auth[_0xa2c1('0x9')](),controller['mailAccounts']);router['get'](_0xa2c1('0x11'),auth['isAuthenticated'](),controller[_0xa2c1('0x12')]);router[_0xa2c1('0x5')]('/sms/queues',auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x13')]);router[_0xa2c1('0x5')](_0xa2c1('0x14'),auth['isAuthenticated'](),controller[_0xa2c1('0x15')]);router[_0xa2c1('0x5')](_0xa2c1('0x16'),auth['isAuthenticated'](),controller[_0xa2c1('0x17')]);router['get'](_0xa2c1('0x18'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x19')]);router[_0xa2c1('0x5')](_0xa2c1('0x1a'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x1b')]);router[_0xa2c1('0x5')](_0xa2c1('0x1c'),auth['isAuthenticated'](),controller[_0xa2c1('0x1d')]);router[_0xa2c1('0x5')](_0xa2c1('0x1e'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x1f')]);router['get'](_0xa2c1('0x20'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x21')]);router['get']('/voice/queues/:id',auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x22')]);router[_0xa2c1('0x5')](_0xa2c1('0x23'),auth['isAuthenticated'](),controller[_0xa2c1('0x24')]);router[_0xa2c1('0x5')](_0xa2c1('0x25'),auth['isAuthenticated'](),controller[_0xa2c1('0x26')]);router['get'](_0xa2c1('0x27'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x28')]);router[_0xa2c1('0x29')]('/agents/:id/capacity',auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x2a')]);router['get']('/telephones',auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x2b')]);router[_0xa2c1('0x5')](_0xa2c1('0x2c'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x2d')]);router[_0xa2c1('0x5')](_0xa2c1('0x2e'),auth[_0xa2c1('0x9')](),controller['campaigns']);router['get'](_0xa2c1('0x2f'),auth[_0xa2c1('0x9')](),controller['faxAccounts']);router[_0xa2c1('0x5')](_0xa2c1('0x30'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x31')]);router[_0xa2c1('0x5')](_0xa2c1('0x32'),auth['isAuthenticated'](),controller[_0xa2c1('0x33')]);router[_0xa2c1('0x5')](_0xa2c1('0x34'),auth['isAuthenticated'](),controller[_0xa2c1('0x35')]);router[_0xa2c1('0x5')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0xa2c1('0x36')]);router[_0xa2c1('0x5')](_0xa2c1('0x37'),auth['isAuthenticated'](),controller[_0xa2c1('0x38')]);router[_0xa2c1('0x5')](_0xa2c1('0x39'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0xa2c1('0x5')](_0xa2c1('0x3a'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x3b')]);router['post'](_0xa2c1('0x3c'),auth[_0xa2c1('0x9')](),controller['queueNotify'](_0xa2c1('0x3d')));router['get'](_0xa2c1('0x3e'),auth['isAuthenticated'](),controller[_0xa2c1('0x3f')]);router[_0xa2c1('0x40')](_0xa2c1('0x41'),auth['isAuthenticated'](),controller[_0xa2c1('0x42')]('chat'));router[_0xa2c1('0x5')](_0xa2c1('0x43'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x44')]);router[_0xa2c1('0x40')](_0xa2c1('0x45'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x42')]('fax'));router[_0xa2c1('0x5')]('/fax/queues/:id',auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x46')]);router[_0xa2c1('0x40')](_0xa2c1('0x47'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x42')]('openchannel'));router['get']('/openchannel/queues/:id',auth[_0xa2c1('0x9')](),controller['showOpenchannelQueues']);router[_0xa2c1('0x40')](_0xa2c1('0x48'),auth['isAuthenticated'](),controller[_0xa2c1('0x42')](_0xa2c1('0x49')));router[_0xa2c1('0x40')]('/whatsapp/queues/:id/notify',auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x42')](_0xa2c1('0x4a')));router[_0xa2c1('0x5')](_0xa2c1('0x4b'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x4c')]);router['get'](_0xa2c1('0x4d'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x4e')]);router[_0xa2c1('0x40')](_0xa2c1('0x4f'),auth[_0xa2c1('0x9')](),controller['agentNotify']);module[_0xa2c1('0x50')]=router; \ No newline at end of file +var _0x9a33=['/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','faxAccounts','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/chat/queues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues'];(function(_0x161174,_0x324acc){var _0x48ed31=function(_0x4eddcf){while(--_0x4eddcf){_0x161174['push'](_0x161174['shift']());}};_0x48ed31(++_0x324acc);}(_0x9a33,0x129));var _0x39a3=function(_0x2c11eb,_0x2a68b1){_0x2c11eb=_0x2c11eb-0x0;var _0x467d26=_0x9a33[_0x2c11eb];return _0x467d26;};'use strict';var multer=require('multer');var util=require(_0x39a3('0x0'));var path=require('path');var express=require(_0x39a3('0x1'));var router=express[_0x39a3('0x2')]();var auth=require(_0x39a3('0x3'));var controller=require(_0x39a3('0x4'));router[_0x39a3('0x5')](_0x39a3('0x6'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x8')]);router[_0x39a3('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x39a3('0x7')](),controller[_0x39a3('0x9')]);router[_0x39a3('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x39a3('0x7')](),controller[_0x39a3('0xa')]);router[_0x39a3('0x5')]('/voice/queues',auth['isAuthenticated'](),controller['voiceQueues']);router[_0x39a3('0x5')](_0x39a3('0xb'),auth[_0x39a3('0x7')](),controller['chatQueues']);router[_0x39a3('0x5')](_0x39a3('0xc'),auth['isAuthenticated'](),controller['mailQueues']);router['get'](_0x39a3('0xd'),auth[_0x39a3('0x7')](),controller[_0x39a3('0xe')]);router[_0x39a3('0x5')](_0x39a3('0xf'),auth[_0x39a3('0x7')](),controller['openchannelQueues']);router[_0x39a3('0x5')](_0x39a3('0x10'),auth[_0x39a3('0x7')](),controller['smsQueues']);router[_0x39a3('0x5')](_0x39a3('0x11'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x12')]);router[_0x39a3('0x5')](_0x39a3('0x13'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x14')]);router[_0x39a3('0x5')](_0x39a3('0x15'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x16')]);router[_0x39a3('0x5')](_0x39a3('0x17'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x18')]);router[_0x39a3('0x5')]('/voice/queues/channels/:uniqueid',auth[_0x39a3('0x7')](),controller[_0x39a3('0x19')]);router[_0x39a3('0x5')](_0x39a3('0x1a'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x1b')]);router[_0x39a3('0x5')](_0x39a3('0x1c'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x1d')]);router[_0x39a3('0x5')](_0x39a3('0x1e'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x1f')]);router[_0x39a3('0x5')](_0x39a3('0x20'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x21')]);router[_0x39a3('0x5')](_0x39a3('0x22'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x23')]);router['get'](_0x39a3('0x24'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x25')]);router[_0x39a3('0x26')](_0x39a3('0x27'),auth['isAuthenticated'](),controller[_0x39a3('0x28')]);router[_0x39a3('0x5')](_0x39a3('0x29'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x2a')]);router['get']('/trunks',auth['isAuthenticated'](),controller[_0x39a3('0x2b')]);router[_0x39a3('0x5')](_0x39a3('0x2c'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x2d')]);router[_0x39a3('0x5')]('/fax/accounts',auth['isAuthenticated'](),controller[_0x39a3('0x2e')]);router[_0x39a3('0x5')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x39a3('0x5')](_0x39a3('0x2f'),auth[_0x39a3('0x7')](),controller['mailQueuesWaitingInteractions']);router['get'](_0x39a3('0x30'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x31')]);router['get'](_0x39a3('0x32'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x33')]);router[_0x39a3('0x5')](_0x39a3('0x34'),auth['isAuthenticated'](),controller[_0x39a3('0x35')]);router[_0x39a3('0x5')](_0x39a3('0x36'),auth[_0x39a3('0x7')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x39a3('0x37'),auth[_0x39a3('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0x39a3('0x38')]('/mail/queues/:id/notify',auth[_0x39a3('0x7')](),controller[_0x39a3('0x39')](_0x39a3('0x3a')));router[_0x39a3('0x5')](_0x39a3('0x3b'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x3c')]);router['post']('/chat/queues/:id/notify',auth[_0x39a3('0x7')](),controller[_0x39a3('0x39')](_0x39a3('0x3d')));router[_0x39a3('0x5')]('/chat/queues/:id',auth[_0x39a3('0x7')](),controller[_0x39a3('0x3e')]);router[_0x39a3('0x38')](_0x39a3('0x3f'),auth['isAuthenticated'](),controller[_0x39a3('0x39')](_0x39a3('0x40')));router[_0x39a3('0x5')](_0x39a3('0x41'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x42')]);router[_0x39a3('0x38')](_0x39a3('0x43'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x39')]('openchannel'));router[_0x39a3('0x5')](_0x39a3('0x44'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x45')]);router[_0x39a3('0x38')](_0x39a3('0x46'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x39')](_0x39a3('0x47')));router[_0x39a3('0x38')](_0x39a3('0x48'),auth['isAuthenticated'](),controller[_0x39a3('0x39')](_0x39a3('0x49')));router['get'](_0x39a3('0x4a'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x4b')]);router[_0x39a3('0x5')]('/whatsapp/queues/:id',auth[_0x39a3('0x7')](),controller[_0x39a3('0x4c')]);router[_0x39a3('0x38')](_0x39a3('0x4d'),auth[_0x39a3('0x7')](),controller[_0x39a3('0x4e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index dfd73b8..78ef246 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 _0xde02=['message','result','catch','status','json','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','MessageId','InteractionId','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','From','agentTransferTimeout','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','code'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0xde02,0xeb));var _0x2de0=function(_0x5a83b8,_0x3bb4eb){_0x5a83b8=_0x5a83b8-0x0;var _0x36ec8a=_0xde02[_0x5a83b8];return _0x36ec8a;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x2de0('0x0'));var util=require(_0x2de0('0x1'));var db=require(_0x2de0('0x2'))['db'];var logger=require(_0x2de0('0x3'))(_0x2de0('0x4'));var jayson=require(_0x2de0('0x5'));var amiClient=jayson[_0x2de0('0x6')][_0x2de0('0x7')]({'port':0x232a});var mailClient=jayson[_0x2de0('0x6')][_0x2de0('0x7')]({'port':0x232b});var routingClient=jayson[_0x2de0('0x6')][_0x2de0('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x2c0bab,_0x1946d7,_0x262e51){return new BPromise(function(_0xf0784e,_0xa13964){var _0x4baeaf=_0x262e51?_0x262e51:amiClient;return _0x4baeaf[_0x2de0('0x8')](_0x2c0bab,_0x1946d7)['then'](function(_0x52f9e2){if(_0x52f9e2[_0x2de0('0x9')]){if(_0x52f9e2[_0x2de0('0x9')][_0x2de0('0xa')]===0x1f4){return _0xa13964(_0x52f9e2[_0x2de0('0x9')][_0x2de0('0xb')]);}return _0xf0784e(_0x52f9e2[_0x2de0('0x9')][_0x2de0('0xb')]);}else{_0xf0784e(_0x52f9e2[_0x2de0('0xc')]);}})[_0x2de0('0xd')](function(_0x209002){_0xa13964(_0x209002);});});}function respondWithResult(_0x38b197,_0x1ea6ce){_0x1ea6ce=_0x1ea6ce||0xc8;return function(_0x4aa5d6){if(_0x4aa5d6){return _0x38b197[_0x2de0('0xe')](_0x1ea6ce)[_0x2de0('0xf')](_0x4aa5d6);}return _0x38b197[_0x2de0('0x10')](0x194);};}function handleError(_0x41ed5a,_0x4d8513){_0x4d8513=_0x4d8513||0x1f4;return function(_0x591971){logger[_0x2de0('0x9')](_0x591971[_0x2de0('0x11')]);if(_0x591971['name']){delete _0x591971[_0x2de0('0x12')];}_0x41ed5a[_0x2de0('0xe')](_0x4d8513)['send'](_0x591971);};}function findById(_0x280dbc){return function(_0x4cc1a0){if(!_[_0x2de0('0x13')](_0x280dbc)&&!_[_0x2de0('0x13')](_0x4cc1a0)&&!_['isNil'](_0x4cc1a0[_0x2de0('0x14')])){return _['find'](_0x4cc1a0[_0x2de0('0x14')],function(_0x3452c0){return _0x3452c0['id']==_0x280dbc;});}return null;};}exports[_0x2de0('0x15')]=function(_0x2c80af,_0x5c2db3){return respondWithRpcPromise(_0x2de0('0x16'),_0x2c80af[_0x2de0('0x17')])[_0x2de0('0x18')](respondWithResult(_0x5c2db3,null))[_0x2de0('0xd')](handleError(_0x5c2db3,null));};exports[_0x2de0('0x19')]=function(_0x4f2a8e,_0x24ff4f){return respondWithRpcPromise(_0x2de0('0x1a'),_[_0x2de0('0x1b')](_0x4f2a8e[_0x2de0('0x17')],_0x4f2a8e[_0x2de0('0x1c')]))['then'](respondWithResult(_0x24ff4f,null))[_0x2de0('0xd')](handleError(_0x24ff4f,null));};exports['voiceChannelStopMixMonitor']=function(_0x218885,_0x1f2296){return respondWithRpcPromise(_0x2de0('0x1d'),_[_0x2de0('0x1b')](_0x218885['query'],_0x218885[_0x2de0('0x1c')]))['then'](respondWithResult(_0x1f2296,null))[_0x2de0('0xd')](handleError(_0x1f2296,null));};exports[_0x2de0('0x1e')]=function(_0xb277cc,_0x21a9e9){return respondWithRpcPromise(_0x2de0('0x1f'),_0xb277cc[_0x2de0('0x17')])[_0x2de0('0x18')](respondWithResult(_0x21a9e9,null))[_0x2de0('0xd')](handleError(_0x21a9e9,null));};exports[_0x2de0('0x20')]=function(_0x4724f0,_0x48134d){return respondWithRpcPromise(_0x2de0('0x1f'),_0x4724f0[_0x2de0('0x17')])['then'](findById(_0x4724f0[_0x2de0('0x1c')]['id']))[_0x2de0('0x18')](respondWithResult(_0x48134d,null))[_0x2de0('0xd')](handleError(_0x48134d,null));};exports['voiceQueuesPreview']=function(_0x12c365,_0x215d7d){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x2de0('0x1b')](_0x12c365[_0x2de0('0x17')],_0x12c365[_0x2de0('0x1c')]))[_0x2de0('0x18')](respondWithResult(_0x215d7d,null))[_0x2de0('0xd')](handleError(_0x215d7d,null));};exports['voiceQueuesChannels']=function(_0x35ba26,_0x2bfd72){return respondWithRpcPromise(_0x2de0('0x21'),_0x35ba26[_0x2de0('0x17')])['then'](respondWithResult(_0x2bfd72,null))[_0x2de0('0xd')](handleError(_0x2bfd72,null));};exports[_0x2de0('0x22')]=function(_0x329421,_0x521438){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x2de0('0x1b')](_0x329421['query'],_0x329421[_0x2de0('0x1c')]))[_0x2de0('0x18')](respondWithResult(_0x521438,null))[_0x2de0('0xd')](handleError(_0x521438,null));};exports[_0x2de0('0x23')]=function(_0x19f98a,_0x28c0f6){return respondWithRpcPromise(_0x2de0('0x24'),_['merge'](_0x19f98a[_0x2de0('0x17')],_0x19f98a[_0x2de0('0x1c')]))[_0x2de0('0x18')](respondWithResult(_0x28c0f6,null))['catch'](handleError(_0x28c0f6,null));};exports['voiceQueuesChannelRedirect']=function(_0x48da6a,_0x5b539a){return respondWithRpcPromise(_0x2de0('0x25'),_[_0x2de0('0x1b')](_0x48da6a[_0x2de0('0x17')],_0x48da6a[_0x2de0('0x1c')]))['then'](respondWithResult(_0x5b539a,null))[_0x2de0('0xd')](handleError(_0x5b539a,null));};exports['outbound']=function(_0xd6711a,_0x3e7788){return respondWithRpcPromise(_0x2de0('0x26'),_0xd6711a['query'])[_0x2de0('0x18')](respondWithResult(_0x3e7788,null))[_0x2de0('0xd')](handleError(_0x3e7788,null));};exports[_0x2de0('0x27')]=function(_0x28efef,_0x259598){return respondWithRpcPromise(_0x2de0('0x28'),_0x28efef[_0x2de0('0x17')])[_0x2de0('0x18')](respondWithResult(_0x259598,null))[_0x2de0('0xd')](handleError(_0x259598,null));};exports['agents']=function(_0x4a5402,_0x30ff34){var _0x37eef0;return respondWithRpcPromise(_0x2de0('0x29'),_0x4a5402[_0x2de0('0x17')])[_0x2de0('0x18')](function(_0x1cde73){_0x37eef0=_0x1cde73;return respondWithRpcPromise('Agents',_0x4a5402[_0x2de0('0x17')],routingClient);})[_0x2de0('0x18')](function(_0x46e8bf){return _[_0x2de0('0x1b')]({},_0x46e8bf,_0x37eef0);})[_0x2de0('0x18')](respondWithResult(_0x30ff34,null))[_0x2de0('0xd')](handleError(_0x30ff34,null));};exports['agentCapacity']=function(_0x1badd8,_0x2c720d){if(_0x1badd8['body']&&_0x1badd8[_0x2de0('0x2a')][_0x2de0('0x2b')]&&_0x1badd8[_0x2de0('0x2c')]&&_0x1badd8[_0x2de0('0x2c')][_0x2de0('0x12')]){for(var _0xface5b in _0x1badd8[_0x2de0('0x2a')][_0x2de0('0x2b')]){if(_0x1badd8[_0x2de0('0x2a')]['interaction'][_0x2de0('0x2d')](_0xface5b)){db[_0x2de0('0x2e')][_0x2de0('0x2f')]({'where':{'channel':_0xface5b,'membername':_0x1badd8['user'][_0x2de0('0x12')],'type':_0x2de0('0x30'),'exitAt':null,'uniqueid':_0x1badd8[_0x2de0('0x2a')][_0x2de0('0x2b')][_0xface5b]&&_0x1badd8['body'][_0x2de0('0x2b')][_0xface5b]['length']?{'$notIn':_0x1badd8[_0x2de0('0x2a')][_0x2de0('0x2b')][_0xface5b]}:{'$ne':null}}})[_0x2de0('0x18')](function(_0x448aa4){var _0x4c7022=moment()[_0x2de0('0x31')](_0x2de0('0x32'));for(var _0x51b491=0x0,_0x26d003=_0x448aa4[_0x2de0('0x33')];_0x51b491<_0x26d003;_0x51b491+=0x1){_0x448aa4[_0x51b491]['updateAttributes']({'exitAt':_0x4c7022});}});for(var _0x43e31e=0x0;_0x43e31e<_0x1badd8['body'][_0x2de0('0x2b')][_0xface5b]['length'];_0x43e31e+=0x1){db[_0x2de0('0x2e')][_0x2de0('0x34')]({'where':{'channel':_0xface5b,'membername':_0x1badd8[_0x2de0('0x2c')][_0x2de0('0x12')],'type':'INTERACTION','uniqueid':_0x1badd8[_0x2de0('0x2a')]['interaction'][_0xface5b][_0x43e31e],'exitAt':null},'defaults':{'channel':_0xface5b,'membername':_0x1badd8['user'][_0x2de0('0x12')],'interface':_[_0x2de0('0x13')](_0x1badd8['user'][_0x2de0('0x35')])?util['format'](_0x2de0('0x36'),_0x1badd8[_0x2de0('0x2c')][_0x2de0('0x12')]):_0x1badd8[_0x2de0('0x2c')][_0x2de0('0x35')],'type':_0x2de0('0x30'),'enterAt':moment()[_0x2de0('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2de0('0x37'),'internal':_0x1badd8[_0x2de0('0x2c')][_0x2de0('0x38')],'uniqueid':_0x1badd8[_0x2de0('0x2a')][_0x2de0('0x2b')][_0xface5b][_0x43e31e]}});}}}}return respondWithRpcPromise(_0x2de0('0x39'),{'id':_0x1badd8[_0x2de0('0x1c')]['id'],'capacity':_0x1badd8[_0x2de0('0x2a')][_0x2de0('0x3a')]},routingClient)[_0x2de0('0x18')](respondWithResult(_0x2c720d,null))[_0x2de0('0xd')](handleError(_0x2c720d,null));};exports[_0x2de0('0x3b')]=function(_0x34fd3b,_0x5b7525){return respondWithRpcPromise(_0x2de0('0x3c'),_0x34fd3b[_0x2de0('0x17')])[_0x2de0('0x18')](respondWithResult(_0x5b7525,null))[_0x2de0('0xd')](handleError(_0x5b7525,null));};exports[_0x2de0('0x3d')]=function(_0x48f51a,_0x432367){return respondWithRpcPromise('Trunks',_0x48f51a[_0x2de0('0x17')])['then'](respondWithResult(_0x432367,null))[_0x2de0('0xd')](handleError(_0x432367,null));};exports[_0x2de0('0x3e')]=function(_0x576e68,_0x507062){return respondWithRpcPromise(_0x2de0('0x3f'),_0x576e68[_0x2de0('0x17')])[_0x2de0('0x18')](respondWithResult(_0x507062,null))[_0x2de0('0xd')](handleError(_0x507062,null));};exports['chatQueues']=function(_0x35644d,_0x5d4ec4){return respondWithRpcPromise(_0x2de0('0x40'),_0x35644d['query'],routingClient)[_0x2de0('0x18')](respondWithResult(_0x5d4ec4,null))[_0x2de0('0xd')](handleError(_0x5d4ec4,null));};exports[_0x2de0('0x41')]=function(_0x1798de,_0x14b38a){return respondWithRpcPromise(_0x2de0('0x40'),_0x1798de[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](findById(_0x1798de[_0x2de0('0x1c')]['id']))[_0x2de0('0x18')](respondWithResult(_0x14b38a,null))['catch'](handleError(_0x14b38a,null));};exports[_0x2de0('0x42')]=function(_0x6551cc,_0xdc2dbb){return respondWithRpcPromise(_0x2de0('0x43'),_0x6551cc[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0xdc2dbb,null))[_0x2de0('0xd')](handleError(_0xdc2dbb,null));};exports['showMailQueues']=function(_0x5663b4,_0x3f84f0){return respondWithRpcPromise(_0x2de0('0x43'),_0x5663b4['query'],routingClient)['then'](findById(_0x5663b4['params']['id']))[_0x2de0('0x18')](respondWithResult(_0x3f84f0,null))[_0x2de0('0xd')](handleError(_0x3f84f0,null));};exports[_0x2de0('0x44')]=function(_0x48a1ef,_0x3dc932){return respondWithRpcPromise(_0x2de0('0x45'),_0x48a1ef[_0x2de0('0x17')],mailClient)[_0x2de0('0x18')](respondWithResult(_0x3dc932,null))[_0x2de0('0xd')](handleError(_0x3dc932,null));};exports[_0x2de0('0x46')]=function(_0x251a97,_0x188321){return respondWithRpcPromise('OpenchannelQueues',_0x251a97[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x188321,null))['catch'](handleError(_0x188321,null));};exports['showOpenchannelQueues']=function(_0x281872,_0x974d53){return respondWithRpcPromise(_0x2de0('0x47'),_0x281872[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](findById(_0x281872[_0x2de0('0x1c')]['id']))[_0x2de0('0x18')](respondWithResult(_0x974d53,null))[_0x2de0('0xd')](handleError(_0x974d53,null));};exports[_0x2de0('0x48')]=function(_0x4be03a,_0x518c25){return respondWithRpcPromise('SmsQueues',_0x4be03a[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x518c25,null))[_0x2de0('0xd')](handleError(_0x518c25,null));};exports['showSmsQueues']=function(_0x423f0a,_0x2180e0){return respondWithRpcPromise(_0x2de0('0x49'),_0x423f0a[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](findById(_0x423f0a[_0x2de0('0x1c')]['id']))['then'](respondWithResult(_0x2180e0,null))['catch'](handleError(_0x2180e0,null));};exports['whatsappQueues']=function(_0x1df317,_0x4dcd21){return respondWithRpcPromise('WhatsappQueues',_0x1df317[_0x2de0('0x17')],routingClient)['then'](respondWithResult(_0x4dcd21,null))[_0x2de0('0xd')](handleError(_0x4dcd21,null));};exports[_0x2de0('0x4a')]=function(_0x2b5a62,_0x55d47a){return respondWithRpcPromise(_0x2de0('0x4b'),_0x2b5a62[_0x2de0('0x17')],routingClient)['then'](findById(_0x2b5a62[_0x2de0('0x1c')]['id']))[_0x2de0('0x18')](respondWithResult(_0x55d47a,null))['catch'](handleError(_0x55d47a,null));};exports[_0x2de0('0x4c')]=function(_0x2f1a3b,_0x5ae03b){return respondWithRpcPromise(_0x2de0('0x4d'),_0x2f1a3b['query'],routingClient)[_0x2de0('0x18')](respondWithResult(_0x5ae03b,null))['catch'](handleError(_0x5ae03b,null));};exports[_0x2de0('0x4e')]=function(_0x36cc4b,_0x59bd8e){return respondWithRpcPromise(_0x2de0('0x4d'),_0x36cc4b[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](findById(_0x36cc4b[_0x2de0('0x1c')]['id']))[_0x2de0('0x18')](respondWithResult(_0x59bd8e,null))[_0x2de0('0xd')](handleError(_0x59bd8e,null));};exports[_0x2de0('0x4f')]=function(_0x2cc5bb,_0x4e4ba9){return respondWithRpcPromise(_0x2de0('0x50'),_0x2cc5bb['query'])[_0x2de0('0x18')](respondWithResult(_0x4e4ba9,null))[_0x2de0('0xd')](handleError(_0x4e4ba9,null));};exports['chatQueuesWaitingInteractions']=function(_0x4c1f70,_0x5aa4c2){return respondWithRpcPromise(_0x2de0('0x51'),_0x4c1f70[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x5aa4c2,null))[_0x2de0('0xd')](handleError(_0x5aa4c2,null));};exports['mailQueuesWaitingInteractions']=function(_0x534ab1,_0x24d0cc){return respondWithRpcPromise(_0x2de0('0x52'),_0x534ab1[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x24d0cc,null))[_0x2de0('0xd')](handleError(_0x24d0cc,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x2bce90,_0x123f9e){return respondWithRpcPromise(_0x2de0('0x53'),_0x2bce90[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x123f9e,null))[_0x2de0('0xd')](handleError(_0x123f9e,null));};exports[_0x2de0('0x54')]=function(_0x2b4fc2,_0x3fadd0){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2b4fc2[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](function(_0x7c73cb){if(_0x2b4fc2['query'][_0x2de0('0x55')]!==undefined){var _0x46622e=_(_0x7c73cb[_0x2de0('0x14')])['filter']([_0x2b4fc2['query']['type'],_0x2b4fc2[_0x2de0('0x1c')]['id']])[_0x2de0('0x56')](_0x2de0('0x57'))[_0x2de0('0x58')]()[_0x2de0('0x59')]();return _0x7c73cb[_0x2de0('0x14')][_0x2de0('0x5a')](function(_0x514d68){return _0x46622e[_0x2de0('0x5b')](_0x514d68[_0x2de0('0x57')])>-0x1;});}else{return _0x7c73cb[_0x2de0('0x14')]['filter'](function(_0x1a80d7){return _0x1a80d7[_0x2de0('0x57')]===parseInt(_0x2b4fc2[_0x2de0('0x1c')]['id']);});}})[_0x2de0('0x18')](respondWithResult(_0x3fadd0,null))[_0x2de0('0xd')](handleError(_0x3fadd0,null));};exports[_0x2de0('0x5c')]=function(_0x5cc1ff,_0x3c90d8){return respondWithRpcPromise(_0x2de0('0x5d'),_0x5cc1ff[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x3c90d8,null))[_0x2de0('0xd')](handleError(_0x3c90d8,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xda1603,_0x31b02d){return respondWithRpcPromise(_0x2de0('0x5e'),_0xda1603['query'],routingClient)[_0x2de0('0x18')](respondWithResult(_0x31b02d,null))['catch'](handleError(_0x31b02d,null));};exports[_0x2de0('0x5f')]=function(_0x5644a2,_0x207207){return respondWithRpcPromise(_0x2de0('0x60'),_0x5644a2[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x207207,null))['catch'](handleError(_0x207207,null));};exports[_0x2de0('0x61')]=function(_0xbcb881){return function(_0x2b0783,_0x3f1d0a){var _0x4f2ea6,_0x20c0d7;var _0x27ca15=_[_0x2de0('0x62')](_0xbcb881);var _0x1d73d6=_0xbcb881===_0x2de0('0x63')?_0x2de0('0x64'):_0x2de0('0x65');return db[_0x27ca15+_0x2de0('0x66')][_0x2de0('0x67')]({'raw':!![],'where':{'id':_0x2b0783[_0x2de0('0x1c')]['id']}})[_0x2de0('0x18')](function(_0x2ddeef){if(_['isNil'](_0x2ddeef)){throw new Error(_0x27ca15+_0x2de0('0x68'));}_0x4f2ea6=_0x2ddeef;return db[_0x27ca15+_0x2de0('0x69')]['findOne']({'where':{'id':_0x2b0783[_0x2de0('0x2a')][_0x2de0('0x6a')]},'include':[{'model':db[_0x27ca15+_0x2de0('0x6b')],'as':_0x2de0('0x6b')},{'model':db[_0x27ca15+_0x1d73d6],'as':_0x2de0('0x65')}]});})[_0x2de0('0x18')](function(_0xe49c6b){if(_[_0x2de0('0x13')](_0xe49c6b)){throw new Error(_0x27ca15+'\x20Message\x20not\x20found');}_0x20c0d7=_0xe49c6b;return _0xe49c6b[_0x2de0('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2de0('0x18')](function(){var _0x27121b={'uniqueid':_0xbcb881+'.'+_0x20c0d7['id']+'.'+_0x20c0d7['Interaction']['id'],'FromUserId':_0x2b0783[_0x2de0('0x2c')]['id'],'type':'queue'};_0x27121b[_0x27ca15+_0x2de0('0x6d')]=_0x20c0d7['id'];_0x27121b[_0x27ca15+_0x2de0('0x6e')]=_0x20c0d7[_0x2de0('0x6b')]['id'];_0x27121b['From'+_0x27ca15+_0x1d73d6+'Id']=_0x20c0d7[_0x2de0('0x65')]['id'];_0x27121b['To'+_0x27ca15+_0x2de0('0x6f')]=_0x4f2ea6['id'];return db[_0x27ca15+_0x2de0('0x70')][_0x2de0('0x71')](_0x27121b);})[_0x2de0('0x18')](function(){return respondWithRpcPromise('Start',{'channel':_0xbcb881,'interaction':_0x20c0d7[_0x2de0('0x6b')],'message':_0x20c0d7,'account':_0x20c0d7[_0x2de0('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4f2ea6[_0x2de0('0x12')]+','+(_0x20c0d7[_0x2de0('0x65')][_0x2de0('0x72')]||0x12c),'interval':_0x2de0('0x73')}]},routingClient);})['then'](respondWithResult(_0x3f1d0a,null))['catch'](handleError(_0x3f1d0a,null));};};exports[_0x2de0('0x74')]=function(_0x59cd10,_0x447d07){var _0x2dc2d0,_0x376130;if(_[_0x2de0('0x13')](_0x59cd10['body'][_0x2de0('0x75')])){throw new Error(_0x2de0('0x76'));}var _0xda2f2f=_0x59cd10[_0x2de0('0x2a')][_0x2de0('0x75')];var _0x235d96=_[_0x2de0('0x62')](_0xda2f2f);var _0x2a8946=_0xda2f2f===_0x2de0('0x63')?_0x2de0('0x64'):'Account';return db[_0x2de0('0x77')][_0x2de0('0x67')]({'raw':!![],'where':{'id':_0x59cd10[_0x2de0('0x1c')]['id'],'role':_0x2de0('0x37')}})[_0x2de0('0x18')](function(_0x400904){if(_[_0x2de0('0x13')](_0x400904)){throw new Error(_0x2de0('0x78'));}_0x2dc2d0=_0x400904;return db[_0x235d96+_0x2de0('0x69')]['findOne']({'where':{'id':_0x59cd10[_0x2de0('0x2a')]['messageId']},'include':[{'model':db[_0x235d96+'Interaction'],'as':_0x2de0('0x6b')},{'model':db[_0x235d96+_0x2a8946],'as':_0x2de0('0x65')}]});})[_0x2de0('0x18')](function(_0x364208){if(_['isNil'](_0x364208)){throw new Error(_0x235d96+'\x20Message\x20not\x20found');}_0x376130=_0x364208;return _0x364208[_0x2de0('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2a7d8c={'uniqueid':_0xda2f2f+'.'+_0x376130['id']+'.'+_0x376130[_0x2de0('0x6b')]['id'],'FromUserId':_0x59cd10[_0x2de0('0x2c')]['id'],'type':'queue','ToUserId':_0x2dc2d0['id']};_0x2a7d8c[_0x235d96+_0x2de0('0x6d')]=_0x376130['id'];_0x2a7d8c[_0x235d96+_0x2de0('0x6e')]=_0x376130[_0x2de0('0x6b')]['id'];_0x2a7d8c[_0x2de0('0x79')+_0x235d96+_0x2a8946+'Id']=_0x376130[_0x2de0('0x65')]['id'];return db[_0x235d96+_0x2de0('0x70')][_0x2de0('0x71')](_0x2a7d8c);})[_0x2de0('0x18')](function(){return respondWithRpcPromise('Start',{'channel':_0xda2f2f,'interaction':_0x376130['Interaction'],'message':_0x376130,'account':_0x376130[_0x2de0('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2de0('0x37'),'appdata':_0x2dc2d0[_0x2de0('0x12')]+','+(_0x376130['Account'][_0x2de0('0x7a')]||0x12c),'interval':_0x2de0('0x73')}]},routingClient);})[_0x2de0('0x18')](respondWithResult(_0x447d07,null))[_0x2de0('0xd')](handleError(_0x447d07,null));}; \ No newline at end of file +var _0xabf4=['InteractionId','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','Message','queue','From','agentTransferTimeout','*,*,*,*','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','send','isNil','find','rows','voiceChannels','VoiceChannels','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','query','VoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','user','name','interaction','hasOwnProperty','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','AgentCapacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId'];(function(_0x1956e7,_0x3a03fb){var _0x35d8fa=function(_0x34b906){while(--_0x34b906){_0x1956e7['push'](_0x1956e7['shift']());}};_0x35d8fa(++_0x3a03fb);}(_0xabf4,0x10a));var _0x4abf=function(_0x349942,_0xaf2dc4){_0x349942=_0x349942-0x0;var _0x40a55b=_0xabf4[_0x349942];return _0x40a55b;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x4abf('0x0'));var util=require(_0x4abf('0x1'));var db=require(_0x4abf('0x2'))['db'];var logger=require('../../config/logger')(_0x4abf('0x3'));var jayson=require(_0x4abf('0x4'));var amiClient=jayson[_0x4abf('0x5')][_0x4abf('0x6')]({'port':0x232a});var mailClient=jayson[_0x4abf('0x5')][_0x4abf('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x4abf('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x4a1b6a,_0x13a179,_0x443124){return new BPromise(function(_0x306ab9,_0x1e8108){var _0x5ebfe6=_0x443124?_0x443124:amiClient;return _0x5ebfe6[_0x4abf('0x7')](_0x4a1b6a,_0x13a179)[_0x4abf('0x8')](function(_0xddab1e){if(_0xddab1e[_0x4abf('0x9')]){if(_0xddab1e['error'][_0x4abf('0xa')]===0x1f4){return _0x1e8108(_0xddab1e[_0x4abf('0x9')][_0x4abf('0xb')]);}return _0x306ab9(_0xddab1e[_0x4abf('0x9')][_0x4abf('0xb')]);}else{_0x306ab9(_0xddab1e[_0x4abf('0xc')]);}})[_0x4abf('0xd')](function(_0x44bddc){_0x1e8108(_0x44bddc);});});}function respondWithResult(_0x577014,_0x3966d0){_0x3966d0=_0x3966d0||0xc8;return function(_0x5c09c9){if(_0x5c09c9){return _0x577014[_0x4abf('0xe')](_0x3966d0)[_0x4abf('0xf')](_0x5c09c9);}return _0x577014[_0x4abf('0x10')](0x194);};}function handleError(_0x2cd6d1,_0x2a3b20){_0x2a3b20=_0x2a3b20||0x1f4;return function(_0x239ceb){logger[_0x4abf('0x9')](_0x239ceb['stack']);if(_0x239ceb['name']){delete _0x239ceb['name'];}_0x2cd6d1['status'](_0x2a3b20)[_0x4abf('0x11')](_0x239ceb);};}function findById(_0xf0bb60){return function(_0x2fc8d1){if(!_[_0x4abf('0x12')](_0xf0bb60)&&!_['isNil'](_0x2fc8d1)&&!_['isNil'](_0x2fc8d1['rows'])){return _[_0x4abf('0x13')](_0x2fc8d1[_0x4abf('0x14')],function(_0x4ee727){return _0x4ee727['id']==_0xf0bb60;});}return null;};}exports[_0x4abf('0x15')]=function(_0x10224e,_0x18b007){return respondWithRpcPromise(_0x4abf('0x16'),_0x10224e['query'])[_0x4abf('0x8')](respondWithResult(_0x18b007,null))[_0x4abf('0xd')](handleError(_0x18b007,null));};exports['voiceChannelMixMonitor']=function(_0x8886c,_0x16fd93){return respondWithRpcPromise(_0x4abf('0x17'),_['merge'](_0x8886c['query'],_0x8886c[_0x4abf('0x18')]))[_0x4abf('0x8')](respondWithResult(_0x16fd93,null))[_0x4abf('0xd')](handleError(_0x16fd93,null));};exports[_0x4abf('0x19')]=function(_0x19cd3e,_0x3bb82b){return respondWithRpcPromise(_0x4abf('0x1a'),_[_0x4abf('0x1b')](_0x19cd3e[_0x4abf('0x1c')],_0x19cd3e[_0x4abf('0x18')]))[_0x4abf('0x8')](respondWithResult(_0x3bb82b,null))[_0x4abf('0xd')](handleError(_0x3bb82b,null));};exports['voiceQueues']=function(_0x4b1052,_0x3f4c9e){return respondWithRpcPromise('VoiceQueues',_0x4b1052[_0x4abf('0x1c')])[_0x4abf('0x8')](respondWithResult(_0x3f4c9e,null))[_0x4abf('0xd')](handleError(_0x3f4c9e,null));};exports['showVoiceQueues']=function(_0x596d43,_0x31a840){return respondWithRpcPromise(_0x4abf('0x1d'),_0x596d43['query'])[_0x4abf('0x8')](findById(_0x596d43[_0x4abf('0x18')]['id']))[_0x4abf('0x8')](respondWithResult(_0x31a840,null))['catch'](handleError(_0x31a840,null));};exports[_0x4abf('0x1e')]=function(_0x15e27a,_0x486064){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x4abf('0x1b')](_0x15e27a[_0x4abf('0x1c')],_0x15e27a[_0x4abf('0x18')]))[_0x4abf('0x8')](respondWithResult(_0x486064,null))['catch'](handleError(_0x486064,null));};exports[_0x4abf('0x1f')]=function(_0x52a59a,_0x4bae2f){return respondWithRpcPromise(_0x4abf('0x20'),_0x52a59a[_0x4abf('0x1c')])[_0x4abf('0x8')](respondWithResult(_0x4bae2f,null))[_0x4abf('0xd')](handleError(_0x4bae2f,null));};exports['voiceQueuesChannel']=function(_0x3b8de3,_0x487830){return respondWithRpcPromise(_0x4abf('0x21'),_[_0x4abf('0x1b')](_0x3b8de3[_0x4abf('0x1c')],_0x3b8de3[_0x4abf('0x18')]))[_0x4abf('0x8')](respondWithResult(_0x487830,null))[_0x4abf('0xd')](handleError(_0x487830,null));};exports[_0x4abf('0x22')]=function(_0x143c54,_0x5cfea3){return respondWithRpcPromise(_0x4abf('0x23'),_[_0x4abf('0x1b')](_0x143c54[_0x4abf('0x1c')],_0x143c54[_0x4abf('0x18')]))[_0x4abf('0x8')](respondWithResult(_0x5cfea3,null))[_0x4abf('0xd')](handleError(_0x5cfea3,null));};exports['voiceQueuesChannelRedirect']=function(_0x40f850,_0x420b2a){return respondWithRpcPromise(_0x4abf('0x24'),_[_0x4abf('0x1b')](_0x40f850[_0x4abf('0x1c')],_0x40f850['params']))[_0x4abf('0x8')](respondWithResult(_0x420b2a,null))[_0x4abf('0xd')](handleError(_0x420b2a,null));};exports[_0x4abf('0x25')]=function(_0x1ad4d5,_0x1a41e3){return respondWithRpcPromise(_0x4abf('0x26'),_0x1ad4d5[_0x4abf('0x1c')])[_0x4abf('0x8')](respondWithResult(_0x1a41e3,null))[_0x4abf('0xd')](handleError(_0x1a41e3,null));};exports[_0x4abf('0x27')]=function(_0x1bf738,_0x50d718){return respondWithRpcPromise(_0x4abf('0x28'),_0x1bf738['query'])['then'](respondWithResult(_0x50d718,null))['catch'](handleError(_0x50d718,null));};exports[_0x4abf('0x29')]=function(_0x271f56,_0x3a1aa0){var _0x3eab84;return respondWithRpcPromise(_0x4abf('0x2a'),_0x271f56[_0x4abf('0x1c')])[_0x4abf('0x8')](function(_0x2c0a26){_0x3eab84=_0x2c0a26;return respondWithRpcPromise('Agents',_0x271f56[_0x4abf('0x1c')],routingClient);})[_0x4abf('0x8')](function(_0x5e0d42){return _[_0x4abf('0x1b')]({},_0x5e0d42,_0x3eab84);})['then'](respondWithResult(_0x3a1aa0,null))[_0x4abf('0xd')](handleError(_0x3a1aa0,null));};exports[_0x4abf('0x2b')]=function(_0x2567db,_0xc80e4a){if(_0x2567db[_0x4abf('0x2c')]&&_0x2567db['body']['interaction']&&_0x2567db[_0x4abf('0x2d')]&&_0x2567db[_0x4abf('0x2d')][_0x4abf('0x2e')]){for(var _0x59ac9a in _0x2567db[_0x4abf('0x2c')][_0x4abf('0x2f')]){if(_0x2567db[_0x4abf('0x2c')][_0x4abf('0x2f')][_0x4abf('0x30')](_0x59ac9a)){db['MemberReport']['findAll']({'where':{'channel':_0x59ac9a,'membername':_0x2567db[_0x4abf('0x2d')][_0x4abf('0x2e')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x2567db[_0x4abf('0x2c')]['interaction'][_0x59ac9a]&&_0x2567db[_0x4abf('0x2c')]['interaction'][_0x59ac9a][_0x4abf('0x31')]?{'$notIn':_0x2567db[_0x4abf('0x2c')][_0x4abf('0x2f')][_0x59ac9a]}:{'$ne':null}}})[_0x4abf('0x8')](function(_0x1a7136){var _0x422343=moment()[_0x4abf('0x32')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2447d=0x0,_0x582f8f=_0x1a7136[_0x4abf('0x31')];_0x2447d<_0x582f8f;_0x2447d+=0x1){_0x1a7136[_0x2447d][_0x4abf('0x33')]({'exitAt':_0x422343});}});for(var _0x45b8b4=0x0;_0x45b8b4<_0x2567db['body'][_0x4abf('0x2f')][_0x59ac9a][_0x4abf('0x31')];_0x45b8b4+=0x1){db[_0x4abf('0x34')][_0x4abf('0x35')]({'where':{'channel':_0x59ac9a,'membername':_0x2567db[_0x4abf('0x2d')][_0x4abf('0x2e')],'type':_0x4abf('0x36'),'uniqueid':_0x2567db['body'][_0x4abf('0x2f')][_0x59ac9a][_0x45b8b4],'exitAt':null},'defaults':{'channel':_0x59ac9a,'membername':_0x2567db['user'][_0x4abf('0x2e')],'interface':_[_0x4abf('0x12')](_0x2567db[_0x4abf('0x2d')][_0x4abf('0x37')])?util['format'](_0x4abf('0x38'),_0x2567db[_0x4abf('0x2d')][_0x4abf('0x2e')]):_0x2567db[_0x4abf('0x2d')][_0x4abf('0x37')],'type':_0x4abf('0x36'),'enterAt':moment()[_0x4abf('0x32')](_0x4abf('0x39')),'role':_0x4abf('0x3a'),'internal':_0x2567db[_0x4abf('0x2d')]['internal'],'uniqueid':_0x2567db[_0x4abf('0x2c')][_0x4abf('0x2f')][_0x59ac9a][_0x45b8b4]}});}}}}return respondWithRpcPromise(_0x4abf('0x3b'),{'id':_0x2567db['params']['id'],'capacity':_0x2567db[_0x4abf('0x2c')]['capacity']},routingClient)[_0x4abf('0x8')](respondWithResult(_0xc80e4a,null))[_0x4abf('0xd')](handleError(_0xc80e4a,null));};exports[_0x4abf('0x3c')]=function(_0x377e75,_0x3995c9){return respondWithRpcPromise(_0x4abf('0x3d'),_0x377e75[_0x4abf('0x1c')])[_0x4abf('0x8')](respondWithResult(_0x3995c9,null))[_0x4abf('0xd')](handleError(_0x3995c9,null));};exports[_0x4abf('0x3e')]=function(_0x5a0453,_0x5ef58f){return respondWithRpcPromise(_0x4abf('0x3f'),_0x5a0453[_0x4abf('0x1c')])[_0x4abf('0x8')](respondWithResult(_0x5ef58f,null))['catch'](handleError(_0x5ef58f,null));};exports[_0x4abf('0x40')]=function(_0x490e17,_0x3bd8c7){return respondWithRpcPromise(_0x4abf('0x41'),_0x490e17[_0x4abf('0x1c')])[_0x4abf('0x8')](respondWithResult(_0x3bd8c7,null))[_0x4abf('0xd')](handleError(_0x3bd8c7,null));};exports[_0x4abf('0x42')]=function(_0xc919f8,_0xc01ea8){return respondWithRpcPromise(_0x4abf('0x43'),_0xc919f8[_0x4abf('0x1c')],routingClient)[_0x4abf('0x8')](respondWithResult(_0xc01ea8,null))[_0x4abf('0xd')](handleError(_0xc01ea8,null));};exports['showChatQueues']=function(_0x296b0c,_0x4ef397){return respondWithRpcPromise(_0x4abf('0x43'),_0x296b0c[_0x4abf('0x1c')],routingClient)[_0x4abf('0x8')](findById(_0x296b0c[_0x4abf('0x18')]['id']))[_0x4abf('0x8')](respondWithResult(_0x4ef397,null))[_0x4abf('0xd')](handleError(_0x4ef397,null));};exports[_0x4abf('0x44')]=function(_0x55eda9,_0x4089b0){return respondWithRpcPromise(_0x4abf('0x45'),_0x55eda9[_0x4abf('0x1c')],routingClient)['then'](respondWithResult(_0x4089b0,null))[_0x4abf('0xd')](handleError(_0x4089b0,null));};exports['showMailQueues']=function(_0x370255,_0x11bb8d){return respondWithRpcPromise('MailQueues',_0x370255[_0x4abf('0x1c')],routingClient)['then'](findById(_0x370255[_0x4abf('0x18')]['id']))[_0x4abf('0x8')](respondWithResult(_0x11bb8d,null))[_0x4abf('0xd')](handleError(_0x11bb8d,null));};exports['mailAccounts']=function(_0x268c13,_0xa57c6d){return respondWithRpcPromise(_0x4abf('0x46'),_0x268c13[_0x4abf('0x1c')],mailClient)[_0x4abf('0x8')](respondWithResult(_0xa57c6d,null))[_0x4abf('0xd')](handleError(_0xa57c6d,null));};exports[_0x4abf('0x47')]=function(_0x579456,_0x52b6d9){return respondWithRpcPromise(_0x4abf('0x48'),_0x579456[_0x4abf('0x1c')],routingClient)['then'](respondWithResult(_0x52b6d9,null))[_0x4abf('0xd')](handleError(_0x52b6d9,null));};exports[_0x4abf('0x49')]=function(_0xb7c782,_0x29d829){return respondWithRpcPromise(_0x4abf('0x48'),_0xb7c782['query'],routingClient)[_0x4abf('0x8')](findById(_0xb7c782[_0x4abf('0x18')]['id']))[_0x4abf('0x8')](respondWithResult(_0x29d829,null))[_0x4abf('0xd')](handleError(_0x29d829,null));};exports[_0x4abf('0x4a')]=function(_0x49ad75,_0x142997){return respondWithRpcPromise(_0x4abf('0x4b'),_0x49ad75[_0x4abf('0x1c')],routingClient)[_0x4abf('0x8')](respondWithResult(_0x142997,null))[_0x4abf('0xd')](handleError(_0x142997,null));};exports['showSmsQueues']=function(_0x1df40e,_0x4a2019){return respondWithRpcPromise(_0x4abf('0x4b'),_0x1df40e['query'],routingClient)['then'](findById(_0x1df40e['params']['id']))[_0x4abf('0x8')](respondWithResult(_0x4a2019,null))['catch'](handleError(_0x4a2019,null));};exports[_0x4abf('0x4c')]=function(_0x2665e4,_0x4d6cf3){return respondWithRpcPromise(_0x4abf('0x4d'),_0x2665e4[_0x4abf('0x1c')],routingClient)[_0x4abf('0x8')](respondWithResult(_0x4d6cf3,null))[_0x4abf('0xd')](handleError(_0x4d6cf3,null));};exports['showWhatsappQueues']=function(_0x5cfddd,_0x471242){return respondWithRpcPromise(_0x4abf('0x4d'),_0x5cfddd[_0x4abf('0x1c')],routingClient)[_0x4abf('0x8')](findById(_0x5cfddd[_0x4abf('0x18')]['id']))[_0x4abf('0x8')](respondWithResult(_0x471242,null))[_0x4abf('0xd')](handleError(_0x471242,null));};exports[_0x4abf('0x4e')]=function(_0xa0b20,_0x52bcea){return respondWithRpcPromise(_0x4abf('0x4f'),_0xa0b20[_0x4abf('0x1c')],routingClient)[_0x4abf('0x8')](respondWithResult(_0x52bcea,null))['catch'](handleError(_0x52bcea,null));};exports[_0x4abf('0x50')]=function(_0x3e4917,_0xa2791c){return respondWithRpcPromise(_0x4abf('0x4f'),_0x3e4917['query'],routingClient)['then'](findById(_0x3e4917['params']['id']))[_0x4abf('0x8')](respondWithResult(_0xa2791c,null))[_0x4abf('0xd')](handleError(_0xa2791c,null));};exports[_0x4abf('0x51')]=function(_0x5cef54,_0x158918){return respondWithRpcPromise(_0x4abf('0x52'),_0x5cef54['query'])[_0x4abf('0x8')](respondWithResult(_0x158918,null))[_0x4abf('0xd')](handleError(_0x158918,null));};exports['chatQueuesWaitingInteractions']=function(_0x45040a,_0x27e4df){return respondWithRpcPromise(_0x4abf('0x53'),_0x45040a['query'],routingClient)[_0x4abf('0x8')](respondWithResult(_0x27e4df,null))[_0x4abf('0xd')](handleError(_0x27e4df,null));};exports[_0x4abf('0x54')]=function(_0x1a2355,_0x3c4464){return respondWithRpcPromise(_0x4abf('0x55'),_0x1a2355[_0x4abf('0x1c')],routingClient)[_0x4abf('0x8')](respondWithResult(_0x3c4464,null))[_0x4abf('0xd')](handleError(_0x3c4464,null));};exports[_0x4abf('0x56')]=function(_0x1ba071,_0x10b422){return respondWithRpcPromise(_0x4abf('0x57'),_0x1ba071[_0x4abf('0x1c')],routingClient)[_0x4abf('0x8')](respondWithResult(_0x10b422,null))[_0x4abf('0xd')](handleError(_0x10b422,null));};exports[_0x4abf('0x58')]=function(_0x5b400f,_0x1b32b9){return respondWithRpcPromise(_0x4abf('0x57'),_0x5b400f[_0x4abf('0x1c')],routingClient)[_0x4abf('0x8')](function(_0x25cb86){if(_0x5b400f[_0x4abf('0x1c')]['type']!==undefined){var _0x2f79be=_(_0x25cb86[_0x4abf('0x14')])[_0x4abf('0x59')]([_0x5b400f[_0x4abf('0x1c')]['type'],_0x5b400f[_0x4abf('0x18')]['id']])[_0x4abf('0x5a')](_0x4abf('0x5b'))[_0x4abf('0x5c')]()[_0x4abf('0x5d')]();return _0x25cb86[_0x4abf('0x14')][_0x4abf('0x59')](function(_0x3edae8){return _0x2f79be[_0x4abf('0x5e')](_0x3edae8[_0x4abf('0x5b')])>-0x1;});}else{return _0x25cb86[_0x4abf('0x14')]['filter'](function(_0x33c39b){return _0x33c39b['queue_id']===parseInt(_0x5b400f[_0x4abf('0x18')]['id']);});}})[_0x4abf('0x8')](respondWithResult(_0x1b32b9,null))['catch'](handleError(_0x1b32b9,null));};exports[_0x4abf('0x5f')]=function(_0x447cfc,_0x1b42dc){return respondWithRpcPromise(_0x4abf('0x60'),_0x447cfc[_0x4abf('0x1c')],routingClient)[_0x4abf('0x8')](respondWithResult(_0x1b42dc,null))[_0x4abf('0xd')](handleError(_0x1b42dc,null));};exports[_0x4abf('0x61')]=function(_0x24f3e2,_0x29133e){return respondWithRpcPromise(_0x4abf('0x62'),_0x24f3e2[_0x4abf('0x1c')],routingClient)[_0x4abf('0x8')](respondWithResult(_0x29133e,null))[_0x4abf('0xd')](handleError(_0x29133e,null));};exports[_0x4abf('0x63')]=function(_0xa1e8d,_0x4b4f1e){return respondWithRpcPromise(_0x4abf('0x64'),_0xa1e8d[_0x4abf('0x1c')],routingClient)['then'](respondWithResult(_0x4b4f1e,null))['catch'](handleError(_0x4b4f1e,null));};exports[_0x4abf('0x65')]=function(_0x145381){return function(_0x5ec379,_0x574e8f){var _0x1cc25e,_0x2465df;var _0x156362=_[_0x4abf('0x66')](_0x145381);var _0x3ec520=_0x145381==='chat'?_0x4abf('0x67'):_0x4abf('0x68');return db[_0x156362+_0x4abf('0x69')][_0x4abf('0x6a')]({'raw':!![],'where':{'id':_0x5ec379[_0x4abf('0x18')]['id']}})[_0x4abf('0x8')](function(_0x38222c){if(_[_0x4abf('0x12')](_0x38222c)){throw new Error(_0x156362+'\x20Queue\x20not\x20found');}_0x1cc25e=_0x38222c;return db[_0x156362+'Message'][_0x4abf('0x6a')]({'where':{'id':_0x5ec379[_0x4abf('0x2c')][_0x4abf('0x6b')]},'include':[{'model':db[_0x156362+_0x4abf('0x6c')],'as':_0x4abf('0x6c')},{'model':db[_0x156362+_0x3ec520],'as':_0x4abf('0x68')}]});})[_0x4abf('0x8')](function(_0x32d9d7){if(_[_0x4abf('0x12')](_0x32d9d7)){throw new Error(_0x156362+_0x4abf('0x6d'));}_0x2465df=_0x32d9d7;return _0x32d9d7[_0x4abf('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4abf('0x8')](function(){var _0xd0e980={'uniqueid':_0x145381+'.'+_0x2465df['id']+'.'+_0x2465df['Interaction']['id'],'FromUserId':_0x5ec379[_0x4abf('0x2d')]['id'],'type':'queue'};_0xd0e980[_0x156362+_0x4abf('0x6f')]=_0x2465df['id'];_0xd0e980[_0x156362+_0x4abf('0x70')]=_0x2465df['Interaction']['id'];_0xd0e980['From'+_0x156362+_0x3ec520+'Id']=_0x2465df[_0x4abf('0x68')]['id'];_0xd0e980['To'+_0x156362+'QueueId']=_0x1cc25e['id'];return db[_0x156362+_0x4abf('0x71')][_0x4abf('0x72')](_0xd0e980);})[_0x4abf('0x8')](function(){return respondWithRpcPromise(_0x4abf('0x73'),{'channel':_0x145381,'interaction':_0x2465df[_0x4abf('0x6c')],'message':_0x2465df,'account':_0x2465df[_0x4abf('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1cc25e[_0x4abf('0x2e')]+','+(_0x2465df[_0x4abf('0x68')][_0x4abf('0x74')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x4abf('0x8')](respondWithResult(_0x574e8f,null))[_0x4abf('0xd')](handleError(_0x574e8f,null));};};exports[_0x4abf('0x75')]=function(_0x35e61d,_0x1761ff){var _0xd58bf7,_0x1c8ff6;if(_[_0x4abf('0x12')](_0x35e61d[_0x4abf('0x2c')][_0x4abf('0x76')])){throw new Error(_0x4abf('0x77'));}var _0x484a36=_0x35e61d[_0x4abf('0x2c')]['channel'];var _0x2fe7a2=_[_0x4abf('0x66')](_0x484a36);var _0x9ed9e8=_0x484a36==='chat'?_0x4abf('0x67'):_0x4abf('0x68');return db['User']['findOne']({'raw':!![],'where':{'id':_0x35e61d['params']['id'],'role':_0x4abf('0x3a')}})[_0x4abf('0x8')](function(_0x3f15e2){if(_[_0x4abf('0x12')](_0x3f15e2)){throw new Error(_0x4abf('0x78'));}_0xd58bf7=_0x3f15e2;return db[_0x2fe7a2+_0x4abf('0x79')]['findOne']({'where':{'id':_0x35e61d[_0x4abf('0x2c')][_0x4abf('0x6b')]},'include':[{'model':db[_0x2fe7a2+'Interaction'],'as':_0x4abf('0x6c')},{'model':db[_0x2fe7a2+_0x9ed9e8],'as':'Account'}]});})['then'](function(_0x23952f){if(_[_0x4abf('0x12')](_0x23952f)){throw new Error(_0x2fe7a2+_0x4abf('0x6d'));}_0x1c8ff6=_0x23952f;return _0x23952f[_0x4abf('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4abf('0x8')](function(){var _0x434810={'uniqueid':_0x484a36+'.'+_0x1c8ff6['id']+'.'+_0x1c8ff6[_0x4abf('0x6c')]['id'],'FromUserId':_0x35e61d[_0x4abf('0x2d')]['id'],'type':_0x4abf('0x7a'),'ToUserId':_0xd58bf7['id']};_0x434810[_0x2fe7a2+'MessageId']=_0x1c8ff6['id'];_0x434810[_0x2fe7a2+_0x4abf('0x70')]=_0x1c8ff6['Interaction']['id'];_0x434810[_0x4abf('0x7b')+_0x2fe7a2+_0x9ed9e8+'Id']=_0x1c8ff6['Account']['id'];return db[_0x2fe7a2+_0x4abf('0x71')]['create'](_0x434810);})[_0x4abf('0x8')](function(){return respondWithRpcPromise(_0x4abf('0x73'),{'channel':_0x484a36,'interaction':_0x1c8ff6[_0x4abf('0x6c')],'message':_0x1c8ff6,'account':_0x1c8ff6[_0x4abf('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4abf('0x3a'),'appdata':_0xd58bf7['name']+','+(_0x1c8ff6[_0x4abf('0x68')][_0x4abf('0x7c')]||0x12c),'interval':_0x4abf('0x7d')}]},routingClient);})[_0x4abf('0x8')](respondWithResult(_0x1761ff,null))[_0x4abf('0xd')](handleError(_0x1761ff,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index c3b7bd9..3a54099 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 _0xbf4c=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','run','post','create','put','update','delete','multer'];(function(_0x3e5e83,_0x242e92){var _0xa8af11=function(_0x37e34f){while(--_0x37e34f){_0x3e5e83['push'](_0x3e5e83['shift']());}};_0xa8af11(++_0x242e92);}(_0xbf4c,0x1a1));var _0xcbf4=function(_0x28ef66,_0x29af0a){_0x28ef66=_0x28ef66-0x0;var _0x138493=_0xbf4c[_0x28ef66];return _0x138493;};'use strict';var multer=require(_0xcbf4('0x0'));var util=require(_0xcbf4('0x1'));var path=require(_0xcbf4('0x2'));var timeout=require(_0xcbf4('0x3'));var express=require(_0xcbf4('0x4'));var router=express[_0xcbf4('0x5')]();var auth=require(_0xcbf4('0x6'));var interaction=require(_0xcbf4('0x7'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0xcbf4('0x8')]('/',auth[_0xcbf4('0x9')](),controller[_0xcbf4('0xa')]);router[_0xcbf4('0x8')](_0xcbf4('0xb'),auth[_0xcbf4('0x9')](),controller[_0xcbf4('0xc')]);router[_0xcbf4('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0xcbf4('0xd')]);router[_0xcbf4('0xe')]('/',auth['isAuthenticated'](),controller[_0xcbf4('0xf')]);router[_0xcbf4('0x10')]('/:id',auth[_0xcbf4('0x9')](),controller[_0xcbf4('0x11')]);router[_0xcbf4('0x12')](_0xcbf4('0xb'),auth[_0xcbf4('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x245e=['../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated','show','/:id/run','run','create','put','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0xcbbd03,_0x67588f){var _0x1ae6f0=function(_0x5d55c7){while(--_0x5d55c7){_0xcbbd03['push'](_0xcbbd03['shift']());}};_0x1ae6f0(++_0x67588f);}(_0x245e,0x129));var _0xe245=function(_0x230b31,_0x39560e){_0x230b31=_0x230b31-0x0;var _0x391efc=_0x245e[_0x230b31];return _0x391efc;};'use strict';var multer=require(_0xe245('0x0'));var util=require(_0xe245('0x1'));var path=require(_0xe245('0x2'));var timeout=require(_0xe245('0x3'));var express=require(_0xe245('0x4'));var router=express[_0xe245('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe245('0x6'));var config=require(_0xe245('0x7'));var controller=require(_0xe245('0x8'));router[_0xe245('0x9')]('/',auth['isAuthenticated'](),controller[_0xe245('0xa')]);router[_0xe245('0x9')](_0xe245('0xb'),auth[_0xe245('0xc')](),controller[_0xe245('0xd')]);router[_0xe245('0x9')](_0xe245('0xe'),auth['isAuthenticated'](),controller[_0xe245('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe245('0x10')]);router[_0xe245('0x11')](_0xe245('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xe245('0xc')](),controller[_0xe245('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 86aabed..faf8966 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 _0x0f80=['quarters','months','weeks','days','hours','minutes','ENUM','csv','pdf','custom','default','TEXT','exports','STRING','BOOLEAN','DATE','INTEGER','years'];(function(_0x2f0d27,_0x13b905){var _0x2bfd1f=function(_0x3e3cfe){while(--_0x3e3cfe){_0x2f0d27['push'](_0x2f0d27['shift']());}};_0x2bfd1f(++_0x13b905);}(_0x0f80,0x108));var _0x00f8=function(_0x130f9d,_0xbf09a1){_0x130f9d=_0x130f9d-0x0;var _0x361385=_0x0f80[_0x130f9d];return _0x361385;};'use strict';var Sequelize=require('sequelize');module[_0x00f8('0x0')]={'name':{'type':Sequelize[_0x00f8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x00f8('0x1')]},'active':{'type':Sequelize[_0x00f8('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x00f8('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x00f8('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x00f8('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x00f8('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x00f8('0x5'),_0x00f8('0x6'),_0x00f8('0x7'),_0x00f8('0x8'),_0x00f8('0x9'),_0x00f8('0xa'),_0x00f8('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x00f8('0xc')](_0x00f8('0xd'),_0x00f8('0xe'),'xlsx'),'allowNull':![],'defaultValue':_0x00f8('0xd')},'type':{'type':Sequelize[_0x00f8('0xc')](_0x00f8('0xf'),_0x00f8('0x10')),'allowNull':![],'defaultValue':_0x00f8('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x00f8('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xd819=['minutes','csv','pdf','xlsx','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','weeks','days','hours'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0xd819,0x181));var _0x9d81=function(_0x55c937,_0x4136f7){_0x55c937=_0x55c937-0x0;var _0xc45fad=_0xd819[_0x55c937];return _0xc45fad;};'use strict';var Sequelize=require('sequelize');module[_0x9d81('0x0')]={'name':{'type':Sequelize[_0x9d81('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9d81('0x1')]},'active':{'type':Sequelize[_0x9d81('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9d81('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x9d81('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9d81('0x5')](_0x9d81('0x6'),_0x9d81('0x7'),'months',_0x9d81('0x8'),_0x9d81('0x9'),_0x9d81('0xa'),_0x9d81('0xb')),'allowNull':![],'defaultValue':_0x9d81('0x9')},'output':{'type':Sequelize[_0x9d81('0x5')](_0x9d81('0xc'),_0x9d81('0xd'),_0x9d81('0xe')),'allowNull':![],'defaultValue':_0x9d81('0xc')},'type':{'type':Sequelize[_0x9d81('0x5')](_0x9d81('0xf'),_0x9d81('0x10')),'allowNull':![],'defaultValue':_0x9d81('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x9d81('0x1')]},'cc':{'type':Sequelize[_0x9d81('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x9d81('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 8ff6249..269a004 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 _0x332f=['name','send','index','map','Schedule','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','autoAssociation','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error'];(function(_0x48ab04,_0x160f27){var _0x1904e4=function(_0x8bacd9){while(--_0x8bacd9){_0x48ab04['push'](_0x48ab04['shift']());}};_0x1904e4(++_0x160f27);}(_0x332f,0x1da));var _0xf332=function(_0x33f3e7,_0x57d963){_0x33f3e7=_0x33f3e7-0x0;var _0x5a9d31=_0x332f[_0x33f3e7];return _0x5a9d31;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf332('0x0'));var rimraf=require(_0xf332('0x1'));var zipdir=require(_0xf332('0x2'));var jsonpatch=require(_0xf332('0x3'));var rp=require(_0xf332('0x4'));var moment=require(_0xf332('0x5'));var BPromise=require(_0xf332('0x6'));var Mustache=require(_0xf332('0x7'));var util=require(_0xf332('0x8'));var path=require(_0xf332('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf332('0xa'));var squel=require(_0xf332('0xb'));var crypto=require(_0xf332('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf332('0xd'));var toCsv=require(_0xf332('0xe'));var querystring=require(_0xf332('0xf'));var Papa=require(_0xf332('0x10'));var Redis=require(_0xf332('0x11'));var authService=require(_0xf332('0x12'));var qs=require(_0xf332('0x13'));var as=require(_0xf332('0x14'));var hardwareService=require(_0xf332('0x15'));var logger=require(_0xf332('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf332('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf332('0x18'))['db'];function respondWithStatusCode(_0x4fc738,_0x236724){_0x236724=_0x236724||0xcc;return function(_0x1faad1){if(_0x1faad1){return _0x4fc738[_0xf332('0x19')](_0x236724);}return _0x4fc738[_0xf332('0x1a')](_0x236724)[_0xf332('0x1b')]();};}function respondWithResult(_0x30fa1a,_0x2a1291){_0x2a1291=_0x2a1291||0xc8;return function(_0x48365a){if(_0x48365a){return _0x30fa1a[_0xf332('0x1a')](_0x2a1291)[_0xf332('0x1c')](_0x48365a);}};}function respondWithFilteredResult(_0x2c6984,_0x1a0fdd){return function(_0x3f8a4f){if(_0x3f8a4f){var _0x4a1675=_0x3f8a4f['count'],_0x218be4=_0x1a0fdd[_0xf332('0x1d')],_0x20329b=_0x1a0fdd[_0xf332('0x1d')]+_0x1a0fdd[_0xf332('0x1e')],_0x24e270;if(_0x20329b>=_0x4a1675){_0x20329b=_0x4a1675;_0x24e270=0xc8;}else{_0x24e270=0xce;}_0x2c6984[_0xf332('0x1a')](_0x24e270);return _0x2c6984[_0xf332('0x1f')](_0xf332('0x20'),_0x218be4+'-'+_0x20329b+'/'+_0x4a1675)[_0xf332('0x1c')](_0x3f8a4f);}return null;};}function patchUpdates(_0x54d105){return function(_0x5eafa3){try{jsonpatch[_0xf332('0x21')](_0x5eafa3,_0x54d105,!![]);}catch(_0x1f6bee){return BPromise[_0xf332('0x22')](_0x1f6bee);}return _0x5eafa3[_0xf332('0x23')]();};}function saveUpdates(_0x4b719f,_0x223a19){return function(_0x541785){if(_0x541785){return _0x541785[_0xf332('0x24')](_0x4b719f)[_0xf332('0x25')](function(_0x1f1b43){return _0x1f1b43;});}return null;};}function removeEntity(_0x2e5e54,_0x3fcc8c){return function(_0x38f898){if(_0x38f898){return _0x38f898[_0xf332('0x26')]()[_0xf332('0x25')](function(){var _0x480964=_0x38f898[_0xf332('0x27')]({'plain':!![]});var _0xbc4207='Scheduler';return db[_0xf332('0x28')][_0xf332('0x26')]({'where':{'type':_0xbc4207,'resourceId':_0x480964['id']}})[_0xf332('0x25')](function(){return _0x38f898;});})[_0xf332('0x25')](function(){_0x2e5e54[_0xf332('0x1a')](0xcc)[_0xf332('0x1b')]();});}};}function handleEntityNotFound(_0x48cf28,_0x1f187d){return function(_0x5e6332){if(!_0x5e6332){_0x48cf28[_0xf332('0x19')](0x194);}return _0x5e6332;};}function handleError(_0x357fdc,_0x3931e9){_0x3931e9=_0x3931e9||0x1f4;return function(_0x2c3720){logger[_0xf332('0x29')](_0x2c3720['stack']);if(_0x2c3720[_0xf332('0x2a')]){delete _0x2c3720[_0xf332('0x2a')];}_0x357fdc[_0xf332('0x1a')](_0x3931e9)[_0xf332('0x2b')](_0x2c3720);};}exports[_0xf332('0x2c')]=function(_0x1d019a,_0x102cb0){var _0x2b6c67={},_0x42d4f6={},_0x3f8be2={'count':0x0,'rows':[]};var _0x28b773=_[_0xf332('0x2d')](db[_0xf332('0x2e')]['rawAttributes'],function(_0x327d44){return{'name':_0x327d44[_0xf332('0x2f')],'type':_0x327d44['type'][_0xf332('0x30')]};});_0x42d4f6[_0xf332('0x31')]=_[_0xf332('0x2d')](_0x28b773,'name');_0x42d4f6[_0xf332('0x32')]=_['keys'](_0x1d019a[_0xf332('0x32')]);_0x42d4f6[_0xf332('0x33')]=_['intersection'](_0x42d4f6[_0xf332('0x31')],_0x42d4f6['query']);_0x2b6c67['attributes']=_[_0xf332('0x34')](_0x42d4f6[_0xf332('0x31')],qs[_0xf332('0x35')](_0x1d019a[_0xf332('0x32')][_0xf332('0x35')]));_0x2b6c67[_0xf332('0x36')]=_0x2b6c67[_0xf332('0x36')][_0xf332('0x37')]?_0x2b6c67[_0xf332('0x36')]:_0x42d4f6[_0xf332('0x31')];if(!_0x1d019a[_0xf332('0x32')][_0xf332('0x38')]('nolimit')){_0x2b6c67[_0xf332('0x1e')]=qs['limit'](_0x1d019a[_0xf332('0x32')][_0xf332('0x1e')]);_0x2b6c67['offset']=qs['offset'](_0x1d019a[_0xf332('0x32')][_0xf332('0x1d')]);}_0x2b6c67[_0xf332('0x39')]=qs[_0xf332('0x3a')](_0x1d019a[_0xf332('0x32')]['sort']);_0x2b6c67[_0xf332('0x3b')]=qs[_0xf332('0x33')](_[_0xf332('0x3c')](_0x1d019a[_0xf332('0x32')],_0x42d4f6[_0xf332('0x33')]),_0x28b773);if(_0x1d019a[_0xf332('0x32')][_0xf332('0x3d')]){_0x2b6c67[_0xf332('0x3b')]=_[_0xf332('0x3e')](_0x2b6c67[_0xf332('0x3b')],{'$or':_['map'](_0x28b773,function(_0x687f95){if(_0x687f95[_0xf332('0x3f')]!==_0xf332('0x40')){var _0x2fb401={};_0x2fb401[_0x687f95['name']]={'$like':'%'+_0x1d019a[_0xf332('0x32')][_0xf332('0x3d')]+'%'};return _0x2fb401;}})});}_0x2b6c67=_[_0xf332('0x3e')]({},_0x2b6c67,_0x1d019a['options']);var _0x470c14={'where':_0x2b6c67['where']};return db[_0xf332('0x2e')][_0xf332('0x41')](_0x470c14)['then'](function(_0x44b24c){_0x3f8be2[_0xf332('0x41')]=_0x44b24c;if(_0x1d019a[_0xf332('0x32')][_0xf332('0x42')]){_0x2b6c67[_0xf332('0x43')]=[{'all':!![]}];}return db[_0xf332('0x2e')][_0xf332('0x44')](_0x2b6c67);})[_0xf332('0x25')](function(_0x3994f2){_0x3f8be2[_0xf332('0x45')]=_0x3994f2;return _0x3f8be2;})[_0xf332('0x25')](respondWithFilteredResult(_0x102cb0,_0x2b6c67))[_0xf332('0x46')](handleError(_0x102cb0,null));};exports[_0xf332('0x47')]=function(_0x4ee78b,_0x4f1411){var _0x17475e={'raw':![],'where':{'id':_0x4ee78b[_0xf332('0x48')]['id']}},_0x315280={};_0x315280[_0xf332('0x31')]=_[_0xf332('0x49')](db[_0xf332('0x2e')][_0xf332('0x4a')]);_0x315280['query']=_[_0xf332('0x49')](_0x4ee78b[_0xf332('0x32')]);_0x315280[_0xf332('0x33')]=_[_0xf332('0x34')](_0x315280['model'],_0x315280[_0xf332('0x32')]);_0x17475e[_0xf332('0x36')]=_[_0xf332('0x34')](_0x315280[_0xf332('0x31')],qs[_0xf332('0x35')](_0x4ee78b[_0xf332('0x32')]['fields']));_0x17475e[_0xf332('0x36')]=_0x17475e[_0xf332('0x36')][_0xf332('0x37')]?_0x17475e[_0xf332('0x36')]:_0x315280['model'];if(_0x4ee78b[_0xf332('0x32')][_0xf332('0x42')]){_0x17475e[_0xf332('0x43')]=[{'all':!![]}];}_0x17475e=_[_0xf332('0x3e')]({},_0x17475e,_0x4ee78b[_0xf332('0x4b')]);return db['Schedule'][_0xf332('0x4c')](_0x17475e)[_0xf332('0x25')](handleEntityNotFound(_0x4f1411,null))[_0xf332('0x25')](respondWithResult(_0x4f1411,null))[_0xf332('0x46')](handleError(_0x4f1411,null));};exports['create']=function(_0xad2158,_0x213b46){return db[_0xf332('0x2e')][_0xf332('0x4d')](_0xad2158[_0xf332('0x4e')],{})[_0xf332('0x25')](function(_0x23b2ff){var _0x2d1afb=_0xad2158[_0xf332('0x4f')][_0xf332('0x27')]({'plain':!![]});if(!_0x2d1afb)throw new Error(_0xf332('0x50'));if(_0x2d1afb[_0xf332('0x51')]==='user'){var _0x3495c1=_0x23b2ff[_0xf332('0x27')]({'plain':!![]});var _0x525249=_0xf332('0x52');return db['UserProfileSection'][_0xf332('0x4c')]({'where':{'name':_0x525249,'userProfileId':_0x2d1afb['userProfileId']},'raw':!![]})[_0xf332('0x25')](function(_0x31c86f){if(_0x31c86f&&_0x31c86f[_0xf332('0x53')]===0x0){return db[_0xf332('0x28')][_0xf332('0x4d')]({'name':_0x3495c1[_0xf332('0x2a')],'resourceId':_0x3495c1['id'],'type':_0x31c86f[_0xf332('0x2a')],'sectionId':_0x31c86f['id']},{})[_0xf332('0x25')](function(){return _0x23b2ff;});}else{return _0x23b2ff;}})['catch'](function(_0x32ac0d){logger[_0xf332('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32ac0d);throw _0x32ac0d;});}return _0x23b2ff;})[_0xf332('0x25')](respondWithResult(_0x213b46,0xc9))['catch'](handleError(_0x213b46,null));};exports[_0xf332('0x24')]=function(_0x372d0f,_0x360355){if(_0x372d0f[_0xf332('0x4e')]['id']){delete _0x372d0f[_0xf332('0x4e')]['id'];}return db[_0xf332('0x2e')]['find']({'where':{'id':_0x372d0f[_0xf332('0x48')]['id']}})[_0xf332('0x25')](handleEntityNotFound(_0x360355,null))[_0xf332('0x25')](saveUpdates(_0x372d0f['body'],null))[_0xf332('0x25')](respondWithResult(_0x360355,null))[_0xf332('0x46')](handleError(_0x360355,null));};exports[_0xf332('0x26')]=function(_0x48e69a,_0x5711d2){return db['Schedule'][_0xf332('0x4c')]({'where':{'id':_0x48e69a['params']['id']}})[_0xf332('0x25')](handleEntityNotFound(_0x5711d2,null))[_0xf332('0x25')](removeEntity(_0x5711d2,null))[_0xf332('0x46')](handleError(_0x5711d2,null));};exports[_0xf332('0x54')]=function(_0x5099da,_0x15964d,_0x3ccf81){var _0x29843e=require(_0xf332('0x55'));return db[_0xf332('0x2e')][_0xf332('0x4c')]({'where':{'id':_0x5099da[_0xf332('0x48')]['id']},'raw':!![]})[_0xf332('0x25')](handleEntityNotFound(_0x15964d,null))[_0xf332('0x25')](function(){_0x29843e[_0xf332('0x54')](_0x5099da['params']['id']);})[_0xf332('0x25')](respondWithStatusCode(_0x15964d,null))[_0xf332('0x46')](handleError(_0x15964d,null));}; \ No newline at end of file +var _0x19fa=['fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','find','catch','create','body','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','Scheduler','UserProfileResource','end','error','stack','name','send','index','Schedule','rawAttributes'];(function(_0x4a9beb,_0x159482){var _0x2d4c58=function(_0x28dabf){while(--_0x28dabf){_0x4a9beb['push'](_0x4a9beb['shift']());}};_0x2d4c58(++_0x159482);}(_0x19fa,0x119));var _0xa19f=function(_0x19bdfc,_0x4c0f31){_0x19bdfc=_0x19bdfc-0x0;var _0x5bf953=_0x19fa[_0x19bdfc];return _0x5bf953;};'use strict';var pdf=require(_0xa19f('0x0'));var emlformat=require(_0xa19f('0x1'));var rimraf=require(_0xa19f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa19f('0x3'));var rp=require(_0xa19f('0x4'));var moment=require(_0xa19f('0x5'));var BPromise=require(_0xa19f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa19f('0x7'));var sox=require('sox');var csv=require(_0xa19f('0x8'));var ejs=require(_0xa19f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa19f('0xa'));var crypto=require(_0xa19f('0xb'));var jsforce=require(_0xa19f('0xc'));var deskjs=require(_0xa19f('0xd'));var toCsv=require(_0xa19f('0x8'));var querystring=require(_0xa19f('0xe'));var Papa=require('papaparse');var Redis=require(_0xa19f('0xf'));var authService=require(_0xa19f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa19f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa19f('0x12'))(_0xa19f('0x13'));var utils=require(_0xa19f('0x14'));var config=require(_0xa19f('0x15'));var licenseUtil=require(_0xa19f('0x16'));var db=require(_0xa19f('0x17'))['db'];function respondWithStatusCode(_0x391c4e,_0x4124d3){_0x4124d3=_0x4124d3||0xcc;return function(_0x5a83eb){if(_0x5a83eb){return _0x391c4e[_0xa19f('0x18')](_0x4124d3);}return _0x391c4e[_0xa19f('0x19')](_0x4124d3)['end']();};}function respondWithResult(_0x1f3850,_0x9499a1){_0x9499a1=_0x9499a1||0xc8;return function(_0x1a59f0){if(_0x1a59f0){return _0x1f3850[_0xa19f('0x19')](_0x9499a1)[_0xa19f('0x1a')](_0x1a59f0);}};}function respondWithFilteredResult(_0x5cf9f3,_0x5caf3d){return function(_0x5bf0c5){if(_0x5bf0c5){var _0x38706e=_0x5bf0c5[_0xa19f('0x1b')],_0x1a7c42=_0x5caf3d[_0xa19f('0x1c')],_0x3f56da=_0x5caf3d[_0xa19f('0x1c')]+_0x5caf3d[_0xa19f('0x1d')],_0x18a7a2;if(_0x3f56da>=_0x38706e){_0x3f56da=_0x38706e;_0x18a7a2=0xc8;}else{_0x18a7a2=0xce;}_0x5cf9f3[_0xa19f('0x19')](_0x18a7a2);return _0x5cf9f3[_0xa19f('0x1e')](_0xa19f('0x1f'),_0x1a7c42+'-'+_0x3f56da+'/'+_0x38706e)[_0xa19f('0x1a')](_0x5bf0c5);}return null;};}function patchUpdates(_0x2b33c9){return function(_0x55173c){try{jsonpatch['apply'](_0x55173c,_0x2b33c9,!![]);}catch(_0x224e36){return BPromise[_0xa19f('0x20')](_0x224e36);}return _0x55173c[_0xa19f('0x21')]();};}function saveUpdates(_0x4a5b9b,_0x564b9a){return function(_0x5f36d9){if(_0x5f36d9){return _0x5f36d9[_0xa19f('0x22')](_0x4a5b9b)[_0xa19f('0x23')](function(_0x146224){return _0x146224;});}return null;};}function removeEntity(_0x2d6886,_0x537762){return function(_0x234af2){if(_0x234af2){return _0x234af2[_0xa19f('0x24')]()[_0xa19f('0x23')](function(){var _0x19508a=_0x234af2['get']({'plain':!![]});var _0x184fb6=_0xa19f('0x25');return db[_0xa19f('0x26')][_0xa19f('0x24')]({'where':{'type':_0x184fb6,'resourceId':_0x19508a['id']}})[_0xa19f('0x23')](function(){return _0x234af2;});})[_0xa19f('0x23')](function(){_0x2d6886[_0xa19f('0x19')](0xcc)[_0xa19f('0x27')]();});}};}function handleEntityNotFound(_0x4789c3,_0x550dc9){return function(_0x56e9e9){if(!_0x56e9e9){_0x4789c3[_0xa19f('0x18')](0x194);}return _0x56e9e9;};}function handleError(_0xdc0f01,_0x5bafdb){_0x5bafdb=_0x5bafdb||0x1f4;return function(_0x25c375){logger[_0xa19f('0x28')](_0x25c375[_0xa19f('0x29')]);if(_0x25c375[_0xa19f('0x2a')]){delete _0x25c375[_0xa19f('0x2a')];}_0xdc0f01[_0xa19f('0x19')](_0x5bafdb)[_0xa19f('0x2b')](_0x25c375);};}exports[_0xa19f('0x2c')]=function(_0x503c34,_0x42706e){var _0x2306c0={},_0x29847d={},_0x450f3c={'count':0x0,'rows':[]};var _0x1a0699=_['map'](db[_0xa19f('0x2d')][_0xa19f('0x2e')],function(_0x844fd1){return{'name':_0x844fd1[_0xa19f('0x2f')],'type':_0x844fd1[_0xa19f('0x30')][_0xa19f('0x31')]};});_0x29847d[_0xa19f('0x32')]=_['map'](_0x1a0699,_0xa19f('0x2a'));_0x29847d['query']=_[_0xa19f('0x33')](_0x503c34[_0xa19f('0x34')]);_0x29847d[_0xa19f('0x35')]=_[_0xa19f('0x36')](_0x29847d[_0xa19f('0x32')],_0x29847d[_0xa19f('0x34')]);_0x2306c0[_0xa19f('0x37')]=_[_0xa19f('0x36')](_0x29847d[_0xa19f('0x32')],qs[_0xa19f('0x38')](_0x503c34[_0xa19f('0x34')][_0xa19f('0x38')]));_0x2306c0['attributes']=_0x2306c0['attributes'][_0xa19f('0x39')]?_0x2306c0[_0xa19f('0x37')]:_0x29847d[_0xa19f('0x32')];if(!_0x503c34['query'][_0xa19f('0x3a')]('nolimit')){_0x2306c0[_0xa19f('0x1d')]=qs['limit'](_0x503c34[_0xa19f('0x34')][_0xa19f('0x1d')]);_0x2306c0['offset']=qs[_0xa19f('0x1c')](_0x503c34[_0xa19f('0x34')][_0xa19f('0x1c')]);}_0x2306c0[_0xa19f('0x3b')]=qs[_0xa19f('0x3c')](_0x503c34[_0xa19f('0x34')][_0xa19f('0x3c')]);_0x2306c0[_0xa19f('0x3d')]=qs['filters'](_[_0xa19f('0x3e')](_0x503c34[_0xa19f('0x34')],_0x29847d[_0xa19f('0x35')]),_0x1a0699);if(_0x503c34['query'][_0xa19f('0x3f')]){_0x2306c0[_0xa19f('0x3d')]=_['merge'](_0x2306c0['where'],{'$or':_['map'](_0x1a0699,function(_0x438b4d){if(_0x438b4d['type']!==_0xa19f('0x40')){var _0x34edc7={};_0x34edc7[_0x438b4d['name']]={'$like':'%'+_0x503c34['query'][_0xa19f('0x3f')]+'%'};return _0x34edc7;}})});}_0x2306c0=_[_0xa19f('0x41')]({},_0x2306c0,_0x503c34[_0xa19f('0x42')]);var _0x27d999={'where':_0x2306c0[_0xa19f('0x3d')]};return db[_0xa19f('0x2d')]['count'](_0x27d999)[_0xa19f('0x23')](function(_0x580b87){_0x450f3c['count']=_0x580b87;if(_0x503c34[_0xa19f('0x34')]['includeAll']){_0x2306c0[_0xa19f('0x43')]=[{'all':!![]}];}return db[_0xa19f('0x2d')][_0xa19f('0x44')](_0x2306c0);})[_0xa19f('0x23')](function(_0x17a4d8){_0x450f3c[_0xa19f('0x45')]=_0x17a4d8;return _0x450f3c;})[_0xa19f('0x23')](respondWithFilteredResult(_0x42706e,_0x2306c0))['catch'](handleError(_0x42706e,null));};exports[_0xa19f('0x46')]=function(_0x5f6542,_0x57f76d){var _0x409566={'raw':![],'where':{'id':_0x5f6542['params']['id']}},_0x1ca8f0={};_0x1ca8f0[_0xa19f('0x32')]=_[_0xa19f('0x33')](db['Schedule'][_0xa19f('0x2e')]);_0x1ca8f0[_0xa19f('0x34')]=_[_0xa19f('0x33')](_0x5f6542[_0xa19f('0x34')]);_0x1ca8f0['filters']=_[_0xa19f('0x36')](_0x1ca8f0[_0xa19f('0x32')],_0x1ca8f0[_0xa19f('0x34')]);_0x409566[_0xa19f('0x37')]=_[_0xa19f('0x36')](_0x1ca8f0[_0xa19f('0x32')],qs[_0xa19f('0x38')](_0x5f6542['query'][_0xa19f('0x38')]));_0x409566[_0xa19f('0x37')]=_0x409566['attributes']['length']?_0x409566['attributes']:_0x1ca8f0[_0xa19f('0x32')];if(_0x5f6542[_0xa19f('0x34')]['includeAll']){_0x409566[_0xa19f('0x43')]=[{'all':!![]}];}_0x409566=_['merge']({},_0x409566,_0x5f6542[_0xa19f('0x42')]);return db[_0xa19f('0x2d')][_0xa19f('0x47')](_0x409566)[_0xa19f('0x23')](handleEntityNotFound(_0x57f76d,null))['then'](respondWithResult(_0x57f76d,null))[_0xa19f('0x48')](handleError(_0x57f76d,null));};exports[_0xa19f('0x49')]=function(_0x54b8fe,_0x181f01){return db[_0xa19f('0x2d')]['create'](_0x54b8fe[_0xa19f('0x4a')],{})[_0xa19f('0x23')](function(_0x47afd9){var _0xd115b5=_0x54b8fe[_0xa19f('0x4b')][_0xa19f('0x4c')]({'plain':!![]});if(!_0xd115b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd115b5['role']===_0xa19f('0x4b')){var _0x45ef6f=_0x47afd9[_0xa19f('0x4c')]({'plain':!![]});var _0x53547c='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x53547c,'userProfileId':_0xd115b5[_0xa19f('0x4d')]},'raw':!![]})[_0xa19f('0x23')](function(_0x4332f6){if(_0x4332f6&&_0x4332f6[_0xa19f('0x4e')]===0x0){return db[_0xa19f('0x26')][_0xa19f('0x49')]({'name':_0x45ef6f[_0xa19f('0x2a')],'resourceId':_0x45ef6f['id'],'type':_0x4332f6[_0xa19f('0x2a')],'sectionId':_0x4332f6['id']},{})[_0xa19f('0x23')](function(){return _0x47afd9;});}else{return _0x47afd9;}})[_0xa19f('0x48')](function(_0x45ac35){logger[_0xa19f('0x28')](_0xa19f('0x4f'),_0x45ac35);throw _0x45ac35;});}return _0x47afd9;})[_0xa19f('0x23')](respondWithResult(_0x181f01,0xc9))[_0xa19f('0x48')](handleError(_0x181f01,null));};exports[_0xa19f('0x22')]=function(_0x547a06,_0x219a76){if(_0x547a06['body']['id']){delete _0x547a06[_0xa19f('0x4a')]['id'];}return db[_0xa19f('0x2d')][_0xa19f('0x47')]({'where':{'id':_0x547a06[_0xa19f('0x50')]['id']}})['then'](handleEntityNotFound(_0x219a76,null))[_0xa19f('0x23')](saveUpdates(_0x547a06[_0xa19f('0x4a')],null))[_0xa19f('0x23')](respondWithResult(_0x219a76,null))['catch'](handleError(_0x219a76,null));};exports[_0xa19f('0x24')]=function(_0x3e4e54,_0x3b4137){return db[_0xa19f('0x2d')][_0xa19f('0x47')]({'where':{'id':_0x3e4e54[_0xa19f('0x50')]['id']}})[_0xa19f('0x23')](handleEntityNotFound(_0x3b4137,null))[_0xa19f('0x23')](removeEntity(_0x3b4137,null))['catch'](handleError(_0x3b4137,null));};exports['run']=function(_0x5b6675,_0x44029b,_0x292d3d){var _0x3b212f=require('../../config/schedule');return db['Schedule'][_0xa19f('0x47')]({'where':{'id':_0x5b6675[_0xa19f('0x50')]['id']},'raw':!![]})[_0xa19f('0x23')](handleEntityNotFound(_0x44029b,null))[_0xa19f('0x23')](function(){_0x3b212f[_0xa19f('0x51')](_0x5b6675[_0xa19f('0x50')]['id']);})[_0xa19f('0x23')](respondWithStatusCode(_0x44029b,null))[_0xa19f('0x48')](handleError(_0x44029b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 54ce8b1..3357916 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 _0x7221=['bluebird','request-promise','path','rimraf','../../config/environment','tools_schedules','lodash','../../config/logger','api','moment'];(function(_0x2eb97e,_0x28342f){var _0x14b474=function(_0x16fee9){while(--_0x16fee9){_0x2eb97e['push'](_0x2eb97e['shift']());}};_0x14b474(++_0x28342f);}(_0x7221,0xb0));var _0x1722=function(_0x4d1c45,_0x6ff874){_0x4d1c45=_0x4d1c45-0x0;var _0x44775c=_0x7221[_0x4d1c45];return _0x44775c;};'use strict';var _=require(_0x1722('0x0'));var util=require('util');var logger=require(_0x1722('0x1'))(_0x1722('0x2'));var moment=require(_0x1722('0x3'));var BPromise=require(_0x1722('0x4'));var rp=require(_0x1722('0x5'));var fs=require('fs');var path=require(_0x1722('0x6'));var rimraf=require(_0x1722('0x7'));var config=require(_0x1722('0x8'));var attributes=require('./schedule.attributes');module['exports']=function(_0x3a7398,_0x1e6702){return _0x3a7398['define']('Schedule',attributes,{'tableName':_0x1722('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6db=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3ec76f,_0x28485){var _0x2ba0ab=function(_0x390149){while(--_0x390149){_0x3ec76f['push'](_0x3ec76f['shift']());}};_0x2ba0ab(++_0x28485);}(_0xd6db,0x111));var _0xbd6d=function(_0x494d31,_0xc614d1){_0x494d31=_0x494d31-0x0;var _0x57bddf=_0xd6db[_0x494d31];return _0x57bddf;};'use strict';var _=require(_0xbd6d('0x0'));var util=require(_0xbd6d('0x1'));var logger=require(_0xbd6d('0x2'))(_0xbd6d('0x3'));var moment=require(_0xbd6d('0x4'));var BPromise=require(_0xbd6d('0x5'));var rp=require(_0xbd6d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd6d('0x7'));var config=require(_0xbd6d('0x8'));var attributes=require(_0xbd6d('0x9'));module[_0xbd6d('0xa')]=function(_0x315b70,_0x2bf5e3){return _0x315b70[_0xbd6d('0xb')](_0xbd6d('0xc'),attributes,{'tableName':_0xbd6d('0xd'),'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 1cce731..3d304d0 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 _0x1fed=['error','code','message','info','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x41920b,_0x2d534f){var _0x4294af=function(_0x25d1a3){while(--_0x25d1a3){_0x41920b['push'](_0x41920b['shift']());}};_0x4294af(++_0x2d534f);}(_0x1fed,0xcc));var _0xd1fe=function(_0x4c644c,_0x1a5d4f){_0x4c644c=_0x4c644c-0x0;var _0x18b89e=_0x1fed[_0x4c644c];return _0x18b89e;};'use strict';var _=require(_0xd1fe('0x0'));var util=require('util');var moment=require(_0xd1fe('0x1'));var BPromise=require('bluebird');var rs=require(_0xd1fe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd1fe('0x3'));var logger=require(_0xd1fe('0x4'))(_0xd1fe('0x5'));var config=require(_0xd1fe('0x6'));var jayson=require(_0xd1fe('0x7'));var client=jayson[_0xd1fe('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fae2c,_0x5616de,_0x317928){return new BPromise(function(_0x36dc19,_0xfb8d0){return client[_0xd1fe('0x9')](_0x1fae2c,_0x317928)[_0xd1fe('0xa')](function(_0x368f06){logger['info'](_0xd1fe('0xb'),_0x5616de,'request\x20sent');logger[_0xd1fe('0xc')](_0xd1fe('0xd'),_0x5616de,_0xd1fe('0xe'),JSON[_0xd1fe('0xf')](_0x368f06));if(_0x368f06[_0xd1fe('0x10')]){if(_0x368f06['error'][_0xd1fe('0x11')]===0x1f4){logger[_0xd1fe('0x10')]('Schedule,\x20%s,\x20%s',_0x5616de,_0x368f06[_0xd1fe('0x10')]['message']);return _0xfb8d0(_0x368f06[_0xd1fe('0x10')]['message']);}logger['error'](_0xd1fe('0xb'),_0x5616de,_0x368f06[_0xd1fe('0x10')]['message']);return _0x36dc19(_0x368f06[_0xd1fe('0x10')][_0xd1fe('0x12')]);}else{logger[_0xd1fe('0x13')](_0xd1fe('0xb'),_0x5616de,_0xd1fe('0xe'));_0x36dc19(_0x368f06[_0xd1fe('0x14')]['message']);}})[_0xd1fe('0x15')](function(_0x2a0c83){logger[_0xd1fe('0x10')](_0xd1fe('0xb'),_0x5616de,_0x2a0c83);_0xfb8d0(_0x2a0c83);});});} \ No newline at end of file +var _0xbdd1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Schedule,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1e4d7e,_0xf3674c){var _0x21c1c8=function(_0x25ad87){while(--_0x25ad87){_0x1e4d7e['push'](_0x1e4d7e['shift']());}};_0x21c1c8(++_0xf3674c);}(_0xbdd1,0x1bc));var _0x1bdd=function(_0x368fb2,_0x4ecb1){_0x368fb2=_0x368fb2-0x0;var _0x3b9693=_0xbdd1[_0x368fb2];return _0x3b9693;};'use strict';var _=require(_0x1bdd('0x0'));var util=require('util');var moment=require(_0x1bdd('0x1'));var BPromise=require(_0x1bdd('0x2'));var rs=require(_0x1bdd('0x3'));var fs=require('fs');var Redis=require(_0x1bdd('0x4'));var db=require(_0x1bdd('0x5'))['db'];var utils=require(_0x1bdd('0x6'));var logger=require(_0x1bdd('0x7'))(_0x1bdd('0x8'));var config=require(_0x1bdd('0x9'));var jayson=require(_0x1bdd('0xa'));var client=jayson[_0x1bdd('0xb')][_0x1bdd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x106547,_0x29d945,_0x5f338c){return new BPromise(function(_0x59a7de,_0xe2d9a5){return client[_0x1bdd('0xd')](_0x106547,_0x5f338c)[_0x1bdd('0xe')](function(_0x6581e3){logger[_0x1bdd('0xf')]('Schedule,\x20%s,\x20%s',_0x29d945,_0x1bdd('0x10'));logger['debug'](_0x1bdd('0x11'),_0x29d945,_0x1bdd('0x10'),JSON[_0x1bdd('0x12')](_0x6581e3));if(_0x6581e3[_0x1bdd('0x13')]){if(_0x6581e3['error'][_0x1bdd('0x14')]===0x1f4){logger[_0x1bdd('0x13')]('Schedule,\x20%s,\x20%s',_0x29d945,_0x6581e3[_0x1bdd('0x13')][_0x1bdd('0x15')]);return _0xe2d9a5(_0x6581e3[_0x1bdd('0x13')][_0x1bdd('0x15')]);}logger['error'](_0x1bdd('0x16'),_0x29d945,_0x6581e3[_0x1bdd('0x13')][_0x1bdd('0x15')]);return _0x59a7de(_0x6581e3['error']['message']);}else{logger[_0x1bdd('0xf')](_0x1bdd('0x16'),_0x29d945,_0x1bdd('0x10'));_0x59a7de(_0x6581e3[_0x1bdd('0x17')]['message']);}})[_0x1bdd('0x18')](function(_0x3e26a9){logger[_0x1bdd('0x13')](_0x1bdd('0x16'),_0x29d945,_0x3e26a9);_0xe2d9a5(_0x3e26a9);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 313732c..fdda2e3 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 _0xe25d=['/describe','describe','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','./screenRecording.controller','get','isAuthenticated'];(function(_0xb76f4e,_0x33038f){var _0x523c4c=function(_0x180378){while(--_0x180378){_0xb76f4e['push'](_0xb76f4e['shift']());}};_0x523c4c(++_0x33038f);}(_0xe25d,0x14c));var _0xde25=function(_0x3bbfc8,_0x39520d){_0x3bbfc8=_0x3bbfc8-0x0;var _0x4f8707=_0xe25d[_0x3bbfc8];return _0x4f8707;};'use strict';var multer=require(_0xde25('0x0'));var util=require(_0xde25('0x1'));var path=require(_0xde25('0x2'));var timeout=require(_0xde25('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xde25('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xde25('0x5'));router[_0xde25('0x6')]('/',auth[_0xde25('0x7')](),controller['index']);router[_0xde25('0x6')](_0xde25('0x8'),auth['isAuthenticated'](),controller[_0xde25('0x9')]);router[_0xde25('0x6')](_0xde25('0xa'),auth['isAuthenticated'](),controller[_0xde25('0xb')]);router[_0xde25('0x6')](_0xde25('0xc'),auth[_0xde25('0x7')](),controller[_0xde25('0xd')]);router[_0xde25('0xe')]('/',auth[_0xde25('0x7')](),controller[_0xde25('0xf')]);router[_0xde25('0x10')](_0xde25('0xa'),auth[_0xde25('0x7')](),controller['update']);router[_0xde25('0x11')](_0xde25('0xa'),auth[_0xde25('0x7')](),controller[_0xde25('0x12')]);module[_0xde25('0x13')]=router; \ No newline at end of file +var _0x65d3=['/:id/download','download','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2ca01b,_0x12246a){var _0x435508=function(_0x414641){while(--_0x414641){_0x2ca01b['push'](_0x2ca01b['shift']());}};_0x435508(++_0x12246a);}(_0x65d3,0x68));var _0x365d=function(_0x4d24e0,_0x7e496){_0x4d24e0=_0x4d24e0-0x0;var _0xef6fc8=_0x65d3[_0x4d24e0];return _0xef6fc8;};'use strict';var multer=require(_0x365d('0x0'));var util=require(_0x365d('0x1'));var path=require(_0x365d('0x2'));var timeout=require(_0x365d('0x3'));var express=require('express');var router=express[_0x365d('0x4')]();var auth=require(_0x365d('0x5'));var interaction=require(_0x365d('0x6'));var config=require(_0x365d('0x7'));var controller=require(_0x365d('0x8'));router[_0x365d('0x9')]('/',auth[_0x365d('0xa')](),controller[_0x365d('0xb')]);router[_0x365d('0x9')](_0x365d('0xc'),auth[_0x365d('0xa')](),controller[_0x365d('0xd')]);router[_0x365d('0x9')](_0x365d('0xe'),auth['isAuthenticated'](),controller[_0x365d('0xf')]);router['get'](_0x365d('0x10'),auth[_0x365d('0xa')](),controller[_0x365d('0x11')]);router[_0x365d('0x12')]('/',auth[_0x365d('0xa')](),controller[_0x365d('0x13')]);router[_0x365d('0x14')]('/:id',auth[_0x365d('0xa')](),controller[_0x365d('0x15')]);router['delete'](_0x365d('0xe'),auth[_0x365d('0xa')](),controller[_0x365d('0x16')]);module[_0x365d('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 0ffa203..b8280b3 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 _0xbd50=['setDataValue','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER','startedAt','subtract','closedAt'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x12cbd8,_0x8ef0ce){_0x12cbd8=_0x12cbd8-0x0;var _0x2fb1ab=_0xbd50[_0x12cbd8];return _0x2fb1ab;};'use strict';var Sequelize=require(_0x0bd5('0x0'));var moment=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var config=require('../../config/environment');module[_0x0bd5('0x3')]={'format':{'type':Sequelize[_0x0bd5('0x4')],'get':function(){return this[_0x0bd5('0x5')](_0x0bd5('0x6'))?path[_0x0bd5('0x7')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0bd5('0x8')]},'value':{'type':Sequelize[_0x0bd5('0x8')],'set':function(_0xcc6cfa){var _0x2c0db1=_0xcc6cfa[_0x0bd5('0x9')](/\\/g,'/');this['setDataValue']('value',_0x2c0db1);}},'rating':{'type':Sequelize[_0x0bd5('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0bd5('0xa')],'set':function(_0x259f4c){this['setDataValue'](_0x0bd5('0xb'),moment()[_0x0bd5('0xc')](_0x259f4c,'ms'));this['setDataValue'](_0x0bd5('0xd'),moment());this[_0x0bd5('0xe')]('duration',_0x259f4c);}},'startedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0xb')))['format'](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'closedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0xd')))[_0x0bd5('0x12')](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0x13')))['format'](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'updatedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')]('updatedAt'))[_0x0bd5('0x12')](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}}}; \ No newline at end of file +var _0x4bc3=['setDataValue','INTEGER','closedAt','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','../../config/environment','exports','getDataValue','value','extname','STRING'];(function(_0x53b0e9,_0xfc5faa){var _0x28b15d=function(_0x242fd8){while(--_0x242fd8){_0x53b0e9['push'](_0x53b0e9['shift']());}};_0x28b15d(++_0xfc5faa);}(_0x4bc3,0x16e));var _0x34bc=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4bc3[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x34bc('0x0'));var moment=require(_0x34bc('0x1'));var path=require('path');var config=require(_0x34bc('0x2'));module[_0x34bc('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x34bc('0x4')](_0x34bc('0x5'))?path[_0x34bc('0x6')](this[_0x34bc('0x4')](_0x34bc('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x34bc('0x7')]},'channel':{'type':Sequelize[_0x34bc('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x21451b){var _0x50320d=_0x21451b['replace'](/\\/g,'/');this[_0x34bc('0x8')](_0x34bc('0x5'),_0x50320d);}},'rating':{'type':Sequelize[_0x34bc('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x34bc('0x9')],'set':function(_0x409105){this[_0x34bc('0x8')]('startedAt',moment()['subtract'](_0x409105,'ms'));this[_0x34bc('0x8')](_0x34bc('0xa'),moment());this[_0x34bc('0x8')]('duration',_0x409105);}},'startedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this['getDataValue'](_0x34bc('0xc')))[_0x34bc('0xd')](_0x34bc('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this['getDataValue'](_0x34bc('0xa')))[_0x34bc('0xd')](_0x34bc('0xe'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x34bc('0x4')]('createdAt'))[_0x34bc('0xd')](_0x34bc('0xe'))[_0x34bc('0xf')]();}},'updatedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this[_0x34bc('0x4')](_0x34bc('0x10')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 2741449..36e64d4 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 _0x7571=['format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','duration','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','server/files/screen_recordings','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy'];(function(_0xecc94b,_0x197b31){var _0x288f46=function(_0x50dba6){while(--_0x50dba6){_0xecc94b['push'](_0xecc94b['shift']());}};_0x288f46(++_0x197b31);}(_0x7571,0x17c));var _0x1757=function(_0x44207d,_0x1e61aa){_0x44207d=_0x44207d-0x0;var _0x14fd11=_0x7571[_0x44207d];return _0x14fd11;};'use strict';var pdf=require(_0x1757('0x0'));var emlformat=require(_0x1757('0x1'));var rimraf=require(_0x1757('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1757('0x3'));var rp=require(_0x1757('0x4'));var moment=require('moment');var BPromise=require(_0x1757('0x5'));var Mustache=require(_0x1757('0x6'));var util=require(_0x1757('0x7'));var path=require(_0x1757('0x8'));var sox=require(_0x1757('0x9'));var csv=require(_0x1757('0xa'));var ejs=require(_0x1757('0xb'));var fs=require('fs');var _=require(_0x1757('0xc'));var squel=require(_0x1757('0xd'));var crypto=require(_0x1757('0xe'));var jsforce=require(_0x1757('0xf'));var deskjs=require(_0x1757('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1757('0x11'));var Papa=require(_0x1757('0x12'));var Redis=require(_0x1757('0x13'));var authService=require(_0x1757('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1757('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1757('0x16'))(_0x1757('0x17'));var utils=require(_0x1757('0x18'));var config=require(_0x1757('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1757('0x1a'))['db'];function respondWithStatusCode(_0x4b0948,_0x29aeeb){_0x29aeeb=_0x29aeeb||0xcc;return function(_0x3d85e1){if(_0x3d85e1){return _0x4b0948[_0x1757('0x1b')](_0x29aeeb);}return _0x4b0948[_0x1757('0x1c')](_0x29aeeb)[_0x1757('0x1d')]();};}function respondWithResult(_0x395750,_0x1c8713){_0x1c8713=_0x1c8713||0xc8;return function(_0x4ebae7){if(_0x4ebae7){return _0x395750['status'](_0x1c8713)[_0x1757('0x1e')](_0x4ebae7);}};}function respondWithFilteredResult(_0x17e818,_0x42e303){return function(_0x1e0fd2){if(_0x1e0fd2){var _0x2ce82f=_0x1e0fd2['count'],_0x5b8113=_0x42e303['offset'],_0x2e2d96=_0x42e303[_0x1757('0x1f')]+_0x42e303[_0x1757('0x20')],_0x22d576;if(_0x2e2d96>=_0x2ce82f){_0x2e2d96=_0x2ce82f;_0x22d576=0xc8;}else{_0x22d576=0xce;}_0x17e818[_0x1757('0x1c')](_0x22d576);return _0x17e818[_0x1757('0x21')](_0x1757('0x22'),_0x5b8113+'-'+_0x2e2d96+'/'+_0x2ce82f)[_0x1757('0x1e')](_0x1e0fd2);}return null;};}function patchUpdates(_0x934d79){return function(_0x52b36e){try{jsonpatch[_0x1757('0x23')](_0x52b36e,_0x934d79,!![]);}catch(_0x3c437a){return BPromise[_0x1757('0x24')](_0x3c437a);}return _0x52b36e[_0x1757('0x25')]();};}function saveUpdates(_0x5e7bb2,_0x3972a3){return function(_0x4995d0){if(_0x4995d0){return _0x4995d0['update'](_0x5e7bb2)['then'](function(_0x3a9f3a){return _0x3a9f3a;});}return null;};}function removeEntity(_0x91eb6c,_0x15b929){return function(_0x40eef3){if(_0x40eef3){return _0x40eef3[_0x1757('0x26')]()[_0x1757('0x27')](function(){_0x91eb6c['status'](0xcc)[_0x1757('0x1d')]();});}};}function handleEntityNotFound(_0x1b40ee,_0xd65559){return function(_0x186afc){if(!_0x186afc){_0x1b40ee[_0x1757('0x1b')](0x194);}return _0x186afc;};}function handleError(_0x478e1b,_0x4eb26d){_0x4eb26d=_0x4eb26d||0x1f4;return function(_0x21bc53){logger[_0x1757('0x28')](_0x21bc53[_0x1757('0x29')]);if(_0x21bc53['name']){delete _0x21bc53[_0x1757('0x2a')];}_0x478e1b[_0x1757('0x1c')](_0x4eb26d)['send'](_0x21bc53);};}exports[_0x1757('0x2b')]=function(_0x39bb88,_0x16db6a){var _0x3efb2c={},_0x3190c6={},_0x4ac471={'count':0x0,'rows':[]};var _0x115cd8=_[_0x1757('0x2c')](db[_0x1757('0x2d')][_0x1757('0x2e')],function(_0x34987f){return{'name':_0x34987f[_0x1757('0x2f')],'type':_0x34987f[_0x1757('0x30')][_0x1757('0x31')]};});_0x3190c6[_0x1757('0x32')]=_[_0x1757('0x33')](_[_0x1757('0x2c')](_0x115cd8,_0x1757('0x2a')),[_0x1757('0x34')]);_0x3190c6[_0x1757('0x35')]=_[_0x1757('0x36')](_0x39bb88[_0x1757('0x35')]);_0x3190c6[_0x1757('0x37')]=_[_0x1757('0x38')](_0x3190c6[_0x1757('0x32')],_0x3190c6['query']);_0x3efb2c[_0x1757('0x39')]=_['intersection'](_0x3190c6['model'],qs[_0x1757('0x3a')](_0x39bb88[_0x1757('0x35')]['fields']));_0x3efb2c[_0x1757('0x39')]=_0x3efb2c[_0x1757('0x39')][_0x1757('0x3b')]?_0x3efb2c[_0x1757('0x39')]:_0x3190c6[_0x1757('0x32')];if(!_0x39bb88[_0x1757('0x35')]['hasOwnProperty'](_0x1757('0x3c'))){_0x3efb2c[_0x1757('0x20')]=qs[_0x1757('0x20')](_0x39bb88['query'][_0x1757('0x20')]);_0x3efb2c[_0x1757('0x1f')]=qs[_0x1757('0x1f')](_0x39bb88[_0x1757('0x35')][_0x1757('0x1f')]);}_0x3efb2c[_0x1757('0x3d')]=qs[_0x1757('0x3e')](_0x39bb88[_0x1757('0x35')][_0x1757('0x3e')]);_0x3efb2c['where']=qs[_0x1757('0x37')](_[_0x1757('0x3f')](_0x39bb88['query'],_0x3190c6[_0x1757('0x37')]),_0x115cd8);if(_0x39bb88[_0x1757('0x35')][_0x1757('0x40')]){_0x3efb2c[_0x1757('0x41')]=_['merge'](_0x3efb2c['where'],{'$or':_['map'](_0x115cd8,function(_0x1b354f){if(_0x1b354f[_0x1757('0x30')]!==_0x1757('0x42')){var _0x5d94dd={};_0x5d94dd[_0x1b354f[_0x1757('0x2a')]]={'$like':'%'+_0x39bb88[_0x1757('0x35')]['filter']+'%'};return _0x5d94dd;}})});}_0x3efb2c=_[_0x1757('0x43')]({},_0x3efb2c,_0x39bb88['options']);var _0x76c908={'where':_0x3efb2c['where']};return db[_0x1757('0x2d')][_0x1757('0x44')](_0x76c908)[_0x1757('0x27')](function(_0x5ee262){_0x4ac471['count']=_0x5ee262;if(_0x39bb88['query'][_0x1757('0x45')]){_0x3efb2c[_0x1757('0x46')]=[{'all':!![]}];}return db['ScreenRecording'][_0x1757('0x47')](_0x3efb2c);})[_0x1757('0x27')](function(_0x1b67b6){_0x4ac471[_0x1757('0x48')]=_0x1b67b6;return _0x4ac471;})[_0x1757('0x27')](respondWithFilteredResult(_0x16db6a,_0x3efb2c))[_0x1757('0x49')](handleError(_0x16db6a,null));};exports[_0x1757('0x4a')]=function(_0x148059,_0x1fa8b4){var _0x42d3d8={'raw':![],'where':{'id':_0x148059[_0x1757('0x4b')]['id']}},_0x13fe18={};_0x13fe18[_0x1757('0x32')]=_[_0x1757('0x36')](db[_0x1757('0x2d')][_0x1757('0x2e')]);_0x13fe18['query']=_[_0x1757('0x36')](_0x148059['query']);_0x13fe18[_0x1757('0x37')]=_[_0x1757('0x38')](_0x13fe18[_0x1757('0x32')],_0x13fe18[_0x1757('0x35')]);_0x42d3d8['attributes']=_['intersection'](_0x13fe18[_0x1757('0x32')],qs[_0x1757('0x3a')](_0x148059[_0x1757('0x35')]['fields']));_0x42d3d8[_0x1757('0x39')]=_0x42d3d8['attributes']['length']?_0x42d3d8[_0x1757('0x39')]:_0x13fe18[_0x1757('0x32')];if(_0x148059[_0x1757('0x35')][_0x1757('0x45')]){_0x42d3d8['include']=[{'all':!![]}];}_0x42d3d8=_[_0x1757('0x43')]({},_0x42d3d8,_0x148059[_0x1757('0x4c')]);return db[_0x1757('0x2d')][_0x1757('0x4d')](_0x42d3d8)['then'](handleEntityNotFound(_0x1fa8b4,null))[_0x1757('0x27')](respondWithResult(_0x1fa8b4,null))['catch'](handleError(_0x1fa8b4,null));};exports[_0x1757('0x4e')]=function(_0x5d2ed5,_0x685fbe){return db[_0x1757('0x2d')][_0x1757('0x4e')](_0x5d2ed5['body'],{})['then'](respondWithResult(_0x685fbe,0xc9))['catch'](handleError(_0x685fbe,null));};exports['update']=function(_0x2993aa,_0x33f2b8){if(_0x2993aa[_0x1757('0x4f')]['id']){delete _0x2993aa[_0x1757('0x4f')]['id'];}delete _0x2993aa['body'][_0x1757('0x50')];delete _0x2993aa['body']['createdAt'];delete _0x2993aa['body'][_0x1757('0x51')];delete _0x2993aa[_0x1757('0x4f')][_0x1757('0x52')];return db[_0x1757('0x2d')][_0x1757('0x4d')]({'where':{'id':_0x2993aa['params']['id']}})[_0x1757('0x27')](handleEntityNotFound(_0x33f2b8,null))[_0x1757('0x27')](saveUpdates(_0x2993aa[_0x1757('0x4f')],null))[_0x1757('0x27')](respondWithResult(_0x33f2b8,null))[_0x1757('0x49')](handleError(_0x33f2b8,null));};exports[_0x1757('0x53')]=function(_0x5358c1,_0xc597fd){return db['ScreenRecording'][_0x1757('0x53')]()[_0x1757('0x27')](respondWithResult(_0xc597fd,null))[_0x1757('0x49')](handleError(_0xc597fd,null));};exports[_0x1757('0x54')]=function(_0x11333c,_0x1b0f64,_0x232d54){var _0x4f1142=require(_0x1757('0x55'));var _0x2a2264=![];var _0x55a6d3={};if(_0x11333c['query'][_0x1757('0x30')]&&_0x11333c['query'][_0x1757('0x30')]===_0x1757('0x56')){_0x55a6d3[_0x1757('0x56')]=_0x11333c[_0x1757('0x4b')]['id'];}else{_0x55a6d3['id']=_0x11333c['params']['id'];}return db[_0x1757('0x2d')][_0x1757('0x4d')]({'where':_0x55a6d3,'attributes':['id',_0x1757('0x52')],'raw':!![]})[_0x1757('0x27')](handleEntityNotFound(_0x1b0f64,null))[_0x1757('0x27')](function(_0x2c020b){if(_0x2c020b){var _0x517914=path[_0x1757('0x57')](config['root'],_0x1757('0x58'),_0x2c020b[_0x1757('0x52')]);var _0x5662ab=util[_0x1757('0x34')]('%s.cypher',_0x517914);if(fs['existsSync'](_0x5662ab)){_0x2a2264=!![];return _0x4f1142[_0x1757('0x59')](_0x5662ab,_0x517914,config[_0x1757('0x5a')][_0x1757('0x5b')])[_0x1757('0x27')](function(){return _0x2c020b;});}return _0x2c020b;}})[_0x1757('0x27')](function(_0x5f3825){if(_0x5f3825){var _0x36e0bd=path[_0x1757('0x57')](config[_0x1757('0x5c')],'server/files/screen_recordings',_0x5f3825[_0x1757('0x52')]);if(!fs['existsSync'](_0x36e0bd)){throw new db[(_0x1757('0x5d'))][(_0x1757('0x5e'))](_0x1757('0x5f'));}if(_0x5f3825[_0x1757('0x60')]){return _0x1b0f64[_0x1757('0x54')](_0x36e0bd,_0x5f3825[_0x1757('0x60')]+path[_0x1757('0x61')](_0x36e0bd),function(){if(_0x2a2264){fs[_0x1757('0x62')](_0x36e0bd);}});}else{return _0x1b0f64[_0x1757('0x54')](_0x36e0bd,function(_0x375554){if(_0x2a2264){fs[_0x1757('0x62')](_0x36e0bd);}});}}})['catch'](function(_0x4b4ebd){if(_0x4b4ebd[_0x1757('0x63')]==='ScreenRecording\x20not\x20found'){_0x1b0f64['status'](0x194)['send'](_0x1757('0x64'));}else{return handleError(_0x1b0f64,null);}});};exports[_0x1757('0x26')]=function(_0x5f27ee,_0x432577){return db[_0x1757('0x2d')]['find']({'where':{'id':_0x5f27ee[_0x1757('0x4b')]['id']}})[_0x1757('0x27')](function(_0x27cf12){if(!_0x27cf12)throw new ReferenceError(_0x1757('0x65'));return _0x27cf12;})[_0x1757('0x27')](function(_0x414bd4){var _0x30e3ed=path['join'](config[_0x1757('0x5c')],_0x1757('0x58'),_0x414bd4['value']);logger[_0x1757('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x30e3ed);if(!_[_0x1757('0x67')](_0x414bd4[_0x1757('0x52')])&&fs[_0x1757('0x68')](_0x30e3ed)){logger[_0x1757('0x66')](_0x1757('0x69')+_0x30e3ed+_0x1757('0x6a'));fs['unlinkSync'](_0x30e3ed);}_0x30e3ed=_0x30e3ed+'.cypher';if(!_[_0x1757('0x67')](_0x414bd4[_0x1757('0x52')])&&fs[_0x1757('0x68')](_0x30e3ed)){logger['info'](_0x1757('0x69')+_0x30e3ed+_0x1757('0x6a'));fs[_0x1757('0x6b')](_0x30e3ed);}return _0x414bd4;})['then'](function(_0x5ae875){if(!_0x5ae875)throw new InternalError();return _0x5ae875[_0x1757('0x26')]();})[_0x1757('0x27')](function(){_0x432577['status'](0xcc)[_0x1757('0x1d')]();})[_0x1757('0x49')](handleError(_0x432577,null));}; \ No newline at end of file +var _0x8720=['nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','create','body','catch','duration','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','html-pdf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x8720,0xef));var _0x0872=function(_0x18154b,_0x18db30){_0x18154b=_0x18154b-0x0;var _0x7743da=_0x8720[_0x18154b];return _0x7743da;};'use strict';var pdf=require(_0x0872('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0872('0x1'));var jsonpatch=require(_0x0872('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0872('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0872('0x4'));var sox=require(_0x0872('0x5'));var csv=require(_0x0872('0x6'));var ejs=require(_0x0872('0x7'));var fs=require('fs');var _=require(_0x0872('0x8'));var squel=require('squel');var crypto=require(_0x0872('0x9'));var jsforce=require(_0x0872('0xa'));var deskjs=require(_0x0872('0xb'));var toCsv=require(_0x0872('0x6'));var querystring=require(_0x0872('0xc'));var Papa=require(_0x0872('0xd'));var Redis=require(_0x0872('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0872('0xf'));var hardwareService=require(_0x0872('0x10'));var logger=require('../../config/logger')(_0x0872('0x11'));var utils=require(_0x0872('0x12'));var config=require(_0x0872('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0872('0x14'))['db'];function respondWithStatusCode(_0xe2ef28,_0x68fcc0){_0x68fcc0=_0x68fcc0||0xcc;return function(_0x2c0ba5){if(_0x2c0ba5){return _0xe2ef28['sendStatus'](_0x68fcc0);}return _0xe2ef28['status'](_0x68fcc0)['end']();};}function respondWithResult(_0x4650bc,_0x31095e){_0x31095e=_0x31095e||0xc8;return function(_0x39c043){if(_0x39c043){return _0x4650bc[_0x0872('0x15')](_0x31095e)[_0x0872('0x16')](_0x39c043);}};}function respondWithFilteredResult(_0xdf22e0,_0x3b5df8){return function(_0x329bd9){if(_0x329bd9){var _0x46705b=_0x329bd9[_0x0872('0x17')],_0x525d6b=_0x3b5df8[_0x0872('0x18')],_0x2ddc7f=_0x3b5df8[_0x0872('0x18')]+_0x3b5df8[_0x0872('0x19')],_0x292722;if(_0x2ddc7f>=_0x46705b){_0x2ddc7f=_0x46705b;_0x292722=0xc8;}else{_0x292722=0xce;}_0xdf22e0[_0x0872('0x15')](_0x292722);return _0xdf22e0[_0x0872('0x1a')](_0x0872('0x1b'),_0x525d6b+'-'+_0x2ddc7f+'/'+_0x46705b)[_0x0872('0x16')](_0x329bd9);}return null;};}function patchUpdates(_0x5409af){return function(_0x49bba3){try{jsonpatch[_0x0872('0x1c')](_0x49bba3,_0x5409af,!![]);}catch(_0x2ddc0c){return BPromise[_0x0872('0x1d')](_0x2ddc0c);}return _0x49bba3[_0x0872('0x1e')]();};}function saveUpdates(_0x1893ef,_0x21e3f0){return function(_0x25dd8f){if(_0x25dd8f){return _0x25dd8f[_0x0872('0x1f')](_0x1893ef)[_0x0872('0x20')](function(_0x41b668){return _0x41b668;});}return null;};}function removeEntity(_0x289f26,_0x53b06a){return function(_0x150d70){if(_0x150d70){return _0x150d70['destroy']()['then'](function(){_0x289f26[_0x0872('0x15')](0xcc)[_0x0872('0x21')]();});}};}function handleEntityNotFound(_0x4d997c,_0x2daad6){return function(_0x242f09){if(!_0x242f09){_0x4d997c['sendStatus'](0x194);}return _0x242f09;};}function handleError(_0xd0d003,_0x3ffe5e){_0x3ffe5e=_0x3ffe5e||0x1f4;return function(_0x1fe861){logger['error'](_0x1fe861['stack']);if(_0x1fe861[_0x0872('0x22')]){delete _0x1fe861[_0x0872('0x22')];}_0xd0d003[_0x0872('0x15')](_0x3ffe5e)[_0x0872('0x23')](_0x1fe861);};}exports[_0x0872('0x24')]=function(_0x43752e,_0x21f2c4){var _0xad5464={},_0x13d9e5={},_0x458fc9={'count':0x0,'rows':[]};var _0x497baa=_[_0x0872('0x25')](db[_0x0872('0x26')][_0x0872('0x27')],function(_0x389a7e){return{'name':_0x389a7e[_0x0872('0x28')],'type':_0x389a7e[_0x0872('0x29')][_0x0872('0x2a')]};});_0x13d9e5[_0x0872('0x2b')]=_[_0x0872('0x2c')](_[_0x0872('0x25')](_0x497baa,_0x0872('0x22')),[_0x0872('0x2d')]);_0x13d9e5['query']=_['keys'](_0x43752e[_0x0872('0x2e')]);_0x13d9e5[_0x0872('0x2f')]=_[_0x0872('0x30')](_0x13d9e5[_0x0872('0x2b')],_0x13d9e5['query']);_0xad5464['attributes']=_[_0x0872('0x30')](_0x13d9e5[_0x0872('0x2b')],qs[_0x0872('0x31')](_0x43752e[_0x0872('0x2e')][_0x0872('0x31')]));_0xad5464[_0x0872('0x32')]=_0xad5464[_0x0872('0x32')][_0x0872('0x33')]?_0xad5464[_0x0872('0x32')]:_0x13d9e5[_0x0872('0x2b')];if(!_0x43752e['query']['hasOwnProperty'](_0x0872('0x34'))){_0xad5464[_0x0872('0x19')]=qs[_0x0872('0x19')](_0x43752e[_0x0872('0x2e')][_0x0872('0x19')]);_0xad5464[_0x0872('0x18')]=qs[_0x0872('0x18')](_0x43752e['query'][_0x0872('0x18')]);}_0xad5464[_0x0872('0x35')]=qs['sort'](_0x43752e[_0x0872('0x2e')][_0x0872('0x36')]);_0xad5464[_0x0872('0x37')]=qs[_0x0872('0x2f')](_['pick'](_0x43752e[_0x0872('0x2e')],_0x13d9e5[_0x0872('0x2f')]),_0x497baa);if(_0x43752e[_0x0872('0x2e')][_0x0872('0x38')]){_0xad5464[_0x0872('0x37')]=_[_0x0872('0x39')](_0xad5464['where'],{'$or':_['map'](_0x497baa,function(_0x5e9192){if(_0x5e9192[_0x0872('0x29')]!==_0x0872('0x3a')){var _0x521a5e={};_0x521a5e[_0x5e9192[_0x0872('0x22')]]={'$like':'%'+_0x43752e[_0x0872('0x2e')][_0x0872('0x38')]+'%'};return _0x521a5e;}})});}_0xad5464=_[_0x0872('0x39')]({},_0xad5464,_0x43752e[_0x0872('0x3b')]);var _0x1dd975={'where':_0xad5464['where']};return db[_0x0872('0x26')]['count'](_0x1dd975)['then'](function(_0x4c0571){_0x458fc9['count']=_0x4c0571;if(_0x43752e[_0x0872('0x2e')][_0x0872('0x3c')]){_0xad5464[_0x0872('0x3d')]=[{'all':!![]}];}return db[_0x0872('0x26')]['findAll'](_0xad5464);})[_0x0872('0x20')](function(_0x17f84e){_0x458fc9[_0x0872('0x3e')]=_0x17f84e;return _0x458fc9;})[_0x0872('0x20')](respondWithFilteredResult(_0x21f2c4,_0xad5464))['catch'](handleError(_0x21f2c4,null));};exports[_0x0872('0x3f')]=function(_0x2579a0,_0x552e26){var _0x2a07de={'raw':![],'where':{'id':_0x2579a0[_0x0872('0x40')]['id']}},_0xd54723={};_0xd54723[_0x0872('0x2b')]=_[_0x0872('0x41')](db[_0x0872('0x26')]['rawAttributes']);_0xd54723[_0x0872('0x2e')]=_['keys'](_0x2579a0[_0x0872('0x2e')]);_0xd54723['filters']=_[_0x0872('0x30')](_0xd54723['model'],_0xd54723[_0x0872('0x2e')]);_0x2a07de[_0x0872('0x32')]=_[_0x0872('0x30')](_0xd54723[_0x0872('0x2b')],qs[_0x0872('0x31')](_0x2579a0['query'][_0x0872('0x31')]));_0x2a07de[_0x0872('0x32')]=_0x2a07de[_0x0872('0x32')][_0x0872('0x33')]?_0x2a07de[_0x0872('0x32')]:_0xd54723[_0x0872('0x2b')];if(_0x2579a0['query'][_0x0872('0x3c')]){_0x2a07de[_0x0872('0x3d')]=[{'all':!![]}];}_0x2a07de=_['merge']({},_0x2a07de,_0x2579a0['options']);return db[_0x0872('0x26')][_0x0872('0x42')](_0x2a07de)[_0x0872('0x20')](handleEntityNotFound(_0x552e26,null))[_0x0872('0x20')](respondWithResult(_0x552e26,null))['catch'](handleError(_0x552e26,null));};exports[_0x0872('0x43')]=function(_0x59335c,_0x3a62f0){return db[_0x0872('0x26')][_0x0872('0x43')](_0x59335c[_0x0872('0x44')],{})[_0x0872('0x20')](respondWithResult(_0x3a62f0,0xc9))[_0x0872('0x45')](handleError(_0x3a62f0,null));};exports[_0x0872('0x1f')]=function(_0x5d598a,_0x45b614){if(_0x5d598a[_0x0872('0x44')]['id']){delete _0x5d598a[_0x0872('0x44')]['id'];}delete _0x5d598a[_0x0872('0x44')][_0x0872('0x46')];delete _0x5d598a['body']['createdAt'];delete _0x5d598a[_0x0872('0x44')][_0x0872('0x47')];delete _0x5d598a['body'][_0x0872('0x48')];return db['ScreenRecording'][_0x0872('0x42')]({'where':{'id':_0x5d598a[_0x0872('0x40')]['id']}})[_0x0872('0x20')](handleEntityNotFound(_0x45b614,null))[_0x0872('0x20')](saveUpdates(_0x5d598a[_0x0872('0x44')],null))[_0x0872('0x20')](respondWithResult(_0x45b614,null))['catch'](handleError(_0x45b614,null));};exports[_0x0872('0x49')]=function(_0x4d01c3,_0x470208){return db['ScreenRecording'][_0x0872('0x49')]()[_0x0872('0x20')](respondWithResult(_0x470208,null))['catch'](handleError(_0x470208,null));};exports[_0x0872('0x4a')]=function(_0x12bec1,_0x486180,_0x5a6ef9){var _0x37f3e7=require(_0x0872('0x4b'));var _0x2a3e82=![];var _0x20ca34={};if(_0x12bec1[_0x0872('0x2e')][_0x0872('0x29')]&&_0x12bec1[_0x0872('0x2e')][_0x0872('0x29')]===_0x0872('0x4c')){_0x20ca34['uniqueid']=_0x12bec1[_0x0872('0x40')]['id'];}else{_0x20ca34['id']=_0x12bec1[_0x0872('0x40')]['id'];}return db[_0x0872('0x26')][_0x0872('0x42')]({'where':_0x20ca34,'attributes':['id',_0x0872('0x48')],'raw':!![]})[_0x0872('0x20')](handleEntityNotFound(_0x486180,null))[_0x0872('0x20')](function(_0x47417a){if(_0x47417a){var _0x9e3865=path[_0x0872('0x4d')](config[_0x0872('0x4e')],_0x0872('0x4f'),_0x47417a[_0x0872('0x48')]);var _0x120310=util[_0x0872('0x2d')](_0x0872('0x50'),_0x9e3865);if(fs[_0x0872('0x51')](_0x120310)){_0x2a3e82=!![];return _0x37f3e7['decryptFile'](_0x120310,_0x9e3865,config[_0x0872('0x52')][_0x0872('0x53')])[_0x0872('0x20')](function(){return _0x47417a;});}return _0x47417a;}})[_0x0872('0x20')](function(_0x58354b){if(_0x58354b){var _0x4ebe60=path['join'](config[_0x0872('0x4e')],_0x0872('0x4f'),_0x58354b[_0x0872('0x48')]);if(!fs[_0x0872('0x51')](_0x4ebe60)){throw new db['Sequelize'][(_0x0872('0x54'))](_0x0872('0x55'));}if(_0x58354b['filename']){return _0x486180[_0x0872('0x4a')](_0x4ebe60,_0x58354b[_0x0872('0x56')]+path['extname'](_0x4ebe60),function(){if(_0x2a3e82){fs['unlink'](_0x4ebe60);}});}else{return _0x486180[_0x0872('0x4a')](_0x4ebe60,function(_0x459068){if(_0x2a3e82){fs[_0x0872('0x57')](_0x4ebe60);}});}}})['catch'](function(_0x24be13){if(_0x24be13['message']===_0x0872('0x55')){_0x486180[_0x0872('0x15')](0x194)[_0x0872('0x23')]('Not\x20found');}else{return handleError(_0x486180,null);}});};exports[_0x0872('0x58')]=function(_0x4c876e,_0x2bcbf2){return db[_0x0872('0x26')][_0x0872('0x42')]({'where':{'id':_0x4c876e[_0x0872('0x40')]['id']}})[_0x0872('0x20')](function(_0x5248b7){if(!_0x5248b7)throw new ReferenceError(_0x0872('0x59'));return _0x5248b7;})[_0x0872('0x20')](function(_0x280294){var _0x30ff43=path[_0x0872('0x4d')](config['root'],'server/files/screen_recordings',_0x280294[_0x0872('0x48')]);logger['info'](_0x0872('0x5a'),_0x30ff43);if(!_[_0x0872('0x5b')](_0x280294[_0x0872('0x48')])&&fs[_0x0872('0x51')](_0x30ff43)){logger[_0x0872('0x5c')](_0x0872('0x5d')+_0x30ff43+_0x0872('0x5e'));fs['unlinkSync'](_0x30ff43);}_0x30ff43=_0x30ff43+_0x0872('0x5f');if(!_['isNil'](_0x280294[_0x0872('0x48')])&&fs[_0x0872('0x51')](_0x30ff43)){logger[_0x0872('0x5c')]('File:\x20\x22'+_0x30ff43+_0x0872('0x5e'));fs[_0x0872('0x60')](_0x30ff43);}return _0x280294;})['then'](function(_0x506200){if(!_0x506200)throw new InternalError();return _0x506200[_0x0872('0x58')]();})['then'](function(){_0x2bcbf2['status'](0xcc)[_0x0872('0x21')]();})['catch'](handleError(_0x2bcbf2,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 3f63901..0819a31 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 _0x7821=['util','../../config/logger','api','bluebird','request-promise','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x1ca4cc,_0x402c23){var _0x108010=function(_0x4c5082){while(--_0x4c5082){_0x1ca4cc['push'](_0x1ca4cc['shift']());}};_0x108010(++_0x402c23);}(_0x7821,0x10d));var _0x1782=function(_0x46ef1d,_0x24926){_0x46ef1d=_0x46ef1d-0x0;var _0x49ce69=_0x7821[_0x46ef1d];return _0x49ce69;};'use strict';var _=require(_0x1782('0x0'));var util=require(_0x1782('0x1'));var logger=require(_0x1782('0x2'))(_0x1782('0x3'));var moment=require('moment');var BPromise=require(_0x1782('0x4'));var rp=require(_0x1782('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1782('0x6'));module['exports']=function(_0x42c0c1,_0xcbc22f){return _0x42c0c1['define'](_0x1782('0x7'),attributes,{'tableName':_0x1782('0x8'),'paranoid':![],'indexes':[{'name':_0x1782('0x9'),'fields':[_0x1782('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb3c6=['../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4f3f23,_0x51a6e3){var _0x368749=function(_0x198fe2){while(--_0x198fe2){_0x4f3f23['push'](_0x4f3f23['shift']());}};_0x368749(++_0x51a6e3);}(_0xb3c6,0xf7));var _0x6b3c=function(_0x2c43f8,_0x261d10){_0x2c43f8=_0x2c43f8-0x0;var _0x3c0c0f=_0xb3c6[_0x2c43f8];return _0x3c0c0f;};'use strict';var _=require(_0x6b3c('0x0'));var util=require(_0x6b3c('0x1'));var logger=require('../../config/logger')(_0x6b3c('0x2'));var moment=require(_0x6b3c('0x3'));var BPromise=require(_0x6b3c('0x4'));var rp=require(_0x6b3c('0x5'));var fs=require('fs');var path=require(_0x6b3c('0x6'));var rimraf=require(_0x6b3c('0x7'));var config=require(_0x6b3c('0x8'));var attributes=require(_0x6b3c('0x9'));module[_0x6b3c('0xa')]=function(_0x1b4521,_0x4f0a2a){return _0x1b4521[_0x6b3c('0xb')](_0x6b3c('0xc'),attributes,{'tableName':_0x6b3c('0xd'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x6b3c('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 9ca92d0..896af62 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(_0x331cf3,_0x3b5745){var _0x3ae273=function(_0x1f8166){while(--_0x1f8166){_0x331cf3['push'](_0x331cf3['shift']());}};_0x3ae273(++_0x3b5745);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x13a8ff,_0x5ab8dc){var _0x41dcd8=function(_0x5d16bd){while(--_0x5d16bd){_0x13a8ff['push'](_0x13a8ff['shift']());}};_0x41dcd8(++_0x5ab8dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 aeb1f3d..ff1ac08 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 _0x96f4=['file','addLogo','logologin','addLogoLogin','preferred','addPreferred','format','favicon','addFavicon','put','isAuthenticated','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','single'];(function(_0x3a2732,_0x432bc0){var _0x380bd3=function(_0x269abe){while(--_0x269abe){_0x3a2732['push'](_0x3a2732['shift']());}};_0x380bd3(++_0x432bc0);}(_0x96f4,0x1f0));var _0x496f=function(_0x5a19fc,_0x58f9f4){_0x5a19fc=_0x5a19fc-0x0;var _0x34b413=_0x96f4[_0x5a19fc];return _0x34b413;};'use strict';var multer=require(_0x496f('0x0'));var util=require(_0x496f('0x1'));var path=require(_0x496f('0x2'));var timeout=require(_0x496f('0x3'));var express=require(_0x496f('0x4'));var router=express[_0x496f('0x5')]();var auth=require(_0x496f('0x6'));var interaction=require(_0x496f('0x7'));var config=require('../../config/environment');var controller=require(_0x496f('0x8'));router[_0x496f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/now',controller[_0x496f('0xa')]);router['get'](_0x496f('0xb'),controller[_0x496f('0xc')]);router[_0x496f('0x9')](_0x496f('0xd'),controller[_0x496f('0xe')]);router[_0x496f('0x9')](_0x496f('0xf'),controller[_0x496f('0x10')]);router[_0x496f('0x9')](_0x496f('0x11'),controller[_0x496f('0x12')]);router[_0x496f('0x9')](_0x496f('0x13'),controller[_0x496f('0x14')]);router[_0x496f('0x9')](_0x496f('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0x496f('0x16')]({'destination':function(_0x3c0316,_0x37a441,_0x23f238){_0x23f238(null,path[_0x496f('0x17')](config[_0x496f('0x18')],_0x496f('0x19')));},'filename':function(_0xd51000,_0x183e10,_0x3aa8aa){_0x3aa8aa(null,util['format'](_0x496f('0x1a'),_0x496f('0x1b'),path[_0x496f('0x1c')](_0x183e10[_0x496f('0x1d')])));}})});router[_0x496f('0x1e')](_0x496f('0xd'),upload[_0x496f('0x1f')](_0x496f('0x20')),controller[_0x496f('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3cfd8b,_0x5d9601,_0x3bda7f){_0x3bda7f(null,path[_0x496f('0x17')](config[_0x496f('0x18')],'server/files/images/logos/'));},'filename':function(_0x422d0a,_0x184e32,_0x2b6e9c){_0x2b6e9c(null,util['format']('%s%s',_0x496f('0x22'),path[_0x496f('0x1c')](_0x184e32[_0x496f('0x1d')])));}})});router[_0x496f('0x1e')](_0x496f('0xf'),upload['single'](_0x496f('0x20')),controller[_0x496f('0x23')]);var upload=multer({'storage':multer[_0x496f('0x16')]({'destination':function(_0x224251,_0x24e1ac,_0x502d62){_0x502d62(null,path[_0x496f('0x17')](config[_0x496f('0x18')],_0x496f('0x19')));},'filename':function(_0x2e794a,_0x3394f4,_0x2821d0){_0x2821d0(null,util['format'](_0x496f('0x1a'),_0x496f('0x24'),path[_0x496f('0x1c')](_0x3394f4[_0x496f('0x1d')])));}})});router[_0x496f('0x1e')]('/:id/preferred',upload['single']('file'),controller[_0x496f('0x25')]);var upload=multer({'storage':multer[_0x496f('0x16')]({'destination':function(_0x20844d,_0x57431e,_0x576da0){_0x576da0(null,path[_0x496f('0x17')](config['root'],_0x496f('0x19')));},'filename':function(_0x1bec22,_0x5b0507,_0xdfa005){_0xdfa005(null,util[_0x496f('0x26')](_0x496f('0x1a'),_0x496f('0x27'),path[_0x496f('0x1c')](_0x5b0507[_0x496f('0x1d')])));}})});router['post']('/:id/favicon',upload[_0x496f('0x1f')](_0x496f('0x20')),controller[_0x496f('0x28')]);router[_0x496f('0x29')](_0x496f('0xb'),auth[_0x496f('0x2a')](),controller[_0x496f('0x2b')]);module['exports']=router; \ No newline at end of file +var _0x27fe=['addLogoLogin','root','format','preferred','single','addPreferred','favicon','addFavicon','put','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/now','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/preferred','/:id/favicon','getFavicon','join','%s%s','logo','originalname','post','/:id/logo','file','diskStorage','server/files/images/logos/','extname'];(function(_0x5ba1ba,_0x18707d){var _0x42a266=function(_0x518684){while(--_0x518684){_0x5ba1ba['push'](_0x5ba1ba['shift']());}};_0x42a266(++_0x18707d);}(_0x27fe,0x1b6));var _0xe27f=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x27fe[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0xe27f('0x0'));var util=require(_0xe27f('0x1'));var path=require(_0xe27f('0x2'));var timeout=require(_0xe27f('0x3'));var express=require(_0xe27f('0x4'));var router=express[_0xe27f('0x5')]();var auth=require(_0xe27f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe27f('0x7'));var controller=require('./setting.controller');router[_0xe27f('0x8')]('/',auth[_0xe27f('0x9')](),controller['index']);router['get'](_0xe27f('0xa'),controller[_0xe27f('0xb')]);router[_0xe27f('0x8')](_0xe27f('0xc'),controller[_0xe27f('0xd')]);router['get']('/:id/logo',controller[_0xe27f('0xe')]);router['get'](_0xe27f('0xf'),controller[_0xe27f('0x10')]);router[_0xe27f('0x8')]('/:id/gdpr',controller['gdpr']);router[_0xe27f('0x8')](_0xe27f('0x11'),controller['getPreferred']);router[_0xe27f('0x8')](_0xe27f('0x12'),controller[_0xe27f('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5f3cf8,_0x5a9743,_0x46433a){_0x46433a(null,path[_0xe27f('0x14')](config['root'],'server/files/images/logos/'));},'filename':function(_0x915a61,_0x51f243,_0x5ceb82){_0x5ceb82(null,util['format'](_0xe27f('0x15'),_0xe27f('0x16'),path['extname'](_0x51f243[_0xe27f('0x17')])));}})});router[_0xe27f('0x18')](_0xe27f('0x19'),upload['single'](_0xe27f('0x1a')),controller['addLogo']);var upload=multer({'storage':multer[_0xe27f('0x1b')]({'destination':function(_0x53a80a,_0xd3010,_0x44e5ee){_0x44e5ee(null,path[_0xe27f('0x14')](config['root'],_0xe27f('0x1c')));},'filename':function(_0x48385d,_0x5034c2,_0x2c0395){_0x2c0395(null,util['format'](_0xe27f('0x15'),'logologin',path[_0xe27f('0x1d')](_0x5034c2['originalname'])));}})});router['post'](_0xe27f('0xf'),upload['single']('file'),controller[_0xe27f('0x1e')]);var upload=multer({'storage':multer[_0xe27f('0x1b')]({'destination':function(_0x756fd6,_0x45badb,_0x283110){_0x283110(null,path['join'](config[_0xe27f('0x1f')],_0xe27f('0x1c')));},'filename':function(_0x37e910,_0x31b22d,_0x275c33){_0x275c33(null,util[_0xe27f('0x20')](_0xe27f('0x15'),_0xe27f('0x21'),path[_0xe27f('0x1d')](_0x31b22d[_0xe27f('0x17')])));}})});router['post'](_0xe27f('0x11'),upload[_0xe27f('0x22')]('file'),controller[_0xe27f('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xffa8c5,_0x15ad19,_0x3269c5){_0x3269c5(null,path['join'](config[_0xe27f('0x1f')],_0xe27f('0x1c')));},'filename':function(_0x593738,_0x20e65b,_0x5567d9){_0x5567d9(null,util[_0xe27f('0x20')](_0xe27f('0x15'),_0xe27f('0x24'),path[_0xe27f('0x1d')](_0x20e65b[_0xe27f('0x17')])));}})});router['post'](_0xe27f('0x12'),upload[_0xe27f('0x22')](_0xe27f('0x1a')),controller[_0xe27f('0x25')]);router[_0xe27f('0x26')](_0xe27f('0xc'),auth[_0xe27f('0x9')](),controller['update']);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 b28e5cd..8188b0e 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 _0x8e6d=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize','exports','INTEGER','min_internal'];(function(_0x1f9eaf,_0x1ca183){var _0x4ef4a8=function(_0x3150c8){while(--_0x3150c8){_0x1f9eaf['push'](_0x1f9eaf['shift']());}};_0x4ef4a8(++_0x1ca183);}(_0x8e6d,0x7a));var _0xd8e6=function(_0x1238ed,_0x266dde){_0x1238ed=_0x1238ed-0x0;var _0x560a37=_0x8e6d[_0x1238ed];return _0x560a37;};'use strict';var Sequelize=require(_0xd8e6('0x0'));module[_0xd8e6('0x1')]={'min_internal':{'type':Sequelize[_0xd8e6('0x2')](0xb),'unique':_0xd8e6('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xd8e6('0x2')](0xb),'unique':_0xd8e6('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xd8e6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xd8e6('0x5')],'defaultValue':_0xd8e6('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xd8e6('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xd8e6('0x5')]},'turnusername':{'type':Sequelize[_0xd8e6('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xd8e6('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xd8e6('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xd8e6('0x5')],'defaultValue':_0xd8e6('0x8')},'enableEmailPreview':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xd8e6('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xd8e6('0x5')]},'defaultPreferred':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xd8e6('0x5')]},'defaultFavicon':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xd8e6('0x2')]},'transcribeRegion':{'type':Sequelize[_0xd8e6('0x5')]},'sentiment':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xd8e6('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd8e6('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xd8e6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd26b=['https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x1309d9,_0x350b9e){var _0x760a8e=function(_0x3fdc89){while(--_0x3fdc89){_0x1309d9['push'](_0x1309d9['shift']());}};_0x760a8e(++_0x350b9e);}(_0xd26b,0x185));var _0xbd26=function(_0x172997,_0x3b4228){_0x172997=_0x172997-0x0;var _0x138049=_0xd26b[_0x172997];return _0x138049;};'use strict';var Sequelize=require('sequelize');module[_0xbd26('0x0')]={'min_internal':{'type':Sequelize[_0xbd26('0x1')](0xb),'unique':_0xbd26('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xbd26('0x1')](0xb),'unique':_0xbd26('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xbd26('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xbd26('0x4')],'defaultValue':_0xbd26('0x5')},'logo':{'type':Sequelize[_0xbd26('0x4')]},'defaultLogo':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xbd26('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xbd26('0x4')]},'turnaddr':{'type':Sequelize[_0xbd26('0x4')]},'turnusername':{'type':Sequelize[_0xbd26('0x4')]},'turnpassword':{'type':Sequelize[_0xbd26('0x4')]},'pageTitle':{'type':Sequelize[_0xbd26('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xbd26('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xbd26('0x4')],'defaultValue':_0xbd26('0x7')},'enableEmailPreview':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xbd26('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xbd26('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xbd26('0x4')]},'defaultPreferred':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xbd26('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xbd26('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xbd26('0x4')]},'defaultFavicon':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xbd26('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xbd26('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xbd26('0x1')]},'sentimentRegion':{'type':Sequelize[_0xbd26('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xbd26('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xbd26('0x1')](0x2)[_0xbd26('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xbd26('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xbd26('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xbd26('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xbd26('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xbd26('0x1')],'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 29a0117..8438b24 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 _0xdc32=['download','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','Sequelize','gdpr','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','set','reject','save','stack','name','send','index','map','Setting','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','body','find','addLogo','file','logo','addLogoLogin','filename','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found'];(function(_0x544799,_0x592b0a){var _0x4af6bb=function(_0x59d2e2){while(--_0x59d2e2){_0x544799['push'](_0x544799['shift']());}};_0x4af6bb(++_0x592b0a);}(_0xdc32,0x1e2));var _0x2dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc32[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2dc3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2dc3('0x1'));var zipdir=require(_0x2dc3('0x2'));var jsonpatch=require(_0x2dc3('0x3'));var rp=require(_0x2dc3('0x4'));var moment=require('moment');var BPromise=require(_0x2dc3('0x5'));var Mustache=require(_0x2dc3('0x6'));var util=require(_0x2dc3('0x7'));var path=require(_0x2dc3('0x8'));var sox=require(_0x2dc3('0x9'));var csv=require(_0x2dc3('0xa'));var ejs=require(_0x2dc3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2dc3('0xc'));var crypto=require(_0x2dc3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2dc3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2dc3('0xf'));var Papa=require(_0x2dc3('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2dc3('0x11'));var as=require(_0x2dc3('0x12'));var hardwareService=require(_0x2dc3('0x13'));var logger=require(_0x2dc3('0x14'))('api');var utils=require(_0x2dc3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2dc3('0x16'));var db=require(_0x2dc3('0x17'))['db'];var jayson=require(_0x2dc3('0x18'));var client=jayson[_0x2dc3('0x19')][_0x2dc3('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x52942e,_0x3691b8,_0x1fff7f,_0x2e5410){return new BPromise(function(_0x3bac49,_0x275521){var _0x3ba008=_0x2e5410||client;return _0x3ba008['request'](_0x52942e,_0x1fff7f)[_0x2dc3('0x1b')](function(_0x45d53c){logger['info'](_0x2dc3('0x1c'),_0x3691b8,_0x2dc3('0x1d'));logger['debug'](_0x2dc3('0x1e'),_0x3691b8,_0x2dc3('0x1d'),JSON[_0x2dc3('0x1f')](_0x45d53c));if(_0x45d53c['error']){if(_0x45d53c[_0x2dc3('0x20')][_0x2dc3('0x21')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x3691b8,_0x45d53c['error'][_0x2dc3('0x22')]);return _0x275521(_0x45d53c['error'][_0x2dc3('0x22')]);}logger[_0x2dc3('0x20')]('Setting,\x20%s,\x20%s',_0x3691b8,_0x45d53c[_0x2dc3('0x20')][_0x2dc3('0x22')]);return _0x3bac49(_0x45d53c[_0x2dc3('0x20')][_0x2dc3('0x22')]);}else{logger[_0x2dc3('0x23')]('Setting,\x20%s,\x20%s',_0x3691b8,_0x2dc3('0x1d'));_0x3bac49(_0x45d53c[_0x2dc3('0x24')][_0x2dc3('0x22')]);}})['catch'](function(_0xdc51df){logger[_0x2dc3('0x20')]('Setting,\x20%s,\x20%s',_0x3691b8,_0xdc51df);_0x275521(_0xdc51df);});});}function respondWithStatusCode(_0x5df087,_0xa5327f){_0xa5327f=_0xa5327f||0xcc;return function(_0x3e788c){if(_0x3e788c){return _0x5df087[_0x2dc3('0x25')](_0xa5327f);}return _0x5df087[_0x2dc3('0x26')](_0xa5327f)[_0x2dc3('0x27')]();};}function respondWithResult(_0x1ebdab,_0x427288){_0x427288=_0x427288||0xc8;return function(_0x3b1215){if(_0x3b1215){return _0x1ebdab['status'](_0x427288)[_0x2dc3('0x28')](_0x3b1215);}};}function respondWithFilteredResult(_0xecbac8,_0x5f0909){return function(_0x331a16){if(_0x331a16){var _0x2e63b6=_0x331a16[_0x2dc3('0x29')],_0x1c8196=_0x5f0909[_0x2dc3('0x2a')],_0x4f6848=_0x5f0909[_0x2dc3('0x2a')]+_0x5f0909['limit'],_0x7de196;if(_0x4f6848>=_0x2e63b6){_0x4f6848=_0x2e63b6;_0x7de196=0xc8;}else{_0x7de196=0xce;}_0xecbac8[_0x2dc3('0x26')](_0x7de196);return _0xecbac8[_0x2dc3('0x2b')]('Content-Range',_0x1c8196+'-'+_0x4f6848+'/'+_0x2e63b6)[_0x2dc3('0x28')](_0x331a16);}return null;};}function patchUpdates(_0x3ac8fa){return function(_0x2eef5a){try{jsonpatch['apply'](_0x2eef5a,_0x3ac8fa,!![]);}catch(_0x118d11){return BPromise[_0x2dc3('0x2c')](_0x118d11);}return _0x2eef5a[_0x2dc3('0x2d')]();};}function saveUpdates(_0x4f4985,_0xe972e3){return function(_0x1c0430){if(_0x1c0430){return _0x1c0430['update'](_0x4f4985)[_0x2dc3('0x1b')](function(_0x186ce8){return _0x186ce8;});}return null;};}function removeEntity(_0x1ba27e,_0x30100c){return function(_0x3a1f25){if(_0x3a1f25){return _0x3a1f25['destroy']()[_0x2dc3('0x1b')](function(){_0x1ba27e[_0x2dc3('0x26')](0xcc)[_0x2dc3('0x27')]();});}};}function handleEntityNotFound(_0x5c6bb9,_0x124dcf){return function(_0x514e90){if(!_0x514e90){_0x5c6bb9[_0x2dc3('0x25')](0x194);}return _0x514e90;};}function handleError(_0x1f55bb,_0xa635dd){_0xa635dd=_0xa635dd||0x1f4;return function(_0x33363d){logger[_0x2dc3('0x20')](_0x33363d[_0x2dc3('0x2e')]);if(_0x33363d[_0x2dc3('0x2f')]){delete _0x33363d[_0x2dc3('0x2f')];}_0x1f55bb[_0x2dc3('0x26')](_0xa635dd)[_0x2dc3('0x30')](_0x33363d);};}exports[_0x2dc3('0x31')]=function(_0x4ec2d7,_0x4a10a8){var _0x33f438={},_0xdb2979={},_0x3dd2ac={'count':0x0,'rows':[]};var _0xee203b=_[_0x2dc3('0x32')](db[_0x2dc3('0x33')][_0x2dc3('0x34')],function(_0x182b5f){return{'name':_0x182b5f['fieldName'],'type':_0x182b5f['type']['key']};});_0xdb2979[_0x2dc3('0x35')]=_['map'](_0xee203b,_0x2dc3('0x2f'));_0xdb2979[_0x2dc3('0x36')]=_[_0x2dc3('0x37')](_0x4ec2d7[_0x2dc3('0x36')]);_0xdb2979[_0x2dc3('0x38')]=_[_0x2dc3('0x39')](_0xdb2979['model'],_0xdb2979[_0x2dc3('0x36')]);_0x33f438['attributes']=_[_0x2dc3('0x39')](_0xdb2979['model'],qs[_0x2dc3('0x3a')](_0x4ec2d7[_0x2dc3('0x36')]['fields']));_0x33f438[_0x2dc3('0x3b')]=_0x33f438['attributes'][_0x2dc3('0x3c')]?_0x33f438[_0x2dc3('0x3b')]:_0xdb2979[_0x2dc3('0x35')];if(!_0x4ec2d7['query'][_0x2dc3('0x3d')](_0x2dc3('0x3e'))){_0x33f438[_0x2dc3('0x3f')]=qs[_0x2dc3('0x3f')](_0x4ec2d7[_0x2dc3('0x36')][_0x2dc3('0x3f')]);_0x33f438[_0x2dc3('0x2a')]=qs[_0x2dc3('0x2a')](_0x4ec2d7[_0x2dc3('0x36')][_0x2dc3('0x2a')]);}_0x33f438['order']=qs[_0x2dc3('0x40')](_0x4ec2d7[_0x2dc3('0x36')][_0x2dc3('0x40')]);_0x33f438['where']=qs['filters'](_[_0x2dc3('0x41')](_0x4ec2d7[_0x2dc3('0x36')],_0xdb2979['filters']),_0xee203b);if(_0x4ec2d7[_0x2dc3('0x36')][_0x2dc3('0x42')]){_0x33f438[_0x2dc3('0x43')]=_[_0x2dc3('0x44')](_0x33f438[_0x2dc3('0x43')],{'$or':_[_0x2dc3('0x32')](_0xee203b,function(_0x468ed5){if(_0x468ed5['type']!==_0x2dc3('0x45')){var _0x7a33c2={};_0x7a33c2[_0x468ed5['name']]={'$like':'%'+_0x4ec2d7[_0x2dc3('0x36')][_0x2dc3('0x42')]+'%'};return _0x7a33c2;}})});}_0x33f438=_['merge']({},_0x33f438,_0x4ec2d7[_0x2dc3('0x46')]);var _0x40c07b={'where':_0x33f438[_0x2dc3('0x43')]};return db['Setting']['count'](_0x40c07b)['then'](function(_0x370a14){_0x3dd2ac['count']=_0x370a14;if(_0x4ec2d7[_0x2dc3('0x36')][_0x2dc3('0x47')]){_0x33f438[_0x2dc3('0x48')]=[{'all':!![]}];}return db['Setting'][_0x2dc3('0x49')](_0x33f438);})[_0x2dc3('0x1b')](function(_0x5b487c){_0x3dd2ac[_0x2dc3('0x4a')]=_0x5b487c;return _0x3dd2ac;})['then'](respondWithFilteredResult(_0x4a10a8,_0x33f438))[_0x2dc3('0x4b')](handleError(_0x4a10a8,null));};exports['show']=function(_0x5f0925,_0x4cb52b){var _0x2365f4={'raw':![],'where':{'id':_0x5f0925[_0x2dc3('0x4c')]['id']}},_0x4b98a0={};_0x4b98a0['model']=_[_0x2dc3('0x37')](db[_0x2dc3('0x33')]['rawAttributes']);_0x4b98a0[_0x2dc3('0x36')]=_['keys'](_0x5f0925[_0x2dc3('0x36')]);_0x4b98a0[_0x2dc3('0x38')]=_[_0x2dc3('0x39')](_0x4b98a0[_0x2dc3('0x35')],_0x4b98a0['query']);_0x2365f4[_0x2dc3('0x3b')]=_['intersection'](_0x4b98a0[_0x2dc3('0x35')],qs[_0x2dc3('0x3a')](_0x5f0925[_0x2dc3('0x36')]['fields']));_0x2365f4[_0x2dc3('0x3b')]=_0x2365f4[_0x2dc3('0x3b')][_0x2dc3('0x3c')]?_0x2365f4[_0x2dc3('0x3b')]:_0x4b98a0[_0x2dc3('0x35')];if(_0x5f0925[_0x2dc3('0x36')][_0x2dc3('0x47')]){_0x2365f4['include']=[{'all':!![]}];}_0x2365f4=_['merge']({},_0x2365f4,_0x5f0925['options']);return db[_0x2dc3('0x33')]['find'](_0x2365f4)['then'](handleEntityNotFound(_0x4cb52b,null))['then'](respondWithResult(_0x4cb52b,null))[_0x2dc3('0x4b')](handleError(_0x4cb52b,null));};exports['update']=function(_0x2f514f,_0x14a32d){if(_0x2f514f['body']['id']){delete _0x2f514f[_0x2dc3('0x4d')]['id'];}return db[_0x2dc3('0x33')][_0x2dc3('0x4e')]({'where':{'id':_0x2f514f[_0x2dc3('0x4c')]['id']}})[_0x2dc3('0x1b')](handleEntityNotFound(_0x14a32d,null))[_0x2dc3('0x1b')](saveUpdates(_0x2f514f[_0x2dc3('0x4d')],null))[_0x2dc3('0x1b')](respondWithResult(_0x14a32d,null))['catch'](handleError(_0x14a32d,null));};exports[_0x2dc3('0x4f')]=function(_0x457c61,_0x1b773c,_0x8b1312){if(_0x457c61[_0x2dc3('0x50')]&&_0x457c61[_0x2dc3('0x50')]['filename']){_0x457c61[_0x2dc3('0x4d')][_0x2dc3('0x51')]=_0x457c61['file']['filename'];}return db['Setting'][_0x2dc3('0x4e')]({'where':{'id':_0x457c61[_0x2dc3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b773c,null))['then'](saveUpdates(_0x457c61[_0x2dc3('0x4d')],null))[_0x2dc3('0x1b')](respondWithResult(_0x1b773c,null))[_0x2dc3('0x4b')](handleError(_0x1b773c,null));};exports[_0x2dc3('0x52')]=function(_0x1df57c,_0x497077,_0x2cf121){if(_0x1df57c[_0x2dc3('0x50')]&&_0x1df57c[_0x2dc3('0x50')][_0x2dc3('0x53')]){_0x1df57c[_0x2dc3('0x4d')][_0x2dc3('0x54')]=_0x1df57c[_0x2dc3('0x50')][_0x2dc3('0x53')];}return db['Setting'][_0x2dc3('0x4e')]({'where':{'id':_0x1df57c[_0x2dc3('0x4c')]['id']}})[_0x2dc3('0x1b')](handleEntityNotFound(_0x497077,null))[_0x2dc3('0x1b')](saveUpdates(_0x1df57c[_0x2dc3('0x4d')],null))[_0x2dc3('0x1b')](respondWithResult(_0x497077,null))['catch'](handleError(_0x497077,null));};var utilLicense=require(_0x2dc3('0x16'));exports[_0x2dc3('0x55')]=function(_0x1d0add,_0x2c54d3,_0x46a0f2){var _0x545344=_0x2dc3('0x56');var _0x335e3f={'custom':![]};return utilLicense[_0x2dc3('0x57')]()[_0x2dc3('0x1b')](function(_0x5693d2){if(_0x5693d2){_0x335e3f=_0x5693d2;}return db['Setting'][_0x2dc3('0x4e')]({'where':{'id':_0x1d0add[_0x2dc3('0x4c')]['id']},'attributes':[_0x2dc3('0x51'),'loginLogo',_0x2dc3('0x58'),_0x2dc3('0x59'),_0x2dc3('0x5a'),'defaultLoginLogo',_0x2dc3('0x5b'),_0x2dc3('0x5c')],'raw':!![]});})[_0x2dc3('0x1b')](handleEntityNotFound(_0x2c54d3,null))[_0x2dc3('0x1b')](function(_0x2f2b68){if(_0x2f2b68){var _0x1b9173=_0x2f2b68['logo']&&fs[_0x2dc3('0x5d')](path[_0x2dc3('0x5e')](config['root'],_0x545344,_[_0x2dc3('0x5f')](_0x2f2b68[_0x2dc3('0x51')])))?path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x545344,_[_0x2dc3('0x5f')](_0x2f2b68[_0x2dc3('0x51')])):path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x545344,_[_0x2dc3('0x5f')](_0x2dc3('0x61')));var _0x425fcf=_0x2dc3('0x62')+_[_0x2dc3('0x63')](_0x2dc3('0x51'));if(_0x2f2b68[_0x425fcf]||!_0x335e3f[_0x2dc3('0x64')]){_0x1b9173=path['join'](config['root'],_0x545344,_[_0x2dc3('0x5f')](_0x2dc3('0x61')));}if(!fs[_0x2dc3('0x5d')](_0x1b9173)){throw new db['Sequelize'][(_0x2dc3('0x65'))](_['upperFirst']('logo')+_0x2dc3('0x66'));}return _0x2c54d3[_0x2dc3('0x67')](_0x1b9173);}})['catch'](handleError(_0x2c54d3,null));};var utilLicense=require(_0x2dc3('0x16'));exports[_0x2dc3('0x68')]=function(_0x5f49ce,_0x315ddc,_0x2a8f13){var _0x451f53=_0x2dc3('0x56');var _0x97a5a8={'custom':![]};return utilLicense[_0x2dc3('0x57')]()[_0x2dc3('0x1b')](function(_0x507e50){if(_0x507e50){_0x97a5a8=_0x507e50;}return db['Setting']['find']({'where':{'id':_0x5f49ce[_0x2dc3('0x4c')]['id']},'attributes':[_0x2dc3('0x51'),_0x2dc3('0x54'),_0x2dc3('0x58'),_0x2dc3('0x59'),_0x2dc3('0x5a'),_0x2dc3('0x69'),'defaultPreferred',_0x2dc3('0x5c')],'raw':!![]});})[_0x2dc3('0x1b')](handleEntityNotFound(_0x315ddc,null))[_0x2dc3('0x1b')](function(_0x21dbf3){if(_0x21dbf3){var _0x2b0a4e=_0x21dbf3['loginLogo']&&fs[_0x2dc3('0x5d')](path['join'](config[_0x2dc3('0x60')],_0x451f53,_[_0x2dc3('0x5f')](_0x21dbf3[_0x2dc3('0x54')])))?path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x451f53,_[_0x2dc3('0x5f')](_0x21dbf3['loginLogo'])):path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x451f53,_[_0x2dc3('0x5f')](_0x2dc3('0x6a')));var _0x3fa561=_0x2dc3('0x62')+_[_0x2dc3('0x63')](_0x2dc3('0x54'));if(_0x21dbf3[_0x3fa561]||!_0x97a5a8[_0x2dc3('0x64')]){_0x2b0a4e=path[_0x2dc3('0x5e')](config['root'],_0x451f53,_[_0x2dc3('0x5f')](_0x2dc3('0x6a')));}if(!fs[_0x2dc3('0x5d')](_0x2b0a4e)){throw new db[(_0x2dc3('0x6b'))][(_0x2dc3('0x65'))](_[_0x2dc3('0x63')](_0x2dc3('0x54'))+_0x2dc3('0x66'));}return _0x315ddc['download'](_0x2b0a4e);}})['catch'](handleError(_0x315ddc,null));};exports[_0x2dc3('0x6c')]=function(_0x4b5461,_0x277ec1){return db[_0x2dc3('0x33')][_0x2dc3('0x4e')]({'where':{'id':_0x4b5461[_0x2dc3('0x4c')]['id']},'attributes':['securePassword']})[_0x2dc3('0x1b')](respondWithResult(_0x277ec1,null))[_0x2dc3('0x4b')](handleError(_0x277ec1,null));};exports['addPreferred']=function(_0x12f6f1,_0x32438c,_0x4b5f7a){if(_0x12f6f1[_0x2dc3('0x50')]&&_0x12f6f1['file'][_0x2dc3('0x53')]){_0x12f6f1[_0x2dc3('0x4d')][_0x2dc3('0x58')]=_0x12f6f1[_0x2dc3('0x50')]['filename'];}return db['Setting'][_0x2dc3('0x4e')]({'where':{'id':_0x12f6f1[_0x2dc3('0x4c')]['id']}})[_0x2dc3('0x1b')](handleEntityNotFound(_0x32438c,null))[_0x2dc3('0x1b')](saveUpdates(_0x12f6f1[_0x2dc3('0x4d')],null))[_0x2dc3('0x1b')](respondWithResult(_0x32438c,null))[_0x2dc3('0x4b')](handleError(_0x32438c,null));};var utilLicense=require(_0x2dc3('0x16'));exports['getPreferred']=function(_0x455307,_0x266814,_0x352e3c){var _0x283683=_0x2dc3('0x56');var _0x3709d6={'custom':![]};return utilLicense[_0x2dc3('0x57')]()['then'](function(_0x2d58eb){if(_0x2d58eb){_0x3709d6=_0x2d58eb;}return db[_0x2dc3('0x33')][_0x2dc3('0x4e')]({'where':{'id':_0x455307['params']['id']},'attributes':[_0x2dc3('0x51'),_0x2dc3('0x54'),'preferred','favicon',_0x2dc3('0x5a'),_0x2dc3('0x69'),_0x2dc3('0x5b'),_0x2dc3('0x5c')],'raw':!![]});})[_0x2dc3('0x1b')](handleEntityNotFound(_0x266814,null))[_0x2dc3('0x1b')](function(_0x5a1409){if(_0x5a1409){var _0x230be0=_0x5a1409['preferred']&&fs[_0x2dc3('0x5d')](path['join'](config[_0x2dc3('0x60')],_0x283683,_[_0x2dc3('0x5f')](_0x5a1409[_0x2dc3('0x58')])))?path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x283683,_[_0x2dc3('0x5f')](_0x5a1409[_0x2dc3('0x58')])):path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x283683,_[_0x2dc3('0x5f')](_0x2dc3('0x6d')));var _0x400af5=_0x2dc3('0x62')+_[_0x2dc3('0x63')](_0x2dc3('0x58'));if(_0x5a1409[_0x400af5]||!_0x3709d6[_0x2dc3('0x64')]||!_0x3709d6[_0x2dc3('0x58')]){_0x230be0=path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x283683,_[_0x2dc3('0x5f')](_0x2dc3('0x6d')));}if(!fs[_0x2dc3('0x5d')](_0x230be0)){throw new db[(_0x2dc3('0x6b'))][(_0x2dc3('0x65'))](_[_0x2dc3('0x63')]('preferred')+'\x20not\x20found');}return _0x266814[_0x2dc3('0x67')](_0x230be0);}})[_0x2dc3('0x4b')](handleError(_0x266814,null));};exports[_0x2dc3('0x6e')]=function(_0xa84f61,_0x3bc2da,_0x3cfe91){if(_0xa84f61['file']&&_0xa84f61[_0x2dc3('0x50')][_0x2dc3('0x53')]){_0xa84f61[_0x2dc3('0x4d')][_0x2dc3('0x59')]=_0xa84f61[_0x2dc3('0x50')]['filename'];}return db['Setting'][_0x2dc3('0x4e')]({'where':{'id':_0xa84f61[_0x2dc3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3bc2da,null))['then'](saveUpdates(_0xa84f61['body'],null))['then'](respondWithResult(_0x3bc2da,null))['catch'](handleError(_0x3bc2da,null));};var utilLicense=require(_0x2dc3('0x16'));exports[_0x2dc3('0x6f')]=function(_0x45a5a2,_0xacb027,_0x2940fa){var _0x49738d=_0x2dc3('0x56');var _0x231a4e={'custom':![]};return utilLicense[_0x2dc3('0x57')]()['then'](function(_0xb532a3){if(_0xb532a3){_0x231a4e=_0xb532a3;}return db[_0x2dc3('0x33')][_0x2dc3('0x4e')]({'where':{'id':_0x45a5a2[_0x2dc3('0x4c')]['id']},'attributes':[_0x2dc3('0x51'),'loginLogo','preferred',_0x2dc3('0x59'),_0x2dc3('0x5a'),_0x2dc3('0x69'),_0x2dc3('0x5b'),_0x2dc3('0x5c')],'raw':!![]});})[_0x2dc3('0x1b')](handleEntityNotFound(_0xacb027,null))[_0x2dc3('0x1b')](function(_0x44d039){if(_0x44d039){var _0x11144a=_0x44d039[_0x2dc3('0x59')]&&fs['existsSync'](path['join'](config[_0x2dc3('0x60')],_0x49738d,_['toLower'](_0x44d039[_0x2dc3('0x59')])))?path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x49738d,_['toLower'](_0x44d039['favicon'])):path['join'](config['root'],_0x49738d,_[_0x2dc3('0x5f')](_0x2dc3('0x70')));var _0x286416='default'+_['upperFirst']('favicon');if(_0x44d039[_0x286416]||!_0x231a4e[_0x2dc3('0x64')]){_0x11144a=path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x49738d,_[_0x2dc3('0x5f')](_0x2dc3('0x70')));}if(!fs[_0x2dc3('0x5d')](_0x11144a)){throw new db[(_0x2dc3('0x6b'))][(_0x2dc3('0x65'))](_[_0x2dc3('0x63')](_0x2dc3('0x59'))+_0x2dc3('0x66'));}return _0xacb027[_0x2dc3('0x67')](_0x11144a);}})[_0x2dc3('0x4b')](handleError(_0xacb027,null));};exports[_0x2dc3('0x71')]=function(_0x2d1d85,_0x16f816){var _0x1a1f8b={'offset':moment()[_0x2dc3('0x72')]()};_0x1a1f8b[_0x2dc3('0x73')]=moment()[_0x2dc3('0x72')](_0x1a1f8b['offset'])[_0x2dc3('0x74')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x16f816['status'](0xc8)['send'](_0x1a1f8b);}; \ No newline at end of file +var _0x8c24=['defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','server/files/images/logos','loginLogo','default_loginLogo.svg','gdpr','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','http','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','Setting','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','rows','catch','show','params','keys','rawAttributes','includeAll','find','body','addLogo','file','filename','getLogo','getLicense','logo','preferred','favicon'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x8c24,0x182));var _0x48c2=function(_0x2696c9,_0x208531){_0x2696c9=_0x2696c9-0x0;var _0x1bd7a1=_0x8c24[_0x2696c9];return _0x1bd7a1;};'use strict';var pdf=require(_0x48c2('0x0'));var emlformat=require(_0x48c2('0x1'));var rimraf=require(_0x48c2('0x2'));var zipdir=require(_0x48c2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48c2('0x4'));var moment=require(_0x48c2('0x5'));var BPromise=require(_0x48c2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x48c2('0x7'));var csv=require(_0x48c2('0x8'));var ejs=require(_0x48c2('0x9'));var fs=require('fs');var _=require(_0x48c2('0xa'));var squel=require(_0x48c2('0xb'));var crypto=require('crypto');var jsforce=require(_0x48c2('0xc'));var deskjs=require(_0x48c2('0xd'));var toCsv=require(_0x48c2('0x8'));var querystring=require(_0x48c2('0xe'));var Papa=require(_0x48c2('0xf'));var Redis=require(_0x48c2('0x10'));var authService=require(_0x48c2('0x11'));var qs=require(_0x48c2('0x12'));var as=require(_0x48c2('0x13'));var hardwareService=require(_0x48c2('0x14'));var logger=require('../../config/logger')(_0x48c2('0x15'));var utils=require(_0x48c2('0x16'));var config=require(_0x48c2('0x17'));var licenseUtil=require(_0x48c2('0x18'));var db=require(_0x48c2('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x48c2('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x141012,_0x240086,_0x279a6a,_0x2ac026){return new BPromise(function(_0x49c50e,_0x2a63f0){var _0x395fd3=_0x2ac026||client;return _0x395fd3[_0x48c2('0x1b')](_0x141012,_0x279a6a)[_0x48c2('0x1c')](function(_0x4cd2a0){logger[_0x48c2('0x1d')](_0x48c2('0x1e'),_0x240086,'request\x20sent');logger[_0x48c2('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x240086,_0x48c2('0x20'),JSON[_0x48c2('0x21')](_0x4cd2a0));if(_0x4cd2a0[_0x48c2('0x22')]){if(_0x4cd2a0[_0x48c2('0x22')]['code']===0x1f4){logger[_0x48c2('0x22')](_0x48c2('0x1e'),_0x240086,_0x4cd2a0['error'][_0x48c2('0x23')]);return _0x2a63f0(_0x4cd2a0[_0x48c2('0x22')][_0x48c2('0x23')]);}logger[_0x48c2('0x22')](_0x48c2('0x1e'),_0x240086,_0x4cd2a0[_0x48c2('0x22')]['message']);return _0x49c50e(_0x4cd2a0[_0x48c2('0x22')][_0x48c2('0x23')]);}else{logger[_0x48c2('0x1d')](_0x48c2('0x1e'),_0x240086,'request\x20sent');_0x49c50e(_0x4cd2a0[_0x48c2('0x24')][_0x48c2('0x23')]);}})['catch'](function(_0x3d9f2e){logger[_0x48c2('0x22')]('Setting,\x20%s,\x20%s',_0x240086,_0x3d9f2e);_0x2a63f0(_0x3d9f2e);});});}function respondWithStatusCode(_0x222821,_0xa3b7c3){_0xa3b7c3=_0xa3b7c3||0xcc;return function(_0x1ecfed){if(_0x1ecfed){return _0x222821[_0x48c2('0x25')](_0xa3b7c3);}return _0x222821[_0x48c2('0x26')](_0xa3b7c3)[_0x48c2('0x27')]();};}function respondWithResult(_0x2272e4,_0x3adde2){_0x3adde2=_0x3adde2||0xc8;return function(_0x29f181){if(_0x29f181){return _0x2272e4[_0x48c2('0x26')](_0x3adde2)[_0x48c2('0x28')](_0x29f181);}};}function respondWithFilteredResult(_0x318257,_0xb1b324){return function(_0x638226){if(_0x638226){var _0x22745f=_0x638226[_0x48c2('0x29')],_0x259de4=_0xb1b324[_0x48c2('0x2a')],_0x40aa84=_0xb1b324[_0x48c2('0x2a')]+_0xb1b324[_0x48c2('0x2b')],_0x238b89;if(_0x40aa84>=_0x22745f){_0x40aa84=_0x22745f;_0x238b89=0xc8;}else{_0x238b89=0xce;}_0x318257[_0x48c2('0x26')](_0x238b89);return _0x318257[_0x48c2('0x2c')]('Content-Range',_0x259de4+'-'+_0x40aa84+'/'+_0x22745f)[_0x48c2('0x28')](_0x638226);}return null;};}function patchUpdates(_0x44642f){return function(_0x109e7c){try{jsonpatch[_0x48c2('0x2d')](_0x109e7c,_0x44642f,!![]);}catch(_0x5d6678){return BPromise[_0x48c2('0x2e')](_0x5d6678);}return _0x109e7c[_0x48c2('0x2f')]();};}function saveUpdates(_0x1b537a,_0x366287){return function(_0x22465a){if(_0x22465a){return _0x22465a[_0x48c2('0x30')](_0x1b537a)['then'](function(_0x128670){return _0x128670;});}return null;};}function removeEntity(_0x4a5854,_0x4f1d96){return function(_0x2e624a){if(_0x2e624a){return _0x2e624a[_0x48c2('0x31')]()['then'](function(){_0x4a5854[_0x48c2('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x452b7f,_0x40d585){return function(_0x5c11c5){if(!_0x5c11c5){_0x452b7f[_0x48c2('0x25')](0x194);}return _0x5c11c5;};}function handleError(_0xdc4f29,_0x227d6b){_0x227d6b=_0x227d6b||0x1f4;return function(_0x2f228a){logger['error'](_0x2f228a[_0x48c2('0x32')]);if(_0x2f228a['name']){delete _0x2f228a[_0x48c2('0x33')];}_0xdc4f29[_0x48c2('0x26')](_0x227d6b)[_0x48c2('0x34')](_0x2f228a);};}exports[_0x48c2('0x35')]=function(_0x39d28a,_0x369843){var _0x27e385={},_0x488d4e={},_0x2d0e78={'count':0x0,'rows':[]};var _0x522d5a=_[_0x48c2('0x36')](db[_0x48c2('0x37')]['rawAttributes'],function(_0x1bd160){return{'name':_0x1bd160[_0x48c2('0x38')],'type':_0x1bd160[_0x48c2('0x39')][_0x48c2('0x3a')]};});_0x488d4e[_0x48c2('0x3b')]=_['map'](_0x522d5a,_0x48c2('0x33'));_0x488d4e['query']=_['keys'](_0x39d28a['query']);_0x488d4e[_0x48c2('0x3c')]=_[_0x48c2('0x3d')](_0x488d4e['model'],_0x488d4e[_0x48c2('0x3e')]);_0x27e385[_0x48c2('0x3f')]=_[_0x48c2('0x3d')](_0x488d4e[_0x48c2('0x3b')],qs[_0x48c2('0x40')](_0x39d28a[_0x48c2('0x3e')][_0x48c2('0x40')]));_0x27e385[_0x48c2('0x3f')]=_0x27e385[_0x48c2('0x3f')][_0x48c2('0x41')]?_0x27e385['attributes']:_0x488d4e[_0x48c2('0x3b')];if(!_0x39d28a[_0x48c2('0x3e')]['hasOwnProperty'](_0x48c2('0x42'))){_0x27e385[_0x48c2('0x2b')]=qs[_0x48c2('0x2b')](_0x39d28a[_0x48c2('0x3e')]['limit']);_0x27e385[_0x48c2('0x2a')]=qs['offset'](_0x39d28a[_0x48c2('0x3e')][_0x48c2('0x2a')]);}_0x27e385[_0x48c2('0x43')]=qs[_0x48c2('0x44')](_0x39d28a[_0x48c2('0x3e')][_0x48c2('0x44')]);_0x27e385[_0x48c2('0x45')]=qs[_0x48c2('0x3c')](_['pick'](_0x39d28a[_0x48c2('0x3e')],_0x488d4e[_0x48c2('0x3c')]),_0x522d5a);if(_0x39d28a[_0x48c2('0x3e')][_0x48c2('0x46')]){_0x27e385[_0x48c2('0x45')]=_[_0x48c2('0x47')](_0x27e385[_0x48c2('0x45')],{'$or':_['map'](_0x522d5a,function(_0x223ae7){if(_0x223ae7['type']!=='VIRTUAL'){var _0x108bca={};_0x108bca[_0x223ae7['name']]={'$like':'%'+_0x39d28a['query'][_0x48c2('0x46')]+'%'};return _0x108bca;}})});}_0x27e385=_[_0x48c2('0x47')]({},_0x27e385,_0x39d28a[_0x48c2('0x48')]);var _0x14a5ac={'where':_0x27e385[_0x48c2('0x45')]};return db['Setting'][_0x48c2('0x29')](_0x14a5ac)[_0x48c2('0x1c')](function(_0x2dd357){_0x2d0e78[_0x48c2('0x29')]=_0x2dd357;if(_0x39d28a[_0x48c2('0x3e')]['includeAll']){_0x27e385['include']=[{'all':!![]}];}return db['Setting']['findAll'](_0x27e385);})['then'](function(_0x2fedd6){_0x2d0e78[_0x48c2('0x49')]=_0x2fedd6;return _0x2d0e78;})[_0x48c2('0x1c')](respondWithFilteredResult(_0x369843,_0x27e385))[_0x48c2('0x4a')](handleError(_0x369843,null));};exports[_0x48c2('0x4b')]=function(_0x5679d9,_0x30b6e1){var _0x43d632={'raw':![],'where':{'id':_0x5679d9[_0x48c2('0x4c')]['id']}},_0x1844c1={};_0x1844c1[_0x48c2('0x3b')]=_[_0x48c2('0x4d')](db['Setting'][_0x48c2('0x4e')]);_0x1844c1[_0x48c2('0x3e')]=_[_0x48c2('0x4d')](_0x5679d9[_0x48c2('0x3e')]);_0x1844c1['filters']=_['intersection'](_0x1844c1[_0x48c2('0x3b')],_0x1844c1[_0x48c2('0x3e')]);_0x43d632[_0x48c2('0x3f')]=_['intersection'](_0x1844c1[_0x48c2('0x3b')],qs['fields'](_0x5679d9[_0x48c2('0x3e')]['fields']));_0x43d632[_0x48c2('0x3f')]=_0x43d632[_0x48c2('0x3f')]['length']?_0x43d632[_0x48c2('0x3f')]:_0x1844c1[_0x48c2('0x3b')];if(_0x5679d9[_0x48c2('0x3e')][_0x48c2('0x4f')]){_0x43d632['include']=[{'all':!![]}];}_0x43d632=_[_0x48c2('0x47')]({},_0x43d632,_0x5679d9['options']);return db['Setting'][_0x48c2('0x50')](_0x43d632)[_0x48c2('0x1c')](handleEntityNotFound(_0x30b6e1,null))[_0x48c2('0x1c')](respondWithResult(_0x30b6e1,null))['catch'](handleError(_0x30b6e1,null));};exports['update']=function(_0xd98a38,_0x2f3d62){if(_0xd98a38[_0x48c2('0x51')]['id']){delete _0xd98a38[_0x48c2('0x51')]['id'];}return db[_0x48c2('0x37')][_0x48c2('0x50')]({'where':{'id':_0xd98a38[_0x48c2('0x4c')]['id']}})[_0x48c2('0x1c')](handleEntityNotFound(_0x2f3d62,null))['then'](saveUpdates(_0xd98a38['body'],null))['then'](respondWithResult(_0x2f3d62,null))[_0x48c2('0x4a')](handleError(_0x2f3d62,null));};exports[_0x48c2('0x52')]=function(_0x468f18,_0x4c6230,_0x16e570){if(_0x468f18[_0x48c2('0x53')]&&_0x468f18['file'][_0x48c2('0x54')]){_0x468f18[_0x48c2('0x51')]['logo']=_0x468f18['file'][_0x48c2('0x54')];}return db[_0x48c2('0x37')]['find']({'where':{'id':_0x468f18['params']['id']}})[_0x48c2('0x1c')](handleEntityNotFound(_0x4c6230,null))[_0x48c2('0x1c')](saveUpdates(_0x468f18[_0x48c2('0x51')],null))[_0x48c2('0x1c')](respondWithResult(_0x4c6230,null))['catch'](handleError(_0x4c6230,null));};exports['addLogoLogin']=function(_0x4dfcd8,_0x26e888,_0x3dd214){if(_0x4dfcd8[_0x48c2('0x53')]&&_0x4dfcd8[_0x48c2('0x53')][_0x48c2('0x54')]){_0x4dfcd8[_0x48c2('0x51')]['loginLogo']=_0x4dfcd8[_0x48c2('0x53')][_0x48c2('0x54')];}return db['Setting'][_0x48c2('0x50')]({'where':{'id':_0x4dfcd8[_0x48c2('0x4c')]['id']}})[_0x48c2('0x1c')](handleEntityNotFound(_0x26e888,null))['then'](saveUpdates(_0x4dfcd8[_0x48c2('0x51')],null))[_0x48c2('0x1c')](respondWithResult(_0x26e888,null))['catch'](handleError(_0x26e888,null));};var utilLicense=require(_0x48c2('0x18'));exports[_0x48c2('0x55')]=function(_0x20a3c1,_0x5893b0,_0x4e02bf){var _0x583fed='server/files/images/logos';var _0x16793f={'custom':![]};return utilLicense[_0x48c2('0x56')]()[_0x48c2('0x1c')](function(_0x44a320){if(_0x44a320){_0x16793f=_0x44a320;}return db[_0x48c2('0x37')][_0x48c2('0x50')]({'where':{'id':_0x20a3c1[_0x48c2('0x4c')]['id']},'attributes':[_0x48c2('0x57'),'loginLogo',_0x48c2('0x58'),_0x48c2('0x59'),_0x48c2('0x5a'),_0x48c2('0x5b'),_0x48c2('0x5c'),_0x48c2('0x5d')],'raw':!![]});})[_0x48c2('0x1c')](handleEntityNotFound(_0x5893b0,null))[_0x48c2('0x1c')](function(_0x13f9cb){if(_0x13f9cb){var _0x292ced=_0x13f9cb[_0x48c2('0x57')]&&fs[_0x48c2('0x5e')](path[_0x48c2('0x5f')](config[_0x48c2('0x60')],_0x583fed,_['toLower'](_0x13f9cb[_0x48c2('0x57')])))?path[_0x48c2('0x5f')](config[_0x48c2('0x60')],_0x583fed,_[_0x48c2('0x61')](_0x13f9cb[_0x48c2('0x57')])):path['join'](config['root'],_0x583fed,_['toLower'](_0x48c2('0x62')));var _0x214b53=_0x48c2('0x63')+_[_0x48c2('0x64')](_0x48c2('0x57'));if(_0x13f9cb[_0x214b53]||!_0x16793f[_0x48c2('0x65')]){_0x292ced=path[_0x48c2('0x5f')](config[_0x48c2('0x60')],_0x583fed,_[_0x48c2('0x61')](_0x48c2('0x62')));}if(!fs[_0x48c2('0x5e')](_0x292ced)){throw new db[(_0x48c2('0x66'))][(_0x48c2('0x67'))](_[_0x48c2('0x64')](_0x48c2('0x57'))+_0x48c2('0x68'));}return _0x5893b0[_0x48c2('0x69')](_0x292ced);}})[_0x48c2('0x4a')](handleError(_0x5893b0,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x3c6087,_0x18367e,_0x536d0c){var _0x29d9bc=_0x48c2('0x6a');var _0x255ace={'custom':![]};return utilLicense[_0x48c2('0x56')]()[_0x48c2('0x1c')](function(_0xe41d54){if(_0xe41d54){_0x255ace=_0xe41d54;}return db[_0x48c2('0x37')][_0x48c2('0x50')]({'where':{'id':_0x3c6087[_0x48c2('0x4c')]['id']},'attributes':['logo',_0x48c2('0x6b'),_0x48c2('0x58'),'favicon',_0x48c2('0x5a'),'defaultLoginLogo',_0x48c2('0x5c'),_0x48c2('0x5d')],'raw':!![]});})[_0x48c2('0x1c')](handleEntityNotFound(_0x18367e,null))['then'](function(_0x564cc8){if(_0x564cc8){var _0x3d7900=_0x564cc8[_0x48c2('0x6b')]&&fs[_0x48c2('0x5e')](path[_0x48c2('0x5f')](config[_0x48c2('0x60')],_0x29d9bc,_[_0x48c2('0x61')](_0x564cc8[_0x48c2('0x6b')])))?path[_0x48c2('0x5f')](config[_0x48c2('0x60')],_0x29d9bc,_[_0x48c2('0x61')](_0x564cc8['loginLogo'])):path[_0x48c2('0x5f')](config[_0x48c2('0x60')],_0x29d9bc,_[_0x48c2('0x61')](_0x48c2('0x6c')));var _0x5912e9=_0x48c2('0x63')+_[_0x48c2('0x64')]('loginLogo');if(_0x564cc8[_0x5912e9]||!_0x255ace[_0x48c2('0x65')]){_0x3d7900=path[_0x48c2('0x5f')](config[_0x48c2('0x60')],_0x29d9bc,_[_0x48c2('0x61')]('default_loginLogo.svg'));}if(!fs[_0x48c2('0x5e')](_0x3d7900)){throw new db['Sequelize'][(_0x48c2('0x67'))](_['upperFirst']('loginLogo')+_0x48c2('0x68'));}return _0x18367e[_0x48c2('0x69')](_0x3d7900);}})[_0x48c2('0x4a')](handleError(_0x18367e,null));};exports[_0x48c2('0x6d')]=function(_0x4b97c5,_0x3ed56b){return db['Setting'][_0x48c2('0x50')]({'where':{'id':_0x4b97c5[_0x48c2('0x4c')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x3ed56b,null))[_0x48c2('0x4a')](handleError(_0x3ed56b,null));};exports['addPreferred']=function(_0x49dc5e,_0x1ce71,_0x173c19){if(_0x49dc5e['file']&&_0x49dc5e[_0x48c2('0x53')]['filename']){_0x49dc5e['body'][_0x48c2('0x58')]=_0x49dc5e[_0x48c2('0x53')]['filename'];}return db[_0x48c2('0x37')][_0x48c2('0x50')]({'where':{'id':_0x49dc5e[_0x48c2('0x4c')]['id']}})[_0x48c2('0x1c')](handleEntityNotFound(_0x1ce71,null))[_0x48c2('0x1c')](saveUpdates(_0x49dc5e[_0x48c2('0x51')],null))['then'](respondWithResult(_0x1ce71,null))[_0x48c2('0x4a')](handleError(_0x1ce71,null));};var utilLicense=require('../../config/license/util');exports[_0x48c2('0x6e')]=function(_0x16d2da,_0x5169eb,_0x16f511){var _0x3d88e6='server/files/images/logos';var _0x4f1dad={'custom':![]};return utilLicense[_0x48c2('0x56')]()['then'](function(_0x1b9934){if(_0x1b9934){_0x4f1dad=_0x1b9934;}return db['Setting'][_0x48c2('0x50')]({'where':{'id':_0x16d2da['params']['id']},'attributes':['logo','loginLogo',_0x48c2('0x58'),_0x48c2('0x59'),'defaultLogo',_0x48c2('0x5b'),'defaultPreferred',_0x48c2('0x5d')],'raw':!![]});})[_0x48c2('0x1c')](handleEntityNotFound(_0x5169eb,null))['then'](function(_0x11ad7b){if(_0x11ad7b){var _0xdc3e22=_0x11ad7b[_0x48c2('0x58')]&&fs[_0x48c2('0x5e')](path[_0x48c2('0x5f')](config[_0x48c2('0x60')],_0x3d88e6,_['toLower'](_0x11ad7b[_0x48c2('0x58')])))?path[_0x48c2('0x5f')](config[_0x48c2('0x60')],_0x3d88e6,_[_0x48c2('0x61')](_0x11ad7b[_0x48c2('0x58')])):path[_0x48c2('0x5f')](config['root'],_0x3d88e6,_[_0x48c2('0x61')](_0x48c2('0x6f')));var _0x5060f0='default'+_[_0x48c2('0x64')]('preferred');if(_0x11ad7b[_0x5060f0]||!_0x4f1dad[_0x48c2('0x65')]||!_0x4f1dad[_0x48c2('0x58')]){_0xdc3e22=path[_0x48c2('0x5f')](config[_0x48c2('0x60')],_0x3d88e6,_[_0x48c2('0x61')](_0x48c2('0x6f')));}if(!fs['existsSync'](_0xdc3e22)){throw new db[(_0x48c2('0x66'))][(_0x48c2('0x67'))](_[_0x48c2('0x64')](_0x48c2('0x58'))+_0x48c2('0x68'));}return _0x5169eb[_0x48c2('0x69')](_0xdc3e22);}})[_0x48c2('0x4a')](handleError(_0x5169eb,null));};exports['addFavicon']=function(_0xfd4117,_0x489ce9,_0x1782d5){if(_0xfd4117[_0x48c2('0x53')]&&_0xfd4117[_0x48c2('0x53')][_0x48c2('0x54')]){_0xfd4117[_0x48c2('0x51')][_0x48c2('0x59')]=_0xfd4117[_0x48c2('0x53')]['filename'];}return db[_0x48c2('0x37')][_0x48c2('0x50')]({'where':{'id':_0xfd4117[_0x48c2('0x4c')]['id']}})[_0x48c2('0x1c')](handleEntityNotFound(_0x489ce9,null))[_0x48c2('0x1c')](saveUpdates(_0xfd4117[_0x48c2('0x51')],null))[_0x48c2('0x1c')](respondWithResult(_0x489ce9,null))['catch'](handleError(_0x489ce9,null));};var utilLicense=require(_0x48c2('0x18'));exports[_0x48c2('0x70')]=function(_0x9c4531,_0xca5a7f,_0x3c0fdd){var _0x423da3=_0x48c2('0x6a');var _0x4754b3={'custom':![]};return utilLicense[_0x48c2('0x56')]()[_0x48c2('0x1c')](function(_0xcb4e0f){if(_0xcb4e0f){_0x4754b3=_0xcb4e0f;}return db[_0x48c2('0x37')][_0x48c2('0x50')]({'where':{'id':_0x9c4531['params']['id']},'attributes':['logo',_0x48c2('0x6b'),_0x48c2('0x58'),_0x48c2('0x59'),'defaultLogo','defaultLoginLogo',_0x48c2('0x5c'),_0x48c2('0x5d')],'raw':!![]});})[_0x48c2('0x1c')](handleEntityNotFound(_0xca5a7f,null))[_0x48c2('0x1c')](function(_0x17e488){if(_0x17e488){var _0x24e3c4=_0x17e488[_0x48c2('0x59')]&&fs[_0x48c2('0x5e')](path[_0x48c2('0x5f')](config['root'],_0x423da3,_['toLower'](_0x17e488['favicon'])))?path[_0x48c2('0x5f')](config[_0x48c2('0x60')],_0x423da3,_[_0x48c2('0x61')](_0x17e488[_0x48c2('0x59')])):path[_0x48c2('0x5f')](config[_0x48c2('0x60')],_0x423da3,_[_0x48c2('0x61')]('default_favicon.ico'));var _0x55eece=_0x48c2('0x63')+_['upperFirst'](_0x48c2('0x59'));if(_0x17e488[_0x55eece]||!_0x4754b3['custom']){_0x24e3c4=path[_0x48c2('0x5f')](config['root'],_0x423da3,_[_0x48c2('0x61')](_0x48c2('0x71')));}if(!fs['existsSync'](_0x24e3c4)){throw new db['Sequelize'][(_0x48c2('0x67'))](_[_0x48c2('0x64')]('favicon')+'\x20not\x20found');}return _0xca5a7f[_0x48c2('0x69')](_0x24e3c4);}})[_0x48c2('0x4a')](handleError(_0xca5a7f,null));};exports[_0x48c2('0x72')]=function(_0xbb28d6,_0x53563b){var _0xdf5de={'offset':moment()[_0x48c2('0x73')]()};_0xdf5de[_0x48c2('0x74')]=moment()[_0x48c2('0x73')](_0xdf5de[_0x48c2('0x2a')])[_0x48c2('0x75')](_0x48c2('0x76'));return _0x53563b[_0x48c2('0x26')](0xc8)[_0x48c2('0x34')](_0xdf5de);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 3bc2226..8d55d1d 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 _0xbeda=['lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','settings'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0xbeda,0x1b8));var _0xabed=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xbeda[_0x99868f];return _0x27a71b;};'use strict';var _=require(_0xabed('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xabed('0x1'));var moment=require(_0xabed('0x2'));var BPromise=require(_0xabed('0x3'));var rp=require(_0xabed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabed('0x5'));var config=require(_0xabed('0x6'));var attributes=require('./setting.attributes');module[_0xabed('0x7')]=function(_0x13ad4a,_0x1c68f1){return _0x13ad4a[_0xabed('0x8')]('Setting',attributes,{'tableName':_0xabed('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2831=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting','util'];(function(_0x4a78fd,_0xa2cb17){var _0x196334=function(_0x30ae02){while(--_0x30ae02){_0x4a78fd['push'](_0x4a78fd['shift']());}};_0x196334(++_0xa2cb17);}(_0x2831,0x1ee));var _0x1283=function(_0x43145c,_0x4ea1b4){_0x43145c=_0x43145c-0x0;var _0x2cee86=_0x2831[_0x43145c];return _0x2cee86;};'use strict';var _=require('lodash');var util=require(_0x1283('0x0'));var logger=require(_0x1283('0x1'))(_0x1283('0x2'));var moment=require('moment');var BPromise=require(_0x1283('0x3'));var rp=require(_0x1283('0x4'));var fs=require('fs');var path=require(_0x1283('0x5'));var rimraf=require(_0x1283('0x6'));var config=require(_0x1283('0x7'));var attributes=require(_0x1283('0x8'));module[_0x1283('0x9')]=function(_0x481ea3,_0x79119f){return _0x481ea3['define'](_0x1283('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index ba963e3..e25f707 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 _0xe925=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x13e99e,_0x1c56f4){var _0x28196b=function(_0xe034d0){while(--_0xe034d0){_0x13e99e['push'](_0x13e99e['shift']());}};_0x28196b(++_0x1c56f4);}(_0xe925,0x1b6));var _0x5e92=function(_0x1637f4,_0x3216fe){_0x1637f4=_0x1637f4-0x0;var _0x1369e3=_0xe925[_0x1637f4];return _0x1369e3;};'use strict';var _=require(_0x5e92('0x0'));var util=require(_0x5e92('0x1'));var moment=require(_0x5e92('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e92('0x3'));var db=require(_0x5e92('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e92('0x5'))('rpc');var config=require(_0x5e92('0x6'));var jayson=require(_0x5e92('0x7'));var client=jayson[_0x5e92('0x8')][_0x5e92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcd9ddb,_0x18ff86,_0x1422a9){return new BPromise(function(_0x29e7f0,_0x4d48e8){return client['request'](_0xcd9ddb,_0x1422a9)[_0x5e92('0xa')](function(_0x18b263){logger['info'](_0x5e92('0xb'),_0x18ff86,'request\x20sent');logger[_0x5e92('0xc')](_0x5e92('0xd'),_0x18ff86,_0x5e92('0xe'),JSON[_0x5e92('0xf')](_0x18b263));if(_0x18b263[_0x5e92('0x10')]){if(_0x18b263['error'][_0x5e92('0x11')]===0x1f4){logger['error'](_0x5e92('0xb'),_0x18ff86,_0x18b263[_0x5e92('0x10')][_0x5e92('0x12')]);return _0x4d48e8(_0x18b263[_0x5e92('0x10')][_0x5e92('0x12')]);}logger[_0x5e92('0x10')](_0x5e92('0xb'),_0x18ff86,_0x18b263[_0x5e92('0x10')][_0x5e92('0x12')]);return _0x29e7f0(_0x18b263[_0x5e92('0x10')]['message']);}else{logger['info'](_0x5e92('0xb'),_0x18ff86,_0x5e92('0xe'));_0x29e7f0(_0x18b263[_0x5e92('0x13')][_0x5e92('0x12')]);}})[_0x5e92('0x14')](function(_0x3d2487){logger[_0x5e92('0x10')](_0x5e92('0xb'),_0x18ff86,_0x3d2487);_0x4d48e8(_0x3d2487);});});} \ No newline at end of file +var _0x1120=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','lodash','util','moment'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x1120,0x1e0));var _0x0112=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0x1120[_0x26f1b2];return _0x1624a4;};'use strict';var _=require(_0x0112('0x0'));var util=require(_0x0112('0x1'));var moment=require(_0x0112('0x2'));var BPromise=require(_0x0112('0x3'));var rs=require(_0x0112('0x4'));var fs=require('fs');var Redis=require(_0x0112('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0112('0x6'));var logger=require(_0x0112('0x7'))(_0x0112('0x8'));var config=require(_0x0112('0x9'));var jayson=require(_0x0112('0xa'));var client=jayson[_0x0112('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49d1de,_0x1832bd,_0x37e218){return new BPromise(function(_0x2afab7,_0x2a97aa){return client[_0x0112('0xc')](_0x49d1de,_0x37e218)[_0x0112('0xd')](function(_0x4e362f){logger[_0x0112('0xe')]('Setting,\x20%s,\x20%s',_0x1832bd,'request\x20sent');logger[_0x0112('0xf')](_0x0112('0x10'),_0x1832bd,_0x0112('0x11'),JSON[_0x0112('0x12')](_0x4e362f));if(_0x4e362f[_0x0112('0x13')]){if(_0x4e362f[_0x0112('0x13')][_0x0112('0x14')]===0x1f4){logger[_0x0112('0x13')](_0x0112('0x15'),_0x1832bd,_0x4e362f[_0x0112('0x13')]['message']);return _0x2a97aa(_0x4e362f[_0x0112('0x13')][_0x0112('0x16')]);}logger['error'](_0x0112('0x15'),_0x1832bd,_0x4e362f[_0x0112('0x13')][_0x0112('0x16')]);return _0x2afab7(_0x4e362f[_0x0112('0x13')]['message']);}else{logger[_0x0112('0xe')]('Setting,\x20%s,\x20%s',_0x1832bd,_0x0112('0x11'));_0x2afab7(_0x4e362f['result'][_0x0112('0x16')]);}})['catch'](function(_0x52ad1d){logger[_0x0112('0x13')](_0x0112('0x15'),_0x1832bd,_0x52ad1d);_0x2a97aa(_0x52ad1d);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index e5e7a5c..dcb2772 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 _0xda6d=['removeAgents','multer','util','connect-timeout','Router','./smsAccount.controller','isAuthenticated','index','get','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','/:id/send','send','status','/:id','update','destroy','delete','removeDispositions','removeAnswers'];(function(_0x1b8a09,_0xfa4f73){var _0x53c51c=function(_0x198446){while(--_0x198446){_0x1b8a09['push'](_0x1b8a09['shift']());}};_0x53c51c(++_0xfa4f73);}(_0xda6d,0xdf));var _0xdda6=function(_0x4eac56,_0x291177){_0x4eac56=_0x4eac56-0x0;var _0x1cffe3=_0xda6d[_0x4eac56];return _0x1cffe3;};'use strict';var multer=require(_0xdda6('0x0'));var util=require(_0xdda6('0x1'));var path=require('path');var timeout=require(_0xdda6('0x2'));var express=require('express');var router=express[_0xdda6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdda6('0x4'));router['get']('/',auth[_0xdda6('0x5')](),controller[_0xdda6('0x6')]);router[_0xdda6('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xdda6('0x7')]('/:id',auth[_0xdda6('0x5')](),controller[_0xdda6('0x8')]);router[_0xdda6('0x7')](_0xdda6('0x9'),auth['isAuthenticated'](),controller[_0xdda6('0xa')]);router['get'](_0xdda6('0xb'),auth[_0xdda6('0x5')](),controller[_0xdda6('0xc')]);router['get']('/:id/applications',auth[_0xdda6('0x5')](),controller[_0xdda6('0xd')]);router[_0xdda6('0x7')](_0xdda6('0xe'),auth[_0xdda6('0x5')](),controller[_0xdda6('0xf')]);router[_0xdda6('0x7')](_0xdda6('0x10'),controller[_0xdda6('0x11')]);router[_0xdda6('0x7')](_0xdda6('0x12'),auth[_0xdda6('0x5')](),controller[_0xdda6('0x13')]);router['post']('/',auth[_0xdda6('0x5')](),controller[_0xdda6('0x14')]);router[_0xdda6('0x15')](_0xdda6('0x9'),auth[_0xdda6('0x5')](),controller[_0xdda6('0x16')]);router[_0xdda6('0x15')](_0xdda6('0xb'),auth[_0xdda6('0x5')](),controller[_0xdda6('0x17')]);router['post'](_0xdda6('0x18'),controller['notify']);router[_0xdda6('0x15')](_0xdda6('0x19'),auth[_0xdda6('0x5')](),controller[_0xdda6('0x1a')]);router[_0xdda6('0x15')](_0xdda6('0x1b'),auth[_0xdda6('0x5')](),controller[_0xdda6('0x1c')]);router[_0xdda6('0x15')](_0xdda6('0x10'),controller[_0xdda6('0x1d')]);router['post'](_0xdda6('0x12'),auth[_0xdda6('0x5')](),controller['addAgents']);router['put'](_0xdda6('0x1e'),auth[_0xdda6('0x5')](),controller[_0xdda6('0x1f')]);router['delete']('/:id',auth[_0xdda6('0x5')](),controller[_0xdda6('0x20')]);router[_0xdda6('0x21')](_0xdda6('0x9'),auth['isAuthenticated'](),controller[_0xdda6('0x22')]);router[_0xdda6('0x21')]('/:id/canned_answers',auth[_0xdda6('0x5')](),controller[_0xdda6('0x23')]);router[_0xdda6('0x21')](_0xdda6('0x12'),auth['isAuthenticated'](),controller[_0xdda6('0x24')]);module['exports']=router; \ No newline at end of file +var _0xaffc=['get','/describe','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','send','status','put','/:id','delete','destroy','/:id/dispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','isAuthenticated','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaffc,0x125));var _0xcaff=function(_0x372e07,_0x4a5979){_0x372e07=_0x372e07-0x0;var _0x4b75ac=_0xaffc[_0x372e07];return _0x4b75ac;};'use strict';var multer=require(_0xcaff('0x0'));var util=require(_0xcaff('0x1'));var path=require('path');var timeout=require(_0xcaff('0x2'));var express=require(_0xcaff('0x3'));var router=express[_0xcaff('0x4')]();var auth=require(_0xcaff('0x5'));var interaction=require(_0xcaff('0x6'));var config=require(_0xcaff('0x7'));var controller=require(_0xcaff('0x8'));router['get']('/',auth[_0xcaff('0x9')](),controller[_0xcaff('0xa')]);router[_0xcaff('0xb')](_0xcaff('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xcaff('0xb')]('/:id',auth[_0xcaff('0x9')](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xcaff('0xd')]);router[_0xcaff('0xb')](_0xcaff('0xe'),auth[_0xcaff('0x9')](),controller[_0xcaff('0xf')]);router[_0xcaff('0xb')](_0xcaff('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0xcaff('0xb')](_0xcaff('0x11'),auth['isAuthenticated'](),controller[_0xcaff('0x12')]);router[_0xcaff('0xb')](_0xcaff('0x13'),controller[_0xcaff('0x14')]);router[_0xcaff('0xb')](_0xcaff('0x15'),auth[_0xcaff('0x9')](),controller[_0xcaff('0x16')]);router[_0xcaff('0x17')]('/',auth[_0xcaff('0x9')](),controller[_0xcaff('0x18')]);router['post']('/:id/dispositions',auth[_0xcaff('0x9')](),controller[_0xcaff('0x19')]);router[_0xcaff('0x17')]('/:id/canned_answers',auth[_0xcaff('0x9')](),controller[_0xcaff('0x1a')]);router[_0xcaff('0x17')]('/:id/notify',controller['notify']);router[_0xcaff('0x17')](_0xcaff('0x10'),auth[_0xcaff('0x9')](),controller['addApplications']);router[_0xcaff('0x17')](_0xcaff('0x1b'),auth['isAuthenticated'](),controller[_0xcaff('0x1c')]);router[_0xcaff('0x17')](_0xcaff('0x13'),controller[_0xcaff('0x1d')]);router['post'](_0xcaff('0x15'),auth[_0xcaff('0x9')](),controller['addAgents']);router[_0xcaff('0x1e')](_0xcaff('0x1f'),auth[_0xcaff('0x9')](),controller['update']);router[_0xcaff('0x20')](_0xcaff('0x1f'),auth[_0xcaff('0x9')](),controller[_0xcaff('0x21')]);router[_0xcaff('0x20')](_0xcaff('0x22'),auth[_0xcaff('0x9')](),controller['removeDispositions']);router[_0xcaff('0x20')](_0xcaff('0xe'),auth[_0xcaff('0x9')](),controller[_0xcaff('0x23')]);router[_0xcaff('0x20')](_0xcaff('0x15'),auth[_0xcaff('0x9')](),controller[_0xcaff('0x24')]);module[_0xcaff('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index a389a1c..8714024 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 _0x3176=['skebby','connectel','clicksend','plivo','bandwidth','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','setDataValue','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio'];(function(_0x38713e,_0x4bdc87){var _0x3adf5a=function(_0x417cc9){while(--_0x417cc9){_0x38713e['push'](_0x38713e['shift']());}};_0x3adf5a(++_0x4bdc87);}(_0x3176,0x1d8));var _0x6317=function(_0x2bb99f,_0x3b8167){_0x2bb99f=_0x2bb99f-0x0;var _0x1632ba=_0x3176[_0x2bb99f];return _0x1632ba;};'use strict';var Sequelize=require(_0x6317('0x0'));var rs=require(_0x6317('0x1'));module[_0x6317('0x2')]={'name':{'type':Sequelize[_0x6317('0x3')],'unique':_0x6317('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x6317('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x6317('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x6317('0x3')],'defaultValue':function(){return rs[_0x6317('0x5')]();}},'phone':{'type':Sequelize[_0x6317('0x3')]},'type':{'type':Sequelize[_0x6317('0x6')](_0x6317('0x7'),_0x6317('0x8'),_0x6317('0x9'),_0x6317('0xa'),_0x6317('0xb'),'clickatell',_0x6317('0xc'),_0x6317('0xd'),_0x6317('0xe'),'intelepeer')},'accountSid':{'type':Sequelize[_0x6317('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x6317('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6317('0x3')]},'password':{'type':Sequelize[_0x6317('0x3')]},'apiKey':{'type':Sequelize[_0x6317('0x3')]},'applicationId':{'type':Sequelize[_0x6317('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x6317('0x3')]},'deliveryReport':{'type':Sequelize[_0x6317('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6317('0x10')],'defaultValue':function(){return _0x6317('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6317('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6317('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6317('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6317('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6317('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6317('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6317('0x12')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1b42b3){if(!_0x1b42b3)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x6317('0x13')]('mandatoryDisposition',_0x1b42b3);}}}; \ No newline at end of file +var _0xade9=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','generate','ENUM','twilio','connectel','clicksend','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0xade9,0x1e7));var _0x9ade=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xade9[_0x3fba9f];return _0x192cf1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9ade('0x0'));module[_0x9ade('0x1')]={'name':{'type':Sequelize[_0x9ade('0x2')],'unique':_0x9ade('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x9ade('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x9ade('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x9ade('0x2')],'defaultValue':function(){return rs[_0x9ade('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9ade('0x5')](_0x9ade('0x6'),'skebby',_0x9ade('0x7'),_0x9ade('0x8'),'plivo',_0x9ade('0x9'),_0x9ade('0xa'),_0x9ade('0xb'),'infobip',_0x9ade('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x9ade('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x9ade('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9ade('0x2')]},'password':{'type':Sequelize[_0x9ade('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x9ade('0x2')]},'accountId':{'type':Sequelize[_0x9ade('0x2')]},'senderString':{'type':Sequelize[_0x9ade('0x2')]},'deliveryReport':{'type':Sequelize[_0x9ade('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x9ade('0xe')],'defaultValue':function(){return _0x9ade('0xf');}},'notificationSound':{'type':Sequelize[_0x9ade('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9ade('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9ade('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9ade('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9ade('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9ade('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9ade('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x9ade('0xd')],'defaultValue':![],'comment':_0x9ade('0x12'),'set':function(_0x5b2e28){if(!_0x5b2e28)this[_0x9ade('0x13')](_0x9ade('0x14'),null);this[_0x9ade('0x13')]('mandatoryDisposition',_0x5b2e28);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 68d8e6c..c0bb13a 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 _0x138d=['./smsAccount.socket','register','jayson/promise','client','http','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','SmsAccount,\x20%s,\x20%s','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','UserProfileResource','then','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','map','type','VIRTUAL','options','includeAll','include','findAll','show','params','create','body','user','get','role','SmsAccounts','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','pick','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','mobile','twilio','from','From','messageId','text','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','intelepeer','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','list','omit','contact','spread','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','info','entity\x20found','Content-Type','send','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','SmsInteraction','Contact','Owner','fullname','internal','Tag','Tags','color','tag','rows','to\x20is\x20mandatory','List','DESC','Messages','SmsMessage','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','querystring','../../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'];(function(_0x2b6798,_0x2163e6){var _0x4991ab=function(_0x4bc90a){while(--_0x4bc90a){_0x2b6798['push'](_0x2b6798['shift']());}};_0x4991ab(++_0x2163e6);}(_0x138d,0x1a5));var _0xd138=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x138d[_0x56f7e2];return _0x36240b;};'use strict';var pdf=require(_0xd138('0x0'));var emlformat=require(_0xd138('0x1'));var rimraf=require(_0xd138('0x2'));var zipdir=require(_0xd138('0x3'));var jsonpatch=require(_0xd138('0x4'));var rp=require('request-promise');var moment=require(_0xd138('0x5'));var BPromise=require(_0xd138('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd138('0x7'));var sox=require('sox');var csv=require(_0xd138('0x8'));var ejs=require(_0xd138('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd138('0xa'));var crypto=require(_0xd138('0xb'));var jsforce=require(_0xd138('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd138('0x8'));var querystring=require(_0xd138('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd138('0xe'));var qs=require(_0xd138('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd138('0x10'));var logger=require(_0xd138('0x11'))(_0xd138('0x12'));var utils=require(_0xd138('0x13'));var config=require(_0xd138('0x14'));var licenseUtil=require(_0xd138('0x15'));var db=require(_0xd138('0x16'))['db'];config['redis']=_[_0xd138('0x17')](config[_0xd138('0x18')],{'host':_0xd138('0x19'),'port':0x18eb});var socket=require(_0xd138('0x1a'))(new Redis(config[_0xd138('0x18')]));require(_0xd138('0x1b'))[_0xd138('0x1c')](socket);var jayson=require(_0xd138('0x1d'));var client=jayson[_0xd138('0x1e')][_0xd138('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0xf89f0f,_0x473079,_0x3a6760,_0x55c7bf){return new BPromise(function(_0x54ff81,_0xc812ab){var _0x253262=_0x55c7bf||client;return _0x253262['request'](_0xf89f0f,_0x3a6760)['then'](function(_0x22976b){logger['info']('SmsAccount,\x20%s,\x20%s',_0x473079,_0xd138('0x20'));logger[_0xd138('0x21')](_0xd138('0x22'),_0x473079,_0xd138('0x20'),JSON[_0xd138('0x23')](_0x22976b));if(_0x22976b['error']){if(_0x22976b['error'][_0xd138('0x24')]===0x1f4){logger[_0xd138('0x25')]('SmsAccount,\x20%s,\x20%s',_0x473079,_0x22976b[_0xd138('0x25')]['message']);return _0xc812ab(_0x22976b[_0xd138('0x25')][_0xd138('0x26')]);}logger[_0xd138('0x25')](_0xd138('0x27'),_0x473079,_0x22976b['error'][_0xd138('0x26')]);return _0x54ff81(_0x22976b['error'][_0xd138('0x26')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x473079,_0xd138('0x20'));_0x54ff81(_0x22976b[_0xd138('0x28')][_0xd138('0x26')]);}})[_0xd138('0x29')](function(_0x3ec95f){logger[_0xd138('0x25')]('SmsAccount,\x20%s,\x20%s',_0x473079,_0x3ec95f);_0xc812ab(_0x3ec95f);});});}function respondWithStatusCode(_0x54a75e,_0x3a5b19){_0x3a5b19=_0x3a5b19||0xcc;return function(_0x2d82cd){if(_0x2d82cd){return _0x54a75e['sendStatus'](_0x3a5b19);}return _0x54a75e[_0xd138('0x2a')](_0x3a5b19)[_0xd138('0x2b')]();};}function respondWithResult(_0x59e0a4,_0x1a1c65){_0x1a1c65=_0x1a1c65||0xc8;return function(_0xa5b49b){if(_0xa5b49b){return _0x59e0a4[_0xd138('0x2a')](_0x1a1c65)[_0xd138('0x2c')](_0xa5b49b);}};}function respondWithFilteredResult(_0x2f9b6,_0x4427da){return function(_0x4497ed){if(_0x4497ed){var _0x3da0d=_0x4497ed[_0xd138('0x2d')],_0x12856e=_0x4427da['offset'],_0x200c82=_0x4427da[_0xd138('0x2e')]+_0x4427da[_0xd138('0x2f')],_0x177b93;if(_0x200c82>=_0x3da0d){_0x200c82=_0x3da0d;_0x177b93=0xc8;}else{_0x177b93=0xce;}_0x2f9b6[_0xd138('0x2a')](_0x177b93);return _0x2f9b6[_0xd138('0x30')](_0xd138('0x31'),_0x12856e+'-'+_0x200c82+'/'+_0x3da0d)[_0xd138('0x2c')](_0x4497ed);}return null;};}function patchUpdates(_0xfe92fb){return function(_0x28493d){try{jsonpatch[_0xd138('0x32')](_0x28493d,_0xfe92fb,!![]);}catch(_0x384ff3){return BPromise[_0xd138('0x33')](_0x384ff3);}return _0x28493d['save']();};}function saveUpdates(_0x4e99d2,_0x27b4b0){return function(_0x5a4bfc){if(_0x5a4bfc){return _0x5a4bfc[_0xd138('0x34')](_0x4e99d2)['then'](function(_0xc7c622){return _0xc7c622;});}return null;};}function removeEntity(_0x1c15b2,_0x309523){return function(_0x3968d6){if(_0x3968d6){return _0x3968d6[_0xd138('0x35')]()['then'](function(){var _0x3ea9a2=_0x3968d6['get']({'plain':!![]});var _0x28d6bc='SmsAccounts';return db[_0xd138('0x36')][_0xd138('0x35')]({'where':{'type':_0x28d6bc,'resourceId':_0x3ea9a2['id']}})[_0xd138('0x37')](function(){return _0x3968d6;});})[_0xd138('0x37')](function(){_0x1c15b2['status'](0xcc)[_0xd138('0x2b')]();});}};}function handleEntityNotFound(_0x18c6a4,_0x40790c){return function(_0x39f6de){if(!_0x39f6de){_0x18c6a4[_0xd138('0x38')](0x194);}return _0x39f6de;};}function handleError(_0x56cbc9,_0xbca792){_0xbca792=_0xbca792||0x1f4;return function(_0x911737){logger[_0xd138('0x25')](_0x911737[_0xd138('0x39')]);if(_0x911737[_0xd138('0x3a')]){delete _0x911737[_0xd138('0x3a')];}_0x56cbc9[_0xd138('0x2a')](_0xbca792)['send'](_0x911737);};}exports[_0xd138('0x3b')]=function(_0x49cd4f,_0x5ec29b){var _0x24aa4b={'include':[{'model':db[_0xd138('0x3c')],'as':_0xd138('0x3d')}]},_0x415498={},_0xb985b0={'count':0x0,'rows':[]};var _0x450f18=_['map'](db[_0xd138('0x3e')][_0xd138('0x3f')],function(_0x50406d){return{'name':_0x50406d[_0xd138('0x40')],'type':_0x50406d['type'][_0xd138('0x41')]};});_0x415498[_0xd138('0x42')]=_['map'](_0x450f18,_0xd138('0x3a'));_0x415498['query']=_[_0xd138('0x43')](_0x49cd4f[_0xd138('0x44')]);_0x415498[_0xd138('0x45')]=_[_0xd138('0x46')](_0x415498[_0xd138('0x42')],_0x415498[_0xd138('0x44')]);_0x24aa4b[_0xd138('0x47')]=_[_0xd138('0x46')](_0x415498[_0xd138('0x42')],qs[_0xd138('0x48')](_0x49cd4f['query']['fields']));_0x24aa4b['attributes']=_0x24aa4b[_0xd138('0x47')][_0xd138('0x49')]?_0x24aa4b['attributes']:_0x415498['model'];if(!_0x49cd4f[_0xd138('0x44')][_0xd138('0x4a')](_0xd138('0x4b'))){_0x24aa4b[_0xd138('0x2f')]=qs[_0xd138('0x2f')](_0x49cd4f[_0xd138('0x44')][_0xd138('0x2f')]);_0x24aa4b['offset']=qs[_0xd138('0x2e')](_0x49cd4f[_0xd138('0x44')]['offset']);}_0x24aa4b[_0xd138('0x4c')]=qs[_0xd138('0x4d')](_0x49cd4f['query'][_0xd138('0x4d')]);_0x24aa4b['where']=qs[_0xd138('0x45')](_['pick'](_0x49cd4f['query'],_0x415498[_0xd138('0x45')]),_0x450f18);if(_0x49cd4f[_0xd138('0x44')][_0xd138('0x4e')]){_0x24aa4b['where']=_[_0xd138('0x4f')](_0x24aa4b[_0xd138('0x50')],{'$or':_[_0xd138('0x51')](_0x450f18,function(_0x368e8f){if(_0x368e8f[_0xd138('0x52')]!==_0xd138('0x53')){var _0x12908d={};_0x12908d[_0x368e8f['name']]={'$like':'%'+_0x49cd4f['query'][_0xd138('0x4e')]+'%'};return _0x12908d;}})});}_0x24aa4b=_[_0xd138('0x4f')]({},_0x24aa4b,_0x49cd4f[_0xd138('0x54')]);var _0x5b0e39={'where':_0x24aa4b[_0xd138('0x50')]};return db[_0xd138('0x3e')][_0xd138('0x2d')](_0x5b0e39)['then'](function(_0x24b75d){_0xb985b0[_0xd138('0x2d')]=_0x24b75d;if(_0x49cd4f['query'][_0xd138('0x55')]){_0x24aa4b[_0xd138('0x56')]=[{'all':!![]}];}return db[_0xd138('0x3e')][_0xd138('0x57')](_0x24aa4b);})['then'](function(_0x1f4f75){_0xb985b0['rows']=_0x1f4f75;return _0xb985b0;})[_0xd138('0x37')](respondWithFilteredResult(_0x5ec29b,_0x24aa4b))[_0xd138('0x29')](handleError(_0x5ec29b,null));};exports[_0xd138('0x58')]=function(_0x2816ac,_0x756304){var _0x35679d={'raw':![],'where':{'id':_0x2816ac[_0xd138('0x59')]['id']},'include':[{'model':db[_0xd138('0x3c')],'as':_0xd138('0x3d')}]},_0x37b931={};_0x37b931[_0xd138('0x42')]=_[_0xd138('0x43')](db[_0xd138('0x3e')][_0xd138('0x3f')]);_0x37b931[_0xd138('0x44')]=_['keys'](_0x2816ac[_0xd138('0x44')]);_0x37b931['filters']=_[_0xd138('0x46')](_0x37b931['model'],_0x37b931[_0xd138('0x44')]);_0x35679d[_0xd138('0x47')]=_[_0xd138('0x46')](_0x37b931['model'],qs[_0xd138('0x48')](_0x2816ac[_0xd138('0x44')][_0xd138('0x48')]));_0x35679d[_0xd138('0x47')]=_0x35679d[_0xd138('0x47')][_0xd138('0x49')]?_0x35679d[_0xd138('0x47')]:_0x37b931['model'];if(_0x2816ac[_0xd138('0x44')][_0xd138('0x55')]){_0x35679d[_0xd138('0x56')]=[{'all':!![]}];}_0x35679d=_[_0xd138('0x4f')]({},_0x35679d,_0x2816ac[_0xd138('0x54')]);return db[_0xd138('0x3e')]['find'](_0x35679d)[_0xd138('0x37')](handleEntityNotFound(_0x756304,null))[_0xd138('0x37')](respondWithResult(_0x756304,null))['catch'](handleError(_0x756304,null));};exports['create']=function(_0x3c3a3b,_0x35e9e3){return db[_0xd138('0x3e')][_0xd138('0x5a')](_0x3c3a3b[_0xd138('0x5b')],{})[_0xd138('0x37')](function(_0x3ededb){var _0x49f86a=_0x3c3a3b[_0xd138('0x5c')][_0xd138('0x5d')]({'plain':!![]});if(!_0x49f86a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49f86a[_0xd138('0x5e')]===_0xd138('0x5c')){var _0x1e16ab=_0x3ededb[_0xd138('0x5d')]({'plain':!![]});var _0x142ab2=_0xd138('0x5f');return db['UserProfileSection'][_0xd138('0x60')]({'where':{'name':_0x142ab2,'userProfileId':_0x49f86a[_0xd138('0x61')]},'raw':!![]})[_0xd138('0x37')](function(_0x15c5ba){if(_0x15c5ba&&_0x15c5ba[_0xd138('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x1e16ab[_0xd138('0x3a')],'resourceId':_0x1e16ab['id'],'type':_0x15c5ba[_0xd138('0x3a')],'sectionId':_0x15c5ba['id']},{})[_0xd138('0x37')](function(){return _0x3ededb;});}else{return _0x3ededb;}})[_0xd138('0x29')](function(_0x48e5e1){logger[_0xd138('0x25')](_0xd138('0x63'),_0x48e5e1);throw _0x48e5e1;});}return _0x3ededb;})['then'](respondWithResult(_0x35e9e3,0xc9))['catch'](handleError(_0x35e9e3,null));};exports[_0xd138('0x34')]=function(_0x29fd2a,_0x1718e1){if(_0x29fd2a['body']['id']){delete _0x29fd2a[_0xd138('0x5b')]['id'];}return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x29fd2a[_0xd138('0x59')]['id']},'include':[{'model':db[_0xd138('0x3c')],'as':_0xd138('0x3d')}]})['then'](handleEntityNotFound(_0x1718e1,null))[_0xd138('0x37')](saveUpdates(_0x29fd2a[_0xd138('0x5b')],null))[_0xd138('0x37')](respondWithResult(_0x1718e1,null))[_0xd138('0x29')](handleError(_0x1718e1,null));};exports[_0xd138('0x35')]=function(_0x22855a,_0x7e15af){return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x22855a[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x7e15af,null))[_0xd138('0x37')](removeEntity(_0x7e15af,null))[_0xd138('0x29')](handleError(_0x7e15af,null));};exports[_0xd138('0x64')]=function(_0x4dc8a4,_0x4b00fa){return db[_0xd138('0x3e')][_0xd138('0x64')]()['then'](respondWithResult(_0x4b00fa,null))[_0xd138('0x29')](handleError(_0x4b00fa,null));};exports[_0xd138('0x65')]=function(_0x2b5a03,_0x2d50da,_0x3b731b){if(_0x2b5a03[_0xd138('0x5b')]['id']){delete _0x2b5a03[_0xd138('0x5b')]['id'];}return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x2b5a03[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x2d50da,null))[_0xd138('0x37')](function(_0xc7df72){if(_0xc7df72){_0x2b5a03['body'][_0xd138('0x66')]=_0xc7df72['id'];return db[_0xd138('0x67')][_0xd138('0x5a')](_0x2b5a03[_0xd138('0x5b')]);}})[_0xd138('0x37')](respondWithResult(_0x2d50da,null))[_0xd138('0x29')](handleError(_0x2d50da,null));};exports[_0xd138('0x68')]=function(_0x3bee1d,_0xfe5a10,_0x9489fc){var _0x11a87b={'raw':![],'where':{}};var _0xd4e6c9={};var _0x42ea09={'count':0x0,'rows':[]};return db[_0xd138('0x3e')][_0xd138('0x69')]({'where':{'id':_0x3bee1d[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0xfe5a10,null))[_0xd138('0x37')](function(_0x217bc1){if(_0x217bc1){_0xd4e6c9[_0xd138('0x42')]=_[_0xd138('0x43')](db[_0xd138('0x67')][_0xd138('0x3f')]);_0xd4e6c9[_0xd138('0x44')]=_[_0xd138('0x43')](_0x3bee1d[_0xd138('0x44')]);_0xd4e6c9[_0xd138('0x45')]=_[_0xd138('0x46')](_0xd4e6c9[_0xd138('0x42')],_0xd4e6c9[_0xd138('0x44')]);_0x11a87b[_0xd138('0x47')]=_[_0xd138('0x46')](_0xd4e6c9['model'],qs[_0xd138('0x48')](_0x3bee1d[_0xd138('0x44')][_0xd138('0x48')]));_0x11a87b[_0xd138('0x47')]=_0x11a87b[_0xd138('0x47')][_0xd138('0x49')]?_0x11a87b[_0xd138('0x47')]:_0xd4e6c9[_0xd138('0x42')];if(!_0x3bee1d['query']['hasOwnProperty'](_0xd138('0x4b'))){_0x11a87b[_0xd138('0x2f')]=qs[_0xd138('0x2f')](_0x3bee1d[_0xd138('0x44')][_0xd138('0x2f')]);_0x11a87b[_0xd138('0x2e')]=qs[_0xd138('0x2e')](_0x3bee1d['query']['offset']);}_0x11a87b[_0xd138('0x4c')]=qs[_0xd138('0x4d')](_0x3bee1d[_0xd138('0x44')]['sort']);_0x11a87b['where']=qs[_0xd138('0x45')](_['pick'](_0x3bee1d[_0xd138('0x44')],_0xd4e6c9[_0xd138('0x45')]));_0x11a87b[_0xd138('0x50')]['SmsAccountId']=_0x217bc1['id'];if(_0x3bee1d[_0xd138('0x44')]['filter']){_0x11a87b[_0xd138('0x50')]=_[_0xd138('0x4f')](_0x11a87b[_0xd138('0x50')],{'$or':_[_0xd138('0x51')](_0x11a87b[_0xd138('0x47')],function(_0x29b4f8){var _0x281478={};_0x281478[_0x29b4f8]={'$like':'%'+_0x3bee1d[_0xd138('0x44')][_0xd138('0x4e')]+'%'};return _0x281478;})});}_0x11a87b=_[_0xd138('0x4f')]({},_0x11a87b,_0x3bee1d['options']);return db[_0xd138('0x67')][_0xd138('0x2d')]({'where':_0x11a87b[_0xd138('0x50')]})['then'](function(_0x4c2277){_0x42ea09[_0xd138('0x2d')]=_0x4c2277;if(_0x3bee1d[_0xd138('0x44')][_0xd138('0x55')]){_0x11a87b['include']=[{'all':!![]}];}return db[_0xd138('0x67')][_0xd138('0x57')](_0x11a87b);})[_0xd138('0x37')](function(_0x2bd6a2){_0x42ea09['rows']=_0x2bd6a2;return _0x42ea09;});}})[_0xd138('0x37')](respondWithFilteredResult(_0xfe5a10,_0x11a87b))[_0xd138('0x29')](handleError(_0xfe5a10,null));};exports[_0xd138('0x6a')]=function(_0x422e69,_0x7424f4,_0x38a108){return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x422e69[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x7424f4,null))[_0xd138('0x37')](function(_0x5e4823){if(_0x5e4823){return _0x5e4823[_0xd138('0x6a')](_0x422e69['query'][_0xd138('0x6b')]);}})[_0xd138('0x37')](respondWithStatusCode(_0x7424f4,null))[_0xd138('0x29')](handleError(_0x7424f4,null));};exports[_0xd138('0x6c')]=function(_0x3277fa,_0x4c1407,_0x2bbecd){if(_0x3277fa['body']['id']){delete _0x3277fa['body']['id'];}return db['SmsAccount'][_0xd138('0x60')]({'where':{'id':_0x3277fa[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x4c1407,null))[_0xd138('0x37')](function(_0x9fc03c){if(_0x9fc03c){_0x3277fa['body'][_0xd138('0x66')]=_0x9fc03c['id'];return db['CannedAnswer'][_0xd138('0x5a')](_0x3277fa[_0xd138('0x5b')]);}})['then'](respondWithResult(_0x4c1407,null))[_0xd138('0x29')](handleError(_0x4c1407,null));};exports['getAnswers']=function(_0x4a443f,_0x4e7419,_0x44ffdc){var _0x2b6350={'raw':![],'where':{}};var _0x2870c4={};var _0xbde71d={'count':0x0,'rows':[]};return db[_0xd138('0x3e')][_0xd138('0x69')]({'where':{'id':_0x4a443f[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x4e7419,null))[_0xd138('0x37')](function(_0x19c345){if(_0x19c345){_0x2870c4[_0xd138('0x42')]=_[_0xd138('0x43')](db[_0xd138('0x6d')][_0xd138('0x3f')]);_0x2870c4[_0xd138('0x44')]=_[_0xd138('0x43')](_0x4a443f[_0xd138('0x44')]);_0x2870c4[_0xd138('0x45')]=_[_0xd138('0x46')](_0x2870c4[_0xd138('0x42')],_0x2870c4[_0xd138('0x44')]);_0x2b6350['attributes']=_[_0xd138('0x46')](_0x2870c4['model'],qs['fields'](_0x4a443f['query'][_0xd138('0x48')]));_0x2b6350[_0xd138('0x47')]=_0x2b6350['attributes']['length']?_0x2b6350[_0xd138('0x47')]:_0x2870c4['model'];if(!_0x4a443f[_0xd138('0x44')][_0xd138('0x4a')](_0xd138('0x4b'))){_0x2b6350[_0xd138('0x2f')]=qs['limit'](_0x4a443f[_0xd138('0x44')][_0xd138('0x2f')]);_0x2b6350[_0xd138('0x2e')]=qs['offset'](_0x4a443f[_0xd138('0x44')]['offset']);}_0x2b6350[_0xd138('0x4c')]=qs['sort'](_0x4a443f['query'][_0xd138('0x4d')]);_0x2b6350[_0xd138('0x50')]=qs['filters'](_[_0xd138('0x6e')](_0x4a443f['query'],_0x2870c4[_0xd138('0x45')]));_0x2b6350['where'][_0xd138('0x66')]=_0x19c345['id'];if(_0x4a443f['query'][_0xd138('0x4e')]){_0x2b6350[_0xd138('0x50')]=_[_0xd138('0x4f')](_0x2b6350['where'],{'$or':_[_0xd138('0x51')](_0x2b6350[_0xd138('0x47')],function(_0xf7819){var _0x2e8932={};_0x2e8932[_0xf7819]={'$like':'%'+_0x4a443f[_0xd138('0x44')][_0xd138('0x4e')]+'%'};return _0x2e8932;})});}_0x2b6350=_[_0xd138('0x4f')]({},_0x2b6350,_0x4a443f[_0xd138('0x54')]);return db[_0xd138('0x6d')][_0xd138('0x2d')]({'where':_0x2b6350[_0xd138('0x50')]})[_0xd138('0x37')](function(_0x3692cd){_0xbde71d['count']=_0x3692cd;if(_0x4a443f[_0xd138('0x44')][_0xd138('0x55')]){_0x2b6350[_0xd138('0x56')]=[{'all':!![]}];}return db[_0xd138('0x6d')][_0xd138('0x57')](_0x2b6350);})[_0xd138('0x37')](function(_0x1931cd){_0xbde71d['rows']=_0x1931cd;return _0xbde71d;});}})[_0xd138('0x37')](respondWithFilteredResult(_0x4e7419,_0x2b6350))[_0xd138('0x29')](handleError(_0x4e7419,null));};exports[_0xd138('0x6f')]=function(_0x2be671,_0x4c26f3,_0x585450){return db[_0xd138('0x3e')]['find']({'where':{'id':_0x2be671[_0xd138('0x59')]['id']}})['then'](handleEntityNotFound(_0x4c26f3,null))['then'](function(_0x2152dc){if(_0x2152dc){return _0x2152dc[_0xd138('0x6f')](_0x2be671[_0xd138('0x44')][_0xd138('0x6b')]);}})[_0xd138('0x37')](respondWithStatusCode(_0x4c26f3,null))[_0xd138('0x29')](handleError(_0x4c26f3,null));};exports[_0xd138('0x70')]=function(_0x4c49a3,_0x4c64ce,_0x1739f7){var _0x513c27={'channel':_0xd138('0x71')};var _0x5b8915=[];var _0x4d6423=[];var _0x265036={};return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x4c49a3['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0xd138('0x72')}]})[_0xd138('0x37')](handleEntityNotFound(_0x4c64ce,null))['then'](function(_0x3e0a4f){_0x513c27[_0xd138('0x73')]=_0x3e0a4f;_0x513c27[_0xd138('0x74')]=_[_0xd138('0x75')](_0x3e0a4f[_0xd138('0x72')],[_0xd138('0x76')],[_0xd138('0x77')]);if(_0x513c27['account'][_0xd138('0x72')]){delete _0x513c27[_0xd138('0x73')][_0xd138('0x72')];}return db[_0xd138('0x78')]['describe']();})[_0xd138('0x37')](function(_0x226516){if(!_0x226516){throw new db[(_0xd138('0x79'))][(_0xd138('0x7a'))](_0xd138('0x7b'));}_0x5b8915=_['difference'](_[_0xd138('0x43')](_0x226516),['createdAt',_0xd138('0x7c')]);_0x4d6423=_[_0xd138('0x7d')](_[_0xd138('0x43')](_0x226516),['createdAt',_0xd138('0x7c'),_0xd138('0x7e'),'ListId']);_0x513c27[_0xd138('0x5b')]={'mapKey':_0xd138('0x7f')};if(_0x513c27[_0xd138('0x73')][_0xd138('0x52')]){switch(_0x513c27['account']['type']){case _0xd138('0x80'):_0x513c27[_0xd138('0x5b')][_0xd138('0x81')]=_0x4c49a3['body'][_0xd138('0x82')];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')]['Body'];_0x513c27['body'][_0xd138('0x83')]=_0x4c49a3[_0xd138('0x5b')]['MessageSid'];break;case'skebby':_0x513c27[_0xd138('0x5b')][_0xd138('0x81')]='+'+_0x4c49a3['body']['sender'];_0x513c27['body'][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x84')];break;case'connectel':_0x513c27['body']['from']=_0x4c49a3[_0xd138('0x5b')]['from'];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x26')];break;case _0xd138('0x85'):_0x513c27[_0xd138('0x5b')][_0xd138('0x81')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x81')];_0x513c27['body'][_0xd138('0x5b')]=_0x4c49a3['body'][_0xd138('0x5b')];_0x513c27[_0xd138('0x5b')][_0xd138('0x83')]=_0x4c49a3['body'][_0xd138('0x86')];break;case _0xd138('0x87'):_0x513c27[_0xd138('0x5b')][_0xd138('0x81')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x82')];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x88')];_0x513c27[_0xd138('0x5b')][_0xd138('0x83')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x89')];break;case _0xd138('0x8a'):_0x513c27[_0xd138('0x5b')][_0xd138('0x81')]='+'+_0x4c49a3[_0xd138('0x5b')][_0xd138('0x8b')][0x0][_0xd138('0x81')];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3['body']['results'][0x0]['text'];_0x513c27[_0xd138('0x5b')][_0xd138('0x83')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x8b')][0x0][_0xd138('0x83')];break;case _0xd138('0x8c'):_0x513c27['body'][_0xd138('0x81')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x8d')];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x8e')]['message'];break;case _0xd138('0x8f'):_0x513c27[_0xd138('0x5b')]['from']=_0x4c49a3[_0xd138('0x5b')]['fromNumber'];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x84')];_0x513c27['body'][_0xd138('0x83')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x90')];break;case'bandwidth':_0x513c27['body']['messageId']=_0x4c49a3[_0xd138('0x5b')][0x0]['message']['id'];_0x513c27[_0xd138('0x5b')][_0xd138('0x81')]=_0x4c49a3[_0xd138('0x5b')][0x0][_0xd138('0x26')][_0xd138('0x81')];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')][0x0][_0xd138('0x26')][_0xd138('0x84')];break;case _0xd138('0x91'):_0x513c27['body'][_0xd138('0x81')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x81')];_0x513c27[_0xd138('0x5b')]['body']=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x26')];_0x513c27[_0xd138('0x5b')]['messageId']=_0x4c49a3[_0xd138('0x5b')]['refid'];break;}}if(_0x513c27[_0xd138('0x5b')]['id']){delete _0x513c27[_0xd138('0x5b')]['id'];}if(_[_0xd138('0x92')](_0x513c27[_0xd138('0x5b')][_0xd138('0x81')])){throw new db['Sequelize'][(_0xd138('0x7a'))](_0xd138('0x93'));}if(_[_0xd138('0x92')](_0x513c27['body'][_0xd138('0x5b')])||_0x513c27['body'][_0xd138('0x5b')]===''){throw new db[(_0xd138('0x79'))][(_0xd138('0x7a'))](_0xd138('0x94'));}if(_[_0xd138('0x92')](_0x513c27[_0xd138('0x5b')]['mapKey'])){throw new db['Sequelize'][(_0xd138('0x7a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d6423);}if(!_[_0xd138('0x95')](_0x4d6423,_0x513c27[_0xd138('0x5b')][_0xd138('0x96')])){throw new db['Sequelize'][(_0xd138('0x7a'))](_0xd138('0x97')+_0x4d6423);}_0x265036[_0x513c27[_0xd138('0x5b')]['mapKey']]=_0x513c27[_0xd138('0x5b')]['from'];return db[_0xd138('0x98')]['find']({'where':{'id':_0x513c27[_0xd138('0x73')][_0xd138('0x99')]},'include':[{'model':db[_0xd138('0x78')],'as':_0xd138('0x9a'),'where':_0x265036,'limit':0x1,'order':[[_0xd138('0x7c'),'DESC']]}]});})[_0xd138('0x37')](handleEntityNotFound(_0x4c64ce,null))['then'](function(_0x17d468){if(_0x17d468){_0x513c27[_0xd138('0x9b')]=_[_0xd138('0x9c')](_0x17d468,[_0xd138('0x9a')]);if(_0x17d468[_0xd138('0x9a')][_0xd138('0x49')]){return _0x17d468['Contacts'][0x0];}var _0x182520=_[_0xd138('0x17')](_0x513c27[_0xd138('0x5b')],{'firstName':_0x513c27[_0xd138('0x5b')][_0xd138('0x81')],'ListId':_0x17d468['id']});_0x182520[_0x513c27[_0xd138('0x5b')][_0xd138('0x96')]]=_0x513c27[_0xd138('0x5b')][_0xd138('0x81')];return db['CmContact'][_0xd138('0x5a')](_0x182520,{'fields':_0x5b8915,'raw':!![]});}})['then'](handleEntityNotFound(_0x4c64ce,null))[_0xd138('0x37')](function(_0x1d9eec){if(_0x1d9eec){_0x513c27[_0xd138('0x9d')]=_0x1d9eec;var _0x4ae830={'ContactId':_0x1d9eec['id'],'phone':_0x513c27[_0xd138('0x5b')][_0xd138('0x81')],'SmsAccountId':_0x4c49a3[_0xd138('0x59')]['id']};var _0x234e50={'ContactId':_0x1d9eec['id'],'SmsAccountId':_0x4c49a3[_0xd138('0x59')]['id'],'closed':![]};return db['SmsInteraction'][_0xd138('0x60')]({'where':_0x234e50})['then'](function(_0x49cf36){if(_0x49cf36){return[_0x49cf36,![]];}return db['SmsInteraction'][_0xd138('0x5a')](_0x4ae830)[_0xd138('0x37')](function(_0x2465a4){return[_0x2465a4,!![]];});});}})[_0xd138('0x9e')](function(_0x32942b,_0x10ac01){_0x513c27['interaction']=_0x32942b[_0xd138('0x5d')]({'plain':!![]});_0x513c27[_0xd138('0x9f')][_0xd138('0xa0')]=![];if(_0x10ac01){if(_0x513c27[_0xd138('0x73')][_0xd138('0xa1')]){_0x513c27[_0xd138('0x74')][_0xd138('0xa2')]({'id':0x0,'priority':_0x513c27[_0xd138('0x74')]['length']+0x1,'app':_0xd138('0xa3'),'appdata':'unmanaged','interval':_0xd138('0xa4')});}_0x513c27['interaction'][_0xd138('0xa0')]=!![];}return db['SmsMessage']['create']({'phone':_0x513c27[_0xd138('0x5b')][_0xd138('0x81')],'messageId':_0x513c27[_0xd138('0x5b')][_0xd138('0x83')],'body':_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')],'SmsAccountId':_0x4c49a3[_0xd138('0x59')]['id'],'SmsInteractionId':_0x32942b['id'],'direction':'in','ContactId':_0x32942b['ContactId'],'AttachmentId':_0x513c27[_0xd138('0x5b')][_0xd138('0xa5')]});})[_0xd138('0x37')](function(_0x125fdf){_0x513c27[_0xd138('0x26')]=_0x125fdf;if(_0x513c27[_0xd138('0x9f')][_0xd138('0xa6')]){return db[_0xd138('0xa7')][_0xd138('0x60')]({'attributes':['id',_0xd138('0x3a')],'where':{'id':_0x513c27[_0xd138('0x9f')][_0xd138('0xa6')]}})['then'](function(_0x12750a){if(_0x12750a){_0x513c27[_0xd138('0x74')][_0xd138('0xa8')]({'id':0x0,'priority':0x0,'app':_0xd138('0xa9'),'appdata':_0x12750a[_0xd138('0x3a')]+','+(_0x513c27[_0xd138('0x73')][_0xd138('0xaa')]||0xa),'interval':_0xd138('0xa4')});}return respondWithRpcPromise(_0xd138('0xab'),_0xd138('0xac'),_0x513c27);});}return respondWithRpcPromise('Start',_0xd138('0xac'),_0x513c27);})[_0xd138('0x37')](function(_0x53969f){if(_0x53969f){var _0x3f1157=0xc8;var _0x507805=_0xd138('0xad');logger[_0xd138('0xae')](_0xd138('0x22'),_0x507805,_0x3f1157,_0xd138('0xaf'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x507805,_0x3f1157,'entity\x20found',JSON['stringify'](_0x53969f));if(_0x513c27[_0xd138('0x73')][_0xd138('0x52')]==='twilio'){return _0x4c64ce[_0xd138('0x2a')](_0x3f1157)['set'](_0xd138('0xb0'),'text/xml')[_0xd138('0xb1')]('\x0a');}else{return _0x4c64ce[_0xd138('0x2a')](_0x3f1157)['json'](_0x53969f);}}})['catch'](handleError(_0x4c64ce,null));};exports[_0xd138('0xb2')]=function(_0x1ffad8,_0xc20f9a,_0xb09410){return db[_0xd138('0x3e')]['findOne']({'where':{'id':_0x1ffad8[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0xc20f9a,null))[_0xd138('0x37')](function(_0x343ca1){if(_0x343ca1){return db[_0xd138('0xb3')][_0xd138('0xb4')](function(_0x363e3b){return db[_0xd138('0xb5')][_0xd138('0x35')]({'where':{'SmsAccountId':_0x1ffad8[_0xd138('0x59')]['id']},'transaction':_0x363e3b})[_0xd138('0x37')](function(_0x210045){var _0x15e53a=_[_0xd138('0x51')](_0x1ffad8['body'],function(_0x2c7640){_0x2c7640['SmsAccountId']=_0x1ffad8[_0xd138('0x59')]['id'];return _0x2c7640;});return db[_0xd138('0xb5')][_0xd138('0xb6')](_0x15e53a,{'transaction':_0x363e3b});});})['then'](function(){return db[_0xd138('0xb5')][_0xd138('0xb7')]({'where':{'SmsAccountId':_0x1ffad8[_0xd138('0x59')]['id']},'order':_0xd138('0x76')});});}})[_0xd138('0x37')](respondWithResult(_0xc20f9a,null))[_0xd138('0x29')](handleError(_0xc20f9a,null));};exports[_0xd138('0xb8')]=function(_0x2216d5,_0x2293a0,_0xc15dfa){var _0x3b6bff={};var _0x4c3034={};var _0x4e90d9;var _0x937162;return db[_0xd138('0x3e')]['findOne']({'where':{'id':_0x2216d5[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x2293a0,null))[_0xd138('0x37')](function(_0x548c37){if(_0x548c37){_0x4e90d9=_0x548c37;_0x4c3034[_0xd138('0x42')]=_[_0xd138('0x43')](db[_0xd138('0xb5')][_0xd138('0x3f')]);_0x4c3034[_0xd138('0x44')]=_[_0xd138('0x43')](_0x2216d5[_0xd138('0x44')]);_0x4c3034[_0xd138('0x45')]=_['intersection'](_0x4c3034['model'],_0x4c3034['query']);_0x3b6bff[_0xd138('0x47')]=_[_0xd138('0x46')](_0x4c3034[_0xd138('0x42')],qs['fields'](_0x2216d5['query']['fields']));_0x3b6bff[_0xd138('0x47')]=_0x3b6bff[_0xd138('0x47')][_0xd138('0x49')]?_0x3b6bff[_0xd138('0x47')]:_0x4c3034['model'];_0x3b6bff[_0xd138('0x4c')]=qs['sort'](_0x2216d5[_0xd138('0x44')][_0xd138('0x4d')]);_0x3b6bff['where']=qs['filters'](_[_0xd138('0x6e')](_0x2216d5[_0xd138('0x44')],_0x4c3034[_0xd138('0x45')]));if(_0x2216d5['query']['filter']){_0x3b6bff[_0xd138('0x50')]=_[_0xd138('0x4f')](_0x3b6bff['where'],{'$or':_[_0xd138('0x51')](_0x3b6bff[_0xd138('0x47')],function(_0x1faed8){var _0x2ad511={};_0x2ad511[_0x1faed8]={'$like':'%'+_0x2216d5[_0xd138('0x44')][_0xd138('0x4e')]+'%'};return _0x2ad511;})});}_0x3b6bff=_[_0xd138('0x4f')]({},_0x3b6bff,_0x2216d5[_0xd138('0x54')]);return _0x4e90d9['getApplications'](_0x3b6bff);}})[_0xd138('0x37')](function(_0x4c9118){if(_0x4c9118){_0x937162=_0x4c9118[_0xd138('0x49')];if(!_0x2216d5[_0xd138('0x44')][_0xd138('0x4a')](_0xd138('0x4b'))){_0x3b6bff[_0xd138('0x2f')]=qs['limit'](_0x2216d5[_0xd138('0x44')]['limit']);_0x3b6bff[_0xd138('0x2e')]=qs[_0xd138('0x2e')](_0x2216d5[_0xd138('0x44')]['offset']);}return _0x4e90d9['getApplications'](_0x3b6bff);}})[_0xd138('0x37')](function(_0x50f622){if(_0x50f622){return _0x50f622?{'count':_0x937162,'rows':_0x50f622}:null;}})['then'](respondWithResult(_0x2293a0,null))['catch'](handleError(_0x2293a0,null));};exports[_0xd138('0xb9')]=function(_0x34a561,_0x3b5c9a,_0x164454){var _0x24f5ae={'raw':![],'where':{}};var _0x34ab70={};var _0x1bb2bc={'count':0x0,'rows':[]};return db[_0xd138('0x3e')][_0xd138('0x69')]({'where':{'id':_0x34a561[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x3b5c9a,null))['then'](function(_0x8c4c32){if(_0x8c4c32){_0x34ab70[_0xd138('0x42')]=_[_0xd138('0x43')](db[_0xd138('0xba')][_0xd138('0x3f')]);_0x34ab70[_0xd138('0x44')]=_['keys'](_0x34a561['query']);_0x34ab70[_0xd138('0x45')]=_[_0xd138('0x46')](_0x34ab70[_0xd138('0x42')],_0x34ab70['query']);_0x24f5ae[_0xd138('0x47')]=_[_0xd138('0x46')](_0x34ab70[_0xd138('0x42')],qs[_0xd138('0x48')](_0x34a561[_0xd138('0x44')]['fields']));_0x24f5ae[_0xd138('0x47')]=_0x24f5ae['attributes'][_0xd138('0x49')]?_0x24f5ae[_0xd138('0x47')]:_0x34ab70[_0xd138('0x42')];if(!_0x34a561['query'][_0xd138('0x4a')]('nolimit')){_0x24f5ae[_0xd138('0x2f')]=qs[_0xd138('0x2f')](_0x34a561['query'][_0xd138('0x2f')]);_0x24f5ae['offset']=qs['offset'](_0x34a561['query'][_0xd138('0x2e')]);}_0x24f5ae['order']=qs['sort'](_0x34a561[_0xd138('0x44')]['sort']);_0x24f5ae[_0xd138('0x50')]=qs[_0xd138('0x45')](_[_0xd138('0x6e')](_0x34a561['query'],_0x34ab70[_0xd138('0x45')]));_0x24f5ae['where'][_0xd138('0x66')]=_0x8c4c32['id'];if(_0x34a561['query'][_0xd138('0x4e')]){_0x24f5ae['where']=_[_0xd138('0x4f')](_0x24f5ae[_0xd138('0x50')],{'$or':_['map'](_0x24f5ae['attributes'],function(_0x4324e0){var _0x510f1b={};_0x510f1b[_0x4324e0]={'$like':'%'+_0x34a561['query']['filter']+'%'};return _0x510f1b;})});}_0x24f5ae=_[_0xd138('0x4f')]({},_0x24f5ae,_0x34a561['options']);return db[_0xd138('0xba')][_0xd138('0x2d')]({'where':_0x24f5ae[_0xd138('0x50')]})['then'](function(_0x3faa75){_0x1bb2bc[_0xd138('0x2d')]=_0x3faa75;if(_0x34a561[_0xd138('0x44')][_0xd138('0x55')]){_0x24f5ae[_0xd138('0x56')]=[{'model':db[_0xd138('0x78')],'as':_0xd138('0xbb'),'required':![]},{'model':db[_0xd138('0xa7')],'as':_0xd138('0xbc'),'attributes':[_0xd138('0x3a'),_0xd138('0xbd'),_0xd138('0xbe')],'required':![]},{'model':db[_0xd138('0xbf')],'as':_0xd138('0xc0'),'attributes':['id',_0xd138('0x3a'),_0xd138('0xc1')],'where':_0x34a561[_0xd138('0x44')]['tag']?{'id':_0x34a561[_0xd138('0x44')][_0xd138('0xc2')]}:undefined,'required':_0x34a561[_0xd138('0x44')][_0xd138('0xc2')]?!![]:![]}];}return db[_0xd138('0xba')]['findAll'](_0x24f5ae);})[_0xd138('0x37')](function(_0x2a6784){_0x1bb2bc[_0xd138('0xc3')]=_0x2a6784;return _0x1bb2bc;});}})['then'](respondWithFilteredResult(_0x3b5c9a,_0x24f5ae))[_0xd138('0x29')](handleError(_0x3b5c9a,null));};exports['send']=function(_0x2baa39,_0x3387e1,_0x11ecc8){var _0x5e5cfa,_0x3140b4,_0x1987f6;if(_[_0xd138('0x92')](_0x2baa39[_0xd138('0x5b')][_0xd138('0x5b')])||_0x2baa39['body'][_0xd138('0x5b')]===''){throw new db[(_0xd138('0x79'))][(_0xd138('0x7a'))](_0xd138('0x94'));}if(_[_0xd138('0x92')](_0x2baa39[_0xd138('0x5b')]['to'])){throw new db[(_0xd138('0x79'))][(_0xd138('0x7a'))](_0xd138('0xc4'));}_0x5e5cfa=_0x2baa39[_0xd138('0x5b')]['to'];return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x2baa39[_0xd138('0x59')]['id']},'include':[{'model':db[_0xd138('0x98')],'as':_0xd138('0xc5'),'include':[{'model':db['CmContact'],'as':_0xd138('0x9a'),'where':{'mobile':_0x5e5cfa},'limit':0x1,'order':[[_0xd138('0x7c'),_0xd138('0xc6')]]}]}]})[_0xd138('0x37')](handleEntityNotFound(_0x3387e1,null))[_0xd138('0x37')](function(_0x46ad8b){if(_0x46ad8b&&_0x46ad8b[_0xd138('0xc5')]){_0x3140b4=_0x46ad8b['get']({'plain':!![]});if(_0x3140b4[_0xd138('0xc5')]&&_0x3140b4['List']['Contacts'][_0xd138('0x49')]){return _0x3140b4['List'][_0xd138('0x9a')][0x0];}return db['CmContact']['create'](_[_0xd138('0x17')](_0x2baa39[_0xd138('0x5b')],{'firstName':_0x5e5cfa,'mobile':_0x5e5cfa,'phone':_0x5e5cfa,'ListId':_0x3140b4[_0xd138('0x99')]}));}})['then'](handleEntityNotFound(_0x3387e1,null))[_0xd138('0x37')](function(_0xc7f21a){if(_0xc7f21a){_0x1987f6=_0xc7f21a;return db['SmsInteraction'][_0xd138('0x60')]({'where':{'ContactId':_0x1987f6['id'],'closed':![],'SmsAccountId':_0x3140b4['id']}})[_0xd138('0x37')](function(_0x515bda){if(_0x515bda){return[_0x515bda,![]];}return db[_0xd138('0xba')][_0xd138('0x5a')]({'UserId':_0x2baa39[_0xd138('0x5c')]['id'],'ContactId':_0x1987f6['id'],'SmsAccountId':_0x3140b4['id'],'phone':_0x5e5cfa,'firstMsgDirection':'out','Messages':[_[_0xd138('0x4f')](_0x2baa39[_0xd138('0x5b')],{'read':![],'body':_0x2baa39[_0xd138('0x5b')][_0xd138('0x5b')],'phone':_0x5e5cfa,'SmsAccountId':_0x3140b4['id'],'UserId':_0x2baa39['user']['id'],'ContactId':_0x1987f6['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xd138('0xc7')}]})['then'](function(_0x3bded0){return[_0x3bded0,!![]];});});}})[_0xd138('0x9e')](function(_0x5230f8,_0x893f10){if(_0x893f10){return _0x5230f8;}return db[_0xd138('0xc8')][_0xd138('0x5a')](_['merge'](_0x2baa39[_0xd138('0x5b')],{'read':![],'body':_0x2baa39['body'][_0xd138('0x5b')],'phone':_0x5e5cfa,'SmsAccountId':_0x3140b4['id'],'SmsInteractionId':_0x5230f8['id'],'UserId':_0x2baa39[_0xd138('0x5c')]['id'],'ContactId':_0x1987f6['id']}))[_0xd138('0x37')](function(_0x41fb00){_0x5230f8['dataValues'][_0xd138('0xc7')]=[];_0x5230f8[_0xd138('0xc9')]['Messages'][_0xd138('0xa2')](_0x41fb00[_0xd138('0xc9')]);return _0x5230f8;});})[_0xd138('0x37')](respondWithResult(_0x3387e1,null))['catch'](handleError(_0x3387e1,null));};exports[_0xd138('0x2a')]=function(_0x2d7c8f,_0x5f0f50,_0x4ef786){if(_0x2d7c8f[_0xd138('0x5b')]['id']){delete _0x2d7c8f[_0xd138('0x5b')]['id'];}var _0x445e82,_0x508284,_0x2a6fc1;return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x2d7c8f['params']['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x5f0f50,null))[_0xd138('0x37')](function(_0x5d53bb){if(_0x5d53bb){_0x2a6fc1=_0x5d53bb;logger[_0xd138('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd138('0x2a'),_0xd138('0xca'),_0x5d53bb[_0xd138('0x52')],util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));switch(_0x5d53bb[_0xd138('0x52')]){case _0xd138('0xcc'):if(_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xcd')]&&_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x2a')]){_0x508284=_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x2a')];return db['SmsMessage'][_0xd138('0x60')]({'where':{'messageId':_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xcd')]}});}break;case _0xd138('0xce'):if(_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xcf')]&&_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xd0')]){_0x508284=_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xd0')];return db[_0xd138('0xc8')][_0xd138('0x60')]({'where':{'messageId':_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xcf')]}});}break;case _0xd138('0x85'):if(_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x86')]&&_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xd1')]){_0x508284=_0x2d7c8f['body'][_0xd138('0xd1')];return db['SmsMessage'][_0xd138('0x60')]({'where':{'messageId':_0x2d7c8f['body'][_0xd138('0x86')]}});}break;case'infobip':var _0x1438bf=_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x8b')][0x0];if(_0x1438bf[_0xd138('0x83')]&&_0x1438bf[_0xd138('0x2a')][_0xd138('0xd2')]===_0xd138('0xd3')){_0x508284=_0x1438bf[_0xd138('0x2a')][_0xd138('0xd2')];return db[_0xd138('0xc8')][_0xd138('0x60')]({'where':{'messageId':_0x1438bf[_0xd138('0x83')]}});}break;case _0xd138('0x8f'):if(_0x2d7c8f[_0xd138('0x5b')]['messageId']&&_0x2d7c8f[_0xd138('0x5b')]['status']){_0x508284=_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x2a')];return db[_0xd138('0xc8')][_0xd138('0x60')]({'where':{'messageId':_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x83')]}});}break;case _0xd138('0xd4'):if(_0x2d7c8f[_0xd138('0x5b')][0x0]['message']['id']){_0x508284=_0x2d7c8f['body'][0x0][_0xd138('0x52')];return db['SmsMessage'][_0xd138('0x60')]({'where':{'messageId':_0x2d7c8f[_0xd138('0x5b')][0x0][_0xd138('0x26')]['id']}});}break;case'intelepeer':if(_0x2d7c8f[_0xd138('0x5b')]['redif']&&_0x2d7c8f[_0xd138('0x5b')]['status']){_0x508284=_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x2a')];return db[_0xd138('0xc8')][_0xd138('0x60')]({'where':{'messageId':_0x2d7c8f[_0xd138('0x5b')]['redif']}});}break;}}})[_0xd138('0x37')](handleEntityNotFound(_0x5f0f50,null))[_0xd138('0x37')](function(_0x720b51){if(_0x720b51){_0x445e82=_0x720b51;switch(_0x2a6fc1[_0xd138('0x52')]){case _0xd138('0xcc'):if(_0x508284===_0xd138('0xd3')){return _0x445e82[_0xd138('0x34')]({'read':!![]});}else{logger[_0xd138('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd138('0xcc'),util[_0xd138('0xcb')](_0x2d7c8f['body'],{'showHidden':![],'depth':null}));}break;case _0xd138('0xce'):if(_0x508284==='1'){return _0x445e82[_0xd138('0x34')]({'read':!![]});}else{logger['error'](_0xd138('0x22'),_0xd138('0x2a'),_0xd138('0xcc'),util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd138('0x85'):if(!_0x2d7c8f[_0xd138('0x5b')]['error_code']&&_0x508284>=0xc8&&_0x508284<=0xce){return _0x445e82[_0xd138('0x34')]({'read':!![]});}else{logger[_0xd138('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd138('0x2a'),_0xd138('0x85'),util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd138('0x8a'):var _0x1189d3=_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x8b')][0x0];if(_0x1189d3[_0xd138('0x2a')]['groupName']===_0xd138('0xd3')){return _0x445e82[_0xd138('0x34')]({'read':!![]});}else{logger[_0xd138('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd138('0x2a'),'infobip',util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd138('0x8f'):if(_0x508284==_0xd138('0xd5')||_0x508284==_0xd138('0xd6')){return _0x445e82[_0xd138('0x34')]({'read':!![]});}else{logger[_0xd138('0x25')](_0xd138('0x22'),_0xd138('0x2a'),_0xd138('0x8f'),util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd138('0xd4'):if(_0x508284==_0xd138('0xd7')){return _0x445e82['update']({'read':!![]});}else{logger[_0xd138('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd138('0xd4'),util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd138('0x91'):if(_0x508284==='DELIVRD'||_0x508284===_0xd138('0xd8')){return _0x445e82[_0xd138('0x34')]({'read':!![]});}else{logger['error'](_0xd138('0x22'),_0xd138('0x2a'),_0xd138('0x91'),util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x445e82;}})['then'](respondWithResult(_0x5f0f50,null))['catch'](handleError(_0x5f0f50,null));};exports['statusGet']=function(_0x4dba98,_0x53a57e,_0xbb716d){var _0x3b85eb,_0x193eab,_0x5d7e87;return db['SmsAccount'][_0xd138('0x60')]({'where':{'id':_0x4dba98[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x53a57e,null))['then'](function(_0x16e4ab){if(_0x16e4ab){_0x5d7e87=_0x16e4ab;logger[_0xd138('0x21')](_0xd138('0x22'),_0xd138('0x2a'),'received\x20delivery\x20report\x20from',_0x16e4ab[_0xd138('0x52')],util['inspect'](_0x4dba98[_0xd138('0x44')],{'showHidden':![],'depth':null}));switch(_0x16e4ab[_0xd138('0x52')]){case _0xd138('0x8c'):if(_0x4dba98[_0xd138('0x44')]['message-id']&&_0x4dba98[_0xd138('0x44')]['state']){_0x193eab=_0x4dba98[_0xd138('0x44')][_0xd138('0xd9')];return db[_0xd138('0xc8')][_0xd138('0x60')]({'where':{'messageId':_0x4dba98[_0xd138('0x44')][_0xd138('0xda')]}});}break;}}})[_0xd138('0x37')](handleEntityNotFound(_0x53a57e,null))['then'](function(_0x5e8e3f){if(_0x5e8e3f){_0x3b85eb=_0x5e8e3f;switch(_0x5d7e87['type']){case _0xd138('0x8c'):if(_0x193eab==='2'||_0x193eab==='6'){return _0x3b85eb['update']({'read':!![]});}else{logger[_0xd138('0x25')](_0xd138('0x22'),'status',_0xd138('0x8c'),util[_0xd138('0xcb')](_0x4dba98[_0xd138('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x3b85eb;}})[_0xd138('0x37')](respondWithResult(_0x53a57e,null))[_0xd138('0x29')](handleError(_0x53a57e,null));};exports[_0xd138('0xdb')]=function(_0x416076,_0x32322e,_0x5478df){return db[_0xd138('0x3e')]['find']({'where':{'id':_0x416076[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x32322e,null))[_0xd138('0x37')](function(_0x120f60){if(_0x120f60){return _0x120f60['addAgents'](_0x416076[_0xd138('0x5b')]['ids'],_[_0xd138('0x9c')](_0x416076[_0xd138('0x5b')],[_0xd138('0x6b'),'id'])||{})[_0xd138('0x9e')](function(_0x1fc0ed){for(var _0x596aeb=0x0;_0x596aeb<_0x416076[_0xd138('0x5b')]['ids'][_0xd138('0x49')];_0x596aeb+=0x1){socket[_0xd138('0xdc')](_0xd138('0xdd'),{'UserId':_0x416076[_0xd138('0x5b')]['ids'][_0x596aeb],'SmsAccountId':_0x416076['params']['id']});}return _0x1fc0ed;});}})[_0xd138('0x37')](respondWithResult(_0x32322e,null))['catch'](handleError(_0x32322e,null));};exports[_0xd138('0xde')]=function(_0x188917,_0x4bf19f,_0x3047bb){return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x188917[_0xd138('0x59')]['id']}})['then'](handleEntityNotFound(_0x4bf19f,null))[_0xd138('0x37')](function(_0x22ed64){if(_0x22ed64){return _0x22ed64[_0xd138('0xde')](_0x188917[_0xd138('0x44')][_0xd138('0x6b')])['then'](function(){if(_['isArray'](_0x188917[_0xd138('0x44')][_0xd138('0x6b')])){for(var _0x1973b0=0x0;_0x1973b0<_0x188917[_0xd138('0x44')][_0xd138('0x6b')]['length'];_0x1973b0+=0x1){socket[_0xd138('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0x188917[_0xd138('0x44')]['ids'][_0x1973b0]),'SmsAccountId':Number(_0x188917[_0xd138('0x59')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x188917[_0xd138('0x44')]['ids']),'SmsAccountId':Number(_0x188917[_0xd138('0x59')]['id'])});}});}})[_0xd138('0x37')](respondWithStatusCode(_0x4bf19f,null))[_0xd138('0x29')](handleError(_0x4bf19f,null));};exports['getAgents']=function(_0x221a25,_0x3249e3,_0x5ff852){var _0x591746={};var _0x5ae12d={};var _0x10d675;var _0x4d409d;return db[_0xd138('0x3e')][_0xd138('0x69')]({'where':{'id':_0x221a25[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x3249e3,null))[_0xd138('0x37')](function(_0x2beb64){if(_0x2beb64){_0x10d675=_0x2beb64;_0x5ae12d[_0xd138('0x42')]=_[_0xd138('0x43')](db[_0xd138('0xa7')]['rawAttributes']);_0x5ae12d[_0xd138('0x44')]=_[_0xd138('0x43')](_0x221a25[_0xd138('0x44')]);_0x5ae12d[_0xd138('0x45')]=_[_0xd138('0x46')](_0x5ae12d[_0xd138('0x42')],_0x5ae12d[_0xd138('0x44')]);_0x591746[_0xd138('0x47')]=_[_0xd138('0x46')](_0x5ae12d[_0xd138('0x42')],qs[_0xd138('0x48')](_0x221a25['query'][_0xd138('0x48')]));_0x591746[_0xd138('0x47')]=_0x591746['attributes'][_0xd138('0x49')]?_0x591746['attributes']:_0x5ae12d[_0xd138('0x42')];_0x591746[_0xd138('0x4c')]=qs['sort'](_0x221a25[_0xd138('0x44')][_0xd138('0x4d')]);_0x591746['where']=qs[_0xd138('0x45')](_[_0xd138('0x6e')](_0x221a25[_0xd138('0x44')],_0x5ae12d[_0xd138('0x45')]));if(_0x221a25['query'][_0xd138('0x4e')]){_0x591746['where']=_[_0xd138('0x4f')](_0x591746[_0xd138('0x50')],{'$or':_[_0xd138('0x51')](_0x591746[_0xd138('0x47')],function(_0x4362d5){var _0x4e4473={};_0x4e4473[_0x4362d5]={'$like':'%'+_0x221a25[_0xd138('0x44')][_0xd138('0x4e')]+'%'};return _0x4e4473;})});}_0x591746=_['merge']({},_0x591746,_0x221a25[_0xd138('0x54')]);return _0x10d675[_0xd138('0xdf')](_0x591746);}})['then'](function(_0x39e3aa){if(_0x39e3aa){_0x4d409d=_0x39e3aa[_0xd138('0x49')];if(!_0x221a25[_0xd138('0x44')][_0xd138('0x4a')](_0xd138('0x4b'))){_0x591746[_0xd138('0x2f')]=qs[_0xd138('0x2f')](_0x221a25[_0xd138('0x44')][_0xd138('0x2f')]);_0x591746['offset']=qs['offset'](_0x221a25[_0xd138('0x44')]['offset']);}return _0x10d675[_0xd138('0xdf')](_0x591746);}})[_0xd138('0x37')](function(_0x1ef17f){if(_0x1ef17f){return _0x1ef17f?{'count':_0x4d409d,'rows':_0x1ef17f}:null;}})[_0xd138('0x37')](respondWithResult(_0x3249e3,null))[_0xd138('0x29')](handleError(_0x3249e3,null));}; \ No newline at end of file +var _0xdaeb=['Content-Range','apply','save','update','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','show','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','Disposition','getDispositions','findOne','nolimit','findAll','rows','removeDispositions','ids','CannedAnswer','getAnswers','length','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','createdAt','difference','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','MessageUUID','results','csc','originatingAddress','fromNumber','replyMessageId','bandwidth','refid','isNil','ValidationError','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','Contacts','updatedAt','DESC','list','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','addApplications','transaction','SmsApplication','bulkCreate','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','infobip','groupName','clickatell','intelepeer','redif','DELIVERED','error_code','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','omit','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0xdaeb,0xb2));var _0xbdae=function(_0x2adb31,_0x1d05cb){_0x2adb31=_0x2adb31-0x0;var _0x1bdc49=_0xdaeb[_0x2adb31];return _0x1bdc49;};'use strict';var pdf=require(_0xbdae('0x0'));var emlformat=require(_0xbdae('0x1'));var rimraf=require(_0xbdae('0x2'));var zipdir=require(_0xbdae('0x3'));var jsonpatch=require(_0xbdae('0x4'));var rp=require('request-promise');var moment=require(_0xbdae('0x5'));var BPromise=require(_0xbdae('0x6'));var Mustache=require(_0xbdae('0x7'));var util=require(_0xbdae('0x8'));var path=require(_0xbdae('0x9'));var sox=require(_0xbdae('0xa'));var csv=require('to-csv');var ejs=require(_0xbdae('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbdae('0xc'));var jsforce=require(_0xbdae('0xd'));var deskjs=require(_0xbdae('0xe'));var toCsv=require(_0xbdae('0xf'));var querystring=require(_0xbdae('0x10'));var Papa=require(_0xbdae('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbdae('0x12'));var as=require(_0xbdae('0x13'));var hardwareService=require(_0xbdae('0x14'));var logger=require('../../config/logger')(_0xbdae('0x15'));var utils=require(_0xbdae('0x16'));var config=require(_0xbdae('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbdae('0x18'))['db'];config['redis']=_[_0xbdae('0x19')](config[_0xbdae('0x1a')],{'host':_0xbdae('0x1b'),'port':0x18eb});var socket=require(_0xbdae('0x1c'))(new Redis(config[_0xbdae('0x1a')]));require('./smsAccount.socket')[_0xbdae('0x1d')](socket);var jayson=require(_0xbdae('0x1e'));var client=jayson[_0xbdae('0x1f')][_0xbdae('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1e5ac3,_0x3deb0c,_0x3f3d11,_0x24d46d){return new BPromise(function(_0x18f3cf,_0x52b8ce){var _0x23f75c=_0x24d46d||client;return _0x23f75c['request'](_0x1e5ac3,_0x3f3d11)[_0xbdae('0x21')](function(_0x46d03f){logger[_0xbdae('0x22')](_0xbdae('0x23'),_0x3deb0c,_0xbdae('0x24'));logger[_0xbdae('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3deb0c,'request\x20sent',JSON[_0xbdae('0x26')](_0x46d03f));if(_0x46d03f[_0xbdae('0x27')]){if(_0x46d03f[_0xbdae('0x27')][_0xbdae('0x28')]===0x1f4){logger[_0xbdae('0x27')](_0xbdae('0x23'),_0x3deb0c,_0x46d03f[_0xbdae('0x27')][_0xbdae('0x29')]);return _0x52b8ce(_0x46d03f['error'][_0xbdae('0x29')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x3deb0c,_0x46d03f[_0xbdae('0x27')][_0xbdae('0x29')]);return _0x18f3cf(_0x46d03f[_0xbdae('0x27')][_0xbdae('0x29')]);}else{logger[_0xbdae('0x22')](_0xbdae('0x23'),_0x3deb0c,_0xbdae('0x24'));_0x18f3cf(_0x46d03f[_0xbdae('0x2a')][_0xbdae('0x29')]);}})[_0xbdae('0x2b')](function(_0x2f5145){logger[_0xbdae('0x27')]('SmsAccount,\x20%s,\x20%s',_0x3deb0c,_0x2f5145);_0x52b8ce(_0x2f5145);});});}function respondWithStatusCode(_0x3344c9,_0xd7592a){_0xd7592a=_0xd7592a||0xcc;return function(_0x1602be){if(_0x1602be){return _0x3344c9[_0xbdae('0x2c')](_0xd7592a);}return _0x3344c9['status'](_0xd7592a)[_0xbdae('0x2d')]();};}function respondWithResult(_0x4e2d67,_0x18cc9d){_0x18cc9d=_0x18cc9d||0xc8;return function(_0x3a43e4){if(_0x3a43e4){return _0x4e2d67[_0xbdae('0x2e')](_0x18cc9d)[_0xbdae('0x2f')](_0x3a43e4);}};}function respondWithFilteredResult(_0x36197c,_0x324b66){return function(_0x2e1bd4){if(_0x2e1bd4){var _0x144c04=_0x2e1bd4[_0xbdae('0x30')],_0x291077=_0x324b66['offset'],_0x403b3e=_0x324b66[_0xbdae('0x31')]+_0x324b66[_0xbdae('0x32')],_0x56dd9a;if(_0x403b3e>=_0x144c04){_0x403b3e=_0x144c04;_0x56dd9a=0xc8;}else{_0x56dd9a=0xce;}_0x36197c['status'](_0x56dd9a);return _0x36197c['set'](_0xbdae('0x33'),_0x291077+'-'+_0x403b3e+'/'+_0x144c04)[_0xbdae('0x2f')](_0x2e1bd4);}return null;};}function patchUpdates(_0x3df283){return function(_0x2fb74f){try{jsonpatch[_0xbdae('0x34')](_0x2fb74f,_0x3df283,!![]);}catch(_0x89371e){return BPromise['reject'](_0x89371e);}return _0x2fb74f[_0xbdae('0x35')]();};}function saveUpdates(_0x1ccd6a,_0x1a537f){return function(_0x54a48f){if(_0x54a48f){return _0x54a48f[_0xbdae('0x36')](_0x1ccd6a)['then'](function(_0x446328){return _0x446328;});}return null;};}function removeEntity(_0x53767e,_0x45f2c7){return function(_0x4552f7){if(_0x4552f7){return _0x4552f7[_0xbdae('0x37')]()['then'](function(){var _0x13c9cb=_0x4552f7['get']({'plain':!![]});var _0x242ebc=_0xbdae('0x38');return db['UserProfileResource'][_0xbdae('0x37')]({'where':{'type':_0x242ebc,'resourceId':_0x13c9cb['id']}})[_0xbdae('0x21')](function(){return _0x4552f7;});})[_0xbdae('0x21')](function(){_0x53767e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e0230,_0x9507f0){return function(_0x463dd3){if(!_0x463dd3){_0x1e0230['sendStatus'](0x194);}return _0x463dd3;};}function handleError(_0xf5662a,_0x18989d){_0x18989d=_0x18989d||0x1f4;return function(_0x25bd90){logger[_0xbdae('0x27')](_0x25bd90[_0xbdae('0x39')]);if(_0x25bd90[_0xbdae('0x3a')]){delete _0x25bd90[_0xbdae('0x3a')];}_0xf5662a[_0xbdae('0x2e')](_0x18989d)[_0xbdae('0x3b')](_0x25bd90);};}exports[_0xbdae('0x3c')]=function(_0x58729e,_0x37143d){var _0x1f206c={'include':[{'model':db[_0xbdae('0x3d')],'as':_0xbdae('0x3e')}]},_0x12d9eb={},_0x12404c={'count':0x0,'rows':[]};var _0x310bd8=_[_0xbdae('0x3f')](db[_0xbdae('0x40')][_0xbdae('0x41')],function(_0x458693){return{'name':_0x458693['fieldName'],'type':_0x458693[_0xbdae('0x42')]['key']};});_0x12d9eb[_0xbdae('0x43')]=_[_0xbdae('0x3f')](_0x310bd8,_0xbdae('0x3a'));_0x12d9eb['query']=_['keys'](_0x58729e[_0xbdae('0x44')]);_0x12d9eb[_0xbdae('0x45')]=_[_0xbdae('0x46')](_0x12d9eb['model'],_0x12d9eb[_0xbdae('0x44')]);_0x1f206c[_0xbdae('0x47')]=_[_0xbdae('0x46')](_0x12d9eb[_0xbdae('0x43')],qs[_0xbdae('0x48')](_0x58729e[_0xbdae('0x44')][_0xbdae('0x48')]));_0x1f206c[_0xbdae('0x47')]=_0x1f206c[_0xbdae('0x47')]['length']?_0x1f206c['attributes']:_0x12d9eb[_0xbdae('0x43')];if(!_0x58729e[_0xbdae('0x44')][_0xbdae('0x49')]('nolimit')){_0x1f206c[_0xbdae('0x32')]=qs[_0xbdae('0x32')](_0x58729e[_0xbdae('0x44')][_0xbdae('0x32')]);_0x1f206c[_0xbdae('0x31')]=qs[_0xbdae('0x31')](_0x58729e[_0xbdae('0x44')][_0xbdae('0x31')]);}_0x1f206c[_0xbdae('0x4a')]=qs[_0xbdae('0x4b')](_0x58729e[_0xbdae('0x44')][_0xbdae('0x4b')]);_0x1f206c['where']=qs[_0xbdae('0x45')](_[_0xbdae('0x4c')](_0x58729e[_0xbdae('0x44')],_0x12d9eb[_0xbdae('0x45')]),_0x310bd8);if(_0x58729e[_0xbdae('0x44')][_0xbdae('0x4d')]){_0x1f206c[_0xbdae('0x4e')]=_[_0xbdae('0x4f')](_0x1f206c[_0xbdae('0x4e')],{'$or':_[_0xbdae('0x3f')](_0x310bd8,function(_0x8d779c){if(_0x8d779c[_0xbdae('0x42')]!==_0xbdae('0x50')){var _0x36d572={};_0x36d572[_0x8d779c['name']]={'$like':'%'+_0x58729e[_0xbdae('0x44')][_0xbdae('0x4d')]+'%'};return _0x36d572;}})});}_0x1f206c=_['merge']({},_0x1f206c,_0x58729e[_0xbdae('0x51')]);var _0x226de5={'where':_0x1f206c[_0xbdae('0x4e')]};return db[_0xbdae('0x40')][_0xbdae('0x30')](_0x226de5)['then'](function(_0xf626c9){_0x12404c[_0xbdae('0x30')]=_0xf626c9;if(_0x58729e[_0xbdae('0x44')]['includeAll']){_0x1f206c[_0xbdae('0x52')]=[{'all':!![]}];}return db[_0xbdae('0x40')]['findAll'](_0x1f206c);})[_0xbdae('0x21')](function(_0x12342c){_0x12404c['rows']=_0x12342c;return _0x12404c;})[_0xbdae('0x21')](respondWithFilteredResult(_0x37143d,_0x1f206c))[_0xbdae('0x2b')](handleError(_0x37143d,null));};exports[_0xbdae('0x53')]=function(_0x1333e9,_0x682840){var _0x590c97={'raw':![],'where':{'id':_0x1333e9[_0xbdae('0x54')]['id']},'include':[{'model':db[_0xbdae('0x3d')],'as':'mandatoryDispositionPause'}]},_0xb49b83={};_0xb49b83['model']=_[_0xbdae('0x55')](db[_0xbdae('0x40')][_0xbdae('0x41')]);_0xb49b83[_0xbdae('0x44')]=_[_0xbdae('0x55')](_0x1333e9['query']);_0xb49b83['filters']=_[_0xbdae('0x46')](_0xb49b83['model'],_0xb49b83[_0xbdae('0x44')]);_0x590c97[_0xbdae('0x47')]=_[_0xbdae('0x46')](_0xb49b83[_0xbdae('0x43')],qs[_0xbdae('0x48')](_0x1333e9[_0xbdae('0x44')][_0xbdae('0x48')]));_0x590c97[_0xbdae('0x47')]=_0x590c97[_0xbdae('0x47')]['length']?_0x590c97[_0xbdae('0x47')]:_0xb49b83[_0xbdae('0x43')];if(_0x1333e9['query'][_0xbdae('0x56')]){_0x590c97[_0xbdae('0x52')]=[{'all':!![]}];}_0x590c97=_['merge']({},_0x590c97,_0x1333e9['options']);return db[_0xbdae('0x40')][_0xbdae('0x57')](_0x590c97)[_0xbdae('0x21')](handleEntityNotFound(_0x682840,null))[_0xbdae('0x21')](respondWithResult(_0x682840,null))[_0xbdae('0x2b')](handleError(_0x682840,null));};exports[_0xbdae('0x58')]=function(_0x35d556,_0x1db0c5){return db[_0xbdae('0x40')]['create'](_0x35d556[_0xbdae('0x59')],{})[_0xbdae('0x21')](function(_0x4c7874){var _0x51d354=_0x35d556['user']['get']({'plain':!![]});if(!_0x51d354)throw new Error(_0xbdae('0x5a'));if(_0x51d354[_0xbdae('0x5b')]===_0xbdae('0x5c')){var _0x33f554=_0x4c7874[_0xbdae('0x5d')]({'plain':!![]});var _0x32c0b5='SmsAccounts';return db[_0xbdae('0x5e')][_0xbdae('0x57')]({'where':{'name':_0x32c0b5,'userProfileId':_0x51d354[_0xbdae('0x5f')]},'raw':!![]})[_0xbdae('0x21')](function(_0x4a2a71){if(_0x4a2a71&&_0x4a2a71[_0xbdae('0x60')]===0x0){return db[_0xbdae('0x61')][_0xbdae('0x58')]({'name':_0x33f554[_0xbdae('0x3a')],'resourceId':_0x33f554['id'],'type':_0x4a2a71['name'],'sectionId':_0x4a2a71['id']},{})['then'](function(){return _0x4c7874;});}else{return _0x4c7874;}})['catch'](function(_0x409782){logger[_0xbdae('0x27')](_0xbdae('0x62'),_0x409782);throw _0x409782;});}return _0x4c7874;})['then'](respondWithResult(_0x1db0c5,0xc9))['catch'](handleError(_0x1db0c5,null));};exports[_0xbdae('0x36')]=function(_0x54e2da,_0x4ea154){if(_0x54e2da['body']['id']){delete _0x54e2da[_0xbdae('0x59')]['id'];}return db[_0xbdae('0x40')][_0xbdae('0x57')]({'where':{'id':_0x54e2da[_0xbdae('0x54')]['id']},'include':[{'model':db[_0xbdae('0x3d')],'as':_0xbdae('0x3e')}]})[_0xbdae('0x21')](handleEntityNotFound(_0x4ea154,null))[_0xbdae('0x21')](saveUpdates(_0x54e2da['body'],null))[_0xbdae('0x21')](respondWithResult(_0x4ea154,null))['catch'](handleError(_0x4ea154,null));};exports[_0xbdae('0x37')]=function(_0x5355d4,_0x9f5b98){return db[_0xbdae('0x40')][_0xbdae('0x57')]({'where':{'id':_0x5355d4[_0xbdae('0x54')]['id']}})[_0xbdae('0x21')](handleEntityNotFound(_0x9f5b98,null))[_0xbdae('0x21')](removeEntity(_0x9f5b98,null))[_0xbdae('0x2b')](handleError(_0x9f5b98,null));};exports[_0xbdae('0x63')]=function(_0x4151d9,_0x11db4a){return db[_0xbdae('0x40')][_0xbdae('0x63')]()[_0xbdae('0x21')](respondWithResult(_0x11db4a,null))[_0xbdae('0x2b')](handleError(_0x11db4a,null));};exports['addDisposition']=function(_0x3b6ece,_0x329536,_0xda1642){if(_0x3b6ece[_0xbdae('0x59')]['id']){delete _0x3b6ece[_0xbdae('0x59')]['id'];}return db[_0xbdae('0x40')][_0xbdae('0x57')]({'where':{'id':_0x3b6ece[_0xbdae('0x54')]['id']}})[_0xbdae('0x21')](handleEntityNotFound(_0x329536,null))[_0xbdae('0x21')](function(_0x920dc7){if(_0x920dc7){_0x3b6ece[_0xbdae('0x59')][_0xbdae('0x64')]=_0x920dc7['id'];return db[_0xbdae('0x65')][_0xbdae('0x58')](_0x3b6ece[_0xbdae('0x59')]);}})[_0xbdae('0x21')](respondWithResult(_0x329536,null))[_0xbdae('0x2b')](handleError(_0x329536,null));};exports[_0xbdae('0x66')]=function(_0x1b133c,_0x491c8b,_0x292bc9){var _0x36493a={'raw':![],'where':{}};var _0x2e8db1={};var _0x4a94b3={'count':0x0,'rows':[]};return db[_0xbdae('0x40')][_0xbdae('0x67')]({'where':{'id':_0x1b133c['params']['id']}})[_0xbdae('0x21')](handleEntityNotFound(_0x491c8b,null))[_0xbdae('0x21')](function(_0x6e3ca7){if(_0x6e3ca7){_0x2e8db1[_0xbdae('0x43')]=_[_0xbdae('0x55')](db[_0xbdae('0x65')][_0xbdae('0x41')]);_0x2e8db1[_0xbdae('0x44')]=_[_0xbdae('0x55')](_0x1b133c[_0xbdae('0x44')]);_0x2e8db1[_0xbdae('0x45')]=_[_0xbdae('0x46')](_0x2e8db1[_0xbdae('0x43')],_0x2e8db1[_0xbdae('0x44')]);_0x36493a[_0xbdae('0x47')]=_[_0xbdae('0x46')](_0x2e8db1['model'],qs[_0xbdae('0x48')](_0x1b133c['query']['fields']));_0x36493a[_0xbdae('0x47')]=_0x36493a[_0xbdae('0x47')]['length']?_0x36493a[_0xbdae('0x47')]:_0x2e8db1['model'];if(!_0x1b133c[_0xbdae('0x44')][_0xbdae('0x49')](_0xbdae('0x68'))){_0x36493a[_0xbdae('0x32')]=qs['limit'](_0x1b133c['query'][_0xbdae('0x32')]);_0x36493a[_0xbdae('0x31')]=qs[_0xbdae('0x31')](_0x1b133c[_0xbdae('0x44')]['offset']);}_0x36493a['order']=qs[_0xbdae('0x4b')](_0x1b133c[_0xbdae('0x44')][_0xbdae('0x4b')]);_0x36493a['where']=qs['filters'](_[_0xbdae('0x4c')](_0x1b133c['query'],_0x2e8db1[_0xbdae('0x45')]));_0x36493a[_0xbdae('0x4e')]['SmsAccountId']=_0x6e3ca7['id'];if(_0x1b133c[_0xbdae('0x44')][_0xbdae('0x4d')]){_0x36493a['where']=_[_0xbdae('0x4f')](_0x36493a[_0xbdae('0x4e')],{'$or':_[_0xbdae('0x3f')](_0x36493a[_0xbdae('0x47')],function(_0x340df5){var _0x1694db={};_0x1694db[_0x340df5]={'$like':'%'+_0x1b133c[_0xbdae('0x44')][_0xbdae('0x4d')]+'%'};return _0x1694db;})});}_0x36493a=_['merge']({},_0x36493a,_0x1b133c[_0xbdae('0x51')]);return db[_0xbdae('0x65')][_0xbdae('0x30')]({'where':_0x36493a[_0xbdae('0x4e')]})[_0xbdae('0x21')](function(_0xb5fa56){_0x4a94b3[_0xbdae('0x30')]=_0xb5fa56;if(_0x1b133c[_0xbdae('0x44')][_0xbdae('0x56')]){_0x36493a[_0xbdae('0x52')]=[{'all':!![]}];}return db[_0xbdae('0x65')][_0xbdae('0x69')](_0x36493a);})[_0xbdae('0x21')](function(_0x2e2715){_0x4a94b3[_0xbdae('0x6a')]=_0x2e2715;return _0x4a94b3;});}})['then'](respondWithFilteredResult(_0x491c8b,_0x36493a))[_0xbdae('0x2b')](handleError(_0x491c8b,null));};exports[_0xbdae('0x6b')]=function(_0x569f65,_0x4c40ab,_0xad704){return db[_0xbdae('0x40')][_0xbdae('0x57')]({'where':{'id':_0x569f65[_0xbdae('0x54')]['id']}})[_0xbdae('0x21')](handleEntityNotFound(_0x4c40ab,null))[_0xbdae('0x21')](function(_0x4a630c){if(_0x4a630c){return _0x4a630c[_0xbdae('0x6b')](_0x569f65[_0xbdae('0x44')][_0xbdae('0x6c')]);}})[_0xbdae('0x21')](respondWithStatusCode(_0x4c40ab,null))[_0xbdae('0x2b')](handleError(_0x4c40ab,null));};exports['addAnswer']=function(_0x5b89e2,_0x17c7a3,_0x33ec62){if(_0x5b89e2[_0xbdae('0x59')]['id']){delete _0x5b89e2[_0xbdae('0x59')]['id'];}return db[_0xbdae('0x40')]['find']({'where':{'id':_0x5b89e2['params']['id']}})['then'](handleEntityNotFound(_0x17c7a3,null))[_0xbdae('0x21')](function(_0x51dafb){if(_0x51dafb){_0x5b89e2[_0xbdae('0x59')][_0xbdae('0x64')]=_0x51dafb['id'];return db[_0xbdae('0x6d')][_0xbdae('0x58')](_0x5b89e2[_0xbdae('0x59')]);}})['then'](respondWithResult(_0x17c7a3,null))[_0xbdae('0x2b')](handleError(_0x17c7a3,null));};exports[_0xbdae('0x6e')]=function(_0x2bd1cb,_0x267033,_0x31d912){var _0x540969={'raw':![],'where':{}};var _0x5491da={};var _0x3a3364={'count':0x0,'rows':[]};return db[_0xbdae('0x40')][_0xbdae('0x67')]({'where':{'id':_0x2bd1cb['params']['id']}})[_0xbdae('0x21')](handleEntityNotFound(_0x267033,null))[_0xbdae('0x21')](function(_0x3c4b0c){if(_0x3c4b0c){_0x5491da[_0xbdae('0x43')]=_[_0xbdae('0x55')](db['CannedAnswer'][_0xbdae('0x41')]);_0x5491da[_0xbdae('0x44')]=_[_0xbdae('0x55')](_0x2bd1cb[_0xbdae('0x44')]);_0x5491da[_0xbdae('0x45')]=_[_0xbdae('0x46')](_0x5491da[_0xbdae('0x43')],_0x5491da['query']);_0x540969['attributes']=_[_0xbdae('0x46')](_0x5491da[_0xbdae('0x43')],qs[_0xbdae('0x48')](_0x2bd1cb[_0xbdae('0x44')]['fields']));_0x540969[_0xbdae('0x47')]=_0x540969[_0xbdae('0x47')][_0xbdae('0x6f')]?_0x540969[_0xbdae('0x47')]:_0x5491da['model'];if(!_0x2bd1cb['query'][_0xbdae('0x49')](_0xbdae('0x68'))){_0x540969[_0xbdae('0x32')]=qs[_0xbdae('0x32')](_0x2bd1cb[_0xbdae('0x44')][_0xbdae('0x32')]);_0x540969[_0xbdae('0x31')]=qs['offset'](_0x2bd1cb[_0xbdae('0x44')][_0xbdae('0x31')]);}_0x540969[_0xbdae('0x4a')]=qs['sort'](_0x2bd1cb[_0xbdae('0x44')][_0xbdae('0x4b')]);_0x540969[_0xbdae('0x4e')]=qs[_0xbdae('0x45')](_[_0xbdae('0x4c')](_0x2bd1cb['query'],_0x5491da['filters']));_0x540969[_0xbdae('0x4e')][_0xbdae('0x64')]=_0x3c4b0c['id'];if(_0x2bd1cb[_0xbdae('0x44')][_0xbdae('0x4d')]){_0x540969[_0xbdae('0x4e')]=_[_0xbdae('0x4f')](_0x540969[_0xbdae('0x4e')],{'$or':_[_0xbdae('0x3f')](_0x540969['attributes'],function(_0x4c05dd){var _0x38a6ed={};_0x38a6ed[_0x4c05dd]={'$like':'%'+_0x2bd1cb[_0xbdae('0x44')]['filter']+'%'};return _0x38a6ed;})});}_0x540969=_[_0xbdae('0x4f')]({},_0x540969,_0x2bd1cb[_0xbdae('0x51')]);return db['CannedAnswer'][_0xbdae('0x30')]({'where':_0x540969['where']})[_0xbdae('0x21')](function(_0x2c58e9){_0x3a3364['count']=_0x2c58e9;if(_0x2bd1cb['query'][_0xbdae('0x56')]){_0x540969[_0xbdae('0x52')]=[{'all':!![]}];}return db[_0xbdae('0x6d')]['findAll'](_0x540969);})[_0xbdae('0x21')](function(_0x35f9cb){_0x3a3364['rows']=_0x35f9cb;return _0x3a3364;});}})[_0xbdae('0x21')](respondWithFilteredResult(_0x267033,_0x540969))[_0xbdae('0x2b')](handleError(_0x267033,null));};exports[_0xbdae('0x70')]=function(_0xbd62a0,_0x58b7a0,_0x3fbabb){return db[_0xbdae('0x40')][_0xbdae('0x57')]({'where':{'id':_0xbd62a0[_0xbdae('0x54')]['id']}})[_0xbdae('0x21')](handleEntityNotFound(_0x58b7a0,null))[_0xbdae('0x21')](function(_0x3be5d2){if(_0x3be5d2){return _0x3be5d2[_0xbdae('0x70')](_0xbd62a0[_0xbdae('0x44')][_0xbdae('0x6c')]);}})[_0xbdae('0x21')](respondWithStatusCode(_0x58b7a0,null))['catch'](handleError(_0x58b7a0,null));};exports[_0xbdae('0x71')]=function(_0x40fff7,_0x23041f,_0x43757e){var _0x264ce={'channel':_0xbdae('0x72')};var _0x20bead=[];var _0x154d7d=[];var _0x23f0c7={};return db[_0xbdae('0x40')][_0xbdae('0x57')]({'where':{'id':_0x40fff7[_0xbdae('0x54')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xbdae('0x73')}]})[_0xbdae('0x21')](handleEntityNotFound(_0x23041f,null))[_0xbdae('0x21')](function(_0x2cd3c8){_0x264ce[_0xbdae('0x74')]=_0x2cd3c8;_0x264ce[_0xbdae('0x75')]=_[_0xbdae('0x76')](_0x2cd3c8[_0xbdae('0x73')],[_0xbdae('0x77')],[_0xbdae('0x78')]);if(_0x264ce[_0xbdae('0x74')][_0xbdae('0x73')]){delete _0x264ce[_0xbdae('0x74')][_0xbdae('0x73')];}return db[_0xbdae('0x79')][_0xbdae('0x63')]();})[_0xbdae('0x21')](function(_0x533baf){if(!_0x533baf){throw new db[(_0xbdae('0x7a'))]['ValidationError'](_0xbdae('0x7b'));}_0x20bead=_['difference'](_[_0xbdae('0x55')](_0x533baf),[_0xbdae('0x7c'),'updatedAt']);_0x154d7d=_[_0xbdae('0x7d')](_['keys'](_0x533baf),[_0xbdae('0x7c'),'updatedAt',_0xbdae('0x7e'),_0xbdae('0x7f')]);_0x264ce['body']={'mapKey':_0xbdae('0x80')};if(_0x264ce[_0xbdae('0x74')][_0xbdae('0x42')]){switch(_0x264ce[_0xbdae('0x74')][_0xbdae('0x42')]){case _0xbdae('0x81'):_0x264ce[_0xbdae('0x59')][_0xbdae('0x82')]=_0x40fff7[_0xbdae('0x59')][_0xbdae('0x83')];_0x264ce[_0xbdae('0x59')][_0xbdae('0x59')]=_0x40fff7[_0xbdae('0x59')][_0xbdae('0x84')];_0x264ce[_0xbdae('0x59')][_0xbdae('0x85')]=_0x40fff7[_0xbdae('0x59')][_0xbdae('0x86')];break;case _0xbdae('0x87'):_0x264ce[_0xbdae('0x59')]['from']='+'+_0x40fff7[_0xbdae('0x59')][_0xbdae('0x88')];_0x264ce[_0xbdae('0x59')][_0xbdae('0x59')]=_0x40fff7['body'][_0xbdae('0x89')];break;case _0xbdae('0x8a'):_0x264ce[_0xbdae('0x59')][_0xbdae('0x82')]=_0x40fff7['body'][_0xbdae('0x82')];_0x264ce[_0xbdae('0x59')][_0xbdae('0x59')]=_0x40fff7[_0xbdae('0x59')][_0xbdae('0x29')];break;case _0xbdae('0x8b'):_0x264ce['body'][_0xbdae('0x82')]=_0x40fff7['body'][_0xbdae('0x82')];_0x264ce['body']['body']=_0x40fff7['body'][_0xbdae('0x59')];_0x264ce[_0xbdae('0x59')][_0xbdae('0x85')]=_0x40fff7['body']['message_id'];break;case'plivo':_0x264ce[_0xbdae('0x59')][_0xbdae('0x82')]=_0x40fff7[_0xbdae('0x59')][_0xbdae('0x83')];_0x264ce[_0xbdae('0x59')]['body']=_0x40fff7['body']['Text'];_0x264ce['body'][_0xbdae('0x85')]=_0x40fff7[_0xbdae('0x59')][_0xbdae('0x8c')];break;case'infobip':_0x264ce[_0xbdae('0x59')][_0xbdae('0x82')]='+'+_0x40fff7[_0xbdae('0x59')][_0xbdae('0x8d')][0x0][_0xbdae('0x82')];_0x264ce[_0xbdae('0x59')]['body']=_0x40fff7['body'][_0xbdae('0x8d')][0x0][_0xbdae('0x89')];_0x264ce[_0xbdae('0x59')][_0xbdae('0x85')]=_0x40fff7['body'][_0xbdae('0x8d')][0x0]['messageId'];break;case _0xbdae('0x8e'):_0x264ce[_0xbdae('0x59')]['from']=_0x40fff7[_0xbdae('0x59')][_0xbdae('0x8f')];_0x264ce[_0xbdae('0x59')][_0xbdae('0x59')]=_0x40fff7['body']['segmentedMessage']['message'];break;case'clickatell':_0x264ce[_0xbdae('0x59')][_0xbdae('0x82')]=_0x40fff7[_0xbdae('0x59')][_0xbdae('0x90')];_0x264ce[_0xbdae('0x59')][_0xbdae('0x59')]=_0x40fff7[_0xbdae('0x59')]['text'];_0x264ce[_0xbdae('0x59')][_0xbdae('0x85')]=_0x40fff7[_0xbdae('0x59')][_0xbdae('0x91')];break;case _0xbdae('0x92'):_0x264ce['body'][_0xbdae('0x85')]=_0x40fff7[_0xbdae('0x59')][0x0][_0xbdae('0x29')]['id'];_0x264ce[_0xbdae('0x59')][_0xbdae('0x82')]=_0x40fff7[_0xbdae('0x59')][0x0][_0xbdae('0x29')]['from'];_0x264ce[_0xbdae('0x59')][_0xbdae('0x59')]=_0x40fff7['body'][0x0][_0xbdae('0x29')][_0xbdae('0x89')];break;case'intelepeer':_0x264ce[_0xbdae('0x59')][_0xbdae('0x82')]=_0x40fff7[_0xbdae('0x59')][_0xbdae('0x82')];_0x264ce[_0xbdae('0x59')]['body']=_0x40fff7['body'][_0xbdae('0x29')];_0x264ce[_0xbdae('0x59')][_0xbdae('0x85')]=_0x40fff7[_0xbdae('0x59')][_0xbdae('0x93')];break;}}if(_0x264ce['body']['id']){delete _0x264ce[_0xbdae('0x59')]['id'];}if(_[_0xbdae('0x94')](_0x264ce['body'][_0xbdae('0x82')])){throw new db[(_0xbdae('0x7a'))][(_0xbdae('0x95'))]('from\x20is\x20mandatory');}if(_[_0xbdae('0x94')](_0x264ce['body'][_0xbdae('0x59')])||_0x264ce[_0xbdae('0x59')][_0xbdae('0x59')]===''){throw new db['Sequelize'][(_0xbdae('0x95'))](_0xbdae('0x96'));}if(_[_0xbdae('0x94')](_0x264ce[_0xbdae('0x59')][_0xbdae('0x97')])){throw new db[(_0xbdae('0x7a'))][(_0xbdae('0x95'))](_0xbdae('0x98')+_0x154d7d);}if(!_[_0xbdae('0x99')](_0x154d7d,_0x264ce['body']['mapKey'])){throw new db[(_0xbdae('0x7a'))][(_0xbdae('0x95'))](_0xbdae('0x9a')+_0x154d7d);}_0x23f0c7[_0x264ce['body']['mapKey']]=_0x264ce['body']['from'];return db['CmList']['find']({'where':{'id':_0x264ce['account'][_0xbdae('0x7f')]},'include':[{'model':db['CmContact'],'as':_0xbdae('0x9b'),'where':_0x23f0c7,'limit':0x1,'order':[[_0xbdae('0x9c'),_0xbdae('0x9d')]]}]});})['then'](handleEntityNotFound(_0x23041f,null))[_0xbdae('0x21')](function(_0x3b5c49){if(_0x3b5c49){_0x264ce[_0xbdae('0x9e')]=_['omit'](_0x3b5c49,['Contacts']);if(_0x3b5c49['Contacts'][_0xbdae('0x6f')]){return _0x3b5c49[_0xbdae('0x9b')][0x0];}var _0x47deb9=_['defaults'](_0x264ce['body'],{'firstName':_0x264ce['body']['from'],'ListId':_0x3b5c49['id']});_0x47deb9[_0x264ce[_0xbdae('0x59')][_0xbdae('0x97')]]=_0x264ce['body'][_0xbdae('0x82')];return db[_0xbdae('0x79')][_0xbdae('0x58')](_0x47deb9,{'fields':_0x20bead,'raw':!![]});}})[_0xbdae('0x21')](handleEntityNotFound(_0x23041f,null))[_0xbdae('0x21')](function(_0x5ba953){if(_0x5ba953){_0x264ce[_0xbdae('0x9f')]=_0x5ba953;var _0x59c9d7={'ContactId':_0x5ba953['id'],'phone':_0x264ce[_0xbdae('0x59')][_0xbdae('0x82')],'SmsAccountId':_0x40fff7[_0xbdae('0x54')]['id']};var _0x55747b={'ContactId':_0x5ba953['id'],'SmsAccountId':_0x40fff7[_0xbdae('0x54')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x55747b})[_0xbdae('0x21')](function(_0x32e918){if(_0x32e918){return[_0x32e918,![]];}return db[_0xbdae('0xa0')][_0xbdae('0x58')](_0x59c9d7)[_0xbdae('0x21')](function(_0x3e2776){return[_0x3e2776,!![]];});});}})[_0xbdae('0xa1')](function(_0x52b8cc,_0x8d452c){_0x264ce[_0xbdae('0xa2')]=_0x52b8cc[_0xbdae('0x5d')]({'plain':!![]});_0x264ce[_0xbdae('0xa2')][_0xbdae('0xa3')]=![];if(_0x8d452c){if(_0x264ce['account'][_0xbdae('0xa4')]){_0x264ce[_0xbdae('0x75')][_0xbdae('0xa5')]({'id':0x0,'priority':_0x264ce['applications'][_0xbdae('0x6f')]+0x1,'app':'close','appdata':_0xbdae('0xa6'),'interval':_0xbdae('0xa7')});}_0x264ce[_0xbdae('0xa2')]['created']=!![];}return db[_0xbdae('0xa8')][_0xbdae('0x58')]({'phone':_0x264ce[_0xbdae('0x59')]['from'],'messageId':_0x264ce[_0xbdae('0x59')]['messageId'],'body':_0x264ce[_0xbdae('0x59')][_0xbdae('0x59')],'SmsAccountId':_0x40fff7[_0xbdae('0x54')]['id'],'SmsInteractionId':_0x52b8cc['id'],'direction':'in','ContactId':_0x52b8cc[_0xbdae('0xa9')],'AttachmentId':_0x264ce[_0xbdae('0x59')][_0xbdae('0xaa')]});})[_0xbdae('0x21')](function(_0x238fc8){_0x264ce[_0xbdae('0x29')]=_0x238fc8;if(_0x264ce[_0xbdae('0xa2')][_0xbdae('0xab')]){return db[_0xbdae('0xac')][_0xbdae('0x57')]({'attributes':['id',_0xbdae('0x3a')],'where':{'id':_0x264ce[_0xbdae('0xa2')][_0xbdae('0xab')]}})['then'](function(_0x1f263f){if(_0x1f263f){_0x264ce['applications'][_0xbdae('0xad')]({'id':0x0,'priority':0x0,'app':_0xbdae('0xae'),'appdata':_0x1f263f['name']+','+(_0x264ce[_0xbdae('0x74')][_0xbdae('0xaf')]||0xa),'interval':_0xbdae('0xa7')});}return respondWithRpcPromise(_0xbdae('0xb0'),_0xbdae('0xb1'),_0x264ce);});}return respondWithRpcPromise('Start','startRouting',_0x264ce);})[_0xbdae('0x21')](function(_0x14edf0){if(_0x14edf0){var _0x15c3b1=0xc8;var _0xe0cee8='receiveMessage';logger[_0xbdae('0x22')](_0xbdae('0xb2'),_0xe0cee8,_0x15c3b1,_0xbdae('0xb3'));logger['debug'](_0xbdae('0xb4'),_0xe0cee8,_0x15c3b1,_0xbdae('0xb3'),JSON[_0xbdae('0x26')](_0x14edf0));if(_0x264ce[_0xbdae('0x74')][_0xbdae('0x42')]===_0xbdae('0x81')){return _0x23041f[_0xbdae('0x2e')](_0x15c3b1)[_0xbdae('0xb5')](_0xbdae('0xb6'),_0xbdae('0xb7'))['send'](_0xbdae('0xb8'));}else{return _0x23041f[_0xbdae('0x2e')](_0x15c3b1)['json'](_0x14edf0);}}})[_0xbdae('0x2b')](handleError(_0x23041f,null));};exports[_0xbdae('0xb9')]=function(_0x228029,_0x4c0aca,_0x2d8004){return db[_0xbdae('0x40')][_0xbdae('0x67')]({'where':{'id':_0x228029[_0xbdae('0x54')]['id']}})[_0xbdae('0x21')](handleEntityNotFound(_0x4c0aca,null))[_0xbdae('0x21')](function(_0x3ad953){if(_0x3ad953){return db['sequelize'][_0xbdae('0xba')](function(_0x248ae9){return db[_0xbdae('0xbb')][_0xbdae('0x37')]({'where':{'SmsAccountId':_0x228029[_0xbdae('0x54')]['id']},'transaction':_0x248ae9})['then'](function(_0x5e4a6d){var _0x2cdb9c=_[_0xbdae('0x3f')](_0x228029[_0xbdae('0x59')],function(_0x47b244){_0x47b244[_0xbdae('0x64')]=_0x228029[_0xbdae('0x54')]['id'];return _0x47b244;});return db['SmsApplication'][_0xbdae('0xbc')](_0x2cdb9c,{'transaction':_0x248ae9});});})['then'](function(){return db[_0xbdae('0xbb')]['findAndCountAll']({'where':{'SmsAccountId':_0x228029[_0xbdae('0x54')]['id']},'order':_0xbdae('0x77')});});}})['then'](respondWithResult(_0x4c0aca,null))[_0xbdae('0x2b')](handleError(_0x4c0aca,null));};exports[_0xbdae('0xbd')]=function(_0x48d5fd,_0x47e09e,_0x5ec9f1){var _0x274616={};var _0x26302d={};var _0x10428b;var _0x36c924;return db[_0xbdae('0x40')][_0xbdae('0x67')]({'where':{'id':_0x48d5fd[_0xbdae('0x54')]['id']}})[_0xbdae('0x21')](handleEntityNotFound(_0x47e09e,null))[_0xbdae('0x21')](function(_0xe81952){if(_0xe81952){_0x10428b=_0xe81952;_0x26302d[_0xbdae('0x43')]=_['keys'](db[_0xbdae('0xbb')][_0xbdae('0x41')]);_0x26302d[_0xbdae('0x44')]=_[_0xbdae('0x55')](_0x48d5fd[_0xbdae('0x44')]);_0x26302d[_0xbdae('0x45')]=_[_0xbdae('0x46')](_0x26302d[_0xbdae('0x43')],_0x26302d['query']);_0x274616[_0xbdae('0x47')]=_['intersection'](_0x26302d[_0xbdae('0x43')],qs[_0xbdae('0x48')](_0x48d5fd[_0xbdae('0x44')]['fields']));_0x274616[_0xbdae('0x47')]=_0x274616[_0xbdae('0x47')][_0xbdae('0x6f')]?_0x274616[_0xbdae('0x47')]:_0x26302d[_0xbdae('0x43')];_0x274616[_0xbdae('0x4a')]=qs[_0xbdae('0x4b')](_0x48d5fd[_0xbdae('0x44')][_0xbdae('0x4b')]);_0x274616[_0xbdae('0x4e')]=qs['filters'](_[_0xbdae('0x4c')](_0x48d5fd[_0xbdae('0x44')],_0x26302d[_0xbdae('0x45')]));if(_0x48d5fd['query'][_0xbdae('0x4d')]){_0x274616[_0xbdae('0x4e')]=_['merge'](_0x274616[_0xbdae('0x4e')],{'$or':_[_0xbdae('0x3f')](_0x274616[_0xbdae('0x47')],function(_0x1871b6){var _0x24c17c={};_0x24c17c[_0x1871b6]={'$like':'%'+_0x48d5fd[_0xbdae('0x44')]['filter']+'%'};return _0x24c17c;})});}_0x274616=_[_0xbdae('0x4f')]({},_0x274616,_0x48d5fd[_0xbdae('0x51')]);return _0x10428b[_0xbdae('0xbd')](_0x274616);}})[_0xbdae('0x21')](function(_0x5c27c8){if(_0x5c27c8){_0x36c924=_0x5c27c8[_0xbdae('0x6f')];if(!_0x48d5fd[_0xbdae('0x44')][_0xbdae('0x49')]('nolimit')){_0x274616[_0xbdae('0x32')]=qs[_0xbdae('0x32')](_0x48d5fd[_0xbdae('0x44')][_0xbdae('0x32')]);_0x274616['offset']=qs[_0xbdae('0x31')](_0x48d5fd['query'][_0xbdae('0x31')]);}return _0x10428b[_0xbdae('0xbd')](_0x274616);}})['then'](function(_0x23b8f9){if(_0x23b8f9){return _0x23b8f9?{'count':_0x36c924,'rows':_0x23b8f9}:null;}})[_0xbdae('0x21')](respondWithResult(_0x47e09e,null))[_0xbdae('0x2b')](handleError(_0x47e09e,null));};exports[_0xbdae('0xbe')]=function(_0x5e1f1b,_0x295599,_0xde88bb){var _0xbf8623={'raw':![],'where':{}};var _0x5bd1f6={};var _0x1135bc={'count':0x0,'rows':[]};return db[_0xbdae('0x40')]['findOne']({'where':{'id':_0x5e1f1b['params']['id']}})[_0xbdae('0x21')](handleEntityNotFound(_0x295599,null))[_0xbdae('0x21')](function(_0x572ebe){if(_0x572ebe){_0x5bd1f6['model']=_['keys'](db[_0xbdae('0xa0')][_0xbdae('0x41')]);_0x5bd1f6[_0xbdae('0x44')]=_['keys'](_0x5e1f1b[_0xbdae('0x44')]);_0x5bd1f6[_0xbdae('0x45')]=_[_0xbdae('0x46')](_0x5bd1f6['model'],_0x5bd1f6[_0xbdae('0x44')]);_0xbf8623[_0xbdae('0x47')]=_[_0xbdae('0x46')](_0x5bd1f6[_0xbdae('0x43')],qs[_0xbdae('0x48')](_0x5e1f1b[_0xbdae('0x44')]['fields']));_0xbf8623[_0xbdae('0x47')]=_0xbf8623[_0xbdae('0x47')][_0xbdae('0x6f')]?_0xbf8623[_0xbdae('0x47')]:_0x5bd1f6[_0xbdae('0x43')];if(!_0x5e1f1b[_0xbdae('0x44')][_0xbdae('0x49')](_0xbdae('0x68'))){_0xbf8623[_0xbdae('0x32')]=qs['limit'](_0x5e1f1b[_0xbdae('0x44')][_0xbdae('0x32')]);_0xbf8623[_0xbdae('0x31')]=qs['offset'](_0x5e1f1b[_0xbdae('0x44')][_0xbdae('0x31')]);}_0xbf8623[_0xbdae('0x4a')]=qs[_0xbdae('0x4b')](_0x5e1f1b['query']['sort']);_0xbf8623['where']=qs[_0xbdae('0x45')](_[_0xbdae('0x4c')](_0x5e1f1b[_0xbdae('0x44')],_0x5bd1f6[_0xbdae('0x45')]));_0xbf8623[_0xbdae('0x4e')][_0xbdae('0x64')]=_0x572ebe['id'];if(_0x5e1f1b['query']['filter']){_0xbf8623[_0xbdae('0x4e')]=_[_0xbdae('0x4f')](_0xbf8623['where'],{'$or':_['map'](_0xbf8623[_0xbdae('0x47')],function(_0x183d48){var _0x1282ff={};_0x1282ff[_0x183d48]={'$like':'%'+_0x5e1f1b[_0xbdae('0x44')][_0xbdae('0x4d')]+'%'};return _0x1282ff;})});}_0xbf8623=_[_0xbdae('0x4f')]({},_0xbf8623,_0x5e1f1b[_0xbdae('0x51')]);return db['SmsInteraction'][_0xbdae('0x30')]({'where':_0xbf8623[_0xbdae('0x4e')]})[_0xbdae('0x21')](function(_0x189963){_0x1135bc[_0xbdae('0x30')]=_0x189963;if(_0x5e1f1b[_0xbdae('0x44')][_0xbdae('0x56')]){_0xbf8623['include']=[{'model':db['CmContact'],'as':_0xbdae('0xbf'),'required':![]},{'model':db['User'],'as':_0xbdae('0xc0'),'attributes':['name','fullname',_0xbdae('0xc1')],'required':![]},{'model':db[_0xbdae('0xc2')],'as':_0xbdae('0xc3'),'attributes':['id','name',_0xbdae('0xc4')],'where':_0x5e1f1b[_0xbdae('0x44')][_0xbdae('0xc5')]?{'id':_0x5e1f1b[_0xbdae('0x44')][_0xbdae('0xc5')]}:undefined,'required':_0x5e1f1b[_0xbdae('0x44')][_0xbdae('0xc5')]?!![]:![]}];}return db['SmsInteraction'][_0xbdae('0x69')](_0xbf8623);})['then'](function(_0x6b487e){_0x1135bc['rows']=_0x6b487e;return _0x1135bc;});}})[_0xbdae('0x21')](respondWithFilteredResult(_0x295599,_0xbf8623))[_0xbdae('0x2b')](handleError(_0x295599,null));};exports['send']=function(_0x3a9003,_0x53490d,_0x2255c8){var _0xaf3ff6,_0x13b9a1,_0x34f99d;if(_[_0xbdae('0x94')](_0x3a9003['body'][_0xbdae('0x59')])||_0x3a9003[_0xbdae('0x59')][_0xbdae('0x59')]===''){throw new db[(_0xbdae('0x7a'))][(_0xbdae('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbdae('0x94')](_0x3a9003['body']['to'])){throw new db['Sequelize'][(_0xbdae('0x95'))](_0xbdae('0xc6'));}_0xaf3ff6=_0x3a9003[_0xbdae('0x59')]['to'];return db[_0xbdae('0x40')][_0xbdae('0x57')]({'where':{'id':_0x3a9003[_0xbdae('0x54')]['id']},'include':[{'model':db[_0xbdae('0xc7')],'as':_0xbdae('0xc8'),'include':[{'model':db['CmContact'],'as':_0xbdae('0x9b'),'where':{'mobile':_0xaf3ff6},'limit':0x1,'order':[[_0xbdae('0x9c'),_0xbdae('0x9d')]]}]}]})[_0xbdae('0x21')](handleEntityNotFound(_0x53490d,null))[_0xbdae('0x21')](function(_0x37a969){if(_0x37a969&&_0x37a969[_0xbdae('0xc8')]){_0x13b9a1=_0x37a969[_0xbdae('0x5d')]({'plain':!![]});if(_0x13b9a1['List']&&_0x13b9a1['List']['Contacts'][_0xbdae('0x6f')]){return _0x13b9a1['List'][_0xbdae('0x9b')][0x0];}return db[_0xbdae('0x79')][_0xbdae('0x58')](_[_0xbdae('0x19')](_0x3a9003['body'],{'firstName':_0xaf3ff6,'mobile':_0xaf3ff6,'phone':_0xaf3ff6,'ListId':_0x13b9a1[_0xbdae('0x7f')]}));}})[_0xbdae('0x21')](handleEntityNotFound(_0x53490d,null))['then'](function(_0x451be9){if(_0x451be9){_0x34f99d=_0x451be9;return db[_0xbdae('0xa0')][_0xbdae('0x57')]({'where':{'ContactId':_0x34f99d['id'],'closed':![],'SmsAccountId':_0x13b9a1['id']}})[_0xbdae('0x21')](function(_0x2ef3f4){if(_0x2ef3f4){return[_0x2ef3f4,![]];}return db['SmsInteraction'][_0xbdae('0x58')]({'UserId':_0x3a9003[_0xbdae('0x5c')]['id'],'ContactId':_0x34f99d['id'],'SmsAccountId':_0x13b9a1['id'],'phone':_0xaf3ff6,'firstMsgDirection':'out','Messages':[_[_0xbdae('0x4f')](_0x3a9003[_0xbdae('0x59')],{'read':![],'body':_0x3a9003[_0xbdae('0x59')][_0xbdae('0x59')],'phone':_0xaf3ff6,'SmsAccountId':_0x13b9a1['id'],'UserId':_0x3a9003[_0xbdae('0x5c')]['id'],'ContactId':_0x34f99d['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})['then'](function(_0x2c4ec6){return[_0x2c4ec6,!![]];});});}})[_0xbdae('0xa1')](function(_0x3c671c,_0x46aa7f){if(_0x46aa7f){return _0x3c671c;}return db[_0xbdae('0xa8')][_0xbdae('0x58')](_['merge'](_0x3a9003['body'],{'read':![],'body':_0x3a9003['body'][_0xbdae('0x59')],'phone':_0xaf3ff6,'SmsAccountId':_0x13b9a1['id'],'SmsInteractionId':_0x3c671c['id'],'UserId':_0x3a9003[_0xbdae('0x5c')]['id'],'ContactId':_0x34f99d['id']}))[_0xbdae('0x21')](function(_0x15a3bd){_0x3c671c[_0xbdae('0xc9')][_0xbdae('0xca')]=[];_0x3c671c[_0xbdae('0xc9')][_0xbdae('0xca')][_0xbdae('0xa5')](_0x15a3bd[_0xbdae('0xc9')]);return _0x3c671c;});})[_0xbdae('0x21')](respondWithResult(_0x53490d,null))[_0xbdae('0x2b')](handleError(_0x53490d,null));};exports[_0xbdae('0x2e')]=function(_0x108b4d,_0x43c938,_0x1f3975){if(_0x108b4d[_0xbdae('0x59')]['id']){delete _0x108b4d[_0xbdae('0x59')]['id'];}var _0x46a936,_0x4c3121,_0x31933c;return db[_0xbdae('0x40')][_0xbdae('0x57')]({'where':{'id':_0x108b4d[_0xbdae('0x54')]['id']}})[_0xbdae('0x21')](handleEntityNotFound(_0x43c938,null))['then'](function(_0x1e3e0c){if(_0x1e3e0c){_0x31933c=_0x1e3e0c;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbdae('0x2e'),_0xbdae('0xcb'),_0x1e3e0c[_0xbdae('0x42')],util[_0xbdae('0xcc')](_0x108b4d[_0xbdae('0x59')],{'showHidden':![],'depth':null}));switch(_0x1e3e0c[_0xbdae('0x42')]){case'skebby':if(_0x108b4d[_0xbdae('0x59')][_0xbdae('0xcd')]&&_0x108b4d[_0xbdae('0x59')][_0xbdae('0x2e')]){_0x4c3121=_0x108b4d[_0xbdae('0x59')][_0xbdae('0x2e')];return db[_0xbdae('0xa8')]['find']({'where':{'messageId':_0x108b4d[_0xbdae('0x59')]['skebby_dispatch_id']}});}break;case _0xbdae('0x8a'):if(_0x108b4d[_0xbdae('0x59')][_0xbdae('0xce')]&&_0x108b4d[_0xbdae('0x59')][_0xbdae('0xcf')]){_0x4c3121=_0x108b4d['body']['statusInt'];return db[_0xbdae('0xa8')][_0xbdae('0x57')]({'where':{'messageId':_0x108b4d[_0xbdae('0x59')][_0xbdae('0xce')]}});}break;case _0xbdae('0x8b'):if(_0x108b4d['body'][_0xbdae('0xd0')]&&_0x108b4d[_0xbdae('0x59')][_0xbdae('0xd1')]){_0x4c3121=_0x108b4d[_0xbdae('0x59')]['status_code'];return db['SmsMessage']['find']({'where':{'messageId':_0x108b4d['body']['message_id']}});}break;case _0xbdae('0xd2'):var _0x51b1a4=_0x108b4d[_0xbdae('0x59')]['results'][0x0];if(_0x51b1a4[_0xbdae('0x85')]&&_0x51b1a4['status'][_0xbdae('0xd3')]==='DELIVERED'){_0x4c3121=_0x51b1a4['status']['groupName'];return db[_0xbdae('0xa8')][_0xbdae('0x57')]({'where':{'messageId':_0x51b1a4['messageId']}});}break;case _0xbdae('0xd4'):if(_0x108b4d['body']['messageId']&&_0x108b4d[_0xbdae('0x59')][_0xbdae('0x2e')]){_0x4c3121=_0x108b4d[_0xbdae('0x59')]['status'];return db[_0xbdae('0xa8')][_0xbdae('0x57')]({'where':{'messageId':_0x108b4d[_0xbdae('0x59')][_0xbdae('0x85')]}});}break;case'bandwidth':if(_0x108b4d[_0xbdae('0x59')][0x0][_0xbdae('0x29')]['id']){_0x4c3121=_0x108b4d[_0xbdae('0x59')][0x0][_0xbdae('0x42')];return db[_0xbdae('0xa8')][_0xbdae('0x57')]({'where':{'messageId':_0x108b4d['body'][0x0][_0xbdae('0x29')]['id']}});}break;case _0xbdae('0xd5'):if(_0x108b4d[_0xbdae('0x59')][_0xbdae('0xd6')]&&_0x108b4d[_0xbdae('0x59')][_0xbdae('0x2e')]){_0x4c3121=_0x108b4d['body']['status'];return db['SmsMessage'][_0xbdae('0x57')]({'where':{'messageId':_0x108b4d[_0xbdae('0x59')][_0xbdae('0xd6')]}});}break;}}})[_0xbdae('0x21')](handleEntityNotFound(_0x43c938,null))[_0xbdae('0x21')](function(_0x4f3889){if(_0x4f3889){_0x46a936=_0x4f3889;switch(_0x31933c[_0xbdae('0x42')]){case _0xbdae('0x87'):if(_0x4c3121===_0xbdae('0xd7')){return _0x46a936[_0xbdae('0x36')]({'read':!![]});}else{logger[_0xbdae('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbdae('0x2e'),_0xbdae('0x87'),util[_0xbdae('0xcc')](_0x108b4d['body'],{'showHidden':![],'depth':null}));}break;case _0xbdae('0x8a'):if(_0x4c3121==='1'){return _0x46a936[_0xbdae('0x36')]({'read':!![]});}else{logger[_0xbdae('0x27')](_0xbdae('0xb2'),_0xbdae('0x2e'),_0xbdae('0x87'),util[_0xbdae('0xcc')](_0x108b4d[_0xbdae('0x59')],{'showHidden':![],'depth':null}));}break;case _0xbdae('0x8b'):if(!_0x108b4d[_0xbdae('0x59')][_0xbdae('0xd8')]&&_0x4c3121>=0xc8&&_0x4c3121<=0xce){return _0x46a936[_0xbdae('0x36')]({'read':!![]});}else{logger[_0xbdae('0x27')](_0xbdae('0xb2'),_0xbdae('0x2e'),_0xbdae('0x8b'),util[_0xbdae('0xcc')](_0x108b4d[_0xbdae('0x59')],{'showHidden':![],'depth':null}));}break;case _0xbdae('0xd2'):var _0x18e396=_0x108b4d[_0xbdae('0x59')][_0xbdae('0x8d')][0x0];if(_0x18e396[_0xbdae('0x2e')][_0xbdae('0xd3')]===_0xbdae('0xd7')){return _0x46a936[_0xbdae('0x36')]({'read':!![]});}else{logger[_0xbdae('0x27')](_0xbdae('0xb2'),_0xbdae('0x2e'),_0xbdae('0xd2'),util[_0xbdae('0xcc')](_0x108b4d[_0xbdae('0x59')],{'showHidden':![],'depth':null}));}break;case _0xbdae('0xd4'):if(_0x4c3121=='DELIVERED_TO_GATEWAY'||_0x4c3121==_0xbdae('0xd9')){return _0x46a936['update']({'read':!![]});}else{logger[_0xbdae('0x27')](_0xbdae('0xb2'),_0xbdae('0x2e'),'clickatell',util[_0xbdae('0xcc')](_0x108b4d['body'],{'showHidden':![],'depth':null}));}break;case _0xbdae('0x92'):if(_0x4c3121=='message-delivered'){return _0x46a936[_0xbdae('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbdae('0x2e'),_0xbdae('0x92'),util[_0xbdae('0xcc')](_0x108b4d[_0xbdae('0x59')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x4c3121===_0xbdae('0xda')||_0x4c3121===_0xbdae('0xdb')){return _0x46a936['update']({'read':!![]});}else{logger[_0xbdae('0x27')](_0xbdae('0xb2'),'status',_0xbdae('0xd5'),util[_0xbdae('0xcc')](_0x108b4d[_0xbdae('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x46a936;}})[_0xbdae('0x21')](respondWithResult(_0x43c938,null))[_0xbdae('0x2b')](handleError(_0x43c938,null));};exports['statusGet']=function(_0x2c78f2,_0x2f369f,_0x3b0adf){var _0x3517b6,_0x522343,_0x48518d;return db[_0xbdae('0x40')][_0xbdae('0x57')]({'where':{'id':_0x2c78f2[_0xbdae('0x54')]['id']}})[_0xbdae('0x21')](handleEntityNotFound(_0x2f369f,null))[_0xbdae('0x21')](function(_0x4cef31){if(_0x4cef31){_0x48518d=_0x4cef31;logger[_0xbdae('0x25')](_0xbdae('0xb2'),'status','received\x20delivery\x20report\x20from',_0x4cef31['type'],util[_0xbdae('0xcc')](_0x2c78f2[_0xbdae('0x44')],{'showHidden':![],'depth':null}));switch(_0x4cef31[_0xbdae('0x42')]){case'csc':if(_0x2c78f2['query'][_0xbdae('0xdc')]&&_0x2c78f2[_0xbdae('0x44')]['state']){_0x522343=_0x2c78f2[_0xbdae('0x44')][_0xbdae('0xdd')];return db[_0xbdae('0xa8')]['find']({'where':{'messageId':_0x2c78f2[_0xbdae('0x44')][_0xbdae('0xdc')]}});}break;}}})[_0xbdae('0x21')](handleEntityNotFound(_0x2f369f,null))['then'](function(_0x2d7af9){if(_0x2d7af9){_0x3517b6=_0x2d7af9;switch(_0x48518d[_0xbdae('0x42')]){case _0xbdae('0x8e'):if(_0x522343==='2'||_0x522343==='6'){return _0x3517b6[_0xbdae('0x36')]({'read':!![]});}else{logger[_0xbdae('0x27')](_0xbdae('0xb2'),_0xbdae('0x2e'),_0xbdae('0x8e'),util[_0xbdae('0xcc')](_0x2c78f2[_0xbdae('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x3517b6;}})[_0xbdae('0x21')](respondWithResult(_0x2f369f,null))['catch'](handleError(_0x2f369f,null));};exports['addAgents']=function(_0x4e2c67,_0x53cc5a,_0x2ec47e){return db['SmsAccount']['find']({'where':{'id':_0x4e2c67[_0xbdae('0x54')]['id']}})[_0xbdae('0x21')](handleEntityNotFound(_0x53cc5a,null))[_0xbdae('0x21')](function(_0x5eb46b){if(_0x5eb46b){return _0x5eb46b[_0xbdae('0xde')](_0x4e2c67['body'][_0xbdae('0x6c')],_[_0xbdae('0xdf')](_0x4e2c67[_0xbdae('0x59')],[_0xbdae('0x6c'),'id'])||{})[_0xbdae('0xa1')](function(_0x43a31c){for(var _0x2be719=0x0;_0x2be719<_0x4e2c67[_0xbdae('0x59')][_0xbdae('0x6c')][_0xbdae('0x6f')];_0x2be719+=0x1){socket[_0xbdae('0xe0')]('userSmsAccount:save',{'UserId':_0x4e2c67[_0xbdae('0x59')][_0xbdae('0x6c')][_0x2be719],'SmsAccountId':_0x4e2c67[_0xbdae('0x54')]['id']});}return _0x43a31c;});}})[_0xbdae('0x21')](respondWithResult(_0x53cc5a,null))[_0xbdae('0x2b')](handleError(_0x53cc5a,null));};exports[_0xbdae('0xe1')]=function(_0x125242,_0x255142,_0x4cc56d){return db[_0xbdae('0x40')][_0xbdae('0x57')]({'where':{'id':_0x125242[_0xbdae('0x54')]['id']}})['then'](handleEntityNotFound(_0x255142,null))['then'](function(_0x40a9f7){if(_0x40a9f7){return _0x40a9f7[_0xbdae('0xe1')](_0x125242[_0xbdae('0x44')][_0xbdae('0x6c')])[_0xbdae('0x21')](function(){if(_[_0xbdae('0xe2')](_0x125242[_0xbdae('0x44')][_0xbdae('0x6c')])){for(var _0x1ec371=0x0;_0x1ec371<_0x125242[_0xbdae('0x44')][_0xbdae('0x6c')][_0xbdae('0x6f')];_0x1ec371+=0x1){socket[_0xbdae('0xe0')](_0xbdae('0xe3'),{'UserId':Number(_0x125242['query']['ids'][_0x1ec371]),'SmsAccountId':Number(_0x125242[_0xbdae('0x54')]['id'])});}}else{socket[_0xbdae('0xe0')](_0xbdae('0xe3'),{'UserId':Number(_0x125242[_0xbdae('0x44')][_0xbdae('0x6c')]),'SmsAccountId':Number(_0x125242[_0xbdae('0x54')]['id'])});}});}})[_0xbdae('0x21')](respondWithStatusCode(_0x255142,null))['catch'](handleError(_0x255142,null));};exports['getAgents']=function(_0x2e8184,_0x361587,_0x11315c){var _0x5d7312={};var _0x11e3f5={};var _0x4c16bc;var _0x30891c;return db[_0xbdae('0x40')][_0xbdae('0x67')]({'where':{'id':_0x2e8184[_0xbdae('0x54')]['id']}})[_0xbdae('0x21')](handleEntityNotFound(_0x361587,null))['then'](function(_0x54c247){if(_0x54c247){_0x4c16bc=_0x54c247;_0x11e3f5[_0xbdae('0x43')]=_['keys'](db['User'][_0xbdae('0x41')]);_0x11e3f5[_0xbdae('0x44')]=_[_0xbdae('0x55')](_0x2e8184['query']);_0x11e3f5[_0xbdae('0x45')]=_['intersection'](_0x11e3f5['model'],_0x11e3f5[_0xbdae('0x44')]);_0x5d7312[_0xbdae('0x47')]=_[_0xbdae('0x46')](_0x11e3f5[_0xbdae('0x43')],qs[_0xbdae('0x48')](_0x2e8184[_0xbdae('0x44')]['fields']));_0x5d7312[_0xbdae('0x47')]=_0x5d7312['attributes'][_0xbdae('0x6f')]?_0x5d7312[_0xbdae('0x47')]:_0x11e3f5['model'];_0x5d7312['order']=qs['sort'](_0x2e8184['query']['sort']);_0x5d7312[_0xbdae('0x4e')]=qs[_0xbdae('0x45')](_[_0xbdae('0x4c')](_0x2e8184['query'],_0x11e3f5[_0xbdae('0x45')]));if(_0x2e8184[_0xbdae('0x44')][_0xbdae('0x4d')]){_0x5d7312[_0xbdae('0x4e')]=_['merge'](_0x5d7312[_0xbdae('0x4e')],{'$or':_[_0xbdae('0x3f')](_0x5d7312[_0xbdae('0x47')],function(_0x579e9d){var _0x168b72={};_0x168b72[_0x579e9d]={'$like':'%'+_0x2e8184[_0xbdae('0x44')][_0xbdae('0x4d')]+'%'};return _0x168b72;})});}_0x5d7312=_[_0xbdae('0x4f')]({},_0x5d7312,_0x2e8184['options']);return _0x4c16bc[_0xbdae('0xe4')](_0x5d7312);}})['then'](function(_0x32c142){if(_0x32c142){_0x30891c=_0x32c142['length'];if(!_0x2e8184[_0xbdae('0x44')][_0xbdae('0x49')](_0xbdae('0x68'))){_0x5d7312[_0xbdae('0x32')]=qs[_0xbdae('0x32')](_0x2e8184['query'][_0xbdae('0x32')]);_0x5d7312[_0xbdae('0x31')]=qs[_0xbdae('0x31')](_0x2e8184[_0xbdae('0x44')][_0xbdae('0x31')]);}return _0x4c16bc[_0xbdae('0xe4')](_0x5d7312);}})[_0xbdae('0x21')](function(_0x3f9755){if(_0x3f9755){return _0x3f9755?{'count':_0x30891c,'rows':_0x3f9755}:null;}})['then'](respondWithResult(_0x361587,null))['catch'](handleError(_0x361587,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 7ea6698..23825ba 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 _0x0c17=['exports','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3153ef,_0x583952){var _0x43c421=function(_0x29cc4f){while(--_0x29cc4f){_0x3153ef['push'](_0x3153ef['shift']());}};_0x43c421(++_0x583952);}(_0x0c17,0xe1));var _0x70c1=function(_0x1159d3,_0x51f60d){_0x1159d3=_0x1159d3-0x0;var _0x26d2ae=_0x0c17[_0x1159d3];return _0x26d2ae;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x70c1('0x0')](0x0);var events={'afterCreate':_0x70c1('0x1'),'afterUpdate':_0x70c1('0x2'),'afterDestroy':_0x70c1('0x3')};function emitEvent(_0x497708){return function(_0x4b3d91,_0x90248b,_0x24559a){SmsAccountEvents[_0x70c1('0x4')](_0x497708+':'+_0x4b3d91['id'],_0x4b3d91);SmsAccountEvents[_0x70c1('0x4')](_0x497708,_0x4b3d91);_0x24559a(null);};}for(var e in events){if(events[_0x70c1('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x70c1('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xbb32=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x17842d,_0x12bb0c){var _0x57d518=function(_0x3148c3){while(--_0x3148c3){_0x17842d['push'](_0x17842d['shift']());}};_0x57d518(++_0x12bb0c);}(_0xbb32,0x18f));var _0x2bb3=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0xbb32[_0x54defc];return _0x1955d3;};'use strict';var EventEmitter=require(_0x2bb3('0x0'));var SmsAccount=require(_0x2bb3('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2bb3('0x2')](0x0);var events={'afterCreate':_0x2bb3('0x3'),'afterUpdate':_0x2bb3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x546e5b){return function(_0x41785f,_0x422ce1,_0x39c3e9){SmsAccountEvents[_0x2bb3('0x5')](_0x546e5b+':'+_0x41785f['id'],_0x41785f);SmsAccountEvents[_0x2bb3('0x5')](_0x546e5b,_0x41785f);_0x39c3e9(null);};}for(var e in events){if(events[_0x2bb3('0x6')](e)){var event=events[e];SmsAccount[_0x2bb3('0x7')](e,emitEvent(event));}}module[_0x2bb3('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index b49f0c4..4f0d0a8 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 _0xe833=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','../../config/logger','api'];(function(_0x564a30,_0x5cd902){var _0xa0e034=function(_0x1b7fbb){while(--_0x1b7fbb){_0x564a30['push'](_0x564a30['shift']());}};_0xa0e034(++_0x5cd902);}(_0xe833,0xf9));var _0x3e83=function(_0x132e7b,_0x117ea1){_0x132e7b=_0x132e7b-0x0;var _0x47c67a=_0xe833[_0x132e7b];return _0x47c67a;};'use strict';var _=require(_0x3e83('0x0'));var util=require('util');var logger=require(_0x3e83('0x1'))(_0x3e83('0x2'));var moment=require(_0x3e83('0x3'));var BPromise=require(_0x3e83('0x4'));var rp=require(_0x3e83('0x5'));var fs=require('fs');var path=require(_0x3e83('0x6'));var rimraf=require(_0x3e83('0x7'));var config=require(_0x3e83('0x8'));var attributes=require(_0x3e83('0x9'));module[_0x3e83('0xa')]=function(_0x5e9fd8,_0x3f8e7b){return _0x5e9fd8[_0x3e83('0xb')](_0x3e83('0xc'),attributes,{'tableName':_0x3e83('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32bd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','define','sms_accounts','lodash','../../config/logger','api'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x32bd,0x159));var _0xd32b=function(_0x51b7c4,_0x22ec74){_0x51b7c4=_0x51b7c4-0x0;var _0x4ed67c=_0x32bd[_0x51b7c4];return _0x4ed67c;};'use strict';var _=require(_0xd32b('0x0'));var util=require('util');var logger=require(_0xd32b('0x1'))(_0xd32b('0x2'));var moment=require(_0xd32b('0x3'));var BPromise=require(_0xd32b('0x4'));var rp=require(_0xd32b('0x5'));var fs=require('fs');var path=require(_0xd32b('0x6'));var rimraf=require(_0xd32b('0x7'));var config=require(_0xd32b('0x8'));var attributes=require(_0xd32b('0x9'));module['exports']=function(_0x2fd652,_0x34dc56){return _0x2fd652[_0xd32b('0xa')]('SmsAccount',attributes,{'tableName':_0xd32b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index ec1c41b..13a000d 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 _0xbf68=['../../config/environment','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','SmsAccount','find','options','raw','where','attributes','map','model','include','ShowSmsAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x38a10f,_0x56ef14){var _0x1c03d3=function(_0x30cc61){while(--_0x30cc61){_0x38a10f['push'](_0x38a10f['shift']());}};_0x1c03d3(++_0x56ef14);}(_0xbf68,0x6d));var _0x8bf6=function(_0x4faa5c,_0x4198ee){_0x4faa5c=_0x4faa5c-0x0;var _0x1f0339=_0xbf68[_0x4faa5c];return _0x1f0339;};'use strict';var _=require(_0x8bf6('0x0'));var util=require(_0x8bf6('0x1'));var moment=require(_0x8bf6('0x2'));var BPromise=require(_0x8bf6('0x3'));var rs=require(_0x8bf6('0x4'));var fs=require('fs');var Redis=require(_0x8bf6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8bf6('0x6'));var logger=require(_0x8bf6('0x7'))('rpc');var config=require(_0x8bf6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8bf6('0x9')][_0x8bf6('0xa')]({'port':0x232a});config[_0x8bf6('0xb')]=_['defaults'](config[_0x8bf6('0xb')],{'host':_0x8bf6('0xc'),'port':0x18eb});var socket=require(_0x8bf6('0xd'))(new Redis(config[_0x8bf6('0xb')]));require(_0x8bf6('0xe'))[_0x8bf6('0xf')](socket);function respondWithRpcPromise(_0x255ebd,_0x2ab04a,_0x555996){return new BPromise(function(_0x105f14,_0x77d683){return client[_0x8bf6('0x10')](_0x255ebd,_0x555996)[_0x8bf6('0x11')](function(_0x310301){logger[_0x8bf6('0x12')](_0x8bf6('0x13'),_0x2ab04a,'request\x20sent');logger[_0x8bf6('0x14')](_0x8bf6('0x15'),_0x2ab04a,_0x8bf6('0x16'),JSON['stringify'](_0x310301));if(_0x310301[_0x8bf6('0x17')]){if(_0x310301[_0x8bf6('0x17')][_0x8bf6('0x18')]===0x1f4){logger[_0x8bf6('0x17')]('SmsAccount,\x20%s,\x20%s',_0x2ab04a,_0x310301[_0x8bf6('0x17')][_0x8bf6('0x19')]);return _0x77d683(_0x310301[_0x8bf6('0x17')][_0x8bf6('0x19')]);}logger[_0x8bf6('0x17')](_0x8bf6('0x13'),_0x2ab04a,_0x310301[_0x8bf6('0x17')][_0x8bf6('0x19')]);return _0x105f14(_0x310301[_0x8bf6('0x17')][_0x8bf6('0x19')]);}else{logger[_0x8bf6('0x12')](_0x8bf6('0x13'),_0x2ab04a,'request\x20sent');_0x105f14(_0x310301[_0x8bf6('0x1a')][_0x8bf6('0x19')]);}})[_0x8bf6('0x1b')](function(_0x22dca3){logger['error'](_0x8bf6('0x13'),_0x2ab04a,_0x22dca3);_0x77d683(_0x22dca3);});});}exports['ShowSmsAccount']=function(_0x23b8de){var _0x157917=this;return new Promise(function(_0x1245fa,_0x294393){return db[_0x8bf6('0x1c')][_0x8bf6('0x1d')]({'raw':_0x23b8de['options']?_0x23b8de[_0x8bf6('0x1e')][_0x8bf6('0x1f')]===undefined?!![]:![]:!![],'where':_0x23b8de[_0x8bf6('0x1e')]?_0x23b8de[_0x8bf6('0x1e')][_0x8bf6('0x20')]||null:null,'attributes':_0x23b8de[_0x8bf6('0x1e')]?_0x23b8de[_0x8bf6('0x1e')][_0x8bf6('0x21')]||null:null,'include':_0x23b8de[_0x8bf6('0x1e')]?_0x23b8de['options']['include']?_[_0x8bf6('0x22')](_0x23b8de[_0x8bf6('0x1e')]['include'],function(_0x1b98f5){return{'model':db[_0x1b98f5[_0x8bf6('0x23')]],'as':_0x1b98f5['as'],'attributes':_0x1b98f5[_0x8bf6('0x21')],'include':_0x1b98f5[_0x8bf6('0x24')]?_[_0x8bf6('0x22')](_0x1b98f5[_0x8bf6('0x24')],function(_0x5bc6f5){return{'model':db[_0x5bc6f5['model']],'as':_0x5bc6f5['as'],'attributes':_0x5bc6f5[_0x8bf6('0x21')],'include':_0x5bc6f5[_0x8bf6('0x24')]?_[_0x8bf6('0x22')](_0x5bc6f5[_0x8bf6('0x24')],function(_0x15daee){return{'model':db[_0x15daee['model']],'as':_0x15daee['as'],'attributes':_0x15daee[_0x8bf6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8bf6('0x11')](function(_0x1071b6){logger[_0x8bf6('0x12')](_0x8bf6('0x25'),_0x23b8de);logger[_0x8bf6('0x14')](_0x8bf6('0x25'),_0x23b8de,JSON[_0x8bf6('0x26')](_0x1071b6));_0x1245fa(_0x1071b6);})[_0x8bf6('0x1b')](function(_0x2e6b29){logger[_0x8bf6('0x17')]('ShowSmsAccount',_0x2e6b29[_0x8bf6('0x19')],_0x23b8de);_0x294393(_0x157917[_0x8bf6('0x17')](0x1f4,_0x2e6b29['message']));});});}; \ No newline at end of file +var _0x4feb=['model','include','map','then','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4feb,0xeb));var _0xb4fe=function(_0x54964f,_0x2f7004){_0x54964f=_0x54964f-0x0;var _0x346dd5=_0x4feb[_0x54964f];return _0x346dd5;};'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(_0xb4fe('0x0'));var db=require(_0xb4fe('0x1'))['db'];var utils=require(_0xb4fe('0x2'));var logger=require(_0xb4fe('0x3'))('rpc');var config=require(_0xb4fe('0x4'));var jayson=require(_0xb4fe('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0xb4fe('0x6')]=_[_0xb4fe('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb4fe('0x8'))(new Redis(config['redis']));require(_0xb4fe('0x9'))[_0xb4fe('0xa')](socket);function respondWithRpcPromise(_0x5285a5,_0xe88bb4,_0x48b702){return new BPromise(function(_0x3814f2,_0x57d76a){return client[_0xb4fe('0xb')](_0x5285a5,_0x48b702)['then'](function(_0x185a8c){logger['info']('SmsAccount,\x20%s,\x20%s',_0xe88bb4,'request\x20sent');logger[_0xb4fe('0xc')](_0xb4fe('0xd'),_0xe88bb4,_0xb4fe('0xe'),JSON[_0xb4fe('0xf')](_0x185a8c));if(_0x185a8c[_0xb4fe('0x10')]){if(_0x185a8c[_0xb4fe('0x10')][_0xb4fe('0x11')]===0x1f4){logger[_0xb4fe('0x10')](_0xb4fe('0x12'),_0xe88bb4,_0x185a8c[_0xb4fe('0x10')]['message']);return _0x57d76a(_0x185a8c['error'][_0xb4fe('0x13')]);}logger[_0xb4fe('0x10')](_0xb4fe('0x12'),_0xe88bb4,_0x185a8c[_0xb4fe('0x10')][_0xb4fe('0x13')]);return _0x3814f2(_0x185a8c['error']['message']);}else{logger[_0xb4fe('0x14')]('SmsAccount,\x20%s,\x20%s',_0xe88bb4,'request\x20sent');_0x3814f2(_0x185a8c[_0xb4fe('0x15')][_0xb4fe('0x13')]);}})[_0xb4fe('0x16')](function(_0xc9dbf9){logger[_0xb4fe('0x10')](_0xb4fe('0x12'),_0xe88bb4,_0xc9dbf9);_0x57d76a(_0xc9dbf9);});});}exports[_0xb4fe('0x17')]=function(_0x189fa1){var _0x2e039d=this;return new Promise(function(_0x4f1982,_0x3f1780){return db[_0xb4fe('0x18')][_0xb4fe('0x19')]({'raw':_0x189fa1['options']?_0x189fa1['options']['raw']===undefined?!![]:![]:!![],'where':_0x189fa1['options']?_0x189fa1[_0xb4fe('0x1a')][_0xb4fe('0x1b')]||null:null,'attributes':_0x189fa1['options']?_0x189fa1['options'][_0xb4fe('0x1c')]||null:null,'include':_0x189fa1[_0xb4fe('0x1a')]?_0x189fa1[_0xb4fe('0x1a')]['include']?_['map'](_0x189fa1['options']['include'],function(_0x2ed896){return{'model':db[_0x2ed896[_0xb4fe('0x1d')]],'as':_0x2ed896['as'],'attributes':_0x2ed896[_0xb4fe('0x1c')],'include':_0x2ed896[_0xb4fe('0x1e')]?_[_0xb4fe('0x1f')](_0x2ed896[_0xb4fe('0x1e')],function(_0x26c9aa){return{'model':db[_0x26c9aa[_0xb4fe('0x1d')]],'as':_0x26c9aa['as'],'attributes':_0x26c9aa[_0xb4fe('0x1c')],'include':_0x26c9aa[_0xb4fe('0x1e')]?_['map'](_0x26c9aa[_0xb4fe('0x1e')],function(_0x4c7458){return{'model':db[_0x4c7458[_0xb4fe('0x1d')]],'as':_0x4c7458['as'],'attributes':_0x4c7458[_0xb4fe('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb4fe('0x20')](function(_0x5df626){logger[_0xb4fe('0x14')]('ShowSmsAccount',_0x189fa1);logger[_0xb4fe('0xc')](_0xb4fe('0x17'),_0x189fa1,JSON['stringify'](_0x5df626));_0x4f1982(_0x5df626);})[_0xb4fe('0x16')](function(_0x3e1c56){logger[_0xb4fe('0x10')]('ShowSmsAccount',_0x3e1c56[_0xb4fe('0x13')],_0x189fa1);_0x3f1780(_0x2e039d['error'](0x1f4,_0x3e1c56[_0xb4fe('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 72e44eb..c65c0bc 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 _0xef82=['length','smsAccount:','save','remove','emit','register'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xef82,0x98));var _0x2ef8=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xef82[_0x47aa64];return _0x549c7a;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x2ef8('0x0'),_0x2ef8('0x1'),'update'];function createListener(_0x5b6433,_0x5e4d7f){return function(_0x392f4a){_0x5e4d7f[_0x2ef8('0x2')](_0x5b6433,_0x392f4a);};}function removeListener(_0x36eca7,_0x2ad549){return function(){SmsAccountEvents['removeListener'](_0x36eca7,_0x2ad549);};}exports[_0x2ef8('0x3')]=function(_0x3504f7){for(var _0x1d3e23=0x0,_0x3a217d=events[_0x2ef8('0x4')];_0x1d3e23<_0x3a217d;_0x1d3e23++){var _0x4a0026=events[_0x1d3e23];var _0xa6eac8=createListener(_0x2ef8('0x5')+_0x4a0026,_0x3504f7);SmsAccountEvents['on'](_0x4a0026,_0xa6eac8);}}; \ No newline at end of file +var _0x9831=['removeListener','register','./smsAccount.events'];(function(_0x257cc8,_0x35e11f){var _0x4f8f4c=function(_0x4d30c7){while(--_0x4d30c7){_0x257cc8['push'](_0x257cc8['shift']());}};_0x4f8f4c(++_0x35e11f);}(_0x9831,0x13d));var _0x1983=function(_0x4bc4ab,_0x4ac62d){_0x4bc4ab=_0x4bc4ab-0x0;var _0x21fced=_0x9831[_0x4bc4ab];return _0x21fced;};'use strict';var SmsAccountEvents=require(_0x1983('0x0'));var events=['save','remove','update'];function createListener(_0x533236,_0x39cbfb){return function(_0x4c2abd){_0x39cbfb['emit'](_0x533236,_0x4c2abd);};}function removeListener(_0x19b105,_0x4e7f02){return function(){SmsAccountEvents[_0x1983('0x1')](_0x19b105,_0x4e7f02);};}exports[_0x1983('0x2')]=function(_0xed8533){for(var _0x3d4a60=0x0,_0x1f0f9f=events['length'];_0x3d4a60<_0x1f0f9f;_0x3d4a60++){var _0xdbce68=events[_0x3d4a60];var _0x4be953=createListener('smsAccount:'+_0xdbce68,_0xed8533);SmsAccountEvents['on'](_0xdbce68,_0x4be953);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 418bae8..182f31e 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 _0xc895=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x36199a,_0x4f756c){var _0x5b36f1=function(_0x29480d){while(--_0x29480d){_0x36199a['push'](_0x36199a['shift']());}};_0x5b36f1(++_0x4f756c);}(_0xc895,0x74));var _0x5c89=function(_0x53daae,_0x51a400){_0x53daae=_0x53daae-0x0;var _0x12be55=_0xc895[_0x53daae];return _0x12be55;};'use strict';var multer=require('multer');var util=require(_0x5c89('0x0'));var path=require(_0x5c89('0x1'));var timeout=require(_0x5c89('0x2'));var express=require(_0x5c89('0x3'));var router=express[_0x5c89('0x4')]();var auth=require(_0x5c89('0x5'));var interaction=require(_0x5c89('0x6'));var config=require(_0x5c89('0x7'));var controller=require(_0x5c89('0x8'));router[_0x5c89('0x9')]('/',auth[_0x5c89('0xa')](),controller['index']);router[_0x5c89('0x9')](_0x5c89('0xb'),auth['isAuthenticated'](),controller[_0x5c89('0xc')]);router[_0x5c89('0xd')]('/',auth[_0x5c89('0xa')](),controller[_0x5c89('0xe')]);router[_0x5c89('0xf')](_0x5c89('0xb'),auth[_0x5c89('0xa')](),controller[_0x5c89('0x10')]);router[_0x5c89('0x11')](_0x5c89('0xb'),auth[_0x5c89('0xa')](),controller[_0x5c89('0x12')]);module[_0x5c89('0x13')]=router; \ No newline at end of file +var _0x387f=['exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','put','update','delete','destroy'];(function(_0x5142b0,_0x2053b1){var _0x176b54=function(_0x2edfbc){while(--_0x2edfbc){_0x5142b0['push'](_0x5142b0['shift']());}};_0x176b54(++_0x2053b1);}(_0x387f,0x10f));var _0xf387=function(_0x4c8f89,_0x318d19){_0x4c8f89=_0x4c8f89-0x0;var _0x5c5685=_0x387f[_0x4c8f89];return _0x5c5685;};'use strict';var multer=require('multer');var util=require(_0xf387('0x0'));var path=require('path');var timeout=require(_0xf387('0x1'));var express=require(_0xf387('0x2'));var router=express['Router']();var auth=require(_0xf387('0x3'));var interaction=require(_0xf387('0x4'));var config=require('../../config/environment');var controller=require('./smsApplication.controller');router[_0xf387('0x5')]('/',auth[_0xf387('0x6')](),controller[_0xf387('0x7')]);router['get'](_0xf387('0x8'),auth[_0xf387('0x6')](),controller[_0xf387('0x9')]);router['post']('/',auth[_0xf387('0x6')](),controller['create']);router[_0xf387('0xa')](_0xf387('0x8'),auth[_0xf387('0x6')](),controller[_0xf387('0xb')]);router[_0xf387('0xc')](_0xf387('0x8'),auth[_0xf387('0x6')](),controller[_0xf387('0xd')]);module[_0xf387('0xe')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 3e86ec2..6af411b 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 _0x4f40=['sequelize','exports','TEXT','STRING','*,*,*,*'];(function(_0x4dc4bd,_0x490bf0){var _0x22a362=function(_0x1512b1){while(--_0x1512b1){_0x4dc4bd['push'](_0x4dc4bd['shift']());}};_0x22a362(++_0x490bf0);}(_0x4f40,0x1d6));var _0x04f4=function(_0xe306b9,_0x476092){_0xe306b9=_0xe306b9-0x0;var _0x382c55=_0x4f40[_0xe306b9];return _0x382c55;};'use strict';var Sequelize=require(_0x04f4('0x0'));module[_0x04f4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x04f4('0x2')]()},'description':{'type':Sequelize[_0x04f4('0x3')]},'interval':{'type':Sequelize[_0x04f4('0x3')],'defaultValue':_0x04f4('0x4')}}; \ No newline at end of file +var _0x9175=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x39a8a6,_0x153e1b){var _0x25fe51=function(_0x2ee594){while(--_0x2ee594){_0x39a8a6['push'](_0x39a8a6['shift']());}};_0x25fe51(++_0x153e1b);}(_0x9175,0x158));var _0x5917=function(_0xe2d8f5,_0x294c28){_0xe2d8f5=_0xe2d8f5-0x0;var _0x289930=_0x9175[_0xe2d8f5];return _0x289930;};'use strict';var Sequelize=require(_0x5917('0x0'));module[_0x5917('0x1')]={'priority':{'type':Sequelize[_0x5917('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5917('0x3')},'appdata':{'type':Sequelize[_0x5917('0x4')]()},'description':{'type':Sequelize[_0x5917('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5917('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 5cddec7..246600e 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 _0xb77e=['type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsApplication','count','includeAll','rows','show','params','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName'];(function(_0x2ee6fe,_0x37baf0){var _0x4bce15=function(_0x504f92){while(--_0x504f92){_0x2ee6fe['push'](_0x2ee6fe['shift']());}};_0x4bce15(++_0x37baf0);}(_0xb77e,0x1e6));var _0xeb77=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb77e[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0xeb77('0x0'));var emlformat=require(_0xeb77('0x1'));var rimraf=require(_0xeb77('0x2'));var zipdir=require(_0xeb77('0x3'));var jsonpatch=require(_0xeb77('0x4'));var rp=require(_0xeb77('0x5'));var moment=require(_0xeb77('0x6'));var BPromise=require(_0xeb77('0x7'));var Mustache=require(_0xeb77('0x8'));var util=require(_0xeb77('0x9'));var path=require(_0xeb77('0xa'));var sox=require(_0xeb77('0xb'));var csv=require(_0xeb77('0xc'));var ejs=require(_0xeb77('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeb77('0xe'));var crypto=require(_0xeb77('0xf'));var jsforce=require(_0xeb77('0x10'));var deskjs=require(_0xeb77('0x11'));var toCsv=require(_0xeb77('0xc'));var querystring=require(_0xeb77('0x12'));var Papa=require('papaparse');var Redis=require(_0xeb77('0x13'));var authService=require(_0xeb77('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb77('0x15'));var logger=require(_0xeb77('0x16'))(_0xeb77('0x17'));var utils=require(_0xeb77('0x18'));var config=require(_0xeb77('0x19'));var licenseUtil=require(_0xeb77('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9d0a64,_0x473501){_0x473501=_0x473501||0xcc;return function(_0x34d8d7){if(_0x34d8d7){return _0x9d0a64[_0xeb77('0x1b')](_0x473501);}return _0x9d0a64['status'](_0x473501)[_0xeb77('0x1c')]();};}function respondWithResult(_0x2844ea,_0x2f47b5){_0x2f47b5=_0x2f47b5||0xc8;return function(_0x1e50b7){if(_0x1e50b7){return _0x2844ea[_0xeb77('0x1d')](_0x2f47b5)[_0xeb77('0x1e')](_0x1e50b7);}};}function respondWithFilteredResult(_0x29343f,_0x12e535){return function(_0xd3503b){if(_0xd3503b){var _0x4ce2e0=_0xd3503b['count'],_0x3a436b=_0x12e535[_0xeb77('0x1f')],_0x4c0e77=_0x12e535['offset']+_0x12e535['limit'],_0x54c00f;if(_0x4c0e77>=_0x4ce2e0){_0x4c0e77=_0x4ce2e0;_0x54c00f=0xc8;}else{_0x54c00f=0xce;}_0x29343f[_0xeb77('0x1d')](_0x54c00f);return _0x29343f[_0xeb77('0x20')](_0xeb77('0x21'),_0x3a436b+'-'+_0x4c0e77+'/'+_0x4ce2e0)[_0xeb77('0x1e')](_0xd3503b);}return null;};}function patchUpdates(_0x348559){return function(_0x1f7fc8){try{jsonpatch[_0xeb77('0x22')](_0x1f7fc8,_0x348559,!![]);}catch(_0x2df83d){return BPromise['reject'](_0x2df83d);}return _0x1f7fc8[_0xeb77('0x23')]();};}function saveUpdates(_0x56e100,_0x3d8fda){return function(_0x527d2c){if(_0x527d2c){return _0x527d2c[_0xeb77('0x24')](_0x56e100)['then'](function(_0x51ce9c){return _0x51ce9c;});}return null;};}function removeEntity(_0x207af7,_0x2b2d7a){return function(_0x45945c){if(_0x45945c){return _0x45945c[_0xeb77('0x25')]()[_0xeb77('0x26')](function(){_0x207af7[_0xeb77('0x1d')](0xcc)[_0xeb77('0x1c')]();});}};}function handleEntityNotFound(_0x381958,_0x28cdfd){return function(_0xde9abe){if(!_0xde9abe){_0x381958[_0xeb77('0x1b')](0x194);}return _0xde9abe;};}function handleError(_0x1bc3cf,_0x596d41){_0x596d41=_0x596d41||0x1f4;return function(_0x36a80a){logger[_0xeb77('0x27')](_0x36a80a[_0xeb77('0x28')]);if(_0x36a80a['name']){delete _0x36a80a[_0xeb77('0x29')];}_0x1bc3cf[_0xeb77('0x1d')](_0x596d41)[_0xeb77('0x2a')](_0x36a80a);};}exports[_0xeb77('0x2b')]=function(_0x4a4962,_0x37bd20){var _0x3a4fa7={},_0x141a94={},_0x306a95={'count':0x0,'rows':[]};var _0x3f0698=_['map'](db['SmsApplication'][_0xeb77('0x2c')],function(_0x3a4d36){return{'name':_0x3a4d36[_0xeb77('0x2d')],'type':_0x3a4d36[_0xeb77('0x2e')]['key']};});_0x141a94[_0xeb77('0x2f')]=_[_0xeb77('0x30')](_0x3f0698,_0xeb77('0x29'));_0x141a94[_0xeb77('0x31')]=_[_0xeb77('0x32')](_0x4a4962['query']);_0x141a94['filters']=_[_0xeb77('0x33')](_0x141a94[_0xeb77('0x2f')],_0x141a94[_0xeb77('0x31')]);_0x3a4fa7['attributes']=_[_0xeb77('0x33')](_0x141a94[_0xeb77('0x2f')],qs[_0xeb77('0x34')](_0x4a4962[_0xeb77('0x31')][_0xeb77('0x34')]));_0x3a4fa7['attributes']=_0x3a4fa7[_0xeb77('0x35')][_0xeb77('0x36')]?_0x3a4fa7[_0xeb77('0x35')]:_0x141a94[_0xeb77('0x2f')];if(!_0x4a4962[_0xeb77('0x31')][_0xeb77('0x37')]('nolimit')){_0x3a4fa7[_0xeb77('0x38')]=qs[_0xeb77('0x38')](_0x4a4962['query'][_0xeb77('0x38')]);_0x3a4fa7[_0xeb77('0x1f')]=qs['offset'](_0x4a4962[_0xeb77('0x31')][_0xeb77('0x1f')]);}_0x3a4fa7[_0xeb77('0x39')]=qs[_0xeb77('0x3a')](_0x4a4962[_0xeb77('0x31')][_0xeb77('0x3a')]);_0x3a4fa7[_0xeb77('0x3b')]=qs[_0xeb77('0x3c')](_[_0xeb77('0x3d')](_0x4a4962[_0xeb77('0x31')],_0x141a94[_0xeb77('0x3c')]),_0x3f0698);if(_0x4a4962[_0xeb77('0x31')][_0xeb77('0x3e')]){_0x3a4fa7[_0xeb77('0x3b')]=_[_0xeb77('0x3f')](_0x3a4fa7['where'],{'$or':_[_0xeb77('0x30')](_0x3f0698,function(_0x185e9a){if(_0x185e9a['type']!==_0xeb77('0x40')){var _0x2b3032={};_0x2b3032[_0x185e9a[_0xeb77('0x29')]]={'$like':'%'+_0x4a4962[_0xeb77('0x31')][_0xeb77('0x3e')]+'%'};return _0x2b3032;}})});}_0x3a4fa7=_['merge']({},_0x3a4fa7,_0x4a4962[_0xeb77('0x41')]);var _0x1b677b={'where':_0x3a4fa7[_0xeb77('0x3b')]};return db[_0xeb77('0x42')][_0xeb77('0x43')](_0x1b677b)[_0xeb77('0x26')](function(_0x53addf){_0x306a95[_0xeb77('0x43')]=_0x53addf;if(_0x4a4962[_0xeb77('0x31')][_0xeb77('0x44')]){_0x3a4fa7['include']=[{'all':!![]}];}return db[_0xeb77('0x42')]['findAll'](_0x3a4fa7);})[_0xeb77('0x26')](function(_0x59be32){_0x306a95[_0xeb77('0x45')]=_0x59be32;return _0x306a95;})[_0xeb77('0x26')](respondWithFilteredResult(_0x37bd20,_0x3a4fa7))['catch'](handleError(_0x37bd20,null));};exports[_0xeb77('0x46')]=function(_0x2c5f17,_0x1d00fb){var _0x36b14a={'raw':!![],'where':{'id':_0x2c5f17[_0xeb77('0x47')]['id']}},_0x4a37da={};_0x4a37da['model']=_[_0xeb77('0x32')](db[_0xeb77('0x42')][_0xeb77('0x2c')]);_0x4a37da['query']=_[_0xeb77('0x32')](_0x2c5f17['query']);_0x4a37da['filters']=_[_0xeb77('0x33')](_0x4a37da[_0xeb77('0x2f')],_0x4a37da[_0xeb77('0x31')]);_0x36b14a[_0xeb77('0x35')]=_[_0xeb77('0x33')](_0x4a37da[_0xeb77('0x2f')],qs[_0xeb77('0x34')](_0x2c5f17[_0xeb77('0x31')]['fields']));_0x36b14a[_0xeb77('0x35')]=_0x36b14a[_0xeb77('0x35')]['length']?_0x36b14a['attributes']:_0x4a37da[_0xeb77('0x2f')];if(_0x2c5f17['query'][_0xeb77('0x44')]){_0x36b14a['include']=[{'all':!![]}];}_0x36b14a=_['merge']({},_0x36b14a,_0x2c5f17[_0xeb77('0x41')]);return db['SmsApplication']['find'](_0x36b14a)[_0xeb77('0x26')](handleEntityNotFound(_0x1d00fb,null))[_0xeb77('0x26')](respondWithResult(_0x1d00fb,null))[_0xeb77('0x48')](handleError(_0x1d00fb,null));};exports[_0xeb77('0x49')]=function(_0x15bd32,_0x33bb52){return db[_0xeb77('0x42')][_0xeb77('0x49')](_0x15bd32[_0xeb77('0x4a')],{})[_0xeb77('0x26')](respondWithResult(_0x33bb52,0xc9))[_0xeb77('0x48')](handleError(_0x33bb52,null));};exports[_0xeb77('0x24')]=function(_0x414fd5,_0x3835e8){if(_0x414fd5[_0xeb77('0x4a')]['id']){delete _0x414fd5[_0xeb77('0x4a')]['id'];}return db[_0xeb77('0x42')]['find']({'where':{'id':_0x414fd5[_0xeb77('0x47')]['id']}})[_0xeb77('0x26')](handleEntityNotFound(_0x3835e8,null))[_0xeb77('0x26')](saveUpdates(_0x414fd5[_0xeb77('0x4a')],null))[_0xeb77('0x26')](respondWithResult(_0x3835e8,null))[_0xeb77('0x48')](handleError(_0x3835e8,null));};exports[_0xeb77('0x25')]=function(_0x3a5b58,_0x591745){return db['SmsApplication'][_0xeb77('0x4b')]({'where':{'id':_0x3a5b58[_0xeb77('0x47')]['id']}})[_0xeb77('0x26')](handleEntityNotFound(_0x591745,null))[_0xeb77('0x26')](removeEntity(_0x591745,null))[_0xeb77('0x48')](handleError(_0x591745,null));}; \ No newline at end of file +var _0x6701=['query','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key'];(function(_0x1083bc,_0x5a438c){var _0x18d714=function(_0x20369e){while(--_0x20369e){_0x1083bc['push'](_0x1083bc['shift']());}};_0x18d714(++_0x5a438c);}(_0x6701,0x1e4));var _0x1670=function(_0x17141f,_0x4d7c4b){_0x17141f=_0x17141f-0x0;var _0x3ee900=_0x6701[_0x17141f];return _0x3ee900;};'use strict';var pdf=require(_0x1670('0x0'));var emlformat=require(_0x1670('0x1'));var rimraf=require(_0x1670('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1670('0x3'));var rp=require(_0x1670('0x4'));var moment=require('moment');var BPromise=require(_0x1670('0x5'));var Mustache=require(_0x1670('0x6'));var util=require(_0x1670('0x7'));var path=require(_0x1670('0x8'));var sox=require(_0x1670('0x9'));var csv=require(_0x1670('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1670('0xb'));var squel=require(_0x1670('0xc'));var crypto=require(_0x1670('0xd'));var jsforce=require(_0x1670('0xe'));var deskjs=require(_0x1670('0xf'));var toCsv=require(_0x1670('0xa'));var querystring=require(_0x1670('0x10'));var Papa=require(_0x1670('0x11'));var Redis=require(_0x1670('0x12'));var authService=require(_0x1670('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1670('0x14'));var hardwareService=require(_0x1670('0x15'));var logger=require(_0x1670('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1670('0x17'));var licenseUtil=require(_0x1670('0x18'));var db=require(_0x1670('0x19'))['db'];function respondWithStatusCode(_0x13178c,_0x3f53cf){_0x3f53cf=_0x3f53cf||0xcc;return function(_0x888c78){if(_0x888c78){return _0x13178c['sendStatus'](_0x3f53cf);}return _0x13178c[_0x1670('0x1a')](_0x3f53cf)[_0x1670('0x1b')]();};}function respondWithResult(_0x4caeff,_0x25f509){_0x25f509=_0x25f509||0xc8;return function(_0x1ad983){if(_0x1ad983){return _0x4caeff['status'](_0x25f509)[_0x1670('0x1c')](_0x1ad983);}};}function respondWithFilteredResult(_0x13a1a2,_0x23e192){return function(_0x5bad66){if(_0x5bad66){var _0x494b43=_0x5bad66[_0x1670('0x1d')],_0x9ef081=_0x23e192[_0x1670('0x1e')],_0xf18f51=_0x23e192['offset']+_0x23e192['limit'],_0x84956e;if(_0xf18f51>=_0x494b43){_0xf18f51=_0x494b43;_0x84956e=0xc8;}else{_0x84956e=0xce;}_0x13a1a2[_0x1670('0x1a')](_0x84956e);return _0x13a1a2[_0x1670('0x1f')](_0x1670('0x20'),_0x9ef081+'-'+_0xf18f51+'/'+_0x494b43)[_0x1670('0x1c')](_0x5bad66);}return null;};}function patchUpdates(_0x13dde0){return function(_0xa9713){try{jsonpatch[_0x1670('0x21')](_0xa9713,_0x13dde0,!![]);}catch(_0xe9c346){return BPromise[_0x1670('0x22')](_0xe9c346);}return _0xa9713['save']();};}function saveUpdates(_0x57c30c,_0x5eb7ec){return function(_0x5bcfd2){if(_0x5bcfd2){return _0x5bcfd2[_0x1670('0x23')](_0x57c30c)[_0x1670('0x24')](function(_0x48b8dc){return _0x48b8dc;});}return null;};}function removeEntity(_0x5e2c59,_0x538723){return function(_0x7a0fd3){if(_0x7a0fd3){return _0x7a0fd3[_0x1670('0x25')]()[_0x1670('0x24')](function(){_0x5e2c59[_0x1670('0x1a')](0xcc)[_0x1670('0x1b')]();});}};}function handleEntityNotFound(_0x4d8152,_0x17ac56){return function(_0x28d980){if(!_0x28d980){_0x4d8152[_0x1670('0x26')](0x194);}return _0x28d980;};}function handleError(_0x5b43a6,_0xdb95ae){_0xdb95ae=_0xdb95ae||0x1f4;return function(_0x4e2588){logger['error'](_0x4e2588[_0x1670('0x27')]);if(_0x4e2588[_0x1670('0x28')]){delete _0x4e2588[_0x1670('0x28')];}_0x5b43a6[_0x1670('0x1a')](_0xdb95ae)[_0x1670('0x29')](_0x4e2588);};}exports[_0x1670('0x2a')]=function(_0xb37bc7,_0x335f48){var _0x11748d={},_0x5e0887={},_0x47123e={'count':0x0,'rows':[]};var _0x43225d=_[_0x1670('0x2b')](db[_0x1670('0x2c')][_0x1670('0x2d')],function(_0x166dd8){return{'name':_0x166dd8[_0x1670('0x2e')],'type':_0x166dd8['type'][_0x1670('0x2f')]};});_0x5e0887['model']=_['map'](_0x43225d,_0x1670('0x28'));_0x5e0887['query']=_['keys'](_0xb37bc7[_0x1670('0x30')]);_0x5e0887['filters']=_[_0x1670('0x31')](_0x5e0887['model'],_0x5e0887[_0x1670('0x30')]);_0x11748d[_0x1670('0x32')]=_['intersection'](_0x5e0887[_0x1670('0x33')],qs[_0x1670('0x34')](_0xb37bc7[_0x1670('0x30')]['fields']));_0x11748d['attributes']=_0x11748d['attributes']['length']?_0x11748d[_0x1670('0x32')]:_0x5e0887[_0x1670('0x33')];if(!_0xb37bc7[_0x1670('0x30')][_0x1670('0x35')](_0x1670('0x36'))){_0x11748d[_0x1670('0x37')]=qs[_0x1670('0x37')](_0xb37bc7['query'][_0x1670('0x37')]);_0x11748d[_0x1670('0x1e')]=qs[_0x1670('0x1e')](_0xb37bc7[_0x1670('0x30')][_0x1670('0x1e')]);}_0x11748d[_0x1670('0x38')]=qs[_0x1670('0x39')](_0xb37bc7[_0x1670('0x30')][_0x1670('0x39')]);_0x11748d[_0x1670('0x3a')]=qs[_0x1670('0x3b')](_[_0x1670('0x3c')](_0xb37bc7[_0x1670('0x30')],_0x5e0887[_0x1670('0x3b')]),_0x43225d);if(_0xb37bc7[_0x1670('0x30')][_0x1670('0x3d')]){_0x11748d[_0x1670('0x3a')]=_[_0x1670('0x3e')](_0x11748d['where'],{'$or':_['map'](_0x43225d,function(_0x317401){if(_0x317401[_0x1670('0x3f')]!=='VIRTUAL'){var _0xaa8bb={};_0xaa8bb[_0x317401[_0x1670('0x28')]]={'$like':'%'+_0xb37bc7[_0x1670('0x30')][_0x1670('0x3d')]+'%'};return _0xaa8bb;}})});}_0x11748d=_[_0x1670('0x3e')]({},_0x11748d,_0xb37bc7[_0x1670('0x40')]);var _0x413433={'where':_0x11748d['where']};return db[_0x1670('0x2c')][_0x1670('0x1d')](_0x413433)[_0x1670('0x24')](function(_0x1b8962){_0x47123e['count']=_0x1b8962;if(_0xb37bc7[_0x1670('0x30')][_0x1670('0x41')]){_0x11748d[_0x1670('0x42')]=[{'all':!![]}];}return db['SmsApplication'][_0x1670('0x43')](_0x11748d);})[_0x1670('0x24')](function(_0x187dde){_0x47123e[_0x1670('0x44')]=_0x187dde;return _0x47123e;})[_0x1670('0x24')](respondWithFilteredResult(_0x335f48,_0x11748d))[_0x1670('0x45')](handleError(_0x335f48,null));};exports[_0x1670('0x46')]=function(_0x4dd9f7,_0x363ce7){var _0x50faeb={'raw':!![],'where':{'id':_0x4dd9f7[_0x1670('0x47')]['id']}},_0x5d371d={};_0x5d371d[_0x1670('0x33')]=_[_0x1670('0x48')](db[_0x1670('0x2c')][_0x1670('0x2d')]);_0x5d371d['query']=_['keys'](_0x4dd9f7[_0x1670('0x30')]);_0x5d371d[_0x1670('0x3b')]=_['intersection'](_0x5d371d['model'],_0x5d371d[_0x1670('0x30')]);_0x50faeb['attributes']=_[_0x1670('0x31')](_0x5d371d['model'],qs[_0x1670('0x34')](_0x4dd9f7['query'][_0x1670('0x34')]));_0x50faeb[_0x1670('0x32')]=_0x50faeb[_0x1670('0x32')]['length']?_0x50faeb[_0x1670('0x32')]:_0x5d371d['model'];if(_0x4dd9f7[_0x1670('0x30')][_0x1670('0x41')]){_0x50faeb[_0x1670('0x42')]=[{'all':!![]}];}_0x50faeb=_[_0x1670('0x3e')]({},_0x50faeb,_0x4dd9f7[_0x1670('0x40')]);return db[_0x1670('0x2c')]['find'](_0x50faeb)[_0x1670('0x24')](handleEntityNotFound(_0x363ce7,null))['then'](respondWithResult(_0x363ce7,null))[_0x1670('0x45')](handleError(_0x363ce7,null));};exports[_0x1670('0x49')]=function(_0xf90257,_0x47b461){return db['SmsApplication'][_0x1670('0x49')](_0xf90257[_0x1670('0x4a')],{})[_0x1670('0x24')](respondWithResult(_0x47b461,0xc9))[_0x1670('0x45')](handleError(_0x47b461,null));};exports['update']=function(_0x398434,_0x29b672){if(_0x398434[_0x1670('0x4a')]['id']){delete _0x398434['body']['id'];}return db[_0x1670('0x2c')][_0x1670('0x4b')]({'where':{'id':_0x398434[_0x1670('0x47')]['id']}})[_0x1670('0x24')](handleEntityNotFound(_0x29b672,null))[_0x1670('0x24')](saveUpdates(_0x398434[_0x1670('0x4a')],null))[_0x1670('0x24')](respondWithResult(_0x29b672,null))[_0x1670('0x45')](handleError(_0x29b672,null));};exports[_0x1670('0x25')]=function(_0x108b62,_0x2b1413){return db[_0x1670('0x2c')][_0x1670('0x4b')]({'where':{'id':_0x108b62['params']['id']}})['then'](handleEntityNotFound(_0x2b1413,null))[_0x1670('0x24')](removeEntity(_0x2b1413,null))[_0x1670('0x45')](handleError(_0x2b1413,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 36bb0fa..19dba3c 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 _0x7531=['../../config/logger','api','moment','rimraf','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x43eaa0,_0x4de588){var _0x32fde6=function(_0x16c7b1){while(--_0x16c7b1){_0x43eaa0['push'](_0x43eaa0['shift']());}};_0x32fde6(++_0x4de588);}(_0x7531,0xe4));var _0x1753=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7531[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x1753('0x0'));var util=require(_0x1753('0x1'));var logger=require(_0x1753('0x2'))(_0x1753('0x3'));var moment=require(_0x1753('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1753('0x5'));var config=require('../../config/environment');var attributes=require(_0x1753('0x6'));module['exports']=function(_0x5788c9,_0x5f511a){return _0x5788c9['define'](_0x1753('0x7'),attributes,{'tableName':_0x1753('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1753('0x9')});}; \ No newline at end of file +var _0xbc70=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4_unicode_ci','lodash'];(function(_0x163d7e,_0x486a8b){var _0x54e389=function(_0xed9b2){while(--_0xed9b2){_0x163d7e['push'](_0x163d7e['shift']());}};_0x54e389(++_0x486a8b);}(_0xbc70,0x144));var _0x0bc7=function(_0x1a0e2e,_0x3166b8){_0x1a0e2e=_0x1a0e2e-0x0;var _0x48539b=_0xbc70[_0x1a0e2e];return _0x48539b;};'use strict';var _=require(_0x0bc7('0x0'));var util=require(_0x0bc7('0x1'));var logger=require(_0x0bc7('0x2'))('api');var moment=require(_0x0bc7('0x3'));var BPromise=require('bluebird');var rp=require(_0x0bc7('0x4'));var fs=require('fs');var path=require(_0x0bc7('0x5'));var rimraf=require(_0x0bc7('0x6'));var config=require(_0x0bc7('0x7'));var attributes=require(_0x0bc7('0x8'));module[_0x0bc7('0x9')]=function(_0x3584f8,_0x2c92a6){return _0x3584f8[_0x0bc7('0xa')]('SmsApplication',attributes,{'tableName':_0x0bc7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0bc7('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 13cd482..25efd9e 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 _0x7dfd=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x58464f,_0x4918f7){var _0x1d56e=function(_0x21ebd3){while(--_0x21ebd3){_0x58464f['push'](_0x58464f['shift']());}};_0x1d56e(++_0x4918f7);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var BPromise=require(_0xd7df('0x3'));var rs=require(_0xd7df('0x4'));var fs=require('fs');var Redis=require(_0xd7df('0x5'));var db=require(_0xd7df('0x6'))['db'];var utils=require(_0xd7df('0x7'));var logger=require(_0xd7df('0x8'))(_0xd7df('0x9'));var config=require(_0xd7df('0xa'));var jayson=require(_0xd7df('0xb'));var client=jayson[_0xd7df('0xc')][_0xd7df('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x354ea7,_0x16e50,_0x2c48a4){return new BPromise(function(_0x5c220a,_0xab6742){return client[_0xd7df('0xe')](_0x354ea7,_0x2c48a4)[_0xd7df('0xf')](function(_0x3dee59){logger['info'](_0xd7df('0x10'),_0x16e50,'request\x20sent');logger[_0xd7df('0x11')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x16e50,_0xd7df('0x12'),JSON[_0xd7df('0x13')](_0x3dee59));if(_0x3dee59[_0xd7df('0x14')]){if(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x15')]===0x1f4){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0xab6742(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0x5c220a(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}else{logger['info'](_0xd7df('0x10'),_0x16e50,_0xd7df('0x12'));_0x5c220a(_0x3dee59['result'][_0xd7df('0x16')]);}})[_0xd7df('0x17')](function(_0x5d3beb){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x5d3beb);_0xab6742(_0x5d3beb);});});} \ No newline at end of file +var _0xf842=['info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0xf842,0x172));var _0x2f84=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0xf842[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0x2f84('0x0'));var util=require(_0x2f84('0x1'));var moment=require(_0x2f84('0x2'));var BPromise=require(_0x2f84('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f84('0x4'));var db=require(_0x2f84('0x5'))['db'];var utils=require(_0x2f84('0x6'));var logger=require(_0x2f84('0x7'))(_0x2f84('0x8'));var config=require('../../config/environment');var jayson=require(_0x2f84('0x9'));var client=jayson[_0x2f84('0xa')][_0x2f84('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55bc67,_0x29019a,_0x29a2db){return new BPromise(function(_0x3458a1,_0x319d1f){return client[_0x2f84('0xc')](_0x55bc67,_0x29a2db)[_0x2f84('0xd')](function(_0x3a3870){logger[_0x2f84('0xe')](_0x2f84('0xf'),_0x29019a,_0x2f84('0x10'));logger['debug'](_0x2f84('0x11'),_0x29019a,'request\x20sent',JSON[_0x2f84('0x12')](_0x3a3870));if(_0x3a3870[_0x2f84('0x13')]){if(_0x3a3870[_0x2f84('0x13')][_0x2f84('0x14')]===0x1f4){logger[_0x2f84('0x13')](_0x2f84('0xf'),_0x29019a,_0x3a3870[_0x2f84('0x13')][_0x2f84('0x15')]);return _0x319d1f(_0x3a3870[_0x2f84('0x13')][_0x2f84('0x15')]);}logger[_0x2f84('0x13')](_0x2f84('0xf'),_0x29019a,_0x3a3870['error']['message']);return _0x3458a1(_0x3a3870['error'][_0x2f84('0x15')]);}else{logger[_0x2f84('0xe')](_0x2f84('0xf'),_0x29019a,'request\x20sent');_0x3458a1(_0x3a3870[_0x2f84('0x16')][_0x2f84('0x15')]);}})[_0x2f84('0x17')](function(_0x54e1f2){logger[_0x2f84('0x13')](_0x2f84('0xf'),_0x29019a,_0x54e1f2);_0x319d1f(_0x54e1f2);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index a3feb44..1c4ecf0 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 _0x04aa=['smsinteraction:update','update','delete','smsinteraction:destroy','removeTags','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x04aa,0xb3));var _0xa04a=function(_0x45db20,_0x3cf0ca){_0x45db20=_0x45db20-0x0;var _0x43e3c0=_0x04aa[_0x45db20];return _0x43e3c0;};'use strict';var multer=require('multer');var util=require(_0xa04a('0x0'));var path=require(_0xa04a('0x1'));var timeout=require(_0xa04a('0x2'));var express=require('express');var router=express[_0xa04a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa04a('0x4'));var config=require(_0xa04a('0x5'));var controller=require(_0xa04a('0x6'));router[_0xa04a('0x7')]('/',auth[_0xa04a('0x8')](),controller['index']);router['get'](_0xa04a('0x9'),auth[_0xa04a('0x8')](),controller['describe']);router[_0xa04a('0x7')](_0xa04a('0xa'),auth[_0xa04a('0x8')](),controller[_0xa04a('0xb')]);router[_0xa04a('0x7')](_0xa04a('0xc'),auth['isAuthenticated'](),controller['getMessages']);router[_0xa04a('0x7')](_0xa04a('0xd'),auth[_0xa04a('0x8')](),controller[_0xa04a('0xe')]);router[_0xa04a('0xf')]('/',auth[_0xa04a('0x8')](),controller[_0xa04a('0x10')]);router[_0xa04a('0xf')]('/:id/messages',auth[_0xa04a('0x8')](),controller[_0xa04a('0x11')]);router['post'](_0xa04a('0x12'),auth['isAuthenticated'](),interaction[_0xa04a('0x13')](_0xa04a('0x14'),_0xa04a('0x15')),controller[_0xa04a('0x16')]);router[_0xa04a('0x17')](_0xa04a('0xa'),auth[_0xa04a('0x8')](),interaction[_0xa04a('0x13')](_0xa04a('0x14'),_0xa04a('0x18')),controller[_0xa04a('0x19')]);router[_0xa04a('0x1a')](_0xa04a('0xa'),auth['isAuthenticated'](),interaction[_0xa04a('0x13')]('sms',_0xa04a('0x1b')),controller['destroy']);router[_0xa04a('0x1a')]('/:id/tags',auth[_0xa04a('0x8')](),controller[_0xa04a('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x67f9=['smsinteraction:update','update','smsinteraction:destroy','destroy','delete','removeTags','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','create','post','/:id/tags','smsinteraction:addtags','addTags','put','tracked','sms'];(function(_0x193e71,_0xcef32f){var _0xf555a2=function(_0x41a0d2){while(--_0x41a0d2){_0x193e71['push'](_0x193e71['shift']());}};_0xf555a2(++_0xcef32f);}(_0x67f9,0x126));var _0x967f=function(_0x37c0af,_0x434bfe){_0x37c0af=_0x37c0af-0x0;var _0x2bea9e=_0x67f9[_0x37c0af];return _0x2bea9e;};'use strict';var multer=require('multer');var util=require(_0x967f('0x0'));var path=require(_0x967f('0x1'));var timeout=require(_0x967f('0x2'));var express=require(_0x967f('0x3'));var router=express[_0x967f('0x4')]();var auth=require(_0x967f('0x5'));var interaction=require(_0x967f('0x6'));var config=require(_0x967f('0x7'));var controller=require(_0x967f('0x8'));router[_0x967f('0x9')]('/',auth[_0x967f('0xa')](),controller[_0x967f('0xb')]);router[_0x967f('0x9')](_0x967f('0xc'),auth[_0x967f('0xa')](),controller[_0x967f('0xd')]);router[_0x967f('0x9')](_0x967f('0xe'),auth[_0x967f('0xa')](),controller[_0x967f('0xf')]);router[_0x967f('0x9')](_0x967f('0x10'),auth[_0x967f('0xa')](),controller['getMessages']);router[_0x967f('0x9')](_0x967f('0x11'),auth[_0x967f('0xa')](),controller['download']);router['post']('/',auth[_0x967f('0xa')](),controller[_0x967f('0x12')]);router[_0x967f('0x13')](_0x967f('0x10'),auth[_0x967f('0xa')](),controller['addMessage']);router[_0x967f('0x13')](_0x967f('0x14'),auth['isAuthenticated'](),interaction['tracked']('sms',_0x967f('0x15')),controller[_0x967f('0x16')]);router[_0x967f('0x17')](_0x967f('0xe'),auth[_0x967f('0xa')](),interaction[_0x967f('0x18')](_0x967f('0x19'),_0x967f('0x1a')),controller[_0x967f('0x1b')]);router['delete'](_0x967f('0xe'),auth['isAuthenticated'](),interaction[_0x967f('0x18')](_0x967f('0x19'),_0x967f('0x1c')),controller[_0x967f('0x1d')]);router[_0x967f('0x1e')]('/:id/tags',auth[_0x967f('0xa')](),controller[_0x967f('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 1da3b7d..6525308 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 _0xd7a4=['ENUM','out','sequelize','moment','DATE','STRING'];(function(_0x2245ce,_0x372263){var _0x1cf09f=function(_0xf595ad){while(--_0xf595ad){_0x2245ce['push'](_0x2245ce['shift']());}};_0x1cf09f(++_0x372263);}(_0xd7a4,0x17c));var _0x4d7a=function(_0x3fd515,_0x1eb68f){_0x3fd515=_0x3fd515-0x0;var _0x441a28=_0xd7a4[_0x3fd515];return _0x441a28;};'use strict';var Sequelize=require(_0x4d7a('0x0'));var moment=require(_0x4d7a('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4d7a('0x2')]},'disposition':{'type':Sequelize[_0x4d7a('0x3')]},'secondDisposition':{'type':Sequelize[_0x4d7a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4d7a('0x3')]},'note':{'type':Sequelize[_0x4d7a('0x3')]},'phone':{'type':Sequelize[_0x4d7a('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4d7a('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4d7a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4d7a('0x4')]('in',_0x4d7a('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xa39e=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x3e7f7b,_0x314c9c){var _0x37ec3c=function(_0x2ca6b7){while(--_0x2ca6b7){_0x3e7f7b['push'](_0x3e7f7b['shift']());}};_0x37ec3c(++_0x314c9c);}(_0xa39e,0x134));var _0xea39=function(_0x33532f,_0x16d0ec){_0x33532f=_0x33532f-0x0;var _0x2b93aa=_0xa39e[_0x33532f];return _0x2b93aa;};'use strict';var Sequelize=require(_0xea39('0x0'));var moment=require('moment');module[_0xea39('0x1')]={'closed':{'type':Sequelize[_0xea39('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xea39('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xea39('0x4')]},'thirdDisposition':{'type':Sequelize[_0xea39('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xea39('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xea39('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xea39('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 a09f955..6656753 100644 --- a/server/api/smsInteraction/smsInteraction.controller.js +++ b/server/api/smsInteraction/smsInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 f67c82d..7136269 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 _0x032e=['catch','hasOwnProperty','hook','exports','events','SmsInteraction','../../mysqldb','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x032e,0x124));var _0xe032=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x032e[_0x2b5eae];return _0x5f3ac9;};'use strict';var EventEmitter=require(_0xe032('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xe032('0x1')];var SmsMessage=require(_0xe032('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe032('0x3'),'afterUpdate':_0xe032('0x4'),'afterDestroy':_0xe032('0x5')};function emitEvent(_0x1983cc){return function(_0x306f3d,_0x420020,_0x2ba8a0){_0x306f3d[_0xe032('0x6')]({'attributes':['id'],'raw':!![]})[_0xe032('0x7')](function(_0x1576c8){_0x306f3d[_0xe032('0x8')](_0xe032('0x9'),_0x1576c8[_0xe032('0xa')](function(_0x3b0ef8){return{'id':_0x3b0ef8['id']};}));return SmsMessage[_0xe032('0xb')]({'where':{'SmsInteractionId':_0x306f3d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe032('0x7')](function(_0x2dc9e5){_0x306f3d[_0xe032('0x8')]('unreadMessages',_0x2dc9e5[_0xe032('0xc')]);SmsInteractionEvents[_0xe032('0xd')](_0x1983cc+':'+_0x306f3d['id'],_0x306f3d);SmsInteractionEvents[_0xe032('0xd')](_0x1983cc,_0x306f3d);_0x2ba8a0(null);})[_0xe032('0xe')](_0x2ba8a0(null));};}for(var e in events){if(events[_0xe032('0xf')](e)){var event=events[e];SmsInteraction[_0xe032('0x10')](e,emitEvent(event));}}module[_0xe032('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0xb647=['save','update','getUsers','then','setDataValue','Users','map','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners'];(function(_0x5da8fa,_0x4d9433){var _0x589e36=function(_0x284517){while(--_0x284517){_0x5da8fa['push'](_0x5da8fa['shift']());}};_0x589e36(++_0x4d9433);}(_0xb647,0xdb));var _0x7b64=function(_0x1d1f0b,_0x2e836f){_0x1d1f0b=_0x1d1f0b-0x0;var _0x1d8500=_0xb647[_0x1d1f0b];return _0x1d8500;};'use strict';var EventEmitter=require(_0x7b64('0x0'));var SmsInteraction=require(_0x7b64('0x1'))['db'][_0x7b64('0x2')];var SmsMessage=require(_0x7b64('0x1'))['db'][_0x7b64('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7b64('0x4')](0x0);var events={'afterCreate':_0x7b64('0x5'),'afterUpdate':_0x7b64('0x6'),'afterDestroy':'remove'};function emitEvent(_0x36ff12){return function(_0x4aaa21,_0x1daa28,_0x38ebf7){_0x4aaa21[_0x7b64('0x7')]({'attributes':['id'],'raw':!![]})[_0x7b64('0x8')](function(_0xcdec41){_0x4aaa21[_0x7b64('0x9')](_0x7b64('0xa'),_0xcdec41[_0x7b64('0xb')](function(_0x432ced){return{'id':_0x432ced['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x4aaa21['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7b64('0x8')](function(_0x49718f){_0x4aaa21[_0x7b64('0x9')]('unreadMessages',_0x49718f['length']);SmsInteractionEvents[_0x7b64('0xc')](_0x36ff12+':'+_0x4aaa21['id'],_0x4aaa21);SmsInteractionEvents[_0x7b64('0xc')](_0x36ff12,_0x4aaa21);_0x38ebf7(null);})['catch'](_0x38ebf7(null));};}for(var e in events){if(events[_0x7b64('0xd')](e)){var event=events[e];SmsInteraction[_0x7b64('0xe')](e,emitEvent(event));}}module[_0x7b64('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 45622f6..81da02a 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 _0xd1ac=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format'];(function(_0x22fd6a,_0x50be64){var _0x31a7fe=function(_0x3dae06){while(--_0x3dae06){_0x22fd6a['push'](_0x22fd6a['shift']());}};_0x31a7fe(++_0x50be64);}(_0xd1ac,0x18d));var _0xcd1a=function(_0x2f8b3d,_0x408d44){_0x2f8b3d=_0x2f8b3d-0x0;var _0xfe9e29=_0xd1ac[_0x2f8b3d];return _0xfe9e29;};'use strict';var _=require(_0xcd1a('0x0'));var util=require(_0xcd1a('0x1'));var logger=require('../../config/logger')(_0xcd1a('0x2'));var moment=require(_0xcd1a('0x3'));var BPromise=require(_0xcd1a('0x4'));var rp=require(_0xcd1a('0x5'));var fs=require('fs');var path=require(_0xcd1a('0x6'));var rimraf=require(_0xcd1a('0x7'));var config=require(_0xcd1a('0x8'));var attributes=require(_0xcd1a('0x9'));module[_0xcd1a('0xa')]=function(_0x1a3d79,_0x1a0298){return _0x1a3d79['define'](_0xcd1a('0xb'),attributes,{'tableName':_0xcd1a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x290cbb,_0x3e9c57,_0x2f4849){if(_0x290cbb[_0xcd1a('0xd')](_0xcd1a('0xe'))){_0x290cbb[_0xcd1a('0xf')]=moment()[_0xcd1a('0x10')](_0xcd1a('0x11'));}_0x2f4849(null,_0x290cbb);}}});}; \ No newline at end of file +var _0x1e06=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','changed','closedAt'];(function(_0x76ce24,_0x47bec7){var _0x5b9878=function(_0x56609d){while(--_0x56609d){_0x76ce24['push'](_0x76ce24['shift']());}};_0x5b9878(++_0x47bec7);}(_0x1e06,0x188));var _0x61e0=function(_0x5a4984,_0x45e831){_0x5a4984=_0x5a4984-0x0;var _0x36efae=_0x1e06[_0x5a4984];return _0x36efae;};'use strict';var _=require(_0x61e0('0x0'));var util=require(_0x61e0('0x1'));var logger=require(_0x61e0('0x2'))('api');var moment=require(_0x61e0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x61e0('0x4'));var rimraf=require(_0x61e0('0x5'));var config=require(_0x61e0('0x6'));var attributes=require(_0x61e0('0x7'));module[_0x61e0('0x8')]=function(_0x6c592d,_0x22c4e6){return _0x6c592d['define']('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2193a5,_0x138d23,_0x3d46c8){if(_0x2193a5[_0x61e0('0x9')]('closed')){_0x2193a5[_0x61e0('0xa')]=moment()[_0x61e0('0xb')](_0x61e0('0xc'));}_0x3d46c8(null,_0x2193a5);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index c0016fc..730da36 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 _0x284c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateSmsInteraction','SmsInteraction','update','options','raw','attributes','limit','then','catch','AddTagsToSmsInteraction','where','body','omit','ids','spread','AddTags','lodash'];(function(_0x3185b0,_0x52d2a5){var _0x52a45b=function(_0x5ad24a){while(--_0x5ad24a){_0x3185b0['push'](_0x3185b0['shift']());}};_0x52a45b(++_0x52d2a5);}(_0x284c,0x182));var _0xc284=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x284c[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xc284('0x0'));var util=require(_0xc284('0x1'));var moment=require(_0xc284('0x2'));var BPromise=require(_0xc284('0x3'));var rs=require(_0xc284('0x4'));var fs=require('fs');var Redis=require(_0xc284('0x5'));var db=require(_0xc284('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc284('0x7'));var config=require(_0xc284('0x8'));var jayson=require(_0xc284('0x9'));var client=jayson[_0xc284('0xa')][_0xc284('0xb')]({'port':0x232a});config['redis']=_[_0xc284('0xc')](config['redis'],{'host':_0xc284('0xd'),'port':0x18eb});var socket=require(_0xc284('0xe'))(new Redis(config[_0xc284('0xf')]));require(_0xc284('0x10'))['register'](socket);function respondWithRpcPromise(_0x13bb62,_0xe1a5fb,_0x3fe639){return new BPromise(function(_0x212b34,_0x115035){return client[_0xc284('0x11')](_0x13bb62,_0x3fe639)['then'](function(_0x2dacb0){logger[_0xc284('0x12')](_0xc284('0x13'),_0xe1a5fb,_0xc284('0x14'));logger[_0xc284('0x15')](_0xc284('0x16'),_0xe1a5fb,'request\x20sent',JSON[_0xc284('0x17')](_0x2dacb0));if(_0x2dacb0['error']){if(_0x2dacb0[_0xc284('0x18')][_0xc284('0x19')]===0x1f4){logger['error'](_0xc284('0x13'),_0xe1a5fb,_0x2dacb0[_0xc284('0x18')][_0xc284('0x1a')]);return _0x115035(_0x2dacb0['error'][_0xc284('0x1a')]);}logger[_0xc284('0x18')]('SmsInteraction,\x20%s,\x20%s',_0xe1a5fb,_0x2dacb0['error'][_0xc284('0x1a')]);return _0x212b34(_0x2dacb0[_0xc284('0x18')][_0xc284('0x1a')]);}else{logger[_0xc284('0x12')](_0xc284('0x13'),_0xe1a5fb,_0xc284('0x14'));_0x212b34(_0x2dacb0['result'][_0xc284('0x1a')]);}})['catch'](function(_0x11fc5e){logger[_0xc284('0x18')](_0xc284('0x13'),_0xe1a5fb,_0x11fc5e);_0x115035(_0x11fc5e);});});}exports[_0xc284('0x1b')]=function(_0x163369){var _0x492e24=this;return new Promise(function(_0x509c04,_0x16bf06){return db[_0xc284('0x1c')][_0xc284('0x1d')](_0x163369['body'],{'raw':_0x163369[_0xc284('0x1e')]?_0x163369[_0xc284('0x1e')][_0xc284('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163369['options']?_0x163369[_0xc284('0x1e')]['where']||null:null,'attributes':_0x163369['options']?_0x163369[_0xc284('0x1e')][_0xc284('0x20')]||null:null,'limit':_0x163369[_0xc284('0x1e')]?_0x163369[_0xc284('0x1e')][_0xc284('0x21')]||null:null})[_0xc284('0x22')](function(_0x1df70e){logger['info'](_0xc284('0x1b'),_0x163369);logger[_0xc284('0x15')](_0xc284('0x1b'),_0x163369,JSON[_0xc284('0x17')](_0x1df70e));_0x509c04(_0x1df70e);})[_0xc284('0x23')](function(_0x3d8d93){logger[_0xc284('0x18')](_0xc284('0x1b'),_0x3d8d93['message'],_0x163369);_0x16bf06(_0x492e24[_0xc284('0x18')](0x1f4,_0x3d8d93[_0xc284('0x1a')]));});});};exports[_0xc284('0x24')]=function(_0x426a3e){return new Promise(function(_0x3547ff,_0xa452d5){return db[_0xc284('0x1c')]['find']({'where':_0x426a3e[_0xc284('0x1e')]?_0x426a3e[_0xc284('0x1e')][_0xc284('0x25')]||null:null})['then'](function(_0x39303f){if(_0x39303f){return _0x39303f['addTags'](_0x426a3e[_0xc284('0x26')]['ids'],_[_0xc284('0x27')](_0x426a3e['body'],[_0xc284('0x28'),'id'])||{});}})[_0xc284('0x29')](function(_0x548ab8){logger['info'](_0xc284('0x2a'),_0x426a3e);logger[_0xc284('0x15')](_0xc284('0x2a'),_0x426a3e,JSON['stringify'](_0x548ab8));_0x3547ff(_0x548ab8);})[_0xc284('0x23')](function(_0x2bf08a){logger[_0xc284('0x18')]('AddTags',_0x2bf08a['message'],_0x426a3e);_0xa452d5(_this[_0xc284('0x18')](0x1f4,_0x2bf08a[_0xc284('0x1a')]));});});}; \ No newline at end of file +var _0x37b8=['socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','stringify','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x4f4e4b,_0x46ea73){var _0x23a628=function(_0x56791){while(--_0x56791){_0x4f4e4b['push'](_0x4f4e4b['shift']());}};_0x23a628(++_0x46ea73);}(_0x37b8,0x186));var _0x837b=function(_0xe22ceb,_0x27dc83){_0xe22ceb=_0xe22ceb-0x0;var _0x45bb58=_0x37b8[_0xe22ceb];return _0x45bb58;};'use strict';var _=require(_0x837b('0x0'));var util=require(_0x837b('0x1'));var moment=require(_0x837b('0x2'));var BPromise=require(_0x837b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x837b('0x4'));var db=require(_0x837b('0x5'))['db'];var utils=require(_0x837b('0x6'));var logger=require(_0x837b('0x7'))(_0x837b('0x8'));var config=require(_0x837b('0x9'));var jayson=require(_0x837b('0xa'));var client=jayson[_0x837b('0xb')][_0x837b('0xc')]({'port':0x232a});config['redis']=_[_0x837b('0xd')](config[_0x837b('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x837b('0xf'))(new Redis(config[_0x837b('0xe')]));require(_0x837b('0x10'))[_0x837b('0x11')](socket);function respondWithRpcPromise(_0xe3b069,_0x82ef45,_0x49e2fe){return new BPromise(function(_0x3b1c9b,_0x27aa96){return client[_0x837b('0x12')](_0xe3b069,_0x49e2fe)[_0x837b('0x13')](function(_0x11de36){logger[_0x837b('0x14')](_0x837b('0x15'),_0x82ef45,'request\x20sent');logger[_0x837b('0x16')](_0x837b('0x17'),_0x82ef45,'request\x20sent',JSON['stringify'](_0x11de36));if(_0x11de36[_0x837b('0x18')]){if(_0x11de36[_0x837b('0x18')][_0x837b('0x19')]===0x1f4){logger['error'](_0x837b('0x15'),_0x82ef45,_0x11de36['error'][_0x837b('0x1a')]);return _0x27aa96(_0x11de36[_0x837b('0x18')][_0x837b('0x1a')]);}logger['error'](_0x837b('0x15'),_0x82ef45,_0x11de36['error'][_0x837b('0x1a')]);return _0x3b1c9b(_0x11de36['error'][_0x837b('0x1a')]);}else{logger[_0x837b('0x14')](_0x837b('0x15'),_0x82ef45,_0x837b('0x1b'));_0x3b1c9b(_0x11de36[_0x837b('0x1c')]['message']);}})['catch'](function(_0x19d632){logger[_0x837b('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x82ef45,_0x19d632);_0x27aa96(_0x19d632);});});}exports[_0x837b('0x1d')]=function(_0x88aace){var _0x10e29f=this;return new Promise(function(_0x53454e,_0x4ea7f5){return db[_0x837b('0x1e')]['update'](_0x88aace[_0x837b('0x1f')],{'raw':_0x88aace[_0x837b('0x20')]?_0x88aace[_0x837b('0x20')][_0x837b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x88aace[_0x837b('0x20')]?_0x88aace[_0x837b('0x20')][_0x837b('0x22')]||null:null,'attributes':_0x88aace[_0x837b('0x20')]?_0x88aace[_0x837b('0x20')][_0x837b('0x23')]||null:null,'limit':_0x88aace[_0x837b('0x20')]?_0x88aace[_0x837b('0x20')][_0x837b('0x24')]||null:null})['then'](function(_0xafa035){logger[_0x837b('0x14')](_0x837b('0x1d'),_0x88aace);logger[_0x837b('0x16')](_0x837b('0x1d'),_0x88aace,JSON[_0x837b('0x25')](_0xafa035));_0x53454e(_0xafa035);})['catch'](function(_0x5b8ad1){logger[_0x837b('0x18')](_0x837b('0x1d'),_0x5b8ad1[_0x837b('0x1a')],_0x88aace);_0x4ea7f5(_0x10e29f[_0x837b('0x18')](0x1f4,_0x5b8ad1['message']));});});};exports[_0x837b('0x26')]=function(_0x4d9e2a){return new Promise(function(_0x4241e1,_0x25247e){return db[_0x837b('0x1e')]['find']({'where':_0x4d9e2a[_0x837b('0x20')]?_0x4d9e2a[_0x837b('0x20')][_0x837b('0x22')]||null:null})[_0x837b('0x13')](function(_0x516d39){if(_0x516d39){return _0x516d39[_0x837b('0x27')](_0x4d9e2a[_0x837b('0x1f')][_0x837b('0x28')],_[_0x837b('0x29')](_0x4d9e2a[_0x837b('0x1f')],[_0x837b('0x28'),'id'])||{});}})[_0x837b('0x2a')](function(_0xb9ec74){logger['info'](_0x837b('0x2b'),_0x4d9e2a);logger[_0x837b('0x16')](_0x837b('0x2b'),_0x4d9e2a,JSON[_0x837b('0x25')](_0xb9ec74));_0x4241e1(_0xb9ec74);})[_0x837b('0x2c')](function(_0x1d203d){logger[_0x837b('0x18')](_0x837b('0x2b'),_0x1d203d[_0x837b('0x1a')],_0x4d9e2a);_0x25247e(_this[_0x837b('0x18')](0x1f4,_0x1d203d[_0x837b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f5ea70e..9b2c95d 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x22d944,_0x4a9133){var _0xf640af=function(_0x36c0af){while(--_0x36c0af){_0x22d944['push'](_0x22d944['shift']());}};_0xf640af(++_0x4a9133);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x558615,_0x1eb496){var _0x1e032a=function(_0x538f1d){while(--_0x538f1d){_0x558615['push'](_0x558615['shift']());}};_0x1e032a(++_0x1eb496);}(_0xb10b,0x12a));var _0xbb10=function(_0x582269,_0x529ef3){_0x582269=_0x582269-0x0;var _0x506c1f=_0xb10b[_0x582269];return _0x506c1f;};'use strict';var SmsInteractionEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){SmsInteractionEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);SmsInteractionEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 4007604..2a6b563 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 _0x8824=['accept','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','describe','/:id','isAuthenticated','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept'];(function(_0x5314e5,_0x3c92c6){var _0x41c2e4=function(_0x910012){while(--_0x910012){_0x5314e5['push'](_0x5314e5['shift']());}};_0x41c2e4(++_0x3c92c6);}(_0x8824,0x6c));var _0x4882=function(_0xa662a3,_0x338633){_0xa662a3=_0xa662a3-0x0;var _0x25e427=_0x8824[_0xa662a3];return _0x25e427;};'use strict';var multer=require(_0x4882('0x0'));var util=require(_0x4882('0x1'));var path=require(_0x4882('0x2'));var timeout=require(_0x4882('0x3'));var express=require(_0x4882('0x4'));var router=express[_0x4882('0x5')]();var auth=require(_0x4882('0x6'));var interaction=require(_0x4882('0x7'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x4882('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4882('0x9')]);router['get'](_0x4882('0xa'),auth[_0x4882('0xb')](),controller['show']);router[_0x4882('0xc')]('/',auth[_0x4882('0xb')](),interaction[_0x4882('0xd')](_0x4882('0xe'),_0x4882('0xf')),controller[_0x4882('0x10')]);router[_0x4882('0xc')](_0x4882('0x11'),controller[_0x4882('0x12')]);router[_0x4882('0x13')](_0x4882('0xa'),auth[_0x4882('0xb')](),controller[_0x4882('0x14')]);router[_0x4882('0x13')](_0x4882('0x15'),auth[_0x4882('0xb')](),controller[_0x4882('0x16')]);router[_0x4882('0x13')]('/:id/reject',auth[_0x4882('0xb')](),controller[_0x4882('0x17')]);router['delete'](_0x4882('0xa'),auth[_0x4882('0xb')](),controller[_0x4882('0x18')]);module[_0x4882('0x19')]=router; \ No newline at end of file +var _0xbe72=['reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject'];(function(_0x2cd306,_0x5ddd4f){var _0x523367=function(_0x2526b1){while(--_0x2526b1){_0x2cd306['push'](_0x2cd306['shift']());}};_0x523367(++_0x5ddd4f);}(_0xbe72,0xc8));var _0x2be7=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xbe72[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x2be7('0x0'));var util=require('util');var path=require(_0x2be7('0x1'));var timeout=require(_0x2be7('0x2'));var express=require(_0x2be7('0x3'));var router=express[_0x2be7('0x4')]();var auth=require(_0x2be7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2be7('0x6'));var controller=require(_0x2be7('0x7'));router[_0x2be7('0x8')]('/',auth[_0x2be7('0x9')](),controller[_0x2be7('0xa')]);router[_0x2be7('0x8')](_0x2be7('0xb'),auth[_0x2be7('0x9')](),controller[_0x2be7('0xc')]);router[_0x2be7('0x8')](_0x2be7('0xd'),auth[_0x2be7('0x9')](),controller['show']);router[_0x2be7('0xe')]('/',auth[_0x2be7('0x9')](),interaction['tracked']('sms',_0x2be7('0xf')),controller[_0x2be7('0x10')]);router[_0x2be7('0xe')](_0x2be7('0x11'),controller[_0x2be7('0x12')]);router[_0x2be7('0x13')]('/:id',auth[_0x2be7('0x9')](),controller[_0x2be7('0x14')]);router['put'](_0x2be7('0x15'),auth[_0x2be7('0x9')](),controller[_0x2be7('0x16')]);router[_0x2be7('0x13')](_0x2be7('0x17'),auth['isAuthenticated'](),controller[_0x2be7('0x18')]);router[_0x2be7('0x19')](_0x2be7('0xd'),auth['isAuthenticated'](),controller[_0x2be7('0x1a')]);module[_0x2be7('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 469ecac..35bc9e9 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 _0xb2ab=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x5716b6,_0x4a3d5a){var _0x547e98=function(_0x34bd48){while(--_0x34bd48){_0x5716b6['push'](_0x5716b6['shift']());}};_0x547e98(++_0x4a3d5a);}(_0xb2ab,0x8e));var _0xbb2a=function(_0x564cb0,_0x198b72){_0x564cb0=_0x564cb0-0x0;var _0x1fceeb=_0xb2ab[_0x564cb0];return _0x1fceeb;};'use strict';var Sequelize=require(_0xbb2a('0x0'));module[_0xbb2a('0x1')]={'body':{'type':Sequelize[_0xbb2a('0x2')](_0xbb2a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbb2a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbb2a('0x5')]('in','out'),'defaultValue':_0xbb2a('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbb2a('0x7')](0xbe)},'phone':{'type':Sequelize[_0xbb2a('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xbb2a('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbb2a('0x7')]},'providerResponse':{'type':Sequelize[_0xbb2a('0x2')]}}; \ No newline at end of file +var _0x9662=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9662,0x68));var _0x2966=function(_0x4bd72f,_0x1928b0){_0x4bd72f=_0x4bd72f-0x0;var _0x1420e9=_0x9662[_0x4bd72f];return _0x1420e9;};'use strict';var Sequelize=require(_0x2966('0x0'));module[_0x2966('0x1')]={'body':{'type':Sequelize[_0x2966('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2966('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2966('0x4')]('in','out'),'defaultValue':_0x2966('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2966('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x2966('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2966('0x6')]},'providerResponse':{'type':Sequelize[_0x2966('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 9b6d6ad..43785d0 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 _0x345a=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','params','intersection','fields','find','create','body','destroy','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','SmsInteraction','read1stAt','interaction','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','event','SmsAccount','inspect','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','messageId','indexOf','delivered','Status','plivio','results','groupName','DELIVERED','infobip','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4f8deb,_0x2bea10){var _0xe80579=function(_0x5c48c2){while(--_0x5c48c2){_0x4f8deb['push'](_0x4f8deb['shift']());}};_0xe80579(++_0x2bea10);}(_0x345a,0xfc));var _0xa345=function(_0x2e6362,_0x90c25){_0x2e6362=_0x2e6362-0x0;var _0x1a5a3b=_0x345a[_0x2e6362];return _0x1a5a3b;};'use strict';var pdf=require(_0xa345('0x0'));var emlformat=require(_0xa345('0x1'));var rimraf=require(_0xa345('0x2'));var zipdir=require(_0xa345('0x3'));var jsonpatch=require(_0xa345('0x4'));var rp=require(_0xa345('0x5'));var moment=require(_0xa345('0x6'));var BPromise=require(_0xa345('0x7'));var Mustache=require('mustache');var util=require(_0xa345('0x8'));var path=require(_0xa345('0x9'));var sox=require(_0xa345('0xa'));var csv=require(_0xa345('0xb'));var ejs=require(_0xa345('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa345('0xd'));var jsforce=require(_0xa345('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa345('0xb'));var querystring=require('querystring');var Papa=require(_0xa345('0xf'));var Redis=require('ioredis');var authService=require(_0xa345('0x10'));var qs=require(_0xa345('0x11'));var as=require(_0xa345('0x12'));var hardwareService=require(_0xa345('0x13'));var logger=require(_0xa345('0x14'))(_0xa345('0x15'));var utils=require(_0xa345('0x16'));var config=require(_0xa345('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa345('0x18'))['db'];config[_0xa345('0x19')]=_[_0xa345('0x1a')](config['redis'],{'host':_0xa345('0x1b'),'port':0x18eb});var socket=require(_0xa345('0x1c'))(new Redis(config[_0xa345('0x19')]));require(_0xa345('0x1d'))[_0xa345('0x1e')](socket);var jayson=require(_0xa345('0x1f'));var client=jayson[_0xa345('0x20')][_0xa345('0x21')]({'port':0x232c});var client9002=jayson[_0xa345('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17019b,_0x471f28,_0x1ac152,_0x447b3e){return new BPromise(function(_0x161d84,_0x462f47){var _0x56e963=_0x447b3e||client;return _0x56e963['request'](_0x17019b,_0x1ac152)[_0xa345('0x22')](function(_0x181841){logger[_0xa345('0x23')](_0xa345('0x24'),_0x471f28,_0xa345('0x25'));logger[_0xa345('0x26')](_0xa345('0x27'),_0x471f28,'request\x20sent',JSON[_0xa345('0x28')](_0x181841));if(_0x181841[_0xa345('0x29')]){if(_0x181841[_0xa345('0x29')][_0xa345('0x2a')]===0x1f4){logger[_0xa345('0x29')]('SmsMessage,\x20%s,\x20%s',_0x471f28,_0x181841[_0xa345('0x29')][_0xa345('0x2b')]);return _0x462f47(_0x181841['error'][_0xa345('0x2b')]);}logger[_0xa345('0x29')]('SmsMessage,\x20%s,\x20%s',_0x471f28,_0x181841['error']['message']);return _0x161d84(_0x181841[_0xa345('0x29')][_0xa345('0x2b')]);}else{logger['info'](_0xa345('0x24'),_0x471f28,_0xa345('0x25'));_0x161d84(_0x181841[_0xa345('0x2c')][_0xa345('0x2b')]);}})[_0xa345('0x2d')](function(_0x6e2902){logger[_0xa345('0x29')](_0xa345('0x24'),_0x471f28,_0x6e2902);_0x462f47(_0x6e2902);});});}function respondWithStatusCode(_0x22f109,_0x1d7af5){_0x1d7af5=_0x1d7af5||0xcc;return function(_0x19b550){if(_0x19b550){return _0x22f109[_0xa345('0x2e')](_0x1d7af5);}return _0x22f109[_0xa345('0x2f')](_0x1d7af5)[_0xa345('0x30')]();};}function respondWithResult(_0x179f62,_0x212850){_0x212850=_0x212850||0xc8;return function(_0x5c33b6){if(_0x5c33b6){return _0x179f62['status'](_0x212850)[_0xa345('0x31')](_0x5c33b6);}};}function respondWithFilteredResult(_0x279474,_0x2851df){return function(_0x28ed74){if(_0x28ed74){var _0x131ad8=_0x28ed74[_0xa345('0x32')],_0xa6f4e9=_0x2851df[_0xa345('0x33')],_0x316438=_0x2851df[_0xa345('0x33')]+_0x2851df[_0xa345('0x34')],_0x121106;if(_0x316438>=_0x131ad8){_0x316438=_0x131ad8;_0x121106=0xc8;}else{_0x121106=0xce;}_0x279474['status'](_0x121106);return _0x279474[_0xa345('0x35')](_0xa345('0x36'),_0xa6f4e9+'-'+_0x316438+'/'+_0x131ad8)[_0xa345('0x31')](_0x28ed74);}return null;};}function patchUpdates(_0x10c054){return function(_0x225112){try{jsonpatch[_0xa345('0x37')](_0x225112,_0x10c054,!![]);}catch(_0x49c84e){return BPromise[_0xa345('0x38')](_0x49c84e);}return _0x225112[_0xa345('0x39')]();};}function saveUpdates(_0x43b5db,_0x5083e3){return function(_0x11aa75){if(_0x11aa75){return _0x11aa75[_0xa345('0x3a')](_0x43b5db)['then'](function(_0xfdf2ed){return _0xfdf2ed;});}return null;};}function removeEntity(_0x4d0f93,_0x430fc0){return function(_0x2a94a0){if(_0x2a94a0){return _0x2a94a0['destroy']()[_0xa345('0x22')](function(){_0x4d0f93[_0xa345('0x2f')](0xcc)[_0xa345('0x30')]();});}};}function handleEntityNotFound(_0x437055,_0x3c8bf0){return function(_0x34fc31){if(!_0x34fc31){_0x437055[_0xa345('0x2e')](0x194);}return _0x34fc31;};}function handleError(_0x10ed35,_0x968ca9){_0x968ca9=_0x968ca9||0x1f4;return function(_0x3ca770){logger[_0xa345('0x29')](_0x3ca770['stack']);if(_0x3ca770[_0xa345('0x3b')]){delete _0x3ca770['name'];}_0x10ed35[_0xa345('0x2f')](_0x968ca9)[_0xa345('0x3c')](_0x3ca770);};}exports[_0xa345('0x3d')]=function(_0xc0868,_0x410abd){var _0x3c46db={},_0x24b23e={},_0x1749ca={'count':0x0,'rows':[]};var _0x2c29e0=_['map'](db[_0xa345('0x3e')][_0xa345('0x3f')],function(_0x2d0b71){return{'name':_0x2d0b71[_0xa345('0x40')],'type':_0x2d0b71[_0xa345('0x41')][_0xa345('0x42')]};});_0x24b23e['model']=_[_0xa345('0x43')](_0x2c29e0,_0xa345('0x3b'));_0x24b23e[_0xa345('0x44')]=_[_0xa345('0x45')](_0xc0868['query']);_0x24b23e[_0xa345('0x46')]=_['intersection'](_0x24b23e[_0xa345('0x47')],_0x24b23e['query']);_0x3c46db[_0xa345('0x48')]=_['intersection'](_0x24b23e[_0xa345('0x47')],qs['fields'](_0xc0868['query']['fields']));_0x3c46db[_0xa345('0x48')]=_0x3c46db['attributes'][_0xa345('0x49')]?_0x3c46db[_0xa345('0x48')]:_0x24b23e[_0xa345('0x47')];if(!_0xc0868['query']['hasOwnProperty'](_0xa345('0x4a'))){_0x3c46db[_0xa345('0x34')]=qs[_0xa345('0x34')](_0xc0868[_0xa345('0x44')][_0xa345('0x34')]);_0x3c46db['offset']=qs[_0xa345('0x33')](_0xc0868[_0xa345('0x44')][_0xa345('0x33')]);}_0x3c46db['order']=qs[_0xa345('0x4b')](_0xc0868[_0xa345('0x44')][_0xa345('0x4b')]);_0x3c46db[_0xa345('0x4c')]=qs[_0xa345('0x46')](_[_0xa345('0x4d')](_0xc0868['query'],_0x24b23e['filters']),_0x2c29e0);if(_0xc0868['query']['filter']){_0x3c46db[_0xa345('0x4c')]=_[_0xa345('0x4e')](_0x3c46db[_0xa345('0x4c')],{'$or':_[_0xa345('0x43')](_0x2c29e0,function(_0x10b1f8){if(_0x10b1f8[_0xa345('0x41')]!==_0xa345('0x4f')){var _0x2a62d8={};_0x2a62d8[_0x10b1f8[_0xa345('0x3b')]]={'$like':'%'+_0xc0868[_0xa345('0x44')]['filter']+'%'};return _0x2a62d8;}})});}_0x3c46db=_[_0xa345('0x4e')]({},_0x3c46db,_0xc0868[_0xa345('0x50')]);var _0x4865ce={'where':_0x3c46db[_0xa345('0x4c')]};return db[_0xa345('0x3e')]['count'](_0x4865ce)[_0xa345('0x22')](function(_0xf6e81c){_0x1749ca[_0xa345('0x32')]=_0xf6e81c;if(_0xc0868[_0xa345('0x44')][_0xa345('0x51')]){_0x3c46db[_0xa345('0x52')]=[{'all':!![]}];}return db[_0xa345('0x3e')]['findAll'](_0x3c46db);})[_0xa345('0x22')](function(_0x5c347f){_0x1749ca[_0xa345('0x53')]=_0x5c347f;return _0x1749ca;})[_0xa345('0x22')](respondWithFilteredResult(_0x410abd,_0x3c46db))['catch'](handleError(_0x410abd,null));};exports['show']=function(_0x23a200,_0x2e8db1){var _0x564374={'raw':!![],'where':{'id':_0x23a200[_0xa345('0x54')]['id']}},_0x35b969={};_0x35b969[_0xa345('0x47')]=_['keys'](db[_0xa345('0x3e')][_0xa345('0x3f')]);_0x35b969[_0xa345('0x44')]=_[_0xa345('0x45')](_0x23a200[_0xa345('0x44')]);_0x35b969[_0xa345('0x46')]=_['intersection'](_0x35b969[_0xa345('0x47')],_0x35b969['query']);_0x564374['attributes']=_[_0xa345('0x55')](_0x35b969[_0xa345('0x47')],qs['fields'](_0x23a200[_0xa345('0x44')][_0xa345('0x56')]));_0x564374[_0xa345('0x48')]=_0x564374[_0xa345('0x48')]['length']?_0x564374['attributes']:_0x35b969[_0xa345('0x47')];if(_0x23a200['query'][_0xa345('0x51')]){_0x564374[_0xa345('0x52')]=[{'all':!![]}];}_0x564374=_['merge']({},_0x564374,_0x23a200[_0xa345('0x50')]);return db[_0xa345('0x3e')][_0xa345('0x57')](_0x564374)[_0xa345('0x22')](handleEntityNotFound(_0x2e8db1,null))['then'](respondWithResult(_0x2e8db1,null))[_0xa345('0x2d')](handleError(_0x2e8db1,null));};exports[_0xa345('0x58')]=function(_0x4d5a45,_0xa727ce){return db[_0xa345('0x3e')][_0xa345('0x58')](_0x4d5a45[_0xa345('0x59')],{})[_0xa345('0x22')](respondWithResult(_0xa727ce,0xc9))[_0xa345('0x2d')](handleError(_0xa727ce,null));};exports[_0xa345('0x3a')]=function(_0x982d0b,_0x5abb86){if(_0x982d0b[_0xa345('0x59')]['id']){delete _0x982d0b[_0xa345('0x59')]['id'];}return db[_0xa345('0x3e')][_0xa345('0x57')]({'where':{'id':_0x982d0b['params']['id']}})[_0xa345('0x22')](handleEntityNotFound(_0x5abb86,null))[_0xa345('0x22')](saveUpdates(_0x982d0b[_0xa345('0x59')],null))[_0xa345('0x22')](respondWithResult(_0x5abb86,null))['catch'](handleError(_0x5abb86,null));};exports[_0xa345('0x5a')]=function(_0x39db6f,_0x3cda5a){return db['SmsMessage'][_0xa345('0x57')]({'where':{'id':_0x39db6f['params']['id']}})[_0xa345('0x22')](handleEntityNotFound(_0x3cda5a,null))[_0xa345('0x22')](removeEntity(_0x3cda5a,null))['catch'](handleError(_0x3cda5a,null));};exports[_0xa345('0x5b')]=function(_0x55bc71,_0x38a77d){return db[_0xa345('0x3e')][_0xa345('0x5b')]()[_0xa345('0x22')](respondWithResult(_0x38a77d,null))[_0xa345('0x2d')](handleError(_0x38a77d,null));};var interaction_log=require('../../config/logger')(_0xa345('0x5c'));exports['accept']=function(_0x4a5543,_0x3a3e8e,_0x5794a){var _0x29d339={'agent':{},'channel':_0xa345('0x5d')};if(_0x4a5543['body']['id']){delete _0x4a5543[_0xa345('0x59')]['id'];}_0x4a5543[_0xa345('0x59')][_0xa345('0x5e')]=!![];_0x4a5543['body'][_0xa345('0x5f')]=moment()[_0xa345('0x60')](_0xa345('0x61'));_0x4a5543['body'][_0xa345('0x62')]=_0x4a5543[_0xa345('0x59')]['UserId']||_0x4a5543[_0xa345('0x63')]['id'];_0x29d339[_0xa345('0x64')]['id']=_0x4a5543[_0xa345('0x59')]['UserId'];return db[_0xa345('0x3e')]['find']({'where':{'id':_0x4a5543[_0xa345('0x54')]['id'],'UserId':null},'include':[{'model':db[_0xa345('0x65')],'as':_0xa345('0x66')}]})['then'](handleEntityNotFound(_0x3a3e8e,null))[_0xa345('0x22')](saveUpdates(_0x4a5543[_0xa345('0x59')],null))[_0xa345('0x22')](function(_0x301722){if(_0x301722){_0x29d339['message']=_0x301722[_0xa345('0x67')]({'plain':!![]});return db[_0xa345('0x68')]['find']({'where':{'id':_0x301722['SmsInteractionId']}});}return null;})[_0xa345('0x22')](handleEntityNotFound(_0x3a3e8e,null))['then'](function(_0x5954db){if(_0x5954db){return _0x5954db[_0xa345('0x3a')]({'UserId':_0x4a5543[_0xa345('0x59')][_0xa345('0x62')],'read1stAt':_['isNil'](_0x5954db[_0xa345('0x69')])?moment()[_0xa345('0x60')](_0xa345('0x61')):undefined});}return null;})['then'](function(_0x2810ca){if(_0x2810ca){_0x29d339[_0xa345('0x6a')]=_0x2810ca[_0xa345('0x67')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a5543[_0xa345('0x63')]['id'],_0x4a5543['user'][_0xa345('0x3b')],_0x4a5543['user'][_0xa345('0x6b')],_0x29d339[_0xa345('0x6a')]['id'],_0x4a5543['body']?JSON[_0xa345('0x28')](_0x4a5543[_0xa345('0x59')]):'null');return respondWithRpcPromise(_0xa345('0x6c'),_0xa345('0x6d'),_0x29d339);}return null;})[_0xa345('0x22')](function(_0x2ed9c7){if(_0x2ed9c7){if(_0x4a5543['body'][_0xa345('0x6e')]){_0x29d339['message'][_0xa345('0x6f')]=util[_0xa345('0x60')](_0xa345('0x70'),_0x4a5543[_0xa345('0x63')][_0xa345('0x3b')]);_0x29d339[_0xa345('0x2b')][_0xa345('0x71')]=_0x29d339['channel'];_0x29d339[_0xa345('0x2b')]['event']=_0xa345('0x72');return respondWithRpcPromise(_0xa345('0x73'),_0xa345('0x73'),{'event':_0xa345('0x74'),'message':_0x29d339[_0xa345('0x2b')]},client9002)['then'](function(){return _0x29d339;});}return _0x29d339;}return null;})[_0xa345('0x22')](respondWithResult(_0x3a3e8e,null))[_0xa345('0x2d')](handleError(_0x3a3e8e,null));};var interaction_log=require(_0xa345('0x14'))(_0xa345('0x5c'));exports[_0xa345('0x38')]=function(_0xda5d0e,_0x2fd26d,_0x563c74){var _0x1bfa00={'agent':{},'channel':_0xa345('0x5d')};if(_0xda5d0e[_0xa345('0x59')]['id']){delete _0xda5d0e['body']['id'];}_0xda5d0e[_0xa345('0x59')]['UserId']=_0xda5d0e[_0xa345('0x59')][_0xa345('0x62')]||_0xda5d0e[_0xa345('0x63')]['id'];_0x1bfa00[_0xa345('0x64')]['id']=_0xda5d0e['body'][_0xa345('0x62')];return db[_0xa345('0x3e')][_0xa345('0x57')]({'where':{'id':_0xda5d0e[_0xa345('0x54')]['id'],'UserId':null}})[_0xa345('0x22')](handleEntityNotFound(_0x2fd26d,null))['then'](function(_0x23b58d){if(_0x23b58d){_0x1bfa00[_0xa345('0x2b')]=_0x23b58d[_0xa345('0x67')]({'plain':!![]});return db[_0xa345('0x68')][_0xa345('0x57')]({'where':{'id':_0x23b58d[_0xa345('0x75')]}});}return null;})[_0xa345('0x22')](handleEntityNotFound(_0x2fd26d,null))[_0xa345('0x22')](function(_0x56f11c){if(_0x56f11c){_0x1bfa00[_0xa345('0x6a')]=_0x56f11c[_0xa345('0x67')]({'plain':!![]});interaction_log['info'](_0xa345('0x76'),_0xda5d0e['user']['id'],_0xda5d0e[_0xa345('0x63')][_0xa345('0x3b')],_0xda5d0e[_0xa345('0x63')][_0xa345('0x6b')],_0x1bfa00['interaction']['id'],_0xda5d0e[_0xa345('0x59')]?JSON[_0xa345('0x28')](_0xda5d0e[_0xa345('0x59')]):_0xa345('0x77'));return respondWithRpcPromise(_0xa345('0x78'),'rejectMessage',_0x1bfa00);}return null;})['then'](function(_0xf377bf){if(_0xf377bf){_0xf377bf[_0xa345('0x2b')]['interface']=util[_0xa345('0x60')](_0xa345('0x70'),_0xda5d0e[_0xa345('0x63')][_0xa345('0x3b')]);_0xf377bf['message'][_0xa345('0x71')]=_0x1bfa00[_0xa345('0x71')];_0xf377bf[_0xa345('0x2b')][_0xa345('0x79')]=_0xa345('0x38');respondWithRpcPromise(_0xa345('0x73'),_0xa345('0x73'),{'event':'rejectmessage','message':_0xf377bf[_0xa345('0x2b')]},client9002);return _0x1bfa00;}return null;})[_0xa345('0x22')](respondWithResult(_0x2fd26d,null))[_0xa345('0x2d')](handleError(_0x2fd26d,null));};exports[_0xa345('0x2f')]=function(_0x8b26d5,_0x56c114,_0x5d0877){if(_0x8b26d5[_0xa345('0x59')]['id']){delete _0x8b26d5[_0xa345('0x59')]['id'];}var _0x1605c2;return db[_0xa345('0x3e')]['find']({'where':{'id':_0x8b26d5[_0xa345('0x54')]['id']}})['then'](handleEntityNotFound(_0x56c114,null))[_0xa345('0x22')](function(_0x1aeb94){if(_0x1aeb94){_0x1605c2=_0x1aeb94;return db[_0xa345('0x7a')]['find']({'where':{'id':_0x1aeb94['SmsAccountId']}});}})[_0xa345('0x22')](handleEntityNotFound(_0x56c114,null))[_0xa345('0x22')](function(_0x39b400){if(_0x39b400){logger[_0xa345('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa345('0x2f'),'received\x20delivery\x20report\x20from',_0x39b400[_0xa345('0x41')],util[_0xa345('0x7b')](_0x8b26d5['body'],{'showHidden':![],'depth':null}));switch(_0x39b400[_0xa345('0x41')]){case'twilio':if(_0x8b26d5['body'][_0xa345('0x7c')]&&_0x8b26d5[_0xa345('0x59')][_0xa345('0x7c')]===_0x1605c2['messageId']){return _0x1605c2[_0xa345('0x3a')]({'read':!![]});}else{logger[_0xa345('0x29')](_0xa345('0x7d'),_0xa345('0x2f'),_0xa345('0x7e'),util[_0xa345('0x7b')](_0x8b26d5[_0xa345('0x59')],{'showHidden':![],'depth':null}));}break;case _0xa345('0x7f'):if(_0x8b26d5['body'][_0xa345('0x80')]&&_0x8b26d5[_0xa345('0x59')][_0xa345('0x80')]===_0x1605c2[_0xa345('0x81')]&&_[_0xa345('0x82')](['sent',_0xa345('0x83')],_0x8b26d5[_0xa345('0x59')][_0xa345('0x84')])>=0x0){return _0x1605c2[_0xa345('0x3a')]({'read':!![]});}else{logger[_0xa345('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa345('0x2f'),_0xa345('0x85'),util[_0xa345('0x7b')](_0x8b26d5['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2d072f=_0x8b26d5[_0xa345('0x59')][_0xa345('0x86')][0x0];if(_0x2d072f[_0xa345('0x2f')][_0xa345('0x87')]===_0xa345('0x88')){return _0x1605c2[_0xa345('0x3a')]({'read':!![]});}else{logger[_0xa345('0x29')](_0xa345('0x7d'),'status',_0xa345('0x89'),util[_0xa345('0x7b')](_0x8b26d5[_0xa345('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x1605c2;}})[_0xa345('0x22')](respondWithResult(_0x56c114,null))[_0xa345('0x2d')](handleError(_0x56c114,null));}; \ No newline at end of file +var _0xf51e=['twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','name','send','map','SmsMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','update','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','UserId','CmContact','get','SmsInteraction','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','sms-interactions','agent','SmsInteractionId','RejectMessage','rejectMessage','SIP/%s','SmsAccountId','received\x20delivery\x20report\x20from','inspect'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xf51e,0x116));var _0xef51=function(_0x1ff11e,_0x4583e1){_0x1ff11e=_0x1ff11e-0x0;var _0x265bba=_0xf51e[_0x1ff11e];return _0x265bba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xef51('0x0'));var rimraf=require(_0xef51('0x1'));var zipdir=require(_0xef51('0x2'));var jsonpatch=require(_0xef51('0x3'));var rp=require(_0xef51('0x4'));var moment=require(_0xef51('0x5'));var BPromise=require(_0xef51('0x6'));var Mustache=require(_0xef51('0x7'));var util=require(_0xef51('0x8'));var path=require(_0xef51('0x9'));var sox=require(_0xef51('0xa'));var csv=require(_0xef51('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xef51('0xc'));var crypto=require(_0xef51('0xd'));var jsforce=require(_0xef51('0xe'));var deskjs=require(_0xef51('0xf'));var toCsv=require('to-csv');var querystring=require(_0xef51('0x10'));var Papa=require(_0xef51('0x11'));var Redis=require('ioredis');var authService=require(_0xef51('0x12'));var qs=require(_0xef51('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef51('0x14'));var logger=require(_0xef51('0x15'))(_0xef51('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xef51('0x17'))['db'];config[_0xef51('0x18')]=_[_0xef51('0x19')](config['redis'],{'host':_0xef51('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef51('0x18')]));require(_0xef51('0x1b'))[_0xef51('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xef51('0x1d')]({'port':0x232c});var client9002=jayson[_0xef51('0x1e')][_0xef51('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2e4754,_0x46f2d1,_0x439ee6,_0x487f26){return new BPromise(function(_0x2f7501,_0x48be53){var _0x153d00=_0x487f26||client;return _0x153d00[_0xef51('0x1f')](_0x2e4754,_0x439ee6)[_0xef51('0x20')](function(_0x5c6ff1){logger[_0xef51('0x21')](_0xef51('0x22'),_0x46f2d1,'request\x20sent');logger[_0xef51('0x23')](_0xef51('0x24'),_0x46f2d1,_0xef51('0x25'),JSON[_0xef51('0x26')](_0x5c6ff1));if(_0x5c6ff1['error']){if(_0x5c6ff1['error'][_0xef51('0x27')]===0x1f4){logger[_0xef51('0x28')](_0xef51('0x22'),_0x46f2d1,_0x5c6ff1[_0xef51('0x28')][_0xef51('0x29')]);return _0x48be53(_0x5c6ff1[_0xef51('0x28')][_0xef51('0x29')]);}logger['error'](_0xef51('0x22'),_0x46f2d1,_0x5c6ff1[_0xef51('0x28')][_0xef51('0x29')]);return _0x2f7501(_0x5c6ff1[_0xef51('0x28')][_0xef51('0x29')]);}else{logger[_0xef51('0x21')](_0xef51('0x22'),_0x46f2d1,_0xef51('0x25'));_0x2f7501(_0x5c6ff1[_0xef51('0x2a')][_0xef51('0x29')]);}})[_0xef51('0x2b')](function(_0x2fcf9c){logger['error']('SmsMessage,\x20%s,\x20%s',_0x46f2d1,_0x2fcf9c);_0x48be53(_0x2fcf9c);});});}function respondWithStatusCode(_0x3d963b,_0x165807){_0x165807=_0x165807||0xcc;return function(_0x11f1dc){if(_0x11f1dc){return _0x3d963b[_0xef51('0x2c')](_0x165807);}return _0x3d963b[_0xef51('0x2d')](_0x165807)[_0xef51('0x2e')]();};}function respondWithResult(_0x38e370,_0x489873){_0x489873=_0x489873||0xc8;return function(_0x7fdb99){if(_0x7fdb99){return _0x38e370[_0xef51('0x2d')](_0x489873)[_0xef51('0x2f')](_0x7fdb99);}};}function respondWithFilteredResult(_0x2a8670,_0x1e637f){return function(_0x3cc08f){if(_0x3cc08f){var _0x62fac5=_0x3cc08f[_0xef51('0x30')],_0x4d00e1=_0x1e637f['offset'],_0x1d52fb=_0x1e637f[_0xef51('0x31')]+_0x1e637f[_0xef51('0x32')],_0x9bc2fe;if(_0x1d52fb>=_0x62fac5){_0x1d52fb=_0x62fac5;_0x9bc2fe=0xc8;}else{_0x9bc2fe=0xce;}_0x2a8670[_0xef51('0x2d')](_0x9bc2fe);return _0x2a8670[_0xef51('0x33')](_0xef51('0x34'),_0x4d00e1+'-'+_0x1d52fb+'/'+_0x62fac5)[_0xef51('0x2f')](_0x3cc08f);}return null;};}function patchUpdates(_0x4f4b60){return function(_0x1e4de8){try{jsonpatch[_0xef51('0x35')](_0x1e4de8,_0x4f4b60,!![]);}catch(_0x2d40a2){return BPromise[_0xef51('0x36')](_0x2d40a2);}return _0x1e4de8['save']();};}function saveUpdates(_0x2f84a9,_0x36bc80){return function(_0x116893){if(_0x116893){return _0x116893['update'](_0x2f84a9)[_0xef51('0x20')](function(_0x54f05b){return _0x54f05b;});}return null;};}function removeEntity(_0x4dd991,_0x45c8d6){return function(_0x46ac5c){if(_0x46ac5c){return _0x46ac5c[_0xef51('0x37')]()[_0xef51('0x20')](function(){_0x4dd991[_0xef51('0x2d')](0xcc)[_0xef51('0x2e')]();});}};}function handleEntityNotFound(_0x13438f,_0x49c615){return function(_0x10d27b){if(!_0x10d27b){_0x13438f['sendStatus'](0x194);}return _0x10d27b;};}function handleError(_0x1f54c4,_0x19c78f){_0x19c78f=_0x19c78f||0x1f4;return function(_0x1d0827){logger[_0xef51('0x28')](_0x1d0827['stack']);if(_0x1d0827[_0xef51('0x38')]){delete _0x1d0827[_0xef51('0x38')];}_0x1f54c4[_0xef51('0x2d')](_0x19c78f)[_0xef51('0x39')](_0x1d0827);};}exports['index']=function(_0xbd8bf6,_0x5e4505){var _0x329bee={},_0x1e99af={},_0x30d823={'count':0x0,'rows':[]};var _0x190361=_[_0xef51('0x3a')](db[_0xef51('0x3b')][_0xef51('0x3c')],function(_0x2d8cc2){return{'name':_0x2d8cc2[_0xef51('0x3d')],'type':_0x2d8cc2[_0xef51('0x3e')]['key']};});_0x1e99af[_0xef51('0x3f')]=_['map'](_0x190361,_0xef51('0x38'));_0x1e99af[_0xef51('0x40')]=_[_0xef51('0x41')](_0xbd8bf6['query']);_0x1e99af[_0xef51('0x42')]=_[_0xef51('0x43')](_0x1e99af[_0xef51('0x3f')],_0x1e99af['query']);_0x329bee[_0xef51('0x44')]=_[_0xef51('0x43')](_0x1e99af[_0xef51('0x3f')],qs['fields'](_0xbd8bf6[_0xef51('0x40')][_0xef51('0x45')]));_0x329bee[_0xef51('0x44')]=_0x329bee[_0xef51('0x44')]['length']?_0x329bee[_0xef51('0x44')]:_0x1e99af[_0xef51('0x3f')];if(!_0xbd8bf6['query'][_0xef51('0x46')](_0xef51('0x47'))){_0x329bee[_0xef51('0x32')]=qs[_0xef51('0x32')](_0xbd8bf6[_0xef51('0x40')][_0xef51('0x32')]);_0x329bee['offset']=qs[_0xef51('0x31')](_0xbd8bf6[_0xef51('0x40')][_0xef51('0x31')]);}_0x329bee['order']=qs['sort'](_0xbd8bf6[_0xef51('0x40')][_0xef51('0x48')]);_0x329bee[_0xef51('0x49')]=qs['filters'](_[_0xef51('0x4a')](_0xbd8bf6[_0xef51('0x40')],_0x1e99af['filters']),_0x190361);if(_0xbd8bf6[_0xef51('0x40')][_0xef51('0x4b')]){_0x329bee['where']=_[_0xef51('0x4c')](_0x329bee[_0xef51('0x49')],{'$or':_[_0xef51('0x3a')](_0x190361,function(_0x5d999c){if(_0x5d999c[_0xef51('0x3e')]!==_0xef51('0x4d')){var _0x1204bd={};_0x1204bd[_0x5d999c[_0xef51('0x38')]]={'$like':'%'+_0xbd8bf6[_0xef51('0x40')]['filter']+'%'};return _0x1204bd;}})});}_0x329bee=_['merge']({},_0x329bee,_0xbd8bf6[_0xef51('0x4e')]);var _0x39ffeb={'where':_0x329bee['where']};return db[_0xef51('0x3b')][_0xef51('0x30')](_0x39ffeb)[_0xef51('0x20')](function(_0xedd44a){_0x30d823[_0xef51('0x30')]=_0xedd44a;if(_0xbd8bf6[_0xef51('0x40')][_0xef51('0x4f')]){_0x329bee[_0xef51('0x50')]=[{'all':!![]}];}return db[_0xef51('0x3b')][_0xef51('0x51')](_0x329bee);})[_0xef51('0x20')](function(_0x8b6e69){_0x30d823[_0xef51('0x52')]=_0x8b6e69;return _0x30d823;})[_0xef51('0x20')](respondWithFilteredResult(_0x5e4505,_0x329bee))['catch'](handleError(_0x5e4505,null));};exports[_0xef51('0x53')]=function(_0x122794,_0x5b5c2d){var _0x1fe80c={'raw':!![],'where':{'id':_0x122794[_0xef51('0x54')]['id']}},_0x1729bd={};_0x1729bd['model']=_[_0xef51('0x41')](db[_0xef51('0x3b')][_0xef51('0x3c')]);_0x1729bd[_0xef51('0x40')]=_[_0xef51('0x41')](_0x122794[_0xef51('0x40')]);_0x1729bd[_0xef51('0x42')]=_[_0xef51('0x43')](_0x1729bd['model'],_0x1729bd['query']);_0x1fe80c[_0xef51('0x44')]=_[_0xef51('0x43')](_0x1729bd[_0xef51('0x3f')],qs[_0xef51('0x45')](_0x122794[_0xef51('0x40')]['fields']));_0x1fe80c[_0xef51('0x44')]=_0x1fe80c[_0xef51('0x44')]['length']?_0x1fe80c[_0xef51('0x44')]:_0x1729bd['model'];if(_0x122794['query'][_0xef51('0x4f')]){_0x1fe80c[_0xef51('0x50')]=[{'all':!![]}];}_0x1fe80c=_['merge']({},_0x1fe80c,_0x122794[_0xef51('0x4e')]);return db[_0xef51('0x3b')][_0xef51('0x55')](_0x1fe80c)['then'](handleEntityNotFound(_0x5b5c2d,null))[_0xef51('0x20')](respondWithResult(_0x5b5c2d,null))['catch'](handleError(_0x5b5c2d,null));};exports[_0xef51('0x56')]=function(_0x20f82f,_0x3e132f){return db[_0xef51('0x3b')]['create'](_0x20f82f[_0xef51('0x57')],{})[_0xef51('0x20')](respondWithResult(_0x3e132f,0xc9))[_0xef51('0x2b')](handleError(_0x3e132f,null));};exports[_0xef51('0x58')]=function(_0x254289,_0x1d8fa3){if(_0x254289[_0xef51('0x57')]['id']){delete _0x254289[_0xef51('0x57')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x254289[_0xef51('0x54')]['id']}})[_0xef51('0x20')](handleEntityNotFound(_0x1d8fa3,null))[_0xef51('0x20')](saveUpdates(_0x254289[_0xef51('0x57')],null))[_0xef51('0x20')](respondWithResult(_0x1d8fa3,null))[_0xef51('0x2b')](handleError(_0x1d8fa3,null));};exports[_0xef51('0x37')]=function(_0x6d2b7c,_0x3e12fd){return db['SmsMessage']['find']({'where':{'id':_0x6d2b7c[_0xef51('0x54')]['id']}})['then'](handleEntityNotFound(_0x3e12fd,null))['then'](removeEntity(_0x3e12fd,null))[_0xef51('0x2b')](handleError(_0x3e12fd,null));};exports[_0xef51('0x59')]=function(_0x730492,_0x52507a){return db[_0xef51('0x3b')][_0xef51('0x59')]()[_0xef51('0x20')](respondWithResult(_0x52507a,null))[_0xef51('0x2b')](handleError(_0x52507a,null));};var interaction_log=require(_0xef51('0x15'))('sms-interactions');exports[_0xef51('0x5a')]=function(_0x2e1e33,_0x4ab396,_0x3a4bd2){var _0x5b1a10={'agent':{},'channel':_0xef51('0x5b')};if(_0x2e1e33[_0xef51('0x57')]['id']){delete _0x2e1e33[_0xef51('0x57')]['id'];}_0x2e1e33[_0xef51('0x57')][_0xef51('0x5c')]=!![];_0x2e1e33['body'][_0xef51('0x5d')]=moment()[_0xef51('0x5e')](_0xef51('0x5f'));_0x2e1e33[_0xef51('0x57')]['UserId']=_0x2e1e33[_0xef51('0x57')]['UserId']||_0x2e1e33[_0xef51('0x60')]['id'];_0x5b1a10['agent']['id']=_0x2e1e33[_0xef51('0x57')][_0xef51('0x61')];return db[_0xef51('0x3b')][_0xef51('0x55')]({'where':{'id':_0x2e1e33['params']['id'],'UserId':null},'include':[{'model':db[_0xef51('0x62')],'as':'Contact'}]})[_0xef51('0x20')](handleEntityNotFound(_0x4ab396,null))[_0xef51('0x20')](saveUpdates(_0x2e1e33[_0xef51('0x57')],null))[_0xef51('0x20')](function(_0x5adeb6){if(_0x5adeb6){_0x5b1a10[_0xef51('0x29')]=_0x5adeb6[_0xef51('0x63')]({'plain':!![]});return db[_0xef51('0x64')][_0xef51('0x55')]({'where':{'id':_0x5adeb6['SmsInteractionId']}});}return null;})[_0xef51('0x20')](handleEntityNotFound(_0x4ab396,null))[_0xef51('0x20')](function(_0x180de4){if(_0x180de4){return _0x180de4[_0xef51('0x58')]({'UserId':_0x2e1e33[_0xef51('0x57')][_0xef51('0x61')],'read1stAt':_[_0xef51('0x65')](_0x180de4[_0xef51('0x66')])?moment()[_0xef51('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xef51('0x20')](function(_0x29851c){if(_0x29851c){_0x5b1a10[_0xef51('0x67')]=_0x29851c[_0xef51('0x63')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2e1e33['user']['id'],_0x2e1e33[_0xef51('0x60')][_0xef51('0x38')],_0x2e1e33[_0xef51('0x60')][_0xef51('0x68')],_0x5b1a10[_0xef51('0x67')]['id'],_0x2e1e33[_0xef51('0x57')]?JSON[_0xef51('0x26')](_0x2e1e33[_0xef51('0x57')]):'null');return respondWithRpcPromise(_0xef51('0x69'),_0xef51('0x6a'),_0x5b1a10);}return null;})[_0xef51('0x20')](function(_0x8ca7c8){if(_0x8ca7c8){if(_0x2e1e33['body']['manual']){_0x5b1a10['message'][_0xef51('0x6b')]=util[_0xef51('0x5e')]('SIP/%s',_0x2e1e33[_0xef51('0x60')][_0xef51('0x38')]);_0x5b1a10['message'][_0xef51('0x6c')]=_0x5b1a10[_0xef51('0x6c')];_0x5b1a10['message'][_0xef51('0x6d')]='accept';return respondWithRpcPromise('EventManager',_0xef51('0x6e'),{'event':_0xef51('0x6f'),'message':_0x5b1a10[_0xef51('0x29')]},client9002)[_0xef51('0x20')](function(){return _0x5b1a10;});}return _0x5b1a10;}return null;})['then'](respondWithResult(_0x4ab396,null))[_0xef51('0x2b')](handleError(_0x4ab396,null));};var interaction_log=require(_0xef51('0x15'))(_0xef51('0x70'));exports[_0xef51('0x36')]=function(_0x5def42,_0x243d41,_0x8835be){var _0x10585b={'agent':{},'channel':'sms'};if(_0x5def42[_0xef51('0x57')]['id']){delete _0x5def42[_0xef51('0x57')]['id'];}_0x5def42[_0xef51('0x57')][_0xef51('0x61')]=_0x5def42[_0xef51('0x57')][_0xef51('0x61')]||_0x5def42[_0xef51('0x60')]['id'];_0x10585b[_0xef51('0x71')]['id']=_0x5def42[_0xef51('0x57')][_0xef51('0x61')];return db[_0xef51('0x3b')][_0xef51('0x55')]({'where':{'id':_0x5def42[_0xef51('0x54')]['id'],'UserId':null}})[_0xef51('0x20')](handleEntityNotFound(_0x243d41,null))[_0xef51('0x20')](function(_0x45ae6b){if(_0x45ae6b){_0x10585b[_0xef51('0x29')]=_0x45ae6b[_0xef51('0x63')]({'plain':!![]});return db[_0xef51('0x64')][_0xef51('0x55')]({'where':{'id':_0x45ae6b[_0xef51('0x72')]}});}return null;})[_0xef51('0x20')](handleEntityNotFound(_0x243d41,null))['then'](function(_0x6b291e){if(_0x6b291e){_0x10585b['interaction']=_0x6b291e['get']({'plain':!![]});interaction_log[_0xef51('0x21')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5def42[_0xef51('0x60')]['id'],_0x5def42['user']['name'],_0x5def42[_0xef51('0x60')][_0xef51('0x68')],_0x10585b[_0xef51('0x67')]['id'],_0x5def42[_0xef51('0x57')]?JSON[_0xef51('0x26')](_0x5def42['body']):'null');return respondWithRpcPromise(_0xef51('0x73'),_0xef51('0x74'),_0x10585b);}return null;})['then'](function(_0x16266d){if(_0x16266d){_0x16266d[_0xef51('0x29')][_0xef51('0x6b')]=util[_0xef51('0x5e')](_0xef51('0x75'),_0x5def42[_0xef51('0x60')]['name']);_0x16266d['message']['channel']=_0x10585b['channel'];_0x16266d[_0xef51('0x29')][_0xef51('0x6d')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x16266d[_0xef51('0x29')]},client9002);return _0x10585b;}return null;})[_0xef51('0x20')](respondWithResult(_0x243d41,null))[_0xef51('0x2b')](handleError(_0x243d41,null));};exports['status']=function(_0x373ee4,_0x18a5ee,_0x35b5ff){if(_0x373ee4[_0xef51('0x57')]['id']){delete _0x373ee4[_0xef51('0x57')]['id'];}var _0x144b7b;return db[_0xef51('0x3b')][_0xef51('0x55')]({'where':{'id':_0x373ee4[_0xef51('0x54')]['id']}})[_0xef51('0x20')](handleEntityNotFound(_0x18a5ee,null))['then'](function(_0x174e7c){if(_0x174e7c){_0x144b7b=_0x174e7c;return db['SmsAccount'][_0xef51('0x55')]({'where':{'id':_0x174e7c[_0xef51('0x76')]}});}})['then'](handleEntityNotFound(_0x18a5ee,null))[_0xef51('0x20')](function(_0x305a53){if(_0x305a53){logger[_0xef51('0x23')](_0xef51('0x24'),_0xef51('0x2d'),_0xef51('0x77'),_0x305a53['type'],util[_0xef51('0x78')](_0x373ee4['body'],{'showHidden':![],'depth':null}));switch(_0x305a53[_0xef51('0x3e')]){case _0xef51('0x79'):if(_0x373ee4['body'][_0xef51('0x7a')]&&_0x373ee4[_0xef51('0x57')]['MessageSid']===_0x144b7b[_0xef51('0x7b')]){return _0x144b7b[_0xef51('0x58')]({'read':!![]});}else{logger[_0xef51('0x28')](_0xef51('0x7c'),'status',_0xef51('0x79'),util['inspect'](_0x373ee4[_0xef51('0x57')],{'showHidden':![],'depth':null}));}break;case _0xef51('0x7d'):if(_0x373ee4[_0xef51('0x57')][_0xef51('0x7e')]&&_0x373ee4[_0xef51('0x57')]['MessageUUID']===_0x144b7b[_0xef51('0x7b')]&&_[_0xef51('0x7f')](['sent',_0xef51('0x80')],_0x373ee4[_0xef51('0x57')][_0xef51('0x81')])>=0x0){return _0x144b7b[_0xef51('0x58')]({'read':!![]});}else{logger[_0xef51('0x28')](_0xef51('0x7c'),'status','plivio',util[_0xef51('0x78')](_0x373ee4[_0xef51('0x57')],{'showHidden':![],'depth':null}));}break;case _0xef51('0x82'):var _0x4cd791=_0x373ee4['body']['results'][0x0];if(_0x4cd791['status'][_0xef51('0x83')]===_0xef51('0x84')){return _0x144b7b['update']({'read':!![]});}else{logger['error'](_0xef51('0x7c'),_0xef51('0x2d'),_0xef51('0x82'),util[_0xef51('0x78')](_0x373ee4[_0xef51('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x144b7b;}})[_0xef51('0x20')](respondWithResult(_0x18a5ee,null))[_0xef51('0x2b')](handleError(_0x18a5ee,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index f1262e1..c49e2aa 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 _0xabb4=['remove','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x23b7d9,_0x55ed3b){var _0x5309e7=function(_0x5c60da){while(--_0x5c60da){_0x23b7d9['push'](_0x23b7d9['shift']());}};_0x5309e7(++_0x55ed3b);}(_0xabb4,0x13a));var _0x4abb=function(_0x3e57e5,_0x50ec4a){_0x3e57e5=_0x3e57e5-0x0;var _0x5dbda3=_0xabb4[_0x3e57e5];return _0x5dbda3;};'use strict';var EventEmitter=require(_0x4abb('0x0'));var SmsMessage=require(_0x4abb('0x1'))['db'][_0x4abb('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4abb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4abb('0x4')};function emitEvent(_0x59c0f0){return function(_0x517293,_0x5365b0,_0x4d52cd){SmsMessageEvents['emit'](_0x59c0f0+':'+_0x517293['id'],_0x517293);SmsMessageEvents['emit'](_0x59c0f0,_0x517293);_0x4d52cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x4abb('0x5')]=SmsMessageEvents; \ No newline at end of file +var _0x8bdf=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3fcb71,_0x46dd2b){var _0x4931a5=function(_0x3750d1){while(--_0x3750d1){_0x3fcb71['push'](_0x3fcb71['shift']());}};_0x4931a5(++_0x46dd2b);}(_0x8bdf,0x1ba));var _0xf8bd=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x8bdf[_0x3ab9ee];return _0x82ee88;};'use strict';var EventEmitter=require(_0xf8bd('0x0'));var SmsMessage=require(_0xf8bd('0x1'))['db'][_0xf8bd('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xf8bd('0x3')](0x0);var events={'afterCreate':_0xf8bd('0x4'),'afterUpdate':_0xf8bd('0x5'),'afterDestroy':_0xf8bd('0x6')};function emitEvent(_0x494958){return function(_0x5f0477,_0xdcb8de,_0x3c2f0e){SmsMessageEvents['emit'](_0x494958+':'+_0x5f0477['id'],_0x5f0477);SmsMessageEvents[_0xf8bd('0x7')](_0x494958,_0x5f0477);_0x3c2f0e(null);};}for(var e in events){if(events[_0xf8bd('0x8')](e)){var event=events[e];SmsMessage[_0xf8bd('0x9')](e,emitEvent(event));}}module[_0xf8bd('0xa')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 1dac376..2c18e38 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 _0x11fb=['authToken','phone','create','remote','token','then','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','http_code','data','head','messages','message_id','clickSend','authId','/api/sms/messages/','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20','infobip','csc','apiKey','login','text','timestamp','digest','hex','signature=','GET','/external/get/send.php?','keys','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','accountId','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','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','createdAt','catch','error','SmsAccount','SmsAccountId','type','twilio','accountSid'];(function(_0x5d57fc,_0x49f7d6){var _0x2729c9=function(_0xb5463e){while(--_0xb5463e){_0x5d57fc['push'](_0x5d57fc['shift']());}};_0x2729c9(++_0x49f7d6);}(_0x11fb,0x147));var _0xb11f=function(_0x34d8ab,_0x468f0e){_0x34d8ab=_0x34d8ab-0x0;var _0x46643e=_0x11fb[_0x34d8ab];return _0x46643e;};'use strict';var _=require(_0xb11f('0x0'));var util=require(_0xb11f('0x1'));var logger=require('../../config/logger')(_0xb11f('0x2'));var moment=require(_0xb11f('0x3'));var BPromise=require(_0xb11f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb11f('0x5'));var rimraf=require(_0xb11f('0x6'));var config=require(_0xb11f('0x7'));var attributes=require(_0xb11f('0x8'));module[_0xb11f('0x9')]=function(_0x3e26db,_0x2a8483){return _0x3e26db[_0xb11f('0xa')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xb11f('0xb'),'fields':[_0xb11f('0xb')]},{'name':_0xb11f('0xc'),'fields':[_0xb11f('0xd')],'type':_0xb11f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4677a1,_0x203783,_0x10639d){var _0x1407ab=_0x3e26db[_0xb11f('0xf')];var _0x2fc26a=_0x4677a1[_0xb11f('0x10')]({'plain':!![]});if(_0x2fc26a[_0xb11f('0x11')][_0xb11f('0x12')]()==='in'||_0x2fc26a[_0xb11f('0x11')][_0xb11f('0x12')]()===_0xb11f('0x13')&&!_0x2fc26a[_0xb11f('0x14')]&&!_[_0xb11f('0x15')](_0x2fc26a[_0xb11f('0x16')])){_0x1407ab[_0xb11f('0x17')]['findOne']({'where':{'id':_0x2fc26a[_0xb11f('0x18')]}})['then'](function(_0x3d70df){if(_0x3d70df){_0x3d70df['update']({'lastMsgAt':_0x2fc26a[_0xb11f('0x19')],'lastMsgDirection':_0x2fc26a[_0xb11f('0x11')][_0xb11f('0x12')]()});}})[_0xb11f('0x1a')](function(_0x1f85be){console[_0xb11f('0x1b')](_0x1f85be);});}if(_0x2fc26a[_0xb11f('0x11')]==='out'&&!_0x2fc26a[_0xb11f('0x14')]){var _0x53eb9f;_0x1407ab[_0xb11f('0x1c')]['find']({'where':{'id':_0x2fc26a[_0xb11f('0x1d')]},'raw':!![]})['then'](function(_0x5ec6d5){_0x53eb9f=_0x5ec6d5;if(_0x53eb9f&&_0x53eb9f[_0xb11f('0x1e')]){switch(_0x53eb9f[_0xb11f('0x1e')]){case'twilio':var _0x3d6520=require(_0xb11f('0x1f'));if(_0x53eb9f[_0xb11f('0x20')]&&_0x53eb9f[_0xb11f('0x21')]&&_0x53eb9f[_0xb11f('0x22')]){var _0x19dc64=new _0x3d6520(_0x53eb9f[_0xb11f('0x20')],_0x53eb9f[_0xb11f('0x21')]);_0x19dc64['messages'][_0xb11f('0x23')]({'body':_0x2fc26a[_0xb11f('0xd')],'to':_0x2fc26a[_0xb11f('0x22')],'from':_0x53eb9f[_0xb11f('0x22')],'statusCallback':_0x53eb9f[_0xb11f('0x24')]+'/api/sms/messages/'+_0x2fc26a['id']+'/status?token='+_0x53eb9f[_0xb11f('0x25')]})[_0xb11f('0x26')](function(_0x3a649d){if(_0x3a649d[_0xb11f('0x27')]){return _0x4677a1[_0xb11f('0x28')]({'messageId':_0x3a649d[_0xb11f('0x27')]});}})[_0xb11f('0x1a')](function(_0x253b43){logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x1f'),util[_0xb11f('0x2b')](_0x253b43,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),'afterCreate',_0xb11f('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xb11f('0x2c'):var _0x1e17d7=_0xb11f('0x2d');if(_0x53eb9f[_0xb11f('0x2e')]&&_0x53eb9f[_0xb11f('0x2f')]){var _0x54880e={'recipient':[_0x2fc26a[_0xb11f('0x22')]],'message':_0x2fc26a[_0xb11f('0xd')],'message_type':_0x53eb9f[_0xb11f('0x30')]};if(_0x53eb9f[_0xb11f('0x30')]&&_0x53eb9f[_0xb11f('0x30')]!=='SI'){_0x54880e[_0xb11f('0x31')]=_0x53eb9f[_0xb11f('0x22')];}var _0xa307ef={'url':_0x1e17d7+_0xb11f('0x32')+_0x53eb9f[_0xb11f('0x2e')]+_0xb11f('0x33')+_0x53eb9f[_0xb11f('0x2f')],'method':'GET'};rp(_0xa307ef)[_0xb11f('0x26')](function(_0x1599ea){var _0x321855=_0x1599ea[_0xb11f('0x34')](';');var _0xb795bc={'user_key':_0x321855[0x0],'session_key':_0x321855[0x1]};_0xa307ef={'url':_0x1e17d7+'sms','method':_0xb11f('0x35'),'headers':{'user_key':_0xb795bc[_0xb11f('0x36')],'Session_key':_0xb795bc[_0xb11f('0x37')]},'json':!![],'body':_0x54880e};return rp(_0xa307ef);})[_0xb11f('0x26')](function(_0x727e7e){if(_0x727e7e[_0xb11f('0x38')]>=0x1){var _0x937101={'messageId':_0x727e7e[_0xb11f('0x39')]};if(_0x53eb9f[_0xb11f('0x30')]!=='GP'||!_0x53eb9f[_0xb11f('0x3a')]){_0x937101['read']=!![];}return _0x4677a1['update'](_0x937101);}else{return logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),_0xb11f('0x2c'),util[_0xb11f('0x2b')](_0x727e7e,{'showHidden':![],'depth':null}));}})[_0xb11f('0x1a')](function(_0xf582ae){return logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x2c'),util[_0xb11f('0x2b')](_0xf582ae,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),'skebby',_0xb11f('0x3b'));}break;case _0xb11f('0x3c'):if(_0x53eb9f[_0xb11f('0x21')]){var _0x53465d={'recipient':_0x2fc26a[_0xb11f('0x22')],'message':_0x2fc26a[_0xb11f('0xd')],'sender':_0x53eb9f[_0xb11f('0x3d')]||_0x53eb9f['phone'],'authorization':_0x53eb9f[_0xb11f('0x21')]};var _0x203783={'method':'POST','uri':_0xb11f('0x3e'),'body':_0x53465d,'json':!![]};rp(_0x203783)[_0xb11f('0x26')](function(_0x3664ed){var _0x4f13ec={'messageId':_0x3664ed['requestid']};if(!_0x53eb9f[_0xb11f('0x3a')]){_0x4f13ec[_0xb11f('0x3f')]=!![];}return _0x4677a1[_0xb11f('0x28')](_0x4f13ec);})[_0xb11f('0x1a')](function(_0x224860){logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),'connectel',util['inspect'](_0x224860,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),'connectel',_0xb11f('0x40'));}break;case _0xb11f('0x41'):if(_0x53eb9f[_0xb11f('0x2e')]&&_0x53eb9f[_0xb11f('0x2f')]){var _0x53465d={'messages':[{'source':_0xb11f('0x42'),'to':_0x2fc26a[_0xb11f('0x22')],'body':_0x2fc26a['body'],'from':_0x53eb9f['senderString']||_0x53eb9f[_0xb11f('0x22')]}]};var _0x1f2fc0=util[_0xb11f('0x43')](_0xb11f('0x44'),_0x53eb9f['username'],_0x53eb9f[_0xb11f('0x2f')]);var _0x203783={'method':_0xb11f('0x35'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x53465d,'headers':{'Authorization':util[_0xb11f('0x43')](_0xb11f('0x45'),new Buffer(_0x1f2fc0)[_0xb11f('0x46')]('base64'))},'json':!![]};rp(_0x203783)[_0xb11f('0x26')](function(_0x4e8b86){if(_0x4e8b86[_0xb11f('0x47')]>=0xc8&&_0x4e8b86['http_code']<=0xce){if(_0x4e8b86[_0xb11f('0x48')]&&_0x4e8b86[_0xb11f('0x48')]['queued_count']>0x0){var _0x4f9e60=_[_0xb11f('0x49')](_0x4e8b86[_0xb11f('0x48')][_0xb11f('0x4a')]);var _0x3898a9={'messageId':_0x4f9e60[_0xb11f('0x4b')]};if(!_0x53eb9f[_0xb11f('0x3a')]){_0x3898a9[_0xb11f('0x3f')]=!![];}return _0x4677a1[_0xb11f('0x28')](_0x3898a9);}else{logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),_0xb11f('0x4c'),util['inspect'](_0x4e8b86,{'showHidden':![],'depth':null}));}}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x4c'),util['inspect'](_0x4e8b86,{'showHidden':![],'depth':null}));}})['catch'](function(_0x576778){logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),_0xb11f('0x4c'),util[_0xb11f('0x2b')](_0x576778,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x4c'),_0xb11f('0x3b'));}break;case'plivo':if(_0x53eb9f[_0xb11f('0x4d')]&&_0x53eb9f[_0xb11f('0x21')]){var _0x53465d={'dst':_0x2fc26a[_0xb11f('0x22')],'text':_0x2fc26a[_0xb11f('0xd')],'src':_0x53eb9f[_0xb11f('0x3d')]||_0x53eb9f[_0xb11f('0x22')],'url':_0x53eb9f[_0xb11f('0x24')]+_0xb11f('0x4e')+_0x2fc26a['id']+'/status?token='+_0x53eb9f[_0xb11f('0x25')]};var _0x1f2fc0=util[_0xb11f('0x43')]('%s:%s',_0x53eb9f[_0xb11f('0x4d')],_0x53eb9f[_0xb11f('0x21')]);var _0x203783={'method':_0xb11f('0x35'),'uri':util[_0xb11f('0x43')]('https://api.plivo.com/v1/Account/%s/Message/',_0x53eb9f['authId']),'body':_0x53465d,'headers':{'Authorization':util[_0xb11f('0x43')](_0xb11f('0x45'),new Buffer(_0x1f2fc0)[_0xb11f('0x46')](_0xb11f('0x4f')))},'json':!![]};rp(_0x203783)[_0xb11f('0x26')](function(_0x3768e4){var _0x9aefc8={'messageId':_0x3768e4[_0xb11f('0x50')][0x0]};return _0x4677a1[_0xb11f('0x28')](_0x9aefc8);})[_0xb11f('0x1a')](function(_0x494c54){logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x51'),util['inspect'](_0x494c54,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),'afterCreate',_0xb11f('0x51'),_0xb11f('0x52'));}break;case'infobip':if(_0x53eb9f[_0xb11f('0x2e')]&&_0x53eb9f['password']){if(_0x53eb9f[_0xb11f('0x53')]){var _0x299599={'method':_0xb11f('0x35'),'uri':_0x53eb9f[_0xb11f('0x53')]+_0xb11f('0x54'),'body':{'username':_0x53eb9f[_0xb11f('0x2e')],'password':_0x53eb9f['password']},'json':!![]};return rp(_0x299599)[_0xb11f('0x26')](function(_0x51f017){var _0x6694fd={'method':_0xb11f('0x35'),'uri':_0x53eb9f[_0xb11f('0x53')]+_0xb11f('0x55'),'body':{'messages':[{'from':_0x53eb9f[_0xb11f('0x22')],'destinations':[{'to':_0x2fc26a['phone']}],'text':_0x2fc26a[_0xb11f('0xd')],'notifyUrl':_0x53eb9f[_0xb11f('0x24')]+'/api/sms/messages/'+_0x2fc26a['id']+_0xb11f('0x56')+_0x53eb9f[_0xb11f('0x25')],'notifyContentType':_0xb11f('0x57'),'callbackData':_0x53eb9f[_0xb11f('0x22')]+';'+_0x2fc26a[_0xb11f('0xd')]}]},'headers':{'Authorization':_0xb11f('0x58')+_0x51f017[_0xb11f('0x25')]},'json':!![]};return rp(_0x6694fd)['then'](function(_0x478599){if(_0x478599[_0xb11f('0x4a')]){var _0x38e270={'messageId':_0x478599['messages'][0x0]['messageId']};if(!_0x53eb9f[_0xb11f('0x3a')]){_0x38e270['read']=!![];}return _0x4677a1[_0xb11f('0x28')](_0x38e270);}else{return logger[_0xb11f('0x1b')](_0xb11f('0x29'),'afterCreate',_0xb11f('0x59'),util[_0xb11f('0x2b')](_0x478599,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x267c62){return logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x59'),util[_0xb11f('0x2b')](_0x267c62,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),'afterCreate',_0xb11f('0x59'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),'infobip',_0xb11f('0x3b'));}break;case _0xb11f('0x5a'):var _0x1c391c=require('crypto');if(_0x53eb9f[_0xb11f('0x5b')]){var _0x273d35={};_0x273d35[_0xb11f('0x5c')]=_0x53eb9f[_0xb11f('0x2e')];_0x273d35[_0xb11f('0x22')]=_0x2fc26a[_0xb11f('0x22')];_0x273d35[_0xb11f('0x31')]=_0x53eb9f[_0xb11f('0x22')];_0x273d35[_0xb11f('0x5d')]=_0x2fc26a[_0xb11f('0xd')];_0x273d35[_0xb11f('0x5e')]=+new Date();var _0x2c5001='';var _0x142799='';var _0x53baf0=Object['keys'](_0x273d35);_0x53baf0['sort']();for(var _0x16ceb2=0x0;_0x16ceb2<_0x53baf0['length'];_0x16ceb2++){if(_0x2c5001!=''){_0x2c5001+='&';}_0x2c5001+=_0x53baf0[_0x16ceb2]+'='+encodeURIComponent(_0x273d35[_0x53baf0[_0x16ceb2]]);_0x142799+=_0x273d35[_0x53baf0[_0x16ceb2]];}_0x142799+=_0x53eb9f[_0xb11f('0x5b')];_0x142799=_0x1c391c['createHash']('md5')[_0xb11f('0x28')](_0x142799)[_0xb11f('0x5f')](_0xb11f('0x60'));if(_0x2c5001!==''){_0x2c5001+='&';}_0x2c5001+=_0xb11f('0x61')+_0x142799;var _0xa307ef={'method':_0xb11f('0x62'),'uri':_0x53eb9f['baseUrl']+_0xb11f('0x63')+_0x2c5001,'json':!![]};return rp(_0xa307ef)[_0xb11f('0x26')](function(_0x2c4520){var _0x52d2ac=Object[_0xb11f('0x64')](_0x2c4520);if(_0x2c4520[_0x52d2ac[0x0]][_0xb11f('0x1b')]&&parseInt(_0x2c4520[_0x52d2ac[0x0]]['error'])===0x0){var _0x8d3011={'messageId':_0x2c4520[_0x52d2ac[0x0]][_0xb11f('0x65')]};if(!_0x53eb9f[_0xb11f('0x3a')]){_0x8d3011[_0xb11f('0x3f')]=!![];}return _0x4677a1[_0xb11f('0x28')](_0x8d3011);}else{return logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x5a'),util['inspect'](_0x2c4520[_0xb11f('0x1b')],{'showHidden':![],'depth':null}));}})[_0xb11f('0x1a')](function(_0x57a8b2){return logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),_0xb11f('0x5a'),util[_0xb11f('0x2b')](_0x57a8b2,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x5a'),'Missing\x20parameters:\x20apiKey');}break;case _0xb11f('0x66'):if(_0x53eb9f[_0xb11f('0x5b')]){var _0x32e287={'method':_0xb11f('0x35'),'uri':_0xb11f('0x67'),'headers':{'Authorization':_0x53eb9f['apiKey']},'body':{'content':_0x2fc26a[_0xb11f('0xd')],'to':[_0x2fc26a[_0xb11f('0x22')]],'from':_0x53eb9f[_0xb11f('0x22')],'binary':![],'clientMessageId':_0xb11f('0x68'),'charset':_0xb11f('0x69')},'json':!![]};rp(_0x32e287)[_0xb11f('0x26')](function(_0x26cfd6){if(!_0x26cfd6[_0xb11f('0x1b')]){var _0xcdd7d6={'messageId':_0x26cfd6['messages'][0x0][_0xb11f('0x6a')]};if(!_0x53eb9f['deliveryReport']){_0xcdd7d6[_0xb11f('0x3f')]=!![];}return _0x4677a1[_0xb11f('0x28')](_0xcdd7d6);}else{return logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x66'),util[_0xb11f('0x2b')](_0x26cfd6[_0xb11f('0x1b')],{'showHidden':![],'depth':null}));}})[_0xb11f('0x1a')](function(_0x342390){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),_0xb11f('0x66'),util[_0xb11f('0x2b')](_0x342390,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb11f('0x29'),'afterCreate','clickatell',_0xb11f('0x6b'));}break;case _0xb11f('0x6c'):if(_0x53eb9f[_0xb11f('0x2e')]&&_0x53eb9f[_0xb11f('0x2f')]){var _0x1f2fc0=util[_0xb11f('0x43')](_0xb11f('0x44'),_0x53eb9f[_0xb11f('0x2e')],_0x53eb9f[_0xb11f('0x2f')]);var _0x203783={'method':_0xb11f('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x53eb9f[_0xb11f('0x6d')]+'/messages','body':{'to':[_0x2fc26a[_0xb11f('0x22')]],'text':_0x2fc26a['body'],'from':_0x53eb9f[_0xb11f('0x22')],'applicationId':_0x53eb9f['applicationId']},'headers':{'Authorization':util[_0xb11f('0x43')](_0xb11f('0x45'),new Buffer(_0x1f2fc0)[_0xb11f('0x46')]('base64'))},'json':!![]};rp(_0x203783)[_0xb11f('0x26')](function(_0x3e1256){if(_0x3e1256['id']){var _0x3472c3={'messageId':_0x3e1256['id']};return _0x4677a1[_0xb11f('0x28')](_0x3472c3);}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),'afterCreate',_0xb11f('0x6c'),util[_0xb11f('0x2b')](_0x3e1256,{'showHidden':![],'depth':null}));}})[_0xb11f('0x1a')](function(_0x55cf35){logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x6c'),util[_0xb11f('0x2b')](_0x55cf35,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x6c'),_0xb11f('0x3b'));}break;case _0xb11f('0x6e'):if(_0x53eb9f['apiKey']){var _0x1b4879={};var _0xa307ef={'method':_0xb11f('0x35'),'uri':_0xb11f('0x6f'),'headers':{'Authorization':_0xb11f('0x70')+_0x53eb9f[_0xb11f('0x5b')],'Content-Type':_0xb11f('0x57')},'body':{'from':_0x53eb9f['phone'],'to':_0x2fc26a[_0xb11f('0x22')],'text':_0x2fc26a['body']},'json':!![]};return rp(_0xa307ef)[_0xb11f('0x26')](function(_0x1969c4){if(_0x1969c4[_0xb11f('0x71')]==0xca){_0x1b4879[_0xb11f('0x72')]=_0x1969c4;var _0x54c95f={'method':_0xb11f('0x35'),'uri':_0xb11f('0x73'),'headers':{'Authorization':_0xb11f('0x70')+_0x53eb9f[_0xb11f('0x5b')],'Content-Type':'application/json'},'body':{'refid':_0x1b4879[_0xb11f('0x72')][_0xb11f('0x74')]},'json':!![]};return rp(_0x54c95f)[_0xb11f('0x26')](function(_0x1e43b2){_0x1b4879['status']=_0x1e43b2;var _0x5bf4af={'messageId':_0x1b4879[_0xb11f('0x72')][_0xb11f('0x74')],'read':!![]};return _0x4677a1['update'](_0x5bf4af);});}else{return logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),_0xb11f('0x6e'),util[_0xb11f('0x2b')](_0x1969c4,{'showHidden':![],'depth':null}));}})[_0xb11f('0x1a')](function(_0x5df3c0){return logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x6e'),util['inspect'](_0x5df3c0,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x6e'),_0xb11f('0x75'));}break;}}})['finally'](function(){_0x10639d();});}else{_0x10639d();}}},'charset':_0xb11f('0x76'),'collate':_0xb11f('0x77')});}; \ No newline at end of file +var _0x28b2=['authId','Basic\x20%s','message_uuid','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','read','Missing\x20parameters:\x20base_url','crypto','apiKey','timestamp','keys','sort','length','md5','hex','/external/get/send.php?','csc','UTF-8','clickatell','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','path','rimraf','exports','define','SmsMessage','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','head','clickSend','plivo','%s:%s'];(function(_0x49b159,_0x5f0547){var _0x17084b=function(_0x53b250){while(--_0x53b250){_0x49b159['push'](_0x49b159['shift']());}};_0x17084b(++_0x5f0547);}(_0x28b2,0x110));var _0x228b=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x28b2[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x228b('0x0'));var util=require(_0x228b('0x1'));var logger=require('../../config/logger')(_0x228b('0x2'));var moment=require('moment');var BPromise=require(_0x228b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x228b('0x4'));var rimraf=require(_0x228b('0x5'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x228b('0x6')]=function(_0x23ab42,_0x4c1764){return _0x23ab42[_0x228b('0x7')](_0x228b('0x8'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x228b('0x9'),'fields':[_0x228b('0xa')],'type':_0x228b('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x359007,_0x1b2944,_0x105240){var _0x2a4864=_0x23ab42['models'];var _0x5d722a=_0x359007[_0x228b('0xc')]({'plain':!![]});if(_0x5d722a['direction']['toLowerCase']()==='in'||_0x5d722a[_0x228b('0xd')][_0x228b('0xe')]()==='out'&&!_0x5d722a[_0x228b('0xf')]&&!_[_0x228b('0x10')](_0x5d722a[_0x228b('0x11')])){_0x2a4864[_0x228b('0x12')][_0x228b('0x13')]({'where':{'id':_0x5d722a['SmsInteractionId']}})[_0x228b('0x14')](function(_0x974742){if(_0x974742){_0x974742[_0x228b('0x15')]({'lastMsgAt':_0x5d722a[_0x228b('0x16')],'lastMsgDirection':_0x5d722a[_0x228b('0xd')]['toLowerCase']()});}})['catch'](function(_0x3a4556){console[_0x228b('0x17')](_0x3a4556);});}if(_0x5d722a['direction']===_0x228b('0x18')&&!_0x5d722a[_0x228b('0xf')]){var _0x923393;_0x2a4864[_0x228b('0x19')][_0x228b('0x1a')]({'where':{'id':_0x5d722a[_0x228b('0x1b')]},'raw':!![]})[_0x228b('0x14')](function(_0x532b28){_0x923393=_0x532b28;if(_0x923393&&_0x923393[_0x228b('0x1c')]){switch(_0x923393[_0x228b('0x1c')]){case'twilio':var _0x148753=require(_0x228b('0x1d'));if(_0x923393[_0x228b('0x1e')]&&_0x923393[_0x228b('0x1f')]&&_0x923393[_0x228b('0x20')]){var _0x4cf8b8=new _0x148753(_0x923393[_0x228b('0x1e')],_0x923393[_0x228b('0x1f')]);_0x4cf8b8[_0x228b('0x21')][_0x228b('0x22')]({'body':_0x5d722a['body'],'to':_0x5d722a[_0x228b('0x20')],'from':_0x923393[_0x228b('0x20')],'statusCallback':_0x923393[_0x228b('0x23')]+_0x228b('0x24')+_0x5d722a['id']+_0x228b('0x25')+_0x923393[_0x228b('0x26')]})['then'](function(_0x493ee0){if(_0x493ee0['sid']){return _0x359007[_0x228b('0x15')]({'messageId':_0x493ee0[_0x228b('0x27')]});}})[_0x228b('0x28')](function(_0x286e16){logger[_0x228b('0x17')](_0x228b('0x29'),_0x228b('0x2a'),_0x228b('0x1d'),util['inspect'](_0x286e16,{'showHidden':![],'depth':null}));});}else{logger[_0x228b('0x17')](_0x228b('0x29'),'afterCreate','twilio',_0x228b('0x2b'));}break;case'skebby':var _0x54b1c8=_0x228b('0x2c');if(_0x923393[_0x228b('0x2d')]&&_0x923393[_0x228b('0x2e')]){var _0x4033ea={'recipient':[_0x5d722a[_0x228b('0x20')]],'message':_0x5d722a[_0x228b('0xa')],'message_type':_0x923393[_0x228b('0x2f')]};if(_0x923393['smsMethod']&&_0x923393[_0x228b('0x2f')]!=='SI'){_0x4033ea[_0x228b('0x30')]=_0x923393[_0x228b('0x20')];}var _0x43bb06={'url':_0x54b1c8+_0x228b('0x31')+_0x923393[_0x228b('0x2d')]+_0x228b('0x32')+_0x923393['password'],'method':_0x228b('0x33')};rp(_0x43bb06)[_0x228b('0x14')](function(_0x4b482b){var _0x19559a=_0x4b482b['split'](';');var _0x3ca9cb={'user_key':_0x19559a[0x0],'session_key':_0x19559a[0x1]};_0x43bb06={'url':_0x54b1c8+_0x228b('0x34'),'method':_0x228b('0x35'),'headers':{'user_key':_0x3ca9cb[_0x228b('0x36')],'Session_key':_0x3ca9cb[_0x228b('0x37')]},'json':!![],'body':_0x4033ea};return rp(_0x43bb06);})[_0x228b('0x14')](function(_0x50ace6){if(_0x50ace6[_0x228b('0x38')]>=0x1){var _0x54ae84={'messageId':_0x50ace6[_0x228b('0x39')]};if(_0x923393['smsMethod']!=='GP'||!_0x923393[_0x228b('0x3a')]){_0x54ae84['read']=!![];}return _0x359007['update'](_0x54ae84);}else{return logger['error'](_0x228b('0x29'),_0x228b('0x2a'),_0x228b('0x3b'),util[_0x228b('0x3c')](_0x50ace6,{'showHidden':![],'depth':null}));}})['catch'](function(_0x8aa190){return logger[_0x228b('0x17')](_0x228b('0x29'),_0x228b('0x2a'),_0x228b('0x3b'),util[_0x228b('0x3c')](_0x8aa190,{'showHidden':![],'depth':null}));});}else{logger[_0x228b('0x17')](_0x228b('0x29'),_0x228b('0x2a'),_0x228b('0x3b'),_0x228b('0x3d'));}break;case _0x228b('0x3e'):if(_0x923393['authToken']){var _0x57c78b={'recipient':_0x5d722a[_0x228b('0x20')],'message':_0x5d722a[_0x228b('0xa')],'sender':_0x923393[_0x228b('0x3f')]||_0x923393[_0x228b('0x20')],'authorization':_0x923393['authToken']};var _0x1b2944={'method':'POST','uri':_0x228b('0x40'),'body':_0x57c78b,'json':!![]};rp(_0x1b2944)[_0x228b('0x14')](function(_0x5af1a1){var _0x5510c6={'messageId':_0x5af1a1[_0x228b('0x41')]};if(!_0x923393['deliveryReport']){_0x5510c6['read']=!![];}return _0x359007[_0x228b('0x15')](_0x5510c6);})[_0x228b('0x28')](function(_0x3d96f8){logger[_0x228b('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x228b('0x2a'),'connectel',util[_0x228b('0x3c')](_0x3d96f8,{'showHidden':![],'depth':null}));});}else{logger[_0x228b('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x228b('0x3e'),_0x228b('0x42'));}break;case'clicksend':if(_0x923393[_0x228b('0x2d')]&&_0x923393['password']){var _0x57c78b={'messages':[{'source':_0x228b('0x43'),'to':_0x5d722a[_0x228b('0x20')],'body':_0x5d722a[_0x228b('0xa')],'from':_0x923393[_0x228b('0x3f')]||_0x923393['phone']}]};var _0x35f18d=util[_0x228b('0x44')]('%s:%s',_0x923393[_0x228b('0x2d')],_0x923393[_0x228b('0x2e')]);var _0x1b2944={'method':_0x228b('0x35'),'uri':_0x228b('0x45'),'body':_0x57c78b,'headers':{'Authorization':util[_0x228b('0x44')]('Basic\x20%s',new Buffer(_0x35f18d)[_0x228b('0x46')](_0x228b('0x47')))},'json':!![]};rp(_0x1b2944)[_0x228b('0x14')](function(_0x5d2de5){if(_0x5d2de5['http_code']>=0xc8&&_0x5d2de5[_0x228b('0x48')]<=0xce){if(_0x5d2de5[_0x228b('0x49')]&&_0x5d2de5[_0x228b('0x49')][_0x228b('0x4a')]>0x0){var _0x5a30d4=_[_0x228b('0x4b')](_0x5d2de5[_0x228b('0x49')][_0x228b('0x21')]);var _0x23116e={'messageId':_0x5a30d4['message_id']};if(!_0x923393[_0x228b('0x3a')]){_0x23116e['read']=!![];}return _0x359007[_0x228b('0x15')](_0x23116e);}else{logger[_0x228b('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x228b('0x2a'),'clickSend',util[_0x228b('0x3c')](_0x5d2de5,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x228b('0x29'),_0x228b('0x2a'),_0x228b('0x4c'),util[_0x228b('0x3c')](_0x5d2de5,{'showHidden':![],'depth':null}));}})[_0x228b('0x28')](function(_0x3a31af){logger[_0x228b('0x17')](_0x228b('0x29'),'afterCreate',_0x228b('0x4c'),util['inspect'](_0x3a31af,{'showHidden':![],'depth':null}));});}else{logger[_0x228b('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x228b('0x2a'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0x228b('0x4d'):if(_0x923393['authId']&&_0x923393[_0x228b('0x1f')]){var _0x57c78b={'dst':_0x5d722a[_0x228b('0x20')],'text':_0x5d722a[_0x228b('0xa')],'src':_0x923393[_0x228b('0x3f')]||_0x923393[_0x228b('0x20')],'url':_0x923393[_0x228b('0x23')]+_0x228b('0x24')+_0x5d722a['id']+_0x228b('0x25')+_0x923393[_0x228b('0x26')]};var _0x35f18d=util['format'](_0x228b('0x4e'),_0x923393[_0x228b('0x4f')],_0x923393[_0x228b('0x1f')]);var _0x1b2944={'method':'POST','uri':util[_0x228b('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x923393[_0x228b('0x4f')]),'body':_0x57c78b,'headers':{'Authorization':util[_0x228b('0x44')](_0x228b('0x50'),new Buffer(_0x35f18d)[_0x228b('0x46')]('base64'))},'json':!![]};rp(_0x1b2944)[_0x228b('0x14')](function(_0x27926e){var _0x3faf25={'messageId':_0x27926e[_0x228b('0x51')][0x0]};return _0x359007[_0x228b('0x15')](_0x3faf25);})[_0x228b('0x28')](function(_0x39f9b6){logger[_0x228b('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x228b('0x2a'),'plivo',util[_0x228b('0x3c')](_0x39f9b6,{'showHidden':![],'depth':null}));});}else{logger[_0x228b('0x17')](_0x228b('0x29'),'afterCreate',_0x228b('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x228b('0x52'):if(_0x923393[_0x228b('0x2d')]&&_0x923393[_0x228b('0x2e')]){if(_0x923393[_0x228b('0x53')]){var _0x42ba98={'method':_0x228b('0x35'),'uri':_0x923393[_0x228b('0x53')]+'/auth/1/session','body':{'username':_0x923393[_0x228b('0x2d')],'password':_0x923393[_0x228b('0x2e')]},'json':!![]};return rp(_0x42ba98)[_0x228b('0x14')](function(_0x24d43c){var _0x2a9ef0={'method':_0x228b('0x35'),'uri':_0x923393['baseUrl']+_0x228b('0x54'),'body':{'messages':[{'from':_0x923393[_0x228b('0x20')],'destinations':[{'to':_0x5d722a[_0x228b('0x20')]}],'text':_0x5d722a[_0x228b('0xa')],'notifyUrl':_0x923393[_0x228b('0x23')]+_0x228b('0x24')+_0x5d722a['id']+_0x228b('0x25')+_0x923393['token'],'notifyContentType':_0x228b('0x55'),'callbackData':_0x923393[_0x228b('0x20')]+';'+_0x5d722a[_0x228b('0xa')]}]},'headers':{'Authorization':_0x228b('0x56')+_0x24d43c[_0x228b('0x26')]},'json':!![]};return rp(_0x2a9ef0)[_0x228b('0x14')](function(_0x5e7f0d){if(_0x5e7f0d[_0x228b('0x21')]){var _0x439a2a={'messageId':_0x5e7f0d[_0x228b('0x21')][0x0]['messageId']};if(!_0x923393[_0x228b('0x3a')]){_0x439a2a[_0x228b('0x57')]=!![];}return _0x359007[_0x228b('0x15')](_0x439a2a);}else{return logger[_0x228b('0x17')](_0x228b('0x29'),_0x228b('0x2a'),'infobip',util[_0x228b('0x3c')](_0x5e7f0d,{'showHidden':![],'depth':null}));}});})[_0x228b('0x28')](function(_0x3dcee6){return logger[_0x228b('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x228b('0x2a'),_0x228b('0x52'),util['inspect'](_0x3dcee6,{'showHidden':![],'depth':null}));});}else{logger[_0x228b('0x17')](_0x228b('0x29'),_0x228b('0x2a'),_0x228b('0x52'),_0x228b('0x58'));}}else{logger[_0x228b('0x17')](_0x228b('0x29'),_0x228b('0x2a'),_0x228b('0x52'),_0x228b('0x3d'));}break;case'csc':var _0x31b85e=require(_0x228b('0x59'));if(_0x923393[_0x228b('0x5a')]){var _0x5bc9d4={};_0x5bc9d4['login']=_0x923393[_0x228b('0x2d')];_0x5bc9d4[_0x228b('0x20')]=_0x5d722a[_0x228b('0x20')];_0x5bc9d4[_0x228b('0x30')]=_0x923393[_0x228b('0x20')];_0x5bc9d4['text']=_0x5d722a[_0x228b('0xa')];_0x5bc9d4[_0x228b('0x5b')]=+new Date();var _0x519ecf='';var _0x19a18e='';var _0x3b816b=Object[_0x228b('0x5c')](_0x5bc9d4);_0x3b816b[_0x228b('0x5d')]();for(var _0x27c4b7=0x0;_0x27c4b7<_0x3b816b[_0x228b('0x5e')];_0x27c4b7++){if(_0x519ecf!=''){_0x519ecf+='&';}_0x519ecf+=_0x3b816b[_0x27c4b7]+'='+encodeURIComponent(_0x5bc9d4[_0x3b816b[_0x27c4b7]]);_0x19a18e+=_0x5bc9d4[_0x3b816b[_0x27c4b7]];}_0x19a18e+=_0x923393[_0x228b('0x5a')];_0x19a18e=_0x31b85e['createHash'](_0x228b('0x5f'))[_0x228b('0x15')](_0x19a18e)['digest'](_0x228b('0x60'));if(_0x519ecf!==''){_0x519ecf+='&';}_0x519ecf+='signature='+_0x19a18e;var _0x43bb06={'method':_0x228b('0x33'),'uri':_0x923393[_0x228b('0x53')]+_0x228b('0x61')+_0x519ecf,'json':!![]};return rp(_0x43bb06)['then'](function(_0x468a79){var _0x539ef9=Object[_0x228b('0x5c')](_0x468a79);if(_0x468a79[_0x539ef9[0x0]][_0x228b('0x17')]&&parseInt(_0x468a79[_0x539ef9[0x0]][_0x228b('0x17')])===0x0){var _0x2d27cd={'messageId':_0x468a79[_0x539ef9[0x0]]['id_sms']};if(!_0x923393[_0x228b('0x3a')]){_0x2d27cd['read']=!![];}return _0x359007[_0x228b('0x15')](_0x2d27cd);}else{return logger['error'](_0x228b('0x29'),_0x228b('0x2a'),_0x228b('0x62'),util[_0x228b('0x3c')](_0x468a79[_0x228b('0x17')],{'showHidden':![],'depth':null}));}})[_0x228b('0x28')](function(_0x304250){return logger[_0x228b('0x17')](_0x228b('0x29'),'afterCreate','csc',util[_0x228b('0x3c')](_0x304250,{'showHidden':![],'depth':null}));});}else{logger[_0x228b('0x17')](_0x228b('0x29'),'afterCreate','csc','Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x923393[_0x228b('0x5a')]){var _0x219c2c={'method':_0x228b('0x35'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x923393[_0x228b('0x5a')]},'body':{'content':_0x5d722a[_0x228b('0xa')],'to':[_0x5d722a['phone']],'from':_0x923393[_0x228b('0x20')],'binary':![],'clientMessageId':'uuid','charset':_0x228b('0x63')},'json':!![]};rp(_0x219c2c)[_0x228b('0x14')](function(_0x56cb42){if(!_0x56cb42['error']){var _0x1f169a={'messageId':_0x56cb42[_0x228b('0x21')][0x0]['apiMessageId']};if(!_0x923393[_0x228b('0x3a')]){_0x1f169a[_0x228b('0x57')]=!![];}return _0x359007[_0x228b('0x15')](_0x1f169a);}else{return logger[_0x228b('0x17')](_0x228b('0x29'),_0x228b('0x2a'),_0x228b('0x64'),util[_0x228b('0x3c')](_0x56cb42[_0x228b('0x17')],{'showHidden':![],'depth':null}));}})[_0x228b('0x28')](function(_0x271dc1){return logger[_0x228b('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x228b('0x64'),util['inspect'](_0x271dc1,{'showHidden':![],'depth':null}));});}else{logger[_0x228b('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x228b('0x2a'),'clickatell',_0x228b('0x65'));}break;case'bandwidth':if(_0x923393[_0x228b('0x2d')]&&_0x923393[_0x228b('0x2e')]){var _0x35f18d=util[_0x228b('0x44')](_0x228b('0x4e'),_0x923393[_0x228b('0x2d')],_0x923393['password']);var _0x1b2944={'method':_0x228b('0x35'),'uri':_0x228b('0x66')+_0x923393[_0x228b('0x67')]+_0x228b('0x68'),'body':{'to':[_0x5d722a[_0x228b('0x20')]],'text':_0x5d722a[_0x228b('0xa')],'from':_0x923393['phone'],'applicationId':_0x923393[_0x228b('0x69')]},'headers':{'Authorization':util['format'](_0x228b('0x50'),new Buffer(_0x35f18d)[_0x228b('0x46')](_0x228b('0x47')))},'json':!![]};rp(_0x1b2944)[_0x228b('0x14')](function(_0x380b5e){if(_0x380b5e['id']){var _0x3a3242={'messageId':_0x380b5e['id']};return _0x359007['update'](_0x3a3242);}else{logger[_0x228b('0x17')](_0x228b('0x29'),_0x228b('0x2a'),_0x228b('0x6a'),util['inspect'](_0x380b5e,{'showHidden':![],'depth':null}));}})['catch'](function(_0x371487){logger['error'](_0x228b('0x29'),_0x228b('0x2a'),_0x228b('0x6a'),util['inspect'](_0x371487,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x228b('0x29'),_0x228b('0x2a'),_0x228b('0x6a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x228b('0x6b'):if(_0x923393[_0x228b('0x5a')]){var _0x83264f={};var _0x43bb06={'method':_0x228b('0x35'),'uri':_0x228b('0x6c'),'headers':{'Authorization':'Bearer\x20'+_0x923393[_0x228b('0x5a')],'Content-Type':_0x228b('0x55')},'body':{'from':_0x923393[_0x228b('0x20')],'to':_0x5d722a['phone'],'text':_0x5d722a['body']},'json':!![]};return rp(_0x43bb06)[_0x228b('0x14')](function(_0x1ee032){if(_0x1ee032['code']==0xca){_0x83264f[_0x228b('0x6d')]=_0x1ee032;var _0x2d61b9={'method':'POST','uri':_0x228b('0x6e'),'headers':{'Authorization':_0x228b('0x6f')+_0x923393['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x83264f[_0x228b('0x6d')][_0x228b('0x70')]},'json':!![]};return rp(_0x2d61b9)[_0x228b('0x14')](function(_0x240eba){_0x83264f['status']=_0x240eba;var _0x5a6186={'messageId':_0x83264f[_0x228b('0x6d')][_0x228b('0x70')],'read':!![]};return _0x359007[_0x228b('0x15')](_0x5a6186);});}else{return logger['error'](_0x228b('0x29'),_0x228b('0x2a'),'intelepeer',util[_0x228b('0x3c')](_0x1ee032,{'showHidden':![],'depth':null}));}})[_0x228b('0x28')](function(_0x590ae4){return logger[_0x228b('0x17')](_0x228b('0x29'),_0x228b('0x2a'),_0x228b('0x6b'),util[_0x228b('0x3c')](_0x590ae4,{'showHidden':![],'depth':null}));});}else{return logger[_0x228b('0x17')](_0x228b('0x29'),'afterCreate',_0x228b('0x6b'),_0x228b('0x71'));}break;}}})[_0x228b('0x72')](function(){_0x105240();});}else{_0x105240();}}},'charset':_0x228b('0x73'),'collate':_0x228b('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 6ce8345..0307e25 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 _0xffc9=['request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateSmsMessage','create','body','options','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','socket.io-emitter','./smsMessage.socket'];(function(_0x1d54ed,_0x30feb1){var _0x5a287c=function(_0x1009b7){while(--_0x1009b7){_0x1d54ed['push'](_0x1d54ed['shift']());}};_0x5a287c(++_0x30feb1);}(_0xffc9,0xb1));var _0x9ffc=function(_0xa91f01,_0x169324){_0xa91f01=_0xa91f01-0x0;var _0x5d9610=_0xffc9[_0xa91f01];return _0x5d9610;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ffc('0x0'));var BPromise=require(_0x9ffc('0x1'));var rs=require(_0x9ffc('0x2'));var fs=require('fs');var Redis=require(_0x9ffc('0x3'));var db=require(_0x9ffc('0x4'))['db'];var utils=require(_0x9ffc('0x5'));var logger=require('../../config/logger')(_0x9ffc('0x6'));var config=require(_0x9ffc('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x9ffc('0x8')]=_[_0x9ffc('0x9')](config[_0x9ffc('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9ffc('0xa'))(new Redis(config['redis']));require(_0x9ffc('0xb'))['register'](socket);function respondWithRpcPromise(_0x100ed4,_0x5a5210,_0x2f7ec6){return new BPromise(function(_0x381430,_0x156f0a){return client[_0x9ffc('0xc')](_0x100ed4,_0x2f7ec6)['then'](function(_0x20ed01){logger[_0x9ffc('0xd')](_0x9ffc('0xe'),_0x5a5210,_0x9ffc('0xf'));logger[_0x9ffc('0x10')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5a5210,'request\x20sent',JSON['stringify'](_0x20ed01));if(_0x20ed01['error']){if(_0x20ed01[_0x9ffc('0x11')][_0x9ffc('0x12')]===0x1f4){logger['error'](_0x9ffc('0xe'),_0x5a5210,_0x20ed01[_0x9ffc('0x11')][_0x9ffc('0x13')]);return _0x156f0a(_0x20ed01[_0x9ffc('0x11')]['message']);}logger[_0x9ffc('0x11')](_0x9ffc('0xe'),_0x5a5210,_0x20ed01[_0x9ffc('0x11')][_0x9ffc('0x13')]);return _0x381430(_0x20ed01[_0x9ffc('0x11')][_0x9ffc('0x13')]);}else{logger[_0x9ffc('0xd')](_0x9ffc('0xe'),_0x5a5210,_0x9ffc('0xf'));_0x381430(_0x20ed01[_0x9ffc('0x14')]['message']);}})[_0x9ffc('0x15')](function(_0x54fa4c){logger['error'](_0x9ffc('0xe'),_0x5a5210,_0x54fa4c);_0x156f0a(_0x54fa4c);});});}exports[_0x9ffc('0x16')]=function(_0x2f7479){var _0x284c8c=this;return new Promise(function(_0x1d37b6,_0x1d777d){return db['SmsMessage'][_0x9ffc('0x17')](_0x2f7479[_0x9ffc('0x18')],{'raw':_0x2f7479[_0x9ffc('0x19')]?_0x2f7479[_0x9ffc('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x9ffc('0x1a')](function(_0x12949c){logger[_0x9ffc('0xd')](_0x9ffc('0x16'),_0x2f7479);logger[_0x9ffc('0x10')](_0x9ffc('0x16'),_0x2f7479,JSON['stringify'](_0x12949c));_0x1d37b6(_0x12949c);})['catch'](function(_0x277d21){logger[_0x9ffc('0x11')](_0x9ffc('0x16'),_0x277d21['message'],_0x2f7479);_0x1d777d(_0x284c8c[_0x9ffc('0x11')](0x1f4,_0x277d21[_0x9ffc('0x13')]));});});}; \ No newline at end of file +var _0x9f66=['request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','register'];(function(_0x1050f2,_0x5d7a5f){var _0x9d3d54=function(_0xdc5bcc){while(--_0xdc5bcc){_0x1050f2['push'](_0x1050f2['shift']());}};_0x9d3d54(++_0x5d7a5f);}(_0x9f66,0xa8));var _0x69f6=function(_0x2feed3,_0x26dbe9){_0x2feed3=_0x2feed3-0x0;var _0xa0e7e0=_0x9f66[_0x2feed3];return _0xa0e7e0;};'use strict';var _=require(_0x69f6('0x0'));var util=require('util');var moment=require(_0x69f6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69f6('0x2'));var db=require(_0x69f6('0x3'))['db'];var utils=require(_0x69f6('0x4'));var logger=require('../../config/logger')(_0x69f6('0x5'));var config=require(_0x69f6('0x6'));var jayson=require(_0x69f6('0x7'));var client=jayson['client'][_0x69f6('0x8')]({'port':0x232a});config['redis']=_[_0x69f6('0x9')](config[_0x69f6('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x69f6('0xb')](socket);function respondWithRpcPromise(_0x5bc2c7,_0x299efc,_0x24286f){return new BPromise(function(_0xb4c936,_0x3fcd59){return client[_0x69f6('0xc')](_0x5bc2c7,_0x24286f)[_0x69f6('0xd')](function(_0x4e7e14){logger[_0x69f6('0xe')](_0x69f6('0xf'),_0x299efc,_0x69f6('0x10'));logger[_0x69f6('0x11')](_0x69f6('0x12'),_0x299efc,_0x69f6('0x10'),JSON[_0x69f6('0x13')](_0x4e7e14));if(_0x4e7e14[_0x69f6('0x14')]){if(_0x4e7e14[_0x69f6('0x14')][_0x69f6('0x15')]===0x1f4){logger['error'](_0x69f6('0xf'),_0x299efc,_0x4e7e14['error'][_0x69f6('0x16')]);return _0x3fcd59(_0x4e7e14[_0x69f6('0x14')]['message']);}logger['error'](_0x69f6('0xf'),_0x299efc,_0x4e7e14[_0x69f6('0x14')]['message']);return _0xb4c936(_0x4e7e14[_0x69f6('0x14')]['message']);}else{logger['info'](_0x69f6('0xf'),_0x299efc,_0x69f6('0x10'));_0xb4c936(_0x4e7e14['result']['message']);}})[_0x69f6('0x17')](function(_0x321d45){logger[_0x69f6('0x14')](_0x69f6('0xf'),_0x299efc,_0x321d45);_0x3fcd59(_0x321d45);});});}exports[_0x69f6('0x18')]=function(_0x118fd5){var _0x5705fe=this;return new Promise(function(_0x40d595,_0x51baad){return db[_0x69f6('0x19')][_0x69f6('0x1a')](_0x118fd5[_0x69f6('0x1b')],{'raw':_0x118fd5[_0x69f6('0x1c')]?_0x118fd5[_0x69f6('0x1c')][_0x69f6('0x1d')]===undefined?!![]:![]:!![]})[_0x69f6('0xd')](function(_0x1ad724){logger[_0x69f6('0xe')](_0x69f6('0x18'),_0x118fd5);logger[_0x69f6('0x11')](_0x69f6('0x18'),_0x118fd5,JSON[_0x69f6('0x13')](_0x1ad724));_0x40d595(_0x1ad724);})['catch'](function(_0x2a1f94){logger[_0x69f6('0x14')](_0x69f6('0x18'),_0x2a1f94['message'],_0x118fd5);_0x51baad(_0x5705fe[_0x69f6('0x14')](0x1f4,_0x2a1f94[_0x69f6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index e1b82f4..8067448 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 _0x518f=['length','./smsMessage.events','save','remove','update','emit','register'];(function(_0x14f6af,_0x579b70){var _0x21f19f=function(_0x2df1c2){while(--_0x2df1c2){_0x14f6af['push'](_0x14f6af['shift']());}};_0x21f19f(++_0x579b70);}(_0x518f,0x119));var _0xf518=function(_0x328ac9,_0x2f7225){_0x328ac9=_0x328ac9-0x0;var _0x2b3a0a=_0x518f[_0x328ac9];return _0x2b3a0a;};'use strict';var SmsMessageEvents=require(_0xf518('0x0'));var events=[_0xf518('0x1'),_0xf518('0x2'),_0xf518('0x3')];function createListener(_0x574d4a,_0x534e43){return function(_0x20ead5){_0x534e43[_0xf518('0x4')](_0x574d4a,_0x20ead5);};}function removeListener(_0xe041a2,_0x3ad45b){return function(){SmsMessageEvents['removeListener'](_0xe041a2,_0x3ad45b);};}exports[_0xf518('0x5')]=function(_0x2e3dea){for(var _0x17d3b2=0x0,_0x2362b2=events[_0xf518('0x6')];_0x17d3b2<_0x2362b2;_0x17d3b2++){var _0x49eb74=events[_0x17d3b2];var _0x5e935d=createListener('smsMessage:'+_0x49eb74,_0x2e3dea);SmsMessageEvents['on'](_0x49eb74,_0x5e935d);}}; \ No newline at end of file +var _0x4112=['length','./smsMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x46b8d9,_0x431db3){var _0x383b8f=function(_0x22f7f0){while(--_0x22f7f0){_0x46b8d9['push'](_0x46b8d9['shift']());}};_0x383b8f(++_0x431db3);}(_0x4112,0x179));var _0x2411=function(_0x46f7fe,_0x40ecd3){_0x46f7fe=_0x46f7fe-0x0;var _0x276f00=_0x4112[_0x46f7fe];return _0x276f00;};'use strict';var SmsMessageEvents=require(_0x2411('0x0'));var events=[_0x2411('0x1'),_0x2411('0x2'),_0x2411('0x3')];function createListener(_0x1d666b,_0x589ef9){return function(_0x5b1096){_0x589ef9[_0x2411('0x4')](_0x1d666b,_0x5b1096);};}function removeListener(_0x374fc6,_0x5cd332){return function(){SmsMessageEvents[_0x2411('0x5')](_0x374fc6,_0x5cd332);};}exports[_0x2411('0x6')]=function(_0x203dce){for(var _0x4bae25=0x0,_0x10e582=events[_0x2411('0x7')];_0x4bae25<_0x10e582;_0x4bae25++){var _0x1cad8e=events[_0x4bae25];var _0x523ba7=createListener('smsMessage:'+_0x1cad8e,_0x203dce);SmsMessageEvents['on'](_0x1cad8e,_0x523ba7);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index d33a283..ab88e6d 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 _0x7ebb=['destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','/:id','update','delete'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7ebb,0x161));var _0xb7eb=function(_0x5d1566,_0x3fed4b){_0x5d1566=_0x5d1566-0x0;var _0x3441a2=_0x7ebb[_0x5d1566];return _0x3441a2;};'use strict';var multer=require(_0xb7eb('0x0'));var util=require(_0xb7eb('0x1'));var path=require(_0xb7eb('0x2'));var timeout=require(_0xb7eb('0x3'));var express=require(_0xb7eb('0x4'));var router=express[_0xb7eb('0x5')]();var auth=require(_0xb7eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb7eb('0x7'));var controller=require(_0xb7eb('0x8'));router[_0xb7eb('0x9')]('/',auth[_0xb7eb('0xa')](),controller[_0xb7eb('0xb')]);router[_0xb7eb('0x9')](_0xb7eb('0xc'),auth[_0xb7eb('0xa')](),controller[_0xb7eb('0xd')]);router[_0xb7eb('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb7eb('0xe')]);router[_0xb7eb('0x9')](_0xb7eb('0xf'),auth[_0xb7eb('0xa')](),controller['getMembers']);router[_0xb7eb('0x9')](_0xb7eb('0x10'),auth['isAuthenticated'](),controller[_0xb7eb('0x11')]);router[_0xb7eb('0x9')](_0xb7eb('0x12'),auth[_0xb7eb('0xa')](),controller[_0xb7eb('0x13')]);router[_0xb7eb('0x14')]('/',auth[_0xb7eb('0xa')](),controller['create']);router[_0xb7eb('0x14')](_0xb7eb('0x10'),auth[_0xb7eb('0xa')](),controller['addTeams']);router[_0xb7eb('0x14')](_0xb7eb('0x12'),auth[_0xb7eb('0xa')](),controller[_0xb7eb('0x15')]);router['put'](_0xb7eb('0x16'),auth['isAuthenticated'](),controller[_0xb7eb('0x17')]);router[_0xb7eb('0x18')](_0xb7eb('0x16'),auth['isAuthenticated'](),controller[_0xb7eb('0x19')]);router[_0xb7eb('0x18')](_0xb7eb('0x10'),auth[_0xb7eb('0xa')](),controller['removeTeams']);router[_0xb7eb('0x18')]('/:id/users',auth[_0xb7eb('0xa')](),controller[_0xb7eb('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x80c3=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','describe','/:id','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','exports','multer'];(function(_0x57417d,_0x586507){var _0x524653=function(_0x517ae2){while(--_0x517ae2){_0x57417d['push'](_0x57417d['shift']());}};_0x524653(++_0x586507);}(_0x80c3,0x18f));var _0x380c=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x80c3[_0x16629d];return _0x56ccee;};'use strict';var multer=require(_0x380c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x380c('0x1'));var express=require('express');var router=express[_0x380c('0x2')]();var auth=require(_0x380c('0x3'));var interaction=require(_0x380c('0x4'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router['get']('/',auth[_0x380c('0x5')](),controller['index']);router['get'](_0x380c('0x6'),auth[_0x380c('0x5')](),controller[_0x380c('0x7')]);router['get'](_0x380c('0x8'),auth[_0x380c('0x5')](),controller['show']);router[_0x380c('0x9')](_0x380c('0xa'),auth['isAuthenticated'](),controller[_0x380c('0xb')]);router[_0x380c('0x9')](_0x380c('0xc'),auth['isAuthenticated'](),controller[_0x380c('0xd')]);router[_0x380c('0x9')](_0x380c('0xe'),auth[_0x380c('0x5')](),controller[_0x380c('0xf')]);router[_0x380c('0x10')]('/',auth[_0x380c('0x5')](),controller[_0x380c('0x11')]);router[_0x380c('0x10')](_0x380c('0xc'),auth['isAuthenticated'](),controller[_0x380c('0x12')]);router[_0x380c('0x10')]('/:id/users',auth[_0x380c('0x5')](),controller[_0x380c('0x13')]);router[_0x380c('0x14')](_0x380c('0x8'),auth[_0x380c('0x5')](),controller[_0x380c('0x15')]);router[_0x380c('0x16')](_0x380c('0x8'),auth[_0x380c('0x5')](),controller['destroy']);router[_0x380c('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x380c('0x17')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x380c('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 246c033..8feeae8 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 _0x6ffa=['sequelize','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0xd5419,_0x199c4e){var _0x59ad9f=function(_0x216c75){while(--_0x216c75){_0xd5419['push'](_0xd5419['shift']());}};_0x59ad9f(++_0x199c4e);}(_0x6ffa,0x173));var _0xa6ff=function(_0x647f18,_0x3f82d3){_0x647f18=_0x647f18-0x0;var _0x36bf54=_0x6ffa[_0x647f18];return _0x36bf54;};'use strict';var Sequelize=require(_0xa6ff('0x0'));module['exports']={'name':{'type':Sequelize[_0xa6ff('0x1')],'unique':_0xa6ff('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa6ff('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa6ff('0x3')](_0xa6ff('0x4'),_0xa6ff('0x5'),_0xa6ff('0x6'))}}; \ No newline at end of file +var _0x2768=['beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x50ad37,_0xf13c72){var _0x19cc96=function(_0x1d4ffa){while(--_0x1d4ffa){_0x50ad37['push'](_0x50ad37['shift']());}};_0x19cc96(++_0xf13c72);}(_0x2768,0x13f));var _0x8276=function(_0x46a015,_0x56d0db){_0x46a015=_0x46a015-0x0;var _0x57b91f=_0x2768[_0x46a015];return _0x57b91f;};'use strict';var Sequelize=require(_0x8276('0x0'));module[_0x8276('0x1')]={'name':{'type':Sequelize[_0x8276('0x2')],'unique':_0x8276('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8276('0x2')]},'timeout':{'type':Sequelize[_0x8276('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x8276('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c02f6f6..aef9c01 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(_0x50b13e,_0x5415bb){var _0x1ac476=function(_0xbab6d){while(--_0xbab6d){_0x50b13e['push'](_0x50b13e['shift']());}};_0x1ac476(++_0x5415bb);}(_0x038b,0x114));var _0xb038=function(_0x550b5b,_0x22f75b){_0x550b5b=_0x550b5b-0x0;var _0x4e84e4=_0x038b[_0x550b5b];return _0x4e84e4;};'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 _0x425d=['SIP','getTeams','addTeams','body','ids','Team','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','SmsQueues','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','filters','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','SmsQueue','count','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','order','pick','SmsQueueId','User','UserId','agent','smsPause','updatedAt','format','%s/%s'];(function(_0x7f8559,_0x412252){var _0x4c70c5=function(_0x3144c3){while(--_0x3144c3){_0x7f8559['push'](_0x7f8559['shift']());}};_0x4c70c5(++_0x412252);}(_0x425d,0x1e0));var _0xd425=function(_0x221888,_0x1d2891){_0x221888=_0x221888-0x0;var _0x18bc6c=_0x425d[_0x221888];return _0x18bc6c;};'use strict';var pdf=require(_0xd425('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd425('0x1'));var zipdir=require(_0xd425('0x2'));var jsonpatch=require(_0xd425('0x3'));var rp=require(_0xd425('0x4'));var moment=require(_0xd425('0x5'));var BPromise=require(_0xd425('0x6'));var Mustache=require(_0xd425('0x7'));var util=require('util');var path=require(_0xd425('0x8'));var sox=require(_0xd425('0x9'));var csv=require(_0xd425('0xa'));var ejs=require(_0xd425('0xb'));var fs=require('fs');var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0xa'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];config[_0xd425('0x1d')]=_[_0xd425('0x1e')](config[_0xd425('0x1d')],{'host':_0xd425('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd425('0x1d')]));require(_0xd425('0x20'))[_0xd425('0x21')](socket);function respondWithStatusCode(_0x5d3d60,_0x309263){_0x309263=_0x309263||0xcc;return function(_0x2e2e4e){if(_0x2e2e4e){return _0x5d3d60[_0xd425('0x22')](_0x309263);}return _0x5d3d60[_0xd425('0x23')](_0x309263)[_0xd425('0x24')]();};}function respondWithResult(_0x538a0a,_0x278626){_0x278626=_0x278626||0xc8;return function(_0x471267){if(_0x471267){return _0x538a0a[_0xd425('0x23')](_0x278626)[_0xd425('0x25')](_0x471267);}};}function respondWithFilteredResult(_0x5d6585,_0x19d7d4){return function(_0x434d97){if(_0x434d97){var _0x467a6c=_0x434d97['count'],_0x1155bc=_0x19d7d4['offset'],_0x4e88fa=_0x19d7d4[_0xd425('0x26')]+_0x19d7d4[_0xd425('0x27')],_0x58a0c1;if(_0x4e88fa>=_0x467a6c){_0x4e88fa=_0x467a6c;_0x58a0c1=0xc8;}else{_0x58a0c1=0xce;}_0x5d6585[_0xd425('0x23')](_0x58a0c1);return _0x5d6585['set'](_0xd425('0x28'),_0x1155bc+'-'+_0x4e88fa+'/'+_0x467a6c)[_0xd425('0x25')](_0x434d97);}return null;};}function patchUpdates(_0x5f1e7e){return function(_0x2e1ec4){try{jsonpatch[_0xd425('0x29')](_0x2e1ec4,_0x5f1e7e,!![]);}catch(_0x249a2b){return BPromise[_0xd425('0x2a')](_0x249a2b);}return _0x2e1ec4[_0xd425('0x2b')]();};}function saveUpdates(_0xb240c4,_0x2480a0){return function(_0x3500bb){if(_0x3500bb){return _0x3500bb[_0xd425('0x2c')](_0xb240c4)[_0xd425('0x2d')](function(_0x151ad9){return _0x151ad9;});}return null;};}function removeEntity(_0x40e84b,_0x47f44a){return function(_0x369b5b){if(_0x369b5b){return _0x369b5b[_0xd425('0x2e')]()[_0xd425('0x2d')](function(){var _0x1908a5=_0x369b5b[_0xd425('0x2f')]({'plain':!![]});var _0x400dd7=_0xd425('0x30');return db['UserProfileResource'][_0xd425('0x2e')]({'where':{'type':_0x400dd7,'resourceId':_0x1908a5['id']}})[_0xd425('0x2d')](function(){return _0x369b5b;});})[_0xd425('0x2d')](function(){_0x40e84b['status'](0xcc)[_0xd425('0x24')]();});}};}function handleEntityNotFound(_0x3ad9bd,_0x433189){return function(_0x999fb9){if(!_0x999fb9){_0x3ad9bd[_0xd425('0x22')](0x194);}return _0x999fb9;};}function handleError(_0x185d7e,_0x2fd17a){_0x2fd17a=_0x2fd17a||0x1f4;return function(_0x37b63c){logger[_0xd425('0x31')](_0x37b63c[_0xd425('0x32')]);if(_0x37b63c['name']){delete _0x37b63c[_0xd425('0x33')];}_0x185d7e[_0xd425('0x23')](_0x2fd17a)[_0xd425('0x34')](_0x37b63c);};}exports[_0xd425('0x35')]=function(_0x3275b1,_0x1abf33){var _0x47405f={},_0x40c392={},_0x3ec51b={'count':0x0,'rows':[]};var _0x3342bb=_[_0xd425('0x36')](db['SmsQueue'][_0xd425('0x37')],function(_0x2a2a9b){return{'name':_0x2a2a9b[_0xd425('0x38')],'type':_0x2a2a9b[_0xd425('0x39')][_0xd425('0x3a')]};});_0x40c392['model']=_[_0xd425('0x36')](_0x3342bb,_0xd425('0x33'));_0x40c392['query']=_['keys'](_0x3275b1['query']);_0x40c392[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x40c392[_0xd425('0x3d')],_0x40c392[_0xd425('0x3e')]);_0x47405f['attributes']=_[_0xd425('0x3c')](_0x40c392[_0xd425('0x3d')],qs[_0xd425('0x3f')](_0x3275b1[_0xd425('0x3e')][_0xd425('0x3f')]));_0x47405f[_0xd425('0x40')]=_0x47405f[_0xd425('0x40')]['length']?_0x47405f[_0xd425('0x40')]:_0x40c392['model'];if(!_0x3275b1[_0xd425('0x3e')][_0xd425('0x41')](_0xd425('0x42'))){_0x47405f['limit']=qs[_0xd425('0x27')](_0x3275b1[_0xd425('0x3e')][_0xd425('0x27')]);_0x47405f[_0xd425('0x26')]=qs['offset'](_0x3275b1[_0xd425('0x3e')][_0xd425('0x26')]);}_0x47405f['order']=qs['sort'](_0x3275b1['query'][_0xd425('0x43')]);_0x47405f[_0xd425('0x44')]=qs[_0xd425('0x3b')](_['pick'](_0x3275b1['query'],_0x40c392['filters']),_0x3342bb);if(_0x3275b1[_0xd425('0x3e')][_0xd425('0x45')]){_0x47405f[_0xd425('0x44')]=_[_0xd425('0x46')](_0x47405f[_0xd425('0x44')],{'$or':_[_0xd425('0x36')](_0x3342bb,function(_0xeda414){if(_0xeda414['type']!==_0xd425('0x47')){var _0x3c88a8={};_0x3c88a8[_0xeda414[_0xd425('0x33')]]={'$like':'%'+_0x3275b1['query'][_0xd425('0x45')]+'%'};return _0x3c88a8;}})});}_0x47405f=_[_0xd425('0x46')]({},_0x47405f,_0x3275b1[_0xd425('0x48')]);var _0x5dc4c4={'where':_0x47405f[_0xd425('0x44')]};return db[_0xd425('0x49')][_0xd425('0x4a')](_0x5dc4c4)[_0xd425('0x2d')](function(_0x5afd62){_0x3ec51b[_0xd425('0x4a')]=_0x5afd62;if(_0x3275b1[_0xd425('0x3e')][_0xd425('0x4b')]){_0x47405f[_0xd425('0x4c')]=[{'all':!![]}];}return db[_0xd425('0x49')][_0xd425('0x4d')](_0x47405f);})[_0xd425('0x2d')](function(_0x524fad){_0x3ec51b[_0xd425('0x4e')]=_0x524fad;return _0x3ec51b;})[_0xd425('0x2d')](respondWithFilteredResult(_0x1abf33,_0x47405f))['catch'](handleError(_0x1abf33,null));};exports[_0xd425('0x4f')]=function(_0x491c51,_0x5e12bf){var _0x3783d2={'raw':!![],'where':{'id':_0x491c51[_0xd425('0x50')]['id']}},_0x59e893={};_0x59e893['model']=_[_0xd425('0x51')](db[_0xd425('0x49')][_0xd425('0x37')]);_0x59e893[_0xd425('0x3e')]=_[_0xd425('0x51')](_0x491c51['query']);_0x59e893[_0xd425('0x3b')]=_['intersection'](_0x59e893[_0xd425('0x3d')],_0x59e893['query']);_0x3783d2[_0xd425('0x40')]=_[_0xd425('0x3c')](_0x59e893[_0xd425('0x3d')],qs[_0xd425('0x3f')](_0x491c51[_0xd425('0x3e')]['fields']));_0x3783d2[_0xd425('0x40')]=_0x3783d2[_0xd425('0x40')][_0xd425('0x52')]?_0x3783d2[_0xd425('0x40')]:_0x59e893[_0xd425('0x3d')];if(_0x491c51['query'][_0xd425('0x4b')]){_0x3783d2[_0xd425('0x4c')]=[{'all':!![]}];}_0x3783d2=_[_0xd425('0x46')]({},_0x3783d2,_0x491c51[_0xd425('0x48')]);return db[_0xd425('0x49')][_0xd425('0x53')](_0x3783d2)['then'](handleEntityNotFound(_0x5e12bf,null))[_0xd425('0x2d')](respondWithResult(_0x5e12bf,null))[_0xd425('0x54')](handleError(_0x5e12bf,null));};exports['create']=function(_0x3f305,_0x42c084){return db[_0xd425('0x49')][_0xd425('0x55')](_0x3f305['body'],{})[_0xd425('0x2d')](function(_0x2b8882){var _0x4552cd=_0x3f305[_0xd425('0x56')][_0xd425('0x2f')]({'plain':!![]});if(!_0x4552cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4552cd['role']===_0xd425('0x56')){var _0x5496d8=_0x2b8882[_0xd425('0x2f')]({'plain':!![]});var _0x1072bf='SmsQueues';return db[_0xd425('0x57')]['find']({'where':{'name':_0x1072bf,'userProfileId':_0x4552cd['userProfileId']},'raw':!![]})[_0xd425('0x2d')](function(_0x111905){if(_0x111905&&_0x111905[_0xd425('0x58')]===0x0){return db[_0xd425('0x59')][_0xd425('0x55')]({'name':_0x5496d8[_0xd425('0x33')],'resourceId':_0x5496d8['id'],'type':_0x111905[_0xd425('0x33')],'sectionId':_0x111905['id']},{})[_0xd425('0x2d')](function(){return _0x2b8882;});}else{return _0x2b8882;}})['catch'](function(_0x11ed71){logger[_0xd425('0x31')](_0xd425('0x5a'),_0x11ed71);throw _0x11ed71;});}return _0x2b8882;})[_0xd425('0x2d')](respondWithResult(_0x42c084,0xc9))[_0xd425('0x54')](handleError(_0x42c084,null));};exports[_0xd425('0x2c')]=function(_0x3b6d6a,_0x456a45){if(_0x3b6d6a['body']['id']){delete _0x3b6d6a['body']['id'];}return db['SmsQueue'][_0xd425('0x53')]({'where':{'id':_0x3b6d6a[_0xd425('0x50')]['id']}})[_0xd425('0x2d')](handleEntityNotFound(_0x456a45,null))[_0xd425('0x2d')](saveUpdates(_0x3b6d6a['body'],null))['then'](respondWithResult(_0x456a45,null))['catch'](handleError(_0x456a45,null));};exports['destroy']=function(_0x254b8b,_0x44c5e4){return db['SmsQueue'][_0xd425('0x53')]({'where':{'id':_0x254b8b[_0xd425('0x50')]['id']}})[_0xd425('0x2d')](handleEntityNotFound(_0x44c5e4,null))['then'](removeEntity(_0x44c5e4,null))['catch'](handleError(_0x44c5e4,null));};exports[_0xd425('0x5b')]=function(_0x49d75e,_0x4acc26){return db['SmsQueue'][_0xd425('0x5b')]()[_0xd425('0x2d')](respondWithResult(_0x4acc26,null))[_0xd425('0x54')](handleError(_0x4acc26,null));};exports['getMembers']=function(_0x3395d8,_0x48bd20,_0x1158ac){var _0x6ee601={'raw':!![],'where':{}},_0x2b515c={},_0x40c377;return db[_0xd425('0x49')][_0xd425('0x5c')]({'where':{'id':_0x3395d8[_0xd425('0x50')]['id']}})[_0xd425('0x2d')](handleEntityNotFound(_0x48bd20,null))[_0xd425('0x2d')](function(_0x574e1f){if(_0x574e1f){_0x40c377=_0x574e1f[_0xd425('0x2f')]({'plain':!![]});_0x2b515c[_0xd425('0x3d')]=_[_0xd425('0x51')](db[_0xd425('0x5d')]['rawAttributes']);_0x2b515c['query']=_[_0xd425('0x51')](_0x3395d8[_0xd425('0x3e')]);_0x2b515c[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x2b515c[_0xd425('0x3d')],_0x2b515c[_0xd425('0x3e')]);_0x6ee601[_0xd425('0x40')]=_[_0xd425('0x3c')](_0x2b515c[_0xd425('0x3d')],qs[_0xd425('0x3f')](_0x3395d8[_0xd425('0x3e')][_0xd425('0x3f')]));_0x6ee601[_0xd425('0x40')]=_0x6ee601[_0xd425('0x40')]['length']?_0x6ee601[_0xd425('0x40')]:_0x2b515c[_0xd425('0x3d')];if(!_0x3395d8[_0xd425('0x3e')]['hasOwnProperty']('nolimit')){_0x6ee601['limit']=qs[_0xd425('0x27')](_0x3395d8[_0xd425('0x3e')][_0xd425('0x27')]);_0x6ee601['offset']=qs[_0xd425('0x26')](_0x3395d8['query'][_0xd425('0x26')]);}_0x6ee601[_0xd425('0x5e')]=qs[_0xd425('0x43')](_0x3395d8['query'][_0xd425('0x43')]);_0x6ee601[_0xd425('0x44')]=qs[_0xd425('0x3b')](_[_0xd425('0x5f')](_0x3395d8[_0xd425('0x3e')],_0x2b515c[_0xd425('0x3b')]));_0x6ee601[_0xd425('0x44')][_0xd425('0x60')]=_0x574e1f['id'];if(_0x3395d8[_0xd425('0x3e')][_0xd425('0x45')]){_0x6ee601[_0xd425('0x44')]=_[_0xd425('0x46')](_0x6ee601[_0xd425('0x44')],{'$or':_[_0xd425('0x36')](_0x6ee601[_0xd425('0x40')],function(_0x443126){var _0x623ff5={};_0x623ff5[_0x443126]={'$like':'%'+_0x3395d8[_0xd425('0x3e')]['filter']+'%'};return _0x623ff5;})});}_0x6ee601=_['merge']({},_0x6ee601,_0x3395d8[_0xd425('0x48')]);return db['UserSmsQueue'][_0xd425('0x4d')](_0x6ee601);}})[_0xd425('0x2d')](function(_0xb407bb){if(_0xb407bb){return db[_0xd425('0x61')]['findAndCountAll']({'where':{'id':_[_0xd425('0x36')](_0xb407bb,_0xd425('0x62')),'role':_0xd425('0x63')},'attributes':['id',_0xd425('0x33'),_0xd425('0x64'),_0xd425('0x65'),'createdAt']});}})['then'](function(_0x3ccffe){if(_0x3ccffe){return{'count':_0x3ccffe[_0xd425('0x4a')],'rows':_['map'](_0x3ccffe[_0xd425('0x4e')],function(_0x4a9215){return{'membername':_0x4a9215[_0xd425('0x33')],'UserId':_0x4a9215['id'],'queue_name':_0x40c377[_0xd425('0x33')],'SmsQueueId':_0x40c377['id'],'interface':util[_0xd425('0x66')](_0xd425('0x67'),_0xd425('0x68'),_0x4a9215[_0xd425('0x33')]),'penalty':0x0,'paused':_0x4a9215[_0xd425('0x64')],'createdAt':_0x4a9215['createdAt'],'updatedAt':_0x4a9215[_0xd425('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd425('0x2d')](respondWithFilteredResult(_0x48bd20,_0x6ee601))[_0xd425('0x54')](handleError(_0x48bd20,null));};exports[_0xd425('0x69')]=function(_0xfcba08,_0x59e1e9,_0x1f2834){var _0x3847f3={};var _0x4e05cd={};var _0x2bb36f;var _0x4599b0;return db['SmsQueue'][_0xd425('0x5c')]({'where':{'id':_0xfcba08[_0xd425('0x50')]['id']}})[_0xd425('0x2d')](handleEntityNotFound(_0x59e1e9,null))[_0xd425('0x2d')](function(_0x1b0cef){if(_0x1b0cef){_0x2bb36f=_0x1b0cef;_0x4e05cd['model']=_[_0xd425('0x51')](db['Team'][_0xd425('0x37')]);_0x4e05cd[_0xd425('0x3e')]=_['keys'](_0xfcba08[_0xd425('0x3e')]);_0x4e05cd[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x4e05cd[_0xd425('0x3d')],_0x4e05cd['query']);_0x3847f3['attributes']=_[_0xd425('0x3c')](_0x4e05cd[_0xd425('0x3d')],qs[_0xd425('0x3f')](_0xfcba08['query'][_0xd425('0x3f')]));_0x3847f3[_0xd425('0x40')]=_0x3847f3['attributes'][_0xd425('0x52')]?_0x3847f3['attributes']:_0x4e05cd[_0xd425('0x3d')];_0x3847f3[_0xd425('0x5e')]=qs[_0xd425('0x43')](_0xfcba08[_0xd425('0x3e')]['sort']);_0x3847f3['where']=qs[_0xd425('0x3b')](_[_0xd425('0x5f')](_0xfcba08['query'],_0x4e05cd[_0xd425('0x3b')]));if(_0xfcba08[_0xd425('0x3e')]['filter']){_0x3847f3[_0xd425('0x44')]=_[_0xd425('0x46')](_0x3847f3[_0xd425('0x44')],{'$or':_[_0xd425('0x36')](_0x3847f3[_0xd425('0x40')],function(_0xf251e6){var _0x302066={};_0x302066[_0xf251e6]={'$like':'%'+_0xfcba08['query']['filter']+'%'};return _0x302066;})});}_0x3847f3=_[_0xd425('0x46')]({},_0x3847f3,_0xfcba08['options']);return _0x2bb36f[_0xd425('0x69')](_0x3847f3);}})[_0xd425('0x2d')](function(_0x58cad5){if(_0x58cad5){_0x4599b0=_0x58cad5[_0xd425('0x52')];if(!_0xfcba08[_0xd425('0x3e')]['hasOwnProperty']('nolimit')){_0x3847f3[_0xd425('0x27')]=qs[_0xd425('0x27')](_0xfcba08[_0xd425('0x3e')][_0xd425('0x27')]);_0x3847f3[_0xd425('0x26')]=qs[_0xd425('0x26')](_0xfcba08[_0xd425('0x3e')][_0xd425('0x26')]);}return _0x2bb36f['getTeams'](_0x3847f3);}})[_0xd425('0x2d')](function(_0x1434c3){if(_0x1434c3){return _0x1434c3?{'count':_0x4599b0,'rows':_0x1434c3}:null;}})['then'](respondWithResult(_0x59e1e9,null))[_0xd425('0x54')](handleError(_0x59e1e9,null));};exports[_0xd425('0x6a')]=function(_0x35f8a3,_0x352962,_0x3801a0){var _0x3b3257=_0x35f8a3[_0xd425('0x6b')][_0xd425('0x6c')];return db[_0xd425('0x6d')][_0xd425('0x4d')]({'where':{'id':_0x3b3257},'attributes':['id'],'include':[{'model':db[_0xd425('0x61')],'as':'Agents','attributes':['id',_0xd425('0x33'),'online','voicePause',_0xd425('0x6e')],'raw':!![]}]})['then'](function(_0x229d7d){if(_0x229d7d){var _0x1b7fa8=_[_0xd425('0x6f')](_0x229d7d,function(_0x1dea3c){var _0x2f767a=_0x1dea3c[_0xd425('0x2f')]({'plain':!![]});return _0x2f767a[_0xd425('0x70')];});return db['SmsQueue'][_0xd425('0x53')]({'where':{'id':_0x35f8a3[_0xd425('0x50')]['id']}})[_0xd425('0x2d')](function(_0x4681c3){return db[_0xd425('0x71')]['transaction'](function(_0x331eaf){return _0x4681c3[_0xd425('0x6a')](_0x3b3257,{'transaction':_0x331eaf})[_0xd425('0x2d')](function(){return BPromise[_0xd425('0x72')](_0x1b7fa8,function(_0x1a5f86){return db[_0xd425('0x5d')][_0xd425('0x73')]({'where':{'UserId':_0x1a5f86['id'],'SmsQueueId':_0x35f8a3[_0xd425('0x50')]['id']},'transaction':_0x331eaf});});})[_0xd425('0x2d')](function(){_0x1b7fa8[_0xd425('0x74')](function(_0x36473f){socket[_0xd425('0x75')]('userSmsQueue:save',{'UserId':_0x36473f['id'],'SmsQueueId':_0x4681c3['id']});});});});});}})[_0xd425('0x2d')](respondWithStatusCode(_0x352962,null))['catch'](handleError(_0x352962,null));};exports[_0xd425('0x76')]=function(_0x18576e,_0x1c03d6,_0x1e6930){return db[_0xd425('0x6d')]['findAll']({'where':{'id':_0x18576e[_0xd425('0x3e')][_0xd425('0x6c')]},'attributes':['id'],'include':[{'model':db[_0xd425('0x61')],'as':_0xd425('0x70'),'attributes':['id'],'raw':!![]}]})[_0xd425('0x2d')](handleEntityNotFound(_0x1c03d6,null))[_0xd425('0x2d')](function(_0x5451a1){var _0x568a83=_[_0xd425('0x36')](_0x5451a1,'id');var _0x50514d=[];var _0x168f8b=[];var _0x905e5d=squel['select']();_0x905e5d[_0xd425('0x77')](_0xd425('0x78'))['from'](_0xd425('0x79'),'tq')[_0xd425('0x7a')](_0xd425('0x7b'),'ut',_0xd425('0x7c'))[_0xd425('0x44')](_0xd425('0x7d'),_0x18576e['params']['id']);for(var _0x3f1a48=0x0;_0x3f1a48<_0x5451a1['length'];_0x3f1a48+=0x1){let _0x103aa2=_0x5451a1[_0x3f1a48];for(var _0x5ea092=0x0;_0x5ea092<_0x103aa2[_0xd425('0x70')][_0xd425('0x52')];_0x5ea092+=0x1){let _0x35e650=_0x103aa2[_0xd425('0x70')][_0x5ea092];var _0x500a65=_0x905e5d['clone']();_0x500a65['where']('ut.UserId\x20=\x20?',_0x35e650['id']);_0x168f8b[_0xd425('0x7e')](db['sequelize'][_0xd425('0x3e')](_0x500a65[_0xd425('0x7f')](),{'type':db[_0xd425('0x71')][_0xd425('0x80')][_0xd425('0x81')]})[_0xd425('0x2d')](function(_0x4b55a6){if(_0x4b55a6[_0xd425('0x52')]===0x1){return _0x35e650['id'];}else{var _0x16f928=_[_0xd425('0x82')](_[_0xd425('0x36')](_0x4b55a6,_0xd425('0x83')),function(_0x56e4c1){return _[_0xd425('0x84')](_0x568a83,_0x56e4c1);});if(_0x16f928){return _0x35e650['id'];}}}));}}return BPromise[_0xd425('0x85')](_0x168f8b)[_0xd425('0x2d')](function(_0x4f5d74){_0x50514d=_(_0x50514d)[_0xd425('0x86')](_0x4f5d74)[_0xd425('0x87')]()[_0xd425('0x88')]();return db[_0xd425('0x49')][_0xd425('0x53')]({'where':{'id':_0x18576e['params']['id']}})[_0xd425('0x2d')](function(_0x52016e){return db[_0xd425('0x71')][_0xd425('0x89')](function(_0x4af082){return _0x52016e['removeTeams'](_0x18576e[_0xd425('0x3e')]['ids'],{'transaction':_0x4af082})[_0xd425('0x2d')](function(){if(!_[_0xd425('0x8a')](_0x50514d)){return _0x52016e[_0xd425('0x8b')](_0x50514d,{'transaction':_0x4af082});}})[_0xd425('0x2d')](function(){_0x50514d['forEach'](function(_0x73bd1d){socket[_0xd425('0x75')](_0xd425('0x8c'),{'UserId':_0x73bd1d,'SmsQueueId':_0x52016e['id']});});});});});});})[_0xd425('0x2d')](respondWithStatusCode(_0x1c03d6,null))[_0xd425('0x54')](handleError(_0x1c03d6,null));};exports[_0xd425('0x8d')]=function(_0x4917bb,_0xe9478d,_0x260121){return db[_0xd425('0x49')][_0xd425('0x53')]({'where':{'id':_0x4917bb[_0xd425('0x50')]['id']}})[_0xd425('0x2d')](handleEntityNotFound(_0xe9478d,null))['then'](function(_0x289aad){if(_0x289aad){return _0x289aad[_0xd425('0x8d')](_0x4917bb['body'][_0xd425('0x6c')],_[_0xd425('0x8e')](_0x4917bb['body'],[_0xd425('0x6c'),'id'])||{})[_0xd425('0x8f')](function(_0x44df21){for(var _0x19a4cd=0x0;_0x19a4cd<_0x4917bb['body'][_0xd425('0x6c')][_0xd425('0x52')];_0x19a4cd+=0x1){socket['emit'](_0xd425('0x90'),{'UserId':_0x4917bb[_0xd425('0x6b')][_0xd425('0x6c')][_0x19a4cd],'SmsQueueId':_0x4917bb[_0xd425('0x50')]['id']});}return _0x44df21;});}})[_0xd425('0x2d')](respondWithResult(_0xe9478d,null))[_0xd425('0x54')](handleError(_0xe9478d,null));};exports[_0xd425('0x8b')]=function(_0x589a8d,_0x471c91,_0x55d9d2){return db[_0xd425('0x49')][_0xd425('0x53')]({'where':{'id':_0x589a8d['params']['id']}})['then'](handleEntityNotFound(_0x471c91,null))[_0xd425('0x2d')](function(_0x166633){if(_0x166633){return _0x166633[_0xd425('0x8b')](_0x589a8d['query'][_0xd425('0x6c')])['then'](function(){if(_['isArray'](_0x589a8d[_0xd425('0x3e')][_0xd425('0x6c')])){for(var _0x1b3667=0x0;_0x1b3667<_0x589a8d[_0xd425('0x3e')][_0xd425('0x6c')]['length'];_0x1b3667+=0x1){socket[_0xd425('0x75')](_0xd425('0x8c'),{'UserId':Number(_0x589a8d[_0xd425('0x3e')]['ids'][_0x1b3667]),'SmsQueueId':Number(_0x589a8d[_0xd425('0x50')]['id'])});}}else{socket[_0xd425('0x75')](_0xd425('0x8c'),{'UserId':Number(_0x589a8d[_0xd425('0x3e')][_0xd425('0x6c')]),'SmsQueueId':Number(_0x589a8d[_0xd425('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x471c91,null))['catch'](handleError(_0x471c91,null));};exports['getAgents']=function(_0x2bf6d7,_0x5abb67,_0x9412de){var _0x2c02be={};var _0x310085={};var _0x1335ba;var _0x164b5c;return db[_0xd425('0x49')][_0xd425('0x5c')]({'where':{'id':_0x2bf6d7[_0xd425('0x50')]['id']}})[_0xd425('0x2d')](handleEntityNotFound(_0x5abb67,null))[_0xd425('0x2d')](function(_0x234a9e){if(_0x234a9e){_0x1335ba=_0x234a9e;_0x310085['model']=_[_0xd425('0x51')](db[_0xd425('0x61')][_0xd425('0x37')]);_0x310085[_0xd425('0x3e')]=_[_0xd425('0x51')](_0x2bf6d7[_0xd425('0x3e')]);_0x310085['filters']=_[_0xd425('0x3c')](_0x310085[_0xd425('0x3d')],_0x310085[_0xd425('0x3e')]);_0x2c02be['attributes']=_[_0xd425('0x3c')](_0x310085[_0xd425('0x3d')],qs['fields'](_0x2bf6d7[_0xd425('0x3e')][_0xd425('0x3f')]));_0x2c02be['attributes']=_0x2c02be[_0xd425('0x40')][_0xd425('0x52')]?_0x2c02be['attributes']:_0x310085[_0xd425('0x3d')];_0x2c02be[_0xd425('0x5e')]=qs[_0xd425('0x43')](_0x2bf6d7[_0xd425('0x3e')][_0xd425('0x43')]);_0x2c02be[_0xd425('0x44')]=qs[_0xd425('0x3b')](_[_0xd425('0x5f')](_0x2bf6d7[_0xd425('0x3e')],_0x310085[_0xd425('0x3b')]));if(_0x2bf6d7[_0xd425('0x3e')][_0xd425('0x45')]){_0x2c02be[_0xd425('0x44')]=_[_0xd425('0x46')](_0x2c02be['where'],{'$or':_[_0xd425('0x36')](_0x2c02be[_0xd425('0x40')],function(_0x53cb91){var _0x826daf={};_0x826daf[_0x53cb91]={'$like':'%'+_0x2bf6d7[_0xd425('0x3e')]['filter']+'%'};return _0x826daf;})});}_0x2c02be=_['merge']({},_0x2c02be,_0x2bf6d7[_0xd425('0x48')]);return _0x1335ba[_0xd425('0x91')](_0x2c02be);}})['then'](function(_0x1d8dc1){if(_0x1d8dc1){_0x164b5c=_0x1d8dc1[_0xd425('0x52')];if(!_0x2bf6d7[_0xd425('0x3e')][_0xd425('0x41')](_0xd425('0x42'))){_0x2c02be[_0xd425('0x27')]=qs[_0xd425('0x27')](_0x2bf6d7[_0xd425('0x3e')][_0xd425('0x27')]);_0x2c02be[_0xd425('0x26')]=qs[_0xd425('0x26')](_0x2bf6d7[_0xd425('0x3e')][_0xd425('0x26')]);}return _0x1335ba[_0xd425('0x91')](_0x2c02be);}})[_0xd425('0x2d')](function(_0x457116){if(_0x457116){return _0x457116?{'count':_0x164b5c,'rows':_0x457116}:null;}})['then'](respondWithResult(_0x5abb67,null))[_0xd425('0x54')](handleError(_0x5abb67,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 8084a23..9ac0b9e 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 _0x5d21=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x36abe4,_0x8a583f){var _0x544474=function(_0x314342){while(--_0x314342){_0x36abe4['push'](_0x36abe4['shift']());}};_0x544474(++_0x8a583f);}(_0x5d21,0x178));var _0x15d2=function(_0x2265d0,_0x145b4f){_0x2265d0=_0x2265d0-0x0;var _0x27e4fa=_0x5d21[_0x2265d0];return _0x27e4fa;};'use strict';var EventEmitter=require(_0x15d2('0x0'));var SmsQueue=require(_0x15d2('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x15d2('0x2')](0x0);var events={'afterCreate':_0x15d2('0x3'),'afterUpdate':_0x15d2('0x4'),'afterDestroy':_0x15d2('0x5')};function emitEvent(_0x41aeb7){return function(_0x18b955,_0x5e8f31,_0x273821){SmsQueueEvents[_0x15d2('0x6')](_0x41aeb7+':'+_0x18b955['id'],_0x18b955);SmsQueueEvents['emit'](_0x41aeb7,_0x18b955);_0x273821(null);};}for(var e in events){if(events[_0x15d2('0x7')](e)){var event=events[e];SmsQueue[_0x15d2('0x8')](e,emitEvent(event));}}module[_0x15d2('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x799a=['exports','events','setMaxListeners','update','hasOwnProperty','hook'];(function(_0x46dd33,_0x492982){var _0x979584=function(_0x5a414b){while(--_0x5a414b){_0x46dd33['push'](_0x46dd33['shift']());}};_0x979584(++_0x492982);}(_0x799a,0x187));var _0xa799=function(_0x2b41fe,_0x40cab0){_0x2b41fe=_0x2b41fe-0x0;var _0x56ef8c=_0x799a[_0x2b41fe];return _0x56ef8c;};'use strict';var EventEmitter=require(_0xa799('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xa799('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa799('0x2'),'afterDestroy':'remove'};function emitEvent(_0x271da2){return function(_0x303ff8,_0x360c66,_0x39c07c){SmsQueueEvents['emit'](_0x271da2+':'+_0x303ff8['id'],_0x303ff8);SmsQueueEvents['emit'](_0x271da2,_0x303ff8);_0x39c07c(null);};}for(var e in events){if(events[_0xa799('0x3')](e)){var event=events[e];SmsQueue[_0xa799('0x4')](e,emitEvent(event));}}module[_0xa799('0x5')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 1e3d0f5..283dab6 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 _0x1d99=['define','SmsQueue','sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports'];(function(_0x169c71,_0x3b6e39){var _0x5a19c2=function(_0x46286a){while(--_0x46286a){_0x169c71['push'](_0x169c71['shift']());}};_0x5a19c2(++_0x3b6e39);}(_0x1d99,0x16f));var _0x91d9=function(_0x73402b,_0x36e524){_0x73402b=_0x73402b-0x0;var _0x4ecce5=_0x1d99[_0x73402b];return _0x4ecce5;};'use strict';var _=require('lodash');var util=require(_0x91d9('0x0'));var logger=require(_0x91d9('0x1'))(_0x91d9('0x2'));var moment=require(_0x91d9('0x3'));var BPromise=require(_0x91d9('0x4'));var rp=require(_0x91d9('0x5'));var fs=require('fs');var path=require(_0x91d9('0x6'));var rimraf=require(_0x91d9('0x7'));var config=require(_0x91d9('0x8'));var attributes=require(_0x91d9('0x9'));module[_0x91d9('0xa')]=function(_0x41f355,_0x617d88){return _0x41f355[_0x91d9('0xb')](_0x91d9('0xc'),attributes,{'tableName':_0x91d9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd86b=['SmsQueue','sms_queues','lodash','../../config/logger','moment','exports','define'];(function(_0x347a1f,_0xab8013){var _0x20316c=function(_0x18be5f){while(--_0x18be5f){_0x347a1f['push'](_0x347a1f['shift']());}};_0x20316c(++_0xab8013);}(_0xd86b,0x136));var _0xbd86=function(_0x32753a,_0x313eff){_0x32753a=_0x32753a-0x0;var _0x5cc638=_0xd86b[_0x32753a];return _0x5cc638;};'use strict';var _=require(_0xbd86('0x0'));var util=require('util');var logger=require(_0xbd86('0x1'))('api');var moment=require(_0xbd86('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0xbd86('0x3')]=function(_0x3e1d8e,_0x164e70){return _0x3e1d8e[_0xbd86('0x4')](_0xbd86('0x5'),attributes,{'tableName':_0xbd86('0x6'),'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 efac8f3..5eb36ad 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 _0x5ffb=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetSmsQueue','SmsQueue','options','attributes','limit','include','map','model','then','stringify','ShowSmsQueue','find','raw','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5864ef,_0x496812){var _0x21c244=function(_0x433f8a){while(--_0x433f8a){_0x5864ef['push'](_0x5864ef['shift']());}};_0x21c244(++_0x496812);}(_0x5ffb,0x1aa));var _0xb5ff=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5ffb[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb5ff('0x0'));var BPromise=require(_0xb5ff('0x1'));var rs=require(_0xb5ff('0x2'));var fs=require('fs');var Redis=require(_0xb5ff('0x3'));var db=require(_0xb5ff('0x4'))['db'];var utils=require(_0xb5ff('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb5ff('0x6'));var jayson=require(_0xb5ff('0x7'));var client=jayson[_0xb5ff('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xb5ff('0x9')],{'host':_0xb5ff('0xa'),'port':0x18eb});var socket=require(_0xb5ff('0xb'))(new Redis(config['redis']));require(_0xb5ff('0xc'))[_0xb5ff('0xd')](socket);function respondWithRpcPromise(_0x209d6f,_0x50351b,_0x27409d){return new BPromise(function(_0x228314,_0x5de446){return client[_0xb5ff('0xe')](_0x209d6f,_0x27409d)['then'](function(_0x5c7602){logger[_0xb5ff('0xf')](_0xb5ff('0x10'),_0x50351b,_0xb5ff('0x11'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x50351b,_0xb5ff('0x11'),JSON['stringify'](_0x5c7602));if(_0x5c7602[_0xb5ff('0x12')]){if(_0x5c7602[_0xb5ff('0x12')]['code']===0x1f4){logger[_0xb5ff('0x12')](_0xb5ff('0x10'),_0x50351b,_0x5c7602[_0xb5ff('0x12')][_0xb5ff('0x13')]);return _0x5de446(_0x5c7602[_0xb5ff('0x12')][_0xb5ff('0x13')]);}logger['error'](_0xb5ff('0x10'),_0x50351b,_0x5c7602[_0xb5ff('0x12')][_0xb5ff('0x13')]);return _0x228314(_0x5c7602['error'][_0xb5ff('0x13')]);}else{logger[_0xb5ff('0xf')](_0xb5ff('0x10'),_0x50351b,_0xb5ff('0x11'));_0x228314(_0x5c7602[_0xb5ff('0x14')][_0xb5ff('0x13')]);}})[_0xb5ff('0x15')](function(_0x13ca53){logger[_0xb5ff('0x12')](_0xb5ff('0x10'),_0x50351b,_0x13ca53);_0x5de446(_0x13ca53);});});}exports[_0xb5ff('0x16')]=function(_0xfe4012){var _0x4915ee=this;return new Promise(function(_0x4cd05e,_0x2cb2de){return db[_0xb5ff('0x17')]['findAll']({'raw':_0xfe4012[_0xb5ff('0x18')]?_0xfe4012[_0xb5ff('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xfe4012['options']?_0xfe4012[_0xb5ff('0x18')]['where']||null:null,'attributes':_0xfe4012['options']?_0xfe4012['options'][_0xb5ff('0x19')]||null:null,'limit':_0xfe4012[_0xb5ff('0x18')]?_0xfe4012[_0xb5ff('0x18')][_0xb5ff('0x1a')]||null:null,'include':_0xfe4012[_0xb5ff('0x18')]?_0xfe4012[_0xb5ff('0x18')][_0xb5ff('0x1b')]?_[_0xb5ff('0x1c')](_0xfe4012[_0xb5ff('0x18')][_0xb5ff('0x1b')],function(_0x5a9950){return{'model':db[_0x5a9950[_0xb5ff('0x1d')]],'as':_0x5a9950['as'],'attributes':_0x5a9950['attributes'],'include':_0x5a9950['include']?_[_0xb5ff('0x1c')](_0x5a9950['include'],function(_0x2ae303){return{'model':db[_0x2ae303[_0xb5ff('0x1d')]],'as':_0x2ae303['as'],'attributes':_0x2ae303[_0xb5ff('0x19')],'include':_0x2ae303['include']?_[_0xb5ff('0x1c')](_0x2ae303[_0xb5ff('0x1b')],function(_0x209a1e){return{'model':db[_0x209a1e[_0xb5ff('0x1d')]],'as':_0x209a1e['as'],'attributes':_0x209a1e[_0xb5ff('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb5ff('0x1e')](function(_0x57ba39){logger['info']('GetSmsQueue',_0xfe4012);logger['debug']('GetSmsQueue',_0xfe4012,JSON[_0xb5ff('0x1f')](_0x57ba39));_0x4cd05e(_0x57ba39);})[_0xb5ff('0x15')](function(_0x2ece76){logger['error']('GetSmsQueue',_0x2ece76[_0xb5ff('0x13')],_0xfe4012);_0x2cb2de(_0x4915ee['error'](0x1f4,_0x2ece76[_0xb5ff('0x13')]));});});};exports[_0xb5ff('0x20')]=function(_0x34ac2a){var _0x87449e=this;return new Promise(function(_0x519942,_0x44211c){return db[_0xb5ff('0x17')][_0xb5ff('0x21')]({'raw':_0x34ac2a[_0xb5ff('0x18')]?_0x34ac2a[_0xb5ff('0x18')][_0xb5ff('0x22')]===undefined?!![]:![]:!![],'where':_0x34ac2a[_0xb5ff('0x18')]?_0x34ac2a[_0xb5ff('0x18')][_0xb5ff('0x23')]||null:null,'attributes':_0x34ac2a[_0xb5ff('0x18')]?_0x34ac2a['options'][_0xb5ff('0x19')]||null:null,'include':_0x34ac2a[_0xb5ff('0x18')]?_0x34ac2a[_0xb5ff('0x18')][_0xb5ff('0x1b')]?_[_0xb5ff('0x1c')](_0x34ac2a[_0xb5ff('0x18')]['include'],function(_0x431bd0){return{'model':db[_0x431bd0[_0xb5ff('0x1d')]],'as':_0x431bd0['as'],'attributes':_0x431bd0[_0xb5ff('0x19')],'include':_0x431bd0[_0xb5ff('0x1b')]?_[_0xb5ff('0x1c')](_0x431bd0['include'],function(_0x393736){return{'model':db[_0x393736[_0xb5ff('0x1d')]],'as':_0x393736['as'],'attributes':_0x393736[_0xb5ff('0x19')],'include':_0x393736[_0xb5ff('0x1b')]?_[_0xb5ff('0x1c')](_0x393736[_0xb5ff('0x1b')],function(_0x52a9d2){return{'model':db[_0x52a9d2[_0xb5ff('0x1d')]],'as':_0x52a9d2['as'],'attributes':_0x52a9d2[_0xb5ff('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb5ff('0x1e')](function(_0xd7db93){logger[_0xb5ff('0xf')](_0xb5ff('0x20'),_0x34ac2a);logger['debug'](_0xb5ff('0x20'),_0x34ac2a,JSON[_0xb5ff('0x1f')](_0xd7db93));_0x519942(_0xd7db93);})[_0xb5ff('0x15')](function(_0x1c5171){logger[_0xb5ff('0x12')]('ShowSmsQueue',_0x1c5171['message'],_0x34ac2a);_0x44211c(_0x87449e[_0xb5ff('0x12')](0x1f4,_0x1c5171[_0xb5ff('0x13')]));});});}; \ No newline at end of file +var _0x6de4=['socket.io-emitter','./smsQueue.socket','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowSmsQueue','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost'];(function(_0x27ad1f,_0x33db69){var _0x4510e9=function(_0x4d30f3){while(--_0x4d30f3){_0x27ad1f['push'](_0x27ad1f['shift']());}};_0x4510e9(++_0x33db69);}(_0x6de4,0x1a0));var _0x46de=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6de4[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x46de('0x0'));var moment=require(_0x46de('0x1'));var BPromise=require(_0x46de('0x2'));var rs=require(_0x46de('0x3'));var fs=require('fs');var Redis=require(_0x46de('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x46de('0x5'));var logger=require(_0x46de('0x6'))(_0x46de('0x7'));var config=require(_0x46de('0x8'));var jayson=require(_0x46de('0x9'));var client=jayson[_0x46de('0xa')]['http']({'port':0x232a});config['redis']=_[_0x46de('0xb')](config[_0x46de('0xc')],{'host':_0x46de('0xd'),'port':0x18eb});var socket=require(_0x46de('0xe'))(new Redis(config[_0x46de('0xc')]));require(_0x46de('0xf'))[_0x46de('0x10')](socket);function respondWithRpcPromise(_0x11f657,_0x48ea17,_0x5774c9){return new BPromise(function(_0x143b6d,_0x3edbcd){return client[_0x46de('0x11')](_0x11f657,_0x5774c9)[_0x46de('0x12')](function(_0x165f59){logger[_0x46de('0x13')]('SmsQueue,\x20%s,\x20%s',_0x48ea17,_0x46de('0x14'));logger[_0x46de('0x15')](_0x46de('0x16'),_0x48ea17,'request\x20sent',JSON[_0x46de('0x17')](_0x165f59));if(_0x165f59[_0x46de('0x18')]){if(_0x165f59[_0x46de('0x18')][_0x46de('0x19')]===0x1f4){logger['error'](_0x46de('0x1a'),_0x48ea17,_0x165f59[_0x46de('0x18')][_0x46de('0x1b')]);return _0x3edbcd(_0x165f59[_0x46de('0x18')][_0x46de('0x1b')]);}logger[_0x46de('0x18')](_0x46de('0x1a'),_0x48ea17,_0x165f59[_0x46de('0x18')][_0x46de('0x1b')]);return _0x143b6d(_0x165f59[_0x46de('0x18')][_0x46de('0x1b')]);}else{logger[_0x46de('0x13')](_0x46de('0x1a'),_0x48ea17,_0x46de('0x14'));_0x143b6d(_0x165f59[_0x46de('0x1c')]['message']);}})[_0x46de('0x1d')](function(_0x1919ab){logger[_0x46de('0x18')](_0x46de('0x1a'),_0x48ea17,_0x1919ab);_0x3edbcd(_0x1919ab);});});}exports[_0x46de('0x1e')]=function(_0x2fb6bf){var _0xf544a0=this;return new Promise(function(_0x354d20,_0x1122de){return db[_0x46de('0x1f')][_0x46de('0x20')]({'raw':_0x2fb6bf[_0x46de('0x21')]?_0x2fb6bf['options'][_0x46de('0x22')]===undefined?!![]:![]:!![],'where':_0x2fb6bf[_0x46de('0x21')]?_0x2fb6bf['options'][_0x46de('0x23')]||null:null,'attributes':_0x2fb6bf['options']?_0x2fb6bf[_0x46de('0x21')][_0x46de('0x24')]||null:null,'limit':_0x2fb6bf[_0x46de('0x21')]?_0x2fb6bf[_0x46de('0x21')][_0x46de('0x25')]||null:null,'include':_0x2fb6bf[_0x46de('0x21')]?_0x2fb6bf['options'][_0x46de('0x26')]?_[_0x46de('0x27')](_0x2fb6bf[_0x46de('0x21')][_0x46de('0x26')],function(_0x3202ad){return{'model':db[_0x3202ad['model']],'as':_0x3202ad['as'],'attributes':_0x3202ad['attributes'],'include':_0x3202ad[_0x46de('0x26')]?_['map'](_0x3202ad[_0x46de('0x26')],function(_0x3f6578){return{'model':db[_0x3f6578[_0x46de('0x28')]],'as':_0x3f6578['as'],'attributes':_0x3f6578[_0x46de('0x24')],'include':_0x3f6578['include']?_[_0x46de('0x27')](_0x3f6578[_0x46de('0x26')],function(_0x41eb4f){return{'model':db[_0x41eb4f[_0x46de('0x28')]],'as':_0x41eb4f['as'],'attributes':_0x41eb4f[_0x46de('0x24')]};}):[]};}):[]};}):[]:[]})[_0x46de('0x12')](function(_0x554683){logger[_0x46de('0x13')]('GetSmsQueue',_0x2fb6bf);logger[_0x46de('0x15')](_0x46de('0x1e'),_0x2fb6bf,JSON[_0x46de('0x17')](_0x554683));_0x354d20(_0x554683);})['catch'](function(_0x23ffc7){logger[_0x46de('0x18')](_0x46de('0x1e'),_0x23ffc7[_0x46de('0x1b')],_0x2fb6bf);_0x1122de(_0xf544a0[_0x46de('0x18')](0x1f4,_0x23ffc7['message']));});});};exports['ShowSmsQueue']=function(_0x24e72e){var _0x7cec24=this;return new Promise(function(_0x1675b3,_0x41d861){return db['SmsQueue'][_0x46de('0x29')]({'raw':_0x24e72e[_0x46de('0x21')]?_0x24e72e[_0x46de('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x24e72e['options']?_0x24e72e['options'][_0x46de('0x23')]||null:null,'attributes':_0x24e72e['options']?_0x24e72e[_0x46de('0x21')][_0x46de('0x24')]||null:null,'include':_0x24e72e['options']?_0x24e72e[_0x46de('0x21')][_0x46de('0x26')]?_[_0x46de('0x27')](_0x24e72e[_0x46de('0x21')][_0x46de('0x26')],function(_0x4dab8a){return{'model':db[_0x4dab8a[_0x46de('0x28')]],'as':_0x4dab8a['as'],'attributes':_0x4dab8a[_0x46de('0x24')],'include':_0x4dab8a[_0x46de('0x26')]?_[_0x46de('0x27')](_0x4dab8a[_0x46de('0x26')],function(_0xc7598e){return{'model':db[_0xc7598e[_0x46de('0x28')]],'as':_0xc7598e['as'],'attributes':_0xc7598e[_0x46de('0x24')],'include':_0xc7598e[_0x46de('0x26')]?_[_0x46de('0x27')](_0xc7598e[_0x46de('0x26')],function(_0x5245ac){return{'model':db[_0x5245ac[_0x46de('0x28')]],'as':_0x5245ac['as'],'attributes':_0x5245ac[_0x46de('0x24')]};}):[]};}):[]};}):[]:[]})[_0x46de('0x12')](function(_0x335f80){logger[_0x46de('0x13')]('ShowSmsQueue',_0x24e72e);logger[_0x46de('0x15')](_0x46de('0x2a'),_0x24e72e,JSON[_0x46de('0x17')](_0x335f80));_0x1675b3(_0x335f80);})['catch'](function(_0xe3f4e9){logger[_0x46de('0x18')](_0x46de('0x2a'),_0xe3f4e9[_0x46de('0x1b')],_0x24e72e);_0x41d861(_0x7cec24[_0x46de('0x18')](0x1f4,_0xe3f4e9[_0x46de('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2debaf9..569cc92 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 _0xabb1=['update','removeListener','register','length','./smsQueue.events','remove'];(function(_0x20a618,_0x3d1a7b){var _0x3be658=function(_0x2cef18){while(--_0x2cef18){_0x20a618['push'](_0x20a618['shift']());}};_0x3be658(++_0x3d1a7b);}(_0xabb1,0x88));var _0x1abb=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xabb1[_0x263a74];return _0x2aa86c;};'use strict';var SmsQueueEvents=require(_0x1abb('0x0'));var events=['save',_0x1abb('0x1'),_0x1abb('0x2')];function createListener(_0x32ebf0,_0x35440f){return function(_0x19ef39){_0x35440f['emit'](_0x32ebf0,_0x19ef39);};}function removeListener(_0x34c941,_0x3ef3e2){return function(){SmsQueueEvents[_0x1abb('0x3')](_0x34c941,_0x3ef3e2);};}exports[_0x1abb('0x4')]=function(_0xd954b8){for(var _0x4695e9=0x0,_0x23face=events[_0x1abb('0x5')];_0x4695e9<_0x23face;_0x4695e9++){var _0x1c9116=events[_0x4695e9];var _0x46876a=createListener('smsQueue:'+_0x1c9116,_0xd954b8);SmsQueueEvents['on'](_0x1c9116,_0x46876a);}}; \ No newline at end of file +var _0xf511=['emit','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x228445,_0x4bfa2b){var _0x33d4f8=function(_0x15917e){while(--_0x15917e){_0x228445['push'](_0x228445['shift']());}};_0x33d4f8(++_0x4bfa2b);}(_0xf511,0xd4));var _0x1f51=function(_0x460fd7,_0x2012db){_0x460fd7=_0x460fd7-0x0;var _0x44d1c2=_0xf511[_0x460fd7];return _0x44d1c2;};'use strict';var SmsQueueEvents=require(_0x1f51('0x0'));var events=[_0x1f51('0x1'),_0x1f51('0x2'),_0x1f51('0x3')];function createListener(_0x81ed2d,_0x57c07a){return function(_0x55ea4f){_0x57c07a[_0x1f51('0x4')](_0x81ed2d,_0x55ea4f);};}function removeListener(_0x1b6de1,_0x24a146){return function(){SmsQueueEvents[_0x1f51('0x5')](_0x1b6de1,_0x24a146);};}exports[_0x1f51('0x6')]=function(_0xffede2){for(var _0x91fbf4=0x0,_0x412410=events[_0x1f51('0x7')];_0x91fbf4<_0x412410;_0x91fbf4++){var _0x1586fc=events[_0x91fbf4];var _0x3ab3bc=createListener(_0x1f51('0x8')+_0x1586fc,_0xffede2);SmsQueueEvents['on'](_0x1586fc,_0x3ab3bc);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 359d69c..e0fcc70 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 _0x5363=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer'];(function(_0x1a6544,_0x4ebaa8){var _0x45126d=function(_0x1c13bd){while(--_0x1c13bd){_0x1a6544['push'](_0x1a6544['shift']());}};_0x45126d(++_0x4ebaa8);}(_0x5363,0x167));var _0x3536=function(_0x4246bd,_0xdab764){_0x4246bd=_0x4246bd-0x0;var _0x20e0b7=_0x5363[_0x4246bd];return _0x20e0b7;};'use strict';var multer=require(_0x3536('0x0'));var util=require(_0x3536('0x1'));var path=require(_0x3536('0x2'));var timeout=require('connect-timeout');var express=require(_0x3536('0x3'));var router=express[_0x3536('0x4')]();var auth=require(_0x3536('0x5'));var interaction=require(_0x3536('0x6'));var config=require('../../config/environment');var controller=require(_0x3536('0x7'));router[_0x3536('0x8')]('/',auth[_0x3536('0x9')](),controller[_0x3536('0xa')]);router['get'](_0x3536('0xb'),auth[_0x3536('0x9')](),controller[_0x3536('0xc')]);router['get'](_0x3536('0xd'),auth[_0x3536('0x9')](),controller[_0x3536('0xe')]);router[_0x3536('0xf')]('/',auth[_0x3536('0x9')](),controller['create']);router['put']('/:id',auth[_0x3536('0x9')](),controller[_0x3536('0x10')]);router[_0x3536('0x11')](_0x3536('0xd'),auth[_0x3536('0x9')](),controller[_0x3536('0x12')]);module[_0x3536('0x13')]=router; \ No newline at end of file +var _0x228a=['../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x228a,0x19c));var _0xa228=function(_0x11723c,_0x30b68a){_0x11723c=_0x11723c-0x0;var _0x561ca6=_0x228a[_0x11723c];return _0x561ca6;};'use strict';var multer=require(_0xa228('0x0'));var util=require(_0xa228('0x1'));var path=require(_0xa228('0x2'));var timeout=require('connect-timeout');var express=require(_0xa228('0x3'));var router=express[_0xa228('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa228('0x5'));var config=require(_0xa228('0x6'));var controller=require(_0xa228('0x7'));router[_0xa228('0x8')]('/',auth[_0xa228('0x9')](),controller['index']);router[_0xa228('0x8')](_0xa228('0xa'),auth[_0xa228('0x9')](),controller[_0xa228('0xb')]);router[_0xa228('0x8')](_0xa228('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa228('0xd')]('/',auth[_0xa228('0x9')](),controller[_0xa228('0xe')]);router[_0xa228('0xf')](_0xa228('0xc'),auth[_0xa228('0x9')](),controller['update']);router[_0xa228('0x10')]('/:id',auth[_0xa228('0x9')](),controller[_0xa228('0x11')]);module[_0xa228('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 1fa98d9..8c438cc 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 _0x1847=['DATE','moment','sequelize','exports','STRING'];(function(_0x155fac,_0x12c9d5){var _0x116783=function(_0x3bc4c9){while(--_0x3bc4c9){_0x155fac['push'](_0x155fac['shift']());}};_0x116783(++_0x12c9d5);}(_0x1847,0x12d));var _0x7184=function(_0x1cb9ab,_0x57c3f2){_0x1cb9ab=_0x1cb9ab-0x0;var _0x543464=_0x1847[_0x1cb9ab];return _0x543464;};'use strict';var moment=require(_0x7184('0x0'));var Sequelize=require(_0x7184('0x1'));module[_0x7184('0x2')]={'uniqueid':{'type':Sequelize[_0x7184('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7184('0x4')]},'leaveAt':{'type':Sequelize[_0x7184('0x4')]},'acceptAt':{'type':Sequelize[_0x7184('0x4')]},'exitAt':{'type':Sequelize[_0x7184('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1bbd=['STRING','DATE','moment','sequelize','exports'];(function(_0x237c45,_0x55cf99){var _0x2942f6=function(_0x45a615){while(--_0x45a615){_0x237c45['push'](_0x237c45['shift']());}};_0x2942f6(++_0x55cf99);}(_0x1bbd,0x70));var _0xd1bb=function(_0x26e32b,_0xbbb4d0){_0x26e32b=_0x26e32b-0x0;var _0x516bc2=_0x1bbd[_0x26e32b];return _0x516bc2;};'use strict';var moment=require(_0xd1bb('0x0'));var Sequelize=require(_0xd1bb('0x1'));module[_0xd1bb('0x2')]={'uniqueid':{'type':Sequelize[_0xd1bb('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd1bb('0x3')]},'joinAt':{'type':Sequelize[_0xd1bb('0x4')]},'leaveAt':{'type':Sequelize[_0xd1bb('0x4')]},'acceptAt':{'type':Sequelize[_0xd1bb('0x4')]},'exitAt':{'type':Sequelize[_0xd1bb('0x4')]},'reason':{'type':Sequelize[_0xd1bb('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 9689872..79121c2 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 _0xe663=['request-promise','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','reject','save','then','destroy','end','error','stack','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','update','describe','html-pdf','zip-dir','fast-json-patch'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0xe663,0x12d));var _0x3e66=function(_0x32ea48,_0x2c4d9a){_0x32ea48=_0x32ea48-0x0;var _0x2e2152=_0xe663[_0x32ea48];return _0x2e2152;};'use strict';var pdf=require(_0x3e66('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3e66('0x1'));var jsonpatch=require(_0x3e66('0x2'));var rp=require(_0x3e66('0x3'));var moment=require(_0x3e66('0x4'));var BPromise=require(_0x3e66('0x5'));var Mustache=require(_0x3e66('0x6'));var util=require(_0x3e66('0x7'));var path=require(_0x3e66('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3e66('0x9'));var squel=require('squel');var crypto=require(_0x3e66('0xa'));var jsforce=require(_0x3e66('0xb'));var deskjs=require(_0x3e66('0xc'));var toCsv=require(_0x3e66('0xd'));var querystring=require(_0x3e66('0xe'));var Papa=require('papaparse');var Redis=require(_0x3e66('0xf'));var authService=require(_0x3e66('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3e66('0x11'));var hardwareService=require(_0x3e66('0x12'));var logger=require(_0x3e66('0x13'))(_0x3e66('0x14'));var utils=require(_0x3e66('0x15'));var config=require(_0x3e66('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e66('0x17'))['db'];function respondWithStatusCode(_0x2192ac,_0x47d2d4){_0x47d2d4=_0x47d2d4||0xcc;return function(_0x396517){if(_0x396517){return _0x2192ac[_0x3e66('0x18')](_0x47d2d4);}return _0x2192ac[_0x3e66('0x19')](_0x47d2d4)['end']();};}function respondWithResult(_0x1e0a9b,_0x1b6507){_0x1b6507=_0x1b6507||0xc8;return function(_0x11add6){if(_0x11add6){return _0x1e0a9b['status'](_0x1b6507)[_0x3e66('0x1a')](_0x11add6);}};}function respondWithFilteredResult(_0x232fac,_0x3f019d){return function(_0x27579a){if(_0x27579a){var _0x47428=_0x27579a[_0x3e66('0x1b')],_0x2c408b=_0x3f019d['offset'],_0x3657e9=_0x3f019d['offset']+_0x3f019d[_0x3e66('0x1c')],_0xf2263e;if(_0x3657e9>=_0x47428){_0x3657e9=_0x47428;_0xf2263e=0xc8;}else{_0xf2263e=0xce;}_0x232fac['status'](_0xf2263e);return _0x232fac[_0x3e66('0x1d')](_0x3e66('0x1e'),_0x2c408b+'-'+_0x3657e9+'/'+_0x47428)['json'](_0x27579a);}return null;};}function patchUpdates(_0x45b67f){return function(_0x25b1cf){try{jsonpatch['apply'](_0x25b1cf,_0x45b67f,!![]);}catch(_0x247709){return BPromise[_0x3e66('0x1f')](_0x247709);}return _0x25b1cf[_0x3e66('0x20')]();};}function saveUpdates(_0x3f3810,_0x51e738){return function(_0x24c065){if(_0x24c065){return _0x24c065['update'](_0x3f3810)[_0x3e66('0x21')](function(_0x4fdfd7){return _0x4fdfd7;});}return null;};}function removeEntity(_0x1e1d8b,_0x2dc5b7){return function(_0xb4a40d){if(_0xb4a40d){return _0xb4a40d[_0x3e66('0x22')]()[_0x3e66('0x21')](function(){_0x1e1d8b['status'](0xcc)[_0x3e66('0x23')]();});}};}function handleEntityNotFound(_0x47633d,_0x272c68){return function(_0x290194){if(!_0x290194){_0x47633d['sendStatus'](0x194);}return _0x290194;};}function handleError(_0x2b6f70,_0x3f393a){_0x3f393a=_0x3f393a||0x1f4;return function(_0x11a93a){logger[_0x3e66('0x24')](_0x11a93a[_0x3e66('0x25')]);if(_0x11a93a['name']){delete _0x11a93a['name'];}_0x2b6f70[_0x3e66('0x19')](_0x3f393a)[_0x3e66('0x26')](_0x11a93a);};}exports[_0x3e66('0x27')]=function(_0x5afd7e,_0x3050c0){var _0x17faad={},_0x32cb8c={},_0x4c34a9={'count':0x0,'rows':[]};var _0x531ec3=_[_0x3e66('0x28')](db[_0x3e66('0x29')][_0x3e66('0x2a')],function(_0x2ac942){return{'name':_0x2ac942[_0x3e66('0x2b')],'type':_0x2ac942['type'][_0x3e66('0x2c')]};});_0x32cb8c[_0x3e66('0x2d')]=_[_0x3e66('0x28')](_0x531ec3,_0x3e66('0x2e'));_0x32cb8c[_0x3e66('0x2f')]=_['keys'](_0x5afd7e[_0x3e66('0x2f')]);_0x32cb8c[_0x3e66('0x30')]=_[_0x3e66('0x31')](_0x32cb8c[_0x3e66('0x2d')],_0x32cb8c[_0x3e66('0x2f')]);_0x17faad[_0x3e66('0x32')]=_['intersection'](_0x32cb8c['model'],qs[_0x3e66('0x33')](_0x5afd7e[_0x3e66('0x2f')][_0x3e66('0x33')]));_0x17faad['attributes']=_0x17faad[_0x3e66('0x32')][_0x3e66('0x34')]?_0x17faad[_0x3e66('0x32')]:_0x32cb8c[_0x3e66('0x2d')];if(!_0x5afd7e[_0x3e66('0x2f')][_0x3e66('0x35')](_0x3e66('0x36'))){_0x17faad[_0x3e66('0x1c')]=qs['limit'](_0x5afd7e[_0x3e66('0x2f')][_0x3e66('0x1c')]);_0x17faad['offset']=qs[_0x3e66('0x37')](_0x5afd7e['query'][_0x3e66('0x37')]);}_0x17faad[_0x3e66('0x38')]=qs[_0x3e66('0x39')](_0x5afd7e[_0x3e66('0x2f')][_0x3e66('0x39')]);_0x17faad[_0x3e66('0x3a')]=qs['filters'](_['pick'](_0x5afd7e['query'],_0x32cb8c[_0x3e66('0x30')]),_0x531ec3);if(_0x5afd7e[_0x3e66('0x2f')][_0x3e66('0x3b')]){_0x17faad[_0x3e66('0x3a')]=_[_0x3e66('0x3c')](_0x17faad[_0x3e66('0x3a')],{'$or':_['map'](_0x531ec3,function(_0x174965){if(_0x174965['type']!==_0x3e66('0x3d')){var _0x4ef93b={};_0x4ef93b[_0x174965[_0x3e66('0x2e')]]={'$like':'%'+_0x5afd7e[_0x3e66('0x2f')]['filter']+'%'};return _0x4ef93b;}})});}_0x17faad=_[_0x3e66('0x3c')]({},_0x17faad,_0x5afd7e['options']);var _0x3df012={'where':_0x17faad[_0x3e66('0x3a')]};return db[_0x3e66('0x29')][_0x3e66('0x1b')](_0x3df012)[_0x3e66('0x21')](function(_0x475b3e){_0x4c34a9[_0x3e66('0x1b')]=_0x475b3e;if(_0x5afd7e[_0x3e66('0x2f')][_0x3e66('0x3e')]){_0x17faad[_0x3e66('0x3f')]=[{'all':!![]}];}return db[_0x3e66('0x29')][_0x3e66('0x40')](_0x17faad);})[_0x3e66('0x21')](function(_0x204b64){_0x4c34a9[_0x3e66('0x41')]=_0x204b64;return _0x4c34a9;})[_0x3e66('0x21')](respondWithFilteredResult(_0x3050c0,_0x17faad))[_0x3e66('0x42')](handleError(_0x3050c0,null));};exports[_0x3e66('0x43')]=function(_0x10c5dc,_0x4aba23){var _0x200c6e={'raw':!![],'where':{'id':_0x10c5dc[_0x3e66('0x44')]['id']}},_0x14d280={};_0x14d280[_0x3e66('0x2d')]=_['keys'](db[_0x3e66('0x29')]['rawAttributes']);_0x14d280['query']=_[_0x3e66('0x45')](_0x10c5dc[_0x3e66('0x2f')]);_0x14d280[_0x3e66('0x30')]=_[_0x3e66('0x31')](_0x14d280[_0x3e66('0x2d')],_0x14d280['query']);_0x200c6e[_0x3e66('0x32')]=_['intersection'](_0x14d280['model'],qs[_0x3e66('0x33')](_0x10c5dc[_0x3e66('0x2f')][_0x3e66('0x33')]));_0x200c6e[_0x3e66('0x32')]=_0x200c6e[_0x3e66('0x32')][_0x3e66('0x34')]?_0x200c6e[_0x3e66('0x32')]:_0x14d280[_0x3e66('0x2d')];if(_0x10c5dc['query'][_0x3e66('0x3e')]){_0x200c6e[_0x3e66('0x3f')]=[{'all':!![]}];}_0x200c6e=_[_0x3e66('0x3c')]({},_0x200c6e,_0x10c5dc[_0x3e66('0x46')]);return db[_0x3e66('0x29')][_0x3e66('0x47')](_0x200c6e)[_0x3e66('0x21')](handleEntityNotFound(_0x4aba23,null))[_0x3e66('0x21')](respondWithResult(_0x4aba23,null))[_0x3e66('0x42')](handleError(_0x4aba23,null));};exports[_0x3e66('0x48')]=function(_0x3188c2,_0x4f7261){return db[_0x3e66('0x29')][_0x3e66('0x48')](_0x3188c2[_0x3e66('0x49')],{})[_0x3e66('0x21')](respondWithResult(_0x4f7261,0xc9))[_0x3e66('0x42')](handleError(_0x4f7261,null));};exports[_0x3e66('0x4a')]=function(_0x372b56,_0x2fdbe3){if(_0x372b56['body']['id']){delete _0x372b56['body']['id'];}return db[_0x3e66('0x29')][_0x3e66('0x47')]({'where':{'id':_0x372b56['params']['id']}})['then'](handleEntityNotFound(_0x2fdbe3,null))[_0x3e66('0x21')](saveUpdates(_0x372b56['body'],null))['then'](respondWithResult(_0x2fdbe3,null))['catch'](handleError(_0x2fdbe3,null));};exports[_0x3e66('0x22')]=function(_0x50f49e,_0x3f7786){return db['SmsQueueReport']['find']({'where':{'id':_0x50f49e[_0x3e66('0x44')]['id']}})[_0x3e66('0x21')](handleEntityNotFound(_0x3f7786,null))['then'](removeEntity(_0x3f7786,null))[_0x3e66('0x42')](handleError(_0x3f7786,null));};exports[_0x3e66('0x4b')]=function(_0x5bb24c,_0x32f7c2){return db[_0x3e66('0x29')][_0x3e66('0x4b')]()[_0x3e66('0x21')](respondWithResult(_0x32f7c2,null))[_0x3e66('0x42')](handleError(_0x32f7c2,null));}; \ No newline at end of file +var _0xdd20=['offset','limit','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','SmsQueueReport','fieldName','type','key','model','query','filters','attributes','intersection','length','order','sort','where','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','fields','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xdd20,0xbd));var _0x0dd2=function(_0x31d890,_0x5ce590){_0x31d890=_0x31d890-0x0;var _0x5aa93b=_0xdd20[_0x31d890];return _0x5aa93b;};'use strict';var pdf=require(_0x0dd2('0x0'));var emlformat=require(_0x0dd2('0x1'));var rimraf=require(_0x0dd2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0dd2('0x3'));var rp=require(_0x0dd2('0x4'));var moment=require(_0x0dd2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0dd2('0x6'));var util=require(_0x0dd2('0x7'));var path=require(_0x0dd2('0x8'));var sox=require(_0x0dd2('0x9'));var csv=require(_0x0dd2('0xa'));var ejs=require(_0x0dd2('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0dd2('0xc'));var crypto=require(_0x0dd2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0dd2('0xe'));var toCsv=require(_0x0dd2('0xa'));var querystring=require('querystring');var Papa=require(_0x0dd2('0xf'));var Redis=require(_0x0dd2('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0dd2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0dd2('0x12'))('api');var utils=require(_0x0dd2('0x13'));var config=require(_0x0dd2('0x14'));var licenseUtil=require(_0x0dd2('0x15'));var db=require(_0x0dd2('0x16'))['db'];function respondWithStatusCode(_0x195b93,_0x1efdc6){_0x1efdc6=_0x1efdc6||0xcc;return function(_0x581688){if(_0x581688){return _0x195b93[_0x0dd2('0x17')](_0x1efdc6);}return _0x195b93[_0x0dd2('0x18')](_0x1efdc6)['end']();};}function respondWithResult(_0x53ce24,_0x59d948){_0x59d948=_0x59d948||0xc8;return function(_0x10b23a){if(_0x10b23a){return _0x53ce24['status'](_0x59d948)[_0x0dd2('0x19')](_0x10b23a);}};}function respondWithFilteredResult(_0x1dcc9d,_0x18a584){return function(_0x53ebb7){if(_0x53ebb7){var _0x609b42=_0x53ebb7[_0x0dd2('0x1a')],_0x2ab06c=_0x18a584['offset'],_0x23eff8=_0x18a584[_0x0dd2('0x1b')]+_0x18a584[_0x0dd2('0x1c')],_0xb12d73;if(_0x23eff8>=_0x609b42){_0x23eff8=_0x609b42;_0xb12d73=0xc8;}else{_0xb12d73=0xce;}_0x1dcc9d[_0x0dd2('0x18')](_0xb12d73);return _0x1dcc9d[_0x0dd2('0x1d')](_0x0dd2('0x1e'),_0x2ab06c+'-'+_0x23eff8+'/'+_0x609b42)[_0x0dd2('0x19')](_0x53ebb7);}return null;};}function patchUpdates(_0x6a727d){return function(_0x27fca7){try{jsonpatch[_0x0dd2('0x1f')](_0x27fca7,_0x6a727d,!![]);}catch(_0x138e0d){return BPromise['reject'](_0x138e0d);}return _0x27fca7[_0x0dd2('0x20')]();};}function saveUpdates(_0x279c8f,_0x57eacd){return function(_0x3016e1){if(_0x3016e1){return _0x3016e1[_0x0dd2('0x21')](_0x279c8f)['then'](function(_0x2c8cf9){return _0x2c8cf9;});}return null;};}function removeEntity(_0x2f1fcc,_0x182831){return function(_0x9f1951){if(_0x9f1951){return _0x9f1951[_0x0dd2('0x22')]()[_0x0dd2('0x23')](function(){_0x2f1fcc[_0x0dd2('0x18')](0xcc)[_0x0dd2('0x24')]();});}};}function handleEntityNotFound(_0x4a0ed4,_0x4f7219){return function(_0x2081e1){if(!_0x2081e1){_0x4a0ed4[_0x0dd2('0x17')](0x194);}return _0x2081e1;};}function handleError(_0x51a58a,_0x5c5bd2){_0x5c5bd2=_0x5c5bd2||0x1f4;return function(_0x453904){logger[_0x0dd2('0x25')](_0x453904[_0x0dd2('0x26')]);if(_0x453904[_0x0dd2('0x27')]){delete _0x453904[_0x0dd2('0x27')];}_0x51a58a[_0x0dd2('0x18')](_0x5c5bd2)[_0x0dd2('0x28')](_0x453904);};}exports[_0x0dd2('0x29')]=function(_0x42eab3,_0x3637dc){var _0x183445={},_0x1b2ba9={},_0x2db4f0={'count':0x0,'rows':[]};var _0x17fcaa=_['map'](db[_0x0dd2('0x2a')]['rawAttributes'],function(_0x215cfc){return{'name':_0x215cfc[_0x0dd2('0x2b')],'type':_0x215cfc[_0x0dd2('0x2c')][_0x0dd2('0x2d')]};});_0x1b2ba9[_0x0dd2('0x2e')]=_['map'](_0x17fcaa,_0x0dd2('0x27'));_0x1b2ba9[_0x0dd2('0x2f')]=_['keys'](_0x42eab3['query']);_0x1b2ba9[_0x0dd2('0x30')]=_['intersection'](_0x1b2ba9[_0x0dd2('0x2e')],_0x1b2ba9[_0x0dd2('0x2f')]);_0x183445[_0x0dd2('0x31')]=_[_0x0dd2('0x32')](_0x1b2ba9[_0x0dd2('0x2e')],qs['fields'](_0x42eab3[_0x0dd2('0x2f')]['fields']));_0x183445['attributes']=_0x183445[_0x0dd2('0x31')][_0x0dd2('0x33')]?_0x183445['attributes']:_0x1b2ba9[_0x0dd2('0x2e')];if(!_0x42eab3[_0x0dd2('0x2f')]['hasOwnProperty']('nolimit')){_0x183445['limit']=qs[_0x0dd2('0x1c')](_0x42eab3[_0x0dd2('0x2f')]['limit']);_0x183445[_0x0dd2('0x1b')]=qs[_0x0dd2('0x1b')](_0x42eab3[_0x0dd2('0x2f')]['offset']);}_0x183445[_0x0dd2('0x34')]=qs[_0x0dd2('0x35')](_0x42eab3[_0x0dd2('0x2f')][_0x0dd2('0x35')]);_0x183445[_0x0dd2('0x36')]=qs[_0x0dd2('0x30')](_['pick'](_0x42eab3[_0x0dd2('0x2f')],_0x1b2ba9[_0x0dd2('0x30')]),_0x17fcaa);if(_0x42eab3[_0x0dd2('0x2f')][_0x0dd2('0x37')]){_0x183445[_0x0dd2('0x36')]=_[_0x0dd2('0x38')](_0x183445[_0x0dd2('0x36')],{'$or':_[_0x0dd2('0x39')](_0x17fcaa,function(_0x21e133){if(_0x21e133['type']!=='VIRTUAL'){var _0x115388={};_0x115388[_0x21e133['name']]={'$like':'%'+_0x42eab3['query'][_0x0dd2('0x37')]+'%'};return _0x115388;}})});}_0x183445=_[_0x0dd2('0x38')]({},_0x183445,_0x42eab3[_0x0dd2('0x3a')]);var _0x289c7e={'where':_0x183445['where']};return db[_0x0dd2('0x2a')][_0x0dd2('0x1a')](_0x289c7e)['then'](function(_0x2cdf05){_0x2db4f0[_0x0dd2('0x1a')]=_0x2cdf05;if(_0x42eab3['query'][_0x0dd2('0x3b')]){_0x183445[_0x0dd2('0x3c')]=[{'all':!![]}];}return db[_0x0dd2('0x2a')][_0x0dd2('0x3d')](_0x183445);})[_0x0dd2('0x23')](function(_0x2b31a3){_0x2db4f0[_0x0dd2('0x3e')]=_0x2b31a3;return _0x2db4f0;})['then'](respondWithFilteredResult(_0x3637dc,_0x183445))[_0x0dd2('0x3f')](handleError(_0x3637dc,null));};exports[_0x0dd2('0x40')]=function(_0x5539d8,_0x56b867){var _0x4ca2b1={'raw':!![],'where':{'id':_0x5539d8[_0x0dd2('0x41')]['id']}},_0x5e2490={};_0x5e2490[_0x0dd2('0x2e')]=_[_0x0dd2('0x42')](db[_0x0dd2('0x2a')][_0x0dd2('0x43')]);_0x5e2490['query']=_[_0x0dd2('0x42')](_0x5539d8[_0x0dd2('0x2f')]);_0x5e2490['filters']=_['intersection'](_0x5e2490['model'],_0x5e2490[_0x0dd2('0x2f')]);_0x4ca2b1[_0x0dd2('0x31')]=_[_0x0dd2('0x32')](_0x5e2490[_0x0dd2('0x2e')],qs[_0x0dd2('0x44')](_0x5539d8[_0x0dd2('0x2f')][_0x0dd2('0x44')]));_0x4ca2b1[_0x0dd2('0x31')]=_0x4ca2b1[_0x0dd2('0x31')][_0x0dd2('0x33')]?_0x4ca2b1['attributes']:_0x5e2490[_0x0dd2('0x2e')];if(_0x5539d8[_0x0dd2('0x2f')][_0x0dd2('0x3b')]){_0x4ca2b1[_0x0dd2('0x3c')]=[{'all':!![]}];}_0x4ca2b1=_['merge']({},_0x4ca2b1,_0x5539d8[_0x0dd2('0x3a')]);return db['SmsQueueReport']['find'](_0x4ca2b1)['then'](handleEntityNotFound(_0x56b867,null))['then'](respondWithResult(_0x56b867,null))['catch'](handleError(_0x56b867,null));};exports['create']=function(_0x199fe0,_0x5334ae){return db[_0x0dd2('0x2a')]['create'](_0x199fe0['body'],{})['then'](respondWithResult(_0x5334ae,0xc9))[_0x0dd2('0x3f')](handleError(_0x5334ae,null));};exports['update']=function(_0xc275d0,_0x390207){if(_0xc275d0[_0x0dd2('0x45')]['id']){delete _0xc275d0[_0x0dd2('0x45')]['id'];}return db[_0x0dd2('0x2a')][_0x0dd2('0x46')]({'where':{'id':_0xc275d0['params']['id']}})[_0x0dd2('0x23')](handleEntityNotFound(_0x390207,null))['then'](saveUpdates(_0xc275d0['body'],null))['then'](respondWithResult(_0x390207,null))['catch'](handleError(_0x390207,null));};exports[_0x0dd2('0x22')]=function(_0x46bdca,_0x4ca3c4){return db[_0x0dd2('0x2a')][_0x0dd2('0x46')]({'where':{'id':_0x46bdca[_0x0dd2('0x41')]['id']}})[_0x0dd2('0x23')](handleEntityNotFound(_0x4ca3c4,null))[_0x0dd2('0x23')](removeEntity(_0x4ca3c4,null))[_0x0dd2('0x3f')](handleError(_0x4ca3c4,null));};exports[_0x0dd2('0x47')]=function(_0x26140c,_0xd0f420){return db[_0x0dd2('0x2a')][_0x0dd2('0x47')]()[_0x0dd2('0x23')](respondWithResult(_0xd0f420,null))[_0x0dd2('0x3f')](handleError(_0xd0f420,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index ae85c3c..d914eb0 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 _0x8039=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x16d895,_0x2be928){var _0x39d786=function(_0x40ff78){while(--_0x40ff78){_0x16d895['push'](_0x16d895['shift']());}};_0x39d786(++_0x2be928);}(_0x8039,0x14a));var _0x9803=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x8039[_0xbc346f];return _0x9f9260;};'use strict';var _=require(_0x9803('0x0'));var util=require(_0x9803('0x1'));var logger=require(_0x9803('0x2'))(_0x9803('0x3'));var moment=require(_0x9803('0x4'));var BPromise=require(_0x9803('0x5'));var rp=require(_0x9803('0x6'));var fs=require('fs');var path=require(_0x9803('0x7'));var rimraf=require(_0x9803('0x8'));var config=require(_0x9803('0x9'));var attributes=require('./smsQueueReport.attributes');module[_0x9803('0xa')]=function(_0x247903,_0x17d183){return _0x247903[_0x9803('0xb')](_0x9803('0xc'),attributes,{'tableName':_0x9803('0xd'),'paranoid':![],'indexes':[{'name':_0x9803('0xe'),'fields':[_0x9803('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa20=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','SmsQueueReport','report_sms_queue','uniqueid','lodash'];(function(_0x3da977,_0x194e29){var _0x1b4be6=function(_0x5cffd1){while(--_0x5cffd1){_0x3da977['push'](_0x3da977['shift']());}};_0x1b4be6(++_0x194e29);}(_0xfa20,0x141));var _0x0fa2=function(_0x49e533,_0x5daa8a){_0x49e533=_0x49e533-0x0;var _0x17769d=_0xfa20[_0x49e533];return _0x17769d;};'use strict';var _=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));var logger=require(_0x0fa2('0x2'))(_0x0fa2('0x3'));var moment=require(_0x0fa2('0x4'));var BPromise=require(_0x0fa2('0x5'));var rp=require(_0x0fa2('0x6'));var fs=require('fs');var path=require(_0x0fa2('0x7'));var rimraf=require(_0x0fa2('0x8'));var config=require(_0x0fa2('0x9'));var attributes=require(_0x0fa2('0xa'));module['exports']=function(_0x19387c,_0x2247e9){return _0x19387c['define'](_0x0fa2('0xb'),attributes,{'tableName':_0x0fa2('0xc'),'paranoid':![],'indexes':[{'name':_0x0fa2('0xd'),'fields':[_0x0fa2('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 33d5e0c..c978885 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 _0xd3fa=['lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','update','where','limit','UpdateSmsQueueReport'];(function(_0x55680e,_0xb76d61){var _0x18183a=function(_0x3ea21c){while(--_0x3ea21c){_0x55680e['push'](_0x55680e['shift']());}};_0x18183a(++_0xb76d61);}(_0xd3fa,0x176));var _0xad3f=function(_0x58ed4c,_0x14c986){_0x58ed4c=_0x58ed4c-0x0;var _0x12d61a=_0xd3fa[_0x58ed4c];return _0x12d61a;};'use strict';var _=require(_0xad3f('0x0'));var util=require('util');var moment=require(_0xad3f('0x1'));var BPromise=require(_0xad3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad3f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xad3f('0x4'));var logger=require(_0xad3f('0x5'))(_0xad3f('0x6'));var config=require(_0xad3f('0x7'));var jayson=require(_0xad3f('0x8'));var client=jayson[_0xad3f('0x9')][_0xad3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a63e3,_0x104937,_0x455087){return new BPromise(function(_0x3c6003,_0x1b05d1){return client[_0xad3f('0xb')](_0x2a63e3,_0x455087)[_0xad3f('0xc')](function(_0xd7027a){logger[_0xad3f('0xd')](_0xad3f('0xe'),_0x104937,_0xad3f('0xf'));logger['debug'](_0xad3f('0x10'),_0x104937,'request\x20sent',JSON[_0xad3f('0x11')](_0xd7027a));if(_0xd7027a[_0xad3f('0x12')]){if(_0xd7027a[_0xad3f('0x12')][_0xad3f('0x13')]===0x1f4){logger['error'](_0xad3f('0xe'),_0x104937,_0xd7027a['error'][_0xad3f('0x14')]);return _0x1b05d1(_0xd7027a[_0xad3f('0x12')][_0xad3f('0x14')]);}logger[_0xad3f('0x12')](_0xad3f('0xe'),_0x104937,_0xd7027a['error'][_0xad3f('0x14')]);return _0x3c6003(_0xd7027a[_0xad3f('0x12')][_0xad3f('0x14')]);}else{logger[_0xad3f('0xd')](_0xad3f('0xe'),_0x104937,_0xad3f('0xf'));_0x3c6003(_0xd7027a[_0xad3f('0x15')][_0xad3f('0x14')]);}})[_0xad3f('0x16')](function(_0x24a197){logger[_0xad3f('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x104937,_0x24a197);_0x1b05d1(_0x24a197);});});}exports[_0xad3f('0x17')]=function(_0x2b3bf5){var _0x52fb74=this;return new Promise(function(_0xa932f,_0x13ede9){return db[_0xad3f('0x18')][_0xad3f('0x19')](_0x2b3bf5[_0xad3f('0x1a')],{'raw':_0x2b3bf5[_0xad3f('0x1b')]?_0x2b3bf5[_0xad3f('0x1b')][_0xad3f('0x1c')]===undefined?!![]:![]:!![]})[_0xad3f('0xc')](function(_0x1036e4){logger[_0xad3f('0xd')](_0xad3f('0x17'),_0x2b3bf5);logger[_0xad3f('0x1d')](_0xad3f('0x17'),_0x2b3bf5,JSON['stringify'](_0x1036e4));_0xa932f(_0x1036e4);})['catch'](function(_0x2d7fcc){logger[_0xad3f('0x12')](_0xad3f('0x17'),_0x2d7fcc['message'],_0x2b3bf5);_0x13ede9(_0x52fb74['error'](0x1f4,_0x2d7fcc[_0xad3f('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0xedff81){var _0xd62bd1=this;return new Promise(function(_0x85ba1d,_0x391943){return db[_0xad3f('0x18')][_0xad3f('0x1e')](_0xedff81[_0xad3f('0x1a')],{'raw':_0xedff81['options']?_0xedff81['options'][_0xad3f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xedff81[_0xad3f('0x1b')]?_0xedff81[_0xad3f('0x1b')][_0xad3f('0x1f')]||null:null,'attributes':_0xedff81['options']?_0xedff81[_0xad3f('0x1b')]['attributes']||null:null,'limit':_0xedff81['options']?_0xedff81[_0xad3f('0x1b')][_0xad3f('0x20')]||null:null})[_0xad3f('0xc')](function(_0x15f0ca){logger[_0xad3f('0xd')](_0xad3f('0x21'),_0xedff81);logger['debug'](_0xad3f('0x21'),_0xedff81,JSON['stringify'](_0x15f0ca));_0x85ba1d(_0x15f0ca);})[_0xad3f('0x16')](function(_0x47ff72){logger[_0xad3f('0x12')](_0xad3f('0x21'),_0x47ff72[_0xad3f('0x14')],_0xedff81);_0x391943(_0xd62bd1[_0xad3f('0x12')](0x1f4,_0x47ff72[_0xad3f('0x14')]));});});}; \ No newline at end of file +var _0xb509=['CreateSmsQueueReport','SmsQueueReport','create','body','options','then','stringify','UpdateSmsQueueReport','raw','where','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch'];(function(_0x2a4cc4,_0x3517c9){var _0x380509=function(_0x5b8194){while(--_0x5b8194){_0x2a4cc4['push'](_0x2a4cc4['shift']());}};_0x380509(++_0x3517c9);}(_0xb509,0xa6));var _0x9b50=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xb509[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0x9b50('0x0'));var util=require(_0x9b50('0x1'));var moment=require('moment');var BPromise=require(_0x9b50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b50('0x3'));var db=require(_0x9b50('0x4'))['db'];var utils=require(_0x9b50('0x5'));var logger=require(_0x9b50('0x6'))('rpc');var config=require(_0x9b50('0x7'));var jayson=require(_0x9b50('0x8'));var client=jayson[_0x9b50('0x9')][_0x9b50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf6f913,_0x1d4434,_0x22f97c){return new BPromise(function(_0x3cf11d,_0x4df28b){return client[_0x9b50('0xb')](_0xf6f913,_0x22f97c)['then'](function(_0x53bae6){logger[_0x9b50('0xc')](_0x9b50('0xd'),_0x1d4434,_0x9b50('0xe'));logger[_0x9b50('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1d4434,_0x9b50('0xe'),JSON['stringify'](_0x53bae6));if(_0x53bae6[_0x9b50('0x10')]){if(_0x53bae6['error'][_0x9b50('0x11')]===0x1f4){logger['error'](_0x9b50('0xd'),_0x1d4434,_0x53bae6[_0x9b50('0x10')][_0x9b50('0x12')]);return _0x4df28b(_0x53bae6[_0x9b50('0x10')][_0x9b50('0x12')]);}logger['error'](_0x9b50('0xd'),_0x1d4434,_0x53bae6[_0x9b50('0x10')][_0x9b50('0x12')]);return _0x3cf11d(_0x53bae6[_0x9b50('0x10')][_0x9b50('0x12')]);}else{logger[_0x9b50('0xc')](_0x9b50('0xd'),_0x1d4434,_0x9b50('0xe'));_0x3cf11d(_0x53bae6['result'][_0x9b50('0x12')]);}})[_0x9b50('0x13')](function(_0x2b5759){logger['error'](_0x9b50('0xd'),_0x1d4434,_0x2b5759);_0x4df28b(_0x2b5759);});});}exports[_0x9b50('0x14')]=function(_0xbee98){var _0x261a4d=this;return new Promise(function(_0x3ed88d,_0xebc1a){return db[_0x9b50('0x15')][_0x9b50('0x16')](_0xbee98[_0x9b50('0x17')],{'raw':_0xbee98[_0x9b50('0x18')]?_0xbee98[_0x9b50('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9b50('0x19')](function(_0x5c57a3){logger[_0x9b50('0xc')](_0x9b50('0x14'),_0xbee98);logger['debug'](_0x9b50('0x14'),_0xbee98,JSON[_0x9b50('0x1a')](_0x5c57a3));_0x3ed88d(_0x5c57a3);})[_0x9b50('0x13')](function(_0x4e637d){logger['error']('CreateSmsQueueReport',_0x4e637d[_0x9b50('0x12')],_0xbee98);_0xebc1a(_0x261a4d['error'](0x1f4,_0x4e637d[_0x9b50('0x12')]));});});};exports[_0x9b50('0x1b')]=function(_0x1c3f26){var _0x5daec4=this;return new Promise(function(_0x480be5,_0xf262a5){return db[_0x9b50('0x15')]['update'](_0x1c3f26[_0x9b50('0x17')],{'raw':_0x1c3f26['options']?_0x1c3f26[_0x9b50('0x18')][_0x9b50('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c3f26['options']?_0x1c3f26[_0x9b50('0x18')][_0x9b50('0x1d')]||null:null,'attributes':_0x1c3f26[_0x9b50('0x18')]?_0x1c3f26[_0x9b50('0x18')]['attributes']||null:null,'limit':_0x1c3f26['options']?_0x1c3f26[_0x9b50('0x18')][_0x9b50('0x1e')]||null:null})['then'](function(_0x1a0ccf){logger[_0x9b50('0xc')]('UpdateSmsQueueReport',_0x1c3f26);logger[_0x9b50('0xf')](_0x9b50('0x1b'),_0x1c3f26,JSON['stringify'](_0x1a0ccf));_0x480be5(_0x1a0ccf);})[_0x9b50('0x13')](function(_0x1aa8b3){logger[_0x9b50('0x10')]('UpdateSmsQueueReport',_0x1aa8b3[_0x9b50('0x12')],_0x1c3f26);_0xf262a5(_0x5daec4[_0x9b50('0x10')](0x1f4,_0x1aa8b3[_0x9b50('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c663ae2..a93815a 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 _0x4213=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post'];(function(_0x409c8b,_0x4892d4){var _0x430500=function(_0x386132){while(--_0x386132){_0x409c8b['push'](_0x409c8b['shift']());}};_0x430500(++_0x4892d4);}(_0x4213,0x77));var _0x3421=function(_0x1946aa,_0x493b74){_0x1946aa=_0x1946aa-0x0;var _0x3c4133=_0x4213[_0x1946aa];return _0x3c4133;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var auth=require(_0x3421('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3421('0x7'));var controller=require('./smsTransferReport.controller');router[_0x3421('0x8')]('/',auth[_0x3421('0x9')](),controller[_0x3421('0xa')]);router[_0x3421('0x8')]('/describe',auth[_0x3421('0x9')](),controller[_0x3421('0xb')]);router[_0x3421('0x8')](_0x3421('0xc'),auth[_0x3421('0x9')](),controller['show']);router[_0x3421('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3421('0xe')]('/:id',auth[_0x3421('0x9')](),controller[_0x3421('0xf')]);router[_0x3421('0x10')](_0x3421('0xc'),auth[_0x3421('0x9')](),controller[_0x3421('0x11')]);module[_0x3421('0x12')]=router; \ No newline at end of file +var _0xb58b=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0x42cc51,_0x11a024){var _0x38180b=function(_0x3bc481){while(--_0x3bc481){_0x42cc51['push'](_0x42cc51['shift']());}};_0x38180b(++_0x11a024);}(_0xb58b,0x1f1));var _0xbb58=function(_0x88d4ac,_0x5d7cb2){_0x88d4ac=_0x88d4ac-0x0;var _0x36207c=_0xb58b[_0x88d4ac];return _0x36207c;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var auth=require(_0xbb58('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbb58('0x5'));var controller=require('./smsTransferReport.controller');router[_0xbb58('0x6')]('/',auth[_0xbb58('0x7')](),controller[_0xbb58('0x8')]);router['get'](_0xbb58('0x9'),auth[_0xbb58('0x7')](),controller[_0xbb58('0xa')]);router[_0xbb58('0x6')](_0xbb58('0xb'),auth[_0xbb58('0x7')](),controller[_0xbb58('0xc')]);router[_0xbb58('0xd')]('/',auth[_0xbb58('0x7')](),controller[_0xbb58('0xe')]);router[_0xbb58('0xf')]('/:id',auth[_0xbb58('0x7')](),controller['update']);router[_0xbb58('0x10')](_0xbb58('0xb'),auth[_0xbb58('0x7')](),controller[_0xbb58('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 342d196..c589365 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 _0x349a=['NOW','moment','sequelize','STRING','ENUM','account','agent','queue','DATE'];(function(_0x9e3162,_0x4bca71){var _0x46f9f7=function(_0x5047f4){while(--_0x5047f4){_0x9e3162['push'](_0x9e3162['shift']());}};_0x46f9f7(++_0x4bca71);}(_0x349a,0x64));var _0xa349=function(_0x3f6426,_0x12cbf9){_0x3f6426=_0x3f6426-0x0;var _0x25d790=_0x349a[_0x3f6426];return _0x25d790;};'use strict';var moment=require(_0xa349('0x0'));var Sequelize=require(_0xa349('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa349('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x4'),_0xa349('0x5'),_0xa349('0x6')),'allowNull':![],'defaultValue':_0xa349('0x6')},'transferredAt':{'type':Sequelize[_0xa349('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xa349('0x8')]}}; \ No newline at end of file +var _0xf520=['queue','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x3b86f3,_0x38d7ea){var _0x14fe9a=function(_0x744b14){while(--_0x744b14){_0x3b86f3['push'](_0x3b86f3['shift']());}};_0x14fe9a(++_0x38d7ea);}(_0xf520,0xd2));var _0x0f52=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf520[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0x0f52('0x0'));var Sequelize=require(_0x0f52('0x1'));module[_0x0f52('0x2')]={'uniqueid':{'type':Sequelize[_0x0f52('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0f52('0x4'),_0x0f52('0x5'),'queue'),'allowNull':![],'defaultValue':_0x0f52('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x0f52('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 84ff156..b81f8cb 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 _0xf194=['find','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','then','destroy','end','error','stack','name','index','SmsTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','create','body'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xf194,0x91));var _0x4f19=function(_0x22d98e,_0x27bea7){_0x22d98e=_0x22d98e-0x0;var _0x15fa84=_0xf194[_0x22d98e];return _0x15fa84;};'use strict';var pdf=require(_0x4f19('0x0'));var emlformat=require(_0x4f19('0x1'));var rimraf=require(_0x4f19('0x2'));var zipdir=require(_0x4f19('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f19('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4f19('0x5'));var path=require(_0x4f19('0x6'));var sox=require(_0x4f19('0x7'));var csv=require('to-csv');var ejs=require(_0x4f19('0x8'));var fs=require('fs');var _=require(_0x4f19('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f19('0xa'));var deskjs=require(_0x4f19('0xb'));var toCsv=require(_0x4f19('0xc'));var querystring=require(_0x4f19('0xd'));var Papa=require('papaparse');var Redis=require(_0x4f19('0xe'));var authService=require(_0x4f19('0xf'));var qs=require(_0x4f19('0x10'));var as=require(_0x4f19('0x11'));var hardwareService=require(_0x4f19('0x12'));var logger=require(_0x4f19('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f19('0x14'));var db=require(_0x4f19('0x15'))['db'];function respondWithStatusCode(_0x5f4f1d,_0x6280a0){_0x6280a0=_0x6280a0||0xcc;return function(_0x26348c){if(_0x26348c){return _0x5f4f1d[_0x4f19('0x16')](_0x6280a0);}return _0x5f4f1d[_0x4f19('0x17')](_0x6280a0)['end']();};}function respondWithResult(_0x144e21,_0x25e5ce){_0x25e5ce=_0x25e5ce||0xc8;return function(_0x4b7198){if(_0x4b7198){return _0x144e21[_0x4f19('0x17')](_0x25e5ce)[_0x4f19('0x18')](_0x4b7198);}};}function respondWithFilteredResult(_0x5b77b1,_0x298562){return function(_0x55e1f8){if(_0x55e1f8){var _0x33bded=_0x55e1f8[_0x4f19('0x19')],_0x16405f=_0x298562[_0x4f19('0x1a')],_0x4b9c07=_0x298562[_0x4f19('0x1a')]+_0x298562['limit'],_0x4d8021;if(_0x4b9c07>=_0x33bded){_0x4b9c07=_0x33bded;_0x4d8021=0xc8;}else{_0x4d8021=0xce;}_0x5b77b1[_0x4f19('0x17')](_0x4d8021);return _0x5b77b1[_0x4f19('0x1b')](_0x4f19('0x1c'),_0x16405f+'-'+_0x4b9c07+'/'+_0x33bded)[_0x4f19('0x18')](_0x55e1f8);}return null;};}function patchUpdates(_0x4377b4){return function(_0x5915a2){try{jsonpatch[_0x4f19('0x1d')](_0x5915a2,_0x4377b4,!![]);}catch(_0xf4de7b){return BPromise['reject'](_0xf4de7b);}return _0x5915a2[_0x4f19('0x1e')]();};}function saveUpdates(_0x14ff93,_0x3312f8){return function(_0x327605){if(_0x327605){return _0x327605['update'](_0x14ff93)[_0x4f19('0x1f')](function(_0x142755){return _0x142755;});}return null;};}function removeEntity(_0x13cdcb,_0xcbe002){return function(_0x11a272){if(_0x11a272){return _0x11a272[_0x4f19('0x20')]()[_0x4f19('0x1f')](function(){_0x13cdcb[_0x4f19('0x17')](0xcc)[_0x4f19('0x21')]();});}};}function handleEntityNotFound(_0x10e164,_0x4531f4){return function(_0x2e2bf5){if(!_0x2e2bf5){_0x10e164[_0x4f19('0x16')](0x194);}return _0x2e2bf5;};}function handleError(_0x3457a4,_0x202965){_0x202965=_0x202965||0x1f4;return function(_0x39cb12){logger[_0x4f19('0x22')](_0x39cb12[_0x4f19('0x23')]);if(_0x39cb12[_0x4f19('0x24')]){delete _0x39cb12['name'];}_0x3457a4[_0x4f19('0x17')](_0x202965)['send'](_0x39cb12);};}exports[_0x4f19('0x25')]=function(_0x515956,_0x759454){var _0x5321a8={},_0x3aac82={},_0x22f4ad={'count':0x0,'rows':[]};var _0xc37e6f=_['map'](db[_0x4f19('0x26')][_0x4f19('0x27')],function(_0x2175ff){return{'name':_0x2175ff[_0x4f19('0x28')],'type':_0x2175ff[_0x4f19('0x29')]['key']};});_0x3aac82[_0x4f19('0x2a')]=_[_0x4f19('0x2b')](_0xc37e6f,'name');_0x3aac82[_0x4f19('0x2c')]=_[_0x4f19('0x2d')](_0x515956[_0x4f19('0x2c')]);_0x3aac82[_0x4f19('0x2e')]=_[_0x4f19('0x2f')](_0x3aac82[_0x4f19('0x2a')],_0x3aac82['query']);_0x5321a8[_0x4f19('0x30')]=_[_0x4f19('0x2f')](_0x3aac82[_0x4f19('0x2a')],qs['fields'](_0x515956[_0x4f19('0x2c')][_0x4f19('0x31')]));_0x5321a8[_0x4f19('0x30')]=_0x5321a8[_0x4f19('0x30')][_0x4f19('0x32')]?_0x5321a8[_0x4f19('0x30')]:_0x3aac82['model'];if(!_0x515956[_0x4f19('0x2c')][_0x4f19('0x33')]('nolimit')){_0x5321a8[_0x4f19('0x34')]=qs[_0x4f19('0x34')](_0x515956[_0x4f19('0x2c')][_0x4f19('0x34')]);_0x5321a8[_0x4f19('0x1a')]=qs[_0x4f19('0x1a')](_0x515956[_0x4f19('0x2c')]['offset']);}_0x5321a8[_0x4f19('0x35')]=qs[_0x4f19('0x36')](_0x515956[_0x4f19('0x2c')][_0x4f19('0x36')]);_0x5321a8[_0x4f19('0x37')]=qs[_0x4f19('0x2e')](_[_0x4f19('0x38')](_0x515956[_0x4f19('0x2c')],_0x3aac82[_0x4f19('0x2e')]),_0xc37e6f);if(_0x515956['query'][_0x4f19('0x39')]){_0x5321a8[_0x4f19('0x37')]=_[_0x4f19('0x3a')](_0x5321a8[_0x4f19('0x37')],{'$or':_[_0x4f19('0x2b')](_0xc37e6f,function(_0x5242cf){if(_0x5242cf['type']!==_0x4f19('0x3b')){var _0x216973={};_0x216973[_0x5242cf['name']]={'$like':'%'+_0x515956['query'][_0x4f19('0x39')]+'%'};return _0x216973;}})});}_0x5321a8=_[_0x4f19('0x3a')]({},_0x5321a8,_0x515956['options']);var _0x51e694={'where':_0x5321a8[_0x4f19('0x37')]};return db['SmsTransferReport'][_0x4f19('0x19')](_0x51e694)[_0x4f19('0x1f')](function(_0x23a565){_0x22f4ad[_0x4f19('0x19')]=_0x23a565;if(_0x515956[_0x4f19('0x2c')][_0x4f19('0x3c')]){_0x5321a8[_0x4f19('0x3d')]=[{'all':!![]}];}return db[_0x4f19('0x26')][_0x4f19('0x3e')](_0x5321a8);})['then'](function(_0x3c930a){_0x22f4ad['rows']=_0x3c930a;return _0x22f4ad;})[_0x4f19('0x1f')](respondWithFilteredResult(_0x759454,_0x5321a8))[_0x4f19('0x3f')](handleError(_0x759454,null));};exports[_0x4f19('0x40')]=function(_0x1c29a0,_0x26b18e){var _0x1690b0={'raw':!![],'where':{'id':_0x1c29a0['params']['id']}},_0x494362={};_0x494362[_0x4f19('0x2a')]=_[_0x4f19('0x2d')](db[_0x4f19('0x26')]['rawAttributes']);_0x494362[_0x4f19('0x2c')]=_[_0x4f19('0x2d')](_0x1c29a0[_0x4f19('0x2c')]);_0x494362['filters']=_[_0x4f19('0x2f')](_0x494362[_0x4f19('0x2a')],_0x494362[_0x4f19('0x2c')]);_0x1690b0['attributes']=_['intersection'](_0x494362[_0x4f19('0x2a')],qs[_0x4f19('0x31')](_0x1c29a0[_0x4f19('0x2c')]['fields']));_0x1690b0['attributes']=_0x1690b0[_0x4f19('0x30')][_0x4f19('0x32')]?_0x1690b0[_0x4f19('0x30')]:_0x494362[_0x4f19('0x2a')];if(_0x1c29a0[_0x4f19('0x2c')][_0x4f19('0x3c')]){_0x1690b0[_0x4f19('0x3d')]=[{'all':!![]}];}_0x1690b0=_[_0x4f19('0x3a')]({},_0x1690b0,_0x1c29a0[_0x4f19('0x41')]);return db[_0x4f19('0x26')]['find'](_0x1690b0)[_0x4f19('0x1f')](handleEntityNotFound(_0x26b18e,null))[_0x4f19('0x1f')](respondWithResult(_0x26b18e,null))[_0x4f19('0x3f')](handleError(_0x26b18e,null));};exports[_0x4f19('0x42')]=function(_0x1dec3c,_0x46ec9d){return db[_0x4f19('0x26')][_0x4f19('0x42')](_0x1dec3c[_0x4f19('0x43')],{})[_0x4f19('0x1f')](respondWithResult(_0x46ec9d,0xc9))[_0x4f19('0x3f')](handleError(_0x46ec9d,null));};exports['update']=function(_0x40a5b1,_0x48b026){if(_0x40a5b1['body']['id']){delete _0x40a5b1[_0x4f19('0x43')]['id'];}return db[_0x4f19('0x26')][_0x4f19('0x44')]({'where':{'id':_0x40a5b1[_0x4f19('0x45')]['id']}})['then'](handleEntityNotFound(_0x48b026,null))['then'](saveUpdates(_0x40a5b1['body'],null))['then'](respondWithResult(_0x48b026,null))['catch'](handleError(_0x48b026,null));};exports['destroy']=function(_0x5b72ad,_0x1f94f7){return db[_0x4f19('0x26')][_0x4f19('0x44')]({'where':{'id':_0x5b72ad[_0x4f19('0x45')]['id']}})[_0x4f19('0x1f')](handleEntityNotFound(_0x1f94f7,null))[_0x4f19('0x1f')](removeEntity(_0x1f94f7,null))['catch'](handleError(_0x1f94f7,null));};exports[_0x4f19('0x46')]=function(_0x20c979,_0xd4d63e){return db[_0x4f19('0x26')]['describe']()['then'](respondWithResult(_0xd4d63e,null))[_0x4f19('0x3f')](handleError(_0xd4d63e,null));}; \ No newline at end of file +var _0x851c=['then','destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','key','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0x851c,0x19d));var _0xc851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc851('0x0'));var emlformat=require(_0xc851('0x1'));var rimraf=require(_0xc851('0x2'));var zipdir=require(_0xc851('0x3'));var jsonpatch=require(_0xc851('0x4'));var rp=require(_0xc851('0x5'));var moment=require(_0xc851('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc851('0x7'));var util=require(_0xc851('0x8'));var path=require('path');var sox=require(_0xc851('0x9'));var csv=require(_0xc851('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc851('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc851('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc851('0xd'));var Papa=require(_0xc851('0xe'));var Redis=require(_0xc851('0xf'));var authService=require(_0xc851('0x10'));var qs=require(_0xc851('0x11'));var as=require(_0xc851('0x12'));var hardwareService=require(_0xc851('0x13'));var logger=require(_0xc851('0x14'))('api');var utils=require(_0xc851('0x15'));var config=require(_0xc851('0x16'));var licenseUtil=require(_0xc851('0x17'));var db=require(_0xc851('0x18'))['db'];function respondWithStatusCode(_0x46227a,_0xd918b6){_0xd918b6=_0xd918b6||0xcc;return function(_0x3301f8){if(_0x3301f8){return _0x46227a[_0xc851('0x19')](_0xd918b6);}return _0x46227a[_0xc851('0x1a')](_0xd918b6)[_0xc851('0x1b')]();};}function respondWithResult(_0x24d83a,_0x3fddbe){_0x3fddbe=_0x3fddbe||0xc8;return function(_0x35be4d){if(_0x35be4d){return _0x24d83a[_0xc851('0x1a')](_0x3fddbe)[_0xc851('0x1c')](_0x35be4d);}};}function respondWithFilteredResult(_0x458951,_0x5e67ee){return function(_0xc2be54){if(_0xc2be54){var _0x5ad5e1=_0xc2be54[_0xc851('0x1d')],_0x2b4839=_0x5e67ee[_0xc851('0x1e')],_0x5178ca=_0x5e67ee[_0xc851('0x1e')]+_0x5e67ee[_0xc851('0x1f')],_0x110261;if(_0x5178ca>=_0x5ad5e1){_0x5178ca=_0x5ad5e1;_0x110261=0xc8;}else{_0x110261=0xce;}_0x458951[_0xc851('0x1a')](_0x110261);return _0x458951[_0xc851('0x20')]('Content-Range',_0x2b4839+'-'+_0x5178ca+'/'+_0x5ad5e1)[_0xc851('0x1c')](_0xc2be54);}return null;};}function patchUpdates(_0x2c3cb1){return function(_0x543377){try{jsonpatch[_0xc851('0x21')](_0x543377,_0x2c3cb1,!![]);}catch(_0x628458){return BPromise[_0xc851('0x22')](_0x628458);}return _0x543377[_0xc851('0x23')]();};}function saveUpdates(_0x5ad006,_0x28fb91){return function(_0xfc72dc){if(_0xfc72dc){return _0xfc72dc[_0xc851('0x24')](_0x5ad006)[_0xc851('0x25')](function(_0x30e85f){return _0x30e85f;});}return null;};}function removeEntity(_0x4bcc4b,_0x5ad1b1){return function(_0x442271){if(_0x442271){return _0x442271[_0xc851('0x26')]()[_0xc851('0x25')](function(){_0x4bcc4b[_0xc851('0x1a')](0xcc)[_0xc851('0x1b')]();});}};}function handleEntityNotFound(_0x35525a,_0x57b70b){return function(_0x3f95d5){if(!_0x3f95d5){_0x35525a['sendStatus'](0x194);}return _0x3f95d5;};}function handleError(_0x5b44b2,_0x7a59cd){_0x7a59cd=_0x7a59cd||0x1f4;return function(_0x1d6bc4){logger['error'](_0x1d6bc4[_0xc851('0x27')]);if(_0x1d6bc4[_0xc851('0x28')]){delete _0x1d6bc4[_0xc851('0x28')];}_0x5b44b2['status'](_0x7a59cd)[_0xc851('0x29')](_0x1d6bc4);};}exports[_0xc851('0x2a')]=function(_0x283b10,_0xc34e1a){var _0x1a08a8={},_0x2fc8f1={},_0x3ebd7b={'count':0x0,'rows':[]};var _0x3d20eb=_[_0xc851('0x2b')](db[_0xc851('0x2c')][_0xc851('0x2d')],function(_0x13a826){return{'name':_0x13a826['fieldName'],'type':_0x13a826[_0xc851('0x2e')][_0xc851('0x2f')]};});_0x2fc8f1['model']=_[_0xc851('0x2b')](_0x3d20eb,'name');_0x2fc8f1['query']=_['keys'](_0x283b10[_0xc851('0x30')]);_0x2fc8f1['filters']=_[_0xc851('0x31')](_0x2fc8f1['model'],_0x2fc8f1[_0xc851('0x30')]);_0x1a08a8[_0xc851('0x32')]=_[_0xc851('0x31')](_0x2fc8f1[_0xc851('0x33')],qs[_0xc851('0x34')](_0x283b10[_0xc851('0x30')][_0xc851('0x34')]));_0x1a08a8[_0xc851('0x32')]=_0x1a08a8[_0xc851('0x32')][_0xc851('0x35')]?_0x1a08a8[_0xc851('0x32')]:_0x2fc8f1['model'];if(!_0x283b10[_0xc851('0x30')]['hasOwnProperty'](_0xc851('0x36'))){_0x1a08a8[_0xc851('0x1f')]=qs[_0xc851('0x1f')](_0x283b10[_0xc851('0x30')][_0xc851('0x1f')]);_0x1a08a8[_0xc851('0x1e')]=qs[_0xc851('0x1e')](_0x283b10['query']['offset']);}_0x1a08a8[_0xc851('0x37')]=qs[_0xc851('0x38')](_0x283b10['query']['sort']);_0x1a08a8[_0xc851('0x39')]=qs[_0xc851('0x3a')](_[_0xc851('0x3b')](_0x283b10['query'],_0x2fc8f1[_0xc851('0x3a')]),_0x3d20eb);if(_0x283b10[_0xc851('0x30')][_0xc851('0x3c')]){_0x1a08a8[_0xc851('0x39')]=_[_0xc851('0x3d')](_0x1a08a8[_0xc851('0x39')],{'$or':_[_0xc851('0x2b')](_0x3d20eb,function(_0x4b02b5){if(_0x4b02b5[_0xc851('0x2e')]!==_0xc851('0x3e')){var _0xe966e4={};_0xe966e4[_0x4b02b5[_0xc851('0x28')]]={'$like':'%'+_0x283b10[_0xc851('0x30')]['filter']+'%'};return _0xe966e4;}})});}_0x1a08a8=_[_0xc851('0x3d')]({},_0x1a08a8,_0x283b10[_0xc851('0x3f')]);var _0x2be2aa={'where':_0x1a08a8['where']};return db[_0xc851('0x2c')]['count'](_0x2be2aa)[_0xc851('0x25')](function(_0x4c29d7){_0x3ebd7b[_0xc851('0x1d')]=_0x4c29d7;if(_0x283b10['query'][_0xc851('0x40')]){_0x1a08a8[_0xc851('0x41')]=[{'all':!![]}];}return db[_0xc851('0x2c')]['findAll'](_0x1a08a8);})[_0xc851('0x25')](function(_0x6a80c2){_0x3ebd7b[_0xc851('0x42')]=_0x6a80c2;return _0x3ebd7b;})[_0xc851('0x25')](respondWithFilteredResult(_0xc34e1a,_0x1a08a8))['catch'](handleError(_0xc34e1a,null));};exports[_0xc851('0x43')]=function(_0x337047,_0x471f3d){var _0x546f5d={'raw':!![],'where':{'id':_0x337047[_0xc851('0x44')]['id']}},_0x4bc46b={};_0x4bc46b['model']=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x4bc46b[_0xc851('0x30')]=_[_0xc851('0x45')](_0x337047[_0xc851('0x30')]);_0x4bc46b[_0xc851('0x3a')]=_[_0xc851('0x31')](_0x4bc46b[_0xc851('0x33')],_0x4bc46b[_0xc851('0x30')]);_0x546f5d[_0xc851('0x32')]=_[_0xc851('0x31')](_0x4bc46b[_0xc851('0x33')],qs[_0xc851('0x34')](_0x337047[_0xc851('0x30')][_0xc851('0x34')]));_0x546f5d[_0xc851('0x32')]=_0x546f5d['attributes']['length']?_0x546f5d[_0xc851('0x32')]:_0x4bc46b['model'];if(_0x337047['query'][_0xc851('0x40')]){_0x546f5d[_0xc851('0x41')]=[{'all':!![]}];}_0x546f5d=_['merge']({},_0x546f5d,_0x337047['options']);return db[_0xc851('0x2c')][_0xc851('0x46')](_0x546f5d)['then'](handleEntityNotFound(_0x471f3d,null))[_0xc851('0x25')](respondWithResult(_0x471f3d,null))[_0xc851('0x47')](handleError(_0x471f3d,null));};exports['create']=function(_0x2d364f,_0x3188b5){return db[_0xc851('0x2c')][_0xc851('0x48')](_0x2d364f[_0xc851('0x49')],{})['then'](respondWithResult(_0x3188b5,0xc9))[_0xc851('0x47')](handleError(_0x3188b5,null));};exports[_0xc851('0x24')]=function(_0x2782ac,_0x51ff8f){if(_0x2782ac[_0xc851('0x49')]['id']){delete _0x2782ac[_0xc851('0x49')]['id'];}return db[_0xc851('0x2c')]['find']({'where':{'id':_0x2782ac['params']['id']}})[_0xc851('0x25')](handleEntityNotFound(_0x51ff8f,null))[_0xc851('0x25')](saveUpdates(_0x2782ac[_0xc851('0x49')],null))['then'](respondWithResult(_0x51ff8f,null))[_0xc851('0x47')](handleError(_0x51ff8f,null));};exports['destroy']=function(_0x370b58,_0x2b7fab){return db[_0xc851('0x2c')][_0xc851('0x46')]({'where':{'id':_0x370b58[_0xc851('0x44')]['id']}})[_0xc851('0x25')](handleEntityNotFound(_0x2b7fab,null))[_0xc851('0x25')](removeEntity(_0x2b7fab,null))[_0xc851('0x47')](handleError(_0x2b7fab,null));};exports['describe']=function(_0xc10f11,_0x29c0d3){return db['SmsTransferReport'][_0xc851('0x4a')]()[_0xc851('0x25')](respondWithResult(_0x29c0d3,null))[_0xc851('0x47')](handleError(_0x29c0d3,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index cb371f4..6114274 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 _0x6a55=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','moment','path','../../config/environment','exports','define'];(function(_0x2e2720,_0x1ae995){var _0x3f9d2d=function(_0x5067a2){while(--_0x5067a2){_0x2e2720['push'](_0x2e2720['shift']());}};_0x3f9d2d(++_0x1ae995);}(_0x6a55,0xdb));var _0x56a5=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0x6a55[_0x5c846d];return _0xd064e4;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./smsTransferReport.attributes');module[_0x56a5('0x4')]=function(_0x380b1b,_0x42d164){return _0x380b1b[_0x56a5('0x5')](_0x56a5('0x6'),attributes,{'tableName':_0x56a5('0x7'),'paranoid':![],'indexes':[{'name':_0x56a5('0x8'),'fields':[_0x56a5('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68b3=['moment','request-promise','path','rimraf','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x32c693,_0xd31779){var _0x554aac=function(_0x20b3ef){while(--_0x20b3ef){_0x32c693['push'](_0x32c693['shift']());}};_0x554aac(++_0xd31779);}(_0x68b3,0x1d8));var _0x368b=function(_0x653725,_0x347ff9){_0x653725=_0x653725-0x0;var _0xdb9c4b=_0x68b3[_0x653725];return _0xdb9c4b;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var logger=require(_0x368b('0x2'))(_0x368b('0x3'));var moment=require(_0x368b('0x4'));var BPromise=require('bluebird');var rp=require(_0x368b('0x5'));var fs=require('fs');var path=require(_0x368b('0x6'));var rimraf=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var attributes=require('./smsTransferReport.attributes');module[_0x368b('0x9')]=function(_0x41b15b,_0x104dad){return _0x41b15b[_0x368b('0xa')](_0x368b('0xb'),attributes,{'tableName':_0x368b('0xc'),'paranoid':![],'indexes':[{'name':_0x368b('0xd'),'fields':[_0x368b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index d7b01e0..244cd8d 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 _0x8582=['info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then'];(function(_0x27a06c,_0x3cb334){var _0x3ffa58=function(_0x1a10cb){while(--_0x1a10cb){_0x27a06c['push'](_0x27a06c['shift']());}};_0x3ffa58(++_0x3cb334);}(_0x8582,0x105));var _0x2858=function(_0xf829f6,_0x58a0c1){_0xf829f6=_0xf829f6-0x0;var _0x221de7=_0x8582[_0xf829f6];return _0x221de7;};'use strict';var _=require(_0x2858('0x0'));var util=require(_0x2858('0x1'));var moment=require(_0x2858('0x2'));var BPromise=require(_0x2858('0x3'));var rs=require(_0x2858('0x4'));var fs=require('fs');var Redis=require(_0x2858('0x5'));var db=require(_0x2858('0x6'))['db'];var utils=require(_0x2858('0x7'));var logger=require(_0x2858('0x8'))(_0x2858('0x9'));var config=require(_0x2858('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x526a85,_0x862396,_0xf006e7){return new BPromise(function(_0x492683,_0x1182e6){return client['request'](_0x526a85,_0xf006e7)[_0x2858('0xb')](function(_0x5cfc9a){logger[_0x2858('0xc')](_0x2858('0xd'),_0x862396,_0x2858('0xe'));logger['debug'](_0x2858('0xf'),_0x862396,_0x2858('0xe'),JSON[_0x2858('0x10')](_0x5cfc9a));if(_0x5cfc9a['error']){if(_0x5cfc9a['error'][_0x2858('0x11')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x862396,_0x5cfc9a['error'][_0x2858('0x12')]);return _0x1182e6(_0x5cfc9a[_0x2858('0x13')]['message']);}logger[_0x2858('0x13')](_0x2858('0xd'),_0x862396,_0x5cfc9a[_0x2858('0x13')]['message']);return _0x492683(_0x5cfc9a['error'][_0x2858('0x12')]);}else{logger[_0x2858('0xc')](_0x2858('0xd'),_0x862396,_0x2858('0xe'));_0x492683(_0x5cfc9a[_0x2858('0x14')][_0x2858('0x12')]);}})['catch'](function(_0x69eb52){logger[_0x2858('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x862396,_0x69eb52);_0x1182e6(_0x69eb52);});});} \ No newline at end of file +var _0x3c65=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3c65,0x1f2));var _0x53c6=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0x3c65[_0x4843f9];return _0x193c6a;};'use strict';var _=require(_0x53c6('0x0'));var util=require('util');var moment=require(_0x53c6('0x1'));var BPromise=require(_0x53c6('0x2'));var rs=require(_0x53c6('0x3'));var fs=require('fs');var Redis=require(_0x53c6('0x4'));var db=require(_0x53c6('0x5'))['db'];var utils=require(_0x53c6('0x6'));var logger=require(_0x53c6('0x7'))('rpc');var config=require(_0x53c6('0x8'));var jayson=require(_0x53c6('0x9'));var client=jayson['client'][_0x53c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b4f8c,_0x1fc224,_0x128a56){return new BPromise(function(_0xff22a3,_0x9418fa){return client['request'](_0x4b4f8c,_0x128a56)[_0x53c6('0xb')](function(_0x159edb){logger[_0x53c6('0xc')](_0x53c6('0xd'),_0x1fc224,'request\x20sent');logger['debug'](_0x53c6('0xe'),_0x1fc224,_0x53c6('0xf'),JSON[_0x53c6('0x10')](_0x159edb));if(_0x159edb[_0x53c6('0x11')]){if(_0x159edb[_0x53c6('0x11')]['code']===0x1f4){logger[_0x53c6('0x11')](_0x53c6('0xd'),_0x1fc224,_0x159edb[_0x53c6('0x11')][_0x53c6('0x12')]);return _0x9418fa(_0x159edb[_0x53c6('0x11')][_0x53c6('0x12')]);}logger[_0x53c6('0x11')](_0x53c6('0xd'),_0x1fc224,_0x159edb[_0x53c6('0x11')]['message']);return _0xff22a3(_0x159edb[_0x53c6('0x11')][_0x53c6('0x12')]);}else{logger[_0x53c6('0xc')](_0x53c6('0xd'),_0x1fc224,_0x53c6('0xf'));_0xff22a3(_0x159edb[_0x53c6('0x13')][_0x53c6('0x12')]);}})[_0x53c6('0x14')](function(_0x104c5e){logger[_0x53c6('0x11')](_0x53c6('0xd'),_0x1fc224,_0x104c5e);_0x9418fa(_0x104c5e);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 43acfca..ca9899c 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 _0x0593=['/:id/download','download','diskStorage','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','create','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x12111d,_0x30d9b4){var _0x14b510=function(_0x54dd27){while(--_0x54dd27){_0x12111d['push'](_0x12111d['shift']());}};_0x14b510(++_0x30d9b4);}(_0x0593,0x150));var _0x3059=function(_0x27796c,_0x13817c){_0x27796c=_0x27796c-0x0;var _0x1b67f6=_0x0593[_0x27796c];return _0x1b67f6;};'use strict';var multer=require(_0x3059('0x0'));var util=require(_0x3059('0x1'));var path=require(_0x3059('0x2'));var timeout=require(_0x3059('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x3059('0x4'));var interaction=require(_0x3059('0x5'));var config=require(_0x3059('0x6'));var controller=require('./sound.controller');router[_0x3059('0x7')]('/',auth[_0x3059('0x8')](),controller[_0x3059('0x9')]);router[_0x3059('0x7')](_0x3059('0xa'),auth['isAuthenticated'](),controller[_0x3059('0xb')]);router[_0x3059('0x7')](_0x3059('0xc'),auth[_0x3059('0x8')](),controller[_0x3059('0xd')]);var upload=multer({'storage':multer[_0x3059('0xe')]({'destination':function(_0x30e253,_0x15f1e8,_0x4ae8c1){_0x4ae8c1(null,path['join'](config['root'],_0x3059('0xf')));},'filename':function(_0x266ccf,_0x4f9c4,_0x159496){_0x4f9c4['originalname']=_0x4f9c4[_0x3059('0x10')][_0x3059('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x159496(null,util[_0x3059('0x12')](_0x3059('0x13'),path[_0x3059('0x14')](_0x4f9c4[_0x3059('0x10')],path['extname'](_0x4f9c4[_0x3059('0x10')])),Date[_0x3059('0x15')](),path[_0x3059('0x16')](_0x4f9c4[_0x3059('0x10')])));}})});router[_0x3059('0x17')]('/',upload[_0x3059('0x18')](_0x3059('0x19')),controller[_0x3059('0x1a')]);router['put'](_0x3059('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x3059('0x1b')]('/:id',auth[_0x3059('0x8')](),controller['delete']);module[_0x3059('0x1c')]=router; \ No newline at end of file +var _0xab47=['get','isAuthenticated','/:id','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','format','extname','post','single','file','create','put','update','delete','exports','multer','path','express','Router','../../components/auth/service'];(function(_0xd6c392,_0x273124){var _0x4afb67=function(_0x3c7d94){while(--_0x3c7d94){_0xd6c392['push'](_0xd6c392['shift']());}};_0x4afb67(++_0x273124);}(_0xab47,0x1bd));var _0x7ab4=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0xab47[_0x21b36c];return _0x236627;};'use strict';var multer=require(_0x7ab4('0x0'));var util=require('util');var path=require(_0x7ab4('0x1'));var timeout=require('connect-timeout');var express=require(_0x7ab4('0x2'));var router=express[_0x7ab4('0x3')]();var auth=require(_0x7ab4('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x7ab4('0x5')]('/',auth[_0x7ab4('0x6')](),controller['index']);router[_0x7ab4('0x5')](_0x7ab4('0x7'),auth[_0x7ab4('0x6')](),controller[_0x7ab4('0x8')]);router[_0x7ab4('0x5')](_0x7ab4('0x9'),auth[_0x7ab4('0x6')](),controller[_0x7ab4('0xa')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ec38c,_0x494f75,_0x5f51b8){_0x5f51b8(null,path[_0x7ab4('0xb')](config[_0x7ab4('0xc')],_0x7ab4('0xd')));},'filename':function(_0xb4ec19,_0x2e9a40,_0x1c9346){_0x2e9a40[_0x7ab4('0xe')]=_0x2e9a40['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1c9346(null,util[_0x7ab4('0xf')]('%s-%s%s',path['basename'](_0x2e9a40[_0x7ab4('0xe')],path[_0x7ab4('0x10')](_0x2e9a40[_0x7ab4('0xe')])),Date['now'](),path['extname'](_0x2e9a40[_0x7ab4('0xe')])));}})});router[_0x7ab4('0x11')]('/',upload[_0x7ab4('0x12')](_0x7ab4('0x13')),controller[_0x7ab4('0x14')]);router[_0x7ab4('0x15')](_0x7ab4('0x7'),auth[_0x7ab4('0x6')](),controller[_0x7ab4('0x16')]);router[_0x7ab4('0x17')](_0x7ab4('0x7'),auth[_0x7ab4('0x6')](),controller[_0x7ab4('0x17')]);module[_0x7ab4('0x18')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 774baba..fe176d7 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 _0x85f5=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x23ad48,_0x104b01){var _0x199a20=function(_0x4805d0){while(--_0x4805d0){_0x23ad48['push'](_0x23ad48['shift']());}};_0x199a20(++_0x104b01);}(_0x85f5,0x167));var _0x585f=function(_0x39010b,_0x17e844){_0x39010b=_0x39010b-0x0;var _0x3d8797=_0x85f5[_0x39010b];return _0x3d8797;};'use strict';var Sequelize=require(_0x585f('0x0'));module['exports']={'name':{'type':Sequelize[_0x585f('0x1')],'unique':_0x585f('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x585f('0x1')]},'display_name':{'type':Sequelize[_0x585f('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x585f('0x1')]},'original_duration':{'type':Sequelize[_0x585f('0x3')]},'original_sampleCount':{'type':Sequelize[_0x585f('0x4')]},'original_channelCount':{'type':Sequelize[_0x585f('0x5')]},'original_bitRate':{'type':Sequelize[_0x585f('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x585f('0x1')]},'converted_duration':{'type':Sequelize[_0x585f('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x585f('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe766=['FLOAT','sequelize','exports','STRING','name','BIGINT','INTEGER'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xe766,0x1c1));var _0x6e76=function(_0x5c3429,_0x305dbc){_0x5c3429=_0x5c3429-0x0;var _0x3e8263=_0xe766[_0x5c3429];return _0x3e8263;};'use strict';var Sequelize=require(_0x6e76('0x0'));module[_0x6e76('0x1')]={'name':{'type':Sequelize[_0x6e76('0x2')],'unique':_0x6e76('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x6e76('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x6e76('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x6e76('0x4')]},'original_channelCount':{'type':Sequelize[_0x6e76('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x6e76('0x5')]},'converted_format':{'type':Sequelize[_0x6e76('0x2')]},'converted_duration':{'type':Sequelize[_0x6e76('0x6')]},'converted_sampleCount':{'type':Sequelize[_0x6e76('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x6e76('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x6e76('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 2c9ab92..5d4123b 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 _0x4bd7=['order','sort','pick','filter','merge','where','VIRTUAL','options','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','extname','originalname','basename','filename','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_sampleCount','sampleCount','body','userProfileId','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','original_format','join','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','status','set','Content-Range','json','reject','save','then','destroy','get','Sounds','UserProfileResource','name','send','map','Sound','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x555c1e,_0x3f8176){var _0x556044=function(_0x1d1afc){while(--_0x1d1afc){_0x555c1e['push'](_0x555c1e['shift']());}};_0x556044(++_0x3f8176);}(_0x4bd7,0x1aa));var _0x74bd=function(_0x245e0e,_0xcab6db){_0x245e0e=_0x245e0e-0x0;var _0xafcff4=_0x4bd7[_0x245e0e];return _0xafcff4;};'use strict';var pdf=require(_0x74bd('0x0'));var emlformat=require(_0x74bd('0x1'));var rimraf=require(_0x74bd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x74bd('0x3'));var rp=require(_0x74bd('0x4'));var moment=require(_0x74bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x74bd('0x6'));var util=require('util');var path=require(_0x74bd('0x7'));var sox=require(_0x74bd('0x8'));var csv=require(_0x74bd('0x9'));var ejs=require(_0x74bd('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x74bd('0xb'));var deskjs=require(_0x74bd('0xc'));var toCsv=require(_0x74bd('0x9'));var querystring=require(_0x74bd('0xd'));var Papa=require('papaparse');var Redis=require(_0x74bd('0xe'));var authService=require(_0x74bd('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74bd('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x74bd('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x74bd('0x12'));var db=require(_0x74bd('0x13'))['db'];function respondWithStatusCode(_0xacba40,_0x3c93ea){_0x3c93ea=_0x3c93ea||0xcc;return function(_0x4f8216){if(_0x4f8216){return _0xacba40[_0x74bd('0x14')](_0x3c93ea);}return _0xacba40['status'](_0x3c93ea)[_0x74bd('0x15')]();};}function respondWithResult(_0x37ae2d,_0x29fade){_0x29fade=_0x29fade||0xc8;return function(_0x100417){if(_0x100417){return _0x37ae2d['status'](_0x29fade)['json'](_0x100417);}};}function respondWithFilteredResult(_0x3e266c,_0x214784){return function(_0x10f40a){if(_0x10f40a){var _0x1b9ad3=_0x10f40a['count'],_0x1f460b=_0x214784['offset'],_0x1a7b4a=_0x214784[_0x74bd('0x16')]+_0x214784[_0x74bd('0x17')],_0x55379b;if(_0x1a7b4a>=_0x1b9ad3){_0x1a7b4a=_0x1b9ad3;_0x55379b=0xc8;}else{_0x55379b=0xce;}_0x3e266c[_0x74bd('0x18')](_0x55379b);return _0x3e266c[_0x74bd('0x19')](_0x74bd('0x1a'),_0x1f460b+'-'+_0x1a7b4a+'/'+_0x1b9ad3)[_0x74bd('0x1b')](_0x10f40a);}return null;};}function patchUpdates(_0x19915a){return function(_0x11ee82){try{jsonpatch['apply'](_0x11ee82,_0x19915a,!![]);}catch(_0x57f459){return BPromise[_0x74bd('0x1c')](_0x57f459);}return _0x11ee82[_0x74bd('0x1d')]();};}function saveUpdates(_0x465ce7,_0x2faef5){return function(_0x2c9223){if(_0x2c9223){return _0x2c9223['update'](_0x465ce7)[_0x74bd('0x1e')](function(_0x41eea7){return _0x41eea7;});}return null;};}function removeEntity(_0x439ba8,_0x870918){return function(_0x114683){if(_0x114683){return _0x114683[_0x74bd('0x1f')]()[_0x74bd('0x1e')](function(){var _0x211c1f=_0x114683[_0x74bd('0x20')]({'plain':!![]});var _0x562178=_0x74bd('0x21');return db[_0x74bd('0x22')]['destroy']({'where':{'type':_0x562178,'resourceId':_0x211c1f['id']}})[_0x74bd('0x1e')](function(){return _0x114683;});})[_0x74bd('0x1e')](function(){_0x439ba8[_0x74bd('0x18')](0xcc)[_0x74bd('0x15')]();});}};}function handleEntityNotFound(_0x49e96c,_0x19d80d){return function(_0x2e63f5){if(!_0x2e63f5){_0x49e96c['sendStatus'](0x194);}return _0x2e63f5;};}function handleError(_0x3e0381,_0x11b530){_0x11b530=_0x11b530||0x1f4;return function(_0x21eb02){logger['error'](_0x21eb02['stack']);if(_0x21eb02[_0x74bd('0x23')]){delete _0x21eb02[_0x74bd('0x23')];}_0x3e0381[_0x74bd('0x18')](_0x11b530)[_0x74bd('0x24')](_0x21eb02);};}exports['index']=function(_0x24ecbe,_0x963ed8){var _0xf7ed14={},_0x48e30f={},_0x5480e9={'count':0x0,'rows':[]};var _0x3b0f3f=_[_0x74bd('0x25')](db[_0x74bd('0x26')]['rawAttributes'],function(_0x178f28){return{'name':_0x178f28['fieldName'],'type':_0x178f28[_0x74bd('0x27')][_0x74bd('0x28')]};});_0x48e30f[_0x74bd('0x29')]=_[_0x74bd('0x25')](_0x3b0f3f,_0x74bd('0x23'));_0x48e30f[_0x74bd('0x2a')]=_[_0x74bd('0x2b')](_0x24ecbe[_0x74bd('0x2a')]);_0x48e30f[_0x74bd('0x2c')]=_[_0x74bd('0x2d')](_0x48e30f[_0x74bd('0x29')],_0x48e30f[_0x74bd('0x2a')]);_0xf7ed14[_0x74bd('0x2e')]=_[_0x74bd('0x2d')](_0x48e30f[_0x74bd('0x29')],qs[_0x74bd('0x2f')](_0x24ecbe[_0x74bd('0x2a')]['fields']));_0xf7ed14['attributes']=_0xf7ed14[_0x74bd('0x2e')][_0x74bd('0x30')]?_0xf7ed14['attributes']:_0x48e30f['model'];if(!_0x24ecbe[_0x74bd('0x2a')]['hasOwnProperty'](_0x74bd('0x31'))){_0xf7ed14['limit']=qs[_0x74bd('0x17')](_0x24ecbe[_0x74bd('0x2a')][_0x74bd('0x17')]);_0xf7ed14[_0x74bd('0x16')]=qs[_0x74bd('0x16')](_0x24ecbe[_0x74bd('0x2a')][_0x74bd('0x16')]);}_0xf7ed14[_0x74bd('0x32')]=qs[_0x74bd('0x33')](_0x24ecbe['query'][_0x74bd('0x33')]);_0xf7ed14['where']=qs[_0x74bd('0x2c')](_[_0x74bd('0x34')](_0x24ecbe[_0x74bd('0x2a')],_0x48e30f[_0x74bd('0x2c')]),_0x3b0f3f);if(_0x24ecbe[_0x74bd('0x2a')][_0x74bd('0x35')]){_0xf7ed14['where']=_[_0x74bd('0x36')](_0xf7ed14[_0x74bd('0x37')],{'$or':_[_0x74bd('0x25')](_0x3b0f3f,function(_0x59748e){if(_0x59748e['type']!==_0x74bd('0x38')){var _0x404a6d={};_0x404a6d[_0x59748e[_0x74bd('0x23')]]={'$like':'%'+_0x24ecbe['query'][_0x74bd('0x35')]+'%'};return _0x404a6d;}})});}_0xf7ed14=_[_0x74bd('0x36')]({},_0xf7ed14,_0x24ecbe[_0x74bd('0x39')]);var _0x49511d={'where':_0xf7ed14[_0x74bd('0x37')]};return db[_0x74bd('0x26')][_0x74bd('0x3a')](_0x49511d)['then'](function(_0x2aaf7b){_0x5480e9[_0x74bd('0x3a')]=_0x2aaf7b;if(_0x24ecbe[_0x74bd('0x2a')]['includeAll']){_0xf7ed14[_0x74bd('0x3b')]=[{'all':!![]}];}return db['Sound'][_0x74bd('0x3c')](_0xf7ed14);})[_0x74bd('0x1e')](function(_0x3d57b7){_0x5480e9[_0x74bd('0x3d')]=_0x3d57b7;return _0x5480e9;})[_0x74bd('0x1e')](respondWithFilteredResult(_0x963ed8,_0xf7ed14))[_0x74bd('0x3e')](handleError(_0x963ed8,null));};exports[_0x74bd('0x3f')]=function(_0x2fedf6,_0x306b24){var _0x25735a={'raw':!![],'where':{'id':_0x2fedf6[_0x74bd('0x40')]['id']}},_0xe04245={};_0xe04245['model']=_[_0x74bd('0x2b')](db[_0x74bd('0x26')][_0x74bd('0x41')]);_0xe04245[_0x74bd('0x2a')]=_[_0x74bd('0x2b')](_0x2fedf6[_0x74bd('0x2a')]);_0xe04245[_0x74bd('0x2c')]=_[_0x74bd('0x2d')](_0xe04245[_0x74bd('0x29')],_0xe04245[_0x74bd('0x2a')]);_0x25735a[_0x74bd('0x2e')]=_[_0x74bd('0x2d')](_0xe04245[_0x74bd('0x29')],qs[_0x74bd('0x2f')](_0x2fedf6[_0x74bd('0x2a')]['fields']));_0x25735a[_0x74bd('0x2e')]=_0x25735a[_0x74bd('0x2e')][_0x74bd('0x30')]?_0x25735a[_0x74bd('0x2e')]:_0xe04245[_0x74bd('0x29')];if(_0x2fedf6[_0x74bd('0x2a')][_0x74bd('0x42')]){_0x25735a['include']=[{'all':!![]}];}_0x25735a=_[_0x74bd('0x36')]({},_0x25735a,_0x2fedf6['options']);return db[_0x74bd('0x26')][_0x74bd('0x43')](_0x25735a)[_0x74bd('0x1e')](handleEntityNotFound(_0x306b24,null))[_0x74bd('0x1e')](respondWithResult(_0x306b24,null))[_0x74bd('0x3e')](handleError(_0x306b24,null));};exports[_0x74bd('0x44')]=function(_0x58cca3,_0x45778f,_0x4c20be){return db[_0x74bd('0x26')][_0x74bd('0x43')]({'where':{'id':_0x58cca3[_0x74bd('0x40')]['id']},'attributes':[_0x74bd('0x23'),_0x74bd('0x45'),_0x74bd('0x46')],'raw':!![]})[_0x74bd('0x1e')](handleEntityNotFound(_0x45778f,null))['then'](function(_0x1526e3){if(_0x1526e3){if(!fs[_0x74bd('0x47')](path['join'](config[_0x74bd('0x48')],_0x74bd('0x49'),_0x1526e3[_0x74bd('0x45')]+'.'+_0x1526e3['converted_format']))){throw new db[(_0x74bd('0x4a'))][(_0x74bd('0x4b'))](_0x74bd('0x4c'));}return _0x45778f[_0x74bd('0x44')](path['join'](config[_0x74bd('0x48')],_0x74bd('0x49'),util[_0x74bd('0x4d')](_0x74bd('0x4e'),_0x1526e3[_0x74bd('0x45')],_0x1526e3['converted_format'])),util[_0x74bd('0x4d')](_0x74bd('0x4e'),_0x1526e3[_0x74bd('0x23')],_0x1526e3[_0x74bd('0x46')]));}return null;})[_0x74bd('0x3e')](handleError(_0x45778f,null));};exports[_0x74bd('0x4f')]=function(_0x1fcd2e,_0x4b8251,_0x4b4a8c){var _0x52de5c={'name':path['basename'](_0x1fcd2e[_0x74bd('0x50')]['originalname'],path[_0x74bd('0x51')](_0x1fcd2e[_0x74bd('0x50')][_0x74bd('0x52')])),'save_name':path[_0x74bd('0x53')](_0x1fcd2e[_0x74bd('0x50')][_0x74bd('0x54')],path['extname'](_0x1fcd2e['file']['filename'])),'original_format':path[_0x74bd('0x51')](_0x1fcd2e['file']['originalname'])['substring'](0x1),'converted_format':'wav'};var _0x231b73=path['join'](config[_0x74bd('0x48')],_0x74bd('0x55'),_0x1fcd2e[_0x74bd('0x50')]['filename']);var _0x10cd32=path['join'](config[_0x74bd('0x48')],_0x74bd('0x49'),util[_0x74bd('0x4d')]('%s.%s',path[_0x74bd('0x53')](_0x1fcd2e[_0x74bd('0x50')]['filename'],path[_0x74bd('0x51')](_0x1fcd2e[_0x74bd('0x50')][_0x74bd('0x54')])),_0x52de5c[_0x74bd('0x46')]));logger[_0x74bd('0x56')]('Sound\x20upload\x20filepath:\x20%s',_0x231b73);logger[_0x74bd('0x56')](_0x74bd('0x57'),_0x10cd32);try{fs[_0x74bd('0x58')](_0x231b73,parseInt(_0x74bd('0x59'),0x8));var _0x36b515=sox[_0x74bd('0x5a')](_0x231b73,_0x10cd32,{'sampleRate':0x1f40,'format':_0x74bd('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36b515['on']('error',function(_0x596fb2){fs[_0x74bd('0x5c')](_0x231b73);_0x4b8251[_0x74bd('0x18')](0x1f4)[_0x74bd('0x24')](_0x596fb2);});_0x36b515['on'](_0x74bd('0x5d'),function(_0x53f449){_0x52de5c['original_duration']=isNaN(_0x53f449['duration'])?null:_0x53f449['duration']*0x3e8;_0x52de5c['original_sampleCount']=isNaN(_0x53f449['sampleCount'])?null:_0x53f449['sampleCount'];_0x52de5c[_0x74bd('0x5e')]=isNaN(_0x53f449[_0x74bd('0x5f')])?null:_0x53f449[_0x74bd('0x5f')];_0x52de5c[_0x74bd('0x60')]=isNaN(_0x53f449[_0x74bd('0x61')])?null:_0x53f449['bitRate'];_0x52de5c[_0x74bd('0x62')]=isNaN(_0x53f449[_0x74bd('0x63')])?null:_0x53f449[_0x74bd('0x63')];});_0x36b515['on'](_0x74bd('0x64'),function(_0x541d0c){_0x52de5c[_0x74bd('0x65')]=isNaN(_0x541d0c[_0x74bd('0x66')])?null:_0x541d0c[_0x74bd('0x66')]*0x3e8;_0x52de5c[_0x74bd('0x67')]=isNaN(_0x541d0c[_0x74bd('0x68')])?null:_0x541d0c[_0x74bd('0x68')];_0x52de5c['converted_channelCount']=isNaN(_0x541d0c['channelCount'])?null:_0x541d0c[_0x74bd('0x5f')];_0x52de5c['converted_bitRate']=isNaN(_0x541d0c[_0x74bd('0x61')])?null:_0x541d0c['bitRate'];_0x52de5c['converted_sampleRate']=isNaN(_0x541d0c[_0x74bd('0x63')])?null:_0x541d0c[_0x74bd('0x63')];});_0x36b515['on'](_0x74bd('0x15'),function(){fs[_0x74bd('0x58')](_0x10cd32,parseInt('0777',0x8));return db[_0x74bd('0x26')][_0x74bd('0x4f')](_0x52de5c)[_0x74bd('0x1e')](function(_0x5199f3){var _0x12f446={'role':_0x1fcd2e[_0x74bd('0x69')]['role'],'userProfileId':_0x1fcd2e['body'][_0x74bd('0x6a')]};if(!_0x12f446)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12f446[_0x74bd('0x6b')]===_0x74bd('0x6c')){var _0x5507aa=_0x5199f3[_0x74bd('0x20')]({'plain':!![]});return db[_0x74bd('0x6d')][_0x74bd('0x43')]({'where':{'name':'Sounds','userProfileId':_0x12f446[_0x74bd('0x6a')]},'raw':!![]})[_0x74bd('0x1e')](function(_0xb632c3){if(_0xb632c3&&_0xb632c3[_0x74bd('0x6e')]===0x0){return db[_0x74bd('0x22')]['create']({'name':_0x5507aa[_0x74bd('0x23')],'resourceId':_0x5507aa['id'],'type':_0xb632c3[_0x74bd('0x23')],'sectionId':_0xb632c3['id']},{})[_0x74bd('0x1e')](function(){return _0x5199f3;});}else{return _0x5199f3;}})['catch'](function(_0x5ac230){logger[_0x74bd('0x6f')](_0x74bd('0x70'),_0x5ac230);throw _0x5ac230;});}return _0x5199f3;})[_0x74bd('0x1e')](respondWithResult(_0x4b8251,null))[_0x74bd('0x3e')](handleError(_0x4b8251,null));});_0x36b515[_0x74bd('0x71')]();}catch(_0x358364){_0x4b8251[_0x74bd('0x18')](0x1f4)['send'](_0x358364);}};exports[_0x74bd('0x72')]=function(_0x2b9e6c,_0x1c5674,_0x50ce04){return db[_0x74bd('0x26')][_0x74bd('0x43')]({'where':{'id':_0x2b9e6c['params']['id']}})['then'](handleEntityNotFound(_0x1c5674,null))['then'](saveUpdates(_[_0x74bd('0x34')](_0x2b9e6c[_0x74bd('0x69')],[_0x74bd('0x23'),_0x74bd('0x73')]),null))['then'](respondWithResult(_0x1c5674,null))['catch'](handleError(_0x1c5674,null));};exports[_0x74bd('0x74')]=function(_0x3d3884,_0xc57f2e,_0x5ad4ba){return db[_0x74bd('0x26')]['find']({'where':{'id':_0x3d3884[_0x74bd('0x40')]['id']}})[_0x74bd('0x1e')](function(_0x461ef8){if(_0x461ef8){return _0x461ef8[_0x74bd('0x1f')]();}})[_0x74bd('0x1e')](function(_0x44dcd4){var _0x53d7be=path['join'](config[_0x74bd('0x48')],'server/files/sounds/original',util[_0x74bd('0x4d')](_0x74bd('0x4e'),_0x44dcd4[_0x74bd('0x45')],_0x44dcd4[_0x74bd('0x75')]));var _0x59ad18=path[_0x74bd('0x76')](config[_0x74bd('0x48')],_0x74bd('0x49'),util[_0x74bd('0x4d')](_0x74bd('0x4e'),_0x44dcd4[_0x74bd('0x45')],_0x44dcd4[_0x74bd('0x46')]));fs['unlinkSync'](_0x53d7be);fs['unlinkSync'](_0x59ad18);return _0x44dcd4;})[_0x74bd('0x1e')](function(_0x5c1f95){if(_0x5c1f95){return _0xc57f2e[_0x74bd('0x18')](0xcc)[_0x74bd('0x15')]();}})[_0x74bd('0x1e')](handleEntityNotFound(_0xc57f2e,null))[_0x74bd('0x3e')](handleError(_0xc57f2e,null));}; \ No newline at end of file +var _0xf7f3=['info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','get','Sounds','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','keys','intersection','find','download','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','originalname','extname','filename','substring','wav','server/files/sounds/original','basename'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf7f3,0x9e));var _0x3f7f=function(_0x5e65fe,_0x2104e5){_0x5e65fe=_0x5e65fe-0x0;var _0x357cb0=_0xf7f3[_0x5e65fe];return _0x357cb0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f7f('0x0'));var rimraf=require(_0x3f7f('0x1'));var zipdir=require(_0x3f7f('0x2'));var jsonpatch=require(_0x3f7f('0x3'));var rp=require(_0x3f7f('0x4'));var moment=require(_0x3f7f('0x5'));var BPromise=require(_0x3f7f('0x6'));var Mustache=require(_0x3f7f('0x7'));var util=require('util');var path=require(_0x3f7f('0x8'));var sox=require(_0x3f7f('0x9'));var csv=require(_0x3f7f('0xa'));var ejs=require(_0x3f7f('0xb'));var fs=require('fs');var _=require(_0x3f7f('0xc'));var squel=require('squel');var crypto=require(_0x3f7f('0xd'));var jsforce=require(_0x3f7f('0xe'));var deskjs=require(_0x3f7f('0xf'));var toCsv=require(_0x3f7f('0xa'));var querystring=require(_0x3f7f('0x10'));var Papa=require(_0x3f7f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f7f('0x12'));var as=require(_0x3f7f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f7f('0x14'))('api');var utils=require(_0x3f7f('0x15'));var config=require(_0x3f7f('0x16'));var licenseUtil=require(_0x3f7f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4aef13,_0x554244){_0x554244=_0x554244||0xcc;return function(_0x33cd2a){if(_0x33cd2a){return _0x4aef13[_0x3f7f('0x18')](_0x554244);}return _0x4aef13['status'](_0x554244)[_0x3f7f('0x19')]();};}function respondWithResult(_0x351f7f,_0x554e36){_0x554e36=_0x554e36||0xc8;return function(_0xd89cf7){if(_0xd89cf7){return _0x351f7f[_0x3f7f('0x1a')](_0x554e36)['json'](_0xd89cf7);}};}function respondWithFilteredResult(_0x9389b5,_0x369b99){return function(_0x2a585e){if(_0x2a585e){var _0x81a6e2=_0x2a585e[_0x3f7f('0x1b')],_0x457fbb=_0x369b99[_0x3f7f('0x1c')],_0x14246d=_0x369b99['offset']+_0x369b99[_0x3f7f('0x1d')],_0x2c2862;if(_0x14246d>=_0x81a6e2){_0x14246d=_0x81a6e2;_0x2c2862=0xc8;}else{_0x2c2862=0xce;}_0x9389b5[_0x3f7f('0x1a')](_0x2c2862);return _0x9389b5['set'](_0x3f7f('0x1e'),_0x457fbb+'-'+_0x14246d+'/'+_0x81a6e2)[_0x3f7f('0x1f')](_0x2a585e);}return null;};}function patchUpdates(_0x3715c9){return function(_0x463182){try{jsonpatch[_0x3f7f('0x20')](_0x463182,_0x3715c9,!![]);}catch(_0x50d462){return BPromise[_0x3f7f('0x21')](_0x50d462);}return _0x463182['save']();};}function saveUpdates(_0x4fad38,_0x5e4b90){return function(_0x2442a8){if(_0x2442a8){return _0x2442a8[_0x3f7f('0x22')](_0x4fad38)[_0x3f7f('0x23')](function(_0x5bf63c){return _0x5bf63c;});}return null;};}function removeEntity(_0x4f381d,_0x3bbdab){return function(_0x44faf9){if(_0x44faf9){return _0x44faf9[_0x3f7f('0x24')]()[_0x3f7f('0x23')](function(){var _0x13ad16=_0x44faf9[_0x3f7f('0x25')]({'plain':!![]});var _0x5dc1ad=_0x3f7f('0x26');return db['UserProfileResource'][_0x3f7f('0x24')]({'where':{'type':_0x5dc1ad,'resourceId':_0x13ad16['id']}})['then'](function(){return _0x44faf9;});})[_0x3f7f('0x23')](function(){_0x4f381d[_0x3f7f('0x1a')](0xcc)[_0x3f7f('0x19')]();});}};}function handleEntityNotFound(_0x11d11e,_0x85c037){return function(_0x103e67){if(!_0x103e67){_0x11d11e[_0x3f7f('0x18')](0x194);}return _0x103e67;};}function handleError(_0x5a8cbf,_0x585a7d){_0x585a7d=_0x585a7d||0x1f4;return function(_0x47e1a7){logger[_0x3f7f('0x27')](_0x47e1a7[_0x3f7f('0x28')]);if(_0x47e1a7[_0x3f7f('0x29')]){delete _0x47e1a7['name'];}_0x5a8cbf[_0x3f7f('0x1a')](_0x585a7d)[_0x3f7f('0x2a')](_0x47e1a7);};}exports[_0x3f7f('0x2b')]=function(_0x33de40,_0x141208){var _0x1fd3d1={},_0x158a91={},_0x4a6d53={'count':0x0,'rows':[]};var _0x2c88ba=_['map'](db[_0x3f7f('0x2c')][_0x3f7f('0x2d')],function(_0x3dfb50){return{'name':_0x3dfb50[_0x3f7f('0x2e')],'type':_0x3dfb50[_0x3f7f('0x2f')][_0x3f7f('0x30')]};});_0x158a91[_0x3f7f('0x31')]=_['map'](_0x2c88ba,_0x3f7f('0x29'));_0x158a91[_0x3f7f('0x32')]=_['keys'](_0x33de40[_0x3f7f('0x32')]);_0x158a91[_0x3f7f('0x33')]=_['intersection'](_0x158a91[_0x3f7f('0x31')],_0x158a91[_0x3f7f('0x32')]);_0x1fd3d1[_0x3f7f('0x34')]=_['intersection'](_0x158a91[_0x3f7f('0x31')],qs['fields'](_0x33de40[_0x3f7f('0x32')][_0x3f7f('0x35')]));_0x1fd3d1[_0x3f7f('0x34')]=_0x1fd3d1[_0x3f7f('0x34')][_0x3f7f('0x36')]?_0x1fd3d1['attributes']:_0x158a91['model'];if(!_0x33de40['query'][_0x3f7f('0x37')](_0x3f7f('0x38'))){_0x1fd3d1['limit']=qs[_0x3f7f('0x1d')](_0x33de40[_0x3f7f('0x32')][_0x3f7f('0x1d')]);_0x1fd3d1[_0x3f7f('0x1c')]=qs[_0x3f7f('0x1c')](_0x33de40[_0x3f7f('0x32')][_0x3f7f('0x1c')]);}_0x1fd3d1[_0x3f7f('0x39')]=qs['sort'](_0x33de40[_0x3f7f('0x32')][_0x3f7f('0x3a')]);_0x1fd3d1[_0x3f7f('0x3b')]=qs[_0x3f7f('0x33')](_['pick'](_0x33de40[_0x3f7f('0x32')],_0x158a91[_0x3f7f('0x33')]),_0x2c88ba);if(_0x33de40[_0x3f7f('0x32')][_0x3f7f('0x3c')]){_0x1fd3d1['where']=_['merge'](_0x1fd3d1[_0x3f7f('0x3b')],{'$or':_['map'](_0x2c88ba,function(_0x14649f){if(_0x14649f[_0x3f7f('0x2f')]!==_0x3f7f('0x3d')){var _0x3e10fe={};_0x3e10fe[_0x14649f[_0x3f7f('0x29')]]={'$like':'%'+_0x33de40['query'][_0x3f7f('0x3c')]+'%'};return _0x3e10fe;}})});}_0x1fd3d1=_[_0x3f7f('0x3e')]({},_0x1fd3d1,_0x33de40[_0x3f7f('0x3f')]);var _0x105235={'where':_0x1fd3d1[_0x3f7f('0x3b')]};return db[_0x3f7f('0x2c')][_0x3f7f('0x1b')](_0x105235)[_0x3f7f('0x23')](function(_0x55d64d){_0x4a6d53[_0x3f7f('0x1b')]=_0x55d64d;if(_0x33de40[_0x3f7f('0x32')][_0x3f7f('0x40')]){_0x1fd3d1[_0x3f7f('0x41')]=[{'all':!![]}];}return db[_0x3f7f('0x2c')][_0x3f7f('0x42')](_0x1fd3d1);})[_0x3f7f('0x23')](function(_0x3379e3){_0x4a6d53[_0x3f7f('0x43')]=_0x3379e3;return _0x4a6d53;})['then'](respondWithFilteredResult(_0x141208,_0x1fd3d1))['catch'](handleError(_0x141208,null));};exports[_0x3f7f('0x44')]=function(_0x5992e2,_0x1d9cb8){var _0x52659e={'raw':!![],'where':{'id':_0x5992e2['params']['id']}},_0x181b48={};_0x181b48[_0x3f7f('0x31')]=_[_0x3f7f('0x45')](db[_0x3f7f('0x2c')][_0x3f7f('0x2d')]);_0x181b48[_0x3f7f('0x32')]=_[_0x3f7f('0x45')](_0x5992e2[_0x3f7f('0x32')]);_0x181b48[_0x3f7f('0x33')]=_[_0x3f7f('0x46')](_0x181b48['model'],_0x181b48['query']);_0x52659e[_0x3f7f('0x34')]=_[_0x3f7f('0x46')](_0x181b48[_0x3f7f('0x31')],qs[_0x3f7f('0x35')](_0x5992e2['query'][_0x3f7f('0x35')]));_0x52659e['attributes']=_0x52659e[_0x3f7f('0x34')][_0x3f7f('0x36')]?_0x52659e[_0x3f7f('0x34')]:_0x181b48[_0x3f7f('0x31')];if(_0x5992e2['query']['includeAll']){_0x52659e[_0x3f7f('0x41')]=[{'all':!![]}];}_0x52659e=_['merge']({},_0x52659e,_0x5992e2[_0x3f7f('0x3f')]);return db['Sound'][_0x3f7f('0x47')](_0x52659e)[_0x3f7f('0x23')](handleEntityNotFound(_0x1d9cb8,null))[_0x3f7f('0x23')](respondWithResult(_0x1d9cb8,null))['catch'](handleError(_0x1d9cb8,null));};exports[_0x3f7f('0x48')]=function(_0x40dbd5,_0x400e12,_0x2d5389){return db['Sound'][_0x3f7f('0x47')]({'where':{'id':_0x40dbd5[_0x3f7f('0x49')]['id']},'attributes':[_0x3f7f('0x29'),_0x3f7f('0x4a'),_0x3f7f('0x4b')],'raw':!![]})[_0x3f7f('0x23')](handleEntityNotFound(_0x400e12,null))[_0x3f7f('0x23')](function(_0x544122){if(_0x544122){if(!fs[_0x3f7f('0x4c')](path[_0x3f7f('0x4d')](config[_0x3f7f('0x4e')],_0x3f7f('0x4f'),_0x544122[_0x3f7f('0x4a')]+'.'+_0x544122[_0x3f7f('0x4b')]))){throw new db[(_0x3f7f('0x50'))][(_0x3f7f('0x51'))](_0x3f7f('0x52'));}return _0x400e12['download'](path[_0x3f7f('0x4d')](config['root'],'server/files/sounds/converted',util[_0x3f7f('0x53')]('%s.%s',_0x544122[_0x3f7f('0x4a')],_0x544122[_0x3f7f('0x4b')])),util[_0x3f7f('0x53')](_0x3f7f('0x54'),_0x544122[_0x3f7f('0x29')],_0x544122[_0x3f7f('0x4b')]));}return null;})['catch'](handleError(_0x400e12,null));};exports[_0x3f7f('0x55')]=function(_0x5be776,_0x4b995e,_0x416bc5){var _0x25ced9={'name':path['basename'](_0x5be776[_0x3f7f('0x56')][_0x3f7f('0x57')],path[_0x3f7f('0x58')](_0x5be776[_0x3f7f('0x56')][_0x3f7f('0x57')])),'save_name':path['basename'](_0x5be776['file'][_0x3f7f('0x59')],path[_0x3f7f('0x58')](_0x5be776[_0x3f7f('0x56')]['filename'])),'original_format':path[_0x3f7f('0x58')](_0x5be776[_0x3f7f('0x56')][_0x3f7f('0x57')])[_0x3f7f('0x5a')](0x1),'converted_format':_0x3f7f('0x5b')};var _0x5f4fdf=path[_0x3f7f('0x4d')](config[_0x3f7f('0x4e')],_0x3f7f('0x5c'),_0x5be776[_0x3f7f('0x56')][_0x3f7f('0x59')]);var _0x59d320=path[_0x3f7f('0x4d')](config[_0x3f7f('0x4e')],_0x3f7f('0x4f'),util[_0x3f7f('0x53')](_0x3f7f('0x54'),path[_0x3f7f('0x5d')](_0x5be776[_0x3f7f('0x56')]['filename'],path[_0x3f7f('0x58')](_0x5be776['file'][_0x3f7f('0x59')])),_0x25ced9[_0x3f7f('0x4b')]));logger[_0x3f7f('0x5e')]('Sound\x20upload\x20filepath:\x20%s',_0x5f4fdf);logger['info'](_0x3f7f('0x5f'),_0x59d320);try{fs[_0x3f7f('0x60')](_0x5f4fdf,parseInt('0777',0x8));var _0x163191=sox[_0x3f7f('0x61')](_0x5f4fdf,_0x59d320,{'sampleRate':0x1f40,'format':_0x3f7f('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x163191['on'](_0x3f7f('0x27'),function(_0x132879){fs[_0x3f7f('0x62')](_0x5f4fdf);_0x4b995e[_0x3f7f('0x1a')](0x1f4)[_0x3f7f('0x2a')](_0x132879);});_0x163191['on'](_0x3f7f('0x63'),function(_0x2d44cf){_0x25ced9[_0x3f7f('0x64')]=isNaN(_0x2d44cf['duration'])?null:_0x2d44cf[_0x3f7f('0x65')]*0x3e8;_0x25ced9[_0x3f7f('0x66')]=isNaN(_0x2d44cf[_0x3f7f('0x67')])?null:_0x2d44cf[_0x3f7f('0x67')];_0x25ced9['original_channelCount']=isNaN(_0x2d44cf[_0x3f7f('0x68')])?null:_0x2d44cf[_0x3f7f('0x68')];_0x25ced9['original_bitRate']=isNaN(_0x2d44cf[_0x3f7f('0x69')])?null:_0x2d44cf['bitRate'];_0x25ced9[_0x3f7f('0x6a')]=isNaN(_0x2d44cf[_0x3f7f('0x6b')])?null:_0x2d44cf[_0x3f7f('0x6b')];});_0x163191['on']('dest',function(_0x4c7fa9){_0x25ced9[_0x3f7f('0x6c')]=isNaN(_0x4c7fa9[_0x3f7f('0x65')])?null:_0x4c7fa9['duration']*0x3e8;_0x25ced9[_0x3f7f('0x6d')]=isNaN(_0x4c7fa9['sampleCount'])?null:_0x4c7fa9[_0x3f7f('0x67')];_0x25ced9[_0x3f7f('0x6e')]=isNaN(_0x4c7fa9[_0x3f7f('0x68')])?null:_0x4c7fa9[_0x3f7f('0x68')];_0x25ced9[_0x3f7f('0x6f')]=isNaN(_0x4c7fa9[_0x3f7f('0x69')])?null:_0x4c7fa9[_0x3f7f('0x69')];_0x25ced9[_0x3f7f('0x70')]=isNaN(_0x4c7fa9[_0x3f7f('0x6b')])?null:_0x4c7fa9[_0x3f7f('0x6b')];});_0x163191['on'](_0x3f7f('0x19'),function(){fs[_0x3f7f('0x60')](_0x59d320,parseInt(_0x3f7f('0x71'),0x8));return db['Sound']['create'](_0x25ced9)[_0x3f7f('0x23')](function(_0x1744af){var _0x1f5c4b={'role':_0x5be776[_0x3f7f('0x72')][_0x3f7f('0x73')],'userProfileId':_0x5be776[_0x3f7f('0x72')][_0x3f7f('0x74')]};if(!_0x1f5c4b)throw new Error(_0x3f7f('0x75'));if(_0x1f5c4b[_0x3f7f('0x73')]==='user'){var _0xf658dd=_0x1744af[_0x3f7f('0x25')]({'plain':!![]});return db[_0x3f7f('0x76')][_0x3f7f('0x47')]({'where':{'name':_0x3f7f('0x26'),'userProfileId':_0x1f5c4b[_0x3f7f('0x74')]},'raw':!![]})[_0x3f7f('0x23')](function(_0x532346){if(_0x532346&&_0x532346[_0x3f7f('0x77')]===0x0){return db[_0x3f7f('0x78')][_0x3f7f('0x55')]({'name':_0xf658dd['name'],'resourceId':_0xf658dd['id'],'type':_0x532346[_0x3f7f('0x29')],'sectionId':_0x532346['id']},{})[_0x3f7f('0x23')](function(){return _0x1744af;});}else{return _0x1744af;}})[_0x3f7f('0x79')](function(_0xadf0f4){logger[_0x3f7f('0x27')](_0x3f7f('0x7a'),_0xadf0f4);throw _0xadf0f4;});}return _0x1744af;})[_0x3f7f('0x23')](respondWithResult(_0x4b995e,null))[_0x3f7f('0x79')](handleError(_0x4b995e,null));});_0x163191[_0x3f7f('0x7b')]();}catch(_0x18e46f){_0x4b995e[_0x3f7f('0x1a')](0x1f4)['send'](_0x18e46f);}};exports['update']=function(_0x3c994e,_0x93f6a0,_0x3aad78){return db['Sound']['find']({'where':{'id':_0x3c994e[_0x3f7f('0x49')]['id']}})['then'](handleEntityNotFound(_0x93f6a0,null))[_0x3f7f('0x23')](saveUpdates(_['pick'](_0x3c994e[_0x3f7f('0x72')],[_0x3f7f('0x29'),'description']),null))['then'](respondWithResult(_0x93f6a0,null))['catch'](handleError(_0x93f6a0,null));};exports[_0x3f7f('0x7c')]=function(_0x44521e,_0x42d655,_0x1718fa){return db[_0x3f7f('0x2c')][_0x3f7f('0x47')]({'where':{'id':_0x44521e[_0x3f7f('0x49')]['id']}})[_0x3f7f('0x23')](function(_0x1a7d1d){if(_0x1a7d1d){return _0x1a7d1d[_0x3f7f('0x24')]();}})[_0x3f7f('0x23')](function(_0x2f27ba){var _0x3e84ab=path[_0x3f7f('0x4d')](config[_0x3f7f('0x4e')],_0x3f7f('0x5c'),util['format']('%s.%s',_0x2f27ba['save_name'],_0x2f27ba[_0x3f7f('0x7d')]));var _0x23101c=path[_0x3f7f('0x4d')](config[_0x3f7f('0x4e')],'server/files/sounds/converted',util[_0x3f7f('0x53')](_0x3f7f('0x54'),_0x2f27ba[_0x3f7f('0x4a')],_0x2f27ba[_0x3f7f('0x4b')]));fs['unlinkSync'](_0x3e84ab);fs['unlinkSync'](_0x23101c);return _0x2f27ba;})[_0x3f7f('0x23')](function(_0x56879b){if(_0x56879b){return _0x42d655[_0x3f7f('0x1a')](0xcc)[_0x3f7f('0x19')]();}})[_0x3f7f('0x23')](handleEntityNotFound(_0x42d655,null))[_0x3f7f('0x79')](handleError(_0x42d655,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 22f7a00..caa40e3 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 _0x2890=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash'];(function(_0x2857fc,_0x411fd1){var _0x49047c=function(_0x30ceb2){while(--_0x30ceb2){_0x2857fc['push'](_0x2857fc['shift']());}};_0x49047c(++_0x411fd1);}(_0x2890,0x1df));var _0x0289=function(_0x1d4a3c,_0x230e34){_0x1d4a3c=_0x1d4a3c-0x0;var _0x5ac981=_0x2890[_0x1d4a3c];return _0x5ac981;};'use strict';var _=require(_0x0289('0x0'));var util=require(_0x0289('0x1'));var logger=require(_0x0289('0x2'))(_0x0289('0x3'));var moment=require(_0x0289('0x4'));var BPromise=require(_0x0289('0x5'));var rp=require(_0x0289('0x6'));var fs=require('fs');var path=require(_0x0289('0x7'));var rimraf=require(_0x0289('0x8'));var config=require(_0x0289('0x9'));var attributes=require('./sound.attributes');module[_0x0289('0xa')]=function(_0x5c72b8,_0x223b13){return _0x5c72b8[_0x0289('0xb')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99a6=['api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','util','../../config/logger'];(function(_0x1446b6,_0x3cf5e6){var _0x4d8b63=function(_0x1ae987){while(--_0x1ae987){_0x1446b6['push'](_0x1446b6['shift']());}};_0x4d8b63(++_0x3cf5e6);}(_0x99a6,0x7f));var _0x699a=function(_0x245208,_0x5ed2c6){_0x245208=_0x245208-0x0;var _0x5187dc=_0x99a6[_0x245208];return _0x5187dc;};'use strict';var _=require(_0x699a('0x0'));var util=require(_0x699a('0x1'));var logger=require(_0x699a('0x2'))(_0x699a('0x3'));var moment=require(_0x699a('0x4'));var BPromise=require('bluebird');var rp=require(_0x699a('0x5'));var fs=require('fs');var path=require(_0x699a('0x6'));var rimraf=require(_0x699a('0x7'));var config=require(_0x699a('0x8'));var attributes=require(_0x699a('0x9'));module['exports']=function(_0xa11329,_0x458f92){return _0xa11329[_0x699a('0xa')](_0x699a('0xb'),attributes,{'tableName':_0x699a('0xc'),'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 adbeb4f..c99df0b 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 _0x54e8=['Sound','options','raw','where','include','map','model','attributes','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','catch','ShowSound'];(function(_0x48b35c,_0x568f70){var _0x46fc38=function(_0x25a9f){while(--_0x25a9f){_0x48b35c['push'](_0x48b35c['shift']());}};_0x46fc38(++_0x568f70);}(_0x54e8,0x149));var _0x854e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x54e8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x854e('0x0'));var util=require('util');var moment=require(_0x854e('0x1'));var BPromise=require(_0x854e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x854e('0x3'));var db=require(_0x854e('0x4'))['db'];var utils=require(_0x854e('0x5'));var logger=require(_0x854e('0x6'))(_0x854e('0x7'));var config=require(_0x854e('0x8'));var jayson=require(_0x854e('0x9'));var client=jayson[_0x854e('0xa')][_0x854e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1954ee,_0x50215e,_0x48485b){return new BPromise(function(_0x1ed4ba,_0x177950){return client[_0x854e('0xc')](_0x1954ee,_0x48485b)['then'](function(_0x4297d9){logger[_0x854e('0xd')]('Sound,\x20%s,\x20%s',_0x50215e,'request\x20sent');logger[_0x854e('0xe')](_0x854e('0xf'),_0x50215e,'request\x20sent',JSON[_0x854e('0x10')](_0x4297d9));if(_0x4297d9[_0x854e('0x11')]){if(_0x4297d9['error'][_0x854e('0x12')]===0x1f4){logger['error'](_0x854e('0x13'),_0x50215e,_0x4297d9[_0x854e('0x11')][_0x854e('0x14')]);return _0x177950(_0x4297d9['error'][_0x854e('0x14')]);}logger[_0x854e('0x11')](_0x854e('0x13'),_0x50215e,_0x4297d9[_0x854e('0x11')][_0x854e('0x14')]);return _0x1ed4ba(_0x4297d9[_0x854e('0x11')]['message']);}else{logger[_0x854e('0xd')]('Sound,\x20%s,\x20%s',_0x50215e,'request\x20sent');_0x1ed4ba(_0x4297d9['result'][_0x854e('0x14')]);}})[_0x854e('0x15')](function(_0x2aa4ba){logger[_0x854e('0x11')]('Sound,\x20%s,\x20%s',_0x50215e,_0x2aa4ba);_0x177950(_0x2aa4ba);});});}exports[_0x854e('0x16')]=function(_0xd5b137){var _0x27e94b=this;return new Promise(function(_0x26b76d,_0x1981f3){return db[_0x854e('0x17')]['find']({'raw':_0xd5b137['options']?_0xd5b137[_0x854e('0x18')][_0x854e('0x19')]===undefined?!![]:![]:!![],'where':_0xd5b137['options']?_0xd5b137[_0x854e('0x18')][_0x854e('0x1a')]||null:null,'attributes':_0xd5b137[_0x854e('0x18')]?_0xd5b137[_0x854e('0x18')]['attributes']||null:null,'include':_0xd5b137[_0x854e('0x18')]?_0xd5b137[_0x854e('0x18')][_0x854e('0x1b')]?_[_0x854e('0x1c')](_0xd5b137['options'][_0x854e('0x1b')],function(_0x516cc2){return{'model':db[_0x516cc2[_0x854e('0x1d')]],'as':_0x516cc2['as'],'attributes':_0x516cc2[_0x854e('0x1e')],'include':_0x516cc2[_0x854e('0x1b')]?_[_0x854e('0x1c')](_0x516cc2[_0x854e('0x1b')],function(_0x4fbc92){return{'model':db[_0x4fbc92[_0x854e('0x1d')]],'as':_0x4fbc92['as'],'attributes':_0x4fbc92['attributes'],'include':_0x4fbc92[_0x854e('0x1b')]?_[_0x854e('0x1c')](_0x4fbc92[_0x854e('0x1b')],function(_0x55967a){return{'model':db[_0x55967a[_0x854e('0x1d')]],'as':_0x55967a['as'],'attributes':_0x55967a[_0x854e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x854e('0x1f')](function(_0x1cbac5){logger['info'](_0x854e('0x16'),_0xd5b137);logger[_0x854e('0xe')](_0x854e('0x16'),_0xd5b137,JSON[_0x854e('0x10')](_0x1cbac5));_0x26b76d(_0x1cbac5);})[_0x854e('0x15')](function(_0x3915e9){logger[_0x854e('0x11')](_0x854e('0x16'),_0x3915e9[_0x854e('0x14')],_0xd5b137);_0x1981f3(_0x27e94b['error'](0x1f4,_0x3915e9[_0x854e('0x14')]));});});}; \ No newline at end of file +var _0x17c3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','error','code','Sound,\x20%s,\x20%s','message','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','then','debug','util','moment','bluebird','randomstring','ioredis'];(function(_0x2e6cea,_0x5d56f4){var _0x2962e9=function(_0x3ea209){while(--_0x3ea209){_0x2e6cea['push'](_0x2e6cea['shift']());}};_0x2962e9(++_0x5d56f4);}(_0x17c3,0x191));var _0x317c=function(_0xf2f94a,_0x182b37){_0xf2f94a=_0xf2f94a-0x0;var _0x1cb10e=_0x17c3[_0xf2f94a];return _0x1cb10e;};'use strict';var _=require('lodash');var util=require(_0x317c('0x0'));var moment=require(_0x317c('0x1'));var BPromise=require(_0x317c('0x2'));var rs=require(_0x317c('0x3'));var fs=require('fs');var Redis=require(_0x317c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x317c('0x5'));var logger=require(_0x317c('0x6'))(_0x317c('0x7'));var config=require(_0x317c('0x8'));var jayson=require(_0x317c('0x9'));var client=jayson[_0x317c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c3350,_0x2691fb,_0x455b13){return new BPromise(function(_0x37e308,_0x577bd7){return client['request'](_0x2c3350,_0x455b13)['then'](function(_0x3ef076){logger[_0x317c('0xb')]('Sound,\x20%s,\x20%s',_0x2691fb,'request\x20sent');logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x2691fb,_0x317c('0xc'),JSON['stringify'](_0x3ef076));if(_0x3ef076[_0x317c('0xd')]){if(_0x3ef076[_0x317c('0xd')][_0x317c('0xe')]===0x1f4){logger[_0x317c('0xd')](_0x317c('0xf'),_0x2691fb,_0x3ef076[_0x317c('0xd')][_0x317c('0x10')]);return _0x577bd7(_0x3ef076[_0x317c('0xd')][_0x317c('0x10')]);}logger[_0x317c('0xd')](_0x317c('0xf'),_0x2691fb,_0x3ef076[_0x317c('0xd')][_0x317c('0x10')]);return _0x37e308(_0x3ef076[_0x317c('0xd')][_0x317c('0x10')]);}else{logger[_0x317c('0xb')](_0x317c('0xf'),_0x2691fb,_0x317c('0xc'));_0x37e308(_0x3ef076['result'][_0x317c('0x10')]);}})['catch'](function(_0x51689b){logger[_0x317c('0xd')]('Sound,\x20%s,\x20%s',_0x2691fb,_0x51689b);_0x577bd7(_0x51689b);});});}exports[_0x317c('0x11')]=function(_0x45ceb1){var _0x163e26=this;return new Promise(function(_0x1b33e8,_0x11025d){return db[_0x317c('0x12')][_0x317c('0x13')]({'raw':_0x45ceb1[_0x317c('0x14')]?_0x45ceb1[_0x317c('0x14')][_0x317c('0x15')]===undefined?!![]:![]:!![],'where':_0x45ceb1['options']?_0x45ceb1['options'][_0x317c('0x16')]||null:null,'attributes':_0x45ceb1[_0x317c('0x14')]?_0x45ceb1['options'][_0x317c('0x17')]||null:null,'include':_0x45ceb1[_0x317c('0x14')]?_0x45ceb1[_0x317c('0x14')][_0x317c('0x18')]?_[_0x317c('0x19')](_0x45ceb1[_0x317c('0x14')][_0x317c('0x18')],function(_0x432439){return{'model':db[_0x432439['model']],'as':_0x432439['as'],'attributes':_0x432439[_0x317c('0x17')],'include':_0x432439['include']?_['map'](_0x432439['include'],function(_0x5cb7c2){return{'model':db[_0x5cb7c2[_0x317c('0x1a')]],'as':_0x5cb7c2['as'],'attributes':_0x5cb7c2[_0x317c('0x17')],'include':_0x5cb7c2[_0x317c('0x18')]?_['map'](_0x5cb7c2['include'],function(_0x1c7064){return{'model':db[_0x1c7064[_0x317c('0x1a')]],'as':_0x1c7064['as'],'attributes':_0x1c7064['attributes']};}):[]};}):[]};}):[]:[]})[_0x317c('0x1b')](function(_0x5e9807){logger[_0x317c('0xb')](_0x317c('0x11'),_0x45ceb1);logger[_0x317c('0x1c')]('ShowSound',_0x45ceb1,JSON['stringify'](_0x5e9807));_0x1b33e8(_0x5e9807);})['catch'](function(_0x3e7531){logger['error'](_0x317c('0x11'),_0x3e7531[_0x317c('0x10')],_0x45ceb1);_0x11025d(_0x163e26[_0x317c('0xd')](0x1f4,_0x3e7531['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 6948e9e..7a5f728 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 _0x7201=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0x36a1d4,_0x5c3a68){var _0x5eadb5=function(_0x5d9ca0){while(--_0x5d9ca0){_0x36a1d4['push'](_0x36a1d4['shift']());}};_0x5eadb5(++_0x5c3a68);}(_0x7201,0xd8));var _0x1720=function(_0x4bfd56,_0x571439){_0x4bfd56=_0x4bfd56-0x0;var _0xae6ee2=_0x7201[_0x4bfd56];return _0xae6ee2;};'use strict';var multer=require(_0x1720('0x0'));var util=require('util');var path=require(_0x1720('0x1'));var timeout=require(_0x1720('0x2'));var express=require(_0x1720('0x3'));var router=express[_0x1720('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1720('0x5'));var config=require(_0x1720('0x6'));var controller=require(_0x1720('0x7'));router[_0x1720('0x8')]('/',auth[_0x1720('0x9')](),controller[_0x1720('0xa')]);router[_0x1720('0x8')](_0x1720('0xb'),auth[_0x1720('0x9')](),controller['show']);router[_0x1720('0xc')]('/',auth[_0x1720('0x9')](),controller[_0x1720('0xd')]);router[_0x1720('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x1720('0xf')]);router[_0x1720('0x10')](_0x1720('0xb'),auth['isAuthenticated'](),controller[_0x1720('0x11')]);module['exports']=router; \ No newline at end of file +var _0xbd75=['express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3f9099,_0x5a924b){var _0x324a67=function(_0x31fc59){while(--_0x31fc59){_0x3f9099['push'](_0x3f9099['shift']());}};_0x324a67(++_0x5a924b);}(_0xbd75,0x1bf));var _0x5bd7=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xbd75[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x5bd7('0x0'));var util=require(_0x5bd7('0x1'));var path=require('path');var timeout=require(_0x5bd7('0x2'));var express=require(_0x5bd7('0x3'));var router=express[_0x5bd7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5bd7('0x5'));var config=require(_0x5bd7('0x6'));var controller=require(_0x5bd7('0x7'));router[_0x5bd7('0x8')]('/',auth[_0x5bd7('0x9')](),controller['index']);router[_0x5bd7('0x8')](_0x5bd7('0xa'),auth['isAuthenticated'](),controller[_0x5bd7('0xb')]);router['post']('/',auth[_0x5bd7('0x9')](),controller[_0x5bd7('0xc')]);router[_0x5bd7('0xd')]('/:id',auth[_0x5bd7('0x9')](),controller[_0x5bd7('0xe')]);router[_0x5bd7('0xf')](_0x5bd7('0xa'),auth['isAuthenticated'](),controller[_0x5bd7('0x10')]);module[_0x5bd7('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 d5ae27d..50d7fe9 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 _0xd67b=['ENUM','out','exports','TEXT','medium'];(function(_0x2aa161,_0x236bf0){var _0x23f86d=function(_0xe0584){while(--_0xe0584){_0x2aa161['push'](_0x2aa161['shift']());}};_0x23f86d(++_0x236bf0);}(_0xd67b,0x133));var _0xbd67=function(_0x308354,_0x4433a5){_0x308354=_0x308354-0x0;var _0x38d4e9=_0xd67b[_0x308354];return _0x38d4e9;};'use strict';var Sequelize=require('sequelize');module[_0xbd67('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xbd67('0x1')](_0xbd67('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xbd67('0x3')]('in','out'),'defaultValue':_0xbd67('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbd67('0x1')]}}; \ No newline at end of file +var _0xd6d6=['STRING','TEXT','ENUM','out','sequelize','exports'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x1ba1ae,_0x4751c8){_0x1ba1ae=_0x1ba1ae-0x0;var _0x59a7a3=_0xd6d6[_0x1ba1ae];return _0x59a7a3;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'body':{'type':Sequelize[_0x6d6d('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x6d6d('0x4')]('in',_0x6d6d('0x5')),'defaultValue':_0x6d6d('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6d6d('0x2')]},'providerResponse':{'type':Sequelize[_0x6d6d('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index df65b80..2908c57 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 _0x1419=['html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','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','status','end','json','count','limit','set','Content-Range','apply','save','update','destroy','error','name','send','index','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','offset','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','SquareMessage','includeAll','include','findAll','rows','then','params','keys','rawAttributes','find','create','body','catch'];(function(_0x586fdb,_0x3f61c9){var _0x43d731=function(_0x71cccc){while(--_0x71cccc){_0x586fdb['push'](_0x586fdb['shift']());}};_0x43d731(++_0x3f61c9);}(_0x1419,0x1bc));var _0x9141=function(_0x2ad4e6,_0x29e609){_0x2ad4e6=_0x2ad4e6-0x0;var _0x4242c1=_0x1419[_0x2ad4e6];return _0x4242c1;};'use strict';var pdf=require(_0x9141('0x0'));var emlformat=require(_0x9141('0x1'));var rimraf=require(_0x9141('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9141('0x3'));var rp=require(_0x9141('0x4'));var moment=require(_0x9141('0x5'));var BPromise=require(_0x9141('0x6'));var Mustache=require('mustache');var util=require(_0x9141('0x7'));var path=require('path');var sox=require(_0x9141('0x8'));var csv=require('to-csv');var ejs=require(_0x9141('0x9'));var fs=require('fs');var _=require(_0x9141('0xa'));var squel=require('squel');var crypto=require(_0x9141('0xb'));var jsforce=require(_0x9141('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9141('0xd'));var querystring=require(_0x9141('0xe'));var Papa=require(_0x9141('0xf'));var Redis=require(_0x9141('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9141('0x11'));var as=require(_0x9141('0x12'));var hardwareService=require(_0x9141('0x13'));var logger=require(_0x9141('0x14'))(_0x9141('0x15'));var utils=require(_0x9141('0x16'));var config=require(_0x9141('0x17'));var licenseUtil=require(_0x9141('0x18'));var db=require(_0x9141('0x19'))['db'];function respondWithStatusCode(_0xd7a90c,_0x43eb00){_0x43eb00=_0x43eb00||0xcc;return function(_0x23570a){if(_0x23570a){return _0xd7a90c['sendStatus'](_0x43eb00);}return _0xd7a90c[_0x9141('0x1a')](_0x43eb00)[_0x9141('0x1b')]();};}function respondWithResult(_0x37d22f,_0x5b0dcf){_0x5b0dcf=_0x5b0dcf||0xc8;return function(_0x2e1e57){if(_0x2e1e57){return _0x37d22f[_0x9141('0x1a')](_0x5b0dcf)[_0x9141('0x1c')](_0x2e1e57);}};}function respondWithFilteredResult(_0x47f5a0,_0x5e9e07){return function(_0x5155ca){if(_0x5155ca){var _0x4443ff=_0x5155ca[_0x9141('0x1d')],_0x165783=_0x5e9e07['offset'],_0x22ece0=_0x5e9e07['offset']+_0x5e9e07[_0x9141('0x1e')],_0x4e1115;if(_0x22ece0>=_0x4443ff){_0x22ece0=_0x4443ff;_0x4e1115=0xc8;}else{_0x4e1115=0xce;}_0x47f5a0['status'](_0x4e1115);return _0x47f5a0[_0x9141('0x1f')](_0x9141('0x20'),_0x165783+'-'+_0x22ece0+'/'+_0x4443ff)[_0x9141('0x1c')](_0x5155ca);}return null;};}function patchUpdates(_0x42dee8){return function(_0x52e763){try{jsonpatch[_0x9141('0x21')](_0x52e763,_0x42dee8,!![]);}catch(_0x291e3c){return BPromise['reject'](_0x291e3c);}return _0x52e763[_0x9141('0x22')]();};}function saveUpdates(_0x1c8063,_0x33fe1f){return function(_0x2515fb){if(_0x2515fb){return _0x2515fb[_0x9141('0x23')](_0x1c8063)['then'](function(_0x3637d2){return _0x3637d2;});}return null;};}function removeEntity(_0x1d1287,_0x35ef6a){return function(_0x3f4ffc){if(_0x3f4ffc){return _0x3f4ffc[_0x9141('0x24')]()['then'](function(){_0x1d1287['status'](0xcc)[_0x9141('0x1b')]();});}};}function handleEntityNotFound(_0x586cd5,_0x1de309){return function(_0x15a19a){if(!_0x15a19a){_0x586cd5['sendStatus'](0x194);}return _0x15a19a;};}function handleError(_0x1c081c,_0x1b4a32){_0x1b4a32=_0x1b4a32||0x1f4;return function(_0x881928){logger[_0x9141('0x25')](_0x881928['stack']);if(_0x881928[_0x9141('0x26')]){delete _0x881928[_0x9141('0x26')];}_0x1c081c[_0x9141('0x1a')](_0x1b4a32)[_0x9141('0x27')](_0x881928);};}exports[_0x9141('0x28')]=function(_0x4f2acc,_0x252c00){var _0x3dabc2={},_0x319246={},_0x4fcb94={'count':0x0,'rows':[]};var _0x31a426=_['map'](db['SquareMessage']['rawAttributes'],function(_0x3b3a10){return{'name':_0x3b3a10['fieldName'],'type':_0x3b3a10[_0x9141('0x29')][_0x9141('0x2a')]};});_0x319246['model']=_['map'](_0x31a426,_0x9141('0x26'));_0x319246[_0x9141('0x2b')]=_['keys'](_0x4f2acc[_0x9141('0x2b')]);_0x319246['filters']=_[_0x9141('0x2c')](_0x319246['model'],_0x319246[_0x9141('0x2b')]);_0x3dabc2[_0x9141('0x2d')]=_[_0x9141('0x2c')](_0x319246[_0x9141('0x2e')],qs[_0x9141('0x2f')](_0x4f2acc['query'][_0x9141('0x2f')]));_0x3dabc2[_0x9141('0x2d')]=_0x3dabc2['attributes'][_0x9141('0x30')]?_0x3dabc2['attributes']:_0x319246[_0x9141('0x2e')];if(!_0x4f2acc['query'][_0x9141('0x31')]('nolimit')){_0x3dabc2[_0x9141('0x1e')]=qs[_0x9141('0x1e')](_0x4f2acc[_0x9141('0x2b')][_0x9141('0x1e')]);_0x3dabc2[_0x9141('0x32')]=qs[_0x9141('0x32')](_0x4f2acc[_0x9141('0x2b')][_0x9141('0x32')]);}_0x3dabc2[_0x9141('0x33')]=qs[_0x9141('0x34')](_0x4f2acc[_0x9141('0x2b')]['sort']);_0x3dabc2[_0x9141('0x35')]=qs[_0x9141('0x36')](_[_0x9141('0x37')](_0x4f2acc[_0x9141('0x2b')],_0x319246[_0x9141('0x36')]),_0x31a426);if(_0x4f2acc[_0x9141('0x2b')]['filter']){_0x3dabc2[_0x9141('0x35')]=_[_0x9141('0x38')](_0x3dabc2['where'],{'$or':_[_0x9141('0x39')](_0x31a426,function(_0x448d3e){if(_0x448d3e[_0x9141('0x29')]!==_0x9141('0x3a')){var _0x172be1={};_0x172be1[_0x448d3e[_0x9141('0x26')]]={'$like':'%'+_0x4f2acc[_0x9141('0x2b')][_0x9141('0x3b')]+'%'};return _0x172be1;}})});}_0x3dabc2=_['merge']({},_0x3dabc2,_0x4f2acc[_0x9141('0x3c')]);var _0x239c0f={'where':_0x3dabc2['where']};return db[_0x9141('0x3d')][_0x9141('0x1d')](_0x239c0f)['then'](function(_0x5d6d6d){_0x4fcb94[_0x9141('0x1d')]=_0x5d6d6d;if(_0x4f2acc[_0x9141('0x2b')][_0x9141('0x3e')]){_0x3dabc2[_0x9141('0x3f')]=[{'all':!![]}];}return db[_0x9141('0x3d')][_0x9141('0x40')](_0x3dabc2);})['then'](function(_0x335137){_0x4fcb94[_0x9141('0x41')]=_0x335137;return _0x4fcb94;})[_0x9141('0x42')](respondWithFilteredResult(_0x252c00,_0x3dabc2))['catch'](handleError(_0x252c00,null));};exports['show']=function(_0x1a0a86,_0xa57043){var _0x1580f3={'raw':!![],'where':{'id':_0x1a0a86[_0x9141('0x43')]['id']}},_0x5792a8={};_0x5792a8[_0x9141('0x2e')]=_[_0x9141('0x44')](db[_0x9141('0x3d')][_0x9141('0x45')]);_0x5792a8[_0x9141('0x2b')]=_[_0x9141('0x44')](_0x1a0a86[_0x9141('0x2b')]);_0x5792a8[_0x9141('0x36')]=_[_0x9141('0x2c')](_0x5792a8['model'],_0x5792a8[_0x9141('0x2b')]);_0x1580f3['attributes']=_['intersection'](_0x5792a8[_0x9141('0x2e')],qs[_0x9141('0x2f')](_0x1a0a86[_0x9141('0x2b')][_0x9141('0x2f')]));_0x1580f3['attributes']=_0x1580f3[_0x9141('0x2d')][_0x9141('0x30')]?_0x1580f3[_0x9141('0x2d')]:_0x5792a8['model'];if(_0x1a0a86[_0x9141('0x2b')]['includeAll']){_0x1580f3[_0x9141('0x3f')]=[{'all':!![]}];}_0x1580f3=_[_0x9141('0x38')]({},_0x1580f3,_0x1a0a86[_0x9141('0x3c')]);return db[_0x9141('0x3d')][_0x9141('0x46')](_0x1580f3)[_0x9141('0x42')](handleEntityNotFound(_0xa57043,null))[_0x9141('0x42')](respondWithResult(_0xa57043,null))['catch'](handleError(_0xa57043,null));};exports[_0x9141('0x47')]=function(_0x259a80,_0xe14325){return db[_0x9141('0x3d')][_0x9141('0x47')](_0x259a80[_0x9141('0x48')],{})[_0x9141('0x42')](respondWithResult(_0xe14325,0xc9))[_0x9141('0x49')](handleError(_0xe14325,null));};exports['update']=function(_0xe86c28,_0x5232c){if(_0xe86c28[_0x9141('0x48')]['id']){delete _0xe86c28[_0x9141('0x48')]['id'];}return db[_0x9141('0x3d')]['find']({'where':{'id':_0xe86c28[_0x9141('0x43')]['id']}})['then'](handleEntityNotFound(_0x5232c,null))[_0x9141('0x42')](saveUpdates(_0xe86c28[_0x9141('0x48')],null))[_0x9141('0x42')](respondWithResult(_0x5232c,null))['catch'](handleError(_0x5232c,null));};exports[_0x9141('0x24')]=function(_0x53a097,_0x1eba32){return db[_0x9141('0x3d')][_0x9141('0x46')]({'where':{'id':_0x53a097[_0x9141('0x43')]['id']}})[_0x9141('0x42')](handleEntityNotFound(_0x1eba32,null))['then'](removeEntity(_0x1eba32,null))[_0x9141('0x49')](handleError(_0x1eba32,null));}; \ No newline at end of file +var _0x5aa5=['create','body','destroy','html-pdf','eml-format','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','error','stack','name','send','map','SquareMessage','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','length','find'];(function(_0x5ae88c,_0x13bbd6){var _0x2d0667=function(_0x3c2585){while(--_0x3c2585){_0x5ae88c['push'](_0x5ae88c['shift']());}};_0x2d0667(++_0x13bbd6);}(_0x5aa5,0x16b));var _0x55aa=function(_0x10f20f,_0xab1de4){_0x10f20f=_0x10f20f-0x0;var _0x310f73=_0x5aa5[_0x10f20f];return _0x310f73;};'use strict';var pdf=require(_0x55aa('0x0'));var emlformat=require(_0x55aa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x55aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x55aa('0x3'));var Mustache=require(_0x55aa('0x4'));var util=require('util');var path=require(_0x55aa('0x5'));var sox=require(_0x55aa('0x6'));var csv=require(_0x55aa('0x7'));var ejs=require(_0x55aa('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x55aa('0x9'));var crypto=require('crypto');var jsforce=require(_0x55aa('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x55aa('0x7'));var querystring=require(_0x55aa('0xb'));var Papa=require(_0x55aa('0xc'));var Redis=require(_0x55aa('0xd'));var authService=require(_0x55aa('0xe'));var qs=require(_0x55aa('0xf'));var as=require(_0x55aa('0x10'));var hardwareService=require(_0x55aa('0x11'));var logger=require(_0x55aa('0x12'))('api');var utils=require(_0x55aa('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x55aa('0x14'));var db=require(_0x55aa('0x15'))['db'];function respondWithStatusCode(_0x47c61c,_0x4848d3){_0x4848d3=_0x4848d3||0xcc;return function(_0x2417df){if(_0x2417df){return _0x47c61c[_0x55aa('0x16')](_0x4848d3);}return _0x47c61c[_0x55aa('0x17')](_0x4848d3)[_0x55aa('0x18')]();};}function respondWithResult(_0x3459fd,_0x52ece2){_0x52ece2=_0x52ece2||0xc8;return function(_0x568c28){if(_0x568c28){return _0x3459fd[_0x55aa('0x17')](_0x52ece2)[_0x55aa('0x19')](_0x568c28);}};}function respondWithFilteredResult(_0x10b302,_0x4c00c2){return function(_0x22086a){if(_0x22086a){var _0x15173f=_0x22086a[_0x55aa('0x1a')],_0x5d0974=_0x4c00c2[_0x55aa('0x1b')],_0x13a02e=_0x4c00c2[_0x55aa('0x1b')]+_0x4c00c2[_0x55aa('0x1c')],_0x5ceb69;if(_0x13a02e>=_0x15173f){_0x13a02e=_0x15173f;_0x5ceb69=0xc8;}else{_0x5ceb69=0xce;}_0x10b302[_0x55aa('0x17')](_0x5ceb69);return _0x10b302[_0x55aa('0x1d')]('Content-Range',_0x5d0974+'-'+_0x13a02e+'/'+_0x15173f)[_0x55aa('0x19')](_0x22086a);}return null;};}function patchUpdates(_0x33ff28){return function(_0x4cf13d){try{jsonpatch['apply'](_0x4cf13d,_0x33ff28,!![]);}catch(_0x54082c){return BPromise[_0x55aa('0x1e')](_0x54082c);}return _0x4cf13d[_0x55aa('0x1f')]();};}function saveUpdates(_0x31ea84,_0x233d32){return function(_0x4b688f){if(_0x4b688f){return _0x4b688f[_0x55aa('0x20')](_0x31ea84)[_0x55aa('0x21')](function(_0x1241c8){return _0x1241c8;});}return null;};}function removeEntity(_0x38250f,_0x5413d2){return function(_0x104dfa){if(_0x104dfa){return _0x104dfa['destroy']()[_0x55aa('0x21')](function(){_0x38250f[_0x55aa('0x17')](0xcc)[_0x55aa('0x18')]();});}};}function handleEntityNotFound(_0xe51338,_0x5442df){return function(_0x1bb06b){if(!_0x1bb06b){_0xe51338[_0x55aa('0x16')](0x194);}return _0x1bb06b;};}function handleError(_0x3bca51,_0x4fa2e0){_0x4fa2e0=_0x4fa2e0||0x1f4;return function(_0x566af1){logger[_0x55aa('0x22')](_0x566af1[_0x55aa('0x23')]);if(_0x566af1[_0x55aa('0x24')]){delete _0x566af1[_0x55aa('0x24')];}_0x3bca51[_0x55aa('0x17')](_0x4fa2e0)[_0x55aa('0x25')](_0x566af1);};}exports['index']=function(_0x4ee84d,_0x52ad8e){var _0x406988={},_0x4346df={},_0x5b3a32={'count':0x0,'rows':[]};var _0x6da46f=_[_0x55aa('0x26')](db[_0x55aa('0x27')]['rawAttributes'],function(_0x1188f8){return{'name':_0x1188f8['fieldName'],'type':_0x1188f8[_0x55aa('0x28')][_0x55aa('0x29')]};});_0x4346df[_0x55aa('0x2a')]=_[_0x55aa('0x26')](_0x6da46f,_0x55aa('0x24'));_0x4346df['query']=_['keys'](_0x4ee84d[_0x55aa('0x2b')]);_0x4346df['filters']=_[_0x55aa('0x2c')](_0x4346df[_0x55aa('0x2a')],_0x4346df[_0x55aa('0x2b')]);_0x406988['attributes']=_[_0x55aa('0x2c')](_0x4346df[_0x55aa('0x2a')],qs[_0x55aa('0x2d')](_0x4ee84d[_0x55aa('0x2b')]['fields']));_0x406988[_0x55aa('0x2e')]=_0x406988[_0x55aa('0x2e')]['length']?_0x406988[_0x55aa('0x2e')]:_0x4346df['model'];if(!_0x4ee84d[_0x55aa('0x2b')][_0x55aa('0x2f')](_0x55aa('0x30'))){_0x406988[_0x55aa('0x1c')]=qs['limit'](_0x4ee84d[_0x55aa('0x2b')]['limit']);_0x406988[_0x55aa('0x1b')]=qs[_0x55aa('0x1b')](_0x4ee84d[_0x55aa('0x2b')]['offset']);}_0x406988[_0x55aa('0x31')]=qs[_0x55aa('0x32')](_0x4ee84d[_0x55aa('0x2b')][_0x55aa('0x32')]);_0x406988[_0x55aa('0x33')]=qs[_0x55aa('0x34')](_[_0x55aa('0x35')](_0x4ee84d['query'],_0x4346df[_0x55aa('0x34')]),_0x6da46f);if(_0x4ee84d[_0x55aa('0x2b')][_0x55aa('0x36')]){_0x406988['where']=_[_0x55aa('0x37')](_0x406988[_0x55aa('0x33')],{'$or':_['map'](_0x6da46f,function(_0x1606df){if(_0x1606df['type']!==_0x55aa('0x38')){var _0x4ad038={};_0x4ad038[_0x1606df['name']]={'$like':'%'+_0x4ee84d[_0x55aa('0x2b')][_0x55aa('0x36')]+'%'};return _0x4ad038;}})});}_0x406988=_[_0x55aa('0x37')]({},_0x406988,_0x4ee84d[_0x55aa('0x39')]);var _0xdc731b={'where':_0x406988['where']};return db[_0x55aa('0x27')][_0x55aa('0x1a')](_0xdc731b)['then'](function(_0x207a25){_0x5b3a32[_0x55aa('0x1a')]=_0x207a25;if(_0x4ee84d[_0x55aa('0x2b')][_0x55aa('0x3a')]){_0x406988[_0x55aa('0x3b')]=[{'all':!![]}];}return db['SquareMessage'][_0x55aa('0x3c')](_0x406988);})[_0x55aa('0x21')](function(_0x1ec464){_0x5b3a32[_0x55aa('0x3d')]=_0x1ec464;return _0x5b3a32;})[_0x55aa('0x21')](respondWithFilteredResult(_0x52ad8e,_0x406988))[_0x55aa('0x3e')](handleError(_0x52ad8e,null));};exports[_0x55aa('0x3f')]=function(_0x4c122f,_0x1bdde3){var _0x4c6d4c={'raw':!![],'where':{'id':_0x4c122f[_0x55aa('0x40')]['id']}},_0x5317d6={};_0x5317d6[_0x55aa('0x2a')]=_['keys'](db[_0x55aa('0x27')][_0x55aa('0x41')]);_0x5317d6[_0x55aa('0x2b')]=_[_0x55aa('0x42')](_0x4c122f[_0x55aa('0x2b')]);_0x5317d6['filters']=_[_0x55aa('0x2c')](_0x5317d6[_0x55aa('0x2a')],_0x5317d6['query']);_0x4c6d4c['attributes']=_[_0x55aa('0x2c')](_0x5317d6[_0x55aa('0x2a')],qs['fields'](_0x4c122f[_0x55aa('0x2b')]['fields']));_0x4c6d4c[_0x55aa('0x2e')]=_0x4c6d4c[_0x55aa('0x2e')][_0x55aa('0x43')]?_0x4c6d4c['attributes']:_0x5317d6[_0x55aa('0x2a')];if(_0x4c122f[_0x55aa('0x2b')]['includeAll']){_0x4c6d4c[_0x55aa('0x3b')]=[{'all':!![]}];}_0x4c6d4c=_[_0x55aa('0x37')]({},_0x4c6d4c,_0x4c122f[_0x55aa('0x39')]);return db['SquareMessage'][_0x55aa('0x44')](_0x4c6d4c)[_0x55aa('0x21')](handleEntityNotFound(_0x1bdde3,null))[_0x55aa('0x21')](respondWithResult(_0x1bdde3,null))['catch'](handleError(_0x1bdde3,null));};exports['create']=function(_0x25aa3a,_0x3b5189){return db[_0x55aa('0x27')][_0x55aa('0x45')](_0x25aa3a[_0x55aa('0x46')],{})[_0x55aa('0x21')](respondWithResult(_0x3b5189,0xc9))[_0x55aa('0x3e')](handleError(_0x3b5189,null));};exports[_0x55aa('0x20')]=function(_0x5f3ffc,_0x572a7a){if(_0x5f3ffc['body']['id']){delete _0x5f3ffc[_0x55aa('0x46')]['id'];}return db[_0x55aa('0x27')][_0x55aa('0x44')]({'where':{'id':_0x5f3ffc[_0x55aa('0x40')]['id']}})['then'](handleEntityNotFound(_0x572a7a,null))[_0x55aa('0x21')](saveUpdates(_0x5f3ffc['body'],null))[_0x55aa('0x21')](respondWithResult(_0x572a7a,null))[_0x55aa('0x3e')](handleError(_0x572a7a,null));};exports[_0x55aa('0x47')]=function(_0x19ad09,_0x481830){return db['SquareMessage'][_0x55aa('0x44')]({'where':{'id':_0x19ad09['params']['id']}})['then'](handleEntityNotFound(_0x481830,null))[_0x55aa('0x21')](removeEntity(_0x481830,null))[_0x55aa('0x3e')](handleError(_0x481830,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 63cab42..1e814d2 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 _0xa4ae=['./squareMessage.attributes','exports','define','SquareMessage','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x56e2d3,_0x303138){var _0x432040=function(_0x53b4b3){while(--_0x53b4b3){_0x56e2d3['push'](_0x56e2d3['shift']());}};_0x432040(++_0x303138);}(_0xa4ae,0x1f3));var _0xea4a=function(_0x58b301,_0x45e991){_0x58b301=_0x58b301-0x0;var _0x2171b3=_0xa4ae[_0x58b301];return _0x2171b3;};'use strict';var _=require('lodash');var util=require(_0xea4a('0x0'));var logger=require(_0xea4a('0x1'))(_0xea4a('0x2'));var moment=require(_0xea4a('0x3'));var BPromise=require('bluebird');var rp=require(_0xea4a('0x4'));var fs=require('fs');var path=require(_0xea4a('0x5'));var rimraf=require(_0xea4a('0x6'));var config=require('../../config/environment');var attributes=require(_0xea4a('0x7'));module[_0xea4a('0x8')]=function(_0x349608,_0x4e5273){return _0x349608[_0xea4a('0x9')](_0xea4a('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4675=['../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x19cfac,_0x3745dc){var _0x25d2a5=function(_0x2bad78){while(--_0x2bad78){_0x19cfac['push'](_0x19cfac['shift']());}};_0x25d2a5(++_0x3745dc);}(_0x4675,0x16d));var _0x5467=function(_0x4b58b2,_0x9b8ea5){_0x4b58b2=_0x4b58b2-0x0;var _0x42e987=_0x4675[_0x4b58b2];return _0x42e987;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5467('0x0'))(_0x5467('0x1'));var moment=require(_0x5467('0x2'));var BPromise=require(_0x5467('0x3'));var rp=require(_0x5467('0x4'));var fs=require('fs');var path=require(_0x5467('0x5'));var rimraf=require(_0x5467('0x6'));var config=require(_0x5467('0x7'));var attributes=require(_0x5467('0x8'));module['exports']=function(_0x56293c,_0x43884a){return _0x56293c[_0x5467('0x9')](_0x5467('0xa'),attributes,{'tableName':_0x5467('0xb'),'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 a7fdf7c..16d3aa0 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(_0x526470,_0xd952d9){var _0x5b43f9=function(_0x30a2c8){while(--_0x30a2c8){_0x526470['push'](_0x526470['shift']());}};_0x5b43f9(++_0xd952d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x1ca433,_0x2db7b0){var _0x206a09=function(_0x5df052){while(--_0x5df052){_0x1ca433['push'](_0x1ca433['shift']());}};_0x206a09(++_0x2db7b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 f4dcd82..f72566a 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 _0x03e5=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','put'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x03e5,0x128));var _0x503e=function(_0x4f70fc,_0x1c006b){_0x4f70fc=_0x4f70fc-0x0;var _0xde6b05=_0x03e5[_0x4f70fc];return _0xde6b05;};'use strict';var multer=require(_0x503e('0x0'));var util=require(_0x503e('0x1'));var path=require(_0x503e('0x2'));var timeout=require(_0x503e('0x3'));var express=require(_0x503e('0x4'));var router=express[_0x503e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x503e('0x6'));var config=require(_0x503e('0x7'));var controller=require('./squareOdbc.controller');router[_0x503e('0x8')]('/',auth[_0x503e('0x9')](),controller[_0x503e('0xa')]);router['get'](_0x503e('0xb'),auth[_0x503e('0x9')](),controller[_0x503e('0xc')]);router[_0x503e('0x8')](_0x503e('0xd'),auth[_0x503e('0x9')](),timeout(_0x503e('0xe')),controller[_0x503e('0xf')]);router[_0x503e('0x10')]('/',auth[_0x503e('0x9')](),controller[_0x503e('0x11')]);router[_0x503e('0x12')](_0x503e('0xb'),auth[_0x503e('0x9')](),controller['update']);router['delete'](_0x503e('0xb'),auth['isAuthenticated'](),controller[_0x503e('0x13')]);module[_0x503e('0x14')]=router; \ No newline at end of file +var _0xa001=['/:id','show','get','15s','test','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','./squareOdbc.controller','isAuthenticated'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0xa001,0x93));var _0x1a00=function(_0x37a21c,_0x54468){_0x37a21c=_0x37a21c-0x0;var _0x9df2b6=_0xa001[_0x37a21c];return _0x9df2b6;};'use strict';var multer=require(_0x1a00('0x0'));var util=require(_0x1a00('0x1'));var path=require('path');var timeout=require(_0x1a00('0x2'));var express=require('express');var router=express[_0x1a00('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a00('0x4'));router['get']('/',auth[_0x1a00('0x5')](),controller['index']);router['get'](_0x1a00('0x6'),auth[_0x1a00('0x5')](),controller[_0x1a00('0x7')]);router[_0x1a00('0x8')]('/:id/test',auth[_0x1a00('0x5')](),timeout(_0x1a00('0x9')),controller[_0x1a00('0xa')]);router[_0x1a00('0xb')]('/',auth[_0x1a00('0x5')](),controller[_0x1a00('0xc')]);router['put'](_0x1a00('0x6'),auth[_0x1a00('0x5')](),controller[_0x1a00('0xd')]);router[_0x1a00('0xe')](_0x1a00('0x6'),auth[_0x1a00('0x5')](),controller[_0x1a00('0xf')]);module[_0x1a00('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 2f6f089..cccf18c 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 _0x1891=['sequelize','exports','STRING','name'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x1891,0x1f4));var _0x1189=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0x1891[_0x1406ae];return _0x23a076;};'use strict';var Sequelize=require(_0x1189('0x0'));module[_0x1189('0x1')]={'name':{'type':Sequelize[_0x1189('0x2')],'unique':_0x1189('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1189('0x2')]}}; \ No newline at end of file +var _0xfd4b=['STRING','name','sequelize','exports'];(function(_0x1dc5a7,_0x448a9f){var _0x4b3f3e=function(_0x1f0cd5){while(--_0x1f0cd5){_0x1dc5a7['push'](_0x1dc5a7['shift']());}};_0x4b3f3e(++_0x448a9f);}(_0xfd4b,0x19e));var _0xbfd4=function(_0x3ee65c,_0x511ad5){_0x3ee65c=_0x3ee65c-0x0;var _0x4f8138=_0xfd4b[_0x3ee65c];return _0x4f8138;};'use strict';var Sequelize=require(_0xbfd4('0x0'));module[_0xbfd4('0x1')]={'name':{'type':Sequelize[_0xbfd4('0x2')],'unique':_0xbfd4('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xbfd4('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 838a533..71c213e 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 _0x6c06=['../../config/license/util','../../mysqldb','status','json','offset','limit','set','Content-Range','reject','save','update','then','get','ODBC','UserProfileResource','end','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','SquareOdbc','count','findAll','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','error','test','odbc','openSync','dsn','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x731761,_0x7b2458){var _0x4f6d56=function(_0x49f3e2){while(--_0x49f3e2){_0x731761['push'](_0x731761['shift']());}};_0x4f6d56(++_0x7b2458);}(_0x6c06,0x1e5));var _0x66c0=function(_0x39e643,_0x5a491c){_0x39e643=_0x39e643-0x0;var _0x27014e=_0x6c06[_0x39e643];return _0x27014e;};'use strict';var pdf=require(_0x66c0('0x0'));var emlformat=require(_0x66c0('0x1'));var rimraf=require(_0x66c0('0x2'));var zipdir=require(_0x66c0('0x3'));var jsonpatch=require(_0x66c0('0x4'));var rp=require(_0x66c0('0x5'));var moment=require(_0x66c0('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x66c0('0x7'));var util=require('util');var path=require(_0x66c0('0x8'));var sox=require(_0x66c0('0x9'));var csv=require(_0x66c0('0xa'));var ejs=require(_0x66c0('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x66c0('0xc'));var crypto=require(_0x66c0('0xd'));var jsforce=require(_0x66c0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x66c0('0xa'));var querystring=require(_0x66c0('0xf'));var Papa=require(_0x66c0('0x10'));var Redis=require('ioredis');var authService=require(_0x66c0('0x11'));var qs=require(_0x66c0('0x12'));var as=require(_0x66c0('0x13'));var hardwareService=require(_0x66c0('0x14'));var logger=require(_0x66c0('0x15'))(_0x66c0('0x16'));var utils=require(_0x66c0('0x17'));var config=require(_0x66c0('0x18'));var licenseUtil=require(_0x66c0('0x19'));var db=require(_0x66c0('0x1a'))['db'];function respondWithStatusCode(_0x4aab7d,_0x5426a0){_0x5426a0=_0x5426a0||0xcc;return function(_0x3c818a){if(_0x3c818a){return _0x4aab7d['sendStatus'](_0x5426a0);}return _0x4aab7d['status'](_0x5426a0)['end']();};}function respondWithResult(_0x397dfb,_0x126e0c){_0x126e0c=_0x126e0c||0xc8;return function(_0x3b9442){if(_0x3b9442){return _0x397dfb[_0x66c0('0x1b')](_0x126e0c)[_0x66c0('0x1c')](_0x3b9442);}};}function respondWithFilteredResult(_0x525e98,_0x34675e){return function(_0x18ee04){if(_0x18ee04){var _0x10665a=_0x18ee04['count'],_0x3fea1c=_0x34675e[_0x66c0('0x1d')],_0x292cc2=_0x34675e[_0x66c0('0x1d')]+_0x34675e[_0x66c0('0x1e')],_0x847aa7;if(_0x292cc2>=_0x10665a){_0x292cc2=_0x10665a;_0x847aa7=0xc8;}else{_0x847aa7=0xce;}_0x525e98[_0x66c0('0x1b')](_0x847aa7);return _0x525e98[_0x66c0('0x1f')](_0x66c0('0x20'),_0x3fea1c+'-'+_0x292cc2+'/'+_0x10665a)[_0x66c0('0x1c')](_0x18ee04);}return null;};}function patchUpdates(_0x3625c0){return function(_0x61cc20){try{jsonpatch['apply'](_0x61cc20,_0x3625c0,!![]);}catch(_0x2aeb41){return BPromise[_0x66c0('0x21')](_0x2aeb41);}return _0x61cc20[_0x66c0('0x22')]();};}function saveUpdates(_0x365608,_0x5a904a){return function(_0x3898ef){if(_0x3898ef){return _0x3898ef[_0x66c0('0x23')](_0x365608)[_0x66c0('0x24')](function(_0x109ef0){return _0x109ef0;});}return null;};}function removeEntity(_0x6e52aa,_0x2290d1){return function(_0x3b7aa0){if(_0x3b7aa0){return _0x3b7aa0['destroy']()[_0x66c0('0x24')](function(){var _0x4f165f=_0x3b7aa0[_0x66c0('0x25')]({'plain':!![]});var _0x2b98a0=_0x66c0('0x26');return db[_0x66c0('0x27')]['destroy']({'where':{'type':_0x2b98a0,'resourceId':_0x4f165f['id']}})[_0x66c0('0x24')](function(){return _0x3b7aa0;});})['then'](function(){_0x6e52aa[_0x66c0('0x1b')](0xcc)[_0x66c0('0x28')]();});}};}function handleEntityNotFound(_0x3bf0d5,_0x3576fa){return function(_0x580094){if(!_0x580094){_0x3bf0d5['sendStatus'](0x194);}return _0x580094;};}function handleError(_0x4bf180,_0x1d1db3){_0x1d1db3=_0x1d1db3||0x1f4;return function(_0x671ff3){logger['error'](_0x671ff3[_0x66c0('0x29')]);if(_0x671ff3[_0x66c0('0x2a')]){delete _0x671ff3[_0x66c0('0x2a')];}_0x4bf180[_0x66c0('0x1b')](_0x1d1db3)[_0x66c0('0x2b')](_0x671ff3);};}exports['index']=function(_0x4eb492,_0x39236d){var _0x5d747e={},_0x27ff61={},_0xf0e851={'count':0x0,'rows':[]};var _0x4853cf=_[_0x66c0('0x2c')](db['SquareOdbc'][_0x66c0('0x2d')],function(_0x17d20a){return{'name':_0x17d20a[_0x66c0('0x2e')],'type':_0x17d20a[_0x66c0('0x2f')]['key']};});_0x27ff61[_0x66c0('0x30')]=_[_0x66c0('0x2c')](_0x4853cf,_0x66c0('0x2a'));_0x27ff61[_0x66c0('0x31')]=_[_0x66c0('0x32')](_0x4eb492['query']);_0x27ff61[_0x66c0('0x33')]=_[_0x66c0('0x34')](_0x27ff61['model'],_0x27ff61[_0x66c0('0x31')]);_0x5d747e[_0x66c0('0x35')]=_[_0x66c0('0x34')](_0x27ff61[_0x66c0('0x30')],qs[_0x66c0('0x36')](_0x4eb492[_0x66c0('0x31')][_0x66c0('0x36')]));_0x5d747e[_0x66c0('0x35')]=_0x5d747e[_0x66c0('0x35')]['length']?_0x5d747e['attributes']:_0x27ff61['model'];if(!_0x4eb492['query'][_0x66c0('0x37')]('nolimit')){_0x5d747e[_0x66c0('0x1e')]=qs[_0x66c0('0x1e')](_0x4eb492[_0x66c0('0x31')]['limit']);_0x5d747e['offset']=qs[_0x66c0('0x1d')](_0x4eb492[_0x66c0('0x31')][_0x66c0('0x1d')]);}_0x5d747e['order']=qs['sort'](_0x4eb492[_0x66c0('0x31')][_0x66c0('0x38')]);_0x5d747e[_0x66c0('0x39')]=qs[_0x66c0('0x33')](_[_0x66c0('0x3a')](_0x4eb492[_0x66c0('0x31')],_0x27ff61[_0x66c0('0x33')]),_0x4853cf);if(_0x4eb492[_0x66c0('0x31')][_0x66c0('0x3b')]){_0x5d747e['where']=_[_0x66c0('0x3c')](_0x5d747e[_0x66c0('0x39')],{'$or':_['map'](_0x4853cf,function(_0x2ca3be){if(_0x2ca3be[_0x66c0('0x2f')]!==_0x66c0('0x3d')){var _0x211829={};_0x211829[_0x2ca3be[_0x66c0('0x2a')]]={'$like':'%'+_0x4eb492[_0x66c0('0x31')][_0x66c0('0x3b')]+'%'};return _0x211829;}})});}_0x5d747e=_['merge']({},_0x5d747e,_0x4eb492[_0x66c0('0x3e')]);var _0xdb248e={'where':_0x5d747e[_0x66c0('0x39')]};return db[_0x66c0('0x3f')][_0x66c0('0x40')](_0xdb248e)['then'](function(_0x1d360e){_0xf0e851[_0x66c0('0x40')]=_0x1d360e;if(_0x4eb492[_0x66c0('0x31')]['includeAll']){_0x5d747e['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x66c0('0x41')](_0x5d747e);})[_0x66c0('0x24')](function(_0x21f995){_0xf0e851[_0x66c0('0x42')]=_0x21f995;return _0xf0e851;})[_0x66c0('0x24')](respondWithFilteredResult(_0x39236d,_0x5d747e))['catch'](handleError(_0x39236d,null));};exports[_0x66c0('0x43')]=function(_0x44a1c7,_0x214f67){var _0x2cc501={'raw':!![],'where':{'id':_0x44a1c7[_0x66c0('0x44')]['id']}},_0x1d738d={};_0x1d738d['model']=_[_0x66c0('0x32')](db['SquareOdbc'][_0x66c0('0x2d')]);_0x1d738d[_0x66c0('0x31')]=_[_0x66c0('0x32')](_0x44a1c7['query']);_0x1d738d[_0x66c0('0x33')]=_[_0x66c0('0x34')](_0x1d738d[_0x66c0('0x30')],_0x1d738d[_0x66c0('0x31')]);_0x2cc501[_0x66c0('0x35')]=_[_0x66c0('0x34')](_0x1d738d[_0x66c0('0x30')],qs[_0x66c0('0x36')](_0x44a1c7[_0x66c0('0x31')]['fields']));_0x2cc501[_0x66c0('0x35')]=_0x2cc501[_0x66c0('0x35')][_0x66c0('0x45')]?_0x2cc501[_0x66c0('0x35')]:_0x1d738d['model'];if(_0x44a1c7[_0x66c0('0x31')]['includeAll']){_0x2cc501['include']=[{'all':!![]}];}_0x2cc501=_['merge']({},_0x2cc501,_0x44a1c7[_0x66c0('0x3e')]);return db[_0x66c0('0x3f')][_0x66c0('0x46')](_0x2cc501)['then'](handleEntityNotFound(_0x214f67,null))[_0x66c0('0x24')](respondWithResult(_0x214f67,null))['catch'](handleError(_0x214f67,null));};exports[_0x66c0('0x47')]=function(_0x14d9f9,_0xcac6aa){return db[_0x66c0('0x3f')][_0x66c0('0x47')](_0x14d9f9[_0x66c0('0x48')],{})['then'](function(_0x24ac77){var _0x363cba=_0x14d9f9[_0x66c0('0x49')][_0x66c0('0x25')]({'plain':!![]});if(!_0x363cba)throw new Error(_0x66c0('0x4a'));if(_0x363cba[_0x66c0('0x4b')]===_0x66c0('0x49')){var _0x51c17e=_0x24ac77[_0x66c0('0x25')]({'plain':!![]});var _0x42f607='ODBC';return db[_0x66c0('0x4c')][_0x66c0('0x46')]({'where':{'name':_0x42f607,'userProfileId':_0x363cba['userProfileId']},'raw':!![]})[_0x66c0('0x24')](function(_0x1d942a){if(_0x1d942a&&_0x1d942a[_0x66c0('0x4d')]===0x0){return db[_0x66c0('0x27')]['create']({'name':_0x51c17e['name'],'resourceId':_0x51c17e['id'],'type':_0x1d942a[_0x66c0('0x2a')],'sectionId':_0x1d942a['id']},{})[_0x66c0('0x24')](function(){return _0x24ac77;});}else{return _0x24ac77;}})[_0x66c0('0x4e')](function(_0x3dd440){logger[_0x66c0('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dd440);throw _0x3dd440;});}return _0x24ac77;})['then'](respondWithResult(_0xcac6aa,0xc9))[_0x66c0('0x4e')](handleError(_0xcac6aa,null));};exports[_0x66c0('0x23')]=function(_0xb1864e,_0x263988){if(_0xb1864e['body']['id']){delete _0xb1864e[_0x66c0('0x48')]['id'];}return db['SquareOdbc'][_0x66c0('0x46')]({'where':{'id':_0xb1864e[_0x66c0('0x44')]['id']}})[_0x66c0('0x24')](handleEntityNotFound(_0x263988,null))['then'](saveUpdates(_0xb1864e['body'],null))[_0x66c0('0x24')](respondWithResult(_0x263988,null))[_0x66c0('0x4e')](handleError(_0x263988,null));};exports['destroy']=function(_0x3a1c51,_0x5611e5){return db[_0x66c0('0x3f')][_0x66c0('0x46')]({'where':{'id':_0x3a1c51[_0x66c0('0x44')]['id']}})[_0x66c0('0x24')](handleEntityNotFound(_0x5611e5,null))['then'](removeEntity(_0x5611e5,null))[_0x66c0('0x4e')](handleError(_0x5611e5,null));};exports[_0x66c0('0x50')]=function(_0x514fd5,_0x18ee40,_0x2ada99){var _0x890430;return db['SquareOdbc']['find']({'where':{'id':_0x514fd5[_0x66c0('0x44')]['id']},'attributes':['id','dsn']})[_0x66c0('0x24')](handleEntityNotFound(_0x18ee40,null))[_0x66c0('0x24')](function(_0x3d3314){if(_0x3d3314){var _0x1ab55e=require(_0x66c0('0x51'))();_0x1ab55e[_0x66c0('0x52')](_0x3d3314[_0x66c0('0x53')]);_0x1ab55e[_0x66c0('0x54')]();return _0x3d3314;}})[_0x66c0('0x24')](respondWithResult(_0x18ee40,null))['catch'](handleError(_0x18ee40,null));}; \ No newline at end of file +var _0x7472=['attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','update','test','dsn','odbc','html-pdf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','then','destroy','get','ODBC','end','stack','name','SquareOdbc','fieldName','type','key','model','query','filters','intersection'];(function(_0x2d3e45,_0x16d47a){var _0x369ff5=function(_0x4dfc35){while(--_0x4dfc35){_0x2d3e45['push'](_0x2d3e45['shift']());}};_0x369ff5(++_0x16d47a);}(_0x7472,0xbd));var _0x2747=function(_0x143395,_0x3cf7d4){_0x143395=_0x143395-0x0;var _0x5768ff=_0x7472[_0x143395];return _0x5768ff;};'use strict';var pdf=require(_0x2747('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2747('0x1'));var jsonpatch=require(_0x2747('0x2'));var rp=require(_0x2747('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2747('0x4'));var path=require(_0x2747('0x5'));var sox=require('sox');var csv=require(_0x2747('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2747('0x7'));var squel=require('squel');var crypto=require(_0x2747('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x2747('0x9'));var toCsv=require(_0x2747('0x6'));var querystring=require(_0x2747('0xa'));var Papa=require(_0x2747('0xb'));var Redis=require(_0x2747('0xc'));var authService=require(_0x2747('0xd'));var qs=require(_0x2747('0xe'));var as=require(_0x2747('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2747('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x2747('0x11'));var db=require(_0x2747('0x12'))['db'];function respondWithStatusCode(_0x517fe0,_0x5c25a8){_0x5c25a8=_0x5c25a8||0xcc;return function(_0x11d8a2){if(_0x11d8a2){return _0x517fe0[_0x2747('0x13')](_0x5c25a8);}return _0x517fe0['status'](_0x5c25a8)['end']();};}function respondWithResult(_0x143515,_0x30b838){_0x30b838=_0x30b838||0xc8;return function(_0x671121){if(_0x671121){return _0x143515[_0x2747('0x14')](_0x30b838)[_0x2747('0x15')](_0x671121);}};}function respondWithFilteredResult(_0x19fc4e,_0xec00a){return function(_0x49f295){if(_0x49f295){var _0x1824d1=_0x49f295[_0x2747('0x16')],_0x49b5cb=_0xec00a[_0x2747('0x17')],_0x3d2cad=_0xec00a['offset']+_0xec00a['limit'],_0xd9d275;if(_0x3d2cad>=_0x1824d1){_0x3d2cad=_0x1824d1;_0xd9d275=0xc8;}else{_0xd9d275=0xce;}_0x19fc4e[_0x2747('0x14')](_0xd9d275);return _0x19fc4e[_0x2747('0x18')](_0x2747('0x19'),_0x49b5cb+'-'+_0x3d2cad+'/'+_0x1824d1)[_0x2747('0x15')](_0x49f295);}return null;};}function patchUpdates(_0x4e9372){return function(_0x3c7cdc){try{jsonpatch[_0x2747('0x1a')](_0x3c7cdc,_0x4e9372,!![]);}catch(_0x346f99){return BPromise['reject'](_0x346f99);}return _0x3c7cdc['save']();};}function saveUpdates(_0x50f954,_0x104ba6){return function(_0x231b9b){if(_0x231b9b){return _0x231b9b['update'](_0x50f954)[_0x2747('0x1b')](function(_0x4e0ee5){return _0x4e0ee5;});}return null;};}function removeEntity(_0x2d3a22,_0x447f80){return function(_0xad3bcc){if(_0xad3bcc){return _0xad3bcc[_0x2747('0x1c')]()['then'](function(){var _0x5c298f=_0xad3bcc[_0x2747('0x1d')]({'plain':!![]});var _0x236232=_0x2747('0x1e');return db['UserProfileResource'][_0x2747('0x1c')]({'where':{'type':_0x236232,'resourceId':_0x5c298f['id']}})[_0x2747('0x1b')](function(){return _0xad3bcc;});})[_0x2747('0x1b')](function(){_0x2d3a22[_0x2747('0x14')](0xcc)[_0x2747('0x1f')]();});}};}function handleEntityNotFound(_0x48da8e,_0x5ec94f){return function(_0x747bc9){if(!_0x747bc9){_0x48da8e['sendStatus'](0x194);}return _0x747bc9;};}function handleError(_0x2da998,_0x5169aa){_0x5169aa=_0x5169aa||0x1f4;return function(_0x39550b){logger['error'](_0x39550b[_0x2747('0x20')]);if(_0x39550b[_0x2747('0x21')]){delete _0x39550b[_0x2747('0x21')];}_0x2da998[_0x2747('0x14')](_0x5169aa)['send'](_0x39550b);};}exports['index']=function(_0x4ced69,_0x1fe1cf){var _0x1dd3ea={},_0x3d1de8={},_0x47df11={'count':0x0,'rows':[]};var _0x1b857a=_['map'](db[_0x2747('0x22')]['rawAttributes'],function(_0x8109a4){return{'name':_0x8109a4[_0x2747('0x23')],'type':_0x8109a4[_0x2747('0x24')][_0x2747('0x25')]};});_0x3d1de8[_0x2747('0x26')]=_['map'](_0x1b857a,_0x2747('0x21'));_0x3d1de8[_0x2747('0x27')]=_['keys'](_0x4ced69[_0x2747('0x27')]);_0x3d1de8[_0x2747('0x28')]=_[_0x2747('0x29')](_0x3d1de8[_0x2747('0x26')],_0x3d1de8['query']);_0x1dd3ea[_0x2747('0x2a')]=_[_0x2747('0x29')](_0x3d1de8[_0x2747('0x26')],qs['fields'](_0x4ced69[_0x2747('0x27')][_0x2747('0x2b')]));_0x1dd3ea[_0x2747('0x2a')]=_0x1dd3ea[_0x2747('0x2a')][_0x2747('0x2c')]?_0x1dd3ea['attributes']:_0x3d1de8[_0x2747('0x26')];if(!_0x4ced69[_0x2747('0x27')][_0x2747('0x2d')](_0x2747('0x2e'))){_0x1dd3ea['limit']=qs[_0x2747('0x2f')](_0x4ced69[_0x2747('0x27')][_0x2747('0x2f')]);_0x1dd3ea[_0x2747('0x17')]=qs[_0x2747('0x17')](_0x4ced69['query'][_0x2747('0x17')]);}_0x1dd3ea['order']=qs[_0x2747('0x30')](_0x4ced69['query'][_0x2747('0x30')]);_0x1dd3ea[_0x2747('0x31')]=qs[_0x2747('0x28')](_[_0x2747('0x32')](_0x4ced69[_0x2747('0x27')],_0x3d1de8[_0x2747('0x28')]),_0x1b857a);if(_0x4ced69['query'][_0x2747('0x33')]){_0x1dd3ea[_0x2747('0x31')]=_[_0x2747('0x34')](_0x1dd3ea[_0x2747('0x31')],{'$or':_[_0x2747('0x35')](_0x1b857a,function(_0x25d39f){if(_0x25d39f[_0x2747('0x24')]!==_0x2747('0x36')){var _0x19180f={};_0x19180f[_0x25d39f[_0x2747('0x21')]]={'$like':'%'+_0x4ced69[_0x2747('0x27')]['filter']+'%'};return _0x19180f;}})});}_0x1dd3ea=_[_0x2747('0x34')]({},_0x1dd3ea,_0x4ced69[_0x2747('0x37')]);var _0x47fd34={'where':_0x1dd3ea[_0x2747('0x31')]};return db['SquareOdbc'][_0x2747('0x16')](_0x47fd34)[_0x2747('0x1b')](function(_0x1c126a){_0x47df11['count']=_0x1c126a;if(_0x4ced69[_0x2747('0x27')]['includeAll']){_0x1dd3ea[_0x2747('0x38')]=[{'all':!![]}];}return db[_0x2747('0x22')][_0x2747('0x39')](_0x1dd3ea);})[_0x2747('0x1b')](function(_0x5f2d03){_0x47df11[_0x2747('0x3a')]=_0x5f2d03;return _0x47df11;})['then'](respondWithFilteredResult(_0x1fe1cf,_0x1dd3ea))[_0x2747('0x3b')](handleError(_0x1fe1cf,null));};exports[_0x2747('0x3c')]=function(_0x44c990,_0x5dd8b3){var _0x2fcbe1={'raw':!![],'where':{'id':_0x44c990[_0x2747('0x3d')]['id']}},_0x44bde6={};_0x44bde6['model']=_[_0x2747('0x3e')](db['SquareOdbc'][_0x2747('0x3f')]);_0x44bde6[_0x2747('0x27')]=_[_0x2747('0x3e')](_0x44c990[_0x2747('0x27')]);_0x44bde6['filters']=_[_0x2747('0x29')](_0x44bde6[_0x2747('0x26')],_0x44bde6[_0x2747('0x27')]);_0x2fcbe1['attributes']=_[_0x2747('0x29')](_0x44bde6['model'],qs[_0x2747('0x2b')](_0x44c990['query']['fields']));_0x2fcbe1['attributes']=_0x2fcbe1['attributes'][_0x2747('0x2c')]?_0x2fcbe1[_0x2747('0x2a')]:_0x44bde6[_0x2747('0x26')];if(_0x44c990['query'][_0x2747('0x40')]){_0x2fcbe1[_0x2747('0x38')]=[{'all':!![]}];}_0x2fcbe1=_['merge']({},_0x2fcbe1,_0x44c990[_0x2747('0x37')]);return db[_0x2747('0x22')][_0x2747('0x41')](_0x2fcbe1)['then'](handleEntityNotFound(_0x5dd8b3,null))[_0x2747('0x1b')](respondWithResult(_0x5dd8b3,null))[_0x2747('0x3b')](handleError(_0x5dd8b3,null));};exports[_0x2747('0x42')]=function(_0x3567c4,_0x4269fc){return db[_0x2747('0x22')]['create'](_0x3567c4[_0x2747('0x43')],{})[_0x2747('0x1b')](function(_0x46adbd){var _0x27ce74=_0x3567c4['user'][_0x2747('0x1d')]({'plain':!![]});if(!_0x27ce74)throw new Error(_0x2747('0x44'));if(_0x27ce74[_0x2747('0x45')]===_0x2747('0x46')){var _0x72c2b9=_0x46adbd[_0x2747('0x1d')]({'plain':!![]});var _0x4f76c6=_0x2747('0x1e');return db[_0x2747('0x47')][_0x2747('0x41')]({'where':{'name':_0x4f76c6,'userProfileId':_0x27ce74['userProfileId']},'raw':!![]})[_0x2747('0x1b')](function(_0x1a1423){if(_0x1a1423&&_0x1a1423['autoAssociation']===0x0){return db[_0x2747('0x48')][_0x2747('0x42')]({'name':_0x72c2b9[_0x2747('0x21')],'resourceId':_0x72c2b9['id'],'type':_0x1a1423[_0x2747('0x21')],'sectionId':_0x1a1423['id']},{})[_0x2747('0x1b')](function(){return _0x46adbd;});}else{return _0x46adbd;}})[_0x2747('0x3b')](function(_0x3645f7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3645f7);throw _0x3645f7;});}return _0x46adbd;})[_0x2747('0x1b')](respondWithResult(_0x4269fc,0xc9))[_0x2747('0x3b')](handleError(_0x4269fc,null));};exports[_0x2747('0x49')]=function(_0x417fea,_0x16cef9){if(_0x417fea[_0x2747('0x43')]['id']){delete _0x417fea[_0x2747('0x43')]['id'];}return db[_0x2747('0x22')][_0x2747('0x41')]({'where':{'id':_0x417fea[_0x2747('0x3d')]['id']}})['then'](handleEntityNotFound(_0x16cef9,null))[_0x2747('0x1b')](saveUpdates(_0x417fea[_0x2747('0x43')],null))[_0x2747('0x1b')](respondWithResult(_0x16cef9,null))[_0x2747('0x3b')](handleError(_0x16cef9,null));};exports[_0x2747('0x1c')]=function(_0x38317b,_0x3d43da){return db['SquareOdbc']['find']({'where':{'id':_0x38317b[_0x2747('0x3d')]['id']}})[_0x2747('0x1b')](handleEntityNotFound(_0x3d43da,null))[_0x2747('0x1b')](removeEntity(_0x3d43da,null))[_0x2747('0x3b')](handleError(_0x3d43da,null));};exports[_0x2747('0x4a')]=function(_0xb06ff0,_0x46b06e,_0x495f48){var _0x313b79;return db[_0x2747('0x22')][_0x2747('0x41')]({'where':{'id':_0xb06ff0[_0x2747('0x3d')]['id']},'attributes':['id',_0x2747('0x4b')]})[_0x2747('0x1b')](handleEntityNotFound(_0x46b06e,null))['then'](function(_0x384159){if(_0x384159){var _0x3889db=require(_0x2747('0x4c'))();_0x3889db['openSync'](_0x384159[_0x2747('0x4b')]);_0x3889db['closeSync']();return _0x384159;}})[_0x2747('0x1b')](respondWithResult(_0x46b06e,null))[_0x2747('0x3b')](handleError(_0x46b06e,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 9c5f1ff..25ab4bd 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 _0xcf9f=['lodash','util','bluebird','path','rimraf','../../config/environment','define','SquareOdbc'];(function(_0x37cbc1,_0x224b70){var _0x528f9b=function(_0xda5316){while(--_0xda5316){_0x37cbc1['push'](_0x37cbc1['shift']());}};_0x528f9b(++_0x224b70);}(_0xcf9f,0x178));var _0xfcf9=function(_0x2263d8,_0x2f5193){_0x2263d8=_0x2263d8-0x0;var _0x43e672=_0xcf9f[_0x2263d8];return _0x43e672;};'use strict';var _=require(_0xfcf9('0x0'));var util=require(_0xfcf9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfcf9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcf9('0x3'));var rimraf=require(_0xfcf9('0x4'));var config=require(_0xfcf9('0x5'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x1b7701,_0x5d7c40){return _0x1b7701[_0xfcf9('0x6')](_0xfcf9('0x7'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4be=['../../config/logger','api','moment','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash'];(function(_0x58c98c,_0x3122f3){var _0x40ed52=function(_0x1e2b17){while(--_0x1e2b17){_0x58c98c['push'](_0x58c98c['shift']());}};_0x40ed52(++_0x3122f3);}(_0xc4be,0x1bb));var _0xec4b=function(_0x2d1304,_0x700af8){_0x2d1304=_0x2d1304-0x0;var _0x47d7b7=_0xc4be[_0x2d1304];return _0x47d7b7;};'use strict';var _=require(_0xec4b('0x0'));var util=require('util');var logger=require(_0xec4b('0x1'))(_0xec4b('0x2'));var moment=require(_0xec4b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xec4b('0x4'));var rimraf=require(_0xec4b('0x5'));var config=require(_0xec4b('0x6'));var attributes=require(_0xec4b('0x7'));module[_0xec4b('0x8')]=function(_0x47f83d,_0x5987c9){return _0x47f83d[_0xec4b('0x9')](_0xec4b('0xa'),attributes,{'tableName':_0xec4b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index f0389b5..c6897d2 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x14a83c,_0x394b54){var _0x345d56=function(_0x34cfcd){while(--_0x34cfcd){_0x14a83c['push'](_0x14a83c['shift']());}};_0x345d56(++_0x394b54);}(_0x5fc3,0xa8));var _0x35fc=function(_0x74745d,_0x177606){_0x74745d=_0x74745d-0x0;var _0x174ab3=_0x5fc3[_0x74745d];return _0x174ab3;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x4c6265,_0x499bc9){var _0x19e126=function(_0x471729){while(--_0x471729){_0x4c6265['push'](_0x4c6265['shift']());}};_0x19e126(++_0x499bc9);}(_0x008c,0x188));var _0xc008=function(_0x18e80c,_0x4077f7){_0x18e80c=_0x18e80c-0x0;var _0x183ba9=_0x008c[_0x18e80c];return _0x183ba9;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 82439f4..e48a189 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 _0x3de3=['update','delete','removeUsers','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id/users','post','create','addUsers','put','/:id'];(function(_0x3510be,_0x2cf8f5){var _0x737e04=function(_0x2527db){while(--_0x2527db){_0x3510be['push'](_0x3510be['shift']());}};_0x737e04(++_0x2cf8f5);}(_0x3de3,0x168));var _0x33de=function(_0x2f5c1b,_0x2c832c){_0x2f5c1b=_0x2f5c1b-0x0;var _0x30df81=_0x3de3[_0x2f5c1b];return _0x30df81;};'use strict';var multer=require('multer');var util=require(_0x33de('0x0'));var path=require(_0x33de('0x1'));var timeout=require(_0x33de('0x2'));var express=require(_0x33de('0x3'));var router=express[_0x33de('0x4')]();var auth=require(_0x33de('0x5'));var interaction=require(_0x33de('0x6'));var config=require(_0x33de('0x7'));var controller=require(_0x33de('0x8'));router[_0x33de('0x9')]('/',auth[_0x33de('0xa')](),controller[_0x33de('0xb')]);router['get']('/:id',auth[_0x33de('0xa')](),controller['show']);router[_0x33de('0x9')](_0x33de('0xc'),auth[_0x33de('0xa')](),controller['getUsers']);router[_0x33de('0xd')]('/',auth[_0x33de('0xa')](),controller[_0x33de('0xe')]);router[_0x33de('0xd')](_0x33de('0xc'),auth['isAuthenticated'](),controller[_0x33de('0xf')]);router[_0x33de('0x10')](_0x33de('0x11'),auth[_0x33de('0xa')](),controller[_0x33de('0x12')]);router['delete'](_0x33de('0x11'),auth[_0x33de('0xa')](),controller['destroy']);router[_0x33de('0x13')]('/:id/users',auth[_0x33de('0xa')](),controller[_0x33de('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9933=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/users','post','update'];(function(_0x70fc99,_0xb87445){var _0x3985f8=function(_0x1caa8c){while(--_0x1caa8c){_0x70fc99['push'](_0x70fc99['shift']());}};_0x3985f8(++_0xb87445);}(_0x9933,0x168));var _0x3993=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9933[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require(_0x3993('0x0'));var path=require(_0x3993('0x1'));var timeout=require(_0x3993('0x2'));var express=require(_0x3993('0x3'));var router=express[_0x3993('0x4')]();var auth=require(_0x3993('0x5'));var interaction=require(_0x3993('0x6'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0x3993('0x7')]('/',auth[_0x3993('0x8')](),controller['index']);router[_0x3993('0x7')](_0x3993('0x9'),auth['isAuthenticated'](),controller[_0x3993('0xa')]);router[_0x3993('0x7')](_0x3993('0xb'),auth[_0x3993('0x8')](),controller['getUsers']);router[_0x3993('0xc')]('/',auth[_0x3993('0x8')](),controller['create']);router[_0x3993('0xc')](_0x3993('0xb'),auth[_0x3993('0x8')](),controller['addUsers']);router['put'](_0x3993('0x9'),auth['isAuthenticated'](),controller[_0x3993('0xd')]);router[_0x3993('0xe')](_0x3993('0x9'),auth[_0x3993('0x8')](),controller[_0x3993('0xf')]);router[_0x3993('0xe')](_0x3993('0xb'),auth['isAuthenticated'](),controller['removeUsers']);module[_0x3993('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 8c6903a..3a15d1e 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 _0x725e=['DATE','sequelize','name','TEXT','BLOB','long','getDataValue','preproduction','toString','production','utf8'];(function(_0x247031,_0x3948d4){var _0x4e6a28=function(_0x1395ea){while(--_0x1395ea){_0x247031['push'](_0x247031['shift']());}};_0x4e6a28(++_0x3948d4);}(_0x725e,0x12a));var _0xe725=function(_0x24c14d,_0x125e66){_0x24c14d=_0x24c14d-0x0;var _0x228823=_0x725e[_0x24c14d];return _0x228823;};'use strict';var Sequelize=require(_0xe725('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe725('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xe725('0x2')]},'preproduction':{'type':Sequelize[_0xe725('0x3')](_0xe725('0x4')),'get':function(){if(this[_0xe725('0x5')]('preproduction')){return this[_0xe725('0x5')](_0xe725('0x6'))[_0xe725('0x7')]('utf8');}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0xe725('0x5')](_0xe725('0x8'))){return this[_0xe725('0x5')](_0xe725('0x8'))[_0xe725('0x7')](_0xe725('0x9'));}}},'savedAt':{'type':Sequelize[_0xe725('0xa')]},'publishedAt':{'type':Sequelize[_0xe725('0xa')]}}; \ No newline at end of file +var _0x01f8=['preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','BLOB','long','getDataValue'];(function(_0x41e991,_0x52c75b){var _0x265e8c=function(_0x5046f5){while(--_0x5046f5){_0x41e991['push'](_0x41e991['shift']());}};_0x265e8c(++_0x52c75b);}(_0x01f8,0x1a7));var _0x801f=function(_0x1fca5c,_0x3fe60c){_0x1fca5c=_0x1fca5c-0x0;var _0x2ebd02=_0x01f8[_0x1fca5c];return _0x2ebd02;};'use strict';var Sequelize=require(_0x801f('0x0'));module[_0x801f('0x1')]={'name':{'type':Sequelize[_0x801f('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x801f('0x3')](_0x801f('0x4')),'get':function(){if(this[_0x801f('0x5')](_0x801f('0x6'))){return this[_0x801f('0x5')](_0x801f('0x6'))[_0x801f('0x7')](_0x801f('0x8'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x801f('0x5')](_0x801f('0x9'))){return this[_0x801f('0x5')](_0x801f('0x9'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x801f('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5f7d6cd..8f44e34 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 _0xf725=['api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','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','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2f14bf,_0x24bab1){var _0x305b16=function(_0x4ea477){while(--_0x4ea477){_0x2f14bf['push'](_0x2f14bf['shift']());}};_0x305b16(++_0x24bab1);}(_0xf725,0x112));var _0x5f72=function(_0x48b19f,_0x7f18fd){_0x48b19f=_0x48b19f-0x0;var _0x211ab2=_0xf725[_0x48b19f];return _0x211ab2;};'use strict';var pdf=require(_0x5f72('0x0'));var emlformat=require(_0x5f72('0x1'));var rimraf=require(_0x5f72('0x2'));var zipdir=require(_0x5f72('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f72('0x4'));var moment=require(_0x5f72('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5f72('0x6'));var util=require('util');var path=require(_0x5f72('0x7'));var sox=require(_0x5f72('0x8'));var csv=require(_0x5f72('0x9'));var ejs=require(_0x5f72('0xa'));var fs=require('fs');var _=require(_0x5f72('0xb'));var squel=require(_0x5f72('0xc'));var crypto=require(_0x5f72('0xd'));var jsforce=require(_0x5f72('0xe'));var deskjs=require(_0x5f72('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5f72('0x10'));var authService=require(_0x5f72('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5f72('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f72('0x13'))(_0x5f72('0x14'));var utils=require('../../config/utils');var config=require(_0x5f72('0x15'));var licenseUtil=require(_0x5f72('0x16'));var db=require(_0x5f72('0x17'))['db'];config['redis']=_[_0x5f72('0x18')](config[_0x5f72('0x19')],{'host':_0x5f72('0x1a'),'port':0x18eb});var socket=require(_0x5f72('0x1b'))(new Redis(config[_0x5f72('0x19')]));require(_0x5f72('0x1c'))['register'](socket);function respondWithStatusCode(_0xa1496d,_0x5f363a){_0x5f363a=_0x5f363a||0xcc;return function(_0x48e8c2){if(_0x48e8c2){return _0xa1496d[_0x5f72('0x1d')](_0x5f363a);}return _0xa1496d[_0x5f72('0x1e')](_0x5f363a)[_0x5f72('0x1f')]();};}function respondWithResult(_0x98a51f,_0x153cf3){_0x153cf3=_0x153cf3||0xc8;return function(_0x54c7b0){if(_0x54c7b0){return _0x98a51f[_0x5f72('0x1e')](_0x153cf3)[_0x5f72('0x20')](_0x54c7b0);}};}function respondWithFilteredResult(_0x35de07,_0x8ceac7){return function(_0x720b78){if(_0x720b78){var _0xb2c317=_0x720b78[_0x5f72('0x21')],_0x2442a6=_0x8ceac7[_0x5f72('0x22')],_0x57c79d=_0x8ceac7[_0x5f72('0x22')]+_0x8ceac7[_0x5f72('0x23')],_0x36b5fb;if(_0x57c79d>=_0xb2c317){_0x57c79d=_0xb2c317;_0x36b5fb=0xc8;}else{_0x36b5fb=0xce;}_0x35de07[_0x5f72('0x1e')](_0x36b5fb);return _0x35de07[_0x5f72('0x24')](_0x5f72('0x25'),_0x2442a6+'-'+_0x57c79d+'/'+_0xb2c317)[_0x5f72('0x20')](_0x720b78);}return null;};}function patchUpdates(_0xa82bf3){return function(_0x2a21d0){try{jsonpatch[_0x5f72('0x26')](_0x2a21d0,_0xa82bf3,!![]);}catch(_0x30166e){return BPromise[_0x5f72('0x27')](_0x30166e);}return _0x2a21d0[_0x5f72('0x28')]();};}function saveUpdates(_0x5945ed,_0x3c590c){return function(_0x139f7d){if(_0x139f7d){return _0x139f7d[_0x5f72('0x29')](_0x5945ed)[_0x5f72('0x2a')](function(_0x110f8f){return _0x110f8f;});}return null;};}function removeEntity(_0x103199,_0x45d36f){return function(_0x3b8cf7){if(_0x3b8cf7){return _0x3b8cf7[_0x5f72('0x2b')]()['then'](function(){var _0x309811=_0x3b8cf7[_0x5f72('0x2c')]({'plain':!![]});var _0x425020=_0x5f72('0x2d');return db[_0x5f72('0x2e')][_0x5f72('0x2b')]({'where':{'type':_0x425020,'resourceId':_0x309811['id']}})[_0x5f72('0x2a')](function(){return _0x3b8cf7;});})[_0x5f72('0x2a')](function(){_0x103199[_0x5f72('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f56f7,_0xd8c1eb){return function(_0xb059b4){if(!_0xb059b4){_0x4f56f7[_0x5f72('0x1d')](0x194);}return _0xb059b4;};}function handleError(_0x25ca3c,_0xfa5140){_0xfa5140=_0xfa5140||0x1f4;return function(_0x52d4ca){logger['error'](_0x52d4ca[_0x5f72('0x2f')]);if(_0x52d4ca['name']){delete _0x52d4ca[_0x5f72('0x30')];}_0x25ca3c[_0x5f72('0x1e')](_0xfa5140)[_0x5f72('0x31')](_0x52d4ca);};}exports[_0x5f72('0x32')]=function(_0x597856,_0x33057d){var _0x4efb9e={},_0x517420={},_0x1f707e={'count':0x0,'rows':[]};var _0x298aad=_[_0x5f72('0x33')](db[_0x5f72('0x34')][_0x5f72('0x35')],function(_0x2f2495){return{'name':_0x2f2495[_0x5f72('0x36')],'type':_0x2f2495[_0x5f72('0x37')]['key']};});_0x517420[_0x5f72('0x38')]=_[_0x5f72('0x33')](_0x298aad,_0x5f72('0x30'));_0x517420['query']=_[_0x5f72('0x39')](_0x597856['query']);_0x517420[_0x5f72('0x3a')]=_[_0x5f72('0x3b')](_0x517420[_0x5f72('0x38')],_0x517420['query']);_0x4efb9e[_0x5f72('0x3c')]=_['intersection'](_0x517420[_0x5f72('0x38')],qs[_0x5f72('0x3d')](_0x597856[_0x5f72('0x3e')]['fields']));_0x4efb9e[_0x5f72('0x3c')]=_0x4efb9e['attributes'][_0x5f72('0x3f')]?_0x4efb9e[_0x5f72('0x3c')]:_0x517420[_0x5f72('0x38')];if(!_0x597856[_0x5f72('0x3e')][_0x5f72('0x40')](_0x5f72('0x41'))){_0x4efb9e['limit']=qs[_0x5f72('0x23')](_0x597856[_0x5f72('0x3e')][_0x5f72('0x23')]);_0x4efb9e[_0x5f72('0x22')]=qs[_0x5f72('0x22')](_0x597856[_0x5f72('0x3e')][_0x5f72('0x22')]);}_0x4efb9e[_0x5f72('0x42')]=qs['sort'](_0x597856[_0x5f72('0x3e')][_0x5f72('0x43')]);_0x4efb9e['where']=qs[_0x5f72('0x3a')](_[_0x5f72('0x44')](_0x597856[_0x5f72('0x3e')],_0x517420[_0x5f72('0x3a')]),_0x298aad);if(_0x597856[_0x5f72('0x3e')][_0x5f72('0x45')]){_0x4efb9e[_0x5f72('0x46')]=_[_0x5f72('0x47')](_0x4efb9e[_0x5f72('0x46')],{'$or':_[_0x5f72('0x33')](_0x298aad,function(_0x8fbb91){if(_0x8fbb91['type']!==_0x5f72('0x48')){var _0x49e29d={};_0x49e29d[_0x8fbb91[_0x5f72('0x30')]]={'$like':'%'+_0x597856[_0x5f72('0x3e')]['filter']+'%'};return _0x49e29d;}})});}_0x4efb9e=_['merge']({},_0x4efb9e,_0x597856[_0x5f72('0x49')]);var _0x5948e0={'where':_0x4efb9e[_0x5f72('0x46')]};return db[_0x5f72('0x34')]['count'](_0x5948e0)[_0x5f72('0x2a')](function(_0x5a0ab0){_0x1f707e['count']=_0x5a0ab0;if(_0x597856[_0x5f72('0x3e')][_0x5f72('0x4a')]){_0x4efb9e[_0x5f72('0x4b')]=[{'all':!![]}];}return db[_0x5f72('0x34')]['findAll'](_0x4efb9e);})['then'](function(_0x1f2594){_0x1f707e[_0x5f72('0x4c')]=_0x1f2594;return _0x1f707e;})[_0x5f72('0x2a')](respondWithFilteredResult(_0x33057d,_0x4efb9e))[_0x5f72('0x4d')](handleError(_0x33057d,null));};exports[_0x5f72('0x4e')]=function(_0x2c0f13,_0x1db5df){var _0x3f13bd={'raw':![],'where':{'id':_0x2c0f13[_0x5f72('0x4f')]['id']}},_0x5822e7={};_0x5822e7['model']=_['keys'](db[_0x5f72('0x34')][_0x5f72('0x35')]);_0x5822e7['query']=_[_0x5f72('0x39')](_0x2c0f13[_0x5f72('0x3e')]);_0x5822e7[_0x5f72('0x3a')]=_[_0x5f72('0x3b')](_0x5822e7[_0x5f72('0x38')],_0x5822e7[_0x5f72('0x3e')]);_0x3f13bd['attributes']=_[_0x5f72('0x3b')](_0x5822e7[_0x5f72('0x38')],qs[_0x5f72('0x3d')](_0x2c0f13[_0x5f72('0x3e')]['fields']));_0x3f13bd[_0x5f72('0x3c')]=_0x3f13bd[_0x5f72('0x3c')][_0x5f72('0x3f')]?_0x3f13bd[_0x5f72('0x3c')]:_0x5822e7[_0x5f72('0x38')];if(_0x2c0f13[_0x5f72('0x3e')][_0x5f72('0x4a')]){_0x3f13bd['include']=[{'all':!![]}];}_0x3f13bd=_[_0x5f72('0x47')]({},_0x3f13bd,_0x2c0f13['options']);return db[_0x5f72('0x34')][_0x5f72('0x50')](_0x3f13bd)[_0x5f72('0x2a')](handleEntityNotFound(_0x1db5df,null))[_0x5f72('0x2a')](respondWithResult(_0x1db5df,null))[_0x5f72('0x4d')](handleError(_0x1db5df,null));};exports[_0x5f72('0x51')]=function(_0x582da3,_0x49cd3a){return db[_0x5f72('0x34')]['create'](_0x582da3['body'],{})[_0x5f72('0x2a')](function(_0x3e94a6){var _0x2fbc27=_0x582da3[_0x5f72('0x52')][_0x5f72('0x2c')]({'plain':!![]});if(!_0x2fbc27)throw new Error(_0x5f72('0x53'));if(_0x2fbc27['role']===_0x5f72('0x52')){var _0x41326c=_0x3e94a6['get']({'plain':!![]});var _0x3da520=_0x5f72('0x2d');return db[_0x5f72('0x54')]['find']({'where':{'name':_0x3da520,'userProfileId':_0x2fbc27[_0x5f72('0x55')]},'raw':!![]})[_0x5f72('0x2a')](function(_0x4258f3){if(_0x4258f3&&_0x4258f3[_0x5f72('0x56')]===0x0){return db[_0x5f72('0x2e')][_0x5f72('0x51')]({'name':_0x41326c[_0x5f72('0x30')],'resourceId':_0x41326c['id'],'type':_0x4258f3[_0x5f72('0x30')],'sectionId':_0x4258f3['id']},{})[_0x5f72('0x2a')](function(){return _0x3e94a6;});}else{return _0x3e94a6;}})[_0x5f72('0x4d')](function(_0x5266d9){logger['error'](_0x5f72('0x57'),_0x5266d9);throw _0x5266d9;});}return _0x3e94a6;})[_0x5f72('0x2a')](respondWithResult(_0x49cd3a,0xc9))[_0x5f72('0x4d')](handleError(_0x49cd3a,null));};exports['update']=function(_0x4c6fad,_0x4042f1){if(_0x4c6fad[_0x5f72('0x58')]['id']){delete _0x4c6fad[_0x5f72('0x58')]['id'];}return db[_0x5f72('0x34')][_0x5f72('0x50')]({'where':{'id':_0x4c6fad['params']['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x4042f1,null))['then'](saveUpdates(_0x4c6fad[_0x5f72('0x58')],null))[_0x5f72('0x2a')](respondWithResult(_0x4042f1,null))[_0x5f72('0x4d')](handleError(_0x4042f1,null));};exports[_0x5f72('0x2b')]=function(_0x509eba,_0x4f20c3){return db['SquareProject']['find']({'where':{'id':_0x509eba[_0x5f72('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4f20c3,null))['then'](removeEntity(_0x4f20c3,null))[_0x5f72('0x4d')](handleError(_0x4f20c3,null));};exports['addUsers']=function(_0x16c978,_0x1f75ff,_0x4cdcbf){return db[_0x5f72('0x34')][_0x5f72('0x50')]({'where':{'id':_0x16c978[_0x5f72('0x4f')]['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x1f75ff,null))[_0x5f72('0x2a')](function(_0x358dc){if(_0x358dc){return _0x358dc[_0x5f72('0x59')](_0x16c978[_0x5f72('0x58')][_0x5f72('0x5a')],_['omit'](_0x16c978[_0x5f72('0x58')],[_0x5f72('0x5a'),'id'])||{});}})[_0x5f72('0x2a')](respondWithResult(_0x1f75ff,null))[_0x5f72('0x4d')](handleError(_0x1f75ff,null));};exports[_0x5f72('0x5b')]=function(_0xbcc9b1,_0x8ca16d,_0x122f71){return db[_0x5f72('0x34')][_0x5f72('0x50')]({'where':{'id':_0xbcc9b1['params']['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x8ca16d,null))[_0x5f72('0x2a')](function(_0x39888){if(_0x39888){return _0x39888[_0x5f72('0x5b')](_0xbcc9b1[_0x5f72('0x3e')][_0x5f72('0x5a')])[_0x5f72('0x2a')](function(){if(_[_0x5f72('0x5c')](_0xbcc9b1[_0x5f72('0x3e')]['ids'])){for(var _0x2d4491=0x0;_0x2d4491<_0xbcc9b1[_0x5f72('0x3e')][_0x5f72('0x5a')][_0x5f72('0x3f')];_0x2d4491+=0x1){socket[_0x5f72('0x5d')]('userSquareProject:remove',{'UserId':Number(_0xbcc9b1['query'][_0x5f72('0x5a')][_0x2d4491]),'SquareProjectId':Number(_0xbcc9b1[_0x5f72('0x4f')]['id'])});}}else{socket[_0x5f72('0x5d')](_0x5f72('0x5e'),{'UserId':Number(_0xbcc9b1['query']['ids']),'SquareProjectId':Number(_0xbcc9b1['params']['id'])});}});}})[_0x5f72('0x2a')](respondWithStatusCode(_0x8ca16d,null))[_0x5f72('0x4d')](handleError(_0x8ca16d,null));};exports[_0x5f72('0x5f')]=function(_0x2377fa,_0x407801,_0x33ad55){var _0x1b070b={};var _0x56d5a2={};var _0x35e15a;var _0x1ca6b9;return db['SquareProject'][_0x5f72('0x60')]({'where':{'id':_0x2377fa[_0x5f72('0x4f')]['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x407801,null))[_0x5f72('0x2a')](function(_0xeb8960){if(_0xeb8960){_0x35e15a=_0xeb8960;_0x56d5a2['model']=_[_0x5f72('0x39')](db[_0x5f72('0x61')][_0x5f72('0x35')]);_0x56d5a2['query']=_[_0x5f72('0x39')](_0x2377fa['query']);_0x56d5a2['filters']=_[_0x5f72('0x3b')](_0x56d5a2['model'],_0x56d5a2['query']);_0x1b070b[_0x5f72('0x3c')]=_['intersection'](_0x56d5a2[_0x5f72('0x38')],qs[_0x5f72('0x3d')](_0x2377fa[_0x5f72('0x3e')][_0x5f72('0x3d')]));_0x1b070b[_0x5f72('0x3c')]=_0x1b070b[_0x5f72('0x3c')]['length']?_0x1b070b[_0x5f72('0x3c')]:_0x56d5a2[_0x5f72('0x38')];_0x1b070b[_0x5f72('0x42')]=qs['sort'](_0x2377fa[_0x5f72('0x3e')][_0x5f72('0x43')]);_0x1b070b[_0x5f72('0x46')]=qs[_0x5f72('0x3a')](_[_0x5f72('0x44')](_0x2377fa['query'],_0x56d5a2['filters']));if(_0x2377fa[_0x5f72('0x3e')]['filter']){_0x1b070b[_0x5f72('0x46')]=_[_0x5f72('0x47')](_0x1b070b[_0x5f72('0x46')],{'$or':_['map'](_0x1b070b[_0x5f72('0x3c')],function(_0x5d074e){var _0x551b7f={};_0x551b7f[_0x5d074e]={'$like':'%'+_0x2377fa['query'][_0x5f72('0x45')]+'%'};return _0x551b7f;})});}_0x1b070b=_[_0x5f72('0x47')]({},_0x1b070b,_0x2377fa[_0x5f72('0x49')]);return _0x35e15a[_0x5f72('0x5f')](_0x1b070b);}})[_0x5f72('0x2a')](function(_0x2c5d9d){if(_0x2c5d9d){_0x1ca6b9=_0x2c5d9d[_0x5f72('0x3f')];if(!_0x2377fa[_0x5f72('0x3e')][_0x5f72('0x40')](_0x5f72('0x41'))){_0x1b070b[_0x5f72('0x23')]=qs['limit'](_0x2377fa['query'][_0x5f72('0x23')]);_0x1b070b[_0x5f72('0x22')]=qs[_0x5f72('0x22')](_0x2377fa['query'][_0x5f72('0x22')]);}return _0x35e15a['getUsers'](_0x1b070b);}})[_0x5f72('0x2a')](function(_0x24b04f){if(_0x24b04f){return _0x24b04f?{'count':_0x1ca6b9,'rows':_0x24b04f}:null;}})[_0x5f72('0x2a')](respondWithResult(_0x407801,null))[_0x5f72('0x4d')](handleError(_0x407801,null));}; \ No newline at end of file +var _0x021f=['params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','html-pdf','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','end','status','count','offset','set','Content-Range','json','reject','save','then','destroy','get','SquareProjects','sendStatus','error','stack','name','send','map','SquareProject','rawAttributes','type','key','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x379fd1,_0x582698){var _0x4ec618=function(_0xfb3f06){while(--_0xfb3f06){_0x379fd1['push'](_0x379fd1['shift']());}};_0x4ec618(++_0x582698);}(_0x021f,0xd8));var _0xf021=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x021f[_0x1da527];return _0x40fc7c;};'use strict';var pdf=require(_0xf021('0x0'));var emlformat=require(_0xf021('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf021('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf021('0x3'));var Mustache=require(_0xf021('0x4'));var util=require(_0xf021('0x5'));var path=require(_0xf021('0x6'));var sox=require(_0xf021('0x7'));var csv=require(_0xf021('0x8'));var ejs=require(_0xf021('0x9'));var fs=require('fs');var _=require(_0xf021('0xa'));var squel=require('squel');var crypto=require(_0xf021('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf021('0xc'));var toCsv=require(_0xf021('0x8'));var querystring=require(_0xf021('0xd'));var Papa=require(_0xf021('0xe'));var Redis=require('ioredis');var authService=require(_0xf021('0xf'));var qs=require(_0xf021('0x10'));var as=require(_0xf021('0x11'));var hardwareService=require(_0xf021('0x12'));var logger=require(_0xf021('0x13'))('api');var utils=require(_0xf021('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf021('0x15'));var db=require(_0xf021('0x16'))['db'];config[_0xf021('0x17')]=_['defaults'](config['redis'],{'host':_0xf021('0x18'),'port':0x18eb});var socket=require(_0xf021('0x19'))(new Redis(config[_0xf021('0x17')]));require(_0xf021('0x1a'))[_0xf021('0x1b')](socket);function respondWithStatusCode(_0x1e829a,_0x33b9da){_0x33b9da=_0x33b9da||0xcc;return function(_0xa3b7d3){if(_0xa3b7d3){return _0x1e829a['sendStatus'](_0x33b9da);}return _0x1e829a['status'](_0x33b9da)[_0xf021('0x1c')]();};}function respondWithResult(_0x1986e1,_0x46c74b){_0x46c74b=_0x46c74b||0xc8;return function(_0x428c3f){if(_0x428c3f){return _0x1986e1[_0xf021('0x1d')](_0x46c74b)['json'](_0x428c3f);}};}function respondWithFilteredResult(_0x2f4794,_0x45309c){return function(_0x2ba74e){if(_0x2ba74e){var _0x2ac8cc=_0x2ba74e[_0xf021('0x1e')],_0x5f1b14=_0x45309c['offset'],_0x2df650=_0x45309c[_0xf021('0x1f')]+_0x45309c['limit'],_0x1e4339;if(_0x2df650>=_0x2ac8cc){_0x2df650=_0x2ac8cc;_0x1e4339=0xc8;}else{_0x1e4339=0xce;}_0x2f4794['status'](_0x1e4339);return _0x2f4794[_0xf021('0x20')](_0xf021('0x21'),_0x5f1b14+'-'+_0x2df650+'/'+_0x2ac8cc)[_0xf021('0x22')](_0x2ba74e);}return null;};}function patchUpdates(_0x3d0406){return function(_0x5030ca){try{jsonpatch['apply'](_0x5030ca,_0x3d0406,!![]);}catch(_0x572d16){return BPromise[_0xf021('0x23')](_0x572d16);}return _0x5030ca[_0xf021('0x24')]();};}function saveUpdates(_0x49d904,_0x4111ca){return function(_0x54a0bd){if(_0x54a0bd){return _0x54a0bd['update'](_0x49d904)[_0xf021('0x25')](function(_0x3f24ef){return _0x3f24ef;});}return null;};}function removeEntity(_0x932098,_0x197d64){return function(_0x487c3c){if(_0x487c3c){return _0x487c3c[_0xf021('0x26')]()['then'](function(){var _0x3bbb21=_0x487c3c[_0xf021('0x27')]({'plain':!![]});var _0x334ad1=_0xf021('0x28');return db['UserProfileResource'][_0xf021('0x26')]({'where':{'type':_0x334ad1,'resourceId':_0x3bbb21['id']}})[_0xf021('0x25')](function(){return _0x487c3c;});})[_0xf021('0x25')](function(){_0x932098[_0xf021('0x1d')](0xcc)[_0xf021('0x1c')]();});}};}function handleEntityNotFound(_0x4a1993,_0x6d1c2b){return function(_0x3406b7){if(!_0x3406b7){_0x4a1993[_0xf021('0x29')](0x194);}return _0x3406b7;};}function handleError(_0x35c197,_0x2bcdaa){_0x2bcdaa=_0x2bcdaa||0x1f4;return function(_0x5a5539){logger[_0xf021('0x2a')](_0x5a5539[_0xf021('0x2b')]);if(_0x5a5539[_0xf021('0x2c')]){delete _0x5a5539[_0xf021('0x2c')];}_0x35c197['status'](_0x2bcdaa)[_0xf021('0x2d')](_0x5a5539);};}exports['index']=function(_0x23c909,_0x170675){var _0x325c23={},_0x5ad12c={},_0x121892={'count':0x0,'rows':[]};var _0x2c0597=_[_0xf021('0x2e')](db[_0xf021('0x2f')][_0xf021('0x30')],function(_0x5f0411){return{'name':_0x5f0411['fieldName'],'type':_0x5f0411[_0xf021('0x31')][_0xf021('0x32')]};});_0x5ad12c['model']=_[_0xf021('0x2e')](_0x2c0597,_0xf021('0x2c'));_0x5ad12c['query']=_[_0xf021('0x33')](_0x23c909['query']);_0x5ad12c[_0xf021('0x34')]=_['intersection'](_0x5ad12c[_0xf021('0x35')],_0x5ad12c[_0xf021('0x36')]);_0x325c23[_0xf021('0x37')]=_[_0xf021('0x38')](_0x5ad12c[_0xf021('0x35')],qs[_0xf021('0x39')](_0x23c909[_0xf021('0x36')][_0xf021('0x39')]));_0x325c23[_0xf021('0x37')]=_0x325c23[_0xf021('0x37')][_0xf021('0x3a')]?_0x325c23[_0xf021('0x37')]:_0x5ad12c['model'];if(!_0x23c909[_0xf021('0x36')][_0xf021('0x3b')](_0xf021('0x3c'))){_0x325c23[_0xf021('0x3d')]=qs['limit'](_0x23c909[_0xf021('0x36')]['limit']);_0x325c23[_0xf021('0x1f')]=qs[_0xf021('0x1f')](_0x23c909[_0xf021('0x36')][_0xf021('0x1f')]);}_0x325c23[_0xf021('0x3e')]=qs[_0xf021('0x3f')](_0x23c909['query'][_0xf021('0x3f')]);_0x325c23[_0xf021('0x40')]=qs[_0xf021('0x34')](_[_0xf021('0x41')](_0x23c909[_0xf021('0x36')],_0x5ad12c[_0xf021('0x34')]),_0x2c0597);if(_0x23c909[_0xf021('0x36')][_0xf021('0x42')]){_0x325c23[_0xf021('0x40')]=_[_0xf021('0x43')](_0x325c23['where'],{'$or':_[_0xf021('0x2e')](_0x2c0597,function(_0x4b9887){if(_0x4b9887[_0xf021('0x31')]!==_0xf021('0x44')){var _0x30ef2b={};_0x30ef2b[_0x4b9887[_0xf021('0x2c')]]={'$like':'%'+_0x23c909[_0xf021('0x36')][_0xf021('0x42')]+'%'};return _0x30ef2b;}})});}_0x325c23=_[_0xf021('0x43')]({},_0x325c23,_0x23c909[_0xf021('0x45')]);var _0xc7ea36={'where':_0x325c23[_0xf021('0x40')]};return db[_0xf021('0x2f')][_0xf021('0x1e')](_0xc7ea36)['then'](function(_0x1cbfd9){_0x121892['count']=_0x1cbfd9;if(_0x23c909[_0xf021('0x36')][_0xf021('0x46')]){_0x325c23['include']=[{'all':!![]}];}return db[_0xf021('0x2f')][_0xf021('0x47')](_0x325c23);})[_0xf021('0x25')](function(_0x51bfe2){_0x121892[_0xf021('0x48')]=_0x51bfe2;return _0x121892;})[_0xf021('0x25')](respondWithFilteredResult(_0x170675,_0x325c23))[_0xf021('0x49')](handleError(_0x170675,null));};exports[_0xf021('0x4a')]=function(_0x3bdef4,_0x5c797c){var _0x3e1510={'raw':![],'where':{'id':_0x3bdef4[_0xf021('0x4b')]['id']}},_0x4cc2e0={};_0x4cc2e0[_0xf021('0x35')]=_['keys'](db[_0xf021('0x2f')][_0xf021('0x30')]);_0x4cc2e0[_0xf021('0x36')]=_[_0xf021('0x33')](_0x3bdef4[_0xf021('0x36')]);_0x4cc2e0['filters']=_[_0xf021('0x38')](_0x4cc2e0[_0xf021('0x35')],_0x4cc2e0[_0xf021('0x36')]);_0x3e1510[_0xf021('0x37')]=_[_0xf021('0x38')](_0x4cc2e0[_0xf021('0x35')],qs[_0xf021('0x39')](_0x3bdef4[_0xf021('0x36')]['fields']));_0x3e1510['attributes']=_0x3e1510[_0xf021('0x37')]['length']?_0x3e1510[_0xf021('0x37')]:_0x4cc2e0['model'];if(_0x3bdef4[_0xf021('0x36')][_0xf021('0x46')]){_0x3e1510[_0xf021('0x4c')]=[{'all':!![]}];}_0x3e1510=_[_0xf021('0x43')]({},_0x3e1510,_0x3bdef4[_0xf021('0x45')]);return db[_0xf021('0x2f')]['find'](_0x3e1510)[_0xf021('0x25')](handleEntityNotFound(_0x5c797c,null))[_0xf021('0x25')](respondWithResult(_0x5c797c,null))[_0xf021('0x49')](handleError(_0x5c797c,null));};exports[_0xf021('0x4d')]=function(_0x475974,_0x9bb83e){return db[_0xf021('0x2f')][_0xf021('0x4d')](_0x475974[_0xf021('0x4e')],{})[_0xf021('0x25')](function(_0x1561d8){var _0x43e1be=_0x475974[_0xf021('0x4f')][_0xf021('0x27')]({'plain':!![]});if(!_0x43e1be)throw new Error(_0xf021('0x50'));if(_0x43e1be[_0xf021('0x51')]===_0xf021('0x4f')){var _0x28e55a=_0x1561d8[_0xf021('0x27')]({'plain':!![]});var _0x170b51=_0xf021('0x28');return db[_0xf021('0x52')][_0xf021('0x53')]({'where':{'name':_0x170b51,'userProfileId':_0x43e1be[_0xf021('0x54')]},'raw':!![]})['then'](function(_0x328c59){if(_0x328c59&&_0x328c59[_0xf021('0x55')]===0x0){return db['UserProfileResource'][_0xf021('0x4d')]({'name':_0x28e55a[_0xf021('0x2c')],'resourceId':_0x28e55a['id'],'type':_0x328c59[_0xf021('0x2c')],'sectionId':_0x328c59['id']},{})[_0xf021('0x25')](function(){return _0x1561d8;});}else{return _0x1561d8;}})['catch'](function(_0x377d24){logger[_0xf021('0x2a')](_0xf021('0x56'),_0x377d24);throw _0x377d24;});}return _0x1561d8;})['then'](respondWithResult(_0x9bb83e,0xc9))['catch'](handleError(_0x9bb83e,null));};exports[_0xf021('0x57')]=function(_0x4517bd,_0x24fc70){if(_0x4517bd[_0xf021('0x4e')]['id']){delete _0x4517bd[_0xf021('0x4e')]['id'];}return db[_0xf021('0x2f')][_0xf021('0x53')]({'where':{'id':_0x4517bd[_0xf021('0x4b')]['id']}})['then'](handleEntityNotFound(_0x24fc70,null))[_0xf021('0x25')](saveUpdates(_0x4517bd[_0xf021('0x4e')],null))['then'](respondWithResult(_0x24fc70,null))[_0xf021('0x49')](handleError(_0x24fc70,null));};exports[_0xf021('0x26')]=function(_0x5d5d01,_0x4ff85c){return db[_0xf021('0x2f')][_0xf021('0x53')]({'where':{'id':_0x5d5d01['params']['id']}})['then'](handleEntityNotFound(_0x4ff85c,null))[_0xf021('0x25')](removeEntity(_0x4ff85c,null))[_0xf021('0x49')](handleError(_0x4ff85c,null));};exports[_0xf021('0x58')]=function(_0x2a6aef,_0x35c30f,_0x2a2fd0){return db[_0xf021('0x2f')][_0xf021('0x53')]({'where':{'id':_0x2a6aef[_0xf021('0x4b')]['id']}})[_0xf021('0x25')](handleEntityNotFound(_0x35c30f,null))[_0xf021('0x25')](function(_0x353dc7){if(_0x353dc7){return _0x353dc7['addUsers'](_0x2a6aef[_0xf021('0x4e')][_0xf021('0x59')],_['omit'](_0x2a6aef[_0xf021('0x4e')],[_0xf021('0x59'),'id'])||{});}})[_0xf021('0x25')](respondWithResult(_0x35c30f,null))[_0xf021('0x49')](handleError(_0x35c30f,null));};exports[_0xf021('0x5a')]=function(_0x300386,_0x354c68,_0x433721){return db[_0xf021('0x2f')][_0xf021('0x53')]({'where':{'id':_0x300386['params']['id']}})[_0xf021('0x25')](handleEntityNotFound(_0x354c68,null))[_0xf021('0x25')](function(_0x116b82){if(_0x116b82){return _0x116b82[_0xf021('0x5a')](_0x300386['query'][_0xf021('0x59')])['then'](function(){if(_[_0xf021('0x5b')](_0x300386[_0xf021('0x36')][_0xf021('0x59')])){for(var _0x94fd9=0x0;_0x94fd9<_0x300386[_0xf021('0x36')]['ids'][_0xf021('0x3a')];_0x94fd9+=0x1){socket[_0xf021('0x5c')]('userSquareProject:remove',{'UserId':Number(_0x300386[_0xf021('0x36')][_0xf021('0x59')][_0x94fd9]),'SquareProjectId':Number(_0x300386[_0xf021('0x4b')]['id'])});}}else{socket[_0xf021('0x5c')](_0xf021('0x5d'),{'UserId':Number(_0x300386[_0xf021('0x36')][_0xf021('0x59')]),'SquareProjectId':Number(_0x300386[_0xf021('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x354c68,null))[_0xf021('0x49')](handleError(_0x354c68,null));};exports[_0xf021('0x5e')]=function(_0x2da1b3,_0x5788cb,_0x11b69b){var _0x52d027={};var _0x22641f={};var _0x2f610b;var _0x52ff9d;return db['SquareProject'][_0xf021('0x5f')]({'where':{'id':_0x2da1b3[_0xf021('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5788cb,null))['then'](function(_0x48554d){if(_0x48554d){_0x2f610b=_0x48554d;_0x22641f[_0xf021('0x35')]=_[_0xf021('0x33')](db[_0xf021('0x60')][_0xf021('0x30')]);_0x22641f['query']=_[_0xf021('0x33')](_0x2da1b3[_0xf021('0x36')]);_0x22641f[_0xf021('0x34')]=_[_0xf021('0x38')](_0x22641f[_0xf021('0x35')],_0x22641f[_0xf021('0x36')]);_0x52d027['attributes']=_[_0xf021('0x38')](_0x22641f[_0xf021('0x35')],qs[_0xf021('0x39')](_0x2da1b3[_0xf021('0x36')][_0xf021('0x39')]));_0x52d027[_0xf021('0x37')]=_0x52d027['attributes'][_0xf021('0x3a')]?_0x52d027['attributes']:_0x22641f['model'];_0x52d027[_0xf021('0x3e')]=qs[_0xf021('0x3f')](_0x2da1b3[_0xf021('0x36')]['sort']);_0x52d027['where']=qs[_0xf021('0x34')](_[_0xf021('0x41')](_0x2da1b3[_0xf021('0x36')],_0x22641f[_0xf021('0x34')]));if(_0x2da1b3['query'][_0xf021('0x42')]){_0x52d027[_0xf021('0x40')]=_[_0xf021('0x43')](_0x52d027[_0xf021('0x40')],{'$or':_[_0xf021('0x2e')](_0x52d027[_0xf021('0x37')],function(_0x2fc783){var _0x85d6a2={};_0x85d6a2[_0x2fc783]={'$like':'%'+_0x2da1b3['query']['filter']+'%'};return _0x85d6a2;})});}_0x52d027=_[_0xf021('0x43')]({},_0x52d027,_0x2da1b3[_0xf021('0x45')]);return _0x2f610b[_0xf021('0x5e')](_0x52d027);}})['then'](function(_0x3e2d3b){if(_0x3e2d3b){_0x52ff9d=_0x3e2d3b[_0xf021('0x3a')];if(!_0x2da1b3[_0xf021('0x36')][_0xf021('0x3b')](_0xf021('0x3c'))){_0x52d027['limit']=qs[_0xf021('0x3d')](_0x2da1b3[_0xf021('0x36')]['limit']);_0x52d027[_0xf021('0x1f')]=qs[_0xf021('0x1f')](_0x2da1b3['query']['offset']);}return _0x2f610b[_0xf021('0x5e')](_0x52d027);}})[_0xf021('0x25')](function(_0x2d9d35){if(_0x2d9d35){return _0x2d9d35?{'count':_0x52ff9d,'rows':_0x2d9d35}:null;}})['then'](respondWithResult(_0x5788cb,null))['catch'](handleError(_0x5788cb,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 9a48ff0..25260c6 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 _0xadd2=['remove','emit','exports','SquareProject','save','update'];(function(_0xaf3140,_0xa4ca3d){var _0x5701e3=function(_0x4d4d43){while(--_0x4d4d43){_0xaf3140['push'](_0xaf3140['shift']());}};_0x5701e3(++_0xa4ca3d);}(_0xadd2,0xa5));var _0x2add=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xadd2[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x2add('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2add('0x1'),'afterUpdate':_0x2add('0x2'),'afterDestroy':_0x2add('0x3')};function emitEvent(_0x270575){return function(_0x1ecb83,_0x217444,_0x328cc0){SquareProjectEvents[_0x2add('0x4')](_0x270575+':'+_0x1ecb83['id'],_0x1ecb83);SquareProjectEvents[_0x2add('0x4')](_0x270575,_0x1ecb83);_0x328cc0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x2add('0x5')]=SquareProjectEvents; \ No newline at end of file +var _0x0412=['hook','exports','events','../../mysqldb','SquareProject','save','remove','emit','hasOwnProperty'];(function(_0x51ceec,_0x1dacd9){var _0x4411f4=function(_0x1be4f0){while(--_0x1be4f0){_0x51ceec['push'](_0x51ceec['shift']());}};_0x4411f4(++_0x1dacd9);}(_0x0412,0xad));var _0x2041=function(_0x43f7f5,_0x3fa4){_0x43f7f5=_0x43f7f5-0x0;var _0x1a171f=_0x0412[_0x43f7f5];return _0x1a171f;};'use strict';var EventEmitter=require(_0x2041('0x0'));var SquareProject=require(_0x2041('0x1'))['db'][_0x2041('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2041('0x3'),'afterUpdate':'update','afterDestroy':_0x2041('0x4')};function emitEvent(_0x27fe2a){return function(_0x115e0f,_0x59ca75,_0x35076f){SquareProjectEvents[_0x2041('0x5')](_0x27fe2a+':'+_0x115e0f['id'],_0x115e0f);SquareProjectEvents[_0x2041('0x5')](_0x27fe2a,_0x115e0f);_0x35076f(null);};}for(var e in events){if(events[_0x2041('0x6')](e)){var event=events[e];SquareProject[_0x2041('0x7')](e,emitEvent(event));}}module[_0x2041('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 7a95cf0..b019fee 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 _0xfcbd=['exports','define','SquareProject','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes'];(function(_0x2847ec,_0x40ce19){var _0x507988=function(_0x3545a1){while(--_0x3545a1){_0x2847ec['push'](_0x2847ec['shift']());}};_0x507988(++_0x40ce19);}(_0xfcbd,0x160));var _0xdfcb=function(_0x1fd563,_0x196466){_0x1fd563=_0x1fd563-0x0;var _0x4673f3=_0xfcbd[_0x1fd563];return _0x4673f3;};'use strict';var _=require(_0xdfcb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdfcb('0x1'));var moment=require(_0xdfcb('0x2'));var BPromise=require(_0xdfcb('0x3'));var rp=require(_0xdfcb('0x4'));var fs=require('fs');var path=require(_0xdfcb('0x5'));var rimraf=require(_0xdfcb('0x6'));var config=require(_0xdfcb('0x7'));var attributes=require(_0xdfcb('0x8'));module[_0xdfcb('0x9')]=function(_0x4bdf76,_0x5615a6){return _0x4bdf76[_0xdfcb('0xa')](_0xdfcb('0xb'),attributes,{'tableName':_0xdfcb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c5431,_0xbe50d6,_0x13fb1c){if(_0x3c5431[_0xdfcb('0xd')]('preproduction')){_0x3c5431[_0xdfcb('0xe')]=moment()[_0xdfcb('0xf')](_0xdfcb('0x10'));}if(_0x3c5431[_0xdfcb('0xd')](_0xdfcb('0x11'))){_0x3c5431[_0xdfcb('0x12')]=moment()[_0xdfcb('0xf')](_0xdfcb('0x10'));}_0x13fb1c(null,_0x3c5431);}}});}; \ No newline at end of file +var _0x758e=['bluebird','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','format','YYYY-MM-DD\x20HH:mm:ss','changed','publishedAt','lodash','api','moment'];(function(_0x542b35,_0x3252ce){var _0x204bd1=function(_0x49d60e){while(--_0x49d60e){_0x542b35['push'](_0x542b35['shift']());}};_0x204bd1(++_0x3252ce);}(_0x758e,0x1af));var _0xe758=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x758e[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xe758('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe758('0x1'));var moment=require(_0xe758('0x2'));var BPromise=require(_0xe758('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe758('0x4'));var config=require(_0xe758('0x5'));var attributes=require(_0xe758('0x6'));module[_0xe758('0x7')]=function(_0x5a2226,_0x2cdf89){return _0x5a2226[_0xe758('0x8')](_0xe758('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c03ba,_0x454ee0,_0x55601a){if(_0x4c03ba['changed']('preproduction')){_0x4c03ba['savedAt']=moment()[_0xe758('0xa')](_0xe758('0xb'));}if(_0x4c03ba[_0xe758('0xc')]('production')){_0x4c03ba[_0xe758('0xd')]=moment()['format'](_0xe758('0xb'));}_0x55601a(null,_0x4c03ba);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 2d44747..3c1b163 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 _0xa04d=['request\x20sent','result','catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xf3ac0b,_0x45a93a){var _0x45ad94=function(_0x325984){while(--_0x325984){_0xf3ac0b['push'](_0xf3ac0b['shift']());}};_0x45ad94(++_0x45a93a);}(_0xa04d,0x17f));var _0xda04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa04d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xda04('0x0'));var util=require(_0xda04('0x1'));var moment=require('moment');var BPromise=require(_0xda04('0x2'));var rs=require(_0xda04('0x3'));var fs=require('fs');var Redis=require(_0xda04('0x4'));var db=require(_0xda04('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda04('0x6'))(_0xda04('0x7'));var config=require('../../config/environment');var jayson=require(_0xda04('0x8'));var client=jayson[_0xda04('0x9')][_0xda04('0xa')]({'port':0x232a});config[_0xda04('0xb')]=_[_0xda04('0xc')](config[_0xda04('0xb')],{'host':_0xda04('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda04('0xb')]));require('./squareProject.socket')[_0xda04('0xe')](socket);function respondWithRpcPromise(_0x32e877,_0x19ee37,_0x2bdb89){return new BPromise(function(_0xdbe31e,_0x48d7fc){return client[_0xda04('0xf')](_0x32e877,_0x2bdb89)[_0xda04('0x10')](function(_0x28eeff){logger[_0xda04('0x11')](_0xda04('0x12'),_0x19ee37,'request\x20sent');logger[_0xda04('0x13')](_0xda04('0x14'),_0x19ee37,'request\x20sent',JSON['stringify'](_0x28eeff));if(_0x28eeff['error']){if(_0x28eeff[_0xda04('0x15')][_0xda04('0x16')]===0x1f4){logger[_0xda04('0x15')](_0xda04('0x12'),_0x19ee37,_0x28eeff['error'][_0xda04('0x17')]);return _0x48d7fc(_0x28eeff[_0xda04('0x15')][_0xda04('0x17')]);}logger[_0xda04('0x15')](_0xda04('0x12'),_0x19ee37,_0x28eeff[_0xda04('0x15')][_0xda04('0x17')]);return _0xdbe31e(_0x28eeff[_0xda04('0x15')][_0xda04('0x17')]);}else{logger['info'](_0xda04('0x12'),_0x19ee37,_0xda04('0x18'));_0xdbe31e(_0x28eeff[_0xda04('0x19')]['message']);}})[_0xda04('0x1a')](function(_0xe22b09){logger[_0xda04('0x15')](_0xda04('0x12'),_0x19ee37,_0xe22b09);_0x48d7fc(_0xe22b09);});});}exports[_0xda04('0x1b')]=function(_0x29743d){var _0x253fea=this;return new Promise(function(_0x4326cd,_0x19cd20){return db['SquareProject'][_0xda04('0x1c')]({'raw':_0x29743d[_0xda04('0x1d')]?_0x29743d[_0xda04('0x1d')][_0xda04('0x1e')]===undefined?!![]:![]:!![],'where':_0x29743d['options']?_0x29743d[_0xda04('0x1d')][_0xda04('0x1f')]||null:null,'attributes':_0x29743d['options']?_0x29743d[_0xda04('0x1d')][_0xda04('0x20')]||null:null,'include':_0x29743d['options']?_0x29743d['options'][_0xda04('0x21')]?_[_0xda04('0x22')](_0x29743d[_0xda04('0x1d')][_0xda04('0x21')],function(_0x27d332){return{'model':db[_0x27d332[_0xda04('0x23')]],'as':_0x27d332['as'],'attributes':_0x27d332[_0xda04('0x20')],'include':_0x27d332[_0xda04('0x21')]?_['map'](_0x27d332['include'],function(_0x2929fd){return{'model':db[_0x2929fd['model']],'as':_0x2929fd['as'],'attributes':_0x2929fd[_0xda04('0x20')],'include':_0x2929fd[_0xda04('0x21')]?_['map'](_0x2929fd[_0xda04('0x21')],function(_0x5cc0db){return{'model':db[_0x5cc0db[_0xda04('0x23')]],'as':_0x5cc0db['as'],'attributes':_0x5cc0db[_0xda04('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b444a){logger[_0xda04('0x11')](_0xda04('0x1b'),_0x29743d);logger[_0xda04('0x13')](_0xda04('0x1b'),_0x29743d,JSON[_0xda04('0x24')](_0x2b444a));_0x4326cd(_0x2b444a);})[_0xda04('0x1a')](function(_0x4dec49){logger[_0xda04('0x15')](_0xda04('0x1b'),_0x4dec49[_0xda04('0x17')],_0x29743d);_0x19cd20(_0x253fea['error'](0x1f4,_0x4dec49[_0xda04('0x17')]));});});}; \ No newline at end of file +var _0x39a5=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSquareProject','SquareProject','find','options','raw','attributes','map','include','stringify'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x39a5,0xb4));var _0x539a=function(_0x1b9b36,_0x511539){_0x1b9b36=_0x1b9b36-0x0;var _0x17401f=_0x39a5[_0x1b9b36];return _0x17401f;};'use strict';var _=require(_0x539a('0x0'));var util=require('util');var moment=require(_0x539a('0x1'));var BPromise=require('bluebird');var rs=require(_0x539a('0x2'));var fs=require('fs');var Redis=require(_0x539a('0x3'));var db=require(_0x539a('0x4'))['db'];var utils=require(_0x539a('0x5'));var logger=require(_0x539a('0x6'))('rpc');var config=require(_0x539a('0x7'));var jayson=require(_0x539a('0x8'));var client=jayson[_0x539a('0x9')][_0x539a('0xa')]({'port':0x232a});config[_0x539a('0xb')]=_[_0x539a('0xc')](config[_0x539a('0xb')],{'host':_0x539a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x539a('0xb')]));require(_0x539a('0xe'))[_0x539a('0xf')](socket);function respondWithRpcPromise(_0x3a0550,_0x5a2bfe,_0x3583bd){return new BPromise(function(_0x31bb19,_0x3d884a){return client[_0x539a('0x10')](_0x3a0550,_0x3583bd)[_0x539a('0x11')](function(_0x1f384b){logger[_0x539a('0x12')](_0x539a('0x13'),_0x5a2bfe,_0x539a('0x14'));logger[_0x539a('0x15')](_0x539a('0x16'),_0x5a2bfe,_0x539a('0x14'),JSON['stringify'](_0x1f384b));if(_0x1f384b[_0x539a('0x17')]){if(_0x1f384b[_0x539a('0x17')][_0x539a('0x18')]===0x1f4){logger['error'](_0x539a('0x13'),_0x5a2bfe,_0x1f384b[_0x539a('0x17')][_0x539a('0x19')]);return _0x3d884a(_0x1f384b[_0x539a('0x17')]['message']);}logger[_0x539a('0x17')]('SquareProject,\x20%s,\x20%s',_0x5a2bfe,_0x1f384b[_0x539a('0x17')][_0x539a('0x19')]);return _0x31bb19(_0x1f384b[_0x539a('0x17')][_0x539a('0x19')]);}else{logger[_0x539a('0x12')](_0x539a('0x13'),_0x5a2bfe,_0x539a('0x14'));_0x31bb19(_0x1f384b[_0x539a('0x1a')][_0x539a('0x19')]);}})['catch'](function(_0x11f432){logger[_0x539a('0x17')]('SquareProject,\x20%s,\x20%s',_0x5a2bfe,_0x11f432);_0x3d884a(_0x11f432);});});}exports[_0x539a('0x1b')]=function(_0x33596f){var _0x33f3e8=this;return new Promise(function(_0xa7f8bc,_0x216900){return db[_0x539a('0x1c')][_0x539a('0x1d')]({'raw':_0x33596f[_0x539a('0x1e')]?_0x33596f[_0x539a('0x1e')][_0x539a('0x1f')]===undefined?!![]:![]:!![],'where':_0x33596f['options']?_0x33596f[_0x539a('0x1e')]['where']||null:null,'attributes':_0x33596f[_0x539a('0x1e')]?_0x33596f['options'][_0x539a('0x20')]||null:null,'include':_0x33596f[_0x539a('0x1e')]?_0x33596f[_0x539a('0x1e')]['include']?_[_0x539a('0x21')](_0x33596f[_0x539a('0x1e')][_0x539a('0x22')],function(_0x51c440){return{'model':db[_0x51c440['model']],'as':_0x51c440['as'],'attributes':_0x51c440[_0x539a('0x20')],'include':_0x51c440[_0x539a('0x22')]?_['map'](_0x51c440[_0x539a('0x22')],function(_0x14bc12){return{'model':db[_0x14bc12['model']],'as':_0x14bc12['as'],'attributes':_0x14bc12[_0x539a('0x20')],'include':_0x14bc12[_0x539a('0x22')]?_[_0x539a('0x21')](_0x14bc12[_0x539a('0x22')],function(_0x147cb0){return{'model':db[_0x147cb0['model']],'as':_0x147cb0['as'],'attributes':_0x147cb0[_0x539a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x539a('0x11')](function(_0x19292b){logger[_0x539a('0x12')](_0x539a('0x1b'),_0x33596f);logger[_0x539a('0x15')](_0x539a('0x1b'),_0x33596f,JSON[_0x539a('0x23')](_0x19292b));_0xa7f8bc(_0x19292b);})['catch'](function(_0x3b08de){logger[_0x539a('0x17')](_0x539a('0x1b'),_0x3b08de[_0x539a('0x19')],_0x33596f);_0x216900(_0x33f3e8[_0x539a('0x17')](0x1f4,_0x3b08de[_0x539a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index a1dece9..044b670 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 _0x1623=['removeListener','length','squareProject:','./squareProject.events','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1623,0xab));var _0x3162=function(_0x23c4f2,_0x247712){_0x23c4f2=_0x23c4f2-0x0;var _0x3b9c56=_0x1623[_0x23c4f2];return _0x3b9c56;};'use strict';var SquareProjectEvents=require(_0x3162('0x0'));var events=['save','remove',_0x3162('0x1')];function createListener(_0x27ee21,_0x36ccc3){return function(_0x2cc4d7){_0x36ccc3[_0x3162('0x2')](_0x27ee21,_0x2cc4d7);};}function removeListener(_0x4ce2bd,_0x5d49d0){return function(){SquareProjectEvents[_0x3162('0x3')](_0x4ce2bd,_0x5d49d0);};}exports['register']=function(_0x1b55f2){for(var _0x428de6=0x0,_0x53260d=events[_0x3162('0x4')];_0x428de6<_0x53260d;_0x428de6++){var _0x2dc07e=events[_0x428de6];var _0x26ee32=createListener(_0x3162('0x5')+_0x2dc07e,_0x1b55f2);SquareProjectEvents['on'](_0x2dc07e,_0x26ee32);}}; \ No newline at end of file +var _0xe2fe=['update','emit','register','length','./squareProject.events'];(function(_0x228f05,_0x4092fd){var _0x58bec6=function(_0x2bb41f){while(--_0x2bb41f){_0x228f05['push'](_0x228f05['shift']());}};_0x58bec6(++_0x4092fd);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var SquareProjectEvents=require(_0xee2f('0x0'));var events=['save','remove',_0xee2f('0x1')];function createListener(_0x5e18ae,_0x169cf9){return function(_0x1b6f4c){_0x169cf9[_0xee2f('0x2')](_0x5e18ae,_0x1b6f4c);};}function removeListener(_0x2d2b03,_0xcb45e6){return function(){SquareProjectEvents['removeListener'](_0x2d2b03,_0xcb45e6);};}exports[_0xee2f('0x3')]=function(_0x2b7e7c){for(var _0x49926b=0x0,_0x1533a0=events[_0xee2f('0x4')];_0x49926b<_0x1533a0;_0x49926b++){var _0x5a7975=events[_0x49926b];var _0x3c4095=createListener('squareProject:'+_0x5a7975,_0x2b7e7c);SquareProjectEvents['on'](_0x5a7975,_0x3c4095);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 2ee8ebf..6379705 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 _0xa0af=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','isAuthenticated','show','/:id/download','download','create','put','/:id','delete'];(function(_0xdb5808,_0x58c067){var _0x111072=function(_0x3c3f27){while(--_0x3c3f27){_0xdb5808['push'](_0xdb5808['shift']());}};_0x111072(++_0x58c067);}(_0xa0af,0x18e));var _0xfa0a=function(_0x37fbeb,_0x54ea57){_0x37fbeb=_0x37fbeb-0x0;var _0xc3ccb9=_0xa0af[_0x37fbeb];return _0xc3ccb9;};'use strict';var multer=require(_0xfa0a('0x0'));var util=require(_0xfa0a('0x1'));var path=require(_0xfa0a('0x2'));var timeout=require(_0xfa0a('0x3'));var express=require(_0xfa0a('0x4'));var router=express[_0xfa0a('0x5')]();var auth=require(_0xfa0a('0x6'));var interaction=require(_0xfa0a('0x7'));var config=require(_0xfa0a('0x8'));var controller=require(_0xfa0a('0x9'));router[_0xfa0a('0xa')]('/',auth['isAuthenticated'](),controller[_0xfa0a('0xb')]);router[_0xfa0a('0xa')]('/:id',auth[_0xfa0a('0xc')](),controller[_0xfa0a('0xd')]);router['get'](_0xfa0a('0xe'),auth[_0xfa0a('0xc')](),controller[_0xfa0a('0xf')]);router['post']('/',auth[_0xfa0a('0xc')](),controller[_0xfa0a('0x10')]);router[_0xfa0a('0x11')](_0xfa0a('0x12'),auth[_0xfa0a('0xc')](),controller['update']);router[_0xfa0a('0x13')]('/:id/delete',auth[_0xfa0a('0xc')](),controller[_0xfa0a('0x14')]);module[_0xfa0a('0x15')]=router; \ No newline at end of file +var _0x7053=['create','put','/:id/delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0x7053,0x11c));var _0x3705=function(_0x30f030,_0xd03b7a){_0x30f030=_0x30f030-0x0;var _0xf7614f=_0x7053[_0x30f030];return _0xf7614f;};'use strict';var multer=require(_0x3705('0x0'));var util=require(_0x3705('0x1'));var path=require(_0x3705('0x2'));var timeout=require(_0x3705('0x3'));var express=require(_0x3705('0x4'));var router=express[_0x3705('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3705('0x6'));var config=require('../../config/environment');var controller=require(_0x3705('0x7'));router[_0x3705('0x8')]('/',auth[_0x3705('0x9')](),controller[_0x3705('0xa')]);router['get'](_0x3705('0xb'),auth[_0x3705('0x9')](),controller[_0x3705('0xc')]);router['get'](_0x3705('0xd'),auth[_0x3705('0x9')](),controller[_0x3705('0xe')]);router[_0x3705('0xf')]('/',auth[_0x3705('0x9')](),controller[_0x3705('0x10')]);router[_0x3705('0x11')](_0x3705('0xb'),auth[_0x3705('0x9')](),controller['update']);router['delete'](_0x3705('0x12'),auth[_0x3705('0x9')](),controller['destroy']);module[_0x3705('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 18eeb88..f5204ad 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 _0xc7bd=['VIRTUAL','getDataValue','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x59eeb6,_0x2e7b71){var _0xba965f=function(_0x28e7f3){while(--_0x28e7f3){_0x59eeb6['push'](_0x59eeb6['shift']());}};_0xba965f(++_0x2e7b71);}(_0xc7bd,0x170));var _0xdc7b=function(_0x22dbf6,_0xdad8e6){_0x22dbf6=_0x22dbf6-0x0;var _0x3d01fc=_0xc7bd[_0x22dbf6];return _0x3d01fc;};'use strict';var Sequelize=require(_0xdc7b('0x0'));module[_0xdc7b('0x1')]={'uniqueid':{'type':Sequelize[_0xdc7b('0x2')]},'callerid':{'type':Sequelize[_0xdc7b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xdc7b('0x2')]},'priority':{'type':Sequelize[_0xdc7b('0x2')]},'accountcode':{'type':Sequelize[_0xdc7b('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xdc7b('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xdc7b('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xdc7b('0x3')],'get':function(){var _0x6a2c2c='';var _0x5688dd=this[_0xdc7b('0x4')]('savePath');if(_0x5688dd){_0x6a2c2c=_0x5688dd[_0xdc7b('0x5')](_0x5688dd[_0xdc7b('0x6')]('.'));}return _0x6a2c2c;}}}; \ No newline at end of file +var _0x20d6=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize','exports'];(function(_0x2c32bb,_0x56b676){var _0x1909ab=function(_0xc7fdcc){while(--_0xc7fdcc){_0x2c32bb['push'](_0x2c32bb['shift']());}};_0x1909ab(++_0x56b676);}(_0x20d6,0x140));var _0x620d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x20d6[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x620d('0x0'));module[_0x620d('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x620d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x620d('0x2')]},'extension':{'type':Sequelize[_0x620d('0x2')]},'priority':{'type':Sequelize[_0x620d('0x2')]},'accountcode':{'type':Sequelize[_0x620d('0x2')]},'dnid':{'type':Sequelize[_0x620d('0x2')]},'projectName':{'type':Sequelize[_0x620d('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x620d('0x2')]},'savePath':{'type':Sequelize[_0x620d('0x2')]},'format':{'type':Sequelize[_0x620d('0x3')],'get':function(){var _0xf7ef0b='';var _0x1a74d7=this[_0x620d('0x4')](_0x620d('0x5'));if(_0x1a74d7){_0xf7ef0b=_0x1a74d7[_0x620d('0x6')](_0x1a74d7['lastIndexOf']('.'));}return _0xf7ef0b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index f184001..1d6e021 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 _0x355b=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','reject','save','then','destroy','error','name','send','map','SquareRecording','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','catch','show','params','length','includeAll','create','body','download','../../components/encryptor','uniqueid','savePath','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','find','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x428029,_0x1a5eb3){var _0x52033a=function(_0x5d73a8){while(--_0x5d73a8){_0x428029['push'](_0x428029['shift']());}};_0x52033a(++_0x1a5eb3);}(_0x355b,0x115));var _0xb355=function(_0x3b68f8,_0x367db8){_0x3b68f8=_0x3b68f8-0x0;var _0x3a2040=_0x355b[_0x3b68f8];return _0x3a2040;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb355('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb355('0x1'));var rp=require(_0xb355('0x2'));var moment=require(_0xb355('0x3'));var BPromise=require(_0xb355('0x4'));var Mustache=require(_0xb355('0x5'));var util=require(_0xb355('0x6'));var path=require('path');var sox=require(_0xb355('0x7'));var csv=require(_0xb355('0x8'));var ejs=require(_0xb355('0x9'));var fs=require('fs');var _=require(_0xb355('0xa'));var squel=require('squel');var crypto=require(_0xb355('0xb'));var jsforce=require(_0xb355('0xc'));var deskjs=require(_0xb355('0xd'));var toCsv=require(_0xb355('0x8'));var querystring=require(_0xb355('0xe'));var Papa=require(_0xb355('0xf'));var Redis=require(_0xb355('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb355('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb355('0x12'));var logger=require(_0xb355('0x13'))(_0xb355('0x14'));var utils=require(_0xb355('0x15'));var config=require(_0xb355('0x16'));var licenseUtil=require(_0xb355('0x17'));var db=require(_0xb355('0x18'))['db'];function respondWithStatusCode(_0x37fd51,_0x447214){_0x447214=_0x447214||0xcc;return function(_0x3359be){if(_0x3359be){return _0x37fd51[_0xb355('0x19')](_0x447214);}return _0x37fd51['status'](_0x447214)[_0xb355('0x1a')]();};}function respondWithResult(_0x353253,_0x128da8){_0x128da8=_0x128da8||0xc8;return function(_0x3163be){if(_0x3163be){return _0x353253[_0xb355('0x1b')](_0x128da8)[_0xb355('0x1c')](_0x3163be);}};}function respondWithFilteredResult(_0x5425fd,_0x389d48){return function(_0x48dda9){if(_0x48dda9){var _0x3b2dd9=_0x48dda9['count'],_0x5a7044=_0x389d48[_0xb355('0x1d')],_0x31b1e9=_0x389d48['offset']+_0x389d48[_0xb355('0x1e')],_0x5672ff;if(_0x31b1e9>=_0x3b2dd9){_0x31b1e9=_0x3b2dd9;_0x5672ff=0xc8;}else{_0x5672ff=0xce;}_0x5425fd[_0xb355('0x1b')](_0x5672ff);return _0x5425fd['set'](_0xb355('0x1f'),_0x5a7044+'-'+_0x31b1e9+'/'+_0x3b2dd9)['json'](_0x48dda9);}return null;};}function patchUpdates(_0x293894){return function(_0x1f9028){try{jsonpatch['apply'](_0x1f9028,_0x293894,!![]);}catch(_0x6a54b8){return BPromise[_0xb355('0x20')](_0x6a54b8);}return _0x1f9028[_0xb355('0x21')]();};}function saveUpdates(_0x5225e0,_0x313d2d){return function(_0xf5dca7){if(_0xf5dca7){return _0xf5dca7['update'](_0x5225e0)[_0xb355('0x22')](function(_0x307b9a){return _0x307b9a;});}return null;};}function removeEntity(_0xb3404a,_0x3ac4b0){return function(_0x56a4fd){if(_0x56a4fd){return _0x56a4fd[_0xb355('0x23')]()[_0xb355('0x22')](function(){_0xb3404a[_0xb355('0x1b')](0xcc)[_0xb355('0x1a')]();});}};}function handleEntityNotFound(_0x5ec812,_0x451c5b){return function(_0x33a187){if(!_0x33a187){_0x5ec812['sendStatus'](0x194);}return _0x33a187;};}function handleError(_0x546380,_0x4b6c8d){_0x4b6c8d=_0x4b6c8d||0x1f4;return function(_0x1043cc){logger[_0xb355('0x24')](_0x1043cc['stack']);if(_0x1043cc[_0xb355('0x25')]){delete _0x1043cc[_0xb355('0x25')];}_0x546380[_0xb355('0x1b')](_0x4b6c8d)[_0xb355('0x26')](_0x1043cc);};}exports['index']=function(_0x285235,_0x23bee2){var _0x19ad55={},_0x1201a0={},_0x280e47={'count':0x0,'rows':[]};var _0x1c8256=_[_0xb355('0x27')](db[_0xb355('0x28')][_0xb355('0x29')],function(_0x295f1b){return{'name':_0x295f1b[_0xb355('0x2a')],'type':_0x295f1b['type'][_0xb355('0x2b')]};});_0x1201a0[_0xb355('0x2c')]=_['map'](_0x1c8256,'name');_0x1201a0[_0xb355('0x2d')]=_[_0xb355('0x2e')](_0x285235['query']);_0x1201a0[_0xb355('0x2f')]=_[_0xb355('0x30')](_0x1201a0[_0xb355('0x2c')],_0x1201a0[_0xb355('0x2d')]);_0x19ad55[_0xb355('0x31')]=_[_0xb355('0x30')](_0x1201a0[_0xb355('0x2c')],qs[_0xb355('0x32')](_0x285235['query'][_0xb355('0x32')]));_0x19ad55[_0xb355('0x31')]=_0x19ad55[_0xb355('0x31')]['length']?_0x19ad55['attributes']:_0x1201a0[_0xb355('0x2c')];if(!_0x285235[_0xb355('0x2d')][_0xb355('0x33')](_0xb355('0x34'))){_0x19ad55[_0xb355('0x1e')]=qs[_0xb355('0x1e')](_0x285235[_0xb355('0x2d')][_0xb355('0x1e')]);_0x19ad55[_0xb355('0x1d')]=qs[_0xb355('0x1d')](_0x285235[_0xb355('0x2d')][_0xb355('0x1d')]);}_0x19ad55[_0xb355('0x35')]=qs[_0xb355('0x36')](_0x285235['query'][_0xb355('0x36')]);_0x19ad55[_0xb355('0x37')]=qs[_0xb355('0x2f')](_[_0xb355('0x38')](_0x285235[_0xb355('0x2d')],_0x1201a0[_0xb355('0x2f')]),_0x1c8256);if(_0x285235[_0xb355('0x2d')][_0xb355('0x39')]){_0x19ad55[_0xb355('0x37')]=_[_0xb355('0x3a')](_0x19ad55[_0xb355('0x37')],{'$or':_[_0xb355('0x27')](_0x1c8256,function(_0x3cfce2){if(_0x3cfce2[_0xb355('0x3b')]!==_0xb355('0x3c')){var _0x2ba0f8={};_0x2ba0f8[_0x3cfce2[_0xb355('0x25')]]={'$like':'%'+_0x285235[_0xb355('0x2d')][_0xb355('0x39')]+'%'};return _0x2ba0f8;}})});}_0x19ad55=_[_0xb355('0x3a')]({},_0x19ad55,_0x285235[_0xb355('0x3d')]);var _0x1ac6c7={'where':_0x19ad55[_0xb355('0x37')]};return db[_0xb355('0x28')]['count'](_0x1ac6c7)[_0xb355('0x22')](function(_0x2b3460){_0x280e47[_0xb355('0x3e')]=_0x2b3460;if(_0x285235[_0xb355('0x2d')]['includeAll']){_0x19ad55[_0xb355('0x3f')]=[{'all':!![]}];}return db[_0xb355('0x28')][_0xb355('0x40')](_0x19ad55);})[_0xb355('0x22')](function(_0x85b9df){_0x280e47[_0xb355('0x41')]=_0x85b9df;return _0x280e47;})[_0xb355('0x22')](respondWithFilteredResult(_0x23bee2,_0x19ad55))[_0xb355('0x42')](handleError(_0x23bee2,null));};exports[_0xb355('0x43')]=function(_0x3fd509,_0x4a7165){var _0x47a556={'raw':!![],'where':{'id':_0x3fd509[_0xb355('0x44')]['id']}},_0x1e8364={};_0x1e8364['model']=_[_0xb355('0x2e')](db['SquareRecording'][_0xb355('0x29')]);_0x1e8364['query']=_['keys'](_0x3fd509['query']);_0x1e8364['filters']=_[_0xb355('0x30')](_0x1e8364[_0xb355('0x2c')],_0x1e8364['query']);_0x47a556[_0xb355('0x31')]=_[_0xb355('0x30')](_0x1e8364[_0xb355('0x2c')],qs['fields'](_0x3fd509[_0xb355('0x2d')][_0xb355('0x32')]));_0x47a556['attributes']=_0x47a556[_0xb355('0x31')][_0xb355('0x45')]?_0x47a556[_0xb355('0x31')]:_0x1e8364['model'];if(_0x3fd509[_0xb355('0x2d')][_0xb355('0x46')]){_0x47a556[_0xb355('0x3f')]=[{'all':!![]}];}_0x47a556=_[_0xb355('0x3a')]({},_0x47a556,_0x3fd509['options']);return db[_0xb355('0x28')]['find'](_0x47a556)['then'](handleEntityNotFound(_0x4a7165,null))[_0xb355('0x22')](respondWithResult(_0x4a7165,null))[_0xb355('0x42')](handleError(_0x4a7165,null));};exports[_0xb355('0x47')]=function(_0x4407e9,_0x48abfd){return db[_0xb355('0x28')][_0xb355('0x47')](_0x4407e9['body'],{})[_0xb355('0x22')](respondWithResult(_0x48abfd,0xc9))[_0xb355('0x42')](handleError(_0x48abfd,null));};exports['update']=function(_0x51b63d,_0x5ae3be){if(_0x51b63d[_0xb355('0x48')]['id']){delete _0x51b63d['body']['id'];}return db[_0xb355('0x28')]['find']({'where':{'id':_0x51b63d['params']['id']}})[_0xb355('0x22')](handleEntityNotFound(_0x5ae3be,null))[_0xb355('0x22')](saveUpdates(_0x51b63d[_0xb355('0x48')],null))[_0xb355('0x22')](respondWithResult(_0x5ae3be,null))['catch'](handleError(_0x5ae3be,null));};exports[_0xb355('0x49')]=function(_0x427f67,_0x2fa166,_0x3a36be){var _0x1a0088=require(_0xb355('0x4a'));var _0x3aa794=![];var _0x25947f={};if(_0x427f67['query'][_0xb355('0x3b')]&&_0x427f67[_0xb355('0x2d')][_0xb355('0x3b')]===_0xb355('0x4b')){_0x25947f[_0xb355('0x4b')]=_0x427f67[_0xb355('0x44')]['id'];}else{_0x25947f['id']=_0x427f67[_0xb355('0x44')]['id'];}return db[_0xb355('0x28')]['find']({'where':_0x25947f,'attributes':['id',_0xb355('0x4c'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x2fa166,null))[_0xb355('0x22')](function(_0x5a5456){if(_0x5a5456){var _0x4ae4d0=_0x5a5456['savePath'];var _0x2206d4=util['format']('%s.cypher',_0x4ae4d0);if(fs[_0xb355('0x4d')](_0x2206d4)){_0x3aa794=!![];return _0x1a0088[_0xb355('0x4e')](_0x2206d4,_0x4ae4d0,config[_0xb355('0x4f')]['recording'])[_0xb355('0x22')](function(){return _0x5a5456;});}return _0x5a5456;}})[_0xb355('0x22')](function(_0x9ac046){if(_0x9ac046){var _0x286cc0=_0x9ac046[_0xb355('0x4c')];if(!fs['existsSync'](_0x286cc0)){throw new db[(_0xb355('0x50'))][(_0xb355('0x51'))](_0xb355('0x52'));}if(_0x9ac046[_0xb355('0x53')]){return _0x2fa166['download'](_0x286cc0,_0x9ac046[_0xb355('0x53')]+path[_0xb355('0x54')](_0x286cc0),function(){if(_0x3aa794){fs[_0xb355('0x55')](_0x286cc0);}});}else{return _0x2fa166[_0xb355('0x49')](_0x286cc0,function(_0x5c66ee){if(_0x3aa794){fs[_0xb355('0x55')](_0x286cc0);}});}}})[_0xb355('0x42')](function(_0xc263a1){if(_0xc263a1[_0xb355('0x56')]==='SquareRecording\x20not\x20found'){_0x2fa166['status'](0x194)[_0xb355('0x26')](_0xb355('0x57'));}else{return handleError(_0x2fa166,null);}});};exports['destroy']=function(_0x512de0,_0xb919a2){return db['SquareRecording'][_0xb355('0x58')]({'where':{'id':_0x512de0[_0xb355('0x44')]['id']}})[_0xb355('0x22')](function(_0x4fda46){if(!_0x4fda46)throw new ReferenceError(_0xb355('0x59'));return _0x4fda46;})[_0xb355('0x22')](function(_0x256db8){var _0x2ff9f4=_0x256db8[_0xb355('0x4c')];logger[_0xb355('0x5a')](_0xb355('0x5b'),_0x2ff9f4);if(!_[_0xb355('0x5c')](_0x256db8[_0xb355('0x4c')])&&fs[_0xb355('0x4d')](_0x2ff9f4)){logger[_0xb355('0x5a')](_0xb355('0x5d')+_0x2ff9f4+_0xb355('0x5e'));fs['unlinkSync'](_0x2ff9f4);}_0x2ff9f4=_0x2ff9f4+_0xb355('0x5f');if(!_[_0xb355('0x5c')](_0x256db8[_0xb355('0x4c')])&&fs[_0xb355('0x4d')](_0x2ff9f4)){logger[_0xb355('0x5a')]('File:\x20\x22'+_0x2ff9f4+_0xb355('0x5e'));fs[_0xb355('0x60')](_0x2ff9f4);}return _0x256db8;})[_0xb355('0x22')](function(_0x1667fd){if(!_0x1667fd)throw new InternalError();return _0x1667fd[_0xb355('0x23')]();})[_0xb355('0x22')](function(){_0xb919a2['status'](0xcc)[_0xb355('0x1a')]();})[_0xb355('0x42')](handleError(_0xb919a2,null));}; \ No newline at end of file +var _0xf29d=['options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','download','../../components/encryptor','filename','savePath','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','end','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0xf29d,0x1a7));var _0xdf29=function(_0x2bbcde,_0x21f1fd){_0x2bbcde=_0x2bbcde-0x0;var _0x20b5d9=_0xf29d[_0x2bbcde];return _0x20b5d9;};'use strict';var pdf=require(_0xdf29('0x0'));var emlformat=require(_0xdf29('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdf29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf29('0x3'));var moment=require(_0xdf29('0x4'));var BPromise=require(_0xdf29('0x5'));var Mustache=require(_0xdf29('0x6'));var util=require('util');var path=require(_0xdf29('0x7'));var sox=require(_0xdf29('0x8'));var csv=require(_0xdf29('0x9'));var ejs=require(_0xdf29('0xa'));var fs=require('fs');var _=require(_0xdf29('0xb'));var squel=require(_0xdf29('0xc'));var crypto=require(_0xdf29('0xd'));var jsforce=require(_0xdf29('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdf29('0x9'));var querystring=require(_0xdf29('0xf'));var Papa=require(_0xdf29('0x10'));var Redis=require(_0xdf29('0x11'));var authService=require(_0xdf29('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdf29('0x13'));var hardwareService=require(_0xdf29('0x14'));var logger=require('../../config/logger')(_0xdf29('0x15'));var utils=require(_0xdf29('0x16'));var config=require(_0xdf29('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fe714,_0x5d5757){_0x5d5757=_0x5d5757||0xcc;return function(_0x2d4cd8){if(_0x2d4cd8){return _0x2fe714[_0xdf29('0x18')](_0x5d5757);}return _0x2fe714[_0xdf29('0x19')](_0x5d5757)['end']();};}function respondWithResult(_0x240c28,_0x834594){_0x834594=_0x834594||0xc8;return function(_0x366590){if(_0x366590){return _0x240c28[_0xdf29('0x19')](_0x834594)[_0xdf29('0x1a')](_0x366590);}};}function respondWithFilteredResult(_0x1b2000,_0x8492e2){return function(_0x27d2d5){if(_0x27d2d5){var _0xf63936=_0x27d2d5[_0xdf29('0x1b')],_0x308d9d=_0x8492e2[_0xdf29('0x1c')],_0x4485c0=_0x8492e2['offset']+_0x8492e2[_0xdf29('0x1d')],_0x288953;if(_0x4485c0>=_0xf63936){_0x4485c0=_0xf63936;_0x288953=0xc8;}else{_0x288953=0xce;}_0x1b2000[_0xdf29('0x19')](_0x288953);return _0x1b2000[_0xdf29('0x1e')](_0xdf29('0x1f'),_0x308d9d+'-'+_0x4485c0+'/'+_0xf63936)['json'](_0x27d2d5);}return null;};}function patchUpdates(_0x4141d5){return function(_0x53b307){try{jsonpatch[_0xdf29('0x20')](_0x53b307,_0x4141d5,!![]);}catch(_0x164479){return BPromise['reject'](_0x164479);}return _0x53b307[_0xdf29('0x21')]();};}function saveUpdates(_0x3dd1d4,_0xdf48cf){return function(_0x206651){if(_0x206651){return _0x206651[_0xdf29('0x22')](_0x3dd1d4)[_0xdf29('0x23')](function(_0x3710e4){return _0x3710e4;});}return null;};}function removeEntity(_0xe1ebfe,_0x2bc4c7){return function(_0x3a0abd){if(_0x3a0abd){return _0x3a0abd[_0xdf29('0x24')]()[_0xdf29('0x23')](function(){_0xe1ebfe[_0xdf29('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ab7e3,_0x2d3596){return function(_0x3485ab){if(!_0x3485ab){_0x5ab7e3[_0xdf29('0x18')](0x194);}return _0x3485ab;};}function handleError(_0x585c5f,_0x44a728){_0x44a728=_0x44a728||0x1f4;return function(_0x30a28d){logger[_0xdf29('0x25')](_0x30a28d[_0xdf29('0x26')]);if(_0x30a28d[_0xdf29('0x27')]){delete _0x30a28d['name'];}_0x585c5f[_0xdf29('0x19')](_0x44a728)[_0xdf29('0x28')](_0x30a28d);};}exports[_0xdf29('0x29')]=function(_0x381f3d,_0x1e662f){var _0x1b3ed4={},_0x2aa952={},_0x60cc84={'count':0x0,'rows':[]};var _0x54f136=_[_0xdf29('0x2a')](db[_0xdf29('0x2b')][_0xdf29('0x2c')],function(_0xaaa5db){return{'name':_0xaaa5db['fieldName'],'type':_0xaaa5db[_0xdf29('0x2d')][_0xdf29('0x2e')]};});_0x2aa952[_0xdf29('0x2f')]=_['map'](_0x54f136,'name');_0x2aa952[_0xdf29('0x30')]=_['keys'](_0x381f3d['query']);_0x2aa952['filters']=_['intersection'](_0x2aa952[_0xdf29('0x2f')],_0x2aa952['query']);_0x1b3ed4['attributes']=_[_0xdf29('0x31')](_0x2aa952[_0xdf29('0x2f')],qs[_0xdf29('0x32')](_0x381f3d[_0xdf29('0x30')][_0xdf29('0x32')]));_0x1b3ed4['attributes']=_0x1b3ed4[_0xdf29('0x33')][_0xdf29('0x34')]?_0x1b3ed4[_0xdf29('0x33')]:_0x2aa952[_0xdf29('0x2f')];if(!_0x381f3d[_0xdf29('0x30')][_0xdf29('0x35')]('nolimit')){_0x1b3ed4['limit']=qs[_0xdf29('0x1d')](_0x381f3d['query'][_0xdf29('0x1d')]);_0x1b3ed4['offset']=qs['offset'](_0x381f3d[_0xdf29('0x30')]['offset']);}_0x1b3ed4[_0xdf29('0x36')]=qs[_0xdf29('0x37')](_0x381f3d['query']['sort']);_0x1b3ed4[_0xdf29('0x38')]=qs[_0xdf29('0x39')](_[_0xdf29('0x3a')](_0x381f3d[_0xdf29('0x30')],_0x2aa952['filters']),_0x54f136);if(_0x381f3d[_0xdf29('0x30')][_0xdf29('0x3b')]){_0x1b3ed4['where']=_[_0xdf29('0x3c')](_0x1b3ed4[_0xdf29('0x38')],{'$or':_['map'](_0x54f136,function(_0x4ff8ee){if(_0x4ff8ee['type']!==_0xdf29('0x3d')){var _0x317bca={};_0x317bca[_0x4ff8ee[_0xdf29('0x27')]]={'$like':'%'+_0x381f3d['query'][_0xdf29('0x3b')]+'%'};return _0x317bca;}})});}_0x1b3ed4=_[_0xdf29('0x3c')]({},_0x1b3ed4,_0x381f3d[_0xdf29('0x3e')]);var _0x277025={'where':_0x1b3ed4[_0xdf29('0x38')]};return db[_0xdf29('0x2b')][_0xdf29('0x1b')](_0x277025)[_0xdf29('0x23')](function(_0x5726b8){_0x60cc84[_0xdf29('0x1b')]=_0x5726b8;if(_0x381f3d[_0xdf29('0x30')][_0xdf29('0x3f')]){_0x1b3ed4[_0xdf29('0x40')]=[{'all':!![]}];}return db[_0xdf29('0x2b')][_0xdf29('0x41')](_0x1b3ed4);})[_0xdf29('0x23')](function(_0x4d0751){_0x60cc84[_0xdf29('0x42')]=_0x4d0751;return _0x60cc84;})[_0xdf29('0x23')](respondWithFilteredResult(_0x1e662f,_0x1b3ed4))['catch'](handleError(_0x1e662f,null));};exports[_0xdf29('0x43')]=function(_0x4b5b2c,_0x3e61cc){var _0x1e24b6={'raw':!![],'where':{'id':_0x4b5b2c[_0xdf29('0x44')]['id']}},_0x47f0db={};_0x47f0db[_0xdf29('0x2f')]=_['keys'](db['SquareRecording'][_0xdf29('0x2c')]);_0x47f0db[_0xdf29('0x30')]=_[_0xdf29('0x45')](_0x4b5b2c[_0xdf29('0x30')]);_0x47f0db[_0xdf29('0x39')]=_['intersection'](_0x47f0db[_0xdf29('0x2f')],_0x47f0db['query']);_0x1e24b6[_0xdf29('0x33')]=_[_0xdf29('0x31')](_0x47f0db[_0xdf29('0x2f')],qs['fields'](_0x4b5b2c[_0xdf29('0x30')][_0xdf29('0x32')]));_0x1e24b6[_0xdf29('0x33')]=_0x1e24b6['attributes'][_0xdf29('0x34')]?_0x1e24b6[_0xdf29('0x33')]:_0x47f0db[_0xdf29('0x2f')];if(_0x4b5b2c[_0xdf29('0x30')]['includeAll']){_0x1e24b6[_0xdf29('0x40')]=[{'all':!![]}];}_0x1e24b6=_[_0xdf29('0x3c')]({},_0x1e24b6,_0x4b5b2c[_0xdf29('0x3e')]);return db[_0xdf29('0x2b')]['find'](_0x1e24b6)[_0xdf29('0x23')](handleEntityNotFound(_0x3e61cc,null))[_0xdf29('0x23')](respondWithResult(_0x3e61cc,null))[_0xdf29('0x46')](handleError(_0x3e61cc,null));};exports[_0xdf29('0x47')]=function(_0x24f629,_0x56e6f4){return db[_0xdf29('0x2b')][_0xdf29('0x47')](_0x24f629[_0xdf29('0x48')],{})[_0xdf29('0x23')](respondWithResult(_0x56e6f4,0xc9))[_0xdf29('0x46')](handleError(_0x56e6f4,null));};exports[_0xdf29('0x22')]=function(_0x189af3,_0x5b3875){if(_0x189af3['body']['id']){delete _0x189af3[_0xdf29('0x48')]['id'];}return db['SquareRecording'][_0xdf29('0x49')]({'where':{'id':_0x189af3['params']['id']}})['then'](handleEntityNotFound(_0x5b3875,null))[_0xdf29('0x23')](saveUpdates(_0x189af3[_0xdf29('0x48')],null))[_0xdf29('0x23')](respondWithResult(_0x5b3875,null))[_0xdf29('0x46')](handleError(_0x5b3875,null));};exports[_0xdf29('0x4a')]=function(_0x5e6a9b,_0x28eb97,_0x5846e6){var _0x5100dd=require(_0xdf29('0x4b'));var _0xaf25a4=![];var _0x549bae={};if(_0x5e6a9b[_0xdf29('0x30')][_0xdf29('0x2d')]&&_0x5e6a9b[_0xdf29('0x30')]['type']==='uniqueid'){_0x549bae['uniqueid']=_0x5e6a9b['params']['id'];}else{_0x549bae['id']=_0x5e6a9b['params']['id'];}return db[_0xdf29('0x2b')][_0xdf29('0x49')]({'where':_0x549bae,'attributes':['id','savePath',_0xdf29('0x4c')],'raw':!![]})[_0xdf29('0x23')](handleEntityNotFound(_0x28eb97,null))['then'](function(_0x37ff00){if(_0x37ff00){var _0x41a6e3=_0x37ff00[_0xdf29('0x4d')];var _0xb725d3=util['format'](_0xdf29('0x4e'),_0x41a6e3);if(fs[_0xdf29('0x4f')](_0xb725d3)){_0xaf25a4=!![];return _0x5100dd[_0xdf29('0x50')](_0xb725d3,_0x41a6e3,config[_0xdf29('0x51')][_0xdf29('0x52')])[_0xdf29('0x23')](function(){return _0x37ff00;});}return _0x37ff00;}})[_0xdf29('0x23')](function(_0x5ef4f1){if(_0x5ef4f1){var _0xa92706=_0x5ef4f1[_0xdf29('0x4d')];if(!fs[_0xdf29('0x4f')](_0xa92706)){throw new db[(_0xdf29('0x53'))][(_0xdf29('0x54'))](_0xdf29('0x55'));}if(_0x5ef4f1[_0xdf29('0x4c')]){return _0x28eb97[_0xdf29('0x4a')](_0xa92706,_0x5ef4f1[_0xdf29('0x4c')]+path[_0xdf29('0x56')](_0xa92706),function(){if(_0xaf25a4){fs[_0xdf29('0x57')](_0xa92706);}});}else{return _0x28eb97['download'](_0xa92706,function(_0x71653b){if(_0xaf25a4){fs[_0xdf29('0x57')](_0xa92706);}});}}})[_0xdf29('0x46')](function(_0x1f3d2c){if(_0x1f3d2c[_0xdf29('0x58')]===_0xdf29('0x55')){_0x28eb97[_0xdf29('0x19')](0x194)[_0xdf29('0x28')](_0xdf29('0x59'));}else{return handleError(_0x28eb97,null);}});};exports[_0xdf29('0x24')]=function(_0x2bd9e3,_0x433111){return db[_0xdf29('0x2b')][_0xdf29('0x49')]({'where':{'id':_0x2bd9e3[_0xdf29('0x44')]['id']}})[_0xdf29('0x23')](function(_0x110bdb){if(!_0x110bdb)throw new ReferenceError(_0xdf29('0x5a'));return _0x110bdb;})[_0xdf29('0x23')](function(_0x18d440){var _0x3e4455=_0x18d440[_0xdf29('0x4d')];logger[_0xdf29('0x5b')](_0xdf29('0x5c'),_0x3e4455);if(!_[_0xdf29('0x5d')](_0x18d440['savePath'])&&fs[_0xdf29('0x4f')](_0x3e4455)){logger[_0xdf29('0x5b')](_0xdf29('0x5e')+_0x3e4455+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xdf29('0x5f')](_0x3e4455);}_0x3e4455=_0x3e4455+'.cypher';if(!_[_0xdf29('0x5d')](_0x18d440[_0xdf29('0x4d')])&&fs[_0xdf29('0x4f')](_0x3e4455)){logger[_0xdf29('0x5b')](_0xdf29('0x5e')+_0x3e4455+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3e4455);}return _0x18d440;})[_0xdf29('0x23')](function(_0x39e6d3){if(!_0x39e6d3)throw new InternalError();return _0x39e6d3[_0xdf29('0x24')]();})['then'](function(){_0x433111[_0xdf29('0x19')](0xcc)[_0xdf29('0x60')]();})[_0xdf29('0x46')](handleError(_0x433111,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index f5ed460..75a36e4 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 _0xdaa8=['api','./squareRecording.attributes','exports','SquareRecording','lodash','util','../../config/logger'];(function(_0xe3b7bb,_0x263836){var _0x2df486=function(_0x527828){while(--_0x527828){_0xe3b7bb['push'](_0xe3b7bb['shift']());}};_0x2df486(++_0x263836);}(_0xdaa8,0xe4));var _0x8daa=function(_0x4fdeec,_0x1c444c){_0x4fdeec=_0x4fdeec-0x0;var _0x3df500=_0xdaa8[_0x4fdeec];return _0x3df500;};'use strict';var _=require(_0x8daa('0x0'));var util=require(_0x8daa('0x1'));var logger=require(_0x8daa('0x2'))(_0x8daa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8daa('0x4'));module[_0x8daa('0x5')]=function(_0x46f753,_0x4d2392){return _0x46f753['define'](_0x8daa('0x6'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x117c=['../../config/environment','./squareRecording.attributes','exports','define','square_recordings','api','request-promise','path','rimraf'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x117c,0x71));var _0xc117=function(_0x18a01c,_0xd1a13a){_0x18a01c=_0x18a01c-0x0;var _0x2b0cd6=_0x117c[_0x18a01c];return _0x2b0cd6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc117('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc117('0x1'));var fs=require('fs');var path=require(_0xc117('0x2'));var rimraf=require(_0xc117('0x3'));var config=require(_0xc117('0x4'));var attributes=require(_0xc117('0x5'));module[_0xc117('0x6')]=function(_0x52d09e,_0x3bb859){return _0x52d09e[_0xc117('0x7')]('SquareRecording',attributes,{'tableName':_0xc117('0x8'),'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 09854c3..0a7a686 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 _0xf7c6=['request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateSquareRecording','create','body','options','raw','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x36b435,_0x1287e){var _0x28a608=function(_0x1b1220){while(--_0x1b1220){_0x36b435['push'](_0x36b435['shift']());}};_0x28a608(++_0x1287e);}(_0xf7c6,0x1b6));var _0x6f7c=function(_0x1ad992,_0x5ddc63){_0x1ad992=_0x1ad992-0x0;var _0x535234=_0xf7c6[_0x1ad992];return _0x535234;};'use strict';var _=require(_0x6f7c('0x0'));var util=require(_0x6f7c('0x1'));var moment=require(_0x6f7c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f7c('0x3'));var fs=require('fs');var Redis=require(_0x6f7c('0x4'));var db=require(_0x6f7c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f7c('0x6'))(_0x6f7c('0x7'));var config=require('../../config/environment');var jayson=require(_0x6f7c('0x8'));var client=jayson[_0x6f7c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x518487,_0x1892b2,_0x797619){return new BPromise(function(_0x50b436,_0x16915e){return client[_0x6f7c('0xa')](_0x518487,_0x797619)[_0x6f7c('0xb')](function(_0x4fd8c2){logger[_0x6f7c('0xc')](_0x6f7c('0xd'),_0x1892b2,_0x6f7c('0xe'));logger[_0x6f7c('0xf')](_0x6f7c('0x10'),_0x1892b2,_0x6f7c('0xe'),JSON[_0x6f7c('0x11')](_0x4fd8c2));if(_0x4fd8c2['error']){if(_0x4fd8c2['error'][_0x6f7c('0x12')]===0x1f4){logger[_0x6f7c('0x13')](_0x6f7c('0xd'),_0x1892b2,_0x4fd8c2[_0x6f7c('0x13')][_0x6f7c('0x14')]);return _0x16915e(_0x4fd8c2[_0x6f7c('0x13')][_0x6f7c('0x14')]);}logger[_0x6f7c('0x13')](_0x6f7c('0xd'),_0x1892b2,_0x4fd8c2[_0x6f7c('0x13')][_0x6f7c('0x14')]);return _0x50b436(_0x4fd8c2[_0x6f7c('0x13')][_0x6f7c('0x14')]);}else{logger[_0x6f7c('0xc')](_0x6f7c('0xd'),_0x1892b2,_0x6f7c('0xe'));_0x50b436(_0x4fd8c2[_0x6f7c('0x15')][_0x6f7c('0x14')]);}})['catch'](function(_0x2815ad){logger[_0x6f7c('0x13')](_0x6f7c('0xd'),_0x1892b2,_0x2815ad);_0x16915e(_0x2815ad);});});}exports[_0x6f7c('0x16')]=function(_0xb377c1){var _0x5b477f=this;return new Promise(function(_0x5bac32,_0xea8b04){return db['SquareRecording'][_0x6f7c('0x17')](_0xb377c1[_0x6f7c('0x18')],{'raw':_0xb377c1[_0x6f7c('0x19')]?_0xb377c1['options'][_0x6f7c('0x1a')]===undefined?!![]:![]:!![]})[_0x6f7c('0xb')](function(_0x12f601){logger[_0x6f7c('0xc')](_0x6f7c('0x16'),_0xb377c1);logger[_0x6f7c('0xf')](_0x6f7c('0x16'),_0xb377c1,JSON[_0x6f7c('0x11')](_0x12f601));_0x5bac32(_0x12f601);})[_0x6f7c('0x1b')](function(_0x2137e7){logger['error'](_0x6f7c('0x16'),_0x2137e7[_0x6f7c('0x14')],_0xb377c1);_0xea8b04(_0x5b477f[_0x6f7c('0x13')](0x1f4,_0x2137e7['message']));});});}; \ No newline at end of file +var _0xea55=['message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xf1b29b,_0xc7f459){var _0x2de436=function(_0x43da76){while(--_0x43da76){_0xf1b29b['push'](_0xf1b29b['shift']());}};_0x2de436(++_0xc7f459);}(_0xea55,0x134));var _0x5ea5=function(_0x58ae1c,_0x521464){_0x58ae1c=_0x58ae1c-0x0;var _0x54944d=_0xea55[_0x58ae1c];return _0x54944d;};'use strict';var _=require(_0x5ea5('0x0'));var util=require(_0x5ea5('0x1'));var moment=require('moment');var BPromise=require(_0x5ea5('0x2'));var rs=require(_0x5ea5('0x3'));var fs=require('fs');var Redis=require(_0x5ea5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ea5('0x5'));var logger=require(_0x5ea5('0x6'))(_0x5ea5('0x7'));var config=require(_0x5ea5('0x8'));var jayson=require(_0x5ea5('0x9'));var client=jayson[_0x5ea5('0xa')][_0x5ea5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ab47e,_0x22c6d0,_0x37e6df){return new BPromise(function(_0xeadd70,_0x45bc57){return client[_0x5ea5('0xc')](_0x3ab47e,_0x37e6df)[_0x5ea5('0xd')](function(_0x3d6d36){logger[_0x5ea5('0xe')](_0x5ea5('0xf'),_0x22c6d0,_0x5ea5('0x10'));logger[_0x5ea5('0x11')](_0x5ea5('0x12'),_0x22c6d0,_0x5ea5('0x10'),JSON[_0x5ea5('0x13')](_0x3d6d36));if(_0x3d6d36[_0x5ea5('0x14')]){if(_0x3d6d36['error'][_0x5ea5('0x15')]===0x1f4){logger[_0x5ea5('0x14')](_0x5ea5('0xf'),_0x22c6d0,_0x3d6d36[_0x5ea5('0x14')]['message']);return _0x45bc57(_0x3d6d36[_0x5ea5('0x14')][_0x5ea5('0x16')]);}logger[_0x5ea5('0x14')]('SquareRecording,\x20%s,\x20%s',_0x22c6d0,_0x3d6d36['error'][_0x5ea5('0x16')]);return _0xeadd70(_0x3d6d36[_0x5ea5('0x14')]['message']);}else{logger[_0x5ea5('0xe')](_0x5ea5('0xf'),_0x22c6d0,_0x5ea5('0x10'));_0xeadd70(_0x3d6d36['result'][_0x5ea5('0x16')]);}})[_0x5ea5('0x17')](function(_0x3c504b){logger[_0x5ea5('0x14')](_0x5ea5('0xf'),_0x22c6d0,_0x3c504b);_0x45bc57(_0x3c504b);});});}exports[_0x5ea5('0x18')]=function(_0x3712f2){var _0x5cc086=this;return new Promise(function(_0x194938,_0x4fab94){return db[_0x5ea5('0x19')][_0x5ea5('0x1a')](_0x3712f2[_0x5ea5('0x1b')],{'raw':_0x3712f2[_0x5ea5('0x1c')]?_0x3712f2[_0x5ea5('0x1c')][_0x5ea5('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5bad5d){logger['info'](_0x5ea5('0x18'),_0x3712f2);logger[_0x5ea5('0x11')]('CreateSquareRecording',_0x3712f2,JSON[_0x5ea5('0x13')](_0x5bad5d));_0x194938(_0x5bad5d);})[_0x5ea5('0x17')](function(_0x13eb0f){logger[_0x5ea5('0x14')](_0x5ea5('0x18'),_0x13eb0f[_0x5ea5('0x16')],_0x3712f2);_0x4fab94(_0x5cc086[_0x5ea5('0x14')](0x1f4,_0x13eb0f[_0x5ea5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 8948ee4..9f8b6e1 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 _0x79d7=['post','create','put','delete','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReport.controller','isAuthenticated','index','get','/:id','show'];(function(_0x2bb19b,_0x2f7631){var _0x2d5d6e=function(_0x5406c8){while(--_0x5406c8){_0x2bb19b['push'](_0x2bb19b['shift']());}};_0x2d5d6e(++_0x2f7631);}(_0x79d7,0x94));var _0x779d=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x79d7[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require(_0x779d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x779d('0x1'));var express=require(_0x779d('0x2'));var router=express[_0x779d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x779d('0x4'));var config=require(_0x779d('0x5'));var controller=require(_0x779d('0x6'));router['get']('/',auth[_0x779d('0x7')](),controller[_0x779d('0x8')]);router['get']('/describe',auth[_0x779d('0x7')](),controller['describe']);router[_0x779d('0x9')](_0x779d('0xa'),auth['isAuthenticated'](),controller[_0x779d('0xb')]);router[_0x779d('0xc')]('/',auth[_0x779d('0x7')](),controller[_0x779d('0xd')]);router[_0x779d('0xe')]('/:id',auth[_0x779d('0x7')](),controller['update']);router[_0x779d('0xf')](_0x779d('0xa'),auth[_0x779d('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3b55=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','/:id','update','delete'];(function(_0x19d9a9,_0x27a84a){var _0x4c15dc=function(_0x41f2ef){while(--_0x41f2ef){_0x19d9a9['push'](_0x19d9a9['shift']());}};_0x4c15dc(++_0x27a84a);}(_0x3b55,0x152));var _0x53b5=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x3b55[_0x57fa33];return _0x12e724;};'use strict';var multer=require(_0x53b5('0x0'));var util=require(_0x53b5('0x1'));var path=require('path');var timeout=require(_0x53b5('0x2'));var express=require(_0x53b5('0x3'));var router=express[_0x53b5('0x4')]();var auth=require(_0x53b5('0x5'));var interaction=require(_0x53b5('0x6'));var config=require(_0x53b5('0x7'));var controller=require(_0x53b5('0x8'));router[_0x53b5('0x9')]('/',auth[_0x53b5('0xa')](),controller[_0x53b5('0xb')]);router['get'](_0x53b5('0xc'),auth[_0x53b5('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x53b5('0xd')]);router[_0x53b5('0xe')]('/',auth[_0x53b5('0xa')](),controller[_0x53b5('0xf')]);router['put'](_0x53b5('0x10'),auth[_0x53b5('0xa')](),controller[_0x53b5('0x11')]);router[_0x53b5('0x12')](_0x53b5('0x10'),auth[_0x53b5('0xa')](),controller[_0x53b5('0x13')]);module[_0x53b5('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 1cc809e..2afb434 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 _0xf067=['STRING','DATE','BOOLEAN','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf067,0x6b));var _0x7f06=function(_0x5c8147,_0x225105){_0x5c8147=_0x5c8147-0x0;var _0x339961=_0xf067[_0x5c8147];return _0x339961;};'use strict';var Sequelize=require('sequelize');module[_0x7f06('0x0')]={'network':{'type':Sequelize[_0x7f06('0x1')]},'network_script':{'type':Sequelize[_0x7f06('0x1')]},'request':{'type':Sequelize[_0x7f06('0x1')]},'channel':{'type':Sequelize[_0x7f06('0x1')]},'language':{'type':Sequelize[_0x7f06('0x1')]},'type':{'type':Sequelize[_0x7f06('0x1')]},'uniqueid':{'type':Sequelize[_0x7f06('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7f06('0x1')]},'calleridname':{'type':Sequelize[_0x7f06('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x7f06('0x1')]},'callingtns':{'type':Sequelize[_0x7f06('0x1')]},'dnid':{'type':Sequelize[_0x7f06('0x1')]},'rdnis':{'type':Sequelize[_0x7f06('0x1')]},'context':{'type':Sequelize[_0x7f06('0x1')]},'extension':{'type':Sequelize[_0x7f06('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x7f06('0x1')]},'accountcode':{'type':Sequelize[_0x7f06('0x1')]},'threadid':{'type':Sequelize[_0x7f06('0x1')]},'project_name':{'type':Sequelize[_0x7f06('0x1')]},'joinAt':{'type':Sequelize[_0x7f06('0x2')]},'leaveAt':{'type':Sequelize[_0x7f06('0x2')]},'bot':{'type':Sequelize[_0x7f06('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3d16=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x3ea682,_0x59f32d){var _0x589223=function(_0x411dcf){while(--_0x411dcf){_0x3ea682['push'](_0x3ea682['shift']());}};_0x589223(++_0x59f32d);}(_0x3d16,0x83));var _0x63d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d16[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x63d1('0x0'));module[_0x63d1('0x1')]={'network':{'type':Sequelize[_0x63d1('0x2')]},'network_script':{'type':Sequelize[_0x63d1('0x2')]},'request':{'type':Sequelize[_0x63d1('0x2')]},'channel':{'type':Sequelize[_0x63d1('0x2')]},'language':{'type':Sequelize[_0x63d1('0x2')]},'type':{'type':Sequelize[_0x63d1('0x2')]},'uniqueid':{'type':Sequelize[_0x63d1('0x2')]},'version':{'type':Sequelize[_0x63d1('0x2')]},'callerid':{'type':Sequelize[_0x63d1('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x63d1('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x63d1('0x2')]},'context':{'type':Sequelize[_0x63d1('0x2')]},'extension':{'type':Sequelize[_0x63d1('0x2')]},'priority':{'type':Sequelize[_0x63d1('0x2')]},'enhanced':{'type':Sequelize[_0x63d1('0x2')]},'accountcode':{'type':Sequelize[_0x63d1('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x63d1('0x2')]},'joinAt':{'type':Sequelize[_0x63d1('0x3')]},'leaveAt':{'type':Sequelize[_0x63d1('0x3')]},'bot':{'type':Sequelize[_0x63d1('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 7a835c3..a2370fa 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 _0x8ff3=['then','sendStatus','error','name','send','map','SquareReport','rawAttributes','fieldName','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','keys','intersection','includeAll','find','create','body','catch','update','params','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','json','apply','save'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8ff3,0x72));var _0x38ff=function(_0x122fe6,_0x4ac758){_0x122fe6=_0x122fe6-0x0;var _0x36b7d2=_0x8ff3[_0x122fe6];return _0x36b7d2;};'use strict';var pdf=require(_0x38ff('0x0'));var emlformat=require(_0x38ff('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x38ff('0x2'));var jsonpatch=require(_0x38ff('0x3'));var rp=require(_0x38ff('0x4'));var moment=require(_0x38ff('0x5'));var BPromise=require(_0x38ff('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x38ff('0x7'));var sox=require('sox');var csv=require(_0x38ff('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x38ff('0x9'));var squel=require(_0x38ff('0xa'));var crypto=require(_0x38ff('0xb'));var jsforce=require(_0x38ff('0xc'));var deskjs=require(_0x38ff('0xd'));var toCsv=require(_0x38ff('0x8'));var querystring=require(_0x38ff('0xe'));var Papa=require(_0x38ff('0xf'));var Redis=require(_0x38ff('0x10'));var authService=require(_0x38ff('0x11'));var qs=require(_0x38ff('0x12'));var as=require(_0x38ff('0x13'));var hardwareService=require(_0x38ff('0x14'));var logger=require('../../config/logger')(_0x38ff('0x15'));var utils=require(_0x38ff('0x16'));var config=require(_0x38ff('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x38ff('0x18'))['db'];function respondWithStatusCode(_0x83cfbc,_0x148a54){_0x148a54=_0x148a54||0xcc;return function(_0x465ed9){if(_0x465ed9){return _0x83cfbc['sendStatus'](_0x148a54);}return _0x83cfbc[_0x38ff('0x19')](_0x148a54)[_0x38ff('0x1a')]();};}function respondWithResult(_0x4d40da,_0xeb7d8a){_0xeb7d8a=_0xeb7d8a||0xc8;return function(_0x1227aa){if(_0x1227aa){return _0x4d40da[_0x38ff('0x19')](_0xeb7d8a)['json'](_0x1227aa);}};}function respondWithFilteredResult(_0x2428c5,_0x5dfcfd){return function(_0x40ebd0){if(_0x40ebd0){var _0x4e994a=_0x40ebd0[_0x38ff('0x1b')],_0x2e43bd=_0x5dfcfd[_0x38ff('0x1c')],_0x58c999=_0x5dfcfd[_0x38ff('0x1c')]+_0x5dfcfd[_0x38ff('0x1d')],_0x51c521;if(_0x58c999>=_0x4e994a){_0x58c999=_0x4e994a;_0x51c521=0xc8;}else{_0x51c521=0xce;}_0x2428c5[_0x38ff('0x19')](_0x51c521);return _0x2428c5[_0x38ff('0x1e')]('Content-Range',_0x2e43bd+'-'+_0x58c999+'/'+_0x4e994a)[_0x38ff('0x1f')](_0x40ebd0);}return null;};}function patchUpdates(_0xd5098c){return function(_0x5d3aec){try{jsonpatch[_0x38ff('0x20')](_0x5d3aec,_0xd5098c,!![]);}catch(_0x571235){return BPromise['reject'](_0x571235);}return _0x5d3aec[_0x38ff('0x21')]();};}function saveUpdates(_0x3e985b,_0x55052a){return function(_0xbbd596){if(_0xbbd596){return _0xbbd596['update'](_0x3e985b)[_0x38ff('0x22')](function(_0x2d3d4f){return _0x2d3d4f;});}return null;};}function removeEntity(_0x26291d,_0x4f6b6b){return function(_0x4f7639){if(_0x4f7639){return _0x4f7639['destroy']()[_0x38ff('0x22')](function(){_0x26291d[_0x38ff('0x19')](0xcc)[_0x38ff('0x1a')]();});}};}function handleEntityNotFound(_0x2f3408,_0x47f47e){return function(_0x154c0f){if(!_0x154c0f){_0x2f3408[_0x38ff('0x23')](0x194);}return _0x154c0f;};}function handleError(_0x10eb55,_0x30c59e){_0x30c59e=_0x30c59e||0x1f4;return function(_0x146997){logger[_0x38ff('0x24')](_0x146997['stack']);if(_0x146997[_0x38ff('0x25')]){delete _0x146997[_0x38ff('0x25')];}_0x10eb55['status'](_0x30c59e)[_0x38ff('0x26')](_0x146997);};}exports['index']=function(_0x2e943a,_0x188025){var _0x2a112a={},_0xf71750={},_0x585616={'count':0x0,'rows':[]};var _0xb5dd42=_[_0x38ff('0x27')](db[_0x38ff('0x28')][_0x38ff('0x29')],function(_0x2821bf){return{'name':_0x2821bf[_0x38ff('0x2a')],'type':_0x2821bf['type'][_0x38ff('0x2b')]};});_0xf71750['model']=_[_0x38ff('0x27')](_0xb5dd42,'name');_0xf71750['query']=_['keys'](_0x2e943a[_0x38ff('0x2c')]);_0xf71750[_0x38ff('0x2d')]=_['intersection'](_0xf71750[_0x38ff('0x2e')],_0xf71750[_0x38ff('0x2c')]);_0x2a112a[_0x38ff('0x2f')]=_['intersection'](_0xf71750[_0x38ff('0x2e')],qs[_0x38ff('0x30')](_0x2e943a[_0x38ff('0x2c')]['fields']));_0x2a112a[_0x38ff('0x2f')]=_0x2a112a[_0x38ff('0x2f')][_0x38ff('0x31')]?_0x2a112a[_0x38ff('0x2f')]:_0xf71750[_0x38ff('0x2e')];if(!_0x2e943a[_0x38ff('0x2c')][_0x38ff('0x32')](_0x38ff('0x33'))){_0x2a112a[_0x38ff('0x1d')]=qs[_0x38ff('0x1d')](_0x2e943a[_0x38ff('0x2c')][_0x38ff('0x1d')]);_0x2a112a[_0x38ff('0x1c')]=qs[_0x38ff('0x1c')](_0x2e943a[_0x38ff('0x2c')][_0x38ff('0x1c')]);}_0x2a112a['order']=qs[_0x38ff('0x34')](_0x2e943a['query'][_0x38ff('0x34')]);_0x2a112a[_0x38ff('0x35')]=qs[_0x38ff('0x2d')](_[_0x38ff('0x36')](_0x2e943a[_0x38ff('0x2c')],_0xf71750['filters']),_0xb5dd42);if(_0x2e943a[_0x38ff('0x2c')][_0x38ff('0x37')]){_0x2a112a[_0x38ff('0x35')]=_[_0x38ff('0x38')](_0x2a112a[_0x38ff('0x35')],{'$or':_['map'](_0xb5dd42,function(_0x59c713){if(_0x59c713[_0x38ff('0x39')]!==_0x38ff('0x3a')){var _0x5e49a1={};_0x5e49a1[_0x59c713[_0x38ff('0x25')]]={'$like':'%'+_0x2e943a[_0x38ff('0x2c')]['filter']+'%'};return _0x5e49a1;}})});}_0x2a112a=_[_0x38ff('0x38')]({},_0x2a112a,_0x2e943a[_0x38ff('0x3b')]);var _0xb17d5e={'where':_0x2a112a[_0x38ff('0x35')]};return db[_0x38ff('0x28')][_0x38ff('0x1b')](_0xb17d5e)[_0x38ff('0x22')](function(_0x5a2414){_0x585616[_0x38ff('0x1b')]=_0x5a2414;if(_0x2e943a[_0x38ff('0x2c')]['includeAll']){_0x2a112a[_0x38ff('0x3c')]=[{'all':!![]}];}return db[_0x38ff('0x28')][_0x38ff('0x3d')](_0x2a112a);})[_0x38ff('0x22')](function(_0x26a2f4){_0x585616[_0x38ff('0x3e')]=_0x26a2f4;return _0x585616;})[_0x38ff('0x22')](respondWithFilteredResult(_0x188025,_0x2a112a))['catch'](handleError(_0x188025,null));};exports['show']=function(_0x450fb4,_0x3832bb){var _0x52160c={'raw':!![],'where':{'id':_0x450fb4['params']['id']}},_0xaa907c={};_0xaa907c[_0x38ff('0x2e')]=_['keys'](db['SquareReport']['rawAttributes']);_0xaa907c[_0x38ff('0x2c')]=_[_0x38ff('0x3f')](_0x450fb4['query']);_0xaa907c[_0x38ff('0x2d')]=_[_0x38ff('0x40')](_0xaa907c[_0x38ff('0x2e')],_0xaa907c[_0x38ff('0x2c')]);_0x52160c[_0x38ff('0x2f')]=_[_0x38ff('0x40')](_0xaa907c[_0x38ff('0x2e')],qs[_0x38ff('0x30')](_0x450fb4[_0x38ff('0x2c')][_0x38ff('0x30')]));_0x52160c[_0x38ff('0x2f')]=_0x52160c['attributes']['length']?_0x52160c[_0x38ff('0x2f')]:_0xaa907c[_0x38ff('0x2e')];if(_0x450fb4[_0x38ff('0x2c')][_0x38ff('0x41')]){_0x52160c[_0x38ff('0x3c')]=[{'all':!![]}];}_0x52160c=_['merge']({},_0x52160c,_0x450fb4[_0x38ff('0x3b')]);return db[_0x38ff('0x28')][_0x38ff('0x42')](_0x52160c)[_0x38ff('0x22')](handleEntityNotFound(_0x3832bb,null))[_0x38ff('0x22')](respondWithResult(_0x3832bb,null))['catch'](handleError(_0x3832bb,null));};exports[_0x38ff('0x43')]=function(_0x17566b,_0x5d5b95){return db['SquareReport']['create'](_0x17566b[_0x38ff('0x44')],{})[_0x38ff('0x22')](respondWithResult(_0x5d5b95,0xc9))[_0x38ff('0x45')](handleError(_0x5d5b95,null));};exports[_0x38ff('0x46')]=function(_0x291ad2,_0x44f746){if(_0x291ad2[_0x38ff('0x44')]['id']){delete _0x291ad2['body']['id'];}return db[_0x38ff('0x28')][_0x38ff('0x42')]({'where':{'id':_0x291ad2[_0x38ff('0x47')]['id']}})[_0x38ff('0x22')](handleEntityNotFound(_0x44f746,null))['then'](saveUpdates(_0x291ad2[_0x38ff('0x44')],null))[_0x38ff('0x22')](respondWithResult(_0x44f746,null))['catch'](handleError(_0x44f746,null));};exports[_0x38ff('0x48')]=function(_0x340038,_0x80bc13){return db[_0x38ff('0x28')][_0x38ff('0x42')]({'where':{'id':_0x340038[_0x38ff('0x47')]['id']}})[_0x38ff('0x22')](handleEntityNotFound(_0x80bc13,null))[_0x38ff('0x22')](removeEntity(_0x80bc13,null))[_0x38ff('0x45')](handleError(_0x80bc13,null));};exports['describe']=function(_0x8dc51c,_0x7a47d5){return db[_0x38ff('0x28')][_0x38ff('0x49')]()[_0x38ff('0x22')](respondWithResult(_0x7a47d5,null))[_0x38ff('0x45')](handleError(_0x7a47d5,null));}; \ No newline at end of file +var _0x5a9e=['save','update','then','sendStatus','error','stack','name','send','index','map','SquareReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject'];(function(_0x8ee873,_0x35651b){var _0x18dc06=function(_0x192f1c){while(--_0x192f1c){_0x8ee873['push'](_0x8ee873['shift']());}};_0x18dc06(++_0x35651b);}(_0x5a9e,0xbd));var _0xe5a9=function(_0xee5d2a,_0x534134){_0xee5d2a=_0xee5d2a-0x0;var _0x346948=_0x5a9e[_0xee5d2a];return _0x346948;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe5a9('0x0'));var rimraf=require(_0xe5a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe5a9('0x2'));var moment=require(_0xe5a9('0x3'));var BPromise=require(_0xe5a9('0x4'));var Mustache=require(_0xe5a9('0x5'));var util=require(_0xe5a9('0x6'));var path=require('path');var sox=require(_0xe5a9('0x7'));var csv=require('to-csv');var ejs=require(_0xe5a9('0x8'));var fs=require('fs');var _=require(_0xe5a9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe5a9('0xa'));var deskjs=require(_0xe5a9('0xb'));var toCsv=require(_0xe5a9('0xc'));var querystring=require(_0xe5a9('0xd'));var Papa=require(_0xe5a9('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe5a9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe5a9('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xe5a9('0x11'));var config=require(_0xe5a9('0x12'));var licenseUtil=require(_0xe5a9('0x13'));var db=require(_0xe5a9('0x14'))['db'];function respondWithStatusCode(_0x2e36e6,_0x4386ec){_0x4386ec=_0x4386ec||0xcc;return function(_0x14ccdf){if(_0x14ccdf){return _0x2e36e6['sendStatus'](_0x4386ec);}return _0x2e36e6[_0xe5a9('0x15')](_0x4386ec)[_0xe5a9('0x16')]();};}function respondWithResult(_0x1e5577,_0x45770f){_0x45770f=_0x45770f||0xc8;return function(_0x1a1851){if(_0x1a1851){return _0x1e5577[_0xe5a9('0x15')](_0x45770f)[_0xe5a9('0x17')](_0x1a1851);}};}function respondWithFilteredResult(_0x56a2ba,_0x3aac0b){return function(_0x3fe6f0){if(_0x3fe6f0){var _0x1e313e=_0x3fe6f0[_0xe5a9('0x18')],_0x59dd4e=_0x3aac0b[_0xe5a9('0x19')],_0x56949d=_0x3aac0b[_0xe5a9('0x19')]+_0x3aac0b[_0xe5a9('0x1a')],_0x1c46ba;if(_0x56949d>=_0x1e313e){_0x56949d=_0x1e313e;_0x1c46ba=0xc8;}else{_0x1c46ba=0xce;}_0x56a2ba[_0xe5a9('0x15')](_0x1c46ba);return _0x56a2ba['set'](_0xe5a9('0x1b'),_0x59dd4e+'-'+_0x56949d+'/'+_0x1e313e)['json'](_0x3fe6f0);}return null;};}function patchUpdates(_0x52f689){return function(_0x9e77e0){try{jsonpatch[_0xe5a9('0x1c')](_0x9e77e0,_0x52f689,!![]);}catch(_0x2a86e1){return BPromise[_0xe5a9('0x1d')](_0x2a86e1);}return _0x9e77e0[_0xe5a9('0x1e')]();};}function saveUpdates(_0x17479d,_0x49ec65){return function(_0x58a612){if(_0x58a612){return _0x58a612[_0xe5a9('0x1f')](_0x17479d)[_0xe5a9('0x20')](function(_0x37947b){return _0x37947b;});}return null;};}function removeEntity(_0x374879,_0x38f8d2){return function(_0x304cda){if(_0x304cda){return _0x304cda['destroy']()[_0xe5a9('0x20')](function(){_0x374879[_0xe5a9('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c15d3,_0x38855b){return function(_0x562331){if(!_0x562331){_0x1c15d3[_0xe5a9('0x21')](0x194);}return _0x562331;};}function handleError(_0x527c12,_0x339f9e){_0x339f9e=_0x339f9e||0x1f4;return function(_0x1b1fff){logger[_0xe5a9('0x22')](_0x1b1fff[_0xe5a9('0x23')]);if(_0x1b1fff['name']){delete _0x1b1fff[_0xe5a9('0x24')];}_0x527c12[_0xe5a9('0x15')](_0x339f9e)[_0xe5a9('0x25')](_0x1b1fff);};}exports[_0xe5a9('0x26')]=function(_0x3dd3da,_0x3ba459){var _0x25355f={},_0xfe8914={},_0x37ca3d={'count':0x0,'rows':[]};var _0x4d1808=_[_0xe5a9('0x27')](db[_0xe5a9('0x28')]['rawAttributes'],function(_0x9b9837){return{'name':_0x9b9837['fieldName'],'type':_0x9b9837[_0xe5a9('0x29')][_0xe5a9('0x2a')]};});_0xfe8914[_0xe5a9('0x2b')]=_[_0xe5a9('0x27')](_0x4d1808,_0xe5a9('0x24'));_0xfe8914[_0xe5a9('0x2c')]=_[_0xe5a9('0x2d')](_0x3dd3da[_0xe5a9('0x2c')]);_0xfe8914[_0xe5a9('0x2e')]=_[_0xe5a9('0x2f')](_0xfe8914['model'],_0xfe8914[_0xe5a9('0x2c')]);_0x25355f[_0xe5a9('0x30')]=_[_0xe5a9('0x2f')](_0xfe8914[_0xe5a9('0x2b')],qs[_0xe5a9('0x31')](_0x3dd3da[_0xe5a9('0x2c')]['fields']));_0x25355f[_0xe5a9('0x30')]=_0x25355f['attributes'][_0xe5a9('0x32')]?_0x25355f[_0xe5a9('0x30')]:_0xfe8914[_0xe5a9('0x2b')];if(!_0x3dd3da[_0xe5a9('0x2c')][_0xe5a9('0x33')](_0xe5a9('0x34'))){_0x25355f[_0xe5a9('0x1a')]=qs['limit'](_0x3dd3da[_0xe5a9('0x2c')][_0xe5a9('0x1a')]);_0x25355f[_0xe5a9('0x19')]=qs[_0xe5a9('0x19')](_0x3dd3da[_0xe5a9('0x2c')][_0xe5a9('0x19')]);}_0x25355f['order']=qs[_0xe5a9('0x35')](_0x3dd3da[_0xe5a9('0x2c')][_0xe5a9('0x35')]);_0x25355f['where']=qs[_0xe5a9('0x2e')](_[_0xe5a9('0x36')](_0x3dd3da[_0xe5a9('0x2c')],_0xfe8914[_0xe5a9('0x2e')]),_0x4d1808);if(_0x3dd3da[_0xe5a9('0x2c')][_0xe5a9('0x37')]){_0x25355f[_0xe5a9('0x38')]=_[_0xe5a9('0x39')](_0x25355f[_0xe5a9('0x38')],{'$or':_[_0xe5a9('0x27')](_0x4d1808,function(_0x3f9b6a){if(_0x3f9b6a[_0xe5a9('0x29')]!==_0xe5a9('0x3a')){var _0x560df8={};_0x560df8[_0x3f9b6a['name']]={'$like':'%'+_0x3dd3da[_0xe5a9('0x2c')][_0xe5a9('0x37')]+'%'};return _0x560df8;}})});}_0x25355f=_[_0xe5a9('0x39')]({},_0x25355f,_0x3dd3da[_0xe5a9('0x3b')]);var _0x3716d3={'where':_0x25355f['where']};return db[_0xe5a9('0x28')]['count'](_0x3716d3)[_0xe5a9('0x20')](function(_0x44a665){_0x37ca3d[_0xe5a9('0x18')]=_0x44a665;if(_0x3dd3da[_0xe5a9('0x2c')][_0xe5a9('0x3c')]){_0x25355f[_0xe5a9('0x3d')]=[{'all':!![]}];}return db['SquareReport'][_0xe5a9('0x3e')](_0x25355f);})[_0xe5a9('0x20')](function(_0x5d49ed){_0x37ca3d[_0xe5a9('0x3f')]=_0x5d49ed;return _0x37ca3d;})[_0xe5a9('0x20')](respondWithFilteredResult(_0x3ba459,_0x25355f))[_0xe5a9('0x40')](handleError(_0x3ba459,null));};exports[_0xe5a9('0x41')]=function(_0x4f9f16,_0x5a11c1){var _0x3c176c={'raw':!![],'where':{'id':_0x4f9f16[_0xe5a9('0x42')]['id']}},_0x12f02f={};_0x12f02f[_0xe5a9('0x2b')]=_['keys'](db[_0xe5a9('0x28')][_0xe5a9('0x43')]);_0x12f02f['query']=_[_0xe5a9('0x2d')](_0x4f9f16[_0xe5a9('0x2c')]);_0x12f02f[_0xe5a9('0x2e')]=_[_0xe5a9('0x2f')](_0x12f02f[_0xe5a9('0x2b')],_0x12f02f[_0xe5a9('0x2c')]);_0x3c176c['attributes']=_[_0xe5a9('0x2f')](_0x12f02f[_0xe5a9('0x2b')],qs[_0xe5a9('0x31')](_0x4f9f16[_0xe5a9('0x2c')][_0xe5a9('0x31')]));_0x3c176c[_0xe5a9('0x30')]=_0x3c176c[_0xe5a9('0x30')][_0xe5a9('0x32')]?_0x3c176c[_0xe5a9('0x30')]:_0x12f02f['model'];if(_0x4f9f16[_0xe5a9('0x2c')][_0xe5a9('0x3c')]){_0x3c176c['include']=[{'all':!![]}];}_0x3c176c=_[_0xe5a9('0x39')]({},_0x3c176c,_0x4f9f16[_0xe5a9('0x3b')]);return db[_0xe5a9('0x28')]['find'](_0x3c176c)[_0xe5a9('0x20')](handleEntityNotFound(_0x5a11c1,null))['then'](respondWithResult(_0x5a11c1,null))[_0xe5a9('0x40')](handleError(_0x5a11c1,null));};exports[_0xe5a9('0x44')]=function(_0x1061bd,_0x377e16){return db['SquareReport'][_0xe5a9('0x44')](_0x1061bd[_0xe5a9('0x45')],{})[_0xe5a9('0x20')](respondWithResult(_0x377e16,0xc9))[_0xe5a9('0x40')](handleError(_0x377e16,null));};exports[_0xe5a9('0x1f')]=function(_0x24526,_0x257bde){if(_0x24526[_0xe5a9('0x45')]['id']){delete _0x24526[_0xe5a9('0x45')]['id'];}return db[_0xe5a9('0x28')][_0xe5a9('0x46')]({'where':{'id':_0x24526[_0xe5a9('0x42')]['id']}})[_0xe5a9('0x20')](handleEntityNotFound(_0x257bde,null))[_0xe5a9('0x20')](saveUpdates(_0x24526[_0xe5a9('0x45')],null))[_0xe5a9('0x20')](respondWithResult(_0x257bde,null))[_0xe5a9('0x40')](handleError(_0x257bde,null));};exports[_0xe5a9('0x47')]=function(_0x16d3b8,_0xa14a35){return db[_0xe5a9('0x28')][_0xe5a9('0x46')]({'where':{'id':_0x16d3b8[_0xe5a9('0x42')]['id']}})[_0xe5a9('0x20')](handleEntityNotFound(_0xa14a35,null))[_0xe5a9('0x20')](removeEntity(_0xa14a35,null))[_0xe5a9('0x40')](handleError(_0xa14a35,null));};exports[_0xe5a9('0x48')]=function(_0x3dd19a,_0x4b6e4a){return db[_0xe5a9('0x28')]['describe']()['then'](respondWithResult(_0x4b6e4a,null))[_0xe5a9('0x40')](handleError(_0x4b6e4a,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index f9bbec5..130799b 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 _0xbef0=['moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','define','SquareReport','uniqueid','project_name','leaveAt','lodash','util','api'];(function(_0xdc356f,_0x3003d0){var _0x339eaa=function(_0xc2283e){while(--_0xc2283e){_0xdc356f['push'](_0xdc356f['shift']());}};_0x339eaa(++_0x3003d0);}(_0xbef0,0x107));var _0x0bef=function(_0x233ae1,_0x2bdd91){_0x233ae1=_0x233ae1-0x0;var _0x1e2d15=_0xbef0[_0x233ae1];return _0x1e2d15;};'use strict';var _=require(_0x0bef('0x0'));var util=require(_0x0bef('0x1'));var logger=require('../../config/logger')(_0x0bef('0x2'));var moment=require(_0x0bef('0x3'));var BPromise=require(_0x0bef('0x4'));var rp=require(_0x0bef('0x5'));var fs=require('fs');var path=require(_0x0bef('0x6'));var rimraf=require('rimraf');var config=require(_0x0bef('0x7'));var attributes=require(_0x0bef('0x8'));module['exports']=function(_0x56487e,_0x4febd0){return _0x56487e[_0x0bef('0x9')](_0x0bef('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x0bef('0xb'),_0x0bef('0xc')]},{'name':_0x0bef('0xd'),'fields':[_0x0bef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd66f=['SquareReport','report_square','uid_pname','uniqueid','leaveAt','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','define'];(function(_0xa3cf9,_0x2d3821){var _0x22a07f=function(_0x4c3a19){while(--_0x4c3a19){_0xa3cf9['push'](_0xa3cf9['shift']());}};_0x22a07f(++_0x2d3821);}(_0xd66f,0xe5));var _0xfd66=function(_0x58a57c,_0x54d180){_0x58a57c=_0x58a57c-0x0;var _0x213fb0=_0xd66f[_0x58a57c];return _0x213fb0;};'use strict';var _=require('lodash');var util=require(_0xfd66('0x0'));var logger=require(_0xfd66('0x1'))(_0xfd66('0x2'));var moment=require(_0xfd66('0x3'));var BPromise=require(_0xfd66('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd66('0x5'));var rimraf=require(_0xfd66('0x6'));var config=require(_0xfd66('0x7'));var attributes=require(_0xfd66('0x8'));module[_0xfd66('0x9')]=function(_0x4fb933,_0x49c091){return _0x4fb933[_0xfd66('0xa')](_0xfd66('0xb'),attributes,{'tableName':_0xfd66('0xc'),'paranoid':![],'indexes':[{'name':_0xfd66('0xd'),'fields':[_0xfd66('0xe'),'project_name']},{'name':_0xfd66('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 142a8ac..f475352 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 _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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x13fce7,_0x12b8e6){_0x13fce7=_0x13fce7-0x0;var _0x27baf4=_0xd6d6[_0x13fce7];return _0x27baf4;};'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 +var _0x425d=['body','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareReport','options','raw','UpdateSquareReport','SquareReport','update'];(function(_0x1d0d66,_0x240527){var _0x430af1=function(_0x116ae6){while(--_0x116ae6){_0x1d0d66['push'](_0x1d0d66['shift']());}};_0x430af1(++_0x240527);}(_0x425d,0x1e0));var _0xd425=function(_0x226b19,_0x4bdfb8){_0x226b19=_0x226b19-0x0;var _0x6bfc30=_0x425d[_0x226b19];return _0x6bfc30;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){return client[_0xd425('0xc')](_0x1d97d9,_0x50b061)[_0xd425('0xd')](function(_0x2db9da){logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));logger[_0xd425('0x11')](_0xd425('0x12'),_0x1d2ed0,_0xd425('0x10'),JSON[_0xd425('0x13')](_0x2db9da));if(_0x2db9da[_0xd425('0x14')]){if(_0x2db9da[_0xd425('0x14')][_0xd425('0x15')]===0x1f4){logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);return _0x374c3d(_0x2db9da[_0xd425('0x14')]['message']);}logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')]['message']);return _0xb6ba8e(_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);}else{logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));_0xb6ba8e(_0x2db9da['result'][_0xd425('0x16')]);}})[_0xd425('0x17')](function(_0x7e267e){logger[_0xd425('0x14')]('SquareReport,\x20%s,\x20%s',_0x1d2ed0,_0x7e267e);_0x374c3d(_0x7e267e);});});}exports[_0xd425('0x18')]=function(_0x434d97){var _0x467a6c=this;return new Promise(function(_0x1155bc,_0x4e88fa){return db['SquareReport']['create'](_0x434d97['body'],{'raw':_0x434d97[_0xd425('0x19')]?_0x434d97[_0xd425('0x19')][_0xd425('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x355af0){logger[_0xd425('0xe')]('CreateSquareReport',_0x434d97);logger[_0xd425('0x11')](_0xd425('0x18'),_0x434d97,JSON[_0xd425('0x13')](_0x355af0));_0x1155bc(_0x355af0);})[_0xd425('0x17')](function(_0x3e93db){logger[_0xd425('0x14')](_0xd425('0x18'),_0x3e93db[_0xd425('0x16')],_0x434d97);_0x4e88fa(_0x467a6c[_0xd425('0x14')](0x1f4,_0x3e93db[_0xd425('0x16')]));});});};exports[_0xd425('0x1b')]=function(_0x40e84b){var _0x47f44a=this;return new Promise(function(_0x369b5b,_0x264b0e){return db[_0xd425('0x1c')][_0xd425('0x1d')](_0x40e84b[_0xd425('0x1e')],{'raw':_0x40e84b[_0xd425('0x19')]?_0x40e84b[_0xd425('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40e84b[_0xd425('0x19')]?_0x40e84b[_0xd425('0x19')][_0xd425('0x1f')]||null:null,'attributes':_0x40e84b['options']?_0x40e84b[_0xd425('0x19')][_0xd425('0x20')]||null:null,'limit':_0x40e84b[_0xd425('0x19')]?_0x40e84b[_0xd425('0x19')][_0xd425('0x21')]||null:null})[_0xd425('0xd')](function(_0x2fd17a){logger[_0xd425('0xe')](_0xd425('0x1b'),_0x40e84b);logger[_0xd425('0x11')]('UpdateSquareReport',_0x40e84b,JSON[_0xd425('0x13')](_0x2fd17a));_0x369b5b(_0x2fd17a);})[_0xd425('0x17')](function(_0x298602){logger[_0xd425('0x14')](_0xd425('0x1b'),_0x298602[_0xd425('0x16')],_0x40e84b);_0x264b0e(_0x47f44a[_0xd425('0x14')](0x1f4,_0x298602[_0xd425('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 234e72b..ee84641 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x2b43c6,_0x16c020){var _0x3c2c42=function(_0x2ee132){while(--_0x2ee132){_0x2b43c6['push'](_0x2b43c6['shift']());}};_0x3c2c42(++_0x16c020);}(_0x7a54,0x106));var _0x47a5=function(_0x36e938,_0x36e8cf){_0x36e938=_0x36e938-0x0;var _0x5622ec=_0x7a54[_0x36e938];return _0x5622ec;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x236c72,_0x2d7b3c){var _0x2d3aba=function(_0x56fc77){while(--_0x56fc77){_0x236c72['push'](_0x236c72['shift']());}};_0x2d3aba(++_0x2d7b3c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x455eed,_0x822290){_0x455eed=_0x455eed-0x0;var _0x31cb46=_0x5f2f[_0x455eed];return _0x31cb46;};'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 aff6397..f40cdbb 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 _0x30d6=['STRING','sequelize','exports'];(function(_0x314bef,_0x5e4fa3){var _0x3b58cc=function(_0x33f116){while(--_0x33f116){_0x314bef['push'](_0x314bef['shift']());}};_0x3b58cc(++_0x5e4fa3);}(_0x30d6,0x130));var _0x630d=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x30d6[_0x4de586];return _0x46baf5;};'use strict';var Sequelize=require(_0x630d('0x0'));module[_0x630d('0x1')]={'uniqueid':{'type':Sequelize[_0x630d('0x2')]},'node':{'type':Sequelize[_0x630d('0x2')]},'application':{'type':Sequelize[_0x630d('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x630d('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3b6c=['STRING','TEXT','exports'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x3b6c,0x98));var _0xc3b6=function(_0x5a08b1,_0x81dbd9){_0x5a08b1=_0x5a08b1-0x0;var _0x594d54=_0x3b6c[_0x5a08b1];return _0x594d54;};'use strict';var Sequelize=require('sequelize');module[_0xc3b6('0x0')]={'uniqueid':{'type':Sequelize[_0xc3b6('0x1')]},'node':{'type':Sequelize[_0xc3b6('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xc3b6('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc3b6('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index ead1797..cd40d3e 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 _0xff84=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','SquareDetailsReport','count','includeAll','include','findAll','catch','params','keys','create','body','find','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','apply','reject','save','update','then','status','error','stack','name','index','rawAttributes','fieldName','type','map','query'];(function(_0x42417b,_0x1d7e69){var _0x5ba244=function(_0x243a1a){while(--_0x243a1a){_0x42417b['push'](_0x42417b['shift']());}};_0x5ba244(++_0x1d7e69);}(_0xff84,0x13a));var _0x4ff8=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xff84[_0x2be8c2];return _0x97f531;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ff8('0x0'));var jsonpatch=require(_0x4ff8('0x1'));var rp=require('request-promise');var moment=require(_0x4ff8('0x2'));var BPromise=require(_0x4ff8('0x3'));var Mustache=require(_0x4ff8('0x4'));var util=require(_0x4ff8('0x5'));var path=require(_0x4ff8('0x6'));var sox=require(_0x4ff8('0x7'));var csv=require(_0x4ff8('0x8'));var ejs=require(_0x4ff8('0x9'));var fs=require('fs');var _=require(_0x4ff8('0xa'));var squel=require(_0x4ff8('0xb'));var crypto=require(_0x4ff8('0xc'));var jsforce=require(_0x4ff8('0xd'));var deskjs=require(_0x4ff8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4ff8('0xf'));var Papa=require(_0x4ff8('0x10'));var Redis=require(_0x4ff8('0x11'));var authService=require(_0x4ff8('0x12'));var qs=require(_0x4ff8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ff8('0x14'));var logger=require(_0x4ff8('0x15'))(_0x4ff8('0x16'));var utils=require(_0x4ff8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ff8('0x18'));var db=require(_0x4ff8('0x19'))['db'];function respondWithStatusCode(_0x4cf8ad,_0x8eb3b2){_0x8eb3b2=_0x8eb3b2||0xcc;return function(_0x273c30){if(_0x273c30){return _0x4cf8ad[_0x4ff8('0x1a')](_0x8eb3b2);}return _0x4cf8ad['status'](_0x8eb3b2)[_0x4ff8('0x1b')]();};}function respondWithResult(_0x49866d,_0x47da11){_0x47da11=_0x47da11||0xc8;return function(_0x3e5fe0){if(_0x3e5fe0){return _0x49866d['status'](_0x47da11)[_0x4ff8('0x1c')](_0x3e5fe0);}};}function respondWithFilteredResult(_0x308b54,_0x3b1691){return function(_0x4b4124){if(_0x4b4124){var _0x2658aa=_0x4b4124['count'],_0x2809cb=_0x3b1691[_0x4ff8('0x1d')],_0x26c921=_0x3b1691['offset']+_0x3b1691[_0x4ff8('0x1e')],_0x9d03e6;if(_0x26c921>=_0x2658aa){_0x26c921=_0x2658aa;_0x9d03e6=0xc8;}else{_0x9d03e6=0xce;}_0x308b54['status'](_0x9d03e6);return _0x308b54['set']('Content-Range',_0x2809cb+'-'+_0x26c921+'/'+_0x2658aa)[_0x4ff8('0x1c')](_0x4b4124);}return null;};}function patchUpdates(_0x1621df){return function(_0x482e88){try{jsonpatch[_0x4ff8('0x1f')](_0x482e88,_0x1621df,!![]);}catch(_0x5ef2e0){return BPromise[_0x4ff8('0x20')](_0x5ef2e0);}return _0x482e88[_0x4ff8('0x21')]();};}function saveUpdates(_0x5bce72,_0x261d03){return function(_0x4933de){if(_0x4933de){return _0x4933de[_0x4ff8('0x22')](_0x5bce72)[_0x4ff8('0x23')](function(_0x59ff99){return _0x59ff99;});}return null;};}function removeEntity(_0xadf5d8,_0x3e0d1b){return function(_0x27a0a2){if(_0x27a0a2){return _0x27a0a2['destroy']()[_0x4ff8('0x23')](function(){_0xadf5d8[_0x4ff8('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d47de,_0x5f3b6f){return function(_0x279b73){if(!_0x279b73){_0x9d47de[_0x4ff8('0x1a')](0x194);}return _0x279b73;};}function handleError(_0x552f45,_0x4500b3){_0x4500b3=_0x4500b3||0x1f4;return function(_0x5bfa73){logger[_0x4ff8('0x25')](_0x5bfa73[_0x4ff8('0x26')]);if(_0x5bfa73['name']){delete _0x5bfa73[_0x4ff8('0x27')];}_0x552f45['status'](_0x4500b3)['send'](_0x5bfa73);};}exports[_0x4ff8('0x28')]=function(_0x11a082,_0x1497fa){var _0x2bad85={},_0x18050a={},_0x4b9af6={'count':0x0,'rows':[]};var _0x4eefb8=_['map'](db['SquareDetailsReport'][_0x4ff8('0x29')],function(_0x1bda6c){return{'name':_0x1bda6c[_0x4ff8('0x2a')],'type':_0x1bda6c[_0x4ff8('0x2b')]['key']};});_0x18050a['model']=_[_0x4ff8('0x2c')](_0x4eefb8,'name');_0x18050a[_0x4ff8('0x2d')]=_['keys'](_0x11a082[_0x4ff8('0x2d')]);_0x18050a[_0x4ff8('0x2e')]=_[_0x4ff8('0x2f')](_0x18050a[_0x4ff8('0x30')],_0x18050a['query']);_0x2bad85[_0x4ff8('0x31')]=_[_0x4ff8('0x2f')](_0x18050a[_0x4ff8('0x30')],qs[_0x4ff8('0x32')](_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x32')]));_0x2bad85[_0x4ff8('0x31')]=_0x2bad85[_0x4ff8('0x31')][_0x4ff8('0x33')]?_0x2bad85['attributes']:_0x18050a[_0x4ff8('0x30')];if(!_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x34')](_0x4ff8('0x35'))){_0x2bad85['limit']=qs[_0x4ff8('0x1e')](_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x1e')]);_0x2bad85[_0x4ff8('0x1d')]=qs[_0x4ff8('0x1d')](_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x1d')]);}_0x2bad85[_0x4ff8('0x36')]=qs[_0x4ff8('0x37')](_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x37')]);_0x2bad85[_0x4ff8('0x38')]=qs['filters'](_[_0x4ff8('0x39')](_0x11a082[_0x4ff8('0x2d')],_0x18050a['filters']),_0x4eefb8);if(_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x3a')]){_0x2bad85[_0x4ff8('0x38')]=_['merge'](_0x2bad85[_0x4ff8('0x38')],{'$or':_[_0x4ff8('0x2c')](_0x4eefb8,function(_0x2f707a){if(_0x2f707a[_0x4ff8('0x2b')]!=='VIRTUAL'){var _0x3c2918={};_0x3c2918[_0x2f707a[_0x4ff8('0x27')]]={'$like':'%'+_0x11a082['query'][_0x4ff8('0x3a')]+'%'};return _0x3c2918;}})});}_0x2bad85=_['merge']({},_0x2bad85,_0x11a082[_0x4ff8('0x3b')]);var _0x5c120e={'where':_0x2bad85['where']};return db[_0x4ff8('0x3c')][_0x4ff8('0x3d')](_0x5c120e)[_0x4ff8('0x23')](function(_0x16dd57){_0x4b9af6['count']=_0x16dd57;if(_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x3e')]){_0x2bad85[_0x4ff8('0x3f')]=[{'all':!![]}];}return db[_0x4ff8('0x3c')][_0x4ff8('0x40')](_0x2bad85);})['then'](function(_0x17d256){_0x4b9af6['rows']=_0x17d256;return _0x4b9af6;})['then'](respondWithFilteredResult(_0x1497fa,_0x2bad85))[_0x4ff8('0x41')](handleError(_0x1497fa,null));};exports['show']=function(_0x19d5c8,_0x4a09c8){var _0x8caac2={'raw':!![],'where':{'id':_0x19d5c8[_0x4ff8('0x42')]['id']}},_0x4fe182={};_0x4fe182[_0x4ff8('0x30')]=_[_0x4ff8('0x43')](db[_0x4ff8('0x3c')][_0x4ff8('0x29')]);_0x4fe182['query']=_[_0x4ff8('0x43')](_0x19d5c8['query']);_0x4fe182[_0x4ff8('0x2e')]=_[_0x4ff8('0x2f')](_0x4fe182[_0x4ff8('0x30')],_0x4fe182[_0x4ff8('0x2d')]);_0x8caac2[_0x4ff8('0x31')]=_[_0x4ff8('0x2f')](_0x4fe182['model'],qs['fields'](_0x19d5c8[_0x4ff8('0x2d')][_0x4ff8('0x32')]));_0x8caac2[_0x4ff8('0x31')]=_0x8caac2[_0x4ff8('0x31')][_0x4ff8('0x33')]?_0x8caac2[_0x4ff8('0x31')]:_0x4fe182['model'];if(_0x19d5c8[_0x4ff8('0x2d')][_0x4ff8('0x3e')]){_0x8caac2[_0x4ff8('0x3f')]=[{'all':!![]}];}_0x8caac2=_['merge']({},_0x8caac2,_0x19d5c8[_0x4ff8('0x3b')]);return db[_0x4ff8('0x3c')]['find'](_0x8caac2)['then'](handleEntityNotFound(_0x4a09c8,null))[_0x4ff8('0x23')](respondWithResult(_0x4a09c8,null))[_0x4ff8('0x41')](handleError(_0x4a09c8,null));};exports['create']=function(_0x5213c1,_0x5ea1d0){return db[_0x4ff8('0x3c')][_0x4ff8('0x44')](_0x5213c1[_0x4ff8('0x45')],{})[_0x4ff8('0x23')](respondWithResult(_0x5ea1d0,0xc9))[_0x4ff8('0x41')](handleError(_0x5ea1d0,null));};exports[_0x4ff8('0x22')]=function(_0x390fa7,_0x1a5545){if(_0x390fa7[_0x4ff8('0x45')]['id']){delete _0x390fa7['body']['id'];}return db[_0x4ff8('0x3c')]['find']({'where':{'id':_0x390fa7[_0x4ff8('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a5545,null))[_0x4ff8('0x23')](saveUpdates(_0x390fa7[_0x4ff8('0x45')],null))[_0x4ff8('0x23')](respondWithResult(_0x1a5545,null))[_0x4ff8('0x41')](handleError(_0x1a5545,null));};exports['destroy']=function(_0x3d9b24,_0x24e56f){return db['SquareDetailsReport'][_0x4ff8('0x46')]({'where':{'id':_0x3d9b24[_0x4ff8('0x42')]['id']}})[_0x4ff8('0x23')](handleEntityNotFound(_0x24e56f,null))[_0x4ff8('0x23')](removeEntity(_0x24e56f,null))['catch'](handleError(_0x24e56f,null));};exports['describe']=function(_0x3d6642,_0x6d5a88){return db['SquareDetailsReport'][_0x4ff8('0x47')]()['then'](respondWithResult(_0x6d5a88,null))[_0x4ff8('0x41')](handleError(_0x6d5a88,null));}; \ No newline at end of file +var _0xd4d0=['fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','findAll','rows','catch','show','keys','rawAttributes','options','create','body','find','params','describe','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','SquareDetailsReport'];(function(_0x50f10b,_0x5a63a3){var _0xad3a10=function(_0xd319e4){while(--_0xd319e4){_0x50f10b['push'](_0x50f10b['shift']());}};_0xad3a10(++_0x5a63a3);}(_0xd4d0,0x6d));var _0x0d4d=function(_0x1b4be7,_0x4a1038){_0x1b4be7=_0x1b4be7-0x0;var _0xe0ffb4=_0xd4d0[_0x1b4be7];return _0xe0ffb4;};'use strict';var pdf=require(_0x0d4d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0d4d('0x1'));var zipdir=require(_0x0d4d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d4d('0x3'));var BPromise=require(_0x0d4d('0x4'));var Mustache=require(_0x0d4d('0x5'));var util=require('util');var path=require(_0x0d4d('0x6'));var sox=require(_0x0d4d('0x7'));var csv=require(_0x0d4d('0x8'));var ejs=require(_0x0d4d('0x9'));var fs=require('fs');var _=require(_0x0d4d('0xa'));var squel=require(_0x0d4d('0xb'));var crypto=require(_0x0d4d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0d4d('0xd'));var toCsv=require(_0x0d4d('0x8'));var querystring=require(_0x0d4d('0xe'));var Papa=require(_0x0d4d('0xf'));var Redis=require('ioredis');var authService=require(_0x0d4d('0x10'));var qs=require(_0x0d4d('0x11'));var as=require(_0x0d4d('0x12'));var hardwareService=require(_0x0d4d('0x13'));var logger=require(_0x0d4d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0d4d('0x15'));var licenseUtil=require(_0x0d4d('0x16'));var db=require(_0x0d4d('0x17'))['db'];function respondWithStatusCode(_0x22cfa4,_0x4155e8){_0x4155e8=_0x4155e8||0xcc;return function(_0x23edbb){if(_0x23edbb){return _0x22cfa4['sendStatus'](_0x4155e8);}return _0x22cfa4['status'](_0x4155e8)[_0x0d4d('0x18')]();};}function respondWithResult(_0x4b8014,_0x1ae4f0){_0x1ae4f0=_0x1ae4f0||0xc8;return function(_0x519d46){if(_0x519d46){return _0x4b8014[_0x0d4d('0x19')](_0x1ae4f0)[_0x0d4d('0x1a')](_0x519d46);}};}function respondWithFilteredResult(_0x4abf96,_0x4ea7a9){return function(_0x407b85){if(_0x407b85){var _0x588827=_0x407b85['count'],_0x3e5494=_0x4ea7a9[_0x0d4d('0x1b')],_0x3269b1=_0x4ea7a9['offset']+_0x4ea7a9['limit'],_0x333ac0;if(_0x3269b1>=_0x588827){_0x3269b1=_0x588827;_0x333ac0=0xc8;}else{_0x333ac0=0xce;}_0x4abf96[_0x0d4d('0x19')](_0x333ac0);return _0x4abf96[_0x0d4d('0x1c')](_0x0d4d('0x1d'),_0x3e5494+'-'+_0x3269b1+'/'+_0x588827)[_0x0d4d('0x1a')](_0x407b85);}return null;};}function patchUpdates(_0x150440){return function(_0x2cdf4c){try{jsonpatch[_0x0d4d('0x1e')](_0x2cdf4c,_0x150440,!![]);}catch(_0x1e121a){return BPromise[_0x0d4d('0x1f')](_0x1e121a);}return _0x2cdf4c[_0x0d4d('0x20')]();};}function saveUpdates(_0x4cc74f,_0x40d012){return function(_0x2327d5){if(_0x2327d5){return _0x2327d5[_0x0d4d('0x21')](_0x4cc74f)[_0x0d4d('0x22')](function(_0x3f98c1){return _0x3f98c1;});}return null;};}function removeEntity(_0x19a0b3,_0x2216c2){return function(_0x5c0b1a){if(_0x5c0b1a){return _0x5c0b1a['destroy']()['then'](function(){_0x19a0b3[_0x0d4d('0x19')](0xcc)[_0x0d4d('0x18')]();});}};}function handleEntityNotFound(_0x213ae1,_0x5ca142){return function(_0x26a3fa){if(!_0x26a3fa){_0x213ae1['sendStatus'](0x194);}return _0x26a3fa;};}function handleError(_0x31beb8,_0x2a5026){_0x2a5026=_0x2a5026||0x1f4;return function(_0x268e11){logger[_0x0d4d('0x23')](_0x268e11['stack']);if(_0x268e11[_0x0d4d('0x24')]){delete _0x268e11['name'];}_0x31beb8[_0x0d4d('0x19')](_0x2a5026)[_0x0d4d('0x25')](_0x268e11);};}exports[_0x0d4d('0x26')]=function(_0xa05c38,_0x2f07b7){var _0x298373={},_0xb09cb1={},_0x18b01a={'count':0x0,'rows':[]};var _0x5abfe3=_[_0x0d4d('0x27')](db[_0x0d4d('0x28')]['rawAttributes'],function(_0x10cbaa){return{'name':_0x10cbaa[_0x0d4d('0x29')],'type':_0x10cbaa[_0x0d4d('0x2a')][_0x0d4d('0x2b')]};});_0xb09cb1[_0x0d4d('0x2c')]=_['map'](_0x5abfe3,'name');_0xb09cb1[_0x0d4d('0x2d')]=_['keys'](_0xa05c38[_0x0d4d('0x2d')]);_0xb09cb1[_0x0d4d('0x2e')]=_[_0x0d4d('0x2f')](_0xb09cb1[_0x0d4d('0x2c')],_0xb09cb1[_0x0d4d('0x2d')]);_0x298373[_0x0d4d('0x30')]=_[_0x0d4d('0x2f')](_0xb09cb1['model'],qs['fields'](_0xa05c38[_0x0d4d('0x2d')][_0x0d4d('0x31')]));_0x298373['attributes']=_0x298373[_0x0d4d('0x30')][_0x0d4d('0x32')]?_0x298373['attributes']:_0xb09cb1[_0x0d4d('0x2c')];if(!_0xa05c38[_0x0d4d('0x2d')][_0x0d4d('0x33')](_0x0d4d('0x34'))){_0x298373[_0x0d4d('0x35')]=qs[_0x0d4d('0x35')](_0xa05c38[_0x0d4d('0x2d')][_0x0d4d('0x35')]);_0x298373['offset']=qs[_0x0d4d('0x1b')](_0xa05c38['query']['offset']);}_0x298373[_0x0d4d('0x36')]=qs[_0x0d4d('0x37')](_0xa05c38[_0x0d4d('0x2d')][_0x0d4d('0x37')]);_0x298373[_0x0d4d('0x38')]=qs['filters'](_[_0x0d4d('0x39')](_0xa05c38[_0x0d4d('0x2d')],_0xb09cb1['filters']),_0x5abfe3);if(_0xa05c38[_0x0d4d('0x2d')][_0x0d4d('0x3a')]){_0x298373[_0x0d4d('0x38')]=_['merge'](_0x298373[_0x0d4d('0x38')],{'$or':_['map'](_0x5abfe3,function(_0x3ff9ff){if(_0x3ff9ff[_0x0d4d('0x2a')]!==_0x0d4d('0x3b')){var _0x1b0f56={};_0x1b0f56[_0x3ff9ff['name']]={'$like':'%'+_0xa05c38[_0x0d4d('0x2d')][_0x0d4d('0x3a')]+'%'};return _0x1b0f56;}})});}_0x298373=_[_0x0d4d('0x3c')]({},_0x298373,_0xa05c38['options']);var _0x58c397={'where':_0x298373[_0x0d4d('0x38')]};return db[_0x0d4d('0x28')][_0x0d4d('0x3d')](_0x58c397)[_0x0d4d('0x22')](function(_0x46493c){_0x18b01a[_0x0d4d('0x3d')]=_0x46493c;if(_0xa05c38['query'][_0x0d4d('0x3e')]){_0x298373['include']=[{'all':!![]}];}return db[_0x0d4d('0x28')][_0x0d4d('0x3f')](_0x298373);})[_0x0d4d('0x22')](function(_0x330c2e){_0x18b01a[_0x0d4d('0x40')]=_0x330c2e;return _0x18b01a;})[_0x0d4d('0x22')](respondWithFilteredResult(_0x2f07b7,_0x298373))[_0x0d4d('0x41')](handleError(_0x2f07b7,null));};exports[_0x0d4d('0x42')]=function(_0x5a9e74,_0x45a433){var _0x91063b={'raw':!![],'where':{'id':_0x5a9e74['params']['id']}},_0x3dd267={};_0x3dd267['model']=_[_0x0d4d('0x43')](db[_0x0d4d('0x28')][_0x0d4d('0x44')]);_0x3dd267[_0x0d4d('0x2d')]=_[_0x0d4d('0x43')](_0x5a9e74[_0x0d4d('0x2d')]);_0x3dd267[_0x0d4d('0x2e')]=_['intersection'](_0x3dd267[_0x0d4d('0x2c')],_0x3dd267[_0x0d4d('0x2d')]);_0x91063b[_0x0d4d('0x30')]=_['intersection'](_0x3dd267['model'],qs[_0x0d4d('0x31')](_0x5a9e74[_0x0d4d('0x2d')][_0x0d4d('0x31')]));_0x91063b[_0x0d4d('0x30')]=_0x91063b[_0x0d4d('0x30')]['length']?_0x91063b['attributes']:_0x3dd267[_0x0d4d('0x2c')];if(_0x5a9e74[_0x0d4d('0x2d')][_0x0d4d('0x3e')]){_0x91063b['include']=[{'all':!![]}];}_0x91063b=_['merge']({},_0x91063b,_0x5a9e74[_0x0d4d('0x45')]);return db[_0x0d4d('0x28')]['find'](_0x91063b)[_0x0d4d('0x22')](handleEntityNotFound(_0x45a433,null))[_0x0d4d('0x22')](respondWithResult(_0x45a433,null))[_0x0d4d('0x41')](handleError(_0x45a433,null));};exports[_0x0d4d('0x46')]=function(_0x29d3f3,_0x38e891){return db[_0x0d4d('0x28')][_0x0d4d('0x46')](_0x29d3f3[_0x0d4d('0x47')],{})['then'](respondWithResult(_0x38e891,0xc9))[_0x0d4d('0x41')](handleError(_0x38e891,null));};exports['update']=function(_0x1704af,_0x46d378){if(_0x1704af['body']['id']){delete _0x1704af['body']['id'];}return db['SquareDetailsReport'][_0x0d4d('0x48')]({'where':{'id':_0x1704af[_0x0d4d('0x49')]['id']}})[_0x0d4d('0x22')](handleEntityNotFound(_0x46d378,null))[_0x0d4d('0x22')](saveUpdates(_0x1704af[_0x0d4d('0x47')],null))[_0x0d4d('0x22')](respondWithResult(_0x46d378,null))[_0x0d4d('0x41')](handleError(_0x46d378,null));};exports['destroy']=function(_0x44c0f0,_0x7107f1){return db[_0x0d4d('0x28')][_0x0d4d('0x48')]({'where':{'id':_0x44c0f0[_0x0d4d('0x49')]['id']}})[_0x0d4d('0x22')](handleEntityNotFound(_0x7107f1,null))[_0x0d4d('0x22')](removeEntity(_0x7107f1,null))[_0x0d4d('0x41')](handleError(_0x7107f1,null));};exports[_0x0d4d('0x4a')]=function(_0x4cee72,_0x59397f){return db[_0x0d4d('0x28')][_0x0d4d('0x4a')]()['then'](respondWithResult(_0x59397f,null))['catch'](handleError(_0x59397f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 1b17974..81b120e 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 _0x2b29=['path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','util','../../config/logger','api','moment','request-promise'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x2b29,0x163));var _0x92b2=function(_0x4feb1c,_0x44896e){_0x4feb1c=_0x4feb1c-0x0;var _0x3f807f=_0x2b29[_0x4feb1c];return _0x3f807f;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var logger=require(_0x92b2('0x1'))(_0x92b2('0x2'));var moment=require(_0x92b2('0x3'));var BPromise=require('bluebird');var rp=require(_0x92b2('0x4'));var fs=require('fs');var path=require(_0x92b2('0x5'));var rimraf=require(_0x92b2('0x6'));var config=require(_0x92b2('0x7'));var attributes=require(_0x92b2('0x8'));module[_0x92b2('0x9')]=function(_0x47c522,_0xb1d856){return _0x47c522['define'](_0x92b2('0xa'),attributes,{'tableName':_0x92b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea98=['lodash','util','../../config/logger','moment','request-promise','../../config/environment','./squareReportDetail.attributes','exports','define'];(function(_0x3f4389,_0x467751){var _0x45c73f=function(_0x2e9620){while(--_0x2e9620){_0x3f4389['push'](_0x3f4389['shift']());}};_0x45c73f(++_0x467751);}(_0xea98,0x19e));var _0x8ea9=function(_0x307a28,_0x2bdd9f){_0x307a28=_0x307a28-0x0;var _0x523ac7=_0xea98[_0x307a28];return _0x523ac7;};'use strict';var _=require(_0x8ea9('0x0'));var util=require(_0x8ea9('0x1'));var logger=require(_0x8ea9('0x2'))('api');var moment=require(_0x8ea9('0x3'));var BPromise=require('bluebird');var rp=require(_0x8ea9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8ea9('0x5'));var attributes=require(_0x8ea9('0x6'));module[_0x8ea9('0x7')]=function(_0x2e88a5,_0x16b009){return _0x2e88a5[_0x8ea9('0x8')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 80b2b55..f3d1c36 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 _0x9919=['then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SquareDetailsReport','create','body','options','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x18e815,_0x171312){var _0x3ae01b=function(_0x1b5e55){while(--_0x1b5e55){_0x18e815['push'](_0x18e815['shift']());}};_0x3ae01b(++_0x171312);}(_0x9919,0x13c));var _0x9991=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x9919[_0x1e6db3];return _0x1de886;};'use strict';var _=require(_0x9991('0x0'));var util=require(_0x9991('0x1'));var moment=require(_0x9991('0x2'));var BPromise=require(_0x9991('0x3'));var rs=require(_0x9991('0x4'));var fs=require('fs');var Redis=require(_0x9991('0x5'));var db=require(_0x9991('0x6'))['db'];var utils=require(_0x9991('0x7'));var logger=require(_0x9991('0x8'))(_0x9991('0x9'));var config=require('../../config/environment');var jayson=require(_0x9991('0xa'));var client=jayson[_0x9991('0xb')][_0x9991('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5845b4,_0x3052e2,_0x16de71){return new BPromise(function(_0x286720,_0x2e10f7){return client[_0x9991('0xd')](_0x5845b4,_0x16de71)[_0x9991('0xe')](function(_0x39b336){logger[_0x9991('0xf')](_0x9991('0x10'),_0x3052e2,_0x9991('0x11'));logger[_0x9991('0x12')](_0x9991('0x13'),_0x3052e2,_0x9991('0x11'),JSON[_0x9991('0x14')](_0x39b336));if(_0x39b336[_0x9991('0x15')]){if(_0x39b336[_0x9991('0x15')][_0x9991('0x16')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x3052e2,_0x39b336[_0x9991('0x15')][_0x9991('0x17')]);return _0x2e10f7(_0x39b336[_0x9991('0x15')][_0x9991('0x17')]);}logger[_0x9991('0x15')](_0x9991('0x10'),_0x3052e2,_0x39b336[_0x9991('0x15')]['message']);return _0x286720(_0x39b336[_0x9991('0x15')][_0x9991('0x17')]);}else{logger['info'](_0x9991('0x10'),_0x3052e2,_0x9991('0x11'));_0x286720(_0x39b336['result'][_0x9991('0x17')]);}})[_0x9991('0x18')](function(_0x1c6ce8){logger[_0x9991('0x15')](_0x9991('0x10'),_0x3052e2,_0x1c6ce8);_0x2e10f7(_0x1c6ce8);});});}exports['CreateSquareDetailsReport']=function(_0x55d7a7){var _0x534575=this;return new Promise(function(_0x1e3b76,_0x5127b3){return db[_0x9991('0x19')][_0x9991('0x1a')](_0x55d7a7[_0x9991('0x1b')],{'raw':_0x55d7a7[_0x9991('0x1c')]?_0x55d7a7[_0x9991('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x50f809){logger[_0x9991('0xf')](_0x9991('0x1d'),_0x55d7a7);logger[_0x9991('0x12')](_0x9991('0x1d'),_0x55d7a7,JSON[_0x9991('0x14')](_0x50f809));_0x1e3b76(_0x50f809);})['catch'](function(_0x43cd00){logger[_0x9991('0x15')](_0x9991('0x1d'),_0x43cd00[_0x9991('0x17')],_0x55d7a7);_0x5127b3(_0x534575[_0x9991('0x15')](0x1f4,_0x43cd00[_0x9991('0x17')]));});});}; \ No newline at end of file +var _0xe73e=['request','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3ca83c,_0x83a924){var _0x58098b=function(_0x25e8f2){while(--_0x25e8f2){_0x3ca83c['push'](_0x3ca83c['shift']());}};_0x58098b(++_0x83a924);}(_0xe73e,0x98));var _0xee73=function(_0x186e73,_0x131b47){_0x186e73=_0x186e73-0x0;var _0x489505=_0xe73e[_0x186e73];return _0x489505;};'use strict';var _=require(_0xee73('0x0'));var util=require(_0xee73('0x1'));var moment=require(_0xee73('0x2'));var BPromise=require(_0xee73('0x3'));var rs=require(_0xee73('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee73('0x5'));var logger=require(_0xee73('0x6'))(_0xee73('0x7'));var config=require(_0xee73('0x8'));var jayson=require(_0xee73('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x96dc90,_0x266574,_0x3bb18e){return new BPromise(function(_0x3520ff,_0x5b5c70){return client[_0xee73('0xa')](_0x96dc90,_0x3bb18e)[_0xee73('0xb')](function(_0x3ba84c){logger[_0xee73('0xc')](_0xee73('0xd'),_0x266574,'request\x20sent');logger['debug'](_0xee73('0xe'),_0x266574,_0xee73('0xf'),JSON[_0xee73('0x10')](_0x3ba84c));if(_0x3ba84c[_0xee73('0x11')]){if(_0x3ba84c[_0xee73('0x11')][_0xee73('0x12')]===0x1f4){logger[_0xee73('0x11')](_0xee73('0xd'),_0x266574,_0x3ba84c[_0xee73('0x11')][_0xee73('0x13')]);return _0x5b5c70(_0x3ba84c[_0xee73('0x11')][_0xee73('0x13')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x266574,_0x3ba84c[_0xee73('0x11')][_0xee73('0x13')]);return _0x3520ff(_0x3ba84c[_0xee73('0x11')][_0xee73('0x13')]);}else{logger[_0xee73('0xc')](_0xee73('0xd'),_0x266574,_0xee73('0xf'));_0x3520ff(_0x3ba84c[_0xee73('0x14')][_0xee73('0x13')]);}})[_0xee73('0x15')](function(_0x48933f){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x266574,_0x48933f);_0x5b5c70(_0x48933f);});});}exports['CreateSquareDetailsReport']=function(_0x593602){var _0x1526c0=this;return new Promise(function(_0x4e83c6,_0x57b447){return db[_0xee73('0x16')]['create'](_0x593602[_0xee73('0x17')],{'raw':_0x593602['options']?_0x593602[_0xee73('0x18')][_0xee73('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x37829c){logger[_0xee73('0xc')](_0xee73('0x1a'),_0x593602);logger['debug'](_0xee73('0x1a'),_0x593602,JSON[_0xee73('0x10')](_0x37829c));_0x4e83c6(_0x37829c);})['catch'](function(_0x45dba5){logger['error'](_0xee73('0x1a'),_0x45dba5[_0xee73('0x13')],_0x593602);_0x57b447(_0x1526c0['error'](0x1f4,_0x45dba5['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index ad25e1a..3c1e69f 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 _0x37a9=['/process/:pid/kill','killProcess','Router','../../components/auth/service','./system.controller','isAuthenticated','index','get'];(function(_0x3df356,_0x5948fc){var _0x81efeb=function(_0x1f78a0){while(--_0x1f78a0){_0x3df356['push'](_0x3df356['shift']());}};_0x81efeb(++_0x5948fc);}(_0x37a9,0x132));var _0x937a=function(_0x40ca2b,_0x3fa84f){_0x40ca2b=_0x40ca2b-0x0;var _0x990011=_0x37a9[_0x40ca2b];return _0x990011;};'use strict';var express=require('express');var router=express[_0x937a('0x0')]();var auth=require(_0x937a('0x1'));var controller=require(_0x937a('0x2'));router['get']('/',auth[_0x937a('0x3')](),controller[_0x937a('0x4')]);router[_0x937a('0x5')](_0x937a('0x6'),auth['isAuthenticated'](),controller[_0x937a('0x7')]);module['exports']=router; \ No newline at end of file +var _0x14ad=['./system.controller','get','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x14ad,0xc5));var _0xd14a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x14ad[_0x3b0731];return _0x4204d7;};'use strict';var express=require(_0xd14a('0x0'));var router=express[_0xd14a('0x1')]();var auth=require(_0xd14a('0x2'));var controller=require(_0xd14a('0x3'));router[_0xd14a('0x4')]('/',auth[_0xd14a('0x5')](),controller['index']);router['get']('/process/:pid/kill',auth[_0xd14a('0x5')](),controller[_0xd14a('0x6')]);module[_0xd14a('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 e0d9bfe..bcfe303 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 _0x4072=['split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','json','catch','killProcess','systeminformation','child_process','exec','util','bluebird','lodash','error','inspect','name','index','then','status','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid'];(function(_0x37687f,_0x577dcc){var _0x3853e0=function(_0x26ecfb){while(--_0x26ecfb){_0x37687f['push'](_0x37687f['shift']());}};_0x3853e0(++_0x577dcc);}(_0x4072,0x198));var _0x2407=function(_0x2467b8,_0x584199){_0x2467b8=_0x2467b8-0x0;var _0x5d3095=_0x4072[_0x2467b8];return _0x5d3095;};'use strict';var info=require(_0x2407('0x0'));var exec=require(_0x2407('0x1'))[_0x2407('0x2')];var logger=require('../../config/logger')('api');var util=require(_0x2407('0x3'));var BPromise=require(_0x2407('0x4'));var _=require(_0x2407('0x5'));function handleError(_0x42a9a6,_0x35986b,_0x3513da){_0x35986b=_0x35986b||0x1f4;return function(_0x1d27df){logger[_0x2407('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x3513da,_0x35986b,util[_0x2407('0x7')](_0x1d27df,{'showHidden':![],'depth':null}));delete _0x1d27df[_0x2407('0x8')];_0x42a9a6['status'](_0x35986b)['send'](_0x1d27df);};}exports[_0x2407('0x9')]=function(_0x35c9ee,_0x4c19c7){return info['getAllData']()[_0x2407('0xa')](function(_0x268d1e){return _0x4c19c7[_0x2407('0xb')](0xc8)['json'](_0x268d1e);})['catch'](function(_0x2d66d4){return _0x4c19c7[_0x2407('0xb')](0x1f4)['json'](_0x2d66d4);});};exports['killProcess']=function(_0x43d790,_0x430442){var _0x4bc7dc=[_0x2407('0xc')];return new BPromise(function(_0x4f627c,_0x102d41){return exec(util[_0x2407('0xd')](_0x2407('0xe'),_0x43d790[_0x2407('0xf')][_0x2407('0x10')]),function(_0x13edaa,_0x224d37,_0x3bd33f){if(_0x13edaa){return _0x102d41(_0x13edaa);}return _0x4f627c(_0x224d37);});})['then'](function(_0x52b564){var _0xdc2272=![];var _0x542387=_0x52b564[_0x2407('0x11')](/\n/);for(var _0x33c9a6=0x0,_0x5ee401=_0x4bc7dc[_0x2407('0x12')];_0x33c9a6<_0x5ee401,_0xdc2272===![];_0x33c9a6+=0x1){if(_0x52b564[_0x2407('0x13')](_0x4bc7dc[_0x33c9a6])>=0x0){_0xdc2272=!![];}}if(!_0xdc2272){throw new Error(util[_0x2407('0xd')](_0x2407('0x14'),_0x43d790[_0x2407('0xf')][_0x2407('0x10')]));}process['kill'](_0x43d790[_0x2407('0xf')][_0x2407('0x10')],_0x2407('0x15'));return _0x430442[_0x2407('0xb')](0xc8)[_0x2407('0x16')]({'message':util[_0x2407('0xd')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x43d790[_0x2407('0xf')][_0x2407('0x10')])});})[_0x2407('0x17')](handleError(_0x430442,null,_0x2407('0x18')));}; \ No newline at end of file +var _0xe6d9=['exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','status','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe6d9,0x1cf));var _0x9e6d=function(_0x223af8,_0x58016f){_0x223af8=_0x223af8-0x0;var _0x4699f=_0xe6d9[_0x223af8];return _0x4699f;};'use strict';var info=require(_0x9e6d('0x0'));var exec=require(_0x9e6d('0x1'))[_0x9e6d('0x2')];var logger=require(_0x9e6d('0x3'))(_0x9e6d('0x4'));var util=require(_0x9e6d('0x5'));var BPromise=require(_0x9e6d('0x6'));var _=require(_0x9e6d('0x7'));function handleError(_0x2fbe6e,_0x558e1a,_0x4d7a18){_0x558e1a=_0x558e1a||0x1f4;return function(_0x4b384e){logger[_0x9e6d('0x8')](_0x9e6d('0x9'),_0x4d7a18,_0x558e1a,util[_0x9e6d('0xa')](_0x4b384e,{'showHidden':![],'depth':null}));delete _0x4b384e[_0x9e6d('0xb')];_0x2fbe6e['status'](_0x558e1a)[_0x9e6d('0xc')](_0x4b384e);};}exports[_0x9e6d('0xd')]=function(_0x58d946,_0x5b036f){return info[_0x9e6d('0xe')]()['then'](function(_0x29bb8b){return _0x5b036f[_0x9e6d('0xf')](0xc8)[_0x9e6d('0x10')](_0x29bb8b);})[_0x9e6d('0x11')](function(_0x3cfcd7){return _0x5b036f[_0x9e6d('0xf')](0x1f4)['json'](_0x3cfcd7);});};exports['killProcess']=function(_0x1bc088,_0x2b0d88){var _0x5366cd=[_0x9e6d('0x12')];return new BPromise(function(_0x18ab41,_0x595e59){return exec(util[_0x9e6d('0x13')](_0x9e6d('0x14'),_0x1bc088['params']['pid']),function(_0x32813c,_0x35f243,_0x1b793f){if(_0x32813c){return _0x595e59(_0x32813c);}return _0x18ab41(_0x35f243);});})[_0x9e6d('0x15')](function(_0x48ad9e){var _0x4cef8a=![];var _0x12e307=_0x48ad9e[_0x9e6d('0x16')](/\n/);for(var _0x1d7fd9=0x0,_0x10abd7=_0x5366cd[_0x9e6d('0x17')];_0x1d7fd9<_0x10abd7,_0x4cef8a===![];_0x1d7fd9+=0x1){if(_0x48ad9e[_0x9e6d('0x18')](_0x5366cd[_0x1d7fd9])>=0x0){_0x4cef8a=!![];}}if(!_0x4cef8a){throw new Error(util['format'](_0x9e6d('0x19'),_0x1bc088[_0x9e6d('0x1a')][_0x9e6d('0x1b')]));}process[_0x9e6d('0x1c')](_0x1bc088['params']['pid'],_0x9e6d('0x1d'));return _0x2b0d88['status'](0xc8)[_0x9e6d('0x10')]({'message':util[_0x9e6d('0x13')](_0x9e6d('0x1e'),_0x1bc088[_0x9e6d('0x1a')][_0x9e6d('0x1b')])});})[_0x9e6d('0x11')](handleError(_0x2b0d88,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a50092a..57519ab 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 _0xbec5=['isAuthenticated','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./tag.controller','get'];(function(_0x3ab8dc,_0xd40762){var _0x1e9ad8=function(_0x1b82ea){while(--_0x1b82ea){_0x3ab8dc['push'](_0x3ab8dc['shift']());}};_0x1e9ad8(++_0xd40762);}(_0xbec5,0xe5));var _0x5bec=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0xbec5[_0x38a3d6];return _0x3768d7;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require('../../config/environment');var controller=require(_0x5bec('0x7'));router[_0x5bec('0x8')]('/',auth[_0x5bec('0x9')](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xb')]);router[_0x5bec('0xc')]('/',auth[_0x5bec('0x9')](),controller[_0x5bec('0xd')]);router[_0x5bec('0xe')]('/:id',auth[_0x5bec('0x9')](),controller['update']);router[_0x5bec('0xf')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller['destroy']);module[_0x5bec('0x10')]=router; \ No newline at end of file +var _0x2dae=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x46e3aa,_0x419ea6){var _0x366388=function(_0x1e0e18){while(--_0x1e0e18){_0x46e3aa['push'](_0x46e3aa['shift']());}};_0x366388(++_0x419ea6);}(_0x2dae,0xc3));var _0xe2da=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2dae[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var auth=require(_0xe2da('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe2da('0x6'));var controller=require(_0xe2da('0x7'));router[_0xe2da('0x8')]('/',auth[_0xe2da('0x9')](),controller['index']);router[_0xe2da('0x8')](_0xe2da('0xa'),auth[_0xe2da('0x9')](),controller[_0xe2da('0xb')]);router[_0xe2da('0xc')]('/',auth[_0xe2da('0x9')](),controller[_0xe2da('0xd')]);router[_0xe2da('0xe')](_0xe2da('0xa'),auth['isAuthenticated'](),controller[_0xe2da('0xf')]);router[_0xe2da('0x10')](_0xe2da('0xa'),auth[_0xe2da('0x9')](),controller[_0xe2da('0x11')]);module[_0xe2da('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 7f7461f..2a78306 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 _0x878f=['STRING','name','#0091EA','exports'];(function(_0x50c505,_0x13b7ce){var _0x2e2ca8=function(_0x38b0dd){while(--_0x38b0dd){_0x50c505['push'](_0x50c505['shift']());}};_0x2e2ca8(++_0x13b7ce);}(_0x878f,0x173));var _0xf878=function(_0x2293eb,_0x4f2cfd){_0x2293eb=_0x2293eb-0x0;var _0x1311bd=_0x878f[_0x2293eb];return _0x1311bd;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'name':{'type':Sequelize[_0xf878('0x1')],'unique':_0xf878('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x3')},'description':{'type':Sequelize[_0xf878('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x355876,_0x38f77b){var _0x98869b=function(_0x215bbb){while(--_0x215bbb){_0x355876['push'](_0x355876['shift']());}};_0x98869b(++_0x38f77b);}(_0x757a,0xde));var _0xa757=function(_0x2e86c6,_0x5cb535){_0x2e86c6=_0x2e86c6-0x0;var _0x9b065f=_0x757a[_0x2e86c6];return _0x9b065f;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xa757('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 4c66774..e020fb5 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 _0x8338=['crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','update','then','destroy','get','end','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','lodash','squel'];(function(_0x4f998e,_0x19e487){var _0xec46f5=function(_0x4fd248){while(--_0x4fd248){_0x4f998e['push'](_0x4f998e['shift']());}};_0xec46f5(++_0x19e487);}(_0x8338,0x140));var _0x8833=function(_0x4e1518,_0x414afa){_0x4e1518=_0x4e1518-0x0;var _0x464071=_0x8338[_0x4e1518];return _0x464071;};'use strict';var pdf=require(_0x8833('0x0'));var emlformat=require(_0x8833('0x1'));var rimraf=require(_0x8833('0x2'));var zipdir=require(_0x8833('0x3'));var jsonpatch=require(_0x8833('0x4'));var rp=require(_0x8833('0x5'));var moment=require('moment');var BPromise=require(_0x8833('0x6'));var Mustache=require(_0x8833('0x7'));var util=require(_0x8833('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8833('0x9'));var fs=require('fs');var _=require(_0x8833('0xa'));var squel=require(_0x8833('0xb'));var crypto=require(_0x8833('0xc'));var jsforce=require(_0x8833('0xd'));var deskjs=require(_0x8833('0xe'));var toCsv=require(_0x8833('0xf'));var querystring=require('querystring');var Papa=require(_0x8833('0x10'));var Redis=require('ioredis');var authService=require(_0x8833('0x11'));var qs=require(_0x8833('0x12'));var as=require(_0x8833('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8833('0x14'))(_0x8833('0x15'));var utils=require(_0x8833('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8833('0x17'))['db'];function respondWithStatusCode(_0x1335da,_0x14edbf){_0x14edbf=_0x14edbf||0xcc;return function(_0x121947){if(_0x121947){return _0x1335da[_0x8833('0x18')](_0x14edbf);}return _0x1335da[_0x8833('0x19')](_0x14edbf)['end']();};}function respondWithResult(_0x49cf91,_0x3064a5){_0x3064a5=_0x3064a5||0xc8;return function(_0x5e82db){if(_0x5e82db){return _0x49cf91[_0x8833('0x19')](_0x3064a5)[_0x8833('0x1a')](_0x5e82db);}};}function respondWithFilteredResult(_0x54aa6f,_0x4c1e7c){return function(_0x459946){if(_0x459946){var _0x298ab5=_0x459946['count'],_0x3de82a=_0x4c1e7c[_0x8833('0x1b')],_0x39c525=_0x4c1e7c[_0x8833('0x1b')]+_0x4c1e7c[_0x8833('0x1c')],_0x33e86c;if(_0x39c525>=_0x298ab5){_0x39c525=_0x298ab5;_0x33e86c=0xc8;}else{_0x33e86c=0xce;}_0x54aa6f[_0x8833('0x19')](_0x33e86c);return _0x54aa6f[_0x8833('0x1d')]('Content-Range',_0x3de82a+'-'+_0x39c525+'/'+_0x298ab5)[_0x8833('0x1a')](_0x459946);}return null;};}function patchUpdates(_0x44d2e9){return function(_0x571ca3){try{jsonpatch[_0x8833('0x1e')](_0x571ca3,_0x44d2e9,!![]);}catch(_0x3269d0){return BPromise[_0x8833('0x1f')](_0x3269d0);}return _0x571ca3['save']();};}function saveUpdates(_0x31dcac,_0x449b6e){return function(_0xc1eb17){if(_0xc1eb17){return _0xc1eb17[_0x8833('0x20')](_0x31dcac)[_0x8833('0x21')](function(_0x3c2a4a){return _0x3c2a4a;});}return null;};}function removeEntity(_0x3d06f2,_0x204167){return function(_0x542961){if(_0x542961){return _0x542961[_0x8833('0x22')]()[_0x8833('0x21')](function(){var _0x410856=_0x542961[_0x8833('0x23')]({'plain':!![]});var _0x55f6ed='Tags';return db['UserProfileResource'][_0x8833('0x22')]({'where':{'type':_0x55f6ed,'resourceId':_0x410856['id']}})[_0x8833('0x21')](function(){return _0x542961;});})[_0x8833('0x21')](function(){_0x3d06f2['status'](0xcc)[_0x8833('0x24')]();});}};}function handleEntityNotFound(_0x18b0c2,_0x1d4613){return function(_0x1112d2){if(!_0x1112d2){_0x18b0c2['sendStatus'](0x194);}return _0x1112d2;};}function handleError(_0x2f6500,_0x5b503a){_0x5b503a=_0x5b503a||0x1f4;return function(_0x3d4cc9){logger[_0x8833('0x25')](_0x3d4cc9[_0x8833('0x26')]);if(_0x3d4cc9[_0x8833('0x27')]){delete _0x3d4cc9[_0x8833('0x27')];}_0x2f6500[_0x8833('0x19')](_0x5b503a)['send'](_0x3d4cc9);};}exports[_0x8833('0x28')]=function(_0x414c12,_0x479f77){var _0x4f5e63={},_0x2a1201={},_0x225801={'count':0x0,'rows':[]};var _0x1e796a=_[_0x8833('0x29')](db[_0x8833('0x2a')][_0x8833('0x2b')],function(_0x5f53ee){return{'name':_0x5f53ee[_0x8833('0x2c')],'type':_0x5f53ee[_0x8833('0x2d')][_0x8833('0x2e')]};});_0x2a1201[_0x8833('0x2f')]=_[_0x8833('0x29')](_0x1e796a,'name');_0x2a1201[_0x8833('0x30')]=_[_0x8833('0x31')](_0x414c12[_0x8833('0x30')]);_0x2a1201[_0x8833('0x32')]=_[_0x8833('0x33')](_0x2a1201['model'],_0x2a1201[_0x8833('0x30')]);_0x4f5e63['attributes']=_[_0x8833('0x33')](_0x2a1201[_0x8833('0x2f')],qs[_0x8833('0x34')](_0x414c12[_0x8833('0x30')][_0x8833('0x34')]));_0x4f5e63[_0x8833('0x35')]=_0x4f5e63['attributes'][_0x8833('0x36')]?_0x4f5e63['attributes']:_0x2a1201[_0x8833('0x2f')];if(!_0x414c12[_0x8833('0x30')][_0x8833('0x37')](_0x8833('0x38'))){_0x4f5e63[_0x8833('0x1c')]=qs[_0x8833('0x1c')](_0x414c12[_0x8833('0x30')][_0x8833('0x1c')]);_0x4f5e63[_0x8833('0x1b')]=qs[_0x8833('0x1b')](_0x414c12[_0x8833('0x30')][_0x8833('0x1b')]);}_0x4f5e63[_0x8833('0x39')]=qs[_0x8833('0x3a')](_0x414c12[_0x8833('0x30')][_0x8833('0x3a')]);_0x4f5e63[_0x8833('0x3b')]=qs[_0x8833('0x32')](_['pick'](_0x414c12['query'],_0x2a1201[_0x8833('0x32')]),_0x1e796a);if(_0x414c12[_0x8833('0x30')][_0x8833('0x3c')]){_0x4f5e63['where']=_[_0x8833('0x3d')](_0x4f5e63[_0x8833('0x3b')],{'$or':_[_0x8833('0x29')](_0x1e796a,function(_0xa4686e){if(_0xa4686e['type']!==_0x8833('0x3e')){var _0x26b452={};_0x26b452[_0xa4686e[_0x8833('0x27')]]={'$like':'%'+_0x414c12[_0x8833('0x30')][_0x8833('0x3c')]+'%'};return _0x26b452;}})});}_0x4f5e63=_[_0x8833('0x3d')]({},_0x4f5e63,_0x414c12['options']);var _0x5294be={'where':_0x4f5e63['where']};return db[_0x8833('0x2a')]['count'](_0x5294be)[_0x8833('0x21')](function(_0x1b4732){_0x225801[_0x8833('0x3f')]=_0x1b4732;if(_0x414c12[_0x8833('0x30')][_0x8833('0x40')]){_0x4f5e63[_0x8833('0x41')]=[{'all':!![]}];}return db[_0x8833('0x2a')][_0x8833('0x42')](_0x4f5e63);})[_0x8833('0x21')](function(_0x566ad9){_0x225801[_0x8833('0x43')]=_0x566ad9;return _0x225801;})[_0x8833('0x21')](respondWithFilteredResult(_0x479f77,_0x4f5e63))[_0x8833('0x44')](handleError(_0x479f77,null));};exports[_0x8833('0x45')]=function(_0x3ea5ca,_0x4df85a){var _0x1f35e3={'raw':!![],'where':{'id':_0x3ea5ca['params']['id']}},_0x5ee8ff={};_0x5ee8ff[_0x8833('0x2f')]=_[_0x8833('0x31')](db[_0x8833('0x2a')][_0x8833('0x2b')]);_0x5ee8ff[_0x8833('0x30')]=_[_0x8833('0x31')](_0x3ea5ca[_0x8833('0x30')]);_0x5ee8ff[_0x8833('0x32')]=_[_0x8833('0x33')](_0x5ee8ff[_0x8833('0x2f')],_0x5ee8ff[_0x8833('0x30')]);_0x1f35e3[_0x8833('0x35')]=_[_0x8833('0x33')](_0x5ee8ff[_0x8833('0x2f')],qs[_0x8833('0x34')](_0x3ea5ca[_0x8833('0x30')][_0x8833('0x34')]));_0x1f35e3['attributes']=_0x1f35e3['attributes']['length']?_0x1f35e3[_0x8833('0x35')]:_0x5ee8ff['model'];if(_0x3ea5ca['query'][_0x8833('0x40')]){_0x1f35e3[_0x8833('0x41')]=[{'all':!![]}];}_0x1f35e3=_[_0x8833('0x3d')]({},_0x1f35e3,_0x3ea5ca['options']);return db[_0x8833('0x2a')][_0x8833('0x46')](_0x1f35e3)[_0x8833('0x21')](handleEntityNotFound(_0x4df85a,null))[_0x8833('0x21')](respondWithResult(_0x4df85a,null))[_0x8833('0x44')](handleError(_0x4df85a,null));};exports[_0x8833('0x47')]=function(_0x3d3f12,_0x313cc4){return db[_0x8833('0x2a')][_0x8833('0x47')](_0x3d3f12[_0x8833('0x48')],{})[_0x8833('0x21')](function(_0x5f004e){var _0x3ecbe9=_0x3d3f12[_0x8833('0x49')][_0x8833('0x23')]({'plain':!![]});if(!_0x3ecbe9)throw new Error(_0x8833('0x4a'));if(_0x3ecbe9[_0x8833('0x4b')]===_0x8833('0x49')){var _0x51ece1=_0x5f004e[_0x8833('0x23')]({'plain':!![]});var _0x3c64ae=_0x8833('0x4c');return db[_0x8833('0x4d')][_0x8833('0x46')]({'where':{'name':_0x3c64ae,'userProfileId':_0x3ecbe9[_0x8833('0x4e')]},'raw':!![]})['then'](function(_0x131e07){if(_0x131e07&&_0x131e07[_0x8833('0x4f')]===0x0){return db[_0x8833('0x50')][_0x8833('0x47')]({'name':_0x51ece1[_0x8833('0x27')],'resourceId':_0x51ece1['id'],'type':_0x131e07[_0x8833('0x27')],'sectionId':_0x131e07['id']},{})[_0x8833('0x21')](function(){return _0x5f004e;});}else{return _0x5f004e;}})[_0x8833('0x44')](function(_0x26b1ab){logger[_0x8833('0x25')](_0x8833('0x51'),_0x26b1ab);throw _0x26b1ab;});}return _0x5f004e;})[_0x8833('0x21')](respondWithResult(_0x313cc4,0xc9))[_0x8833('0x44')](handleError(_0x313cc4,null));};exports[_0x8833('0x20')]=function(_0x55c46b,_0x48d783){if(_0x55c46b[_0x8833('0x48')]['id']){delete _0x55c46b[_0x8833('0x48')]['id'];}return db[_0x8833('0x2a')][_0x8833('0x46')]({'where':{'id':_0x55c46b[_0x8833('0x52')]['id']}})['then'](handleEntityNotFound(_0x48d783,null))['then'](saveUpdates(_0x55c46b[_0x8833('0x48')],null))[_0x8833('0x21')](respondWithResult(_0x48d783,null))[_0x8833('0x44')](handleError(_0x48d783,null));};exports['destroy']=function(_0x23b60c,_0x5befd5){return db['Tag'][_0x8833('0x46')]({'where':{'id':_0x23b60c[_0x8833('0x52')]['id']}})[_0x8833('0x21')](handleEntityNotFound(_0x5befd5,null))['then'](removeEntity(_0x5befd5,null))['catch'](handleError(_0x5befd5,null));}; \ No newline at end of file +var _0xb73e=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','then','destroy','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','get','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis'];(function(_0x46c1d5,_0x5ca335){var _0x40fe7b=function(_0x34cb99){while(--_0x34cb99){_0x46c1d5['push'](_0x46c1d5['shift']());}};_0x40fe7b(++_0x5ca335);}(_0xb73e,0x17b));var _0xeb73=function(_0xf089ad,_0x2123de){_0xf089ad=_0xf089ad-0x0;var _0x3b3a86=_0xb73e[_0xf089ad];return _0x3b3a86;};'use strict';var pdf=require(_0xeb73('0x0'));var emlformat=require(_0xeb73('0x1'));var rimraf=require(_0xeb73('0x2'));var zipdir=require(_0xeb73('0x3'));var jsonpatch=require(_0xeb73('0x4'));var rp=require(_0xeb73('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeb73('0x6'));var path=require(_0xeb73('0x7'));var sox=require('sox');var csv=require(_0xeb73('0x8'));var ejs=require(_0xeb73('0x9'));var fs=require('fs');var _=require(_0xeb73('0xa'));var squel=require(_0xeb73('0xb'));var crypto=require(_0xeb73('0xc'));var jsforce=require(_0xeb73('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeb73('0x8'));var querystring=require(_0xeb73('0xe'));var Papa=require('papaparse');var Redis=require(_0xeb73('0xf'));var authService=require(_0xeb73('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xeb73('0x11'));var hardwareService=require(_0xeb73('0x12'));var logger=require(_0xeb73('0x13'))(_0xeb73('0x14'));var utils=require(_0xeb73('0x15'));var config=require(_0xeb73('0x16'));var licenseUtil=require(_0xeb73('0x17'));var db=require(_0xeb73('0x18'))['db'];function respondWithStatusCode(_0x31bab4,_0x266e67){_0x266e67=_0x266e67||0xcc;return function(_0x339459){if(_0x339459){return _0x31bab4[_0xeb73('0x19')](_0x266e67);}return _0x31bab4['status'](_0x266e67)[_0xeb73('0x1a')]();};}function respondWithResult(_0x109aa2,_0x311a90){_0x311a90=_0x311a90||0xc8;return function(_0x2c1eb8){if(_0x2c1eb8){return _0x109aa2[_0xeb73('0x1b')](_0x311a90)[_0xeb73('0x1c')](_0x2c1eb8);}};}function respondWithFilteredResult(_0x1f3107,_0x3edd16){return function(_0x233e05){if(_0x233e05){var _0x49bfb4=_0x233e05[_0xeb73('0x1d')],_0x263bf7=_0x3edd16[_0xeb73('0x1e')],_0x2ec496=_0x3edd16[_0xeb73('0x1e')]+_0x3edd16[_0xeb73('0x1f')],_0x2dab09;if(_0x2ec496>=_0x49bfb4){_0x2ec496=_0x49bfb4;_0x2dab09=0xc8;}else{_0x2dab09=0xce;}_0x1f3107[_0xeb73('0x1b')](_0x2dab09);return _0x1f3107['set']('Content-Range',_0x263bf7+'-'+_0x2ec496+'/'+_0x49bfb4)[_0xeb73('0x1c')](_0x233e05);}return null;};}function patchUpdates(_0x1df75a){return function(_0x51187e){try{jsonpatch[_0xeb73('0x20')](_0x51187e,_0x1df75a,!![]);}catch(_0x263e94){return BPromise[_0xeb73('0x21')](_0x263e94);}return _0x51187e[_0xeb73('0x22')]();};}function saveUpdates(_0x102882,_0x3fd1f2){return function(_0x46f074){if(_0x46f074){return _0x46f074[_0xeb73('0x23')](_0x102882)[_0xeb73('0x24')](function(_0x4cc1e9){return _0x4cc1e9;});}return null;};}function removeEntity(_0x5ba222,_0x85712e){return function(_0x5bdb41){if(_0x5bdb41){return _0x5bdb41[_0xeb73('0x25')]()[_0xeb73('0x24')](function(){var _0x18957e=_0x5bdb41['get']({'plain':!![]});var _0x200720=_0xeb73('0x26');return db[_0xeb73('0x27')]['destroy']({'where':{'type':_0x200720,'resourceId':_0x18957e['id']}})[_0xeb73('0x24')](function(){return _0x5bdb41;});})[_0xeb73('0x24')](function(){_0x5ba222['status'](0xcc)[_0xeb73('0x1a')]();});}};}function handleEntityNotFound(_0x45776b,_0x36f9f4){return function(_0x158852){if(!_0x158852){_0x45776b[_0xeb73('0x19')](0x194);}return _0x158852;};}function handleError(_0x473a15,_0x16ce6a){_0x16ce6a=_0x16ce6a||0x1f4;return function(_0xa0ab5a){logger[_0xeb73('0x28')](_0xa0ab5a[_0xeb73('0x29')]);if(_0xa0ab5a[_0xeb73('0x2a')]){delete _0xa0ab5a['name'];}_0x473a15[_0xeb73('0x1b')](_0x16ce6a)[_0xeb73('0x2b')](_0xa0ab5a);};}exports[_0xeb73('0x2c')]=function(_0x5da173,_0x1529b){var _0x5ef8d7={},_0x1d2dd6={},_0x486638={'count':0x0,'rows':[]};var _0x317b27=_[_0xeb73('0x2d')](db[_0xeb73('0x2e')][_0xeb73('0x2f')],function(_0x3d24eb){return{'name':_0x3d24eb['fieldName'],'type':_0x3d24eb[_0xeb73('0x30')]['key']};});_0x1d2dd6['model']=_[_0xeb73('0x2d')](_0x317b27,'name');_0x1d2dd6[_0xeb73('0x31')]=_[_0xeb73('0x32')](_0x5da173[_0xeb73('0x31')]);_0x1d2dd6[_0xeb73('0x33')]=_[_0xeb73('0x34')](_0x1d2dd6[_0xeb73('0x35')],_0x1d2dd6[_0xeb73('0x31')]);_0x5ef8d7[_0xeb73('0x36')]=_[_0xeb73('0x34')](_0x1d2dd6[_0xeb73('0x35')],qs[_0xeb73('0x37')](_0x5da173[_0xeb73('0x31')][_0xeb73('0x37')]));_0x5ef8d7[_0xeb73('0x36')]=_0x5ef8d7['attributes'][_0xeb73('0x38')]?_0x5ef8d7['attributes']:_0x1d2dd6['model'];if(!_0x5da173[_0xeb73('0x31')][_0xeb73('0x39')]('nolimit')){_0x5ef8d7['limit']=qs[_0xeb73('0x1f')](_0x5da173['query'][_0xeb73('0x1f')]);_0x5ef8d7[_0xeb73('0x1e')]=qs[_0xeb73('0x1e')](_0x5da173['query'][_0xeb73('0x1e')]);}_0x5ef8d7[_0xeb73('0x3a')]=qs[_0xeb73('0x3b')](_0x5da173['query'][_0xeb73('0x3b')]);_0x5ef8d7[_0xeb73('0x3c')]=qs[_0xeb73('0x33')](_[_0xeb73('0x3d')](_0x5da173[_0xeb73('0x31')],_0x1d2dd6[_0xeb73('0x33')]),_0x317b27);if(_0x5da173[_0xeb73('0x31')][_0xeb73('0x3e')]){_0x5ef8d7[_0xeb73('0x3c')]=_[_0xeb73('0x3f')](_0x5ef8d7[_0xeb73('0x3c')],{'$or':_['map'](_0x317b27,function(_0x277b4c){if(_0x277b4c['type']!=='VIRTUAL'){var _0x4214fe={};_0x4214fe[_0x277b4c[_0xeb73('0x2a')]]={'$like':'%'+_0x5da173[_0xeb73('0x31')]['filter']+'%'};return _0x4214fe;}})});}_0x5ef8d7=_[_0xeb73('0x3f')]({},_0x5ef8d7,_0x5da173[_0xeb73('0x40')]);var _0x3f6644={'where':_0x5ef8d7[_0xeb73('0x3c')]};return db[_0xeb73('0x2e')]['count'](_0x3f6644)[_0xeb73('0x24')](function(_0x1b6880){_0x486638[_0xeb73('0x1d')]=_0x1b6880;if(_0x5da173[_0xeb73('0x31')][_0xeb73('0x41')]){_0x5ef8d7[_0xeb73('0x42')]=[{'all':!![]}];}return db[_0xeb73('0x2e')][_0xeb73('0x43')](_0x5ef8d7);})[_0xeb73('0x24')](function(_0x593ec0){_0x486638[_0xeb73('0x44')]=_0x593ec0;return _0x486638;})[_0xeb73('0x24')](respondWithFilteredResult(_0x1529b,_0x5ef8d7))[_0xeb73('0x45')](handleError(_0x1529b,null));};exports['show']=function(_0xd50d0a,_0x41395f){var _0x2ee935={'raw':!![],'where':{'id':_0xd50d0a[_0xeb73('0x46')]['id']}},_0x19a135={};_0x19a135['model']=_[_0xeb73('0x32')](db[_0xeb73('0x2e')][_0xeb73('0x2f')]);_0x19a135[_0xeb73('0x31')]=_[_0xeb73('0x32')](_0xd50d0a[_0xeb73('0x31')]);_0x19a135['filters']=_[_0xeb73('0x34')](_0x19a135[_0xeb73('0x35')],_0x19a135['query']);_0x2ee935['attributes']=_[_0xeb73('0x34')](_0x19a135[_0xeb73('0x35')],qs['fields'](_0xd50d0a[_0xeb73('0x31')]['fields']));_0x2ee935[_0xeb73('0x36')]=_0x2ee935['attributes'][_0xeb73('0x38')]?_0x2ee935['attributes']:_0x19a135['model'];if(_0xd50d0a['query'][_0xeb73('0x41')]){_0x2ee935[_0xeb73('0x42')]=[{'all':!![]}];}_0x2ee935=_[_0xeb73('0x3f')]({},_0x2ee935,_0xd50d0a[_0xeb73('0x40')]);return db[_0xeb73('0x2e')][_0xeb73('0x47')](_0x2ee935)[_0xeb73('0x24')](handleEntityNotFound(_0x41395f,null))['then'](respondWithResult(_0x41395f,null))[_0xeb73('0x45')](handleError(_0x41395f,null));};exports['create']=function(_0x18a77c,_0x5ed1fc){return db[_0xeb73('0x2e')][_0xeb73('0x48')](_0x18a77c[_0xeb73('0x49')],{})[_0xeb73('0x24')](function(_0x248a6f){var _0x39a66c=_0x18a77c['user'][_0xeb73('0x4a')]({'plain':!![]});if(!_0x39a66c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39a66c['role']===_0xeb73('0x4b')){var _0x223624=_0x248a6f[_0xeb73('0x4a')]({'plain':!![]});var _0x3c4ee8=_0xeb73('0x26');return db[_0xeb73('0x4c')]['find']({'where':{'name':_0x3c4ee8,'userProfileId':_0x39a66c[_0xeb73('0x4d')]},'raw':!![]})[_0xeb73('0x24')](function(_0x68c62e){if(_0x68c62e&&_0x68c62e['autoAssociation']===0x0){return db['UserProfileResource'][_0xeb73('0x48')]({'name':_0x223624[_0xeb73('0x2a')],'resourceId':_0x223624['id'],'type':_0x68c62e[_0xeb73('0x2a')],'sectionId':_0x68c62e['id']},{})[_0xeb73('0x24')](function(){return _0x248a6f;});}else{return _0x248a6f;}})[_0xeb73('0x45')](function(_0x58ea25){logger['error'](_0xeb73('0x4e'),_0x58ea25);throw _0x58ea25;});}return _0x248a6f;})['then'](respondWithResult(_0x5ed1fc,0xc9))['catch'](handleError(_0x5ed1fc,null));};exports['update']=function(_0x3e7f0c,_0x24da68){if(_0x3e7f0c[_0xeb73('0x49')]['id']){delete _0x3e7f0c[_0xeb73('0x49')]['id'];}return db['Tag'][_0xeb73('0x47')]({'where':{'id':_0x3e7f0c[_0xeb73('0x46')]['id']}})[_0xeb73('0x24')](handleEntityNotFound(_0x24da68,null))[_0xeb73('0x24')](saveUpdates(_0x3e7f0c[_0xeb73('0x49')],null))['then'](respondWithResult(_0x24da68,null))[_0xeb73('0x45')](handleError(_0x24da68,null));};exports[_0xeb73('0x25')]=function(_0x88250b,_0x416890){return db[_0xeb73('0x2e')][_0xeb73('0x47')]({'where':{'id':_0x88250b[_0xeb73('0x46')]['id']}})['then'](handleEntityNotFound(_0x416890,null))[_0xeb73('0x24')](removeEntity(_0x416890,null))['catch'](handleError(_0x416890,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 3f57e73..1ae9306 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 _0xe75a=['api','moment','request-promise','path','rimraf','define','Tag','util','../../config/logger'];(function(_0xd7b3,_0xe260c7){var _0x4c39a5=function(_0x3d10ab){while(--_0x3d10ab){_0xd7b3['push'](_0xd7b3['shift']());}};_0x4c39a5(++_0xe260c7);}(_0xe75a,0x115));var _0xae75=function(_0x20025e,_0x44c8e1){_0x20025e=_0x20025e-0x0;var _0x4a5ac4=_0xe75a[_0x20025e];return _0x4a5ac4;};'use strict';var _=require('lodash');var util=require(_0xae75('0x0'));var logger=require(_0xae75('0x1'))(_0xae75('0x2'));var moment=require(_0xae75('0x3'));var BPromise=require('bluebird');var rp=require(_0xae75('0x4'));var fs=require('fs');var path=require(_0xae75('0x5'));var rimraf=require(_0xae75('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module['exports']=function(_0x3e7f3d,_0x25bd3f){return _0x3e7f3d[_0xae75('0x7')](_0xae75('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb28d=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','Tag','lodash'];(function(_0x559568,_0x581618){var _0x19161f=function(_0xfa93a8){while(--_0xfa93a8){_0x559568['push'](_0x559568['shift']());}};_0x19161f(++_0x581618);}(_0xb28d,0xbf));var _0xdb28=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xb28d[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xdb28('0x0'));var util=require(_0xdb28('0x1'));var logger=require(_0xdb28('0x2'))(_0xdb28('0x3'));var moment=require(_0xdb28('0x4'));var BPromise=require('bluebird');var rp=require(_0xdb28('0x5'));var fs=require('fs');var path=require(_0xdb28('0x6'));var rimraf=require(_0xdb28('0x7'));var config=require(_0xdb28('0x8'));var attributes=require(_0xdb28('0x9'));module[_0xdb28('0xa')]=function(_0x5b8c83,_0x44204c){return _0x5b8c83['define'](_0xdb28('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index d41fd69..2e0bafa 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 _0x44a3=['http','request','then','info','request\x20sent','debug','error','code','message','Tag,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0xdfea88,_0x14a9e9){var _0x5638a3=function(_0x5e46a8){while(--_0x5e46a8){_0xdfea88['push'](_0xdfea88['shift']());}};_0x5638a3(++_0x14a9e9);}(_0x44a3,0x1a9));var _0x344a=function(_0x483888,_0x2ff778){_0x483888=_0x483888-0x0;var _0x4be161=_0x44a3[_0x483888];return _0x4be161;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('Tag,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('Tag,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('Tag,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('Tag,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});} \ No newline at end of file +var _0xca66=['http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x278943,_0x15f517){var _0x423f71=function(_0x669743){while(--_0x669743){_0x278943['push'](_0x278943['shift']());}};_0x423f71(++_0x15f517);}(_0xca66,0x8b));var _0x6ca6=function(_0x2b0df4,_0x13fd97){_0x2b0df4=_0x2b0df4-0x0;var _0x280425=_0xca66[_0x2b0df4];return _0x280425;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ca6('0x1'));var rs=require(_0x6ca6('0x2'));var fs=require('fs');var Redis=require(_0x6ca6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ca6('0x4'));var logger=require('../../config/logger')(_0x6ca6('0x5'));var config=require('../../config/environment');var jayson=require(_0x6ca6('0x6'));var client=jayson[_0x6ca6('0x7')][_0x6ca6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44019c,_0x407e66,_0x27a210){return new BPromise(function(_0x27d280,_0x4f5651){return client[_0x6ca6('0x9')](_0x44019c,_0x27a210)[_0x6ca6('0xa')](function(_0x34b71b){logger[_0x6ca6('0xb')](_0x6ca6('0xc'),_0x407e66,_0x6ca6('0xd'));logger[_0x6ca6('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'),JSON[_0x6ca6('0xf')](_0x34b71b));if(_0x34b71b[_0x6ca6('0x10')]){if(_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x11')]===0x1f4){logger[_0x6ca6('0x10')]('Tag,\x20%s,\x20%s',_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x4f5651(_0x34b71b['error'][_0x6ca6('0x12')]);}logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x27d280(_0x34b71b[_0x6ca6('0x10')]['message']);}else{logger['info']('Tag,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'));_0x27d280(_0x34b71b[_0x6ca6('0x13')][_0x6ca6('0x12')]);}})[_0x6ca6('0x14')](function(_0x2c4a5c){logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x2c4a5c);_0x4f5651(_0x2c4a5c);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ede1250..47d5721 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 _0x49f7=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','index','get','/:id','show','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','put','delete','/:id/queues','removeQueues','exports','multer','path','connect-timeout'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x49f7,0x17d));var _0x749f=function(_0x181b97,_0x5e59ce){_0x181b97=_0x181b97-0x0;var _0x504f2d=_0x49f7[_0x181b97];return _0x504f2d;};'use strict';var multer=require(_0x749f('0x0'));var util=require('util');var path=require(_0x749f('0x1'));var timeout=require(_0x749f('0x2'));var express=require('express');var router=express[_0x749f('0x3')]();var auth=require(_0x749f('0x4'));var interaction=require(_0x749f('0x5'));var config=require(_0x749f('0x6'));var controller=require(_0x749f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x749f('0x8')]);router[_0x749f('0x9')](_0x749f('0xa'),auth['isAuthenticated'](),controller[_0x749f('0xb')]);router['get']('/:id/queues',auth['isAuthenticated'](),controller[_0x749f('0xc')]);router['get'](_0x749f('0xd'),auth[_0x749f('0xe')](),controller[_0x749f('0xf')]);router[_0x749f('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x749f('0x10')]('/:id/queues',auth[_0x749f('0xe')](),controller[_0x749f('0x11')]);router[_0x749f('0x10')](_0x749f('0xd'),auth[_0x749f('0xe')](),controller[_0x749f('0x12')]);router[_0x749f('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x749f('0x14')](_0x749f('0xa'),auth[_0x749f('0xe')](),controller['destroy']);router[_0x749f('0x14')](_0x749f('0x15'),auth[_0x749f('0xe')](),controller[_0x749f('0x16')]);router[_0x749f('0x14')](_0x749f('0xd'),auth[_0x749f('0xe')](),controller['removeAgents']);module[_0x749f('0x17')]=router; \ No newline at end of file +var _0x8f3b=['get','index','/:id','isAuthenticated','show','/:id/queues','getQueues','getAgents','post','create','/:id/users','update','delete','removeAgents','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller'];(function(_0x5afdc4,_0x574bee){var _0x48f660=function(_0x1dd950){while(--_0x1dd950){_0x5afdc4['push'](_0x5afdc4['shift']());}};_0x48f660(++_0x574bee);}(_0x8f3b,0x1f2));var _0xb8f3=function(_0x3f99f0,_0x3c3701){_0x3f99f0=_0x3f99f0-0x0;var _0x565912=_0x8f3b[_0x3f99f0];return _0x565912;};'use strict';var multer=require(_0xb8f3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb8f3('0x1')]();var auth=require(_0xb8f3('0x2'));var interaction=require(_0xb8f3('0x3'));var config=require(_0xb8f3('0x4'));var controller=require(_0xb8f3('0x5'));router[_0xb8f3('0x6')]('/',auth['isAuthenticated'](),controller[_0xb8f3('0x7')]);router[_0xb8f3('0x6')](_0xb8f3('0x8'),auth[_0xb8f3('0x9')](),controller[_0xb8f3('0xa')]);router[_0xb8f3('0x6')](_0xb8f3('0xb'),auth[_0xb8f3('0x9')](),controller[_0xb8f3('0xc')]);router['get']('/:id/users',auth[_0xb8f3('0x9')](),controller[_0xb8f3('0xd')]);router[_0xb8f3('0xe')]('/',auth[_0xb8f3('0x9')](),controller[_0xb8f3('0xf')]);router[_0xb8f3('0xe')](_0xb8f3('0xb'),auth['isAuthenticated'](),controller['addQueues']);router[_0xb8f3('0xe')](_0xb8f3('0x10'),auth[_0xb8f3('0x9')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb8f3('0x11')]);router[_0xb8f3('0x12')](_0xb8f3('0x8'),auth[_0xb8f3('0x9')](),controller['destroy']);router[_0xb8f3('0x12')](_0xb8f3('0xb'),auth['isAuthenticated'](),controller['removeQueues']);router['delete'](_0xb8f3('0x10'),auth[_0xb8f3('0x9')](),controller[_0xb8f3('0x13')]);module[_0xb8f3('0x14')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index bb955f3..a07228d 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 _0xd58e=['exports','name','STRING','sequelize'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd58e,0x14b));var _0xed58=function(_0x136a53,_0x50e12f){_0x136a53=_0x136a53-0x0;var _0x56a3b2=_0xd58e[_0x136a53];return _0x56a3b2;};'use strict';var Sequelize=require(_0xed58('0x0'));module[_0xed58('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xed58('0x2')},'description':{'type':Sequelize[_0xed58('0x3')]}}; \ No newline at end of file +var _0x9757=['exports','STRING','name','sequelize'];(function(_0x5d23e7,_0x306d0f){var _0x23e197=function(_0x523ee1){while(--_0x523ee1){_0x5d23e7['push'](_0x5d23e7['shift']());}};_0x23e197(++_0x306d0f);}(_0x9757,0x13b));var _0x7975=function(_0x84ae67,_0x28bbe5){_0x84ae67=_0x84ae67-0x0;var _0x554f82=_0x9757[_0x84ae67];return _0x554f82;};'use strict';var Sequelize=require(_0x7975('0x0'));module[_0x7975('0x1')]={'name':{'type':Sequelize[_0x7975('0x2')],'allowNull':![],'unique':_0x7975('0x3')},'description':{'type':Sequelize[_0x7975('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 019398b..a462ff7 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 _0x50e9=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Teams','UserProfileResource','sendStatus','error','name','send','index','Team','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','findOne','channel','Unknown\x20channel','Queue','capitalize','toLowerCase','addQueues','isValidChannel','Sequelize','ValidationError','add','Queues','ids','addAgents','Chat','Mail','Sms','Openchannel','Whatsapp','each','User','online','isNil','SIP/%s','interface','voicePause','omit','spread','userTeam:save','chat','fax','openchannel','voice','UserVoiceQueueRt','emit','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x4632f7,_0x529597){var _0x415281=function(_0x3fdca3){while(--_0x3fdca3){_0x4632f7['push'](_0x4632f7['shift']());}};_0x415281(++_0x529597);}(_0x50e9,0xec));var _0x950e=function(_0x100890,_0x5f0b22){_0x100890=_0x100890-0x0;var _0x308d99=_0x50e9[_0x100890];return _0x308d99;};'use strict';var pdf=require(_0x950e('0x0'));var emlformat=require(_0x950e('0x1'));var rimraf=require(_0x950e('0x2'));var zipdir=require(_0x950e('0x3'));var jsonpatch=require(_0x950e('0x4'));var rp=require('request-promise');var moment=require(_0x950e('0x5'));var BPromise=require(_0x950e('0x6'));var Mustache=require(_0x950e('0x7'));var util=require(_0x950e('0x8'));var path=require(_0x950e('0x9'));var sox=require('sox');var csv=require(_0x950e('0xa'));var ejs=require(_0x950e('0xb'));var fs=require('fs');var _=require(_0x950e('0xc'));var squel=require(_0x950e('0xd'));var crypto=require(_0x950e('0xe'));var jsforce=require(_0x950e('0xf'));var deskjs=require(_0x950e('0x10'));var toCsv=require(_0x950e('0xa'));var querystring=require(_0x950e('0x11'));var Papa=require(_0x950e('0x12'));var Redis=require('ioredis');var authService=require(_0x950e('0x13'));var qs=require(_0x950e('0x14'));var as=require(_0x950e('0x15'));var hardwareService=require(_0x950e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x950e('0x17'));var config=require(_0x950e('0x18'));var licenseUtil=require(_0x950e('0x19'));var db=require('../../mysqldb')['db'];config[_0x950e('0x1a')]=_[_0x950e('0x1b')](config[_0x950e('0x1a')],{'host':_0x950e('0x1c'),'port':0x18eb});var socket=require(_0x950e('0x1d'))(new Redis(config[_0x950e('0x1a')]));require(_0x950e('0x1e'))['register'](socket);function respondWithStatusCode(_0x4b70cb,_0x535299){_0x535299=_0x535299||0xcc;return function(_0x197a1c){if(_0x197a1c){return _0x4b70cb['sendStatus'](_0x535299);}return _0x4b70cb[_0x950e('0x1f')](_0x535299)[_0x950e('0x20')]();};}function respondWithResult(_0x5b40e3,_0x2f3588){_0x2f3588=_0x2f3588||0xc8;return function(_0x6a1c14){if(_0x6a1c14){return _0x5b40e3[_0x950e('0x1f')](_0x2f3588)[_0x950e('0x21')](_0x6a1c14);}};}function respondWithFilteredResult(_0x2c5f94,_0x4e8bdf){return function(_0x286fa3){if(_0x286fa3){var _0x439cbc=_0x286fa3[_0x950e('0x22')],_0x5013b8=_0x4e8bdf['offset'],_0x48d4ee=_0x4e8bdf[_0x950e('0x23')]+_0x4e8bdf[_0x950e('0x24')],_0x333990;if(_0x48d4ee>=_0x439cbc){_0x48d4ee=_0x439cbc;_0x333990=0xc8;}else{_0x333990=0xce;}_0x2c5f94[_0x950e('0x1f')](_0x333990);return _0x2c5f94[_0x950e('0x25')](_0x950e('0x26'),_0x5013b8+'-'+_0x48d4ee+'/'+_0x439cbc)['json'](_0x286fa3);}return null;};}function patchUpdates(_0x5531b7){return function(_0x1b035b){try{jsonpatch['apply'](_0x1b035b,_0x5531b7,!![]);}catch(_0x3c328c){return BPromise[_0x950e('0x27')](_0x3c328c);}return _0x1b035b[_0x950e('0x28')]();};}function saveUpdates(_0x46cb44,_0xbac570){return function(_0x1facc4){if(_0x1facc4){return _0x1facc4[_0x950e('0x29')](_0x46cb44)[_0x950e('0x2a')](function(_0x27db9c){return _0x27db9c;});}return null;};}function removeEntity(_0x918297,_0x42c2a5){return function(_0x5f38f1){if(_0x5f38f1){return _0x5f38f1[_0x950e('0x2b')]()['then'](function(){var _0x32b403=_0x5f38f1[_0x950e('0x2c')]({'plain':!![]});var _0x53d2b9=_0x950e('0x2d');return db[_0x950e('0x2e')][_0x950e('0x2b')]({'where':{'type':_0x53d2b9,'resourceId':_0x32b403['id']}})[_0x950e('0x2a')](function(){return _0x5f38f1;});})[_0x950e('0x2a')](function(){_0x918297[_0x950e('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5db660,_0x1c71ce){return function(_0xeee784){if(!_0xeee784){_0x5db660[_0x950e('0x2f')](0x194);}return _0xeee784;};}function handleError(_0x43e8bf,_0x5e2e18){_0x5e2e18=_0x5e2e18||0x1f4;return function(_0x5bb256){logger[_0x950e('0x30')](_0x5bb256['stack']);if(_0x5bb256[_0x950e('0x31')]){delete _0x5bb256[_0x950e('0x31')];}_0x43e8bf[_0x950e('0x1f')](_0x5e2e18)[_0x950e('0x32')](_0x5bb256);};}exports[_0x950e('0x33')]=function(_0x53e8be,_0x468a9b){var _0x5058e3={},_0x42ee21={},_0x525ee6={'count':0x0,'rows':[]};var _0x1ea5a1=_['map'](db[_0x950e('0x34')]['rawAttributes'],function(_0x24c4a4){return{'name':_0x24c4a4['fieldName'],'type':_0x24c4a4['type'][_0x950e('0x35')]};});_0x42ee21['model']=_[_0x950e('0x36')](_0x1ea5a1,_0x950e('0x31'));_0x42ee21[_0x950e('0x37')]=_['keys'](_0x53e8be[_0x950e('0x37')]);_0x42ee21[_0x950e('0x38')]=_[_0x950e('0x39')](_0x42ee21['model'],_0x42ee21[_0x950e('0x37')]);_0x5058e3['attributes']=_[_0x950e('0x39')](_0x42ee21[_0x950e('0x3a')],qs[_0x950e('0x3b')](_0x53e8be[_0x950e('0x37')][_0x950e('0x3b')]));_0x5058e3['attributes']=_0x5058e3[_0x950e('0x3c')][_0x950e('0x3d')]?_0x5058e3[_0x950e('0x3c')]:_0x42ee21['model'];if(!_0x53e8be['query'][_0x950e('0x3e')](_0x950e('0x3f'))){_0x5058e3[_0x950e('0x24')]=qs[_0x950e('0x24')](_0x53e8be['query'][_0x950e('0x24')]);_0x5058e3[_0x950e('0x23')]=qs[_0x950e('0x23')](_0x53e8be['query'][_0x950e('0x23')]);}_0x5058e3[_0x950e('0x40')]=qs[_0x950e('0x41')](_0x53e8be[_0x950e('0x37')][_0x950e('0x41')]);_0x5058e3[_0x950e('0x42')]=qs['filters'](_[_0x950e('0x43')](_0x53e8be[_0x950e('0x37')],_0x42ee21[_0x950e('0x38')]),_0x1ea5a1);if(_0x53e8be[_0x950e('0x37')]['filter']){_0x5058e3[_0x950e('0x42')]=_[_0x950e('0x44')](_0x5058e3[_0x950e('0x42')],{'$or':_[_0x950e('0x36')](_0x1ea5a1,function(_0x5998e6){if(_0x5998e6[_0x950e('0x45')]!=='VIRTUAL'){var _0x21d52f={};_0x21d52f[_0x5998e6[_0x950e('0x31')]]={'$like':'%'+_0x53e8be[_0x950e('0x37')][_0x950e('0x46')]+'%'};return _0x21d52f;}})});}_0x5058e3=_[_0x950e('0x44')]({},_0x5058e3,_0x53e8be[_0x950e('0x47')]);var _0x1387d8={'where':_0x5058e3[_0x950e('0x42')]};return db[_0x950e('0x34')][_0x950e('0x22')](_0x1387d8)[_0x950e('0x2a')](function(_0x4bc759){_0x525ee6[_0x950e('0x22')]=_0x4bc759;if(_0x53e8be[_0x950e('0x37')][_0x950e('0x48')]){_0x5058e3[_0x950e('0x49')]=[{'all':!![]}];}return db[_0x950e('0x34')][_0x950e('0x4a')](_0x5058e3);})[_0x950e('0x2a')](function(_0x5e02fa){_0x525ee6[_0x950e('0x4b')]=_0x5e02fa;return _0x525ee6;})[_0x950e('0x2a')](respondWithFilteredResult(_0x468a9b,_0x5058e3))[_0x950e('0x4c')](handleError(_0x468a9b,null));};exports['show']=function(_0x181522,_0x3f3b3c){var _0x4bc5df={'raw':![],'where':{'id':_0x181522[_0x950e('0x4d')]['id']}},_0x5cd301={};_0x5cd301[_0x950e('0x3a')]=_[_0x950e('0x4e')](db[_0x950e('0x34')][_0x950e('0x4f')]);_0x5cd301[_0x950e('0x37')]=_[_0x950e('0x4e')](_0x181522[_0x950e('0x37')]);_0x5cd301[_0x950e('0x38')]=_[_0x950e('0x39')](_0x5cd301['model'],_0x5cd301[_0x950e('0x37')]);_0x4bc5df[_0x950e('0x3c')]=_[_0x950e('0x39')](_0x5cd301[_0x950e('0x3a')],qs[_0x950e('0x3b')](_0x181522[_0x950e('0x37')][_0x950e('0x3b')]));_0x4bc5df[_0x950e('0x3c')]=_0x4bc5df[_0x950e('0x3c')][_0x950e('0x3d')]?_0x4bc5df[_0x950e('0x3c')]:_0x5cd301['model'];if(_0x181522[_0x950e('0x37')][_0x950e('0x48')]){_0x4bc5df['include']=[{'all':!![]}];}_0x4bc5df=_[_0x950e('0x44')]({},_0x4bc5df,_0x181522[_0x950e('0x47')]);return db[_0x950e('0x34')]['find'](_0x4bc5df)[_0x950e('0x2a')](handleEntityNotFound(_0x3f3b3c,null))[_0x950e('0x2a')](respondWithResult(_0x3f3b3c,null))[_0x950e('0x4c')](handleError(_0x3f3b3c,null));};exports[_0x950e('0x50')]=function(_0x4c1b97,_0x56b202){return db[_0x950e('0x34')][_0x950e('0x50')](_0x4c1b97[_0x950e('0x51')],{})['then'](function(_0x40d455){var _0x509bf7=_0x4c1b97['user'][_0x950e('0x2c')]({'plain':!![]});if(!_0x509bf7)throw new Error(_0x950e('0x52'));if(_0x509bf7['role']===_0x950e('0x53')){var _0x570913=_0x40d455[_0x950e('0x2c')]({'plain':!![]});var _0x1b2040=_0x950e('0x2d');return db[_0x950e('0x54')]['find']({'where':{'name':_0x1b2040,'userProfileId':_0x509bf7[_0x950e('0x55')]},'raw':!![]})[_0x950e('0x2a')](function(_0x2aaa55){if(_0x2aaa55&&_0x2aaa55[_0x950e('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x570913[_0x950e('0x31')],'resourceId':_0x570913['id'],'type':_0x2aaa55[_0x950e('0x31')],'sectionId':_0x2aaa55['id']},{})[_0x950e('0x2a')](function(){return _0x40d455;});}else{return _0x40d455;}})[_0x950e('0x4c')](function(_0x12b28b){logger[_0x950e('0x30')](_0x950e('0x57'),_0x12b28b);throw _0x12b28b;});}return _0x40d455;})['then'](respondWithResult(_0x56b202,0xc9))['catch'](handleError(_0x56b202,null));};exports['update']=function(_0x18f2a6,_0x2767d6){if(_0x18f2a6[_0x950e('0x51')]['id']){delete _0x18f2a6[_0x950e('0x51')]['id'];}return db[_0x950e('0x34')][_0x950e('0x58')]({'where':{'id':_0x18f2a6[_0x950e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2767d6,null))[_0x950e('0x2a')](saveUpdates(_0x18f2a6[_0x950e('0x51')],null))[_0x950e('0x2a')](respondWithResult(_0x2767d6,null))[_0x950e('0x4c')](handleError(_0x2767d6,null));};exports[_0x950e('0x2b')]=function(_0x3ffb17,_0xf193bd){return db[_0x950e('0x34')][_0x950e('0x58')]({'where':{'id':_0x3ffb17[_0x950e('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf193bd,null))['then'](removeEntity(_0xf193bd,null))['catch'](handleError(_0xf193bd,null));};exports['getQueues']=function(_0x103778,_0x2235c6,_0x46617b){return db[_0x950e('0x34')][_0x950e('0x59')]({'where':{'id':_0x103778[_0x950e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2235c6,null))['then'](function(_0x1d5880){if(!_0x103778[_0x950e('0x37')]['channel']||!utils['isValidChannel'](_0x103778[_0x950e('0x37')][_0x950e('0x5a')])){throw new db['Sequelize']['ValidationError'](_0x950e('0x5b'));}var _0x1d5ea4={};var _0x38af45={};_0x38af45['model']=_['keys'](db[_['capitalize'](_0x103778['query'][_0x950e('0x5a')]['toLowerCase']())+_0x950e('0x5c')][_0x950e('0x4f')]);_0x38af45['query']=_[_0x950e('0x4e')](_0x103778[_0x950e('0x37')]);_0x38af45['filters']=_[_0x950e('0x39')](_0x38af45[_0x950e('0x3a')],_0x38af45[_0x950e('0x37')]);_0x1d5ea4['attributes']=_['intersection'](_0x38af45[_0x950e('0x3a')],qs[_0x950e('0x3b')](_0x103778[_0x950e('0x37')][_0x950e('0x3b')]));_0x1d5ea4['attributes']=_0x1d5ea4[_0x950e('0x3c')][_0x950e('0x3d')]?_0x1d5ea4[_0x950e('0x3c')]:_0x38af45[_0x950e('0x3a')];_0x1d5ea4[_0x950e('0x24')]=qs[_0x950e('0x24')](_0x103778[_0x950e('0x37')][_0x950e('0x24')]);_0x1d5ea4[_0x950e('0x23')]=qs[_0x950e('0x23')](_0x103778[_0x950e('0x37')][_0x950e('0x23')]);_0x1d5ea4[_0x950e('0x40')]=qs[_0x950e('0x41')](_0x103778[_0x950e('0x37')]['sort']);_0x1d5ea4[_0x950e('0x42')]=qs[_0x950e('0x38')](_[_0x950e('0x43')](_0x103778[_0x950e('0x37')],_0x38af45[_0x950e('0x38')]));_0x1d5ea4=_['merge']({},_0x1d5ea4,_0x103778[_0x950e('0x47')]);return _0x1d5880[_0x950e('0x2c')+_[_0x950e('0x5d')](_0x103778[_0x950e('0x37')][_0x950e('0x5a')][_0x950e('0x5e')]())+'Queues'](_0x1d5ea4);})[_0x950e('0x2a')](respondWithResult(_0x2235c6,null))[_0x950e('0x4c')](handleError(_0x2235c6,null));};exports[_0x950e('0x5f')]=function(_0x1815a6,_0x5151d0,_0x52d056){return db[_0x950e('0x34')]['findOne']({'where':{'id':_0x1815a6[_0x950e('0x4d')]['id']}})['then'](function(_0xc204df){if(_0xc204df){if(!_0x1815a6[_0x950e('0x51')][_0x950e('0x5a')]||!utils[_0x950e('0x60')](_0x1815a6[_0x950e('0x51')]['channel'])){throw new db[(_0x950e('0x61'))][(_0x950e('0x62'))](_0x950e('0x5b'));}return _0xc204df[_0x950e('0x63')+_[_0x950e('0x5d')](_0x1815a6[_0x950e('0x51')][_0x950e('0x5a')][_0x950e('0x5e')]())+_0x950e('0x64')](_0x1815a6['body'][_0x950e('0x65')]);}return null;})[_0x950e('0x2a')](handleEntityNotFound(_0x5151d0,null))[_0x950e('0x2a')](respondWithStatusCode(_0x5151d0,null))['catch'](handleError(_0x5151d0,null));};exports['removeQueues']=function(_0x5f0072,_0xdcadc7,_0x359e95){return db[_0x950e('0x34')][_0x950e('0x59')]({'where':{'id':_0x5f0072[_0x950e('0x4d')]['id']}})[_0x950e('0x2a')](function(_0x1f8537){if(_0x1f8537){if(!_0x5f0072['query'][_0x950e('0x5a')]||!utils['isValidChannel'](_0x5f0072[_0x950e('0x37')][_0x950e('0x5a')])){throw new db[(_0x950e('0x61'))][(_0x950e('0x62'))](_0x950e('0x5b'));}return _0x1f8537['remove'+_[_0x950e('0x5d')](_0x5f0072[_0x950e('0x37')][_0x950e('0x5a')]['toLowerCase']())+_0x950e('0x64')](_0x5f0072[_0x950e('0x37')][_0x950e('0x65')]);}return null;})[_0x950e('0x2a')](handleEntityNotFound(_0xdcadc7,null))['then'](respondWithStatusCode(_0xdcadc7,null))[_0x950e('0x4c')](handleError(_0xdcadc7,null));};exports[_0x950e('0x66')]=function(_0x4dc139,_0x1e269b,_0x1f4d21){return db['Team']['find']({'where':{'id':_0x4dc139['params']['id']}})[_0x950e('0x2a')](handleEntityNotFound(_0x1e269b,null))[_0x950e('0x2a')](function(_0x10f97d){if(_0x10f97d){var _0x446222=['Voice',_0x950e('0x67'),_0x950e('0x68'),_0x950e('0x69'),'Fax',_0x950e('0x6a'),_0x950e('0x6b')];return BPromise[_0x950e('0x6c')](_0x446222,function(_0x29df54){return _0x10f97d['get'+_0x29df54+'Queues']({'attributes':['id',_0x950e('0x31')]})['then'](function(_0x23c5f4){return BPromise['each'](_0x23c5f4,function(_0x15d127){return _0x15d127['addAgents'](_0x4dc139['body'][_0x950e('0x65')])[_0x950e('0x2a')](function(){if(_0x29df54==='Voice'){return db[_0x950e('0x6d')][_0x950e('0x4a')]({'where':{'id':_0x4dc139[_0x950e('0x51')][_0x950e('0x65')]},'attributes':['id',_0x950e('0x31'),_0x950e('0x6e'),'voicePause','interface'],'raw':!![]})[_0x950e('0x2a')](function(_0x257e74){return BPromise[_0x950e('0x6c')](_[_0x950e('0x46')](_0x257e74,{'online':0x1}),function(_0x56689d){return db['UserVoiceQueueRt']['upsert']({'membername':_0x56689d[_0x950e('0x31')],'UserId':_0x56689d['id'],'queue_name':_0x15d127[_0x950e('0x31')],'VoiceQueueId':_0x15d127['id'],'interface':_[_0x950e('0x6f')](_0x56689d['interface'])?util['format'](_0x950e('0x70'),_0x56689d[_0x950e('0x31')]):_0x56689d[_0x950e('0x71')],'paused':_0x56689d[_0x950e('0x72')]||![],'penalty':0x0});});});}});});})[_0x950e('0x2a')](function(){return _0x10f97d;});})[_0x950e('0x2a')](function(){return _0x10f97d;});}})['then'](function(_0x4bde33){if(_0x4bde33){return _0x4bde33['addAgents'](_0x4dc139[_0x950e('0x51')][_0x950e('0x65')],_[_0x950e('0x73')](_0x4dc139[_0x950e('0x51')],[_0x950e('0x65'),'id'])||{})[_0x950e('0x74')](function(_0x135cc6){for(var _0x276df6=0x0;_0x276df6<_0x4dc139[_0x950e('0x51')][_0x950e('0x65')][_0x950e('0x3d')];_0x276df6+=0x1){socket['emit'](_0x950e('0x75'),{'UserId':_0x4dc139['body'][_0x950e('0x65')][_0x276df6],'TeamId':_0x4dc139[_0x950e('0x4d')]['id']});}return _0x135cc6;});}})[_0x950e('0x2a')](respondWithResult(_0x1e269b,null))[_0x950e('0x4c')](handleError(_0x1e269b,null));};exports['removeAgents']=function(_0x1d37d8,_0x75bccd,_0x2a9c28){return db[_0x950e('0x34')][_0x950e('0x58')]({'where':{'id':_0x1d37d8[_0x950e('0x4d')]['id']}})[_0x950e('0x2a')](handleEntityNotFound(_0x75bccd,null))[_0x950e('0x2a')](function(_0x4b1324){if(_0x4b1324){return BPromise[_0x950e('0x6c')](['voice',_0x950e('0x76'),'mail','sms',_0x950e('0x77'),_0x950e('0x78'),'whatsapp'],function(_0x1d2178){return _0x4b1324[_0x950e('0x2c')+_[_0x950e('0x5d')](_0x1d2178)+'Queues']({'attributes':['id',_0x950e('0x31')]})[_0x950e('0x2a')](function(_0x1fcf49){return BPromise[_0x950e('0x6c')](_0x1fcf49,function(_0x371437){return _0x371437['removeAgents'](_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')])['then'](function(){if(_0x1d2178===_0x950e('0x79')){return db[_0x950e('0x7a')]['destroy']({'where':{'VoiceQueueId':_0x371437['id'],'UserId':_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')]}});}});});})[_0x950e('0x2a')](function(){return _0x4b1324;});})['then'](function(){return _0x4b1324;});}})[_0x950e('0x2a')](function(_0x24138f){if(_0x24138f){return _0x24138f['removeAgents'](_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')])[_0x950e('0x2a')](function(){if(_['isArray'](_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')])){for(var _0x1dca14=0x0;_0x1dca14<_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')]['length'];_0x1dca14+=0x1){socket[_0x950e('0x7b')](_0x950e('0x7c'),{'UserId':Number(_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')][_0x1dca14]),'TeamId':Number(_0x1d37d8[_0x950e('0x4d')]['id'])});}}else{socket['emit'](_0x950e('0x7c'),{'UserId':Number(_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')]),'TeamId':Number(_0x1d37d8['params']['id'])});}});}})[_0x950e('0x2a')](respondWithStatusCode(_0x75bccd,null))['catch'](handleError(_0x75bccd,null));};exports['getAgents']=function(_0x3b0b83,_0x40ff92,_0x214b0e){var _0x59d5b4={};var _0x590d15={};var _0x392749;var _0x4a36e2;return db[_0x950e('0x34')][_0x950e('0x59')]({'where':{'id':_0x3b0b83[_0x950e('0x4d')]['id']}})[_0x950e('0x2a')](handleEntityNotFound(_0x40ff92,null))[_0x950e('0x2a')](function(_0x2b3ce4){if(_0x2b3ce4){_0x392749=_0x2b3ce4;_0x590d15['model']=_[_0x950e('0x4e')](db[_0x950e('0x6d')][_0x950e('0x4f')]);_0x590d15[_0x950e('0x37')]=_[_0x950e('0x4e')](_0x3b0b83['query']);_0x590d15[_0x950e('0x38')]=_['intersection'](_0x590d15[_0x950e('0x3a')],_0x590d15[_0x950e('0x37')]);_0x59d5b4[_0x950e('0x3c')]=_[_0x950e('0x39')](_0x590d15[_0x950e('0x3a')],qs['fields'](_0x3b0b83[_0x950e('0x37')][_0x950e('0x3b')]));_0x59d5b4[_0x950e('0x3c')]=_0x59d5b4['attributes'][_0x950e('0x3d')]?_0x59d5b4[_0x950e('0x3c')]:_0x590d15[_0x950e('0x3a')];_0x59d5b4[_0x950e('0x40')]=qs[_0x950e('0x41')](_0x3b0b83['query'][_0x950e('0x41')]);_0x59d5b4[_0x950e('0x42')]=qs[_0x950e('0x38')](_[_0x950e('0x43')](_0x3b0b83[_0x950e('0x37')],_0x590d15[_0x950e('0x38')]));if(_0x3b0b83[_0x950e('0x37')][_0x950e('0x46')]){_0x59d5b4[_0x950e('0x42')]=_['merge'](_0x59d5b4[_0x950e('0x42')],{'$or':_[_0x950e('0x36')](_0x59d5b4['attributes'],function(_0x14fe01){var _0x43cb97={};_0x43cb97[_0x14fe01]={'$like':'%'+_0x3b0b83[_0x950e('0x37')][_0x950e('0x46')]+'%'};return _0x43cb97;})});}_0x59d5b4=_[_0x950e('0x44')]({},_0x59d5b4,_0x3b0b83['options']);return _0x392749[_0x950e('0x7d')](_0x59d5b4);}})[_0x950e('0x2a')](function(_0x3f64f3){if(_0x3f64f3){_0x4a36e2=_0x3f64f3[_0x950e('0x3d')];if(!_0x3b0b83[_0x950e('0x37')][_0x950e('0x3e')](_0x950e('0x3f'))){_0x59d5b4[_0x950e('0x24')]=qs[_0x950e('0x24')](_0x3b0b83[_0x950e('0x37')][_0x950e('0x24')]);_0x59d5b4[_0x950e('0x23')]=qs[_0x950e('0x23')](_0x3b0b83['query']['offset']);}return _0x392749[_0x950e('0x7d')](_0x59d5b4);}})['then'](function(_0x3950ee){if(_0x3950ee){return _0x3950ee?{'count':_0x4a36e2,'rows':_0x3950ee}:null;}})[_0x950e('0x2a')](respondWithResult(_0x40ff92,null))['catch'](handleError(_0x40ff92,null));}; \ No newline at end of file +var _0xeb32=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','channel','isValidChannel','ValidationError','toLowerCase','capitalize','Queues','addQueues','Sequelize','Unknown\x20channel','remove','ids','Voice','Chat','Mail','Fax','Openchannel','each','addAgents','User','online','interface','UserVoiceQueueRt','upsert','SIP/%s','voicePause','omit','spread','emit','userTeam:save','removeAgents','voice','chat','mail','sms','fax','isArray','userTeam:remove','getAgents','filter','nolimit','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','Team','includeAll','include','findAll','rows','catch','show','length','find'];(function(_0x3869bb,_0x4a67f1){var _0xb66ee9=function(_0x29f91d){while(--_0x29f91d){_0x3869bb['push'](_0x3869bb['shift']());}};_0xb66ee9(++_0x4a67f1);}(_0xeb32,0x13d));var _0x2eb3=function(_0x1a5620,_0x18ac96){_0x1a5620=_0x1a5620-0x0;var _0x21a32c=_0xeb32[_0x1a5620];return _0x21a32c;};'use strict';var pdf=require(_0x2eb3('0x0'));var emlformat=require(_0x2eb3('0x1'));var rimraf=require(_0x2eb3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2eb3('0x3'));var rp=require(_0x2eb3('0x4'));var moment=require(_0x2eb3('0x5'));var BPromise=require(_0x2eb3('0x6'));var Mustache=require(_0x2eb3('0x7'));var util=require(_0x2eb3('0x8'));var path=require('path');var sox=require(_0x2eb3('0x9'));var csv=require('to-csv');var ejs=require(_0x2eb3('0xa'));var fs=require('fs');var _=require(_0x2eb3('0xb'));var squel=require(_0x2eb3('0xc'));var crypto=require(_0x2eb3('0xd'));var jsforce=require(_0x2eb3('0xe'));var deskjs=require(_0x2eb3('0xf'));var toCsv=require(_0x2eb3('0x10'));var querystring=require(_0x2eb3('0x11'));var Papa=require(_0x2eb3('0x12'));var Redis=require('ioredis');var authService=require(_0x2eb3('0x13'));var qs=require(_0x2eb3('0x14'));var as=require(_0x2eb3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2eb3('0x16'))(_0x2eb3('0x17'));var utils=require('../../config/utils');var config=require(_0x2eb3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2eb3('0x19'))['db'];config[_0x2eb3('0x1a')]=_[_0x2eb3('0x1b')](config['redis'],{'host':_0x2eb3('0x1c'),'port':0x18eb});var socket=require(_0x2eb3('0x1d'))(new Redis(config[_0x2eb3('0x1a')]));require(_0x2eb3('0x1e'))[_0x2eb3('0x1f')](socket);function respondWithStatusCode(_0x408959,_0x184b9a){_0x184b9a=_0x184b9a||0xcc;return function(_0x28ec63){if(_0x28ec63){return _0x408959[_0x2eb3('0x20')](_0x184b9a);}return _0x408959[_0x2eb3('0x21')](_0x184b9a)[_0x2eb3('0x22')]();};}function respondWithResult(_0x435460,_0x501111){_0x501111=_0x501111||0xc8;return function(_0x558b56){if(_0x558b56){return _0x435460[_0x2eb3('0x21')](_0x501111)[_0x2eb3('0x23')](_0x558b56);}};}function respondWithFilteredResult(_0x42ea6c,_0x523cb3){return function(_0x586a4e){if(_0x586a4e){var _0x4e4a5c=_0x586a4e[_0x2eb3('0x24')],_0x259c0c=_0x523cb3[_0x2eb3('0x25')],_0xd7aa14=_0x523cb3[_0x2eb3('0x25')]+_0x523cb3[_0x2eb3('0x26')],_0x50beb8;if(_0xd7aa14>=_0x4e4a5c){_0xd7aa14=_0x4e4a5c;_0x50beb8=0xc8;}else{_0x50beb8=0xce;}_0x42ea6c[_0x2eb3('0x21')](_0x50beb8);return _0x42ea6c[_0x2eb3('0x27')](_0x2eb3('0x28'),_0x259c0c+'-'+_0xd7aa14+'/'+_0x4e4a5c)[_0x2eb3('0x23')](_0x586a4e);}return null;};}function patchUpdates(_0x480a25){return function(_0x408499){try{jsonpatch['apply'](_0x408499,_0x480a25,!![]);}catch(_0x398eac){return BPromise[_0x2eb3('0x29')](_0x398eac);}return _0x408499[_0x2eb3('0x2a')]();};}function saveUpdates(_0x39d992,_0x4b398c){return function(_0x1123e7){if(_0x1123e7){return _0x1123e7[_0x2eb3('0x2b')](_0x39d992)[_0x2eb3('0x2c')](function(_0x2a6216){return _0x2a6216;});}return null;};}function removeEntity(_0x5928a2,_0xb0cb77){return function(_0x5529b0){if(_0x5529b0){return _0x5529b0[_0x2eb3('0x2d')]()[_0x2eb3('0x2c')](function(){var _0x4c9200=_0x5529b0[_0x2eb3('0x2e')]({'plain':!![]});var _0x3b609d='Teams';return db[_0x2eb3('0x2f')][_0x2eb3('0x2d')]({'where':{'type':_0x3b609d,'resourceId':_0x4c9200['id']}})[_0x2eb3('0x2c')](function(){return _0x5529b0;});})['then'](function(){_0x5928a2[_0x2eb3('0x21')](0xcc)[_0x2eb3('0x22')]();});}};}function handleEntityNotFound(_0x254de8,_0x5840de){return function(_0x5137d3){if(!_0x5137d3){_0x254de8[_0x2eb3('0x20')](0x194);}return _0x5137d3;};}function handleError(_0x4df132,_0x2374d9){_0x2374d9=_0x2374d9||0x1f4;return function(_0x254a18){logger['error'](_0x254a18[_0x2eb3('0x30')]);if(_0x254a18[_0x2eb3('0x31')]){delete _0x254a18[_0x2eb3('0x31')];}_0x4df132['status'](_0x2374d9)[_0x2eb3('0x32')](_0x254a18);};}exports['index']=function(_0x2a4cb9,_0x3e3e96){var _0x3939af={},_0x3a0a1b={},_0x5e3539={'count':0x0,'rows':[]};var _0x533ec4=_[_0x2eb3('0x33')](db['Team'][_0x2eb3('0x34')],function(_0x461826){return{'name':_0x461826[_0x2eb3('0x35')],'type':_0x461826[_0x2eb3('0x36')]['key']};});_0x3a0a1b[_0x2eb3('0x37')]=_['map'](_0x533ec4,_0x2eb3('0x31'));_0x3a0a1b[_0x2eb3('0x38')]=_[_0x2eb3('0x39')](_0x2a4cb9[_0x2eb3('0x38')]);_0x3a0a1b['filters']=_[_0x2eb3('0x3a')](_0x3a0a1b[_0x2eb3('0x37')],_0x3a0a1b[_0x2eb3('0x38')]);_0x3939af['attributes']=_[_0x2eb3('0x3a')](_0x3a0a1b[_0x2eb3('0x37')],qs['fields'](_0x2a4cb9[_0x2eb3('0x38')][_0x2eb3('0x3b')]));_0x3939af[_0x2eb3('0x3c')]=_0x3939af[_0x2eb3('0x3c')]['length']?_0x3939af[_0x2eb3('0x3c')]:_0x3a0a1b['model'];if(!_0x2a4cb9['query'][_0x2eb3('0x3d')]('nolimit')){_0x3939af[_0x2eb3('0x26')]=qs[_0x2eb3('0x26')](_0x2a4cb9[_0x2eb3('0x38')]['limit']);_0x3939af['offset']=qs['offset'](_0x2a4cb9[_0x2eb3('0x38')][_0x2eb3('0x25')]);}_0x3939af[_0x2eb3('0x3e')]=qs[_0x2eb3('0x3f')](_0x2a4cb9['query']['sort']);_0x3939af[_0x2eb3('0x40')]=qs[_0x2eb3('0x41')](_[_0x2eb3('0x42')](_0x2a4cb9[_0x2eb3('0x38')],_0x3a0a1b['filters']),_0x533ec4);if(_0x2a4cb9['query']['filter']){_0x3939af[_0x2eb3('0x40')]=_[_0x2eb3('0x43')](_0x3939af[_0x2eb3('0x40')],{'$or':_[_0x2eb3('0x33')](_0x533ec4,function(_0xed13ac){if(_0xed13ac[_0x2eb3('0x36')]!==_0x2eb3('0x44')){var _0x4d56d5={};_0x4d56d5[_0xed13ac[_0x2eb3('0x31')]]={'$like':'%'+_0x2a4cb9['query']['filter']+'%'};return _0x4d56d5;}})});}_0x3939af=_[_0x2eb3('0x43')]({},_0x3939af,_0x2a4cb9[_0x2eb3('0x45')]);var _0x10b570={'where':_0x3939af[_0x2eb3('0x40')]};return db[_0x2eb3('0x46')][_0x2eb3('0x24')](_0x10b570)[_0x2eb3('0x2c')](function(_0x4be2f6){_0x5e3539[_0x2eb3('0x24')]=_0x4be2f6;if(_0x2a4cb9['query'][_0x2eb3('0x47')]){_0x3939af[_0x2eb3('0x48')]=[{'all':!![]}];}return db[_0x2eb3('0x46')][_0x2eb3('0x49')](_0x3939af);})[_0x2eb3('0x2c')](function(_0x302390){_0x5e3539[_0x2eb3('0x4a')]=_0x302390;return _0x5e3539;})['then'](respondWithFilteredResult(_0x3e3e96,_0x3939af))[_0x2eb3('0x4b')](handleError(_0x3e3e96,null));};exports[_0x2eb3('0x4c')]=function(_0x47b162,_0x4ce164){var _0x559d67={'raw':![],'where':{'id':_0x47b162['params']['id']}},_0x24ebc0={};_0x24ebc0[_0x2eb3('0x37')]=_[_0x2eb3('0x39')](db['Team'][_0x2eb3('0x34')]);_0x24ebc0[_0x2eb3('0x38')]=_[_0x2eb3('0x39')](_0x47b162['query']);_0x24ebc0[_0x2eb3('0x41')]=_[_0x2eb3('0x3a')](_0x24ebc0['model'],_0x24ebc0['query']);_0x559d67['attributes']=_[_0x2eb3('0x3a')](_0x24ebc0[_0x2eb3('0x37')],qs['fields'](_0x47b162[_0x2eb3('0x38')][_0x2eb3('0x3b')]));_0x559d67['attributes']=_0x559d67[_0x2eb3('0x3c')][_0x2eb3('0x4d')]?_0x559d67['attributes']:_0x24ebc0[_0x2eb3('0x37')];if(_0x47b162[_0x2eb3('0x38')][_0x2eb3('0x47')]){_0x559d67['include']=[{'all':!![]}];}_0x559d67=_['merge']({},_0x559d67,_0x47b162[_0x2eb3('0x45')]);return db[_0x2eb3('0x46')][_0x2eb3('0x4e')](_0x559d67)[_0x2eb3('0x2c')](handleEntityNotFound(_0x4ce164,null))[_0x2eb3('0x2c')](respondWithResult(_0x4ce164,null))[_0x2eb3('0x4b')](handleError(_0x4ce164,null));};exports[_0x2eb3('0x4f')]=function(_0x2a3840,_0x26b75f){return db[_0x2eb3('0x46')][_0x2eb3('0x4f')](_0x2a3840[_0x2eb3('0x50')],{})[_0x2eb3('0x2c')](function(_0x79a246){var _0x1661b3=_0x2a3840[_0x2eb3('0x51')][_0x2eb3('0x2e')]({'plain':!![]});if(!_0x1661b3)throw new Error(_0x2eb3('0x52'));if(_0x1661b3[_0x2eb3('0x53')]==='user'){var _0x4b3897=_0x79a246['get']({'plain':!![]});var _0x2867a1=_0x2eb3('0x54');return db[_0x2eb3('0x55')][_0x2eb3('0x4e')]({'where':{'name':_0x2867a1,'userProfileId':_0x1661b3[_0x2eb3('0x56')]},'raw':!![]})['then'](function(_0x317d22){if(_0x317d22&&_0x317d22[_0x2eb3('0x57')]===0x0){return db[_0x2eb3('0x2f')][_0x2eb3('0x4f')]({'name':_0x4b3897[_0x2eb3('0x31')],'resourceId':_0x4b3897['id'],'type':_0x317d22['name'],'sectionId':_0x317d22['id']},{})[_0x2eb3('0x2c')](function(){return _0x79a246;});}else{return _0x79a246;}})['catch'](function(_0x518aed){logger[_0x2eb3('0x58')](_0x2eb3('0x59'),_0x518aed);throw _0x518aed;});}return _0x79a246;})[_0x2eb3('0x2c')](respondWithResult(_0x26b75f,0xc9))[_0x2eb3('0x4b')](handleError(_0x26b75f,null));};exports[_0x2eb3('0x2b')]=function(_0x10c60a,_0x14d874){if(_0x10c60a[_0x2eb3('0x50')]['id']){delete _0x10c60a[_0x2eb3('0x50')]['id'];}return db[_0x2eb3('0x46')][_0x2eb3('0x4e')]({'where':{'id':_0x10c60a[_0x2eb3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x14d874,null))[_0x2eb3('0x2c')](saveUpdates(_0x10c60a[_0x2eb3('0x50')],null))[_0x2eb3('0x2c')](respondWithResult(_0x14d874,null))[_0x2eb3('0x4b')](handleError(_0x14d874,null));};exports[_0x2eb3('0x2d')]=function(_0x3e7602,_0x46eae1){return db[_0x2eb3('0x46')]['find']({'where':{'id':_0x3e7602[_0x2eb3('0x5a')]['id']}})[_0x2eb3('0x2c')](handleEntityNotFound(_0x46eae1,null))['then'](removeEntity(_0x46eae1,null))['catch'](handleError(_0x46eae1,null));};exports['getQueues']=function(_0x415a75,_0x35dc51,_0x4feb4c){return db[_0x2eb3('0x46')][_0x2eb3('0x5b')]({'where':{'id':_0x415a75['params']['id']}})[_0x2eb3('0x2c')](handleEntityNotFound(_0x35dc51,null))['then'](function(_0xf71ec9){if(!_0x415a75[_0x2eb3('0x38')][_0x2eb3('0x5c')]||!utils[_0x2eb3('0x5d')](_0x415a75[_0x2eb3('0x38')]['channel'])){throw new db['Sequelize'][(_0x2eb3('0x5e'))]('Unknown\x20channel');}var _0x21c7c9={};var _0x2d133a={};_0x2d133a['model']=_['keys'](db[_['capitalize'](_0x415a75['query'][_0x2eb3('0x5c')][_0x2eb3('0x5f')]())+'Queue'][_0x2eb3('0x34')]);_0x2d133a['query']=_[_0x2eb3('0x39')](_0x415a75[_0x2eb3('0x38')]);_0x2d133a[_0x2eb3('0x41')]=_[_0x2eb3('0x3a')](_0x2d133a[_0x2eb3('0x37')],_0x2d133a[_0x2eb3('0x38')]);_0x21c7c9[_0x2eb3('0x3c')]=_[_0x2eb3('0x3a')](_0x2d133a['model'],qs['fields'](_0x415a75['query'][_0x2eb3('0x3b')]));_0x21c7c9[_0x2eb3('0x3c')]=_0x21c7c9[_0x2eb3('0x3c')][_0x2eb3('0x4d')]?_0x21c7c9[_0x2eb3('0x3c')]:_0x2d133a[_0x2eb3('0x37')];_0x21c7c9['limit']=qs[_0x2eb3('0x26')](_0x415a75['query'][_0x2eb3('0x26')]);_0x21c7c9[_0x2eb3('0x25')]=qs['offset'](_0x415a75['query'][_0x2eb3('0x25')]);_0x21c7c9[_0x2eb3('0x3e')]=qs[_0x2eb3('0x3f')](_0x415a75[_0x2eb3('0x38')][_0x2eb3('0x3f')]);_0x21c7c9[_0x2eb3('0x40')]=qs['filters'](_['pick'](_0x415a75[_0x2eb3('0x38')],_0x2d133a[_0x2eb3('0x41')]));_0x21c7c9=_[_0x2eb3('0x43')]({},_0x21c7c9,_0x415a75['options']);return _0xf71ec9[_0x2eb3('0x2e')+_[_0x2eb3('0x60')](_0x415a75[_0x2eb3('0x38')][_0x2eb3('0x5c')][_0x2eb3('0x5f')]())+_0x2eb3('0x61')](_0x21c7c9);})['then'](respondWithResult(_0x35dc51,null))['catch'](handleError(_0x35dc51,null));};exports[_0x2eb3('0x62')]=function(_0x38d28f,_0x4a716a,_0x44d0a8){return db['Team'][_0x2eb3('0x5b')]({'where':{'id':_0x38d28f[_0x2eb3('0x5a')]['id']}})[_0x2eb3('0x2c')](function(_0x3daa26){if(_0x3daa26){if(!_0x38d28f[_0x2eb3('0x50')]['channel']||!utils['isValidChannel'](_0x38d28f[_0x2eb3('0x50')]['channel'])){throw new db[(_0x2eb3('0x63'))][(_0x2eb3('0x5e'))](_0x2eb3('0x64'));}return _0x3daa26['add'+_[_0x2eb3('0x60')](_0x38d28f['body']['channel'][_0x2eb3('0x5f')]())+'Queues'](_0x38d28f[_0x2eb3('0x50')]['ids']);}return null;})['then'](handleEntityNotFound(_0x4a716a,null))['then'](respondWithStatusCode(_0x4a716a,null))[_0x2eb3('0x4b')](handleError(_0x4a716a,null));};exports['removeQueues']=function(_0x32218e,_0x104780,_0x496b95){return db[_0x2eb3('0x46')][_0x2eb3('0x5b')]({'where':{'id':_0x32218e[_0x2eb3('0x5a')]['id']}})[_0x2eb3('0x2c')](function(_0x54cae4){if(_0x54cae4){if(!_0x32218e[_0x2eb3('0x38')][_0x2eb3('0x5c')]||!utils['isValidChannel'](_0x32218e[_0x2eb3('0x38')][_0x2eb3('0x5c')])){throw new db[(_0x2eb3('0x63'))]['ValidationError'](_0x2eb3('0x64'));}return _0x54cae4[_0x2eb3('0x65')+_[_0x2eb3('0x60')](_0x32218e[_0x2eb3('0x38')][_0x2eb3('0x5c')]['toLowerCase']())+'Queues'](_0x32218e[_0x2eb3('0x38')][_0x2eb3('0x66')]);}return null;})[_0x2eb3('0x2c')](handleEntityNotFound(_0x104780,null))[_0x2eb3('0x2c')](respondWithStatusCode(_0x104780,null))['catch'](handleError(_0x104780,null));};exports['addAgents']=function(_0x19771d,_0x255a13,_0x2c9029){return db[_0x2eb3('0x46')]['find']({'where':{'id':_0x19771d['params']['id']}})[_0x2eb3('0x2c')](handleEntityNotFound(_0x255a13,null))['then'](function(_0x16e1cf){if(_0x16e1cf){var _0x4fb140=[_0x2eb3('0x67'),_0x2eb3('0x68'),_0x2eb3('0x69'),'Sms',_0x2eb3('0x6a'),_0x2eb3('0x6b'),'Whatsapp'];return BPromise[_0x2eb3('0x6c')](_0x4fb140,function(_0x47369a){return _0x16e1cf['get'+_0x47369a+_0x2eb3('0x61')]({'attributes':['id',_0x2eb3('0x31')]})[_0x2eb3('0x2c')](function(_0x4fb0c8){return BPromise['each'](_0x4fb0c8,function(_0x129603){return _0x129603[_0x2eb3('0x6d')](_0x19771d[_0x2eb3('0x50')][_0x2eb3('0x66')])[_0x2eb3('0x2c')](function(){if(_0x47369a===_0x2eb3('0x67')){return db[_0x2eb3('0x6e')][_0x2eb3('0x49')]({'where':{'id':_0x19771d[_0x2eb3('0x50')][_0x2eb3('0x66')]},'attributes':['id',_0x2eb3('0x31'),_0x2eb3('0x6f'),'voicePause',_0x2eb3('0x70')],'raw':!![]})[_0x2eb3('0x2c')](function(_0x42478f){return BPromise[_0x2eb3('0x6c')](_['filter'](_0x42478f,{'online':0x1}),function(_0x3ed0f5){return db[_0x2eb3('0x71')][_0x2eb3('0x72')]({'membername':_0x3ed0f5['name'],'UserId':_0x3ed0f5['id'],'queue_name':_0x129603[_0x2eb3('0x31')],'VoiceQueueId':_0x129603['id'],'interface':_['isNil'](_0x3ed0f5[_0x2eb3('0x70')])?util['format'](_0x2eb3('0x73'),_0x3ed0f5[_0x2eb3('0x31')]):_0x3ed0f5[_0x2eb3('0x70')],'paused':_0x3ed0f5[_0x2eb3('0x74')]||![],'penalty':0x0});});});}});});})['then'](function(){return _0x16e1cf;});})[_0x2eb3('0x2c')](function(){return _0x16e1cf;});}})[_0x2eb3('0x2c')](function(_0x549817){if(_0x549817){return _0x549817[_0x2eb3('0x6d')](_0x19771d[_0x2eb3('0x50')][_0x2eb3('0x66')],_[_0x2eb3('0x75')](_0x19771d[_0x2eb3('0x50')],['ids','id'])||{})[_0x2eb3('0x76')](function(_0x59415f){for(var _0x3cca12=0x0;_0x3cca12<_0x19771d[_0x2eb3('0x50')][_0x2eb3('0x66')][_0x2eb3('0x4d')];_0x3cca12+=0x1){socket[_0x2eb3('0x77')](_0x2eb3('0x78'),{'UserId':_0x19771d[_0x2eb3('0x50')][_0x2eb3('0x66')][_0x3cca12],'TeamId':_0x19771d[_0x2eb3('0x5a')]['id']});}return _0x59415f;});}})[_0x2eb3('0x2c')](respondWithResult(_0x255a13,null))['catch'](handleError(_0x255a13,null));};exports[_0x2eb3('0x79')]=function(_0x32a02,_0xa85f8a,_0x931eaf){return db[_0x2eb3('0x46')][_0x2eb3('0x4e')]({'where':{'id':_0x32a02[_0x2eb3('0x5a')]['id']}})[_0x2eb3('0x2c')](handleEntityNotFound(_0xa85f8a,null))[_0x2eb3('0x2c')](function(_0x2840f6){if(_0x2840f6){return BPromise[_0x2eb3('0x6c')]([_0x2eb3('0x7a'),_0x2eb3('0x7b'),_0x2eb3('0x7c'),_0x2eb3('0x7d'),_0x2eb3('0x7e'),'openchannel','whatsapp'],function(_0xdfd9c8){return _0x2840f6[_0x2eb3('0x2e')+_[_0x2eb3('0x60')](_0xdfd9c8)+_0x2eb3('0x61')]({'attributes':['id',_0x2eb3('0x31')]})[_0x2eb3('0x2c')](function(_0x32bede){return BPromise['each'](_0x32bede,function(_0x4fd7d0){return _0x4fd7d0[_0x2eb3('0x79')](_0x32a02[_0x2eb3('0x38')]['ids'])['then'](function(){if(_0xdfd9c8===_0x2eb3('0x7a')){return db[_0x2eb3('0x71')][_0x2eb3('0x2d')]({'where':{'VoiceQueueId':_0x4fd7d0['id'],'UserId':_0x32a02[_0x2eb3('0x38')]['ids']}});}});});})[_0x2eb3('0x2c')](function(){return _0x2840f6;});})[_0x2eb3('0x2c')](function(){return _0x2840f6;});}})[_0x2eb3('0x2c')](function(_0x30d95f){if(_0x30d95f){return _0x30d95f['removeAgents'](_0x32a02['query']['ids'])['then'](function(){if(_[_0x2eb3('0x7f')](_0x32a02[_0x2eb3('0x38')][_0x2eb3('0x66')])){for(var _0x4caf44=0x0;_0x4caf44<_0x32a02['query'][_0x2eb3('0x66')][_0x2eb3('0x4d')];_0x4caf44+=0x1){socket[_0x2eb3('0x77')](_0x2eb3('0x80'),{'UserId':Number(_0x32a02[_0x2eb3('0x38')][_0x2eb3('0x66')][_0x4caf44]),'TeamId':Number(_0x32a02[_0x2eb3('0x5a')]['id'])});}}else{socket[_0x2eb3('0x77')]('userTeam:remove',{'UserId':Number(_0x32a02[_0x2eb3('0x38')][_0x2eb3('0x66')]),'TeamId':Number(_0x32a02[_0x2eb3('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0xa85f8a,null))[_0x2eb3('0x4b')](handleError(_0xa85f8a,null));};exports[_0x2eb3('0x81')]=function(_0x200fd0,_0x43657b,_0x33a41d){var _0x49adba={};var _0x3f6147={};var _0x4d7cd5;var _0x2e48ec;return db[_0x2eb3('0x46')][_0x2eb3('0x5b')]({'where':{'id':_0x200fd0[_0x2eb3('0x5a')]['id']}})[_0x2eb3('0x2c')](handleEntityNotFound(_0x43657b,null))[_0x2eb3('0x2c')](function(_0xd35316){if(_0xd35316){_0x4d7cd5=_0xd35316;_0x3f6147['model']=_[_0x2eb3('0x39')](db[_0x2eb3('0x6e')][_0x2eb3('0x34')]);_0x3f6147[_0x2eb3('0x38')]=_[_0x2eb3('0x39')](_0x200fd0[_0x2eb3('0x38')]);_0x3f6147[_0x2eb3('0x41')]=_['intersection'](_0x3f6147[_0x2eb3('0x37')],_0x3f6147[_0x2eb3('0x38')]);_0x49adba['attributes']=_[_0x2eb3('0x3a')](_0x3f6147[_0x2eb3('0x37')],qs['fields'](_0x200fd0[_0x2eb3('0x38')]['fields']));_0x49adba[_0x2eb3('0x3c')]=_0x49adba[_0x2eb3('0x3c')][_0x2eb3('0x4d')]?_0x49adba[_0x2eb3('0x3c')]:_0x3f6147[_0x2eb3('0x37')];_0x49adba[_0x2eb3('0x3e')]=qs[_0x2eb3('0x3f')](_0x200fd0[_0x2eb3('0x38')]['sort']);_0x49adba[_0x2eb3('0x40')]=qs['filters'](_[_0x2eb3('0x42')](_0x200fd0[_0x2eb3('0x38')],_0x3f6147['filters']));if(_0x200fd0[_0x2eb3('0x38')]['filter']){_0x49adba[_0x2eb3('0x40')]=_[_0x2eb3('0x43')](_0x49adba[_0x2eb3('0x40')],{'$or':_[_0x2eb3('0x33')](_0x49adba['attributes'],function(_0x59936a){var _0x5c7ac6={};_0x5c7ac6[_0x59936a]={'$like':'%'+_0x200fd0['query'][_0x2eb3('0x82')]+'%'};return _0x5c7ac6;})});}_0x49adba=_[_0x2eb3('0x43')]({},_0x49adba,_0x200fd0['options']);return _0x4d7cd5[_0x2eb3('0x81')](_0x49adba);}})['then'](function(_0xd2f538){if(_0xd2f538){_0x2e48ec=_0xd2f538[_0x2eb3('0x4d')];if(!_0x200fd0[_0x2eb3('0x38')][_0x2eb3('0x3d')](_0x2eb3('0x83'))){_0x49adba[_0x2eb3('0x26')]=qs[_0x2eb3('0x26')](_0x200fd0[_0x2eb3('0x38')][_0x2eb3('0x26')]);_0x49adba[_0x2eb3('0x25')]=qs['offset'](_0x200fd0[_0x2eb3('0x38')][_0x2eb3('0x25')]);}return _0x4d7cd5[_0x2eb3('0x81')](_0x49adba);}})[_0x2eb3('0x2c')](function(_0x5995d6){if(_0x5995d6){return _0x5995d6?{'count':_0x2e48ec,'rows':_0x5995d6}:null;}})[_0x2eb3('0x2c')](respondWithResult(_0x43657b,null))[_0x2eb3('0x4b')](handleError(_0x43657b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 62ed481..b3d70bd 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 _0x5de5=['exports','Team','setMaxListeners','save','update','remove','emit'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x5de5,0x6a));var _0x55de=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5de5[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x55de('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x55de('0x1')](0x0);var events={'afterCreate':_0x55de('0x2'),'afterUpdate':_0x55de('0x3'),'afterDestroy':_0x55de('0x4')};function emitEvent(_0x566cf4){return function(_0x597692,_0x36b646,_0x54ed99){TeamEvents['emit'](_0x566cf4+':'+_0x597692['id'],_0x597692);TeamEvents[_0x55de('0x5')](_0x566cf4,_0x597692);_0x54ed99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x55de('0x6')]=TeamEvents; \ No newline at end of file +var _0xd7d3=['hasOwnProperty','hook','exports','events','../../mysqldb','Team','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd7d3,0x1b3));var _0x3d7d=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0xd7d3[_0x466247];return _0x4b352e;};'use strict';var EventEmitter=require(_0x3d7d('0x0'));var Team=require(_0x3d7d('0x1'))['db'][_0x3d7d('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3d7d('0x3'),'afterUpdate':_0x3d7d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3116bd){return function(_0xb0b31c,_0x49d36c,_0x1aa31f){TeamEvents[_0x3d7d('0x5')](_0x3116bd+':'+_0xb0b31c['id'],_0xb0b31c);TeamEvents[_0x3d7d('0x5')](_0x3116bd,_0xb0b31c);_0x1aa31f(null);};}for(var e in events){if(events[_0x3d7d('0x6')](e)){var event=events[e];Team[_0x3d7d('0x7')](e,emitEvent(event));}}module[_0x3d7d('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 7442969..544a32b 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 _0x2b29=['bluebird','request-promise','path','rimraf','../../config/environment','define','Team','teams','lodash','util','api'];(function(_0x23e5d9,_0xf3db15){var _0x9f9065=function(_0x5c87d0){while(--_0x5c87d0){_0x23e5d9['push'](_0x23e5d9['shift']());}};_0x9f9065(++_0xf3db15);}(_0x2b29,0x1e1));var _0x92b2=function(_0x5f0149,_0x67957d){_0x5f0149=_0x5f0149-0x0;var _0x42da19=_0x2b29[_0x5f0149];return _0x42da19;};'use strict';var _=require(_0x92b2('0x0'));var util=require(_0x92b2('0x1'));var logger=require('../../config/logger')(_0x92b2('0x2'));var moment=require('moment');var BPromise=require(_0x92b2('0x3'));var rp=require(_0x92b2('0x4'));var fs=require('fs');var path=require(_0x92b2('0x5'));var rimraf=require(_0x92b2('0x6'));var config=require(_0x92b2('0x7'));var attributes=require('./team.attributes');module['exports']=function(_0x55090e,_0x3e2930){return _0x55090e[_0x92b2('0x8')](_0x92b2('0x9'),attributes,{'tableName':_0x92b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa426=['exports','Team','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./team.attributes'];(function(_0x34f277,_0x3b09dc){var _0x2066ca=function(_0xbaa6b5){while(--_0xbaa6b5){_0x34f277['push'](_0x34f277['shift']());}};_0x2066ca(++_0x3b09dc);}(_0xa426,0x17e));var _0x6a42=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xa426[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x6a42('0x0'));var util=require(_0x6a42('0x1'));var logger=require(_0x6a42('0x2'))(_0x6a42('0x3'));var moment=require('moment');var BPromise=require(_0x6a42('0x4'));var rp=require(_0x6a42('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6a42('0x6'));var attributes=require(_0x6a42('0x7'));module[_0x6a42('0x8')]=function(_0x57881f,_0x276ff){return _0x57881f['define'](_0x6a42('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 1fffc47..34363a7 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 _0x935e=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x935e,0x9a));var _0xe935=function(_0x47b4b3,_0x32efb9){_0x47b4b3=_0x47b4b3-0x0;var _0x463180=_0x935e[_0x47b4b3];return _0x463180;};'use strict';var _=require(_0xe935('0x0'));var util=require(_0xe935('0x1'));var moment=require(_0xe935('0x2'));var BPromise=require(_0xe935('0x3'));var rs=require(_0xe935('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe935('0x5'))['db'];var utils=require(_0xe935('0x6'));var logger=require(_0xe935('0x7'))(_0xe935('0x8'));var config=require(_0xe935('0x9'));var jayson=require(_0xe935('0xa'));var client=jayson[_0xe935('0xb')]['http']({'port':0x232a});config[_0xe935('0xc')]=_['defaults'](config[_0xe935('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')[_0xe935('0xd')](socket);function respondWithRpcPromise(_0x596167,_0x3fc729,_0x4db099){return new BPromise(function(_0x11f3d5,_0x1a6011){return client[_0xe935('0xe')](_0x596167,_0x4db099)[_0xe935('0xf')](function(_0x2acd8c){logger[_0xe935('0x10')](_0xe935('0x11'),_0x3fc729,_0xe935('0x12'));logger[_0xe935('0x13')](_0xe935('0x14'),_0x3fc729,_0xe935('0x12'),JSON[_0xe935('0x15')](_0x2acd8c));if(_0x2acd8c[_0xe935('0x16')]){if(_0x2acd8c[_0xe935('0x16')]['code']===0x1f4){logger[_0xe935('0x16')](_0xe935('0x11'),_0x3fc729,_0x2acd8c[_0xe935('0x16')][_0xe935('0x17')]);return _0x1a6011(_0x2acd8c[_0xe935('0x16')][_0xe935('0x17')]);}logger[_0xe935('0x16')](_0xe935('0x11'),_0x3fc729,_0x2acd8c['error']['message']);return _0x11f3d5(_0x2acd8c['error'][_0xe935('0x17')]);}else{logger[_0xe935('0x10')](_0xe935('0x11'),_0x3fc729,_0xe935('0x12'));_0x11f3d5(_0x2acd8c[_0xe935('0x18')]['message']);}})[_0xe935('0x19')](function(_0x49dc41){logger['error'](_0xe935('0x11'),_0x3fc729,_0x49dc41);_0x1a6011(_0x49dc41);});});} \ No newline at end of file +var _0x7922=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x7922,0x1aa));var _0x2792=function(_0x29d16c,_0x4b8dc4){_0x29d16c=_0x29d16c-0x0;var _0x1960d5=_0x7922[_0x29d16c];return _0x1960d5;};'use strict';var _=require(_0x2792('0x0'));var util=require(_0x2792('0x1'));var moment=require(_0x2792('0x2'));var BPromise=require('bluebird');var rs=require(_0x2792('0x3'));var fs=require('fs');var Redis=require(_0x2792('0x4'));var db=require(_0x2792('0x5'))['db'];var utils=require(_0x2792('0x6'));var logger=require(_0x2792('0x7'))(_0x2792('0x8'));var config=require(_0x2792('0x9'));var jayson=require(_0x2792('0xa'));var client=jayson[_0x2792('0xb')][_0x2792('0xc')]({'port':0x232a});config[_0x2792('0xd')]=_[_0x2792('0xe')](config[_0x2792('0xd')],{'host':_0x2792('0xf'),'port':0x18eb});var socket=require(_0x2792('0x10'))(new Redis(config[_0x2792('0xd')]));require(_0x2792('0x11'))['register'](socket);function respondWithRpcPromise(_0x5f3cdf,_0x44bc61,_0x171429){return new BPromise(function(_0x2a3b59,_0x386069){return client[_0x2792('0x12')](_0x5f3cdf,_0x171429)[_0x2792('0x13')](function(_0x6a70b3){logger[_0x2792('0x14')](_0x2792('0x15'),_0x44bc61,_0x2792('0x16'));logger['debug'](_0x2792('0x17'),_0x44bc61,_0x2792('0x16'),JSON['stringify'](_0x6a70b3));if(_0x6a70b3[_0x2792('0x18')]){if(_0x6a70b3[_0x2792('0x18')][_0x2792('0x19')]===0x1f4){logger[_0x2792('0x18')]('Team,\x20%s,\x20%s',_0x44bc61,_0x6a70b3[_0x2792('0x18')][_0x2792('0x1a')]);return _0x386069(_0x6a70b3[_0x2792('0x18')][_0x2792('0x1a')]);}logger[_0x2792('0x18')](_0x2792('0x15'),_0x44bc61,_0x6a70b3[_0x2792('0x18')][_0x2792('0x1a')]);return _0x2a3b59(_0x6a70b3[_0x2792('0x18')][_0x2792('0x1a')]);}else{logger['info'](_0x2792('0x15'),_0x44bc61,'request\x20sent');_0x2a3b59(_0x6a70b3[_0x2792('0x1b')]['message']);}})[_0x2792('0x1c')](function(_0x46451d){logger['error'](_0x2792('0x15'),_0x44bc61,_0x46451d);_0x386069(_0x46451d);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 598ce5f..a3cb4bc 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 _0xf1c6=['removeListener','register','length','team:','./team.events','save','remove','update'];(function(_0x31aa0f,_0x42ef74){var _0x3a307b=function(_0x2cae11){while(--_0x2cae11){_0x31aa0f['push'](_0x31aa0f['shift']());}};_0x3a307b(++_0x42ef74);}(_0xf1c6,0xf4));var _0x6f1c=function(_0x31d1f1,_0xeec92){_0x31d1f1=_0x31d1f1-0x0;var _0x5ede69=_0xf1c6[_0x31d1f1];return _0x5ede69;};'use strict';var TeamEvents=require(_0x6f1c('0x0'));var events=[_0x6f1c('0x1'),_0x6f1c('0x2'),_0x6f1c('0x3')];function createListener(_0x381044,_0x17a05a){return function(_0x15b146){_0x17a05a['emit'](_0x381044,_0x15b146);};}function removeListener(_0x3747f8,_0x2c875e){return function(){TeamEvents[_0x6f1c('0x4')](_0x3747f8,_0x2c875e);};}exports[_0x6f1c('0x5')]=function(_0x4fd3fc){for(var _0x57bb67=0x0,_0x1a3460=events[_0x6f1c('0x6')];_0x57bb67<_0x1a3460;_0x57bb67++){var _0x3f7b30=events[_0x57bb67];var _0x2efcb5=createListener(_0x6f1c('0x7')+_0x3f7b30,_0x4fd3fc);TeamEvents['on'](_0x3f7b30,_0x2efcb5);}}; \ No newline at end of file +var _0xba18=['./team.events','save','remove','update','emit','removeListener','register'];(function(_0x5babe5,_0x5413aa){var _0x9e6e0=function(_0x2a0254){while(--_0x2a0254){_0x5babe5['push'](_0x5babe5['shift']());}};_0x9e6e0(++_0x5413aa);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0x8ba1('0x0'));var events=[_0x8ba1('0x1'),_0x8ba1('0x2'),_0x8ba1('0x3')];function createListener(_0x4070cc,_0x46f8c7){return function(_0x25144d){_0x46f8c7[_0x8ba1('0x4')](_0x4070cc,_0x25144d);};}function removeListener(_0x59c54c,_0xe3bc16){return function(){TeamEvents[_0x8ba1('0x5')](_0x59c54c,_0xe3bc16);};}exports[_0x8ba1('0x6')]=function(_0x2a9dab){for(var _0x3b107c=0x0,_0x2ffa15=events['length'];_0x3b107c<_0x2ffa15;_0x3b107c++){var _0x3a87eb=events[_0x3b107c];var _0x3d1fe7=createListener('team:'+_0x3a87eb,_0x2a9dab);TeamEvents['on'](_0x3a87eb,_0x3d1fe7);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 05aa138..83c6166 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafbc=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router'];(function(_0x3de906,_0x5c33fa){var _0x2e1a48=function(_0x5373b4){while(--_0x5373b4){_0x3de906['push'](_0x3de906['shift']());}};_0x2e1a48(++_0x5c33fa);}(_0xafbc,0xa6));var _0xcafb=function(_0x2e6360,_0x320a4f){_0x2e6360=_0x2e6360-0x0;var _0x2b0b07=_0xafbc[_0x2e6360];return _0x2b0b07;};'use strict';var multer=require(_0xcafb('0x0'));var util=require('util');var path=require(_0xcafb('0x1'));var timeout=require(_0xcafb('0x2'));var express=require(_0xcafb('0x3'));var router=express[_0xcafb('0x4')]();var auth=require(_0xcafb('0x5'));var interaction=require(_0xcafb('0x6'));var config=require(_0xcafb('0x7'));module[_0xcafb('0x8')]=router; \ No newline at end of file +var _0x9da3=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x9da3,0x17a));var _0x39da=function(_0x327cdb,_0x596cc7){_0x327cdb=_0x327cdb-0x0;var _0x25516e=_0x9da3[_0x327cdb];return _0x25516e;};'use strict';var multer=require(_0x39da('0x0'));var util=require(_0x39da('0x1'));var path=require(_0x39da('0x2'));var timeout=require(_0x39da('0x3'));var express=require(_0x39da('0x4'));var router=express['Router']();var auth=require(_0x39da('0x5'));var interaction=require(_0x39da('0x6'));var config=require(_0x39da('0x7'));module[_0x39da('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index bd06b6d..a25e6af 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x57b7f9,_0x45a8e4){var _0x2cc4fe=function(_0x5dcbdf){while(--_0x5dcbdf){_0x57b7f9['push'](_0x57b7f9['shift']());}};_0x2cc4fe(++_0x45a8e4);}(_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 _0xbaf0=['exports','INTEGER'];(function(_0x33feca,_0x2bd9ae){var _0x3c558f=function(_0x11bede){while(--_0x11bede){_0x33feca['push'](_0x33feca['shift']());}};_0x3c558f(++_0x2bd9ae);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 2958e4e..6e2d2e3 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95c4=['./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues','lodash','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x95c4,0x86));var _0x495c=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x95c4[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x495c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x495c('0x1'));var BPromise=require(_0x495c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x495c('0x3'));var rimraf=require(_0x495c('0x4'));var config=require(_0x495c('0x5'));var attributes=require(_0x495c('0x6'));module[_0x495c('0x7')]=function(_0x4424c7,_0x16ecde){return _0x4424c7['define'](_0x495c('0x8'),attributes,{'tableName':_0x495c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa9f=['./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x182bdf,_0x1fb709){var _0x2b7f42=function(_0x58401a){while(--_0x58401a){_0x182bdf['push'](_0x182bdf['shift']());}};_0x2b7f42(++_0x1fb709);}(_0xaa9f,0x1bd));var _0xfaa9=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0xaa9f[_0x5b27da];return _0x3254f4;};'use strict';var _=require(_0xfaa9('0x0'));var util=require('util');var logger=require(_0xfaa9('0x1'))(_0xfaa9('0x2'));var moment=require(_0xfaa9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfaa9('0x4'));var rimraf=require(_0xfaa9('0x5'));var config=require('../../config/environment');var attributes=require(_0xfaa9('0x6'));module[_0xfaa9('0x7')]=function(_0xd34b7,_0x3d3d9d){return _0xd34b7[_0xfaa9('0x8')](_0xfaa9('0x9'),attributes,{'tableName':_0xfaa9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 3e84030..0d18d91 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6734=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5bb5ab,_0x4ae6ee){var _0x20cd05=function(_0xeb61f1){while(--_0xeb61f1){_0x5bb5ab['push'](_0x5bb5ab['shift']());}};_0x20cd05(++_0x4ae6ee);}(_0x6734,0x86));var _0x4673=function(_0x19ef2b,_0x354f66){_0x19ef2b=_0x19ef2b-0x0;var _0x4df537=_0x6734[_0x19ef2b];return _0x4df537;};'use strict';var _=require(_0x4673('0x0'));var util=require(_0x4673('0x1'));var moment=require(_0x4673('0x2'));var BPromise=require(_0x4673('0x3'));var rs=require(_0x4673('0x4'));var fs=require('fs');var Redis=require(_0x4673('0x5'));var db=require(_0x4673('0x6'))['db'];var utils=require(_0x4673('0x7'));var logger=require(_0x4673('0x8'))(_0x4673('0x9'));var config=require('../../config/environment');var jayson=require(_0x4673('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31ead4,_0x16f55,_0x34d4ef){return new BPromise(function(_0xdf9f7e,_0x41e2a3){return client['request'](_0x31ead4,_0x34d4ef)[_0x4673('0xb')](function(_0xd69a16){logger[_0x4673('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x16f55,_0x4673('0xd'));logger[_0x4673('0xe')](_0x4673('0xf'),_0x16f55,'request\x20sent',JSON[_0x4673('0x10')](_0xd69a16));if(_0xd69a16[_0x4673('0x11')]){if(_0xd69a16[_0x4673('0x11')][_0x4673('0x12')]===0x1f4){logger[_0x4673('0x11')](_0x4673('0x13'),_0x16f55,_0xd69a16[_0x4673('0x11')]['message']);return _0x41e2a3(_0xd69a16[_0x4673('0x11')][_0x4673('0x14')]);}logger[_0x4673('0x11')](_0x4673('0x13'),_0x16f55,_0xd69a16[_0x4673('0x11')][_0x4673('0x14')]);return _0xdf9f7e(_0xd69a16[_0x4673('0x11')][_0x4673('0x14')]);}else{logger[_0x4673('0xc')](_0x4673('0x13'),_0x16f55,_0x4673('0xd'));_0xdf9f7e(_0xd69a16[_0x4673('0x15')][_0x4673('0x14')]);}})[_0x4673('0x16')](function(_0x23bba6){logger[_0x4673('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x16f55,_0x23bba6);_0x41e2a3(_0x23bba6);});});} \ No newline at end of file +var _0xc8d8=['lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x28a147,_0x38539c){var _0x3cf2b9=function(_0x28ad08){while(--_0x28ad08){_0x28a147['push'](_0x28a147['shift']());}};_0x3cf2b9(++_0x38539c);}(_0xc8d8,0x1ce));var _0x8c8d=function(_0x36d8d9,_0x17b58a){_0x36d8d9=_0x36d8d9-0x0;var _0x1ac3a2=_0xc8d8[_0x36d8d9];return _0x1ac3a2;};'use strict';var _=require(_0x8c8d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8c8d('0x1'));var rs=require(_0x8c8d('0x2'));var fs=require('fs');var Redis=require(_0x8c8d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c8d('0x4'));var logger=require(_0x8c8d('0x5'))('rpc');var config=require(_0x8c8d('0x6'));var jayson=require(_0x8c8d('0x7'));var client=jayson['client'][_0x8c8d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b8b69,_0x594ead,_0x3954ec){return new BPromise(function(_0x5285ac,_0x56cdc8){return client[_0x8c8d('0x9')](_0x5b8b69,_0x3954ec)[_0x8c8d('0xa')](function(_0x315543){logger[_0x8c8d('0xb')](_0x8c8d('0xc'),_0x594ead,'request\x20sent');logger[_0x8c8d('0xd')](_0x8c8d('0xe'),_0x594ead,_0x8c8d('0xf'),JSON[_0x8c8d('0x10')](_0x315543));if(_0x315543['error']){if(_0x315543[_0x8c8d('0x11')][_0x8c8d('0x12')]===0x1f4){logger[_0x8c8d('0x11')](_0x8c8d('0xc'),_0x594ead,_0x315543[_0x8c8d('0x11')][_0x8c8d('0x13')]);return _0x56cdc8(_0x315543[_0x8c8d('0x11')]['message']);}logger[_0x8c8d('0x11')](_0x8c8d('0xc'),_0x594ead,_0x315543[_0x8c8d('0x11')][_0x8c8d('0x13')]);return _0x5285ac(_0x315543[_0x8c8d('0x11')][_0x8c8d('0x13')]);}else{logger[_0x8c8d('0xb')](_0x8c8d('0xc'),_0x594ead,_0x8c8d('0xf'));_0x5285ac(_0x315543[_0x8c8d('0x14')][_0x8c8d('0x13')]);}})[_0x8c8d('0x15')](function(_0x216261){logger[_0x8c8d('0x11')](_0x8c8d('0xc'),_0x594ead,_0x216261);_0x56cdc8(_0x216261);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 5106d09..35cfd7a 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 _0x9771=['delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x9771,0x1e3));var _0x1977=function(_0x81ad07,_0x4f570e){_0x81ad07=_0x81ad07-0x0;var _0x201b21=_0x9771[_0x81ad07];return _0x201b21;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1977('0x0'));var timeout=require(_0x1977('0x1'));var express=require(_0x1977('0x2'));var router=express['Router']();var auth=require(_0x1977('0x3'));var interaction=require(_0x1977('0x4'));var config=require(_0x1977('0x5'));var controller=require('./template.controller');router[_0x1977('0x6')]('/',auth[_0x1977('0x7')](),controller[_0x1977('0x8')]);router[_0x1977('0x6')](_0x1977('0x9'),auth[_0x1977('0x7')](),controller['show']);router[_0x1977('0xa')]('/',auth['isAuthenticated'](),controller[_0x1977('0xb')]);router[_0x1977('0xc')](_0x1977('0x9'),auth[_0x1977('0x7')](),controller['update']);router[_0x1977('0xd')](_0x1977('0x9'),auth[_0x1977('0x7')](),controller[_0x1977('0xe')]);module[_0x1977('0xf')]=router; \ No newline at end of file +var _0xb72a=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x240504,_0x2290d7){var _0x486e27=function(_0x13e691){while(--_0x13e691){_0x240504['push'](_0x240504['shift']());}};_0x486e27(++_0x2290d7);}(_0xb72a,0x69));var _0xab72=function(_0xdb2d77,_0x57b26e){_0xdb2d77=_0xdb2d77-0x0;var _0x503c56=_0xb72a[_0xdb2d77];return _0x503c56;};'use strict';var multer=require('multer');var util=require(_0xab72('0x0'));var path=require('path');var timeout=require(_0xab72('0x1'));var express=require(_0xab72('0x2'));var router=express[_0xab72('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xab72('0x4'));var config=require(_0xab72('0x5'));var controller=require(_0xab72('0x6'));router[_0xab72('0x7')]('/',auth[_0xab72('0x8')](),controller['index']);router[_0xab72('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xab72('0x9')]);router[_0xab72('0xa')]('/',auth[_0xab72('0x8')](),controller[_0xab72('0xb')]);router[_0xab72('0xc')](_0xab72('0xd'),auth[_0xab72('0x8')](),controller[_0xab72('0xe')]);router['delete'](_0xab72('0xd'),auth[_0xab72('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 63ce96e..1f0ae7d 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 _0x8eb0=['STRING'];(function(_0x4f3da5,_0x442069){var _0x259a2d=function(_0x15ecc0){while(--_0x15ecc0){_0x4f3da5['push'](_0x4f3da5['shift']());}};_0x259a2d(++_0x442069);}(_0x8eb0,0x96));var _0x08eb=function(_0x2cab94,_0x5abbc2){_0x2cab94=_0x2cab94-0x0;var _0x4222e7=_0x8eb0[_0x2cab94];return _0x4222e7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x08eb('0x0')]},'description':{'type':Sequelize[_0x08eb('0x0')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd3a6=['exports','STRING','TEXT','sequelize'];(function(_0x57cc22,_0x2d351f){var _0x6f7bdc=function(_0x4935b5){while(--_0x4935b5){_0x57cc22['push'](_0x57cc22['shift']());}};_0x6f7bdc(++_0x2d351f);}(_0xd3a6,0xd7));var _0x6d3a=function(_0x11eeea,_0x1f8dbd){_0x11eeea=_0x11eeea-0x0;var _0xed5c03=_0xd3a6[_0x11eeea];return _0xed5c03;};'use strict';var Sequelize=require(_0x6d3a('0x0'));module[_0x6d3a('0x1')]={'name':{'type':Sequelize[_0x6d3a('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x6d3a('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index f2d1c80..84f81fb 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(_0x61286b,_0x4b20e3){var _0x2a3b3d=function(_0x4fd856){while(--_0x4fd856){_0x61286b['push'](_0x61286b['shift']());}};_0x2a3b3d(++_0x4b20e3);}(_0xe14b,0x93));var _0xbe14=function(_0x35b57d,_0x3fc6ac){_0x35b57d=_0x35b57d-0x0;var _0x3c164c=_0xe14b[_0x35b57d];return _0x3c164c;};'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 _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(_0x96e05f,_0x59e327){var _0xd1514e=function(_0x35da41){while(--_0x35da41){_0x96e05f['push'](_0x96e05f['shift']());}};_0xd1514e(++_0x59e327);}(_0xe14b,0x93));var _0xbe14=function(_0x20a415,_0x2d3da5){_0x20a415=_0x20a415-0x0;var _0x12bf8f=_0xe14b[_0x20a415];return _0x12bf8f;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=_0xf4ac9[_0xbe14('0x19')],_0x4e8f34=_0x3dc4a9[_0xbe14('0x1a')],_0x21c789=_0x3dc4a9[_0xbe14('0x1a')]+_0x3dc4a9[_0xbe14('0x1b')],_0xe9c3ec;if(_0x21c789>=_0x37ce4e){_0x21c789=_0x37ce4e;_0xe9c3ec=0xc8;}else{_0xe9c3ec=0xce;}_0x3f58f5[_0xbe14('0x17')](_0xe9c3ec);return _0x3f58f5['set'](_0xbe14('0x1c'),_0x4e8f34+'-'+_0x21c789+'/'+_0x37ce4e)[_0xbe14('0x1d')](_0xf4ac9);}return null;};}function patchUpdates(_0x329588){return function(_0x433459){try{jsonpatch[_0xbe14('0x1e')](_0x433459,_0x329588,!![]);}catch(_0x37e4c1){return BPromise['reject'](_0x37e4c1);}return _0x433459[_0xbe14('0x1f')]();};}function saveUpdates(_0x4a1bbd,_0x417c8d){return function(_0xc12977){if(_0xc12977){return _0xc12977[_0xbe14('0x20')](_0x4a1bbd)['then'](function(_0xe60f42){return _0xe60f42;});}return null;};}function removeEntity(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')]()['then'](function(){var _0x274018=_0x56e80c[_0xbe14('0x22')]({'plain':!![]});var _0x505dbd=_0xbe14('0x23');return db['UserProfileResource'][_0xbe14('0x21')]({'where':{'type':_0x505dbd,'resourceId':_0x274018['id']}})['then'](function(){return _0x56e80c;});})[_0xbe14('0x24')](function(){_0x56d845[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x39cc81,_0x15ef02){return function(_0x2703f5){if(!_0x2703f5){_0x39cc81['sendStatus'](0x194);}return _0x2703f5;};}function handleError(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0x1f4;return function(_0x391556){logger[_0xbe14('0x25')](_0x391556['stack']);if(_0x391556[_0xbe14('0x26')]){delete _0x391556[_0xbe14('0x26')];}_0x1822e0['status'](_0x1ba46a)[_0xbe14('0x27')](_0x391556);};}exports[_0xbe14('0x28')]=function(_0x1c7cc7,_0x19252f){var _0x34d648={},_0x36d4b2={},_0x31a664={'count':0x0,'rows':[]};var _0x2b05cb=_[_0xbe14('0x29')](db[_0xbe14('0x2a')][_0xbe14('0x2b')],function(_0x3bf43c){return{'name':_0x3bf43c[_0xbe14('0x2c')],'type':_0x3bf43c[_0xbe14('0x2d')][_0xbe14('0x2e')]};});_0x36d4b2[_0xbe14('0x2f')]=_[_0xbe14('0x29')](_0x2b05cb,_0xbe14('0x26'));_0x36d4b2[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x1c7cc7['query']);_0x36d4b2[_0xbe14('0x32')]=_['intersection'](_0x36d4b2['model'],_0x36d4b2[_0xbe14('0x30')]);_0x34d648['attributes']=_[_0xbe14('0x33')](_0x36d4b2[_0xbe14('0x2f')],qs['fields'](_0x1c7cc7['query']['fields']));_0x34d648[_0xbe14('0x34')]=_0x34d648[_0xbe14('0x34')]['length']?_0x34d648[_0xbe14('0x34')]:_0x36d4b2[_0xbe14('0x2f')];if(!_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x34d648['limit']=qs['limit'](_0x1c7cc7[_0xbe14('0x30')]['limit']);_0x34d648['offset']=qs['offset'](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x1a')]);}_0x34d648[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x38')]);_0x34d648[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x1c7cc7[_0xbe14('0x30')],_0x36d4b2[_0xbe14('0x32')]),_0x2b05cb);if(_0x1c7cc7[_0xbe14('0x30')]['filter']){_0x34d648['where']=_[_0xbe14('0x3b')](_0x34d648[_0xbe14('0x39')],{'$or':_[_0xbe14('0x29')](_0x2b05cb,function(_0x520e09){if(_0x520e09[_0xbe14('0x2d')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x26')]]={'$like':'%'+_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x34d648=_[_0xbe14('0x3b')]({},_0x34d648,_0x1c7cc7[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x34d648['where']};return db[_0xbe14('0x2a')][_0xbe14('0x19')](_0x1b2608)[_0xbe14('0x24')](function(_0x1b3118){_0x31a664[_0xbe14('0x19')]=_0x1b3118;if(_0x1c7cc7[_0xbe14('0x30')]['includeAll']){_0x34d648[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2a')][_0xbe14('0x40')](_0x34d648);})[_0xbe14('0x24')](function(_0x5cf713){_0x31a664['rows']=_0x5cf713;return _0x31a664;})[_0xbe14('0x24')](respondWithFilteredResult(_0x19252f,_0x34d648))[_0xbe14('0x41')](handleError(_0x19252f,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':!![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2f')]=_[_0xbe14('0x31')](db[_0xbe14('0x2a')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2f')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['Template'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x24')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['Template']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x24')](function(_0x4a1a37){var _0x5acf90=_0x2d6ee8[_0xbe14('0x49')][_0xbe14('0x22')]({'plain':!![]});if(!_0x5acf90)throw new Error(_0xbe14('0x4a'));if(_0x5acf90[_0xbe14('0x4b')]===_0xbe14('0x49')){var _0xd04fd5=_0x4a1a37[_0xbe14('0x22')]({'plain':!![]});var _0x5a4068=_0xbe14('0x23');return db[_0xbe14('0x4c')][_0xbe14('0x46')]({'where':{'name':_0x5a4068,'userProfileId':_0x5acf90[_0xbe14('0x4d')]},'raw':!![]})[_0xbe14('0x24')](function(_0x494c32){if(_0x494c32&&_0x494c32[_0xbe14('0x4e')]===0x0){return db[_0xbe14('0x4f')][_0xbe14('0x47')]({'name':_0xd04fd5[_0xbe14('0x26')],'resourceId':_0xd04fd5['id'],'type':_0x494c32[_0xbe14('0x26')],'sectionId':_0x494c32['id']},{})[_0xbe14('0x24')](function(){return _0x4a1a37;});}else{return _0x4a1a37;}})['catch'](function(_0x5aeea9){logger[_0xbe14('0x25')](_0xbe14('0x50'),_0x5aeea9);throw _0x5aeea9;});}return _0x4a1a37;})[_0xbe14('0x24')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0x44fe0d,_0x134878){if(_0x44fe0d['body']['id']){delete _0x44fe0d[_0xbe14('0x48')]['id'];}return db[_0xbe14('0x2a')]['find']({'where':{'id':_0x44fe0d[_0xbe14('0x51')]['id']}})['then'](handleEntityNotFound(_0x134878,null))[_0xbe14('0x24')](saveUpdates(_0x44fe0d[_0xbe14('0x48')],null))[_0xbe14('0x24')](respondWithResult(_0x134878,null))['catch'](handleError(_0x134878,null));};exports[_0xbe14('0x21')]=function(_0x404212,_0x5dc78a){return db[_0xbe14('0x2a')][_0xbe14('0x46')]({'where':{'id':_0x404212[_0xbe14('0x51')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x5dc78a,null))[_0xbe14('0x24')](removeEntity(_0x5dc78a,null))['catch'](handleError(_0x5dc78a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index f6491ba..b544423 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 _0xf83a=['./template.attributes','exports','define','tools_templates','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf83a,0xe0));var _0xaf83=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xf83a[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0xaf83('0x0'));var util=require(_0xaf83('0x1'));var logger=require(_0xaf83('0x2'))('api');var moment=require(_0xaf83('0x3'));var BPromise=require(_0xaf83('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf83('0x5'));var rimraf=require('rimraf');var config=require(_0xaf83('0x6'));var attributes=require(_0xaf83('0x7'));module[_0xaf83('0x8')]=function(_0x5d25d2,_0x14667e){return _0x5d25d2[_0xaf83('0x9')]('Template',attributes,{'tableName':_0xaf83('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1812=['../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1d0948,_0x29a5ad){var _0x405614=function(_0x1ac2af){while(--_0x1ac2af){_0x1d0948['push'](_0x1d0948['shift']());}};_0x405614(++_0x29a5ad);}(_0x1812,0x9f));var _0x2181=function(_0x353fd0,_0x3528f4){_0x353fd0=_0x353fd0-0x0;var _0x480fc4=_0x1812[_0x353fd0];return _0x480fc4;};'use strict';var _=require(_0x2181('0x0'));var util=require(_0x2181('0x1'));var logger=require(_0x2181('0x2'))(_0x2181('0x3'));var moment=require(_0x2181('0x4'));var BPromise=require(_0x2181('0x5'));var rp=require(_0x2181('0x6'));var fs=require('fs');var path=require(_0x2181('0x7'));var rimraf=require(_0x2181('0x8'));var config=require(_0x2181('0x9'));var attributes=require(_0x2181('0xa'));module['exports']=function(_0xc546e6,_0x30bac0){return _0xc546e6[_0x2181('0xb')](_0x2181('0xc'),attributes,{'tableName':_0x2181('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 28b4b27..efd57c8 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 _0xc2dc=['limit','include','map','model','attributes','then','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','info','result','GetTemplate','options','raw','where'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xc2dc,0x19f));var _0xcc2d=function(_0x3d3ddd,_0x59b504){_0x3d3ddd=_0x3d3ddd-0x0;var _0x52a4f9=_0xc2dc[_0x3d3ddd];return _0x52a4f9;};'use strict';var _=require(_0xcc2d('0x0'));var util=require(_0xcc2d('0x1'));var moment=require(_0xcc2d('0x2'));var BPromise=require(_0xcc2d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc2d('0x4'))['db'];var utils=require(_0xcc2d('0x5'));var logger=require(_0xcc2d('0x6'))(_0xcc2d('0x7'));var config=require(_0xcc2d('0x8'));var jayson=require(_0xcc2d('0x9'));var client=jayson[_0xcc2d('0xa')][_0xcc2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ee9f7,_0x10266f,_0xa5309a){return new BPromise(function(_0x5a7f1d,_0x3875e9){return client[_0xcc2d('0xc')](_0x5ee9f7,_0xa5309a)['then'](function(_0x2bfcc3){logger['info']('Template,\x20%s,\x20%s',_0x10266f,_0xcc2d('0xd'));logger[_0xcc2d('0xe')](_0xcc2d('0xf'),_0x10266f,_0xcc2d('0xd'),JSON[_0xcc2d('0x10')](_0x2bfcc3));if(_0x2bfcc3['error']){if(_0x2bfcc3[_0xcc2d('0x11')][_0xcc2d('0x12')]===0x1f4){logger['error'](_0xcc2d('0x13'),_0x10266f,_0x2bfcc3[_0xcc2d('0x11')][_0xcc2d('0x14')]);return _0x3875e9(_0x2bfcc3['error'][_0xcc2d('0x14')]);}logger[_0xcc2d('0x11')](_0xcc2d('0x13'),_0x10266f,_0x2bfcc3[_0xcc2d('0x11')][_0xcc2d('0x14')]);return _0x5a7f1d(_0x2bfcc3['error']['message']);}else{logger[_0xcc2d('0x15')](_0xcc2d('0x13'),_0x10266f,_0xcc2d('0xd'));_0x5a7f1d(_0x2bfcc3[_0xcc2d('0x16')][_0xcc2d('0x14')]);}})['catch'](function(_0x29c087){logger[_0xcc2d('0x11')](_0xcc2d('0x13'),_0x10266f,_0x29c087);_0x3875e9(_0x29c087);});});}exports[_0xcc2d('0x17')]=function(_0x2a6bac){var _0x30712c=this;return new Promise(function(_0x2f88c3,_0xd4961b){return db['Template']['findAll']({'raw':_0x2a6bac[_0xcc2d('0x18')]?_0x2a6bac['options'][_0xcc2d('0x19')]===undefined?!![]:![]:!![],'where':_0x2a6bac[_0xcc2d('0x18')]?_0x2a6bac[_0xcc2d('0x18')][_0xcc2d('0x1a')]||null:null,'attributes':_0x2a6bac[_0xcc2d('0x18')]?_0x2a6bac[_0xcc2d('0x18')]['attributes']||null:null,'limit':_0x2a6bac[_0xcc2d('0x18')]?_0x2a6bac['options'][_0xcc2d('0x1b')]||null:null,'include':_0x2a6bac[_0xcc2d('0x18')]?_0x2a6bac[_0xcc2d('0x18')][_0xcc2d('0x1c')]?_['map'](_0x2a6bac[_0xcc2d('0x18')][_0xcc2d('0x1c')],function(_0xe2a17c){return{'model':db[_0xe2a17c['model']],'as':_0xe2a17c['as'],'attributes':_0xe2a17c['attributes'],'include':_0xe2a17c[_0xcc2d('0x1c')]?_[_0xcc2d('0x1d')](_0xe2a17c[_0xcc2d('0x1c')],function(_0x209d38){return{'model':db[_0x209d38[_0xcc2d('0x1e')]],'as':_0x209d38['as'],'attributes':_0x209d38['attributes'],'include':_0x209d38[_0xcc2d('0x1c')]?_['map'](_0x209d38[_0xcc2d('0x1c')],function(_0x4500c9){return{'model':db[_0x4500c9[_0xcc2d('0x1e')]],'as':_0x4500c9['as'],'attributes':_0x4500c9[_0xcc2d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcc2d('0x20')](function(_0x2c422f){logger[_0xcc2d('0x15')](_0xcc2d('0x17'),_0x2a6bac);logger['debug'](_0xcc2d('0x17'),_0x2a6bac,JSON[_0xcc2d('0x10')](_0x2c422f));_0x2f88c3(_0x2c422f);})[_0xcc2d('0x21')](function(_0x162650){logger['error'](_0xcc2d('0x17'),_0x162650[_0xcc2d('0x14')],_0x2a6bac);_0xd4961b(_0x30712c[_0xcc2d('0x11')](0x1f4,_0x162650[_0xcc2d('0x14')]));});});}; \ No newline at end of file +var _0x4c73=['message','result','GetTemplate','findAll','options','raw','where','limit','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x343090,_0x433a80){var _0x3ff3e8=function(_0x16c811){while(--_0x16c811){_0x343090['push'](_0x343090['shift']());}};_0x3ff3e8(++_0x433a80);}(_0x4c73,0x183));var _0x34c7=function(_0x3f58e5,_0x148225){_0x3f58e5=_0x3f58e5-0x0;var _0x51a44d=_0x4c73[_0x3f58e5];return _0x51a44d;};'use strict';var _=require(_0x34c7('0x0'));var util=require(_0x34c7('0x1'));var moment=require(_0x34c7('0x2'));var BPromise=require(_0x34c7('0x3'));var rs=require(_0x34c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x34c7('0x6'))(_0x34c7('0x7'));var config=require(_0x34c7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x34c7('0x9')][_0x34c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x136384,_0x111225,_0x21a5e4){return new BPromise(function(_0x35095e,_0xe5a5bc){return client[_0x34c7('0xb')](_0x136384,_0x21a5e4)[_0x34c7('0xc')](function(_0x57c6ea){logger[_0x34c7('0xd')](_0x34c7('0xe'),_0x111225,_0x34c7('0xf'));logger[_0x34c7('0x10')](_0x34c7('0x11'),_0x111225,_0x34c7('0xf'),JSON[_0x34c7('0x12')](_0x57c6ea));if(_0x57c6ea['error']){if(_0x57c6ea['error'][_0x34c7('0x13')]===0x1f4){logger[_0x34c7('0x14')](_0x34c7('0xe'),_0x111225,_0x57c6ea[_0x34c7('0x14')][_0x34c7('0x15')]);return _0xe5a5bc(_0x57c6ea[_0x34c7('0x14')][_0x34c7('0x15')]);}logger[_0x34c7('0x14')](_0x34c7('0xe'),_0x111225,_0x57c6ea[_0x34c7('0x14')]['message']);return _0x35095e(_0x57c6ea[_0x34c7('0x14')]['message']);}else{logger['info'](_0x34c7('0xe'),_0x111225,'request\x20sent');_0x35095e(_0x57c6ea[_0x34c7('0x16')]['message']);}})['catch'](function(_0xf379b4){logger[_0x34c7('0x14')](_0x34c7('0xe'),_0x111225,_0xf379b4);_0xe5a5bc(_0xf379b4);});});}exports[_0x34c7('0x17')]=function(_0x32415d){var _0x2ae8fe=this;return new Promise(function(_0xe34975,_0x4060a7){return db['Template'][_0x34c7('0x18')]({'raw':_0x32415d[_0x34c7('0x19')]?_0x32415d['options'][_0x34c7('0x1a')]===undefined?!![]:![]:!![],'where':_0x32415d['options']?_0x32415d[_0x34c7('0x19')][_0x34c7('0x1b')]||null:null,'attributes':_0x32415d[_0x34c7('0x19')]?_0x32415d[_0x34c7('0x19')]['attributes']||null:null,'limit':_0x32415d[_0x34c7('0x19')]?_0x32415d[_0x34c7('0x19')][_0x34c7('0x1c')]||null:null,'include':_0x32415d['options']?_0x32415d['options'][_0x34c7('0x1d')]?_[_0x34c7('0x1e')](_0x32415d[_0x34c7('0x19')][_0x34c7('0x1d')],function(_0xd1b2f5){return{'model':db[_0xd1b2f5[_0x34c7('0x1f')]],'as':_0xd1b2f5['as'],'attributes':_0xd1b2f5[_0x34c7('0x20')],'include':_0xd1b2f5['include']?_['map'](_0xd1b2f5[_0x34c7('0x1d')],function(_0x102e8e){return{'model':db[_0x102e8e[_0x34c7('0x1f')]],'as':_0x102e8e['as'],'attributes':_0x102e8e[_0x34c7('0x20')],'include':_0x102e8e[_0x34c7('0x1d')]?_['map'](_0x102e8e[_0x34c7('0x1d')],function(_0xcb9f61){return{'model':db[_0xcb9f61[_0x34c7('0x1f')]],'as':_0xcb9f61['as'],'attributes':_0xcb9f61['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x35cd10){logger[_0x34c7('0xd')](_0x34c7('0x17'),_0x32415d);logger['debug']('GetTemplate',_0x32415d,JSON['stringify'](_0x35cd10));_0xe34975(_0x35cd10);})[_0x34c7('0x21')](function(_0x46f1bd){logger['error']('GetTemplate',_0x46f1bd['message'],_0x32415d);_0x4060a7(_0x2ae8fe[_0x34c7('0x14')](0x1f4,_0x46f1bd[_0x34c7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 1906d74..15ca0c0 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 _0x2534=['/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAction','put','update','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions'];(function(_0x2859a8,_0xaa50fd){var _0x441bb3=function(_0x1e73e6){while(--_0x1e73e6){_0x2859a8['push'](_0x2859a8['shift']());}};_0x441bb3(++_0xaa50fd);}(_0x2534,0x9a));var _0x4253=function(_0x4cf757,_0x170b8f){_0x4cf757=_0x4cf757-0x0;var _0x2b1947=_0x2534[_0x4cf757];return _0x2b1947;};'use strict';var multer=require(_0x4253('0x0'));var util=require('util');var path=require(_0x4253('0x1'));var timeout=require('connect-timeout');var express=require(_0x4253('0x2'));var router=express[_0x4253('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4253('0x4'));var config=require(_0x4253('0x5'));var controller=require(_0x4253('0x6'));router[_0x4253('0x7')]('/',auth[_0x4253('0x8')](),controller[_0x4253('0x9')]);router[_0x4253('0x7')](_0x4253('0xa'),auth[_0x4253('0x8')](),controller[_0x4253('0xb')]);router[_0x4253('0x7')](_0x4253('0xc'),auth['isAuthenticated'](),controller[_0x4253('0xd')]);router['get'](_0x4253('0xe'),auth[_0x4253('0x8')](),controller[_0x4253('0xf')]);router['get'](_0x4253('0x10'),auth[_0x4253('0x8')](),controller[_0x4253('0x11')]);router[_0x4253('0x12')]('/',auth['isAuthenticated'](),controller[_0x4253('0x13')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller['addAllCondition']);router[_0x4253('0x12')](_0x4253('0xe'),auth['isAuthenticated'](),controller['addAnyCondition']);router['post'](_0x4253('0x10'),auth[_0x4253('0x8')](),controller[_0x4253('0x14')]);router[_0x4253('0x15')](_0x4253('0xa'),auth[_0x4253('0x8')](),controller[_0x4253('0x16')]);router['delete'](_0x4253('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4253('0x17')]=router; \ No newline at end of file +var _0x7556=['/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','/:id/all_conditions','addAllCondition','addAnyCondition','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index'];(function(_0x1caa2b,_0x233c72){var _0x47c982=function(_0x3d46ef){while(--_0x3d46ef){_0x1caa2b['push'](_0x1caa2b['shift']());}};_0x47c982(++_0x233c72);}(_0x7556,0xc5));var _0x6755=function(_0x2aaa16,_0x58cfb4){_0x2aaa16=_0x2aaa16-0x0;var _0x3e66ab=_0x7556[_0x2aaa16];return _0x3e66ab;};'use strict';var multer=require(_0x6755('0x0'));var util=require(_0x6755('0x1'));var path=require('path');var timeout=require(_0x6755('0x2'));var express=require('express');var router=express[_0x6755('0x3')]();var auth=require(_0x6755('0x4'));var interaction=require(_0x6755('0x5'));var config=require(_0x6755('0x6'));var controller=require(_0x6755('0x7'));router[_0x6755('0x8')]('/',auth[_0x6755('0x9')](),controller[_0x6755('0xa')]);router[_0x6755('0x8')](_0x6755('0xb'),auth[_0x6755('0x9')](),controller[_0x6755('0xc')]);router[_0x6755('0x8')]('/:id/all_conditions',auth[_0x6755('0x9')](),controller[_0x6755('0xd')]);router['get'](_0x6755('0xe'),auth['isAuthenticated'](),controller[_0x6755('0xf')]);router[_0x6755('0x8')](_0x6755('0x10'),auth[_0x6755('0x9')](),controller[_0x6755('0x11')]);router[_0x6755('0x12')]('/',auth[_0x6755('0x9')](),controller['create']);router[_0x6755('0x12')](_0x6755('0x13'),auth['isAuthenticated'](),controller[_0x6755('0x14')]);router[_0x6755('0x12')]('/:id/any_conditions',auth[_0x6755('0x9')](),controller[_0x6755('0x15')]);router[_0x6755('0x12')](_0x6755('0x10'),auth['isAuthenticated'](),controller['addAction']);router[_0x6755('0x16')](_0x6755('0xb'),auth[_0x6755('0x9')](),controller[_0x6755('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6755('0x18')]);module[_0x6755('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 3018513..0db234a 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 _0xcaa6=['sequelize','exports','STRING'];(function(_0x20d99c,_0x1abe9b){var _0x6df816=function(_0xd2a170){while(--_0xd2a170){_0x20d99c['push'](_0x20d99c['shift']());}};_0x6df816(++_0x1abe9b);}(_0xcaa6,0x1bc));var _0x6caa=function(_0x5b22f5,_0x1497b3){_0x5b22f5=_0x5b22f5-0x0;var _0x5ba3c8=_0xcaa6[_0x5b22f5];return _0x5ba3c8;};'use strict';var Sequelize=require(_0x6caa('0x0'));module[_0x6caa('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6caa('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xfc25=['sequelize','exports','STRING','BOOLEAN'];(function(_0x35245d,_0x193583){var _0x184a83=function(_0x2d46bd){while(--_0x2d46bd){_0x35245d['push'](_0x35245d['shift']());}};_0x184a83(++_0x193583);}(_0xfc25,0x78));var _0x5fc2=function(_0x1d4b18,_0x4bc93f){_0x1d4b18=_0x1d4b18-0x0;var _0x443611=_0xfc25[_0x1d4b18];return _0x443611;};'use strict';var Sequelize=require(_0x5fc2('0x0'));module[_0x5fc2('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5fc2('0x2')]},'description':{'type':Sequelize[_0x5fc2('0x2')]},'status':{'type':Sequelize[_0x5fc2('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 1cc59d9..4eae08b 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 _0x61b8=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','Trigger','count','includeAll','include','findAll','rows','catch','show','keys','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Triggers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','addAllCondition','addAnyCondition','Condition','getAllConditions','findOne','pick','options','getAnyConditions','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x61b8,0x169));var _0x861b=function(_0x3f44b,_0xede649){_0x3f44b=_0x3f44b-0x0;var _0x254458=_0x61b8[_0x3f44b];return _0x254458;};'use strict';var pdf=require(_0x861b('0x0'));var emlformat=require(_0x861b('0x1'));var rimraf=require(_0x861b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x861b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x861b('0x4'));var Mustache=require(_0x861b('0x5'));var util=require(_0x861b('0x6'));var path=require('path');var sox=require(_0x861b('0x7'));var csv=require(_0x861b('0x8'));var ejs=require(_0x861b('0x9'));var fs=require('fs');var _=require(_0x861b('0xa'));var squel=require(_0x861b('0xb'));var crypto=require(_0x861b('0xc'));var jsforce=require(_0x861b('0xd'));var deskjs=require(_0x861b('0xe'));var toCsv=require(_0x861b('0x8'));var querystring=require(_0x861b('0xf'));var Papa=require(_0x861b('0x10'));var Redis=require('ioredis');var authService=require(_0x861b('0x11'));var qs=require(_0x861b('0x12'));var as=require(_0x861b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x861b('0x14'))('api');var utils=require(_0x861b('0x15'));var config=require(_0x861b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x861b('0x17'))['db'];function respondWithStatusCode(_0x16eb59,_0x125345){_0x125345=_0x125345||0xcc;return function(_0x23c3db){if(_0x23c3db){return _0x16eb59[_0x861b('0x18')](_0x125345);}return _0x16eb59[_0x861b('0x19')](_0x125345)[_0x861b('0x1a')]();};}function respondWithResult(_0x21c585,_0x44b444){_0x44b444=_0x44b444||0xc8;return function(_0x226ee9){if(_0x226ee9){return _0x21c585[_0x861b('0x19')](_0x44b444)[_0x861b('0x1b')](_0x226ee9);}};}function respondWithFilteredResult(_0x264ba1,_0x3ee3ab){return function(_0x437bbd){if(_0x437bbd){var _0x3dbd5e=_0x437bbd['count'],_0x5121aa=_0x3ee3ab[_0x861b('0x1c')],_0x18b1d7=_0x3ee3ab['offset']+_0x3ee3ab[_0x861b('0x1d')],_0x5a4542;if(_0x18b1d7>=_0x3dbd5e){_0x18b1d7=_0x3dbd5e;_0x5a4542=0xc8;}else{_0x5a4542=0xce;}_0x264ba1[_0x861b('0x19')](_0x5a4542);return _0x264ba1['set'](_0x861b('0x1e'),_0x5121aa+'-'+_0x18b1d7+'/'+_0x3dbd5e)[_0x861b('0x1b')](_0x437bbd);}return null;};}function patchUpdates(_0x3b9740){return function(_0x11a914){try{jsonpatch['apply'](_0x11a914,_0x3b9740,!![]);}catch(_0x55d21b){return BPromise[_0x861b('0x1f')](_0x55d21b);}return _0x11a914[_0x861b('0x20')]();};}function saveUpdates(_0x20422f,_0x4e76a3){return function(_0x1223aa){if(_0x1223aa){return _0x1223aa['update'](_0x20422f)[_0x861b('0x21')](function(_0x1ad06c){return _0x1ad06c;});}return null;};}function removeEntity(_0x4af003,_0x4fd2b3){return function(_0x474f49){if(_0x474f49){return _0x474f49[_0x861b('0x22')]()['then'](function(){var _0x4e61cd=_0x474f49[_0x861b('0x23')]({'plain':!![]});var _0x47be04='Triggers';return db[_0x861b('0x24')]['destroy']({'where':{'type':_0x47be04,'resourceId':_0x4e61cd['id']}})['then'](function(){return _0x474f49;});})[_0x861b('0x21')](function(){_0x4af003[_0x861b('0x19')](0xcc)[_0x861b('0x1a')]();});}};}function handleEntityNotFound(_0xb763e2,_0x2a2074){return function(_0x58527c){if(!_0x58527c){_0xb763e2['sendStatus'](0x194);}return _0x58527c;};}function handleError(_0x726496,_0x130dbb){_0x130dbb=_0x130dbb||0x1f4;return function(_0x2d4ed8){logger[_0x861b('0x25')](_0x2d4ed8[_0x861b('0x26')]);if(_0x2d4ed8[_0x861b('0x27')]){delete _0x2d4ed8['name'];}_0x726496['status'](_0x130dbb)[_0x861b('0x28')](_0x2d4ed8);};}exports[_0x861b('0x29')]=function(_0x419259,_0x1fc11a){var _0xc94042={},_0x31c890={},_0x5bee82={'count':0x0,'rows':[]};var _0x4b21b9=_[_0x861b('0x2a')](db['Trigger'][_0x861b('0x2b')],function(_0x13d1c0){return{'name':_0x13d1c0[_0x861b('0x2c')],'type':_0x13d1c0[_0x861b('0x2d')][_0x861b('0x2e')]};});_0x31c890[_0x861b('0x2f')]=_[_0x861b('0x2a')](_0x4b21b9,_0x861b('0x27'));_0x31c890['query']=_['keys'](_0x419259[_0x861b('0x30')]);_0x31c890['filters']=_[_0x861b('0x31')](_0x31c890[_0x861b('0x2f')],_0x31c890['query']);_0xc94042[_0x861b('0x32')]=_['intersection'](_0x31c890['model'],qs[_0x861b('0x33')](_0x419259[_0x861b('0x30')]['fields']));_0xc94042[_0x861b('0x32')]=_0xc94042[_0x861b('0x32')]['length']?_0xc94042[_0x861b('0x32')]:_0x31c890[_0x861b('0x2f')];if(!_0x419259['query'][_0x861b('0x34')](_0x861b('0x35'))){_0xc94042[_0x861b('0x1d')]=qs[_0x861b('0x1d')](_0x419259[_0x861b('0x30')][_0x861b('0x1d')]);_0xc94042['offset']=qs[_0x861b('0x1c')](_0x419259[_0x861b('0x30')][_0x861b('0x1c')]);}_0xc94042[_0x861b('0x36')]=qs[_0x861b('0x37')](_0x419259['query']['sort']);_0xc94042[_0x861b('0x38')]=qs[_0x861b('0x39')](_['pick'](_0x419259['query'],_0x31c890[_0x861b('0x39')]),_0x4b21b9);if(_0x419259[_0x861b('0x30')][_0x861b('0x3a')]){_0xc94042[_0x861b('0x38')]=_[_0x861b('0x3b')](_0xc94042[_0x861b('0x38')],{'$or':_['map'](_0x4b21b9,function(_0x362e88){if(_0x362e88[_0x861b('0x2d')]!==_0x861b('0x3c')){var _0x75fca9={};_0x75fca9[_0x362e88[_0x861b('0x27')]]={'$like':'%'+_0x419259[_0x861b('0x30')]['filter']+'%'};return _0x75fca9;}})});}_0xc94042=_[_0x861b('0x3b')]({},_0xc94042,_0x419259['options']);var _0x25080a={'where':_0xc94042['where']};return db[_0x861b('0x3d')][_0x861b('0x3e')](_0x25080a)[_0x861b('0x21')](function(_0x1a4046){_0x5bee82[_0x861b('0x3e')]=_0x1a4046;if(_0x419259['query'][_0x861b('0x3f')]){_0xc94042[_0x861b('0x40')]=[{'all':!![]}];}return db[_0x861b('0x3d')][_0x861b('0x41')](_0xc94042);})['then'](function(_0x23ae99){_0x5bee82[_0x861b('0x42')]=_0x23ae99;return _0x5bee82;})['then'](respondWithFilteredResult(_0x1fc11a,_0xc94042))[_0x861b('0x43')](handleError(_0x1fc11a,null));};exports[_0x861b('0x44')]=function(_0x3a236c,_0x5f25b3){var _0x29cb4b={'raw':![],'where':{'id':_0x3a236c['params']['id']}},_0x396341={};_0x396341[_0x861b('0x2f')]=_[_0x861b('0x45')](db['Trigger'][_0x861b('0x2b')]);_0x396341[_0x861b('0x30')]=_['keys'](_0x3a236c[_0x861b('0x30')]);_0x396341[_0x861b('0x39')]=_[_0x861b('0x31')](_0x396341[_0x861b('0x2f')],_0x396341[_0x861b('0x30')]);_0x29cb4b[_0x861b('0x32')]=_['intersection'](_0x396341[_0x861b('0x2f')],qs['fields'](_0x3a236c[_0x861b('0x30')][_0x861b('0x33')]));_0x29cb4b['attributes']=_0x29cb4b[_0x861b('0x32')][_0x861b('0x46')]?_0x29cb4b[_0x861b('0x32')]:_0x396341[_0x861b('0x2f')];if(_0x3a236c[_0x861b('0x30')]['includeAll']){_0x29cb4b[_0x861b('0x40')]=[{'all':!![]}];}_0x29cb4b=_[_0x861b('0x3b')]({},_0x29cb4b,_0x3a236c['options']);return db[_0x861b('0x3d')][_0x861b('0x47')](_0x29cb4b)[_0x861b('0x21')](handleEntityNotFound(_0x5f25b3,null))[_0x861b('0x21')](respondWithResult(_0x5f25b3,null))[_0x861b('0x43')](handleError(_0x5f25b3,null));};exports[_0x861b('0x48')]=function(_0x37214c,_0x285537){return db[_0x861b('0x3d')][_0x861b('0x48')](_0x37214c['body'],{})[_0x861b('0x21')](function(_0x5f2145){var _0x1074f1=_0x37214c['user'][_0x861b('0x23')]({'plain':!![]});if(!_0x1074f1)throw new Error(_0x861b('0x49'));if(_0x1074f1['role']===_0x861b('0x4a')){var _0x4df88a=_0x5f2145[_0x861b('0x23')]({'plain':!![]});var _0x24d0ac=_0x861b('0x4b');return db['UserProfileSection'][_0x861b('0x47')]({'where':{'name':_0x24d0ac,'userProfileId':_0x1074f1[_0x861b('0x4c')]},'raw':!![]})[_0x861b('0x21')](function(_0x3b3124){if(_0x3b3124&&_0x3b3124[_0x861b('0x4d')]===0x0){return db[_0x861b('0x24')][_0x861b('0x48')]({'name':_0x4df88a[_0x861b('0x27')],'resourceId':_0x4df88a['id'],'type':_0x3b3124['name'],'sectionId':_0x3b3124['id']},{})[_0x861b('0x21')](function(){return _0x5f2145;});}else{return _0x5f2145;}})[_0x861b('0x43')](function(_0x408874){logger['error'](_0x861b('0x4e'),_0x408874);throw _0x408874;});}return _0x5f2145;})[_0x861b('0x21')](respondWithResult(_0x285537,0xc9))['catch'](handleError(_0x285537,null));};exports[_0x861b('0x4f')]=function(_0x4f025a,_0x1b9934){if(_0x4f025a[_0x861b('0x50')]['id']){delete _0x4f025a[_0x861b('0x50')]['id'];}return db[_0x861b('0x3d')]['find']({'where':{'id':_0x4f025a[_0x861b('0x51')]['id']}})[_0x861b('0x21')](handleEntityNotFound(_0x1b9934,null))['then'](saveUpdates(_0x4f025a[_0x861b('0x50')],null))[_0x861b('0x21')](respondWithResult(_0x1b9934,null))['catch'](handleError(_0x1b9934,null));};exports[_0x861b('0x22')]=function(_0x16f364,_0x192868){return db[_0x861b('0x3d')][_0x861b('0x47')]({'where':{'id':_0x16f364[_0x861b('0x51')]['id']}})[_0x861b('0x21')](handleEntityNotFound(_0x192868,null))[_0x861b('0x21')](removeEntity(_0x192868,null))[_0x861b('0x43')](handleError(_0x192868,null));};exports[_0x861b('0x52')]=function(_0x4e0e32,_0xa15789,_0x1153f3){if(_0x4e0e32[_0x861b('0x50')]['id']){delete _0x4e0e32[_0x861b('0x50')]['id'];}return db[_0x861b('0x3d')]['find']({'where':{'id':_0x4e0e32[_0x861b('0x51')]['id']}})[_0x861b('0x21')](handleEntityNotFound(_0xa15789,null))[_0x861b('0x21')](function(_0x49b1e4){if(_0x49b1e4){_0x4e0e32[_0x861b('0x50')]['TriggerAllId']=_0x49b1e4['id'];return db['Condition'][_0x861b('0x48')](_0x4e0e32[_0x861b('0x50')]);}})['then'](respondWithResult(_0xa15789,null))[_0x861b('0x43')](handleError(_0xa15789,null));};exports[_0x861b('0x53')]=function(_0x1530aa,_0x40ead7,_0x3ea660){if(_0x1530aa[_0x861b('0x50')]['id']){delete _0x1530aa[_0x861b('0x50')]['id'];}return db[_0x861b('0x3d')][_0x861b('0x47')]({'where':{'id':_0x1530aa[_0x861b('0x51')]['id']}})[_0x861b('0x21')](handleEntityNotFound(_0x40ead7,null))[_0x861b('0x21')](function(_0x3c61fd){if(_0x3c61fd){_0x1530aa['body']['TriggerAnyId']=_0x3c61fd['id'];return db[_0x861b('0x54')][_0x861b('0x48')](_0x1530aa[_0x861b('0x50')]);}})[_0x861b('0x21')](respondWithResult(_0x40ead7,null))[_0x861b('0x43')](handleError(_0x40ead7,null));};exports[_0x861b('0x55')]=function(_0x11207c,_0x654bcd,_0x5982e1){var _0x479a8f={};var _0x55fdf6={};var _0x246718;var _0x45cad8;return db[_0x861b('0x3d')][_0x861b('0x56')]({'where':{'id':_0x11207c['params']['id']}})[_0x861b('0x21')](handleEntityNotFound(_0x654bcd,null))[_0x861b('0x21')](function(_0xe7ea7a){if(_0xe7ea7a){_0x246718=_0xe7ea7a;_0x55fdf6[_0x861b('0x2f')]=_[_0x861b('0x45')](db['Condition'][_0x861b('0x2b')]);_0x55fdf6[_0x861b('0x30')]=_[_0x861b('0x45')](_0x11207c[_0x861b('0x30')]);_0x55fdf6[_0x861b('0x39')]=_['intersection'](_0x55fdf6[_0x861b('0x2f')],_0x55fdf6[_0x861b('0x30')]);_0x479a8f[_0x861b('0x32')]=_['intersection'](_0x55fdf6[_0x861b('0x2f')],qs[_0x861b('0x33')](_0x11207c['query'][_0x861b('0x33')]));_0x479a8f['attributes']=_0x479a8f['attributes']['length']?_0x479a8f[_0x861b('0x32')]:_0x55fdf6[_0x861b('0x2f')];_0x479a8f[_0x861b('0x36')]=qs[_0x861b('0x37')](_0x11207c[_0x861b('0x30')][_0x861b('0x37')]);_0x479a8f[_0x861b('0x38')]=qs['filters'](_[_0x861b('0x57')](_0x11207c['query'],_0x55fdf6[_0x861b('0x39')]));if(_0x11207c[_0x861b('0x30')]['filter']){_0x479a8f['where']=_[_0x861b('0x3b')](_0x479a8f['where'],{'$or':_[_0x861b('0x2a')](_0x479a8f[_0x861b('0x32')],function(_0x47d232){var _0x54ba64={};_0x54ba64[_0x47d232]={'$like':'%'+_0x11207c[_0x861b('0x30')][_0x861b('0x3a')]+'%'};return _0x54ba64;})});}_0x479a8f=_[_0x861b('0x3b')]({},_0x479a8f,_0x11207c[_0x861b('0x58')]);return _0x246718[_0x861b('0x55')](_0x479a8f);}})[_0x861b('0x21')](function(_0xb3895f){if(_0xb3895f){_0x45cad8=_0xb3895f[_0x861b('0x46')];if(!_0x11207c[_0x861b('0x30')][_0x861b('0x34')](_0x861b('0x35'))){_0x479a8f[_0x861b('0x1d')]=qs[_0x861b('0x1d')](_0x11207c[_0x861b('0x30')][_0x861b('0x1d')]);_0x479a8f['offset']=qs[_0x861b('0x1c')](_0x11207c[_0x861b('0x30')][_0x861b('0x1c')]);}return _0x246718[_0x861b('0x55')](_0x479a8f);}})[_0x861b('0x21')](function(_0xd929c7){if(_0xd929c7){return _0xd929c7?{'count':_0x45cad8,'rows':_0xd929c7}:null;}})[_0x861b('0x21')](respondWithResult(_0x654bcd,null))[_0x861b('0x43')](handleError(_0x654bcd,null));};exports['getAnyConditions']=function(_0x1311de,_0x32cf4e,_0x5ba1c0){var _0x5ce54d={};var _0x4857b1={};var _0x339ed2;var _0x313129;return db[_0x861b('0x3d')][_0x861b('0x56')]({'where':{'id':_0x1311de[_0x861b('0x51')]['id']}})['then'](handleEntityNotFound(_0x32cf4e,null))['then'](function(_0xdc7696){if(_0xdc7696){_0x339ed2=_0xdc7696;_0x4857b1[_0x861b('0x2f')]=_['keys'](db[_0x861b('0x54')][_0x861b('0x2b')]);_0x4857b1[_0x861b('0x30')]=_[_0x861b('0x45')](_0x1311de[_0x861b('0x30')]);_0x4857b1['filters']=_[_0x861b('0x31')](_0x4857b1['model'],_0x4857b1[_0x861b('0x30')]);_0x5ce54d[_0x861b('0x32')]=_[_0x861b('0x31')](_0x4857b1[_0x861b('0x2f')],qs[_0x861b('0x33')](_0x1311de[_0x861b('0x30')][_0x861b('0x33')]));_0x5ce54d[_0x861b('0x32')]=_0x5ce54d[_0x861b('0x32')]['length']?_0x5ce54d['attributes']:_0x4857b1[_0x861b('0x2f')];_0x5ce54d[_0x861b('0x36')]=qs[_0x861b('0x37')](_0x1311de[_0x861b('0x30')][_0x861b('0x37')]);_0x5ce54d[_0x861b('0x38')]=qs[_0x861b('0x39')](_['pick'](_0x1311de[_0x861b('0x30')],_0x4857b1['filters']));if(_0x1311de[_0x861b('0x30')][_0x861b('0x3a')]){_0x5ce54d['where']=_['merge'](_0x5ce54d[_0x861b('0x38')],{'$or':_[_0x861b('0x2a')](_0x5ce54d['attributes'],function(_0x546ce3){var _0x500f12={};_0x500f12[_0x546ce3]={'$like':'%'+_0x1311de[_0x861b('0x30')][_0x861b('0x3a')]+'%'};return _0x500f12;})});}_0x5ce54d=_['merge']({},_0x5ce54d,_0x1311de[_0x861b('0x58')]);return _0x339ed2[_0x861b('0x59')](_0x5ce54d);}})[_0x861b('0x21')](function(_0x439236){if(_0x439236){_0x313129=_0x439236[_0x861b('0x46')];if(!_0x1311de['query']['hasOwnProperty'](_0x861b('0x35'))){_0x5ce54d[_0x861b('0x1d')]=qs['limit'](_0x1311de[_0x861b('0x30')]['limit']);_0x5ce54d['offset']=qs['offset'](_0x1311de['query'][_0x861b('0x1c')]);}return _0x339ed2[_0x861b('0x59')](_0x5ce54d);}})[_0x861b('0x21')](function(_0x4500d1){if(_0x4500d1){return _0x4500d1?{'count':_0x313129,'rows':_0x4500d1}:null;}})['then'](respondWithResult(_0x32cf4e,null))['catch'](handleError(_0x32cf4e,null));};exports['addAction']=function(_0x3c4c8c,_0x569fd2,_0x57cba6){if(_0x3c4c8c[_0x861b('0x50')]['id']){delete _0x3c4c8c[_0x861b('0x50')]['id'];}return db[_0x861b('0x3d')]['find']({'where':{'id':_0x3c4c8c['params']['id']}})[_0x861b('0x21')](handleEntityNotFound(_0x569fd2,null))[_0x861b('0x21')](function(_0x428d27){if(_0x428d27){_0x3c4c8c[_0x861b('0x50')][_0x861b('0x5a')]=_0x428d27['id'];return db['Action'][_0x861b('0x48')](_0x3c4c8c[_0x861b('0x50')]);}})['then'](respondWithResult(_0x569fd2,null))[_0x861b('0x43')](handleError(_0x569fd2,null));};exports['getActions']=function(_0xdb4258,_0x4e2523,_0x2a0456){var _0x1372e9={};var _0x4bc5b9={};var _0x1db813;var _0x2e17fb;return db[_0x861b('0x3d')][_0x861b('0x56')]({'where':{'id':_0xdb4258[_0x861b('0x51')]['id']}})[_0x861b('0x21')](handleEntityNotFound(_0x4e2523,null))[_0x861b('0x21')](function(_0x4b49b4){if(_0x4b49b4){_0x1db813=_0x4b49b4;_0x4bc5b9[_0x861b('0x2f')]=_['keys'](db[_0x861b('0x5b')][_0x861b('0x2b')]);_0x4bc5b9[_0x861b('0x30')]=_['keys'](_0xdb4258['query']);_0x4bc5b9[_0x861b('0x39')]=_[_0x861b('0x31')](_0x4bc5b9[_0x861b('0x2f')],_0x4bc5b9[_0x861b('0x30')]);_0x1372e9[_0x861b('0x32')]=_[_0x861b('0x31')](_0x4bc5b9['model'],qs[_0x861b('0x33')](_0xdb4258[_0x861b('0x30')][_0x861b('0x33')]));_0x1372e9[_0x861b('0x32')]=_0x1372e9[_0x861b('0x32')][_0x861b('0x46')]?_0x1372e9[_0x861b('0x32')]:_0x4bc5b9[_0x861b('0x2f')];_0x1372e9[_0x861b('0x36')]=qs['sort'](_0xdb4258[_0x861b('0x30')][_0x861b('0x37')]);_0x1372e9['where']=qs[_0x861b('0x39')](_['pick'](_0xdb4258[_0x861b('0x30')],_0x4bc5b9[_0x861b('0x39')]));if(_0xdb4258['query']['filter']){_0x1372e9[_0x861b('0x38')]=_[_0x861b('0x3b')](_0x1372e9[_0x861b('0x38')],{'$or':_[_0x861b('0x2a')](_0x1372e9[_0x861b('0x32')],function(_0x1aee56){var _0x96a37f={};_0x96a37f[_0x1aee56]={'$like':'%'+_0xdb4258[_0x861b('0x30')]['filter']+'%'};return _0x96a37f;})});}_0x1372e9=_['merge']({},_0x1372e9,_0xdb4258['options']);return _0x1db813[_0x861b('0x5c')](_0x1372e9);}})[_0x861b('0x21')](function(_0x50bbd6){if(_0x50bbd6){_0x2e17fb=_0x50bbd6['length'];if(!_0xdb4258[_0x861b('0x30')][_0x861b('0x34')]('nolimit')){_0x1372e9[_0x861b('0x1d')]=qs['limit'](_0xdb4258[_0x861b('0x30')][_0x861b('0x1d')]);_0x1372e9[_0x861b('0x1c')]=qs[_0x861b('0x1c')](_0xdb4258[_0x861b('0x30')][_0x861b('0x1c')]);}return _0x1db813[_0x861b('0x5c')](_0x1372e9);}})['then'](function(_0xd4de61){if(_0xd4de61){return _0xd4de61?{'count':_0x2e17fb,'rows':_0xd4de61}:null;}})['then'](respondWithResult(_0x4e2523,null))[_0x861b('0x43')](handleError(_0x4e2523,null));}; \ No newline at end of file +var _0x1b94=['keys','intersection','query','attributes','fields','length','model','hasOwnProperty','nolimit','where','pick','filters','filter','VIRTUAL','merge','options','count','includeAll','rows','params','include','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','TriggerAnyId','Condition','getAllConditions','findOne','order','sort','getAnyConditions','addAction','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','Trigger','rawAttributes','type','key','map'];(function(_0x5e1db3,_0x5d8c32){var _0x1aaaf8=function(_0x118063){while(--_0x118063){_0x5e1db3['push'](_0x5e1db3['shift']());}};_0x1aaaf8(++_0x5d8c32);}(_0x1b94,0x1f2));var _0x41b9=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x1b94[_0x12fc8d];return _0x3f9d04;};'use strict';var pdf=require(_0x41b9('0x0'));var emlformat=require(_0x41b9('0x1'));var rimraf=require(_0x41b9('0x2'));var zipdir=require(_0x41b9('0x3'));var jsonpatch=require(_0x41b9('0x4'));var rp=require('request-promise');var moment=require(_0x41b9('0x5'));var BPromise=require(_0x41b9('0x6'));var Mustache=require(_0x41b9('0x7'));var util=require('util');var path=require(_0x41b9('0x8'));var sox=require(_0x41b9('0x9'));var csv=require(_0x41b9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x41b9('0xb'));var squel=require(_0x41b9('0xc'));var crypto=require(_0x41b9('0xd'));var jsforce=require(_0x41b9('0xe'));var deskjs=require(_0x41b9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x41b9('0x10'));var Papa=require(_0x41b9('0x11'));var Redis=require('ioredis');var authService=require(_0x41b9('0x12'));var qs=require(_0x41b9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41b9('0x14'));var logger=require(_0x41b9('0x15'))('api');var utils=require(_0x41b9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x41b9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f0b64,_0xa498a3){_0xa498a3=_0xa498a3||0xcc;return function(_0x33af17){if(_0x33af17){return _0x3f0b64[_0x41b9('0x18')](_0xa498a3);}return _0x3f0b64[_0x41b9('0x19')](_0xa498a3)['end']();};}function respondWithResult(_0x428efe,_0x415f86){_0x415f86=_0x415f86||0xc8;return function(_0x5187a8){if(_0x5187a8){return _0x428efe[_0x41b9('0x19')](_0x415f86)[_0x41b9('0x1a')](_0x5187a8);}};}function respondWithFilteredResult(_0x303433,_0x2200f7){return function(_0x4b38da){if(_0x4b38da){var _0x5849aa=_0x4b38da['count'],_0x4a6357=_0x2200f7['offset'],_0x2d7bf0=_0x2200f7[_0x41b9('0x1b')]+_0x2200f7[_0x41b9('0x1c')],_0x432cd7;if(_0x2d7bf0>=_0x5849aa){_0x2d7bf0=_0x5849aa;_0x432cd7=0xc8;}else{_0x432cd7=0xce;}_0x303433[_0x41b9('0x19')](_0x432cd7);return _0x303433[_0x41b9('0x1d')](_0x41b9('0x1e'),_0x4a6357+'-'+_0x2d7bf0+'/'+_0x5849aa)[_0x41b9('0x1a')](_0x4b38da);}return null;};}function patchUpdates(_0x5d5828){return function(_0x10bfdf){try{jsonpatch[_0x41b9('0x1f')](_0x10bfdf,_0x5d5828,!![]);}catch(_0x5bc794){return BPromise[_0x41b9('0x20')](_0x5bc794);}return _0x10bfdf[_0x41b9('0x21')]();};}function saveUpdates(_0x2c205e,_0x4471bc){return function(_0x1aeaad){if(_0x1aeaad){return _0x1aeaad[_0x41b9('0x22')](_0x2c205e)['then'](function(_0x69eb43){return _0x69eb43;});}return null;};}function removeEntity(_0x5367b2,_0x319452){return function(_0x14dc16){if(_0x14dc16){return _0x14dc16[_0x41b9('0x23')]()[_0x41b9('0x24')](function(){var _0x2fe95=_0x14dc16['get']({'plain':!![]});var _0x231f64='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x231f64,'resourceId':_0x2fe95['id']}})[_0x41b9('0x24')](function(){return _0x14dc16;});})[_0x41b9('0x24')](function(){_0x5367b2[_0x41b9('0x19')](0xcc)[_0x41b9('0x25')]();});}};}function handleEntityNotFound(_0x136b46,_0x465280){return function(_0x9adf1c){if(!_0x9adf1c){_0x136b46[_0x41b9('0x18')](0x194);}return _0x9adf1c;};}function handleError(_0x18ea59,_0x545ad5){_0x545ad5=_0x545ad5||0x1f4;return function(_0x516845){logger[_0x41b9('0x26')](_0x516845[_0x41b9('0x27')]);if(_0x516845[_0x41b9('0x28')]){delete _0x516845[_0x41b9('0x28')];}_0x18ea59[_0x41b9('0x19')](_0x545ad5)[_0x41b9('0x29')](_0x516845);};}exports[_0x41b9('0x2a')]=function(_0x284e93,_0x53199d){var _0x5eeb51={},_0x1ae013={},_0x5463e1={'count':0x0,'rows':[]};var _0x6de6c5=_['map'](db[_0x41b9('0x2b')][_0x41b9('0x2c')],function(_0x4be093){return{'name':_0x4be093['fieldName'],'type':_0x4be093[_0x41b9('0x2d')][_0x41b9('0x2e')]};});_0x1ae013['model']=_[_0x41b9('0x2f')](_0x6de6c5,_0x41b9('0x28'));_0x1ae013['query']=_[_0x41b9('0x30')](_0x284e93['query']);_0x1ae013['filters']=_[_0x41b9('0x31')](_0x1ae013['model'],_0x1ae013[_0x41b9('0x32')]);_0x5eeb51[_0x41b9('0x33')]=_[_0x41b9('0x31')](_0x1ae013['model'],qs[_0x41b9('0x34')](_0x284e93[_0x41b9('0x32')][_0x41b9('0x34')]));_0x5eeb51[_0x41b9('0x33')]=_0x5eeb51[_0x41b9('0x33')][_0x41b9('0x35')]?_0x5eeb51[_0x41b9('0x33')]:_0x1ae013[_0x41b9('0x36')];if(!_0x284e93[_0x41b9('0x32')][_0x41b9('0x37')](_0x41b9('0x38'))){_0x5eeb51[_0x41b9('0x1c')]=qs['limit'](_0x284e93[_0x41b9('0x32')][_0x41b9('0x1c')]);_0x5eeb51[_0x41b9('0x1b')]=qs[_0x41b9('0x1b')](_0x284e93['query'][_0x41b9('0x1b')]);}_0x5eeb51['order']=qs['sort'](_0x284e93[_0x41b9('0x32')]['sort']);_0x5eeb51[_0x41b9('0x39')]=qs['filters'](_[_0x41b9('0x3a')](_0x284e93[_0x41b9('0x32')],_0x1ae013[_0x41b9('0x3b')]),_0x6de6c5);if(_0x284e93[_0x41b9('0x32')][_0x41b9('0x3c')]){_0x5eeb51[_0x41b9('0x39')]=_['merge'](_0x5eeb51['where'],{'$or':_[_0x41b9('0x2f')](_0x6de6c5,function(_0x32196e){if(_0x32196e['type']!==_0x41b9('0x3d')){var _0x17920a={};_0x17920a[_0x32196e[_0x41b9('0x28')]]={'$like':'%'+_0x284e93[_0x41b9('0x32')][_0x41b9('0x3c')]+'%'};return _0x17920a;}})});}_0x5eeb51=_[_0x41b9('0x3e')]({},_0x5eeb51,_0x284e93[_0x41b9('0x3f')]);var _0xcb5984={'where':_0x5eeb51[_0x41b9('0x39')]};return db[_0x41b9('0x2b')]['count'](_0xcb5984)['then'](function(_0x1bd038){_0x5463e1[_0x41b9('0x40')]=_0x1bd038;if(_0x284e93[_0x41b9('0x32')][_0x41b9('0x41')]){_0x5eeb51['include']=[{'all':!![]}];}return db['Trigger']['findAll'](_0x5eeb51);})[_0x41b9('0x24')](function(_0x445346){_0x5463e1[_0x41b9('0x42')]=_0x445346;return _0x5463e1;})['then'](respondWithFilteredResult(_0x53199d,_0x5eeb51))['catch'](handleError(_0x53199d,null));};exports['show']=function(_0x3a86d5,_0x7546bc){var _0x105c3c={'raw':![],'where':{'id':_0x3a86d5[_0x41b9('0x43')]['id']}},_0x4a221c={};_0x4a221c[_0x41b9('0x36')]=_[_0x41b9('0x30')](db['Trigger']['rawAttributes']);_0x4a221c[_0x41b9('0x32')]=_[_0x41b9('0x30')](_0x3a86d5[_0x41b9('0x32')]);_0x4a221c['filters']=_[_0x41b9('0x31')](_0x4a221c[_0x41b9('0x36')],_0x4a221c[_0x41b9('0x32')]);_0x105c3c['attributes']=_[_0x41b9('0x31')](_0x4a221c[_0x41b9('0x36')],qs[_0x41b9('0x34')](_0x3a86d5[_0x41b9('0x32')]['fields']));_0x105c3c[_0x41b9('0x33')]=_0x105c3c['attributes'][_0x41b9('0x35')]?_0x105c3c[_0x41b9('0x33')]:_0x4a221c['model'];if(_0x3a86d5[_0x41b9('0x32')]['includeAll']){_0x105c3c[_0x41b9('0x44')]=[{'all':!![]}];}_0x105c3c=_['merge']({},_0x105c3c,_0x3a86d5['options']);return db[_0x41b9('0x2b')]['find'](_0x105c3c)[_0x41b9('0x24')](handleEntityNotFound(_0x7546bc,null))['then'](respondWithResult(_0x7546bc,null))[_0x41b9('0x45')](handleError(_0x7546bc,null));};exports[_0x41b9('0x46')]=function(_0x24c4e8,_0x210a32){return db[_0x41b9('0x2b')][_0x41b9('0x46')](_0x24c4e8[_0x41b9('0x47')],{})['then'](function(_0x46f4d8){var _0x2289c3=_0x24c4e8[_0x41b9('0x48')][_0x41b9('0x49')]({'plain':!![]});if(!_0x2289c3)throw new Error(_0x41b9('0x4a'));if(_0x2289c3[_0x41b9('0x4b')]===_0x41b9('0x48')){var _0x263c72=_0x46f4d8[_0x41b9('0x49')]({'plain':!![]});var _0x53b83d='Triggers';return db['UserProfileSection'][_0x41b9('0x4c')]({'where':{'name':_0x53b83d,'userProfileId':_0x2289c3[_0x41b9('0x4d')]},'raw':!![]})['then'](function(_0x5283ca){if(_0x5283ca&&_0x5283ca[_0x41b9('0x4e')]===0x0){return db[_0x41b9('0x4f')][_0x41b9('0x46')]({'name':_0x263c72[_0x41b9('0x28')],'resourceId':_0x263c72['id'],'type':_0x5283ca[_0x41b9('0x28')],'sectionId':_0x5283ca['id']},{})[_0x41b9('0x24')](function(){return _0x46f4d8;});}else{return _0x46f4d8;}})[_0x41b9('0x45')](function(_0x534b4c){logger[_0x41b9('0x26')](_0x41b9('0x50'),_0x534b4c);throw _0x534b4c;});}return _0x46f4d8;})[_0x41b9('0x24')](respondWithResult(_0x210a32,0xc9))[_0x41b9('0x45')](handleError(_0x210a32,null));};exports['update']=function(_0x52e96c,_0x16cfd8){if(_0x52e96c[_0x41b9('0x47')]['id']){delete _0x52e96c[_0x41b9('0x47')]['id'];}return db['Trigger'][_0x41b9('0x4c')]({'where':{'id':_0x52e96c[_0x41b9('0x43')]['id']}})[_0x41b9('0x24')](handleEntityNotFound(_0x16cfd8,null))[_0x41b9('0x24')](saveUpdates(_0x52e96c[_0x41b9('0x47')],null))[_0x41b9('0x24')](respondWithResult(_0x16cfd8,null))['catch'](handleError(_0x16cfd8,null));};exports[_0x41b9('0x23')]=function(_0x4198e9,_0x122865){return db[_0x41b9('0x2b')][_0x41b9('0x4c')]({'where':{'id':_0x4198e9[_0x41b9('0x43')]['id']}})['then'](handleEntityNotFound(_0x122865,null))['then'](removeEntity(_0x122865,null))[_0x41b9('0x45')](handleError(_0x122865,null));};exports['addAllCondition']=function(_0x3fa420,_0x74ed80,_0x49aedd){if(_0x3fa420[_0x41b9('0x47')]['id']){delete _0x3fa420[_0x41b9('0x47')]['id'];}return db[_0x41b9('0x2b')]['find']({'where':{'id':_0x3fa420['params']['id']}})['then'](handleEntityNotFound(_0x74ed80,null))[_0x41b9('0x24')](function(_0x578a4f){if(_0x578a4f){_0x3fa420[_0x41b9('0x47')][_0x41b9('0x51')]=_0x578a4f['id'];return db['Condition']['create'](_0x3fa420[_0x41b9('0x47')]);}})[_0x41b9('0x24')](respondWithResult(_0x74ed80,null))[_0x41b9('0x45')](handleError(_0x74ed80,null));};exports['addAnyCondition']=function(_0x704416,_0x3f8f5a,_0x811d92){if(_0x704416[_0x41b9('0x47')]['id']){delete _0x704416['body']['id'];}return db[_0x41b9('0x2b')][_0x41b9('0x4c')]({'where':{'id':_0x704416[_0x41b9('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f8f5a,null))[_0x41b9('0x24')](function(_0x32e87d){if(_0x32e87d){_0x704416[_0x41b9('0x47')][_0x41b9('0x52')]=_0x32e87d['id'];return db[_0x41b9('0x53')][_0x41b9('0x46')](_0x704416[_0x41b9('0x47')]);}})[_0x41b9('0x24')](respondWithResult(_0x3f8f5a,null))[_0x41b9('0x45')](handleError(_0x3f8f5a,null));};exports[_0x41b9('0x54')]=function(_0x4c2f8b,_0x243b84,_0x4bbc6d){var _0x45bfaf={};var _0x2818b9={};var _0x1474a0;var _0xf41980;return db[_0x41b9('0x2b')][_0x41b9('0x55')]({'where':{'id':_0x4c2f8b[_0x41b9('0x43')]['id']}})[_0x41b9('0x24')](handleEntityNotFound(_0x243b84,null))[_0x41b9('0x24')](function(_0x38d339){if(_0x38d339){_0x1474a0=_0x38d339;_0x2818b9[_0x41b9('0x36')]=_[_0x41b9('0x30')](db[_0x41b9('0x53')]['rawAttributes']);_0x2818b9[_0x41b9('0x32')]=_[_0x41b9('0x30')](_0x4c2f8b[_0x41b9('0x32')]);_0x2818b9[_0x41b9('0x3b')]=_[_0x41b9('0x31')](_0x2818b9['model'],_0x2818b9[_0x41b9('0x32')]);_0x45bfaf[_0x41b9('0x33')]=_['intersection'](_0x2818b9[_0x41b9('0x36')],qs[_0x41b9('0x34')](_0x4c2f8b[_0x41b9('0x32')][_0x41b9('0x34')]));_0x45bfaf[_0x41b9('0x33')]=_0x45bfaf[_0x41b9('0x33')][_0x41b9('0x35')]?_0x45bfaf['attributes']:_0x2818b9[_0x41b9('0x36')];_0x45bfaf[_0x41b9('0x56')]=qs[_0x41b9('0x57')](_0x4c2f8b[_0x41b9('0x32')][_0x41b9('0x57')]);_0x45bfaf[_0x41b9('0x39')]=qs[_0x41b9('0x3b')](_['pick'](_0x4c2f8b[_0x41b9('0x32')],_0x2818b9['filters']));if(_0x4c2f8b[_0x41b9('0x32')][_0x41b9('0x3c')]){_0x45bfaf[_0x41b9('0x39')]=_[_0x41b9('0x3e')](_0x45bfaf['where'],{'$or':_[_0x41b9('0x2f')](_0x45bfaf[_0x41b9('0x33')],function(_0x53699f){var _0x1241dc={};_0x1241dc[_0x53699f]={'$like':'%'+_0x4c2f8b[_0x41b9('0x32')][_0x41b9('0x3c')]+'%'};return _0x1241dc;})});}_0x45bfaf=_['merge']({},_0x45bfaf,_0x4c2f8b[_0x41b9('0x3f')]);return _0x1474a0[_0x41b9('0x54')](_0x45bfaf);}})[_0x41b9('0x24')](function(_0x2f7d22){if(_0x2f7d22){_0xf41980=_0x2f7d22[_0x41b9('0x35')];if(!_0x4c2f8b[_0x41b9('0x32')][_0x41b9('0x37')](_0x41b9('0x38'))){_0x45bfaf[_0x41b9('0x1c')]=qs['limit'](_0x4c2f8b[_0x41b9('0x32')][_0x41b9('0x1c')]);_0x45bfaf[_0x41b9('0x1b')]=qs[_0x41b9('0x1b')](_0x4c2f8b[_0x41b9('0x32')][_0x41b9('0x1b')]);}return _0x1474a0['getAllConditions'](_0x45bfaf);}})['then'](function(_0x2097fd){if(_0x2097fd){return _0x2097fd?{'count':_0xf41980,'rows':_0x2097fd}:null;}})[_0x41b9('0x24')](respondWithResult(_0x243b84,null))['catch'](handleError(_0x243b84,null));};exports[_0x41b9('0x58')]=function(_0x5b2dc0,_0x99aed8,_0xa5658f){var _0x33e24f={};var _0x104523={};var _0x424056;var _0x5c2ec4;return db[_0x41b9('0x2b')][_0x41b9('0x55')]({'where':{'id':_0x5b2dc0[_0x41b9('0x43')]['id']}})['then'](handleEntityNotFound(_0x99aed8,null))[_0x41b9('0x24')](function(_0x2a8187){if(_0x2a8187){_0x424056=_0x2a8187;_0x104523[_0x41b9('0x36')]=_[_0x41b9('0x30')](db[_0x41b9('0x53')][_0x41b9('0x2c')]);_0x104523[_0x41b9('0x32')]=_[_0x41b9('0x30')](_0x5b2dc0[_0x41b9('0x32')]);_0x104523[_0x41b9('0x3b')]=_[_0x41b9('0x31')](_0x104523[_0x41b9('0x36')],_0x104523['query']);_0x33e24f['attributes']=_[_0x41b9('0x31')](_0x104523['model'],qs['fields'](_0x5b2dc0[_0x41b9('0x32')]['fields']));_0x33e24f[_0x41b9('0x33')]=_0x33e24f[_0x41b9('0x33')][_0x41b9('0x35')]?_0x33e24f[_0x41b9('0x33')]:_0x104523[_0x41b9('0x36')];_0x33e24f[_0x41b9('0x56')]=qs[_0x41b9('0x57')](_0x5b2dc0[_0x41b9('0x32')][_0x41b9('0x57')]);_0x33e24f[_0x41b9('0x39')]=qs[_0x41b9('0x3b')](_[_0x41b9('0x3a')](_0x5b2dc0[_0x41b9('0x32')],_0x104523[_0x41b9('0x3b')]));if(_0x5b2dc0[_0x41b9('0x32')][_0x41b9('0x3c')]){_0x33e24f['where']=_[_0x41b9('0x3e')](_0x33e24f['where'],{'$or':_[_0x41b9('0x2f')](_0x33e24f[_0x41b9('0x33')],function(_0x35a4db){var _0x4aeeee={};_0x4aeeee[_0x35a4db]={'$like':'%'+_0x5b2dc0[_0x41b9('0x32')][_0x41b9('0x3c')]+'%'};return _0x4aeeee;})});}_0x33e24f=_[_0x41b9('0x3e')]({},_0x33e24f,_0x5b2dc0['options']);return _0x424056[_0x41b9('0x58')](_0x33e24f);}})[_0x41b9('0x24')](function(_0x3d96a4){if(_0x3d96a4){_0x5c2ec4=_0x3d96a4[_0x41b9('0x35')];if(!_0x5b2dc0[_0x41b9('0x32')][_0x41b9('0x37')](_0x41b9('0x38'))){_0x33e24f[_0x41b9('0x1c')]=qs[_0x41b9('0x1c')](_0x5b2dc0['query']['limit']);_0x33e24f[_0x41b9('0x1b')]=qs['offset'](_0x5b2dc0[_0x41b9('0x32')][_0x41b9('0x1b')]);}return _0x424056[_0x41b9('0x58')](_0x33e24f);}})[_0x41b9('0x24')](function(_0x38c494){if(_0x38c494){return _0x38c494?{'count':_0x5c2ec4,'rows':_0x38c494}:null;}})[_0x41b9('0x24')](respondWithResult(_0x99aed8,null))['catch'](handleError(_0x99aed8,null));};exports[_0x41b9('0x59')]=function(_0x120ab0,_0x442045,_0xc41646){if(_0x120ab0[_0x41b9('0x47')]['id']){delete _0x120ab0[_0x41b9('0x47')]['id'];}return db['Trigger'][_0x41b9('0x4c')]({'where':{'id':_0x120ab0[_0x41b9('0x43')]['id']}})[_0x41b9('0x24')](handleEntityNotFound(_0x442045,null))[_0x41b9('0x24')](function(_0x3a2f77){if(_0x3a2f77){_0x120ab0[_0x41b9('0x47')]['TriggerId']=_0x3a2f77['id'];return db['Action']['create'](_0x120ab0['body']);}})[_0x41b9('0x24')](respondWithResult(_0x442045,null))[_0x41b9('0x45')](handleError(_0x442045,null));};exports[_0x41b9('0x5a')]=function(_0x5183b5,_0x5eea0f,_0x72f2a7){var _0x2e23c6={};var _0x1065e8={};var _0x55f529;var _0x55d3dd;return db[_0x41b9('0x2b')]['findOne']({'where':{'id':_0x5183b5[_0x41b9('0x43')]['id']}})['then'](handleEntityNotFound(_0x5eea0f,null))[_0x41b9('0x24')](function(_0x264098){if(_0x264098){_0x55f529=_0x264098;_0x1065e8[_0x41b9('0x36')]=_[_0x41b9('0x30')](db['Action']['rawAttributes']);_0x1065e8[_0x41b9('0x32')]=_[_0x41b9('0x30')](_0x5183b5[_0x41b9('0x32')]);_0x1065e8['filters']=_[_0x41b9('0x31')](_0x1065e8[_0x41b9('0x36')],_0x1065e8[_0x41b9('0x32')]);_0x2e23c6[_0x41b9('0x33')]=_['intersection'](_0x1065e8[_0x41b9('0x36')],qs[_0x41b9('0x34')](_0x5183b5[_0x41b9('0x32')][_0x41b9('0x34')]));_0x2e23c6['attributes']=_0x2e23c6[_0x41b9('0x33')]['length']?_0x2e23c6[_0x41b9('0x33')]:_0x1065e8['model'];_0x2e23c6[_0x41b9('0x56')]=qs[_0x41b9('0x57')](_0x5183b5['query'][_0x41b9('0x57')]);_0x2e23c6['where']=qs[_0x41b9('0x3b')](_['pick'](_0x5183b5[_0x41b9('0x32')],_0x1065e8[_0x41b9('0x3b')]));if(_0x5183b5[_0x41b9('0x32')]['filter']){_0x2e23c6['where']=_[_0x41b9('0x3e')](_0x2e23c6[_0x41b9('0x39')],{'$or':_[_0x41b9('0x2f')](_0x2e23c6['attributes'],function(_0x5728f8){var _0x46bbe3={};_0x46bbe3[_0x5728f8]={'$like':'%'+_0x5183b5[_0x41b9('0x32')]['filter']+'%'};return _0x46bbe3;})});}_0x2e23c6=_[_0x41b9('0x3e')]({},_0x2e23c6,_0x5183b5['options']);return _0x55f529['getActions'](_0x2e23c6);}})[_0x41b9('0x24')](function(_0xc2849c){if(_0xc2849c){_0x55d3dd=_0xc2849c[_0x41b9('0x35')];if(!_0x5183b5[_0x41b9('0x32')]['hasOwnProperty'](_0x41b9('0x38'))){_0x2e23c6[_0x41b9('0x1c')]=qs['limit'](_0x5183b5[_0x41b9('0x32')]['limit']);_0x2e23c6[_0x41b9('0x1b')]=qs[_0x41b9('0x1b')](_0x5183b5[_0x41b9('0x32')][_0x41b9('0x1b')]);}return _0x55f529[_0x41b9('0x5a')](_0x2e23c6);}})[_0x41b9('0x24')](function(_0x3499cf){if(_0x3499cf){return _0x3499cf?{'count':_0x55d3dd,'rows':_0x3499cf}:null;}})[_0x41b9('0x24')](respondWithResult(_0x5eea0f,null))[_0x41b9('0x45')](handleError(_0x5eea0f,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 4c9ef57..cf02ad7 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 _0x8324=['path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x46651b,_0x4a5cc5){var _0x4b6f92=function(_0x5ec09d){while(--_0x5ec09d){_0x46651b['push'](_0x46651b['shift']());}};_0x4b6f92(++_0x4a5cc5);}(_0x8324,0x1ab));var _0x4832=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x8324[_0x15ea09];return _0x3e9c78;};'use strict';var _=require(_0x4832('0x0'));var util=require('util');var logger=require(_0x4832('0x1'))('api');var moment=require(_0x4832('0x2'));var BPromise=require(_0x4832('0x3'));var rp=require(_0x4832('0x4'));var fs=require('fs');var path=require(_0x4832('0x5'));var rimraf=require(_0x4832('0x6'));var config=require(_0x4832('0x7'));var attributes=require(_0x4832('0x8'));module[_0x4832('0x9')]=function(_0x4e3c0f,_0x193911){return _0x4e3c0f['define'](_0x4832('0xa'),attributes,{'tableName':_0x4832('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc404=['define','tools_triggers','lodash','util','../../config/logger','path','rimraf','./trigger.attributes','exports'];(function(_0x2980d1,_0x12be62){var _0x150368=function(_0x29ddbe){while(--_0x29ddbe){_0x2980d1['push'](_0x2980d1['shift']());}};_0x150368(++_0x12be62);}(_0xc404,0x197));var _0x4c40=function(_0x26b129,_0x1f6dee){_0x26b129=_0x26b129-0x0;var _0x3e9741=_0xc404[_0x26b129];return _0x3e9741;};'use strict';var _=require(_0x4c40('0x0'));var util=require(_0x4c40('0x1'));var logger=require(_0x4c40('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c40('0x3'));var rimraf=require(_0x4c40('0x4'));var config=require('../../config/environment');var attributes=require(_0x4c40('0x5'));module[_0x4c40('0x6')]=function(_0x1ad037,_0x3a633c){return _0x1ad037[_0x4c40('0x7')]('Trigger',attributes,{'tableName':_0x4c40('0x8'),'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 eb6eb46..b624292 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 _0x0102=['util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrigger','findAll','options','raw','where','attributes','include','model','map','find','ShowTrigger'];(function(_0x5708a1,_0x5cfd78){var _0x119002=function(_0x22fd89){while(--_0x22fd89){_0x5708a1['push'](_0x5708a1['shift']());}};_0x119002(++_0x5cfd78);}(_0x0102,0x186));var _0x2010=function(_0x4677ad,_0x5cffd7){_0x4677ad=_0x4677ad-0x0;var _0x5e5972=_0x0102[_0x4677ad];return _0x5e5972;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var moment=require(_0x2010('0x1'));var BPromise=require(_0x2010('0x2'));var rs=require(_0x2010('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2010('0x4'));var jayson=require(_0x2010('0x5'));var client=jayson[_0x2010('0x6')][_0x2010('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4eeb67,_0x453fc0,_0x495d98){return new BPromise(function(_0x4728c0,_0x160e41){return client['request'](_0x4eeb67,_0x495d98)[_0x2010('0x8')](function(_0x3c2d98){logger[_0x2010('0x9')](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));logger[_0x2010('0xc')](_0x2010('0xd'),_0x453fc0,_0x2010('0xb'),JSON[_0x2010('0xe')](_0x3c2d98));if(_0x3c2d98[_0x2010('0xf')]){if(_0x3c2d98[_0x2010('0xf')][_0x2010('0x10')]===0x1f4){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x160e41(_0x3c2d98['error']['message']);}logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x4728c0(_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);}else{logger['info'](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));_0x4728c0(_0x3c2d98['result'][_0x2010('0x11')]);}})[_0x2010('0x12')](function(_0x410889){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x410889);_0x160e41(_0x410889);});});}exports[_0x2010('0x13')]=function(_0x83cd35){var _0x1476c0=this;return new Promise(function(_0x309477,_0x569de2){return db['Trigger'][_0x2010('0x14')]({'raw':_0x83cd35[_0x2010('0x15')]?_0x83cd35[_0x2010('0x15')][_0x2010('0x16')]===undefined?!![]:![]:!![],'where':_0x83cd35['options']?_0x83cd35['options'][_0x2010('0x17')]||null:null,'attributes':_0x83cd35[_0x2010('0x15')]?_0x83cd35[_0x2010('0x15')][_0x2010('0x18')]||null:null,'limit':_0x83cd35[_0x2010('0x15')]?_0x83cd35[_0x2010('0x15')]['limit']||null:null,'include':_0x83cd35[_0x2010('0x15')]?_0x83cd35[_0x2010('0x15')]['include']?_['map'](_0x83cd35['options'][_0x2010('0x19')],function(_0x574719){return{'model':db[_0x574719[_0x2010('0x1a')]],'as':_0x574719['as'],'attributes':_0x574719['attributes'],'include':_0x574719['include']?_[_0x2010('0x1b')](_0x574719[_0x2010('0x19')],function(_0x52b4fe){return{'model':db[_0x52b4fe[_0x2010('0x1a')]],'as':_0x52b4fe['as'],'attributes':_0x52b4fe['attributes'],'include':_0x52b4fe[_0x2010('0x19')]?_[_0x2010('0x1b')](_0x52b4fe[_0x2010('0x19')],function(_0x3dcea4){return{'model':db[_0x3dcea4[_0x2010('0x1a')]],'as':_0x3dcea4['as'],'attributes':_0x3dcea4[_0x2010('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2010('0x8')](function(_0x3eb4dc){logger[_0x2010('0x9')](_0x2010('0x13'),_0x83cd35);logger[_0x2010('0xc')](_0x2010('0x13'),_0x83cd35,JSON['stringify'](_0x3eb4dc));_0x309477(_0x3eb4dc);})[_0x2010('0x12')](function(_0x52fe5e){logger[_0x2010('0xf')](_0x2010('0x13'),_0x52fe5e[_0x2010('0x11')],_0x83cd35);_0x569de2(_0x1476c0[_0x2010('0xf')](0x1f4,_0x52fe5e['message']));});});};exports['ShowTrigger']=function(_0x136d5f){var _0x48d9f2=this;return new Promise(function(_0x2839f2,_0x1d5d7a){return db['Trigger'][_0x2010('0x1c')]({'raw':_0x136d5f[_0x2010('0x15')]?_0x136d5f[_0x2010('0x15')][_0x2010('0x16')]===undefined?!![]:![]:!![],'where':_0x136d5f[_0x2010('0x15')]?_0x136d5f['options'][_0x2010('0x17')]||null:null,'attributes':_0x136d5f[_0x2010('0x15')]?_0x136d5f[_0x2010('0x15')]['attributes']||null:null,'include':_0x136d5f['options']?_0x136d5f[_0x2010('0x15')][_0x2010('0x19')]?_[_0x2010('0x1b')](_0x136d5f['options']['include'],function(_0xac64e1){return{'model':db[_0xac64e1[_0x2010('0x1a')]],'as':_0xac64e1['as'],'attributes':_0xac64e1[_0x2010('0x18')],'include':_0xac64e1[_0x2010('0x19')]?_[_0x2010('0x1b')](_0xac64e1['include'],function(_0x569e13){return{'model':db[_0x569e13['model']],'as':_0x569e13['as'],'attributes':_0x569e13[_0x2010('0x18')],'include':_0x569e13[_0x2010('0x19')]?_[_0x2010('0x1b')](_0x569e13['include'],function(_0x1f7f49){return{'model':db[_0x1f7f49[_0x2010('0x1a')]],'as':_0x1f7f49['as'],'attributes':_0x1f7f49[_0x2010('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2010('0x8')](function(_0x4f5106){logger[_0x2010('0x9')](_0x2010('0x1d'),_0x136d5f);logger[_0x2010('0xc')]('ShowTrigger',_0x136d5f,JSON[_0x2010('0xe')](_0x4f5106));_0x2839f2(_0x4f5106);})['catch'](function(_0x13f88a){logger[_0x2010('0xf')](_0x2010('0x1d'),_0x13f88a[_0x2010('0x11')],_0x136d5f);_0x1d5d7a(_0x48d9f2[_0x2010('0xf')](0x1f4,_0x13f88a[_0x2010('0x11')]));});});}; \ No newline at end of file +var _0xab40=['Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Trigger','findAll','options','limit','include','model','map','attributes','GetTrigger','ShowTrigger','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','Trigger,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2fba0e,_0x1a8c05){var _0x3d1553=function(_0x33641e){while(--_0x33641e){_0x2fba0e['push'](_0x2fba0e['shift']());}};_0x3d1553(++_0x1a8c05);}(_0xab40,0xcd));var _0x0ab4=function(_0x2c7780,_0x14c36e){_0x2c7780=_0x2c7780-0x0;var _0x2ddd63=_0xab40[_0x2c7780];return _0x2ddd63;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ab4('0x2'));var db=require(_0x0ab4('0x3'))['db'];var utils=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10d92b,_0x46d16a,_0x11e99f){return new BPromise(function(_0x6d135d,_0x4cf8de){return client['request'](_0x10d92b,_0x11e99f)['then'](function(_0x24271e){logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));logger[_0x0ab4('0xb')](_0x0ab4('0xc'),_0x46d16a,_0x0ab4('0xa'),JSON[_0x0ab4('0xd')](_0x24271e));if(_0x24271e['error']){if(_0x24271e['error'][_0x0ab4('0xe')]===0x1f4){logger['error'](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x4cf8de(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}logger[_0x0ab4('0xf')](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x6d135d(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}else{logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));_0x6d135d(_0x24271e[_0x0ab4('0x11')][_0x0ab4('0x10')]);}})[_0x0ab4('0x12')](function(_0x2bdda7){logger['error']('Trigger,\x20%s,\x20%s',_0x46d16a,_0x2bdda7);_0x4cf8de(_0x2bdda7);});});}exports['GetTrigger']=function(_0x17422f){var _0x30d5df=this;return new Promise(function(_0x2f50d2,_0x53723c){return db[_0x0ab4('0x13')][_0x0ab4('0x14')]({'raw':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x17422f['options']?_0x17422f[_0x0ab4('0x15')]['where']||null:null,'attributes':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['attributes']||null:null,'limit':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')][_0x0ab4('0x16')]||null:null,'include':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['include']?_['map'](_0x17422f[_0x0ab4('0x15')][_0x0ab4('0x17')],function(_0x392afe){return{'model':db[_0x392afe[_0x0ab4('0x18')]],'as':_0x392afe['as'],'attributes':_0x392afe['attributes'],'include':_0x392afe[_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x392afe[_0x0ab4('0x17')],function(_0x4ea9aa){return{'model':db[_0x4ea9aa['model']],'as':_0x4ea9aa['as'],'attributes':_0x4ea9aa[_0x0ab4('0x1a')],'include':_0x4ea9aa[_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x4ea9aa['include'],function(_0x519b23){return{'model':db[_0x519b23['model']],'as':_0x519b23['as'],'attributes':_0x519b23[_0x0ab4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bf844){logger[_0x0ab4('0x8')]('GetTrigger',_0x17422f);logger['debug']('GetTrigger',_0x17422f,JSON[_0x0ab4('0xd')](_0x3bf844));_0x2f50d2(_0x3bf844);})[_0x0ab4('0x12')](function(_0x1cfdad){logger[_0x0ab4('0xf')](_0x0ab4('0x1b'),_0x1cfdad['message'],_0x17422f);_0x53723c(_0x30d5df['error'](0x1f4,_0x1cfdad['message']));});});};exports[_0x0ab4('0x1c')]=function(_0x2b66d5){var _0x155d96=this;return new Promise(function(_0x182bbe,_0x46eda7){return db['Trigger']['find']({'raw':_0x2b66d5[_0x0ab4('0x15')]?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b66d5['options']?_0x2b66d5['options'][_0x0ab4('0x1e')]||null:null,'attributes':_0x2b66d5['options']?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x1a')]||null:null,'include':_0x2b66d5[_0x0ab4('0x15')]?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x2b66d5['options'][_0x0ab4('0x17')],function(_0x4696fc){return{'model':db[_0x4696fc[_0x0ab4('0x18')]],'as':_0x4696fc['as'],'attributes':_0x4696fc[_0x0ab4('0x1a')],'include':_0x4696fc['include']?_['map'](_0x4696fc[_0x0ab4('0x17')],function(_0x3e65a1){return{'model':db[_0x3e65a1[_0x0ab4('0x18')]],'as':_0x3e65a1['as'],'attributes':_0x3e65a1['attributes'],'include':_0x3e65a1['include']?_['map'](_0x3e65a1[_0x0ab4('0x17')],function(_0x35eab3){return{'model':db[_0x35eab3[_0x0ab4('0x18')]],'as':_0x35eab3['as'],'attributes':_0x35eab3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x492943){logger[_0x0ab4('0x8')](_0x0ab4('0x1c'),_0x2b66d5);logger[_0x0ab4('0xb')](_0x0ab4('0x1c'),_0x2b66d5,JSON[_0x0ab4('0xd')](_0x492943));_0x182bbe(_0x492943);})[_0x0ab4('0x12')](function(_0x52d9bf){logger[_0x0ab4('0xf')](_0x0ab4('0x1c'),_0x52d9bf[_0x0ab4('0x10')],_0x2b66d5);_0x46eda7(_0x155d96['error'](0x1f4,_0x52d9bf[_0x0ab4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 007c605..52912d3 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 _0x4b84=['./trunk.controller','get','isAuthenticated','post','clone','put','/:id','update','delete','exports','multer','util','express','../../components/interaction/service','../../config/environment'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x4b84[_0x5e9876];return _0x576c48;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x44b8('0x3'));var config=require(_0x44b8('0x4'));var controller=require(_0x44b8('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x44b8('0x6')]('/:id',auth[_0x44b8('0x7')](),controller['show']);router[_0x44b8('0x8')]('/:id/clone',auth['isAuthenticated'](),controller[_0x44b8('0x9')]);router[_0x44b8('0x8')]('/',auth[_0x44b8('0x7')](),controller['create']);router[_0x44b8('0xa')](_0x44b8('0xb'),auth[_0x44b8('0x7')](),controller[_0x44b8('0xc')]);router[_0x44b8('0xd')](_0x44b8('0xb'),auth[_0x44b8('0x7')](),controller['destroy']);module[_0x44b8('0xe')]=router; \ No newline at end of file +var _0x17ba=['show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id'];(function(_0x1733e1,_0x5d2dc1){var _0x5a4854=function(_0x47820a){while(--_0x47820a){_0x1733e1['push'](_0x1733e1['shift']());}};_0x5a4854(++_0x5d2dc1);}(_0x17ba,0xab));var _0xa17b=function(_0x25e34d,_0x16c5fd){_0x25e34d=_0x25e34d-0x0;var _0x249c45=_0x17ba[_0x25e34d];return _0x249c45;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var auth=require(_0xa17b('0x5'));var interaction=require(_0xa17b('0x6'));var config=require(_0xa17b('0x7'));var controller=require(_0xa17b('0x8'));router[_0xa17b('0x9')]('/',auth[_0xa17b('0xa')](),controller[_0xa17b('0xb')]);router[_0xa17b('0x9')](_0xa17b('0xc'),auth[_0xa17b('0xa')](),controller[_0xa17b('0xd')]);router[_0xa17b('0xe')](_0xa17b('0xf'),auth[_0xa17b('0xa')](),controller[_0xa17b('0x10')]);router[_0xa17b('0xe')]('/',auth['isAuthenticated'](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xc'),auth[_0xa17b('0xa')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')](_0xa17b('0xc'),auth['isAuthenticated'](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 9b6b24c..1f1f425 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 _0xdb41=['friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','rfc2833','shortinfo','auto','yes','nonat','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','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','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','actpass','dynamic','update,nonat','BOOLEAN','sequelize','name','ENUM'];(function(_0x47037d,_0x5bea6b){var _0x401d0a=function(_0x1461eb){while(--_0x1461eb){_0x47037d['push'](_0x47037d['shift']());}};_0x401d0a(++_0x5bea6b);}(_0xdb41,0x90));var _0x1db4=function(_0x7c1a5d,_0x4bcb22){_0x7c1a5d=_0x7c1a5d-0x0;var _0x1cceb3=_0xdb41[_0x7c1a5d];return _0x1cceb3;};'use strict';var Sequelize=require(_0x1db4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1db4('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x3'),_0x1db4('0x4'),_0x1db4('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x1db4('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x7'),_0x1db4('0x8'),_0x1db4('0x9'),'ALLOWED',_0x1db4('0xa'),_0x1db4('0xb'),_0x1db4('0xc'),_0x1db4('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x1db4('0x6')]},'secret':{'type':Sequelize[_0x1db4('0x6')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x1db4('0x6')]},'transport':{'type':Sequelize[_0x1db4('0x6')],'defaultValue':_0x1db4('0xe'),'set':function(_0x47aeb2){this[_0x1db4('0xf')]('transport',_0x47aeb2?_0x47aeb2[_0x1db4('0x10')](','):null);},'get':function(){return this[_0x1db4('0x11')]('transport')?this[_0x1db4('0x11')](_0x1db4('0x12'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x13'),'info',_0x1db4('0x14'),'inband',_0x1db4('0x15')),'defaultValue':_0x1db4('0x13')},'directmedia':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no',_0x1db4('0x17'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1db4('0x6')]},'directmediadeny':{'type':Sequelize[_0x1db4('0x6')]},'nat':{'type':Sequelize[_0x1db4('0x6')],'defaultValue':_0x1db4('0x18'),'set':function(_0x5e1893){this[_0x1db4('0xf')](_0x1db4('0x19'),_0x5e1893?_0x5e1893[_0x1db4('0x10')](','):null);},'get':function(){return this[_0x1db4('0x11')](_0x1db4('0x19'))?this[_0x1db4('0x11')](_0x1db4('0x19'))[_0x1db4('0x1a')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1db4('0x6')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x1db4('0x6')]},'language':{'type':Sequelize[_0x1db4('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1db4('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1db4('0x6')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x1db4('0x6')],'allowNull':![],'defaultValue':_0x1db4('0x1b'),'set':function(_0x5664ec){this[_0x1db4('0xf')](_0x1db4('0x1c'),_0x5664ec?_0x5664ec[_0x1db4('0x10')](';'):_0x1db4('0x1b'));},'get':function(){return this[_0x1db4('0x11')](_0x1db4('0x1c'))?this['getDataValue'](_0x1db4('0x1c'))[_0x1db4('0x1a')](';'):null;},'comment':_0x1db4('0x1d')},'autoframing':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'insecure':{'type':Sequelize[_0x1db4('0x6')],'defaultValue':_0x1db4('0x1e'),'set':function(_0x529273){this[_0x1db4('0xf')]('insecure',_0x529273?_0x529273['join'](','):null);},'get':function(){return this[_0x1db4('0x11')](_0x1db4('0x1f'))?this[_0x1db4('0x11')](_0x1db4('0x1f'))['split'](','):null;},'comment':_0x1db4('0x20')},'trustrpid':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x1db4('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1db4('0x2')]('yes','no',_0x1db4('0x21'))},'promiscredir':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x1db4('0x2')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x1db4('0x6')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x1db4('0x22')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no'),'defaultValue':_0x1db4('0x16')},'busylevel':{'type':Sequelize[_0x1db4('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x1db4('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x1db4('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x1db4('0x6')]},'videosupport':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no',_0x1db4('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1db4('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1db4('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0x1db4('0x6')]},'session_timers':{'type':Sequelize['ENUM'](_0x1db4('0x25'),_0x1db4('0x26'),_0x1db4('0x27'))},'session_expires':{'type':Sequelize[_0x1db4('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x1db4('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x1db4('0x2')]('uac',_0x1db4('0x28')),'defaultValue':_0x1db4('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x1db4('0x6')]},'regexten':{'type':Sequelize[_0x1db4('0x6')]},'fromdomain':{'type':Sequelize[_0x1db4('0x6')]},'fromuser':{'type':Sequelize[_0x1db4('0x6')]},'port':{'type':Sequelize[_0x1db4('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x1db4('0x16'),'no'),'defaultValue':_0x1db4('0x16')},'keepalive':{'type':Sequelize[_0x1db4('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x1db4('0x6')]},'defaultuser':{'type':Sequelize[_0x1db4('0x6')]},'rtptimeout':{'type':Sequelize[_0x1db4('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x1db4('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x1db4('0x16'),'no',_0x1db4('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1db4('0x6')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x1db4('0x23')](0xb)},'timerb':{'type':Sequelize[_0x1db4('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1db4('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x1db4('0x6')]},'contactdeny':{'type':Sequelize[_0x1db4('0x6')]},'contactacl':{'type':Sequelize[_0x1db4('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0x1db4('0x6')]},'use_q850_reason':{'type':Sequelize[_0x1db4('0x6')]},'maxforwards':{'type':Sequelize[_0x1db4('0x23')](0xb)},'encryption':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'force_avp':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'icesupport':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x1db4('0x2')]('yes','no',_0x1db4('0x2a'),_0x1db4('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x1db4('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x1db4('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0x1db4('0x6')]},'dtlscipher':{'type':Sequelize[_0x1db4('0x6')]},'dtlscafile':{'type':Sequelize[_0x1db4('0x6')]},'dtlscapath':{'type':Sequelize[_0x1db4('0x6')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x1db4('0x2c'),'passive',_0x1db4('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1db4('0x6')]},'usereqphone':{'type':Sequelize[_0x1db4('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1db4('0x6')]},'recordofffeature':{'type':Sequelize[_0x1db4('0x6')]},'call_limit':{'type':Sequelize[_0x1db4('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x1db4('0x6')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x1db4('0x6')]},'description':{'type':Sequelize[_0x1db4('0x6')]},'host':{'type':Sequelize[_0x1db4('0x6')],'defaultValue':_0x1db4('0x2e')},'canreinvite':{'type':Sequelize['ENUM'](_0x1db4('0x16'),'no',_0x1db4('0x17'),'update',_0x1db4('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1db4('0x6')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1db4('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1db4('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0x3d3d=['ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','update','outgoing','force_rport,comedia','setDataValue','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','certificate','active','passive','nonat','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','user','peer','friend'];(function(_0x19be2e,_0x5a2ffc){var _0x1eb2c0=function(_0x386a11){while(--_0x386a11){_0x19be2e['push'](_0x19be2e['shift']());}};_0x1eb2c0(++_0x5a2ffc);}(_0x3d3d,0x150));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd3d3('0x0'));module['exports']={'name':{'type':Sequelize[_0xd3d3('0x1')],'allowNull':![],'unique':_0xd3d3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd3d3('0x3')]('friend',_0xd3d3('0x4'),_0xd3d3('0x5')),'allowNull':![],'defaultValue':_0xd3d3('0x6')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xd3d3('0x7'),_0xd3d3('0x8'),'ALLOWED',_0xd3d3('0x9'),_0xd3d3('0xa'),_0xd3d3('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0xd3d3('0x1')]},'permit':{'type':Sequelize[_0xd3d3('0x1')]},'secret':{'type':Sequelize[_0xd3d3('0x1')]},'md5secret':{'type':Sequelize[_0xd3d3('0x1')]},'remotesecret':{'type':Sequelize[_0xd3d3('0x1')]},'transport':{'type':Sequelize[_0xd3d3('0x1')],'defaultValue':_0xd3d3('0xc'),'set':function(_0x1dac5a){this['setDataValue'](_0xd3d3('0xd'),_0x1dac5a?_0x1dac5a['join'](','):null);},'get':function(){return this['getDataValue'](_0xd3d3('0xd'))?this[_0xd3d3('0xe')]('transport')[_0xd3d3('0xf')](','):null;},'comment':_0xd3d3('0x10')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xd3d3('0x11'),_0xd3d3('0x12'),_0xd3d3('0x13'),_0xd3d3('0x14')),'defaultValue':_0xd3d3('0x15')},'directmedia':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no','nonat',_0xd3d3('0x17'),_0xd3d3('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd3d3('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xd3d3('0x1')],'defaultValue':_0xd3d3('0x19'),'set':function(_0x2f02e5){this[_0xd3d3('0x1a')](_0xd3d3('0x1b'),_0x2f02e5?_0x2f02e5[_0xd3d3('0x1c')](','):null);},'get':function(){return this[_0xd3d3('0xe')](_0xd3d3('0x1b'))?this[_0xd3d3('0xe')](_0xd3d3('0x1b'))[_0xd3d3('0xf')](','):null;},'comment':_0xd3d3('0x1d')},'callgroup':{'type':Sequelize[_0xd3d3('0x1')]},'namedcallgroup':{'type':Sequelize[_0xd3d3('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xd3d3('0x1')]},'language':{'type':Sequelize[_0xd3d3('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd3d3('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xd3d3('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2eaa29){this[_0xd3d3('0x1a')]('allow',_0x2eaa29?_0x2eaa29['join'](';'):_0xd3d3('0x1e'));},'get':function(){return this[_0xd3d3('0xe')]('allow')?this['getDataValue'](_0xd3d3('0x1f'))[_0xd3d3('0xf')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xd3d3('0x16'),'no')},'insecure':{'type':Sequelize[_0xd3d3('0x1')],'defaultValue':'port,invite','set':function(_0x3956fd){this[_0xd3d3('0x1a')](_0xd3d3('0x20'),_0x3956fd?_0x3956fd['join'](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xd3d3('0xe')](_0xd3d3('0x20'))['split'](','):null;},'comment':_0xd3d3('0x21')},'trustrpid':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no','never')},'promiscredir':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no')},'accountcode':{'type':Sequelize[_0xd3d3('0x22')](0xb)},'setvar':{'type':Sequelize[_0xd3d3('0x1')]},'callerid':{'type':Sequelize[_0xd3d3('0x1')],'defaultValue':_0xd3d3('0x23')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no'),'defaultValue':_0xd3d3('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xd3d3('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd3d3('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xd3d3('0x1')]},'videosupport':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no',_0xd3d3('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd3d3('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no')},'mailbox':{'type':Sequelize[_0xd3d3('0x1')]},'session_timers':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x25'),_0xd3d3('0x26'),_0xd3d3('0x27'))},'session_expires':{'type':Sequelize[_0xd3d3('0x22')](0xb)},'session_minse':{'type':Sequelize[_0xd3d3('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x28'),_0xd3d3('0x29')),'defaultValue':_0xd3d3('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xd3d3('0x1')]},'regexten':{'type':Sequelize[_0xd3d3('0x1')]},'fromdomain':{'type':Sequelize[_0xd3d3('0x1')]},'fromuser':{'type':Sequelize[_0xd3d3('0x1')]},'port':{'type':Sequelize[_0xd3d3('0x22')](0x5)},'qualify':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no'),'defaultValue':_0xd3d3('0x16')},'keepalive':{'type':Sequelize[_0xd3d3('0x22')](0xb)},'defaultip':{'type':Sequelize[_0xd3d3('0x1')]},'defaultuser':{'type':Sequelize[_0xd3d3('0x1')]},'rtptimeout':{'type':Sequelize[_0xd3d3('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd3d3('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd3d3('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0xd3d3('0x3')]('yes','no',_0xd3d3('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd3d3('0x1')]},'callbackextension':{'type':Sequelize[_0xd3d3('0x1')]},'timert1':{'type':Sequelize[_0xd3d3('0x22')](0xb)},'timerb':{'type':Sequelize[_0xd3d3('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd3d3('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0xd3d3('0x1')]},'contactdeny':{'type':Sequelize[_0xd3d3('0x1')]},'contactacl':{'type':Sequelize[_0xd3d3('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xd3d3('0x1')]},'use_q850_reason':{'type':Sequelize[_0xd3d3('0x1')]},'maxforwards':{'type':Sequelize[_0xd3d3('0x22')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xd3d3('0x16'),'no')},'icesupport':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0xd3d3('0x3')]('yes','no','fingerprint',_0xd3d3('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xd3d3('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd3d3('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xd3d3('0x1')]},'dtlscafile':{'type':Sequelize[_0xd3d3('0x1')]},'dtlscapath':{'type':Sequelize[_0xd3d3('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xd3d3('0x2c'),_0xd3d3('0x2d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd3d3('0x1')]},'usereqphone':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd3d3('0x1')]},'recordofffeature':{'type':Sequelize[_0xd3d3('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd3d3('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x16'),'no')},'vmexten':{'type':Sequelize[_0xd3d3('0x1')]},'mohinterpret':{'type':Sequelize[_0xd3d3('0x1')]},'mohsuggest':{'type':Sequelize[_0xd3d3('0x1')]},'parkinglot':{'type':Sequelize[_0xd3d3('0x1')]},'description':{'type':Sequelize[_0xd3d3('0x1')]},'host':{'type':Sequelize[_0xd3d3('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xd3d3('0x3')]('yes','no',_0xd3d3('0x2e'),_0xd3d3('0x17'),_0xd3d3('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd3d3('0x1')]},'otherFields':{'type':Sequelize[_0xd3d3('0x1')]},'active':{'type':Sequelize[_0xd3d3('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd3d3('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index de92913..9dfb0be 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 _0xa8df=['stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','status','end','json','count','offset','Content-Range','apply','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','map','Trunk','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','include','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','root','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','join','server/files/templates/registry.ejs','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa8df,0x126));var _0xfa8d=function(_0x473da,_0x1b7f25){_0x473da=_0x473da-0x0;var _0xd6a05e=_0xa8df[_0x473da];return _0xd6a05e;};'use strict';var pdf=require(_0xfa8d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfa8d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfa8d('0x2'));var moment=require(_0xfa8d('0x3'));var BPromise=require(_0xfa8d('0x4'));var Mustache=require(_0xfa8d('0x5'));var util=require(_0xfa8d('0x6'));var path=require(_0xfa8d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfa8d('0x8'));var fs=require('fs');var _=require(_0xfa8d('0x9'));var squel=require(_0xfa8d('0xa'));var crypto=require(_0xfa8d('0xb'));var jsforce=require(_0xfa8d('0xc'));var deskjs=require(_0xfa8d('0xd'));var toCsv=require(_0xfa8d('0xe'));var querystring=require(_0xfa8d('0xf'));var Papa=require(_0xfa8d('0x10'));var Redis=require(_0xfa8d('0x11'));var authService=require(_0xfa8d('0x12'));var qs=require(_0xfa8d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa8d('0x14'));var logger=require('../../config/logger')(_0xfa8d('0x15'));var utils=require(_0xfa8d('0x16'));var config=require(_0xfa8d('0x17'));var licenseUtil=require(_0xfa8d('0x18'));var db=require(_0xfa8d('0x19'))['db'];var jayson=require(_0xfa8d('0x1a'));var client=jayson[_0xfa8d('0x1b')][_0xfa8d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x22cf19,_0x1ea86e,_0x2c6928,_0x440a16){return new BPromise(function(_0x446f00,_0x208b11){var _0x43faf3=_0x440a16||client;return _0x43faf3[_0xfa8d('0x1d')](_0x22cf19,_0x2c6928)[_0xfa8d('0x1e')](function(_0x4a1782){logger['info']('Trunk,\x20%s,\x20%s',_0x1ea86e,_0xfa8d('0x1f'));logger[_0xfa8d('0x20')]('Trunk,\x20%s,\x20%s,\x20%s',_0x1ea86e,_0xfa8d('0x1f'),JSON[_0xfa8d('0x21')](_0x4a1782));if(_0x4a1782[_0xfa8d('0x22')]){if(_0x4a1782[_0xfa8d('0x22')][_0xfa8d('0x23')]===0x1f4){logger[_0xfa8d('0x22')](_0xfa8d('0x24'),_0x1ea86e,_0x4a1782['error'][_0xfa8d('0x25')]);return _0x208b11(_0x4a1782['error'][_0xfa8d('0x25')]);}logger[_0xfa8d('0x22')](_0xfa8d('0x24'),_0x1ea86e,_0x4a1782['error']['message']);return _0x446f00(_0x4a1782[_0xfa8d('0x22')][_0xfa8d('0x25')]);}else{logger[_0xfa8d('0x26')](_0xfa8d('0x24'),_0x1ea86e,_0xfa8d('0x1f'));_0x446f00(_0x4a1782[_0xfa8d('0x27')][_0xfa8d('0x25')]);}})['catch'](function(_0x1cc068){logger[_0xfa8d('0x22')](_0xfa8d('0x24'),_0x1ea86e,_0x1cc068);_0x208b11(_0x1cc068);});});}function respondWithStatusCode(_0x5698f2,_0x360d8d){_0x360d8d=_0x360d8d||0xcc;return function(_0xdf1c8d){if(_0xdf1c8d){return _0x5698f2['sendStatus'](_0x360d8d);}return _0x5698f2[_0xfa8d('0x28')](_0x360d8d)[_0xfa8d('0x29')]();};}function respondWithResult(_0x3dfa0c,_0x184bc9){_0x184bc9=_0x184bc9||0xc8;return function(_0x467489){if(_0x467489){return _0x3dfa0c[_0xfa8d('0x28')](_0x184bc9)[_0xfa8d('0x2a')](_0x467489);}};}function respondWithFilteredResult(_0x34662d,_0x5f299a){return function(_0x1fb2e0){if(_0x1fb2e0){var _0x59e6d8=_0x1fb2e0[_0xfa8d('0x2b')],_0x5221b0=_0x5f299a[_0xfa8d('0x2c')],_0x4a2e9f=_0x5f299a[_0xfa8d('0x2c')]+_0x5f299a['limit'],_0x3eb35d;if(_0x4a2e9f>=_0x59e6d8){_0x4a2e9f=_0x59e6d8;_0x3eb35d=0xc8;}else{_0x3eb35d=0xce;}_0x34662d[_0xfa8d('0x28')](_0x3eb35d);return _0x34662d['set'](_0xfa8d('0x2d'),_0x5221b0+'-'+_0x4a2e9f+'/'+_0x59e6d8)[_0xfa8d('0x2a')](_0x1fb2e0);}return null;};}function patchUpdates(_0x4b18a4){return function(_0x27bad0){try{jsonpatch[_0xfa8d('0x2e')](_0x27bad0,_0x4b18a4,!![]);}catch(_0x2ea9c3){return BPromise[_0xfa8d('0x2f')](_0x2ea9c3);}return _0x27bad0['save']();};}function saveUpdates(_0x3e4850,_0x2df5b5){return function(_0x14efb0){if(_0x14efb0){return _0x14efb0[_0xfa8d('0x30')](_0x3e4850)[_0xfa8d('0x1e')](function(_0x417eb9){return _0x417eb9;});}return null;};}function removeEntity(_0x5249fd,_0x40d920){return function(_0x310ab5){if(_0x310ab5){return _0x310ab5[_0xfa8d('0x31')]()[_0xfa8d('0x1e')](function(){var _0x455853=_0x310ab5[_0xfa8d('0x32')]({'plain':!![]});var _0x12bac8=_0xfa8d('0x33');return db[_0xfa8d('0x34')]['destroy']({'where':{'type':_0x12bac8,'resourceId':_0x455853['id']}})[_0xfa8d('0x1e')](function(){return _0x310ab5;});})[_0xfa8d('0x1e')](function(){_0x5249fd['status'](0xcc)[_0xfa8d('0x29')]();});}};}function handleEntityNotFound(_0xe6d0c7,_0x5d4325){return function(_0x52baed){if(!_0x52baed){_0xe6d0c7['sendStatus'](0x194);}return _0x52baed;};}function handleError(_0x350c5a,_0x2b399f){_0x2b399f=_0x2b399f||0x1f4;return function(_0x52455d){logger[_0xfa8d('0x22')](_0x52455d[_0xfa8d('0x35')]);if(_0x52455d['name']){delete _0x52455d[_0xfa8d('0x36')];}_0x350c5a[_0xfa8d('0x28')](_0x2b399f)['send'](_0x52455d);};}exports['index']=function(_0x368e62,_0x20caa5){var _0x39c1eb={},_0x3d1e3e={},_0x54bd34={'count':0x0,'rows':[]};var _0x181823=_[_0xfa8d('0x37')](db[_0xfa8d('0x38')][_0xfa8d('0x39')],function(_0x19b655){return{'name':_0x19b655[_0xfa8d('0x3a')],'type':_0x19b655[_0xfa8d('0x3b')]['key']};});_0x3d1e3e[_0xfa8d('0x3c')]=_['map'](_0x181823,_0xfa8d('0x36'));_0x3d1e3e[_0xfa8d('0x3d')]=_[_0xfa8d('0x3e')](_0x368e62[_0xfa8d('0x3d')]);_0x3d1e3e[_0xfa8d('0x3f')]=_[_0xfa8d('0x40')](_0x3d1e3e[_0xfa8d('0x3c')],_0x3d1e3e[_0xfa8d('0x3d')]);_0x39c1eb[_0xfa8d('0x41')]=_['intersection'](_0x3d1e3e[_0xfa8d('0x3c')],qs[_0xfa8d('0x42')](_0x368e62[_0xfa8d('0x3d')]['fields']));_0x39c1eb[_0xfa8d('0x41')]=_0x39c1eb[_0xfa8d('0x41')][_0xfa8d('0x43')]?_0x39c1eb[_0xfa8d('0x41')]:_0x3d1e3e['model'];if(!_0x368e62['query'][_0xfa8d('0x44')](_0xfa8d('0x45'))){_0x39c1eb['limit']=qs[_0xfa8d('0x46')](_0x368e62[_0xfa8d('0x3d')][_0xfa8d('0x46')]);_0x39c1eb[_0xfa8d('0x2c')]=qs[_0xfa8d('0x2c')](_0x368e62[_0xfa8d('0x3d')]['offset']);}_0x39c1eb[_0xfa8d('0x47')]=qs[_0xfa8d('0x48')](_0x368e62[_0xfa8d('0x3d')][_0xfa8d('0x48')]);_0x39c1eb[_0xfa8d('0x49')]=qs[_0xfa8d('0x3f')](_[_0xfa8d('0x4a')](_0x368e62[_0xfa8d('0x3d')],_0x3d1e3e[_0xfa8d('0x3f')]),_0x181823);if(_0x368e62[_0xfa8d('0x3d')][_0xfa8d('0x4b')]){_0x39c1eb[_0xfa8d('0x49')]=_[_0xfa8d('0x4c')](_0x39c1eb[_0xfa8d('0x49')],{'$or':_['map'](_0x181823,function(_0x56b0de){if(_0x56b0de[_0xfa8d('0x3b')]!=='VIRTUAL'){var _0x141539={};_0x141539[_0x56b0de[_0xfa8d('0x36')]]={'$like':'%'+_0x368e62['query'][_0xfa8d('0x4b')]+'%'};return _0x141539;}})});}_0x39c1eb=_[_0xfa8d('0x4c')]({},_0x39c1eb,_0x368e62[_0xfa8d('0x4d')]);var _0x33d5d9={'where':_0x39c1eb[_0xfa8d('0x49')]};return db[_0xfa8d('0x38')][_0xfa8d('0x2b')](_0x33d5d9)[_0xfa8d('0x1e')](function(_0x84a64c){_0x54bd34[_0xfa8d('0x2b')]=_0x84a64c;if(_0x368e62['query'][_0xfa8d('0x4e')]){_0x39c1eb['include']=[{'all':!![]}];}return db['Trunk'][_0xfa8d('0x4f')](_0x39c1eb);})[_0xfa8d('0x1e')](function(_0x1d8f9b){_0x54bd34[_0xfa8d('0x50')]=_0x1d8f9b;return _0x54bd34;})[_0xfa8d('0x1e')](respondWithFilteredResult(_0x20caa5,_0x39c1eb))[_0xfa8d('0x51')](handleError(_0x20caa5,null));};exports['show']=function(_0x2db59f,_0x4c4dd0){var _0xa1a7f6={'raw':![],'where':{'id':_0x2db59f[_0xfa8d('0x52')]['id']}},_0xb06432={};_0xb06432['model']=_[_0xfa8d('0x3e')](db[_0xfa8d('0x38')][_0xfa8d('0x39')]);_0xb06432[_0xfa8d('0x3d')]=_['keys'](_0x2db59f[_0xfa8d('0x3d')]);_0xb06432[_0xfa8d('0x3f')]=_[_0xfa8d('0x40')](_0xb06432[_0xfa8d('0x3c')],_0xb06432[_0xfa8d('0x3d')]);_0xa1a7f6[_0xfa8d('0x41')]=_[_0xfa8d('0x40')](_0xb06432['model'],qs[_0xfa8d('0x42')](_0x2db59f['query'][_0xfa8d('0x42')]));_0xa1a7f6[_0xfa8d('0x41')]=_0xa1a7f6[_0xfa8d('0x41')][_0xfa8d('0x43')]?_0xa1a7f6['attributes']:_0xb06432[_0xfa8d('0x3c')];if(_0x2db59f[_0xfa8d('0x3d')][_0xfa8d('0x4e')]){_0xa1a7f6[_0xfa8d('0x53')]=[{'all':!![]}];}_0xa1a7f6=_[_0xfa8d('0x4c')]({},_0xa1a7f6,_0x2db59f[_0xfa8d('0x4d')]);return db[_0xfa8d('0x38')][_0xfa8d('0x54')](_0xa1a7f6)[_0xfa8d('0x1e')](handleEntityNotFound(_0x4c4dd0,null))[_0xfa8d('0x1e')](respondWithResult(_0x4c4dd0,null))[_0xfa8d('0x51')](handleError(_0x4c4dd0,null));};exports['clone']=function(_0x13e00a,_0x214f1f){var _0x73f309={'where':{'id':_0x13e00a[_0xfa8d('0x52')]['id']}},_0x1b84b5={};_0x1b84b5['model']=_[_0xfa8d('0x3e')](db[_0xfa8d('0x38')][_0xfa8d('0x39')]);_0x73f309[_0xfa8d('0x41')]=_[_0xfa8d('0x40')](_0x1b84b5[_0xfa8d('0x3c')],qs[_0xfa8d('0x42')](_0x13e00a[_0xfa8d('0x3d')]['fields']));_0x73f309[_0xfa8d('0x41')]=_0x73f309[_0xfa8d('0x41')][_0xfa8d('0x43')]?_0x73f309[_0xfa8d('0x41')]:_0x1b84b5['model'];if(_0x13e00a[_0xfa8d('0x3d')][_0xfa8d('0x4e')]){_0x73f309[_0xfa8d('0x53')]=[{'all':!![]}];}_0x73f309=_[_0xfa8d('0x4c')]({},_0x73f309,_0x13e00a[_0xfa8d('0x4d')]);return db[_0xfa8d('0x38')][_0xfa8d('0x54')](_0x73f309)[_0xfa8d('0x1e')](handleEntityNotFound(_0x214f1f,null))['then'](function(_0x2618b4){if(_0x2618b4){var _0x2ff354=_0x2618b4[_0xfa8d('0x32')]({'plain':!![]});_0x2ff354=qs[_0xfa8d('0x55')](_0x2ff354,['id',_0xfa8d('0x56'),'updatedAt']);_0x13e00a['body']=_[_0xfa8d('0x55')](_0x13e00a[_0xfa8d('0x57')],['id','createdAt','updatedAt']);return db[_0xfa8d('0x38')][_0xfa8d('0x58')](_['merge'](_0x2ff354,_0x13e00a[_0xfa8d('0x57')]),{'include':_0x13e00a['query']['includeAll']?[{'all':!![]}]:undefined})[_0xfa8d('0x1e')](function(_0x274012){var _0x37811e=_0x13e00a[_0xfa8d('0x59')][_0xfa8d('0x32')]({'plain':!![]});if(!_0x37811e)throw new Error(_0xfa8d('0x5a'));if(_0x37811e['role']===_0xfa8d('0x59')){var _0x146903=_0x274012[_0xfa8d('0x32')]({'plain':!![]});var _0x4d9500=_0xfa8d('0x33');return db['UserProfileSection'][_0xfa8d('0x54')]({'where':{'name':_0x4d9500,'userProfileId':_0x37811e[_0xfa8d('0x5b')]},'raw':!![]})[_0xfa8d('0x1e')](function(_0x4f63dc){if(_0x4f63dc&&_0x4f63dc[_0xfa8d('0x5c')]===0x0){return db[_0xfa8d('0x34')][_0xfa8d('0x58')]({'name':_0x146903[_0xfa8d('0x36')],'resourceId':_0x146903['id'],'type':_0x4f63dc[_0xfa8d('0x36')],'sectionId':_0x4f63dc['id']},{})['then'](function(){return _0x274012;});}else{return _0x274012;}})['catch'](function(_0x1460ba){logger['error'](_0xfa8d('0x5d'),_0x1460ba);throw _0x1460ba;});}return _0x274012;});}})[_0xfa8d('0x1e')](respondWithResult(_0x214f1f,0xc9))[_0xfa8d('0x51')](handleError(_0x214f1f,null));};exports['create']=function(_0x41803b,_0x2db95f,_0x3bc214){var _0x5850d6;return db[_0xfa8d('0x38')][_0xfa8d('0x58')](_0x41803b['body'],{'raw':!![]})['then'](function(_0x24013a){_0x5850d6=_0x24013a;return db[_0xfa8d('0x38')]['findAll']({'raw':!![]});})[_0xfa8d('0x1e')](function(_0x4fbb58){var _0x29780a=fs[_0xfa8d('0x5e')](path['join'](config['root'],_0xfa8d('0x5f')),_0xfa8d('0x60'));var _0x5ee0fa=fs[_0xfa8d('0x5e')](path['join'](config[_0xfa8d('0x61')],'server/files/templates/registry.ejs'),_0xfa8d('0x60'));var _0x11746e=ejs['render'](_0x29780a,{'trunks':_0x4fbb58||[]});fs[_0xfa8d('0x62')](_0xfa8d('0x63'),_0x11746e);if(_0x5850d6[_0xfa8d('0x64')]){var _0xb6d1fb=ejs[_0xfa8d('0x65')](_0x5ee0fa,{'trunks':_0x4fbb58||[]});fs[_0xfa8d('0x62')](_0xfa8d('0x66'),_0xb6d1fb);}})[_0xfa8d('0x1e')](function(){return respondWithRpcPromise(_0xfa8d('0x67'),_0xfa8d('0x58'),{'module':_0xfa8d('0x68')});})[_0xfa8d('0x1e')](function(){var _0x1d6548=_0x41803b['user'][_0xfa8d('0x32')]({'plain':!![]});if(!_0x1d6548)throw new Error(_0xfa8d('0x5a'));if(_0x1d6548[_0xfa8d('0x69')]===_0xfa8d('0x59')){var _0x3e1ef4=_0x5850d6[_0xfa8d('0x32')]({'plain':!![]});return db[_0xfa8d('0x6a')][_0xfa8d('0x54')]({'where':{'name':'Trunks','userProfileId':_0x1d6548[_0xfa8d('0x5b')]},'raw':!![]})[_0xfa8d('0x1e')](function(_0x11a150){if(_0x11a150&&_0x11a150['autoAssociation']===0x0){return db[_0xfa8d('0x34')][_0xfa8d('0x58')]({'name':_0x3e1ef4[_0xfa8d('0x36')],'resourceId':_0x3e1ef4['id'],'type':_0x11a150[_0xfa8d('0x36')],'sectionId':_0x11a150['id']},{})[_0xfa8d('0x1e')](function(){return _0x5850d6;});}else{return _0x5850d6;}})[_0xfa8d('0x51')](function(_0x1fd11b){logger[_0xfa8d('0x22')](_0xfa8d('0x5d'),_0x1fd11b);throw _0x1fd11b;});}return _0x5850d6;})['then'](respondWithResult(_0x2db95f,0xc9))[_0xfa8d('0x51')](handleError(_0x2db95f,null));};exports[_0xfa8d('0x30')]=function(_0x1bd83b,_0x24971a,_0x224749){var _0x33b07d;return db['Trunk']['find']({'where':{'id':_0x1bd83b[_0xfa8d('0x52')]['id']}})[_0xfa8d('0x1e')](handleEntityNotFound(_0x24971a,null))[_0xfa8d('0x1e')](saveUpdates(_0x1bd83b[_0xfa8d('0x57')],null))[_0xfa8d('0x1e')](function(_0x32267b){if(_0x32267b){_0x33b07d=_0x32267b;return db[_0xfa8d('0x38')][_0xfa8d('0x4f')]({'raw':!![]});}})[_0xfa8d('0x1e')](function(_0x1c2e32){if(_0x1c2e32){var _0x499bf3=fs[_0xfa8d('0x5e')](path[_0xfa8d('0x6b')](config[_0xfa8d('0x61')],'server/files/templates/trunk.ejs'),_0xfa8d('0x60'));var _0x1146bd=fs[_0xfa8d('0x5e')](path[_0xfa8d('0x6b')](config[_0xfa8d('0x61')],_0xfa8d('0x6c')),'utf8');var _0x39aeb5=ejs[_0xfa8d('0x65')](_0x499bf3,{'trunks':_0x1c2e32||[]});fs[_0xfa8d('0x62')](_0xfa8d('0x63'),_0x39aeb5);var _0x19bf09=ejs[_0xfa8d('0x65')](_0x1146bd,{'trunks':_0x1c2e32||[]});fs[_0xfa8d('0x62')](_0xfa8d('0x66'),_0x19bf09);return respondWithRpcPromise('Reload',_0xfa8d('0x30'),{'module':_0xfa8d('0x68')});}return null;})[_0xfa8d('0x1e')](function(_0x47bd5e){if(_0x47bd5e){return _0x33b07d;}})[_0xfa8d('0x1e')](respondWithResult(_0x24971a,null))[_0xfa8d('0x51')](handleError(_0x24971a,null));};exports[_0xfa8d('0x31')]=function(_0x46a18c,_0x267757,_0x3e87dd){var _0x1efd48;return db[_0xfa8d('0x38')]['find']({'where':{'id':_0x46a18c['params']['id']}})[_0xfa8d('0x1e')](handleEntityNotFound(_0x267757,null))[_0xfa8d('0x1e')](removeEntity(_0x267757,null))[_0xfa8d('0x1e')](function(){return db[_0xfa8d('0x38')][_0xfa8d('0x4f')]({'raw':!![]});})['then'](function(_0x39a4d4){var _0x39db00=fs[_0xfa8d('0x5e')](path[_0xfa8d('0x6b')](config[_0xfa8d('0x61')],_0xfa8d('0x5f')),_0xfa8d('0x60'));var _0x991d05=fs[_0xfa8d('0x5e')](path[_0xfa8d('0x6b')](config[_0xfa8d('0x61')],'server/files/templates/registry.ejs'),_0xfa8d('0x60'));var _0x2052b7=ejs['render'](_0x39db00,{'trunks':_0x39a4d4});var _0x5a2af1=ejs[_0xfa8d('0x65')](_0x991d05,{'trunks':_0x39a4d4});fs[_0xfa8d('0x62')](_0xfa8d('0x63'),_0x2052b7);fs[_0xfa8d('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x5a2af1);return respondWithRpcPromise('Reload',_0xfa8d('0x31'),{'module':_0xfa8d('0x68')});})[_0xfa8d('0x51')](handleError(_0x267757,null));}; \ No newline at end of file +var _0x0998=['Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trunk,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','apply','reject','update','get','Trunks','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','where','pick','filter','merge','Trunk','includeAll','include','findAll','rows','show','options','find','clone','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readFileSync','server/files/templates/registry.ejs','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info'];(function(_0x1596fa,_0x38bcaf){var _0x2b09f6=function(_0x18787b){while(--_0x18787b){_0x1596fa['push'](_0x1596fa['shift']());}};_0x2b09f6(++_0x38bcaf);}(_0x0998,0x190));var _0x8099=function(_0x1368dc,_0x47ace3){_0x1368dc=_0x1368dc-0x0;var _0x5cb1ea=_0x0998[_0x1368dc];return _0x5cb1ea;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8099('0x0'));var zipdir=require(_0x8099('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8099('0x2'));var BPromise=require(_0x8099('0x3'));var Mustache=require('mustache');var util=require(_0x8099('0x4'));var path=require(_0x8099('0x5'));var sox=require(_0x8099('0x6'));var csv=require(_0x8099('0x7'));var ejs=require(_0x8099('0x8'));var fs=require('fs');var _=require(_0x8099('0x9'));var squel=require(_0x8099('0xa'));var crypto=require(_0x8099('0xb'));var jsforce=require(_0x8099('0xc'));var deskjs=require(_0x8099('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8099('0xe'));var Redis=require('ioredis');var authService=require(_0x8099('0xf'));var qs=require(_0x8099('0x10'));var as=require(_0x8099('0x11'));var hardwareService=require(_0x8099('0x12'));var logger=require('../../config/logger')(_0x8099('0x13'));var utils=require('../../config/utils');var config=require(_0x8099('0x14'));var licenseUtil=require(_0x8099('0x15'));var db=require(_0x8099('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x8099('0x17')][_0x8099('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1c357a,_0x16b608,_0xa48d70,_0x214f6a){return new BPromise(function(_0x4e0513,_0x54324c){var _0x46991d=_0x214f6a||client;return _0x46991d[_0x8099('0x19')](_0x1c357a,_0xa48d70)[_0x8099('0x1a')](function(_0x8aae8c){logger[_0x8099('0x1b')]('Trunk,\x20%s,\x20%s',_0x16b608,'request\x20sent');logger['debug'](_0x8099('0x1c'),_0x16b608,_0x8099('0x1d'),JSON[_0x8099('0x1e')](_0x8aae8c));if(_0x8aae8c['error']){if(_0x8aae8c[_0x8099('0x1f')]['code']===0x1f4){logger[_0x8099('0x1f')](_0x8099('0x20'),_0x16b608,_0x8aae8c[_0x8099('0x1f')][_0x8099('0x21')]);return _0x54324c(_0x8aae8c[_0x8099('0x1f')][_0x8099('0x21')]);}logger[_0x8099('0x1f')]('Trunk,\x20%s,\x20%s',_0x16b608,_0x8aae8c[_0x8099('0x1f')]['message']);return _0x4e0513(_0x8aae8c[_0x8099('0x1f')][_0x8099('0x21')]);}else{logger[_0x8099('0x1b')]('Trunk,\x20%s,\x20%s',_0x16b608,_0x8099('0x1d'));_0x4e0513(_0x8aae8c['result']['message']);}})[_0x8099('0x22')](function(_0x2be4d9){logger[_0x8099('0x1f')](_0x8099('0x20'),_0x16b608,_0x2be4d9);_0x54324c(_0x2be4d9);});});}function respondWithStatusCode(_0x38f61f,_0x3fde4e){_0x3fde4e=_0x3fde4e||0xcc;return function(_0x55cd21){if(_0x55cd21){return _0x38f61f[_0x8099('0x23')](_0x3fde4e);}return _0x38f61f[_0x8099('0x24')](_0x3fde4e)[_0x8099('0x25')]();};}function respondWithResult(_0x254dd5,_0x1b233e){_0x1b233e=_0x1b233e||0xc8;return function(_0x5ad5a8){if(_0x5ad5a8){return _0x254dd5[_0x8099('0x24')](_0x1b233e)[_0x8099('0x26')](_0x5ad5a8);}};}function respondWithFilteredResult(_0x558319,_0x5679c6){return function(_0x2daaae){if(_0x2daaae){var _0x4f7725=_0x2daaae[_0x8099('0x27')],_0x3ce378=_0x5679c6[_0x8099('0x28')],_0x41b625=_0x5679c6['offset']+_0x5679c6['limit'],_0x5f4c7c;if(_0x41b625>=_0x4f7725){_0x41b625=_0x4f7725;_0x5f4c7c=0xc8;}else{_0x5f4c7c=0xce;}_0x558319[_0x8099('0x24')](_0x5f4c7c);return _0x558319['set']('Content-Range',_0x3ce378+'-'+_0x41b625+'/'+_0x4f7725)[_0x8099('0x26')](_0x2daaae);}return null;};}function patchUpdates(_0x24c5e9){return function(_0x2023f6){try{jsonpatch[_0x8099('0x29')](_0x2023f6,_0x24c5e9,!![]);}catch(_0x1f6564){return BPromise[_0x8099('0x2a')](_0x1f6564);}return _0x2023f6['save']();};}function saveUpdates(_0x151f23,_0x423005){return function(_0x39e714){if(_0x39e714){return _0x39e714[_0x8099('0x2b')](_0x151f23)[_0x8099('0x1a')](function(_0x10579f){return _0x10579f;});}return null;};}function removeEntity(_0x26cbe3,_0x210fb5){return function(_0x452191){if(_0x452191){return _0x452191['destroy']()['then'](function(){var _0x38f71a=_0x452191[_0x8099('0x2c')]({'plain':!![]});var _0x2795b2=_0x8099('0x2d');return db[_0x8099('0x2e')][_0x8099('0x2f')]({'where':{'type':_0x2795b2,'resourceId':_0x38f71a['id']}})['then'](function(){return _0x452191;});})[_0x8099('0x1a')](function(){_0x26cbe3[_0x8099('0x24')](0xcc)[_0x8099('0x25')]();});}};}function handleEntityNotFound(_0x1c81f9,_0x4ee9be){return function(_0x3666c9){if(!_0x3666c9){_0x1c81f9[_0x8099('0x23')](0x194);}return _0x3666c9;};}function handleError(_0x3e3551,_0x443078){_0x443078=_0x443078||0x1f4;return function(_0x32cf1f){logger['error'](_0x32cf1f[_0x8099('0x30')]);if(_0x32cf1f[_0x8099('0x31')]){delete _0x32cf1f[_0x8099('0x31')];}_0x3e3551[_0x8099('0x24')](_0x443078)[_0x8099('0x32')](_0x32cf1f);};}exports[_0x8099('0x33')]=function(_0x3ede50,_0x147ea1){var _0x420996={},_0x13393f={},_0x2392c5={'count':0x0,'rows':[]};var _0x350c9b=_[_0x8099('0x34')](db['Trunk'][_0x8099('0x35')],function(_0x3f2cd8){return{'name':_0x3f2cd8[_0x8099('0x36')],'type':_0x3f2cd8[_0x8099('0x37')][_0x8099('0x38')]};});_0x13393f['model']=_[_0x8099('0x34')](_0x350c9b,_0x8099('0x31'));_0x13393f[_0x8099('0x39')]=_[_0x8099('0x3a')](_0x3ede50[_0x8099('0x39')]);_0x13393f[_0x8099('0x3b')]=_[_0x8099('0x3c')](_0x13393f[_0x8099('0x3d')],_0x13393f[_0x8099('0x39')]);_0x420996['attributes']=_[_0x8099('0x3c')](_0x13393f['model'],qs[_0x8099('0x3e')](_0x3ede50[_0x8099('0x39')][_0x8099('0x3e')]));_0x420996[_0x8099('0x3f')]=_0x420996[_0x8099('0x3f')][_0x8099('0x40')]?_0x420996[_0x8099('0x3f')]:_0x13393f[_0x8099('0x3d')];if(!_0x3ede50['query'][_0x8099('0x41')](_0x8099('0x42'))){_0x420996[_0x8099('0x43')]=qs[_0x8099('0x43')](_0x3ede50[_0x8099('0x39')][_0x8099('0x43')]);_0x420996['offset']=qs[_0x8099('0x28')](_0x3ede50[_0x8099('0x39')]['offset']);}_0x420996['order']=qs['sort'](_0x3ede50[_0x8099('0x39')]['sort']);_0x420996[_0x8099('0x44')]=qs['filters'](_[_0x8099('0x45')](_0x3ede50['query'],_0x13393f[_0x8099('0x3b')]),_0x350c9b);if(_0x3ede50['query'][_0x8099('0x46')]){_0x420996[_0x8099('0x44')]=_[_0x8099('0x47')](_0x420996['where'],{'$or':_[_0x8099('0x34')](_0x350c9b,function(_0x473c2e){if(_0x473c2e['type']!=='VIRTUAL'){var _0x325830={};_0x325830[_0x473c2e['name']]={'$like':'%'+_0x3ede50['query'][_0x8099('0x46')]+'%'};return _0x325830;}})});}_0x420996=_[_0x8099('0x47')]({},_0x420996,_0x3ede50['options']);var _0x99eae0={'where':_0x420996[_0x8099('0x44')]};return db[_0x8099('0x48')][_0x8099('0x27')](_0x99eae0)[_0x8099('0x1a')](function(_0x591400){_0x2392c5[_0x8099('0x27')]=_0x591400;if(_0x3ede50['query'][_0x8099('0x49')]){_0x420996[_0x8099('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0x8099('0x4b')](_0x420996);})[_0x8099('0x1a')](function(_0x547b17){_0x2392c5[_0x8099('0x4c')]=_0x547b17;return _0x2392c5;})[_0x8099('0x1a')](respondWithFilteredResult(_0x147ea1,_0x420996))[_0x8099('0x22')](handleError(_0x147ea1,null));};exports[_0x8099('0x4d')]=function(_0x35de99,_0x3c7201){var _0x57c5da={'raw':![],'where':{'id':_0x35de99['params']['id']}},_0x56f02d={};_0x56f02d['model']=_['keys'](db[_0x8099('0x48')]['rawAttributes']);_0x56f02d[_0x8099('0x39')]=_[_0x8099('0x3a')](_0x35de99[_0x8099('0x39')]);_0x56f02d[_0x8099('0x3b')]=_[_0x8099('0x3c')](_0x56f02d[_0x8099('0x3d')],_0x56f02d['query']);_0x57c5da['attributes']=_[_0x8099('0x3c')](_0x56f02d[_0x8099('0x3d')],qs[_0x8099('0x3e')](_0x35de99['query'][_0x8099('0x3e')]));_0x57c5da[_0x8099('0x3f')]=_0x57c5da[_0x8099('0x3f')][_0x8099('0x40')]?_0x57c5da['attributes']:_0x56f02d[_0x8099('0x3d')];if(_0x35de99[_0x8099('0x39')][_0x8099('0x49')]){_0x57c5da[_0x8099('0x4a')]=[{'all':!![]}];}_0x57c5da=_[_0x8099('0x47')]({},_0x57c5da,_0x35de99[_0x8099('0x4e')]);return db['Trunk'][_0x8099('0x4f')](_0x57c5da)['then'](handleEntityNotFound(_0x3c7201,null))['then'](respondWithResult(_0x3c7201,null))[_0x8099('0x22')](handleError(_0x3c7201,null));};exports[_0x8099('0x50')]=function(_0x4427bd,_0x31ceec){var _0x363745={'where':{'id':_0x4427bd['params']['id']}},_0x5b4498={};_0x5b4498[_0x8099('0x3d')]=_[_0x8099('0x3a')](db[_0x8099('0x48')][_0x8099('0x35')]);_0x363745[_0x8099('0x3f')]=_[_0x8099('0x3c')](_0x5b4498[_0x8099('0x3d')],qs[_0x8099('0x3e')](_0x4427bd[_0x8099('0x39')][_0x8099('0x3e')]));_0x363745[_0x8099('0x3f')]=_0x363745[_0x8099('0x3f')][_0x8099('0x40')]?_0x363745['attributes']:_0x5b4498[_0x8099('0x3d')];if(_0x4427bd[_0x8099('0x39')][_0x8099('0x49')]){_0x363745[_0x8099('0x4a')]=[{'all':!![]}];}_0x363745=_[_0x8099('0x47')]({},_0x363745,_0x4427bd[_0x8099('0x4e')]);return db[_0x8099('0x48')][_0x8099('0x4f')](_0x363745)[_0x8099('0x1a')](handleEntityNotFound(_0x31ceec,null))[_0x8099('0x1a')](function(_0x5557c4){if(_0x5557c4){var _0x473e2f=_0x5557c4[_0x8099('0x2c')]({'plain':!![]});_0x473e2f=qs[_0x8099('0x51')](_0x473e2f,['id',_0x8099('0x52'),_0x8099('0x53')]);_0x4427bd[_0x8099('0x54')]=_[_0x8099('0x51')](_0x4427bd[_0x8099('0x54')],['id',_0x8099('0x52'),'updatedAt']);return db['Trunk'][_0x8099('0x55')](_['merge'](_0x473e2f,_0x4427bd[_0x8099('0x54')]),{'include':_0x4427bd[_0x8099('0x39')][_0x8099('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x57b4ad){var _0x5495ee=_0x4427bd[_0x8099('0x56')][_0x8099('0x2c')]({'plain':!![]});if(!_0x5495ee)throw new Error(_0x8099('0x57'));if(_0x5495ee[_0x8099('0x58')]===_0x8099('0x56')){var _0x3210bf=_0x57b4ad['get']({'plain':!![]});var _0x24c59c=_0x8099('0x2d');return db[_0x8099('0x59')][_0x8099('0x4f')]({'where':{'name':_0x24c59c,'userProfileId':_0x5495ee['userProfileId']},'raw':!![]})[_0x8099('0x1a')](function(_0x5823a7){if(_0x5823a7&&_0x5823a7[_0x8099('0x5a')]===0x0){return db['UserProfileResource'][_0x8099('0x55')]({'name':_0x3210bf[_0x8099('0x31')],'resourceId':_0x3210bf['id'],'type':_0x5823a7[_0x8099('0x31')],'sectionId':_0x5823a7['id']},{})[_0x8099('0x1a')](function(){return _0x57b4ad;});}else{return _0x57b4ad;}})['catch'](function(_0x4ad9b5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ad9b5);throw _0x4ad9b5;});}return _0x57b4ad;});}})[_0x8099('0x1a')](respondWithResult(_0x31ceec,0xc9))[_0x8099('0x22')](handleError(_0x31ceec,null));};exports[_0x8099('0x55')]=function(_0x205c76,_0x3c7c48,_0x23d303){var _0x2921a5;return db[_0x8099('0x48')][_0x8099('0x55')](_0x205c76[_0x8099('0x54')],{'raw':!![]})[_0x8099('0x1a')](function(_0x2cca2f){_0x2921a5=_0x2cca2f;return db[_0x8099('0x48')]['findAll']({'raw':!![]});})[_0x8099('0x1a')](function(_0x3bf53a){var _0x13ebcd=fs['readFileSync'](path[_0x8099('0x5b')](config[_0x8099('0x5c')],_0x8099('0x5d')),_0x8099('0x5e'));var _0x3c9c95=fs['readFileSync'](path['join'](config[_0x8099('0x5c')],'server/files/templates/registry.ejs'),_0x8099('0x5e'));var _0x5011a8=ejs['render'](_0x13ebcd,{'trunks':_0x3bf53a||[]});fs[_0x8099('0x5f')](_0x8099('0x60'),_0x5011a8);if(_0x2921a5[_0x8099('0x61')]){var _0x363abf=ejs[_0x8099('0x62')](_0x3c9c95,{'trunks':_0x3bf53a||[]});fs['writeFileSync'](_0x8099('0x63'),_0x363abf);}})['then'](function(){return respondWithRpcPromise(_0x8099('0x64'),'create',{'module':_0x8099('0x65')});})['then'](function(){var _0x4a62f9=_0x205c76[_0x8099('0x56')][_0x8099('0x2c')]({'plain':!![]});if(!_0x4a62f9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a62f9[_0x8099('0x58')]===_0x8099('0x56')){var _0x278028=_0x2921a5[_0x8099('0x2c')]({'plain':!![]});return db[_0x8099('0x59')][_0x8099('0x4f')]({'where':{'name':_0x8099('0x2d'),'userProfileId':_0x4a62f9[_0x8099('0x66')]},'raw':!![]})[_0x8099('0x1a')](function(_0x5078b5){if(_0x5078b5&&_0x5078b5[_0x8099('0x5a')]===0x0){return db[_0x8099('0x2e')][_0x8099('0x55')]({'name':_0x278028[_0x8099('0x31')],'resourceId':_0x278028['id'],'type':_0x5078b5[_0x8099('0x31')],'sectionId':_0x5078b5['id']},{})['then'](function(){return _0x2921a5;});}else{return _0x2921a5;}})[_0x8099('0x22')](function(_0x160647){logger['error'](_0x8099('0x67'),_0x160647);throw _0x160647;});}return _0x2921a5;})[_0x8099('0x1a')](respondWithResult(_0x3c7c48,0xc9))[_0x8099('0x22')](handleError(_0x3c7c48,null));};exports[_0x8099('0x2b')]=function(_0x3f0d19,_0x381537,_0x49d5fb){var _0x487bf0;return db[_0x8099('0x48')][_0x8099('0x4f')]({'where':{'id':_0x3f0d19[_0x8099('0x68')]['id']}})[_0x8099('0x1a')](handleEntityNotFound(_0x381537,null))[_0x8099('0x1a')](saveUpdates(_0x3f0d19['body'],null))['then'](function(_0xc6292b){if(_0xc6292b){_0x487bf0=_0xc6292b;return db[_0x8099('0x48')][_0x8099('0x4b')]({'raw':!![]});}})[_0x8099('0x1a')](function(_0x4fad61){if(_0x4fad61){var _0x5d29bd=fs[_0x8099('0x69')](path[_0x8099('0x5b')](config[_0x8099('0x5c')],_0x8099('0x5d')),'utf8');var _0xa0ab6a=fs['readFileSync'](path['join'](config[_0x8099('0x5c')],_0x8099('0x6a')),_0x8099('0x5e'));var _0x23a4a5=ejs[_0x8099('0x62')](_0x5d29bd,{'trunks':_0x4fad61||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x23a4a5);var _0x171295=ejs[_0x8099('0x62')](_0xa0ab6a,{'trunks':_0x4fad61||[]});fs['writeFileSync'](_0x8099('0x63'),_0x171295);return respondWithRpcPromise(_0x8099('0x64'),_0x8099('0x2b'),{'module':_0x8099('0x65')});}return null;})['then'](function(_0x47128e){if(_0x47128e){return _0x487bf0;}})[_0x8099('0x1a')](respondWithResult(_0x381537,null))[_0x8099('0x22')](handleError(_0x381537,null));};exports[_0x8099('0x2f')]=function(_0xc2ae2a,_0x2da2ea,_0x59167c){var _0x22fb37;return db[_0x8099('0x48')][_0x8099('0x4f')]({'where':{'id':_0xc2ae2a[_0x8099('0x68')]['id']}})[_0x8099('0x1a')](handleEntityNotFound(_0x2da2ea,null))[_0x8099('0x1a')](removeEntity(_0x2da2ea,null))[_0x8099('0x1a')](function(){return db['Trunk'][_0x8099('0x4b')]({'raw':!![]});})[_0x8099('0x1a')](function(_0x37e3c5){var _0x25e71d=fs[_0x8099('0x69')](path[_0x8099('0x5b')](config[_0x8099('0x5c')],_0x8099('0x5d')),_0x8099('0x5e'));var _0x34ee9b=fs[_0x8099('0x69')](path[_0x8099('0x5b')](config[_0x8099('0x5c')],'server/files/templates/registry.ejs'),_0x8099('0x5e'));var _0x1c486d=ejs[_0x8099('0x62')](_0x25e71d,{'trunks':_0x37e3c5});var _0x2973f5=ejs[_0x8099('0x62')](_0x34ee9b,{'trunks':_0x37e3c5});fs['writeFileSync'](_0x8099('0x60'),_0x1c486d);fs[_0x8099('0x5f')](_0x8099('0x63'),_0x2973f5);return respondWithRpcPromise('Reload',_0x8099('0x2f'),{'module':_0x8099('0x65')});})[_0x8099('0x22')](handleError(_0x2da2ea,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 6cc749b..5148ce3 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 _0xbf60=['./trunk.attributes','exports','define','Trunk','tools_trunks','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x9eaec5,_0x2e8c12){var _0x4b3002=function(_0x19e92b){while(--_0x19e92b){_0x9eaec5['push'](_0x9eaec5['shift']());}};_0x4b3002(++_0x2e8c12);}(_0xbf60,0x102));var _0x0bf6=function(_0x39d6a8,_0xc9c91a){_0x39d6a8=_0x39d6a8-0x0;var _0x93f3db=_0xbf60[_0x39d6a8];return _0x93f3db;};'use strict';var _=require('lodash');var util=require(_0x0bf6('0x0'));var logger=require(_0x0bf6('0x1'))(_0x0bf6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bf6('0x3'));var rimraf=require(_0x0bf6('0x4'));var config=require(_0x0bf6('0x5'));var attributes=require(_0x0bf6('0x6'));module[_0x0bf6('0x7')]=function(_0xc43816,_0x2c7c61){return _0xc43816[_0x0bf6('0x8')](_0x0bf6('0x9'),attributes,{'tableName':_0x0bf6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f48=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','Trunk','tools_trunks','util'];(function(_0xb3d313,_0x3e2f2b){var _0x5d93b5=function(_0x373344){while(--_0x373344){_0xb3d313['push'](_0xb3d313['shift']());}};_0x5d93b5(++_0x3e2f2b);}(_0x1f48,0x194));var _0x81f4=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x1f48[_0x2642cb];return _0xe6e41;};'use strict';var _=require('lodash');var util=require(_0x81f4('0x0'));var logger=require(_0x81f4('0x1'))(_0x81f4('0x2'));var moment=require(_0x81f4('0x3'));var BPromise=require('bluebird');var rp=require(_0x81f4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x81f4('0x5'));var config=require(_0x81f4('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0x129b81,_0x495436){return _0x129b81['define'](_0x81f4('0x7'),attributes,{'tableName':_0x81f4('0x8'),'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 5616eb3..eaa61f0 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 _0x2032=['error','code','message','info','result','catch','GetTrunk','Trunk','options','raw','where','map','model','attributes','include','stringify','ShowTrunk','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4dc7d4,_0x21a542){var _0x109248=function(_0x491f78){while(--_0x491f78){_0x4dc7d4['push'](_0x4dc7d4['shift']());}};_0x109248(++_0x21a542);}(_0x2032,0xd9));var _0x2203=function(_0x3e27fd,_0x3ddacc){_0x3e27fd=_0x3e27fd-0x0;var _0x34698f=_0x2032[_0x3e27fd];return _0x34698f;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['findAll']({'raw':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x18')]||null:null,'attributes':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['attributes']||null:null,'limit':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['limit']||null:null,'include':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')]['include']?_[_0x2203('0x19')](_0x4893ff['options']['include'],function(_0x226374){return{'model':db[_0x226374[_0x2203('0x1a')]],'as':_0x226374['as'],'attributes':_0x226374[_0x2203('0x1b')],'include':_0x226374[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x226374[_0x2203('0x1c')],function(_0x49c12){return{'model':db[_0x49c12[_0x2203('0x1a')]],'as':_0x49c12['as'],'attributes':_0x49c12['attributes'],'include':_0x49c12[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x49c12[_0x2203('0x1c')],function(_0x5f11bf){return{'model':db[_0x5f11bf[_0x2203('0x1a')]],'as':_0x5f11bf['as'],'attributes':_0x5f11bf[_0x2203('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6e109){logger[_0x2203('0x11')](_0x2203('0x14'),_0x4893ff);logger[_0x2203('0xd')](_0x2203('0x14'),_0x4893ff,JSON[_0x2203('0x1d')](_0xd6e109));_0x8906e1(_0xd6e109);})[_0x2203('0x13')](function(_0x5a95c1){logger[_0x2203('0xe')](_0x2203('0x14'),_0x5a95c1[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6[_0x2203('0xe')](0x1f4,_0x5a95c1['message']));});});};exports[_0x2203('0x1e')]=function(_0x21ff0d){var _0x287c95=this;return new Promise(function(_0xf59954,_0x520602){return db[_0x2203('0x15')][_0x2203('0x1f')]({'raw':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x18')]||null:null,'attributes':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d[_0x2203('0x16')][_0x2203('0x1b')]||null:null,'include':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d['options'][_0x2203('0x1c')]?_[_0x2203('0x19')](_0x21ff0d['options'][_0x2203('0x1c')],function(_0x20fbe1){return{'model':db[_0x20fbe1[_0x2203('0x1a')]],'as':_0x20fbe1['as'],'attributes':_0x20fbe1[_0x2203('0x1b')],'include':_0x20fbe1[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x20fbe1[_0x2203('0x1c')],function(_0x44228e){return{'model':db[_0x44228e[_0x2203('0x1a')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x44228e['include'],function(_0x54b90b){return{'model':db[_0x54b90b[_0x2203('0x1a')]],'as':_0x54b90b['as'],'attributes':_0x54b90b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2203('0x20')](function(_0x3b1eeb){logger[_0x2203('0x11')]('ShowTrunk',_0x21ff0d);logger['debug'](_0x2203('0x1e'),_0x21ff0d,JSON['stringify'](_0x3b1eeb));_0xf59954(_0x3b1eeb);})[_0x2203('0x13')](function(_0x5cfe5e){logger[_0x2203('0xe')]('ShowTrunk',_0x5cfe5e[_0x2203('0x10')],_0x21ff0d);_0x520602(_0x287c95[_0x2203('0xe')](0x1f4,_0x5cfe5e[_0x2203('0x10')]));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s'];(function(_0x4e9657,_0x21d7ba){var _0xee4a30=function(_0x5515f3){while(--_0x5515f3){_0x4e9657['push'](_0x4e9657['shift']());}};_0xee4a30(++_0x21d7ba);}(_0x757a,0xde));var _0xa757=function(_0x40ed0b,_0x4bec82){_0x40ed0b=_0x40ed0b-0x0;var _0x25d8e2=_0x757a[_0x40ed0b];return _0x25d8e2;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetTrunk',_0x4d9f58);logger['debug']('GetTrunk',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetTrunk',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 11ce4fb..0f80018 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 _0xaefc=['getLists','/:id/agents','getAgents','/:id/prefixes','/:id/mail_accounts','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','getApiKey','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','format','%s-%s','now','single','file','addAvatar','login','/:id/logout','/:id/pause','/:id/unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/square_projects','addSquareProjects','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeChatWebsites','removeSquareProjects','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/:id','/:id/avatar','getAvatar','getContacts','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions'];(function(_0x3b8bf5,_0x5e1267){var _0x5b18f9=function(_0x489b84){while(--_0x489b84){_0x3b8bf5['push'](_0x3b8bf5['shift']());}};_0x5b18f9(++_0x5e1267);}(_0xaefc,0x184));var _0xcaef=function(_0x198a55,_0x32317c){_0x198a55=_0x198a55-0x0;var _0x49368f=_0xaefc[_0x198a55];return _0x49368f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcaef('0x0'));var express=require(_0xcaef('0x1'));var router=express[_0xcaef('0x2')]();var auth=require(_0xcaef('0x3'));var interaction=require(_0xcaef('0x4'));var config=require(_0xcaef('0x5'));var controller=require(_0xcaef('0x6'));router[_0xcaef('0x7')]('/',auth['isAuthenticated'](),controller[_0xcaef('0x8')]);router[_0xcaef('0x7')](_0xcaef('0x9'),auth[_0xcaef('0xa')](),controller[_0xcaef('0xb')]);router[_0xcaef('0x7')](_0xcaef('0xc'),auth[_0xcaef('0xa')](),controller[_0xcaef('0xd')]);router[_0xcaef('0x7')](_0xcaef('0xe'),auth[_0xcaef('0xa')](),controller['show']);router['get'](_0xcaef('0xf'),controller[_0xcaef('0x10')]);router['get']('/:id/contacts',auth[_0xcaef('0xa')](),controller[_0xcaef('0x11')]);router[_0xcaef('0x7')]('/:id/queues',auth[_0xcaef('0xa')](),controller[_0xcaef('0x12')]);router[_0xcaef('0x7')]('/:id/queues_rt',auth[_0xcaef('0xa')](),controller[_0xcaef('0x13')]);router[_0xcaef('0x7')]('/:id/groups',auth[_0xcaef('0xa')](),controller[_0xcaef('0x14')]);router[_0xcaef('0x7')](_0xcaef('0x15'),auth[_0xcaef('0xa')](),controller['getRecordings']);router[_0xcaef('0x7')]('/:id/screen_recordings',auth[_0xcaef('0xa')](),controller[_0xcaef('0x16')]);router[_0xcaef('0x7')](_0xcaef('0x17'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x18')]);router[_0xcaef('0x7')]('/:id/openchannel/interactions',auth[_0xcaef('0xa')](),controller[_0xcaef('0x19')]);router[_0xcaef('0x7')](_0xcaef('0x1a'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x1b')]);router['get']('/:id/sms/interactions',auth[_0xcaef('0xa')](),controller['getSmsInteractions']);router[_0xcaef('0x7')](_0xcaef('0x1c'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x1d')]);router['get'](_0xcaef('0x1e'),auth['isAuthenticated'](),controller[_0xcaef('0x1f')]);router[_0xcaef('0x7')]('/:id/teams',auth[_0xcaef('0xa')](),controller['getTeams']);router[_0xcaef('0x7')]('/:id/lists',auth[_0xcaef('0xa')](),controller[_0xcaef('0x20')]);router[_0xcaef('0x7')](_0xcaef('0x21'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x22')]);router[_0xcaef('0x7')](_0xcaef('0x23'),auth[_0xcaef('0xa')](),controller['getVoicePrefixes']);router[_0xcaef('0x7')]('/:id/fax_accounts',auth[_0xcaef('0xa')](),controller['getFaxAccounts']);router['get'](_0xcaef('0x24'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x25')]);router[_0xcaef('0x7')](_0xcaef('0x26'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x27')]);router[_0xcaef('0x7')](_0xcaef('0x28'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x29')]);router[_0xcaef('0x7')](_0xcaef('0x2a'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x2b')]);router['get'](_0xcaef('0x2c'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x2d')]);router[_0xcaef('0x7')]('/:id/square_projects',auth[_0xcaef('0xa')](),controller[_0xcaef('0x2e')]);router['get'](_0xcaef('0x2f'),auth['isAuthenticated'](),controller[_0xcaef('0x30')]);router['get'](_0xcaef('0x31'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x32')]);router[_0xcaef('0x33')](_0xcaef('0x34'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x35')]);router[_0xcaef('0x33')]('/',auth[_0xcaef('0xa')](),controller[_0xcaef('0x36')]);router[_0xcaef('0x33')](_0xcaef('0x37'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x38')]);router[_0xcaef('0x33')](_0xcaef('0x39'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x3a')]);var upload=multer({'storage':multer[_0xcaef('0x3b')]({'destination':function(_0x35eabc,_0x3474da,_0x3c33f5){_0x3c33f5(null,path[_0xcaef('0x3c')](config[_0xcaef('0x3d')],'server/files/images/'));},'filename':function(_0x4df5d7,_0x4f74f7,_0x43adc2){_0x43adc2(null,util[_0xcaef('0x3e')](_0xcaef('0x3f'),Date[_0xcaef('0x40')](),_0x4f74f7['originalname']));}})});router[_0xcaef('0x33')](_0xcaef('0xf'),upload[_0xcaef('0x41')](_0xcaef('0x42')),controller[_0xcaef('0x43')]);router['post']('/:id/login',auth['isAuthenticated'](),controller[_0xcaef('0x44')]);router[_0xcaef('0x33')](_0xcaef('0x45'),auth['isAuthenticated'](),controller['logout']);router[_0xcaef('0x33')](_0xcaef('0x46'),auth[_0xcaef('0xa')](),controller['pause']);router[_0xcaef('0x33')](_0xcaef('0x47'),auth[_0xcaef('0xa')](),controller['unpause']);router[_0xcaef('0x33')](_0xcaef('0x48'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x49')]);router[_0xcaef('0x33')](_0xcaef('0x4a'),auth['isAuthenticated'](),controller[_0xcaef('0x4b')]);router[_0xcaef('0x33')](_0xcaef('0x4c'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0xcaef('0x33')]('/:id/fax_interactions',auth[_0xcaef('0xa')](),controller[_0xcaef('0x4d')]);router['post']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xcaef('0x4e')]);router[_0xcaef('0x33')](_0xcaef('0x4f'),auth[_0xcaef('0xa')](),controller['addOpenchannelInteractions']);router[_0xcaef('0x33')](_0xcaef('0x50'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x51')]);router[_0xcaef('0x33')](_0xcaef('0x52'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x53')]);router['post'](_0xcaef('0x24'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x54')]);router[_0xcaef('0x33')]('/:id/openchannel_accounts',auth[_0xcaef('0xa')](),controller[_0xcaef('0x55')]);router[_0xcaef('0x33')](_0xcaef('0x28'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x56')]);router['post'](_0xcaef('0x2a'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x57')]);router[_0xcaef('0x33')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['addWhatsappAccounts']);router['post'](_0xcaef('0x58'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x59')]);router[_0xcaef('0x33')](_0xcaef('0x31'),auth[_0xcaef('0xa')](),controller['createApiKey']);router[_0xcaef('0x5a')](_0xcaef('0xe'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x5b')]);router[_0xcaef('0x5a')](_0xcaef('0x5c'),auth['isAuthenticated'](),controller[_0xcaef('0x5d')]);router[_0xcaef('0x5e')](_0xcaef('0x39'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x5f')]);router[_0xcaef('0x5e')](_0xcaef('0x48'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x60')]);router[_0xcaef('0x5e')](_0xcaef('0xe'),auth[_0xcaef('0xa')](),controller['destroy']);router[_0xcaef('0x5e')](_0xcaef('0x4a'),auth['isAuthenticated'](),controller[_0xcaef('0x61')]);router[_0xcaef('0x5e')]('/:id/mail_interactions',auth[_0xcaef('0xa')](),controller['removeMailInteractions']);router[_0xcaef('0x5e')]('/:id/fax_interactions',auth[_0xcaef('0xa')](),controller[_0xcaef('0x62')]);router[_0xcaef('0x5e')](_0xcaef('0x63'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete'](_0xcaef('0x4f'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x64')]);router[_0xcaef('0x5e')](_0xcaef('0x50'),auth[_0xcaef('0xa')](),controller['removeWhatsappInteractions']);router[_0xcaef('0x5e')](_0xcaef('0x52'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x65')]);router[_0xcaef('0x5e')](_0xcaef('0x24'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x66')]);router[_0xcaef('0x5e')]('/:id/openchannel_accounts',auth[_0xcaef('0xa')](),controller['removeOpenchannelAccounts']);router[_0xcaef('0x5e')]('/:id/sms_accounts',auth[_0xcaef('0xa')](),controller['removeSmsAccounts']);router[_0xcaef('0x5e')](_0xcaef('0x2a'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x67')]);router[_0xcaef('0x5e')](_0xcaef('0x2c'),auth[_0xcaef('0xa')](),controller['removeWhatsappAccounts']);router['delete'](_0xcaef('0x58'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x68')]);router[_0xcaef('0x5e')](_0xcaef('0x31'),auth[_0xcaef('0xa')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0x6a2d=['/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','/:id/openchannel_accounts','removeOpenchannelAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','Router','../../components/interaction/service','./user.controller','get','isAuthenticated','index','describe','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','%s-%s','originalname','single','login','/:id/logout','logout','pause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions'];(function(_0x12fde3,_0x4800c6){var _0x521038=function(_0x2ea066){while(--_0x2ea066){_0x12fde3['push'](_0x12fde3['shift']());}};_0x521038(++_0x4800c6);}(_0x6a2d,0x145));var _0xd6a2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6a2d[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xd6a2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd6a2('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xd6a2('0x2'));var config=require('../../config/environment');var controller=require(_0xd6a2('0x3'));router[_0xd6a2('0x4')]('/',auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x6')]);router[_0xd6a2('0x4')]('/describe',auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x7')]);router['get']('/whoami',auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x8')]);router['get'](_0xd6a2('0x9'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0xa')]);router[_0xd6a2('0x4')](_0xd6a2('0xb'),controller[_0xd6a2('0xc')]);router[_0xd6a2('0x4')](_0xd6a2('0xd'),auth[_0xd6a2('0x5')](),controller['getContacts']);router['get'](_0xd6a2('0xe'),auth[_0xd6a2('0x5')](),controller['getQueues']);router[_0xd6a2('0x4')]('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0xd6a2('0x4')]('/:id/groups',auth['isAuthenticated'](),controller[_0xd6a2('0xf')]);router['get'](_0xd6a2('0x10'),auth['isAuthenticated'](),controller[_0xd6a2('0x11')]);router[_0xd6a2('0x4')](_0xd6a2('0x12'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x13')]);router[_0xd6a2('0x4')]('/:id/chat/interactions',auth[_0xd6a2('0x5')](),controller['getChatInteractions']);router[_0xd6a2('0x4')](_0xd6a2('0x14'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x15')]);router[_0xd6a2('0x4')](_0xd6a2('0x16'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x17')]);router[_0xd6a2('0x4')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0xd6a2('0x18')]);router[_0xd6a2('0x4')]('/:id/fax/interactions',auth[_0xd6a2('0x5')](),controller['getFaxInteractions']);router[_0xd6a2('0x4')]('/:id/whatsapp/interactions',auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x19')]);router[_0xd6a2('0x4')](_0xd6a2('0x1a'),auth['isAuthenticated'](),controller[_0xd6a2('0x1b')]);router[_0xd6a2('0x4')](_0xd6a2('0x1c'),auth['isAuthenticated'](),controller[_0xd6a2('0x1d')]);router[_0xd6a2('0x4')](_0xd6a2('0x1e'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xd6a2('0x1f'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x20')]);router['get']('/:id/fax_accounts',auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x21')]);router[_0xd6a2('0x4')](_0xd6a2('0x22'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x23')]);router[_0xd6a2('0x4')]('/:id/openchannel_accounts',auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x24')]);router[_0xd6a2('0x4')](_0xd6a2('0x25'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x26')]);router[_0xd6a2('0x4')](_0xd6a2('0x27'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0xd6a2('0x4')](_0xd6a2('0x28'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x29')]);router[_0xd6a2('0x4')](_0xd6a2('0x2a'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0xd6a2('0x4')](_0xd6a2('0x2b'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x2c')]);router[_0xd6a2('0x4')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xd6a2('0x2d')]);router[_0xd6a2('0x2e')](_0xd6a2('0xd'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x2f')]);router[_0xd6a2('0x2e')]('/',auth[_0xd6a2('0x5')](),controller['create']);router[_0xd6a2('0x2e')](_0xd6a2('0x30'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x31')]);router[_0xd6a2('0x2e')](_0xd6a2('0xe'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x32')]);var upload=multer({'storage':multer[_0xd6a2('0x33')]({'destination':function(_0xf5294d,_0x41d430,_0x5508b7){_0x5508b7(null,path[_0xd6a2('0x34')](config['root'],'server/files/images/'));},'filename':function(_0x18595e,_0x3d36b0,_0xa65faf){_0xa65faf(null,util['format'](_0xd6a2('0x35'),Date['now'](),_0x3d36b0[_0xd6a2('0x36')]));}})});router[_0xd6a2('0x2e')](_0xd6a2('0xb'),upload[_0xd6a2('0x37')]('file'),controller['addAvatar']);router[_0xd6a2('0x2e')]('/:id/login',auth['isAuthenticated'](),controller[_0xd6a2('0x38')]);router[_0xd6a2('0x2e')](_0xd6a2('0x39'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x3a')]);router[_0xd6a2('0x2e')]('/:id/pause',auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x3b')]);router['post']('/:id/unpause',auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x3c')]);router['post'](_0xd6a2('0x1a'),auth['isAuthenticated'](),controller[_0xd6a2('0x3d')]);router['post'](_0xd6a2('0x3e'),auth[_0xd6a2('0x5')](),controller['addChatInteractions']);router['post'](_0xd6a2('0x3f'),auth['isAuthenticated'](),controller[_0xd6a2('0x40')]);router[_0xd6a2('0x2e')](_0xd6a2('0x41'),auth[_0xd6a2('0x5')](),controller['addFaxInteractions']);router[_0xd6a2('0x2e')](_0xd6a2('0x42'),auth[_0xd6a2('0x5')](),controller['addSmsInteractions']);router['post'](_0xd6a2('0x43'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x44')]);router['post'](_0xd6a2('0x45'),auth['isAuthenticated'](),controller[_0xd6a2('0x46')]);router['post'](_0xd6a2('0x47'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x48')]);router['post']('/:id/mail_accounts',auth[_0xd6a2('0x5')](),controller['addMailAccounts']);router[_0xd6a2('0x2e')]('/:id/openchannel_accounts',auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x49')]);router[_0xd6a2('0x2e')](_0xd6a2('0x25'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x4a')]);router[_0xd6a2('0x2e')](_0xd6a2('0x27'),auth[_0xd6a2('0x5')](),controller['addChatWebsites']);router['post']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xd6a2('0x4b')]);router[_0xd6a2('0x2e')](_0xd6a2('0x2a'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x4c')]);router[_0xd6a2('0x2e')](_0xd6a2('0x4d'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x4e')]);router['put'](_0xd6a2('0x9'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x4f')]);router[_0xd6a2('0x50')](_0xd6a2('0x51'),auth['isAuthenticated'](),controller[_0xd6a2('0x52')]);router[_0xd6a2('0x53')](_0xd6a2('0xe'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x54')]);router[_0xd6a2('0x53')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xd6a2('0x53')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xd6a2('0x53')](_0xd6a2('0x3e'),auth['isAuthenticated'](),controller[_0xd6a2('0x55')]);router[_0xd6a2('0x53')]('/:id/mail_interactions',auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x56')]);router[_0xd6a2('0x53')](_0xd6a2('0x41'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x57')]);router['delete']('/:id/sms_interactions',auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x58')]);router['delete'](_0xd6a2('0x43'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x59')]);router[_0xd6a2('0x53')](_0xd6a2('0x45'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x5a')]);router['delete'](_0xd6a2('0x47'),auth[_0xd6a2('0x5')](),controller['removeFaxAccounts']);router['delete'](_0xd6a2('0x22'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x5b')]);router['delete'](_0xd6a2('0x5c'),auth['isAuthenticated'](),controller[_0xd6a2('0x5d')]);router['delete'](_0xd6a2('0x25'),auth[_0xd6a2('0x5')](),controller['removeSmsAccounts']);router[_0xd6a2('0x53')](_0xd6a2('0x27'),auth[_0xd6a2('0x5')](),controller['removeChatWebsites']);router[_0xd6a2('0x53')](_0xd6a2('0x28'),auth['isAuthenticated'](),controller[_0xd6a2('0x5e')]);router[_0xd6a2('0x53')](_0xd6a2('0x2a'),auth['isAuthenticated'](),controller[_0xd6a2('0x5f')]);router[_0xd6a2('0x53')](_0xd6a2('0x4d'),auth[_0xd6a2('0x5')](),controller[_0xd6a2('0x60')]);module[_0xd6a2('0x61')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 385bb67..fe4ee03 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 _0x8bf0=['yes','force_rport,comedia','nat','join','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','certificate','active','passive','update,nonat','showWebBar','isArray','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','wss','avpf','actpass','dtlscertfile','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB','udp','transport','split','rfc2833','info','shortinfo','auto','nonat','update'];(function(_0x1b6ce4,_0x9068d7){var _0xa54fd7=function(_0x644628){while(--_0x644628){_0x1b6ce4['push'](_0x1b6ce4['shift']());}};_0xa54fd7(++_0x9068d7);}(_0x8bf0,0x86));var _0x08bf=function(_0x35005f,_0x4dad9f){_0x35005f=_0x35005f-0x0;var _0x1f0270=_0x8bf0[_0x35005f];return _0x1f0270;};'use strict';var Sequelize=require(_0x08bf('0x0'));var moment=require(_0x08bf('0x1'));var util=require(_0x08bf('0x2'));var _=require(_0x08bf('0x3'));module[_0x08bf('0x4')]={'name':{'type':Sequelize[_0x08bf('0x5')],'allowNull':![],'unique':_0x08bf('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2977a3){this[_0x08bf('0x7')](_0x08bf('0x6'),_0x2977a3);this[_0x08bf('0x7')](_0x08bf('0x8'),_0x2977a3);},'comment':_0x08bf('0x9')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x31cb88){this[_0x08bf('0x7')](_0x08bf('0xa'),_0x31cb88);this['setDataValue'](_0x08bf('0xb'),util[_0x08bf('0xc')](_0x08bf('0xd'),_0x31cb88,this[_0x08bf('0xe')](_0x08bf('0xf'))));}},'alias':{'type':Sequelize[_0x08bf('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x08bf('0x10'),'validate':{'isEmail':!![]},'set':function(_0x401e90){if(_0x401e90){this[_0x08bf('0x7')](_0x08bf('0x10'),_0x401e90[_0x08bf('0x11')]());}}},'role':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x13'),'user',_0x08bf('0x14'),_0x08bf('0x15')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x08bf('0x5')],'defaultValue':_0x08bf('0x16')},'internal':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':![],'unique':_0x08bf('0xf'),'set':function(_0x2b1786){this['setDataValue']('internal',_0x2b1786);this[_0x08bf('0x7')](_0x08bf('0x18'),_0x2b1786);this[_0x08bf('0x7')]('callerid',util[_0x08bf('0xc')](_0x08bf('0xd'),this[_0x08bf('0xe')](_0x08bf('0xa')),_0x2b1786));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x08bf('0x5')]},'address':{'type':Sequelize[_0x08bf('0x5')]},'zipcode':{'type':Sequelize[_0x08bf('0x5')]},'userpic':{'type':Sequelize[_0x08bf('0x5')]},'city':{'type':Sequelize[_0x08bf('0x5')]},'country':{'type':Sequelize[_0x08bf('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x08bf('0x19')]},'voicePause':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x08bf('0x5')],'defaultValue':_0x08bf('0x1b')},'lastPauseAt':{'type':Sequelize[_0x08bf('0x19')]},'chatCapacity':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x08bf('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x08bf('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'description':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![],'defaultValue':_0x08bf('0x1c')},'ipaddr':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x08bf('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x1d'),_0x08bf('0x1e'),_0x08bf('0x1f')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x08bf('0x20')},'callingpres':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x21'),'ALLOWED_PASSED_SCREEN',_0x08bf('0x22'),'ALLOWED',_0x08bf('0x23'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x08bf('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x08bf('0x25'),'set':function(_0xb75fd0){this[_0x08bf('0x7')](_0x08bf('0x26'),_0xb75fd0?_0xb75fd0['join'](','):null);},'get':function(){return this[_0x08bf('0xe')](_0x08bf('0x26'))?this[_0x08bf('0xe')]('transport')[_0x08bf('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x28'),_0x08bf('0x29'),_0x08bf('0x2a'),'inband',_0x08bf('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x08bf('0x2c'),_0x08bf('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![],'defaultValue':_0x08bf('0x2f'),'set':function(_0x23a78c){this[_0x08bf('0x7')](_0x08bf('0x30'),_0x23a78c?_0x23a78c[_0x08bf('0x31')](','):null);},'get':function(){return this[_0x08bf('0xe')]('nat')?this['getDataValue'](_0x08bf('0x30'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x08bf('0x5')]},'namedcallgroup':{'type':Sequelize[_0x08bf('0x5')]},'pickupgroup':{'type':Sequelize[_0x08bf('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x08bf('0x5')]},'language':{'type':Sequelize[_0x08bf('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x08bf('0x5')]},'disallow':{'type':Sequelize[_0x08bf('0x5')],'allowNull':![],'defaultValue':_0x08bf('0x32')},'allow':{'type':Sequelize[_0x08bf('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2806da){this[_0x08bf('0x7')]('allow',_0x2806da?_0x2806da[_0x08bf('0x31')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x08bf('0xe')](_0x08bf('0x33'))?this[_0x08bf('0xe')](_0x08bf('0x33'))[_0x08bf('0x27')](';'):null;},'comment':_0x08bf('0x34')},'autoframing':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x4e3407){this['setDataValue']('insecure',_0x4e3407?_0x4e3407[_0x08bf('0x31')](','):null);},'get':function(){return this[_0x08bf('0xe')](_0x08bf('0x35'))?this[_0x08bf('0xe')](_0x08bf('0x35'))[_0x08bf('0x27')](','):null;},'comment':_0x08bf('0x36')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x08bf('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x08bf('0x37')},'amaflags':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x08bf('0x2e')},'busylevel':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x08bf('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x08bf('0x12')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x08bf('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x38'),_0x08bf('0x39'),_0x08bf('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x3b'),'uas'),'allowNull':!![],'defaultValue':_0x08bf('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x08bf('0x12')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x08bf('0x12')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no','fingerprint',_0x08bf('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x3e'),_0x08bf('0x3f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x08bf('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no',_0x08bf('0x2c'),_0x08bf('0x2d'),_0x08bf('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x08bf('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x08bf('0x19')]},'passwordResetAt':{'type':Sequelize[_0x08bf('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x08bf('0x5')]},'showWebBar':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0,'set':function(_0xbae37f){this['setDataValue'](_0x08bf('0x41'),_0xbae37f);var _0x5771fd=this['get']({'plain':!![]});switch(_0xbae37f){case 0x0:case 0x1:var _0x4d1210=_0x5771fd[_0x08bf('0x26')]?_[_0x08bf('0x42')](_0x5771fd[_0x08bf('0x26')])?_0x5771fd[_0x08bf('0x26')]['join']():_0x5771fd[_0x08bf('0x26')]:'udp';if(_0x4d1210==='wss'){_0x4d1210='udp';}this[_0x08bf('0x7')]('transport',_0x4d1210);this[_0x08bf('0x7')](_0x08bf('0x43'),'no');this[_0x08bf('0x7')]('avpf',null);this[_0x08bf('0x7')](_0x08bf('0x44'),null);this[_0x08bf('0x7')](_0x08bf('0x45'),null);this[_0x08bf('0x7')](_0x08bf('0x46'),null);this[_0x08bf('0x7')](_0x08bf('0x47'),null);this[_0x08bf('0x7')](_0x08bf('0x48'),null);this[_0x08bf('0x7')]('dtlscertfile',null);this['setDataValue'](_0x08bf('0x49'),null);this[_0x08bf('0x7')]('rtcp_mux','no');break;case 0x2:this[_0x08bf('0x7')](_0x08bf('0x26'),_0x08bf('0x4a'));this[_0x08bf('0x7')](_0x08bf('0x43'),'yes');this[_0x08bf('0x7')](_0x08bf('0x4b'),_0x08bf('0x2e'));this[_0x08bf('0x7')](_0x08bf('0x44'),'yes');this[_0x08bf('0x7')](_0x08bf('0x45'),_0x08bf('0x2e'));this['setDataValue'](_0x08bf('0x46'),_0x08bf('0x2e'));this[_0x08bf('0x7')](_0x08bf('0x47'),'no');this[_0x08bf('0x7')](_0x08bf('0x48'),_0x08bf('0x4c'));this[_0x08bf('0x7')](_0x08bf('0x4d'),_0x5771fd['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0x08bf('0x7')](_0x08bf('0x49'),_0x5771fd[_0x08bf('0x49')]||_0x08bf('0x4e'));this[_0x08bf('0x7')](_0x08bf('0x4f'),_0x08bf('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0x08bf('0x50')],'set':function(_0x48c199){this[_0x08bf('0x7')](_0x08bf('0x51'),_0x48c199?_0x48c199[_0x08bf('0x31')](','):[]);},'get':function(){return this[_0x08bf('0xe')]('permissions')?_[_0x08bf('0x52')](this['getDataValue'](_0x08bf('0x51'))[_0x08bf('0x27')](','),function(_0x532e5b){return parseInt(_0x532e5b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x08bf('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x08bf('0x5')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x08bf('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x08bf('0xe')](_0x08bf('0x53'))?this[_0x08bf('0xe')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'interface':{'type':Sequelize[_0x08bf('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![],'set':function(_0x417da5){if(typeof _0x417da5===_0x08bf('0x54')){var _0x228ca8=_0x417da5==='1'?!![]:_0x417da5==='0'?![]:_0x417da5===_0x08bf('0x55')?!![]:_0x417da5===_0x08bf('0x56')?![]:![];this[_0x08bf('0x7')](_0x08bf('0x57'),_0x228ca8);}else{this[_0x08bf('0x7')]('screenrecording',_0x417da5);}}},'blocked':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![],'set':function(_0x132f60){this[_0x08bf('0x7')](_0x08bf('0x58'),_0x132f60);if(_0x132f60===!![]){this[_0x08bf('0x7')]('blockedAt',moment());this[_0x08bf('0x7')]('loginAttempts',0x0);}else{this['setDataValue'](_0x08bf('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0x08bf('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':!![]}}; \ No newline at end of file +var _0x764c=['dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','wss','force_avp','dtlscertfile','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','user','telephone','local','INTEGER','accountcode','callerid','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uas','fingerprint','active','passive','actpass','update,nonat','showWebBar','encryption','avpf','icesupport'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x764c,0x16a));var _0xc764=function(_0xde3db5,_0x5bcd71){_0xde3db5=_0xde3db5-0x0;var _0x20ac14=_0x764c[_0xde3db5];return _0x20ac14;};'use strict';var Sequelize=require(_0xc764('0x0'));var moment=require(_0xc764('0x1'));var util=require(_0xc764('0x2'));var _=require(_0xc764('0x3'));module[_0xc764('0x4')]={'name':{'type':Sequelize[_0xc764('0x5')],'allowNull':![],'unique':_0xc764('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2a336b){this['setDataValue'](_0xc764('0x6'),_0x2a336b);this[_0xc764('0x7')](_0xc764('0x8'),_0x2a336b);},'comment':_0xc764('0x9')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x47c0eb){this['setDataValue'](_0xc764('0xa'),_0x47c0eb);this[_0xc764('0x7')]('callerid',util[_0xc764('0xb')](_0xc764('0xc'),_0x47c0eb,this[_0xc764('0xd')](_0xc764('0xe'))));}},'alias':{'type':Sequelize[_0xc764('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x494ff7){if(_0x494ff7){this[_0xc764('0x7')](_0xc764('0xf'),_0x494ff7[_0xc764('0x10')]());}}},'role':{'type':Sequelize[_0xc764('0x11')]('admin',_0xc764('0x12'),'agent',_0xc764('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xc764('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xc764('0x5')],'defaultValue':_0xc764('0x14')},'internal':{'type':Sequelize[_0xc764('0x15')](0xb),'allowNull':![],'unique':_0xc764('0xe'),'set':function(_0x14b8c7){this[_0xc764('0x7')](_0xc764('0xe'),_0x14b8c7);this[_0xc764('0x7')](_0xc764('0x16'),_0x14b8c7);this['setDataValue'](_0xc764('0x17'),util[_0xc764('0xb')](_0xc764('0xc'),this[_0xc764('0xd')](_0xc764('0xa')),_0x14b8c7));}},'salt':{'type':Sequelize[_0xc764('0x5')]},'phone':{'type':Sequelize[_0xc764('0x5')]},'mobile':{'type':Sequelize[_0xc764('0x5')]},'address':{'type':Sequelize[_0xc764('0x5')]},'zipcode':{'type':Sequelize[_0xc764('0x5')]},'userpic':{'type':Sequelize[_0xc764('0x5')]},'city':{'type':Sequelize[_0xc764('0x5')]},'country':{'type':Sequelize[_0xc764('0x5')]},'online':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xc764('0x19')]},'voicePause':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xc764('0x5')],'defaultValue':_0xc764('0x1a')},'lastPauseAt':{'type':Sequelize[_0xc764('0x19')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc764('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc764('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc764('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc764('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc764('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc764('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc764('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![],'defaultValue':_0xc764('0x1b')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xc764('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xc764('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc764('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc764('0x11')]('friend',_0xc764('0x12'),'peer'),'allowNull':!![],'defaultValue':_0xc764('0x1c')},'context':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![],'defaultValue':_0xc764('0x1d')},'callingpres':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x1e'),_0xc764('0x1f'),_0xc764('0x20'),_0xc764('0x21'),_0xc764('0x22'),_0xc764('0x23'),_0xc764('0x24'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![],'defaultValue':_0xc764('0x25'),'set':function(_0x5bd6e1){this[_0xc764('0x7')](_0xc764('0x26'),_0x5bd6e1?_0x5bd6e1['join'](','):null);},'get':function(){return this[_0xc764('0xd')]('transport')?this[_0xc764('0xd')](_0xc764('0x26'))[_0xc764('0x27')](','):null;},'comment':_0xc764('0x28')},'dtmfmode':{'type':Sequelize['ENUM'](_0xc764('0x29'),_0xc764('0x2a'),_0xc764('0x2b'),_0xc764('0x2c'),_0xc764('0x2d')),'allowNull':!![],'defaultValue':_0xc764('0x29')},'directmedia':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x2e'),'no',_0xc764('0x2f'),_0xc764('0x30'),_0xc764('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xc764('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![],'defaultValue':_0xc764('0x32'),'set':function(_0x2c2db4){this[_0xc764('0x7')]('nat',_0x2c2db4?_0x2c2db4['join'](','):null);},'get':function(){return this[_0xc764('0xd')]('nat')?this[_0xc764('0xd')]('nat')[_0xc764('0x27')](','):null;},'comment':_0xc764('0x33')},'callgroup':{'type':Sequelize[_0xc764('0x5')]},'namedcallgroup':{'type':Sequelize[_0xc764('0x5')]},'pickupgroup':{'type':Sequelize[_0xc764('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc764('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc764('0x5')]},'disallow':{'type':Sequelize[_0xc764('0x5')],'allowNull':![],'defaultValue':_0xc764('0x34')},'allow':{'type':Sequelize[_0xc764('0x5')],'allowNull':![],'defaultValue':_0xc764('0x35'),'set':function(_0x5603c5){this[_0xc764('0x7')](_0xc764('0x36'),_0x5603c5?_0x5603c5[_0xc764('0x37')](';'):_0xc764('0x35'));},'get':function(){return this[_0xc764('0xd')](_0xc764('0x36'))?this[_0xc764('0xd')](_0xc764('0x36'))[_0xc764('0x27')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xc764('0x11')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x57d836){this[_0xc764('0x7')](_0xc764('0x38'),_0x57d836?_0x57d836[_0xc764('0x37')](','):null);},'get':function(){return this[_0xc764('0xd')]('insecure')?this[_0xc764('0xd')](_0xc764('0x38'))[_0xc764('0x27')](','):null;},'comment':_0xc764('0x39')},'trustrpid':{'type':Sequelize['ENUM'](_0xc764('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x2e'),'no',_0xc764('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xc764('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xc764('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![],'defaultValue':_0xc764('0x3b')},'amaflags':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xc764('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xc764('0x2e')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xc764('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc764('0x11')]('yes','no',_0xc764('0x3c')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xc764('0x3d'),_0xc764('0x3e'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc764('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xc764('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc764('0x11')]('uac',_0xc764('0x3f')),'allowNull':!![],'defaultValue':_0xc764('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xc764('0x2e')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc764('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc764('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc764('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc764('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc764('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xc764('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xc764('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xc764('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x2e'),'no',_0xc764('0x40'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x41'),_0xc764('0x42'),_0xc764('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc764('0x11')](_0xc764('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc764('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xc764('0x11')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc764('0x11')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xc764('0x2e'),'no',_0xc764('0x2f'),'update',_0xc764('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc764('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xc764('0x19')]},'passwordResetAt':{'type':Sequelize[_0xc764('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc764('0x5')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4746eb){this[_0xc764('0x7')](_0xc764('0x45'),_0x4746eb);var _0x49cb6a=this['get']({'plain':!![]});switch(_0x4746eb){case 0x0:case 0x1:var _0x5a84db=_0x49cb6a[_0xc764('0x26')]?_['isArray'](_0x49cb6a[_0xc764('0x26')])?_0x49cb6a[_0xc764('0x26')][_0xc764('0x37')]():_0x49cb6a[_0xc764('0x26')]:_0xc764('0x25');if(_0x5a84db==='wss'){_0x5a84db=_0xc764('0x25');}this[_0xc764('0x7')](_0xc764('0x26'),_0x5a84db);this[_0xc764('0x7')](_0xc764('0x46'),'no');this[_0xc764('0x7')](_0xc764('0x47'),null);this[_0xc764('0x7')]('force_avp',null);this['setDataValue'](_0xc764('0x48'),null);this[_0xc764('0x7')](_0xc764('0x49'),null);this[_0xc764('0x7')](_0xc764('0x4a'),null);this[_0xc764('0x7')](_0xc764('0x4b'),null);this[_0xc764('0x7')]('dtlscertfile',null);this['setDataValue'](_0xc764('0x4c'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xc764('0x7')](_0xc764('0x26'),_0xc764('0x4d'));this[_0xc764('0x7')](_0xc764('0x46'),_0xc764('0x2e'));this[_0xc764('0x7')](_0xc764('0x47'),_0xc764('0x2e'));this[_0xc764('0x7')](_0xc764('0x4e'),_0xc764('0x2e'));this[_0xc764('0x7')]('icesupport',_0xc764('0x2e'));this[_0xc764('0x7')](_0xc764('0x49'),_0xc764('0x2e'));this['setDataValue']('dtlsverify','no');this[_0xc764('0x7')]('dtlssetup',_0xc764('0x43'));this['setDataValue'](_0xc764('0x4f'),_0x49cb6a[_0xc764('0x4f')]||'/etc/pki/tls/certs/motion.crt');this[_0xc764('0x7')]('dtlsprivatekey',_0x49cb6a[_0xc764('0x4c')]||'/etc/pki/tls/private/motion.key');this[_0xc764('0x7')](_0xc764('0x50'),_0xc764('0x2e'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x5f163d){this[_0xc764('0x7')](_0xc764('0x51'),_0x5f163d?_0x5f163d[_0xc764('0x37')](','):[]);},'get':function(){return this[_0xc764('0xd')](_0xc764('0x51'))?_['map'](this[_0xc764('0xd')]('permissions')[_0xc764('0x27')](','),function(_0xfcc250){return parseInt(_0xfcc250,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc764('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc764('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xc764('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc764('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc764('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc764('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc764('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xc764('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc764('0x11')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xc764('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc764('0x52')],'get':function(){return this[_0xc764('0xd')](_0xc764('0x53'))?this[_0xc764('0xd')](_0xc764('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0xc764('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc764('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![],'set':function(_0x187e7f){if(typeof _0x187e7f==='string'){var _0x14a0a2=_0x187e7f==='1'?!![]:_0x187e7f==='0'?![]:_0x187e7f==='true'?!![]:_0x187e7f===_0xc764('0x54')?![]:![];this[_0xc764('0x7')](_0xc764('0x55'),_0x14a0a2);}else{this[_0xc764('0x7')]('screenrecording',_0x187e7f);}}},'blocked':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![],'set':function(_0x232f03){this[_0xc764('0x7')]('blocked',_0x232f03);if(_0x232f03===!![]){this[_0xc764('0x7')]('blockedAt',moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0xc764('0x7')](_0xc764('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0xc764('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc764('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc764('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 006e1ba..52102db 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 _0x63e3=['login','mobile','intrf','SIP/%s','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','YYYY-MM-DD\x20HH:mm:ss','forEach','PAUSE','LOGININPAUSE','MemberReport','bulkCreate','concat','isMiddleware','logout','pause','QueuePause','getChannels','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','lastPauseAt','manual','fax','sms','whatsapp','openchannel','%s%s','Pause','Team','getTeams','addTeams','setDataValue','getChatQueues','Chat','getMailQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','Voice','getDataValue','Queue:save','removeTeams','Mail','getSmsQueues','transaction','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','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','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','removeSquareProjects','getScheduledCalls','$or','$gt','$lt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contained','$any','CmHopper','lastName','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyIat','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./user.socket','register','jayson/promise','client','request','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','role','admin','Users','user','Agents','Telephones','filter','map','value','includes','find','name','UserProfileResource','destroy','send','index','rawAttributes','fieldName','type','key','model','differenceBy','password','salt','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','sequelize','lower','col','User','include','findAll','rows','params','includeAll','options','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','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','113','110','105','106','107','108','109','100','111','114','create','agent','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','autoAssociation','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','push','each','UserProfileSection','isEmpty','telephone','all','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','emit','VoiceQueue','voice','format','UserVoiceQueueRt','upsert','removeQueues','remove','Queue:remove','file','getAvatar','join','server/files/images/logos/default_profile.png','userpic','download','root','server/files/images/','getContacts','findOne','CmContact','hasOwnProperty','CmList','color','tag','getQueues','Queue','get','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0x63e3,0x92));var _0x363e=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x63e3[_0x341e0f];return _0x59555a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x363e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x363e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x363e('0x2'));var moment=require('moment');var BPromise=require(_0x363e('0x3'));var Mustache=require(_0x363e('0x4'));var util=require(_0x363e('0x5'));var path=require('path');var sox=require(_0x363e('0x6'));var csv=require(_0x363e('0x7'));var ejs=require(_0x363e('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x363e('0x9'));var crypto=require('crypto');var jsforce=require(_0x363e('0xa'));var deskjs=require(_0x363e('0xb'));var toCsv=require(_0x363e('0x7'));var querystring=require(_0x363e('0xc'));var Papa=require(_0x363e('0xd'));var Redis=require(_0x363e('0xe'));var authService=require(_0x363e('0xf'));var qs=require(_0x363e('0x10'));var as=require(_0x363e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x363e('0x12'));var licenseUtil=require(_0x363e('0x13'));var db=require(_0x363e('0x14'))['db'];config[_0x363e('0x15')]=_[_0x363e('0x16')](config[_0x363e('0x15')],{'host':_0x363e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x363e('0x15')]));require(_0x363e('0x18'))[_0x363e('0x19')](socket);var jayson=require(_0x363e('0x1a'));var client=jayson[_0x363e('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31ca17,_0x3babe9,_0x16f2ba,_0x4b07ad){return new BPromise(function(_0x557677,_0x5d5700){var _0x88e257=_0x4b07ad||client;return _0x88e257[_0x363e('0x1c')](_0x31ca17,_0x16f2ba)['then'](function(_0x229dca){logger['info'](_0x363e('0x1d'),_0x3babe9,_0x363e('0x1e'));logger[_0x363e('0x1f')](_0x363e('0x20'),_0x3babe9,'request\x20sent',JSON['stringify'](_0x229dca));if(_0x229dca[_0x363e('0x21')]){if(_0x229dca['error']['code']===0x1f4){logger[_0x363e('0x21')](_0x363e('0x1d'),_0x3babe9,_0x229dca['error'][_0x363e('0x22')]);return _0x5d5700(_0x229dca[_0x363e('0x21')][_0x363e('0x22')]);}logger[_0x363e('0x21')]('User,\x20%s,\x20%s',_0x3babe9,_0x229dca[_0x363e('0x21')][_0x363e('0x22')]);return _0x557677(_0x229dca['error'][_0x363e('0x22')]);}else{logger[_0x363e('0x23')]('User,\x20%s,\x20%s',_0x3babe9,_0x363e('0x1e'));_0x557677(_0x229dca['result']['message']);}})[_0x363e('0x24')](function(_0x3647f4){logger[_0x363e('0x21')](_0x363e('0x1d'),_0x3babe9,_0x3647f4);_0x5d5700(_0x3647f4);});});}function respondWithStatusCode(_0x4bdd47,_0x3d666a){_0x3d666a=_0x3d666a||0xcc;return function(_0x4eeee2){if(_0x4eeee2){return _0x4bdd47[_0x363e('0x25')](_0x3d666a);}return _0x4bdd47[_0x363e('0x26')](_0x3d666a)[_0x363e('0x27')]();};}function respondWithResult(_0x11151b,_0x4f0c72){_0x4f0c72=_0x4f0c72||0xc8;return function(_0x363de1){if(_0x363de1){return _0x11151b[_0x363e('0x26')](_0x4f0c72)[_0x363e('0x28')](_0x363de1);}};}function respondWithFilteredResult(_0xf1dcd4,_0x5f3546){return function(_0x3904bd){if(_0x3904bd){var _0x30ab9e=_0x3904bd[_0x363e('0x29')],_0x57b949=_0x5f3546['offset'],_0x72c957=_0x5f3546[_0x363e('0x2a')]+_0x5f3546[_0x363e('0x2b')],_0xe319fa;if(_0x72c957>=_0x30ab9e){_0x72c957=_0x30ab9e;_0xe319fa=0xc8;}else{_0xe319fa=0xce;}_0xf1dcd4[_0x363e('0x26')](_0xe319fa);return _0xf1dcd4[_0x363e('0x2c')](_0x363e('0x2d'),_0x57b949+'-'+_0x72c957+'/'+_0x30ab9e)[_0x363e('0x28')](_0x3904bd);}return null;};}function patchUpdates(_0x15fc46){return function(_0x18c2a1){try{jsonpatch['apply'](_0x18c2a1,_0x15fc46,!![]);}catch(_0x302166){return BPromise[_0x363e('0x2e')](_0x302166);}return _0x18c2a1[_0x363e('0x2f')]();};}function saveUpdates(_0x29931a,_0x2b4116){return function(_0x56b0f2){if(_0x56b0f2){return _0x56b0f2[_0x363e('0x30')](_0x29931a)[_0x363e('0x31')](function(_0x18a8be){return _0x18a8be;});}return null;};}function removeEntity(_0x336216,_0x51a3b3){return function(_0x49953f){if(_0x49953f){return _0x49953f['destroy']()[_0x363e('0x31')](function(){var _0x289895=_0x49953f['get']({'plain':!![]});if(_0x289895[_0x363e('0x32')]===_0x363e('0x33'))return;var _0x125d57=[{'name':_0x363e('0x34'),'value':_0x363e('0x35'),'ignore':!![]},{'name':_0x363e('0x36'),'value':'agent','ignore':![]},{'name':_0x363e('0x37'),'value':'telephone','ignore':![]}];var _0x1a4731=_(_0x125d57)[_0x363e('0x38')]('ignore')[_0x363e('0x39')](_0x363e('0x3a'))['value']();if(_[_0x363e('0x3b')](_0x1a4731,_0x289895[_0x363e('0x32')])){return;}var _0x4ddad3=_[_0x363e('0x3c')](_0x125d57,[_0x363e('0x3a'),_0x289895[_0x363e('0x32')]])[_0x363e('0x3d')];return db[_0x363e('0x3e')][_0x363e('0x3f')]({'where':{'type':_0x4ddad3,'resourceId':_0x289895['id']}})['then'](function(){return _0x49953f;});})[_0x363e('0x31')](function(){_0x336216[_0x363e('0x26')](0xcc)[_0x363e('0x27')]();});}};}function handleEntityNotFound(_0x5236f8,_0x584d4a){return function(_0xdd73b6){if(!_0xdd73b6){_0x5236f8[_0x363e('0x25')](0x194);}return _0xdd73b6;};}function handleError(_0x3844af,_0x4ca257){_0x4ca257=_0x4ca257||0x1f4;return function(_0x2b87d8){logger[_0x363e('0x21')](_0x2b87d8['stack']);if(_0x2b87d8[_0x363e('0x3d')]){delete _0x2b87d8[_0x363e('0x3d')];}_0x3844af[_0x363e('0x26')](_0x4ca257)[_0x363e('0x40')](_0x2b87d8);};}exports[_0x363e('0x41')]=function(_0x222269,_0x6a9855){var _0x52d037={},_0x2b0b42={},_0xd53cb={'count':0x0,'rows':[]};var _0x4d0a0f=_[_0x363e('0x39')](db['User'][_0x363e('0x42')],function(_0x355a83){return{'name':_0x355a83[_0x363e('0x43')],'type':_0x355a83[_0x363e('0x44')][_0x363e('0x45')]};});_0x2b0b42[_0x363e('0x46')]=_[_0x363e('0x47')](_[_0x363e('0x39')](_0x4d0a0f,_0x363e('0x3d')),[_0x363e('0x48'),_0x363e('0x49')]);_0x2b0b42['query']=_[_0x363e('0x4a')](_0x222269[_0x363e('0x4b')]);_0x2b0b42[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x2b0b42[_0x363e('0x46')],_0x2b0b42['query']);_0x52d037['attributes']=_[_0x363e('0x4d')](_0x2b0b42[_0x363e('0x46')],qs['fields'](_0x222269['query'][_0x363e('0x4e')]));_0x52d037[_0x363e('0x4f')]=_0x52d037[_0x363e('0x4f')][_0x363e('0x50')]?_0x52d037[_0x363e('0x4f')]:_0x2b0b42['model'];if(!_0x222269[_0x363e('0x4b')]['hasOwnProperty'](_0x363e('0x51'))){_0x52d037['limit']=qs[_0x363e('0x2b')](_0x222269[_0x363e('0x4b')][_0x363e('0x2b')]);_0x52d037['offset']=qs[_0x363e('0x2a')](_0x222269[_0x363e('0x4b')][_0x363e('0x2a')]);}_0x52d037[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x222269[_0x363e('0x4b')][_0x363e('0x53')]);_0x52d037[_0x363e('0x54')]=qs['filters'](_[_0x363e('0x55')](_0x222269[_0x363e('0x4b')],_0x2b0b42['filters']),_0x4d0a0f);if(_0x222269['query'][_0x363e('0x38')]){_0x52d037[_0x363e('0x54')]=_[_0x363e('0x56')](_0x52d037[_0x363e('0x54')],{'$or':_['map'](_0x4d0a0f,function(_0x27a5e9){if(_0x27a5e9[_0x363e('0x44')]!=='VIRTUAL'){return db[_0x363e('0x57')][_0x363e('0x54')](db[_0x363e('0x57')]['fn'](_0x363e('0x58'),db['sequelize'][_0x363e('0x59')](_0x27a5e9['name'])),{'$like':db[_0x363e('0x57')]['fn']('lower','%'+_0x222269['query'][_0x363e('0x38')]+'%')});}})});}_0x52d037=_[_0x363e('0x56')]({},_0x52d037,_0x222269['options']);var _0x4878fe={'where':_0x52d037['where']};return db[_0x363e('0x5a')][_0x363e('0x29')](_0x4878fe)[_0x363e('0x31')](function(_0xda95c6){_0xd53cb['count']=_0xda95c6;if(_0x222269[_0x363e('0x4b')]['includeAll']){_0x52d037[_0x363e('0x5b')]=[{'all':!![]}];}return db[_0x363e('0x5a')][_0x363e('0x5c')](_0x52d037);})[_0x363e('0x31')](function(_0x3a3fd8){_0xd53cb[_0x363e('0x5d')]=_0x3a3fd8;return _0xd53cb;})[_0x363e('0x31')](respondWithFilteredResult(_0x6a9855,_0x52d037))[_0x363e('0x24')](handleError(_0x6a9855,null));};exports['show']=function(_0x4bf8be,_0x594c43){var _0x2981ef={'raw':![],'where':{'id':_0x4bf8be[_0x363e('0x5e')]['id']}},_0x42fc13={};_0x42fc13['model']=_['differenceBy'](_['keys'](db[_0x363e('0x5a')][_0x363e('0x42')]),[_0x363e('0x48'),_0x363e('0x49')]);_0x42fc13['query']=_[_0x363e('0x4a')](_0x4bf8be[_0x363e('0x4b')]);_0x42fc13[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x42fc13[_0x363e('0x46')],_0x42fc13[_0x363e('0x4b')]);_0x2981ef[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x42fc13[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x4bf8be['query'][_0x363e('0x4e')]));_0x2981ef['attributes']=_0x2981ef[_0x363e('0x4f')][_0x363e('0x50')]?_0x2981ef[_0x363e('0x4f')]:_0x42fc13[_0x363e('0x46')];if(_0x4bf8be[_0x363e('0x4b')][_0x363e('0x5f')]){_0x2981ef[_0x363e('0x5b')]=[{'all':!![]}];}_0x2981ef=_[_0x363e('0x56')]({},_0x2981ef,_0x4bf8be[_0x363e('0x60')]);return db[_0x363e('0x5a')][_0x363e('0x3c')](_0x2981ef)[_0x363e('0x31')](handleEntityNotFound(_0x594c43,null))['then'](respondWithResult(_0x594c43,null))['catch'](handleError(_0x594c43,null));};exports[_0x363e('0x30')]=function(_0x1dd5c4,_0x205718){if(_0x1dd5c4[_0x363e('0x61')]['id']){delete _0x1dd5c4[_0x363e('0x61')]['id'];}delete _0x1dd5c4['body'][_0x363e('0x32')];return db[_0x363e('0x5a')]['find']({'where':{'id':_0x1dd5c4[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x205718,null))['then'](saveUpdates(_0x1dd5c4['body'],null))[_0x363e('0x31')](respondWithResult(_0x205718,null))[_0x363e('0x24')](handleError(_0x205718,null));};exports['describe']=function(_0x598335,_0x446de5){return db[_0x363e('0x5a')][_0x363e('0x62')]()[_0x363e('0x31')](respondWithResult(_0x446de5,null))[_0x363e('0x24')](handleError(_0x446de5,null));};exports[_0x363e('0x63')]=function(_0x5e3ec1,_0x232bef,_0x1b4e0c){return db[_0x363e('0x5a')][_0x363e('0x3c')]({'where':{'id':_0x5e3ec1['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x232bef,null))[_0x363e('0x31')](function(_0x51859f){if(_0x51859f){return _0x51859f[_0x363e('0x63')](_0x5e3ec1[_0x363e('0x61')][_0x363e('0x64')],_[_0x363e('0x65')](_0x5e3ec1[_0x363e('0x61')],[_0x363e('0x64'),'id'])||{});}})[_0x363e('0x31')](respondWithResult(_0x232bef,null))['catch'](handleError(_0x232bef,null));};function validateUser(_0x21b114){return new BPromise(function(_0x4a100d,_0x2e69dd){if(_0x21b114[_0x363e('0x66')])return _0x4a100d(_0x21b114);return db[_0x363e('0x67')]['findById'](0x1)['then'](function(_0x7f198e){if(_0x7f198e[_0x363e('0x68')])authService[_0x363e('0x69')](_0x21b114[_0x363e('0x48')]);db['User'][_0x363e('0x6a')](_0x363e('0x66'))[_0x363e('0x31')](function(_0x18598f){if(_[_0x363e('0x6b')](_0x18598f)){_0x21b114['internal']=_0x7f198e[_0x363e('0x6c')]||0x1;return;}if(_[_0x363e('0x6b')](_0x7f198e[_0x363e('0x6c')])||_0x7f198e[_0x363e('0x6c')]===_0x18598f){_0x21b114[_0x363e('0x66')]=_0x18598f+0x1;return;}if(_0x7f198e[_0x363e('0x6c')]>_0x18598f){_0x21b114['internal']=_0x7f198e[_0x363e('0x6c')];return;}return db['sequelize'][_0x363e('0x4b')](_0x363e('0x6d'),{'type':db['sequelize'][_0x363e('0x6e')][_0x363e('0x6f')]})[_0x363e('0x31')](function(_0x59cc6e){if(_0x59cc6e&&_0x59cc6e[_0x363e('0x50')]){for(var _0x233b66=0x0,_0x2c1951=_0x59cc6e['length'];_0x233b66<_0x2c1951&&_[_0x363e('0x6b')](_0x21b114[_0x363e('0x66')]);_0x233b66++){if(_0x7f198e[_0x363e('0x6c')]<=_0x59cc6e[_0x233b66]['from']){_0x21b114[_0x363e('0x66')]=_0x59cc6e[_0x233b66][_0x363e('0x70')];}else if(_0x7f198e['min_internal']>_0x59cc6e[_0x233b66][_0x363e('0x70')]&&_0x7f198e[_0x363e('0x6c')]<=_0x59cc6e[_0x233b66]['to']){_0x21b114[_0x363e('0x66')]=_0x7f198e[_0x363e('0x6c')];}}}if(_['isNil'](_0x21b114[_0x363e('0x66')])){_0x21b114[_0x363e('0x66')]=_0x18598f+0x1;}return _0x4a100d(_0x21b114);});});})[_0x363e('0x24')](function(_0x54bb94){_0x2e69dd(_0x54bb94);});});}function updateUser(_0xfcfc3a){return new BPromise(function(_0x10a867,_0x34e5cd){try{if(_0xfcfc3a[_0x363e('0x71')]){_0xfcfc3a[_0x363e('0x72')]=_0xfcfc3a['internal'];_0xfcfc3a[_0x363e('0x73')]={'mailbox':_0xfcfc3a[_0x363e('0x66')],'password':_0xfcfc3a['password'],'fullname':_0xfcfc3a[_0x363e('0x74')],'email':_0xfcfc3a[_0x363e('0x75')]};}if(_0xfcfc3a['role']==='agent'){if(!_0xfcfc3a[_0x363e('0x76')])_0xfcfc3a[_0x363e('0x76')]=[_0x363e('0x77'),_0x363e('0x78'),'103',_0x363e('0x79'),_0x363e('0x7a'),'104',_0x363e('0x7b'),_0x363e('0x7c'),_0x363e('0x7d'),_0x363e('0x7e'),_0x363e('0x7f'),_0x363e('0x80'),_0x363e('0x81'),_0x363e('0x82')];}_0x10a867(_0xfcfc3a);}catch(_0x290b62){_0x34e5cd(_0x290b62);}});}exports[_0x363e('0x83')]=function(_0x3ccd74,_0x29c765){if(_0x3ccd74[_0x363e('0x35')][_0x363e('0x32')]===_0x363e('0x84'))throw new Error(_0x363e('0x85'));if(_0x3ccd74[_0x363e('0x61')][_0x363e('0x32')]===_0x363e('0x35')&&_0x3ccd74['user'][_0x363e('0x32')]!==_0x363e('0x33')){throw new Error(_0x363e('0x86'));}if(_0x3ccd74[_0x363e('0x61')][_0x363e('0x32')]===_0x363e('0x33')&&_0x3ccd74[_0x363e('0x35')][_0x363e('0x32')]!==_0x363e('0x33')){throw new Error(_0x363e('0x87'));}return licenseUtil[_0x363e('0x88')]([_0x3ccd74['body']])[_0x363e('0x31')](function(){return validateUser(_0x3ccd74[_0x363e('0x61')]);})[_0x363e('0x31')](function(_0x4b3c97){return updateUser(_0x4b3c97)[_0x363e('0x31')](function(_0x387afe){if(_0x387afe[_0x363e('0x32')]===_0x363e('0x33')){_0x387afe[_0x363e('0x89')]=_0x3ccd74[_0x363e('0x35')][_0x363e('0x89')];delete _0x387afe[_0x363e('0x8a')];}return _0x387afe;});})[_0x363e('0x31')](function(_0x1c13f3){return db[_0x363e('0x5a')][_0x363e('0x83')](_0x1c13f3,{'include':[{'model':db[_0x363e('0x73')],'as':_0x363e('0x73')}]});})[_0x363e('0x31')](function(_0x4a2130){if(_0x3ccd74[_0x363e('0x61')][_0x363e('0x32')]==='user')return _0x4a2130;if(_0x3ccd74[_0x363e('0x35')][_0x363e('0x32')]!==_0x363e('0x35'))return _0x4a2130;return db['UserProfileSection']['find']({'where':{'name':_0x4a2130['role']===_0x363e('0x84')?_0x363e('0x36'):_0x363e('0x37'),'userProfileId':_0x3ccd74[_0x363e('0x35')][_0x363e('0x8a')]},'raw':!![]})[_0x363e('0x31')](function(_0x155d20){if(!_0x155d20||_0x155d20[_0x363e('0x8b')]!=0x0)return _0x4a2130;return db[_0x363e('0x3e')]['create']({'name':_0x4a2130['name'],'resourceId':_0x4a2130['id'],'type':_0x155d20[_0x363e('0x3d')],'sectionId':_0x155d20['id']},{})[_0x363e('0x31')](function(){return _0x4a2130;});})[_0x363e('0x24')](function(_0x498e4a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x498e4a);throw _0x498e4a;});})[_0x363e('0x31')](respondWithResult(_0x29c765,0xc9))[_0x363e('0x24')](handleError(_0x29c765,null));};exports['bulkCreate']=function(_0x13defe,_0x5db113){var _0x3d408e=_0x13defe['body'];var _0x1b3d25=[];if(_0x13defe['user'][_0x363e('0x32')]==='agent')throw new Error(_0x363e('0x85'));if(_['some'](_0x3d408e,[_0x363e('0x32'),_0x363e('0x35')])&&_0x13defe[_0x363e('0x35')][_0x363e('0x32')]!==_0x363e('0x33')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x363e('0x8c')](_0x3d408e,[_0x363e('0x32'),_0x363e('0x33')])&&_0x13defe[_0x363e('0x35')][_0x363e('0x32')]!==_0x363e('0x33')){throw new Error(_0x363e('0x8d'));}return licenseUtil[_0x363e('0x88')](_0x3d408e)[_0x363e('0x31')](function(){return validateUser(_0x3d408e[0x0]);})[_0x363e('0x31')](function(){for(var _0x21f37b=0x1;_0x21f37b<_0x3d408e['length'];_0x21f37b++){var _0xf52c22=_0x3d408e[_0x21f37b-0x1]['internal'];if(!_0x3d408e[_0x21f37b][_0x363e('0x66')])_0x3d408e[_0x21f37b][_0x363e('0x66')]=_0xf52c22+0x1;_0x1b3d25[_0x363e('0x8e')](validateUser(_0x3d408e[_0x21f37b]));}return BPromise['all'](_0x1b3d25);})[_0x363e('0x31')](function(){_0x1b3d25=[];for(var _0x3cb732=0x0;_0x3cb732<_0x3d408e['length'];_0x3cb732++){_0x1b3d25[_0x363e('0x8e')](updateUser(_0x3d408e[_0x3cb732]));}return BPromise['all'](_0x1b3d25);})[_0x363e('0x31')](function(){return BPromise[_0x363e('0x8f')](_0x3d408e,function(_0x51c99d){return db[_0x363e('0x5a')]['create'](_0x51c99d,{'include':[{'model':db[_0x363e('0x73')],'as':_0x363e('0x73')}]})[_0x363e('0x31')](function(_0x45724c){_0x51c99d['id']=_0x45724c['id'];return _0x51c99d;});});})[_0x363e('0x31')](function(_0x3e6ae5){if(_0x13defe[_0x363e('0x61')]['role']===_0x363e('0x35'))return _0x3e6ae5;if(_0x13defe['user'][_0x363e('0x32')]!==_0x363e('0x35'))return _0x3e6ae5;var _0x5d57fd=_[_0x363e('0x8c')](_0x3e6ae5,function(_0x281517){return _0x281517[_0x363e('0x32')]===_0x363e('0x84')||_0x281517[_0x363e('0x32')]==='telephone';});if(!_0x5d57fd)return _0x3e6ae5;return db[_0x363e('0x90')][_0x363e('0x5c')]({'where':{'name':{'$or':[_0x363e('0x36'),'Telephones']},'userProfileId':_0x13defe[_0x363e('0x35')]['userProfileId']},'raw':!![]})[_0x363e('0x31')](function(_0x189b68){if(_[_0x363e('0x91')](_0x189b68)||!_[_0x363e('0x8c')](_0x189b68,['autoAssociation',0x0]))return _0x3e6ae5;_0x1b3d25=[];var _0x3cfe0c=_(_0x189b68)[_0x363e('0x39')](function(_0x8a78ba){if(_0x8a78ba[_0x363e('0x8b')]===0x1)return;return _0x8a78ba[_0x363e('0x3d')]===_0x363e('0x36')?_0x363e('0x84'):_0x363e('0x92');})['compact']()[_0x363e('0x3a')]();for(var _0x2cc98b=0x0;_0x2cc98b<_0x3e6ae5[_0x363e('0x50')];_0x2cc98b++){if(!_[_0x363e('0x3b')](_0x3cfe0c,_0x3e6ae5[_0x2cc98b][_0x363e('0x32')]))return;var _0x1029da=_0x3e6ae5[_0x2cc98b][_0x363e('0x32')]==='agent'?_0x363e('0x36'):'Telephones';_0x1b3d25[_0x363e('0x8e')](db[_0x363e('0x3e')]['create']({'name':_0x3e6ae5[_0x2cc98b][_0x363e('0x3d')],'resourceId':_0x3e6ae5[_0x2cc98b]['id'],'type':_0x1029da,'sectionId':_[_0x363e('0x3c')](_0x189b68,[_0x363e('0x3d'),_0x1029da])['id']},{}));}return BPromise[_0x363e('0x93')](_0x1b3d25);})['then'](respondWithResult(_0x5db113,0xc9))[_0x363e('0x24')](handleError(_0x5db113,null));});};exports['changePassword']=function(_0x511394,_0xbceacd,_0x7e5d25){if(_0x511394[_0x363e('0x61')]['id']){delete _0x511394[_0x363e('0x61')]['id'];}return db[_0x363e('0x5a')][_0x363e('0x3c')]({'where':{'id':_0x511394[_0x363e('0x5e')]['id']}})['then'](function(_0x4c5241){if(!_0x4c5241)return null;if(_0x4c5241['id']===_0x511394[_0x363e('0x35')]['id']){if(!_0x511394[_0x363e('0x61')][_0x363e('0x94')]||!_0x511394['body'][_0x363e('0x95')]){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))](_0x363e('0x98'));}if(!_0x4c5241[_0x363e('0x99')](_0x511394[_0x363e('0x61')][_0x363e('0x94')])){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))]('Wrong\x20credentials');}if(_0x511394[_0x363e('0x61')][_0x363e('0x94')]===_0x511394[_0x363e('0x61')][_0x363e('0x95')]){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))](_0x363e('0x9a'));}}else if(_0x511394[_0x363e('0x35')]['role']===_0x363e('0x33')){if(!_0x511394['body'][_0x363e('0x95')]){throw new db['Sequelize']['ValidationError'](_0x363e('0x9b'));}}else if(_0x511394[_0x363e('0x35')][_0x363e('0x32')]===_0x363e('0x35')){if(!_0x511394[_0x363e('0x61')][_0x363e('0x95')]){throw new db[(_0x363e('0x96'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x4c5241[_0x363e('0x32')]!==_0x363e('0x84')){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))](_0x363e('0x85'));}}else{throw new db[(_0x363e('0x96'))]['ValidationError'](_0x363e('0x85'));}return _0x4c5241;})[_0x363e('0x31')](handleEntityNotFound(_0xbceacd,null))[_0x363e('0x31')](function(_0x11f437){return db[_0x363e('0x67')]['findOne']({'attributes':['id','securePassword',_0x363e('0x9c'),_0x363e('0x9d')]})[_0x363e('0x31')](function(_0x55bdb4){if(_0x55bdb4[_0x363e('0x68')])authService[_0x363e('0x69')](_0x511394[_0x363e('0x61')][_0x363e('0x95')]);if(!_0x55bdb4[_0x363e('0x9c')]||!_0x11f437[_0x363e('0x9e')])return _0x11f437;authService['validatePasswordHistory'](_0x511394[_0x363e('0x61')][_0x363e('0x95')],_0x11f437['previousPasswords'],_0x55bdb4[_0x363e('0x9d')]);return _0x11f437;})['then'](saveUpdates({'password':_0x511394['body'][_0x363e('0x95')],'passwordResetAt':_0x511394[_0x363e('0x35')]['id']==_0x511394['params']['id']?moment():null,'previousPasswords':authService[_0x363e('0x9f')](_0x511394['body'][_0x363e('0x95')],_0x11f437[_0x363e('0x9e')])},null));})['then'](respondWithResult(_0xbceacd,null))[_0x363e('0x24')](handleError(_0xbceacd,null));};exports[_0x363e('0xa0')]=function(_0x1e419c,_0x39488d,_0x2b3b2b){var _0x4507d7=_0x1e419c[_0x363e('0x61')][_0x363e('0xa1')];return db[_0x363e('0x5a')][_0x363e('0x3c')]({'where':{'id':_0x1e419c[_0x363e('0x5e')]['id']},'attributes':['id',_0x363e('0x3d'),'role',_0x363e('0xa2'),_0x363e('0xa3'),_0x363e('0xa4'),_0x363e('0xa5')]})['then'](handleEntityNotFound(_0x39488d,null))['then'](function(_0x5c2ac7){if(_0x5c2ac7){if(!utils[_0x363e('0xa6')](_0x4507d7)){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))](_0x363e('0xa7'));}return _0x5c2ac7[_0x363e('0xa8')+_[_0x363e('0xa9')](_0x4507d7[_0x363e('0xaa')]())+_0x363e('0xab')](_0x1e419c[_0x363e('0x61')][_0x363e('0x64')],{'penalty':_0x1e419c[_0x363e('0x61')][_0x363e('0xac')]||0x0})['spread'](function(_0x18168e){for(var _0x24638f=0x0;_0x24638f<_0x1e419c['body'][_0x363e('0x64')][_0x363e('0x50')];_0x24638f+=0x1){var _0x33d982={'UserId':_0x1e419c['params']['id']};_0x33d982[_[_0x363e('0xa9')](_0x4507d7['toLowerCase']())+_0x363e('0xad')]=_0x1e419c['body'][_0x363e('0x64')][_0x24638f];socket[_0x363e('0xae')](_0x363e('0x35')+_[_0x363e('0xa9')](_0x4507d7[_0x363e('0xaa')]())+'Queue:save',_0x33d982);}return _0x18168e;})['then'](function(){if(_0x4507d7==='voice'){return db[_0x363e('0xaf')][_0x363e('0x5c')]({'where':{'id':_0x1e419c[_0x363e('0x61')]['ids']||[]},'raw':!![],'attributes':['id',_0x363e('0x3d')]});}})['then'](function(_0x4340d1){var _0x424929=_0x5c2ac7['get']({'plain':!![]});var _0x2041cb=[];if(_0x4507d7===_0x363e('0xb0')&&_0x424929['role']==='agent'&&_0x424929['online']){for(var _0x522e9b=0x0;_0x522e9b<_0x4340d1[_0x363e('0x50')];_0x522e9b+=0x1){_0x2041cb[_0x363e('0x8e')]({'membername':_0x424929[_0x363e('0x3d')],'UserId':_0x424929['id'],'queue_name':_0x4340d1[_0x522e9b][_0x363e('0x3d')],'VoiceQueueId':_0x4340d1[_0x522e9b]['id'],'interface':_[_0x363e('0x6b')](_0x424929[_0x363e('0xa5')])?util[_0x363e('0xb1')]('SIP/%s',_0x424929[_0x363e('0x3d')]):_0x424929[_0x363e('0xa5')],'paused':_0x424929[_0x363e('0xa4')]||![],'penalty':_0x1e419c[_0x363e('0x61')]['penalty']||0x0});}return BPromise[_0x363e('0x8f')](_0x2041cb,function(_0x387170){return db[_0x363e('0xb2')][_0x363e('0xb3')](_0x387170);});}return _0x5c2ac7;});}})[_0x363e('0x31')](respondWithStatusCode(_0x39488d,null))[_0x363e('0x24')](handleError(_0x39488d,null));};exports[_0x363e('0xb4')]=function(_0x13fd90,_0x205466,_0xf50479){var _0x25313f;return db[_0x363e('0x5a')][_0x363e('0x3c')]({'where':{'id':_0x13fd90['params']['id']},'attributes':['id',_0x363e('0x3d'),'role']})[_0x363e('0x31')](handleEntityNotFound(_0x205466,null))['then'](function(_0x508762){if(_0x508762){_0x25313f=_0x508762;if(!_0x13fd90[_0x363e('0x4b')][_0x363e('0xa1')]||!utils[_0x363e('0xa6')](_0x13fd90[_0x363e('0x4b')][_0x363e('0xa1')])){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))](_0x363e('0xa7'));}return _0x508762[_0x363e('0xb5')+_[_0x363e('0xa9')](_0x13fd90[_0x363e('0x4b')][_0x363e('0xa1')][_0x363e('0xaa')]())+'Queues'](_0x13fd90[_0x363e('0x4b')]['ids']);}})[_0x363e('0x31')](function(_0x24ccac){for(var _0x55431d=0x0;_0x55431d<_0x13fd90[_0x363e('0x4b')]['ids'][_0x363e('0x50')];_0x55431d+=0x1){var _0x34e278={'UserId':_0x13fd90[_0x363e('0x5e')]['id']};_0x34e278[_[_0x363e('0xa9')](_0x13fd90['query'][_0x363e('0xa1')][_0x363e('0xaa')]())+'QueueId']=_0x13fd90['query'][_0x363e('0x64')][_0x55431d];socket['emit'](_0x363e('0x35')+_[_0x363e('0xa9')](_0x13fd90[_0x363e('0x4b')][_0x363e('0xa1')]['toLowerCase']())+_0x363e('0xb6'),_0x34e278);}return _0x24ccac;})['then'](function(){if(_0x13fd90[_0x363e('0x4b')][_0x363e('0xa1')]===_0x363e('0xb0')){return db[_0x363e('0xb2')][_0x363e('0x3f')]({'where':{'UserId':_0x13fd90['params']['id'],'VoiceQueueId':_0x13fd90[_0x363e('0x4b')][_0x363e('0x64')]},'individualHooks':!![]})[_0x363e('0x31')](function(){return _0x25313f;});}return _0x25313f;})[_0x363e('0x31')](respondWithStatusCode(_0x205466,null))[_0x363e('0x24')](handleError(_0x205466,null));};exports['addAvatar']=function(_0x3c7b50,_0x20236b,_0x577262){_0x3c7b50[_0x363e('0x61')]['userpic']=_0x3c7b50[_0x363e('0xb7')]['filename'];return db['User'][_0x363e('0x3c')]({'where':{'id':_0x3c7b50['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x20236b,null))[_0x363e('0x31')](saveUpdates(_0x3c7b50[_0x363e('0x61')],null))[_0x363e('0x31')](respondWithResult(_0x20236b,null))['catch'](handleError(_0x20236b,null));};exports[_0x363e('0xb8')]=function(_0x4f7384,_0x3c245b,_0x25eda7){var _0x2f6184=path[_0x363e('0xb9')](config['root'],_0x363e('0xba'));return db['User'][_0x363e('0x3c')]({'where':{'id':_0x4f7384[_0x363e('0x5e')]['id']},'attributes':['id',_0x363e('0xbb')],'raw':!![]})['then'](handleEntityNotFound(_0x3c245b,null))[_0x363e('0x31')](function(_0x542c3a){if(_0x542c3a){if(_['isNil'](_0x542c3a[_0x363e('0xbb')])){return _0x3c245b[_0x363e('0xbc')](_0x2f6184);}else{if(!fs['existsSync'](path['join'](config[_0x363e('0xbd')],_0x363e('0xbe'),_0x542c3a[_0x363e('0xbb')]))){return _0x3c245b['download'](_0x2f6184);}return _0x3c245b[_0x363e('0xbc')](path['join'](config[_0x363e('0xbd')],_0x363e('0xbe'),_0x542c3a[_0x363e('0xbb')]));}}})[_0x363e('0x24')](handleError(_0x3c245b,null));};exports[_0x363e('0xbf')]=function(_0x51f824,_0x5a9236,_0x3353f9){var _0xa08ab7={};var _0x355e3f={};var _0x3ee10b;var _0x2709f7;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x51f824['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x5a9236,null))['then'](function(_0x4bd9be){if(_0x4bd9be){_0x3ee10b=_0x4bd9be;_0x355e3f[_0x363e('0x46')]=_['keys'](db[_0x363e('0xc1')][_0x363e('0x42')]);_0x355e3f['query']=_[_0x363e('0x4a')](_0x51f824[_0x363e('0x4b')]);_0x355e3f[_0x363e('0x4c')]=_['intersection'](_0x355e3f[_0x363e('0x46')],_0x355e3f[_0x363e('0x4b')]);_0xa08ab7[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x355e3f[_0x363e('0x46')],qs['fields'](_0x51f824[_0x363e('0x4b')][_0x363e('0x4e')]));_0xa08ab7[_0x363e('0x4f')]=_0xa08ab7[_0x363e('0x4f')]['length']?_0xa08ab7[_0x363e('0x4f')]:_0x355e3f[_0x363e('0x46')];_0xa08ab7[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x51f824['query'][_0x363e('0x53')]);_0xa08ab7[_0x363e('0x54')]=qs['filters'](_[_0x363e('0x55')](_0x51f824[_0x363e('0x4b')],_0x355e3f[_0x363e('0x4c')]));if(_0x51f824[_0x363e('0x4b')][_0x363e('0x38')]){_0xa08ab7[_0x363e('0x54')]=_[_0x363e('0x56')](_0xa08ab7['where'],{'$or':_[_0x363e('0x39')](_0xa08ab7[_0x363e('0x4f')],function(_0x9c8a55){var _0x8c8e44={};_0x8c8e44[_0x9c8a55]={'$like':'%'+_0x51f824[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x8c8e44;})});}_0xa08ab7=_[_0x363e('0x56')]({},_0xa08ab7,_0x51f824[_0x363e('0x60')]);return _0x3ee10b[_0x363e('0xbf')](_0xa08ab7);}})[_0x363e('0x31')](function(_0x480322){if(_0x480322){_0x2709f7=_0x480322[_0x363e('0x50')];if(_0x51f824[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x5f'))){_0xa08ab7['include']=[{'model':db[_0x363e('0xc3')],'as':'List','required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x363e('0x3d'),_0x363e('0xc4')],'where':_0x51f824[_0x363e('0x4b')][_0x363e('0xc5')]?{'id':_0x51f824[_0x363e('0x4b')][_0x363e('0xc5')]}:undefined,'required':_0x51f824['query'][_0x363e('0xc5')]?!![]:![]}];}if(!_0x51f824[_0x363e('0x4b')][_0x363e('0xc2')]('nolimit')){_0xa08ab7[_0x363e('0x2b')]=qs[_0x363e('0x2b')](_0x51f824['query']['limit']);_0xa08ab7[_0x363e('0x2a')]=qs[_0x363e('0x2a')](_0x51f824[_0x363e('0x4b')][_0x363e('0x2a')]);}return _0x3ee10b[_0x363e('0xbf')](_0xa08ab7);}})['then'](function(_0x2209e8){if(_0x2209e8){return _0x2209e8?{'count':_0x2709f7,'rows':_0x2209e8}:null;}})[_0x363e('0x31')](respondWithResult(_0x5a9236,null))[_0x363e('0x24')](handleError(_0x5a9236,null));};exports[_0x363e('0xc6')]=function(_0x241be2,_0x350589,_0x48e5ff){var _0x501c37;var _0x4efaed;var _0x464a7c={};var _0x24d03c;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x241be2['params']['id']},'attributes':['id',_0x363e('0x3d'),_0x363e('0x32')]})[_0x363e('0x31')](handleEntityNotFound(_0x350589,null))['then'](function(_0x266927){if(!utils['isValidChannel'](_0x241be2[_0x363e('0x4b')][_0x363e('0xa1')])){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))](_0x363e('0xa7'));}_0x501c37=_0x266927;var _0x12baff={};_0x12baff[_0x363e('0x46')]=_['keys'](db[_[_0x363e('0xa9')](_0x241be2['query'][_0x363e('0xa1')])+_0x363e('0xc7')][_0x363e('0x42')]);_0x12baff[_0x363e('0x4b')]=_['keys'](_0x241be2[_0x363e('0x4b')]);_0x12baff[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x12baff['model'],_0x12baff[_0x363e('0x4b')]);_0x464a7c[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x12baff[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x241be2[_0x363e('0x4b')][_0x363e('0x4e')]));_0x464a7c[_0x363e('0x4f')]=_0x464a7c[_0x363e('0x4f')][_0x363e('0x50')]?_0x464a7c[_0x363e('0x4f')]:_0x12baff['model'];_0x464a7c[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x241be2[_0x363e('0x4b')][_0x363e('0x53')]);_0x464a7c[_0x363e('0x54')]=qs[_0x363e('0x4c')](_[_0x363e('0x55')](_0x241be2[_0x363e('0x4b')],_0x12baff[_0x363e('0x4c')]));if(_0x241be2[_0x363e('0x4b')]['filter']){_0x464a7c[_0x363e('0x54')]=_['merge'](_0x464a7c[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x464a7c['attributes'],function(_0x2a63bd){var _0x3b53b7={};_0x3b53b7[_0x2a63bd]={'$like':'%'+_0x241be2[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x3b53b7;})});}_0x464a7c=_[_0x363e('0x56')]({},_0x464a7c,_0x241be2[_0x363e('0x60')]);switch(_0x501c37[_0x363e('0x32')]){case _0x363e('0x33'):return db[_[_0x363e('0xa9')](_0x241be2[_0x363e('0x4b')][_0x363e('0xa1')])+_0x363e('0xc7')][_0x363e('0x5c')](_0x464a7c);case _0x363e('0x35'):case'agent':return _0x501c37[_0x363e('0xc8')+_[_0x363e('0xa9')](_0x241be2[_0x363e('0x4b')][_0x363e('0xa1')])+_0x363e('0xab')](_0x464a7c);default:throw new db['Sequelize']['ValidationError'](_0x363e('0xc9'));}})[_0x363e('0x31')](function(_0x55bdaf){_0x24d03c=_0x55bdaf[_0x363e('0x50')];if(!_0x241be2[_0x363e('0x4b')]['hasOwnProperty'](_0x363e('0x51'))){_0x464a7c[_0x363e('0x2b')]=qs['limit'](_0x241be2[_0x363e('0x4b')][_0x363e('0x2b')]);_0x464a7c[_0x363e('0x2a')]=qs['offset'](_0x241be2[_0x363e('0x4b')]['offset']);}switch(_0x501c37['role']){case _0x363e('0x33'):return db[_[_0x363e('0xa9')](_0x241be2[_0x363e('0x4b')]['channel'])+_0x363e('0xc7')][_0x363e('0x5c')](_0x464a7c);case _0x363e('0x35'):case _0x363e('0x84'):return _0x501c37[_0x363e('0xc8')+_['capitalize'](_0x241be2[_0x363e('0x4b')][_0x363e('0xa1')])+_0x363e('0xab')](_0x464a7c);}})[_0x363e('0x31')](function(_0x43eedf){return{'count':_0x24d03c,'rows':_0x43eedf};})[_0x363e('0x31')](respondWithResult(_0x350589,null))[_0x363e('0x24')](handleError(_0x350589,null));};exports['getVoiceQueuesRt']=function(_0x54cdc4,_0x2f485e,_0xc08a1c){var _0x18847f={};var _0x33c8e5={};var _0x2a322e;var _0x233803;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x54cdc4['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x2f485e,null))[_0x363e('0x31')](function(_0x4de3bb){if(_0x4de3bb){_0x2a322e=_0x4de3bb;_0x33c8e5['model']=_[_0x363e('0x4a')](db[_0x363e('0xb2')]['rawAttributes']);_0x33c8e5[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x54cdc4[_0x363e('0x4b')]);_0x33c8e5[_0x363e('0x4c')]=_['intersection'](_0x33c8e5[_0x363e('0x46')],_0x33c8e5[_0x363e('0x4b')]);_0x18847f['attributes']=_['intersection'](_0x33c8e5['model'],qs[_0x363e('0x4e')](_0x54cdc4[_0x363e('0x4b')][_0x363e('0x4e')]));_0x18847f['attributes']=_0x18847f[_0x363e('0x4f')][_0x363e('0x50')]?_0x18847f[_0x363e('0x4f')]:_0x33c8e5[_0x363e('0x46')];_0x18847f[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x54cdc4['query']['sort']);_0x18847f[_0x363e('0x54')]=qs[_0x363e('0x4c')](_['pick'](_0x54cdc4[_0x363e('0x4b')],_0x33c8e5[_0x363e('0x4c')]));if(_0x54cdc4[_0x363e('0x4b')][_0x363e('0x38')]){_0x18847f[_0x363e('0x54')]=_['merge'](_0x18847f[_0x363e('0x54')],{'$or':_['map'](_0x18847f[_0x363e('0x4f')],function(_0x554988){var _0x3e3db5={};_0x3e3db5[_0x554988]={'$like':'%'+_0x54cdc4[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x3e3db5;})});}_0x18847f=_['merge']({},_0x18847f,_0x54cdc4[_0x363e('0x60')]);return _0x2a322e['getVoiceQueuesRt'](_0x18847f);}})['then'](function(_0x2eae5d){if(_0x2eae5d){_0x233803=_0x2eae5d['length'];if(!_0x54cdc4['query'][_0x363e('0xc2')](_0x363e('0x51'))){_0x18847f[_0x363e('0x2b')]=qs[_0x363e('0x2b')](_0x54cdc4['query'][_0x363e('0x2b')]);_0x18847f[_0x363e('0x2a')]=qs[_0x363e('0x2a')](_0x54cdc4['query']['offset']);}return _0x2a322e[_0x363e('0xca')](_0x18847f);}})[_0x363e('0x31')](function(_0xb037eb){if(_0xb037eb){return _0xb037eb?{'count':_0x233803,'rows':_0xb037eb}:null;}})[_0x363e('0x31')](respondWithResult(_0x2f485e,null))[_0x363e('0x24')](handleError(_0x2f485e,null));};exports[_0x363e('0xcb')]=function(_0x839ff8,_0xe9d989,_0x211cb5){var _0x2ec27e={};var _0x333a85={};var _0xb2a3c6;var _0xf62a1;return db['User'][_0x363e('0xc0')]({'where':{'id':_0x839ff8['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0xe9d989,null))[_0x363e('0x31')](function(_0x14c1a8){if(_0x14c1a8){_0xb2a3c6=_0x14c1a8;_0x333a85['model']=_[_0x363e('0x4a')](db[_0x363e('0xcc')][_0x363e('0x42')]);_0x333a85[_0x363e('0x4b')]=_['keys'](_0x839ff8[_0x363e('0x4b')]);_0x333a85[_0x363e('0x4c')]=_['intersection'](_0x333a85['model'],_0x333a85[_0x363e('0x4b')]);_0x2ec27e[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x333a85['model'],qs['fields'](_0x839ff8['query'][_0x363e('0x4e')]));_0x2ec27e[_0x363e('0x4f')]=_0x2ec27e['attributes'][_0x363e('0x50')]?_0x2ec27e[_0x363e('0x4f')]:_0x333a85['model'];_0x2ec27e['order']=qs[_0x363e('0x53')](_0x839ff8[_0x363e('0x4b')][_0x363e('0x53')]);_0x2ec27e[_0x363e('0x54')]=qs['filters'](_[_0x363e('0x55')](_0x839ff8[_0x363e('0x4b')],_0x333a85['filters']));if(_0x839ff8[_0x363e('0x4b')][_0x363e('0x38')]){_0x2ec27e[_0x363e('0x54')]=_[_0x363e('0x56')](_0x2ec27e[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x2ec27e[_0x363e('0x4f')],function(_0x312833){var _0x32282a={};_0x32282a[_0x312833]={'$like':'%'+_0x839ff8[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x32282a;})});}_0x2ec27e=_[_0x363e('0x56')]({},_0x2ec27e,_0x839ff8[_0x363e('0x60')]);return _0xb2a3c6[_0x363e('0xcb')](_0x2ec27e);}})['then'](function(_0x31065e){if(_0x31065e){_0xf62a1=_0x31065e['length'];if(!_0x839ff8[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x2ec27e[_0x363e('0x2b')]=qs['limit'](_0x839ff8['query'][_0x363e('0x2b')]);_0x2ec27e[_0x363e('0x2a')]=qs[_0x363e('0x2a')](_0x839ff8[_0x363e('0x4b')]['offset']);}return _0xb2a3c6[_0x363e('0xcb')](_0x2ec27e);}})[_0x363e('0x31')](function(_0x3c7ef2){if(_0x3c7ef2){return _0x3c7ef2?{'count':_0xf62a1,'rows':_0x3c7ef2}:null;}})['then'](respondWithResult(_0xe9d989,null))['catch'](handleError(_0xe9d989,null));};exports[_0x363e('0xcd')]=function(_0x1be762,_0x4feb7d,_0x195e67){var _0x5b6ba5={'raw':!![],'where':{}};var _0x5f34e1={};var _0x1ce145={'count':0x0,'rows':[]};return db[_0x363e('0x5a')]['findOne']({'where':{'id':_0x1be762[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x4feb7d,null))[_0x363e('0x31')](function(_0x5f06de){if(_0x5f06de){_0x5f34e1[_0x363e('0x46')]=_[_0x363e('0x4a')](db[_0x363e('0xce')]['rawAttributes']);_0x5f34e1[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x1be762[_0x363e('0x4b')]);_0x5f34e1[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x5f34e1[_0x363e('0x46')],_0x5f34e1[_0x363e('0x4b')]);_0x5b6ba5[_0x363e('0x4f')]=_['intersection'](_0x5f34e1[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x1be762['query']['fields']));_0x5b6ba5[_0x363e('0x4f')]=_0x5b6ba5['attributes']['length']?_0x5b6ba5[_0x363e('0x4f')]:_0x5f34e1['model'];if(!_0x1be762[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x5b6ba5['limit']=qs[_0x363e('0x2b')](_0x1be762['query']['limit']);_0x5b6ba5[_0x363e('0x2a')]=qs[_0x363e('0x2a')](_0x1be762[_0x363e('0x4b')][_0x363e('0x2a')]);}_0x5b6ba5[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x1be762['query'][_0x363e('0x53')]);_0x5b6ba5['where']=qs[_0x363e('0x4c')](_[_0x363e('0x55')](_0x1be762[_0x363e('0x4b')],_0x5f34e1[_0x363e('0x4c')]));_0x5b6ba5[_0x363e('0x54')][_0x363e('0xcf')]=_0x5f06de['id'];if(_0x1be762[_0x363e('0x4b')][_0x363e('0x38')]){_0x5b6ba5[_0x363e('0x54')]=_[_0x363e('0x56')](_0x5b6ba5[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x5b6ba5[_0x363e('0x4f')],function(_0x14a642){var _0x15e261={};_0x15e261[_0x14a642]={'$like':'%'+_0x1be762['query']['filter']+'%'};return _0x15e261;})});}_0x5b6ba5=_['merge']({},_0x5b6ba5,_0x1be762[_0x363e('0x60')]);return db[_0x363e('0xce')]['count']({'where':_0x5b6ba5[_0x363e('0x54')]})[_0x363e('0x31')](function(_0x2d190d){_0x1ce145['count']=_0x2d190d;if(_0x1be762[_0x363e('0x4b')][_0x363e('0x5f')]){_0x5b6ba5['include']=[{'all':!![]}];}return db[_0x363e('0xce')][_0x363e('0x5c')](_0x5b6ba5);})[_0x363e('0x31')](function(_0x18fa51){_0x1ce145['rows']=_0x18fa51;return _0x1ce145;});}})['then'](respondWithFilteredResult(_0x4feb7d,_0x5b6ba5))[_0x363e('0x24')](handleError(_0x4feb7d,null));};exports[_0x363e('0xd0')]=function(_0x244fbb,_0x485a69,_0x4d1ffd){var _0x11316d={'raw':!![],'where':{}};var _0x4d57c2={};var _0x3cf326={'count':0x0,'rows':[]};return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x244fbb[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x485a69,null))[_0x363e('0x31')](function(_0x25371a){if(_0x25371a){_0x4d57c2[_0x363e('0x46')]=_[_0x363e('0x4a')](db[_0x363e('0xd1')][_0x363e('0x42')]);_0x4d57c2[_0x363e('0x4b')]=_['keys'](_0x244fbb[_0x363e('0x4b')]);_0x4d57c2[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x4d57c2['model'],_0x4d57c2[_0x363e('0x4b')]);_0x11316d[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x4d57c2[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x244fbb[_0x363e('0x4b')]['fields']));_0x11316d[_0x363e('0x4f')]=_0x11316d[_0x363e('0x4f')][_0x363e('0x50')]?_0x11316d[_0x363e('0x4f')]:_0x4d57c2[_0x363e('0x46')];if(!_0x244fbb[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x11316d[_0x363e('0x2b')]=qs[_0x363e('0x2b')](_0x244fbb[_0x363e('0x4b')][_0x363e('0x2b')]);_0x11316d[_0x363e('0x2a')]=qs['offset'](_0x244fbb[_0x363e('0x4b')][_0x363e('0x2a')]);}_0x11316d[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x244fbb[_0x363e('0x4b')]['sort']);_0x11316d[_0x363e('0x54')]=qs[_0x363e('0x4c')](_[_0x363e('0x55')](_0x244fbb['query'],_0x4d57c2[_0x363e('0x4c')]));_0x11316d[_0x363e('0x54')][_0x363e('0xcf')]=_0x25371a['id'];if(_0x244fbb[_0x363e('0x4b')][_0x363e('0x38')]){_0x11316d['where']=_[_0x363e('0x56')](_0x11316d[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x11316d[_0x363e('0x4f')],function(_0x18efeb){var _0x2f25b6={};_0x2f25b6[_0x18efeb]={'$like':'%'+_0x244fbb['query'][_0x363e('0x38')]+'%'};return _0x2f25b6;})});}_0x11316d=_['merge']({},_0x11316d,_0x244fbb[_0x363e('0x60')]);return db[_0x363e('0xd1')][_0x363e('0x29')]({'where':_0x11316d[_0x363e('0x54')]})[_0x363e('0x31')](function(_0x5a5565){_0x3cf326[_0x363e('0x29')]=_0x5a5565;if(_0x244fbb[_0x363e('0x4b')][_0x363e('0x5f')]){_0x11316d['include']=[{'all':!![]}];}return db[_0x363e('0xd1')][_0x363e('0x5c')](_0x11316d);})[_0x363e('0x31')](function(_0x377a90){_0x3cf326['rows']=_0x377a90;return _0x3cf326;});}})[_0x363e('0x31')](respondWithFilteredResult(_0x485a69,_0x11316d))[_0x363e('0x24')](handleError(_0x485a69,null));};exports[_0x363e('0xd2')]=function(_0x288c54,_0x428f28,_0x9fd7bd){var _0x57ba96={};var _0x2be95c={};var _0x94e270;var _0x5cf399;return db[_0x363e('0x5a')]['findOne']({'where':{'id':_0x288c54['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x428f28,null))[_0x363e('0x31')](function(_0x2977b3){if(_0x2977b3){_0x94e270=_0x2977b3;_0x2be95c[_0x363e('0x46')]=_[_0x363e('0x4a')](db[_0x363e('0xd3')]['rawAttributes']);_0x2be95c[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x288c54['query']);_0x2be95c[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x2be95c[_0x363e('0x46')],_0x2be95c['query']);_0x57ba96[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x2be95c['model'],qs[_0x363e('0x4e')](_0x288c54['query'][_0x363e('0x4e')]));_0x57ba96[_0x363e('0x4f')]=_0x57ba96['attributes'][_0x363e('0x50')]?_0x57ba96[_0x363e('0x4f')]:_0x2be95c['model'];_0x57ba96[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x288c54[_0x363e('0x4b')][_0x363e('0x53')]);_0x57ba96['where']=qs[_0x363e('0x4c')](_[_0x363e('0x55')](_0x288c54['query'],_0x2be95c['filters']));if(_0x288c54['query'][_0x363e('0x38')]){_0x57ba96[_0x363e('0x54')]=_[_0x363e('0x56')](_0x57ba96['where'],{'$or':_[_0x363e('0x39')](_0x57ba96[_0x363e('0x4f')],function(_0x1b388e){var _0x3f3bc6={};_0x3f3bc6[_0x1b388e]={'$like':'%'+_0x288c54[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x3f3bc6;})});}_0x57ba96=_[_0x363e('0x56')]({},_0x57ba96,_0x288c54['options']);return _0x94e270[_0x363e('0xd2')](_0x57ba96);}})['then'](function(_0x3388de){if(_0x3388de){_0x5cf399=_0x3388de['length'];if(!_0x288c54[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x57ba96[_0x363e('0x2b')]=qs[_0x363e('0x2b')](_0x288c54[_0x363e('0x4b')][_0x363e('0x2b')]);_0x57ba96[_0x363e('0x2a')]=qs[_0x363e('0x2a')](_0x288c54[_0x363e('0x4b')][_0x363e('0x2a')]);}return _0x94e270[_0x363e('0xd2')](_0x57ba96);}})[_0x363e('0x31')](function(_0x3a7873){if(_0x3a7873){return _0x3a7873?{'count':_0x5cf399,'rows':_0x3a7873}:null;}})['then'](respondWithResult(_0x428f28,null))['catch'](handleError(_0x428f28,null));};exports[_0x363e('0xd4')]=function(_0x3fb7b5,_0x5b3b0c,_0x411124){var _0x19a85c={};var _0x488426={};var _0x1f57f1;var _0x21ef50;return db['User'][_0x363e('0xc0')]({'where':{'id':_0x3fb7b5['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x5b3b0c,null))[_0x363e('0x31')](function(_0x2331bf){if(_0x2331bf){_0x1f57f1=_0x2331bf;_0x488426[_0x363e('0x46')]=_[_0x363e('0x4a')](db['OpenchannelInteraction'][_0x363e('0x42')]);_0x488426[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x3fb7b5[_0x363e('0x4b')]);_0x488426[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x488426[_0x363e('0x46')],_0x488426['query']);_0x19a85c[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x488426[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x3fb7b5[_0x363e('0x4b')][_0x363e('0x4e')]));_0x19a85c[_0x363e('0x4f')]=_0x19a85c['attributes'][_0x363e('0x50')]?_0x19a85c[_0x363e('0x4f')]:_0x488426[_0x363e('0x46')];_0x19a85c['order']=qs[_0x363e('0x53')](_0x3fb7b5[_0x363e('0x4b')][_0x363e('0x53')]);_0x19a85c['where']=qs['filters'](_[_0x363e('0x55')](_0x3fb7b5[_0x363e('0x4b')],_0x488426[_0x363e('0x4c')]));if(_0x3fb7b5[_0x363e('0x4b')][_0x363e('0x38')]){_0x19a85c[_0x363e('0x54')]=_[_0x363e('0x56')](_0x19a85c[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x19a85c[_0x363e('0x4f')],function(_0x20b615){var _0x3d3184={};_0x3d3184[_0x20b615]={'$like':'%'+_0x3fb7b5[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x3d3184;})});}_0x19a85c=_[_0x363e('0x56')]({},_0x19a85c,_0x3fb7b5[_0x363e('0x60')]);return _0x1f57f1[_0x363e('0xd4')](_0x19a85c);}})[_0x363e('0x31')](function(_0x25a7f9){if(_0x25a7f9){_0x21ef50=_0x25a7f9[_0x363e('0x50')];if(!_0x3fb7b5[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x19a85c[_0x363e('0x2b')]=qs['limit'](_0x3fb7b5['query'][_0x363e('0x2b')]);_0x19a85c[_0x363e('0x2a')]=qs[_0x363e('0x2a')](_0x3fb7b5['query'][_0x363e('0x2a')]);}return _0x1f57f1[_0x363e('0xd4')](_0x19a85c);}})['then'](function(_0x518785){if(_0x518785){return _0x518785?{'count':_0x21ef50,'rows':_0x518785}:null;}})[_0x363e('0x31')](respondWithResult(_0x5b3b0c,null))[_0x363e('0x24')](handleError(_0x5b3b0c,null));};exports[_0x363e('0xd5')]=function(_0x578e4a,_0x3da394,_0x55a13f){var _0x408e15={'raw':!![],'where':{}};var _0x33cd1c={};var _0x7e363e={'count':0x0,'rows':[]};return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x578e4a[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x3da394,null))['then'](function(_0x261bfb){if(_0x261bfb){_0x33cd1c[_0x363e('0x46')]=_['keys'](db[_0x363e('0xd6')][_0x363e('0x42')]);_0x33cd1c[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x578e4a[_0x363e('0x4b')]);_0x33cd1c[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x33cd1c[_0x363e('0x46')],_0x33cd1c['query']);_0x408e15[_0x363e('0x4f')]=_['intersection'](_0x33cd1c['model'],qs[_0x363e('0x4e')](_0x578e4a[_0x363e('0x4b')]['fields']));_0x408e15[_0x363e('0x4f')]=_0x408e15[_0x363e('0x4f')][_0x363e('0x50')]?_0x408e15[_0x363e('0x4f')]:_0x33cd1c[_0x363e('0x46')];if(!_0x578e4a[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x408e15[_0x363e('0x2b')]=qs[_0x363e('0x2b')](_0x578e4a[_0x363e('0x4b')][_0x363e('0x2b')]);_0x408e15[_0x363e('0x2a')]=qs['offset'](_0x578e4a[_0x363e('0x4b')][_0x363e('0x2a')]);}_0x408e15[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x578e4a[_0x363e('0x4b')][_0x363e('0x53')]);_0x408e15[_0x363e('0x54')]=qs[_0x363e('0x4c')](_['pick'](_0x578e4a[_0x363e('0x4b')],_0x33cd1c[_0x363e('0x4c')]));_0x408e15[_0x363e('0x54')][_0x363e('0xcf')]=_0x261bfb['id'];if(_0x578e4a['query'][_0x363e('0x38')]){_0x408e15[_0x363e('0x54')]=_[_0x363e('0x56')](_0x408e15[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x408e15[_0x363e('0x4f')],function(_0x59efca){var _0x6e9b16={};_0x6e9b16[_0x59efca]={'$like':'%'+_0x578e4a[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x6e9b16;})});}_0x408e15=_['merge']({},_0x408e15,_0x578e4a[_0x363e('0x60')]);return db[_0x363e('0xd6')][_0x363e('0x29')]({'where':_0x408e15[_0x363e('0x54')]})[_0x363e('0x31')](function(_0x4997ff){_0x7e363e[_0x363e('0x29')]=_0x4997ff;if(_0x578e4a[_0x363e('0x4b')]['includeAll']){_0x408e15['include']=[{'all':!![]}];}return db[_0x363e('0xd6')]['findAll'](_0x408e15);})[_0x363e('0x31')](function(_0x3af24a){_0x7e363e[_0x363e('0x5d')]=_0x3af24a;return _0x7e363e;});}})[_0x363e('0x31')](respondWithFilteredResult(_0x3da394,_0x408e15))['catch'](handleError(_0x3da394,null));};exports[_0x363e('0xd7')]=function(_0x5c723b,_0x1b08ab,_0x2c089d){var _0x5c8923={};var _0x590c96={};var _0x56fe39;var _0x5eee97;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x5c723b[_0x363e('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1b08ab,null))[_0x363e('0x31')](function(_0x5ce676){if(_0x5ce676){_0x56fe39=_0x5ce676;_0x590c96[_0x363e('0x46')]=_['keys'](db[_0x363e('0xd8')][_0x363e('0x42')]);_0x590c96[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x5c723b[_0x363e('0x4b')]);_0x590c96[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x590c96['model'],_0x590c96['query']);_0x5c8923[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x590c96[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x5c723b[_0x363e('0x4b')][_0x363e('0x4e')]));_0x5c8923[_0x363e('0x4f')]=_0x5c8923[_0x363e('0x4f')][_0x363e('0x50')]?_0x5c8923[_0x363e('0x4f')]:_0x590c96[_0x363e('0x46')];_0x5c8923['order']=qs[_0x363e('0x53')](_0x5c723b[_0x363e('0x4b')][_0x363e('0x53')]);_0x5c8923[_0x363e('0x54')]=qs[_0x363e('0x4c')](_[_0x363e('0x55')](_0x5c723b[_0x363e('0x4b')],_0x590c96[_0x363e('0x4c')]));if(_0x5c723b['query'][_0x363e('0x38')]){_0x5c8923['where']=_[_0x363e('0x56')](_0x5c8923[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x5c8923[_0x363e('0x4f')],function(_0x4ecf8f){var _0x2fb1c9={};_0x2fb1c9[_0x4ecf8f]={'$like':'%'+_0x5c723b[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x2fb1c9;})});}_0x5c8923=_[_0x363e('0x56')]({},_0x5c8923,_0x5c723b[_0x363e('0x60')]);return _0x56fe39['getSmsInteractions'](_0x5c8923);}})[_0x363e('0x31')](function(_0x5c9611){if(_0x5c9611){_0x5eee97=_0x5c9611['length'];if(!_0x5c723b[_0x363e('0x4b')][_0x363e('0xc2')]('nolimit')){_0x5c8923[_0x363e('0x2b')]=qs['limit'](_0x5c723b[_0x363e('0x4b')]['limit']);_0x5c8923['offset']=qs[_0x363e('0x2a')](_0x5c723b[_0x363e('0x4b')]['offset']);}return _0x56fe39[_0x363e('0xd7')](_0x5c8923);}})['then'](function(_0x62ff7e){if(_0x62ff7e){return _0x62ff7e?{'count':_0x5eee97,'rows':_0x62ff7e}:null;}})[_0x363e('0x31')](respondWithResult(_0x1b08ab,null))[_0x363e('0x24')](handleError(_0x1b08ab,null));};exports['getFaxInteractions']=function(_0x797a71,_0x2ef0ec,_0x1effb2){var _0x12030a={};var _0x2e7e6b={};var _0x244865;var _0x19fb19;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x797a71[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x2ef0ec,null))['then'](function(_0x4cf746){if(_0x4cf746){_0x244865=_0x4cf746;_0x2e7e6b[_0x363e('0x46')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x2e7e6b[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x797a71[_0x363e('0x4b')]);_0x2e7e6b[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x2e7e6b[_0x363e('0x46')],_0x2e7e6b[_0x363e('0x4b')]);_0x12030a[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x2e7e6b[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x797a71[_0x363e('0x4b')][_0x363e('0x4e')]));_0x12030a[_0x363e('0x4f')]=_0x12030a[_0x363e('0x4f')][_0x363e('0x50')]?_0x12030a[_0x363e('0x4f')]:_0x2e7e6b[_0x363e('0x46')];_0x12030a['order']=qs[_0x363e('0x53')](_0x797a71[_0x363e('0x4b')][_0x363e('0x53')]);_0x12030a[_0x363e('0x54')]=qs['filters'](_[_0x363e('0x55')](_0x797a71['query'],_0x2e7e6b[_0x363e('0x4c')]));if(_0x797a71[_0x363e('0x4b')]['filter']){_0x12030a['where']=_['merge'](_0x12030a['where'],{'$or':_[_0x363e('0x39')](_0x12030a[_0x363e('0x4f')],function(_0x5ad075){var _0x3aaed5={};_0x3aaed5[_0x5ad075]={'$like':'%'+_0x797a71[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x3aaed5;})});}_0x12030a=_[_0x363e('0x56')]({},_0x12030a,_0x797a71[_0x363e('0x60')]);return _0x244865[_0x363e('0xd9')](_0x12030a);}})[_0x363e('0x31')](function(_0x52307e){if(_0x52307e){_0x19fb19=_0x52307e[_0x363e('0x50')];if(!_0x797a71[_0x363e('0x4b')][_0x363e('0xc2')]('nolimit')){_0x12030a[_0x363e('0x2b')]=qs['limit'](_0x797a71['query'][_0x363e('0x2b')]);_0x12030a['offset']=qs['offset'](_0x797a71['query'][_0x363e('0x2a')]);}return _0x244865[_0x363e('0xd9')](_0x12030a);}})[_0x363e('0x31')](function(_0x14415c){if(_0x14415c){return _0x14415c?{'count':_0x19fb19,'rows':_0x14415c}:null;}})[_0x363e('0x31')](respondWithResult(_0x2ef0ec,null))[_0x363e('0x24')](handleError(_0x2ef0ec,null));};exports[_0x363e('0xda')]=function(_0x526c5b,_0x44d79c,_0xc66955){var _0xe17d66={};var _0x3f2167={};var _0x5ef698;var _0x141bc9;return db['User']['findOne']({'where':{'id':_0x526c5b[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x44d79c,null))[_0x363e('0x31')](function(_0x3bd61e){if(_0x3bd61e){_0x5ef698=_0x3bd61e;_0x3f2167[_0x363e('0x46')]=_[_0x363e('0x4a')](db['WhatsappInteraction'][_0x363e('0x42')]);_0x3f2167[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x526c5b['query']);_0x3f2167[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x3f2167['model'],_0x3f2167[_0x363e('0x4b')]);_0xe17d66['attributes']=_[_0x363e('0x4d')](_0x3f2167[_0x363e('0x46')],qs['fields'](_0x526c5b[_0x363e('0x4b')][_0x363e('0x4e')]));_0xe17d66[_0x363e('0x4f')]=_0xe17d66[_0x363e('0x4f')]['length']?_0xe17d66['attributes']:_0x3f2167['model'];_0xe17d66[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x526c5b['query']['sort']);_0xe17d66[_0x363e('0x54')]=qs['filters'](_['pick'](_0x526c5b['query'],_0x3f2167[_0x363e('0x4c')]));if(_0x526c5b[_0x363e('0x4b')][_0x363e('0x38')]){_0xe17d66[_0x363e('0x54')]=_[_0x363e('0x56')](_0xe17d66[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0xe17d66['attributes'],function(_0x51b084){var _0x3af31c={};_0x3af31c[_0x51b084]={'$like':'%'+_0x526c5b['query'][_0x363e('0x38')]+'%'};return _0x3af31c;})});}_0xe17d66=_[_0x363e('0x56')]({},_0xe17d66,_0x526c5b[_0x363e('0x60')]);return _0x5ef698['getWhatsappInteractions'](_0xe17d66);}})['then'](function(_0x558d40){if(_0x558d40){_0x141bc9=_0x558d40[_0x363e('0x50')];if(!_0x526c5b['query'][_0x363e('0xc2')]('nolimit')){_0xe17d66[_0x363e('0x2b')]=qs['limit'](_0x526c5b[_0x363e('0x4b')][_0x363e('0x2b')]);_0xe17d66['offset']=qs[_0x363e('0x2a')](_0x526c5b[_0x363e('0x4b')][_0x363e('0x2a')]);}return _0x5ef698[_0x363e('0xda')](_0xe17d66);}})['then'](function(_0x510a0d){if(_0x510a0d){return _0x510a0d?{'count':_0x141bc9,'rows':_0x510a0d}:null;}})[_0x363e('0x31')](respondWithResult(_0x44d79c,null))[_0x363e('0x24')](handleError(_0x44d79c,null));};exports[_0x363e('0xdb')]=function(_0x5e0ba5,_0x5c0904,_0x196a1d){var _0x477e79;var _0x5d29fe;var _0xeef910;var _0x584683=!_['isNil'](_0x5e0ba5[_0x363e('0x5e')]['id'])?_0x5e0ba5[_0x363e('0x5e')]['id']:!_[_0x363e('0x6b')](_0x5e0ba5[_0x363e('0x35')]['id'])?_0x5e0ba5[_0x363e('0x35')]['id']:null;return db[_0x363e('0x5a')]['find']({'where':{'id':_0x584683,'role':{'$or':[_0x363e('0x33'),'user','agent']}},'attributes':['id',_0x363e('0x3d'),'phone',_0x363e('0xdc'),_0x363e('0x32'),_0x363e('0x66'),_0x363e('0xa3')]})['then'](function(_0x1f99b9){if(_0x1f99b9){if(_0x1f99b9['role']==='agent'){_0x477e79=_0x1f99b9;if(_0x5e0ba5['body'][_0x363e('0xa5')]){_0xeef910=util[_0x363e('0xb1')]('LOCAL/%s@from-sip/n',_0x477e79[_0x5e0ba5[_0x363e('0x61')][_0x363e('0xa5')]]);}else if(_0x5e0ba5['body'][_0x363e('0xdd')]){_0xeef910=util['format'](_0x363e('0xde'),_0x5e0ba5[_0x363e('0x61')][_0x363e('0xdd')]);}else{_0xeef910=util[_0x363e('0xb1')]('SIP/%s',_0x477e79[_0x363e('0x3d')]);}socket['to'](util[_0x363e('0xb1')](_0x363e('0xdf'),_0x477e79[_0x363e('0x3d')]))[_0x363e('0xae')](_0x363e('0xe0'),{'ip':_0x5e0ba5['headers'][_0x363e('0xe1')]||_0x5e0ba5[_0x363e('0xe2')][_0x363e('0xe3')]||_0x5e0ba5[_0x363e('0xe4')][_0x363e('0xe3')]||_0x5e0ba5[_0x363e('0xe2')][_0x363e('0xe4')][_0x363e('0xe3')]});return db[_0x363e('0xb2')][_0x363e('0x3f')]({'where':{'membername':_0x477e79['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x363e('0x97'))](_0x363e('0xe5'));}})[_0x363e('0x31')](function(){if(_0x477e79){return _0x477e79[_0x363e('0xe6')]({'raw':!![]});}})[_0x363e('0x31')](function(_0x132783){if(_0x477e79){var _0xce5eca=[];if(_0x132783){_0x5d29fe=_0x132783;if(_0x5d29fe['length']){for(var _0x49e5ca=0x0;_0x49e5ca<_0x5d29fe[_0x363e('0x50')];_0x49e5ca++){_0xce5eca[_0x363e('0x8e')]({'membername':_0x477e79[_0x363e('0x3d')],'UserId':_0x477e79['id'],'queue_name':_0x5d29fe[_0x49e5ca][_0x363e('0x3d')],'VoiceQueueId':_0x5d29fe[_0x49e5ca]['id'],'interface':_0xeef910,'paused':_0x477e79[_0x363e('0xa3')]||![],'penalty':_0x5d29fe[_0x49e5ca][_0x363e('0xe7')]||0x0});}return BPromise[_0x363e('0x8f')](_0xce5eca,function(_0x3d0a39){return db[_0x363e('0xb2')][_0x363e('0xb3')](_0x3d0a39);});}}}})[_0x363e('0x31')](function(){if(_0x477e79){return db['MemberReport'][_0x363e('0x5c')]({'where':{'membername':_0x477e79[_0x363e('0x3d')],'exitAt':null}});}})[_0x363e('0x31')](function(_0x39f096){if(_0x477e79){var _0x27139a=[];_0x39f096['forEach'](function(_0x2f9651){_0x27139a['push'](_0x2f9651[_0x363e('0x30')]({'exitAt':moment()[_0x363e('0xb1')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x363e('0x93')](_0x27139a);}})[_0x363e('0x31')](function(){if(_0x477e79){var _0x220c42=[];var _0x58bb28=[];var _0x40b34a=utils['getChannels']();var _0xf1880f={'membername':_0x477e79[_0x363e('0x3d')],'interface':_0xeef910,'enterAt':moment()[_0x363e('0xb1')](_0x363e('0xe8')),'role':_0x477e79[_0x363e('0x32')],'internal':_0x477e79[_0x363e('0x66')]};_0x40b34a[_0x363e('0xe9')](function(_0x5b1000){_0x220c42[_0x363e('0x8e')](_['merge']({'channel':_0x5b1000,'type':'LOGIN','data1':_0x5e0ba5[_0x363e('0x61')]['device'],'data2':_0xeef910},_0xf1880f));if(_0x477e79[_0x363e('0xa3')]){_0x58bb28[_0x363e('0x8e')](_['merge']({'channel':_0x5b1000,'type':_0x363e('0xea'),'data1':_0x363e('0xeb')},_0xf1880f));}});return db[_0x363e('0xec')][_0x363e('0xed')](_0x220c42[_0x363e('0xee')](_0x58bb28),{'individualHooks':!![]});}})['then'](function(){if(_0x477e79){return _0x477e79['update']({'online':!![],'lastLoginAt':moment()['format'](_0x363e('0xe8')),'voicePause':_0x477e79[_0x363e('0xa3')]||![],'mailPause':_0x477e79[_0x363e('0xa3')]||![],'chatPause':_0x477e79[_0x363e('0xa3')]||![],'faxPause':_0x477e79[_0x363e('0xa3')]||![],'smsPause':_0x477e79[_0x363e('0xa3')]||![],'openchannelPause':_0x477e79[_0x363e('0xa3')]||![],'whatsappPause':_0x477e79[_0x363e('0xa3')]||![],'pauseType':_0x477e79['loginInPause']?'LOGININPAUSE':null,'interface':_0xeef910,'lastPauseAt':moment()[_0x363e('0xb1')](_0x363e('0xe8'))});}})[_0x363e('0x31')](function(_0x1aa01f){if(_0x5e0ba5[_0x363e('0xef')]){return _0x196a1d();}else{return BPromise['resolve'](_0x1aa01f)[_0x363e('0x31')](respondWithResult(_0x5c0904,null));}})['catch'](handleError(_0x5c0904,null));};exports[_0x363e('0xf0')]=function(_0x42eb78,_0x1213fb,_0xfd66fb){var _0x3994ab;return db[_0x363e('0x5a')][_0x363e('0x3c')]({'where':{'id':_0x42eb78['params']['id'],'role':_0x363e('0x84')},'attributes':['id',_0x363e('0x3d'),_0x363e('0x32')]})[_0x363e('0x31')](handleEntityNotFound(_0x1213fb,null))['then'](function(_0x252e93){if(_0x252e93){_0x3994ab=_0x252e93;return db[_0x363e('0xb2')]['destroy']({'where':{'membername':_0x3994ab['name']},'individualHooks':!![]});}})[_0x363e('0x31')](function(){return db[_0x363e('0xec')][_0x363e('0x5c')]({'where':{'membername':_0x3994ab[_0x363e('0x3d')],'exitAt':null}});})['then'](function(_0x16fe3a){var _0x4dbe79=[];_0x16fe3a[_0x363e('0xe9')](function(_0x1067ac){_0x4dbe79[_0x363e('0x8e')](_0x1067ac['update']({'exitAt':moment()[_0x363e('0xb1')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x4dbe79);})['then'](function(){return _0x3994ab[_0x363e('0x30')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x363e('0x31')](respondWithResult(_0x1213fb,null))[_0x363e('0x24')](handleError(_0x1213fb,null));};exports[_0x363e('0xf1')]=function(_0x334da3,_0x20bd26,_0x3081e0){var _0x2c0e91;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x334da3[_0x363e('0x5e')]['id']},'individualHooks':!![]})[_0x363e('0x31')](function(){return db['User'][_0x363e('0x3c')]({'where':{'id':_0x334da3[_0x363e('0x5e')]['id'],'role':'agent'},'attributes':['id','name',_0x363e('0x32'),_0x363e('0x66'),'interface']});})[_0x363e('0x31')](handleEntityNotFound(_0x20bd26,null))[_0x363e('0x31')](function(_0x1507a7){if(_0x1507a7){_0x2c0e91=_0x1507a7;return respondWithRpcPromise(_0x363e('0xf2'),_0x363e('0xf1'),{'id':_0x2c0e91['id'],'name':_0x2c0e91[_0x363e('0x3d')],'pause':!![]});}})['then'](function(){if(_0x2c0e91){return db[_0x363e('0xec')][_0x363e('0x5c')]({'where':{'membername':_0x2c0e91[_0x363e('0x3d')],'type':'PAUSE','exitAt':null}});}})[_0x363e('0x31')](function(_0x464883){if(_0x464883['length']){var _0x5bc01a=moment()[_0x363e('0xb1')](_0x363e('0xe8'));for(var _0x357e22=0x0,_0x1d7dd1=_0x464883['length'];_0x357e22<_0x1d7dd1;_0x357e22++){_0x464883[_0x357e22]['updateAttributes']({'exitAt':_0x5bc01a});}}})[_0x363e('0x31')](function(){var _0x2a5294=[];var _0x502a9a=utils[_0x363e('0xf3')]();_0x502a9a[_0x363e('0xe9')](function(_0x41dabd){_0x2a5294[_0x363e('0x8e')]({'channel':_0x41dabd,'membername':_0x2c0e91['name'],'interface':_[_0x363e('0x6b')](_0x2c0e91[_0x363e('0xa5')])?util[_0x363e('0xb1')](_0x363e('0xde'),_0x2c0e91[_0x363e('0x3d')]):_0x2c0e91[_0x363e('0xa5')],'type':'PAUSE','enterAt':moment()[_0x363e('0xb1')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x334da3[_0x363e('0x61')]['type']||'DEFAULT\x20PAUSE','role':_0x2c0e91[_0x363e('0x32')],'internal':_0x2c0e91[_0x363e('0x66')]});});return db['MemberReport'][_0x363e('0xed')](_0x2a5294,{'individualHooks':!![]});})[_0x363e('0x31')](function(){return _0x2c0e91[_0x363e('0x30')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x334da3[_0x363e('0x61')]['type']||_0x363e('0xf4'),'lastPauseAt':moment()[_0x363e('0xb1')](_0x363e('0xe8'))});})['then'](respondWithResult(_0x20bd26,null))[_0x363e('0x24')](handleError(_0x20bd26,null));};exports[_0x363e('0xf5')]=function(_0x55ff21,_0x14d717,_0x509d03){var _0x53a345;return db[_0x363e('0x5a')]['find']({'where':{'id':_0x55ff21['params']['id']},'attributes':['id','name',_0x363e('0x32'),_0x363e('0xa4'),_0x363e('0xf6'),_0x363e('0xf7'),_0x363e('0xf8'),_0x363e('0xf9'),'smsPause','whatsapppause','pauseType',_0x363e('0xfa')]})[_0x363e('0x31')](handleEntityNotFound(_0x14d717,null))[_0x363e('0x31')](function(_0xad81b9){if(_0xad81b9){_0x53a345=_0xad81b9;if(_0x55ff21['body'][_0x363e('0xa1')]&&!utils[_0x363e('0xa6')](_0x55ff21[_0x363e('0x61')]['channel'])){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))]('Unknown\x20channel');}switch(_0x55ff21[_0x363e('0x61')]['channel']){case _0x363e('0xb0'):return respondWithRpcPromise('QueuePause',_0x363e('0xf5'),{'id':_0x53a345['id'],'name':_0x53a345[_0x363e('0x3d')],'pause':![]})[_0x363e('0x31')](function(){return db[_0x363e('0xb2')][_0x363e('0x30')]({'paused':0x0},{'where':{'UserId':_0x53a345['id']},'individualHooks':!![]});})[_0x363e('0x31')](function(){return db[_0x363e('0xec')][_0x363e('0x3c')]({'where':{'channel':_0x55ff21[_0x363e('0x61')]['channel'],'membername':_0x53a345[_0x363e('0x3d')],'type':'PAUSE','exitAt':null}});})[_0x363e('0x31')](function(_0x244bbe){if(_0x244bbe){return _0x244bbe[_0x363e('0x30')]({'exitAt':moment()[_0x363e('0xb1')](_0x363e('0xe8')),'data2':_0x363e('0xfb')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x53a345['update']({'voicePause':![]});});case'mail':case'chat':case _0x363e('0xfc'):case _0x363e('0xfd'):case _0x363e('0xfe'):case _0x363e('0xff'):return db[_0x363e('0xec')][_0x363e('0x3c')]({'where':{'channel':_0x55ff21['body']['channel'],'membername':_0x53a345[_0x363e('0x3d')],'type':_0x363e('0xea'),'exitAt':null}})[_0x363e('0x31')](function(_0x21816c){if(_0x21816c){return _0x21816c['update']({'exitAt':moment()[_0x363e('0xb1')](_0x363e('0xe8')),'data2':_0x363e('0xfb')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x33f7ed={};_['set'](_0x33f7ed,util[_0x363e('0xb1')](_0x363e('0x100'),_0x55ff21[_0x363e('0x61')][_0x363e('0xa1')],_0x363e('0x101')),![]);return _0x53a345[_0x363e('0x30')](_0x33f7ed);});default:return respondWithRpcPromise('QueuePause',_0x363e('0xf5'),{'id':_0x53a345['id'],'name':_0x53a345[_0x363e('0x3d')],'pause':![]})[_0x363e('0x31')](function(){return db[_0x363e('0xb2')][_0x363e('0x30')]({'paused':0x0},{'where':{'UserId':_0x53a345['id']}});})[_0x363e('0x31')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x53a345['name'],'type':_0x363e('0xea'),'exitAt':null}});})[_0x363e('0x31')](function(_0x2c3401){var _0x265463=[];_0x2c3401[_0x363e('0xe9')](function(_0x2fa375){_0x265463[_0x363e('0x8e')](_0x2fa375[_0x363e('0x30')]({'exitAt':moment()[_0x363e('0xb1')](_0x363e('0xe8')),'data2':'manual'}));});return BPromise[_0x363e('0x93')](_0x265463);})['then'](function(){return _0x53a345[_0x363e('0x30')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x14d717,null))[_0x363e('0x24')](handleError(_0x14d717,null));};exports['getTeams']=function(_0x1a7501,_0xc62843,_0x333f40){var _0x3b4ad4={};var _0x5ad453={};var _0x1d7400;var _0x41cd2e;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x1a7501[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0xc62843,null))['then'](function(_0x137099){if(_0x137099){_0x1d7400=_0x137099;_0x5ad453['model']=_[_0x363e('0x4a')](db[_0x363e('0x102')]['rawAttributes']);_0x5ad453['query']=_['keys'](_0x1a7501[_0x363e('0x4b')]);_0x5ad453[_0x363e('0x4c')]=_['intersection'](_0x5ad453['model'],_0x5ad453['query']);_0x3b4ad4['attributes']=_[_0x363e('0x4d')](_0x5ad453[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x1a7501[_0x363e('0x4b')]['fields']));_0x3b4ad4[_0x363e('0x4f')]=_0x3b4ad4[_0x363e('0x4f')][_0x363e('0x50')]?_0x3b4ad4['attributes']:_0x5ad453['model'];_0x3b4ad4[_0x363e('0x52')]=qs['sort'](_0x1a7501[_0x363e('0x4b')]['sort']);_0x3b4ad4[_0x363e('0x54')]=qs[_0x363e('0x4c')](_[_0x363e('0x55')](_0x1a7501[_0x363e('0x4b')],_0x5ad453[_0x363e('0x4c')]));if(_0x1a7501[_0x363e('0x4b')][_0x363e('0x38')]){_0x3b4ad4[_0x363e('0x54')]=_[_0x363e('0x56')](_0x3b4ad4[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x3b4ad4['attributes'],function(_0x6512bf){var _0x2b0127={};_0x2b0127[_0x6512bf]={'$like':'%'+_0x1a7501[_0x363e('0x4b')]['filter']+'%'};return _0x2b0127;})});}_0x3b4ad4=_['merge']({},_0x3b4ad4,_0x1a7501[_0x363e('0x60')]);return _0x1d7400['getTeams'](_0x3b4ad4);}})[_0x363e('0x31')](function(_0x4e7d59){if(_0x4e7d59){_0x41cd2e=_0x4e7d59['length'];if(!_0x1a7501[_0x363e('0x4b')]['hasOwnProperty']('nolimit')){_0x3b4ad4[_0x363e('0x2b')]=qs[_0x363e('0x2b')](_0x1a7501[_0x363e('0x4b')]['limit']);_0x3b4ad4['offset']=qs[_0x363e('0x2a')](_0x1a7501[_0x363e('0x4b')][_0x363e('0x2a')]);}return _0x1d7400[_0x363e('0x103')](_0x3b4ad4);}})[_0x363e('0x31')](function(_0x2f2a9a){if(_0x2f2a9a){return _0x2f2a9a?{'count':_0x41cd2e,'rows':_0x2f2a9a}:null;}})['then'](respondWithResult(_0xc62843,null))['catch'](handleError(_0xc62843,null));};exports['addTeams']=function(_0x5e0ca3,_0x3d4bd0){return db['User'][_0x363e('0x3c')]({'where':{'id':_0x5e0ca3[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x3d4bd0,null))[_0x363e('0x31')](function(_0x370a90){if(_0x370a90){var _0x57808f=_0x370a90[_0x363e('0xc8')]({'plain':!![]});return _0x370a90[_0x363e('0x104')](_0x5e0ca3[_0x363e('0x61')]['ids'],_[_0x363e('0x65')](_0x5e0ca3[_0x363e('0x61')],[_0x363e('0x64'),'id'])||{})[_0x363e('0x31')](function(){for(var _0x20a6f4=0x0;_0x20a6f4<_0x5e0ca3['body'][_0x363e('0x64')][_0x363e('0x50')];_0x20a6f4++){var _0x452261=[];db[_0x363e('0x102')]['findOne']({'where':{'id':_0x5e0ca3['body'][_0x363e('0x64')][_0x20a6f4]}})[_0x363e('0x31')](function(_0x25f5d3){_0x452261[_0x363e('0x8e')](_0x25f5d3[_0x363e('0xe6')]()[_0x363e('0x31')](function(_0x3531ec){for(var _0x1f8282=0x0;_0x1f8282<_0x3531ec[_0x363e('0x50')];_0x1f8282++){_0x3531ec[_0x1f8282][_0x363e('0x105')](_0x363e('0xa1'),'Voice');}return _0x3531ec;}));_0x452261[_0x363e('0x8e')](_0x25f5d3[_0x363e('0x106')]()[_0x363e('0x31')](function(_0x1fd630){for(var _0x56d5c8=0x0;_0x56d5c8<_0x1fd630[_0x363e('0x50')];_0x56d5c8++){_0x1fd630[_0x56d5c8][_0x363e('0x105')]('channel',_0x363e('0x107'));}return _0x1fd630;}));_0x452261[_0x363e('0x8e')](_0x25f5d3[_0x363e('0x108')]()[_0x363e('0x31')](function(_0x493c33){for(var _0x47b29f=0x0;_0x47b29f<_0x493c33[_0x363e('0x50')];_0x47b29f++){_0x493c33[_0x47b29f][_0x363e('0x105')](_0x363e('0xa1'),'Mail');}return _0x493c33;}));_0x452261[_0x363e('0x8e')](_0x25f5d3['getSmsQueues']()['then'](function(_0x3d0b8d){for(var _0x383c42=0x0;_0x383c42<_0x3d0b8d['length'];_0x383c42++){_0x3d0b8d[_0x383c42][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x109'));}return _0x3d0b8d;}));_0x452261[_0x363e('0x8e')](_0x25f5d3[_0x363e('0x10a')]()[_0x363e('0x31')](function(_0x4ed175){for(var _0x4dcd3f=0x0;_0x4dcd3f<_0x4ed175[_0x363e('0x50')];_0x4dcd3f++){_0x4ed175[_0x4dcd3f][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x10b'));}return _0x4ed175;}));_0x452261[_0x363e('0x8e')](_0x25f5d3[_0x363e('0x10c')]()[_0x363e('0x31')](function(_0x449751){for(var _0x3b41b=0x0;_0x3b41b<_0x449751['length'];_0x3b41b++){_0x449751[_0x3b41b][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x10d'));}return _0x449751;}));_0x452261[_0x363e('0x8e')](_0x25f5d3[_0x363e('0x10e')]()[_0x363e('0x31')](function(_0x1325bd){for(var _0x3c80e9=0x0;_0x3c80e9<_0x1325bd[_0x363e('0x50')];_0x3c80e9++){_0x1325bd[_0x3c80e9][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x10f'));}return _0x1325bd;}));return BPromise[_0x363e('0x93')](_0x452261);})[_0x363e('0x31')](function(_0x568f22){var _0x46b63e=_[_0x363e('0x110')](_0x568f22);_0x452261=[];return db[_0x363e('0x57')]['transaction'](function(_0x4a2649){for(var _0x143e54=0x0;_0x143e54<_0x46b63e[_0x363e('0x50')];_0x143e54++){_0x452261[_0x363e('0x8e')](_0x46b63e[_0x143e54]['addAgent'](_0x57808f['id']),{'transaction':_0x4a2649});}return BPromise[_0x363e('0x93')](_0x452261)[_0x363e('0x31')](function(){if(_0x57808f[_0x363e('0xa2')]){return BPromise[_0x363e('0x8f')](_[_0x363e('0x38')](_0x46b63e,function(_0x359188){return _0x359188['getDataValue'](_0x363e('0xa1'))===_0x363e('0x111');}),function(_0x18df83){return db[_0x363e('0xb2')]['upsert']({'membername':_0x57808f[_0x363e('0x3d')],'UserId':_0x57808f['id'],'queue_name':_0x18df83[_0x363e('0x3d')],'VoiceQueueId':_0x18df83['id'],'interface':_[_0x363e('0x6b')](_0x57808f[_0x363e('0xa5')])?util[_0x363e('0xb1')](_0x363e('0xde'),_0x57808f[_0x363e('0x3d')]):_0x57808f['interface'],'paused':_0x57808f[_0x363e('0xa4')]||![],'penalty':_0x57808f[_0x363e('0xac')]},{'transaction':_0x4a2649});});}else{return;}})[_0x363e('0x31')](function(){for(var _0x290aad=0x0;_0x290aad<_0x46b63e[_0x363e('0x50')];_0x290aad++){var _0x593f6b=_0x46b63e[_0x290aad][_0x363e('0x112')]('channel');var _0x4b8aa8=_0x593f6b+_0x363e('0xad');socket[_0x363e('0xae')](_0x363e('0x35')+_0x593f6b+_0x363e('0x113'),{'UserId':_0x57808f['id'],['queueField']:_0x46b63e[_0x290aad]['id']});}});});});}});}})[_0x363e('0x31')](respondWithStatusCode(_0x3d4bd0,null))[_0x363e('0x24')](handleError(_0x3d4bd0,null));};exports[_0x363e('0x114')]=function(_0x594404,_0x5881b3){return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x594404[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x5881b3,null))[_0x363e('0x31')](function(_0x16930b){if(_0x16930b){var _0x3e73f8=_0x16930b[_0x363e('0xc8')]({'plain':!![]});var _0x1266da=_0x594404[_0x363e('0x4b')][_0x363e('0x64')];return _0x16930b[_0x363e('0x114')](_0x1266da)[_0x363e('0x31')](function(){for(var _0x2a955a=0x0;_0x2a955a<_0x1266da[_0x363e('0x50')];_0x2a955a++){var _0x3eb5dc=[];db[_0x363e('0x102')][_0x363e('0xc0')]({'where':{'id':_0x1266da[_0x2a955a]}})[_0x363e('0x31')](function(_0x1f8271){_0x3eb5dc[_0x363e('0x8e')](_0x1f8271[_0x363e('0xe6')]()[_0x363e('0x31')](function(_0x422232){for(var _0x227e5c=0x0;_0x227e5c<_0x422232['length'];_0x227e5c++){_0x422232[_0x227e5c][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x111'));}return _0x422232;}));_0x3eb5dc[_0x363e('0x8e')](_0x1f8271[_0x363e('0x106')]()[_0x363e('0x31')](function(_0x46d433){for(var _0x385425=0x0;_0x385425<_0x46d433[_0x363e('0x50')];_0x385425++){_0x46d433[_0x385425][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x107'));}return _0x46d433;}));_0x3eb5dc[_0x363e('0x8e')](_0x1f8271[_0x363e('0x108')]()['then'](function(_0x3a9e9d){for(var _0x59fc8c=0x0;_0x59fc8c<_0x3a9e9d[_0x363e('0x50')];_0x59fc8c++){_0x3a9e9d[_0x59fc8c][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x115'));}return _0x3a9e9d;}));_0x3eb5dc[_0x363e('0x8e')](_0x1f8271[_0x363e('0x116')]()[_0x363e('0x31')](function(_0x27db72){for(var _0x5e0f07=0x0;_0x5e0f07<_0x27db72[_0x363e('0x50')];_0x5e0f07++){_0x27db72[_0x5e0f07][_0x363e('0x105')](_0x363e('0xa1'),'Sms');}return _0x27db72;}));_0x3eb5dc['push'](_0x1f8271[_0x363e('0x10a')]()[_0x363e('0x31')](function(_0x5c1777){for(var _0x371031=0x0;_0x371031<_0x5c1777[_0x363e('0x50')];_0x371031++){_0x5c1777[_0x371031][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x10b'));}return _0x5c1777;}));_0x3eb5dc[_0x363e('0x8e')](_0x1f8271['getFaxQueues']()['then'](function(_0x535cbb){for(var _0x356c00=0x0;_0x356c00<_0x535cbb[_0x363e('0x50')];_0x356c00++){_0x535cbb[_0x356c00][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x10d'));}return _0x535cbb;}));_0x3eb5dc[_0x363e('0x8e')](_0x1f8271['getOpenchannelQueues']()['then'](function(_0xbcb2a0){for(var _0x4304c4=0x0;_0x4304c4<_0xbcb2a0[_0x363e('0x50')];_0x4304c4++){_0xbcb2a0[_0x4304c4][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x10f'));}return _0xbcb2a0;}));return BPromise[_0x363e('0x93')](_0x3eb5dc);})[_0x363e('0x31')](function(_0x3cabbb){var _0x5f39eb=_[_0x363e('0x110')](_0x3cabbb);_0x3eb5dc=[];return db['sequelize'][_0x363e('0x117')](function(_0x15eb0f){for(var _0x196142=0x0;_0x196142<_0x5f39eb[_0x363e('0x50')];_0x196142++){_0x3eb5dc[_0x363e('0x8e')](_0x5f39eb[_0x196142][_0x363e('0x118')](_0x3e73f8['id']),{'transaction':_0x15eb0f});}return BPromise[_0x363e('0x93')](_0x3eb5dc)['then'](function(){if(_0x3e73f8['online']){return BPromise[_0x363e('0x8f')](_['filter'](_0x5f39eb,function(_0x55ab73){return _0x55ab73[_0x363e('0x112')]('channel')===_0x363e('0x111');}),function(_0x3b17ea){return db[_0x363e('0xb2')][_0x363e('0x3f')]({'where':{'VoiceQueueId':_0x3b17ea['id'],'UserId':_0x3e73f8['id']},'transaction':_0x15eb0f});});}else{return;}})[_0x363e('0x31')](function(){for(var _0x289ffe=0x0;_0x289ffe<_0x5f39eb[_0x363e('0x50')];_0x289ffe++){var _0x9bf0e6=_0x5f39eb[_0x289ffe]['getDataValue'](_0x363e('0xa1'));var _0x4c3d80=_0x9bf0e6+_0x363e('0xad');socket[_0x363e('0xae')](_0x363e('0x35')+_0x9bf0e6+_0x363e('0xb6'),{'UserId':_0x3e73f8['id'],['queueField']:_0x5f39eb[_0x289ffe]['id']});}});});});}});}})[_0x363e('0x31')](respondWithStatusCode(_0x5881b3,null))[_0x363e('0x24')](handleError(_0x5881b3,null));};exports[_0x363e('0x119')]=function(_0x22234a,_0x33e187,_0x2f58f8){var _0x2f2bfb={};var _0x4fc500={};var _0x383de7;var _0x54b5fa;return db['User'][_0x363e('0xc0')]({'where':{'id':_0x22234a['params']['id']}})['then'](handleEntityNotFound(_0x33e187,null))[_0x363e('0x31')](function(_0x19fbd5){if(_0x19fbd5){_0x383de7=_0x19fbd5;_0x4fc500[_0x363e('0x46')]=_['keys'](db[_0x363e('0xc3')][_0x363e('0x42')]);_0x4fc500[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x22234a[_0x363e('0x4b')]);_0x4fc500['filters']=_[_0x363e('0x4d')](_0x4fc500[_0x363e('0x46')],_0x4fc500[_0x363e('0x4b')]);_0x2f2bfb['attributes']=_[_0x363e('0x4d')](_0x4fc500[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x22234a[_0x363e('0x4b')][_0x363e('0x4e')]));_0x2f2bfb['attributes']=_0x2f2bfb[_0x363e('0x4f')][_0x363e('0x50')]?_0x2f2bfb[_0x363e('0x4f')]:_0x4fc500[_0x363e('0x46')];_0x2f2bfb['order']=qs[_0x363e('0x53')](_0x22234a[_0x363e('0x4b')][_0x363e('0x53')]);_0x2f2bfb[_0x363e('0x54')]=qs[_0x363e('0x4c')](_['pick'](_0x22234a[_0x363e('0x4b')],_0x4fc500[_0x363e('0x4c')]));if(_0x22234a[_0x363e('0x4b')][_0x363e('0x38')]){_0x2f2bfb[_0x363e('0x54')]=_[_0x363e('0x56')](_0x2f2bfb[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x2f2bfb[_0x363e('0x4f')],function(_0x28aeb6){var _0x3a918c={};_0x3a918c[_0x28aeb6]={'$like':'%'+_0x22234a[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x3a918c;})});}_0x2f2bfb=_[_0x363e('0x56')]({},_0x2f2bfb,_0x22234a['options']);return _0x383de7[_0x363e('0x119')](_0x2f2bfb);}})['then'](function(_0x4af360){if(_0x4af360){_0x54b5fa=_0x4af360[_0x363e('0x50')];if(!_0x22234a[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x2f2bfb['limit']=qs['limit'](_0x22234a[_0x363e('0x4b')][_0x363e('0x2b')]);_0x2f2bfb[_0x363e('0x2a')]=qs['offset'](_0x22234a[_0x363e('0x4b')][_0x363e('0x2a')]);}return _0x383de7[_0x363e('0x119')](_0x2f2bfb);}})[_0x363e('0x31')](function(_0x249c23){if(_0x249c23){return _0x249c23?{'count':_0x54b5fa,'rows':_0x249c23}:null;}})[_0x363e('0x31')](respondWithResult(_0x33e187,null))['catch'](handleError(_0x33e187,null));};exports[_0x363e('0x11a')]=function(_0x19cb8e,_0x1a6553,_0x3b32b6){var _0x58845d={};var _0xda1212={};var _0x41163b;var _0xc619bf;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x19cb8e[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x1a6553,null))[_0x363e('0x31')](function(_0x2fe243){if(_0x2fe243){_0x41163b=_0x2fe243;_0xda1212[_0x363e('0x46')]=_[_0x363e('0x4a')](db[_0x363e('0x5a')]['rawAttributes']);_0xda1212[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x19cb8e[_0x363e('0x4b')]);_0xda1212[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0xda1212['model'],_0xda1212[_0x363e('0x4b')]);_0x58845d[_0x363e('0x4f')]=_['intersection'](_0xda1212[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x19cb8e[_0x363e('0x4b')][_0x363e('0x4e')]));_0x58845d[_0x363e('0x4f')]=_0x58845d[_0x363e('0x4f')]['length']?_0x58845d['attributes']:_0xda1212[_0x363e('0x46')];_0x58845d[_0x363e('0x52')]=qs['sort'](_0x19cb8e[_0x363e('0x4b')]['sort']);_0x58845d['where']=qs['filters'](_[_0x363e('0x55')](_0x19cb8e[_0x363e('0x4b')],_0xda1212[_0x363e('0x4c')]));if(_0x19cb8e['query'][_0x363e('0x38')]){_0x58845d['where']=_[_0x363e('0x56')](_0x58845d[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x58845d[_0x363e('0x4f')],function(_0x43d3f4){var _0x569f17={};_0x569f17[_0x43d3f4]={'$like':'%'+_0x19cb8e[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x569f17;})});}_0x58845d[_0x363e('0x46')]=db[_0x363e('0x5a')];_0x58845d['as']=_0x363e('0x36');_0x58845d=_[_0x363e('0x56')]({},_0x58845d,_0x19cb8e[_0x363e('0x60')]);return _0x41163b['getVoiceQueues']({'include':[_0x58845d]});}})[_0x363e('0x31')](function(_0x1007f9){if(_0x1007f9){var _0x44d21b={},_0x26cd2e=[],_0x5611ad=0x0;for(var _0x28910e=0x0;_0x28910e<_0x1007f9['length'];_0x28910e+=0x1){for(var _0x3c9492=0x0,_0x3d973a;_0x3c9492<_0x1007f9[_0x28910e][_0x363e('0x36')][_0x363e('0x50')];_0x3c9492+=0x1){_0x3d973a=_0x1007f9[_0x28910e][_0x363e('0x36')][_0x3c9492][_0x363e('0xc8')]({'plain':!![]});_0x44d21b[_0x3d973a['id']]=_0x3d973a;}}_0x44d21b=_[_0x363e('0x11b')](_0x44d21b);for(var _0x1024ea=qs[_0x363e('0x2a')](_0x19cb8e[_0x363e('0x4b')][_0x363e('0x2a')]);_0x1024ea<_0x44d21b[_0x363e('0x50')]&&_0x26cd2e[_0x363e('0x50')]=_0x1ec179){_0x1a9e74=_0x1ec179;_0x18b3a7=0xc8;}else{_0x18b3a7=0xce;}_0x2d327d[_0x1ab8('0x2f')](_0x18b3a7);return _0x2d327d[_0x1ab8('0x34')](_0x1ab8('0x35'),_0x225357+'-'+_0x1a9e74+'/'+_0x1ec179)[_0x1ab8('0x30')](_0x394719);}return null;};}function patchUpdates(_0x50f320){return function(_0x149ae1){try{jsonpatch['apply'](_0x149ae1,_0x50f320,!![]);}catch(_0x36a799){return BPromise[_0x1ab8('0x36')](_0x36a799);}return _0x149ae1[_0x1ab8('0x37')]();};}function saveUpdates(_0x2275a5,_0x4d24e6){return function(_0x2fc10d){if(_0x2fc10d){return _0x2fc10d['update'](_0x2275a5)[_0x1ab8('0x38')](function(_0x262298){return _0x262298;});}return null;};}function removeEntity(_0x2f814d,_0x459e39){return function(_0x39bff6){if(_0x39bff6){return _0x39bff6['destroy']()[_0x1ab8('0x38')](function(){var _0x41aa1e=_0x39bff6['get']({'plain':!![]});if(_0x41aa1e['role']===_0x1ab8('0x39'))return;var _0xe0d165=[{'name':_0x1ab8('0x3a'),'value':_0x1ab8('0x3b'),'ignore':!![]},{'name':'Agents','value':_0x1ab8('0x3c'),'ignore':![]},{'name':_0x1ab8('0x3d'),'value':_0x1ab8('0x3e'),'ignore':![]}];var _0x46c723=_(_0xe0d165)[_0x1ab8('0x3f')](_0x1ab8('0x40'))[_0x1ab8('0x41')](_0x1ab8('0x42'))[_0x1ab8('0x42')]();if(_['includes'](_0x46c723,_0x41aa1e[_0x1ab8('0x43')])){return;}var _0x5b4f5b=_[_0x1ab8('0x44')](_0xe0d165,[_0x1ab8('0x42'),_0x41aa1e['role']])[_0x1ab8('0x45')];return db[_0x1ab8('0x46')]['destroy']({'where':{'type':_0x5b4f5b,'resourceId':_0x41aa1e['id']}})[_0x1ab8('0x38')](function(){return _0x39bff6;});})[_0x1ab8('0x38')](function(){_0x2f814d[_0x1ab8('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48b3ac,_0x295ec1){return function(_0x253acc){if(!_0x253acc){_0x48b3ac['sendStatus'](0x194);}return _0x253acc;};}function handleError(_0x4c0940,_0x22721e){_0x22721e=_0x22721e||0x1f4;return function(_0x19b07d){logger[_0x1ab8('0x29')](_0x19b07d[_0x1ab8('0x47')]);if(_0x19b07d['name']){delete _0x19b07d[_0x1ab8('0x45')];}_0x4c0940[_0x1ab8('0x2f')](_0x22721e)['send'](_0x19b07d);};}exports[_0x1ab8('0x48')]=function(_0x324d27,_0x2b17b1){var _0x4fd2db={},_0x403904={},_0x52d191={'count':0x0,'rows':[]};var _0x13afe3=_['map'](db[_0x1ab8('0x49')][_0x1ab8('0x4a')],function(_0x49c1b8){return{'name':_0x49c1b8[_0x1ab8('0x4b')],'type':_0x49c1b8[_0x1ab8('0x4c')][_0x1ab8('0x4d')]};});_0x403904['model']=_['differenceBy'](_['map'](_0x13afe3,'name'),[_0x1ab8('0x4e'),'salt']);_0x403904[_0x1ab8('0x4f')]=_[_0x1ab8('0x50')](_0x324d27[_0x1ab8('0x4f')]);_0x403904[_0x1ab8('0x51')]=_[_0x1ab8('0x52')](_0x403904[_0x1ab8('0x53')],_0x403904['query']);_0x4fd2db[_0x1ab8('0x54')]=_['intersection'](_0x403904[_0x1ab8('0x53')],qs[_0x1ab8('0x55')](_0x324d27[_0x1ab8('0x4f')][_0x1ab8('0x55')]));_0x4fd2db[_0x1ab8('0x54')]=_0x4fd2db[_0x1ab8('0x54')][_0x1ab8('0x56')]?_0x4fd2db['attributes']:_0x403904[_0x1ab8('0x53')];if(!_0x324d27['query']['hasOwnProperty']('nolimit')){_0x4fd2db[_0x1ab8('0x33')]=qs[_0x1ab8('0x33')](_0x324d27[_0x1ab8('0x4f')][_0x1ab8('0x33')]);_0x4fd2db[_0x1ab8('0x32')]=qs[_0x1ab8('0x32')](_0x324d27[_0x1ab8('0x4f')][_0x1ab8('0x32')]);}_0x4fd2db['order']=qs[_0x1ab8('0x57')](_0x324d27[_0x1ab8('0x4f')][_0x1ab8('0x57')]);_0x4fd2db[_0x1ab8('0x58')]=qs['filters'](_[_0x1ab8('0x59')](_0x324d27['query'],_0x403904[_0x1ab8('0x51')]),_0x13afe3);if(_0x324d27['query'][_0x1ab8('0x3f')]){_0x4fd2db[_0x1ab8('0x58')]=_[_0x1ab8('0x5a')](_0x4fd2db[_0x1ab8('0x58')],{'$or':_[_0x1ab8('0x41')](_0x13afe3,function(_0x44ab0d){if(_0x44ab0d[_0x1ab8('0x4c')]!==_0x1ab8('0x5b')){return db[_0x1ab8('0x5c')][_0x1ab8('0x58')](db[_0x1ab8('0x5c')]['fn'](_0x1ab8('0x5d'),db['sequelize'][_0x1ab8('0x5e')](_0x44ab0d[_0x1ab8('0x45')])),{'$like':db[_0x1ab8('0x5c')]['fn'](_0x1ab8('0x5d'),'%'+_0x324d27[_0x1ab8('0x4f')][_0x1ab8('0x3f')]+'%')});}})});}_0x4fd2db=_['merge']({},_0x4fd2db,_0x324d27['options']);var _0x224c28={'where':_0x4fd2db['where']};return db[_0x1ab8('0x49')][_0x1ab8('0x31')](_0x224c28)[_0x1ab8('0x38')](function(_0x31a854){_0x52d191[_0x1ab8('0x31')]=_0x31a854;if(_0x324d27[_0x1ab8('0x4f')][_0x1ab8('0x5f')]){_0x4fd2db[_0x1ab8('0x60')]=[{'all':!![]}];}return db[_0x1ab8('0x49')][_0x1ab8('0x61')](_0x4fd2db);})['then'](function(_0x451db9){_0x52d191[_0x1ab8('0x62')]=_0x451db9;return _0x52d191;})[_0x1ab8('0x38')](respondWithFilteredResult(_0x2b17b1,_0x4fd2db))[_0x1ab8('0x63')](handleError(_0x2b17b1,null));};exports[_0x1ab8('0x64')]=function(_0x34210b,_0x5ed1a1){var _0x245b6d={'raw':![],'where':{'id':_0x34210b[_0x1ab8('0x65')]['id']}},_0x13195d={};_0x13195d[_0x1ab8('0x53')]=_[_0x1ab8('0x66')](_['keys'](db[_0x1ab8('0x49')][_0x1ab8('0x4a')]),['password',_0x1ab8('0x67')]);_0x13195d[_0x1ab8('0x4f')]=_[_0x1ab8('0x50')](_0x34210b[_0x1ab8('0x4f')]);_0x13195d[_0x1ab8('0x51')]=_[_0x1ab8('0x52')](_0x13195d[_0x1ab8('0x53')],_0x13195d[_0x1ab8('0x4f')]);_0x245b6d[_0x1ab8('0x54')]=_[_0x1ab8('0x52')](_0x13195d['model'],qs[_0x1ab8('0x55')](_0x34210b['query'][_0x1ab8('0x55')]));_0x245b6d[_0x1ab8('0x54')]=_0x245b6d['attributes'][_0x1ab8('0x56')]?_0x245b6d[_0x1ab8('0x54')]:_0x13195d[_0x1ab8('0x53')];if(_0x34210b[_0x1ab8('0x4f')][_0x1ab8('0x5f')]){_0x245b6d['include']=[{'all':!![]}];}_0x245b6d=_[_0x1ab8('0x5a')]({},_0x245b6d,_0x34210b[_0x1ab8('0x68')]);return db[_0x1ab8('0x49')][_0x1ab8('0x44')](_0x245b6d)[_0x1ab8('0x38')](handleEntityNotFound(_0x5ed1a1,null))[_0x1ab8('0x38')](respondWithResult(_0x5ed1a1,null))[_0x1ab8('0x63')](handleError(_0x5ed1a1,null));};exports[_0x1ab8('0x69')]=function(_0x2e715d,_0x4ed463){if(_0x2e715d['body']['id']){delete _0x2e715d[_0x1ab8('0x6a')]['id'];}delete _0x2e715d['body'][_0x1ab8('0x43')];return db['User'][_0x1ab8('0x44')]({'where':{'id':_0x2e715d['params']['id']}})[_0x1ab8('0x38')](handleEntityNotFound(_0x4ed463,null))[_0x1ab8('0x38')](saveUpdates(_0x2e715d[_0x1ab8('0x6a')],null))[_0x1ab8('0x38')](respondWithResult(_0x4ed463,null))[_0x1ab8('0x63')](handleError(_0x4ed463,null));};exports[_0x1ab8('0x6b')]=function(_0x4d2ba9,_0x4af6fd){return db[_0x1ab8('0x49')][_0x1ab8('0x6b')]()['then'](respondWithResult(_0x4af6fd,null))[_0x1ab8('0x63')](handleError(_0x4af6fd,null));};exports[_0x1ab8('0x6c')]=function(_0x3d0d4a,_0x5aa4b7,_0x197c75){return db[_0x1ab8('0x49')]['find']({'where':{'id':_0x3d0d4a[_0x1ab8('0x65')]['id']}})[_0x1ab8('0x38')](handleEntityNotFound(_0x5aa4b7,null))[_0x1ab8('0x38')](function(_0xcd406d){if(_0xcd406d){return _0xcd406d[_0x1ab8('0x6c')](_0x3d0d4a[_0x1ab8('0x6a')]['ids'],_[_0x1ab8('0x6d')](_0x3d0d4a['body'],[_0x1ab8('0x6e'),'id'])||{});}})[_0x1ab8('0x38')](respondWithResult(_0x5aa4b7,null))[_0x1ab8('0x63')](handleError(_0x5aa4b7,null));};function validateUser(_0x596a9b){return new BPromise(function(_0x561bc9,_0x534a88){if(_0x596a9b[_0x1ab8('0x6f')])return _0x561bc9(_0x596a9b);return db[_0x1ab8('0x70')][_0x1ab8('0x71')](0x1)[_0x1ab8('0x38')](function(_0x36c60d){if(_0x36c60d[_0x1ab8('0x72')])authService[_0x1ab8('0x73')](_0x596a9b[_0x1ab8('0x4e')]);db[_0x1ab8('0x49')][_0x1ab8('0x74')](_0x1ab8('0x6f'))['then'](function(_0x6c72a8){if(_['isNil'](_0x6c72a8)){_0x596a9b[_0x1ab8('0x6f')]=_0x36c60d[_0x1ab8('0x75')]||0x1;return;}if(_['isNil'](_0x36c60d['min_internal'])||_0x36c60d[_0x1ab8('0x75')]===_0x6c72a8){_0x596a9b[_0x1ab8('0x6f')]=_0x6c72a8+0x1;return;}if(_0x36c60d[_0x1ab8('0x75')]>_0x6c72a8){_0x596a9b['internal']=_0x36c60d[_0x1ab8('0x75')];return;}return db[_0x1ab8('0x5c')][_0x1ab8('0x4f')]('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)',{'type':db[_0x1ab8('0x5c')]['QueryTypes'][_0x1ab8('0x76')]})[_0x1ab8('0x38')](function(_0x154d64){if(_0x154d64&&_0x154d64['length']){for(var _0x250bc6=0x0,_0x5e5306=_0x154d64[_0x1ab8('0x56')];_0x250bc6<_0x5e5306&&_['isNil'](_0x596a9b[_0x1ab8('0x6f')]);_0x250bc6++){if(_0x36c60d[_0x1ab8('0x75')]<=_0x154d64[_0x250bc6][_0x1ab8('0x77')]){_0x596a9b[_0x1ab8('0x6f')]=_0x154d64[_0x250bc6][_0x1ab8('0x77')];}else if(_0x36c60d[_0x1ab8('0x75')]>_0x154d64[_0x250bc6][_0x1ab8('0x77')]&&_0x36c60d[_0x1ab8('0x75')]<=_0x154d64[_0x250bc6]['to']){_0x596a9b[_0x1ab8('0x6f')]=_0x36c60d[_0x1ab8('0x75')];}}}if(_[_0x1ab8('0x78')](_0x596a9b[_0x1ab8('0x6f')])){_0x596a9b[_0x1ab8('0x6f')]=_0x6c72a8+0x1;}return _0x561bc9(_0x596a9b);});});})[_0x1ab8('0x63')](function(_0x25941b){_0x534a88(_0x25941b);});});}function updateUser(_0xacb7da){return new BPromise(function(_0x2c73cd,_0x38ea13){try{if(_0xacb7da['voicemail']){_0xacb7da[_0x1ab8('0x79')]=_0xacb7da[_0x1ab8('0x6f')];_0xacb7da[_0x1ab8('0x7a')]={'mailbox':_0xacb7da[_0x1ab8('0x6f')],'password':_0xacb7da[_0x1ab8('0x4e')],'fullname':_0xacb7da['fullname'],'email':_0xacb7da[_0x1ab8('0x7b')]};}if(_0xacb7da[_0x1ab8('0x43')]===_0x1ab8('0x3c')){if(!_0xacb7da[_0x1ab8('0x7c')])_0xacb7da[_0x1ab8('0x7c')]=[_0x1ab8('0x7d'),'102',_0x1ab8('0x7e'),_0x1ab8('0x7f'),_0x1ab8('0x80'),_0x1ab8('0x81'),_0x1ab8('0x82'),_0x1ab8('0x83'),_0x1ab8('0x84'),_0x1ab8('0x85'),_0x1ab8('0x86'),_0x1ab8('0x87'),_0x1ab8('0x88'),_0x1ab8('0x89')];}_0x2c73cd(_0xacb7da);}catch(_0x4a2e55){_0x38ea13(_0x4a2e55);}});}exports['create']=function(_0x2b5436,_0x38beb0){if(_0x2b5436[_0x1ab8('0x3b')][_0x1ab8('0x43')]===_0x1ab8('0x3c'))throw new Error('Unauthorized');if(_0x2b5436[_0x1ab8('0x6a')][_0x1ab8('0x43')]==='user'&&_0x2b5436[_0x1ab8('0x3b')][_0x1ab8('0x43')]!==_0x1ab8('0x39')){throw new Error(_0x1ab8('0x8a'));}if(_0x2b5436[_0x1ab8('0x6a')][_0x1ab8('0x43')]==='admin'&&_0x2b5436[_0x1ab8('0x3b')][_0x1ab8('0x43')]!==_0x1ab8('0x39')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x1ab8('0x8b')]([_0x2b5436[_0x1ab8('0x6a')]])[_0x1ab8('0x38')](function(){return validateUser(_0x2b5436['body']);})[_0x1ab8('0x38')](function(_0x2b22de){return updateUser(_0x2b22de)['then'](function(_0x1d1ec4){if(_0x1d1ec4['role']===_0x1ab8('0x39')){_0x1d1ec4[_0x1ab8('0x8c')]=_0x2b5436['user']['settingsEnabled'];delete _0x1d1ec4[_0x1ab8('0x8d')];}return _0x1d1ec4;});})[_0x1ab8('0x38')](function(_0x50fd57){return db[_0x1ab8('0x49')][_0x1ab8('0x8e')](_0x50fd57,{'include':[{'model':db['VoiceMail'],'as':_0x1ab8('0x7a')}]});})['then'](function(_0x19603b){if(_0x2b5436[_0x1ab8('0x6a')][_0x1ab8('0x43')]===_0x1ab8('0x3b'))return _0x19603b;if(_0x2b5436['user'][_0x1ab8('0x43')]!==_0x1ab8('0x3b'))return _0x19603b;return db[_0x1ab8('0x8f')]['find']({'where':{'name':_0x19603b[_0x1ab8('0x43')]===_0x1ab8('0x3c')?_0x1ab8('0x90'):'Telephones','userProfileId':_0x2b5436['user'][_0x1ab8('0x8d')]},'raw':!![]})['then'](function(_0x42c130){if(!_0x42c130||_0x42c130[_0x1ab8('0x91')]!=0x0)return _0x19603b;return db['UserProfileResource'][_0x1ab8('0x8e')]({'name':_0x19603b[_0x1ab8('0x45')],'resourceId':_0x19603b['id'],'type':_0x42c130['name'],'sectionId':_0x42c130['id']},{})[_0x1ab8('0x38')](function(){return _0x19603b;});})[_0x1ab8('0x63')](function(_0x596938){logger[_0x1ab8('0x29')](_0x1ab8('0x92'),_0x596938);throw _0x596938;});})['then'](respondWithResult(_0x38beb0,0xc9))[_0x1ab8('0x63')](handleError(_0x38beb0,null));};exports[_0x1ab8('0x93')]=function(_0x5e7db0,_0x15873f){var _0x25ada7=_0x5e7db0[_0x1ab8('0x6a')];var _0x530064=[];if(_0x5e7db0['user'][_0x1ab8('0x43')]===_0x1ab8('0x3c'))throw new Error(_0x1ab8('0x94'));if(_[_0x1ab8('0x95')](_0x25ada7,[_0x1ab8('0x43'),_0x1ab8('0x3b')])&&_0x5e7db0['user'][_0x1ab8('0x43')]!==_0x1ab8('0x39')){throw new Error(_0x1ab8('0x8a'));}if(_[_0x1ab8('0x95')](_0x25ada7,[_0x1ab8('0x43'),'admin'])&&_0x5e7db0[_0x1ab8('0x3b')][_0x1ab8('0x43')]!==_0x1ab8('0x39')){throw new Error(_0x1ab8('0x96'));}return licenseUtil[_0x1ab8('0x8b')](_0x25ada7)[_0x1ab8('0x38')](function(){return validateUser(_0x25ada7[0x0]);})[_0x1ab8('0x38')](function(){for(var _0x21f0de=0x1;_0x21f0de<_0x25ada7['length'];_0x21f0de++){var _0x248620=_0x25ada7[_0x21f0de-0x1][_0x1ab8('0x6f')];if(!_0x25ada7[_0x21f0de][_0x1ab8('0x6f')])_0x25ada7[_0x21f0de][_0x1ab8('0x6f')]=_0x248620+0x1;_0x530064[_0x1ab8('0x97')](validateUser(_0x25ada7[_0x21f0de]));}return BPromise['all'](_0x530064);})[_0x1ab8('0x38')](function(){_0x530064=[];for(var _0x3bf7e0=0x0;_0x3bf7e0<_0x25ada7[_0x1ab8('0x56')];_0x3bf7e0++){_0x530064[_0x1ab8('0x97')](updateUser(_0x25ada7[_0x3bf7e0]));}return BPromise[_0x1ab8('0x98')](_0x530064);})[_0x1ab8('0x38')](function(){return BPromise[_0x1ab8('0x99')](_0x25ada7,function(_0x4d6d2e){return db[_0x1ab8('0x49')][_0x1ab8('0x8e')](_0x4d6d2e,{'include':[{'model':db[_0x1ab8('0x7a')],'as':_0x1ab8('0x7a')}]})[_0x1ab8('0x38')](function(_0x8f4c55){_0x4d6d2e['id']=_0x8f4c55['id'];return _0x4d6d2e;});});})['then'](function(_0x462812){if(_0x5e7db0[_0x1ab8('0x6a')][_0x1ab8('0x43')]===_0x1ab8('0x3b'))return _0x462812;if(_0x5e7db0[_0x1ab8('0x3b')][_0x1ab8('0x43')]!==_0x1ab8('0x3b'))return _0x462812;var _0x33458c=_[_0x1ab8('0x95')](_0x462812,function(_0x10edf3){return _0x10edf3['role']==='agent'||_0x10edf3['role']==='telephone';});if(!_0x33458c)return _0x462812;return db[_0x1ab8('0x8f')][_0x1ab8('0x61')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x5e7db0['user'][_0x1ab8('0x8d')]},'raw':!![]})[_0x1ab8('0x38')](function(_0x3bdd3a){if(_['isEmpty'](_0x3bdd3a)||!_['some'](_0x3bdd3a,[_0x1ab8('0x91'),0x0]))return _0x462812;_0x530064=[];var _0xeb267b=_(_0x3bdd3a)[_0x1ab8('0x41')](function(_0x59fd6f){if(_0x59fd6f['autoAssociation']===0x1)return;return _0x59fd6f['name']===_0x1ab8('0x90')?_0x1ab8('0x3c'):'telephone';})[_0x1ab8('0x9a')]()['value']();for(var _0x1b1ac1=0x0;_0x1b1ac1<_0x462812[_0x1ab8('0x56')];_0x1b1ac1++){if(!_[_0x1ab8('0x9b')](_0xeb267b,_0x462812[_0x1b1ac1][_0x1ab8('0x43')]))return;var _0x4da99f=_0x462812[_0x1b1ac1][_0x1ab8('0x43')]===_0x1ab8('0x3c')?_0x1ab8('0x90'):'Telephones';_0x530064[_0x1ab8('0x97')](db['UserProfileResource'][_0x1ab8('0x8e')]({'name':_0x462812[_0x1b1ac1][_0x1ab8('0x45')],'resourceId':_0x462812[_0x1b1ac1]['id'],'type':_0x4da99f,'sectionId':_['find'](_0x3bdd3a,['name',_0x4da99f])['id']},{}));}return BPromise[_0x1ab8('0x98')](_0x530064);})[_0x1ab8('0x38')](respondWithResult(_0x15873f,0xc9))['catch'](handleError(_0x15873f,null));});};exports[_0x1ab8('0x9c')]=function(_0x1eabcd,_0x1fc36c,_0x565263){if(_0x1eabcd[_0x1ab8('0x6a')]['id']){delete _0x1eabcd[_0x1ab8('0x6a')]['id'];}return db['User'][_0x1ab8('0x44')]({'where':{'id':_0x1eabcd['params']['id']}})[_0x1ab8('0x38')](function(_0x43930b){if(!_0x43930b)return null;if(_0x43930b['id']===_0x1eabcd[_0x1ab8('0x3b')]['id']){if(!_0x1eabcd[_0x1ab8('0x6a')][_0x1ab8('0x9d')]||!_0x1eabcd[_0x1ab8('0x6a')][_0x1ab8('0x9e')]){throw new db[(_0x1ab8('0x9f'))][(_0x1ab8('0xa0'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x43930b[_0x1ab8('0xa1')](_0x1eabcd[_0x1ab8('0x6a')][_0x1ab8('0x9d')])){throw new db[(_0x1ab8('0x9f'))][(_0x1ab8('0xa0'))](_0x1ab8('0xa2'));}if(_0x1eabcd['body'][_0x1ab8('0x9d')]===_0x1eabcd[_0x1ab8('0x6a')]['newPassword']){throw new db[(_0x1ab8('0x9f'))]['ValidationError'](_0x1ab8('0xa3'));}}else if(_0x1eabcd[_0x1ab8('0x3b')]['role']===_0x1ab8('0x39')){if(!_0x1eabcd['body'][_0x1ab8('0x9e')]){throw new db[(_0x1ab8('0x9f'))][(_0x1ab8('0xa0'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x1eabcd['user'][_0x1ab8('0x43')]===_0x1ab8('0x3b')){if(!_0x1eabcd[_0x1ab8('0x6a')]['newPassword']){throw new db[(_0x1ab8('0x9f'))][(_0x1ab8('0xa0'))](_0x1ab8('0xa4'));}if(_0x43930b[_0x1ab8('0x43')]!==_0x1ab8('0x3c')){throw new db['Sequelize'][(_0x1ab8('0xa0'))](_0x1ab8('0x94'));}}else{throw new db['Sequelize'][(_0x1ab8('0xa0'))](_0x1ab8('0x94'));}return _0x43930b;})[_0x1ab8('0x38')](handleEntityNotFound(_0x1fc36c,null))['then'](function(_0x559e45){return db[_0x1ab8('0x70')][_0x1ab8('0xa5')]({'attributes':['id',_0x1ab8('0x72'),'enforcePasswordHistory',_0x1ab8('0xa6')]})[_0x1ab8('0x38')](function(_0x1eae5a){if(_0x1eae5a['securePassword'])authService['validatePasswordPattern'](_0x1eabcd[_0x1ab8('0x6a')][_0x1ab8('0x9e')]);if(!_0x1eae5a[_0x1ab8('0xa7')]||!_0x559e45[_0x1ab8('0xa8')])return _0x559e45;authService[_0x1ab8('0xa9')](_0x1eabcd[_0x1ab8('0x6a')]['newPassword'],_0x559e45[_0x1ab8('0xa8')],_0x1eae5a[_0x1ab8('0xa6')]);return _0x559e45;})[_0x1ab8('0x38')](saveUpdates({'password':_0x1eabcd[_0x1ab8('0x6a')][_0x1ab8('0x9e')],'passwordResetAt':_0x1eabcd[_0x1ab8('0x3b')]['id']==_0x1eabcd[_0x1ab8('0x65')]['id']?moment():null,'previousPasswords':authService[_0x1ab8('0xaa')](_0x1eabcd[_0x1ab8('0x6a')][_0x1ab8('0x9e')],_0x559e45[_0x1ab8('0xa8')])},null));})[_0x1ab8('0x38')](respondWithResult(_0x1fc36c,null))['catch'](handleError(_0x1fc36c,null));};exports[_0x1ab8('0xab')]=function(_0x35502d,_0xcff902,_0x2a7439){var _0x514ac5=_0x35502d[_0x1ab8('0x6a')]['channel'];return db[_0x1ab8('0x49')][_0x1ab8('0x44')]({'where':{'id':_0x35502d[_0x1ab8('0x65')]['id']},'attributes':['id',_0x1ab8('0x45'),_0x1ab8('0x43'),_0x1ab8('0xac'),_0x1ab8('0xad'),_0x1ab8('0xae'),_0x1ab8('0xaf')]})['then'](handleEntityNotFound(_0xcff902,null))[_0x1ab8('0x38')](function(_0x91df5c){if(_0x91df5c){if(!utils[_0x1ab8('0xb0')](_0x514ac5)){throw new db[(_0x1ab8('0x9f'))]['ValidationError'](_0x1ab8('0xb1'));}return _0x91df5c[_0x1ab8('0xb2')+_[_0x1ab8('0xb3')](_0x514ac5[_0x1ab8('0xb4')]())+_0x1ab8('0xb5')](_0x35502d['body'][_0x1ab8('0x6e')],{'penalty':_0x35502d[_0x1ab8('0x6a')][_0x1ab8('0xb6')]||0x0})['spread'](function(_0xd6162b){for(var _0x3d148a=0x0;_0x3d148a<_0x35502d[_0x1ab8('0x6a')][_0x1ab8('0x6e')][_0x1ab8('0x56')];_0x3d148a+=0x1){var _0x1b91b4={'UserId':_0x35502d[_0x1ab8('0x65')]['id']};_0x1b91b4[_[_0x1ab8('0xb3')](_0x514ac5[_0x1ab8('0xb4')]())+_0x1ab8('0xb7')]=_0x35502d[_0x1ab8('0x6a')]['ids'][_0x3d148a];socket[_0x1ab8('0xb8')](_0x1ab8('0x3b')+_['capitalize'](_0x514ac5[_0x1ab8('0xb4')]())+'Queue:save',_0x1b91b4);}return _0xd6162b;})[_0x1ab8('0x38')](function(){if(_0x514ac5===_0x1ab8('0xb9')){return db[_0x1ab8('0xba')]['findAll']({'where':{'id':_0x35502d['body']['ids']||[]},'raw':!![],'attributes':['id',_0x1ab8('0x45')]});}})[_0x1ab8('0x38')](function(_0x3fd068){var _0x2c8cd8=_0x91df5c[_0x1ab8('0xbb')]({'plain':!![]});var _0x355be6=[];if(_0x514ac5==='voice'&&_0x2c8cd8[_0x1ab8('0x43')]===_0x1ab8('0x3c')&&_0x2c8cd8[_0x1ab8('0xac')]){for(var _0x456a3f=0x0;_0x456a3f<_0x3fd068[_0x1ab8('0x56')];_0x456a3f+=0x1){_0x355be6[_0x1ab8('0x97')]({'membername':_0x2c8cd8[_0x1ab8('0x45')],'UserId':_0x2c8cd8['id'],'queue_name':_0x3fd068[_0x456a3f][_0x1ab8('0x45')],'VoiceQueueId':_0x3fd068[_0x456a3f]['id'],'interface':_[_0x1ab8('0x78')](_0x2c8cd8[_0x1ab8('0xaf')])?util[_0x1ab8('0xbc')]('SIP/%s',_0x2c8cd8[_0x1ab8('0x45')]):_0x2c8cd8[_0x1ab8('0xaf')],'paused':_0x2c8cd8[_0x1ab8('0xae')]||![],'penalty':_0x35502d[_0x1ab8('0x6a')][_0x1ab8('0xb6')]||0x0});}return BPromise[_0x1ab8('0x99')](_0x355be6,function(_0x4b9c28){return db[_0x1ab8('0xbd')][_0x1ab8('0xbe')](_0x4b9c28);});}return _0x91df5c;});}})[_0x1ab8('0x38')](respondWithStatusCode(_0xcff902,null))[_0x1ab8('0x63')](handleError(_0xcff902,null));};exports[_0x1ab8('0xbf')]=function(_0x2451c8,_0x3b17fa,_0x4f9a94){var _0x190fd2;return db[_0x1ab8('0x49')][_0x1ab8('0x44')]({'where':{'id':_0x2451c8[_0x1ab8('0x65')]['id']},'attributes':['id','name',_0x1ab8('0x43')]})[_0x1ab8('0x38')](handleEntityNotFound(_0x3b17fa,null))[_0x1ab8('0x38')](function(_0x270547){if(_0x270547){_0x190fd2=_0x270547;if(!_0x2451c8[_0x1ab8('0x4f')][_0x1ab8('0xc0')]||!utils['isValidChannel'](_0x2451c8['query'][_0x1ab8('0xc0')])){throw new db[(_0x1ab8('0x9f'))]['ValidationError'](_0x1ab8('0xb1'));}return _0x270547[_0x1ab8('0xc1')+_[_0x1ab8('0xb3')](_0x2451c8[_0x1ab8('0x4f')][_0x1ab8('0xc0')][_0x1ab8('0xb4')]())+_0x1ab8('0xb5')](_0x2451c8[_0x1ab8('0x4f')][_0x1ab8('0x6e')]);}})[_0x1ab8('0x38')](function(_0x21983a){for(var _0x382b60=0x0;_0x382b60<_0x2451c8['query']['ids'][_0x1ab8('0x56')];_0x382b60+=0x1){var _0x23286f={'UserId':_0x2451c8['params']['id']};_0x23286f[_['capitalize'](_0x2451c8[_0x1ab8('0x4f')][_0x1ab8('0xc0')][_0x1ab8('0xb4')]())+_0x1ab8('0xb7')]=_0x2451c8[_0x1ab8('0x4f')][_0x1ab8('0x6e')][_0x382b60];socket[_0x1ab8('0xb8')](_0x1ab8('0x3b')+_[_0x1ab8('0xb3')](_0x2451c8[_0x1ab8('0x4f')][_0x1ab8('0xc0')][_0x1ab8('0xb4')]())+_0x1ab8('0xc2'),_0x23286f);}return _0x21983a;})[_0x1ab8('0x38')](function(){if(_0x2451c8[_0x1ab8('0x4f')][_0x1ab8('0xc0')]==='voice'){return db[_0x1ab8('0xbd')][_0x1ab8('0xc3')]({'where':{'UserId':_0x2451c8[_0x1ab8('0x65')]['id'],'VoiceQueueId':_0x2451c8[_0x1ab8('0x4f')][_0x1ab8('0x6e')]},'individualHooks':!![]})['then'](function(){return _0x190fd2;});}return _0x190fd2;})['then'](respondWithStatusCode(_0x3b17fa,null))[_0x1ab8('0x63')](handleError(_0x3b17fa,null));};exports[_0x1ab8('0xc4')]=function(_0x79fc4f,_0x2a9bda,_0x401c43){_0x79fc4f[_0x1ab8('0x6a')][_0x1ab8('0xc5')]=_0x79fc4f[_0x1ab8('0xc6')]['filename'];return db['User'][_0x1ab8('0x44')]({'where':{'id':_0x79fc4f[_0x1ab8('0x65')]['id']}})[_0x1ab8('0x38')](handleEntityNotFound(_0x2a9bda,null))[_0x1ab8('0x38')](saveUpdates(_0x79fc4f[_0x1ab8('0x6a')],null))[_0x1ab8('0x38')](respondWithResult(_0x2a9bda,null))[_0x1ab8('0x63')](handleError(_0x2a9bda,null));};exports[_0x1ab8('0xc7')]=function(_0x461e2a,_0x70bbab,_0x5f06f2){var _0x5361de=path[_0x1ab8('0xc8')](config[_0x1ab8('0xc9')],_0x1ab8('0xca'));return db['User'][_0x1ab8('0x44')]({'where':{'id':_0x461e2a[_0x1ab8('0x65')]['id']},'attributes':['id',_0x1ab8('0xc5')],'raw':!![]})[_0x1ab8('0x38')](handleEntityNotFound(_0x70bbab,null))[_0x1ab8('0x38')](function(_0x31db2e){if(_0x31db2e){if(_[_0x1ab8('0x78')](_0x31db2e[_0x1ab8('0xc5')])){return _0x70bbab[_0x1ab8('0xcb')](_0x5361de);}else{if(!fs[_0x1ab8('0xcc')](path['join'](config[_0x1ab8('0xc9')],'server/files/images/',_0x31db2e[_0x1ab8('0xc5')]))){return _0x70bbab['download'](_0x5361de);}return _0x70bbab[_0x1ab8('0xcb')](path[_0x1ab8('0xc8')](config['root'],_0x1ab8('0xcd'),_0x31db2e[_0x1ab8('0xc5')]));}}})[_0x1ab8('0x63')](handleError(_0x70bbab,null));};exports[_0x1ab8('0xce')]=function(_0x21f958,_0xef3bfd,_0x59aa66){var _0x14dc8d={};var _0x493bd8={};var _0x2911f2;var _0x1cb37a;return db[_0x1ab8('0x49')][_0x1ab8('0xa5')]({'where':{'id':_0x21f958[_0x1ab8('0x65')]['id']}})['then'](handleEntityNotFound(_0xef3bfd,null))['then'](function(_0x5b92c2){if(_0x5b92c2){_0x2911f2=_0x5b92c2;_0x493bd8['model']=_['keys'](db['CmContact']['rawAttributes']);_0x493bd8['query']=_[_0x1ab8('0x50')](_0x21f958['query']);_0x493bd8[_0x1ab8('0x51')]=_['intersection'](_0x493bd8['model'],_0x493bd8[_0x1ab8('0x4f')]);_0x14dc8d[_0x1ab8('0x54')]=_[_0x1ab8('0x52')](_0x493bd8[_0x1ab8('0x53')],qs[_0x1ab8('0x55')](_0x21f958[_0x1ab8('0x4f')][_0x1ab8('0x55')]));_0x14dc8d['attributes']=_0x14dc8d[_0x1ab8('0x54')][_0x1ab8('0x56')]?_0x14dc8d[_0x1ab8('0x54')]:_0x493bd8[_0x1ab8('0x53')];_0x14dc8d[_0x1ab8('0xcf')]=qs[_0x1ab8('0x57')](_0x21f958[_0x1ab8('0x4f')][_0x1ab8('0x57')]);_0x14dc8d['where']=qs[_0x1ab8('0x51')](_[_0x1ab8('0x59')](_0x21f958[_0x1ab8('0x4f')],_0x493bd8[_0x1ab8('0x51')]));if(_0x21f958[_0x1ab8('0x4f')][_0x1ab8('0x3f')]){_0x14dc8d[_0x1ab8('0x58')]=_[_0x1ab8('0x5a')](_0x14dc8d[_0x1ab8('0x58')],{'$or':_['map'](_0x14dc8d[_0x1ab8('0x54')],function(_0x29454f){var _0x27dce0={};_0x27dce0[_0x29454f]={'$like':'%'+_0x21f958[_0x1ab8('0x4f')][_0x1ab8('0x3f')]+'%'};return _0x27dce0;})});}_0x14dc8d=_['merge']({},_0x14dc8d,_0x21f958['options']);return _0x2911f2[_0x1ab8('0xce')](_0x14dc8d);}})[_0x1ab8('0x38')](function(_0x1da8bf){if(_0x1da8bf){_0x1cb37a=_0x1da8bf[_0x1ab8('0x56')];if(_0x21f958['query'][_0x1ab8('0xd0')]('includeAll')){_0x14dc8d['include']=[{'model':db[_0x1ab8('0xd1')],'as':_0x1ab8('0xd2'),'required':![]},{'model':db[_0x1ab8('0xd3')],'as':_0x1ab8('0xd4'),'attributes':['id','name',_0x1ab8('0xd5')],'where':_0x21f958[_0x1ab8('0x4f')]['tag']?{'id':_0x21f958[_0x1ab8('0x4f')][_0x1ab8('0xd6')]}:undefined,'required':_0x21f958[_0x1ab8('0x4f')][_0x1ab8('0xd6')]?!![]:![]}];}if(!_0x21f958[_0x1ab8('0x4f')][_0x1ab8('0xd0')]('nolimit')){_0x14dc8d['limit']=qs[_0x1ab8('0x33')](_0x21f958['query'][_0x1ab8('0x33')]);_0x14dc8d[_0x1ab8('0x32')]=qs[_0x1ab8('0x32')](_0x21f958[_0x1ab8('0x4f')][_0x1ab8('0x32')]);}return _0x2911f2[_0x1ab8('0xce')](_0x14dc8d);}})[_0x1ab8('0x38')](function(_0x4308d6){if(_0x4308d6){return _0x4308d6?{'count':_0x1cb37a,'rows':_0x4308d6}:null;}})[_0x1ab8('0x38')](respondWithResult(_0xef3bfd,null))[_0x1ab8('0x63')](handleError(_0xef3bfd,null));};exports['getQueues']=function(_0x3e5c5e,_0x25111b,_0x574c2e){var _0xcdd7fc;var _0x4ed14c;var _0x251556={};var _0x5e1658;return db[_0x1ab8('0x49')][_0x1ab8('0xa5')]({'where':{'id':_0x3e5c5e[_0x1ab8('0x65')]['id']},'attributes':['id',_0x1ab8('0x45'),_0x1ab8('0x43')]})['then'](handleEntityNotFound(_0x25111b,null))[_0x1ab8('0x38')](function(_0x4ae57c){if(!utils[_0x1ab8('0xb0')](_0x3e5c5e[_0x1ab8('0x4f')][_0x1ab8('0xc0')])){throw new db[(_0x1ab8('0x9f'))][(_0x1ab8('0xa0'))](_0x1ab8('0xb1'));}_0xcdd7fc=_0x4ae57c;var _0x296fe2={};_0x296fe2[_0x1ab8('0x53')]=_[_0x1ab8('0x50')](db[_['capitalize'](_0x3e5c5e[_0x1ab8('0x4f')][_0x1ab8('0xc0')])+_0x1ab8('0xd7')][_0x1ab8('0x4a')]);_0x296fe2[_0x1ab8('0x4f')]=_[_0x1ab8('0x50')](_0x3e5c5e[_0x1ab8('0x4f')]);_0x296fe2['filters']=_[_0x1ab8('0x52')](_0x296fe2[_0x1ab8('0x53')],_0x296fe2[_0x1ab8('0x4f')]);_0x251556['attributes']=_[_0x1ab8('0x52')](_0x296fe2[_0x1ab8('0x53')],qs['fields'](_0x3e5c5e[_0x1ab8('0x4f')][_0x1ab8('0x55')]));_0x251556[_0x1ab8('0x54')]=_0x251556['attributes'][_0x1ab8('0x56')]?_0x251556[_0x1ab8('0x54')]:_0x296fe2['model'];_0x251556[_0x1ab8('0xcf')]=qs['sort'](_0x3e5c5e[_0x1ab8('0x4f')][_0x1ab8('0x57')]);_0x251556['where']=qs[_0x1ab8('0x51')](_['pick'](_0x3e5c5e[_0x1ab8('0x4f')],_0x296fe2['filters']));if(_0x3e5c5e[_0x1ab8('0x4f')][_0x1ab8('0x3f')]){_0x251556[_0x1ab8('0x58')]=_['merge'](_0x251556['where'],{'$or':_[_0x1ab8('0x41')](_0x251556[_0x1ab8('0x54')],function(_0x44716d){var _0x3813cd={};_0x3813cd[_0x44716d]={'$like':'%'+_0x3e5c5e[_0x1ab8('0x4f')][_0x1ab8('0x3f')]+'%'};return _0x3813cd;})});}_0x251556=_[_0x1ab8('0x5a')]({},_0x251556,_0x3e5c5e[_0x1ab8('0x68')]);switch(_0xcdd7fc[_0x1ab8('0x43')]){case _0x1ab8('0x39'):return db[_['capitalize'](_0x3e5c5e[_0x1ab8('0x4f')][_0x1ab8('0xc0')])+_0x1ab8('0xd7')][_0x1ab8('0x61')](_0x251556);case'user':case'agent':return _0xcdd7fc['get'+_[_0x1ab8('0xb3')](_0x3e5c5e['query']['channel'])+'Queues'](_0x251556);default:throw new db[(_0x1ab8('0x9f'))][(_0x1ab8('0xa0'))](_0x1ab8('0xd8'));}})[_0x1ab8('0x38')](function(_0x32a1b6){_0x5e1658=_0x32a1b6[_0x1ab8('0x56')];if(!_0x3e5c5e[_0x1ab8('0x4f')][_0x1ab8('0xd0')]('nolimit')){_0x251556[_0x1ab8('0x33')]=qs[_0x1ab8('0x33')](_0x3e5c5e[_0x1ab8('0x4f')][_0x1ab8('0x33')]);_0x251556[_0x1ab8('0x32')]=qs['offset'](_0x3e5c5e[_0x1ab8('0x4f')][_0x1ab8('0x32')]);}switch(_0xcdd7fc[_0x1ab8('0x43')]){case _0x1ab8('0x39'):return db[_[_0x1ab8('0xb3')](_0x3e5c5e[_0x1ab8('0x4f')][_0x1ab8('0xc0')])+'Queue'][_0x1ab8('0x61')](_0x251556);case _0x1ab8('0x3b'):case _0x1ab8('0x3c'):return _0xcdd7fc['get'+_[_0x1ab8('0xb3')](_0x3e5c5e['query'][_0x1ab8('0xc0')])+_0x1ab8('0xb5')](_0x251556);}})[_0x1ab8('0x38')](function(_0x1c97f3){return{'count':_0x5e1658,'rows':_0x1c97f3};})[_0x1ab8('0x38')](respondWithResult(_0x25111b,null))[_0x1ab8('0x63')](handleError(_0x25111b,null));};exports[_0x1ab8('0xd9')]=function(_0x43e19d,_0x489acc,_0x460ea4){var _0xb0fd02={};var _0x553e02={};var _0x8557d7;var _0x3f6bc9;return db[_0x1ab8('0x49')]['findOne']({'where':{'id':_0x43e19d['params']['id']}})[_0x1ab8('0x38')](handleEntityNotFound(_0x489acc,null))['then'](function(_0x42f971){if(_0x42f971){_0x8557d7=_0x42f971;_0x553e02[_0x1ab8('0x53')]=_[_0x1ab8('0x50')](db[_0x1ab8('0xbd')][_0x1ab8('0x4a')]);_0x553e02[_0x1ab8('0x4f')]=_['keys'](_0x43e19d['query']);_0x553e02[_0x1ab8('0x51')]=_['intersection'](_0x553e02['model'],_0x553e02[_0x1ab8('0x4f')]);_0xb0fd02[_0x1ab8('0x54')]=_['intersection'](_0x553e02[_0x1ab8('0x53')],qs[_0x1ab8('0x55')](_0x43e19d['query']['fields']));_0xb0fd02[_0x1ab8('0x54')]=_0xb0fd02[_0x1ab8('0x54')][_0x1ab8('0x56')]?_0xb0fd02['attributes']:_0x553e02['model'];_0xb0fd02[_0x1ab8('0xcf')]=qs[_0x1ab8('0x57')](_0x43e19d[_0x1ab8('0x4f')][_0x1ab8('0x57')]);_0xb0fd02['where']=qs['filters'](_[_0x1ab8('0x59')](_0x43e19d[_0x1ab8('0x4f')],_0x553e02[_0x1ab8('0x51')]));if(_0x43e19d[_0x1ab8('0x4f')][_0x1ab8('0x3f')]){_0xb0fd02[_0x1ab8('0x58')]=_[_0x1ab8('0x5a')](_0xb0fd02[_0x1ab8('0x58')],{'$or':_['map'](_0xb0fd02[_0x1ab8('0x54')],function(_0x42f81c){var _0x257cb5={};_0x257cb5[_0x42f81c]={'$like':'%'+_0x43e19d[_0x1ab8('0x4f')][_0x1ab8('0x3f')]+'%'};return _0x257cb5;})});}_0xb0fd02=_[_0x1ab8('0x5a')]({},_0xb0fd02,_0x43e19d[_0x1ab8('0x68')]);return _0x8557d7[_0x1ab8('0xd9')](_0xb0fd02);}})[_0x1ab8('0x38')](function(_0x5bab33){if(_0x5bab33){_0x3f6bc9=_0x5bab33[_0x1ab8('0x56')];if(!_0x43e19d[_0x1ab8('0x4f')][_0x1ab8('0xd0')](_0x1ab8('0xda'))){_0xb0fd02[_0x1ab8('0x33')]=qs['limit'](_0x43e19d[_0x1ab8('0x4f')]['limit']);_0xb0fd02[_0x1ab8('0x32')]=qs[_0x1ab8('0x32')](_0x43e19d[_0x1ab8('0x4f')][_0x1ab8('0x32')]);}return _0x8557d7[_0x1ab8('0xd9')](_0xb0fd02);}})[_0x1ab8('0x38')](function(_0x31e46a){if(_0x31e46a){return _0x31e46a?{'count':_0x3f6bc9,'rows':_0x31e46a}:null;}})['then'](respondWithResult(_0x489acc,null))[_0x1ab8('0x63')](handleError(_0x489acc,null));};exports[_0x1ab8('0xdb')]=function(_0x411a8a,_0x77555b,_0x37590d){var _0x3390f={};var _0x21e253={};var _0xb46a02;var _0x433d4d;return db['User'][_0x1ab8('0xa5')]({'where':{'id':_0x411a8a[_0x1ab8('0x65')]['id']}})[_0x1ab8('0x38')](handleEntityNotFound(_0x77555b,null))[_0x1ab8('0x38')](function(_0xabdbb9){if(_0xabdbb9){_0xb46a02=_0xabdbb9;_0x21e253['model']=_[_0x1ab8('0x50')](db[_0x1ab8('0xdc')][_0x1ab8('0x4a')]);_0x21e253[_0x1ab8('0x4f')]=_['keys'](_0x411a8a[_0x1ab8('0x4f')]);_0x21e253['filters']=_[_0x1ab8('0x52')](_0x21e253[_0x1ab8('0x53')],_0x21e253[_0x1ab8('0x4f')]);_0x3390f[_0x1ab8('0x54')]=_[_0x1ab8('0x52')](_0x21e253['model'],qs[_0x1ab8('0x55')](_0x411a8a[_0x1ab8('0x4f')][_0x1ab8('0x55')]));_0x3390f[_0x1ab8('0x54')]=_0x3390f['attributes'][_0x1ab8('0x56')]?_0x3390f[_0x1ab8('0x54')]:_0x21e253['model'];_0x3390f['order']=qs[_0x1ab8('0x57')](_0x411a8a[_0x1ab8('0x4f')][_0x1ab8('0x57')]);_0x3390f['where']=qs['filters'](_[_0x1ab8('0x59')](_0x411a8a[_0x1ab8('0x4f')],_0x21e253[_0x1ab8('0x51')]));if(_0x411a8a['query'][_0x1ab8('0x3f')]){_0x3390f['where']=_['merge'](_0x3390f[_0x1ab8('0x58')],{'$or':_[_0x1ab8('0x41')](_0x3390f['attributes'],function(_0x42b303){var _0x425800={};_0x425800[_0x42b303]={'$like':'%'+_0x411a8a[_0x1ab8('0x4f')][_0x1ab8('0x3f')]+'%'};return _0x425800;})});}_0x3390f=_[_0x1ab8('0x5a')]({},_0x3390f,_0x411a8a[_0x1ab8('0x68')]);return _0xb46a02[_0x1ab8('0xdb')](_0x3390f);}})[_0x1ab8('0x38')](function(_0x2ac97c){if(_0x2ac97c){_0x433d4d=_0x2ac97c[_0x1ab8('0x56')];if(!_0x411a8a[_0x1ab8('0x4f')][_0x1ab8('0xd0')](_0x1ab8('0xda'))){_0x3390f[_0x1ab8('0x33')]=qs[_0x1ab8('0x33')](_0x411a8a[_0x1ab8('0x4f')][_0x1ab8('0x33')]);_0x3390f['offset']=qs[_0x1ab8('0x32')](_0x411a8a[_0x1ab8('0x4f')][_0x1ab8('0x32')]);}return _0xb46a02[_0x1ab8('0xdb')](_0x3390f);}})[_0x1ab8('0x38')](function(_0x34e04){if(_0x34e04){return _0x34e04?{'count':_0x433d4d,'rows':_0x34e04}:null;}})[_0x1ab8('0x38')](respondWithResult(_0x77555b,null))[_0x1ab8('0x63')](handleError(_0x77555b,null));};exports[_0x1ab8('0xdd')]=function(_0x323b86,_0x100ce7,_0x4be476){var _0x468ab7={'raw':!![],'where':{}};var _0x585e93={};var _0x229cdf={'count':0x0,'rows':[]};return db[_0x1ab8('0x49')]['findOne']({'where':{'id':_0x323b86[_0x1ab8('0x65')]['id']}})[_0x1ab8('0x38')](handleEntityNotFound(_0x100ce7,null))['then'](function(_0x53de74){if(_0x53de74){_0x585e93[_0x1ab8('0x53')]=_['keys'](db[_0x1ab8('0xde')]['rawAttributes']);_0x585e93[_0x1ab8('0x4f')]=_[_0x1ab8('0x50')](_0x323b86[_0x1ab8('0x4f')]);_0x585e93[_0x1ab8('0x51')]=_[_0x1ab8('0x52')](_0x585e93[_0x1ab8('0x53')],_0x585e93['query']);_0x468ab7[_0x1ab8('0x54')]=_[_0x1ab8('0x52')](_0x585e93[_0x1ab8('0x53')],qs[_0x1ab8('0x55')](_0x323b86['query'][_0x1ab8('0x55')]));_0x468ab7[_0x1ab8('0x54')]=_0x468ab7[_0x1ab8('0x54')]['length']?_0x468ab7[_0x1ab8('0x54')]:_0x585e93[_0x1ab8('0x53')];if(!_0x323b86[_0x1ab8('0x4f')]['hasOwnProperty'](_0x1ab8('0xda'))){_0x468ab7['limit']=qs['limit'](_0x323b86[_0x1ab8('0x4f')][_0x1ab8('0x33')]);_0x468ab7[_0x1ab8('0x32')]=qs[_0x1ab8('0x32')](_0x323b86['query'][_0x1ab8('0x32')]);}_0x468ab7['order']=qs[_0x1ab8('0x57')](_0x323b86[_0x1ab8('0x4f')][_0x1ab8('0x57')]);_0x468ab7[_0x1ab8('0x58')]=qs[_0x1ab8('0x51')](_[_0x1ab8('0x59')](_0x323b86[_0x1ab8('0x4f')],_0x585e93[_0x1ab8('0x51')]));_0x468ab7['where'][_0x1ab8('0xdf')]=_0x53de74['id'];if(_0x323b86[_0x1ab8('0x4f')]['filter']){_0x468ab7['where']=_[_0x1ab8('0x5a')](_0x468ab7[_0x1ab8('0x58')],{'$or':_['map'](_0x468ab7[_0x1ab8('0x54')],function(_0x2587cd){var _0x2725bd={};_0x2725bd[_0x2587cd]={'$like':'%'+_0x323b86[_0x1ab8('0x4f')][_0x1ab8('0x3f')]+'%'};return _0x2725bd;})});}_0x468ab7=_[_0x1ab8('0x5a')]({},_0x468ab7,_0x323b86[_0x1ab8('0x68')]);return db[_0x1ab8('0xde')][_0x1ab8('0x31')]({'where':_0x468ab7[_0x1ab8('0x58')]})['then'](function(_0x127069){_0x229cdf[_0x1ab8('0x31')]=_0x127069;if(_0x323b86[_0x1ab8('0x4f')][_0x1ab8('0x5f')]){_0x468ab7['include']=[{'all':!![]}];}return db[_0x1ab8('0xde')][_0x1ab8('0x61')](_0x468ab7);})[_0x1ab8('0x38')](function(_0x4c076c){_0x229cdf[_0x1ab8('0x62')]=_0x4c076c;return _0x229cdf;});}})[_0x1ab8('0x38')](respondWithFilteredResult(_0x100ce7,_0x468ab7))[_0x1ab8('0x63')](handleError(_0x100ce7,null));};exports[_0x1ab8('0xe0')]=function(_0x12befa,_0x5d25ac,_0x8019ed){var _0x4b9494={'raw':!![],'where':{}};var _0x460903={};var _0x59ccc7={'count':0x0,'rows':[]};return db[_0x1ab8('0x49')][_0x1ab8('0xa5')]({'where':{'id':_0x12befa[_0x1ab8('0x65')]['id']}})[_0x1ab8('0x38')](handleEntityNotFound(_0x5d25ac,null))[_0x1ab8('0x38')](function(_0x1eacdf){if(_0x1eacdf){_0x460903[_0x1ab8('0x53')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x460903[_0x1ab8('0x4f')]=_[_0x1ab8('0x50')](_0x12befa[_0x1ab8('0x4f')]);_0x460903['filters']=_[_0x1ab8('0x52')](_0x460903['model'],_0x460903[_0x1ab8('0x4f')]);_0x4b9494[_0x1ab8('0x54')]=_[_0x1ab8('0x52')](_0x460903[_0x1ab8('0x53')],qs[_0x1ab8('0x55')](_0x12befa[_0x1ab8('0x4f')][_0x1ab8('0x55')]));_0x4b9494[_0x1ab8('0x54')]=_0x4b9494[_0x1ab8('0x54')]['length']?_0x4b9494[_0x1ab8('0x54')]:_0x460903['model'];if(!_0x12befa[_0x1ab8('0x4f')][_0x1ab8('0xd0')](_0x1ab8('0xda'))){_0x4b9494[_0x1ab8('0x33')]=qs[_0x1ab8('0x33')](_0x12befa[_0x1ab8('0x4f')][_0x1ab8('0x33')]);_0x4b9494[_0x1ab8('0x32')]=qs[_0x1ab8('0x32')](_0x12befa[_0x1ab8('0x4f')][_0x1ab8('0x32')]);}_0x4b9494[_0x1ab8('0xcf')]=qs[_0x1ab8('0x57')](_0x12befa[_0x1ab8('0x4f')][_0x1ab8('0x57')]);_0x4b9494[_0x1ab8('0x58')]=qs[_0x1ab8('0x51')](_[_0x1ab8('0x59')](_0x12befa[_0x1ab8('0x4f')],_0x460903[_0x1ab8('0x51')]));_0x4b9494[_0x1ab8('0x58')][_0x1ab8('0xdf')]=_0x1eacdf['id'];if(_0x12befa[_0x1ab8('0x4f')][_0x1ab8('0x3f')]){_0x4b9494[_0x1ab8('0x58')]=_[_0x1ab8('0x5a')](_0x4b9494['where'],{'$or':_[_0x1ab8('0x41')](_0x4b9494[_0x1ab8('0x54')],function(_0x12e2af){var _0x30076f={};_0x30076f[_0x12e2af]={'$like':'%'+_0x12befa[_0x1ab8('0x4f')]['filter']+'%'};return _0x30076f;})});}_0x4b9494=_[_0x1ab8('0x5a')]({},_0x4b9494,_0x12befa['options']);return db[_0x1ab8('0xe1')][_0x1ab8('0x31')]({'where':_0x4b9494[_0x1ab8('0x58')]})[_0x1ab8('0x38')](function(_0x5dbc15){_0x59ccc7['count']=_0x5dbc15;if(_0x12befa[_0x1ab8('0x4f')]['includeAll']){_0x4b9494[_0x1ab8('0x60')]=[{'all':!![]}];}return db[_0x1ab8('0xe1')][_0x1ab8('0x61')](_0x4b9494);})[_0x1ab8('0x38')](function(_0xb8aded){_0x59ccc7[_0x1ab8('0x62')]=_0xb8aded;return _0x59ccc7;});}})['then'](respondWithFilteredResult(_0x5d25ac,_0x4b9494))[_0x1ab8('0x63')](handleError(_0x5d25ac,null));};exports[_0x1ab8('0xe2')]=function(_0x398742,_0x48d4df,_0x424b1d){var _0x5ad73b={};var _0x362c0a={};var _0x26fb97;var _0x550425;return db[_0x1ab8('0x49')]['findOne']({'where':{'id':_0x398742[_0x1ab8('0x65')]['id']}})[_0x1ab8('0x38')](handleEntityNotFound(_0x48d4df,null))[_0x1ab8('0x38')](function(_0x136c4c){if(_0x136c4c){_0x26fb97=_0x136c4c;_0x362c0a[_0x1ab8('0x53')]=_['keys'](db[_0x1ab8('0xe3')][_0x1ab8('0x4a')]);_0x362c0a[_0x1ab8('0x4f')]=_[_0x1ab8('0x50')](_0x398742[_0x1ab8('0x4f')]);_0x362c0a[_0x1ab8('0x51')]=_[_0x1ab8('0x52')](_0x362c0a[_0x1ab8('0x53')],_0x362c0a[_0x1ab8('0x4f')]);_0x5ad73b[_0x1ab8('0x54')]=_[_0x1ab8('0x52')](_0x362c0a[_0x1ab8('0x53')],qs[_0x1ab8('0x55')](_0x398742[_0x1ab8('0x4f')][_0x1ab8('0x55')]));_0x5ad73b['attributes']=_0x5ad73b[_0x1ab8('0x54')][_0x1ab8('0x56')]?_0x5ad73b[_0x1ab8('0x54')]:_0x362c0a['model'];_0x5ad73b[_0x1ab8('0xcf')]=qs[_0x1ab8('0x57')](_0x398742[_0x1ab8('0x4f')][_0x1ab8('0x57')]);_0x5ad73b[_0x1ab8('0x58')]=qs['filters'](_[_0x1ab8('0x59')](_0x398742[_0x1ab8('0x4f')],_0x362c0a['filters']));if(_0x398742[_0x1ab8('0x4f')]['filter']){_0x5ad73b[_0x1ab8('0x58')]=_['merge'](_0x5ad73b['where'],{'$or':_[_0x1ab8('0x41')](_0x5ad73b[_0x1ab8('0x54')],function(_0x42f9d1){var _0x399b18={};_0x399b18[_0x42f9d1]={'$like':'%'+_0x398742['query'][_0x1ab8('0x3f')]+'%'};return _0x399b18;})});}_0x5ad73b=_[_0x1ab8('0x5a')]({},_0x5ad73b,_0x398742[_0x1ab8('0x68')]);return _0x26fb97['getChatInteractions'](_0x5ad73b);}})['then'](function(_0x237e06){if(_0x237e06){_0x550425=_0x237e06['length'];if(!_0x398742['query'][_0x1ab8('0xd0')](_0x1ab8('0xda'))){_0x5ad73b[_0x1ab8('0x33')]=qs['limit'](_0x398742['query']['limit']);_0x5ad73b[_0x1ab8('0x32')]=qs[_0x1ab8('0x32')](_0x398742[_0x1ab8('0x4f')][_0x1ab8('0x32')]);}return _0x26fb97[_0x1ab8('0xe2')](_0x5ad73b);}})[_0x1ab8('0x38')](function(_0x2851e6){if(_0x2851e6){return _0x2851e6?{'count':_0x550425,'rows':_0x2851e6}:null;}})['then'](respondWithResult(_0x48d4df,null))[_0x1ab8('0x63')](handleError(_0x48d4df,null));};exports[_0x1ab8('0xe4')]=function(_0x401e42,_0x4b21a1,_0x2c7537){var _0x4fa6f3={};var _0x26eb4e={};var _0x326bc0;var _0x2d7381;return db[_0x1ab8('0x49')][_0x1ab8('0xa5')]({'where':{'id':_0x401e42[_0x1ab8('0x65')]['id']}})[_0x1ab8('0x38')](handleEntityNotFound(_0x4b21a1,null))['then'](function(_0x50db35){if(_0x50db35){_0x326bc0=_0x50db35;_0x26eb4e[_0x1ab8('0x53')]=_[_0x1ab8('0x50')](db[_0x1ab8('0xe5')][_0x1ab8('0x4a')]);_0x26eb4e['query']=_[_0x1ab8('0x50')](_0x401e42[_0x1ab8('0x4f')]);_0x26eb4e[_0x1ab8('0x51')]=_[_0x1ab8('0x52')](_0x26eb4e[_0x1ab8('0x53')],_0x26eb4e[_0x1ab8('0x4f')]);_0x4fa6f3[_0x1ab8('0x54')]=_[_0x1ab8('0x52')](_0x26eb4e[_0x1ab8('0x53')],qs['fields'](_0x401e42[_0x1ab8('0x4f')]['fields']));_0x4fa6f3[_0x1ab8('0x54')]=_0x4fa6f3[_0x1ab8('0x54')][_0x1ab8('0x56')]?_0x4fa6f3[_0x1ab8('0x54')]:_0x26eb4e[_0x1ab8('0x53')];_0x4fa6f3[_0x1ab8('0xcf')]=qs[_0x1ab8('0x57')](_0x401e42[_0x1ab8('0x4f')][_0x1ab8('0x57')]);_0x4fa6f3[_0x1ab8('0x58')]=qs[_0x1ab8('0x51')](_['pick'](_0x401e42['query'],_0x26eb4e[_0x1ab8('0x51')]));if(_0x401e42['query'][_0x1ab8('0x3f')]){_0x4fa6f3[_0x1ab8('0x58')]=_[_0x1ab8('0x5a')](_0x4fa6f3[_0x1ab8('0x58')],{'$or':_[_0x1ab8('0x41')](_0x4fa6f3[_0x1ab8('0x54')],function(_0x380662){var _0x4a6de9={};_0x4a6de9[_0x380662]={'$like':'%'+_0x401e42[_0x1ab8('0x4f')][_0x1ab8('0x3f')]+'%'};return _0x4a6de9;})});}_0x4fa6f3=_[_0x1ab8('0x5a')]({},_0x4fa6f3,_0x401e42[_0x1ab8('0x68')]);return _0x326bc0[_0x1ab8('0xe4')](_0x4fa6f3);}})['then'](function(_0xdf0778){if(_0xdf0778){_0x2d7381=_0xdf0778[_0x1ab8('0x56')];if(!_0x401e42['query']['hasOwnProperty'](_0x1ab8('0xda'))){_0x4fa6f3[_0x1ab8('0x33')]=qs[_0x1ab8('0x33')](_0x401e42[_0x1ab8('0x4f')][_0x1ab8('0x33')]);_0x4fa6f3['offset']=qs[_0x1ab8('0x32')](_0x401e42[_0x1ab8('0x4f')][_0x1ab8('0x32')]);}return _0x326bc0[_0x1ab8('0xe4')](_0x4fa6f3);}})['then'](function(_0x36f257){if(_0x36f257){return _0x36f257?{'count':_0x2d7381,'rows':_0x36f257}:null;}})[_0x1ab8('0x38')](respondWithResult(_0x4b21a1,null))['catch'](handleError(_0x4b21a1,null));};exports[_0x1ab8('0xe6')]=function(_0x2f9101,_0x154078,_0x241332){var _0x3279dc={'raw':!![],'where':{}};var _0x27fc97={};var _0x2d5c5f={'count':0x0,'rows':[]};return db[_0x1ab8('0x49')][_0x1ab8('0xa5')]({'where':{'id':_0x2f9101[_0x1ab8('0x65')]['id']}})[_0x1ab8('0x38')](handleEntityNotFound(_0x154078,null))['then'](function(_0x4a6767){if(_0x4a6767){_0x27fc97[_0x1ab8('0x53')]=_[_0x1ab8('0x50')](db[_0x1ab8('0xe7')][_0x1ab8('0x4a')]);_0x27fc97[_0x1ab8('0x4f')]=_[_0x1ab8('0x50')](_0x2f9101['query']);_0x27fc97[_0x1ab8('0x51')]=_['intersection'](_0x27fc97[_0x1ab8('0x53')],_0x27fc97['query']);_0x3279dc[_0x1ab8('0x54')]=_[_0x1ab8('0x52')](_0x27fc97[_0x1ab8('0x53')],qs['fields'](_0x2f9101[_0x1ab8('0x4f')][_0x1ab8('0x55')]));_0x3279dc[_0x1ab8('0x54')]=_0x3279dc[_0x1ab8('0x54')][_0x1ab8('0x56')]?_0x3279dc[_0x1ab8('0x54')]:_0x27fc97[_0x1ab8('0x53')];if(!_0x2f9101[_0x1ab8('0x4f')]['hasOwnProperty']('nolimit')){_0x3279dc[_0x1ab8('0x33')]=qs['limit'](_0x2f9101[_0x1ab8('0x4f')][_0x1ab8('0x33')]);_0x3279dc[_0x1ab8('0x32')]=qs[_0x1ab8('0x32')](_0x2f9101[_0x1ab8('0x4f')][_0x1ab8('0x32')]);}_0x3279dc[_0x1ab8('0xcf')]=qs[_0x1ab8('0x57')](_0x2f9101[_0x1ab8('0x4f')][_0x1ab8('0x57')]);_0x3279dc['where']=qs['filters'](_[_0x1ab8('0x59')](_0x2f9101[_0x1ab8('0x4f')],_0x27fc97[_0x1ab8('0x51')]));_0x3279dc[_0x1ab8('0x58')]['UserId']=_0x4a6767['id'];if(_0x2f9101[_0x1ab8('0x4f')][_0x1ab8('0x3f')]){_0x3279dc['where']=_[_0x1ab8('0x5a')](_0x3279dc[_0x1ab8('0x58')],{'$or':_[_0x1ab8('0x41')](_0x3279dc['attributes'],function(_0x219c6e){var _0x1be169={};_0x1be169[_0x219c6e]={'$like':'%'+_0x2f9101[_0x1ab8('0x4f')]['filter']+'%'};return _0x1be169;})});}_0x3279dc=_[_0x1ab8('0x5a')]({},_0x3279dc,_0x2f9101[_0x1ab8('0x68')]);return db[_0x1ab8('0xe7')][_0x1ab8('0x31')]({'where':_0x3279dc[_0x1ab8('0x58')]})[_0x1ab8('0x38')](function(_0x3c8b12){_0x2d5c5f['count']=_0x3c8b12;if(_0x2f9101['query'][_0x1ab8('0x5f')]){_0x3279dc[_0x1ab8('0x60')]=[{'all':!![]}];}return db[_0x1ab8('0xe7')]['findAll'](_0x3279dc);})['then'](function(_0x471ff6){_0x2d5c5f['rows']=_0x471ff6;return _0x2d5c5f;});}})['then'](respondWithFilteredResult(_0x154078,_0x3279dc))[_0x1ab8('0x63')](handleError(_0x154078,null));};exports[_0x1ab8('0xe8')]=function(_0x372551,_0x2b5a6c,_0x2e48cf){var _0x59c9c9={};var _0x217350={};var _0x363fa3;var _0x3c498a;return db[_0x1ab8('0x49')]['findOne']({'where':{'id':_0x372551['params']['id']}})[_0x1ab8('0x38')](handleEntityNotFound(_0x2b5a6c,null))[_0x1ab8('0x38')](function(_0xa266f3){if(_0xa266f3){_0x363fa3=_0xa266f3;_0x217350[_0x1ab8('0x53')]=_[_0x1ab8('0x50')](db['SmsInteraction']['rawAttributes']);_0x217350[_0x1ab8('0x4f')]=_[_0x1ab8('0x50')](_0x372551[_0x1ab8('0x4f')]);_0x217350[_0x1ab8('0x51')]=_[_0x1ab8('0x52')](_0x217350[_0x1ab8('0x53')],_0x217350[_0x1ab8('0x4f')]);_0x59c9c9[_0x1ab8('0x54')]=_[_0x1ab8('0x52')](_0x217350['model'],qs[_0x1ab8('0x55')](_0x372551[_0x1ab8('0x4f')][_0x1ab8('0x55')]));_0x59c9c9[_0x1ab8('0x54')]=_0x59c9c9[_0x1ab8('0x54')]['length']?_0x59c9c9[_0x1ab8('0x54')]:_0x217350[_0x1ab8('0x53')];_0x59c9c9[_0x1ab8('0xcf')]=qs[_0x1ab8('0x57')](_0x372551['query']['sort']);_0x59c9c9[_0x1ab8('0x58')]=qs[_0x1ab8('0x51')](_[_0x1ab8('0x59')](_0x372551[_0x1ab8('0x4f')],_0x217350[_0x1ab8('0x51')]));if(_0x372551[_0x1ab8('0x4f')]['filter']){_0x59c9c9['where']=_[_0x1ab8('0x5a')](_0x59c9c9[_0x1ab8('0x58')],{'$or':_[_0x1ab8('0x41')](_0x59c9c9[_0x1ab8('0x54')],function(_0x336b8d){var _0x4a61b7={};_0x4a61b7[_0x336b8d]={'$like':'%'+_0x372551['query'][_0x1ab8('0x3f')]+'%'};return _0x4a61b7;})});}_0x59c9c9=_[_0x1ab8('0x5a')]({},_0x59c9c9,_0x372551[_0x1ab8('0x68')]);return _0x363fa3[_0x1ab8('0xe8')](_0x59c9c9);}})[_0x1ab8('0x38')](function(_0x56a760){if(_0x56a760){_0x3c498a=_0x56a760[_0x1ab8('0x56')];if(!_0x372551['query'][_0x1ab8('0xd0')](_0x1ab8('0xda'))){_0x59c9c9[_0x1ab8('0x33')]=qs[_0x1ab8('0x33')](_0x372551[_0x1ab8('0x4f')]['limit']);_0x59c9c9[_0x1ab8('0x32')]=qs[_0x1ab8('0x32')](_0x372551[_0x1ab8('0x4f')]['offset']);}return _0x363fa3[_0x1ab8('0xe8')](_0x59c9c9);}})[_0x1ab8('0x38')](function(_0x14feb5){if(_0x14feb5){return _0x14feb5?{'count':_0x3c498a,'rows':_0x14feb5}:null;}})[_0x1ab8('0x38')](respondWithResult(_0x2b5a6c,null))[_0x1ab8('0x63')](handleError(_0x2b5a6c,null));};exports[_0x1ab8('0xe9')]=function(_0x149c6b,_0x2115a0,_0x221d0b){var _0x140ae8={};var _0x4a305c={};var _0xc99d5;var _0x56ea8b;return db[_0x1ab8('0x49')][_0x1ab8('0xa5')]({'where':{'id':_0x149c6b[_0x1ab8('0x65')]['id']}})['then'](handleEntityNotFound(_0x2115a0,null))[_0x1ab8('0x38')](function(_0x200dcb){if(_0x200dcb){_0xc99d5=_0x200dcb;_0x4a305c[_0x1ab8('0x53')]=_[_0x1ab8('0x50')](db[_0x1ab8('0xea')][_0x1ab8('0x4a')]);_0x4a305c[_0x1ab8('0x4f')]=_[_0x1ab8('0x50')](_0x149c6b[_0x1ab8('0x4f')]);_0x4a305c[_0x1ab8('0x51')]=_[_0x1ab8('0x52')](_0x4a305c[_0x1ab8('0x53')],_0x4a305c[_0x1ab8('0x4f')]);_0x140ae8[_0x1ab8('0x54')]=_['intersection'](_0x4a305c['model'],qs[_0x1ab8('0x55')](_0x149c6b[_0x1ab8('0x4f')][_0x1ab8('0x55')]));_0x140ae8[_0x1ab8('0x54')]=_0x140ae8['attributes'][_0x1ab8('0x56')]?_0x140ae8['attributes']:_0x4a305c[_0x1ab8('0x53')];_0x140ae8[_0x1ab8('0xcf')]=qs['sort'](_0x149c6b[_0x1ab8('0x4f')]['sort']);_0x140ae8[_0x1ab8('0x58')]=qs['filters'](_[_0x1ab8('0x59')](_0x149c6b[_0x1ab8('0x4f')],_0x4a305c[_0x1ab8('0x51')]));if(_0x149c6b[_0x1ab8('0x4f')][_0x1ab8('0x3f')]){_0x140ae8[_0x1ab8('0x58')]=_[_0x1ab8('0x5a')](_0x140ae8[_0x1ab8('0x58')],{'$or':_['map'](_0x140ae8[_0x1ab8('0x54')],function(_0x2f13b7){var _0xb76624={};_0xb76624[_0x2f13b7]={'$like':'%'+_0x149c6b[_0x1ab8('0x4f')]['filter']+'%'};return _0xb76624;})});}_0x140ae8=_['merge']({},_0x140ae8,_0x149c6b[_0x1ab8('0x68')]);return _0xc99d5['getFaxInteractions'](_0x140ae8);}})[_0x1ab8('0x38')](function(_0x2c0cc3){if(_0x2c0cc3){_0x56ea8b=_0x2c0cc3[_0x1ab8('0x56')];if(!_0x149c6b[_0x1ab8('0x4f')]['hasOwnProperty'](_0x1ab8('0xda'))){_0x140ae8['limit']=qs[_0x1ab8('0x33')](_0x149c6b[_0x1ab8('0x4f')]['limit']);_0x140ae8[_0x1ab8('0x32')]=qs[_0x1ab8('0x32')](_0x149c6b[_0x1ab8('0x4f')][_0x1ab8('0x32')]);}return _0xc99d5[_0x1ab8('0xe9')](_0x140ae8);}})[_0x1ab8('0x38')](function(_0xdfbd80){if(_0xdfbd80){return _0xdfbd80?{'count':_0x56ea8b,'rows':_0xdfbd80}:null;}})[_0x1ab8('0x38')](respondWithResult(_0x2115a0,null))[_0x1ab8('0x63')](handleError(_0x2115a0,null));};exports[_0x1ab8('0xeb')]=function(_0x258ede,_0x8fc934,_0x1d833a){var _0x3c139d={};var _0x53a837={};var _0x34b83e;var _0x4aa909;return db[_0x1ab8('0x49')][_0x1ab8('0xa5')]({'where':{'id':_0x258ede[_0x1ab8('0x65')]['id']}})['then'](handleEntityNotFound(_0x8fc934,null))[_0x1ab8('0x38')](function(_0x56e3e2){if(_0x56e3e2){_0x34b83e=_0x56e3e2;_0x53a837[_0x1ab8('0x53')]=_[_0x1ab8('0x50')](db[_0x1ab8('0xec')][_0x1ab8('0x4a')]);_0x53a837[_0x1ab8('0x4f')]=_[_0x1ab8('0x50')](_0x258ede[_0x1ab8('0x4f')]);_0x53a837[_0x1ab8('0x51')]=_[_0x1ab8('0x52')](_0x53a837[_0x1ab8('0x53')],_0x53a837[_0x1ab8('0x4f')]);_0x3c139d[_0x1ab8('0x54')]=_[_0x1ab8('0x52')](_0x53a837['model'],qs[_0x1ab8('0x55')](_0x258ede['query'][_0x1ab8('0x55')]));_0x3c139d[_0x1ab8('0x54')]=_0x3c139d[_0x1ab8('0x54')]['length']?_0x3c139d['attributes']:_0x53a837[_0x1ab8('0x53')];_0x3c139d[_0x1ab8('0xcf')]=qs[_0x1ab8('0x57')](_0x258ede['query'][_0x1ab8('0x57')]);_0x3c139d['where']=qs[_0x1ab8('0x51')](_[_0x1ab8('0x59')](_0x258ede[_0x1ab8('0x4f')],_0x53a837[_0x1ab8('0x51')]));if(_0x258ede['query'][_0x1ab8('0x3f')]){_0x3c139d[_0x1ab8('0x58')]=_[_0x1ab8('0x5a')](_0x3c139d[_0x1ab8('0x58')],{'$or':_[_0x1ab8('0x41')](_0x3c139d[_0x1ab8('0x54')],function(_0x55f477){var _0x3cf88a={};_0x3cf88a[_0x55f477]={'$like':'%'+_0x258ede['query'][_0x1ab8('0x3f')]+'%'};return _0x3cf88a;})});}_0x3c139d=_[_0x1ab8('0x5a')]({},_0x3c139d,_0x258ede['options']);return _0x34b83e['getWhatsappInteractions'](_0x3c139d);}})[_0x1ab8('0x38')](function(_0x402aca){if(_0x402aca){_0x4aa909=_0x402aca[_0x1ab8('0x56')];if(!_0x258ede[_0x1ab8('0x4f')][_0x1ab8('0xd0')](_0x1ab8('0xda'))){_0x3c139d['limit']=qs[_0x1ab8('0x33')](_0x258ede[_0x1ab8('0x4f')][_0x1ab8('0x33')]);_0x3c139d[_0x1ab8('0x32')]=qs[_0x1ab8('0x32')](_0x258ede[_0x1ab8('0x4f')][_0x1ab8('0x32')]);}return _0x34b83e[_0x1ab8('0xeb')](_0x3c139d);}})[_0x1ab8('0x38')](function(_0x16c9e3){if(_0x16c9e3){return _0x16c9e3?{'count':_0x4aa909,'rows':_0x16c9e3}:null;}})[_0x1ab8('0x38')](respondWithResult(_0x8fc934,null))['catch'](handleError(_0x8fc934,null));};exports[_0x1ab8('0xed')]=function(_0x2489df,_0x48419d,_0x272c88){var _0x580b87;var _0x1cce51;var _0x1dfb76;var _0x528ea3=!_[_0x1ab8('0x78')](_0x2489df['params']['id'])?_0x2489df[_0x1ab8('0x65')]['id']:!_[_0x1ab8('0x78')](_0x2489df[_0x1ab8('0x3b')]['id'])?_0x2489df[_0x1ab8('0x3b')]['id']:null;return db[_0x1ab8('0x49')][_0x1ab8('0x44')]({'where':{'id':_0x528ea3,'role':{'$or':[_0x1ab8('0x39'),_0x1ab8('0x3b'),_0x1ab8('0x3c')]}},'attributes':['id',_0x1ab8('0x45'),_0x1ab8('0xee'),_0x1ab8('0xef'),_0x1ab8('0x43'),_0x1ab8('0x6f'),_0x1ab8('0xad')]})[_0x1ab8('0x38')](function(_0x141e05){if(_0x141e05){if(_0x141e05[_0x1ab8('0x43')]===_0x1ab8('0x3c')){_0x580b87=_0x141e05;if(_0x2489df['body']['interface']){_0x1dfb76=util[_0x1ab8('0xbc')](_0x1ab8('0xf0'),_0x580b87[_0x2489df['body']['interface']]);}else if(_0x2489df[_0x1ab8('0x6a')][_0x1ab8('0xf1')]){_0x1dfb76=util[_0x1ab8('0xbc')](_0x1ab8('0xf2'),_0x2489df[_0x1ab8('0x6a')][_0x1ab8('0xf1')]);}else{_0x1dfb76=util[_0x1ab8('0xbc')](_0x1ab8('0xf2'),_0x580b87['name']);}socket['to'](util[_0x1ab8('0xbc')](_0x1ab8('0xf3'),_0x580b87[_0x1ab8('0x45')]))[_0x1ab8('0xb8')]('user:forcelogout',{'ip':_0x2489df['headers']['x-forwarded-for']||_0x2489df['connection'][_0x1ab8('0xf4')]||_0x2489df[_0x1ab8('0xf5')][_0x1ab8('0xf4')]||_0x2489df['connection']['socket']['remoteAddress']});return db[_0x1ab8('0xbd')]['destroy']({'where':{'membername':_0x580b87[_0x1ab8('0x45')]},'individualHooks':!![]});}}else{throw new db[(_0x1ab8('0x9f'))][(_0x1ab8('0xa0'))](_0x1ab8('0xf6'));}})[_0x1ab8('0x38')](function(){if(_0x580b87){return _0x580b87[_0x1ab8('0xf7')]({'raw':!![]});}})[_0x1ab8('0x38')](function(_0x4a1f72){if(_0x580b87){var _0x1c7415=[];if(_0x4a1f72){_0x1cce51=_0x4a1f72;if(_0x1cce51['length']){for(var _0x474ca1=0x0;_0x474ca1<_0x1cce51[_0x1ab8('0x56')];_0x474ca1++){_0x1c7415[_0x1ab8('0x97')]({'membername':_0x580b87[_0x1ab8('0x45')],'UserId':_0x580b87['id'],'queue_name':_0x1cce51[_0x474ca1][_0x1ab8('0x45')],'VoiceQueueId':_0x1cce51[_0x474ca1]['id'],'interface':_0x1dfb76,'paused':_0x580b87['loginInPause']||![],'penalty':_0x1cce51[_0x474ca1]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x1c7415,function(_0x71c8d5){return db[_0x1ab8('0xbd')][_0x1ab8('0xbe')](_0x71c8d5);});}}}})[_0x1ab8('0x38')](function(){if(_0x580b87){return db[_0x1ab8('0xf8')]['findAll']({'where':{'membername':_0x580b87[_0x1ab8('0x45')],'exitAt':null}});}})[_0x1ab8('0x38')](function(_0x44e0f0){if(_0x580b87){var _0x32a52a=[];_0x44e0f0[_0x1ab8('0xf9')](function(_0x1478ee){_0x32a52a['push'](_0x1478ee['update']({'exitAt':moment()[_0x1ab8('0xbc')](_0x1ab8('0xfa'))}));});return BPromise[_0x1ab8('0x98')](_0x32a52a);}})['then'](function(){if(_0x580b87){var _0x4438b1=[];var _0x52d242=[];var _0x49f3ce=utils[_0x1ab8('0xfb')]();var _0x414244={'membername':_0x580b87[_0x1ab8('0x45')],'interface':_0x1dfb76,'enterAt':moment()[_0x1ab8('0xbc')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x580b87['role'],'internal':_0x580b87[_0x1ab8('0x6f')]};_0x49f3ce[_0x1ab8('0xf9')](function(_0x3cc12a){_0x4438b1['push'](_['merge']({'channel':_0x3cc12a,'type':_0x1ab8('0xfc'),'data1':_0x2489df['body']['device'],'data2':_0x1dfb76},_0x414244));if(_0x580b87['loginInPause']){_0x52d242[_0x1ab8('0x97')](_['merge']({'channel':_0x3cc12a,'type':_0x1ab8('0xfd'),'data1':_0x1ab8('0xfe')},_0x414244));}});return db[_0x1ab8('0xf8')][_0x1ab8('0x93')](_0x4438b1[_0x1ab8('0xff')](_0x52d242),{'individualHooks':!![]});}})['then'](function(){if(_0x580b87){return _0x580b87[_0x1ab8('0x69')]({'online':!![],'lastLoginAt':moment()[_0x1ab8('0xbc')](_0x1ab8('0xfa')),'voicePause':_0x580b87[_0x1ab8('0xad')]||![],'mailPause':_0x580b87[_0x1ab8('0xad')]||![],'chatPause':_0x580b87[_0x1ab8('0xad')]||![],'faxPause':_0x580b87[_0x1ab8('0xad')]||![],'smsPause':_0x580b87[_0x1ab8('0xad')]||![],'openchannelPause':_0x580b87[_0x1ab8('0xad')]||![],'whatsappPause':_0x580b87[_0x1ab8('0xad')]||![],'pauseType':_0x580b87[_0x1ab8('0xad')]?'LOGININPAUSE':null,'interface':_0x1dfb76,'lastPauseAt':moment()[_0x1ab8('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x1ab8('0x38')](function(_0x4d6972){if(_0x2489df[_0x1ab8('0x100')]){return _0x272c88();}else{return BPromise['resolve'](_0x4d6972)[_0x1ab8('0x38')](respondWithResult(_0x48419d,null));}})['catch'](handleError(_0x48419d,null));};exports[_0x1ab8('0x101')]=function(_0x15b474,_0x59661f,_0x30e200){var _0x15b643;return db[_0x1ab8('0x49')][_0x1ab8('0x44')]({'where':{'id':_0x15b474[_0x1ab8('0x65')]['id'],'role':_0x1ab8('0x3c')},'attributes':['id',_0x1ab8('0x45'),_0x1ab8('0x43')]})['then'](handleEntityNotFound(_0x59661f,null))[_0x1ab8('0x38')](function(_0x5680da){if(_0x5680da){_0x15b643=_0x5680da;return db[_0x1ab8('0xbd')][_0x1ab8('0xc3')]({'where':{'membername':_0x15b643[_0x1ab8('0x45')]},'individualHooks':!![]});}})[_0x1ab8('0x38')](function(){return db[_0x1ab8('0xf8')]['findAll']({'where':{'membername':_0x15b643[_0x1ab8('0x45')],'exitAt':null}});})['then'](function(_0x230bfa){var _0x333d2a=[];_0x230bfa['forEach'](function(_0x124ab0){_0x333d2a[_0x1ab8('0x97')](_0x124ab0[_0x1ab8('0x69')]({'exitAt':moment()[_0x1ab8('0xbc')](_0x1ab8('0xfa'))}));});return BPromise[_0x1ab8('0x98')](_0x333d2a);})[_0x1ab8('0x38')](function(){return _0x15b643['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x1ab8('0x38')](respondWithResult(_0x59661f,null))[_0x1ab8('0x63')](handleError(_0x59661f,null));};exports['pause']=function(_0x36c56f,_0x5e18da,_0x4de85a){var _0x5bc707;return db[_0x1ab8('0xbd')]['update']({'paused':0x1},{'where':{'UserId':_0x36c56f[_0x1ab8('0x65')]['id']},'individualHooks':!![]})[_0x1ab8('0x38')](function(){return db[_0x1ab8('0x49')][_0x1ab8('0x44')]({'where':{'id':_0x36c56f[_0x1ab8('0x65')]['id'],'role':_0x1ab8('0x3c')},'attributes':['id',_0x1ab8('0x45'),_0x1ab8('0x43'),_0x1ab8('0x6f'),'interface']});})['then'](handleEntityNotFound(_0x5e18da,null))[_0x1ab8('0x38')](function(_0x34fb23){if(_0x34fb23){_0x5bc707=_0x34fb23;return respondWithRpcPromise(_0x1ab8('0x102'),_0x1ab8('0x103'),{'id':_0x5bc707['id'],'name':_0x5bc707[_0x1ab8('0x45')],'pause':!![]});}})['then'](function(){if(_0x5bc707){return db[_0x1ab8('0xf8')][_0x1ab8('0x61')]({'where':{'membername':_0x5bc707['name'],'type':_0x1ab8('0xfd'),'exitAt':null}});}})[_0x1ab8('0x38')](function(_0x4156a6){if(_0x4156a6[_0x1ab8('0x56')]){var _0x39846f=moment()['format'](_0x1ab8('0xfa'));for(var _0x199715=0x0,_0x2372c4=_0x4156a6[_0x1ab8('0x56')];_0x199715<_0x2372c4;_0x199715++){_0x4156a6[_0x199715][_0x1ab8('0x104')]({'exitAt':_0x39846f});}}})['then'](function(){var _0x368c9d=[];var _0x5014f0=utils[_0x1ab8('0xfb')]();_0x5014f0[_0x1ab8('0xf9')](function(_0x523821){_0x368c9d[_0x1ab8('0x97')]({'channel':_0x523821,'membername':_0x5bc707[_0x1ab8('0x45')],'interface':_[_0x1ab8('0x78')](_0x5bc707[_0x1ab8('0xaf')])?util['format'](_0x1ab8('0xf2'),_0x5bc707[_0x1ab8('0x45')]):_0x5bc707[_0x1ab8('0xaf')],'type':_0x1ab8('0xfd'),'enterAt':moment()[_0x1ab8('0xbc')](_0x1ab8('0xfa')),'data1':_0x36c56f[_0x1ab8('0x6a')][_0x1ab8('0x4c')]||_0x1ab8('0x105'),'role':_0x5bc707[_0x1ab8('0x43')],'internal':_0x5bc707[_0x1ab8('0x6f')]});});return db[_0x1ab8('0xf8')][_0x1ab8('0x93')](_0x368c9d,{'individualHooks':!![]});})[_0x1ab8('0x38')](function(){return _0x5bc707['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x36c56f[_0x1ab8('0x6a')][_0x1ab8('0x4c')]||_0x1ab8('0x105'),'lastPauseAt':moment()[_0x1ab8('0xbc')](_0x1ab8('0xfa'))});})[_0x1ab8('0x38')](respondWithResult(_0x5e18da,null))[_0x1ab8('0x63')](handleError(_0x5e18da,null));};exports[_0x1ab8('0x106')]=function(_0x3b446c,_0x183edd,_0x3c7b20){var _0x3e3307;return db['User'][_0x1ab8('0x44')]({'where':{'id':_0x3b446c[_0x1ab8('0x65')]['id']},'attributes':['id',_0x1ab8('0x45'),_0x1ab8('0x43'),_0x1ab8('0xae'),_0x1ab8('0x107'),_0x1ab8('0x108'),_0x1ab8('0x109'),_0x1ab8('0x10a'),_0x1ab8('0x10b'),_0x1ab8('0x10c'),_0x1ab8('0x10d'),_0x1ab8('0x10e')]})['then'](handleEntityNotFound(_0x183edd,null))['then'](function(_0x30fb61){if(_0x30fb61){_0x3e3307=_0x30fb61;if(_0x3b446c[_0x1ab8('0x6a')][_0x1ab8('0xc0')]&&!utils[_0x1ab8('0xb0')](_0x3b446c[_0x1ab8('0x6a')][_0x1ab8('0xc0')])){throw new db[(_0x1ab8('0x9f'))][(_0x1ab8('0xa0'))](_0x1ab8('0xb1'));}switch(_0x3b446c[_0x1ab8('0x6a')][_0x1ab8('0xc0')]){case _0x1ab8('0xb9'):return respondWithRpcPromise('QueuePause',_0x1ab8('0x106'),{'id':_0x3e3307['id'],'name':_0x3e3307['name'],'pause':![]})[_0x1ab8('0x38')](function(){return db[_0x1ab8('0xbd')][_0x1ab8('0x69')]({'paused':0x0},{'where':{'UserId':_0x3e3307['id']},'individualHooks':!![]});})[_0x1ab8('0x38')](function(){return db[_0x1ab8('0xf8')]['find']({'where':{'channel':_0x3b446c[_0x1ab8('0x6a')][_0x1ab8('0xc0')],'membername':_0x3e3307['name'],'type':_0x1ab8('0xfd'),'exitAt':null}});})['then'](function(_0x2a5d46){if(_0x2a5d46){return _0x2a5d46['update']({'exitAt':moment()[_0x1ab8('0xbc')](_0x1ab8('0xfa')),'data2':_0x1ab8('0x10f')},{'individualHooks':!![]});}return null;})[_0x1ab8('0x38')](function(){return _0x3e3307['update']({'voicePause':![]});});case'mail':case _0x1ab8('0x110'):case _0x1ab8('0x111'):case _0x1ab8('0x112'):case'whatsapp':case'openchannel':return db[_0x1ab8('0xf8')][_0x1ab8('0x44')]({'where':{'channel':_0x3b446c['body'][_0x1ab8('0xc0')],'membername':_0x3e3307[_0x1ab8('0x45')],'type':_0x1ab8('0xfd'),'exitAt':null}})['then'](function(_0x3ec68c){if(_0x3ec68c){return _0x3ec68c[_0x1ab8('0x69')]({'exitAt':moment()['format'](_0x1ab8('0xfa')),'data2':_0x1ab8('0x10f')},{'individualHooks':!![]});}return null;})[_0x1ab8('0x38')](function(){var _0x3bc614={};_['set'](_0x3bc614,util[_0x1ab8('0xbc')]('%s%s',_0x3b446c[_0x1ab8('0x6a')][_0x1ab8('0xc0')],_0x1ab8('0x113')),![]);return _0x3e3307[_0x1ab8('0x69')](_0x3bc614);});default:return respondWithRpcPromise(_0x1ab8('0x102'),'unpause',{'id':_0x3e3307['id'],'name':_0x3e3307['name'],'pause':![]})['then'](function(){return db[_0x1ab8('0xbd')]['update']({'paused':0x0},{'where':{'UserId':_0x3e3307['id']}});})['then'](function(){return db[_0x1ab8('0xf8')][_0x1ab8('0x61')]({'where':{'membername':_0x3e3307['name'],'type':_0x1ab8('0xfd'),'exitAt':null}});})['then'](function(_0x5213ea){var _0x396297=[];_0x5213ea[_0x1ab8('0xf9')](function(_0x5b3113){_0x396297[_0x1ab8('0x97')](_0x5b3113[_0x1ab8('0x69')]({'exitAt':moment()['format'](_0x1ab8('0xfa')),'data2':_0x1ab8('0x10f')}));});return BPromise[_0x1ab8('0x98')](_0x396297);})[_0x1ab8('0x38')](function(){return _0x3e3307['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x1ab8('0x38')](respondWithResult(_0x183edd,null))[_0x1ab8('0x63')](handleError(_0x183edd,null));};exports[_0x1ab8('0x114')]=function(_0x3092c2,_0x63d3b0,_0xe247f1){var _0x421e79={};var _0x2023c1={};var _0x5e8229;var _0x2c1689;return db[_0x1ab8('0x49')]['findOne']({'where':{'id':_0x3092c2['params']['id']}})[_0x1ab8('0x38')](handleEntityNotFound(_0x63d3b0,null))[_0x1ab8('0x38')](function(_0x1f77cd){if(_0x1f77cd){_0x5e8229=_0x1f77cd;_0x2023c1[_0x1ab8('0x53')]=_[_0x1ab8('0x50')](db['Team'][_0x1ab8('0x4a')]);_0x2023c1['query']=_['keys'](_0x3092c2[_0x1ab8('0x4f')]);_0x2023c1[_0x1ab8('0x51')]=_['intersection'](_0x2023c1['model'],_0x2023c1['query']);_0x421e79[_0x1ab8('0x54')]=_[_0x1ab8('0x52')](_0x2023c1[_0x1ab8('0x53')],qs[_0x1ab8('0x55')](_0x3092c2[_0x1ab8('0x4f')][_0x1ab8('0x55')]));_0x421e79[_0x1ab8('0x54')]=_0x421e79[_0x1ab8('0x54')][_0x1ab8('0x56')]?_0x421e79[_0x1ab8('0x54')]:_0x2023c1[_0x1ab8('0x53')];_0x421e79[_0x1ab8('0xcf')]=qs[_0x1ab8('0x57')](_0x3092c2[_0x1ab8('0x4f')]['sort']);_0x421e79[_0x1ab8('0x58')]=qs[_0x1ab8('0x51')](_[_0x1ab8('0x59')](_0x3092c2[_0x1ab8('0x4f')],_0x2023c1['filters']));if(_0x3092c2[_0x1ab8('0x4f')]['filter']){_0x421e79[_0x1ab8('0x58')]=_[_0x1ab8('0x5a')](_0x421e79[_0x1ab8('0x58')],{'$or':_[_0x1ab8('0x41')](_0x421e79[_0x1ab8('0x54')],function(_0x5889fc){var _0x56ad79={};_0x56ad79[_0x5889fc]={'$like':'%'+_0x3092c2[_0x1ab8('0x4f')]['filter']+'%'};return _0x56ad79;})});}_0x421e79=_[_0x1ab8('0x5a')]({},_0x421e79,_0x3092c2['options']);return _0x5e8229['getTeams'](_0x421e79);}})['then'](function(_0xb96c8d){if(_0xb96c8d){_0x2c1689=_0xb96c8d['length'];if(!_0x3092c2[_0x1ab8('0x4f')]['hasOwnProperty'](_0x1ab8('0xda'))){_0x421e79[_0x1ab8('0x33')]=qs[_0x1ab8('0x33')](_0x3092c2['query'][_0x1ab8('0x33')]);_0x421e79[_0x1ab8('0x32')]=qs[_0x1ab8('0x32')](_0x3092c2['query'][_0x1ab8('0x32')]);}return _0x5e8229[_0x1ab8('0x114')](_0x421e79);}})[_0x1ab8('0x38')](function(_0x14d92a){if(_0x14d92a){return _0x14d92a?{'count':_0x2c1689,'rows':_0x14d92a}:null;}})[_0x1ab8('0x38')](respondWithResult(_0x63d3b0,null))[_0x1ab8('0x63')](handleError(_0x63d3b0,null));};exports[_0x1ab8('0x115')]=function(_0x164210,_0x2a6a48){return db[_0x1ab8('0x49')]['find']({'where':{'id':_0x164210[_0x1ab8('0x65')]['id']}})['then'](handleEntityNotFound(_0x2a6a48,null))[_0x1ab8('0x38')](function(_0x3baf2b){if(_0x3baf2b){var _0x22e987=_0x3baf2b[_0x1ab8('0xbb')]({'plain':!![]});return _0x3baf2b[_0x1ab8('0x115')](_0x164210[_0x1ab8('0x6a')][_0x1ab8('0x6e')],_[_0x1ab8('0x6d')](_0x164210[_0x1ab8('0x6a')],['ids','id'])||{})[_0x1ab8('0x38')](function(){for(var _0x9c5d9=0x0;_0x9c5d9<_0x164210[_0x1ab8('0x6a')][_0x1ab8('0x6e')][_0x1ab8('0x56')];_0x9c5d9++){var _0x35676f=[];db[_0x1ab8('0x116')][_0x1ab8('0xa5')]({'where':{'id':_0x164210['body'][_0x1ab8('0x6e')][_0x9c5d9]}})['then'](function(_0x48be44){_0x35676f[_0x1ab8('0x97')](_0x48be44[_0x1ab8('0xf7')]()[_0x1ab8('0x38')](function(_0xc7479){for(var _0x1ea4e8=0x0;_0x1ea4e8<_0xc7479[_0x1ab8('0x56')];_0x1ea4e8++){_0xc7479[_0x1ea4e8][_0x1ab8('0x117')](_0x1ab8('0xc0'),_0x1ab8('0x118'));}return _0xc7479;}));_0x35676f['push'](_0x48be44[_0x1ab8('0x119')]()[_0x1ab8('0x38')](function(_0x5ad1eb){for(var _0x5d9154=0x0;_0x5d9154<_0x5ad1eb[_0x1ab8('0x56')];_0x5d9154++){_0x5ad1eb[_0x5d9154][_0x1ab8('0x117')](_0x1ab8('0xc0'),_0x1ab8('0x11a'));}return _0x5ad1eb;}));_0x35676f[_0x1ab8('0x97')](_0x48be44[_0x1ab8('0x11b')]()[_0x1ab8('0x38')](function(_0x2ccc3c){for(var _0x2c0c74=0x0;_0x2c0c74<_0x2ccc3c[_0x1ab8('0x56')];_0x2c0c74++){_0x2ccc3c[_0x2c0c74][_0x1ab8('0x117')](_0x1ab8('0xc0'),_0x1ab8('0x11c'));}return _0x2ccc3c;}));_0x35676f[_0x1ab8('0x97')](_0x48be44[_0x1ab8('0x11d')]()[_0x1ab8('0x38')](function(_0x5a5578){for(var _0x56bd2c=0x0;_0x56bd2c<_0x5a5578['length'];_0x56bd2c++){_0x5a5578[_0x56bd2c]['setDataValue'](_0x1ab8('0xc0'),_0x1ab8('0x11e'));}return _0x5a5578;}));_0x35676f['push'](_0x48be44[_0x1ab8('0x11f')]()[_0x1ab8('0x38')](function(_0x4c1f4a){for(var _0x5df97d=0x0;_0x5df97d<_0x4c1f4a['length'];_0x5df97d++){_0x4c1f4a[_0x5df97d][_0x1ab8('0x117')](_0x1ab8('0xc0'),_0x1ab8('0x120'));}return _0x4c1f4a;}));_0x35676f[_0x1ab8('0x97')](_0x48be44[_0x1ab8('0x121')]()[_0x1ab8('0x38')](function(_0x42cc6b){for(var _0x5a3071=0x0;_0x5a3071<_0x42cc6b[_0x1ab8('0x56')];_0x5a3071++){_0x42cc6b[_0x5a3071][_0x1ab8('0x117')]('channel',_0x1ab8('0x122'));}return _0x42cc6b;}));_0x35676f[_0x1ab8('0x97')](_0x48be44['getOpenchannelQueues']()[_0x1ab8('0x38')](function(_0x437698){for(var _0x4374d5=0x0;_0x4374d5<_0x437698[_0x1ab8('0x56')];_0x4374d5++){_0x437698[_0x4374d5]['setDataValue'](_0x1ab8('0xc0'),_0x1ab8('0x123'));}return _0x437698;}));return BPromise[_0x1ab8('0x98')](_0x35676f);})['then'](function(_0x4ea3f8){var _0x22f8f7=_[_0x1ab8('0x124')](_0x4ea3f8);_0x35676f=[];return db[_0x1ab8('0x5c')]['transaction'](function(_0x541d09){for(var _0x14ba41=0x0;_0x14ba41<_0x22f8f7[_0x1ab8('0x56')];_0x14ba41++){_0x35676f[_0x1ab8('0x97')](_0x22f8f7[_0x14ba41][_0x1ab8('0x125')](_0x22e987['id']),{'transaction':_0x541d09});}return BPromise[_0x1ab8('0x98')](_0x35676f)['then'](function(){if(_0x22e987[_0x1ab8('0xac')]){return BPromise[_0x1ab8('0x99')](_[_0x1ab8('0x3f')](_0x22f8f7,function(_0x1db4bb){return _0x1db4bb[_0x1ab8('0x126')](_0x1ab8('0xc0'))==='Voice';}),function(_0x153662){return db['UserVoiceQueueRt'][_0x1ab8('0xbe')]({'membername':_0x22e987[_0x1ab8('0x45')],'UserId':_0x22e987['id'],'queue_name':_0x153662[_0x1ab8('0x45')],'VoiceQueueId':_0x153662['id'],'interface':_['isNil'](_0x22e987['interface'])?util[_0x1ab8('0xbc')](_0x1ab8('0xf2'),_0x22e987[_0x1ab8('0x45')]):_0x22e987['interface'],'paused':_0x22e987['voicePause']||![],'penalty':_0x22e987[_0x1ab8('0xb6')]},{'transaction':_0x541d09});});}else{return;}})['then'](function(){for(var _0x47a2f6=0x0;_0x47a2f6<_0x22f8f7[_0x1ab8('0x56')];_0x47a2f6++){var _0x5f379f=_0x22f8f7[_0x47a2f6][_0x1ab8('0x126')](_0x1ab8('0xc0'));var _0x4a7f3e=_0x5f379f+_0x1ab8('0xb7');socket['emit'](_0x1ab8('0x3b')+_0x5f379f+_0x1ab8('0x127'),{'UserId':_0x22e987['id'],['queueField']:_0x22f8f7[_0x47a2f6]['id']});}});});});}});}})[_0x1ab8('0x38')](respondWithStatusCode(_0x2a6a48,null))[_0x1ab8('0x63')](handleError(_0x2a6a48,null));};exports['removeTeams']=function(_0x1a4b11,_0x215ca0){return db['User']['findOne']({'where':{'id':_0x1a4b11[_0x1ab8('0x65')]['id']}})['then'](handleEntityNotFound(_0x215ca0,null))['then'](function(_0x434ad3){if(_0x434ad3){var _0x306eea=_0x434ad3[_0x1ab8('0xbb')]({'plain':!![]});var _0x4d321a=_0x1a4b11[_0x1ab8('0x4f')]['ids'];return _0x434ad3[_0x1ab8('0x128')](_0x4d321a)[_0x1ab8('0x38')](function(){for(var _0x32d03c=0x0;_0x32d03c<_0x4d321a['length'];_0x32d03c++){var _0x5f02e6=[];db[_0x1ab8('0x116')][_0x1ab8('0xa5')]({'where':{'id':_0x4d321a[_0x32d03c]}})[_0x1ab8('0x38')](function(_0x4be74b){_0x5f02e6[_0x1ab8('0x97')](_0x4be74b[_0x1ab8('0xf7')]()[_0x1ab8('0x38')](function(_0x255671){for(var _0x3fc628=0x0;_0x3fc628<_0x255671['length'];_0x3fc628++){_0x255671[_0x3fc628][_0x1ab8('0x117')](_0x1ab8('0xc0'),_0x1ab8('0x118'));}return _0x255671;}));_0x5f02e6['push'](_0x4be74b[_0x1ab8('0x119')]()[_0x1ab8('0x38')](function(_0x17a07c){for(var _0x48a85f=0x0;_0x48a85f<_0x17a07c[_0x1ab8('0x56')];_0x48a85f++){_0x17a07c[_0x48a85f][_0x1ab8('0x117')](_0x1ab8('0xc0'),_0x1ab8('0x11a'));}return _0x17a07c;}));_0x5f02e6[_0x1ab8('0x97')](_0x4be74b[_0x1ab8('0x11b')]()['then'](function(_0x4d0691){for(var _0x1d3194=0x0;_0x1d3194<_0x4d0691[_0x1ab8('0x56')];_0x1d3194++){_0x4d0691[_0x1d3194][_0x1ab8('0x117')](_0x1ab8('0xc0'),_0x1ab8('0x11c'));}return _0x4d0691;}));_0x5f02e6['push'](_0x4be74b[_0x1ab8('0x11d')]()[_0x1ab8('0x38')](function(_0x813967){for(var _0x495c0b=0x0;_0x495c0b<_0x813967[_0x1ab8('0x56')];_0x495c0b++){_0x813967[_0x495c0b][_0x1ab8('0x117')](_0x1ab8('0xc0'),_0x1ab8('0x11e'));}return _0x813967;}));_0x5f02e6['push'](_0x4be74b[_0x1ab8('0x11f')]()[_0x1ab8('0x38')](function(_0x47601b){for(var _0x3b616a=0x0;_0x3b616a<_0x47601b[_0x1ab8('0x56')];_0x3b616a++){_0x47601b[_0x3b616a]['setDataValue'](_0x1ab8('0xc0'),_0x1ab8('0x120'));}return _0x47601b;}));_0x5f02e6[_0x1ab8('0x97')](_0x4be74b['getFaxQueues']()['then'](function(_0x4f18f0){for(var _0x187733=0x0;_0x187733<_0x4f18f0['length'];_0x187733++){_0x4f18f0[_0x187733][_0x1ab8('0x117')](_0x1ab8('0xc0'),_0x1ab8('0x122'));}return _0x4f18f0;}));_0x5f02e6[_0x1ab8('0x97')](_0x4be74b['getOpenchannelQueues']()[_0x1ab8('0x38')](function(_0x4c8d6e){for(var _0x1df98c=0x0;_0x1df98c<_0x4c8d6e[_0x1ab8('0x56')];_0x1df98c++){_0x4c8d6e[_0x1df98c][_0x1ab8('0x117')](_0x1ab8('0xc0'),_0x1ab8('0x123'));}return _0x4c8d6e;}));return BPromise['all'](_0x5f02e6);})[_0x1ab8('0x38')](function(_0x470a2c){var _0x3aa020=_[_0x1ab8('0x124')](_0x470a2c);_0x5f02e6=[];return db[_0x1ab8('0x5c')][_0x1ab8('0x129')](function(_0x2cb185){for(var _0x6bd84=0x0;_0x6bd84<_0x3aa020['length'];_0x6bd84++){_0x5f02e6[_0x1ab8('0x97')](_0x3aa020[_0x6bd84][_0x1ab8('0x12a')](_0x306eea['id']),{'transaction':_0x2cb185});}return BPromise[_0x1ab8('0x98')](_0x5f02e6)['then'](function(){if(_0x306eea[_0x1ab8('0xac')]){return BPromise[_0x1ab8('0x99')](_['filter'](_0x3aa020,function(_0x30cc6e){return _0x30cc6e[_0x1ab8('0x126')](_0x1ab8('0xc0'))===_0x1ab8('0x118');}),function(_0xd503eb){return db['UserVoiceQueueRt'][_0x1ab8('0xc3')]({'where':{'VoiceQueueId':_0xd503eb['id'],'UserId':_0x306eea['id']},'transaction':_0x2cb185});});}else{return;}})['then'](function(){for(var _0xaab54e=0x0;_0xaab54e<_0x3aa020[_0x1ab8('0x56')];_0xaab54e++){var _0x33b4ba=_0x3aa020[_0xaab54e][_0x1ab8('0x126')](_0x1ab8('0xc0'));var _0x31662d=_0x33b4ba+'QueueId';socket[_0x1ab8('0xb8')](_0x1ab8('0x3b')+_0x33b4ba+_0x1ab8('0xc2'),{'UserId':_0x306eea['id'],['queueField']:_0x3aa020[_0xaab54e]['id']});}});});});}});}})[_0x1ab8('0x38')](respondWithStatusCode(_0x215ca0,null))[_0x1ab8('0x63')](handleError(_0x215ca0,null));};exports[_0x1ab8('0x12b')]=function(_0x128ac3,_0x1370c6,_0xbdf0ad){var _0xb2c78e={};var _0x13166f={};var _0x257b53;var _0x435807;return db['User'][_0x1ab8('0xa5')]({'where':{'id':_0x128ac3[_0x1ab8('0x65')]['id']}})[_0x1ab8('0x38')](handleEntityNotFound(_0x1370c6,null))[_0x1ab8('0x38')](function(_0x3ebbc9){if(_0x3ebbc9){_0x257b53=_0x3ebbc9;_0x13166f[_0x1ab8('0x53')]=_['keys'](db[_0x1ab8('0xd1')][_0x1ab8('0x4a')]);_0x13166f[_0x1ab8('0x4f')]=_[_0x1ab8('0x50')](_0x128ac3[_0x1ab8('0x4f')]);_0x13166f[_0x1ab8('0x51')]=_[_0x1ab8('0x52')](_0x13166f['model'],_0x13166f[_0x1ab8('0x4f')]);_0xb2c78e['attributes']=_[_0x1ab8('0x52')](_0x13166f[_0x1ab8('0x53')],qs['fields'](_0x128ac3['query'][_0x1ab8('0x55')]));_0xb2c78e[_0x1ab8('0x54')]=_0xb2c78e[_0x1ab8('0x54')][_0x1ab8('0x56')]?_0xb2c78e[_0x1ab8('0x54')]:_0x13166f[_0x1ab8('0x53')];_0xb2c78e[_0x1ab8('0xcf')]=qs[_0x1ab8('0x57')](_0x128ac3[_0x1ab8('0x4f')][_0x1ab8('0x57')]);_0xb2c78e['where']=qs[_0x1ab8('0x51')](_[_0x1ab8('0x59')](_0x128ac3[_0x1ab8('0x4f')],_0x13166f['filters']));if(_0x128ac3[_0x1ab8('0x4f')][_0x1ab8('0x3f')]){_0xb2c78e[_0x1ab8('0x58')]=_[_0x1ab8('0x5a')](_0xb2c78e['where'],{'$or':_[_0x1ab8('0x41')](_0xb2c78e['attributes'],function(_0x1561af){var _0x41f436={};_0x41f436[_0x1561af]={'$like':'%'+_0x128ac3[_0x1ab8('0x4f')][_0x1ab8('0x3f')]+'%'};return _0x41f436;})});}_0xb2c78e=_[_0x1ab8('0x5a')]({},_0xb2c78e,_0x128ac3['options']);return _0x257b53[_0x1ab8('0x12b')](_0xb2c78e);}})[_0x1ab8('0x38')](function(_0x153b0c){if(_0x153b0c){_0x435807=_0x153b0c['length'];if(!_0x128ac3[_0x1ab8('0x4f')][_0x1ab8('0xd0')]('nolimit')){_0xb2c78e['limit']=qs['limit'](_0x128ac3[_0x1ab8('0x4f')][_0x1ab8('0x33')]);_0xb2c78e['offset']=qs[_0x1ab8('0x32')](_0x128ac3[_0x1ab8('0x4f')][_0x1ab8('0x32')]);}return _0x257b53[_0x1ab8('0x12b')](_0xb2c78e);}})[_0x1ab8('0x38')](function(_0x33c798){if(_0x33c798){return _0x33c798?{'count':_0x435807,'rows':_0x33c798}:null;}})['then'](respondWithResult(_0x1370c6,null))['catch'](handleError(_0x1370c6,null));};exports[_0x1ab8('0x12c')]=function(_0x393c24,_0x1a1405,_0xc5f9fc){var _0x5de181={};var _0x2c6fd2={};var _0x59197d;var _0xb49815;return db[_0x1ab8('0x49')]['findOne']({'where':{'id':_0x393c24[_0x1ab8('0x65')]['id']}})['then'](handleEntityNotFound(_0x1a1405,null))['then'](function(_0x1280f1){if(_0x1280f1){_0x59197d=_0x1280f1;_0x2c6fd2['model']=_[_0x1ab8('0x50')](db['User'][_0x1ab8('0x4a')]);_0x2c6fd2[_0x1ab8('0x4f')]=_[_0x1ab8('0x50')](_0x393c24[_0x1ab8('0x4f')]);_0x2c6fd2[_0x1ab8('0x51')]=_[_0x1ab8('0x52')](_0x2c6fd2['model'],_0x2c6fd2[_0x1ab8('0x4f')]);_0x5de181['attributes']=_[_0x1ab8('0x52')](_0x2c6fd2[_0x1ab8('0x53')],qs[_0x1ab8('0x55')](_0x393c24['query'][_0x1ab8('0x55')]));_0x5de181['attributes']=_0x5de181[_0x1ab8('0x54')][_0x1ab8('0x56')]?_0x5de181[_0x1ab8('0x54')]:_0x2c6fd2[_0x1ab8('0x53')];_0x5de181['order']=qs[_0x1ab8('0x57')](_0x393c24[_0x1ab8('0x4f')][_0x1ab8('0x57')]);_0x5de181[_0x1ab8('0x58')]=qs[_0x1ab8('0x51')](_[_0x1ab8('0x59')](_0x393c24[_0x1ab8('0x4f')],_0x2c6fd2['filters']));if(_0x393c24[_0x1ab8('0x4f')]['filter']){_0x5de181[_0x1ab8('0x58')]=_[_0x1ab8('0x5a')](_0x5de181[_0x1ab8('0x58')],{'$or':_['map'](_0x5de181[_0x1ab8('0x54')],function(_0x2d5b41){var _0x3f73e5={};_0x3f73e5[_0x2d5b41]={'$like':'%'+_0x393c24[_0x1ab8('0x4f')]['filter']+'%'};return _0x3f73e5;})});}_0x5de181['model']=db[_0x1ab8('0x49')];_0x5de181['as']='Agents';_0x5de181=_[_0x1ab8('0x5a')]({},_0x5de181,_0x393c24[_0x1ab8('0x68')]);return _0x59197d[_0x1ab8('0xf7')]({'include':[_0x5de181]});}})[_0x1ab8('0x38')](function(_0x48fc20){if(_0x48fc20){var _0x17818c={},_0xa5ae6b=[],_0x228dc8=0x0;for(var _0x4663ba=0x0;_0x4663ba<_0x48fc20[_0x1ab8('0x56')];_0x4663ba+=0x1){for(var _0x589d46=0x0,_0x4aef1f;_0x589d46<_0x48fc20[_0x4663ba][_0x1ab8('0x90')][_0x1ab8('0x56')];_0x589d46+=0x1){_0x4aef1f=_0x48fc20[_0x4663ba][_0x1ab8('0x90')][_0x589d46][_0x1ab8('0xbb')]({'plain':!![]});_0x17818c[_0x4aef1f['id']]=_0x4aef1f;}}_0x17818c=_['values'](_0x17818c);for(var _0x2a508b=qs[_0x1ab8('0x32')](_0x393c24[_0x1ab8('0x4f')][_0x1ab8('0x32')]);_0x2a508b<_0x17818c[_0x1ab8('0x56')]&&_0xa5ae6b[_0x1ab8('0x56')]=_0x3de186[_0x0057('0x55')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x0057('0x11')](function(){if(_0x586333){return db[_0x0057('0x2b')]['destroy']({'where':{'membername':_0x586333['name']},'individualHooks':!![]});}})[_0x0057('0x11')](function(){if(_0x586333){return _0x586333[_0x0057('0x56')]({'raw':!![]});}})['then'](function(_0xa30f3){if(_0x586333){if(_0xa30f3){var _0x1608fa=[];_0x2eec69=_0xa30f3;if(_0x2eec69['length']){for(var _0x47bc12=0x0;_0x47bc12<_0x2eec69[_0x0057('0x30')];_0x47bc12++){_0x1608fa['push'](db[_0x0057('0x2b')]['upsert']({'membername':_0x586333[_0x0057('0x28')],'UserId':_0x586333['id'],'queue_name':_0x2eec69[_0x47bc12]['name'],'VoiceQueueId':_0x2eec69[_0x47bc12]['id'],'interface':_0xda34f5,'paused':_0x586333[_0x0057('0x51')]||![],'penalty':_0x2eec69[_0x47bc12][_0x0057('0x57')]||0x0}));}return BPromise['all'](_0x1608fa);}}}})['then'](function(){if(_0x586333){return db['MemberReport']['findAll']({'where':{'membername':_0x586333[_0x0057('0x28')],'exitAt':null}});}})[_0x0057('0x11')](function(_0x19e0e0){if(_0x586333){if(_0x19e0e0&&_0x19e0e0[_0x0057('0x30')]){var _0x398eab=[];_0x19e0e0[_0x0057('0x32')](function(_0x8d6d58){_0x398eab['push'](_0x8d6d58[_0x0057('0x2c')]({'exitAt':moment()['format'](_0x0057('0x36'))}));});return BPromise[_0x0057('0x4b')](_0x398eab);}}})['then'](function(_0xd8d2be){if(_0x586333){var _0x626282=[];var _0x2b5f6e=[];var _0x1cfa99=utils['getChannels']();var _0x40a5ec={'membername':_0x586333[_0x0057('0x28')],'interface':_0xda34f5,'enterAt':moment()[_0x0057('0x2f')](_0x0057('0x36')),'role':_0x586333[_0x0057('0x29')],'internal':_0x586333[_0x0057('0x2a')]};_0x1cfa99[_0x0057('0x32')](function(_0x3a8bf6){_0x626282['push'](_[_0x0057('0x58')]({'channel':_0x3a8bf6,'type':_0x0057('0x59'),'data1':_0x0057('0x5a'),'data2':_0xda34f5},_0x40a5ec));if(_0x586333[_0x0057('0x51')]){_0x2b5f6e[_0x0057('0x33')](_[_0x0057('0x58')]({'channel':_0x3a8bf6,'type':_0x0057('0x2e'),'data1':_0x0057('0x5b')},_0x40a5ec));}});return db[_0x0057('0x2d')]['bulkCreate'](_0x626282[_0x0057('0x5c')](_0x2b5f6e),{'individualHooks':!![]});}})['then'](function(){if(_0x586333){return _0x586333[_0x0057('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x0057('0x2f')](_0x0057('0x36')),'voicePause':_0x586333[_0x0057('0x51')]||![],'mailPause':_0x586333['loginInPause']||![],'chatPause':_0x586333[_0x0057('0x51')]||![],'faxPause':_0x586333[_0x0057('0x51')]||![],'smsPause':_0x586333[_0x0057('0x51')]||![],'openchannelPause':_0x586333['loginInPause']||![],'pauseType':_0x586333['loginInPause']?_0x0057('0x5b'):null,'lastPauseAt':moment()[_0x0057('0x2f')](_0x0057('0x36')),'interface':_0xda34f5});}})[_0x0057('0x11')](function(_0x58adf8){_0x336649(_0x58adf8);})['catch'](function(_0x45612b){_0x178392(_0x1321f9[_0x0057('0x16')](0x1f4,_0x45612b[_0x0057('0x17')]));});});}; \ No newline at end of file +var _0xf53d=['limit','include','model','map','GetUser','stringify','catch','ShowUser','find','raw','PauseUser','name','role','internal','UserVoiceQueueRt','MemberReport','findAll','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','push','isNil','interface','SIP/%s','body','type','uniqueid','bulkCreate','update','UnpauseUser','findOne','channel','voice','system','sms','whatsapp','set','Pause','forEach','all','LogoutUser','LoginUser','mobile','phone','loginInPause','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','callysquare','concat','LOGININPAUSE','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','client','redis','defaults','localhost','socket.io-emitter','./user.socket','register','then','info','User,\x20%s,\x20%s','request\x20sent','debug','code','error','message','User','options','where','attributes'];(function(_0xe41560,_0x323403){var _0x27041a=function(_0x5c37f5){while(--_0x5c37f5){_0xe41560['push'](_0xe41560['shift']());}};_0x27041a(++_0x323403);}(_0xf53d,0x199));var _0xdf53=function(_0x18fc7d,_0x613d28){_0x18fc7d=_0x18fc7d-0x0;var _0xf78053=_0xf53d[_0x18fc7d];return _0xf78053;};'use strict';var _=require(_0xdf53('0x0'));var util=require(_0xdf53('0x1'));var moment=require('moment');var BPromise=require(_0xdf53('0x2'));var rs=require(_0xdf53('0x3'));var fs=require('fs');var Redis=require(_0xdf53('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf53('0x5'));var logger=require('../../config/logger')(_0xdf53('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf53('0x7')]['http']({'port':0x232a});config[_0xdf53('0x8')]=_[_0xdf53('0x9')](config[_0xdf53('0x8')],{'host':_0xdf53('0xa'),'port':0x18eb});var socket=require(_0xdf53('0xb'))(new Redis(config[_0xdf53('0x8')]));require(_0xdf53('0xc'))[_0xdf53('0xd')](socket);function respondWithRpcPromise(_0x4c0fb1,_0x29152a,_0x2293f3){return new BPromise(function(_0x5e1df7,_0x1e54dd){return client['request'](_0x4c0fb1,_0x2293f3)[_0xdf53('0xe')](function(_0x34897d){logger[_0xdf53('0xf')](_0xdf53('0x10'),_0x29152a,_0xdf53('0x11'));logger[_0xdf53('0x12')]('User,\x20%s,\x20%s,\x20%s',_0x29152a,_0xdf53('0x11'),JSON['stringify'](_0x34897d));if(_0x34897d['error']){if(_0x34897d['error'][_0xdf53('0x13')]===0x1f4){logger[_0xdf53('0x14')](_0xdf53('0x10'),_0x29152a,_0x34897d['error'][_0xdf53('0x15')]);return _0x1e54dd(_0x34897d[_0xdf53('0x14')][_0xdf53('0x15')]);}logger[_0xdf53('0x14')](_0xdf53('0x10'),_0x29152a,_0x34897d[_0xdf53('0x14')][_0xdf53('0x15')]);return _0x5e1df7(_0x34897d[_0xdf53('0x14')][_0xdf53('0x15')]);}else{logger[_0xdf53('0xf')](_0xdf53('0x10'),_0x29152a,_0xdf53('0x11'));_0x5e1df7(_0x34897d['result'][_0xdf53('0x15')]);}})['catch'](function(_0x22d112){logger[_0xdf53('0x14')](_0xdf53('0x10'),_0x29152a,_0x22d112);_0x1e54dd(_0x22d112);});});}exports['GetUser']=function(_0x351048){var _0xb0fbd0=this;return new Promise(function(_0x341a5e,_0x4edc1f){return db[_0xdf53('0x16')]['findAll']({'raw':_0x351048['options']?_0x351048[_0xdf53('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x351048[_0xdf53('0x17')]?_0x351048[_0xdf53('0x17')][_0xdf53('0x18')]||null:null,'attributes':_0x351048[_0xdf53('0x17')]?_0x351048[_0xdf53('0x17')][_0xdf53('0x19')]||null:null,'limit':_0x351048[_0xdf53('0x17')]?_0x351048['options'][_0xdf53('0x1a')]||null:null,'include':_0x351048[_0xdf53('0x17')]?_0x351048[_0xdf53('0x17')][_0xdf53('0x1b')]?_['map'](_0x351048[_0xdf53('0x17')][_0xdf53('0x1b')],function(_0x4127c5){return{'model':db[_0x4127c5[_0xdf53('0x1c')]],'as':_0x4127c5['as'],'attributes':_0x4127c5[_0xdf53('0x19')],'include':_0x4127c5[_0xdf53('0x1b')]?_[_0xdf53('0x1d')](_0x4127c5[_0xdf53('0x1b')],function(_0x159942){return{'model':db[_0x159942[_0xdf53('0x1c')]],'as':_0x159942['as'],'attributes':_0x159942[_0xdf53('0x19')],'include':_0x159942[_0xdf53('0x1b')]?_[_0xdf53('0x1d')](_0x159942[_0xdf53('0x1b')],function(_0x1ed29a){return{'model':db[_0x1ed29a['model']],'as':_0x1ed29a['as'],'attributes':_0x1ed29a[_0xdf53('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e9056){logger[_0xdf53('0xf')](_0xdf53('0x1e'),_0x351048);logger[_0xdf53('0x12')](_0xdf53('0x1e'),_0x351048,JSON[_0xdf53('0x1f')](_0x4e9056));_0x341a5e(_0x4e9056);})[_0xdf53('0x20')](function(_0x2ad1d4){logger[_0xdf53('0x14')]('GetUser',_0x2ad1d4[_0xdf53('0x15')],_0x351048);_0x4edc1f(_0xb0fbd0[_0xdf53('0x14')](0x1f4,_0x2ad1d4[_0xdf53('0x15')]));});});};exports[_0xdf53('0x21')]=function(_0x23aef4){var _0x1b5e0e=this;return new Promise(function(_0x429667,_0x295f60){return db[_0xdf53('0x16')][_0xdf53('0x22')]({'raw':_0x23aef4[_0xdf53('0x17')]?_0x23aef4[_0xdf53('0x17')][_0xdf53('0x23')]===undefined?!![]:![]:!![],'where':_0x23aef4[_0xdf53('0x17')]?_0x23aef4['options'][_0xdf53('0x18')]||null:null,'attributes':_0x23aef4['options']?_0x23aef4[_0xdf53('0x17')][_0xdf53('0x19')]||null:null,'include':_0x23aef4['options']?_0x23aef4[_0xdf53('0x17')]['include']?_[_0xdf53('0x1d')](_0x23aef4['options'][_0xdf53('0x1b')],function(_0x25f5d8){return{'model':db[_0x25f5d8[_0xdf53('0x1c')]],'as':_0x25f5d8['as'],'attributes':_0x25f5d8['attributes'],'include':_0x25f5d8[_0xdf53('0x1b')]?_['map'](_0x25f5d8['include'],function(_0x333d95){return{'model':db[_0x333d95['model']],'as':_0x333d95['as'],'attributes':_0x333d95['attributes'],'include':_0x333d95[_0xdf53('0x1b')]?_[_0xdf53('0x1d')](_0x333d95[_0xdf53('0x1b')],function(_0x2b5a3c){return{'model':db[_0x2b5a3c['model']],'as':_0x2b5a3c['as'],'attributes':_0x2b5a3c[_0xdf53('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6d0551){logger['info'](_0xdf53('0x21'),_0x23aef4);logger[_0xdf53('0x12')]('ShowUser',_0x23aef4,JSON[_0xdf53('0x1f')](_0x6d0551));_0x429667(_0x6d0551);})[_0xdf53('0x20')](function(_0x23be1c){logger[_0xdf53('0x14')](_0xdf53('0x21'),_0x23be1c[_0xdf53('0x15')],_0x23aef4);_0x295f60(_0x1b5e0e[_0xdf53('0x14')](0x1f4,_0x23be1c[_0xdf53('0x15')]));});});};exports[_0xdf53('0x24')]=function(_0x3c3b80){var _0x26d446=this;return new Promise(function(_0x33bd35,_0x4f30ea){var _0x18350a;return db[_0xdf53('0x16')][_0xdf53('0x22')]({'where':_0x3c3b80[_0xdf53('0x17')][_0xdf53('0x18')]||{},'attributes':['id',_0xdf53('0x25'),_0xdf53('0x26'),_0xdf53('0x27'),'interface']})['then'](function(_0x3bdcf4){if(_0x3bdcf4){_0x18350a=_0x3bdcf4;return db[_0xdf53('0x28')]['update']({'paused':0x1},{'where':{'UserId':_0x18350a['id']},'individualHooks':!![]});}})['then'](function(){if(_0x18350a){return db[_0xdf53('0x29')][_0xdf53('0x2a')]({'where':{'membername':_0x18350a['name'],'type':_0xdf53('0x2b'),'exitAt':null}});}})[_0xdf53('0xe')](function(_0x7289ae){if(_0x18350a){if(_0x7289ae&&_0x7289ae[_0xdf53('0x2c')]){var _0x48da3e=moment()[_0xdf53('0x2d')](_0xdf53('0x2e'));for(var _0x1bf714=0x0,_0x16e3be=_0x7289ae[_0xdf53('0x2c')];_0x1bf714<_0x16e3be;_0x1bf714++){_0x7289ae[_0x1bf714][_0xdf53('0x2f')]({'exitAt':_0x48da3e});}}}})['then'](function(){if(_0x18350a){var _0x5be750=[];var _0x2d339f=utils['getChannels']();_0x2d339f['forEach'](function(_0x23d558){_0x5be750[_0xdf53('0x30')]({'channel':_0x23d558,'membername':_0x18350a['name'],'interface':_[_0xdf53('0x31')](_0x18350a[_0xdf53('0x32')])?util[_0xdf53('0x2d')](_0xdf53('0x33'),_0x18350a['name']):_0x18350a[_0xdf53('0x32')],'type':_0xdf53('0x2b'),'enterAt':moment()[_0xdf53('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3c3b80[_0xdf53('0x34')][_0xdf53('0x35')]||'DEFAULT\x20PAUSE','role':_0x18350a['role'],'internal':_0x18350a['internal'],'uniqueid':_0x3c3b80[_0xdf53('0x34')][_0xdf53('0x36')]||null});});return db[_0xdf53('0x29')][_0xdf53('0x37')](_0x5be750,{'individualHooks':!![]});}})[_0xdf53('0xe')](function(){if(_0x18350a){return _0x18350a[_0xdf53('0x38')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3c3b80[_0xdf53('0x34')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xdf53('0x2d')](_0xdf53('0x2e'))});}})[_0xdf53('0xe')](function(_0x2e5a8d){_0x33bd35(_0x2e5a8d);})[_0xdf53('0x20')](function(_0x1bbdae){_0x4f30ea(_0x26d446[_0xdf53('0x14')](0x1f4,_0x1bbdae[_0xdf53('0x15')]));});});};exports[_0xdf53('0x39')]=function(_0x20fcc1){var _0x6c753a=this;return new Promise(function(_0x3ccf62,_0x2cfc95){var _0x3d4af9;return db[_0xdf53('0x16')][_0xdf53('0x3a')]({'where':_0x20fcc1[_0xdf53('0x17')][_0xdf53('0x18')]||{},'attributes':['id',_0xdf53('0x25')]})['then'](function(_0x2e79a6){if(_0x2e79a6){_0x3d4af9=_0x2e79a6;if(_0x20fcc1[_0xdf53('0x34')][_0xdf53('0x3b')]&&!utils['isValidChannel'](_0x20fcc1[_0xdf53('0x34')][_0xdf53('0x3b')])){throw new Error('Unknown\x20channel');}switch(_0x20fcc1[_0xdf53('0x34')]['channel']){case _0xdf53('0x3c'):return db[_0xdf53('0x28')]['update']({'paused':0x0},{'where':{'UserId':_0x3d4af9['id']}})[_0xdf53('0xe')](function(){return db[_0xdf53('0x29')][_0xdf53('0x22')]({'where':{'channel':_0x20fcc1[_0xdf53('0x34')][_0xdf53('0x3b')],'membername':_0x3d4af9[_0xdf53('0x25')],'type':_0xdf53('0x2b'),'exitAt':null}});})[_0xdf53('0xe')](function(_0x56627b){if(_0x56627b){return _0x56627b['update']({'exitAt':moment()[_0xdf53('0x2d')](_0xdf53('0x2e')),'data2':_0xdf53('0x3d')},{'individualHooks':!![]});}return null;})[_0xdf53('0xe')](function(){return _0x3d4af9[_0xdf53('0x38')]({'voicePause':![]});});case'mail':case'chat':case'fax':case _0xdf53('0x3e'):case'openchannel':case _0xdf53('0x3f'):return db[_0xdf53('0x29')][_0xdf53('0x22')]({'where':{'channel':_0x20fcc1[_0xdf53('0x34')][_0xdf53('0x3b')],'membername':_0x3d4af9[_0xdf53('0x25')],'type':_0xdf53('0x2b'),'exitAt':null}})[_0xdf53('0xe')](function(_0x935078){return _0x935078[_0xdf53('0x38')]({'exitAt':moment()[_0xdf53('0x2d')](_0xdf53('0x2e')),'data2':_0xdf53('0x3d')},{'individualHooks':!![]});})[_0xdf53('0xe')](function(){var _0x5568b1={};_[_0xdf53('0x40')](_0x5568b1,util[_0xdf53('0x2d')]('%s%s',_0x20fcc1[_0xdf53('0x34')][_0xdf53('0x3b')],_0xdf53('0x41')),![]);return _0x3d4af9['update'](_0x5568b1);});default:return db[_0xdf53('0x28')][_0xdf53('0x38')]({'paused':0x0},{'where':{'UserId':_0x3d4af9['id']}})[_0xdf53('0xe')](function(){return db[_0xdf53('0x29')][_0xdf53('0x2a')]({'where':{'membername':_0x3d4af9[_0xdf53('0x25')],'type':_0xdf53('0x2b'),'exitAt':null}});})[_0xdf53('0xe')](function(_0x5d9dd4){var _0x46e5ca=[];_0x5d9dd4[_0xdf53('0x42')](function(_0x1330a6){_0x46e5ca[_0xdf53('0x30')](_0x1330a6[_0xdf53('0x38')]({'exitAt':moment()[_0xdf53('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'}));});return BPromise[_0xdf53('0x43')](_0x46e5ca);})[_0xdf53('0xe')](function(){return _0x3d4af9['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xdf53('0xe')](function(_0x211541){_0x3ccf62(_0x211541);})[_0xdf53('0x20')](function(_0x509611){_0x2cfc95(_0x6c753a['error'](0x1f4,_0x509611[_0xdf53('0x15')]));});});};exports[_0xdf53('0x44')]=function(_0x34fb7c){var _0x5c078a=this;return new Promise(function(_0x1c4da3,_0x59bb8e){var _0x2d8726;return db[_0xdf53('0x16')][_0xdf53('0x3a')]({'where':_0x34fb7c['options']['where']||{},'attributes':['id',_0xdf53('0x25')]})['then'](function(_0x25ff8b){if(_0x25ff8b){_0x2d8726=_0x25ff8b;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x2d8726['name']},'individualHooks':!![]});}})[_0xdf53('0xe')](function(){if(_0x2d8726){return db[_0xdf53('0x29')][_0xdf53('0x2a')]({'where':{'membername':_0x2d8726[_0xdf53('0x25')],'exitAt':null}});}})['then'](function(_0x25c6b3){if(_0x2d8726){if(_0x25c6b3&&_0x25c6b3[_0xdf53('0x2c')]){var _0x33e27c=[];_0x25c6b3[_0xdf53('0x42')](function(_0x1153cf){_0x33e27c[_0xdf53('0x30')](_0x1153cf[_0xdf53('0x38')]({'exitAt':moment()[_0xdf53('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x33e27c);}}})[_0xdf53('0xe')](function(){if(_0x2d8726){return _0x2d8726['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xdf53('0xe')](function(_0x23be71){_0x1c4da3(_0x23be71);})[_0xdf53('0x20')](function(_0x352c5b){_0x59bb8e(_0x5c078a[_0xdf53('0x14')](0x1f4,_0x352c5b[_0xdf53('0x15')]));});});};exports[_0xdf53('0x45')]=function(_0x20595c){var _0x32cbd7=this;return new Promise(function(_0x46ef2e,_0x466e8a){var _0x29dafc;var _0x5c8ae9;var _0x3dbe4c;var _0x11cfa0;return db['User'][_0xdf53('0x3a')]({'where':_0x20595c[_0xdf53('0x17')][_0xdf53('0x18')]||{},'attributes':['id','name',_0xdf53('0x26'),_0xdf53('0x46'),_0xdf53('0x47'),'internal',_0xdf53('0x48'),'interface']})['then'](function(_0x16cdef){if(_0x16cdef){_0x29dafc=_0x16cdef;_0x11cfa0=_0x20595c[_0xdf53('0x34')]['interface']?_0x20595c['body'][_0xdf53('0x32')]:util[_0xdf53('0x2d')](_0xdf53('0x33'),_0x29dafc[_0xdf53('0x25')]);return db[_0xdf53('0x16')]['count']({'where':{'role':_0xdf53('0x49'),'online':!![],'id':{'$ne':_0x29dafc['id']}}});}})[_0xdf53('0xe')](function(_0x3d9296){if(_0x3d9296){_0x3dbe4c=_0x3d9296;return require(_0xdf53('0x4a'))[_0xdf53('0x4b')]();}})['then'](function(_0x31eca3){if(_0x31eca3&&_0x31eca3[_0xdf53('0x4c')]&&_0x3dbe4c>=_0x31eca3[_0xdf53('0x4c')]){throw new Error(_0xdf53('0x4d'));}})[_0xdf53('0xe')](function(){if(_0x29dafc){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x29dafc['name']},'individualHooks':!![]});}})[_0xdf53('0xe')](function(){if(_0x29dafc){return _0x29dafc[_0xdf53('0x4e')]({'raw':!![]});}})[_0xdf53('0xe')](function(_0x1ec5a5){if(_0x29dafc){if(_0x1ec5a5){var _0x5603f0=[];_0x5c8ae9=_0x1ec5a5;if(_0x5c8ae9[_0xdf53('0x2c')]){for(var _0x3f886b=0x0;_0x3f886b<_0x5c8ae9[_0xdf53('0x2c')];_0x3f886b++){_0x5603f0[_0xdf53('0x30')](db[_0xdf53('0x28')][_0xdf53('0x4f')]({'membername':_0x29dafc[_0xdf53('0x25')],'UserId':_0x29dafc['id'],'queue_name':_0x5c8ae9[_0x3f886b][_0xdf53('0x25')],'VoiceQueueId':_0x5c8ae9[_0x3f886b]['id'],'interface':_0x11cfa0,'paused':_0x29dafc['loginInPause']||![],'penalty':_0x5c8ae9[_0x3f886b][_0xdf53('0x50')]||0x0}));}return BPromise[_0xdf53('0x43')](_0x5603f0);}}}})[_0xdf53('0xe')](function(){if(_0x29dafc){return db[_0xdf53('0x29')]['findAll']({'where':{'membername':_0x29dafc[_0xdf53('0x25')],'exitAt':null}});}})[_0xdf53('0xe')](function(_0x5c803d){if(_0x29dafc){if(_0x5c803d&&_0x5c803d[_0xdf53('0x2c')]){var _0x49c57d=[];_0x5c803d[_0xdf53('0x42')](function(_0x4135c8){_0x49c57d[_0xdf53('0x30')](_0x4135c8[_0xdf53('0x38')]({'exitAt':moment()[_0xdf53('0x2d')](_0xdf53('0x2e'))}));});return BPromise[_0xdf53('0x43')](_0x49c57d);}}})['then'](function(_0x10356b){if(_0x29dafc){var _0x4760b9=[];var _0x15ff4a=[];var _0x312a04=utils[_0xdf53('0x51')]();var _0x5578b6={'membername':_0x29dafc[_0xdf53('0x25')],'interface':_0x11cfa0,'enterAt':moment()[_0xdf53('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x29dafc['role'],'internal':_0x29dafc[_0xdf53('0x27')]};_0x312a04[_0xdf53('0x42')](function(_0x5bc0e6){_0x4760b9[_0xdf53('0x30')](_[_0xdf53('0x52')]({'channel':_0x5bc0e6,'type':_0xdf53('0x53'),'data1':_0xdf53('0x54'),'data2':_0x11cfa0},_0x5578b6));if(_0x29dafc['loginInPause']){_0x15ff4a['push'](_[_0xdf53('0x52')]({'channel':_0x5bc0e6,'type':_0xdf53('0x2b'),'data1':'LOGININPAUSE'},_0x5578b6));}});return db[_0xdf53('0x29')][_0xdf53('0x37')](_0x4760b9[_0xdf53('0x55')](_0x15ff4a),{'individualHooks':!![]});}})[_0xdf53('0xe')](function(){if(_0x29dafc){return _0x29dafc[_0xdf53('0x38')]({'online':!![],'lastLoginAt':moment()['format'](_0xdf53('0x2e')),'voicePause':_0x29dafc[_0xdf53('0x48')]||![],'mailPause':_0x29dafc[_0xdf53('0x48')]||![],'chatPause':_0x29dafc[_0xdf53('0x48')]||![],'faxPause':_0x29dafc[_0xdf53('0x48')]||![],'smsPause':_0x29dafc[_0xdf53('0x48')]||![],'openchannelPause':_0x29dafc[_0xdf53('0x48')]||![],'pauseType':_0x29dafc[_0xdf53('0x48')]?_0xdf53('0x56'):null,'lastPauseAt':moment()[_0xdf53('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x11cfa0});}})['then'](function(_0x42b14a){_0x46ef2e(_0x42b14a);})[_0xdf53('0x20')](function(_0x264073){_0x466e8a(_0x32cbd7[_0xdf53('0x14')](0x1f4,_0x264073['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f6e03db..1cb2afc 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 _0x605e=['emit','removeListener','register','length','user:','./user.events','save','remove','update'];(function(_0x5ecfce,_0x3f2740){var _0x18e4ca=function(_0x1b5e0f){while(--_0x1b5e0f){_0x5ecfce['push'](_0x5ecfce['shift']());}};_0x18e4ca(++_0x3f2740);}(_0x605e,0x19a));var _0xe605=function(_0x32ba82,_0x15b38e){_0x32ba82=_0x32ba82-0x0;var _0x244688=_0x605e[_0x32ba82];return _0x244688;};'use strict';var UserEvents=require(_0xe605('0x0'));var events=[_0xe605('0x1'),_0xe605('0x2'),_0xe605('0x3')];function createListener(_0x1534db,_0x47d0d8){return function(_0x304f57){_0x47d0d8[_0xe605('0x4')](_0x1534db,_0x304f57);};}function removeListener(_0x11dd93,_0x32e016){return function(){UserEvents[_0xe605('0x5')](_0x11dd93,_0x32e016);};}exports[_0xe605('0x6')]=function(_0x2d66ff){for(var _0x5bea95=0x0,_0x391198=events[_0xe605('0x7')];_0x5bea95<_0x391198;_0x5bea95++){var _0x45b535=events[_0x5bea95];var _0x3cf365=createListener(_0xe605('0x8')+_0x45b535,_0x2d66ff);UserEvents['on'](_0x45b535,_0x3cf365);}}; \ No newline at end of file +var _0x5b71=['length','user:','save','remove','update','emit','removeListener','register'];(function(_0xbcc5b1,_0x4dd3a9){var _0x26773b=function(_0x58bd83){while(--_0x58bd83){_0xbcc5b1['push'](_0xbcc5b1['shift']());}};_0x26773b(++_0x4dd3a9);}(_0x5b71,0x102));var _0x15b7=function(_0x289874,_0x1b6752){_0x289874=_0x289874-0x0;var _0x2f8bbb=_0x5b71[_0x289874];return _0x2f8bbb;};'use strict';var UserEvents=require('./user.events');var events=[_0x15b7('0x0'),_0x15b7('0x1'),_0x15b7('0x2')];function createListener(_0x2ccf28,_0x29bbef){return function(_0xcb1a3a){_0x29bbef[_0x15b7('0x3')](_0x2ccf28,_0xcb1a3a);};}function removeListener(_0x109a4e,_0x2830c2){return function(){UserEvents[_0x15b7('0x4')](_0x109a4e,_0x2830c2);};}exports[_0x15b7('0x5')]=function(_0x409408){for(var _0x64d098=0x0,_0x47b9ca=events[_0x15b7('0x6')];_0x64d098<_0x47b9ca;_0x64d098++){var _0x1e464b=events[_0x64d098];var _0x576a2a=createListener(_0x15b7('0x7')+_0x1e464b,_0x409408);UserEvents['on'](_0x1e464b,_0x576a2a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index e617435..f74a034 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 _0x5902=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5902,0x187));var _0x2590=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5902[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x2590('0x0'));var util=require('util');var path=require(_0x2590('0x1'));var timeout=require(_0x2590('0x2'));var express=require('express');var router=express[_0x2590('0x3')]();var auth=require(_0x2590('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2590('0x5'));module[_0x2590('0x6')]=router; \ No newline at end of file +var _0x27a7=['util','connect-timeout','express','Router','../../components/auth/service','exports','multer'];(function(_0x32b586,_0x475492){var _0x32ebc6=function(_0x2f1eb6){while(--_0x2f1eb6){_0x32b586['push'](_0x32b586['shift']());}};_0x32ebc6(++_0x475492);}(_0x27a7,0x11e));var _0x727a=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x27a7[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require(_0x727a('0x0'));var util=require(_0x727a('0x1'));var path=require('path');var timeout=require(_0x727a('0x2'));var express=require(_0x727a('0x3'));var router=express[_0x727a('0x4')]();var auth=require(_0x727a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x727a('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index e6549af..68cd01a 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 _0xd8b0=['exports','sequelize'];(function(_0xf4fee8,_0x5951ce){var _0x1303d7=function(_0x56e749){while(--_0x56e749){_0xf4fee8['push'](_0xf4fee8['shift']());}};_0x1303d7(++_0x5951ce);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x2baac3,_0x4a38e9){var _0x3f258f=function(_0x3a8030){while(--_0x3a8030){_0x2baac3['push'](_0x2baac3['shift']());}};_0x3f258f(++_0x4a38e9);}(_0xe706,0xa3));var _0x6e70=function(_0x115fc9,_0x22021c){_0x115fc9=_0x115fc9-0x0;var _0x2d4bc2=_0xe706[_0x115fc9];return _0x2d4bc2;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 678201d..addc447 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 _0xbddb=['api','moment','bluebird','request-promise','path','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','util'];(function(_0x666c12,_0x34353e){var _0x42be36=function(_0x21a9f6){while(--_0x21a9f6){_0x666c12['push'](_0x666c12['shift']());}};_0x42be36(++_0x34353e);}(_0xbddb,0x11d));var _0xbbdd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbddb[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xbbdd('0x0'));var logger=require('../../config/logger')(_0xbbdd('0x1'));var moment=require(_0xbbdd('0x2'));var BPromise=require(_0xbbdd('0x3'));var rp=require(_0xbbdd('0x4'));var fs=require('fs');var path=require(_0xbbdd('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbbdd('0x6'));module[_0xbbdd('0x7')]=function(_0x4a52b9,_0x2b2b98){return _0x4a52b9[_0xbbdd('0x8')](_0xbbdd('0x9'),attributes,{'tableName':_0xbbdd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x251e=['request-promise','path','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger'];(function(_0x56f532,_0xfad8c0){var _0x11f7aa=function(_0x1707db){while(--_0x1707db){_0x56f532['push'](_0x56f532['shift']());}};_0x11f7aa(++_0xfad8c0);}(_0x251e,0x102));var _0xe251=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x251e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe251('0x0'));var logger=require(_0xe251('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe251('0x2'));var fs=require('fs');var path=require(_0xe251('0x3'));var rimraf=require('rimraf');var config=require(_0xe251('0x4'));var attributes=require(_0xe251('0x5'));module[_0xe251('0x6')]=function(_0xd86854,_0x34cb58){return _0xd86854[_0xe251('0x7')](_0xe251('0x8'),attributes,{'tableName':_0xe251('0x9'),'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 2994a72..f4570f9 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 _0x87d0=['error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0x87d0,0x1a7));var _0x087d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x87d0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x087d('0x0'));var util=require(_0x087d('0x1'));var moment=require(_0x087d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x087d('0x3'));var db=require(_0x087d('0x4'))['db'];var utils=require(_0x087d('0x5'));var logger=require(_0x087d('0x6'))(_0x087d('0x7'));var config=require('../../config/environment');var jayson=require(_0x087d('0x8'));var client=jayson['client'][_0x087d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4967ce,_0x1a9b78,_0x286bf1){return new BPromise(function(_0x295086,_0x112eaf){return client['request'](_0x4967ce,_0x286bf1)[_0x087d('0xa')](function(_0x290817){logger[_0x087d('0xb')](_0x087d('0xc'),_0x1a9b78,_0x087d('0xd'));logger[_0x087d('0xe')](_0x087d('0xf'),_0x1a9b78,'request\x20sent',JSON[_0x087d('0x10')](_0x290817));if(_0x290817[_0x087d('0x11')]){if(_0x290817[_0x087d('0x11')][_0x087d('0x12')]===0x1f4){logger[_0x087d('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x1a9b78,_0x290817['error']['message']);return _0x112eaf(_0x290817[_0x087d('0x11')]['message']);}logger[_0x087d('0x11')](_0x087d('0xc'),_0x1a9b78,_0x290817['error'][_0x087d('0x13')]);return _0x295086(_0x290817[_0x087d('0x11')][_0x087d('0x13')]);}else{logger[_0x087d('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x1a9b78,_0x087d('0xd'));_0x295086(_0x290817[_0x087d('0x14')]['message']);}})[_0x087d('0x15')](function(_0x2abeca){logger[_0x087d('0x11')](_0x087d('0xc'),_0x1a9b78,_0x2abeca);_0x112eaf(_0x2abeca);});});} \ No newline at end of file +var _0xa970=['stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x276f6d,_0x10a50e){var _0xda31b5=function(_0x5cfb89){while(--_0x5cfb89){_0x276f6d['push'](_0x276f6d['shift']());}};_0xda31b5(++_0x10a50e);}(_0xa970,0x127));var _0x0a97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa970[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0a97('0x0'));var util=require('util');var moment=require(_0x0a97('0x1'));var BPromise=require(_0x0a97('0x2'));var rs=require(_0x0a97('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0a97('0x4'));var logger=require(_0x0a97('0x5'))(_0x0a97('0x6'));var config=require(_0x0a97('0x7'));var jayson=require(_0x0a97('0x8'));var client=jayson[_0x0a97('0x9')][_0x0a97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24e731,_0x1fd441,_0x2a928c){return new BPromise(function(_0x173253,_0x7e8b6c){return client[_0x0a97('0xb')](_0x24e731,_0x2a928c)[_0x0a97('0xc')](function(_0x1e5ce8){logger['info'](_0x0a97('0xd'),_0x1fd441,_0x0a97('0xe'));logger[_0x0a97('0xf')](_0x0a97('0x10'),_0x1fd441,'request\x20sent',JSON[_0x0a97('0x11')](_0x1e5ce8));if(_0x1e5ce8[_0x0a97('0x12')]){if(_0x1e5ce8['error'][_0x0a97('0x13')]===0x1f4){logger[_0x0a97('0x12')](_0x0a97('0xd'),_0x1fd441,_0x1e5ce8[_0x0a97('0x12')]['message']);return _0x7e8b6c(_0x1e5ce8[_0x0a97('0x12')][_0x0a97('0x14')]);}logger[_0x0a97('0x12')](_0x0a97('0xd'),_0x1fd441,_0x1e5ce8[_0x0a97('0x12')][_0x0a97('0x14')]);return _0x173253(_0x1e5ce8[_0x0a97('0x12')]['message']);}else{logger[_0x0a97('0x15')](_0x0a97('0xd'),_0x1fd441,_0x0a97('0xe'));_0x173253(_0x1e5ce8[_0x0a97('0x16')][_0x0a97('0x14')]);}})[_0x0a97('0x17')](function(_0x336bf4){logger[_0x0a97('0x12')](_0x0a97('0xd'),_0x1fd441,_0x336bf4);_0x7e8b6c(_0x336bf4);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 4384d05..16409e1 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 _0x3bac=['express','Router','../../config/environment','exports','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3bac,0xa4));var _0xc3ba=function(_0x3060e3,_0x14f2c6){_0x3060e3=_0x3060e3-0x0;var _0x497d2c=_0x3bac[_0x3060e3];return _0x497d2c;};'use strict';var multer=require('multer');var util=require(_0xc3ba('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc3ba('0x1'));var router=express[_0xc3ba('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc3ba('0x3'));module[_0xc3ba('0x4')]=router; \ No newline at end of file +var _0x443a=['path','connect-timeout','express','Router','../../config/environment','util'];(function(_0x350396,_0x391ad2){var _0xf306b1=function(_0x3f2d38){while(--_0x3f2d38){_0x350396['push'](_0x350396['shift']());}};_0xf306b1(++_0x391ad2);}(_0x443a,0xa1));var _0xa443=function(_0x2ccde3,_0x5bcb54){_0x2ccde3=_0x2ccde3-0x0;var _0x3bdd0d=_0x443a[_0x2ccde3];return _0x3bdd0d;};'use strict';var multer=require('multer');var util=require(_0xa443('0x0'));var path=require(_0xa443('0x1'));var timeout=require(_0xa443('0x2'));var express=require(_0xa443('0x3'));var router=express[_0xa443('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa443('0x5'));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 dac111f..59139b3 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 _0x9c00=['exports','STRING','sequelize'];(function(_0x561854,_0x414a2d){var _0x157589=function(_0x4a7c87){while(--_0x4a7c87){_0x561854['push'](_0x561854['shift']());}};_0x157589(++_0x414a2d);}(_0x9c00,0x1a0));var _0x09c0=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0x9c00[_0x35fb56];return _0x2fd52c;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x09c0('0x2')]}}; \ No newline at end of file +var _0x5eb8=['INTEGER','STRING'];(function(_0x40cb77,_0x1f01d1){var _0x271f56=function(_0x2950a3){while(--_0x2950a3){_0x40cb77['push'](_0x40cb77['shift']());}};_0x271f56(++_0x1f01d1);}(_0x5eb8,0xb0));var _0x85eb=function(_0x27b7d2,_0x56c091){_0x27b7d2=_0x27b7d2-0x0;var _0x3ef6be=_0x5eb8[_0x27b7d2];return _0x3ef6be;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x85eb('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5805018..00b07a7 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 _0x2138=['../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x564b7f,_0x162734){var _0x194ae6=function(_0x25fe6b){while(--_0x25fe6b){_0x564b7f['push'](_0x564b7f['shift']());}};_0x194ae6(++_0x162734);}(_0x2138,0x18b));var _0x8213=function(_0x659112,_0x226301){_0x659112=_0x659112-0x0;var _0xb3aaa2=_0x2138[_0x659112];return _0xb3aaa2;};'use strict';var _=require('lodash');var util=require(_0x8213('0x0'));var logger=require(_0x8213('0x1'))(_0x8213('0x2'));var moment=require(_0x8213('0x3'));var BPromise=require(_0x8213('0x4'));var rp=require(_0x8213('0x5'));var fs=require('fs');var path=require(_0x8213('0x6'));var rimraf=require(_0x8213('0x7'));var config=require(_0x8213('0x8'));var attributes=require(_0x8213('0x9'));module[_0x8213('0xa')]=function(_0x1c35c0,_0x39cfcd){return _0x1c35c0[_0x8213('0xb')]('UserFaxQueue',attributes,{'tableName':_0x8213('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa2c=['UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0xfa2c,0xda));var _0xcfa2=function(_0x2f76bb,_0xef0e3){_0x2f76bb=_0x2f76bb-0x0;var _0x46895f=_0xfa2c[_0x2f76bb];return _0x46895f;};'use strict';var _=require(_0xcfa2('0x0'));var util=require(_0xcfa2('0x1'));var logger=require(_0xcfa2('0x2'))('api');var moment=require(_0xcfa2('0x3'));var BPromise=require(_0xcfa2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcfa2('0x5'));var config=require(_0xcfa2('0x6'));var attributes=require(_0xcfa2('0x7'));module[_0xcfa2('0x8')]=function(_0x7d77f5,_0x1cea47){return _0x7d77f5[_0xcfa2('0x9')](_0xcfa2('0xa'),attributes,{'tableName':_0xcfa2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 51ab080..8019dee 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 _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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6f12,0x86));var _0x26f1=function(_0x4bbc76,_0x9401ed){_0x4bbc76=_0x4bbc76-0x0;var _0x228f3b=_0x6f12[_0x4bbc76];return _0x228f3b;};'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 +var _0x2343=['error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3edd9f,_0x54cf16){var _0x27ae24=function(_0xd456e2){while(--_0xd456e2){_0x3edd9f['push'](_0x3edd9f['shift']());}};_0x27ae24(++_0x54cf16);}(_0x2343,0xef));var _0x3234=function(_0x44b0de,_0x213afa){_0x44b0de=_0x44b0de-0x0;var _0x21da2a=_0x2343[_0x44b0de];return _0x21da2a;};'use strict';var _=require(_0x3234('0x0'));var util=require(_0x3234('0x1'));var moment=require(_0x3234('0x2'));var BPromise=require('bluebird');var rs=require(_0x3234('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3234('0x4'))['db'];var utils=require(_0x3234('0x5'));var logger=require(_0x3234('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c08f0,_0x23d34b,_0x1da64c){return new BPromise(function(_0x13c9ba,_0x1509c9){return client['request'](_0x2c08f0,_0x1da64c)[_0x3234('0x7')](function(_0x3e9491){logger[_0x3234('0x8')](_0x3234('0x9'),_0x23d34b,_0x3234('0xa'));logger[_0x3234('0xb')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x23d34b,_0x3234('0xa'),JSON[_0x3234('0xc')](_0x3e9491));if(_0x3e9491[_0x3234('0xd')]){if(_0x3e9491[_0x3234('0xd')][_0x3234('0xe')]===0x1f4){logger[_0x3234('0xd')](_0x3234('0x9'),_0x23d34b,_0x3e9491[_0x3234('0xd')][_0x3234('0xf')]);return _0x1509c9(_0x3e9491[_0x3234('0xd')][_0x3234('0xf')]);}logger[_0x3234('0xd')](_0x3234('0x9'),_0x23d34b,_0x3e9491[_0x3234('0xd')][_0x3234('0xf')]);return _0x13c9ba(_0x3e9491[_0x3234('0xd')]['message']);}else{logger['info'](_0x3234('0x9'),_0x23d34b,_0x3234('0xa'));_0x13c9ba(_0x3e9491[_0x3234('0x10')]['message']);}})[_0x3234('0x11')](function(_0x578242){logger[_0x3234('0xd')](_0x3234('0x9'),_0x23d34b,_0x578242);_0x1509c9(_0x578242);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index c8d7d82..d4e755e 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 _0xd028=['../../config/environment','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0xd028,0x105));var _0x8d02=function(_0x579f9a,_0x49758b){_0x579f9a=_0x579f9a-0x0;var _0x1fc3ed=_0xd028[_0x579f9a];return _0x1fc3ed;};'use strict';var multer=require('multer');var util=require(_0x8d02('0x0'));var path=require(_0x8d02('0x1'));var timeout=require(_0x8d02('0x2'));var express=require('express');var router=express[_0x8d02('0x3')]();var auth=require(_0x8d02('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8d02('0x5'));module[_0x8d02('0x6')]=router; \ No newline at end of file +var _0xf30e=['multer','util','path','express','../../components/auth/service','../../config/environment'];(function(_0x4161d7,_0x1eb21b){var _0x3bc9bf=function(_0x147bf3){while(--_0x147bf3){_0x4161d7['push'](_0x4161d7['shift']());}};_0x3bc9bf(++_0x1eb21b);}(_0xf30e,0x150));var _0xef30=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0xf30e[_0x26d386];return _0x4ef9a8;};'use strict';var multer=require(_0xef30('0x0'));var util=require(_0xef30('0x1'));var path=require(_0xef30('0x2'));var timeout=require('connect-timeout');var express=require(_0xef30('0x3'));var router=express['Router']();var auth=require(_0xef30('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xef30('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 b978d3b..859f575 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x3a21c0,_0x348451){var _0x411e84=function(_0xdd7b02){while(--_0xdd7b02){_0x3a21c0['push'](_0x3a21c0['shift']());}};_0x411e84(++_0x348451);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0xb5b3d7,_0x11a6cd){var _0x28bac1=function(_0x1d3a1f){while(--_0x1d3a1f){_0xb5b3d7['push'](_0xb5b3d7['shift']());}};_0x28bac1(++_0x11a6cd);}(_0xe706,0xa3));var _0x6e70=function(_0x9aaca8,_0x222c1a){_0x9aaca8=_0x9aaca8-0x0;var _0x1a77bd=_0xe706[_0x9aaca8];return _0x1a77bd;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index ec92de0..66468fa 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d0183,_0xeeed3e){var _0x488220=function(_0x4ba252){while(--_0x4ba252){_0x5d0183['push'](_0x5d0183['shift']());}};_0x488220(++_0xeeed3e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserMailQueue',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','../../config/logger','api'];(function(_0xdb1d83,_0x5b67a9){var _0x1819f5=function(_0x2e750d){while(--_0x2e750d){_0xdb1d83['push'](_0xdb1d83['shift']());}};_0x1819f5(++_0x5b67a9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 29f9850..e4e4c2d 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 _0x6dac=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6dac,0x16e));var _0xc6da=function(_0x38361b,_0x35fdee){_0x38361b=_0x38361b-0x0;var _0x117b1d=_0x6dac[_0x38361b];return _0x117b1d;};'use strict';var _=require(_0xc6da('0x0'));var util=require(_0xc6da('0x1'));var moment=require(_0xc6da('0x2'));var BPromise=require(_0xc6da('0x3'));var rs=require(_0xc6da('0x4'));var fs=require('fs');var Redis=require(_0xc6da('0x5'));var db=require(_0xc6da('0x6'))['db'];var utils=require(_0xc6da('0x7'));var logger=require(_0xc6da('0x8'))(_0xc6da('0x9'));var config=require(_0xc6da('0xa'));var jayson=require(_0xc6da('0xb'));var client=jayson[_0xc6da('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ebd11,_0x1abd90,_0x5a0d8d){return new BPromise(function(_0x3047d3,_0x2bfaa6){return client[_0xc6da('0xd')](_0x1ebd11,_0x5a0d8d)[_0xc6da('0xe')](function(_0x39a8d8){logger[_0xc6da('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x1abd90,_0xc6da('0x10'));logger[_0xc6da('0x11')](_0xc6da('0x12'),_0x1abd90,_0xc6da('0x10'),JSON[_0xc6da('0x13')](_0x39a8d8));if(_0x39a8d8[_0xc6da('0x14')]){if(_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x15')]===0x1f4){logger[_0xc6da('0x14')](_0xc6da('0x16'),_0x1abd90,_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x17')]);return _0x2bfaa6(_0x39a8d8[_0xc6da('0x14')]['message']);}logger[_0xc6da('0x14')](_0xc6da('0x16'),_0x1abd90,_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x17')]);return _0x3047d3(_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x17')]);}else{logger['info'](_0xc6da('0x16'),_0x1abd90,_0xc6da('0x10'));_0x3047d3(_0x39a8d8[_0xc6da('0x18')][_0xc6da('0x17')]);}})[_0xc6da('0x19')](function(_0x5463a1){logger[_0xc6da('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x1abd90,_0x5463a1);_0x2bfaa6(_0x5463a1);});});} \ No newline at end of file +var _0xdedc=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x16d696,_0xc9412e){var _0x2f91c8=function(_0x30a802){while(--_0x30a802){_0x16d696['push'](_0x16d696['shift']());}};_0x2f91c8(++_0xc9412e);}(_0xdedc,0xb8));var _0xcded=function(_0x50da6b,_0x5b4e89){_0x50da6b=_0x50da6b-0x0;var _0x2f2bca=_0xdedc[_0x50da6b];return _0x2f2bca;};'use strict';var _=require(_0xcded('0x0'));var util=require(_0xcded('0x1'));var moment=require(_0xcded('0x2'));var BPromise=require(_0xcded('0x3'));var rs=require(_0xcded('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcded('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcded('0x6'))(_0xcded('0x7'));var config=require(_0xcded('0x8'));var jayson=require(_0xcded('0x9'));var client=jayson['client'][_0xcded('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x333e61,_0x50d7ae,_0x21f513){return new BPromise(function(_0x488df8,_0x5a8057){return client[_0xcded('0xb')](_0x333e61,_0x21f513)['then'](function(_0x5b6bdc){logger[_0xcded('0xc')](_0xcded('0xd'),_0x50d7ae,_0xcded('0xe'));logger['debug'](_0xcded('0xf'),_0x50d7ae,_0xcded('0xe'),JSON[_0xcded('0x10')](_0x5b6bdc));if(_0x5b6bdc[_0xcded('0x11')]){if(_0x5b6bdc[_0xcded('0x11')]['code']===0x1f4){logger[_0xcded('0x11')](_0xcded('0xd'),_0x50d7ae,_0x5b6bdc[_0xcded('0x11')][_0xcded('0x12')]);return _0x5a8057(_0x5b6bdc['error'][_0xcded('0x12')]);}logger[_0xcded('0x11')](_0xcded('0xd'),_0x50d7ae,_0x5b6bdc['error'][_0xcded('0x12')]);return _0x488df8(_0x5b6bdc[_0xcded('0x11')][_0xcded('0x12')]);}else{logger['info'](_0xcded('0xd'),_0x50d7ae,'request\x20sent');_0x488df8(_0x5b6bdc[_0xcded('0x13')][_0xcded('0x12')]);}})[_0xcded('0x14')](function(_0x59b28d){logger[_0xcded('0x11')](_0xcded('0xd'),_0x50d7ae,_0x59b28d);_0x5a8057(_0x59b28d);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index ffb772f..49cf536 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 _0x9188=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','util','path','connect-timeout','express'];(function(_0x2b63a0,_0x14fc48){var _0x4f0434=function(_0x8cba9e){while(--_0x8cba9e){_0x2b63a0['push'](_0x2b63a0['shift']());}};_0x4f0434(++_0x14fc48);}(_0x9188,0x8c));var _0x8918=function(_0x58f23d,_0x269aad){_0x58f23d=_0x58f23d-0x0;var _0x11045a=_0x9188[_0x58f23d];return _0x11045a;};'use strict';var multer=require('multer');var util=require(_0x8918('0x0'));var path=require(_0x8918('0x1'));var timeout=require(_0x8918('0x2'));var express=require(_0x8918('0x3'));var router=express[_0x8918('0x4')]();var auth=require(_0x8918('0x5'));var interaction=require(_0x8918('0x6'));var config=require(_0x8918('0x7'));var controller=require('./userNotification.controller');router[_0x8918('0x8')]('/',auth[_0x8918('0x9')](),controller[_0x8918('0xa')]);module[_0x8918('0xb')]=router; \ No newline at end of file +var _0x0d24=['express','../../components/auth/service','../../config/environment','post','isAuthenticated','sendUserNotification','multer','util','path','connect-timeout'];(function(_0x535cc1,_0x31b157){var _0x2dc22c=function(_0x7781b5){while(--_0x7781b5){_0x535cc1['push'](_0x535cc1['shift']());}};_0x2dc22c(++_0x31b157);}(_0x0d24,0xa6));var _0x40d2=function(_0x4448a9,_0x7052b4){_0x4448a9=_0x4448a9-0x0;var _0x3cef68=_0x0d24[_0x4448a9];return _0x3cef68;};'use strict';var multer=require(_0x40d2('0x0'));var util=require(_0x40d2('0x1'));var path=require(_0x40d2('0x2'));var timeout=require(_0x40d2('0x3'));var express=require(_0x40d2('0x4'));var router=express['Router']();var auth=require(_0x40d2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x40d2('0x6'));var controller=require('./userNotification.controller');router[_0x40d2('0x7')]('/',auth[_0x40d2('0x8')](),controller[_0x40d2('0x9')]);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 8360c12..6a762ba 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 _0x770e=['TEXT','STRING','BOOLEAN','exports'];(function(_0x362eab,_0x1dcf02){var _0x1e1e32=function(_0x341ecc){while(--_0x341ecc){_0x362eab['push'](_0x362eab['shift']());}};_0x1e1e32(++_0x1dcf02);}(_0x770e,0xf7));var _0xe770=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x770e[_0x125ff8];return _0x2d9ef;};'use strict';var Sequelize=require('sequelize');module[_0xe770('0x0')]={'body':{'type':Sequelize[_0xe770('0x1')]},'senderName':{'type':Sequelize[_0xe770('0x2')]},'recipientsId':{'type':Sequelize[_0xe770('0x1')]},'recipientsDescription':{'type':Sequelize[_0xe770('0x2')]},'beep':{'type':Sequelize[_0xe770('0x3')]}}; \ No newline at end of file +var _0x7f36=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x5f2b77,_0x48966b){var _0x2b8fca=function(_0x50e0c5){while(--_0x50e0c5){_0x5f2b77['push'](_0x5f2b77['shift']());}};_0x2b8fca(++_0x48966b);}(_0x7f36,0xc8));var _0x67f3=function(_0xaadd9a,_0x432378){_0xaadd9a=_0xaadd9a-0x0;var _0x1a14dd=_0x7f36[_0xaadd9a];return _0x1a14dd;};'use strict';var Sequelize=require(_0x67f3('0x0'));module[_0x67f3('0x1')]={'body':{'type':Sequelize[_0x67f3('0x2')]},'senderName':{'type':Sequelize[_0x67f3('0x3')]},'recipientsId':{'type':Sequelize[_0x67f3('0x2')]},'recipientsDescription':{'type':Sequelize[_0x67f3('0x3')]},'beep':{'type':Sequelize[_0x67f3('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 9842aad..2085f42 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 _0xacfa=['transaction','UserNotification','create','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','union','queue','ids','push','all','flatten','map','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xacfa,0x6e));var _0xaacf=function(_0xd5ea18,_0x44e0d8){_0xd5ea18=_0xd5ea18-0x0;var _0x447951=_0xacfa[_0xd5ea18];return _0x447951;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xaacf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaacf('0x1'));var rp=require(_0xaacf('0x2'));var moment=require('moment');var BPromise=require(_0xaacf('0x3'));var Mustache=require(_0xaacf('0x4'));var util=require('util');var path=require(_0xaacf('0x5'));var sox=require('sox');var csv=require(_0xaacf('0x6'));var ejs=require(_0xaacf('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaacf('0x8'));var crypto=require(_0xaacf('0x9'));var jsforce=require(_0xaacf('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xaacf('0x6'));var querystring=require(_0xaacf('0xb'));var Papa=require('papaparse');var Redis=require(_0xaacf('0xc'));var authService=require(_0xaacf('0xd'));var qs=require(_0xaacf('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaacf('0xf'));var logger=require('../../config/logger')(_0xaacf('0x10'));var utils=require(_0xaacf('0x11'));var config=require(_0xaacf('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xaacf('0x13'))['db'];config['redis']=_[_0xaacf('0x14')](config[_0xaacf('0x15')],{'host':_0xaacf('0x16'),'port':0x18eb});var socket=require(_0xaacf('0x17'))(new Redis(config[_0xaacf('0x15')]));require(_0xaacf('0x18'))[_0xaacf('0x19')](socket);function respondWithStatusCode(_0x146b03,_0xbe4b4a){_0xbe4b4a=_0xbe4b4a||0xcc;return function(_0x3e3071){if(_0x3e3071){return _0x146b03[_0xaacf('0x1a')](_0xbe4b4a);}return _0x146b03[_0xaacf('0x1b')](_0xbe4b4a)[_0xaacf('0x1c')]();};}function respondWithResult(_0x25162a,_0x2bc648){_0x2bc648=_0x2bc648||0xc8;return function(_0x223b0b){if(_0x223b0b){return _0x25162a['status'](_0x2bc648)[_0xaacf('0x1d')](_0x223b0b);}};}function respondWithFilteredResult(_0x4cc967,_0x48ac07){return function(_0x72afb9){if(_0x72afb9){var _0x3b7782=_0x72afb9[_0xaacf('0x1e')],_0x4ac341=_0x48ac07[_0xaacf('0x1f')],_0x4a24dc=_0x48ac07['offset']+_0x48ac07[_0xaacf('0x20')],_0x41aa21;if(_0x4a24dc>=_0x3b7782){_0x4a24dc=_0x3b7782;_0x41aa21=0xc8;}else{_0x41aa21=0xce;}_0x4cc967[_0xaacf('0x1b')](_0x41aa21);return _0x4cc967[_0xaacf('0x21')](_0xaacf('0x22'),_0x4ac341+'-'+_0x4a24dc+'/'+_0x3b7782)[_0xaacf('0x1d')](_0x72afb9);}return null;};}function patchUpdates(_0x2355b1){return function(_0x53901a){try{jsonpatch['apply'](_0x53901a,_0x2355b1,!![]);}catch(_0x5479f8){return BPromise['reject'](_0x5479f8);}return _0x53901a[_0xaacf('0x23')]();};}function saveUpdates(_0x2c3bab,_0x4e7210){return function(_0x36e3ab){if(_0x36e3ab){return _0x36e3ab['update'](_0x2c3bab)[_0xaacf('0x24')](function(_0x40c50d){return _0x40c50d;});}return null;};}function removeEntity(_0x36ddab,_0x505878){return function(_0x481839){if(_0x481839){return _0x481839['destroy']()[_0xaacf('0x24')](function(){_0x36ddab[_0xaacf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a256e,_0x4d4ab1){return function(_0x306e47){if(!_0x306e47){_0x3a256e[_0xaacf('0x1a')](0x194);}return _0x306e47;};}function handleError(_0x55eb66,_0x116148){_0x116148=_0x116148||0x1f4;return function(_0x537821){logger['error'](_0x537821['stack']);if(_0x537821[_0xaacf('0x25')]){delete _0x537821[_0xaacf('0x25')];}_0x55eb66['status'](_0x116148)['send'](_0x537821);};}exports[_0xaacf('0x26')]=function(_0xa4fc53,_0xa127a0,_0x5abca2){if(!_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x28')](_0xaacf('0x29'))&&!_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x28')](_0xaacf('0x2a'))){throw new db['Sequelize'][(_0xaacf('0x2b'))](_0xaacf('0x2c'));}else{if(_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x28')](_0xaacf('0x2a'))&&!_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x28')](_0xaacf('0x2d'))){throw new db[(_0xaacf('0x2e'))][(_0xaacf('0x2b'))](_0xaacf('0x2f'));}if(!_0xa4fc53['body']['hasOwnProperty'](_0xaacf('0x30'))){throw new db['Sequelize'][(_0xaacf('0x2b'))](_0xaacf('0x31'));}else{try{var _0x4a8786=JSON[_0xaacf('0x32')](_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x30')]);}catch(_0x33821f){logger['error'](_0x33821f);throw new db['Sequelize'][(_0xaacf('0x2b'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x8b9fef=[_0xaacf('0x33'),_0xaacf('0x34'),'mailqueue',_0xaacf('0x35'),'smsqueue',_0xaacf('0x36'),_0xaacf('0x37'),_0xaacf('0x38'),_0xaacf('0x39')];if(_[_0xaacf('0x3a')](_0x4a8786,function(_0x17e4e9){return!_[_0xaacf('0x3b')](_0x8b9fef,_0x17e4e9[_0xaacf('0x3c')]['toLowerCase']());})){throw new db[(_0xaacf('0x2e'))][(_0xaacf('0x2b'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0xef8d66={};_0xef8d66[_0xaacf('0x3d')]=_0xa4fc53['body'][_0xaacf('0x28')]('senderName')?_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x3d')]:_0xa4fc53[_0xaacf('0x39')]['fullname'];_0xef8d66[_0xaacf('0x3e')]=_[_0xaacf('0x3f')](_0xa4fc53['body'][_0xaacf('0x3e')])?null:_0xa4fc53['body']['recipientsDescription'];_0xef8d66[_0xaacf('0x40')]=_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x40')]||![];_0xef8d66[_0xaacf('0x41')]=_0xa4fc53[_0xaacf('0x39')]['id'];return getContent(_0xa4fc53[_0xaacf('0x27')])[_0xaacf('0x24')](function(_0x540b66){_0xef8d66[_0xaacf('0x27')]=_0x540b66;return getRecipients(_0x4a8786);})[_0xaacf('0x24')](function(_0x3c05f0){_0xef8d66[_0xaacf('0x42')]=_[_0xaacf('0x43')](_0x3c05f0)['join'](',');return db['sequelize'][_0xaacf('0x44')](function(_0x323738){return db[_0xaacf('0x45')][_0xaacf('0x46')](_0xef8d66,{'raw':!![],'transaction':_0x323738})['then'](function(_0x434d6c){var _0x534110={'sender':_0xef8d66['senderName'],'description':_0xef8d66['recipientsDescription'],'content':_0xef8d66['body'],'beep':_0xef8d66['beep']};_0x3c05f0['forEach'](function(_0xec98ae){_0x534110[_0xaacf('0x47')]=_0xec98ae;socket[_0xaacf('0x48')](_0xaacf('0x49'),_0x534110);});return _0x434d6c;});});})[_0xaacf('0x24')](respondWithResult(_0xa127a0,0xc9))[_0xaacf('0x4a')](handleError(_0xa127a0,null));};function getContent(_0xca2bdb){return new BPromise(function(_0x588171,_0x237b07){if(_0xca2bdb[_0xaacf('0x29')]){_0x588171(_0xca2bdb[_0xaacf('0x29')]);return;}return db[_0xaacf('0x4b')][_0xaacf('0x4c')]({'attributes':[_0xaacf('0x4d')],'where':{'id':_0xca2bdb[_0xaacf('0x2a')]},'raw':!![]})['then'](function(_0x5cd429){if(!_0x5cd429)throw new db[(_0xaacf('0x2e'))][(_0xaacf('0x2b'))](_0xaacf('0x4e'));var _0x2ab8b7=Mustache[_0xaacf('0x4f')](_0x5cd429[_0xaacf('0x4d')],_0xca2bdb[_0xaacf('0x2d')]);_0x588171(_0x2ab8b7);})['catch'](function(_0x2dbd76){_0x237b07(_0x2dbd76);});});}function getRecipients(_0x292d5f){return new BPromise(function(_0x15c964,_0x41f5da){var _0x434538=[];var _0xc01865=[];_0x292d5f['forEach'](function(_0x21feb7){var _0x2dfd4d=_[_0xaacf('0x50')](_0x21feb7['model'][_0xaacf('0x51')]());if(_0x2dfd4d==='User'){_0x434538=_[_0xaacf('0x52')](_0x434538,_0x21feb7['ids']);}else{if(_[_0xaacf('0x3b')](_0x2dfd4d,_0xaacf('0x53')))_0x2dfd4d=_0x2dfd4d['replace']('queue','Queue');_0x21feb7[_0xaacf('0x54')]['forEach'](function(_0x2ff114){_0xc01865[_0xaacf('0x55')](getAgents(_0x2dfd4d,_0x2ff114));});}});return BPromise[_0xaacf('0x56')](_0xc01865)[_0xaacf('0x24')](function(_0x2a4a2e){_0x434538=_[_0xaacf('0x52')](_0x434538,_[_0xaacf('0x57')](_0x2a4a2e));_0x15c964(_0x434538);})[_0xaacf('0x4a')](function(_0x564538){_0x41f5da(_0x564538);});});}function getAgents(_0x417e5c,_0x2639cd){return new BPromise(function(_0x1efea2,_0x1533f2){return db[_0x417e5c]['findOne']({'where':{'id':_0x2639cd}})[_0xaacf('0x24')](function(_0x3a36cb){return _0x3a36cb['getAgents']({'attributes':['id'],'raw':!![]})[_0xaacf('0x24')](function(_0x5eb305){var _0x1c5519=_[_0xaacf('0x58')](_0x5eb305,'id');_0x1efea2(_0x1c5519);});})['catch'](function(_0x3a005a){_0x1533f2(_0x3a005a);});});} \ No newline at end of file +var _0xcd12=['reject','save','then','destroy','error','stack','name','send','sendUserNotification','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','replace','queue','Queue','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./userNotification.socket','sendStatus','status','end','count','offset','limit','Content-Range','json','apply'];(function(_0x10dad0,_0x49260e){var _0x140d80=function(_0x32b47e){while(--_0x32b47e){_0x10dad0['push'](_0x10dad0['shift']());}};_0x140d80(++_0x49260e);}(_0xcd12,0xa2));var _0x2cd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd12[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2cd1('0x0'));var emlformat=require(_0x2cd1('0x1'));var rimraf=require(_0x2cd1('0x2'));var zipdir=require(_0x2cd1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2cd1('0x4'));var BPromise=require(_0x2cd1('0x5'));var Mustache=require('mustache');var util=require(_0x2cd1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2cd1('0x7'));var ejs=require(_0x2cd1('0x8'));var fs=require('fs');var _=require(_0x2cd1('0x9'));var squel=require(_0x2cd1('0xa'));var crypto=require(_0x2cd1('0xb'));var jsforce=require(_0x2cd1('0xc'));var deskjs=require(_0x2cd1('0xd'));var toCsv=require(_0x2cd1('0x7'));var querystring=require(_0x2cd1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2cd1('0xf'));var qs=require(_0x2cd1('0x10'));var as=require(_0x2cd1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2cd1('0x12'));var utils=require(_0x2cd1('0x13'));var config=require(_0x2cd1('0x14'));var licenseUtil=require(_0x2cd1('0x15'));var db=require(_0x2cd1('0x16'))['db'];config['redis']=_[_0x2cd1('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2cd1('0x18'))(new Redis(config[_0x2cd1('0x19')]));require(_0x2cd1('0x1a'))['register'](socket);function respondWithStatusCode(_0x16cd50,_0x35c988){_0x35c988=_0x35c988||0xcc;return function(_0x103b55){if(_0x103b55){return _0x16cd50[_0x2cd1('0x1b')](_0x35c988);}return _0x16cd50[_0x2cd1('0x1c')](_0x35c988)[_0x2cd1('0x1d')]();};}function respondWithResult(_0x40ece3,_0x6ff2bb){_0x6ff2bb=_0x6ff2bb||0xc8;return function(_0x4ecab4){if(_0x4ecab4){return _0x40ece3[_0x2cd1('0x1c')](_0x6ff2bb)['json'](_0x4ecab4);}};}function respondWithFilteredResult(_0x12c739,_0x2f4da8){return function(_0x396d56){if(_0x396d56){var _0x5cd05f=_0x396d56[_0x2cd1('0x1e')],_0x15e5cb=_0x2f4da8['offset'],_0x3ae733=_0x2f4da8[_0x2cd1('0x1f')]+_0x2f4da8[_0x2cd1('0x20')],_0x1ad576;if(_0x3ae733>=_0x5cd05f){_0x3ae733=_0x5cd05f;_0x1ad576=0xc8;}else{_0x1ad576=0xce;}_0x12c739[_0x2cd1('0x1c')](_0x1ad576);return _0x12c739['set'](_0x2cd1('0x21'),_0x15e5cb+'-'+_0x3ae733+'/'+_0x5cd05f)[_0x2cd1('0x22')](_0x396d56);}return null;};}function patchUpdates(_0x3373d7){return function(_0x5af6b3){try{jsonpatch[_0x2cd1('0x23')](_0x5af6b3,_0x3373d7,!![]);}catch(_0x1f3596){return BPromise[_0x2cd1('0x24')](_0x1f3596);}return _0x5af6b3[_0x2cd1('0x25')]();};}function saveUpdates(_0x55b0de,_0x26254d){return function(_0x58b56d){if(_0x58b56d){return _0x58b56d['update'](_0x55b0de)[_0x2cd1('0x26')](function(_0x8facb5){return _0x8facb5;});}return null;};}function removeEntity(_0x321990,_0x43fd96){return function(_0x426dfe){if(_0x426dfe){return _0x426dfe[_0x2cd1('0x27')]()[_0x2cd1('0x26')](function(){_0x321990[_0x2cd1('0x1c')](0xcc)[_0x2cd1('0x1d')]();});}};}function handleEntityNotFound(_0x228e09,_0x4376e7){return function(_0x1a90eb){if(!_0x1a90eb){_0x228e09['sendStatus'](0x194);}return _0x1a90eb;};}function handleError(_0x151969,_0x4d6ac8){_0x4d6ac8=_0x4d6ac8||0x1f4;return function(_0x142fdf){logger[_0x2cd1('0x28')](_0x142fdf[_0x2cd1('0x29')]);if(_0x142fdf[_0x2cd1('0x2a')]){delete _0x142fdf[_0x2cd1('0x2a')];}_0x151969[_0x2cd1('0x1c')](_0x4d6ac8)[_0x2cd1('0x2b')](_0x142fdf);};}exports[_0x2cd1('0x2c')]=function(_0x207a6e,_0x1bb79e,_0x701058){if(!_0x207a6e['body'][_0x2cd1('0x2d')]('text')&&!_0x207a6e['body'][_0x2cd1('0x2d')](_0x2cd1('0x2e'))){throw new db['Sequelize'][(_0x2cd1('0x2f'))](_0x2cd1('0x30'));}else{if(_0x207a6e[_0x2cd1('0x31')][_0x2cd1('0x2d')](_0x2cd1('0x2e'))&&!_0x207a6e[_0x2cd1('0x31')]['hasOwnProperty'](_0x2cd1('0x32'))){throw new db['Sequelize'][(_0x2cd1('0x2f'))](_0x2cd1('0x33'));}if(!_0x207a6e[_0x2cd1('0x31')][_0x2cd1('0x2d')](_0x2cd1('0x34'))){throw new db[(_0x2cd1('0x35'))][(_0x2cd1('0x2f'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x9298d=JSON[_0x2cd1('0x36')](_0x207a6e['body'][_0x2cd1('0x34')]);}catch(_0x4b35ec){logger['error'](_0x4b35ec);throw new db[(_0x2cd1('0x35'))]['ValidationError'](_0x2cd1('0x37'));}var _0x44b44c=[_0x2cd1('0x38'),_0x2cd1('0x39'),_0x2cd1('0x3a'),_0x2cd1('0x3b'),_0x2cd1('0x3c'),_0x2cd1('0x3d'),'whatsappqueue',_0x2cd1('0x3e'),_0x2cd1('0x3f')];if(_[_0x2cd1('0x40')](_0x9298d,function(_0x37a886){return!_[_0x2cd1('0x41')](_0x44b44c,_0x37a886['model'][_0x2cd1('0x42')]());})){throw new db[(_0x2cd1('0x35'))][(_0x2cd1('0x2f'))](_0x2cd1('0x43'));}}}var _0x23e5f8={};_0x23e5f8[_0x2cd1('0x44')]=_0x207a6e[_0x2cd1('0x31')]['hasOwnProperty'](_0x2cd1('0x44'))?_0x207a6e[_0x2cd1('0x31')]['senderName']:_0x207a6e[_0x2cd1('0x3f')][_0x2cd1('0x45')];_0x23e5f8[_0x2cd1('0x46')]=_[_0x2cd1('0x47')](_0x207a6e[_0x2cd1('0x31')]['recipientsDescription'])?null:_0x207a6e[_0x2cd1('0x31')][_0x2cd1('0x46')];_0x23e5f8[_0x2cd1('0x48')]=_0x207a6e[_0x2cd1('0x31')][_0x2cd1('0x48')]||![];_0x23e5f8['SenderId']=_0x207a6e[_0x2cd1('0x3f')]['id'];return getContent(_0x207a6e[_0x2cd1('0x31')])[_0x2cd1('0x26')](function(_0x42c77b){_0x23e5f8['body']=_0x42c77b;return getRecipients(_0x9298d);})[_0x2cd1('0x26')](function(_0x30c1e3){_0x23e5f8['recipientsId']=_[_0x2cd1('0x49')](_0x30c1e3)[_0x2cd1('0x4a')](',');return db[_0x2cd1('0x4b')][_0x2cd1('0x4c')](function(_0x2ff9be){return db[_0x2cd1('0x4d')][_0x2cd1('0x4e')](_0x23e5f8,{'raw':!![],'transaction':_0x2ff9be})[_0x2cd1('0x26')](function(_0x73525b){var _0x2d2400={'sender':_0x23e5f8[_0x2cd1('0x44')],'description':_0x23e5f8[_0x2cd1('0x46')],'content':_0x23e5f8['body'],'beep':_0x23e5f8['beep']};_0x30c1e3[_0x2cd1('0x4f')](function(_0x1757f0){_0x2d2400[_0x2cd1('0x50')]=_0x1757f0;socket[_0x2cd1('0x51')](_0x2cd1('0x52'),_0x2d2400);});return _0x73525b;});});})[_0x2cd1('0x26')](respondWithResult(_0x1bb79e,0xc9))[_0x2cd1('0x53')](handleError(_0x1bb79e,null));};function getContent(_0x29ea6f){return new BPromise(function(_0x353aaa,_0x25fb5f){if(_0x29ea6f['text']){_0x353aaa(_0x29ea6f[_0x2cd1('0x54')]);return;}return db['Template'][_0x2cd1('0x55')]({'attributes':[_0x2cd1('0x56')],'where':{'id':_0x29ea6f[_0x2cd1('0x2e')]},'raw':!![]})[_0x2cd1('0x26')](function(_0x1efa80){if(!_0x1efa80)throw new db[(_0x2cd1('0x35'))][(_0x2cd1('0x2f'))](_0x2cd1('0x57'));var _0x39ffe5=Mustache[_0x2cd1('0x58')](_0x1efa80['html'],_0x29ea6f['view']);_0x353aaa(_0x39ffe5);})['catch'](function(_0x4027f9){_0x25fb5f(_0x4027f9);});});}function getRecipients(_0x391cfe){return new BPromise(function(_0x2722cc,_0x2ed073){var _0x4e19ad=[];var _0x42c4ff=[];_0x391cfe['forEach'](function(_0x2ecd58){var _0x55f4a7=_[_0x2cd1('0x59')](_0x2ecd58['model']['toLowerCase']());if(_0x55f4a7===_0x2cd1('0x5a')){_0x4e19ad=_[_0x2cd1('0x5b')](_0x4e19ad,_0x2ecd58[_0x2cd1('0x5c')]);}else{if(_[_0x2cd1('0x41')](_0x55f4a7,'queue'))_0x55f4a7=_0x55f4a7[_0x2cd1('0x5d')](_0x2cd1('0x5e'),_0x2cd1('0x5f'));_0x2ecd58[_0x2cd1('0x5c')][_0x2cd1('0x4f')](function(_0x22b8cc){_0x42c4ff['push'](getAgents(_0x55f4a7,_0x22b8cc));});}});return BPromise['all'](_0x42c4ff)['then'](function(_0x493717){_0x4e19ad=_['union'](_0x4e19ad,_[_0x2cd1('0x60')](_0x493717));_0x2722cc(_0x4e19ad);})[_0x2cd1('0x53')](function(_0xb1b2f2){_0x2ed073(_0xb1b2f2);});});}function getAgents(_0x54336b,_0x3d37ca){return new BPromise(function(_0x5d4000,_0x122f67){return db[_0x54336b][_0x2cd1('0x55')]({'where':{'id':_0x3d37ca}})[_0x2cd1('0x26')](function(_0x2e51f7){return _0x2e51f7[_0x2cd1('0x61')]({'attributes':['id'],'raw':!![]})[_0x2cd1('0x26')](function(_0x10d9d6){var _0x3b0667=_[_0x2cd1('0x62')](_0x10d9d6,'id');_0x5d4000(_0x3b0667);});})[_0x2cd1('0x53')](function(_0x5c9185){_0x122f67(_0x5c9185);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index a7bdb8f..f539076 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 _0xfd28=['UserNotification','save','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x5d50c8,_0x2cfa52){var _0x19a9d4=function(_0x530d65){while(--_0x530d65){_0x5d50c8['push'](_0x5d50c8['shift']());}};_0x19a9d4(++_0x2cfa52);}(_0xfd28,0x148));var _0x8fd2=function(_0xcfeff4,_0x3f2e19){_0xcfeff4=_0xcfeff4-0x0;var _0xb2fadc=_0xfd28[_0xcfeff4];return _0xb2fadc;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x8fd2('0x0'))['db'][_0x8fd2('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8fd2('0x2'),'afterUpdate':'update','afterDestroy':_0x8fd2('0x3')};function emitEvent(_0xf7417d){return function(_0x4e2108,_0x4b22ae,_0x155f46){UserNotificationEvents[_0x8fd2('0x4')](_0xf7417d+':'+_0x4e2108['id'],_0x4e2108);UserNotificationEvents[_0x8fd2('0x4')](_0xf7417d,_0x4e2108);_0x155f46(null);};}for(var e in events){if(events[_0x8fd2('0x5')](e)){var event=events[e];UserNotification[_0x8fd2('0x6')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x29d4=['save','update','remove','emit','hasOwnProperty','hook','exports','events','UserNotification','setMaxListeners'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x29d4,0x1a1));var _0x429d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x29d4[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x429d('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x429d('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x429d('0x2')](0x0);var events={'afterCreate':_0x429d('0x3'),'afterUpdate':_0x429d('0x4'),'afterDestroy':_0x429d('0x5')};function emitEvent(_0x4e287b){return function(_0xc3989d,_0x3f43f5,_0x36a3d8){UserNotificationEvents[_0x429d('0x6')](_0x4e287b+':'+_0xc3989d['id'],_0xc3989d);UserNotificationEvents[_0x429d('0x6')](_0x4e287b,_0xc3989d);_0x36a3d8(null);};}for(var e in events){if(events[_0x429d('0x7')](e)){var event=events[e];UserNotification[_0x429d('0x8')](e,emitEvent(event));}}module[_0x429d('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 4eaf364..7e3786a 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 _0x7d80=['api','moment','bluebird','request-promise','rimraf','./userNotification.attributes','exports','UserNotification','util','../../config/logger'];(function(_0x368726,_0x4a651d){var _0x3fc2e7=function(_0x484a0b){while(--_0x484a0b){_0x368726['push'](_0x368726['shift']());}};_0x3fc2e7(++_0x4a651d);}(_0x7d80,0x17a));var _0x07d8=function(_0x76a463,_0x406998){_0x76a463=_0x76a463-0x0;var _0xd5eafb=_0x7d80[_0x76a463];return _0xd5eafb;};'use strict';var _=require('lodash');var util=require(_0x07d8('0x0'));var logger=require(_0x07d8('0x1'))(_0x07d8('0x2'));var moment=require(_0x07d8('0x3'));var BPromise=require(_0x07d8('0x4'));var rp=require(_0x07d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07d8('0x6'));var config=require('../../config/environment');var attributes=require(_0x07d8('0x7'));module[_0x07d8('0x8')]=function(_0x3e7308,_0x53231b){return _0x3e7308['define'](_0x07d8('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbf82=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./userNotification.attributes','exports','userNotifications','utf8mb4_unicode_ci','lodash'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0xbf82,0x1cb));var _0x2bf8=function(_0x2fe846,_0x299e61){_0x2fe846=_0x2fe846-0x0;var _0x18ac40=_0xbf82[_0x2fe846];return _0x18ac40;};'use strict';var _=require(_0x2bf8('0x0'));var util=require('util');var logger=require(_0x2bf8('0x1'))('api');var moment=require(_0x2bf8('0x2'));var BPromise=require(_0x2bf8('0x3'));var rp=require(_0x2bf8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2bf8('0x5'));var attributes=require(_0x2bf8('0x6'));module[_0x2bf8('0x7')]=function(_0x20dc19,_0x19d402){return _0x20dc19['define']('UserNotification',attributes,{'tableName':_0x2bf8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2bf8('0x9')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 8f1089f..d7f2061 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 _0xb74d=['request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./userNotification.socket','register'];(function(_0x326f38,_0x417aef){var _0x34c233=function(_0x313a9b){while(--_0x313a9b){_0x326f38['push'](_0x326f38['shift']());}};_0x34c233(++_0x417aef);}(_0xb74d,0x1b4));var _0xdb74=function(_0x3186aa,_0x34c21e){_0x3186aa=_0x3186aa-0x0;var _0x2d8c36=_0xb74d[_0x3186aa];return _0x2d8c36;};'use strict';var _=require(_0xdb74('0x0'));var util=require(_0xdb74('0x1'));var moment=require(_0xdb74('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb74('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdb74('0x4'))(_0xdb74('0x5'));var config=require(_0xdb74('0x6'));var jayson=require(_0xdb74('0x7'));var client=jayson['client'][_0xdb74('0x8')]({'port':0x232a});config[_0xdb74('0x9')]=_['defaults'](config['redis'],{'host':_0xdb74('0xa'),'port':0x18eb});var socket=require(_0xdb74('0xb'))(new Redis(config[_0xdb74('0x9')]));require(_0xdb74('0xc'))[_0xdb74('0xd')](socket);function respondWithRpcPromise(_0x52b033,_0x22a19c,_0x5a2d88){return new BPromise(function(_0x2ffe35,_0x5541f0){return client[_0xdb74('0xe')](_0x52b033,_0x5a2d88)[_0xdb74('0xf')](function(_0x35be3b){logger[_0xdb74('0x10')](_0xdb74('0x11'),_0x22a19c,'request\x20sent');logger[_0xdb74('0x12')](_0xdb74('0x13'),_0x22a19c,_0xdb74('0x14'),JSON['stringify'](_0x35be3b));if(_0x35be3b[_0xdb74('0x15')]){if(_0x35be3b[_0xdb74('0x15')][_0xdb74('0x16')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x22a19c,_0x35be3b['error'][_0xdb74('0x17')]);return _0x5541f0(_0x35be3b[_0xdb74('0x15')][_0xdb74('0x17')]);}logger['error'](_0xdb74('0x11'),_0x22a19c,_0x35be3b[_0xdb74('0x15')]['message']);return _0x2ffe35(_0x35be3b['error'][_0xdb74('0x17')]);}else{logger[_0xdb74('0x10')](_0xdb74('0x11'),_0x22a19c,_0xdb74('0x14'));_0x2ffe35(_0x35be3b['result'][_0xdb74('0x17')]);}})[_0xdb74('0x18')](function(_0x3e7ebc){logger[_0xdb74('0x15')](_0xdb74('0x11'),_0x22a19c,_0x3e7ebc);_0x5541f0(_0x3e7ebc);});});} \ No newline at end of file +var _0x90b0=['info','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0x90b0,0x1bc));var _0x090b=function(_0x3065e5,_0x3dbf72){_0x3065e5=_0x3065e5-0x0;var _0x4ef6aa=_0x90b0[_0x3065e5];return _0x4ef6aa;};'use strict';var _=require('lodash');var util=require(_0x090b('0x0'));var moment=require(_0x090b('0x1'));var BPromise=require(_0x090b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x090b('0x3'));var db=require(_0x090b('0x4'))['db'];var utils=require(_0x090b('0x5'));var logger=require(_0x090b('0x6'))(_0x090b('0x7'));var config=require(_0x090b('0x8'));var jayson=require(_0x090b('0x9'));var client=jayson[_0x090b('0xa')][_0x090b('0xb')]({'port':0x232a});config['redis']=_[_0x090b('0xc')](config[_0x090b('0xd')],{'host':_0x090b('0xe'),'port':0x18eb});var socket=require(_0x090b('0xf'))(new Redis(config[_0x090b('0xd')]));require(_0x090b('0x10'))[_0x090b('0x11')](socket);function respondWithRpcPromise(_0x3e00a4,_0x36a5ce,_0x5b51dd){return new BPromise(function(_0x5d648e,_0x12a6a6){return client[_0x090b('0x12')](_0x3e00a4,_0x5b51dd)[_0x090b('0x13')](function(_0x21e119){logger[_0x090b('0x14')]('UserNotification,\x20%s,\x20%s',_0x36a5ce,_0x090b('0x15'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x36a5ce,'request\x20sent',JSON[_0x090b('0x16')](_0x21e119));if(_0x21e119[_0x090b('0x17')]){if(_0x21e119[_0x090b('0x17')][_0x090b('0x18')]===0x1f4){logger['error'](_0x090b('0x19'),_0x36a5ce,_0x21e119[_0x090b('0x17')]['message']);return _0x12a6a6(_0x21e119['error'][_0x090b('0x1a')]);}logger[_0x090b('0x17')](_0x090b('0x19'),_0x36a5ce,_0x21e119[_0x090b('0x17')][_0x090b('0x1a')]);return _0x5d648e(_0x21e119['error'][_0x090b('0x1a')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x36a5ce,_0x090b('0x15'));_0x5d648e(_0x21e119[_0x090b('0x1b')]['message']);}})[_0x090b('0x1c')](function(_0x5d4f5f){logger['error']('UserNotification,\x20%s,\x20%s',_0x36a5ce,_0x5d4f5f);_0x12a6a6(_0x5d4f5f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index f9e1fda..55c6110 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 _0x0738=['update','emit','removeListener','register','length','userNotification:','./userNotification.events','remove'];(function(_0x5eeb5c,_0x7f0265){var _0x2c1901=function(_0x40e7be){while(--_0x40e7be){_0x5eeb5c['push'](_0x5eeb5c['shift']());}};_0x2c1901(++_0x7f0265);}(_0x0738,0x6e));var _0x8073=function(_0x38ae4f,_0x1d3180){_0x38ae4f=_0x38ae4f-0x0;var _0x1e92db=_0x0738[_0x38ae4f];return _0x1e92db;};'use strict';var UserNotificationEvents=require(_0x8073('0x0'));var events=['save',_0x8073('0x1'),_0x8073('0x2')];function createListener(_0x46b716,_0xf6179e){return function(_0x8e2e35){_0xf6179e[_0x8073('0x3')](_0x46b716,_0x8e2e35);};}function removeListener(_0x176f52,_0x38b47d){return function(){UserNotificationEvents[_0x8073('0x4')](_0x176f52,_0x38b47d);};}exports[_0x8073('0x5')]=function(_0x2f90b9){for(var _0x588057=0x0,_0x1aad61=events[_0x8073('0x6')];_0x588057<_0x1aad61;_0x588057++){var _0x2899ce=events[_0x588057];var _0x310f3a=createListener(_0x8073('0x7')+_0x2899ce,_0x2f90b9);UserNotificationEvents['on'](_0x2899ce,_0x310f3a);}}; \ No newline at end of file +var _0x4cc7=['update','emit','removeListener','register','length','userNotification:','./userNotification.events','save','remove'];(function(_0x1bf57f,_0x255df4){var _0x23a86b=function(_0x497866){while(--_0x497866){_0x1bf57f['push'](_0x1bf57f['shift']());}};_0x23a86b(++_0x255df4);}(_0x4cc7,0x1b6));var _0x74cc=function(_0x216e58,_0x497adc){_0x216e58=_0x216e58-0x0;var _0x5adcad=_0x4cc7[_0x216e58];return _0x5adcad;};'use strict';var UserNotificationEvents=require(_0x74cc('0x0'));var events=[_0x74cc('0x1'),_0x74cc('0x2'),_0x74cc('0x3')];function createListener(_0x1627f8,_0x28a746){return function(_0x432efa){_0x28a746[_0x74cc('0x4')](_0x1627f8,_0x432efa);};}function removeListener(_0x4b3d99,_0x14af2c){return function(){UserNotificationEvents[_0x74cc('0x5')](_0x4b3d99,_0x14af2c);};}exports[_0x74cc('0x6')]=function(_0x3b5d01){for(var _0x225d38=0x0,_0x1d2678=events[_0x74cc('0x7')];_0x225d38<_0x1d2678;_0x225d38++){var _0x2b104a=events[_0x225d38];var _0x3deb8d=createListener(_0x74cc('0x8')+_0x2b104a,_0x3b5d01);UserNotificationEvents['on'](_0x2b104a,_0x3deb8d);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index dffeec0..edc0aaa 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 _0x9c63=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0x2d92bd,_0x416726){var _0x51a00f=function(_0x12f323){while(--_0x12f323){_0x2d92bd['push'](_0x2d92bd['shift']());}};_0x51a00f(++_0x416726);}(_0x9c63,0x7e));var _0x39c6=function(_0x50c8ee,_0x196ffe){_0x50c8ee=_0x50c8ee-0x0;var _0x4d0941=_0x9c63[_0x50c8ee];return _0x4d0941;};'use strict';var multer=require('multer');var util=require(_0x39c6('0x0'));var path=require('path');var timeout=require(_0x39c6('0x1'));var express=require(_0x39c6('0x2'));var router=express[_0x39c6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x39c6('0x4'));var config=require(_0x39c6('0x5'));module[_0x39c6('0x6')]=router; \ No newline at end of file +var _0x85d0=['express','../../config/environment','util','path','connect-timeout'];(function(_0x28b7a2,_0x40aa58){var _0x404e08=function(_0x5e2894){while(--_0x5e2894){_0x28b7a2['push'](_0x28b7a2['shift']());}};_0x404e08(++_0x40aa58);}(_0x85d0,0x142));var _0x085d=function(_0x516b77,_0x3e4357){_0x516b77=_0x516b77-0x0;var _0x573828=_0x85d0[_0x516b77];return _0x573828;};'use strict';var multer=require('multer');var util=require(_0x085d('0x0'));var path=require(_0x085d('0x1'));var timeout=require(_0x085d('0x2'));var express=require(_0x085d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x085d('0x4'));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 715d08d..a06f11f 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(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1d2d64,_0x1eccf5){var _0x34ec1b=function(_0x5a209c){while(--_0x5a209c){_0x1d2d64['push'](_0x1d2d64['shift']());}};_0x34ec1b(++_0x1eccf5);}(_0xe706,0xa3));var _0x6e70=function(_0x31c133,_0x3075f7){_0x31c133=_0x31c133-0x0;var _0x596121=_0xe706[_0x31c133];return _0x596121;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index b336774..742dcba 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 _0xb73a=['./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x280ad6,_0x3dd146){var _0x5d7286=function(_0x2ff287){while(--_0x2ff287){_0x280ad6['push'](_0x280ad6['shift']());}};_0x5d7286(++_0x3dd146);}(_0xb73a,0xab));var _0xab73=function(_0x102b2b,_0x45d45e){_0x102b2b=_0x102b2b-0x0;var _0x55db93=_0xb73a[_0x102b2b];return _0x55db93;};'use strict';var _=require(_0xab73('0x0'));var util=require(_0xab73('0x1'));var logger=require(_0xab73('0x2'))(_0xab73('0x3'));var moment=require(_0xab73('0x4'));var BPromise=require(_0xab73('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab73('0x6'));var rimraf=require(_0xab73('0x7'));var config=require(_0xab73('0x8'));var attributes=require(_0xab73('0x9'));module['exports']=function(_0x274b49,_0xd97193){return _0x274b49[_0xab73('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0xab73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3846=['api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','user_has_openchannel_queues','lodash'];(function(_0x317cc5,_0x3b6179){var _0x44fe81=function(_0x3b43b5){while(--_0x3b43b5){_0x317cc5['push'](_0x317cc5['shift']());}};_0x44fe81(++_0x3b6179);}(_0x3846,0x155));var _0x6384=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x3846[_0x27bd2c];return _0x3784ea;};'use strict';var _=require(_0x6384('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6384('0x1'));var moment=require(_0x6384('0x2'));var BPromise=require(_0x6384('0x3'));var rp=require(_0x6384('0x4'));var fs=require('fs');var path=require(_0x6384('0x5'));var rimraf=require(_0x6384('0x6'));var config=require('../../config/environment');var attributes=require(_0x6384('0x7'));module['exports']=function(_0x225e3a,_0x472d35){return _0x225e3a['define']('UserOpenchannelQueue',attributes,{'tableName':_0x6384('0x8'),'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 dcd0490..1ac4740 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 _0x1557=['bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x3fcc20,_0x57c31b){var _0x15d3ce=function(_0x575619){while(--_0x575619){_0x3fcc20['push'](_0x3fcc20['shift']());}};_0x15d3ce(++_0x57c31b);}(_0x1557,0x70));var _0x7155=function(_0x422f14,_0x27e379){_0x422f14=_0x422f14-0x0;var _0x91850c=_0x1557[_0x422f14];return _0x91850c;};'use strict';var _=require(_0x7155('0x0'));var util=require(_0x7155('0x1'));var moment=require(_0x7155('0x2'));var BPromise=require(_0x7155('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7155('0x4'))['db'];var utils=require(_0x7155('0x5'));var logger=require('../../config/logger')(_0x7155('0x6'));var config=require(_0x7155('0x7'));var jayson=require(_0x7155('0x8'));var client=jayson[_0x7155('0x9')][_0x7155('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3826d2,_0x338728,_0x5e9dac){return new BPromise(function(_0x240a91,_0x192b4d){return client[_0x7155('0xb')](_0x3826d2,_0x5e9dac)['then'](function(_0x46c27b){logger[_0x7155('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x338728,'request\x20sent');logger[_0x7155('0xd')](_0x7155('0xe'),_0x338728,_0x7155('0xf'),JSON[_0x7155('0x10')](_0x46c27b));if(_0x46c27b[_0x7155('0x11')]){if(_0x46c27b['error'][_0x7155('0x12')]===0x1f4){logger[_0x7155('0x11')](_0x7155('0x13'),_0x338728,_0x46c27b[_0x7155('0x11')][_0x7155('0x14')]);return _0x192b4d(_0x46c27b[_0x7155('0x11')][_0x7155('0x14')]);}logger[_0x7155('0x11')](_0x7155('0x13'),_0x338728,_0x46c27b[_0x7155('0x11')][_0x7155('0x14')]);return _0x240a91(_0x46c27b[_0x7155('0x11')][_0x7155('0x14')]);}else{logger['info'](_0x7155('0x13'),_0x338728,_0x7155('0xf'));_0x240a91(_0x46c27b[_0x7155('0x15')][_0x7155('0x14')]);}})[_0x7155('0x16')](function(_0x2dd789){logger['error'](_0x7155('0x13'),_0x338728,_0x2dd789);_0x192b4d(_0x2dd789);});});} \ No newline at end of file +var _0x5dda=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5dda,0x1be));var _0xa5dd=function(_0x10a7cb,_0x311b31){_0x10a7cb=_0x10a7cb-0x0;var _0xa3d54a=_0x5dda[_0x10a7cb];return _0xa3d54a;};'use strict';var _=require(_0xa5dd('0x0'));var util=require(_0xa5dd('0x1'));var moment=require(_0xa5dd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5dd('0x3'))['db'];var utils=require(_0xa5dd('0x4'));var logger=require(_0xa5dd('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa5dd('0x6'));var client=jayson[_0xa5dd('0x7')][_0xa5dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f55e4,_0x2615dd,_0x2b997e){return new BPromise(function(_0x3e089a,_0x4136b6){return client['request'](_0x3f55e4,_0x2b997e)['then'](function(_0x4f3956){logger[_0xa5dd('0x9')](_0xa5dd('0xa'),_0x2615dd,_0xa5dd('0xb'));logger[_0xa5dd('0xc')](_0xa5dd('0xd'),_0x2615dd,'request\x20sent',JSON[_0xa5dd('0xe')](_0x4f3956));if(_0x4f3956[_0xa5dd('0xf')]){if(_0x4f3956[_0xa5dd('0xf')]['code']===0x1f4){logger[_0xa5dd('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2615dd,_0x4f3956[_0xa5dd('0xf')][_0xa5dd('0x10')]);return _0x4136b6(_0x4f3956[_0xa5dd('0xf')][_0xa5dd('0x10')]);}logger[_0xa5dd('0xf')](_0xa5dd('0xa'),_0x2615dd,_0x4f3956[_0xa5dd('0xf')]['message']);return _0x3e089a(_0x4f3956[_0xa5dd('0xf')][_0xa5dd('0x10')]);}else{logger[_0xa5dd('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2615dd,'request\x20sent');_0x3e089a(_0x4f3956[_0xa5dd('0x11')][_0xa5dd('0x10')]);}})[_0xa5dd('0x12')](function(_0x59ec03){logger[_0xa5dd('0xf')](_0xa5dd('0xa'),_0x2615dd,_0x59ec03);_0x4136b6(_0x59ec03);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 1c6b175..18e629d 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 _0x87d0=['addSections','put','update','delete','destroy','removeSections','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0x87d0,0xbd));var _0x087d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x87d0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x087d('0x0'));var util=require(_0x087d('0x1'));var path=require(_0x087d('0x2'));var timeout=require('connect-timeout');var express=require(_0x087d('0x3'));var router=express['Router']();var auth=require(_0x087d('0x4'));var interaction=require(_0x087d('0x5'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router['get']('/',auth[_0x087d('0x6')](),controller[_0x087d('0x7')]);router[_0x087d('0x8')](_0x087d('0x9'),auth['isAuthenticated'](),controller[_0x087d('0xa')]);router['get'](_0x087d('0xb'),auth['isAuthenticated'](),controller[_0x087d('0xc')]);router[_0x087d('0x8')](_0x087d('0xd'),auth[_0x087d('0x6')](),controller[_0x087d('0xe')]);router[_0x087d('0x8')](_0x087d('0xf'),auth[_0x087d('0x6')](),controller[_0x087d('0x10')]);router[_0x087d('0x11')]('/',auth['isAuthenticated'](),controller[_0x087d('0x12')]);router[_0x087d('0x11')]('/:id/clone',auth[_0x087d('0x6')](),controller['clone']);router[_0x087d('0x11')](_0x087d('0xd'),auth[_0x087d('0x6')](),controller[_0x087d('0x13')]);router[_0x087d('0x11')](_0x087d('0xf'),auth['isAuthenticated'](),controller['addResources']);router[_0x087d('0x14')](_0x087d('0xb'),auth[_0x087d('0x6')](),controller[_0x087d('0x15')]);router[_0x087d('0x16')]('/:id',auth[_0x087d('0x6')](),controller[_0x087d('0x17')]);router['delete'](_0x087d('0xd'),auth[_0x087d('0x6')](),controller[_0x087d('0x18')]);router['delete']('/:id/resources',auth[_0x087d('0x6')](),controller['removeResources']);module[_0x087d('0x19')]=router; \ No newline at end of file +var _0x2466=['connect-timeout','express','Router','./userProfile.controller','isAuthenticated','index','get','/describe','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','/:id','update','delete','removeSections','removeResources','exports','multer','util','path'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x2466,0x176));var _0x6246=function(_0x482106,_0x175ecb){_0x482106=_0x482106-0x0;var _0x3c51cb=_0x2466[_0x482106];return _0x3c51cb;};'use strict';var multer=require(_0x6246('0x0'));var util=require(_0x6246('0x1'));var path=require(_0x6246('0x2'));var timeout=require(_0x6246('0x3'));var express=require(_0x6246('0x4'));var router=express[_0x6246('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6246('0x6'));router['get']('/',auth[_0x6246('0x7')](),controller[_0x6246('0x8')]);router[_0x6246('0x9')](_0x6246('0xa'),auth[_0x6246('0x7')](),controller['describe']);router[_0x6246('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6246('0xb')]);router[_0x6246('0x9')](_0x6246('0xc'),auth['isAuthenticated'](),controller[_0x6246('0xd')]);router[_0x6246('0x9')](_0x6246('0xe'),auth[_0x6246('0x7')](),controller[_0x6246('0xf')]);router[_0x6246('0x10')]('/',auth[_0x6246('0x7')](),controller[_0x6246('0x11')]);router['post'](_0x6246('0x12'),auth['isAuthenticated'](),controller[_0x6246('0x13')]);router[_0x6246('0x10')](_0x6246('0xc'),auth[_0x6246('0x7')](),controller[_0x6246('0x14')]);router['post'](_0x6246('0xe'),auth['isAuthenticated'](),controller[_0x6246('0x15')]);router[_0x6246('0x16')](_0x6246('0x17'),auth[_0x6246('0x7')](),controller[_0x6246('0x18')]);router[_0x6246('0x19')](_0x6246('0x17'),auth[_0x6246('0x7')](),controller['destroy']);router[_0x6246('0x19')](_0x6246('0xc'),auth[_0x6246('0x7')](),controller[_0x6246('0x1a')]);router[_0x6246('0x19')](_0x6246('0xe'),auth['isAuthenticated'](),controller[_0x6246('0x1b')]);module[_0x6246('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 89652fb..4d1a777 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 _0xc205=['STRING','name','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports'];(function(_0x10cec3,_0x3aa214){var _0x29116f=function(_0x402da6){while(--_0x402da6){_0x10cec3['push'](_0x10cec3['shift']());}};_0x29116f(++_0x3aa214);}(_0xc205,0x19c));var _0x5c20=function(_0x18f911,_0x16a1b6){_0x18f911=_0x18f911-0x0;var _0x16b199=_0xc205[_0x18f911];return _0x16b199;};'use strict';var Sequelize=require(_0x5c20('0x0'));module[_0x5c20('0x1')]={'name':{'type':Sequelize[_0x5c20('0x2')],'allowNull':![],'unique':_0x5c20('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x14484f){this[_0x5c20('0x4')](_0x5c20('0x5'),_0x14484f?_0x14484f[_0x5c20('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x5c20('0x5'))?this[_0x5c20('0x7')](_0x5c20('0x5'))[_0x5c20('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5c20('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x4c3d=['join','crudPermissions','split','sequelize','exports','STRING','name'];(function(_0x245efb,_0x2c636b){var _0x59ee7b=function(_0x3953f8){while(--_0x3953f8){_0x245efb['push'](_0x245efb['shift']());}};_0x59ee7b(++_0x2c636b);}(_0x4c3d,0x8f));var _0xd4c3=function(_0x5aff99,_0x3fca08){_0x5aff99=_0x5aff99-0x0;var _0x5f5c1d=_0x4c3d[_0x5aff99];return _0x5f5c1d;};'use strict';var Sequelize=require(_0xd4c3('0x0'));module[_0xd4c3('0x1')]={'name':{'type':Sequelize[_0xd4c3('0x2')],'allowNull':![],'unique':_0xd4c3('0x3')},'crudPermissions':{'type':Sequelize[_0xd4c3('0x2')],'set':function(_0x59a8f8){this['setDataValue']('crudPermissions',_0x59a8f8?_0x59a8f8[_0xd4c3('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xd4c3('0x5'))?this['getDataValue'](_0xd4c3('0x5'))[_0xd4c3('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index ce6e1cd..d09d280 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 _0x4c63=['sounds','Sound','Template','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','AnalyticMetric','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','catch','params','length','include','find','create','body','get','omit','createdAt','updatedAt','sequelize','transaction','UserProfileSection','findAll','autoAssociation','sectionId','userProfileId','Resources','describe','addSections','each','UserProfileResource','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','mergeResources','childModel','ValidationError','Invalid\x20section\x20\x27','parentSections','all','ignore','VIRTUAL','field','AnalyticExtractedReport','associatedResources','foreignKey','reportType','default','reportId','DefaultReports','custom','CustomReports','rows','CmContact','Tag','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','squarerecordings','SquareRecording','projectName','projects','contacts','Lists','ListId','lists','companies','CmCompany','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','outboundroutes','VoiceContext','voicemails','VoiceRecording','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule'];(function(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0x4c63,0xf2));var _0x34c6=function(_0x42c454,_0x4f96cd){_0x42c454=_0x42c454-0x0;var _0x8cbf0d=_0x4c63[_0x42c454];return _0x8cbf0d;};'use strict';var pdf=require(_0x34c6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x34c6('0x1'));var zipdir=require(_0x34c6('0x2'));var jsonpatch=require(_0x34c6('0x3'));var rp=require(_0x34c6('0x4'));var moment=require(_0x34c6('0x5'));var BPromise=require(_0x34c6('0x6'));var Mustache=require(_0x34c6('0x7'));var util=require(_0x34c6('0x8'));var path=require(_0x34c6('0x9'));var sox=require(_0x34c6('0xa'));var csv=require(_0x34c6('0xb'));var ejs=require(_0x34c6('0xc'));var fs=require('fs');var _=require(_0x34c6('0xd'));var squel=require(_0x34c6('0xe'));var crypto=require('crypto');var jsforce=require(_0x34c6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x34c6('0xb'));var querystring=require('querystring');var Papa=require(_0x34c6('0x10'));var Redis=require('ioredis');var authService=require(_0x34c6('0x11'));var qs=require(_0x34c6('0x12'));var as=require(_0x34c6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x34c6('0x14'));var licenseUtil=require(_0x34c6('0x15'));var db=require('../../mysqldb')['db'];config[_0x34c6('0x16')]=_[_0x34c6('0x17')](config['redis'],{'host':_0x34c6('0x18'),'port':0x18eb});var socket=require(_0x34c6('0x19'))(new Redis(config['redis']));require(_0x34c6('0x1a'))['register'](socket);function respondWithStatusCode(_0x5d539f,_0x474920){_0x474920=_0x474920||0xcc;return function(_0x18c7f0){if(_0x18c7f0){return _0x5d539f['sendStatus'](_0x474920);}return _0x5d539f['status'](_0x474920)['end']();};}function respondWithResult(_0x4d7118,_0x2b6aa4){_0x2b6aa4=_0x2b6aa4||0xc8;return function(_0x291277){if(_0x291277){return _0x4d7118[_0x34c6('0x1b')](_0x2b6aa4)[_0x34c6('0x1c')](_0x291277);}};}function respondWithFilteredResult(_0x4ca108,_0x41ca9e){return function(_0x4e21fc){if(_0x4e21fc){var _0x29781b=_0x4e21fc[_0x34c6('0x1d')],_0x39214c=_0x41ca9e[_0x34c6('0x1e')],_0x1425c6=_0x41ca9e[_0x34c6('0x1e')]+_0x41ca9e[_0x34c6('0x1f')],_0x1b0fdb;if(_0x1425c6>=_0x29781b){_0x1425c6=_0x29781b;_0x1b0fdb=0xc8;}else{_0x1b0fdb=0xce;}_0x4ca108[_0x34c6('0x1b')](_0x1b0fdb);return _0x4ca108['set'](_0x34c6('0x20'),_0x39214c+'-'+_0x1425c6+'/'+_0x29781b)[_0x34c6('0x1c')](_0x4e21fc);}return null;};}function patchUpdates(_0x108624){return function(_0x57ec7d){try{jsonpatch['apply'](_0x57ec7d,_0x108624,!![]);}catch(_0x3d90d1){return BPromise[_0x34c6('0x21')](_0x3d90d1);}return _0x57ec7d[_0x34c6('0x22')]();};}function saveUpdates(_0x3ec069,_0x4db037){return function(_0x248a53){if(_0x248a53){return _0x248a53[_0x34c6('0x23')](_0x3ec069)[_0x34c6('0x24')](function(_0x4192b2){return _0x4192b2;});}return null;};}function removeEntity(_0x2aa028,_0x43df7a){return function(_0x3988fd){if(_0x3988fd){return _0x3988fd[_0x34c6('0x25')]()[_0x34c6('0x24')](function(){_0x2aa028['status'](0xcc)[_0x34c6('0x26')]();});}};}function handleEntityNotFound(_0x338237,_0x34bc9b){return function(_0x5c1efa){if(!_0x5c1efa){_0x338237['sendStatus'](0x194);}return _0x5c1efa;};}function handleError(_0x109b9f,_0x31215b){_0x31215b=_0x31215b||0x1f4;return function(_0x2194aa){logger[_0x34c6('0x27')](_0x2194aa[_0x34c6('0x28')]);if(_0x2194aa['name']){delete _0x2194aa[_0x34c6('0x29')];}_0x109b9f[_0x34c6('0x1b')](_0x31215b)[_0x34c6('0x2a')](_0x2194aa);};}exports[_0x34c6('0x2b')]=function(_0x1dd57c,_0x4ecf64){var _0x5fd795={},_0x4d77fc={},_0x49d09f={'count':0x0,'rows':[]};var _0x5e4bce=_['map'](db[_0x34c6('0x2c')][_0x34c6('0x2d')],function(_0x16638c){return{'name':_0x16638c[_0x34c6('0x2e')],'type':_0x16638c[_0x34c6('0x2f')][_0x34c6('0x30')]};});_0x4d77fc[_0x34c6('0x31')]=_[_0x34c6('0x32')](_0x5e4bce,'name');_0x4d77fc[_0x34c6('0x33')]=_[_0x34c6('0x34')](_0x1dd57c[_0x34c6('0x33')]);_0x4d77fc[_0x34c6('0x35')]=_[_0x34c6('0x36')](_0x4d77fc[_0x34c6('0x31')],_0x4d77fc[_0x34c6('0x33')]);_0x5fd795['attributes']=_[_0x34c6('0x36')](_0x4d77fc[_0x34c6('0x31')],qs[_0x34c6('0x37')](_0x1dd57c[_0x34c6('0x33')][_0x34c6('0x37')]));_0x5fd795[_0x34c6('0x38')]=_0x5fd795[_0x34c6('0x38')]['length']?_0x5fd795[_0x34c6('0x38')]:_0x4d77fc['model'];if(!_0x1dd57c[_0x34c6('0x33')][_0x34c6('0x39')](_0x34c6('0x3a'))){_0x5fd795[_0x34c6('0x1f')]=qs[_0x34c6('0x1f')](_0x1dd57c['query']['limit']);_0x5fd795['offset']=qs[_0x34c6('0x1e')](_0x1dd57c[_0x34c6('0x33')]['offset']);}_0x5fd795[_0x34c6('0x3b')]=qs[_0x34c6('0x3c')](_0x1dd57c[_0x34c6('0x33')][_0x34c6('0x3c')]);_0x5fd795[_0x34c6('0x3d')]=qs[_0x34c6('0x35')](_[_0x34c6('0x3e')](_0x1dd57c[_0x34c6('0x33')],_0x4d77fc[_0x34c6('0x35')]),_0x5e4bce);if(_0x1dd57c[_0x34c6('0x33')][_0x34c6('0x3f')]){_0x5fd795[_0x34c6('0x3d')]=_[_0x34c6('0x40')](_0x5fd795['where'],{'$or':_[_0x34c6('0x32')](_0x5e4bce,function(_0x2ccca6){if(_0x2ccca6[_0x34c6('0x2f')]!=='VIRTUAL'){var _0xc46567={};_0xc46567[_0x2ccca6[_0x34c6('0x29')]]={'$like':'%'+_0x1dd57c['query'][_0x34c6('0x3f')]+'%'};return _0xc46567;}})});}_0x5fd795=_[_0x34c6('0x40')]({},_0x5fd795,_0x1dd57c[_0x34c6('0x41')]);var _0x52c007={'where':_0x5fd795[_0x34c6('0x3d')]};return db[_0x34c6('0x2c')]['count'](_0x52c007)[_0x34c6('0x24')](function(_0x190c76){_0x49d09f[_0x34c6('0x1d')]=_0x190c76;if(_0x1dd57c[_0x34c6('0x33')][_0x34c6('0x42')]){_0x5fd795['include']=[{'all':!![]}];}return db[_0x34c6('0x2c')]['findAll'](_0x5fd795);})[_0x34c6('0x24')](function(_0x52932f){_0x49d09f['rows']=_0x52932f;return _0x49d09f;})[_0x34c6('0x24')](respondWithFilteredResult(_0x4ecf64,_0x5fd795))[_0x34c6('0x43')](handleError(_0x4ecf64,null));};exports['show']=function(_0x475d1c,_0x45a641){var _0xd4bb6c={'raw':![],'where':{'id':_0x475d1c[_0x34c6('0x44')]['id']}},_0x1cef70={};_0x1cef70['model']=_[_0x34c6('0x34')](db[_0x34c6('0x2c')][_0x34c6('0x2d')]);_0x1cef70['query']=_[_0x34c6('0x34')](_0x475d1c[_0x34c6('0x33')]);_0x1cef70[_0x34c6('0x35')]=_[_0x34c6('0x36')](_0x1cef70['model'],_0x1cef70['query']);_0xd4bb6c['attributes']=_[_0x34c6('0x36')](_0x1cef70[_0x34c6('0x31')],qs[_0x34c6('0x37')](_0x475d1c[_0x34c6('0x33')][_0x34c6('0x37')]));_0xd4bb6c[_0x34c6('0x38')]=_0xd4bb6c[_0x34c6('0x38')][_0x34c6('0x45')]?_0xd4bb6c[_0x34c6('0x38')]:_0x1cef70[_0x34c6('0x31')];if(_0x475d1c[_0x34c6('0x33')][_0x34c6('0x42')]){_0xd4bb6c[_0x34c6('0x46')]=[{'all':!![]}];}_0xd4bb6c=_[_0x34c6('0x40')]({},_0xd4bb6c,_0x475d1c['options']);return db[_0x34c6('0x2c')][_0x34c6('0x47')](_0xd4bb6c)[_0x34c6('0x24')](handleEntityNotFound(_0x45a641,null))[_0x34c6('0x24')](respondWithResult(_0x45a641,null))[_0x34c6('0x43')](handleError(_0x45a641,null));};exports['create']=function(_0x2100a1,_0xb532d4){return db['UserProfile'][_0x34c6('0x48')](_0x2100a1[_0x34c6('0x49')],{})['then'](respondWithResult(_0xb532d4,0xc9))['catch'](handleError(_0xb532d4,null));};exports['clone']=function(_0x1d992f,_0x19eb9a){var _0x3d9dbe={'where':{'id':_0x1d992f[_0x34c6('0x44')]['id']}},_0x596886={};_0x596886[_0x34c6('0x31')]=_[_0x34c6('0x34')](db['UserProfile'][_0x34c6('0x2d')]);_0x3d9dbe[_0x34c6('0x38')]=_[_0x34c6('0x36')](_0x596886[_0x34c6('0x31')],qs[_0x34c6('0x37')](_0x1d992f[_0x34c6('0x33')]['fields']));_0x3d9dbe[_0x34c6('0x38')]=_0x3d9dbe[_0x34c6('0x38')][_0x34c6('0x45')]?_0x3d9dbe['attributes']:_0x596886[_0x34c6('0x31')];if(_0x1d992f[_0x34c6('0x33')]['includeAll']){_0x3d9dbe[_0x34c6('0x46')]=[{'all':!![]}];}_0x3d9dbe=_['merge']({},_0x3d9dbe,_0x1d992f['options']);return db['UserProfile'][_0x34c6('0x47')](_0x3d9dbe)['then'](handleEntityNotFound(_0x19eb9a,null))[_0x34c6('0x24')](function(_0x187cfc){if(_0x187cfc){var _0x4dc761=_0x187cfc[_0x34c6('0x4a')]({'plain':!![]});_0x4dc761=qs[_0x34c6('0x4b')](_0x4dc761,['id',_0x34c6('0x4c'),_0x34c6('0x4d'),'crudPermissions']);_0x1d992f[_0x34c6('0x49')]=_[_0x34c6('0x4b')](_0x1d992f[_0x34c6('0x49')],['id',_0x34c6('0x4c'),_0x34c6('0x4d')]);return db[_0x34c6('0x4e')][_0x34c6('0x4f')](function(_0x4acca4){return db[_0x34c6('0x2c')][_0x34c6('0x48')](_[_0x34c6('0x40')](_0x4dc761,_0x1d992f[_0x34c6('0x49')]),{'include':_0x1d992f[_0x34c6('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4acca4})['then'](function(_0x5f31bb){var _0x457f0b=_0x5f31bb[_0x34c6('0x4a')]({'plain':!![]});return db[_0x34c6('0x50')][_0x34c6('0x51')]({'where':{'userProfileId':_0x1d992f[_0x34c6('0x44')]['id']},'raw':!![]})['then'](function(_0x29b4ab){if(_0x29b4ab){return BPromise['each'](_0x29b4ab,function(_0x26b201){return new BPromise(function(_0x2bcf6e,_0x422436){if(_0x26b201['autoAssociation']===null||_0x26b201[_0x34c6('0x52')]===0x1)_0x2bcf6e(null);return db['UserProfileResource'][_0x34c6('0x51')]({'where':{'sectionId':_0x26b201['id']},'raw':!![]})[_0x34c6('0x24')](function(_0x232fdf){var _0x3ee2dd=_[_0x34c6('0x32')](_0x232fdf,function(_0x25ea5b){return qs['omit'](_0x25ea5b,['id',_0x34c6('0x4c'),_0x34c6('0x4d'),_0x34c6('0x53')]);});_0x2bcf6e(_0x3ee2dd);})[_0x34c6('0x43')](function(_0x4e6e1d){_0x422436(_0x4e6e1d);});})['then'](function(_0x2edadb){var _0x41be7f=qs['omit'](_0x26b201,['id',_0x34c6('0x4c'),'updatedAt']);_0x41be7f[_0x34c6('0x54')]=_0x457f0b['id'];if(_0x2edadb)_0x41be7f[_0x34c6('0x55')]=_0x2edadb;return _0x41be7f;})[_0x34c6('0x24')](function(_0x422c06){return db[_0x34c6('0x50')][_0x34c6('0x48')](_0x422c06,{'include':[{'model':db['UserProfileResource'],'as':_0x34c6('0x55')}],'raw':!![],'transaction':_0x4acca4});});})[_0x34c6('0x24')](function(){return _0x457f0b;});}});});});}})[_0x34c6('0x24')](respondWithResult(_0x19eb9a,0xc9))[_0x34c6('0x43')](handleError(_0x19eb9a,null));};exports[_0x34c6('0x23')]=function(_0xba85f1,_0xf96f37){if(_0xba85f1['body']['id']){delete _0xba85f1[_0x34c6('0x49')]['id'];}return db['UserProfile'][_0x34c6('0x47')]({'where':{'id':_0xba85f1['params']['id']}})[_0x34c6('0x24')](handleEntityNotFound(_0xf96f37,null))[_0x34c6('0x24')](saveUpdates(_0xba85f1['body'],null))[_0x34c6('0x24')](respondWithResult(_0xf96f37,null))[_0x34c6('0x43')](handleError(_0xf96f37,null));};exports[_0x34c6('0x25')]=function(_0x4d6d4c,_0x8863e5){return db[_0x34c6('0x2c')][_0x34c6('0x47')]({'where':{'id':_0x4d6d4c[_0x34c6('0x44')]['id']}})[_0x34c6('0x24')](handleEntityNotFound(_0x8863e5,null))[_0x34c6('0x24')](removeEntity(_0x8863e5,null))[_0x34c6('0x43')](handleError(_0x8863e5,null));};exports[_0x34c6('0x56')]=function(_0x334cf1,_0x3b034c){return db[_0x34c6('0x2c')]['describe']()['then'](respondWithResult(_0x3b034c,null))[_0x34c6('0x43')](handleError(_0x3b034c,null));};exports[_0x34c6('0x57')]=function(_0x46b006,_0x201249){var _0x139699=_0x46b006['body'];return db[_0x34c6('0x2c')][_0x34c6('0x47')]({'where':{'id':_0x46b006['params']['id']}})[_0x34c6('0x24')](handleEntityNotFound(_0x201249,null))[_0x34c6('0x24')](function(_0x10e49f){if(_0x10e49f){return db['sequelize'][_0x34c6('0x4f')](function(_0x3aecaf){return db[_0x34c6('0x50')][_0x34c6('0x25')]({'where':{'userProfileId':_0x46b006['params']['id'],'sectionId':_[_0x34c6('0x32')](_0x139699,function(_0x4496c8){return _0x4496c8['sectionId'];})},'transaction':_0x3aecaf})['then'](function(){var _0x3408e1=_['map'](_0x139699,function(_0x553e57){_0x553e57['userProfileId']=_0x46b006[_0x34c6('0x44')]['id'];return _0x553e57;});var _0x50f044=[];return BPromise[_0x34c6('0x58')](_0x3408e1,function(_0x50aff4){return db[_0x34c6('0x50')][_0x34c6('0x48')](_0x50aff4,{'include':[{'model':db[_0x34c6('0x59')],'as':_0x34c6('0x55')}],'raw':!![],'transaction':_0x3aecaf})[_0x34c6('0x24')](function(_0x1c3dfb){_0x50f044['push'](_0x1c3dfb['get']({'plain':!![]}));});})[_0x34c6('0x24')](function(){return _0x50f044;});});});}})[_0x34c6('0x24')](function(_0x1179bc){return _0x1179bc;})['then'](respondWithResult(_0x201249,null))[_0x34c6('0x43')](handleError(_0x201249,null));};exports[_0x34c6('0x5a')]=function(_0x42971d,_0x47d75d){var _0x25d1f7;return db[_0x34c6('0x2c')][_0x34c6('0x47')]({'where':{'id':_0x42971d['params']['id']},'attributes':['id',_0x34c6('0x29')]})['then'](handleEntityNotFound(_0x47d75d,null))[_0x34c6('0x24')](function(_0x3af51d){if(_0x3af51d){_0x25d1f7=_0x3af51d;return db[_0x34c6('0x50')][_0x34c6('0x25')]({'where':{'userProfileId':_0x42971d[_0x34c6('0x44')]['id'],'sectionId':_0x42971d[_0x34c6('0x33')][_0x34c6('0x5b')]}});}})[_0x34c6('0x24')](function(){return _0x25d1f7;})[_0x34c6('0x24')](respondWithStatusCode(_0x47d75d,null))[_0x34c6('0x43')](handleError(_0x47d75d,null));};exports[_0x34c6('0x5c')]=function(_0x2edf82,_0x3c247a){var _0x125635=[];var _0xd483ba=[];return db[_0x34c6('0x50')]['findAll']({'where':{'userProfileId':_0x2edf82[_0x34c6('0x44')]['id']},'raw':!![]})[_0x34c6('0x24')](function(_0x20a162){_0x125635=_[_0x34c6('0x3f')](_0x20a162,function(_0x14e29d){return _0x14e29d[_0x34c6('0x5d')]===0x1||_[_0x34c6('0x5e')]([0x3eb,0x709],_0x14e29d[_0x34c6('0x53')]);});if(!_[_0x34c6('0x5f')](_0x125635)){return _[_0x34c6('0x32')](_0x125635,function(_0x236dea){return _0x236dea[_0x34c6('0x53')];});}else{return;}})['then'](function(_0x5b6ee5){if(_0x5b6ee5)_0xd483ba=_0x5b6ee5;if(_[_0x34c6('0x5e')](_0xd483ba,0x64)){var _0x25f416=_['find'](_0x125635,{'sectionId':0x64});return hasDefaultDashboard(_0x25f416)[_0x34c6('0x24')](function(_0x1266de){return _[_0x34c6('0x32')](_0x125635,function(_0x769d81){if(_0x769d81[_0x34c6('0x53')]===0x64){_0x769d81[_0x34c6('0x60')]=_0x1266de;}return _0x769d81;});});}else{return;}})['then'](function(_0x4d26b5){if(_0x4d26b5)_0x125635=_0x4d26b5;if(_['includes'](_0xd483ba,0x3eb)){var _0x114247=_[_0x34c6('0x47')](_0x125635,{'sectionId':0x3eb});return getCustomDashboards(_0x114247)[_0x34c6('0x24')](function(_0x1c53f7){return _[_0x34c6('0x32')](_0x125635,function(_0x52d48d){if(_0x114247[_0x34c6('0x5d')]){if(_0x52d48d[_0x34c6('0x53')]===0x3eb){_0x52d48d[_0x34c6('0x60')]=_0x1c53f7;}}else{if(_0x52d48d[_0x34c6('0x53')]===0x64){_0x52d48d['subsections']=_0x1c53f7;}}return _0x52d48d;});});}else{return;}})[_0x34c6('0x24')](function(_0x4c1c3d){if(_0x4c1c3d)_0x125635=_0x4c1c3d;if(_['includes'](_0xd483ba,0x709)){var _0x1ddc52=_[_0x34c6('0x47')](_0x125635,{'sectionId':0x709});return getPlugins(_0x1ddc52)[_0x34c6('0x24')](function(_0x31b44f){if(_0x1ddc52[_0x34c6('0x5d')]){return _[_0x34c6('0x32')](_0x125635,function(_0x215af6){if(_0x215af6[_0x34c6('0x53')]===0x709){_0x215af6[_0x34c6('0x60')]=_0x31b44f;}return _0x215af6;});}else{var _0x4bf92a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x31b44f};var _0x457aa3=_[_0x34c6('0x32')](_0x125635);_0x457aa3[_0x34c6('0x61')](_0x4bf92a);return _0x457aa3;}});}else{return;}})[_0x34c6('0x24')](function(_0x12c159){if(_0x12c159)_0x125635=_0x12c159;return _[_0x34c6('0x3f')](_0x125635,[_0x34c6('0x5d'),0x1]);})['then'](respondWithResult(_0x3c247a,null))['catch'](handleError(_0x3c247a,null));};function hasDefaultDashboard(_0x54ac2b){var _0x2f6b6a=[0x65];return new BPromise(function(_0x279607,_0x2f51b1){try{if(_0x54ac2b[_0x34c6('0x52')]){_0x279607(_0x2f6b6a);}else{return db['UserProfileResource'][_0x34c6('0x62')]({'where':{'sectionId':_0x54ac2b['id']},'raw':!![]})[_0x34c6('0x24')](function(_0x215cdb){_0x215cdb?_0x279607(_0x2f6b6a):_0x279607();});}}catch(_0x3e8aa6){_0x2f51b1(_0x3e8aa6);}});}function getCustomDashboards(_0x328c9f){var _0x2c3122=[];return new BPromise(function(_0x5a79b7,_0x290cb7){try{if(_0x328c9f[_0x34c6('0x52')]){return db[_0x34c6('0x63')][_0x34c6('0x51')]({'raw':!![]})[_0x34c6('0x24')](function(_0x45d673){_0x45d673[_0x34c6('0x64')](function(_0x533e0d){_0x2c3122[_0x34c6('0x61')](_0x533e0d['id']+0x1869f);});_0x5a79b7(_0x2c3122);});}else{return db[_0x34c6('0x59')][_0x34c6('0x51')]({'where':{'sectionId':_0x328c9f['id']},'raw':!![]})[_0x34c6('0x24')](function(_0x4ec4c9){_0x4ec4c9[_0x34c6('0x64')](function(_0x311096){_0x2c3122[_0x34c6('0x61')](_0x311096[_0x34c6('0x65')]+0x1869f);});_0x5a79b7(_0x2c3122);});}}catch(_0x1de848){_0x290cb7(_0x1de848);}});}function getPlugins(_0x14cabf){var _0x4ba7c9=[];return new BPromise(function(_0xc1abe1,_0x2b85ef){try{if(_0x14cabf[_0x34c6('0x52')]){return db[_0x34c6('0x66')]['findAll']({'raw':!![]})[_0x34c6('0x24')](function(_0x48c9f8){_0x48c9f8['forEach'](function(_0x3f07a6){_0x4ba7c9[_0x34c6('0x61')](_0x3f07a6['id']+0x15b38);});_0xc1abe1(_0x4ba7c9);});}else{return db[_0x34c6('0x59')]['findAll']({'where':{'sectionId':_0x14cabf['id']},'raw':!![]})[_0x34c6('0x24')](function(_0x5930b3){_0x5930b3['forEach'](function(_0x5dde1c){_0x4ba7c9[_0x34c6('0x61')](_0x5dde1c[_0x34c6('0x65')]+0x15b38);});_0xc1abe1(_0x4ba7c9);});}}catch(_0x535074){_0x2b85ef(_0x535074);}});}exports[_0x34c6('0x67')]=function(_0x4eee8e,_0x459677){return db[_0x34c6('0x2c')]['find']({'where':{'id':_0x4eee8e[_0x34c6('0x44')]['id']}})['then'](handleEntityNotFound(_0x459677,null))[_0x34c6('0x24')](function(_0x438b05){if(_0x438b05){return db[_0x34c6('0x4e')][_0x34c6('0x4f')](function(_0x1f1e69){return db[_0x34c6('0x50')]['findAll']({'where':{'userProfileId':_0x4eee8e[_0x34c6('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0x34c6('0x24')](function(_0xf8b020){if(_0xf8b020){return db[_0x34c6('0x50')][_0x34c6('0x25')]({'where':{'userProfileId':_0x4eee8e[_0x34c6('0x44')]['id'],'id':_[_0x34c6('0x32')](_0xf8b020,function(_0x4ab159){return _0x4ab159['id'];})},'transaction':_0x1f1e69});}})[_0x34c6('0x24')](function(_0x22bb5d){var _0x2eef90=_[_0x34c6('0x32')](_0x4eee8e[_0x34c6('0x49')],function(_0x5bafcc){_0x5bafcc[_0x34c6('0x54')]=_0x4eee8e[_0x34c6('0x44')]['id'];return _0x5bafcc;});return db[_0x34c6('0x50')][_0x34c6('0x68')](_0x2eef90,{'raw':!![],'transaction':_0x1f1e69});})[_0x34c6('0x24')](function(_0x4f3870){var _0x54beb3=_[_0x34c6('0x3f')](_[_0x34c6('0x32')](_0x4f3870,function(_0x357570){return _0x357570[_0x34c6('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x54beb3){return db[_0x34c6('0x50')][_0x34c6('0x51')]({'where':{'userProfileId':_0x4eee8e['params']['id'],'sectionId':_[_0x34c6('0x32')](_0x54beb3,function(_0x30f762){return _0x30f762[_0x34c6('0x53')];})},'attributes':['id',_0x34c6('0x53')],'raw':!![]})[_0x34c6('0x24')](function(_0x1043fa){var _0x173a7b=_[_0x34c6('0x32')](_0x4eee8e[_0x34c6('0x49')],function(_0x2b82df){_0x2b82df[_0x34c6('0x54')]=_0x4eee8e['params']['id'];return _0x2b82df;});return db[_0x34c6('0x59')][_0x34c6('0x68')](_0x173a7b,{'raw':!![],'transaction':_0x1f1e69});});}})['catch'](handleError(_0x459677,null));});}})[_0x34c6('0x24')](function(_0xf16067){var _0x29e3a9=_[_0x34c6('0x32')](_0xf16067,function(_0xe0d867){return _0xe0d867[_0x34c6('0x4a')]({'plain':!![]});});})[_0x34c6('0x24')](respondWithResult(_0x459677,null))['catch'](handleError(_0x459677,null));};exports[_0x34c6('0x69')]=function(_0x2b4f5b,_0x4a0925,_0x8629d2){return db[_0x34c6('0x2c')][_0x34c6('0x47')]({'where':{'id':_0x2b4f5b[_0x34c6('0x44')]['id']}})[_0x34c6('0x24')](handleEntityNotFound(_0x4a0925,null))[_0x34c6('0x24')](function(_0x2cd022){if(_0x2cd022){return _0x2cd022[_0x34c6('0x69')](_0x2b4f5b[_0x34c6('0x33')][_0x34c6('0x5b')]);}})[_0x34c6('0x24')](respondWithStatusCode(_0x4a0925,null))[_0x34c6('0x43')](handleError(_0x4a0925,null));};exports[_0x34c6('0x6a')]=function(_0x1727af,_0x52be21){var _0x279c51={'raw':![],'where':{}};var _0x8f0532={};var _0x4ce5ef={'count':0x0,'rows':[]};var _0x196ea6=_0x1727af[_0x34c6('0x33')][_0x34c6('0x6b')];if(typeof _0x196ea6===_0x34c6('0x6c')){throw new db[(_0x34c6('0x6d'))]['ValidationError']('Unknown\x20section');}var _0x5946e9=_0x1727af[_0x34c6('0x33')][_0x34c6('0x6e')]||![];var _0x1cb0f2=getQueryModels(_0x196ea6,_0x5946e9);if(typeof _0x1cb0f2[_0x34c6('0x6f')]===_0x34c6('0x6c')){throw new db['Sequelize'][(_0x34c6('0x70'))](_0x34c6('0x71')+_0x196ea6+'\x27');}var _0x5bbb4e=[];if(!_[_0x34c6('0x5f')](_0x1cb0f2[_0x34c6('0x72')])){_0x5bbb4e=_0x1cb0f2[_0x34c6('0x72')];}else{_0x5bbb4e=[{'name':_0x196ea6}];}return db[_0x34c6('0x2c')][_0x34c6('0x62')]({'where':{'id':_0x1727af[_0x34c6('0x44')]['id']}})[_0x34c6('0x24')](handleEntityNotFound(_0x52be21,null))[_0x34c6('0x24')](function(_0x410254){if(_0x410254){var _0x45c236=[];for(var _0x3cca33=0x0;_0x3cca33<_0x5bbb4e[_0x34c6('0x45')];_0x3cca33++){_0x45c236[_0x34c6('0x61')](db[_0x34c6('0x50')]['findOne']({'where':{'userProfileId':_0x410254['id'],'name':_0x5bbb4e[_0x3cca33][_0x34c6('0x29')]},'raw':!![]}));}return BPromise[_0x34c6('0x73')](_0x45c236);}})[_0x34c6('0x24')](function(_0x450a3d){var _0x349751=_[_0x34c6('0x3f')](_0x450a3d,function(_0x506a58){return _0x506a58?_0x506a58:undefined;});var _0x554768=_[_0x34c6('0x3f')](_0x5bbb4e,[_0x34c6('0x74'),!![]]);var _0x4eafed=_[_0x34c6('0x5f')](_0x349751)&&_[_0x34c6('0x5f')](_0x554768)?null:_['union'](_0x554768,_0x349751);if(_0x4eafed){var _0x20a4a5=[];for(var _0x2278fc=0x0;_0x2278fc<_0x4eafed[_0x34c6('0x45')];_0x2278fc++){var _0x4fc336=_[_0x34c6('0x47')](_0x5bbb4e,function(_0x20d0c7){return _0x4eafed[_0x2278fc]?_0x20d0c7[_0x34c6('0x29')]===_0x4eafed[_0x2278fc][_0x34c6('0x29')]:null;});if(_0x4fc336){if(_0x4eafed[_0x2278fc][_0x34c6('0x74')]){_0x20a4a5['push'](getAllResources(_0x1cb0f2[_0x34c6('0x6f')],_0x4eafed[_0x2278fc]));}else{if(!_0x4eafed[_0x2278fc]['autoAssociation']){_0x20a4a5[_0x34c6('0x61')](getAllowedResources(_0x4fc336,_0x4eafed[_0x2278fc],_0x1cb0f2[_0x34c6('0x6f')]));}else{if(_0x4fc336[_0x34c6('0x31')]){_0x20a4a5['push'](getAllFilteredResources(_0x4fc336,_0x4eafed[_0x2278fc]));}}}}}return BPromise['all'](_0x20a4a5);}else{return null;}})[_0x34c6('0x24')](function(_0x4a442a){var _0x3825b4=_0x4a442a;var _0x1c8433=null;if(_0x3825b4){_0x1c8433=_0x3825b4['length']===0x1?_0x3825b4[0x0]:null;}if(_0x1c8433||_0x3825b4){var _0x2c4bbb=db[_0x1cb0f2[_0x34c6('0x6f')]][_0x34c6('0x2d')];_0x8f0532[_0x34c6('0x31')]=_[_0x34c6('0x34')](_0x2c4bbb);_0x8f0532[_0x34c6('0x33')]=_[_0x34c6('0x34')](_0x1727af[_0x34c6('0x33')]);_0x8f0532[_0x34c6('0x35')]=_[_0x34c6('0x36')](_0x8f0532[_0x34c6('0x31')],_0x8f0532[_0x34c6('0x33')]);_0x279c51[_0x34c6('0x38')]=_[_0x34c6('0x36')](_0x8f0532['model'],qs[_0x34c6('0x37')](_0x1727af[_0x34c6('0x33')][_0x34c6('0x37')]));_0x279c51[_0x34c6('0x38')]=_0x279c51[_0x34c6('0x38')][_0x34c6('0x45')]?_0x279c51['attributes']:_0x8f0532[_0x34c6('0x31')];if(!_0x1727af[_0x34c6('0x33')][_0x34c6('0x39')]('nolimit')){_0x279c51[_0x34c6('0x1f')]=qs[_0x34c6('0x1f')](_0x1727af['query'][_0x34c6('0x1f')]);_0x279c51[_0x34c6('0x1e')]=qs[_0x34c6('0x1e')](_0x1727af['query'][_0x34c6('0x1e')]);}_0x279c51[_0x34c6('0x3b')]=qs[_0x34c6('0x3c')](_0x1727af['query'][_0x34c6('0x3c')]);_0x279c51[_0x34c6('0x3d')]=qs[_0x34c6('0x35')](_['pick'](_0x1727af['query'],_0x8f0532[_0x34c6('0x35')]));if(_0x1727af[_0x34c6('0x33')][_0x34c6('0x3f')]){_0x279c51[_0x34c6('0x3d')]=_[_0x34c6('0x40')](_0x279c51[_0x34c6('0x3d')],{'$or':_[_0x34c6('0x32')](_0x2c4bbb,function(_0x24a1bf){if(_0x24a1bf[_0x34c6('0x2f')][_0x34c6('0x30')]!==_0x34c6('0x75')){var _0x207f25={};_0x207f25[_0x24a1bf['field']]={'$like':'%'+_0x1727af[_0x34c6('0x33')][_0x34c6('0x3f')]+'%'};return _0x207f25;}})});}var _0x29f00e=[];if(_0x1c8433){var _0x199dd0=_[_0x34c6('0x47')](_0x5bbb4e,['name',_0x1c8433[_0x34c6('0x29')]]);if(_0x199dd0[_0x34c6('0x76')]){var _0x530d48={};if(_0x1cb0f2[_0x34c6('0x6f')]===_0x34c6('0x77')){_0x530d48[_0x199dd0['foreignKey']]=_[_0x34c6('0x32')](_0x1c8433[_0x34c6('0x78')],'id');}else{_0x530d48[_0x199dd0[_0x34c6('0x79')]]=_0x1c8433['associatedResources'];}_0x29f00e['push'](_0x530d48);}else{_0x279c51['where']['id']=_0x1c8433[_0x34c6('0x78')];}}else{for(var _0x32f22b=0x0;_0x32f22b<_0x3825b4[_0x34c6('0x45')];_0x32f22b++){var _0x199dd0=_['find'](_0x5bbb4e,[_0x34c6('0x29'),_0x3825b4[_0x32f22b][_0x34c6('0x29')]]);if(_0x199dd0['field']){var _0x530d48={};_0x530d48[_0x199dd0[_0x34c6('0x79')]]=_0x3825b4[_0x32f22b]['associatedResources'];_0x29f00e[_0x34c6('0x61')](_0x530d48);}else{if(!_0x279c51[_0x34c6('0x3d')]['id'])_0x279c51['where']['id']=[];_0x3825b4[_0x32f22b]['associatedResources'][_0x34c6('0x64')](function(_0x37548a){_0x279c51['where']['id']['push'](_0x37548a);});}}}if(!_[_0x34c6('0x5f')](_0x29f00e)){_0x279c51[_0x34c6('0x3d')]=_[_0x34c6('0x40')](_0x279c51[_0x34c6('0x3d')],{'$and':{'$or':_0x29f00e}});}_0x279c51=_[_0x34c6('0x40')]({},_0x279c51,_0x1727af[_0x34c6('0x41')]);if(_0x1c8433&&!_0x1c8433[_0x34c6('0x52')]&&_0x1cb0f2[_0x34c6('0x6f')]===_0x34c6('0x77')){if(_0x1727af[_0x34c6('0x33')][_0x34c6('0x42')]){_0x279c51[_0x34c6('0x46')]=[{'all':!![]}];}return db[_0x1cb0f2[_0x34c6('0x6f')]][_0x34c6('0x51')](_0x279c51)[_0x34c6('0x24')](function(_0x546327){var _0x563c0e=[];_0x546327[_0x34c6('0x64')](function(_0x5acbe7){var _0x3f086a;switch(_0x5acbe7[_0x34c6('0x7a')]){case _0x34c6('0x7b'):_0x3f086a=_[_0x34c6('0x47')](_0x1c8433[_0x34c6('0x78')],function(_0x46134c){return _0x46134c['id']===_0x5acbe7[_0x34c6('0x7c')]&&_0x46134c[_0x34c6('0x2f')]===_0x34c6('0x7d');});break;case _0x34c6('0x7e'):_0x3f086a=_['find'](_0x1c8433[_0x34c6('0x78')],function(_0x2121c3){return _0x2121c3['id']===_0x5acbe7['reportId']&&_0x2121c3[_0x34c6('0x2f')]===_0x34c6('0x7f');});break;}if(_0x3f086a)_0x563c0e[_0x34c6('0x61')](_0x5acbe7);});_0x4ce5ef['count']=_0x563c0e[_0x34c6('0x45')];_0x4ce5ef[_0x34c6('0x80')]=_0x563c0e;return _0x4ce5ef;});}else{return db[_0x1cb0f2[_0x34c6('0x6f')]][_0x34c6('0x1d')]({'where':_0x279c51[_0x34c6('0x3d')]})[_0x34c6('0x24')](function(_0x4363cb){_0x4ce5ef[_0x34c6('0x1d')]=_0x4363cb;if(_0x1727af[_0x34c6('0x33')][_0x34c6('0x42')]){if(_0x1cb0f2[_0x34c6('0x6f')]===_0x34c6('0x81')){_0x279c51['include']=[{'model':db[_0x34c6('0x82')],'as':'Tags','attributes':['id','name',_0x34c6('0x83')],'required':_0x1727af[_0x34c6('0x33')][_0x34c6('0x84')]?!![]:![]},{'model':db['Tag'],'as':_0x34c6('0x85'),'attributes':['id',_0x34c6('0x29'),_0x34c6('0x83')],'through':_0x1727af[_0x34c6('0x33')][_0x34c6('0x84')]?{'attributes':[],'where':{'TagId':_0x1727af[_0x34c6('0x33')]['tag']||undefined}}:{},'required':_0x1727af[_0x34c6('0x33')][_0x34c6('0x84')]?!![]:![]}];}else{_0x279c51['include']=[{'all':!![]}];}}return db[_0x1cb0f2[_0x34c6('0x6f')]]['findAll'](_0x279c51);})['then'](function(_0x39c8cf){_0x4ce5ef[_0x34c6('0x80')]=_0x39c8cf;return _0x4ce5ef;});}}else{return _0x4ce5ef;}})[_0x34c6('0x24')](respondWithFilteredResult(_0x52be21,_0x279c51))[_0x34c6('0x43')](handleError(_0x52be21,null));};function getAllResources(_0x4ab11b,_0x57a880){return new BPromise(function(_0x154e89,_0x36484e){if(_0x57a880){var _0x2cd23a=_0x57a880[_0x34c6('0x3f')]?{[_0x57a880['filter']['field']]:_0x57a880['filter'][_0x34c6('0x86')]}:undefined;return db[_0x4ab11b][_0x34c6('0x51')]({'where':_0x2cd23a,'raw':!![]})[_0x34c6('0x24')](function(_0x358f2e){_0x57a880[_0x34c6('0x78')]=_[_0x34c6('0x32')](_0x358f2e,'id');_0x154e89(_0x57a880);})[_0x34c6('0x43')](function(_0x3aa919){_0x36484e(_0x3aa919);});}else{_0x154e89(null);}});}function getAllFilteredResources(_0x2ef191,_0x53c7ff){return new BPromise(function(_0x16a058,_0x2c9701){var _0x18d1a8=_0x2ef191['filter']?{[_0x2ef191['filter']['field']]:_0x2ef191[_0x34c6('0x3f')][_0x34c6('0x86')]}:undefined;return db[_0x2ef191[_0x34c6('0x31')]][_0x34c6('0x51')]({'where':_0x18d1a8,'raw':!![]})[_0x34c6('0x24')](function(_0x1da9c0){_0x53c7ff['associatedResources']=_[_0x34c6('0x32')](_0x1da9c0,function(_0x4aca53){return _0x4aca53['name'];});_0x16a058(_0x53c7ff);})['catch'](function(_0xed3a4a){_0x2c9701(_0xed3a4a);});});}function getAllowedResources(_0x24d1ab,_0x182dda,_0x148cbb){return new BPromise(function(_0x4ea486,_0x2403e4){if(_0x182dda){return db[_0x34c6('0x59')][_0x34c6('0x51')]({'where':{'sectionId':_0x182dda['id']},'raw':!![]})[_0x34c6('0x24')](function(_0x1842df){if(_0x24d1ab[_0x34c6('0x76')]&&_0x24d1ab[_0x34c6('0x76')]!=='id'){_0x182dda[_0x34c6('0x78')]=_[_0x34c6('0x32')](_0x1842df,function(_0x3aa8db){return _0x3aa8db[_0x24d1ab[_0x34c6('0x76')]];});}else{if(_0x148cbb===_0x34c6('0x77')){_0x182dda[_0x34c6('0x78')]=_['map'](_0x1842df,function(_0x151a9d){return{'id':_0x151a9d[_0x34c6('0x65')],'type':_0x151a9d[_0x34c6('0x2f')]};});}else{_0x182dda[_0x34c6('0x78')]=_['map'](_0x1842df,function(_0x3ba2a3){return _0x3ba2a3['resourceId'];});}}_0x4ea486(_0x182dda);})[_0x34c6('0x43')](function(_0x1cee72){_0x2403e4(_0x1cee72);});}else{_0x4ea486(null);}});}function getQueryModels(_0x3870a5,_0xdc3863){var _0x3ac1ed=_0x3870a5[_0x34c6('0x87')]();var _0x105c50={'childModel':undefined,'parentSections':[]};switch(_0x3ac1ed){case _0x34c6('0x88'):_0x105c50['childModel']=_0x34c6('0x89');break;case _0x34c6('0x8a'):_0x105c50[_0x34c6('0x6f')]='SquareOdbc';break;case _0x34c6('0x8b'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x8c');_0x105c50[_0x34c6('0x72')]=[{'name':'SquareProjects','field':_0x34c6('0x29'),'foreignKey':_0x34c6('0x8d')}];break;case _0x34c6('0x8e'):_0x105c50[_0x34c6('0x6f')]='JscriptyProject';break;case _0x34c6('0x8f'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x81');_0x105c50['parentSections']=[{'name':_0x34c6('0x90'),'field':'id','foreignKey':_0x34c6('0x91')}];break;case _0x34c6('0x92'):_0x105c50[_0x34c6('0x6f')]='CmList';break;case _0x34c6('0x93'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x94');break;case'globalcustomfields':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x95');break;case _0x34c6('0x96'):_0x105c50[_0x34c6('0x6f')]='ChatQueue';break;case _0x34c6('0x97'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x98');break;case _0x34c6('0x99'):_0x105c50['childModel']=_0x34c6('0x9a');break;case _0x34c6('0x9b'):_0x105c50[_0x34c6('0x6f')]='FaxAccount';break;case'inboundroutes':case'internalroutes':case _0x34c6('0x9c'):_0x105c50['childModel']='VoiceExtension';break;case'contexts':_0x105c50['childModel']=_0x34c6('0x9d');break;case _0x34c6('0x9e'):_0x105c50[_0x34c6('0x6f')]='VoiceMail';break;case'voicerecordings':_0x105c50['childModel']=_0x34c6('0x9f');_0x105c50[_0x34c6('0x72')]=[{'name':'Agents','field':_0x34c6('0x29'),'foreignKey':_0x34c6('0xa0'),'model':_0x34c6('0xa1'),'filter':{'field':_0x34c6('0xa2'),'value':['agent']}},{'name':_0x34c6('0xa3'),'field':_0x34c6('0x29'),'foreignKey':_0x34c6('0xa0'),'model':_0x34c6('0xa1'),'filter':{'field':_0x34c6('0xa2'),'value':[_0x34c6('0xa4')]}},{'name':_0x34c6('0xa5'),'field':'name','foreignKey':_0x34c6('0xa6'),'model':_0x34c6('0xa7'),'filter':{'field':'type','value':[_0x34c6('0xa8')]}},{'name':_0x34c6('0xa9'),'field':_0x34c6('0x29'),'foreignKey':_0x34c6('0xa6'),'model':_0x34c6('0xa7'),'filter':{'field':_0x34c6('0x2f'),'value':[_0x34c6('0xaa')]}}];break;case _0x34c6('0xab'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xac');break;case _0x34c6('0xad'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xae');break;case'voiceprefixes':_0x105c50['childModel']='VoicePrefix';break;case _0x34c6('0xaf'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xb0');break;case _0x34c6('0xb1'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xb2');break;case _0x34c6('0xb3'):_0x105c50[_0x34c6('0x6f')]='MailAccount';break;case _0x34c6('0xb4'):_0x105c50[_0x34c6('0x6f')]='MailSubstatus';break;case _0x34c6('0xb5'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xb6');break;case _0x34c6('0xb7'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xb8');break;case'smsqueues':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xb9');break;case _0x34c6('0xba'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xbb');break;case'whatsappqueues':_0x105c50['childModel']=_0x34c6('0xbc');break;case'whatsappaccounts':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xbd');break;case _0x34c6('0xbe'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xbf');break;case _0x34c6('0xc0'):case _0x34c6('0xc1'):_0x105c50['childModel']=_0x34c6('0xa7');if(_0xdc3863){_0x105c50[_0x34c6('0x72')]=[{'name':_0x34c6('0xa5')},{'name':_0x34c6('0xa9')}];}break;case _0x34c6('0xc2'):case'agents':case _0x34c6('0xc3'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xa1');if(_0xdc3863){_0x105c50[_0x34c6('0x72')]=[{'name':_0x34c6('0xc4'),'filter':{'field':_0x34c6('0xa2'),'value':[_0x34c6('0xc5'),_0x34c6('0xc6')]},'ignore':!![]},{'name':'Agents'},{'name':_0x34c6('0xa3')}];}break;case _0x34c6('0xc7'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xc8');break;case'salesforceaccounts':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xc9');break;case'freshdeskaccounts':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xca');break;case'sugarcrmaccounts':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xcb');break;case _0x34c6('0xcc'):_0x105c50[_0x34c6('0x6f')]='DeskAccount';break;case'zohoaccounts':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xcd');break;case _0x34c6('0xce'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xa1');break;case _0x34c6('0xcf'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xd0');break;case _0x34c6('0xd1'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xd2');break;case _0x34c6('0xd3'):_0x105c50[_0x34c6('0x6f')]='Dashboard';break;case _0x34c6('0xd4'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xd5');break;case _0x34c6('0xd6'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xd7');break;case _0x34c6('0xd8'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xd9');break;case _0x34c6('0xda'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xdb');break;case'tags':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x82');break;case'templates':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xdc');break;case'triggers':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xdd');break;case _0x34c6('0xde'):_0x105c50['childModel']=_0x34c6('0xdf');break;case _0x34c6('0xe0'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xe1');break;case _0x34c6('0xe2'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x66');break;case _0x34c6('0xe3'):_0x105c50[_0x34c6('0x6f')]='AnalyticExtractedReport';_0x105c50[_0x34c6('0x72')]=[{'name':_0x34c6('0xe4'),'field':'id','foreignKey':_0x34c6('0x7c')}];break;case'metrics':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xe5');break;case'whatsappaccounts':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xbd');break;default:return _0x105c50;}return _0x105c50;} \ No newline at end of file +var _0xb88f=['inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','cannedanswers','dispositions','customdashboards','Interval','pauses','Pause','scheduler','sounds','Sound','tags','templates','Template','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','AnalyticMetric','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','offset','set','Content-Range','json','apply','reject','save','then','end','stack','name','send','rawAttributes','model','map','query','keys','filters','intersection','attributes','length','nolimit','limit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','UserProfile','count','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','Resources','update','describe','addSections','destroy','sectionId','userProfileId','removeSections','ids','includes','isEmpty','subsections','enabled','push','findOne','Dashboard','Plugin','forEach','addResources','getResources','undefined','Sequelize','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','parentSections','all','ignore','union','childModel','hasOwnProperty','key','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','resourceId','toLowerCase','squareprojects','SquareProject','odbc','SquareRecording','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','agent','User','role','telephone','VoiceQueues','queue'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0xb88f,0x124));var _0xfb88=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xb88f[_0x363ef8];return _0x148822;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfb88('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb88('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb88('0x2'));var moment=require(_0xfb88('0x3'));var BPromise=require(_0xfb88('0x4'));var Mustache=require(_0xfb88('0x5'));var util=require(_0xfb88('0x6'));var path=require('path');var sox=require(_0xfb88('0x7'));var csv=require(_0xfb88('0x8'));var ejs=require(_0xfb88('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfb88('0xa'));var crypto=require('crypto');var jsforce=require(_0xfb88('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfb88('0xc'));var Papa=require(_0xfb88('0xd'));var Redis=require(_0xfb88('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfb88('0xf'));var hardwareService=require(_0xfb88('0x10'));var logger=require(_0xfb88('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfb88('0x12'));var db=require(_0xfb88('0x13'))['db'];config[_0xfb88('0x14')]=_[_0xfb88('0x15')](config[_0xfb88('0x14')],{'host':_0xfb88('0x16'),'port':0x18eb});var socket=require(_0xfb88('0x17'))(new Redis(config['redis']));require(_0xfb88('0x18'))[_0xfb88('0x19')](socket);function respondWithStatusCode(_0x7f226f,_0x1afae6){_0x1afae6=_0x1afae6||0xcc;return function(_0x5a8025){if(_0x5a8025){return _0x7f226f['sendStatus'](_0x1afae6);}return _0x7f226f[_0xfb88('0x1a')](_0x1afae6)['end']();};}function respondWithResult(_0x2d99c6,_0x1088e4){_0x1088e4=_0x1088e4||0xc8;return function(_0x1a9286){if(_0x1a9286){return _0x2d99c6[_0xfb88('0x1a')](_0x1088e4)['json'](_0x1a9286);}};}function respondWithFilteredResult(_0x2d95cc,_0x33c14e){return function(_0x3ce04c){if(_0x3ce04c){var _0x4e1458=_0x3ce04c['count'],_0x5d82eb=_0x33c14e['offset'],_0x410185=_0x33c14e[_0xfb88('0x1b')]+_0x33c14e['limit'],_0x1dfa9a;if(_0x410185>=_0x4e1458){_0x410185=_0x4e1458;_0x1dfa9a=0xc8;}else{_0x1dfa9a=0xce;}_0x2d95cc['status'](_0x1dfa9a);return _0x2d95cc[_0xfb88('0x1c')](_0xfb88('0x1d'),_0x5d82eb+'-'+_0x410185+'/'+_0x4e1458)[_0xfb88('0x1e')](_0x3ce04c);}return null;};}function patchUpdates(_0x43a631){return function(_0x117987){try{jsonpatch[_0xfb88('0x1f')](_0x117987,_0x43a631,!![]);}catch(_0x5e8877){return BPromise[_0xfb88('0x20')](_0x5e8877);}return _0x117987[_0xfb88('0x21')]();};}function saveUpdates(_0x40c4a3,_0x5a5d51){return function(_0x4c9ec6){if(_0x4c9ec6){return _0x4c9ec6['update'](_0x40c4a3)[_0xfb88('0x22')](function(_0x34208e){return _0x34208e;});}return null;};}function removeEntity(_0x630942,_0x5ef6b5){return function(_0x2503c6){if(_0x2503c6){return _0x2503c6['destroy']()[_0xfb88('0x22')](function(){_0x630942['status'](0xcc)[_0xfb88('0x23')]();});}};}function handleEntityNotFound(_0x3d185a,_0x26f8fc){return function(_0x28a063){if(!_0x28a063){_0x3d185a['sendStatus'](0x194);}return _0x28a063;};}function handleError(_0x3d67a3,_0x5c9c03){_0x5c9c03=_0x5c9c03||0x1f4;return function(_0x215aa0){logger['error'](_0x215aa0[_0xfb88('0x24')]);if(_0x215aa0[_0xfb88('0x25')]){delete _0x215aa0[_0xfb88('0x25')];}_0x3d67a3[_0xfb88('0x1a')](_0x5c9c03)[_0xfb88('0x26')](_0x215aa0);};}exports['index']=function(_0x59b0f8,_0x5c3ec1){var _0x5e6837={},_0x2f9074={},_0x179a95={'count':0x0,'rows':[]};var _0x186ad0=_['map'](db['UserProfile'][_0xfb88('0x27')],function(_0x482ab4){return{'name':_0x482ab4['fieldName'],'type':_0x482ab4['type']['key']};});_0x2f9074[_0xfb88('0x28')]=_[_0xfb88('0x29')](_0x186ad0,_0xfb88('0x25'));_0x2f9074[_0xfb88('0x2a')]=_[_0xfb88('0x2b')](_0x59b0f8[_0xfb88('0x2a')]);_0x2f9074[_0xfb88('0x2c')]=_[_0xfb88('0x2d')](_0x2f9074[_0xfb88('0x28')],_0x2f9074[_0xfb88('0x2a')]);_0x5e6837[_0xfb88('0x2e')]=_['intersection'](_0x2f9074[_0xfb88('0x28')],qs['fields'](_0x59b0f8[_0xfb88('0x2a')]['fields']));_0x5e6837[_0xfb88('0x2e')]=_0x5e6837[_0xfb88('0x2e')][_0xfb88('0x2f')]?_0x5e6837['attributes']:_0x2f9074[_0xfb88('0x28')];if(!_0x59b0f8['query']['hasOwnProperty'](_0xfb88('0x30'))){_0x5e6837[_0xfb88('0x31')]=qs[_0xfb88('0x31')](_0x59b0f8['query'][_0xfb88('0x31')]);_0x5e6837[_0xfb88('0x1b')]=qs[_0xfb88('0x1b')](_0x59b0f8[_0xfb88('0x2a')][_0xfb88('0x1b')]);}_0x5e6837[_0xfb88('0x32')]=qs[_0xfb88('0x33')](_0x59b0f8[_0xfb88('0x2a')]['sort']);_0x5e6837['where']=qs[_0xfb88('0x2c')](_[_0xfb88('0x34')](_0x59b0f8['query'],_0x2f9074['filters']),_0x186ad0);if(_0x59b0f8['query']['filter']){_0x5e6837[_0xfb88('0x35')]=_[_0xfb88('0x36')](_0x5e6837[_0xfb88('0x35')],{'$or':_['map'](_0x186ad0,function(_0x5c2a21){if(_0x5c2a21[_0xfb88('0x37')]!==_0xfb88('0x38')){var _0x22ecbc={};_0x22ecbc[_0x5c2a21['name']]={'$like':'%'+_0x59b0f8[_0xfb88('0x2a')][_0xfb88('0x39')]+'%'};return _0x22ecbc;}})});}_0x5e6837=_[_0xfb88('0x36')]({},_0x5e6837,_0x59b0f8[_0xfb88('0x3a')]);var _0x239f49={'where':_0x5e6837[_0xfb88('0x35')]};return db[_0xfb88('0x3b')][_0xfb88('0x3c')](_0x239f49)[_0xfb88('0x22')](function(_0x57d4ef){_0x179a95[_0xfb88('0x3c')]=_0x57d4ef;if(_0x59b0f8[_0xfb88('0x2a')][_0xfb88('0x3d')]){_0x5e6837[_0xfb88('0x3e')]=[{'all':!![]}];}return db[_0xfb88('0x3b')][_0xfb88('0x3f')](_0x5e6837);})['then'](function(_0x1e7133){_0x179a95[_0xfb88('0x40')]=_0x1e7133;return _0x179a95;})['then'](respondWithFilteredResult(_0x5c3ec1,_0x5e6837))[_0xfb88('0x41')](handleError(_0x5c3ec1,null));};exports[_0xfb88('0x42')]=function(_0x57f64e,_0x299029){var _0x182f67={'raw':![],'where':{'id':_0x57f64e['params']['id']}},_0x106610={};_0x106610[_0xfb88('0x28')]=_[_0xfb88('0x2b')](db[_0xfb88('0x3b')][_0xfb88('0x27')]);_0x106610['query']=_[_0xfb88('0x2b')](_0x57f64e[_0xfb88('0x2a')]);_0x106610[_0xfb88('0x2c')]=_['intersection'](_0x106610[_0xfb88('0x28')],_0x106610['query']);_0x182f67[_0xfb88('0x2e')]=_[_0xfb88('0x2d')](_0x106610[_0xfb88('0x28')],qs[_0xfb88('0x43')](_0x57f64e[_0xfb88('0x2a')][_0xfb88('0x43')]));_0x182f67[_0xfb88('0x2e')]=_0x182f67['attributes']['length']?_0x182f67[_0xfb88('0x2e')]:_0x106610[_0xfb88('0x28')];if(_0x57f64e[_0xfb88('0x2a')][_0xfb88('0x3d')]){_0x182f67['include']=[{'all':!![]}];}_0x182f67=_[_0xfb88('0x36')]({},_0x182f67,_0x57f64e[_0xfb88('0x3a')]);return db[_0xfb88('0x3b')][_0xfb88('0x44')](_0x182f67)[_0xfb88('0x22')](handleEntityNotFound(_0x299029,null))[_0xfb88('0x22')](respondWithResult(_0x299029,null))[_0xfb88('0x41')](handleError(_0x299029,null));};exports[_0xfb88('0x45')]=function(_0x351c46,_0x10d44d){return db[_0xfb88('0x3b')]['create'](_0x351c46[_0xfb88('0x46')],{})[_0xfb88('0x22')](respondWithResult(_0x10d44d,0xc9))['catch'](handleError(_0x10d44d,null));};exports['clone']=function(_0xf015d,_0x2205ff){var _0x5c12c1={'where':{'id':_0xf015d[_0xfb88('0x47')]['id']}},_0x3704ba={};_0x3704ba[_0xfb88('0x28')]=_[_0xfb88('0x2b')](db['UserProfile'][_0xfb88('0x27')]);_0x5c12c1['attributes']=_['intersection'](_0x3704ba[_0xfb88('0x28')],qs['fields'](_0xf015d[_0xfb88('0x2a')][_0xfb88('0x43')]));_0x5c12c1[_0xfb88('0x2e')]=_0x5c12c1[_0xfb88('0x2e')]['length']?_0x5c12c1[_0xfb88('0x2e')]:_0x3704ba[_0xfb88('0x28')];if(_0xf015d[_0xfb88('0x2a')]['includeAll']){_0x5c12c1[_0xfb88('0x3e')]=[{'all':!![]}];}_0x5c12c1=_[_0xfb88('0x36')]({},_0x5c12c1,_0xf015d['options']);return db['UserProfile'][_0xfb88('0x44')](_0x5c12c1)[_0xfb88('0x22')](handleEntityNotFound(_0x2205ff,null))[_0xfb88('0x22')](function(_0x1c0fc0){if(_0x1c0fc0){var _0x471684=_0x1c0fc0['get']({'plain':!![]});_0x471684=qs[_0xfb88('0x48')](_0x471684,['id',_0xfb88('0x49'),'updatedAt',_0xfb88('0x4a')]);_0xf015d[_0xfb88('0x46')]=_[_0xfb88('0x48')](_0xf015d['body'],['id',_0xfb88('0x49'),_0xfb88('0x4b')]);return db[_0xfb88('0x4c')][_0xfb88('0x4d')](function(_0x422cb3){return db['UserProfile'][_0xfb88('0x45')](_['merge'](_0x471684,_0xf015d['body']),{'include':_0xf015d[_0xfb88('0x2a')][_0xfb88('0x3d')]?[{'all':!![]}]:undefined,'transaction':_0x422cb3})['then'](function(_0x2738c9){var _0x3b2cbe=_0x2738c9[_0xfb88('0x4e')]({'plain':!![]});return db[_0xfb88('0x4f')][_0xfb88('0x3f')]({'where':{'userProfileId':_0xf015d[_0xfb88('0x47')]['id']},'raw':!![]})[_0xfb88('0x22')](function(_0x383ddf){if(_0x383ddf){return BPromise[_0xfb88('0x50')](_0x383ddf,function(_0x485cf8){return new BPromise(function(_0x375d7f,_0x40e8bd){if(_0x485cf8['autoAssociation']===null||_0x485cf8[_0xfb88('0x51')]===0x1)_0x375d7f(null);return db[_0xfb88('0x52')][_0xfb88('0x3f')]({'where':{'sectionId':_0x485cf8['id']},'raw':!![]})['then'](function(_0x4cc4eb){var _0x2b4e59=_['map'](_0x4cc4eb,function(_0x44bf7c){return qs[_0xfb88('0x48')](_0x44bf7c,['id',_0xfb88('0x49'),_0xfb88('0x4b'),'sectionId']);});_0x375d7f(_0x2b4e59);})[_0xfb88('0x41')](function(_0xec1e8d){_0x40e8bd(_0xec1e8d);});})[_0xfb88('0x22')](function(_0x215cb6){var _0x534e43=qs[_0xfb88('0x48')](_0x485cf8,['id',_0xfb88('0x49'),_0xfb88('0x4b')]);_0x534e43['userProfileId']=_0x3b2cbe['id'];if(_0x215cb6)_0x534e43[_0xfb88('0x53')]=_0x215cb6;return _0x534e43;})[_0xfb88('0x22')](function(_0x52407f){return db[_0xfb88('0x4f')]['create'](_0x52407f,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x422cb3});});})['then'](function(){return _0x3b2cbe;});}});});});}})['then'](respondWithResult(_0x2205ff,0xc9))['catch'](handleError(_0x2205ff,null));};exports[_0xfb88('0x54')]=function(_0x370fe2,_0xea6489){if(_0x370fe2[_0xfb88('0x46')]['id']){delete _0x370fe2[_0xfb88('0x46')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x370fe2[_0xfb88('0x47')]['id']}})[_0xfb88('0x22')](handleEntityNotFound(_0xea6489,null))[_0xfb88('0x22')](saveUpdates(_0x370fe2[_0xfb88('0x46')],null))['then'](respondWithResult(_0xea6489,null))[_0xfb88('0x41')](handleError(_0xea6489,null));};exports['destroy']=function(_0x30f079,_0x21de65){return db['UserProfile'][_0xfb88('0x44')]({'where':{'id':_0x30f079[_0xfb88('0x47')]['id']}})[_0xfb88('0x22')](handleEntityNotFound(_0x21de65,null))['then'](removeEntity(_0x21de65,null))[_0xfb88('0x41')](handleError(_0x21de65,null));};exports['describe']=function(_0x2c6fe0,_0x32d349){return db[_0xfb88('0x3b')][_0xfb88('0x55')]()[_0xfb88('0x22')](respondWithResult(_0x32d349,null))[_0xfb88('0x41')](handleError(_0x32d349,null));};exports[_0xfb88('0x56')]=function(_0x357d12,_0x1accab){var _0x3d3cdb=_0x357d12['body'];return db[_0xfb88('0x3b')][_0xfb88('0x44')]({'where':{'id':_0x357d12[_0xfb88('0x47')]['id']}})[_0xfb88('0x22')](handleEntityNotFound(_0x1accab,null))[_0xfb88('0x22')](function(_0x3267b7){if(_0x3267b7){return db[_0xfb88('0x4c')][_0xfb88('0x4d')](function(_0x32d0ed){return db[_0xfb88('0x4f')][_0xfb88('0x57')]({'where':{'userProfileId':_0x357d12['params']['id'],'sectionId':_['map'](_0x3d3cdb,function(_0x9026a1){return _0x9026a1[_0xfb88('0x58')];})},'transaction':_0x32d0ed})[_0xfb88('0x22')](function(){var _0xc61997=_[_0xfb88('0x29')](_0x3d3cdb,function(_0x234de8){_0x234de8[_0xfb88('0x59')]=_0x357d12[_0xfb88('0x47')]['id'];return _0x234de8;});var _0x54f68f=[];return BPromise[_0xfb88('0x50')](_0xc61997,function(_0x461124){return db[_0xfb88('0x4f')][_0xfb88('0x45')](_0x461124,{'include':[{'model':db['UserProfileResource'],'as':_0xfb88('0x53')}],'raw':!![],'transaction':_0x32d0ed})[_0xfb88('0x22')](function(_0x222ccc){_0x54f68f['push'](_0x222ccc['get']({'plain':!![]}));});})['then'](function(){return _0x54f68f;});});});}})[_0xfb88('0x22')](function(_0xe41934){return _0xe41934;})['then'](respondWithResult(_0x1accab,null))[_0xfb88('0x41')](handleError(_0x1accab,null));};exports[_0xfb88('0x5a')]=function(_0x4c32b6,_0x385d55){var _0xc4a4b5;return db[_0xfb88('0x3b')][_0xfb88('0x44')]({'where':{'id':_0x4c32b6[_0xfb88('0x47')]['id']},'attributes':['id',_0xfb88('0x25')]})[_0xfb88('0x22')](handleEntityNotFound(_0x385d55,null))['then'](function(_0x1c2ab6){if(_0x1c2ab6){_0xc4a4b5=_0x1c2ab6;return db[_0xfb88('0x4f')][_0xfb88('0x57')]({'where':{'userProfileId':_0x4c32b6['params']['id'],'sectionId':_0x4c32b6[_0xfb88('0x2a')][_0xfb88('0x5b')]}});}})[_0xfb88('0x22')](function(){return _0xc4a4b5;})[_0xfb88('0x22')](respondWithStatusCode(_0x385d55,null))['catch'](handleError(_0x385d55,null));};exports['getSections']=function(_0x3b1d62,_0x4eecd3){var _0x3cbcfe=[];var _0x378983=[];return db[_0xfb88('0x4f')][_0xfb88('0x3f')]({'where':{'userProfileId':_0x3b1d62[_0xfb88('0x47')]['id']},'raw':!![]})[_0xfb88('0x22')](function(_0x9d4f58){_0x3cbcfe=_[_0xfb88('0x39')](_0x9d4f58,function(_0x22af39){return _0x22af39['enabled']===0x1||_[_0xfb88('0x5c')]([0x3eb,0x709],_0x22af39[_0xfb88('0x58')]);});if(!_[_0xfb88('0x5d')](_0x3cbcfe)){return _[_0xfb88('0x29')](_0x3cbcfe,function(_0x2292a9){return _0x2292a9[_0xfb88('0x58')];});}else{return;}})['then'](function(_0x2e2b52){if(_0x2e2b52)_0x378983=_0x2e2b52;if(_['includes'](_0x378983,0x64)){var _0x308f85=_[_0xfb88('0x44')](_0x3cbcfe,{'sectionId':0x64});return hasDefaultDashboard(_0x308f85)[_0xfb88('0x22')](function(_0x33c341){return _['map'](_0x3cbcfe,function(_0x5a399d){if(_0x5a399d['sectionId']===0x64){_0x5a399d[_0xfb88('0x5e')]=_0x33c341;}return _0x5a399d;});});}else{return;}})[_0xfb88('0x22')](function(_0x6cd7a7){if(_0x6cd7a7)_0x3cbcfe=_0x6cd7a7;if(_[_0xfb88('0x5c')](_0x378983,0x3eb)){var _0x1cb0ff=_[_0xfb88('0x44')](_0x3cbcfe,{'sectionId':0x3eb});return getCustomDashboards(_0x1cb0ff)[_0xfb88('0x22')](function(_0x1ab636){return _[_0xfb88('0x29')](_0x3cbcfe,function(_0xbe5582){if(_0x1cb0ff[_0xfb88('0x5f')]){if(_0xbe5582[_0xfb88('0x58')]===0x3eb){_0xbe5582['subsections']=_0x1ab636;}}else{if(_0xbe5582[_0xfb88('0x58')]===0x64){_0xbe5582['subsections']=_0x1ab636;}}return _0xbe5582;});});}else{return;}})[_0xfb88('0x22')](function(_0x5bb93c){if(_0x5bb93c)_0x3cbcfe=_0x5bb93c;if(_[_0xfb88('0x5c')](_0x378983,0x709)){var _0x246886=_[_0xfb88('0x44')](_0x3cbcfe,{'sectionId':0x709});return getPlugins(_0x246886)[_0xfb88('0x22')](function(_0x40d613){if(_0x246886[_0xfb88('0x5f')]){return _[_0xfb88('0x29')](_0x3cbcfe,function(_0x1ddca2){if(_0x1ddca2[_0xfb88('0x58')]===0x709){_0x1ddca2[_0xfb88('0x5e')]=_0x40d613;}return _0x1ddca2;});}else{var _0x5e73bc={'sectionId':0x76c,'enabled':0x1,'subsections':_0x40d613};var _0x34d0f8=_[_0xfb88('0x29')](_0x3cbcfe);_0x34d0f8[_0xfb88('0x60')](_0x5e73bc);return _0x34d0f8;}});}else{return;}})[_0xfb88('0x22')](function(_0x134550){if(_0x134550)_0x3cbcfe=_0x134550;return _[_0xfb88('0x39')](_0x3cbcfe,[_0xfb88('0x5f'),0x1]);})['then'](respondWithResult(_0x4eecd3,null))[_0xfb88('0x41')](handleError(_0x4eecd3,null));};function hasDefaultDashboard(_0x26797b){var _0x3744c8=[0x65];return new BPromise(function(_0x2ac7b4,_0x1a944d){try{if(_0x26797b[_0xfb88('0x51')]){_0x2ac7b4(_0x3744c8);}else{return db[_0xfb88('0x52')][_0xfb88('0x61')]({'where':{'sectionId':_0x26797b['id']},'raw':!![]})[_0xfb88('0x22')](function(_0x5666e7){_0x5666e7?_0x2ac7b4(_0x3744c8):_0x2ac7b4();});}}catch(_0xe90f5f){_0x1a944d(_0xe90f5f);}});}function getCustomDashboards(_0x5ee19d){var _0x27c1f1=[];return new BPromise(function(_0x3900a6,_0x4f679d){try{if(_0x5ee19d[_0xfb88('0x51')]){return db[_0xfb88('0x62')][_0xfb88('0x3f')]({'raw':!![]})['then'](function(_0x46f2db){_0x46f2db['forEach'](function(_0x859c5f){_0x27c1f1[_0xfb88('0x60')](_0x859c5f['id']+0x1869f);});_0x3900a6(_0x27c1f1);});}else{return db['UserProfileResource'][_0xfb88('0x3f')]({'where':{'sectionId':_0x5ee19d['id']},'raw':!![]})['then'](function(_0x2d6ae3){_0x2d6ae3['forEach'](function(_0x14cc65){_0x27c1f1[_0xfb88('0x60')](_0x14cc65['resourceId']+0x1869f);});_0x3900a6(_0x27c1f1);});}}catch(_0x48f313){_0x4f679d(_0x48f313);}});}function getPlugins(_0x731d45){var _0x5eb2e8=[];return new BPromise(function(_0x257059,_0x845a1){try{if(_0x731d45[_0xfb88('0x51')]){return db[_0xfb88('0x63')][_0xfb88('0x3f')]({'raw':!![]})['then'](function(_0x490fa0){_0x490fa0['forEach'](function(_0x1666a4){_0x5eb2e8[_0xfb88('0x60')](_0x1666a4['id']+0x15b38);});_0x257059(_0x5eb2e8);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x731d45['id']},'raw':!![]})[_0xfb88('0x22')](function(_0x2ce422){_0x2ce422[_0xfb88('0x64')](function(_0x2d60e9){_0x5eb2e8[_0xfb88('0x60')](_0x2d60e9['resourceId']+0x15b38);});_0x257059(_0x5eb2e8);});}}catch(_0x4d797d){_0x845a1(_0x4d797d);}});}exports[_0xfb88('0x65')]=function(_0x4104e9,_0xa7de9c){return db['UserProfile']['find']({'where':{'id':_0x4104e9[_0xfb88('0x47')]['id']}})['then'](handleEntityNotFound(_0xa7de9c,null))['then'](function(_0x3ff260){if(_0x3ff260){return db[_0xfb88('0x4c')]['transaction'](function(_0xfe7ddc){return db[_0xfb88('0x4f')][_0xfb88('0x3f')]({'where':{'userProfileId':_0x4104e9[_0xfb88('0x47')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x5c055d){if(_0x5c055d){return db[_0xfb88('0x4f')][_0xfb88('0x57')]({'where':{'userProfileId':_0x4104e9[_0xfb88('0x47')]['id'],'id':_[_0xfb88('0x29')](_0x5c055d,function(_0x16603b){return _0x16603b['id'];})},'transaction':_0xfe7ddc});}})['then'](function(_0xce87db){var _0x541bab=_[_0xfb88('0x29')](_0x4104e9[_0xfb88('0x46')],function(_0x42d6f6){_0x42d6f6[_0xfb88('0x59')]=_0x4104e9[_0xfb88('0x47')]['id'];return _0x42d6f6;});return db['UserProfileSection']['bulkCreate'](_0x541bab,{'raw':!![],'transaction':_0xfe7ddc});})[_0xfb88('0x22')](function(_0x480e32){var _0x59f215=_[_0xfb88('0x39')](_['map'](_0x480e32,function(_0x303c33){return _0x303c33[_0xfb88('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x59f215){return db[_0xfb88('0x4f')][_0xfb88('0x3f')]({'where':{'userProfileId':_0x4104e9[_0xfb88('0x47')]['id'],'sectionId':_[_0xfb88('0x29')](_0x59f215,function(_0x92102){return _0x92102[_0xfb88('0x58')];})},'attributes':['id',_0xfb88('0x58')],'raw':!![]})[_0xfb88('0x22')](function(_0x167cf2){var _0x23a11c=_[_0xfb88('0x29')](_0x4104e9['body'],function(_0x4518a2){_0x4518a2[_0xfb88('0x59')]=_0x4104e9[_0xfb88('0x47')]['id'];return _0x4518a2;});return db[_0xfb88('0x52')]['bulkCreate'](_0x23a11c,{'raw':!![],'transaction':_0xfe7ddc});});}})[_0xfb88('0x41')](handleError(_0xa7de9c,null));});}})[_0xfb88('0x22')](function(_0x44cb6a){var _0x360c8f=_[_0xfb88('0x29')](_0x44cb6a,function(_0x1db0dc){return _0x1db0dc[_0xfb88('0x4e')]({'plain':!![]});});})['then'](respondWithResult(_0xa7de9c,null))[_0xfb88('0x41')](handleError(_0xa7de9c,null));};exports['removeResources']=function(_0x5c1a86,_0x1b1fee,_0x3529a8){return db[_0xfb88('0x3b')][_0xfb88('0x44')]({'where':{'id':_0x5c1a86[_0xfb88('0x47')]['id']}})[_0xfb88('0x22')](handleEntityNotFound(_0x1b1fee,null))[_0xfb88('0x22')](function(_0x27e3fb){if(_0x27e3fb){return _0x27e3fb['removeResources'](_0x5c1a86[_0xfb88('0x2a')][_0xfb88('0x5b')]);}})[_0xfb88('0x22')](respondWithStatusCode(_0x1b1fee,null))['catch'](handleError(_0x1b1fee,null));};exports[_0xfb88('0x66')]=function(_0x43e656,_0x4208de){var _0x3520e1={'raw':![],'where':{}};var _0x52ae83={};var _0x2cb5dc={'count':0x0,'rows':[]};var _0x224545=_0x43e656[_0xfb88('0x2a')]['section'];if(typeof _0x224545===_0xfb88('0x67')){throw new db[(_0xfb88('0x68'))]['ValidationError'](_0xfb88('0x69'));}var _0x5795aa=_0x43e656[_0xfb88('0x2a')][_0xfb88('0x6a')]||![];var _0x2fc0ac=getQueryModels(_0x224545,_0x5795aa);if(typeof _0x2fc0ac['childModel']===_0xfb88('0x67')){throw new db['Sequelize']['ValidationError'](_0xfb88('0x6b')+_0x224545+'\x27');}var _0x6d4246=[];if(!_[_0xfb88('0x5d')](_0x2fc0ac[_0xfb88('0x6c')])){_0x6d4246=_0x2fc0ac[_0xfb88('0x6c')];}else{_0x6d4246=[{'name':_0x224545}];}return db[_0xfb88('0x3b')]['findOne']({'where':{'id':_0x43e656[_0xfb88('0x47')]['id']}})[_0xfb88('0x22')](handleEntityNotFound(_0x4208de,null))[_0xfb88('0x22')](function(_0x1f5851){if(_0x1f5851){var _0x588cb7=[];for(var _0x56e56b=0x0;_0x56e56b<_0x6d4246[_0xfb88('0x2f')];_0x56e56b++){_0x588cb7[_0xfb88('0x60')](db[_0xfb88('0x4f')][_0xfb88('0x61')]({'where':{'userProfileId':_0x1f5851['id'],'name':_0x6d4246[_0x56e56b]['name']},'raw':!![]}));}return BPromise[_0xfb88('0x6d')](_0x588cb7);}})[_0xfb88('0x22')](function(_0x5732c9){var _0x3570fe=_[_0xfb88('0x39')](_0x5732c9,function(_0xf01913){return _0xf01913?_0xf01913:undefined;});var _0x2e557e=_['filter'](_0x6d4246,[_0xfb88('0x6e'),!![]]);var _0xd74d1=_[_0xfb88('0x5d')](_0x3570fe)&&_[_0xfb88('0x5d')](_0x2e557e)?null:_[_0xfb88('0x6f')](_0x2e557e,_0x3570fe);if(_0xd74d1){var _0x3959cf=[];for(var _0x17dea4=0x0;_0x17dea4<_0xd74d1['length'];_0x17dea4++){var _0x3a5166=_[_0xfb88('0x44')](_0x6d4246,function(_0xda98d){return _0xd74d1[_0x17dea4]?_0xda98d['name']===_0xd74d1[_0x17dea4][_0xfb88('0x25')]:null;});if(_0x3a5166){if(_0xd74d1[_0x17dea4][_0xfb88('0x6e')]){_0x3959cf[_0xfb88('0x60')](getAllResources(_0x2fc0ac[_0xfb88('0x70')],_0xd74d1[_0x17dea4]));}else{if(!_0xd74d1[_0x17dea4]['autoAssociation']){_0x3959cf[_0xfb88('0x60')](getAllowedResources(_0x3a5166,_0xd74d1[_0x17dea4],_0x2fc0ac[_0xfb88('0x70')]));}else{if(_0x3a5166[_0xfb88('0x28')]){_0x3959cf[_0xfb88('0x60')](getAllFilteredResources(_0x3a5166,_0xd74d1[_0x17dea4]));}}}}}return BPromise[_0xfb88('0x6d')](_0x3959cf);}else{return null;}})[_0xfb88('0x22')](function(_0x14c64b){var _0x1e95e5=_0x14c64b;var _0x846319=null;if(_0x1e95e5){_0x846319=_0x1e95e5[_0xfb88('0x2f')]===0x1?_0x1e95e5[0x0]:null;}if(_0x846319||_0x1e95e5){var _0x3a4c6c=db[_0x2fc0ac[_0xfb88('0x70')]][_0xfb88('0x27')];_0x52ae83[_0xfb88('0x28')]=_[_0xfb88('0x2b')](_0x3a4c6c);_0x52ae83[_0xfb88('0x2a')]=_[_0xfb88('0x2b')](_0x43e656[_0xfb88('0x2a')]);_0x52ae83[_0xfb88('0x2c')]=_[_0xfb88('0x2d')](_0x52ae83[_0xfb88('0x28')],_0x52ae83[_0xfb88('0x2a')]);_0x3520e1[_0xfb88('0x2e')]=_['intersection'](_0x52ae83['model'],qs[_0xfb88('0x43')](_0x43e656['query']['fields']));_0x3520e1['attributes']=_0x3520e1[_0xfb88('0x2e')][_0xfb88('0x2f')]?_0x3520e1[_0xfb88('0x2e')]:_0x52ae83['model'];if(!_0x43e656[_0xfb88('0x2a')][_0xfb88('0x71')]('nolimit')){_0x3520e1[_0xfb88('0x31')]=qs['limit'](_0x43e656[_0xfb88('0x2a')]['limit']);_0x3520e1['offset']=qs['offset'](_0x43e656[_0xfb88('0x2a')][_0xfb88('0x1b')]);}_0x3520e1[_0xfb88('0x32')]=qs['sort'](_0x43e656['query'][_0xfb88('0x33')]);_0x3520e1[_0xfb88('0x35')]=qs[_0xfb88('0x2c')](_[_0xfb88('0x34')](_0x43e656[_0xfb88('0x2a')],_0x52ae83[_0xfb88('0x2c')]));if(_0x43e656[_0xfb88('0x2a')]['filter']){_0x3520e1[_0xfb88('0x35')]=_['merge'](_0x3520e1[_0xfb88('0x35')],{'$or':_[_0xfb88('0x29')](_0x3a4c6c,function(_0x2a2ddf){if(_0x2a2ddf[_0xfb88('0x37')][_0xfb88('0x72')]!=='VIRTUAL'){var _0xacf0b9={};_0xacf0b9[_0x2a2ddf[_0xfb88('0x73')]]={'$like':'%'+_0x43e656[_0xfb88('0x2a')]['filter']+'%'};return _0xacf0b9;}})});}var _0x43f94a=[];if(_0x846319){var _0x2db4e0=_['find'](_0x6d4246,[_0xfb88('0x25'),_0x846319[_0xfb88('0x25')]]);if(_0x2db4e0[_0xfb88('0x73')]){var _0x4c1c26={};if(_0x2fc0ac[_0xfb88('0x70')]===_0xfb88('0x74')){_0x4c1c26[_0x2db4e0[_0xfb88('0x75')]]=_[_0xfb88('0x29')](_0x846319['associatedResources'],'id');}else{_0x4c1c26[_0x2db4e0[_0xfb88('0x75')]]=_0x846319['associatedResources'];}_0x43f94a[_0xfb88('0x60')](_0x4c1c26);}else{_0x3520e1[_0xfb88('0x35')]['id']=_0x846319[_0xfb88('0x76')];}}else{for(var _0x51a50c=0x0;_0x51a50c<_0x1e95e5[_0xfb88('0x2f')];_0x51a50c++){var _0x2db4e0=_[_0xfb88('0x44')](_0x6d4246,[_0xfb88('0x25'),_0x1e95e5[_0x51a50c][_0xfb88('0x25')]]);if(_0x2db4e0[_0xfb88('0x73')]){var _0x4c1c26={};_0x4c1c26[_0x2db4e0[_0xfb88('0x75')]]=_0x1e95e5[_0x51a50c][_0xfb88('0x76')];_0x43f94a[_0xfb88('0x60')](_0x4c1c26);}else{if(!_0x3520e1[_0xfb88('0x35')]['id'])_0x3520e1[_0xfb88('0x35')]['id']=[];_0x1e95e5[_0x51a50c][_0xfb88('0x76')]['forEach'](function(_0x8a591d){_0x3520e1[_0xfb88('0x35')]['id']['push'](_0x8a591d);});}}}if(!_[_0xfb88('0x5d')](_0x43f94a)){_0x3520e1[_0xfb88('0x35')]=_['merge'](_0x3520e1[_0xfb88('0x35')],{'$and':{'$or':_0x43f94a}});}_0x3520e1=_[_0xfb88('0x36')]({},_0x3520e1,_0x43e656[_0xfb88('0x3a')]);if(_0x846319&&!_0x846319['autoAssociation']&&_0x2fc0ac[_0xfb88('0x70')]===_0xfb88('0x74')){if(_0x43e656[_0xfb88('0x2a')][_0xfb88('0x3d')]){_0x3520e1[_0xfb88('0x3e')]=[{'all':!![]}];}return db[_0x2fc0ac[_0xfb88('0x70')]]['findAll'](_0x3520e1)[_0xfb88('0x22')](function(_0x4eed61){var _0x24fe25=[];_0x4eed61[_0xfb88('0x64')](function(_0x22186e){var _0x56ae6a;switch(_0x22186e[_0xfb88('0x77')]){case _0xfb88('0x78'):_0x56ae6a=_[_0xfb88('0x44')](_0x846319[_0xfb88('0x76')],function(_0x50c6f4){return _0x50c6f4['id']===_0x22186e[_0xfb88('0x79')]&&_0x50c6f4['type']===_0xfb88('0x7a');});break;case'custom':_0x56ae6a=_[_0xfb88('0x44')](_0x846319[_0xfb88('0x76')],function(_0x2fd72d){return _0x2fd72d['id']===_0x22186e[_0xfb88('0x79')]&&_0x2fd72d[_0xfb88('0x37')]==='CustomReports';});break;}if(_0x56ae6a)_0x24fe25['push'](_0x22186e);});_0x2cb5dc[_0xfb88('0x3c')]=_0x24fe25[_0xfb88('0x2f')];_0x2cb5dc['rows']=_0x24fe25;return _0x2cb5dc;});}else{return db[_0x2fc0ac[_0xfb88('0x70')]][_0xfb88('0x3c')]({'where':_0x3520e1[_0xfb88('0x35')]})[_0xfb88('0x22')](function(_0x4a4717){_0x2cb5dc['count']=_0x4a4717;if(_0x43e656[_0xfb88('0x2a')][_0xfb88('0x3d')]){if(_0x2fc0ac[_0xfb88('0x70')]===_0xfb88('0x7b')){_0x3520e1[_0xfb88('0x3e')]=[{'model':db[_0xfb88('0x7c')],'as':_0xfb88('0x7d'),'attributes':['id',_0xfb88('0x25'),_0xfb88('0x7e')],'required':_0x43e656[_0xfb88('0x2a')][_0xfb88('0x7f')]?!![]:![]},{'model':db[_0xfb88('0x7c')],'as':_0xfb88('0x80'),'attributes':['id',_0xfb88('0x25'),_0xfb88('0x7e')],'through':_0x43e656['query'][_0xfb88('0x7f')]?{'attributes':[],'where':{'TagId':_0x43e656[_0xfb88('0x2a')][_0xfb88('0x7f')]||undefined}}:{},'required':_0x43e656[_0xfb88('0x2a')][_0xfb88('0x7f')]?!![]:![]}];}else{_0x3520e1[_0xfb88('0x3e')]=[{'all':!![]}];}}return db[_0x2fc0ac[_0xfb88('0x70')]][_0xfb88('0x3f')](_0x3520e1);})[_0xfb88('0x22')](function(_0x371865){_0x2cb5dc[_0xfb88('0x40')]=_0x371865;return _0x2cb5dc;});}}else{return _0x2cb5dc;}})[_0xfb88('0x22')](respondWithFilteredResult(_0x4208de,_0x3520e1))['catch'](handleError(_0x4208de,null));};function getAllResources(_0x4d04a2,_0x5effe3){return new BPromise(function(_0x2217c9,_0x349e6b){if(_0x5effe3){var _0xb0fe74=_0x5effe3[_0xfb88('0x39')]?{[_0x5effe3[_0xfb88('0x39')][_0xfb88('0x73')]]:_0x5effe3['filter'][_0xfb88('0x81')]}:undefined;return db[_0x4d04a2][_0xfb88('0x3f')]({'where':_0xb0fe74,'raw':!![]})[_0xfb88('0x22')](function(_0x3a5d97){_0x5effe3[_0xfb88('0x76')]=_[_0xfb88('0x29')](_0x3a5d97,'id');_0x2217c9(_0x5effe3);})[_0xfb88('0x41')](function(_0x190e5d){_0x349e6b(_0x190e5d);});}else{_0x2217c9(null);}});}function getAllFilteredResources(_0x5682f0,_0x4fd6cd){return new BPromise(function(_0x1cf717,_0x1affb2){var _0x1eebf9=_0x5682f0[_0xfb88('0x39')]?{[_0x5682f0[_0xfb88('0x39')][_0xfb88('0x73')]]:_0x5682f0[_0xfb88('0x39')]['value']}:undefined;return db[_0x5682f0[_0xfb88('0x28')]][_0xfb88('0x3f')]({'where':_0x1eebf9,'raw':!![]})[_0xfb88('0x22')](function(_0x385990){_0x4fd6cd['associatedResources']=_[_0xfb88('0x29')](_0x385990,function(_0x551244){return _0x551244[_0xfb88('0x25')];});_0x1cf717(_0x4fd6cd);})[_0xfb88('0x41')](function(_0x211e2f){_0x1affb2(_0x211e2f);});});}function getAllowedResources(_0x4571dc,_0xf50380,_0x8629bf){return new BPromise(function(_0x4f5906,_0x5867a5){if(_0xf50380){return db[_0xfb88('0x52')][_0xfb88('0x3f')]({'where':{'sectionId':_0xf50380['id']},'raw':!![]})['then'](function(_0x2b124e){if(_0x4571dc['field']&&_0x4571dc['field']!=='id'){_0xf50380[_0xfb88('0x76')]=_['map'](_0x2b124e,function(_0xe30d){return _0xe30d[_0x4571dc[_0xfb88('0x73')]];});}else{if(_0x8629bf===_0xfb88('0x74')){_0xf50380[_0xfb88('0x76')]=_[_0xfb88('0x29')](_0x2b124e,function(_0x31da84){return{'id':_0x31da84['resourceId'],'type':_0x31da84['type']};});}else{_0xf50380[_0xfb88('0x76')]=_['map'](_0x2b124e,function(_0x519d1f){return _0x519d1f[_0xfb88('0x82')];});}}_0x4f5906(_0xf50380);})[_0xfb88('0x41')](function(_0x295bf2){_0x5867a5(_0x295bf2);});}else{_0x4f5906(null);}});}function getQueryModels(_0x48c401,_0x122bea){var _0x5854e9=_0x48c401[_0xfb88('0x83')]();var _0x1e31fa={'childModel':undefined,'parentSections':[]};switch(_0x5854e9){case _0xfb88('0x84'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0x85');break;case _0xfb88('0x86'):_0x1e31fa[_0xfb88('0x70')]='SquareOdbc';break;case'squarerecordings':_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0x87');_0x1e31fa[_0xfb88('0x6c')]=[{'name':'SquareProjects','field':'name','foreignKey':_0xfb88('0x88')}];break;case _0xfb88('0x89'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0x8a');break;case _0xfb88('0x8b'):_0x1e31fa['childModel']=_0xfb88('0x7b');_0x1e31fa[_0xfb88('0x6c')]=[{'name':_0xfb88('0x8c'),'field':'id','foreignKey':_0xfb88('0x8d')}];break;case _0xfb88('0x8e'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0x8f');break;case _0xfb88('0x90'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0x91');break;case'globalcustomfields':_0x1e31fa[_0xfb88('0x70')]='CmCustomField';break;case'chatqueues':_0x1e31fa['childModel']='ChatQueue';break;case _0xfb88('0x92'):_0x1e31fa['childModel']=_0xfb88('0x93');break;case _0xfb88('0x94'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0x95');break;case'faxaccounts':_0x1e31fa['childModel']=_0xfb88('0x96');break;case _0xfb88('0x97'):case _0xfb88('0x98'):case _0xfb88('0x99'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0x9a');break;case'contexts':_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0x9b');break;case _0xfb88('0x9c'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0x9d');break;case _0xfb88('0x9e'):_0x1e31fa['childModel']=_0xfb88('0x9f');_0x1e31fa[_0xfb88('0x6c')]=[{'name':_0xfb88('0xa0'),'field':_0xfb88('0x25'),'foreignKey':_0xfb88('0xa1'),'model':'User','filter':{'field':'role','value':[_0xfb88('0xa2')]}},{'name':'Telephones','field':_0xfb88('0x25'),'foreignKey':_0xfb88('0xa1'),'model':_0xfb88('0xa3'),'filter':{'field':_0xfb88('0xa4'),'value':[_0xfb88('0xa5')]}},{'name':_0xfb88('0xa6'),'field':_0xfb88('0x25'),'foreignKey':_0xfb88('0xa7'),'model':'VoiceQueue','filter':{'field':_0xfb88('0x37'),'value':[_0xfb88('0xa8')]}},{'name':_0xfb88('0xa9'),'field':_0xfb88('0x25'),'foreignKey':_0xfb88('0xa7'),'model':_0xfb88('0xaa'),'filter':{'field':'type','value':[_0xfb88('0xab')]}}];break;case _0xfb88('0xac'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xad');break;case'chanspies':_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xae');break;case _0xfb88('0xaf'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xb0');break;case _0xfb88('0xb1'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xb2');break;case'mailqueues':_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xb3');break;case _0xfb88('0xb4'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xb5');break;case _0xfb88('0xb6'):_0x1e31fa[_0xfb88('0x70')]='MailSubstatus';break;case _0xfb88('0xb7'):_0x1e31fa[_0xfb88('0x70')]='OpenchannelQueue';break;case _0xfb88('0xb8'):_0x1e31fa[_0xfb88('0x70')]='OpenchannelAccount';break;case _0xfb88('0xb9'):_0x1e31fa[_0xfb88('0x70')]='SmsQueue';break;case _0xfb88('0xba'):_0x1e31fa['childModel']=_0xfb88('0xbb');break;case _0xfb88('0xbc'):_0x1e31fa[_0xfb88('0x70')]='WhatsappQueue';break;case _0xfb88('0xbd'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xbe');break;case _0xfb88('0xbf'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xc0');break;case _0xfb88('0xc1'):case _0xfb88('0xc2'):_0x1e31fa['childModel']='VoiceQueue';if(_0x122bea){_0x1e31fa['parentSections']=[{'name':_0xfb88('0xa6')},{'name':'QueueCampaigns'}];}break;case _0xfb88('0xc3'):case _0xfb88('0xc4'):case _0xfb88('0xc5'):_0x1e31fa['childModel']=_0xfb88('0xa3');if(_0x122bea){_0x1e31fa[_0xfb88('0x6c')]=[{'name':_0xfb88('0xc6'),'filter':{'field':_0xfb88('0xa4'),'value':[_0xfb88('0xc7'),_0xfb88('0xc8')]},'ignore':!![]},{'name':_0xfb88('0xa0')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xc9');break;case _0xfb88('0xca'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xcb');break;case _0xfb88('0xcc'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xcd');break;case'sugarcrmaccounts':_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xce');break;case _0xfb88('0xcf'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xd0');break;case _0xfb88('0xd1'):_0x1e31fa[_0xfb88('0x70')]='ZohoAccount';break;case'vtigeraccounts':_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xa3');break;case _0xfb88('0xd2'):_0x1e31fa['childModel']='CannedAnswer';break;case _0xfb88('0xd3'):_0x1e31fa[_0xfb88('0x70')]='Disposition';break;case _0xfb88('0xd4'):_0x1e31fa['childModel']=_0xfb88('0x62');break;case'intervals':_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xd5');break;case _0xfb88('0xd6'):_0x1e31fa['childModel']=_0xfb88('0xd7');break;case _0xfb88('0xd8'):_0x1e31fa['childModel']='Schedule';break;case _0xfb88('0xd9'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xda');break;case _0xfb88('0xdb'):_0x1e31fa['childModel']=_0xfb88('0x7c');break;case _0xfb88('0xdc'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xdd');break;case'triggers':_0x1e31fa[_0xfb88('0x70')]='Trigger';break;case _0xfb88('0xde'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xdf');break;case _0xfb88('0xe0'):_0x1e31fa['childModel']=_0xfb88('0xe1');break;case _0xfb88('0xe2'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0x63');break;case _0xfb88('0xe3'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0x74');_0x1e31fa[_0xfb88('0x6c')]=[{'name':_0xfb88('0xe4'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xe5');break;case _0xfb88('0xbd'):_0x1e31fa[_0xfb88('0x70')]=_0xfb88('0xbe');break;default:return _0x1e31fa;}return _0x1e31fa;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index be326de..6c2f4d8 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 _0xce8b=['emit','hook','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xce8b,0x1b2));var _0xbce8=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xce8b[_0x249e96];return _0x17444c;};'use strict';var EventEmitter=require(_0xbce8('0x0'));var UserProfile=require(_0xbce8('0x1'))['db'][_0xbce8('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xbce8('0x3')](0x0);var events={'afterCreate':_0xbce8('0x4'),'afterUpdate':_0xbce8('0x5'),'afterDestroy':_0xbce8('0x6')};function emitEvent(_0x342a95){return function(_0x480399,_0xbb768d,_0x9c0b33){UserProfileEvents[_0xbce8('0x7')](_0x342a95+':'+_0x480399['id'],_0x480399);UserProfileEvents[_0xbce8('0x7')](_0x342a95,_0x480399);_0x9c0b33(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xbce8('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xdd02=['emit','exports','../../mysqldb','save','update','remove'];(function(_0x30f28b,_0x12ad1a){var _0x20f475=function(_0x5d1e65){while(--_0x5d1e65){_0x30f28b['push'](_0x30f28b['shift']());}};_0x20f475(++_0x12ad1a);}(_0xdd02,0xd4));var _0x2dd0=function(_0x297599,_0x12fe68){_0x297599=_0x297599-0x0;var _0x5c6497=_0xdd02[_0x297599];return _0x5c6497;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x2dd0('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2dd0('0x1'),'afterUpdate':_0x2dd0('0x2'),'afterDestroy':_0x2dd0('0x3')};function emitEvent(_0x4d9f58){return function(_0x352508,_0x3e985e,_0x160d64){UserProfileEvents[_0x2dd0('0x4')](_0x4d9f58+':'+_0x352508['id'],_0x352508);UserProfileEvents['emit'](_0x4d9f58,_0x352508);_0x160d64(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x2dd0('0x5')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index a09a82c..94e251c 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 _0xca0c=['exports','define','UserProfile','lodash','../../config/logger','api','moment','bluebird','../../config/environment','./userProfile.attributes'];(function(_0x4bae51,_0x31f7ce){var _0x2042bf=function(_0x265fb0){while(--_0x265fb0){_0x4bae51['push'](_0x4bae51['shift']());}};_0x2042bf(++_0x31f7ce);}(_0xca0c,0x1bb));var _0xcca0=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xca0c[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0xcca0('0x0'));var util=require('util');var logger=require(_0xcca0('0x1'))(_0xcca0('0x2'));var moment=require(_0xcca0('0x3'));var BPromise=require(_0xcca0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcca0('0x5'));var attributes=require(_0xcca0('0x6'));module[_0xcca0('0x7')]=function(_0x33d0b8,_0x292a96){return _0x33d0b8[_0xcca0('0x8')](_0xcca0('0x9'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ee3=['rimraf','./userProfile.attributes','exports','define','user_profiles','util','api','moment','bluebird','request-promise','path'];(function(_0x2f3738,_0x115a52){var _0x3dfa2c=function(_0x91434d){while(--_0x91434d){_0x2f3738['push'](_0x2f3738['shift']());}};_0x3dfa2c(++_0x115a52);}(_0x0ee3,0x1bd));var _0x30ee=function(_0x563bfd,_0x4ba246){_0x563bfd=_0x563bfd-0x0;var _0x3eaf75=_0x0ee3[_0x563bfd];return _0x3eaf75;};'use strict';var _=require('lodash');var util=require(_0x30ee('0x0'));var logger=require('../../config/logger')(_0x30ee('0x1'));var moment=require(_0x30ee('0x2'));var BPromise=require(_0x30ee('0x3'));var rp=require(_0x30ee('0x4'));var fs=require('fs');var path=require(_0x30ee('0x5'));var rimraf=require(_0x30ee('0x6'));var config=require('../../config/environment');var attributes=require(_0x30ee('0x7'));module[_0x30ee('0x8')]=function(_0x6106cc,_0x1d1a6f){return _0x6106cc[_0x30ee('0x9')]('UserProfile',attributes,{'tableName':_0x30ee('0xa'),'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 e2d42ec..4b91a87 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 _0x2bd8=['../../config/environment','jayson/promise','client','redis','defaults','localhost','info','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x43b020,_0x51688f){var _0x4169b7=function(_0x419978){while(--_0x419978){_0x43b020['push'](_0x43b020['shift']());}};_0x4169b7(++_0x51688f);}(_0x2bd8,0x130));var _0x82bd=function(_0x2b6e01,_0x13c226){_0x2b6e01=_0x2b6e01-0x0;var _0x536172=_0x2bd8[_0x2b6e01];return _0x536172;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var rs=require(_0x82bd('0x3'));var fs=require('fs');var Redis=require(_0x82bd('0x4'));var db=require(_0x82bd('0x5'))['db'];var utils=require(_0x82bd('0x6'));var logger=require(_0x82bd('0x7'))('rpc');var config=require(_0x82bd('0x8'));var jayson=require(_0x82bd('0x9'));var client=jayson[_0x82bd('0xa')]['http']({'port':0x232a});config[_0x82bd('0xb')]=_[_0x82bd('0xc')](config[_0x82bd('0xb')],{'host':_0x82bd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82bd('0xb')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x51c6ea,_0x5bb22c,_0x5f0434){return new BPromise(function(_0x4c9430,_0x36abe3){return client['request'](_0x51c6ea,_0x5f0434)['then'](function(_0x32821a){logger[_0x82bd('0xe')]('UserProfile,\x20%s,\x20%s',_0x5bb22c,_0x82bd('0xf'));logger['debug'](_0x82bd('0x10'),_0x5bb22c,'request\x20sent',JSON[_0x82bd('0x11')](_0x32821a));if(_0x32821a[_0x82bd('0x12')]){if(_0x32821a[_0x82bd('0x12')][_0x82bd('0x13')]===0x1f4){logger['error'](_0x82bd('0x14'),_0x5bb22c,_0x32821a[_0x82bd('0x12')]['message']);return _0x36abe3(_0x32821a[_0x82bd('0x12')]['message']);}logger[_0x82bd('0x12')](_0x82bd('0x14'),_0x5bb22c,_0x32821a[_0x82bd('0x12')][_0x82bd('0x15')]);return _0x4c9430(_0x32821a[_0x82bd('0x12')][_0x82bd('0x15')]);}else{logger[_0x82bd('0xe')](_0x82bd('0x14'),_0x5bb22c,_0x82bd('0xf'));_0x4c9430(_0x32821a[_0x82bd('0x16')][_0x82bd('0x15')]);}})[_0x82bd('0x17')](function(_0x1c3779){logger[_0x82bd('0x12')]('UserProfile,\x20%s,\x20%s',_0x5bb22c,_0x1c3779);_0x36abe3(_0x1c3779);});});} \ No newline at end of file +var _0xbd51=['request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket'];(function(_0xd42e67,_0x1cc819){var _0x4f317f=function(_0x5791b3){while(--_0x5791b3){_0xd42e67['push'](_0xd42e67['shift']());}};_0x4f317f(++_0x1cc819);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x5827fa,_0x1c3f79){_0x5827fa=_0x5827fa-0x0;var _0x4e855f=_0xbd51[_0x5827fa];return _0x4e855f;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});config[_0x1bd5('0x8')]=_[_0x1bd5('0x9')](config[_0x1bd5('0x8')],{'host':_0x1bd5('0xa'),'port':0x18eb});var socket=require(_0x1bd5('0xb'))(new Redis(config['redis']));require(_0x1bd5('0xc'))['register'](socket);function respondWithRpcPromise(_0x2bd975,_0x28df8e,_0x3b868a){return new BPromise(function(_0x1fbc68,_0x2344e1){return client[_0x1bd5('0xd')](_0x2bd975,_0x3b868a)['then'](function(_0x456ef8){logger['info'](_0x1bd5('0xe'),_0x28df8e,_0x1bd5('0xf'));logger[_0x1bd5('0x10')](_0x1bd5('0x11'),_0x28df8e,_0x1bd5('0xf'),JSON[_0x1bd5('0x12')](_0x456ef8));if(_0x456ef8[_0x1bd5('0x13')]){if(_0x456ef8['error']['code']===0x1f4){logger[_0x1bd5('0x13')](_0x1bd5('0xe'),_0x28df8e,_0x456ef8[_0x1bd5('0x13')][_0x1bd5('0x14')]);return _0x2344e1(_0x456ef8['error']['message']);}logger[_0x1bd5('0x13')](_0x1bd5('0xe'),_0x28df8e,_0x456ef8[_0x1bd5('0x13')][_0x1bd5('0x14')]);return _0x1fbc68(_0x456ef8[_0x1bd5('0x13')][_0x1bd5('0x14')]);}else{logger[_0x1bd5('0x15')](_0x1bd5('0xe'),_0x28df8e,_0x1bd5('0xf'));_0x1fbc68(_0x456ef8['result']['message']);}})[_0x1bd5('0x16')](function(_0x260827){logger[_0x1bd5('0x13')](_0x1bd5('0xe'),_0x28df8e,_0x260827);_0x2344e1(_0x260827);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 70100eb..6533370 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 _0x21bf=['userProfile:','./userProfile.events','save','remove','update','removeListener','register','length'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x21bf,0x1c9));var _0xf21b=function(_0x53b939,_0x419a8c){_0x53b939=_0x53b939-0x0;var _0x2fdc06=_0x21bf[_0x53b939];return _0x2fdc06;};'use strict';var UserProfileEvents=require(_0xf21b('0x0'));var events=[_0xf21b('0x1'),_0xf21b('0x2'),_0xf21b('0x3')];function createListener(_0x274741,_0x1c2775){return function(_0x496ecf){_0x1c2775['emit'](_0x274741,_0x496ecf);};}function removeListener(_0x32850c,_0x52fba7){return function(){UserProfileEvents[_0xf21b('0x4')](_0x32850c,_0x52fba7);};}exports[_0xf21b('0x5')]=function(_0x14c328){for(var _0x28cca4=0x0,_0x5a19ca=events[_0xf21b('0x6')];_0x28cca4<_0x5a19ca;_0x28cca4++){var _0x5aaacd=events[_0x28cca4];var _0x52ffc4=createListener(_0xf21b('0x7')+_0x5aaacd,_0x14c328);UserProfileEvents['on'](_0x5aaacd,_0x52ffc4);}}; \ No newline at end of file +var _0xee1b=['update','emit','removeListener','register','save','remove'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0xee1b,0x1ae));var _0xbee1=function(_0x435fd2,_0x34abd9){_0x435fd2=_0x435fd2-0x0;var _0x43c9d9=_0xee1b[_0x435fd2];return _0x43c9d9;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xbee1('0x0'),_0xbee1('0x1'),_0xbee1('0x2')];function createListener(_0x5897f4,_0x16e52e){return function(_0x381c5f){_0x16e52e[_0xbee1('0x3')](_0x5897f4,_0x381c5f);};}function removeListener(_0x17968c,_0x459f70){return function(){UserProfileEvents[_0xbee1('0x4')](_0x17968c,_0x459f70);};}exports[_0xbee1('0x5')]=function(_0x1c1927){for(var _0x17dc41=0x0,_0x4f853c=events['length'];_0x17dc41<_0x4f853c;_0x17dc41++){var _0x222812=events[_0x17dc41];var _0x5736fe=createListener('userProfile:'+_0x222812,_0x1c1927);UserProfileEvents['on'](_0x222812,_0x5736fe);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index cf17147..23b0655 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 _0x832e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','exports','path'];(function(_0xcde180,_0x2c7cb4){var _0x2adf0c=function(_0x31d24d){while(--_0x31d24d){_0xcde180['push'](_0xcde180['shift']());}};_0x2adf0c(++_0x2c7cb4);}(_0x832e,0x17b));var _0xe832=function(_0x161518,_0x338d35){_0x161518=_0x161518-0x0;var _0x5cc0b5=_0x832e[_0x161518];return _0x5cc0b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe832('0x0'));var timeout=require(_0xe832('0x1'));var express=require(_0xe832('0x2'));var router=express[_0xe832('0x3')]();var auth=require(_0xe832('0x4'));var interaction=require(_0xe832('0x5'));var config=require(_0xe832('0x6'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xe832('0x7')](),controller[_0xe832('0x8')]);router[_0xe832('0x9')](_0xe832('0xa'),auth[_0xe832('0x7')](),controller[_0xe832('0xb')]);router[_0xe832('0x9')](_0xe832('0xc'),auth[_0xe832('0x7')](),controller['show']);router[_0xe832('0xd')]('/',auth['isAuthenticated'](),controller[_0xe832('0xe')]);router[_0xe832('0xf')](_0xe832('0xc'),auth['isAuthenticated'](),controller[_0xe832('0x10')]);router[_0xe832('0x11')](_0xe832('0xc'),auth[_0xe832('0x7')](),controller['destroy']);module[_0xe832('0x12')]=router; \ No newline at end of file +var _0xebb6=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','post','create','put','/:id','update','delete','destroy'];(function(_0x1b328b,_0x381475){var _0x4be944=function(_0x58e5df){while(--_0x58e5df){_0x1b328b['push'](_0x1b328b['shift']());}};_0x4be944(++_0x381475);}(_0xebb6,0x7f));var _0x6ebb=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xebb6[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x6ebb('0x0'));var util=require(_0x6ebb('0x1'));var path=require(_0x6ebb('0x2'));var timeout=require(_0x6ebb('0x3'));var express=require(_0x6ebb('0x4'));var router=express[_0x6ebb('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6ebb('0x6'));var config=require(_0x6ebb('0x7'));var controller=require(_0x6ebb('0x8'));router[_0x6ebb('0x9')]('/',auth[_0x6ebb('0xa')](),controller['index']);router[_0x6ebb('0x9')](_0x6ebb('0xb'),auth[_0x6ebb('0xa')](),controller[_0x6ebb('0xc')]);router[_0x6ebb('0x9')]('/:id',auth[_0x6ebb('0xa')](),controller['show']);router[_0x6ebb('0xd')]('/',auth[_0x6ebb('0xa')](),controller[_0x6ebb('0xe')]);router[_0x6ebb('0xf')](_0x6ebb('0x10'),auth[_0x6ebb('0xa')](),controller[_0x6ebb('0x11')]);router[_0x6ebb('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6ebb('0x13')]);module[_0x6ebb('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 b6ed0e0..2e40488 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 _0x4919=['exports','STRING','INTEGER'];(function(_0x478e2f,_0xcc2041){var _0x4b088d=function(_0x1d262b){while(--_0x1d262b){_0x478e2f['push'](_0x478e2f['shift']());}};_0x4b088d(++_0xcc2041);}(_0x4919,0x12f));var _0x9491=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x4919[_0x1573ea];return _0x51c0e2;};'use strict';var Sequelize=require('sequelize');module[_0x9491('0x0')]={'name':{'type':Sequelize[_0x9491('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9491('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9491('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3378=['sequelize','exports','INTEGER','STRING'];(function(_0x21f548,_0x257c38){var _0x1fff12=function(_0xf515d4){while(--_0xf515d4){_0x21f548['push'](_0x21f548['shift']());}};_0x1fff12(++_0x257c38);}(_0x3378,0xe4));var _0x8337=function(_0x2212d1,_0x483fc8){_0x2212d1=_0x2212d1-0x0;var _0x15eec5=_0x3378[_0x2212d1];return _0x15eec5;};'use strict';var Sequelize=require(_0x8337('0x0'));module[_0x8337('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x8337('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8337('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 931006b..40ce2a7 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(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xda19,0xd5));var _0x9da1=function(_0x3e70a8,_0x21d6c1){_0x3e70a8=_0x3e70a8-0x0;var _0x2a415f=_0xda19[_0x3e70a8];return _0x2a415f;};'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 _0xf494=['filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','save','update','destroy','then','error','stack','name','send','index','map','UserProfileResource','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2d0945,_0x32835a){var _0x5322ad=function(_0x22eb68){while(--_0x22eb68){_0x2d0945['push'](_0x2d0945['shift']());}};_0x5322ad(++_0x32835a);}(_0xf494,0x1c6));var _0x4f49=function(_0x2ecd51,_0x310d41){_0x2ecd51=_0x2ecd51-0x0;var _0x4017b8=_0xf494[_0x2ecd51];return _0x4017b8;};'use strict';var pdf=require(_0x4f49('0x0'));var emlformat=require(_0x4f49('0x1'));var rimraf=require(_0x4f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var moment=require(_0x4f49('0x5'));var BPromise=require(_0x4f49('0x6'));var Mustache=require(_0x4f49('0x7'));var util=require(_0x4f49('0x8'));var path=require(_0x4f49('0x9'));var sox=require(_0x4f49('0xa'));var csv=require(_0x4f49('0xb'));var ejs=require(_0x4f49('0xc'));var fs=require('fs');var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xb'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=_0x5878f4['count'],_0x2f0a0d=_0x415e83[_0x4f49('0x1d')],_0x2ecaaa=_0x415e83[_0x4f49('0x1d')]+_0x415e83[_0x4f49('0x1e')],_0x74886e;if(_0x2ecaaa>=_0x5bdfaf){_0x2ecaaa=_0x5bdfaf;_0x74886e=0xc8;}else{_0x74886e=0xce;}_0x1f2d0d['status'](_0x74886e);return _0x1f2d0d['set']('Content-Range',_0x2f0a0d+'-'+_0x2ecaaa+'/'+_0x5bdfaf)['json'](_0x5878f4);}return null;};}function patchUpdates(_0xb2081a){return function(_0x1834f4){try{jsonpatch[_0x4f49('0x1f')](_0x1834f4,_0xb2081a,!![]);}catch(_0x407042){return BPromise['reject'](_0x407042);}return _0x1834f4[_0x4f49('0x20')]();};}function saveUpdates(_0x2aed27,_0x197a49){return function(_0xaab5e7){if(_0xaab5e7){return _0xaab5e7[_0x4f49('0x21')](_0x2aed27)['then'](function(_0x3e7e28){return _0x3e7e28;});}return null;};}function removeEntity(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x22')]()[_0x4f49('0x23')](function(){_0x357446[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x9d30aa,_0x36187b){return function(_0x559d98){if(!_0x559d98){_0x9d30aa['sendStatus'](0x194);}return _0x559d98;};}function handleError(_0x3a947b,_0x429de7){_0x429de7=_0x429de7||0x1f4;return function(_0x4fedbb){logger[_0x4f49('0x24')](_0x4fedbb[_0x4f49('0x25')]);if(_0x4fedbb[_0x4f49('0x26')]){delete _0x4fedbb['name'];}_0x3a947b[_0x4f49('0x1a')](_0x429de7)[_0x4f49('0x27')](_0x4fedbb);};}exports[_0x4f49('0x28')]=function(_0x148153,_0xfefbab){var _0x122404={},_0x4915af={},_0x50c571={'count':0x0,'rows':[]};var _0x239f44=_[_0x4f49('0x29')](db[_0x4f49('0x2a')]['rawAttributes'],function(_0x3cbfbd){return{'name':_0x3cbfbd[_0x4f49('0x2b')],'type':_0x3cbfbd[_0x4f49('0x2c')]['key']};});_0x4915af['model']=_[_0x4f49('0x29')](_0x239f44,_0x4f49('0x26'));_0x4915af[_0x4f49('0x2d')]=_['keys'](_0x148153[_0x4f49('0x2d')]);_0x4915af[_0x4f49('0x2e')]=_[_0x4f49('0x2f')](_0x4915af[_0x4f49('0x30')],_0x4915af[_0x4f49('0x2d')]);_0x122404[_0x4f49('0x31')]=_[_0x4f49('0x2f')](_0x4915af[_0x4f49('0x30')],qs[_0x4f49('0x32')](_0x148153[_0x4f49('0x2d')][_0x4f49('0x32')]));_0x122404[_0x4f49('0x31')]=_0x122404[_0x4f49('0x31')][_0x4f49('0x33')]?_0x122404[_0x4f49('0x31')]:_0x4915af[_0x4f49('0x30')];if(!_0x148153[_0x4f49('0x2d')][_0x4f49('0x34')](_0x4f49('0x35'))){_0x122404['limit']=qs[_0x4f49('0x1e')](_0x148153[_0x4f49('0x2d')][_0x4f49('0x1e')]);_0x122404[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x148153[_0x4f49('0x2d')][_0x4f49('0x1d')]);}_0x122404[_0x4f49('0x36')]=qs[_0x4f49('0x37')](_0x148153[_0x4f49('0x2d')][_0x4f49('0x37')]);_0x122404[_0x4f49('0x38')]=qs[_0x4f49('0x2e')](_['pick'](_0x148153[_0x4f49('0x2d')],_0x4915af[_0x4f49('0x2e')]),_0x239f44);if(_0x148153[_0x4f49('0x2d')][_0x4f49('0x39')]){_0x122404[_0x4f49('0x38')]=_[_0x4f49('0x3a')](_0x122404[_0x4f49('0x38')],{'$or':_[_0x4f49('0x29')](_0x239f44,function(_0x10bfc4){if(_0x10bfc4[_0x4f49('0x2c')]!==_0x4f49('0x3b')){var _0x141db={};_0x141db[_0x10bfc4[_0x4f49('0x26')]]={'$like':'%'+_0x148153[_0x4f49('0x2d')]['filter']+'%'};return _0x141db;}})});}_0x122404=_[_0x4f49('0x3a')]({},_0x122404,_0x148153[_0x4f49('0x3c')]);var _0x543605={'where':_0x122404[_0x4f49('0x38')]};return db[_0x4f49('0x2a')]['count'](_0x543605)[_0x4f49('0x23')](function(_0x1dd1a6){_0x50c571[_0x4f49('0x3d')]=_0x1dd1a6;if(_0x148153[_0x4f49('0x2d')][_0x4f49('0x3e')]){_0x122404[_0x4f49('0x3f')]=[{'all':!![]}];}return db[_0x4f49('0x2a')]['findAll'](_0x122404);})['then'](function(_0x55960a){_0x50c571[_0x4f49('0x40')]=_0x55960a;return _0x50c571;})[_0x4f49('0x23')](respondWithFilteredResult(_0xfefbab,_0x122404))[_0x4f49('0x41')](handleError(_0xfefbab,null));};exports[_0x4f49('0x42')]=function(_0x1053b2,_0x1ecf6c){var _0x38aff8={'raw':![],'where':{'id':_0x1053b2[_0x4f49('0x43')]['id']}},_0x23720a={};_0x23720a['model']=_['keys'](db[_0x4f49('0x2a')][_0x4f49('0x44')]);_0x23720a[_0x4f49('0x2d')]=_['keys'](_0x1053b2[_0x4f49('0x2d')]);_0x23720a['filters']=_['intersection'](_0x23720a[_0x4f49('0x30')],_0x23720a[_0x4f49('0x2d')]);_0x38aff8[_0x4f49('0x31')]=_['intersection'](_0x23720a[_0x4f49('0x30')],qs[_0x4f49('0x32')](_0x1053b2['query'][_0x4f49('0x32')]));_0x38aff8['attributes']=_0x38aff8[_0x4f49('0x31')][_0x4f49('0x33')]?_0x38aff8[_0x4f49('0x31')]:_0x23720a['model'];if(_0x1053b2[_0x4f49('0x2d')][_0x4f49('0x3e')]){_0x38aff8[_0x4f49('0x3f')]=[{'all':!![]}];}_0x38aff8=_[_0x4f49('0x3a')]({},_0x38aff8,_0x1053b2[_0x4f49('0x3c')]);return db[_0x4f49('0x2a')][_0x4f49('0x45')](_0x38aff8)[_0x4f49('0x23')](handleEntityNotFound(_0x1ecf6c,null))[_0x4f49('0x23')](respondWithResult(_0x1ecf6c,null))[_0x4f49('0x41')](handleError(_0x1ecf6c,null));};exports['create']=function(_0x26c222,_0x44bf1d){return db['UserProfileResource'][_0x4f49('0x46')](_0x26c222['body'],{})[_0x4f49('0x23')](respondWithResult(_0x44bf1d,0xc9))[_0x4f49('0x41')](handleError(_0x44bf1d,null));};exports[_0x4f49('0x21')]=function(_0x300230,_0x4a91ec){if(_0x300230[_0x4f49('0x47')]['id']){delete _0x300230[_0x4f49('0x47')]['id'];}return db[_0x4f49('0x2a')][_0x4f49('0x45')]({'where':{'id':_0x300230[_0x4f49('0x43')]['id']}})[_0x4f49('0x23')](handleEntityNotFound(_0x4a91ec,null))[_0x4f49('0x23')](saveUpdates(_0x300230[_0x4f49('0x47')],null))[_0x4f49('0x23')](respondWithResult(_0x4a91ec,null))[_0x4f49('0x41')](handleError(_0x4a91ec,null));};exports[_0x4f49('0x22')]=function(_0x4482f7,_0x148031){return db[_0x4f49('0x2a')][_0x4f49('0x45')]({'where':{'id':_0x4482f7[_0x4f49('0x43')]['id']}})['then'](handleEntityNotFound(_0x148031,null))['then'](removeEntity(_0x148031,null))[_0x4f49('0x41')](handleError(_0x148031,null));};exports[_0x4f49('0x48')]=function(_0x36bcc2,_0xe46c90){return db[_0x4f49('0x2a')][_0x4f49('0x48')]()[_0x4f49('0x23')](respondWithResult(_0xe46c90,null))['catch'](handleError(_0xe46c90,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index c66e67e..235cf38 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 _0x0274=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x0274,0x1cf));var _0x4027=function(_0x26907e,_0x5ce8a7){_0x26907e=_0x26907e-0x0;var _0x59091c=_0x0274[_0x26907e];return _0x59091c;};'use strict';var _=require(_0x4027('0x0'));var util=require(_0x4027('0x1'));var logger=require(_0x4027('0x2'))(_0x4027('0x3'));var moment=require(_0x4027('0x4'));var BPromise=require(_0x4027('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4027('0x6'));var rimraf=require(_0x4027('0x7'));var config=require(_0x4027('0x8'));var attributes=require(_0x4027('0x9'));module[_0x4027('0xa')]=function(_0x260747,_0x254736){return _0x260747['define'](_0x4027('0xb'),attributes,{'tableName':_0x4027('0xc'),'paranoid':![],'indexes':[{'name':_0x4027('0xd'),'fields':[_0x4027('0xe'),_0x4027('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c02=['sectionId','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','compositeIndex'];(function(_0x33fc57,_0xdd2591){var _0xf701ca=function(_0x4a38b9){while(--_0x4a38b9){_0x33fc57['push'](_0x33fc57['shift']());}};_0xf701ca(++_0xdd2591);}(_0x4c02,0x1e2));var _0x24c0=function(_0x3480f2,_0x4947fa){_0x3480f2=_0x3480f2-0x0;var _0x1e4899=_0x4c02[_0x3480f2];return _0x1e4899;};'use strict';var _=require(_0x24c0('0x0'));var util=require(_0x24c0('0x1'));var logger=require(_0x24c0('0x2'))(_0x24c0('0x3'));var moment=require('moment');var BPromise=require(_0x24c0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24c0('0x5'));var rimraf=require(_0x24c0('0x6'));var config=require(_0x24c0('0x7'));var attributes=require(_0x24c0('0x8'));module['exports']=function(_0x143efd,_0x23e0db){return _0x143efd[_0x24c0('0x9')](_0x24c0('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x24c0('0xb'),'fields':['resourceId',_0x24c0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 284f57c..e703da9 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 _0x4022=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xc05d78,_0x300f27){var _0x2a493f=function(_0x5e632c){while(--_0x5e632c){_0xc05d78['push'](_0xc05d78['shift']());}};_0x2a493f(++_0x300f27);}(_0x4022,0x1c9));var _0x2402=function(_0x38585b,_0x5489a8){_0x38585b=_0x38585b-0x0;var _0x37dc69=_0x4022[_0x38585b];return _0x37dc69;};'use strict';var _=require(_0x2402('0x0'));var util=require(_0x2402('0x1'));var moment=require(_0x2402('0x2'));var BPromise=require(_0x2402('0x3'));var rs=require(_0x2402('0x4'));var fs=require('fs');var Redis=require(_0x2402('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2402('0x6'));var logger=require(_0x2402('0x7'))(_0x2402('0x8'));var config=require(_0x2402('0x9'));var jayson=require(_0x2402('0xa'));var client=jayson[_0x2402('0xb')][_0x2402('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41d880,_0x30c435,_0x5406ff){return new BPromise(function(_0x29d817,_0x5a8bf5){return client[_0x2402('0xd')](_0x41d880,_0x5406ff)['then'](function(_0x3974c9){logger[_0x2402('0xe')](_0x2402('0xf'),_0x30c435,_0x2402('0x10'));logger[_0x2402('0x11')](_0x2402('0x12'),_0x30c435,_0x2402('0x10'),JSON[_0x2402('0x13')](_0x3974c9));if(_0x3974c9[_0x2402('0x14')]){if(_0x3974c9[_0x2402('0x14')][_0x2402('0x15')]===0x1f4){logger[_0x2402('0x14')](_0x2402('0xf'),_0x30c435,_0x3974c9['error']['message']);return _0x5a8bf5(_0x3974c9[_0x2402('0x14')][_0x2402('0x16')]);}logger[_0x2402('0x14')](_0x2402('0xf'),_0x30c435,_0x3974c9['error'][_0x2402('0x16')]);return _0x29d817(_0x3974c9[_0x2402('0x14')][_0x2402('0x16')]);}else{logger['info'](_0x2402('0xf'),_0x30c435,_0x2402('0x10'));_0x29d817(_0x3974c9['result'][_0x2402('0x16')]);}})[_0x2402('0x17')](function(_0x5e2946){logger['error'](_0x2402('0xf'),_0x30c435,_0x5e2946);_0x5a8bf5(_0x5e2946);});});} \ No newline at end of file +var _0xf898=['then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request'];(function(_0x498d71,_0x2187f1){var _0x37f50a=function(_0x16b938){while(--_0x16b938){_0x498d71['push'](_0x498d71['shift']());}};_0x37f50a(++_0x2187f1);}(_0xf898,0x114));var _0x8f89=function(_0x2d617d,_0xd033f9){_0x2d617d=_0x2d617d-0x0;var _0x346d6a=_0xf898[_0x2d617d];return _0x346d6a;};'use strict';var _=require(_0x8f89('0x0'));var util=require('util');var moment=require(_0x8f89('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f89('0x2'));var fs=require('fs');var Redis=require(_0x8f89('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f89('0x4'));var logger=require(_0x8f89('0x5'))('rpc');var config=require(_0x8f89('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8f89('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xaf5d7b,_0x2e2c31,_0x795659){return new BPromise(function(_0x313497,_0x2c64f7){return client[_0x8f89('0x8')](_0xaf5d7b,_0x795659)[_0x8f89('0x9')](function(_0x410817){logger['info'](_0x8f89('0xa'),_0x2e2c31,_0x8f89('0xb'));logger[_0x8f89('0xc')](_0x8f89('0xd'),_0x2e2c31,_0x8f89('0xb'),JSON[_0x8f89('0xe')](_0x410817));if(_0x410817['error']){if(_0x410817['error']['code']===0x1f4){logger[_0x8f89('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x2e2c31,_0x410817[_0x8f89('0xf')][_0x8f89('0x10')]);return _0x2c64f7(_0x410817[_0x8f89('0xf')][_0x8f89('0x10')]);}logger['error'](_0x8f89('0xa'),_0x2e2c31,_0x410817[_0x8f89('0xf')][_0x8f89('0x10')]);return _0x313497(_0x410817[_0x8f89('0xf')]['message']);}else{logger['info'](_0x8f89('0xa'),_0x2e2c31,_0x8f89('0xb'));_0x313497(_0x410817[_0x8f89('0x11')][_0x8f89('0x10')]);}})[_0x8f89('0x12')](function(_0x10263f){logger[_0x8f89('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x2e2c31,_0x10263f);_0x2c64f7(_0x10263f);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 19f4004..cdfa13c 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 _0xad26=['/describe','describe','show','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated'];(function(_0x28f632,_0x19c6b5){var _0x1bbfa2=function(_0x403808){while(--_0x403808){_0x28f632['push'](_0x28f632['shift']());}};_0x1bbfa2(++_0x19c6b5);}(_0xad26,0x1ab));var _0x6ad2=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xad26[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0x6ad2('0x0'));var util=require('util');var path=require(_0x6ad2('0x1'));var timeout=require(_0x6ad2('0x2'));var express=require(_0x6ad2('0x3'));var router=express[_0x6ad2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6ad2('0x5'));var config=require(_0x6ad2('0x6'));var controller=require(_0x6ad2('0x7'));router[_0x6ad2('0x8')]('/',auth[_0x6ad2('0x9')](),controller['index']);router[_0x6ad2('0x8')](_0x6ad2('0xa'),auth[_0x6ad2('0x9')](),controller[_0x6ad2('0xb')]);router[_0x6ad2('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6ad2('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6ad2('0xd')](_0x6ad2('0xe'),auth['isAuthenticated'](),controller[_0x6ad2('0xf')]);router[_0x6ad2('0x10')](_0x6ad2('0xe'),auth[_0x6ad2('0x9')](),controller[_0x6ad2('0x11')]);module[_0x6ad2('0x12')]=router; \ No newline at end of file +var _0x3ac6=['../../config/environment','./userProfileSection.controller','get','index','/describe','describe','/:id','show','post','isAuthenticated','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x346b3f,_0x5f50d8){var _0x328a4f=function(_0x107618){while(--_0x107618){_0x346b3f['push'](_0x346b3f['shift']());}};_0x328a4f(++_0x5f50d8);}(_0x3ac6,0xeb));var _0x63ac=function(_0x550668,_0x4216ec){_0x550668=_0x550668-0x0;var _0x4849cf=_0x3ac6[_0x550668];return _0x4849cf;};'use strict';var multer=require(_0x63ac('0x0'));var util=require(_0x63ac('0x1'));var path=require(_0x63ac('0x2'));var timeout=require(_0x63ac('0x3'));var express=require(_0x63ac('0x4'));var router=express[_0x63ac('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x63ac('0x6'));var config=require(_0x63ac('0x7'));var controller=require(_0x63ac('0x8'));router[_0x63ac('0x9')]('/',auth['isAuthenticated'](),controller[_0x63ac('0xa')]);router['get'](_0x63ac('0xb'),auth['isAuthenticated'](),controller[_0x63ac('0xc')]);router[_0x63ac('0x9')](_0x63ac('0xd'),auth['isAuthenticated'](),controller[_0x63ac('0xe')]);router[_0x63ac('0xf')]('/',auth[_0x63ac('0x10')](),controller[_0x63ac('0x11')]);router[_0x63ac('0x12')]('/:id',auth[_0x63ac('0x10')](),controller[_0x63ac('0x13')]);router[_0x63ac('0x14')]('/:id',auth[_0x63ac('0x10')](),controller['destroy']);module[_0x63ac('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index f4f4a08..5fc1f09 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 _0x6364=['join','getDataValue','crudPermissions','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x6364,0x8f));var _0x4636=function(_0x21d5b3,_0x2ff359){_0x21d5b3=_0x21d5b3-0x0;var _0x4f82c9=_0x6364[_0x21d5b3];return _0x4f82c9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4636('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x4636('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4636('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4636('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4636('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4636('0x0')],'set':function(_0x28d2a2){this[_0x4636('0x3')]('crudPermissions',_0x28d2a2?_0x28d2a2[_0x4636('0x4')](''):[]);},'get':function(){return this[_0x4636('0x5')](_0x4636('0x6'))?this[_0x4636('0x5')](_0x4636('0x6'))['split'](''):[];}}}; \ No newline at end of file +var _0xad26=['crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0xad26,0x1ab));var _0x6ad2=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xad26[_0x5317b5];return _0x3b7ce2;};'use strict';var Sequelize=require(_0x6ad2('0x0'));module['exports']={'name':{'type':Sequelize[_0x6ad2('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x6ad2('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x6ad2('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x6ad2('0x1')],'set':function(_0x35f9cb){this[_0x6ad2('0x4')](_0x6ad2('0x5'),_0x35f9cb?_0x35f9cb[_0x6ad2('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x6ad2('0x5'))?this[_0x6ad2('0x7')](_0x6ad2('0x5'))[_0x6ad2('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 5a88f5d..b4e781a 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 _0x16f8=['path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','Content-Range','apply','reject','save','error','stack','name','status','send','index','map','UserProfileSection','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','then','rows','show','keys','rawAttributes','length','find','catch','body','update','params','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xc9b9f3,_0x4b96c4){var _0x2e4a9a=function(_0x3c6834){while(--_0x3c6834){_0xc9b9f3['push'](_0xc9b9f3['shift']());}};_0x2e4a9a(++_0x4b96c4);}(_0x16f8,0x91));var _0x816f=function(_0x4caff1,_0x4d7ce1){_0x4caff1=_0x4caff1-0x0;var _0x2e088f=_0x16f8[_0x4caff1];return _0x2e088f;};'use strict';var pdf=require(_0x816f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x816f('0x1'));var zipdir=require(_0x816f('0x2'));var jsonpatch=require(_0x816f('0x3'));var rp=require(_0x816f('0x4'));var moment=require(_0x816f('0x5'));var BPromise=require(_0x816f('0x6'));var Mustache=require(_0x816f('0x7'));var util=require(_0x816f('0x8'));var path=require(_0x816f('0x9'));var sox=require(_0x816f('0xa'));var csv=require('to-csv');var ejs=require(_0x816f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x816f('0xc'));var jsforce=require(_0x816f('0xd'));var deskjs=require(_0x816f('0xe'));var toCsv=require(_0x816f('0xf'));var querystring=require(_0x816f('0x10'));var Papa=require('papaparse');var Redis=require(_0x816f('0x11'));var authService=require(_0x816f('0x12'));var qs=require(_0x816f('0x13'));var as=require(_0x816f('0x14'));var hardwareService=require(_0x816f('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x816f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x816f('0x17'));var db=require(_0x816f('0x18'))['db'];function respondWithStatusCode(_0x50a8cd,_0x3d64fe){_0x3d64fe=_0x3d64fe||0xcc;return function(_0x42ccdf){if(_0x42ccdf){return _0x50a8cd[_0x816f('0x19')](_0x3d64fe);}return _0x50a8cd['status'](_0x3d64fe)[_0x816f('0x1a')]();};}function respondWithResult(_0x3b21b1,_0x3c6aff){_0x3c6aff=_0x3c6aff||0xc8;return function(_0x4c1fec){if(_0x4c1fec){return _0x3b21b1['status'](_0x3c6aff)[_0x816f('0x1b')](_0x4c1fec);}};}function respondWithFilteredResult(_0x22d535,_0x22fe81){return function(_0x3b4408){if(_0x3b4408){var _0x4dc52b=_0x3b4408['count'],_0x40313d=_0x22fe81['offset'],_0x3c7760=_0x22fe81[_0x816f('0x1c')]+_0x22fe81[_0x816f('0x1d')],_0x1ef437;if(_0x3c7760>=_0x4dc52b){_0x3c7760=_0x4dc52b;_0x1ef437=0xc8;}else{_0x1ef437=0xce;}_0x22d535['status'](_0x1ef437);return _0x22d535['set'](_0x816f('0x1e'),_0x40313d+'-'+_0x3c7760+'/'+_0x4dc52b)[_0x816f('0x1b')](_0x3b4408);}return null;};}function patchUpdates(_0x322e44){return function(_0x5d3a80){try{jsonpatch[_0x816f('0x1f')](_0x5d3a80,_0x322e44,!![]);}catch(_0x2a9dd0){return BPromise[_0x816f('0x20')](_0x2a9dd0);}return _0x5d3a80[_0x816f('0x21')]();};}function saveUpdates(_0x439c85,_0x5591c2){return function(_0x5a7cfb){if(_0x5a7cfb){return _0x5a7cfb['update'](_0x439c85)['then'](function(_0x344dd8){return _0x344dd8;});}return null;};}function removeEntity(_0x850218,_0x58b0a8){return function(_0xc3885a){if(_0xc3885a){return _0xc3885a['destroy']()['then'](function(){_0x850218['status'](0xcc)[_0x816f('0x1a')]();});}};}function handleEntityNotFound(_0x4b8694,_0x51be5d){return function(_0x375f37){if(!_0x375f37){_0x4b8694[_0x816f('0x19')](0x194);}return _0x375f37;};}function handleError(_0x646414,_0xd7d38e){_0xd7d38e=_0xd7d38e||0x1f4;return function(_0xd7470e){logger[_0x816f('0x22')](_0xd7470e[_0x816f('0x23')]);if(_0xd7470e[_0x816f('0x24')]){delete _0xd7470e[_0x816f('0x24')];}_0x646414[_0x816f('0x25')](_0xd7d38e)[_0x816f('0x26')](_0xd7470e);};}exports[_0x816f('0x27')]=function(_0x52d9e3,_0x200684){var _0x257b01={},_0x1fe05f={},_0xccc2ba={'count':0x0,'rows':[]};var _0x56aafd=_[_0x816f('0x28')](db[_0x816f('0x29')]['rawAttributes'],function(_0x34c688){return{'name':_0x34c688[_0x816f('0x2a')],'type':_0x34c688['type'][_0x816f('0x2b')]};});_0x1fe05f[_0x816f('0x2c')]=_[_0x816f('0x28')](_0x56aafd,_0x816f('0x24'));_0x1fe05f[_0x816f('0x2d')]=_['keys'](_0x52d9e3[_0x816f('0x2d')]);_0x1fe05f['filters']=_[_0x816f('0x2e')](_0x1fe05f[_0x816f('0x2c')],_0x1fe05f[_0x816f('0x2d')]);_0x257b01[_0x816f('0x2f')]=_[_0x816f('0x2e')](_0x1fe05f['model'],qs[_0x816f('0x30')](_0x52d9e3[_0x816f('0x2d')]['fields']));_0x257b01[_0x816f('0x2f')]=_0x257b01[_0x816f('0x2f')]['length']?_0x257b01['attributes']:_0x1fe05f['model'];if(!_0x52d9e3[_0x816f('0x2d')][_0x816f('0x31')](_0x816f('0x32'))){_0x257b01[_0x816f('0x1d')]=qs[_0x816f('0x1d')](_0x52d9e3[_0x816f('0x2d')][_0x816f('0x1d')]);_0x257b01[_0x816f('0x1c')]=qs[_0x816f('0x1c')](_0x52d9e3[_0x816f('0x2d')][_0x816f('0x1c')]);}_0x257b01[_0x816f('0x33')]=qs['sort'](_0x52d9e3['query'][_0x816f('0x34')]);_0x257b01[_0x816f('0x35')]=qs[_0x816f('0x36')](_[_0x816f('0x37')](_0x52d9e3['query'],_0x1fe05f[_0x816f('0x36')]),_0x56aafd);if(_0x52d9e3[_0x816f('0x2d')][_0x816f('0x38')]){_0x257b01[_0x816f('0x35')]=_[_0x816f('0x39')](_0x257b01[_0x816f('0x35')],{'$or':_['map'](_0x56aafd,function(_0x3cca3f){if(_0x3cca3f[_0x816f('0x3a')]!==_0x816f('0x3b')){var _0x2dc110={};_0x2dc110[_0x3cca3f[_0x816f('0x24')]]={'$like':'%'+_0x52d9e3[_0x816f('0x2d')]['filter']+'%'};return _0x2dc110;}})});}_0x257b01=_[_0x816f('0x39')]({},_0x257b01,_0x52d9e3[_0x816f('0x3c')]);var _0x3fda2a={'where':_0x257b01['where']};return db[_0x816f('0x29')][_0x816f('0x3d')](_0x3fda2a)['then'](function(_0x1c89db){_0xccc2ba[_0x816f('0x3d')]=_0x1c89db;if(_0x52d9e3[_0x816f('0x2d')][_0x816f('0x3e')]){_0x257b01['include']=[{'all':!![]}];}return db[_0x816f('0x29')][_0x816f('0x3f')](_0x257b01);})[_0x816f('0x40')](function(_0x3c36fb){_0xccc2ba[_0x816f('0x41')]=_0x3c36fb;return _0xccc2ba;})[_0x816f('0x40')](respondWithFilteredResult(_0x200684,_0x257b01))['catch'](handleError(_0x200684,null));};exports[_0x816f('0x42')]=function(_0x4da0fe,_0x4cf908){var _0x237798={'raw':![],'where':{'id':_0x4da0fe['params']['id']}},_0x4aa4a2={};_0x4aa4a2[_0x816f('0x2c')]=_[_0x816f('0x43')](db[_0x816f('0x29')][_0x816f('0x44')]);_0x4aa4a2['query']=_[_0x816f('0x43')](_0x4da0fe[_0x816f('0x2d')]);_0x4aa4a2['filters']=_[_0x816f('0x2e')](_0x4aa4a2[_0x816f('0x2c')],_0x4aa4a2[_0x816f('0x2d')]);_0x237798[_0x816f('0x2f')]=_[_0x816f('0x2e')](_0x4aa4a2[_0x816f('0x2c')],qs['fields'](_0x4da0fe[_0x816f('0x2d')][_0x816f('0x30')]));_0x237798['attributes']=_0x237798[_0x816f('0x2f')][_0x816f('0x45')]?_0x237798[_0x816f('0x2f')]:_0x4aa4a2['model'];if(_0x4da0fe[_0x816f('0x2d')][_0x816f('0x3e')]){_0x237798['include']=[{'all':!![]}];}_0x237798=_[_0x816f('0x39')]({},_0x237798,_0x4da0fe[_0x816f('0x3c')]);return db[_0x816f('0x29')][_0x816f('0x46')](_0x237798)[_0x816f('0x40')](handleEntityNotFound(_0x4cf908,null))[_0x816f('0x40')](respondWithResult(_0x4cf908,null))[_0x816f('0x47')](handleError(_0x4cf908,null));};exports['create']=function(_0x3fb819,_0x12c83b){return db[_0x816f('0x29')]['create'](_0x3fb819[_0x816f('0x48')],{})[_0x816f('0x40')](respondWithResult(_0x12c83b,0xc9))[_0x816f('0x47')](handleError(_0x12c83b,null));};exports[_0x816f('0x49')]=function(_0x1c56b7,_0x1f4e17){if(_0x1c56b7[_0x816f('0x48')]['id']){delete _0x1c56b7[_0x816f('0x48')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x1c56b7[_0x816f('0x4a')]['id']}})[_0x816f('0x40')](handleEntityNotFound(_0x1f4e17,null))['then'](saveUpdates(_0x1c56b7[_0x816f('0x48')],null))[_0x816f('0x40')](respondWithResult(_0x1f4e17,null))[_0x816f('0x47')](handleError(_0x1f4e17,null));};exports[_0x816f('0x4b')]=function(_0x3b6a0b,_0x495dc1){return db[_0x816f('0x29')][_0x816f('0x46')]({'where':{'id':_0x3b6a0b[_0x816f('0x4a')]['id']}})[_0x816f('0x40')](handleEntityNotFound(_0x495dc1,null))[_0x816f('0x40')](removeEntity(_0x495dc1,null))[_0x816f('0x47')](handleError(_0x495dc1,null));};exports['describe']=function(_0x5246b9,_0x2a04f9){return db[_0x816f('0x29')][_0x816f('0x4c')]()[_0x816f('0x40')](respondWithResult(_0x2a04f9,null))[_0x816f('0x47')](handleError(_0x2a04f9,null));}; \ No newline at end of file +var _0x3249=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','name','send','index','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','UserProfileSection','then','includeAll','include','findAll','catch','rawAttributes','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x3249,0xcd));var _0x9324=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x3249[_0x3b0731];return _0x4204d7;};'use strict';var pdf=require(_0x9324('0x0'));var emlformat=require(_0x9324('0x1'));var rimraf=require(_0x9324('0x2'));var zipdir=require(_0x9324('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9324('0x4'));var moment=require(_0x9324('0x5'));var BPromise=require(_0x9324('0x6'));var Mustache=require(_0x9324('0x7'));var util=require(_0x9324('0x8'));var path=require(_0x9324('0x9'));var sox=require(_0x9324('0xa'));var csv=require(_0x9324('0xb'));var ejs=require(_0x9324('0xc'));var fs=require('fs');var _=require(_0x9324('0xd'));var squel=require(_0x9324('0xe'));var crypto=require(_0x9324('0xf'));var jsforce=require(_0x9324('0x10'));var deskjs=require(_0x9324('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9324('0x12'));var Papa=require(_0x9324('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9324('0x14'));var hardwareService=require(_0x9324('0x15'));var logger=require(_0x9324('0x16'))(_0x9324('0x17'));var utils=require(_0x9324('0x18'));var config=require(_0x9324('0x19'));var licenseUtil=require(_0x9324('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd7b553,_0x1a2b93){_0x1a2b93=_0x1a2b93||0xcc;return function(_0x1e1da9){if(_0x1e1da9){return _0xd7b553['sendStatus'](_0x1a2b93);}return _0xd7b553['status'](_0x1a2b93)[_0x9324('0x1b')]();};}function respondWithResult(_0x17c1c1,_0x181564){_0x181564=_0x181564||0xc8;return function(_0x1d472b){if(_0x1d472b){return _0x17c1c1[_0x9324('0x1c')](_0x181564)[_0x9324('0x1d')](_0x1d472b);}};}function respondWithFilteredResult(_0x2f280a,_0x5e88cf){return function(_0x28b521){if(_0x28b521){var _0x387060=_0x28b521[_0x9324('0x1e')],_0x1bd353=_0x5e88cf[_0x9324('0x1f')],_0x1cb21b=_0x5e88cf[_0x9324('0x1f')]+_0x5e88cf[_0x9324('0x20')],_0x5da17a;if(_0x1cb21b>=_0x387060){_0x1cb21b=_0x387060;_0x5da17a=0xc8;}else{_0x5da17a=0xce;}_0x2f280a['status'](_0x5da17a);return _0x2f280a[_0x9324('0x21')](_0x9324('0x22'),_0x1bd353+'-'+_0x1cb21b+'/'+_0x387060)[_0x9324('0x1d')](_0x28b521);}return null;};}function patchUpdates(_0x381f60){return function(_0x1b2a4f){try{jsonpatch['apply'](_0x1b2a4f,_0x381f60,!![]);}catch(_0x4b4906){return BPromise[_0x9324('0x23')](_0x4b4906);}return _0x1b2a4f[_0x9324('0x24')]();};}function saveUpdates(_0x3559c3,_0x455edc){return function(_0xa8d0da){if(_0xa8d0da){return _0xa8d0da[_0x9324('0x25')](_0x3559c3)['then'](function(_0x1dd44c){return _0x1dd44c;});}return null;};}function removeEntity(_0x147134,_0x13b856){return function(_0x6242fb){if(_0x6242fb){return _0x6242fb[_0x9324('0x26')]()['then'](function(){_0x147134[_0x9324('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58b74b,_0x3e43e2){return function(_0x550074){if(!_0x550074){_0x58b74b[_0x9324('0x27')](0x194);}return _0x550074;};}function handleError(_0x4b064c,_0x47b7ee){_0x47b7ee=_0x47b7ee||0x1f4;return function(_0x53287d){logger['error'](_0x53287d['stack']);if(_0x53287d[_0x9324('0x28')]){delete _0x53287d[_0x9324('0x28')];}_0x4b064c[_0x9324('0x1c')](_0x47b7ee)[_0x9324('0x29')](_0x53287d);};}exports[_0x9324('0x2a')]=function(_0x291394,_0x4c59b5){var _0x158265={},_0x1e2b6a={},_0x48238a={'count':0x0,'rows':[]};var _0x4dd0ca=_[_0x9324('0x2b')](db['UserProfileSection']['rawAttributes'],function(_0x456b05){return{'name':_0x456b05['fieldName'],'type':_0x456b05[_0x9324('0x2c')][_0x9324('0x2d')]};});_0x1e2b6a[_0x9324('0x2e')]=_[_0x9324('0x2b')](_0x4dd0ca,'name');_0x1e2b6a['query']=_[_0x9324('0x2f')](_0x291394[_0x9324('0x30')]);_0x1e2b6a[_0x9324('0x31')]=_[_0x9324('0x32')](_0x1e2b6a['model'],_0x1e2b6a[_0x9324('0x30')]);_0x158265[_0x9324('0x33')]=_['intersection'](_0x1e2b6a[_0x9324('0x2e')],qs[_0x9324('0x34')](_0x291394[_0x9324('0x30')][_0x9324('0x34')]));_0x158265[_0x9324('0x33')]=_0x158265[_0x9324('0x33')][_0x9324('0x35')]?_0x158265[_0x9324('0x33')]:_0x1e2b6a[_0x9324('0x2e')];if(!_0x291394[_0x9324('0x30')][_0x9324('0x36')](_0x9324('0x37'))){_0x158265[_0x9324('0x20')]=qs['limit'](_0x291394[_0x9324('0x30')][_0x9324('0x20')]);_0x158265[_0x9324('0x1f')]=qs['offset'](_0x291394[_0x9324('0x30')]['offset']);}_0x158265[_0x9324('0x38')]=qs[_0x9324('0x39')](_0x291394[_0x9324('0x30')]['sort']);_0x158265[_0x9324('0x3a')]=qs[_0x9324('0x31')](_[_0x9324('0x3b')](_0x291394[_0x9324('0x30')],_0x1e2b6a['filters']),_0x4dd0ca);if(_0x291394['query']['filter']){_0x158265[_0x9324('0x3a')]=_[_0x9324('0x3c')](_0x158265[_0x9324('0x3a')],{'$or':_['map'](_0x4dd0ca,function(_0x5da3ba){if(_0x5da3ba['type']!==_0x9324('0x3d')){var _0x40b034={};_0x40b034[_0x5da3ba['name']]={'$like':'%'+_0x291394[_0x9324('0x30')]['filter']+'%'};return _0x40b034;}})});}_0x158265=_[_0x9324('0x3c')]({},_0x158265,_0x291394[_0x9324('0x3e')]);var _0x8ec875={'where':_0x158265[_0x9324('0x3a')]};return db[_0x9324('0x3f')][_0x9324('0x1e')](_0x8ec875)[_0x9324('0x40')](function(_0x1e9489){_0x48238a[_0x9324('0x1e')]=_0x1e9489;if(_0x291394[_0x9324('0x30')][_0x9324('0x41')]){_0x158265[_0x9324('0x42')]=[{'all':!![]}];}return db['UserProfileSection'][_0x9324('0x43')](_0x158265);})[_0x9324('0x40')](function(_0x419a4e){_0x48238a['rows']=_0x419a4e;return _0x48238a;})[_0x9324('0x40')](respondWithFilteredResult(_0x4c59b5,_0x158265))[_0x9324('0x44')](handleError(_0x4c59b5,null));};exports['show']=function(_0x599b82,_0x55f9f5){var _0x30fed0={'raw':![],'where':{'id':_0x599b82['params']['id']}},_0x349e78={};_0x349e78['model']=_[_0x9324('0x2f')](db['UserProfileSection'][_0x9324('0x45')]);_0x349e78['query']=_[_0x9324('0x2f')](_0x599b82[_0x9324('0x30')]);_0x349e78[_0x9324('0x31')]=_[_0x9324('0x32')](_0x349e78[_0x9324('0x2e')],_0x349e78[_0x9324('0x30')]);_0x30fed0[_0x9324('0x33')]=_[_0x9324('0x32')](_0x349e78['model'],qs['fields'](_0x599b82[_0x9324('0x30')]['fields']));_0x30fed0[_0x9324('0x33')]=_0x30fed0[_0x9324('0x33')]['length']?_0x30fed0[_0x9324('0x33')]:_0x349e78['model'];if(_0x599b82[_0x9324('0x30')][_0x9324('0x41')]){_0x30fed0[_0x9324('0x42')]=[{'all':!![]}];}_0x30fed0=_[_0x9324('0x3c')]({},_0x30fed0,_0x599b82[_0x9324('0x3e')]);return db['UserProfileSection'][_0x9324('0x46')](_0x30fed0)[_0x9324('0x40')](handleEntityNotFound(_0x55f9f5,null))[_0x9324('0x40')](respondWithResult(_0x55f9f5,null))[_0x9324('0x44')](handleError(_0x55f9f5,null));};exports[_0x9324('0x47')]=function(_0x4adffc,_0xb7e0e5){return db[_0x9324('0x3f')][_0x9324('0x47')](_0x4adffc[_0x9324('0x48')],{})['then'](respondWithResult(_0xb7e0e5,0xc9))[_0x9324('0x44')](handleError(_0xb7e0e5,null));};exports['update']=function(_0x56c3d1,_0x262d97){if(_0x56c3d1[_0x9324('0x48')]['id']){delete _0x56c3d1[_0x9324('0x48')]['id'];}return db[_0x9324('0x3f')]['find']({'where':{'id':_0x56c3d1[_0x9324('0x49')]['id']}})['then'](handleEntityNotFound(_0x262d97,null))[_0x9324('0x40')](saveUpdates(_0x56c3d1[_0x9324('0x48')],null))[_0x9324('0x40')](respondWithResult(_0x262d97,null))['catch'](handleError(_0x262d97,null));};exports['destroy']=function(_0x340878,_0x34a8f7){return db['UserProfileSection'][_0x9324('0x46')]({'where':{'id':_0x340878['params']['id']}})['then'](handleEntityNotFound(_0x34a8f7,null))[_0x9324('0x40')](removeEntity(_0x34a8f7,null))[_0x9324('0x44')](handleError(_0x34a8f7,null));};exports[_0x9324('0x4a')]=function(_0xa6dc77,_0x8b8223){return db['UserProfileSection'][_0x9324('0x4a')]()['then'](respondWithResult(_0x8b8223,null))['catch'](handleError(_0x8b8223,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index f966739..a015572 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 _0x175f=['rimraf','../../config/environment','./userProfileSection.attributes','exports','define','compositeIndex','userProfileId','util','api','moment','request-promise','path'];(function(_0x19c8d0,_0x17c993){var _0x1e70b9=function(_0x8bb85e){while(--_0x8bb85e){_0x19c8d0['push'](_0x19c8d0['shift']());}};_0x1e70b9(++_0x17c993);}(_0x175f,0x1ab));var _0xf175=function(_0x23a68f,_0x2e1edf){_0x23a68f=_0x23a68f-0x0;var _0x2d9a7c=_0x175f[_0x23a68f];return _0x2d9a7c;};'use strict';var _=require('lodash');var util=require(_0xf175('0x0'));var logger=require('../../config/logger')(_0xf175('0x1'));var moment=require(_0xf175('0x2'));var BPromise=require('bluebird');var rp=require(_0xf175('0x3'));var fs=require('fs');var path=require(_0xf175('0x4'));var rimraf=require(_0xf175('0x5'));var config=require(_0xf175('0x6'));var attributes=require(_0xf175('0x7'));module[_0xf175('0x8')]=function(_0x6641aa,_0x3c13f0){return _0x6641aa[_0xf175('0x9')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xf175('0xa'),'fields':['sectionId',_0xf175('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2405=['rimraf','./userProfileSection.attributes','exports','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x55fd2c,_0x3fa39a){var _0x42f962=function(_0x65bbfd){while(--_0x65bbfd){_0x55fd2c['push'](_0x55fd2c['shift']());}};_0x42f962(++_0x3fa39a);}(_0x2405,0x173));var _0x5240=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x2405[_0x2272b5];return _0x110156;};'use strict';var _=require(_0x5240('0x0'));var util=require(_0x5240('0x1'));var logger=require('../../config/logger')(_0x5240('0x2'));var moment=require(_0x5240('0x3'));var BPromise=require(_0x5240('0x4'));var rp=require(_0x5240('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5240('0x6'));var config=require('../../config/environment');var attributes=require(_0x5240('0x7'));module[_0x5240('0x8')]=function(_0x2bac60,_0x8d0e5a){return _0x2bac60['define'](_0x5240('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x5240('0xa'),'fields':[_0x5240('0xb'),_0x5240('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index d00235a..c8f569e 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 _0x72df=['error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3396ae,_0x5eabaf){var _0x75ff62=function(_0x4ae31e){while(--_0x4ae31e){_0x3396ae['push'](_0x3396ae['shift']());}};_0x75ff62(++_0x5eabaf);}(_0x72df,0xea));var _0xf72d=function(_0x22a604,_0x245c92){_0x22a604=_0x22a604-0x0;var _0x301bdb=_0x72df[_0x22a604];return _0x301bdb;};'use strict';var _=require(_0xf72d('0x0'));var util=require(_0xf72d('0x1'));var moment=require(_0xf72d('0x2'));var BPromise=require(_0xf72d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf72d('0x4'));var db=require(_0xf72d('0x5'))['db'];var utils=require(_0xf72d('0x6'));var logger=require(_0xf72d('0x7'))(_0xf72d('0x8'));var config=require(_0xf72d('0x9'));var jayson=require(_0xf72d('0xa'));var client=jayson[_0xf72d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b74f,_0x558e5e,_0x57dd41){return new BPromise(function(_0x43496f,_0x12532a){return client['request'](_0x10b74f,_0x57dd41)[_0xf72d('0xc')](function(_0x64517a){logger[_0xf72d('0xd')](_0xf72d('0xe'),_0x558e5e,_0xf72d('0xf'));logger[_0xf72d('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x558e5e,_0xf72d('0xf'),JSON[_0xf72d('0x11')](_0x64517a));if(_0x64517a[_0xf72d('0x12')]){if(_0x64517a[_0xf72d('0x12')]['code']===0x1f4){logger[_0xf72d('0x12')](_0xf72d('0xe'),_0x558e5e,_0x64517a[_0xf72d('0x12')]['message']);return _0x12532a(_0x64517a[_0xf72d('0x12')][_0xf72d('0x13')]);}logger[_0xf72d('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x558e5e,_0x64517a[_0xf72d('0x12')][_0xf72d('0x13')]);return _0x43496f(_0x64517a[_0xf72d('0x12')][_0xf72d('0x13')]);}else{logger['info'](_0xf72d('0xe'),_0x558e5e,'request\x20sent');_0x43496f(_0x64517a[_0xf72d('0x14')][_0xf72d('0x13')]);}})['catch'](function(_0x50fc1a){logger[_0xf72d('0x12')](_0xf72d('0xe'),_0x558e5e,_0x50fc1a);_0x12532a(_0x50fc1a);});});} \ No newline at end of file +var _0xbbe0=['../../config/environment','jayson/promise','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x9a9f23,_0x2be6a0){var _0x423e5a=function(_0x4f0ba7){while(--_0x4f0ba7){_0x9a9f23['push'](_0x9a9f23['shift']());}};_0x423e5a(++_0x2be6a0);}(_0xbbe0,0x75));var _0x0bbe=function(_0x426f44,_0x399545){_0x426f44=_0x426f44-0x0;var _0x1bca30=_0xbbe0[_0x426f44];return _0x1bca30;};'use strict';var _=require(_0x0bbe('0x0'));var util=require(_0x0bbe('0x1'));var moment=require(_0x0bbe('0x2'));var BPromise=require(_0x0bbe('0x3'));var rs=require(_0x0bbe('0x4'));var fs=require('fs');var Redis=require(_0x0bbe('0x5'));var db=require(_0x0bbe('0x6'))['db'];var utils=require(_0x0bbe('0x7'));var logger=require(_0x0bbe('0x8'))('rpc');var config=require(_0x0bbe('0x9'));var jayson=require(_0x0bbe('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xaaefb2,_0x388f6f,_0x215b04){return new BPromise(function(_0x5dd6a8,_0x14c2af){return client[_0x0bbe('0xb')](_0xaaefb2,_0x215b04)['then'](function(_0x1d65c9){logger[_0x0bbe('0xc')](_0x0bbe('0xd'),_0x388f6f,_0x0bbe('0xe'));logger[_0x0bbe('0xf')](_0x0bbe('0x10'),_0x388f6f,'request\x20sent',JSON[_0x0bbe('0x11')](_0x1d65c9));if(_0x1d65c9[_0x0bbe('0x12')]){if(_0x1d65c9[_0x0bbe('0x12')]['code']===0x1f4){logger[_0x0bbe('0x12')](_0x0bbe('0xd'),_0x388f6f,_0x1d65c9[_0x0bbe('0x12')][_0x0bbe('0x13')]);return _0x14c2af(_0x1d65c9['error'][_0x0bbe('0x13')]);}logger[_0x0bbe('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x388f6f,_0x1d65c9[_0x0bbe('0x12')]['message']);return _0x5dd6a8(_0x1d65c9[_0x0bbe('0x12')][_0x0bbe('0x13')]);}else{logger[_0x0bbe('0xc')](_0x0bbe('0xd'),_0x388f6f,_0x0bbe('0xe'));_0x5dd6a8(_0x1d65c9[_0x0bbe('0x14')][_0x0bbe('0x13')]);}})['catch'](function(_0x369300){logger['error'](_0x0bbe('0xd'),_0x388f6f,_0x369300);_0x14c2af(_0x369300);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 73fc58a..888b213 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 _0x9829=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x40061d,_0x28be99){var _0x44f50d=function(_0x39412e){while(--_0x39412e){_0x40061d['push'](_0x40061d['shift']());}};_0x44f50d(++_0x28be99);}(_0x9829,0xc4));var _0x9982=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9829[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0x9982('0x0'));var util=require(_0x9982('0x1'));var path=require(_0x9982('0x2'));var timeout=require(_0x9982('0x3'));var express=require(_0x9982('0x4'));var router=express['Router']();var auth=require(_0x9982('0x5'));var interaction=require(_0x9982('0x6'));var config=require(_0x9982('0x7'));module['exports']=router; \ No newline at end of file +var _0x600c=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router'];(function(_0x347142,_0x1a83ae){var _0x47e238=function(_0x431cf9){while(--_0x431cf9){_0x347142['push'](_0x347142['shift']());}};_0x47e238(++_0x1a83ae);}(_0x600c,0xe5));var _0xc600=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x600c[_0x25e7cb];return _0x375d92;};'use strict';var multer=require(_0xc600('0x0'));var util=require(_0xc600('0x1'));var path=require(_0xc600('0x2'));var timeout=require('connect-timeout');var express=require(_0xc600('0x3'));var router=express[_0xc600('0x4')]();var auth=require(_0xc600('0x5'));var interaction=require(_0xc600('0x6'));var config=require(_0xc600('0x7'));module[_0xc600('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 4b8e60f..36626fb 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x31520d,_0x50046a){var _0x4d0d26=function(_0x187fe0){while(--_0x187fe0){_0x31520d['push'](_0x31520d['shift']());}};_0x4d0d26(++_0x50046a);}(_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 +var _0xd8b0=['exports','sequelize'];(function(_0x1c6f10,_0x5eed05){var _0x5a9683=function(_0x1ea102){while(--_0x1ea102){_0x1c6f10['push'](_0x1c6f10['shift']());}};_0x5a9683(++_0x5eed05);}(_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 e688ab0..174d8fa 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 _0xabf0=['./userSmsQueue.attributes','define','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x561f29,_0x465d8a){var _0x498c76=function(_0x556c30){while(--_0x556c30){_0x561f29['push'](_0x561f29['shift']());}};_0x498c76(++_0x465d8a);}(_0xabf0,0xda));var _0x0abf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xabf0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0abf('0x0'));var util=require('util');var logger=require(_0x0abf('0x1'))(_0x0abf('0x2'));var moment=require(_0x0abf('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0abf('0x4'));var rimraf=require(_0x0abf('0x5'));var config=require(_0x0abf('0x6'));var attributes=require(_0x0abf('0x7'));module['exports']=function(_0x4fd72b,_0x53f65e){return _0x4fd72b[_0x0abf('0x8')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5385=['./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5385,0x185));var _0x5538=function(_0x4928e4,_0xcb29c){_0x4928e4=_0x4928e4-0x0;var _0x127908=_0x5385[_0x4928e4];return _0x127908;};'use strict';var _=require(_0x5538('0x0'));var util=require(_0x5538('0x1'));var logger=require('../../config/logger')(_0x5538('0x2'));var moment=require(_0x5538('0x3'));var BPromise=require(_0x5538('0x4'));var rp=require(_0x5538('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5538('0x6'));var attributes=require(_0x5538('0x7'));module[_0x5538('0x8')]=function(_0x3188e3,_0xa1d385){return _0x3188e3[_0x5538('0x9')]('UserSmsQueue',attributes,{'tableName':_0x5538('0xa'),'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 e2d7608..6967b73 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 _0x617f=['http','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x120123,_0x4eff59){var _0x3bec4c=function(_0x182818){while(--_0x182818){_0x120123['push'](_0x120123['shift']());}};_0x3bec4c(++_0x4eff59);}(_0x617f,0x14d));var _0xf617=function(_0x2a8925,_0x7245af){_0x2a8925=_0x2a8925-0x0;var _0x38c067=_0x617f[_0x2a8925];return _0x38c067;};'use strict';var _=require('lodash');var util=require(_0xf617('0x0'));var moment=require(_0xf617('0x1'));var BPromise=require('bluebird');var rs=require(_0xf617('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf617('0x3'));var logger=require(_0xf617('0x4'))(_0xf617('0x5'));var config=require(_0xf617('0x6'));var jayson=require(_0xf617('0x7'));var client=jayson[_0xf617('0x8')][_0xf617('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58e230,_0x4b8050,_0xe50c72){return new BPromise(function(_0x15aba9,_0x5518f1){return client['request'](_0x58e230,_0xe50c72)['then'](function(_0x2035c1){logger[_0xf617('0xa')](_0xf617('0xb'),_0x4b8050,'request\x20sent');logger['debug'](_0xf617('0xc'),_0x4b8050,'request\x20sent',JSON[_0xf617('0xd')](_0x2035c1));if(_0x2035c1[_0xf617('0xe')]){if(_0x2035c1[_0xf617('0xe')][_0xf617('0xf')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x4b8050,_0x2035c1['error'][_0xf617('0x10')]);return _0x5518f1(_0x2035c1['error'][_0xf617('0x10')]);}logger[_0xf617('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x4b8050,_0x2035c1[_0xf617('0xe')][_0xf617('0x10')]);return _0x15aba9(_0x2035c1[_0xf617('0xe')][_0xf617('0x10')]);}else{logger[_0xf617('0xa')](_0xf617('0xb'),_0x4b8050,'request\x20sent');_0x15aba9(_0x2035c1[_0xf617('0x11')][_0xf617('0x10')]);}})['catch'](function(_0x245e9e){logger[_0xf617('0xe')](_0xf617('0xb'),_0x4b8050,_0x245e9e);_0x5518f1(_0x245e9e);});});} \ No newline at end of file +var _0xcf00=['UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x3ec0e8,_0x485a9d){var _0x26fd54=function(_0x4df6a5){while(--_0x4df6a5){_0x3ec0e8['push'](_0x3ec0e8['shift']());}};_0x26fd54(++_0x485a9d);}(_0xcf00,0x65));var _0x0cf0=function(_0x3789b9,_0x5c2f00){_0x3789b9=_0x3789b9-0x0;var _0x4d020d=_0xcf00[_0x3789b9];return _0x4d020d;};'use strict';var _=require(_0x0cf0('0x0'));var util=require(_0x0cf0('0x1'));var moment=require(_0x0cf0('0x2'));var BPromise=require(_0x0cf0('0x3'));var rs=require(_0x0cf0('0x4'));var fs=require('fs');var Redis=require(_0x0cf0('0x5'));var db=require(_0x0cf0('0x6'))['db'];var utils=require(_0x0cf0('0x7'));var logger=require(_0x0cf0('0x8'))(_0x0cf0('0x9'));var config=require(_0x0cf0('0xa'));var jayson=require(_0x0cf0('0xb'));var client=jayson['client'][_0x0cf0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3952ee,_0x90d41d,_0x1a5af4){return new BPromise(function(_0x3b3ecc,_0x3fb363){return client['request'](_0x3952ee,_0x1a5af4)[_0x0cf0('0xd')](function(_0x4322c4){logger['info'](_0x0cf0('0xe'),_0x90d41d,'request\x20sent');logger[_0x0cf0('0xf')](_0x0cf0('0x10'),_0x90d41d,_0x0cf0('0x11'),JSON[_0x0cf0('0x12')](_0x4322c4));if(_0x4322c4['error']){if(_0x4322c4[_0x0cf0('0x13')]['code']===0x1f4){logger[_0x0cf0('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x90d41d,_0x4322c4['error']['message']);return _0x3fb363(_0x4322c4[_0x0cf0('0x13')]['message']);}logger[_0x0cf0('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x90d41d,_0x4322c4[_0x0cf0('0x13')][_0x0cf0('0x14')]);return _0x3b3ecc(_0x4322c4['error'][_0x0cf0('0x14')]);}else{logger[_0x0cf0('0x15')]('UserSmsQueue,\x20%s,\x20%s',_0x90d41d,'request\x20sent');_0x3b3ecc(_0x4322c4['result']['message']);}})[_0x0cf0('0x16')](function(_0x353b1e){logger[_0x0cf0('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x90d41d,_0x353b1e);_0x3fb363(_0x353b1e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 6bbe4cc..939a16b 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 _0x7fc5=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x7fc5,0x10c));var _0x57fc=function(_0xb1d76d,_0x30f235){_0xb1d76d=_0xb1d76d-0x0;var _0x383a0b=_0x7fc5[_0xb1d76d];return _0x383a0b;};'use strict';var multer=require(_0x57fc('0x0'));var util=require(_0x57fc('0x1'));var path=require(_0x57fc('0x2'));var timeout=require(_0x57fc('0x3'));var express=require(_0x57fc('0x4'));var router=express[_0x57fc('0x5')]();var auth=require(_0x57fc('0x6'));var interaction=require(_0x57fc('0x7'));var config=require(_0x57fc('0x8'));module['exports']=router; \ No newline at end of file +var _0x7718=['../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout'];(function(_0x558c21,_0x190368){var _0x2e7610=function(_0x23c3ab){while(--_0x23c3ab){_0x558c21['push'](_0x558c21['shift']());}};_0x2e7610(++_0x190368);}(_0x7718,0x129));var _0x8771=function(_0x2a4780,_0x20fa15){_0x2a4780=_0x2a4780-0x0;var _0x31020e=_0x7718[_0x2a4780];return _0x31020e;};'use strict';var multer=require(_0x8771('0x0'));var util=require(_0x8771('0x1'));var path=require('path');var timeout=require(_0x8771('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8771('0x3'));var config=require(_0x8771('0x4'));module[_0x8771('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 55051a6..5eb2bbe 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 _0xd8b0=['exports','sequelize'];(function(_0x43f756,_0xae9f58){var _0x5ba710=function(_0x5205d4){while(--_0x5205d4){_0x43f756['push'](_0x43f756['shift']());}};_0x5ba710(++_0xae9f58);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x4df85c,_0x248dfb){var _0x4e2a61=function(_0x4e2c8e){while(--_0x4e2c8e){_0x4df85c['push'](_0x4df85c['shift']());}};_0x4e2a61(++_0x248dfb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 64d4879..dfaf5de 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 _0xed1f=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0xc63efa,_0x10a80e){var _0x984b27=function(_0xa129e3){while(--_0xa129e3){_0xc63efa['push'](_0xc63efa['shift']());}};_0x984b27(++_0x10a80e);}(_0xed1f,0x6a));var _0xfed1=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xed1f[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3435=['api','moment','bluebird','path','rimraf','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0x3435,0xfa));var _0x5343=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x3435[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var logger=require(_0x5343('0x2'))(_0x5343('0x3'));var moment=require(_0x5343('0x4'));var BPromise=require(_0x5343('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5343('0x6'));var rimraf=require(_0x5343('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x5343('0x8')]=function(_0x28f0f3,_0x4d26b5){return _0x28f0f3['define'](_0x5343('0x9'),attributes,{'tableName':_0x5343('0xa'),'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 f75850f..807eb2b 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 _0x1813=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s'];(function(_0x3f8421,_0x583880){var _0x10b087=function(_0x319d5a){while(--_0x319d5a){_0x3f8421['push'](_0x3f8421['shift']());}};_0x10b087(++_0x583880);}(_0x1813,0x1ec));var _0x3181=function(_0x3168cf,_0x132e93){_0x3168cf=_0x3168cf-0x0;var _0x751dac=_0x1813[_0x3168cf];return _0x751dac;};'use strict';var _=require(_0x3181('0x0'));var util=require(_0x3181('0x1'));var moment=require('moment');var BPromise=require(_0x3181('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3181('0x3'));var logger=require(_0x3181('0x4'))(_0x3181('0x5'));var config=require('../../config/environment');var jayson=require(_0x3181('0x6'));var client=jayson[_0x3181('0x7')][_0x3181('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x311a44,_0x2de7ac,_0x4b9a81){return new BPromise(function(_0x1ee21e,_0x5b6b4b){return client[_0x3181('0x9')](_0x311a44,_0x4b9a81)[_0x3181('0xa')](function(_0xba3e58){logger['info'](_0x3181('0xb'),_0x2de7ac,'request\x20sent');logger['debug'](_0x3181('0xc'),_0x2de7ac,_0x3181('0xd'),JSON[_0x3181('0xe')](_0xba3e58));if(_0xba3e58[_0x3181('0xf')]){if(_0xba3e58[_0x3181('0xf')][_0x3181('0x10')]===0x1f4){logger[_0x3181('0xf')](_0x3181('0xb'),_0x2de7ac,_0xba3e58[_0x3181('0xf')]['message']);return _0x5b6b4b(_0xba3e58[_0x3181('0xf')]['message']);}logger[_0x3181('0xf')](_0x3181('0xb'),_0x2de7ac,_0xba3e58[_0x3181('0xf')][_0x3181('0x11')]);return _0x1ee21e(_0xba3e58[_0x3181('0xf')][_0x3181('0x11')]);}else{logger[_0x3181('0x12')](_0x3181('0xb'),_0x2de7ac,'request\x20sent');_0x1ee21e(_0xba3e58[_0x3181('0x13')][_0x3181('0x11')]);}})[_0x3181('0x14')](function(_0x491b89){logger['error'](_0x3181('0xb'),_0x2de7ac,_0x491b89);_0x5b6b4b(_0x491b89);});});} \ No newline at end of file +var _0x9e7b=['../../config/environment','jayson/promise','client','http','request','then','info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserVoiceQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x436542,_0x1dd417){var _0x1aab00=function(_0x2a69e7){while(--_0x2a69e7){_0x436542['push'](_0x436542['shift']());}};_0x1aab00(++_0x1dd417);}(_0x9e7b,0xd9));var _0xb9e7=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x9e7b[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xb9e7('0x0'));var util=require(_0xb9e7('0x1'));var moment=require(_0xb9e7('0x2'));var BPromise=require('bluebird');var rs=require(_0xb9e7('0x3'));var fs=require('fs');var Redis=require(_0xb9e7('0x4'));var db=require(_0xb9e7('0x5'))['db'];var utils=require(_0xb9e7('0x6'));var logger=require('../../config/logger')(_0xb9e7('0x7'));var config=require(_0xb9e7('0x8'));var jayson=require(_0xb9e7('0x9'));var client=jayson[_0xb9e7('0xa')][_0xb9e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c740d,_0x506372,_0x447263){return new BPromise(function(_0x569c37,_0x32349a){return client[_0xb9e7('0xc')](_0x2c740d,_0x447263)[_0xb9e7('0xd')](function(_0x748228){logger[_0xb9e7('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x506372,'request\x20sent');logger[_0xb9e7('0xf')](_0xb9e7('0x10'),_0x506372,_0xb9e7('0x11'),JSON[_0xb9e7('0x12')](_0x748228));if(_0x748228[_0xb9e7('0x13')]){if(_0x748228[_0xb9e7('0x13')][_0xb9e7('0x14')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x506372,_0x748228[_0xb9e7('0x13')][_0xb9e7('0x15')]);return _0x32349a(_0x748228[_0xb9e7('0x13')][_0xb9e7('0x15')]);}logger['error'](_0xb9e7('0x16'),_0x506372,_0x748228[_0xb9e7('0x13')][_0xb9e7('0x15')]);return _0x569c37(_0x748228['error'][_0xb9e7('0x15')]);}else{logger[_0xb9e7('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x506372,_0xb9e7('0x11'));_0x569c37(_0x748228[_0xb9e7('0x17')]['message']);}})[_0xb9e7('0x18')](function(_0x6b0cd1){logger[_0xb9e7('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x506372,_0x6b0cd1);_0x32349a(_0x6b0cd1);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 7df3339..f69fb2d 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 _0xb7c2=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb7c2,0x1c6));var _0x2b7c=function(_0x343593,_0x4114e1){_0x343593=_0x343593-0x0;var _0x35fb17=_0xb7c2[_0x343593];return _0x35fb17;};'use strict';var multer=require('multer');var util=require(_0x2b7c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2b7c('0x1')]();var auth=require(_0x2b7c('0x2'));var interaction=require(_0x2b7c('0x3'));var config=require(_0x2b7c('0x4'));module['exports']=router; \ No newline at end of file +var _0x6aea=['connect-timeout','Router','../../components/auth/service','../../config/environment','multer','util','path'];(function(_0x4d29bf,_0x34c965){var _0xecfaf9=function(_0x3417a){while(--_0x3417a){_0x4d29bf['push'](_0x4d29bf['shift']());}};_0xecfaf9(++_0x34c965);}(_0x6aea,0x89));var _0xa6ae=function(_0x3009a2,_0x220c9a){_0x3009a2=_0x3009a2-0x0;var _0x108195=_0x6aea[_0x3009a2];return _0x108195;};'use strict';var multer=require(_0xa6ae('0x0'));var util=require(_0xa6ae('0x1'));var path=require(_0xa6ae('0x2'));var timeout=require(_0xa6ae('0x3'));var express=require('express');var router=express[_0xa6ae('0x4')]();var auth=require(_0xa6ae('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa6ae('0x6'));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 bcb5e48..f2dae91 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 _0x9952=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x1c0781,_0x4a19f1){var _0x1f577e=function(_0x396577){while(--_0x396577){_0x1c0781['push'](_0x1c0781['shift']());}};_0x1f577e(++_0x4a19f1);}(_0x9952,0x12b));var _0x2995=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0x9952[_0x9a3e0f];return _0x3d2a9a;};'use strict';var Sequelize=require(_0x2995('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x2995('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2995('0x2')},'membername':{'type':Sequelize[_0x2995('0x3')],'allowNull':![],'comment':_0x2995('0x2')},'UserId':{'type':Sequelize[_0x2995('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2995('0x3')],'allowNull':![],'unique':_0x2995('0x4'),'comment':_0x2995('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x2995('0x3')],'allowNull':![],'unique':_0x2995('0x4'),'comment':_0x2995('0x2')},'penalty':{'type':Sequelize[_0x2995('0x1')](0xb),'defaultValue':0x0,'comment':_0x2995('0x2')},'paused':{'type':Sequelize[_0x2995('0x1')](0xb),'defaultValue':0x0,'comment':_0x2995('0x2')}}; \ No newline at end of file +var _0xc76c=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x5d5be1,_0x261eb9){var _0x23134c=function(_0x1ea727){while(--_0x1ea727){_0x5d5be1['push'](_0x5d5be1['shift']());}};_0x23134c(++_0x261eb9);}(_0xc76c,0xfa));var _0xcc76=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc76c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcc76('0x0'));module[_0xcc76('0x1')]={'uniqueid':{'type':Sequelize[_0xcc76('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xcc76('0x3')},'membername':{'type':Sequelize[_0xcc76('0x4')],'allowNull':![],'comment':_0xcc76('0x3')},'UserId':{'type':Sequelize[_0xcc76('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xcc76('0x4')],'allowNull':![],'unique':_0xcc76('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xcc76('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xcc76('0x4')],'allowNull':![],'unique':_0xcc76('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xcc76('0x3')},'paused':{'type':Sequelize[_0xcc76('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index abfb4b9..bc83a64 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 _0xcd4b=['remove','emit','hasOwnProperty','hook','exports','events','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x3b76e2,_0x12dd4f){var _0x49e797=function(_0x3906d0){while(--_0x3906d0){_0x3b76e2['push'](_0x3b76e2['shift']());}};_0x49e797(++_0x12dd4f);}(_0xcd4b,0xb0));var _0xbcd4=function(_0x2b9981,_0x4f81b3){_0x2b9981=_0x2b9981-0x0;var _0x314ac1=_0xcd4b[_0x2b9981];return _0x314ac1;};'use strict';var EventEmitter=require(_0xbcd4('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xbcd4('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xbcd4('0x2')](0x0);var events={'afterCreate':_0xbcd4('0x3'),'afterUpdate':'update','afterDestroy':_0xbcd4('0x4')};function emitEvent(_0x8e2648){return function(_0x31729e,_0x50bf7b,_0x43a6ca){UserVoiceQueueRtEvents[_0xbcd4('0x5')](_0x8e2648+':'+_0x31729e['id'],_0x31729e);UserVoiceQueueRtEvents[_0xbcd4('0x5')](_0x8e2648,_0x31729e);_0x43a6ca(null);};}for(var e in events){if(events[_0xbcd4('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xbcd4('0x7')](e,emitEvent(event));}}module[_0xbcd4('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x8b35=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit'];(function(_0x33d2e,_0x33a718){var _0x561ea6=function(_0x368fb5){while(--_0x368fb5){_0x33d2e['push'](_0x33d2e['shift']());}};_0x561ea6(++_0x33a718);}(_0x8b35,0xa3));var _0x58b3=function(_0x8873e0,_0x184ae7){_0x8873e0=_0x8873e0-0x0;var _0x241fa1=_0x8b35[_0x8873e0];return _0x241fa1;};'use strict';var EventEmitter=require(_0x58b3('0x0'));var UserVoiceQueueRt=require(_0x58b3('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x58b3('0x2')](0x0);var events={'afterCreate':_0x58b3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3561e4){return function(_0xb94b3a,_0x51a783,_0x2bf456){UserVoiceQueueRtEvents[_0x58b3('0x4')](_0x3561e4+':'+_0xb94b3a['id'],_0xb94b3a);UserVoiceQueueRtEvents[_0x58b3('0x4')](_0x3561e4,_0xb94b3a);_0x2bf456(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x58b3('0x5')](e,emitEvent(event));}}module[_0x58b3('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index f4d8a6c..550fa89 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 _0xf432=['path','rimraf','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27ab8c,_0x42376a){var _0x1e65dc=function(_0x1604ba){while(--_0x1604ba){_0x27ab8c['push'](_0x27ab8c['shift']());}};_0x1e65dc(++_0x42376a);}(_0xf432,0xd6));var _0x2f43=function(_0x631577,_0x38e35d){_0x631577=_0x631577-0x0;var _0x517397=_0xf432[_0x631577];return _0x517397;};'use strict';var _=require('lodash');var util=require(_0x2f43('0x0'));var logger=require(_0x2f43('0x1'))(_0x2f43('0x2'));var moment=require(_0x2f43('0x3'));var BPromise=require(_0x2f43('0x4'));var rp=require(_0x2f43('0x5'));var fs=require('fs');var path=require(_0x2f43('0x6'));var rimraf=require(_0x2f43('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x395f4c,_0x2d4b79){return _0x395f4c[_0x2f43('0x8')](_0x2f43('0x9'),attributes,{'tableName':_0x2f43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8af=['exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x3d0c24,_0xac3f2b){var _0x3e8af2=function(_0xbd5a20){while(--_0xbd5a20){_0x3d0c24['push'](_0x3d0c24['shift']());}};_0x3e8af2(++_0xac3f2b);}(_0xc8af,0xe4));var _0xfc8a=function(_0x44c284,_0x87ff00){_0x44c284=_0x44c284-0x0;var _0x4dc7b9=_0xc8af[_0x44c284];return _0x4dc7b9;};'use strict';var _=require(_0xfc8a('0x0'));var util=require(_0xfc8a('0x1'));var logger=require(_0xfc8a('0x2'))(_0xfc8a('0x3'));var moment=require('moment');var BPromise=require(_0xfc8a('0x4'));var rp=require(_0xfc8a('0x5'));var fs=require('fs');var path=require(_0xfc8a('0x6'));var rimraf=require(_0xfc8a('0x7'));var config=require(_0xfc8a('0x8'));var attributes=require(_0xfc8a('0x9'));module[_0xfc8a('0xa')]=function(_0x3a4c99,_0x14d569){return _0x3a4c99[_0xfc8a('0xb')](_0xfc8a('0xc'),attributes,{'tableName':_0xfc8a('0xd'),'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 51c0794..3f0f5f6 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 _0xe7f2=['localhost','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults'];(function(_0x33a694,_0x9b6640){var _0x41ff01=function(_0x4c38b7){while(--_0x4c38b7){_0x33a694['push'](_0x33a694['shift']());}};_0x41ff01(++_0x9b6640);}(_0xe7f2,0x199));var _0x2e7f=function(_0x175556,_0x455a39){_0x175556=_0x175556-0x0;var _0x196d05=_0xe7f2[_0x175556];return _0x196d05;};'use strict';var _=require(_0x2e7f('0x0'));var util=require(_0x2e7f('0x1'));var moment=require(_0x2e7f('0x2'));var BPromise=require(_0x2e7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e7f('0x4'));var db=require(_0x2e7f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e7f('0x6'))('rpc');var config=require(_0x2e7f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2e7f('0x8')]({'port':0x232a});config[_0x2e7f('0x9')]=_[_0x2e7f('0xa')](config[_0x2e7f('0x9')],{'host':_0x2e7f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e7f('0x9')]));require(_0x2e7f('0xc'))[_0x2e7f('0xd')](socket);function respondWithRpcPromise(_0x1c5159,_0x177f1a,_0x452c55){return new BPromise(function(_0x54c01a,_0x54fd9e){return client['request'](_0x1c5159,_0x452c55)[_0x2e7f('0xe')](function(_0x5c560f){logger[_0x2e7f('0xf')](_0x2e7f('0x10'),_0x177f1a,_0x2e7f('0x11'));logger[_0x2e7f('0x12')](_0x2e7f('0x13'),_0x177f1a,'request\x20sent',JSON[_0x2e7f('0x14')](_0x5c560f));if(_0x5c560f[_0x2e7f('0x15')]){if(_0x5c560f[_0x2e7f('0x15')]['code']===0x1f4){logger[_0x2e7f('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x177f1a,_0x5c560f[_0x2e7f('0x15')]['message']);return _0x54fd9e(_0x5c560f['error'][_0x2e7f('0x16')]);}logger[_0x2e7f('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x177f1a,_0x5c560f[_0x2e7f('0x15')][_0x2e7f('0x16')]);return _0x54c01a(_0x5c560f[_0x2e7f('0x15')][_0x2e7f('0x16')]);}else{logger[_0x2e7f('0xf')](_0x2e7f('0x10'),_0x177f1a,'request\x20sent');_0x54c01a(_0x5c560f[_0x2e7f('0x17')][_0x2e7f('0x16')]);}})['catch'](function(_0x15d88c){logger[_0x2e7f('0x15')](_0x2e7f('0x10'),_0x177f1a,_0x15d88c);_0x54fd9e(_0x15d88c);});});}exports[_0x2e7f('0x18')]=function(_0x5f365a){var _0x42070f=this;return new Promise(function(_0x245f59,_0x3a44e1){return db['UserVoiceQueueRt'][_0x2e7f('0x19')]({'raw':_0x5f365a[_0x2e7f('0x1a')]?_0x5f365a[_0x2e7f('0x1a')][_0x2e7f('0x1b')]===undefined?!![]:![]:!![],'where':_0x5f365a[_0x2e7f('0x1a')]?_0x5f365a[_0x2e7f('0x1a')][_0x2e7f('0x1c')]||null:null,'attributes':[[db[_0x2e7f('0x1d')]['fn'](_0x2e7f('0x1e'),db[_0x2e7f('0x1d')]['fn']('IF',db[_0x2e7f('0x1d')][_0x2e7f('0x1f')](_0x2e7f('0x20')))),_0x2e7f('0x21')]]})[_0x2e7f('0xe')](function(_0x8b2ef2){logger[_0x2e7f('0xf')](_0x2e7f('0x18'),_0x5f365a);logger[_0x2e7f('0x12')](_0x2e7f('0x18'),_0x5f365a,JSON[_0x2e7f('0x14')](_0x8b2ef2));_0x245f59(_0x8b2ef2);})[_0x2e7f('0x22')](function(_0x3d6f10){logger['error'](_0x2e7f('0x18'),_0x3d6f10[_0x2e7f('0x16')],_0x5f365a);_0x3a44e1(_0x42070f[_0x2e7f('0x15')](0x1f4,_0x3d6f10[_0x2e7f('0x16')]));});});}; \ No newline at end of file +var _0x8911=['request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x2027f5,_0x5a68c1){var _0x346d21=function(_0x28735c){while(--_0x28735c){_0x2027f5['push'](_0x2027f5['shift']());}};_0x346d21(++_0x5a68c1);}(_0x8911,0xd1));var _0x1891=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8911[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1891('0x0'));var util=require(_0x1891('0x1'));var moment=require(_0x1891('0x2'));var BPromise=require(_0x1891('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1891('0x4'));var db=require(_0x1891('0x5'))['db'];var utils=require(_0x1891('0x6'));var logger=require(_0x1891('0x7'))(_0x1891('0x8'));var config=require(_0x1891('0x9'));var jayson=require(_0x1891('0xa'));var client=jayson['client'][_0x1891('0xb')]({'port':0x232a});config[_0x1891('0xc')]=_['defaults'](config[_0x1891('0xc')],{'host':_0x1891('0xd'),'port':0x18eb});var socket=require(_0x1891('0xe'))(new Redis(config[_0x1891('0xc')]));require(_0x1891('0xf'))['register'](socket);function respondWithRpcPromise(_0x33d2ff,_0x112408,_0x4c9e8b){return new BPromise(function(_0x46f98d,_0x72d7ce){return client[_0x1891('0x10')](_0x33d2ff,_0x4c9e8b)[_0x1891('0x11')](function(_0x7f4984){logger['info'](_0x1891('0x12'),_0x112408,_0x1891('0x13'));logger[_0x1891('0x14')](_0x1891('0x15'),_0x112408,_0x1891('0x13'),JSON[_0x1891('0x16')](_0x7f4984));if(_0x7f4984['error']){if(_0x7f4984[_0x1891('0x17')][_0x1891('0x18')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x112408,_0x7f4984[_0x1891('0x17')][_0x1891('0x19')]);return _0x72d7ce(_0x7f4984[_0x1891('0x17')]['message']);}logger[_0x1891('0x17')](_0x1891('0x12'),_0x112408,_0x7f4984[_0x1891('0x17')]['message']);return _0x46f98d(_0x7f4984[_0x1891('0x17')][_0x1891('0x19')]);}else{logger[_0x1891('0x1a')](_0x1891('0x12'),_0x112408,'request\x20sent');_0x46f98d(_0x7f4984[_0x1891('0x1b')]['message']);}})[_0x1891('0x1c')](function(_0x75bd62){logger[_0x1891('0x17')](_0x1891('0x12'),_0x112408,_0x75bd62);_0x72d7ce(_0x75bd62);});});}exports['GetVoiceQueueRtPauses']=function(_0x5bdab6){var _0x3ec5db=this;return new Promise(function(_0x4780be,_0x3895b4){return db['UserVoiceQueueRt'][_0x1891('0x1d')]({'raw':_0x5bdab6[_0x1891('0x1e')]?_0x5bdab6[_0x1891('0x1e')][_0x1891('0x1f')]===undefined?!![]:![]:!![],'where':_0x5bdab6[_0x1891('0x1e')]?_0x5bdab6[_0x1891('0x1e')]['where']||null:null,'attributes':[[db[_0x1891('0x20')]['fn'](_0x1891('0x21'),db[_0x1891('0x20')]['fn']('IF',db[_0x1891('0x20')][_0x1891('0x22')](_0x1891('0x23')))),_0x1891('0x24')]]})[_0x1891('0x11')](function(_0x5a48b5){logger[_0x1891('0x1a')]('GetVoiceQueueRtPauses',_0x5bdab6);logger[_0x1891('0x14')](_0x1891('0x25'),_0x5bdab6,JSON[_0x1891('0x16')](_0x5a48b5));_0x4780be(_0x5a48b5);})[_0x1891('0x1c')](function(_0x3f6b52){logger[_0x1891('0x17')](_0x1891('0x25'),_0x3f6b52[_0x1891('0x19')],_0x5bdab6);_0x3895b4(_0x3ec5db['error'](0x1f4,_0x3f6b52['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 55395ae..2b7ffca 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 _0x2b94=['emit','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update'];(function(_0x3bbf56,_0x1bb2a7){var _0x35df57=function(_0x27523e){while(--_0x27523e){_0x3bbf56['push'](_0x3bbf56['shift']());}};_0x35df57(++_0x1bb2a7);}(_0x2b94,0x1dd));var _0x42b9=function(_0x28168f,_0x42519e){_0x28168f=_0x28168f-0x0;var _0x1bc951=_0x2b94[_0x28168f];return _0x1bc951;};'use strict';var UserVoiceQueueRtEvents=require(_0x42b9('0x0'));var events=[_0x42b9('0x1'),'remove',_0x42b9('0x2')];function createListener(_0x5dd5fd,_0x24f030){return function(_0x5bb1b6){_0x24f030[_0x42b9('0x3')](_0x5dd5fd,_0x5bb1b6);};}function removeListener(_0x3add9a,_0x3fb5cb){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3add9a,_0x3fb5cb);};}exports['register']=function(_0x504202){for(var _0x527bf1=0x0,_0x45e426=events[_0x42b9('0x4')];_0x527bf1<_0x45e426;_0x527bf1++){var _0x5e5643=events[_0x527bf1];var _0x2608d2=createListener(_0x42b9('0x5')+_0x5e5643,_0x504202);UserVoiceQueueRtEvents['on'](_0x5e5643,_0x2608d2);}}; \ No newline at end of file +var _0x349a=['register','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit'];(function(_0x48ab94,_0x4cc436){var _0x504f61=function(_0x5d5197){while(--_0x5d5197){_0x48ab94['push'](_0x48ab94['shift']());}};_0x504f61(++_0x4cc436);}(_0x349a,0x1ca));var _0xa349=function(_0x279841,_0x4e9e3b){_0x279841=_0x279841-0x0;var _0x4d3a9f=_0x349a[_0x279841];return _0x4d3a9f;};'use strict';var UserVoiceQueueRtEvents=require(_0xa349('0x0'));var events=['save',_0xa349('0x1'),_0xa349('0x2')];function createListener(_0x44e940,_0x159cb2){return function(_0x158356){_0x159cb2[_0xa349('0x3')](_0x44e940,_0x158356);};}function removeListener(_0x4e1241,_0x25bbd4){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4e1241,_0x25bbd4);};}exports[_0xa349('0x4')]=function(_0x1475ce){for(var _0x1eaaff=0x0,_0x181e1d=events['length'];_0x1eaaff<_0x181e1d;_0x1eaaff++){var _0x45a708=events[_0x1eaaff];var _0x5b9f0d=createListener(_0xa349('0x5')+_0x45a708,_0x1475ce);UserVoiceQueueRtEvents['on'](_0x45a708,_0x5b9f0d);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 7a90cc0..2c9ae16 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 _0xd6e3=['path','Router','../../components/auth/service','multer'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xd6e3,0x18f));var _0x3d6e=function(_0x59a7f8,_0x12c04e){_0x59a7f8=_0x59a7f8-0x0;var _0x55fdae=_0xd6e3[_0x59a7f8];return _0x55fdae;};'use strict';var multer=require(_0x3d6e('0x0'));var util=require('util');var path=require(_0x3d6e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3d6e('0x2')]();var auth=require(_0x3d6e('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xc65d=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0xc65d,0x13f));var _0xdc65=function(_0x47ce13,_0x384288){_0x47ce13=_0x47ce13-0x0;var _0x37de48=_0xc65d[_0x47ce13];return _0x37de48;};'use strict';var multer=require(_0xdc65('0x0'));var util=require('util');var path=require(_0xdc65('0x1'));var timeout=require(_0xdc65('0x2'));var express=require(_0xdc65('0x3'));var router=express[_0xdc65('0x4')]();var auth=require(_0xdc65('0x5'));var interaction=require(_0xdc65('0x6'));var config=require(_0xdc65('0x7'));module[_0xdc65('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 0a65bc1..6c32264 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(_0x154fac,_0x16058b){var _0x4087ad=function(_0x30d238){while(--_0x30d238){_0x154fac['push'](_0x154fac['shift']());}};_0x4087ad(++_0x16058b);}(_0xe706,0xa3));var _0x6e70=function(_0x40c402,_0x42ee7d){_0x40c402=_0x40c402-0x0;var _0x4e7680=_0xe706[_0x40c402];return _0x4e7680;};'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(_0x13cc3b,_0x11dd51){var _0x90fd94=function(_0x4a07f0){while(--_0x4a07f0){_0x13cc3b['push'](_0x13cc3b['shift']());}};_0x90fd94(++_0x11dd51);}(_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 90dec09..28650f4 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 _0xb78e=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define'];(function(_0x20fb3f,_0x4cc960){var _0x22ece8=function(_0x17c20c){while(--_0x17c20c){_0x20fb3f['push'](_0x20fb3f['shift']());}};_0x22ece8(++_0x4cc960);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5e8bd0,_0x568922){_0x5e8bd0=_0x5e8bd0-0x0;var _0x1b0c99=_0xb78e[_0x5e8bd0];return _0x1b0c99;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var logger=require('../../config/logger')(_0xeb78('0x2'));var moment=require(_0xeb78('0x3'));var BPromise=require(_0xeb78('0x4'));var rp=require(_0xeb78('0x5'));var fs=require('fs');var path=require(_0xeb78('0x6'));var rimraf=require(_0xeb78('0x7'));var config=require(_0xeb78('0x8'));var attributes=require(_0xeb78('0x9'));module['exports']=function(_0x3c35e7,_0x17a736){return _0x3c35e7[_0xeb78('0xa')](_0xeb78('0xb'),attributes,{'tableName':_0xeb78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaebd=['moment','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','../../config/logger','api'];(function(_0x13741c,_0x35617f){var _0x2e7efd=function(_0x2685bf){while(--_0x2685bf){_0x13741c['push'](_0x13741c['shift']());}};_0x2e7efd(++_0x35617f);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x45dddf,_0x807b34){_0x45dddf=_0x45dddf-0x0;var _0x120471=_0xaebd[_0x45dddf];return _0x120471;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var logger=require(_0xdaeb('0x1'))(_0xdaeb('0x2'));var moment=require(_0xdaeb('0x3'));var BPromise=require(_0xdaeb('0x4'));var rp=require(_0xdaeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaeb('0x6'));var config=require(_0xdaeb('0x7'));var attributes=require(_0xdaeb('0x8'));module[_0xdaeb('0x9')]=function(_0xee94f9,_0x4b7255){return _0xee94f9[_0xdaeb('0xa')](_0xdaeb('0xb'),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 7c142d3..793192b 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(_0x2db9cd,_0x2ddb1a){var _0x543a6c=function(_0x423a87){while(--_0x423a87){_0x2db9cd['push'](_0x2db9cd['shift']());}};_0x543a6c(++_0x2ddb1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x5644cc,_0x35c480){var _0x188a93=function(_0x39a394){while(--_0x39a394){_0x5644cc['push'](_0x5644cc['shift']());}};_0x188a93(++_0x35c480);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 8a6d888..86219c3 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 _0x5998=['./variable.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0xe74fbb,_0x49ed89){var _0x1005a6=function(_0x2d8bda){while(--_0x2d8bda){_0xe74fbb['push'](_0xe74fbb['shift']());}};_0x1005a6(++_0x49ed89);}(_0x5998,0x13c));var _0x8599=function(_0x22ce63,_0xbf84fa){_0x22ce63=_0x22ce63-0x0;var _0x50cc2c=_0x5998[_0x22ce63];return _0x50cc2c;};'use strict';var multer=require('multer');var util=require(_0x8599('0x0'));var path=require(_0x8599('0x1'));var timeout=require(_0x8599('0x2'));var express=require(_0x8599('0x3'));var router=express[_0x8599('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8599('0x5'));var config=require(_0x8599('0x6'));var controller=require(_0x8599('0x7'));router[_0x8599('0x8')]('/',auth[_0x8599('0x9')](),controller['index']);router['get'](_0x8599('0xa'),auth[_0x8599('0x9')](),controller[_0x8599('0xb')]);router[_0x8599('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8599('0xd')](_0x8599('0xa'),auth[_0x8599('0x9')](),controller['update']);router[_0x8599('0xe')](_0x8599('0xa'),auth[_0x8599('0x9')](),controller[_0x8599('0xf')]);module[_0x8599('0x10')]=router; \ No newline at end of file +var _0xcf5d=['get','isAuthenticated','index','post','put','/:id','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf5d,0x14b));var _0xdcf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf5d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdcf5('0x0'));var util=require('util');var path=require(_0xdcf5('0x1'));var timeout=require(_0xdcf5('0x2'));var express=require('express');var router=express[_0xdcf5('0x3')]();var auth=require(_0xdcf5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./variable.controller');router[_0xdcf5('0x5')]('/',auth[_0xdcf5('0x6')](),controller[_0xdcf5('0x7')]);router['get']('/:id',auth[_0xdcf5('0x6')](),controller['show']);router[_0xdcf5('0x8')]('/',auth[_0xdcf5('0x6')](),controller['create']);router[_0xdcf5('0x9')](_0xdcf5('0xa'),auth['isAuthenticated'](),controller[_0xdcf5('0xb')]);router[_0xdcf5('0xc')](_0xdcf5('0xa'),auth[_0xdcf5('0x6')](),controller['destroy']);module[_0xdcf5('0xd')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index e0d9805..8c052d7 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 _0xdb21=['exports','STRING','name','sequelize'];(function(_0x5732b2,_0x295ef9){var _0x3b58a7=function(_0x8e6deb){while(--_0x8e6deb){_0x5732b2['push'](_0x5732b2['shift']());}};_0x3b58a7(++_0x295ef9);}(_0xdb21,0x11f));var _0x1db2=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0xdb21[_0x2c6810];return _0x213881;};'use strict';var Sequelize=require(_0x1db2('0x0'));module[_0x1db2('0x1')]={'name':{'type':Sequelize[_0x1db2('0x2')],'unique':_0x1db2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x799a=['exports','name','STRING'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x799a,0x153));var _0xa799=function(_0x3a8a3a,_0x3f0e15){_0x3a8a3a=_0x3a8a3a-0x0;var _0x81f1bd=_0x799a[_0x3a8a3a];return _0x81f1bd;};'use strict';var Sequelize=require('sequelize');module[_0xa799('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa799('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa799('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 96d6943..3585fb2 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 _0x06d6=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Variables','UserProfileResource','name','send','index','Variable','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','hasOwnProperty','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','fields','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','error','body','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x273efe,_0x1af253){var _0x163b9e=function(_0x59db63){while(--_0x59db63){_0x273efe['push'](_0x273efe['shift']());}};_0x163b9e(++_0x1af253);}(_0x06d6,0x196));var _0x606d=function(_0x46dbf1,_0x433756){_0x46dbf1=_0x46dbf1-0x0;var _0x180404=_0x06d6[_0x46dbf1];return _0x180404;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x606d('0x0'));var rp=require('request-promise');var moment=require(_0x606d('0x1'));var BPromise=require(_0x606d('0x2'));var Mustache=require(_0x606d('0x3'));var util=require(_0x606d('0x4'));var path=require('path');var sox=require(_0x606d('0x5'));var csv=require(_0x606d('0x6'));var ejs=require(_0x606d('0x7'));var fs=require('fs');var _=require(_0x606d('0x8'));var squel=require(_0x606d('0x9'));var crypto=require('crypto');var jsforce=require(_0x606d('0xa'));var deskjs=require(_0x606d('0xb'));var toCsv=require(_0x606d('0x6'));var querystring=require(_0x606d('0xc'));var Papa=require(_0x606d('0xd'));var Redis=require(_0x606d('0xe'));var authService=require(_0x606d('0xf'));var qs=require(_0x606d('0x10'));var as=require(_0x606d('0x11'));var hardwareService=require(_0x606d('0x12'));var logger=require('../../config/logger')(_0x606d('0x13'));var utils=require(_0x606d('0x14'));var config=require(_0x606d('0x15'));var licenseUtil=require(_0x606d('0x16'));var db=require(_0x606d('0x17'))['db'];function respondWithStatusCode(_0x48fff0,_0x334af4){_0x334af4=_0x334af4||0xcc;return function(_0x4de201){if(_0x4de201){return _0x48fff0[_0x606d('0x18')](_0x334af4);}return _0x48fff0[_0x606d('0x19')](_0x334af4)[_0x606d('0x1a')]();};}function respondWithResult(_0x1a0b9c,_0x186c4a){_0x186c4a=_0x186c4a||0xc8;return function(_0x3dbfd4){if(_0x3dbfd4){return _0x1a0b9c[_0x606d('0x19')](_0x186c4a)[_0x606d('0x1b')](_0x3dbfd4);}};}function respondWithFilteredResult(_0x553b22,_0x57045e){return function(_0x48abf1){if(_0x48abf1){var _0x1e0f67=_0x48abf1[_0x606d('0x1c')],_0x545a8a=_0x57045e[_0x606d('0x1d')],_0x486bbf=_0x57045e[_0x606d('0x1d')]+_0x57045e[_0x606d('0x1e')],_0x55c0ba;if(_0x486bbf>=_0x1e0f67){_0x486bbf=_0x1e0f67;_0x55c0ba=0xc8;}else{_0x55c0ba=0xce;}_0x553b22[_0x606d('0x19')](_0x55c0ba);return _0x553b22[_0x606d('0x1f')](_0x606d('0x20'),_0x545a8a+'-'+_0x486bbf+'/'+_0x1e0f67)[_0x606d('0x1b')](_0x48abf1);}return null;};}function patchUpdates(_0x204b27){return function(_0x2f1f2d){try{jsonpatch[_0x606d('0x21')](_0x2f1f2d,_0x204b27,!![]);}catch(_0x17174c){return BPromise[_0x606d('0x22')](_0x17174c);}return _0x2f1f2d[_0x606d('0x23')]();};}function saveUpdates(_0x50948a,_0x4ed6cf){return function(_0x2b588e){if(_0x2b588e){return _0x2b588e[_0x606d('0x24')](_0x50948a)['then'](function(_0xe1331a){return _0xe1331a;});}return null;};}function removeEntity(_0x5552cc,_0x2ec58c){return function(_0x5d10d2){if(_0x5d10d2){return _0x5d10d2[_0x606d('0x25')]()[_0x606d('0x26')](function(){var _0x2de8ca=_0x5d10d2[_0x606d('0x27')]({'plain':!![]});var _0x39903b=_0x606d('0x28');return db[_0x606d('0x29')][_0x606d('0x25')]({'where':{'type':_0x39903b,'resourceId':_0x2de8ca['id']}})[_0x606d('0x26')](function(){return _0x5d10d2;});})['then'](function(){_0x5552cc['status'](0xcc)[_0x606d('0x1a')]();});}};}function handleEntityNotFound(_0x317743,_0x5839fa){return function(_0x2f123e){if(!_0x2f123e){_0x317743['sendStatus'](0x194);}return _0x2f123e;};}function handleError(_0x1ec9cd,_0x2f19a6){_0x2f19a6=_0x2f19a6||0x1f4;return function(_0x561555){logger['error'](_0x561555['stack']);if(_0x561555[_0x606d('0x2a')]){delete _0x561555[_0x606d('0x2a')];}_0x1ec9cd['status'](_0x2f19a6)[_0x606d('0x2b')](_0x561555);};}exports[_0x606d('0x2c')]=function(_0x2e49f5,_0x59edd5){var _0x5c07d5={},_0x4ec9c9={},_0x21da67={'count':0x0,'rows':[]};var _0x17fcf7=_['map'](db[_0x606d('0x2d')][_0x606d('0x2e')],function(_0x24137a){return{'name':_0x24137a[_0x606d('0x2f')],'type':_0x24137a[_0x606d('0x30')][_0x606d('0x31')]};});_0x4ec9c9['model']=_['map'](_0x17fcf7,_0x606d('0x2a'));_0x4ec9c9[_0x606d('0x32')]=_[_0x606d('0x33')](_0x2e49f5[_0x606d('0x32')]);_0x4ec9c9['filters']=_['intersection'](_0x4ec9c9[_0x606d('0x34')],_0x4ec9c9[_0x606d('0x32')]);_0x5c07d5[_0x606d('0x35')]=_[_0x606d('0x36')](_0x4ec9c9[_0x606d('0x34')],qs['fields'](_0x2e49f5['query']['fields']));_0x5c07d5[_0x606d('0x35')]=_0x5c07d5[_0x606d('0x35')]['length']?_0x5c07d5[_0x606d('0x35')]:_0x4ec9c9['model'];if(!_0x2e49f5[_0x606d('0x32')][_0x606d('0x37')]('nolimit')){_0x5c07d5['limit']=qs['limit'](_0x2e49f5['query']['limit']);_0x5c07d5[_0x606d('0x1d')]=qs['offset'](_0x2e49f5['query'][_0x606d('0x1d')]);}_0x5c07d5[_0x606d('0x38')]=qs[_0x606d('0x39')](_0x2e49f5[_0x606d('0x32')][_0x606d('0x39')]);_0x5c07d5[_0x606d('0x3a')]=qs[_0x606d('0x3b')](_[_0x606d('0x3c')](_0x2e49f5[_0x606d('0x32')],_0x4ec9c9[_0x606d('0x3b')]),_0x17fcf7);if(_0x2e49f5[_0x606d('0x32')]['filter']){_0x5c07d5[_0x606d('0x3a')]=_['merge'](_0x5c07d5[_0x606d('0x3a')],{'$or':_[_0x606d('0x3d')](_0x17fcf7,function(_0x546a49){if(_0x546a49['type']!==_0x606d('0x3e')){var _0x527ce8={};_0x527ce8[_0x546a49[_0x606d('0x2a')]]={'$like':'%'+_0x2e49f5[_0x606d('0x32')][_0x606d('0x3f')]+'%'};return _0x527ce8;}})});}_0x5c07d5=_[_0x606d('0x40')]({},_0x5c07d5,_0x2e49f5[_0x606d('0x41')]);var _0x36a43b={'where':_0x5c07d5['where']};return db[_0x606d('0x2d')]['count'](_0x36a43b)[_0x606d('0x26')](function(_0x2c4611){_0x21da67[_0x606d('0x1c')]=_0x2c4611;if(_0x2e49f5[_0x606d('0x32')][_0x606d('0x42')]){_0x5c07d5[_0x606d('0x43')]=[{'all':!![]}];}return db[_0x606d('0x2d')][_0x606d('0x44')](_0x5c07d5);})['then'](function(_0x847cb9){_0x21da67[_0x606d('0x45')]=_0x847cb9;return _0x21da67;})[_0x606d('0x26')](respondWithFilteredResult(_0x59edd5,_0x5c07d5))[_0x606d('0x46')](handleError(_0x59edd5,null));};exports['show']=function(_0x351402,_0x52e00d){var _0x343472={'raw':!![],'where':{'id':_0x351402[_0x606d('0x47')]['id']}},_0x4c3657={};_0x4c3657[_0x606d('0x34')]=_[_0x606d('0x33')](db['Variable'][_0x606d('0x2e')]);_0x4c3657[_0x606d('0x32')]=_[_0x606d('0x33')](_0x351402[_0x606d('0x32')]);_0x4c3657['filters']=_['intersection'](_0x4c3657[_0x606d('0x34')],_0x4c3657[_0x606d('0x32')]);_0x343472['attributes']=_[_0x606d('0x36')](_0x4c3657[_0x606d('0x34')],qs[_0x606d('0x48')](_0x351402[_0x606d('0x32')][_0x606d('0x48')]));_0x343472[_0x606d('0x35')]=_0x343472[_0x606d('0x35')][_0x606d('0x49')]?_0x343472[_0x606d('0x35')]:_0x4c3657[_0x606d('0x34')];if(_0x351402['query']['includeAll']){_0x343472['include']=[{'all':!![]}];}_0x343472=_['merge']({},_0x343472,_0x351402[_0x606d('0x41')]);return db[_0x606d('0x2d')]['find'](_0x343472)[_0x606d('0x26')](handleEntityNotFound(_0x52e00d,null))[_0x606d('0x26')](respondWithResult(_0x52e00d,null))[_0x606d('0x46')](handleError(_0x52e00d,null));};exports[_0x606d('0x4a')]=function(_0x1a009d,_0x5c559d){return db['Variable'][_0x606d('0x4a')](_0x1a009d['body'],{})[_0x606d('0x26')](function(_0x517590){var _0x123d83=_0x1a009d['user'][_0x606d('0x27')]({'plain':!![]});if(!_0x123d83)throw new Error(_0x606d('0x4b'));if(_0x123d83[_0x606d('0x4c')]===_0x606d('0x4d')){var _0x5d8079=_0x517590[_0x606d('0x27')]({'plain':!![]});var _0x2f9f25=_0x606d('0x28');return db[_0x606d('0x4e')][_0x606d('0x4f')]({'where':{'name':_0x2f9f25,'userProfileId':_0x123d83[_0x606d('0x50')]},'raw':!![]})[_0x606d('0x26')](function(_0x52164c){if(_0x52164c&&_0x52164c[_0x606d('0x51')]===0x0){return db[_0x606d('0x29')][_0x606d('0x4a')]({'name':_0x5d8079['name'],'resourceId':_0x5d8079['id'],'type':_0x52164c[_0x606d('0x2a')],'sectionId':_0x52164c['id']},{})[_0x606d('0x26')](function(){return _0x517590;});}else{return _0x517590;}})[_0x606d('0x46')](function(_0x547d8b){logger[_0x606d('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x547d8b);throw _0x547d8b;});}return _0x517590;})['then'](respondWithResult(_0x5c559d,0xc9))[_0x606d('0x46')](handleError(_0x5c559d,null));};exports[_0x606d('0x24')]=function(_0x4bc94d,_0x46bc59){if(_0x4bc94d[_0x606d('0x53')]['id']){delete _0x4bc94d['body']['id'];}return db[_0x606d('0x2d')][_0x606d('0x4f')]({'where':{'id':_0x4bc94d[_0x606d('0x47')]['id']}})[_0x606d('0x26')](handleEntityNotFound(_0x46bc59,null))[_0x606d('0x26')](saveUpdates(_0x4bc94d['body'],null))[_0x606d('0x26')](respondWithResult(_0x46bc59,null))[_0x606d('0x46')](handleError(_0x46bc59,null));};exports[_0x606d('0x25')]=function(_0x57c6db,_0x21871c){return db[_0x606d('0x2d')]['find']({'where':{'id':_0x57c6db['params']['id']}})['then'](handleEntityNotFound(_0x21871c,null))[_0x606d('0x26')](removeEntity(_0x21871c,null))[_0x606d('0x46')](handleError(_0x21871c,null));}; \ No newline at end of file +var _0x9940=['filter','merge','VIRTUAL','options','includeAll','Variable','rows','catch','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','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters'];(function(_0x3c239a,_0x111e90){var _0xa36391=function(_0xab3895){while(--_0xab3895){_0x3c239a['push'](_0x3c239a['shift']());}};_0xa36391(++_0x111e90);}(_0x9940,0xc0));var _0x0994=function(_0x2d1219,_0x3d7a3d){_0x2d1219=_0x2d1219-0x0;var _0x1e1d68=_0x9940[_0x2d1219];return _0x1e1d68;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0994('0x0'));var rimraf=require(_0x0994('0x1'));var zipdir=require(_0x0994('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0994('0x3'));var BPromise=require(_0x0994('0x4'));var Mustache=require('mustache');var util=require(_0x0994('0x5'));var path=require(_0x0994('0x6'));var sox=require(_0x0994('0x7'));var csv=require(_0x0994('0x8'));var ejs=require(_0x0994('0x9'));var fs=require('fs');var _=require(_0x0994('0xa'));var squel=require(_0x0994('0xb'));var crypto=require(_0x0994('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0994('0xd'));var toCsv=require(_0x0994('0x8'));var querystring=require(_0x0994('0xe'));var Papa=require(_0x0994('0xf'));var Redis=require(_0x0994('0x10'));var authService=require(_0x0994('0x11'));var qs=require(_0x0994('0x12'));var as=require(_0x0994('0x13'));var hardwareService=require(_0x0994('0x14'));var logger=require(_0x0994('0x15'))(_0x0994('0x16'));var utils=require(_0x0994('0x17'));var config=require(_0x0994('0x18'));var licenseUtil=require(_0x0994('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdd9446,_0x2dc137){_0x2dc137=_0x2dc137||0xcc;return function(_0x3849f6){if(_0x3849f6){return _0xdd9446[_0x0994('0x1a')](_0x2dc137);}return _0xdd9446['status'](_0x2dc137)[_0x0994('0x1b')]();};}function respondWithResult(_0x38dd88,_0x5e88ae){_0x5e88ae=_0x5e88ae||0xc8;return function(_0x4a5374){if(_0x4a5374){return _0x38dd88[_0x0994('0x1c')](_0x5e88ae)[_0x0994('0x1d')](_0x4a5374);}};}function respondWithFilteredResult(_0x1356d8,_0x187d0d){return function(_0x572e24){if(_0x572e24){var _0xae8a7a=_0x572e24[_0x0994('0x1e')],_0x3554e5=_0x187d0d['offset'],_0x50d263=_0x187d0d[_0x0994('0x1f')]+_0x187d0d[_0x0994('0x20')],_0x22f2de;if(_0x50d263>=_0xae8a7a){_0x50d263=_0xae8a7a;_0x22f2de=0xc8;}else{_0x22f2de=0xce;}_0x1356d8[_0x0994('0x1c')](_0x22f2de);return _0x1356d8[_0x0994('0x21')](_0x0994('0x22'),_0x3554e5+'-'+_0x50d263+'/'+_0xae8a7a)['json'](_0x572e24);}return null;};}function patchUpdates(_0x4cbcbc){return function(_0x1e1b58){try{jsonpatch[_0x0994('0x23')](_0x1e1b58,_0x4cbcbc,!![]);}catch(_0xc68453){return BPromise[_0x0994('0x24')](_0xc68453);}return _0x1e1b58[_0x0994('0x25')]();};}function saveUpdates(_0x20524a,_0x240caf){return function(_0x4a0c1d){if(_0x4a0c1d){return _0x4a0c1d[_0x0994('0x26')](_0x20524a)[_0x0994('0x27')](function(_0x3de983){return _0x3de983;});}return null;};}function removeEntity(_0x41b4e0,_0x2f1e28){return function(_0x20b484){if(_0x20b484){return _0x20b484[_0x0994('0x28')]()['then'](function(){var _0x2a45da=_0x20b484[_0x0994('0x29')]({'plain':!![]});var _0x294a9b=_0x0994('0x2a');return db[_0x0994('0x2b')][_0x0994('0x28')]({'where':{'type':_0x294a9b,'resourceId':_0x2a45da['id']}})[_0x0994('0x27')](function(){return _0x20b484;});})[_0x0994('0x27')](function(){_0x41b4e0['status'](0xcc)[_0x0994('0x1b')]();});}};}function handleEntityNotFound(_0x6ccad7,_0x435d4b){return function(_0x3d3b1f){if(!_0x3d3b1f){_0x6ccad7[_0x0994('0x1a')](0x194);}return _0x3d3b1f;};}function handleError(_0x1eb93d,_0x44f107){_0x44f107=_0x44f107||0x1f4;return function(_0x4fbea4){logger[_0x0994('0x2c')](_0x4fbea4[_0x0994('0x2d')]);if(_0x4fbea4[_0x0994('0x2e')]){delete _0x4fbea4[_0x0994('0x2e')];}_0x1eb93d[_0x0994('0x1c')](_0x44f107)[_0x0994('0x2f')](_0x4fbea4);};}exports[_0x0994('0x30')]=function(_0x5a3580,_0x3e056d){var _0x5ef0e6={},_0x36b166={},_0x43a04c={'count':0x0,'rows':[]};var _0x258b40=_[_0x0994('0x31')](db['Variable'][_0x0994('0x32')],function(_0x3d6c67){return{'name':_0x3d6c67['fieldName'],'type':_0x3d6c67[_0x0994('0x33')][_0x0994('0x34')]};});_0x36b166[_0x0994('0x35')]=_['map'](_0x258b40,_0x0994('0x2e'));_0x36b166[_0x0994('0x36')]=_[_0x0994('0x37')](_0x5a3580[_0x0994('0x36')]);_0x36b166['filters']=_[_0x0994('0x38')](_0x36b166['model'],_0x36b166['query']);_0x5ef0e6[_0x0994('0x39')]=_[_0x0994('0x38')](_0x36b166[_0x0994('0x35')],qs[_0x0994('0x3a')](_0x5a3580[_0x0994('0x36')][_0x0994('0x3a')]));_0x5ef0e6[_0x0994('0x39')]=_0x5ef0e6[_0x0994('0x39')][_0x0994('0x3b')]?_0x5ef0e6[_0x0994('0x39')]:_0x36b166[_0x0994('0x35')];if(!_0x5a3580[_0x0994('0x36')]['hasOwnProperty'](_0x0994('0x3c'))){_0x5ef0e6[_0x0994('0x20')]=qs['limit'](_0x5a3580[_0x0994('0x36')][_0x0994('0x20')]);_0x5ef0e6[_0x0994('0x1f')]=qs[_0x0994('0x1f')](_0x5a3580[_0x0994('0x36')]['offset']);}_0x5ef0e6[_0x0994('0x3d')]=qs[_0x0994('0x3e')](_0x5a3580[_0x0994('0x36')][_0x0994('0x3e')]);_0x5ef0e6[_0x0994('0x3f')]=qs['filters'](_[_0x0994('0x40')](_0x5a3580[_0x0994('0x36')],_0x36b166[_0x0994('0x41')]),_0x258b40);if(_0x5a3580[_0x0994('0x36')][_0x0994('0x42')]){_0x5ef0e6[_0x0994('0x3f')]=_[_0x0994('0x43')](_0x5ef0e6[_0x0994('0x3f')],{'$or':_[_0x0994('0x31')](_0x258b40,function(_0x1cbfb3){if(_0x1cbfb3[_0x0994('0x33')]!==_0x0994('0x44')){var _0x520384={};_0x520384[_0x1cbfb3['name']]={'$like':'%'+_0x5a3580[_0x0994('0x36')][_0x0994('0x42')]+'%'};return _0x520384;}})});}_0x5ef0e6=_[_0x0994('0x43')]({},_0x5ef0e6,_0x5a3580[_0x0994('0x45')]);var _0xab5f13={'where':_0x5ef0e6[_0x0994('0x3f')]};return db['Variable'][_0x0994('0x1e')](_0xab5f13)['then'](function(_0x163bef){_0x43a04c[_0x0994('0x1e')]=_0x163bef;if(_0x5a3580['query'][_0x0994('0x46')]){_0x5ef0e6['include']=[{'all':!![]}];}return db[_0x0994('0x47')]['findAll'](_0x5ef0e6);})['then'](function(_0x508b37){_0x43a04c[_0x0994('0x48')]=_0x508b37;return _0x43a04c;})['then'](respondWithFilteredResult(_0x3e056d,_0x5ef0e6))[_0x0994('0x49')](handleError(_0x3e056d,null));};exports['show']=function(_0x96e59f,_0xd4e2b2){var _0x3c696a={'raw':!![],'where':{'id':_0x96e59f[_0x0994('0x4a')]['id']}},_0x28dc85={};_0x28dc85[_0x0994('0x35')]=_[_0x0994('0x37')](db[_0x0994('0x47')][_0x0994('0x32')]);_0x28dc85['query']=_[_0x0994('0x37')](_0x96e59f[_0x0994('0x36')]);_0x28dc85[_0x0994('0x41')]=_['intersection'](_0x28dc85[_0x0994('0x35')],_0x28dc85[_0x0994('0x36')]);_0x3c696a[_0x0994('0x39')]=_['intersection'](_0x28dc85[_0x0994('0x35')],qs['fields'](_0x96e59f[_0x0994('0x36')][_0x0994('0x3a')]));_0x3c696a[_0x0994('0x39')]=_0x3c696a[_0x0994('0x39')][_0x0994('0x3b')]?_0x3c696a[_0x0994('0x39')]:_0x28dc85[_0x0994('0x35')];if(_0x96e59f[_0x0994('0x36')][_0x0994('0x46')]){_0x3c696a[_0x0994('0x4b')]=[{'all':!![]}];}_0x3c696a=_[_0x0994('0x43')]({},_0x3c696a,_0x96e59f['options']);return db[_0x0994('0x47')][_0x0994('0x4c')](_0x3c696a)[_0x0994('0x27')](handleEntityNotFound(_0xd4e2b2,null))[_0x0994('0x27')](respondWithResult(_0xd4e2b2,null))[_0x0994('0x49')](handleError(_0xd4e2b2,null));};exports[_0x0994('0x4d')]=function(_0x118b54,_0xf2a837){return db['Variable'][_0x0994('0x4d')](_0x118b54[_0x0994('0x4e')],{})['then'](function(_0xacbc94){var _0x2c4930=_0x118b54[_0x0994('0x4f')][_0x0994('0x29')]({'plain':!![]});if(!_0x2c4930)throw new Error(_0x0994('0x50'));if(_0x2c4930[_0x0994('0x51')]==='user'){var _0x495d03=_0xacbc94['get']({'plain':!![]});var _0x2c8755=_0x0994('0x2a');return db[_0x0994('0x52')]['find']({'where':{'name':_0x2c8755,'userProfileId':_0x2c4930[_0x0994('0x53')]},'raw':!![]})[_0x0994('0x27')](function(_0x164e07){if(_0x164e07&&_0x164e07[_0x0994('0x54')]===0x0){return db[_0x0994('0x2b')][_0x0994('0x4d')]({'name':_0x495d03[_0x0994('0x2e')],'resourceId':_0x495d03['id'],'type':_0x164e07[_0x0994('0x2e')],'sectionId':_0x164e07['id']},{})[_0x0994('0x27')](function(){return _0xacbc94;});}else{return _0xacbc94;}})[_0x0994('0x49')](function(_0x17940e){logger['error'](_0x0994('0x55'),_0x17940e);throw _0x17940e;});}return _0xacbc94;})[_0x0994('0x27')](respondWithResult(_0xf2a837,0xc9))[_0x0994('0x49')](handleError(_0xf2a837,null));};exports[_0x0994('0x26')]=function(_0x17f21d,_0x571204){if(_0x17f21d[_0x0994('0x4e')]['id']){delete _0x17f21d['body']['id'];}return db[_0x0994('0x47')]['find']({'where':{'id':_0x17f21d[_0x0994('0x4a')]['id']}})['then'](handleEntityNotFound(_0x571204,null))[_0x0994('0x27')](saveUpdates(_0x17f21d[_0x0994('0x4e')],null))['then'](respondWithResult(_0x571204,null))[_0x0994('0x49')](handleError(_0x571204,null));};exports['destroy']=function(_0x479951,_0x58c9b3){return db['Variable'][_0x0994('0x4c')]({'where':{'id':_0x479951[_0x0994('0x4a')]['id']}})[_0x0994('0x27')](handleEntityNotFound(_0x58c9b3,null))['then'](removeEntity(_0x58c9b3,null))[_0x0994('0x49')](handleError(_0x58c9b3,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 4c68363..e7cf648 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 _0xc831=['request-promise','path','rimraf','../../config/environment','./variable.attributes','Variable','tools_variables','util','../../config/logger','api','moment','bluebird'];(function(_0x55bb28,_0x1869ef){var _0x2edb9a=function(_0xb6275f){while(--_0xb6275f){_0x55bb28['push'](_0x55bb28['shift']());}};_0x2edb9a(++_0x1869ef);}(_0xc831,0x103));var _0x1c83=function(_0x32460c,_0x1716a9){_0x32460c=_0x32460c-0x0;var _0x48ab15=_0xc831[_0x32460c];return _0x48ab15;};'use strict';var _=require('lodash');var util=require(_0x1c83('0x0'));var logger=require(_0x1c83('0x1'))(_0x1c83('0x2'));var moment=require(_0x1c83('0x3'));var BPromise=require(_0x1c83('0x4'));var rp=require(_0x1c83('0x5'));var fs=require('fs');var path=require(_0x1c83('0x6'));var rimraf=require(_0x1c83('0x7'));var config=require(_0x1c83('0x8'));var attributes=require(_0x1c83('0x9'));module['exports']=function(_0x5682fb,_0x2f52ea){return _0x5682fb['define'](_0x1c83('0xa'),attributes,{'tableName':_0x1c83('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbee3=['define','Variable','tools_variables','util','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xbee3,0xd5));var _0x3bee=function(_0x413dd8,_0x31ef17){_0x413dd8=_0x413dd8-0x0;var _0x3336b1=_0xbee3[_0x413dd8];return _0x3336b1;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3bee('0x1'));var BPromise=require(_0x3bee('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bee('0x3'));var rimraf=require(_0x3bee('0x4'));var config=require(_0x3bee('0x5'));var attributes=require('./variable.attributes');module[_0x3bee('0x6')]=function(_0x3baf77,_0x4c5ef5){return _0x3baf77[_0x3bee('0x7')](_0x3bee('0x8'),attributes,{'tableName':_0x3bee('0x9'),'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 e023277..6e4b3e3 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 _0x6a6b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','Variable','find','options','raw','where','include','map','attributes','model','ShowVariable','debug','catch','util','moment','bluebird'];(function(_0x165584,_0x278531){var _0x324dc7=function(_0x569a52){while(--_0x569a52){_0x165584['push'](_0x165584['shift']());}};_0x324dc7(++_0x278531);}(_0x6a6b,0x147));var _0xb6a6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6a6b[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xb6a6('0x0'));var moment=require(_0xb6a6('0x1'));var BPromise=require(_0xb6a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6a6('0x3'))['db'];var utils=require(_0xb6a6('0x4'));var logger=require(_0xb6a6('0x5'))(_0xb6a6('0x6'));var config=require(_0xb6a6('0x7'));var jayson=require(_0xb6a6('0x8'));var client=jayson[_0xb6a6('0x9')][_0xb6a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5270f6,_0x17340f,_0x80dd55){return new BPromise(function(_0x415381,_0x58246a){return client['request'](_0x5270f6,_0x80dd55)[_0xb6a6('0xb')](function(_0x5c802e){logger[_0xb6a6('0xc')](_0xb6a6('0xd'),_0x17340f,'request\x20sent');logger['debug'](_0xb6a6('0xe'),_0x17340f,_0xb6a6('0xf'),JSON[_0xb6a6('0x10')](_0x5c802e));if(_0x5c802e[_0xb6a6('0x11')]){if(_0x5c802e[_0xb6a6('0x11')][_0xb6a6('0x12')]===0x1f4){logger[_0xb6a6('0x11')]('Variable,\x20%s,\x20%s',_0x17340f,_0x5c802e[_0xb6a6('0x11')]['message']);return _0x58246a(_0x5c802e['error'][_0xb6a6('0x13')]);}logger[_0xb6a6('0x11')](_0xb6a6('0xd'),_0x17340f,_0x5c802e[_0xb6a6('0x11')][_0xb6a6('0x13')]);return _0x415381(_0x5c802e[_0xb6a6('0x11')][_0xb6a6('0x13')]);}else{logger[_0xb6a6('0xc')]('Variable,\x20%s,\x20%s',_0x17340f,_0xb6a6('0xf'));_0x415381(_0x5c802e[_0xb6a6('0x14')]['message']);}})['catch'](function(_0x46c885){logger[_0xb6a6('0x11')]('Variable,\x20%s,\x20%s',_0x17340f,_0x46c885);_0x58246a(_0x46c885);});});}exports['ShowVariable']=function(_0x466075){var _0x2f027c=this;return new Promise(function(_0x1617fd,_0x5e0748){return db[_0xb6a6('0x15')][_0xb6a6('0x16')]({'raw':_0x466075[_0xb6a6('0x17')]?_0x466075[_0xb6a6('0x17')][_0xb6a6('0x18')]===undefined?!![]:![]:!![],'where':_0x466075[_0xb6a6('0x17')]?_0x466075['options'][_0xb6a6('0x19')]||null:null,'attributes':_0x466075['options']?_0x466075['options']['attributes']||null:null,'include':_0x466075['options']?_0x466075[_0xb6a6('0x17')][_0xb6a6('0x1a')]?_[_0xb6a6('0x1b')](_0x466075['options'][_0xb6a6('0x1a')],function(_0x329216){return{'model':db[_0x329216['model']],'as':_0x329216['as'],'attributes':_0x329216[_0xb6a6('0x1c')],'include':_0x329216[_0xb6a6('0x1a')]?_['map'](_0x329216[_0xb6a6('0x1a')],function(_0x53a0ee){return{'model':db[_0x53a0ee[_0xb6a6('0x1d')]],'as':_0x53a0ee['as'],'attributes':_0x53a0ee['attributes'],'include':_0x53a0ee[_0xb6a6('0x1a')]?_[_0xb6a6('0x1b')](_0x53a0ee[_0xb6a6('0x1a')],function(_0x5458dd){return{'model':db[_0x5458dd[_0xb6a6('0x1d')]],'as':_0x5458dd['as'],'attributes':_0x5458dd[_0xb6a6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb6a6('0xb')](function(_0x52222b){logger[_0xb6a6('0xc')](_0xb6a6('0x1e'),_0x466075);logger[_0xb6a6('0x1f')](_0xb6a6('0x1e'),_0x466075,JSON[_0xb6a6('0x10')](_0x52222b));_0x1617fd(_0x52222b);})[_0xb6a6('0x20')](function(_0x4e9ab3){logger[_0xb6a6('0x11')](_0xb6a6('0x1e'),_0x4e9ab3['message'],_0x466075);_0x5e0748(_0x2f027c[_0xb6a6('0x11')](0x1f4,_0x4e9ab3['message']));});});}; \ No newline at end of file +var _0xd453=['client','http','then','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','info','result','catch','ShowVariable','options','raw','where','map','include','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3ee48b,_0x3612cb){var _0x4c9888=function(_0x23dfab){while(--_0x23dfab){_0x3ee48b['push'](_0x3ee48b['shift']());}};_0x4c9888(++_0x3612cb);}(_0xd453,0x175));var _0x3d45=function(_0xf46bd9,_0x322826){_0xf46bd9=_0xf46bd9-0x0;var _0x2763c3=_0xd453[_0xf46bd9];return _0x2763c3;};'use strict';var _=require(_0x3d45('0x0'));var util=require(_0x3d45('0x1'));var moment=require(_0x3d45('0x2'));var BPromise=require(_0x3d45('0x3'));var rs=require(_0x3d45('0x4'));var fs=require('fs');var Redis=require(_0x3d45('0x5'));var db=require(_0x3d45('0x6'))['db'];var utils=require(_0x3d45('0x7'));var logger=require(_0x3d45('0x8'))(_0x3d45('0x9'));var config=require(_0x3d45('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3d45('0xb')][_0x3d45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4dc9c1,_0x4344d7,_0x1274b2){return new BPromise(function(_0x130027,_0x351bcb){return client['request'](_0x4dc9c1,_0x1274b2)[_0x3d45('0xd')](function(_0x552da8){logger['info']('Variable,\x20%s,\x20%s',_0x4344d7,_0x3d45('0xe'));logger[_0x3d45('0xf')](_0x3d45('0x10'),_0x4344d7,_0x3d45('0xe'),JSON[_0x3d45('0x11')](_0x552da8));if(_0x552da8[_0x3d45('0x12')]){if(_0x552da8['error']['code']===0x1f4){logger[_0x3d45('0x12')](_0x3d45('0x13'),_0x4344d7,_0x552da8[_0x3d45('0x12')][_0x3d45('0x14')]);return _0x351bcb(_0x552da8[_0x3d45('0x12')][_0x3d45('0x14')]);}logger[_0x3d45('0x12')]('Variable,\x20%s,\x20%s',_0x4344d7,_0x552da8[_0x3d45('0x12')][_0x3d45('0x14')]);return _0x130027(_0x552da8[_0x3d45('0x12')][_0x3d45('0x14')]);}else{logger[_0x3d45('0x15')](_0x3d45('0x13'),_0x4344d7,_0x3d45('0xe'));_0x130027(_0x552da8[_0x3d45('0x16')]['message']);}})[_0x3d45('0x17')](function(_0x342609){logger[_0x3d45('0x12')](_0x3d45('0x13'),_0x4344d7,_0x342609);_0x351bcb(_0x342609);});});}exports[_0x3d45('0x18')]=function(_0x15f529){var _0x26ea60=this;return new Promise(function(_0xd32160,_0x2b6de4){return db['Variable']['find']({'raw':_0x15f529['options']?_0x15f529[_0x3d45('0x19')][_0x3d45('0x1a')]===undefined?!![]:![]:!![],'where':_0x15f529[_0x3d45('0x19')]?_0x15f529[_0x3d45('0x19')][_0x3d45('0x1b')]||null:null,'attributes':_0x15f529[_0x3d45('0x19')]?_0x15f529['options']['attributes']||null:null,'include':_0x15f529[_0x3d45('0x19')]?_0x15f529[_0x3d45('0x19')]['include']?_[_0x3d45('0x1c')](_0x15f529[_0x3d45('0x19')][_0x3d45('0x1d')],function(_0x431d72){return{'model':db[_0x431d72[_0x3d45('0x1e')]],'as':_0x431d72['as'],'attributes':_0x431d72[_0x3d45('0x1f')],'include':_0x431d72['include']?_[_0x3d45('0x1c')](_0x431d72[_0x3d45('0x1d')],function(_0x45a503){return{'model':db[_0x45a503[_0x3d45('0x1e')]],'as':_0x45a503['as'],'attributes':_0x45a503['attributes'],'include':_0x45a503[_0x3d45('0x1d')]?_['map'](_0x45a503['include'],function(_0x16e200){return{'model':db[_0x16e200[_0x3d45('0x1e')]],'as':_0x16e200['as'],'attributes':_0x16e200['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d45('0xd')](function(_0x1baad2){logger[_0x3d45('0x15')](_0x3d45('0x18'),_0x15f529);logger[_0x3d45('0xf')](_0x3d45('0x18'),_0x15f529,JSON[_0x3d45('0x11')](_0x1baad2));_0xd32160(_0x1baad2);})[_0x3d45('0x17')](function(_0x437e8a){logger[_0x3d45('0x12')](_0x3d45('0x18'),_0x437e8a[_0x3d45('0x14')],_0x15f529);_0x2b6de4(_0x26ea60[_0x3d45('0x12')](0x1f4,_0x437e8a['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index efe8d0b..91b8e80 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 _0x9dec=['/restart','migrations','express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull'];(function(_0x4d8b8e,_0x12fb10){var _0x3103ba=function(_0x361cae){while(--_0x361cae){_0x4d8b8e['push'](_0x4d8b8e['shift']());}};_0x3103ba(++_0x12fb10);}(_0x9dec,0x1d3));var _0xc9de=function(_0x12c0aa,_0x5ac6fe){_0x12c0aa=_0x12c0aa-0x0;var _0x1e045b=_0x9dec[_0x12c0aa];return _0x1e045b;};'use strict';var express=require(_0xc9de('0x0'));var router=express['Router']();var auth=require(_0xc9de('0x1'));var controller=require(_0xc9de('0x2'));router[_0xc9de('0x3')]('/',controller[_0xc9de('0x4')]);router[_0xc9de('0x3')](_0xc9de('0x5'),auth[_0xc9de('0x6')](),auth['canUpdate'](),controller[_0xc9de('0x7')]);router[_0xc9de('0x3')](_0xc9de('0x8'),auth[_0xc9de('0x6')](),auth[_0xc9de('0x9')](),controller[_0xc9de('0xa')]);router['get'](_0xc9de('0xb'),auth[_0xc9de('0x6')](),auth['canUpdate'](),controller[_0xc9de('0xc')]);router[_0xc9de('0x3')](_0xc9de('0xd'),auth['isAuthenticated'](),controller['restart']);router[_0xc9de('0x3')]('/migrations',controller[_0xc9de('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc626=['migrations','exports','express','Router','../../components/auth/service','./version.controller','index','get','/fetch','fetch','isAuthenticated','reset','/pull','pull','/restart','restart','/migrations'];(function(_0x23a07e,_0x2e2f09){var _0x3ee816=function(_0x23cbbe){while(--_0x23cbbe){_0x23a07e['push'](_0x23a07e['shift']());}};_0x3ee816(++_0x2e2f09);}(_0xc626,0x145));var _0x6c62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc626[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x6c62('0x0'));var router=express[_0x6c62('0x1')]();var auth=require(_0x6c62('0x2'));var controller=require(_0x6c62('0x3'));router['get']('/',controller[_0x6c62('0x4')]);router[_0x6c62('0x5')](_0x6c62('0x6'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x6c62('0x7')]);router[_0x6c62('0x5')]('/reset',auth[_0x6c62('0x8')](),auth['canUpdate'](),controller[_0x6c62('0x9')]);router[_0x6c62('0x5')](_0x6c62('0xa'),auth[_0x6c62('0x8')](),auth['canUpdate'](),controller[_0x6c62('0xb')]);router[_0x6c62('0x5')](_0x6c62('0xc'),auth[_0x6c62('0x8')](),controller[_0x6c62('0xd')]);router[_0x6c62('0x5')](_0x6c62('0xe'),controller[_0x6c62('0xf')]);module[_0x6c62('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 69c407d..3984f9d 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 _0xee2c=['compare-versions','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','status','master','error','json','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','replace','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','join','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xee2c,0x1c7));var _0xcee2=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xee2c[_0x1589dd];return _0x1bddd1;};'use strict';var Umzug=require(_0xcee2('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xcee2('0x1'));var pkginfo=require(_0xcee2('0x2'))(module,_0xcee2('0x3'));var compareVersions=require(_0xcee2('0x4'));var exec=require('child_process')['exec'];var db=require(_0xcee2('0x5'))['db'];var config=require(_0xcee2('0x6'));var pm2=require('../../config/pm2');var logger=require(_0xcee2('0x7'))(_0xcee2('0x8'));var git=require(_0xcee2('0x9'))(config[_0xcee2('0xa')]);exports[_0xcee2('0xb')]=function(_0x5a8219,_0x52a4ac){var _0xea6c3c={'current':module[_0xcee2('0xc')][_0xcee2('0x3')],'phonebar':0x2};if(_0x5a8219[_0xcee2('0xd')]&&_0x5a8219[_0xcee2('0xd')][_0xcee2('0xe')]){return git[_0xcee2('0xf')]()[_0xcee2('0x10')](function(_0x4ded22,_0xca2c64){_0xea6c3c[_0xcee2('0xe')]=(_0x4ded22?module[_0xcee2('0xc')][_0xcee2('0x3')]:_0xca2c64[_0xcee2('0xe')])||'2.0.0';return _0x52a4ac[_0xcee2('0x11')](0xc8)['json'](_0xea6c3c);});}else{return _0x52a4ac['status'](0xc8)['json'](_0xea6c3c);}};exports[_0xcee2('0xf')]=function(_0x34cc92,_0x2afc56){return git[_0xcee2('0xf')](['origin',_0xcee2('0x12')],function(_0x818e13){if(_0x818e13){logger[_0xcee2('0x13')](_0x818e13);return _0x2afc56[_0xcee2('0x11')](0x1f4)[_0xcee2('0x14')](_0x818e13);}logger[_0xcee2('0x15')](_0xcee2('0x16'));return _0x2afc56[_0xcee2('0x11')](0xc8)[_0xcee2('0x14')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xcee2('0x17')]=function(_0x548e47,_0x221d75){return git[_0xcee2('0x17')]([_0xcee2('0x18'),_0xcee2('0x19')],function(_0x5bb46f){if(_0x5bb46f){logger[_0xcee2('0x13')](_0x5bb46f);return _0x221d75[_0xcee2('0x11')](0x1f4)[_0xcee2('0x14')](_0x5bb46f);}logger[_0xcee2('0x15')](_0xcee2('0x1a'));return _0x221d75[_0xcee2('0x11')](0xc8)[_0xcee2('0x14')]({'output':_0xcee2('0x1b')});});};exports[_0xcee2('0x1c')]=function(_0x148023,_0x3e3f75){exec('npm\x20install\x20--production',function(_0x3f4f92,_0x4864d7,_0x4fdb88){logger['info'](_0x4864d7);logger[_0xcee2('0x15')](_0x4fdb88);if(_0x3f4f92){logger['error'](_0x3f4f92);return _0x3e3f75[_0xcee2('0x11')](0x1f4)[_0xcee2('0x14')](_0x3f4f92);}return _0x3e3f75[_0xcee2('0x11')](0xc8)['json']({'output':_0x4864d7});});};exports['restart']=function(_0x20a6de,_0x2ccc9c){return pm2[_0xcee2('0x1d')]('motion2')[_0xcee2('0x1e')](function(_0x538c04){logger[_0xcee2('0x15')](_0xcee2('0x1f'),_0x538c04);return _0x2ccc9c[_0xcee2('0x11')](0xc8)[_0xcee2('0x14')]({'output':_0xcee2('0x20')});})[_0xcee2('0x21')](function(_0xbc2b2e){logger[_0xcee2('0x13')](_0xbc2b2e);return _0x2ccc9c[_0xcee2('0x11')](0x1f4)[_0xcee2('0x14')](_0xbc2b2e);});};exports[_0xcee2('0x22')]=function(_0x483d22,_0x19a99b){var _0x3ccff6=fs[_0xcee2('0x23')](path['join'](config[_0xcee2('0xa')],_0xcee2('0x24'),'migrations'));var _0x1e0dfc=[];for(var _0x25ead9=0x0;_0x25ead9<_0x3ccff6['length'];_0x25ead9++){var _0x5ee5a5=_0x3ccff6[_0x25ead9][_0xcee2('0x25')]('.js','');if(compareVersions(module['exports'][_0xcee2('0x3')],_0x5ee5a5)===-0x1){_0x1e0dfc[_0xcee2('0x26')](_0x5ee5a5);}}if(_0x1e0dfc['length']){var _0x2563bf=_0x1e0dfc[_0xcee2('0x27')](compareVersions);var _0x21635f=new Umzug({'storage':_0xcee2('0x28'),'storageOptions':{'model':db[_0xcee2('0x29')],'modelName':_0xcee2('0x29'),'columnName':_0xcee2('0x3')},'migrations':{'params':[db[_0xcee2('0x28')][_0xcee2('0x2a')](),db[_0xcee2('0x28')][_0xcee2('0x2b')],function(){throw new Error(_0xcee2('0x2c'));}],'path':path['join'](config[_0xcee2('0xa')],_0xcee2('0x24'),'migrations'),'pattern':/\.js$/}});_0x21635f['up']({'migrations':_[_0xcee2('0x2d')](_0x2563bf,function(_0xecdf2c){return _0xecdf2c+'.js';})})[_0xcee2('0x1e')](function(){return _0x19a99b[_0xcee2('0x11')](0xc8)[_0xcee2('0x14')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xcee2('0xc')][_0xcee2('0x3')]+_0xcee2('0x2e')+_[_0xcee2('0x2f')](_0x2563bf),'migrations':_[_0xcee2('0x30')](_0x2563bf)});})[_0xcee2('0x21')](function(_0x538984){if(_0x538984 instanceof db[_0xcee2('0x28')][_0xcee2('0x31')]){return _0x19a99b[_0xcee2('0x11')](0xc8)['json']({'output':_0xcee2('0x32')});}else{return _0x19a99b['status'](0x1f4)['json'](_0x538984);}});}else{return _0x19a99b[_0xcee2('0x11')](0xc8)[_0xcee2('0x14')]({'output':_0xcee2('0x32')});}}; \ No newline at end of file +var _0x3e94=['then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','join','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','index','exports','query','latest','fetch','tags','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard','pull','npm\x20install\x20--production','pm2\x20restart\x20motion\x20%s','readdirSync','root','migrations','replace','.js','push','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map'];(function(_0x2fef62,_0x3a513d){var _0xd37f65=function(_0x345b16){while(--_0x345b16){_0x2fef62['push'](_0x2fef62['shift']());}};_0xd37f65(++_0x3a513d);}(_0x3e94,0x67));var _0x43e9=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x3e94[_0x138adb];return _0x1b27f2;};'use strict';var Umzug=require(_0x43e9('0x0'));var path=require(_0x43e9('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x43e9('0x2'))(module,_0x43e9('0x3'));var compareVersions=require(_0x43e9('0x4'));var exec=require('child_process')[_0x43e9('0x5')];var db=require(_0x43e9('0x6'))['db'];var config=require(_0x43e9('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x43e9('0x8'))('update');var git=require(_0x43e9('0x9'))(config['root']);exports[_0x43e9('0xa')]=function(_0x2989fe,_0x287aaf){var _0x510ee7={'current':module[_0x43e9('0xb')][_0x43e9('0x3')],'phonebar':0x2};if(_0x2989fe[_0x43e9('0xc')]&&_0x2989fe[_0x43e9('0xc')][_0x43e9('0xd')]){return git[_0x43e9('0xe')]()[_0x43e9('0xf')](function(_0x3c3ee3,_0x377899){_0x510ee7['latest']=(_0x3c3ee3?module[_0x43e9('0xb')][_0x43e9('0x3')]:_0x377899[_0x43e9('0xd')])||'2.0.0';return _0x287aaf[_0x43e9('0x10')](0xc8)[_0x43e9('0x11')](_0x510ee7);});}else{return _0x287aaf[_0x43e9('0x10')](0xc8)[_0x43e9('0x11')](_0x510ee7);}};exports[_0x43e9('0xe')]=function(_0x5387a5,_0x4b72a0){return git[_0x43e9('0xe')](['origin',_0x43e9('0x12')],function(_0x471cb8){if(_0x471cb8){logger[_0x43e9('0x13')](_0x471cb8);return _0x4b72a0[_0x43e9('0x10')](0x1f4)[_0x43e9('0x11')](_0x471cb8);}logger[_0x43e9('0x14')](_0x43e9('0x15'));return _0x4b72a0[_0x43e9('0x10')](0xc8)[_0x43e9('0x11')]({'output':_0x43e9('0x16')});});};exports[_0x43e9('0x17')]=function(_0x21ceda,_0x310476){return git[_0x43e9('0x17')](['--hard','FETCH_HEAD'],function(_0x38b426){if(_0x38b426){logger[_0x43e9('0x13')](_0x38b426);return _0x310476[_0x43e9('0x10')](0x1f4)[_0x43e9('0x11')](_0x38b426);}logger[_0x43e9('0x14')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x310476[_0x43e9('0x10')](0xc8)['json']({'output':_0x43e9('0x18')});});};exports[_0x43e9('0x19')]=function(_0x777e8f,_0x3a8c3b){exec(_0x43e9('0x1a'),function(_0x536a70,_0x3c6c5c,_0x3d604e){logger['info'](_0x3c6c5c);logger[_0x43e9('0x14')](_0x3d604e);if(_0x536a70){logger[_0x43e9('0x13')](_0x536a70);return _0x3a8c3b[_0x43e9('0x10')](0x1f4)[_0x43e9('0x11')](_0x536a70);}return _0x3a8c3b['status'](0xc8)[_0x43e9('0x11')]({'output':_0x3c6c5c});});};exports['restart']=function(_0x64a3a8,_0x4ac04c){return pm2['restart']('motion2')['then'](function(_0x2fac99){logger['info'](_0x43e9('0x1b'),_0x2fac99);return _0x4ac04c[_0x43e9('0x10')](0xc8)[_0x43e9('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0xf64426){logger['error'](_0xf64426);return _0x4ac04c['status'](0x1f4)[_0x43e9('0x11')](_0xf64426);});};exports['migrations']=function(_0x502f88,_0x51b356){var _0x197c88=fs[_0x43e9('0x1c')](path['join'](config[_0x43e9('0x1d')],'server',_0x43e9('0x1e')));var _0x5777a8=[];for(var _0x24dfff=0x0;_0x24dfff<_0x197c88['length'];_0x24dfff++){var _0x4cd81b=_0x197c88[_0x24dfff][_0x43e9('0x1f')](_0x43e9('0x20'),'');if(compareVersions(module[_0x43e9('0xb')][_0x43e9('0x3')],_0x4cd81b)===-0x1){_0x5777a8[_0x43e9('0x21')](_0x4cd81b);}}if(_0x5777a8['length']){var _0x20b8b9=_0x5777a8['sort'](compareVersions);var _0x5c99e8=new Umzug({'storage':_0x43e9('0x22'),'storageOptions':{'model':db[_0x43e9('0x23')],'modelName':_0x43e9('0x23'),'columnName':_0x43e9('0x3')},'migrations':{'params':[db['sequelize'][_0x43e9('0x24')](),db[_0x43e9('0x22')][_0x43e9('0x25')],function(){throw new Error(_0x43e9('0x26'));}],'path':path['join'](config[_0x43e9('0x1d')],_0x43e9('0x27'),_0x43e9('0x1e')),'pattern':/\.js$/}});_0x5c99e8['up']({'migrations':_[_0x43e9('0x28')](_0x20b8b9,function(_0x2ce6d4){return _0x2ce6d4+_0x43e9('0x20');})})[_0x43e9('0x29')](function(){return _0x51b356['status'](0xc8)[_0x43e9('0x11')]({'output':_0x43e9('0x2a')+module[_0x43e9('0xb')][_0x43e9('0x3')]+_0x43e9('0x2b')+_['last'](_0x20b8b9),'migrations':_[_0x43e9('0x2c')](_0x20b8b9)});})[_0x43e9('0x2d')](function(_0x3e3d0f){if(_0x3e3d0f instanceof db['sequelize'][_0x43e9('0x2e')]){return _0x51b356[_0x43e9('0x10')](0xc8)[_0x43e9('0x11')]({'output':_0x43e9('0x2f')});}else{return _0x51b356[_0x43e9('0x10')](0x1f4)['json'](_0x3e3d0f);}});}else{return _0x51b356[_0x43e9('0x10')](0xc8)[_0x43e9('0x11')]({'output':_0x43e9('0x2f')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index bb699c8..f54c019 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 _0x2756=['create','put','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','post'];(function(_0xc84622,_0xf623a6){var _0x504c81=function(_0x3fc07a){while(--_0x3fc07a){_0xc84622['push'](_0xc84622['shift']());}};_0x504c81(++_0xf623a6);}(_0x2756,0x124));var _0x6275=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x2756[_0x4eafed];return _0x159c85;};'use strict';var multer=require('multer');var util=require(_0x6275('0x0'));var path=require(_0x6275('0x1'));var timeout=require(_0x6275('0x2'));var express=require(_0x6275('0x3'));var router=express[_0x6275('0x4')]();var auth=require(_0x6275('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6275('0x6'));var controller=require(_0x6275('0x7'));router[_0x6275('0x8')]('/',auth[_0x6275('0x9')](),controller['index']);router['get'](_0x6275('0xa'),auth[_0x6275('0x9')](),controller[_0x6275('0xb')]);router['get'](_0x6275('0xc'),auth[_0x6275('0x9')](),controller['show']);router[_0x6275('0xd')]('/',auth[_0x6275('0x9')](),controller[_0x6275('0xe')]);router[_0x6275('0xf')]('/:id',auth[_0x6275('0x9')](),controller['update']);router[_0x6275('0x10')](_0x6275('0xc'),auth[_0x6275('0x9')](),controller['destroy']);module[_0x6275('0x11')]=router; \ No newline at end of file +var _0x36d4=['./voiceAgentReport.controller','isAuthenticated','index','get','describe','/:id','post','put','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment'];(function(_0x3ec28a,_0x141408){var _0x15e81d=function(_0x3ef627){while(--_0x3ef627){_0x3ec28a['push'](_0x3ec28a['shift']());}};_0x15e81d(++_0x141408);}(_0x36d4,0x1e7));var _0x436d=function(_0x23cfaf,_0x1d8545){_0x23cfaf=_0x23cfaf-0x0;var _0xf8af44=_0x36d4[_0x23cfaf];return _0xf8af44;};'use strict';var multer=require(_0x436d('0x0'));var util=require(_0x436d('0x1'));var path=require(_0x436d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x436d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x436d('0x4'));var config=require(_0x436d('0x5'));var controller=require(_0x436d('0x6'));router['get']('/',auth[_0x436d('0x7')](),controller[_0x436d('0x8')]);router[_0x436d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x436d('0xa')]);router[_0x436d('0x9')](_0x436d('0xb'),auth[_0x436d('0x7')](),controller['show']);router[_0x436d('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x436d('0xd')](_0x436d('0xb'),auth[_0x436d('0x7')](),controller['update']);router[_0x436d('0xe')]('/:id',auth[_0x436d('0x7')](),controller[_0x436d('0xf')]);module[_0x436d('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 4a5f7ef..40e5223 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 _0xdc97=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3fa6eb,_0x139e0b){var _0x587da5=function(_0x39c8ca){while(--_0x39c8ca){_0x3fa6eb['push'](_0x3fa6eb['shift']());}};_0x587da5(++_0x139e0b);}(_0xdc97,0x13b));var _0x7dc9=function(_0x546764,_0x97e034){_0x546764=_0x546764-0x0;var _0x31134a=_0xdc97[_0x546764];return _0x31134a;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'type':{'type':Sequelize[_0x7dc9('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7dc9('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7dc9('0x2')]},'interface':{'type':Sequelize[_0x7dc9('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x7dc9('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7dc9('0x4')]},'agentacw':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7dc9('0x4')]},'reason':{'type':Sequelize[_0x7dc9('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7dc9('0x2')]},'channelstate':{'type':Sequelize[_0x7dc9('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7dc9('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7dc9('0x2')]},'connectedlinename':{'type':Sequelize[_0x7dc9('0x2')]},'language':{'type':Sequelize[_0x7dc9('0x2')]},'accountcode':{'type':Sequelize[_0x7dc9('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7dc9('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7dc9('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7dc9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7dc9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7dc9('0x2')]},'destlanguage':{'type':Sequelize[_0x7dc9('0x2')]},'destaccountcode':{'type':Sequelize[_0x7dc9('0x2')]},'destcontext':{'type':Sequelize[_0x7dc9('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7dc9('0x2')]},'destuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7dc9('0x2')]},'transfer':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7dc9('0x2')],'comment':_0x7dc9('0x6')},'transferexten':{'type':Sequelize[_0x7dc9('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf494=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x598fb2,_0x6808e7){var _0x1a10a8=function(_0x188cba){while(--_0x188cba){_0x598fb2['push'](_0x598fb2['shift']());}};_0x1a10a8(++_0x6808e7);}(_0xf494,0x1c6));var _0x4f49=function(_0x4a5265,_0x1ab0bf){_0x4a5265=_0x4a5265-0x0;var _0x5c31fe=_0xf494[_0x4a5265];return _0x5c31fe;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'type':{'type':Sequelize[_0x4f49('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4f49('0x2')]},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'queue':{'type':Sequelize[_0x4f49('0x2')]},'interface':{'type':Sequelize[_0x4f49('0x2')]},'membername':{'type':Sequelize[_0x4f49('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4f49('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4f49('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4f49('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4f49('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4f49('0x3')]},'holdtime':{'type':Sequelize[_0x4f49('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4f49('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4f49('0x4')]},'agentacw':{'type':Sequelize[_0x4f49('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4f49('0x4')]},'reason':{'type':Sequelize[_0x4f49('0x2')]},'lastevent':{'type':Sequelize[_0x4f49('0x2')]},'channel':{'type':Sequelize[_0x4f49('0x2')]},'channelstate':{'type':Sequelize[_0x4f49('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4f49('0x2')]},'connectedlinename':{'type':Sequelize[_0x4f49('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4f49('0x2')]},'destchannel':{'type':Sequelize[_0x4f49('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4f49('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4f49('0x2')]},'destcalleridname':{'type':Sequelize[_0x4f49('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4f49('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4f49('0x2')]},'destlanguage':{'type':Sequelize[_0x4f49('0x2')]},'destaccountcode':{'type':Sequelize[_0x4f49('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x4f49('0x2')]},'destpriority':{'type':Sequelize[_0x4f49('0x2')]},'destuniqueid':{'type':Sequelize[_0x4f49('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4f49('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4f49('0x2')],'comment':_0x4f49('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x4f49('0x2')]},'agententerreason':{'type':Sequelize[_0x4f49('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 c7f83b5..8e1337a 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 _0xd66d=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','rows','show','params','keys','options','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x5a7aea,_0x40eb3f){var _0x19237f=function(_0x3876f7){while(--_0x3876f7){_0x5a7aea['push'](_0x5a7aea['shift']());}};_0x19237f(++_0x40eb3f);}(_0xd66d,0x18f));var _0xdd66=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xd66d[_0x2d2c16];return _0x53f2fb;};'use strict';var pdf=require(_0xdd66('0x0'));var emlformat=require(_0xdd66('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdd66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdd66('0x3'));var BPromise=require(_0xdd66('0x4'));var Mustache=require(_0xdd66('0x5'));var util=require(_0xdd66('0x6'));var path=require(_0xdd66('0x7'));var sox=require(_0xdd66('0x8'));var csv=require(_0xdd66('0x9'));var ejs=require(_0xdd66('0xa'));var fs=require('fs');var _=require(_0xdd66('0xb'));var squel=require('squel');var crypto=require(_0xdd66('0xc'));var jsforce=require(_0xdd66('0xd'));var deskjs=require(_0xdd66('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdd66('0xf'));var Papa=require(_0xdd66('0x10'));var Redis=require(_0xdd66('0x11'));var authService=require(_0xdd66('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdd66('0x13'));var hardwareService=require(_0xdd66('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xdd66('0x15'));var config=require(_0xdd66('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd66('0x17'))['db'];function respondWithStatusCode(_0x1c5f7c,_0x58e31a){_0x58e31a=_0x58e31a||0xcc;return function(_0x5e62a8){if(_0x5e62a8){return _0x1c5f7c[_0xdd66('0x18')](_0x58e31a);}return _0x1c5f7c['status'](_0x58e31a)[_0xdd66('0x19')]();};}function respondWithResult(_0x270798,_0x2d5224){_0x2d5224=_0x2d5224||0xc8;return function(_0x5d147d){if(_0x5d147d){return _0x270798[_0xdd66('0x1a')](_0x2d5224)[_0xdd66('0x1b')](_0x5d147d);}};}function respondWithFilteredResult(_0xf697bc,_0x5cffc3){return function(_0x25d227){if(_0x25d227){var _0x2a0839=_0x25d227['count'],_0x44a95b=_0x5cffc3[_0xdd66('0x1c')],_0x3754f4=_0x5cffc3['offset']+_0x5cffc3[_0xdd66('0x1d')],_0xc4d5c7;if(_0x3754f4>=_0x2a0839){_0x3754f4=_0x2a0839;_0xc4d5c7=0xc8;}else{_0xc4d5c7=0xce;}_0xf697bc[_0xdd66('0x1a')](_0xc4d5c7);return _0xf697bc['set']('Content-Range',_0x44a95b+'-'+_0x3754f4+'/'+_0x2a0839)[_0xdd66('0x1b')](_0x25d227);}return null;};}function patchUpdates(_0x35eeb8){return function(_0x1c7f70){try{jsonpatch[_0xdd66('0x1e')](_0x1c7f70,_0x35eeb8,!![]);}catch(_0x594024){return BPromise[_0xdd66('0x1f')](_0x594024);}return _0x1c7f70[_0xdd66('0x20')]();};}function saveUpdates(_0x5dd7a0,_0x25c66a){return function(_0x246e58){if(_0x246e58){return _0x246e58[_0xdd66('0x21')](_0x5dd7a0)[_0xdd66('0x22')](function(_0x2a2571){return _0x2a2571;});}return null;};}function removeEntity(_0x37323e,_0x1a905d){return function(_0x1bb8fd){if(_0x1bb8fd){return _0x1bb8fd[_0xdd66('0x23')]()['then'](function(){_0x37323e['status'](0xcc)[_0xdd66('0x19')]();});}};}function handleEntityNotFound(_0x348fb4,_0x3b621b){return function(_0x36d402){if(!_0x36d402){_0x348fb4['sendStatus'](0x194);}return _0x36d402;};}function handleError(_0x3d92a8,_0xfa723c){_0xfa723c=_0xfa723c||0x1f4;return function(_0x471125){logger[_0xdd66('0x24')](_0x471125['stack']);if(_0x471125['name']){delete _0x471125[_0xdd66('0x25')];}_0x3d92a8[_0xdd66('0x1a')](_0xfa723c)[_0xdd66('0x26')](_0x471125);};}exports[_0xdd66('0x27')]=function(_0x2d0931,_0x4088e5){var _0x2ddb88={},_0x434ea2={},_0x446dc6={'count':0x0,'rows':[]};var _0x4f2f5c=_[_0xdd66('0x28')](db[_0xdd66('0x29')][_0xdd66('0x2a')],function(_0x26f4b3){return{'name':_0x26f4b3[_0xdd66('0x2b')],'type':_0x26f4b3[_0xdd66('0x2c')][_0xdd66('0x2d')]};});_0x434ea2[_0xdd66('0x2e')]=_['map'](_0x4f2f5c,_0xdd66('0x25'));_0x434ea2['query']=_['keys'](_0x2d0931[_0xdd66('0x2f')]);_0x434ea2[_0xdd66('0x30')]=_[_0xdd66('0x31')](_0x434ea2[_0xdd66('0x2e')],_0x434ea2[_0xdd66('0x2f')]);_0x2ddb88[_0xdd66('0x32')]=_[_0xdd66('0x31')](_0x434ea2['model'],qs[_0xdd66('0x33')](_0x2d0931[_0xdd66('0x2f')][_0xdd66('0x33')]));_0x2ddb88[_0xdd66('0x32')]=_0x2ddb88[_0xdd66('0x32')][_0xdd66('0x34')]?_0x2ddb88[_0xdd66('0x32')]:_0x434ea2[_0xdd66('0x2e')];if(!_0x2d0931[_0xdd66('0x2f')][_0xdd66('0x35')](_0xdd66('0x36'))){_0x2ddb88[_0xdd66('0x1d')]=qs[_0xdd66('0x1d')](_0x2d0931[_0xdd66('0x2f')]['limit']);_0x2ddb88['offset']=qs[_0xdd66('0x1c')](_0x2d0931[_0xdd66('0x2f')][_0xdd66('0x1c')]);}_0x2ddb88[_0xdd66('0x37')]=qs[_0xdd66('0x38')](_0x2d0931[_0xdd66('0x2f')][_0xdd66('0x38')]);_0x2ddb88[_0xdd66('0x39')]=qs['filters'](_[_0xdd66('0x3a')](_0x2d0931[_0xdd66('0x2f')],_0x434ea2['filters']),_0x4f2f5c);if(_0x2d0931[_0xdd66('0x2f')][_0xdd66('0x3b')]){_0x2ddb88[_0xdd66('0x39')]=_['merge'](_0x2ddb88[_0xdd66('0x39')],{'$or':_[_0xdd66('0x28')](_0x4f2f5c,function(_0x43e6df){if(_0x43e6df[_0xdd66('0x2c')]!==_0xdd66('0x3c')){var _0x987d22={};_0x987d22[_0x43e6df[_0xdd66('0x25')]]={'$like':'%'+_0x2d0931[_0xdd66('0x2f')][_0xdd66('0x3b')]+'%'};return _0x987d22;}})});}_0x2ddb88=_[_0xdd66('0x3d')]({},_0x2ddb88,_0x2d0931['options']);var _0x20c805={'where':_0x2ddb88[_0xdd66('0x39')]};return db[_0xdd66('0x29')][_0xdd66('0x3e')](_0x20c805)[_0xdd66('0x22')](function(_0x1b07c5){_0x446dc6[_0xdd66('0x3e')]=_0x1b07c5;if(_0x2d0931['query'][_0xdd66('0x3f')]){_0x2ddb88[_0xdd66('0x40')]=[{'all':!![]}];}return db[_0xdd66('0x29')]['findAll'](_0x2ddb88);})[_0xdd66('0x22')](function(_0x532572){_0x446dc6[_0xdd66('0x41')]=_0x532572;return _0x446dc6;})[_0xdd66('0x22')](respondWithFilteredResult(_0x4088e5,_0x2ddb88))['catch'](handleError(_0x4088e5,null));};exports[_0xdd66('0x42')]=function(_0x3526c2,_0x52a680){var _0x4021ed={'raw':![],'where':{'id':_0x3526c2[_0xdd66('0x43')]['id']}},_0x4ed9d6={};_0x4ed9d6[_0xdd66('0x2e')]=_[_0xdd66('0x44')](db[_0xdd66('0x29')][_0xdd66('0x2a')]);_0x4ed9d6[_0xdd66('0x2f')]=_[_0xdd66('0x44')](_0x3526c2['query']);_0x4ed9d6[_0xdd66('0x30')]=_[_0xdd66('0x31')](_0x4ed9d6[_0xdd66('0x2e')],_0x4ed9d6[_0xdd66('0x2f')]);_0x4021ed[_0xdd66('0x32')]=_[_0xdd66('0x31')](_0x4ed9d6[_0xdd66('0x2e')],qs[_0xdd66('0x33')](_0x3526c2[_0xdd66('0x2f')][_0xdd66('0x33')]));_0x4021ed['attributes']=_0x4021ed[_0xdd66('0x32')]['length']?_0x4021ed[_0xdd66('0x32')]:_0x4ed9d6[_0xdd66('0x2e')];if(_0x3526c2['query'][_0xdd66('0x3f')]){_0x4021ed[_0xdd66('0x40')]=[{'all':!![]}];}_0x4021ed=_['merge']({},_0x4021ed,_0x3526c2[_0xdd66('0x45')]);return db['VoiceAgentReport'][_0xdd66('0x46')](_0x4021ed)[_0xdd66('0x22')](handleEntityNotFound(_0x52a680,null))['then'](respondWithResult(_0x52a680,null))[_0xdd66('0x47')](handleError(_0x52a680,null));};exports[_0xdd66('0x48')]=function(_0x5c97d8,_0x3b0cd6){return db[_0xdd66('0x29')][_0xdd66('0x48')](_0x5c97d8[_0xdd66('0x49')],{})[_0xdd66('0x22')](respondWithResult(_0x3b0cd6,0xc9))[_0xdd66('0x47')](handleError(_0x3b0cd6,null));};exports[_0xdd66('0x21')]=function(_0x100011,_0x6581bd){if(_0x100011['body']['id']){delete _0x100011['body']['id'];}return db[_0xdd66('0x29')][_0xdd66('0x46')]({'where':{'id':_0x100011[_0xdd66('0x43')]['id']}})[_0xdd66('0x22')](handleEntityNotFound(_0x6581bd,null))[_0xdd66('0x22')](saveUpdates(_0x100011['body'],null))['then'](respondWithResult(_0x6581bd,null))[_0xdd66('0x47')](handleError(_0x6581bd,null));};exports[_0xdd66('0x23')]=function(_0xa1df31,_0xe19e00){return db[_0xdd66('0x29')][_0xdd66('0x46')]({'where':{'id':_0xa1df31['params']['id']}})['then'](handleEntityNotFound(_0xe19e00,null))['then'](removeEntity(_0xe19e00,null))[_0xdd66('0x47')](handleError(_0xe19e00,null));};exports[_0xdd66('0x4a')]=function(_0x2f2cb9,_0x2a0ac2){return db['VoiceAgentReport'][_0xdd66('0x4a')]()[_0xdd66('0x22')](respondWithResult(_0x2a0ac2,null))[_0xdd66('0x47')](handleError(_0x2a0ac2,null));}; \ No newline at end of file +var _0x9490=['count','offset','limit','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','VoiceAgentReport','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','params','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','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','sendStatus','status','end'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9490,0xbc));var _0x0949=function(_0xfae9f2,_0x5211be){_0xfae9f2=_0xfae9f2-0x0;var _0x2b7d5c=_0x9490[_0xfae9f2];return _0x2b7d5c;};'use strict';var pdf=require(_0x0949('0x0'));var emlformat=require(_0x0949('0x1'));var rimraf=require(_0x0949('0x2'));var zipdir=require(_0x0949('0x3'));var jsonpatch=require(_0x0949('0x4'));var rp=require(_0x0949('0x5'));var moment=require(_0x0949('0x6'));var BPromise=require(_0x0949('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0949('0x8'));var sox=require(_0x0949('0x9'));var csv=require(_0x0949('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0949('0xb'));var crypto=require(_0x0949('0xc'));var jsforce=require(_0x0949('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0949('0xe'));var Papa=require(_0x0949('0xf'));var Redis=require(_0x0949('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0949('0x11'));var as=require(_0x0949('0x12'));var hardwareService=require(_0x0949('0x13'));var logger=require(_0x0949('0x14'))('api');var utils=require(_0x0949('0x15'));var config=require(_0x0949('0x16'));var licenseUtil=require(_0x0949('0x17'));var db=require(_0x0949('0x18'))['db'];function respondWithStatusCode(_0x535a84,_0xa6a943){_0xa6a943=_0xa6a943||0xcc;return function(_0x26def4){if(_0x26def4){return _0x535a84[_0x0949('0x19')](_0xa6a943);}return _0x535a84[_0x0949('0x1a')](_0xa6a943)[_0x0949('0x1b')]();};}function respondWithResult(_0x26af36,_0x35b5d2){_0x35b5d2=_0x35b5d2||0xc8;return function(_0x2e3f78){if(_0x2e3f78){return _0x26af36[_0x0949('0x1a')](_0x35b5d2)['json'](_0x2e3f78);}};}function respondWithFilteredResult(_0x2b6e52,_0x212c15){return function(_0x3a2205){if(_0x3a2205){var _0x4544b0=_0x3a2205[_0x0949('0x1c')],_0x2f9186=_0x212c15[_0x0949('0x1d')],_0x2a4f20=_0x212c15['offset']+_0x212c15[_0x0949('0x1e')],_0x13ae36;if(_0x2a4f20>=_0x4544b0){_0x2a4f20=_0x4544b0;_0x13ae36=0xc8;}else{_0x13ae36=0xce;}_0x2b6e52[_0x0949('0x1a')](_0x13ae36);return _0x2b6e52['set'](_0x0949('0x1f'),_0x2f9186+'-'+_0x2a4f20+'/'+_0x4544b0)['json'](_0x3a2205);}return null;};}function patchUpdates(_0x5ce781){return function(_0x4fe35b){try{jsonpatch[_0x0949('0x20')](_0x4fe35b,_0x5ce781,!![]);}catch(_0x45a156){return BPromise['reject'](_0x45a156);}return _0x4fe35b[_0x0949('0x21')]();};}function saveUpdates(_0x3c4b3,_0x205aac){return function(_0x4db71e){if(_0x4db71e){return _0x4db71e[_0x0949('0x22')](_0x3c4b3)['then'](function(_0x42a73d){return _0x42a73d;});}return null;};}function removeEntity(_0x4ce971,_0x8b78d9){return function(_0x13fb25){if(_0x13fb25){return _0x13fb25[_0x0949('0x23')]()[_0x0949('0x24')](function(){_0x4ce971[_0x0949('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x85e5ec,_0xf1d0a6){return function(_0x3b0475){if(!_0x3b0475){_0x85e5ec[_0x0949('0x19')](0x194);}return _0x3b0475;};}function handleError(_0x2707c6,_0x10f6a2){_0x10f6a2=_0x10f6a2||0x1f4;return function(_0xa671b3){logger[_0x0949('0x25')](_0xa671b3[_0x0949('0x26')]);if(_0xa671b3['name']){delete _0xa671b3[_0x0949('0x27')];}_0x2707c6[_0x0949('0x1a')](_0x10f6a2)[_0x0949('0x28')](_0xa671b3);};}exports[_0x0949('0x29')]=function(_0x561938,_0x2d2805){var _0x2e00cd={},_0x1a140b={},_0x5b0390={'count':0x0,'rows':[]};var _0x34b8c6=_['map'](db[_0x0949('0x2a')]['rawAttributes'],function(_0x3493d7){return{'name':_0x3493d7[_0x0949('0x2b')],'type':_0x3493d7[_0x0949('0x2c')]['key']};});_0x1a140b[_0x0949('0x2d')]=_[_0x0949('0x2e')](_0x34b8c6,_0x0949('0x27'));_0x1a140b[_0x0949('0x2f')]=_[_0x0949('0x30')](_0x561938[_0x0949('0x2f')]);_0x1a140b['filters']=_[_0x0949('0x31')](_0x1a140b[_0x0949('0x2d')],_0x1a140b[_0x0949('0x2f')]);_0x2e00cd[_0x0949('0x32')]=_[_0x0949('0x31')](_0x1a140b[_0x0949('0x2d')],qs[_0x0949('0x33')](_0x561938['query'][_0x0949('0x33')]));_0x2e00cd['attributes']=_0x2e00cd[_0x0949('0x32')][_0x0949('0x34')]?_0x2e00cd[_0x0949('0x32')]:_0x1a140b[_0x0949('0x2d')];if(!_0x561938['query']['hasOwnProperty']('nolimit')){_0x2e00cd[_0x0949('0x1e')]=qs[_0x0949('0x1e')](_0x561938[_0x0949('0x2f')][_0x0949('0x1e')]);_0x2e00cd[_0x0949('0x1d')]=qs['offset'](_0x561938[_0x0949('0x2f')][_0x0949('0x1d')]);}_0x2e00cd['order']=qs[_0x0949('0x35')](_0x561938['query']['sort']);_0x2e00cd[_0x0949('0x36')]=qs[_0x0949('0x37')](_[_0x0949('0x38')](_0x561938['query'],_0x1a140b['filters']),_0x34b8c6);if(_0x561938[_0x0949('0x2f')][_0x0949('0x39')]){_0x2e00cd['where']=_[_0x0949('0x3a')](_0x2e00cd[_0x0949('0x36')],{'$or':_[_0x0949('0x2e')](_0x34b8c6,function(_0x18ec24){if(_0x18ec24[_0x0949('0x2c')]!=='VIRTUAL'){var _0x5808b3={};_0x5808b3[_0x18ec24[_0x0949('0x27')]]={'$like':'%'+_0x561938[_0x0949('0x2f')][_0x0949('0x39')]+'%'};return _0x5808b3;}})});}_0x2e00cd=_[_0x0949('0x3a')]({},_0x2e00cd,_0x561938[_0x0949('0x3b')]);var _0x58ad43={'where':_0x2e00cd[_0x0949('0x36')]};return db['VoiceAgentReport'][_0x0949('0x1c')](_0x58ad43)[_0x0949('0x24')](function(_0x51120d){_0x5b0390[_0x0949('0x1c')]=_0x51120d;if(_0x561938[_0x0949('0x2f')][_0x0949('0x3c')]){_0x2e00cd[_0x0949('0x3d')]=[{'all':!![]}];}return db[_0x0949('0x2a')][_0x0949('0x3e')](_0x2e00cd);})[_0x0949('0x24')](function(_0x313bab){_0x5b0390[_0x0949('0x3f')]=_0x313bab;return _0x5b0390;})[_0x0949('0x24')](respondWithFilteredResult(_0x2d2805,_0x2e00cd))[_0x0949('0x40')](handleError(_0x2d2805,null));};exports[_0x0949('0x41')]=function(_0x9401a4,_0x589ea8){var _0xc07f39={'raw':![],'where':{'id':_0x9401a4['params']['id']}},_0x2cb574={};_0x2cb574[_0x0949('0x2d')]=_[_0x0949('0x30')](db[_0x0949('0x2a')][_0x0949('0x42')]);_0x2cb574[_0x0949('0x2f')]=_[_0x0949('0x30')](_0x9401a4['query']);_0x2cb574[_0x0949('0x37')]=_['intersection'](_0x2cb574[_0x0949('0x2d')],_0x2cb574[_0x0949('0x2f')]);_0xc07f39[_0x0949('0x32')]=_[_0x0949('0x31')](_0x2cb574[_0x0949('0x2d')],qs[_0x0949('0x33')](_0x9401a4['query']['fields']));_0xc07f39[_0x0949('0x32')]=_0xc07f39['attributes']['length']?_0xc07f39[_0x0949('0x32')]:_0x2cb574[_0x0949('0x2d')];if(_0x9401a4[_0x0949('0x2f')][_0x0949('0x3c')]){_0xc07f39[_0x0949('0x3d')]=[{'all':!![]}];}_0xc07f39=_[_0x0949('0x3a')]({},_0xc07f39,_0x9401a4[_0x0949('0x3b')]);return db[_0x0949('0x2a')]['find'](_0xc07f39)['then'](handleEntityNotFound(_0x589ea8,null))[_0x0949('0x24')](respondWithResult(_0x589ea8,null))[_0x0949('0x40')](handleError(_0x589ea8,null));};exports[_0x0949('0x43')]=function(_0xff2b4d,_0x4f6e78){return db['VoiceAgentReport'][_0x0949('0x43')](_0xff2b4d['body'],{})['then'](respondWithResult(_0x4f6e78,0xc9))[_0x0949('0x40')](handleError(_0x4f6e78,null));};exports[_0x0949('0x22')]=function(_0x3c270c,_0x3d3702){if(_0x3c270c[_0x0949('0x44')]['id']){delete _0x3c270c['body']['id'];}return db[_0x0949('0x2a')]['find']({'where':{'id':_0x3c270c[_0x0949('0x45')]['id']}})[_0x0949('0x24')](handleEntityNotFound(_0x3d3702,null))[_0x0949('0x24')](saveUpdates(_0x3c270c[_0x0949('0x44')],null))['then'](respondWithResult(_0x3d3702,null))[_0x0949('0x40')](handleError(_0x3d3702,null));};exports[_0x0949('0x23')]=function(_0x3a7259,_0x50a53d){return db[_0x0949('0x2a')][_0x0949('0x46')]({'where':{'id':_0x3a7259[_0x0949('0x45')]['id']}})[_0x0949('0x24')](handleEntityNotFound(_0x50a53d,null))['then'](removeEntity(_0x50a53d,null))[_0x0949('0x40')](handleError(_0x50a53d,null));};exports[_0x0949('0x47')]=function(_0x328bbf,_0x587c86){return db['VoiceAgentReport']['describe']()['then'](respondWithResult(_0x587c86,null))['catch'](handleError(_0x587c86,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 10b8fa8..87dfc97 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 _0xfc38=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','util','api','moment','bluebird'];(function(_0x412fd7,_0x8c1287){var _0x2077fd=function(_0x425811){while(--_0x425811){_0x412fd7['push'](_0x412fd7['shift']());}};_0x2077fd(++_0x8c1287);}(_0xfc38,0x98));var _0x8fc3=function(_0x375cb5,_0x4a06a0){_0x375cb5=_0x375cb5-0x0;var _0x49ad42=_0xfc38[_0x375cb5];return _0x49ad42;};'use strict';var _=require('lodash');var util=require(_0x8fc3('0x0'));var logger=require('../../config/logger')(_0x8fc3('0x1'));var moment=require(_0x8fc3('0x2'));var BPromise=require(_0x8fc3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fc3('0x4'));var rimraf=require(_0x8fc3('0x5'));var config=require(_0x8fc3('0x6'));var attributes=require(_0x8fc3('0x7'));module[_0x8fc3('0x8')]=function(_0x4cdb8c,_0x5e0f12){return _0x4cdb8c[_0x8fc3('0x9')]('VoiceAgentReport',attributes,{'tableName':_0x8fc3('0xa'),'paranoid':![],'indexes':[{'fields':[_0x8fc3('0xb'),_0x8fc3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a9f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceAgentReport','report_agent','lodash','util','../../config/logger','api'];(function(_0x33f31b,_0x550ae9){var _0x33514e=function(_0x266538){while(--_0x266538){_0x33f31b['push'](_0x33f31b['shift']());}};_0x33514e(++_0x550ae9);}(_0x3a9f,0x122));var _0xf3a9=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x3a9f[_0x2c1dcd];return _0x158ce5;};'use strict';var _=require(_0xf3a9('0x0'));var util=require(_0xf3a9('0x1'));var logger=require(_0xf3a9('0x2'))(_0xf3a9('0x3'));var moment=require(_0xf3a9('0x4'));var BPromise=require(_0xf3a9('0x5'));var rp=require(_0xf3a9('0x6'));var fs=require('fs');var path=require(_0xf3a9('0x7'));var rimraf=require(_0xf3a9('0x8'));var config=require(_0xf3a9('0x9'));var attributes=require('./voiceAgentReport.attributes');module[_0xf3a9('0xa')]=function(_0x56f671,_0x10a338){return _0x56f671[_0xf3a9('0xb')](_0xf3a9('0xc'),attributes,{'tableName':_0xf3a9('0xd'),'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 882a388..389851a 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 _0x03be=['info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateVoiceAgentReport','create','body','options','raw','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x16f6e4,_0x288b61){var _0x275354=function(_0x43865e){while(--_0x43865e){_0x16f6e4['push'](_0x16f6e4['shift']());}};_0x275354(++_0x288b61);}(_0x03be,0x150));var _0xe03b=function(_0x291436,_0x9dd541){_0x291436=_0x291436-0x0;var _0x3fa0fa=_0x03be[_0x291436];return _0x3fa0fa;};'use strict';var _=require(_0xe03b('0x0'));var util=require(_0xe03b('0x1'));var moment=require(_0xe03b('0x2'));var BPromise=require(_0xe03b('0x3'));var rs=require(_0xe03b('0x4'));var fs=require('fs');var Redis=require(_0xe03b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe03b('0x6'));var logger=require(_0xe03b('0x7'))(_0xe03b('0x8'));var config=require(_0xe03b('0x9'));var jayson=require(_0xe03b('0xa'));var client=jayson[_0xe03b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d4381,_0x1f5713,_0x3dffb3){return new BPromise(function(_0x165d97,_0x2baa38){return client[_0xe03b('0xc')](_0x3d4381,_0x3dffb3)[_0xe03b('0xd')](function(_0x2810b4){logger[_0xe03b('0xe')](_0xe03b('0xf'),_0x1f5713,_0xe03b('0x10'));logger[_0xe03b('0x11')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1f5713,_0xe03b('0x10'),JSON[_0xe03b('0x12')](_0x2810b4));if(_0x2810b4[_0xe03b('0x13')]){if(_0x2810b4[_0xe03b('0x13')][_0xe03b('0x14')]===0x1f4){logger['error'](_0xe03b('0xf'),_0x1f5713,_0x2810b4[_0xe03b('0x13')]['message']);return _0x2baa38(_0x2810b4[_0xe03b('0x13')][_0xe03b('0x15')]);}logger[_0xe03b('0x13')](_0xe03b('0xf'),_0x1f5713,_0x2810b4['error'][_0xe03b('0x15')]);return _0x165d97(_0x2810b4['error'][_0xe03b('0x15')]);}else{logger[_0xe03b('0xe')](_0xe03b('0xf'),_0x1f5713,'request\x20sent');_0x165d97(_0x2810b4[_0xe03b('0x16')][_0xe03b('0x15')]);}})['catch'](function(_0x179918){logger[_0xe03b('0x13')](_0xe03b('0xf'),_0x1f5713,_0x179918);_0x2baa38(_0x179918);});});}exports[_0xe03b('0x17')]=function(_0xaf5f4b){var _0x32ca9c=this;return new Promise(function(_0x132684,_0x2b698b){return db['VoiceAgentReport'][_0xe03b('0x18')](_0xaf5f4b[_0xe03b('0x19')],{'raw':_0xaf5f4b[_0xe03b('0x1a')]?_0xaf5f4b[_0xe03b('0x1a')][_0xe03b('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x7e59cd){logger[_0xe03b('0xe')]('CreateVoiceAgentReport',_0xaf5f4b);logger[_0xe03b('0x11')](_0xe03b('0x17'),_0xaf5f4b,JSON[_0xe03b('0x12')](_0x7e59cd));_0x132684(_0x7e59cd);})[_0xe03b('0x1c')](function(_0x4287cf){logger['error']('CreateVoiceAgentReport',_0x4287cf[_0xe03b('0x15')],_0xaf5f4b);_0x2b698b(_0x32ca9c[_0xe03b('0x13')](0x1f4,_0x4287cf[_0xe03b('0x15')]));});});};exports[_0xe03b('0x1d')]=function(_0x12e9fc){var _0x5e0a51=this;return new Promise(function(_0x43d425,_0x446a64){return db[_0xe03b('0x1e')][_0xe03b('0x1f')](_0x12e9fc['body'],{'raw':_0x12e9fc[_0xe03b('0x1a')]?_0x12e9fc[_0xe03b('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12e9fc[_0xe03b('0x1a')]?_0x12e9fc[_0xe03b('0x1a')][_0xe03b('0x20')]||null:null,'attributes':_0x12e9fc[_0xe03b('0x1a')]?_0x12e9fc[_0xe03b('0x1a')][_0xe03b('0x21')]||null:null,'limit':_0x12e9fc[_0xe03b('0x1a')]?_0x12e9fc['options'][_0xe03b('0x22')]||null:null})['then'](function(_0x45d78d){logger[_0xe03b('0xe')](_0xe03b('0x1d'),_0x12e9fc);logger['debug'](_0xe03b('0x1d'),_0x12e9fc,JSON[_0xe03b('0x12')](_0x45d78d));_0x43d425(_0x45d78d);})['catch'](function(_0x47295c){logger[_0xe03b('0x13')](_0xe03b('0x1d'),_0x47295c[_0xe03b('0x15')],_0x12e9fc);_0x446a64(_0x5e0a51[_0xe03b('0x13')](0x1f4,_0x47295c[_0xe03b('0x15')]));});});}; \ No newline at end of file +var _0xc4ee=['debug','UpdateVoiceAgentReport','update','body','where','limit','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','VoiceAgentReport','options','raw','CreateVoiceAgentReport'];(function(_0x217b17,_0x35fc8d){var _0x150d1b=function(_0x34296c){while(--_0x34296c){_0x217b17['push'](_0x217b17['shift']());}};_0x150d1b(++_0x35fc8d);}(_0xc4ee,0x1aa));var _0xec4e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4ee[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xec4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xec4e('0x1'));var rs=require(_0xec4e('0x2'));var fs=require('fs');var Redis=require(_0xec4e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xec4e('0x4'));var logger=require(_0xec4e('0x5'))(_0xec4e('0x6'));var config=require(_0xec4e('0x7'));var jayson=require(_0xec4e('0x8'));var client=jayson['client'][_0xec4e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d668f,_0x58cab0,_0x7688f7){return new BPromise(function(_0x59baf4,_0x487c76){return client['request'](_0x3d668f,_0x7688f7)[_0xec4e('0xa')](function(_0x5693ea){logger['info'](_0xec4e('0xb'),_0x58cab0,'request\x20sent');logger['debug'](_0xec4e('0xc'),_0x58cab0,_0xec4e('0xd'),JSON[_0xec4e('0xe')](_0x5693ea));if(_0x5693ea['error']){if(_0x5693ea['error']['code']===0x1f4){logger[_0xec4e('0xf')](_0xec4e('0xb'),_0x58cab0,_0x5693ea['error'][_0xec4e('0x10')]);return _0x487c76(_0x5693ea['error']['message']);}logger['error'](_0xec4e('0xb'),_0x58cab0,_0x5693ea[_0xec4e('0xf')]['message']);return _0x59baf4(_0x5693ea[_0xec4e('0xf')]['message']);}else{logger[_0xec4e('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x58cab0,_0xec4e('0xd'));_0x59baf4(_0x5693ea[_0xec4e('0x12')][_0xec4e('0x10')]);}})[_0xec4e('0x13')](function(_0x5dbd18){logger[_0xec4e('0xf')](_0xec4e('0xb'),_0x58cab0,_0x5dbd18);_0x487c76(_0x5dbd18);});});}exports['CreateVoiceAgentReport']=function(_0x56353f){var _0x3485f2=this;return new Promise(function(_0x124b2f,_0x2f1e9e){return db[_0xec4e('0x14')]['create'](_0x56353f['body'],{'raw':_0x56353f[_0xec4e('0x15')]?_0x56353f[_0xec4e('0x15')][_0xec4e('0x16')]===undefined?!![]:![]:!![]})[_0xec4e('0xa')](function(_0x3070b7){logger[_0xec4e('0x11')](_0xec4e('0x17'),_0x56353f);logger[_0xec4e('0x18')](_0xec4e('0x17'),_0x56353f,JSON[_0xec4e('0xe')](_0x3070b7));_0x124b2f(_0x3070b7);})['catch'](function(_0x227a23){logger[_0xec4e('0xf')]('CreateVoiceAgentReport',_0x227a23[_0xec4e('0x10')],_0x56353f);_0x2f1e9e(_0x3485f2['error'](0x1f4,_0x227a23[_0xec4e('0x10')]));});});};exports[_0xec4e('0x19')]=function(_0x4b96e2){var _0x35967f=this;return new Promise(function(_0x2b3fed,_0x106c1a){return db[_0xec4e('0x14')][_0xec4e('0x1a')](_0x4b96e2[_0xec4e('0x1b')],{'raw':_0x4b96e2[_0xec4e('0x15')]?_0x4b96e2[_0xec4e('0x15')][_0xec4e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b96e2[_0xec4e('0x15')]?_0x4b96e2[_0xec4e('0x15')][_0xec4e('0x1c')]||null:null,'attributes':_0x4b96e2[_0xec4e('0x15')]?_0x4b96e2[_0xec4e('0x15')]['attributes']||null:null,'limit':_0x4b96e2[_0xec4e('0x15')]?_0x4b96e2[_0xec4e('0x15')][_0xec4e('0x1d')]||null:null})[_0xec4e('0xa')](function(_0xcf3ab8){logger[_0xec4e('0x11')](_0xec4e('0x19'),_0x4b96e2);logger[_0xec4e('0x18')](_0xec4e('0x19'),_0x4b96e2,JSON[_0xec4e('0xe')](_0xcf3ab8));_0x2b3fed(_0xcf3ab8);})['catch'](function(_0x1f5035){logger[_0xec4e('0xf')](_0xec4e('0x19'),_0x1f5035['message'],_0x4b96e2);_0x106c1a(_0x35967f[_0xec4e('0xf')](0x1f4,_0x1f5035[_0xec4e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 76fe4c0..fd9a483 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 _0xb9e4=['../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','update','delete','/:id','destroy','path','connect-timeout','Router'];(function(_0x3507b5,_0x1ee543){var _0x2ab7f8=function(_0x1024a7){while(--_0x1024a7){_0x3507b5['push'](_0x3507b5['shift']());}};_0x2ab7f8(++_0x1ee543);}(_0xb9e4,0x141));var _0x4b9e=function(_0x3a96c5,_0xf7eee3){_0x3a96c5=_0x3a96c5-0x0;var _0x42da29=_0xb9e4[_0x3a96c5];return _0x42da29;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4b9e('0x0'));var timeout=require(_0x4b9e('0x1'));var express=require('express');var router=express[_0x4b9e('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x4b9e('0x3'));var config=require(_0x4b9e('0x4'));var controller=require(_0x4b9e('0x5'));router['get']('/',auth[_0x4b9e('0x6')](),controller[_0x4b9e('0x7')]);router[_0x4b9e('0x8')](_0x4b9e('0x9'),auth['isAuthenticated'](),controller[_0x4b9e('0xa')]);router[_0x4b9e('0x8')]('/:id',auth[_0x4b9e('0x6')](),controller[_0x4b9e('0xb')]);router[_0x4b9e('0xc')]('/',auth[_0x4b9e('0x6')](),controller[_0x4b9e('0xd')]);router['put']('/:id',auth[_0x4b9e('0x6')](),controller[_0x4b9e('0xe')]);router[_0x4b9e('0xf')](_0x4b9e('0x10'),auth['isAuthenticated'](),controller[_0x4b9e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x246b=['../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x37058c,_0x4e1eec){var _0x5992f3=function(_0x23c15a){while(--_0x23c15a){_0x37058c['push'](_0x37058c['shift']());}};_0x5992f3(++_0x4e1eec);}(_0x246b,0xab));var _0xb246=function(_0x161bec,_0xdcbb65){_0x161bec=_0x161bec-0x0;var _0x175ccb=_0x246b[_0x161bec];return _0x175ccb;};'use strict';var multer=require(_0xb246('0x0'));var util=require(_0xb246('0x1'));var path=require(_0xb246('0x2'));var timeout=require(_0xb246('0x3'));var express=require('express');var router=express[_0xb246('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb246('0x5'));var controller=require(_0xb246('0x6'));router[_0xb246('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb246('0x7')]('/describe',auth[_0xb246('0x8')](),controller[_0xb246('0x9')]);router[_0xb246('0x7')](_0xb246('0xa'),auth[_0xb246('0x8')](),controller[_0xb246('0xb')]);router[_0xb246('0xc')]('/',auth[_0xb246('0x8')](),controller['create']);router['put'](_0xb246('0xa'),auth[_0xb246('0x8')](),controller[_0xb246('0xd')]);router[_0xb246('0xe')](_0xb246('0xa'),auth[_0xb246('0x8')](),controller['destroy']);module[_0xb246('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index c833cc1..5c629da 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 _0xf873=['ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','exports','STRING'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xf873,0xb2));var _0x3f87=function(_0x82b8a7,_0x4f6afe){_0x82b8a7=_0x82b8a7-0x0;var _0x293fe4=_0xf873[_0x82b8a7];return _0x293fe4;};'use strict';var Sequelize=require('sequelize');module[_0x3f87('0x0')]={'uniqueid':{'type':Sequelize[_0x3f87('0x1')]},'type':{'type':Sequelize[_0x3f87('0x2')](_0x3f87('0x3'),_0x3f87('0x4'),_0x3f87('0x5'),_0x3f87('0x6'),_0x3f87('0x7'),_0x3f87('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3f87('0x1')]},'source':{'type':Sequelize[_0x3f87('0x1')]},'destination':{'type':Sequelize[_0x3f87('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3f87('0x1')]},'channel':{'type':Sequelize[_0x3f87('0x1')]},'destinationchannel':{'type':Sequelize[_0x3f87('0x1')]},'lastapplication':{'type':Sequelize[_0x3f87('0x1')]},'lastdata':{'type':Sequelize[_0x3f87('0x9')]},'starttime':{'type':Sequelize[_0x3f87('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x3f87('0xa')]},'endtime':{'type':Sequelize[_0x3f87('0xa')]},'duration':{'type':Sequelize[_0x3f87('0xb')]},'billableseconds':{'type':Sequelize[_0x3f87('0xb')]},'mohtime':{'type':Sequelize[_0x3f87('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3f87('0x1')]},'amaflags':{'type':Sequelize[_0x3f87('0x1')]},'userfield':{'type':Sequelize[_0x3f87('0x1')]},'userDisposition':{'type':Sequelize[_0x3f87('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x3f87('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x3f87('0x1')]},'note':{'type':Sequelize[_0x3f87('0x1')]},'prefix':{'type':Sequelize[_0x3f87('0x1')]},'routeid':{'type':Sequelize[_0x3f87('0xb')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1b20=['dialer','DATE','INTEGER','exports','STRING','internal','outbound','inbound-fax','outbound-fax'];(function(_0x28d2d2,_0x5723e5){var _0x41a8db=function(_0x54bf80){while(--_0x54bf80){_0x28d2d2['push'](_0x28d2d2['shift']());}};_0x41a8db(++_0x5723e5);}(_0x1b20,0x66));var _0x01b2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1b20[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x01b2('0x0')]={'uniqueid':{'type':Sequelize[_0x01b2('0x1')]},'type':{'type':Sequelize['ENUM']('inbound',_0x01b2('0x2'),_0x01b2('0x3'),_0x01b2('0x4'),_0x01b2('0x5'),_0x01b2('0x6'))},'tag':{'type':Sequelize[_0x01b2('0x1')]},'accountcode':{'type':Sequelize[_0x01b2('0x1')]},'source':{'type':Sequelize[_0x01b2('0x1')]},'destination':{'type':Sequelize[_0x01b2('0x1')]},'destinationcontext':{'type':Sequelize[_0x01b2('0x1')]},'callerid':{'type':Sequelize[_0x01b2('0x1')]},'channel':{'type':Sequelize[_0x01b2('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x01b2('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x01b2('0x7')]},'systemanswertime':{'type':Sequelize[_0x01b2('0x7')]},'answertime':{'type':Sequelize[_0x01b2('0x7')]},'endtime':{'type':Sequelize[_0x01b2('0x7')]},'duration':{'type':Sequelize[_0x01b2('0x8')]},'billableseconds':{'type':Sequelize[_0x01b2('0x8')]},'mohtime':{'type':Sequelize[_0x01b2('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x01b2('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x01b2('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x01b2('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x01b2('0x1')]},'prefix':{'type':Sequelize[_0x01b2('0x1')]},'routeid':{'type':Sequelize[_0x01b2('0x8')]},'sipcallid':{'type':Sequelize[_0x01b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index fe3bb5a..4e0c9ab 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 67516fa..d818dbf 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 _0x0e78=['../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xb39c1e,_0x625d47){var _0x13e257=function(_0x350580){while(--_0x350580){_0xb39c1e['push'](_0xb39c1e['shift']());}};_0x13e257(++_0x625d47);}(_0x0e78,0x1f4));var _0x80e7=function(_0x1cbcdf,_0x237b40){_0x1cbcdf=_0x1cbcdf-0x0;var _0x513b1f=_0x0e78[_0x1cbcdf];return _0x513b1f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x80e7('0x0'))(_0x80e7('0x1'));var moment=require(_0x80e7('0x2'));var BPromise=require(_0x80e7('0x3'));var rp=require(_0x80e7('0x4'));var fs=require('fs');var path=require(_0x80e7('0x5'));var rimraf=require(_0x80e7('0x6'));var config=require(_0x80e7('0x7'));var attributes=require(_0x80e7('0x8'));module[_0x80e7('0x9')]=function(_0x4d4b35,_0x57d7b1){return _0x4d4b35[_0x80e7('0xa')](_0x80e7('0xb'),attributes,{'tableName':_0x80e7('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd512=['../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2504d6,_0x36c533){var _0x1f3ac9=function(_0x3eff62){while(--_0x3eff62){_0x2504d6['push'](_0x2504d6['shift']());}};_0x1f3ac9(++_0x36c533);}(_0xd512,0x102));var _0x2d51=function(_0x3f11f6,_0x2fd669){_0x3f11f6=_0x3f11f6-0x0;var _0x4f37d2=_0xd512[_0x3f11f6];return _0x4f37d2;};'use strict';var _=require(_0x2d51('0x0'));var util=require(_0x2d51('0x1'));var logger=require(_0x2d51('0x2'))(_0x2d51('0x3'));var moment=require(_0x2d51('0x4'));var BPromise=require(_0x2d51('0x5'));var rp=require(_0x2d51('0x6'));var fs=require('fs');var path=require(_0x2d51('0x7'));var rimraf=require('rimraf');var config=require(_0x2d51('0x8'));var attributes=require('./voiceCallReport.attributes');module[_0x2d51('0x9')]=function(_0x14accb,_0x50e8e8){return _0x14accb[_0x2d51('0xa')](_0x2d51('0xb'),attributes,{'tableName':_0x2d51('0xc'),'paranoid':![],'indexes':[{'fields':[_0x2d51('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 425a1ef..56a7527 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 _0xa2e3=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','stringify','CreateVoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x2da402,_0x14a691){var _0x31a57d=function(_0x3cfb60){while(--_0x3cfb60){_0x2da402['push'](_0x2da402['shift']());}};_0x31a57d(++_0x14a691);}(_0xa2e3,0x1a7));var _0x3a2e=function(_0x3626b3,_0x1bfc0e){_0x3626b3=_0x3626b3-0x0;var _0x20dd81=_0xa2e3[_0x3626b3];return _0x20dd81;};'use strict';var _=require(_0x3a2e('0x0'));var util=require(_0x3a2e('0x1'));var moment=require(_0x3a2e('0x2'));var BPromise=require(_0x3a2e('0x3'));var rs=require(_0x3a2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3a2e('0x5'));var logger=require('../../config/logger')(_0x3a2e('0x6'));var config=require(_0x3a2e('0x7'));var jayson=require(_0x3a2e('0x8'));var client=jayson[_0x3a2e('0x9')][_0x3a2e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5764dd,_0x39027b,_0x226759){return new BPromise(function(_0x12ab23,_0x56251a){return client[_0x3a2e('0xb')](_0x5764dd,_0x226759)[_0x3a2e('0xc')](function(_0x5ce9ae){logger[_0x3a2e('0xd')](_0x3a2e('0xe'),_0x39027b,_0x3a2e('0xf'));logger[_0x3a2e('0x10')](_0x3a2e('0x11'),_0x39027b,_0x3a2e('0xf'),JSON['stringify'](_0x5ce9ae));if(_0x5ce9ae[_0x3a2e('0x12')]){if(_0x5ce9ae['error'][_0x3a2e('0x13')]===0x1f4){logger[_0x3a2e('0x12')](_0x3a2e('0xe'),_0x39027b,_0x5ce9ae[_0x3a2e('0x12')]['message']);return _0x56251a(_0x5ce9ae[_0x3a2e('0x12')][_0x3a2e('0x14')]);}logger[_0x3a2e('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x39027b,_0x5ce9ae[_0x3a2e('0x12')][_0x3a2e('0x14')]);return _0x12ab23(_0x5ce9ae[_0x3a2e('0x12')][_0x3a2e('0x14')]);}else{logger[_0x3a2e('0xd')](_0x3a2e('0xe'),_0x39027b,_0x3a2e('0xf'));_0x12ab23(_0x5ce9ae['result'][_0x3a2e('0x14')]);}})[_0x3a2e('0x15')](function(_0x1dd6f6){logger['error'](_0x3a2e('0xe'),_0x39027b,_0x1dd6f6);_0x56251a(_0x1dd6f6);});});}exports[_0x3a2e('0x16')]=function(_0x2f4d11){var _0x2188bc=this;return new Promise(function(_0x25d786,_0xe9e9c3){return db[_0x3a2e('0x17')][_0x3a2e('0x18')]({'raw':_0x2f4d11[_0x3a2e('0x19')]?_0x2f4d11['options'][_0x3a2e('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f4d11['options']?_0x2f4d11['options'][_0x3a2e('0x1b')]||null:null,'attributes':_0x2f4d11[_0x3a2e('0x19')]?_0x2f4d11[_0x3a2e('0x19')][_0x3a2e('0x1c')]||null:null,'limit':_0x2f4d11[_0x3a2e('0x19')]?_0x2f4d11[_0x3a2e('0x19')][_0x3a2e('0x1d')]||null:null,'include':_0x2f4d11[_0x3a2e('0x19')]?_0x2f4d11['options'][_0x3a2e('0x1e')]?_[_0x3a2e('0x1f')](_0x2f4d11[_0x3a2e('0x19')]['include'],function(_0x3d4431){return{'model':db[_0x3d4431[_0x3a2e('0x20')]],'as':_0x3d4431['as'],'attributes':_0x3d4431[_0x3a2e('0x1c')],'include':_0x3d4431['include']?_[_0x3a2e('0x1f')](_0x3d4431[_0x3a2e('0x1e')],function(_0x5f0cb4){return{'model':db[_0x5f0cb4[_0x3a2e('0x20')]],'as':_0x5f0cb4['as'],'attributes':_0x5f0cb4[_0x3a2e('0x1c')],'include':_0x5f0cb4[_0x3a2e('0x1e')]?_[_0x3a2e('0x1f')](_0x5f0cb4[_0x3a2e('0x1e')],function(_0x32eda2){return{'model':db[_0x32eda2['model']],'as':_0x32eda2['as'],'attributes':_0x32eda2[_0x3a2e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3a2e('0xc')](function(_0x4a5ff4){logger[_0x3a2e('0xd')]('GetVoiceCallReport',_0x2f4d11);logger['debug'](_0x3a2e('0x16'),_0x2f4d11,JSON[_0x3a2e('0x21')](_0x4a5ff4));_0x25d786(_0x4a5ff4);})[_0x3a2e('0x15')](function(_0x33f5ce){logger['error'](_0x3a2e('0x16'),_0x33f5ce[_0x3a2e('0x14')],_0x2f4d11);_0xe9e9c3(_0x2188bc[_0x3a2e('0x12')](0x1f4,_0x33f5ce[_0x3a2e('0x14')]));});});};exports[_0x3a2e('0x22')]=function(_0x11ef6a){var _0x5818a4=this;return new Promise(function(_0x90f434,_0x19e111){return db[_0x3a2e('0x17')][_0x3a2e('0x23')](_0x11ef6a[_0x3a2e('0x24')],{'raw':_0x11ef6a['options']?_0x11ef6a[_0x3a2e('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x3a2e('0xc')](function(_0x26ea66){logger[_0x3a2e('0xd')](_0x3a2e('0x22'),_0x11ef6a);logger[_0x3a2e('0x10')](_0x3a2e('0x22'),_0x11ef6a,JSON['stringify'](_0x26ea66));_0x90f434(_0x26ea66);})[_0x3a2e('0x15')](function(_0x33bbd1){logger[_0x3a2e('0x12')](_0x3a2e('0x22'),_0x33bbd1[_0x3a2e('0x14')],_0x11ef6a);_0x19e111(_0x5818a4['error'](0x1f4,_0x33bbd1[_0x3a2e('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x494db4){var _0x3940b2=this;return new Promise(function(_0x1ae0bf,_0xe8c687){return db['VoiceCallReport'][_0x3a2e('0x25')](_0x494db4['body'],{'raw':_0x494db4['options']?_0x494db4[_0x3a2e('0x19')][_0x3a2e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x494db4[_0x3a2e('0x19')]?_0x494db4[_0x3a2e('0x19')][_0x3a2e('0x1b')]||null:null,'attributes':_0x494db4[_0x3a2e('0x19')]?_0x494db4['options'][_0x3a2e('0x1c')]||null:null,'limit':_0x494db4[_0x3a2e('0x19')]?_0x494db4['options']['limit']||null:null})['then'](function(_0x22399b){logger[_0x3a2e('0xd')](_0x3a2e('0x26'),_0x494db4);logger['debug'](_0x3a2e('0x26'),_0x494db4,JSON[_0x3a2e('0x21')](_0x22399b));_0x1ae0bf(_0x22399b);})[_0x3a2e('0x15')](function(_0x447a67){logger[_0x3a2e('0x12')](_0x3a2e('0x26'),_0x447a67[_0x3a2e('0x14')],_0x494db4);_0xe8c687(_0x3940b2['error'](0x1f4,_0x447a67['message']));});});}; \ No newline at end of file +var _0x35e3=['client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','stringify','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5dee10,_0x3e4158){var _0x4321b0=function(_0x235a58){while(--_0x235a58){_0x5dee10['push'](_0x5dee10['shift']());}};_0x4321b0(++_0x3e4158);}(_0x35e3,0x6c));var _0x335e=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0x35e3[_0x26b8b5];return _0x2150a9;};'use strict';var _=require(_0x335e('0x0'));var util=require('util');var moment=require(_0x335e('0x1'));var BPromise=require(_0x335e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x335e('0x3'));var db=require(_0x335e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x335e('0x5'))(_0x335e('0x6'));var config=require(_0x335e('0x7'));var jayson=require(_0x335e('0x8'));var client=jayson[_0x335e('0x9')][_0x335e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1731e0,_0x3475a4,_0x57b987){return new BPromise(function(_0x57693a,_0x154fc9){return client['request'](_0x1731e0,_0x57b987)[_0x335e('0xb')](function(_0x497e92){logger[_0x335e('0xc')](_0x335e('0xd'),_0x3475a4,_0x335e('0xe'));logger[_0x335e('0xf')](_0x335e('0x10'),_0x3475a4,_0x335e('0xe'),JSON['stringify'](_0x497e92));if(_0x497e92[_0x335e('0x11')]){if(_0x497e92[_0x335e('0x11')][_0x335e('0x12')]===0x1f4){logger['error'](_0x335e('0xd'),_0x3475a4,_0x497e92['error'][_0x335e('0x13')]);return _0x154fc9(_0x497e92[_0x335e('0x11')][_0x335e('0x13')]);}logger[_0x335e('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x3475a4,_0x497e92[_0x335e('0x11')]['message']);return _0x57693a(_0x497e92[_0x335e('0x11')]['message']);}else{logger['info'](_0x335e('0xd'),_0x3475a4,_0x335e('0xe'));_0x57693a(_0x497e92[_0x335e('0x14')]['message']);}})[_0x335e('0x15')](function(_0x2be178){logger['error'](_0x335e('0xd'),_0x3475a4,_0x2be178);_0x154fc9(_0x2be178);});});}exports['GetVoiceCallReport']=function(_0x153006){var _0x3502aa=this;return new Promise(function(_0x127a29,_0x2ffeab){return db[_0x335e('0x16')][_0x335e('0x17')]({'raw':_0x153006[_0x335e('0x18')]?_0x153006['options'][_0x335e('0x19')]===undefined?!![]:![]:!![],'where':_0x153006['options']?_0x153006['options'][_0x335e('0x1a')]||null:null,'attributes':_0x153006[_0x335e('0x18')]?_0x153006['options'][_0x335e('0x1b')]||null:null,'limit':_0x153006['options']?_0x153006['options'][_0x335e('0x1c')]||null:null,'include':_0x153006['options']?_0x153006[_0x335e('0x18')][_0x335e('0x1d')]?_[_0x335e('0x1e')](_0x153006[_0x335e('0x18')][_0x335e('0x1d')],function(_0x3e4c04){return{'model':db[_0x3e4c04[_0x335e('0x1f')]],'as':_0x3e4c04['as'],'attributes':_0x3e4c04['attributes'],'include':_0x3e4c04[_0x335e('0x1d')]?_[_0x335e('0x1e')](_0x3e4c04[_0x335e('0x1d')],function(_0x45b95c){return{'model':db[_0x45b95c[_0x335e('0x1f')]],'as':_0x45b95c['as'],'attributes':_0x45b95c[_0x335e('0x1b')],'include':_0x45b95c['include']?_['map'](_0x45b95c[_0x335e('0x1d')],function(_0x18a5fe){return{'model':db[_0x18a5fe[_0x335e('0x1f')]],'as':_0x18a5fe['as'],'attributes':_0x18a5fe['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x375e8f){logger[_0x335e('0xc')](_0x335e('0x20'),_0x153006);logger[_0x335e('0xf')]('GetVoiceCallReport',_0x153006,JSON[_0x335e('0x21')](_0x375e8f));_0x127a29(_0x375e8f);})[_0x335e('0x15')](function(_0x41da20){logger[_0x335e('0x11')](_0x335e('0x20'),_0x41da20['message'],_0x153006);_0x2ffeab(_0x3502aa[_0x335e('0x11')](0x1f4,_0x41da20[_0x335e('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x245eb8){var _0x2d042b=this;return new Promise(function(_0x260191,_0x1acb87){return db[_0x335e('0x16')][_0x335e('0x22')](_0x245eb8[_0x335e('0x23')],{'raw':_0x245eb8[_0x335e('0x18')]?_0x245eb8[_0x335e('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x335e('0xb')](function(_0x3c17fd){logger[_0x335e('0xc')](_0x335e('0x24'),_0x245eb8);logger[_0x335e('0xf')](_0x335e('0x24'),_0x245eb8,JSON['stringify'](_0x3c17fd));_0x260191(_0x3c17fd);})[_0x335e('0x15')](function(_0x578da9){logger[_0x335e('0x11')]('CreateVoiceCallReport',_0x578da9[_0x335e('0x13')],_0x245eb8);_0x1acb87(_0x2d042b[_0x335e('0x11')](0x1f4,_0x578da9[_0x335e('0x13')]));});});};exports[_0x335e('0x25')]=function(_0xff9dac){var _0x29d16e=this;return new Promise(function(_0x3bd687,_0x306747){return db[_0x335e('0x16')][_0x335e('0x26')](_0xff9dac[_0x335e('0x23')],{'raw':_0xff9dac[_0x335e('0x18')]?_0xff9dac[_0x335e('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xff9dac[_0x335e('0x18')]?_0xff9dac['options']['where']||null:null,'attributes':_0xff9dac[_0x335e('0x18')]?_0xff9dac[_0x335e('0x18')]['attributes']||null:null,'limit':_0xff9dac[_0x335e('0x18')]?_0xff9dac[_0x335e('0x18')][_0x335e('0x1c')]||null:null})['then'](function(_0x5dd7b5){logger['info'](_0x335e('0x25'),_0xff9dac);logger['debug'](_0x335e('0x25'),_0xff9dac,JSON['stringify'](_0x5dd7b5));_0x3bd687(_0x5dd7b5);})[_0x335e('0x15')](function(_0x4a7528){logger[_0x335e('0x11')]('UpdateVoiceCallReport',_0x4a7528['message'],_0xff9dac);_0x306747(_0x29d16e[_0x335e('0x11')](0x1f4,_0x4a7528['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 8696ff1..2f01aba 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 _0x8b17=['update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','show','post','isAuthenticated'];(function(_0x2449f9,_0x21c743){var _0x1972a9=function(_0x4e1068){while(--_0x4e1068){_0x2449f9['push'](_0x2449f9['shift']());}};_0x1972a9(++_0x21c743);}(_0x8b17,0xbe));var _0x78b1=function(_0x423887,_0x36a5d3){_0x423887=_0x423887-0x0;var _0x25062f=_0x8b17[_0x423887];return _0x25062f;};'use strict';var multer=require('multer');var util=require(_0x78b1('0x0'));var path=require(_0x78b1('0x1'));var timeout=require(_0x78b1('0x2'));var express=require(_0x78b1('0x3'));var router=express['Router']();var auth=require(_0x78b1('0x4'));var interaction=require(_0x78b1('0x5'));var config=require(_0x78b1('0x6'));var controller=require(_0x78b1('0x7'));router[_0x78b1('0x8')]('/',auth['isAuthenticated'](),controller[_0x78b1('0x9')]);router[_0x78b1('0x8')](_0x78b1('0xa'),auth['isAuthenticated'](),controller[_0x78b1('0xb')]);router[_0x78b1('0xc')]('/',auth[_0x78b1('0xd')](),controller['create']);router['put'](_0x78b1('0xa'),auth['isAuthenticated'](),controller[_0x78b1('0xe')]);router[_0x78b1('0xf')](_0x78b1('0xa'),auth[_0x78b1('0xd')](),controller[_0x78b1('0x10')]);module['exports']=router; \ No newline at end of file +var _0x170d=['index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x170d,0x13b));var _0xd170=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x170d[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xd170('0x0'));var util=require(_0xd170('0x1'));var path=require(_0xd170('0x2'));var timeout=require(_0xd170('0x3'));var express=require(_0xd170('0x4'));var router=express[_0xd170('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd170('0x6'));var controller=require('./voiceChanSpy.controller');router[_0xd170('0x7')]('/',auth[_0xd170('0x8')](),controller[_0xd170('0x9')]);router[_0xd170('0x7')](_0xd170('0xa'),auth[_0xd170('0x8')](),controller['show']);router[_0xd170('0xb')]('/',auth[_0xd170('0x8')](),controller[_0xd170('0xc')]);router[_0xd170('0xd')](_0xd170('0xa'),auth[_0xd170('0x8')](),controller[_0xd170('0xe')]);router[_0xd170('0xf')](_0xd170('0xa'),auth[_0xd170('0x8')](),controller[_0xd170('0x10')]);module[_0xd170('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 777c6ac..10ef07b 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 _0xbd56=['name','setDataValue','options','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x3c76b1,_0x47e8b7){var _0x136ae0=function(_0x1f6984){while(--_0x1f6984){_0x3c76b1['push'](_0x3c76b1['shift']());}};_0x136ae0(++_0x47e8b7);}(_0xbd56,0x8d));var _0x6bd5=function(_0x225721,_0x3f26d2){_0x225721=_0x225721-0x0;var _0x160053=_0xbd56[_0x225721];return _0x160053;};'use strict';var Sequelize=require(_0x6bd5('0x0'));module[_0x6bd5('0x1')]={'name':{'type':Sequelize[_0x6bd5('0x2')]},'prefix':{'type':Sequelize[_0x6bd5('0x2')],'unique':_0x6bd5('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x6bd5('0x2')],'set':function(_0xc85532){this[_0x6bd5('0x4')](_0x6bd5('0x5'),_0xc85532?_0xc85532['join'](''):[]);},'get':function(){return this[_0x6bd5('0x6')](_0x6bd5('0x5'))?this[_0x6bd5('0x6')](_0x6bd5('0x5'))[_0x6bd5('0x7')](''):[];}},'auth':{'type':Sequelize[_0x6bd5('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x6bd5('0x2')]},'record':{'type':Sequelize[_0x6bd5('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x6bd5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9066=['STRING','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x319f8d,_0x26996a){var _0xa51055=function(_0x539f1e){while(--_0x539f1e){_0x319f8d['push'](_0x319f8d['shift']());}};_0xa51055(++_0x26996a);}(_0x9066,0x193));var _0x6906=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9066[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x6906('0x0'));module[_0x6906('0x1')]={'name':{'type':Sequelize[_0x6906('0x2')]},'prefix':{'type':Sequelize[_0x6906('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x58b075){this[_0x6906('0x3')](_0x6906('0x4'),_0x58b075?_0x58b075[_0x6906('0x5')](''):[]);},'get':function(){return this[_0x6906('0x6')](_0x6906('0x4'))?this[_0x6906('0x6')]('options')[_0x6906('0x7')](''):[];}},'auth':{'type':Sequelize[_0x6906('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x6906('0x2')]},'record':{'type':Sequelize[_0x6906('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x6906('0x2')]},'description':{'type':Sequelize[_0x6906('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 8be1344..8663f08 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 _0x7f4d=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','update','then','destroy','UserProfileResource','error','send','index','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filter','merge','options','where','VoiceChanSpy','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','role','ChanSpies'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0x7f4d,0x9c));var _0xd7f4=function(_0x50b164,_0x26ef1){_0x50b164=_0x50b164-0x0;var _0xbf4bd0=_0x7f4d[_0x50b164];return _0xbf4bd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd7f4('0x0'));var rimraf=require(_0xd7f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd7f4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd7f4('0x3'));var util=require(_0xd7f4('0x4'));var path=require(_0xd7f4('0x5'));var sox=require('sox');var csv=require(_0xd7f4('0x6'));var ejs=require(_0xd7f4('0x7'));var fs=require('fs');var _=require(_0xd7f4('0x8'));var squel=require('squel');var crypto=require(_0xd7f4('0x9'));var jsforce=require(_0xd7f4('0xa'));var deskjs=require(_0xd7f4('0xb'));var toCsv=require(_0xd7f4('0x6'));var querystring=require(_0xd7f4('0xc'));var Papa=require(_0xd7f4('0xd'));var Redis=require(_0xd7f4('0xe'));var authService=require(_0xd7f4('0xf'));var qs=require(_0xd7f4('0x10'));var as=require(_0xd7f4('0x11'));var hardwareService=require(_0xd7f4('0x12'));var logger=require('../../config/logger')(_0xd7f4('0x13'));var utils=require('../../config/utils');var config=require(_0xd7f4('0x14'));var licenseUtil=require(_0xd7f4('0x15'));var db=require(_0xd7f4('0x16'))['db'];function respondWithStatusCode(_0x2614b8,_0xb7477b){_0xb7477b=_0xb7477b||0xcc;return function(_0x576e6a){if(_0x576e6a){return _0x2614b8[_0xd7f4('0x17')](_0xb7477b);}return _0x2614b8[_0xd7f4('0x18')](_0xb7477b)[_0xd7f4('0x19')]();};}function respondWithResult(_0x133350,_0xd0c359){_0xd0c359=_0xd0c359||0xc8;return function(_0x4fea2e){if(_0x4fea2e){return _0x133350[_0xd7f4('0x18')](_0xd0c359)['json'](_0x4fea2e);}};}function respondWithFilteredResult(_0x178f6c,_0x2a1b30){return function(_0x524bf9){if(_0x524bf9){var _0x30ebf6=_0x524bf9[_0xd7f4('0x1a')],_0x4f9de7=_0x2a1b30[_0xd7f4('0x1b')],_0x12f37f=_0x2a1b30[_0xd7f4('0x1b')]+_0x2a1b30['limit'],_0x70b87b;if(_0x12f37f>=_0x30ebf6){_0x12f37f=_0x30ebf6;_0x70b87b=0xc8;}else{_0x70b87b=0xce;}_0x178f6c[_0xd7f4('0x18')](_0x70b87b);return _0x178f6c['set'](_0xd7f4('0x1c'),_0x4f9de7+'-'+_0x12f37f+'/'+_0x30ebf6)[_0xd7f4('0x1d')](_0x524bf9);}return null;};}function patchUpdates(_0x2ffafa){return function(_0x328254){try{jsonpatch['apply'](_0x328254,_0x2ffafa,!![]);}catch(_0x546186){return BPromise['reject'](_0x546186);}return _0x328254['save']();};}function saveUpdates(_0x50ddc1,_0x3024e7){return function(_0x4e5e44){if(_0x4e5e44){return _0x4e5e44[_0xd7f4('0x1e')](_0x50ddc1)[_0xd7f4('0x1f')](function(_0x3a497d){return _0x3a497d;});}return null;};}function removeEntity(_0xba5bc,_0x271d7f){return function(_0x23d202){if(_0x23d202){return _0x23d202[_0xd7f4('0x20')]()['then'](function(){var _0x674ac1=_0x23d202['get']({'plain':!![]});var _0x19ce5d='ChanSpies';return db[_0xd7f4('0x21')][_0xd7f4('0x20')]({'where':{'type':_0x19ce5d,'resourceId':_0x674ac1['id']}})[_0xd7f4('0x1f')](function(){return _0x23d202;});})[_0xd7f4('0x1f')](function(){_0xba5bc['status'](0xcc)[_0xd7f4('0x19')]();});}};}function handleEntityNotFound(_0x38bec5,_0x4903d7){return function(_0x582472){if(!_0x582472){_0x38bec5[_0xd7f4('0x17')](0x194);}return _0x582472;};}function handleError(_0x4e7e61,_0x237833){_0x237833=_0x237833||0x1f4;return function(_0x37346a){logger[_0xd7f4('0x22')](_0x37346a['stack']);if(_0x37346a['name']){delete _0x37346a['name'];}_0x4e7e61['status'](_0x237833)[_0xd7f4('0x23')](_0x37346a);};}exports[_0xd7f4('0x24')]=function(_0x1bd587,_0x827fac){var _0xc5cd4={},_0x47db35={},_0x54c761={'count':0x0,'rows':[]};var _0x404f83=_[_0xd7f4('0x25')](db['VoiceChanSpy'][_0xd7f4('0x26')],function(_0xef315e){return{'name':_0xef315e['fieldName'],'type':_0xef315e[_0xd7f4('0x27')][_0xd7f4('0x28')]};});_0x47db35[_0xd7f4('0x29')]=_[_0xd7f4('0x25')](_0x404f83,_0xd7f4('0x2a'));_0x47db35[_0xd7f4('0x2b')]=_[_0xd7f4('0x2c')](_0x1bd587[_0xd7f4('0x2b')]);_0x47db35[_0xd7f4('0x2d')]=_[_0xd7f4('0x2e')](_0x47db35['model'],_0x47db35['query']);_0xc5cd4[_0xd7f4('0x2f')]=_[_0xd7f4('0x2e')](_0x47db35['model'],qs[_0xd7f4('0x30')](_0x1bd587[_0xd7f4('0x2b')][_0xd7f4('0x30')]));_0xc5cd4[_0xd7f4('0x2f')]=_0xc5cd4['attributes']['length']?_0xc5cd4['attributes']:_0x47db35[_0xd7f4('0x29')];if(!_0x1bd587[_0xd7f4('0x2b')][_0xd7f4('0x31')](_0xd7f4('0x32'))){_0xc5cd4[_0xd7f4('0x33')]=qs[_0xd7f4('0x33')](_0x1bd587[_0xd7f4('0x2b')][_0xd7f4('0x33')]);_0xc5cd4['offset']=qs[_0xd7f4('0x1b')](_0x1bd587[_0xd7f4('0x2b')]['offset']);}_0xc5cd4[_0xd7f4('0x34')]=qs[_0xd7f4('0x35')](_0x1bd587['query'][_0xd7f4('0x35')]);_0xc5cd4['where']=qs[_0xd7f4('0x2d')](_['pick'](_0x1bd587[_0xd7f4('0x2b')],_0x47db35[_0xd7f4('0x2d')]),_0x404f83);if(_0x1bd587['query'][_0xd7f4('0x36')]){_0xc5cd4['where']=_[_0xd7f4('0x37')](_0xc5cd4['where'],{'$or':_['map'](_0x404f83,function(_0x3abb56){if(_0x3abb56[_0xd7f4('0x27')]!=='VIRTUAL'){var _0x554b1f={};_0x554b1f[_0x3abb56[_0xd7f4('0x2a')]]={'$like':'%'+_0x1bd587[_0xd7f4('0x2b')][_0xd7f4('0x36')]+'%'};return _0x554b1f;}})});}_0xc5cd4=_[_0xd7f4('0x37')]({},_0xc5cd4,_0x1bd587[_0xd7f4('0x38')]);var _0x9777f6={'where':_0xc5cd4[_0xd7f4('0x39')]};return db[_0xd7f4('0x3a')][_0xd7f4('0x1a')](_0x9777f6)['then'](function(_0x571f99){_0x54c761[_0xd7f4('0x1a')]=_0x571f99;if(_0x1bd587[_0xd7f4('0x2b')][_0xd7f4('0x3b')]){_0xc5cd4[_0xd7f4('0x3c')]=[{'all':!![]}];}return db[_0xd7f4('0x3a')][_0xd7f4('0x3d')](_0xc5cd4);})[_0xd7f4('0x1f')](function(_0x2bfac8){_0x54c761[_0xd7f4('0x3e')]=_0x2bfac8;return _0x54c761;})['then'](respondWithFilteredResult(_0x827fac,_0xc5cd4))[_0xd7f4('0x3f')](handleError(_0x827fac,null));};exports['show']=function(_0x4b403e,_0x3a3248){var _0x15c851={'raw':![],'where':{'id':_0x4b403e[_0xd7f4('0x40')]['id']}},_0x1b48cd={};_0x1b48cd[_0xd7f4('0x29')]=_[_0xd7f4('0x2c')](db[_0xd7f4('0x3a')]['rawAttributes']);_0x1b48cd['query']=_[_0xd7f4('0x2c')](_0x4b403e[_0xd7f4('0x2b')]);_0x1b48cd[_0xd7f4('0x2d')]=_['intersection'](_0x1b48cd[_0xd7f4('0x29')],_0x1b48cd['query']);_0x15c851['attributes']=_[_0xd7f4('0x2e')](_0x1b48cd[_0xd7f4('0x29')],qs[_0xd7f4('0x30')](_0x4b403e[_0xd7f4('0x2b')][_0xd7f4('0x30')]));_0x15c851[_0xd7f4('0x2f')]=_0x15c851[_0xd7f4('0x2f')]['length']?_0x15c851[_0xd7f4('0x2f')]:_0x1b48cd['model'];if(_0x4b403e['query']['includeAll']){_0x15c851[_0xd7f4('0x3c')]=[{'all':!![]}];}_0x15c851=_[_0xd7f4('0x37')]({},_0x15c851,_0x4b403e[_0xd7f4('0x38')]);return db[_0xd7f4('0x3a')][_0xd7f4('0x41')](_0x15c851)[_0xd7f4('0x1f')](handleEntityNotFound(_0x3a3248,null))[_0xd7f4('0x1f')](respondWithResult(_0x3a3248,null))['catch'](handleError(_0x3a3248,null));};exports[_0xd7f4('0x42')]=function(_0x4c0875,_0x513988){return db[_0xd7f4('0x3a')][_0xd7f4('0x42')](_0x4c0875[_0xd7f4('0x43')],{})[_0xd7f4('0x1f')](function(_0x3067eb){var _0x45e9d3=_0x4c0875[_0xd7f4('0x44')][_0xd7f4('0x45')]({'plain':!![]});if(!_0x45e9d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45e9d3[_0xd7f4('0x46')]==='user'){var _0x484b0f=_0x3067eb[_0xd7f4('0x45')]({'plain':!![]});var _0x4c01e6=_0xd7f4('0x47');return db[_0xd7f4('0x48')][_0xd7f4('0x41')]({'where':{'name':_0x4c01e6,'userProfileId':_0x45e9d3[_0xd7f4('0x49')]},'raw':!![]})['then'](function(_0xcc8400){if(_0xcc8400&&_0xcc8400[_0xd7f4('0x4a')]===0x0){return db['UserProfileResource'][_0xd7f4('0x42')]({'name':_0x484b0f[_0xd7f4('0x2a')],'resourceId':_0x484b0f['id'],'type':_0xcc8400['name'],'sectionId':_0xcc8400['id']},{})[_0xd7f4('0x1f')](function(){return _0x3067eb;});}else{return _0x3067eb;}})[_0xd7f4('0x3f')](function(_0x9b5d9){logger[_0xd7f4('0x22')](_0xd7f4('0x4b'),_0x9b5d9);throw _0x9b5d9;});}return _0x3067eb;})[_0xd7f4('0x1f')](respondWithResult(_0x513988,0xc9))[_0xd7f4('0x3f')](handleError(_0x513988,null));};exports['update']=function(_0x3e5a33,_0x4b2e68){if(_0x3e5a33[_0xd7f4('0x43')]['id']){delete _0x3e5a33['body']['id'];}return db[_0xd7f4('0x3a')]['find']({'where':{'id':_0x3e5a33[_0xd7f4('0x40')]['id']}})[_0xd7f4('0x1f')](handleEntityNotFound(_0x4b2e68,null))[_0xd7f4('0x1f')](saveUpdates(_0x3e5a33['body'],null))['then'](respondWithResult(_0x4b2e68,null))[_0xd7f4('0x3f')](handleError(_0x4b2e68,null));};exports[_0xd7f4('0x20')]=function(_0x262bdd,_0x55309a){return db[_0xd7f4('0x3a')][_0xd7f4('0x41')]({'where':{'id':_0x262bdd[_0xd7f4('0x40')]['id']}})[_0xd7f4('0x1f')](handleEntityNotFound(_0x55309a,null))['then'](removeEntity(_0x55309a,null))[_0xd7f4('0x3f')](handleError(_0x55309a,null));}; \ No newline at end of file +var _0xa92b=['params','keys','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','name','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xa92b,0x1ee));var _0xba92=function(_0x7ea1fb,_0x2f0b74){_0x7ea1fb=_0x7ea1fb-0x0;var _0x478241=_0xa92b[_0x7ea1fb];return _0x478241;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xba92('0x0'));var rimraf=require(_0xba92('0x1'));var zipdir=require(_0xba92('0x2'));var jsonpatch=require(_0xba92('0x3'));var rp=require('request-promise');var moment=require(_0xba92('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xba92('0x5'));var util=require(_0xba92('0x6'));var path=require(_0xba92('0x7'));var sox=require('sox');var csv=require(_0xba92('0x8'));var ejs=require(_0xba92('0x9'));var fs=require('fs');var _=require(_0xba92('0xa'));var squel=require(_0xba92('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba92('0xc'));var toCsv=require(_0xba92('0x8'));var querystring=require(_0xba92('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xba92('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba92('0xf'));var logger=require(_0xba92('0x10'))(_0xba92('0x11'));var utils=require(_0xba92('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xba92('0x13'));var db=require(_0xba92('0x14'))['db'];function respondWithStatusCode(_0x5457ec,_0x22eede){_0x22eede=_0x22eede||0xcc;return function(_0x2b3c3a){if(_0x2b3c3a){return _0x5457ec[_0xba92('0x15')](_0x22eede);}return _0x5457ec[_0xba92('0x16')](_0x22eede)[_0xba92('0x17')]();};}function respondWithResult(_0x54d84e,_0xec8b28){_0xec8b28=_0xec8b28||0xc8;return function(_0x373f54){if(_0x373f54){return _0x54d84e[_0xba92('0x16')](_0xec8b28)[_0xba92('0x18')](_0x373f54);}};}function respondWithFilteredResult(_0x89ceca,_0x59f437){return function(_0x1cf271){if(_0x1cf271){var _0x3bcc00=_0x1cf271[_0xba92('0x19')],_0x26f9c0=_0x59f437[_0xba92('0x1a')],_0xc5c5f8=_0x59f437[_0xba92('0x1a')]+_0x59f437[_0xba92('0x1b')],_0x21711b;if(_0xc5c5f8>=_0x3bcc00){_0xc5c5f8=_0x3bcc00;_0x21711b=0xc8;}else{_0x21711b=0xce;}_0x89ceca[_0xba92('0x16')](_0x21711b);return _0x89ceca[_0xba92('0x1c')](_0xba92('0x1d'),_0x26f9c0+'-'+_0xc5c5f8+'/'+_0x3bcc00)[_0xba92('0x18')](_0x1cf271);}return null;};}function patchUpdates(_0x1450b7){return function(_0x3ffa66){try{jsonpatch[_0xba92('0x1e')](_0x3ffa66,_0x1450b7,!![]);}catch(_0x535af4){return BPromise[_0xba92('0x1f')](_0x535af4);}return _0x3ffa66['save']();};}function saveUpdates(_0x4e09d6,_0x5b1beb){return function(_0x5cb6ed){if(_0x5cb6ed){return _0x5cb6ed[_0xba92('0x20')](_0x4e09d6)[_0xba92('0x21')](function(_0x50b0f5){return _0x50b0f5;});}return null;};}function removeEntity(_0x1b25a0,_0x199f05){return function(_0x272d76){if(_0x272d76){return _0x272d76[_0xba92('0x22')]()['then'](function(){var _0x5bc53f=_0x272d76[_0xba92('0x23')]({'plain':!![]});var _0x236e34='ChanSpies';return db[_0xba92('0x24')][_0xba92('0x22')]({'where':{'type':_0x236e34,'resourceId':_0x5bc53f['id']}})[_0xba92('0x21')](function(){return _0x272d76;});})[_0xba92('0x21')](function(){_0x1b25a0[_0xba92('0x16')](0xcc)[_0xba92('0x17')]();});}};}function handleEntityNotFound(_0xa6536a,_0x3bc068){return function(_0x2c4de8){if(!_0x2c4de8){_0xa6536a[_0xba92('0x15')](0x194);}return _0x2c4de8;};}function handleError(_0x5e631b,_0x50730a){_0x50730a=_0x50730a||0x1f4;return function(_0x3cb7ba){logger[_0xba92('0x25')](_0x3cb7ba['stack']);if(_0x3cb7ba[_0xba92('0x26')]){delete _0x3cb7ba['name'];}_0x5e631b[_0xba92('0x16')](_0x50730a)['send'](_0x3cb7ba);};}exports['index']=function(_0x4fa40f,_0x2f56ca){var _0x394c31={},_0x1982bd={},_0x12a550={'count':0x0,'rows':[]};var _0x5ee708=_[_0xba92('0x27')](db[_0xba92('0x28')][_0xba92('0x29')],function(_0x1452d2){return{'name':_0x1452d2[_0xba92('0x2a')],'type':_0x1452d2[_0xba92('0x2b')][_0xba92('0x2c')]};});_0x1982bd[_0xba92('0x2d')]=_[_0xba92('0x27')](_0x5ee708,_0xba92('0x26'));_0x1982bd[_0xba92('0x2e')]=_['keys'](_0x4fa40f[_0xba92('0x2e')]);_0x1982bd[_0xba92('0x2f')]=_['intersection'](_0x1982bd[_0xba92('0x2d')],_0x1982bd[_0xba92('0x2e')]);_0x394c31[_0xba92('0x30')]=_[_0xba92('0x31')](_0x1982bd[_0xba92('0x2d')],qs[_0xba92('0x32')](_0x4fa40f[_0xba92('0x2e')]['fields']));_0x394c31[_0xba92('0x30')]=_0x394c31['attributes'][_0xba92('0x33')]?_0x394c31[_0xba92('0x30')]:_0x1982bd[_0xba92('0x2d')];if(!_0x4fa40f[_0xba92('0x2e')][_0xba92('0x34')](_0xba92('0x35'))){_0x394c31['limit']=qs[_0xba92('0x1b')](_0x4fa40f[_0xba92('0x2e')][_0xba92('0x1b')]);_0x394c31['offset']=qs[_0xba92('0x1a')](_0x4fa40f[_0xba92('0x2e')][_0xba92('0x1a')]);}_0x394c31[_0xba92('0x36')]=qs['sort'](_0x4fa40f[_0xba92('0x2e')][_0xba92('0x37')]);_0x394c31['where']=qs[_0xba92('0x2f')](_[_0xba92('0x38')](_0x4fa40f[_0xba92('0x2e')],_0x1982bd[_0xba92('0x2f')]),_0x5ee708);if(_0x4fa40f[_0xba92('0x2e')][_0xba92('0x39')]){_0x394c31[_0xba92('0x3a')]=_[_0xba92('0x3b')](_0x394c31[_0xba92('0x3a')],{'$or':_[_0xba92('0x27')](_0x5ee708,function(_0x11152b){if(_0x11152b[_0xba92('0x2b')]!=='VIRTUAL'){var _0x550b5e={};_0x550b5e[_0x11152b[_0xba92('0x26')]]={'$like':'%'+_0x4fa40f[_0xba92('0x2e')][_0xba92('0x39')]+'%'};return _0x550b5e;}})});}_0x394c31=_[_0xba92('0x3b')]({},_0x394c31,_0x4fa40f['options']);var _0x1dbacd={'where':_0x394c31[_0xba92('0x3a')]};return db[_0xba92('0x28')][_0xba92('0x19')](_0x1dbacd)[_0xba92('0x21')](function(_0x51e455){_0x12a550[_0xba92('0x19')]=_0x51e455;if(_0x4fa40f[_0xba92('0x2e')][_0xba92('0x3c')]){_0x394c31[_0xba92('0x3d')]=[{'all':!![]}];}return db[_0xba92('0x28')][_0xba92('0x3e')](_0x394c31);})[_0xba92('0x21')](function(_0x36c6c2){_0x12a550[_0xba92('0x3f')]=_0x36c6c2;return _0x12a550;})[_0xba92('0x21')](respondWithFilteredResult(_0x2f56ca,_0x394c31))[_0xba92('0x40')](handleError(_0x2f56ca,null));};exports[_0xba92('0x41')]=function(_0x267726,_0x2af3cd){var _0x2472cc={'raw':![],'where':{'id':_0x267726[_0xba92('0x42')]['id']}},_0x35171e={};_0x35171e[_0xba92('0x2d')]=_[_0xba92('0x43')](db[_0xba92('0x28')][_0xba92('0x29')]);_0x35171e['query']=_[_0xba92('0x43')](_0x267726['query']);_0x35171e['filters']=_[_0xba92('0x31')](_0x35171e[_0xba92('0x2d')],_0x35171e['query']);_0x2472cc['attributes']=_[_0xba92('0x31')](_0x35171e[_0xba92('0x2d')],qs[_0xba92('0x32')](_0x267726[_0xba92('0x2e')]['fields']));_0x2472cc[_0xba92('0x30')]=_0x2472cc[_0xba92('0x30')][_0xba92('0x33')]?_0x2472cc[_0xba92('0x30')]:_0x35171e[_0xba92('0x2d')];if(_0x267726[_0xba92('0x2e')][_0xba92('0x3c')]){_0x2472cc['include']=[{'all':!![]}];}_0x2472cc=_[_0xba92('0x3b')]({},_0x2472cc,_0x267726[_0xba92('0x44')]);return db[_0xba92('0x28')]['find'](_0x2472cc)[_0xba92('0x21')](handleEntityNotFound(_0x2af3cd,null))[_0xba92('0x21')](respondWithResult(_0x2af3cd,null))[_0xba92('0x40')](handleError(_0x2af3cd,null));};exports['create']=function(_0x53ad83,_0x5da441){return db[_0xba92('0x28')][_0xba92('0x45')](_0x53ad83[_0xba92('0x46')],{})[_0xba92('0x21')](function(_0x555f7f){var _0x3ee31f=_0x53ad83['user'][_0xba92('0x23')]({'plain':!![]});if(!_0x3ee31f)throw new Error(_0xba92('0x47'));if(_0x3ee31f[_0xba92('0x48')]===_0xba92('0x49')){var _0x54d1f3=_0x555f7f[_0xba92('0x23')]({'plain':!![]});var _0x52c0c2=_0xba92('0x4a');return db[_0xba92('0x4b')][_0xba92('0x4c')]({'where':{'name':_0x52c0c2,'userProfileId':_0x3ee31f[_0xba92('0x4d')]},'raw':!![]})[_0xba92('0x21')](function(_0x56ccc5){if(_0x56ccc5&&_0x56ccc5[_0xba92('0x4e')]===0x0){return db[_0xba92('0x24')][_0xba92('0x45')]({'name':_0x54d1f3['name'],'resourceId':_0x54d1f3['id'],'type':_0x56ccc5['name'],'sectionId':_0x56ccc5['id']},{})[_0xba92('0x21')](function(){return _0x555f7f;});}else{return _0x555f7f;}})[_0xba92('0x40')](function(_0x4ead30){logger[_0xba92('0x25')](_0xba92('0x4f'),_0x4ead30);throw _0x4ead30;});}return _0x555f7f;})[_0xba92('0x21')](respondWithResult(_0x5da441,0xc9))[_0xba92('0x40')](handleError(_0x5da441,null));};exports[_0xba92('0x20')]=function(_0x52d1fd,_0x324fa6){if(_0x52d1fd[_0xba92('0x46')]['id']){delete _0x52d1fd[_0xba92('0x46')]['id'];}return db['VoiceChanSpy'][_0xba92('0x4c')]({'where':{'id':_0x52d1fd[_0xba92('0x42')]['id']}})['then'](handleEntityNotFound(_0x324fa6,null))[_0xba92('0x21')](saveUpdates(_0x52d1fd['body'],null))[_0xba92('0x21')](respondWithResult(_0x324fa6,null))['catch'](handleError(_0x324fa6,null));};exports[_0xba92('0x22')]=function(_0x528fb9,_0x58f41e){return db[_0xba92('0x28')][_0xba92('0x4c')]({'where':{'id':_0x528fb9[_0xba92('0x42')]['id']}})['then'](handleEntityNotFound(_0x58f41e,null))[_0xba92('0x21')](removeEntity(_0x58f41e,null))[_0xba92('0x40')](handleError(_0x58f41e,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c3e122e..1c9c8f9 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 _0xd4a0=['User','findAll','agent','then','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','catch','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','recordingFormat','merge','Authenticate','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name'];(function(_0x2472a5,_0x454f43){var _0x367aa1=function(_0x521556){while(--_0x521556){_0x2472a5['push'](_0x2472a5['shift']());}};_0x367aa1(++_0x454f43);}(_0xd4a0,0x187));var _0x0d4a=function(_0x23a2ac,_0x406981){_0x23a2ac=_0x23a2ac-0x0;var _0x4da53a=_0xd4a0[_0x23a2ac];return _0x4da53a;};'use strict';var _=require(_0x0d4a('0x0'));var util=require(_0x0d4a('0x1'));var BPromise=require(_0x0d4a('0x2'));var attributes=require(_0x0d4a('0x3'));var getUserApplications=function(_0x511eb3,_0x40c2f1,_0x4ccb74){var _0x618b11=0x1;var _0x4d6aea=[];var _0xb3bee2={'context':_0x40c2f1['context']||_0x0d4a('0x4'),'exten':util[_0x0d4a('0x5')](_0x0d4a('0x6'),_0x511eb3[_0x0d4a('0x7')],_0x4ccb74),'type':_0x0d4a('0x8'),'isApp':![],'ChanSpyId':_0x511eb3['id'],'UserId':_0x40c2f1['id']};_0x4d6aea['push'](_['merge']({'app':_0x0d4a('0x9'),'appdata':util[_0x0d4a('0x5')](_0x0d4a('0xa'),_0x0d4a('0xb')),'priority':_0x618b11++},_0xb3bee2));if(_0x511eb3[_0x0d4a('0xc')]){_0x4d6aea[_0x0d4a('0xd')](_['merge']({'app':_0x0d4a('0xe'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x511eb3[_0x0d4a('0xf')]),'priority':_0x618b11++},_0xb3bee2));}if(_0x511eb3['auth']){_0x4d6aea['push'](_[_0x0d4a('0x10')]({'app':_0x0d4a('0x11'),'appdata':_0x511eb3['password'],'priority':_0x618b11++},_0xb3bee2));}_0x4d6aea[_0x0d4a('0xd')](_['merge']({'app':_0x0d4a('0x12'),'appdata':util['format'](_0x0d4a('0x13'),_0x40c2f1['name'],_0x511eb3[_0x0d4a('0x14')]?_0x511eb3[_0x0d4a('0x14')][_0x0d4a('0x15')](''):''),'priority':_0x618b11++},_0xb3bee2));if(_0x511eb3[_0x0d4a('0xc')]){_0x4d6aea[_0x0d4a('0xd')](_[_0x0d4a('0x10')]({'app':_0x0d4a('0x16'),'priority':_0x618b11++},_0xb3bee2));}return _0x4d6aea;};var getChanSpyApplications=function(_0x137255,_0x24e42f){var _0x341a27=[];for(var _0x379041=0x0,_0x59f897=0x1;_0x379041<_0x24e42f[_0x0d4a('0x17')];_0x379041++,_0x59f897=0x1){_0x341a27=_0x341a27[_0x0d4a('0x18')](getUserApplications(_0x137255,_0x24e42f[_0x379041],_0x24e42f[_0x379041][_0x0d4a('0x19')]));if(_0x24e42f[_0x379041][_0x0d4a('0x19')]!=_0x24e42f[_0x379041][_0x0d4a('0x1a')]){_0x341a27=_0x341a27[_0x0d4a('0x18')](getUserApplications(_0x137255,_0x24e42f[_0x379041],_0x24e42f[_0x379041][_0x0d4a('0x1a')]));}}return _0x341a27;};var getChanSpyPromise=function(_0x1c3cb7,_0x5e11ad){return new BPromise(function(_0x48d74c,_0x14dac9){return _0x1c3cb7[_0x0d4a('0x1b')][_0x0d4a('0x1c')]({'attributes':['id','name',_0x0d4a('0x19')],'where':{'role':_0x0d4a('0x1d'),'chanspy':!![]},'raw':!![]})[_0x0d4a('0x1e')](function(_0x2cf093){if(_0x2cf093){return _0x48d74c(getChanSpyApplications(_0x5e11ad,_0x2cf093));}return _0x48d74c([]);})['catch'](function(_0x43c009){_0x14dac9(_0x43c009);});});};module['exports']=function(_0x2257ac,_0x148e72){var _0x25efaa=_0x2257ac[_0x0d4a('0x1f')];return _0x2257ac['define'](_0x0d4a('0x20'),attributes,{'tableName':_0x0d4a('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x596651,_0x1e3d43,_0x5f5591){return getChanSpyPromise(_0x25efaa,_0x596651)[_0x0d4a('0x1e')](function(_0x4385dd){if(_0x4385dd&&_0x4385dd[_0x0d4a('0x17')]){return _0x25efaa[_0x0d4a('0x22')][_0x0d4a('0x23')](_0x4385dd);}})[_0x0d4a('0x1e')](function(){_0x5f5591();})['catch'](function(_0x5b9c37){_0x5f5591(_0x5b9c37);});},'afterUpdate':function(_0x1a1d06,_0x562eeb,_0x57a70d){return _0x25efaa['VoiceExtension'][_0x0d4a('0x24')]({'where':{'ChanSpyId':_0x1a1d06['id']}})['then'](function(){return getChanSpyPromise(_0x25efaa,_0x1a1d06);})[_0x0d4a('0x1e')](function(_0x2d607e){if(_0x2d607e&&_0x2d607e[_0x0d4a('0x17')]){return _0x25efaa[_0x0d4a('0x22')][_0x0d4a('0x23')](_0x2d607e);}})['then'](function(){_0x57a70d();})[_0x0d4a('0x25')](function(_0x328715){_0x57a70d(_0x328715);});},'afterDestroy':function(_0x249276,_0x29c396,_0x47d9e4){return _0x25efaa[_0x0d4a('0x22')][_0x0d4a('0x24')]({'where':{'ChanSpyId':_0x249276['id']}})[_0x0d4a('0x1e')](function(){_0x47d9e4();})['catch'](function(_0x26fefb){_0x47d9e4(_0x26fefb);});}}});}; \ No newline at end of file +var _0xbcc4=['auth','Authenticate','password','ChanSpy','name','options','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','recordingFormat'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xbcc4,0x12b));var _0x4bcc=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbcc4[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x4bcc('0x0'));var util=require('util');var BPromise=require(_0x4bcc('0x1'));var attributes=require(_0x4bcc('0x2'));var getUserApplications=function(_0xa8c575,_0x42ed85,_0x4812c1){var _0x13f68e=0x1;var _0x1e342e=[];var _0x59c387={'context':_0x42ed85['context']||_0x4bcc('0x3'),'exten':util[_0x4bcc('0x4')](_0x4bcc('0x5'),_0xa8c575[_0x4bcc('0x6')],_0x4812c1),'type':_0x4bcc('0x7'),'isApp':![],'ChanSpyId':_0xa8c575['id'],'UserId':_0x42ed85['id']};_0x1e342e['push'](_[_0x4bcc('0x8')]({'app':_0x4bcc('0x9'),'appdata':util[_0x4bcc('0x4')](_0x4bcc('0xa'),_0x4bcc('0xb')),'priority':_0x13f68e++},_0x59c387));if(_0xa8c575[_0x4bcc('0xc')]){_0x1e342e[_0x4bcc('0xd')](_['merge']({'app':_0x4bcc('0xe'),'appdata':util[_0x4bcc('0x4')]('${UNIQUEID}.%s,a',_0xa8c575[_0x4bcc('0xf')]),'priority':_0x13f68e++},_0x59c387));}if(_0xa8c575[_0x4bcc('0x10')]){_0x1e342e[_0x4bcc('0xd')](_['merge']({'app':_0x4bcc('0x11'),'appdata':_0xa8c575[_0x4bcc('0x12')],'priority':_0x13f68e++},_0x59c387));}_0x1e342e[_0x4bcc('0xd')](_[_0x4bcc('0x8')]({'app':_0x4bcc('0x13'),'appdata':util[_0x4bcc('0x4')]('SIP/%s,%s',_0x42ed85[_0x4bcc('0x14')],_0xa8c575[_0x4bcc('0x15')]?_0xa8c575[_0x4bcc('0x15')]['join'](''):''),'priority':_0x13f68e++},_0x59c387));if(_0xa8c575[_0x4bcc('0xc')]){_0x1e342e[_0x4bcc('0xd')](_[_0x4bcc('0x8')]({'app':_0x4bcc('0x16'),'priority':_0x13f68e++},_0x59c387));}return _0x1e342e;};var getChanSpyApplications=function(_0x1382b0,_0x31aaca){var _0x687826=[];for(var _0x1077eb=0x0,_0x2f478e=0x1;_0x1077eb<_0x31aaca[_0x4bcc('0x17')];_0x1077eb++,_0x2f478e=0x1){_0x687826=_0x687826[_0x4bcc('0x18')](getUserApplications(_0x1382b0,_0x31aaca[_0x1077eb],_0x31aaca[_0x1077eb][_0x4bcc('0x19')]));if(_0x31aaca[_0x1077eb][_0x4bcc('0x19')]!=_0x31aaca[_0x1077eb][_0x4bcc('0x14')]){_0x687826=_0x687826[_0x4bcc('0x18')](getUserApplications(_0x1382b0,_0x31aaca[_0x1077eb],_0x31aaca[_0x1077eb][_0x4bcc('0x14')]));}}return _0x687826;};var getChanSpyPromise=function(_0x1e5fe9,_0x3c816d){return new BPromise(function(_0x4f02dd,_0x3b803b){return _0x1e5fe9['User'][_0x4bcc('0x1a')]({'attributes':['id',_0x4bcc('0x14'),'internal'],'where':{'role':_0x4bcc('0x1b'),'chanspy':!![]},'raw':!![]})[_0x4bcc('0x1c')](function(_0x4be09c){if(_0x4be09c){return _0x4f02dd(getChanSpyApplications(_0x3c816d,_0x4be09c));}return _0x4f02dd([]);})[_0x4bcc('0x1d')](function(_0x5f05e1){_0x3b803b(_0x5f05e1);});});};module['exports']=function(_0x2915b8,_0x396956){var _0x1c4172=_0x2915b8['models'];return _0x2915b8['define'](_0x4bcc('0x1e'),attributes,{'tableName':_0x4bcc('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x391d32,_0x5b6027,_0x1d0155){return getChanSpyPromise(_0x1c4172,_0x391d32)[_0x4bcc('0x1c')](function(_0x41f4cd){if(_0x41f4cd&&_0x41f4cd[_0x4bcc('0x17')]){return _0x1c4172[_0x4bcc('0x20')][_0x4bcc('0x21')](_0x41f4cd);}})[_0x4bcc('0x1c')](function(){_0x1d0155();})[_0x4bcc('0x1d')](function(_0x2d4e06){_0x1d0155(_0x2d4e06);});},'afterUpdate':function(_0x49447e,_0x27646e,_0x328e18){return _0x1c4172[_0x4bcc('0x20')][_0x4bcc('0x22')]({'where':{'ChanSpyId':_0x49447e['id']}})[_0x4bcc('0x1c')](function(){return getChanSpyPromise(_0x1c4172,_0x49447e);})[_0x4bcc('0x1c')](function(_0x5d9af5){if(_0x5d9af5&&_0x5d9af5[_0x4bcc('0x17')]){return _0x1c4172['VoiceExtension'][_0x4bcc('0x21')](_0x5d9af5);}})['then'](function(){_0x328e18();})['catch'](function(_0x2ea6e5){_0x328e18(_0x2ea6e5);});},'afterDestroy':function(_0x27068e,_0x4965a1,_0x148fff){return _0x1c4172[_0x4bcc('0x20')][_0x4bcc('0x22')]({'where':{'ChanSpyId':_0x27068e['id']}})[_0x4bcc('0x1c')](function(){_0x148fff();})[_0x4bcc('0x1d')](function(_0xa76050){_0x148fff(_0xa76050);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index f723bb7..8eb78d1 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 _0x052a=['request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2f5172,_0x17b4c3){var _0x1c846d=function(_0x4b45dc){while(--_0x4b45dc){_0x2f5172['push'](_0x2f5172['shift']());}};_0x1c846d(++_0x17b4c3);}(_0x052a,0x1d4));var _0xa052=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0x052a[_0x555b2f];return _0x81c0a6;};'use strict';var _=require('lodash');var util=require(_0xa052('0x0'));var moment=require('moment');var BPromise=require(_0xa052('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa052('0x2'))['db'];var utils=require(_0xa052('0x3'));var logger=require('../../config/logger')(_0xa052('0x4'));var config=require(_0xa052('0x5'));var jayson=require(_0xa052('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49b4d0,_0x329eaa,_0x184f86){return new BPromise(function(_0x5db4df,_0x1d8871){return client[_0xa052('0x7')](_0x49b4d0,_0x184f86)[_0xa052('0x8')](function(_0x1c05f2){logger['info'](_0xa052('0x9'),_0x329eaa,_0xa052('0xa'));logger[_0xa052('0xb')](_0xa052('0xc'),_0x329eaa,_0xa052('0xa'),JSON[_0xa052('0xd')](_0x1c05f2));if(_0x1c05f2[_0xa052('0xe')]){if(_0x1c05f2[_0xa052('0xe')][_0xa052('0xf')]===0x1f4){logger[_0xa052('0xe')](_0xa052('0x9'),_0x329eaa,_0x1c05f2[_0xa052('0xe')][_0xa052('0x10')]);return _0x1d8871(_0x1c05f2['error']['message']);}logger[_0xa052('0xe')](_0xa052('0x9'),_0x329eaa,_0x1c05f2[_0xa052('0xe')][_0xa052('0x10')]);return _0x5db4df(_0x1c05f2[_0xa052('0xe')][_0xa052('0x10')]);}else{logger['info'](_0xa052('0x9'),_0x329eaa,'request\x20sent');_0x5db4df(_0x1c05f2[_0xa052('0x11')][_0xa052('0x10')]);}})[_0xa052('0x12')](function(_0x24bf80){logger[_0xa052('0xe')](_0xa052('0x9'),_0x329eaa,_0x24bf80);_0x1d8871(_0x24bf80);});});} \ No newline at end of file +var _0xcac0=['info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x4825e2,_0x398155){var _0x1a1676=function(_0x1335f1){while(--_0x1335f1){_0x4825e2['push'](_0x4825e2['shift']());}};_0x1a1676(++_0x398155);}(_0xcac0,0x12f));var _0x0cac=function(_0x489c9e,_0x3749f0){_0x489c9e=_0x489c9e-0x0;var _0x52fb40=_0xcac0[_0x489c9e];return _0x52fb40;};'use strict';var _=require(_0x0cac('0x0'));var util=require('util');var moment=require(_0x0cac('0x1'));var BPromise=require(_0x0cac('0x2'));var rs=require(_0x0cac('0x3'));var fs=require('fs');var Redis=require(_0x0cac('0x4'));var db=require(_0x0cac('0x5'))['db'];var utils=require(_0x0cac('0x6'));var logger=require(_0x0cac('0x7'))('rpc');var config=require(_0x0cac('0x8'));var jayson=require(_0x0cac('0x9'));var client=jayson['client'][_0x0cac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f11a4,_0x16c303,_0xac456e){return new BPromise(function(_0x1a55d3,_0x1bb0cf){return client[_0x0cac('0xb')](_0x3f11a4,_0xac456e)['then'](function(_0x2f4d52){logger[_0x0cac('0xc')](_0x0cac('0xd'),_0x16c303,_0x0cac('0xe'));logger[_0x0cac('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x16c303,'request\x20sent',JSON[_0x0cac('0x10')](_0x2f4d52));if(_0x2f4d52[_0x0cac('0x11')]){if(_0x2f4d52[_0x0cac('0x11')][_0x0cac('0x12')]===0x1f4){logger[_0x0cac('0x11')](_0x0cac('0xd'),_0x16c303,_0x2f4d52[_0x0cac('0x11')][_0x0cac('0x13')]);return _0x1bb0cf(_0x2f4d52[_0x0cac('0x11')][_0x0cac('0x13')]);}logger[_0x0cac('0x11')](_0x0cac('0xd'),_0x16c303,_0x2f4d52[_0x0cac('0x11')][_0x0cac('0x13')]);return _0x1a55d3(_0x2f4d52[_0x0cac('0x11')]['message']);}else{logger['info'](_0x0cac('0xd'),_0x16c303,_0x0cac('0xe'));_0x1a55d3(_0x2f4d52['result']['message']);}})[_0x0cac('0x14')](function(_0x33cc55){logger['error'](_0x0cac('0xd'),_0x16c303,_0x33cc55);_0x1bb0cf(_0x33cc55);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index b97dedc..858e731 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 _0x0b85=['index','show','create','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','./voiceContext.controller','get'];(function(_0x148b18,_0x4647ae){var _0x367064=function(_0x23d7b6){while(--_0x23d7b6){_0x148b18['push'](_0x148b18['shift']());}};_0x367064(++_0x4647ae);}(_0x0b85,0x1a1));var _0x50b8=function(_0x4cd86e,_0x5a1225){_0x4cd86e=_0x4cd86e-0x0;var _0x46d50b=_0x0b85[_0x4cd86e];return _0x46d50b;};'use strict';var multer=require(_0x50b8('0x0'));var util=require(_0x50b8('0x1'));var path=require(_0x50b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x50b8('0x3'));var router=express[_0x50b8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x50b8('0x5'));var config=require('../../config/environment');var controller=require(_0x50b8('0x6'));router[_0x50b8('0x7')]('/',auth['isAuthenticated'](),controller[_0x50b8('0x8')]);router[_0x50b8('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x50b8('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x50b8('0xa')]);router[_0x50b8('0xb')](_0x50b8('0xc'),auth[_0x50b8('0xd')](),controller[_0x50b8('0xe')]);router[_0x50b8('0xf')]('/:id',auth[_0x50b8('0xd')](),controller[_0x50b8('0x10')]);module['exports']=router; \ No newline at end of file +var _0x15d1=['/:id','post','create','put','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x304454,_0x2902cd){var _0xf3eeaf=function(_0xb79b2c){while(--_0xb79b2c){_0x304454['push'](_0x304454['shift']());}};_0xf3eeaf(++_0x2902cd);}(_0x15d1,0x15f));var _0x115d=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0x15d1[_0x121886];return _0x20ca01;};'use strict';var multer=require(_0x115d('0x0'));var util=require('util');var path=require(_0x115d('0x1'));var timeout=require(_0x115d('0x2'));var express=require(_0x115d('0x3'));var router=express['Router']();var auth=require(_0x115d('0x4'));var interaction=require(_0x115d('0x5'));var config=require(_0x115d('0x6'));var controller=require('./voiceContext.controller');router[_0x115d('0x7')]('/',auth['isAuthenticated'](),controller[_0x115d('0x8')]);router[_0x115d('0x7')](_0x115d('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x115d('0xa')]('/',auth['isAuthenticated'](),controller[_0x115d('0xb')]);router[_0x115d('0xc')](_0x115d('0x9'),auth[_0x115d('0xd')](),controller[_0x115d('0xe')]);router[_0x115d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x115d('0x10')]);module[_0x115d('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 299a8f3..cdd4a01 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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x18df30,_0x34a297){var _0x436b61=function(_0x20a3a3){while(--_0x20a3a3){_0x18df30['push'](_0x18df30['shift']());}};_0x436b61(++_0x34a297);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x5cfec5,_0x27e4a1){var _0x5ba2ef=function(_0x160fe5){while(--_0x160fe5){_0x5cfec5['push'](_0x5cfec5['shift']());}};_0x5ba2ef(++_0x27e4a1);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('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 d67273c..fe70280 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 _0x2bd6=['stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','Contexts','destroy','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceContext','includeAll','include','findAll','rows','show','keys','find','create','body','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','utf8','chan_sip.so','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x511e84,_0x4b7808){var _0x374900=function(_0x18bc73){while(--_0x18bc73){_0x511e84['push'](_0x511e84['shift']());}};_0x374900(++_0x4b7808);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x2bd6[_0x45e98e];return _0x374dba;};'use strict';var pdf=require(_0x62bd('0x0'));var emlformat=require(_0x62bd('0x1'));var rimraf=require(_0x62bd('0x2'));var zipdir=require(_0x62bd('0x3'));var jsonpatch=require(_0x62bd('0x4'));var rp=require('request-promise');var moment=require(_0x62bd('0x5'));var BPromise=require(_0x62bd('0x6'));var Mustache=require(_0x62bd('0x7'));var util=require('util');var path=require(_0x62bd('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x62bd('0x9'));var fs=require('fs');var _=require(_0x62bd('0xa'));var squel=require('squel');var crypto=require(_0x62bd('0xb'));var jsforce=require(_0x62bd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x62bd('0xd'));var querystring=require(_0x62bd('0xe'));var Papa=require(_0x62bd('0xf'));var Redis=require(_0x62bd('0x10'));var authService=require(_0x62bd('0x11'));var qs=require(_0x62bd('0x12'));var as=require(_0x62bd('0x13'));var hardwareService=require(_0x62bd('0x14'));var logger=require(_0x62bd('0x15'))(_0x62bd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x62bd('0x17'));var db=require(_0x62bd('0x18'))['db'];var jayson=require(_0x62bd('0x19'));var client=jayson[_0x62bd('0x1a')][_0x62bd('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xb46500,_0x549520,_0x12815e,_0x5d42f8){return new BPromise(function(_0x1b751c,_0x5dc408){var _0x4bc2d9=_0x5d42f8||client;return _0x4bc2d9[_0x62bd('0x1c')](_0xb46500,_0x12815e)[_0x62bd('0x1d')](function(_0x5260f9){logger[_0x62bd('0x1e')](_0x62bd('0x1f'),_0x549520,_0x62bd('0x20'));logger[_0x62bd('0x21')](_0x62bd('0x22'),_0x549520,'request\x20sent',JSON[_0x62bd('0x23')](_0x5260f9));if(_0x5260f9[_0x62bd('0x24')]){if(_0x5260f9[_0x62bd('0x24')][_0x62bd('0x25')]===0x1f4){logger['error'](_0x62bd('0x1f'),_0x549520,_0x5260f9[_0x62bd('0x24')][_0x62bd('0x26')]);return _0x5dc408(_0x5260f9[_0x62bd('0x24')]['message']);}logger[_0x62bd('0x24')](_0x62bd('0x1f'),_0x549520,_0x5260f9[_0x62bd('0x24')][_0x62bd('0x26')]);return _0x1b751c(_0x5260f9['error'][_0x62bd('0x26')]);}else{logger[_0x62bd('0x1e')](_0x62bd('0x1f'),_0x549520,_0x62bd('0x20'));_0x1b751c(_0x5260f9['result'][_0x62bd('0x26')]);}})[_0x62bd('0x27')](function(_0xc1c37){logger[_0x62bd('0x24')](_0x62bd('0x1f'),_0x549520,_0xc1c37);_0x5dc408(_0xc1c37);});});}function respondWithStatusCode(_0x10fad2,_0x245628){_0x245628=_0x245628||0xcc;return function(_0x304cf0){if(_0x304cf0){return _0x10fad2[_0x62bd('0x28')](_0x245628);}return _0x10fad2[_0x62bd('0x29')](_0x245628)[_0x62bd('0x2a')]();};}function respondWithResult(_0x2f5c03,_0x45e4f2){_0x45e4f2=_0x45e4f2||0xc8;return function(_0x528b43){if(_0x528b43){return _0x2f5c03[_0x62bd('0x29')](_0x45e4f2)[_0x62bd('0x2b')](_0x528b43);}};}function respondWithFilteredResult(_0x5bce54,_0x2f1d83){return function(_0x3c6761){if(_0x3c6761){var _0x1f6339=_0x3c6761[_0x62bd('0x2c')],_0x56890f=_0x2f1d83[_0x62bd('0x2d')],_0x191063=_0x2f1d83[_0x62bd('0x2d')]+_0x2f1d83[_0x62bd('0x2e')],_0x205d78;if(_0x191063>=_0x1f6339){_0x191063=_0x1f6339;_0x205d78=0xc8;}else{_0x205d78=0xce;}_0x5bce54[_0x62bd('0x29')](_0x205d78);return _0x5bce54[_0x62bd('0x2f')](_0x62bd('0x30'),_0x56890f+'-'+_0x191063+'/'+_0x1f6339)['json'](_0x3c6761);}return null;};}function patchUpdates(_0x31ad61){return function(_0x2e689b){try{jsonpatch[_0x62bd('0x31')](_0x2e689b,_0x31ad61,!![]);}catch(_0x380193){return BPromise[_0x62bd('0x32')](_0x380193);}return _0x2e689b[_0x62bd('0x33')]();};}function saveUpdates(_0x52ed97,_0x310254){return function(_0x2ea583){if(_0x2ea583){return _0x2ea583[_0x62bd('0x34')](_0x52ed97)[_0x62bd('0x1d')](function(_0x1e81f1){return _0x1e81f1;});}return null;};}function removeEntity(_0x578ed4,_0x2d64e7){return function(_0x4ec3b3){if(_0x4ec3b3){return _0x4ec3b3['destroy']()[_0x62bd('0x1d')](function(){var _0x203b53=_0x4ec3b3[_0x62bd('0x35')]({'plain':!![]});var _0xb4e444=_0x62bd('0x36');return db['UserProfileResource'][_0x62bd('0x37')]({'where':{'type':_0xb4e444,'resourceId':_0x203b53['id']}})[_0x62bd('0x1d')](function(){return _0x4ec3b3;});})[_0x62bd('0x1d')](function(){_0x578ed4[_0x62bd('0x29')](0xcc)[_0x62bd('0x2a')]();});}};}function handleEntityNotFound(_0x2cb56a,_0x1f8c9d){return function(_0x171901){if(!_0x171901){_0x2cb56a[_0x62bd('0x28')](0x194);}return _0x171901;};}function handleError(_0x58d484,_0x193a5e){_0x193a5e=_0x193a5e||0x1f4;return function(_0x5e1f7a){logger[_0x62bd('0x24')](_0x5e1f7a['stack']);if(_0x5e1f7a[_0x62bd('0x38')]){delete _0x5e1f7a[_0x62bd('0x38')];}_0x58d484['status'](_0x193a5e)[_0x62bd('0x39')](_0x5e1f7a);};}exports[_0x62bd('0x3a')]=function(_0x2a0382,_0x1e25f5){var _0x3cffd0={},_0x317f7e={},_0x1aed2e={'count':0x0,'rows':[]};var _0x24f756=_['map'](db['VoiceContext'][_0x62bd('0x3b')],function(_0x341fca){return{'name':_0x341fca[_0x62bd('0x3c')],'type':_0x341fca[_0x62bd('0x3d')][_0x62bd('0x3e')]};});_0x317f7e[_0x62bd('0x3f')]=_[_0x62bd('0x40')](_0x24f756,'name');_0x317f7e[_0x62bd('0x41')]=_['keys'](_0x2a0382[_0x62bd('0x41')]);_0x317f7e[_0x62bd('0x42')]=_[_0x62bd('0x43')](_0x317f7e[_0x62bd('0x3f')],_0x317f7e[_0x62bd('0x41')]);_0x3cffd0['attributes']=_[_0x62bd('0x43')](_0x317f7e[_0x62bd('0x3f')],qs[_0x62bd('0x44')](_0x2a0382['query'][_0x62bd('0x44')]));_0x3cffd0['attributes']=_0x3cffd0[_0x62bd('0x45')][_0x62bd('0x46')]?_0x3cffd0[_0x62bd('0x45')]:_0x317f7e[_0x62bd('0x3f')];if(!_0x2a0382[_0x62bd('0x41')][_0x62bd('0x47')](_0x62bd('0x48'))){_0x3cffd0[_0x62bd('0x2e')]=qs[_0x62bd('0x2e')](_0x2a0382[_0x62bd('0x41')][_0x62bd('0x2e')]);_0x3cffd0['offset']=qs[_0x62bd('0x2d')](_0x2a0382[_0x62bd('0x41')][_0x62bd('0x2d')]);}_0x3cffd0[_0x62bd('0x49')]=qs[_0x62bd('0x4a')](_0x2a0382[_0x62bd('0x41')][_0x62bd('0x4a')]);_0x3cffd0[_0x62bd('0x4b')]=qs[_0x62bd('0x42')](_[_0x62bd('0x4c')](_0x2a0382[_0x62bd('0x41')],_0x317f7e[_0x62bd('0x42')]),_0x24f756);if(_0x2a0382[_0x62bd('0x41')][_0x62bd('0x4d')]){_0x3cffd0[_0x62bd('0x4b')]=_['merge'](_0x3cffd0['where'],{'$or':_[_0x62bd('0x40')](_0x24f756,function(_0x5694e7){if(_0x5694e7[_0x62bd('0x3d')]!==_0x62bd('0x4e')){var _0x39202e={};_0x39202e[_0x5694e7[_0x62bd('0x38')]]={'$like':'%'+_0x2a0382[_0x62bd('0x41')][_0x62bd('0x4d')]+'%'};return _0x39202e;}})});}_0x3cffd0=_[_0x62bd('0x4f')]({},_0x3cffd0,_0x2a0382[_0x62bd('0x50')]);var _0x4b7590={'where':_0x3cffd0['where']};return db[_0x62bd('0x51')][_0x62bd('0x2c')](_0x4b7590)[_0x62bd('0x1d')](function(_0x3d0d52){_0x1aed2e['count']=_0x3d0d52;if(_0x2a0382[_0x62bd('0x41')][_0x62bd('0x52')]){_0x3cffd0[_0x62bd('0x53')]=[{'all':!![]}];}return db[_0x62bd('0x51')][_0x62bd('0x54')](_0x3cffd0);})[_0x62bd('0x1d')](function(_0x51ce41){_0x1aed2e[_0x62bd('0x55')]=_0x51ce41;return _0x1aed2e;})[_0x62bd('0x1d')](respondWithFilteredResult(_0x1e25f5,_0x3cffd0))[_0x62bd('0x27')](handleError(_0x1e25f5,null));};exports[_0x62bd('0x56')]=function(_0x30660a,_0x3c4f05){var _0x50a908={'raw':![],'where':{'id':_0x30660a['params']['id']}},_0x4dc05f={};_0x4dc05f[_0x62bd('0x3f')]=_[_0x62bd('0x57')](db['VoiceContext'][_0x62bd('0x3b')]);_0x4dc05f[_0x62bd('0x41')]=_[_0x62bd('0x57')](_0x30660a['query']);_0x4dc05f['filters']=_[_0x62bd('0x43')](_0x4dc05f[_0x62bd('0x3f')],_0x4dc05f[_0x62bd('0x41')]);_0x50a908[_0x62bd('0x45')]=_['intersection'](_0x4dc05f['model'],qs[_0x62bd('0x44')](_0x30660a[_0x62bd('0x41')]['fields']));_0x50a908[_0x62bd('0x45')]=_0x50a908[_0x62bd('0x45')][_0x62bd('0x46')]?_0x50a908['attributes']:_0x4dc05f[_0x62bd('0x3f')];if(_0x30660a[_0x62bd('0x41')][_0x62bd('0x52')]){_0x50a908[_0x62bd('0x53')]=[{'all':!![]}];}_0x50a908=_['merge']({},_0x50a908,_0x30660a[_0x62bd('0x50')]);return db[_0x62bd('0x51')][_0x62bd('0x58')](_0x50a908)[_0x62bd('0x1d')](handleEntityNotFound(_0x3c4f05,null))[_0x62bd('0x1d')](respondWithResult(_0x3c4f05,null))['catch'](handleError(_0x3c4f05,null));};exports[_0x62bd('0x59')]=function(_0xf5e0b5,_0x3ed61c,_0x245546){var _0x82f4c7;return db[_0x62bd('0x51')][_0x62bd('0x59')](_0xf5e0b5[_0x62bd('0x5a')],{'raw':!![]})[_0x62bd('0x1d')](function(_0x2ce213){_0x82f4c7=_0x2ce213;return db['VoiceContext'][_0x62bd('0x54')]({'raw':!![]});})[_0x62bd('0x1d')](function(_0x28768c){var _0x7f9fff=fs['readFileSync'](path['join'](config[_0x62bd('0x5b')],_0x62bd('0x5c')),'utf8');var _0x180cf9=ejs[_0x62bd('0x5d')](_0x7f9fff,{'contexts':_0x28768c||[]});fs[_0x62bd('0x5e')](_0x62bd('0x5f'),_0x180cf9);})[_0x62bd('0x1d')](function(){return respondWithRpcPromise(_0x62bd('0x60'),'create',{'module':'chan_sip.so'});})[_0x62bd('0x1d')](function(){var _0x21fa83=_0xf5e0b5[_0x62bd('0x61')][_0x62bd('0x35')]({'plain':!![]});if(!_0x21fa83)throw new Error(_0x62bd('0x62'));if(_0x21fa83['role']==='user'){var _0x9cddf1=_0x82f4c7[_0x62bd('0x35')]({'plain':!![]});return db[_0x62bd('0x63')]['find']({'where':{'name':_0x62bd('0x36'),'userProfileId':_0x21fa83[_0x62bd('0x64')]},'raw':!![]})['then'](function(_0x409b6d){if(_0x409b6d&&_0x409b6d['autoAssociation']===0x0){return db['UserProfileResource'][_0x62bd('0x59')]({'name':_0x9cddf1[_0x62bd('0x38')],'resourceId':_0x9cddf1['id'],'type':_0x409b6d['name'],'sectionId':_0x409b6d['id']},{})['then'](function(){return _0x82f4c7;});}else{return _0x82f4c7;}})[_0x62bd('0x27')](function(_0x20663e){logger[_0x62bd('0x24')](_0x62bd('0x65'),_0x20663e);throw _0x20663e;});}return _0x82f4c7;})['then'](respondWithResult(_0x3ed61c,0xc9))[_0x62bd('0x27')](handleError(_0x3ed61c,null));};exports[_0x62bd('0x34')]=function(_0x95ab4,_0x21e489,_0x180e39){var _0x2501bd;return db['VoiceContext']['find']({'where':{'id':_0x95ab4['params']['id']}})[_0x62bd('0x1d')](handleEntityNotFound(_0x21e489,null))[_0x62bd('0x1d')](saveUpdates(_0x95ab4[_0x62bd('0x5a')],null))[_0x62bd('0x1d')](function(_0x2e053b){if(_0x2e053b){_0x2501bd=_0x2e053b;return db[_0x62bd('0x51')][_0x62bd('0x54')]({'raw':!![]});}})['then'](function(_0x265de5){var _0xaec62d=fs[_0x62bd('0x66')](path[_0x62bd('0x67')](config['root'],_0x62bd('0x5c')),_0x62bd('0x68'));var _0x3ce91c=ejs[_0x62bd('0x5d')](_0xaec62d,{'contexts':_0x265de5||[]});fs[_0x62bd('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3ce91c);})['then'](function(){return respondWithRpcPromise(_0x62bd('0x60'),_0x62bd('0x34'),{'module':_0x62bd('0x69')});})[_0x62bd('0x1d')](function(){return _0x2501bd;})['then'](respondWithResult(_0x21e489,null))['catch'](handleError(_0x21e489,null));};exports['destroy']=function(_0x123843,_0x93a9e1,_0x2b7875){var _0x5887c3;return db['VoiceContext']['find']({'where':{'id':_0x123843[_0x62bd('0x6a')]['id']}})[_0x62bd('0x1d')](handleEntityNotFound(_0x93a9e1,null))[_0x62bd('0x1d')](removeEntity(_0x93a9e1,null))['then'](function(){return db[_0x62bd('0x51')]['findAll']({'raw':!![]});})[_0x62bd('0x1d')](function(_0x36b5a0){var _0x5004a1=fs['readFileSync'](path[_0x62bd('0x67')](config[_0x62bd('0x5b')],_0x62bd('0x5c')),_0x62bd('0x68'));var _0x3f9762=ejs[_0x62bd('0x5d')](_0x5004a1,{'contexts':_0x36b5a0});fs[_0x62bd('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3f9762);return respondWithRpcPromise(_0x62bd('0x60'),_0x62bd('0x37'),{'module':_0x62bd('0x69')});})[_0x62bd('0x27')](handleError(_0x93a9e1,null));}; \ No newline at end of file +var _0xa5ca=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','set','apply','reject','save','update','destroy','then','Contexts','name','send','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','offset','where','pick','VIRTUAL','filter','merge','options','includeAll','VoiceContext','findAll','rows','show','params','include','find','create','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','get','UserProfileSection','userProfileId','autoAssociation','readFileSync','chan_sip.so','server/files/templates/context.ejs','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x366269,_0x31d7d3){var _0x34ed77=function(_0x58bef0){while(--_0x58bef0){_0x366269['push'](_0x366269['shift']());}};_0x34ed77(++_0x31d7d3);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xa5ca[_0x44946b];return _0x249bc4;};'use strict';var pdf=require(_0xaa5c('0x0'));var emlformat=require(_0xaa5c('0x1'));var rimraf=require(_0xaa5c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaa5c('0x3'));var moment=require(_0xaa5c('0x4'));var BPromise=require(_0xaa5c('0x5'));var Mustache=require(_0xaa5c('0x6'));var util=require(_0xaa5c('0x7'));var path=require(_0xaa5c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xaa5c('0x9'));var squel=require(_0xaa5c('0xa'));var crypto=require(_0xaa5c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaa5c('0xc'));var querystring=require(_0xaa5c('0xd'));var Papa=require(_0xaa5c('0xe'));var Redis=require('ioredis');var authService=require(_0xaa5c('0xf'));var qs=require(_0xaa5c('0x10'));var as=require(_0xaa5c('0x11'));var hardwareService=require(_0xaa5c('0x12'));var logger=require(_0xaa5c('0x13'))(_0xaa5c('0x14'));var utils=require(_0xaa5c('0x15'));var config=require(_0xaa5c('0x16'));var licenseUtil=require(_0xaa5c('0x17'));var db=require(_0xaa5c('0x18'))['db'];var jayson=require(_0xaa5c('0x19'));var client=jayson[_0xaa5c('0x1a')][_0xaa5c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4a2b26,_0xb82ce2,_0x521c01,_0x53f57a){return new BPromise(function(_0x4c8461,_0x36fd71){var _0x18c0a8=_0x53f57a||client;return _0x18c0a8[_0xaa5c('0x1c')](_0x4a2b26,_0x521c01)['then'](function(_0x2814c2){logger[_0xaa5c('0x1d')](_0xaa5c('0x1e'),_0xb82ce2,_0xaa5c('0x1f'));logger[_0xaa5c('0x20')](_0xaa5c('0x21'),_0xb82ce2,'request\x20sent',JSON['stringify'](_0x2814c2));if(_0x2814c2[_0xaa5c('0x22')]){if(_0x2814c2['error'][_0xaa5c('0x23')]===0x1f4){logger[_0xaa5c('0x22')]('VoiceContext,\x20%s,\x20%s',_0xb82ce2,_0x2814c2['error']['message']);return _0x36fd71(_0x2814c2['error'][_0xaa5c('0x24')]);}logger[_0xaa5c('0x22')]('VoiceContext,\x20%s,\x20%s',_0xb82ce2,_0x2814c2[_0xaa5c('0x22')][_0xaa5c('0x24')]);return _0x4c8461(_0x2814c2['error']['message']);}else{logger[_0xaa5c('0x1d')](_0xaa5c('0x1e'),_0xb82ce2,_0xaa5c('0x1f'));_0x4c8461(_0x2814c2[_0xaa5c('0x25')][_0xaa5c('0x24')]);}})[_0xaa5c('0x26')](function(_0x5efbd5){logger[_0xaa5c('0x22')](_0xaa5c('0x1e'),_0xb82ce2,_0x5efbd5);_0x36fd71(_0x5efbd5);});});}function respondWithStatusCode(_0x5caf81,_0x1cee8c){_0x1cee8c=_0x1cee8c||0xcc;return function(_0x4159a4){if(_0x4159a4){return _0x5caf81[_0xaa5c('0x27')](_0x1cee8c);}return _0x5caf81[_0xaa5c('0x28')](_0x1cee8c)[_0xaa5c('0x29')]();};}function respondWithResult(_0x697bde,_0x596b08){_0x596b08=_0x596b08||0xc8;return function(_0x380591){if(_0x380591){return _0x697bde['status'](_0x596b08)['json'](_0x380591);}};}function respondWithFilteredResult(_0x4cc156,_0x4f1490){return function(_0x2f9f3f){if(_0x2f9f3f){var _0x5ca1ae=_0x2f9f3f[_0xaa5c('0x2a')],_0xcf71e9=_0x4f1490['offset'],_0x44f227=_0x4f1490['offset']+_0x4f1490['limit'],_0x3fc42c;if(_0x44f227>=_0x5ca1ae){_0x44f227=_0x5ca1ae;_0x3fc42c=0xc8;}else{_0x3fc42c=0xce;}_0x4cc156['status'](_0x3fc42c);return _0x4cc156[_0xaa5c('0x2b')]('Content-Range',_0xcf71e9+'-'+_0x44f227+'/'+_0x5ca1ae)['json'](_0x2f9f3f);}return null;};}function patchUpdates(_0xb4f2ff){return function(_0x4f13fa){try{jsonpatch[_0xaa5c('0x2c')](_0x4f13fa,_0xb4f2ff,!![]);}catch(_0x5e5ebc){return BPromise[_0xaa5c('0x2d')](_0x5e5ebc);}return _0x4f13fa[_0xaa5c('0x2e')]();};}function saveUpdates(_0x2fa587,_0x598b49){return function(_0x100d3c){if(_0x100d3c){return _0x100d3c[_0xaa5c('0x2f')](_0x2fa587)['then'](function(_0x33c56d){return _0x33c56d;});}return null;};}function removeEntity(_0x3e8f95,_0xe3a501){return function(_0x4744c4){if(_0x4744c4){return _0x4744c4[_0xaa5c('0x30')]()[_0xaa5c('0x31')](function(){var _0x4f4a0d=_0x4744c4['get']({'plain':!![]});var _0x2bc484=_0xaa5c('0x32');return db['UserProfileResource']['destroy']({'where':{'type':_0x2bc484,'resourceId':_0x4f4a0d['id']}})[_0xaa5c('0x31')](function(){return _0x4744c4;});})[_0xaa5c('0x31')](function(){_0x3e8f95[_0xaa5c('0x28')](0xcc)[_0xaa5c('0x29')]();});}};}function handleEntityNotFound(_0x301ceb,_0x1b8915){return function(_0x1d5a92){if(!_0x1d5a92){_0x301ceb['sendStatus'](0x194);}return _0x1d5a92;};}function handleError(_0x50c236,_0x11d856){_0x11d856=_0x11d856||0x1f4;return function(_0x3c31eb){logger[_0xaa5c('0x22')](_0x3c31eb['stack']);if(_0x3c31eb[_0xaa5c('0x33')]){delete _0x3c31eb[_0xaa5c('0x33')];}_0x50c236[_0xaa5c('0x28')](_0x11d856)[_0xaa5c('0x34')](_0x3c31eb);};}exports[_0xaa5c('0x35')]=function(_0x53cade,_0x49194a){var _0xd2a5bd={},_0x440edd={},_0x3d32c2={'count':0x0,'rows':[]};var _0x22f4c2=_[_0xaa5c('0x36')](db['VoiceContext'][_0xaa5c('0x37')],function(_0x35a302){return{'name':_0x35a302[_0xaa5c('0x38')],'type':_0x35a302['type']['key']};});_0x440edd[_0xaa5c('0x39')]=_[_0xaa5c('0x36')](_0x22f4c2,_0xaa5c('0x33'));_0x440edd['query']=_[_0xaa5c('0x3a')](_0x53cade[_0xaa5c('0x3b')]);_0x440edd[_0xaa5c('0x3c')]=_[_0xaa5c('0x3d')](_0x440edd[_0xaa5c('0x39')],_0x440edd['query']);_0xd2a5bd[_0xaa5c('0x3e')]=_[_0xaa5c('0x3d')](_0x440edd[_0xaa5c('0x39')],qs[_0xaa5c('0x3f')](_0x53cade[_0xaa5c('0x3b')]['fields']));_0xd2a5bd[_0xaa5c('0x3e')]=_0xd2a5bd[_0xaa5c('0x3e')][_0xaa5c('0x40')]?_0xd2a5bd[_0xaa5c('0x3e')]:_0x440edd[_0xaa5c('0x39')];if(!_0x53cade[_0xaa5c('0x3b')]['hasOwnProperty'](_0xaa5c('0x41'))){_0xd2a5bd[_0xaa5c('0x42')]=qs['limit'](_0x53cade['query']['limit']);_0xd2a5bd['offset']=qs[_0xaa5c('0x43')](_0x53cade['query'][_0xaa5c('0x43')]);}_0xd2a5bd['order']=qs['sort'](_0x53cade[_0xaa5c('0x3b')]['sort']);_0xd2a5bd[_0xaa5c('0x44')]=qs[_0xaa5c('0x3c')](_[_0xaa5c('0x45')](_0x53cade[_0xaa5c('0x3b')],_0x440edd[_0xaa5c('0x3c')]),_0x22f4c2);if(_0x53cade['query']['filter']){_0xd2a5bd[_0xaa5c('0x44')]=_['merge'](_0xd2a5bd[_0xaa5c('0x44')],{'$or':_[_0xaa5c('0x36')](_0x22f4c2,function(_0x271bba){if(_0x271bba['type']!==_0xaa5c('0x46')){var _0x48d255={};_0x48d255[_0x271bba[_0xaa5c('0x33')]]={'$like':'%'+_0x53cade[_0xaa5c('0x3b')][_0xaa5c('0x47')]+'%'};return _0x48d255;}})});}_0xd2a5bd=_[_0xaa5c('0x48')]({},_0xd2a5bd,_0x53cade[_0xaa5c('0x49')]);var _0x47be10={'where':_0xd2a5bd[_0xaa5c('0x44')]};return db['VoiceContext'][_0xaa5c('0x2a')](_0x47be10)[_0xaa5c('0x31')](function(_0x2d5362){_0x3d32c2[_0xaa5c('0x2a')]=_0x2d5362;if(_0x53cade[_0xaa5c('0x3b')][_0xaa5c('0x4a')]){_0xd2a5bd['include']=[{'all':!![]}];}return db[_0xaa5c('0x4b')][_0xaa5c('0x4c')](_0xd2a5bd);})[_0xaa5c('0x31')](function(_0x13bca7){_0x3d32c2[_0xaa5c('0x4d')]=_0x13bca7;return _0x3d32c2;})[_0xaa5c('0x31')](respondWithFilteredResult(_0x49194a,_0xd2a5bd))[_0xaa5c('0x26')](handleError(_0x49194a,null));};exports[_0xaa5c('0x4e')]=function(_0x2d1436,_0xe9ed3f){var _0xd72f58={'raw':![],'where':{'id':_0x2d1436[_0xaa5c('0x4f')]['id']}},_0x182725={};_0x182725[_0xaa5c('0x39')]=_[_0xaa5c('0x3a')](db['VoiceContext']['rawAttributes']);_0x182725['query']=_['keys'](_0x2d1436[_0xaa5c('0x3b')]);_0x182725['filters']=_[_0xaa5c('0x3d')](_0x182725[_0xaa5c('0x39')],_0x182725['query']);_0xd72f58[_0xaa5c('0x3e')]=_['intersection'](_0x182725['model'],qs[_0xaa5c('0x3f')](_0x2d1436[_0xaa5c('0x3b')]['fields']));_0xd72f58[_0xaa5c('0x3e')]=_0xd72f58[_0xaa5c('0x3e')][_0xaa5c('0x40')]?_0xd72f58[_0xaa5c('0x3e')]:_0x182725[_0xaa5c('0x39')];if(_0x2d1436['query'][_0xaa5c('0x4a')]){_0xd72f58[_0xaa5c('0x50')]=[{'all':!![]}];}_0xd72f58=_[_0xaa5c('0x48')]({},_0xd72f58,_0x2d1436[_0xaa5c('0x49')]);return db[_0xaa5c('0x4b')][_0xaa5c('0x51')](_0xd72f58)[_0xaa5c('0x31')](handleEntityNotFound(_0xe9ed3f,null))['then'](respondWithResult(_0xe9ed3f,null))[_0xaa5c('0x26')](handleError(_0xe9ed3f,null));};exports[_0xaa5c('0x52')]=function(_0x576f18,_0x2aced2,_0x2db0be){var _0x4392f4;return db['VoiceContext'][_0xaa5c('0x52')](_0x576f18['body'],{'raw':!![]})[_0xaa5c('0x31')](function(_0x21c12a){_0x4392f4=_0x21c12a;return db[_0xaa5c('0x4b')][_0xaa5c('0x4c')]({'raw':!![]});})['then'](function(_0x211567){var _0x1b4f5d=fs['readFileSync'](path[_0xaa5c('0x53')](config[_0xaa5c('0x54')],'server/files/templates/context.ejs'),'utf8');var _0x3ff999=ejs[_0xaa5c('0x55')](_0x1b4f5d,{'contexts':_0x211567||[]});fs[_0xaa5c('0x56')](_0xaa5c('0x57'),_0x3ff999);})[_0xaa5c('0x31')](function(){return respondWithRpcPromise(_0xaa5c('0x58'),_0xaa5c('0x52'),{'module':'chan_sip.so'});})[_0xaa5c('0x31')](function(){var _0x242675=_0x576f18[_0xaa5c('0x59')]['get']({'plain':!![]});if(!_0x242675)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x242675['role']==='user'){var _0x4e6825=_0x4392f4[_0xaa5c('0x5a')]({'plain':!![]});return db[_0xaa5c('0x5b')][_0xaa5c('0x51')]({'where':{'name':_0xaa5c('0x32'),'userProfileId':_0x242675[_0xaa5c('0x5c')]},'raw':!![]})[_0xaa5c('0x31')](function(_0x5d1bca){if(_0x5d1bca&&_0x5d1bca[_0xaa5c('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x4e6825['name'],'resourceId':_0x4e6825['id'],'type':_0x5d1bca[_0xaa5c('0x33')],'sectionId':_0x5d1bca['id']},{})[_0xaa5c('0x31')](function(){return _0x4392f4;});}else{return _0x4392f4;}})[_0xaa5c('0x26')](function(_0x3487a7){logger[_0xaa5c('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3487a7);throw _0x3487a7;});}return _0x4392f4;})[_0xaa5c('0x31')](respondWithResult(_0x2aced2,0xc9))[_0xaa5c('0x26')](handleError(_0x2aced2,null));};exports[_0xaa5c('0x2f')]=function(_0x4a8752,_0x373aac,_0xa93e19){var _0x45ea65;return db[_0xaa5c('0x4b')][_0xaa5c('0x51')]({'where':{'id':_0x4a8752['params']['id']}})['then'](handleEntityNotFound(_0x373aac,null))[_0xaa5c('0x31')](saveUpdates(_0x4a8752['body'],null))[_0xaa5c('0x31')](function(_0x3378ef){if(_0x3378ef){_0x45ea65=_0x3378ef;return db[_0xaa5c('0x4b')][_0xaa5c('0x4c')]({'raw':!![]});}})[_0xaa5c('0x31')](function(_0xd3b931){var _0x46009f=fs[_0xaa5c('0x5e')](path['join'](config[_0xaa5c('0x54')],'server/files/templates/context.ejs'),'utf8');var _0x12445c=ejs[_0xaa5c('0x55')](_0x46009f,{'contexts':_0xd3b931||[]});fs[_0xaa5c('0x56')](_0xaa5c('0x57'),_0x12445c);})[_0xaa5c('0x31')](function(){return respondWithRpcPromise(_0xaa5c('0x58'),_0xaa5c('0x2f'),{'module':_0xaa5c('0x5f')});})[_0xaa5c('0x31')](function(){return _0x45ea65;})['then'](respondWithResult(_0x373aac,null))[_0xaa5c('0x26')](handleError(_0x373aac,null));};exports[_0xaa5c('0x30')]=function(_0x31a523,_0xc2dd7c,_0x2e6917){var _0x5f1d0c;return db[_0xaa5c('0x4b')][_0xaa5c('0x51')]({'where':{'id':_0x31a523['params']['id']}})[_0xaa5c('0x31')](handleEntityNotFound(_0xc2dd7c,null))['then'](removeEntity(_0xc2dd7c,null))[_0xaa5c('0x31')](function(){return db[_0xaa5c('0x4b')][_0xaa5c('0x4c')]({'raw':!![]});})['then'](function(_0x83ca3){var _0x10a986=fs[_0xaa5c('0x5e')](path[_0xaa5c('0x53')](config[_0xaa5c('0x54')],_0xaa5c('0x60')),'utf8');var _0x151b4a=ejs[_0xaa5c('0x55')](_0x10a986,{'contexts':_0x83ca3});fs[_0xaa5c('0x56')](_0xaa5c('0x57'),_0x151b4a);return respondWithRpcPromise(_0xaa5c('0x58'),_0xaa5c('0x30'),{'module':_0xaa5c('0x5f')});})[_0xaa5c('0x26')](handleError(_0xc2dd7c,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 46037f7..27477e5 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 _0x711a=['exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x711a,0xca));var _0xa711=function(_0x51bd72,_0x1bf44b){_0x51bd72=_0x51bd72-0x0;var _0x46c7cb=_0x711a[_0x51bd72];return _0x46c7cb;};'use strict';var _=require(_0xa711('0x0'));var util=require('util');var logger=require(_0xa711('0x1'))(_0xa711('0x2'));var moment=require(_0xa711('0x3'));var BPromise=require(_0xa711('0x4'));var rp=require(_0xa711('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa711('0x6'));var attributes=require('./voiceContext.attributes');module[_0xa711('0x7')]=function(_0x1fe489,_0xdffa9e){return _0x1fe489[_0xa711('0x8')](_0xa711('0x9'),attributes,{'tableName':_0xa711('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7661=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1c4601,_0x383540){var _0x5f24b9=function(_0x3314e2){while(--_0x3314e2){_0x1c4601['push'](_0x1c4601['shift']());}};_0x5f24b9(++_0x383540);}(_0x7661,0x125));var _0x1766=function(_0x4df487,_0x4a6be6){_0x4df487=_0x4df487-0x0;var _0x196d69=_0x7661[_0x4df487];return _0x196d69;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1766('0x0'))(_0x1766('0x1'));var moment=require(_0x1766('0x2'));var BPromise=require(_0x1766('0x3'));var rp=require(_0x1766('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1766('0x5'));var config=require(_0x1766('0x6'));var attributes=require(_0x1766('0x7'));module[_0x1766('0x8')]=function(_0x2447d8,_0x5a7150){return _0x2447d8[_0x1766('0x9')](_0x1766('0xa'),attributes,{'tableName':_0x1766('0xb'),'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 dd5dab7..5b9637d 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 _0x23c7=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','randomstring'];(function(_0x3d8785,_0x2e9180){var _0x2627d9=function(_0x30ba8d){while(--_0x30ba8d){_0x3d8785['push'](_0x3d8785['shift']());}};_0x2627d9(++_0x2e9180);}(_0x23c7,0x1e0));var _0x723c=function(_0x64382c,_0x2cda49){_0x64382c=_0x64382c-0x0;var _0x2efdc2=_0x23c7[_0x64382c];return _0x2efdc2;};'use strict';var _=require(_0x723c('0x0'));var util=require(_0x723c('0x1'));var moment=require('moment');var BPromise=require(_0x723c('0x2'));var rs=require(_0x723c('0x3'));var fs=require('fs');var Redis=require(_0x723c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x723c('0x5'));var logger=require(_0x723c('0x6'))(_0x723c('0x7'));var config=require('../../config/environment');var jayson=require(_0x723c('0x8'));var client=jayson[_0x723c('0x9')][_0x723c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfdbd25,_0x1e7268,_0x571b79){return new BPromise(function(_0x2747b9,_0x158cb6){return client[_0x723c('0xb')](_0xfdbd25,_0x571b79)[_0x723c('0xc')](function(_0x1ed087){logger['info'](_0x723c('0xd'),_0x1e7268,'request\x20sent');logger[_0x723c('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1e7268,_0x723c('0xf'),JSON['stringify'](_0x1ed087));if(_0x1ed087['error']){if(_0x1ed087[_0x723c('0x10')][_0x723c('0x11')]===0x1f4){logger[_0x723c('0x10')](_0x723c('0xd'),_0x1e7268,_0x1ed087[_0x723c('0x10')][_0x723c('0x12')]);return _0x158cb6(_0x1ed087[_0x723c('0x10')][_0x723c('0x12')]);}logger[_0x723c('0x10')]('VoiceContext,\x20%s,\x20%s',_0x1e7268,_0x1ed087[_0x723c('0x10')]['message']);return _0x2747b9(_0x1ed087['error'][_0x723c('0x12')]);}else{logger[_0x723c('0x13')]('VoiceContext,\x20%s,\x20%s',_0x1e7268,_0x723c('0xf'));_0x2747b9(_0x1ed087[_0x723c('0x14')]['message']);}})[_0x723c('0x15')](function(_0x5afddd){logger[_0x723c('0x10')](_0x723c('0xd'),_0x1e7268,_0x5afddd);_0x158cb6(_0x5afddd);});});} \ No newline at end of file +var _0x0627=['../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3c2c62,_0x2033c2){var _0x58bcb8=function(_0x25c172){while(--_0x25c172){_0x3c2c62['push'](_0x3c2c62['shift']());}};_0x58bcb8(++_0x2033c2);}(_0x0627,0x1d8));var _0x7062=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x0627[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x7062('0x0'));var util=require(_0x7062('0x1'));var moment=require(_0x7062('0x2'));var BPromise=require(_0x7062('0x3'));var rs=require(_0x7062('0x4'));var fs=require('fs');var Redis=require(_0x7062('0x5'));var db=require(_0x7062('0x6'))['db'];var utils=require(_0x7062('0x7'));var logger=require(_0x7062('0x8'))(_0x7062('0x9'));var config=require(_0x7062('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7062('0xb')][_0x7062('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x372759,_0x21cf85,_0x2ca86e){return new BPromise(function(_0x50da50,_0xb531a0){return client['request'](_0x372759,_0x2ca86e)[_0x7062('0xd')](function(_0x30d6f8){logger['info']('VoiceContext,\x20%s,\x20%s',_0x21cf85,_0x7062('0xe'));logger[_0x7062('0xf')](_0x7062('0x10'),_0x21cf85,'request\x20sent',JSON[_0x7062('0x11')](_0x30d6f8));if(_0x30d6f8[_0x7062('0x12')]){if(_0x30d6f8[_0x7062('0x12')][_0x7062('0x13')]===0x1f4){logger[_0x7062('0x12')](_0x7062('0x14'),_0x21cf85,_0x30d6f8[_0x7062('0x12')][_0x7062('0x15')]);return _0xb531a0(_0x30d6f8[_0x7062('0x12')][_0x7062('0x15')]);}logger['error'](_0x7062('0x14'),_0x21cf85,_0x30d6f8['error']['message']);return _0x50da50(_0x30d6f8[_0x7062('0x12')]['message']);}else{logger[_0x7062('0x16')](_0x7062('0x14'),_0x21cf85,_0x7062('0xe'));_0x50da50(_0x30d6f8['result'][_0x7062('0x15')]);}})[_0x7062('0x17')](function(_0x57a136){logger[_0x7062('0x12')](_0x7062('0x14'),_0x21cf85,_0x57a136);_0xb531a0(_0x57a136);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 1eb75df..656127f 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 _0xe424=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','util','path'];(function(_0x55c722,_0x1dc795){var _0x230588=function(_0x3ae35a){while(--_0x3ae35a){_0x55c722['push'](_0x55c722['shift']());}};_0x230588(++_0x1dc795);}(_0xe424,0x167));var _0x4e42=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xe424[_0x3054be];return _0x3df150;};'use strict';var multer=require('multer');var util=require(_0x4e42('0x0'));var path=require(_0x4e42('0x1'));var timeout=require(_0x4e42('0x2'));var express=require(_0x4e42('0x3'));var router=express[_0x4e42('0x4')]();var auth=require(_0x4e42('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4e42('0x6'));var controller=require(_0x4e42('0x7'));router[_0x4e42('0x8')]('/',auth[_0x4e42('0x9')](),controller[_0x4e42('0xa')]);router[_0x4e42('0x8')]('/describe',auth[_0x4e42('0x9')](),controller[_0x4e42('0xb')]);router[_0x4e42('0x8')](_0x4e42('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4e42('0xd')]('/',auth[_0x4e42('0x9')](),controller[_0x4e42('0xe')]);router[_0x4e42('0xf')](_0x4e42('0xc'),auth[_0x4e42('0x9')](),controller[_0x4e42('0x10')]);router[_0x4e42('0x11')](_0x4e42('0xc'),auth[_0x4e42('0x9')](),controller[_0x4e42('0x12')]);module['exports']=router; \ No newline at end of file +var _0x82d9=['/:id','show','post','put','update','delete','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x82d9,0x139));var _0x982d=function(_0x540789,_0x589af8){_0x540789=_0x540789-0x0;var _0x2e3bba=_0x82d9[_0x540789];return _0x2e3bba;};'use strict';var multer=require('multer');var util=require(_0x982d('0x0'));var path=require(_0x982d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x982d('0x2')]();var auth=require(_0x982d('0x3'));var interaction=require(_0x982d('0x4'));var config=require(_0x982d('0x5'));var controller=require(_0x982d('0x6'));router[_0x982d('0x7')]('/',auth[_0x982d('0x8')](),controller['index']);router['get'](_0x982d('0x9'),auth['isAuthenticated'](),controller[_0x982d('0xa')]);router['get'](_0x982d('0xb'),auth[_0x982d('0x8')](),controller[_0x982d('0xc')]);router[_0x982d('0xd')]('/',auth[_0x982d('0x8')](),controller['create']);router[_0x982d('0xe')](_0x982d('0xb'),auth[_0x982d('0x8')](),controller[_0x982d('0xf')]);router[_0x982d('0x10')](_0x982d('0xb'),auth[_0x982d('0x8')](),controller['destroy']);module[_0x982d('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 81c20f9..0c9e8fa 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 _0xb13f=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x12d7e1,_0x3a4395){var _0xfbe6ba=function(_0x8274a){while(--_0x8274a){_0x12d7e1['push'](_0x12d7e1['shift']());}};_0xfbe6ba(++_0x3a4395);}(_0xb13f,0x112));var _0xfb13=function(_0x4f9f92,_0x1d6eac){_0x4f9f92=_0x4f9f92-0x0;var _0x173b70=_0xb13f[_0x4f9f92];return _0x173b70;};'use strict';var Sequelize=require(_0xfb13('0x0'));module[_0xfb13('0x1')]={'privilege':{'type':Sequelize[_0xfb13('0x2')]},'channel':{'type':Sequelize[_0xfb13('0x2')]},'channelstate':{'type':Sequelize[_0xfb13('0x3')]},'channelstatedesc':{'type':Sequelize[_0xfb13('0x2')]},'calleridnum':{'type':Sequelize[_0xfb13('0x2')]},'calleridname':{'type':Sequelize[_0xfb13('0x2')]},'connectedlinenum':{'type':Sequelize[_0xfb13('0x2')]},'connectedlinename':{'type':Sequelize[_0xfb13('0x2')]},'language':{'type':Sequelize[_0xfb13('0x2')]},'accountcode':{'type':Sequelize[_0xfb13('0x2')]},'context':{'type':Sequelize[_0xfb13('0x2')]},'exten':{'type':Sequelize[_0xfb13('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xfb13('0x2')]},'destchannel':{'type':Sequelize[_0xfb13('0x2')]},'destchannelstate':{'type':Sequelize[_0xfb13('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xfb13('0x2')]},'destcalleridnum':{'type':Sequelize[_0xfb13('0x2')]},'destcalleridname':{'type':Sequelize[_0xfb13('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xfb13('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xfb13('0x2')]},'destlanguage':{'type':Sequelize[_0xfb13('0x2')]},'destaccountcode':{'type':Sequelize[_0xfb13('0x2')]},'destcontext':{'type':Sequelize[_0xfb13('0x2')]},'destexten':{'type':Sequelize[_0xfb13('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xfb13('0x2')]},'destlinkedid':{'type':Sequelize[_0xfb13('0x2')]},'dialstring':{'type':Sequelize[_0xfb13('0x2')]},'dialstatus':{'type':Sequelize[_0xfb13('0x2')]},'starttime':{'type':Sequelize[_0xfb13('0x4')]},'answertime':{'type':Sequelize[_0xfb13('0x4')]},'endtime':{'type':Sequelize[_0xfb13('0x4')]},'lastevent':{'type':Sequelize[_0xfb13('0x2')],'comment':_0xfb13('0x5')},'routeId':{'type':Sequelize[_0xfb13('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xfb13('0x3')]}}; \ No newline at end of file +var _0xce97=['exports','STRING','INTEGER','DATE'];(function(_0x117289,_0x44a47a){var _0x48405f=function(_0x5d11c1){while(--_0x5d11c1){_0x117289['push'](_0x117289['shift']());}};_0x48405f(++_0x44a47a);}(_0xce97,0x1d8));var _0x7ce9=function(_0x417c17,_0xaaae82){_0x417c17=_0x417c17-0x0;var _0x3e4b15=_0xce97[_0x417c17];return _0x3e4b15;};'use strict';var Sequelize=require('sequelize');module[_0x7ce9('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7ce9('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7ce9('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7ce9('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7ce9('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7ce9('0x1')]},'context':{'type':Sequelize[_0x7ce9('0x1')]},'exten':{'type':Sequelize[_0x7ce9('0x1')]},'priority':{'type':Sequelize[_0x7ce9('0x2')]},'uniqueid':{'type':Sequelize[_0x7ce9('0x1')]},'linkedid':{'type':Sequelize[_0x7ce9('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7ce9('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x7ce9('0x1')]},'destcalleridnum':{'type':Sequelize[_0x7ce9('0x1')]},'destcalleridname':{'type':Sequelize[_0x7ce9('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7ce9('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x7ce9('0x1')]},'destcontext':{'type':Sequelize[_0x7ce9('0x1')]},'destexten':{'type':Sequelize[_0x7ce9('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x7ce9('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7ce9('0x1')]},'dialstatus':{'type':Sequelize[_0x7ce9('0x1')]},'starttime':{'type':Sequelize[_0x7ce9('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x7ce9('0x2')]},'duration':{'type':Sequelize[_0x7ce9('0x2')]},'holdtime':{'type':Sequelize[_0x7ce9('0x2')]},'billableseconds':{'type':Sequelize[_0x7ce9('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 23ae180..0ab822b 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 _0x1505=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','options','count','includeAll','VoiceDialReport','findAll','catch','show','params','intersection','fields','include','find','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','squel','to-csv','querystring','../../components/auth/service'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x1505,0x7e));var _0x5150=function(_0x481c28,_0x19280a){_0x481c28=_0x481c28-0x0;var _0x39b5e9=_0x1505[_0x481c28];return _0x39b5e9;};'use strict';var pdf=require(_0x5150('0x0'));var emlformat=require(_0x5150('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5150('0x2'));var jsonpatch=require(_0x5150('0x3'));var rp=require('request-promise');var moment=require(_0x5150('0x4'));var BPromise=require(_0x5150('0x5'));var Mustache=require(_0x5150('0x6'));var util=require(_0x5150('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5150('0x8'));var fs=require('fs');var _=require(_0x5150('0x9'));var squel=require(_0x5150('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5150('0xb'));var querystring=require(_0x5150('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5150('0xd'));var qs=require(_0x5150('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5150('0xf'));var logger=require('../../config/logger')(_0x5150('0x10'));var utils=require(_0x5150('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x5150('0x12'));var db=require(_0x5150('0x13'))['db'];function respondWithStatusCode(_0xd80582,_0x21d340){_0x21d340=_0x21d340||0xcc;return function(_0x375054){if(_0x375054){return _0xd80582[_0x5150('0x14')](_0x21d340);}return _0xd80582[_0x5150('0x15')](_0x21d340)[_0x5150('0x16')]();};}function respondWithResult(_0x53b738,_0x5a254a){_0x5a254a=_0x5a254a||0xc8;return function(_0x1dd56c){if(_0x1dd56c){return _0x53b738['status'](_0x5a254a)[_0x5150('0x17')](_0x1dd56c);}};}function respondWithFilteredResult(_0xc11740,_0x4e445f){return function(_0x2821d3){if(_0x2821d3){var _0x47bfca=_0x2821d3['count'],_0x3c3e42=_0x4e445f['offset'],_0x1fb8fd=_0x4e445f['offset']+_0x4e445f[_0x5150('0x18')],_0x4a9f7e;if(_0x1fb8fd>=_0x47bfca){_0x1fb8fd=_0x47bfca;_0x4a9f7e=0xc8;}else{_0x4a9f7e=0xce;}_0xc11740[_0x5150('0x15')](_0x4a9f7e);return _0xc11740[_0x5150('0x19')](_0x5150('0x1a'),_0x3c3e42+'-'+_0x1fb8fd+'/'+_0x47bfca)[_0x5150('0x17')](_0x2821d3);}return null;};}function patchUpdates(_0x4a063c){return function(_0x1de32a){try{jsonpatch[_0x5150('0x1b')](_0x1de32a,_0x4a063c,!![]);}catch(_0x3253e9){return BPromise[_0x5150('0x1c')](_0x3253e9);}return _0x1de32a[_0x5150('0x1d')]();};}function saveUpdates(_0x151a24,_0x4de0e1){return function(_0x71cb52){if(_0x71cb52){return _0x71cb52[_0x5150('0x1e')](_0x151a24)[_0x5150('0x1f')](function(_0x64cdd6){return _0x64cdd6;});}return null;};}function removeEntity(_0xafc6a6,_0x48144c){return function(_0x1e1012){if(_0x1e1012){return _0x1e1012[_0x5150('0x20')]()[_0x5150('0x1f')](function(){_0xafc6a6[_0x5150('0x15')](0xcc)[_0x5150('0x16')]();});}};}function handleEntityNotFound(_0x4ee0d2,_0x45031d){return function(_0x3633ca){if(!_0x3633ca){_0x4ee0d2[_0x5150('0x14')](0x194);}return _0x3633ca;};}function handleError(_0x20f7ad,_0x463850){_0x463850=_0x463850||0x1f4;return function(_0x330bc0){logger[_0x5150('0x21')](_0x330bc0[_0x5150('0x22')]);if(_0x330bc0[_0x5150('0x23')]){delete _0x330bc0[_0x5150('0x23')];}_0x20f7ad[_0x5150('0x15')](_0x463850)[_0x5150('0x24')](_0x330bc0);};}exports[_0x5150('0x25')]=function(_0x555b94,_0x1ff17c){var _0x32ec7b={},_0x2352d7={},_0x4da7dc={'count':0x0,'rows':[]};var _0x205a76=_[_0x5150('0x26')](db['VoiceDialReport'][_0x5150('0x27')],function(_0x17244e){return{'name':_0x17244e[_0x5150('0x28')],'type':_0x17244e[_0x5150('0x29')][_0x5150('0x2a')]};});_0x2352d7[_0x5150('0x2b')]=_[_0x5150('0x26')](_0x205a76,_0x5150('0x23'));_0x2352d7['query']=_[_0x5150('0x2c')](_0x555b94[_0x5150('0x2d')]);_0x2352d7[_0x5150('0x2e')]=_['intersection'](_0x2352d7[_0x5150('0x2b')],_0x2352d7[_0x5150('0x2d')]);_0x32ec7b[_0x5150('0x2f')]=_['intersection'](_0x2352d7['model'],qs['fields'](_0x555b94['query']['fields']));_0x32ec7b['attributes']=_0x32ec7b[_0x5150('0x2f')][_0x5150('0x30')]?_0x32ec7b[_0x5150('0x2f')]:_0x2352d7[_0x5150('0x2b')];if(!_0x555b94[_0x5150('0x2d')][_0x5150('0x31')](_0x5150('0x32'))){_0x32ec7b[_0x5150('0x18')]=qs['limit'](_0x555b94[_0x5150('0x2d')][_0x5150('0x18')]);_0x32ec7b[_0x5150('0x33')]=qs[_0x5150('0x33')](_0x555b94['query'][_0x5150('0x33')]);}_0x32ec7b['order']=qs[_0x5150('0x34')](_0x555b94[_0x5150('0x2d')][_0x5150('0x34')]);_0x32ec7b[_0x5150('0x35')]=qs[_0x5150('0x2e')](_['pick'](_0x555b94[_0x5150('0x2d')],_0x2352d7[_0x5150('0x2e')]),_0x205a76);if(_0x555b94[_0x5150('0x2d')][_0x5150('0x36')]){_0x32ec7b[_0x5150('0x35')]=_[_0x5150('0x37')](_0x32ec7b['where'],{'$or':_[_0x5150('0x26')](_0x205a76,function(_0x5a0e1c){if(_0x5a0e1c[_0x5150('0x29')]!=='VIRTUAL'){var _0x4bd1e5={};_0x4bd1e5[_0x5a0e1c[_0x5150('0x23')]]={'$like':'%'+_0x555b94[_0x5150('0x2d')][_0x5150('0x36')]+'%'};return _0x4bd1e5;}})});}_0x32ec7b=_[_0x5150('0x37')]({},_0x32ec7b,_0x555b94[_0x5150('0x38')]);var _0x484d66={'where':_0x32ec7b[_0x5150('0x35')]};return db['VoiceDialReport'][_0x5150('0x39')](_0x484d66)[_0x5150('0x1f')](function(_0x4f509b){_0x4da7dc[_0x5150('0x39')]=_0x4f509b;if(_0x555b94[_0x5150('0x2d')][_0x5150('0x3a')]){_0x32ec7b['include']=[{'all':!![]}];}return db[_0x5150('0x3b')][_0x5150('0x3c')](_0x32ec7b);})['then'](function(_0x26b6d9){_0x4da7dc['rows']=_0x26b6d9;return _0x4da7dc;})[_0x5150('0x1f')](respondWithFilteredResult(_0x1ff17c,_0x32ec7b))[_0x5150('0x3d')](handleError(_0x1ff17c,null));};exports[_0x5150('0x3e')]=function(_0x30a6bb,_0x2efd8a){var _0x1164fb={'raw':!![],'where':{'id':_0x30a6bb[_0x5150('0x3f')]['id']}},_0x1d3451={};_0x1d3451['model']=_[_0x5150('0x2c')](db['VoiceDialReport']['rawAttributes']);_0x1d3451['query']=_[_0x5150('0x2c')](_0x30a6bb[_0x5150('0x2d')]);_0x1d3451[_0x5150('0x2e')]=_[_0x5150('0x40')](_0x1d3451[_0x5150('0x2b')],_0x1d3451[_0x5150('0x2d')]);_0x1164fb[_0x5150('0x2f')]=_['intersection'](_0x1d3451['model'],qs['fields'](_0x30a6bb['query'][_0x5150('0x41')]));_0x1164fb[_0x5150('0x2f')]=_0x1164fb['attributes'][_0x5150('0x30')]?_0x1164fb[_0x5150('0x2f')]:_0x1d3451[_0x5150('0x2b')];if(_0x30a6bb['query'][_0x5150('0x3a')]){_0x1164fb[_0x5150('0x42')]=[{'all':!![]}];}_0x1164fb=_[_0x5150('0x37')]({},_0x1164fb,_0x30a6bb[_0x5150('0x38')]);return db[_0x5150('0x3b')][_0x5150('0x43')](_0x1164fb)[_0x5150('0x1f')](handleEntityNotFound(_0x2efd8a,null))[_0x5150('0x1f')](respondWithResult(_0x2efd8a,null))[_0x5150('0x3d')](handleError(_0x2efd8a,null));};exports['create']=function(_0x455d87,_0x1d8187){return db[_0x5150('0x3b')]['create'](_0x455d87['body'],{})[_0x5150('0x1f')](respondWithResult(_0x1d8187,0xc9))['catch'](handleError(_0x1d8187,null));};exports[_0x5150('0x1e')]=function(_0x22cc43,_0x167ab0){if(_0x22cc43[_0x5150('0x44')]['id']){delete _0x22cc43['body']['id'];}return db[_0x5150('0x3b')][_0x5150('0x43')]({'where':{'id':_0x22cc43[_0x5150('0x3f')]['id']}})[_0x5150('0x1f')](handleEntityNotFound(_0x167ab0,null))[_0x5150('0x1f')](saveUpdates(_0x22cc43[_0x5150('0x44')],null))[_0x5150('0x1f')](respondWithResult(_0x167ab0,null))[_0x5150('0x3d')](handleError(_0x167ab0,null));};exports[_0x5150('0x20')]=function(_0x365fd3,_0x4d4a8f){return db[_0x5150('0x3b')][_0x5150('0x43')]({'where':{'id':_0x365fd3[_0x5150('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4d4a8f,null))['then'](removeEntity(_0x4d4a8f,null))['catch'](handleError(_0x4d4a8f,null));};exports[_0x5150('0x45')]=function(_0x2fbcc8,_0x10d1cf){return db['VoiceDialReport']['describe']()[_0x5150('0x1f')](respondWithResult(_0x10d1cf,null))[_0x5150('0x3d')](handleError(_0x10d1cf,null));}; \ No newline at end of file +var _0xcef5=['json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','index','map','VoiceDialReport','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','keys','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xcef5,0x14e));var _0x5cef=function(_0x15ef65,_0x4d8ed7){_0x15ef65=_0x15ef65-0x0;var _0x59aa39=_0xcef5[_0x15ef65];return _0x59aa39;};'use strict';var pdf=require(_0x5cef('0x0'));var emlformat=require(_0x5cef('0x1'));var rimraf=require(_0x5cef('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5cef('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5cef('0x4'));var path=require(_0x5cef('0x5'));var sox=require(_0x5cef('0x6'));var csv=require(_0x5cef('0x7'));var ejs=require(_0x5cef('0x8'));var fs=require('fs');var _=require(_0x5cef('0x9'));var squel=require(_0x5cef('0xa'));var crypto=require(_0x5cef('0xb'));var jsforce=require(_0x5cef('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5cef('0x7'));var querystring=require(_0x5cef('0xd'));var Papa=require(_0x5cef('0xe'));var Redis=require('ioredis');var authService=require(_0x5cef('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5cef('0x10'));var hardwareService=require(_0x5cef('0x11'));var logger=require(_0x5cef('0x12'))(_0x5cef('0x13'));var utils=require(_0x5cef('0x14'));var config=require(_0x5cef('0x15'));var licenseUtil=require(_0x5cef('0x16'));var db=require(_0x5cef('0x17'))['db'];function respondWithStatusCode(_0x27750d,_0x5f24dd){_0x5f24dd=_0x5f24dd||0xcc;return function(_0x27249b){if(_0x27249b){return _0x27750d[_0x5cef('0x18')](_0x5f24dd);}return _0x27750d[_0x5cef('0x19')](_0x5f24dd)['end']();};}function respondWithResult(_0x2198dc,_0x40c923){_0x40c923=_0x40c923||0xc8;return function(_0x40018b){if(_0x40018b){return _0x2198dc['status'](_0x40c923)[_0x5cef('0x1a')](_0x40018b);}};}function respondWithFilteredResult(_0x3503c3,_0x575ead){return function(_0x21c7f3){if(_0x21c7f3){var _0x3280a9=_0x21c7f3[_0x5cef('0x1b')],_0x5560d6=_0x575ead[_0x5cef('0x1c')],_0x150151=_0x575ead[_0x5cef('0x1c')]+_0x575ead[_0x5cef('0x1d')],_0x5bc108;if(_0x150151>=_0x3280a9){_0x150151=_0x3280a9;_0x5bc108=0xc8;}else{_0x5bc108=0xce;}_0x3503c3[_0x5cef('0x19')](_0x5bc108);return _0x3503c3[_0x5cef('0x1e')](_0x5cef('0x1f'),_0x5560d6+'-'+_0x150151+'/'+_0x3280a9)['json'](_0x21c7f3);}return null;};}function patchUpdates(_0x1d3ca0){return function(_0x5725f9){try{jsonpatch[_0x5cef('0x20')](_0x5725f9,_0x1d3ca0,!![]);}catch(_0x1bbad5){return BPromise[_0x5cef('0x21')](_0x1bbad5);}return _0x5725f9[_0x5cef('0x22')]();};}function saveUpdates(_0x57a0e1,_0x3f8504){return function(_0x437ade){if(_0x437ade){return _0x437ade['update'](_0x57a0e1)[_0x5cef('0x23')](function(_0xcc8769){return _0xcc8769;});}return null;};}function removeEntity(_0x1a2bdf,_0x819fc0){return function(_0x294a3f){if(_0x294a3f){return _0x294a3f['destroy']()['then'](function(){_0x1a2bdf[_0x5cef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37f8bb,_0x7edeee){return function(_0x43c886){if(!_0x43c886){_0x37f8bb[_0x5cef('0x18')](0x194);}return _0x43c886;};}function handleError(_0x5947e4,_0x1afa89){_0x1afa89=_0x1afa89||0x1f4;return function(_0x33f04c){logger[_0x5cef('0x24')](_0x33f04c[_0x5cef('0x25')]);if(_0x33f04c[_0x5cef('0x26')]){delete _0x33f04c[_0x5cef('0x26')];}_0x5947e4[_0x5cef('0x19')](_0x1afa89)['send'](_0x33f04c);};}exports[_0x5cef('0x27')]=function(_0x3210e5,_0x552b83){var _0x2adedc={},_0x45abd5={},_0xd09aa8={'count':0x0,'rows':[]};var _0x567bc8=_[_0x5cef('0x28')](db[_0x5cef('0x29')]['rawAttributes'],function(_0x1c2b2a){return{'name':_0x1c2b2a['fieldName'],'type':_0x1c2b2a[_0x5cef('0x2a')]['key']};});_0x45abd5[_0x5cef('0x2b')]=_[_0x5cef('0x28')](_0x567bc8,'name');_0x45abd5[_0x5cef('0x2c')]=_['keys'](_0x3210e5[_0x5cef('0x2c')]);_0x45abd5[_0x5cef('0x2d')]=_[_0x5cef('0x2e')](_0x45abd5[_0x5cef('0x2b')],_0x45abd5[_0x5cef('0x2c')]);_0x2adedc['attributes']=_[_0x5cef('0x2e')](_0x45abd5[_0x5cef('0x2b')],qs['fields'](_0x3210e5[_0x5cef('0x2c')][_0x5cef('0x2f')]));_0x2adedc[_0x5cef('0x30')]=_0x2adedc[_0x5cef('0x30')][_0x5cef('0x31')]?_0x2adedc[_0x5cef('0x30')]:_0x45abd5[_0x5cef('0x2b')];if(!_0x3210e5[_0x5cef('0x2c')][_0x5cef('0x32')](_0x5cef('0x33'))){_0x2adedc[_0x5cef('0x1d')]=qs[_0x5cef('0x1d')](_0x3210e5[_0x5cef('0x2c')][_0x5cef('0x1d')]);_0x2adedc[_0x5cef('0x1c')]=qs[_0x5cef('0x1c')](_0x3210e5[_0x5cef('0x2c')][_0x5cef('0x1c')]);}_0x2adedc[_0x5cef('0x34')]=qs['sort'](_0x3210e5[_0x5cef('0x2c')][_0x5cef('0x35')]);_0x2adedc[_0x5cef('0x36')]=qs[_0x5cef('0x2d')](_[_0x5cef('0x37')](_0x3210e5[_0x5cef('0x2c')],_0x45abd5[_0x5cef('0x2d')]),_0x567bc8);if(_0x3210e5[_0x5cef('0x2c')][_0x5cef('0x38')]){_0x2adedc['where']=_[_0x5cef('0x39')](_0x2adedc[_0x5cef('0x36')],{'$or':_[_0x5cef('0x28')](_0x567bc8,function(_0x7a2dd5){if(_0x7a2dd5['type']!=='VIRTUAL'){var _0x46f7d4={};_0x46f7d4[_0x7a2dd5['name']]={'$like':'%'+_0x3210e5[_0x5cef('0x2c')][_0x5cef('0x38')]+'%'};return _0x46f7d4;}})});}_0x2adedc=_['merge']({},_0x2adedc,_0x3210e5[_0x5cef('0x3a')]);var _0x17c0b9={'where':_0x2adedc[_0x5cef('0x36')]};return db[_0x5cef('0x29')][_0x5cef('0x1b')](_0x17c0b9)[_0x5cef('0x23')](function(_0x42cc78){_0xd09aa8['count']=_0x42cc78;if(_0x3210e5[_0x5cef('0x2c')]['includeAll']){_0x2adedc[_0x5cef('0x3b')]=[{'all':!![]}];}return db[_0x5cef('0x29')][_0x5cef('0x3c')](_0x2adedc);})[_0x5cef('0x23')](function(_0x134d05){_0xd09aa8[_0x5cef('0x3d')]=_0x134d05;return _0xd09aa8;})[_0x5cef('0x23')](respondWithFilteredResult(_0x552b83,_0x2adedc))[_0x5cef('0x3e')](handleError(_0x552b83,null));};exports[_0x5cef('0x3f')]=function(_0x1c7cc0,_0x5e8acf){var _0x56f9ac={'raw':!![],'where':{'id':_0x1c7cc0[_0x5cef('0x40')]['id']}},_0x432654={};_0x432654[_0x5cef('0x2b')]=_['keys'](db[_0x5cef('0x29')][_0x5cef('0x41')]);_0x432654[_0x5cef('0x2c')]=_[_0x5cef('0x42')](_0x1c7cc0[_0x5cef('0x2c')]);_0x432654['filters']=_[_0x5cef('0x2e')](_0x432654[_0x5cef('0x2b')],_0x432654[_0x5cef('0x2c')]);_0x56f9ac[_0x5cef('0x30')]=_[_0x5cef('0x2e')](_0x432654[_0x5cef('0x2b')],qs[_0x5cef('0x2f')](_0x1c7cc0[_0x5cef('0x2c')][_0x5cef('0x2f')]));_0x56f9ac[_0x5cef('0x30')]=_0x56f9ac['attributes'][_0x5cef('0x31')]?_0x56f9ac['attributes']:_0x432654[_0x5cef('0x2b')];if(_0x1c7cc0[_0x5cef('0x2c')][_0x5cef('0x43')]){_0x56f9ac['include']=[{'all':!![]}];}_0x56f9ac=_[_0x5cef('0x39')]({},_0x56f9ac,_0x1c7cc0[_0x5cef('0x3a')]);return db[_0x5cef('0x29')]['find'](_0x56f9ac)[_0x5cef('0x23')](handleEntityNotFound(_0x5e8acf,null))[_0x5cef('0x23')](respondWithResult(_0x5e8acf,null))[_0x5cef('0x3e')](handleError(_0x5e8acf,null));};exports[_0x5cef('0x44')]=function(_0x583af5,_0x415053){return db[_0x5cef('0x29')][_0x5cef('0x44')](_0x583af5['body'],{})[_0x5cef('0x23')](respondWithResult(_0x415053,0xc9))[_0x5cef('0x3e')](handleError(_0x415053,null));};exports['update']=function(_0x36d3a8,_0x40c683){if(_0x36d3a8[_0x5cef('0x45')]['id']){delete _0x36d3a8[_0x5cef('0x45')]['id'];}return db[_0x5cef('0x29')][_0x5cef('0x46')]({'where':{'id':_0x36d3a8['params']['id']}})[_0x5cef('0x23')](handleEntityNotFound(_0x40c683,null))['then'](saveUpdates(_0x36d3a8[_0x5cef('0x45')],null))[_0x5cef('0x23')](respondWithResult(_0x40c683,null))[_0x5cef('0x3e')](handleError(_0x40c683,null));};exports['destroy']=function(_0x5d7bec,_0x33d178){return db['VoiceDialReport']['find']({'where':{'id':_0x5d7bec['params']['id']}})[_0x5cef('0x23')](handleEntityNotFound(_0x33d178,null))[_0x5cef('0x23')](removeEntity(_0x33d178,null))[_0x5cef('0x3e')](handleError(_0x33d178,null));};exports[_0x5cef('0x47')]=function(_0x26244e,_0x36c254){return db[_0x5cef('0x29')][_0x5cef('0x47')]()[_0x5cef('0x23')](respondWithResult(_0x36c254,null))[_0x5cef('0x3e')](handleError(_0x36c254,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index f5bd8f8..c2fc6df 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 _0x6d18=['request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','../../config/logger','api','moment','bluebird'];(function(_0x56ffde,_0x389999){var _0x39623a=function(_0x27c1c3){while(--_0x27c1c3){_0x56ffde['push'](_0x56ffde['shift']());}};_0x39623a(++_0x389999);}(_0x6d18,0x13d));var _0x86d1=function(_0x339c7d,_0x29054e){_0x339c7d=_0x339c7d-0x0;var _0x5ec80a=_0x6d18[_0x339c7d];return _0x5ec80a;};'use strict';var _=require(_0x86d1('0x0'));var util=require('util');var logger=require(_0x86d1('0x1'))(_0x86d1('0x2'));var moment=require(_0x86d1('0x3'));var BPromise=require(_0x86d1('0x4'));var rp=require(_0x86d1('0x5'));var fs=require('fs');var path=require(_0x86d1('0x6'));var rimraf=require(_0x86d1('0x7'));var config=require(_0x86d1('0x8'));var attributes=require(_0x86d1('0x9'));module[_0x86d1('0xa')]=function(_0x4775a9,_0x4e716c){return _0x4775a9[_0x86d1('0xb')](_0x86d1('0xc'),attributes,{'tableName':_0x86d1('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2fbf=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x3246a6,_0x2a685a){var _0x1df64d=function(_0x4868ad){while(--_0x4868ad){_0x3246a6['push'](_0x3246a6['shift']());}};_0x1df64d(++_0x2a685a);}(_0x2fbf,0xfb));var _0xf2fb=function(_0x225721,_0x3f26d2){_0x225721=_0x225721-0x0;var _0x160053=_0x2fbf[_0x225721];return _0x160053;};'use strict';var _=require(_0xf2fb('0x0'));var util=require(_0xf2fb('0x1'));var logger=require(_0xf2fb('0x2'))(_0xf2fb('0x3'));var moment=require(_0xf2fb('0x4'));var BPromise=require(_0xf2fb('0x5'));var rp=require(_0xf2fb('0x6'));var fs=require('fs');var path=require(_0xf2fb('0x7'));var rimraf=require('rimraf');var config=require(_0xf2fb('0x8'));var attributes=require(_0xf2fb('0x9'));module['exports']=function(_0x528b31,_0x46273e){return _0x528b31[_0xf2fb('0xa')](_0xf2fb('0xb'),attributes,{'tableName':_0xf2fb('0xc'),'paranoid':![],'indexes':[{'fields':[_0xf2fb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index b7c63d6..7b4ac69 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 _0xfdf9=['CreateVoiceDialReport','VoiceDialReport','create','options','UpdateVoiceDialReport','update','body','attributes','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch'];(function(_0x6da129,_0x40948d){var _0x1349d6=function(_0x3b1bc){while(--_0x3b1bc){_0x6da129['push'](_0x6da129['shift']());}};_0x1349d6(++_0x40948d);}(_0xfdf9,0xa3));var _0x9fdf=function(_0x4057ec,_0x425f09){_0x4057ec=_0x4057ec-0x0;var _0xe062c=_0xfdf9[_0x4057ec];return _0xe062c;};'use strict';var _=require(_0x9fdf('0x0'));var util=require(_0x9fdf('0x1'));var moment=require(_0x9fdf('0x2'));var BPromise=require(_0x9fdf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9fdf('0x4'));var logger=require(_0x9fdf('0x5'))(_0x9fdf('0x6'));var config=require('../../config/environment');var jayson=require(_0x9fdf('0x7'));var client=jayson[_0x9fdf('0x8')][_0x9fdf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c8502,_0x7a73ec,_0x3a448d){return new BPromise(function(_0x5d2e23,_0x1b20d9){return client[_0x9fdf('0xa')](_0x3c8502,_0x3a448d)[_0x9fdf('0xb')](function(_0x4d4b34){logger[_0x9fdf('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x7a73ec,'request\x20sent');logger[_0x9fdf('0xd')](_0x9fdf('0xe'),_0x7a73ec,_0x9fdf('0xf'),JSON[_0x9fdf('0x10')](_0x4d4b34));if(_0x4d4b34['error']){if(_0x4d4b34[_0x9fdf('0x11')][_0x9fdf('0x12')]===0x1f4){logger['error'](_0x9fdf('0x13'),_0x7a73ec,_0x4d4b34[_0x9fdf('0x11')][_0x9fdf('0x14')]);return _0x1b20d9(_0x4d4b34[_0x9fdf('0x11')][_0x9fdf('0x14')]);}logger[_0x9fdf('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x7a73ec,_0x4d4b34[_0x9fdf('0x11')][_0x9fdf('0x14')]);return _0x5d2e23(_0x4d4b34[_0x9fdf('0x11')][_0x9fdf('0x14')]);}else{logger[_0x9fdf('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x7a73ec,_0x9fdf('0xf'));_0x5d2e23(_0x4d4b34[_0x9fdf('0x15')][_0x9fdf('0x14')]);}})[_0x9fdf('0x16')](function(_0xaad817){logger[_0x9fdf('0x11')](_0x9fdf('0x13'),_0x7a73ec,_0xaad817);_0x1b20d9(_0xaad817);});});}exports[_0x9fdf('0x17')]=function(_0x57c91d){var _0x3948b1=this;return new Promise(function(_0x5f9ef5,_0x2e1bee){return db[_0x9fdf('0x18')][_0x9fdf('0x19')](_0x57c91d['body'],{'raw':_0x57c91d[_0x9fdf('0x1a')]?_0x57c91d[_0x9fdf('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9fdf('0xb')](function(_0xa5bc89){logger[_0x9fdf('0xc')](_0x9fdf('0x17'),_0x57c91d);logger['debug'](_0x9fdf('0x17'),_0x57c91d,JSON[_0x9fdf('0x10')](_0xa5bc89));_0x5f9ef5(_0xa5bc89);})[_0x9fdf('0x16')](function(_0xce8c2c){logger[_0x9fdf('0x11')](_0x9fdf('0x17'),_0xce8c2c[_0x9fdf('0x14')],_0x57c91d);_0x2e1bee(_0x3948b1['error'](0x1f4,_0xce8c2c[_0x9fdf('0x14')]));});});};exports[_0x9fdf('0x1b')]=function(_0x1475a8){var _0x189df3=this;return new Promise(function(_0x59bd13,_0x52b755){return db[_0x9fdf('0x18')][_0x9fdf('0x1c')](_0x1475a8[_0x9fdf('0x1d')],{'raw':_0x1475a8[_0x9fdf('0x1a')]?_0x1475a8[_0x9fdf('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1475a8[_0x9fdf('0x1a')]?_0x1475a8[_0x9fdf('0x1a')]['where']||null:null,'attributes':_0x1475a8[_0x9fdf('0x1a')]?_0x1475a8[_0x9fdf('0x1a')][_0x9fdf('0x1e')]||null:null,'limit':_0x1475a8[_0x9fdf('0x1a')]?_0x1475a8[_0x9fdf('0x1a')]['limit']||null:null})[_0x9fdf('0xb')](function(_0x3f7187){logger[_0x9fdf('0xc')](_0x9fdf('0x1b'),_0x1475a8);logger['debug']('UpdateVoiceDialReport',_0x1475a8,JSON['stringify'](_0x3f7187));_0x59bd13(_0x3f7187);})['catch'](function(_0x125398){logger['error']('UpdateVoiceDialReport',_0x125398[_0x9fdf('0x14')],_0x1475a8);_0x52b755(_0x189df3[_0x9fdf('0x11')](0x1f4,_0x125398[_0x9fdf('0x14')]));});});}; \ No newline at end of file +var _0x5f53=['http','request','then','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','VoiceDialReport,\x20%s,\x20%s','message','info','result','catch','VoiceDialReport','body','raw','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','options','where','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5f53,0x140));var _0x35f5=function(_0x3b98c1,_0x3a4ae5){_0x3b98c1=_0x3b98c1-0x0;var _0x26990b=_0x5f53[_0x3b98c1];return _0x26990b;};'use strict';var _=require(_0x35f5('0x0'));var util=require(_0x35f5('0x1'));var moment=require(_0x35f5('0x2'));var BPromise=require(_0x35f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35f5('0x4'));var db=require(_0x35f5('0x5'))['db'];var utils=require(_0x35f5('0x6'));var logger=require('../../config/logger')(_0x35f5('0x7'));var config=require('../../config/environment');var jayson=require(_0x35f5('0x8'));var client=jayson[_0x35f5('0x9')][_0x35f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x68fcb8,_0x57109e,_0x521d23){return new BPromise(function(_0x4d2e00,_0x50bb20){return client[_0x35f5('0xb')](_0x68fcb8,_0x521d23)[_0x35f5('0xc')](function(_0x472a4e){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x57109e,_0x35f5('0xd'));logger['debug'](_0x35f5('0xe'),_0x57109e,_0x35f5('0xd'),JSON['stringify'](_0x472a4e));if(_0x472a4e[_0x35f5('0xf')]){if(_0x472a4e[_0x35f5('0xf')][_0x35f5('0x10')]===0x1f4){logger[_0x35f5('0xf')](_0x35f5('0x11'),_0x57109e,_0x472a4e[_0x35f5('0xf')][_0x35f5('0x12')]);return _0x50bb20(_0x472a4e[_0x35f5('0xf')][_0x35f5('0x12')]);}logger[_0x35f5('0xf')](_0x35f5('0x11'),_0x57109e,_0x472a4e[_0x35f5('0xf')][_0x35f5('0x12')]);return _0x4d2e00(_0x472a4e[_0x35f5('0xf')][_0x35f5('0x12')]);}else{logger[_0x35f5('0x13')](_0x35f5('0x11'),_0x57109e,_0x35f5('0xd'));_0x4d2e00(_0x472a4e[_0x35f5('0x14')]['message']);}})[_0x35f5('0x15')](function(_0x161e81){logger['error'](_0x35f5('0x11'),_0x57109e,_0x161e81);_0x50bb20(_0x161e81);});});}exports['CreateVoiceDialReport']=function(_0x3c72d9){var _0x518727=this;return new Promise(function(_0x3ae674,_0x505dff){return db[_0x35f5('0x16')]['create'](_0x3c72d9[_0x35f5('0x17')],{'raw':_0x3c72d9['options']?_0x3c72d9['options'][_0x35f5('0x18')]===undefined?!![]:![]:!![]})[_0x35f5('0xc')](function(_0x3d9601){logger[_0x35f5('0x13')](_0x35f5('0x19'),_0x3c72d9);logger['debug'](_0x35f5('0x19'),_0x3c72d9,JSON[_0x35f5('0x1a')](_0x3d9601));_0x3ae674(_0x3d9601);})[_0x35f5('0x15')](function(_0x476474){logger[_0x35f5('0xf')](_0x35f5('0x19'),_0x476474[_0x35f5('0x12')],_0x3c72d9);_0x505dff(_0x518727[_0x35f5('0xf')](0x1f4,_0x476474[_0x35f5('0x12')]));});});};exports[_0x35f5('0x1b')]=function(_0x1fceeb){var _0x4a8bf3=this;return new Promise(function(_0x378a5c,_0x43f581){return db[_0x35f5('0x16')]['update'](_0x1fceeb['body'],{'raw':_0x1fceeb[_0x35f5('0x1c')]?_0x1fceeb[_0x35f5('0x1c')][_0x35f5('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fceeb[_0x35f5('0x1c')]?_0x1fceeb['options'][_0x35f5('0x1d')]||null:null,'attributes':_0x1fceeb[_0x35f5('0x1c')]?_0x1fceeb[_0x35f5('0x1c')][_0x35f5('0x1e')]||null:null,'limit':_0x1fceeb['options']?_0x1fceeb[_0x35f5('0x1c')][_0x35f5('0x1f')]||null:null})[_0x35f5('0xc')](function(_0x4712e1){logger[_0x35f5('0x13')](_0x35f5('0x1b'),_0x1fceeb);logger[_0x35f5('0x20')]('UpdateVoiceDialReport',_0x1fceeb,JSON[_0x35f5('0x1a')](_0x4712e1));_0x378a5c(_0x4712e1);})[_0x35f5('0x15')](function(_0x3b5cb5){logger[_0x35f5('0xf')](_0x35f5('0x1b'),_0x3b5cb5[_0x35f5('0x12')],_0x1fceeb);_0x43f581(_0x4a8bf3[_0x35f5('0xf')](0x1f4,_0x3b5cb5[_0x35f5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f9289c9..a02acea 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 _0x3aae=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','put','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3aae,0x102));var _0xe3aa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3aae[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xe3aa('0x0'));var util=require(_0xe3aa('0x1'));var path=require(_0xe3aa('0x2'));var timeout=require(_0xe3aa('0x3'));var express=require(_0xe3aa('0x4'));var router=express[_0xe3aa('0x5')]();var auth=require(_0xe3aa('0x6'));var interaction=require(_0xe3aa('0x7'));var config=require(_0xe3aa('0x8'));var controller=require(_0xe3aa('0x9'));router[_0xe3aa('0xa')]('/',auth[_0xe3aa('0xb')](),controller['index']);router[_0xe3aa('0xa')](_0xe3aa('0xc'),auth[_0xe3aa('0xb')](),controller[_0xe3aa('0xd')]);router[_0xe3aa('0xe')]('/',auth[_0xe3aa('0xb')](),controller[_0xe3aa('0xf')]);router[_0xe3aa('0xe')](_0xe3aa('0x10'),auth[_0xe3aa('0xb')](),controller[_0xe3aa('0x11')]);router[_0xe3aa('0x12')](_0xe3aa('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe3aa('0x13')]=router; \ No newline at end of file +var _0xb50a=['update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','addApplications','put'];(function(_0x2bfdb9,_0x63b605){var _0x4dc87e=function(_0x2927c1){while(--_0x2927c1){_0x2bfdb9['push'](_0x2bfdb9['shift']());}};_0x4dc87e(++_0x63b605);}(_0xb50a,0x159));var _0xab50=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xb50a[_0x5d80de];return _0x1c7556;};'use strict';var multer=require(_0xab50('0x0'));var util=require(_0xab50('0x1'));var path=require(_0xab50('0x2'));var timeout=require(_0xab50('0x3'));var express=require(_0xab50('0x4'));var router=express['Router']();var auth=require(_0xab50('0x5'));var interaction=require(_0xab50('0x6'));var config=require(_0xab50('0x7'));var controller=require('./voiceExtension.controller');router[_0xab50('0x8')]('/',auth['isAuthenticated'](),controller[_0xab50('0x9')]);router[_0xab50('0x8')](_0xab50('0xa'),auth['isAuthenticated'](),controller[_0xab50('0xb')]);router[_0xab50('0xc')]('/',auth[_0xab50('0xd')](),controller['create']);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xab50('0xe')]);router[_0xab50('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xab50('0x10')]);router['delete'](_0xab50('0xa'),auth[_0xab50('0xd')](),controller[_0xab50('0x11')]);module[_0xab50('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index bda289a..65eeb97 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(_0x40a909,_0x2d887e){var _0x488189=function(_0x24189c){while(--_0x24189c){_0x40a909['push'](_0x40a909['shift']());}};_0x488189(++_0x2d887e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x3e2e35,_0x483f93){var _0x5da96f=function(_0xc0daa1){while(--_0xc0daa1){_0x3e2e35['push'](_0x3e2e35['shift']());}};_0x5da96f(++_0x483f93);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index c6d2c21..b28986c 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 _0x1ca9=['findAll','catch','show','rawAttributes','fields','destroy','params','create','startsWith','body','concat','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','recordingFormat','mandatoryDisposition','addApplications','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','type','find','end','stack','name','send','index','VoiceExtension','key','query','keys','filters','intersection','attributes','length','model','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x114362,_0x16952e){var _0xb73a14=function(_0x10dbbf){while(--_0x10dbbf){_0x114362['push'](_0x114362['shift']());}};_0xb73a14(++_0x16952e);}(_0x1ca9,0x16d));var _0x91ca=function(_0x4a441d,_0x585115){_0x4a441d=_0x4a441d-0x0;var _0x1c07fd=_0x1ca9[_0x4a441d];return _0x1c07fd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x91ca('0x0'));var rimraf=require(_0x91ca('0x1'));var zipdir=require(_0x91ca('0x2'));var jsonpatch=require(_0x91ca('0x3'));var rp=require(_0x91ca('0x4'));var moment=require(_0x91ca('0x5'));var BPromise=require(_0x91ca('0x6'));var Mustache=require(_0x91ca('0x7'));var util=require(_0x91ca('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x91ca('0x9'));var ejs=require(_0x91ca('0xa'));var fs=require('fs');var _=require(_0x91ca('0xb'));var squel=require('squel');var crypto=require(_0x91ca('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x91ca('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91ca('0xe'));var Papa=require(_0x91ca('0xf'));var Redis=require(_0x91ca('0x10'));var authService=require(_0x91ca('0x11'));var qs=require(_0x91ca('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91ca('0x13'));var logger=require(_0x91ca('0x14'))(_0x91ca('0x15'));var utils=require(_0x91ca('0x16'));var config=require(_0x91ca('0x17'));var licenseUtil=require(_0x91ca('0x18'));var db=require(_0x91ca('0x19'))['db'];config['redis']=_['defaults'](config[_0x91ca('0x1a')],{'host':_0x91ca('0x1b'),'port':0x18eb});var socket=require(_0x91ca('0x1c'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x91ca('0x1d')](socket);function respondWithStatusCode(_0x5a8db3,_0x57c303){_0x57c303=_0x57c303||0xcc;return function(_0x26c0af){if(_0x26c0af){return _0x5a8db3[_0x91ca('0x1e')](_0x57c303);}return _0x5a8db3[_0x91ca('0x1f')](_0x57c303)['end']();};}function respondWithResult(_0xf6d84f,_0x2f0414){_0x2f0414=_0x2f0414||0xc8;return function(_0x2b875d){if(_0x2b875d){return _0xf6d84f['status'](_0x2f0414)['json'](_0x2b875d);}};}function respondWithFilteredResult(_0x53e3fe,_0x48804a){return function(_0x23d205){if(_0x23d205){var _0x40ca50=_0x23d205[_0x91ca('0x20')],_0x4a6e9f=_0x48804a[_0x91ca('0x21')],_0x480bfc=_0x48804a['offset']+_0x48804a['limit'],_0x139f10;if(_0x480bfc>=_0x40ca50){_0x480bfc=_0x40ca50;_0x139f10=0xc8;}else{_0x139f10=0xce;}_0x53e3fe[_0x91ca('0x1f')](_0x139f10);return _0x53e3fe[_0x91ca('0x22')](_0x91ca('0x23'),_0x4a6e9f+'-'+_0x480bfc+'/'+_0x40ca50)[_0x91ca('0x24')](_0x23d205);}return null;};}function patchUpdates(_0x1bca73){return function(_0x5a3d9e){try{jsonpatch[_0x91ca('0x25')](_0x5a3d9e,_0x1bca73,!![]);}catch(_0x3c3600){return BPromise[_0x91ca('0x26')](_0x3c3600);}return _0x5a3d9e[_0x91ca('0x27')]();};}function saveUpdates(_0x595e16,_0x17523f){return function(_0x22863a){if(_0x22863a){return _0x22863a[_0x91ca('0x28')](_0x595e16)['then'](function(_0x32650c){return _0x32650c;});}return null;};}function removeEntity(_0x191309,_0x5c9af6){return function(_0x2c0340){if(_0x2c0340){return _0x2c0340['destroy']()[_0x91ca('0x29')](function(){var _0xfeb105=_0x2c0340[_0x91ca('0x2a')]({'plain':!![]});var _0x5c80b0=[{'name':_0x91ca('0x2b'),'value':_0x91ca('0x2c'),'ignore':![]},{'name':_0x91ca('0x2d'),'value':_0x91ca('0x2e'),'ignore':![]},{'name':'InternalRoutes','value':_0x91ca('0x2f'),'ignore':![]}];var _0xfe579c=_(_0x5c80b0)[_0x91ca('0x30')](_0x91ca('0x31'))[_0x91ca('0x32')](_0x91ca('0x33'))[_0x91ca('0x33')]();if(_['includes'](_0xfe579c,_0xfeb105[_0x91ca('0x34')])){return;}var _0x15f8b3=_[_0x91ca('0x35')](_0x5c80b0,[_0x91ca('0x33'),_0xfeb105[_0x91ca('0x34')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x15f8b3,'resourceId':_0xfeb105['id']}})[_0x91ca('0x29')](function(){return _0x2c0340;});})[_0x91ca('0x29')](function(){_0x191309[_0x91ca('0x1f')](0xcc)[_0x91ca('0x36')]();});}};}function handleEntityNotFound(_0x2645a9,_0x5eb425){return function(_0x2dc6b2){if(!_0x2dc6b2){_0x2645a9[_0x91ca('0x1e')](0x194);}return _0x2dc6b2;};}function handleError(_0x393bb2,_0x5d95ff){_0x5d95ff=_0x5d95ff||0x1f4;return function(_0x2c437e){logger['error'](_0x2c437e[_0x91ca('0x37')]);if(_0x2c437e[_0x91ca('0x38')]){delete _0x2c437e[_0x91ca('0x38')];}_0x393bb2[_0x91ca('0x1f')](_0x5d95ff)[_0x91ca('0x39')](_0x2c437e);};}exports[_0x91ca('0x3a')]=function(_0x5ab853,_0x393522){var _0x372729={},_0x4eb26a={},_0x53511c={'count':0x0,'rows':[]};var _0x374a67=_[_0x91ca('0x32')](db[_0x91ca('0x3b')]['rawAttributes'],function(_0xaab301){return{'name':_0xaab301['fieldName'],'type':_0xaab301[_0x91ca('0x34')][_0x91ca('0x3c')]};});_0x4eb26a['model']=_[_0x91ca('0x32')](_0x374a67,_0x91ca('0x38'));_0x4eb26a[_0x91ca('0x3d')]=_[_0x91ca('0x3e')](_0x5ab853[_0x91ca('0x3d')]);_0x4eb26a[_0x91ca('0x3f')]=_[_0x91ca('0x40')](_0x4eb26a['model'],_0x4eb26a[_0x91ca('0x3d')]);_0x372729[_0x91ca('0x41')]=_['intersection'](_0x4eb26a['model'],qs['fields'](_0x5ab853[_0x91ca('0x3d')]['fields']));_0x372729[_0x91ca('0x41')]=_0x372729['attributes'][_0x91ca('0x42')]?_0x372729[_0x91ca('0x41')]:_0x4eb26a[_0x91ca('0x43')];if(!_0x5ab853[_0x91ca('0x3d')][_0x91ca('0x44')](_0x91ca('0x45'))){_0x372729[_0x91ca('0x46')]=qs[_0x91ca('0x46')](_0x5ab853[_0x91ca('0x3d')][_0x91ca('0x46')]);_0x372729[_0x91ca('0x21')]=qs[_0x91ca('0x21')](_0x5ab853[_0x91ca('0x3d')][_0x91ca('0x21')]);}_0x372729[_0x91ca('0x47')]=qs['sort'](_0x5ab853['query'][_0x91ca('0x48')]);_0x372729[_0x91ca('0x49')]=qs[_0x91ca('0x3f')](_['pick'](_0x5ab853[_0x91ca('0x3d')],_0x4eb26a[_0x91ca('0x3f')]),_0x374a67);if(_0x5ab853[_0x91ca('0x3d')][_0x91ca('0x30')]){_0x372729[_0x91ca('0x49')]=_[_0x91ca('0x4a')](_0x372729[_0x91ca('0x49')],{'$or':_['map'](_0x374a67,function(_0x2b30da){if(_0x2b30da['type']!==_0x91ca('0x4b')){var _0x4ebd8c={};_0x4ebd8c[_0x2b30da[_0x91ca('0x38')]]={'$like':'%'+_0x5ab853[_0x91ca('0x3d')][_0x91ca('0x30')]+'%'};return _0x4ebd8c;}})});}_0x372729=_[_0x91ca('0x4a')]({},_0x372729,_0x5ab853[_0x91ca('0x4c')]);var _0x50569c={'where':_0x372729[_0x91ca('0x49')]};return db[_0x91ca('0x3b')][_0x91ca('0x20')](_0x50569c)['then'](function(_0x4d3104){_0x53511c[_0x91ca('0x20')]=_0x4d3104;if(_0x5ab853[_0x91ca('0x3d')][_0x91ca('0x4d')]){_0x372729[_0x91ca('0x4e')]=[{'all':!![]}];}return db[_0x91ca('0x3b')][_0x91ca('0x4f')](_0x372729);})['then'](function(_0x3d67d6){_0x53511c['rows']=_0x3d67d6;return _0x53511c;})[_0x91ca('0x29')](respondWithFilteredResult(_0x393522,_0x372729))[_0x91ca('0x50')](handleError(_0x393522,null));};exports[_0x91ca('0x51')]=function(_0xff4a7b,_0x5ee40d){var _0x19e76b={'raw':![],'where':{'id':_0xff4a7b['params']['id']}},_0x2253dd={};_0x2253dd['model']=_['keys'](db[_0x91ca('0x3b')][_0x91ca('0x52')]);_0x2253dd[_0x91ca('0x3d')]=_[_0x91ca('0x3e')](_0xff4a7b['query']);_0x2253dd[_0x91ca('0x3f')]=_[_0x91ca('0x40')](_0x2253dd[_0x91ca('0x43')],_0x2253dd[_0x91ca('0x3d')]);_0x19e76b[_0x91ca('0x41')]=_['intersection'](_0x2253dd[_0x91ca('0x43')],qs[_0x91ca('0x53')](_0xff4a7b[_0x91ca('0x3d')][_0x91ca('0x53')]));_0x19e76b['attributes']=_0x19e76b[_0x91ca('0x41')][_0x91ca('0x42')]?_0x19e76b[_0x91ca('0x41')]:_0x2253dd[_0x91ca('0x43')];if(_0xff4a7b[_0x91ca('0x3d')][_0x91ca('0x4d')]){_0x19e76b[_0x91ca('0x4e')]=[{'all':!![]}];}_0x19e76b=_[_0x91ca('0x4a')]({},_0x19e76b,_0xff4a7b[_0x91ca('0x4c')]);return db[_0x91ca('0x3b')][_0x91ca('0x35')](_0x19e76b)['then'](handleEntityNotFound(_0x5ee40d,null))[_0x91ca('0x29')](respondWithResult(_0x5ee40d,null))['catch'](handleError(_0x5ee40d,null));};exports[_0x91ca('0x54')]=function(_0x31e6a3,_0x2463b4){return db[_0x91ca('0x3b')][_0x91ca('0x35')]({'where':{'id':_0x31e6a3[_0x91ca('0x55')]['id']}})[_0x91ca('0x29')](handleEntityNotFound(_0x2463b4,null))['then'](removeEntity(_0x2463b4,null))[_0x91ca('0x50')](handleError(_0x2463b4,null));};exports[_0x91ca('0x56')]=function(_0x41f3ef,_0x2ac13b){if(_0x41f3ef['body'][_0x91ca('0x34')]===_0x91ca('0x2e')&&!_[_0x91ca('0x57')](_0x41f3ef[_0x91ca('0x58')]['exten'],'_')){_0x41f3ef['body']['exten']='_'[_0x91ca('0x59')](_0x41f3ef[_0x91ca('0x58')][_0x91ca('0x5a')]);}return db[_0x91ca('0x3b')]['create'](_0x41f3ef[_0x91ca('0x58')],{'raw':![]})[_0x91ca('0x29')](function(_0x528d0d){var _0x1af8ae=_0x41f3ef[_0x91ca('0x5b')]['get']({'plain':!![]});if(!_0x1af8ae)throw new Error(_0x91ca('0x5c'));if(_0x1af8ae[_0x91ca('0x5d')]===_0x91ca('0x5b')){var _0x12ef26=_0x528d0d['get']({'plain':!![]});var _0x23868e=[{'name':_0x91ca('0x2b'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x91ca('0x2e')},{'name':'InternalRoutes','value':_0x91ca('0x2f')}];var _0x34ffb0=_[_0x91ca('0x35')](_0x23868e,['value',_0x12ef26[_0x91ca('0x34')]])[_0x91ca('0x38')];return db[_0x91ca('0x5e')][_0x91ca('0x35')]({'where':{'name':_0x34ffb0,'userProfileId':_0x1af8ae[_0x91ca('0x5f')]},'raw':!![]})[_0x91ca('0x29')](function(_0x4ca8a8){if(_0x4ca8a8&&_0x4ca8a8[_0x91ca('0x60')]===0x0){return db[_0x91ca('0x61')]['create']({'name':_0x12ef26[_0x91ca('0x38')],'resourceId':_0x12ef26['id'],'type':_0x4ca8a8[_0x91ca('0x38')],'sectionId':_0x4ca8a8['id']},{})[_0x91ca('0x29')](function(){return _0x528d0d;});}else{return _0x528d0d;}})[_0x91ca('0x50')](function(_0xb90d10){logger[_0x91ca('0x62')](_0x91ca('0x63'),_0xb90d10);throw _0xb90d10;});}return _0x528d0d;})[_0x91ca('0x29')](respondWithResult(_0x2ac13b,0xc9))['catch'](handleError(_0x2ac13b,null));};exports[_0x91ca('0x28')]=function(_0x5d35e6,_0x599c06){if(_0x5d35e6[_0x91ca('0x58')]['id']){delete _0x5d35e6['body']['id'];}return db['VoiceExtension'][_0x91ca('0x35')]({'where':{'id':_0x5d35e6[_0x91ca('0x55')]['id']}})[_0x91ca('0x29')](handleEntityNotFound(_0x599c06,null))[_0x91ca('0x29')](function(_0x52cd0b){if(_0x52cd0b){return db[_0x91ca('0x3b')][_0x91ca('0x28')](_[_0x91ca('0x64')](_0x5d35e6[_0x91ca('0x58')],[_0x91ca('0x5a'),'context',_0x91ca('0x65'),_0x91ca('0x66'),'cutdigits',_0x91ca('0x67')]),{'where':{'context':_0x52cd0b['context'],'exten':_0x52cd0b[_0x91ca('0x5a')]},'individualHooks':!![]})[_0x91ca('0x29')](function(_0x50cce0){return _0x50cce0;});}return null;})[_0x91ca('0x29')](respondWithStatusCode(_0x599c06,null))[_0x91ca('0x50')](handleError(_0x599c06,null));};exports[_0x91ca('0x68')]=function(_0x283c5f,_0x1c6f07,_0x5207f5){return db[_0x91ca('0x3b')]['findOne']({'where':{'id':_0x283c5f[_0x91ca('0x55')]['id']}})[_0x91ca('0x29')](handleEntityNotFound(_0x1c6f07,null))[_0x91ca('0x29')](function(_0x446d1e){if(_0x446d1e){return db[_0x91ca('0x69')][_0x91ca('0x6a')](function(_0x3e73b5){return db[_0x91ca('0x3b')][_0x91ca('0x54')]({'where':{'VoiceExtensionId':_0x283c5f['params']['id']},'transaction':_0x3e73b5})['then'](function(_0xf77101){var _0x4e3d52=_['map'](_0x283c5f['body'],function(_0x32dac){_0x32dac[_0x91ca('0x6b')]=_0x283c5f[_0x91ca('0x55')]['id'];return _0x32dac;});return db[_0x91ca('0x3b')][_0x91ca('0x6c')](_0x4e3d52,{'transaction':_0x3e73b5});});})[_0x91ca('0x29')](function(){return db[_0x91ca('0x3b')][_0x91ca('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x283c5f[_0x91ca('0x55')]['id']},'order':_0x91ca('0x6e')});});}})['then'](respondWithResult(_0x1c6f07,null))[_0x91ca('0x50')](handleError(_0x1c6f07,null));}; \ No newline at end of file +var _0xc76d=['key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','OutboundRoutes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','get','InboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','type','name','destroy','end','error','stack','send','index','VoiceExtension','rawAttributes','fieldName'];(function(_0xf6c6d9,_0x496070){var _0x57077c=function(_0x2465e9){while(--_0x2465e9){_0xf6c6d9['push'](_0xf6c6d9['shift']());}};_0x57077c(++_0x496070);}(_0xc76d,0x1d1));var _0xdc76=function(_0x58cbde,_0x4b0f62){_0x58cbde=_0x58cbde-0x0;var _0x5799f3=_0xc76d[_0x58cbde];return _0x5799f3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdc76('0x0'));var rimraf=require(_0xdc76('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc76('0x2'));var rp=require('request-promise');var moment=require(_0xdc76('0x3'));var BPromise=require(_0xdc76('0x4'));var Mustache=require(_0xdc76('0x5'));var util=require(_0xdc76('0x6'));var path=require(_0xdc76('0x7'));var sox=require(_0xdc76('0x8'));var csv=require(_0xdc76('0x9'));var ejs=require(_0xdc76('0xa'));var fs=require('fs');var _=require(_0xdc76('0xb'));var squel=require(_0xdc76('0xc'));var crypto=require(_0xdc76('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdc76('0xe'));var toCsv=require(_0xdc76('0x9'));var querystring=require(_0xdc76('0xf'));var Papa=require(_0xdc76('0x10'));var Redis=require('ioredis');var authService=require(_0xdc76('0x11'));var qs=require(_0xdc76('0x12'));var as=require(_0xdc76('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc76('0x14'))(_0xdc76('0x15'));var utils=require(_0xdc76('0x16'));var config=require(_0xdc76('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc76('0x18'))['db'];config[_0xdc76('0x19')]=_[_0xdc76('0x1a')](config[_0xdc76('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc76('0x1b'))(new Redis(config[_0xdc76('0x19')]));require(_0xdc76('0x1c'))[_0xdc76('0x1d')](socket);function respondWithStatusCode(_0x4a3a5b,_0x2db696){_0x2db696=_0x2db696||0xcc;return function(_0x30dd6d){if(_0x30dd6d){return _0x4a3a5b[_0xdc76('0x1e')](_0x2db696);}return _0x4a3a5b[_0xdc76('0x1f')](_0x2db696)['end']();};}function respondWithResult(_0x4a18d9,_0x1ed0e0){_0x1ed0e0=_0x1ed0e0||0xc8;return function(_0x2d34d2){if(_0x2d34d2){return _0x4a18d9[_0xdc76('0x1f')](_0x1ed0e0)[_0xdc76('0x20')](_0x2d34d2);}};}function respondWithFilteredResult(_0x5c49e5,_0x4c9d5b){return function(_0x520407){if(_0x520407){var _0x34c6c8=_0x520407[_0xdc76('0x21')],_0x18030f=_0x4c9d5b[_0xdc76('0x22')],_0x2821f4=_0x4c9d5b[_0xdc76('0x22')]+_0x4c9d5b[_0xdc76('0x23')],_0x5e4250;if(_0x2821f4>=_0x34c6c8){_0x2821f4=_0x34c6c8;_0x5e4250=0xc8;}else{_0x5e4250=0xce;}_0x5c49e5[_0xdc76('0x1f')](_0x5e4250);return _0x5c49e5[_0xdc76('0x24')]('Content-Range',_0x18030f+'-'+_0x2821f4+'/'+_0x34c6c8)[_0xdc76('0x20')](_0x520407);}return null;};}function patchUpdates(_0x416c90){return function(_0x21afd3){try{jsonpatch[_0xdc76('0x25')](_0x21afd3,_0x416c90,!![]);}catch(_0x51bf8f){return BPromise[_0xdc76('0x26')](_0x51bf8f);}return _0x21afd3['save']();};}function saveUpdates(_0x376597,_0x3e18b6){return function(_0x348fea){if(_0x348fea){return _0x348fea[_0xdc76('0x27')](_0x376597)[_0xdc76('0x28')](function(_0x4e05e5){return _0x4e05e5;});}return null;};}function removeEntity(_0x319d92,_0xa0644a){return function(_0x6824e6){if(_0x6824e6){return _0x6824e6['destroy']()[_0xdc76('0x28')](function(){var _0x4c6cb3=_0x6824e6[_0xdc76('0x29')]({'plain':!![]});var _0x355857=[{'name':_0xdc76('0x2a'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0xdc76('0x2b'),'ignore':![]},{'name':_0xdc76('0x2c'),'value':_0xdc76('0x2d'),'ignore':![]}];var _0x2ca532=_(_0x355857)['filter'](_0xdc76('0x2e'))[_0xdc76('0x2f')](_0xdc76('0x30'))['value']();if(_['includes'](_0x2ca532,_0x4c6cb3[_0xdc76('0x31')])){return;}var _0x368260=_['find'](_0x355857,[_0xdc76('0x30'),_0x4c6cb3[_0xdc76('0x31')]])[_0xdc76('0x32')];return db['UserProfileResource'][_0xdc76('0x33')]({'where':{'type':_0x368260,'resourceId':_0x4c6cb3['id']}})[_0xdc76('0x28')](function(){return _0x6824e6;});})[_0xdc76('0x28')](function(){_0x319d92[_0xdc76('0x1f')](0xcc)[_0xdc76('0x34')]();});}};}function handleEntityNotFound(_0x3ad07c,_0x201747){return function(_0x2c9187){if(!_0x2c9187){_0x3ad07c[_0xdc76('0x1e')](0x194);}return _0x2c9187;};}function handleError(_0x489f09,_0x3e2be7){_0x3e2be7=_0x3e2be7||0x1f4;return function(_0x22bebc){logger[_0xdc76('0x35')](_0x22bebc[_0xdc76('0x36')]);if(_0x22bebc['name']){delete _0x22bebc[_0xdc76('0x32')];}_0x489f09[_0xdc76('0x1f')](_0x3e2be7)[_0xdc76('0x37')](_0x22bebc);};}exports[_0xdc76('0x38')]=function(_0x3bb8eb,_0x1333a4){var _0x52fd4e={},_0x50c3c1={},_0x350bf9={'count':0x0,'rows':[]};var _0x31103b=_['map'](db[_0xdc76('0x39')][_0xdc76('0x3a')],function(_0x15490d){return{'name':_0x15490d[_0xdc76('0x3b')],'type':_0x15490d[_0xdc76('0x31')][_0xdc76('0x3c')]};});_0x50c3c1[_0xdc76('0x3d')]=_[_0xdc76('0x2f')](_0x31103b,_0xdc76('0x32'));_0x50c3c1['query']=_[_0xdc76('0x3e')](_0x3bb8eb[_0xdc76('0x3f')]);_0x50c3c1[_0xdc76('0x40')]=_[_0xdc76('0x41')](_0x50c3c1['model'],_0x50c3c1[_0xdc76('0x3f')]);_0x52fd4e[_0xdc76('0x42')]=_['intersection'](_0x50c3c1[_0xdc76('0x3d')],qs[_0xdc76('0x43')](_0x3bb8eb[_0xdc76('0x3f')][_0xdc76('0x43')]));_0x52fd4e[_0xdc76('0x42')]=_0x52fd4e['attributes'][_0xdc76('0x44')]?_0x52fd4e['attributes']:_0x50c3c1[_0xdc76('0x3d')];if(!_0x3bb8eb[_0xdc76('0x3f')][_0xdc76('0x45')]('nolimit')){_0x52fd4e[_0xdc76('0x23')]=qs[_0xdc76('0x23')](_0x3bb8eb[_0xdc76('0x3f')]['limit']);_0x52fd4e[_0xdc76('0x22')]=qs[_0xdc76('0x22')](_0x3bb8eb[_0xdc76('0x3f')][_0xdc76('0x22')]);}_0x52fd4e[_0xdc76('0x46')]=qs[_0xdc76('0x47')](_0x3bb8eb[_0xdc76('0x3f')][_0xdc76('0x47')]);_0x52fd4e[_0xdc76('0x48')]=qs['filters'](_['pick'](_0x3bb8eb['query'],_0x50c3c1[_0xdc76('0x40')]),_0x31103b);if(_0x3bb8eb[_0xdc76('0x3f')][_0xdc76('0x49')]){_0x52fd4e[_0xdc76('0x48')]=_[_0xdc76('0x4a')](_0x52fd4e[_0xdc76('0x48')],{'$or':_[_0xdc76('0x2f')](_0x31103b,function(_0x21c39a){if(_0x21c39a['type']!==_0xdc76('0x4b')){var _0x449e7c={};_0x449e7c[_0x21c39a[_0xdc76('0x32')]]={'$like':'%'+_0x3bb8eb['query'][_0xdc76('0x49')]+'%'};return _0x449e7c;}})});}_0x52fd4e=_[_0xdc76('0x4a')]({},_0x52fd4e,_0x3bb8eb[_0xdc76('0x4c')]);var _0x1f0267={'where':_0x52fd4e[_0xdc76('0x48')]};return db[_0xdc76('0x39')][_0xdc76('0x21')](_0x1f0267)[_0xdc76('0x28')](function(_0x4d9fbd){_0x350bf9['count']=_0x4d9fbd;if(_0x3bb8eb[_0xdc76('0x3f')]['includeAll']){_0x52fd4e[_0xdc76('0x4d')]=[{'all':!![]}];}return db[_0xdc76('0x39')][_0xdc76('0x4e')](_0x52fd4e);})[_0xdc76('0x28')](function(_0x5e2490){_0x350bf9[_0xdc76('0x4f')]=_0x5e2490;return _0x350bf9;})['then'](respondWithFilteredResult(_0x1333a4,_0x52fd4e))['catch'](handleError(_0x1333a4,null));};exports['show']=function(_0x31167c,_0x1ad9d6){var _0x2d8040={'raw':![],'where':{'id':_0x31167c[_0xdc76('0x50')]['id']}},_0x13a1e0={};_0x13a1e0['model']=_['keys'](db[_0xdc76('0x39')]['rawAttributes']);_0x13a1e0[_0xdc76('0x3f')]=_[_0xdc76('0x3e')](_0x31167c[_0xdc76('0x3f')]);_0x13a1e0['filters']=_[_0xdc76('0x41')](_0x13a1e0[_0xdc76('0x3d')],_0x13a1e0['query']);_0x2d8040[_0xdc76('0x42')]=_[_0xdc76('0x41')](_0x13a1e0[_0xdc76('0x3d')],qs[_0xdc76('0x43')](_0x31167c[_0xdc76('0x3f')][_0xdc76('0x43')]));_0x2d8040[_0xdc76('0x42')]=_0x2d8040['attributes'][_0xdc76('0x44')]?_0x2d8040['attributes']:_0x13a1e0[_0xdc76('0x3d')];if(_0x31167c[_0xdc76('0x3f')][_0xdc76('0x51')]){_0x2d8040[_0xdc76('0x4d')]=[{'all':!![]}];}_0x2d8040=_[_0xdc76('0x4a')]({},_0x2d8040,_0x31167c[_0xdc76('0x4c')]);return db[_0xdc76('0x39')]['find'](_0x2d8040)[_0xdc76('0x28')](handleEntityNotFound(_0x1ad9d6,null))[_0xdc76('0x28')](respondWithResult(_0x1ad9d6,null))['catch'](handleError(_0x1ad9d6,null));};exports['destroy']=function(_0x4adc2d,_0x249a82){return db[_0xdc76('0x39')][_0xdc76('0x52')]({'where':{'id':_0x4adc2d[_0xdc76('0x50')]['id']}})['then'](handleEntityNotFound(_0x249a82,null))[_0xdc76('0x28')](removeEntity(_0x249a82,null))[_0xdc76('0x53')](handleError(_0x249a82,null));};exports[_0xdc76('0x54')]=function(_0x136eab,_0x2a8483){if(_0x136eab[_0xdc76('0x55')][_0xdc76('0x31')]===_0xdc76('0x2b')&&!_['startsWith'](_0x136eab[_0xdc76('0x55')][_0xdc76('0x56')],'_')){_0x136eab['body'][_0xdc76('0x56')]='_'['concat'](_0x136eab[_0xdc76('0x55')][_0xdc76('0x56')]);}return db[_0xdc76('0x39')][_0xdc76('0x54')](_0x136eab[_0xdc76('0x55')],{'raw':![]})[_0xdc76('0x28')](function(_0x46b452){var _0x533ad1=_0x136eab[_0xdc76('0x57')][_0xdc76('0x29')]({'plain':!![]});if(!_0x533ad1)throw new Error(_0xdc76('0x58'));if(_0x533ad1[_0xdc76('0x59')]===_0xdc76('0x57')){var _0x358440=_0x46b452[_0xdc76('0x29')]({'plain':!![]});var _0x4d260a=[{'name':_0xdc76('0x2a'),'value':_0xdc76('0x5a')},{'name':_0xdc76('0x5b'),'value':_0xdc76('0x2b')},{'name':_0xdc76('0x2c'),'value':_0xdc76('0x2d')}];var _0x444d1a=_['find'](_0x4d260a,[_0xdc76('0x30'),_0x358440['type']])[_0xdc76('0x32')];return db['UserProfileSection']['find']({'where':{'name':_0x444d1a,'userProfileId':_0x533ad1[_0xdc76('0x5c')]},'raw':!![]})['then'](function(_0x85e465){if(_0x85e465&&_0x85e465['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x358440[_0xdc76('0x32')],'resourceId':_0x358440['id'],'type':_0x85e465['name'],'sectionId':_0x85e465['id']},{})[_0xdc76('0x28')](function(){return _0x46b452;});}else{return _0x46b452;}})['catch'](function(_0x3e4abc){logger['error'](_0xdc76('0x5d'),_0x3e4abc);throw _0x3e4abc;});}return _0x46b452;})[_0xdc76('0x28')](respondWithResult(_0x2a8483,0xc9))['catch'](handleError(_0x2a8483,null));};exports['update']=function(_0x2ae13d,_0x33bdd9){if(_0x2ae13d[_0xdc76('0x55')]['id']){delete _0x2ae13d['body']['id'];}return db[_0xdc76('0x39')][_0xdc76('0x52')]({'where':{'id':_0x2ae13d[_0xdc76('0x50')]['id']}})[_0xdc76('0x28')](handleEntityNotFound(_0x33bdd9,null))['then'](function(_0x47be01){if(_0x47be01){return db[_0xdc76('0x39')][_0xdc76('0x27')](_[_0xdc76('0x5e')](_0x2ae13d[_0xdc76('0x55')],[_0xdc76('0x56'),'context',_0xdc76('0x5f'),'recordingFormat',_0xdc76('0x60'),_0xdc76('0x61')]),{'where':{'context':_0x47be01['context'],'exten':_0x47be01[_0xdc76('0x56')]},'individualHooks':!![]})['then'](function(_0x55c70a){return _0x55c70a;});}return null;})[_0xdc76('0x28')](respondWithStatusCode(_0x33bdd9,null))['catch'](handleError(_0x33bdd9,null));};exports[_0xdc76('0x62')]=function(_0x5bb3d9,_0x13bcb6,_0x36bfa2){return db[_0xdc76('0x39')][_0xdc76('0x63')]({'where':{'id':_0x5bb3d9[_0xdc76('0x50')]['id']}})[_0xdc76('0x28')](handleEntityNotFound(_0x13bcb6,null))[_0xdc76('0x28')](function(_0x32552c){if(_0x32552c){return db[_0xdc76('0x64')][_0xdc76('0x65')](function(_0x5ee34c){return db[_0xdc76('0x39')][_0xdc76('0x33')]({'where':{'VoiceExtensionId':_0x5bb3d9[_0xdc76('0x50')]['id']},'transaction':_0x5ee34c})[_0xdc76('0x28')](function(_0x2fadfa){var _0x2312dc=_[_0xdc76('0x2f')](_0x5bb3d9[_0xdc76('0x55')],function(_0xc31b29){_0xc31b29[_0xdc76('0x66')]=_0x5bb3d9[_0xdc76('0x50')]['id'];return _0xc31b29;});return db[_0xdc76('0x39')]['bulkCreate'](_0x2312dc,{'transaction':_0x5ee34c});});})[_0xdc76('0x28')](function(){return db['VoiceExtension'][_0xdc76('0x67')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5bb3d9[_0xdc76('0x50')]['id']},'order':_0xdc76('0x68')});});}})['then'](respondWithResult(_0x13bcb6,null))[_0xdc76('0x53')](handleError(_0x13bcb6,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 6bb9ecf..c21bacf 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 _0x32e7=['emit','hook','exports','events','VoiceExtension','setMaxListeners','save','remove'];(function(_0xafc64f,_0x15be35){var _0x1b4bf4=function(_0x57a415){while(--_0x57a415){_0xafc64f['push'](_0xafc64f['shift']());}};_0x1b4bf4(++_0x15be35);}(_0x32e7,0xc3));var _0x732e=function(_0x52b4d6,_0x4240ce){_0x52b4d6=_0x52b4d6-0x0;var _0x518d80=_0x32e7[_0x52b4d6];return _0x518d80;};'use strict';var EventEmitter=require(_0x732e('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x732e('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x732e('0x2')](0x0);var events={'afterCreate':_0x732e('0x3'),'afterUpdate':'update','afterDestroy':_0x732e('0x4')};function emitEvent(_0x40f199){return function(_0x853cce,_0x122e38,_0x538b2d){VoiceExtensionEvents['emit'](_0x40f199+':'+_0x853cce['id'],_0x853cce);VoiceExtensionEvents[_0x732e('0x5')](_0x40f199,_0x853cce);_0x538b2d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x732e('0x6')](e,emitEvent(event));}}module[_0x732e('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x0121=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x4f84d3,_0x250e61){var _0x5c4e55=function(_0x3bbf12){while(--_0x3bbf12){_0x4f84d3['push'](_0x4f84d3['shift']());}};_0x5c4e55(++_0x250e61);}(_0x0121,0xf6));var _0x1012=function(_0x477184,_0x514f42){_0x477184=_0x477184-0x0;var _0x12ef90=_0x0121[_0x477184];return _0x12ef90;};'use strict';var EventEmitter=require(_0x1012('0x0'));var VoiceExtension=require(_0x1012('0x1'))['db'][_0x1012('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1012('0x3')](0x0);var events={'afterCreate':_0x1012('0x4'),'afterUpdate':_0x1012('0x5'),'afterDestroy':_0x1012('0x6')};function emitEvent(_0x3618a5){return function(_0x19cc09,_0x459533,_0x5016a6){VoiceExtensionEvents['emit'](_0x3618a5+':'+_0x19cc09['id'],_0x19cc09);VoiceExtensionEvents[_0x1012('0x7')](_0x3618a5,_0x19cc09);_0x5016a6(null);};}for(var e in events){if(events[_0x1012('0x8')](e)){var event=events[e];VoiceExtension[_0x1012('0x9')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 5337c4a..b8c98ca 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 _0x9ce4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions'];(function(_0x4cb445,_0x2973a9){var _0x5ae691=function(_0x5f1898){while(--_0x5f1898){_0x4cb445['push'](_0x4cb445['shift']());}};_0x5ae691(++_0x2973a9);}(_0x9ce4,0x1dc));var _0x49ce=function(_0x33aceb,_0x426921){_0x33aceb=_0x33aceb-0x0;var _0x571c82=_0x9ce4[_0x33aceb];return _0x571c82;};'use strict';var _=require(_0x49ce('0x0'));var util=require(_0x49ce('0x1'));var logger=require(_0x49ce('0x2'))(_0x49ce('0x3'));var moment=require(_0x49ce('0x4'));var BPromise=require(_0x49ce('0x5'));var rp=require(_0x49ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49ce('0x7'));var config=require(_0x49ce('0x8'));var attributes=require(_0x49ce('0x9'));module[_0x49ce('0xa')]=function(_0x142a3d,_0x4ccc48){return _0x142a3d[_0x49ce('0xb')](_0x49ce('0xc'),attributes,{'tableName':_0x49ce('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4eb=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','voice_extensions','lodash'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0xc4eb,0x8b));var _0xbc4e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc4eb[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbc4e('0x0'));var util=require(_0xbc4e('0x1'));var logger=require(_0xbc4e('0x2'))('api');var moment=require(_0xbc4e('0x3'));var BPromise=require(_0xbc4e('0x4'));var rp=require(_0xbc4e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbc4e('0x6'));var attributes=require('./voiceExtension.attributes');module[_0xbc4e('0x7')]=function(_0x27d59c,_0x2cd772){return _0x27d59c[_0xbc4e('0x8')]('VoiceExtension',attributes,{'tableName':_0xbc4e('0x9'),'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 14b2acc..559344a 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 _0x25e8=['info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceExtension','findAll','raw','options','where','attributes','limit','include','model','map','GetVoiceExtension','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then'];(function(_0x47dabf,_0x468106){var _0x2baaa5=function(_0x1bf373){while(--_0x1bf373){_0x47dabf['push'](_0x47dabf['shift']());}};_0x2baaa5(++_0x468106);}(_0x25e8,0xae));var _0x825e=function(_0x275f22,_0x3bfdf6){_0x275f22=_0x275f22-0x0;var _0x52f7ef=_0x25e8[_0x275f22];return _0x52f7ef;};'use strict';var _=require(_0x825e('0x0'));var util=require(_0x825e('0x1'));var moment=require(_0x825e('0x2'));var BPromise=require(_0x825e('0x3'));var rs=require(_0x825e('0x4'));var fs=require('fs');var Redis=require(_0x825e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x825e('0x6'))(_0x825e('0x7'));var config=require(_0x825e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x825e('0x9')],{'host':_0x825e('0xa'),'port':0x18eb});var socket=require(_0x825e('0xb'))(new Redis(config[_0x825e('0x9')]));require(_0x825e('0xc'))[_0x825e('0xd')](socket);function respondWithRpcPromise(_0x3c860c,_0x50816b,_0x4f0ac7){return new BPromise(function(_0x25ea19,_0x51e7ad){return client[_0x825e('0xe')](_0x3c860c,_0x4f0ac7)[_0x825e('0xf')](function(_0x1717d7){logger[_0x825e('0x10')](_0x825e('0x11'),_0x50816b,_0x825e('0x12'));logger['debug'](_0x825e('0x13'),_0x50816b,_0x825e('0x12'),JSON[_0x825e('0x14')](_0x1717d7));if(_0x1717d7[_0x825e('0x15')]){if(_0x1717d7[_0x825e('0x15')][_0x825e('0x16')]===0x1f4){logger[_0x825e('0x15')](_0x825e('0x11'),_0x50816b,_0x1717d7[_0x825e('0x15')][_0x825e('0x17')]);return _0x51e7ad(_0x1717d7[_0x825e('0x15')][_0x825e('0x17')]);}logger[_0x825e('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x50816b,_0x1717d7[_0x825e('0x15')][_0x825e('0x17')]);return _0x25ea19(_0x1717d7['error'][_0x825e('0x17')]);}else{logger[_0x825e('0x10')](_0x825e('0x11'),_0x50816b,_0x825e('0x12'));_0x25ea19(_0x1717d7[_0x825e('0x18')][_0x825e('0x17')]);}})[_0x825e('0x19')](function(_0x3818b7){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x50816b,_0x3818b7);_0x51e7ad(_0x3818b7);});});}exports['GetVoiceExtension']=function(_0x573eec){var _0x39ea5d=this;return new Promise(function(_0x3f6296,_0x6e9483){return db[_0x825e('0x1a')][_0x825e('0x1b')]({'raw':_0x573eec['options']?_0x573eec['options'][_0x825e('0x1c')]===undefined?!![]:![]:!![],'where':_0x573eec[_0x825e('0x1d')]?_0x573eec[_0x825e('0x1d')][_0x825e('0x1e')]||null:null,'attributes':_0x573eec[_0x825e('0x1d')]?_0x573eec[_0x825e('0x1d')][_0x825e('0x1f')]||null:null,'limit':_0x573eec['options']?_0x573eec[_0x825e('0x1d')][_0x825e('0x20')]||null:null,'include':_0x573eec[_0x825e('0x1d')]?_0x573eec[_0x825e('0x1d')][_0x825e('0x21')]?_['map'](_0x573eec[_0x825e('0x1d')][_0x825e('0x21')],function(_0x508de9){return{'model':db[_0x508de9[_0x825e('0x22')]],'as':_0x508de9['as'],'attributes':_0x508de9[_0x825e('0x1f')],'include':_0x508de9[_0x825e('0x21')]?_[_0x825e('0x23')](_0x508de9[_0x825e('0x21')],function(_0x57c234){return{'model':db[_0x57c234[_0x825e('0x22')]],'as':_0x57c234['as'],'attributes':_0x57c234[_0x825e('0x1f')],'include':_0x57c234[_0x825e('0x21')]?_[_0x825e('0x23')](_0x57c234[_0x825e('0x21')],function(_0x512153){return{'model':db[_0x512153[_0x825e('0x22')]],'as':_0x512153['as'],'attributes':_0x512153[_0x825e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ce258){logger[_0x825e('0x10')](_0x825e('0x24'),_0x573eec);logger[_0x825e('0x25')]('GetVoiceExtension',_0x573eec,JSON['stringify'](_0x2ce258));_0x3f6296(_0x2ce258);})[_0x825e('0x19')](function(_0x4b076d){logger['error'](_0x825e('0x24'),_0x4b076d[_0x825e('0x17')],_0x573eec);_0x6e9483(_0x39ea5d[_0x825e('0x15')](0x1f4,_0x4b076d['message']));});});}; \ No newline at end of file +var _0x43a1=['info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','then','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register'];(function(_0x4880fd,_0x2cc70d){var _0x4a4b50=function(_0xafeb91){while(--_0xafeb91){_0x4880fd['push'](_0x4880fd['shift']());}};_0x4a4b50(++_0x2cc70d);}(_0x43a1,0x1d3));var _0x143a=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0x43a1[_0x531cb8];return _0x5cf297;};'use strict';var _=require(_0x143a('0x0'));var util=require('util');var moment=require(_0x143a('0x1'));var BPromise=require('bluebird');var rs=require(_0x143a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x143a('0x3'))['db'];var utils=require(_0x143a('0x4'));var logger=require(_0x143a('0x5'))(_0x143a('0x6'));var config=require(_0x143a('0x7'));var jayson=require(_0x143a('0x8'));var client=jayson['client'][_0x143a('0x9')]({'port':0x232a});config[_0x143a('0xa')]=_[_0x143a('0xb')](config[_0x143a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x143a('0xc'))(new Redis(config[_0x143a('0xa')]));require('./voiceExtension.socket')[_0x143a('0xd')](socket);function respondWithRpcPromise(_0x3c232c,_0x14dba1,_0x1fe6fd){return new BPromise(function(_0x594096,_0x11b68){return client['request'](_0x3c232c,_0x1fe6fd)['then'](function(_0x407d5a){logger[_0x143a('0xe')](_0x143a('0xf'),_0x14dba1,_0x143a('0x10'));logger[_0x143a('0x11')](_0x143a('0x12'),_0x14dba1,_0x143a('0x10'),JSON[_0x143a('0x13')](_0x407d5a));if(_0x407d5a[_0x143a('0x14')]){if(_0x407d5a[_0x143a('0x14')][_0x143a('0x15')]===0x1f4){logger['error'](_0x143a('0xf'),_0x14dba1,_0x407d5a[_0x143a('0x14')]['message']);return _0x11b68(_0x407d5a['error']['message']);}logger[_0x143a('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x14dba1,_0x407d5a['error'][_0x143a('0x16')]);return _0x594096(_0x407d5a[_0x143a('0x14')][_0x143a('0x16')]);}else{logger['info'](_0x143a('0xf'),_0x14dba1,_0x143a('0x10'));_0x594096(_0x407d5a[_0x143a('0x17')][_0x143a('0x16')]);}})[_0x143a('0x18')](function(_0x297550){logger['error'](_0x143a('0xf'),_0x14dba1,_0x297550);_0x11b68(_0x297550);});});}exports[_0x143a('0x19')]=function(_0x10e987){var _0x1943de=this;return new Promise(function(_0x16ce50,_0xb6cf5a){return db[_0x143a('0x1a')][_0x143a('0x1b')]({'raw':_0x10e987[_0x143a('0x1c')]?_0x10e987[_0x143a('0x1c')][_0x143a('0x1d')]===undefined?!![]:![]:!![],'where':_0x10e987[_0x143a('0x1c')]?_0x10e987['options'][_0x143a('0x1e')]||null:null,'attributes':_0x10e987['options']?_0x10e987[_0x143a('0x1c')][_0x143a('0x1f')]||null:null,'limit':_0x10e987['options']?_0x10e987[_0x143a('0x1c')][_0x143a('0x20')]||null:null,'include':_0x10e987[_0x143a('0x1c')]?_0x10e987['options'][_0x143a('0x21')]?_[_0x143a('0x22')](_0x10e987[_0x143a('0x1c')][_0x143a('0x21')],function(_0x9ed9f3){return{'model':db[_0x9ed9f3[_0x143a('0x23')]],'as':_0x9ed9f3['as'],'attributes':_0x9ed9f3[_0x143a('0x1f')],'include':_0x9ed9f3[_0x143a('0x21')]?_[_0x143a('0x22')](_0x9ed9f3[_0x143a('0x21')],function(_0x15c778){return{'model':db[_0x15c778[_0x143a('0x23')]],'as':_0x15c778['as'],'attributes':_0x15c778[_0x143a('0x1f')],'include':_0x15c778['include']?_[_0x143a('0x22')](_0x15c778[_0x143a('0x21')],function(_0x12c484){return{'model':db[_0x12c484[_0x143a('0x23')]],'as':_0x12c484['as'],'attributes':_0x12c484[_0x143a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x143a('0x24')](function(_0x35ca6f){logger[_0x143a('0xe')](_0x143a('0x19'),_0x10e987);logger[_0x143a('0x11')](_0x143a('0x19'),_0x10e987,JSON[_0x143a('0x13')](_0x35ca6f));_0x16ce50(_0x35ca6f);})['catch'](function(_0x5736ff){logger[_0x143a('0x14')](_0x143a('0x19'),_0x5736ff[_0x143a('0x16')],_0x10e987);_0xb6cf5a(_0x1943de[_0x143a('0x14')](0x1f4,_0x5736ff[_0x143a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index cc8faaf..60f0615 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 _0x1117=['register','length','voiceExtension:','./voiceExtension.events','save','remove','update'];(function(_0x24d8db,_0x2392c6){var _0x13d20d=function(_0x568f80){while(--_0x568f80){_0x24d8db['push'](_0x24d8db['shift']());}};_0x13d20d(++_0x2392c6);}(_0x1117,0x153));var _0x7111=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1117[_0xfae23b];return _0x200640;};'use strict';var VoiceExtensionEvents=require(_0x7111('0x0'));var events=[_0x7111('0x1'),_0x7111('0x2'),_0x7111('0x3')];function createListener(_0x530399,_0x1cfc6a){return function(_0x5a4cac){_0x1cfc6a['emit'](_0x530399,_0x5a4cac);};}function removeListener(_0x1a3b7d,_0x50db48){return function(){VoiceExtensionEvents['removeListener'](_0x1a3b7d,_0x50db48);};}exports[_0x7111('0x4')]=function(_0x3bf2bc){for(var _0xd391a7=0x0,_0x3d45dd=events[_0x7111('0x5')];_0xd391a7<_0x3d45dd;_0xd391a7++){var _0x14fcc2=events[_0xd391a7];var _0x589651=createListener(_0x7111('0x6')+_0x14fcc2,_0x3bf2bc);VoiceExtensionEvents['on'](_0x14fcc2,_0x589651);}}; \ No newline at end of file +var _0xcbf9=['./voiceExtension.events','save','emit','removeListener','register','length','voiceExtension:'];(function(_0x56b838,_0x1c6389){var _0x227a70=function(_0x188d88){while(--_0x188d88){_0x56b838['push'](_0x56b838['shift']());}};_0x227a70(++_0x1c6389);}(_0xcbf9,0x196));var _0x9cbf=function(_0x34a215,_0x2085b7){_0x34a215=_0x34a215-0x0;var _0x2cf955=_0xcbf9[_0x34a215];return _0x2cf955;};'use strict';var VoiceExtensionEvents=require(_0x9cbf('0x0'));var events=[_0x9cbf('0x1'),'remove','update'];function createListener(_0x3c3328,_0x21e7dd){return function(_0x5bb174){_0x21e7dd[_0x9cbf('0x2')](_0x3c3328,_0x5bb174);};}function removeListener(_0x10be26,_0x34c2be){return function(){VoiceExtensionEvents[_0x9cbf('0x3')](_0x10be26,_0x34c2be);};}exports[_0x9cbf('0x4')]=function(_0x3ea362){for(var _0x3e563c=0x0,_0xaf68f7=events[_0x9cbf('0x5')];_0x3e563c<_0xaf68f7;_0x3e563c++){var _0x4b26fe=events[_0x3e563c];var _0x96b8bf=createListener(_0x9cbf('0x6')+_0x4b26fe,_0x3ea362);VoiceExtensionEvents['on'](_0x4b26fe,_0x96b8bf);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 6e853d0..fcd4184 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 _0xb784=['destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','delete'];(function(_0x4510f8,_0x4a6198){var _0x139364=function(_0x50fcbf){while(--_0x50fcbf){_0x4510f8['push'](_0x4510f8['shift']());}};_0x139364(++_0x4a6198);}(_0xb784,0x74));var _0x4b78=function(_0x27bc9b,_0x55b1f6){_0x27bc9b=_0x27bc9b-0x0;var _0x14abf7=_0xb784[_0x27bc9b];return _0x14abf7;};'use strict';var multer=require('multer');var util=require(_0x4b78('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4b78('0x1'));var router=express[_0x4b78('0x2')]();var auth=require(_0x4b78('0x3'));var interaction=require(_0x4b78('0x4'));var config=require(_0x4b78('0x5'));var controller=require(_0x4b78('0x6'));router[_0x4b78('0x7')]('/',auth[_0x4b78('0x8')](),controller[_0x4b78('0x9')]);router[_0x4b78('0x7')](_0x4b78('0xa'),auth[_0x4b78('0x8')](),controller[_0x4b78('0xb')]);router['get']('/:id/messages',auth[_0x4b78('0x8')](),controller[_0x4b78('0xc')]);router[_0x4b78('0xd')]('/',auth[_0x4b78('0x8')](),controller[_0x4b78('0xe')]);router[_0x4b78('0xf')](_0x4b78('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4b78('0x10')](_0x4b78('0xa'),auth[_0x4b78('0x8')](),controller[_0x4b78('0x11')]);module[_0x4b78('0x12')]=router; \ No newline at end of file +var _0x64b6=['getMessages','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages'];(function(_0x382894,_0x42235c){var _0x2d94bb=function(_0x549cb4){while(--_0x549cb4){_0x382894['push'](_0x382894['shift']());}};_0x2d94bb(++_0x42235c);}(_0x64b6,0x1ea));var _0x664b=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0x64b6[_0x39fd11];return _0x302799;};'use strict';var multer=require(_0x664b('0x0'));var util=require(_0x664b('0x1'));var path=require('path');var timeout=require(_0x664b('0x2'));var express=require(_0x664b('0x3'));var router=express[_0x664b('0x4')]();var auth=require(_0x664b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x664b('0x6'));var controller=require(_0x664b('0x7'));router[_0x664b('0x8')]('/',auth[_0x664b('0x9')](),controller[_0x664b('0xa')]);router[_0x664b('0x8')](_0x664b('0xb'),auth[_0x664b('0x9')](),controller[_0x664b('0xc')]);router['get'](_0x664b('0xd'),auth[_0x664b('0x9')](),controller[_0x664b('0xe')]);router[_0x664b('0xf')]('/',auth[_0x664b('0x9')](),controller[_0x664b('0x10')]);router[_0x664b('0x11')](_0x664b('0xb'),auth[_0x664b('0x9')](),controller['update']);router[_0x664b('0x12')]('/:id',auth[_0x664b('0x9')](),controller[_0x664b('0x13')]);module[_0x664b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 344ec6d..dbca85f 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 _0x2032=['yes','ENUM','INTEGER','VIRTUAL','fullname','getDataValue','mailbox','exports','STRING','contest_mailbox','setDataValue','email','string','trim'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x2032,0xd9));var _0x2203=function(_0x7a8bf,_0x3ef6bc){_0x7a8bf=_0x7a8bf-0x0;var _0x268d37=_0x2032[_0x7a8bf];return _0x268d37;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'customer_id':{'type':Sequelize[_0x2203('0x1')]},'context':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'from-voicemail','unique':_0x2203('0x2')},'mailbox':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x2203('0x1')]},'fullname':{'type':Sequelize[_0x2203('0x1')]},'email':{'type':Sequelize[_0x2203('0x1')],'validate':{'isEmail':!![]},'set':function(_0x201796){this[_0x2203('0x3')](_0x2203('0x4'),typeof _0x201796===_0x2203('0x5')&&_0x201796[_0x2203('0x6')]()?_0x201796[_0x2203('0x6')]():null);}},'pager':{'type':Sequelize[_0x2203('0x1')]},'tz':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x2203('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':_0x2203('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x2203('0x1')]},'review':{'type':Sequelize['ENUM'](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2203('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':_0x2203('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':_0x2203('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x2203('0x1')]},'emailbody':{'type':Sequelize[_0x2203('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x2203('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2203('0xa')],'get':function(){return this['getDataValue'](_0x2203('0xb'))+'\x20-\x20'+this[_0x2203('0xc')](_0x2203('0xd'));}}}; \ No newline at end of file +var _0xefda=['TINYINT(4)','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM','yes'];(function(_0x426661,_0x5483cd){var _0x246055=function(_0x2df225){while(--_0x2df225){_0x426661['push'](_0x426661['shift']());}};_0x246055(++_0x5483cd);}(_0xefda,0x96));var _0xaefd=function(_0x37e8a1,_0x225770){_0x37e8a1=_0x37e8a1-0x0;var _0x14c5d0=_0xefda[_0x37e8a1];return _0x14c5d0;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaefd('0x1')],'defaultValue':_0xaefd('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xaefd('0x1')],'defaultValue':'','allowNull':![],'unique':_0xaefd('0x3')},'password':{'type':Sequelize[_0xaefd('0x1')]},'fullname':{'type':Sequelize[_0xaefd('0x1')]},'email':{'type':Sequelize[_0xaefd('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3288f9){this['setDataValue'](_0xaefd('0x4'),typeof _0x3288f9===_0xaefd('0x5')&&_0x3288f9[_0xaefd('0x6')]()?_0x3288f9[_0xaefd('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xaefd('0x1')],'defaultValue':_0xaefd('0x7')},'attach':{'type':Sequelize[_0xaefd('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xaefd('0x9'),'no'),'defaultValue':_0xaefd('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xaefd('0x1')]},'callback':{'type':Sequelize[_0xaefd('0x1')]},'review':{'type':Sequelize[_0xaefd('0x8')](_0xaefd('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xaefd('0x8')](_0xaefd('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xaefd('0x8')](_0xaefd('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xaefd('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xaefd('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xaefd('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xaefd('0x8')](_0xaefd('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xaefd('0x8')]('yes','no'),'defaultValue':_0xaefd('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xaefd('0x8')](_0xaefd('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xaefd('0x8')](_0xaefd('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xaefd('0x8')](_0xaefd('0x9'),'no'),'defaultValue':_0xaefd('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xaefd('0x1')]},'emailbody':{'type':Sequelize[_0xaefd('0x1')]},'maxsecs':{'type':Sequelize[_0xaefd('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xaefd('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xaefd('0xc')],'get':function(){return this[_0xaefd('0xd')]('fullname')+_0xaefd('0xe')+this[_0xaefd('0xd')](_0xaefd('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 40c49e9..6a8f29a 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 _0xf567=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','VoiceMail','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filters','type','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','params','rawAttributes','catch'];(function(_0x20f08b,_0x5ad154){var _0x3aca7d=function(_0x41544d){while(--_0x41544d){_0x20f08b['push'](_0x20f08b['shift']());}};_0x3aca7d(++_0x5ad154);}(_0xf567,0x118));var _0x7f56=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf567[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x7f56('0x0'));var emlformat=require(_0x7f56('0x1'));var rimraf=require(_0x7f56('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f56('0x3'));var rp=require(_0x7f56('0x4'));var moment=require('moment');var BPromise=require(_0x7f56('0x5'));var Mustache=require(_0x7f56('0x6'));var util=require(_0x7f56('0x7'));var path=require(_0x7f56('0x8'));var sox=require('sox');var csv=require(_0x7f56('0x9'));var ejs=require(_0x7f56('0xa'));var fs=require('fs');var _=require(_0x7f56('0xb'));var squel=require('squel');var crypto=require(_0x7f56('0xc'));var jsforce=require(_0x7f56('0xd'));var deskjs=require(_0x7f56('0xe'));var toCsv=require(_0x7f56('0x9'));var querystring=require(_0x7f56('0xf'));var Papa=require(_0x7f56('0x10'));var Redis=require(_0x7f56('0x11'));var authService=require(_0x7f56('0x12'));var qs=require(_0x7f56('0x13'));var as=require(_0x7f56('0x14'));var hardwareService=require(_0x7f56('0x15'));var logger=require(_0x7f56('0x16'))(_0x7f56('0x17'));var utils=require(_0x7f56('0x18'));var config=require(_0x7f56('0x19'));var licenseUtil=require(_0x7f56('0x1a'));var db=require(_0x7f56('0x1b'))['db'];function respondWithStatusCode(_0x12557f,_0x3677af){_0x3677af=_0x3677af||0xcc;return function(_0x13b663){if(_0x13b663){return _0x12557f[_0x7f56('0x1c')](_0x3677af);}return _0x12557f[_0x7f56('0x1d')](_0x3677af)['end']();};}function respondWithResult(_0x3cc92b,_0x32119f){_0x32119f=_0x32119f||0xc8;return function(_0x11d663){if(_0x11d663){return _0x3cc92b['status'](_0x32119f)[_0x7f56('0x1e')](_0x11d663);}};}function respondWithFilteredResult(_0x211be1,_0x52e072){return function(_0x5f9e3c){if(_0x5f9e3c){var _0x441459=_0x5f9e3c['count'],_0x4ad41a=_0x52e072[_0x7f56('0x1f')],_0x5b2b27=_0x52e072[_0x7f56('0x1f')]+_0x52e072['limit'],_0x1dee75;if(_0x5b2b27>=_0x441459){_0x5b2b27=_0x441459;_0x1dee75=0xc8;}else{_0x1dee75=0xce;}_0x211be1[_0x7f56('0x1d')](_0x1dee75);return _0x211be1[_0x7f56('0x20')](_0x7f56('0x21'),_0x4ad41a+'-'+_0x5b2b27+'/'+_0x441459)[_0x7f56('0x1e')](_0x5f9e3c);}return null;};}function patchUpdates(_0x3f609e){return function(_0x24fe45){try{jsonpatch['apply'](_0x24fe45,_0x3f609e,!![]);}catch(_0x32aa49){return BPromise['reject'](_0x32aa49);}return _0x24fe45[_0x7f56('0x22')]();};}function saveUpdates(_0x56ba40,_0x38e7d5){return function(_0x36407f){if(_0x36407f){return _0x36407f[_0x7f56('0x23')](_0x56ba40)[_0x7f56('0x24')](function(_0x4706e4){return _0x4706e4;});}return null;};}function removeEntity(_0x4480b1,_0x9b7f15){return function(_0x3f54f8){if(_0x3f54f8){return _0x3f54f8[_0x7f56('0x25')]()[_0x7f56('0x24')](function(){var _0x52a902=_0x3f54f8[_0x7f56('0x26')]({'plain':!![]});var _0xe8f270=_0x7f56('0x27');return db[_0x7f56('0x28')][_0x7f56('0x25')]({'where':{'type':_0xe8f270,'resourceId':_0x52a902['id']}})[_0x7f56('0x24')](function(){return _0x3f54f8;});})[_0x7f56('0x24')](function(){_0x4480b1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a1f1b,_0x29de7c){return function(_0x5d2c39){if(!_0x5d2c39){_0x4a1f1b[_0x7f56('0x1c')](0x194);}return _0x5d2c39;};}function handleError(_0xc53c00,_0x1daeff){_0x1daeff=_0x1daeff||0x1f4;return function(_0x5bb367){logger[_0x7f56('0x29')](_0x5bb367[_0x7f56('0x2a')]);if(_0x5bb367[_0x7f56('0x2b')]){delete _0x5bb367[_0x7f56('0x2b')];}_0xc53c00['status'](_0x1daeff)[_0x7f56('0x2c')](_0x5bb367);};}exports[_0x7f56('0x2d')]=function(_0x20335a,_0x57d1db){var _0x10372d={},_0x1f247e={},_0x5f1de2={'count':0x0,'rows':[]};var _0x5823bb=_['map'](db[_0x7f56('0x2e')]['rawAttributes'],function(_0x4d92c0){return{'name':_0x4d92c0[_0x7f56('0x2f')],'type':_0x4d92c0['type'][_0x7f56('0x30')]};});_0x1f247e[_0x7f56('0x31')]=_[_0x7f56('0x32')](_0x5823bb,'name');_0x1f247e[_0x7f56('0x33')]=_[_0x7f56('0x34')](_0x20335a[_0x7f56('0x33')]);_0x1f247e['filters']=_[_0x7f56('0x35')](_0x1f247e[_0x7f56('0x31')],_0x1f247e[_0x7f56('0x33')]);_0x10372d[_0x7f56('0x36')]=_[_0x7f56('0x35')](_0x1f247e[_0x7f56('0x31')],qs[_0x7f56('0x37')](_0x20335a[_0x7f56('0x33')][_0x7f56('0x37')]));_0x10372d[_0x7f56('0x36')]=_0x10372d[_0x7f56('0x36')][_0x7f56('0x38')]?_0x10372d['attributes']:_0x1f247e['model'];if(!_0x20335a[_0x7f56('0x33')]['hasOwnProperty'](_0x7f56('0x39'))){_0x10372d[_0x7f56('0x3a')]=qs['limit'](_0x20335a[_0x7f56('0x33')][_0x7f56('0x3a')]);_0x10372d['offset']=qs[_0x7f56('0x1f')](_0x20335a[_0x7f56('0x33')]['offset']);}_0x10372d[_0x7f56('0x3b')]=qs[_0x7f56('0x3c')](_0x20335a[_0x7f56('0x33')]['sort']);_0x10372d[_0x7f56('0x3d')]=qs['filters'](_[_0x7f56('0x3e')](_0x20335a['query'],_0x1f247e[_0x7f56('0x3f')]),_0x5823bb);if(_0x20335a[_0x7f56('0x33')]['filter']){_0x10372d['where']=_['merge'](_0x10372d[_0x7f56('0x3d')],{'$or':_[_0x7f56('0x32')](_0x5823bb,function(_0x5b4b47){if(_0x5b4b47[_0x7f56('0x40')]!==_0x7f56('0x41')){var _0x3af75a={};_0x3af75a[_0x5b4b47[_0x7f56('0x2b')]]={'$like':'%'+_0x20335a[_0x7f56('0x33')][_0x7f56('0x42')]+'%'};return _0x3af75a;}})});}_0x10372d=_[_0x7f56('0x43')]({},_0x10372d,_0x20335a[_0x7f56('0x44')]);var _0x453741={'where':_0x10372d[_0x7f56('0x3d')]};return db[_0x7f56('0x2e')][_0x7f56('0x45')](_0x453741)[_0x7f56('0x24')](function(_0x20571d){_0x5f1de2[_0x7f56('0x45')]=_0x20571d;if(_0x20335a[_0x7f56('0x33')][_0x7f56('0x46')]){_0x10372d[_0x7f56('0x47')]=[{'all':!![]}];}return db[_0x7f56('0x2e')][_0x7f56('0x48')](_0x10372d);})[_0x7f56('0x24')](function(_0x404576){_0x5f1de2['rows']=_0x404576;return _0x5f1de2;})[_0x7f56('0x24')](respondWithFilteredResult(_0x57d1db,_0x10372d))['catch'](handleError(_0x57d1db,null));};exports['show']=function(_0x2ab999,_0x438a30){var _0x1f0d55={'raw':!![],'where':{'id':_0x2ab999[_0x7f56('0x49')]['id']}},_0x2e4751={};_0x2e4751[_0x7f56('0x31')]=_['keys'](db[_0x7f56('0x2e')][_0x7f56('0x4a')]);_0x2e4751['query']=_[_0x7f56('0x34')](_0x2ab999[_0x7f56('0x33')]);_0x2e4751[_0x7f56('0x3f')]=_[_0x7f56('0x35')](_0x2e4751[_0x7f56('0x31')],_0x2e4751[_0x7f56('0x33')]);_0x1f0d55[_0x7f56('0x36')]=_[_0x7f56('0x35')](_0x2e4751[_0x7f56('0x31')],qs[_0x7f56('0x37')](_0x2ab999[_0x7f56('0x33')]['fields']));_0x1f0d55['attributes']=_0x1f0d55[_0x7f56('0x36')][_0x7f56('0x38')]?_0x1f0d55['attributes']:_0x2e4751[_0x7f56('0x31')];if(_0x2ab999['query'][_0x7f56('0x46')]){_0x1f0d55[_0x7f56('0x47')]=[{'all':!![]}];}_0x1f0d55=_[_0x7f56('0x43')]({},_0x1f0d55,_0x2ab999['options']);return db[_0x7f56('0x2e')]['find'](_0x1f0d55)['then'](handleEntityNotFound(_0x438a30,null))[_0x7f56('0x24')](respondWithResult(_0x438a30,null))[_0x7f56('0x4b')](handleError(_0x438a30,null));};exports['create']=function(_0x12124c,_0x5e4805){return db[_0x7f56('0x2e')][_0x7f56('0x4c')](_0x12124c[_0x7f56('0x4d')],{})[_0x7f56('0x24')](function(_0x5cc708){var _0x25704f=_0x12124c[_0x7f56('0x4e')][_0x7f56('0x26')]({'plain':!![]});if(!_0x25704f)throw new Error(_0x7f56('0x4f'));if(_0x25704f[_0x7f56('0x50')]===_0x7f56('0x4e')){var _0x3abdd3=_0x5cc708[_0x7f56('0x26')]({'plain':!![]});var _0x725760='Voicemails';return db['UserProfileSection'][_0x7f56('0x51')]({'where':{'name':_0x725760,'userProfileId':_0x25704f['userProfileId']},'raw':!![]})[_0x7f56('0x24')](function(_0x3c623b){if(_0x3c623b&&_0x3c623b['autoAssociation']===0x0){return db[_0x7f56('0x28')][_0x7f56('0x4c')]({'name':_0x3abdd3['name'],'resourceId':_0x3abdd3['id'],'type':_0x3c623b[_0x7f56('0x2b')],'sectionId':_0x3c623b['id']},{})[_0x7f56('0x24')](function(){return _0x5cc708;});}else{return _0x5cc708;}})[_0x7f56('0x4b')](function(_0x530898){logger[_0x7f56('0x29')](_0x7f56('0x52'),_0x530898);throw _0x530898;});}return _0x5cc708;})[_0x7f56('0x24')](respondWithResult(_0x5e4805,0xc9))[_0x7f56('0x4b')](handleError(_0x5e4805,null));};exports['update']=function(_0x25f2ca,_0x47b14a){if(_0x25f2ca[_0x7f56('0x4d')]['id']){delete _0x25f2ca[_0x7f56('0x4d')]['id'];}return db[_0x7f56('0x2e')][_0x7f56('0x51')]({'where':{'id':_0x25f2ca[_0x7f56('0x49')]['id']}})[_0x7f56('0x24')](handleEntityNotFound(_0x47b14a,null))[_0x7f56('0x24')](saveUpdates(_0x25f2ca[_0x7f56('0x4d')],null))[_0x7f56('0x24')](respondWithResult(_0x47b14a,null))[_0x7f56('0x4b')](handleError(_0x47b14a,null));};exports[_0x7f56('0x25')]=function(_0x1ad8e5,_0x36bf14){return db[_0x7f56('0x2e')][_0x7f56('0x51')]({'where':{'id':_0x1ad8e5[_0x7f56('0x49')]['id']}})[_0x7f56('0x24')](handleEntityNotFound(_0x36bf14,null))[_0x7f56('0x24')](removeEntity(_0x36bf14,null))['catch'](handleError(_0x36bf14,null));};exports[_0x7f56('0x53')]=function(_0x1e8914,_0x4e948c,_0x36a534){return db['VoiceMail'][_0x7f56('0x54')]({'where':{'id':_0x1e8914['params']['id']}})[_0x7f56('0x24')](handleEntityNotFound(_0x4e948c,null))['then'](function(_0x36d8a0){var _0x20dbda;var _0x23dc1d={},_0x5cae81={};_0x5cae81[_0x7f56('0x31')]=_[_0x7f56('0x34')](db[_0x7f56('0x55')][_0x7f56('0x4a')]);_0x5cae81[_0x7f56('0x33')]=_[_0x7f56('0x34')](_0x1e8914[_0x7f56('0x33')]);_0x5cae81[_0x7f56('0x3f')]=_[_0x7f56('0x35')](_0x5cae81[_0x7f56('0x31')],_0x5cae81[_0x7f56('0x33')]);_0x23dc1d[_0x7f56('0x36')]=_[_0x7f56('0x35')](_0x5cae81[_0x7f56('0x31')],qs[_0x7f56('0x37')](_0x1e8914[_0x7f56('0x33')][_0x7f56('0x37')]));_0x23dc1d[_0x7f56('0x36')]=_0x23dc1d[_0x7f56('0x36')][_0x7f56('0x38')]?_0x23dc1d[_0x7f56('0x36')]:_0x5cae81[_0x7f56('0x31')];if(!_0x1e8914[_0x7f56('0x33')][_0x7f56('0x56')](_0x7f56('0x39'))){_0x23dc1d[_0x7f56('0x3a')]=qs[_0x7f56('0x3a')](_0x1e8914[_0x7f56('0x33')][_0x7f56('0x3a')]);_0x23dc1d[_0x7f56('0x1f')]=qs['offset'](_0x1e8914['query'][_0x7f56('0x1f')]);}_0x23dc1d[_0x7f56('0x3b')]=qs[_0x7f56('0x3c')](_0x1e8914[_0x7f56('0x33')][_0x7f56('0x3c')]);_0x23dc1d[_0x7f56('0x3d')]=qs[_0x7f56('0x3f')](_[_0x7f56('0x3e')](_0x1e8914['query'],_0x5cae81[_0x7f56('0x3f')]));if(_0x1e8914[_0x7f56('0x33')]['filter']){_0x23dc1d[_0x7f56('0x3d')]=_[_0x7f56('0x43')](_0x23dc1d[_0x7f56('0x3d')],{'$or':_[_0x7f56('0x32')](_0x23dc1d[_0x7f56('0x36')],function(_0x1cc07d){var _0x391962={};_0x391962[_0x1cc07d]={'$like':'%'+_0x1e8914[_0x7f56('0x33')]['filter']+'%'};return _0x391962;})});}_0x23dc1d[_0x7f56('0x3d')]=_['merge'](_0x23dc1d[_0x7f56('0x3d')],{'mailboxuser':_0x36d8a0[_0x7f56('0x57')]});_0x23dc1d=_[_0x7f56('0x43')]({},_0x23dc1d,_0x1e8914[_0x7f56('0x44')]);return db[_0x7f56('0x55')][_0x7f56('0x58')](_0x23dc1d)['then'](respondWithFilteredResult(_0x4e948c,_0x23dc1d));})['catch'](handleError(_0x4e948c,null));}; \ No newline at end of file +var _0xfaf2=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','length','merge','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','findOne','VoiceMailMessage','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','destroy','then','get','Voicemails','UserProfileResource','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x3dd845,_0x52c100){var _0x4a575c=function(_0x70c32c){while(--_0x70c32c){_0x3dd845['push'](_0x3dd845['shift']());}};_0x4a575c(++_0x52c100);}(_0xfaf2,0x169));var _0x2faf=function(_0x39c8ea,_0x211c56){_0x39c8ea=_0x39c8ea-0x0;var _0x371f48=_0xfaf2[_0x39c8ea];return _0x371f48;};'use strict';var pdf=require(_0x2faf('0x0'));var emlformat=require(_0x2faf('0x1'));var rimraf=require(_0x2faf('0x2'));var zipdir=require(_0x2faf('0x3'));var jsonpatch=require(_0x2faf('0x4'));var rp=require('request-promise');var moment=require(_0x2faf('0x5'));var BPromise=require(_0x2faf('0x6'));var Mustache=require(_0x2faf('0x7'));var util=require(_0x2faf('0x8'));var path=require(_0x2faf('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2faf('0xa'));var squel=require(_0x2faf('0xb'));var crypto=require(_0x2faf('0xc'));var jsforce=require(_0x2faf('0xd'));var deskjs=require(_0x2faf('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2faf('0xf'));var Redis=require(_0x2faf('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2faf('0x11'));var hardwareService=require(_0x2faf('0x12'));var logger=require(_0x2faf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2faf('0x14'));var licenseUtil=require(_0x2faf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x335730,_0x509157){_0x509157=_0x509157||0xcc;return function(_0x1945fe){if(_0x1945fe){return _0x335730[_0x2faf('0x16')](_0x509157);}return _0x335730[_0x2faf('0x17')](_0x509157)[_0x2faf('0x18')]();};}function respondWithResult(_0x1be421,_0x27d2c1){_0x27d2c1=_0x27d2c1||0xc8;return function(_0x4c44bb){if(_0x4c44bb){return _0x1be421[_0x2faf('0x17')](_0x27d2c1)[_0x2faf('0x19')](_0x4c44bb);}};}function respondWithFilteredResult(_0x5167af,_0x1fd4d3){return function(_0x3be136){if(_0x3be136){var _0x45cd2c=_0x3be136[_0x2faf('0x1a')],_0x1dc453=_0x1fd4d3[_0x2faf('0x1b')],_0x4a2dad=_0x1fd4d3[_0x2faf('0x1b')]+_0x1fd4d3['limit'],_0x3a2f18;if(_0x4a2dad>=_0x45cd2c){_0x4a2dad=_0x45cd2c;_0x3a2f18=0xc8;}else{_0x3a2f18=0xce;}_0x5167af[_0x2faf('0x17')](_0x3a2f18);return _0x5167af[_0x2faf('0x1c')](_0x2faf('0x1d'),_0x1dc453+'-'+_0x4a2dad+'/'+_0x45cd2c)[_0x2faf('0x19')](_0x3be136);}return null;};}function patchUpdates(_0x1b8098){return function(_0x40d8bf){try{jsonpatch[_0x2faf('0x1e')](_0x40d8bf,_0x1b8098,!![]);}catch(_0x5e4009){return BPromise['reject'](_0x5e4009);}return _0x40d8bf['save']();};}function saveUpdates(_0x219f13,_0x1a6f89){return function(_0x5e5e38){if(_0x5e5e38){return _0x5e5e38[_0x2faf('0x1f')](_0x219f13)['then'](function(_0x4ff607){return _0x4ff607;});}return null;};}function removeEntity(_0x328814,_0x2cb862){return function(_0x5d8cb7){if(_0x5d8cb7){return _0x5d8cb7[_0x2faf('0x20')]()[_0x2faf('0x21')](function(){var _0x3545cf=_0x5d8cb7[_0x2faf('0x22')]({'plain':!![]});var _0xfe4559=_0x2faf('0x23');return db[_0x2faf('0x24')][_0x2faf('0x20')]({'where':{'type':_0xfe4559,'resourceId':_0x3545cf['id']}})[_0x2faf('0x21')](function(){return _0x5d8cb7;});})[_0x2faf('0x21')](function(){_0x328814[_0x2faf('0x17')](0xcc)[_0x2faf('0x18')]();});}};}function handleEntityNotFound(_0x5f1359,_0x404f67){return function(_0x13b655){if(!_0x13b655){_0x5f1359[_0x2faf('0x16')](0x194);}return _0x13b655;};}function handleError(_0x53f72c,_0x2553fc){_0x2553fc=_0x2553fc||0x1f4;return function(_0x24f6c2){logger[_0x2faf('0x25')](_0x24f6c2[_0x2faf('0x26')]);if(_0x24f6c2[_0x2faf('0x27')]){delete _0x24f6c2[_0x2faf('0x27')];}_0x53f72c['status'](_0x2553fc)[_0x2faf('0x28')](_0x24f6c2);};}exports['index']=function(_0x14acde,_0x1133a0){var _0x147730={},_0x37398e={},_0x462d9b={'count':0x0,'rows':[]};var _0xac1403=_[_0x2faf('0x29')](db[_0x2faf('0x2a')][_0x2faf('0x2b')],function(_0x48f6a5){return{'name':_0x48f6a5[_0x2faf('0x2c')],'type':_0x48f6a5[_0x2faf('0x2d')][_0x2faf('0x2e')]};});_0x37398e[_0x2faf('0x2f')]=_[_0x2faf('0x29')](_0xac1403,'name');_0x37398e[_0x2faf('0x30')]=_[_0x2faf('0x31')](_0x14acde['query']);_0x37398e[_0x2faf('0x32')]=_[_0x2faf('0x33')](_0x37398e[_0x2faf('0x2f')],_0x37398e[_0x2faf('0x30')]);_0x147730['attributes']=_[_0x2faf('0x33')](_0x37398e['model'],qs['fields'](_0x14acde[_0x2faf('0x30')][_0x2faf('0x34')]));_0x147730[_0x2faf('0x35')]=_0x147730[_0x2faf('0x35')]['length']?_0x147730['attributes']:_0x37398e[_0x2faf('0x2f')];if(!_0x14acde[_0x2faf('0x30')][_0x2faf('0x36')](_0x2faf('0x37'))){_0x147730[_0x2faf('0x38')]=qs[_0x2faf('0x38')](_0x14acde['query'][_0x2faf('0x38')]);_0x147730[_0x2faf('0x1b')]=qs[_0x2faf('0x1b')](_0x14acde[_0x2faf('0x30')][_0x2faf('0x1b')]);}_0x147730[_0x2faf('0x39')]=qs[_0x2faf('0x3a')](_0x14acde[_0x2faf('0x30')][_0x2faf('0x3a')]);_0x147730[_0x2faf('0x3b')]=qs[_0x2faf('0x32')](_[_0x2faf('0x3c')](_0x14acde[_0x2faf('0x30')],_0x37398e['filters']),_0xac1403);if(_0x14acde['query'][_0x2faf('0x3d')]){_0x147730[_0x2faf('0x3b')]=_['merge'](_0x147730['where'],{'$or':_[_0x2faf('0x29')](_0xac1403,function(_0x3cdf46){if(_0x3cdf46[_0x2faf('0x2d')]!==_0x2faf('0x3e')){var _0x14a426={};_0x14a426[_0x3cdf46[_0x2faf('0x27')]]={'$like':'%'+_0x14acde[_0x2faf('0x30')]['filter']+'%'};return _0x14a426;}})});}_0x147730=_['merge']({},_0x147730,_0x14acde[_0x2faf('0x3f')]);var _0x596d1b={'where':_0x147730['where']};return db['VoiceMail']['count'](_0x596d1b)[_0x2faf('0x21')](function(_0x2b3284){_0x462d9b[_0x2faf('0x1a')]=_0x2b3284;if(_0x14acde['query'][_0x2faf('0x40')]){_0x147730['include']=[{'all':!![]}];}return db['VoiceMail'][_0x2faf('0x41')](_0x147730);})[_0x2faf('0x21')](function(_0x257af7){_0x462d9b[_0x2faf('0x42')]=_0x257af7;return _0x462d9b;})[_0x2faf('0x21')](respondWithFilteredResult(_0x1133a0,_0x147730))['catch'](handleError(_0x1133a0,null));};exports[_0x2faf('0x43')]=function(_0x450509,_0x294e5c){var _0x14f437={'raw':!![],'where':{'id':_0x450509[_0x2faf('0x44')]['id']}},_0x5f1f2a={};_0x5f1f2a[_0x2faf('0x2f')]=_[_0x2faf('0x31')](db[_0x2faf('0x2a')][_0x2faf('0x2b')]);_0x5f1f2a[_0x2faf('0x30')]=_[_0x2faf('0x31')](_0x450509['query']);_0x5f1f2a[_0x2faf('0x32')]=_[_0x2faf('0x33')](_0x5f1f2a[_0x2faf('0x2f')],_0x5f1f2a[_0x2faf('0x30')]);_0x14f437[_0x2faf('0x35')]=_[_0x2faf('0x33')](_0x5f1f2a[_0x2faf('0x2f')],qs['fields'](_0x450509[_0x2faf('0x30')][_0x2faf('0x34')]));_0x14f437[_0x2faf('0x35')]=_0x14f437[_0x2faf('0x35')][_0x2faf('0x45')]?_0x14f437[_0x2faf('0x35')]:_0x5f1f2a[_0x2faf('0x2f')];if(_0x450509['query'][_0x2faf('0x40')]){_0x14f437['include']=[{'all':!![]}];}_0x14f437=_[_0x2faf('0x46')]({},_0x14f437,_0x450509[_0x2faf('0x3f')]);return db[_0x2faf('0x2a')][_0x2faf('0x47')](_0x14f437)[_0x2faf('0x21')](handleEntityNotFound(_0x294e5c,null))[_0x2faf('0x21')](respondWithResult(_0x294e5c,null))['catch'](handleError(_0x294e5c,null));};exports[_0x2faf('0x48')]=function(_0x1a439e,_0x17f697){return db[_0x2faf('0x2a')][_0x2faf('0x48')](_0x1a439e[_0x2faf('0x49')],{})[_0x2faf('0x21')](function(_0x3d0f6e){var _0x274a4e=_0x1a439e[_0x2faf('0x4a')]['get']({'plain':!![]});if(!_0x274a4e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x274a4e['role']===_0x2faf('0x4a')){var _0x1a3771=_0x3d0f6e['get']({'plain':!![]});var _0x247608='Voicemails';return db[_0x2faf('0x4b')]['find']({'where':{'name':_0x247608,'userProfileId':_0x274a4e[_0x2faf('0x4c')]},'raw':!![]})[_0x2faf('0x21')](function(_0x90572){if(_0x90572&&_0x90572['autoAssociation']===0x0){return db['UserProfileResource'][_0x2faf('0x48')]({'name':_0x1a3771[_0x2faf('0x27')],'resourceId':_0x1a3771['id'],'type':_0x90572['name'],'sectionId':_0x90572['id']},{})[_0x2faf('0x21')](function(){return _0x3d0f6e;});}else{return _0x3d0f6e;}})['catch'](function(_0x575f31){logger[_0x2faf('0x25')](_0x2faf('0x4d'),_0x575f31);throw _0x575f31;});}return _0x3d0f6e;})['then'](respondWithResult(_0x17f697,0xc9))[_0x2faf('0x4e')](handleError(_0x17f697,null));};exports[_0x2faf('0x1f')]=function(_0x23dcd5,_0x3026c4){if(_0x23dcd5[_0x2faf('0x49')]['id']){delete _0x23dcd5[_0x2faf('0x49')]['id'];}return db[_0x2faf('0x2a')][_0x2faf('0x47')]({'where':{'id':_0x23dcd5[_0x2faf('0x44')]['id']}})[_0x2faf('0x21')](handleEntityNotFound(_0x3026c4,null))['then'](saveUpdates(_0x23dcd5[_0x2faf('0x49')],null))['then'](respondWithResult(_0x3026c4,null))[_0x2faf('0x4e')](handleError(_0x3026c4,null));};exports[_0x2faf('0x20')]=function(_0x1e014e,_0x264f47){return db[_0x2faf('0x2a')][_0x2faf('0x47')]({'where':{'id':_0x1e014e[_0x2faf('0x44')]['id']}})[_0x2faf('0x21')](handleEntityNotFound(_0x264f47,null))['then'](removeEntity(_0x264f47,null))[_0x2faf('0x4e')](handleError(_0x264f47,null));};exports['getMessages']=function(_0x2538a4,_0x42640d,_0x45d652){return db['VoiceMail'][_0x2faf('0x4f')]({'where':{'id':_0x2538a4['params']['id']}})[_0x2faf('0x21')](handleEntityNotFound(_0x42640d,null))[_0x2faf('0x21')](function(_0x5d7e05){var _0x1289c5;var _0xe0fd8c={},_0x5cccef={};_0x5cccef[_0x2faf('0x2f')]=_[_0x2faf('0x31')](db[_0x2faf('0x50')]['rawAttributes']);_0x5cccef[_0x2faf('0x30')]=_[_0x2faf('0x31')](_0x2538a4['query']);_0x5cccef[_0x2faf('0x32')]=_[_0x2faf('0x33')](_0x5cccef[_0x2faf('0x2f')],_0x5cccef[_0x2faf('0x30')]);_0xe0fd8c['attributes']=_[_0x2faf('0x33')](_0x5cccef[_0x2faf('0x2f')],qs[_0x2faf('0x34')](_0x2538a4['query'][_0x2faf('0x34')]));_0xe0fd8c[_0x2faf('0x35')]=_0xe0fd8c['attributes'][_0x2faf('0x45')]?_0xe0fd8c[_0x2faf('0x35')]:_0x5cccef[_0x2faf('0x2f')];if(!_0x2538a4['query'][_0x2faf('0x36')](_0x2faf('0x37'))){_0xe0fd8c[_0x2faf('0x38')]=qs[_0x2faf('0x38')](_0x2538a4[_0x2faf('0x30')][_0x2faf('0x38')]);_0xe0fd8c[_0x2faf('0x1b')]=qs[_0x2faf('0x1b')](_0x2538a4[_0x2faf('0x30')][_0x2faf('0x1b')]);}_0xe0fd8c['order']=qs[_0x2faf('0x3a')](_0x2538a4['query'][_0x2faf('0x3a')]);_0xe0fd8c[_0x2faf('0x3b')]=qs['filters'](_[_0x2faf('0x3c')](_0x2538a4['query'],_0x5cccef['filters']));if(_0x2538a4[_0x2faf('0x30')][_0x2faf('0x3d')]){_0xe0fd8c[_0x2faf('0x3b')]=_[_0x2faf('0x46')](_0xe0fd8c[_0x2faf('0x3b')],{'$or':_['map'](_0xe0fd8c['attributes'],function(_0x31a718){var _0x1cde60={};_0x1cde60[_0x31a718]={'$like':'%'+_0x2538a4[_0x2faf('0x30')]['filter']+'%'};return _0x1cde60;})});}_0xe0fd8c[_0x2faf('0x3b')]=_[_0x2faf('0x46')](_0xe0fd8c[_0x2faf('0x3b')],{'mailboxuser':_0x5d7e05[_0x2faf('0x51')]});_0xe0fd8c=_[_0x2faf('0x46')]({},_0xe0fd8c,_0x2538a4[_0x2faf('0x3f')]);return db[_0x2faf('0x50')][_0x2faf('0x52')](_0xe0fd8c)[_0x2faf('0x21')](respondWithFilteredResult(_0x42640d,_0xe0fd8c));})['catch'](handleError(_0x42640d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 9cbe378..82f2d02 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 _0xd11c=['voice_voicemail','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceMail.attributes','exports','VoiceMail'];(function(_0x38e345,_0x269d73){var _0x2271a4=function(_0x49946a){while(--_0x49946a){_0x38e345['push'](_0x38e345['shift']());}};_0x2271a4(++_0x269d73);}(_0xd11c,0x64));var _0xcd11=function(_0x120c68,_0x5cf7a1){_0x120c68=_0x120c68-0x0;var _0x2b43a8=_0xd11c[_0x120c68];return _0x2b43a8;};'use strict';var _=require(_0xcd11('0x0'));var util=require(_0xcd11('0x1'));var logger=require(_0xcd11('0x2'))(_0xcd11('0x3'));var moment=require('moment');var BPromise=require(_0xcd11('0x4'));var rp=require(_0xcd11('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd11('0x6'));var config=require('../../config/environment');var attributes=require(_0xcd11('0x7'));module[_0xcd11('0x8')]=function(_0x16441c,_0x34ecb8){return _0x16441c['define'](_0xcd11('0x9'),attributes,{'tableName':_0xcd11('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa6a4=['voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail'];(function(_0x55af68,_0x54e62a){var _0x1d7a09=function(_0x4fbd07){while(--_0x4fbd07){_0x55af68['push'](_0x55af68['shift']());}};_0x1d7a09(++_0x54e62a);}(_0xa6a4,0x9e));var _0x4a6a=function(_0x51fd88,_0x12644e){_0x51fd88=_0x51fd88-0x0;var _0x4bb755=_0xa6a4[_0x51fd88];return _0x4bb755;};'use strict';var _=require('lodash');var util=require(_0x4a6a('0x0'));var logger=require(_0x4a6a('0x1'))(_0x4a6a('0x2'));var moment=require(_0x4a6a('0x3'));var BPromise=require(_0x4a6a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4a6a('0x5'));var config=require(_0x4a6a('0x6'));var attributes=require(_0x4a6a('0x7'));module['exports']=function(_0x2e9a7b,_0x26f786){return _0x2e9a7b[_0x4a6a('0x8')](_0x4a6a('0x9'),attributes,{'tableName':_0x4a6a('0xa'),'paranoid':![],'indexes':[{'name':_0x4a6a('0xb'),'fields':[_0x4a6a('0xc'),_0x4a6a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index cbde6ab..ed79ec3 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 _0x28f4=['VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','request\x20sent'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x28f4,0x139));var _0x428f=function(_0x12d1c1,_0x338b36){_0x12d1c1=_0x12d1c1-0x0;var _0x56db84=_0x28f4[_0x12d1c1];return _0x56db84;};'use strict';var _=require('lodash');var util=require(_0x428f('0x0'));var moment=require('moment');var BPromise=require(_0x428f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x428f('0x2'));var db=require(_0x428f('0x3'))['db'];var utils=require(_0x428f('0x4'));var logger=require(_0x428f('0x5'))('rpc');var config=require(_0x428f('0x6'));var jayson=require(_0x428f('0x7'));var client=jayson[_0x428f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13da4f,_0x21c6b,_0x3e6b29){return new BPromise(function(_0x5bcb8e,_0x261109){return client['request'](_0x13da4f,_0x3e6b29)['then'](function(_0x412114){logger[_0x428f('0x9')]('VoiceMail,\x20%s,\x20%s',_0x21c6b,_0x428f('0xa'));logger['debug'](_0x428f('0xb'),_0x21c6b,_0x428f('0xa'),JSON[_0x428f('0xc')](_0x412114));if(_0x412114[_0x428f('0xd')]){if(_0x412114[_0x428f('0xd')][_0x428f('0xe')]===0x1f4){logger[_0x428f('0xd')](_0x428f('0xf'),_0x21c6b,_0x412114['error'][_0x428f('0x10')]);return _0x261109(_0x412114['error'][_0x428f('0x10')]);}logger[_0x428f('0xd')](_0x428f('0xf'),_0x21c6b,_0x412114[_0x428f('0xd')]['message']);return _0x5bcb8e(_0x412114[_0x428f('0xd')]['message']);}else{logger[_0x428f('0x9')](_0x428f('0xf'),_0x21c6b,_0x428f('0xa'));_0x5bcb8e(_0x412114[_0x428f('0x11')]['message']);}})['catch'](function(_0xf0cc03){logger['error']('VoiceMail,\x20%s,\x20%s',_0x21c6b,_0xf0cc03);_0x261109(_0xf0cc03);});});} \ No newline at end of file +var _0xc6ed=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x322c99,_0x4c0d2a){var _0xf0259b=function(_0x488f92){while(--_0x488f92){_0x322c99['push'](_0x322c99['shift']());}};_0xf0259b(++_0x4c0d2a);}(_0xc6ed,0x1b0));var _0xdc6e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc6ed[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xdc6e('0x0'));var util=require(_0xdc6e('0x1'));var moment=require(_0xdc6e('0x2'));var BPromise=require(_0xdc6e('0x3'));var rs=require(_0xdc6e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc6e('0x5'))['db'];var utils=require(_0xdc6e('0x6'));var logger=require(_0xdc6e('0x7'))('rpc');var config=require(_0xdc6e('0x8'));var jayson=require(_0xdc6e('0x9'));var client=jayson[_0xdc6e('0xa')][_0xdc6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5456c8,_0xf875ab,_0x8f3775){return new BPromise(function(_0x1e36eb,_0x47d688){return client[_0xdc6e('0xc')](_0x5456c8,_0x8f3775)[_0xdc6e('0xd')](function(_0x3ba5dd){logger[_0xdc6e('0xe')](_0xdc6e('0xf'),_0xf875ab,_0xdc6e('0x10'));logger[_0xdc6e('0x11')](_0xdc6e('0x12'),_0xf875ab,_0xdc6e('0x10'),JSON['stringify'](_0x3ba5dd));if(_0x3ba5dd['error']){if(_0x3ba5dd[_0xdc6e('0x13')]['code']===0x1f4){logger['error'](_0xdc6e('0xf'),_0xf875ab,_0x3ba5dd[_0xdc6e('0x13')][_0xdc6e('0x14')]);return _0x47d688(_0x3ba5dd[_0xdc6e('0x13')]['message']);}logger['error'](_0xdc6e('0xf'),_0xf875ab,_0x3ba5dd[_0xdc6e('0x13')][_0xdc6e('0x14')]);return _0x1e36eb(_0x3ba5dd['error'][_0xdc6e('0x14')]);}else{logger['info'](_0xdc6e('0xf'),_0xf875ab,'request\x20sent');_0x1e36eb(_0x3ba5dd['result']['message']);}})[_0xdc6e('0x15')](function(_0x228497){logger['error']('VoiceMail,\x20%s,\x20%s',_0xf875ab,_0x228497);_0x47d688(_0x228497);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index f909ad8..6845297 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 _0x1261=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','show','/:id/download','isAuthenticated','download','create','put','destroy'];(function(_0x54daf5,_0x528643){var _0xf70158=function(_0x4902d6){while(--_0x4902d6){_0x54daf5['push'](_0x54daf5['shift']());}};_0xf70158(++_0x528643);}(_0x1261,0x144));var _0x1126=function(_0x28e0f1,_0xd1bfa0){_0x28e0f1=_0x28e0f1-0x0;var _0x13aedc=_0x1261[_0x28e0f1];return _0x13aedc;};'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('0x9')](_0x1126('0xc'),auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router['post']('/',auth[_0x1126('0xd')](),controller[_0x1126('0xf')]);router[_0x1126('0x10')]('/:id',auth[_0x1126('0xd')](),controller['update']);router['delete'](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0x11')]);module[_0x1126('0x12')]=router; \ No newline at end of file +var _0x2675=['create','put','delete','destroy','exports','multer','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download'];(function(_0x5625d6,_0x47d26d){var _0x468966=function(_0x1c3cb2){while(--_0x1c3cb2){_0x5625d6['push'](_0x5625d6['shift']());}};_0x468966(++_0x47d26d);}(_0x2675,0x75));var _0x5267=function(_0x5dc8c3,_0x1fd1e3){_0x5dc8c3=_0x5dc8c3-0x0;var _0x56fefa=_0x2675[_0x5dc8c3];return _0x56fefa;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5267('0x3'));var config=require(_0x5267('0x4'));var controller=require('./voiceMailMessage.controller');router[_0x5267('0x5')]('/',auth[_0x5267('0x6')](),controller[_0x5267('0x7')]);router[_0x5267('0x5')](_0x5267('0x8'),auth[_0x5267('0x6')](),controller['show']);router[_0x5267('0x5')](_0x5267('0x9'),auth['isAuthenticated'](),controller[_0x5267('0xa')]);router['post']('/',auth[_0x5267('0x6')](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x6')](),controller['update']);router[_0x5267('0xd')]('/:id',auth[_0x5267('0x6')](),controller[_0x5267('0xe')]);module[_0x5267('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 14a3ae4..6623e22 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 _0xa083=['BLOB','long','TIMESTAMP','sequelize','getDataValue','INTEGER','STRING'];(function(_0x507148,_0x26ff54){var _0x18673c=function(_0x3abb7c){while(--_0x3abb7c){_0x507148['push'](_0x507148['shift']());}};_0x18673c(++_0x26ff54);}(_0xa083,0x1a7));var _0x3a08=function(_0x69da38,_0x44ad2e){_0x69da38=_0x69da38-0x0;var _0x51d097=_0xa083[_0x69da38];return _0x51d097;};'use strict';var Sequelize=require(_0x3a08('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xad0ada){return this[_0x3a08('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x3a08('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x3a08('0x4')](_0x3a08('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x3a08('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x83e1=['long','sequelize','exports','VIRTUAL','getDataValue','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83e1,0x11b));var _0x183e=function(_0xeb2969,_0xee087e){_0xeb2969=_0xeb2969-0x0;var _0xc51e23=_0x83e1[_0xeb2969];return _0xc51e23;};'use strict';var Sequelize=require(_0x183e('0x0'));module[_0x183e('0x1')]={'name':{'type':Sequelize[_0x183e('0x2')],'get':function(_0x157411){return this[_0x183e('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x183e('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x183e('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x183e('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x183e('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x183e('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x183e('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x183e('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x183e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 504dcf5..fba7483 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 _0x9374=['length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','create','body','find','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9374,0x169));var _0x4937=function(_0x1da289,_0x417651){_0x1da289=_0x1da289-0x0;var _0x41c889=_0x9374[_0x1da289];return _0x41c889;};'use strict';var pdf=require(_0x4937('0x0'));var emlformat=require(_0x4937('0x1'));var rimraf=require(_0x4937('0x2'));var zipdir=require(_0x4937('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4937('0x4'));var moment=require(_0x4937('0x5'));var BPromise=require(_0x4937('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4937('0x7'));var sox=require(_0x4937('0x8'));var csv=require(_0x4937('0x9'));var ejs=require(_0x4937('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4937('0xb'));var crypto=require(_0x4937('0xc'));var jsforce=require(_0x4937('0xd'));var deskjs=require(_0x4937('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4937('0xf'));var Redis=require(_0x4937('0x10'));var authService=require(_0x4937('0x11'));var qs=require(_0x4937('0x12'));var as=require(_0x4937('0x13'));var hardwareService=require(_0x4937('0x14'));var logger=require(_0x4937('0x15'))(_0x4937('0x16'));var utils=require(_0x4937('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4937('0x18'));var db=require(_0x4937('0x19'))['db'];function respondWithStatusCode(_0x564b05,_0x9866b2){_0x9866b2=_0x9866b2||0xcc;return function(_0x2badd2){if(_0x2badd2){return _0x564b05[_0x4937('0x1a')](_0x9866b2);}return _0x564b05[_0x4937('0x1b')](_0x9866b2)[_0x4937('0x1c')]();};}function respondWithResult(_0x3accb3,_0x191d5e){_0x191d5e=_0x191d5e||0xc8;return function(_0x4d9a1a){if(_0x4d9a1a){return _0x3accb3[_0x4937('0x1b')](_0x191d5e)[_0x4937('0x1d')](_0x4d9a1a);}};}function respondWithFilteredResult(_0x25c103,_0x1ebba6){return function(_0x187dfb){if(_0x187dfb){var _0x453639=_0x187dfb[_0x4937('0x1e')],_0x919e7f=_0x1ebba6[_0x4937('0x1f')],_0x589365=_0x1ebba6[_0x4937('0x1f')]+_0x1ebba6['limit'],_0x25c075;if(_0x589365>=_0x453639){_0x589365=_0x453639;_0x25c075=0xc8;}else{_0x25c075=0xce;}_0x25c103['status'](_0x25c075);return _0x25c103[_0x4937('0x20')](_0x4937('0x21'),_0x919e7f+'-'+_0x589365+'/'+_0x453639)[_0x4937('0x1d')](_0x187dfb);}return null;};}function patchUpdates(_0x26edee){return function(_0xddbce0){try{jsonpatch[_0x4937('0x22')](_0xddbce0,_0x26edee,!![]);}catch(_0x5ebd4e){return BPromise['reject'](_0x5ebd4e);}return _0xddbce0[_0x4937('0x23')]();};}function saveUpdates(_0x517ff6,_0x15e274){return function(_0x2db4f3){if(_0x2db4f3){return _0x2db4f3['update'](_0x517ff6)[_0x4937('0x24')](function(_0x3aacd0){return _0x3aacd0;});}return null;};}function removeEntity(_0x12568f,_0x1009c8){return function(_0x216e0e){if(_0x216e0e){return _0x216e0e[_0x4937('0x25')]()[_0x4937('0x24')](function(){_0x12568f[_0x4937('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f83b7,_0x195304){return function(_0x5ea2bb){if(!_0x5ea2bb){_0x3f83b7[_0x4937('0x1a')](0x194);}return _0x5ea2bb;};}function handleError(_0x52c308,_0x2bbbf6){_0x2bbbf6=_0x2bbbf6||0x1f4;return function(_0x2cd2f1){logger[_0x4937('0x26')](_0x2cd2f1[_0x4937('0x27')]);if(_0x2cd2f1[_0x4937('0x28')]){delete _0x2cd2f1['name'];}_0x52c308[_0x4937('0x1b')](_0x2bbbf6)[_0x4937('0x29')](_0x2cd2f1);};}exports['index']=function(_0x454418,_0x4627e3){var _0x1aad42={},_0x52bd87={},_0x226ec2={'count':0x0,'rows':[]};var _0x116dd5=_[_0x4937('0x2a')](db[_0x4937('0x2b')][_0x4937('0x2c')],function(_0x277315){return{'name':_0x277315[_0x4937('0x2d')],'type':_0x277315['type'][_0x4937('0x2e')]};});_0x52bd87[_0x4937('0x2f')]=_['differenceBy'](_[_0x4937('0x2a')](_0x116dd5,_0x4937('0x28')),[_0x4937('0x28')]);_0x52bd87[_0x4937('0x30')]=_[_0x4937('0x31')](_0x454418[_0x4937('0x30')]);_0x52bd87[_0x4937('0x32')]=_[_0x4937('0x33')](_0x52bd87[_0x4937('0x2f')],_0x52bd87[_0x4937('0x30')]);_0x1aad42['attributes']=_[_0x4937('0x33')](_0x52bd87[_0x4937('0x2f')],qs['fields'](_0x454418[_0x4937('0x30')][_0x4937('0x34')]));_0x1aad42[_0x4937('0x35')]=_0x1aad42['attributes'][_0x4937('0x36')]?_0x1aad42[_0x4937('0x35')]:_0x52bd87[_0x4937('0x2f')];if(!_0x454418[_0x4937('0x30')][_0x4937('0x37')](_0x4937('0x38'))){_0x1aad42[_0x4937('0x39')]=qs['limit'](_0x454418[_0x4937('0x30')][_0x4937('0x39')]);_0x1aad42[_0x4937('0x1f')]=qs[_0x4937('0x1f')](_0x454418[_0x4937('0x30')][_0x4937('0x1f')]);}_0x1aad42['order']=qs[_0x4937('0x3a')](_0x454418[_0x4937('0x30')][_0x4937('0x3a')]);_0x1aad42[_0x4937('0x3b')]=qs[_0x4937('0x32')](_[_0x4937('0x3c')](_0x454418[_0x4937('0x30')],_0x52bd87[_0x4937('0x32')]),_0x116dd5);if(_0x454418[_0x4937('0x30')]['filter']){_0x1aad42['where']=_[_0x4937('0x3d')](_0x1aad42[_0x4937('0x3b')],{'$or':_[_0x4937('0x2a')](_0x116dd5,function(_0x50df26){if(_0x50df26['type']!==_0x4937('0x3e')){var _0x1a3661={};_0x1a3661[_0x50df26[_0x4937('0x28')]]={'$like':'%'+_0x454418['query'][_0x4937('0x3f')]+'%'};return _0x1a3661;}})});}_0x1aad42=_['merge']({},_0x1aad42,_0x454418[_0x4937('0x40')]);var _0x5057e3={'where':_0x1aad42[_0x4937('0x3b')]};return db[_0x4937('0x2b')][_0x4937('0x1e')](_0x5057e3)['then'](function(_0x50730b){_0x226ec2['count']=_0x50730b;if(_0x454418[_0x4937('0x30')][_0x4937('0x41')]){_0x1aad42[_0x4937('0x42')]=[{'all':!![]}];}return db[_0x4937('0x2b')]['findAll'](_0x1aad42);})['then'](function(_0x35dab7){_0x226ec2[_0x4937('0x43')]=_0x35dab7;return _0x226ec2;})[_0x4937('0x24')](respondWithFilteredResult(_0x4627e3,_0x1aad42))[_0x4937('0x44')](handleError(_0x4627e3,null));};exports[_0x4937('0x45')]=function(_0x2bdd58,_0x4c6a8c){var _0x407bc1={'raw':!![],'where':{'id':_0x2bdd58[_0x4937('0x46')]['id']}},_0x4bd7b6={};_0x4bd7b6[_0x4937('0x2f')]=_[_0x4937('0x31')](db[_0x4937('0x2b')][_0x4937('0x2c')]);_0x4bd7b6[_0x4937('0x30')]=_[_0x4937('0x31')](_0x2bdd58['query']);_0x4bd7b6[_0x4937('0x32')]=_[_0x4937('0x33')](_0x4bd7b6[_0x4937('0x2f')],_0x4bd7b6['query']);_0x407bc1[_0x4937('0x35')]=_[_0x4937('0x33')](_0x4bd7b6[_0x4937('0x2f')],qs[_0x4937('0x34')](_0x2bdd58[_0x4937('0x30')][_0x4937('0x34')]));_0x407bc1[_0x4937('0x35')]=_0x407bc1[_0x4937('0x35')][_0x4937('0x36')]?_0x407bc1['attributes']:_0x4bd7b6[_0x4937('0x2f')];if(_0x2bdd58[_0x4937('0x30')][_0x4937('0x41')]){_0x407bc1[_0x4937('0x42')]=[{'all':!![]}];}_0x407bc1=_[_0x4937('0x3d')]({},_0x407bc1,_0x2bdd58[_0x4937('0x40')]);return db['VoiceMailMessage']['find'](_0x407bc1)['then'](handleEntityNotFound(_0x4c6a8c,null))['then'](respondWithResult(_0x4c6a8c,null))['catch'](handleError(_0x4c6a8c,null));};exports[_0x4937('0x47')]=function(_0x1c41b5,_0x29bdc4){return db['VoiceMailMessage'][_0x4937('0x47')](_0x1c41b5[_0x4937('0x48')],{})[_0x4937('0x24')](respondWithResult(_0x29bdc4,0xc9))[_0x4937('0x44')](handleError(_0x29bdc4,null));};exports['update']=function(_0x2b0701,_0x600fe7){if(_0x2b0701[_0x4937('0x48')]['id']){delete _0x2b0701[_0x4937('0x48')]['id'];}return db['VoiceMailMessage'][_0x4937('0x49')]({'where':{'id':_0x2b0701[_0x4937('0x46')]['id']}})['then'](handleEntityNotFound(_0x600fe7,null))['then'](saveUpdates(_0x2b0701['body'],null))['then'](respondWithResult(_0x600fe7,null))['catch'](handleError(_0x600fe7,null));};exports[_0x4937('0x25')]=function(_0x34c35d,_0x5383b3){return db[_0x4937('0x2b')][_0x4937('0x49')]({'where':{'id':_0x34c35d['params']['id']}})[_0x4937('0x24')](handleEntityNotFound(_0x5383b3,null))[_0x4937('0x24')](removeEntity(_0x5383b3,null))['catch'](handleError(_0x5383b3,null));};exports['download']=function(_0x316d52,_0x1d3b6e,_0x371366){return db['VoiceMailMessage'][_0x4937('0x49')]({'where':{'id':_0x316d52[_0x4937('0x46')]['id']},'attributes':['id',_0x4937('0x4a'),_0x4937('0x4b')]})[_0x4937('0x24')](handleEntityNotFound(_0x1d3b6e,null))['then'](function(_0x4131e4){if(_0x4131e4){if(!_0x4131e4[_0x4937('0x4a')]){throw new db[(_0x4937('0x4c'))][(_0x4937('0x4d'))](_0x4937('0x4e'));}var _0x4a6593={'Content-Type':'audio/wav','Content-Disposition':_0x4937('0x4f')};if(_0x4131e4[_0x4937('0x4b')]){_0x4a6593[_0x4937('0x50')]=_0x4937('0x51')+_0x4131e4[_0x4937('0x4b')]+_0x4937('0x52');}_0x1d3b6e[_0x4937('0x20')](_0x4a6593);return _0x1d3b6e[_0x4937('0x29')](new Buffer(_0x4131e4['recording']));}})[_0x4937('0x44')](handleError(_0x1d3b6e,null));}; \ No newline at end of file +var _0x2005=['set','apply','save','update','then','error','stack','name','send','map','VoiceMailMessage','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','download','recording','msg_id','VoiceMailMessage\x20not\x20found','audio/wav','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset'];(function(_0x25ced0,_0x1f2424){var _0x136719=function(_0x1a6463){while(--_0x1a6463){_0x25ced0['push'](_0x25ced0['shift']());}};_0x136719(++_0x1f2424);}(_0x2005,0xc9));var _0x5200=function(_0x2531ab,_0x19c09b){_0x2531ab=_0x2531ab-0x0;var _0x10d643=_0x2005[_0x2531ab];return _0x10d643;};'use strict';var pdf=require(_0x5200('0x0'));var emlformat=require(_0x5200('0x1'));var rimraf=require(_0x5200('0x2'));var zipdir=require(_0x5200('0x3'));var jsonpatch=require(_0x5200('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5200('0x5'));var Mustache=require(_0x5200('0x6'));var util=require('util');var path=require(_0x5200('0x7'));var sox=require('sox');var csv=require(_0x5200('0x8'));var ejs=require(_0x5200('0x9'));var fs=require('fs');var _=require(_0x5200('0xa'));var squel=require(_0x5200('0xb'));var crypto=require('crypto');var jsforce=require(_0x5200('0xc'));var deskjs=require(_0x5200('0xd'));var toCsv=require(_0x5200('0x8'));var querystring=require(_0x5200('0xe'));var Papa=require(_0x5200('0xf'));var Redis=require(_0x5200('0x10'));var authService=require(_0x5200('0x11'));var qs=require(_0x5200('0x12'));var as=require(_0x5200('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5200('0x14'));var utils=require(_0x5200('0x15'));var config=require(_0x5200('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5200('0x17'))['db'];function respondWithStatusCode(_0x1eddef,_0xd32250){_0xd32250=_0xd32250||0xcc;return function(_0x2985cb){if(_0x2985cb){return _0x1eddef[_0x5200('0x18')](_0xd32250);}return _0x1eddef['status'](_0xd32250)[_0x5200('0x19')]();};}function respondWithResult(_0x3ef15f,_0x430bc5){_0x430bc5=_0x430bc5||0xc8;return function(_0x23f521){if(_0x23f521){return _0x3ef15f[_0x5200('0x1a')](_0x430bc5)[_0x5200('0x1b')](_0x23f521);}};}function respondWithFilteredResult(_0x2c9acc,_0x20e6a0){return function(_0x32c45c){if(_0x32c45c){var _0x1a94ac=_0x32c45c[_0x5200('0x1c')],_0x242010=_0x20e6a0[_0x5200('0x1d')],_0x399aa9=_0x20e6a0['offset']+_0x20e6a0['limit'],_0x34a56f;if(_0x399aa9>=_0x1a94ac){_0x399aa9=_0x1a94ac;_0x34a56f=0xc8;}else{_0x34a56f=0xce;}_0x2c9acc[_0x5200('0x1a')](_0x34a56f);return _0x2c9acc[_0x5200('0x1e')]('Content-Range',_0x242010+'-'+_0x399aa9+'/'+_0x1a94ac)[_0x5200('0x1b')](_0x32c45c);}return null;};}function patchUpdates(_0x587ef3){return function(_0x7fb5a){try{jsonpatch[_0x5200('0x1f')](_0x7fb5a,_0x587ef3,!![]);}catch(_0x148d0c){return BPromise['reject'](_0x148d0c);}return _0x7fb5a[_0x5200('0x20')]();};}function saveUpdates(_0x6f3e06,_0x4d1ca3){return function(_0x1108f5){if(_0x1108f5){return _0x1108f5[_0x5200('0x21')](_0x6f3e06)['then'](function(_0x1f5df4){return _0x1f5df4;});}return null;};}function removeEntity(_0x45d26d,_0x3fff72){return function(_0x1a73c6){if(_0x1a73c6){return _0x1a73c6['destroy']()[_0x5200('0x22')](function(){_0x45d26d[_0x5200('0x1a')](0xcc)[_0x5200('0x19')]();});}};}function handleEntityNotFound(_0x27810e,_0x496531){return function(_0x10e56e){if(!_0x10e56e){_0x27810e['sendStatus'](0x194);}return _0x10e56e;};}function handleError(_0x386996,_0x2c8799){_0x2c8799=_0x2c8799||0x1f4;return function(_0x3da012){logger[_0x5200('0x23')](_0x3da012[_0x5200('0x24')]);if(_0x3da012[_0x5200('0x25')]){delete _0x3da012[_0x5200('0x25')];}_0x386996[_0x5200('0x1a')](_0x2c8799)[_0x5200('0x26')](_0x3da012);};}exports['index']=function(_0x11a41e,_0x19794c){var _0x125b39={},_0x4891c8={},_0x2259a9={'count':0x0,'rows':[]};var _0x545e2d=_[_0x5200('0x27')](db[_0x5200('0x28')]['rawAttributes'],function(_0x4af810){return{'name':_0x4af810['fieldName'],'type':_0x4af810[_0x5200('0x29')][_0x5200('0x2a')]};});_0x4891c8['model']=_[_0x5200('0x2b')](_[_0x5200('0x27')](_0x545e2d,_0x5200('0x25')),[_0x5200('0x25')]);_0x4891c8[_0x5200('0x2c')]=_[_0x5200('0x2d')](_0x11a41e[_0x5200('0x2c')]);_0x4891c8[_0x5200('0x2e')]=_[_0x5200('0x2f')](_0x4891c8[_0x5200('0x30')],_0x4891c8['query']);_0x125b39[_0x5200('0x31')]=_[_0x5200('0x2f')](_0x4891c8[_0x5200('0x30')],qs[_0x5200('0x32')](_0x11a41e[_0x5200('0x2c')][_0x5200('0x32')]));_0x125b39[_0x5200('0x31')]=_0x125b39['attributes'][_0x5200('0x33')]?_0x125b39[_0x5200('0x31')]:_0x4891c8[_0x5200('0x30')];if(!_0x11a41e[_0x5200('0x2c')]['hasOwnProperty']('nolimit')){_0x125b39[_0x5200('0x34')]=qs[_0x5200('0x34')](_0x11a41e['query'][_0x5200('0x34')]);_0x125b39['offset']=qs[_0x5200('0x1d')](_0x11a41e[_0x5200('0x2c')][_0x5200('0x1d')]);}_0x125b39[_0x5200('0x35')]=qs['sort'](_0x11a41e[_0x5200('0x2c')][_0x5200('0x36')]);_0x125b39[_0x5200('0x37')]=qs[_0x5200('0x2e')](_['pick'](_0x11a41e[_0x5200('0x2c')],_0x4891c8[_0x5200('0x2e')]),_0x545e2d);if(_0x11a41e['query']['filter']){_0x125b39[_0x5200('0x37')]=_[_0x5200('0x38')](_0x125b39[_0x5200('0x37')],{'$or':_[_0x5200('0x27')](_0x545e2d,function(_0x73462d){if(_0x73462d['type']!==_0x5200('0x39')){var _0x3e6436={};_0x3e6436[_0x73462d['name']]={'$like':'%'+_0x11a41e[_0x5200('0x2c')][_0x5200('0x3a')]+'%'};return _0x3e6436;}})});}_0x125b39=_['merge']({},_0x125b39,_0x11a41e[_0x5200('0x3b')]);var _0x36ae8c={'where':_0x125b39[_0x5200('0x37')]};return db['VoiceMailMessage']['count'](_0x36ae8c)[_0x5200('0x22')](function(_0x2b45bc){_0x2259a9[_0x5200('0x1c')]=_0x2b45bc;if(_0x11a41e[_0x5200('0x2c')][_0x5200('0x3c')]){_0x125b39['include']=[{'all':!![]}];}return db[_0x5200('0x28')][_0x5200('0x3d')](_0x125b39);})[_0x5200('0x22')](function(_0x3b05ca){_0x2259a9[_0x5200('0x3e')]=_0x3b05ca;return _0x2259a9;})[_0x5200('0x22')](respondWithFilteredResult(_0x19794c,_0x125b39))[_0x5200('0x3f')](handleError(_0x19794c,null));};exports[_0x5200('0x40')]=function(_0xbc67c9,_0x164556){var _0xf6d62={'raw':!![],'where':{'id':_0xbc67c9[_0x5200('0x41')]['id']}},_0x505673={};_0x505673[_0x5200('0x30')]=_[_0x5200('0x2d')](db[_0x5200('0x28')]['rawAttributes']);_0x505673[_0x5200('0x2c')]=_[_0x5200('0x2d')](_0xbc67c9['query']);_0x505673[_0x5200('0x2e')]=_[_0x5200('0x2f')](_0x505673[_0x5200('0x30')],_0x505673[_0x5200('0x2c')]);_0xf6d62[_0x5200('0x31')]=_[_0x5200('0x2f')](_0x505673[_0x5200('0x30')],qs[_0x5200('0x32')](_0xbc67c9[_0x5200('0x2c')][_0x5200('0x32')]));_0xf6d62[_0x5200('0x31')]=_0xf6d62[_0x5200('0x31')][_0x5200('0x33')]?_0xf6d62[_0x5200('0x31')]:_0x505673['model'];if(_0xbc67c9['query'][_0x5200('0x3c')]){_0xf6d62[_0x5200('0x42')]=[{'all':!![]}];}_0xf6d62=_['merge']({},_0xf6d62,_0xbc67c9[_0x5200('0x3b')]);return db[_0x5200('0x28')]['find'](_0xf6d62)['then'](handleEntityNotFound(_0x164556,null))[_0x5200('0x22')](respondWithResult(_0x164556,null))[_0x5200('0x3f')](handleError(_0x164556,null));};exports[_0x5200('0x43')]=function(_0x59e5d3,_0x279e2d){return db[_0x5200('0x28')]['create'](_0x59e5d3[_0x5200('0x44')],{})[_0x5200('0x22')](respondWithResult(_0x279e2d,0xc9))[_0x5200('0x3f')](handleError(_0x279e2d,null));};exports[_0x5200('0x21')]=function(_0x17a751,_0x5072bb){if(_0x17a751[_0x5200('0x44')]['id']){delete _0x17a751[_0x5200('0x44')]['id'];}return db[_0x5200('0x28')][_0x5200('0x45')]({'where':{'id':_0x17a751[_0x5200('0x41')]['id']}})[_0x5200('0x22')](handleEntityNotFound(_0x5072bb,null))[_0x5200('0x22')](saveUpdates(_0x17a751['body'],null))['then'](respondWithResult(_0x5072bb,null))['catch'](handleError(_0x5072bb,null));};exports[_0x5200('0x46')]=function(_0x3f889d,_0xa93ed5){return db[_0x5200('0x28')][_0x5200('0x45')]({'where':{'id':_0x3f889d[_0x5200('0x41')]['id']}})[_0x5200('0x22')](handleEntityNotFound(_0xa93ed5,null))[_0x5200('0x22')](removeEntity(_0xa93ed5,null))[_0x5200('0x3f')](handleError(_0xa93ed5,null));};exports[_0x5200('0x47')]=function(_0x7e40a,_0x3c0fd5,_0x1636a1){return db[_0x5200('0x28')]['find']({'where':{'id':_0x7e40a[_0x5200('0x41')]['id']},'attributes':['id',_0x5200('0x48'),_0x5200('0x49')]})['then'](handleEntityNotFound(_0x3c0fd5,null))[_0x5200('0x22')](function(_0x270133){if(_0x270133){if(!_0x270133[_0x5200('0x48')]){throw new db['Sequelize']['ValidationError'](_0x5200('0x4a'));}var _0x269201={'Content-Type':_0x5200('0x4b'),'Content-Disposition':'attachment'};if(_0x270133[_0x5200('0x49')]){_0x269201['Content-Disposition']='attachment;\x20filename=\x22'+_0x270133['msg_id']+_0x5200('0x4c');}_0x3c0fd5['set'](_0x269201);return _0x3c0fd5[_0x5200('0x26')](new Buffer(_0x270133['recording']));}})[_0x5200('0x3f')](handleError(_0x3c0fd5,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 25eadff..47e50d4 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 _0x188b=['rimraf','../../config/environment','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','bluebird','request-promise'];(function(_0x5c660a,_0x4b5262){var _0x3a77a4=function(_0x479c95){while(--_0x479c95){_0x5c660a['push'](_0x5c660a['shift']());}};_0x3a77a4(++_0x4b5262);}(_0x188b,0x1dc));var _0xb188=function(_0x5e78e0,_0x184cb0){_0x5e78e0=_0x5e78e0-0x0;var _0x391d1f=_0x188b[_0x5e78e0];return _0x391d1f;};'use strict';var _=require(_0xb188('0x0'));var util=require('util');var logger=require(_0xb188('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb188('0x2'));var rp=require(_0xb188('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb188('0x4'));var config=require(_0xb188('0x5'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x580883,_0xb9c8df){return _0x580883[_0xb188('0x6')](_0xb188('0x7'),attributes,{'tableName':_0xb188('0x8'),'paranoid':![],'indexes':[{'name':_0xb188('0x9'),'fields':[_0xb188('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0xec29=['dir','../../config/logger','moment','bluebird','rimraf','./voiceMailMessage.attributes','define','VoiceMailMessage'];(function(_0x3fad5a,_0x2d3b02){var _0x4ca713=function(_0x2abe58){while(--_0x2abe58){_0x3fad5a['push'](_0x3fad5a['shift']());}};_0x4ca713(++_0x2d3b02);}(_0xec29,0x71));var _0x9ec2=function(_0x48b131,_0x5db228){_0x48b131=_0x48b131-0x0;var _0x30fb3a=_0xec29[_0x48b131];return _0x30fb3a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9ec2('0x0'))('api');var moment=require(_0x9ec2('0x1'));var BPromise=require(_0x9ec2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9ec2('0x3'));var config=require('../../config/environment');var attributes=require(_0x9ec2('0x4'));module['exports']=function(_0x24a57e,_0x3ffe37){return _0x24a57e[_0x9ec2('0x5')](_0x9ec2('0x6'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x9ec2('0x7'),'fields':[_0x9ec2('0x7')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 392b90a..d8d1535 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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceMailMessage,\x20%s,\x20%s','message','catch','lodash'];(function(_0x1cd363,_0x12c2b7){var _0x2e92cd=function(_0x26f726){while(--_0x26f726){_0x1cd363['push'](_0x1cd363['shift']());}};_0x2e92cd(++_0x12c2b7);}(_0x66fa,0x117));var _0xa66f=function(_0x15cd5b,_0xd5cc4d){_0x15cd5b=_0x15cd5b-0x0;var _0x1121f5=_0x66fa[_0x15cd5b];return _0x1121f5;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1d9f90,_0x5d41cd){var _0xb2f3d4=function(_0x11a7e9){while(--_0x11a7e9){_0x1d9f90['push'](_0x1d9f90['shift']());}};_0xb2f3d4(++_0x5d41cd);}(_0x0295,0x1f0));var _0x5029=function(_0x39df29,_0x450cdc){_0x39df29=_0x39df29-0x0;var _0x4cecc6=_0x0295[_0x39df29];return _0x4cecc6;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index d37220e..a3442cf 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 _0x7397=['/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create','addSound','put','destroy','/:id/sounds/:id2','removeSound','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMusicOnHold.controller','get','index'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x7397,0x132));var _0x7739=function(_0x435e3c,_0x59c6c9){_0x435e3c=_0x435e3c-0x0;var _0x230cf8=_0x7397[_0x435e3c];return _0x230cf8;};'use strict';var multer=require('multer');var util=require(_0x7739('0x0'));var path=require(_0x7739('0x1'));var timeout=require(_0x7739('0x2'));var express=require(_0x7739('0x3'));var router=express[_0x7739('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7739('0x5'));var config=require('../../config/environment');var controller=require(_0x7739('0x6'));router[_0x7739('0x7')]('/',auth['isAuthenticated'](),controller[_0x7739('0x8')]);router['get'](_0x7739('0x9'),auth[_0x7739('0xa')](),controller[_0x7739('0xb')]);router[_0x7739('0x7')](_0x7739('0xc'),auth[_0x7739('0xa')](),controller[_0x7739('0xd')]);router[_0x7739('0xe')]('/',auth[_0x7739('0xa')](),controller[_0x7739('0xf')]);router[_0x7739('0xe')](_0x7739('0xc'),auth[_0x7739('0xa')](),controller[_0x7739('0x10')]);router[_0x7739('0x11')](_0x7739('0x9'),auth[_0x7739('0xa')](),controller['update']);router['delete']('/:id',auth[_0x7739('0xa')](),controller[_0x7739('0x12')]);router['delete'](_0x7739('0x13'),auth[_0x7739('0xa')](),controller[_0x7739('0x14')]);module['exports']=router; \ No newline at end of file +var _0x80b7=['./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','post','create','addSound','put','delete','/:id/sounds/:id2','removeSound','multer','util','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);}(_0x80b7,0x12c));var _0x780b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x80b7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x780b('0x0'));var util=require(_0x780b('0x1'));var path=require('path');var timeout=require(_0x780b('0x2'));var express=require(_0x780b('0x3'));var router=express[_0x780b('0x4')]();var auth=require(_0x780b('0x5'));var interaction=require(_0x780b('0x6'));var config=require(_0x780b('0x7'));var controller=require(_0x780b('0x8'));router[_0x780b('0x9')]('/',auth[_0x780b('0xa')](),controller[_0x780b('0xb')]);router[_0x780b('0x9')](_0x780b('0xc'),auth[_0x780b('0xa')](),controller[_0x780b('0xd')]);router[_0x780b('0x9')](_0x780b('0xe'),auth[_0x780b('0xa')](),controller['getSounds']);router[_0x780b('0xf')]('/',auth[_0x780b('0xa')](),controller[_0x780b('0x10')]);router[_0x780b('0xf')](_0x780b('0xe'),auth[_0x780b('0xa')](),controller[_0x780b('0x11')]);router[_0x780b('0x12')](_0x780b('0xc'),auth[_0x780b('0xa')](),controller['update']);router[_0x780b('0x13')](_0x780b('0xc'),auth[_0x780b('0xa')](),controller['destroy']);router[_0x780b('0x13')](_0x780b('0x14'),auth[_0x780b('0xa')](),controller[_0x780b('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 2fe959f..edbf55c 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 _0x5c54=['alpha','TIMESTAMP','BOOLEAN','sequelize','name','custom','quietmp3nb','quietmp3','mp3','STRING'];(function(_0x3b3c2f,_0x35ff72){var _0x1f1123=function(_0x48fffa){while(--_0x48fffa){_0x3b3c2f['push'](_0x3b3c2f['shift']());}};_0x1f1123(++_0x35ff72);}(_0x5c54,0x139));var _0x45c5=function(_0x5dcfb9,_0x494864){_0x5dcfb9=_0x5dcfb9-0x0;var _0x119f69=_0x5c54[_0x5dcfb9];return _0x119f69;};'use strict';var Sequelize=require(_0x45c5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x45c5('0x1')},'mode':{'type':Sequelize['ENUM'](_0x45c5('0x2'),'files','mp3nb',_0x45c5('0x3'),_0x45c5('0x4'),_0x45c5('0x5')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x45c5('0x6')],'allowNull':!![]},'application':{'type':Sequelize[_0x45c5('0x6')],'allowNull':!![]},'digit':{'type':Sequelize[_0x45c5('0x6')],'allowNull':!![]},'sort':{'type':Sequelize[_0x45c5('0x6')],'allowNull':!![],'defaultValue':_0x45c5('0x7')},'format':{'type':Sequelize[_0x45c5('0x6')],'allowNull':!![]},'stamp':{'type':_0x45c5('0x8')},'defaultEntry':{'type':Sequelize[_0x45c5('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5f03=['alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM','files','mp3nb','quietmp3nb','mp3'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5f03,0x184));var _0x35f0=function(_0x552207,_0x1b95d4){_0x552207=_0x552207-0x0;var _0x204d44=_0x5f03[_0x552207];return _0x204d44;};'use strict';var Sequelize=require(_0x35f0('0x0'));module[_0x35f0('0x1')]={'name':{'type':Sequelize[_0x35f0('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x35f0('0x3')]('custom',_0x35f0('0x4'),_0x35f0('0x5'),_0x35f0('0x6'),'quietmp3',_0x35f0('0x7')),'allowNull':!![],'defaultValue':_0x35f0('0x4')},'directory':{'type':Sequelize[_0x35f0('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x35f0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x35f0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x35f0('0x2')],'allowNull':!![],'defaultValue':_0x35f0('0x8')},'format':{'type':Sequelize[_0x35f0('0x2')],'allowNull':!![]},'stamp':{'type':_0x35f0('0x9')},'defaultEntry':{'type':Sequelize[_0x35f0('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 049fba2..469b926 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 _0xf0da=['UserProfileResource','readdirSync','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','converted_format','createdAt','root','format','%s.%s','basename','save_name','symlinkSync','ValidationError','findOne','removeSound','id2','getSounds','order','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','keys','find','body','params','create','sequelize','transaction','mode','files','directory','join','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId'];(function(_0x544a26,_0x383869){var _0x449357=function(_0x5e5a33){while(--_0x5e5a33){_0x544a26['push'](_0x544a26['shift']());}};_0x449357(++_0x383869);}(_0xf0da,0xff));var _0xaf0d=function(_0x4ac3a4,_0x5e623d){_0x4ac3a4=_0x4ac3a4-0x0;var _0x64d096=_0xf0da[_0x4ac3a4];return _0x64d096;};'use strict';var pdf=require(_0xaf0d('0x0'));var emlformat=require(_0xaf0d('0x1'));var rimraf=require(_0xaf0d('0x2'));var zipdir=require(_0xaf0d('0x3'));var jsonpatch=require(_0xaf0d('0x4'));var rp=require('request-promise');var moment=require(_0xaf0d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaf0d('0x6'));var util=require('util');var path=require(_0xaf0d('0x7'));var sox=require(_0xaf0d('0x8'));var csv=require(_0xaf0d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaf0d('0xa'));var squel=require(_0xaf0d('0xb'));var crypto=require(_0xaf0d('0xc'));var jsforce=require(_0xaf0d('0xd'));var deskjs=require(_0xaf0d('0xe'));var toCsv=require(_0xaf0d('0x9'));var querystring=require(_0xaf0d('0xf'));var Papa=require(_0xaf0d('0x10'));var Redis=require(_0xaf0d('0x11'));var authService=require(_0xaf0d('0x12'));var qs=require(_0xaf0d('0x13'));var as=require(_0xaf0d('0x14'));var hardwareService=require(_0xaf0d('0x15'));var logger=require(_0xaf0d('0x16'))(_0xaf0d('0x17'));var utils=require(_0xaf0d('0x18'));var config=require(_0xaf0d('0x19'));var licenseUtil=require(_0xaf0d('0x1a'));var db=require(_0xaf0d('0x1b'))['db'];function respondWithStatusCode(_0x3a60ef,_0x4813df){_0x4813df=_0x4813df||0xcc;return function(_0x303629){if(_0x303629){return _0x3a60ef[_0xaf0d('0x1c')](_0x4813df);}return _0x3a60ef[_0xaf0d('0x1d')](_0x4813df)[_0xaf0d('0x1e')]();};}function respondWithResult(_0x5f3426,_0x4643e0){_0x4643e0=_0x4643e0||0xc8;return function(_0x2fb7fa){if(_0x2fb7fa){return _0x5f3426[_0xaf0d('0x1d')](_0x4643e0)[_0xaf0d('0x1f')](_0x2fb7fa);}};}function respondWithFilteredResult(_0x272423,_0x400581){return function(_0x490892){if(_0x490892){var _0xfb2ed9=_0x490892[_0xaf0d('0x20')],_0x18141e=_0x400581[_0xaf0d('0x21')],_0x2778b6=_0x400581[_0xaf0d('0x21')]+_0x400581[_0xaf0d('0x22')],_0x2fb66e;if(_0x2778b6>=_0xfb2ed9){_0x2778b6=_0xfb2ed9;_0x2fb66e=0xc8;}else{_0x2fb66e=0xce;}_0x272423[_0xaf0d('0x1d')](_0x2fb66e);return _0x272423[_0xaf0d('0x23')](_0xaf0d('0x24'),_0x18141e+'-'+_0x2778b6+'/'+_0xfb2ed9)[_0xaf0d('0x1f')](_0x490892);}return null;};}function patchUpdates(_0x28252d){return function(_0x28be7c){try{jsonpatch[_0xaf0d('0x25')](_0x28be7c,_0x28252d,!![]);}catch(_0x3ee9a8){return BPromise['reject'](_0x3ee9a8);}return _0x28be7c[_0xaf0d('0x26')]();};}function saveUpdates(_0x459a3d,_0x3c218a){return function(_0x6500ff){if(_0x6500ff){return _0x6500ff[_0xaf0d('0x27')](_0x459a3d)[_0xaf0d('0x28')](function(_0xc50a81){return _0xc50a81;});}return null;};}function removeEntity(_0x3342cd,_0xe0d1d4){return function(_0x5d50e3){if(_0x5d50e3){return _0x5d50e3[_0xaf0d('0x29')]()[_0xaf0d('0x28')](function(){var _0x34047b=_0x5d50e3[_0xaf0d('0x2a')]({'plain':!![]});var _0x1c77f4=_0xaf0d('0x2b');return db['UserProfileResource'][_0xaf0d('0x29')]({'where':{'type':_0x1c77f4,'resourceId':_0x34047b['id']}})[_0xaf0d('0x28')](function(){return _0x5d50e3;});})[_0xaf0d('0x28')](function(){_0x3342cd[_0xaf0d('0x1d')](0xcc)[_0xaf0d('0x1e')]();});}};}function handleEntityNotFound(_0x45ec1b,_0x18b53d){return function(_0x553e52){if(!_0x553e52){_0x45ec1b['sendStatus'](0x194);}return _0x553e52;};}function handleError(_0x175ccb,_0x5a8c3){_0x5a8c3=_0x5a8c3||0x1f4;return function(_0x1c4c7c){logger[_0xaf0d('0x2c')](_0x1c4c7c[_0xaf0d('0x2d')]);if(_0x1c4c7c[_0xaf0d('0x2e')]){delete _0x1c4c7c['name'];}_0x175ccb[_0xaf0d('0x1d')](_0x5a8c3)[_0xaf0d('0x2f')](_0x1c4c7c);};}exports[_0xaf0d('0x30')]=function(_0x479395,_0x241368){var _0x44b65c={},_0x49c2ae={},_0x23c30a={'count':0x0,'rows':[]};var _0x128d22=_[_0xaf0d('0x31')](db[_0xaf0d('0x32')][_0xaf0d('0x33')],function(_0x6b6cda){return{'name':_0x6b6cda[_0xaf0d('0x34')],'type':_0x6b6cda['type'][_0xaf0d('0x35')]};});_0x49c2ae[_0xaf0d('0x36')]=_[_0xaf0d('0x31')](_0x128d22,_0xaf0d('0x2e'));_0x49c2ae[_0xaf0d('0x37')]=_['keys'](_0x479395[_0xaf0d('0x37')]);_0x49c2ae[_0xaf0d('0x38')]=_[_0xaf0d('0x39')](_0x49c2ae[_0xaf0d('0x36')],_0x49c2ae[_0xaf0d('0x37')]);_0x44b65c['attributes']=_[_0xaf0d('0x39')](_0x49c2ae[_0xaf0d('0x36')],qs[_0xaf0d('0x3a')](_0x479395[_0xaf0d('0x37')][_0xaf0d('0x3a')]));_0x44b65c['attributes']=_0x44b65c[_0xaf0d('0x3b')][_0xaf0d('0x3c')]?_0x44b65c[_0xaf0d('0x3b')]:_0x49c2ae[_0xaf0d('0x36')];if(!_0x479395[_0xaf0d('0x37')][_0xaf0d('0x3d')](_0xaf0d('0x3e'))){_0x44b65c['limit']=qs['limit'](_0x479395[_0xaf0d('0x37')][_0xaf0d('0x22')]);_0x44b65c['offset']=qs['offset'](_0x479395[_0xaf0d('0x37')][_0xaf0d('0x21')]);}_0x44b65c['order']=qs[_0xaf0d('0x3f')](_0x479395['query'][_0xaf0d('0x3f')]);_0x44b65c['where']=qs['filters'](_['pick'](_0x479395[_0xaf0d('0x37')],_0x49c2ae[_0xaf0d('0x38')]),_0x128d22);if(_0x479395[_0xaf0d('0x37')]['filter']){_0x44b65c[_0xaf0d('0x40')]=_[_0xaf0d('0x41')](_0x44b65c[_0xaf0d('0x40')],{'$or':_['map'](_0x128d22,function(_0x5906dd){if(_0x5906dd[_0xaf0d('0x42')]!==_0xaf0d('0x43')){var _0x1e5147={};_0x1e5147[_0x5906dd[_0xaf0d('0x2e')]]={'$like':'%'+_0x479395[_0xaf0d('0x37')][_0xaf0d('0x44')]+'%'};return _0x1e5147;}})});}_0x44b65c=_[_0xaf0d('0x41')]({},_0x44b65c,_0x479395[_0xaf0d('0x45')]);var _0x1bae6a={'where':_0x44b65c[_0xaf0d('0x40')]};return db['VoiceMusicOnHold'][_0xaf0d('0x20')](_0x1bae6a)[_0xaf0d('0x28')](function(_0x4edd04){_0x23c30a[_0xaf0d('0x20')]=_0x4edd04;if(_0x479395[_0xaf0d('0x37')][_0xaf0d('0x46')]){_0x44b65c[_0xaf0d('0x47')]=[{'all':!![]}];}return db[_0xaf0d('0x32')][_0xaf0d('0x48')](_0x44b65c);})[_0xaf0d('0x28')](function(_0x3c0851){_0x23c30a['rows']=_0x3c0851;return _0x23c30a;})[_0xaf0d('0x28')](respondWithFilteredResult(_0x241368,_0x44b65c))[_0xaf0d('0x49')](handleError(_0x241368,null));};exports[_0xaf0d('0x4a')]=function(_0x392238,_0x569f50){var _0x3922ae={'raw':![],'where':{'id':_0x392238['params']['id']}},_0x237a8f={};_0x237a8f[_0xaf0d('0x36')]=_['keys'](db[_0xaf0d('0x32')][_0xaf0d('0x33')]);_0x237a8f[_0xaf0d('0x37')]=_[_0xaf0d('0x4b')](_0x392238[_0xaf0d('0x37')]);_0x237a8f[_0xaf0d('0x38')]=_[_0xaf0d('0x39')](_0x237a8f[_0xaf0d('0x36')],_0x237a8f[_0xaf0d('0x37')]);_0x3922ae[_0xaf0d('0x3b')]=_[_0xaf0d('0x39')](_0x237a8f[_0xaf0d('0x36')],qs['fields'](_0x392238['query'][_0xaf0d('0x3a')]));_0x3922ae[_0xaf0d('0x3b')]=_0x3922ae['attributes']['length']?_0x3922ae['attributes']:_0x237a8f['model'];if(_0x392238['query']['includeAll']){_0x3922ae[_0xaf0d('0x47')]=[{'all':!![]}];}_0x3922ae=_['merge']({},_0x3922ae,_0x392238[_0xaf0d('0x45')]);return db[_0xaf0d('0x32')][_0xaf0d('0x4c')](_0x3922ae)[_0xaf0d('0x28')](handleEntityNotFound(_0x569f50,null))[_0xaf0d('0x28')](respondWithResult(_0x569f50,null))[_0xaf0d('0x49')](handleError(_0x569f50,null));};exports[_0xaf0d('0x27')]=function(_0x4e8536,_0x4cdffc){if(_0x4e8536[_0xaf0d('0x4d')]['id']){delete _0x4e8536['body']['id'];}return db[_0xaf0d('0x32')][_0xaf0d('0x4c')]({'where':{'id':_0x4e8536[_0xaf0d('0x4e')]['id']}})[_0xaf0d('0x28')](handleEntityNotFound(_0x4cdffc,null))[_0xaf0d('0x28')](saveUpdates(_0x4e8536['body'],null))['then'](respondWithResult(_0x4cdffc,null))['catch'](handleError(_0x4cdffc,null));};exports[_0xaf0d('0x4f')]=function(_0x2010c8,_0x59e5f8,_0x30c07a){return db[_0xaf0d('0x50')][_0xaf0d('0x51')](function(_0x2d14ef){if(_0x2010c8[_0xaf0d('0x4d')][_0xaf0d('0x52')]===_0xaf0d('0x53')){_0x2010c8['body'][_0xaf0d('0x54')]=path[_0xaf0d('0x55')](config['root'],_0xaf0d('0x56'),_0x2010c8[_0xaf0d('0x4d')][_0xaf0d('0x2e')]);}return db[_0xaf0d('0x32')][_0xaf0d('0x4f')](_0x2010c8['body'],{'transaction':_0x2d14ef})[_0xaf0d('0x28')](function(_0x535e01){if(_0x2010c8[_0xaf0d('0x4d')][_0xaf0d('0x52')]==='files'){fs[_0xaf0d('0x57')](_0x535e01[_0xaf0d('0x54')],parseInt(_0xaf0d('0x58'),0x8));}var _0x460a4e=_0x2010c8[_0xaf0d('0x59')][_0xaf0d('0x2a')]({'plain':!![]});if(!_0x460a4e)throw new Error(_0xaf0d('0x5a'));if(_0x460a4e[_0xaf0d('0x5b')]===_0xaf0d('0x59')){var _0x59267f=_0x535e01[_0xaf0d('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0xaf0d('0x4c')]({'where':{'name':'MusicOnHolds','userProfileId':_0x460a4e[_0xaf0d('0x5c')]},'raw':!![]})[_0xaf0d('0x28')](function(_0x57c991){if(_0x57c991&&_0x57c991['autoAssociation']===0x0){return db[_0xaf0d('0x5d')][_0xaf0d('0x4f')]({'name':_0x59267f[_0xaf0d('0x2e')],'resourceId':_0x59267f['id'],'type':_0x57c991[_0xaf0d('0x2e')],'sectionId':_0x57c991['id']},{})[_0xaf0d('0x28')](function(){return _0x535e01;});}else{return _0x535e01;}})['catch'](function(_0x21ddab){logger[_0xaf0d('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21ddab);});}return _0x535e01;});})[_0xaf0d('0x28')](respondWithResult(_0x59e5f8,0xc9))[_0xaf0d('0x49')](handleError(_0x59e5f8,null));};exports[_0xaf0d('0x29')]=function(_0x15112e,_0x50e4e6,_0x3d5585){var _0x50f239;return db['VoiceMusicOnHold'][_0xaf0d('0x4c')]({'where':{'id':_0x15112e[_0xaf0d('0x4e')]['id']}})[_0xaf0d('0x28')](function(_0x567faa){if(_0x567faa){return db[_0xaf0d('0x50')][_0xaf0d('0x51')](function(_0x1db59d){return _0x567faa[_0xaf0d('0x29')]({'transaction':_0x1db59d,'raw':!![]})['then'](function(_0x545847){if(_0x545847[_0xaf0d('0x54')]){fs[_0xaf0d('0x5e')](_0x545847[_0xaf0d('0x54')])['forEach'](function(_0x5081db){fs[_0xaf0d('0x5f')](path[_0xaf0d('0x55')](_0x545847[_0xaf0d('0x54')],_0x5081db));});fs[_0xaf0d('0x60')](_0x545847[_0xaf0d('0x54')]);}return _0x545847;});})[_0xaf0d('0x49')](function(_0x2aa26d){throw new db[(_0xaf0d('0x61'))]['ValidationError'](_0x2aa26d[_0xaf0d('0x62')]);});}})[_0xaf0d('0x28')](handleEntityNotFound(_0x50e4e6,null))[_0xaf0d('0x28')](removeEntity(_0x50e4e6,null))['catch'](handleError(_0x50e4e6,null));};exports[_0xaf0d('0x63')]=function(_0x4bf25a,_0x2ae265,_0x75f27){return db['sequelize'][_0xaf0d('0x51')](function(_0x416047){var _0x2897af;return db[_0xaf0d('0x32')][_0xaf0d('0x4c')]({'where':{'id':_0x4bf25a[_0xaf0d('0x4e')]['id']}})[_0xaf0d('0x28')](function(_0x1da659){if(_0x1da659){_0x2897af=_0x1da659;return _0x1da659[_0xaf0d('0x63')](_0x4bf25a[_0xaf0d('0x4d')]['id'],{'transaction':_0x416047});}})[_0xaf0d('0x28')](function(_0x16a484){if(_0x16a484){return db[_0xaf0d('0x64')]['findOne']({'where':{'id':_0x4bf25a[_0xaf0d('0x4d')]['id']},'attributes':['id',_0xaf0d('0x2e'),'save_name',_0xaf0d('0x65'),_0xaf0d('0x66')],'raw':!![]});}})['then'](function(_0x561141){if(_0x561141){var _0x4db8fb=path[_0xaf0d('0x55')](config[_0xaf0d('0x67')],'server/files/sounds/converted',util[_0xaf0d('0x68')](_0xaf0d('0x69'),path[_0xaf0d('0x6a')](_0x561141[_0xaf0d('0x6b')],path['extname'](_0x561141[_0xaf0d('0x6b')])),_0x561141[_0xaf0d('0x65')]));var _0x412c44=path[_0xaf0d('0x55')](config[_0xaf0d('0x67')],_0xaf0d('0x56'),_0x2897af[_0xaf0d('0x2e')],util['format'](_0xaf0d('0x69'),_0x561141[_0xaf0d('0x2e')],_0x561141[_0xaf0d('0x65')]));fs[_0xaf0d('0x6c')](_0x4db8fb,_0x412c44);return _0x561141;}})['catch'](function(_0x2e26f5){throw new db[(_0xaf0d('0x61'))][(_0xaf0d('0x6d'))](_0x2e26f5[_0xaf0d('0x62')]);});})['then'](handleEntityNotFound(_0x2ae265,null))[_0xaf0d('0x28')](respondWithResult(_0x2ae265,0xc9))[_0xaf0d('0x49')](handleError(_0x2ae265,null));};exports['removeSound']=function(_0x477d65,_0x3e0bfc,_0xf8f4e5){return db[_0xaf0d('0x50')][_0xaf0d('0x51')](function(_0x15c607){var _0x204052;return db['VoiceMusicOnHold'][_0xaf0d('0x6e')]({'where':{'id':_0x477d65[_0xaf0d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3e0bfc,null))[_0xaf0d('0x28')](function(_0x4d6a6a){if(_0x4d6a6a){_0x204052=_0x4d6a6a;return _0x4d6a6a[_0xaf0d('0x6f')](_0x477d65[_0xaf0d('0x4e')][_0xaf0d('0x70')]);}})[_0xaf0d('0x28')](function(_0x13dfde){if(_0x13dfde){return db[_0xaf0d('0x64')][_0xaf0d('0x6e')]({'where':{'id':_0x477d65['params']['id2']},'attributes':['id',_0xaf0d('0x2e'),_0xaf0d('0x6b'),_0xaf0d('0x65'),_0xaf0d('0x66')],'raw':!![]});}})[_0xaf0d('0x28')](function(_0x6d5181){if(_0x6d5181){fs['unlinkSync'](path[_0xaf0d('0x55')](_0x204052[_0xaf0d('0x54')],util[_0xaf0d('0x68')](_0xaf0d('0x69'),_0x6d5181[_0xaf0d('0x2e')],_0x6d5181[_0xaf0d('0x65')])));return _0x6d5181;}})['catch'](function(_0x58af82){throw new db[(_0xaf0d('0x61'))][(_0xaf0d('0x6d'))](_0x58af82['message']);});})[_0xaf0d('0x28')](handleEntityNotFound(_0x3e0bfc,null))[_0xaf0d('0x28')](respondWithStatusCode(_0x3e0bfc,0xcc))[_0xaf0d('0x49')](handleError(_0x3e0bfc,null));};exports[_0xaf0d('0x71')]=function(_0x4888e7,_0x2cd904,_0x2c757c){var _0x2971de={};var _0x334ddb={};var _0x21c348;var _0x79fb25;return db[_0xaf0d('0x32')][_0xaf0d('0x6e')]({'where':{'id':_0x4888e7[_0xaf0d('0x4e')]['id']}})[_0xaf0d('0x28')](handleEntityNotFound(_0x2cd904,null))['then'](function(_0x5cdcd5){if(_0x5cdcd5){_0x21c348=_0x5cdcd5;_0x334ddb[_0xaf0d('0x36')]=_[_0xaf0d('0x4b')](db[_0xaf0d('0x64')][_0xaf0d('0x33')]);_0x334ddb[_0xaf0d('0x37')]=_['keys'](_0x4888e7[_0xaf0d('0x37')]);_0x334ddb[_0xaf0d('0x38')]=_[_0xaf0d('0x39')](_0x334ddb[_0xaf0d('0x36')],_0x334ddb['query']);_0x2971de['attributes']=_[_0xaf0d('0x39')](_0x334ddb[_0xaf0d('0x36')],qs[_0xaf0d('0x3a')](_0x4888e7[_0xaf0d('0x37')][_0xaf0d('0x3a')]));_0x2971de[_0xaf0d('0x3b')]=_0x2971de[_0xaf0d('0x3b')][_0xaf0d('0x3c')]?_0x2971de[_0xaf0d('0x3b')]:_0x334ddb[_0xaf0d('0x36')];_0x2971de[_0xaf0d('0x72')]=qs[_0xaf0d('0x3f')](_0x4888e7[_0xaf0d('0x37')][_0xaf0d('0x3f')]);_0x2971de[_0xaf0d('0x40')]=qs[_0xaf0d('0x38')](_[_0xaf0d('0x73')](_0x4888e7[_0xaf0d('0x37')],_0x334ddb[_0xaf0d('0x38')]));if(_0x4888e7['query'][_0xaf0d('0x44')]){_0x2971de[_0xaf0d('0x40')]=_[_0xaf0d('0x41')](_0x2971de[_0xaf0d('0x40')],{'$or':_[_0xaf0d('0x31')](_0x2971de[_0xaf0d('0x3b')],function(_0x4fbc5c){var _0x5ef27b={};_0x5ef27b[_0x4fbc5c]={'$like':'%'+_0x4888e7['query'][_0xaf0d('0x44')]+'%'};return _0x5ef27b;})});}_0x2971de=_[_0xaf0d('0x41')]({},_0x2971de,_0x4888e7[_0xaf0d('0x45')]);return _0x21c348[_0xaf0d('0x71')](_0x2971de);}})[_0xaf0d('0x28')](function(_0x3af2d2){if(_0x3af2d2){_0x79fb25=_0x3af2d2[_0xaf0d('0x3c')];if(!_0x4888e7[_0xaf0d('0x37')][_0xaf0d('0x3d')](_0xaf0d('0x3e'))){_0x2971de['limit']=qs[_0xaf0d('0x22')](_0x4888e7[_0xaf0d('0x37')][_0xaf0d('0x22')]);_0x2971de[_0xaf0d('0x21')]=qs[_0xaf0d('0x21')](_0x4888e7['query']['offset']);}return _0x21c348[_0xaf0d('0x71')](_0x2971de);}})[_0xaf0d('0x28')](function(_0x10ee68){if(_0x10ee68){return _0x10ee68?{'count':_0x79fb25,'rows':_0x10ee68}:null;}})[_0xaf0d('0x28')](respondWithResult(_0x2cd904,null))[_0xaf0d('0x49')](handleError(_0x2cd904,null));}; \ No newline at end of file +var _0x1f1c=['converted_format','ValidationError','message','removeSound','findOne','id2','unlinkSync','getSounds','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','MusicOnHolds','error','stack','name','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','length','include','find','body','sequelize','transaction','mode','files','directory','root','server/files/moh','create','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','join','rmdirSync','Sequelize','addSound','Sound','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','extname'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x1f1c,0x7b));var _0xc1f1=function(_0xbf9981,_0x506e8f){_0xbf9981=_0xbf9981-0x0;var _0x48a084=_0x1f1c[_0xbf9981];return _0x48a084;};'use strict';var pdf=require(_0xc1f1('0x0'));var emlformat=require(_0xc1f1('0x1'));var rimraf=require(_0xc1f1('0x2'));var zipdir=require(_0xc1f1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1f1('0x4'));var moment=require(_0xc1f1('0x5'));var BPromise=require(_0xc1f1('0x6'));var Mustache=require(_0xc1f1('0x7'));var util=require(_0xc1f1('0x8'));var path=require(_0xc1f1('0x9'));var sox=require(_0xc1f1('0xa'));var csv=require(_0xc1f1('0xb'));var ejs=require(_0xc1f1('0xc'));var fs=require('fs');var _=require(_0xc1f1('0xd'));var squel=require(_0xc1f1('0xe'));var crypto=require(_0xc1f1('0xf'));var jsforce=require(_0xc1f1('0x10'));var deskjs=require(_0xc1f1('0x11'));var toCsv=require(_0xc1f1('0xb'));var querystring=require(_0xc1f1('0x12'));var Papa=require(_0xc1f1('0x13'));var Redis=require('ioredis');var authService=require(_0xc1f1('0x14'));var qs=require(_0xc1f1('0x15'));var as=require(_0xc1f1('0x16'));var hardwareService=require(_0xc1f1('0x17'));var logger=require(_0xc1f1('0x18'))('api');var utils=require(_0xc1f1('0x19'));var config=require(_0xc1f1('0x1a'));var licenseUtil=require(_0xc1f1('0x1b'));var db=require(_0xc1f1('0x1c'))['db'];function respondWithStatusCode(_0x37ea6d,_0x377382){_0x377382=_0x377382||0xcc;return function(_0x184698){if(_0x184698){return _0x37ea6d[_0xc1f1('0x1d')](_0x377382);}return _0x37ea6d[_0xc1f1('0x1e')](_0x377382)[_0xc1f1('0x1f')]();};}function respondWithResult(_0x2b8740,_0x275648){_0x275648=_0x275648||0xc8;return function(_0x2dbc59){if(_0x2dbc59){return _0x2b8740[_0xc1f1('0x1e')](_0x275648)['json'](_0x2dbc59);}};}function respondWithFilteredResult(_0x71c394,_0x1ed8fa){return function(_0x5137e6){if(_0x5137e6){var _0x4df25c=_0x5137e6[_0xc1f1('0x20')],_0xc2f979=_0x1ed8fa[_0xc1f1('0x21')],_0x355bb3=_0x1ed8fa['offset']+_0x1ed8fa['limit'],_0x372db3;if(_0x355bb3>=_0x4df25c){_0x355bb3=_0x4df25c;_0x372db3=0xc8;}else{_0x372db3=0xce;}_0x71c394[_0xc1f1('0x1e')](_0x372db3);return _0x71c394[_0xc1f1('0x22')](_0xc1f1('0x23'),_0xc2f979+'-'+_0x355bb3+'/'+_0x4df25c)['json'](_0x5137e6);}return null;};}function patchUpdates(_0x1801da){return function(_0x5a45ca){try{jsonpatch[_0xc1f1('0x24')](_0x5a45ca,_0x1801da,!![]);}catch(_0xdf03f2){return BPromise[_0xc1f1('0x25')](_0xdf03f2);}return _0x5a45ca[_0xc1f1('0x26')]();};}function saveUpdates(_0x3e9cdb,_0x41999b){return function(_0x3bf959){if(_0x3bf959){return _0x3bf959[_0xc1f1('0x27')](_0x3e9cdb)[_0xc1f1('0x28')](function(_0xc973bf){return _0xc973bf;});}return null;};}function removeEntity(_0x30335f,_0x1c71a8){return function(_0x538eb3){if(_0x538eb3){return _0x538eb3['destroy']()[_0xc1f1('0x28')](function(){var _0x35abd8=_0x538eb3['get']({'plain':!![]});var _0x55b519=_0xc1f1('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x55b519,'resourceId':_0x35abd8['id']}})[_0xc1f1('0x28')](function(){return _0x538eb3;});})[_0xc1f1('0x28')](function(){_0x30335f[_0xc1f1('0x1e')](0xcc)[_0xc1f1('0x1f')]();});}};}function handleEntityNotFound(_0x3452a5,_0x17d185){return function(_0x5cbae2){if(!_0x5cbae2){_0x3452a5[_0xc1f1('0x1d')](0x194);}return _0x5cbae2;};}function handleError(_0x21ea06,_0x57a093){_0x57a093=_0x57a093||0x1f4;return function(_0x411fe6){logger[_0xc1f1('0x2a')](_0x411fe6[_0xc1f1('0x2b')]);if(_0x411fe6[_0xc1f1('0x2c')]){delete _0x411fe6[_0xc1f1('0x2c')];}_0x21ea06[_0xc1f1('0x1e')](_0x57a093)['send'](_0x411fe6);};}exports[_0xc1f1('0x2d')]=function(_0x456642,_0x31f101){var _0xea5232={},_0x52841d={},_0x158388={'count':0x0,'rows':[]};var _0x2966f3=_['map'](db[_0xc1f1('0x2e')][_0xc1f1('0x2f')],function(_0x3565d2){return{'name':_0x3565d2[_0xc1f1('0x30')],'type':_0x3565d2[_0xc1f1('0x31')][_0xc1f1('0x32')]};});_0x52841d[_0xc1f1('0x33')]=_[_0xc1f1('0x34')](_0x2966f3,_0xc1f1('0x2c'));_0x52841d[_0xc1f1('0x35')]=_['keys'](_0x456642['query']);_0x52841d[_0xc1f1('0x36')]=_[_0xc1f1('0x37')](_0x52841d['model'],_0x52841d['query']);_0xea5232['attributes']=_['intersection'](_0x52841d['model'],qs[_0xc1f1('0x38')](_0x456642[_0xc1f1('0x35')]['fields']));_0xea5232[_0xc1f1('0x39')]=_0xea5232[_0xc1f1('0x39')]['length']?_0xea5232['attributes']:_0x52841d[_0xc1f1('0x33')];if(!_0x456642[_0xc1f1('0x35')][_0xc1f1('0x3a')](_0xc1f1('0x3b'))){_0xea5232[_0xc1f1('0x3c')]=qs[_0xc1f1('0x3c')](_0x456642[_0xc1f1('0x35')][_0xc1f1('0x3c')]);_0xea5232[_0xc1f1('0x21')]=qs[_0xc1f1('0x21')](_0x456642[_0xc1f1('0x35')][_0xc1f1('0x21')]);}_0xea5232[_0xc1f1('0x3d')]=qs['sort'](_0x456642[_0xc1f1('0x35')][_0xc1f1('0x3e')]);_0xea5232[_0xc1f1('0x3f')]=qs[_0xc1f1('0x36')](_['pick'](_0x456642['query'],_0x52841d['filters']),_0x2966f3);if(_0x456642[_0xc1f1('0x35')][_0xc1f1('0x40')]){_0xea5232[_0xc1f1('0x3f')]=_[_0xc1f1('0x41')](_0xea5232[_0xc1f1('0x3f')],{'$or':_['map'](_0x2966f3,function(_0xcbd984){if(_0xcbd984[_0xc1f1('0x31')]!==_0xc1f1('0x42')){var _0x3d5d02={};_0x3d5d02[_0xcbd984[_0xc1f1('0x2c')]]={'$like':'%'+_0x456642[_0xc1f1('0x35')]['filter']+'%'};return _0x3d5d02;}})});}_0xea5232=_[_0xc1f1('0x41')]({},_0xea5232,_0x456642[_0xc1f1('0x43')]);var _0x67a97b={'where':_0xea5232[_0xc1f1('0x3f')]};return db[_0xc1f1('0x2e')]['count'](_0x67a97b)[_0xc1f1('0x28')](function(_0x40550d){_0x158388['count']=_0x40550d;if(_0x456642['query'][_0xc1f1('0x44')]){_0xea5232['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0xea5232);})[_0xc1f1('0x28')](function(_0x446d64){_0x158388[_0xc1f1('0x45')]=_0x446d64;return _0x158388;})[_0xc1f1('0x28')](respondWithFilteredResult(_0x31f101,_0xea5232))[_0xc1f1('0x46')](handleError(_0x31f101,null));};exports[_0xc1f1('0x47')]=function(_0x57e9cb,_0x126aaf){var _0x20aae7={'raw':![],'where':{'id':_0x57e9cb[_0xc1f1('0x48')]['id']}},_0x50d195={};_0x50d195[_0xc1f1('0x33')]=_['keys'](db[_0xc1f1('0x2e')][_0xc1f1('0x2f')]);_0x50d195[_0xc1f1('0x35')]=_[_0xc1f1('0x49')](_0x57e9cb[_0xc1f1('0x35')]);_0x50d195['filters']=_['intersection'](_0x50d195[_0xc1f1('0x33')],_0x50d195['query']);_0x20aae7['attributes']=_[_0xc1f1('0x37')](_0x50d195[_0xc1f1('0x33')],qs['fields'](_0x57e9cb[_0xc1f1('0x35')][_0xc1f1('0x38')]));_0x20aae7[_0xc1f1('0x39')]=_0x20aae7[_0xc1f1('0x39')][_0xc1f1('0x4a')]?_0x20aae7[_0xc1f1('0x39')]:_0x50d195[_0xc1f1('0x33')];if(_0x57e9cb['query'][_0xc1f1('0x44')]){_0x20aae7[_0xc1f1('0x4b')]=[{'all':!![]}];}_0x20aae7=_[_0xc1f1('0x41')]({},_0x20aae7,_0x57e9cb[_0xc1f1('0x43')]);return db[_0xc1f1('0x2e')][_0xc1f1('0x4c')](_0x20aae7)[_0xc1f1('0x28')](handleEntityNotFound(_0x126aaf,null))['then'](respondWithResult(_0x126aaf,null))[_0xc1f1('0x46')](handleError(_0x126aaf,null));};exports[_0xc1f1('0x27')]=function(_0x3fad21,_0x2dfe90){if(_0x3fad21['body']['id']){delete _0x3fad21[_0xc1f1('0x4d')]['id'];}return db[_0xc1f1('0x2e')][_0xc1f1('0x4c')]({'where':{'id':_0x3fad21['params']['id']}})[_0xc1f1('0x28')](handleEntityNotFound(_0x2dfe90,null))[_0xc1f1('0x28')](saveUpdates(_0x3fad21[_0xc1f1('0x4d')],null))[_0xc1f1('0x28')](respondWithResult(_0x2dfe90,null))['catch'](handleError(_0x2dfe90,null));};exports['create']=function(_0x4070eb,_0x14d530,_0x2af381){return db[_0xc1f1('0x4e')][_0xc1f1('0x4f')](function(_0x48f361){if(_0x4070eb['body'][_0xc1f1('0x50')]===_0xc1f1('0x51')){_0x4070eb[_0xc1f1('0x4d')][_0xc1f1('0x52')]=path['join'](config[_0xc1f1('0x53')],_0xc1f1('0x54'),_0x4070eb[_0xc1f1('0x4d')][_0xc1f1('0x2c')]);}return db['VoiceMusicOnHold'][_0xc1f1('0x55')](_0x4070eb[_0xc1f1('0x4d')],{'transaction':_0x48f361})[_0xc1f1('0x28')](function(_0x2f0575){if(_0x4070eb[_0xc1f1('0x4d')][_0xc1f1('0x50')]==='files'){fs[_0xc1f1('0x56')](_0x2f0575[_0xc1f1('0x52')],parseInt(_0xc1f1('0x57'),0x8));}var _0x1813ce=_0x4070eb[_0xc1f1('0x58')][_0xc1f1('0x59')]({'plain':!![]});if(!_0x1813ce)throw new Error(_0xc1f1('0x5a'));if(_0x1813ce['role']==='user'){var _0x35b3ee=_0x2f0575['get']({'plain':!![]});return db['UserProfileSection'][_0xc1f1('0x4c')]({'where':{'name':_0xc1f1('0x29'),'userProfileId':_0x1813ce['userProfileId']},'raw':!![]})[_0xc1f1('0x28')](function(_0x571e8c){if(_0x571e8c&&_0x571e8c[_0xc1f1('0x5b')]===0x0){return db[_0xc1f1('0x5c')][_0xc1f1('0x55')]({'name':_0x35b3ee['name'],'resourceId':_0x35b3ee['id'],'type':_0x571e8c[_0xc1f1('0x2c')],'sectionId':_0x571e8c['id']},{})[_0xc1f1('0x28')](function(){return _0x2f0575;});}else{return _0x2f0575;}})[_0xc1f1('0x46')](function(_0x186a55){logger[_0xc1f1('0x2a')](_0xc1f1('0x5d'),_0x186a55);});}return _0x2f0575;});})[_0xc1f1('0x28')](respondWithResult(_0x14d530,0xc9))[_0xc1f1('0x46')](handleError(_0x14d530,null));};exports['destroy']=function(_0x7f736f,_0x42b0ec,_0x3b662e){var _0x29feb7;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x7f736f[_0xc1f1('0x48')]['id']}})['then'](function(_0x34a2af){if(_0x34a2af){return db['sequelize'][_0xc1f1('0x4f')](function(_0x5f30d3){return _0x34a2af['destroy']({'transaction':_0x5f30d3,'raw':!![]})['then'](function(_0x1de16b){if(_0x1de16b['directory']){fs['readdirSync'](_0x1de16b[_0xc1f1('0x52')])[_0xc1f1('0x5e')](function(_0xcc3ebc){fs['unlinkSync'](path[_0xc1f1('0x5f')](_0x1de16b[_0xc1f1('0x52')],_0xcc3ebc));});fs[_0xc1f1('0x60')](_0x1de16b[_0xc1f1('0x52')]);}return _0x1de16b;});})[_0xc1f1('0x46')](function(_0x397dd2){throw new db[(_0xc1f1('0x61'))]['ValidationError'](_0x397dd2['message']);});}})[_0xc1f1('0x28')](handleEntityNotFound(_0x42b0ec,null))[_0xc1f1('0x28')](removeEntity(_0x42b0ec,null))[_0xc1f1('0x46')](handleError(_0x42b0ec,null));};exports[_0xc1f1('0x62')]=function(_0x577824,_0x2942ff,_0x3fea2f){return db[_0xc1f1('0x4e')][_0xc1f1('0x4f')](function(_0x11ddd8){var _0x419a85;return db['VoiceMusicOnHold'][_0xc1f1('0x4c')]({'where':{'id':_0x577824[_0xc1f1('0x48')]['id']}})[_0xc1f1('0x28')](function(_0x53521c){if(_0x53521c){_0x419a85=_0x53521c;return _0x53521c[_0xc1f1('0x62')](_0x577824['body']['id'],{'transaction':_0x11ddd8});}})[_0xc1f1('0x28')](function(_0x4362a7){if(_0x4362a7){return db[_0xc1f1('0x63')]['findOne']({'where':{'id':_0x577824[_0xc1f1('0x4d')]['id']},'attributes':['id','name','save_name','converted_format',_0xc1f1('0x64')],'raw':!![]});}})[_0xc1f1('0x28')](function(_0x33831a){if(_0x33831a){var _0x455f1e=path[_0xc1f1('0x5f')](config[_0xc1f1('0x53')],_0xc1f1('0x65'),util[_0xc1f1('0x66')](_0xc1f1('0x67'),path[_0xc1f1('0x68')](_0x33831a[_0xc1f1('0x69')],path[_0xc1f1('0x6a')](_0x33831a[_0xc1f1('0x69')])),_0x33831a[_0xc1f1('0x6b')]));var _0x49755b=path[_0xc1f1('0x5f')](config[_0xc1f1('0x53')],_0xc1f1('0x54'),_0x419a85[_0xc1f1('0x2c')],util[_0xc1f1('0x66')](_0xc1f1('0x67'),_0x33831a['name'],_0x33831a['converted_format']));fs['symlinkSync'](_0x455f1e,_0x49755b);return _0x33831a;}})['catch'](function(_0x1d566b){throw new db[(_0xc1f1('0x61'))][(_0xc1f1('0x6c'))](_0x1d566b[_0xc1f1('0x6d')]);});})[_0xc1f1('0x28')](handleEntityNotFound(_0x2942ff,null))[_0xc1f1('0x28')](respondWithResult(_0x2942ff,0xc9))[_0xc1f1('0x46')](handleError(_0x2942ff,null));};exports[_0xc1f1('0x6e')]=function(_0x13f078,_0x1390e6,_0x4407c4){return db[_0xc1f1('0x4e')][_0xc1f1('0x4f')](function(_0x3b7143){var _0x36463f;return db['VoiceMusicOnHold'][_0xc1f1('0x6f')]({'where':{'id':_0x13f078['params']['id']}})[_0xc1f1('0x28')](handleEntityNotFound(_0x1390e6,null))['then'](function(_0x4e1ad0){if(_0x4e1ad0){_0x36463f=_0x4e1ad0;return _0x4e1ad0[_0xc1f1('0x6e')](_0x13f078[_0xc1f1('0x48')][_0xc1f1('0x70')]);}})[_0xc1f1('0x28')](function(_0x8c9e2a){if(_0x8c9e2a){return db[_0xc1f1('0x63')]['findOne']({'where':{'id':_0x13f078[_0xc1f1('0x48')][_0xc1f1('0x70')]},'attributes':['id',_0xc1f1('0x2c'),'save_name','converted_format',_0xc1f1('0x64')],'raw':!![]});}})['then'](function(_0x5183a1){if(_0x5183a1){fs[_0xc1f1('0x71')](path[_0xc1f1('0x5f')](_0x36463f[_0xc1f1('0x52')],util['format'](_0xc1f1('0x67'),_0x5183a1['name'],_0x5183a1['converted_format'])));return _0x5183a1;}})['catch'](function(_0x15552e){throw new db[(_0xc1f1('0x61'))][(_0xc1f1('0x6c'))](_0x15552e[_0xc1f1('0x6d')]);});})['then'](handleEntityNotFound(_0x1390e6,null))[_0xc1f1('0x28')](respondWithStatusCode(_0x1390e6,0xcc))['catch'](handleError(_0x1390e6,null));};exports[_0xc1f1('0x72')]=function(_0x42c720,_0x5efabb,_0x19ea51){var _0x3b05e4={};var _0x441cee={};var _0x4ca4c0;var _0x262e29;return db[_0xc1f1('0x2e')]['findOne']({'where':{'id':_0x42c720['params']['id']}})[_0xc1f1('0x28')](handleEntityNotFound(_0x5efabb,null))[_0xc1f1('0x28')](function(_0x266675){if(_0x266675){_0x4ca4c0=_0x266675;_0x441cee[_0xc1f1('0x33')]=_['keys'](db[_0xc1f1('0x63')][_0xc1f1('0x2f')]);_0x441cee[_0xc1f1('0x35')]=_[_0xc1f1('0x49')](_0x42c720[_0xc1f1('0x35')]);_0x441cee[_0xc1f1('0x36')]=_['intersection'](_0x441cee['model'],_0x441cee[_0xc1f1('0x35')]);_0x3b05e4[_0xc1f1('0x39')]=_[_0xc1f1('0x37')](_0x441cee[_0xc1f1('0x33')],qs[_0xc1f1('0x38')](_0x42c720[_0xc1f1('0x35')][_0xc1f1('0x38')]));_0x3b05e4[_0xc1f1('0x39')]=_0x3b05e4[_0xc1f1('0x39')]['length']?_0x3b05e4[_0xc1f1('0x39')]:_0x441cee[_0xc1f1('0x33')];_0x3b05e4['order']=qs['sort'](_0x42c720[_0xc1f1('0x35')][_0xc1f1('0x3e')]);_0x3b05e4[_0xc1f1('0x3f')]=qs['filters'](_['pick'](_0x42c720[_0xc1f1('0x35')],_0x441cee['filters']));if(_0x42c720[_0xc1f1('0x35')][_0xc1f1('0x40')]){_0x3b05e4[_0xc1f1('0x3f')]=_[_0xc1f1('0x41')](_0x3b05e4[_0xc1f1('0x3f')],{'$or':_[_0xc1f1('0x34')](_0x3b05e4[_0xc1f1('0x39')],function(_0x3ddf70){var _0x505c11={};_0x505c11[_0x3ddf70]={'$like':'%'+_0x42c720[_0xc1f1('0x35')][_0xc1f1('0x40')]+'%'};return _0x505c11;})});}_0x3b05e4=_[_0xc1f1('0x41')]({},_0x3b05e4,_0x42c720[_0xc1f1('0x43')]);return _0x4ca4c0[_0xc1f1('0x72')](_0x3b05e4);}})[_0xc1f1('0x28')](function(_0x184d2a){if(_0x184d2a){_0x262e29=_0x184d2a[_0xc1f1('0x4a')];if(!_0x42c720[_0xc1f1('0x35')][_0xc1f1('0x3a')](_0xc1f1('0x3b'))){_0x3b05e4[_0xc1f1('0x3c')]=qs[_0xc1f1('0x3c')](_0x42c720[_0xc1f1('0x35')]['limit']);_0x3b05e4[_0xc1f1('0x21')]=qs[_0xc1f1('0x21')](_0x42c720[_0xc1f1('0x35')][_0xc1f1('0x21')]);}return _0x4ca4c0[_0xc1f1('0x72')](_0x3b05e4);}})[_0xc1f1('0x28')](function(_0x115ec4){if(_0x115ec4){return _0x115ec4?{'count':_0x262e29,'rows':_0x115ec4}:null;}})[_0xc1f1('0x28')](respondWithResult(_0x5efabb,null))['catch'](handleError(_0x5efabb,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index fe41ddf..7c356e2 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 _0x709b=['path','rimraf','../../config/environment','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','moment'];(function(_0x334825,_0x1aaf12){var _0x17554b=function(_0x1a10c7){while(--_0x1a10c7){_0x334825['push'](_0x334825['shift']());}};_0x17554b(++_0x1aaf12);}(_0x709b,0xc3));var _0xb709=function(_0x41f603,_0x3835fb){_0x41f603=_0x41f603-0x0;var _0x1e6281=_0x709b[_0x41f603];return _0x1e6281;};'use strict';var _=require(_0xb709('0x0'));var util=require(_0xb709('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb709('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb709('0x3'));var rimraf=require(_0xb709('0x4'));var config=require(_0xb709('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x4765b5,_0x512dd0){return _0x4765b5[_0xb709('0x6')](_0xb709('0x7'),attributes,{'tableName':_0xb709('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccd4=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','bluebird'];(function(_0x5d5979,_0x3b4921){var _0x237182=function(_0xbd4df7){while(--_0xbd4df7){_0x5d5979['push'](_0x5d5979['shift']());}};_0x237182(++_0x3b4921);}(_0xccd4,0x8b));var _0x4ccd=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xccd4[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x4ccd('0x0'));var util=require(_0x4ccd('0x1'));var logger=require(_0x4ccd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4ccd('0x3'));var rp=require(_0x4ccd('0x4'));var fs=require('fs');var path=require(_0x4ccd('0x5'));var rimraf=require(_0x4ccd('0x6'));var config=require(_0x4ccd('0x7'));var attributes=require(_0x4ccd('0x8'));module[_0x4ccd('0x9')]=function(_0x1acd6c,_0x576df3){return _0x1acd6c[_0x4ccd('0xa')](_0x4ccd('0xb'),attributes,{'tableName':_0x4ccd('0xc'),'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 2a94231..7c61da2 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 _0x56a1=['../../mysqldb','rpc','jayson/promise','client','http','request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','util','moment','randomstring','ioredis'];(function(_0x133c5a,_0xc74e31){var _0x6f7cae=function(_0x87ae01){while(--_0x87ae01){_0x133c5a['push'](_0x133c5a['shift']());}};_0x6f7cae(++_0xc74e31);}(_0x56a1,0x1f4));var _0x156a=function(_0x264e1e,_0x3af804){_0x264e1e=_0x264e1e-0x0;var _0x4b1840=_0x56a1[_0x264e1e];return _0x4b1840;};'use strict';var _=require('lodash');var util=require(_0x156a('0x0'));var moment=require(_0x156a('0x1'));var BPromise=require('bluebird');var rs=require(_0x156a('0x2'));var fs=require('fs');var Redis=require(_0x156a('0x3'));var db=require(_0x156a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x156a('0x5'));var config=require('../../config/environment');var jayson=require(_0x156a('0x6'));var client=jayson[_0x156a('0x7')][_0x156a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x464269,_0x6a9298,_0x1646b1){return new BPromise(function(_0x56c384,_0x5e0198){return client[_0x156a('0x9')](_0x464269,_0x1646b1)[_0x156a('0xa')](function(_0x4b7abe){logger['info'](_0x156a('0xb'),_0x6a9298,_0x156a('0xc'));logger[_0x156a('0xd')](_0x156a('0xe'),_0x6a9298,_0x156a('0xc'),JSON['stringify'](_0x4b7abe));if(_0x4b7abe['error']){if(_0x4b7abe['error'][_0x156a('0xf')]===0x1f4){logger[_0x156a('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x6a9298,_0x4b7abe[_0x156a('0x10')][_0x156a('0x11')]);return _0x5e0198(_0x4b7abe[_0x156a('0x10')][_0x156a('0x11')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x6a9298,_0x4b7abe[_0x156a('0x10')][_0x156a('0x11')]);return _0x56c384(_0x4b7abe['error'][_0x156a('0x11')]);}else{logger[_0x156a('0x12')](_0x156a('0xb'),_0x6a9298,_0x156a('0xc'));_0x56c384(_0x4b7abe[_0x156a('0x13')][_0x156a('0x11')]);}})[_0x156a('0x14')](function(_0x281a3b){logger[_0x156a('0x10')](_0x156a('0xb'),_0x6a9298,_0x281a3b);_0x5e0198(_0x281a3b);});});} \ No newline at end of file +var _0x8899=['client','request','then','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment'];(function(_0x3e7aba,_0x27e08c){var _0x232c82=function(_0x63fee6){while(--_0x63fee6){_0x3e7aba['push'](_0x3e7aba['shift']());}};_0x232c82(++_0x27e08c);}(_0x8899,0x1c5));var _0x9889=function(_0x2c5a2a,_0x4e547b){_0x2c5a2a=_0x2c5a2a-0x0;var _0x5e1c82=_0x8899[_0x2c5a2a];return _0x5e1c82;};'use strict';var _=require(_0x9889('0x0'));var util=require(_0x9889('0x1'));var moment=require('moment');var BPromise=require(_0x9889('0x2'));var rs=require(_0x9889('0x3'));var fs=require('fs');var Redis=require(_0x9889('0x4'));var db=require(_0x9889('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9889('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9889('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51ad28,_0x599e04,_0x19496c){return new BPromise(function(_0x356a6b,_0x152d32){return client[_0x9889('0x8')](_0x51ad28,_0x19496c)[_0x9889('0x9')](function(_0x3ad5a8){logger['info'](_0x9889('0xa'),_0x599e04,'request\x20sent');logger[_0x9889('0xb')](_0x9889('0xc'),_0x599e04,_0x9889('0xd'),JSON[_0x9889('0xe')](_0x3ad5a8));if(_0x3ad5a8[_0x9889('0xf')]){if(_0x3ad5a8[_0x9889('0xf')][_0x9889('0x10')]===0x1f4){logger[_0x9889('0xf')](_0x9889('0xa'),_0x599e04,_0x3ad5a8[_0x9889('0xf')]['message']);return _0x152d32(_0x3ad5a8[_0x9889('0xf')][_0x9889('0x11')]);}logger['error'](_0x9889('0xa'),_0x599e04,_0x3ad5a8[_0x9889('0xf')]['message']);return _0x356a6b(_0x3ad5a8[_0x9889('0xf')][_0x9889('0x11')]);}else{logger['info'](_0x9889('0xa'),_0x599e04,_0x9889('0xd'));_0x356a6b(_0x3ad5a8[_0x9889('0x12')][_0x9889('0x11')]);}})[_0x9889('0x13')](function(_0x113366){logger[_0x9889('0xf')](_0x9889('0xa'),_0x599e04,_0x113366);_0x152d32(_0x113366);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index ce04663..aa1a527 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 _0xa45c=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','show','getAgents','create','addAgents','put','delete','destroy','/:id/users','removeAgents'];(function(_0x2f1089,_0x1ac63a){var _0x4f3a8b=function(_0x2e7380){while(--_0x2e7380){_0x2f1089['push'](_0x2f1089['shift']());}};_0x4f3a8b(++_0x1ac63a);}(_0xa45c,0x171));var _0xca45=function(_0x54bfd7,_0x4f8b0b){_0x54bfd7=_0x54bfd7-0x0;var _0x4cffeb=_0xa45c[_0x54bfd7];return _0x4cffeb;};'use strict';var multer=require('multer');var util=require(_0xca45('0x0'));var path=require(_0xca45('0x1'));var timeout=require(_0xca45('0x2'));var express=require('express');var router=express[_0xca45('0x3')]();var auth=require(_0xca45('0x4'));var interaction=require(_0xca45('0x5'));var config=require(_0xca45('0x6'));var controller=require(_0xca45('0x7'));router[_0xca45('0x8')]('/',auth[_0xca45('0x9')](),controller['index']);router[_0xca45('0x8')](_0xca45('0xa'),auth[_0xca45('0x9')](),controller[_0xca45('0xb')]);router[_0xca45('0x8')](_0xca45('0xc'),auth[_0xca45('0x9')](),controller[_0xca45('0xd')]);router[_0xca45('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xca45('0xe')]);router['post']('/',auth[_0xca45('0x9')](),controller[_0xca45('0xf')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xca45('0x10')]);router[_0xca45('0x11')](_0xca45('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xca45('0x12')](_0xca45('0xc'),auth['isAuthenticated'](),controller[_0xca45('0x13')]);router[_0xca45('0x12')](_0xca45('0x14'),auth[_0xca45('0x9')](),controller[_0xca45('0x15')]);module[_0xca45('0x16')]=router; \ No newline at end of file +var _0x048f=['exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','/:id','show','/:id/users','getAgents','post','addAgents','put','delete','destroy','removeAgents'];(function(_0x2eca35,_0xec16eb){var _0x27df00=function(_0x2ebc30){while(--_0x2ebc30){_0x2eca35['push'](_0x2eca35['shift']());}};_0x27df00(++_0xec16eb);}(_0x048f,0x1e4));var _0xf048=function(_0x30bda6,_0x57bfa4){_0x30bda6=_0x30bda6-0x0;var _0x417cca=_0x048f[_0x30bda6];return _0x417cca;};'use strict';var multer=require('multer');var util=require(_0xf048('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf048('0x1'));var router=express[_0xf048('0x2')]();var auth=require(_0xf048('0x3'));var interaction=require(_0xf048('0x4'));var config=require(_0xf048('0x5'));var controller=require(_0xf048('0x6'));router[_0xf048('0x7')]('/',auth[_0xf048('0x8')](),controller['index']);router['get']('/describe',auth[_0xf048('0x8')](),controller[_0xf048('0x9')]);router[_0xf048('0x7')](_0xf048('0xa'),auth['isAuthenticated'](),controller[_0xf048('0xb')]);router[_0xf048('0x7')](_0xf048('0xc'),auth[_0xf048('0x8')](),controller[_0xf048('0xd')]);router[_0xf048('0xe')]('/',auth[_0xf048('0x8')](),controller['create']);router[_0xf048('0xe')](_0xf048('0xc'),auth[_0xf048('0x8')](),controller[_0xf048('0xf')]);router[_0xf048('0x10')](_0xf048('0xa'),auth[_0xf048('0x8')](),controller['update']);router[_0xf048('0x11')](_0xf048('0xa'),auth[_0xf048('0x8')](),controller[_0xf048('0x12')]);router[_0xf048('0x11')](_0xf048('0xc'),auth['isAuthenticated'](),controller[_0xf048('0x13')]);module[_0xf048('0x14')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index d259c6d..d859a0f 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 _0xf7e7=['getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x36558f,_0x1a4f6f){var _0x5d888d=function(_0x16bbe3){while(--_0x16bbe3){_0x36558f['push'](_0x36558f['shift']());}};_0x5d888d(++_0x1a4f6f);}(_0xf7e7,0x182));var _0x7f7e=function(_0x437572,_0x25f10a){_0x437572=_0x437572-0x0;var _0x1f1851=_0xf7e7[_0x437572];return _0x1f1851;};'use strict';var Sequelize=require(_0x7f7e('0x0'));module[_0x7f7e('0x1')]={'name':{'type':Sequelize[_0x7f7e('0x2')],'allowNull':![],'unique':_0x7f7e('0x3')},'prefix':{'type':Sequelize[_0x7f7e('0x4')],'get':function(_0x41ff4f){return _0x7f7e('0x5')+this[_0x7f7e('0x6')](_0x7f7e('0x3'))+'-';}},'description':{'type':Sequelize[_0x7f7e('0x2')]},'callerIdAll':{'type':Sequelize[_0x7f7e('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x7f7e('0x7')]}}; \ No newline at end of file +var _0x0bb5=['sequelize','exports','VIRTUAL','system-','getDataValue','name','STRING','INTEGER'];(function(_0x36609a,_0x316990){var _0x1a7b26=function(_0x637a15){while(--_0x637a15){_0x36609a['push'](_0x36609a['shift']());}};_0x1a7b26(++_0x316990);}(_0x0bb5,0x148));var _0x50bb=function(_0x43d6ac,_0x32ebe4){_0x43d6ac=_0x43d6ac-0x0;var _0x2da928=_0x0bb5[_0x43d6ac];return _0x2da928;};'use strict';var Sequelize=require(_0x50bb('0x0'));module[_0x50bb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x50bb('0x2')],'get':function(_0x1aaa37){return _0x50bb('0x3')+this[_0x50bb('0x4')](_0x50bb('0x5'))+'-';}},'description':{'type':Sequelize[_0x50bb('0x6')]},'callerIdAll':{'type':Sequelize[_0x50bb('0x6')]},'VoiceExtensionId':{'type':Sequelize[_0x50bb('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 77ea22a..3e3d35e 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 _0xe626=['app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtensionId','VoicePrefixId','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','${EXTEN:','charAt','update','system-','sequelize','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','stack','index','rawAttributes','model','name','query','keys','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','map','type','merge','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','params','length','find','describe','create','transaction','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten'];(function(_0x24257,_0x42ae94){var _0x570f0b=function(_0x20493f){while(--_0x20493f){_0x24257['push'](_0x24257['shift']());}};_0x570f0b(++_0x42ae94);}(_0xe626,0x9d));var _0x6e62=function(_0x2f56db,_0x2ba32a){_0x2f56db=_0x2f56db-0x0;var _0x56f271=_0xe626[_0x2f56db];return _0x56f271;};'use strict';var pdf=require(_0x6e62('0x0'));var emlformat=require(_0x6e62('0x1'));var rimraf=require(_0x6e62('0x2'));var zipdir=require(_0x6e62('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e62('0x4'));var moment=require(_0x6e62('0x5'));var BPromise=require(_0x6e62('0x6'));var Mustache=require(_0x6e62('0x7'));var util=require(_0x6e62('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6e62('0x9'));var fs=require('fs');var _=require(_0x6e62('0xa'));var squel=require('squel');var crypto=require(_0x6e62('0xb'));var jsforce=require(_0x6e62('0xc'));var deskjs=require(_0x6e62('0xd'));var toCsv=require(_0x6e62('0xe'));var querystring=require('querystring');var Papa=require(_0x6e62('0xf'));var Redis=require(_0x6e62('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6e62('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e62('0x12'));var logger=require('../../config/logger')(_0x6e62('0x13'));var utils=require('../../config/utils');var config=require(_0x6e62('0x14'));var licenseUtil=require(_0x6e62('0x15'));var db=require(_0x6e62('0x16'))['db'];config[_0x6e62('0x17')]=_[_0x6e62('0x18')](config[_0x6e62('0x17')],{'host':_0x6e62('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6e62('0x1a'))[_0x6e62('0x1b')](socket);function respondWithStatusCode(_0x5328fe,_0x91facd){_0x91facd=_0x91facd||0xcc;return function(_0x40ec9d){if(_0x40ec9d){return _0x5328fe[_0x6e62('0x1c')](_0x91facd);}return _0x5328fe[_0x6e62('0x1d')](_0x91facd)['end']();};}function respondWithResult(_0x416158,_0x19deb1){_0x19deb1=_0x19deb1||0xc8;return function(_0x8aef1b){if(_0x8aef1b){return _0x416158[_0x6e62('0x1d')](_0x19deb1)[_0x6e62('0x1e')](_0x8aef1b);}};}function respondWithFilteredResult(_0x31b304,_0x42c2ea){return function(_0x45d7ee){if(_0x45d7ee){var _0x474e58=_0x45d7ee[_0x6e62('0x1f')],_0x15bce5=_0x42c2ea['offset'],_0x50c535=_0x42c2ea[_0x6e62('0x20')]+_0x42c2ea['limit'],_0x1f5ee7;if(_0x50c535>=_0x474e58){_0x50c535=_0x474e58;_0x1f5ee7=0xc8;}else{_0x1f5ee7=0xce;}_0x31b304[_0x6e62('0x1d')](_0x1f5ee7);return _0x31b304[_0x6e62('0x21')](_0x6e62('0x22'),_0x15bce5+'-'+_0x50c535+'/'+_0x474e58)[_0x6e62('0x1e')](_0x45d7ee);}return null;};}function patchUpdates(_0x2b6741){return function(_0x77c5f9){try{jsonpatch[_0x6e62('0x23')](_0x77c5f9,_0x2b6741,!![]);}catch(_0x263c47){return BPromise[_0x6e62('0x24')](_0x263c47);}return _0x77c5f9[_0x6e62('0x25')]();};}function saveUpdates(_0x1954dc,_0x4dc760){return function(_0x41821a){if(_0x41821a){return _0x41821a['update'](_0x1954dc)[_0x6e62('0x26')](function(_0x3dad96){return _0x3dad96;});}return null;};}function removeEntity(_0x345af8,_0x40d498){return function(_0x461eae){if(_0x461eae){return _0x461eae[_0x6e62('0x27')]()[_0x6e62('0x26')](function(){var _0x3a1683=_0x461eae[_0x6e62('0x28')]({'plain':!![]});var _0x448691='VoicePrefixes';return db[_0x6e62('0x29')]['destroy']({'where':{'type':_0x448691,'resourceId':_0x3a1683['id']}})[_0x6e62('0x26')](function(){return _0x461eae;});})[_0x6e62('0x26')](function(){_0x345af8[_0x6e62('0x1d')](0xcc)[_0x6e62('0x2a')]();});}};}function handleEntityNotFound(_0x3b7dfa,_0x3e7c90){return function(_0x4ecc45){if(!_0x4ecc45){_0x3b7dfa[_0x6e62('0x1c')](0x194);}return _0x4ecc45;};}function handleError(_0x26c991,_0x14cd51){_0x14cd51=_0x14cd51||0x1f4;return function(_0x50ba00){logger['error'](_0x50ba00[_0x6e62('0x2b')]);if(_0x50ba00['name']){delete _0x50ba00['name'];}_0x26c991['status'](_0x14cd51)['send'](_0x50ba00);};}exports[_0x6e62('0x2c')]=function(_0x4c6af1,_0x2d9172){var _0x5a8516={},_0x1dc29e={},_0x2fb5ce={'count':0x0,'rows':[]};var _0x2905d7=_['map'](db['VoicePrefix'][_0x6e62('0x2d')],function(_0xb8d42e){return{'name':_0xb8d42e['fieldName'],'type':_0xb8d42e['type']['key']};});_0x1dc29e[_0x6e62('0x2e')]=_['map'](_0x2905d7,_0x6e62('0x2f'));_0x1dc29e[_0x6e62('0x30')]=_[_0x6e62('0x31')](_0x4c6af1[_0x6e62('0x30')]);_0x1dc29e[_0x6e62('0x32')]=_['intersection'](_0x1dc29e['model'],_0x1dc29e[_0x6e62('0x30')]);_0x5a8516[_0x6e62('0x33')]=_[_0x6e62('0x34')](_0x1dc29e[_0x6e62('0x2e')],qs[_0x6e62('0x35')](_0x4c6af1[_0x6e62('0x30')][_0x6e62('0x35')]));_0x5a8516[_0x6e62('0x33')]=_0x5a8516[_0x6e62('0x33')]['length']?_0x5a8516[_0x6e62('0x33')]:_0x1dc29e[_0x6e62('0x2e')];if(!_0x4c6af1[_0x6e62('0x30')]['hasOwnProperty'](_0x6e62('0x36'))){_0x5a8516[_0x6e62('0x37')]=qs['limit'](_0x4c6af1[_0x6e62('0x30')][_0x6e62('0x37')]);_0x5a8516[_0x6e62('0x20')]=qs[_0x6e62('0x20')](_0x4c6af1[_0x6e62('0x30')]['offset']);}_0x5a8516[_0x6e62('0x38')]=qs[_0x6e62('0x39')](_0x4c6af1[_0x6e62('0x30')][_0x6e62('0x39')]);_0x5a8516[_0x6e62('0x3a')]=qs['filters'](_[_0x6e62('0x3b')](_0x4c6af1[_0x6e62('0x30')],_0x1dc29e[_0x6e62('0x32')]),_0x2905d7);if(_0x4c6af1['query'][_0x6e62('0x3c')]){_0x5a8516[_0x6e62('0x3a')]=_['merge'](_0x5a8516['where'],{'$or':_[_0x6e62('0x3d')](_0x2905d7,function(_0x1c2ee1){if(_0x1c2ee1[_0x6e62('0x3e')]!=='VIRTUAL'){var _0x5133a2={};_0x5133a2[_0x1c2ee1[_0x6e62('0x2f')]]={'$like':'%'+_0x4c6af1['query']['filter']+'%'};return _0x5133a2;}})});}_0x5a8516=_[_0x6e62('0x3f')]({},_0x5a8516,_0x4c6af1[_0x6e62('0x40')]);var _0xd07973={'where':_0x5a8516[_0x6e62('0x3a')]};return db[_0x6e62('0x41')]['count'](_0xd07973)[_0x6e62('0x26')](function(_0x4c5431){_0x2fb5ce['count']=_0x4c5431;if(_0x4c6af1[_0x6e62('0x30')][_0x6e62('0x42')]){_0x5a8516[_0x6e62('0x43')]=[{'all':!![]}];}return db['VoicePrefix'][_0x6e62('0x44')](_0x5a8516);})['then'](function(_0x28bf71){_0x2fb5ce[_0x6e62('0x45')]=_0x28bf71;return _0x2fb5ce;})[_0x6e62('0x26')](respondWithFilteredResult(_0x2d9172,_0x5a8516))[_0x6e62('0x46')](handleError(_0x2d9172,null));};exports[_0x6e62('0x47')]=function(_0x10c524,_0x228519){var _0x77b70={'raw':![],'where':{'id':_0x10c524[_0x6e62('0x48')]['id']}},_0x3888bf={};_0x3888bf['model']=_['keys'](db['VoicePrefix'][_0x6e62('0x2d')]);_0x3888bf['query']=_[_0x6e62('0x31')](_0x10c524[_0x6e62('0x30')]);_0x3888bf['filters']=_[_0x6e62('0x34')](_0x3888bf[_0x6e62('0x2e')],_0x3888bf[_0x6e62('0x30')]);_0x77b70[_0x6e62('0x33')]=_[_0x6e62('0x34')](_0x3888bf[_0x6e62('0x2e')],qs[_0x6e62('0x35')](_0x10c524[_0x6e62('0x30')][_0x6e62('0x35')]));_0x77b70[_0x6e62('0x33')]=_0x77b70[_0x6e62('0x33')][_0x6e62('0x49')]?_0x77b70[_0x6e62('0x33')]:_0x3888bf['model'];if(_0x10c524[_0x6e62('0x30')][_0x6e62('0x42')]){_0x77b70['include']=[{'all':!![]}];}_0x77b70=_[_0x6e62('0x3f')]({},_0x77b70,_0x10c524['options']);return db[_0x6e62('0x41')][_0x6e62('0x4a')](_0x77b70)[_0x6e62('0x26')](handleEntityNotFound(_0x228519,null))['then'](respondWithResult(_0x228519,null))[_0x6e62('0x46')](handleError(_0x228519,null));};exports[_0x6e62('0x27')]=function(_0x2d32f8,_0x212290){return db[_0x6e62('0x41')][_0x6e62('0x4a')]({'where':{'id':_0x2d32f8[_0x6e62('0x48')]['id']}})[_0x6e62('0x26')](handleEntityNotFound(_0x212290,null))[_0x6e62('0x26')](removeEntity(_0x212290,null))[_0x6e62('0x46')](handleError(_0x212290,null));};exports[_0x6e62('0x4b')]=function(_0x5613a0,_0x4a009d){return db[_0x6e62('0x41')][_0x6e62('0x4b')]()[_0x6e62('0x26')](respondWithResult(_0x4a009d,null))[_0x6e62('0x46')](handleError(_0x4a009d,null));};exports[_0x6e62('0x4c')]=function(_0x34108f,_0x5b474f){var _0x19a7e9;return db['sequelize'][_0x6e62('0x4d')](function(_0xead50c){return db[_0x6e62('0x41')][_0x6e62('0x4c')](_0x34108f[_0x6e62('0x4e')],{'transaction':_0xead50c})['then'](function(_0x353346){_0x19a7e9=_0x353346[_0x6e62('0x28')]({'plain':!![]});return db[_0x6e62('0x4f')][_0x6e62('0x4a')]({'where':{'id':_0x19a7e9['VoiceExtensionId']},'raw':!![]})[_0x6e62('0x26')](function(_0x479728){return createVoicePrefixExtensions(_0x19a7e9,_0x479728,_0xead50c);});});})[_0x6e62('0x26')](function(){var _0x213bf3=_0x34108f[_0x6e62('0x50')][_0x6e62('0x28')]({'plain':!![]});if(!_0x213bf3)throw new Error(_0x6e62('0x51'));if(_0x213bf3[_0x6e62('0x52')]===_0x6e62('0x50')){var _0x520ca5=_0x19a7e9;return db[_0x6e62('0x53')]['find']({'where':{'name':_0x6e62('0x54'),'userProfileId':_0x213bf3[_0x6e62('0x55')]},'raw':!![]})[_0x6e62('0x26')](function(_0x3d5b60){if(_0x3d5b60&&_0x3d5b60[_0x6e62('0x56')]===0x0){return db['UserProfileResource'][_0x6e62('0x4c')]({'name':_0x520ca5['name'],'resourceId':_0x520ca5['id'],'type':_0x3d5b60[_0x6e62('0x2f')],'sectionId':_0x3d5b60['id']},{})[_0x6e62('0x26')](function(){return _0x19a7e9;});}else{return _0x19a7e9;}})[_0x6e62('0x46')](function(_0x4e03e4){logger[_0x6e62('0x57')](_0x6e62('0x58'),_0x4e03e4);throw _0x4e03e4;});}return _0x19a7e9;})['then'](respondWithResult(_0x5b474f,null))[_0x6e62('0x46')](handleError(_0x5b474f,null));};function Extension(_0x56be92,_0x3de583,_0x5bf3ef,_0x1da279){this[_0x6e62('0x59')]='from-sip';this[_0x6e62('0x5a')]=_0x56be92;this[_0x6e62('0x5b')]=_0x5bf3ef;this['type']='system';this[_0x6e62('0x5c')]=_0x6e62('0x5d');this[_0x6e62('0x5e')]=_0x3de583;this[_0x6e62('0x5f')]=_0x1da279;}function createVoicePrefixExtensions(_0x171686,_0x1eb6e8,_0x21b99c){return new BPromise(function(_0x50bd9c,_0x932d39){var _0x10e546=new Extension(formatPrefixName(_0x171686[_0x6e62('0x60')]),0x1,_0x6e62('0x61'),_0x6e62('0x62'));_0x10e546['VoicePrefixId']=_0x171686['id'];return db[_0x6e62('0x4f')][_0x6e62('0x4c')](_0x10e546,{'transaction':_0x21b99c})['then'](function(_0x5aeefe){var _0x52803c=_0x5aeefe[_0x6e62('0x28')]({'plain':!![]});var _0x2656cd=_[_0x6e62('0x3d')](addVoicePrefixExtensions(_0x171686,_0x1eb6e8),function(_0x4d62d8){_0x4d62d8[_0x6e62('0x63')]=_0x52803c['id'];_0x4d62d8[_0x6e62('0x64')]=_0x171686['id'];return _0x4d62d8;});return db[_0x6e62('0x4f')]['bulkCreate'](_0x2656cd,{'transaction':_0x21b99c})[_0x6e62('0x26')](function(_0x2dc0a7){if(!_0x2dc0a7){return _0x932d39('Extensions\x20creation\x20failed');}else{return _0x50bd9c(_0x2dc0a7);}})[_0x6e62('0x46')](function(_0x5b5b66){return _0x932d39(_0x5b5b66);});});;});};function addVoicePrefixExtensions(_0x29b290,_0xb22e54){var _0xb465=[];var _0x5db78e=formatPrefixName(_0x29b290['prefix']);_0xb465[_0x6e62('0x65')](new Extension(_0x5db78e,0x2,_0x6e62('0x66'),_0x6e62('0x67')+_0x29b290[_0x6e62('0x2f')]));if(_0x29b290[_0x6e62('0x68')]){_0xb465[_0x6e62('0x65')](new Extension(_0x5db78e,0x3,_0x6e62('0x66'),_0x6e62('0x69')+_0x29b290['callerIdAll']));}else{_0xb465[_0x6e62('0x65')](new Extension(_0x5db78e,0x3,_0x6e62('0x61'),'No\x20callerid\x20available'));}_0xb465[_0x6e62('0x65')](new Extension(_0x5db78e,0x4,'goto',_0xb22e54[_0x6e62('0x59')]+','+_0x6e62('0x6a')+(0x8+_0x29b290[_0x6e62('0x2f')][_0x6e62('0x49')])+'}'+','+0x1));return _0xb465;}function formatPrefixName(_0x5bbea0){var _0x597a20='_';for(var _0x1c4c3c=0x0;_0x1c4c3c<_0x5bbea0[_0x6e62('0x49')];_0x1c4c3c++){if(_0x5bbea0[_0x6e62('0x6b')](_0x1c4c3c)=='-'){_0x597a20+=_0x5bbea0[_0x6e62('0x6b')](_0x1c4c3c);}else{_0x597a20+='['+_0x5bbea0[_0x6e62('0x6b')](_0x1c4c3c)+']';}}_0x597a20+='.';return _0x597a20;}exports[_0x6e62('0x6c')]=function(_0x46bbff,_0x3b5d98,_0x5dfadc){var _0x1785bc=_0x46bbff[_0x6e62('0x4e')];_0x1785bc[_0x6e62('0x60')]=_0x6e62('0x6d')+_0x1785bc[_0x6e62('0x2f')]+'-';return db[_0x6e62('0x6e')][_0x6e62('0x4d')](function(_0x37816e){return db[_0x6e62('0x41')]['update'](_0x1785bc,{'where':{'id':_0x1785bc['id']},'transaction':_0x37816e})[_0x6e62('0x26')](function(){return db[_0x6e62('0x4f')][_0x6e62('0x27')]({'where':{'VoicePrefixId':_0x1785bc['id']},'transaction':_0x37816e})[_0x6e62('0x26')](function(){return db[_0x6e62('0x4f')][_0x6e62('0x4a')]({'where':{'id':_0x1785bc[_0x6e62('0x63')]},'raw':!![]})[_0x6e62('0x26')](function(_0x10ffe9){return createVoicePrefixExtensions(_0x1785bc,_0x10ffe9,_0x37816e);});});});})[_0x6e62('0x26')](function(){return db[_0x6e62('0x41')][_0x6e62('0x6f')](_0x1785bc['id']);})[_0x6e62('0x26')](respondWithResult(_0x3b5d98,null))[_0x6e62('0x46')](handleError(_0x3b5d98,null));};exports[_0x6e62('0x70')]=function(_0x242a62,_0x416ab1,_0x502eca){return db[_0x6e62('0x41')][_0x6e62('0x4a')]({'where':{'id':_0x242a62[_0x6e62('0x48')]['id']}})[_0x6e62('0x26')](handleEntityNotFound(_0x416ab1,null))['then'](function(_0x66aa19){if(_0x66aa19){return _0x66aa19[_0x6e62('0x70')](_0x242a62[_0x6e62('0x4e')]['ids'],_[_0x6e62('0x71')](_0x242a62[_0x6e62('0x4e')],[_0x6e62('0x72'),'id'])||{})[_0x6e62('0x73')](function(_0x5944e4){for(var _0x6a2c3a=0x0;_0x6a2c3a<_0x242a62[_0x6e62('0x4e')][_0x6e62('0x72')][_0x6e62('0x49')];_0x6a2c3a+=0x1){socket[_0x6e62('0x74')](_0x6e62('0x75'),{'UserId':_0x242a62[_0x6e62('0x4e')][_0x6e62('0x72')][_0x6a2c3a],'VoicePrefixId':_0x242a62[_0x6e62('0x48')]['id']});}return _0x5944e4;});}})[_0x6e62('0x26')](respondWithResult(_0x416ab1,null))[_0x6e62('0x46')](handleError(_0x416ab1,null));};exports[_0x6e62('0x76')]=function(_0x1cd07e,_0x1c65ff,_0x5132be){return db[_0x6e62('0x41')][_0x6e62('0x4a')]({'where':{'id':_0x1cd07e[_0x6e62('0x48')]['id']}})[_0x6e62('0x26')](handleEntityNotFound(_0x1c65ff,null))[_0x6e62('0x26')](function(_0x26a242){if(_0x26a242){return _0x26a242[_0x6e62('0x76')](_0x1cd07e[_0x6e62('0x30')]['ids'])[_0x6e62('0x26')](function(){if(_[_0x6e62('0x77')](_0x1cd07e[_0x6e62('0x30')][_0x6e62('0x72')])){for(var _0x1f91fe=0x0;_0x1f91fe<_0x1cd07e[_0x6e62('0x30')][_0x6e62('0x72')]['length'];_0x1f91fe+=0x1){socket[_0x6e62('0x74')](_0x6e62('0x78'),{'UserId':Number(_0x1cd07e[_0x6e62('0x30')][_0x6e62('0x72')][_0x1f91fe]),'VoicePrefixId':Number(_0x1cd07e[_0x6e62('0x48')]['id'])});}}else{socket[_0x6e62('0x74')](_0x6e62('0x78'),{'UserId':Number(_0x1cd07e[_0x6e62('0x30')][_0x6e62('0x72')]),'VoicePrefixId':Number(_0x1cd07e[_0x6e62('0x48')]['id'])});}});}})[_0x6e62('0x26')](respondWithStatusCode(_0x1c65ff,null))[_0x6e62('0x46')](handleError(_0x1c65ff,null));};exports[_0x6e62('0x79')]=function(_0xa7fd55,_0x3b5371,_0x318ffa){var _0x4577c0={};var _0x46f419={};var _0x4cfd7b;var _0x349d64;return db[_0x6e62('0x41')][_0x6e62('0x7a')]({'where':{'id':_0xa7fd55[_0x6e62('0x48')]['id']}})[_0x6e62('0x26')](handleEntityNotFound(_0x3b5371,null))[_0x6e62('0x26')](function(_0x494bb4){if(_0x494bb4){_0x4cfd7b=_0x494bb4;_0x46f419[_0x6e62('0x2e')]=_[_0x6e62('0x31')](db['User'][_0x6e62('0x2d')]);_0x46f419['query']=_['keys'](_0xa7fd55[_0x6e62('0x30')]);_0x46f419[_0x6e62('0x32')]=_[_0x6e62('0x34')](_0x46f419[_0x6e62('0x2e')],_0x46f419['query']);_0x4577c0[_0x6e62('0x33')]=_[_0x6e62('0x34')](_0x46f419[_0x6e62('0x2e')],qs[_0x6e62('0x35')](_0xa7fd55['query'][_0x6e62('0x35')]));_0x4577c0[_0x6e62('0x33')]=_0x4577c0[_0x6e62('0x33')]['length']?_0x4577c0[_0x6e62('0x33')]:_0x46f419['model'];_0x4577c0['order']=qs[_0x6e62('0x39')](_0xa7fd55[_0x6e62('0x30')][_0x6e62('0x39')]);_0x4577c0['where']=qs['filters'](_[_0x6e62('0x3b')](_0xa7fd55[_0x6e62('0x30')],_0x46f419[_0x6e62('0x32')]));if(_0xa7fd55[_0x6e62('0x30')][_0x6e62('0x3c')]){_0x4577c0['where']=_[_0x6e62('0x3f')](_0x4577c0[_0x6e62('0x3a')],{'$or':_[_0x6e62('0x3d')](_0x4577c0[_0x6e62('0x33')],function(_0x5cc806){var _0x48e7b7={};_0x48e7b7[_0x5cc806]={'$like':'%'+_0xa7fd55[_0x6e62('0x30')][_0x6e62('0x3c')]+'%'};return _0x48e7b7;})});}_0x4577c0=_['merge']({},_0x4577c0,_0xa7fd55['options']);return _0x4cfd7b[_0x6e62('0x79')](_0x4577c0);}})[_0x6e62('0x26')](function(_0x346cd6){if(_0x346cd6){_0x349d64=_0x346cd6[_0x6e62('0x49')];if(!_0xa7fd55[_0x6e62('0x30')][_0x6e62('0x7b')](_0x6e62('0x36'))){_0x4577c0[_0x6e62('0x37')]=qs[_0x6e62('0x37')](_0xa7fd55['query'][_0x6e62('0x37')]);_0x4577c0[_0x6e62('0x20')]=qs[_0x6e62('0x20')](_0xa7fd55['query'][_0x6e62('0x20')]);}return _0x4cfd7b['getAgents'](_0x4577c0);}})[_0x6e62('0x26')](function(_0x258314){if(_0x258314){return _0x258314?{'count':_0x349d64,'rows':_0x258314}:null;}})['then'](respondWithResult(_0x3b5371,null))[_0x6e62('0x46')](handleError(_0x3b5371,null));}; \ No newline at end of file +var _0x2c8f=['system','description','priority','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','prefix','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','push','No\x20callerid\x20available','goto','charAt','system-','findById','omit','ids','spread','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','findOne','User','getAgents','eml-format','request-promise','moment','bluebird','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/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','VoicePrefixes','UserProfileResource','then','name','send','index','map','VoicePrefix','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','catch','describe','create','sequelize','transaction','body','VoiceExtension','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app'];(function(_0x1fd5e2,_0x2d517a){var _0x4ecfc6=function(_0x3832e4){while(--_0x3832e4){_0x1fd5e2['push'](_0x1fd5e2['shift']());}};_0x4ecfc6(++_0x2d517a);}(_0x2c8f,0x192));var _0xf2c8=function(_0x11697b,_0x29eb50){_0x11697b=_0x11697b-0x0;var _0x196518=_0x2c8f[_0x11697b];return _0x196518;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf2c8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf2c8('0x1'));var moment=require(_0xf2c8('0x2'));var BPromise=require(_0xf2c8('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf2c8('0x4'));var sox=require(_0xf2c8('0x5'));var csv=require(_0xf2c8('0x6'));var ejs=require(_0xf2c8('0x7'));var fs=require('fs');var _=require(_0xf2c8('0x8'));var squel=require('squel');var crypto=require(_0xf2c8('0x9'));var jsforce=require(_0xf2c8('0xa'));var deskjs=require(_0xf2c8('0xb'));var toCsv=require(_0xf2c8('0x6'));var querystring=require(_0xf2c8('0xc'));var Papa=require(_0xf2c8('0xd'));var Redis=require('ioredis');var authService=require(_0xf2c8('0xe'));var qs=require(_0xf2c8('0xf'));var as=require(_0xf2c8('0x10'));var hardwareService=require(_0xf2c8('0x11'));var logger=require(_0xf2c8('0x12'))(_0xf2c8('0x13'));var utils=require(_0xf2c8('0x14'));var config=require(_0xf2c8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf2c8('0x16'))['db'];config['redis']=_[_0xf2c8('0x17')](config[_0xf2c8('0x18')],{'host':_0xf2c8('0x19'),'port':0x18eb});var socket=require(_0xf2c8('0x1a'))(new Redis(config[_0xf2c8('0x18')]));require(_0xf2c8('0x1b'))['register'](socket);function respondWithStatusCode(_0x3b86f0,_0x165f5f){_0x165f5f=_0x165f5f||0xcc;return function(_0x9152f1){if(_0x9152f1){return _0x3b86f0[_0xf2c8('0x1c')](_0x165f5f);}return _0x3b86f0[_0xf2c8('0x1d')](_0x165f5f)[_0xf2c8('0x1e')]();};}function respondWithResult(_0x1b8c5b,_0x5f37ba){_0x5f37ba=_0x5f37ba||0xc8;return function(_0x282094){if(_0x282094){return _0x1b8c5b[_0xf2c8('0x1d')](_0x5f37ba)[_0xf2c8('0x1f')](_0x282094);}};}function respondWithFilteredResult(_0x31b8e0,_0xe1ec71){return function(_0x52e9d0){if(_0x52e9d0){var _0x49a07c=_0x52e9d0[_0xf2c8('0x20')],_0x104d9d=_0xe1ec71['offset'],_0x290953=_0xe1ec71[_0xf2c8('0x21')]+_0xe1ec71[_0xf2c8('0x22')],_0x2c6d7a;if(_0x290953>=_0x49a07c){_0x290953=_0x49a07c;_0x2c6d7a=0xc8;}else{_0x2c6d7a=0xce;}_0x31b8e0[_0xf2c8('0x1d')](_0x2c6d7a);return _0x31b8e0['set'](_0xf2c8('0x23'),_0x104d9d+'-'+_0x290953+'/'+_0x49a07c)[_0xf2c8('0x1f')](_0x52e9d0);}return null;};}function patchUpdates(_0x533375){return function(_0x5b1e44){try{jsonpatch[_0xf2c8('0x24')](_0x5b1e44,_0x533375,!![]);}catch(_0x3e7ceb){return BPromise[_0xf2c8('0x25')](_0x3e7ceb);}return _0x5b1e44['save']();};}function saveUpdates(_0xd2e728,_0x43763e){return function(_0x24e756){if(_0x24e756){return _0x24e756[_0xf2c8('0x26')](_0xd2e728)['then'](function(_0x17956f){return _0x17956f;});}return null;};}function removeEntity(_0xe5ff6c,_0x20e994){return function(_0x440b41){if(_0x440b41){return _0x440b41[_0xf2c8('0x27')]()['then'](function(){var _0x93707c=_0x440b41['get']({'plain':!![]});var _0x3cd344=_0xf2c8('0x28');return db[_0xf2c8('0x29')][_0xf2c8('0x27')]({'where':{'type':_0x3cd344,'resourceId':_0x93707c['id']}})[_0xf2c8('0x2a')](function(){return _0x440b41;});})[_0xf2c8('0x2a')](function(){_0xe5ff6c[_0xf2c8('0x1d')](0xcc)[_0xf2c8('0x1e')]();});}};}function handleEntityNotFound(_0x33f1b0,_0xcf5239){return function(_0xf17065){if(!_0xf17065){_0x33f1b0[_0xf2c8('0x1c')](0x194);}return _0xf17065;};}function handleError(_0x311349,_0x4e12a2){_0x4e12a2=_0x4e12a2||0x1f4;return function(_0x1cb979){logger['error'](_0x1cb979['stack']);if(_0x1cb979[_0xf2c8('0x2b')]){delete _0x1cb979['name'];}_0x311349[_0xf2c8('0x1d')](_0x4e12a2)[_0xf2c8('0x2c')](_0x1cb979);};}exports[_0xf2c8('0x2d')]=function(_0x10c825,_0x123b45){var _0x12a547={},_0x27a7dc={},_0x55ded9={'count':0x0,'rows':[]};var _0x27c02e=_[_0xf2c8('0x2e')](db[_0xf2c8('0x2f')][_0xf2c8('0x30')],function(_0x18ed3f){return{'name':_0x18ed3f[_0xf2c8('0x31')],'type':_0x18ed3f['type'][_0xf2c8('0x32')]};});_0x27a7dc['model']=_[_0xf2c8('0x2e')](_0x27c02e,'name');_0x27a7dc[_0xf2c8('0x33')]=_[_0xf2c8('0x34')](_0x10c825[_0xf2c8('0x33')]);_0x27a7dc[_0xf2c8('0x35')]=_[_0xf2c8('0x36')](_0x27a7dc['model'],_0x27a7dc[_0xf2c8('0x33')]);_0x12a547[_0xf2c8('0x37')]=_['intersection'](_0x27a7dc[_0xf2c8('0x38')],qs[_0xf2c8('0x39')](_0x10c825['query'][_0xf2c8('0x39')]));_0x12a547[_0xf2c8('0x37')]=_0x12a547[_0xf2c8('0x37')][_0xf2c8('0x3a')]?_0x12a547[_0xf2c8('0x37')]:_0x27a7dc['model'];if(!_0x10c825['query'][_0xf2c8('0x3b')](_0xf2c8('0x3c'))){_0x12a547[_0xf2c8('0x22')]=qs[_0xf2c8('0x22')](_0x10c825[_0xf2c8('0x33')][_0xf2c8('0x22')]);_0x12a547[_0xf2c8('0x21')]=qs[_0xf2c8('0x21')](_0x10c825['query'][_0xf2c8('0x21')]);}_0x12a547[_0xf2c8('0x3d')]=qs[_0xf2c8('0x3e')](_0x10c825['query']['sort']);_0x12a547['where']=qs['filters'](_[_0xf2c8('0x3f')](_0x10c825['query'],_0x27a7dc[_0xf2c8('0x35')]),_0x27c02e);if(_0x10c825['query'][_0xf2c8('0x40')]){_0x12a547['where']=_['merge'](_0x12a547[_0xf2c8('0x41')],{'$or':_[_0xf2c8('0x2e')](_0x27c02e,function(_0x49782c){if(_0x49782c[_0xf2c8('0x42')]!==_0xf2c8('0x43')){var _0x5e496c={};_0x5e496c[_0x49782c[_0xf2c8('0x2b')]]={'$like':'%'+_0x10c825[_0xf2c8('0x33')][_0xf2c8('0x40')]+'%'};return _0x5e496c;}})});}_0x12a547=_[_0xf2c8('0x44')]({},_0x12a547,_0x10c825[_0xf2c8('0x45')]);var _0x1cd9b9={'where':_0x12a547['where']};return db['VoicePrefix'][_0xf2c8('0x20')](_0x1cd9b9)['then'](function(_0x1a27c8){_0x55ded9['count']=_0x1a27c8;if(_0x10c825[_0xf2c8('0x33')]['includeAll']){_0x12a547[_0xf2c8('0x46')]=[{'all':!![]}];}return db[_0xf2c8('0x2f')][_0xf2c8('0x47')](_0x12a547);})[_0xf2c8('0x2a')](function(_0x4d5601){_0x55ded9[_0xf2c8('0x48')]=_0x4d5601;return _0x55ded9;})[_0xf2c8('0x2a')](respondWithFilteredResult(_0x123b45,_0x12a547))['catch'](handleError(_0x123b45,null));};exports[_0xf2c8('0x49')]=function(_0xa68854,_0x262a83){var _0x25caf3={'raw':![],'where':{'id':_0xa68854[_0xf2c8('0x4a')]['id']}},_0x41dfcb={};_0x41dfcb[_0xf2c8('0x38')]=_['keys'](db[_0xf2c8('0x2f')][_0xf2c8('0x30')]);_0x41dfcb[_0xf2c8('0x33')]=_[_0xf2c8('0x34')](_0xa68854['query']);_0x41dfcb['filters']=_[_0xf2c8('0x36')](_0x41dfcb[_0xf2c8('0x38')],_0x41dfcb[_0xf2c8('0x33')]);_0x25caf3['attributes']=_[_0xf2c8('0x36')](_0x41dfcb[_0xf2c8('0x38')],qs['fields'](_0xa68854['query'][_0xf2c8('0x39')]));_0x25caf3[_0xf2c8('0x37')]=_0x25caf3[_0xf2c8('0x37')][_0xf2c8('0x3a')]?_0x25caf3['attributes']:_0x41dfcb[_0xf2c8('0x38')];if(_0xa68854[_0xf2c8('0x33')][_0xf2c8('0x4b')]){_0x25caf3['include']=[{'all':!![]}];}_0x25caf3=_[_0xf2c8('0x44')]({},_0x25caf3,_0xa68854[_0xf2c8('0x45')]);return db[_0xf2c8('0x2f')]['find'](_0x25caf3)[_0xf2c8('0x2a')](handleEntityNotFound(_0x262a83,null))[_0xf2c8('0x2a')](respondWithResult(_0x262a83,null))[_0xf2c8('0x4c')](handleError(_0x262a83,null));};exports[_0xf2c8('0x27')]=function(_0x143cd0,_0x5d2c18){return db[_0xf2c8('0x2f')]['find']({'where':{'id':_0x143cd0['params']['id']}})[_0xf2c8('0x2a')](handleEntityNotFound(_0x5d2c18,null))[_0xf2c8('0x2a')](removeEntity(_0x5d2c18,null))[_0xf2c8('0x4c')](handleError(_0x5d2c18,null));};exports[_0xf2c8('0x4d')]=function(_0x286e1a,_0x47fec0){return db[_0xf2c8('0x2f')][_0xf2c8('0x4d')]()[_0xf2c8('0x2a')](respondWithResult(_0x47fec0,null))[_0xf2c8('0x4c')](handleError(_0x47fec0,null));};exports[_0xf2c8('0x4e')]=function(_0x35a20b,_0x5c9381){var _0x53f6ee;return db[_0xf2c8('0x4f')][_0xf2c8('0x50')](function(_0x372296){return db[_0xf2c8('0x2f')][_0xf2c8('0x4e')](_0x35a20b[_0xf2c8('0x51')],{'transaction':_0x372296})[_0xf2c8('0x2a')](function(_0x1e260c){_0x53f6ee=_0x1e260c['get']({'plain':!![]});return db[_0xf2c8('0x52')][_0xf2c8('0x53')]({'where':{'id':_0x53f6ee['VoiceExtensionId']},'raw':!![]})['then'](function(_0x155fdb){return createVoicePrefixExtensions(_0x53f6ee,_0x155fdb,_0x372296);});});})[_0xf2c8('0x2a')](function(){var _0x5ac17d=_0x35a20b[_0xf2c8('0x54')][_0xf2c8('0x55')]({'plain':!![]});if(!_0x5ac17d)throw new Error(_0xf2c8('0x56'));if(_0x5ac17d['role']===_0xf2c8('0x54')){var _0x34cfc4=_0x53f6ee;return db[_0xf2c8('0x57')][_0xf2c8('0x53')]({'where':{'name':_0xf2c8('0x28'),'userProfileId':_0x5ac17d[_0xf2c8('0x58')]},'raw':!![]})[_0xf2c8('0x2a')](function(_0x1b74e2){if(_0x1b74e2&&_0x1b74e2['autoAssociation']===0x0){return db[_0xf2c8('0x29')][_0xf2c8('0x4e')]({'name':_0x34cfc4[_0xf2c8('0x2b')],'resourceId':_0x34cfc4['id'],'type':_0x1b74e2['name'],'sectionId':_0x1b74e2['id']},{})['then'](function(){return _0x53f6ee;});}else{return _0x53f6ee;}})[_0xf2c8('0x4c')](function(_0x266726){logger['error'](_0xf2c8('0x59'),_0x266726);throw _0x266726;});}return _0x53f6ee;})['then'](respondWithResult(_0x5c9381,null))['catch'](handleError(_0x5c9381,null));};function Extension(_0x33cf49,_0x22a1c1,_0x48741f,_0x201699){this[_0xf2c8('0x5a')]=_0xf2c8('0x5b');this[_0xf2c8('0x5c')]=_0x33cf49;this[_0xf2c8('0x5d')]=_0x48741f;this['type']=_0xf2c8('0x5e');this[_0xf2c8('0x5f')]='Voice\x20Prefix\x20Extension';this[_0xf2c8('0x60')]=_0x22a1c1;this['appdata']=_0x201699;}function createVoicePrefixExtensions(_0x22ad3d,_0x184c25,_0x31408f){return new BPromise(function(_0xfb5353,_0x387497){var _0x21b885=new Extension(formatPrefixName(_0x22ad3d['prefix']),0x1,_0xf2c8('0x61'),_0xf2c8('0x62'));_0x21b885[_0xf2c8('0x63')]=_0x22ad3d['id'];return db[_0xf2c8('0x52')][_0xf2c8('0x4e')](_0x21b885,{'transaction':_0x31408f})['then'](function(_0x2d5c32){var _0x4335cc=_0x2d5c32[_0xf2c8('0x55')]({'plain':!![]});var _0xea023d=_['map'](addVoicePrefixExtensions(_0x22ad3d,_0x184c25),function(_0x191174){_0x191174[_0xf2c8('0x64')]=_0x4335cc['id'];_0x191174[_0xf2c8('0x63')]=_0x22ad3d['id'];return _0x191174;});return db[_0xf2c8('0x52')][_0xf2c8('0x65')](_0xea023d,{'transaction':_0x31408f})[_0xf2c8('0x2a')](function(_0x1bcaa0){if(!_0x1bcaa0){return _0x387497(_0xf2c8('0x66'));}else{return _0xfb5353(_0x1bcaa0);}})[_0xf2c8('0x4c')](function(_0x4f13fe){return _0x387497(_0x4f13fe);});});;});};function addVoicePrefixExtensions(_0x1959fd,_0x117bac){var _0x4afe9b=[];var _0xdbf069=formatPrefixName(_0x1959fd[_0xf2c8('0x67')]);_0x4afe9b['push'](new Extension(_0xdbf069,0x2,_0xf2c8('0x68'),_0xf2c8('0x69')+_0x1959fd[_0xf2c8('0x2b')]));if(_0x1959fd[_0xf2c8('0x6a')]){_0x4afe9b['push'](new Extension(_0xdbf069,0x3,'Set',_0xf2c8('0x6b')+_0x1959fd['callerIdAll']));}else{_0x4afe9b[_0xf2c8('0x6c')](new Extension(_0xdbf069,0x3,_0xf2c8('0x61'),_0xf2c8('0x6d')));}_0x4afe9b[_0xf2c8('0x6c')](new Extension(_0xdbf069,0x4,_0xf2c8('0x6e'),_0x117bac[_0xf2c8('0x5a')]+','+'${EXTEN:'+(0x8+_0x1959fd[_0xf2c8('0x2b')][_0xf2c8('0x3a')])+'}'+','+0x1));return _0x4afe9b;}function formatPrefixName(_0x4dcfd0){var _0x3fc45d='_';for(var _0x21b71b=0x0;_0x21b71b<_0x4dcfd0['length'];_0x21b71b++){if(_0x4dcfd0[_0xf2c8('0x6f')](_0x21b71b)=='-'){_0x3fc45d+=_0x4dcfd0['charAt'](_0x21b71b);}else{_0x3fc45d+='['+_0x4dcfd0[_0xf2c8('0x6f')](_0x21b71b)+']';}}_0x3fc45d+='.';return _0x3fc45d;}exports[_0xf2c8('0x26')]=function(_0x47b940,_0x59f562,_0x5b85b2){var _0x3290d9=_0x47b940[_0xf2c8('0x51')];_0x3290d9[_0xf2c8('0x67')]=_0xf2c8('0x70')+_0x3290d9[_0xf2c8('0x2b')]+'-';return db[_0xf2c8('0x4f')]['transaction'](function(_0x2f5718){return db[_0xf2c8('0x2f')][_0xf2c8('0x26')](_0x3290d9,{'where':{'id':_0x3290d9['id']},'transaction':_0x2f5718})[_0xf2c8('0x2a')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x3290d9['id']},'transaction':_0x2f5718})[_0xf2c8('0x2a')](function(){return db[_0xf2c8('0x52')][_0xf2c8('0x53')]({'where':{'id':_0x3290d9[_0xf2c8('0x64')]},'raw':!![]})['then'](function(_0x4fe673){return createVoicePrefixExtensions(_0x3290d9,_0x4fe673,_0x2f5718);});});});})[_0xf2c8('0x2a')](function(){return db[_0xf2c8('0x2f')][_0xf2c8('0x71')](_0x3290d9['id']);})[_0xf2c8('0x2a')](respondWithResult(_0x59f562,null))['catch'](handleError(_0x59f562,null));};exports['addAgents']=function(_0x3fe711,_0x276bd0,_0x26dbe6){return db[_0xf2c8('0x2f')][_0xf2c8('0x53')]({'where':{'id':_0x3fe711[_0xf2c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x276bd0,null))[_0xf2c8('0x2a')](function(_0x25879d){if(_0x25879d){return _0x25879d['addAgents'](_0x3fe711[_0xf2c8('0x51')]['ids'],_[_0xf2c8('0x72')](_0x3fe711['body'],[_0xf2c8('0x73'),'id'])||{})[_0xf2c8('0x74')](function(_0x2db8b1){for(var _0x34ddf7=0x0;_0x34ddf7<_0x3fe711[_0xf2c8('0x51')]['ids']['length'];_0x34ddf7+=0x1){socket['emit'](_0xf2c8('0x75'),{'UserId':_0x3fe711[_0xf2c8('0x51')][_0xf2c8('0x73')][_0x34ddf7],'VoicePrefixId':_0x3fe711['params']['id']});}return _0x2db8b1;});}})[_0xf2c8('0x2a')](respondWithResult(_0x276bd0,null))['catch'](handleError(_0x276bd0,null));};exports[_0xf2c8('0x76')]=function(_0x4879e0,_0x2e0742,_0x5d1c2d){return db[_0xf2c8('0x2f')][_0xf2c8('0x53')]({'where':{'id':_0x4879e0[_0xf2c8('0x4a')]['id']}})[_0xf2c8('0x2a')](handleEntityNotFound(_0x2e0742,null))[_0xf2c8('0x2a')](function(_0x3ec49b){if(_0x3ec49b){return _0x3ec49b[_0xf2c8('0x76')](_0x4879e0[_0xf2c8('0x33')]['ids'])[_0xf2c8('0x2a')](function(){if(_['isArray'](_0x4879e0[_0xf2c8('0x33')]['ids'])){for(var _0x511faa=0x0;_0x511faa<_0x4879e0['query']['ids'][_0xf2c8('0x3a')];_0x511faa+=0x1){socket[_0xf2c8('0x77')](_0xf2c8('0x78'),{'UserId':Number(_0x4879e0[_0xf2c8('0x33')]['ids'][_0x511faa]),'VoicePrefixId':Number(_0x4879e0[_0xf2c8('0x4a')]['id'])});}}else{socket[_0xf2c8('0x77')](_0xf2c8('0x78'),{'UserId':Number(_0x4879e0[_0xf2c8('0x33')]['ids']),'VoicePrefixId':Number(_0x4879e0[_0xf2c8('0x4a')]['id'])});}});}})[_0xf2c8('0x2a')](respondWithStatusCode(_0x2e0742,null))['catch'](handleError(_0x2e0742,null));};exports['getAgents']=function(_0x15bb5d,_0xa68658,_0x32ce0a){var _0x4d2686={};var _0x14edd6={};var _0x28fdcc;var _0x3d1a5a;return db['VoicePrefix'][_0xf2c8('0x79')]({'where':{'id':_0x15bb5d[_0xf2c8('0x4a')]['id']}})[_0xf2c8('0x2a')](handleEntityNotFound(_0xa68658,null))[_0xf2c8('0x2a')](function(_0x3a1b37){if(_0x3a1b37){_0x28fdcc=_0x3a1b37;_0x14edd6[_0xf2c8('0x38')]=_['keys'](db[_0xf2c8('0x7a')][_0xf2c8('0x30')]);_0x14edd6[_0xf2c8('0x33')]=_[_0xf2c8('0x34')](_0x15bb5d[_0xf2c8('0x33')]);_0x14edd6[_0xf2c8('0x35')]=_['intersection'](_0x14edd6[_0xf2c8('0x38')],_0x14edd6[_0xf2c8('0x33')]);_0x4d2686[_0xf2c8('0x37')]=_[_0xf2c8('0x36')](_0x14edd6[_0xf2c8('0x38')],qs['fields'](_0x15bb5d[_0xf2c8('0x33')][_0xf2c8('0x39')]));_0x4d2686[_0xf2c8('0x37')]=_0x4d2686['attributes'][_0xf2c8('0x3a')]?_0x4d2686[_0xf2c8('0x37')]:_0x14edd6[_0xf2c8('0x38')];_0x4d2686[_0xf2c8('0x3d')]=qs[_0xf2c8('0x3e')](_0x15bb5d['query']['sort']);_0x4d2686[_0xf2c8('0x41')]=qs['filters'](_[_0xf2c8('0x3f')](_0x15bb5d[_0xf2c8('0x33')],_0x14edd6[_0xf2c8('0x35')]));if(_0x15bb5d['query'][_0xf2c8('0x40')]){_0x4d2686[_0xf2c8('0x41')]=_[_0xf2c8('0x44')](_0x4d2686[_0xf2c8('0x41')],{'$or':_[_0xf2c8('0x2e')](_0x4d2686[_0xf2c8('0x37')],function(_0x8acd72){var _0x33d312={};_0x33d312[_0x8acd72]={'$like':'%'+_0x15bb5d[_0xf2c8('0x33')][_0xf2c8('0x40')]+'%'};return _0x33d312;})});}_0x4d2686=_[_0xf2c8('0x44')]({},_0x4d2686,_0x15bb5d['options']);return _0x28fdcc['getAgents'](_0x4d2686);}})[_0xf2c8('0x2a')](function(_0x415424){if(_0x415424){_0x3d1a5a=_0x415424[_0xf2c8('0x3a')];if(!_0x15bb5d[_0xf2c8('0x33')][_0xf2c8('0x3b')](_0xf2c8('0x3c'))){_0x4d2686[_0xf2c8('0x22')]=qs[_0xf2c8('0x22')](_0x15bb5d[_0xf2c8('0x33')][_0xf2c8('0x22')]);_0x4d2686[_0xf2c8('0x21')]=qs[_0xf2c8('0x21')](_0x15bb5d[_0xf2c8('0x33')][_0xf2c8('0x21')]);}return _0x28fdcc[_0xf2c8('0x7b')](_0x4d2686);}})['then'](function(_0x4455b3){if(_0x4455b3){return _0x4455b3?{'count':_0x3d1a5a,'rows':_0x4455b3}:null;}})[_0xf2c8('0x2a')](respondWithResult(_0xa68658,null))[_0xf2c8('0x4c')](handleError(_0xa68658,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index f8c8e05..5eb6c96 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 _0x3e74=['hasOwnProperty','exports','events','VoicePrefix','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x2ca8c5,_0x4520fc){_0x2ca8c5=_0x2ca8c5-0x0;var _0x4d5513=_0x3e74[_0x2ca8c5];return _0x4d5513;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x43e7('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){VoicePrefixEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);VoicePrefixEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xedd9,0xfc));var _0x9edd=function(_0x8a79ef,_0x52272c){_0x8a79ef=_0x8a79ef-0x0;var _0x21ca2a=_0xedd9[_0x8a79ef];return _0x21ca2a;};'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 d50af3a..6427b22 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 _0xbebf=['moment','bluebird','request-promise','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util','../../config/logger','api'];(function(_0x568a06,_0x173c72){var _0x4346a4=function(_0x535eed){while(--_0x535eed){_0x568a06['push'](_0x568a06['shift']());}};_0x4346a4(++_0x173c72);}(_0xbebf,0xa4));var _0xfbeb=function(_0x4d353b,_0x57e42b){_0x4d353b=_0x4d353b-0x0;var _0x3bf754=_0xbebf[_0x4d353b];return _0x3bf754;};'use strict';var _=require(_0xfbeb('0x0'));var util=require(_0xfbeb('0x1'));var logger=require(_0xfbeb('0x2'))(_0xfbeb('0x3'));var moment=require(_0xfbeb('0x4'));var BPromise=require(_0xfbeb('0x5'));var rp=require(_0xfbeb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfbeb('0x7'));var attributes=require(_0xfbeb('0x8'));module[_0xfbeb('0x9')]=function(_0x10e42a,_0x32627b){return _0x10e42a[_0xfbeb('0xa')](_0xfbeb('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00fe=['lodash','util','moment','bluebird','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0x00fe,0x1e6));var _0xe00f=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x00fe[_0x30e004];return _0x5ca247;};'use strict';var _=require(_0xe00f('0x0'));var util=require(_0xe00f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe00f('0x2'));var BPromise=require(_0xe00f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe00f('0x4'));var attributes=require(_0xe00f('0x5'));module['exports']=function(_0x19cedc,_0x18e5ca){return _0x19cedc[_0xe00f('0x6')](_0xe00f('0x7'),attributes,{'tableName':_0xe00f('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 4a126df..4cc4991 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 _0x8c47=['request\x20sent','debug','stringify','error','code','message','info','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x8c47,0xc5));var _0x78c4=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x8c47[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x78c4('0x0'));var util=require('util');var moment=require(_0x78c4('0x1'));var BPromise=require('bluebird');var rs=require(_0x78c4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78c4('0x3'))['db'];var utils=require(_0x78c4('0x4'));var logger=require(_0x78c4('0x5'))(_0x78c4('0x6'));var config=require(_0x78c4('0x7'));var jayson=require(_0x78c4('0x8'));var client=jayson[_0x78c4('0x9')]['http']({'port':0x232a});config['redis']=_[_0x78c4('0xa')](config[_0x78c4('0xb')],{'host':_0x78c4('0xc'),'port':0x18eb});var socket=require(_0x78c4('0xd'))(new Redis(config[_0x78c4('0xb')]));require(_0x78c4('0xe'))[_0x78c4('0xf')](socket);function respondWithRpcPromise(_0x2f466f,_0xe6a8b4,_0x431595){return new BPromise(function(_0x51fe54,_0x20b705){return client[_0x78c4('0x10')](_0x2f466f,_0x431595)[_0x78c4('0x11')](function(_0x1c498c){logger['info'](_0x78c4('0x12'),_0xe6a8b4,_0x78c4('0x13'));logger[_0x78c4('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0xe6a8b4,_0x78c4('0x13'),JSON[_0x78c4('0x15')](_0x1c498c));if(_0x1c498c[_0x78c4('0x16')]){if(_0x1c498c[_0x78c4('0x16')][_0x78c4('0x17')]===0x1f4){logger[_0x78c4('0x16')]('VoicePrefix,\x20%s,\x20%s',_0xe6a8b4,_0x1c498c['error'][_0x78c4('0x18')]);return _0x20b705(_0x1c498c['error']['message']);}logger[_0x78c4('0x16')](_0x78c4('0x12'),_0xe6a8b4,_0x1c498c[_0x78c4('0x16')][_0x78c4('0x18')]);return _0x51fe54(_0x1c498c[_0x78c4('0x16')][_0x78c4('0x18')]);}else{logger[_0x78c4('0x19')](_0x78c4('0x12'),_0xe6a8b4,_0x78c4('0x13'));_0x51fe54(_0x1c498c[_0x78c4('0x1a')][_0x78c4('0x18')]);}})['catch'](function(_0x533ad1){logger[_0x78c4('0x16')](_0x78c4('0x12'),_0xe6a8b4,_0x533ad1);_0x20b705(_0x533ad1);});});} \ No newline at end of file +var _0x6a83=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2aab5b,_0x359dd2){var _0x473ff3=function(_0x5b8359){while(--_0x5b8359){_0x2aab5b['push'](_0x2aab5b['shift']());}};_0x473ff3(++_0x359dd2);}(_0x6a83,0xd2));var _0x36a8=function(_0x4877a8,_0x453d15){_0x4877a8=_0x4877a8-0x0;var _0x4b1d88=_0x6a83[_0x4877a8];return _0x4b1d88;};'use strict';var _=require(_0x36a8('0x0'));var util=require(_0x36a8('0x1'));var moment=require(_0x36a8('0x2'));var BPromise=require(_0x36a8('0x3'));var rs=require(_0x36a8('0x4'));var fs=require('fs');var Redis=require(_0x36a8('0x5'));var db=require(_0x36a8('0x6'))['db'];var utils=require(_0x36a8('0x7'));var logger=require(_0x36a8('0x8'))(_0x36a8('0x9'));var config=require(_0x36a8('0xa'));var jayson=require(_0x36a8('0xb'));var client=jayson[_0x36a8('0xc')][_0x36a8('0xd')]({'port':0x232a});config[_0x36a8('0xe')]=_[_0x36a8('0xf')](config[_0x36a8('0xe')],{'host':_0x36a8('0x10'),'port':0x18eb});var socket=require(_0x36a8('0x11'))(new Redis(config['redis']));require(_0x36a8('0x12'))['register'](socket);function respondWithRpcPromise(_0x345fa4,_0x29923c,_0x48b0fc){return new BPromise(function(_0x23834f,_0x1e5a57){return client['request'](_0x345fa4,_0x48b0fc)[_0x36a8('0x13')](function(_0x3c8c08){logger[_0x36a8('0x14')](_0x36a8('0x15'),_0x29923c,_0x36a8('0x16'));logger[_0x36a8('0x17')](_0x36a8('0x18'),_0x29923c,_0x36a8('0x16'),JSON['stringify'](_0x3c8c08));if(_0x3c8c08[_0x36a8('0x19')]){if(_0x3c8c08[_0x36a8('0x19')][_0x36a8('0x1a')]===0x1f4){logger[_0x36a8('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x29923c,_0x3c8c08['error'][_0x36a8('0x1b')]);return _0x1e5a57(_0x3c8c08[_0x36a8('0x19')][_0x36a8('0x1b')]);}logger[_0x36a8('0x19')](_0x36a8('0x15'),_0x29923c,_0x3c8c08[_0x36a8('0x19')][_0x36a8('0x1b')]);return _0x23834f(_0x3c8c08['error'][_0x36a8('0x1b')]);}else{logger[_0x36a8('0x14')](_0x36a8('0x15'),_0x29923c,'request\x20sent');_0x23834f(_0x3c8c08[_0x36a8('0x1c')]['message']);}})[_0x36a8('0x1d')](function(_0x45889a){logger[_0x36a8('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x29923c,_0x45889a);_0x1e5a57(_0x45889a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7fa4736..ed88adf 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 _0xf5e8=['update','removeListener','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0xf5e8,0xd0));var _0x8f5e=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0xf5e8[_0x310d10];return _0x1fb8af;};'use strict';var VoicePrefixEvents=require(_0x8f5e('0x0'));var events=[_0x8f5e('0x1'),'remove',_0x8f5e('0x2')];function createListener(_0x8d7e4e,_0x13a381){return function(_0xede87c){_0x13a381['emit'](_0x8d7e4e,_0xede87c);};}function removeListener(_0x53951d,_0xec1d5a){return function(){VoicePrefixEvents[_0x8f5e('0x3')](_0x53951d,_0xec1d5a);};}exports[_0x8f5e('0x4')]=function(_0x1abdcb){for(var _0x454386=0x0,_0x4a9bbb=events[_0x8f5e('0x5')];_0x454386<_0x4a9bbb;_0x454386++){var _0x3b204e=events[_0x454386];var _0x3ffe36=createListener(_0x8f5e('0x6')+_0x3b204e,_0x1abdcb);VoicePrefixEvents['on'](_0x3b204e,_0x3ffe36);}}; \ No newline at end of file +var _0x13e7=['./voicePrefix.events','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x328cf1,_0x2559e0){var _0x6a076b=function(_0x1251b9){while(--_0x1251b9){_0x328cf1['push'](_0x328cf1['shift']());}};_0x6a076b(++_0x2559e0);}(_0x13e7,0x138));var _0x713e=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x13e7[_0x4b4f24];return _0x1c13d4;};'use strict';var VoicePrefixEvents=require(_0x713e('0x0'));var events=['save',_0x713e('0x1'),_0x713e('0x2')];function createListener(_0x51146d,_0x368e0d){return function(_0x23ec09){_0x368e0d[_0x713e('0x3')](_0x51146d,_0x23ec09);};}function removeListener(_0x5cd1a7,_0x4e7507){return function(){VoicePrefixEvents[_0x713e('0x4')](_0x5cd1a7,_0x4e7507);};}exports[_0x713e('0x5')]=function(_0x1f4222){for(var _0x3203c9=0x0,_0x52bb0c=events[_0x713e('0x6')];_0x3203c9<_0x52bb0c;_0x3203c9++){var _0x249f2c=events[_0x3203c9];var _0x358d55=createListener(_0x713e('0x7')+_0x249f2c,_0x1f4222);VoicePrefixEvents['on'](_0x249f2c,_0x358d55);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index bff259d..84aa8a0 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 _0x4eb9=['/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','getMembers','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','update','delete','destroy','removeTeams','removeLists','removeBlackLists','exports','multer','util','express','Router','../../components/auth/service','isAuthenticated','index','/:id','show','get'];(function(_0x3dff4c,_0x15805c){var _0x480e99=function(_0x4e8bbc){while(--_0x4e8bbc){_0x3dff4c['push'](_0x3dff4c['shift']());}};_0x480e99(++_0x15805c);}(_0x4eb9,0x14c));var _0x94eb=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x4eb9[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0x94eb('0x0'));var util=require(_0x94eb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x94eb('0x2'));var router=express[_0x94eb('0x3')]();var auth=require(_0x94eb('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router['get']('/',auth[_0x94eb('0x5')](),controller[_0x94eb('0x6')]);router['get'](_0x94eb('0x7'),auth['isAuthenticated'](),controller[_0x94eb('0x8')]);router[_0x94eb('0x9')](_0x94eb('0xa'),auth[_0x94eb('0x5')](),controller[_0x94eb('0xb')]);router[_0x94eb('0x9')](_0x94eb('0xc'),auth[_0x94eb('0x5')](),controller[_0x94eb('0xd')]);router['get'](_0x94eb('0xe'),auth[_0x94eb('0x5')](),controller['getHopperFinals']);router['get'](_0x94eb('0xf'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x10')]);router[_0x94eb('0x9')](_0x94eb('0x11'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x12')]);router[_0x94eb('0x9')](_0x94eb('0x13'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x14')]);router[_0x94eb('0x9')]('/:id/members',auth[_0x94eb('0x5')](),controller[_0x94eb('0x15')]);router['get'](_0x94eb('0x16'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x17')]);router[_0x94eb('0x9')]('/:id/blacklists',auth[_0x94eb('0x5')](),controller[_0x94eb('0x18')]);router[_0x94eb('0x19')]('/',auth[_0x94eb('0x5')](),controller[_0x94eb('0x1a')]);router[_0x94eb('0x19')](_0x94eb('0x1b'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x1c')]);router[_0x94eb('0x19')](_0x94eb('0x11'),auth[_0x94eb('0x5')](),controller['addTeams']);router[_0x94eb('0x19')](_0x94eb('0x13'),auth[_0x94eb('0x5')](),controller['addAgents']);router[_0x94eb('0x19')](_0x94eb('0x16'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x1d')]);router[_0x94eb('0x19')](_0x94eb('0x1e'),auth[_0x94eb('0x5')](),controller['addBlackLists']);router['put'](_0x94eb('0x7'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x1f')]);router[_0x94eb('0x20')](_0x94eb('0x7'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x21')]);router[_0x94eb('0x20')](_0x94eb('0x11'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x22')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);router[_0x94eb('0x20')](_0x94eb('0x16'),auth['isAuthenticated'](),controller[_0x94eb('0x23')]);router[_0x94eb('0x20')](_0x94eb('0x1e'),auth['isAuthenticated'](),controller[_0x94eb('0x24')]);module[_0x94eb('0x25')]=router; \ No newline at end of file +var _0x10d4=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/hoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/lists','getLists','/:id/blacklists','create','post','clone','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeLists','removeBlackLists','multer'];(function(_0x35f5c9,_0x3267d6){var _0x463e96=function(_0x26a2e7){while(--_0x26a2e7){_0x35f5c9['push'](_0x35f5c9['shift']());}};_0x463e96(++_0x3267d6);}(_0x10d4,0x1af));var _0x410d=function(_0x5871f9,_0x28ccb7){_0x5871f9=_0x5871f9-0x0;var _0x8fd1c0=_0x10d4[_0x5871f9];return _0x8fd1c0;};'use strict';var multer=require(_0x410d('0x0'));var util=require(_0x410d('0x1'));var path=require(_0x410d('0x2'));var timeout=require('connect-timeout');var express=require(_0x410d('0x3'));var router=express[_0x410d('0x4')]();var auth=require(_0x410d('0x5'));var interaction=require(_0x410d('0x6'));var config=require(_0x410d('0x7'));var controller=require('./voiceQueue.controller');router[_0x410d('0x8')]('/',auth[_0x410d('0x9')](),controller[_0x410d('0xa')]);router['get'](_0x410d('0xb'),auth[_0x410d('0x9')](),controller['show']);router[_0x410d('0x8')](_0x410d('0xc'),auth[_0x410d('0x9')](),controller['getHoppers']);router[_0x410d('0x8')]('/:id/hopper_histories',auth[_0x410d('0x9')](),controller['getHopperHistories']);router['get'](_0x410d('0xd'),auth[_0x410d('0x9')](),controller[_0x410d('0xe')]);router[_0x410d('0x8')](_0x410d('0xf'),auth[_0x410d('0x9')](),controller[_0x410d('0x10')]);router['get'](_0x410d('0x11'),auth['isAuthenticated'](),controller[_0x410d('0x12')]);router[_0x410d('0x8')](_0x410d('0x13'),auth[_0x410d('0x9')](),controller[_0x410d('0x14')]);router['get']('/:id/members',auth[_0x410d('0x9')](),controller['getMembers']);router[_0x410d('0x8')](_0x410d('0x15'),auth[_0x410d('0x9')](),controller[_0x410d('0x16')]);router['get'](_0x410d('0x17'),auth[_0x410d('0x9')](),controller['getBlackLists']);router['post']('/',auth[_0x410d('0x9')](),controller[_0x410d('0x18')]);router[_0x410d('0x19')]('/:id/clone',auth[_0x410d('0x9')](),controller[_0x410d('0x1a')]);router[_0x410d('0x19')](_0x410d('0x11'),auth[_0x410d('0x9')](),controller[_0x410d('0x1b')]);router[_0x410d('0x19')](_0x410d('0x13'),auth[_0x410d('0x9')](),controller[_0x410d('0x1c')]);router[_0x410d('0x19')](_0x410d('0x15'),auth[_0x410d('0x9')](),controller['addLists']);router['post'](_0x410d('0x17'),auth[_0x410d('0x9')](),controller['addBlackLists']);router[_0x410d('0x1d')](_0x410d('0xb'),auth['isAuthenticated'](),controller[_0x410d('0x1e')]);router['delete'](_0x410d('0xb'),auth[_0x410d('0x9')](),controller[_0x410d('0x1f')]);router[_0x410d('0x20')]('/:id/teams',auth[_0x410d('0x9')](),controller[_0x410d('0x21')]);router[_0x410d('0x20')](_0x410d('0x13'),auth[_0x410d('0x9')](),controller['removeAgents']);router[_0x410d('0x20')](_0x410d('0x15'),auth[_0x410d('0x9')](),controller[_0x410d('0x22')]);router[_0x410d('0x20')](_0x410d('0x17'),auth[_0x410d('0x9')](),controller[_0x410d('0x23')]);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 66c4f94..89a048c 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(_0x1401e1,_0xabb499){var _0x1aab56=function(_0x1071fd){while(--_0x1071fd){_0x1401e1['push'](_0x1401e1['shift']());}};_0x1aab56(++_0xabb499);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x452d9d,_0x54304a){var _0x5966a1=function(_0x2f90a0){while(--_0x2f90a0){_0x452d9d['push'](_0x452d9d['shift']());}};_0x5966a1(++_0x54304a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 79e418e..510b8bc 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['updatedAt','role','getHoppers','findOne','CmHopper','nolimit','order','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','Team','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','all','union','compact','ids','removeAgents','emit','addAgents','spread','isEmpty','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','destroy','then','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','error','name','send','VoiceQueue','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','options','findAll','rows','catch','rawAttributes','includeAll','include','create','body','user','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt'];(function(_0x5eb43c,_0x382085){var _0x4a0c6f=function(_0x132ed2){while(--_0x132ed2){_0x5eb43c['push'](_0x5eb43c['shift']());}};_0x4a0c6f(++_0x382085);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];config['redis']=_['defaults'](config[_0x3071('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3071('0x1c'))(new Redis(config[_0x3071('0x1b')]));require('./voiceQueue.socket')[_0x3071('0x1d')](socket);function respondWithStatusCode(_0x4e1219,_0x2fc15d){_0x2fc15d=_0x2fc15d||0xcc;return function(_0x45c93b){if(_0x45c93b){return _0x4e1219[_0x3071('0x1e')](_0x2fc15d);}return _0x4e1219[_0x3071('0x1f')](_0x2fc15d)[_0x3071('0x20')]();};}function respondWithResult(_0x2a6a4b,_0x157a47){_0x157a47=_0x157a47||0xc8;return function(_0x11bdc9){if(_0x11bdc9){return _0x2a6a4b[_0x3071('0x1f')](_0x157a47)[_0x3071('0x21')](_0x11bdc9);}};}function respondWithFilteredResult(_0x5f3c22,_0x224996){return function(_0x17dbda){if(_0x17dbda){var _0x1068d9=_0x17dbda[_0x3071('0x22')],_0x108a83=_0x224996[_0x3071('0x23')],_0x3acf0e=_0x224996['offset']+_0x224996[_0x3071('0x24')],_0x17aee2;if(_0x3acf0e>=_0x1068d9){_0x3acf0e=_0x1068d9;_0x17aee2=0xc8;}else{_0x17aee2=0xce;}_0x5f3c22[_0x3071('0x1f')](_0x17aee2);return _0x5f3c22[_0x3071('0x25')]('Content-Range',_0x108a83+'-'+_0x3acf0e+'/'+_0x1068d9)[_0x3071('0x21')](_0x17dbda);}return null;};}function patchUpdates(_0x5cd80d){return function(_0x833074){try{jsonpatch[_0x3071('0x26')](_0x833074,_0x5cd80d,!![]);}catch(_0x3762d8){return BPromise[_0x3071('0x27')](_0x3762d8);}return _0x833074[_0x3071('0x28')]();};}function saveUpdates(_0x34c50e,_0x3c5cef){return function(_0x211b4f){if(_0x211b4f){return _0x211b4f['update'](_0x34c50e)['then'](function(_0x2ce48a){return _0x2ce48a;});}return null;};}function removeEntity(_0xb05b1d,_0x412652){return function(_0x13df9f){if(_0x13df9f){return _0x13df9f[_0x3071('0x29')]()[_0x3071('0x2a')](function(){var _0x7a4cb4=_0x13df9f[_0x3071('0x2b')]({'plain':!![]});var _0x1de5fb=[{'name':'VoiceQueues','value':_0x3071('0x2c'),'ignore':![]},{'name':_0x3071('0x2d'),'value':_0x3071('0x2e'),'ignore':![]}];var _0x4d5c4b=_(_0x1de5fb)[_0x3071('0x2f')](_0x3071('0x30'))[_0x3071('0x31')](_0x3071('0x32'))[_0x3071('0x32')]();if(_[_0x3071('0x33')](_0x4d5c4b,_0x7a4cb4[_0x3071('0x34')])){return;}var _0x3921a1=_[_0x3071('0x35')](_0x1de5fb,[_0x3071('0x32'),_0x7a4cb4[_0x3071('0x34')]])['name'];return db['UserProfileResource'][_0x3071('0x29')]({'where':{'type':_0x3921a1,'resourceId':_0x7a4cb4['id']}})[_0x3071('0x2a')](function(){return _0x13df9f;});})[_0x3071('0x2a')](function(){_0xb05b1d[_0x3071('0x1f')](0xcc)[_0x3071('0x20')]();});}};}function handleEntityNotFound(_0x29538c,_0x32b6b1){return function(_0x1ccc41){if(!_0x1ccc41){_0x29538c['sendStatus'](0x194);}return _0x1ccc41;};}function handleError(_0x55d230,_0x4ab983){_0x4ab983=_0x4ab983||0x1f4;return function(_0x1b0aaf){logger[_0x3071('0x36')](_0x1b0aaf['stack']);if(_0x1b0aaf[_0x3071('0x37')]){delete _0x1b0aaf[_0x3071('0x37')];}_0x55d230[_0x3071('0x1f')](_0x4ab983)[_0x3071('0x38')](_0x1b0aaf);};}exports['index']=function(_0x218a82,_0x1525df){var _0x602719={},_0x240443={},_0x148096={'count':0x0,'rows':[]};var _0x2068ce=_[_0x3071('0x31')](db[_0x3071('0x39')]['rawAttributes'],function(_0x3988eb){return{'name':_0x3988eb['fieldName'],'type':_0x3988eb['type'][_0x3071('0x3a')]};});_0x240443[_0x3071('0x3b')]=_['map'](_0x2068ce,_0x3071('0x37'));_0x240443[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x218a82[_0x3071('0x3c')]);_0x240443[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x240443['model'],_0x240443[_0x3071('0x3c')]);_0x602719[_0x3071('0x40')]=_['intersection'](_0x240443[_0x3071('0x3b')],qs['fields'](_0x218a82[_0x3071('0x3c')][_0x3071('0x41')]));_0x602719['attributes']=_0x602719['attributes'][_0x3071('0x42')]?_0x602719[_0x3071('0x40')]:_0x240443[_0x3071('0x3b')];if(!_0x218a82['query'][_0x3071('0x43')]('nolimit')){_0x602719[_0x3071('0x24')]=qs['limit'](_0x218a82[_0x3071('0x3c')][_0x3071('0x24')]);_0x602719[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x218a82[_0x3071('0x3c')]['offset']);}_0x602719['order']=qs[_0x3071('0x44')](_0x218a82[_0x3071('0x3c')][_0x3071('0x44')]);_0x602719[_0x3071('0x45')]=qs['filters'](_[_0x3071('0x46')](_0x218a82[_0x3071('0x3c')],_0x240443[_0x3071('0x3e')]),_0x2068ce);if(_0x218a82[_0x3071('0x3c')][_0x3071('0x2f')]){_0x602719[_0x3071('0x45')]=_['merge'](_0x602719[_0x3071('0x45')],{'$or':_['map'](_0x2068ce,function(_0x4c8b1f){if(_0x4c8b1f['type']!=='VIRTUAL'){var _0x2992e6={};_0x2992e6[_0x4c8b1f[_0x3071('0x37')]]={'$like':'%'+_0x218a82[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x2992e6;}})});}_0x602719=_[_0x3071('0x47')]({},_0x602719,_0x218a82[_0x3071('0x48')]);var _0xa711b5={'where':_0x602719[_0x3071('0x45')]};return db['VoiceQueue'][_0x3071('0x22')](_0xa711b5)[_0x3071('0x2a')](function(_0x44a879){_0x148096[_0x3071('0x22')]=_0x44a879;if(_0x218a82[_0x3071('0x3c')]['includeAll']){_0x602719['include']=[{'all':!![]}];}return db[_0x3071('0x39')][_0x3071('0x49')](_0x602719);})[_0x3071('0x2a')](function(_0x5c5865){_0x148096[_0x3071('0x4a')]=_0x5c5865;return _0x148096;})['then'](respondWithFilteredResult(_0x1525df,_0x602719))[_0x3071('0x4b')](handleError(_0x1525df,null));};exports['show']=function(_0x18a773,_0x509178){var _0x5a3db7={'raw':![],'where':{'id':_0x18a773['params']['id']}},_0x874522={};_0x874522[_0x3071('0x3b')]=_['keys'](db[_0x3071('0x39')][_0x3071('0x4c')]);_0x874522[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x18a773['query']);_0x874522[_0x3071('0x3e')]=_['intersection'](_0x874522[_0x3071('0x3b')],_0x874522['query']);_0x5a3db7[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x874522['model'],qs[_0x3071('0x41')](_0x18a773[_0x3071('0x3c')][_0x3071('0x41')]));_0x5a3db7[_0x3071('0x40')]=_0x5a3db7[_0x3071('0x40')][_0x3071('0x42')]?_0x5a3db7[_0x3071('0x40')]:_0x874522['model'];if(_0x18a773[_0x3071('0x3c')][_0x3071('0x4d')]){_0x5a3db7[_0x3071('0x4e')]=[{'all':!![]}];}_0x5a3db7=_[_0x3071('0x47')]({},_0x5a3db7,_0x18a773['options']);return db[_0x3071('0x39')][_0x3071('0x35')](_0x5a3db7)[_0x3071('0x2a')](handleEntityNotFound(_0x509178,null))[_0x3071('0x2a')](respondWithResult(_0x509178,null))[_0x3071('0x4b')](handleError(_0x509178,null));};exports[_0x3071('0x4f')]=function(_0x3ab6d4,_0x390944){return db[_0x3071('0x39')][_0x3071('0x4f')](_0x3ab6d4[_0x3071('0x50')],{})[_0x3071('0x2a')](function(_0x24977b){var _0x114f1f=_0x3ab6d4[_0x3071('0x51')][_0x3071('0x2b')]({'plain':!![]});if(!_0x114f1f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x114f1f['role']===_0x3071('0x51')){var _0x580c04=_0x24977b[_0x3071('0x2b')]({'plain':!![]});var _0x198168=[{'name':_0x3071('0x52'),'value':'inbound'},{'name':_0x3071('0x2d'),'value':_0x3071('0x2e')}];var _0x5bc69e=_['find'](_0x198168,[_0x3071('0x32'),_0x580c04[_0x3071('0x34')]])[_0x3071('0x37')];return db[_0x3071('0x53')]['find']({'where':{'name':_0x5bc69e,'userProfileId':_0x114f1f[_0x3071('0x54')]},'raw':!![]})[_0x3071('0x2a')](function(_0x3f2edc){if(_0x3f2edc&&_0x3f2edc[_0x3071('0x55')]===0x0){return db[_0x3071('0x56')]['create']({'name':_0x580c04[_0x3071('0x37')],'resourceId':_0x580c04['id'],'type':_0x3f2edc[_0x3071('0x37')],'sectionId':_0x3f2edc['id']},{})[_0x3071('0x2a')](function(){return _0x24977b;});}else{return _0x24977b;}})[_0x3071('0x4b')](function(_0x12d6be){logger[_0x3071('0x36')](_0x3071('0x57'),_0x12d6be);throw _0x12d6be;});}return _0x24977b;})['then'](respondWithResult(_0x390944,0xc9))['catch'](handleError(_0x390944,null));};exports[_0x3071('0x58')]=function(_0x4de4f3,_0xe96994){var _0x26ba8a={'where':{'id':_0x4de4f3[_0x3071('0x59')]['id']}},_0x499b6a={};_0x499b6a[_0x3071('0x3b')]=_['keys'](db[_0x3071('0x39')][_0x3071('0x4c')]);_0x26ba8a[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x499b6a[_0x3071('0x3b')],qs['fields'](_0x4de4f3[_0x3071('0x3c')][_0x3071('0x41')]));_0x26ba8a[_0x3071('0x40')]=_0x26ba8a['attributes'][_0x3071('0x42')]?_0x26ba8a[_0x3071('0x40')]:_0x499b6a[_0x3071('0x3b')];if(_0x4de4f3[_0x3071('0x3c')][_0x3071('0x4d')]){_0x26ba8a[_0x3071('0x4e')]=[{'all':!![]}];}_0x26ba8a=_[_0x3071('0x47')]({},_0x26ba8a,_0x4de4f3[_0x3071('0x48')]);return db[_0x3071('0x39')]['find'](_0x26ba8a)[_0x3071('0x2a')](handleEntityNotFound(_0xe96994,null))[_0x3071('0x2a')](function(_0x3bcf28){if(_0x3bcf28){var _0x26ecb2=_0x3bcf28[_0x3071('0x2b')]({'plain':!![]});_0x26ecb2=qs[_0x3071('0x5a')](_0x26ecb2,['id',_0x3071('0x5b'),_0x3071('0x5c')]);_0x4de4f3[_0x3071('0x50')]=_[_0x3071('0x5a')](_0x4de4f3[_0x3071('0x50')],['id','createdAt',_0x3071('0x5c')]);return db[_0x3071('0x39')][_0x3071('0x4f')](_[_0x3071('0x47')](_0x26ecb2,_0x4de4f3[_0x3071('0x50')]),{'include':_0x4de4f3[_0x3071('0x3c')][_0x3071('0x4d')]?[{'all':!![]}]:undefined})[_0x3071('0x2a')](function(_0x52fddc){var _0x352d6f=_0x4de4f3[_0x3071('0x51')]['get']({'plain':!![]});if(!_0x352d6f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x352d6f[_0x3071('0x5d')]===_0x3071('0x51')){var _0x3469c1=_0x52fddc[_0x3071('0x2b')]({'plain':!![]});var _0x5278ea=[{'name':'VoiceQueues','value':_0x3071('0x2c')},{'name':'QueueCampaigns','value':'outbound'}];var _0x5113fc=_['find'](_0x5278ea,[_0x3071('0x32'),_0x3469c1[_0x3071('0x34')]])[_0x3071('0x37')];return db['UserProfileSection'][_0x3071('0x35')]({'where':{'name':_0x5113fc,'userProfileId':_0x352d6f[_0x3071('0x54')]},'raw':!![]})[_0x3071('0x2a')](function(_0x19a03d){if(_0x19a03d&&_0x19a03d['autoAssociation']===0x0){return db[_0x3071('0x56')][_0x3071('0x4f')]({'name':_0x3469c1['name'],'resourceId':_0x3469c1['id'],'type':_0x19a03d[_0x3071('0x37')],'sectionId':_0x19a03d['id']},{})[_0x3071('0x2a')](function(){return _0x52fddc;});}else{return _0x52fddc;}})[_0x3071('0x4b')](function(_0x40c258){logger[_0x3071('0x36')](_0x3071('0x57'),_0x40c258);throw _0x40c258;});}return _0x52fddc;});}})[_0x3071('0x2a')](respondWithResult(_0xe96994,0xc9))['catch'](handleError(_0xe96994,null));};exports['update']=function(_0x21c1e3,_0x168025){if(_0x21c1e3[_0x3071('0x50')]['id']){delete _0x21c1e3['body']['id'];}return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x21c1e3[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x168025,null))[_0x3071('0x2a')](saveUpdates(_0x21c1e3[_0x3071('0x50')],null))[_0x3071('0x2a')](respondWithResult(_0x168025,null))[_0x3071('0x4b')](handleError(_0x168025,null));};exports[_0x3071('0x29')]=function(_0x5eed64,_0x4ce89b){return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x5eed64[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x4ce89b,null))[_0x3071('0x2a')](removeEntity(_0x4ce89b,null))[_0x3071('0x4b')](handleError(_0x4ce89b,null));};exports[_0x3071('0x5e')]=function(_0x155542,_0x2ae053,_0x4fa372){var _0x20dff9={'raw':![],'where':{}};var _0x138a94={};var _0x1da477={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3071('0x5f')]({'where':{'id':_0x155542[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x2ae053,null))['then'](function(_0x521ee6){if(_0x521ee6){_0x138a94[_0x3071('0x3b')]=_['keys'](db[_0x3071('0x60')][_0x3071('0x4c')]);_0x138a94[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x155542[_0x3071('0x3c')]);_0x138a94[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x138a94['model'],_0x138a94[_0x3071('0x3c')]);_0x20dff9[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x138a94[_0x3071('0x3b')],qs[_0x3071('0x41')](_0x155542[_0x3071('0x3c')][_0x3071('0x41')]));_0x20dff9[_0x3071('0x40')]=_0x20dff9['attributes'][_0x3071('0x42')]?_0x20dff9['attributes']:_0x138a94[_0x3071('0x3b')];if(!_0x155542[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0x20dff9[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x155542[_0x3071('0x3c')][_0x3071('0x24')]);_0x20dff9[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x155542['query'][_0x3071('0x23')]);}_0x20dff9[_0x3071('0x62')]=qs['sort'](_0x155542[_0x3071('0x3c')][_0x3071('0x44')]);_0x20dff9[_0x3071('0x45')]=qs[_0x3071('0x3e')](_[_0x3071('0x46')](_0x155542['query'],_0x138a94['filters']));_0x20dff9[_0x3071('0x45')]['VoiceQueueId']=_0x521ee6['id'];if(_0x155542[_0x3071('0x3c')][_0x3071('0x2f')]){_0x20dff9[_0x3071('0x45')]=_[_0x3071('0x47')](_0x20dff9[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x20dff9['attributes'],function(_0x290d1c){var _0xa732ea={};_0xa732ea[_0x290d1c]={'$like':'%'+_0x155542[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0xa732ea;})});}_0x20dff9=_['merge']({},_0x20dff9,_0x155542[_0x3071('0x48')]);return db[_0x3071('0x60')]['count']({'where':_0x20dff9[_0x3071('0x45')]})[_0x3071('0x2a')](function(_0x391887){_0x1da477[_0x3071('0x22')]=_0x391887;if(_0x155542[_0x3071('0x3c')]['includeAll']){_0x20dff9[_0x3071('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x3071('0x49')](_0x20dff9);})[_0x3071('0x2a')](function(_0x39060f){_0x1da477[_0x3071('0x4a')]=_0x39060f;return _0x1da477;});}})[_0x3071('0x2a')](respondWithFilteredResult(_0x2ae053,_0x20dff9))[_0x3071('0x4b')](handleError(_0x2ae053,null));};exports[_0x3071('0x63')]=function(_0x32b2e2,_0x4ed248,_0x2868c2){var _0x3efa3c={'raw':!![],'where':{}};var _0x459653={};var _0x4dfb45={'count':0x0,'rows':[]};return db[_0x3071('0x39')]['findOne']({'where':{'id':_0x32b2e2[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x4ed248,null))[_0x3071('0x2a')](function(_0x5e0cbd){if(_0x5e0cbd){_0x459653[_0x3071('0x3b')]=_[_0x3071('0x3d')](db[_0x3071('0x64')][_0x3071('0x4c')]);_0x459653[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x32b2e2[_0x3071('0x3c')]);_0x459653[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x459653['model'],_0x459653[_0x3071('0x3c')]);_0x3efa3c[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x459653['model'],qs['fields'](_0x32b2e2['query']['fields']));_0x3efa3c['attributes']=_0x3efa3c[_0x3071('0x40')][_0x3071('0x42')]?_0x3efa3c['attributes']:_0x459653[_0x3071('0x3b')];if(!_0x32b2e2[_0x3071('0x3c')][_0x3071('0x43')]('nolimit')){_0x3efa3c['limit']=qs[_0x3071('0x24')](_0x32b2e2[_0x3071('0x3c')][_0x3071('0x24')]);_0x3efa3c[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x32b2e2[_0x3071('0x3c')][_0x3071('0x23')]);}_0x3efa3c['order']=qs['sort'](_0x32b2e2[_0x3071('0x3c')][_0x3071('0x44')]);_0x3efa3c[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x32b2e2[_0x3071('0x3c')],_0x459653[_0x3071('0x3e')]));_0x3efa3c[_0x3071('0x45')][_0x3071('0x65')]=_0x5e0cbd['id'];if(_0x32b2e2[_0x3071('0x3c')][_0x3071('0x2f')]){_0x3efa3c[_0x3071('0x45')]=_[_0x3071('0x47')](_0x3efa3c['where'],{'$or':_[_0x3071('0x31')](_0x3efa3c[_0x3071('0x40')],function(_0x118268){var _0x9dba3={};_0x9dba3[_0x118268]={'$like':'%'+_0x32b2e2[_0x3071('0x3c')]['filter']+'%'};return _0x9dba3;})});}_0x3efa3c=_[_0x3071('0x47')]({},_0x3efa3c,_0x32b2e2['options']);return db['CmHopperHistory'][_0x3071('0x22')]({'where':_0x3efa3c[_0x3071('0x45')]})[_0x3071('0x2a')](function(_0x48fdd2){_0x4dfb45[_0x3071('0x22')]=_0x48fdd2;if(_0x32b2e2[_0x3071('0x3c')][_0x3071('0x4d')]){_0x3efa3c[_0x3071('0x4e')]=[{'all':!![]}];}return db[_0x3071('0x64')]['findAll'](_0x3efa3c);})['then'](function(_0x39dc23){_0x4dfb45[_0x3071('0x4a')]=_0x39dc23;return _0x4dfb45;});}})['then'](respondWithFilteredResult(_0x4ed248,_0x3efa3c))[_0x3071('0x4b')](handleError(_0x4ed248,null));};exports[_0x3071('0x66')]=function(_0x22e484,_0x2d559a,_0xa7fb55){var _0x4df9dd={'raw':!![],'where':{}};var _0x4194dd={};var _0x5b1ff8={'count':0x0,'rows':[]};return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0x22e484['params']['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x2d559a,null))['then'](function(_0x1322eb){if(_0x1322eb){_0x4194dd[_0x3071('0x3b')]=_[_0x3071('0x3d')](db[_0x3071('0x67')]['rawAttributes']);_0x4194dd[_0x3071('0x3c')]=_['keys'](_0x22e484[_0x3071('0x3c')]);_0x4194dd['filters']=_[_0x3071('0x3f')](_0x4194dd[_0x3071('0x3b')],_0x4194dd['query']);_0x4df9dd[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x4194dd['model'],qs[_0x3071('0x41')](_0x22e484[_0x3071('0x3c')][_0x3071('0x41')]));_0x4df9dd[_0x3071('0x40')]=_0x4df9dd[_0x3071('0x40')][_0x3071('0x42')]?_0x4df9dd[_0x3071('0x40')]:_0x4194dd[_0x3071('0x3b')];if(!_0x22e484[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0x4df9dd[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x22e484[_0x3071('0x3c')][_0x3071('0x24')]);_0x4df9dd['offset']=qs[_0x3071('0x23')](_0x22e484[_0x3071('0x3c')][_0x3071('0x23')]);}_0x4df9dd[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x22e484['query']['sort']);_0x4df9dd[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x22e484[_0x3071('0x3c')],_0x4194dd[_0x3071('0x3e')]));_0x4df9dd['where'][_0x3071('0x65')]=_0x1322eb['id'];if(_0x22e484[_0x3071('0x3c')][_0x3071('0x2f')]){_0x4df9dd[_0x3071('0x45')]=_[_0x3071('0x47')](_0x4df9dd[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x4df9dd[_0x3071('0x40')],function(_0xbee265){var _0x199bb0={};_0x199bb0[_0xbee265]={'$like':'%'+_0x22e484['query'][_0x3071('0x2f')]+'%'};return _0x199bb0;})});}_0x4df9dd=_['merge']({},_0x4df9dd,_0x22e484[_0x3071('0x48')]);return db[_0x3071('0x67')][_0x3071('0x22')]({'where':_0x4df9dd[_0x3071('0x45')]})['then'](function(_0x4f83d2){_0x5b1ff8['count']=_0x4f83d2;if(_0x22e484[_0x3071('0x3c')][_0x3071('0x4d')]){_0x4df9dd[_0x3071('0x4e')]=[{'all':!![]}];}return db[_0x3071('0x67')]['findAll'](_0x4df9dd);})[_0x3071('0x2a')](function(_0x7c3473){_0x5b1ff8[_0x3071('0x4a')]=_0x7c3473;return _0x5b1ff8;});}})['then'](respondWithFilteredResult(_0x2d559a,_0x4df9dd))['catch'](handleError(_0x2d559a,null));};exports['getHopperBlacks']=function(_0x4afc58,_0x18d792,_0x46efeb){var _0x5795ea={'raw':!![],'where':{}};var _0x2750c5={};var _0x2a2b9d={'count':0x0,'rows':[]};return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0x4afc58[_0x3071('0x59')]['id']}})['then'](handleEntityNotFound(_0x18d792,null))[_0x3071('0x2a')](function(_0x3d83cd){if(_0x3d83cd){_0x2750c5[_0x3071('0x3b')]=_[_0x3071('0x3d')](db['CmHopperBlack'][_0x3071('0x4c')]);_0x2750c5['query']=_[_0x3071('0x3d')](_0x4afc58[_0x3071('0x3c')]);_0x2750c5[_0x3071('0x3e')]=_['intersection'](_0x2750c5[_0x3071('0x3b')],_0x2750c5[_0x3071('0x3c')]);_0x5795ea[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x2750c5['model'],qs[_0x3071('0x41')](_0x4afc58[_0x3071('0x3c')][_0x3071('0x41')]));_0x5795ea[_0x3071('0x40')]=_0x5795ea[_0x3071('0x40')]['length']?_0x5795ea['attributes']:_0x2750c5[_0x3071('0x3b')];if(!_0x4afc58[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0x5795ea['limit']=qs['limit'](_0x4afc58[_0x3071('0x3c')][_0x3071('0x24')]);_0x5795ea['offset']=qs[_0x3071('0x23')](_0x4afc58[_0x3071('0x3c')][_0x3071('0x23')]);}_0x5795ea['order']=qs['sort'](_0x4afc58['query'][_0x3071('0x44')]);_0x5795ea[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x4afc58['query'],_0x2750c5[_0x3071('0x3e')]));_0x5795ea[_0x3071('0x45')][_0x3071('0x65')]=_0x3d83cd['id'];if(_0x4afc58[_0x3071('0x3c')][_0x3071('0x2f')]){_0x5795ea['where']=_[_0x3071('0x47')](_0x5795ea['where'],{'$or':_[_0x3071('0x31')](_0x5795ea[_0x3071('0x40')],function(_0x294316){var _0xc1632={};_0xc1632[_0x294316]={'$like':'%'+_0x4afc58[_0x3071('0x3c')]['filter']+'%'};return _0xc1632;})});}_0x5795ea=_[_0x3071('0x47')]({},_0x5795ea,_0x4afc58[_0x3071('0x48')]);return db[_0x3071('0x68')][_0x3071('0x22')]({'where':_0x5795ea[_0x3071('0x45')]})[_0x3071('0x2a')](function(_0x58d53b){_0x2a2b9d[_0x3071('0x22')]=_0x58d53b;if(_0x4afc58[_0x3071('0x3c')][_0x3071('0x4d')]){_0x5795ea[_0x3071('0x4e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x3071('0x49')](_0x5795ea);})[_0x3071('0x2a')](function(_0x330cfb){_0x2a2b9d[_0x3071('0x4a')]=_0x330cfb;return _0x2a2b9d;});}})['then'](respondWithFilteredResult(_0x18d792,_0x5795ea))[_0x3071('0x4b')](handleError(_0x18d792,null));};exports['getTeams']=function(_0x17a9f5,_0x2fcecd,_0x148924){var _0xfe896c={};var _0x3aa03f={};var _0x44c0e5;var _0x31c8bd;return db['VoiceQueue'][_0x3071('0x5f')]({'where':{'id':_0x17a9f5['params']['id']}})['then'](handleEntityNotFound(_0x2fcecd,null))[_0x3071('0x2a')](function(_0x2b0a2d){if(_0x2b0a2d){_0x44c0e5=_0x2b0a2d;_0x3aa03f['model']=_[_0x3071('0x3d')](db['Team'][_0x3071('0x4c')]);_0x3aa03f[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x17a9f5[_0x3071('0x3c')]);_0x3aa03f[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x3aa03f[_0x3071('0x3b')],_0x3aa03f[_0x3071('0x3c')]);_0xfe896c[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x3aa03f[_0x3071('0x3b')],qs['fields'](_0x17a9f5[_0x3071('0x3c')][_0x3071('0x41')]));_0xfe896c[_0x3071('0x40')]=_0xfe896c['attributes'][_0x3071('0x42')]?_0xfe896c['attributes']:_0x3aa03f[_0x3071('0x3b')];_0xfe896c[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x17a9f5[_0x3071('0x3c')]['sort']);_0xfe896c['where']=qs['filters'](_[_0x3071('0x46')](_0x17a9f5['query'],_0x3aa03f['filters']));if(_0x17a9f5[_0x3071('0x3c')]['filter']){_0xfe896c[_0x3071('0x45')]=_[_0x3071('0x47')](_0xfe896c[_0x3071('0x45')],{'$or':_['map'](_0xfe896c[_0x3071('0x40')],function(_0x5a10af){var _0x587e6b={};_0x587e6b[_0x5a10af]={'$like':'%'+_0x17a9f5[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x587e6b;})});}_0xfe896c=_[_0x3071('0x47')]({},_0xfe896c,_0x17a9f5[_0x3071('0x48')]);return _0x44c0e5[_0x3071('0x69')](_0xfe896c);}})[_0x3071('0x2a')](function(_0x3d396d){if(_0x3d396d){_0x31c8bd=_0x3d396d['length'];if(!_0x17a9f5[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0xfe896c[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x17a9f5[_0x3071('0x3c')][_0x3071('0x24')]);_0xfe896c[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x17a9f5['query'][_0x3071('0x23')]);}return _0x44c0e5[_0x3071('0x69')](_0xfe896c);}})[_0x3071('0x2a')](function(_0x28e880){if(_0x28e880){return _0x28e880?{'count':_0x31c8bd,'rows':_0x28e880}:null;}})[_0x3071('0x2a')](respondWithResult(_0x2fcecd,null))[_0x3071('0x4b')](handleError(_0x2fcecd,null));};exports[_0x3071('0x6a')]=function(_0x4ec86a,_0x2b6fca,_0x5b2cbc){var _0x32575c=_0x4ec86a[_0x3071('0x50')][_0x3071('0x6b')];var _0x5411b4=_['map'](_0x32575c,'id');return db['Team'][_0x3071('0x49')]({'where':{'id':_0x5411b4},'attributes':['id'],'include':[{'model':db[_0x3071('0x6c')],'as':_0x3071('0x6d'),'attributes':['id','name',_0x3071('0x6e'),_0x3071('0x6f'),_0x3071('0x70')],'raw':!![]}]})[_0x3071('0x2a')](function(_0x3e788f){if(_0x3e788f){var _0x25b492=_[_0x3071('0x71')](_0x3e788f,function(_0x1befe3){var _0x381eb=_0x1befe3['get']({'plain':!![]});_0x381eb[_0x3071('0x6d')][_0x3071('0x72')](function(_0x345f90){_0x345f90['penalty']=_[_0x3071('0x35')](_0x32575c,{'id':_0x381eb['id']})[_0x3071('0x73')];});return _0x381eb[_0x3071('0x6d')];});return db[_0x3071('0x39')][_0x3071('0x35')]({'where':{'id':_0x4ec86a[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](function(_0x10a0c3){return db[_0x3071('0x74')][_0x3071('0x75')](function(_0x242313){return _0x10a0c3[_0x3071('0x6a')](_0x5411b4,{'transaction':_0x242313})['then'](function(){return BPromise[_0x3071('0x76')](_0x25b492,function(_0x3e9573){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x3e9573['id'],'VoiceQueueId':_0x4ec86a['params']['id']},'defaults':{'penalty':_0x3e9573['penalty']},'transaction':_0x242313});});})[_0x3071('0x2a')](function(){return BPromise[_0x3071('0x76')](_['filter'](_0x25b492,{'online':!![]}),function(_0x1b0bb7){return db[_0x3071('0x77')][_0x3071('0x78')]({'membername':_0x1b0bb7[_0x3071('0x37')],'UserId':_0x1b0bb7['id'],'queue_name':_0x10a0c3[_0x3071('0x37')],'VoiceQueueId':_0x10a0c3['id'],'interface':_[_0x3071('0x79')](_0x1b0bb7[_0x3071('0x70')])?util[_0x3071('0x7a')](_0x3071('0x7b'),_0x1b0bb7[_0x3071('0x37')]):_0x1b0bb7[_0x3071('0x70')],'paused':_0x1b0bb7[_0x3071('0x6f')]||![],'penalty':_0x1b0bb7[_0x3071('0x73')]},{'transaction':_0x242313});});})['then'](function(){_0x25b492[_0x3071('0x72')](function(_0x9eb8e2){socket['emit'](_0x3071('0x7c'),{'UserId':_0x9eb8e2['id'],'VoiceQueueId':_0x10a0c3['id']});});});});});}})[_0x3071('0x2a')](respondWithStatusCode(_0x2b6fca,null))[_0x3071('0x4b')](handleError(_0x2b6fca,null));};exports[_0x3071('0x7d')]=function(_0x4e6536,_0x2bfae8,_0x363418){return db[_0x3071('0x7e')][_0x3071('0x49')]({'where':{'id':_0x4e6536['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3071('0x6c')],'as':_0x3071('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x3071('0x2a')](handleEntityNotFound(_0x2bfae8,null))[_0x3071('0x2a')](function(_0x406ffe){var _0x2e4180=_[_0x3071('0x31')](_0x406ffe,'id');var _0x2fc3d5=[];var _0x4d2992=[];var _0x15f9b1=squel['select']();_0x15f9b1['field'](_0x3071('0x7f'))[_0x3071('0x80')]('team_has_voice_queues','tq')['join'](_0x3071('0x81'),'ut',_0x3071('0x82'))[_0x3071('0x45')](_0x3071('0x83'),_0x4e6536['params']['id']);for(var _0x6ad3d9=0x0;_0x6ad3d9<_0x406ffe[_0x3071('0x42')];_0x6ad3d9+=0x1){let _0x2bb0eb=_0x406ffe[_0x6ad3d9];for(var _0x15a2b6=0x0;_0x15a2b6<_0x2bb0eb[_0x3071('0x6d')]['length'];_0x15a2b6+=0x1){let _0x2bf807=_0x2bb0eb[_0x3071('0x6d')][_0x15a2b6];var _0x52b7a8=_0x15f9b1['clone']();_0x52b7a8['where'](_0x3071('0x84'),_0x2bf807['id']);_0x4d2992[_0x3071('0x85')](db[_0x3071('0x74')]['query'](_0x52b7a8[_0x3071('0x86')](),{'type':db[_0x3071('0x74')]['QueryTypes'][_0x3071('0x87')]})[_0x3071('0x2a')](function(_0x33efb9){if(_0x33efb9[_0x3071('0x42')]===0x1){return _0x2bf807['id'];}else{var _0x2a995c=_['every'](_['map'](_0x33efb9,_0x3071('0x88')),function(_0x20230c){return _[_0x3071('0x33')](_0x2e4180,_0x20230c);});if(_0x2a995c){return _0x2bf807['id'];}}}));}}return BPromise[_0x3071('0x89')](_0x4d2992)['then'](function(_0x5ed84d){_0x2fc3d5=_(_0x2fc3d5)[_0x3071('0x8a')](_0x5ed84d)[_0x3071('0x8b')]()['value']();return db[_0x3071('0x39')][_0x3071('0x35')]({'where':{'id':_0x4e6536[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](function(_0x4e1cfa){return db[_0x3071('0x74')][_0x3071('0x75')](function(_0x6f189a){return _0x4e1cfa[_0x3071('0x7d')](_0x4e6536['query'][_0x3071('0x8c')],{'transaction':_0x6f189a})[_0x3071('0x2a')](function(){if(!_['isEmpty'](_0x2fc3d5)){return _0x4e1cfa[_0x3071('0x8d')](_0x2fc3d5,{'transaction':_0x6f189a})[_0x3071('0x2a')](function(){return db[_0x3071('0x77')][_0x3071('0x29')]({'where':{'VoiceQueueId':_0x4e6536[_0x3071('0x59')]['id'],'UserId':_0x2fc3d5},'transaction':_0x6f189a});});}})['then'](function(){_0x2fc3d5[_0x3071('0x72')](function(_0x5ece4a){socket[_0x3071('0x8e')]('userVoiceQueue:remove',{'UserId':_0x5ece4a,'VoiceQueueId':_0x4e1cfa['id']});});});});});});})[_0x3071('0x2a')](respondWithStatusCode(_0x2bfae8,null))[_0x3071('0x4b')](handleError(_0x2bfae8,null));};exports[_0x3071('0x8f')]=function(_0x29746e,_0x4826a0,_0x2ba6c3){var _0xacb4a3,_0x21d250;return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x29746e[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x4826a0,null))['then'](function(_0x25eca6){if(_0x25eca6){_0x21d250=_0x25eca6;return _0x25eca6[_0x3071('0x8f')](_0x29746e[_0x3071('0x50')][_0x3071('0x8c')],_[_0x3071('0x5a')](_0x29746e['body'],[_0x3071('0x8c'),'id'])||{})[_0x3071('0x90')](function(_0x1179ff){for(var _0xceab08=0x0;_0xceab08<_0x29746e['body'][_0x3071('0x8c')][_0x3071('0x42')];_0xceab08+=0x1){socket[_0x3071('0x8e')](_0x3071('0x7c'),{'UserId':_0x29746e[_0x3071('0x50')][_0x3071('0x8c')][_0xceab08],'VoiceQueueId':_0x29746e[_0x3071('0x59')]['id']});}return _0x1179ff;});}})[_0x3071('0x2a')](function(_0x4c7b0d){_0xacb4a3=_0x4c7b0d||[];if(_0x21d250){return db['User'][_0x3071('0x49')]({'where':{'id':_0x29746e[_0x3071('0x50')]['ids']},'attributes':['id',_0x3071('0x37'),_0x3071('0x6e'),_0x3071('0x6f'),_0x3071('0x70')],'raw':!![]});}})[_0x3071('0x2a')](function(_0x1a769a){if(!_[_0x3071('0x91')](_0x1a769a)){var _0x55f5c4=[];for(var _0x1c85bc=0x0;_0x1c85bc<_0x1a769a[_0x3071('0x42')];_0x1c85bc++){if(_0x1a769a[_0x1c85bc]['online']){_0x55f5c4[_0x3071('0x85')](db[_0x3071('0x77')][_0x3071('0x78')]({'membername':_0x1a769a[_0x1c85bc]['name'],'UserId':_0x1a769a[_0x1c85bc]['id'],'queue_name':_0x21d250[_0x3071('0x37')],'VoiceQueueId':_0x21d250['id'],'interface':_[_0x3071('0x79')](_0x1a769a[_0x1c85bc][_0x3071('0x70')])?util[_0x3071('0x7a')](_0x3071('0x7b'),_0x1a769a[_0x1c85bc][_0x3071('0x37')]):_0x1a769a[_0x1c85bc][_0x3071('0x70')],'paused':_0x1a769a[_0x1c85bc][_0x3071('0x6f')]||![],'penalty':_0x29746e['body'][_0x3071('0x73')]||0x0}));}}return BPromise[_0x3071('0x89')](_0x55f5c4);}})['then'](function(){return _0xacb4a3;})['then'](respondWithResult(_0x4826a0,null))[_0x3071('0x4b')](handleError(_0x4826a0,null));};exports['removeAgents']=function(_0x11d7b9,_0x589333,_0x5be17d){return db[_0x3071('0x39')][_0x3071('0x35')]({'where':{'id':_0x11d7b9[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x589333,null))[_0x3071('0x2a')](function(_0x6dc24d){if(_0x6dc24d){return _0x6dc24d['removeAgents'](_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')])['then'](function(){if(_[_0x3071('0x92')](_0x11d7b9[_0x3071('0x3c')]['ids'])){for(var _0x17b3fd=0x0;_0x17b3fd<_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')][_0x3071('0x42')];_0x17b3fd+=0x1){socket[_0x3071('0x8e')]('userVoiceQueue:remove',{'UserId':Number(_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')][_0x17b3fd]),'VoiceQueueId':Number(_0x11d7b9[_0x3071('0x59')]['id'])});}}else{socket[_0x3071('0x8e')]('userVoiceQueue:remove',{'UserId':Number(_0x11d7b9['query'][_0x3071('0x8c')]),'VoiceQueueId':Number(_0x11d7b9[_0x3071('0x59')]['id'])});}});}})[_0x3071('0x2a')](function(_0x3a1bd3){return db[_0x3071('0x77')][_0x3071('0x29')]({'where':{'VoiceQueueId':_0x11d7b9[_0x3071('0x59')]['id'],'UserId':_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')]}})[_0x3071('0x2a')](function(){return _0x3a1bd3;});})[_0x3071('0x2a')](respondWithStatusCode(_0x589333,null))[_0x3071('0x4b')](handleError(_0x589333,null));};exports['getAgents']=function(_0xce1615,_0x5a6594,_0x1dc10a){var _0x2acf72={};var _0x41a30d={};var _0x305958;var _0x393279;return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0xce1615['params']['id']}})['then'](handleEntityNotFound(_0x5a6594,null))[_0x3071('0x2a')](function(_0x4f5f82){if(_0x4f5f82){_0x305958=_0x4f5f82;_0x41a30d['model']=_[_0x3071('0x3d')](db['User']['rawAttributes']);_0x41a30d[_0x3071('0x3c')]=_['keys'](_0xce1615[_0x3071('0x3c')]);_0x41a30d['filters']=_[_0x3071('0x3f')](_0x41a30d[_0x3071('0x3b')],_0x41a30d[_0x3071('0x3c')]);_0x2acf72[_0x3071('0x40')]=_['intersection'](_0x41a30d['model'],qs['fields'](_0xce1615[_0x3071('0x3c')][_0x3071('0x41')]));_0x2acf72[_0x3071('0x40')]=_0x2acf72['attributes'][_0x3071('0x42')]?_0x2acf72[_0x3071('0x40')]:_0x41a30d[_0x3071('0x3b')];_0x2acf72[_0x3071('0x62')]=qs['sort'](_0xce1615[_0x3071('0x3c')][_0x3071('0x44')]);_0x2acf72[_0x3071('0x45')]=qs[_0x3071('0x3e')](_[_0x3071('0x46')](_0xce1615[_0x3071('0x3c')],_0x41a30d[_0x3071('0x3e')]));if(_0xce1615['query'][_0x3071('0x2f')]){_0x2acf72[_0x3071('0x45')]=_[_0x3071('0x47')](_0x2acf72[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x2acf72[_0x3071('0x40')],function(_0x397892){var _0x4666fc={};_0x4666fc[_0x397892]={'$like':'%'+_0xce1615['query']['filter']+'%'};return _0x4666fc;})});}_0x2acf72=_[_0x3071('0x47')]({},_0x2acf72,_0xce1615[_0x3071('0x48')]);return _0x305958[_0x3071('0x93')](_0x2acf72);}})[_0x3071('0x2a')](function(_0x23e6b6){if(_0x23e6b6){_0x393279=_0x23e6b6['length'];if(!_0xce1615[_0x3071('0x3c')][_0x3071('0x43')]('nolimit')){_0x2acf72[_0x3071('0x24')]=qs['limit'](_0xce1615['query'][_0x3071('0x24')]);_0x2acf72[_0x3071('0x23')]=qs[_0x3071('0x23')](_0xce1615[_0x3071('0x3c')][_0x3071('0x23')]);}return _0x305958[_0x3071('0x93')](_0x2acf72);}})[_0x3071('0x2a')](function(_0x49b48e){if(_0x49b48e){return _0x49b48e?{'count':_0x393279,'rows':_0x49b48e}:null;}})[_0x3071('0x2a')](respondWithResult(_0x5a6594,null))[_0x3071('0x4b')](handleError(_0x5a6594,null));};exports['getMembers']=function(_0x16588c,_0x191207,_0x1ae9f5){var _0x1c78d8={};var _0x14e6bf={};var _0x46cb83;var _0x4d092a;return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0x16588c[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x191207,null))[_0x3071('0x2a')](function(_0x2edcad){if(_0x2edcad){_0x46cb83=_0x2edcad;_0x14e6bf['model']=_[_0x3071('0x3d')](db['UserVoiceQueueRt'][_0x3071('0x4c')]);_0x14e6bf[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x16588c[_0x3071('0x3c')]);_0x14e6bf[_0x3071('0x3e')]=_['intersection'](_0x14e6bf[_0x3071('0x3b')],_0x14e6bf[_0x3071('0x3c')]);_0x1c78d8['attributes']=_['intersection'](_0x14e6bf[_0x3071('0x3b')],qs['fields'](_0x16588c[_0x3071('0x3c')]['fields']));_0x1c78d8[_0x3071('0x40')]=_0x1c78d8['attributes'][_0x3071('0x42')]?_0x1c78d8[_0x3071('0x40')]:_0x14e6bf[_0x3071('0x3b')];_0x1c78d8[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x16588c[_0x3071('0x3c')]['sort']);_0x1c78d8[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x16588c[_0x3071('0x3c')],_0x14e6bf['filters']));if(_0x16588c['query'][_0x3071('0x2f')]){_0x1c78d8[_0x3071('0x45')]=_[_0x3071('0x47')](_0x1c78d8[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x1c78d8['attributes'],function(_0xa7c24b){var _0x3612fa={};_0x3612fa[_0xa7c24b]={'$like':'%'+_0x16588c[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x3612fa;})});}_0x1c78d8=_[_0x3071('0x47')]({},_0x1c78d8,_0x16588c[_0x3071('0x48')]);return _0x46cb83[_0x3071('0x94')](_0x1c78d8);}})[_0x3071('0x2a')](function(_0x5b0ec5){if(_0x5b0ec5){_0x4d092a=_0x5b0ec5['length'];if(!_0x16588c[_0x3071('0x3c')]['hasOwnProperty'](_0x3071('0x61'))){_0x1c78d8[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x16588c['query']['limit']);_0x1c78d8[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x16588c[_0x3071('0x3c')][_0x3071('0x23')]);}return _0x46cb83['getMembers'](_0x1c78d8);}})[_0x3071('0x2a')](function(_0x290db0){return _0x290db0?{'count':_0x4d092a,'rows':_0x290db0}:null;})[_0x3071('0x2a')](respondWithResult(_0x191207,null))[_0x3071('0x4b')](handleError(_0x191207,null));};exports[_0x3071('0x95')]=function(_0x5deca4,_0x33583a,_0x390b60){var _0x4c63ee={};var _0x476765={};var _0x1bb3d7;var _0x59bb52;return db['VoiceQueue'][_0x3071('0x5f')]({'where':{'id':_0x5deca4[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x33583a,null))[_0x3071('0x2a')](function(_0x241c34){if(_0x241c34){_0x1bb3d7=_0x241c34;_0x476765[_0x3071('0x3b')]=_[_0x3071('0x3d')](db['CmList'][_0x3071('0x4c')]);_0x476765[_0x3071('0x3c')]=_['keys'](_0x5deca4[_0x3071('0x3c')]);_0x476765['filters']=_[_0x3071('0x3f')](_0x476765['model'],_0x476765[_0x3071('0x3c')]);_0x4c63ee[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x476765[_0x3071('0x3b')],qs[_0x3071('0x41')](_0x5deca4[_0x3071('0x3c')][_0x3071('0x41')]));_0x4c63ee[_0x3071('0x40')]=_0x4c63ee[_0x3071('0x40')][_0x3071('0x42')]?_0x4c63ee[_0x3071('0x40')]:_0x476765['model'];_0x4c63ee[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x5deca4[_0x3071('0x3c')][_0x3071('0x44')]);_0x4c63ee['where']=qs['filters'](_[_0x3071('0x46')](_0x5deca4['query'],_0x476765['filters']));if(_0x5deca4[_0x3071('0x3c')][_0x3071('0x2f')]){_0x4c63ee['where']=_[_0x3071('0x47')](_0x4c63ee['where'],{'$or':_[_0x3071('0x31')](_0x4c63ee[_0x3071('0x40')],function(_0x3762a4){var _0x4285a2={};_0x4285a2[_0x3762a4]={'$like':'%'+_0x5deca4[_0x3071('0x3c')]['filter']+'%'};return _0x4285a2;})});}_0x4c63ee=_[_0x3071('0x47')]({},_0x4c63ee,_0x5deca4[_0x3071('0x48')]);return _0x1bb3d7[_0x3071('0x95')](_0x4c63ee);}})[_0x3071('0x2a')](function(_0x10b3f1){if(_0x10b3f1){_0x59bb52=_0x10b3f1[_0x3071('0x42')];if(!_0x5deca4[_0x3071('0x3c')]['hasOwnProperty'](_0x3071('0x61'))){_0x4c63ee[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x5deca4[_0x3071('0x3c')]['limit']);_0x4c63ee[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x5deca4['query'][_0x3071('0x23')]);}return _0x1bb3d7[_0x3071('0x95')](_0x4c63ee);}})[_0x3071('0x2a')](function(_0x430c53){if(_0x430c53){return _0x430c53?{'count':_0x59bb52,'rows':_0x430c53}:null;}})[_0x3071('0x2a')](respondWithResult(_0x33583a,null))[_0x3071('0x4b')](handleError(_0x33583a,null));};exports[_0x3071('0x96')]=function(_0x50cb8c,_0x13d977,_0x2973b7){var _0x4d0f2a,_0x19b73d;return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x50cb8c[_0x3071('0x59')]['id']}})['then'](handleEntityNotFound(_0x13d977,null))[_0x3071('0x2a')](function(_0x4957b4){if(_0x4957b4){_0x19b73d=_0x4957b4;return _0x4957b4[_0x3071('0x96')](_0x50cb8c[_0x3071('0x50')][_0x3071('0x8c')],_[_0x3071('0x5a')](_0x50cb8c[_0x3071('0x50')],[_0x3071('0x8c'),'id'])||{});}return null;})[_0x3071('0x90')](function(_0x5db057){var _0x4eb2f0;_0x4d0f2a=_0x5db057||[];var _0x51e4b1=[];if(_0x5db057){for(var _0x4b9aad=0x0;_0x4b9aad<_0x5db057[_0x3071('0x42')];_0x4b9aad+=0x1){var _0x35bf60=_0x5db057[_0x4b9aad][_0x3071('0x2b')]({'plain':!![]});_0x19b73d[_0x3071('0x97')]=_0x50cb8c[_0x3071('0x50')][_0x3071('0x97')]?_0x50cb8c[_0x3071('0x50')][_0x3071('0x97')]:_0x19b73d[_0x3071('0x97')];switch(_0x19b73d[_0x3071('0x97')]){case _0x3071('0x98'):_0x4eb2f0=squel[_0x3071('0x99')]()[_0x3071('0x9a')]('cm_hopper')['fromQuery']([_0x3071('0x9b'),_0x3071('0x9c'),_0x3071('0x9d'),_0x3071('0x9e'),_0x3071('0x65'),_0x3071('0x5b'),'updatedAt'],squel[_0x3071('0x9f')]()[_0x3071('0xa0')](_0x3071('0x9b'),_0x3071('0x9b'))[_0x3071('0xa0')](_0x3071('0xa1'),'scheduledAt')[_0x3071('0xa0')]('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')](),_0x3071('0x9e'))['field'](_0x50cb8c['params']['id'][_0x3071('0x86')](),_0x3071('0x65'))['field'](_0x3071('0xa1'),_0x3071('0x5b'))[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x5c'))[_0x3071('0x80')](_0x3071('0xa3'))[_0x3071('0x45')](_0x3071('0xa4'))[_0x3071('0x45')](_0x3071('0xa5'),_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x3071('0x45')](_0x3071('0xa6'),squel[_0x3071('0x9f')]()[_0x3071('0xa0')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x3071('0xa7'))[_0x3071('0x45')](_0x3071('0x83'),_0x50cb8c[_0x3071('0x59')]['id']['toString']()))['where'](_0x3071('0xa6'),squel['select']()[_0x3071('0xa0')](_0x3071('0xa8'))[_0x3071('0x80')](_0x3071('0xa9'))[_0x3071('0x45')](_0x3071('0x83'),_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')]())))[_0x3071('0x86')]();break;case _0x3071('0xaa'):_0x4eb2f0=squel[_0x3071('0x99')]()[_0x3071('0x9a')](_0x3071('0xa9'))[_0x3071('0xab')](['phone',_0x3071('0x9c'),_0x3071('0x9d'),_0x3071('0x9e'),_0x3071('0x65'),_0x3071('0x5b'),_0x3071('0x5c')],squel['select']()[_0x3071('0xa0')]('phone',_0x3071('0x9b'))[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x9c'))['field']('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')](),_0x3071('0x9e'))[_0x3071('0xa0')](_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')](),'VoiceQueueId')[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x5b'))['field'](_0x3071('0xa1'),'updatedAt')[_0x3071('0x80')](_0x3071('0xa3'))[_0x3071('0x45')]('deletedAt\x20IS\x20NULL')['where'](_0x3071('0xa5'),_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')]())[_0x3071('0x45')](_0x3071('0xac'))[_0x3071('0x45')](_0x3071('0xa6'),squel[_0x3071('0x9f')]()[_0x3071('0xa0')](_0x3071('0xa8'))[_0x3071('0x80')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')]())))['toString']();break;default:_0x4eb2f0=squel[_0x3071('0x99')]()[_0x3071('0x9a')](_0x3071('0xa9'))[_0x3071('0xab')]([_0x3071('0x9b'),_0x3071('0x9c'),_0x3071('0x9d'),_0x3071('0x9e'),'VoiceQueueId',_0x3071('0x5b'),_0x3071('0x5c')],squel[_0x3071('0x9f')]()['field'](_0x3071('0x9b'),_0x3071('0x9b'))[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x9c'))['field']('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')](),'ListId')[_0x3071('0xa0')](_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')](),_0x3071('0x65'))[_0x3071('0xa0')]('NOW()',_0x3071('0x5b'))['field']('NOW()',_0x3071('0x5c'))[_0x3071('0x80')](_0x3071('0xa3'))['where'](_0x3071('0xa4'))['where'](_0x3071('0xa5'),_0x35bf60[_0x3071('0xa2')]['toString']())[_0x3071('0x45')](_0x3071('0xac')))[_0x3071('0x86')]();}_0x51e4b1['push'](db[_0x3071('0x74')][_0x3071('0x3c')](_0x4eb2f0));}return BPromise[_0x3071('0x89')](_0x51e4b1);}})[_0x3071('0x2a')](function(){return _0x4d0f2a;})[_0x3071('0x2a')](respondWithResult(_0x13d977,null))[_0x3071('0x4b')](handleError(_0x13d977,null));};exports[_0x3071('0xad')]=function(_0x41f46a,_0x453fa6,_0x80af16){return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x41f46a[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x453fa6,null))[_0x3071('0x2a')](function(_0x18fbc3){if(_0x18fbc3){return _0x18fbc3[_0x3071('0xad')](_0x41f46a[_0x3071('0x3c')][_0x3071('0x8c')]);}})[_0x3071('0x2a')](function(_0x2673a5){if(_0x2673a5){return db['CmHopper'][_0x3071('0x29')]({'where':{'ListId':_0x41f46a[_0x3071('0x3c')]['ids'],'VoiceQueueId':_0x41f46a['params']['id']}})[_0x3071('0x2a')](function(){return _0x2673a5;});}})[_0x3071('0x2a')](respondWithStatusCode(_0x453fa6,null))[_0x3071('0x4b')](handleError(_0x453fa6,null));};exports[_0x3071('0xae')]=function(_0x3d957e,_0x401cc5,_0xb08066){var _0x2f5966={};var _0x58557e={};var _0xc3f6f9;var _0x21f445;return db[_0x3071('0x39')]['findOne']({'where':{'id':_0x3d957e[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x401cc5,null))['then'](function(_0x46f138){if(_0x46f138){_0xc3f6f9=_0x46f138;_0x58557e[_0x3071('0x3b')]=_[_0x3071('0x3d')](db[_0x3071('0xaf')][_0x3071('0x4c')]);_0x58557e[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x3d957e[_0x3071('0x3c')]);_0x58557e[_0x3071('0x3e')]=_['intersection'](_0x58557e['model'],_0x58557e[_0x3071('0x3c')]);_0x2f5966['attributes']=_['intersection'](_0x58557e[_0x3071('0x3b')],qs[_0x3071('0x41')](_0x3d957e[_0x3071('0x3c')][_0x3071('0x41')]));_0x2f5966['attributes']=_0x2f5966['attributes']['length']?_0x2f5966[_0x3071('0x40')]:_0x58557e[_0x3071('0x3b')];_0x2f5966[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x3d957e['query'][_0x3071('0x44')]);_0x2f5966[_0x3071('0x45')]=qs['filters'](_[_0x3071('0x46')](_0x3d957e['query'],_0x58557e['filters']));if(_0x3d957e[_0x3071('0x3c')][_0x3071('0x2f')]){_0x2f5966[_0x3071('0x45')]=_[_0x3071('0x47')](_0x2f5966[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x2f5966['attributes'],function(_0x39bf1d){var _0x1e703b={};_0x1e703b[_0x39bf1d]={'$like':'%'+_0x3d957e[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x1e703b;})});}_0x2f5966=_[_0x3071('0x47')]({},_0x2f5966,_0x3d957e[_0x3071('0x48')]);return _0xc3f6f9[_0x3071('0xae')](_0x2f5966);}})[_0x3071('0x2a')](function(_0x56642a){if(_0x56642a){_0x21f445=_0x56642a[_0x3071('0x42')];if(!_0x3d957e['query'][_0x3071('0x43')](_0x3071('0x61'))){_0x2f5966[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x3d957e['query'][_0x3071('0x24')]);_0x2f5966[_0x3071('0x23')]=qs['offset'](_0x3d957e[_0x3071('0x3c')][_0x3071('0x23')]);}return _0xc3f6f9[_0x3071('0xae')](_0x2f5966);}})[_0x3071('0x2a')](function(_0x46f8cf){if(_0x46f8cf){return _0x46f8cf?{'count':_0x21f445,'rows':_0x46f8cf}:null;}})[_0x3071('0x2a')](respondWithResult(_0x401cc5,null))[_0x3071('0x4b')](handleError(_0x401cc5,null));};exports[_0x3071('0xb0')]=function(_0x2b92f5,_0x369200,_0x4287b4){var _0x43860c,_0x185fef;return db[_0x3071('0x39')]['find']({'where':{'id':_0x2b92f5[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x369200,null))['then'](function(_0x3543bb){if(_0x3543bb){_0x185fef=_0x3543bb;return _0x3543bb[_0x3071('0xb0')](_0x2b92f5['body'][_0x3071('0x8c')],_[_0x3071('0x5a')](_0x2b92f5[_0x3071('0x50')],[_0x3071('0x8c'),'id'])||{});}return null;})[_0x3071('0x90')](function(_0x27a834){var _0x624078;_0x43860c=_0x27a834||[];var _0x911c8c=[];if(_0x27a834){for(var _0x32776b=0x0;_0x32776b<_0x27a834[_0x3071('0x42')];_0x32776b+=0x1){var _0x5a98c7=_0x27a834[_0x32776b]['get']({'plain':!![]});_0x624078=squel[_0x3071('0x99')]()[_0x3071('0x9a')]('cm_hopper_black')[_0x3071('0xab')]([_0x3071('0x9b'),_0x3071('0x9d'),'ListId','VoiceQueueId',_0x3071('0x5b'),_0x3071('0x5c')],squel[_0x3071('0x9f')]()[_0x3071('0xa0')]('phone',_0x3071('0x9b'))['field']('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x5a98c7[_0x3071('0xa2')][_0x3071('0x86')](),'ListId')['field'](_0x2b92f5[_0x3071('0x59')]['id'][_0x3071('0x86')](),_0x3071('0x65'))[_0x3071('0xa0')]('NOW()','createdAt')['field']('NOW()',_0x3071('0x5c'))[_0x3071('0x80')](_0x3071('0xa3'))[_0x3071('0x45')](_0x3071('0xa4'))[_0x3071('0x45')]('ListId\x20=\x20?',_0x5a98c7[_0x3071('0xa2')][_0x3071('0x86')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x3071('0x86')]();_0x911c8c[_0x3071('0x85')](db[_0x3071('0x74')][_0x3071('0x3c')](_0x624078));}return BPromise[_0x3071('0x89')](_0x911c8c);}})['then'](function(){return _0x43860c;})[_0x3071('0x2a')](respondWithResult(_0x369200,null))[_0x3071('0x4b')](handleError(_0x369200,null));};exports['removeBlackLists']=function(_0x2c9ebe,_0x16f73b,_0xb628a){return db[_0x3071('0x39')]['find']({'where':{'id':_0x2c9ebe[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x16f73b,null))[_0x3071('0x2a')](function(_0x57dc29){if(_0x57dc29){return _0x57dc29[_0x3071('0xb1')](_0x2c9ebe[_0x3071('0x3c')][_0x3071('0x8c')]);}})[_0x3071('0x2a')](function(_0x41fb16){if(_0x41fb16){return db[_0x3071('0x68')]['destroy']({'where':{'ListId':_0x2c9ebe[_0x3071('0x3c')]['ids'],'VoiceQueueId':_0x2c9ebe[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](function(){return _0x41fb16;});}})[_0x3071('0x2a')](respondWithStatusCode(_0x16f73b,null))[_0x3071('0x4b')](handleError(_0x16f73b,null));}; \ No newline at end of file +var _0xcb91=['field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','spread','userVoiceQueue:save','push','isArray','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','get','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','UserProfileResource','end','error','name','send','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','rows','catch','show','params','length','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','outbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','role','UserProfileSection','getHoppers','findOne','VoiceQueueId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','removeTeams','ids','select'];(function(_0x2f607a,_0x59541e){var _0x286a07=function(_0x4116a3){while(--_0x4116a3){_0x2f607a['push'](_0x2f607a['shift']());}};_0x286a07(++_0x59541e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0xcb91[_0x422be2];return _0x1b820e;};'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 c5f0dae..5e4ae61 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 _0x34de=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0xaec50c,_0x11cfd1){var _0x15b23d=function(_0x3da97c){while(--_0x3da97c){_0xaec50c['push'](_0xaec50c['shift']());}};_0x15b23d(++_0x11cfd1);}(_0x34de,0x120));var _0xe34d=function(_0x2f0e03,_0x238418){_0x2f0e03=_0x2f0e03-0x0;var _0x1b5588=_0x34de[_0x2f0e03];return _0x1b5588;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xe34d('0x0'))['db'][_0xe34d('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe34d('0x2')](0x0);var events={'afterCreate':_0xe34d('0x3'),'afterUpdate':_0xe34d('0x4'),'afterDestroy':_0xe34d('0x5')};function emitEvent(_0x308e1a){return function(_0x336f0b,_0x42502a,_0x18a0d5){VoiceQueueEvents[_0xe34d('0x6')](_0x308e1a+':'+_0x336f0b['id'],_0x336f0b);VoiceQueueEvents[_0xe34d('0x6')](_0x308e1a,_0x336f0b);_0x18a0d5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xe34d('0x7')](e,emitEvent(event));}}module[_0xe34d('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x8bfa=['save','remove','emit','exports','events','VoiceQueue'];(function(_0x214b0d,_0x433cd7){var _0x70833a=function(_0x132af7){while(--_0x132af7){_0x214b0d['push'](_0x214b0d['shift']());}};_0x70833a(++_0x433cd7);}(_0x8bfa,0x1d2));var _0xa8bf=function(_0x52af0b,_0x580c97){_0x52af0b=_0x52af0b-0x0;var _0x40ed35=_0x8bfa[_0x52af0b];return _0x40ed35;};'use strict';var EventEmitter=require(_0xa8bf('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xa8bf('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8bf('0x2'),'afterUpdate':'update','afterDestroy':_0xa8bf('0x3')};function emitEvent(_0x2d095f){return function(_0x5a3e24,_0x1103cf,_0xf78a8d){VoiceQueueEvents[_0xa8bf('0x4')](_0x2d095f+':'+_0x5a3e24['id'],_0x5a3e24);VoiceQueueEvents[_0xa8bf('0x4')](_0x2d095f,_0x5a3e24);_0xf78a8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xa8bf('0x5')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 6fbc642..5e39857 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 _0x640e=['define','VoiceQueue','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0xe5ebae,_0x3d64f4){var _0x1188bd=function(_0x25df0e){while(--_0x25df0e){_0xe5ebae['push'](_0xe5ebae['shift']());}};_0x1188bd(++_0x3d64f4);}(_0x640e,0xd4));var _0xe640=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0x640e[_0x3a04ab];return _0x4bff6d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe640('0x0'));var moment=require(_0xe640('0x1'));var BPromise=require(_0xe640('0x2'));var rp=require(_0xe640('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe640('0x4'));var config=require(_0xe640('0x5'));var attributes=require(_0xe640('0x6'));module[_0xe640('0x7')]=function(_0x316130,_0x45abe8){return _0x316130[_0xe640('0x8')](_0xe640('0x9'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd37=['path','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xdd37,0xcc));var _0x7dd3=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xdd37[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x7dd3('0x0'));var util=require(_0x7dd3('0x1'));var logger=require(_0x7dd3('0x2'))(_0x7dd3('0x3'));var moment=require(_0x7dd3('0x4'));var BPromise=require('bluebird');var rp=require(_0x7dd3('0x5'));var fs=require('fs');var path=require(_0x7dd3('0x6'));var rimraf=require(_0x7dd3('0x7'));var config=require(_0x7dd3('0x8'));var attributes=require(_0x7dd3('0x9'));module[_0x7dd3('0xa')]=function(_0x200894,_0x482c81){return _0x200894[_0x7dd3('0xb')](_0x7dd3('0xc'),attributes,{'tableName':_0x7dd3('0xd'),'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 b53001c..a645ab2 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 _0xd603=['then','GetVoiceQueue','debug','catch','ShowVoiceQueue','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','info','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueue,\x20%s,\x20%s','message','findAll','options','where','attributes','limit','map','include','model'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xd603,0x1e7));var _0x3d60=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xd603[_0x54edc9];return _0x2ae7a9;};'use strict';var _=require(_0x3d60('0x0'));var util=require(_0x3d60('0x1'));var moment=require(_0x3d60('0x2'));var BPromise=require(_0x3d60('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d60('0x4'));var db=require(_0x3d60('0x5'))['db'];var utils=require(_0x3d60('0x6'));var logger=require(_0x3d60('0x7'))(_0x3d60('0x8'));var config=require(_0x3d60('0x9'));var jayson=require(_0x3d60('0xa'));var client=jayson['client'][_0x3d60('0xb')]({'port':0x232a});config[_0x3d60('0xc')]=_[_0x3d60('0xd')](config[_0x3d60('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d60('0xe'))(new Redis(config[_0x3d60('0xc')]));require(_0x3d60('0xf'))[_0x3d60('0x10')](socket);function respondWithRpcPromise(_0x22679e,_0x57c02b,_0x1b22a9){return new BPromise(function(_0x45f234,_0x2220ca){return client[_0x3d60('0x11')](_0x22679e,_0x1b22a9)['then'](function(_0x29479d){logger[_0x3d60('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x57c02b,_0x3d60('0x13'));logger['debug'](_0x3d60('0x14'),_0x57c02b,_0x3d60('0x13'),JSON[_0x3d60('0x15')](_0x29479d));if(_0x29479d[_0x3d60('0x16')]){if(_0x29479d[_0x3d60('0x16')]['code']===0x1f4){logger[_0x3d60('0x16')](_0x3d60('0x17'),_0x57c02b,_0x29479d['error'][_0x3d60('0x18')]);return _0x2220ca(_0x29479d[_0x3d60('0x16')][_0x3d60('0x18')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x57c02b,_0x29479d['error'][_0x3d60('0x18')]);return _0x45f234(_0x29479d['error'][_0x3d60('0x18')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x57c02b,_0x3d60('0x13'));_0x45f234(_0x29479d['result'][_0x3d60('0x18')]);}})['catch'](function(_0x46264e){logger[_0x3d60('0x16')](_0x3d60('0x17'),_0x57c02b,_0x46264e);_0x2220ca(_0x46264e);});});}exports['GetVoiceQueue']=function(_0x191b27){var _0x4d4244=this;return new Promise(function(_0x457c94,_0x1f4358){return db['VoiceQueue'][_0x3d60('0x19')]({'raw':_0x191b27[_0x3d60('0x1a')]?_0x191b27['options']['raw']===undefined?!![]:![]:!![],'where':_0x191b27[_0x3d60('0x1a')]?_0x191b27[_0x3d60('0x1a')][_0x3d60('0x1b')]||null:null,'attributes':_0x191b27[_0x3d60('0x1a')]?_0x191b27[_0x3d60('0x1a')][_0x3d60('0x1c')]||null:null,'limit':_0x191b27['options']?_0x191b27[_0x3d60('0x1a')][_0x3d60('0x1d')]||null:null,'include':_0x191b27[_0x3d60('0x1a')]?_0x191b27[_0x3d60('0x1a')]['include']?_[_0x3d60('0x1e')](_0x191b27[_0x3d60('0x1a')][_0x3d60('0x1f')],function(_0x220873){return{'model':db[_0x220873['model']],'as':_0x220873['as'],'attributes':_0x220873[_0x3d60('0x1c')],'include':_0x220873[_0x3d60('0x1f')]?_[_0x3d60('0x1e')](_0x220873['include'],function(_0x4b864e){return{'model':db[_0x4b864e[_0x3d60('0x20')]],'as':_0x4b864e['as'],'attributes':_0x4b864e[_0x3d60('0x1c')],'include':_0x4b864e[_0x3d60('0x1f')]?_[_0x3d60('0x1e')](_0x4b864e[_0x3d60('0x1f')],function(_0x40b4ac){return{'model':db[_0x40b4ac[_0x3d60('0x20')]],'as':_0x40b4ac['as'],'attributes':_0x40b4ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d60('0x21')](function(_0x316494){logger[_0x3d60('0x12')](_0x3d60('0x22'),_0x191b27);logger[_0x3d60('0x23')](_0x3d60('0x22'),_0x191b27,JSON[_0x3d60('0x15')](_0x316494));_0x457c94(_0x316494);})[_0x3d60('0x24')](function(_0x420d3b){logger[_0x3d60('0x16')](_0x3d60('0x22'),_0x420d3b[_0x3d60('0x18')],_0x191b27);_0x1f4358(_0x4d4244['error'](0x1f4,_0x420d3b[_0x3d60('0x18')]));});});};exports[_0x3d60('0x25')]=function(_0x4b8ad5){var _0x1579bd=this;return new Promise(function(_0x5bd9fa,_0x14e3c8){return db['VoiceQueue'][_0x3d60('0x26')]({'raw':_0x4b8ad5[_0x3d60('0x1a')]?_0x4b8ad5[_0x3d60('0x1a')][_0x3d60('0x27')]===undefined?!![]:![]:!![],'where':_0x4b8ad5[_0x3d60('0x1a')]?_0x4b8ad5[_0x3d60('0x1a')]['where']||null:null,'attributes':_0x4b8ad5[_0x3d60('0x1a')]?_0x4b8ad5[_0x3d60('0x1a')][_0x3d60('0x1c')]||null:null,'include':_0x4b8ad5['options']?_0x4b8ad5[_0x3d60('0x1a')]['include']?_[_0x3d60('0x1e')](_0x4b8ad5['options']['include'],function(_0x2b409d){return{'model':db[_0x2b409d[_0x3d60('0x20')]],'as':_0x2b409d['as'],'attributes':_0x2b409d[_0x3d60('0x1c')],'include':_0x2b409d[_0x3d60('0x1f')]?_['map'](_0x2b409d[_0x3d60('0x1f')],function(_0x58136c){return{'model':db[_0x58136c[_0x3d60('0x20')]],'as':_0x58136c['as'],'attributes':_0x58136c[_0x3d60('0x1c')],'include':_0x58136c[_0x3d60('0x1f')]?_[_0x3d60('0x1e')](_0x58136c[_0x3d60('0x1f')],function(_0x48a2ae){return{'model':db[_0x48a2ae['model']],'as':_0x48a2ae['as'],'attributes':_0x48a2ae[_0x3d60('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47afc0){logger[_0x3d60('0x12')]('ShowVoiceQueue',_0x4b8ad5);logger['debug'](_0x3d60('0x25'),_0x4b8ad5,JSON[_0x3d60('0x15')](_0x47afc0));_0x5bd9fa(_0x47afc0);})[_0x3d60('0x24')](function(_0x315ca3){logger[_0x3d60('0x16')](_0x3d60('0x25'),_0x315ca3[_0x3d60('0x18')],_0x4b8ad5);_0x14e3c8(_0x1579bd['error'](0x1f4,_0x315ca3[_0x3d60('0x18')]));});});}; \ No newline at end of file +var _0xcf80=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','map','include','model','stringify','catch','find','ShowVoiceQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf80,0x1e4));var _0x0cf8=function(_0x35ecc5,_0x5830e5){_0x35ecc5=_0x35ecc5-0x0;var _0x2ff79d=_0xcf80[_0x35ecc5];return _0x2ff79d;};'use strict';var _=require(_0x0cf8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0cf8('0x1'));var rs=require(_0x0cf8('0x2'));var fs=require('fs');var Redis=require(_0x0cf8('0x3'));var db=require(_0x0cf8('0x4'))['db'];var utils=require(_0x0cf8('0x5'));var logger=require(_0x0cf8('0x6'))(_0x0cf8('0x7'));var config=require(_0x0cf8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0cf8('0x9')][_0x0cf8('0xa')]({'port':0x232a});config[_0x0cf8('0xb')]=_[_0x0cf8('0xc')](config['redis'],{'host':_0x0cf8('0xd'),'port':0x18eb});var socket=require(_0x0cf8('0xe'))(new Redis(config['redis']));require(_0x0cf8('0xf'))[_0x0cf8('0x10')](socket);function respondWithRpcPromise(_0x2d081e,_0x164d90,_0x43aea0){return new BPromise(function(_0x23e4bc,_0x486577){return client[_0x0cf8('0x11')](_0x2d081e,_0x43aea0)[_0x0cf8('0x12')](function(_0x561d89){logger[_0x0cf8('0x13')](_0x0cf8('0x14'),_0x164d90,_0x0cf8('0x15'));logger[_0x0cf8('0x16')](_0x0cf8('0x17'),_0x164d90,_0x0cf8('0x15'),JSON['stringify'](_0x561d89));if(_0x561d89[_0x0cf8('0x18')]){if(_0x561d89[_0x0cf8('0x18')]['code']===0x1f4){logger[_0x0cf8('0x18')](_0x0cf8('0x14'),_0x164d90,_0x561d89['error'][_0x0cf8('0x19')]);return _0x486577(_0x561d89[_0x0cf8('0x18')][_0x0cf8('0x19')]);}logger[_0x0cf8('0x18')](_0x0cf8('0x14'),_0x164d90,_0x561d89['error'][_0x0cf8('0x19')]);return _0x23e4bc(_0x561d89[_0x0cf8('0x18')][_0x0cf8('0x19')]);}else{logger[_0x0cf8('0x13')](_0x0cf8('0x14'),_0x164d90,'request\x20sent');_0x23e4bc(_0x561d89[_0x0cf8('0x1a')][_0x0cf8('0x19')]);}})['catch'](function(_0x6710f0){logger[_0x0cf8('0x18')](_0x0cf8('0x14'),_0x164d90,_0x6710f0);_0x486577(_0x6710f0);});});}exports[_0x0cf8('0x1b')]=function(_0x2e7bb4){var _0xd075b4=this;return new Promise(function(_0x4a1e5b,_0x7a5fa){return db[_0x0cf8('0x1c')]['findAll']({'raw':_0x2e7bb4[_0x0cf8('0x1d')]?_0x2e7bb4[_0x0cf8('0x1d')][_0x0cf8('0x1e')]===undefined?!![]:![]:!![],'where':_0x2e7bb4[_0x0cf8('0x1d')]?_0x2e7bb4[_0x0cf8('0x1d')][_0x0cf8('0x1f')]||null:null,'attributes':_0x2e7bb4['options']?_0x2e7bb4['options'][_0x0cf8('0x20')]||null:null,'limit':_0x2e7bb4['options']?_0x2e7bb4[_0x0cf8('0x1d')][_0x0cf8('0x21')]||null:null,'include':_0x2e7bb4[_0x0cf8('0x1d')]?_0x2e7bb4[_0x0cf8('0x1d')]['include']?_[_0x0cf8('0x22')](_0x2e7bb4[_0x0cf8('0x1d')][_0x0cf8('0x23')],function(_0x326945){return{'model':db[_0x326945['model']],'as':_0x326945['as'],'attributes':_0x326945['attributes'],'include':_0x326945[_0x0cf8('0x23')]?_['map'](_0x326945[_0x0cf8('0x23')],function(_0xfb7bb8){return{'model':db[_0xfb7bb8[_0x0cf8('0x24')]],'as':_0xfb7bb8['as'],'attributes':_0xfb7bb8['attributes'],'include':_0xfb7bb8[_0x0cf8('0x23')]?_[_0x0cf8('0x22')](_0xfb7bb8[_0x0cf8('0x23')],function(_0x2766c1){return{'model':db[_0x2766c1[_0x0cf8('0x24')]],'as':_0x2766c1['as'],'attributes':_0x2766c1[_0x0cf8('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc0b00a){logger[_0x0cf8('0x13')]('GetVoiceQueue',_0x2e7bb4);logger[_0x0cf8('0x16')](_0x0cf8('0x1b'),_0x2e7bb4,JSON[_0x0cf8('0x25')](_0xc0b00a));_0x4a1e5b(_0xc0b00a);})[_0x0cf8('0x26')](function(_0x5b89c2){logger[_0x0cf8('0x18')](_0x0cf8('0x1b'),_0x5b89c2[_0x0cf8('0x19')],_0x2e7bb4);_0x7a5fa(_0xd075b4[_0x0cf8('0x18')](0x1f4,_0x5b89c2[_0x0cf8('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x1698b4){var _0x36a468=this;return new Promise(function(_0x33b396,_0x5ca97b){return db[_0x0cf8('0x1c')][_0x0cf8('0x27')]({'raw':_0x1698b4[_0x0cf8('0x1d')]?_0x1698b4[_0x0cf8('0x1d')][_0x0cf8('0x1e')]===undefined?!![]:![]:!![],'where':_0x1698b4[_0x0cf8('0x1d')]?_0x1698b4['options'][_0x0cf8('0x1f')]||null:null,'attributes':_0x1698b4[_0x0cf8('0x1d')]?_0x1698b4[_0x0cf8('0x1d')][_0x0cf8('0x20')]||null:null,'include':_0x1698b4[_0x0cf8('0x1d')]?_0x1698b4[_0x0cf8('0x1d')][_0x0cf8('0x23')]?_['map'](_0x1698b4['options'][_0x0cf8('0x23')],function(_0x22ea76){return{'model':db[_0x22ea76['model']],'as':_0x22ea76['as'],'attributes':_0x22ea76[_0x0cf8('0x20')],'include':_0x22ea76[_0x0cf8('0x23')]?_[_0x0cf8('0x22')](_0x22ea76[_0x0cf8('0x23')],function(_0x1d7e1b){return{'model':db[_0x1d7e1b['model']],'as':_0x1d7e1b['as'],'attributes':_0x1d7e1b[_0x0cf8('0x20')],'include':_0x1d7e1b[_0x0cf8('0x23')]?_[_0x0cf8('0x22')](_0x1d7e1b[_0x0cf8('0x23')],function(_0x292454){return{'model':db[_0x292454[_0x0cf8('0x24')]],'as':_0x292454['as'],'attributes':_0x292454[_0x0cf8('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x375f2d){logger[_0x0cf8('0x13')](_0x0cf8('0x28'),_0x1698b4);logger[_0x0cf8('0x16')](_0x0cf8('0x28'),_0x1698b4,JSON[_0x0cf8('0x25')](_0x375f2d));_0x33b396(_0x375f2d);})['catch'](function(_0x32a3c3){logger['error'](_0x0cf8('0x28'),_0x32a3c3[_0x0cf8('0x19')],_0x1698b4);_0x5ca97b(_0x36a468[_0x0cf8('0x18')](0x1f4,_0x32a3c3['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index be23264..a801184 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 _0x5d2a=['removeListener','length','voiceQueue:','save','emit'];(function(_0x17553a,_0x462896){var _0x6ebe9e=function(_0x11c33f){while(--_0x11c33f){_0x17553a['push'](_0x17553a['shift']());}};_0x6ebe9e(++_0x462896);}(_0x5d2a,0x139));var _0xa5d2=function(_0x376987,_0x105cdd){_0x376987=_0x376987-0x0;var _0x2e6fa6=_0x5d2a[_0x376987];return _0x2e6fa6;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xa5d2('0x0'),'remove','update'];function createListener(_0x362e9b,_0x159a89){return function(_0xb4fd84){_0x159a89[_0xa5d2('0x1')](_0x362e9b,_0xb4fd84);};}function removeListener(_0x178c5f,_0x11c611){return function(){VoiceQueueEvents[_0xa5d2('0x2')](_0x178c5f,_0x11c611);};}exports['register']=function(_0x373397){for(var _0x43b112=0x0,_0xdafecb=events[_0xa5d2('0x3')];_0x43b112<_0xdafecb;_0x43b112++){var _0x378732=events[_0x43b112];var _0x4d9ded=createListener(_0xa5d2('0x4')+_0x378732,_0x373397);VoiceQueueEvents['on'](_0x378732,_0x4d9ded);}}; \ No newline at end of file +var _0x111c=['remove','emit','removeListener','register','voiceQueue:'];(function(_0x31d7ed,_0x5ba021){var _0x2b6278=function(_0x5e3849){while(--_0x5e3849){_0x31d7ed['push'](_0x31d7ed['shift']());}};_0x2b6278(++_0x5ba021);}(_0x111c,0x11d));var _0xc111=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x111c[_0x5b644e];return _0x49c6bf;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0xc111('0x0'),'update'];function createListener(_0x55ba88,_0x2a29c3){return function(_0x117788){_0x2a29c3[_0xc111('0x1')](_0x55ba88,_0x117788);};}function removeListener(_0x2fdcdd,_0x1e9bc0){return function(){VoiceQueueEvents[_0xc111('0x2')](_0x2fdcdd,_0x1e9bc0);};}exports[_0xc111('0x3')]=function(_0x1d92b3){for(var _0x56c879=0x0,_0x55108f=events['length'];_0x56c879<_0x55108f;_0x56c879++){var _0x11f0bd=events[_0x56c879];var _0xa471df=createListener(_0xc111('0x4')+_0x11f0bd,_0x1d92b3);VoiceQueueEvents['on'](_0x11f0bd,_0xa471df);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 69d6041..7a6f44c 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 _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(_0x47df72,_0x4fea97){var _0xf7803=function(_0x4248ab){while(--_0x4248ab){_0x47df72['push'](_0x47df72['shift']());}};_0xf7803(++_0x4fea97);}(_0x33af,0xec));var _0xf33a=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0x33af[_0x470f24];return _0x2c6fc8;};'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 +var _0x6050=['getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/index','isAuthenticated'];(function(_0x553b76,_0x3aa47b){var _0x398006=function(_0x312e7a){while(--_0x312e7a){_0x553b76['push'](_0x553b76['shift']());}};_0x398006(++_0x3aa47b);}(_0x6050,0x196));var _0x0605=function(_0x8b84aa,_0x5bd6b3){_0x8b84aa=_0x8b84aa-0x0;var _0x31a7b0=_0x6050[_0x8b84aa];return _0x31a7b0;};'use strict';var multer=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var path=require(_0x0605('0x2'));var timeout=require(_0x0605('0x3'));var express=require(_0x0605('0x4'));var router=express[_0x0605('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0605('0x6'));var config=require(_0x0605('0x7'));var controller=require(_0x0605('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0605('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0605('0x9')](_0x0605('0xa'),auth[_0x0605('0xb')](),controller[_0x0605('0xc')]);router[_0x0605('0x9')]('/:id',auth[_0x0605('0xb')](),controller[_0x0605('0xd')]);router[_0x0605('0xe')]('/',auth[_0x0605('0xb')](),controller[_0x0605('0xf')]);router[_0x0605('0x10')](_0x0605('0x11'),auth[_0x0605('0xb')](),controller[_0x0605('0x12')]);router[_0x0605('0x13')](_0x0605('0x11'),auth[_0x0605('0xb')](),controller[_0x0605('0x14')]);module[_0x0605('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 93e27e1..ee689d1 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.attributes.js +++ b/server/api/voiceQueueReport/voiceQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x3b7976,_0x540132){var _0x51fc0f=function(_0x5df4aa){while(--_0x5df4aa){_0x3b7976['push'](_0x3b7976['shift']());}};_0x51fc0f(++_0x540132);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'type':{'type':Sequelize[_0x3071('0x1')]},'uniqueid':{'type':Sequelize[_0x3071('0x1')]},'calleridnum':{'type':Sequelize[_0x3071('0x1')]},'calleridname':{'type':Sequelize[_0x3071('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3071('0x2')],'set':function(_0x33a70c){var _0x3137c8=moment(_0x33a70c);var _0xabd7b6=moment(this[_0x3071('0x3')](_0x3071('0x4')))[_0x3071('0x5')](_0x3071('0x6'));var _0x22274c=_0x3137c8[_0x3071('0x7')](_0xabd7b6,_0x3071('0x8'));this[_0x3071('0x9')]('queuecallerleaveAt',_0x33a70c);this[_0x3071('0x9')](_0x3071('0xa'),_0x22274c||null);}},'position':{'type':Sequelize[_0x3071('0xb')]},'count':{'type':Sequelize[_0x3071('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3071('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3071('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3071('0x1')]},'accountcode':{'type':Sequelize[_0x3071('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3071('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3071('0xb')]},'mohtime':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3071('0x1')]},'transfer':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3071('0x1')],'comment':_0x3071('0xd')},'transferexten':{'type':Sequelize[_0x3071('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3071('0x1')]},'disposition':{'type':Sequelize[_0x3071('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3071('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcb91=['setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0xcb91[_0x12ca5f];return _0xfc3ae9;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1cb9('0x0')]={'type':{'type':Sequelize[_0x1cb9('0x1')]},'uniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'calleridnum':{'type':Sequelize[_0x1cb9('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x13d5fd){var _0x1b26cd=moment(_0x13d5fd);var _0x53ffbd=moment(this[_0x1cb9('0x3')](_0x1cb9('0x4')))['format'](_0x1cb9('0x5'));var _0x12567c=_0x1b26cd['diff'](_0x53ffbd,_0x1cb9('0x6'));this['setDataValue']('queuecallerleaveAt',_0x13d5fd);this[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x12567c||null);}},'position':{'type':Sequelize[_0x1cb9('0x9')]},'count':{'type':Sequelize[_0x1cb9('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexit':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x1cb9('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1cb9('0x1')]},'connectedlinename':{'type':Sequelize[_0x1cb9('0x1')]},'accountcode':{'type':Sequelize[_0x1cb9('0x1')]},'context':{'type':Sequelize[_0x1cb9('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1cb9('0x1')]},'holdtime':{'type':Sequelize[_0x1cb9('0x9')]},'mohtime':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1cb9('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x1cb9('0xb')},'transferexten':{'type':Sequelize[_0x1cb9('0x1')]},'transferuniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'disposition':{'type':Sequelize[_0x1cb9('0x1')]},'secondDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'thirdDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 08973c7..65e3521 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(_0x2128b3,_0x11917d){var _0x4a17be=function(_0x560f27){while(--_0x560f27){_0x2128b3['push'](_0x2128b3['shift']());}};_0x4a17be(++_0x11917d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0xa625a9,_0x1e7a68){var _0x235b91=function(_0x5d59f6){while(--_0x5d59f6){_0xa625a9['push'](_0xa625a9['shift']());}};_0x235b91(++_0x1e7a68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 d016d1e..726ccc0 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 _0x6b29=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x1e4e40,_0x151130){var _0x3fd329=function(_0xf55396){while(--_0xf55396){_0x1e4e40['push'](_0x1e4e40['shift']());}};_0x3fd329(++_0x151130);}(_0x6b29,0xc3));var _0x96b2=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x6b29[_0x2f4c1c];return _0x25e0f2;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x96b2('0x0'))['db'][_0x96b2('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x96b2('0x2')](0x0);var events={'afterCreate':_0x96b2('0x3'),'afterUpdate':_0x96b2('0x4'),'afterDestroy':_0x96b2('0x5')};function emitEvent(_0x52e836){return function(_0x126aa2,_0x185042,_0x53d148){VoiceQueueReportEvents[_0x96b2('0x6')](_0x52e836+':'+_0x126aa2['id'],_0x126aa2);VoiceQueueReportEvents[_0x96b2('0x6')](_0x52e836,_0x126aa2);_0x53d148(null);};}for(var e in events){if(events[_0x96b2('0x7')](e)){var event=events[e];VoiceQueueReport[_0x96b2('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x833e=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x49c888,_0x1a013c){var _0x2d38e2=function(_0x5e2f58){while(--_0x5e2f58){_0x49c888['push'](_0x49c888['shift']());}};_0x2d38e2(++_0x1a013c);}(_0x833e,0x185));var _0xe833=function(_0x228aaa,_0x5e1418){_0x228aaa=_0x228aaa-0x0;var _0x10e124=_0x833e[_0x228aaa];return _0x10e124;};'use strict';var EventEmitter=require(_0xe833('0x0'));var VoiceQueueReport=require(_0xe833('0x1'))['db'][_0xe833('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe833('0x3')](0x0);var events={'afterCreate':_0xe833('0x4'),'afterUpdate':_0xe833('0x5'),'afterDestroy':_0xe833('0x6')};function emitEvent(_0x39f541){return function(_0x48ceeb,_0x5ce5d1,_0x48761b){VoiceQueueReportEvents[_0xe833('0x7')](_0x39f541+':'+_0x48ceeb['id'],_0x48ceeb);VoiceQueueReportEvents['emit'](_0x39f541,_0x48ceeb);_0x48761b(null);};}for(var e in events){if(events[_0xe833('0x8')](e)){var event=events[e];VoiceQueueReport[_0xe833('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index abdf437..91b0ed7 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 _0x2032=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x2032,0xd9));var _0x2203=function(_0x5ec7de,_0x2c22e7){_0x5ec7de=_0x5ec7de-0x0;var _0x46320c=_0x2032[_0x5ec7de];return _0x46320c;};'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 +var _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0x465845,_0x15007c){var _0x314825=function(_0x4f24b8){while(--_0x4f24b8){_0x465845['push'](_0x465845['shift']());}};_0x314825(++_0x15007c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x491641,_0x4e853b){_0x491641=_0x491641-0x0;var _0x59f408=_0x5f2f[_0x491641];return _0x59f408;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf5f2('0xc')]},{'fields':[_0xf5f2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 8684b99..783f9c7 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 _0x4af2=['register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetVoiceQueueReport','findAll','options','raw','where','include','model','map','attributes','CreateVoiceQueueReport','VoiceQueueReport','create','body','debug','UpdateVoiceQueueReport','update','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket'];(function(_0x50f37a,_0x3916de){var _0x35d7a9=function(_0x390260){while(--_0x390260){_0x50f37a['push'](_0x50f37a['shift']());}};_0x35d7a9(++_0x3916de);}(_0x4af2,0x1ca));var _0x24af=function(_0x4e97c0,_0x1c1c6b){_0x4e97c0=_0x4e97c0-0x0;var _0x280e84=_0x4af2[_0x4e97c0];return _0x280e84;};'use strict';var _=require('lodash');var util=require(_0x24af('0x0'));var moment=require(_0x24af('0x1'));var BPromise=require(_0x24af('0x2'));var rs=require(_0x24af('0x3'));var fs=require('fs');var Redis=require(_0x24af('0x4'));var db=require(_0x24af('0x5'))['db'];var utils=require(_0x24af('0x6'));var logger=require('../../config/logger')(_0x24af('0x7'));var config=require('../../config/environment');var jayson=require(_0x24af('0x8'));var client=jayson[_0x24af('0x9')]['http']({'port':0x232a});config[_0x24af('0xa')]=_[_0x24af('0xb')](config[_0x24af('0xa')],{'host':_0x24af('0xc'),'port':0x18eb});var socket=require(_0x24af('0xd'))(new Redis(config[_0x24af('0xa')]));require(_0x24af('0xe'))[_0x24af('0xf')](socket);function respondWithRpcPromise(_0x48d306,_0x488456,_0x231502){return new BPromise(function(_0x5d186c,_0x5b5d2b){return client[_0x24af('0x10')](_0x48d306,_0x231502)[_0x24af('0x11')](function(_0x258b4b){logger[_0x24af('0x12')](_0x24af('0x13'),_0x488456,'request\x20sent');logger['debug'](_0x24af('0x14'),_0x488456,_0x24af('0x15'),JSON[_0x24af('0x16')](_0x258b4b));if(_0x258b4b[_0x24af('0x17')]){if(_0x258b4b[_0x24af('0x17')]['code']===0x1f4){logger['error'](_0x24af('0x13'),_0x488456,_0x258b4b[_0x24af('0x17')][_0x24af('0x18')]);return _0x5b5d2b(_0x258b4b[_0x24af('0x17')]['message']);}logger[_0x24af('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x488456,_0x258b4b[_0x24af('0x17')][_0x24af('0x18')]);return _0x5d186c(_0x258b4b['error']['message']);}else{logger['info'](_0x24af('0x13'),_0x488456,_0x24af('0x15'));_0x5d186c(_0x258b4b['result'][_0x24af('0x18')]);}})[_0x24af('0x19')](function(_0x3c15bc){logger['error'](_0x24af('0x13'),_0x488456,_0x3c15bc);_0x5b5d2b(_0x3c15bc);});});}exports[_0x24af('0x1a')]=function(_0x375e58){var _0xabeb08=this;return new Promise(function(_0x35b6d6,_0x56c945){return db['VoiceQueueReport'][_0x24af('0x1b')]({'raw':_0x375e58[_0x24af('0x1c')]?_0x375e58['options'][_0x24af('0x1d')]===undefined?!![]:![]:!![],'where':_0x375e58['options']?_0x375e58[_0x24af('0x1c')][_0x24af('0x1e')]||null:null,'attributes':_0x375e58[_0x24af('0x1c')]?_0x375e58[_0x24af('0x1c')]['attributes']||null:null,'limit':_0x375e58[_0x24af('0x1c')]?_0x375e58[_0x24af('0x1c')]['limit']||null:null,'include':_0x375e58['options']?_0x375e58[_0x24af('0x1c')][_0x24af('0x1f')]?_['map'](_0x375e58[_0x24af('0x1c')]['include'],function(_0x51090e){return{'model':db[_0x51090e[_0x24af('0x20')]],'as':_0x51090e['as'],'attributes':_0x51090e['attributes'],'include':_0x51090e[_0x24af('0x1f')]?_[_0x24af('0x21')](_0x51090e['include'],function(_0x4f05e7){return{'model':db[_0x4f05e7[_0x24af('0x20')]],'as':_0x4f05e7['as'],'attributes':_0x4f05e7[_0x24af('0x22')],'include':_0x4f05e7[_0x24af('0x1f')]?_[_0x24af('0x21')](_0x4f05e7[_0x24af('0x1f')],function(_0x3b00a8){return{'model':db[_0x3b00a8[_0x24af('0x20')]],'as':_0x3b00a8['as'],'attributes':_0x3b00a8[_0x24af('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32ddf8){logger['info'](_0x24af('0x1a'),_0x375e58);logger['debug']('GetVoiceQueueReport',_0x375e58,JSON[_0x24af('0x16')](_0x32ddf8));_0x35b6d6(_0x32ddf8);})[_0x24af('0x19')](function(_0x28d5a8){logger[_0x24af('0x17')](_0x24af('0x1a'),_0x28d5a8[_0x24af('0x18')],_0x375e58);_0x56c945(_0xabeb08[_0x24af('0x17')](0x1f4,_0x28d5a8['message']));});});};exports[_0x24af('0x23')]=function(_0x1a9a53){var _0xab639=this;return new Promise(function(_0x3675ea,_0x1005a2){return db[_0x24af('0x24')][_0x24af('0x25')](_0x1a9a53[_0x24af('0x26')],{'raw':_0x1a9a53['options']?_0x1a9a53['options'][_0x24af('0x1d')]===undefined?!![]:![]:!![]})[_0x24af('0x11')](function(_0x2b1f13){logger['info'](_0x24af('0x23'),_0x1a9a53);logger[_0x24af('0x27')](_0x24af('0x23'),_0x1a9a53,JSON[_0x24af('0x16')](_0x2b1f13));_0x3675ea(_0x2b1f13);})[_0x24af('0x19')](function(_0x5d69e6){logger[_0x24af('0x17')]('CreateVoiceQueueReport',_0x5d69e6[_0x24af('0x18')],_0x1a9a53);_0x1005a2(_0xab639[_0x24af('0x17')](0x1f4,_0x5d69e6[_0x24af('0x18')]));});});};exports[_0x24af('0x28')]=function(_0x48a039){var _0x4294d8=this;return new Promise(function(_0x332506,_0x5ccc01){return db[_0x24af('0x24')][_0x24af('0x29')](_0x48a039[_0x24af('0x26')],{'raw':_0x48a039[_0x24af('0x1c')]?_0x48a039[_0x24af('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48a039['options']?_0x48a039[_0x24af('0x1c')][_0x24af('0x1e')]||null:null,'attributes':_0x48a039[_0x24af('0x1c')]?_0x48a039[_0x24af('0x1c')][_0x24af('0x22')]||null:null,'limit':_0x48a039[_0x24af('0x1c')]?_0x48a039[_0x24af('0x1c')][_0x24af('0x2a')]||null:null})[_0x24af('0x11')](function(_0x5298ea){logger[_0x24af('0x12')](_0x24af('0x28'),_0x48a039);logger[_0x24af('0x27')](_0x24af('0x28'),_0x48a039,JSON[_0x24af('0x16')](_0x5298ea));_0x332506(_0x5298ea);})[_0x24af('0x19')](function(_0x4a2cc0){logger[_0x24af('0x17')](_0x24af('0x28'),_0x4a2cc0[_0x24af('0x18')],_0x48a039);_0x5ccc01(_0x4294d8[_0x24af('0x17')](0x1f4,_0x4a2cc0[_0x24af('0x18')]));});});}; \ No newline at end of file +var _0xd9e5=['then','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','VoiceQueueReport','findAll','options','where','attributes','limit','map','model','include','info','GetVoiceQueueReport','catch','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request'];(function(_0x5499ab,_0x4c1128){var _0x344478=function(_0x5d767e){while(--_0x5d767e){_0x5499ab['push'](_0x5499ab['shift']());}};_0x344478(++_0x4c1128);}(_0xd9e5,0x1b6));var _0x5d9e=function(_0x3dbfc7,_0x4f6530){_0x3dbfc7=_0x3dbfc7-0x0;var _0x21568a=_0xd9e5[_0x3dbfc7];return _0x21568a;};'use strict';var _=require(_0x5d9e('0x0'));var util=require('util');var moment=require(_0x5d9e('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d9e('0x2'));var fs=require('fs');var Redis=require(_0x5d9e('0x3'));var db=require(_0x5d9e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d9e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5d9e('0x6')]=_[_0x5d9e('0x7')](config[_0x5d9e('0x6')],{'host':_0x5d9e('0x8'),'port':0x18eb});var socket=require(_0x5d9e('0x9'))(new Redis(config[_0x5d9e('0x6')]));require(_0x5d9e('0xa'))[_0x5d9e('0xb')](socket);function respondWithRpcPromise(_0x59192a,_0x3a1ab4,_0x6e0803){return new BPromise(function(_0x1c152e,_0x17ef27){return client[_0x5d9e('0xc')](_0x59192a,_0x6e0803)[_0x5d9e('0xd')](function(_0x36286c){logger['info'](_0x5d9e('0xe'),_0x3a1ab4,'request\x20sent');logger[_0x5d9e('0xf')](_0x5d9e('0x10'),_0x3a1ab4,_0x5d9e('0x11'),JSON[_0x5d9e('0x12')](_0x36286c));if(_0x36286c[_0x5d9e('0x13')]){if(_0x36286c[_0x5d9e('0x13')][_0x5d9e('0x14')]===0x1f4){logger[_0x5d9e('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x3a1ab4,_0x36286c[_0x5d9e('0x13')][_0x5d9e('0x15')]);return _0x17ef27(_0x36286c[_0x5d9e('0x13')][_0x5d9e('0x15')]);}logger[_0x5d9e('0x13')](_0x5d9e('0xe'),_0x3a1ab4,_0x36286c[_0x5d9e('0x13')][_0x5d9e('0x15')]);return _0x1c152e(_0x36286c[_0x5d9e('0x13')][_0x5d9e('0x15')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x3a1ab4,'request\x20sent');_0x1c152e(_0x36286c[_0x5d9e('0x16')]['message']);}})['catch'](function(_0x2b7241){logger[_0x5d9e('0x13')](_0x5d9e('0xe'),_0x3a1ab4,_0x2b7241);_0x17ef27(_0x2b7241);});});}exports['GetVoiceQueueReport']=function(_0xd2ae69){var _0x30a092=this;return new Promise(function(_0x344efa,_0xc2a08c){return db[_0x5d9e('0x17')][_0x5d9e('0x18')]({'raw':_0xd2ae69['options']?_0xd2ae69[_0x5d9e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xd2ae69[_0x5d9e('0x19')]?_0xd2ae69[_0x5d9e('0x19')][_0x5d9e('0x1a')]||null:null,'attributes':_0xd2ae69[_0x5d9e('0x19')]?_0xd2ae69[_0x5d9e('0x19')][_0x5d9e('0x1b')]||null:null,'limit':_0xd2ae69[_0x5d9e('0x19')]?_0xd2ae69[_0x5d9e('0x19')][_0x5d9e('0x1c')]||null:null,'include':_0xd2ae69['options']?_0xd2ae69[_0x5d9e('0x19')]['include']?_[_0x5d9e('0x1d')](_0xd2ae69[_0x5d9e('0x19')]['include'],function(_0x3e1851){return{'model':db[_0x3e1851[_0x5d9e('0x1e')]],'as':_0x3e1851['as'],'attributes':_0x3e1851[_0x5d9e('0x1b')],'include':_0x3e1851['include']?_[_0x5d9e('0x1d')](_0x3e1851[_0x5d9e('0x1f')],function(_0x1b2f00){return{'model':db[_0x1b2f00[_0x5d9e('0x1e')]],'as':_0x1b2f00['as'],'attributes':_0x1b2f00[_0x5d9e('0x1b')],'include':_0x1b2f00[_0x5d9e('0x1f')]?_[_0x5d9e('0x1d')](_0x1b2f00['include'],function(_0x44d354){return{'model':db[_0x44d354[_0x5d9e('0x1e')]],'as':_0x44d354['as'],'attributes':_0x44d354[_0x5d9e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1076f8){logger[_0x5d9e('0x20')](_0x5d9e('0x21'),_0xd2ae69);logger[_0x5d9e('0xf')](_0x5d9e('0x21'),_0xd2ae69,JSON[_0x5d9e('0x12')](_0x1076f8));_0x344efa(_0x1076f8);})[_0x5d9e('0x22')](function(_0x1c3749){logger['error'](_0x5d9e('0x21'),_0x1c3749[_0x5d9e('0x15')],_0xd2ae69);_0xc2a08c(_0x30a092[_0x5d9e('0x13')](0x1f4,_0x1c3749['message']));});});};exports[_0x5d9e('0x23')]=function(_0x213ae1){var _0x188d95=this;return new Promise(function(_0x4927b1,_0xba1ddf){return db[_0x5d9e('0x17')][_0x5d9e('0x24')](_0x213ae1[_0x5d9e('0x25')],{'raw':_0x213ae1[_0x5d9e('0x19')]?_0x213ae1[_0x5d9e('0x19')][_0x5d9e('0x26')]===undefined?!![]:![]:!![]})[_0x5d9e('0xd')](function(_0x253c42){logger[_0x5d9e('0x20')]('CreateVoiceQueueReport',_0x213ae1);logger[_0x5d9e('0xf')](_0x5d9e('0x23'),_0x213ae1,JSON[_0x5d9e('0x12')](_0x253c42));_0x4927b1(_0x253c42);})[_0x5d9e('0x22')](function(_0x2b7403){logger[_0x5d9e('0x13')](_0x5d9e('0x23'),_0x2b7403['message'],_0x213ae1);_0xba1ddf(_0x188d95[_0x5d9e('0x13')](0x1f4,_0x2b7403[_0x5d9e('0x15')]));});});};exports[_0x5d9e('0x27')]=function(_0x4718a3){var _0x303244=this;return new Promise(function(_0x15e568,_0x484e79){return db[_0x5d9e('0x17')][_0x5d9e('0x28')](_0x4718a3['body'],{'raw':_0x4718a3[_0x5d9e('0x19')]?_0x4718a3[_0x5d9e('0x19')][_0x5d9e('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4718a3['options']?_0x4718a3[_0x5d9e('0x19')][_0x5d9e('0x1a')]||null:null,'attributes':_0x4718a3[_0x5d9e('0x19')]?_0x4718a3['options'][_0x5d9e('0x1b')]||null:null,'limit':_0x4718a3[_0x5d9e('0x19')]?_0x4718a3['options'][_0x5d9e('0x1c')]||null:null})[_0x5d9e('0xd')](function(_0x784e04){logger[_0x5d9e('0x20')](_0x5d9e('0x27'),_0x4718a3);logger[_0x5d9e('0xf')]('UpdateVoiceQueueReport',_0x4718a3,JSON[_0x5d9e('0x12')](_0x784e04));_0x15e568(_0x784e04);})[_0x5d9e('0x22')](function(_0x28a562){logger[_0x5d9e('0x13')](_0x5d9e('0x27'),_0x28a562[_0x5d9e('0x15')],_0x4718a3);_0x484e79(_0x303244[_0x5d9e('0x13')](0x1f4,_0x28a562[_0x5d9e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 8005127..590e02c 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 _0x3f32=['voiceQueueReport:','./voiceQueueReport.events','save','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3f32,0x1e5));var _0x23f3=function(_0x487524,_0x292ba6){_0x487524=_0x487524-0x0;var _0x3f3543=_0x3f32[_0x487524];return _0x3f3543;};'use strict';var VoiceQueueReportEvents=require(_0x23f3('0x0'));var events=[_0x23f3('0x1'),'remove','update'];function createListener(_0x832e75,_0x5c87a5){return function(_0x5087b4){_0x5c87a5['emit'](_0x832e75,_0x5087b4);};}function removeListener(_0xf83a80,_0x850fb3){return function(){VoiceQueueReportEvents['removeListener'](_0xf83a80,_0x850fb3);};}exports['register']=function(_0x1684ec){for(var _0x1180b2=0x0,_0x4a3e2c=events[_0x23f3('0x2')];_0x1180b2<_0x4a3e2c;_0x1180b2++){var _0x553e6c=events[_0x1180b2];var _0x111d29=createListener(_0x23f3('0x3')+_0x553e6c,_0x1684ec);VoiceQueueReportEvents['on'](_0x553e6c,_0x111d29);}}; \ No newline at end of file +var _0xcc66=['length','voiceQueueReport:','save','remove','update','emit','removeListener','register'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0xcc66,0x122));var _0x6cc6=function(_0x34dd5e,_0xf839fd){_0x34dd5e=_0x34dd5e-0x0;var _0x5df57e=_0xcc66[_0x34dd5e];return _0x5df57e;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x6cc6('0x0'),_0x6cc6('0x1'),_0x6cc6('0x2')];function createListener(_0x5017bb,_0x35c7bd){return function(_0x558f98){_0x35c7bd[_0x6cc6('0x3')](_0x5017bb,_0x558f98);};}function removeListener(_0x1f9719,_0x42f718){return function(){VoiceQueueReportEvents[_0x6cc6('0x4')](_0x1f9719,_0x42f718);};}exports[_0x6cc6('0x5')]=function(_0x35aaa4){for(var _0x36d030=0x0,_0xee1c4e=events[_0x6cc6('0x6')];_0x36d030<_0xee1c4e;_0x36d030++){var _0x56c1c5=events[_0x36d030];var _0x1dbd99=createListener(_0x6cc6('0x7')+_0x56c1c5,_0x35aaa4);VoiceQueueReportEvents['on'](_0x56c1c5,_0x1dbd99);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 2c7df35..252751c 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 _0xa97a=['/:id','show','create','update','delete','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get'];(function(_0x2590f2,_0x54ecb1){var _0x2c6f89=function(_0x1d948b){while(--_0x1d948b){_0x2590f2['push'](_0x2590f2['shift']());}};_0x2c6f89(++_0x54ecb1);}(_0xa97a,0x166));var _0xaa97=function(_0x5c22a0,_0x392a95){_0x5c22a0=_0x5c22a0-0x0;var _0x12d21b=_0xa97a[_0x5c22a0];return _0x12d21b;};'use strict';var multer=require(_0xaa97('0x0'));var util=require(_0xaa97('0x1'));var path=require('path');var timeout=require(_0xaa97('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xaa97('0x3'));var interaction=require(_0xaa97('0x4'));var config=require(_0xaa97('0x5'));var controller=require(_0xaa97('0x6'));router['get']('/',auth[_0xaa97('0x7')](),controller[_0xaa97('0x8')]);router[_0xaa97('0x9')](_0xaa97('0xa'),auth[_0xaa97('0x7')](),controller[_0xaa97('0xb')]);router['post']('/',auth[_0xaa97('0x7')](),controller[_0xaa97('0xc')]);router['put'](_0xaa97('0xa'),auth[_0xaa97('0x7')](),controller[_0xaa97('0xd')]);router[_0xaa97('0xe')](_0xaa97('0xa'),auth['isAuthenticated'](),controller[_0xaa97('0xf')]);module['exports']=router; \ No newline at end of file +var _0x19a2=['post','create','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show'];(function(_0xb60ae4,_0x48b458){var _0x53d530=function(_0x5c0743){while(--_0x5c0743){_0xb60ae4['push'](_0xb60ae4['shift']());}};_0x53d530(++_0x48b458);}(_0x19a2,0x126));var _0x219a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x19a2[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x219a('0x0'));var util=require(_0x219a('0x1'));var path=require(_0x219a('0x2'));var timeout=require('connect-timeout');var express=require(_0x219a('0x3'));var router=express[_0x219a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x219a('0x5'));var config=require('../../config/environment');var controller=require(_0x219a('0x6'));router[_0x219a('0x7')]('/',auth[_0x219a('0x8')](),controller[_0x219a('0x9')]);router[_0x219a('0x7')](_0x219a('0xa'),auth[_0x219a('0x8')](),controller[_0x219a('0xb')]);router[_0x219a('0xc')]('/',auth[_0x219a('0x8')](),controller[_0x219a('0xd')]);router['put'](_0x219a('0xa'),auth[_0x219a('0x8')](),controller[_0x219a('0xe')]);router[_0x219a('0xf')](_0x219a('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x219a('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index c98f9d5..6e93b50 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 _0x3ca4=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING','DATE','format'];(function(_0x4f04e8,_0x5e3c43){var _0x20c11d=function(_0x1bb27d){while(--_0x1bb27d){_0x4f04e8['push'](_0x4f04e8['shift']());}};_0x20c11d(++_0x5e3c43);}(_0x3ca4,0x73));var _0x43ca=function(_0x420297,_0x57337c){_0x420297=_0x420297-0x0;var _0x2f76a8=_0x3ca4[_0x420297];return _0x2f76a8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x43ca('0x0'));module[_0x43ca('0x1')]={'time':{'type':Sequelize[_0x43ca('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x43ca('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x43ca('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x43ca('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x43ca('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x43ca('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x43ca('0x3')],'allowNull':![],'defaultValue':moment()[_0x43ca('0x4')](_0x43ca('0x5'))}}; \ No newline at end of file +var _0xb150=['format','sequelize','moment','exports','STRING','DATE'];(function(_0x569277,_0x51e86a){var _0x1aea32=function(_0x329c06){while(--_0x329c06){_0x569277['push'](_0x569277['shift']());}};_0x1aea32(++_0x51e86a);}(_0xb150,0x19f));var _0x0b15=function(_0x5d494c,_0x275345){_0x5d494c=_0x5d494c-0x0;var _0x4c14c6=_0xb150[_0x5d494c];return _0x4c14c6;};'use strict';var Sequelize=require(_0x0b15('0x0'));var moment=require(_0x0b15('0x1'));module[_0x0b15('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x0b15('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0b15('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0b15('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x0b15('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0b15('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0b15('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0b15('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0b15('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0b15('0x4')],'allowNull':![],'defaultValue':moment()[_0x0b15('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 144943f..19b2834 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 _0x9d5d=['apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','findAll','rows','catch','show','params','includeAll','include','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range'];(function(_0x3861e5,_0x1b9277){var _0x143e24=function(_0x101917){while(--_0x101917){_0x3861e5['push'](_0x3861e5['shift']());}};_0x143e24(++_0x1b9277);}(_0x9d5d,0xb9));var _0xd9d5=function(_0x45db74,_0x51c68a){_0x45db74=_0x45db74-0x0;var _0x4bc2f2=_0x9d5d[_0x45db74];return _0x4bc2f2;};'use strict';var pdf=require(_0xd9d5('0x0'));var emlformat=require(_0xd9d5('0x1'));var rimraf=require(_0xd9d5('0x2'));var zipdir=require(_0xd9d5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9d5('0x4'));var moment=require('moment');var BPromise=require(_0xd9d5('0x5'));var Mustache=require('mustache');var util=require(_0xd9d5('0x6'));var path=require('path');var sox=require(_0xd9d5('0x7'));var csv=require(_0xd9d5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd9d5('0x9'));var squel=require('squel');var crypto=require(_0xd9d5('0xa'));var jsforce=require(_0xd9d5('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd9d5('0xc'));var Papa=require('papaparse');var Redis=require(_0xd9d5('0xd'));var authService=require(_0xd9d5('0xe'));var qs=require(_0xd9d5('0xf'));var as=require(_0xd9d5('0x10'));var hardwareService=require(_0xd9d5('0x11'));var logger=require(_0xd9d5('0x12'))('api');var utils=require(_0xd9d5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd9d5('0x14'));var db=require(_0xd9d5('0x15'))['db'];function respondWithStatusCode(_0x4417b1,_0x14f84e){_0x14f84e=_0x14f84e||0xcc;return function(_0x58ee60){if(_0x58ee60){return _0x4417b1[_0xd9d5('0x16')](_0x14f84e);}return _0x4417b1['status'](_0x14f84e)[_0xd9d5('0x17')]();};}function respondWithResult(_0x454ca8,_0x45e08c){_0x45e08c=_0x45e08c||0xc8;return function(_0x10cb68){if(_0x10cb68){return _0x454ca8[_0xd9d5('0x18')](_0x45e08c)[_0xd9d5('0x19')](_0x10cb68);}};}function respondWithFilteredResult(_0x3de690,_0x442a14){return function(_0x8f4f1c){if(_0x8f4f1c){var _0x7d0d87=_0x8f4f1c[_0xd9d5('0x1a')],_0x3316e7=_0x442a14[_0xd9d5('0x1b')],_0x1cb90d=_0x442a14['offset']+_0x442a14[_0xd9d5('0x1c')],_0x838222;if(_0x1cb90d>=_0x7d0d87){_0x1cb90d=_0x7d0d87;_0x838222=0xc8;}else{_0x838222=0xce;}_0x3de690['status'](_0x838222);return _0x3de690[_0xd9d5('0x1d')](_0xd9d5('0x1e'),_0x3316e7+'-'+_0x1cb90d+'/'+_0x7d0d87)[_0xd9d5('0x19')](_0x8f4f1c);}return null;};}function patchUpdates(_0x1b6503){return function(_0x51f577){try{jsonpatch[_0xd9d5('0x1f')](_0x51f577,_0x1b6503,!![]);}catch(_0x5cce22){return BPromise[_0xd9d5('0x20')](_0x5cce22);}return _0x51f577[_0xd9d5('0x21')]();};}function saveUpdates(_0x640b22,_0xd29fa5){return function(_0x5a3d0d){if(_0x5a3d0d){return _0x5a3d0d[_0xd9d5('0x22')](_0x640b22)['then'](function(_0x113034){return _0x113034;});}return null;};}function removeEntity(_0x58436c,_0xc46504){return function(_0xdb64b6){if(_0xdb64b6){return _0xdb64b6[_0xd9d5('0x23')]()[_0xd9d5('0x24')](function(){_0x58436c[_0xd9d5('0x18')](0xcc)[_0xd9d5('0x17')]();});}};}function handleEntityNotFound(_0xe14362,_0x336c5e){return function(_0x49e238){if(!_0x49e238){_0xe14362[_0xd9d5('0x16')](0x194);}return _0x49e238;};}function handleError(_0x41d54a,_0x5441c3){_0x5441c3=_0x5441c3||0x1f4;return function(_0x544572){logger[_0xd9d5('0x25')](_0x544572[_0xd9d5('0x26')]);if(_0x544572[_0xd9d5('0x27')]){delete _0x544572[_0xd9d5('0x27')];}_0x41d54a['status'](_0x5441c3)[_0xd9d5('0x28')](_0x544572);};}exports[_0xd9d5('0x29')]=function(_0x13b6d5,_0x11c7ba){var _0x9d7ec9={},_0xfae0a2={},_0x4ea949={'count':0x0,'rows':[]};var _0x54d326=_[_0xd9d5('0x2a')](db[_0xd9d5('0x2b')]['rawAttributes'],function(_0x339ca8){return{'name':_0x339ca8[_0xd9d5('0x2c')],'type':_0x339ca8[_0xd9d5('0x2d')]['key']};});_0xfae0a2[_0xd9d5('0x2e')]=_['map'](_0x54d326,_0xd9d5('0x27'));_0xfae0a2[_0xd9d5('0x2f')]=_[_0xd9d5('0x30')](_0x13b6d5[_0xd9d5('0x2f')]);_0xfae0a2[_0xd9d5('0x31')]=_[_0xd9d5('0x32')](_0xfae0a2[_0xd9d5('0x2e')],_0xfae0a2['query']);_0x9d7ec9[_0xd9d5('0x33')]=_['intersection'](_0xfae0a2[_0xd9d5('0x2e')],qs['fields'](_0x13b6d5[_0xd9d5('0x2f')][_0xd9d5('0x34')]));_0x9d7ec9[_0xd9d5('0x33')]=_0x9d7ec9[_0xd9d5('0x33')][_0xd9d5('0x35')]?_0x9d7ec9[_0xd9d5('0x33')]:_0xfae0a2['model'];if(!_0x13b6d5['query'][_0xd9d5('0x36')](_0xd9d5('0x37'))){_0x9d7ec9['limit']=qs[_0xd9d5('0x1c')](_0x13b6d5['query'][_0xd9d5('0x1c')]);_0x9d7ec9[_0xd9d5('0x1b')]=qs[_0xd9d5('0x1b')](_0x13b6d5['query'][_0xd9d5('0x1b')]);}_0x9d7ec9[_0xd9d5('0x38')]=qs[_0xd9d5('0x39')](_0x13b6d5[_0xd9d5('0x2f')][_0xd9d5('0x39')]);_0x9d7ec9[_0xd9d5('0x3a')]=qs[_0xd9d5('0x31')](_['pick'](_0x13b6d5[_0xd9d5('0x2f')],_0xfae0a2[_0xd9d5('0x31')]),_0x54d326);if(_0x13b6d5[_0xd9d5('0x2f')][_0xd9d5('0x3b')]){_0x9d7ec9[_0xd9d5('0x3a')]=_[_0xd9d5('0x3c')](_0x9d7ec9[_0xd9d5('0x3a')],{'$or':_[_0xd9d5('0x2a')](_0x54d326,function(_0x42e418){if(_0x42e418[_0xd9d5('0x2d')]!=='VIRTUAL'){var _0x45e1ed={};_0x45e1ed[_0x42e418[_0xd9d5('0x27')]]={'$like':'%'+_0x13b6d5[_0xd9d5('0x2f')]['filter']+'%'};return _0x45e1ed;}})});}_0x9d7ec9=_['merge']({},_0x9d7ec9,_0x13b6d5[_0xd9d5('0x3d')]);var _0x295978={'where':_0x9d7ec9['where']};return db[_0xd9d5('0x2b')][_0xd9d5('0x1a')](_0x295978)['then'](function(_0x216365){_0x4ea949[_0xd9d5('0x1a')]=_0x216365;if(_0x13b6d5[_0xd9d5('0x2f')]['includeAll']){_0x9d7ec9['include']=[{'all':!![]}];}return db[_0xd9d5('0x2b')][_0xd9d5('0x3e')](_0x9d7ec9);})[_0xd9d5('0x24')](function(_0x16c75d){_0x4ea949[_0xd9d5('0x3f')]=_0x16c75d;return _0x4ea949;})[_0xd9d5('0x24')](respondWithFilteredResult(_0x11c7ba,_0x9d7ec9))[_0xd9d5('0x40')](handleError(_0x11c7ba,null));};exports[_0xd9d5('0x41')]=function(_0x3cf4b7,_0x5a6009){var _0x5f78df={'raw':!![],'where':{'id':_0x3cf4b7[_0xd9d5('0x42')]['id']}},_0x412841={};_0x412841['model']=_[_0xd9d5('0x30')](db[_0xd9d5('0x2b')]['rawAttributes']);_0x412841[_0xd9d5('0x2f')]=_[_0xd9d5('0x30')](_0x3cf4b7[_0xd9d5('0x2f')]);_0x412841[_0xd9d5('0x31')]=_[_0xd9d5('0x32')](_0x412841[_0xd9d5('0x2e')],_0x412841['query']);_0x5f78df[_0xd9d5('0x33')]=_[_0xd9d5('0x32')](_0x412841[_0xd9d5('0x2e')],qs[_0xd9d5('0x34')](_0x3cf4b7['query'][_0xd9d5('0x34')]));_0x5f78df[_0xd9d5('0x33')]=_0x5f78df['attributes']['length']?_0x5f78df['attributes']:_0x412841['model'];if(_0x3cf4b7[_0xd9d5('0x2f')][_0xd9d5('0x43')]){_0x5f78df[_0xd9d5('0x44')]=[{'all':!![]}];}_0x5f78df=_[_0xd9d5('0x3c')]({},_0x5f78df,_0x3cf4b7['options']);return db[_0xd9d5('0x2b')]['find'](_0x5f78df)[_0xd9d5('0x24')](handleEntityNotFound(_0x5a6009,null))[_0xd9d5('0x24')](respondWithResult(_0x5a6009,null))[_0xd9d5('0x40')](handleError(_0x5a6009,null));};exports['create']=function(_0x3defb6,_0x5b66aa){return db[_0xd9d5('0x2b')][_0xd9d5('0x45')](_0x3defb6[_0xd9d5('0x46')],{})[_0xd9d5('0x24')](respondWithResult(_0x5b66aa,0xc9))[_0xd9d5('0x40')](handleError(_0x5b66aa,null));};exports[_0xd9d5('0x22')]=function(_0x3a29ea,_0x54b897){if(_0x3a29ea['body']['id']){delete _0x3a29ea[_0xd9d5('0x46')]['id'];}return db[_0xd9d5('0x2b')][_0xd9d5('0x47')]({'where':{'id':_0x3a29ea[_0xd9d5('0x42')]['id']}})['then'](handleEntityNotFound(_0x54b897,null))[_0xd9d5('0x24')](saveUpdates(_0x3a29ea[_0xd9d5('0x46')],null))['then'](respondWithResult(_0x54b897,null))[_0xd9d5('0x40')](handleError(_0x54b897,null));};exports[_0xd9d5('0x23')]=function(_0x5277e7,_0x5ca956){return db['VoiceQueuesLog']['find']({'where':{'id':_0x5277e7['params']['id']}})[_0xd9d5('0x24')](handleEntityNotFound(_0x5ca956,null))['then'](removeEntity(_0x5ca956,null))[_0xd9d5('0x40')](handleError(_0x5ca956,null));}; \ No newline at end of file +var _0xbe8d=['where','pick','filter','merge','VIRTUAL','options','include','rows','includeAll','find','catch','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','VoiceQueuesLog','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0x4711be,_0x452340){var _0x95ed0c=function(_0x21c935){while(--_0x21c935){_0x4711be['push'](_0x4711be['shift']());}};_0x95ed0c(++_0x452340);}(_0xbe8d,0xe0));var _0xdbe8=function(_0x2570b1,_0x3fed7f){_0x2570b1=_0x2570b1-0x0;var _0x5b4e74=_0xbe8d[_0x2570b1];return _0x5b4e74;};'use strict';var pdf=require(_0xdbe8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdbe8('0x1'));var zipdir=require(_0xdbe8('0x2'));var jsonpatch=require(_0xdbe8('0x3'));var rp=require(_0xdbe8('0x4'));var moment=require('moment');var BPromise=require(_0xdbe8('0x5'));var Mustache=require('mustache');var util=require(_0xdbe8('0x6'));var path=require(_0xdbe8('0x7'));var sox=require(_0xdbe8('0x8'));var csv=require(_0xdbe8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdbe8('0xa'));var squel=require(_0xdbe8('0xb'));var crypto=require(_0xdbe8('0xc'));var jsforce=require(_0xdbe8('0xd'));var deskjs=require(_0xdbe8('0xe'));var toCsv=require(_0xdbe8('0x9'));var querystring=require(_0xdbe8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbe8('0x10'));var qs=require(_0xdbe8('0x11'));var as=require(_0xdbe8('0x12'));var hardwareService=require(_0xdbe8('0x13'));var logger=require('../../config/logger')(_0xdbe8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdbe8('0x15'));var db=require(_0xdbe8('0x16'))['db'];function respondWithStatusCode(_0x428d74,_0x22edbf){_0x22edbf=_0x22edbf||0xcc;return function(_0x3b0542){if(_0x3b0542){return _0x428d74[_0xdbe8('0x17')](_0x22edbf);}return _0x428d74[_0xdbe8('0x18')](_0x22edbf)[_0xdbe8('0x19')]();};}function respondWithResult(_0x62280a,_0x50a3ee){_0x50a3ee=_0x50a3ee||0xc8;return function(_0x1dd5ed){if(_0x1dd5ed){return _0x62280a[_0xdbe8('0x18')](_0x50a3ee)['json'](_0x1dd5ed);}};}function respondWithFilteredResult(_0x553d8f,_0x307d0c){return function(_0x4288b8){if(_0x4288b8){var _0xfd0597=_0x4288b8[_0xdbe8('0x1a')],_0x206111=_0x307d0c['offset'],_0x4a2d7a=_0x307d0c[_0xdbe8('0x1b')]+_0x307d0c[_0xdbe8('0x1c')],_0x38b891;if(_0x4a2d7a>=_0xfd0597){_0x4a2d7a=_0xfd0597;_0x38b891=0xc8;}else{_0x38b891=0xce;}_0x553d8f[_0xdbe8('0x18')](_0x38b891);return _0x553d8f[_0xdbe8('0x1d')](_0xdbe8('0x1e'),_0x206111+'-'+_0x4a2d7a+'/'+_0xfd0597)['json'](_0x4288b8);}return null;};}function patchUpdates(_0x1c8f88){return function(_0x139838){try{jsonpatch[_0xdbe8('0x1f')](_0x139838,_0x1c8f88,!![]);}catch(_0x42c4aa){return BPromise[_0xdbe8('0x20')](_0x42c4aa);}return _0x139838[_0xdbe8('0x21')]();};}function saveUpdates(_0x42b5e0,_0x426ce2){return function(_0x2d9821){if(_0x2d9821){return _0x2d9821[_0xdbe8('0x22')](_0x42b5e0)[_0xdbe8('0x23')](function(_0x838ffe){return _0x838ffe;});}return null;};}function removeEntity(_0xb04b27,_0x59b515){return function(_0x3cd50c){if(_0x3cd50c){return _0x3cd50c[_0xdbe8('0x24')]()['then'](function(){_0xb04b27[_0xdbe8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cc58f,_0x3f6663){return function(_0x37ecbf){if(!_0x37ecbf){_0x1cc58f[_0xdbe8('0x17')](0x194);}return _0x37ecbf;};}function handleError(_0x1c01c1,_0x938c66){_0x938c66=_0x938c66||0x1f4;return function(_0x38ae3c){logger[_0xdbe8('0x25')](_0x38ae3c['stack']);if(_0x38ae3c['name']){delete _0x38ae3c[_0xdbe8('0x26')];}_0x1c01c1[_0xdbe8('0x18')](_0x938c66)[_0xdbe8('0x27')](_0x38ae3c);};}exports[_0xdbe8('0x28')]=function(_0x2e31d1,_0x9f4226){var _0xdcf292={},_0x481c1f={},_0xa00e1e={'count':0x0,'rows':[]};var _0x3ea841=_['map'](db[_0xdbe8('0x29')]['rawAttributes'],function(_0x493643){return{'name':_0x493643[_0xdbe8('0x2a')],'type':_0x493643[_0xdbe8('0x2b')]['key']};});_0x481c1f[_0xdbe8('0x2c')]=_[_0xdbe8('0x2d')](_0x3ea841,'name');_0x481c1f[_0xdbe8('0x2e')]=_[_0xdbe8('0x2f')](_0x2e31d1['query']);_0x481c1f[_0xdbe8('0x30')]=_[_0xdbe8('0x31')](_0x481c1f['model'],_0x481c1f['query']);_0xdcf292['attributes']=_[_0xdbe8('0x31')](_0x481c1f[_0xdbe8('0x2c')],qs[_0xdbe8('0x32')](_0x2e31d1[_0xdbe8('0x2e')][_0xdbe8('0x32')]));_0xdcf292[_0xdbe8('0x33')]=_0xdcf292[_0xdbe8('0x33')][_0xdbe8('0x34')]?_0xdcf292['attributes']:_0x481c1f[_0xdbe8('0x2c')];if(!_0x2e31d1['query'][_0xdbe8('0x35')]('nolimit')){_0xdcf292[_0xdbe8('0x1c')]=qs[_0xdbe8('0x1c')](_0x2e31d1['query'][_0xdbe8('0x1c')]);_0xdcf292['offset']=qs[_0xdbe8('0x1b')](_0x2e31d1[_0xdbe8('0x2e')]['offset']);}_0xdcf292[_0xdbe8('0x36')]=qs[_0xdbe8('0x37')](_0x2e31d1[_0xdbe8('0x2e')][_0xdbe8('0x37')]);_0xdcf292[_0xdbe8('0x38')]=qs[_0xdbe8('0x30')](_[_0xdbe8('0x39')](_0x2e31d1[_0xdbe8('0x2e')],_0x481c1f[_0xdbe8('0x30')]),_0x3ea841);if(_0x2e31d1['query'][_0xdbe8('0x3a')]){_0xdcf292[_0xdbe8('0x38')]=_[_0xdbe8('0x3b')](_0xdcf292[_0xdbe8('0x38')],{'$or':_[_0xdbe8('0x2d')](_0x3ea841,function(_0x2e44ae){if(_0x2e44ae[_0xdbe8('0x2b')]!==_0xdbe8('0x3c')){var _0x176b43={};_0x176b43[_0x2e44ae[_0xdbe8('0x26')]]={'$like':'%'+_0x2e31d1[_0xdbe8('0x2e')][_0xdbe8('0x3a')]+'%'};return _0x176b43;}})});}_0xdcf292=_[_0xdbe8('0x3b')]({},_0xdcf292,_0x2e31d1[_0xdbe8('0x3d')]);var _0x15d549={'where':_0xdcf292[_0xdbe8('0x38')]};return db[_0xdbe8('0x29')][_0xdbe8('0x1a')](_0x15d549)['then'](function(_0x25b803){_0xa00e1e[_0xdbe8('0x1a')]=_0x25b803;if(_0x2e31d1['query']['includeAll']){_0xdcf292[_0xdbe8('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0xdcf292);})[_0xdbe8('0x23')](function(_0x2a4657){_0xa00e1e[_0xdbe8('0x3f')]=_0x2a4657;return _0xa00e1e;})['then'](respondWithFilteredResult(_0x9f4226,_0xdcf292))['catch'](handleError(_0x9f4226,null));};exports['show']=function(_0x4fc326,_0x270ef7){var _0x5547b0={'raw':!![],'where':{'id':_0x4fc326['params']['id']}},_0x4f5bc8={};_0x4f5bc8[_0xdbe8('0x2c')]=_[_0xdbe8('0x2f')](db[_0xdbe8('0x29')]['rawAttributes']);_0x4f5bc8[_0xdbe8('0x2e')]=_['keys'](_0x4fc326[_0xdbe8('0x2e')]);_0x4f5bc8[_0xdbe8('0x30')]=_['intersection'](_0x4f5bc8[_0xdbe8('0x2c')],_0x4f5bc8[_0xdbe8('0x2e')]);_0x5547b0['attributes']=_[_0xdbe8('0x31')](_0x4f5bc8[_0xdbe8('0x2c')],qs['fields'](_0x4fc326[_0xdbe8('0x2e')][_0xdbe8('0x32')]));_0x5547b0[_0xdbe8('0x33')]=_0x5547b0['attributes'][_0xdbe8('0x34')]?_0x5547b0[_0xdbe8('0x33')]:_0x4f5bc8[_0xdbe8('0x2c')];if(_0x4fc326[_0xdbe8('0x2e')][_0xdbe8('0x40')]){_0x5547b0[_0xdbe8('0x3e')]=[{'all':!![]}];}_0x5547b0=_[_0xdbe8('0x3b')]({},_0x5547b0,_0x4fc326[_0xdbe8('0x3d')]);return db[_0xdbe8('0x29')][_0xdbe8('0x41')](_0x5547b0)[_0xdbe8('0x23')](handleEntityNotFound(_0x270ef7,null))[_0xdbe8('0x23')](respondWithResult(_0x270ef7,null))[_0xdbe8('0x42')](handleError(_0x270ef7,null));};exports[_0xdbe8('0x43')]=function(_0x5d7f1d,_0x15db9a){return db[_0xdbe8('0x29')][_0xdbe8('0x43')](_0x5d7f1d[_0xdbe8('0x44')],{})[_0xdbe8('0x23')](respondWithResult(_0x15db9a,0xc9))['catch'](handleError(_0x15db9a,null));};exports['update']=function(_0xccdfbf,_0x21a571){if(_0xccdfbf[_0xdbe8('0x44')]['id']){delete _0xccdfbf['body']['id'];}return db[_0xdbe8('0x29')][_0xdbe8('0x41')]({'where':{'id':_0xccdfbf['params']['id']}})['then'](handleEntityNotFound(_0x21a571,null))['then'](saveUpdates(_0xccdfbf[_0xdbe8('0x44')],null))[_0xdbe8('0x23')](respondWithResult(_0x21a571,null))[_0xdbe8('0x42')](handleError(_0x21a571,null));};exports[_0xdbe8('0x24')]=function(_0x419125,_0x42ad9d){return db[_0xdbe8('0x29')]['find']({'where':{'id':_0x419125[_0xdbe8('0x45')]['id']}})[_0xdbe8('0x23')](handleEntityNotFound(_0x42ad9d,null))[_0xdbe8('0x23')](removeEntity(_0x42ad9d,null))[_0xdbe8('0x42')](handleError(_0x42ad9d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index f266e38..19241d0 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 _0x7d63=['path','rimraf','./voiceQueuesLog.attributes','exports','define','event','dtm','lodash','util','moment','bluebird','request-promise'];(function(_0x183792,_0x3efec2){var _0x51fe4e=function(_0x14ea3c){while(--_0x14ea3c){_0x183792['push'](_0x183792['shift']());}};_0x51fe4e(++_0x3efec2);}(_0x7d63,0x16f));var _0x37d6=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0x7d63[_0x2aefb6];return _0x202772;};'use strict';var _=require(_0x37d6('0x0'));var util=require(_0x37d6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x37d6('0x2'));var BPromise=require(_0x37d6('0x3'));var rp=require(_0x37d6('0x4'));var fs=require('fs');var path=require(_0x37d6('0x5'));var rimraf=require(_0x37d6('0x6'));var config=require('../../config/environment');var attributes=require(_0x37d6('0x7'));module[_0x37d6('0x8')]=function(_0x92bd9c,_0x16c683){return _0x92bd9c[_0x37d6('0x9')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x37d6('0xa'),_0x37d6('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9fa4=['event','dtm','lodash','util','api','moment','bluebird','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0x37ba11,_0x34ff25){var _0x3c445d=function(_0xb2dc3c){while(--_0xb2dc3c){_0x37ba11['push'](_0x37ba11['shift']());}};_0x3c445d(++_0x34ff25);}(_0x9fa4,0x147));var _0x49fa=function(_0x4f9548,_0x2a75c7){_0x4f9548=_0x4f9548-0x0;var _0x96c0cf=_0x9fa4[_0x4f9548];return _0x96c0cf;};'use strict';var _=require(_0x49fa('0x0'));var util=require(_0x49fa('0x1'));var logger=require('../../config/logger')(_0x49fa('0x2'));var moment=require(_0x49fa('0x3'));var BPromise=require(_0x49fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x49fa('0x5'));var attributes=require('./voiceQueuesLog.attributes');module[_0x49fa('0x6')]=function(_0x5a66e9,_0x158714){return _0x5a66e9[_0x49fa('0x7')](_0x49fa('0x8'),attributes,{'tableName':_0x49fa('0x9'),'paranoid':![],'indexes':[{'name':_0x49fa('0xa'),'fields':[_0x49fa('0xb'),_0x49fa('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 65915e1..d47dd70 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 _0x422f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','util'];(function(_0x6620b8,_0x8b3d5e){var _0x33de50=function(_0x2f1f07){while(--_0x2f1f07){_0x6620b8['push'](_0x6620b8['shift']());}};_0x33de50(++_0x8b3d5e);}(_0x422f,0x1c7));var _0xf422=function(_0x52d59e,_0x3c546d){_0x52d59e=_0x52d59e-0x0;var _0x364739=_0x422f[_0x52d59e];return _0x364739;};'use strict';var _=require('lodash');var util=require(_0xf422('0x0'));var moment=require('moment');var BPromise=require(_0xf422('0x1'));var rs=require(_0xf422('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf422('0x3'))['db'];var utils=require(_0xf422('0x4'));var logger=require(_0xf422('0x5'))(_0xf422('0x6'));var config=require(_0xf422('0x7'));var jayson=require(_0xf422('0x8'));var client=jayson[_0xf422('0x9')][_0xf422('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x350b2d,_0x583283,_0x3f4801){return new BPromise(function(_0x1037fa,_0xc2c9f5){return client[_0xf422('0xb')](_0x350b2d,_0x3f4801)[_0xf422('0xc')](function(_0x5f02da){logger[_0xf422('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x583283,'request\x20sent');logger[_0xf422('0xe')](_0xf422('0xf'),_0x583283,_0xf422('0x10'),JSON[_0xf422('0x11')](_0x5f02da));if(_0x5f02da[_0xf422('0x12')]){if(_0x5f02da['error'][_0xf422('0x13')]===0x1f4){logger[_0xf422('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x583283,_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);return _0xc2c9f5(_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);}logger[_0xf422('0x12')](_0xf422('0x15'),_0x583283,_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);return _0x1037fa(_0x5f02da[_0xf422('0x12')]['message']);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x583283,_0xf422('0x10'));_0x1037fa(_0x5f02da[_0xf422('0x16')][_0xf422('0x14')]);}})[_0xf422('0x17')](function(_0x5f3de5){logger[_0xf422('0x12')](_0xf422('0x15'),_0x583283,_0x5f3de5);_0xc2c9f5(_0x5f3de5);});});} \ No newline at end of file +var _0xa478=['http','then','info','request\x20sent','debug','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0xa478,0x136));var _0x8a47=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xa478[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var moment=require(_0x8a47('0x2'));var BPromise=require(_0x8a47('0x3'));var rs=require(_0x8a47('0x4'));var fs=require('fs');var Redis=require(_0x8a47('0x5'));var db=require(_0x8a47('0x6'))['db'];var utils=require(_0x8a47('0x7'));var logger=require(_0x8a47('0x8'))(_0x8a47('0x9'));var config=require(_0x8a47('0xa'));var jayson=require(_0x8a47('0xb'));var client=jayson['client'][_0x8a47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d62a6,_0x3de815,_0x3cb340){return new BPromise(function(_0x56884b,_0x384886){return client['request'](_0x2d62a6,_0x3cb340)[_0x8a47('0xd')](function(_0x369fc9){logger[_0x8a47('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'));logger[_0x8a47('0x10')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'),JSON['stringify'](_0x369fc9));if(_0x369fc9[_0x8a47('0x11')]){if(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x12')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x3de815,_0x369fc9['error'][_0x8a47('0x13')]);return _0x384886(_0x369fc9[_0x8a47('0x11')]['message']);}logger[_0x8a47('0x11')](_0x8a47('0x14'),_0x3de815,_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);return _0x56884b(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);}else{logger[_0x8a47('0xe')](_0x8a47('0x14'),_0x3de815,_0x8a47('0xf'));_0x56884b(_0x369fc9[_0x8a47('0x15')][_0x8a47('0x13')]);}})[_0x8a47('0x16')](function(_0x2917d9){logger['error'](_0x8a47('0x14'),_0x3de815,_0x2917d9);_0x384886(_0x2917d9);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index b62eece..59fcf8b 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 _0x637a=['create','post','runTranscribe','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x637a,0x68));var _0xa637=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x637a[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xa637('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa637('0x1'));var express=require(_0xa637('0x2'));var router=express['Router']();var auth=require(_0xa637('0x3'));var interaction=require(_0xa637('0x4'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0xa637('0x5')]('/',auth[_0xa637('0x6')](),controller[_0xa637('0x7')]);router[_0xa637('0x5')]('/describe',auth[_0xa637('0x6')](),controller[_0xa637('0x8')]);router['get'](_0xa637('0x9'),auth[_0xa637('0x6')](),controller['show']);router[_0xa637('0x5')](_0xa637('0xa'),auth['isAuthenticated'](),controller[_0xa637('0xb')]);router[_0xa637('0x5')](_0xa637('0xc'),controller[_0xa637('0xd')]);router[_0xa637('0x5')](_0xa637('0xe'),auth['isAuthenticated'](),controller[_0xa637('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa637('0x10')]);router[_0xa637('0x11')](_0xa637('0xe'),auth[_0xa637('0x6')](),controller[_0xa637('0x12')]);router[_0xa637('0x13')](_0xa637('0x9'),auth[_0xa637('0x6')](),controller[_0xa637('0x14')]);router[_0xa637('0x15')](_0xa637('0x9'),auth[_0xa637('0x6')](),controller[_0xa637('0x16')]);module[_0xa637('0x17')]=router; \ No newline at end of file +var _0x32bc=['describe','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated'];(function(_0x3f3f94,_0x12b24e){var _0x4ebb5a=function(_0x3a4778){while(--_0x3a4778){_0x3f3f94['push'](_0x3f3f94['shift']());}};_0x4ebb5a(++_0x12b24e);}(_0x32bc,0x16c));var _0xc32b=function(_0x4bc19e,_0x4853dd){_0x4bc19e=_0x4bc19e-0x0;var _0x52b575=_0x32bc[_0x4bc19e];return _0x52b575;};'use strict';var multer=require(_0xc32b('0x0'));var util=require(_0xc32b('0x1'));var path=require(_0xc32b('0x2'));var timeout=require('connect-timeout');var express=require(_0xc32b('0x3'));var router=express[_0xc32b('0x4')]();var auth=require(_0xc32b('0x5'));var interaction=require(_0xc32b('0x6'));var config=require(_0xc32b('0x7'));var controller=require(_0xc32b('0x8'));router[_0xc32b('0x9')]('/',auth[_0xc32b('0xa')](),controller['index']);router[_0xc32b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xc32b('0xb')]);router[_0xc32b('0x9')]('/:id',auth[_0xc32b('0xa')](),controller['show']);router[_0xc32b('0x9')]('/:id/download',auth[_0xc32b('0xa')](),controller[_0xc32b('0xc')]);router['get'](_0xc32b('0xd'),controller[_0xc32b('0xe')]);router[_0xc32b('0x9')](_0xc32b('0xf'),auth[_0xc32b('0xa')](),controller[_0xc32b('0x10')]);router[_0xc32b('0x11')]('/',auth[_0xc32b('0xa')](),controller[_0xc32b('0x12')]);router['post']('/:id/transcribe',auth[_0xc32b('0xa')](),controller[_0xc32b('0x13')]);router[_0xc32b('0x14')](_0xc32b('0x15'),auth[_0xc32b('0xa')](),controller[_0xc32b('0x16')]);router['delete'](_0xc32b('0x15'),auth[_0xc32b('0xa')](),controller[_0xc32b('0x17')]);module[_0xc32b('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a6ae0a9..d2acbff 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 _0x72b7=['moment','path','exports','value','extname','getDataValue','STRING','channel','setDataValue','membername','split','INTEGER','TEXT','FLOAT','BOOLEAN','format','toString','DATE','updatedAt','sequelize'];(function(_0x86f399,_0x5cc477){var _0x3b8b2e=function(_0xbe80a){while(--_0xbe80a){_0x86f399['push'](_0x86f399['shift']());}};_0x3b8b2e(++_0x5cc477);}(_0x72b7,0x1a3));var _0x772b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x72b7[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x772b('0x0'));var moment=require(_0x772b('0x1'));var path=require(_0x772b('0x2'));module[_0x772b('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x772b('0x4'))?path[_0x772b('0x5')](this[_0x772b('0x6')](_0x772b('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0x772b('0x7')]},'channel':{'type':Sequelize[_0x772b('0x7')],'set':function(_0xfe6888){if(_0xfe6888){this['setDataValue'](_0x772b('0x8'),_0xfe6888);this[_0x772b('0x9')](_0x772b('0xa'),_0xfe6888[_0x772b('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x772b('0x7')]},'calleridnum':{'type':Sequelize[_0x772b('0x7')]},'calleridname':{'type':Sequelize[_0x772b('0x7')]},'connectedlinenum':{'type':Sequelize[_0x772b('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x772b('0x7')]},'value':{'type':Sequelize[_0x772b('0x7')]},'type':{'type':Sequelize[_0x772b('0x7')]},'rating':{'type':Sequelize[_0x772b('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x772b('0x7')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x772b('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x772b('0xd')]},'transcribeName':{'type':Sequelize[_0x772b('0x7')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x772b('0xd')]},'fileText':{'type':Sequelize[_0x772b('0xd')]},'failureReason':{'type':Sequelize[_0x772b('0xd')]},'sentiment':{'type':Sequelize[_0x772b('0x7')]},'sPositive':{'type':Sequelize[_0x772b('0xe')]},'sNegative':{'type':Sequelize[_0x772b('0xe')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x772b('0xe')]},'tempSentiment':{'type':Sequelize[_0x772b('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x772b('0x6')]('createdAt'))[_0x772b('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x772b('0x11')]();}},'updatedAt':{'type':Sequelize[_0x772b('0x12')],'get':function(){return moment(this[_0x772b('0x6')](_0x772b('0x13')))[_0x772b('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x96de=['channel','membername','STRING','TEXT','FLOAT','DATE','format','MM-DD-YYYY\x20HH:mm','toString','moment','exports','getDataValue','value','extname','setDataValue'];(function(_0x3ee21e,_0x5cf64c){var _0x10755a=function(_0x31d3a9){while(--_0x31d3a9){_0x3ee21e['push'](_0x3ee21e['shift']());}};_0x10755a(++_0x5cf64c);}(_0x96de,0x126));var _0xe96d=function(_0x32d86c,_0x374da2){_0x32d86c=_0x32d86c-0x0;var _0x35cfd5=_0x96de[_0x32d86c];return _0x35cfd5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe96d('0x0'));var path=require('path');module[_0xe96d('0x1')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe96d('0x2')](_0xe96d('0x3'))?path[_0xe96d('0x4')](this[_0xe96d('0x2')](_0xe96d('0x3'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING'],'set':function(_0x4a2ff2){if(_0x4a2ff2){this[_0xe96d('0x5')](_0xe96d('0x6'),_0x4a2ff2);this['setDataValue'](_0xe96d('0x7'),_0x4a2ff2['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xe96d('0x8')]},'calleridnum':{'type':Sequelize[_0xe96d('0x8')]},'calleridname':{'type':Sequelize[_0xe96d('0x8')]},'connectedlinenum':{'type':Sequelize[_0xe96d('0x8')]},'connectedlinename':{'type':Sequelize[_0xe96d('0x8')]},'accountcode':{'type':Sequelize[_0xe96d('0x8')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xe96d('0x8')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xe96d('0x8')]},'userDisposition':{'type':Sequelize[_0xe96d('0x8')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0xe96d('0x9')]},'transcribeName':{'type':Sequelize[_0xe96d('0x8')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0xe96d('0x9')]},'fileText':{'type':Sequelize[_0xe96d('0x9')]},'failureReason':{'type':Sequelize[_0xe96d('0x9')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize[_0xe96d('0xa')]},'sNegative':{'type':Sequelize[_0xe96d('0xa')]},'sNeutral':{'type':Sequelize[_0xe96d('0xa')]},'sMixed':{'type':Sequelize[_0xe96d('0xa')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xe96d('0xb')],'get':function(){return moment(this[_0xe96d('0x2')]('createdAt'))[_0xe96d('0xc')](_0xe96d('0xd'))[_0xe96d('0xe')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('updatedAt'))['format'](_0xe96d('0xd'))[_0xe96d('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 7401b55..a02e3ee 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 _0x48d7=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','download','../../components/encryptor','value','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','uniqueid','token','push','$and','recording','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','uuid/v4'];(function(_0x2f6fcf,_0x3d44af){var _0x180fc1=function(_0x505fa7){while(--_0x505fa7){_0x2f6fcf['push'](_0x2f6fcf['shift']());}};_0x180fc1(++_0x3d44af);}(_0x48d7,0x11f));var _0x748d=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x48d7[_0x47aa64];return _0x549c7a;};'use strict';var pdf=require(_0x748d('0x0'));var emlformat=require(_0x748d('0x1'));var rimraf=require(_0x748d('0x2'));var zipdir=require(_0x748d('0x3'));var jsonpatch=require(_0x748d('0x4'));var rp=require(_0x748d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x748d('0x6'));var util=require(_0x748d('0x7'));var path=require('path');var sox=require(_0x748d('0x8'));var csv=require(_0x748d('0x9'));var ejs=require(_0x748d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x748d('0xb'));var crypto=require('crypto');var jsforce=require(_0x748d('0xc'));var deskjs=require(_0x748d('0xd'));var toCsv=require(_0x748d('0x9'));var querystring=require(_0x748d('0xe'));var Papa=require(_0x748d('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0x748d('0x10'));var Redis=require(_0x748d('0x11'));var authService=require(_0x748d('0x12'));var qs=require(_0x748d('0x13'));var as=require(_0x748d('0x14'));var hardwareService=require(_0x748d('0x15'));var logger=require('../../config/logger')(_0x748d('0x16'));var utils=require(_0x748d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x748d('0x18'));var db=require(_0x748d('0x19'))['db'];function respondWithStatusCode(_0x9079d6,_0x47581f){_0x47581f=_0x47581f||0xcc;return function(_0x19e607){if(_0x19e607){return _0x9079d6[_0x748d('0x1a')](_0x47581f);}return _0x9079d6['status'](_0x47581f)[_0x748d('0x1b')]();};}function respondWithResult(_0x399768,_0x327213){_0x327213=_0x327213||0xc8;return function(_0x52ae5c){if(_0x52ae5c){return _0x399768[_0x748d('0x1c')](_0x327213)[_0x748d('0x1d')](_0x52ae5c);}};}function respondWithFilteredResult(_0x118fb2,_0x138a59){return function(_0x487f35){if(_0x487f35){var _0xea8717=_0x487f35[_0x748d('0x1e')],_0x12ed98=_0x138a59[_0x748d('0x1f')],_0x4ed3da=_0x138a59[_0x748d('0x1f')]+_0x138a59['limit'],_0x2b79cd;if(_0x4ed3da>=_0xea8717){_0x4ed3da=_0xea8717;_0x2b79cd=0xc8;}else{_0x2b79cd=0xce;}_0x118fb2[_0x748d('0x1c')](_0x2b79cd);return _0x118fb2[_0x748d('0x20')](_0x748d('0x21'),_0x12ed98+'-'+_0x4ed3da+'/'+_0xea8717)[_0x748d('0x1d')](_0x487f35);}return null;};}function patchUpdates(_0x543710){return function(_0x5c0a33){try{jsonpatch[_0x748d('0x22')](_0x5c0a33,_0x543710,!![]);}catch(_0x5e2549){return BPromise[_0x748d('0x23')](_0x5e2549);}return _0x5c0a33['save']();};}function saveUpdates(_0x1c8909,_0x145228){return function(_0x4e625a){if(_0x4e625a){return _0x4e625a[_0x748d('0x24')](_0x1c8909)[_0x748d('0x25')](function(_0x423a17){return _0x423a17;});}return null;};}function removeEntity(_0x2c73a3,_0x51457d){return function(_0x10efd0){if(_0x10efd0){return _0x10efd0[_0x748d('0x26')]()[_0x748d('0x25')](function(){_0x2c73a3[_0x748d('0x1c')](0xcc)[_0x748d('0x1b')]();});}};}function handleEntityNotFound(_0x355f0e,_0x246e04){return function(_0x91155c){if(!_0x91155c){_0x355f0e[_0x748d('0x1a')](0x194);}return _0x91155c;};}function handleError(_0x42d364,_0x3d2466){_0x3d2466=_0x3d2466||0x1f4;return function(_0x21c98d){logger['error'](_0x21c98d[_0x748d('0x27')]);if(_0x21c98d[_0x748d('0x28')]){delete _0x21c98d['name'];}_0x42d364[_0x748d('0x1c')](_0x3d2466)[_0x748d('0x29')](_0x21c98d);};}exports[_0x748d('0x2a')]=function(_0xff0c05,_0x1f6f20){var _0xd8d80e={},_0x41a7dd={},_0x49ade4={'count':0x0,'rows':[]};var _0x1e054b=_[_0x748d('0x2b')](db[_0x748d('0x2c')][_0x748d('0x2d')],function(_0x17c0d0){return{'name':_0x17c0d0[_0x748d('0x2e')],'type':_0x17c0d0[_0x748d('0x2f')][_0x748d('0x30')]};});_0x41a7dd[_0x748d('0x31')]=_[_0x748d('0x32')](_[_0x748d('0x2b')](_0x1e054b,_0x748d('0x28')),['format']);_0x41a7dd[_0x748d('0x33')]=_[_0x748d('0x34')](_0xff0c05['query']);_0x41a7dd['filters']=_[_0x748d('0x35')](_0x41a7dd[_0x748d('0x31')],_0x41a7dd[_0x748d('0x33')]);_0xd8d80e[_0x748d('0x36')]=_[_0x748d('0x35')](_0x41a7dd[_0x748d('0x31')],qs[_0x748d('0x37')](_0xff0c05[_0x748d('0x33')][_0x748d('0x37')]));_0xd8d80e[_0x748d('0x36')]=_0xd8d80e['attributes']['length']?_0xd8d80e['attributes']:_0x41a7dd[_0x748d('0x31')];if(!_0xff0c05['query'][_0x748d('0x38')](_0x748d('0x39'))){_0xd8d80e['limit']=qs[_0x748d('0x3a')](_0xff0c05[_0x748d('0x33')]['limit']);_0xd8d80e[_0x748d('0x1f')]=qs[_0x748d('0x1f')](_0xff0c05['query'][_0x748d('0x1f')]);}_0xd8d80e[_0x748d('0x3b')]=qs[_0x748d('0x3c')](_0xff0c05[_0x748d('0x33')][_0x748d('0x3c')]);_0xd8d80e[_0x748d('0x3d')]=qs['filters'](_[_0x748d('0x3e')](_0xff0c05[_0x748d('0x33')],_0x41a7dd['filters']),_0x1e054b);if(_0xff0c05[_0x748d('0x33')]['filter']){_0xd8d80e[_0x748d('0x3d')]=_['merge'](_0xd8d80e[_0x748d('0x3d')],{'$or':_[_0x748d('0x2b')](_0x1e054b,function(_0x4453c1){if(_0x4453c1['type']!==_0x748d('0x3f')){var _0x5009a7={};_0x5009a7[_0x4453c1[_0x748d('0x28')]]={'$like':'%'+_0xff0c05['query'][_0x748d('0x40')]+'%'};return _0x5009a7;}})});}_0xd8d80e=_[_0x748d('0x41')]({},_0xd8d80e,_0xff0c05[_0x748d('0x42')]);var _0x1893d0={'where':_0xd8d80e[_0x748d('0x3d')]};return db[_0x748d('0x2c')][_0x748d('0x1e')](_0x1893d0)[_0x748d('0x25')](function(_0x51f52f){_0x49ade4['count']=_0x51f52f;if(_0xff0c05[_0x748d('0x33')][_0x748d('0x43')]){_0xd8d80e[_0x748d('0x44')]=[{'all':!![]}];}return db[_0x748d('0x2c')][_0x748d('0x45')](_0xd8d80e);})[_0x748d('0x25')](function(_0x375ae4){_0x49ade4['rows']=_0x375ae4;return _0x49ade4;})[_0x748d('0x25')](respondWithFilteredResult(_0x1f6f20,_0xd8d80e))[_0x748d('0x46')](handleError(_0x1f6f20,null));};exports[_0x748d('0x47')]=function(_0x58c4fc,_0x55eaf3){var _0x506549={'raw':![],'where':{'id':_0x58c4fc[_0x748d('0x48')]['id']}},_0x3d6e05={};_0x3d6e05[_0x748d('0x31')]=_[_0x748d('0x34')](db[_0x748d('0x2c')][_0x748d('0x2d')]);_0x3d6e05[_0x748d('0x33')]=_[_0x748d('0x34')](_0x58c4fc[_0x748d('0x33')]);_0x3d6e05['filters']=_[_0x748d('0x35')](_0x3d6e05['model'],_0x3d6e05[_0x748d('0x33')]);_0x506549[_0x748d('0x36')]=_[_0x748d('0x35')](_0x3d6e05['model'],qs[_0x748d('0x37')](_0x58c4fc[_0x748d('0x33')][_0x748d('0x37')]));_0x506549[_0x748d('0x36')]=_0x506549[_0x748d('0x36')][_0x748d('0x49')]?_0x506549[_0x748d('0x36')]:_0x3d6e05[_0x748d('0x31')];if(_0x58c4fc[_0x748d('0x33')][_0x748d('0x43')]){_0x506549['include']=[{'all':!![]}];}_0x506549=_[_0x748d('0x41')]({},_0x506549,_0x58c4fc[_0x748d('0x42')]);return db['VoiceRecording'][_0x748d('0x4a')](_0x506549)['then'](handleEntityNotFound(_0x55eaf3,null))['then'](respondWithResult(_0x55eaf3,null))['catch'](handleError(_0x55eaf3,null));};exports[_0x748d('0x4b')]=function(_0x5f4f3a,_0xe6b421){return db['VoiceRecording'][_0x748d('0x4b')](_0x5f4f3a[_0x748d('0x4c')],{})[_0x748d('0x25')](respondWithResult(_0xe6b421,0xc9))[_0x748d('0x46')](handleError(_0xe6b421,null));};exports[_0x748d('0x24')]=function(_0x16f2c1,_0x298233){if(_0x16f2c1['body']['id']){delete _0x16f2c1[_0x748d('0x4c')]['id'];}return db[_0x748d('0x2c')][_0x748d('0x4a')]({'where':{'id':_0x16f2c1['params']['id']}})[_0x748d('0x25')](handleEntityNotFound(_0x298233,null))[_0x748d('0x25')](saveUpdates(_0x16f2c1[_0x748d('0x4c')],null))['then'](respondWithResult(_0x298233,null))[_0x748d('0x46')](handleError(_0x298233,null));};exports[_0x748d('0x4d')]=function(_0x5a713c,_0x35f61b){return db['VoiceRecording'][_0x748d('0x4d')]()[_0x748d('0x25')](respondWithResult(_0x35f61b,null))[_0x748d('0x46')](handleError(_0x35f61b,null));};exports[_0x748d('0x4e')]=function(_0x3a12d6,_0x3433cf,_0x209060){var _0x388340=require(_0x748d('0x4f'));var _0x376fea=![];var _0x59f63c={};if(_0x3a12d6['query'][_0x748d('0x2f')]&&_0x3a12d6[_0x748d('0x33')][_0x748d('0x2f')]==='uniqueid'){_0x59f63c['uniqueid']=_0x3a12d6[_0x748d('0x48')]['id'];}else{_0x59f63c['id']=_0x3a12d6[_0x748d('0x48')]['id'];}return db['VoiceRecording']['find']({'where':_0x59f63c,'attributes':['id',_0x748d('0x50')],'raw':!![]})[_0x748d('0x25')](handleEntityNotFound(_0x3433cf,null))['then'](function(_0x357ac9){if(_0x357ac9){var _0x2fe7a0=_0x357ac9[_0x748d('0x50')];var _0x2c5730=util[_0x748d('0x51')](_0x748d('0x52'),_0x2fe7a0);if(fs[_0x748d('0x53')](_0x2c5730)){_0x376fea=!![];return _0x388340[_0x748d('0x54')](_0x2c5730,_0x2fe7a0,config[_0x748d('0x55')]['recording'])[_0x748d('0x25')](function(){return _0x357ac9;});}return _0x357ac9;}})['then'](function(_0x16265a){if(_0x16265a){var _0x43dba8=_0x16265a[_0x748d('0x50')];if(!fs[_0x748d('0x53')](_0x43dba8)){throw new db[(_0x748d('0x56'))][(_0x748d('0x57'))](_0x748d('0x58'));}if(_0x16265a[_0x748d('0x59')]){return _0x3433cf['download'](_0x43dba8,_0x16265a[_0x748d('0x59')]+path[_0x748d('0x5a')](_0x43dba8),function(){if(_0x376fea){fs['unlink'](_0x43dba8);}});}else{return _0x3433cf[_0x748d('0x4e')](_0x43dba8,function(_0x3b432a){if(_0x376fea){fs[_0x748d('0x5b')](_0x43dba8);}});}}})[_0x748d('0x46')](function(_0x588a99){if(_0x588a99['message']==='VoiceRecording\x20not\x20found'){_0x3433cf[_0x748d('0x1c')](0x194)['send'](_0x748d('0x5c'));}else{return handleError(_0x3433cf,null);}});};exports[_0x748d('0x5d')]=function(_0x332411,_0x2c7f41,_0x1b4159){var _0x1848ad=require(_0x748d('0x4f'));var _0x5e8227=![];var _0x1f169={'$and':[db[_0x748d('0x5e')][_0x748d('0x3d')](db['sequelize']['fn'](_0x748d('0x5f'),db['sequelize']['col'](_0x748d('0x60'))),_0x332411['query'][_0x748d('0x61')])]};if(_0x332411[_0x748d('0x33')][_0x748d('0x2f')]&&_0x332411[_0x748d('0x33')]['type']===_0x748d('0x60')){_0x1f169['$and'][_0x748d('0x62')]({'uniqueid':_0x332411[_0x748d('0x48')]['id']});}else{_0x1f169[_0x748d('0x63')]['push']({'id':_0x332411[_0x748d('0x48')]['id']});}return db['VoiceRecording'][_0x748d('0x4a')]({'where':_0x1f169,'attributes':['id','value'],'raw':!![]})[_0x748d('0x25')](handleEntityNotFound(_0x2c7f41,null))['then'](function(_0x17b6ca){if(_0x17b6ca){var _0xa30d8d=util[_0x748d('0x51')](_0x748d('0x52'),_0x17b6ca[_0x748d('0x50')]);if(fs[_0x748d('0x53')](_0xa30d8d)){_0x5e8227=!![];return _0x1848ad[_0x748d('0x54')](_0xa30d8d,_0x17b6ca[_0x748d('0x50')],config[_0x748d('0x55')][_0x748d('0x64')])[_0x748d('0x25')](function(){return _0x17b6ca;});}return _0x17b6ca;}})['then'](function(_0x5b0c5d){if(_0x5b0c5d){if(!fs[_0x748d('0x53')](_0x5b0c5d[_0x748d('0x50')])){throw new db['Sequelize'][(_0x748d('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x5b0c5d[_0x748d('0x59')]){return _0x2c7f41[_0x748d('0x4e')](_0x5b0c5d[_0x748d('0x50')],_0x5b0c5d[_0x748d('0x59')]+path['extname'](_0x5b0c5d[_0x748d('0x50')]),function(){if(_0x5e8227){fs[_0x748d('0x5b')](_0x5b0c5d[_0x748d('0x50')]);}});}else{return _0x2c7f41['download'](_0x5b0c5d[_0x748d('0x50')],function(_0x55a89a){if(_0x5e8227){fs[_0x748d('0x5b')](_0x5b0c5d[_0x748d('0x50')]);}});}}})[_0x748d('0x46')](handleError(_0x2c7f41,null));};exports[_0x748d('0x26')]=function(_0x428abe,_0x5b495c){return db[_0x748d('0x2c')]['find']({'where':{'id':_0x428abe[_0x748d('0x48')]['id']}})[_0x748d('0x25')](function(_0x8506d5){if(!_0x8506d5)throw new ReferenceError(_0x748d('0x65'));return _0x8506d5;})[_0x748d('0x25')](function(_0x22dd49){var _0x49e0ed=_0x22dd49[_0x748d('0x50')];logger[_0x748d('0x66')](_0x748d('0x67'),_0x49e0ed);if(!_['isNil'](_0x22dd49['value'])&&fs[_0x748d('0x53')](_0x49e0ed)){logger[_0x748d('0x66')](_0x748d('0x68')+_0x49e0ed+_0x748d('0x69'));fs[_0x748d('0x6a')](_0x49e0ed);}_0x49e0ed=_0x49e0ed+_0x748d('0x6b');if(!_[_0x748d('0x6c')](_0x22dd49['value'])&&fs[_0x748d('0x53')](_0x49e0ed)){logger[_0x748d('0x66')]('File:\x20\x22'+_0x49e0ed+_0x748d('0x69'));fs[_0x748d('0x6a')](_0x49e0ed);}return _0x22dd49;})[_0x748d('0x25')](function(_0x5be97d){if(!_0x5be97d)throw new InternalError();return _0x5be97d[_0x748d('0x26')]();})['then'](function(){_0x5b495c['status'](0xcc)[_0x748d('0x1b')]();})[_0x748d('0x46')](handleError(_0x5b495c,null));};function getBucketslist(_0x5228d8,_0x173703,_0x5ba64d){return new Promise(function(_0x45924a,_0x19782e){var _0x2b8219=new AWS['S3']({'accessKeyId':_0x173703,'secretAccessKey':_0x5228d8,'region':_0x5ba64d});_0x2b8219[_0x748d('0x6d')]({},function(_0x18c126,_0x5c1eb9){if(_0x18c126){return _0x19782e(_0x18c126);}else{return _0x45924a(_0x5c1eb9);}});});}function createBucket(_0x3852f8,_0x4b337f,_0x16745a,_0x1e22b9){return new Promise(function(_0x1e7a0d,_0x2e1df9){var _0x2ce7d9=new AWS['S3']({'accessKeyId':_0x4b337f,'secretAccessKey':_0x3852f8,'region':_0x16745a});_0x2ce7d9[_0x748d('0x6e')]({'Bucket':_0x1e22b9},function(_0x2a0fdb,_0x3c6165){if(_0x2a0fdb){return _0x2e1df9(_0x2a0fdb);}else{return _0x1e7a0d(_0x3c6165);}});});}function uploadFile(_0x23a8c1,_0x37d7b5,_0x1e3272,_0x312820,_0x26128c,_0x3bebb4){return new Promise(function(_0x5eecae,_0x188b24){var _0x28b7a3=new AWS['S3']({'accessKeyId':_0x37d7b5,'secretAccessKey':_0x23a8c1,'region':_0x1e3272});_0x28b7a3[_0x748d('0x6f')]({'Bucket':_0x312820,'Key':_0x26128c,'Body':_0x3bebb4},function(_0x1d0145,_0x2ba400){if(_0x1d0145){return _0x188b24(_0x1d0145);}else{return _0x5eecae(_0x2ba400);}});});}function startTranscribe(_0x208c75,_0x344672,_0x50b8d5,_0x3207dc,_0x3a50dc,_0x13849a){return new Promise(function(_0x42561e,_0x45e9b9){var _0x15b4ab=new AWS['TranscribeService']({'accessKeyId':_0x344672,'secretAccessKey':_0x208c75,'region':_0x50b8d5});_0x15b4ab[_0x748d('0x70')]({'TranscriptionJobName':_0x3207dc,'LanguageCode':_0x3a50dc,'Media':{'MediaFileUri':_0x13849a}},function(_0x568c79,_0x403c6e){if(_0x568c79){return _0x45e9b9(_0x568c79);}else{return _0x42561e(_0x403c6e);}});});}function transcribe(_0x302701,_0x541443,_0x295a76,_0x34b0c7,_0x454171,_0x1de6c1,_0x2c9055){return new Promise(function(_0xb1f522,_0x3f23f9){var _0x341a16={};logger[_0x748d('0x66')](util[_0x748d('0x51')](_0x748d('0x71'),_0x302701,_0x454171));return uploadFile(_0x541443,_0x295a76,_0x34b0c7,_0x454171,path['basename'](_0x1de6c1),fs['readFileSync'](_0x1de6c1))[_0x748d('0x25')](function(_0x393d21){logger[_0x748d('0x66')](util[_0x748d('0x51')](_0x748d('0x72'),_0x302701,_0x454171,_0x393d21[_0x748d('0x73')]));_0x341a16[_0x748d('0x74')]=_0x393d21[_0x748d('0x75')];_0x341a16[_0x748d('0x76')]=_0x393d21[_0x748d('0x73')];logger['info'](util[_0x748d('0x51')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x302701));return startTranscribe(_0x541443,_0x295a76,_0x34b0c7,uuidv4(),_0x2c9055,_0x393d21[_0x748d('0x73')]);})[_0x748d('0x25')](function(_0x559761){logger[_0x748d('0x66')](util[_0x748d('0x51')](_0x748d('0x77'),_0x302701,_0x559761[_0x748d('0x78')][_0x748d('0x79')]));_0x341a16[_0x748d('0x7a')]=_0x559761[_0x748d('0x78')][_0x748d('0x79')];_0x341a16[_0x748d('0x7b')]=_0x559761['TranscriptionJob'][_0x748d('0x7c')];return _0xb1f522(_0x341a16);})[_0x748d('0x46')](function(_0x4e37e5){return _0x3f23f9(_0x4e37e5);});});}exports[_0x748d('0x7d')]=function(_0x33f1c2,_0x122778,_0xc379e0){var _0x3c76e7;var _0x5af6be;var _0x31043e;var _0x4cecce=require('../../components/encryptor');return db[_0x748d('0x2c')][_0x748d('0x7e')]({'where':{'id':_0x33f1c2[_0x748d('0x48')]['id']}})[_0x748d('0x25')](function(_0x1f5285){if(_0x1f5285){var _0x15467c=util[_0x748d('0x51')](_0x748d('0x52'),_0x1f5285[_0x748d('0x50')]);if(fs[_0x748d('0x53')](_0x15467c)){cypher=!![];return _0x4cecce['decryptFile'](_0x15467c,_0x1f5285[_0x748d('0x50')],config[_0x748d('0x55')][_0x748d('0x64')])[_0x748d('0x25')](function(){return _0x1f5285;});}return _0x1f5285;}})[_0x748d('0x25')](function(_0xb528ff){if(!_0xb528ff){throw new db['Sequelize'][(_0x748d('0x57'))](_0x748d('0x7f'));}_0x5af6be=_0xb528ff;return db['Setting'][_0x748d('0x7e')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x122778,null))['then'](function(_0x2edd3b){if(_0x2edd3b){_0x3c76e7=_0x2edd3b;if(!_0x3c76e7[_0x748d('0x80')]||!_0x3c76e7[_0x748d('0x81')]||!_0x3c76e7[_0x748d('0x82')]||!_0x3c76e7[_0x748d('0x83')]||!_0x3c76e7[_0x748d('0x74')]){throw new db['Sequelize'][(_0x748d('0x57'))]('Transcribe\x20not\x20configured');}if(_0x33f1c2[_0x748d('0x4c')]['runSentiment']&&(!_0x3c76e7['sentiment']||!_0x3c76e7[_0x748d('0x84')]||!_0x3c76e7[_0x748d('0x85')]||!_0x3c76e7[_0x748d('0x83')]||!_0x3c76e7[_0x748d('0x74')])){throw new db['Sequelize'][(_0x748d('0x57'))](_0x748d('0x86'));}return db['CloudProvider'][_0x748d('0x7e')]({'where':{'id':_0x3c76e7['transcribeAccountId']}});}})['then'](function(_0x40ebea){if(!_0x40ebea){throw new db['Sequelize']['ValidationError'](_0x748d('0x87'));}if(!_0x40ebea[_0x748d('0x88')]||!_0x40ebea[_0x748d('0x89')]){throw new db[(_0x748d('0x56'))][(_0x748d('0x57'))](_0x748d('0x8a'));}_0x31043e=_0x40ebea;return getBucketslist(_0x31043e['data1'],_0x31043e[_0x748d('0x89')],_0x3c76e7[_0x748d('0x82')]);})[_0x748d('0x25')](function(_0x42153c){if(_0x42153c&&_0x42153c[_0x748d('0x8b')]){var _0x53501f=_['find'](_0x42153c[_0x748d('0x8b')],function(_0x45530c){return _0x45530c[_0x748d('0x8c')]===_0x3c76e7[_0x748d('0x74')];});if(!_0x53501f){logger[_0x748d('0x66')](util[_0x748d('0x51')](_0x748d('0x8d'),_0x33f1c2[_0x748d('0x48')]['id'],_0x3c76e7[_0x748d('0x74')]));return createBucket(_0x31043e[_0x748d('0x88')],_0x31043e[_0x748d('0x89')],_0x3c76e7[_0x748d('0x82')],_0x3c76e7[_0x748d('0x74')]);}logger[_0x748d('0x66')](util[_0x748d('0x51')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x33f1c2[_0x748d('0x48')]['id'],_0x3c76e7[_0x748d('0x74')]));return;}})[_0x748d('0x25')](function(_0x1f1857){if(_0x5af6be[_0x748d('0x7b')]==='NEW'){return transcribe(_0x33f1c2[_0x748d('0x48')]['id'],_0x31043e[_0x748d('0x88')],_0x31043e[_0x748d('0x89')],_0x3c76e7[_0x748d('0x82')],_0x3c76e7['bucket'],_0x5af6be[_0x748d('0x50')],_0x3c76e7[_0x748d('0x83')]);}else{logger[_0x748d('0x66')](util[_0x748d('0x51')](_0x748d('0x8e'),_0x33f1c2[_0x748d('0x48')]['id']));return{'transcribeStatus':_0x748d('0x8f')};}})['then'](function(_0x17152c){if(_0x17152c){_0x17152c['tempSentiment']=_0x33f1c2['body'][_0x748d('0x90')];return _0x5af6be[_0x748d('0x91')](_0x17152c);}})[_0x748d('0x25')](respondWithResult(_0x122778,null))[_0x748d('0x46')](handleError(_0x122778,null));};function writeFile(_0xec5b52,_0x343185){return new Promise(function(_0x2f1579,_0x431dea){fs[_0x748d('0x92')](_0x343185,_0xec5b52,function(_0x3281e4,_0xd3b981){if(_0x3281e4){return _0x431dea(_0x3281e4);}else{return _0x2f1579(_0xd3b981);}});});}exports[_0x748d('0x93')]=function(_0x15c066,_0xaad121,_0x404762){return db[_0x748d('0x2c')][_0x748d('0x7e')]({'where':{'id':_0x15c066[_0x748d('0x48')]['id']}})[_0x748d('0x25')](handleEntityNotFound(_0xaad121))[_0x748d('0x25')](function(_0x582327){if(_0x582327&&_0x582327[_0x748d('0x94')]){var _0x53f925=_0x582327[_0x748d('0x94')];var _0x161393=config[_0x748d('0x95')]+_0x748d('0x96')+_0x582327['id']+_0x748d('0x97');if(fs[_0x748d('0x53')](_0x161393)){return _0x161393;}return writeFile(_0x53f925,_0x161393)[_0x748d('0x25')](function(){return _0x161393;});}else{throw new db[(_0x748d('0x56'))][(_0x748d('0x57'))]('Transcript\x20not\x20available');}})[_0x748d('0x25')](function(_0x4e11cb){return _0xaad121['download'](_0x4e11cb);})[_0x748d('0x46')](handleError(_0xaad121));}; \ No newline at end of file +var _0x5c58=['transcribe','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','transcribeRegion','Buckets','Name','data2','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','reject','update','then','destroy','error','name','index','map','VoiceRecording','rawAttributes','type','key','model','format','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','col','token','push','$and','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','Setting'];(function(_0x3524fc,_0x5d4249){var _0x4671f6=function(_0x2233e7){while(--_0x2233e7){_0x3524fc['push'](_0x3524fc['shift']());}};_0x4671f6(++_0x5d4249);}(_0x5c58,0x1d6));var _0x85c5=function(_0x11c0cd,_0x15818d){_0x11c0cd=_0x11c0cd-0x0;var _0x206707=_0x5c58[_0x11c0cd];return _0x206707;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x85c5('0x0'));var rimraf=require(_0x85c5('0x1'));var zipdir=require(_0x85c5('0x2'));var jsonpatch=require(_0x85c5('0x3'));var rp=require(_0x85c5('0x4'));var moment=require(_0x85c5('0x5'));var BPromise=require(_0x85c5('0x6'));var Mustache=require(_0x85c5('0x7'));var util=require('util');var path=require('path');var sox=require(_0x85c5('0x8'));var csv=require(_0x85c5('0x9'));var ejs=require(_0x85c5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x85c5('0xb'));var crypto=require(_0x85c5('0xc'));var jsforce=require(_0x85c5('0xd'));var deskjs=require(_0x85c5('0xe'));var toCsv=require(_0x85c5('0x9'));var querystring=require(_0x85c5('0xf'));var Papa=require('papaparse');var AWS=require(_0x85c5('0x10'));var uuidv4=require(_0x85c5('0x11'));var Redis=require(_0x85c5('0x12'));var authService=require(_0x85c5('0x13'));var qs=require(_0x85c5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85c5('0x15'))(_0x85c5('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x85c5('0x17'));var db=require(_0x85c5('0x18'))['db'];function respondWithStatusCode(_0x446080,_0x97f25){_0x97f25=_0x97f25||0xcc;return function(_0x22e181){if(_0x22e181){return _0x446080[_0x85c5('0x19')](_0x97f25);}return _0x446080['status'](_0x97f25)[_0x85c5('0x1a')]();};}function respondWithResult(_0x271e99,_0x56c2f5){_0x56c2f5=_0x56c2f5||0xc8;return function(_0x4a8570){if(_0x4a8570){return _0x271e99[_0x85c5('0x1b')](_0x56c2f5)[_0x85c5('0x1c')](_0x4a8570);}};}function respondWithFilteredResult(_0x5ec2a4,_0x2c24cd){return function(_0x506795){if(_0x506795){var _0x5d425b=_0x506795[_0x85c5('0x1d')],_0x507028=_0x2c24cd[_0x85c5('0x1e')],_0x467fbd=_0x2c24cd[_0x85c5('0x1e')]+_0x2c24cd['limit'],_0x41f9d9;if(_0x467fbd>=_0x5d425b){_0x467fbd=_0x5d425b;_0x41f9d9=0xc8;}else{_0x41f9d9=0xce;}_0x5ec2a4[_0x85c5('0x1b')](_0x41f9d9);return _0x5ec2a4[_0x85c5('0x1f')]('Content-Range',_0x507028+'-'+_0x467fbd+'/'+_0x5d425b)[_0x85c5('0x1c')](_0x506795);}return null;};}function patchUpdates(_0x1c781f){return function(_0x44d0f3){try{jsonpatch[_0x85c5('0x20')](_0x44d0f3,_0x1c781f,!![]);}catch(_0x2f4b52){return BPromise[_0x85c5('0x21')](_0x2f4b52);}return _0x44d0f3['save']();};}function saveUpdates(_0x1294dd,_0x496719){return function(_0x197612){if(_0x197612){return _0x197612[_0x85c5('0x22')](_0x1294dd)[_0x85c5('0x23')](function(_0x422335){return _0x422335;});}return null;};}function removeEntity(_0x3f23c7,_0x10dd00){return function(_0xd6536e){if(_0xd6536e){return _0xd6536e[_0x85c5('0x24')]()[_0x85c5('0x23')](function(){_0x3f23c7['status'](0xcc)[_0x85c5('0x1a')]();});}};}function handleEntityNotFound(_0x17e7a9,_0x4ee82a){return function(_0x2b0976){if(!_0x2b0976){_0x17e7a9[_0x85c5('0x19')](0x194);}return _0x2b0976;};}function handleError(_0xa53902,_0x1aa5fb){_0x1aa5fb=_0x1aa5fb||0x1f4;return function(_0x73e9ea){logger[_0x85c5('0x25')](_0x73e9ea['stack']);if(_0x73e9ea[_0x85c5('0x26')]){delete _0x73e9ea[_0x85c5('0x26')];}_0xa53902['status'](_0x1aa5fb)['send'](_0x73e9ea);};}exports[_0x85c5('0x27')]=function(_0x29c966,_0x158703){var _0x24bec5={},_0x2e9248={},_0x38d4f7={'count':0x0,'rows':[]};var _0x5be737=_[_0x85c5('0x28')](db[_0x85c5('0x29')][_0x85c5('0x2a')],function(_0x52aee4){return{'name':_0x52aee4['fieldName'],'type':_0x52aee4[_0x85c5('0x2b')][_0x85c5('0x2c')]};});_0x2e9248[_0x85c5('0x2d')]=_['differenceBy'](_[_0x85c5('0x28')](_0x5be737,_0x85c5('0x26')),[_0x85c5('0x2e')]);_0x2e9248[_0x85c5('0x2f')]=_[_0x85c5('0x30')](_0x29c966[_0x85c5('0x2f')]);_0x2e9248[_0x85c5('0x31')]=_[_0x85c5('0x32')](_0x2e9248[_0x85c5('0x2d')],_0x2e9248['query']);_0x24bec5['attributes']=_[_0x85c5('0x32')](_0x2e9248[_0x85c5('0x2d')],qs[_0x85c5('0x33')](_0x29c966[_0x85c5('0x2f')][_0x85c5('0x33')]));_0x24bec5[_0x85c5('0x34')]=_0x24bec5['attributes'][_0x85c5('0x35')]?_0x24bec5['attributes']:_0x2e9248[_0x85c5('0x2d')];if(!_0x29c966[_0x85c5('0x2f')]['hasOwnProperty'](_0x85c5('0x36'))){_0x24bec5[_0x85c5('0x37')]=qs[_0x85c5('0x37')](_0x29c966[_0x85c5('0x2f')][_0x85c5('0x37')]);_0x24bec5[_0x85c5('0x1e')]=qs[_0x85c5('0x1e')](_0x29c966[_0x85c5('0x2f')][_0x85c5('0x1e')]);}_0x24bec5[_0x85c5('0x38')]=qs[_0x85c5('0x39')](_0x29c966[_0x85c5('0x2f')][_0x85c5('0x39')]);_0x24bec5['where']=qs[_0x85c5('0x31')](_[_0x85c5('0x3a')](_0x29c966[_0x85c5('0x2f')],_0x2e9248[_0x85c5('0x31')]),_0x5be737);if(_0x29c966[_0x85c5('0x2f')][_0x85c5('0x3b')]){_0x24bec5[_0x85c5('0x3c')]=_[_0x85c5('0x3d')](_0x24bec5[_0x85c5('0x3c')],{'$or':_[_0x85c5('0x28')](_0x5be737,function(_0x399a99){if(_0x399a99[_0x85c5('0x2b')]!=='VIRTUAL'){var _0x16f1eb={};_0x16f1eb[_0x399a99[_0x85c5('0x26')]]={'$like':'%'+_0x29c966[_0x85c5('0x2f')][_0x85c5('0x3b')]+'%'};return _0x16f1eb;}})});}_0x24bec5=_[_0x85c5('0x3d')]({},_0x24bec5,_0x29c966[_0x85c5('0x3e')]);var _0x48f8fe={'where':_0x24bec5[_0x85c5('0x3c')]};return db[_0x85c5('0x29')][_0x85c5('0x1d')](_0x48f8fe)[_0x85c5('0x23')](function(_0x14fccc){_0x38d4f7[_0x85c5('0x1d')]=_0x14fccc;if(_0x29c966[_0x85c5('0x2f')][_0x85c5('0x3f')]){_0x24bec5[_0x85c5('0x40')]=[{'all':!![]}];}return db[_0x85c5('0x29')][_0x85c5('0x41')](_0x24bec5);})[_0x85c5('0x23')](function(_0x3fd02f){_0x38d4f7[_0x85c5('0x42')]=_0x3fd02f;return _0x38d4f7;})[_0x85c5('0x23')](respondWithFilteredResult(_0x158703,_0x24bec5))[_0x85c5('0x43')](handleError(_0x158703,null));};exports[_0x85c5('0x44')]=function(_0x2e5e78,_0x1bde83){var _0x4df8f3={'raw':![],'where':{'id':_0x2e5e78[_0x85c5('0x45')]['id']}},_0x15167f={};_0x15167f['model']=_[_0x85c5('0x30')](db['VoiceRecording'][_0x85c5('0x2a')]);_0x15167f[_0x85c5('0x2f')]=_[_0x85c5('0x30')](_0x2e5e78[_0x85c5('0x2f')]);_0x15167f[_0x85c5('0x31')]=_[_0x85c5('0x32')](_0x15167f[_0x85c5('0x2d')],_0x15167f[_0x85c5('0x2f')]);_0x4df8f3[_0x85c5('0x34')]=_[_0x85c5('0x32')](_0x15167f[_0x85c5('0x2d')],qs[_0x85c5('0x33')](_0x2e5e78[_0x85c5('0x2f')]['fields']));_0x4df8f3[_0x85c5('0x34')]=_0x4df8f3['attributes'][_0x85c5('0x35')]?_0x4df8f3['attributes']:_0x15167f[_0x85c5('0x2d')];if(_0x2e5e78[_0x85c5('0x2f')]['includeAll']){_0x4df8f3[_0x85c5('0x40')]=[{'all':!![]}];}_0x4df8f3=_[_0x85c5('0x3d')]({},_0x4df8f3,_0x2e5e78[_0x85c5('0x3e')]);return db[_0x85c5('0x29')][_0x85c5('0x46')](_0x4df8f3)[_0x85c5('0x23')](handleEntityNotFound(_0x1bde83,null))['then'](respondWithResult(_0x1bde83,null))[_0x85c5('0x43')](handleError(_0x1bde83,null));};exports[_0x85c5('0x47')]=function(_0x3a799e,_0x554072){return db[_0x85c5('0x29')]['create'](_0x3a799e[_0x85c5('0x48')],{})[_0x85c5('0x23')](respondWithResult(_0x554072,0xc9))[_0x85c5('0x43')](handleError(_0x554072,null));};exports[_0x85c5('0x22')]=function(_0x24e795,_0x17e00f){if(_0x24e795[_0x85c5('0x48')]['id']){delete _0x24e795['body']['id'];}return db[_0x85c5('0x29')][_0x85c5('0x46')]({'where':{'id':_0x24e795[_0x85c5('0x45')]['id']}})['then'](handleEntityNotFound(_0x17e00f,null))[_0x85c5('0x23')](saveUpdates(_0x24e795[_0x85c5('0x48')],null))[_0x85c5('0x23')](respondWithResult(_0x17e00f,null))[_0x85c5('0x43')](handleError(_0x17e00f,null));};exports['describe']=function(_0x5e03f2,_0x57f213){return db[_0x85c5('0x29')][_0x85c5('0x49')]()[_0x85c5('0x23')](respondWithResult(_0x57f213,null))[_0x85c5('0x43')](handleError(_0x57f213,null));};exports[_0x85c5('0x4a')]=function(_0x1e4a24,_0x340180,_0x28ca33){var _0x445245=require(_0x85c5('0x4b'));var _0x5352db=![];var _0x83f359={};if(_0x1e4a24[_0x85c5('0x2f')][_0x85c5('0x2b')]&&_0x1e4a24[_0x85c5('0x2f')][_0x85c5('0x2b')]===_0x85c5('0x4c')){_0x83f359['uniqueid']=_0x1e4a24[_0x85c5('0x45')]['id'];}else{_0x83f359['id']=_0x1e4a24['params']['id'];}return db['VoiceRecording'][_0x85c5('0x46')]({'where':_0x83f359,'attributes':['id',_0x85c5('0x4d')],'raw':!![]})[_0x85c5('0x23')](handleEntityNotFound(_0x340180,null))[_0x85c5('0x23')](function(_0x261f96){if(_0x261f96){var _0x4a5ae6=_0x261f96[_0x85c5('0x4d')];var _0x54c687=util[_0x85c5('0x2e')]('%s.cypher',_0x4a5ae6);if(fs[_0x85c5('0x4e')](_0x54c687)){_0x5352db=!![];return _0x445245[_0x85c5('0x4f')](_0x54c687,_0x4a5ae6,config[_0x85c5('0x50')][_0x85c5('0x51')])['then'](function(){return _0x261f96;});}return _0x261f96;}})[_0x85c5('0x23')](function(_0x49e740){if(_0x49e740){var _0x59f52c=_0x49e740[_0x85c5('0x4d')];if(!fs[_0x85c5('0x4e')](_0x59f52c)){throw new db[(_0x85c5('0x52'))][(_0x85c5('0x53'))](_0x85c5('0x54'));}if(_0x49e740[_0x85c5('0x55')]){return _0x340180['download'](_0x59f52c,_0x49e740[_0x85c5('0x55')]+path[_0x85c5('0x56')](_0x59f52c),function(){if(_0x5352db){fs[_0x85c5('0x57')](_0x59f52c);}});}else{return _0x340180['download'](_0x59f52c,function(_0x5a8057){if(_0x5352db){fs[_0x85c5('0x57')](_0x59f52c);}});}}})['catch'](function(_0x36321a){if(_0x36321a[_0x85c5('0x58')]==='VoiceRecording\x20not\x20found'){_0x340180[_0x85c5('0x1b')](0x194)['send'](_0x85c5('0x59'));}else{return handleError(_0x340180,null);}});};exports[_0x85c5('0x5a')]=function(_0x20d262,_0x1ed19f,_0x12c3ef){var _0x530435=require('../../components/encryptor');var _0x4f2c4b=![];var _0xa3c51f={'$and':[db[_0x85c5('0x5b')]['where'](db[_0x85c5('0x5b')]['fn']('MD5',db[_0x85c5('0x5b')][_0x85c5('0x5c')](_0x85c5('0x4c'))),_0x20d262[_0x85c5('0x2f')][_0x85c5('0x5d')])]};if(_0x20d262[_0x85c5('0x2f')]['type']&&_0x20d262[_0x85c5('0x2f')][_0x85c5('0x2b')]===_0x85c5('0x4c')){_0xa3c51f['$and'][_0x85c5('0x5e')]({'uniqueid':_0x20d262[_0x85c5('0x45')]['id']});}else{_0xa3c51f[_0x85c5('0x5f')][_0x85c5('0x5e')]({'id':_0x20d262[_0x85c5('0x45')]['id']});}return db[_0x85c5('0x29')]['find']({'where':_0xa3c51f,'attributes':['id',_0x85c5('0x4d')],'raw':!![]})[_0x85c5('0x23')](handleEntityNotFound(_0x1ed19f,null))[_0x85c5('0x23')](function(_0x486d64){if(_0x486d64){var _0x5bdf4e=util[_0x85c5('0x2e')]('%s.cypher',_0x486d64[_0x85c5('0x4d')]);if(fs[_0x85c5('0x4e')](_0x5bdf4e)){_0x4f2c4b=!![];return _0x530435[_0x85c5('0x4f')](_0x5bdf4e,_0x486d64[_0x85c5('0x4d')],config['secrets'][_0x85c5('0x51')])[_0x85c5('0x23')](function(){return _0x486d64;});}return _0x486d64;}})['then'](function(_0x17ea3c){if(_0x17ea3c){if(!fs[_0x85c5('0x4e')](_0x17ea3c[_0x85c5('0x4d')])){throw new db[(_0x85c5('0x52'))][(_0x85c5('0x53'))](_0x85c5('0x54'));}if(_0x17ea3c['filename']){return _0x1ed19f[_0x85c5('0x4a')](_0x17ea3c[_0x85c5('0x4d')],_0x17ea3c['filename']+path[_0x85c5('0x56')](_0x17ea3c[_0x85c5('0x4d')]),function(){if(_0x4f2c4b){fs[_0x85c5('0x57')](_0x17ea3c['value']);}});}else{return _0x1ed19f[_0x85c5('0x4a')](_0x17ea3c[_0x85c5('0x4d')],function(_0x227e12){if(_0x4f2c4b){fs[_0x85c5('0x57')](_0x17ea3c[_0x85c5('0x4d')]);}});}}})['catch'](handleError(_0x1ed19f,null));};exports[_0x85c5('0x24')]=function(_0x327e14,_0x1033e8){return db[_0x85c5('0x29')][_0x85c5('0x46')]({'where':{'id':_0x327e14[_0x85c5('0x45')]['id']}})['then'](function(_0x20654f){if(!_0x20654f)throw new ReferenceError(_0x85c5('0x60'));return _0x20654f;})[_0x85c5('0x23')](function(_0x94c7d9){var _0x2d939d=_0x94c7d9[_0x85c5('0x4d')];logger['info'](_0x85c5('0x61'),_0x2d939d);if(!_[_0x85c5('0x62')](_0x94c7d9['value'])&&fs[_0x85c5('0x4e')](_0x2d939d)){logger[_0x85c5('0x63')](_0x85c5('0x64')+_0x2d939d+_0x85c5('0x65'));fs['unlinkSync'](_0x2d939d);}_0x2d939d=_0x2d939d+_0x85c5('0x66');if(!_[_0x85c5('0x62')](_0x94c7d9[_0x85c5('0x4d')])&&fs[_0x85c5('0x4e')](_0x2d939d)){logger[_0x85c5('0x63')]('File:\x20\x22'+_0x2d939d+_0x85c5('0x65'));fs[_0x85c5('0x67')](_0x2d939d);}return _0x94c7d9;})[_0x85c5('0x23')](function(_0x59d998){if(!_0x59d998)throw new InternalError();return _0x59d998['destroy']();})[_0x85c5('0x23')](function(){_0x1033e8[_0x85c5('0x1b')](0xcc)['end']();})['catch'](handleError(_0x1033e8,null));};function getBucketslist(_0x15b15a,_0x460fce,_0x44af89){return new Promise(function(_0x2add09,_0x2f0cfb){var _0x4c1bf6=new AWS['S3']({'accessKeyId':_0x460fce,'secretAccessKey':_0x15b15a,'region':_0x44af89});_0x4c1bf6[_0x85c5('0x68')]({},function(_0x24f35b,_0x5ab4f0){if(_0x24f35b){return _0x2f0cfb(_0x24f35b);}else{return _0x2add09(_0x5ab4f0);}});});}function createBucket(_0x59e0a6,_0x5d2fe6,_0xa937b3,_0x4b840e){return new Promise(function(_0xb9b1fc,_0xe28fc6){var _0x5dd3fe=new AWS['S3']({'accessKeyId':_0x5d2fe6,'secretAccessKey':_0x59e0a6,'region':_0xa937b3});_0x5dd3fe['createBucket']({'Bucket':_0x4b840e},function(_0x40fcac,_0x16bf3c){if(_0x40fcac){return _0xe28fc6(_0x40fcac);}else{return _0xb9b1fc(_0x16bf3c);}});});}function uploadFile(_0x42298e,_0x4e1b97,_0x480d6e,_0xff97f2,_0x2a0537,_0x22798a){return new Promise(function(_0x1ecd9f,_0x19634d){var _0x3192f3=new AWS['S3']({'accessKeyId':_0x4e1b97,'secretAccessKey':_0x42298e,'region':_0x480d6e});_0x3192f3[_0x85c5('0x69')]({'Bucket':_0xff97f2,'Key':_0x2a0537,'Body':_0x22798a},function(_0x332bff,_0x5d451b){if(_0x332bff){return _0x19634d(_0x332bff);}else{return _0x1ecd9f(_0x5d451b);}});});}function startTranscribe(_0x464193,_0x4aae88,_0x378bdf,_0x1187a4,_0xb616d2,_0x127013){return new Promise(function(_0x110c73,_0x10daee){var _0x5cbdea=new AWS[(_0x85c5('0x6a'))]({'accessKeyId':_0x4aae88,'secretAccessKey':_0x464193,'region':_0x378bdf});_0x5cbdea[_0x85c5('0x6b')]({'TranscriptionJobName':_0x1187a4,'LanguageCode':_0xb616d2,'Media':{'MediaFileUri':_0x127013}},function(_0x730366,_0x48a4bd){if(_0x730366){return _0x10daee(_0x730366);}else{return _0x110c73(_0x48a4bd);}});});}function transcribe(_0x4db7d2,_0x529ead,_0x20f4e5,_0x17de3b,_0x101bdd,_0x431f72,_0x4ee972){return new Promise(function(_0x187488,_0x22604d){var _0x4a39f5={};logger[_0x85c5('0x63')](util[_0x85c5('0x2e')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4db7d2,_0x101bdd));return uploadFile(_0x529ead,_0x20f4e5,_0x17de3b,_0x101bdd,path[_0x85c5('0x6c')](_0x431f72),fs[_0x85c5('0x6d')](_0x431f72))[_0x85c5('0x23')](function(_0x6a208e){logger[_0x85c5('0x63')](util[_0x85c5('0x2e')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x4db7d2,_0x101bdd,_0x6a208e['Location']));_0x4a39f5[_0x85c5('0x6e')]=_0x6a208e[_0x85c5('0x6f')];_0x4a39f5[_0x85c5('0x70')]=_0x6a208e[_0x85c5('0x71')];logger[_0x85c5('0x63')](util['format'](_0x85c5('0x72'),_0x4db7d2));return startTranscribe(_0x529ead,_0x20f4e5,_0x17de3b,uuidv4(),_0x4ee972,_0x6a208e[_0x85c5('0x71')]);})[_0x85c5('0x23')](function(_0x19bf30){logger['info'](util[_0x85c5('0x2e')](_0x85c5('0x73'),_0x4db7d2,_0x19bf30['TranscriptionJob'][_0x85c5('0x74')]));_0x4a39f5[_0x85c5('0x75')]=_0x19bf30[_0x85c5('0x76')][_0x85c5('0x74')];_0x4a39f5[_0x85c5('0x77')]=_0x19bf30['TranscriptionJob'][_0x85c5('0x78')];return _0x187488(_0x4a39f5);})['catch'](function(_0x58a2c9){return _0x22604d(_0x58a2c9);});});}exports[_0x85c5('0x79')]=function(_0x456f3b,_0x3d804e,_0x160426){var _0x39f080;var _0x29e262;var _0x4c5541;var _0x1e6bc7=require(_0x85c5('0x4b'));return db[_0x85c5('0x29')][_0x85c5('0x7a')]({'where':{'id':_0x456f3b[_0x85c5('0x45')]['id']}})[_0x85c5('0x23')](function(_0x47a975){if(_0x47a975){var _0x29bfec=util[_0x85c5('0x2e')](_0x85c5('0x7b'),_0x47a975[_0x85c5('0x4d')]);if(fs[_0x85c5('0x4e')](_0x29bfec)){cypher=!![];return _0x1e6bc7[_0x85c5('0x4f')](_0x29bfec,_0x47a975[_0x85c5('0x4d')],config[_0x85c5('0x50')][_0x85c5('0x51')])[_0x85c5('0x23')](function(){return _0x47a975;});}return _0x47a975;}})[_0x85c5('0x23')](function(_0x16178d){if(!_0x16178d){throw new db['Sequelize'][(_0x85c5('0x53'))](_0x85c5('0x7c'));}_0x29e262=_0x16178d;return db[_0x85c5('0x7d')][_0x85c5('0x7a')]({'where':{'id':0x1}});})[_0x85c5('0x23')](handleEntityNotFound(_0x3d804e,null))['then'](function(_0x319fb5){if(_0x319fb5){_0x39f080=_0x319fb5;if(!_0x39f080[_0x85c5('0x7e')]||!_0x39f080['transcribeAccountId']||!_0x39f080['transcribeRegion']||!_0x39f080['language']||!_0x39f080[_0x85c5('0x6e')]){throw new db[(_0x85c5('0x52'))][(_0x85c5('0x53'))](_0x85c5('0x7f'));}if(_0x456f3b['body'][_0x85c5('0x80')]&&(!_0x39f080[_0x85c5('0x81')]||!_0x39f080[_0x85c5('0x82')]||!_0x39f080['sentimentRegion']||!_0x39f080['language']||!_0x39f080['bucket'])){throw new db[(_0x85c5('0x52'))][(_0x85c5('0x53'))](_0x85c5('0x83'));}return db[_0x85c5('0x84')][_0x85c5('0x7a')]({'where':{'id':_0x39f080[_0x85c5('0x85')]}});}})['then'](function(_0x2f19ac){if(!_0x2f19ac){throw new db[(_0x85c5('0x52'))][(_0x85c5('0x53'))](_0x85c5('0x86'));}if(!_0x2f19ac['data1']||!_0x2f19ac['data2']){throw new db[(_0x85c5('0x52'))][(_0x85c5('0x53'))]('Cloud\x20Provider\x20not\x20configured');}_0x4c5541=_0x2f19ac;return getBucketslist(_0x4c5541[_0x85c5('0x87')],_0x4c5541['data2'],_0x39f080[_0x85c5('0x88')]);})['then'](function(_0x2bbf25){if(_0x2bbf25&&_0x2bbf25['Buckets']){var _0x4daccc=_['find'](_0x2bbf25[_0x85c5('0x89')],function(_0x50c68e){return _0x50c68e[_0x85c5('0x8a')]===_0x39f080[_0x85c5('0x6e')];});if(!_0x4daccc){logger[_0x85c5('0x63')](util[_0x85c5('0x2e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x456f3b[_0x85c5('0x45')]['id'],_0x39f080[_0x85c5('0x6e')]));return createBucket(_0x4c5541[_0x85c5('0x87')],_0x4c5541[_0x85c5('0x8b')],_0x39f080['transcribeRegion'],_0x39f080[_0x85c5('0x6e')]);}logger[_0x85c5('0x63')](util[_0x85c5('0x2e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x456f3b[_0x85c5('0x45')]['id'],_0x39f080['bucket']));return;}})[_0x85c5('0x23')](function(_0x2d2dd7){if(_0x29e262[_0x85c5('0x77')]===_0x85c5('0x8c')){return transcribe(_0x456f3b[_0x85c5('0x45')]['id'],_0x4c5541[_0x85c5('0x87')],_0x4c5541[_0x85c5('0x8b')],_0x39f080[_0x85c5('0x88')],_0x39f080[_0x85c5('0x6e')],_0x29e262['value'],_0x39f080['language']);}else{logger[_0x85c5('0x63')](util[_0x85c5('0x2e')](_0x85c5('0x8d'),_0x456f3b['params']['id']));return{'transcribeStatus':_0x85c5('0x8e')};}})['then'](function(_0x4ade26){if(_0x4ade26){_0x4ade26[_0x85c5('0x8f')]=_0x456f3b[_0x85c5('0x48')][_0x85c5('0x80')];return _0x29e262[_0x85c5('0x90')](_0x4ade26);}})[_0x85c5('0x23')](respondWithResult(_0x3d804e,null))[_0x85c5('0x43')](handleError(_0x3d804e,null));};function writeFile(_0xe288df,_0x5ccba4){return new Promise(function(_0x1421f0,_0x43713c){fs[_0x85c5('0x91')](_0x5ccba4,_0xe288df,function(_0xabab8b,_0x4be577){if(_0xabab8b){return _0x43713c(_0xabab8b);}else{return _0x1421f0(_0x4be577);}});});}exports[_0x85c5('0x92')]=function(_0x3f4b6f,_0x55be7c,_0x355bdf){return db[_0x85c5('0x29')][_0x85c5('0x7a')]({'where':{'id':_0x3f4b6f[_0x85c5('0x45')]['id']}})[_0x85c5('0x23')](handleEntityNotFound(_0x55be7c))['then'](function(_0x63b47d){if(_0x63b47d&&_0x63b47d[_0x85c5('0x93')]){var _0x473772=_0x63b47d['fileText'];var _0x6aa4f2=config['root']+'/server/files/transcribes/transcribe_'+_0x63b47d['id']+_0x85c5('0x94');if(fs[_0x85c5('0x4e')](_0x6aa4f2)){return _0x6aa4f2;}return writeFile(_0x473772,_0x6aa4f2)[_0x85c5('0x23')](function(){return _0x6aa4f2;});}else{throw new db[(_0x85c5('0x52'))][(_0x85c5('0x53'))]('Transcript\x20not\x20available');}})[_0x85c5('0x23')](function(_0x2eb25e){return _0x55be7c[_0x85c5('0x4a')](_0x2eb25e);})[_0x85c5('0x43')](handleError(_0x55be7c));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index d0d359f..9dcdb54 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 _0x4ff4=['define','VoiceRecording','uniqueid','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x3aa671,_0x392e38){var _0xb2faba=function(_0x16fd9d){while(--_0x16fd9d){_0x3aa671['push'](_0x3aa671['shift']());}};_0xb2faba(++_0x392e38);}(_0x4ff4,0x1c5));var _0x44ff=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0x4ff4[_0x5179a5];return _0x15c8ce;};'use strict';var _=require(_0x44ff('0x0'));var util=require(_0x44ff('0x1'));var logger=require(_0x44ff('0x2'))(_0x44ff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x44ff('0x4'));var fs=require('fs');var path=require(_0x44ff('0x5'));var rimraf=require('rimraf');var config=require(_0x44ff('0x6'));var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x10f66e,_0xbe0c5f){return _0x10f66e[_0x44ff('0x7')](_0x44ff('0x8'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x44ff('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x11ff=['define','voice_recordings','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x43fe5b,_0x165399){var _0x11fae8=function(_0x6f9e24){while(--_0x6f9e24){_0x43fe5b['push'](_0x43fe5b['shift']());}};_0x11fae8(++_0x165399);}(_0x11ff,0xed));var _0xf11f=function(_0x1d22b2,_0x503da2){_0x1d22b2=_0x1d22b2-0x0;var _0x365b7c=_0x11ff[_0x1d22b2];return _0x365b7c;};'use strict';var _=require(_0xf11f('0x0'));var util=require(_0xf11f('0x1'));var logger=require(_0xf11f('0x2'))(_0xf11f('0x3'));var moment=require('moment');var BPromise=require(_0xf11f('0x4'));var rp=require(_0xf11f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf11f('0x6'));var config=require(_0xf11f('0x7'));var attributes=require(_0xf11f('0x8'));module[_0xf11f('0x9')]=function(_0x6af888,_0x48540f){return _0x6af888[_0xf11f('0xa')]('VoiceRecording',attributes,{'tableName':_0xf11f('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf11f('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 2adf20a..af3e4bb 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(_0x306106,_0x7dc50d){var _0x4d6083=function(_0x2a5b5a){while(--_0x2a5b5a){_0x306106['push'](_0x306106['shift']());}};_0x4d6083(++_0x7dc50d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x455893,_0x909838){var _0x3851e8=function(_0x32ac8a){while(--_0x32ac8a){_0x455893['push'](_0x455893['shift']());}};_0x3851e8(++_0x909838);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 e6f2a01..0ea75b7 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 _0xaf71=['put','update','delete','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x5a90f0,_0x1a6754){var _0x592c57=function(_0xc34577){while(--_0xc34577){_0x5a90f0['push'](_0x5a90f0['shift']());}};_0x592c57(++_0x1a6754);}(_0xaf71,0x19c));var _0x1af7=function(_0x58978d,_0x1d93a6){_0x58978d=_0x58978d-0x0;var _0x36460b=_0xaf71[_0x58978d];return _0x36460b;};'use strict';var multer=require(_0x1af7('0x0'));var util=require(_0x1af7('0x1'));var path=require('path');var timeout=require(_0x1af7('0x2'));var express=require('express');var router=express[_0x1af7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1af7('0x4'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x1af7('0x5')]('/',auth[_0x1af7('0x6')](),controller[_0x1af7('0x7')]);router[_0x1af7('0x5')](_0x1af7('0x8'),auth['isAuthenticated'](),controller[_0x1af7('0x9')]);router[_0x1af7('0x5')](_0x1af7('0xa'),auth[_0x1af7('0x6')](),controller['show']);router[_0x1af7('0xb')]('/',auth[_0x1af7('0x6')](),controller[_0x1af7('0xc')]);router[_0x1af7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x1af7('0xe')]);router[_0x1af7('0xf')](_0x1af7('0xa'),auth[_0x1af7('0x6')](),controller[_0x1af7('0x10')]);module['exports']=router; \ No newline at end of file +var _0x09a8=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','index','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x1cb32e,_0x31742a){var _0x2a6223=function(_0x14afc){while(--_0x14afc){_0x1cb32e['push'](_0x1cb32e['shift']());}};_0x2a6223(++_0x31742a);}(_0x09a8,0x18d));var _0x809a=function(_0x5bafb7,_0x118634){_0x5bafb7=_0x5bafb7-0x0;var _0xb0069c=_0x09a8[_0x5bafb7];return _0xb0069c;};'use strict';var multer=require(_0x809a('0x0'));var util=require(_0x809a('0x1'));var path=require(_0x809a('0x2'));var timeout=require(_0x809a('0x3'));var express=require(_0x809a('0x4'));var router=express['Router']();var auth=require(_0x809a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x809a('0x6'));var controller=require(_0x809a('0x7'));router[_0x809a('0x8')]('/',auth['isAuthenticated'](),controller[_0x809a('0x9')]);router[_0x809a('0x8')]('/describe',auth[_0x809a('0xa')](),controller['describe']);router[_0x809a('0x8')](_0x809a('0xb'),auth[_0x809a('0xa')](),controller[_0x809a('0xc')]);router['post']('/',auth[_0x809a('0xa')](),controller[_0x809a('0xd')]);router[_0x809a('0xe')](_0x809a('0xb'),auth['isAuthenticated'](),controller[_0x809a('0xf')]);router[_0x809a('0x10')](_0x809a('0xb'),auth['isAuthenticated'](),controller[_0x809a('0x11')]);module[_0x809a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 970563c..91253fb 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 _0xf126=['moment','exports','ENUM','attended','STRING','sequelize'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xf126,0x6b));var _0x6f12=function(_0xf915a7,_0x3c5104){_0xf915a7=_0xf915a7-0x0;var _0x714195=_0xf126[_0xf915a7];return _0x714195;};'use strict';var Sequelize=require(_0x6f12('0x0'));var moment=require(_0x6f12('0x1'));module[_0x6f12('0x2')]={'type':{'type':Sequelize[_0x6f12('0x3')]('blind',_0x6f12('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x6f12('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x6f12('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x6f12('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x6f12('0x5')]},'transferercontext':{'type':Sequelize[_0x6f12('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x6f12('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x6f12('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x6f12('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x6f12('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x6f12('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x6f12('0x5')]},'transfereecontext':{'type':Sequelize[_0x6f12('0x5')]},'transfereeexten':{'type':Sequelize[_0x6f12('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x6f12('0x5')]},'isexternal':{'type':Sequelize[_0x6f12('0x3')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x6f12('0x5')]}}; \ No newline at end of file +var _0x127e=['STRING','Yes','moment','exports','ENUM','blind','attended'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x127e,0x160));var _0xe127=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x127e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe127('0x0'));module[_0xe127('0x1')]={'type':{'type':Sequelize[_0xe127('0x2')](_0xe127('0x3'),_0xe127('0x4'))},'result':{'type':Sequelize[_0xe127('0x5')]},'transfererchannel':{'type':Sequelize[_0xe127('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xe127('0x5')]},'transferercalleridname':{'type':Sequelize[_0xe127('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe127('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xe127('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xe127('0x5')]},'transferercontext':{'type':Sequelize[_0xe127('0x5')]},'transfererexten':{'type':Sequelize[_0xe127('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xe127('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xe127('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xe127('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe127('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe127('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xe127('0x5')]},'transfereeexten':{'type':Sequelize[_0xe127('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xe127('0x5')]},'isexternal':{'type':Sequelize[_0xe127('0x2')](_0xe127('0x6'),'No')},'context':{'type':Sequelize[_0xe127('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 3e5e6ce..0740d52 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 _0x4ec4=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','destroy','error','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','params','keys','include','find','create','body','describe','html-pdf','eml-format','rimraf'];(function(_0xcaa1bc,_0x4a8314){var _0x11a3b1=function(_0x2fdb50){while(--_0x2fdb50){_0xcaa1bc['push'](_0xcaa1bc['shift']());}};_0x11a3b1(++_0x4a8314);}(_0x4ec4,0x125));var _0x44ec=function(_0x2616cd,_0x6b2d90){_0x2616cd=_0x2616cd-0x0;var _0x4e1fcb=_0x4ec4[_0x2616cd];return _0x4e1fcb;};'use strict';var pdf=require(_0x44ec('0x0'));var emlformat=require(_0x44ec('0x1'));var rimraf=require(_0x44ec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x44ec('0x3'));var rp=require(_0x44ec('0x4'));var moment=require(_0x44ec('0x5'));var BPromise=require(_0x44ec('0x6'));var Mustache=require(_0x44ec('0x7'));var util=require(_0x44ec('0x8'));var path=require('path');var sox=require(_0x44ec('0x9'));var csv=require(_0x44ec('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x44ec('0xb'));var squel=require(_0x44ec('0xc'));var crypto=require(_0x44ec('0xd'));var jsforce=require(_0x44ec('0xe'));var deskjs=require(_0x44ec('0xf'));var toCsv=require(_0x44ec('0xa'));var querystring=require(_0x44ec('0x10'));var Papa=require('papaparse');var Redis=require(_0x44ec('0x11'));var authService=require(_0x44ec('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x44ec('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x44ec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x44ec('0x15'));var licenseUtil=require(_0x44ec('0x16'));var db=require(_0x44ec('0x17'))['db'];function respondWithStatusCode(_0x37ef19,_0x4cdf0c){_0x4cdf0c=_0x4cdf0c||0xcc;return function(_0x26a6eb){if(_0x26a6eb){return _0x37ef19[_0x44ec('0x18')](_0x4cdf0c);}return _0x37ef19[_0x44ec('0x19')](_0x4cdf0c)[_0x44ec('0x1a')]();};}function respondWithResult(_0x2dbd5e,_0x3bbf64){_0x3bbf64=_0x3bbf64||0xc8;return function(_0x3ee949){if(_0x3ee949){return _0x2dbd5e[_0x44ec('0x19')](_0x3bbf64)[_0x44ec('0x1b')](_0x3ee949);}};}function respondWithFilteredResult(_0x57fb32,_0x4beca6){return function(_0x348c9d){if(_0x348c9d){var _0x22fa25=_0x348c9d['count'],_0xca7f51=_0x4beca6[_0x44ec('0x1c')],_0x5a45f4=_0x4beca6[_0x44ec('0x1c')]+_0x4beca6[_0x44ec('0x1d')],_0x468921;if(_0x5a45f4>=_0x22fa25){_0x5a45f4=_0x22fa25;_0x468921=0xc8;}else{_0x468921=0xce;}_0x57fb32[_0x44ec('0x19')](_0x468921);return _0x57fb32[_0x44ec('0x1e')]('Content-Range',_0xca7f51+'-'+_0x5a45f4+'/'+_0x22fa25)[_0x44ec('0x1b')](_0x348c9d);}return null;};}function patchUpdates(_0x5cf050){return function(_0x3f2565){try{jsonpatch[_0x44ec('0x1f')](_0x3f2565,_0x5cf050,!![]);}catch(_0x51877b){return BPromise[_0x44ec('0x20')](_0x51877b);}return _0x3f2565['save']();};}function saveUpdates(_0x20cb5e,_0x52aa71){return function(_0x36d2bc){if(_0x36d2bc){return _0x36d2bc[_0x44ec('0x21')](_0x20cb5e)[_0x44ec('0x22')](function(_0x4e160d){return _0x4e160d;});}return null;};}function removeEntity(_0x48fede,_0x1968ba){return function(_0x142f73){if(_0x142f73){return _0x142f73[_0x44ec('0x23')]()['then'](function(){_0x48fede[_0x44ec('0x19')](0xcc)[_0x44ec('0x1a')]();});}};}function handleEntityNotFound(_0x48be86,_0x2e8a28){return function(_0xd1055c){if(!_0xd1055c){_0x48be86[_0x44ec('0x18')](0x194);}return _0xd1055c;};}function handleError(_0x3acc81,_0x5898b7){_0x5898b7=_0x5898b7||0x1f4;return function(_0x30a812){logger[_0x44ec('0x24')](_0x30a812['stack']);if(_0x30a812[_0x44ec('0x25')]){delete _0x30a812[_0x44ec('0x25')];}_0x3acc81[_0x44ec('0x19')](_0x5898b7)[_0x44ec('0x26')](_0x30a812);};}exports['index']=function(_0x384d50,_0x3fa437){var _0x1beb81={},_0xcb9a42={},_0x5f5805={'count':0x0,'rows':[]};var _0x22f2c9=_[_0x44ec('0x27')](db[_0x44ec('0x28')][_0x44ec('0x29')],function(_0x291805){return{'name':_0x291805[_0x44ec('0x2a')],'type':_0x291805[_0x44ec('0x2b')][_0x44ec('0x2c')]};});_0xcb9a42[_0x44ec('0x2d')]=_[_0x44ec('0x27')](_0x22f2c9,_0x44ec('0x25'));_0xcb9a42['query']=_['keys'](_0x384d50['query']);_0xcb9a42[_0x44ec('0x2e')]=_[_0x44ec('0x2f')](_0xcb9a42['model'],_0xcb9a42[_0x44ec('0x30')]);_0x1beb81[_0x44ec('0x31')]=_[_0x44ec('0x2f')](_0xcb9a42[_0x44ec('0x2d')],qs[_0x44ec('0x32')](_0x384d50[_0x44ec('0x30')][_0x44ec('0x32')]));_0x1beb81['attributes']=_0x1beb81[_0x44ec('0x31')][_0x44ec('0x33')]?_0x1beb81[_0x44ec('0x31')]:_0xcb9a42['model'];if(!_0x384d50[_0x44ec('0x30')][_0x44ec('0x34')](_0x44ec('0x35'))){_0x1beb81[_0x44ec('0x1d')]=qs[_0x44ec('0x1d')](_0x384d50[_0x44ec('0x30')][_0x44ec('0x1d')]);_0x1beb81[_0x44ec('0x1c')]=qs[_0x44ec('0x1c')](_0x384d50['query']['offset']);}_0x1beb81[_0x44ec('0x36')]=qs[_0x44ec('0x37')](_0x384d50[_0x44ec('0x30')][_0x44ec('0x37')]);_0x1beb81[_0x44ec('0x38')]=qs[_0x44ec('0x2e')](_[_0x44ec('0x39')](_0x384d50['query'],_0xcb9a42['filters']),_0x22f2c9);if(_0x384d50[_0x44ec('0x30')]['filter']){_0x1beb81[_0x44ec('0x38')]=_[_0x44ec('0x3a')](_0x1beb81['where'],{'$or':_['map'](_0x22f2c9,function(_0x5e8a68){if(_0x5e8a68[_0x44ec('0x2b')]!==_0x44ec('0x3b')){var _0x22e4de={};_0x22e4de[_0x5e8a68[_0x44ec('0x25')]]={'$like':'%'+_0x384d50[_0x44ec('0x30')][_0x44ec('0x3c')]+'%'};return _0x22e4de;}})});}_0x1beb81=_['merge']({},_0x1beb81,_0x384d50[_0x44ec('0x3d')]);var _0x3445ca={'where':_0x1beb81['where']};return db[_0x44ec('0x28')][_0x44ec('0x3e')](_0x3445ca)['then'](function(_0x4e6595){_0x5f5805[_0x44ec('0x3e')]=_0x4e6595;if(_0x384d50['query'][_0x44ec('0x3f')]){_0x1beb81['include']=[{'all':!![]}];}return db[_0x44ec('0x28')][_0x44ec('0x40')](_0x1beb81);})[_0x44ec('0x22')](function(_0x37e316){_0x5f5805[_0x44ec('0x41')]=_0x37e316;return _0x5f5805;})[_0x44ec('0x22')](respondWithFilteredResult(_0x3fa437,_0x1beb81))[_0x44ec('0x42')](handleError(_0x3fa437,null));};exports['show']=function(_0x4a6abe,_0x46e845){var _0x8184c5={'raw':!![],'where':{'id':_0x4a6abe[_0x44ec('0x43')]['id']}},_0x1e3c02={};_0x1e3c02[_0x44ec('0x2d')]=_[_0x44ec('0x44')](db[_0x44ec('0x28')][_0x44ec('0x29')]);_0x1e3c02['query']=_[_0x44ec('0x44')](_0x4a6abe['query']);_0x1e3c02[_0x44ec('0x2e')]=_[_0x44ec('0x2f')](_0x1e3c02[_0x44ec('0x2d')],_0x1e3c02[_0x44ec('0x30')]);_0x8184c5[_0x44ec('0x31')]=_[_0x44ec('0x2f')](_0x1e3c02['model'],qs[_0x44ec('0x32')](_0x4a6abe[_0x44ec('0x30')][_0x44ec('0x32')]));_0x8184c5[_0x44ec('0x31')]=_0x8184c5[_0x44ec('0x31')][_0x44ec('0x33')]?_0x8184c5[_0x44ec('0x31')]:_0x1e3c02['model'];if(_0x4a6abe[_0x44ec('0x30')][_0x44ec('0x3f')]){_0x8184c5[_0x44ec('0x45')]=[{'all':!![]}];}_0x8184c5=_[_0x44ec('0x3a')]({},_0x8184c5,_0x4a6abe[_0x44ec('0x3d')]);return db[_0x44ec('0x28')][_0x44ec('0x46')](_0x8184c5)[_0x44ec('0x22')](handleEntityNotFound(_0x46e845,null))[_0x44ec('0x22')](respondWithResult(_0x46e845,null))[_0x44ec('0x42')](handleError(_0x46e845,null));};exports[_0x44ec('0x47')]=function(_0x33eafb,_0x3e5e61){return db['VoiceTransferReport'][_0x44ec('0x47')](_0x33eafb[_0x44ec('0x48')],{})['then'](respondWithResult(_0x3e5e61,0xc9))[_0x44ec('0x42')](handleError(_0x3e5e61,null));};exports['update']=function(_0x565c43,_0x376762){if(_0x565c43['body']['id']){delete _0x565c43[_0x44ec('0x48')]['id'];}return db['VoiceTransferReport'][_0x44ec('0x46')]({'where':{'id':_0x565c43[_0x44ec('0x43')]['id']}})[_0x44ec('0x22')](handleEntityNotFound(_0x376762,null))[_0x44ec('0x22')](saveUpdates(_0x565c43[_0x44ec('0x48')],null))[_0x44ec('0x22')](respondWithResult(_0x376762,null))[_0x44ec('0x42')](handleError(_0x376762,null));};exports[_0x44ec('0x23')]=function(_0x450606,_0x3b7450){return db[_0x44ec('0x28')][_0x44ec('0x46')]({'where':{'id':_0x450606[_0x44ec('0x43')]['id']}})[_0x44ec('0x22')](handleEntityNotFound(_0x3b7450,null))[_0x44ec('0x22')](removeEntity(_0x3b7450,null))['catch'](handleError(_0x3b7450,null));};exports[_0x44ec('0x49')]=function(_0x3a976f,_0x58330c){return db[_0x44ec('0x28')][_0x44ec('0x49')]()[_0x44ec('0x22')](respondWithResult(_0x58330c,null))[_0x44ec('0x42')](handleError(_0x58330c,null));}; \ No newline at end of file +var _0x2882=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','reject','then','stack','name','send','map','VoiceTransferReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis'];(function(_0x1f063b,_0x321a3c){var _0x4d864b=function(_0x173dfe){while(--_0x173dfe){_0x1f063b['push'](_0x1f063b['shift']());}};_0x4d864b(++_0x321a3c);}(_0x2882,0x1db));var _0x2288=function(_0x4c7985,_0x228652){_0x4c7985=_0x4c7985-0x0;var _0x1aeeb1=_0x2882[_0x4c7985];return _0x1aeeb1;};'use strict';var pdf=require(_0x2288('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2288('0x1'));var zipdir=require(_0x2288('0x2'));var jsonpatch=require(_0x2288('0x3'));var rp=require(_0x2288('0x4'));var moment=require(_0x2288('0x5'));var BPromise=require(_0x2288('0x6'));var Mustache=require(_0x2288('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2288('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2288('0x9'));var squel=require(_0x2288('0xa'));var crypto=require(_0x2288('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2288('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2288('0xd'));var Redis=require(_0x2288('0xe'));var authService=require(_0x2288('0xf'));var qs=require(_0x2288('0x10'));var as=require(_0x2288('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2288('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x2288('0x13'));var licenseUtil=require(_0x2288('0x14'));var db=require(_0x2288('0x15'))['db'];function respondWithStatusCode(_0x29ad91,_0x398af5){_0x398af5=_0x398af5||0xcc;return function(_0x42f998){if(_0x42f998){return _0x29ad91[_0x2288('0x16')](_0x398af5);}return _0x29ad91[_0x2288('0x17')](_0x398af5)[_0x2288('0x18')]();};}function respondWithResult(_0x47962d,_0x30552a){_0x30552a=_0x30552a||0xc8;return function(_0x4d9f97){if(_0x4d9f97){return _0x47962d[_0x2288('0x17')](_0x30552a)[_0x2288('0x19')](_0x4d9f97);}};}function respondWithFilteredResult(_0x88f5a2,_0x2b92a6){return function(_0x3f78de){if(_0x3f78de){var _0x3ed9c6=_0x3f78de['count'],_0x72b03d=_0x2b92a6[_0x2288('0x1a')],_0x2a564e=_0x2b92a6['offset']+_0x2b92a6['limit'],_0x39805d;if(_0x2a564e>=_0x3ed9c6){_0x2a564e=_0x3ed9c6;_0x39805d=0xc8;}else{_0x39805d=0xce;}_0x88f5a2[_0x2288('0x17')](_0x39805d);return _0x88f5a2['set'](_0x2288('0x1b'),_0x72b03d+'-'+_0x2a564e+'/'+_0x3ed9c6)[_0x2288('0x19')](_0x3f78de);}return null;};}function patchUpdates(_0x3d1280){return function(_0x2ac099){try{jsonpatch['apply'](_0x2ac099,_0x3d1280,!![]);}catch(_0x213286){return BPromise[_0x2288('0x1c')](_0x213286);}return _0x2ac099['save']();};}function saveUpdates(_0x2de034,_0x4d51f4){return function(_0x5abb40){if(_0x5abb40){return _0x5abb40['update'](_0x2de034)[_0x2288('0x1d')](function(_0x4d642b){return _0x4d642b;});}return null;};}function removeEntity(_0x2b85a9,_0x555959){return function(_0x45316f){if(_0x45316f){return _0x45316f['destroy']()[_0x2288('0x1d')](function(){_0x2b85a9[_0x2288('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ebb40,_0x452436){return function(_0x412ad0){if(!_0x412ad0){_0x4ebb40[_0x2288('0x16')](0x194);}return _0x412ad0;};}function handleError(_0x5b2646,_0x3c1369){_0x3c1369=_0x3c1369||0x1f4;return function(_0x4e40e2){logger['error'](_0x4e40e2[_0x2288('0x1e')]);if(_0x4e40e2[_0x2288('0x1f')]){delete _0x4e40e2[_0x2288('0x1f')];}_0x5b2646['status'](_0x3c1369)[_0x2288('0x20')](_0x4e40e2);};}exports['index']=function(_0x43207e,_0x3bb5e5){var _0xb79aae={},_0x51cc8b={},_0x3ef6bf={'count':0x0,'rows':[]};var _0x11a814=_[_0x2288('0x21')](db[_0x2288('0x22')]['rawAttributes'],function(_0x262267){return{'name':_0x262267[_0x2288('0x23')],'type':_0x262267[_0x2288('0x24')][_0x2288('0x25')]};});_0x51cc8b[_0x2288('0x26')]=_[_0x2288('0x21')](_0x11a814,'name');_0x51cc8b[_0x2288('0x27')]=_[_0x2288('0x28')](_0x43207e[_0x2288('0x27')]);_0x51cc8b[_0x2288('0x29')]=_['intersection'](_0x51cc8b[_0x2288('0x26')],_0x51cc8b[_0x2288('0x27')]);_0xb79aae[_0x2288('0x2a')]=_[_0x2288('0x2b')](_0x51cc8b['model'],qs[_0x2288('0x2c')](_0x43207e[_0x2288('0x27')][_0x2288('0x2c')]));_0xb79aae[_0x2288('0x2a')]=_0xb79aae['attributes'][_0x2288('0x2d')]?_0xb79aae[_0x2288('0x2a')]:_0x51cc8b[_0x2288('0x26')];if(!_0x43207e[_0x2288('0x27')]['hasOwnProperty'](_0x2288('0x2e'))){_0xb79aae['limit']=qs[_0x2288('0x2f')](_0x43207e[_0x2288('0x27')][_0x2288('0x2f')]);_0xb79aae['offset']=qs[_0x2288('0x1a')](_0x43207e[_0x2288('0x27')]['offset']);}_0xb79aae[_0x2288('0x30')]=qs[_0x2288('0x31')](_0x43207e[_0x2288('0x27')][_0x2288('0x31')]);_0xb79aae[_0x2288('0x32')]=qs[_0x2288('0x29')](_[_0x2288('0x33')](_0x43207e[_0x2288('0x27')],_0x51cc8b[_0x2288('0x29')]),_0x11a814);if(_0x43207e[_0x2288('0x27')][_0x2288('0x34')]){_0xb79aae['where']=_[_0x2288('0x35')](_0xb79aae[_0x2288('0x32')],{'$or':_['map'](_0x11a814,function(_0x4e4844){if(_0x4e4844['type']!==_0x2288('0x36')){var _0x291e4a={};_0x291e4a[_0x4e4844[_0x2288('0x1f')]]={'$like':'%'+_0x43207e[_0x2288('0x27')]['filter']+'%'};return _0x291e4a;}})});}_0xb79aae=_[_0x2288('0x35')]({},_0xb79aae,_0x43207e[_0x2288('0x37')]);var _0x40bca5={'where':_0xb79aae[_0x2288('0x32')]};return db[_0x2288('0x22')][_0x2288('0x38')](_0x40bca5)['then'](function(_0x61e742){_0x3ef6bf[_0x2288('0x38')]=_0x61e742;if(_0x43207e[_0x2288('0x27')][_0x2288('0x39')]){_0xb79aae[_0x2288('0x3a')]=[{'all':!![]}];}return db[_0x2288('0x22')][_0x2288('0x3b')](_0xb79aae);})[_0x2288('0x1d')](function(_0x157956){_0x3ef6bf[_0x2288('0x3c')]=_0x157956;return _0x3ef6bf;})[_0x2288('0x1d')](respondWithFilteredResult(_0x3bb5e5,_0xb79aae))[_0x2288('0x3d')](handleError(_0x3bb5e5,null));};exports[_0x2288('0x3e')]=function(_0x50f360,_0x546abd){var _0x4b0591={'raw':!![],'where':{'id':_0x50f360[_0x2288('0x3f')]['id']}},_0x4bb740={};_0x4bb740[_0x2288('0x26')]=_['keys'](db[_0x2288('0x22')][_0x2288('0x40')]);_0x4bb740['query']=_[_0x2288('0x28')](_0x50f360[_0x2288('0x27')]);_0x4bb740[_0x2288('0x29')]=_['intersection'](_0x4bb740[_0x2288('0x26')],_0x4bb740['query']);_0x4b0591[_0x2288('0x2a')]=_['intersection'](_0x4bb740['model'],qs['fields'](_0x50f360['query'][_0x2288('0x2c')]));_0x4b0591[_0x2288('0x2a')]=_0x4b0591[_0x2288('0x2a')][_0x2288('0x2d')]?_0x4b0591[_0x2288('0x2a')]:_0x4bb740[_0x2288('0x26')];if(_0x50f360['query']['includeAll']){_0x4b0591['include']=[{'all':!![]}];}_0x4b0591=_['merge']({},_0x4b0591,_0x50f360[_0x2288('0x37')]);return db['VoiceTransferReport'][_0x2288('0x41')](_0x4b0591)['then'](handleEntityNotFound(_0x546abd,null))[_0x2288('0x1d')](respondWithResult(_0x546abd,null))[_0x2288('0x3d')](handleError(_0x546abd,null));};exports[_0x2288('0x42')]=function(_0x4abe66,_0x1eb3bd){return db[_0x2288('0x22')]['create'](_0x4abe66['body'],{})[_0x2288('0x1d')](respondWithResult(_0x1eb3bd,0xc9))[_0x2288('0x3d')](handleError(_0x1eb3bd,null));};exports[_0x2288('0x43')]=function(_0x2d0820,_0x3f0f08){if(_0x2d0820[_0x2288('0x44')]['id']){delete _0x2d0820[_0x2288('0x44')]['id'];}return db[_0x2288('0x22')][_0x2288('0x41')]({'where':{'id':_0x2d0820[_0x2288('0x3f')]['id']}})[_0x2288('0x1d')](handleEntityNotFound(_0x3f0f08,null))[_0x2288('0x1d')](saveUpdates(_0x2d0820[_0x2288('0x44')],null))[_0x2288('0x1d')](respondWithResult(_0x3f0f08,null))[_0x2288('0x3d')](handleError(_0x3f0f08,null));};exports['destroy']=function(_0x33935e,_0x57cbc3){return db[_0x2288('0x22')][_0x2288('0x41')]({'where':{'id':_0x33935e[_0x2288('0x3f')]['id']}})[_0x2288('0x1d')](handleEntityNotFound(_0x57cbc3,null))['then'](removeEntity(_0x57cbc3,null))['catch'](handleError(_0x57cbc3,null));};exports[_0x2288('0x45')]=function(_0x284176,_0x48e0f1){return db[_0x2288('0x22')][_0x2288('0x45')]()[_0x2288('0x1d')](respondWithResult(_0x48e0f1,null))[_0x2288('0x3d')](handleError(_0x48e0f1,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 1ee9c44..c88a950 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 _0xb2a9=['VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x291d57,_0x30557b){var _0x4eb3a7=function(_0x51d697){while(--_0x51d697){_0x291d57['push'](_0x291d57['shift']());}};_0x4eb3a7(++_0x30557b);}(_0xb2a9,0x84));var _0x9b2a=function(_0x4ac8f3,_0x450bef){_0x4ac8f3=_0x4ac8f3-0x0;var _0x3c64a3=_0xb2a9[_0x4ac8f3];return _0x3c64a3;};'use strict';var _=require(_0x9b2a('0x0'));var util=require(_0x9b2a('0x1'));var logger=require(_0x9b2a('0x2'))(_0x9b2a('0x3'));var moment=require(_0x9b2a('0x4'));var BPromise=require(_0x9b2a('0x5'));var rp=require(_0x9b2a('0x6'));var fs=require('fs');var path=require(_0x9b2a('0x7'));var rimraf=require('rimraf');var config=require(_0x9b2a('0x8'));var attributes=require('./voiceTransferReport.attributes');module[_0x9b2a('0x9')]=function(_0x2eafb0,_0x31a9a3){return _0x2eafb0[_0x9b2a('0xa')](_0x9b2a('0xb'),attributes,{'tableName':_0x9b2a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4760=['lodash','util','api','moment','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x2bafde,_0x39326c){var _0x5733dc=function(_0x3aa9a6){while(--_0x3aa9a6){_0x2bafde['push'](_0x2bafde['shift']());}};_0x5733dc(++_0x39326c);}(_0x4760,0x120));var _0x0476=function(_0x584b86,_0x5278e6){_0x584b86=_0x584b86-0x0;var _0x24ae69=_0x4760[_0x584b86];return _0x24ae69;};'use strict';var _=require(_0x0476('0x0'));var util=require(_0x0476('0x1'));var logger=require('../../config/logger')(_0x0476('0x2'));var moment=require(_0x0476('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0476('0x4'));var rimraf=require(_0x0476('0x5'));var config=require(_0x0476('0x6'));var attributes=require(_0x0476('0x7'));module[_0x0476('0x8')]=function(_0x328021,_0x476fed){return _0x328021[_0x0476('0x9')](_0x0476('0xa'),attributes,{'tableName':_0x0476('0xb'),'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 ed95eef..1932d99 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 _0x40b5=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','VoiceTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x40b5,0x1d7));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x540b('0x0'));var util=require(_0x540b('0x1'));var moment=require(_0x540b('0x2'));var BPromise=require(_0x540b('0x3'));var rs=require(_0x540b('0x4'));var fs=require('fs');var Redis=require(_0x540b('0x5'));var db=require(_0x540b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x540b('0x7'))(_0x540b('0x8'));var config=require(_0x540b('0x9'));var jayson=require(_0x540b('0xa'));var client=jayson[_0x540b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22e1da,_0x448b68,_0x316ab7){return new BPromise(function(_0x5aeb5f,_0x5a9a78){return client[_0x540b('0xc')](_0x22e1da,_0x316ab7)['then'](function(_0x5c4ca0){logger['info'](_0x540b('0xd'),_0x448b68,'request\x20sent');logger[_0x540b('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x448b68,'request\x20sent',JSON[_0x540b('0xf')](_0x5c4ca0));if(_0x5c4ca0[_0x540b('0x10')]){if(_0x5c4ca0['error'][_0x540b('0x11')]===0x1f4){logger[_0x540b('0x10')](_0x540b('0xd'),_0x448b68,_0x5c4ca0[_0x540b('0x10')]['message']);return _0x5a9a78(_0x5c4ca0[_0x540b('0x10')][_0x540b('0x12')]);}logger[_0x540b('0x10')](_0x540b('0xd'),_0x448b68,_0x5c4ca0['error'][_0x540b('0x12')]);return _0x5aeb5f(_0x5c4ca0['error']['message']);}else{logger[_0x540b('0x13')](_0x540b('0xd'),_0x448b68,_0x540b('0x14'));_0x5aeb5f(_0x5c4ca0[_0x540b('0x15')][_0x540b('0x12')]);}})['catch'](function(_0x26bbf6){logger[_0x540b('0x10')](_0x540b('0xd'),_0x448b68,_0x26bbf6);_0x5a9a78(_0x26bbf6);});});}exports[_0x540b('0x16')]=function(_0x44dff4){var _0xd61e60=this;return new Promise(function(_0x2a3265,_0x2db521){return db[_0x540b('0x17')]['create'](_0x44dff4[_0x540b('0x18')],{'raw':_0x44dff4[_0x540b('0x19')]?_0x44dff4['options'][_0x540b('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x342cbd){logger['info']('CreateVoiceTransferReport',_0x44dff4);logger[_0x540b('0xe')]('CreateVoiceTransferReport',_0x44dff4,JSON[_0x540b('0xf')](_0x342cbd));_0x2a3265(_0x342cbd);})[_0x540b('0x1b')](function(_0x1069f3){logger['error'](_0x540b('0x16'),_0x1069f3[_0x540b('0x12')],_0x44dff4);_0x2db521(_0xd61e60[_0x540b('0x10')](0x1f4,_0x1069f3[_0x540b('0x12')]));});});}; \ No newline at end of file +var _0xf7c3=['options','raw','CreateVoiceTransferReport','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','VoiceTransferReport','create','body'];(function(_0x3937b6,_0xd53d2b){var _0x1ba356=function(_0x4816cc){while(--_0x4816cc){_0x3937b6['push'](_0x3937b6['shift']());}};_0x1ba356(++_0xd53d2b);}(_0xf7c3,0x154));var _0x3f7c=function(_0x42fde3,_0x270525){_0x42fde3=_0x42fde3-0x0;var _0x16232d=_0xf7c3[_0x42fde3];return _0x16232d;};'use strict';var _=require(_0x3f7c('0x0'));var util=require(_0x3f7c('0x1'));var moment=require(_0x3f7c('0x2'));var BPromise=require(_0x3f7c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f7c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f7c('0x5'));var logger=require(_0x3f7c('0x6'))(_0x3f7c('0x7'));var config=require('../../config/environment');var jayson=require(_0x3f7c('0x8'));var client=jayson[_0x3f7c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x854413,_0x57ce1e,_0x3c23a2){return new BPromise(function(_0x541074,_0x1253db){return client[_0x3f7c('0xa')](_0x854413,_0x3c23a2)[_0x3f7c('0xb')](function(_0x4c7e15){logger[_0x3f7c('0xc')](_0x3f7c('0xd'),_0x57ce1e,_0x3f7c('0xe'));logger[_0x3f7c('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x57ce1e,'request\x20sent',JSON[_0x3f7c('0x10')](_0x4c7e15));if(_0x4c7e15[_0x3f7c('0x11')]){if(_0x4c7e15['error'][_0x3f7c('0x12')]===0x1f4){logger[_0x3f7c('0x11')](_0x3f7c('0xd'),_0x57ce1e,_0x4c7e15[_0x3f7c('0x11')]['message']);return _0x1253db(_0x4c7e15[_0x3f7c('0x11')][_0x3f7c('0x13')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x57ce1e,_0x4c7e15['error'][_0x3f7c('0x13')]);return _0x541074(_0x4c7e15[_0x3f7c('0x11')][_0x3f7c('0x13')]);}else{logger[_0x3f7c('0xc')](_0x3f7c('0xd'),_0x57ce1e,'request\x20sent');_0x541074(_0x4c7e15[_0x3f7c('0x14')][_0x3f7c('0x13')]);}})['catch'](function(_0x5cae3f){logger[_0x3f7c('0x11')](_0x3f7c('0xd'),_0x57ce1e,_0x5cae3f);_0x1253db(_0x5cae3f);});});}exports['CreateVoiceTransferReport']=function(_0x35c3c1){var _0x12ab92=this;return new Promise(function(_0x46b625,_0x51c6d6){return db[_0x3f7c('0x15')][_0x3f7c('0x16')](_0x35c3c1[_0x3f7c('0x17')],{'raw':_0x35c3c1['options']?_0x35c3c1[_0x3f7c('0x18')][_0x3f7c('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x171c65){logger[_0x3f7c('0xc')](_0x3f7c('0x1a'),_0x35c3c1);logger[_0x3f7c('0xf')](_0x3f7c('0x1a'),_0x35c3c1,JSON[_0x3f7c('0x10')](_0x171c65));_0x46b625(_0x171c65);})[_0x3f7c('0x1b')](function(_0x3bdcf2){logger[_0x3f7c('0x11')](_0x3f7c('0x1a'),_0x3bdcf2['message'],_0x35c3c1);_0x51c6d6(_0x12ab92['error'](0x1f4,_0x3bdcf2[_0x3f7c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 1d01723..e446d47 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 _0xd4b6=['/calls','calls','transfer','exports','express','Router','./webbar.controller','post','isAuthenticated','/hangup','canUpdate','/answer','/hold','/unhold','unhold'];(function(_0x4ddf27,_0x92cefa){var _0x46754f=function(_0x2913cf){while(--_0x2913cf){_0x4ddf27['push'](_0x4ddf27['shift']());}};_0x46754f(++_0x92cefa);}(_0xd4b6,0x13f));var _0x6d4b=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xd4b6[_0x1f9f37];return _0x21c080;};'use strict';var express=require(_0x6d4b('0x0'));var router=express[_0x6d4b('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6d4b('0x2'));router[_0x6d4b('0x3')]('/originate',auth[_0x6d4b('0x4')](),auth['canUpdate'](),controller['originate']);router['post'](_0x6d4b('0x5'),auth[_0x6d4b('0x4')](),auth[_0x6d4b('0x6')](),controller['hangup']);router[_0x6d4b('0x3')](_0x6d4b('0x7'),auth[_0x6d4b('0x4')](),auth[_0x6d4b('0x6')](),controller['answer']);router[_0x6d4b('0x3')](_0x6d4b('0x8'),auth[_0x6d4b('0x4')](),auth[_0x6d4b('0x6')](),controller['hold']);router[_0x6d4b('0x3')](_0x6d4b('0x9'),auth[_0x6d4b('0x4')](),auth[_0x6d4b('0x6')](),controller[_0x6d4b('0xa')]);router[_0x6d4b('0x3')](_0x6d4b('0xb'),auth['isAuthenticated'](),auth[_0x6d4b('0x6')](),controller[_0x6d4b('0xc')]);router[_0x6d4b('0x3')]('/transfer',auth[_0x6d4b('0x4')](),auth[_0x6d4b('0x6')](),controller[_0x6d4b('0xd')]);module[_0x6d4b('0xe')]=router; \ No newline at end of file +var _0x121d=['/unhold','unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','/hold'];(function(_0x4ed0c9,_0x5ce27a){var _0x2cfd1f=function(_0x29ac54){while(--_0x29ac54){_0x4ed0c9['push'](_0x4ed0c9['shift']());}};_0x2cfd1f(++_0x5ce27a);}(_0x121d,0xea));var _0xd121=function(_0x5dbce0,_0x4cb580){_0x5dbce0=_0x5dbce0-0x0;var _0x11fcfa=_0x121d[_0x5dbce0];return _0x11fcfa;};'use strict';var express=require(_0xd121('0x0'));var router=express[_0xd121('0x1')]();var auth=require(_0xd121('0x2'));var controller=require(_0xd121('0x3'));router[_0xd121('0x4')](_0xd121('0x5'),auth[_0xd121('0x6')](),auth[_0xd121('0x7')](),controller[_0xd121('0x8')]);router[_0xd121('0x4')](_0xd121('0x9'),auth[_0xd121('0x6')](),auth[_0xd121('0x7')](),controller[_0xd121('0xa')]);router['post'](_0xd121('0xb'),auth['isAuthenticated'](),auth[_0xd121('0x7')](),controller['answer']);router[_0xd121('0x4')](_0xd121('0xc'),auth['isAuthenticated'](),auth['canUpdate'](),controller['hold']);router[_0xd121('0x4')](_0xd121('0xd'),auth[_0xd121('0x6')](),auth[_0xd121('0x7')](),controller[_0xd121('0xe')]);router[_0xd121('0x4')](_0xd121('0xf'),auth['isAuthenticated'](),auth[_0xd121('0x7')](),controller[_0xd121('0x10')]);router['post'](_0xd121('0x11'),auth[_0xd121('0x6')](),auth[_0xd121('0x7')](),controller[_0xd121('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 7b5f8b8..6ec2550 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 _0x634d=['validate','userId\x20is\x20required','string','number','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','message','result','catch','User','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate\x20fired:','body','userId','callNumber','entityFound:','format','user:%s','json','originate\x20executed!','hangup','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','jayson/promise','client','http','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0x634d,0x120));var _0xd634=function(_0x3c596f,_0x50a156){_0x3c596f=_0x3c596f-0x0;var _0x2b3e02=_0x634d[_0x3c596f];return _0x2b3e02;};'use strict';var path=require(_0xd634('0x0'));var fs=require('fs');var _=require(_0xd634('0x1'));var db=require(_0xd634('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xd634('0x3'));var amiClient=jayson[_0xd634('0x4')][_0xd634('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0xd634('0x6'));var Redis=require(_0xd634('0x7'));config['redis']=_[_0xd634('0x8')](config[_0xd634('0x9')],{'host':_0xd634('0xa'),'port':0x18eb});var io=require(_0xd634('0xb'))(new Redis(config[_0xd634('0x9')]));var Schema=require(_0xd634('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd634('0xd')]},'callNumber':{'type':_0xd634('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xd634('0xe')},'callbackUrl':{'type':_0xd634('0xe')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd634('0xd')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xd634('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xd634('0xf'),'required':[!![],_0xd634('0xd')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xd634('0xe'),'required':[!![],_0xd634('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xd634('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xd634('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xd634('0xf'),'required':[!![],_0xd634('0xd')]},'sessionId':{'type':_0xd634('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xd634('0xf'),'required':[!![],_0xd634('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xd634('0xf'),'required':[!![],_0xd634('0xd')]}});function emit(_0x3a5fdd,_0x4bf557,_0x46d41d){logger[_0xd634('0x11')](_0x3a5fdd,_0x4bf557,JSON[_0xd634('0x12')](_0x46d41d));io['to'](_0x3a5fdd)[_0xd634('0x13')](_0x4bf557,_0x46d41d);}function handleError(_0x21acb4){return function(_0x271fa2){console[_0xd634('0x14')](_0xd634('0x15'),_0x271fa2,_0x271fa2 instanceof RangeError);logger[_0xd634('0x16')](_0x271fa2[_0xd634('0x17')]);if(_0x271fa2 instanceof RangeError){if(_0x271fa2['name']){delete _0x271fa2[_0xd634('0x18')];}_0x21acb4[_0xd634('0x19')](0x194)[_0xd634('0x1a')](_0x271fa2);}else{if(_0x271fa2[_0xd634('0x18')]){delete _0x271fa2[_0xd634('0x18')];}_0x21acb4[_0xd634('0x19')](0x1f4)[_0xd634('0x1a')](_0x271fa2);}};}function checkError(){return function(_0x2738bd){if(!_0x2738bd){throw new RangeError(_0xd634('0x1b'));}return _0x2738bd;};}function respondWithRpcPromise(_0x36f903,_0x561b74){return new BPromise(function(_0x5c34d1,_0x2c1bf2){var _0x350725=amiClient;return _0x350725[_0xd634('0x1c')](_0x36f903,_0x561b74)['then'](function(_0x140e50){if(_0x140e50[_0xd634('0x16')]){if(_0x140e50['error']['code']===0x1f4){return _0x2c1bf2(_0x140e50[_0xd634('0x16')]['message']);}return _0x5c34d1(_0x140e50['error'][_0xd634('0x1d')]);}else{_0x5c34d1(_0x140e50[_0xd634('0x1e')]);}})[_0xd634('0x1f')](function(_0x548f5b){_0x2c1bf2(_0x548f5b);});});}function getAgent(_0x5012b8){return db[_0xd634('0x20')]['findOne']({'where':{'id':_0x5012b8,'role':_0xd634('0x21')}})[_0xd634('0x22')](checkError());}function getAgentCheckSession(_0x262d2f,_0x2a3b86){return new BPromise(function(_0x29182d,_0x232b0c){var _0x16b84e=respondWithRpcPromise(_0xd634('0x23'));var _0x427c03=getAgent(_0x262d2f);Promise[_0xd634('0x24')]([_0x16b84e,_0x427c03])[_0xd634('0x22')](function(_0x36311f){var _0x37783f=_0x36311f[0x0];var _0x28b9b4=_0x36311f[0x1];var _0x2dd5ed=_[_0xd634('0x25')](_0x37783f[_0xd634('0x26')],function(_0x11c2a5){return _0x11c2a5[_0xd634('0x27')]==_0x28b9b4['id']&&_0x11c2a5[_0xd634('0x28')]==_0x2a3b86;});if(_0x2dd5ed[_0xd634('0x29')]==0x1){_0x29182d(_0x28b9b4);}else{_0x232b0c(new RangeError('sessionId\x20'+_0x2a3b86+_0xd634('0x2a')));}});});}exports['originate']=function(_0x3ca340,_0x5dbb76){logger[_0xd634('0x11')](_0xd634('0x2b'),_0x3ca340[_0xd634('0x2c')]);var _0x4af19e=originateValidation[_0xd634('0xc')](_0x3ca340[_0xd634('0x2c')]);if(_0x4af19e[_0xd634('0x29')]>0x0){return _0x5dbb76[_0xd634('0x19')](0x190)['json'](_0x4af19e);}var _0xec9fb2=_0x3ca340[_0xd634('0x2c')][_0xd634('0x2d')];var _0x367e4b=_0x3ca340[_0xd634('0x2c')][_0xd634('0x2e')];var _0x457c0f=_0x3ca340[_0xd634('0x2c')]['callerId'];var _0x368f3e=_0x3ca340[_0xd634('0x2c')]['callbackUrl'];return getAgent(_0xec9fb2)['then'](function(_0x5093f7){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x5093f7[_0xd634('0x18')]);emit(util[_0xd634('0x30')](_0xd634('0x31'),_0x5093f7[_0xd634('0x18')]),'webbar:originate',{'callNumber':_0x367e4b,'callerId':_0x457c0f,'callbackUrl':_0x368f3e});return _0x5dbb76[_0xd634('0x19')](0xc8)[_0xd634('0x32')]({'error':![],'message':_0xd634('0x33')});})[_0xd634('0x1f')](handleError(_0x5dbb76));};exports[_0xd634('0x34')]=function(_0x1c153e,_0x342360){logger[_0xd634('0x11')]('hangup\x20fired:',_0x1c153e[_0xd634('0x2c')]);var _0x47b5de=hangupValidation[_0xd634('0xc')](_0x1c153e[_0xd634('0x2c')]);if(_0x47b5de[_0xd634('0x29')]>0x0){return _0x342360[_0xd634('0x19')](0x190)[_0xd634('0x32')](_0x47b5de);}var _0x37ee6c=_0x1c153e[_0xd634('0x2c')]['userId'];var _0x1f9af7=_0x1c153e['body'][_0xd634('0x28')];return getAgent(_0x37ee6c)[_0xd634('0x22')](function(_0x1c6adc){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x1c6adc[_0xd634('0x18')]);emit(util['format'](_0xd634('0x31'),_0x1c6adc[_0xd634('0x18')]),_0xd634('0x35'),{'sessionId':_0x1f9af7});return _0x342360[_0xd634('0x19')](0xc8)[_0xd634('0x32')]({'error':![],'message':_0xd634('0x36')});})['catch'](handleError(_0x342360));};exports[_0xd634('0x37')]=function(_0x32e167,_0x2b060b){logger[_0xd634('0x11')](_0xd634('0x38'),_0x32e167[_0xd634('0x2c')]);var _0x2a9118=answerValidation[_0xd634('0xc')](_0x32e167[_0xd634('0x2c')]);if(_0x2a9118[_0xd634('0x29')]>0x0){return _0x2b060b[_0xd634('0x19')](0x190)['json'](_0x2a9118);}var _0x4e3388=_0x32e167['body']['userId'];var _0x19e5d2=_0x32e167[_0xd634('0x2c')][_0xd634('0x28')];return getAgent(_0x4e3388)['then'](function(_0x2f2b8d){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x2f2b8d[_0xd634('0x18')]);emit(util[_0xd634('0x30')](_0xd634('0x31'),_0x2f2b8d[_0xd634('0x18')]),_0xd634('0x39'),{'sessionId':_0x19e5d2});return _0x2b060b[_0xd634('0x19')](0xc8)[_0xd634('0x32')]({'error':![],'message':_0xd634('0x3a')});})[_0xd634('0x1f')](handleError(_0x2b060b));};exports[_0xd634('0x3b')]=function(_0x682119,_0x17cb1f){logger[_0xd634('0x11')]('hold\x20fired:',_0x682119[_0xd634('0x2c')]);var _0x5d572d=holdValidation[_0xd634('0xc')](_0x682119[_0xd634('0x2c')]);if(_0x5d572d[_0xd634('0x29')]>0x0){return _0x17cb1f[_0xd634('0x19')](0x190)[_0xd634('0x32')](_0x5d572d);}var _0x2e9600=_0x682119[_0xd634('0x2c')][_0xd634('0x2d')];var _0x29f96d=_0x682119[_0xd634('0x2c')][_0xd634('0x28')];return getAgent(_0x2e9600)[_0xd634('0x22')](function(_0x27ee8c){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x27ee8c[_0xd634('0x18')]);emit(util[_0xd634('0x30')](_0xd634('0x31'),_0x27ee8c[_0xd634('0x18')]),_0xd634('0x3c'),{'sessionId':_0x29f96d});return _0x17cb1f[_0xd634('0x19')](0xc8)[_0xd634('0x32')]({'error':![],'message':_0xd634('0x3d')});})[_0xd634('0x1f')](handleError(_0x17cb1f));};exports['unhold']=function(_0x1f6adf,_0x56cf2){logger[_0xd634('0x11')](_0xd634('0x3e'),_0x1f6adf[_0xd634('0x2c')]);var _0x517b3c=unholdValidation[_0xd634('0xc')](_0x1f6adf[_0xd634('0x2c')]);if(_0x517b3c[_0xd634('0x29')]>0x0){return _0x56cf2[_0xd634('0x19')](0x190)['json'](_0x517b3c);}var _0x4ca2f3=_0x1f6adf['body'][_0xd634('0x2d')];var _0xcb738c=_0x1f6adf[_0xd634('0x2c')]['sessionId'];return getAgent(_0x4ca2f3)[_0xd634('0x22')](function(_0x304bfa){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x304bfa['name']);emit(util['format'](_0xd634('0x31'),_0x304bfa[_0xd634('0x18')]),_0xd634('0x3f'),{'sessionId':_0xcb738c});return _0x56cf2[_0xd634('0x19')](0xc8)[_0xd634('0x32')]({'error':![],'message':'unhold\x20executed!'});})[_0xd634('0x1f')](handleError(_0x56cf2));};exports[_0xd634('0x40')]=function(_0xc503e6,_0x50a387){logger[_0xd634('0x11')](_0xd634('0x41'),_0x50a387[_0xd634('0x2c')]);var _0x5f51a1=callsValidation['validate'](_0xc503e6[_0xd634('0x2c')]);if(_0x5f51a1[_0xd634('0x29')]>0x0){return _0x50a387[_0xd634('0x19')](0x190)[_0xd634('0x32')](_0x5f51a1);}var _0x274225=_0xc503e6[_0xd634('0x2c')][_0xd634('0x2d')];var _0x2384bb=respondWithRpcPromise(_0xd634('0x23'));var _0xcb136f=getAgent(_0x274225);return Promise['all']([_0x2384bb,_0xcb136f])['then'](function(_0x1035eb){var _0x334611=_0x1035eb[0x0];var _0x1af022=_0x1035eb[0x1];var _0x233987=_['filter'](_0x334611['rows'],function(_0x511ed1){return _0x511ed1[_0xd634('0x27')]==_0x1af022['id'];});return _0x50a387[_0xd634('0x19')](0xc8)['json']({'count':_0x233987[_0xd634('0x29')],'rows':_0x233987});})['catch'](handleError(_0x50a387));};exports[_0xd634('0x42')]=function(_0x5eed9e,_0x10f572){logger['info'](_0xd634('0x43'),_0x5eed9e[_0xd634('0x2c')]);var _0x411dda=conferenceValidation[_0xd634('0xc')](_0x5eed9e[_0xd634('0x2c')]);if(_0x411dda[_0xd634('0x29')]>0x0){return _0x10f572[_0xd634('0x19')](0x190)[_0xd634('0x32')](_0x411dda);}var _0x3dc6f0=_0x5eed9e[_0xd634('0x2c')]['userId'];return getAgent(_0x3dc6f0)[_0xd634('0x22')](function(_0x53de41){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x53de41['name']);emit(util[_0xd634('0x30')](_0xd634('0x31'),_0x53de41[_0xd634('0x18')]),_0xd634('0x44'));return _0x10f572[_0xd634('0x19')](0xc8)['json']({'error':![],'message':_0xd634('0x45')});})[_0xd634('0x1f')](handleError(_0x10f572));};exports[_0xd634('0x46')]=function(_0x23b7f6,_0x156879){logger[_0xd634('0x11')](_0xd634('0x47'),_0x23b7f6['body']);var _0x1df458=transferValidation['validate'](_0x23b7f6['body']);if(_0x1df458['length']>0x0){return _0x156879[_0xd634('0x19')](0x190)[_0xd634('0x32')](_0x1df458);}var _0x40669d=_0x23b7f6['body'][_0xd634('0x2d')];var _0x3672e0=_0x23b7f6[_0xd634('0x2c')][_0xd634('0x28')];var _0x463764=_0x23b7f6[_0xd634('0x2c')][_0xd634('0x48')];return getAgent(_0x40669d)[_0xd634('0x22')](function(_0x538585){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x538585[_0xd634('0x18')]);emit(util[_0xd634('0x30')]('user:%s',_0x538585['name']),_0xd634('0x49'),{'sessionId':_0x3672e0,'transferNumber':_0x463764});return _0x156879[_0xd634('0x19')](0xc8)[_0xd634('0x32')]({'error':![],'message':_0xd634('0x4a')});})['catch'](handleError(_0x156879));}; \ No newline at end of file +var _0xacb8=['string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','name','status','send','NotFound','request','then','error','code','result','findOne','VoiceChannels','all','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','json','body','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','catch','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','rows','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required'];(function(_0x1829fd,_0x33b470){var _0x177d22=function(_0x595874){while(--_0x595874){_0x1829fd['push'](_0x1829fd['shift']());}};_0x177d22(++_0x33b470);}(_0xacb8,0x119));var _0x8acb=function(_0x11adbd,_0x5055f5){_0x11adbd=_0x11adbd-0x0;var _0x270029=_0xacb8[_0x11adbd];return _0x270029;};'use strict';var path=require(_0x8acb('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x8acb('0x1'))['db'];var config=require(_0x8acb('0x2'));var util=require(_0x8acb('0x3'));var BPromise=require('bluebird');var jayson=require(_0x8acb('0x4'));var amiClient=jayson[_0x8acb('0x5')]['http']({'port':0x232a});var logger=require(_0x8acb('0x6'))(_0x8acb('0x7'));var Redis=require(_0x8acb('0x8'));config[_0x8acb('0x9')]=_[_0x8acb('0xa')](config[_0x8acb('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x8acb('0xb'))(new Redis(config[_0x8acb('0x9')]));var Schema=require(_0x8acb('0xc'));var originateValidation=new Schema({'userId':{'type':_0x8acb('0xd'),'required':[!![],_0x8acb('0xe')]},'callNumber':{'type':_0x8acb('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x8acb('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x8acb('0xd'),'required':[!![],_0x8acb('0xe')]},'sessionId':{'type':_0x8acb('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8acb('0xe')]},'sessionId':{'type':_0x8acb('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8acb('0xe')]},'sessionId':{'type':_0x8acb('0xf'),'required':[!![],_0x8acb('0x10')]},'transferNumber':{'type':_0x8acb('0xf'),'required':[!![],_0x8acb('0x11')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8acb('0xe')]},'sessionId':{'type':_0x8acb('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8acb('0xd'),'required':[!![],_0x8acb('0xe')]},'sessionId':{'type':_0x8acb('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8acb('0xd'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x8acb('0xd'),'required':[!![],_0x8acb('0xe')]}});function emit(_0x1fa864,_0x924d47,_0x1c1740){logger[_0x8acb('0x12')](_0x1fa864,_0x924d47,JSON[_0x8acb('0x13')](_0x1c1740));io['to'](_0x1fa864)[_0x8acb('0x14')](_0x924d47,_0x1c1740);}function handleError(_0x471219){return function(_0x5c8edc){console[_0x8acb('0x15')](_0x8acb('0x16'),_0x5c8edc,_0x5c8edc instanceof RangeError);logger['error'](_0x5c8edc['stack']);if(_0x5c8edc instanceof RangeError){if(_0x5c8edc[_0x8acb('0x17')]){delete _0x5c8edc['name'];}_0x471219[_0x8acb('0x18')](0x194)[_0x8acb('0x19')](_0x5c8edc);}else{if(_0x5c8edc['name']){delete _0x5c8edc[_0x8acb('0x17')];}_0x471219[_0x8acb('0x18')](0x1f4)[_0x8acb('0x19')](_0x5c8edc);}};}function checkError(){return function(_0x3849b5){if(!_0x3849b5){throw new RangeError(_0x8acb('0x1a'));}return _0x3849b5;};}function respondWithRpcPromise(_0x43b59b,_0x284563){return new BPromise(function(_0x52f6c3,_0x494bff){var _0x316258=amiClient;return _0x316258[_0x8acb('0x1b')](_0x43b59b,_0x284563)[_0x8acb('0x1c')](function(_0x365f68){if(_0x365f68[_0x8acb('0x1d')]){if(_0x365f68[_0x8acb('0x1d')][_0x8acb('0x1e')]===0x1f4){return _0x494bff(_0x365f68[_0x8acb('0x1d')]['message']);}return _0x52f6c3(_0x365f68[_0x8acb('0x1d')]['message']);}else{_0x52f6c3(_0x365f68[_0x8acb('0x1f')]);}})['catch'](function(_0x2591d6){_0x494bff(_0x2591d6);});});}function getAgent(_0x1f1651){return db['User'][_0x8acb('0x20')]({'where':{'id':_0x1f1651,'role':'agent'}})[_0x8acb('0x1c')](checkError());}function getAgentCheckSession(_0x25e4ec,_0x9c6ae1){return new BPromise(function(_0x30edf2,_0x14954d){var _0x5d42d5=respondWithRpcPromise(_0x8acb('0x21'));var _0x3e184c=getAgent(_0x25e4ec);Promise[_0x8acb('0x22')]([_0x5d42d5,_0x3e184c])[_0x8acb('0x1c')](function(_0x88a7e0){var _0x1bd338=_0x88a7e0[0x0];var _0x29be92=_0x88a7e0[0x1];var _0x3f6355=_[_0x8acb('0x23')](_0x1bd338['rows'],function(_0x2ff5b8){return _0x2ff5b8[_0x8acb('0x24')]==_0x29be92['id']&&_0x2ff5b8[_0x8acb('0x25')]==_0x9c6ae1;});if(_0x3f6355[_0x8acb('0x26')]==0x1){_0x30edf2(_0x29be92);}else{_0x14954d(new RangeError(_0x8acb('0x27')+_0x9c6ae1+_0x8acb('0x28')));}});});}exports[_0x8acb('0x29')]=function(_0x2049f9,_0x1703a8){logger['info'](_0x8acb('0x2a'),_0x2049f9['body']);var _0x5a7610=originateValidation[_0x8acb('0xc')](_0x2049f9['body']);if(_0x5a7610[_0x8acb('0x26')]>0x0){return _0x1703a8[_0x8acb('0x18')](0x190)[_0x8acb('0x2b')](_0x5a7610);}var _0x9c4d79=_0x2049f9[_0x8acb('0x2c')][_0x8acb('0x2d')];var _0x478126=_0x2049f9[_0x8acb('0x2c')][_0x8acb('0x2e')];var _0x3df16c=_0x2049f9[_0x8acb('0x2c')][_0x8acb('0x2f')];var _0x8793c1=_0x2049f9[_0x8acb('0x2c')][_0x8acb('0x30')];return getAgent(_0x9c4d79)[_0x8acb('0x1c')](function(_0x131b37){logger[_0x8acb('0x12')](_0x8acb('0x31'),_0x131b37[_0x8acb('0x17')]);emit(util[_0x8acb('0x32')](_0x8acb('0x33'),_0x131b37['name']),'webbar:originate',{'callNumber':_0x478126,'callerId':_0x3df16c,'callbackUrl':_0x8793c1});return _0x1703a8[_0x8acb('0x18')](0xc8)[_0x8acb('0x2b')]({'error':![],'message':'originate\x20executed!'});})[_0x8acb('0x34')](handleError(_0x1703a8));};exports['hangup']=function(_0xf73636,_0x28cdfd){logger[_0x8acb('0x12')](_0x8acb('0x35'),_0xf73636[_0x8acb('0x2c')]);var _0x2c4e27=hangupValidation[_0x8acb('0xc')](_0xf73636['body']);if(_0x2c4e27['length']>0x0){return _0x28cdfd['status'](0x190)[_0x8acb('0x2b')](_0x2c4e27);}var _0xad4c98=_0xf73636[_0x8acb('0x2c')]['userId'];var _0x51611f=_0xf73636[_0x8acb('0x2c')][_0x8acb('0x25')];return getAgent(_0xad4c98)[_0x8acb('0x1c')](function(_0x529324){logger[_0x8acb('0x12')](_0x8acb('0x31'),_0x529324[_0x8acb('0x17')]);emit(util['format'](_0x8acb('0x33'),_0x529324[_0x8acb('0x17')]),_0x8acb('0x36'),{'sessionId':_0x51611f});return _0x28cdfd['status'](0xc8)[_0x8acb('0x2b')]({'error':![],'message':_0x8acb('0x37')});})[_0x8acb('0x34')](handleError(_0x28cdfd));};exports['answer']=function(_0x23e5c0,_0x5cc943){logger[_0x8acb('0x12')](_0x8acb('0x38'),_0x23e5c0['body']);var _0x2d67ee=answerValidation[_0x8acb('0xc')](_0x23e5c0[_0x8acb('0x2c')]);if(_0x2d67ee[_0x8acb('0x26')]>0x0){return _0x5cc943['status'](0x190)[_0x8acb('0x2b')](_0x2d67ee);}var _0x5b74f4=_0x23e5c0[_0x8acb('0x2c')]['userId'];var _0x2ef961=_0x23e5c0[_0x8acb('0x2c')]['sessionId'];return getAgent(_0x5b74f4)[_0x8acb('0x1c')](function(_0xaa5373){logger[_0x8acb('0x12')](_0x8acb('0x31'),_0xaa5373['name']);emit(util[_0x8acb('0x32')](_0x8acb('0x33'),_0xaa5373[_0x8acb('0x17')]),'webbar:answer',{'sessionId':_0x2ef961});return _0x5cc943[_0x8acb('0x18')](0xc8)[_0x8acb('0x2b')]({'error':![],'message':_0x8acb('0x39')});})[_0x8acb('0x34')](handleError(_0x5cc943));};exports[_0x8acb('0x3a')]=function(_0xc44b8,_0x4f8bc6){logger['info'](_0x8acb('0x3b'),_0xc44b8['body']);var _0x226d8f=holdValidation[_0x8acb('0xc')](_0xc44b8[_0x8acb('0x2c')]);if(_0x226d8f['length']>0x0){return _0x4f8bc6[_0x8acb('0x18')](0x190)[_0x8acb('0x2b')](_0x226d8f);}var _0x5582bf=_0xc44b8[_0x8acb('0x2c')][_0x8acb('0x2d')];var _0x33b11e=_0xc44b8[_0x8acb('0x2c')][_0x8acb('0x25')];return getAgent(_0x5582bf)[_0x8acb('0x1c')](function(_0x5ad1d7){logger[_0x8acb('0x12')]('entityFound:',_0x5ad1d7[_0x8acb('0x17')]);emit(util[_0x8acb('0x32')](_0x8acb('0x33'),_0x5ad1d7[_0x8acb('0x17')]),_0x8acb('0x3c'),{'sessionId':_0x33b11e});return _0x4f8bc6[_0x8acb('0x18')](0xc8)[_0x8acb('0x2b')]({'error':![],'message':_0x8acb('0x3d')});})[_0x8acb('0x34')](handleError(_0x4f8bc6));};exports[_0x8acb('0x3e')]=function(_0x1bd115,_0x515076){logger['info'](_0x8acb('0x3f'),_0x1bd115[_0x8acb('0x2c')]);var _0x5454b3=unholdValidation[_0x8acb('0xc')](_0x1bd115[_0x8acb('0x2c')]);if(_0x5454b3['length']>0x0){return _0x515076[_0x8acb('0x18')](0x190)[_0x8acb('0x2b')](_0x5454b3);}var _0x32b875=_0x1bd115[_0x8acb('0x2c')][_0x8acb('0x2d')];var _0x110e4b=_0x1bd115['body']['sessionId'];return getAgent(_0x32b875)[_0x8acb('0x1c')](function(_0x94fcd2){logger[_0x8acb('0x12')](_0x8acb('0x31'),_0x94fcd2[_0x8acb('0x17')]);emit(util['format'](_0x8acb('0x33'),_0x94fcd2['name']),_0x8acb('0x40'),{'sessionId':_0x110e4b});return _0x515076[_0x8acb('0x18')](0xc8)[_0x8acb('0x2b')]({'error':![],'message':_0x8acb('0x41')});})[_0x8acb('0x34')](handleError(_0x515076));};exports[_0x8acb('0x42')]=function(_0x12f5c9,_0x10d22f){logger['info']('calls\x20fired:',_0x10d22f[_0x8acb('0x2c')]);var _0x53ecdf=callsValidation['validate'](_0x12f5c9['body']);if(_0x53ecdf['length']>0x0){return _0x10d22f[_0x8acb('0x18')](0x190)[_0x8acb('0x2b')](_0x53ecdf);}var _0x43648d=_0x12f5c9[_0x8acb('0x2c')]['userId'];var _0x21f614=respondWithRpcPromise('VoiceChannels');var _0x46ebbd=getAgent(_0x43648d);return Promise[_0x8acb('0x22')]([_0x21f614,_0x46ebbd])['then'](function(_0xd0869d){var _0x52b6ef=_0xd0869d[0x0];var _0x2c7841=_0xd0869d[0x1];var _0x2589be=_[_0x8acb('0x23')](_0x52b6ef[_0x8acb('0x43')],function(_0x45fd22){return _0x45fd22['UserId']==_0x2c7841['id'];});return _0x10d22f['status'](0xc8)[_0x8acb('0x2b')]({'count':_0x2589be[_0x8acb('0x26')],'rows':_0x2589be});})[_0x8acb('0x34')](handleError(_0x10d22f));};exports[_0x8acb('0x44')]=function(_0x24956d,_0x52edc0){logger['info'](_0x8acb('0x45'),_0x24956d[_0x8acb('0x2c')]);var _0x42e478=conferenceValidation[_0x8acb('0xc')](_0x24956d[_0x8acb('0x2c')]);if(_0x42e478[_0x8acb('0x26')]>0x0){return _0x52edc0[_0x8acb('0x18')](0x190)[_0x8acb('0x2b')](_0x42e478);}var _0xca6999=_0x24956d[_0x8acb('0x2c')]['userId'];return getAgent(_0xca6999)[_0x8acb('0x1c')](function(_0x41e237){logger['info'](_0x8acb('0x31'),_0x41e237['name']);emit(util[_0x8acb('0x32')](_0x8acb('0x33'),_0x41e237[_0x8acb('0x17')]),'webbar:conference');return _0x52edc0['status'](0xc8)[_0x8acb('0x2b')]({'error':![],'message':_0x8acb('0x46')});})[_0x8acb('0x34')](handleError(_0x52edc0));};exports[_0x8acb('0x47')]=function(_0x3df955,_0x177c22){logger[_0x8acb('0x12')](_0x8acb('0x48'),_0x3df955[_0x8acb('0x2c')]);var _0x3c3aae=transferValidation['validate'](_0x3df955[_0x8acb('0x2c')]);if(_0x3c3aae[_0x8acb('0x26')]>0x0){return _0x177c22[_0x8acb('0x18')](0x190)[_0x8acb('0x2b')](_0x3c3aae);}var _0x4a40e3=_0x3df955['body'][_0x8acb('0x2d')];var _0x58091f=_0x3df955['body'][_0x8acb('0x25')];var _0x10d374=_0x3df955[_0x8acb('0x2c')]['transferNumber'];return getAgent(_0x4a40e3)[_0x8acb('0x1c')](function(_0x5e2f1c){logger['info'](_0x8acb('0x31'),_0x5e2f1c['name']);emit(util[_0x8acb('0x32')](_0x8acb('0x33'),_0x5e2f1c[_0x8acb('0x17')]),'webbar:transfer',{'sessionId':_0x58091f,'transferNumber':_0x10d374});return _0x177c22[_0x8acb('0x18')](0xc8)['json']({'error':![],'message':_0x8acb('0x49')});})[_0x8acb('0x34')](handleError(_0x177c22));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 47d2071..5c880de 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 _0x5464=['show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','post','addAgents','/:id/applications','/:id/notify','notify','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','describe','/:id'];(function(_0x3bbe24,_0x381385){var _0x209387=function(_0x8cf0e8){while(--_0x8cf0e8){_0x3bbe24['push'](_0x3bbe24['shift']());}};_0x209387(++_0x381385);}(_0x5464,0x15d));var _0x4546=function(_0x344556,_0xd096f3){_0x344556=_0x344556-0x0;var _0x524e19=_0x5464[_0x344556];return _0x524e19;};'use strict';var multer=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var path=require(_0x4546('0x2'));var timeout=require('connect-timeout');var express=require(_0x4546('0x3'));var router=express['Router']();var auth=require(_0x4546('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4546('0x5'));var controller=require(_0x4546('0x6'));router[_0x4546('0x7')]('/',auth[_0x4546('0x8')](),controller['index']);router['get']('/describe',auth[_0x4546('0x8')](),controller[_0x4546('0x9')]);router[_0x4546('0x7')](_0x4546('0xa'),auth[_0x4546('0x8')](),controller[_0x4546('0xb')]);router[_0x4546('0x7')](_0x4546('0xc'),auth[_0x4546('0x8')](),controller['getDispositions']);router[_0x4546('0x7')](_0x4546('0xd'),auth[_0x4546('0x8')](),controller['getAnswers']);router[_0x4546('0x7')](_0x4546('0xe'),auth[_0x4546('0x8')](),controller[_0x4546('0xf')]);router['get']('/:id/applications',auth[_0x4546('0x8')](),controller['getApplications']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/dispositions',auth[_0x4546('0x8')](),controller['addDisposition']);router[_0x4546('0x10')]('/:id/canned_answers',auth[_0x4546('0x8')](),controller['addAnswer']);router[_0x4546('0x10')](_0x4546('0xe'),auth[_0x4546('0x8')](),controller[_0x4546('0x11')]);router[_0x4546('0x10')](_0x4546('0x12'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x4546('0x13'),controller[_0x4546('0x14')]);router[_0x4546('0x10')](_0x4546('0x15'),auth[_0x4546('0x8')](),controller[_0x4546('0x16')]);router[_0x4546('0x17')](_0x4546('0xa'),auth[_0x4546('0x8')](),controller[_0x4546('0x18')]);router['delete'](_0x4546('0xa'),auth[_0x4546('0x8')](),controller['destroy']);router[_0x4546('0x19')](_0x4546('0xc'),auth[_0x4546('0x8')](),controller[_0x4546('0x1a')]);router[_0x4546('0x19')](_0x4546('0xd'),auth['isAuthenticated'](),controller[_0x4546('0x1b')]);router[_0x4546('0x19')]('/:id/users',auth[_0x4546('0x8')](),controller[_0x4546('0x1c')]);module[_0x4546('0x1d')]=router; \ No newline at end of file +var _0x02ce=['/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','addDisposition','post','addAgents','addApplications','/:id/notify','notify','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0x02ce,0x1ac));var _0xe02c=function(_0x3e8239,_0xc04d56){_0x3e8239=_0x3e8239-0x0;var _0x2cc493=_0x02ce[_0x3e8239];return _0x2cc493;};'use strict';var multer=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var path=require(_0xe02c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe02c('0x3'));var router=express['Router']();var auth=require(_0xe02c('0x4'));var interaction=require(_0xe02c('0x5'));var config=require(_0xe02c('0x6'));var controller=require(_0xe02c('0x7'));router[_0xe02c('0x8')]('/',auth[_0xe02c('0x9')](),controller[_0xe02c('0xa')]);router[_0xe02c('0x8')](_0xe02c('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe02c('0x8')](_0xe02c('0xc'),auth[_0xe02c('0x9')](),controller[_0xe02c('0xd')]);router[_0xe02c('0x8')](_0xe02c('0xe'),auth[_0xe02c('0x9')](),controller[_0xe02c('0xf')]);router[_0xe02c('0x8')](_0xe02c('0x10'),auth[_0xe02c('0x9')](),controller[_0xe02c('0x11')]);router[_0xe02c('0x8')](_0xe02c('0x12'),auth[_0xe02c('0x9')](),controller[_0xe02c('0x13')]);router[_0xe02c('0x8')](_0xe02c('0x14'),auth['isAuthenticated'](),controller[_0xe02c('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe02c('0x16')]);router['post'](_0xe02c('0xe'),auth['isAuthenticated'](),controller[_0xe02c('0x17')]);router['post'](_0xe02c('0x10'),auth[_0xe02c('0x9')](),controller['addAnswer']);router[_0xe02c('0x18')](_0xe02c('0x12'),auth['isAuthenticated'](),controller[_0xe02c('0x19')]);router[_0xe02c('0x18')]('/:id/applications',auth['isAuthenticated'](),controller[_0xe02c('0x1a')]);router['post'](_0xe02c('0x1b'),controller[_0xe02c('0x1c')]);router[_0xe02c('0x18')](_0xe02c('0x1d'),auth[_0xe02c('0x9')](),controller['send']);router[_0xe02c('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0xe02c('0x1f')]);router[_0xe02c('0x20')]('/:id',auth[_0xe02c('0x9')](),controller[_0xe02c('0x21')]);router['delete'](_0xe02c('0xe'),auth[_0xe02c('0x9')](),controller[_0xe02c('0x22')]);router[_0xe02c('0x20')](_0xe02c('0x10'),auth[_0xe02c('0x9')](),controller[_0xe02c('0x23')]);router[_0xe02c('0x20')](_0xe02c('0x12'),auth[_0xe02c('0x9')](),controller[_0xe02c('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 8ec2080..4fe1787 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 _0x3b5f=['mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING','generate','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x3b5f,0x17c));var _0xf3b5=function(_0x16e8c2,_0x4518cb){_0x16e8c2=_0x16e8c2-0x0;var _0x1091e1=_0x3b5f[_0x16e8c2];return _0x1091e1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf3b5('0x0'));module[_0xf3b5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf3b5('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xf3b5('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xf3b5('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xf3b5('0x3')],'defaultValue':function(){return rs[_0xf3b5('0x4')]();}},'phone':{'type':Sequelize[_0xf3b5('0x3')]},'type':{'type':Sequelize['ENUM'](_0xf3b5('0x5'))},'accountSid':{'type':Sequelize[_0xf3b5('0x3')]},'authToken':{'type':Sequelize[_0xf3b5('0x3')]},'notificationTemplate':{'type':Sequelize[_0xf3b5('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf3b5('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xf3b5('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf3b5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf3b5('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf3b5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf3b5('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf3b5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf3b5('0x8')],'comment':_0xf3b5('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xf3b5('0x7')],'defaultValue':![],'comment':_0xf3b5('0xa'),'set':function(_0xdd6f04){if(!_0xdd6f04){this[_0xf3b5('0xb')](_0xf3b5('0xc'),null);}this[_0xf3b5('0xb')](_0xf3b5('0xd'),_0xdd6f04);}},'description':{'type':Sequelize[_0xf3b5('0x3')]}}; \ No newline at end of file +var _0x309b=['ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','generate'];(function(_0x31081f,_0x98cb6a){var _0x51fd1c=function(_0x295bc7){while(--_0x295bc7){_0x31081f['push'](_0x31081f['shift']());}};_0x51fd1c(++_0x98cb6a);}(_0x309b,0x175));var _0xb309=function(_0x11597f,_0x319a85){_0x11597f=_0x11597f-0x0;var _0x4a375e=_0x309b[_0x11597f];return _0x4a375e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb309('0x0'));module[_0xb309('0x1')]={'name':{'type':Sequelize[_0xb309('0x2')],'unique':_0xb309('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xb309('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xb309('0x2')],'defaultValue':function(){return rs[_0xb309('0x4')]();}},'phone':{'type':Sequelize[_0xb309('0x2')]},'type':{'type':Sequelize[_0xb309('0x5')](_0xb309('0x6'))},'accountSid':{'type':Sequelize[_0xb309('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb309('0x7');}},'notificationSound':{'type':Sequelize[_0xb309('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb309('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb309('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb309('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb309('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb309('0x9')],'comment':_0xb309('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xb309('0x8')],'defaultValue':![],'comment':_0xb309('0xb'),'set':function(_0x3d14b4){if(!_0x3d14b4){this[_0xb309('0xc')](_0xb309('0xd'),null);}this['setDataValue']('mandatoryDisposition',_0x3d14b4);}},'description':{'type':Sequelize[_0xb309('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 0417497..15d2a31 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 _0x4af5=['addDisposition','WhatsappAccountId','Disposition','findOne','options','includeAll','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','orderBy','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','MessageSid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','Contacts','list','WhatsappInteraction','spread','interaction','created','applications','push','close','unmanaged','*,*,*,*','WhatsappMessage','messageId','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','text/xml','\x0a','json','to\x20is\x20mandatory','CmList','List','DESC','out','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','jayson/promise','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','count','offset','Content-Range','apply','reject','then','get','WhatsappAccounts','destroy','end','stack','name','send','index','Pause','WhatsappAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','VIRTUAL','include','findAll','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe'];(function(_0x4de752,_0x48e4dc){var _0x56792d=function(_0x379a09){while(--_0x379a09){_0x4de752['push'](_0x4de752['shift']());}};_0x56792d(++_0x48e4dc);}(_0x4af5,0x1c3));var _0x54af=function(_0x55b6ba,_0x305cd6){_0x55b6ba=_0x55b6ba-0x0;var _0x494dfd=_0x4af5[_0x55b6ba];return _0x494dfd;};'use strict';var pdf=require(_0x54af('0x0'));var emlformat=require(_0x54af('0x1'));var rimraf=require(_0x54af('0x2'));var zipdir=require(_0x54af('0x3'));var jsonpatch=require(_0x54af('0x4'));var rp=require(_0x54af('0x5'));var moment=require('moment');var BPromise=require(_0x54af('0x6'));var Mustache=require(_0x54af('0x7'));var util=require('util');var path=require('path');var sox=require(_0x54af('0x8'));var csv=require(_0x54af('0x9'));var ejs=require(_0x54af('0xa'));var fs=require('fs');var _=require(_0x54af('0xb'));var squel=require('squel');var crypto=require(_0x54af('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x54af('0xd'));var Redis=require(_0x54af('0xe'));var authService=require(_0x54af('0xf'));var qs=require(_0x54af('0x10'));var as=require(_0x54af('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54af('0x12'))(_0x54af('0x13'));var utils=require('../../config/utils');var config=require(_0x54af('0x14'));var licenseUtil=require(_0x54af('0x15'));var db=require(_0x54af('0x16'))['db'];config['redis']=_[_0x54af('0x17')](config[_0x54af('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x54af('0x18')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x54af('0x19'));var client=jayson['client'][_0x54af('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x2d05c3,_0x3ffc0a,_0x284f5b,_0x521b12){return new BPromise(function(_0x54576b,_0x549547){var _0x318a2a=_0x521b12||client;return _0x318a2a[_0x54af('0x1b')](_0x2d05c3,_0x284f5b)['then'](function(_0x2ab56e){logger[_0x54af('0x1c')](_0x54af('0x1d'),_0x3ffc0a,_0x54af('0x1e'));logger[_0x54af('0x1f')](_0x54af('0x20'),_0x3ffc0a,_0x54af('0x1e'),JSON['stringify'](_0x2ab56e));if(_0x2ab56e[_0x54af('0x21')]){if(_0x2ab56e[_0x54af('0x21')]['code']===0x1f4){logger[_0x54af('0x21')](_0x54af('0x1d'),_0x3ffc0a,_0x2ab56e[_0x54af('0x21')][_0x54af('0x22')]);return _0x549547(_0x2ab56e[_0x54af('0x21')][_0x54af('0x22')]);}logger[_0x54af('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x3ffc0a,_0x2ab56e[_0x54af('0x21')]['message']);return _0x54576b(_0x2ab56e[_0x54af('0x21')][_0x54af('0x22')]);}else{logger[_0x54af('0x1c')](_0x54af('0x1d'),_0x3ffc0a,_0x54af('0x1e'));_0x54576b(_0x2ab56e[_0x54af('0x23')][_0x54af('0x22')]);}})['catch'](function(_0x812aa){logger[_0x54af('0x21')](_0x54af('0x1d'),_0x3ffc0a,_0x812aa);_0x549547(_0x812aa);});});}function respondWithStatusCode(_0x32011b,_0x3d2a80){_0x3d2a80=_0x3d2a80||0xcc;return function(_0x1419e2){if(_0x1419e2){return _0x32011b[_0x54af('0x24')](_0x3d2a80);}return _0x32011b[_0x54af('0x25')](_0x3d2a80)['end']();};}function respondWithResult(_0xb92f39,_0x5425df){_0x5425df=_0x5425df||0xc8;return function(_0x2f5448){if(_0x2f5448){return _0xb92f39[_0x54af('0x25')](_0x5425df)['json'](_0x2f5448);}};}function respondWithFilteredResult(_0x342a23,_0x5b8fb8){return function(_0xf9b19c){if(_0xf9b19c){var _0x316966=_0xf9b19c[_0x54af('0x26')],_0x4901c7=_0x5b8fb8[_0x54af('0x27')],_0x56b09d=_0x5b8fb8[_0x54af('0x27')]+_0x5b8fb8['limit'],_0x3ae54f;if(_0x56b09d>=_0x316966){_0x56b09d=_0x316966;_0x3ae54f=0xc8;}else{_0x3ae54f=0xce;}_0x342a23[_0x54af('0x25')](_0x3ae54f);return _0x342a23['set'](_0x54af('0x28'),_0x4901c7+'-'+_0x56b09d+'/'+_0x316966)['json'](_0xf9b19c);}return null;};}function patchUpdates(_0x229079){return function(_0x1bce33){try{jsonpatch[_0x54af('0x29')](_0x1bce33,_0x229079,!![]);}catch(_0x3d3748){return BPromise[_0x54af('0x2a')](_0x3d3748);}return _0x1bce33['save']();};}function saveUpdates(_0x39def0,_0xdfc564){return function(_0x1dd43f){if(_0x1dd43f){return _0x1dd43f['update'](_0x39def0)['then'](function(_0x574622){return _0x574622;});}return null;};}function removeEntity(_0x53ea70,_0x4beabc){return function(_0x371320){if(_0x371320){return _0x371320['destroy']()[_0x54af('0x2b')](function(){var _0x59ab08=_0x371320[_0x54af('0x2c')]({'plain':!![]});var _0x5f01b5=_0x54af('0x2d');return db['UserProfileResource'][_0x54af('0x2e')]({'where':{'type':_0x5f01b5,'resourceId':_0x59ab08['id']}})[_0x54af('0x2b')](function(){return _0x371320;});})[_0x54af('0x2b')](function(){_0x53ea70[_0x54af('0x25')](0xcc)[_0x54af('0x2f')]();});}};}function handleEntityNotFound(_0x167a2e,_0x4aa688){return function(_0x432368){if(!_0x432368){_0x167a2e[_0x54af('0x24')](0x194);}return _0x432368;};}function handleError(_0x58000b,_0x26699d){_0x26699d=_0x26699d||0x1f4;return function(_0x20e9fc){logger['error'](_0x20e9fc[_0x54af('0x30')]);if(_0x20e9fc[_0x54af('0x31')]){delete _0x20e9fc[_0x54af('0x31')];}_0x58000b[_0x54af('0x25')](_0x26699d)[_0x54af('0x32')](_0x20e9fc);};}exports[_0x54af('0x33')]=function(_0x2df123,_0x597dab){var _0x7febac={'include':[{'model':db[_0x54af('0x34')],'as':'mandatoryDispositionPause'}]},_0x425cb2={},_0x12d892={'count':0x0,'rows':[]};var _0x150fc3=_['map'](db[_0x54af('0x35')]['rawAttributes'],function(_0xd8f10f){return{'name':_0xd8f10f[_0x54af('0x36')],'type':_0xd8f10f[_0x54af('0x37')][_0x54af('0x38')]};});_0x425cb2[_0x54af('0x39')]=_['map'](_0x150fc3,_0x54af('0x31'));_0x425cb2[_0x54af('0x3a')]=_[_0x54af('0x3b')](_0x2df123[_0x54af('0x3a')]);_0x425cb2[_0x54af('0x3c')]=_['intersection'](_0x425cb2['model'],_0x425cb2[_0x54af('0x3a')]);_0x7febac[_0x54af('0x3d')]=_[_0x54af('0x3e')](_0x425cb2['model'],qs['fields'](_0x2df123[_0x54af('0x3a')][_0x54af('0x3f')]));_0x7febac[_0x54af('0x3d')]=_0x7febac[_0x54af('0x3d')]['length']?_0x7febac[_0x54af('0x3d')]:_0x425cb2[_0x54af('0x39')];if(!_0x2df123[_0x54af('0x3a')][_0x54af('0x40')](_0x54af('0x41'))){_0x7febac[_0x54af('0x42')]=qs[_0x54af('0x42')](_0x2df123[_0x54af('0x3a')][_0x54af('0x42')]);_0x7febac[_0x54af('0x27')]=qs[_0x54af('0x27')](_0x2df123['query'][_0x54af('0x27')]);}_0x7febac[_0x54af('0x43')]=qs[_0x54af('0x44')](_0x2df123[_0x54af('0x3a')][_0x54af('0x44')]);_0x7febac['where']=qs[_0x54af('0x3c')](_[_0x54af('0x45')](_0x2df123[_0x54af('0x3a')],_0x425cb2[_0x54af('0x3c')]),_0x150fc3);if(_0x2df123[_0x54af('0x3a')][_0x54af('0x46')]){_0x7febac[_0x54af('0x47')]=_[_0x54af('0x48')](_0x7febac[_0x54af('0x47')],{'$or':_[_0x54af('0x49')](_0x150fc3,function(_0x4e78c0){if(_0x4e78c0[_0x54af('0x37')]!==_0x54af('0x4a')){var _0x2a19f8={};_0x2a19f8[_0x4e78c0['name']]={'$like':'%'+_0x2df123['query'][_0x54af('0x46')]+'%'};return _0x2a19f8;}})});}_0x7febac=_[_0x54af('0x48')]({},_0x7febac,_0x2df123['options']);var _0x565047={'where':_0x7febac[_0x54af('0x47')]};return db['WhatsappAccount'][_0x54af('0x26')](_0x565047)[_0x54af('0x2b')](function(_0x4b35c0){_0x12d892['count']=_0x4b35c0;if(_0x2df123['query']['includeAll']){_0x7febac[_0x54af('0x4b')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x54af('0x4c')](_0x7febac);})[_0x54af('0x2b')](function(_0x5c5399){_0x12d892['rows']=_0x5c5399;return _0x12d892;})[_0x54af('0x2b')](respondWithFilteredResult(_0x597dab,_0x7febac))[_0x54af('0x4d')](handleError(_0x597dab,null));};exports[_0x54af('0x4e')]=function(_0x4db0dd,_0x227092){var _0x1a5799={'raw':![],'where':{'id':_0x4db0dd[_0x54af('0x4f')]['id']},'include':[{'model':db[_0x54af('0x34')],'as':_0x54af('0x50')}]},_0x51cdfb={};_0x51cdfb[_0x54af('0x39')]=_[_0x54af('0x3b')](db[_0x54af('0x35')][_0x54af('0x51')]);_0x51cdfb[_0x54af('0x3a')]=_['keys'](_0x4db0dd['query']);_0x51cdfb['filters']=_[_0x54af('0x3e')](_0x51cdfb[_0x54af('0x39')],_0x51cdfb[_0x54af('0x3a')]);_0x1a5799['attributes']=_[_0x54af('0x3e')](_0x51cdfb[_0x54af('0x39')],qs[_0x54af('0x3f')](_0x4db0dd[_0x54af('0x3a')][_0x54af('0x3f')]));_0x1a5799[_0x54af('0x3d')]=_0x1a5799[_0x54af('0x3d')][_0x54af('0x52')]?_0x1a5799[_0x54af('0x3d')]:_0x51cdfb[_0x54af('0x39')];if(_0x4db0dd[_0x54af('0x3a')]['includeAll']){_0x1a5799[_0x54af('0x4b')]=[{'all':!![]}];}_0x1a5799=_[_0x54af('0x48')]({},_0x1a5799,_0x4db0dd['options']);return db[_0x54af('0x35')][_0x54af('0x53')](_0x1a5799)[_0x54af('0x2b')](handleEntityNotFound(_0x227092,null))['then'](respondWithResult(_0x227092,null))['catch'](handleError(_0x227092,null));};exports[_0x54af('0x54')]=function(_0x50c416,_0x737850){return db['WhatsappAccount'][_0x54af('0x54')](_0x50c416[_0x54af('0x55')],{})[_0x54af('0x2b')](function(_0x4abee5){var _0x4484bd=_0x50c416['user'][_0x54af('0x2c')]({'plain':!![]});if(!_0x4484bd)throw new Error(_0x54af('0x56'));if(_0x4484bd[_0x54af('0x57')]===_0x54af('0x58')){var _0x4ffebd=_0x4abee5['get']({'plain':!![]});var _0x582a21=_0x54af('0x2d');return db[_0x54af('0x59')][_0x54af('0x53')]({'where':{'name':_0x582a21,'userProfileId':_0x4484bd[_0x54af('0x5a')]},'raw':!![]})[_0x54af('0x2b')](function(_0x5034a7){if(_0x5034a7&&_0x5034a7['autoAssociation']===0x0){return db[_0x54af('0x5b')]['create']({'name':_0x4ffebd['name'],'resourceId':_0x4ffebd['id'],'type':_0x5034a7[_0x54af('0x31')],'sectionId':_0x5034a7['id']},{})[_0x54af('0x2b')](function(){return _0x4abee5;});}else{return _0x4abee5;}})[_0x54af('0x4d')](function(_0x4ca2d2){logger[_0x54af('0x21')](_0x54af('0x5c'),_0x4ca2d2);throw _0x4ca2d2;});}return _0x4abee5;})[_0x54af('0x2b')](respondWithResult(_0x737850,0xc9))[_0x54af('0x4d')](handleError(_0x737850,null));};exports[_0x54af('0x5d')]=function(_0x373120,_0x168306){if(_0x373120[_0x54af('0x55')]['id']){delete _0x373120[_0x54af('0x55')]['id'];}return db[_0x54af('0x35')][_0x54af('0x53')]({'where':{'id':_0x373120['params']['id']},'include':[{'model':db[_0x54af('0x34')],'as':_0x54af('0x50')}]})[_0x54af('0x2b')](handleEntityNotFound(_0x168306,null))[_0x54af('0x2b')](saveUpdates(_0x373120['body'],null))[_0x54af('0x2b')](respondWithResult(_0x168306,null))['catch'](handleError(_0x168306,null));};exports[_0x54af('0x2e')]=function(_0x20f723,_0x40fff1){return db[_0x54af('0x35')][_0x54af('0x53')]({'where':{'id':_0x20f723['params']['id']}})['then'](handleEntityNotFound(_0x40fff1,null))['then'](removeEntity(_0x40fff1,null))['catch'](handleError(_0x40fff1,null));};exports['describe']=function(_0x596124,_0x595423){return db[_0x54af('0x35')][_0x54af('0x5e')]()[_0x54af('0x2b')](respondWithResult(_0x595423,null))[_0x54af('0x4d')](handleError(_0x595423,null));};exports[_0x54af('0x5f')]=function(_0x557292,_0x3a5c74,_0xf441b5){if(_0x557292[_0x54af('0x55')]['id']){delete _0x557292['body']['id'];}return db['WhatsappAccount'][_0x54af('0x53')]({'where':{'id':_0x557292['params']['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x3a5c74,null))[_0x54af('0x2b')](function(_0xd559b4){if(_0xd559b4){_0x557292[_0x54af('0x55')][_0x54af('0x60')]=_0xd559b4['id'];return db[_0x54af('0x61')][_0x54af('0x54')](_0x557292[_0x54af('0x55')]);}})[_0x54af('0x2b')](respondWithResult(_0x3a5c74,null))[_0x54af('0x4d')](handleError(_0x3a5c74,null));};exports['getDispositions']=function(_0x1343bb,_0x32719a,_0x7bb997){var _0x40b09a={'raw':![],'where':{}};var _0x2a9119={};var _0x48281b={'count':0x0,'rows':[]};return db[_0x54af('0x35')][_0x54af('0x62')]({'where':{'id':_0x1343bb[_0x54af('0x4f')]['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x32719a,null))[_0x54af('0x2b')](function(_0x350df3){if(_0x350df3){_0x2a9119['model']=_[_0x54af('0x3b')](db[_0x54af('0x61')][_0x54af('0x51')]);_0x2a9119['query']=_[_0x54af('0x3b')](_0x1343bb[_0x54af('0x3a')]);_0x2a9119[_0x54af('0x3c')]=_[_0x54af('0x3e')](_0x2a9119['model'],_0x2a9119[_0x54af('0x3a')]);_0x40b09a[_0x54af('0x3d')]=_[_0x54af('0x3e')](_0x2a9119[_0x54af('0x39')],qs[_0x54af('0x3f')](_0x1343bb[_0x54af('0x3a')][_0x54af('0x3f')]));_0x40b09a[_0x54af('0x3d')]=_0x40b09a[_0x54af('0x3d')][_0x54af('0x52')]?_0x40b09a[_0x54af('0x3d')]:_0x2a9119['model'];if(!_0x1343bb[_0x54af('0x3a')]['hasOwnProperty'](_0x54af('0x41'))){_0x40b09a[_0x54af('0x42')]=qs[_0x54af('0x42')](_0x1343bb[_0x54af('0x3a')][_0x54af('0x42')]);_0x40b09a[_0x54af('0x27')]=qs[_0x54af('0x27')](_0x1343bb[_0x54af('0x3a')]['offset']);}_0x40b09a['order']=qs[_0x54af('0x44')](_0x1343bb[_0x54af('0x3a')][_0x54af('0x44')]);_0x40b09a[_0x54af('0x47')]=qs[_0x54af('0x3c')](_[_0x54af('0x45')](_0x1343bb['query'],_0x2a9119[_0x54af('0x3c')]));_0x40b09a[_0x54af('0x47')][_0x54af('0x60')]=_0x350df3['id'];if(_0x1343bb[_0x54af('0x3a')][_0x54af('0x46')]){_0x40b09a[_0x54af('0x47')]=_[_0x54af('0x48')](_0x40b09a[_0x54af('0x47')],{'$or':_['map'](_0x40b09a[_0x54af('0x3d')],function(_0x592d22){var _0x3c2a12={};_0x3c2a12[_0x592d22]={'$like':'%'+_0x1343bb[_0x54af('0x3a')][_0x54af('0x46')]+'%'};return _0x3c2a12;})});}_0x40b09a=_[_0x54af('0x48')]({},_0x40b09a,_0x1343bb[_0x54af('0x63')]);return db[_0x54af('0x61')]['count']({'where':_0x40b09a['where']})[_0x54af('0x2b')](function(_0x50236a){_0x48281b[_0x54af('0x26')]=_0x50236a;if(_0x1343bb[_0x54af('0x3a')][_0x54af('0x64')]){_0x40b09a[_0x54af('0x4b')]=[{'all':!![]}];}return db[_0x54af('0x61')][_0x54af('0x4c')](_0x40b09a);})[_0x54af('0x2b')](function(_0x11bd45){_0x48281b[_0x54af('0x65')]=_0x11bd45;return _0x48281b;});}})[_0x54af('0x2b')](respondWithFilteredResult(_0x32719a,_0x40b09a))['catch'](handleError(_0x32719a,null));};exports['removeDispositions']=function(_0x59329e,_0x460976,_0x3b03e0){return db['WhatsappAccount']['find']({'where':{'id':_0x59329e['params']['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x460976,null))[_0x54af('0x2b')](function(_0x3db747){if(_0x3db747){return _0x3db747[_0x54af('0x66')](_0x59329e['query'][_0x54af('0x67')]);}})[_0x54af('0x2b')](respondWithStatusCode(_0x460976,null))[_0x54af('0x4d')](handleError(_0x460976,null));};exports['addAnswer']=function(_0x144c71,_0x20aac0,_0x53ec5a){if(_0x144c71['body']['id']){delete _0x144c71[_0x54af('0x55')]['id'];}return db[_0x54af('0x35')]['find']({'where':{'id':_0x144c71[_0x54af('0x4f')]['id']}})['then'](handleEntityNotFound(_0x20aac0,null))[_0x54af('0x2b')](function(_0x483073){if(_0x483073){_0x144c71[_0x54af('0x55')]['WhatsappAccountId']=_0x483073['id'];return db[_0x54af('0x68')][_0x54af('0x54')](_0x144c71[_0x54af('0x55')]);}})[_0x54af('0x2b')](respondWithResult(_0x20aac0,null))[_0x54af('0x4d')](handleError(_0x20aac0,null));};exports[_0x54af('0x69')]=function(_0x3b1de1,_0x16a383,_0x19fd58){var _0xda72f0={'raw':![],'where':{}};var _0x1a37da={};var _0x29584d={'count':0x0,'rows':[]};return db[_0x54af('0x35')][_0x54af('0x62')]({'where':{'id':_0x3b1de1[_0x54af('0x4f')]['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x16a383,null))[_0x54af('0x2b')](function(_0x27b1cb){if(_0x27b1cb){_0x1a37da[_0x54af('0x39')]=_[_0x54af('0x3b')](db[_0x54af('0x68')][_0x54af('0x51')]);_0x1a37da['query']=_[_0x54af('0x3b')](_0x3b1de1[_0x54af('0x3a')]);_0x1a37da[_0x54af('0x3c')]=_[_0x54af('0x3e')](_0x1a37da['model'],_0x1a37da[_0x54af('0x3a')]);_0xda72f0[_0x54af('0x3d')]=_[_0x54af('0x3e')](_0x1a37da['model'],qs[_0x54af('0x3f')](_0x3b1de1[_0x54af('0x3a')]['fields']));_0xda72f0[_0x54af('0x3d')]=_0xda72f0[_0x54af('0x3d')][_0x54af('0x52')]?_0xda72f0['attributes']:_0x1a37da[_0x54af('0x39')];if(!_0x3b1de1[_0x54af('0x3a')][_0x54af('0x40')](_0x54af('0x41'))){_0xda72f0['limit']=qs[_0x54af('0x42')](_0x3b1de1[_0x54af('0x3a')][_0x54af('0x42')]);_0xda72f0[_0x54af('0x27')]=qs[_0x54af('0x27')](_0x3b1de1[_0x54af('0x3a')][_0x54af('0x27')]);}_0xda72f0[_0x54af('0x43')]=qs[_0x54af('0x44')](_0x3b1de1[_0x54af('0x3a')]['sort']);_0xda72f0[_0x54af('0x47')]=qs[_0x54af('0x3c')](_['pick'](_0x3b1de1['query'],_0x1a37da[_0x54af('0x3c')]));_0xda72f0['where']['WhatsappAccountId']=_0x27b1cb['id'];if(_0x3b1de1[_0x54af('0x3a')]['filter']){_0xda72f0['where']=_['merge'](_0xda72f0['where'],{'$or':_['map'](_0xda72f0[_0x54af('0x3d')],function(_0x3676cc){var _0x36bc01={};_0x36bc01[_0x3676cc]={'$like':'%'+_0x3b1de1['query'][_0x54af('0x46')]+'%'};return _0x36bc01;})});}_0xda72f0=_[_0x54af('0x48')]({},_0xda72f0,_0x3b1de1[_0x54af('0x63')]);return db[_0x54af('0x68')][_0x54af('0x26')]({'where':_0xda72f0['where']})['then'](function(_0x6129e4){_0x29584d[_0x54af('0x26')]=_0x6129e4;if(_0x3b1de1[_0x54af('0x3a')][_0x54af('0x64')]){_0xda72f0[_0x54af('0x4b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x54af('0x4c')](_0xda72f0);})[_0x54af('0x2b')](function(_0x1771a0){_0x29584d[_0x54af('0x65')]=_0x1771a0;return _0x29584d;});}})[_0x54af('0x2b')](respondWithFilteredResult(_0x16a383,_0xda72f0))[_0x54af('0x4d')](handleError(_0x16a383,null));};exports[_0x54af('0x6a')]=function(_0x3f7b59,_0x52d786,_0x75999){return db[_0x54af('0x35')][_0x54af('0x53')]({'where':{'id':_0x3f7b59[_0x54af('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52d786,null))[_0x54af('0x2b')](function(_0x3d4990){if(_0x3d4990){return _0x3d4990[_0x54af('0x6a')](_0x3f7b59[_0x54af('0x3a')]['ids']);}})[_0x54af('0x2b')](respondWithStatusCode(_0x52d786,null))[_0x54af('0x4d')](handleError(_0x52d786,null));};exports[_0x54af('0x6b')]=function(_0x542010,_0x42dc16,_0x120c1e){return db[_0x54af('0x35')]['find']({'where':{'id':_0x542010[_0x54af('0x4f')]['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x42dc16,null))[_0x54af('0x2b')](function(_0x3c2345){if(_0x3c2345){return _0x3c2345['addAgents'](_0x542010['body'][_0x54af('0x67')],_[_0x54af('0x6c')](_0x542010[_0x54af('0x55')],['ids','id'])||{})['spread'](function(_0x37ab4e){for(var _0x25ef55=0x0;_0x25ef55<_0x542010[_0x54af('0x55')][_0x54af('0x67')][_0x54af('0x52')];_0x25ef55+=0x1){socket[_0x54af('0x6d')](_0x54af('0x6e'),{'UserId':_0x542010[_0x54af('0x55')][_0x54af('0x67')][_0x25ef55],'WhatsappAccountId':_0x542010[_0x54af('0x4f')]['id']});}return _0x37ab4e;});}})['then'](respondWithResult(_0x42dc16,null))[_0x54af('0x4d')](handleError(_0x42dc16,null));};exports[_0x54af('0x6f')]=function(_0x5d8db4,_0x483b9b,_0x216d2d){return db[_0x54af('0x35')]['find']({'where':{'id':_0x5d8db4[_0x54af('0x4f')]['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x483b9b,null))[_0x54af('0x2b')](function(_0x55f146){if(_0x55f146){return _0x55f146[_0x54af('0x6f')](_0x5d8db4[_0x54af('0x3a')][_0x54af('0x67')])[_0x54af('0x2b')](function(){if(_[_0x54af('0x70')](_0x5d8db4[_0x54af('0x3a')]['ids'])){for(var _0x41876e=0x0;_0x41876e<_0x5d8db4[_0x54af('0x3a')][_0x54af('0x67')][_0x54af('0x52')];_0x41876e+=0x1){socket[_0x54af('0x6d')](_0x54af('0x71'),{'UserId':Number(_0x5d8db4[_0x54af('0x3a')][_0x54af('0x67')][_0x41876e]),'WhatsappAccountId':Number(_0x5d8db4[_0x54af('0x4f')]['id'])});}}else{socket[_0x54af('0x6d')](_0x54af('0x71'),{'UserId':Number(_0x5d8db4['query'][_0x54af('0x67')]),'WhatsappAccountId':Number(_0x5d8db4[_0x54af('0x4f')]['id'])});}});}})[_0x54af('0x2b')](respondWithStatusCode(_0x483b9b,null))['catch'](handleError(_0x483b9b,null));};exports['getAgents']=function(_0xc354bc,_0x82229e,_0x4f03f9){var _0x461074={};var _0x29354b={};var _0x45301a;var _0x24e052;return db[_0x54af('0x35')][_0x54af('0x62')]({'where':{'id':_0xc354bc[_0x54af('0x4f')]['id']}})['then'](handleEntityNotFound(_0x82229e,null))[_0x54af('0x2b')](function(_0x35ddad){if(_0x35ddad){_0x45301a=_0x35ddad;_0x29354b[_0x54af('0x39')]=_[_0x54af('0x3b')](db[_0x54af('0x72')][_0x54af('0x51')]);_0x29354b[_0x54af('0x3a')]=_[_0x54af('0x3b')](_0xc354bc[_0x54af('0x3a')]);_0x29354b[_0x54af('0x3c')]=_[_0x54af('0x3e')](_0x29354b[_0x54af('0x39')],_0x29354b['query']);_0x461074[_0x54af('0x3d')]=_[_0x54af('0x3e')](_0x29354b['model'],qs[_0x54af('0x3f')](_0xc354bc[_0x54af('0x3a')][_0x54af('0x3f')]));_0x461074[_0x54af('0x3d')]=_0x461074[_0x54af('0x3d')][_0x54af('0x52')]?_0x461074[_0x54af('0x3d')]:_0x29354b['model'];_0x461074[_0x54af('0x43')]=qs['sort'](_0xc354bc[_0x54af('0x3a')][_0x54af('0x44')]);_0x461074[_0x54af('0x47')]=qs[_0x54af('0x3c')](_[_0x54af('0x45')](_0xc354bc['query'],_0x29354b[_0x54af('0x3c')]));if(_0xc354bc[_0x54af('0x3a')]['filter']){_0x461074[_0x54af('0x47')]=_[_0x54af('0x48')](_0x461074[_0x54af('0x47')],{'$or':_[_0x54af('0x49')](_0x461074['attributes'],function(_0x5dc70a){var _0x3bd983={};_0x3bd983[_0x5dc70a]={'$like':'%'+_0xc354bc[_0x54af('0x3a')]['filter']+'%'};return _0x3bd983;})});}_0x461074=_[_0x54af('0x48')]({},_0x461074,_0xc354bc['options']);return _0x45301a[_0x54af('0x73')](_0x461074);}})[_0x54af('0x2b')](function(_0xcd01ec){if(_0xcd01ec){_0x24e052=_0xcd01ec[_0x54af('0x52')];if(!_0xc354bc['query']['hasOwnProperty'](_0x54af('0x41'))){_0x461074[_0x54af('0x42')]=qs[_0x54af('0x42')](_0xc354bc[_0x54af('0x3a')]['limit']);_0x461074[_0x54af('0x27')]=qs[_0x54af('0x27')](_0xc354bc['query']['offset']);}return _0x45301a[_0x54af('0x73')](_0x461074);}})[_0x54af('0x2b')](function(_0x31d4cf){if(_0x31d4cf){return _0x31d4cf?{'count':_0x24e052,'rows':_0x31d4cf}:null;}})[_0x54af('0x2b')](respondWithResult(_0x82229e,null))[_0x54af('0x4d')](handleError(_0x82229e,null));};exports['addApplications']=function(_0x1b5be5,_0x2f5d97,_0x13a72e){return db[_0x54af('0x35')][_0x54af('0x62')]({'where':{'id':_0x1b5be5[_0x54af('0x4f')]['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x2f5d97,null))['then'](function(_0x55a838){if(_0x55a838){return db['sequelize'][_0x54af('0x74')](function(_0x5d1634){return db[_0x54af('0x75')]['destroy']({'where':{'WhatsappAccountId':_0x1b5be5[_0x54af('0x4f')]['id']},'transaction':_0x5d1634})[_0x54af('0x2b')](function(_0x4af682){var _0x4823dc=_[_0x54af('0x49')](_0x1b5be5[_0x54af('0x55')],function(_0x504969){_0x504969[_0x54af('0x60')]=_0x1b5be5[_0x54af('0x4f')]['id'];return _0x504969;});return db[_0x54af('0x75')][_0x54af('0x76')](_0x4823dc,{'transaction':_0x5d1634});});})[_0x54af('0x2b')](function(){return db[_0x54af('0x75')][_0x54af('0x77')]({'where':{'WhatsappAccountId':_0x1b5be5[_0x54af('0x4f')]['id']},'order':_0x54af('0x78')});});}})[_0x54af('0x2b')](respondWithResult(_0x2f5d97,null))['catch'](handleError(_0x2f5d97,null));};exports[_0x54af('0x79')]=function(_0x3bd697,_0x2bfb18,_0x2ae497){var _0x31e35c={};var _0x424c09={};var _0x28c863;var _0x9ea083;return db[_0x54af('0x35')][_0x54af('0x62')]({'where':{'id':_0x3bd697[_0x54af('0x4f')]['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x2bfb18,null))['then'](function(_0x29ece5){if(_0x29ece5){_0x28c863=_0x29ece5;_0x424c09['model']=_[_0x54af('0x3b')](db[_0x54af('0x75')][_0x54af('0x51')]);_0x424c09[_0x54af('0x3a')]=_['keys'](_0x3bd697[_0x54af('0x3a')]);_0x424c09[_0x54af('0x3c')]=_['intersection'](_0x424c09[_0x54af('0x39')],_0x424c09[_0x54af('0x3a')]);_0x31e35c[_0x54af('0x3d')]=_['intersection'](_0x424c09[_0x54af('0x39')],qs[_0x54af('0x3f')](_0x3bd697[_0x54af('0x3a')][_0x54af('0x3f')]));_0x31e35c['attributes']=_0x31e35c[_0x54af('0x3d')]['length']?_0x31e35c['attributes']:_0x424c09['model'];_0x31e35c[_0x54af('0x43')]=qs[_0x54af('0x44')](_0x3bd697[_0x54af('0x3a')][_0x54af('0x44')]);_0x31e35c[_0x54af('0x47')]=qs[_0x54af('0x3c')](_['pick'](_0x3bd697['query'],_0x424c09[_0x54af('0x3c')]));if(_0x3bd697[_0x54af('0x3a')][_0x54af('0x46')]){_0x31e35c['where']=_['merge'](_0x31e35c[_0x54af('0x47')],{'$or':_[_0x54af('0x49')](_0x31e35c[_0x54af('0x3d')],function(_0x3f8a73){var _0x2c71e4={};_0x2c71e4[_0x3f8a73]={'$like':'%'+_0x3bd697[_0x54af('0x3a')][_0x54af('0x46')]+'%'};return _0x2c71e4;})});}_0x31e35c=_[_0x54af('0x48')]({},_0x31e35c,_0x3bd697['options']);return _0x28c863[_0x54af('0x79')](_0x31e35c);}})[_0x54af('0x2b')](function(_0x353a91){if(_0x353a91){_0x9ea083=_0x353a91[_0x54af('0x52')];if(!_0x3bd697['query'][_0x54af('0x40')](_0x54af('0x41'))){_0x31e35c['limit']=qs['limit'](_0x3bd697[_0x54af('0x3a')]['limit']);_0x31e35c[_0x54af('0x27')]=qs[_0x54af('0x27')](_0x3bd697[_0x54af('0x3a')][_0x54af('0x27')]);}return _0x28c863[_0x54af('0x79')](_0x31e35c);}})[_0x54af('0x2b')](function(_0xe88c51){if(_0xe88c51){return _0xe88c51?{'count':_0x9ea083,'rows':_0xe88c51}:null;}})['then'](respondWithResult(_0x2bfb18,null))[_0x54af('0x4d')](handleError(_0x2bfb18,null));};exports[_0x54af('0x7a')]=function(_0x470c4e,_0x120152,_0x22ace7){var _0x7b436f={'channel':_0x54af('0x7b')};var _0x283313=[];var _0x59f346=[];var _0x396d5c={};return db[_0x54af('0x35')][_0x54af('0x53')]({'where':{'id':_0x470c4e[_0x54af('0x4f')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x54af('0x7c')}]})[_0x54af('0x2b')](handleEntityNotFound(_0x120152,null))['then'](function(_0x2bfd96){_0x7b436f[_0x54af('0x7d')]=_0x2bfd96;_0x7b436f['applications']=_[_0x54af('0x7e')](_0x2bfd96[_0x54af('0x7c')],[_0x54af('0x78')],['asc']);if(_0x7b436f[_0x54af('0x7d')]['Applications']){delete _0x7b436f[_0x54af('0x7d')][_0x54af('0x7c')];}return db[_0x54af('0x7f')][_0x54af('0x5e')]();})[_0x54af('0x2b')](function(_0x382e5){if(!_0x382e5){throw new db[(_0x54af('0x80'))][(_0x54af('0x81'))](_0x54af('0x82'));}_0x283313=_[_0x54af('0x83')](_[_0x54af('0x3b')](_0x382e5),[_0x54af('0x84'),'updatedAt']);_0x59f346=_[_0x54af('0x83')](_[_0x54af('0x3b')](_0x382e5),[_0x54af('0x84'),_0x54af('0x85'),_0x54af('0x86'),_0x54af('0x87')]);_0x7b436f['body']={'mapKey':'mobile'};if(_0x7b436f[_0x54af('0x7d')][_0x54af('0x37')]&&_0x7b436f[_0x54af('0x7d')][_0x54af('0x37')]===_0x54af('0x88')){_0x7b436f[_0x54af('0x55')][_0x54af('0x89')]=_0x470c4e[_0x54af('0x55')][_0x54af('0x8a')][_0x54af('0x8b')](_0x54af('0x8c'),'');_0x7b436f[_0x54af('0x55')]['body']=_0x470c4e[_0x54af('0x55')][_0x54af('0x8d')];_0x7b436f['body']['messageId']=_0x470c4e[_0x54af('0x55')][_0x54af('0x8e')];}if(_0x7b436f[_0x54af('0x55')]['id']){delete _0x7b436f['body']['id'];}if(_[_0x54af('0x8f')](_0x7b436f[_0x54af('0x55')][_0x54af('0x89')])){throw new db[(_0x54af('0x80'))][(_0x54af('0x81'))]('from\x20is\x20mandatory');}if(_[_0x54af('0x8f')](_0x7b436f[_0x54af('0x55')][_0x54af('0x55')])||_0x7b436f[_0x54af('0x55')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x54af('0x90'));}if(_[_0x54af('0x8f')](_0x7b436f[_0x54af('0x55')][_0x54af('0x91')])){throw new db[(_0x54af('0x80'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x59f346);}if(!_[_0x54af('0x92')](_0x59f346,_0x7b436f[_0x54af('0x55')][_0x54af('0x91')])){throw new db[(_0x54af('0x80'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x59f346);}_0x396d5c[_0x7b436f['body']['mapKey']]=_0x7b436f[_0x54af('0x55')]['from'];return db['CmList'][_0x54af('0x53')]({'where':{'id':_0x7b436f['account'][_0x54af('0x87')]},'include':[{'model':db[_0x54af('0x7f')],'as':_0x54af('0x93'),'where':_0x396d5c,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x54af('0x2b')](handleEntityNotFound(_0x120152,null))[_0x54af('0x2b')](function(_0x1edfb4){if(_0x1edfb4){_0x7b436f[_0x54af('0x94')]=_[_0x54af('0x6c')](_0x1edfb4,[_0x54af('0x93')]);if(_0x1edfb4[_0x54af('0x93')][_0x54af('0x52')]){return _0x1edfb4[_0x54af('0x93')][0x0];}var _0x267573=_[_0x54af('0x17')](_0x7b436f[_0x54af('0x55')],{'firstName':_0x7b436f[_0x54af('0x55')][_0x54af('0x89')],'ListId':_0x1edfb4['id']});_0x267573[_0x7b436f[_0x54af('0x55')][_0x54af('0x91')]]=_0x7b436f['body'][_0x54af('0x89')];return db[_0x54af('0x7f')][_0x54af('0x54')](_0x267573,{'fields':_0x283313,'raw':!![]});}})[_0x54af('0x2b')](handleEntityNotFound(_0x120152,null))[_0x54af('0x2b')](function(_0x381aa1){if(_0x381aa1){_0x7b436f['contact']=_0x381aa1;var _0x51248f={'ContactId':_0x381aa1['id'],'phone':_0x7b436f[_0x54af('0x55')][_0x54af('0x89')],'WhatsappAccountId':_0x470c4e['params']['id']};var _0x3dcad7={'ContactId':_0x381aa1['id'],'WhatsappAccountId':_0x470c4e[_0x54af('0x4f')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x54af('0x53')]({'where':_0x3dcad7})[_0x54af('0x2b')](function(_0x208894){if(_0x208894){return[_0x208894,![]];}return db[_0x54af('0x95')][_0x54af('0x54')](_0x51248f)[_0x54af('0x2b')](function(_0x181a7c){return[_0x181a7c,!![]];});});}})[_0x54af('0x96')](function(_0x15c9f5,_0xfc5b44){_0x7b436f[_0x54af('0x97')]=_0x15c9f5['get']({'plain':!![]});_0x7b436f['interaction'][_0x54af('0x98')]=![];if(_0xfc5b44){if(_0x7b436f[_0x54af('0x7d')]['autoclose']){_0x7b436f[_0x54af('0x99')][_0x54af('0x9a')]({'id':0x0,'priority':_0x7b436f['applications'][_0x54af('0x52')]+0x1,'app':_0x54af('0x9b'),'appdata':_0x54af('0x9c'),'interval':_0x54af('0x9d')});}_0x7b436f[_0x54af('0x97')][_0x54af('0x98')]=!![];}return db[_0x54af('0x9e')]['create']({'phone':_0x7b436f[_0x54af('0x55')][_0x54af('0x89')],'messageId':_0x7b436f[_0x54af('0x55')][_0x54af('0x9f')],'body':_0x7b436f[_0x54af('0x55')][_0x54af('0x55')],'WhatsappAccountId':_0x470c4e['params']['id'],'WhatsappInteractionId':_0x15c9f5['id'],'direction':'in','ContactId':_0x15c9f5[_0x54af('0xa0')],'AttachmentId':_0x7b436f[_0x54af('0x55')][_0x54af('0xa1')]});})['then'](function(_0x206dbb){_0x7b436f[_0x54af('0x22')]=_0x206dbb;if(_0x7b436f[_0x54af('0x97')][_0x54af('0xa2')]){return db['User'][_0x54af('0x53')]({'attributes':['id',_0x54af('0x31')],'where':{'id':_0x7b436f[_0x54af('0x97')][_0x54af('0xa2')]}})[_0x54af('0x2b')](function(_0x459919){if(_0x459919){_0x7b436f['applications'][_0x54af('0xa3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x459919[_0x54af('0x31')]+','+(_0x7b436f[_0x54af('0x7d')][_0x54af('0xa4')]||0xa),'interval':_0x54af('0x9d')});}return respondWithRpcPromise(_0x54af('0xa5'),'startRouting',_0x7b436f);});}return respondWithRpcPromise('Start',_0x54af('0xa6'),_0x7b436f);})['then'](function(_0x181c79){if(_0x181c79){var _0xf4c1a2=0xc8;var _0x1fec5e=_0x54af('0xa7');logger['info'](_0x54af('0x20'),_0x1fec5e,_0xf4c1a2,_0x54af('0xa8'));logger[_0x54af('0x1f')](_0x54af('0xa9'),_0x1fec5e,_0xf4c1a2,_0x54af('0xa8'),JSON[_0x54af('0xaa')](_0x181c79));if(_0x7b436f['account'][_0x54af('0x37')]==='twilio'){return _0x120152['status'](_0xf4c1a2)[_0x54af('0xab')](_0x54af('0xac'),_0x54af('0xad'))[_0x54af('0x32')](_0x54af('0xae'));}else{return _0x120152['status'](_0xf4c1a2)[_0x54af('0xaf')](_0x181c79);}}})[_0x54af('0x4d')](handleError(_0x120152,null));};exports[_0x54af('0x32')]=function(_0x2e1ca6,_0x4756b8,_0x2afdb3){var _0xa34d39,_0x3a1636,_0x1c038c;if(_[_0x54af('0x8f')](_0x2e1ca6[_0x54af('0x55')][_0x54af('0x55')])||_0x2e1ca6['body']['body']===''){throw new db[(_0x54af('0x80'))][(_0x54af('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x54af('0x8f')](_0x2e1ca6[_0x54af('0x55')]['to'])){throw new db[(_0x54af('0x80'))]['ValidationError'](_0x54af('0xb0'));}_0xa34d39=_0x2e1ca6[_0x54af('0x55')]['to'];return db[_0x54af('0x35')][_0x54af('0x53')]({'where':{'id':_0x2e1ca6['params']['id']},'include':[{'model':db[_0x54af('0xb1')],'as':_0x54af('0xb2'),'include':[{'model':db['CmContact'],'as':_0x54af('0x93'),'where':{'mobile':_0xa34d39},'limit':0x1,'order':[[_0x54af('0x85'),_0x54af('0xb3')]]}]}]})[_0x54af('0x2b')](handleEntityNotFound(_0x4756b8,null))[_0x54af('0x2b')](function(_0xb4cad0){if(_0xb4cad0&&_0xb4cad0[_0x54af('0xb2')]){_0x3a1636=_0xb4cad0[_0x54af('0x2c')]({'plain':!![]});if(_0x3a1636[_0x54af('0xb2')]&&_0x3a1636[_0x54af('0xb2')][_0x54af('0x93')][_0x54af('0x52')]){return _0x3a1636[_0x54af('0xb2')][_0x54af('0x93')][0x0];}return db[_0x54af('0x7f')]['create'](_[_0x54af('0x17')](_0x2e1ca6[_0x54af('0x55')],{'firstName':_0xa34d39,'mobile':_0xa34d39,'phone':_0xa34d39,'ListId':_0x3a1636[_0x54af('0x87')]}));}})[_0x54af('0x2b')](handleEntityNotFound(_0x4756b8,null))['then'](function(_0x70a3bb){if(_0x70a3bb){_0x1c038c=_0x70a3bb;return db[_0x54af('0x95')][_0x54af('0x53')]({'where':{'ContactId':_0x1c038c['id'],'closed':![],'WhatsappAccountId':_0x3a1636['id']}})[_0x54af('0x2b')](function(_0x2cd03e){if(_0x2cd03e){return[_0x2cd03e,![]];}return db['WhatsappInteraction'][_0x54af('0x54')]({'UserId':_0x2e1ca6[_0x54af('0x58')]['id'],'ContactId':_0x1c038c['id'],'WhatsappAccountId':_0x3a1636['id'],'phone':_0xa34d39,'firstMsgDirection':_0x54af('0xb4'),'Messages':[_[_0x54af('0x48')](_0x2e1ca6[_0x54af('0x55')],{'read':![],'body':_0x2e1ca6[_0x54af('0x55')][_0x54af('0x55')],'phone':_0xa34d39,'WhatsappAccountId':_0x3a1636['id'],'UserId':_0x2e1ca6['user']['id'],'ContactId':_0x1c038c['id']})]},{'include':[{'model':db[_0x54af('0x9e')],'as':'Messages'}]})[_0x54af('0x2b')](function(_0x457c82){return[_0x457c82,!![]];});});}})[_0x54af('0x96')](function(_0x38ae3e,_0x128a1d){if(_0x128a1d){return _0x38ae3e;}return db[_0x54af('0x9e')][_0x54af('0x54')](_[_0x54af('0x48')](_0x2e1ca6[_0x54af('0x55')],{'read':![],'body':_0x2e1ca6[_0x54af('0x55')][_0x54af('0x55')],'phone':_0xa34d39,'WhatsappAccountId':_0x3a1636['id'],'WhatsappInteractionId':_0x38ae3e['id'],'UserId':_0x2e1ca6[_0x54af('0x58')]['id'],'ContactId':_0x1c038c['id']}))[_0x54af('0x2b')](function(_0x5d5028){_0x38ae3e['dataValues']['Messages']=[];_0x38ae3e['dataValues']['Messages']['push'](_0x5d5028[_0x54af('0xb5')]);return _0x38ae3e;});})[_0x54af('0x2b')](respondWithResult(_0x4756b8,null))[_0x54af('0x4d')](handleError(_0x4756b8,null));}; \ No newline at end of file +var _0x4061=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','WhatsappAccount','includeAll','findAll','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','WhatsappAccountId','Disposition','include','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','emit','getAgents','addApplications','transaction','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','WhatsappApplication','Applications','account','applications','orderBy','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','list','contact','WhatsappInteraction','interaction','created','autoclose','unmanaged','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','WhatsappMessage','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','http','request','then','info','request\x20sent','debug','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','end','status','json','count','offset','limit','apply','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','intersection'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x4061,0x75));var _0x1406=function(_0x3411a4,_0x60d585){_0x3411a4=_0x3411a4-0x0;var _0x4eb325=_0x4061[_0x3411a4];return _0x4eb325;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1406('0x0'));var rimraf=require(_0x1406('0x1'));var zipdir=require(_0x1406('0x2'));var jsonpatch=require(_0x1406('0x3'));var rp=require(_0x1406('0x4'));var moment=require(_0x1406('0x5'));var BPromise=require(_0x1406('0x6'));var Mustache=require(_0x1406('0x7'));var util=require(_0x1406('0x8'));var path=require(_0x1406('0x9'));var sox=require(_0x1406('0xa'));var csv=require(_0x1406('0xb'));var ejs=require(_0x1406('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1406('0xd'));var jsforce=require(_0x1406('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1406('0xb'));var querystring=require(_0x1406('0xf'));var Papa=require(_0x1406('0x10'));var Redis=require(_0x1406('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1406('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1406('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1406('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1406('0x15'))['db'];config[_0x1406('0x16')]=_[_0x1406('0x17')](config[_0x1406('0x16')],{'host':_0x1406('0x18'),'port':0x18eb});var socket=require(_0x1406('0x19'))(new Redis(config[_0x1406('0x16')]));require('./whatsappAccount.socket')[_0x1406('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x1406('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x2ab55d,_0x1996ca,_0x5ec384,_0x2f8f83){return new BPromise(function(_0x13f03a,_0xa8590b){var _0x3fadde=_0x2f8f83||client;return _0x3fadde[_0x1406('0x1c')](_0x2ab55d,_0x5ec384)[_0x1406('0x1d')](function(_0x2e5a0d){logger[_0x1406('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x1996ca,_0x1406('0x1f'));logger[_0x1406('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1996ca,'request\x20sent',JSON['stringify'](_0x2e5a0d));if(_0x2e5a0d['error']){if(_0x2e5a0d[_0x1406('0x21')][_0x1406('0x22')]===0x1f4){logger['error'](_0x1406('0x23'),_0x1996ca,_0x2e5a0d[_0x1406('0x21')][_0x1406('0x24')]);return _0xa8590b(_0x2e5a0d[_0x1406('0x21')][_0x1406('0x24')]);}logger[_0x1406('0x21')](_0x1406('0x23'),_0x1996ca,_0x2e5a0d[_0x1406('0x21')][_0x1406('0x24')]);return _0x13f03a(_0x2e5a0d[_0x1406('0x21')][_0x1406('0x24')]);}else{logger[_0x1406('0x1e')](_0x1406('0x23'),_0x1996ca,_0x1406('0x1f'));_0x13f03a(_0x2e5a0d['result']['message']);}})[_0x1406('0x25')](function(_0x7a4090){logger[_0x1406('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x1996ca,_0x7a4090);_0xa8590b(_0x7a4090);});});}function respondWithStatusCode(_0x20aca8,_0x3c4125){_0x3c4125=_0x3c4125||0xcc;return function(_0x21da0e){if(_0x21da0e){return _0x20aca8['sendStatus'](_0x3c4125);}return _0x20aca8['status'](_0x3c4125)[_0x1406('0x26')]();};}function respondWithResult(_0x384b25,_0x4a0dbf){_0x4a0dbf=_0x4a0dbf||0xc8;return function(_0x1de3d6){if(_0x1de3d6){return _0x384b25[_0x1406('0x27')](_0x4a0dbf)[_0x1406('0x28')](_0x1de3d6);}};}function respondWithFilteredResult(_0x1b4800,_0x365178){return function(_0x320143){if(_0x320143){var _0x5c2391=_0x320143[_0x1406('0x29')],_0x173909=_0x365178['offset'],_0xa98a61=_0x365178[_0x1406('0x2a')]+_0x365178[_0x1406('0x2b')],_0x95dfa0;if(_0xa98a61>=_0x5c2391){_0xa98a61=_0x5c2391;_0x95dfa0=0xc8;}else{_0x95dfa0=0xce;}_0x1b4800[_0x1406('0x27')](_0x95dfa0);return _0x1b4800['set']('Content-Range',_0x173909+'-'+_0xa98a61+'/'+_0x5c2391)[_0x1406('0x28')](_0x320143);}return null;};}function patchUpdates(_0xd692cb){return function(_0x443a54){try{jsonpatch[_0x1406('0x2c')](_0x443a54,_0xd692cb,!![]);}catch(_0x3e0911){return BPromise['reject'](_0x3e0911);}return _0x443a54[_0x1406('0x2d')]();};}function saveUpdates(_0x26ad03,_0x424c6f){return function(_0x16a0c0){if(_0x16a0c0){return _0x16a0c0[_0x1406('0x2e')](_0x26ad03)[_0x1406('0x1d')](function(_0x2b8008){return _0x2b8008;});}return null;};}function removeEntity(_0x3ed947,_0x3153e3){return function(_0x395d9c){if(_0x395d9c){return _0x395d9c[_0x1406('0x2f')]()['then'](function(){var _0x4bbeaa=_0x395d9c[_0x1406('0x30')]({'plain':!![]});var _0x3a4844=_0x1406('0x31');return db[_0x1406('0x32')][_0x1406('0x2f')]({'where':{'type':_0x3a4844,'resourceId':_0x4bbeaa['id']}})[_0x1406('0x1d')](function(){return _0x395d9c;});})[_0x1406('0x1d')](function(){_0x3ed947[_0x1406('0x27')](0xcc)[_0x1406('0x26')]();});}};}function handleEntityNotFound(_0x42115c,_0x477bce){return function(_0x512215){if(!_0x512215){_0x42115c[_0x1406('0x33')](0x194);}return _0x512215;};}function handleError(_0x3392a1,_0xa518db){_0xa518db=_0xa518db||0x1f4;return function(_0x58ed96){logger[_0x1406('0x21')](_0x58ed96['stack']);if(_0x58ed96[_0x1406('0x34')]){delete _0x58ed96[_0x1406('0x34')];}_0x3392a1[_0x1406('0x27')](_0xa518db)[_0x1406('0x35')](_0x58ed96);};}exports['index']=function(_0x4afb72,_0x86df22){var _0x334975={'include':[{'model':db[_0x1406('0x36')],'as':_0x1406('0x37')}]},_0x54d796={},_0x595c8e={'count':0x0,'rows':[]};var _0x1c7441=_[_0x1406('0x38')](db['WhatsappAccount'][_0x1406('0x39')],function(_0x1dbb69){return{'name':_0x1dbb69['fieldName'],'type':_0x1dbb69[_0x1406('0x3a')][_0x1406('0x3b')]};});_0x54d796[_0x1406('0x3c')]=_[_0x1406('0x38')](_0x1c7441,'name');_0x54d796[_0x1406('0x3d')]=_[_0x1406('0x3e')](_0x4afb72[_0x1406('0x3d')]);_0x54d796['filters']=_[_0x1406('0x3f')](_0x54d796[_0x1406('0x3c')],_0x54d796[_0x1406('0x3d')]);_0x334975[_0x1406('0x40')]=_[_0x1406('0x3f')](_0x54d796[_0x1406('0x3c')],qs[_0x1406('0x41')](_0x4afb72[_0x1406('0x3d')]['fields']));_0x334975[_0x1406('0x40')]=_0x334975[_0x1406('0x40')][_0x1406('0x42')]?_0x334975[_0x1406('0x40')]:_0x54d796[_0x1406('0x3c')];if(!_0x4afb72['query'][_0x1406('0x43')](_0x1406('0x44'))){_0x334975[_0x1406('0x2b')]=qs[_0x1406('0x2b')](_0x4afb72['query'][_0x1406('0x2b')]);_0x334975[_0x1406('0x2a')]=qs[_0x1406('0x2a')](_0x4afb72[_0x1406('0x3d')][_0x1406('0x2a')]);}_0x334975[_0x1406('0x45')]=qs[_0x1406('0x46')](_0x4afb72[_0x1406('0x3d')][_0x1406('0x46')]);_0x334975[_0x1406('0x47')]=qs[_0x1406('0x48')](_[_0x1406('0x49')](_0x4afb72[_0x1406('0x3d')],_0x54d796[_0x1406('0x48')]),_0x1c7441);if(_0x4afb72[_0x1406('0x3d')][_0x1406('0x4a')]){_0x334975[_0x1406('0x47')]=_[_0x1406('0x4b')](_0x334975[_0x1406('0x47')],{'$or':_[_0x1406('0x38')](_0x1c7441,function(_0x30e52f){if(_0x30e52f[_0x1406('0x3a')]!==_0x1406('0x4c')){var _0x2d7800={};_0x2d7800[_0x30e52f[_0x1406('0x34')]]={'$like':'%'+_0x4afb72[_0x1406('0x3d')]['filter']+'%'};return _0x2d7800;}})});}_0x334975=_[_0x1406('0x4b')]({},_0x334975,_0x4afb72['options']);var _0x385974={'where':_0x334975['where']};return db[_0x1406('0x4d')]['count'](_0x385974)['then'](function(_0x442e98){_0x595c8e[_0x1406('0x29')]=_0x442e98;if(_0x4afb72['query'][_0x1406('0x4e')]){_0x334975['include']=[{'all':!![]}];}return db[_0x1406('0x4d')][_0x1406('0x4f')](_0x334975);})[_0x1406('0x1d')](function(_0x112d9b){_0x595c8e['rows']=_0x112d9b;return _0x595c8e;})['then'](respondWithFilteredResult(_0x86df22,_0x334975))[_0x1406('0x25')](handleError(_0x86df22,null));};exports[_0x1406('0x50')]=function(_0x56b740,_0x21e5a9){var _0x226811={'raw':![],'where':{'id':_0x56b740['params']['id']},'include':[{'model':db['Pause'],'as':_0x1406('0x37')}]},_0x39abd4={};_0x39abd4[_0x1406('0x3c')]=_['keys'](db['WhatsappAccount'][_0x1406('0x39')]);_0x39abd4[_0x1406('0x3d')]=_[_0x1406('0x3e')](_0x56b740[_0x1406('0x3d')]);_0x39abd4['filters']=_[_0x1406('0x3f')](_0x39abd4['model'],_0x39abd4[_0x1406('0x3d')]);_0x226811[_0x1406('0x40')]=_[_0x1406('0x3f')](_0x39abd4['model'],qs[_0x1406('0x41')](_0x56b740['query']['fields']));_0x226811['attributes']=_0x226811[_0x1406('0x40')][_0x1406('0x42')]?_0x226811['attributes']:_0x39abd4[_0x1406('0x3c')];if(_0x56b740['query'][_0x1406('0x4e')]){_0x226811['include']=[{'all':!![]}];}_0x226811=_[_0x1406('0x4b')]({},_0x226811,_0x56b740[_0x1406('0x51')]);return db[_0x1406('0x4d')][_0x1406('0x52')](_0x226811)['then'](handleEntityNotFound(_0x21e5a9,null))[_0x1406('0x1d')](respondWithResult(_0x21e5a9,null))[_0x1406('0x25')](handleError(_0x21e5a9,null));};exports[_0x1406('0x53')]=function(_0x2765be,_0x81386c){return db[_0x1406('0x4d')]['create'](_0x2765be[_0x1406('0x54')],{})[_0x1406('0x1d')](function(_0x1b0779){var _0x540695=_0x2765be[_0x1406('0x55')]['get']({'plain':!![]});if(!_0x540695)throw new Error(_0x1406('0x56'));if(_0x540695[_0x1406('0x57')]==='user'){var _0x1d8168=_0x1b0779[_0x1406('0x30')]({'plain':!![]});var _0x5ae061=_0x1406('0x31');return db[_0x1406('0x58')]['find']({'where':{'name':_0x5ae061,'userProfileId':_0x540695[_0x1406('0x59')]},'raw':!![]})[_0x1406('0x1d')](function(_0x356901){if(_0x356901&&_0x356901[_0x1406('0x5a')]===0x0){return db[_0x1406('0x32')][_0x1406('0x53')]({'name':_0x1d8168['name'],'resourceId':_0x1d8168['id'],'type':_0x356901[_0x1406('0x34')],'sectionId':_0x356901['id']},{})[_0x1406('0x1d')](function(){return _0x1b0779;});}else{return _0x1b0779;}})[_0x1406('0x25')](function(_0x3505f6){logger[_0x1406('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3505f6);throw _0x3505f6;});}return _0x1b0779;})[_0x1406('0x1d')](respondWithResult(_0x81386c,0xc9))[_0x1406('0x25')](handleError(_0x81386c,null));};exports['update']=function(_0x1dff66,_0x320bd2){if(_0x1dff66[_0x1406('0x54')]['id']){delete _0x1dff66[_0x1406('0x54')]['id'];}return db[_0x1406('0x4d')]['find']({'where':{'id':_0x1dff66[_0x1406('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x1406('0x1d')](handleEntityNotFound(_0x320bd2,null))[_0x1406('0x1d')](saveUpdates(_0x1dff66[_0x1406('0x54')],null))[_0x1406('0x1d')](respondWithResult(_0x320bd2,null))[_0x1406('0x25')](handleError(_0x320bd2,null));};exports[_0x1406('0x2f')]=function(_0x566a59,_0x2dd730){return db[_0x1406('0x4d')][_0x1406('0x52')]({'where':{'id':_0x566a59['params']['id']}})[_0x1406('0x1d')](handleEntityNotFound(_0x2dd730,null))['then'](removeEntity(_0x2dd730,null))['catch'](handleError(_0x2dd730,null));};exports[_0x1406('0x5c')]=function(_0x4b657f,_0x5c3a4d){return db[_0x1406('0x4d')]['describe']()[_0x1406('0x1d')](respondWithResult(_0x5c3a4d,null))[_0x1406('0x25')](handleError(_0x5c3a4d,null));};exports[_0x1406('0x5d')]=function(_0x22a1c5,_0x15db7c,_0x437411){if(_0x22a1c5[_0x1406('0x54')]['id']){delete _0x22a1c5[_0x1406('0x54')]['id'];}return db[_0x1406('0x4d')][_0x1406('0x52')]({'where':{'id':_0x22a1c5['params']['id']}})[_0x1406('0x1d')](handleEntityNotFound(_0x15db7c,null))[_0x1406('0x1d')](function(_0x2505bc){if(_0x2505bc){_0x22a1c5['body'][_0x1406('0x5e')]=_0x2505bc['id'];return db[_0x1406('0x5f')][_0x1406('0x53')](_0x22a1c5[_0x1406('0x54')]);}})['then'](respondWithResult(_0x15db7c,null))[_0x1406('0x25')](handleError(_0x15db7c,null));};exports['getDispositions']=function(_0x219bde,_0x3d866d,_0x5eadb6){var _0xb62af5={'raw':![],'where':{}};var _0x206218={};var _0xcc3474={'count':0x0,'rows':[]};return db[_0x1406('0x4d')]['findOne']({'where':{'id':_0x219bde['params']['id']}})[_0x1406('0x1d')](handleEntityNotFound(_0x3d866d,null))[_0x1406('0x1d')](function(_0xa0bb53){if(_0xa0bb53){_0x206218['model']=_[_0x1406('0x3e')](db[_0x1406('0x5f')][_0x1406('0x39')]);_0x206218[_0x1406('0x3d')]=_[_0x1406('0x3e')](_0x219bde[_0x1406('0x3d')]);_0x206218[_0x1406('0x48')]=_[_0x1406('0x3f')](_0x206218[_0x1406('0x3c')],_0x206218['query']);_0xb62af5[_0x1406('0x40')]=_[_0x1406('0x3f')](_0x206218['model'],qs[_0x1406('0x41')](_0x219bde[_0x1406('0x3d')][_0x1406('0x41')]));_0xb62af5[_0x1406('0x40')]=_0xb62af5[_0x1406('0x40')][_0x1406('0x42')]?_0xb62af5[_0x1406('0x40')]:_0x206218[_0x1406('0x3c')];if(!_0x219bde[_0x1406('0x3d')][_0x1406('0x43')]('nolimit')){_0xb62af5[_0x1406('0x2b')]=qs[_0x1406('0x2b')](_0x219bde[_0x1406('0x3d')][_0x1406('0x2b')]);_0xb62af5[_0x1406('0x2a')]=qs[_0x1406('0x2a')](_0x219bde['query'][_0x1406('0x2a')]);}_0xb62af5[_0x1406('0x45')]=qs['sort'](_0x219bde[_0x1406('0x3d')][_0x1406('0x46')]);_0xb62af5[_0x1406('0x47')]=qs['filters'](_[_0x1406('0x49')](_0x219bde['query'],_0x206218['filters']));_0xb62af5['where'][_0x1406('0x5e')]=_0xa0bb53['id'];if(_0x219bde['query'][_0x1406('0x4a')]){_0xb62af5['where']=_[_0x1406('0x4b')](_0xb62af5[_0x1406('0x47')],{'$or':_[_0x1406('0x38')](_0xb62af5[_0x1406('0x40')],function(_0x261e81){var _0x33408e={};_0x33408e[_0x261e81]={'$like':'%'+_0x219bde[_0x1406('0x3d')][_0x1406('0x4a')]+'%'};return _0x33408e;})});}_0xb62af5=_[_0x1406('0x4b')]({},_0xb62af5,_0x219bde[_0x1406('0x51')]);return db[_0x1406('0x5f')]['count']({'where':_0xb62af5['where']})[_0x1406('0x1d')](function(_0x59e57){_0xcc3474[_0x1406('0x29')]=_0x59e57;if(_0x219bde[_0x1406('0x3d')][_0x1406('0x4e')]){_0xb62af5[_0x1406('0x60')]=[{'all':!![]}];}return db[_0x1406('0x5f')][_0x1406('0x4f')](_0xb62af5);})[_0x1406('0x1d')](function(_0x2555af){_0xcc3474[_0x1406('0x61')]=_0x2555af;return _0xcc3474;});}})[_0x1406('0x1d')](respondWithFilteredResult(_0x3d866d,_0xb62af5))[_0x1406('0x25')](handleError(_0x3d866d,null));};exports['removeDispositions']=function(_0x1289f8,_0x163e1f,_0x582c91){return db[_0x1406('0x4d')][_0x1406('0x52')]({'where':{'id':_0x1289f8[_0x1406('0x5b')]['id']}})[_0x1406('0x1d')](handleEntityNotFound(_0x163e1f,null))['then'](function(_0x19c94c){if(_0x19c94c){return _0x19c94c[_0x1406('0x62')](_0x1289f8['query'][_0x1406('0x63')]);}})[_0x1406('0x1d')](respondWithStatusCode(_0x163e1f,null))['catch'](handleError(_0x163e1f,null));};exports[_0x1406('0x64')]=function(_0x4e36db,_0x3a783f,_0x142629){if(_0x4e36db[_0x1406('0x54')]['id']){delete _0x4e36db[_0x1406('0x54')]['id'];}return db[_0x1406('0x4d')][_0x1406('0x52')]({'where':{'id':_0x4e36db[_0x1406('0x5b')]['id']}})[_0x1406('0x1d')](handleEntityNotFound(_0x3a783f,null))[_0x1406('0x1d')](function(_0x2ed8d0){if(_0x2ed8d0){_0x4e36db[_0x1406('0x54')][_0x1406('0x5e')]=_0x2ed8d0['id'];return db[_0x1406('0x65')]['create'](_0x4e36db[_0x1406('0x54')]);}})[_0x1406('0x1d')](respondWithResult(_0x3a783f,null))['catch'](handleError(_0x3a783f,null));};exports[_0x1406('0x66')]=function(_0x1bca25,_0x4184b8,_0xa1221b){var _0x35d491={'raw':![],'where':{}};var _0x2d63fd={};var _0x46073e={'count':0x0,'rows':[]};return db[_0x1406('0x4d')][_0x1406('0x67')]({'where':{'id':_0x1bca25[_0x1406('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4184b8,null))[_0x1406('0x1d')](function(_0x3b7df9){if(_0x3b7df9){_0x2d63fd['model']=_['keys'](db[_0x1406('0x65')][_0x1406('0x39')]);_0x2d63fd[_0x1406('0x3d')]=_[_0x1406('0x3e')](_0x1bca25[_0x1406('0x3d')]);_0x2d63fd[_0x1406('0x48')]=_[_0x1406('0x3f')](_0x2d63fd[_0x1406('0x3c')],_0x2d63fd[_0x1406('0x3d')]);_0x35d491['attributes']=_[_0x1406('0x3f')](_0x2d63fd[_0x1406('0x3c')],qs[_0x1406('0x41')](_0x1bca25[_0x1406('0x3d')][_0x1406('0x41')]));_0x35d491[_0x1406('0x40')]=_0x35d491['attributes'][_0x1406('0x42')]?_0x35d491['attributes']:_0x2d63fd['model'];if(!_0x1bca25[_0x1406('0x3d')][_0x1406('0x43')](_0x1406('0x44'))){_0x35d491[_0x1406('0x2b')]=qs['limit'](_0x1bca25['query'][_0x1406('0x2b')]);_0x35d491[_0x1406('0x2a')]=qs[_0x1406('0x2a')](_0x1bca25['query']['offset']);}_0x35d491[_0x1406('0x45')]=qs[_0x1406('0x46')](_0x1bca25[_0x1406('0x3d')][_0x1406('0x46')]);_0x35d491[_0x1406('0x47')]=qs[_0x1406('0x48')](_['pick'](_0x1bca25[_0x1406('0x3d')],_0x2d63fd[_0x1406('0x48')]));_0x35d491[_0x1406('0x47')][_0x1406('0x5e')]=_0x3b7df9['id'];if(_0x1bca25[_0x1406('0x3d')][_0x1406('0x4a')]){_0x35d491[_0x1406('0x47')]=_[_0x1406('0x4b')](_0x35d491['where'],{'$or':_[_0x1406('0x38')](_0x35d491[_0x1406('0x40')],function(_0xc0c898){var _0x47695b={};_0x47695b[_0xc0c898]={'$like':'%'+_0x1bca25[_0x1406('0x3d')][_0x1406('0x4a')]+'%'};return _0x47695b;})});}_0x35d491=_[_0x1406('0x4b')]({},_0x35d491,_0x1bca25['options']);return db['CannedAnswer'][_0x1406('0x29')]({'where':_0x35d491[_0x1406('0x47')]})[_0x1406('0x1d')](function(_0x273552){_0x46073e['count']=_0x273552;if(_0x1bca25['query'][_0x1406('0x4e')]){_0x35d491[_0x1406('0x60')]=[{'all':!![]}];}return db[_0x1406('0x65')]['findAll'](_0x35d491);})[_0x1406('0x1d')](function(_0x23d5e5){_0x46073e['rows']=_0x23d5e5;return _0x46073e;});}})['then'](respondWithFilteredResult(_0x4184b8,_0x35d491))['catch'](handleError(_0x4184b8,null));};exports[_0x1406('0x68')]=function(_0x21b5ac,_0xc00ba,_0x4f3564){return db[_0x1406('0x4d')][_0x1406('0x52')]({'where':{'id':_0x21b5ac[_0x1406('0x5b')]['id']}})[_0x1406('0x1d')](handleEntityNotFound(_0xc00ba,null))[_0x1406('0x1d')](function(_0x13dc94){if(_0x13dc94){return _0x13dc94[_0x1406('0x68')](_0x21b5ac['query'][_0x1406('0x63')]);}})[_0x1406('0x1d')](respondWithStatusCode(_0xc00ba,null))['catch'](handleError(_0xc00ba,null));};exports['addAgents']=function(_0x54cc18,_0x372681,_0x19613e){return db[_0x1406('0x4d')][_0x1406('0x52')]({'where':{'id':_0x54cc18[_0x1406('0x5b')]['id']}})[_0x1406('0x1d')](handleEntityNotFound(_0x372681,null))['then'](function(_0x6f6d43){if(_0x6f6d43){return _0x6f6d43[_0x1406('0x69')](_0x54cc18[_0x1406('0x54')][_0x1406('0x63')],_[_0x1406('0x6a')](_0x54cc18[_0x1406('0x54')],[_0x1406('0x63'),'id'])||{})[_0x1406('0x6b')](function(_0x378100){for(var _0x3e55bd=0x0;_0x3e55bd<_0x54cc18[_0x1406('0x54')][_0x1406('0x63')][_0x1406('0x42')];_0x3e55bd+=0x1){socket['emit'](_0x1406('0x6c'),{'UserId':_0x54cc18[_0x1406('0x54')][_0x1406('0x63')][_0x3e55bd],'WhatsappAccountId':_0x54cc18['params']['id']});}return _0x378100;});}})['then'](respondWithResult(_0x372681,null))[_0x1406('0x25')](handleError(_0x372681,null));};exports['removeAgents']=function(_0x351065,_0xe9d496,_0x1eea76){return db[_0x1406('0x4d')]['find']({'where':{'id':_0x351065[_0x1406('0x5b')]['id']}})[_0x1406('0x1d')](handleEntityNotFound(_0xe9d496,null))[_0x1406('0x1d')](function(_0x1973b4){if(_0x1973b4){return _0x1973b4['removeAgents'](_0x351065[_0x1406('0x3d')][_0x1406('0x63')])[_0x1406('0x1d')](function(){if(_[_0x1406('0x6d')](_0x351065[_0x1406('0x3d')]['ids'])){for(var _0x271eb9=0x0;_0x271eb9<_0x351065[_0x1406('0x3d')][_0x1406('0x63')][_0x1406('0x42')];_0x271eb9+=0x1){socket['emit'](_0x1406('0x6e'),{'UserId':Number(_0x351065['query'][_0x1406('0x63')][_0x271eb9]),'WhatsappAccountId':Number(_0x351065['params']['id'])});}}else{socket[_0x1406('0x6f')](_0x1406('0x6e'),{'UserId':Number(_0x351065[_0x1406('0x3d')][_0x1406('0x63')]),'WhatsappAccountId':Number(_0x351065[_0x1406('0x5b')]['id'])});}});}})[_0x1406('0x1d')](respondWithStatusCode(_0xe9d496,null))[_0x1406('0x25')](handleError(_0xe9d496,null));};exports[_0x1406('0x70')]=function(_0xb341fa,_0x1b6238,_0x478d2d){var _0x4d1e8c={};var _0x3b70ff={};var _0x32b373;var _0x3caf08;return db[_0x1406('0x4d')][_0x1406('0x67')]({'where':{'id':_0xb341fa[_0x1406('0x5b')]['id']}})[_0x1406('0x1d')](handleEntityNotFound(_0x1b6238,null))[_0x1406('0x1d')](function(_0x3719aa){if(_0x3719aa){_0x32b373=_0x3719aa;_0x3b70ff[_0x1406('0x3c')]=_[_0x1406('0x3e')](db['User'][_0x1406('0x39')]);_0x3b70ff[_0x1406('0x3d')]=_[_0x1406('0x3e')](_0xb341fa[_0x1406('0x3d')]);_0x3b70ff[_0x1406('0x48')]=_['intersection'](_0x3b70ff[_0x1406('0x3c')],_0x3b70ff[_0x1406('0x3d')]);_0x4d1e8c[_0x1406('0x40')]=_[_0x1406('0x3f')](_0x3b70ff[_0x1406('0x3c')],qs['fields'](_0xb341fa[_0x1406('0x3d')][_0x1406('0x41')]));_0x4d1e8c[_0x1406('0x40')]=_0x4d1e8c[_0x1406('0x40')]['length']?_0x4d1e8c[_0x1406('0x40')]:_0x3b70ff['model'];_0x4d1e8c[_0x1406('0x45')]=qs[_0x1406('0x46')](_0xb341fa[_0x1406('0x3d')][_0x1406('0x46')]);_0x4d1e8c[_0x1406('0x47')]=qs[_0x1406('0x48')](_[_0x1406('0x49')](_0xb341fa[_0x1406('0x3d')],_0x3b70ff[_0x1406('0x48')]));if(_0xb341fa[_0x1406('0x3d')]['filter']){_0x4d1e8c[_0x1406('0x47')]=_['merge'](_0x4d1e8c[_0x1406('0x47')],{'$or':_['map'](_0x4d1e8c[_0x1406('0x40')],function(_0x2db421){var _0x462f69={};_0x462f69[_0x2db421]={'$like':'%'+_0xb341fa[_0x1406('0x3d')][_0x1406('0x4a')]+'%'};return _0x462f69;})});}_0x4d1e8c=_[_0x1406('0x4b')]({},_0x4d1e8c,_0xb341fa['options']);return _0x32b373[_0x1406('0x70')](_0x4d1e8c);}})[_0x1406('0x1d')](function(_0x3b258){if(_0x3b258){_0x3caf08=_0x3b258[_0x1406('0x42')];if(!_0xb341fa['query'][_0x1406('0x43')](_0x1406('0x44'))){_0x4d1e8c[_0x1406('0x2b')]=qs[_0x1406('0x2b')](_0xb341fa['query'][_0x1406('0x2b')]);_0x4d1e8c[_0x1406('0x2a')]=qs[_0x1406('0x2a')](_0xb341fa[_0x1406('0x3d')][_0x1406('0x2a')]);}return _0x32b373['getAgents'](_0x4d1e8c);}})[_0x1406('0x1d')](function(_0x4d3ab8){if(_0x4d3ab8){return _0x4d3ab8?{'count':_0x3caf08,'rows':_0x4d3ab8}:null;}})[_0x1406('0x1d')](respondWithResult(_0x1b6238,null))[_0x1406('0x25')](handleError(_0x1b6238,null));};exports[_0x1406('0x71')]=function(_0x5ee0f4,_0x3b2593,_0x98a86a){return db[_0x1406('0x4d')][_0x1406('0x67')]({'where':{'id':_0x5ee0f4['params']['id']}})[_0x1406('0x1d')](handleEntityNotFound(_0x3b2593,null))[_0x1406('0x1d')](function(_0x383d0c){if(_0x383d0c){return db['sequelize'][_0x1406('0x72')](function(_0x29b368){return db['WhatsappApplication'][_0x1406('0x2f')]({'where':{'WhatsappAccountId':_0x5ee0f4[_0x1406('0x5b')]['id']},'transaction':_0x29b368})[_0x1406('0x1d')](function(_0x1280cb){var _0x19d3fd=_['map'](_0x5ee0f4[_0x1406('0x54')],function(_0x3f921d){_0x3f921d[_0x1406('0x5e')]=_0x5ee0f4[_0x1406('0x5b')]['id'];return _0x3f921d;});return db['WhatsappApplication'][_0x1406('0x73')](_0x19d3fd,{'transaction':_0x29b368});});})[_0x1406('0x1d')](function(){return db['WhatsappApplication'][_0x1406('0x74')]({'where':{'WhatsappAccountId':_0x5ee0f4[_0x1406('0x5b')]['id']},'order':_0x1406('0x75')});});}})['then'](respondWithResult(_0x3b2593,null))[_0x1406('0x25')](handleError(_0x3b2593,null));};exports[_0x1406('0x76')]=function(_0x1b0847,_0x766c41,_0x29461a){var _0x33a774={};var _0x4e9235={};var _0x5a8863;var _0x5d3fc8;return db[_0x1406('0x4d')]['findOne']({'where':{'id':_0x1b0847[_0x1406('0x5b')]['id']}})[_0x1406('0x1d')](handleEntityNotFound(_0x766c41,null))[_0x1406('0x1d')](function(_0x44b25d){if(_0x44b25d){_0x5a8863=_0x44b25d;_0x4e9235['model']=_[_0x1406('0x3e')](db['WhatsappApplication'][_0x1406('0x39')]);_0x4e9235[_0x1406('0x3d')]=_['keys'](_0x1b0847[_0x1406('0x3d')]);_0x4e9235[_0x1406('0x48')]=_[_0x1406('0x3f')](_0x4e9235['model'],_0x4e9235[_0x1406('0x3d')]);_0x33a774[_0x1406('0x40')]=_[_0x1406('0x3f')](_0x4e9235['model'],qs['fields'](_0x1b0847['query'][_0x1406('0x41')]));_0x33a774[_0x1406('0x40')]=_0x33a774['attributes'][_0x1406('0x42')]?_0x33a774['attributes']:_0x4e9235[_0x1406('0x3c')];_0x33a774[_0x1406('0x45')]=qs[_0x1406('0x46')](_0x1b0847[_0x1406('0x3d')][_0x1406('0x46')]);_0x33a774['where']=qs[_0x1406('0x48')](_[_0x1406('0x49')](_0x1b0847['query'],_0x4e9235[_0x1406('0x48')]));if(_0x1b0847['query'][_0x1406('0x4a')]){_0x33a774[_0x1406('0x47')]=_['merge'](_0x33a774[_0x1406('0x47')],{'$or':_[_0x1406('0x38')](_0x33a774[_0x1406('0x40')],function(_0x34f0c8){var _0x5a839e={};_0x5a839e[_0x34f0c8]={'$like':'%'+_0x1b0847[_0x1406('0x3d')]['filter']+'%'};return _0x5a839e;})});}_0x33a774=_[_0x1406('0x4b')]({},_0x33a774,_0x1b0847['options']);return _0x5a8863[_0x1406('0x76')](_0x33a774);}})[_0x1406('0x1d')](function(_0x2f2806){if(_0x2f2806){_0x5d3fc8=_0x2f2806['length'];if(!_0x1b0847[_0x1406('0x3d')]['hasOwnProperty'](_0x1406('0x44'))){_0x33a774[_0x1406('0x2b')]=qs['limit'](_0x1b0847[_0x1406('0x3d')][_0x1406('0x2b')]);_0x33a774[_0x1406('0x2a')]=qs[_0x1406('0x2a')](_0x1b0847[_0x1406('0x3d')][_0x1406('0x2a')]);}return _0x5a8863[_0x1406('0x76')](_0x33a774);}})[_0x1406('0x1d')](function(_0x5764fa){if(_0x5764fa){return _0x5764fa?{'count':_0x5d3fc8,'rows':_0x5764fa}:null;}})[_0x1406('0x1d')](respondWithResult(_0x766c41,null))[_0x1406('0x25')](handleError(_0x766c41,null));};exports[_0x1406('0x77')]=function(_0x112b3e,_0x3a5c4e,_0x16aeae){var _0x16fcfc={'channel':_0x1406('0x78')};var _0x33090e=[];var _0x212b88=[];var _0x18842d={};return db[_0x1406('0x4d')]['find']({'where':{'id':_0x112b3e[_0x1406('0x5b')]['id']},'include':[{'model':db[_0x1406('0x79')],'as':_0x1406('0x7a')}]})[_0x1406('0x1d')](handleEntityNotFound(_0x3a5c4e,null))[_0x1406('0x1d')](function(_0x4ee113){_0x16fcfc[_0x1406('0x7b')]=_0x4ee113;_0x16fcfc[_0x1406('0x7c')]=_[_0x1406('0x7d')](_0x4ee113[_0x1406('0x7a')],[_0x1406('0x75')],[_0x1406('0x7e')]);if(_0x16fcfc[_0x1406('0x7b')]['Applications']){delete _0x16fcfc[_0x1406('0x7b')][_0x1406('0x7a')];}return db[_0x1406('0x7f')][_0x1406('0x5c')]();})[_0x1406('0x1d')](function(_0xa21f0f){if(!_0xa21f0f){throw new db[(_0x1406('0x80'))][(_0x1406('0x81'))]('no\x20available\x20attributes');}_0x33090e=_[_0x1406('0x82')](_[_0x1406('0x3e')](_0xa21f0f),[_0x1406('0x83'),_0x1406('0x84')]);_0x212b88=_[_0x1406('0x82')](_[_0x1406('0x3e')](_0xa21f0f),[_0x1406('0x83'),_0x1406('0x84'),_0x1406('0x85'),_0x1406('0x86')]);_0x16fcfc[_0x1406('0x54')]={'mapKey':'mobile'};if(_0x16fcfc['account'][_0x1406('0x3a')]&&_0x16fcfc[_0x1406('0x7b')][_0x1406('0x3a')]===_0x1406('0x87')){_0x16fcfc[_0x1406('0x54')][_0x1406('0x88')]=_0x112b3e['body'][_0x1406('0x89')][_0x1406('0x8a')](_0x1406('0x8b'),'');_0x16fcfc[_0x1406('0x54')][_0x1406('0x54')]=_0x112b3e[_0x1406('0x54')][_0x1406('0x8c')];_0x16fcfc[_0x1406('0x54')][_0x1406('0x8d')]=_0x112b3e[_0x1406('0x54')]['MessageSid'];}if(_0x16fcfc['body']['id']){delete _0x16fcfc['body']['id'];}if(_[_0x1406('0x8e')](_0x16fcfc[_0x1406('0x54')][_0x1406('0x88')])){throw new db[(_0x1406('0x80'))][(_0x1406('0x81'))](_0x1406('0x8f'));}if(_[_0x1406('0x8e')](_0x16fcfc[_0x1406('0x54')]['body'])||_0x16fcfc[_0x1406('0x54')][_0x1406('0x54')]===''){throw new db[(_0x1406('0x80'))][(_0x1406('0x81'))](_0x1406('0x90'));}if(_[_0x1406('0x8e')](_0x16fcfc[_0x1406('0x54')]['mapKey'])){throw new db[(_0x1406('0x80'))][(_0x1406('0x81'))](_0x1406('0x91')+_0x212b88);}if(!_['includes'](_0x212b88,_0x16fcfc[_0x1406('0x54')][_0x1406('0x92')])){throw new db[(_0x1406('0x80'))][(_0x1406('0x81'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x212b88);}_0x18842d[_0x16fcfc[_0x1406('0x54')][_0x1406('0x92')]]=_0x16fcfc[_0x1406('0x54')][_0x1406('0x88')];return db[_0x1406('0x93')][_0x1406('0x52')]({'where':{'id':_0x16fcfc['account'][_0x1406('0x86')]},'include':[{'model':db['CmContact'],'as':_0x1406('0x94'),'where':_0x18842d,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x1406('0x1d')](handleEntityNotFound(_0x3a5c4e,null))[_0x1406('0x1d')](function(_0x157a8d){if(_0x157a8d){_0x16fcfc[_0x1406('0x95')]=_[_0x1406('0x6a')](_0x157a8d,['Contacts']);if(_0x157a8d[_0x1406('0x94')][_0x1406('0x42')]){return _0x157a8d[_0x1406('0x94')][0x0];}var _0x4493d9=_[_0x1406('0x17')](_0x16fcfc['body'],{'firstName':_0x16fcfc[_0x1406('0x54')][_0x1406('0x88')],'ListId':_0x157a8d['id']});_0x4493d9[_0x16fcfc['body'][_0x1406('0x92')]]=_0x16fcfc[_0x1406('0x54')]['from'];return db[_0x1406('0x7f')][_0x1406('0x53')](_0x4493d9,{'fields':_0x33090e,'raw':!![]});}})['then'](handleEntityNotFound(_0x3a5c4e,null))['then'](function(_0x2dbbcd){if(_0x2dbbcd){_0x16fcfc[_0x1406('0x96')]=_0x2dbbcd;var _0x18fe45={'ContactId':_0x2dbbcd['id'],'phone':_0x16fcfc[_0x1406('0x54')]['from'],'WhatsappAccountId':_0x112b3e[_0x1406('0x5b')]['id']};var _0x563598={'ContactId':_0x2dbbcd['id'],'WhatsappAccountId':_0x112b3e['params']['id'],'closed':![]};return db[_0x1406('0x97')][_0x1406('0x52')]({'where':_0x563598})[_0x1406('0x1d')](function(_0xe1ac35){if(_0xe1ac35){return[_0xe1ac35,![]];}return db[_0x1406('0x97')][_0x1406('0x53')](_0x18fe45)[_0x1406('0x1d')](function(_0xf06ef4){return[_0xf06ef4,!![]];});});}})['spread'](function(_0x3f421b,_0x29c388){_0x16fcfc[_0x1406('0x98')]=_0x3f421b['get']({'plain':!![]});_0x16fcfc[_0x1406('0x98')][_0x1406('0x99')]=![];if(_0x29c388){if(_0x16fcfc['account'][_0x1406('0x9a')]){_0x16fcfc[_0x1406('0x7c')]['push']({'id':0x0,'priority':_0x16fcfc['applications']['length']+0x1,'app':'close','appdata':_0x1406('0x9b'),'interval':'*,*,*,*'});}_0x16fcfc[_0x1406('0x98')][_0x1406('0x99')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x16fcfc[_0x1406('0x54')]['from'],'messageId':_0x16fcfc[_0x1406('0x54')][_0x1406('0x8d')],'body':_0x16fcfc[_0x1406('0x54')][_0x1406('0x54')],'WhatsappAccountId':_0x112b3e[_0x1406('0x5b')]['id'],'WhatsappInteractionId':_0x3f421b['id'],'direction':'in','ContactId':_0x3f421b[_0x1406('0x9c')],'AttachmentId':_0x16fcfc['body'][_0x1406('0x9d')]});})[_0x1406('0x1d')](function(_0x576fae){_0x16fcfc['message']=_0x576fae;if(_0x16fcfc[_0x1406('0x98')][_0x1406('0x9e')]){return db[_0x1406('0x9f')][_0x1406('0x52')]({'attributes':['id',_0x1406('0x34')],'where':{'id':_0x16fcfc[_0x1406('0x98')]['UserId']}})[_0x1406('0x1d')](function(_0x4ca8e6){if(_0x4ca8e6){_0x16fcfc[_0x1406('0x7c')][_0x1406('0xa0')]({'id':0x0,'priority':0x0,'app':_0x1406('0xa1'),'appdata':_0x4ca8e6[_0x1406('0x34')]+','+(_0x16fcfc[_0x1406('0x7b')][_0x1406('0xa2')]||0xa),'interval':_0x1406('0xa3')});}return respondWithRpcPromise(_0x1406('0xa4'),_0x1406('0xa5'),_0x16fcfc);});}return respondWithRpcPromise('Start',_0x1406('0xa5'),_0x16fcfc);})[_0x1406('0x1d')](function(_0x53f8df){if(_0x53f8df){var _0x41292a=0xc8;var _0x3437bb=_0x1406('0xa6');logger[_0x1406('0x1e')](_0x1406('0xa7'),_0x3437bb,_0x41292a,'entity\x20found');logger[_0x1406('0x20')](_0x1406('0xa8'),_0x3437bb,_0x41292a,_0x1406('0xa9'),JSON[_0x1406('0xaa')](_0x53f8df));if(_0x16fcfc[_0x1406('0x7b')]['type']===_0x1406('0x87')){return _0x3a5c4e[_0x1406('0x27')](_0x41292a)[_0x1406('0xab')](_0x1406('0xac'),_0x1406('0xad'))['send'](_0x1406('0xae'));}else{return _0x3a5c4e[_0x1406('0x27')](_0x41292a)[_0x1406('0x28')](_0x53f8df);}}})[_0x1406('0x25')](handleError(_0x3a5c4e,null));};exports['send']=function(_0x14b982,_0x4d7fa6,_0x2c964b){var _0x212003,_0x1315f2,_0x11f129;if(_[_0x1406('0x8e')](_0x14b982[_0x1406('0x54')]['body'])||_0x14b982['body']['body']===''){throw new db[(_0x1406('0x80'))][(_0x1406('0x81'))](_0x1406('0x90'));}if(_[_0x1406('0x8e')](_0x14b982[_0x1406('0x54')]['to'])){throw new db[(_0x1406('0x80'))]['ValidationError'](_0x1406('0xaf'));}_0x212003=_0x14b982[_0x1406('0x54')]['to'];return db[_0x1406('0x4d')][_0x1406('0x52')]({'where':{'id':_0x14b982['params']['id']},'include':[{'model':db[_0x1406('0x93')],'as':_0x1406('0xb0'),'include':[{'model':db['CmContact'],'as':_0x1406('0x94'),'where':{'mobile':_0x212003},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x1406('0x1d')](handleEntityNotFound(_0x4d7fa6,null))[_0x1406('0x1d')](function(_0x33e3b5){if(_0x33e3b5&&_0x33e3b5[_0x1406('0xb0')]){_0x1315f2=_0x33e3b5[_0x1406('0x30')]({'plain':!![]});if(_0x1315f2[_0x1406('0xb0')]&&_0x1315f2[_0x1406('0xb0')][_0x1406('0x94')][_0x1406('0x42')]){return _0x1315f2[_0x1406('0xb0')][_0x1406('0x94')][0x0];}return db['CmContact']['create'](_[_0x1406('0x17')](_0x14b982[_0x1406('0x54')],{'firstName':_0x212003,'mobile':_0x212003,'phone':_0x212003,'ListId':_0x1315f2[_0x1406('0x86')]}));}})['then'](handleEntityNotFound(_0x4d7fa6,null))[_0x1406('0x1d')](function(_0x5a25a4){if(_0x5a25a4){_0x11f129=_0x5a25a4;return db[_0x1406('0x97')]['find']({'where':{'ContactId':_0x11f129['id'],'closed':![],'WhatsappAccountId':_0x1315f2['id']}})[_0x1406('0x1d')](function(_0x198e00){if(_0x198e00){return[_0x198e00,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x14b982[_0x1406('0x55')]['id'],'ContactId':_0x11f129['id'],'WhatsappAccountId':_0x1315f2['id'],'phone':_0x212003,'firstMsgDirection':_0x1406('0xb1'),'Messages':[_['merge'](_0x14b982[_0x1406('0x54')],{'read':![],'body':_0x14b982['body']['body'],'phone':_0x212003,'WhatsappAccountId':_0x1315f2['id'],'UserId':_0x14b982[_0x1406('0x55')]['id'],'ContactId':_0x11f129['id']})]},{'include':[{'model':db[_0x1406('0xb2')],'as':'Messages'}]})['then'](function(_0x3c5c56){return[_0x3c5c56,!![]];});});}})[_0x1406('0x6b')](function(_0x43a479,_0x567954){if(_0x567954){return _0x43a479;}return db['WhatsappMessage'][_0x1406('0x53')](_['merge'](_0x14b982[_0x1406('0x54')],{'read':![],'body':_0x14b982[_0x1406('0x54')][_0x1406('0x54')],'phone':_0x212003,'WhatsappAccountId':_0x1315f2['id'],'WhatsappInteractionId':_0x43a479['id'],'UserId':_0x14b982[_0x1406('0x55')]['id'],'ContactId':_0x11f129['id']}))['then'](function(_0x246bb4){_0x43a479[_0x1406('0xb3')][_0x1406('0xb4')]=[];_0x43a479[_0x1406('0xb3')][_0x1406('0xb4')]['push'](_0x246bb4[_0x1406('0xb3')]);return _0x43a479;});})['then'](respondWithResult(_0x4d7fa6,null))[_0x1406('0x25')](handleError(_0x4d7fa6,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 7013e45..511d000 100644 --- a/server/api/whatsappAccount/whatsappAccount.events.js +++ b/server/api/whatsappAccount/whatsappAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8a=['../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5a9597,_0x48e55b){var _0x5b1e40=function(_0x33a42c){while(--_0x33a42c){_0x5a9597['push'](_0x5a9597['shift']());}};_0x5b1e40(++_0x48e55b);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x309a5e,_0x1ec246){_0x309a5e=_0x309a5e-0x0;var _0x1d21f1=_0x3f8a[_0x309a5e];return _0x1d21f1;};'use strict';var EventEmitter=require(_0xa3f8('0x0'));var WhatsappAccount=require(_0xa3f8('0x1'))['db'][_0xa3f8('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa3f8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa3f8('0x4'),'afterDestroy':_0xa3f8('0x5')};function emitEvent(_0x928738){return function(_0x15b6aa,_0x2553fd,_0x2847b4){WhatsappAccountEvents[_0xa3f8('0x6')](_0x928738+':'+_0x15b6aa['id'],_0x15b6aa);WhatsappAccountEvents[_0xa3f8('0x6')](_0x928738,_0x15b6aa);_0x2847b4(null);};}for(var e in events){if(events[_0xa3f8('0x7')](e)){var event=events[e];WhatsappAccount[_0xa3f8('0x8')](e,emitEvent(event));}}module[_0xa3f8('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xf61e=['hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4f43d4,_0x5c3af2){var _0x363e9c=function(_0x23b3a5){while(--_0x23b3a5){_0x4f43d4['push'](_0x4f43d4['shift']());}};_0x363e9c(++_0x5c3af2);}(_0xf61e,0x191));var _0xef61=function(_0x152c35,_0x41416b){_0x152c35=_0x152c35-0x0;var _0x2bab6a=_0xf61e[_0x152c35];return _0x2bab6a;};'use strict';var EventEmitter=require(_0xef61('0x0'));var WhatsappAccount=require(_0xef61('0x1'))['db'][_0xef61('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xef61('0x3')](0x0);var events={'afterCreate':_0xef61('0x4'),'afterUpdate':_0xef61('0x5'),'afterDestroy':_0xef61('0x6')};function emitEvent(_0x40509e){return function(_0x2bd1d0,_0x14122a,_0x239fa9){WhatsappAccountEvents[_0xef61('0x7')](_0x40509e+':'+_0x2bd1d0['id'],_0x2bd1d0);WhatsappAccountEvents['emit'](_0x40509e,_0x2bd1d0);_0x239fa9(null);};}for(var e in events){if(events[_0xef61('0x8')](e)){var event=events[e];WhatsappAccount[_0xef61('0x9')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index e98674a..89dc794 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 _0x9577=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api'];(function(_0x156b03,_0x238b09){var _0x302cc5=function(_0x5ef22e){while(--_0x5ef22e){_0x156b03['push'](_0x156b03['shift']());}};_0x302cc5(++_0x238b09);}(_0x9577,0x6c));var _0x7957=function(_0x3e0591,_0x2ad477){_0x3e0591=_0x3e0591-0x0;var _0x5712b3=_0x9577[_0x3e0591];return _0x5712b3;};'use strict';var _=require(_0x7957('0x0'));var util=require(_0x7957('0x1'));var logger=require(_0x7957('0x2'))(_0x7957('0x3'));var moment=require('moment');var BPromise=require(_0x7957('0x4'));var rp=require(_0x7957('0x5'));var fs=require('fs');var path=require(_0x7957('0x6'));var rimraf=require(_0x7957('0x7'));var config=require(_0x7957('0x8'));var attributes=require(_0x7957('0x9'));module[_0x7957('0xa')]=function(_0x11cfd7,_0x1dffda){return _0x11cfd7[_0x7957('0xb')](_0x7957('0xc'),attributes,{'tableName':_0x7957('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11d9=['api','moment','bluebird','path','rimraf','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x11d9,0x69));var _0x911d=function(_0x2e54c8,_0x5ac7fa){_0x2e54c8=_0x2e54c8-0x0;var _0x2b1f2e=_0x11d9[_0x2e54c8];return _0x2b1f2e;};'use strict';var _=require(_0x911d('0x0'));var util=require(_0x911d('0x1'));var logger=require(_0x911d('0x2'))(_0x911d('0x3'));var moment=require(_0x911d('0x4'));var BPromise=require(_0x911d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x911d('0x6'));var rimraf=require(_0x911d('0x7'));var config=require('../../config/environment');var attributes=require(_0x911d('0x8'));module[_0x911d('0x9')]=function(_0x3f5484,_0x571e8b){return _0x3f5484[_0x911d('0xa')]('WhatsappAccount',attributes,{'tableName':_0x911d('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 0a9cc58..87aeee4 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 _0x60a5=['../../config/environment','jayson/promise','client','localhost','socket.io-emitter','redis','./whatsappAccount.socket','then','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','where','attributes','include','model','map','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x60a5,0x83));var _0x560a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x60a5[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x560a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x560a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x560a('0x2'))['db'];var utils=require(_0x560a('0x3'));var logger=require(_0x560a('0x4'))('rpc');var config=require(_0x560a('0x5'));var jayson=require(_0x560a('0x6'));var client=jayson[_0x560a('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x560a('0x8'),'port':0x18eb});var socket=require(_0x560a('0x9'))(new Redis(config[_0x560a('0xa')]));require(_0x560a('0xb'))['register'](socket);function respondWithRpcPromise(_0x4c7a7a,_0x359da4,_0x5d95ee){return new BPromise(function(_0x2e3b88,_0x13c6a3){return client['request'](_0x4c7a7a,_0x5d95ee)[_0x560a('0xc')](function(_0x36e345){logger[_0x560a('0xd')](_0x560a('0xe'),_0x359da4,_0x560a('0xf'));logger[_0x560a('0x10')](_0x560a('0x11'),_0x359da4,_0x560a('0xf'),JSON[_0x560a('0x12')](_0x36e345));if(_0x36e345['error']){if(_0x36e345[_0x560a('0x13')][_0x560a('0x14')]===0x1f4){logger[_0x560a('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x359da4,_0x36e345[_0x560a('0x13')][_0x560a('0x15')]);return _0x13c6a3(_0x36e345[_0x560a('0x13')][_0x560a('0x15')]);}logger['error'](_0x560a('0xe'),_0x359da4,_0x36e345[_0x560a('0x13')][_0x560a('0x15')]);return _0x2e3b88(_0x36e345[_0x560a('0x13')]['message']);}else{logger['info'](_0x560a('0xe'),_0x359da4,_0x560a('0xf'));_0x2e3b88(_0x36e345[_0x560a('0x16')][_0x560a('0x15')]);}})['catch'](function(_0x96deb7){logger[_0x560a('0x13')](_0x560a('0xe'),_0x359da4,_0x96deb7);_0x13c6a3(_0x96deb7);});});}exports[_0x560a('0x17')]=function(_0xe9be04){var _0x4807f2=this;return new Promise(function(_0x32ff83,_0x155c2b){return db[_0x560a('0x18')][_0x560a('0x19')]({'raw':_0xe9be04[_0x560a('0x1a')]?_0xe9be04[_0x560a('0x1a')][_0x560a('0x1b')]===undefined?!![]:![]:!![],'where':_0xe9be04['options']?_0xe9be04[_0x560a('0x1a')][_0x560a('0x1c')]||null:null,'attributes':_0xe9be04[_0x560a('0x1a')]?_0xe9be04[_0x560a('0x1a')][_0x560a('0x1d')]||null:null,'include':_0xe9be04[_0x560a('0x1a')]?_0xe9be04[_0x560a('0x1a')][_0x560a('0x1e')]?_['map'](_0xe9be04['options']['include'],function(_0x306510){return{'model':db[_0x306510[_0x560a('0x1f')]],'as':_0x306510['as'],'attributes':_0x306510['attributes'],'include':_0x306510['include']?_[_0x560a('0x20')](_0x306510['include'],function(_0x405eeb){return{'model':db[_0x405eeb[_0x560a('0x1f')]],'as':_0x405eeb['as'],'attributes':_0x405eeb['attributes'],'include':_0x405eeb[_0x560a('0x1e')]?_[_0x560a('0x20')](_0x405eeb['include'],function(_0x1ddcf6){return{'model':db[_0x1ddcf6[_0x560a('0x1f')]],'as':_0x1ddcf6['as'],'attributes':_0x1ddcf6[_0x560a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x560a('0xc')](function(_0x40a668){logger['info'](_0x560a('0x17'),_0xe9be04);logger[_0x560a('0x10')]('ShowWhatsappAccount',_0xe9be04,JSON[_0x560a('0x12')](_0x40a668));_0x32ff83(_0x40a668);})[_0x560a('0x21')](function(_0xf4a166){logger[_0x560a('0x13')](_0x560a('0x17'),_0xf4a166[_0x560a('0x15')],_0xe9be04);_0x155c2b(_0x4807f2[_0x560a('0x13')](0x1f4,_0xf4a166['message']));});});}; \ No newline at end of file +var _0xd1d3=['raw','options','where','map','include','attributes','model','then','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','register','request','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1d3,0x68));var _0x3d1d=function(_0x3aa6f5,_0x22887d){_0x3aa6f5=_0x3aa6f5-0x0;var _0xfa09e1=_0xd1d3[_0x3aa6f5];return _0xfa09e1;};'use strict';var _=require('lodash');var util=require(_0x3d1d('0x0'));var moment=require(_0x3d1d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d1d('0x2'))['db'];var utils=require(_0x3d1d('0x3'));var logger=require('../../config/logger')(_0x3d1d('0x4'));var config=require(_0x3d1d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3d1d('0x6')][_0x3d1d('0x7')]({'port':0x232a});config[_0x3d1d('0x8')]=_['defaults'](config[_0x3d1d('0x8')],{'host':_0x3d1d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d1d('0x8')]));require('./whatsappAccount.socket')[_0x3d1d('0xa')](socket);function respondWithRpcPromise(_0x56154a,_0x1cb81e,_0x5d2e09){return new BPromise(function(_0x29f76e,_0x23b4a1){return client[_0x3d1d('0xb')](_0x56154a,_0x5d2e09)['then'](function(_0x553661){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1cb81e,_0x3d1d('0xc'));logger['debug'](_0x3d1d('0xd'),_0x1cb81e,_0x3d1d('0xc'),JSON['stringify'](_0x553661));if(_0x553661[_0x3d1d('0xe')]){if(_0x553661[_0x3d1d('0xe')][_0x3d1d('0xf')]===0x1f4){logger[_0x3d1d('0xe')](_0x3d1d('0x10'),_0x1cb81e,_0x553661['error'][_0x3d1d('0x11')]);return _0x23b4a1(_0x553661[_0x3d1d('0xe')][_0x3d1d('0x11')]);}logger[_0x3d1d('0xe')](_0x3d1d('0x10'),_0x1cb81e,_0x553661[_0x3d1d('0xe')][_0x3d1d('0x11')]);return _0x29f76e(_0x553661['error'][_0x3d1d('0x11')]);}else{logger[_0x3d1d('0x12')](_0x3d1d('0x10'),_0x1cb81e,_0x3d1d('0xc'));_0x29f76e(_0x553661[_0x3d1d('0x13')][_0x3d1d('0x11')]);}})[_0x3d1d('0x14')](function(_0x39da0e){logger[_0x3d1d('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x1cb81e,_0x39da0e);_0x23b4a1(_0x39da0e);});});}exports[_0x3d1d('0x15')]=function(_0x220c7b){var _0x21f6f6=this;return new Promise(function(_0x15dc5f,_0xca4143){return db[_0x3d1d('0x16')][_0x3d1d('0x17')]({'raw':_0x220c7b['options']?_0x220c7b['options'][_0x3d1d('0x18')]===undefined?!![]:![]:!![],'where':_0x220c7b[_0x3d1d('0x19')]?_0x220c7b[_0x3d1d('0x19')][_0x3d1d('0x1a')]||null:null,'attributes':_0x220c7b[_0x3d1d('0x19')]?_0x220c7b[_0x3d1d('0x19')]['attributes']||null:null,'include':_0x220c7b['options']?_0x220c7b[_0x3d1d('0x19')]['include']?_[_0x3d1d('0x1b')](_0x220c7b['options'][_0x3d1d('0x1c')],function(_0x529b33){return{'model':db[_0x529b33['model']],'as':_0x529b33['as'],'attributes':_0x529b33[_0x3d1d('0x1d')],'include':_0x529b33[_0x3d1d('0x1c')]?_[_0x3d1d('0x1b')](_0x529b33['include'],function(_0x23ef9d){return{'model':db[_0x23ef9d[_0x3d1d('0x1e')]],'as':_0x23ef9d['as'],'attributes':_0x23ef9d[_0x3d1d('0x1d')],'include':_0x23ef9d['include']?_['map'](_0x23ef9d[_0x3d1d('0x1c')],function(_0x2869a5){return{'model':db[_0x2869a5[_0x3d1d('0x1e')]],'as':_0x2869a5['as'],'attributes':_0x2869a5[_0x3d1d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d1d('0x1f')](function(_0x21f479){logger['info'](_0x3d1d('0x15'),_0x220c7b);logger['debug']('ShowWhatsappAccount',_0x220c7b,JSON['stringify'](_0x21f479));_0x15dc5f(_0x21f479);})[_0x3d1d('0x14')](function(_0x42de03){logger['error'](_0x3d1d('0x15'),_0x42de03[_0x3d1d('0x11')],_0x220c7b);_0xca4143(_0x21f6f6[_0x3d1d('0xe')](0x1f4,_0x42de03[_0x3d1d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index efdde1a..db2681b 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 _0xb3cf=['save','remove','update','emit','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x4beaca,_0x92d420){var _0x2febe4=function(_0x349e97){while(--_0x349e97){_0x4beaca['push'](_0x4beaca['shift']());}};_0x2febe4(++_0x92d420);}(_0xb3cf,0x12f));var _0xfb3c=function(_0x5a2abe,_0x8638a3){_0x5a2abe=_0x5a2abe-0x0;var _0x4b4439=_0xb3cf[_0x5a2abe];return _0x4b4439;};'use strict';var WhatsappAccountEvents=require(_0xfb3c('0x0'));var events=[_0xfb3c('0x1'),_0xfb3c('0x2'),_0xfb3c('0x3')];function createListener(_0x1cbd50,_0x73ffef){return function(_0x444fb6){_0x73ffef[_0xfb3c('0x4')](_0x1cbd50,_0x444fb6);};}function removeListener(_0x3b1a79,_0x561ac9){return function(){WhatsappAccountEvents['removeListener'](_0x3b1a79,_0x561ac9);};}exports[_0xfb3c('0x5')]=function(_0x2aea50){for(var _0x1e4eb9=0x0,_0x26da87=events[_0xfb3c('0x6')];_0x1e4eb9<_0x26da87;_0x1e4eb9++){var _0x629ba0=events[_0x1e4eb9];var _0x440b6f=createListener(_0xfb3c('0x7')+_0x629ba0,_0x2aea50);WhatsappAccountEvents['on'](_0x629ba0,_0x440b6f);}}; \ No newline at end of file +var _0x1010=['remove','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x47d501,_0x1b9cf1){var _0x36c1a9=function(_0x52c5ce){while(--_0x52c5ce){_0x47d501['push'](_0x47d501['shift']());}};_0x36c1a9(++_0x1b9cf1);}(_0x1010,0x125));var _0x0101=function(_0x10a904,_0x2bf292){_0x10a904=_0x10a904-0x0;var _0x53815a=_0x1010[_0x10a904];return _0x53815a;};'use strict';var WhatsappAccountEvents=require(_0x0101('0x0'));var events=['save',_0x0101('0x1'),'update'];function createListener(_0x2e41b8,_0x51f930){return function(_0x86954b){_0x51f930[_0x0101('0x2')](_0x2e41b8,_0x86954b);};}function removeListener(_0x11b766,_0x48fb3d){return function(){WhatsappAccountEvents[_0x0101('0x3')](_0x11b766,_0x48fb3d);};}exports[_0x0101('0x4')]=function(_0x4815b3){for(var _0x421df0=0x0,_0x5f0f30=events[_0x0101('0x5')];_0x421df0<_0x5f0f30;_0x421df0++){var _0x3b50a0=events[_0x421df0];var _0x23d7f6=createListener(_0x0101('0x6')+_0x3b50a0,_0x4815b3);WhatsappAccountEvents['on'](_0x3b50a0,_0x23d7f6);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index db9a842..6dca332 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 _0xbb63=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','path','express'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0xbb63,0xcf));var _0x3bb6=function(_0x4847bd,_0x2b322d){_0x4847bd=_0x4847bd-0x0;var _0x1ac4f9=_0xbb63[_0x4847bd];return _0x1ac4f9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3bb6('0x0'));var timeout=require('connect-timeout');var express=require(_0x3bb6('0x1'));var router=express[_0x3bb6('0x2')]();var auth=require(_0x3bb6('0x3'));var interaction=require(_0x3bb6('0x4'));var config=require(_0x3bb6('0x5'));var controller=require(_0x3bb6('0x6'));router[_0x3bb6('0x7')]('/',auth[_0x3bb6('0x8')](),controller[_0x3bb6('0x9')]);router[_0x3bb6('0x7')](_0x3bb6('0xa'),auth[_0x3bb6('0x8')](),controller[_0x3bb6('0xb')]);router[_0x3bb6('0xc')]('/',auth[_0x3bb6('0x8')](),controller[_0x3bb6('0xd')]);router[_0x3bb6('0xe')](_0x3bb6('0xa'),auth[_0x3bb6('0x8')](),controller[_0x3bb6('0xf')]);router[_0x3bb6('0x10')](_0x3bb6('0xa'),auth[_0x3bb6('0x8')](),controller[_0x3bb6('0x11')]);module[_0x3bb6('0x12')]=router; \ No newline at end of file +var _0x8e2a=['isAuthenticated','index','/:id','post','create','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8e2a,0x15d));var _0xa8e2=function(_0x23530a,_0x453807){_0x23530a=_0x23530a-0x0;var _0x3e1dfa=_0x8e2a[_0x23530a];return _0x3e1dfa;};'use strict';var multer=require(_0xa8e2('0x0'));var util=require(_0xa8e2('0x1'));var path=require(_0xa8e2('0x2'));var timeout=require(_0xa8e2('0x3'));var express=require(_0xa8e2('0x4'));var router=express[_0xa8e2('0x5')]();var auth=require(_0xa8e2('0x6'));var interaction=require(_0xa8e2('0x7'));var config=require(_0xa8e2('0x8'));var controller=require(_0xa8e2('0x9'));router[_0xa8e2('0xa')]('/',auth[_0xa8e2('0xb')](),controller[_0xa8e2('0xc')]);router[_0xa8e2('0xa')](_0xa8e2('0xd'),auth[_0xa8e2('0xb')](),controller['show']);router[_0xa8e2('0xe')]('/',auth[_0xa8e2('0xb')](),controller[_0xa8e2('0xf')]);router['put']('/:id',auth[_0xa8e2('0xb')](),controller['update']);router[_0xa8e2('0x10')](_0xa8e2('0xd'),auth[_0xa8e2('0xb')](),controller['destroy']);module[_0xa8e2('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index d75d965..17caded 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 _0xc246=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2ddb6d,_0x25d45b){var _0x56c103=function(_0x4f73c4){while(--_0x4f73c4){_0x2ddb6d['push'](_0x2ddb6d['shift']());}};_0x56c103(++_0x25d45b);}(_0xc246,0xb2));var _0x6c24=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc246[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6c24('0x0'));module[_0x6c24('0x1')]={'priority':{'type':Sequelize[_0x6c24('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6c24('0x3')],'allowNull':![],'defaultValue':_0x6c24('0x4')},'appdata':{'type':Sequelize[_0x6c24('0x5')]()},'description':{'type':Sequelize[_0x6c24('0x3')]},'interval':{'type':Sequelize[_0x6c24('0x3')],'defaultValue':_0x6c24('0x6')}}; \ No newline at end of file +var _0xa24e=['sequelize','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x3a82be,_0x5b32f9){var _0x2e4ec7=function(_0x1f28fe){while(--_0x1f28fe){_0x3a82be['push'](_0x3a82be['shift']());}};_0x2e4ec7(++_0x5b32f9);}(_0xa24e,0xc0));var _0xea24=function(_0x45228a,_0x4acbf3){_0x45228a=_0x45228a-0x0;var _0x4fbf5e=_0xa24e[_0x45228a];return _0x4fbf5e;};'use strict';var Sequelize=require(_0xea24('0x0'));module['exports']={'priority':{'type':Sequelize[_0xea24('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xea24('0x2')},'appdata':{'type':Sequelize[_0xea24('0x3')]()},'description':{'type':Sequelize[_0xea24('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xea24('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 72d3368..596fcd3 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 _0xda91=['json','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','then','includeAll','include','WhatsappApplication','findAll','rows','catch','show','params','find','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','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','../../mysqldb','sendStatus','status','end'];(function(_0x5421cc,_0x104e78){var _0x2250dc=function(_0x4b2020){while(--_0x4b2020){_0x5421cc['push'](_0x5421cc['shift']());}};_0x2250dc(++_0x104e78);}(_0xda91,0x164));var _0x1da9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xda91[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0x1da9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1da9('0x1'));var zipdir=require(_0x1da9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1da9('0x3'));var moment=require(_0x1da9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1da9('0x5'));var util=require(_0x1da9('0x6'));var path=require(_0x1da9('0x7'));var sox=require(_0x1da9('0x8'));var csv=require(_0x1da9('0x9'));var ejs=require(_0x1da9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1da9('0xb'));var crypto=require(_0x1da9('0xc'));var jsforce=require(_0x1da9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1da9('0xe'));var Papa=require('papaparse');var Redis=require(_0x1da9('0xf'));var authService=require(_0x1da9('0x10'));var qs=require(_0x1da9('0x11'));var as=require(_0x1da9('0x12'));var hardwareService=require(_0x1da9('0x13'));var logger=require(_0x1da9('0x14'))(_0x1da9('0x15'));var utils=require(_0x1da9('0x16'));var config=require(_0x1da9('0x17'));var licenseUtil=require(_0x1da9('0x18'));var db=require(_0x1da9('0x19'))['db'];function respondWithStatusCode(_0x1fae71,_0x2febdc){_0x2febdc=_0x2febdc||0xcc;return function(_0x59a59d){if(_0x59a59d){return _0x1fae71[_0x1da9('0x1a')](_0x2febdc);}return _0x1fae71[_0x1da9('0x1b')](_0x2febdc)[_0x1da9('0x1c')]();};}function respondWithResult(_0x576cd9,_0x5bc1a3){_0x5bc1a3=_0x5bc1a3||0xc8;return function(_0xdd2991){if(_0xdd2991){return _0x576cd9['status'](_0x5bc1a3)[_0x1da9('0x1d')](_0xdd2991);}};}function respondWithFilteredResult(_0x2cb8f1,_0x503e39){return function(_0x39418c){if(_0x39418c){var _0x399617=_0x39418c['count'],_0x5b7601=_0x503e39[_0x1da9('0x1e')],_0x35bf83=_0x503e39['offset']+_0x503e39[_0x1da9('0x1f')],_0x2d50a5;if(_0x35bf83>=_0x399617){_0x35bf83=_0x399617;_0x2d50a5=0xc8;}else{_0x2d50a5=0xce;}_0x2cb8f1[_0x1da9('0x1b')](_0x2d50a5);return _0x2cb8f1[_0x1da9('0x20')](_0x1da9('0x21'),_0x5b7601+'-'+_0x35bf83+'/'+_0x399617)[_0x1da9('0x1d')](_0x39418c);}return null;};}function patchUpdates(_0x1c4b19){return function(_0x354323){try{jsonpatch[_0x1da9('0x22')](_0x354323,_0x1c4b19,!![]);}catch(_0x146195){return BPromise['reject'](_0x146195);}return _0x354323['save']();};}function saveUpdates(_0x84362e,_0x5f8888){return function(_0x33a09c){if(_0x33a09c){return _0x33a09c[_0x1da9('0x23')](_0x84362e)['then'](function(_0x379bea){return _0x379bea;});}return null;};}function removeEntity(_0x7be7e7,_0x4279ee){return function(_0x3a845d){if(_0x3a845d){return _0x3a845d[_0x1da9('0x24')]()['then'](function(){_0x7be7e7[_0x1da9('0x1b')](0xcc)[_0x1da9('0x1c')]();});}};}function handleEntityNotFound(_0x290d71,_0x3cf207){return function(_0x28e541){if(!_0x28e541){_0x290d71[_0x1da9('0x1a')](0x194);}return _0x28e541;};}function handleError(_0x392f19,_0x5196e9){_0x5196e9=_0x5196e9||0x1f4;return function(_0x5050a5){logger[_0x1da9('0x25')](_0x5050a5[_0x1da9('0x26')]);if(_0x5050a5[_0x1da9('0x27')]){delete _0x5050a5[_0x1da9('0x27')];}_0x392f19[_0x1da9('0x1b')](_0x5196e9)[_0x1da9('0x28')](_0x5050a5);};}exports[_0x1da9('0x29')]=function(_0x34907b,_0x293b65){var _0x18f2b3={},_0x36644c={},_0xb7a28f={'count':0x0,'rows':[]};var _0xda788e=_[_0x1da9('0x2a')](db['WhatsappApplication'][_0x1da9('0x2b')],function(_0xed4c36){return{'name':_0xed4c36[_0x1da9('0x2c')],'type':_0xed4c36['type'][_0x1da9('0x2d')]};});_0x36644c[_0x1da9('0x2e')]=_[_0x1da9('0x2a')](_0xda788e,_0x1da9('0x27'));_0x36644c[_0x1da9('0x2f')]=_[_0x1da9('0x30')](_0x34907b['query']);_0x36644c[_0x1da9('0x31')]=_['intersection'](_0x36644c[_0x1da9('0x2e')],_0x36644c[_0x1da9('0x2f')]);_0x18f2b3['attributes']=_[_0x1da9('0x32')](_0x36644c[_0x1da9('0x2e')],qs[_0x1da9('0x33')](_0x34907b[_0x1da9('0x2f')][_0x1da9('0x33')]));_0x18f2b3['attributes']=_0x18f2b3['attributes'][_0x1da9('0x34')]?_0x18f2b3[_0x1da9('0x35')]:_0x36644c['model'];if(!_0x34907b[_0x1da9('0x2f')]['hasOwnProperty'](_0x1da9('0x36'))){_0x18f2b3[_0x1da9('0x1f')]=qs[_0x1da9('0x1f')](_0x34907b['query'][_0x1da9('0x1f')]);_0x18f2b3[_0x1da9('0x1e')]=qs['offset'](_0x34907b[_0x1da9('0x2f')][_0x1da9('0x1e')]);}_0x18f2b3[_0x1da9('0x37')]=qs[_0x1da9('0x38')](_0x34907b[_0x1da9('0x2f')][_0x1da9('0x38')]);_0x18f2b3[_0x1da9('0x39')]=qs[_0x1da9('0x31')](_[_0x1da9('0x3a')](_0x34907b['query'],_0x36644c[_0x1da9('0x31')]),_0xda788e);if(_0x34907b[_0x1da9('0x2f')][_0x1da9('0x3b')]){_0x18f2b3['where']=_['merge'](_0x18f2b3[_0x1da9('0x39')],{'$or':_['map'](_0xda788e,function(_0x343790){if(_0x343790[_0x1da9('0x3c')]!==_0x1da9('0x3d')){var _0x8b4a70={};_0x8b4a70[_0x343790[_0x1da9('0x27')]]={'$like':'%'+_0x34907b[_0x1da9('0x2f')][_0x1da9('0x3b')]+'%'};return _0x8b4a70;}})});}_0x18f2b3=_[_0x1da9('0x3e')]({},_0x18f2b3,_0x34907b[_0x1da9('0x3f')]);var _0x1f8bd0={'where':_0x18f2b3[_0x1da9('0x39')]};return db['WhatsappApplication'][_0x1da9('0x40')](_0x1f8bd0)[_0x1da9('0x41')](function(_0x45f7c7){_0xb7a28f[_0x1da9('0x40')]=_0x45f7c7;if(_0x34907b[_0x1da9('0x2f')][_0x1da9('0x42')]){_0x18f2b3[_0x1da9('0x43')]=[{'all':!![]}];}return db[_0x1da9('0x44')][_0x1da9('0x45')](_0x18f2b3);})[_0x1da9('0x41')](function(_0x5c97dd){_0xb7a28f[_0x1da9('0x46')]=_0x5c97dd;return _0xb7a28f;})[_0x1da9('0x41')](respondWithFilteredResult(_0x293b65,_0x18f2b3))[_0x1da9('0x47')](handleError(_0x293b65,null));};exports[_0x1da9('0x48')]=function(_0x16ed78,_0x556df3){var _0x5a565c={'raw':!![],'where':{'id':_0x16ed78[_0x1da9('0x49')]['id']}},_0x239d01={};_0x239d01[_0x1da9('0x2e')]=_[_0x1da9('0x30')](db['WhatsappApplication'][_0x1da9('0x2b')]);_0x239d01['query']=_['keys'](_0x16ed78['query']);_0x239d01['filters']=_[_0x1da9('0x32')](_0x239d01[_0x1da9('0x2e')],_0x239d01['query']);_0x5a565c['attributes']=_[_0x1da9('0x32')](_0x239d01[_0x1da9('0x2e')],qs[_0x1da9('0x33')](_0x16ed78[_0x1da9('0x2f')][_0x1da9('0x33')]));_0x5a565c[_0x1da9('0x35')]=_0x5a565c[_0x1da9('0x35')][_0x1da9('0x34')]?_0x5a565c[_0x1da9('0x35')]:_0x239d01['model'];if(_0x16ed78[_0x1da9('0x2f')][_0x1da9('0x42')]){_0x5a565c['include']=[{'all':!![]}];}_0x5a565c=_[_0x1da9('0x3e')]({},_0x5a565c,_0x16ed78[_0x1da9('0x3f')]);return db[_0x1da9('0x44')][_0x1da9('0x4a')](_0x5a565c)[_0x1da9('0x41')](handleEntityNotFound(_0x556df3,null))[_0x1da9('0x41')](respondWithResult(_0x556df3,null))[_0x1da9('0x47')](handleError(_0x556df3,null));};exports[_0x1da9('0x4b')]=function(_0x55c0fc,_0x8b56a6){return db[_0x1da9('0x44')][_0x1da9('0x4b')](_0x55c0fc[_0x1da9('0x4c')],{})[_0x1da9('0x41')](respondWithResult(_0x8b56a6,0xc9))[_0x1da9('0x47')](handleError(_0x8b56a6,null));};exports['update']=function(_0x7f0f62,_0x47f60c){if(_0x7f0f62['body']['id']){delete _0x7f0f62[_0x1da9('0x4c')]['id'];}return db[_0x1da9('0x44')][_0x1da9('0x4a')]({'where':{'id':_0x7f0f62[_0x1da9('0x49')]['id']}})[_0x1da9('0x41')](handleEntityNotFound(_0x47f60c,null))[_0x1da9('0x41')](saveUpdates(_0x7f0f62[_0x1da9('0x4c')],null))['then'](respondWithResult(_0x47f60c,null))[_0x1da9('0x47')](handleError(_0x47f60c,null));};exports['destroy']=function(_0x17262c,_0x2203c7){return db[_0x1da9('0x44')]['find']({'where':{'id':_0x17262c['params']['id']}})[_0x1da9('0x41')](handleEntityNotFound(_0x2203c7,null))[_0x1da9('0x41')](removeEntity(_0x2203c7,null))['catch'](handleError(_0x2203c7,null));}; \ No newline at end of file +var _0x9700=['query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','map','WhatsappApplication','rawAttributes','key','keys'];(function(_0x42b90f,_0x127e5e){var _0x5e3edc=function(_0x558107){while(--_0x558107){_0x42b90f['push'](_0x42b90f['shift']());}};_0x5e3edc(++_0x127e5e);}(_0x9700,0xfd));var _0x0970=function(_0x2edc4a,_0x4fc422){_0x2edc4a=_0x2edc4a-0x0;var _0xa8cb96=_0x9700[_0x2edc4a];return _0xa8cb96;};'use strict';var pdf=require(_0x0970('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0970('0x1'));var zipdir=require(_0x0970('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0970('0x3'));var moment=require(_0x0970('0x4'));var BPromise=require(_0x0970('0x5'));var Mustache=require('mustache');var util=require(_0x0970('0x6'));var path=require(_0x0970('0x7'));var sox=require(_0x0970('0x8'));var csv=require(_0x0970('0x9'));var ejs=require(_0x0970('0xa'));var fs=require('fs');var _=require(_0x0970('0xb'));var squel=require('squel');var crypto=require(_0x0970('0xc'));var jsforce=require(_0x0970('0xd'));var deskjs=require(_0x0970('0xe'));var toCsv=require(_0x0970('0x9'));var querystring=require(_0x0970('0xf'));var Papa=require(_0x0970('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0970('0x11'));var hardwareService=require(_0x0970('0x12'));var logger=require(_0x0970('0x13'))(_0x0970('0x14'));var utils=require(_0x0970('0x15'));var config=require(_0x0970('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0970('0x17'))['db'];function respondWithStatusCode(_0x351fda,_0x30bd69){_0x30bd69=_0x30bd69||0xcc;return function(_0x47e826){if(_0x47e826){return _0x351fda[_0x0970('0x18')](_0x30bd69);}return _0x351fda['status'](_0x30bd69)['end']();};}function respondWithResult(_0x328128,_0x47b82b){_0x47b82b=_0x47b82b||0xc8;return function(_0x98f0d9){if(_0x98f0d9){return _0x328128[_0x0970('0x19')](_0x47b82b)[_0x0970('0x1a')](_0x98f0d9);}};}function respondWithFilteredResult(_0x3267f8,_0x5cd835){return function(_0x408a5c){if(_0x408a5c){var _0x5c95b0=_0x408a5c[_0x0970('0x1b')],_0x28ca8e=_0x5cd835['offset'],_0x5b0380=_0x5cd835[_0x0970('0x1c')]+_0x5cd835[_0x0970('0x1d')],_0x310543;if(_0x5b0380>=_0x5c95b0){_0x5b0380=_0x5c95b0;_0x310543=0xc8;}else{_0x310543=0xce;}_0x3267f8[_0x0970('0x19')](_0x310543);return _0x3267f8[_0x0970('0x1e')](_0x0970('0x1f'),_0x28ca8e+'-'+_0x5b0380+'/'+_0x5c95b0)[_0x0970('0x1a')](_0x408a5c);}return null;};}function patchUpdates(_0x2b7c68){return function(_0x533735){try{jsonpatch[_0x0970('0x20')](_0x533735,_0x2b7c68,!![]);}catch(_0x4ba25e){return BPromise[_0x0970('0x21')](_0x4ba25e);}return _0x533735['save']();};}function saveUpdates(_0x4c62e7,_0x32a3fe){return function(_0x2485e6){if(_0x2485e6){return _0x2485e6[_0x0970('0x22')](_0x4c62e7)['then'](function(_0x58ef55){return _0x58ef55;});}return null;};}function removeEntity(_0x132848,_0xb49958){return function(_0x1f7467){if(_0x1f7467){return _0x1f7467[_0x0970('0x23')]()[_0x0970('0x24')](function(){_0x132848['status'](0xcc)[_0x0970('0x25')]();});}};}function handleEntityNotFound(_0x5e9684,_0x3bb07b){return function(_0x2dc0ce){if(!_0x2dc0ce){_0x5e9684[_0x0970('0x18')](0x194);}return _0x2dc0ce;};}function handleError(_0x474c20,_0x51d596){_0x51d596=_0x51d596||0x1f4;return function(_0x3fcb84){logger[_0x0970('0x26')](_0x3fcb84[_0x0970('0x27')]);if(_0x3fcb84['name']){delete _0x3fcb84[_0x0970('0x28')];}_0x474c20[_0x0970('0x19')](_0x51d596)[_0x0970('0x29')](_0x3fcb84);};}exports['index']=function(_0x5a5c85,_0x5b1c71){var _0x24404c={},_0x39f721={},_0x38b446={'count':0x0,'rows':[]};var _0x3bdd90=_[_0x0970('0x2a')](db[_0x0970('0x2b')][_0x0970('0x2c')],function(_0x377eb2){return{'name':_0x377eb2['fieldName'],'type':_0x377eb2['type'][_0x0970('0x2d')]};});_0x39f721['model']=_[_0x0970('0x2a')](_0x3bdd90,_0x0970('0x28'));_0x39f721['query']=_[_0x0970('0x2e')](_0x5a5c85[_0x0970('0x2f')]);_0x39f721['filters']=_[_0x0970('0x30')](_0x39f721[_0x0970('0x31')],_0x39f721[_0x0970('0x2f')]);_0x24404c[_0x0970('0x32')]=_[_0x0970('0x30')](_0x39f721[_0x0970('0x31')],qs[_0x0970('0x33')](_0x5a5c85[_0x0970('0x2f')]['fields']));_0x24404c[_0x0970('0x32')]=_0x24404c['attributes'][_0x0970('0x34')]?_0x24404c['attributes']:_0x39f721[_0x0970('0x31')];if(!_0x5a5c85[_0x0970('0x2f')][_0x0970('0x35')](_0x0970('0x36'))){_0x24404c['limit']=qs[_0x0970('0x1d')](_0x5a5c85[_0x0970('0x2f')][_0x0970('0x1d')]);_0x24404c[_0x0970('0x1c')]=qs['offset'](_0x5a5c85['query'][_0x0970('0x1c')]);}_0x24404c[_0x0970('0x37')]=qs[_0x0970('0x38')](_0x5a5c85[_0x0970('0x2f')]['sort']);_0x24404c['where']=qs[_0x0970('0x39')](_[_0x0970('0x3a')](_0x5a5c85['query'],_0x39f721['filters']),_0x3bdd90);if(_0x5a5c85[_0x0970('0x2f')][_0x0970('0x3b')]){_0x24404c[_0x0970('0x3c')]=_[_0x0970('0x3d')](_0x24404c[_0x0970('0x3c')],{'$or':_['map'](_0x3bdd90,function(_0x3175b4){if(_0x3175b4[_0x0970('0x3e')]!==_0x0970('0x3f')){var _0x4f454a={};_0x4f454a[_0x3175b4['name']]={'$like':'%'+_0x5a5c85['query']['filter']+'%'};return _0x4f454a;}})});}_0x24404c=_[_0x0970('0x3d')]({},_0x24404c,_0x5a5c85[_0x0970('0x40')]);var _0x481bd4={'where':_0x24404c[_0x0970('0x3c')]};return db['WhatsappApplication'][_0x0970('0x1b')](_0x481bd4)[_0x0970('0x24')](function(_0x71aa4a){_0x38b446[_0x0970('0x1b')]=_0x71aa4a;if(_0x5a5c85[_0x0970('0x2f')][_0x0970('0x41')]){_0x24404c[_0x0970('0x42')]=[{'all':!![]}];}return db[_0x0970('0x2b')][_0x0970('0x43')](_0x24404c);})[_0x0970('0x24')](function(_0x191633){_0x38b446[_0x0970('0x44')]=_0x191633;return _0x38b446;})[_0x0970('0x24')](respondWithFilteredResult(_0x5b1c71,_0x24404c))[_0x0970('0x45')](handleError(_0x5b1c71,null));};exports[_0x0970('0x46')]=function(_0x50835f,_0x2ff00e){var _0x373a37={'raw':!![],'where':{'id':_0x50835f[_0x0970('0x47')]['id']}},_0x10402d={};_0x10402d[_0x0970('0x31')]=_[_0x0970('0x2e')](db[_0x0970('0x2b')][_0x0970('0x2c')]);_0x10402d[_0x0970('0x2f')]=_[_0x0970('0x2e')](_0x50835f[_0x0970('0x2f')]);_0x10402d[_0x0970('0x39')]=_[_0x0970('0x30')](_0x10402d[_0x0970('0x31')],_0x10402d[_0x0970('0x2f')]);_0x373a37[_0x0970('0x32')]=_['intersection'](_0x10402d['model'],qs[_0x0970('0x33')](_0x50835f['query'][_0x0970('0x33')]));_0x373a37['attributes']=_0x373a37['attributes'][_0x0970('0x34')]?_0x373a37[_0x0970('0x32')]:_0x10402d[_0x0970('0x31')];if(_0x50835f['query'][_0x0970('0x41')]){_0x373a37[_0x0970('0x42')]=[{'all':!![]}];}_0x373a37=_[_0x0970('0x3d')]({},_0x373a37,_0x50835f[_0x0970('0x40')]);return db[_0x0970('0x2b')]['find'](_0x373a37)[_0x0970('0x24')](handleEntityNotFound(_0x2ff00e,null))[_0x0970('0x24')](respondWithResult(_0x2ff00e,null))['catch'](handleError(_0x2ff00e,null));};exports[_0x0970('0x48')]=function(_0x3e9bb4,_0x278687){return db[_0x0970('0x2b')][_0x0970('0x48')](_0x3e9bb4[_0x0970('0x49')],{})[_0x0970('0x24')](respondWithResult(_0x278687,0xc9))[_0x0970('0x45')](handleError(_0x278687,null));};exports['update']=function(_0x56eb74,_0x436c14){if(_0x56eb74['body']['id']){delete _0x56eb74[_0x0970('0x49')]['id'];}return db[_0x0970('0x2b')][_0x0970('0x4a')]({'where':{'id':_0x56eb74['params']['id']}})[_0x0970('0x24')](handleEntityNotFound(_0x436c14,null))[_0x0970('0x24')](saveUpdates(_0x56eb74[_0x0970('0x49')],null))[_0x0970('0x24')](respondWithResult(_0x436c14,null))['catch'](handleError(_0x436c14,null));};exports['destroy']=function(_0x50e83d,_0x271fc2){return db[_0x0970('0x2b')][_0x0970('0x4a')]({'where':{'id':_0x50e83d[_0x0970('0x47')]['id']}})['then'](handleEntityNotFound(_0x271fc2,null))[_0x0970('0x24')](removeEntity(_0x271fc2,null))['catch'](handleError(_0x271fc2,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index f928937..ff93f03 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 _0x7ab1=['bluebird','request-promise','path','rimraf','../../config/environment','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3d6bd9,_0x577251){var _0x43f2f8=function(_0x451870){while(--_0x451870){_0x3d6bd9['push'](_0x3d6bd9['shift']());}};_0x43f2f8(++_0x577251);}(_0x7ab1,0x15d));var _0x17ab=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x7ab1[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x17ab('0x0'));var util=require(_0x17ab('0x1'));var logger=require(_0x17ab('0x2'))('api');var moment=require('moment');var BPromise=require(_0x17ab('0x3'));var rp=require(_0x17ab('0x4'));var fs=require('fs');var path=require(_0x17ab('0x5'));var rimraf=require(_0x17ab('0x6'));var config=require(_0x17ab('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x3d6401,_0x1e45a3){return _0x3d6401['define'](_0x17ab('0x8'),attributes,{'tableName':_0x17ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x17ab('0xa')});}; \ No newline at end of file +var _0xd126=['path','../../config/environment','./whatsappApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise'];(function(_0x2764ba,_0x4807d7){var _0x88c8d7=function(_0x57bf79){while(--_0x57bf79){_0x2764ba['push'](_0x2764ba['shift']());}};_0x88c8d7(++_0x4807d7);}(_0xd126,0x1f3));var _0x6d12=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0xd126[_0x3b1b23];return _0x1efc85;};'use strict';var _=require(_0x6d12('0x0'));var util=require(_0x6d12('0x1'));var logger=require('../../config/logger')(_0x6d12('0x2'));var moment=require('moment');var BPromise=require(_0x6d12('0x3'));var rp=require(_0x6d12('0x4'));var fs=require('fs');var path=require(_0x6d12('0x5'));var rimraf=require('rimraf');var config=require(_0x6d12('0x6'));var attributes=require(_0x6d12('0x7'));module[_0x6d12('0x8')]=function(_0x16a90f,_0x1cb3bd){return _0x16a90f[_0x6d12('0x9')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6d12('0xa'),'collate':_0x6d12('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 34b7a6b..0be26e7 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 _0xe6e9=['WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x38acb7,_0x249695){var _0x306cbd=function(_0x320157){while(--_0x320157){_0x38acb7['push'](_0x38acb7['shift']());}};_0x306cbd(++_0x249695);}(_0xe6e9,0x182));var _0x9e6e=function(_0x46aa3d,_0x5a170a){_0x46aa3d=_0x46aa3d-0x0;var _0x371ff=_0xe6e9[_0x46aa3d];return _0x371ff;};'use strict';var _=require(_0x9e6e('0x0'));var util=require(_0x9e6e('0x1'));var moment=require(_0x9e6e('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e6e('0x3'));var fs=require('fs');var Redis=require(_0x9e6e('0x4'));var db=require(_0x9e6e('0x5'))['db'];var utils=require(_0x9e6e('0x6'));var logger=require(_0x9e6e('0x7'))('rpc');var config=require(_0x9e6e('0x8'));var jayson=require(_0x9e6e('0x9'));var client=jayson[_0x9e6e('0xa')][_0x9e6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x174aaa,_0x5eda3e,_0x165666){return new BPromise(function(_0x2bf742,_0x2b8c88){return client[_0x9e6e('0xc')](_0x174aaa,_0x165666)[_0x9e6e('0xd')](function(_0x42b7ed){logger['info'](_0x9e6e('0xe'),_0x5eda3e,_0x9e6e('0xf'));logger[_0x9e6e('0x10')](_0x9e6e('0x11'),_0x5eda3e,'request\x20sent',JSON[_0x9e6e('0x12')](_0x42b7ed));if(_0x42b7ed[_0x9e6e('0x13')]){if(_0x42b7ed['error'][_0x9e6e('0x14')]===0x1f4){logger[_0x9e6e('0x13')](_0x9e6e('0xe'),_0x5eda3e,_0x42b7ed[_0x9e6e('0x13')]['message']);return _0x2b8c88(_0x42b7ed[_0x9e6e('0x13')][_0x9e6e('0x15')]);}logger[_0x9e6e('0x13')](_0x9e6e('0xe'),_0x5eda3e,_0x42b7ed[_0x9e6e('0x13')][_0x9e6e('0x15')]);return _0x2bf742(_0x42b7ed[_0x9e6e('0x13')][_0x9e6e('0x15')]);}else{logger[_0x9e6e('0x16')](_0x9e6e('0xe'),_0x5eda3e,_0x9e6e('0xf'));_0x2bf742(_0x42b7ed[_0x9e6e('0x17')][_0x9e6e('0x15')]);}})[_0x9e6e('0x18')](function(_0x452bc3){logger[_0x9e6e('0x13')](_0x9e6e('0xe'),_0x5eda3e,_0x452bc3);_0x2b8c88(_0x452bc3);});});} \ No newline at end of file +var _0xaa3f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','WhatsappApplication,\x20%s,\x20%s','catch','lodash','util'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x6268f,_0x615136){_0x6268f=_0x6268f-0x0;var _0x3c3bd3=_0xaa3f[_0x6268f];return _0x3c3bd3;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var moment=require(_0xfaa3('0x2'));var BPromise=require(_0xfaa3('0x3'));var rs=require(_0xfaa3('0x4'));var fs=require('fs');var Redis=require(_0xfaa3('0x5'));var db=require(_0xfaa3('0x6'))['db'];var utils=require(_0xfaa3('0x7'));var logger=require(_0xfaa3('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfaa3('0x9'));var client=jayson['client'][_0xfaa3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeecce5,_0x352958,_0xbf270c){return new BPromise(function(_0x328d5f,_0x2e422d){return client[_0xfaa3('0xb')](_0xeecce5,_0xbf270c)['then'](function(_0x37bcd5){logger[_0xfaa3('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x352958,'request\x20sent');logger[_0xfaa3('0xd')](_0xfaa3('0xe'),_0x352958,_0xfaa3('0xf'),JSON[_0xfaa3('0x10')](_0x37bcd5));if(_0x37bcd5[_0xfaa3('0x11')]){if(_0x37bcd5[_0xfaa3('0x11')]['code']===0x1f4){logger[_0xfaa3('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x352958,_0x37bcd5[_0xfaa3('0x11')][_0xfaa3('0x12')]);return _0x2e422d(_0x37bcd5[_0xfaa3('0x11')]['message']);}logger[_0xfaa3('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x352958,_0x37bcd5[_0xfaa3('0x11')][_0xfaa3('0x12')]);return _0x328d5f(_0x37bcd5[_0xfaa3('0x11')][_0xfaa3('0x12')]);}else{logger[_0xfaa3('0xc')](_0xfaa3('0x13'),_0x352958,'request\x20sent');_0x328d5f(_0x37bcd5['result'][_0xfaa3('0x12')]);}})[_0xfaa3('0x14')](function(_0x407384){logger[_0xfaa3('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x352958,_0x407384);_0x2e422d(_0x407384);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 87a9fdc..2f0935a 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 _0x90a2=['isAuthenticated','get','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller'];(function(_0x211e36,_0x380138){var _0x34bf8d=function(_0x252ae0){while(--_0x252ae0){_0x211e36['push'](_0x211e36['shift']());}};_0x34bf8d(++_0x380138);}(_0x90a2,0x7c));var _0x290a=function(_0xd2fc1b,_0x4df384){_0xd2fc1b=_0xd2fc1b-0x0;var _0x47ede7=_0x90a2[_0xd2fc1b];return _0x47ede7;};'use strict';var multer=require('multer');var util=require(_0x290a('0x0'));var path=require('path');var timeout=require(_0x290a('0x1'));var express=require(_0x290a('0x2'));var router=express[_0x290a('0x3')]();var auth=require(_0x290a('0x4'));var interaction=require(_0x290a('0x5'));var config=require(_0x290a('0x6'));var controller=require(_0x290a('0x7'));router['get']('/',auth[_0x290a('0x8')](),controller['index']);router[_0x290a('0x9')](_0x290a('0xa'),auth[_0x290a('0x8')](),controller['describe']);router[_0x290a('0x9')](_0x290a('0xb'),auth[_0x290a('0x8')](),controller[_0x290a('0xc')]);router[_0x290a('0x9')](_0x290a('0xd'),auth['isAuthenticated'](),controller[_0x290a('0xe')]);router['get'](_0x290a('0xf'),auth[_0x290a('0x8')](),controller[_0x290a('0x10')]);router['post']('/',auth[_0x290a('0x8')](),controller[_0x290a('0x11')]);router[_0x290a('0x12')](_0x290a('0xd'),auth[_0x290a('0x8')](),controller[_0x290a('0x13')]);router[_0x290a('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x290a('0x14')]('whatsapp',_0x290a('0x15')),controller[_0x290a('0x16')]);router[_0x290a('0x17')](_0x290a('0xb'),auth[_0x290a('0x8')](),interaction[_0x290a('0x14')](_0x290a('0x18'),_0x290a('0x19')),controller[_0x290a('0x1a')]);router[_0x290a('0x1b')](_0x290a('0xb'),auth[_0x290a('0x8')](),interaction[_0x290a('0x14')](_0x290a('0x18'),_0x290a('0x1c')),controller[_0x290a('0x1d')]);router[_0x290a('0x1b')](_0x290a('0x1e'),auth[_0x290a('0x8')](),controller[_0x290a('0x1f')]);module[_0x290a('0x20')]=router; \ No newline at end of file +var _0xaee0=['../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','whatsapp','addTags','put','tracked','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaee0,0x1ab));var _0x0aee=function(_0x4e1bd3,_0xda464d){_0x4e1bd3=_0x4e1bd3-0x0;var _0x234e83=_0xaee0[_0x4e1bd3];return _0x234e83;};'use strict';var multer=require(_0x0aee('0x0'));var util=require(_0x0aee('0x1'));var path=require(_0x0aee('0x2'));var timeout=require(_0x0aee('0x3'));var express=require(_0x0aee('0x4'));var router=express[_0x0aee('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0aee('0x6'));var config=require(_0x0aee('0x7'));var controller=require(_0x0aee('0x8'));router[_0x0aee('0x9')]('/',auth[_0x0aee('0xa')](),controller[_0x0aee('0xb')]);router['get'](_0x0aee('0xc'),auth[_0x0aee('0xa')](),controller['describe']);router[_0x0aee('0x9')](_0x0aee('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0aee('0x9')](_0x0aee('0xe'),auth[_0x0aee('0xa')](),controller[_0x0aee('0xf')]);router['get'](_0x0aee('0x10'),auth[_0x0aee('0xa')](),controller[_0x0aee('0x11')]);router[_0x0aee('0x12')]('/',auth[_0x0aee('0xa')](),controller[_0x0aee('0x13')]);router['post'](_0x0aee('0xe'),auth['isAuthenticated'](),controller[_0x0aee('0x14')]);router[_0x0aee('0x12')](_0x0aee('0x15'),auth[_0x0aee('0xa')](),interaction['tracked'](_0x0aee('0x16'),'whatsappinteraction:addtags'),controller[_0x0aee('0x17')]);router[_0x0aee('0x18')](_0x0aee('0xd'),auth[_0x0aee('0xa')](),interaction[_0x0aee('0x19')](_0x0aee('0x16'),_0x0aee('0x1a')),controller[_0x0aee('0x1b')]);router['delete'](_0x0aee('0xd'),auth[_0x0aee('0xa')](),interaction[_0x0aee('0x19')](_0x0aee('0x16'),_0x0aee('0x1c')),controller[_0x0aee('0x1d')]);router[_0x0aee('0x1e')](_0x0aee('0x15'),auth[_0x0aee('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 797b168..c39df9d 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 _0x3306=['moment','exports','BOOLEAN','STRING','ENUM','out','DATE','sequelize'];(function(_0x5a950d,_0x41fc9b){var _0x31c239=function(_0x277509){while(--_0x277509){_0x5a950d['push'](_0x5a950d['shift']());}};_0x31c239(++_0x41fc9b);}(_0x3306,0x107));var _0x6330=function(_0x5a7414,_0x11fda7){_0x5a7414=_0x5a7414-0x0;var _0x192640=_0x3306[_0x5a7414];return _0x192640;};'use strict';var Sequelize=require(_0x6330('0x0'));var moment=require(_0x6330('0x1'));module[_0x6330('0x2')]={'closed':{'type':Sequelize[_0x6330('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6330('0x4')]},'secondDisposition':{'type':Sequelize[_0x6330('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6330('0x4')]},'note':{'type':Sequelize[_0x6330('0x4')]},'phone':{'type':Sequelize[_0x6330('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6330('0x5')]('in',_0x6330('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6330('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x6330('0x5')]('in',_0x6330('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x7b3d=['out','ENUM','sequelize','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x2f03b9,_0x478c16){var _0x458ffc=function(_0xb7a906){while(--_0xb7a906){_0x2f03b9['push'](_0x2f03b9['shift']());}};_0x458ffc(++_0x478c16);}(_0x7b3d,0x1ca));var _0xd7b3=function(_0x2e7a42,_0x2ff4f6){_0x2e7a42=_0x2e7a42-0x0;var _0x205404=_0x7b3d[_0x2e7a42];return _0x205404;};'use strict';var Sequelize=require(_0xd7b3('0x0'));var moment=require(_0xd7b3('0x1'));module[_0xd7b3('0x2')]={'closed':{'type':Sequelize[_0xd7b3('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd7b3('0x4')]},'secondDisposition':{'type':Sequelize[_0xd7b3('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xd7b3('0x4')]},'read1stAt':{'type':Sequelize[_0xd7b3('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd7b3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd7b3('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xd7b3('0x7')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ebff123..b98f48d 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 _0x6d38=['root','tmp','join','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','direction','read','WhatsappAccount','Account','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\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','Owner','N.A.','closed','closedAt','Messages','existsSync','createReadStream','pipe','out','secret','renderFile','views','toFile','err','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json','offset','limit','Content-Range','save','update','then','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','pick','select','field','color','tools_tags','u.fullname','ui.WhatsappInteractionId','from','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','whatsapp_accounts','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','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','keys','some','compact','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`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','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','i.WhatsappAccountId\x20IS\x20NULL','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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','params','include','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','sort','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','addTags','setTags','spread','whatsappInteractionTags:save','removeTags','download','unix'];(function(_0x56d7f7,_0x1afa6e){var _0x5a9735=function(_0x43c262){while(--_0x43c262){_0x56d7f7['push'](_0x56d7f7['shift']());}};_0x5a9735(++_0x1afa6e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x6d38[_0x580576];return _0x3f55a0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x86d3('0x0'));var rimraf=require(_0x86d3('0x1'));var zipdir=require(_0x86d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x86d3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x86d3('0x4'));var util=require(_0x86d3('0x5'));var path=require(_0x86d3('0x6'));var sox=require('sox');var csv=require(_0x86d3('0x7'));var ejs=require(_0x86d3('0x8'));var fs=require('fs');var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0x7'));var querystring=require(_0x86d3('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xd'));var qs=require(_0x86d3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0xf'))(_0x86d3('0x10'));var utils=require('../../config/utils');var config=require(_0x86d3('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x12'))['db'];config[_0x86d3('0x13')]=_[_0x86d3('0x14')](config[_0x86d3('0x13')],{'host':_0x86d3('0x15'),'port':0x18eb});var socket=require(_0x86d3('0x16'))(new Redis(config[_0x86d3('0x13')]));require(_0x86d3('0x17'))['register'](socket);function respondWithStatusCode(_0x1c1ba8,_0x1f35cf){_0x1f35cf=_0x1f35cf||0xcc;return function(_0x356e7d){if(_0x356e7d){return _0x1c1ba8[_0x86d3('0x18')](_0x1f35cf);}return _0x1c1ba8[_0x86d3('0x19')](_0x1f35cf)[_0x86d3('0x1a')]();};}function respondWithResult(_0x1ff008,_0x44436d){_0x44436d=_0x44436d||0xc8;return function(_0x53b437){if(_0x53b437){return _0x1ff008[_0x86d3('0x19')](_0x44436d)[_0x86d3('0x1b')](_0x53b437);}};}function respondWithFilteredResult(_0x431b3f,_0xa26ea2){return function(_0x46feec){if(_0x46feec){var _0x120ef3=_0x46feec['count'],_0x33e459=_0xa26ea2[_0x86d3('0x1c')],_0x32dee7=_0xa26ea2['offset']+_0xa26ea2[_0x86d3('0x1d')],_0x9b76f2;if(_0x32dee7>=_0x120ef3){_0x32dee7=_0x120ef3;_0x9b76f2=0xc8;}else{_0x9b76f2=0xce;}_0x431b3f['status'](_0x9b76f2);return _0x431b3f['set'](_0x86d3('0x1e'),_0x33e459+'-'+_0x32dee7+'/'+_0x120ef3)[_0x86d3('0x1b')](_0x46feec);}return null;};}function patchUpdates(_0x988066){return function(_0x1720ae){try{jsonpatch['apply'](_0x1720ae,_0x988066,!![]);}catch(_0x2901de){return BPromise['reject'](_0x2901de);}return _0x1720ae[_0x86d3('0x1f')]();};}function saveUpdates(_0x3fdf67,_0x1ce849){return function(_0x5b990d){if(_0x5b990d){return _0x5b990d[_0x86d3('0x20')](_0x3fdf67)[_0x86d3('0x21')](function(_0x1fa4ac){return _0x1fa4ac;});}return null;};}function removeEntity(_0x4bf5b8,_0x58ba51){return function(_0x26262a){if(_0x26262a){return _0x26262a['destroy']()[_0x86d3('0x21')](function(){_0x4bf5b8[_0x86d3('0x19')](0xcc)[_0x86d3('0x1a')]();});}};}function handleEntityNotFound(_0x3c5fe4,_0x48b3ff){return function(_0x481077){if(!_0x481077){_0x3c5fe4[_0x86d3('0x18')](0x194);}return _0x481077;};}function handleError(_0x611764,_0x50291c){_0x50291c=_0x50291c||0x1f4;return function(_0x14e325){logger['error'](_0x14e325[_0x86d3('0x22')]);if(_0x14e325[_0x86d3('0x23')]){delete _0x14e325[_0x86d3('0x23')];}_0x611764[_0x86d3('0x19')](_0x50291c)[_0x86d3('0x24')](_0x14e325);};}function getInteractionUsers(_0x14c9ff,_0x1f203e){return new BPromise(function(_0x35d708,_0x303f13){try{if(_0x1f203e[_0x14c9ff['id']]){_0x14c9ff[_0x86d3('0x25')]=_[_0x86d3('0x26')](_0x1f203e[_0x14c9ff['id']],function(_0x1666af){return{'id':_0x1666af['id'],'fullname':_0x1666af[_0x86d3('0x27')]};});}}catch(_0x28c25e){_0x303f13(_0x28c25e);}_0x35d708(_0x14c9ff);});}function getInteractionTags(_0x5b09f6,_0x120a0c){return new BPromise(function(_0x403be3,_0x2bda35){try{if(_0x5b09f6[_0x86d3('0x28')]){_0x5b09f6[_0x86d3('0x29')]=[];_0x5b09f6[_0x86d3('0x28')]['split'](',')[_0x86d3('0x2a')](function(_0x5c71df){_0x5b09f6['Tags'][_0x86d3('0x2b')](_0x120a0c[_0x5c71df]);});}delete _0x5b09f6[_0x86d3('0x28')];}catch(_0x32012a){_0x2bda35(_0x32012a);}_0x403be3(_0x5b09f6);});}function updateWhatsappInteraction(_0x4ca4fc,_0x3866b8,_0x458802){return new BPromise(function(_0x5b8fdd,_0x5505b6){return getInteractionUsers(_0x4ca4fc,_0x458802)[_0x86d3('0x21')](function(_0x414f34){return getInteractionTags(_0x414f34,_0x3866b8);})[_0x86d3('0x21')](function(_0x1196b6){_0x5b8fdd(_0x1196b6);})[_0x86d3('0x2c')](function(_0x2c5ecf){_0x5505b6(_0x2c5ecf);});});}exports[_0x86d3('0x2d')]=function(_0x541309,_0x4cdf45){var _0x536b98={},_0x19cabb={},_0x5990eb={'count':0x0,'rows':[]};var _0x15926f=_['map'](db[_0x86d3('0x2e')][_0x86d3('0x2f')],function(_0x452d49){return{'name':_0x452d49[_0x86d3('0x30')],'type':_0x452d49[_0x86d3('0x31')][_0x86d3('0x32')]};});_0x19cabb[_0x86d3('0x33')]=_['map'](_0x15926f,_0x86d3('0x23'));_0x19cabb[_0x86d3('0x34')]=_['keys'](_0x541309[_0x86d3('0x34')]);_0x19cabb[_0x86d3('0x35')]=_[_0x86d3('0x36')](_0x19cabb[_0x86d3('0x33')],_0x19cabb['query']);_0x536b98[_0x86d3('0x37')]=_[_0x86d3('0x36')](_0x19cabb[_0x86d3('0x33')],qs['fields'](_0x541309[_0x86d3('0x34')][_0x86d3('0x38')]));_0x536b98[_0x86d3('0x37')]=_0x536b98[_0x86d3('0x37')][_0x86d3('0x39')]?_0x536b98[_0x86d3('0x37')]:_0x19cabb[_0x86d3('0x33')];if(!_0x541309[_0x86d3('0x34')]['hasOwnProperty'](_0x86d3('0x3a'))){_0x536b98[_0x86d3('0x1d')]=qs[_0x86d3('0x1d')](_0x541309[_0x86d3('0x34')]['limit']);_0x536b98[_0x86d3('0x1c')]=qs[_0x86d3('0x1c')](_0x541309[_0x86d3('0x34')][_0x86d3('0x1c')]);}_0x536b98['order']=qs['sort'](_0x541309[_0x86d3('0x34')]['sort']);_0x536b98['where']=qs[_0x86d3('0x35')](_[_0x86d3('0x3b')](_0x541309[_0x86d3('0x34')],_0x19cabb[_0x86d3('0x35')]),_0x15926f);var _0x23ef72=[];var _0x581eac=squel[_0x86d3('0x3c')]()[_0x86d3('0x3d')]('id')[_0x86d3('0x3d')]('name')[_0x86d3('0x3d')](_0x86d3('0x3e'))['from'](_0x86d3('0x3f'));var _0xcf6c9e=squel['select']()['field']('u.id')[_0x86d3('0x3d')](_0x86d3('0x40'))[_0x86d3('0x3d')](_0x86d3('0x41'))[_0x86d3('0x42')](_0x86d3('0x43'),'ui')['left_join'](_0x86d3('0x44'),'u',_0x86d3('0x45'));var _0x5d9dad=squel[_0x86d3('0x3c')]()[_0x86d3('0x42')](_0x86d3('0x46'),'i')[_0x86d3('0x47')](_0x86d3('0x48'),'c',_0x86d3('0x49'))['left_join'](_0x86d3('0x44'),'o',_0x86d3('0x4a'))['left_join'](_0x86d3('0x4b'),'a',_0x86d3('0x4c'))[_0x86d3('0x47')](_0x86d3('0x4d'),'me',_0x86d3('0x4e'))['left_join'](_0x86d3('0x4f'),'it',_0x86d3('0x50'))[_0x86d3('0x47')](_0x86d3('0x3f'),'t',_0x86d3('0x51'));var _0x7af7b3=squel[_0x86d3('0x52')]();var _0x734d8e=[];var _0x28054a=squel[_0x86d3('0x52')]();var _0x118552;if(_0x541309[_0x86d3('0x34')]['search']){_0x118552=as[_0x86d3('0x53')](_0x541309[_0x86d3('0x34')]['search']);var _0x43290d=_0x118552[_0x86d3('0x54')];for(var _0x197047=0x0;_0x197047<_0x118552[_0x86d3('0x55')][_0x86d3('0x39')];_0x197047++){var _0x2c0648=_0x118552['conditions'][_0x197047];var _0x4cd179='i';var _0x5b872f=_['find'](_0x15926f,[_0x86d3('0x23'),_0x2c0648[_0x86d3('0x3d')]]);if(!_0x5b872f){switch(_0x2c0648[_0x86d3('0x3d')]){case _0x86d3('0x56'):if(_0x2c0648[_0x86d3('0x57')]==0x1){_0x5d9dad[_0x86d3('0x58')]('`'+_0x2c0648[_0x86d3('0x3d')]+'`\x20=\x200');}else{_0x5d9dad[_0x86d3('0x58')]('`'+_0x2c0648[_0x86d3('0x3d')]+_0x86d3('0x59'));}break;case _0x86d3('0x5a'):if(_0x2c0648[_0x86d3('0x5b')]===_0x86d3('0x5c')){if(_0x2c0648[_0x86d3('0x57')]['split']('\x20')[_0x86d3('0x39')]>0x1){_0x7af7b3[_0x43290d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x86d3('0x5d')](_0x2c0648[_0x86d3('0x57')]),null);}else{var _0xd072f2='%'+_0x2c0648[_0x86d3('0x57')]+'%';_0x7af7b3[_0x43290d](_0x86d3('0x5e'),_0xd072f2,_0xd072f2,_0xd072f2);}}else{_0x5b872f=_['find'](_0x15926f,[_0x86d3('0x23'),_0x86d3('0x5f')]);_0x2c0648[_0x86d3('0x3d')]='ContactId';_0x156960=as['buildExpression'](_0x4cd179,_0x5b872f['type'],_0x2c0648);_0x7af7b3[_0x43290d](_0x156960[_0x86d3('0x60')],_0x156960['value'][_0x86d3('0x61')],_0x156960[_0x86d3('0x57')][_0x86d3('0x1a')]);}break;case _0x86d3('0x62'):var _0x5963bb=_0x2c0648['value']['split'](',')[_0x86d3('0x26')](function(_0x100588){return Number(_0x100588);});_0x5963bb['forEach'](function(_0x3561c5){_0x28054a['or'](_0x86d3('0x63'),'%,'+_0x3561c5+',%');});_0x734d8e=_[_0x86d3('0x64')](_0x734d8e,_0x5963bb);break;case _0x86d3('0x65'):if(_0x2c0648[_0x86d3('0x5b')]==='$substring'){_0x7af7b3[_0x43290d](_0x86d3('0x66'),'%'+_0x2c0648[_0x86d3('0x57')]+'%',null);}else{_0x5b872f=_[_0x86d3('0x67')](_0x15926f,[_0x86d3('0x23'),'UserId']);_0x2c0648[_0x86d3('0x3d')]=_0x86d3('0x68');_0x156960=as['buildExpression'](_0x4cd179,_0x5b872f[_0x86d3('0x31')],_0x2c0648);_0x7af7b3[_0x43290d](_0x156960[_0x86d3('0x60')],_0x156960[_0x86d3('0x57')][_0x86d3('0x61')],_0x156960[_0x86d3('0x57')][_0x86d3('0x1a')]);}break;case _0x86d3('0x69'):_0x156960=as['buildExpression']('me',null,_0x2c0648);_0x7af7b3[_0x43290d](_0x156960['text'],_0x156960[_0x86d3('0x57')]['start'],_0x156960['value']['end']);break;}}else{var _0x156960=as['buildExpression'](_0x4cd179,_0x5b872f[_0x86d3('0x31')],_0x2c0648);_0x7af7b3[_0x43290d](_0x156960['text'],_0x156960[_0x86d3('0x57')][_0x86d3('0x61')],_0x156960[_0x86d3('0x57')]['end']);}}}else{var _0x4c3e66=_(_0x541309[_0x86d3('0x34')])[_0x86d3('0x6a')]()[_0x86d3('0x26')](function(_0x202c2a){return _[_0x86d3('0x6b')](_0x15926f,[_0x86d3('0x23'),_0x202c2a])?_0x202c2a:undefined;})[_0x86d3('0x6c')]()[_0x86d3('0x57')]();if(!_[_0x86d3('0x6d')](_0x4c3e66)){_0x4c3e66[_0x86d3('0x2a')](function(_0x1e3479){if(_0x1e3479===_0x86d3('0x6e')){_0x5d9dad[_0x86d3('0x6f')](_0x86d3('0x70'),[][_0x86d3('0x71')](_0x541309[_0x86d3('0x34')][_0x1e3479]));}else if(_0x1e3479===_0x86d3('0x72')){var _0x301643=JSON['parse'](_0x541309[_0x86d3('0x34')][_0x1e3479])[_0x86d3('0x73')];var _0x42a09b=JSON['parse'](_0x541309[_0x86d3('0x34')][_0x1e3479])[_0x86d3('0x74')];_0x5d9dad[_0x86d3('0x6f')](_0x86d3('0x75'),_0x301643,_0x42a09b);}else{if(_0x541309['query'][_0x1e3479]===_0x86d3('0x76')){_0x5d9dad['where']('i.'+_0x1e3479+_0x86d3('0x77'));}else{_0x5d9dad[_0x86d3('0x6f')]('i.'+_0x1e3479+_0x86d3('0x78'),_0x541309[_0x86d3('0x34')][_0x1e3479]);}}});}if(_0x541309[_0x86d3('0x34')]['read']){if(_0x541309[_0x86d3('0x34')]['read']==0x1){_0x5d9dad[_0x86d3('0x58')](_0x86d3('0x79'));}else{_0x5d9dad['having'](_0x86d3('0x7a'));}}if(_0x541309[_0x86d3('0x34')][_0x86d3('0x7b')]){_0x734d8e=_[_0x86d3('0x7c')](_0x541309[_0x86d3('0x34')][_0x86d3('0x7b')])?_0x541309[_0x86d3('0x34')]['tag']:new Array(_0x541309[_0x86d3('0x34')][_0x86d3('0x7b')]);_0x734d8e[_0x86d3('0x2a')](function(_0x10dfc2){_0x28054a['or'](_0x86d3('0x63'),'%,'+_0x10dfc2+',%');});}if(_0x541309['query'][_0x86d3('0x7d')]){var _0x9444e5=_0x541309['query'][_0x86d3('0x7d')][_0x86d3('0x7e')]('\x5c','\x5c\x5c')[_0x86d3('0x7e')](/'/g,'\x27\x27');if(qs[_0x86d3('0x7f')](_0x9444e5)){_0x7af7b3['or'](_0x86d3('0x80'),_0x9444e5+'%')['or'](_0x86d3('0x81'),_0x9444e5+'%');}else{_0x7af7b3['or'](_0x86d3('0x82'),qs[_0x86d3('0x5d')](_0x9444e5))['or'](_0x86d3('0x83'),_0x9444e5+'%');}}}_0x5d9dad[_0x86d3('0x6f')](_0x7af7b3);_0x5d9dad[_0x86d3('0x84')](_0x86d3('0x85'));var _0x334760={'type':db[_0x86d3('0x86')]['QueryTypes'][_0x86d3('0x87')],'raw':!![]};var _0x3fa37c=_0x5d9dad[_0x86d3('0x88')]();_0x3fa37c[_0x86d3('0x3d')]('i.id');_0x3fa37c[_0x86d3('0x3d')](_0x86d3('0x89'),_0x86d3('0x56'));if(_0x536b98[_0x86d3('0x8a')]){_0x536b98['order']['forEach'](function(_0x234497){var _0x5d09a2=_0x234497[0x0]===_0x86d3('0x8b')?_0x234497[0x0]:'i.'+_0x234497[0x0];_0x5d9dad['order'](_0x5d09a2,_0x234497[0x1]==='DESC'?![]:!![]);});}if(!_[_0x86d3('0x6d')](_0x734d8e)){_0x5d9dad[_0x86d3('0x58')](_0x28054a);_0x3fa37c[_0x86d3('0x6f')](_0x86d3('0x8c'),_0x734d8e);}BPromise[_0x86d3('0x8d')]()['then'](function(){if(!_0x118552){if(_0x541309[_0x86d3('0x34')][_0x86d3('0x6e')])return;_0x3fa37c['where'](_0x86d3('0x8e'));_0x5d9dad[_0x86d3('0x6f')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x541309[_0x86d3('0x8f')]['role']!==_0x86d3('0x90'))return;return _0x541309['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x86d3('0x21')](function(_0x555d95){if(_[_0x86d3('0x6d')](_0x555d95)){_0x3fa37c[_0x86d3('0x6f')](_0x86d3('0x91'));_0x5d9dad[_0x86d3('0x6f')](_0x86d3('0x91'));}else{_0x3fa37c[_0x86d3('0x6f')](_0x86d3('0x70'),_[_0x86d3('0x26')](_0x555d95,'id'));_0x5d9dad['where'](_0x86d3('0x70'),_[_0x86d3('0x26')](_0x555d95,'id'));}});})[_0x86d3('0x21')](function(){if(_0x541309[_0x86d3('0x8f')][_0x86d3('0x92')]==='agent'&&!_0x118552&&!_0x541309[_0x86d3('0x34')][_0x86d3('0x6e')])return[];return db[_0x86d3('0x93')][_0x86d3('0x34')](_0x3fa37c[_0x86d3('0x94')](),_0x334760);})[_0x86d3('0x21')](function(_0x345c22){_0x5990eb['count']=_0x345c22[_0x86d3('0x39')];if(_0x5990eb['count']===0x0)return[];return db[_0x86d3('0x93')]['query'](_0x581eac['toString'](),_0x334760)[_0x86d3('0x21')](function(_0x3e998f){_0x23ef72=_['keyBy'](_0x3e998f,'id');_0x334760=_[_0x86d3('0x95')](_0x334760,{'model':db[_0x86d3('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x541309[_0x86d3('0x34')][_0x86d3('0x38')]){_0x536b98[_0x86d3('0x37')][_0x86d3('0x2a')](function(_0x15635a){_0x5d9dad['field']('i.'+_0x15635a);});}else{_0x5d9dad['field'](_0x86d3('0x89'),_0x86d3('0x56'));_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0x96'),_0x86d3('0x97'));_0x5d9dad[_0x86d3('0x3d')]('a.mandatoryDisposition',_0x86d3('0x98'));_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0x99'),_0x86d3('0x8b'));_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0x9a'));_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0x9b'),_0x86d3('0x9c'));_0x5d9dad['field'](_0x86d3('0x9d'),_0x86d3('0x9e'));_0x5d9dad['field']('c.email',_0x86d3('0x9f'));_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0xa0'),'Contact.phone');_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0xa1'),_0x86d3('0xa2'));_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0xa3'),'Contact.fax');_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0xa4'),'Owner.fullname');_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0xa5'),_0x86d3('0xa6'));_0x5d9dad[_0x86d3('0x3d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x86d3('0x28'));}if(_0x536b98[_0x86d3('0x1d')])_0x5d9dad[_0x86d3('0x1d')](_0x536b98[_0x86d3('0x1d')]);if(_0x536b98[_0x86d3('0x1c')])_0x5d9dad['offset'](_0x536b98[_0x86d3('0x1c')]);return db[_0x86d3('0x93')][_0x86d3('0x34')](_0x5d9dad[_0x86d3('0x94')](),_0x334760);})[_0x86d3('0x21')](function(_0x2215fc){_0xcf6c9e[_0x86d3('0x6f')](_0x86d3('0xa7'),_[_0x86d3('0x26')](_0x2215fc,'id'));return db[_0x86d3('0x93')]['query'](_0xcf6c9e['toString'](),_0x334760)[_0x86d3('0x21')](function(_0x22b67b){var _0x4ac7b3=_[_0x86d3('0xa8')](_0x22b67b,_0x86d3('0xa9'));var _0x166646=[];_0x2215fc[_0x86d3('0x2a')](function(_0x359c82){_0x166646[_0x86d3('0x2b')](updateWhatsappInteraction(_0x359c82,_0x23ef72,_0x4ac7b3));});return BPromise[_0x86d3('0xaa')](_0x166646);});});})[_0x86d3('0x21')](function(_0x3d7e6f){_0x5990eb['rows']=_0x3d7e6f;return _0x5990eb;})['then'](respondWithFilteredResult(_0x4cdf45,_0x536b98))['catch'](handleError(_0x4cdf45,null));};exports['show']=function(_0xad83bf,_0x2514c1){var _0x28a509={'raw':![],'where':{'id':_0xad83bf[_0x86d3('0xab')]['id']}},_0x3d2b13={};_0x3d2b13[_0x86d3('0x33')]=_[_0x86d3('0x6a')](db['WhatsappInteraction'][_0x86d3('0x2f')]);_0x3d2b13[_0x86d3('0x34')]=_[_0x86d3('0x6a')](_0xad83bf[_0x86d3('0x34')]);_0x3d2b13['filters']=_[_0x86d3('0x36')](_0x3d2b13['model'],_0x3d2b13[_0x86d3('0x34')]);_0x28a509[_0x86d3('0x37')]=_[_0x86d3('0x36')](_0x3d2b13[_0x86d3('0x33')],qs[_0x86d3('0x38')](_0xad83bf['query']['fields']));_0x28a509[_0x86d3('0x37')]=_0x28a509['attributes'][_0x86d3('0x39')]?_0x28a509['attributes']:_0x3d2b13[_0x86d3('0x33')];if(_0xad83bf['query']['includeAll']){_0x28a509[_0x86d3('0xac')]=[{'all':!![]}];}_0x28a509=_[_0x86d3('0x95')]({},_0x28a509,_0xad83bf[_0x86d3('0xad')]);return db[_0x86d3('0x2e')][_0x86d3('0x67')](_0x28a509)[_0x86d3('0x21')](handleEntityNotFound(_0x2514c1,null))[_0x86d3('0x21')](respondWithResult(_0x2514c1,null))[_0x86d3('0x2c')](handleError(_0x2514c1,null));};exports[_0x86d3('0xae')]=function(_0x120a85,_0x25f4c1){return db[_0x86d3('0x2e')][_0x86d3('0xae')](_0x120a85[_0x86d3('0x69')],{})[_0x86d3('0x21')](respondWithResult(_0x25f4c1,0xc9))['catch'](handleError(_0x25f4c1,null));};exports['update']=function(_0x4f79b7,_0xbd8ee7){if(_0x4f79b7[_0x86d3('0x69')]['id']){delete _0x4f79b7[_0x86d3('0x69')]['id'];}return db[_0x86d3('0x2e')][_0x86d3('0x67')]({'where':{'id':_0x4f79b7[_0x86d3('0xab')]['id']}})[_0x86d3('0x21')](handleEntityNotFound(_0xbd8ee7,null))[_0x86d3('0x21')](saveUpdates(_0x4f79b7[_0x86d3('0x69')],null))[_0x86d3('0x21')](respondWithResult(_0xbd8ee7,null))[_0x86d3('0x2c')](handleError(_0xbd8ee7,null));};exports['destroy']=function(_0x4672af,_0x48abbe){return db[_0x86d3('0x2e')][_0x86d3('0x67')]({'where':{'id':_0x4672af[_0x86d3('0xab')]['id']}})[_0x86d3('0x21')](handleEntityNotFound(_0x48abbe,null))['then'](removeEntity(_0x48abbe,null))[_0x86d3('0x2c')](handleError(_0x48abbe,null));};exports[_0x86d3('0xaf')]=function(_0x4d4f9f,_0x909c3){return db[_0x86d3('0x2e')][_0x86d3('0xaf')]()[_0x86d3('0x21')](respondWithResult(_0x909c3,null))[_0x86d3('0x2c')](handleError(_0x909c3,null));};exports[_0x86d3('0xb0')]=function(_0x69cef7,_0x44f26a,_0xfa2fea){return db[_0x86d3('0xb1')][_0x86d3('0x67')]({'where':{'id':_0x69cef7[_0x86d3('0xab')]['id']}})[_0x86d3('0x21')](handleEntityNotFound(_0x44f26a,null))[_0x86d3('0x21')](function(_0x515ebf){if(_0x515ebf){return _0x515ebf[_0x86d3('0xb0')](_0x69cef7[_0x86d3('0x69')][_0x86d3('0xb2')],_[_0x86d3('0xb3')](_0x69cef7['body'],[_0x86d3('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x44f26a,null))['catch'](handleError(_0x44f26a,null));};exports[_0x86d3('0xb4')]=function(_0x2bcabc,_0x44ae59,_0x4246df){var _0x337401={'raw':![],'where':{}};var _0x348c8b={};var _0x34fc17={'count':0x0,'rows':[]};return db[_0x86d3('0x2e')]['findOne']({'where':{'id':_0x2bcabc['params']['id']}})['then'](handleEntityNotFound(_0x44ae59,null))[_0x86d3('0x21')](function(_0x14c617){if(_0x14c617){_0x348c8b[_0x86d3('0x33')]=_['keys'](db[_0x86d3('0xb1')]['rawAttributes']);_0x348c8b[_0x86d3('0x34')]=_[_0x86d3('0x6a')](_0x2bcabc[_0x86d3('0x34')]);_0x348c8b[_0x86d3('0x35')]=_['intersection'](_0x348c8b[_0x86d3('0x33')],_0x348c8b[_0x86d3('0x34')]);_0x337401[_0x86d3('0x37')]=_['intersection'](_0x348c8b['model'],qs['fields'](_0x2bcabc[_0x86d3('0x34')][_0x86d3('0x38')]));_0x337401['attributes']=_0x337401[_0x86d3('0x37')]['length']?_0x337401[_0x86d3('0x37')]:_0x348c8b[_0x86d3('0x33')];if(!_0x2bcabc[_0x86d3('0x34')]['hasOwnProperty'](_0x86d3('0x3a'))){_0x337401[_0x86d3('0x1d')]=qs[_0x86d3('0x1d')](_0x2bcabc[_0x86d3('0x34')][_0x86d3('0x1d')]);_0x337401['offset']=qs[_0x86d3('0x1c')](_0x2bcabc[_0x86d3('0x34')]['offset']);}_0x337401[_0x86d3('0x8a')]=qs[_0x86d3('0xb5')](_0x2bcabc['query'][_0x86d3('0xb5')]);_0x337401['where']=qs['filters'](_[_0x86d3('0x3b')](_0x2bcabc[_0x86d3('0x34')],_0x348c8b[_0x86d3('0x35')]));_0x337401[_0x86d3('0x6f')][_0x86d3('0xa9')]=_0x14c617['id'];if(_0x2bcabc[_0x86d3('0x34')][_0x86d3('0x7d')]){_0x337401[_0x86d3('0x6f')]=_[_0x86d3('0x95')](_0x337401[_0x86d3('0x6f')],{'$or':_[_0x86d3('0x26')](_0x337401[_0x86d3('0x37')],function(_0x25339c){var _0x5564a7={};_0x5564a7[_0x25339c]={'$like':'%'+_0x2bcabc[_0x86d3('0x34')][_0x86d3('0x7d')]+'%'};return _0x5564a7;})});}if(_0x2bcabc[_0x86d3('0x34')][_0x86d3('0x73')]){var _0x3c46aa=_0x2bcabc[_0x86d3('0x34')]['$gte'][_0x86d3('0xb6')](',');var _0x4f2359={};_0x4f2359[_0x3c46aa[0x0]]={'$gte':moment(_0x3c46aa[0x1])[_0x86d3('0xb7')](_0x86d3('0xb8'))};_0x337401['where']=_['merge'](_0x337401[_0x86d3('0x6f')],_0x4f2359);}_0x337401=_[_0x86d3('0x95')]({},_0x337401,_0x2bcabc[_0x86d3('0xad')]);return db['WhatsappMessage']['count']({'where':_0x337401[_0x86d3('0x6f')]})[_0x86d3('0x21')](function(_0x9ee5af){_0x34fc17['count']=_0x9ee5af;if(_0x2bcabc[_0x86d3('0x34')][_0x86d3('0xb9')]){_0x337401[_0x86d3('0xac')]=[{'all':!![]}];}return db[_0x86d3('0xb1')][_0x86d3('0xba')](_0x337401);})[_0x86d3('0x21')](function(_0x12a1f8){_0x34fc17[_0x86d3('0xbb')]=_0x12a1f8;return _0x34fc17;});}})[_0x86d3('0x21')](respondWithFilteredResult(_0x44ae59,_0x337401))[_0x86d3('0x2c')](handleError(_0x44ae59,null));};exports[_0x86d3('0xbc')]=function(_0x490e3c,_0x2c8568,_0x4f639f){return db['WhatsappInteraction'][_0x86d3('0x67')]({'where':{'id':_0x490e3c[_0x86d3('0xab')]['id']}})['then'](handleEntityNotFound(_0x2c8568,null))['then'](function(_0x97a33d){if(_0x97a33d){return _0x97a33d[_0x86d3('0xbd')](_0x490e3c[_0x86d3('0x69')][_0x86d3('0xb2')],_['omit'](_0x490e3c[_0x86d3('0x69')],[_0x86d3('0xb2'),'id'])||{})[_0x86d3('0xbe')](function(){return db[_0x86d3('0x62')][_0x86d3('0xba')]({'attributes':['id','name',_0x86d3('0x3e')],'where':{'id':_0x490e3c[_0x86d3('0x69')][_0x86d3('0xb2')]}});})['then'](function(_0x88a97d){socket['emit'](_0x86d3('0xbf'),{'id':Number(_0x490e3c[_0x86d3('0xab')]['id']),'tags':_0x88a97d||[]});return{'id':Number(_0x490e3c['params']['id']),'tags':_0x88a97d||[]};});}})[_0x86d3('0x21')](respondWithResult(_0x2c8568,null))[_0x86d3('0x2c')](handleError(_0x2c8568,null));};exports[_0x86d3('0xc0')]=function(_0x427ffc,_0x3b9be8,_0x179095){return db['WhatsappInteraction'][_0x86d3('0x67')]({'where':{'id':_0x427ffc['params']['id']}})[_0x86d3('0x21')](handleEntityNotFound(_0x3b9be8,null))[_0x86d3('0x21')](function(_0x2f3fde){if(_0x2f3fde){return _0x2f3fde[_0x86d3('0xc0')](_0x427ffc['query'][_0x86d3('0xb2')]);}})[_0x86d3('0x21')](respondWithStatusCode(_0x3b9be8,null))[_0x86d3('0x2c')](handleError(_0x3b9be8,null));};exports[_0x86d3('0xc1')]=function(_0x2c8911,_0x259a9f){var _0x538dfb=moment()[_0x86d3('0xc2')]()[_0x86d3('0x94')]();var _0x565a8e=path['join'](config[_0x86d3('0xc3')],'server','files',_0x86d3('0xc4'));var _0x983367=path[_0x86d3('0xc5')](config['root'],_0x86d3('0xc6'),_0x86d3('0xc7'),_0x86d3('0xc8'));var _0x313600=path[_0x86d3('0xc5')](_0x565a8e,_0x538dfb);var _0x56d68e=util[_0x86d3('0xb7')](_0x86d3('0xc9'),_0x2c8911['params']['id'],_0x538dfb);var _0x5af513=path['join'](_0x565a8e,_0x56d68e);var _0x434d60=[];_0x434d60['push']({'model':db['User'],'as':_0x86d3('0x65'),'attributes':['id',_0x86d3('0x27')],'raw':!![]});_0x434d60['push']({'model':db['CmContact'],'as':_0x86d3('0x5a'),'attributes':['id',_0x86d3('0xca'),_0x86d3('0xcb')],'raw':!![]});if(_0x2c8911['query'][_0x86d3('0xc8')]){_0x434d60[_0x86d3('0x2b')]({'model':db[_0x86d3('0xcc')],'as':_0x86d3('0xcc'),'raw':!![]});}var _0x245272=[{'model':db[_0x86d3('0xb1')],'as':'Messages','attributes':['id',_0x86d3('0x69'),_0x86d3('0x72'),_0x86d3('0xcd'),'secret',_0x86d3('0xce')],'include':_0x434d60}];_0x245272['push']({'model':db[_0x86d3('0xcf')],'as':_0x86d3('0xd0'),'attributes':['id',_0x86d3('0x23')]});_0x245272[_0x86d3('0x2b')]({'model':db['User'],'as':'Owner','attributes':['id',_0x86d3('0x27')]});return db[_0x86d3('0x2e')][_0x86d3('0x67')]({'where':{'id':_0x2c8911[_0x86d3('0xab')]['id']},'include':_0x245272})[_0x86d3('0x21')](handleEntityNotFound(_0x259a9f,null))[_0x86d3('0x21')](function(_0x10d623){if(_0x10d623){var _0x533c3d=_0x10d623[_0x86d3('0xd1')]({'plain':!![]});fs[_0x86d3('0xd2')](_0x313600);var _0x303176={'format':'A4','border':_0x86d3('0xd3'),'header':{'height':'40px','contents':{'first':_0x86d3('0xd4')}},'footer':{'height':'30px','contents':{'default':util[_0x86d3('0xb7')](_0x86d3('0xd5'),util[_0x86d3('0xb7')]('%s\x20#%d',_0x86d3('0xd6'),_0x533c3d['id']),moment()[_0x86d3('0xb7')](_0x86d3('0xd7'))['toString']())}}};var _0x536628={'channel':_0x86d3('0xd6'),'account':_0x533c3d['Account'][_0x86d3('0x23')],'agent':_0x533c3d[_0x86d3('0xd8')]?_0x533c3d['Owner'][_0x86d3('0x27')]:_0x86d3('0xd9'),'createdAt':moment(_0x533c3d[_0x86d3('0x72')])['format'](_0x86d3('0xb8'))[_0x86d3('0x94')](),'closedAt':_0x533c3d[_0x86d3('0xda')]?moment(_0x533c3d[_0x86d3('0xdb')])['format'](_0x86d3('0xb8'))[_0x86d3('0x94')]():'','disposition':_0x533c3d['disposition'],'messages':_(_0x533c3d[_0x86d3('0xdc')])[_0x86d3('0x7d')]({'secret':![]})[_0x86d3('0x26')](function(_0x3bef59){if(_0x3bef59[_0x86d3('0xcc')]){var _0x1b4b8e=path[_0x86d3('0xc5')](_0x983367,_0x3bef59[_0x86d3('0xcc')]['basename']);if(fs[_0x86d3('0xdd')](_0x1b4b8e)){fs[_0x86d3('0xde')](_0x1b4b8e)[_0x86d3('0xdf')](fs['createWriteStream'](path[_0x86d3('0xc5')](_0x313600,_0x3bef59[_0x86d3('0xcc')]['basename'])));}}return{'date':moment(_0x3bef59[_0x86d3('0x72')])[_0x86d3('0xb7')](_0x86d3('0xb8'))[_0x86d3('0x94')](),'sender':_0x3bef59[_0x86d3('0xcd')]==='out'?_0x3bef59['User']?_0x3bef59['User']['fullname']:'System':_0x3bef59[_0x86d3('0x5a')][_0x86d3('0xca')]+(_0x3bef59[_0x86d3('0x5a')]['lastName']?'\x20'+_0x3bef59[_0x86d3('0x5a')][_0x86d3('0xcb')]:''),'body':_0x3bef59[_0x86d3('0xcc')]?_0x3bef59[_0x86d3('0xcc')]['basename']:_0x3bef59[_0x86d3('0x69')],'direction':_0x3bef59['direction']===_0x86d3('0xe0')?'A':'C','secret':_0x3bef59[_0x86d3('0xe1')],'read':_0x3bef59[_0x86d3('0xce')],'attachment':_0x3bef59['Attachment']};})['value']()};return ejs[_0x86d3('0xe2')](path['join'](config[_0x86d3('0xc3')],_0x86d3('0xc6'),_0x86d3('0xe3'),'downloadInteraction.html'),{'interaction':_0x536628})[_0x86d3('0x21')](function(_0x58168a){return new BPromise(function(_0x1aedcc,_0x37d1a3){pdf[_0x86d3('0xae')](_0x58168a,_0x303176)[_0x86d3('0xe4')](path['join'](_0x313600,'transcript-'+_0x533c3d['id']+'-'+_0x538dfb+'.pdf'),function(_0x2261f2,_0x5dd421){if(_0x2261f2)return _0x37d1a3(_0x2261f2);_0x1aedcc(_0x5dd421);});});})['then'](function(){return new BPromise(function(_0x457ed0,_0x1bbf44){zipdir(_0x313600,{'saveTo':_0x5af513},function(_0x5097e3,_0x163ad6){if(_0x5097e3)return _0x1bbf44(_0x5097e3);return _0x457ed0(_0x163ad6);});})[_0x86d3('0x21')](function(){return new BPromise(function(_0x4993a2,_0x2b5fa1){rimraf(_0x313600,function(_0x22e51a){if(_0x22e51a)_0x2b5fa1(_0x22e51a);return _0x4993a2();});});})[_0x86d3('0x21')](function(){return _0x259a9f[_0x86d3('0xc1')](_0x5af513,_0x56d68e,function(_0x456e72){if(_0x456e72){console['log'](_0x86d3('0xe5'),_0x456e72);}else{fs['unlinkSync'](_0x5af513);}});});});}else{return _0x259a9f[_0x86d3('0x18')](0xc8);}})['catch'](handleError(_0x259a9f,null));}; \ No newline at end of file +var _0xc6ac=['getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','WhatsappAccountId','sequelize','toString','keyBy','merge','unreadMessages','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','catch','show','params','includeAll','include','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','firstName','Attachment','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','N.A.','createdAt','closed','closedAt','disposition','Messages','existsSync','createReadStream','createWriteStream','out','System','lastName','basename','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','field','from','select','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','where','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role'];(function(_0x4eaa9f,_0x347a84){var _0x2219c4=function(_0x3abaff){while(--_0x3abaff){_0x4eaa9f['push'](_0x4eaa9f['shift']());}};_0x2219c4(++_0x347a84);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4114a3,_0x4cc495){_0x4114a3=_0x4114a3-0x0;var _0x3b14c0=_0xc6ac[_0x4114a3];return _0x3b14c0;};'use strict';var pdf=require(_0xcc6a('0x0'));var emlformat=require(_0xcc6a('0x1'));var rimraf=require(_0xcc6a('0x2'));var zipdir=require(_0xcc6a('0x3'));var jsonpatch=require(_0xcc6a('0x4'));var rp=require(_0xcc6a('0x5'));var moment=require(_0xcc6a('0x6'));var BPromise=require(_0xcc6a('0x7'));var Mustache=require(_0xcc6a('0x8'));var util=require(_0xcc6a('0x9'));var path=require(_0xcc6a('0xa'));var sox=require(_0xcc6a('0xb'));var csv=require(_0xcc6a('0xc'));var ejs=require(_0xcc6a('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xc'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xcc6a('0x1b')](config[_0xcc6a('0x1c')],{'host':_0xcc6a('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcc6a('0x1e'))[_0xcc6a('0x1f')](socket);function respondWithStatusCode(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xcc;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x20')](_0x348af7);}return _0x43710d[_0xcc6a('0x21')](_0x348af7)[_0xcc6a('0x22')]();};}function respondWithResult(_0x56ffb0,_0x4e628f){_0x4e628f=_0x4e628f||0xc8;return function(_0x4d021a){if(_0x4d021a){return _0x56ffb0[_0xcc6a('0x21')](_0x4e628f)[_0xcc6a('0x23')](_0x4d021a);}};}function respondWithFilteredResult(_0x307f2a,_0x3e63d9){return function(_0x33079c){if(_0x33079c){var _0x12ef33=_0x33079c[_0xcc6a('0x24')],_0x2d9585=_0x3e63d9[_0xcc6a('0x25')],_0x412bc7=_0x3e63d9['offset']+_0x3e63d9[_0xcc6a('0x26')],_0x374e51;if(_0x412bc7>=_0x12ef33){_0x412bc7=_0x12ef33;_0x374e51=0xc8;}else{_0x374e51=0xce;}_0x307f2a[_0xcc6a('0x21')](_0x374e51);return _0x307f2a[_0xcc6a('0x27')](_0xcc6a('0x28'),_0x2d9585+'-'+_0x412bc7+'/'+_0x12ef33)[_0xcc6a('0x23')](_0x33079c);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x29')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x2a')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x2b')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x2c')](_0x845088)[_0xcc6a('0x2d')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2e')]()[_0xcc6a('0x2d')](function(){_0x10016a[_0xcc6a('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26def8,_0x29d8be){return function(_0x3514f3){if(!_0x3514f3){_0x26def8['sendStatus'](0x194);}return _0x3514f3;};}function handleError(_0x3afb3a,_0x3dad72){_0x3dad72=_0x3dad72||0x1f4;return function(_0x4da301){logger[_0xcc6a('0x2f')](_0x4da301[_0xcc6a('0x30')]);if(_0x4da301[_0xcc6a('0x31')]){delete _0x4da301[_0xcc6a('0x31')];}_0x3afb3a['status'](_0x3dad72)[_0xcc6a('0x32')](_0x4da301);};}function getInteractionUsers(_0x3cf14c,_0x2c6d88){return new BPromise(function(_0x4f176b,_0x2590a2){try{if(_0x2c6d88[_0x3cf14c['id']]){_0x3cf14c['Users']=_['map'](_0x2c6d88[_0x3cf14c['id']],function(_0x33b72b){return{'id':_0x33b72b['id'],'fullname':_0x33b72b[_0xcc6a('0x33')]};});}}catch(_0x3aa315){_0x2590a2(_0x3aa315);}_0x4f176b(_0x3cf14c);});}function getInteractionTags(_0x11b481,_0x2b575d){return new BPromise(function(_0x131138,_0x4e2de4){try{if(_0x11b481[_0xcc6a('0x34')]){_0x11b481[_0xcc6a('0x35')]=[];_0x11b481[_0xcc6a('0x34')][_0xcc6a('0x36')](',')[_0xcc6a('0x37')](function(_0x152ebd){_0x11b481[_0xcc6a('0x35')][_0xcc6a('0x38')](_0x2b575d[_0x152ebd]);});}delete _0x11b481['TagIds'];}catch(_0x36fc25){_0x4e2de4(_0x36fc25);}_0x131138(_0x11b481);});}function updateWhatsappInteraction(_0xc8c90c,_0x3769b2,_0x1538bc){return new BPromise(function(_0x30d6e1,_0x711a58){return getInteractionUsers(_0xc8c90c,_0x1538bc)[_0xcc6a('0x2d')](function(_0x5afbbc){return getInteractionTags(_0x5afbbc,_0x3769b2);})[_0xcc6a('0x2d')](function(_0x5a41b4){_0x30d6e1(_0x5a41b4);})['catch'](function(_0x50cfe0){_0x711a58(_0x50cfe0);});});}exports[_0xcc6a('0x39')]=function(_0x2a3e93,_0x1101ec){var _0xe213b3={},_0x1dc64f={},_0x5856af={'count':0x0,'rows':[]};var _0x58f6ee=_[_0xcc6a('0x3a')](db[_0xcc6a('0x3b')][_0xcc6a('0x3c')],function(_0x538ea5){return{'name':_0x538ea5[_0xcc6a('0x3d')],'type':_0x538ea5[_0xcc6a('0x3e')][_0xcc6a('0x3f')]};});_0x1dc64f[_0xcc6a('0x40')]=_[_0xcc6a('0x3a')](_0x58f6ee,_0xcc6a('0x31'));_0x1dc64f[_0xcc6a('0x41')]=_[_0xcc6a('0x42')](_0x2a3e93[_0xcc6a('0x41')]);_0x1dc64f[_0xcc6a('0x43')]=_[_0xcc6a('0x44')](_0x1dc64f[_0xcc6a('0x40')],_0x1dc64f[_0xcc6a('0x41')]);_0xe213b3[_0xcc6a('0x45')]=_[_0xcc6a('0x44')](_0x1dc64f[_0xcc6a('0x40')],qs[_0xcc6a('0x46')](_0x2a3e93[_0xcc6a('0x41')]['fields']));_0xe213b3['attributes']=_0xe213b3[_0xcc6a('0x45')][_0xcc6a('0x47')]?_0xe213b3[_0xcc6a('0x45')]:_0x1dc64f[_0xcc6a('0x40')];if(!_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x48')](_0xcc6a('0x49'))){_0xe213b3[_0xcc6a('0x26')]=qs['limit'](_0x2a3e93['query'][_0xcc6a('0x26')]);_0xe213b3['offset']=qs['offset'](_0x2a3e93['query'][_0xcc6a('0x25')]);}_0xe213b3[_0xcc6a('0x4a')]=qs[_0xcc6a('0x4b')](_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x4b')]);_0xe213b3['where']=qs[_0xcc6a('0x43')](_[_0xcc6a('0x4c')](_0x2a3e93[_0xcc6a('0x41')],_0x1dc64f[_0xcc6a('0x43')]),_0x58f6ee);var _0x14ca90=[];var _0x2235e0=squel['select']()[_0xcc6a('0x4d')]('id')[_0xcc6a('0x4d')](_0xcc6a('0x31'))[_0xcc6a('0x4d')]('color')[_0xcc6a('0x4e')]('tools_tags');var _0x351529=squel[_0xcc6a('0x4f')]()[_0xcc6a('0x4d')]('u.id')[_0xcc6a('0x4d')](_0xcc6a('0x50'))[_0xcc6a('0x4d')]('ui.WhatsappInteractionId')['from'](_0xcc6a('0x51'),'ui')[_0xcc6a('0x52')](_0xcc6a('0x53'),'u',_0xcc6a('0x54'));var _0x345e94=squel['select']()[_0xcc6a('0x4e')](_0xcc6a('0x55'),'i')['left_join'](_0xcc6a('0x56'),'c',_0xcc6a('0x57'))[_0xcc6a('0x52')](_0xcc6a('0x53'),'o',_0xcc6a('0x58'))[_0xcc6a('0x52')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')['left_join'](_0xcc6a('0x59'),'me',_0xcc6a('0x5a'))[_0xcc6a('0x52')](_0xcc6a('0x5b'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xcc6a('0x52')]('tools_tags','t',_0xcc6a('0x5c'));var _0x4299ca=squel[_0xcc6a('0x5d')]();var _0x321b74=[];var _0x41be6d=squel[_0xcc6a('0x5d')]();var _0x47b175;if(_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x5e')]){_0x47b175=as[_0xcc6a('0x5f')](_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x5e')]);var _0x362bf6=_0x47b175[_0xcc6a('0x60')];for(var _0x392805=0x0;_0x392805<_0x47b175[_0xcc6a('0x61')][_0xcc6a('0x47')];_0x392805++){var _0x486072=_0x47b175[_0xcc6a('0x61')][_0x392805];var _0x3197b5='i';var _0xbed299=_[_0xcc6a('0x62')](_0x58f6ee,[_0xcc6a('0x31'),_0x486072[_0xcc6a('0x4d')]]);if(!_0xbed299){switch(_0x486072['field']){case'unreadMessages':if(_0x486072[_0xcc6a('0x63')]==0x1){_0x345e94['having']('`'+_0x486072[_0xcc6a('0x4d')]+_0xcc6a('0x64'));}else{_0x345e94[_0xcc6a('0x65')]('`'+_0x486072[_0xcc6a('0x4d')]+_0xcc6a('0x66'));}break;case _0xcc6a('0x67'):if(_0x486072[_0xcc6a('0x68')]===_0xcc6a('0x69')){if(_0x486072[_0xcc6a('0x63')][_0xcc6a('0x36')]('\x20')[_0xcc6a('0x47')]>0x1){_0x4299ca[_0x362bf6]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcc6a('0x6a')](_0x486072['value']),null);}else{var _0x378679='%'+_0x486072[_0xcc6a('0x63')]+'%';_0x4299ca[_0x362bf6](_0xcc6a('0x6b'),_0x378679,_0x378679,_0x378679);}}else{_0xbed299=_['find'](_0x58f6ee,[_0xcc6a('0x31'),'ContactId']);_0x486072[_0xcc6a('0x4d')]='ContactId';_0x247188=as[_0xcc6a('0x6c')](_0x3197b5,_0xbed299[_0xcc6a('0x3e')],_0x486072);_0x4299ca[_0x362bf6](_0x247188[_0xcc6a('0x6d')],_0x247188[_0xcc6a('0x63')][_0xcc6a('0x6e')],_0x247188[_0xcc6a('0x63')][_0xcc6a('0x22')]);}break;case _0xcc6a('0x6f'):var _0x506311=_0x486072[_0xcc6a('0x63')]['split'](',')[_0xcc6a('0x3a')](function(_0x49dd51){return Number(_0x49dd51);});_0x506311[_0xcc6a('0x37')](function(_0x242892){_0x41be6d['or'](_0xcc6a('0x70'),'%,'+_0x242892+',%');});_0x321b74=_['union'](_0x321b74,_0x506311);break;case _0xcc6a('0x71'):if(_0x486072['operator']==='$substring'){_0x4299ca[_0x362bf6](_0xcc6a('0x72'),'%'+_0x486072[_0xcc6a('0x63')]+'%',null);}else{_0xbed299=_[_0xcc6a('0x62')](_0x58f6ee,[_0xcc6a('0x31'),_0xcc6a('0x73')]);_0x486072[_0xcc6a('0x4d')]=_0xcc6a('0x73');_0x247188=as[_0xcc6a('0x6c')](_0x3197b5,_0xbed299[_0xcc6a('0x3e')],_0x486072);_0x4299ca[_0x362bf6](_0x247188[_0xcc6a('0x6d')],_0x247188[_0xcc6a('0x63')][_0xcc6a('0x6e')],_0x247188[_0xcc6a('0x63')]['end']);}break;case _0xcc6a('0x74'):_0x247188=as[_0xcc6a('0x6c')]('me',null,_0x486072);_0x4299ca[_0x362bf6](_0x247188[_0xcc6a('0x6d')],_0x247188[_0xcc6a('0x63')]['start'],_0x247188[_0xcc6a('0x63')][_0xcc6a('0x22')]);break;}}else{var _0x247188=as[_0xcc6a('0x6c')](_0x3197b5,_0xbed299[_0xcc6a('0x3e')],_0x486072);_0x4299ca[_0x362bf6](_0x247188[_0xcc6a('0x6d')],_0x247188[_0xcc6a('0x63')][_0xcc6a('0x6e')],_0x247188[_0xcc6a('0x63')][_0xcc6a('0x22')]);}}}else{var _0x4c5e4e=_(_0x2a3e93['query'])['keys']()[_0xcc6a('0x3a')](function(_0x332c20){return _[_0xcc6a('0x75')](_0x58f6ee,['name',_0x332c20])?_0x332c20:undefined;})[_0xcc6a('0x76')]()[_0xcc6a('0x63')]();if(!_[_0xcc6a('0x77')](_0x4c5e4e)){_0x4c5e4e[_0xcc6a('0x37')](function(_0x5e1c69){if(_0x5e1c69==='WhatsappAccountId'){_0x345e94[_0xcc6a('0x78')](_0xcc6a('0x79'),[][_0xcc6a('0x7a')](_0x2a3e93[_0xcc6a('0x41')][_0x5e1c69]));}else if(_0x5e1c69==='createdAt'){var _0x33cd69=JSON[_0xcc6a('0x7b')](_0x2a3e93[_0xcc6a('0x41')][_0x5e1c69])[_0xcc6a('0x7c')];var _0x3a0d36=JSON['parse'](_0x2a3e93['query'][_0x5e1c69])[_0xcc6a('0x7d')];_0x345e94[_0xcc6a('0x78')](_0xcc6a('0x7e'),_0x33cd69,_0x3a0d36);}else{if(_0x2a3e93[_0xcc6a('0x41')][_0x5e1c69]==='null'){_0x345e94['where']('i.'+_0x5e1c69+_0xcc6a('0x7f'));}else{_0x345e94[_0xcc6a('0x78')]('i.'+_0x5e1c69+_0xcc6a('0x80'),_0x2a3e93[_0xcc6a('0x41')][_0x5e1c69]);}}});}if(_0x2a3e93['query']['read']){if(_0x2a3e93['query'][_0xcc6a('0x81')]==0x1){_0x345e94[_0xcc6a('0x65')](_0xcc6a('0x82'));}else{_0x345e94[_0xcc6a('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x83')]){_0x321b74=_['isArray'](_0x2a3e93[_0xcc6a('0x41')]['tag'])?_0x2a3e93[_0xcc6a('0x41')]['tag']:new Array(_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x83')]);_0x321b74[_0xcc6a('0x37')](function(_0x4da2bc){_0x41be6d['or'](_0xcc6a('0x70'),'%,'+_0x4da2bc+',%');});}if(_0x2a3e93['query'][_0xcc6a('0x84')]){var _0x54ab25=_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x84')][_0xcc6a('0x85')]('\x5c','\x5c\x5c')[_0xcc6a('0x85')](/'/g,'\x27\x27');if(qs[_0xcc6a('0x86')](_0x54ab25)){_0x4299ca['or'](_0xcc6a('0x87'),_0x54ab25+'%')['or']('i.phone\x20LIKE\x20?',_0x54ab25+'%');}else{_0x4299ca['or'](_0xcc6a('0x88'),qs[_0xcc6a('0x6a')](_0x54ab25))['or'](_0xcc6a('0x89'),_0x54ab25+'%');}}}_0x345e94[_0xcc6a('0x78')](_0x4299ca);_0x345e94[_0xcc6a('0x8a')]('i.id');var _0xcc68cf={'type':db[_0xcc6a('0x8b')]['QueryTypes']['SELECT'],'raw':!![]};var _0x2fbdce=_0x345e94[_0xcc6a('0x8c')]();_0x2fbdce[_0xcc6a('0x4d')](_0xcc6a('0x8d'));_0x2fbdce[_0xcc6a('0x4d')](_0xcc6a('0x8e'),'unreadMessages');if(_0xe213b3[_0xcc6a('0x4a')]){_0xe213b3[_0xcc6a('0x4a')][_0xcc6a('0x37')](function(_0x3e31bd){var _0x19a582=_0x3e31bd[0x0]===_0xcc6a('0x8f')?_0x3e31bd[0x0]:'i.'+_0x3e31bd[0x0];_0x345e94['order'](_0x19a582,_0x3e31bd[0x1]==='DESC'?![]:!![]);});}if(!_[_0xcc6a('0x77')](_0x321b74)){_0x345e94[_0xcc6a('0x65')](_0x41be6d);_0x2fbdce[_0xcc6a('0x78')](_0xcc6a('0x90'),_0x321b74);}BPromise[_0xcc6a('0x91')]()[_0xcc6a('0x2d')](function(){if(!_0x47b175){if(_0x2a3e93[_0xcc6a('0x41')]['WhatsappAccountId'])return;_0x2fbdce[_0xcc6a('0x78')](_0xcc6a('0x92'));_0x345e94[_0xcc6a('0x78')](_0xcc6a('0x92'));return;}if(_0x2a3e93[_0xcc6a('0x93')][_0xcc6a('0x94')]!=='agent')return;return _0x2a3e93[_0xcc6a('0x93')][_0xcc6a('0x95')]({'attributes':['id'],'raw':!![]})[_0xcc6a('0x2d')](function(_0x5ad57c){if(_[_0xcc6a('0x77')](_0x5ad57c)){_0x2fbdce[_0xcc6a('0x78')](_0xcc6a('0x96'));_0x345e94[_0xcc6a('0x78')](_0xcc6a('0x96'));}else{_0x2fbdce[_0xcc6a('0x78')]('i.WhatsappAccountId\x20IN\x20?',_[_0xcc6a('0x3a')](_0x5ad57c,'id'));_0x345e94[_0xcc6a('0x78')]('i.WhatsappAccountId\x20IN\x20?',_[_0xcc6a('0x3a')](_0x5ad57c,'id'));}});})[_0xcc6a('0x2d')](function(){if(_0x2a3e93[_0xcc6a('0x93')][_0xcc6a('0x94')]===_0xcc6a('0x97')&&!_0x47b175&&!_0x2a3e93['query'][_0xcc6a('0x98')])return[];return db[_0xcc6a('0x99')][_0xcc6a('0x41')](_0x2fbdce[_0xcc6a('0x9a')](),_0xcc68cf);})[_0xcc6a('0x2d')](function(_0xaa0da6){_0x5856af['count']=_0xaa0da6['length'];if(_0x5856af[_0xcc6a('0x24')]===0x0)return[];return db['sequelize'][_0xcc6a('0x41')](_0x2235e0[_0xcc6a('0x9a')](),_0xcc68cf)[_0xcc6a('0x2d')](function(_0x1b8d31){_0x14ca90=_[_0xcc6a('0x9b')](_0x1b8d31,'id');_0xcc68cf=_[_0xcc6a('0x9c')](_0xcc68cf,{'model':db[_0xcc6a('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x46')]){_0xe213b3[_0xcc6a('0x45')][_0xcc6a('0x37')](function(_0x383b1b){_0x345e94['field']('i.'+_0x383b1b);});}else{_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0x8e'),_0xcc6a('0x9d'));_0x345e94[_0xcc6a('0x4d')]('a.key',_0xcc6a('0x9e'));_0x345e94['field'](_0xcc6a('0x9f'),_0xcc6a('0xa0'));_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xa1'),_0xcc6a('0x8f'));_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xa2'));_0x345e94['field'](_0xcc6a('0xa3'),_0xcc6a('0xa4'));_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xa5'),_0xcc6a('0xa6'));_0x345e94[_0xcc6a('0x4d')]('c.email',_0xcc6a('0xa7'));_0x345e94[_0xcc6a('0x4d')]('c.phone','Contact.phone');_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xa8'),_0xcc6a('0xa9'));_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xaa'),'Contact.fax');_0x345e94[_0xcc6a('0x4d')]('o.fullname',_0xcc6a('0xab'));_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xac'),_0xcc6a('0xad'));_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xae'),_0xcc6a('0x34'));}if(_0xe213b3[_0xcc6a('0x26')])_0x345e94['limit'](_0xe213b3[_0xcc6a('0x26')]);if(_0xe213b3[_0xcc6a('0x25')])_0x345e94[_0xcc6a('0x25')](_0xe213b3['offset']);return db[_0xcc6a('0x99')][_0xcc6a('0x41')](_0x345e94[_0xcc6a('0x9a')](),_0xcc68cf);})[_0xcc6a('0x2d')](function(_0xadeca6){_0x351529[_0xcc6a('0x78')](_0xcc6a('0xaf'),_['map'](_0xadeca6,'id'));return db[_0xcc6a('0x99')][_0xcc6a('0x41')](_0x351529[_0xcc6a('0x9a')](),_0xcc68cf)[_0xcc6a('0x2d')](function(_0x192117){var _0xc42043=_[_0xcc6a('0xb0')](_0x192117,_0xcc6a('0xb1'));var _0x5e3be3=[];_0xadeca6['forEach'](function(_0x5cd73e){_0x5e3be3['push'](updateWhatsappInteraction(_0x5cd73e,_0x14ca90,_0xc42043));});return BPromise[_0xcc6a('0xb2')](_0x5e3be3);});});})[_0xcc6a('0x2d')](function(_0x9bb85c){_0x5856af[_0xcc6a('0xb3')]=_0x9bb85c;return _0x5856af;})[_0xcc6a('0x2d')](respondWithFilteredResult(_0x1101ec,_0xe213b3))[_0xcc6a('0xb4')](handleError(_0x1101ec,null));};exports[_0xcc6a('0xb5')]=function(_0x48b6e3,_0x10d731){var _0x537e2b={'raw':![],'where':{'id':_0x48b6e3[_0xcc6a('0xb6')]['id']}},_0x5eb00a={};_0x5eb00a['model']=_[_0xcc6a('0x42')](db[_0xcc6a('0x3b')]['rawAttributes']);_0x5eb00a['query']=_[_0xcc6a('0x42')](_0x48b6e3['query']);_0x5eb00a[_0xcc6a('0x43')]=_[_0xcc6a('0x44')](_0x5eb00a[_0xcc6a('0x40')],_0x5eb00a[_0xcc6a('0x41')]);_0x537e2b[_0xcc6a('0x45')]=_[_0xcc6a('0x44')](_0x5eb00a['model'],qs[_0xcc6a('0x46')](_0x48b6e3[_0xcc6a('0x41')][_0xcc6a('0x46')]));_0x537e2b[_0xcc6a('0x45')]=_0x537e2b['attributes'][_0xcc6a('0x47')]?_0x537e2b[_0xcc6a('0x45')]:_0x5eb00a[_0xcc6a('0x40')];if(_0x48b6e3[_0xcc6a('0x41')][_0xcc6a('0xb7')]){_0x537e2b[_0xcc6a('0xb8')]=[{'all':!![]}];}_0x537e2b=_[_0xcc6a('0x9c')]({},_0x537e2b,_0x48b6e3['options']);return db[_0xcc6a('0x3b')][_0xcc6a('0x62')](_0x537e2b)['then'](handleEntityNotFound(_0x10d731,null))[_0xcc6a('0x2d')](respondWithResult(_0x10d731,null))[_0xcc6a('0xb4')](handleError(_0x10d731,null));};exports[_0xcc6a('0xb9')]=function(_0x2297ea,_0xc4ed84){return db[_0xcc6a('0x3b')][_0xcc6a('0xb9')](_0x2297ea[_0xcc6a('0x74')],{})[_0xcc6a('0x2d')](respondWithResult(_0xc4ed84,0xc9))[_0xcc6a('0xb4')](handleError(_0xc4ed84,null));};exports[_0xcc6a('0x2c')]=function(_0x18e20d,_0x2768b6){if(_0x18e20d[_0xcc6a('0x74')]['id']){delete _0x18e20d['body']['id'];}return db['WhatsappInteraction'][_0xcc6a('0x62')]({'where':{'id':_0x18e20d[_0xcc6a('0xb6')]['id']}})['then'](handleEntityNotFound(_0x2768b6,null))[_0xcc6a('0x2d')](saveUpdates(_0x18e20d[_0xcc6a('0x74')],null))[_0xcc6a('0x2d')](respondWithResult(_0x2768b6,null))['catch'](handleError(_0x2768b6,null));};exports[_0xcc6a('0x2e')]=function(_0x5c531a,_0x1ced4b){return db[_0xcc6a('0x3b')]['find']({'where':{'id':_0x5c531a[_0xcc6a('0xb6')]['id']}})['then'](handleEntityNotFound(_0x1ced4b,null))[_0xcc6a('0x2d')](removeEntity(_0x1ced4b,null))[_0xcc6a('0xb4')](handleError(_0x1ced4b,null));};exports[_0xcc6a('0xba')]=function(_0x3a69a2,_0x32098d){return db[_0xcc6a('0x3b')]['describe']()['then'](respondWithResult(_0x32098d,null))[_0xcc6a('0xb4')](handleError(_0x32098d,null));};exports[_0xcc6a('0xbb')]=function(_0x3eef43,_0x5d00fb,_0x1f8ec5){return db[_0xcc6a('0xbc')][_0xcc6a('0x62')]({'where':{'id':_0x3eef43[_0xcc6a('0xb6')]['id']}})['then'](handleEntityNotFound(_0x5d00fb,null))[_0xcc6a('0x2d')](function(_0x32f3b8){if(_0x32f3b8){return _0x32f3b8[_0xcc6a('0xbb')](_0x3eef43['body'][_0xcc6a('0xbd')],_['omit'](_0x3eef43[_0xcc6a('0x74')],[_0xcc6a('0xbd'),'id'])||{});}})['then'](respondWithResult(_0x5d00fb,null))[_0xcc6a('0xb4')](handleError(_0x5d00fb,null));};exports[_0xcc6a('0xbe')]=function(_0x31698d,_0x25ce7b,_0x20581c){var _0x125dba={'raw':![],'where':{}};var _0x36df40={};var _0x15146c={'count':0x0,'rows':[]};return db[_0xcc6a('0x3b')][_0xcc6a('0xbf')]({'where':{'id':_0x31698d[_0xcc6a('0xb6')]['id']}})['then'](handleEntityNotFound(_0x25ce7b,null))['then'](function(_0x3cb6bf){if(_0x3cb6bf){_0x36df40['model']=_[_0xcc6a('0x42')](db['WhatsappMessage']['rawAttributes']);_0x36df40[_0xcc6a('0x41')]=_[_0xcc6a('0x42')](_0x31698d[_0xcc6a('0x41')]);_0x36df40[_0xcc6a('0x43')]=_['intersection'](_0x36df40[_0xcc6a('0x40')],_0x36df40['query']);_0x125dba['attributes']=_[_0xcc6a('0x44')](_0x36df40[_0xcc6a('0x40')],qs[_0xcc6a('0x46')](_0x31698d[_0xcc6a('0x41')][_0xcc6a('0x46')]));_0x125dba[_0xcc6a('0x45')]=_0x125dba[_0xcc6a('0x45')]['length']?_0x125dba[_0xcc6a('0x45')]:_0x36df40[_0xcc6a('0x40')];if(!_0x31698d[_0xcc6a('0x41')]['hasOwnProperty'](_0xcc6a('0x49'))){_0x125dba['limit']=qs[_0xcc6a('0x26')](_0x31698d['query']['limit']);_0x125dba[_0xcc6a('0x25')]=qs[_0xcc6a('0x25')](_0x31698d[_0xcc6a('0x41')][_0xcc6a('0x25')]);}_0x125dba[_0xcc6a('0x4a')]=qs['sort'](_0x31698d['query']['sort']);_0x125dba[_0xcc6a('0x78')]=qs[_0xcc6a('0x43')](_[_0xcc6a('0x4c')](_0x31698d[_0xcc6a('0x41')],_0x36df40[_0xcc6a('0x43')]));_0x125dba[_0xcc6a('0x78')]['WhatsappInteractionId']=_0x3cb6bf['id'];if(_0x31698d[_0xcc6a('0x41')]['filter']){_0x125dba[_0xcc6a('0x78')]=_[_0xcc6a('0x9c')](_0x125dba[_0xcc6a('0x78')],{'$or':_[_0xcc6a('0x3a')](_0x125dba[_0xcc6a('0x45')],function(_0x48746a){var _0x58d868={};_0x58d868[_0x48746a]={'$like':'%'+_0x31698d[_0xcc6a('0x41')][_0xcc6a('0x84')]+'%'};return _0x58d868;})});}if(_0x31698d['query'][_0xcc6a('0x7c')]){var _0x307113=_0x31698d[_0xcc6a('0x41')][_0xcc6a('0x7c')][_0xcc6a('0x36')](',');var _0x2c8fbd={};_0x2c8fbd[_0x307113[0x0]]={'$gte':moment(_0x307113[0x1])['format'](_0xcc6a('0xc0'))};_0x125dba[_0xcc6a('0x78')]=_[_0xcc6a('0x9c')](_0x125dba['where'],_0x2c8fbd);}_0x125dba=_['merge']({},_0x125dba,_0x31698d['options']);return db['WhatsappMessage'][_0xcc6a('0x24')]({'where':_0x125dba['where']})[_0xcc6a('0x2d')](function(_0x4a767c){_0x15146c['count']=_0x4a767c;if(_0x31698d[_0xcc6a('0x41')]['includeAll']){_0x125dba[_0xcc6a('0xb8')]=[{'all':!![]}];}return db[_0xcc6a('0xbc')][_0xcc6a('0xc1')](_0x125dba);})[_0xcc6a('0x2d')](function(_0x65280b){_0x15146c[_0xcc6a('0xb3')]=_0x65280b;return _0x15146c;});}})[_0xcc6a('0x2d')](respondWithFilteredResult(_0x25ce7b,_0x125dba))[_0xcc6a('0xb4')](handleError(_0x25ce7b,null));};exports[_0xcc6a('0xc2')]=function(_0x365aac,_0x353442,_0x258397){return db[_0xcc6a('0x3b')][_0xcc6a('0x62')]({'where':{'id':_0x365aac[_0xcc6a('0xb6')]['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x353442,null))[_0xcc6a('0x2d')](function(_0x335748){if(_0x335748){return _0x335748[_0xcc6a('0xc3')](_0x365aac[_0xcc6a('0x74')][_0xcc6a('0xbd')],_[_0xcc6a('0xc4')](_0x365aac['body'],[_0xcc6a('0xbd'),'id'])||{})[_0xcc6a('0xc5')](function(){return db[_0xcc6a('0x6f')]['findAll']({'attributes':['id',_0xcc6a('0x31'),_0xcc6a('0xc6')],'where':{'id':_0x365aac['body'][_0xcc6a('0xbd')]}});})[_0xcc6a('0x2d')](function(_0x58a8a7){socket[_0xcc6a('0xc7')](_0xcc6a('0xc8'),{'id':Number(_0x365aac[_0xcc6a('0xb6')]['id']),'tags':_0x58a8a7||[]});return{'id':Number(_0x365aac[_0xcc6a('0xb6')]['id']),'tags':_0x58a8a7||[]};});}})[_0xcc6a('0x2d')](respondWithResult(_0x353442,null))[_0xcc6a('0xb4')](handleError(_0x353442,null));};exports['removeTags']=function(_0x505170,_0x1e436d,_0x331efb){return db['WhatsappInteraction'][_0xcc6a('0x62')]({'where':{'id':_0x505170['params']['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x1e436d,null))['then'](function(_0x24a5d0){if(_0x24a5d0){return _0x24a5d0[_0xcc6a('0xc9')](_0x505170[_0xcc6a('0x41')]['ids']);}})[_0xcc6a('0x2d')](respondWithStatusCode(_0x1e436d,null))[_0xcc6a('0xb4')](handleError(_0x1e436d,null));};exports[_0xcc6a('0xca')]=function(_0x48f019,_0x4fb270){var _0x4cd822=moment()[_0xcc6a('0xcb')]()[_0xcc6a('0x9a')]();var _0x34eb38=path[_0xcc6a('0xcc')](config[_0xcc6a('0xcd')],_0xcc6a('0xce'),_0xcc6a('0xcf'),_0xcc6a('0xd0'));var _0x14a817=path[_0xcc6a('0xcc')](config[_0xcc6a('0xcd')],_0xcc6a('0xce'),'files',_0xcc6a('0xd1'));var _0x38ffe2=path[_0xcc6a('0xcc')](_0x34eb38,_0x4cd822);var _0x5a494f=util[_0xcc6a('0xd2')](_0xcc6a('0xd3'),_0x48f019[_0xcc6a('0xb6')]['id'],_0x4cd822);var _0x4d7fc1=path[_0xcc6a('0xcc')](_0x34eb38,_0x5a494f);var _0x30b49f=[];_0x30b49f[_0xcc6a('0x38')]({'model':db[_0xcc6a('0x71')],'as':'User','attributes':['id',_0xcc6a('0x33')],'raw':!![]});_0x30b49f['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xcc6a('0xd4'),'lastName'],'raw':!![]});if(_0x48f019['query'][_0xcc6a('0xd1')]){_0x30b49f[_0xcc6a('0x38')]({'model':db[_0xcc6a('0xd5')],'as':_0xcc6a('0xd5'),'raw':!![]});}var _0xe5f8b4=[{'model':db[_0xcc6a('0xbc')],'as':'Messages','attributes':['id','body','createdAt',_0xcc6a('0xd6'),_0xcc6a('0xd7'),_0xcc6a('0x81')],'include':_0x30b49f}];_0xe5f8b4[_0xcc6a('0x38')]({'model':db[_0xcc6a('0xd8')],'as':_0xcc6a('0xd9'),'attributes':['id','name']});_0xe5f8b4['push']({'model':db[_0xcc6a('0x71')],'as':_0xcc6a('0xda'),'attributes':['id',_0xcc6a('0x33')]});return db[_0xcc6a('0x3b')]['find']({'where':{'id':_0x48f019[_0xcc6a('0xb6')]['id']},'include':_0xe5f8b4})['then'](handleEntityNotFound(_0x4fb270,null))[_0xcc6a('0x2d')](function(_0x1c2115){if(_0x1c2115){var _0x8fa195=_0x1c2115[_0xcc6a('0xdb')]({'plain':!![]});fs[_0xcc6a('0xdc')](_0x38ffe2);var _0x51619f={'format':'A4','border':'10px','header':{'height':_0xcc6a('0xdd'),'contents':{'first':_0xcc6a('0xde')}},'footer':{'height':'30px','contents':{'default':util[_0xcc6a('0xd2')](_0xcc6a('0xdf'),util[_0xcc6a('0xd2')](_0xcc6a('0xe0'),_0xcc6a('0xe1'),_0x8fa195['id']),moment()[_0xcc6a('0xd2')](_0xcc6a('0xe2'))[_0xcc6a('0x9a')]())}}};var _0x9255b2={'channel':_0xcc6a('0xe1'),'account':_0x8fa195['Account']['name'],'agent':_0x8fa195[_0xcc6a('0xda')]?_0x8fa195['Owner'][_0xcc6a('0x33')]:_0xcc6a('0xe3'),'createdAt':moment(_0x8fa195[_0xcc6a('0xe4')])['format'](_0xcc6a('0xc0'))['toString'](),'closedAt':_0x8fa195[_0xcc6a('0xe5')]?moment(_0x8fa195[_0xcc6a('0xe6')])[_0xcc6a('0xd2')](_0xcc6a('0xc0'))['toString']():'','disposition':_0x8fa195[_0xcc6a('0xe7')],'messages':_(_0x8fa195[_0xcc6a('0xe8')])[_0xcc6a('0x84')]({'secret':![]})[_0xcc6a('0x3a')](function(_0x10777a){if(_0x10777a[_0xcc6a('0xd5')]){var _0x3b84f6=path['join'](_0x14a817,_0x10777a['Attachment']['basename']);if(fs[_0xcc6a('0xe9')](_0x3b84f6)){fs[_0xcc6a('0xea')](_0x3b84f6)['pipe'](fs[_0xcc6a('0xeb')](path[_0xcc6a('0xcc')](_0x38ffe2,_0x10777a[_0xcc6a('0xd5')]['basename'])));}}return{'date':moment(_0x10777a[_0xcc6a('0xe4')])['format'](_0xcc6a('0xc0'))['toString'](),'sender':_0x10777a[_0xcc6a('0xd6')]===_0xcc6a('0xec')?_0x10777a[_0xcc6a('0x71')]?_0x10777a[_0xcc6a('0x71')]['fullname']:_0xcc6a('0xed'):_0x10777a[_0xcc6a('0x67')][_0xcc6a('0xd4')]+(_0x10777a['Contact']['lastName']?'\x20'+_0x10777a['Contact'][_0xcc6a('0xee')]:''),'body':_0x10777a[_0xcc6a('0xd5')]?_0x10777a[_0xcc6a('0xd5')][_0xcc6a('0xef')]:_0x10777a[_0xcc6a('0x74')],'direction':_0x10777a[_0xcc6a('0xd6')]===_0xcc6a('0xec')?'A':'C','secret':_0x10777a[_0xcc6a('0xd7')],'read':_0x10777a[_0xcc6a('0x81')],'attachment':_0x10777a[_0xcc6a('0xd5')]};})[_0xcc6a('0x63')]()};return ejs[_0xcc6a('0xf0')](path['join'](config[_0xcc6a('0xcd')],_0xcc6a('0xce'),_0xcc6a('0xf1'),_0xcc6a('0xf2')),{'interaction':_0x9255b2})[_0xcc6a('0x2d')](function(_0x2dfa97){return new BPromise(function(_0x24ded7,_0x4efdd9){pdf[_0xcc6a('0xb9')](_0x2dfa97,_0x51619f)[_0xcc6a('0xf3')](path[_0xcc6a('0xcc')](_0x38ffe2,_0xcc6a('0xf4')+_0x8fa195['id']+'-'+_0x4cd822+_0xcc6a('0xf5')),function(_0x4f197e,_0x132834){if(_0x4f197e)return _0x4efdd9(_0x4f197e);_0x24ded7(_0x132834);});});})['then'](function(){return new BPromise(function(_0x30c5d5,_0x132f83){zipdir(_0x38ffe2,{'saveTo':_0x4d7fc1},function(_0x10ebdf,_0x371639){if(_0x10ebdf)return _0x132f83(_0x10ebdf);return _0x30c5d5(_0x371639);});})['then'](function(){return new BPromise(function(_0x186e38,_0x2955fb){rimraf(_0x38ffe2,function(_0x2e8c0a){if(_0x2e8c0a)_0x2955fb(_0x2e8c0a);return _0x186e38();});});})[_0xcc6a('0x2d')](function(){return _0x4fb270[_0xcc6a('0xca')](_0x4d7fc1,_0x5a494f,function(_0x53242e){if(_0x53242e){console['log'](_0xcc6a('0xf6'),_0x53242e);}else{fs[_0xcc6a('0xf7')](_0x4d7fc1);}});});});}else{return _0x4fb270[_0xcc6a('0x20')](0xc8);}})[_0xcc6a('0xb4')](handleError(_0x4fb270,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d3c06ec..571a590 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 _0x718a=['emit','catch','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','setDataValue','Users','findAll','unreadMessages'];(function(_0x1892aa,_0x333158){var _0x1d02a2=function(_0x18a790){while(--_0x18a790){_0x1892aa['push'](_0x1892aa['shift']());}};_0x1d02a2(++_0x333158);}(_0x718a,0x114));var _0xa718=function(_0x29a09d,_0x424b73){_0x29a09d=_0x29a09d-0x0;var _0x484938=_0x718a[_0x29a09d];return _0x484938;};'use strict';var EventEmitter=require(_0xa718('0x0'));var WhatsappInteraction=require(_0xa718('0x1'))['db'][_0xa718('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0xa718('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa718('0x4')](0x0);var events={'afterCreate':_0xa718('0x5'),'afterUpdate':'update','afterDestroy':_0xa718('0x6')};function emitEvent(_0x21e58e){return function(_0x9f1d2,_0x1f9e77,_0x1e1866){_0x9f1d2[_0xa718('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4174bc){_0x9f1d2[_0xa718('0x8')](_0xa718('0x9'),_0x4174bc['map'](function(_0x1077fb){return{'id':_0x1077fb['id']};}));return WhatsappMessage[_0xa718('0xa')]({'where':{'WhatsappInteractionId':_0x9f1d2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x24d2f7){_0x9f1d2[_0xa718('0x8')](_0xa718('0xb'),_0x24d2f7['length']);WhatsappInteractionEvents[_0xa718('0xc')](_0x21e58e+':'+_0x9f1d2['id'],_0x9f1d2);WhatsappInteractionEvents[_0xa718('0xc')](_0x21e58e,_0x9f1d2);_0x1e1866(null);})[_0xa718('0xd')](_0x1e1866(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xa718('0xe')](e,emitEvent(event));}}module[_0xa718('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x6786=['unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map'];(function(_0x2cc871,_0x3d9748){var _0x29fd98=function(_0x48bed1){while(--_0x48bed1){_0x2cc871['push'](_0x2cc871['shift']());}};_0x29fd98(++_0x3d9748);}(_0x6786,0x18d));var _0x6678=function(_0x4c630b,_0x25f8ef){_0x4c630b=_0x4c630b-0x0;var _0x181259=_0x6786[_0x4c630b];return _0x181259;};'use strict';var EventEmitter=require(_0x6678('0x0'));var WhatsappInteraction=require(_0x6678('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x6678('0x1'))['db'][_0x6678('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6678('0x3')](0x0);var events={'afterCreate':_0x6678('0x4'),'afterUpdate':_0x6678('0x5'),'afterDestroy':_0x6678('0x6')};function emitEvent(_0x4a07c5){return function(_0x40873a,_0x4789e1,_0x62bc8){_0x40873a[_0x6678('0x7')]({'attributes':['id'],'raw':!![]})[_0x6678('0x8')](function(_0x1ca792){_0x40873a[_0x6678('0x9')]('Users',_0x1ca792[_0x6678('0xa')](function(_0x50d04b){return{'id':_0x50d04b['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x40873a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6678('0x8')](function(_0x739ae6){_0x40873a[_0x6678('0x9')](_0x6678('0xb'),_0x739ae6[_0x6678('0xc')]);WhatsappInteractionEvents[_0x6678('0xd')](_0x4a07c5+':'+_0x40873a['id'],_0x40873a);WhatsappInteractionEvents[_0x6678('0xd')](_0x4a07c5,_0x40873a);_0x62bc8(null);})[_0x6678('0xe')](_0x62bc8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x6678('0xf')](e,emitEvent(event));}}module[_0x6678('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 466099e..d3988e8 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 _0x023a=['path','rimraf','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x023a,0xe8));var _0xa023=function(_0x127989,_0x4e3e64){_0x127989=_0x127989-0x0;var _0x42ee03=_0x023a[_0x127989];return _0x42ee03;};'use strict';var _=require(_0xa023('0x0'));var util=require(_0xa023('0x1'));var logger=require(_0xa023('0x2'))(_0xa023('0x3'));var moment=require(_0xa023('0x4'));var BPromise=require('bluebird');var rp=require(_0xa023('0x5'));var fs=require('fs');var path=require(_0xa023('0x6'));var rimraf=require(_0xa023('0x7'));var config=require(_0xa023('0x8'));var attributes=require('./whatsappInteraction.attributes');module[_0xa023('0x9')]=function(_0x44a05e,_0xa8ef5c){return _0x44a05e[_0xa023('0xa')](_0xa023('0xb'),attributes,{'tableName':_0xa023('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a24c1,_0x51a10f,_0x4298f6){if(_0x5a24c1[_0xa023('0xd')](_0xa023('0xe'))){_0x5a24c1['closedAt']=moment()[_0xa023('0xf')](_0xa023('0x10'));}_0x4298f6(null,_0x5a24c1);}}});}; \ No newline at end of file +var _0x2c5b=['../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x4191af,_0x5783da){var _0x27bebf=function(_0x355be7){while(--_0x355be7){_0x4191af['push'](_0x4191af['shift']());}};_0x27bebf(++_0x5783da);}(_0x2c5b,0x89));var _0xb2c5=function(_0x2fa71e,_0x3f841b){_0x2fa71e=_0x2fa71e-0x0;var _0x1389ea=_0x2c5b[_0x2fa71e];return _0x1389ea;};'use strict';var _=require(_0xb2c5('0x0'));var util=require('util');var logger=require(_0xb2c5('0x1'))('api');var moment=require(_0xb2c5('0x2'));var BPromise=require(_0xb2c5('0x3'));var rp=require(_0xb2c5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2c5('0x5'));var config=require(_0xb2c5('0x6'));var attributes=require(_0xb2c5('0x7'));module[_0xb2c5('0x8')]=function(_0x433307,_0x5abe0d){return _0x433307['define'](_0xb2c5('0x9'),attributes,{'tableName':_0xb2c5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x565a8d,_0x567818,_0x176aa8){if(_0x565a8d['changed'](_0xb2c5('0xb'))){_0x565a8d['closedAt']=moment()['format'](_0xb2c5('0xc'));}_0x176aa8(null,_0x565a8d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index dd5a91a..81f27ad 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 _0xdfb3=['http','defaults','redis','localhost','./whatsappInteraction.socket','request','WhatsappInteraction,\x20%s,\x20%s','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','stringify','AddTagsToWhatsappInteraction','find','then','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x575934,_0x4a6760){var _0x109a3d=function(_0x1c20a1){while(--_0x1c20a1){_0x575934['push'](_0x575934['shift']());}};_0x109a3d(++_0x4a6760);}(_0xdfb3,0x1b9));var _0x3dfb=function(_0x510508,_0x30b4d2){_0x510508=_0x510508-0x0;var _0x486a65=_0xdfb3[_0x510508];return _0x486a65;};'use strict';var _=require(_0x3dfb('0x0'));var util=require(_0x3dfb('0x1'));var moment=require(_0x3dfb('0x2'));var BPromise=require(_0x3dfb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dfb('0x4'));var db=require(_0x3dfb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3dfb('0x6'))('rpc');var config=require(_0x3dfb('0x7'));var jayson=require(_0x3dfb('0x8'));var client=jayson[_0x3dfb('0x9')][_0x3dfb('0xa')]({'port':0x232a});config['redis']=_[_0x3dfb('0xb')](config[_0x3dfb('0xc')],{'host':_0x3dfb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3dfb('0xc')]));require(_0x3dfb('0xe'))['register'](socket);function respondWithRpcPromise(_0x31e0e5,_0x188dc8,_0x5693c1){return new BPromise(function(_0x2fcf72,_0xf495b6){return client[_0x3dfb('0xf')](_0x31e0e5,_0x5693c1)['then'](function(_0x3b2e87){logger['info'](_0x3dfb('0x10'),_0x188dc8,'request\x20sent');logger['debug'](_0x3dfb('0x11'),_0x188dc8,_0x3dfb('0x12'),JSON['stringify'](_0x3b2e87));if(_0x3b2e87[_0x3dfb('0x13')]){if(_0x3b2e87[_0x3dfb('0x13')][_0x3dfb('0x14')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x188dc8,_0x3b2e87[_0x3dfb('0x13')][_0x3dfb('0x15')]);return _0xf495b6(_0x3b2e87[_0x3dfb('0x13')]['message']);}logger['error'](_0x3dfb('0x10'),_0x188dc8,_0x3b2e87[_0x3dfb('0x13')][_0x3dfb('0x15')]);return _0x2fcf72(_0x3b2e87[_0x3dfb('0x13')][_0x3dfb('0x15')]);}else{logger[_0x3dfb('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x188dc8,_0x3dfb('0x12'));_0x2fcf72(_0x3b2e87[_0x3dfb('0x17')][_0x3dfb('0x15')]);}})[_0x3dfb('0x18')](function(_0x4246fd){logger[_0x3dfb('0x13')](_0x3dfb('0x10'),_0x188dc8,_0x4246fd);_0xf495b6(_0x4246fd);});});}exports[_0x3dfb('0x19')]=function(_0x4bd7a1){var _0x1c1ee1=this;return new Promise(function(_0x99271d,_0x975244){return db[_0x3dfb('0x1a')][_0x3dfb('0x1b')](_0x4bd7a1['body'],{'raw':_0x4bd7a1['options']?_0x4bd7a1[_0x3dfb('0x1c')][_0x3dfb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bd7a1[_0x3dfb('0x1c')]?_0x4bd7a1['options'][_0x3dfb('0x1e')]||null:null,'attributes':_0x4bd7a1[_0x3dfb('0x1c')]?_0x4bd7a1['options']['attributes']||null:null,'limit':_0x4bd7a1[_0x3dfb('0x1c')]?_0x4bd7a1[_0x3dfb('0x1c')]['limit']||null:null})['then'](function(_0x53262f){logger[_0x3dfb('0x16')](_0x3dfb('0x19'),_0x4bd7a1);logger['debug'](_0x3dfb('0x19'),_0x4bd7a1,JSON[_0x3dfb('0x1f')](_0x53262f));_0x99271d(_0x53262f);})[_0x3dfb('0x18')](function(_0x2e2d9c){logger[_0x3dfb('0x13')]('UpdateWhatsappInteraction',_0x2e2d9c[_0x3dfb('0x15')],_0x4bd7a1);_0x975244(_0x1c1ee1[_0x3dfb('0x13')](0x1f4,_0x2e2d9c[_0x3dfb('0x15')]));});});};exports[_0x3dfb('0x20')]=function(_0x858fb7){return new Promise(function(_0x58d541,_0x4042f1){return db[_0x3dfb('0x1a')][_0x3dfb('0x21')]({'where':_0x858fb7[_0x3dfb('0x1c')]?_0x858fb7[_0x3dfb('0x1c')][_0x3dfb('0x1e')]||null:null})[_0x3dfb('0x22')](function(_0x1b0ada){if(_0x1b0ada){return _0x1b0ada[_0x3dfb('0x23')](_0x858fb7[_0x3dfb('0x24')][_0x3dfb('0x25')],_[_0x3dfb('0x26')](_0x858fb7[_0x3dfb('0x24')],[_0x3dfb('0x25'),'id'])||{});}})[_0x3dfb('0x27')](function(_0x541cd9){logger[_0x3dfb('0x16')](_0x3dfb('0x28'),_0x858fb7);logger['debug'](_0x3dfb('0x28'),_0x858fb7,JSON[_0x3dfb('0x1f')](_0x541cd9));_0x58d541(_0x541cd9);})['catch'](function(_0x157358){logger[_0x3dfb('0x13')]('AddTags',_0x157358['message'],_0x858fb7);_0x4042f1(_this[_0x3dfb('0x13')](0x1f4,_0x157358[_0x3dfb('0x15')]));});});}; \ No newline at end of file +var _0x1111=['defaults','redis','localhost','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','limit','AddTagsToWhatsappInteraction','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xdd2a5c,_0x370894){var _0x1bccb7=function(_0x449146){while(--_0x449146){_0xdd2a5c['push'](_0xdd2a5c['shift']());}};_0x1bccb7(++_0x370894);}(_0x1111,0xc5));var _0x1111=function(_0x7f1f9,_0x596773){_0x7f1f9=_0x7f1f9-0x0;var _0x2eeb62=_0x1111[_0x7f1f9];return _0x2eeb62;};'use strict';var _=require(_0x1111('0x0'));var util=require(_0x1111('0x1'));var moment=require(_0x1111('0x2'));var BPromise=require(_0x1111('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1111('0x4'));var db=require(_0x1111('0x5'))['db'];var utils=require(_0x1111('0x6'));var logger=require(_0x1111('0x7'))(_0x1111('0x8'));var config=require(_0x1111('0x9'));var jayson=require(_0x1111('0xa'));var client=jayson[_0x1111('0xb')][_0x1111('0xc')]({'port':0x232a});config['redis']=_[_0x1111('0xd')](config[_0x1111('0xe')],{'host':_0x1111('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1111('0xe')]));require('./whatsappInteraction.socket')[_0x1111('0x10')](socket);function respondWithRpcPromise(_0x53b9d6,_0xf91a79,_0x166d6b){return new BPromise(function(_0x395c2e,_0x164079){return client[_0x1111('0x11')](_0x53b9d6,_0x166d6b)[_0x1111('0x12')](function(_0x4ab239){logger[_0x1111('0x13')](_0x1111('0x14'),_0xf91a79,_0x1111('0x15'));logger[_0x1111('0x16')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xf91a79,_0x1111('0x15'),JSON[_0x1111('0x17')](_0x4ab239));if(_0x4ab239['error']){if(_0x4ab239[_0x1111('0x18')][_0x1111('0x19')]===0x1f4){logger[_0x1111('0x18')](_0x1111('0x14'),_0xf91a79,_0x4ab239[_0x1111('0x18')][_0x1111('0x1a')]);return _0x164079(_0x4ab239[_0x1111('0x18')][_0x1111('0x1a')]);}logger[_0x1111('0x18')](_0x1111('0x14'),_0xf91a79,_0x4ab239[_0x1111('0x18')][_0x1111('0x1a')]);return _0x395c2e(_0x4ab239[_0x1111('0x18')][_0x1111('0x1a')]);}else{logger[_0x1111('0x13')](_0x1111('0x14'),_0xf91a79,_0x1111('0x15'));_0x395c2e(_0x4ab239[_0x1111('0x1b')][_0x1111('0x1a')]);}})[_0x1111('0x1c')](function(_0x9f7e1e){logger[_0x1111('0x18')](_0x1111('0x14'),_0xf91a79,_0x9f7e1e);_0x164079(_0x9f7e1e);});});}exports[_0x1111('0x1d')]=function(_0x4e8e5a){var _0xcc5f1f=this;return new Promise(function(_0x14ba81,_0x5f4b90){return db[_0x1111('0x1e')][_0x1111('0x1f')](_0x4e8e5a['body'],{'raw':_0x4e8e5a[_0x1111('0x20')]?_0x4e8e5a['options'][_0x1111('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e8e5a['options']?_0x4e8e5a[_0x1111('0x20')][_0x1111('0x22')]||null:null,'attributes':_0x4e8e5a[_0x1111('0x20')]?_0x4e8e5a[_0x1111('0x20')]['attributes']||null:null,'limit':_0x4e8e5a[_0x1111('0x20')]?_0x4e8e5a[_0x1111('0x20')][_0x1111('0x23')]||null:null})[_0x1111('0x12')](function(_0x1b9cc2){logger[_0x1111('0x13')](_0x1111('0x1d'),_0x4e8e5a);logger[_0x1111('0x16')](_0x1111('0x1d'),_0x4e8e5a,JSON[_0x1111('0x17')](_0x1b9cc2));_0x14ba81(_0x1b9cc2);})[_0x1111('0x1c')](function(_0x56fb93){logger[_0x1111('0x18')](_0x1111('0x1d'),_0x56fb93[_0x1111('0x1a')],_0x4e8e5a);_0x5f4b90(_0xcc5f1f[_0x1111('0x18')](0x1f4,_0x56fb93[_0x1111('0x1a')]));});});};exports[_0x1111('0x24')]=function(_0x59dbb3){return new Promise(function(_0x5e75f7,_0x322aaa){return db[_0x1111('0x1e')]['find']({'where':_0x59dbb3[_0x1111('0x20')]?_0x59dbb3['options'][_0x1111('0x22')]||null:null})[_0x1111('0x12')](function(_0x116aba){if(_0x116aba){return _0x116aba['addTags'](_0x59dbb3[_0x1111('0x25')][_0x1111('0x26')],_[_0x1111('0x27')](_0x59dbb3[_0x1111('0x25')],[_0x1111('0x26'),'id'])||{});}})[_0x1111('0x28')](function(_0x483737){logger['info']('AddTags',_0x59dbb3);logger['debug'](_0x1111('0x29'),_0x59dbb3,JSON[_0x1111('0x17')](_0x483737));_0x5e75f7(_0x483737);})[_0x1111('0x1c')](function(_0x4867e1){logger['error'](_0x1111('0x29'),_0x4867e1[_0x1111('0x1a')],_0x59dbb3);_0x322aaa(_this[_0x1111('0x18')](0x1f4,_0x4867e1['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index b5c7fb5..7fe0ed7 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 _0x5f5e=['removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save','emit'];(function(_0x53bdf1,_0x279555){var _0x19839a=function(_0x20b61b){while(--_0x20b61b){_0x53bdf1['push'](_0x53bdf1['shift']());}};_0x19839a(++_0x279555);}(_0x5f5e,0x17d));var _0xe5f5=function(_0x3ae605,_0x38eadc){_0x3ae605=_0x3ae605-0x0;var _0x44750b=_0x5f5e[_0x3ae605];return _0x44750b;};'use strict';var WhatsappInteractionEvents=require(_0xe5f5('0x0'));var events=[_0xe5f5('0x1'),'remove','update'];function createListener(_0x3469e9,_0x1eb492){return function(_0x18aee7){_0x1eb492[_0xe5f5('0x2')](_0x3469e9,_0x18aee7);};}function removeListener(_0x488c21,_0x489724){return function(){WhatsappInteractionEvents[_0xe5f5('0x3')](_0x488c21,_0x489724);};}exports[_0xe5f5('0x4')]=function(_0x1b1530){for(var _0x554c41=0x0,_0x3fd516=events['length'];_0x554c41<_0x3fd516;_0x554c41++){var _0x3fb8b7=events[_0x554c41];var _0x283455=createListener(_0xe5f5('0x5')+_0x3fb8b7,_0x1b1530);WhatsappInteractionEvents['on'](_0x3fb8b7,_0x283455);}}; \ No newline at end of file +var _0x46c2=['./whatsappInteraction.events','save','remove','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x4aefb9,_0x55959c){var _0x3152dc=function(_0x5f5bd5){while(--_0x5f5bd5){_0x4aefb9['push'](_0x4aefb9['shift']());}};_0x3152dc(++_0x55959c);}(_0x46c2,0x90));var _0x246c=function(_0x2e5c3a,_0x3aff6e){_0x2e5c3a=_0x2e5c3a-0x0;var _0x2d3a24=_0x46c2[_0x2e5c3a];return _0x2d3a24;};'use strict';var WhatsappInteractionEvents=require(_0x246c('0x0'));var events=[_0x246c('0x1'),_0x246c('0x2'),_0x246c('0x3')];function createListener(_0x203c31,_0x2422b1){return function(_0x186cf2){_0x2422b1[_0x246c('0x4')](_0x203c31,_0x186cf2);};}function removeListener(_0x294908,_0xe3b48c){return function(){WhatsappInteractionEvents[_0x246c('0x5')](_0x294908,_0xe3b48c);};}exports[_0x246c('0x6')]=function(_0x3fad27){for(var _0x40055a=0x0,_0x20d9bd=events[_0x246c('0x7')];_0x40055a<_0x20d9bd;_0x40055a++){var _0x5def2e=events[_0x40055a];var _0x4522d7=createListener(_0x246c('0x8')+_0x5def2e,_0x3fad27);WhatsappInteractionEvents['on'](_0x5def2e,_0x4522d7);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index c15da4d..556b9b3 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 _0x71fa=['get','describe','/:id','post','whatsapp','whatsappmessage:create','create','put','update','accept','reject','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x2d09f5,_0x291b98){var _0x4370c2=function(_0x42b1d7){while(--_0x42b1d7){_0x2d09f5['push'](_0x2d09f5['shift']());}};_0x4370c2(++_0x291b98);}(_0x71fa,0x166));var _0xa71f=function(_0x1fb58e,_0x3411eb){_0x1fb58e=_0x1fb58e-0x0;var _0x3f30f1=_0x71fa[_0x1fb58e];return _0x3f30f1;};'use strict';var multer=require(_0xa71f('0x0'));var util=require(_0xa71f('0x1'));var path=require(_0xa71f('0x2'));var timeout=require(_0xa71f('0x3'));var express=require('express');var router=express[_0xa71f('0x4')]();var auth=require(_0xa71f('0x5'));var interaction=require(_0xa71f('0x6'));var config=require(_0xa71f('0x7'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xa71f('0x8')](),controller[_0xa71f('0x9')]);router[_0xa71f('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xa71f('0xb')]);router[_0xa71f('0xa')](_0xa71f('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa71f('0xd')]('/',auth[_0xa71f('0x8')](),interaction['tracked'](_0xa71f('0xe'),_0xa71f('0xf')),controller[_0xa71f('0x10')]);router[_0xa71f('0xd')]('/:id/status',controller['status']);router[_0xa71f('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa71f('0x12')]);router[_0xa71f('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0xa71f('0x13')]);router['put']('/:id/reject',auth[_0xa71f('0x8')](),controller[_0xa71f('0x14')]);router['delete'](_0xa71f('0xc'),auth[_0xa71f('0x8')](),controller[_0xa71f('0x15')]);module[_0xa71f('0x16')]=router; \ No newline at end of file +var _0x807a=['./whatsappMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x167b0b,_0x3e8fee){var _0x4c5e8b=function(_0x525eba){while(--_0x525eba){_0x167b0b['push'](_0x167b0b['shift']());}};_0x4c5e8b(++_0x3e8fee);}(_0x807a,0x158));var _0xa807=function(_0x499735,_0x2cd025){_0x499735=_0x499735-0x0;var _0x2c8a7f=_0x807a[_0x499735];return _0x2c8a7f;};'use strict';var multer=require(_0xa807('0x0'));var util=require(_0xa807('0x1'));var path=require('path');var timeout=require(_0xa807('0x2'));var express=require(_0xa807('0x3'));var router=express[_0xa807('0x4')]();var auth=require(_0xa807('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa807('0x6'));var controller=require(_0xa807('0x7'));router[_0xa807('0x8')]('/',auth['isAuthenticated'](),controller[_0xa807('0x9')]);router[_0xa807('0x8')](_0xa807('0xa'),auth[_0xa807('0xb')](),controller['describe']);router[_0xa807('0x8')](_0xa807('0xc'),auth[_0xa807('0xb')](),controller[_0xa807('0xd')]);router[_0xa807('0xe')]('/',auth[_0xa807('0xb')](),interaction[_0xa807('0xf')]('whatsapp',_0xa807('0x10')),controller[_0xa807('0x11')]);router[_0xa807('0xe')](_0xa807('0x12'),controller[_0xa807('0x13')]);router[_0xa807('0x14')](_0xa807('0xc'),auth[_0xa807('0xb')](),controller[_0xa807('0x15')]);router['put'](_0xa807('0x16'),auth[_0xa807('0xb')](),controller[_0xa807('0x17')]);router[_0xa807('0x14')](_0xa807('0x18'),auth[_0xa807('0xb')](),controller[_0xa807('0x19')]);router[_0xa807('0x1a')](_0xa807('0xc'),auth[_0xa807('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 6dbdfdb..40c8782 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 _0xfe53=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x3ec4e3,_0x15aab4){var _0x38ee8c=function(_0x439303){while(--_0x439303){_0x3ec4e3['push'](_0x3ec4e3['shift']());}};_0x38ee8c(++_0x15aab4);}(_0xfe53,0x1c7));var _0x3fe5=function(_0x11b1b3,_0xf3cc69){_0x11b1b3=_0x11b1b3-0x0;var _0x437029=_0xfe53[_0x11b1b3];return _0x437029;};'use strict';var Sequelize=require(_0x3fe5('0x0'));module[_0x3fe5('0x1')]={'body':{'type':Sequelize[_0x3fe5('0x2')](_0x3fe5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3fe5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3fe5('0x5')]('in','out'),'defaultValue':_0x3fe5('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x3fe5('0x7')]},'readAt':{'type':Sequelize[_0x3fe5('0x8')]},'secret':{'type':Sequelize[_0x3fe5('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3fe5('0x7')]},'providerResponse':{'type':Sequelize[_0x3fe5('0x2')]}}; \ No newline at end of file +var _0xa433=['sequelize','exports','TEXT','medium','ENUM','out','STRING','DATE'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xa433,0x100));var _0x3a43=function(_0x4b45c5,_0x2a2c7b){_0x4b45c5=_0x4b45c5-0x0;var _0x3314f2=_0xa433[_0x4b45c5];return _0x3314f2;};'use strict';var Sequelize=require(_0x3a43('0x0'));module[_0x3a43('0x1')]={'body':{'type':Sequelize[_0x3a43('0x2')](_0x3a43('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3a43('0x4')]('in',_0x3a43('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x3a43('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x3a43('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3a43('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index e143b8c..42f2b88 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 _0x61f1=['WhatsappInteraction','WhatsappInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','interface','SIP/%s','channel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','WhatsappAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','stack','name','send','index','map','WhatsappMessage','type','key','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','show','include','find','create','body','params','describe','whatsapp-interactions','whatsapp','read','format','UserId','user','agent','CmContact','Contact'];(function(_0x3273e3,_0x587f59){var _0x37da75=function(_0x2de493){while(--_0x2de493){_0x3273e3['push'](_0x3273e3['shift']());}};_0x37da75(++_0x587f59);}(_0x61f1,0x18a));var _0x161f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x61f1[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x161f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x161f('0x1'));var jsonpatch=require(_0x161f('0x2'));var rp=require(_0x161f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x161f('0x4'));var util=require(_0x161f('0x5'));var path=require('path');var sox=require(_0x161f('0x6'));var csv=require(_0x161f('0x7'));var ejs=require(_0x161f('0x8'));var fs=require('fs');var _=require(_0x161f('0x9'));var squel=require(_0x161f('0xa'));var crypto=require('crypto');var jsforce=require(_0x161f('0xb'));var deskjs=require(_0x161f('0xc'));var toCsv=require(_0x161f('0x7'));var querystring=require(_0x161f('0xd'));var Papa=require(_0x161f('0xe'));var Redis=require(_0x161f('0xf'));var authService=require(_0x161f('0x10'));var qs=require(_0x161f('0x11'));var as=require(_0x161f('0x12'));var hardwareService=require(_0x161f('0x13'));var logger=require(_0x161f('0x14'))('api');var utils=require(_0x161f('0x15'));var config=require(_0x161f('0x16'));var licenseUtil=require(_0x161f('0x17'));var db=require(_0x161f('0x18'))['db'];config[_0x161f('0x19')]=_['defaults'](config[_0x161f('0x19')],{'host':_0x161f('0x1a'),'port':0x18eb});var socket=require(_0x161f('0x1b'))(new Redis(config[_0x161f('0x19')]));require('./whatsappMessage.socket')[_0x161f('0x1c')](socket);var jayson=require(_0x161f('0x1d'));var client=jayson[_0x161f('0x1e')][_0x161f('0x1f')]({'port':0x232c});var client9002=jayson[_0x161f('0x1e')][_0x161f('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x594742,_0x486261,_0x3270f3,_0x49dffc){return new BPromise(function(_0x189a95,_0x5aea99){var _0x325d4c=_0x49dffc||client;return _0x325d4c[_0x161f('0x20')](_0x594742,_0x3270f3)[_0x161f('0x21')](function(_0x561a13){logger[_0x161f('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x486261,_0x161f('0x23'));logger[_0x161f('0x24')](_0x161f('0x25'),_0x486261,_0x161f('0x23'),JSON[_0x161f('0x26')](_0x561a13));if(_0x561a13[_0x161f('0x27')]){if(_0x561a13[_0x161f('0x27')][_0x161f('0x28')]===0x1f4){logger[_0x161f('0x27')](_0x161f('0x29'),_0x486261,_0x561a13[_0x161f('0x27')][_0x161f('0x2a')]);return _0x5aea99(_0x561a13[_0x161f('0x27')]['message']);}logger[_0x161f('0x27')](_0x161f('0x29'),_0x486261,_0x561a13[_0x161f('0x27')]['message']);return _0x189a95(_0x561a13['error'][_0x161f('0x2a')]);}else{logger[_0x161f('0x22')](_0x161f('0x29'),_0x486261,_0x161f('0x23'));_0x189a95(_0x561a13[_0x161f('0x2b')]['message']);}})[_0x161f('0x2c')](function(_0x2b501f){logger[_0x161f('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x486261,_0x2b501f);_0x5aea99(_0x2b501f);});});}function respondWithStatusCode(_0x157709,_0x378423){_0x378423=_0x378423||0xcc;return function(_0xe900b0){if(_0xe900b0){return _0x157709[_0x161f('0x2d')](_0x378423);}return _0x157709[_0x161f('0x2e')](_0x378423)[_0x161f('0x2f')]();};}function respondWithResult(_0x561025,_0x168b66){_0x168b66=_0x168b66||0xc8;return function(_0x625125){if(_0x625125){return _0x561025[_0x161f('0x2e')](_0x168b66)[_0x161f('0x30')](_0x625125);}};}function respondWithFilteredResult(_0x94935,_0xc3a866){return function(_0x589793){if(_0x589793){var _0x18e910=_0x589793[_0x161f('0x31')],_0x3c5717=_0xc3a866[_0x161f('0x32')],_0x264d09=_0xc3a866[_0x161f('0x32')]+_0xc3a866[_0x161f('0x33')],_0x4fbf5f;if(_0x264d09>=_0x18e910){_0x264d09=_0x18e910;_0x4fbf5f=0xc8;}else{_0x4fbf5f=0xce;}_0x94935[_0x161f('0x2e')](_0x4fbf5f);return _0x94935[_0x161f('0x34')](_0x161f('0x35'),_0x3c5717+'-'+_0x264d09+'/'+_0x18e910)[_0x161f('0x30')](_0x589793);}return null;};}function patchUpdates(_0x498628){return function(_0x494d8c){try{jsonpatch[_0x161f('0x36')](_0x494d8c,_0x498628,!![]);}catch(_0x3d4dd0){return BPromise[_0x161f('0x37')](_0x3d4dd0);}return _0x494d8c['save']();};}function saveUpdates(_0x5b24b3,_0x596abf){return function(_0x1ec678){if(_0x1ec678){return _0x1ec678[_0x161f('0x38')](_0x5b24b3)['then'](function(_0x229e33){return _0x229e33;});}return null;};}function removeEntity(_0x115242,_0x3db55f){return function(_0x35d318){if(_0x35d318){return _0x35d318['destroy']()[_0x161f('0x21')](function(){_0x115242['status'](0xcc)[_0x161f('0x2f')]();});}};}function handleEntityNotFound(_0x3ffdb8,_0xacbbd0){return function(_0x476626){if(!_0x476626){_0x3ffdb8[_0x161f('0x2d')](0x194);}return _0x476626;};}function handleError(_0x187304,_0x222410){_0x222410=_0x222410||0x1f4;return function(_0x39aa6f){logger[_0x161f('0x27')](_0x39aa6f[_0x161f('0x39')]);if(_0x39aa6f['name']){delete _0x39aa6f[_0x161f('0x3a')];}_0x187304['status'](_0x222410)[_0x161f('0x3b')](_0x39aa6f);};}exports[_0x161f('0x3c')]=function(_0x4ebf4d,_0x3985bc){var _0x288124={},_0x2ab370={},_0x35be8b={'count':0x0,'rows':[]};var _0x56959d=_[_0x161f('0x3d')](db[_0x161f('0x3e')]['rawAttributes'],function(_0x4f185d){return{'name':_0x4f185d['fieldName'],'type':_0x4f185d[_0x161f('0x3f')][_0x161f('0x40')]};});_0x2ab370['model']=_[_0x161f('0x3d')](_0x56959d,'name');_0x2ab370['query']=_[_0x161f('0x41')](_0x4ebf4d[_0x161f('0x42')]);_0x2ab370[_0x161f('0x43')]=_['intersection'](_0x2ab370[_0x161f('0x44')],_0x2ab370[_0x161f('0x42')]);_0x288124[_0x161f('0x45')]=_[_0x161f('0x46')](_0x2ab370[_0x161f('0x44')],qs[_0x161f('0x47')](_0x4ebf4d[_0x161f('0x42')][_0x161f('0x47')]));_0x288124[_0x161f('0x45')]=_0x288124[_0x161f('0x45')][_0x161f('0x48')]?_0x288124[_0x161f('0x45')]:_0x2ab370[_0x161f('0x44')];if(!_0x4ebf4d['query']['hasOwnProperty'](_0x161f('0x49'))){_0x288124[_0x161f('0x33')]=qs[_0x161f('0x33')](_0x4ebf4d[_0x161f('0x42')]['limit']);_0x288124[_0x161f('0x32')]=qs[_0x161f('0x32')](_0x4ebf4d[_0x161f('0x42')][_0x161f('0x32')]);}_0x288124[_0x161f('0x4a')]=qs[_0x161f('0x4b')](_0x4ebf4d[_0x161f('0x42')]['sort']);_0x288124[_0x161f('0x4c')]=qs[_0x161f('0x43')](_['pick'](_0x4ebf4d['query'],_0x2ab370[_0x161f('0x43')]),_0x56959d);if(_0x4ebf4d['query'][_0x161f('0x4d')]){_0x288124[_0x161f('0x4c')]=_[_0x161f('0x4e')](_0x288124[_0x161f('0x4c')],{'$or':_[_0x161f('0x3d')](_0x56959d,function(_0x3827cd){if(_0x3827cd[_0x161f('0x3f')]!==_0x161f('0x4f')){var _0x58a693={};_0x58a693[_0x3827cd[_0x161f('0x3a')]]={'$like':'%'+_0x4ebf4d[_0x161f('0x42')][_0x161f('0x4d')]+'%'};return _0x58a693;}})});}_0x288124=_[_0x161f('0x4e')]({},_0x288124,_0x4ebf4d[_0x161f('0x50')]);var _0x4174ed={'where':_0x288124['where']};return db[_0x161f('0x3e')][_0x161f('0x31')](_0x4174ed)[_0x161f('0x21')](function(_0x2b056c){_0x35be8b[_0x161f('0x31')]=_0x2b056c;if(_0x4ebf4d['query']['includeAll']){_0x288124['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x161f('0x51')](_0x288124);})['then'](function(_0x1741ed){_0x35be8b['rows']=_0x1741ed;return _0x35be8b;})[_0x161f('0x21')](respondWithFilteredResult(_0x3985bc,_0x288124))[_0x161f('0x2c')](handleError(_0x3985bc,null));};exports[_0x161f('0x52')]=function(_0x4d6644,_0x3a0c86){var _0x40bde3={'raw':!![],'where':{'id':_0x4d6644['params']['id']}},_0x5b2e7e={};_0x5b2e7e[_0x161f('0x44')]=_['keys'](db[_0x161f('0x3e')]['rawAttributes']);_0x5b2e7e[_0x161f('0x42')]=_[_0x161f('0x41')](_0x4d6644[_0x161f('0x42')]);_0x5b2e7e[_0x161f('0x43')]=_[_0x161f('0x46')](_0x5b2e7e[_0x161f('0x44')],_0x5b2e7e[_0x161f('0x42')]);_0x40bde3[_0x161f('0x45')]=_[_0x161f('0x46')](_0x5b2e7e[_0x161f('0x44')],qs[_0x161f('0x47')](_0x4d6644[_0x161f('0x42')][_0x161f('0x47')]));_0x40bde3[_0x161f('0x45')]=_0x40bde3[_0x161f('0x45')][_0x161f('0x48')]?_0x40bde3[_0x161f('0x45')]:_0x5b2e7e['model'];if(_0x4d6644['query']['includeAll']){_0x40bde3[_0x161f('0x53')]=[{'all':!![]}];}_0x40bde3=_[_0x161f('0x4e')]({},_0x40bde3,_0x4d6644[_0x161f('0x50')]);return db[_0x161f('0x3e')][_0x161f('0x54')](_0x40bde3)[_0x161f('0x21')](handleEntityNotFound(_0x3a0c86,null))[_0x161f('0x21')](respondWithResult(_0x3a0c86,null))[_0x161f('0x2c')](handleError(_0x3a0c86,null));};exports[_0x161f('0x55')]=function(_0x1a7930,_0x40183b){return db['WhatsappMessage'][_0x161f('0x55')](_0x1a7930[_0x161f('0x56')],{})['then'](respondWithResult(_0x40183b,0xc9))[_0x161f('0x2c')](handleError(_0x40183b,null));};exports[_0x161f('0x38')]=function(_0xd06afc,_0x4528b3){if(_0xd06afc[_0x161f('0x56')]['id']){delete _0xd06afc[_0x161f('0x56')]['id'];}return db[_0x161f('0x3e')][_0x161f('0x54')]({'where':{'id':_0xd06afc[_0x161f('0x57')]['id']}})['then'](handleEntityNotFound(_0x4528b3,null))[_0x161f('0x21')](saveUpdates(_0xd06afc[_0x161f('0x56')],null))[_0x161f('0x21')](respondWithResult(_0x4528b3,null))[_0x161f('0x2c')](handleError(_0x4528b3,null));};exports['destroy']=function(_0x57cbfa,_0x28f63b){return db[_0x161f('0x3e')]['find']({'where':{'id':_0x57cbfa[_0x161f('0x57')]['id']}})[_0x161f('0x21')](handleEntityNotFound(_0x28f63b,null))[_0x161f('0x21')](removeEntity(_0x28f63b,null))['catch'](handleError(_0x28f63b,null));};exports[_0x161f('0x58')]=function(_0x431534,_0x31d6c2){return db['WhatsappMessage'][_0x161f('0x58')]()[_0x161f('0x21')](respondWithResult(_0x31d6c2,null))['catch'](handleError(_0x31d6c2,null));};var interaction_log=require(_0x161f('0x14'))(_0x161f('0x59'));exports['accept']=function(_0x253ae2,_0x1dd142,_0x49236b){var _0x4b7c39={'agent':{},'channel':_0x161f('0x5a')};if(_0x253ae2[_0x161f('0x56')]['id']){delete _0x253ae2[_0x161f('0x56')]['id'];}_0x253ae2['body'][_0x161f('0x5b')]=!![];_0x253ae2[_0x161f('0x56')]['readAt']=moment()[_0x161f('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x253ae2[_0x161f('0x56')][_0x161f('0x5d')]=_0x253ae2['body'][_0x161f('0x5d')]||_0x253ae2[_0x161f('0x5e')]['id'];_0x4b7c39[_0x161f('0x5f')]['id']=_0x253ae2[_0x161f('0x56')][_0x161f('0x5d')];return db[_0x161f('0x3e')][_0x161f('0x54')]({'where':{'id':_0x253ae2[_0x161f('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x161f('0x60')],'as':_0x161f('0x61')}]})[_0x161f('0x21')](handleEntityNotFound(_0x1dd142,null))['then'](saveUpdates(_0x253ae2[_0x161f('0x56')],null))[_0x161f('0x21')](function(_0x39ece7){if(_0x39ece7){_0x4b7c39['message']=_0x39ece7['get']({'plain':!![]});return db[_0x161f('0x62')][_0x161f('0x54')]({'where':{'id':_0x39ece7[_0x161f('0x63')]}});}return null;})[_0x161f('0x21')](handleEntityNotFound(_0x1dd142,null))['then'](function(_0x3ecf0e){if(_0x3ecf0e){return _0x3ecf0e[_0x161f('0x38')]({'UserId':_0x253ae2[_0x161f('0x56')][_0x161f('0x5d')],'read1stAt':_['isNil'](_0x3ecf0e[_0x161f('0x64')])?moment()[_0x161f('0x5c')](_0x161f('0x65')):undefined});}return null;})[_0x161f('0x21')](function(_0x344f6f){if(_0x344f6f){_0x4b7c39[_0x161f('0x66')]=_0x344f6f[_0x161f('0x67')]({'plain':!![]});interaction_log[_0x161f('0x22')](_0x161f('0x68'),_0x253ae2['user']['id'],_0x253ae2[_0x161f('0x5e')][_0x161f('0x3a')],_0x253ae2[_0x161f('0x5e')][_0x161f('0x69')],_0x4b7c39[_0x161f('0x66')]['id'],_0x253ae2['body']?JSON['stringify'](_0x253ae2[_0x161f('0x56')]):_0x161f('0x6a'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x4b7c39);}return null;})[_0x161f('0x21')](function(_0x4b5cec){if(_0x4b5cec){if(_0x253ae2[_0x161f('0x56')][_0x161f('0x6b')]){_0x4b7c39['message'][_0x161f('0x6c')]=util[_0x161f('0x5c')](_0x161f('0x6d'),_0x253ae2[_0x161f('0x5e')][_0x161f('0x3a')]);_0x4b7c39[_0x161f('0x2a')][_0x161f('0x6e')]=_0x4b7c39[_0x161f('0x6e')];_0x4b7c39[_0x161f('0x2a')]['event']='accept';return respondWithRpcPromise(_0x161f('0x6f'),'EventManager',{'event':_0x161f('0x70'),'message':_0x4b7c39['message']},client9002)[_0x161f('0x21')](function(){return _0x4b7c39;});}return _0x4b7c39;}return null;})[_0x161f('0x21')](respondWithResult(_0x1dd142,null))[_0x161f('0x2c')](handleError(_0x1dd142,null));};var interaction_log=require(_0x161f('0x14'))(_0x161f('0x59'));exports['reject']=function(_0x868083,_0x2b131d,_0x4f2bd6){var _0x113cc1={'agent':{},'channel':_0x161f('0x5a')};if(_0x868083[_0x161f('0x56')]['id']){delete _0x868083[_0x161f('0x56')]['id'];}_0x868083['body'][_0x161f('0x5d')]=_0x868083[_0x161f('0x56')][_0x161f('0x5d')]||_0x868083[_0x161f('0x5e')]['id'];_0x113cc1[_0x161f('0x5f')]['id']=_0x868083['body']['UserId'];return db['WhatsappMessage'][_0x161f('0x54')]({'where':{'id':_0x868083['params']['id'],'UserId':null}})[_0x161f('0x21')](handleEntityNotFound(_0x2b131d,null))[_0x161f('0x21')](function(_0x5ebbb3){if(_0x5ebbb3){_0x113cc1[_0x161f('0x2a')]=_0x5ebbb3[_0x161f('0x67')]({'plain':!![]});return db[_0x161f('0x62')][_0x161f('0x54')]({'where':{'id':_0x5ebbb3[_0x161f('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x2b131d,null))[_0x161f('0x21')](function(_0x4758bd){if(_0x4758bd){_0x113cc1['interaction']=_0x4758bd[_0x161f('0x67')]({'plain':!![]});interaction_log['info'](_0x161f('0x71'),_0x868083[_0x161f('0x5e')]['id'],_0x868083[_0x161f('0x5e')]['name'],_0x868083[_0x161f('0x5e')]['role'],_0x113cc1[_0x161f('0x66')]['id'],_0x868083[_0x161f('0x56')]?JSON['stringify'](_0x868083[_0x161f('0x56')]):_0x161f('0x6a'));return respondWithRpcPromise(_0x161f('0x72'),_0x161f('0x73'),_0x113cc1);}return null;})['then'](function(_0x167a1b){if(_0x167a1b){_0x167a1b[_0x161f('0x2a')][_0x161f('0x6c')]=util[_0x161f('0x5c')](_0x161f('0x6d'),_0x868083['user'][_0x161f('0x3a')]);_0x167a1b['message'][_0x161f('0x6e')]=_0x113cc1[_0x161f('0x6e')];_0x167a1b['message']['event']=_0x161f('0x37');respondWithRpcPromise(_0x161f('0x6f'),_0x161f('0x6f'),{'event':'rejectmessage','message':_0x167a1b['message']},client9002);return _0x113cc1;}return null;})[_0x161f('0x21')](respondWithResult(_0x2b131d,null))['catch'](handleError(_0x2b131d,null));};exports[_0x161f('0x2e')]=function(_0x102d44,_0x35140a,_0x8bf19){if(_0x102d44[_0x161f('0x56')]['id']){delete _0x102d44[_0x161f('0x56')]['id'];}var _0x34dc06;return db[_0x161f('0x3e')][_0x161f('0x54')]({'where':{'id':_0x102d44[_0x161f('0x57')]['id']}})[_0x161f('0x21')](handleEntityNotFound(_0x35140a,null))[_0x161f('0x21')](function(_0x4aa6a3){if(_0x4aa6a3){_0x34dc06=_0x4aa6a3;return db[_0x161f('0x74')][_0x161f('0x54')]({'where':{'id':_0x4aa6a3['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x35140a,null))[_0x161f('0x21')](function(_0x3339af){if(_0x3339af){logger[_0x161f('0x24')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x161f('0x2e'),_0x161f('0x75'),_0x3339af[_0x161f('0x3f')],util[_0x161f('0x76')](_0x102d44[_0x161f('0x56')],{'showHidden':![],'depth':null}));switch(_0x3339af['type']){case _0x161f('0x77'):if(_0x102d44[_0x161f('0x56')][_0x161f('0x78')]&&_0x102d44[_0x161f('0x56')][_0x161f('0x78')]===_0x34dc06[_0x161f('0x79')]&&_0x102d44[_0x161f('0x56')][_0x161f('0x7a')]&&_0x102d44[_0x161f('0x56')]['MessageStatus']===_0x161f('0x5b')){return _0x34dc06[_0x161f('0x38')]({'read':!![]});}else{logger[_0x161f('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x161f('0x2e'),_0x161f('0x77'),util['inspect'](_0x102d44['body'],{'showHidden':![],'depth':null}));}break;}return _0x34dc06;}})['then'](respondWithResult(_0x35140a,null))['catch'](handleError(_0x35140a,null));}; \ No newline at end of file +var _0xfa94=['jayson/promise','client','http','request','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','WhatsappMessage','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','rows','show','rawAttributes','includeAll','include','find','create','body','params','describe','whatsapp-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','acceptmessage','whatsapp','RejectMessage','rejectMessage','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','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','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xfa94,0xef));var _0x4fa9=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0xfa94[_0x3cc9d9];return _0x1a425d;};'use strict';var pdf=require(_0x4fa9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4fa9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4fa9('0x2'));var rp=require(_0x4fa9('0x3'));var moment=require('moment');var BPromise=require(_0x4fa9('0x4'));var Mustache=require(_0x4fa9('0x5'));var util=require(_0x4fa9('0x6'));var path=require(_0x4fa9('0x7'));var sox=require(_0x4fa9('0x8'));var csv=require(_0x4fa9('0x9'));var ejs=require(_0x4fa9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4fa9('0xb'));var crypto=require(_0x4fa9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4fa9('0x9'));var querystring=require('querystring');var Papa=require(_0x4fa9('0xd'));var Redis=require(_0x4fa9('0xe'));var authService=require(_0x4fa9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4fa9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fa9('0x11'))(_0x4fa9('0x12'));var utils=require('../../config/utils');var config=require(_0x4fa9('0x13'));var licenseUtil=require(_0x4fa9('0x14'));var db=require(_0x4fa9('0x15'))['db'];config['redis']=_[_0x4fa9('0x16')](config['redis'],{'host':_0x4fa9('0x17'),'port':0x18eb});var socket=require(_0x4fa9('0x18'))(new Redis(config['redis']));require(_0x4fa9('0x19'))[_0x4fa9('0x1a')](socket);var jayson=require(_0x4fa9('0x1b'));var client=jayson[_0x4fa9('0x1c')][_0x4fa9('0x1d')]({'port':0x232c});var client9002=jayson[_0x4fa9('0x1c')][_0x4fa9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2c28be,_0x328770,_0x4ef6d8,_0x19ea1b){return new BPromise(function(_0x1a1117,_0x4c164f){var _0x56cf7d=_0x19ea1b||client;return _0x56cf7d[_0x4fa9('0x1e')](_0x2c28be,_0x4ef6d8)['then'](function(_0x2fe920){logger[_0x4fa9('0x1f')]('WhatsappMessage,\x20%s,\x20%s',_0x328770,_0x4fa9('0x20'));logger['debug'](_0x4fa9('0x21'),_0x328770,_0x4fa9('0x20'),JSON[_0x4fa9('0x22')](_0x2fe920));if(_0x2fe920[_0x4fa9('0x23')]){if(_0x2fe920[_0x4fa9('0x23')]['code']===0x1f4){logger[_0x4fa9('0x23')](_0x4fa9('0x24'),_0x328770,_0x2fe920[_0x4fa9('0x23')]['message']);return _0x4c164f(_0x2fe920[_0x4fa9('0x23')][_0x4fa9('0x25')]);}logger[_0x4fa9('0x23')](_0x4fa9('0x24'),_0x328770,_0x2fe920[_0x4fa9('0x23')][_0x4fa9('0x25')]);return _0x1a1117(_0x2fe920[_0x4fa9('0x23')][_0x4fa9('0x25')]);}else{logger[_0x4fa9('0x1f')](_0x4fa9('0x24'),_0x328770,_0x4fa9('0x20'));_0x1a1117(_0x2fe920[_0x4fa9('0x26')][_0x4fa9('0x25')]);}})[_0x4fa9('0x27')](function(_0x1d00c9){logger[_0x4fa9('0x23')](_0x4fa9('0x24'),_0x328770,_0x1d00c9);_0x4c164f(_0x1d00c9);});});}function respondWithStatusCode(_0x1e5836,_0x1fe8ba){_0x1fe8ba=_0x1fe8ba||0xcc;return function(_0x31a3fb){if(_0x31a3fb){return _0x1e5836['sendStatus'](_0x1fe8ba);}return _0x1e5836[_0x4fa9('0x28')](_0x1fe8ba)[_0x4fa9('0x29')]();};}function respondWithResult(_0x12f169,_0xdeffbf){_0xdeffbf=_0xdeffbf||0xc8;return function(_0x9bc956){if(_0x9bc956){return _0x12f169[_0x4fa9('0x28')](_0xdeffbf)[_0x4fa9('0x2a')](_0x9bc956);}};}function respondWithFilteredResult(_0x5545b9,_0x384d4e){return function(_0x1185df){if(_0x1185df){var _0x13cf76=_0x1185df[_0x4fa9('0x2b')],_0x383d27=_0x384d4e[_0x4fa9('0x2c')],_0x112673=_0x384d4e[_0x4fa9('0x2c')]+_0x384d4e[_0x4fa9('0x2d')],_0xb9fed8;if(_0x112673>=_0x13cf76){_0x112673=_0x13cf76;_0xb9fed8=0xc8;}else{_0xb9fed8=0xce;}_0x5545b9[_0x4fa9('0x28')](_0xb9fed8);return _0x5545b9[_0x4fa9('0x2e')](_0x4fa9('0x2f'),_0x383d27+'-'+_0x112673+'/'+_0x13cf76)[_0x4fa9('0x2a')](_0x1185df);}return null;};}function patchUpdates(_0x29b2a2){return function(_0x1fa94e){try{jsonpatch[_0x4fa9('0x30')](_0x1fa94e,_0x29b2a2,!![]);}catch(_0x54cd8d){return BPromise[_0x4fa9('0x31')](_0x54cd8d);}return _0x1fa94e[_0x4fa9('0x32')]();};}function saveUpdates(_0x224297,_0x96945){return function(_0x4163f4){if(_0x4163f4){return _0x4163f4[_0x4fa9('0x33')](_0x224297)['then'](function(_0x1c3838){return _0x1c3838;});}return null;};}function removeEntity(_0x2fe7d3,_0x3f8846){return function(_0x515ba3){if(_0x515ba3){return _0x515ba3[_0x4fa9('0x34')]()['then'](function(){_0x2fe7d3['status'](0xcc)[_0x4fa9('0x29')]();});}};}function handleEntityNotFound(_0x591844,_0x3d5739){return function(_0x2b80de){if(!_0x2b80de){_0x591844[_0x4fa9('0x35')](0x194);}return _0x2b80de;};}function handleError(_0x58c70c,_0x4edfa3){_0x4edfa3=_0x4edfa3||0x1f4;return function(_0xa0533f){logger[_0x4fa9('0x23')](_0xa0533f[_0x4fa9('0x36')]);if(_0xa0533f['name']){delete _0xa0533f[_0x4fa9('0x37')];}_0x58c70c[_0x4fa9('0x28')](_0x4edfa3)[_0x4fa9('0x38')](_0xa0533f);};}exports[_0x4fa9('0x39')]=function(_0x3f35ff,_0x43ed7f){var _0x27e935={},_0x8f38a1={},_0x32ab34={'count':0x0,'rows':[]};var _0x389058=_[_0x4fa9('0x3a')](db[_0x4fa9('0x3b')]['rawAttributes'],function(_0x4022fd){return{'name':_0x4022fd['fieldName'],'type':_0x4022fd['type'][_0x4fa9('0x3c')]};});_0x8f38a1['model']=_['map'](_0x389058,'name');_0x8f38a1[_0x4fa9('0x3d')]=_[_0x4fa9('0x3e')](_0x3f35ff['query']);_0x8f38a1[_0x4fa9('0x3f')]=_['intersection'](_0x8f38a1['model'],_0x8f38a1[_0x4fa9('0x3d')]);_0x27e935[_0x4fa9('0x40')]=_[_0x4fa9('0x41')](_0x8f38a1[_0x4fa9('0x42')],qs[_0x4fa9('0x43')](_0x3f35ff[_0x4fa9('0x3d')][_0x4fa9('0x43')]));_0x27e935['attributes']=_0x27e935['attributes'][_0x4fa9('0x44')]?_0x27e935['attributes']:_0x8f38a1[_0x4fa9('0x42')];if(!_0x3f35ff[_0x4fa9('0x3d')][_0x4fa9('0x45')](_0x4fa9('0x46'))){_0x27e935['limit']=qs[_0x4fa9('0x2d')](_0x3f35ff['query'][_0x4fa9('0x2d')]);_0x27e935[_0x4fa9('0x2c')]=qs[_0x4fa9('0x2c')](_0x3f35ff[_0x4fa9('0x3d')][_0x4fa9('0x2c')]);}_0x27e935[_0x4fa9('0x47')]=qs[_0x4fa9('0x48')](_0x3f35ff[_0x4fa9('0x3d')]['sort']);_0x27e935[_0x4fa9('0x49')]=qs[_0x4fa9('0x3f')](_[_0x4fa9('0x4a')](_0x3f35ff['query'],_0x8f38a1[_0x4fa9('0x3f')]),_0x389058);if(_0x3f35ff[_0x4fa9('0x3d')][_0x4fa9('0x4b')]){_0x27e935[_0x4fa9('0x49')]=_[_0x4fa9('0x4c')](_0x27e935[_0x4fa9('0x49')],{'$or':_[_0x4fa9('0x3a')](_0x389058,function(_0x1dfb3e){if(_0x1dfb3e[_0x4fa9('0x4d')]!==_0x4fa9('0x4e')){var _0xc2134d={};_0xc2134d[_0x1dfb3e[_0x4fa9('0x37')]]={'$like':'%'+_0x3f35ff['query'][_0x4fa9('0x4b')]+'%'};return _0xc2134d;}})});}_0x27e935=_[_0x4fa9('0x4c')]({},_0x27e935,_0x3f35ff[_0x4fa9('0x4f')]);var _0x168da7={'where':_0x27e935[_0x4fa9('0x49')]};return db[_0x4fa9('0x3b')][_0x4fa9('0x2b')](_0x168da7)[_0x4fa9('0x50')](function(_0x1d08dd){_0x32ab34[_0x4fa9('0x2b')]=_0x1d08dd;if(_0x3f35ff[_0x4fa9('0x3d')]['includeAll']){_0x27e935['include']=[{'all':!![]}];}return db[_0x4fa9('0x3b')]['findAll'](_0x27e935);})[_0x4fa9('0x50')](function(_0xbb7424){_0x32ab34[_0x4fa9('0x51')]=_0xbb7424;return _0x32ab34;})[_0x4fa9('0x50')](respondWithFilteredResult(_0x43ed7f,_0x27e935))[_0x4fa9('0x27')](handleError(_0x43ed7f,null));};exports[_0x4fa9('0x52')]=function(_0x5044b3,_0x569123){var _0x5ef25e={'raw':!![],'where':{'id':_0x5044b3['params']['id']}},_0x1404d6={};_0x1404d6[_0x4fa9('0x42')]=_[_0x4fa9('0x3e')](db[_0x4fa9('0x3b')][_0x4fa9('0x53')]);_0x1404d6['query']=_[_0x4fa9('0x3e')](_0x5044b3[_0x4fa9('0x3d')]);_0x1404d6['filters']=_[_0x4fa9('0x41')](_0x1404d6[_0x4fa9('0x42')],_0x1404d6[_0x4fa9('0x3d')]);_0x5ef25e[_0x4fa9('0x40')]=_[_0x4fa9('0x41')](_0x1404d6[_0x4fa9('0x42')],qs['fields'](_0x5044b3['query'][_0x4fa9('0x43')]));_0x5ef25e['attributes']=_0x5ef25e[_0x4fa9('0x40')][_0x4fa9('0x44')]?_0x5ef25e[_0x4fa9('0x40')]:_0x1404d6[_0x4fa9('0x42')];if(_0x5044b3[_0x4fa9('0x3d')][_0x4fa9('0x54')]){_0x5ef25e[_0x4fa9('0x55')]=[{'all':!![]}];}_0x5ef25e=_['merge']({},_0x5ef25e,_0x5044b3[_0x4fa9('0x4f')]);return db['WhatsappMessage'][_0x4fa9('0x56')](_0x5ef25e)[_0x4fa9('0x50')](handleEntityNotFound(_0x569123,null))[_0x4fa9('0x50')](respondWithResult(_0x569123,null))[_0x4fa9('0x27')](handleError(_0x569123,null));};exports[_0x4fa9('0x57')]=function(_0x464ab3,_0x5892db){return db['WhatsappMessage']['create'](_0x464ab3[_0x4fa9('0x58')],{})['then'](respondWithResult(_0x5892db,0xc9))[_0x4fa9('0x27')](handleError(_0x5892db,null));};exports[_0x4fa9('0x33')]=function(_0x300b32,_0x49f6b2){if(_0x300b32['body']['id']){delete _0x300b32['body']['id'];}return db['WhatsappMessage'][_0x4fa9('0x56')]({'where':{'id':_0x300b32['params']['id']}})[_0x4fa9('0x50')](handleEntityNotFound(_0x49f6b2,null))['then'](saveUpdates(_0x300b32[_0x4fa9('0x58')],null))[_0x4fa9('0x50')](respondWithResult(_0x49f6b2,null))[_0x4fa9('0x27')](handleError(_0x49f6b2,null));};exports[_0x4fa9('0x34')]=function(_0x3ca91e,_0xe05820){return db[_0x4fa9('0x3b')][_0x4fa9('0x56')]({'where':{'id':_0x3ca91e[_0x4fa9('0x59')]['id']}})[_0x4fa9('0x50')](handleEntityNotFound(_0xe05820,null))[_0x4fa9('0x50')](removeEntity(_0xe05820,null))[_0x4fa9('0x27')](handleError(_0xe05820,null));};exports['describe']=function(_0x5bb415,_0x104d3d){return db[_0x4fa9('0x3b')][_0x4fa9('0x5a')]()[_0x4fa9('0x50')](respondWithResult(_0x104d3d,null))['catch'](handleError(_0x104d3d,null));};var interaction_log=require('../../config/logger')(_0x4fa9('0x5b'));exports[_0x4fa9('0x5c')]=function(_0x1b0959,_0x35220e,_0x7d5325){var _0xea762d={'agent':{},'channel':'whatsapp'};if(_0x1b0959[_0x4fa9('0x58')]['id']){delete _0x1b0959[_0x4fa9('0x58')]['id'];}_0x1b0959[_0x4fa9('0x58')][_0x4fa9('0x5d')]=!![];_0x1b0959[_0x4fa9('0x58')]['readAt']=moment()[_0x4fa9('0x5e')](_0x4fa9('0x5f'));_0x1b0959[_0x4fa9('0x58')][_0x4fa9('0x60')]=_0x1b0959['body'][_0x4fa9('0x60')]||_0x1b0959[_0x4fa9('0x61')]['id'];_0xea762d[_0x4fa9('0x62')]['id']=_0x1b0959[_0x4fa9('0x58')][_0x4fa9('0x60')];return db[_0x4fa9('0x3b')]['find']({'where':{'id':_0x1b0959[_0x4fa9('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x4fa9('0x63')}]})[_0x4fa9('0x50')](handleEntityNotFound(_0x35220e,null))[_0x4fa9('0x50')](saveUpdates(_0x1b0959[_0x4fa9('0x58')],null))['then'](function(_0x1b0a7e){if(_0x1b0a7e){_0xea762d[_0x4fa9('0x25')]=_0x1b0a7e[_0x4fa9('0x64')]({'plain':!![]});return db[_0x4fa9('0x65')]['find']({'where':{'id':_0x1b0a7e[_0x4fa9('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x35220e,null))[_0x4fa9('0x50')](function(_0x58ea8d){if(_0x58ea8d){return _0x58ea8d[_0x4fa9('0x33')]({'UserId':_0x1b0959[_0x4fa9('0x58')][_0x4fa9('0x60')],'read1stAt':_[_0x4fa9('0x67')](_0x58ea8d[_0x4fa9('0x68')])?moment()[_0x4fa9('0x5e')](_0x4fa9('0x5f')):undefined});}return null;})['then'](function(_0x19ae7b){if(_0x19ae7b){_0xea762d['interaction']=_0x19ae7b[_0x4fa9('0x64')]({'plain':!![]});interaction_log['info'](_0x4fa9('0x69'),_0x1b0959[_0x4fa9('0x61')]['id'],_0x1b0959[_0x4fa9('0x61')][_0x4fa9('0x37')],_0x1b0959[_0x4fa9('0x61')][_0x4fa9('0x6a')],_0xea762d[_0x4fa9('0x6b')]['id'],_0x1b0959[_0x4fa9('0x58')]?JSON[_0x4fa9('0x22')](_0x1b0959[_0x4fa9('0x58')]):_0x4fa9('0x6c'));return respondWithRpcPromise(_0x4fa9('0x6d'),_0x4fa9('0x6e'),_0xea762d);}return null;})[_0x4fa9('0x50')](function(_0x39c6a2){if(_0x39c6a2){if(_0x1b0959[_0x4fa9('0x58')][_0x4fa9('0x6f')]){_0xea762d[_0x4fa9('0x25')][_0x4fa9('0x70')]=util[_0x4fa9('0x5e')](_0x4fa9('0x71'),_0x1b0959[_0x4fa9('0x61')][_0x4fa9('0x37')]);_0xea762d[_0x4fa9('0x25')][_0x4fa9('0x72')]=_0xea762d['channel'];_0xea762d['message']['event']='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x4fa9('0x73'),'message':_0xea762d[_0x4fa9('0x25')]},client9002)[_0x4fa9('0x50')](function(){return _0xea762d;});}return _0xea762d;}return null;})[_0x4fa9('0x50')](respondWithResult(_0x35220e,null))['catch'](handleError(_0x35220e,null));};var interaction_log=require(_0x4fa9('0x11'))(_0x4fa9('0x5b'));exports[_0x4fa9('0x31')]=function(_0x4a13c9,_0x357bd4,_0x225199){var _0x3b55e3={'agent':{},'channel':_0x4fa9('0x74')};if(_0x4a13c9[_0x4fa9('0x58')]['id']){delete _0x4a13c9[_0x4fa9('0x58')]['id'];}_0x4a13c9['body'][_0x4fa9('0x60')]=_0x4a13c9['body'][_0x4fa9('0x60')]||_0x4a13c9[_0x4fa9('0x61')]['id'];_0x3b55e3['agent']['id']=_0x4a13c9[_0x4fa9('0x58')][_0x4fa9('0x60')];return db[_0x4fa9('0x3b')]['find']({'where':{'id':_0x4a13c9['params']['id'],'UserId':null}})[_0x4fa9('0x50')](handleEntityNotFound(_0x357bd4,null))[_0x4fa9('0x50')](function(_0x4532df){if(_0x4532df){_0x3b55e3[_0x4fa9('0x25')]=_0x4532df['get']({'plain':!![]});return db[_0x4fa9('0x65')][_0x4fa9('0x56')]({'where':{'id':_0x4532df[_0x4fa9('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x357bd4,null))[_0x4fa9('0x50')](function(_0x257b07){if(_0x257b07){_0x3b55e3[_0x4fa9('0x6b')]=_0x257b07['get']({'plain':!![]});interaction_log[_0x4fa9('0x1f')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a13c9[_0x4fa9('0x61')]['id'],_0x4a13c9[_0x4fa9('0x61')][_0x4fa9('0x37')],_0x4a13c9[_0x4fa9('0x61')][_0x4fa9('0x6a')],_0x3b55e3['interaction']['id'],_0x4a13c9['body']?JSON[_0x4fa9('0x22')](_0x4a13c9[_0x4fa9('0x58')]):_0x4fa9('0x6c'));return respondWithRpcPromise(_0x4fa9('0x75'),_0x4fa9('0x76'),_0x3b55e3);}return null;})['then'](function(_0x5d2bbe){if(_0x5d2bbe){_0x5d2bbe[_0x4fa9('0x25')][_0x4fa9('0x70')]=util[_0x4fa9('0x5e')](_0x4fa9('0x71'),_0x4a13c9[_0x4fa9('0x61')][_0x4fa9('0x37')]);_0x5d2bbe['message'][_0x4fa9('0x72')]=_0x3b55e3[_0x4fa9('0x72')];_0x5d2bbe[_0x4fa9('0x25')][_0x4fa9('0x77')]=_0x4fa9('0x31');respondWithRpcPromise(_0x4fa9('0x78'),_0x4fa9('0x78'),{'event':_0x4fa9('0x79'),'message':_0x5d2bbe[_0x4fa9('0x25')]},client9002);return _0x3b55e3;}return null;})[_0x4fa9('0x50')](respondWithResult(_0x357bd4,null))[_0x4fa9('0x27')](handleError(_0x357bd4,null));};exports[_0x4fa9('0x28')]=function(_0x1b17ac,_0x2713db,_0x475521){if(_0x1b17ac[_0x4fa9('0x58')]['id']){delete _0x1b17ac[_0x4fa9('0x58')]['id'];}var _0x288204;return db['WhatsappMessage']['find']({'where':{'id':_0x1b17ac[_0x4fa9('0x59')]['id']}})[_0x4fa9('0x50')](handleEntityNotFound(_0x2713db,null))[_0x4fa9('0x50')](function(_0x3b4565){if(_0x3b4565){_0x288204=_0x3b4565;return db[_0x4fa9('0x7a')][_0x4fa9('0x56')]({'where':{'id':_0x3b4565[_0x4fa9('0x7b')]}});}})[_0x4fa9('0x50')](handleEntityNotFound(_0x2713db,null))[_0x4fa9('0x50')](function(_0x272901){if(_0x272901){logger[_0x4fa9('0x7c')](_0x4fa9('0x7d'),_0x4fa9('0x28'),_0x4fa9('0x7e'),_0x272901['type'],util[_0x4fa9('0x7f')](_0x1b17ac[_0x4fa9('0x58')],{'showHidden':![],'depth':null}));switch(_0x272901[_0x4fa9('0x4d')]){case _0x4fa9('0x80'):if(_0x1b17ac['body'][_0x4fa9('0x81')]&&_0x1b17ac[_0x4fa9('0x58')][_0x4fa9('0x81')]===_0x288204[_0x4fa9('0x82')]&&_0x1b17ac[_0x4fa9('0x58')][_0x4fa9('0x83')]&&_0x1b17ac[_0x4fa9('0x58')][_0x4fa9('0x83')]==='read'){return _0x288204[_0x4fa9('0x33')]({'read':!![]});}else{logger['error'](_0x4fa9('0x84'),_0x4fa9('0x28'),_0x4fa9('0x80'),util[_0x4fa9('0x7f')](_0x1b17ac[_0x4fa9('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x288204;}})[_0x4fa9('0x50')](respondWithResult(_0x2713db,null))['catch'](handleError(_0x2713db,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 34ef927..9f884bc 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(_0x3212c3,_0x2534a8){var _0x2234ae=function(_0x4165cd){while(--_0x4165cd){_0x3212c3['push'](_0x3212c3['shift']());}};_0x2234ae(++_0x2534a8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x46001d,_0x4a1ab6){_0x46001d=_0x46001d-0x0;var _0x57cb00=_0x5f2f[_0x46001d];return _0x57cb00;};'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(_0x35d7ce,_0x28e917){var _0x4da44c=function(_0x1450b7){while(--_0x1450b7){_0x35d7ce['push'](_0x35d7ce['shift']());}};_0x4da44c(++_0x28e917);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c5a79,_0x565097){_0x3c5a79=_0x3c5a79-0x0;var _0x52835f=_0xb10b[_0x3c5a79];return _0x52835f;};'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 6c00ebf..4f5e25d 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 _0x9429=['WhatsappInteraction','findOne','update','catch','direction','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','messageId','body','FULLTEXT','get','toLowerCase','out','secret','isNil','UserId'];(function(_0x242cde,_0xd2f987){var _0x313c44=function(_0x2bd8f3){while(--_0x2bd8f3){_0x242cde['push'](_0x242cde['shift']());}};_0x313c44(++_0xd2f987);}(_0x9429,0x1cc));var _0x9942=function(_0x223a73,_0x63ed95){_0x223a73=_0x223a73-0x0;var _0x57c249=_0x9429[_0x223a73];return _0x57c249;};'use strict';var _=require(_0x9942('0x0'));var util=require('util');var logger=require(_0x9942('0x1'))(_0x9942('0x2'));var moment=require(_0x9942('0x3'));var BPromise=require(_0x9942('0x4'));var rp=require(_0x9942('0x5'));var fs=require('fs');var path=require(_0x9942('0x6'));var rimraf=require(_0x9942('0x7'));var config=require(_0x9942('0x8'));var attributes=require(_0x9942('0x9'));module[_0x9942('0xa')]=function(_0x3213a5,_0x4adf09){return _0x3213a5['define']('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x9942('0xb'),'fields':[_0x9942('0xb')]},{'name':'fti_whatsapp_messages','fields':[_0x9942('0xc')],'type':_0x9942('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2bb5ec,_0x36ef2d,_0x5b1550){var _0x1ce0f9=_0x3213a5['models'];var _0x220917=_0x2bb5ec[_0x9942('0xe')]({'plain':!![]});if(_0x220917['direction'][_0x9942('0xf')]()==='in'||_0x220917['direction'][_0x9942('0xf')]()===_0x9942('0x10')&&!_0x220917[_0x9942('0x11')]&&!_[_0x9942('0x12')](_0x220917[_0x9942('0x13')])){_0x1ce0f9[_0x9942('0x14')][_0x9942('0x15')]({'where':{'id':_0x220917['WhatsappInteractionId']}})['then'](function(_0x456491){if(_0x456491){_0x456491[_0x9942('0x16')]({'lastMsgAt':_0x220917['createdAt'],'lastMsgDirection':_0x220917['direction'][_0x9942('0xf')]()});}})[_0x9942('0x17')](function(_0x324a91){console['error'](_0x324a91);});}if(_0x220917[_0x9942('0x18')]===_0x9942('0x10')&&!_0x220917['secret']){var _0x487d06;_0x1ce0f9[_0x9942('0x19')][_0x9942('0x1a')]({'where':{'id':_0x220917[_0x9942('0x1b')]},'raw':!![]})[_0x9942('0x1c')](function(_0x4ae8fd){_0x487d06=_0x4ae8fd;if(_0x487d06&&_0x487d06[_0x9942('0x1d')]){switch(_0x487d06['type']){case _0x9942('0x1e'):var _0x1769e6=require(_0x9942('0x1e'));if(_0x487d06[_0x9942('0x1f')]&&_0x487d06[_0x9942('0x20')]&&_0x487d06[_0x9942('0x21')]){var _0x2e65b5=new _0x1769e6(_0x487d06[_0x9942('0x1f')],_0x487d06[_0x9942('0x20')]);_0x2e65b5[_0x9942('0x22')][_0x9942('0x23')]({'body':_0x220917[_0x9942('0xc')],'to':_0x9942('0x24')+_0x220917['phone'],'from':_0x9942('0x24')+_0x487d06[_0x9942('0x21')],'statusCallback':_0x487d06[_0x9942('0x25')]+_0x9942('0x26')+_0x220917['id']+'/status?token='+_0x487d06[_0x9942('0x27')]})['then'](function(_0x4888e4){if(_0x4888e4[_0x9942('0x28')]){return _0x2bb5ec['update']({'messageId':_0x4888e4[_0x9942('0x28')]});}})[_0x9942('0x17')](function(_0x328150){logger[_0x9942('0x29')](_0x9942('0x2a'),'afterCreate',_0x9942('0x1e'),util[_0x9942('0x2b')](_0x328150,{'showHidden':![],'depth':null}));});}else{logger[_0x9942('0x29')](_0x9942('0x2a'),_0x9942('0x2c'),_0x9942('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x9942('0x2d')](function(){_0x5b1550();});}else{_0x5b1550();}}},'charset':_0x9942('0x2e'),'collate':_0x9942('0x2f')});}; \ No newline at end of file +var _0x4ab6=['models','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','update','createdAt','catch','error','secret','WhatsappAccount','WhatsappAccountId','then','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x4ab6,0xbc));var _0x64ab=function(_0x2d034d,_0x532a40){_0x2d034d=_0x2d034d-0x0;var _0x286474=_0x4ab6[_0x2d034d];return _0x286474;};'use strict';var _=require(_0x64ab('0x0'));var util=require(_0x64ab('0x1'));var logger=require('../../config/logger')(_0x64ab('0x2'));var moment=require(_0x64ab('0x3'));var BPromise=require('bluebird');var rp=require(_0x64ab('0x4'));var fs=require('fs');var path=require(_0x64ab('0x5'));var rimraf=require(_0x64ab('0x6'));var config=require(_0x64ab('0x7'));var attributes=require(_0x64ab('0x8'));module[_0x64ab('0x9')]=function(_0x59c578,_0xc922b4){return _0x59c578[_0x64ab('0xa')](_0x64ab('0xb'),attributes,{'tableName':_0x64ab('0xc'),'paranoid':![],'indexes':[{'name':_0x64ab('0xd'),'fields':[_0x64ab('0xd')]},{'name':_0x64ab('0xe'),'fields':[_0x64ab('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d18e2,_0x3158e6,_0x394202){var _0x299447=_0x59c578[_0x64ab('0x10')];var _0xdec25b=_0x1d18e2['get']({'plain':!![]});if(_0xdec25b[_0x64ab('0x11')][_0x64ab('0x12')]()==='in'||_0xdec25b[_0x64ab('0x11')][_0x64ab('0x12')]()===_0x64ab('0x13')&&!_0xdec25b['secret']&&!_[_0x64ab('0x14')](_0xdec25b[_0x64ab('0x15')])){_0x299447[_0x64ab('0x16')][_0x64ab('0x17')]({'where':{'id':_0xdec25b['WhatsappInteractionId']}})['then'](function(_0x5e21bd){if(_0x5e21bd){_0x5e21bd[_0x64ab('0x18')]({'lastMsgAt':_0xdec25b[_0x64ab('0x19')],'lastMsgDirection':_0xdec25b[_0x64ab('0x11')]['toLowerCase']()});}})[_0x64ab('0x1a')](function(_0x5856c1){console[_0x64ab('0x1b')](_0x5856c1);});}if(_0xdec25b['direction']===_0x64ab('0x13')&&!_0xdec25b[_0x64ab('0x1c')]){var _0x2c51e2;_0x299447[_0x64ab('0x1d')]['find']({'where':{'id':_0xdec25b[_0x64ab('0x1e')]},'raw':!![]})[_0x64ab('0x1f')](function(_0x5591be){_0x2c51e2=_0x5591be;if(_0x2c51e2&&_0x2c51e2[_0x64ab('0x20')]){switch(_0x2c51e2[_0x64ab('0x20')]){case'twilio':var _0x84a04=require(_0x64ab('0x21'));if(_0x2c51e2[_0x64ab('0x22')]&&_0x2c51e2[_0x64ab('0x23')]&&_0x2c51e2['phone']){var _0x173c8c=new _0x84a04(_0x2c51e2['accountSid'],_0x2c51e2['authToken']);_0x173c8c[_0x64ab('0x24')][_0x64ab('0x25')]({'body':_0xdec25b[_0x64ab('0xf')],'to':_0x64ab('0x26')+_0xdec25b[_0x64ab('0x27')],'from':'whatsapp:'+_0x2c51e2['phone'],'statusCallback':_0x2c51e2[_0x64ab('0x28')]+'/api/whatsapp/messages/'+_0xdec25b['id']+_0x64ab('0x29')+_0x2c51e2[_0x64ab('0x2a')]})[_0x64ab('0x1f')](function(_0x46de53){if(_0x46de53[_0x64ab('0x2b')]){return _0x1d18e2[_0x64ab('0x18')]({'messageId':_0x46de53[_0x64ab('0x2b')]});}})['catch'](function(_0x5d46a4){logger[_0x64ab('0x1b')](_0x64ab('0x2c'),'afterCreate','twilio',util[_0x64ab('0x2d')](_0x5d46a4,{'showHidden':![],'depth':null}));});}else{logger[_0x64ab('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x64ab('0x2e'),'twilio',_0x64ab('0x2f'));}break;}}})[_0x64ab('0x30')](function(){_0x394202();});}else{_0x394202();}}},'charset':_0x64ab('0x31'),'collate':_0x64ab('0x32')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index d01a7af..872f071 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 _0x7c79=['request','then','info','request\x20sent','code','error','WhatsappMessage,\x20%s,\x20%s','message','result','CreateWhatsappMessage','WhatsappMessage','body','options','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x554630,_0x1fd26d){var _0x252b1a=function(_0x14023b){while(--_0x14023b){_0x554630['push'](_0x554630['shift']());}};_0x252b1a(++_0x1fd26d);}(_0x7c79,0x8f));var _0x97c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c79[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x97c7('0x0'));var util=require(_0x97c7('0x1'));var moment=require(_0x97c7('0x2'));var BPromise=require(_0x97c7('0x3'));var rs=require(_0x97c7('0x4'));var fs=require('fs');var Redis=require(_0x97c7('0x5'));var db=require(_0x97c7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x97c7('0x7'))('rpc');var config=require(_0x97c7('0x8'));var jayson=require(_0x97c7('0x9'));var client=jayson[_0x97c7('0xa')][_0x97c7('0xb')]({'port':0x232a});config['redis']=_[_0x97c7('0xc')](config[_0x97c7('0xd')],{'host':_0x97c7('0xe'),'port':0x18eb});var socket=require(_0x97c7('0xf'))(new Redis(config[_0x97c7('0xd')]));require('./whatsappMessage.socket')[_0x97c7('0x10')](socket);function respondWithRpcPromise(_0x3aea86,_0x351a15,_0xcfd268){return new BPromise(function(_0x5dd2fc,_0x353acc){return client[_0x97c7('0x11')](_0x3aea86,_0xcfd268)[_0x97c7('0x12')](function(_0x101070){logger[_0x97c7('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x351a15,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x351a15,_0x97c7('0x14'),JSON['stringify'](_0x101070));if(_0x101070['error']){if(_0x101070['error'][_0x97c7('0x15')]===0x1f4){logger[_0x97c7('0x16')](_0x97c7('0x17'),_0x351a15,_0x101070[_0x97c7('0x16')][_0x97c7('0x18')]);return _0x353acc(_0x101070[_0x97c7('0x16')]['message']);}logger[_0x97c7('0x16')](_0x97c7('0x17'),_0x351a15,_0x101070[_0x97c7('0x16')][_0x97c7('0x18')]);return _0x5dd2fc(_0x101070[_0x97c7('0x16')][_0x97c7('0x18')]);}else{logger[_0x97c7('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x351a15,_0x97c7('0x14'));_0x5dd2fc(_0x101070[_0x97c7('0x19')][_0x97c7('0x18')]);}})['catch'](function(_0xeb3e1a){logger[_0x97c7('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x351a15,_0xeb3e1a);_0x353acc(_0xeb3e1a);});});}exports[_0x97c7('0x1a')]=function(_0x536ce5){var _0x3e4e90=this;return new Promise(function(_0x131632,_0x1ba22a){return db[_0x97c7('0x1b')]['create'](_0x536ce5[_0x97c7('0x1c')],{'raw':_0x536ce5[_0x97c7('0x1d')]?_0x536ce5[_0x97c7('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x97c7('0x12')](function(_0x4c4548){logger['info'](_0x97c7('0x1a'),_0x536ce5);logger[_0x97c7('0x1e')](_0x97c7('0x1a'),_0x536ce5,JSON[_0x97c7('0x1f')](_0x4c4548));_0x131632(_0x4c4548);})['catch'](function(_0x3c533){logger[_0x97c7('0x16')](_0x97c7('0x1a'),_0x3c533['message'],_0x536ce5);_0x1ba22a(_0x3e4e90[_0x97c7('0x16')](0x1f4,_0x3c533[_0x97c7('0x18')]));});});}; \ No newline at end of file +var _0x20d6=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','moment','bluebird','ioredis'];(function(_0x4cac6e,_0x20274c){var _0x542d73=function(_0xba3af8){while(--_0xba3af8){_0x4cac6e['push'](_0x4cac6e['shift']());}};_0x542d73(++_0x20274c);}(_0x20d6,0xf3));var _0x620d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x20d6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var moment=require(_0x620d('0x2'));var BPromise=require(_0x620d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x620d('0x4'));var db=require(_0x620d('0x5'))['db'];var utils=require(_0x620d('0x6'));var logger=require(_0x620d('0x7'))('rpc');var config=require(_0x620d('0x8'));var jayson=require(_0x620d('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x620d('0xa')]=_[_0x620d('0xb')](config[_0x620d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x620d('0xc'))(new Redis(config['redis']));require(_0x620d('0xd'))['register'](socket);function respondWithRpcPromise(_0x599c78,_0x442eda,_0x4d16ce){return new BPromise(function(_0x5bb8cc,_0x31ee89){return client[_0x620d('0xe')](_0x599c78,_0x4d16ce)[_0x620d('0xf')](function(_0x45c133){logger[_0x620d('0x10')](_0x620d('0x11'),_0x442eda,_0x620d('0x12'));logger[_0x620d('0x13')](_0x620d('0x14'),_0x442eda,_0x620d('0x12'),JSON[_0x620d('0x15')](_0x45c133));if(_0x45c133[_0x620d('0x16')]){if(_0x45c133[_0x620d('0x16')]['code']===0x1f4){logger['error'](_0x620d('0x11'),_0x442eda,_0x45c133[_0x620d('0x16')][_0x620d('0x17')]);return _0x31ee89(_0x45c133[_0x620d('0x16')][_0x620d('0x17')]);}logger[_0x620d('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x442eda,_0x45c133[_0x620d('0x16')][_0x620d('0x17')]);return _0x5bb8cc(_0x45c133['error']['message']);}else{logger[_0x620d('0x10')](_0x620d('0x11'),_0x442eda,'request\x20sent');_0x5bb8cc(_0x45c133[_0x620d('0x18')][_0x620d('0x17')]);}})[_0x620d('0x19')](function(_0x5c7fdb){logger['error'](_0x620d('0x11'),_0x442eda,_0x5c7fdb);_0x31ee89(_0x5c7fdb);});});}exports[_0x620d('0x1a')]=function(_0x4b593f){var _0x49bde9=this;return new Promise(function(_0x37c7c8,_0x18422b){return db[_0x620d('0x1b')]['create'](_0x4b593f[_0x620d('0x1c')],{'raw':_0x4b593f['options']?_0x4b593f[_0x620d('0x1d')][_0x620d('0x1e')]===undefined?!![]:![]:!![]})[_0x620d('0xf')](function(_0x2f1aa1){logger[_0x620d('0x10')]('CreateWhatsappMessage',_0x4b593f);logger['debug'](_0x620d('0x1a'),_0x4b593f,JSON[_0x620d('0x15')](_0x2f1aa1));_0x37c7c8(_0x2f1aa1);})['catch'](function(_0x1476ac){logger['error'](_0x620d('0x1a'),_0x1476ac[_0x620d('0x17')],_0x4b593f);_0x18422b(_0x49bde9[_0x620d('0x16')](0x1f4,_0x1476ac[_0x620d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 006832e..282c282 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 _0x6e4a=['whatsappMessage:','./whatsappMessage.events','save','update','emit','removeListener','register'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x6e4a,0x14a));var _0xa6e4=function(_0x58767d,_0x1a1495){_0x58767d=_0x58767d-0x0;var _0x2178b3=_0x6e4a[_0x58767d];return _0x2178b3;};'use strict';var WhatsappMessageEvents=require(_0xa6e4('0x0'));var events=[_0xa6e4('0x1'),'remove',_0xa6e4('0x2')];function createListener(_0x7b7ea,_0x3ae968){return function(_0x4a3da8){_0x3ae968[_0xa6e4('0x3')](_0x7b7ea,_0x4a3da8);};}function removeListener(_0x5d4915,_0x5988c5){return function(){WhatsappMessageEvents[_0xa6e4('0x4')](_0x5d4915,_0x5988c5);};}exports[_0xa6e4('0x5')]=function(_0x3d49e0){for(var _0x12bfe2=0x0,_0x5c4a7f=events['length'];_0x12bfe2<_0x5c4a7f;_0x12bfe2++){var _0x27b651=events[_0x12bfe2];var _0x40cf09=createListener(_0xa6e4('0x6')+_0x27b651,_0x3d49e0);WhatsappMessageEvents['on'](_0x27b651,_0x40cf09);}}; \ No newline at end of file +var _0x0e6f=['removeListener','register','length','remove','update','emit'];(function(_0x52186d,_0x48a00a){var _0x4e44d9=function(_0x1e1df2){while(--_0x1e1df2){_0x52186d['push'](_0x52186d['shift']());}};_0x4e44d9(++_0x48a00a);}(_0x0e6f,0x1b3));var _0xf0e6=function(_0x37e307,_0x378e6c){_0x37e307=_0x37e307-0x0;var _0x44a38c=_0x0e6f[_0x37e307];return _0x44a38c;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0xf0e6('0x0'),_0xf0e6('0x1')];function createListener(_0x2d8f36,_0x2649c0){return function(_0x8524b2){_0x2649c0[_0xf0e6('0x2')](_0x2d8f36,_0x8524b2);};}function removeListener(_0x43648e,_0x55441c){return function(){WhatsappMessageEvents[_0xf0e6('0x3')](_0x43648e,_0x55441c);};}exports[_0xf0e6('0x4')]=function(_0x281912){for(var _0x43b3c7=0x0,_0x49861d=events[_0xf0e6('0x5')];_0x43b3c7<_0x49861d;_0x43b3c7++){var _0x57d53a=events[_0x43b3c7];var _0x347d94=createListener('whatsappMessage:'+_0x57d53a,_0x281912);WhatsappMessageEvents['on'](_0x57d53a,_0x347d94);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 5d71cc8..5ca7ee3 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 _0xd3f7=['delete','destroy','removeTeams','removeAgents','exports','multer','path','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update'];(function(_0x1ed996,_0x2872f7){var _0x3681c5=function(_0xc09a1){while(--_0xc09a1){_0x1ed996['push'](_0x1ed996['shift']());}};_0x3681c5(++_0x2872f7);}(_0xd3f7,0x131));var _0x7d3f=function(_0x1f9f5f,_0x509fb7){_0x1f9f5f=_0x1f9f5f-0x0;var _0x51d649=_0xd3f7[_0x1f9f5f];return _0x51d649;};'use strict';var multer=require(_0x7d3f('0x0'));var util=require('util');var path=require(_0x7d3f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7d3f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x7d3f('0x3'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x7d3f('0x4')]('/',auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x6')]);router[_0x7d3f('0x4')](_0x7d3f('0x7'),auth['isAuthenticated'](),controller[_0x7d3f('0x8')]);router[_0x7d3f('0x4')](_0x7d3f('0x9'),auth['isAuthenticated'](),controller[_0x7d3f('0xa')]);router[_0x7d3f('0x4')]('/:id/members',auth[_0x7d3f('0x5')](),controller['getMembers']);router[_0x7d3f('0x4')](_0x7d3f('0xb'),auth[_0x7d3f('0x5')](),controller['getTeams']);router['get'](_0x7d3f('0xc'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0xd')]);router[_0x7d3f('0xe')]('/',auth[_0x7d3f('0x5')](),controller[_0x7d3f('0xf')]);router[_0x7d3f('0xe')](_0x7d3f('0xb'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x10')]);router['post'](_0x7d3f('0xc'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x11')]);router[_0x7d3f('0x12')](_0x7d3f('0x9'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x13')]);router[_0x7d3f('0x14')](_0x7d3f('0x9'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x15')]);router['delete'](_0x7d3f('0xb'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x16')]);router[_0x7d3f('0x14')](_0x7d3f('0xc'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x17')]);module[_0x7d3f('0x18')]=router; \ No newline at end of file +var _0x9b26=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','update','delete','removeTeams','removeAgents','multer','util'];(function(_0x21d2a2,_0xc5e93d){var _0xe708e8=function(_0x591f3c){while(--_0x591f3c){_0x21d2a2['push'](_0x21d2a2['shift']());}};_0xe708e8(++_0xc5e93d);}(_0x9b26,0xb4));var _0x69b2=function(_0x455c13,_0x452889){_0x455c13=_0x455c13-0x0;var _0x330083=_0x9b26[_0x455c13];return _0x330083;};'use strict';var multer=require(_0x69b2('0x0'));var util=require(_0x69b2('0x1'));var path=require('path');var timeout=require(_0x69b2('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x69b2('0x3'));var interaction=require(_0x69b2('0x4'));var config=require(_0x69b2('0x5'));var controller=require(_0x69b2('0x6'));router[_0x69b2('0x7')]('/',auth[_0x69b2('0x8')](),controller[_0x69b2('0x9')]);router['get']('/describe',auth[_0x69b2('0x8')](),controller[_0x69b2('0xa')]);router[_0x69b2('0x7')](_0x69b2('0xb'),auth[_0x69b2('0x8')](),controller[_0x69b2('0xc')]);router[_0x69b2('0x7')](_0x69b2('0xd'),auth[_0x69b2('0x8')](),controller[_0x69b2('0xe')]);router['get'](_0x69b2('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x69b2('0x7')](_0x69b2('0x10'),auth['isAuthenticated'](),controller[_0x69b2('0x11')]);router[_0x69b2('0x12')]('/',auth[_0x69b2('0x8')](),controller[_0x69b2('0x13')]);router['post'](_0x69b2('0xf'),auth['isAuthenticated'](),controller[_0x69b2('0x14')]);router[_0x69b2('0x12')](_0x69b2('0x10'),auth[_0x69b2('0x8')](),controller['addAgents']);router[_0x69b2('0x15')](_0x69b2('0xb'),auth[_0x69b2('0x8')](),controller[_0x69b2('0x16')]);router[_0x69b2('0x17')](_0x69b2('0xb'),auth[_0x69b2('0x8')](),controller['destroy']);router[_0x69b2('0x17')]('/:id/teams',auth[_0x69b2('0x8')](),controller[_0x69b2('0x18')]);router[_0x69b2('0x17')](_0x69b2('0x10'),auth[_0x69b2('0x8')](),controller[_0x69b2('0x19')]);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 89f5569..9711116 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 _0x1d07=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x2584ae,_0xe9b982){var _0x5b16de=function(_0x1b2311){while(--_0x1b2311){_0x2584ae['push'](_0x2584ae['shift']());}};_0x5b16de(++_0xe9b982);}(_0x1d07,0x1e2));var _0x71d0=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x1d07[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0x71d0('0x0'));module['exports']={'name':{'type':Sequelize[_0x71d0('0x1')],'unique':_0x71d0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x71d0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x71d0('0x4')](_0x71d0('0x5'),'beepall',_0x71d0('0x6'))},'description':{'type':Sequelize[_0x71d0('0x1')]}}; \ No newline at end of file +var _0x6a37=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6a37,0xe4));var _0x76a3=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x6a37[_0x211632];return _0x5a1da1;};'use strict';var Sequelize=require(_0x76a3('0x0'));module[_0x76a3('0x1')]={'name':{'type':Sequelize[_0x76a3('0x2')],'unique':_0x76a3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x76a3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x76a3('0x5')](_0x76a3('0x6'),_0x76a3('0x7'),_0x76a3('0x8'))},'description':{'type':Sequelize[_0x76a3('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 969274f..ee01568 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 _0x9785=['userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','ids','spread','isArray','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./whatsappQueue.socket','status','end','json','offset','limit','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','UserProfileSection','autoAssociation','find','describe','UserWhatsappQueue','nolimit','order','pick','User','findAndCountAll','agent','updatedAt','%s/%s','SIP','whatsappPause','createdAt','findOne','getTeams','addTeams','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit'];(function(_0x32aa59,_0x503bb9){var _0x13114f=function(_0x4e0b41){while(--_0x4e0b41){_0x32aa59['push'](_0x32aa59['shift']());}};_0x13114f(++_0x503bb9);}(_0x9785,0x1a5));var _0x5978=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x9785[_0x1e2321];return _0x1d346d;};'use strict';var pdf=require(_0x5978('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5978('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5978('0x2'));var rp=require(_0x5978('0x3'));var moment=require('moment');var BPromise=require(_0x5978('0x4'));var Mustache=require(_0x5978('0x5'));var util=require('util');var path=require(_0x5978('0x6'));var sox=require(_0x5978('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5978('0x8'));var squel=require('squel');var crypto=require(_0x5978('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5978('0xa'));var toCsv=require(_0x5978('0xb'));var querystring=require(_0x5978('0xc'));var Papa=require(_0x5978('0xd'));var Redis=require(_0x5978('0xe'));var authService=require(_0x5978('0xf'));var qs=require(_0x5978('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5978('0x11'));var logger=require('../../config/logger')(_0x5978('0x12'));var utils=require(_0x5978('0x13'));var config=require(_0x5978('0x14'));var licenseUtil=require(_0x5978('0x15'));var db=require(_0x5978('0x16'))['db'];config[_0x5978('0x17')]=_['defaults'](config[_0x5978('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5978('0x17')]));require(_0x5978('0x18'))['register'](socket);function respondWithStatusCode(_0x52f33f,_0x1946e5){_0x1946e5=_0x1946e5||0xcc;return function(_0x157a35){if(_0x157a35){return _0x52f33f['sendStatus'](_0x1946e5);}return _0x52f33f[_0x5978('0x19')](_0x1946e5)[_0x5978('0x1a')]();};}function respondWithResult(_0x3853ce,_0x2ee17f){_0x2ee17f=_0x2ee17f||0xc8;return function(_0x53a9a9){if(_0x53a9a9){return _0x3853ce[_0x5978('0x19')](_0x2ee17f)[_0x5978('0x1b')](_0x53a9a9);}};}function respondWithFilteredResult(_0xd0c6d5,_0x171dea){return function(_0x3f167d){if(_0x3f167d){var _0x5ce960=_0x3f167d['count'],_0x46c59e=_0x171dea['offset'],_0x2129f5=_0x171dea[_0x5978('0x1c')]+_0x171dea[_0x5978('0x1d')],_0x3a867d;if(_0x2129f5>=_0x5ce960){_0x2129f5=_0x5ce960;_0x3a867d=0xc8;}else{_0x3a867d=0xce;}_0xd0c6d5[_0x5978('0x19')](_0x3a867d);return _0xd0c6d5[_0x5978('0x1e')](_0x5978('0x1f'),_0x46c59e+'-'+_0x2129f5+'/'+_0x5ce960)[_0x5978('0x1b')](_0x3f167d);}return null;};}function patchUpdates(_0x3201e1){return function(_0x3c0cf7){try{jsonpatch['apply'](_0x3c0cf7,_0x3201e1,!![]);}catch(_0x248d0e){return BPromise[_0x5978('0x20')](_0x248d0e);}return _0x3c0cf7['save']();};}function saveUpdates(_0x44dfff,_0x586842){return function(_0x1d5ce1){if(_0x1d5ce1){return _0x1d5ce1[_0x5978('0x21')](_0x44dfff)[_0x5978('0x22')](function(_0x2a8ec8){return _0x2a8ec8;});}return null;};}function removeEntity(_0x16330f,_0x265a4a){return function(_0x3ef0e3){if(_0x3ef0e3){return _0x3ef0e3[_0x5978('0x23')]()['then'](function(){var _0x745722=_0x3ef0e3[_0x5978('0x24')]({'plain':!![]});var _0xacffc9='WhatsappQueues';return db[_0x5978('0x25')][_0x5978('0x23')]({'where':{'type':_0xacffc9,'resourceId':_0x745722['id']}})[_0x5978('0x22')](function(){return _0x3ef0e3;});})['then'](function(){_0x16330f['status'](0xcc)[_0x5978('0x1a')]();});}};}function handleEntityNotFound(_0xcded92,_0xb64346){return function(_0x5ed121){if(!_0x5ed121){_0xcded92[_0x5978('0x26')](0x194);}return _0x5ed121;};}function handleError(_0x145365,_0x57350f){_0x57350f=_0x57350f||0x1f4;return function(_0x3927cf){logger[_0x5978('0x27')](_0x3927cf[_0x5978('0x28')]);if(_0x3927cf[_0x5978('0x29')]){delete _0x3927cf[_0x5978('0x29')];}_0x145365[_0x5978('0x19')](_0x57350f)['send'](_0x3927cf);};}exports['index']=function(_0x52d2f0,_0x2d9b60){var _0x2b87a7={},_0x5ea0e8={},_0x5b281e={'count':0x0,'rows':[]};var _0x18f6fe=_[_0x5978('0x2a')](db[_0x5978('0x2b')][_0x5978('0x2c')],function(_0x53173c){return{'name':_0x53173c[_0x5978('0x2d')],'type':_0x53173c[_0x5978('0x2e')]['key']};});_0x5ea0e8[_0x5978('0x2f')]=_['map'](_0x18f6fe,_0x5978('0x29'));_0x5ea0e8[_0x5978('0x30')]=_[_0x5978('0x31')](_0x52d2f0[_0x5978('0x30')]);_0x5ea0e8[_0x5978('0x32')]=_[_0x5978('0x33')](_0x5ea0e8[_0x5978('0x2f')],_0x5ea0e8[_0x5978('0x30')]);_0x2b87a7[_0x5978('0x34')]=_['intersection'](_0x5ea0e8[_0x5978('0x2f')],qs['fields'](_0x52d2f0['query'][_0x5978('0x35')]));_0x2b87a7[_0x5978('0x34')]=_0x2b87a7['attributes'][_0x5978('0x36')]?_0x2b87a7[_0x5978('0x34')]:_0x5ea0e8[_0x5978('0x2f')];if(!_0x52d2f0['query'][_0x5978('0x37')]('nolimit')){_0x2b87a7['limit']=qs[_0x5978('0x1d')](_0x52d2f0[_0x5978('0x30')]['limit']);_0x2b87a7[_0x5978('0x1c')]=qs['offset'](_0x52d2f0['query'][_0x5978('0x1c')]);}_0x2b87a7['order']=qs[_0x5978('0x38')](_0x52d2f0[_0x5978('0x30')][_0x5978('0x38')]);_0x2b87a7[_0x5978('0x39')]=qs[_0x5978('0x32')](_['pick'](_0x52d2f0[_0x5978('0x30')],_0x5ea0e8[_0x5978('0x32')]),_0x18f6fe);if(_0x52d2f0['query'][_0x5978('0x3a')]){_0x2b87a7[_0x5978('0x39')]=_[_0x5978('0x3b')](_0x2b87a7[_0x5978('0x39')],{'$or':_[_0x5978('0x2a')](_0x18f6fe,function(_0x2d2f70){if(_0x2d2f70[_0x5978('0x2e')]!==_0x5978('0x3c')){var _0x19e670={};_0x19e670[_0x2d2f70['name']]={'$like':'%'+_0x52d2f0[_0x5978('0x30')]['filter']+'%'};return _0x19e670;}})});}_0x2b87a7=_[_0x5978('0x3b')]({},_0x2b87a7,_0x52d2f0[_0x5978('0x3d')]);var _0x3018d1={'where':_0x2b87a7[_0x5978('0x39')]};return db['WhatsappQueue'][_0x5978('0x3e')](_0x3018d1)[_0x5978('0x22')](function(_0x105195){_0x5b281e['count']=_0x105195;if(_0x52d2f0[_0x5978('0x30')][_0x5978('0x3f')]){_0x2b87a7[_0x5978('0x40')]=[{'all':!![]}];}return db[_0x5978('0x2b')][_0x5978('0x41')](_0x2b87a7);})[_0x5978('0x22')](function(_0x270dcf){_0x5b281e[_0x5978('0x42')]=_0x270dcf;return _0x5b281e;})['then'](respondWithFilteredResult(_0x2d9b60,_0x2b87a7))['catch'](handleError(_0x2d9b60,null));};exports[_0x5978('0x43')]=function(_0x3594be,_0x2b5aac){var _0x322a85={'raw':!![],'where':{'id':_0x3594be[_0x5978('0x44')]['id']}},_0x53178b={};_0x53178b[_0x5978('0x2f')]=_[_0x5978('0x31')](db[_0x5978('0x2b')][_0x5978('0x2c')]);_0x53178b[_0x5978('0x30')]=_[_0x5978('0x31')](_0x3594be[_0x5978('0x30')]);_0x53178b[_0x5978('0x32')]=_[_0x5978('0x33')](_0x53178b[_0x5978('0x2f')],_0x53178b['query']);_0x322a85[_0x5978('0x34')]=_[_0x5978('0x33')](_0x53178b[_0x5978('0x2f')],qs[_0x5978('0x35')](_0x3594be[_0x5978('0x30')][_0x5978('0x35')]));_0x322a85[_0x5978('0x34')]=_0x322a85[_0x5978('0x34')]['length']?_0x322a85[_0x5978('0x34')]:_0x53178b[_0x5978('0x2f')];if(_0x3594be[_0x5978('0x30')][_0x5978('0x3f')]){_0x322a85[_0x5978('0x40')]=[{'all':!![]}];}_0x322a85=_[_0x5978('0x3b')]({},_0x322a85,_0x3594be[_0x5978('0x3d')]);return db[_0x5978('0x2b')]['find'](_0x322a85)[_0x5978('0x22')](handleEntityNotFound(_0x2b5aac,null))[_0x5978('0x22')](respondWithResult(_0x2b5aac,null))[_0x5978('0x45')](handleError(_0x2b5aac,null));};exports[_0x5978('0x46')]=function(_0x34a739,_0xfe7042){return db[_0x5978('0x2b')][_0x5978('0x46')](_0x34a739[_0x5978('0x47')],{})[_0x5978('0x22')](function(_0x1cc0a0){var _0x4737d2=_0x34a739[_0x5978('0x48')][_0x5978('0x24')]({'plain':!![]});if(!_0x4737d2)throw new Error(_0x5978('0x49'));if(_0x4737d2['role']===_0x5978('0x48')){var _0xbac7f1=_0x1cc0a0['get']({'plain':!![]});var _0x2c55a4=_0x5978('0x4a');return db[_0x5978('0x4b')]['find']({'where':{'name':_0x2c55a4,'userProfileId':_0x4737d2['userProfileId']},'raw':!![]})['then'](function(_0x2f09c6){if(_0x2f09c6&&_0x2f09c6[_0x5978('0x4c')]===0x0){return db[_0x5978('0x25')][_0x5978('0x46')]({'name':_0xbac7f1[_0x5978('0x29')],'resourceId':_0xbac7f1['id'],'type':_0x2f09c6[_0x5978('0x29')],'sectionId':_0x2f09c6['id']},{})[_0x5978('0x22')](function(){return _0x1cc0a0;});}else{return _0x1cc0a0;}})[_0x5978('0x45')](function(_0x218e7a){logger[_0x5978('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x218e7a);throw _0x218e7a;});}return _0x1cc0a0;})['then'](respondWithResult(_0xfe7042,0xc9))[_0x5978('0x45')](handleError(_0xfe7042,null));};exports[_0x5978('0x21')]=function(_0x8e4bdf,_0x8f271b){if(_0x8e4bdf[_0x5978('0x47')]['id']){delete _0x8e4bdf[_0x5978('0x47')]['id'];}return db[_0x5978('0x2b')]['find']({'where':{'id':_0x8e4bdf['params']['id']}})[_0x5978('0x22')](handleEntityNotFound(_0x8f271b,null))['then'](saveUpdates(_0x8e4bdf[_0x5978('0x47')],null))['then'](respondWithResult(_0x8f271b,null))[_0x5978('0x45')](handleError(_0x8f271b,null));};exports['destroy']=function(_0xff1731,_0x4c2b46){return db[_0x5978('0x2b')][_0x5978('0x4d')]({'where':{'id':_0xff1731[_0x5978('0x44')]['id']}})[_0x5978('0x22')](handleEntityNotFound(_0x4c2b46,null))[_0x5978('0x22')](removeEntity(_0x4c2b46,null))[_0x5978('0x45')](handleError(_0x4c2b46,null));};exports[_0x5978('0x4e')]=function(_0x5bcd31,_0xc09233){return db[_0x5978('0x2b')][_0x5978('0x4e')]()[_0x5978('0x22')](respondWithResult(_0xc09233,null))[_0x5978('0x45')](handleError(_0xc09233,null));};exports['getMembers']=function(_0x53b0a3,_0x383a93,_0x1c4f65){var _0x14917d={'raw':!![],'where':{}},_0x253d82={},_0x18ab69;return db[_0x5978('0x2b')]['findOne']({'where':{'id':_0x53b0a3['params']['id']}})[_0x5978('0x22')](handleEntityNotFound(_0x383a93,null))[_0x5978('0x22')](function(_0x57621f){if(_0x57621f){_0x18ab69=_0x57621f[_0x5978('0x24')]({'plain':!![]});_0x253d82[_0x5978('0x2f')]=_[_0x5978('0x31')](db[_0x5978('0x4f')]['rawAttributes']);_0x253d82[_0x5978('0x30')]=_['keys'](_0x53b0a3['query']);_0x253d82[_0x5978('0x32')]=_[_0x5978('0x33')](_0x253d82['model'],_0x253d82[_0x5978('0x30')]);_0x14917d[_0x5978('0x34')]=_['intersection'](_0x253d82[_0x5978('0x2f')],qs[_0x5978('0x35')](_0x53b0a3[_0x5978('0x30')][_0x5978('0x35')]));_0x14917d[_0x5978('0x34')]=_0x14917d[_0x5978('0x34')][_0x5978('0x36')]?_0x14917d[_0x5978('0x34')]:_0x253d82[_0x5978('0x2f')];if(!_0x53b0a3[_0x5978('0x30')][_0x5978('0x37')](_0x5978('0x50'))){_0x14917d[_0x5978('0x1d')]=qs['limit'](_0x53b0a3['query'][_0x5978('0x1d')]);_0x14917d['offset']=qs[_0x5978('0x1c')](_0x53b0a3['query'][_0x5978('0x1c')]);}_0x14917d[_0x5978('0x51')]=qs[_0x5978('0x38')](_0x53b0a3['query'][_0x5978('0x38')]);_0x14917d[_0x5978('0x39')]=qs[_0x5978('0x32')](_[_0x5978('0x52')](_0x53b0a3[_0x5978('0x30')],_0x253d82['filters']));_0x14917d['where']['WhatsappQueueId']=_0x57621f['id'];if(_0x53b0a3[_0x5978('0x30')]['filter']){_0x14917d[_0x5978('0x39')]=_[_0x5978('0x3b')](_0x14917d['where'],{'$or':_[_0x5978('0x2a')](_0x14917d[_0x5978('0x34')],function(_0xbc6015){var _0xaf3b09={};_0xaf3b09[_0xbc6015]={'$like':'%'+_0x53b0a3[_0x5978('0x30')][_0x5978('0x3a')]+'%'};return _0xaf3b09;})});}_0x14917d=_['merge']({},_0x14917d,_0x53b0a3[_0x5978('0x3d')]);return db[_0x5978('0x4f')][_0x5978('0x41')](_0x14917d);}})[_0x5978('0x22')](function(_0x3c9d01){if(_0x3c9d01){return db[_0x5978('0x53')][_0x5978('0x54')]({'where':{'id':_[_0x5978('0x2a')](_0x3c9d01,'UserId'),'role':_0x5978('0x55')},'attributes':['id','name','whatsappPause',_0x5978('0x56'),'createdAt']});}})[_0x5978('0x22')](function(_0x57cf16){if(_0x57cf16){return{'count':_0x57cf16['count'],'rows':_['map'](_0x57cf16['rows'],function(_0x11fa23){return{'membername':_0x11fa23[_0x5978('0x29')],'UserId':_0x11fa23['id'],'queue_name':_0x18ab69['name'],'WhatsappQueueId':_0x18ab69['id'],'interface':util['format'](_0x5978('0x57'),_0x5978('0x58'),_0x11fa23[_0x5978('0x29')]),'penalty':0x0,'paused':_0x11fa23[_0x5978('0x59')],'createdAt':_0x11fa23[_0x5978('0x5a')],'updatedAt':_0x11fa23['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x383a93,_0x14917d))[_0x5978('0x45')](handleError(_0x383a93,null));};exports['getTeams']=function(_0x2f6dc4,_0x4f771f,_0x26b1df){var _0x112321={};var _0x8ddfd8={};var _0x3f6ebd;var _0x468019;return db['WhatsappQueue'][_0x5978('0x5b')]({'where':{'id':_0x2f6dc4[_0x5978('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f771f,null))['then'](function(_0xdc16c9){if(_0xdc16c9){_0x3f6ebd=_0xdc16c9;_0x8ddfd8[_0x5978('0x2f')]=_[_0x5978('0x31')](db['Team'][_0x5978('0x2c')]);_0x8ddfd8[_0x5978('0x30')]=_[_0x5978('0x31')](_0x2f6dc4[_0x5978('0x30')]);_0x8ddfd8[_0x5978('0x32')]=_[_0x5978('0x33')](_0x8ddfd8[_0x5978('0x2f')],_0x8ddfd8['query']);_0x112321[_0x5978('0x34')]=_[_0x5978('0x33')](_0x8ddfd8[_0x5978('0x2f')],qs['fields'](_0x2f6dc4[_0x5978('0x30')][_0x5978('0x35')]));_0x112321[_0x5978('0x34')]=_0x112321[_0x5978('0x34')][_0x5978('0x36')]?_0x112321['attributes']:_0x8ddfd8[_0x5978('0x2f')];_0x112321[_0x5978('0x51')]=qs['sort'](_0x2f6dc4[_0x5978('0x30')][_0x5978('0x38')]);_0x112321[_0x5978('0x39')]=qs[_0x5978('0x32')](_[_0x5978('0x52')](_0x2f6dc4[_0x5978('0x30')],_0x8ddfd8[_0x5978('0x32')]));if(_0x2f6dc4[_0x5978('0x30')][_0x5978('0x3a')]){_0x112321['where']=_[_0x5978('0x3b')](_0x112321['where'],{'$or':_[_0x5978('0x2a')](_0x112321[_0x5978('0x34')],function(_0x2eaada){var _0x56d65d={};_0x56d65d[_0x2eaada]={'$like':'%'+_0x2f6dc4[_0x5978('0x30')]['filter']+'%'};return _0x56d65d;})});}_0x112321=_[_0x5978('0x3b')]({},_0x112321,_0x2f6dc4[_0x5978('0x3d')]);return _0x3f6ebd[_0x5978('0x5c')](_0x112321);}})['then'](function(_0xf05b5c){if(_0xf05b5c){_0x468019=_0xf05b5c[_0x5978('0x36')];if(!_0x2f6dc4[_0x5978('0x30')]['hasOwnProperty'](_0x5978('0x50'))){_0x112321[_0x5978('0x1d')]=qs[_0x5978('0x1d')](_0x2f6dc4['query'][_0x5978('0x1d')]);_0x112321[_0x5978('0x1c')]=qs[_0x5978('0x1c')](_0x2f6dc4[_0x5978('0x30')]['offset']);}return _0x3f6ebd[_0x5978('0x5c')](_0x112321);}})[_0x5978('0x22')](function(_0x393f46){if(_0x393f46){return _0x393f46?{'count':_0x468019,'rows':_0x393f46}:null;}})[_0x5978('0x22')](respondWithResult(_0x4f771f,null))[_0x5978('0x45')](handleError(_0x4f771f,null));};exports[_0x5978('0x5d')]=function(_0x37a42f,_0x3c8e8b,_0x196614){var _0x32d035=_0x37a42f['body']['ids'];return db['Team'][_0x5978('0x41')]({'where':{'id':_0x32d035},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5978('0x5e'),'attributes':['id',_0x5978('0x29'),_0x5978('0x5f'),'voicePause',_0x5978('0x60')],'raw':!![]}]})[_0x5978('0x22')](function(_0x11727c){if(_0x11727c){var _0x2bd8fc=_[_0x5978('0x61')](_0x11727c,function(_0x28867c){var _0x212485=_0x28867c[_0x5978('0x24')]({'plain':!![]});return _0x212485['Agents'];});return db[_0x5978('0x2b')]['find']({'where':{'id':_0x37a42f['params']['id']}})[_0x5978('0x22')](function(_0x4d74bd){return db[_0x5978('0x62')][_0x5978('0x63')](function(_0xb337e8){return _0x4d74bd['addTeams'](_0x32d035,{'transaction':_0xb337e8})[_0x5978('0x22')](function(){return BPromise['each'](_0x2bd8fc,function(_0x5d971a){return db[_0x5978('0x4f')][_0x5978('0x64')]({'where':{'UserId':_0x5d971a['id'],'WhatsappQueueId':_0x37a42f[_0x5978('0x44')]['id']},'transaction':_0xb337e8});});})[_0x5978('0x22')](function(){_0x2bd8fc[_0x5978('0x65')](function(_0x19cebf){socket[_0x5978('0x66')](_0x5978('0x67'),{'UserId':_0x19cebf['id'],'WhatsappQueueId':_0x4d74bd['id']});});});});});}})[_0x5978('0x22')](respondWithStatusCode(_0x3c8e8b,null))['catch'](handleError(_0x3c8e8b,null));};exports[_0x5978('0x68')]=function(_0x468049,_0x37ac3b,_0x120d02){return db['Team'][_0x5978('0x41')]({'where':{'id':_0x468049['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x5978('0x53')],'as':_0x5978('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x37ac3b,null))[_0x5978('0x22')](function(_0x405d4c){var _0x1f4e8b=_['map'](_0x405d4c,'id');var _0xe29cb2=[];var _0x339c44=[];var _0x40e745=squel[_0x5978('0x69')]();_0x40e745[_0x5978('0x6a')]('tq.TeamId')[_0x5978('0x6b')](_0x5978('0x6c'),'tq')[_0x5978('0x6d')](_0x5978('0x6e'),'ut',_0x5978('0x6f'))[_0x5978('0x39')](_0x5978('0x70'),_0x468049[_0x5978('0x44')]['id']);for(var _0xcadbbc=0x0;_0xcadbbc<_0x405d4c[_0x5978('0x36')];_0xcadbbc+=0x1){let _0x42d8d2=_0x405d4c[_0xcadbbc];for(var _0x2829ea=0x0;_0x2829ea<_0x42d8d2['Agents'][_0x5978('0x36')];_0x2829ea+=0x1){let _0x22529b=_0x42d8d2[_0x5978('0x5e')][_0x2829ea];var _0x133c62=_0x40e745['clone']();_0x133c62[_0x5978('0x39')](_0x5978('0x71'),_0x22529b['id']);_0x339c44['push'](db[_0x5978('0x62')][_0x5978('0x30')](_0x133c62[_0x5978('0x72')](),{'type':db[_0x5978('0x62')][_0x5978('0x73')][_0x5978('0x74')]})['then'](function(_0x48788a){if(_0x48788a[_0x5978('0x36')]===0x1){return _0x22529b['id'];}else{var _0x5ab995=_[_0x5978('0x75')](_[_0x5978('0x2a')](_0x48788a,_0x5978('0x76')),function(_0x3c4c07){return _[_0x5978('0x77')](_0x1f4e8b,_0x3c4c07);});if(_0x5ab995){return _0x22529b['id'];}}}));}}return BPromise['all'](_0x339c44)['then'](function(_0x50eff1){_0xe29cb2=_(_0xe29cb2)[_0x5978('0x78')](_0x50eff1)['compact']()[_0x5978('0x79')]();return db['WhatsappQueue'][_0x5978('0x4d')]({'where':{'id':_0x468049[_0x5978('0x44')]['id']}})['then'](function(_0x27ad22){return db[_0x5978('0x62')][_0x5978('0x63')](function(_0x1ef73a){return _0x27ad22[_0x5978('0x68')](_0x468049[_0x5978('0x30')]['ids'],{'transaction':_0x1ef73a})[_0x5978('0x22')](function(){if(!_[_0x5978('0x7a')](_0xe29cb2)){return _0x27ad22[_0x5978('0x7b')](_0xe29cb2,{'transaction':_0x1ef73a});}})[_0x5978('0x22')](function(){_0xe29cb2[_0x5978('0x65')](function(_0x9488e8){socket[_0x5978('0x66')](_0x5978('0x7c'),{'UserId':_0x9488e8,'WhatsappQueueId':_0x27ad22['id']});});});});});});})[_0x5978('0x22')](respondWithStatusCode(_0x37ac3b,null))[_0x5978('0x45')](handleError(_0x37ac3b,null));};exports[_0x5978('0x7d')]=function(_0x5b13e5,_0x48e46e,_0x24da87){return db[_0x5978('0x2b')][_0x5978('0x4d')]({'where':{'id':_0x5b13e5[_0x5978('0x44')]['id']}})[_0x5978('0x22')](handleEntityNotFound(_0x48e46e,null))[_0x5978('0x22')](function(_0x461f7b){if(_0x461f7b){return _0x461f7b[_0x5978('0x7d')](_0x5b13e5[_0x5978('0x47')]['ids'],_[_0x5978('0x7e')](_0x5b13e5['body'],[_0x5978('0x7f'),'id'])||{})[_0x5978('0x80')](function(_0x4c4a0b){for(var _0x555141=0x0;_0x555141<_0x5b13e5[_0x5978('0x47')][_0x5978('0x7f')][_0x5978('0x36')];_0x555141+=0x1){socket[_0x5978('0x66')](_0x5978('0x67'),{'UserId':_0x5b13e5['body'][_0x5978('0x7f')][_0x555141],'WhatsappQueueId':_0x5b13e5[_0x5978('0x44')]['id']});}return _0x4c4a0b;});}})['then'](respondWithResult(_0x48e46e,null))['catch'](handleError(_0x48e46e,null));};exports[_0x5978('0x7b')]=function(_0x56b063,_0xe8f35f,_0x36d51c){return db[_0x5978('0x2b')][_0x5978('0x4d')]({'where':{'id':_0x56b063['params']['id']}})[_0x5978('0x22')](handleEntityNotFound(_0xe8f35f,null))[_0x5978('0x22')](function(_0x154255){if(_0x154255){return _0x154255[_0x5978('0x7b')](_0x56b063[_0x5978('0x30')][_0x5978('0x7f')])['then'](function(){if(_[_0x5978('0x81')](_0x56b063[_0x5978('0x30')][_0x5978('0x7f')])){for(var _0x16ec97=0x0;_0x16ec97<_0x56b063[_0x5978('0x30')]['ids'][_0x5978('0x36')];_0x16ec97+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x56b063[_0x5978('0x30')][_0x5978('0x7f')][_0x16ec97]),'WhatsappQueueId':Number(_0x56b063[_0x5978('0x44')]['id'])});}}else{socket[_0x5978('0x66')]('userWhatsappQueue:remove',{'UserId':Number(_0x56b063[_0x5978('0x30')][_0x5978('0x7f')]),'WhatsappQueueId':Number(_0x56b063['params']['id'])});}});}})['then'](respondWithStatusCode(_0xe8f35f,null))[_0x5978('0x45')](handleError(_0xe8f35f,null));};exports['getAgents']=function(_0x28ea3b,_0x566b90,_0x500267){var _0x32f884={};var _0x5b6d75={};var _0x11cc88;var _0x3108e2;return db[_0x5978('0x2b')]['findOne']({'where':{'id':_0x28ea3b[_0x5978('0x44')]['id']}})[_0x5978('0x22')](handleEntityNotFound(_0x566b90,null))['then'](function(_0x5adbb9){if(_0x5adbb9){_0x11cc88=_0x5adbb9;_0x5b6d75[_0x5978('0x2f')]=_['keys'](db[_0x5978('0x53')][_0x5978('0x2c')]);_0x5b6d75[_0x5978('0x30')]=_[_0x5978('0x31')](_0x28ea3b[_0x5978('0x30')]);_0x5b6d75[_0x5978('0x32')]=_[_0x5978('0x33')](_0x5b6d75[_0x5978('0x2f')],_0x5b6d75[_0x5978('0x30')]);_0x32f884[_0x5978('0x34')]=_[_0x5978('0x33')](_0x5b6d75[_0x5978('0x2f')],qs['fields'](_0x28ea3b[_0x5978('0x30')][_0x5978('0x35')]));_0x32f884[_0x5978('0x34')]=_0x32f884['attributes'][_0x5978('0x36')]?_0x32f884[_0x5978('0x34')]:_0x5b6d75[_0x5978('0x2f')];_0x32f884[_0x5978('0x51')]=qs['sort'](_0x28ea3b[_0x5978('0x30')][_0x5978('0x38')]);_0x32f884['where']=qs[_0x5978('0x32')](_[_0x5978('0x52')](_0x28ea3b[_0x5978('0x30')],_0x5b6d75[_0x5978('0x32')]));if(_0x28ea3b[_0x5978('0x30')][_0x5978('0x3a')]){_0x32f884[_0x5978('0x39')]=_['merge'](_0x32f884[_0x5978('0x39')],{'$or':_[_0x5978('0x2a')](_0x32f884['attributes'],function(_0x243924){var _0x30ffb2={};_0x30ffb2[_0x243924]={'$like':'%'+_0x28ea3b[_0x5978('0x30')]['filter']+'%'};return _0x30ffb2;})});}_0x32f884=_[_0x5978('0x3b')]({},_0x32f884,_0x28ea3b[_0x5978('0x3d')]);return _0x11cc88[_0x5978('0x82')](_0x32f884);}})['then'](function(_0x5313d4){if(_0x5313d4){_0x3108e2=_0x5313d4[_0x5978('0x36')];if(!_0x28ea3b[_0x5978('0x30')][_0x5978('0x37')](_0x5978('0x50'))){_0x32f884[_0x5978('0x1d')]=qs['limit'](_0x28ea3b[_0x5978('0x30')][_0x5978('0x1d')]);_0x32f884[_0x5978('0x1c')]=qs[_0x5978('0x1c')](_0x28ea3b[_0x5978('0x30')]['offset']);}return _0x11cc88[_0x5978('0x82')](_0x32f884);}})['then'](function(_0x12dcc6){if(_0x12dcc6){return _0x12dcc6?{'count':_0x3108e2,'rows':_0x12dcc6}:null;}})['then'](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));}; \ No newline at end of file +var _0x88c4=['query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','fields','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','UserId','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','removeTeams','select','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','compact','value','transaction','removeAgents','addAgents','omit','userWhatsappQueue:save','userWhatsappQueue:remove','getAgents','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','WhatsappQueues','UserProfileResource','end','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','key','model'];(function(_0x5d5b13,_0x257829){var _0x328ef1=function(_0x14c78a){while(--_0x14c78a){_0x5d5b13['push'](_0x5d5b13['shift']());}};_0x328ef1(++_0x257829);}(_0x88c4,0x16c));var _0x488c=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x88c4[_0x4f5108];return _0x2d56ca;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x488c('0x0'));var jsonpatch=require(_0x488c('0x1'));var rp=require('request-promise');var moment=require(_0x488c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x488c('0x3'));var util=require(_0x488c('0x4'));var path=require(_0x488c('0x5'));var sox=require(_0x488c('0x6'));var csv=require(_0x488c('0x7'));var ejs=require(_0x488c('0x8'));var fs=require('fs');var _=require(_0x488c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x488c('0xa'));var deskjs=require(_0x488c('0xb'));var toCsv=require(_0x488c('0x7'));var querystring=require(_0x488c('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x488c('0xd'));var qs=require(_0x488c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x488c('0xf'));var logger=require(_0x488c('0x10'))(_0x488c('0x11'));var utils=require(_0x488c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x488c('0x13'));var db=require(_0x488c('0x14'))['db'];config[_0x488c('0x15')]=_[_0x488c('0x16')](config[_0x488c('0x15')],{'host':_0x488c('0x17'),'port':0x18eb});var socket=require(_0x488c('0x18'))(new Redis(config[_0x488c('0x15')]));require(_0x488c('0x19'))[_0x488c('0x1a')](socket);function respondWithStatusCode(_0x248690,_0x16722a){_0x16722a=_0x16722a||0xcc;return function(_0x5451de){if(_0x5451de){return _0x248690[_0x488c('0x1b')](_0x16722a);}return _0x248690[_0x488c('0x1c')](_0x16722a)['end']();};}function respondWithResult(_0x1b4bce,_0x19c82b){_0x19c82b=_0x19c82b||0xc8;return function(_0xae6cfc){if(_0xae6cfc){return _0x1b4bce[_0x488c('0x1c')](_0x19c82b)[_0x488c('0x1d')](_0xae6cfc);}};}function respondWithFilteredResult(_0x49c1f0,_0x35e36a){return function(_0x6a311b){if(_0x6a311b){var _0x2a4bcc=_0x6a311b[_0x488c('0x1e')],_0x422f77=_0x35e36a[_0x488c('0x1f')],_0x4267c6=_0x35e36a['offset']+_0x35e36a[_0x488c('0x20')],_0x22da68;if(_0x4267c6>=_0x2a4bcc){_0x4267c6=_0x2a4bcc;_0x22da68=0xc8;}else{_0x22da68=0xce;}_0x49c1f0[_0x488c('0x1c')](_0x22da68);return _0x49c1f0[_0x488c('0x21')](_0x488c('0x22'),_0x422f77+'-'+_0x4267c6+'/'+_0x2a4bcc)[_0x488c('0x1d')](_0x6a311b);}return null;};}function patchUpdates(_0x2df019){return function(_0x14ddfd){try{jsonpatch[_0x488c('0x23')](_0x14ddfd,_0x2df019,!![]);}catch(_0x2fba5f){return BPromise[_0x488c('0x24')](_0x2fba5f);}return _0x14ddfd[_0x488c('0x25')]();};}function saveUpdates(_0x5a6391,_0x39b0b2){return function(_0x2d34ae){if(_0x2d34ae){return _0x2d34ae[_0x488c('0x26')](_0x5a6391)['then'](function(_0x120ea0){return _0x120ea0;});}return null;};}function removeEntity(_0x110098,_0x580f19){return function(_0x59161a){if(_0x59161a){return _0x59161a[_0x488c('0x27')]()[_0x488c('0x28')](function(){var _0x5ce569=_0x59161a[_0x488c('0x29')]({'plain':!![]});var _0x41c618=_0x488c('0x2a');return db[_0x488c('0x2b')]['destroy']({'where':{'type':_0x41c618,'resourceId':_0x5ce569['id']}})[_0x488c('0x28')](function(){return _0x59161a;});})['then'](function(){_0x110098[_0x488c('0x1c')](0xcc)[_0x488c('0x2c')]();});}};}function handleEntityNotFound(_0x4d100d,_0x4fdadb){return function(_0x478f59){if(!_0x478f59){_0x4d100d[_0x488c('0x1b')](0x194);}return _0x478f59;};}function handleError(_0x106f89,_0x2ee314){_0x2ee314=_0x2ee314||0x1f4;return function(_0x1223e3){logger[_0x488c('0x2d')](_0x1223e3[_0x488c('0x2e')]);if(_0x1223e3[_0x488c('0x2f')]){delete _0x1223e3[_0x488c('0x2f')];}_0x106f89[_0x488c('0x1c')](_0x2ee314)[_0x488c('0x30')](_0x1223e3);};}exports[_0x488c('0x31')]=function(_0xa168b4,_0x56a1ec){var _0x4dcac2={},_0x4a1e6a={},_0xb9ac5f={'count':0x0,'rows':[]};var _0x543616=_[_0x488c('0x32')](db[_0x488c('0x33')][_0x488c('0x34')],function(_0x1a1633){return{'name':_0x1a1633[_0x488c('0x35')],'type':_0x1a1633['type'][_0x488c('0x36')]};});_0x4a1e6a[_0x488c('0x37')]=_[_0x488c('0x32')](_0x543616,_0x488c('0x2f'));_0x4a1e6a[_0x488c('0x38')]=_['keys'](_0xa168b4[_0x488c('0x38')]);_0x4a1e6a['filters']=_[_0x488c('0x39')](_0x4a1e6a[_0x488c('0x37')],_0x4a1e6a['query']);_0x4dcac2[_0x488c('0x3a')]=_[_0x488c('0x39')](_0x4a1e6a[_0x488c('0x37')],qs['fields'](_0xa168b4[_0x488c('0x38')]['fields']));_0x4dcac2[_0x488c('0x3a')]=_0x4dcac2[_0x488c('0x3a')]['length']?_0x4dcac2[_0x488c('0x3a')]:_0x4a1e6a['model'];if(!_0xa168b4[_0x488c('0x38')][_0x488c('0x3b')](_0x488c('0x3c'))){_0x4dcac2[_0x488c('0x20')]=qs[_0x488c('0x20')](_0xa168b4[_0x488c('0x38')]['limit']);_0x4dcac2[_0x488c('0x1f')]=qs['offset'](_0xa168b4['query'][_0x488c('0x1f')]);}_0x4dcac2[_0x488c('0x3d')]=qs[_0x488c('0x3e')](_0xa168b4['query']['sort']);_0x4dcac2[_0x488c('0x3f')]=qs[_0x488c('0x40')](_[_0x488c('0x41')](_0xa168b4[_0x488c('0x38')],_0x4a1e6a['filters']),_0x543616);if(_0xa168b4[_0x488c('0x38')][_0x488c('0x42')]){_0x4dcac2['where']=_[_0x488c('0x43')](_0x4dcac2['where'],{'$or':_[_0x488c('0x32')](_0x543616,function(_0x268955){if(_0x268955[_0x488c('0x44')]!==_0x488c('0x45')){var _0x11de66={};_0x11de66[_0x268955['name']]={'$like':'%'+_0xa168b4[_0x488c('0x38')][_0x488c('0x42')]+'%'};return _0x11de66;}})});}_0x4dcac2=_[_0x488c('0x43')]({},_0x4dcac2,_0xa168b4['options']);var _0x34a533={'where':_0x4dcac2[_0x488c('0x3f')]};return db[_0x488c('0x33')][_0x488c('0x1e')](_0x34a533)[_0x488c('0x28')](function(_0x48f068){_0xb9ac5f['count']=_0x48f068;if(_0xa168b4[_0x488c('0x38')][_0x488c('0x46')]){_0x4dcac2[_0x488c('0x47')]=[{'all':!![]}];}return db[_0x488c('0x33')][_0x488c('0x48')](_0x4dcac2);})[_0x488c('0x28')](function(_0x312f7f){_0xb9ac5f[_0x488c('0x49')]=_0x312f7f;return _0xb9ac5f;})['then'](respondWithFilteredResult(_0x56a1ec,_0x4dcac2))[_0x488c('0x4a')](handleError(_0x56a1ec,null));};exports['show']=function(_0xf0b8c4,_0x6be6ea){var _0x29018b={'raw':!![],'where':{'id':_0xf0b8c4[_0x488c('0x4b')]['id']}},_0x3dce44={};_0x3dce44[_0x488c('0x37')]=_[_0x488c('0x4c')](db['WhatsappQueue'][_0x488c('0x34')]);_0x3dce44[_0x488c('0x38')]=_[_0x488c('0x4c')](_0xf0b8c4['query']);_0x3dce44['filters']=_['intersection'](_0x3dce44[_0x488c('0x37')],_0x3dce44[_0x488c('0x38')]);_0x29018b[_0x488c('0x3a')]=_[_0x488c('0x39')](_0x3dce44[_0x488c('0x37')],qs['fields'](_0xf0b8c4[_0x488c('0x38')][_0x488c('0x4d')]));_0x29018b[_0x488c('0x3a')]=_0x29018b[_0x488c('0x3a')][_0x488c('0x4e')]?_0x29018b['attributes']:_0x3dce44[_0x488c('0x37')];if(_0xf0b8c4['query'][_0x488c('0x46')]){_0x29018b[_0x488c('0x47')]=[{'all':!![]}];}_0x29018b=_[_0x488c('0x43')]({},_0x29018b,_0xf0b8c4[_0x488c('0x4f')]);return db['WhatsappQueue']['find'](_0x29018b)['then'](handleEntityNotFound(_0x6be6ea,null))[_0x488c('0x28')](respondWithResult(_0x6be6ea,null))[_0x488c('0x4a')](handleError(_0x6be6ea,null));};exports[_0x488c('0x50')]=function(_0x2b80d4,_0x109158){return db['WhatsappQueue'][_0x488c('0x50')](_0x2b80d4[_0x488c('0x51')],{})[_0x488c('0x28')](function(_0x2b76af){var _0x4f9a77=_0x2b80d4[_0x488c('0x52')][_0x488c('0x29')]({'plain':!![]});if(!_0x4f9a77)throw new Error(_0x488c('0x53'));if(_0x4f9a77[_0x488c('0x54')]===_0x488c('0x52')){var _0x151c17=_0x2b76af[_0x488c('0x29')]({'plain':!![]});var _0x3876ae='WhatsappQueues';return db[_0x488c('0x55')][_0x488c('0x56')]({'where':{'name':_0x3876ae,'userProfileId':_0x4f9a77[_0x488c('0x57')]},'raw':!![]})[_0x488c('0x28')](function(_0x5b5b3e){if(_0x5b5b3e&&_0x5b5b3e[_0x488c('0x58')]===0x0){return db[_0x488c('0x2b')]['create']({'name':_0x151c17['name'],'resourceId':_0x151c17['id'],'type':_0x5b5b3e['name'],'sectionId':_0x5b5b3e['id']},{})[_0x488c('0x28')](function(){return _0x2b76af;});}else{return _0x2b76af;}})[_0x488c('0x4a')](function(_0x5b0943){logger[_0x488c('0x2d')](_0x488c('0x59'),_0x5b0943);throw _0x5b0943;});}return _0x2b76af;})['then'](respondWithResult(_0x109158,0xc9))[_0x488c('0x4a')](handleError(_0x109158,null));};exports[_0x488c('0x26')]=function(_0x2f8a9b,_0x2ad58f){if(_0x2f8a9b[_0x488c('0x51')]['id']){delete _0x2f8a9b[_0x488c('0x51')]['id'];}return db[_0x488c('0x33')][_0x488c('0x56')]({'where':{'id':_0x2f8a9b[_0x488c('0x4b')]['id']}})[_0x488c('0x28')](handleEntityNotFound(_0x2ad58f,null))['then'](saveUpdates(_0x2f8a9b[_0x488c('0x51')],null))[_0x488c('0x28')](respondWithResult(_0x2ad58f,null))[_0x488c('0x4a')](handleError(_0x2ad58f,null));};exports['destroy']=function(_0x170957,_0x5c7efa){return db[_0x488c('0x33')][_0x488c('0x56')]({'where':{'id':_0x170957['params']['id']}})[_0x488c('0x28')](handleEntityNotFound(_0x5c7efa,null))['then'](removeEntity(_0x5c7efa,null))[_0x488c('0x4a')](handleError(_0x5c7efa,null));};exports[_0x488c('0x5a')]=function(_0x4a79e1,_0x24da64){return db[_0x488c('0x33')]['describe']()[_0x488c('0x28')](respondWithResult(_0x24da64,null))[_0x488c('0x4a')](handleError(_0x24da64,null));};exports[_0x488c('0x5b')]=function(_0x4e6b0a,_0x4bec14,_0x4aaebc){var _0x49c044={'raw':!![],'where':{}},_0x13cd51={},_0x18ae38;return db['WhatsappQueue'][_0x488c('0x5c')]({'where':{'id':_0x4e6b0a[_0x488c('0x4b')]['id']}})[_0x488c('0x28')](handleEntityNotFound(_0x4bec14,null))[_0x488c('0x28')](function(_0x18f98f){if(_0x18f98f){_0x18ae38=_0x18f98f[_0x488c('0x29')]({'plain':!![]});_0x13cd51[_0x488c('0x37')]=_[_0x488c('0x4c')](db[_0x488c('0x5d')]['rawAttributes']);_0x13cd51['query']=_['keys'](_0x4e6b0a['query']);_0x13cd51[_0x488c('0x40')]=_[_0x488c('0x39')](_0x13cd51[_0x488c('0x37')],_0x13cd51[_0x488c('0x38')]);_0x49c044[_0x488c('0x3a')]=_[_0x488c('0x39')](_0x13cd51[_0x488c('0x37')],qs[_0x488c('0x4d')](_0x4e6b0a[_0x488c('0x38')][_0x488c('0x4d')]));_0x49c044[_0x488c('0x3a')]=_0x49c044['attributes']['length']?_0x49c044[_0x488c('0x3a')]:_0x13cd51[_0x488c('0x37')];if(!_0x4e6b0a[_0x488c('0x38')][_0x488c('0x3b')](_0x488c('0x3c'))){_0x49c044['limit']=qs['limit'](_0x4e6b0a['query']['limit']);_0x49c044[_0x488c('0x1f')]=qs[_0x488c('0x1f')](_0x4e6b0a[_0x488c('0x38')]['offset']);}_0x49c044['order']=qs[_0x488c('0x3e')](_0x4e6b0a[_0x488c('0x38')]['sort']);_0x49c044[_0x488c('0x3f')]=qs[_0x488c('0x40')](_[_0x488c('0x41')](_0x4e6b0a[_0x488c('0x38')],_0x13cd51[_0x488c('0x40')]));_0x49c044[_0x488c('0x3f')][_0x488c('0x5e')]=_0x18f98f['id'];if(_0x4e6b0a[_0x488c('0x38')]['filter']){_0x49c044[_0x488c('0x3f')]=_[_0x488c('0x43')](_0x49c044[_0x488c('0x3f')],{'$or':_[_0x488c('0x32')](_0x49c044['attributes'],function(_0x3960c8){var _0x21d327={};_0x21d327[_0x3960c8]={'$like':'%'+_0x4e6b0a['query'][_0x488c('0x42')]+'%'};return _0x21d327;})});}_0x49c044=_[_0x488c('0x43')]({},_0x49c044,_0x4e6b0a[_0x488c('0x4f')]);return db[_0x488c('0x5d')]['findAll'](_0x49c044);}})[_0x488c('0x28')](function(_0x12a0a4){if(_0x12a0a4){return db[_0x488c('0x5f')]['findAndCountAll']({'where':{'id':_[_0x488c('0x32')](_0x12a0a4,_0x488c('0x60')),'role':'agent'},'attributes':['id','name',_0x488c('0x61'),_0x488c('0x62'),_0x488c('0x63')]});}})['then'](function(_0x40f496){if(_0x40f496){return{'count':_0x40f496[_0x488c('0x1e')],'rows':_['map'](_0x40f496[_0x488c('0x49')],function(_0x324e4f){return{'membername':_0x324e4f[_0x488c('0x2f')],'UserId':_0x324e4f['id'],'queue_name':_0x18ae38[_0x488c('0x2f')],'WhatsappQueueId':_0x18ae38['id'],'interface':util[_0x488c('0x64')]('%s/%s',_0x488c('0x65'),_0x324e4f[_0x488c('0x2f')]),'penalty':0x0,'paused':_0x324e4f['whatsappPause'],'createdAt':_0x324e4f[_0x488c('0x63')],'updatedAt':_0x324e4f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x488c('0x28')](respondWithFilteredResult(_0x4bec14,_0x49c044))[_0x488c('0x4a')](handleError(_0x4bec14,null));};exports[_0x488c('0x66')]=function(_0x39a4cf,_0x1a0b85,_0xa72f1a){var _0x1c6b3e={};var _0x2ebc47={};var _0x54960b;var _0x419357;return db[_0x488c('0x33')][_0x488c('0x5c')]({'where':{'id':_0x39a4cf[_0x488c('0x4b')]['id']}})[_0x488c('0x28')](handleEntityNotFound(_0x1a0b85,null))['then'](function(_0x297e40){if(_0x297e40){_0x54960b=_0x297e40;_0x2ebc47[_0x488c('0x37')]=_[_0x488c('0x4c')](db[_0x488c('0x67')]['rawAttributes']);_0x2ebc47['query']=_['keys'](_0x39a4cf[_0x488c('0x38')]);_0x2ebc47[_0x488c('0x40')]=_[_0x488c('0x39')](_0x2ebc47[_0x488c('0x37')],_0x2ebc47[_0x488c('0x38')]);_0x1c6b3e[_0x488c('0x3a')]=_[_0x488c('0x39')](_0x2ebc47[_0x488c('0x37')],qs[_0x488c('0x4d')](_0x39a4cf[_0x488c('0x38')]['fields']));_0x1c6b3e[_0x488c('0x3a')]=_0x1c6b3e[_0x488c('0x3a')][_0x488c('0x4e')]?_0x1c6b3e[_0x488c('0x3a')]:_0x2ebc47[_0x488c('0x37')];_0x1c6b3e[_0x488c('0x3d')]=qs[_0x488c('0x3e')](_0x39a4cf[_0x488c('0x38')][_0x488c('0x3e')]);_0x1c6b3e[_0x488c('0x3f')]=qs[_0x488c('0x40')](_[_0x488c('0x41')](_0x39a4cf[_0x488c('0x38')],_0x2ebc47[_0x488c('0x40')]));if(_0x39a4cf[_0x488c('0x38')][_0x488c('0x42')]){_0x1c6b3e[_0x488c('0x3f')]=_[_0x488c('0x43')](_0x1c6b3e[_0x488c('0x3f')],{'$or':_['map'](_0x1c6b3e[_0x488c('0x3a')],function(_0x7a12f7){var _0x42ed98={};_0x42ed98[_0x7a12f7]={'$like':'%'+_0x39a4cf['query'][_0x488c('0x42')]+'%'};return _0x42ed98;})});}_0x1c6b3e=_['merge']({},_0x1c6b3e,_0x39a4cf[_0x488c('0x4f')]);return _0x54960b[_0x488c('0x66')](_0x1c6b3e);}})['then'](function(_0x52ef41){if(_0x52ef41){_0x419357=_0x52ef41[_0x488c('0x4e')];if(!_0x39a4cf[_0x488c('0x38')][_0x488c('0x3b')](_0x488c('0x3c'))){_0x1c6b3e['limit']=qs['limit'](_0x39a4cf[_0x488c('0x38')][_0x488c('0x20')]);_0x1c6b3e[_0x488c('0x1f')]=qs[_0x488c('0x1f')](_0x39a4cf[_0x488c('0x38')]['offset']);}return _0x54960b[_0x488c('0x66')](_0x1c6b3e);}})[_0x488c('0x28')](function(_0x159dc9){if(_0x159dc9){return _0x159dc9?{'count':_0x419357,'rows':_0x159dc9}:null;}})[_0x488c('0x28')](respondWithResult(_0x1a0b85,null))[_0x488c('0x4a')](handleError(_0x1a0b85,null));};exports[_0x488c('0x68')]=function(_0x2031f2,_0x2eb021,_0x4fcba0){var _0x44cf13=_0x2031f2[_0x488c('0x51')][_0x488c('0x69')];return db['Team']['findAll']({'where':{'id':_0x44cf13},'attributes':['id'],'include':[{'model':db[_0x488c('0x5f')],'as':_0x488c('0x6a'),'attributes':['id',_0x488c('0x2f'),_0x488c('0x6b'),_0x488c('0x6c'),_0x488c('0x6d')],'raw':!![]}]})[_0x488c('0x28')](function(_0x25848a){if(_0x25848a){var _0x2e3284=_[_0x488c('0x6e')](_0x25848a,function(_0x12b8fe){var _0x1c29de=_0x12b8fe['get']({'plain':!![]});return _0x1c29de[_0x488c('0x6a')];});return db[_0x488c('0x33')][_0x488c('0x56')]({'where':{'id':_0x2031f2[_0x488c('0x4b')]['id']}})[_0x488c('0x28')](function(_0x163a67){return db[_0x488c('0x6f')]['transaction'](function(_0x54cafa){return _0x163a67[_0x488c('0x68')](_0x44cf13,{'transaction':_0x54cafa})['then'](function(){return BPromise[_0x488c('0x70')](_0x2e3284,function(_0x249c59){return db[_0x488c('0x5d')][_0x488c('0x71')]({'where':{'UserId':_0x249c59['id'],'WhatsappQueueId':_0x2031f2[_0x488c('0x4b')]['id']},'transaction':_0x54cafa});});})[_0x488c('0x28')](function(){_0x2e3284['forEach'](function(_0x50b966){socket[_0x488c('0x72')]('userWhatsappQueue:save',{'UserId':_0x50b966['id'],'WhatsappQueueId':_0x163a67['id']});});});});});}})[_0x488c('0x28')](respondWithStatusCode(_0x2eb021,null))['catch'](handleError(_0x2eb021,null));};exports[_0x488c('0x73')]=function(_0x34ef9f,_0x94977,_0x13b947){return db[_0x488c('0x67')]['findAll']({'where':{'id':_0x34ef9f[_0x488c('0x38')][_0x488c('0x69')]},'attributes':['id'],'include':[{'model':db[_0x488c('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x488c('0x28')](handleEntityNotFound(_0x94977,null))['then'](function(_0x5606b2){var _0x25ae00=_[_0x488c('0x32')](_0x5606b2,'id');var _0x2a7bc2=[];var _0x4d34b7=[];var _0x4d7742=squel[_0x488c('0x74')]();_0x4d7742['field']('tq.TeamId')[_0x488c('0x75')](_0x488c('0x76'),'tq')[_0x488c('0x77')]('user_has_teams','ut',_0x488c('0x78'))[_0x488c('0x3f')](_0x488c('0x79'),_0x34ef9f[_0x488c('0x4b')]['id']);for(var _0x1fad4e=0x0;_0x1fad4e<_0x5606b2[_0x488c('0x4e')];_0x1fad4e+=0x1){let _0x109166=_0x5606b2[_0x1fad4e];for(var _0x8722c=0x0;_0x8722c<_0x109166[_0x488c('0x6a')][_0x488c('0x4e')];_0x8722c+=0x1){let _0x5b8c38=_0x109166[_0x488c('0x6a')][_0x8722c];var _0x1fe14e=_0x4d7742[_0x488c('0x7a')]();_0x1fe14e[_0x488c('0x3f')](_0x488c('0x7b'),_0x5b8c38['id']);_0x4d34b7[_0x488c('0x7c')](db[_0x488c('0x6f')][_0x488c('0x38')](_0x1fe14e[_0x488c('0x7d')](),{'type':db['sequelize']['QueryTypes'][_0x488c('0x7e')]})[_0x488c('0x28')](function(_0x2c2585){if(_0x2c2585[_0x488c('0x4e')]===0x1){return _0x5b8c38['id'];}else{var _0x503f8c=_[_0x488c('0x7f')](_[_0x488c('0x32')](_0x2c2585,_0x488c('0x80')),function(_0x454253){return _[_0x488c('0x81')](_0x25ae00,_0x454253);});if(_0x503f8c){return _0x5b8c38['id'];}}}));}}return BPromise['all'](_0x4d34b7)[_0x488c('0x28')](function(_0x35d660){_0x2a7bc2=_(_0x2a7bc2)[_0x488c('0x82')](_0x35d660)[_0x488c('0x83')]()[_0x488c('0x84')]();return db['WhatsappQueue']['find']({'where':{'id':_0x34ef9f['params']['id']}})[_0x488c('0x28')](function(_0x3fb00f){return db['sequelize'][_0x488c('0x85')](function(_0x5b77cd){return _0x3fb00f[_0x488c('0x73')](_0x34ef9f[_0x488c('0x38')][_0x488c('0x69')],{'transaction':_0x5b77cd})[_0x488c('0x28')](function(){if(!_['isEmpty'](_0x2a7bc2)){return _0x3fb00f[_0x488c('0x86')](_0x2a7bc2,{'transaction':_0x5b77cd});}})['then'](function(){_0x2a7bc2['forEach'](function(_0x260d96){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x260d96,'WhatsappQueueId':_0x3fb00f['id']});});});});});});})[_0x488c('0x28')](respondWithStatusCode(_0x94977,null))[_0x488c('0x4a')](handleError(_0x94977,null));};exports[_0x488c('0x87')]=function(_0x22b537,_0x1ce5ad,_0x4d06fe){return db[_0x488c('0x33')][_0x488c('0x56')]({'where':{'id':_0x22b537[_0x488c('0x4b')]['id']}})[_0x488c('0x28')](handleEntityNotFound(_0x1ce5ad,null))[_0x488c('0x28')](function(_0x19dd9c){if(_0x19dd9c){return _0x19dd9c[_0x488c('0x87')](_0x22b537[_0x488c('0x51')]['ids'],_[_0x488c('0x88')](_0x22b537[_0x488c('0x51')],[_0x488c('0x69'),'id'])||{})['spread'](function(_0x5eaa37){for(var _0x1a68b5=0x0;_0x1a68b5<_0x22b537[_0x488c('0x51')]['ids']['length'];_0x1a68b5+=0x1){socket[_0x488c('0x72')](_0x488c('0x89'),{'UserId':_0x22b537[_0x488c('0x51')][_0x488c('0x69')][_0x1a68b5],'WhatsappQueueId':_0x22b537['params']['id']});}return _0x5eaa37;});}})[_0x488c('0x28')](respondWithResult(_0x1ce5ad,null))[_0x488c('0x4a')](handleError(_0x1ce5ad,null));};exports['removeAgents']=function(_0x20bb4b,_0x207805,_0x8ae2bf){return db[_0x488c('0x33')][_0x488c('0x56')]({'where':{'id':_0x20bb4b[_0x488c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x207805,null))['then'](function(_0x197de8){if(_0x197de8){return _0x197de8[_0x488c('0x86')](_0x20bb4b[_0x488c('0x38')][_0x488c('0x69')])[_0x488c('0x28')](function(){if(_['isArray'](_0x20bb4b[_0x488c('0x38')][_0x488c('0x69')])){for(var _0x264e1f=0x0;_0x264e1f<_0x20bb4b['query']['ids'][_0x488c('0x4e')];_0x264e1f+=0x1){socket[_0x488c('0x72')](_0x488c('0x8a'),{'UserId':Number(_0x20bb4b['query']['ids'][_0x264e1f]),'WhatsappQueueId':Number(_0x20bb4b[_0x488c('0x4b')]['id'])});}}else{socket[_0x488c('0x72')]('userWhatsappQueue:remove',{'UserId':Number(_0x20bb4b[_0x488c('0x38')]['ids']),'WhatsappQueueId':Number(_0x20bb4b['params']['id'])});}});}})[_0x488c('0x28')](respondWithStatusCode(_0x207805,null))['catch'](handleError(_0x207805,null));};exports[_0x488c('0x8b')]=function(_0x4d477c,_0x56764c,_0x5eb368){var _0x32f358={};var _0x4bad79={};var _0x53d1f9;var _0x4d4166;return db[_0x488c('0x33')][_0x488c('0x5c')]({'where':{'id':_0x4d477c['params']['id']}})['then'](handleEntityNotFound(_0x56764c,null))[_0x488c('0x28')](function(_0x231205){if(_0x231205){_0x53d1f9=_0x231205;_0x4bad79[_0x488c('0x37')]=_[_0x488c('0x4c')](db[_0x488c('0x5f')][_0x488c('0x34')]);_0x4bad79[_0x488c('0x38')]=_[_0x488c('0x4c')](_0x4d477c[_0x488c('0x38')]);_0x4bad79[_0x488c('0x40')]=_['intersection'](_0x4bad79['model'],_0x4bad79['query']);_0x32f358[_0x488c('0x3a')]=_['intersection'](_0x4bad79[_0x488c('0x37')],qs[_0x488c('0x4d')](_0x4d477c['query'][_0x488c('0x4d')]));_0x32f358['attributes']=_0x32f358[_0x488c('0x3a')][_0x488c('0x4e')]?_0x32f358['attributes']:_0x4bad79[_0x488c('0x37')];_0x32f358[_0x488c('0x3d')]=qs[_0x488c('0x3e')](_0x4d477c['query']['sort']);_0x32f358['where']=qs[_0x488c('0x40')](_[_0x488c('0x41')](_0x4d477c[_0x488c('0x38')],_0x4bad79[_0x488c('0x40')]));if(_0x4d477c[_0x488c('0x38')][_0x488c('0x42')]){_0x32f358[_0x488c('0x3f')]=_[_0x488c('0x43')](_0x32f358[_0x488c('0x3f')],{'$or':_[_0x488c('0x32')](_0x32f358['attributes'],function(_0x1e7352){var _0x573e88={};_0x573e88[_0x1e7352]={'$like':'%'+_0x4d477c[_0x488c('0x38')][_0x488c('0x42')]+'%'};return _0x573e88;})});}_0x32f358=_[_0x488c('0x43')]({},_0x32f358,_0x4d477c[_0x488c('0x4f')]);return _0x53d1f9[_0x488c('0x8b')](_0x32f358);}})[_0x488c('0x28')](function(_0x353b0a){if(_0x353b0a){_0x4d4166=_0x353b0a['length'];if(!_0x4d477c[_0x488c('0x38')][_0x488c('0x3b')](_0x488c('0x3c'))){_0x32f358[_0x488c('0x20')]=qs['limit'](_0x4d477c[_0x488c('0x38')][_0x488c('0x20')]);_0x32f358[_0x488c('0x1f')]=qs[_0x488c('0x1f')](_0x4d477c['query'][_0x488c('0x1f')]);}return _0x53d1f9[_0x488c('0x8b')](_0x32f358);}})[_0x488c('0x28')](function(_0x58cf1c){if(_0x58cf1c){return _0x58cf1c?{'count':_0x4d4166,'rows':_0x58cf1c}:null;}})[_0x488c('0x28')](respondWithResult(_0x56764c,null))['catch'](handleError(_0x56764c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index e0024ba..6172eda 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 _0x458e=['exports','events','../../mysqldb','WhatsappQueue','update','emit'];(function(_0x3f87a9,_0x3b3bfc){var _0x513fe9=function(_0x24cf78){while(--_0x24cf78){_0x3f87a9['push'](_0x3f87a9['shift']());}};_0x513fe9(++_0x3b3bfc);}(_0x458e,0xb5));var _0xe458=function(_0x5685ce,_0x4a7322){_0x5685ce=_0x5685ce-0x0;var _0x3960be=_0x458e[_0x5685ce];return _0x3960be;};'use strict';var EventEmitter=require(_0xe458('0x0'));var WhatsappQueue=require(_0xe458('0x1'))['db'][_0xe458('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe458('0x3'),'afterDestroy':'remove'};function emitEvent(_0x435d26){return function(_0x36662b,_0x5ce946,_0x1aefc7){WhatsappQueueEvents[_0xe458('0x4')](_0x435d26+':'+_0x36662b['id'],_0x36662b);WhatsappQueueEvents[_0xe458('0x4')](_0x435d26,_0x36662b);_0x1aefc7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xe458('0x5')]=WhatsappQueueEvents; \ No newline at end of file +var _0xe5f6=['events','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x4a618b,_0x11d42e){var _0x1a006d=function(_0x18c914){while(--_0x18c914){_0x4a618b['push'](_0x4a618b['shift']());}};_0x1a006d(++_0x11d42e);}(_0xe5f6,0xf3));var _0x6e5f=function(_0x252d87,_0x932b52){_0x252d87=_0x252d87-0x0;var _0x526e8e=_0xe5f6[_0x252d87];return _0x526e8e;};'use strict';var EventEmitter=require(_0x6e5f('0x0'));var WhatsappQueue=require(_0x6e5f('0x1'))['db'][_0x6e5f('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6e5f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6e5f('0x4'),'afterDestroy':_0x6e5f('0x5')};function emitEvent(_0x3b18d0){return function(_0x3ce9b2,_0x4d9d8a,_0x222623){WhatsappQueueEvents[_0x6e5f('0x6')](_0x3b18d0+':'+_0x3ce9b2['id'],_0x3ce9b2);WhatsappQueueEvents['emit'](_0x3b18d0,_0x3ce9b2);_0x222623(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x6e5f('0x7')](e,emitEvent(event));}}module[_0x6e5f('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 5f3b5f7..58a010f 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 _0xcd5f=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','whatsapp_queues'];(function(_0xc43e41,_0x2935d3){var _0xdffeb1=function(_0x26a974){while(--_0x26a974){_0xc43e41['push'](_0xc43e41['shift']());}};_0xdffeb1(++_0x2935d3);}(_0xcd5f,0x9a));var _0xfcd5=function(_0x3438cb,_0x861903){_0x3438cb=_0x3438cb-0x0;var _0xe28847=_0xcd5f[_0x3438cb];return _0xe28847;};'use strict';var _=require(_0xfcd5('0x0'));var util=require(_0xfcd5('0x1'));var logger=require('../../config/logger')(_0xfcd5('0x2'));var moment=require(_0xfcd5('0x3'));var BPromise=require(_0xfcd5('0x4'));var rp=require(_0xfcd5('0x5'));var fs=require('fs');var path=require(_0xfcd5('0x6'));var rimraf=require(_0xfcd5('0x7'));var config=require(_0xfcd5('0x8'));var attributes=require(_0xfcd5('0x9'));module['exports']=function(_0x111892,_0x24307d){return _0x111892['define']('WhatsappQueue',attributes,{'tableName':_0xfcd5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb046=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash'];(function(_0x571743,_0x566101){var _0x5d4f6e=function(_0x8fa6a5){while(--_0x8fa6a5){_0x571743['push'](_0x571743['shift']());}};_0x5d4f6e(++_0x566101);}(_0xb046,0x1df));var _0x6b04=function(_0x34bc94,_0x74f0fd){_0x34bc94=_0x34bc94-0x0;var _0xee41e7=_0xb046[_0x34bc94];return _0xee41e7;};'use strict';var _=require(_0x6b04('0x0'));var util=require(_0x6b04('0x1'));var logger=require(_0x6b04('0x2'))(_0x6b04('0x3'));var moment=require('moment');var BPromise=require(_0x6b04('0x4'));var rp=require(_0x6b04('0x5'));var fs=require('fs');var path=require(_0x6b04('0x6'));var rimraf=require('rimraf');var config=require(_0x6b04('0x7'));var attributes=require(_0x6b04('0x8'));module[_0x6b04('0x9')]=function(_0x51b341,_0x4a1050){return _0x51b341[_0x6b04('0xa')](_0x6b04('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 5f18266..03bca0c 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 _0x0cef=['ShowWhatsappQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','WhatsappQueue','findAll','options','where','limit','map','include','model','attributes','then','GetWhatsappQueue','debug','stringify','catch'];(function(_0x18e50f,_0x484130){var _0x49ae07=function(_0x52c3c1){while(--_0x52c3c1){_0x18e50f['push'](_0x18e50f['shift']());}};_0x49ae07(++_0x484130);}(_0x0cef,0x7d));var _0xf0ce=function(_0x29cb88,_0x36e887){_0x29cb88=_0x29cb88-0x0;var _0x7988a7=_0x0cef[_0x29cb88];return _0x7988a7;};'use strict';var _=require('lodash');var util=require(_0xf0ce('0x0'));var moment=require(_0xf0ce('0x1'));var BPromise=require(_0xf0ce('0x2'));var rs=require(_0xf0ce('0x3'));var fs=require('fs');var Redis=require(_0xf0ce('0x4'));var db=require(_0xf0ce('0x5'))['db'];var utils=require(_0xf0ce('0x6'));var logger=require('../../config/logger')(_0xf0ce('0x7'));var config=require('../../config/environment');var jayson=require(_0xf0ce('0x8'));var client=jayson[_0xf0ce('0x9')]['http']({'port':0x232a});config['redis']=_[_0xf0ce('0xa')](config['redis'],{'host':_0xf0ce('0xb'),'port':0x18eb});var socket=require(_0xf0ce('0xc'))(new Redis(config[_0xf0ce('0xd')]));require(_0xf0ce('0xe'))[_0xf0ce('0xf')](socket);function respondWithRpcPromise(_0x5ddfb1,_0x23d57e,_0x489cfd){return new BPromise(function(_0x11d639,_0x290f2b){return client[_0xf0ce('0x10')](_0x5ddfb1,_0x489cfd)['then'](function(_0x4e4d6d){logger[_0xf0ce('0x11')](_0xf0ce('0x12'),_0x23d57e,_0xf0ce('0x13'));logger['debug'](_0xf0ce('0x14'),_0x23d57e,_0xf0ce('0x13'),JSON['stringify'](_0x4e4d6d));if(_0x4e4d6d['error']){if(_0x4e4d6d[_0xf0ce('0x15')][_0xf0ce('0x16')]===0x1f4){logger[_0xf0ce('0x15')](_0xf0ce('0x12'),_0x23d57e,_0x4e4d6d[_0xf0ce('0x15')][_0xf0ce('0x17')]);return _0x290f2b(_0x4e4d6d[_0xf0ce('0x15')][_0xf0ce('0x17')]);}logger[_0xf0ce('0x15')](_0xf0ce('0x12'),_0x23d57e,_0x4e4d6d['error'][_0xf0ce('0x17')]);return _0x11d639(_0x4e4d6d[_0xf0ce('0x15')][_0xf0ce('0x17')]);}else{logger[_0xf0ce('0x11')](_0xf0ce('0x12'),_0x23d57e,_0xf0ce('0x13'));_0x11d639(_0x4e4d6d[_0xf0ce('0x18')][_0xf0ce('0x17')]);}})['catch'](function(_0x3a0d1f){logger[_0xf0ce('0x15')](_0xf0ce('0x12'),_0x23d57e,_0x3a0d1f);_0x290f2b(_0x3a0d1f);});});}exports['GetWhatsappQueue']=function(_0x1a40f7){var _0x3f6d57=this;return new Promise(function(_0x3697a3,_0x4d5dfa){return db[_0xf0ce('0x19')][_0xf0ce('0x1a')]({'raw':_0x1a40f7[_0xf0ce('0x1b')]?_0x1a40f7[_0xf0ce('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1a40f7[_0xf0ce('0x1b')]?_0x1a40f7[_0xf0ce('0x1b')][_0xf0ce('0x1c')]||null:null,'attributes':_0x1a40f7[_0xf0ce('0x1b')]?_0x1a40f7[_0xf0ce('0x1b')]['attributes']||null:null,'limit':_0x1a40f7['options']?_0x1a40f7[_0xf0ce('0x1b')][_0xf0ce('0x1d')]||null:null,'include':_0x1a40f7['options']?_0x1a40f7['options']['include']?_[_0xf0ce('0x1e')](_0x1a40f7[_0xf0ce('0x1b')][_0xf0ce('0x1f')],function(_0x27879f){return{'model':db[_0x27879f[_0xf0ce('0x20')]],'as':_0x27879f['as'],'attributes':_0x27879f[_0xf0ce('0x21')],'include':_0x27879f[_0xf0ce('0x1f')]?_[_0xf0ce('0x1e')](_0x27879f[_0xf0ce('0x1f')],function(_0x20aeb9){return{'model':db[_0x20aeb9[_0xf0ce('0x20')]],'as':_0x20aeb9['as'],'attributes':_0x20aeb9[_0xf0ce('0x21')],'include':_0x20aeb9[_0xf0ce('0x1f')]?_[_0xf0ce('0x1e')](_0x20aeb9['include'],function(_0x5d69c3){return{'model':db[_0x5d69c3[_0xf0ce('0x20')]],'as':_0x5d69c3['as'],'attributes':_0x5d69c3[_0xf0ce('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf0ce('0x22')](function(_0xa7a55d){logger[_0xf0ce('0x11')](_0xf0ce('0x23'),_0x1a40f7);logger[_0xf0ce('0x24')](_0xf0ce('0x23'),_0x1a40f7,JSON[_0xf0ce('0x25')](_0xa7a55d));_0x3697a3(_0xa7a55d);})[_0xf0ce('0x26')](function(_0x39a57f){logger['error'](_0xf0ce('0x23'),_0x39a57f[_0xf0ce('0x17')],_0x1a40f7);_0x4d5dfa(_0x3f6d57[_0xf0ce('0x15')](0x1f4,_0x39a57f[_0xf0ce('0x17')]));});});};exports[_0xf0ce('0x27')]=function(_0x3d6bc3){var _0x45b1ed=this;return new Promise(function(_0x1d0a55,_0x28db3f){return db[_0xf0ce('0x19')][_0xf0ce('0x28')]({'raw':_0x3d6bc3[_0xf0ce('0x1b')]?_0x3d6bc3[_0xf0ce('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3d6bc3[_0xf0ce('0x1b')]?_0x3d6bc3['options'][_0xf0ce('0x1c')]||null:null,'attributes':_0x3d6bc3[_0xf0ce('0x1b')]?_0x3d6bc3[_0xf0ce('0x1b')]['attributes']||null:null,'include':_0x3d6bc3[_0xf0ce('0x1b')]?_0x3d6bc3[_0xf0ce('0x1b')][_0xf0ce('0x1f')]?_[_0xf0ce('0x1e')](_0x3d6bc3[_0xf0ce('0x1b')]['include'],function(_0x285305){return{'model':db[_0x285305['model']],'as':_0x285305['as'],'attributes':_0x285305[_0xf0ce('0x21')],'include':_0x285305[_0xf0ce('0x1f')]?_[_0xf0ce('0x1e')](_0x285305[_0xf0ce('0x1f')],function(_0x51fb57){return{'model':db[_0x51fb57['model']],'as':_0x51fb57['as'],'attributes':_0x51fb57[_0xf0ce('0x21')],'include':_0x51fb57[_0xf0ce('0x1f')]?_[_0xf0ce('0x1e')](_0x51fb57[_0xf0ce('0x1f')],function(_0x483def){return{'model':db[_0x483def[_0xf0ce('0x20')]],'as':_0x483def['as'],'attributes':_0x483def[_0xf0ce('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf0ce('0x22')](function(_0x123e44){logger[_0xf0ce('0x11')]('ShowWhatsappQueue',_0x3d6bc3);logger[_0xf0ce('0x24')](_0xf0ce('0x27'),_0x3d6bc3,JSON[_0xf0ce('0x25')](_0x123e44));_0x1d0a55(_0x123e44);})[_0xf0ce('0x26')](function(_0x4f99a3){logger['error'](_0xf0ce('0x27'),_0x4f99a3['message'],_0x3d6bc3);_0x28db3f(_0x45b1ed[_0xf0ce('0x15')](0x1f4,_0x4f99a3[_0xf0ce('0x17')]));});});}; \ No newline at end of file +var _0xc58b=['options','where','attributes','limit','include','map','model','then','find','raw','ShowWhatsappQueue','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xc58b,0x1df));var _0xbc58=function(_0x34ffcc,_0x5bf550){_0x34ffcc=_0x34ffcc-0x0;var _0x4e815a=_0xc58b[_0x34ffcc];return _0x4e815a;};'use strict';var _=require(_0xbc58('0x0'));var util=require(_0xbc58('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbc58('0x2'));var fs=require('fs');var Redis=require(_0xbc58('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc58('0x4'))(_0xbc58('0x5'));var config=require(_0xbc58('0x6'));var jayson=require(_0xbc58('0x7'));var client=jayson[_0xbc58('0x8')][_0xbc58('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xbc58('0xa'),'port':0x18eb});var socket=require(_0xbc58('0xb'))(new Redis(config[_0xbc58('0xc')]));require(_0xbc58('0xd'))[_0xbc58('0xe')](socket);function respondWithRpcPromise(_0x2dfc95,_0x21fb97,_0x163541){return new BPromise(function(_0xf7ae76,_0x5bb20a){return client['request'](_0x2dfc95,_0x163541)['then'](function(_0x4b7fad){logger['info'](_0xbc58('0xf'),_0x21fb97,_0xbc58('0x10'));logger[_0xbc58('0x11')](_0xbc58('0x12'),_0x21fb97,'request\x20sent',JSON[_0xbc58('0x13')](_0x4b7fad));if(_0x4b7fad[_0xbc58('0x14')]){if(_0x4b7fad['error'][_0xbc58('0x15')]===0x1f4){logger['error'](_0xbc58('0xf'),_0x21fb97,_0x4b7fad[_0xbc58('0x14')]['message']);return _0x5bb20a(_0x4b7fad[_0xbc58('0x14')][_0xbc58('0x16')]);}logger[_0xbc58('0x14')](_0xbc58('0xf'),_0x21fb97,_0x4b7fad['error'][_0xbc58('0x16')]);return _0xf7ae76(_0x4b7fad[_0xbc58('0x14')][_0xbc58('0x16')]);}else{logger[_0xbc58('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x21fb97,_0xbc58('0x10'));_0xf7ae76(_0x4b7fad[_0xbc58('0x18')][_0xbc58('0x16')]);}})[_0xbc58('0x19')](function(_0x3f66f6){logger[_0xbc58('0x14')](_0xbc58('0xf'),_0x21fb97,_0x3f66f6);_0x5bb20a(_0x3f66f6);});});}exports[_0xbc58('0x1a')]=function(_0x129837){var _0x17d49c=this;return new Promise(function(_0x5b9168,_0x2938bf){return db[_0xbc58('0x1b')]['findAll']({'raw':_0x129837[_0xbc58('0x1c')]?_0x129837[_0xbc58('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x129837[_0xbc58('0x1c')]?_0x129837[_0xbc58('0x1c')][_0xbc58('0x1d')]||null:null,'attributes':_0x129837[_0xbc58('0x1c')]?_0x129837[_0xbc58('0x1c')][_0xbc58('0x1e')]||null:null,'limit':_0x129837[_0xbc58('0x1c')]?_0x129837['options'][_0xbc58('0x1f')]||null:null,'include':_0x129837[_0xbc58('0x1c')]?_0x129837[_0xbc58('0x1c')][_0xbc58('0x20')]?_[_0xbc58('0x21')](_0x129837[_0xbc58('0x1c')]['include'],function(_0xc2b195){return{'model':db[_0xc2b195['model']],'as':_0xc2b195['as'],'attributes':_0xc2b195[_0xbc58('0x1e')],'include':_0xc2b195[_0xbc58('0x20')]?_[_0xbc58('0x21')](_0xc2b195[_0xbc58('0x20')],function(_0x29c236){return{'model':db[_0x29c236['model']],'as':_0x29c236['as'],'attributes':_0x29c236[_0xbc58('0x1e')],'include':_0x29c236[_0xbc58('0x20')]?_[_0xbc58('0x21')](_0x29c236[_0xbc58('0x20')],function(_0x5c0a32){return{'model':db[_0x5c0a32[_0xbc58('0x22')]],'as':_0x5c0a32['as'],'attributes':_0x5c0a32[_0xbc58('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbc58('0x23')](function(_0x57547f){logger[_0xbc58('0x17')](_0xbc58('0x1a'),_0x129837);logger[_0xbc58('0x11')](_0xbc58('0x1a'),_0x129837,JSON['stringify'](_0x57547f));_0x5b9168(_0x57547f);})['catch'](function(_0x13a8d6){logger[_0xbc58('0x14')](_0xbc58('0x1a'),_0x13a8d6['message'],_0x129837);_0x2938bf(_0x17d49c[_0xbc58('0x14')](0x1f4,_0x13a8d6[_0xbc58('0x16')]));});});};exports['ShowWhatsappQueue']=function(_0x4815c9){var _0x465a07=this;return new Promise(function(_0x35fcb3,_0x2995db){return db['WhatsappQueue'][_0xbc58('0x24')]({'raw':_0x4815c9[_0xbc58('0x1c')]?_0x4815c9['options'][_0xbc58('0x25')]===undefined?!![]:![]:!![],'where':_0x4815c9['options']?_0x4815c9[_0xbc58('0x1c')]['where']||null:null,'attributes':_0x4815c9[_0xbc58('0x1c')]?_0x4815c9['options']['attributes']||null:null,'include':_0x4815c9['options']?_0x4815c9[_0xbc58('0x1c')]['include']?_[_0xbc58('0x21')](_0x4815c9[_0xbc58('0x1c')][_0xbc58('0x20')],function(_0x2b1796){return{'model':db[_0x2b1796[_0xbc58('0x22')]],'as':_0x2b1796['as'],'attributes':_0x2b1796['attributes'],'include':_0x2b1796[_0xbc58('0x20')]?_[_0xbc58('0x21')](_0x2b1796[_0xbc58('0x20')],function(_0x59ba4e){return{'model':db[_0x59ba4e[_0xbc58('0x22')]],'as':_0x59ba4e['as'],'attributes':_0x59ba4e['attributes'],'include':_0x59ba4e[_0xbc58('0x20')]?_[_0xbc58('0x21')](_0x59ba4e[_0xbc58('0x20')],function(_0x53e6a0){return{'model':db[_0x53e6a0[_0xbc58('0x22')]],'as':_0x53e6a0['as'],'attributes':_0x53e6a0[_0xbc58('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbc58('0x23')](function(_0x3817d2){logger['info']('ShowWhatsappQueue',_0x4815c9);logger['debug']('ShowWhatsappQueue',_0x4815c9,JSON['stringify'](_0x3817d2));_0x35fcb3(_0x3817d2);})[_0xbc58('0x19')](function(_0x3a755e){logger[_0xbc58('0x14')](_0xbc58('0x26'),_0x3a755e[_0xbc58('0x16')],_0x4815c9);_0x2995db(_0x465a07[_0xbc58('0x14')](0x1f4,_0x3a755e[_0xbc58('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c290b48..5617178 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 _0x23b4=['length','whatsappQueue:','save','remove','emit','removeListener','register'];(function(_0x5c11fc,_0x43eb53){var _0x38746c=function(_0x478e89){while(--_0x478e89){_0x5c11fc['push'](_0x5c11fc['shift']());}};_0x38746c(++_0x43eb53);}(_0x23b4,0x16e));var _0x423b=function(_0x29b49d,_0x58c804){_0x29b49d=_0x29b49d-0x0;var _0x18ff22=_0x23b4[_0x29b49d];return _0x18ff22;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x423b('0x0'),_0x423b('0x1'),'update'];function createListener(_0x52448a,_0xa6c128){return function(_0x3f70d6){_0xa6c128[_0x423b('0x2')](_0x52448a,_0x3f70d6);};}function removeListener(_0x318016,_0x236fd6){return function(){WhatsappQueueEvents[_0x423b('0x3')](_0x318016,_0x236fd6);};}exports[_0x423b('0x4')]=function(_0x496524){for(var _0x179257=0x0,_0x49665b=events[_0x423b('0x5')];_0x179257<_0x49665b;_0x179257++){var _0x2b9640=events[_0x179257];var _0x10e78c=createListener(_0x423b('0x6')+_0x2b9640,_0x496524);WhatsappQueueEvents['on'](_0x2b9640,_0x10e78c);}}; \ No newline at end of file +var _0x810c=['whatsappQueue:','./whatsappQueue.events','save','update','removeListener','register'];(function(_0x253a06,_0x5ce92f){var _0x4f9106=function(_0x314d27){while(--_0x314d27){_0x253a06['push'](_0x253a06['shift']());}};_0x4f9106(++_0x5ce92f);}(_0x810c,0x1a5));var _0xc810=function(_0x5714e0,_0xbf4ccd){_0x5714e0=_0x5714e0-0x0;var _0x348053=_0x810c[_0x5714e0];return _0x348053;};'use strict';var WhatsappQueueEvents=require(_0xc810('0x0'));var events=[_0xc810('0x1'),'remove',_0xc810('0x2')];function createListener(_0x22f659,_0x542d7f){return function(_0x20d708){_0x542d7f['emit'](_0x22f659,_0x20d708);};}function removeListener(_0x16ab60,_0x58e31c){return function(){WhatsappQueueEvents[_0xc810('0x3')](_0x16ab60,_0x58e31c);};}exports[_0xc810('0x4')]=function(_0x1f71b5){for(var _0x3c5bb8=0x0,_0x38a729=events['length'];_0x3c5bb8<_0x38a729;_0x3c5bb8++){var _0x227fd4=events[_0x3c5bb8];var _0x4bb524=createListener(_0xc810('0x5')+_0x227fd4,_0x1f71b5);WhatsappQueueEvents['on'](_0x227fd4,_0x4bb524);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 6dc57c2..56fab26 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 _0x4b9f=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','update','delete','multer','util'];(function(_0x301dbf,_0x2217ea){var _0x3be856=function(_0xa9c0d1){while(--_0xa9c0d1){_0x301dbf['push'](_0x301dbf['shift']());}};_0x3be856(++_0x2217ea);}(_0x4b9f,0x18d));var _0xf4b9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4b9f[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xf4b9('0x0'));var util=require(_0xf4b9('0x1'));var path=require(_0xf4b9('0x2'));var timeout=require(_0xf4b9('0x3'));var express=require(_0xf4b9('0x4'));var router=express[_0xf4b9('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf4b9('0x6'));var config=require(_0xf4b9('0x7'));var controller=require(_0xf4b9('0x8'));router[_0xf4b9('0x9')]('/',auth[_0xf4b9('0xa')](),controller[_0xf4b9('0xb')]);router[_0xf4b9('0x9')]('/describe',auth[_0xf4b9('0xa')](),controller[_0xf4b9('0xc')]);router[_0xf4b9('0x9')](_0xf4b9('0xd'),auth[_0xf4b9('0xa')](),controller[_0xf4b9('0xe')]);router[_0xf4b9('0xf')]('/',auth[_0xf4b9('0xa')](),controller['create']);router[_0xf4b9('0x10')](_0xf4b9('0xd'),auth[_0xf4b9('0xa')](),controller[_0xf4b9('0x11')]);router[_0xf4b9('0x12')](_0xf4b9('0xd'),auth[_0xf4b9('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9219=['/:id','create','delete','destroy','express','../../components/interaction/service','get','isAuthenticated','/describe','describe'];(function(_0x116990,_0x35f867){var _0x47fadb=function(_0x4b6b47){while(--_0x4b6b47){_0x116990['push'](_0x116990['shift']());}};_0x47fadb(++_0x35f867);}(_0x9219,0x19e));var _0x9921=function(_0x508e2f,_0x4e44ea){_0x508e2f=_0x508e2f-0x0;var _0x4ba927=_0x9219[_0x508e2f];return _0x4ba927;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9921('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9921('0x1'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router[_0x9921('0x2')]('/',auth[_0x9921('0x3')](),controller['index']);router[_0x9921('0x2')](_0x9921('0x4'),auth[_0x9921('0x3')](),controller[_0x9921('0x5')]);router[_0x9921('0x2')](_0x9921('0x6'),auth[_0x9921('0x3')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x9921('0x7')]);router['put'](_0x9921('0x6'),auth['isAuthenticated'](),controller['update']);router[_0x9921('0x8')](_0x9921('0x6'),auth[_0x9921('0x3')](),controller[_0x9921('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index b49c6f8..3fbdc51 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 _0x55ca=['DATE','STRING','sequelize','exports'];(function(_0xb4c15b,_0x338632){var _0x517058=function(_0x190d49){while(--_0x190d49){_0xb4c15b['push'](_0xb4c15b['shift']());}};_0x517058(++_0x338632);}(_0x55ca,0x126));var _0xa55c=function(_0xd3e16a,_0x28517e){_0xd3e16a=_0xd3e16a-0x0;var _0x449538=_0x55ca[_0xd3e16a];return _0x449538;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa55c('0x2')]},'acceptAt':{'type':Sequelize[_0xa55c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file +var _0xedd9=['exports','STRING','DATE'];(function(_0x3bebf4,_0x4e892e){var _0xca9ee5=function(_0xc93fa7){while(--_0xc93fa7){_0x3bebf4['push'](_0x3bebf4['shift']());}};_0xca9ee5(++_0x4e892e);}(_0xedd9,0xfc));var _0x9edd=function(_0x3e9d97,_0x533b62){_0x3e9d97=_0x3e9d97-0x0;var _0x1a2255=_0xedd9[_0x3e9d97];return _0x1a2255;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'uniqueid':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x9edd('0x1')]},'joinAt':{'type':Sequelize[_0x9edd('0x2')]},'leaveAt':{'type':Sequelize[_0x9edd('0x2')]},'acceptAt':{'type':Sequelize[_0x9edd('0x2')]},'exitAt':{'type':Sequelize[_0x9edd('0x2')]},'reason':{'type':Sequelize[_0x9edd('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index e0ad480..122decf 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 _0x2fda=['filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','squel','crypto','jsforce','to-csv','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','update','then','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort'];(function(_0x35a56a,_0x2bf0b8){var _0x204184=function(_0x507720){while(--_0x507720){_0x35a56a['push'](_0x35a56a['shift']());}};_0x204184(++_0x2bf0b8);}(_0x2fda,0xdd));var _0xa2fd=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2fda[_0x1ac595];return _0x455fff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa2fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2fd('0x1'));var jsonpatch=require(_0xa2fd('0x2'));var rp=require(_0xa2fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa2fd('0x4'));var util=require(_0xa2fd('0x5'));var path=require(_0xa2fd('0x6'));var sox=require(_0xa2fd('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa2fd('0x8'));var crypto=require(_0xa2fd('0x9'));var jsforce=require(_0xa2fd('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa2fd('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa2fd('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2fd('0xd'))('api');var utils=require(_0xa2fd('0xe'));var config=require('../../config/environment');var licenseUtil=require(_0xa2fd('0xf'));var db=require(_0xa2fd('0x10'))['db'];function respondWithStatusCode(_0x4978d7,_0x5454bb){_0x5454bb=_0x5454bb||0xcc;return function(_0x3f56e1){if(_0x3f56e1){return _0x4978d7[_0xa2fd('0x11')](_0x5454bb);}return _0x4978d7['status'](_0x5454bb)[_0xa2fd('0x12')]();};}function respondWithResult(_0x3f72c7,_0x30bea9){_0x30bea9=_0x30bea9||0xc8;return function(_0x5d75c4){if(_0x5d75c4){return _0x3f72c7[_0xa2fd('0x13')](_0x30bea9)[_0xa2fd('0x14')](_0x5d75c4);}};}function respondWithFilteredResult(_0x35da12,_0x27bfd7){return function(_0x515052){if(_0x515052){var _0x3f1050=_0x515052[_0xa2fd('0x15')],_0x4c7062=_0x27bfd7[_0xa2fd('0x16')],_0xd648b8=_0x27bfd7[_0xa2fd('0x16')]+_0x27bfd7[_0xa2fd('0x17')],_0x568052;if(_0xd648b8>=_0x3f1050){_0xd648b8=_0x3f1050;_0x568052=0xc8;}else{_0x568052=0xce;}_0x35da12[_0xa2fd('0x13')](_0x568052);return _0x35da12['set'](_0xa2fd('0x18'),_0x4c7062+'-'+_0xd648b8+'/'+_0x3f1050)['json'](_0x515052);}return null;};}function patchUpdates(_0x77ee4a){return function(_0x3b8c2a){try{jsonpatch['apply'](_0x3b8c2a,_0x77ee4a,!![]);}catch(_0x49e2bf){return BPromise[_0xa2fd('0x19')](_0x49e2bf);}return _0x3b8c2a['save']();};}function saveUpdates(_0x126111,_0x2fd949){return function(_0x2a351f){if(_0x2a351f){return _0x2a351f[_0xa2fd('0x1a')](_0x126111)[_0xa2fd('0x1b')](function(_0x586789){return _0x586789;});}return null;};}function removeEntity(_0x1fff84,_0x121f94){return function(_0x12056a){if(_0x12056a){return _0x12056a['destroy']()[_0xa2fd('0x1b')](function(){_0x1fff84['status'](0xcc)[_0xa2fd('0x12')]();});}};}function handleEntityNotFound(_0x33d60d,_0x1a07e6){return function(_0x5e6aec){if(!_0x5e6aec){_0x33d60d[_0xa2fd('0x11')](0x194);}return _0x5e6aec;};}function handleError(_0x22a52f,_0x112df6){_0x112df6=_0x112df6||0x1f4;return function(_0x4cf820){logger['error'](_0x4cf820[_0xa2fd('0x1c')]);if(_0x4cf820['name']){delete _0x4cf820[_0xa2fd('0x1d')];}_0x22a52f[_0xa2fd('0x13')](_0x112df6)[_0xa2fd('0x1e')](_0x4cf820);};}exports[_0xa2fd('0x1f')]=function(_0x15fcab,_0x588019){var _0x287237={},_0x19f3e0={},_0x1b1de2={'count':0x0,'rows':[]};var _0x56dc2c=_[_0xa2fd('0x20')](db[_0xa2fd('0x21')][_0xa2fd('0x22')],function(_0x54e713){return{'name':_0x54e713[_0xa2fd('0x23')],'type':_0x54e713['type'][_0xa2fd('0x24')]};});_0x19f3e0[_0xa2fd('0x25')]=_['map'](_0x56dc2c,_0xa2fd('0x1d'));_0x19f3e0[_0xa2fd('0x26')]=_[_0xa2fd('0x27')](_0x15fcab[_0xa2fd('0x26')]);_0x19f3e0['filters']=_[_0xa2fd('0x28')](_0x19f3e0[_0xa2fd('0x25')],_0x19f3e0['query']);_0x287237['attributes']=_['intersection'](_0x19f3e0[_0xa2fd('0x25')],qs['fields'](_0x15fcab['query'][_0xa2fd('0x29')]));_0x287237[_0xa2fd('0x2a')]=_0x287237[_0xa2fd('0x2a')][_0xa2fd('0x2b')]?_0x287237[_0xa2fd('0x2a')]:_0x19f3e0[_0xa2fd('0x25')];if(!_0x15fcab[_0xa2fd('0x26')]['hasOwnProperty'](_0xa2fd('0x2c'))){_0x287237[_0xa2fd('0x17')]=qs[_0xa2fd('0x17')](_0x15fcab[_0xa2fd('0x26')]['limit']);_0x287237[_0xa2fd('0x16')]=qs[_0xa2fd('0x16')](_0x15fcab[_0xa2fd('0x26')]['offset']);}_0x287237[_0xa2fd('0x2d')]=qs[_0xa2fd('0x2e')](_0x15fcab[_0xa2fd('0x26')][_0xa2fd('0x2e')]);_0x287237['where']=qs[_0xa2fd('0x2f')](_[_0xa2fd('0x30')](_0x15fcab[_0xa2fd('0x26')],_0x19f3e0[_0xa2fd('0x2f')]),_0x56dc2c);if(_0x15fcab[_0xa2fd('0x26')][_0xa2fd('0x31')]){_0x287237[_0xa2fd('0x32')]=_[_0xa2fd('0x33')](_0x287237[_0xa2fd('0x32')],{'$or':_[_0xa2fd('0x20')](_0x56dc2c,function(_0x560e3d){if(_0x560e3d[_0xa2fd('0x34')]!==_0xa2fd('0x35')){var _0x436d7f={};_0x436d7f[_0x560e3d[_0xa2fd('0x1d')]]={'$like':'%'+_0x15fcab[_0xa2fd('0x26')][_0xa2fd('0x31')]+'%'};return _0x436d7f;}})});}_0x287237=_[_0xa2fd('0x33')]({},_0x287237,_0x15fcab[_0xa2fd('0x36')]);var _0x470c98={'where':_0x287237[_0xa2fd('0x32')]};return db['WhatsappQueueReport'][_0xa2fd('0x15')](_0x470c98)[_0xa2fd('0x1b')](function(_0x228638){_0x1b1de2[_0xa2fd('0x15')]=_0x228638;if(_0x15fcab[_0xa2fd('0x26')][_0xa2fd('0x37')]){_0x287237[_0xa2fd('0x38')]=[{'all':!![]}];}return db[_0xa2fd('0x21')][_0xa2fd('0x39')](_0x287237);})[_0xa2fd('0x1b')](function(_0x1b0819){_0x1b1de2[_0xa2fd('0x3a')]=_0x1b0819;return _0x1b1de2;})[_0xa2fd('0x1b')](respondWithFilteredResult(_0x588019,_0x287237))[_0xa2fd('0x3b')](handleError(_0x588019,null));};exports[_0xa2fd('0x3c')]=function(_0x2290c5,_0x1e522e){var _0x2dfab0={'raw':!![],'where':{'id':_0x2290c5[_0xa2fd('0x3d')]['id']}},_0x318aa4={};_0x318aa4['model']=_[_0xa2fd('0x27')](db[_0xa2fd('0x21')][_0xa2fd('0x22')]);_0x318aa4[_0xa2fd('0x26')]=_[_0xa2fd('0x27')](_0x2290c5[_0xa2fd('0x26')]);_0x318aa4[_0xa2fd('0x2f')]=_[_0xa2fd('0x28')](_0x318aa4[_0xa2fd('0x25')],_0x318aa4[_0xa2fd('0x26')]);_0x2dfab0[_0xa2fd('0x2a')]=_[_0xa2fd('0x28')](_0x318aa4['model'],qs['fields'](_0x2290c5['query'][_0xa2fd('0x29')]));_0x2dfab0[_0xa2fd('0x2a')]=_0x2dfab0[_0xa2fd('0x2a')][_0xa2fd('0x2b')]?_0x2dfab0[_0xa2fd('0x2a')]:_0x318aa4[_0xa2fd('0x25')];if(_0x2290c5[_0xa2fd('0x26')][_0xa2fd('0x37')]){_0x2dfab0[_0xa2fd('0x38')]=[{'all':!![]}];}_0x2dfab0=_[_0xa2fd('0x33')]({},_0x2dfab0,_0x2290c5['options']);return db[_0xa2fd('0x21')][_0xa2fd('0x3e')](_0x2dfab0)[_0xa2fd('0x1b')](handleEntityNotFound(_0x1e522e,null))[_0xa2fd('0x1b')](respondWithResult(_0x1e522e,null))['catch'](handleError(_0x1e522e,null));};exports[_0xa2fd('0x3f')]=function(_0x507044,_0x1906a4){return db[_0xa2fd('0x21')][_0xa2fd('0x3f')](_0x507044['body'],{})['then'](respondWithResult(_0x1906a4,0xc9))[_0xa2fd('0x3b')](handleError(_0x1906a4,null));};exports['update']=function(_0x2fd1c9,_0x53cd2f){if(_0x2fd1c9[_0xa2fd('0x40')]['id']){delete _0x2fd1c9[_0xa2fd('0x40')]['id'];}return db[_0xa2fd('0x21')]['find']({'where':{'id':_0x2fd1c9['params']['id']}})[_0xa2fd('0x1b')](handleEntityNotFound(_0x53cd2f,null))[_0xa2fd('0x1b')](saveUpdates(_0x2fd1c9['body'],null))[_0xa2fd('0x1b')](respondWithResult(_0x53cd2f,null))[_0xa2fd('0x3b')](handleError(_0x53cd2f,null));};exports[_0xa2fd('0x41')]=function(_0x5761dc,_0x43b0d6){return db[_0xa2fd('0x21')][_0xa2fd('0x3e')]({'where':{'id':_0x5761dc[_0xa2fd('0x3d')]['id']}})[_0xa2fd('0x1b')](handleEntityNotFound(_0x43b0d6,null))[_0xa2fd('0x1b')](removeEntity(_0x43b0d6,null))[_0xa2fd('0x3b')](handleError(_0x43b0d6,null));};exports['describe']=function(_0x3b64a7,_0x34548d){return db[_0xa2fd('0x21')][_0xa2fd('0x42')]()[_0xa2fd('0x1b')](respondWithResult(_0x34548d,null))[_0xa2fd('0x3b')](handleError(_0x34548d,null));}; \ No newline at end of file +var _0x309a=['intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x309a,0xf2));var _0xa309=function(_0x4faae9,_0xac1a0){_0x4faae9=_0x4faae9-0x0;var _0x4b52ca=_0x309a[_0x4faae9];return _0x4b52ca;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa309('0x0'));var rimraf=require(_0xa309('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa309('0x2'));var BPromise=require(_0xa309('0x3'));var Mustache=require(_0xa309('0x4'));var util=require(_0xa309('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa309('0x6'));var ejs=require(_0xa309('0x7'));var fs=require('fs');var _=require(_0xa309('0x8'));var squel=require('squel');var crypto=require(_0xa309('0x9'));var jsforce=require(_0xa309('0xa'));var deskjs=require(_0xa309('0xb'));var toCsv=require(_0xa309('0x6'));var querystring=require(_0xa309('0xc'));var Papa=require(_0xa309('0xd'));var Redis=require(_0xa309('0xe'));var authService=require(_0xa309('0xf'));var qs=require(_0xa309('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa309('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa309('0x12'));var config=require(_0xa309('0x13'));var licenseUtil=require(_0xa309('0x14'));var db=require(_0xa309('0x15'))['db'];function respondWithStatusCode(_0x4dc14b,_0x385c0f){_0x385c0f=_0x385c0f||0xcc;return function(_0x296462){if(_0x296462){return _0x4dc14b[_0xa309('0x16')](_0x385c0f);}return _0x4dc14b[_0xa309('0x17')](_0x385c0f)[_0xa309('0x18')]();};}function respondWithResult(_0xa2761f,_0x46714b){_0x46714b=_0x46714b||0xc8;return function(_0x541cd9){if(_0x541cd9){return _0xa2761f[_0xa309('0x17')](_0x46714b)[_0xa309('0x19')](_0x541cd9);}};}function respondWithFilteredResult(_0x179ea1,_0x49f682){return function(_0x3cd34e){if(_0x3cd34e){var _0x323401=_0x3cd34e[_0xa309('0x1a')],_0x414dc7=_0x49f682[_0xa309('0x1b')],_0x4f77db=_0x49f682[_0xa309('0x1b')]+_0x49f682[_0xa309('0x1c')],_0x2ec43b;if(_0x4f77db>=_0x323401){_0x4f77db=_0x323401;_0x2ec43b=0xc8;}else{_0x2ec43b=0xce;}_0x179ea1[_0xa309('0x17')](_0x2ec43b);return _0x179ea1[_0xa309('0x1d')]('Content-Range',_0x414dc7+'-'+_0x4f77db+'/'+_0x323401)[_0xa309('0x19')](_0x3cd34e);}return null;};}function patchUpdates(_0x42cee5){return function(_0x7cd8ec){try{jsonpatch['apply'](_0x7cd8ec,_0x42cee5,!![]);}catch(_0x55e0e5){return BPromise[_0xa309('0x1e')](_0x55e0e5);}return _0x7cd8ec[_0xa309('0x1f')]();};}function saveUpdates(_0x5ec67d,_0x490fc1){return function(_0x162091){if(_0x162091){return _0x162091[_0xa309('0x20')](_0x5ec67d)[_0xa309('0x21')](function(_0x135e3b){return _0x135e3b;});}return null;};}function removeEntity(_0x5f1d90,_0x149b39){return function(_0x156a37){if(_0x156a37){return _0x156a37[_0xa309('0x22')]()[_0xa309('0x21')](function(){_0x5f1d90['status'](0xcc)[_0xa309('0x18')]();});}};}function handleEntityNotFound(_0x4d7cc5,_0xc0e702){return function(_0x5e8b01){if(!_0x5e8b01){_0x4d7cc5[_0xa309('0x16')](0x194);}return _0x5e8b01;};}function handleError(_0x252b7f,_0x3449f9){_0x3449f9=_0x3449f9||0x1f4;return function(_0xe50cf5){logger[_0xa309('0x23')](_0xe50cf5[_0xa309('0x24')]);if(_0xe50cf5[_0xa309('0x25')]){delete _0xe50cf5['name'];}_0x252b7f[_0xa309('0x17')](_0x3449f9)[_0xa309('0x26')](_0xe50cf5);};}exports[_0xa309('0x27')]=function(_0x54e177,_0x4a870){var _0x297225={},_0x5c3c01={},_0x34c6d9={'count':0x0,'rows':[]};var _0x59bba7=_[_0xa309('0x28')](db[_0xa309('0x29')][_0xa309('0x2a')],function(_0x3c4196){return{'name':_0x3c4196[_0xa309('0x2b')],'type':_0x3c4196[_0xa309('0x2c')][_0xa309('0x2d')]};});_0x5c3c01[_0xa309('0x2e')]=_['map'](_0x59bba7,_0xa309('0x25'));_0x5c3c01[_0xa309('0x2f')]=_[_0xa309('0x30')](_0x54e177[_0xa309('0x2f')]);_0x5c3c01[_0xa309('0x31')]=_[_0xa309('0x32')](_0x5c3c01[_0xa309('0x2e')],_0x5c3c01[_0xa309('0x2f')]);_0x297225['attributes']=_[_0xa309('0x32')](_0x5c3c01[_0xa309('0x2e')],qs[_0xa309('0x33')](_0x54e177[_0xa309('0x2f')][_0xa309('0x33')]));_0x297225[_0xa309('0x34')]=_0x297225[_0xa309('0x34')][_0xa309('0x35')]?_0x297225[_0xa309('0x34')]:_0x5c3c01[_0xa309('0x2e')];if(!_0x54e177[_0xa309('0x2f')]['hasOwnProperty'](_0xa309('0x36'))){_0x297225['limit']=qs[_0xa309('0x1c')](_0x54e177[_0xa309('0x2f')][_0xa309('0x1c')]);_0x297225[_0xa309('0x1b')]=qs[_0xa309('0x1b')](_0x54e177[_0xa309('0x2f')][_0xa309('0x1b')]);}_0x297225[_0xa309('0x37')]=qs[_0xa309('0x38')](_0x54e177[_0xa309('0x2f')][_0xa309('0x38')]);_0x297225[_0xa309('0x39')]=qs['filters'](_['pick'](_0x54e177[_0xa309('0x2f')],_0x5c3c01['filters']),_0x59bba7);if(_0x54e177[_0xa309('0x2f')]['filter']){_0x297225['where']=_[_0xa309('0x3a')](_0x297225[_0xa309('0x39')],{'$or':_[_0xa309('0x28')](_0x59bba7,function(_0x220d11){if(_0x220d11['type']!==_0xa309('0x3b')){var _0x28f343={};_0x28f343[_0x220d11[_0xa309('0x25')]]={'$like':'%'+_0x54e177[_0xa309('0x2f')][_0xa309('0x3c')]+'%'};return _0x28f343;}})});}_0x297225=_[_0xa309('0x3a')]({},_0x297225,_0x54e177['options']);var _0x40a7fb={'where':_0x297225[_0xa309('0x39')]};return db[_0xa309('0x29')]['count'](_0x40a7fb)['then'](function(_0x364898){_0x34c6d9[_0xa309('0x1a')]=_0x364898;if(_0x54e177['query'][_0xa309('0x3d')]){_0x297225[_0xa309('0x3e')]=[{'all':!![]}];}return db[_0xa309('0x29')][_0xa309('0x3f')](_0x297225);})['then'](function(_0x1c82ab){_0x34c6d9[_0xa309('0x40')]=_0x1c82ab;return _0x34c6d9;})['then'](respondWithFilteredResult(_0x4a870,_0x297225))[_0xa309('0x41')](handleError(_0x4a870,null));};exports[_0xa309('0x42')]=function(_0x3aebd2,_0x74b124){var _0x3ff81d={'raw':!![],'where':{'id':_0x3aebd2[_0xa309('0x43')]['id']}},_0x5b3c5b={};_0x5b3c5b[_0xa309('0x2e')]=_[_0xa309('0x30')](db[_0xa309('0x29')][_0xa309('0x2a')]);_0x5b3c5b[_0xa309('0x2f')]=_[_0xa309('0x30')](_0x3aebd2[_0xa309('0x2f')]);_0x5b3c5b[_0xa309('0x31')]=_[_0xa309('0x32')](_0x5b3c5b[_0xa309('0x2e')],_0x5b3c5b['query']);_0x3ff81d[_0xa309('0x34')]=_[_0xa309('0x32')](_0x5b3c5b[_0xa309('0x2e')],qs[_0xa309('0x33')](_0x3aebd2[_0xa309('0x2f')][_0xa309('0x33')]));_0x3ff81d[_0xa309('0x34')]=_0x3ff81d[_0xa309('0x34')][_0xa309('0x35')]?_0x3ff81d[_0xa309('0x34')]:_0x5b3c5b[_0xa309('0x2e')];if(_0x3aebd2[_0xa309('0x2f')][_0xa309('0x3d')]){_0x3ff81d[_0xa309('0x3e')]=[{'all':!![]}];}_0x3ff81d=_[_0xa309('0x3a')]({},_0x3ff81d,_0x3aebd2[_0xa309('0x44')]);return db[_0xa309('0x29')][_0xa309('0x45')](_0x3ff81d)[_0xa309('0x21')](handleEntityNotFound(_0x74b124,null))['then'](respondWithResult(_0x74b124,null))[_0xa309('0x41')](handleError(_0x74b124,null));};exports[_0xa309('0x46')]=function(_0x589c19,_0x3fd940){return db[_0xa309('0x29')][_0xa309('0x46')](_0x589c19[_0xa309('0x47')],{})[_0xa309('0x21')](respondWithResult(_0x3fd940,0xc9))[_0xa309('0x41')](handleError(_0x3fd940,null));};exports[_0xa309('0x20')]=function(_0x4bb8fe,_0x1b0259){if(_0x4bb8fe[_0xa309('0x47')]['id']){delete _0x4bb8fe['body']['id'];}return db[_0xa309('0x29')][_0xa309('0x45')]({'where':{'id':_0x4bb8fe[_0xa309('0x43')]['id']}})[_0xa309('0x21')](handleEntityNotFound(_0x1b0259,null))[_0xa309('0x21')](saveUpdates(_0x4bb8fe['body'],null))[_0xa309('0x21')](respondWithResult(_0x1b0259,null))[_0xa309('0x41')](handleError(_0x1b0259,null));};exports[_0xa309('0x22')]=function(_0x5c1294,_0x10cb31){return db['WhatsappQueueReport'][_0xa309('0x45')]({'where':{'id':_0x5c1294[_0xa309('0x43')]['id']}})[_0xa309('0x21')](handleEntityNotFound(_0x10cb31,null))[_0xa309('0x21')](removeEntity(_0x10cb31,null))[_0xa309('0x41')](handleError(_0x10cb31,null));};exports[_0xa309('0x48')]=function(_0x2c6db8,_0x103504){return db[_0xa309('0x29')][_0xa309('0x48')]()[_0xa309('0x21')](respondWithResult(_0x103504,null))[_0xa309('0x41')](handleError(_0x103504,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 5b3b323..c6bec1b 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 _0xad94=['path','rimraf','../../config/environment','exports','define','report_whatsapp_queue','uniqueid','lodash','util','moment','bluebird','request-promise'];(function(_0x3c1fc8,_0x3517b9){var _0x2990a9=function(_0x38b5fd){while(--_0x38b5fd){_0x3c1fc8['push'](_0x3c1fc8['shift']());}};_0x2990a9(++_0x3517b9);}(_0xad94,0xbb));var _0x4ad9=function(_0x554b09,_0xcc781a){_0x554b09=_0x554b09-0x0;var _0x4d3676=_0xad94[_0x554b09];return _0x4d3676;};'use strict';var _=require(_0x4ad9('0x0'));var util=require(_0x4ad9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4ad9('0x2'));var BPromise=require(_0x4ad9('0x3'));var rp=require(_0x4ad9('0x4'));var fs=require('fs');var path=require(_0x4ad9('0x5'));var rimraf=require(_0x4ad9('0x6'));var config=require(_0x4ad9('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x4ad9('0x8')]=function(_0x4e38b0,_0x4d5795){return _0x4e38b0[_0x4ad9('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x4ad9('0xa'),'paranoid':![],'indexes':[{'name':_0x4ad9('0xb'),'fields':[_0x4ad9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c01=['./whatsappQueueReport.attributes','exports','define','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xbf52f3,_0x2b2bb2){var _0x25edcc=function(_0x2f8b93){while(--_0x2f8b93){_0xbf52f3['push'](_0xbf52f3['shift']());}};_0x25edcc(++_0x2b2bb2);}(_0x9c01,0x99));var _0x19c0=function(_0x2fe959,_0x5dc795){_0x2fe959=_0x2fe959-0x0;var _0x5aac50=_0x9c01[_0x2fe959];return _0x5aac50;};'use strict';var _=require('lodash');var util=require(_0x19c0('0x0'));var logger=require('../../config/logger')(_0x19c0('0x1'));var moment=require(_0x19c0('0x2'));var BPromise=require(_0x19c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19c0('0x4'));var rimraf=require(_0x19c0('0x5'));var config=require(_0x19c0('0x6'));var attributes=require(_0x19c0('0x7'));module[_0x19c0('0x8')]=function(_0xb4ebfc,_0x1bf6e2){return _0xb4ebfc[_0x19c0('0x9')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 33fc9f3..4082388 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 _0x74af=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','stringify','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x4c452f,_0xa9b308){var _0x20ba8d=function(_0x506094){while(--_0x506094){_0x4c452f['push'](_0x4c452f['shift']());}};_0x20ba8d(++_0xa9b308);}(_0x74af,0x140));var _0xf74a=function(_0x3df1a7,_0x268ed1){_0x3df1a7=_0x3df1a7-0x0;var _0x34b0ba=_0x74af[_0x3df1a7];return _0x34b0ba;};'use strict';var _=require(_0xf74a('0x0'));var util=require(_0xf74a('0x1'));var moment=require(_0xf74a('0x2'));var BPromise=require(_0xf74a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf74a('0x4'));var logger=require(_0xf74a('0x5'))('rpc');var config=require(_0xf74a('0x6'));var jayson=require(_0xf74a('0x7'));var client=jayson['client'][_0xf74a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbc9f84,_0x1b116d,_0x21f2b3){return new BPromise(function(_0x10adeb,_0x390588){return client['request'](_0xbc9f84,_0x21f2b3)[_0xf74a('0x9')](function(_0x4b4c4b){logger['info'](_0xf74a('0xa'),_0x1b116d,_0xf74a('0xb'));logger[_0xf74a('0xc')](_0xf74a('0xd'),_0x1b116d,_0xf74a('0xb'),JSON['stringify'](_0x4b4c4b));if(_0x4b4c4b[_0xf74a('0xe')]){if(_0x4b4c4b[_0xf74a('0xe')][_0xf74a('0xf')]===0x1f4){logger['error'](_0xf74a('0xa'),_0x1b116d,_0x4b4c4b[_0xf74a('0xe')][_0xf74a('0x10')]);return _0x390588(_0x4b4c4b[_0xf74a('0xe')][_0xf74a('0x10')]);}logger['error'](_0xf74a('0xa'),_0x1b116d,_0x4b4c4b[_0xf74a('0xe')][_0xf74a('0x10')]);return _0x10adeb(_0x4b4c4b['error']['message']);}else{logger[_0xf74a('0x11')](_0xf74a('0xa'),_0x1b116d,'request\x20sent');_0x10adeb(_0x4b4c4b['result'][_0xf74a('0x10')]);}})['catch'](function(_0xe8b8c8){logger[_0xf74a('0xe')](_0xf74a('0xa'),_0x1b116d,_0xe8b8c8);_0x390588(_0xe8b8c8);});});}exports[_0xf74a('0x12')]=function(_0x4fa33e){var _0x3a74b1=this;return new Promise(function(_0x2bbada,_0x32d6f8){return db[_0xf74a('0x13')]['create'](_0x4fa33e[_0xf74a('0x14')],{'raw':_0x4fa33e[_0xf74a('0x15')]?_0x4fa33e[_0xf74a('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xf74a('0x9')](function(_0x5caead){logger[_0xf74a('0x11')](_0xf74a('0x12'),_0x4fa33e);logger[_0xf74a('0xc')](_0xf74a('0x12'),_0x4fa33e,JSON[_0xf74a('0x16')](_0x5caead));_0x2bbada(_0x5caead);})['catch'](function(_0x4d45e2){logger[_0xf74a('0xe')]('CreateWhatsappQueueReport',_0x4d45e2[_0xf74a('0x10')],_0x4fa33e);_0x32d6f8(_0x3a74b1[_0xf74a('0xe')](0x1f4,_0x4d45e2[_0xf74a('0x10')]));});});};exports[_0xf74a('0x17')]=function(_0x1b7e32){var _0x1eff40=this;return new Promise(function(_0x50db2f,_0x50b8ca){return db[_0xf74a('0x13')]['update'](_0x1b7e32['body'],{'raw':_0x1b7e32[_0xf74a('0x15')]?_0x1b7e32[_0xf74a('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7e32[_0xf74a('0x15')]?_0x1b7e32['options'][_0xf74a('0x18')]||null:null,'attributes':_0x1b7e32[_0xf74a('0x15')]?_0x1b7e32[_0xf74a('0x15')][_0xf74a('0x19')]||null:null,'limit':_0x1b7e32[_0xf74a('0x15')]?_0x1b7e32['options'][_0xf74a('0x1a')]||null:null})[_0xf74a('0x9')](function(_0xda7694){logger[_0xf74a('0x11')](_0xf74a('0x17'),_0x1b7e32);logger[_0xf74a('0xc')](_0xf74a('0x17'),_0x1b7e32,JSON[_0xf74a('0x16')](_0xda7694));_0x50db2f(_0xda7694);})['catch'](function(_0x5990ce){logger[_0xf74a('0xe')](_0xf74a('0x17'),_0x5990ce[_0xf74a('0x10')],_0x1b7e32);_0x50b8ca(_0x1eff40[_0xf74a('0xe')](0x1f4,_0x5990ce['message']));});});}; \ No newline at end of file +var _0xc40e=['update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','create','body','options','raw','info','UpdateWhatsappQueueReport'];(function(_0x5bbbaa,_0x2ce370){var _0x28d8a5=function(_0x74a27){while(--_0x74a27){_0x5bbbaa['push'](_0x5bbbaa['shift']());}};_0x28d8a5(++_0x2ce370);}(_0xc40e,0xca));var _0xec40=function(_0x318bb9,_0x4eead1){_0x318bb9=_0x318bb9-0x0;var _0x3a10d2=_0xc40e[_0x318bb9];return _0x3a10d2;};'use strict';var _=require(_0xec40('0x0'));var util=require(_0xec40('0x1'));var moment=require(_0xec40('0x2'));var BPromise=require('bluebird');var rs=require(_0xec40('0x3'));var fs=require('fs');var Redis=require(_0xec40('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec40('0x5'));var logger=require(_0xec40('0x6'))(_0xec40('0x7'));var config=require('../../config/environment');var jayson=require(_0xec40('0x8'));var client=jayson[_0xec40('0x9')][_0xec40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x285cee,_0x3409a7,_0x32daf7){return new BPromise(function(_0x1627d5,_0xe03b7d){return client['request'](_0x285cee,_0x32daf7)[_0xec40('0xb')](function(_0x292167){logger['info'](_0xec40('0xc'),_0x3409a7,_0xec40('0xd'));logger[_0xec40('0xe')](_0xec40('0xf'),_0x3409a7,'request\x20sent',JSON[_0xec40('0x10')](_0x292167));if(_0x292167['error']){if(_0x292167[_0xec40('0x11')][_0xec40('0x12')]===0x1f4){logger[_0xec40('0x11')](_0xec40('0xc'),_0x3409a7,_0x292167[_0xec40('0x11')][_0xec40('0x13')]);return _0xe03b7d(_0x292167['error'][_0xec40('0x13')]);}logger[_0xec40('0x11')](_0xec40('0xc'),_0x3409a7,_0x292167[_0xec40('0x11')][_0xec40('0x13')]);return _0x1627d5(_0x292167[_0xec40('0x11')][_0xec40('0x13')]);}else{logger['info'](_0xec40('0xc'),_0x3409a7,_0xec40('0xd'));_0x1627d5(_0x292167[_0xec40('0x14')][_0xec40('0x13')]);}})[_0xec40('0x15')](function(_0x2a7681){logger[_0xec40('0x11')](_0xec40('0xc'),_0x3409a7,_0x2a7681);_0xe03b7d(_0x2a7681);});});}exports[_0xec40('0x16')]=function(_0xaf9c10){var _0x4cb3eb=this;return new Promise(function(_0x4bd447,_0x122125){return db['WhatsappQueueReport'][_0xec40('0x17')](_0xaf9c10[_0xec40('0x18')],{'raw':_0xaf9c10['options']?_0xaf9c10[_0xec40('0x19')][_0xec40('0x1a')]===undefined?!![]:![]:!![]})[_0xec40('0xb')](function(_0x511f59){logger[_0xec40('0x1b')](_0xec40('0x16'),_0xaf9c10);logger['debug'](_0xec40('0x16'),_0xaf9c10,JSON['stringify'](_0x511f59));_0x4bd447(_0x511f59);})[_0xec40('0x15')](function(_0x1a99e1){logger[_0xec40('0x11')](_0xec40('0x16'),_0x1a99e1[_0xec40('0x13')],_0xaf9c10);_0x122125(_0x4cb3eb['error'](0x1f4,_0x1a99e1[_0xec40('0x13')]));});});};exports[_0xec40('0x1c')]=function(_0xd37186){var _0x462513=this;return new Promise(function(_0x416ef9,_0x3dff78){return db['WhatsappQueueReport'][_0xec40('0x1d')](_0xd37186[_0xec40('0x18')],{'raw':_0xd37186[_0xec40('0x19')]?_0xd37186[_0xec40('0x19')][_0xec40('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd37186['options']?_0xd37186['options'][_0xec40('0x1e')]||null:null,'attributes':_0xd37186[_0xec40('0x19')]?_0xd37186['options'][_0xec40('0x1f')]||null:null,'limit':_0xd37186['options']?_0xd37186[_0xec40('0x19')][_0xec40('0x20')]||null:null})[_0xec40('0xb')](function(_0x58aa4d){logger[_0xec40('0x1b')]('UpdateWhatsappQueueReport',_0xd37186);logger[_0xec40('0xe')](_0xec40('0x1c'),_0xd37186,JSON[_0xec40('0x10')](_0x58aa4d));_0x416ef9(_0x58aa4d);})[_0xec40('0x15')](function(_0x2d69cb){logger[_0xec40('0x11')](_0xec40('0x1c'),_0x2d69cb['message'],_0xd37186);_0x3dff78(_0x462513[_0xec40('0x11')](0x1f4,_0x2d69cb[_0xec40('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 4a57f48..5ebd7ec 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 _0x3f18=['update','delete','destroy','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','describe','/:id','isAuthenticated','show','post','create'];(function(_0x86337d,_0x2b57c3){var _0x22b2c6=function(_0x180d16){while(--_0x180d16){_0x86337d['push'](_0x86337d['shift']());}};_0x22b2c6(++_0x2b57c3);}(_0x3f18,0xc9));var _0x83f1=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3f18[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x83f1('0x0'));var express=require(_0x83f1('0x1'));var router=express[_0x83f1('0x2')]();var auth=require(_0x83f1('0x3'));var interaction=require(_0x83f1('0x4'));var config=require(_0x83f1('0x5'));var controller=require(_0x83f1('0x6'));router[_0x83f1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x83f1('0x7')](_0x83f1('0x8'),auth['isAuthenticated'](),controller[_0x83f1('0x9')]);router['get'](_0x83f1('0xa'),auth[_0x83f1('0xb')](),controller[_0x83f1('0xc')]);router[_0x83f1('0xd')]('/',auth[_0x83f1('0xb')](),controller[_0x83f1('0xe')]);router['put'](_0x83f1('0xa'),auth['isAuthenticated'](),controller[_0x83f1('0xf')]);router[_0x83f1('0x10')](_0x83f1('0xa'),auth[_0x83f1('0xb')](),controller[_0x83f1('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe432=['isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x21384b,_0x3200a9){var _0x42c165=function(_0x487100){while(--_0x487100){_0x21384b['push'](_0x21384b['shift']());}};_0x42c165(++_0x3200a9);}(_0xe432,0x91));var _0x2e43=function(_0x1c6d44,_0x1b7780){_0x1c6d44=_0x1c6d44-0x0;var _0x49d1a7=_0xe432[_0x1c6d44];return _0x49d1a7;};'use strict';var multer=require(_0x2e43('0x0'));var util=require(_0x2e43('0x1'));var path=require(_0x2e43('0x2'));var timeout=require(_0x2e43('0x3'));var express=require(_0x2e43('0x4'));var router=express[_0x2e43('0x5')]();var auth=require(_0x2e43('0x6'));var interaction=require(_0x2e43('0x7'));var config=require(_0x2e43('0x8'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x2e43('0x9')](),controller[_0x2e43('0xa')]);router[_0x2e43('0xb')](_0x2e43('0xc'),auth[_0x2e43('0x9')](),controller[_0x2e43('0xd')]);router['get'](_0x2e43('0xe'),auth[_0x2e43('0x9')](),controller[_0x2e43('0xf')]);router[_0x2e43('0x10')]('/',auth[_0x2e43('0x9')](),controller[_0x2e43('0x11')]);router[_0x2e43('0x12')](_0x2e43('0xe'),auth[_0x2e43('0x9')](),controller[_0x2e43('0x13')]);router[_0x2e43('0x14')](_0x2e43('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x2e43('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 8520f9d..31536a1 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 _0xb7e7=['queue','sequelize','STRING','account'];(function(_0x579b42,_0x399716){var _0x52c0ff=function(_0x8c8235){while(--_0x8c8235){_0x579b42['push'](_0x579b42['shift']());}};_0x52c0ff(++_0x399716);}(_0xb7e7,0x121));var _0x7b7e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb7e7[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x2'),'agent',_0x7b7e('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb10b,0x12a));var _0xbb10=function(_0x292688,_0x4ed5d4){_0x292688=_0x292688-0x0;var _0x12f117=_0xb10b[_0x292688];return _0x12f117;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index ad79947..075e0df 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 _0xa5be=['Content-Range','json','apply','reject','destroy','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','then','include','findAll','rows','show','params','includeAll','options','find','create','body','catch','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','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','../../mysqldb','sendStatus','end','status','count','offset','limit'];(function(_0x282ff9,_0x268bfe){var _0x542612=function(_0x4ad95c){while(--_0x4ad95c){_0x282ff9['push'](_0x282ff9['shift']());}};_0x542612(++_0x268bfe);}(_0xa5be,0x10e));var _0xea5b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa5be[_0x1ac595];return _0x455fff;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xea5b('0x0'));var zipdir=require(_0xea5b('0x1'));var jsonpatch=require(_0xea5b('0x2'));var rp=require(_0xea5b('0x3'));var moment=require(_0xea5b('0x4'));var BPromise=require(_0xea5b('0x5'));var Mustache=require('mustache');var util=require(_0xea5b('0x6'));var path=require('path');var sox=require(_0xea5b('0x7'));var csv=require(_0xea5b('0x8'));var ejs=require(_0xea5b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xea5b('0xa'));var crypto=require('crypto');var jsforce=require(_0xea5b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xea5b('0xc'));var Papa=require('papaparse');var Redis=require(_0xea5b('0xd'));var authService=require(_0xea5b('0xe'));var qs=require(_0xea5b('0xf'));var as=require(_0xea5b('0x10'));var hardwareService=require(_0xea5b('0x11'));var logger=require(_0xea5b('0x12'))(_0xea5b('0x13'));var utils=require(_0xea5b('0x14'));var config=require(_0xea5b('0x15'));var licenseUtil=require(_0xea5b('0x16'));var db=require(_0xea5b('0x17'))['db'];function respondWithStatusCode(_0x591361,_0x4ddcb5){_0x4ddcb5=_0x4ddcb5||0xcc;return function(_0x550218){if(_0x550218){return _0x591361[_0xea5b('0x18')](_0x4ddcb5);}return _0x591361['status'](_0x4ddcb5)[_0xea5b('0x19')]();};}function respondWithResult(_0x41306b,_0x10abb5){_0x10abb5=_0x10abb5||0xc8;return function(_0x1f0c5f){if(_0x1f0c5f){return _0x41306b[_0xea5b('0x1a')](_0x10abb5)['json'](_0x1f0c5f);}};}function respondWithFilteredResult(_0x3809b0,_0x23bc97){return function(_0x8c4cf){if(_0x8c4cf){var _0x3c4ab2=_0x8c4cf[_0xea5b('0x1b')],_0x402ed0=_0x23bc97[_0xea5b('0x1c')],_0x430976=_0x23bc97[_0xea5b('0x1c')]+_0x23bc97[_0xea5b('0x1d')],_0x2aa97f;if(_0x430976>=_0x3c4ab2){_0x430976=_0x3c4ab2;_0x2aa97f=0xc8;}else{_0x2aa97f=0xce;}_0x3809b0[_0xea5b('0x1a')](_0x2aa97f);return _0x3809b0['set'](_0xea5b('0x1e'),_0x402ed0+'-'+_0x430976+'/'+_0x3c4ab2)[_0xea5b('0x1f')](_0x8c4cf);}return null;};}function patchUpdates(_0x2b7f33){return function(_0x1323af){try{jsonpatch[_0xea5b('0x20')](_0x1323af,_0x2b7f33,!![]);}catch(_0x11095d){return BPromise[_0xea5b('0x21')](_0x11095d);}return _0x1323af['save']();};}function saveUpdates(_0x564f66,_0x2e4acd){return function(_0x18791d){if(_0x18791d){return _0x18791d['update'](_0x564f66)['then'](function(_0x992b32){return _0x992b32;});}return null;};}function removeEntity(_0xa0dfe2,_0xed987b){return function(_0x4f12b9){if(_0x4f12b9){return _0x4f12b9[_0xea5b('0x22')]()['then'](function(){_0xa0dfe2[_0xea5b('0x1a')](0xcc)[_0xea5b('0x19')]();});}};}function handleEntityNotFound(_0x440214,_0x3e44cb){return function(_0x45f82a){if(!_0x45f82a){_0x440214[_0xea5b('0x18')](0x194);}return _0x45f82a;};}function handleError(_0x51727b,_0x3def97){_0x3def97=_0x3def97||0x1f4;return function(_0x259c12){logger[_0xea5b('0x23')](_0x259c12[_0xea5b('0x24')]);if(_0x259c12['name']){delete _0x259c12[_0xea5b('0x25')];}_0x51727b[_0xea5b('0x1a')](_0x3def97)[_0xea5b('0x26')](_0x259c12);};}exports['index']=function(_0xf95967,_0x24e9a9){var _0xf98ba3={},_0x8353c={},_0x4fcb53={'count':0x0,'rows':[]};var _0x6703ac=_[_0xea5b('0x27')](db[_0xea5b('0x28')][_0xea5b('0x29')],function(_0x307839){return{'name':_0x307839[_0xea5b('0x2a')],'type':_0x307839[_0xea5b('0x2b')][_0xea5b('0x2c')]};});_0x8353c[_0xea5b('0x2d')]=_['map'](_0x6703ac,'name');_0x8353c[_0xea5b('0x2e')]=_[_0xea5b('0x2f')](_0xf95967[_0xea5b('0x2e')]);_0x8353c[_0xea5b('0x30')]=_[_0xea5b('0x31')](_0x8353c[_0xea5b('0x2d')],_0x8353c[_0xea5b('0x2e')]);_0xf98ba3[_0xea5b('0x32')]=_[_0xea5b('0x31')](_0x8353c[_0xea5b('0x2d')],qs[_0xea5b('0x33')](_0xf95967[_0xea5b('0x2e')][_0xea5b('0x33')]));_0xf98ba3['attributes']=_0xf98ba3[_0xea5b('0x32')][_0xea5b('0x34')]?_0xf98ba3[_0xea5b('0x32')]:_0x8353c[_0xea5b('0x2d')];if(!_0xf95967['query'][_0xea5b('0x35')](_0xea5b('0x36'))){_0xf98ba3[_0xea5b('0x1d')]=qs['limit'](_0xf95967['query'][_0xea5b('0x1d')]);_0xf98ba3['offset']=qs[_0xea5b('0x1c')](_0xf95967[_0xea5b('0x2e')][_0xea5b('0x1c')]);}_0xf98ba3[_0xea5b('0x37')]=qs['sort'](_0xf95967[_0xea5b('0x2e')][_0xea5b('0x38')]);_0xf98ba3[_0xea5b('0x39')]=qs[_0xea5b('0x30')](_[_0xea5b('0x3a')](_0xf95967[_0xea5b('0x2e')],_0x8353c[_0xea5b('0x30')]),_0x6703ac);if(_0xf95967[_0xea5b('0x2e')][_0xea5b('0x3b')]){_0xf98ba3['where']=_['merge'](_0xf98ba3[_0xea5b('0x39')],{'$or':_['map'](_0x6703ac,function(_0x6a916f){if(_0x6a916f[_0xea5b('0x2b')]!==_0xea5b('0x3c')){var _0x39b3a5={};_0x39b3a5[_0x6a916f[_0xea5b('0x25')]]={'$like':'%'+_0xf95967[_0xea5b('0x2e')][_0xea5b('0x3b')]+'%'};return _0x39b3a5;}})});}_0xf98ba3=_['merge']({},_0xf98ba3,_0xf95967['options']);var _0x1e338b={'where':_0xf98ba3[_0xea5b('0x39')]};return db[_0xea5b('0x28')][_0xea5b('0x1b')](_0x1e338b)[_0xea5b('0x3d')](function(_0x3c277f){_0x4fcb53[_0xea5b('0x1b')]=_0x3c277f;if(_0xf95967[_0xea5b('0x2e')]['includeAll']){_0xf98ba3[_0xea5b('0x3e')]=[{'all':!![]}];}return db[_0xea5b('0x28')][_0xea5b('0x3f')](_0xf98ba3);})[_0xea5b('0x3d')](function(_0x343842){_0x4fcb53[_0xea5b('0x40')]=_0x343842;return _0x4fcb53;})[_0xea5b('0x3d')](respondWithFilteredResult(_0x24e9a9,_0xf98ba3))['catch'](handleError(_0x24e9a9,null));};exports[_0xea5b('0x41')]=function(_0xf9ca5b,_0x276499){var _0x301fca={'raw':!![],'where':{'id':_0xf9ca5b[_0xea5b('0x42')]['id']}},_0x1fd23b={};_0x1fd23b[_0xea5b('0x2d')]=_[_0xea5b('0x2f')](db[_0xea5b('0x28')][_0xea5b('0x29')]);_0x1fd23b[_0xea5b('0x2e')]=_[_0xea5b('0x2f')](_0xf9ca5b[_0xea5b('0x2e')]);_0x1fd23b[_0xea5b('0x30')]=_['intersection'](_0x1fd23b[_0xea5b('0x2d')],_0x1fd23b[_0xea5b('0x2e')]);_0x301fca[_0xea5b('0x32')]=_[_0xea5b('0x31')](_0x1fd23b[_0xea5b('0x2d')],qs[_0xea5b('0x33')](_0xf9ca5b[_0xea5b('0x2e')]['fields']));_0x301fca['attributes']=_0x301fca[_0xea5b('0x32')][_0xea5b('0x34')]?_0x301fca[_0xea5b('0x32')]:_0x1fd23b[_0xea5b('0x2d')];if(_0xf9ca5b[_0xea5b('0x2e')][_0xea5b('0x43')]){_0x301fca['include']=[{'all':!![]}];}_0x301fca=_['merge']({},_0x301fca,_0xf9ca5b[_0xea5b('0x44')]);return db[_0xea5b('0x28')][_0xea5b('0x45')](_0x301fca)[_0xea5b('0x3d')](handleEntityNotFound(_0x276499,null))[_0xea5b('0x3d')](respondWithResult(_0x276499,null))['catch'](handleError(_0x276499,null));};exports[_0xea5b('0x46')]=function(_0x4f5007,_0x4cc55a){return db[_0xea5b('0x28')]['create'](_0x4f5007[_0xea5b('0x47')],{})[_0xea5b('0x3d')](respondWithResult(_0x4cc55a,0xc9))[_0xea5b('0x48')](handleError(_0x4cc55a,null));};exports[_0xea5b('0x49')]=function(_0x4cbbf7,_0x91afb5){if(_0x4cbbf7[_0xea5b('0x47')]['id']){delete _0x4cbbf7[_0xea5b('0x47')]['id'];}return db[_0xea5b('0x28')][_0xea5b('0x45')]({'where':{'id':_0x4cbbf7[_0xea5b('0x42')]['id']}})[_0xea5b('0x3d')](handleEntityNotFound(_0x91afb5,null))[_0xea5b('0x3d')](saveUpdates(_0x4cbbf7['body'],null))['then'](respondWithResult(_0x91afb5,null))[_0xea5b('0x48')](handleError(_0x91afb5,null));};exports[_0xea5b('0x22')]=function(_0x26d6f1,_0x25faf6){return db[_0xea5b('0x28')]['find']({'where':{'id':_0x26d6f1['params']['id']}})[_0xea5b('0x3d')](handleEntityNotFound(_0x25faf6,null))[_0xea5b('0x3d')](removeEntity(_0x25faf6,null))[_0xea5b('0x48')](handleError(_0x25faf6,null));};exports['describe']=function(_0xd1c9cd,_0x3fbab8){return db[_0xea5b('0x28')][_0xea5b('0x4a')]()[_0xea5b('0x3d')](respondWithResult(_0x3fbab8,null))[_0xea5b('0x48')](handleError(_0x3fbab8,null));}; \ No newline at end of file +var _0xb688=['destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','error','name','send','index','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','merge','includeAll','findAll','rows','catch','show','include','create','WhatsappTransferReport','body','find','params'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb688,0x1b2));var _0x8b68=function(_0xf0a280,_0x35450b){_0xf0a280=_0xf0a280-0x0;var _0x4fdbaf=_0xb688[_0xf0a280];return _0x4fdbaf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b68('0x0'));var rimraf=require(_0x8b68('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require(_0x8b68('0x6'));var util=require(_0x8b68('0x7'));var path=require(_0x8b68('0x8'));var sox=require(_0x8b68('0x9'));var csv=require('to-csv');var ejs=require(_0x8b68('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8b68('0xb'));var jsforce=require(_0x8b68('0xc'));var deskjs=require(_0x8b68('0xd'));var toCsv=require(_0x8b68('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b68('0xf'));var authService=require(_0x8b68('0x10'));var qs=require(_0x8b68('0x11'));var as=require(_0x8b68('0x12'));var hardwareService=require(_0x8b68('0x13'));var logger=require('../../config/logger')(_0x8b68('0x14'));var utils=require(_0x8b68('0x15'));var config=require(_0x8b68('0x16'));var licenseUtil=require(_0x8b68('0x17'));var db=require(_0x8b68('0x18'))['db'];function respondWithStatusCode(_0x4d3483,_0x1f0d31){_0x1f0d31=_0x1f0d31||0xcc;return function(_0x57f7eb){if(_0x57f7eb){return _0x4d3483[_0x8b68('0x19')](_0x1f0d31);}return _0x4d3483[_0x8b68('0x1a')](_0x1f0d31)[_0x8b68('0x1b')]();};}function respondWithResult(_0x8e206f,_0x12d17d){_0x12d17d=_0x12d17d||0xc8;return function(_0x381e54){if(_0x381e54){return _0x8e206f['status'](_0x12d17d)[_0x8b68('0x1c')](_0x381e54);}};}function respondWithFilteredResult(_0x4fde26,_0x2d894e){return function(_0xbb76c6){if(_0xbb76c6){var _0x558edc=_0xbb76c6[_0x8b68('0x1d')],_0x2c4242=_0x2d894e[_0x8b68('0x1e')],_0x2b3ffa=_0x2d894e[_0x8b68('0x1e')]+_0x2d894e[_0x8b68('0x1f')],_0x42af55;if(_0x2b3ffa>=_0x558edc){_0x2b3ffa=_0x558edc;_0x42af55=0xc8;}else{_0x42af55=0xce;}_0x4fde26[_0x8b68('0x1a')](_0x42af55);return _0x4fde26[_0x8b68('0x20')]('Content-Range',_0x2c4242+'-'+_0x2b3ffa+'/'+_0x558edc)['json'](_0xbb76c6);}return null;};}function patchUpdates(_0x2ecd27){return function(_0x42a0fc){try{jsonpatch[_0x8b68('0x21')](_0x42a0fc,_0x2ecd27,!![]);}catch(_0x280194){return BPromise['reject'](_0x280194);}return _0x42a0fc[_0x8b68('0x22')]();};}function saveUpdates(_0x7cab30,_0x2c02d2){return function(_0xa013bf){if(_0xa013bf){return _0xa013bf[_0x8b68('0x23')](_0x7cab30)[_0x8b68('0x24')](function(_0x1c82f6){return _0x1c82f6;});}return null;};}function removeEntity(_0x1538d3,_0x28e858){return function(_0x2f8174){if(_0x2f8174){return _0x2f8174['destroy']()[_0x8b68('0x24')](function(){_0x1538d3[_0x8b68('0x1a')](0xcc)[_0x8b68('0x1b')]();});}};}function handleEntityNotFound(_0x4fc122,_0x5509dc){return function(_0x3099d9){if(!_0x3099d9){_0x4fc122[_0x8b68('0x19')](0x194);}return _0x3099d9;};}function handleError(_0x3105e4,_0x2f2aa7){_0x2f2aa7=_0x2f2aa7||0x1f4;return function(_0x33be66){logger[_0x8b68('0x25')](_0x33be66['stack']);if(_0x33be66['name']){delete _0x33be66[_0x8b68('0x26')];}_0x3105e4[_0x8b68('0x1a')](_0x2f2aa7)[_0x8b68('0x27')](_0x33be66);};}exports[_0x8b68('0x28')]=function(_0x191310,_0x4d159a){var _0x524f71={},_0x174d06={},_0x306c32={'count':0x0,'rows':[]};var _0x315d4a=_['map'](db['WhatsappTransferReport']['rawAttributes'],function(_0x2e4546){return{'name':_0x2e4546[_0x8b68('0x29')],'type':_0x2e4546['type'][_0x8b68('0x2a')]};});_0x174d06[_0x8b68('0x2b')]=_['map'](_0x315d4a,_0x8b68('0x26'));_0x174d06[_0x8b68('0x2c')]=_[_0x8b68('0x2d')](_0x191310[_0x8b68('0x2c')]);_0x174d06[_0x8b68('0x2e')]=_[_0x8b68('0x2f')](_0x174d06[_0x8b68('0x2b')],_0x174d06[_0x8b68('0x2c')]);_0x524f71[_0x8b68('0x30')]=_[_0x8b68('0x2f')](_0x174d06[_0x8b68('0x2b')],qs[_0x8b68('0x31')](_0x191310[_0x8b68('0x2c')][_0x8b68('0x31')]));_0x524f71[_0x8b68('0x30')]=_0x524f71[_0x8b68('0x30')][_0x8b68('0x32')]?_0x524f71[_0x8b68('0x30')]:_0x174d06[_0x8b68('0x2b')];if(!_0x191310['query'][_0x8b68('0x33')](_0x8b68('0x34'))){_0x524f71[_0x8b68('0x1f')]=qs['limit'](_0x191310[_0x8b68('0x2c')][_0x8b68('0x1f')]);_0x524f71['offset']=qs['offset'](_0x191310[_0x8b68('0x2c')][_0x8b68('0x1e')]);}_0x524f71[_0x8b68('0x35')]=qs[_0x8b68('0x36')](_0x191310[_0x8b68('0x2c')][_0x8b68('0x36')]);_0x524f71[_0x8b68('0x37')]=qs[_0x8b68('0x2e')](_['pick'](_0x191310[_0x8b68('0x2c')],_0x174d06[_0x8b68('0x2e')]),_0x315d4a);if(_0x191310[_0x8b68('0x2c')][_0x8b68('0x38')]){_0x524f71[_0x8b68('0x37')]=_['merge'](_0x524f71[_0x8b68('0x37')],{'$or':_[_0x8b68('0x39')](_0x315d4a,function(_0x5549ce){if(_0x5549ce['type']!=='VIRTUAL'){var _0x21c850={};_0x21c850[_0x5549ce['name']]={'$like':'%'+_0x191310['query']['filter']+'%'};return _0x21c850;}})});}_0x524f71=_[_0x8b68('0x3a')]({},_0x524f71,_0x191310['options']);var _0x2df2b8={'where':_0x524f71[_0x8b68('0x37')]};return db['WhatsappTransferReport'][_0x8b68('0x1d')](_0x2df2b8)[_0x8b68('0x24')](function(_0x196649){_0x306c32[_0x8b68('0x1d')]=_0x196649;if(_0x191310[_0x8b68('0x2c')][_0x8b68('0x3b')]){_0x524f71['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x8b68('0x3c')](_0x524f71);})[_0x8b68('0x24')](function(_0x29cb7f){_0x306c32[_0x8b68('0x3d')]=_0x29cb7f;return _0x306c32;})[_0x8b68('0x24')](respondWithFilteredResult(_0x4d159a,_0x524f71))[_0x8b68('0x3e')](handleError(_0x4d159a,null));};exports[_0x8b68('0x3f')]=function(_0x7d6579,_0x54f1a3){var _0x274ae9={'raw':!![],'where':{'id':_0x7d6579['params']['id']}},_0x1c70f4={};_0x1c70f4[_0x8b68('0x2b')]=_[_0x8b68('0x2d')](db['WhatsappTransferReport']['rawAttributes']);_0x1c70f4[_0x8b68('0x2c')]=_['keys'](_0x7d6579[_0x8b68('0x2c')]);_0x1c70f4['filters']=_[_0x8b68('0x2f')](_0x1c70f4[_0x8b68('0x2b')],_0x1c70f4[_0x8b68('0x2c')]);_0x274ae9['attributes']=_[_0x8b68('0x2f')](_0x1c70f4[_0x8b68('0x2b')],qs[_0x8b68('0x31')](_0x7d6579['query'][_0x8b68('0x31')]));_0x274ae9[_0x8b68('0x30')]=_0x274ae9[_0x8b68('0x30')][_0x8b68('0x32')]?_0x274ae9[_0x8b68('0x30')]:_0x1c70f4['model'];if(_0x7d6579[_0x8b68('0x2c')][_0x8b68('0x3b')]){_0x274ae9[_0x8b68('0x40')]=[{'all':!![]}];}_0x274ae9=_[_0x8b68('0x3a')]({},_0x274ae9,_0x7d6579['options']);return db['WhatsappTransferReport']['find'](_0x274ae9)[_0x8b68('0x24')](handleEntityNotFound(_0x54f1a3,null))['then'](respondWithResult(_0x54f1a3,null))[_0x8b68('0x3e')](handleError(_0x54f1a3,null));};exports[_0x8b68('0x41')]=function(_0x238899,_0xdeb88){return db[_0x8b68('0x42')]['create'](_0x238899[_0x8b68('0x43')],{})[_0x8b68('0x24')](respondWithResult(_0xdeb88,0xc9))['catch'](handleError(_0xdeb88,null));};exports[_0x8b68('0x23')]=function(_0x2c5a45,_0x3d7cc7){if(_0x2c5a45[_0x8b68('0x43')]['id']){delete _0x2c5a45['body']['id'];}return db[_0x8b68('0x42')][_0x8b68('0x44')]({'where':{'id':_0x2c5a45[_0x8b68('0x45')]['id']}})[_0x8b68('0x24')](handleEntityNotFound(_0x3d7cc7,null))[_0x8b68('0x24')](saveUpdates(_0x2c5a45[_0x8b68('0x43')],null))['then'](respondWithResult(_0x3d7cc7,null))['catch'](handleError(_0x3d7cc7,null));};exports[_0x8b68('0x46')]=function(_0x2d83a5,_0x275f36){return db[_0x8b68('0x42')][_0x8b68('0x44')]({'where':{'id':_0x2d83a5[_0x8b68('0x45')]['id']}})[_0x8b68('0x24')](handleEntityNotFound(_0x275f36,null))[_0x8b68('0x24')](removeEntity(_0x275f36,null))['catch'](handleError(_0x275f36,null));};exports['describe']=function(_0x5cf530,_0x112cb3){return db[_0x8b68('0x42')][_0x8b68('0x47')]()[_0x8b68('0x24')](respondWithResult(_0x112cb3,null))[_0x8b68('0x3e')](handleError(_0x112cb3,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index ebe8c00..f5b4bf9 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 _0x64af=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','moment','bluebird','path','rimraf','./whatsappTransferReport.attributes'];(function(_0x3ed666,_0x3345f9){var _0x1587f5=function(_0x304fd0){while(--_0x304fd0){_0x3ed666['push'](_0x3ed666['shift']());}};_0x1587f5(++_0x3345f9);}(_0x64af,0xe0));var _0xf64a=function(_0x546f45,_0x3a0b48){_0x546f45=_0x546f45-0x0;var _0x3058cc=_0x64af[_0x546f45];return _0x3058cc;};'use strict';var _=require('lodash');var util=require(_0xf64a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf64a('0x1'));var BPromise=require(_0xf64a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf64a('0x3'));var rimraf=require(_0xf64a('0x4'));var config=require('../../config/environment');var attributes=require(_0xf64a('0x5'));module['exports']=function(_0x329338,_0x360bea){return _0x329338[_0xf64a('0x6')](_0xf64a('0x7'),attributes,{'tableName':_0xf64a('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf64a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa853=['api','moment','bluebird','path','rimraf','../../config/environment','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa853,0x7f));var _0x3a85=function(_0x14c784,_0x4b03e4){_0x14c784=_0x14c784-0x0;var _0x1aedca=_0xa853[_0x14c784];return _0x1aedca;};'use strict';var _=require(_0x3a85('0x0'));var util=require(_0x3a85('0x1'));var logger=require(_0x3a85('0x2'))(_0x3a85('0x3'));var moment=require(_0x3a85('0x4'));var BPromise=require(_0x3a85('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a85('0x6'));var rimraf=require(_0x3a85('0x7'));var config=require(_0x3a85('0x8'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x497afa,_0x396808){return _0x497afa[_0x3a85('0x9')](_0x3a85('0xa'),attributes,{'tableName':_0x3a85('0xb'),'paranoid':![],'indexes':[{'name':_0x3a85('0xc'),'fields':[_0x3a85('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 1ab6d50..bcce91b 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(_0xe3a2d8,_0x4d32a6){var _0xfff85f=function(_0x3118c2){while(--_0x3118c2){_0xe3a2d8['push'](_0xe3a2d8['shift']());}};_0xfff85f(++_0x4d32a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x5ca098,_0x2b28bf){var _0x27015a=function(_0x5be001){while(--_0x5be001){_0x5ca098['push'](_0x5ca098['shift']());}};_0x27015a(++_0x2b28bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 92bf809..f1f8fa2 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b64=['sequelize','sync','info','start','then','Online\x20apps:','map','filter','name','join','Offline\x20apps:','status','online','None','./config/seedDB','default','./config/license','catch','lodash','./mysqldb','./config/environment','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp'];(function(_0x26e3c3,_0x3030b4){var _0x71d019=function(_0x12e3f7){while(--_0x12e3f7){_0x26e3c3['push'](_0x26e3c3['shift']());}};_0x71d019(++_0x3030b4);}(_0x1b64,0x76));var _0x41b6=function(_0xd53b56,_0x19820c){_0xd53b56=_0xd53b56-0x0;var _0x1faaac=_0x1b64[_0xd53b56];return _0x1faaac;};'use strict';var _=require(_0x41b6('0x0'));var mysqldb=require(_0x41b6('0x1'));var rpc=require('./rpc');var config=require(_0x41b6('0x2'));var logger=require('./config/logger')('app');var pm2=require('./config/pm2');var pm2Config=require(_0x41b6('0x3'));var schedule=require(_0x41b6('0x4'));var chat=require(_0x41b6('0x5'));var whatsapp=require(_0x41b6('0x6'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x41b6('0x7')][_0x41b6('0x8')]()['then'](function(){return rpc['listen']();})['then'](function(_0x7763c3){logger[_0x41b6('0x9')](_0x7763c3);return chat[_0x41b6('0xa')]();})[_0x41b6('0xb')](function(){return whatsapp[_0x41b6('0xa')]();})[_0x41b6('0xb')](function(){return schedule['start']();})[_0x41b6('0xb')](function(){return transcribe[_0x41b6('0xa')]();})[_0x41b6('0xb')](function(_0x1e0256){logger[_0x41b6('0x9')](_0x1e0256);return pm2[_0x41b6('0xa')](pm2Config);})[_0x41b6('0xb')](function(_0xd7866){logger[_0x41b6('0x9')](_0x41b6('0xc'),_[_0x41b6('0xd')](_[_0x41b6('0xe')](_0xd7866,{'status':'online'}),_0x41b6('0xf'))[_0x41b6('0x10')]());logger[_0x41b6('0x9')](_0x41b6('0x11'),_['map'](_[_0x41b6('0xe')](_0xd7866,function(_0xed7e7f){return _0xed7e7f[_0x41b6('0x12')]!==_0x41b6('0x13');}),_0x41b6('0xf'))[_0x41b6('0x10')]()||_0x41b6('0x14'));config['seedDB']&&require(_0x41b6('0x15'))[_0x41b6('0x16')]();require(_0x41b6('0x17'))[_0x41b6('0x16')]();})[_0x41b6('0x18')](function(_0x47feb9){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x47feb9);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xb511=['status','None','seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','then','listen','info','start','Online\x20apps:','map','filter','online','name','join'];(function(_0xa4febe,_0x126c23){var _0x2712d8=function(_0x2da8d8){while(--_0x2da8d8){_0xa4febe['push'](_0xa4febe['shift']());}};_0x2712d8(++_0x126c23);}(_0xb511,0x165));var _0x1b51=function(_0x236bd8,_0x336442){_0x236bd8=_0x236bd8-0x0;var _0x48d620=_0xb511[_0x236bd8];return _0x48d620;};'use strict';var _=require(_0x1b51('0x0'));var mysqldb=require(_0x1b51('0x1'));var rpc=require(_0x1b51('0x2'));var config=require('./config/environment');var logger=require(_0x1b51('0x3'))(_0x1b51('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x1b51('0x5'));var schedule=require(_0x1b51('0x6'));var chat=require(_0x1b51('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x1b51('0x8'));function main(){return mysqldb['db'][_0x1b51('0x9')]['sync']()[_0x1b51('0xa')](function(){return rpc[_0x1b51('0xb')]();})['then'](function(_0xfa46a3){logger[_0x1b51('0xc')](_0xfa46a3);return chat[_0x1b51('0xd')]();})[_0x1b51('0xa')](function(){return whatsapp[_0x1b51('0xd')]();})[_0x1b51('0xa')](function(){return schedule[_0x1b51('0xd')]();})[_0x1b51('0xa')](function(){return transcribe['start']();})[_0x1b51('0xa')](function(_0x3113c9){logger[_0x1b51('0xc')](_0x3113c9);return pm2[_0x1b51('0xd')](pm2Config);})[_0x1b51('0xa')](function(_0x1ed8ad){logger['info'](_0x1b51('0xe'),_[_0x1b51('0xf')](_[_0x1b51('0x10')](_0x1ed8ad,{'status':_0x1b51('0x11')}),_0x1b51('0x12'))[_0x1b51('0x13')]());logger[_0x1b51('0xc')]('Offline\x20apps:',_[_0x1b51('0xf')](_['filter'](_0x1ed8ad,function(_0x5db91e){return _0x5db91e[_0x1b51('0x14')]!==_0x1b51('0x11');}),'name')[_0x1b51('0x13')]()||_0x1b51('0x15'));config[_0x1b51('0x16')]&&require('./config/seedDB')[_0x1b51('0x17')]();require(_0x1b51('0x18'))[_0x1b51('0x17')]();})[_0x1b51('0x19')](function(_0x5deebf){logger[_0x1b51('0x1a')](_0x1b51('0x1b'),_0x5deebf);process[_0x1b51('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 15453f8..3ea0f3e 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 _0x3e17=['internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','pauseType','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','isChatInteractionAuthorized','use','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','Basic','User','find','name','authenticate','pass','Wrong\x20credentials.','user','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','allowedLoginAttempts','blockDuration','nonce','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','splice','join','promisify','sign','session','options','randomBytes','toString','floor','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','util','secrets','role','fullname'];(function(_0x4b2331,_0x3dcd93){var _0x3005df=function(_0x47f6a7){while(--_0x47f6a7){_0x4b2331['push'](_0x4b2331['shift']());}};_0x3005df(++_0x3dcd93);}(_0x3e17,0xe7));var _0x73e1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3e17[_0x57b54c];return _0x59cc19;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x73e1('0x0'));var hardwareConf=require(_0x73e1('0x1'));var licenseUtil=require(_0x73e1('0x2'));var encryptor=require(_0x73e1('0x3'));var _=require(_0x73e1('0x4'));var jwt=require(_0x73e1('0x5'));var expressJwt=require('express-jwt');var compose=require(_0x73e1('0x6'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x73e1('0x7'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x73e1('0x8')]['session']});var userAttributes=['id',_0x73e1('0x9'),_0x73e1('0xa'),'name',_0x73e1('0xb'),_0x73e1('0xc'),_0x73e1('0xd'),_0x73e1('0xe'),_0x73e1('0xf'),_0x73e1('0x10'),_0x73e1('0x11'),_0x73e1('0x12'),_0x73e1('0x13'),_0x73e1('0x14'),'openchannelPause',_0x73e1('0x15'),'showWebBar',_0x73e1('0x16'),_0x73e1('0x17'),'crudPermissions',_0x73e1('0x18'),_0x73e1('0x19'),_0x73e1('0x1a'),'phoneBarAutoAnswer',_0x73e1('0x1b'),_0x73e1('0x1c'),_0x73e1('0x1d'),_0x73e1('0x1e'),'phoneBarEnableSettings',_0x73e1('0x1f'),_0x73e1('0x20'),_0x73e1('0x21'),_0x73e1('0x22'),_0x73e1('0x23'),'interface',_0x73e1('0x24'),_0x73e1('0x25')];exports[_0x73e1('0x26')]=function(){return this['isAuthenticated'](!![])[_0x73e1('0x27')](function(_0x470342,_0x29c259,_0x10762d){if(_0x470342['user']){_0x10762d();}else{return db[_0x73e1('0x28')][_0x73e1('0x29')]({'where':{'id':_0x470342[_0x73e1('0x2a')]['id']},'attributes':['id',_0x73e1('0x2b'),_0x73e1('0x2c')],'raw':!![]})[_0x73e1('0x2d')](function(_0x4f2803){if(_0x4f2803&&_0x4f2803['closed']){return _0x29c259[_0x73e1('0x2e')](_0x4f2803['disposition']===_0x73e1('0x2f')?0x195:0x193)[_0x73e1('0x30')]({'message':_0x4f2803[_0x73e1('0x2c')]===_0x73e1('0x2f')?_0x73e1('0x31'):_0x73e1('0x32')});}else{_0x10762d();}})[_0x73e1('0x33')](function(_0x2e4e97){_0x10762d(_0x2e4e97);});}});};exports['isAuthenticated']=function isAuthenticated(_0x60c857){return compose()[_0x73e1('0x27')](function(_0x57cb24,_0x11c69c,_0x33f57a){var _0xb0e742;if(_0x57cb24[_0x73e1('0x34')][_0x73e1('0x35')]){if(_['startsWith'](_0x57cb24[_0x73e1('0x34')][_0x73e1('0x35')],_0x73e1('0x36'))){var _0x3ca350=basicAuth(_0x57cb24);db[_0x73e1('0x37')][_0x73e1('0x38')]({'where':{'name':_0x3ca350[_0x73e1('0x39')]}})[_0x73e1('0x2d')](function(_0x4ab24c){if(!_0x4ab24c||!_0x4ab24c[_0x73e1('0x3a')](_0x3ca350[_0x73e1('0x3b')])){return _0x11c69c[_0x73e1('0x2e')](0x191)[_0x73e1('0x30')]({'message':_0x73e1('0x3c')});}_0x57cb24[_0x73e1('0x3d')]={'id':_0x4ab24c['id']};_0x33f57a();})[_0x73e1('0x33')](function(_0x37af45){_0x33f57a(_0x37af45);});}else if(_[_0x73e1('0x3e')](_0x57cb24[_0x73e1('0x34')][_0x73e1('0x35')],_0x73e1('0x3f'))){validateJwt(_0x57cb24,_0x11c69c,_0x33f57a);}else{if(_0x60c857){_0x33f57a();}else{return _0x11c69c[_0x73e1('0x2e')](0x193)[_0x73e1('0x30')]({'message':_0x73e1('0x40')});}}}else if(_0x57cb24[_0x73e1('0x41')][_0x73e1('0x42')]){try{var _0x53618c={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x73e1('0x43')]()};verifyJwt(_0x57cb24[_0x73e1('0x41')][_0x73e1('0x42')],_0x53618c)[_0x73e1('0x2d')](function(_0x57887b){return db['User']['find']({'where':{'id':_0x57887b[_0x73e1('0x44')]}})[_0x73e1('0x2d')](function(_0x40b567){_0xb0e742=_0x40b567;return db['Setting'][_0x73e1('0x29')]({'where':{'id':0x1},'attributes':[_0x73e1('0x45'),_0x73e1('0x46')],'raw':!![]});})['then'](function(_0x4fad9a){if(!_0xb0e742||!_['isEqual'](_0xb0e742['apiKeyNonce'],_0x57887b[_0x73e1('0x47')])){return _0x11c69c[_0x73e1('0x2e')](0x191)[_0x73e1('0x30')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0xb0e742[_0x73e1('0x48')]){return _0x11c69c[_0x73e1('0x2e')](0x191)[_0x73e1('0x30')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0xb0e742[_0x73e1('0x49')]){if(_0x4fad9a[_0x73e1('0x46')]>0x0){if(moment(_0xb0e742[_0x73e1('0x4a')])[_0x73e1('0x4b')](_0x4fad9a[_0x73e1('0x46')],_0x73e1('0x4c'))>moment()){return _0x11c69c[_0x73e1('0x2e')](0x191)[_0x73e1('0x30')]({'message':_0x73e1('0x4d')});}}else{return _0x11c69c['status'](0x191)[_0x73e1('0x30')]({'message':_0x73e1('0x4d')});}}_0x57cb24['user']={'id':_0xb0e742['id']};_0x33f57a();});})['catch'](function(){return _0x11c69c[_0x73e1('0x2e')](0x191)[_0x73e1('0x30')]({'message':_0x73e1('0x4d')});});}catch(_0x16fcb7){_0x33f57a(_0x16fcb7);}}else if(_0x60c857){_0x33f57a();}else{return _0x11c69c[_0x73e1('0x2e')](0x193)[_0x73e1('0x30')]({'message':_0x73e1('0x40')});}})[_0x73e1('0x27')](function(_0x4a1ec3,_0x3391ad,_0x561152){if(_0x4a1ec3['user']){db[_0x73e1('0x37')]['find']({'where':{'id':_0x4a1ec3[_0x73e1('0x3d')]['id']},'attributes':userAttributes})[_0x73e1('0x2d')](function(_0x595768){if(!_0x595768){return _0x3391ad[_0x73e1('0x2e')](0x194)[_0x73e1('0x30')]({'message':_0x73e1('0x4e')});}_0x4a1ec3[_0x73e1('0x3d')]=_0x595768;_0x561152();})[_0x73e1('0x33')](function(_0x1b712d){_0x561152(_0x1b712d);});}else if(_0x60c857){_0x561152();}else{return _0x3391ad[_0x73e1('0x2e')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x73e1('0x4f')]=function canUpdate(){return compose()[_0x73e1('0x27')](function(_0x4fbb0e,_0x15a924,_0xebc320){return licenseUtil[_0x73e1('0x50')]()[_0x73e1('0x2d')](function(_0xa3845f){if(_0xa3845f[_0x73e1('0x51')]){_0xebc320();}else{return _0x15a924[_0x73e1('0x2e')](0x193)[_0x73e1('0x30')]({'message':_0x73e1('0x52')});}})[_0x73e1('0x33')](function(_0x24e7d2){_0xebc320(_0x24e7d2);});});};exports[_0x73e1('0x53')]=function(_0x916aa,_0x58f3eb,_0x12de39){_0x916aa['isMiddleware']=!![];return _0x12de39();};exports[_0x73e1('0x54')]=function signToken(_0x1b29d7){return signJwt(_0x1b29d7);};exports[_0x73e1('0x55')]=function(_0xfda807,_0x4cc6ca){if(!_0xfda807['user']){return _0x4cc6ca[_0x73e1('0x2e')](0x194)[_0x73e1('0x30')]({'message':_0x73e1('0x56')});}var _0x35b1ef={'payload':{'id':_0xfda807[_0x73e1('0x3d')]['id'],'role':_0xfda807[_0x73e1('0x3d')][_0x73e1('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x35b1ef)['then'](function(_0x233393){_0x4cc6ca[_0x73e1('0x57')](_0x73e1('0x58'),_0x233393);_0x4cc6ca[_0x73e1('0x59')](_0x73e1('0x5a'));})[_0x73e1('0x33')](function(_0x1a2a1b){return _0x4cc6ca[_0x73e1('0x2e')](0x1f4)[_0x73e1('0x5b')](_0x1a2a1b);});};exports[_0x73e1('0x5c')]=function(_0x3c7625){if(_[_0x73e1('0x5d')](_0x3c7625['apiKeyNonce'])||_['isNil'](_0x3c7625[_0x73e1('0x5e')])){return null;}else{return createJwt(_0x3c7625);}};exports[_0x73e1('0x5f')]=function(_0x17bbab){_0x17bbab[_0x73e1('0x60')]=generateNonce();_0x17bbab[_0x73e1('0x5e')]=generateIssuedAt();return createJwt(_0x17bbab);};exports[_0x73e1('0x61')]=function(_0x1136ef,_0x4a8b3e){var _0x2f3e56=_0x1136ef['query']['apikey'];if(_0x2f3e56){var _0xe3cf1b={'nonce':_0x4a8b3e[_0x73e1('0x60')],'iat':_0x4a8b3e[_0x73e1('0x5e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x73e1('0x43')]()};return verifyJwt(_0x2f3e56,_0xe3cf1b)['then'](function(){return generateApiKey(_0x4a8b3e);});}else{throw{'message':_0x73e1('0x62')};}};exports[_0x73e1('0x63')]=function(_0x3879da){var _0x3e7feb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3e7feb[_0x73e1('0x64')](_0x3879da))throw new db[(_0x73e1('0x65'))]['ValidationError'](_0x73e1('0x66'));return;};exports[_0x73e1('0x67')]=function(_0x12a6f9,_0x1a2f2c,_0x4fb5bb){var _0x41936f=encryptor[_0x73e1('0x68')](_0x1a2f2c)[_0x73e1('0x69')](',');for(var _0x588612=0x0;_0x588612<_0x4fb5bb;_0x588612++){if(!_0x41936f[_0x588612])break;if(_0x12a6f9['toLowerCase']()===_0x41936f[_0x588612]['toLowerCase']()){var _0x5dea61=util[_0x73e1('0x6a')](_0x73e1('0x6b'),_0x4fb5bb);if(_0x4fb5bb===0x1){_0x5dea61=_0x73e1('0x6c');}throw new db[(_0x73e1('0x65'))][(_0x73e1('0x6d'))](_0x5dea61);}}return;};exports['updatePasswordsHistory']=function(_0x334b7a,_0x3a3d74){var _0x3acc9c=_0x3a3d74?encryptor[_0x73e1('0x68')](_0x3a3d74)[_0x73e1('0x69')](','):[];if(_0x3acc9c['length']===0x5){_0x3acc9c[_0x73e1('0x6e')](-0x1,0x1);}_0x3acc9c['unshift'](_0x334b7a);return encryptor['encryptString'](_0x3acc9c[_0x73e1('0x6f')](','));};function signJwt(_0x2c67cd){var _0x4a755a=BPromise[_0x73e1('0x70')](jwt[_0x73e1('0x71')],{'context':jwt});var _0x4d9dac=_0x2c67cd['secret']||config[_0x73e1('0x8')][_0x73e1('0x72')];return new BPromise(function(_0x34ff6d,_0x7f49d6){_0x4a755a(_0x2c67cd['payload'],_0x4d9dac,_0x2c67cd[_0x73e1('0x73')])[_0x73e1('0x2d')](function(_0x17c97b){_0x34ff6d(_0x17c97b);})[_0x73e1('0x33')](function(_0x255020){_0x7f49d6(_0x255020);});});}function verifyJwt(_0x2d9ce2,_0x47cadd,_0x52cedb){var _0x3493f6=BPromise[_0x73e1('0x70')](jwt['verify'],{'context':jwt});var _0x45862f=_0x52cedb||config[_0x73e1('0x8')][_0x73e1('0x72')];return new BPromise(function(_0x57cf6f,_0x3ebe30){_0x3493f6(_0x2d9ce2,_0x45862f,_0x47cadd)[_0x73e1('0x2d')](function(_0x2399c3){_0x57cf6f(_0x2399c3);})[_0x73e1('0x33')](function(_0x5762a1){_0x3ebe30(_0x5762a1);});});}function generateNonce(){return crypto[_0x73e1('0x74')](0x10)[_0x73e1('0x75')]('hex');}function generateIssuedAt(){return Math[_0x73e1('0x76')](Date[_0x73e1('0x77')]()/0x3e8)[_0x73e1('0x75')]();}function createJwt(_0x34fdf4){var _0x11e8e1={'payload':{'iat':_0x34fdf4['apiKeyIat'],'nonce':_0x34fdf4['apiKeyNonce']},'options':{'algorithm':_0x73e1('0x78'),'subject':_0x34fdf4['id'][_0x73e1('0x75')](),'issuer':hardwareConf[_0x73e1('0x43')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x11e8e1)['then'](function(_0x35f27d){return{'iat':_0x34fdf4[_0x73e1('0x5e')],'nonce':_0x34fdf4[_0x73e1('0x60')],'token':_0x35f27d};});} \ No newline at end of file +var _0xb0cd=['hotdesk','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','disposition','then','status','json','Unmanaged.','headers','startsWith','authorization','Basic','User','find','authenticate','pass','Bearer','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','catch','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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.','updatePasswordsHistory','length','unshift','join','sign','secret','payload','options','verify','randomBytes','hex','floor','now','HS512','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl'];(function(_0x26c275,_0x286946){var _0x27020b=function(_0xc49d40){while(--_0xc49d40){_0x26c275['push'](_0x26c275['shift']());}};_0x27020b(++_0x286946);}(_0xb0cd,0x1d8));var _0xdb0c=function(_0x21e784,_0x101bda){_0x21e784=_0x21e784-0x0;var _0x516b71=_0xb0cd[_0x21e784];return _0x516b71;};'use strict';var db=require(_0xdb0c('0x0'))['db'];var config=require(_0xdb0c('0x1'));var hardwareConf=require(_0xdb0c('0x2'));var licenseUtil=require(_0xdb0c('0x3'));var encryptor=require(_0xdb0c('0x4'));var _=require(_0xdb0c('0x5'));var jwt=require(_0xdb0c('0x6'));var expressJwt=require(_0xdb0c('0x7'));var compose=require(_0xdb0c('0x8'));var basicAuth=require('basic-auth');var crypto=require(_0xdb0c('0x9'));var BPromise=require(_0xdb0c('0xa'));var util=require('util');var moment=require(_0xdb0c('0xb'));var validateJwt=expressJwt({'secret':config[_0xdb0c('0xc')][_0xdb0c('0xd')]});var userAttributes=['id',_0xdb0c('0xe'),_0xdb0c('0xf'),_0xdb0c('0x10'),_0xdb0c('0x11'),_0xdb0c('0x12'),_0xdb0c('0x13'),_0xdb0c('0x14'),_0xdb0c('0x15'),_0xdb0c('0x16'),_0xdb0c('0x17'),_0xdb0c('0x18'),_0xdb0c('0x19'),_0xdb0c('0x1a'),_0xdb0c('0x1b'),_0xdb0c('0x1c'),_0xdb0c('0x1d'),_0xdb0c('0x1e'),_0xdb0c('0x1f'),_0xdb0c('0x20'),_0xdb0c('0x21'),_0xdb0c('0x22'),_0xdb0c('0x23'),_0xdb0c('0x24'),_0xdb0c('0x25'),'phoneBarDnd',_0xdb0c('0x26'),_0xdb0c('0x27'),_0xdb0c('0x28'),_0xdb0c('0x29'),_0xdb0c('0x2a'),_0xdb0c('0x2b'),'phoneBarRemoteControlPort',_0xdb0c('0x2c'),'interface',_0xdb0c('0x2d'),'settingsEnabled'];exports[_0xdb0c('0x2e')]=function(){return this[_0xdb0c('0x2f')](!![])[_0xdb0c('0x30')](function(_0x322555,_0x4c80ed,_0x28326a){if(_0x322555[_0xdb0c('0x31')]){_0x28326a();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x322555[_0xdb0c('0x32')]['id']},'attributes':['id',_0xdb0c('0x33'),_0xdb0c('0x34')],'raw':!![]})[_0xdb0c('0x35')](function(_0x401b7b){if(_0x401b7b&&_0x401b7b[_0xdb0c('0x33')]){return _0x4c80ed[_0xdb0c('0x36')](_0x401b7b[_0xdb0c('0x34')]==='unmanaged'?0x195:0x193)[_0xdb0c('0x37')]({'message':_0x401b7b[_0xdb0c('0x34')]==='unmanaged'?_0xdb0c('0x38'):'Forbidden.'});}else{_0x28326a();}})['catch'](function(_0x1de728){_0x28326a(_0x1de728);});}});};exports['isAuthenticated']=function isAuthenticated(_0x42e46b){return compose()[_0xdb0c('0x30')](function(_0x20ad6c,_0x5318e1,_0x3e1d4f){var _0x89e80d;if(_0x20ad6c[_0xdb0c('0x39')]['authorization']){if(_[_0xdb0c('0x3a')](_0x20ad6c[_0xdb0c('0x39')][_0xdb0c('0x3b')],_0xdb0c('0x3c'))){var _0x11a196=basicAuth(_0x20ad6c);db[_0xdb0c('0x3d')][_0xdb0c('0x3e')]({'where':{'name':_0x11a196[_0xdb0c('0x10')]}})[_0xdb0c('0x35')](function(_0x9a4980){if(!_0x9a4980||!_0x9a4980[_0xdb0c('0x3f')](_0x11a196[_0xdb0c('0x40')])){return _0x5318e1['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x20ad6c[_0xdb0c('0x31')]={'id':_0x9a4980['id']};_0x3e1d4f();})['catch'](function(_0x4c6501){_0x3e1d4f(_0x4c6501);});}else if(_[_0xdb0c('0x3a')](_0x20ad6c[_0xdb0c('0x39')][_0xdb0c('0x3b')],_0xdb0c('0x41'))){validateJwt(_0x20ad6c,_0x5318e1,_0x3e1d4f);}else{if(_0x42e46b){_0x3e1d4f();}else{return _0x5318e1[_0xdb0c('0x36')](0x193)[_0xdb0c('0x37')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x20ad6c[_0xdb0c('0x42')][_0xdb0c('0x43')]){try{var _0x513894={'audience':hardwareConf[_0xdb0c('0x44')](),'issuer':hardwareConf[_0xdb0c('0x44')]()};verifyJwt(_0x20ad6c[_0xdb0c('0x42')]['apikey'],_0x513894)[_0xdb0c('0x35')](function(_0x5b3290){return db[_0xdb0c('0x3d')][_0xdb0c('0x3e')]({'where':{'id':_0x5b3290[_0xdb0c('0x45')]}})[_0xdb0c('0x35')](function(_0x601291){_0x89e80d=_0x601291;return db[_0xdb0c('0x46')][_0xdb0c('0x47')]({'where':{'id':0x1},'attributes':[_0xdb0c('0x48'),'blockDuration'],'raw':!![]});})['then'](function(_0x9e0520){if(!_0x89e80d||!_[_0xdb0c('0x49')](_0x89e80d['apiKeyNonce'],_0x5b3290[_0xdb0c('0x4a')])){return _0x5318e1[_0xdb0c('0x36')](0x191)[_0xdb0c('0x37')]({'message':_0xdb0c('0x4b')});}if(_0x89e80d[_0xdb0c('0x4c')]){return _0x5318e1[_0xdb0c('0x36')](0x191)['json']({'message':_0xdb0c('0x4d')});}if(_0x89e80d[_0xdb0c('0x4e')]){if(_0x9e0520[_0xdb0c('0x4f')]>0x0){if(moment(_0x89e80d[_0xdb0c('0x50')])[_0xdb0c('0x51')](_0x9e0520[_0xdb0c('0x4f')],_0xdb0c('0x52'))>moment()){return _0x5318e1[_0xdb0c('0x36')](0x191)[_0xdb0c('0x37')]({'message':_0xdb0c('0x4d')});}}else{return _0x5318e1[_0xdb0c('0x36')](0x191)['json']({'message':_0xdb0c('0x4d')});}}_0x20ad6c[_0xdb0c('0x31')]={'id':_0x89e80d['id']};_0x3e1d4f();});})[_0xdb0c('0x53')](function(){return _0x5318e1['status'](0x191)[_0xdb0c('0x37')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x2c0948){_0x3e1d4f(_0x2c0948);}}else if(_0x42e46b){_0x3e1d4f();}else{return _0x5318e1[_0xdb0c('0x36')](0x193)[_0xdb0c('0x37')]({'message':_0xdb0c('0x54')});}})['use'](function(_0x3883a4,_0x2a4250,_0x5264f9){if(_0x3883a4[_0xdb0c('0x31')]){db['User']['find']({'where':{'id':_0x3883a4['user']['id']},'attributes':userAttributes})[_0xdb0c('0x35')](function(_0x39afdc){if(!_0x39afdc){return _0x2a4250[_0xdb0c('0x36')](0x194)['json']({'message':_0xdb0c('0x55')});}_0x3883a4[_0xdb0c('0x31')]=_0x39afdc;_0x5264f9();})[_0xdb0c('0x53')](function(_0xeae7a4){_0x5264f9(_0xeae7a4);});}else if(_0x42e46b){_0x5264f9();}else{return _0x2a4250[_0xdb0c('0x36')](0x194)[_0xdb0c('0x37')]({'message':_0xdb0c('0x56')});}});};exports[_0xdb0c('0x57')]=function canUpdate(){return compose()[_0xdb0c('0x30')](function(_0x554ffe,_0xa5f08e,_0x889ae2){return licenseUtil['getLicense']()[_0xdb0c('0x35')](function(_0x18fcb8){if(_0x18fcb8[_0xdb0c('0x58')]){_0x889ae2();}else{return _0xa5f08e[_0xdb0c('0x36')](0x193)['json']({'message':_0xdb0c('0x59')});}})[_0xdb0c('0x53')](function(_0x1629bb){_0x889ae2(_0x1629bb);});});};exports[_0xdb0c('0x5a')]=function(_0x2de3ec,_0x40d3c9,_0x3f8442){_0x2de3ec[_0xdb0c('0x5a')]=!![];return _0x3f8442();};exports[_0xdb0c('0x5b')]=function signToken(_0x3fd20d){return signJwt(_0x3fd20d);};exports['setTokenCookie']=function(_0x129b23,_0x5bb40b){if(!_0x129b23[_0xdb0c('0x31')]){return _0x5bb40b[_0xdb0c('0x36')](0x194)['json']({'message':_0xdb0c('0x5c')});}var _0x2cf8d4={'payload':{'id':_0x129b23['user']['id'],'role':_0x129b23[_0xdb0c('0x31')][_0xdb0c('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2cf8d4)['then'](function(_0x3f7f67){_0x5bb40b[_0xdb0c('0x5d')](_0xdb0c('0x5e'),_0x3f7f67);_0x5bb40b['redirect'](_0xdb0c('0x5f'));})['catch'](function(_0x16065f){return _0x5bb40b[_0xdb0c('0x36')](0x1f4)[_0xdb0c('0x60')](_0x16065f);});};exports[_0xdb0c('0x61')]=function(_0x1b1b96){if(_[_0xdb0c('0x62')](_0x1b1b96[_0xdb0c('0x63')])||_[_0xdb0c('0x62')](_0x1b1b96[_0xdb0c('0x64')])){return null;}else{return createJwt(_0x1b1b96);}};exports[_0xdb0c('0x65')]=function(_0x49cd3a){_0x49cd3a[_0xdb0c('0x63')]=generateNonce();_0x49cd3a[_0xdb0c('0x64')]=generateIssuedAt();return createJwt(_0x49cd3a);};exports[_0xdb0c('0x66')]=function(_0x788960,_0x726f85){var _0x3cce01=_0x788960['query'][_0xdb0c('0x43')];if(_0x3cce01){var _0x12ce65={'nonce':_0x726f85['apiKeyNonce'],'iat':_0x726f85[_0xdb0c('0x64')],'audience':hardwareConf[_0xdb0c('0x44')](),'issuer':hardwareConf[_0xdb0c('0x44')]()};return verifyJwt(_0x3cce01,_0x12ce65)['then'](function(){return generateApiKey(_0x726f85);});}else{throw{'message':_0xdb0c('0x67')};}};exports[_0xdb0c('0x68')]=function(_0x55aaa6){var _0x31da83=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x31da83['test'](_0x55aaa6))throw new db[(_0xdb0c('0x69'))][(_0xdb0c('0x6a'))](_0xdb0c('0x6b'));return;};exports[_0xdb0c('0x6c')]=function(_0x279e91,_0x4c5ca8,_0x9422ff){var _0x3a3cd5=encryptor[_0xdb0c('0x6d')](_0x4c5ca8)[_0xdb0c('0x6e')](',');for(var _0x2e9b32=0x0;_0x2e9b32<_0x9422ff;_0x2e9b32++){if(!_0x3a3cd5[_0x2e9b32])break;if(_0x279e91[_0xdb0c('0x6f')]()===_0x3a3cd5[_0x2e9b32][_0xdb0c('0x6f')]()){var _0x29f6be=util[_0xdb0c('0x70')](_0xdb0c('0x71'),_0x9422ff);if(_0x9422ff===0x1){_0x29f6be='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x29f6be);}}return;};exports[_0xdb0c('0x72')]=function(_0x57c6df,_0x264b89){var _0x569b5f=_0x264b89?encryptor[_0xdb0c('0x6d')](_0x264b89)[_0xdb0c('0x6e')](','):[];if(_0x569b5f[_0xdb0c('0x73')]===0x5){_0x569b5f['splice'](-0x1,0x1);}_0x569b5f[_0xdb0c('0x74')](_0x57c6df);return encryptor['encryptString'](_0x569b5f[_0xdb0c('0x75')](','));};function signJwt(_0x30ff3e){var _0x1e5b83=BPromise['promisify'](jwt[_0xdb0c('0x76')],{'context':jwt});var _0x317e4a=_0x30ff3e[_0xdb0c('0x77')]||config[_0xdb0c('0xc')]['session'];return new BPromise(function(_0x28d64d,_0x2ef4c1){_0x1e5b83(_0x30ff3e[_0xdb0c('0x78')],_0x317e4a,_0x30ff3e[_0xdb0c('0x79')])[_0xdb0c('0x35')](function(_0x44a066){_0x28d64d(_0x44a066);})[_0xdb0c('0x53')](function(_0x51e022){_0x2ef4c1(_0x51e022);});});}function verifyJwt(_0x2ac52d,_0x273e97,_0x527f73){var _0x57b10c=BPromise['promisify'](jwt[_0xdb0c('0x7a')],{'context':jwt});var _0x452a7c=_0x527f73||config['secrets']['session'];return new BPromise(function(_0x259ce5,_0x22fccd){_0x57b10c(_0x2ac52d,_0x452a7c,_0x273e97)[_0xdb0c('0x35')](function(_0x521ccf){_0x259ce5(_0x521ccf);})[_0xdb0c('0x53')](function(_0x39b704){_0x22fccd(_0x39b704);});});}function generateNonce(){return crypto[_0xdb0c('0x7b')](0x10)['toString'](_0xdb0c('0x7c'));}function generateIssuedAt(){return Math[_0xdb0c('0x7d')](Date[_0xdb0c('0x7e')]()/0x3e8)['toString']();}function createJwt(_0x3f46b8){var _0x4b2797={'payload':{'iat':_0x3f46b8['apiKeyIat'],'nonce':_0x3f46b8[_0xdb0c('0x63')]},'options':{'algorithm':_0xdb0c('0x7f'),'subject':_0x3f46b8['id'][_0xdb0c('0x80')](),'issuer':hardwareConf[_0xdb0c('0x44')](),'audience':hardwareConf[_0xdb0c('0x44')]()}};return signJwt(_0x4b2797)[_0xdb0c('0x35')](function(_0xc495ce){return{'iat':_0x3f46b8[_0xdb0c('0x64')],'nonce':_0x3f46b8[_0xdb0c('0x63')],'token':_0xc495ce};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 7233b3f..da00226 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 _0xae24=['update','write','end','final','binary','close','createDecipher','unlink','encryptString','secret','utf8','base64','crypto','../../config/environment','session','aes-256-ctr','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm'];(function(_0x5779dc,_0x46b82b){var _0x226637=function(_0x597f09){while(--_0x597f09){_0x5779dc['push'](_0x5779dc['shift']());}};_0x226637(++_0x46b82b);}(_0xae24,0x182));var _0x4ae2=function(_0x3d8db3,_0x4a533d){_0x3d8db3=_0x3d8db3-0x0;var _0x21de3a=_0xae24[_0x3d8db3];return _0x21de3a;};'use strict';var crypto=require(_0x4ae2('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require(_0x4ae2('0x1'));const stringOptions={'secret':config['secrets'][_0x4ae2('0x2')],'algorithm':_0x4ae2('0x3')};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x5b6f4d){var _0x1afc7a={};for(var _0x5b25b5 in fileOptions){if(fileOptions[_0x4ae2('0x4')](_0x5b25b5)){_0x1afc7a[_0x5b25b5]=fileOptions[_0x5b25b5];}}if(_0x5b6f4d){for(var _0xf26f45 in _0x5b6f4d){if(_0x5b6f4d[_0x4ae2('0x4')](_0xf26f45)){_0x1afc7a[_0xf26f45]=_0x5b6f4d[_0xf26f45];}}}return _0x1afc7a;}exports[_0x4ae2('0x5')]=function(_0x428054,_0x307247,_0x4f2e84,_0x5f589a){return new BPromise(function(_0x41cdf1,_0x4d3d8a){_0x5f589a=combineOptions(_0x5f589a);var _0x564ef9=new Buffer(_0x4f2e84);var _0xb5587a=fs[_0x4ae2('0x6')](_0x428054);var _0x5c32b7=fs[_0x4ae2('0x7')](_0x307247);var _0x449e1a=crypto[_0x4ae2('0x8')](_0x5f589a[_0x4ae2('0x9')],_0x564ef9);_0xb5587a['on']('data',function(_0x19b222){var _0xcbd76d=new Buffer(_0x449e1a[_0x4ae2('0xa')](_0x19b222),'binary');_0x5c32b7[_0x4ae2('0xb')](_0xcbd76d);});_0xb5587a['on'](_0x4ae2('0xc'),function(){try{var _0x30d6c4=new Buffer(_0x449e1a[_0x4ae2('0xd')](_0x4ae2('0xe')),_0x4ae2('0xe'));_0x5c32b7[_0x4ae2('0xb')](_0x30d6c4);_0x5c32b7[_0x4ae2('0xc')]();_0x5c32b7['on'](_0x4ae2('0xf'),function(){return _0x41cdf1(_0x307247);});}catch(_0x5e2bfd){fs['unlink'](_0x307247);return _0x4d3d8a(_0x5e2bfd);}});});};exports['decryptFile']=function(_0x2f3936,_0xf834a1,_0x5f447a,_0x463765){return new BPromise(function(_0x9fb8db,_0x1fde63){_0x463765=combineOptions(_0x463765);var _0x1d5a78=new Buffer(_0x5f447a);var _0x428d24=fs[_0x4ae2('0x6')](_0x2f3936);var _0x3d4259=fs[_0x4ae2('0x7')](_0xf834a1);var _0x41b672=crypto[_0x4ae2('0x10')](_0x463765['algorithm'],_0x1d5a78);_0x428d24['on']('data',function(_0x44a2d3){var _0x2d910c=new Buffer(_0x41b672['update'](_0x44a2d3),_0x4ae2('0xe'));_0x3d4259[_0x4ae2('0xb')](_0x2d910c);});_0x428d24['on'](_0x4ae2('0xc'),function(){try{var _0x2ad222=new Buffer(_0x41b672[_0x4ae2('0xd')]('binary'),_0x4ae2('0xe'));_0x3d4259['write'](_0x2ad222);_0x3d4259['end']();_0x3d4259['on'](_0x4ae2('0xf'),function(){return _0x9fb8db(_0xf834a1);});}catch(_0x151b70){fs[_0x4ae2('0x11')](_0xf834a1);return _0x1fde63(_0x151b70);}});});};exports[_0x4ae2('0x12')]=function(_0xca16bf,_0x526768,_0x1005e0){var _0x4a0ddb=_0x1005e0||stringOptions[_0x4ae2('0x9')];var _0x12b5d2=_0x526768||stringOptions[_0x4ae2('0x13')];var _0x57933b=crypto[_0x4ae2('0x8')](_0x4a0ddb,_0x12b5d2);var _0x6f0cc6=_0x57933b[_0x4ae2('0xa')](_0xca16bf,_0x4ae2('0x14'),_0x4ae2('0x15'));_0x6f0cc6+=_0x57933b[_0x4ae2('0xd')]('base64');return _0x6f0cc6;};exports['decryptString']=function(_0x9508d7,_0x3030f8,_0x3fa514){var _0x329588=_0x3fa514||stringOptions[_0x4ae2('0x9')];var _0x20ef44=_0x3030f8||stringOptions['secret'];var _0x5ec1fd=crypto[_0x4ae2('0x10')](_0x329588,_0x20ef44);var _0x4e7741=_0x5ec1fd['update'](_0x9508d7,'base64',_0x4ae2('0x14'));_0x4e7741+=_0x5ec1fd[_0x4ae2('0xd')]('utf8');return _0x4e7741;}; \ No newline at end of file +var _0xabce=['createDecipher','final','close','utf8','base64','decryptString','crypto','bluebird','../../config/environment','secrets','session','hasOwnProperty','createReadStream','createWriteStream','createCipher','algorithm','data','update','binary','write','end','unlink','decryptFile'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xabce,0x103));var _0xeabc=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xabce[_0x1d9aa0];return _0x226868;};'use strict';var crypto=require(_0xeabc('0x0'));var fs=require('fs');var BPromise=require(_0xeabc('0x1'));var config=require(_0xeabc('0x2'));const stringOptions={'secret':config[_0xeabc('0x3')][_0xeabc('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x2e01eb){var _0x1d9f37={};for(var _0x1a88a7 in fileOptions){if(fileOptions['hasOwnProperty'](_0x1a88a7)){_0x1d9f37[_0x1a88a7]=fileOptions[_0x1a88a7];}}if(_0x2e01eb){for(var _0x54e4a8 in _0x2e01eb){if(_0x2e01eb[_0xeabc('0x5')](_0x54e4a8)){_0x1d9f37[_0x54e4a8]=_0x2e01eb[_0x54e4a8];}}}return _0x1d9f37;}exports['encryptFile']=function(_0x229ba4,_0x52ede8,_0x3bdc29,_0x9417af){return new BPromise(function(_0x8434c5,_0x5d59d5){_0x9417af=combineOptions(_0x9417af);var _0x438ccf=new Buffer(_0x3bdc29);var _0x341f16=fs[_0xeabc('0x6')](_0x229ba4);var _0x1b4d1b=fs[_0xeabc('0x7')](_0x52ede8);var _0x283cdf=crypto[_0xeabc('0x8')](_0x9417af[_0xeabc('0x9')],_0x438ccf);_0x341f16['on'](_0xeabc('0xa'),function(_0xf0d9c0){var _0x7be90=new Buffer(_0x283cdf[_0xeabc('0xb')](_0xf0d9c0),_0xeabc('0xc'));_0x1b4d1b[_0xeabc('0xd')](_0x7be90);});_0x341f16['on'](_0xeabc('0xe'),function(){try{var _0xcfbf06=new Buffer(_0x283cdf['final'](_0xeabc('0xc')),_0xeabc('0xc'));_0x1b4d1b[_0xeabc('0xd')](_0xcfbf06);_0x1b4d1b['end']();_0x1b4d1b['on']('close',function(){return _0x8434c5(_0x52ede8);});}catch(_0x3170ea){fs[_0xeabc('0xf')](_0x52ede8);return _0x5d59d5(_0x3170ea);}});});};exports[_0xeabc('0x10')]=function(_0x53d5cb,_0xf913d7,_0x638976,_0x49f2d8){return new BPromise(function(_0x53fe28,_0x10fa8e){_0x49f2d8=combineOptions(_0x49f2d8);var _0x581d29=new Buffer(_0x638976);var _0x3d0e21=fs[_0xeabc('0x6')](_0x53d5cb);var _0x58a3c0=fs[_0xeabc('0x7')](_0xf913d7);var _0x31dd53=crypto[_0xeabc('0x11')](_0x49f2d8[_0xeabc('0x9')],_0x581d29);_0x3d0e21['on'](_0xeabc('0xa'),function(_0x5d92e5){var _0x1253e4=new Buffer(_0x31dd53['update'](_0x5d92e5),_0xeabc('0xc'));_0x58a3c0[_0xeabc('0xd')](_0x1253e4);});_0x3d0e21['on']('end',function(){try{var _0x28063a=new Buffer(_0x31dd53[_0xeabc('0x12')](_0xeabc('0xc')),_0xeabc('0xc'));_0x58a3c0[_0xeabc('0xd')](_0x28063a);_0x58a3c0['end']();_0x58a3c0['on'](_0xeabc('0x13'),function(){return _0x53fe28(_0xf913d7);});}catch(_0x10c675){fs[_0xeabc('0xf')](_0xf913d7);return _0x10fa8e(_0x10c675);}});});};exports['encryptString']=function(_0x457f27,_0x3854d2,_0x214953){var _0x319119=_0x214953||stringOptions['algorithm'];var _0x109e1d=_0x3854d2||stringOptions['secret'];var _0x27dbaf=crypto['createCipher'](_0x319119,_0x109e1d);var _0x811f0d=_0x27dbaf[_0xeabc('0xb')](_0x457f27,_0xeabc('0x14'),_0xeabc('0x15'));_0x811f0d+=_0x27dbaf[_0xeabc('0x12')](_0xeabc('0x15'));return _0x811f0d;};exports[_0xeabc('0x16')]=function(_0x4c2693,_0x5b2934,_0x459c8a){var _0x5bf8f2=_0x459c8a||stringOptions[_0xeabc('0x9')];var _0x2b342c=_0x5b2934||stringOptions['secret'];var _0x2163e6=crypto[_0xeabc('0x11')](_0x5bf8f2,_0x2b342c);var _0x2b568f=_0x2163e6[_0xeabc('0xb')](_0x4c2693,_0xeabc('0x15'),_0xeabc('0x14'));_0x2b568f+=_0x2163e6[_0xeabc('0x12')](_0xeabc('0x14'));return _0x2b568f;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index eff8ba0..f50572c 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 _0x6c76=['argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','analytics'];(function(_0x2340e2,_0x1627f9){var _0x5ced10=function(_0x3c5250){while(--_0x3c5250){_0x2340e2['push'](_0x2340e2['shift']());}};_0x5ced10(++_0x1627f9);}(_0x6c76,0x184));var _0x66c7=function(_0x2cc20d,_0x3a2f1b){_0x2cc20d=_0x2cc20d-0x0;var _0x1db55b=_0x6c76[_0x2cc20d];return _0x1db55b;};'use strict';var util=require(_0x66c7('0x0'));var path=require(_0x66c7('0x1'));var _=require(_0x66c7('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x66c7('0x3'));var zipdir=require(_0x66c7('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x66c7('0x5'))[_0x66c7('0x6')];var logger=require('../../config/logger')(_0x66c7('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x66c7('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x66c7('0x8')][0x4];function analyticExtractedReport(_0x4dffcd,_0x4fa6ce){var _0x208d06={'status':_0x4dffcd};var _0x2b0065={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4fa6ce){_0x208d06[_0x66c7('0x9')]=_0x4fa6ce;}return db['AnalyticExtractedReport'][_0x66c7('0xa')](_0x208d06,_0x2b0065);}function main(){var _0xbc35d9=0x1388;var _0xf44e2;logger[_0x66c7('0xb')](util['format'](_0x66c7('0xc'),EXTRACTED_REPORT_ID,_0x66c7('0xd')));return db[_0x66c7('0xe')][_0x66c7('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x66c7('0x10'),_0x66c7('0x11')]})[_0x66c7('0x12')](function(_0x5176a3){if(_0x5176a3){_0xf44e2=_0x5176a3;_0xbc35d9=_0xf44e2[_0x66c7('0x11')]||0x1388;}})[_0x66c7('0x12')](function(){return dbH[_0x66c7('0x13')][_0x66c7('0x14')](util[_0x66c7('0x15')](_0x66c7('0x16'),QUERY),{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')][_0x66c7('0x18')]});})['then'](function(_0x110f6d){if(!_0x110f6d[0x0]['num']){return analyticExtractedReport(_0x66c7('0x19'));}var _0x39f951=[];var _0x3c81c0=0x0;var _0x42e930=!![];if(_0x110f6d&&_0x110f6d[_0x66c7('0x1a')]){var _0x4e229a=_0x110f6d[0x0]['num']%(_0x3c81c0+_0xbc35d9);if(_0xf44e2['split']){for(;_0x42e930;_0x3c81c0+=_0xbc35d9,_0x4e229a=_0x110f6d[0x0]['num']%(_0x3c81c0+_0xbc35d9)){if(_0x4e229a==0x0||_0x4e229a==_0x110f6d[0x0][_0x66c7('0x1b')]){_0x42e930=![];}_0x39f951[_0x66c7('0x1c')](dbH['sequelize']['query'](util[_0x66c7('0x15')](_0x66c7('0x1d'),QUERY,_0xbc35d9,_0x3c81c0),{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')]['SELECT']}));}}else{_0x39f951['push'](dbH[_0x66c7('0x13')][_0x66c7('0x14')](QUERY,{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')][_0x66c7('0x18')]}));}}var _0x75f118=path['dirname'](PATH);var _0x4ddbd2=path[_0x66c7('0x1e')](PATH,'.csv');var _0x7462f1=_0xf44e2[_0x66c7('0x10')]&&_0x39f951[_0x66c7('0x1a')]>0x1;var _0x1fc9d3=[];if(!fs['existsSync'](path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2))&&_0x7462f1){fs[_0x66c7('0x20')](path['join'](_0x75f118,_0x4ddbd2));}return BPromise[_0x66c7('0x21')](_0x39f951,function(_0x11a6b9){_0x1fc9d3[_0x66c7('0x1c')](_0x11a6b9);})[_0x66c7('0x12')](function(){for(var _0x2af0a3=0x0;_0x2af0a3<_0x1fc9d3['length'];_0x2af0a3+=0x1){var _0x5bc4e6;var _0x4e514a=_0x1fc9d3[_0x2af0a3];if(_0x7462f1){_0x5bc4e6=path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2,util[_0x66c7('0x15')]('%s%d.%s',_0x4ddbd2,_0x2af0a3,_0x66c7('0x22')));}else{_0x5bc4e6=path[_0x66c7('0x1f')](_0x75f118,util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x66c7('0x22')));}fs[_0x66c7('0x24')](_0x5bc4e6,csv(_0x4e514a));}})['then'](function(){if(_0x7462f1){zipdir(path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2),{'saveTo':path[_0x66c7('0x1f')](_0x75f118,util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x66c7('0x25')))},function(_0x592f0e,_0x263b48){});rimraf(path['join'](_0x75f118,_0x4ddbd2),function(){});}})[_0x66c7('0x12')](function(){logger['info'](util[_0x66c7('0x15')](_0x66c7('0x26'),EXTRACTED_REPORT_ID,_0x66c7('0xd')));return analyticExtractedReport(_0x66c7('0x27'),_0x7462f1?util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x7462f1?'zip':'csv'):null);});})[_0x66c7('0x28')](function(_0x12e7c6){logger[_0x66c7('0xb')](util[_0x66c7('0x15')](_0x66c7('0x29'),EXTRACTED_REPORT_ID,_0x66c7('0xd')),util[_0x66c7('0x2a')](_0x12e7c6,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x66c7('0x2b'));});}main(); \ No newline at end of file +var _0x1be1=['mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','to-csv','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','query','num','length','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.csv'];(function(_0x2d967c,_0x433b3f){var _0x1ca79c=function(_0x23ae2b){while(--_0x23ae2b){_0x2d967c['push'](_0x2d967c['shift']());}};_0x1ca79c(++_0x433b3f);}(_0x1be1,0x192));var _0x11be=function(_0x4b8c45,_0xb7d463){_0x4b8c45=_0x4b8c45-0x0;var _0x2d480f=_0x1be1[_0x4b8c45];return _0x2d480f;};'use strict';var util=require('util');var path=require('path');var _=require(_0x11be('0x0'));var csv=require(_0x11be('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x11be('0x2'));var rimraf=require(_0x11be('0x3'));var db=require(_0x11be('0x4'))['db'];var dbH=require(_0x11be('0x4'))['dbH'];var logger=require(_0x11be('0x5'))(_0x11be('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x11be('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x11be('0x7')][0x4];function analyticExtractedReport(_0x497730,_0x18f661){var _0x11fc15={'status':_0x497730};var _0x246772={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x18f661){_0x11fc15[_0x11be('0x8')]=_0x18f661;}return db[_0x11be('0x9')]['update'](_0x11fc15,_0x246772);}function main(){var _0x2bf6db=0x1388;var _0x2754b8;logger['info'](util[_0x11be('0xa')](_0x11be('0xb'),EXTRACTED_REPORT_ID,_0x11be('0xc')));return db[_0x11be('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x11be('0xe'),_0x11be('0xf')]})[_0x11be('0x10')](function(_0x4b36c8){if(_0x4b36c8){_0x2754b8=_0x4b36c8;_0x2bf6db=_0x2754b8[_0x11be('0xf')]||0x1388;}})[_0x11be('0x10')](function(){return dbH['sequelize'][_0x11be('0x11')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})['then'](function(_0x588871){if(!_0x588871[0x0][_0x11be('0x12')]){return analyticExtractedReport('Empty');}var _0x31047c=[];var _0x241eec=0x0;var _0x27b004=!![];if(_0x588871&&_0x588871[_0x11be('0x13')]){var _0x547037=_0x588871[0x0][_0x11be('0x12')]%(_0x241eec+_0x2bf6db);if(_0x2754b8[_0x11be('0xe')]){for(;_0x27b004;_0x241eec+=_0x2bf6db,_0x547037=_0x588871[0x0]['num']%(_0x241eec+_0x2bf6db)){if(_0x547037==0x0||_0x547037==_0x588871[0x0][_0x11be('0x12')]){_0x27b004=![];}_0x31047c[_0x11be('0x14')](dbH[_0x11be('0x15')]['query'](util['format'](_0x11be('0x16'),QUERY,_0x2bf6db,_0x241eec),{'type':dbH[_0x11be('0x15')][_0x11be('0x17')][_0x11be('0x18')]}));}}else{_0x31047c['push'](dbH[_0x11be('0x15')][_0x11be('0x11')](QUERY,{'type':dbH[_0x11be('0x15')][_0x11be('0x17')][_0x11be('0x18')]}));}}var _0x3426ed=path[_0x11be('0x19')](PATH);var _0x17678d=path[_0x11be('0x1a')](PATH,_0x11be('0x1b'));var _0x5b62f6=_0x2754b8[_0x11be('0xe')]&&_0x31047c[_0x11be('0x13')]>0x1;var _0x2fe43c=[];if(!fs['existsSync'](path['join'](_0x3426ed,_0x17678d))&&_0x5b62f6){fs[_0x11be('0x1c')](path[_0x11be('0x1d')](_0x3426ed,_0x17678d));}return BPromise[_0x11be('0x1e')](_0x31047c,function(_0x4cb27f){_0x2fe43c[_0x11be('0x14')](_0x4cb27f);})['then'](function(){for(var _0x46111f=0x0;_0x46111f<_0x2fe43c['length'];_0x46111f+=0x1){var _0x28310d;var _0xb11f3d=_0x2fe43c[_0x46111f];if(_0x5b62f6){_0x28310d=path['join'](_0x3426ed,_0x17678d,util[_0x11be('0xa')](_0x11be('0x1f'),_0x17678d,_0x46111f,_0x11be('0x20')));}else{_0x28310d=path[_0x11be('0x1d')](_0x3426ed,util[_0x11be('0xa')](_0x11be('0x21'),_0x17678d,_0x11be('0x20')));}fs[_0x11be('0x22')](_0x28310d,csv(_0xb11f3d));}})[_0x11be('0x10')](function(){if(_0x5b62f6){zipdir(path['join'](_0x3426ed,_0x17678d),{'saveTo':path[_0x11be('0x1d')](_0x3426ed,util['format'](_0x11be('0x21'),_0x17678d,_0x11be('0x23')))},function(_0x510476,_0x584d4c){});rimraf(path[_0x11be('0x1d')](_0x3426ed,_0x17678d),function(){});}})[_0x11be('0x10')](function(){logger[_0x11be('0x24')](util[_0x11be('0xa')](_0x11be('0x25'),EXTRACTED_REPORT_ID,_0x11be('0xc')));return analyticExtractedReport(_0x11be('0x26'),_0x5b62f6?util[_0x11be('0xa')](_0x11be('0x21'),_0x17678d,_0x5b62f6?'zip':_0x11be('0x20')):null);});})[_0x11be('0x27')](function(_0x213bf1){logger[_0x11be('0x24')](util[_0x11be('0xa')](_0x11be('0x28'),EXTRACTED_REPORT_ID,'CSV'),util[_0x11be('0x29')](_0x213bf1,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x11be('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 8e359e3..2ab9c7b 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(_0x35aef1,_0x10d15f){var _0x4236cd=function(_0xd5781){while(--_0xd5781){_0x35aef1['push'](_0x35aef1['shift']());}};_0x4236cd(++_0x10d15f);}(_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 _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x533138,_0x4b88a2){var _0x2f23c3=function(_0x1e070e){while(--_0x1e070e){_0x533138['push'](_0x533138['shift']());}};_0x2f23c3(++_0x4b88a2);}(_0xb10b,0x12a));var _0xbb10=function(_0x42c069,_0xdfa0f9){_0x42c069=_0x42c069-0x0;var _0x4f0740=_0xb10b[_0x42c069];return _0x4f0740;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 5ef51e9..8043278 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 _0xc2b4=['format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','split','length','push','SELECT','dirname','.xlsx','existsSync','join','mkdirSync','xlsx','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','util','path','lodash','json2xls','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0xc2b4,0xc5));var _0x4c2b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc2b4[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x4c2b('0x0'));var path=require(_0x4c2b('0x1'));var _=require(_0x4c2b('0x2'));var fs=require('fs');var json2xls=require(_0x4c2b('0x3'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x4c2b('0x4'));var db=require(_0x4c2b('0x5'))['db'];var dbH=require(_0x4c2b('0x5'))['dbH'];var logger=require(_0x4c2b('0x6'))(_0x4c2b('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4c2b('0x8')][0x3];var PATH=process[_0x4c2b('0x8')][0x4];function analyticExtractedReport(_0x12c96e,_0xa5c76b){var _0x427f07={'status':_0x12c96e};var _0x9a40c8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa5c76b){_0x427f07[_0x4c2b('0x9')]=_0xa5c76b;}return db[_0x4c2b('0xa')][_0x4c2b('0xb')](_0x427f07,_0x9a40c8);}function main(){var _0x557445=0x1388;var _0x28ecd8;logger[_0x4c2b('0xc')](util[_0x4c2b('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4c2b('0xe')));return db[_0x4c2b('0xf')][_0x4c2b('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})['then'](function(_0x11cc06){if(_0x11cc06){_0x28ecd8=_0x11cc06;_0x557445=_0x28ecd8[_0x4c2b('0x11')]||0x1388;}})[_0x4c2b('0x12')](function(){return dbH[_0x4c2b('0x13')][_0x4c2b('0x14')](util[_0x4c2b('0xd')](_0x4c2b('0x15'),QUERY),{'type':dbH[_0x4c2b('0x13')][_0x4c2b('0x16')]['SELECT']});})['then'](function(_0x52a7bc){if(!_0x52a7bc[0x0][_0x4c2b('0x17')]){return analyticExtractedReport(_0x4c2b('0x18'));}var _0xbfa649=[];var _0x12c72d=0x0;var _0x153958=!![];if(_0x28ecd8[_0x4c2b('0x19')]){if(_0x52a7bc&&_0x52a7bc[_0x4c2b('0x1a')]){var _0x3dd7d3=_0x52a7bc[0x0][_0x4c2b('0x17')]%(_0x12c72d+_0x557445);for(;_0x153958;_0x12c72d+=_0x557445,_0x3dd7d3=_0x52a7bc[0x0]['num']%(_0x12c72d+_0x557445)){if(_0x3dd7d3==0x0||_0x3dd7d3==_0x52a7bc[0x0][_0x4c2b('0x17')]){_0x153958=![];}_0xbfa649[_0x4c2b('0x1b')](dbH[_0x4c2b('0x13')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x557445,_0x12c72d),{'type':dbH[_0x4c2b('0x13')][_0x4c2b('0x16')][_0x4c2b('0x1c')]}));}}}else{_0xbfa649[_0x4c2b('0x1b')](dbH[_0x4c2b('0x13')][_0x4c2b('0x14')](QUERY,{'type':dbH[_0x4c2b('0x13')]['QueryTypes']['SELECT']}));}var _0x2c72ec=path[_0x4c2b('0x1d')](PATH);var _0x305d84=path['basename'](PATH,_0x4c2b('0x1e'));var _0x21016a=_0x28ecd8['split']&&_0xbfa649[_0x4c2b('0x1a')]>0x1;var _0x3eb4fb=[];if(!fs[_0x4c2b('0x1f')](path[_0x4c2b('0x20')](_0x2c72ec,_0x305d84))&&_0x21016a){fs[_0x4c2b('0x21')](path[_0x4c2b('0x20')](_0x2c72ec,_0x305d84));}return BPromise['each'](_0xbfa649,function(_0x393428){_0x3eb4fb['push'](_0x393428);})[_0x4c2b('0x12')](function(){for(var _0x791e55=0x0;_0x791e55<_0x3eb4fb[_0x4c2b('0x1a')];_0x791e55+=0x1){var _0x2d3646;var _0x38773e=_0x3eb4fb[_0x791e55];if(_0x21016a){_0x2d3646=path[_0x4c2b('0x20')](_0x2c72ec,_0x305d84,util[_0x4c2b('0xd')]('%s%d.%s',_0x305d84,_0x791e55,_0x4c2b('0x22')));}else{_0x2d3646=path[_0x4c2b('0x20')](_0x2c72ec,util['format']('%s.%s',_0x305d84,_0x4c2b('0x22')));}fs[_0x4c2b('0x23')](_0x2d3646,json2xls(_0x38773e),'binary');}})[_0x4c2b('0x12')](function(){if(_0x21016a){zipdir(path['join'](_0x2c72ec,_0x305d84),{'saveTo':path[_0x4c2b('0x20')](_0x2c72ec,util['format'](_0x4c2b('0x24'),_0x305d84,_0x4c2b('0x25')))},function(_0x37b7b4,_0x46bc2d){});rimraf(path['join'](_0x2c72ec,_0x305d84),function(){});}})[_0x4c2b('0x12')](function(){logger[_0x4c2b('0xc')](util[_0x4c2b('0xd')](_0x4c2b('0x26'),EXTRACTED_REPORT_ID,_0x4c2b('0xe')));return analyticExtractedReport(_0x4c2b('0x27'),_0x21016a?util[_0x4c2b('0xd')]('%s.%s',_0x305d84,_0x21016a?_0x4c2b('0x25'):_0x4c2b('0x22')):null);});})[_0x4c2b('0x28')](function(_0x35c20a){logger['info'](util[_0x4c2b('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x35c20a,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x4c2b('0x29'));});}main(); \ No newline at end of file +var _0x59f9=['bluebird','rimraf','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','split','push','sequelize','SELECT','basename','.xlsx','mkdirSync','each','length','join','xlsx','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','inspect','Failed','util','path','lodash','json2xls'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x59f9,0x1ea));var _0x959f=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x59f9[_0x49b207];return _0x2dc8fa;};'use strict';var util=require(_0x959f('0x0'));var path=require(_0x959f('0x1'));var _=require(_0x959f('0x2'));var fs=require('fs');var json2xls=require(_0x959f('0x3'));var BPromise=require(_0x959f('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x959f('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x959f('0x6')];var logger=require(_0x959f('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x959f('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x200f23,_0x17f705){var _0x10245d={'status':_0x200f23};var _0x4fd44a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x17f705){_0x10245d['savename']=_0x17f705;}return db[_0x959f('0x9')][_0x959f('0xa')](_0x10245d,_0x4fd44a);}function main(){var _0x27be8a=0x1388;var _0x2d9d39;logger[_0x959f('0xb')](util[_0x959f('0xc')](_0x959f('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x959f('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0x959f('0xf')](function(_0x621f31){if(_0x621f31){_0x2d9d39=_0x621f31;_0x27be8a=_0x2d9d39['splitSizeXlsx']||0x1388;}})[_0x959f('0xf')](function(){return dbH['sequelize'][_0x959f('0x10')](util['format'](_0x959f('0x11'),QUERY),{'type':dbH['sequelize'][_0x959f('0x12')]['SELECT']});})['then'](function(_0x3dfe89){if(!_0x3dfe89[0x0][_0x959f('0x13')]){return analyticExtractedReport(_0x959f('0x14'));}var _0x2a0063=[];var _0x591894=0x0;var _0x13576d=!![];if(_0x2d9d39[_0x959f('0x15')]){if(_0x3dfe89&&_0x3dfe89['length']){var _0x5f518d=_0x3dfe89[0x0][_0x959f('0x13')]%(_0x591894+_0x27be8a);for(;_0x13576d;_0x591894+=_0x27be8a,_0x5f518d=_0x3dfe89[0x0][_0x959f('0x13')]%(_0x591894+_0x27be8a)){if(_0x5f518d==0x0||_0x5f518d==_0x3dfe89[0x0][_0x959f('0x13')]){_0x13576d=![];}_0x2a0063[_0x959f('0x16')](dbH['sequelize'][_0x959f('0x10')](util[_0x959f('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x27be8a,_0x591894),{'type':dbH[_0x959f('0x17')][_0x959f('0x12')][_0x959f('0x18')]}));}}}else{_0x2a0063[_0x959f('0x16')](dbH[_0x959f('0x17')][_0x959f('0x10')](QUERY,{'type':dbH['sequelize'][_0x959f('0x12')]['SELECT']}));}var _0x5bc2f5=path['dirname'](PATH);var _0x4ef857=path[_0x959f('0x19')](PATH,_0x959f('0x1a'));var _0x34fedd=_0x2d9d39[_0x959f('0x15')]&&_0x2a0063['length']>0x1;var _0x14cbb5=[];if(!fs['existsSync'](path['join'](_0x5bc2f5,_0x4ef857))&&_0x34fedd){fs[_0x959f('0x1b')](path['join'](_0x5bc2f5,_0x4ef857));}return BPromise[_0x959f('0x1c')](_0x2a0063,function(_0x91a389){_0x14cbb5[_0x959f('0x16')](_0x91a389);})[_0x959f('0xf')](function(){for(var _0x54c623=0x0;_0x54c623<_0x14cbb5[_0x959f('0x1d')];_0x54c623+=0x1){var _0x7df873;var _0x3dcc77=_0x14cbb5[_0x54c623];if(_0x34fedd){_0x7df873=path[_0x959f('0x1e')](_0x5bc2f5,_0x4ef857,util['format']('%s%d.%s',_0x4ef857,_0x54c623,_0x959f('0x1f')));}else{_0x7df873=path[_0x959f('0x1e')](_0x5bc2f5,util[_0x959f('0xc')](_0x959f('0x20'),_0x4ef857,'xlsx'));}fs[_0x959f('0x21')](_0x7df873,json2xls(_0x3dcc77),'binary');}})[_0x959f('0xf')](function(){if(_0x34fedd){zipdir(path[_0x959f('0x1e')](_0x5bc2f5,_0x4ef857),{'saveTo':path[_0x959f('0x1e')](_0x5bc2f5,util[_0x959f('0xc')](_0x959f('0x20'),_0x4ef857,'zip'))},function(_0x112cb4,_0x12d582){});rimraf(path['join'](_0x5bc2f5,_0x4ef857),function(){});}})['then'](function(){logger[_0x959f('0xb')](util[_0x959f('0xc')](_0x959f('0x22'),EXTRACTED_REPORT_ID,_0x959f('0x23')));return analyticExtractedReport('Completed',_0x34fedd?util[_0x959f('0xc')]('%s.%s',_0x4ef857,_0x34fedd?'zip':_0x959f('0x1f')):null);});})['catch'](function(_0x2df540){logger['info'](util[_0x959f('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x959f('0x24')](_0x2df540,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x959f('0x25'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7ce165a..91c6377 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 _0x50c1=['context','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','tag','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','error','rewrite','lodash','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','CDR(type)=%s','VoiceExtensionId','type','CDR(destination)=','cutdigits','${EXTEN:'];(function(_0x243d52,_0x2d5634){var _0xbbf923=function(_0x1a9466){while(--_0x1a9466){_0x243d52['push'](_0x243d52['shift']());}};_0xbbf923(++_0x2d5634);}(_0x50c1,0x1a5));var _0x150c=function(_0x31db51,_0x2958a7){_0x31db51=_0x31db51-0x0;var _0x58d60d=_0x50c1[_0x31db51];return _0x58d60d;};'use strict';var _=require(_0x150c('0x0'));var util=require('util');function rewrite(_0x47d48d,_0x33d11f){var _0x292ace=this;return _0x47d48d[_0x150c('0x1')][_0x150c('0x2')][_0x150c('0x3')]({'raw':!![]})[_0x150c('0x4')](function(_0x37cd57){_0x292ace[_0x150c('0x5')]=_0x37cd57;return _0x47d48d[_0x150c('0x1')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x33d11f[_0x150c('0x6')]},'raw':!![]});})['then'](function(_0x5b10b4){return _0x47d48d[_0x150c('0x1')][_0x150c('0x7')][_0x150c('0x3')]({'where':{'exten':{'$in':_[_0x150c('0x8')](_[_0x150c('0x9')](_0x5b10b4,_0x150c('0xa')))}},'order':[{'raw':_0x150c('0xb')}],'raw':!![]});})[_0x150c('0x4')](function(_0x29ae40){var _0x2fc78e=_['filter'](_0x29ae40,{'priority':'1'});var _0xa0cbab=_[_0x150c('0xc')](_0x29ae40,{'isApp':0x1});var _0x194f58=_['groupBy'](_0xa0cbab,_0x150c('0xa'));var _0x4e2f73=['queue',_0x150c('0xd')];var _0x1d2ec7=[];var _0x1c7670=[];for(var _0x2971fc in _0x194f58){if(_0x194f58[_0x150c('0xe')](_0x2971fc)){_0x292ace[_0x150c('0xf')]=0x2;_0x292ace[_0x150c('0x10')]=[];_0x292ace[_0x150c('0x11')]=_[_0x150c('0x12')](_0x2fc78e,{'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')]});_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0]['type'],'app':_0x150c('0x14'),'appdata':util['format'](_0x150c('0x15'),_0x194f58[_0x2971fc][0x0]['type']),'context':_0x194f58[_0x2971fc][0x0]['context'],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});if(_0x194f58[_0x2971fc][0x0][_0x150c('0x17')]==='outbound'){if(_0x292ace[_0x150c('0x11')]){_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':_0x150c('0x18')+(_0x292ace['extension'][_0x150c('0x19')]?_0x150c('0x1a')+_0x292ace['extension'][_0x150c('0x19')]+'}':'${EXTEN}'),'context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});}_0x292ace[_0x150c('0x10')]['push']({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':_0x150c('0x1c')+_0x194f58[_0x2971fc][0x0][_0x150c('0x16')],'context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});var _0x3b1ce6=_0x292ace['priority']++;_0x292ace['extensions'][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3b1ce6+0x2)+'):Goto('+(_0x3b1ce6+0x1)+')','context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x3b1ce6,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});if(_0x292ace[_0x150c('0x11')]){_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':'Set','appdata':_0x292ace['extension'][_0x150c('0x19')]?_0x150c('0x1e')+_0x292ace[_0x150c('0x11')][_0x150c('0x19')]+'}':'CDR(prefix)=noprefix','context':_0x194f58[_0x2971fc][0x0]['context'],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});}_0x292ace['extensions'][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0]['type'],'app':_0x150c('0x14'),'appdata':_0x150c('0x1f')+_0x194f58[_0x2971fc][0x0][_0x150c('0x16')],'context':_0x194f58[_0x2971fc][0x0]['context'],'exten':_0x194f58[_0x2971fc][0x0]['exten'],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0]['VoiceExtensionId']});if(_0x292ace[_0x150c('0x11')]&&_0x292ace[_0x150c('0x11')][_0x150c('0xe')](_0x150c('0x20'))&&_0x292ace[_0x150c('0x11')][_0x150c('0x20')]!==_0x150c('0x21')){_0x292ace['extensions'][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':'Set','appdata':_0x150c('0x22'),'context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace['priority']++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0]['type'],'app':_0x150c('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x292ace['extension'][_0x150c('0x20')]||'wav','context':_0x194f58[_0x2971fc][0x0]['context'],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});}}_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0]['VoiceExtensionId']});_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':_0x150c('0x23'),'context':_0x194f58[_0x2971fc][0x0]['context'],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});_0x292ace['extensions'][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':_0x150c('0x24'),'context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0]['VoiceExtensionId']});for(var _0x510ab6=0x0,_0x55e78c=0x0;_0x510ab6<_0x194f58[_0x2971fc][_0x150c('0x25')];_0x510ab6+=0x1,_0x55e78c=0x0){var _0x14aab3=_0x194f58[_0x2971fc][_0x510ab6];if(_0x14aab3[_0x150c('0x17')]){_0x14aab3[_0x150c('0x17')]=_0x14aab3[_0x150c('0x17')][_0x150c('0x26')]();}var _0x4f86bb=[];var _0x3f7a57=[];delete _0x14aab3['id'];delete _0x14aab3['createdAt'];delete _0x14aab3[_0x150c('0x27')];var _0x16bc55=_0x14aab3[_0x150c('0x28')]!==_0x150c('0x29')?[_0x14aab3[_0x150c('0x28')]]:_0x14aab3[_0x150c('0x6')]?_[_0x150c('0x9')](_[_0x150c('0xc')](_0x292ace[_0x150c('0x5')],{'IntervalId':_0x14aab3[_0x150c('0x6')]}),'interval'):[];if(_0x14aab3['hasOwnProperty']('tag')){if(_0x14aab3['tag']&&_0x14aab3['tag']!=='--'){_0x4f86bb[_0x150c('0x13')]({'type':_0x14aab3[_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':'CDR(tag)='+_0x14aab3[_0x150c('0x2a')],'context':_0x14aab3['context'],'exten':_0x14aab3[_0x150c('0xa')],'priority':_0x16bc55[_0x150c('0x25')]+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3[_0x150c('0x16')]});}}if(_0x14aab3[_0x150c('0x17')]===_0x150c('0x2b')&&_0x14aab3[_0x150c('0xe')](_0x150c('0x2c'))){if(_0x14aab3[_0x150c('0x2c')]){_0x4f86bb[_0x150c('0x13')]({'type':_0x14aab3[_0x150c('0x17')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x14aab3['callerID']+')','context':_0x14aab3[_0x150c('0x1b')],'exten':_0x14aab3[_0x150c('0xa')],'priority':_0x16bc55[_0x150c('0x25')]+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3[_0x150c('0x16')]});}else{_0x4f86bb[_0x150c('0x13')]({'type':_0x14aab3[_0x150c('0x17')],'app':_0x150c('0x1d'),'appdata':_0x150c('0x2d'),'context':_0x14aab3['context'],'exten':_0x14aab3[_0x150c('0xa')],'priority':_0x16bc55['length']+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3['VoiceExtensionId']});}}if(_0x14aab3[_0x150c('0xe')](_0x150c('0x2e'))){if(_0x4e2f73[_0x150c('0x2f')](_0x14aab3[_0x150c('0x30')]['toLowerCase']())>=0x0&&_0x14aab3[_0x150c('0x31')]!==_0x150c('0x32')){if(_0x14aab3[_0x150c('0x2e')]){_0x4f86bb[_0x150c('0x13')]({'type':_0x14aab3[_0x150c('0x17')],'app':_0x150c('0x1d'),'appdata':_0x150c('0x33'),'context':_0x14aab3[_0x150c('0x1b')],'exten':_0x14aab3[_0x150c('0xa')],'priority':_0x16bc55[_0x150c('0x25')]+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3[_0x150c('0x16')]});_0x4f86bb[_0x150c('0x13')]({'type':_0x14aab3['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x14aab3[_0x150c('0x1b')],'exten':_0x14aab3[_0x150c('0xa')],'priority':_0x16bc55['length']+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3[_0x150c('0x16')]});}else{_0x4f86bb['push']({'type':_0x14aab3[_0x150c('0x17')],'app':_0x150c('0x1d'),'appdata':_0x150c('0x34'),'context':_0x14aab3['context'],'exten':_0x14aab3[_0x150c('0xa')],'priority':_0x16bc55[_0x150c('0x25')]+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3[_0x150c('0x16')]});_0x4f86bb[_0x150c('0x13')]({'type':_0x14aab3[_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':_0x150c('0x35'),'context':_0x14aab3[_0x150c('0x1b')],'exten':_0x14aab3['exten'],'priority':_0x16bc55[_0x150c('0x25')]+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3[_0x150c('0x16')]});}}}for(var _0x2b89ee=0x0;_0x2b89ee<_0x16bc55[_0x150c('0x25')];_0x2b89ee+=0x1){var _0x22ade2=_0x292ace[_0x150c('0xf')]+_0x16bc55[_0x150c('0x25')];var _0x1cb0c8=_0x2b89ee===_0x16bc55[_0x150c('0x25')]-0x1?_0x292ace[_0x150c('0xf')]+_0x4f86bb[_0x150c('0x25')]+_0x3f7a57['length']+0x2:_0x292ace[_0x150c('0xf')]+_0x2b89ee+0x1;_0x4f86bb[_0x150c('0x36')](_0x2b89ee,0x0,{'type':_0x14aab3[_0x150c('0x17')],'app':'GotoIfTime','appdata':_0x16bc55[_0x2b89ee]+'?'+_0x14aab3[_0x150c('0x1b')]+_0x150c('0x37')+_0x22ade2+':'+_0x14aab3[_0x150c('0x1b')]+',${EXTEN},'+_0x1cb0c8,'exten':_0x14aab3[_0x150c('0xa')],'context':_0x14aab3[_0x150c('0x1b')],'priority':_0x292ace['priority']+_0x2b89ee,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});}_0x14aab3[_0x150c('0xf')]=_0x4f86bb['length']?_[_0x150c('0x38')](_0x4f86bb)[_0x150c('0xf')]+0x1:_0x292ace[_0x150c('0xf')];_0x292ace[_0x150c('0xf')]=(_0x3f7a57[_0x150c('0x25')]?_[_0x150c('0x38')](_0x3f7a57)[_0x150c('0xf')]:_0x14aab3['priority'])+0x1;_0x292ace[_0x150c('0x10')]=_[_0x150c('0x39')](_0x292ace['extensions'],_0x4f86bb,[_0x14aab3],_0x3f7a57);}_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x3a'),'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'priority':_0x292ace[_0x150c('0xf')],'VoiceExtensionId':_0x194f58[_0x2971fc][0x0]['VoiceExtensionId']});_0x1d2ec7[_0x150c('0x13')](_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]);_0x1c7670=_[_0x150c('0x39')](_0x1c7670,_0x292ace[_0x150c('0x10')]);}}return _0x47d48d[_0x150c('0x3b')](function(_0x3ec441){return _0x47d48d[_0x150c('0x1')][_0x150c('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x1d2ec7}},'transaction':_0x3ec441})[_0x150c('0x4')](function(_0x5836ff){return _0x47d48d['models'][_0x150c('0x7')][_0x150c('0x3c')](_[_0x150c('0x3d')](_0x1c7670,'priority'),{'transaction':_0x3ec441});});});})['catch'](function(_0x46fdc9){console[_0x150c('0x3e')](_0x46fdc9);});}exports[_0x150c('0x3f')]=rewrite; \ No newline at end of file +var _0xa74b=['${EXTEN:','cutdigits','${EXTEN}','push','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','updatedAt','interval','*,*,*,*','intervals','tag','outbound','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','$[${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-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','lodash','util','Interval','then','models','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extension','find','extensions','Set','CDR(type)=%s','type','context','VoiceExtensionId','CDR(destination)='];(function(_0x54f732,_0x235d0b){var _0x4f60a4=function(_0x27b92c){while(--_0x27b92c){_0x54f732['push'](_0x54f732['shift']());}};_0x4f60a4(++_0x235d0b);}(_0xa74b,0x140));var _0xba74=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa74b[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xba74('0x0'));var util=require(_0xba74('0x1'));function rewrite(_0x4d584e,_0x4d032d){var _0x590c52=this;return _0x4d584e['models'][_0xba74('0x2')]['findAll']({'raw':!![]})[_0xba74('0x3')](function(_0x6b6b00){_0x590c52['intervals']=_0x6b6b00;return _0x4d584e[_0xba74('0x4')][_0xba74('0x5')][_0xba74('0x6')]({'where':{'IntervalId':_0x4d032d[_0xba74('0x7')]},'raw':!![]});})[_0xba74('0x3')](function(_0x38b2fe){return _0x4d584e[_0xba74('0x4')][_0xba74('0x5')][_0xba74('0x6')]({'where':{'exten':{'$in':_[_0xba74('0x8')](_[_0xba74('0x9')](_0x38b2fe,_0xba74('0xa')))}},'order':[{'raw':_0xba74('0xb')}],'raw':!![]});})[_0xba74('0x3')](function(_0x1a45a7){var _0xd20e64=_[_0xba74('0xc')](_0x1a45a7,{'priority':'1'});var _0x5c56a3=_['filter'](_0x1a45a7,{'isApp':0x1});var _0xa37492=_['groupBy'](_0x5c56a3,_0xba74('0xa'));var _0x359b2d=['queue',_0xba74('0xd')];var _0x360ca0=[];var _0x46a8b8=[];for(var _0x3353d5 in _0xa37492){if(_0xa37492[_0xba74('0xe')](_0x3353d5)){_0x590c52[_0xba74('0xf')]=0x2;_0x590c52['extensions']=[];_0x590c52[_0xba74('0x10')]=_[_0xba74('0x11')](_0xd20e64,{'exten':_0xa37492[_0x3353d5][0x0][_0xba74('0xa')]});_0x590c52[_0xba74('0x12')]['push']({'type':_0xa37492[_0x3353d5][0x0]['type'],'app':_0xba74('0x13'),'appdata':util['format'](_0xba74('0x14'),_0xa37492[_0x3353d5][0x0][_0xba74('0x15')]),'context':_0xa37492[_0x3353d5][0x0][_0xba74('0x16')],'exten':_0xa37492[_0x3353d5][0x0][_0xba74('0xa')],'priority':_0x590c52['priority']++,'VoiceExtensionId':_0xa37492[_0x3353d5][0x0][_0xba74('0x17')]});if(_0xa37492[_0x3353d5][0x0]['type']==='outbound'){if(_0x590c52[_0xba74('0x10')]){_0x590c52[_0xba74('0x12')]['push']({'type':_0xa37492[_0x3353d5][0x0][_0xba74('0x15')],'app':_0xba74('0x13'),'appdata':_0xba74('0x18')+(_0x590c52[_0xba74('0x10')]['cutdigits']?_0xba74('0x19')+_0x590c52[_0xba74('0x10')][_0xba74('0x1a')]+'}':_0xba74('0x1b')),'context':_0xa37492[_0x3353d5][0x0][_0xba74('0x16')],'exten':_0xa37492[_0x3353d5][0x0][_0xba74('0xa')],'priority':_0x590c52[_0xba74('0xf')]++,'VoiceExtensionId':_0xa37492[_0x3353d5][0x0][_0xba74('0x17')]});}_0x590c52[_0xba74('0x12')][_0xba74('0x1c')]({'type':_0xa37492[_0x3353d5][0x0]['type'],'app':_0xba74('0x13'),'appdata':_0xba74('0x1d')+_0xa37492[_0x3353d5][0x0][_0xba74('0x17')],'context':_0xa37492[_0x3353d5][0x0][_0xba74('0x16')],'exten':_0xa37492[_0x3353d5][0x0][_0xba74('0xa')],'priority':_0x590c52[_0xba74('0xf')]++,'VoiceExtensionId':_0xa37492[_0x3353d5][0x0][_0xba74('0x17')]});var _0x2cb225=_0x590c52[_0xba74('0xf')]++;_0x590c52[_0xba74('0x12')][_0xba74('0x1c')]({'type':_0xa37492[_0x3353d5][0x0]['type'],'app':_0xba74('0x1e'),'appdata':_0xba74('0x1f')+(_0x2cb225+0x2)+_0xba74('0x20')+(_0x2cb225+0x1)+')','context':_0xa37492[_0x3353d5][0x0][_0xba74('0x16')],'exten':_0xa37492[_0x3353d5][0x0]['exten'],'priority':_0x2cb225,'VoiceExtensionId':_0xa37492[_0x3353d5][0x0][_0xba74('0x17')]});if(_0x590c52['extension']){_0x590c52[_0xba74('0x12')][_0xba74('0x1c')]({'type':_0xa37492[_0x3353d5][0x0][_0xba74('0x15')],'app':_0xba74('0x13'),'appdata':_0x590c52[_0xba74('0x10')][_0xba74('0x1a')]?_0xba74('0x21')+_0x590c52['extension'][_0xba74('0x1a')]+'}':_0xba74('0x22'),'context':_0xa37492[_0x3353d5][0x0][_0xba74('0x16')],'exten':_0xa37492[_0x3353d5][0x0]['exten'],'priority':_0x590c52[_0xba74('0xf')]++,'VoiceExtensionId':_0xa37492[_0x3353d5][0x0][_0xba74('0x17')]});}_0x590c52['extensions'][_0xba74('0x1c')]({'type':_0xa37492[_0x3353d5][0x0]['type'],'app':_0xba74('0x13'),'appdata':_0xba74('0x23')+_0xa37492[_0x3353d5][0x0][_0xba74('0x17')],'context':_0xa37492[_0x3353d5][0x0][_0xba74('0x16')],'exten':_0xa37492[_0x3353d5][0x0][_0xba74('0xa')],'priority':_0x590c52[_0xba74('0xf')]++,'VoiceExtensionId':_0xa37492[_0x3353d5][0x0]['VoiceExtensionId']});if(_0x590c52[_0xba74('0x10')]&&_0x590c52[_0xba74('0x10')]['hasOwnProperty'](_0xba74('0x24'))&&_0x590c52['extension'][_0xba74('0x24')]!=='none'){_0x590c52[_0xba74('0x12')][_0xba74('0x1c')]({'type':_0xa37492[_0x3353d5][0x0][_0xba74('0x15')],'app':_0xba74('0x13'),'appdata':_0xba74('0x25'),'context':_0xa37492[_0x3353d5][0x0][_0xba74('0x16')],'exten':_0xa37492[_0x3353d5][0x0]['exten'],'priority':_0x590c52[_0xba74('0xf')]++,'VoiceExtensionId':_0xa37492[_0x3353d5][0x0][_0xba74('0x17')]});_0x590c52['extensions']['push']({'type':_0xa37492[_0x3353d5][0x0][_0xba74('0x15')],'app':'Set','appdata':_0xba74('0x26')+_0x590c52['extension'][_0xba74('0x24')]||'wav','context':_0xa37492[_0x3353d5][0x0][_0xba74('0x16')],'exten':_0xa37492[_0x3353d5][0x0][_0xba74('0xa')],'priority':_0x590c52[_0xba74('0xf')]++,'VoiceExtensionId':_0xa37492[_0x3353d5][0x0][_0xba74('0x17')]});}}_0x590c52[_0xba74('0x12')]['push']({'type':_0xa37492[_0x3353d5][0x0][_0xba74('0x15')],'app':_0xba74('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xa37492[_0x3353d5][0x0][_0xba74('0x16')],'exten':_0xa37492[_0x3353d5][0x0]['exten'],'priority':_0x590c52['priority']++,'VoiceExtensionId':_0xa37492[_0x3353d5][0x0][_0xba74('0x17')]});_0x590c52[_0xba74('0x12')][_0xba74('0x1c')]({'type':_0xa37492[_0x3353d5][0x0]['type'],'app':'Set','appdata':_0xba74('0x27'),'context':_0xa37492[_0x3353d5][0x0][_0xba74('0x16')],'exten':_0xa37492[_0x3353d5][0x0]['exten'],'priority':_0x590c52[_0xba74('0xf')]++,'VoiceExtensionId':_0xa37492[_0x3353d5][0x0]['VoiceExtensionId']});_0x590c52['extensions'][_0xba74('0x1c')]({'type':_0xa37492[_0x3353d5][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0xa37492[_0x3353d5][0x0][_0xba74('0x16')],'exten':_0xa37492[_0x3353d5][0x0][_0xba74('0xa')],'priority':_0x590c52[_0xba74('0xf')]++,'VoiceExtensionId':_0xa37492[_0x3353d5][0x0][_0xba74('0x17')]});for(var _0x1acfe6=0x0,_0x5026e3=0x0;_0x1acfe6<_0xa37492[_0x3353d5][_0xba74('0x28')];_0x1acfe6+=0x1,_0x5026e3=0x0){var _0x4f2ab1=_0xa37492[_0x3353d5][_0x1acfe6];if(_0x4f2ab1[_0xba74('0x15')]){_0x4f2ab1[_0xba74('0x15')]=_0x4f2ab1[_0xba74('0x15')][_0xba74('0x29')]();}var _0x58670c=[];var _0x1b76e9=[];delete _0x4f2ab1['id'];delete _0x4f2ab1['createdAt'];delete _0x4f2ab1[_0xba74('0x2a')];var _0x158a15=_0x4f2ab1[_0xba74('0x2b')]!==_0xba74('0x2c')?[_0x4f2ab1['interval']]:_0x4f2ab1[_0xba74('0x7')]?_[_0xba74('0x9')](_['filter'](_0x590c52[_0xba74('0x2d')],{'IntervalId':_0x4f2ab1['IntervalId']}),'interval'):[];if(_0x4f2ab1[_0xba74('0xe')](_0xba74('0x2e'))){if(_0x4f2ab1[_0xba74('0x2e')]&&_0x4f2ab1['tag']!=='--'){_0x58670c['push']({'type':_0x4f2ab1[_0xba74('0x15')],'app':'Set','appdata':'CDR(tag)='+_0x4f2ab1['tag'],'context':_0x4f2ab1[_0xba74('0x16')],'exten':_0x4f2ab1[_0xba74('0xa')],'priority':_0x158a15[_0xba74('0x28')]+_0x590c52['priority']+_0x5026e3++,'VoiceExtensionId':_0x4f2ab1[_0xba74('0x17')]});}}if(_0x4f2ab1[_0xba74('0x15')]===_0xba74('0x2f')&&_0x4f2ab1[_0xba74('0xe')]('callerID')){if(_0x4f2ab1['callerID']){_0x58670c[_0xba74('0x1c')]({'type':_0x4f2ab1['type'],'app':_0xba74('0x1e'),'appdata':_0xba74('0x30')+_0x4f2ab1[_0xba74('0x31')]+')','context':_0x4f2ab1[_0xba74('0x16')],'exten':_0x4f2ab1[_0xba74('0xa')],'priority':_0x158a15[_0xba74('0x28')]+_0x590c52[_0xba74('0xf')]+_0x5026e3++,'VoiceExtensionId':_0x4f2ab1[_0xba74('0x17')]});}else{_0x58670c[_0xba74('0x1c')]({'type':_0x4f2ab1[_0xba74('0x15')],'app':_0xba74('0x1e'),'appdata':_0xba74('0x32'),'context':_0x4f2ab1[_0xba74('0x16')],'exten':_0x4f2ab1[_0xba74('0xa')],'priority':_0x158a15[_0xba74('0x28')]+_0x590c52[_0xba74('0xf')]+_0x5026e3++,'VoiceExtensionId':_0x4f2ab1['VoiceExtensionId']});}}if(_0x4f2ab1[_0xba74('0xe')](_0xba74('0x33'))){if(_0x359b2d['indexOf'](_0x4f2ab1[_0xba74('0x34')][_0xba74('0x29')]())>=0x0&&_0x4f2ab1[_0xba74('0x35')]!==_0xba74('0x36')){if(_0x4f2ab1[_0xba74('0x33')]){_0x58670c['push']({'type':_0x4f2ab1['type'],'app':_0xba74('0x1e'),'appdata':_0xba74('0x37'),'context':_0x4f2ab1[_0xba74('0x16')],'exten':_0x4f2ab1['exten'],'priority':_0x158a15['length']+_0x590c52[_0xba74('0xf')]+_0x5026e3++,'VoiceExtensionId':_0x4f2ab1[_0xba74('0x17')]});_0x58670c[_0xba74('0x1c')]({'type':_0x4f2ab1[_0xba74('0x15')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4f2ab1[_0xba74('0x16')],'exten':_0x4f2ab1['exten'],'priority':_0x158a15[_0xba74('0x28')]+_0x590c52[_0xba74('0xf')]+_0x5026e3++,'VoiceExtensionId':_0x4f2ab1[_0xba74('0x17')]});}else{_0x58670c[_0xba74('0x1c')]({'type':_0x4f2ab1[_0xba74('0x15')],'app':_0xba74('0x1e'),'appdata':_0xba74('0x38'),'context':_0x4f2ab1[_0xba74('0x16')],'exten':_0x4f2ab1[_0xba74('0xa')],'priority':_0x158a15[_0xba74('0x28')]+_0x590c52[_0xba74('0xf')]+_0x5026e3++,'VoiceExtensionId':_0x4f2ab1[_0xba74('0x17')]});_0x58670c[_0xba74('0x1c')]({'type':_0x4f2ab1[_0xba74('0x15')],'app':'Set','appdata':_0xba74('0x39'),'context':_0x4f2ab1[_0xba74('0x16')],'exten':_0x4f2ab1[_0xba74('0xa')],'priority':_0x158a15[_0xba74('0x28')]+_0x590c52[_0xba74('0xf')]+_0x5026e3++,'VoiceExtensionId':_0x4f2ab1[_0xba74('0x17')]});}}}for(var _0xb3d14e=0x0;_0xb3d14e<_0x158a15[_0xba74('0x28')];_0xb3d14e+=0x1){var _0xee142c=_0x590c52[_0xba74('0xf')]+_0x158a15[_0xba74('0x28')];var _0x4731a8=_0xb3d14e===_0x158a15['length']-0x1?_0x590c52[_0xba74('0xf')]+_0x58670c[_0xba74('0x28')]+_0x1b76e9['length']+0x2:_0x590c52[_0xba74('0xf')]+_0xb3d14e+0x1;_0x58670c[_0xba74('0x3a')](_0xb3d14e,0x0,{'type':_0x4f2ab1['type'],'app':'GotoIfTime','appdata':_0x158a15[_0xb3d14e]+'?'+_0x4f2ab1[_0xba74('0x16')]+',${EXTEN},'+_0xee142c+':'+_0x4f2ab1['context']+_0xba74('0x3b')+_0x4731a8,'exten':_0x4f2ab1[_0xba74('0xa')],'context':_0x4f2ab1[_0xba74('0x16')],'priority':_0x590c52[_0xba74('0xf')]+_0xb3d14e,'VoiceExtensionId':_0xa37492[_0x3353d5][0x0][_0xba74('0x17')]});}_0x4f2ab1[_0xba74('0xf')]=_0x58670c[_0xba74('0x28')]?_[_0xba74('0x3c')](_0x58670c)['priority']+0x1:_0x590c52[_0xba74('0xf')];_0x590c52[_0xba74('0xf')]=(_0x1b76e9[_0xba74('0x28')]?_[_0xba74('0x3c')](_0x1b76e9)['priority']:_0x4f2ab1[_0xba74('0xf')])+0x1;_0x590c52[_0xba74('0x12')]=_[_0xba74('0x3d')](_0x590c52[_0xba74('0x12')],_0x58670c,[_0x4f2ab1],_0x1b76e9);}_0x590c52['extensions'][_0xba74('0x1c')]({'type':_0xa37492[_0x3353d5][0x0]['type'],'app':_0xba74('0x3e'),'exten':_0xa37492[_0x3353d5][0x0][_0xba74('0xa')],'context':_0xa37492[_0x3353d5][0x0]['context'],'priority':_0x590c52['priority'],'VoiceExtensionId':_0xa37492[_0x3353d5][0x0][_0xba74('0x17')]});_0x360ca0[_0xba74('0x1c')](_0xa37492[_0x3353d5][0x0][_0xba74('0x17')]);_0x46a8b8=_[_0xba74('0x3d')](_0x46a8b8,_0x590c52[_0xba74('0x12')]);}}return _0x4d584e[_0xba74('0x3f')](function(_0x3ac26b){return _0x4d584e['models'][_0xba74('0x5')][_0xba74('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x360ca0}},'transaction':_0x3ac26b})[_0xba74('0x3')](function(_0x293b1e){return _0x4d584e['models'][_0xba74('0x5')]['bulkCreate'](_[_0xba74('0x41')](_0x46a8b8,_0xba74('0xf')),{'transaction':_0x3ac26b});});});})[_0xba74('0x42')](function(_0x4ede41){console[_0xba74('0x43')](_0x4ede41);});}exports[_0xba74('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index d2fb63b..9455bdf 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 _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x2f84bd,_0x428332){var _0xb5d99=function(_0x26157e){while(--_0x26157e){_0x2f84bd['push'](_0x2f84bd['shift']());}};_0xb5d99(++_0x428332);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);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(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){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'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file +var _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xb7e7[_0x710815];return _0x5b3b89;};'use strict';var BPromise=require(_0x7b7e('0x0'));var util=require('util');var _=require(_0x7b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b7e('0x2'));var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));config[_0x7b7e('0x6')]=_['defaults'](config['redis'],{'host':_0x7b7e('0x7'),'port':0x18eb});var socket=require(_0x7b7e('0x8'))(new Redis(config[_0x7b7e('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x7b7e('0x9')](socket);try{if(!process[_0x7b7e('0xa')][0x2]||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xc')){throw new Error(_0x7b7e('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7b7e('0xa')][0x3]||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xc')||!process[_0x7b7e('0xa')][0x4]||process[_0x7b7e('0xa')][0x4]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x4]==='null'){throw new Error(_0x7b7e('0xe'));}var FIELDS=_[_0x7b7e('0xf')](process['argv'][0x3][_0x7b7e('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x7b7e('0xa')][0x5]||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7b7e('0xa')][0x6]&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x6]:null;var DUPLICATES=process[_0x7b7e('0xa')][0x7]&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x7]:null;if(!process[_0x7b7e('0xa')][0x8]||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7b7e('0xa')][0x8];}catch(_0x43db4f){logger[_0x7b7e('0x11')](_0x43db4f);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4c0647,_0x313122,_0xbf0cb3,_0x14243b){var _0x200156={'message':_0x313122};_0x200156[_0x4c0647]=!![];if(_0xbf0cb3){_0x200156[_0x7b7e('0x12')]=_0xbf0cb3;}if(_0x14243b){_0x200156[_0x7b7e('0x13')]=_0x14243b;}return _0x200156;}function isEmail(_0x28bf43){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7b7e('0x14')](_0x28bf43);}function checkRow(_0x53bbb3,_0x5d6215,_0x4a836a){return new BPromise(function(_0x26ee14,_0x22598e){if(_[_0x7b7e('0x15')](_0x53bbb3)){return _0x22598e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a836a));}if(_0x53bbb3['errors']&&_0x53bbb3[_0x7b7e('0x16')][_0x7b7e('0x17')]){var _0x16a3c7=_[_0x7b7e('0x18')](_0x53bbb3[_0x7b7e('0x16')],'message')[_0x7b7e('0x19')](';');return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x16a3c7,null,_0x4a836a));}var _0x4c46b8={};for(var _0x57b9da in FIELDS){if(FIELDS['hasOwnProperty'](_0x57b9da)&&FIELDS[_0x57b9da]){_0x4c46b8[_0x57b9da]=_0x53bbb3[_0x7b7e('0x1a')][0x0][FIELDS[_0x57b9da]]||_0x53bbb3[_0x7b7e('0x1a')][0x0]['\ufeff'+FIELDS[_0x57b9da]];}}if(!_0x4c46b8['firstName']){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'firstName\x20not\x20specified!',null,_0x4a836a));}if(!_0x4c46b8[_0x7b7e('0x1b')]){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x1c'),null,_0x4a836a));}if(_0x4c46b8['birthDate']){var _0x3960b8=moment(_0x4c46b8[_0x7b7e('0x1d')],_0x7b7e('0x1e'));if(!_0x3960b8[_0x7b7e('0x1f')]()){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a836a));}}if(_0x4c46b8[_0x7b7e('0x20')]){if(!isEmail(_0x4c46b8['email'])){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x21'),null,_0x4a836a));}}_0x4c46b8[_0x7b7e('0x22')]=LISTID;_0x4c46b8[_0x7b7e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){var _0x247ea0={};for(var _0x29cb58=0x0,_0x4bfe7f=DUPLICATES['length'];_0x29cb58<_0x4bfe7f;_0x29cb58+=0x1){_0x247ea0[DUPLICATES[_0x29cb58]]=_0x4c46b8[DUPLICATES[_0x29cb58]];}var _0xebcdbc=_[_0x7b7e('0x24')](_0x5d6215,_0x247ea0);if(_0xebcdbc){return _0x22598e(handleCheckRowError('duplicate',_0x7b7e('0x25'),_0xebcdbc,_0x4a836a));}}return db[_0x7b7e('0x26')][_0x7b7e('0x27')](_0x4c46b8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c46b8)})[_0x7b7e('0x28')](function(_0x256908){if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){_0x5d6215[_0x7b7e('0x29')](_[_0x7b7e('0x2a')](_0x4c46b8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x256908['id'];return _0x26ee14();})[_0x7b7e('0x2b')](function(_0x3e8cf4){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x2c')+(_0x3e8cf4[_0x7b7e('0x2d')]||JSON[_0x7b7e('0x2e')](_0x3e8cf4)),null,_0x4a836a));});});}function checkHopper(){function _0x2d0620(){return function(_0x442366){logger[_0x7b7e('0x11')](_0x7b7e('0x2f'),_0x7b7e('0x30'),util['inspect'](_0x442366,{'showHidden':![],'depth':null}));};}var _0x8c80d5=function(_0x156dca,_0xb20532){var _0x242609=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),'ContactId',_0x7b7e('0x22'),_0xb20532,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))[_0x7b7e('0x39')]('NOW()','scheduledAt')[_0x7b7e('0x39')]('id','ContactId')[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x156dca['id'][_0x7b7e('0x3a')](),_0xb20532)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID['toString']())['where'](_0x7b7e('0x3f'))['where'](_0x7b7e('0x40'),squel['select']()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xb20532+_0x7b7e('0x41'),_0x156dca['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x242609;};var _0x37895a=function(_0x3e4f21,_0xccdfc7){var _0x5e8572=squel['insert']()['into'](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0xccdfc7,'createdAt',_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))['field'](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x3e4f21['id'][_0x7b7e('0x3a')](),_0xccdfc7)[_0x7b7e('0x39')](_0x7b7e('0x3b'),'createdAt')[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())[_0x7b7e('0x44')]('id\x20IN\x20?',squel[_0x7b7e('0x45')](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f'))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')]('calleridnum')[_0x7b7e('0x3c')]('cm_hopper_final')[_0x7b7e('0x44')](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id']['toString']()))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x5e8572;};function _0x24481a(_0x5b9ab5,_0x527403){var _0x5bdf1d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))['fromQuery'](['phone',_0x7b7e('0x35'),_0x7b7e('0x42'),'ListId',_0x527403,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5b9ab5['id'][_0x7b7e('0x3a')](),_0x527403)['field'](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')[_0x7b7e('0x44')]('deletedAt\x20IS\x20NULL')[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID['toString']())[_0x7b7e('0x44')](_0x7b7e('0x46'),squel['str'](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x5bdf1d;}function _0x3b1adb(_0x5eb32c,_0x101896){var _0x73904d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x47'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0x101896,_0x7b7e('0x36'),'updatedAt'],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID['toString'](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5eb32c['id'][_0x7b7e('0x3a')](),_0x101896)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),'updatedAt')['from'](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())['where'](_0x7b7e('0x46'),squel[_0x7b7e('0x45')](hopperContacts))['where'](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x73904d;}return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id',_0x7b7e('0x4b')],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x17e5ba){var _0x589b02=[];if(_0x17e5ba){var _0x59ecf9;for(var _0x34e7df=0x0,_0x46ac1f;_0x34e7df<_0x17e5ba[_0x7b7e('0x17')];_0x34e7df+=0x1){_0x46ac1f=_0x17e5ba[_0x34e7df][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x46ac1f[_0x7b7e('0x4b')]){case _0x7b7e('0x4f'):_0x589b02[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x46ac1f,_0x7b7e('0x51')))['then'](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case _0x7b7e('0x52'):_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x46ac1f,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x46ac1f,'VoiceQueueId'))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x589b02;})[_0x7b7e('0x54')]()[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1eb5ce){var _0x49f0a4=[];if(_0x1eb5ce){var _0x1d6aa4;for(var _0x195ae2=0x0,_0x381ee6;_0x195ae2<_0x1eb5ce[_0x7b7e('0x17')];_0x195ae2+=0x1){_0x381ee6=_0x1eb5ce[_0x195ae2][_0x7b7e('0x4e')]({'plain':!![]});_0x49f0a4['push'](db['sequelize']['query'](_0x3b1adb(_0x381ee6,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}return _0x49f0a4;})['all']();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x34a06c){var _0x538c5f=[];if(_0x34a06c){for(var _0x315923=0x0,_0x40b4ae;_0x315923<_0x34a06c[_0x7b7e('0x17')];_0x315923+=0x1){_0x40b4ae=_0x34a06c[_0x315923][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x40b4ae['dialCheckDuplicateType']){case'always':_0x538c5f[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case'onlyIfOpen':_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x538c5f;})[_0x7b7e('0x54')]();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1d9e08){var _0xa03d7a=[];if(_0x1d9e08){for(var _0x10c35e=0x0,_0x302462;_0x10c35e<_0x1d9e08[_0x7b7e('0x17')];_0x10c35e+=0x1){_0x302462=_0x1d9e08[_0x10c35e]['get']({'plain':!![]});_0xa03d7a[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x3b1adb(_0x302462,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})['catch'](_0x2d0620()));}}return _0xa03d7a;})['all']();})[_0x7b7e('0x2b')](function(_0x110f2b){logger[_0x7b7e('0x11')](_0x7b7e('0x58'),_0x7b7e('0x59'),_0x110f2b[_0x7b7e('0x2d')]);});}var processPromises=function(_0x2c65b8){return BPromise[_0x7b7e('0x54')](promises)[_0x7b7e('0x28')](function(_0x850d0f){})['catch'](function(_0x27402a){logger[_0x7b7e('0x11')](_0x7b7e('0x5a'),JSON[_0x7b7e('0x2e')](_0x27402a));})[_0x7b7e('0x5b')](function(){socket[_0x7b7e('0x5c')](_0x7b7e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c65b8){return _0x2c65b8['resume']();}});};var endCsv=function(){return BPromise[_0x7b7e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7b7e('0x28')](function(){socket[_0x7b7e('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b7e('0x5f')](FILEPATH);}catch(_0x38fd40){logger[_0x7b7e('0x11')](_0x7b7e('0x60'),JSON[_0x7b7e('0x2e')](_0x38fd40));}finally{process['exit'](0x0);}});};process['on'](_0x7b7e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b7e('0x5e')]()[_0x7b7e('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b7e('0x10')](',');return db[_0x7b7e('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b7e('0x28')](function(_0x5cedd4){var _0x25233a=fs[_0x7b7e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b7e('0x63')](_0x25233a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71ab,_0x11d615){total+=0x1;var _0x3afd15=total;promises[_0x7b7e('0x29')](checkRow(_0x1e71ab,_0x5cedd4,_0x3afd15)['then'](function(){success+=0x1;})[_0x7b7e('0x2b')](function(_0x30eeee){if(_0x30eeee['error']){errors+=0x1;delete _0x30eeee[_0x7b7e('0x11')];}else if(_0x30eeee[_0x7b7e('0x64')]){duplicates+=0x1;delete _0x30eeee[_0x7b7e('0x64')];}rows[_0x7b7e('0x29')](_0x30eeee);}));if(total%0xc8===0x0){_0x11d615[_0x7b7e('0x65')]();return processPromises(_0x11d615);}},'complete':function(){return processPromises()[_0x7b7e('0x28')](function(){logger[_0x7b7e('0x66')](_0x7b7e('0x67'));endCsv();});},'error':function(_0x41e2b5,_0x97232d){logger[_0x7b7e('0x66')](_0x7b7e('0x68'),JSON[_0x7b7e('0x2e')](_0x41e2b5));endCsv();}});})[_0x7b7e('0x2b')](function(_0x12d0cb){logger[_0x7b7e('0x11')](_0x7b7e('0x69'),JSON[_0x7b7e('0x2e')](_0x12d0cb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index c41991d..dd88af8 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 _0xd08a=['hasOwnProperty','trim','replace','scheduledat','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','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','duplicates','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','voice_queues','CampaignId','campaigns_has_cm_blacklists','campaigns','then','finish','unlink','arguments\x20\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','No\x20agent\x20available','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','test','select','field','phone','from','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','join','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','into','cm_hopper_black','cm_contacts.ListId\x20=\x20','\x20=\x20?','toString','concat','keys','CompanyId','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','exit','errors','push','code','message','sequelize','query','spread','catch','main','stringify','send','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','data','length','rows'];(function(_0x5219ec,_0x582356){var _0x388c0e=function(_0xaee0c1){while(--_0xaee0c1){_0x5219ec['push'](_0x5219ec['shift']());}};_0x388c0e(++_0x582356);}(_0xd08a,0x134));var _0xad08=function(_0x50591a,_0x3e0f25){_0x50591a=_0x50591a-0x0;var _0x5d5dd2=_0xd08a[_0x50591a];return _0x5d5dd2;};'use strict';var fs=require('fs');var path=require(_0xad08('0x0'));var _=require(_0xad08('0x1'));var Papa=require(_0xad08('0x2'));var util=require(_0xad08('0x3'));var BPromise=require(_0xad08('0x4'));var moment=require(_0xad08('0x5'));var squel=require('squel');var Redis=require(_0xad08('0x6'));var db=require(_0xad08('0x7'))['db'];var config=require(_0xad08('0x8'));var logger=require(_0xad08('0x9'))(_0xad08('0xa'));config['redis']=_['defaults'](config[_0xad08('0xb')],{'host':_0xad08('0xc'),'port':0x18eb});var socket=require(_0xad08('0xd'))(new Redis(config[_0xad08('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x54d193){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))*$/[_0xad08('0xe')](_0x54d193);}function selectNotIn(_0x25031f,_0x2cd47f,_0x465a57,_0x2733a4,_0x48ad37){return squel[_0xad08('0xf')]()[_0xad08('0x10')](_0xad08('0x11'))[_0xad08('0x12')](_0x2733a4)['join'](_0x2cd47f,null,_0x2cd47f+_0xad08('0x13')+_0x2733a4+'.'+_0x465a57)['where'](_0x2733a4+'.'+_0x465a57+_0xad08('0x14')+_0x25031f+'.'+_0x465a57)[_0xad08('0x15')](_0x2cd47f+_0xad08('0x16')+_0x48ad37['join']()+')');}function insertCmHopper(_0x3364ca,_0x39261d,_0x12efe1,_0x27207a,_0x3715c9){var _0x5b36a9=[_0xad08('0x17'),_0xad08('0x18'),_0xad08('0x19'),'cm_contacts.ListId',_0x39261d+'.'+_0x27207a,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xad08('0x1a'),_0xad08('0x1b'),'\x22'+_0x3715c9+'\x22'];return squel[_0xad08('0x1c')]()['into'](_0xad08('0x1d'))[_0xad08('0x1e')](['phone','scheduledat',_0xad08('0x1f'),_0xad08('0x20'),_0x27207a,_0xad08('0x21'),_0xad08('0x22'),_0xad08('0x23'),_0xad08('0x24'),_0xad08('0x25')],squel[_0xad08('0xf')]()[_0xad08('0x26')](_0x5b36a9)[_0xad08('0x12')](_0x39261d)[_0xad08('0x27')](_0xad08('0x28'),null,'cm_contacts.ListId\x20=\x20'+_0x39261d+_0xad08('0x29'))[_0xad08('0x27')](_0x12efe1,null,_0x12efe1+_0xad08('0x13')+_0x39261d+'.'+_0x27207a)[_0xad08('0x15')](_0x39261d+_0xad08('0x2a'),_0x3364ca)['where'](_0xad08('0x2b'),NOW)[_0xad08('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x39261d,_0x12efe1,_0x27207a,_0xad08('0x1d'),[_0xad08('0x2c'),_0xad08('0x2d')]))[_0xad08('0x15')](_0xad08('0x2e'),selectNotIn(_0x39261d,_0x12efe1,_0x27207a,_0xad08('0x1d'),[_0xad08('0x2c')])))['toString']();}function insertCmHopperBlack(_0x1af979,_0x11c9ed,_0xb5894e,_0x2f869a){var _0x3b0b01=['cm_contacts.phone',_0xad08('0x19'),_0xad08('0x2f'),_0x11c9ed+'.'+_0x2f869a,_0xad08('0x30'),_0xad08('0x31')];return squel[_0xad08('0x1c')]()[_0xad08('0x32')](_0xad08('0x33'))['fromQuery']([_0xad08('0x11'),_0xad08('0x1f'),_0xad08('0x20'),_0x2f869a,_0xad08('0x21'),_0xad08('0x22')],squel['select']()['fields'](_0x3b0b01)['from'](_0x11c9ed)[_0xad08('0x27')](_0xad08('0x28'),null,_0xad08('0x34')+_0x11c9ed+_0xad08('0x29'))[_0xad08('0x27')](_0xb5894e,null,_0xb5894e+_0xad08('0x13')+_0x11c9ed+'.'+_0x2f869a)[_0xad08('0x15')](_0x11c9ed+_0xad08('0x2a'),_0x1af979)[_0xad08('0x15')](_0xad08('0x2b'),NOW)[_0xad08('0x15')](_0xad08('0x2e'),squel[_0xad08('0xf')]()[_0xad08('0x10')](_0xad08('0x11'))[_0xad08('0x12')](_0xad08('0x33'))['where']('ListId\x20=\x20?',_0x1af979)[_0xad08('0x15')](_0x2f869a+_0xad08('0x35'),_0x11c9ed+'.'+_0x2f869a)))[_0xad08('0x36')]();}function insertCmContact(_0x5c5c4b,_0x24bacd,_0x28be29,_0x58170f){var _0x14152a=_[_0xad08('0x37')](_[_0xad08('0x38')](_0x58170f),[_0xad08('0x20'),_0xad08('0x39'),_0xad08('0x21'),_0xad08('0x22')]);return squel[_0xad08('0x1c')]()[_0xad08('0x32')](_0xad08('0x28'))['fromQuery'](_0x14152a,squel[_0xad08('0xf')]()[_0xad08('0x26')](_0x14152a)[_0xad08('0x12')](_0x24bacd)[_0xad08('0x15')]('('+_0x28be29['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xad08('0xf')]()[_0xad08('0x26')](_0x28be29)[_0xad08('0x12')](_0xad08('0x28'))[_0xad08('0x15')](_0xad08('0x3a'),_0x5c5c4b)['where'](_0xad08('0x3b')))[_0xad08('0x15')](_0xad08('0x3c'),squel[_0xad08('0xf')]()[_0xad08('0x10')](_0xad08('0x3d'),_0xad08('0x3e'))['from'](_0x24bacd)[_0xad08('0x3f')](_0x28be29['join'](','))))['toString']();}function handleStop(){logger[_0xad08('0x40')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x513277){logger[_0xad08('0x41')](_0x513277['message']);process[_0xad08('0x42')](0x1);}function handleError(_0x30a604,_0x1861dc){stats[_0xad08('0x43')][_0xad08('0x44')]({'name':_0x1861dc[_0xad08('0x45')],'message':_0x1861dc[_0xad08('0x46')],'row':_0x30a604});}function handleQuery(_0x2983cf){logger[_0xad08('0x40')](_0x2983cf);return db[_0xad08('0x47')][_0xad08('0x48')](_0x2983cf)[_0xad08('0x49')](function(_0x243c84){results[_0xad08('0x44')](_0x243c84);})[_0xad08('0x4a')](function(_0x1a56e0){logger[_0xad08('0x41')](_0x1a56e0[_0xad08('0x46')]);});}function main(_0x54828c,_0x3f8618,_0x221019,_0x31c784){logger['info'](_0xad08('0x4b'),_0x54828c,JSON[_0xad08('0x4c')](_0x3f8618));process[_0xad08('0x4d')]('start');var _0x51a751=_0x3f8618['binding'];var _0x20434e=_0x3f8618[_0xad08('0x4e')];var _0x2fefb5=path[_0xad08('0x27')](config[_0xad08('0x4f')],_0xad08('0x50'),_0x20434e+_0xad08('0x51'));var _0x3cbd21=_[_0xad08('0x38')](_0x51a751)[_0xad08('0x27')]();logger[_0xad08('0x40')](_0xad08('0x52'),_0x3cbd21);fs[_0xad08('0x53')](_0x2fefb5,_0x3cbd21+'\x0a');Papa['parse'](fs[_0xad08('0x54')](_0x54828c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3a9949,_0xa4dcd5){try{for(var _0x9119a3=0x0,_0x498c45=[];_0x9119a3<_0x3a9949[_0xad08('0x55')][_0xad08('0x56')];_0x9119a3++){stats[_0xad08('0x57')]+=0x1;if(_0x3a9949['errors'][_0x9119a3]){handleError(_0x3a9949[_0xad08('0x55')][_0x9119a3],_0x3a9949[_0xad08('0x43')][_0x9119a3]);}else{var _0x5eb597=[];for(var _0xd3f20b in _0x51a751){if(_0x51a751[_0xad08('0x58')](_0xd3f20b)){if(_0x3a9949[_0xad08('0x55')][_0x9119a3][_0x51a751[_0xd3f20b]]){var _0x2af371=_[_0xad08('0x59')](_0x3a9949['data'][_0x9119a3][_0x51a751[_0xd3f20b]][_0xad08('0x5a')](/"/g,'\x27'));switch(_0xd3f20b){case _0xad08('0x5b'):var _0x5068a2=moment(_0x2af371,_0xad08('0x5c'),!![]);if(_0x5068a2['isValid']()){_0x498c45[_0xad08('0x44')]('\x22'+_0x2af371+'\x22');}else{_0x5eb597[_0xad08('0x44')](_0xad08('0x5d'));}break;case'priority':var _0x50ba97=parseInt(_0x2af371);_0x2af371=_[_0xad08('0x5e')](_0x50ba97)||_0x50ba97<0x0||_0x50ba97>0x4?_0x31c784?0x3:0x2:_0x50ba97;_0x498c45[_0xad08('0x44')]('\x22'+_0x2af371+'\x22');break;case'UserId':var _0x28074b=parseInt(_0x2af371);if(_[_0xad08('0x5f')](_0x28074b)&&_['includes'](_0x221019,_0x28074b)){_0x498c45[_0xad08('0x44')]('\x22'+_0x28074b+'\x22');}else{_0x5eb597[_0xad08('0x44')](_0xad08('0x60'));}break;case _0xad08('0x61'):if(isEmail(_0x2af371)){_0x498c45[_0xad08('0x44')]('\x22'+_0x2af371+'\x22');}else{_0x5eb597[_0xad08('0x44')](_0xad08('0x62'));}break;case _0xad08('0x63'):var _0x29aea2=moment(_0x2af371,_0xad08('0x64'),!![]);if(_0x29aea2['isValid']()){_0x498c45[_0xad08('0x44')]('\x22'+_0x2af371+'\x22');}else{_0x5eb597['push'](_0xad08('0x65'));}break;default:_0x498c45[_0xad08('0x44')]('\x22'+_0x2af371+'\x22');}}else{switch(_0xd3f20b){case _0xad08('0x66'):case'phone':_0x5eb597[_0xad08('0x44')](_0xd3f20b+_0xad08('0x67'));break;default:_0x498c45[_0xad08('0x44')]('\x22\x22');}}}}if(_0x5eb597['length']){handleError(_0x3a9949[_0xad08('0x55')][_0x9119a3],{'code':_0xad08('0x68'),'message':_0x5eb597[_0xad08('0x27')]()});}else{fs[_0xad08('0x69')](_0x2fefb5,_0x498c45[_0xad08('0x27')]()+'\x0a');}_0x498c45=[];}if(!(stats[_0xad08('0x57')]%0xc8)){socket[_0xad08('0x6a')]('contact:import:'+_0x20434e,stats);stats[_0xad08('0x43')]=[];}}if(stopped){logger[_0xad08('0x40')](_0xad08('0x6b'));_0xa4dcd5[_0xad08('0x6c')]();}}catch(_0x17687e){handleError(_0x3a9949[_0xad08('0x55')][_0x9119a3],{'code':'SystemError','message':_0x17687e[_0xad08('0x46')]});logger['error']('step',_0x17687e[_0xad08('0x46')]);}},'complete':function(){try{var _0x38bfcd=[];var _0x23400a=_0xad08('0x28');if(_0x3f8618[_0xad08('0x6d')]&&_0x3f8618[_0xad08('0x6d')]['length']){_0x23400a='cm_contacts_'+_0x20434e;_0x38bfcd['push']('CREATE\x20TABLE\x20'+_0x23400a+_0xad08('0x6e'));}var _0x1f91c4=util['format'](_0xad08('0x6f'),_0x2fefb5,_0x23400a,_0x3cbd21,_0x3f8618[_0xad08('0x20')],_0x3f8618[_0xad08('0x39')]||null,NOW,NOW);if(_['isNil'](_0x51a751[_0xad08('0x5b')])){_0x1f91c4+=_0xad08('0x70');}_0x38bfcd[_0xad08('0x44')](_0x1f91c4);if(_0x3f8618['duplicates']&&_0x3f8618[_0xad08('0x6d')][_0xad08('0x56')]){_0x38bfcd[_0xad08('0x44')](insertCmContact(_0x3f8618[_0xad08('0x20')],_0x23400a,_0x3f8618[_0xad08('0x6d')],_0x51a751));_0x38bfcd[_0xad08('0x44')]('DROP\x20TABLE\x20'+_0x23400a+';');}_0x38bfcd[_0xad08('0x44')](insertCmHopper(_0x3f8618[_0xad08('0x20')],_0xad08('0x71'),_0xad08('0x72'),'VoiceQueueId',_0x31c784));_0x38bfcd[_0xad08('0x44')](insertCmHopperBlack(_0x3f8618[_0xad08('0x20')],'voice_queues_has_cm_blacklists',_0xad08('0x72'),'VoiceQueueId'));_0x38bfcd[_0xad08('0x44')](insertCmHopper(_0x3f8618[_0xad08('0x20')],'campaigns_has_cm_lists','campaigns',_0xad08('0x73'),_0x31c784));_0x38bfcd[_0xad08('0x44')](insertCmHopperBlack(_0x3f8618[_0xad08('0x20')],_0xad08('0x74'),_0xad08('0x75'),_0xad08('0x73')));BPromise['each'](_0x38bfcd,handleQuery)[_0xad08('0x76')](function(_0x391155){stats[_0xad08('0x77')]=!![];stats['affectedRows']=_0x3f8618[_0xad08('0x6d')]&&_0x3f8618['duplicates'][_0xad08('0x56')]?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket[_0xad08('0x6a')]('contact:import:'+_0x20434e,stats);fs['unlink'](_0x54828c);fs[_0xad08('0x78')](_0x2fefb5);process[_0xad08('0x42')](0x0);})[_0xad08('0x4a')](function(_0x510351){logger[_0xad08('0x41')](_0x510351['message']);process[_0xad08('0x42')](0x1);});}catch(_0x44c30f){logger[_0xad08('0x41')]('complete',_0x44c30f[_0xad08('0x46')]);process[_0xad08('0x42')](0x1);}},'error':function(_0x4de540,_0x3612b3,_0x5dce24,_0x5740e8){throw new Error(_0x5740e8);}});}function validate(){if(process['argv']&&process['argv'][_0xad08('0x56')]<0x4){throw new Error(_0xad08('0x79'));}var _0x52f695=path[_0xad08('0x27')](config[_0xad08('0x4f')],'server/files/tmp',process[_0xad08('0x7a')][0x2]);if(!fs[_0xad08('0x7b')](_0x52f695)){throw new Error(_0xad08('0x7c'));}var _0x562ca9={};try{_0x562ca9=JSON['parse'](process[_0xad08('0x7a')][0x3]);if(!_0x562ca9[_0xad08('0x7d')]){throw new Error(_0xad08('0x7e'));}if(!_0x562ca9[_0xad08('0x7d')][_0xad08('0x11')]){throw new Error(_0xad08('0x7f'));}if(!_0x562ca9[_0xad08('0x7d')][_0xad08('0x66')]){throw new Error('firstName\x20is\x20mandatory');}var _0xe7336f=0x0;if(_0x562ca9['binding'][_0xad08('0x24')]){_0xe7336f=0x1;}if(!_0x562ca9[_0xad08('0x20')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x12519e){throw new Error(_0xad08('0x80'));}var _0x2af1aa=[];try{_0x2af1aa=_[_0xad08('0x81')](JSON[_0xad08('0x82')](process[_0xad08('0x7a')][0x4]),'id');}catch(_0x1dfe48){logger['info'](_0xad08('0x83'));}main(_0x52f695,_0x562ca9,_0x2af1aa,_0xe7336f);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x6ece=['isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','then','finish','affectedRows','argv','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','bluebird','moment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_hopper','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.phone','insert','cm_hopper_black','updatedAt','select','fields','\x20=\x20?','concat','keys','CompanyId','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','sequelize','query','spread','push','catch','main','stringify','start','binding','socket_timestamp','server/files/tmp','.csv','writeFileSync','parse','createReadStream','data','length','errors','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','format'];(function(_0x41a6fc,_0x40f332){var _0xa1f8ae=function(_0x2c81cf){while(--_0x2c81cf){_0x41a6fc['push'](_0x41a6fc['shift']());}};_0xa1f8ae(++_0x40f332);}(_0x6ece,0x8f));var _0xe6ec=function(_0x2e1123,_0x1b95dd){_0x2e1123=_0x2e1123-0x0;var _0x470bd4=_0x6ece[_0x2e1123];return _0x470bd4;};'use strict';var fs=require('fs');var path=require(_0xe6ec('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xe6ec('0x1'));var moment=require(_0xe6ec('0x2'));var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xe6ec('0x3'))(_0xe6ec('0x4'));config[_0xe6ec('0x5')]=_[_0xe6ec('0x6')](config['redis'],{'host':_0xe6ec('0x7'),'port':0x18eb});var socket=require(_0xe6ec('0x8'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0xe6ec('0x9'));function isEmail(_0xce1207){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))*$/[_0xe6ec('0xa')](_0xce1207);}function selectNotIn(_0x99cbb5,_0x17914a,_0x574ed9,_0x495b8c,_0x24cf1b){return squel['select']()[_0xe6ec('0xb')](_0xe6ec('0xc'))[_0xe6ec('0xd')](_0x495b8c)[_0xe6ec('0xe')](_0x17914a,null,_0x17914a+'.id\x20=\x20'+_0x495b8c+'.'+_0x574ed9)[_0xe6ec('0xf')](_0x495b8c+'.'+_0x574ed9+_0xe6ec('0x10')+_0x99cbb5+'.'+_0x574ed9)['where'](_0x17914a+_0xe6ec('0x11')+_0x24cf1b[_0xe6ec('0xe')]()+')');}function insertCmHopper(_0x42a2eb,_0x543084,_0x48e194,_0x930d47,_0x48a735){var _0x303969=['cm_contacts.phone',_0xe6ec('0x12'),_0xe6ec('0x13'),_0xe6ec('0x14'),_0x543084+'.'+_0x930d47,_0xe6ec('0x15'),_0xe6ec('0x16'),_0xe6ec('0x17'),_0xe6ec('0x18'),'\x22'+_0x48a735+'\x22'];return squel['insert']()[_0xe6ec('0x19')]('cm_hopper')[_0xe6ec('0x1a')]([_0xe6ec('0xc'),_0xe6ec('0x1b'),_0xe6ec('0x1c'),_0xe6ec('0x1d'),_0x930d47,_0xe6ec('0x1e'),'updatedAt',_0xe6ec('0x1f'),_0xe6ec('0x20'),_0xe6ec('0x21')],squel['select']()['fields'](_0x303969)['from'](_0x543084)[_0xe6ec('0xe')](_0xe6ec('0x22'),null,_0xe6ec('0x23')+_0x543084+_0xe6ec('0x24'))[_0xe6ec('0xe')](_0x48e194,null,_0x48e194+_0xe6ec('0x25')+_0x543084+'.'+_0x930d47)[_0xe6ec('0xf')](_0x543084+_0xe6ec('0x26'),_0x42a2eb)[_0xe6ec('0xf')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x543084,_0x48e194,_0x930d47,_0xe6ec('0x27'),['\x22always\x22',_0xe6ec('0x28')]))[_0xe6ec('0xf')](_0xe6ec('0x29'),selectNotIn(_0x543084,_0x48e194,_0x930d47,'cm_hopper',[_0xe6ec('0x2a')])))[_0xe6ec('0x2b')]();}function insertCmHopperBlack(_0x482544,_0x3680d8,_0x25c781,_0x3621fe){var _0x100bf8=[_0xe6ec('0x2c'),_0xe6ec('0x13'),_0xe6ec('0x14'),_0x3680d8+'.'+_0x3621fe,_0xe6ec('0x15'),_0xe6ec('0x16')];return squel[_0xe6ec('0x2d')]()['into'](_0xe6ec('0x2e'))[_0xe6ec('0x1a')](['phone',_0xe6ec('0x1c'),'ListId',_0x3621fe,_0xe6ec('0x1e'),_0xe6ec('0x2f')],squel[_0xe6ec('0x30')]()[_0xe6ec('0x31')](_0x100bf8)[_0xe6ec('0xd')](_0x3680d8)[_0xe6ec('0xe')](_0xe6ec('0x22'),null,_0xe6ec('0x23')+_0x3680d8+_0xe6ec('0x24'))[_0xe6ec('0xe')](_0x25c781,null,_0x25c781+_0xe6ec('0x25')+_0x3680d8+'.'+_0x3621fe)['where'](_0x3680d8+'.CmListId\x20=\x20?',_0x482544)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe6ec('0xf')](_0xe6ec('0x29'),squel['select']()[_0xe6ec('0xb')]('phone')[_0xe6ec('0xd')](_0xe6ec('0x2e'))[_0xe6ec('0xf')]('ListId\x20=\x20?',_0x482544)[_0xe6ec('0xf')](_0x3621fe+_0xe6ec('0x32'),_0x3680d8+'.'+_0x3621fe)))[_0xe6ec('0x2b')]();}function insertCmContact(_0x391043,_0x23adfe,_0x23e989,_0x7a4721){var _0x4802a2=_[_0xe6ec('0x33')](_[_0xe6ec('0x34')](_0x7a4721),[_0xe6ec('0x1d'),_0xe6ec('0x35'),_0xe6ec('0x1e'),_0xe6ec('0x2f')]);return squel[_0xe6ec('0x2d')]()[_0xe6ec('0x19')]('cm_contacts')[_0xe6ec('0x1a')](_0x4802a2,squel[_0xe6ec('0x30')]()[_0xe6ec('0x31')](_0x4802a2)[_0xe6ec('0xd')](_0x23adfe)[_0xe6ec('0xf')]('('+_0x23e989['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xe6ec('0x30')]()[_0xe6ec('0x31')](_0x23e989)[_0xe6ec('0xd')](_0xe6ec('0x22'))[_0xe6ec('0xf')](_0xe6ec('0x36'),_0x391043)[_0xe6ec('0xf')](_0xe6ec('0x37')))[_0xe6ec('0xf')](_0xe6ec('0x38'),squel[_0xe6ec('0x30')]()[_0xe6ec('0xb')](_0xe6ec('0x39'),_0xe6ec('0x3a'))[_0xe6ec('0xd')](_0x23adfe)[_0xe6ec('0x3b')](_0x23e989['join'](','))))[_0xe6ec('0x2b')]();}function handleStop(){logger[_0xe6ec('0x3c')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2e83aa){logger[_0xe6ec('0x3d')](_0x2e83aa[_0xe6ec('0x3e')]);process[_0xe6ec('0x3f')](0x1);}function handleError(_0x3ec160,_0xfaca84){stats['errors']['push']({'name':_0xfaca84['code'],'message':_0xfaca84[_0xe6ec('0x3e')],'row':_0x3ec160});}function handleQuery(_0x2fff2b){logger[_0xe6ec('0x3c')](_0x2fff2b);return db[_0xe6ec('0x40')][_0xe6ec('0x41')](_0x2fff2b)[_0xe6ec('0x42')](function(_0x39f2c8){results[_0xe6ec('0x43')](_0x39f2c8);})[_0xe6ec('0x44')](function(_0x3e4b20){logger[_0xe6ec('0x3d')](_0x3e4b20[_0xe6ec('0x3e')]);});}function main(_0x342b5c,_0x55f314,_0x2a1c32,_0xff96fb){logger[_0xe6ec('0x3c')](_0xe6ec('0x45'),_0x342b5c,JSON[_0xe6ec('0x46')](_0x55f314));process['send'](_0xe6ec('0x47'));var _0x1a8f6b=_0x55f314[_0xe6ec('0x48')];var _0x1c6353=_0x55f314[_0xe6ec('0x49')];var _0x3fd6c3=path[_0xe6ec('0xe')](config['root'],_0xe6ec('0x4a'),_0x1c6353+_0xe6ec('0x4b'));var _0x334fff=_[_0xe6ec('0x34')](_0x1a8f6b)[_0xe6ec('0xe')]();logger['info']('header',_0x334fff);fs[_0xe6ec('0x4c')](_0x3fd6c3,_0x334fff+'\x0a');Papa[_0xe6ec('0x4d')](fs[_0xe6ec('0x4e')](_0x342b5c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x382129,_0x207d5f){try{for(var _0x426368=0x0,_0x2f64ad=[];_0x426368<_0x382129[_0xe6ec('0x4f')][_0xe6ec('0x50')];_0x426368++){stats['rows']+=0x1;if(_0x382129[_0xe6ec('0x51')][_0x426368]){handleError(_0x382129[_0xe6ec('0x4f')][_0x426368],_0x382129['errors'][_0x426368]);}else{var _0x39d7e8=[];for(var _0x815dcc in _0x1a8f6b){if(_0x1a8f6b[_0xe6ec('0x52')](_0x815dcc)){if(_0x382129[_0xe6ec('0x4f')][_0x426368][_0x1a8f6b[_0x815dcc]]){var _0xa9ad4a=_[_0xe6ec('0x53')](_0x382129[_0xe6ec('0x4f')][_0x426368][_0x1a8f6b[_0x815dcc]]['replace'](/"/g,'\x27'));switch(_0x815dcc){case _0xe6ec('0x1b'):var _0x51a37e=moment(_0xa9ad4a,_0xe6ec('0x9'),!![]);if(_0x51a37e[_0xe6ec('0x54')]()){_0x2f64ad[_0xe6ec('0x43')]('\x22'+_0xa9ad4a+'\x22');}else{_0x39d7e8[_0xe6ec('0x43')](_0xe6ec('0x55'));}break;case _0xe6ec('0x1f'):var _0x1fff47=parseInt(_0xa9ad4a);_0xa9ad4a=_[_0xe6ec('0x56')](_0x1fff47)||_0x1fff47<0x0||_0x1fff47>0x4?_0xff96fb?0x3:0x2:_0x1fff47;_0x2f64ad[_0xe6ec('0x43')]('\x22'+_0xa9ad4a+'\x22');break;case'UserId':var _0x52a3ea=parseInt(_0xa9ad4a);if(_['isNumber'](_0x52a3ea)&&_['includes'](_0x2a1c32,_0x52a3ea)){_0x2f64ad['push']('\x22'+_0x52a3ea+'\x22');}else{_0x39d7e8[_0xe6ec('0x43')](_0xe6ec('0x57'));}break;case'email':if(isEmail(_0xa9ad4a)){_0x2f64ad[_0xe6ec('0x43')]('\x22'+_0xa9ad4a+'\x22');}else{_0x39d7e8[_0xe6ec('0x43')](_0xe6ec('0x58'));}break;case'dateOfBirth':var _0x47b2e6=moment(_0xa9ad4a,_0xe6ec('0x59'),!![]);if(_0x47b2e6['isValid']()){_0x2f64ad[_0xe6ec('0x43')]('\x22'+_0xa9ad4a+'\x22');}else{_0x39d7e8[_0xe6ec('0x43')](_0xe6ec('0x5a'));}break;default:_0x2f64ad[_0xe6ec('0x43')]('\x22'+_0xa9ad4a+'\x22');}}else{switch(_0x815dcc){case _0xe6ec('0x5b'):case'phone':_0x39d7e8['push'](_0x815dcc+_0xe6ec('0x5c'));break;default:_0x2f64ad[_0xe6ec('0x43')]('\x22\x22');}}}}if(_0x39d7e8['length']){handleError(_0x382129[_0xe6ec('0x4f')][_0x426368],{'code':_0xe6ec('0x5d'),'message':_0x39d7e8['join']()});}else{fs[_0xe6ec('0x5e')](_0x3fd6c3,_0x2f64ad['join']()+'\x0a');}_0x2f64ad=[];}if(!(stats['rows']%0xc8)){socket[_0xe6ec('0x5f')](_0xe6ec('0x60')+_0x1c6353,stats);stats[_0xe6ec('0x51')]=[];}}if(stopped){logger[_0xe6ec('0x3c')](_0xe6ec('0x61'));_0x207d5f[_0xe6ec('0x62')]();}}catch(_0x35f57a){handleError(_0x382129[_0xe6ec('0x4f')][_0x426368],{'code':'SystemError','message':_0x35f57a['message']});logger[_0xe6ec('0x3d')](_0xe6ec('0x63'),_0x35f57a[_0xe6ec('0x3e')]);}},'complete':function(){try{var _0xa21f43=[];var _0x50d0fc=_0xe6ec('0x22');if(_0x55f314[_0xe6ec('0x64')]&&_0x55f314['duplicates']['length']){_0x50d0fc=_0xe6ec('0x65')+_0x1c6353;_0xa21f43[_0xe6ec('0x43')](_0xe6ec('0x66')+_0x50d0fc+_0xe6ec('0x67'));}var _0x103ae1=util[_0xe6ec('0x68')]('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',_0x3fd6c3,_0x50d0fc,_0x334fff,_0x55f314[_0xe6ec('0x1d')],_0x55f314[_0xe6ec('0x35')]||null,NOW,NOW);if(_[_0xe6ec('0x69')](_0x1a8f6b[_0xe6ec('0x1b')])){_0x103ae1+=',\x20scheduledAt\x20=\x20NOW()';}_0xa21f43[_0xe6ec('0x43')](_0x103ae1);if(_0x55f314[_0xe6ec('0x64')]&&_0x55f314[_0xe6ec('0x64')][_0xe6ec('0x50')]){_0xa21f43['push'](insertCmContact(_0x55f314['ListId'],_0x50d0fc,_0x55f314[_0xe6ec('0x64')],_0x1a8f6b));_0xa21f43['push'](_0xe6ec('0x6a')+_0x50d0fc+';');}_0xa21f43[_0xe6ec('0x43')](insertCmHopper(_0x55f314[_0xe6ec('0x1d')],_0xe6ec('0x6b'),'voice_queues','VoiceQueueId',_0xff96fb));_0xa21f43[_0xe6ec('0x43')](insertCmHopperBlack(_0x55f314[_0xe6ec('0x1d')],_0xe6ec('0x6c'),_0xe6ec('0x6d'),_0xe6ec('0x6e')));_0xa21f43[_0xe6ec('0x43')](insertCmHopper(_0x55f314[_0xe6ec('0x1d')],_0xe6ec('0x6f'),_0xe6ec('0x70'),_0xe6ec('0x71'),_0xff96fb));_0xa21f43[_0xe6ec('0x43')](insertCmHopperBlack(_0x55f314[_0xe6ec('0x1d')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));BPromise['each'](_0xa21f43,handleQuery)[_0xe6ec('0x72')](function(_0x35dfa5){stats[_0xe6ec('0x73')]=!![];stats[_0xe6ec('0x74')]=_0x55f314[_0xe6ec('0x64')]&&_0x55f314['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0xe6ec('0x74')];socket[_0xe6ec('0x5f')](_0xe6ec('0x60')+_0x1c6353,stats);fs['unlink'](_0x342b5c);fs['unlink'](_0x3fd6c3);process[_0xe6ec('0x3f')](0x0);})['catch'](function(_0x50d320){logger['error'](_0x50d320['message']);process[_0xe6ec('0x3f')](0x1);});}catch(_0x3f6cc2){logger[_0xe6ec('0x3d')]('complete',_0x3f6cc2[_0xe6ec('0x3e')]);process[_0xe6ec('0x3f')](0x1);}},'error':function(_0x48f78b,_0x59e03f,_0x147e5f,_0xc472de){throw new Error(_0xc472de);}});}function validate(){if(process['argv']&&process[_0xe6ec('0x75')][_0xe6ec('0x50')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x5bef1c=path['join'](config['root'],_0xe6ec('0x4a'),process[_0xe6ec('0x75')][0x2]);if(!fs['existsSync'](_0x5bef1c)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x3b1ed5={};try{_0x3b1ed5=JSON[_0xe6ec('0x4d')](process[_0xe6ec('0x75')][0x3]);if(!_0x3b1ed5[_0xe6ec('0x48')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x3b1ed5[_0xe6ec('0x48')][_0xe6ec('0xc')]){throw new Error(_0xe6ec('0x76'));}if(!_0x3b1ed5[_0xe6ec('0x48')][_0xe6ec('0x5b')]){throw new Error(_0xe6ec('0x77'));}var _0x373f02=0x0;if(_0x3b1ed5[_0xe6ec('0x48')][_0xe6ec('0x20')]){_0x373f02=0x1;}if(!_0x3b1ed5['ListId']){throw new Error(_0xe6ec('0x78'));}}catch(_0x48f276){throw new Error('body\x20id\x20mandatory');}var _0x2b7168=[];try{_0x2b7168=_[_0xe6ec('0x79')](JSON[_0xe6ec('0x4d')](process[_0xe6ec('0x75')][0x4]),'id');}catch(_0x5978f4){logger[_0xe6ec('0x3c')](_0xe6ec('0x7a'));}main(_0x5bef1c,_0x3b1ed5,_0x2b7168,_0x373f02);}validate();process['on']('SIGINT',handleStop);process['on'](_0xe6ec('0x7b'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 7b034d3..7b563c6 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 _0x45bd=['contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','orderBy','DROP\x20TABLE\x20','finish','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/logger','redis','defaults','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','catch','error','message','split','length','filter','CmContactHasItem','findOne','update','updated','create','PHONE','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_hopper_black','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','min_id','group','info','Received\x20SIGINT','exit','sequelize','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','header','writeFileSync','data','rows','errors','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','UserId','includes','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','SystemRow','emit'];(function(_0x301831,_0x2af7c7){var _0x416dbe=function(_0x4f7ded){while(--_0x4f7ded){_0x301831['push'](_0x301831['shift']());}};_0x416dbe(++_0x2af7c7);}(_0x45bd,0xb5));var _0xd45b=function(_0x4a28b0,_0xfc2f61){_0x4a28b0=_0x4a28b0-0x0;var _0x5fe21=_0x45bd[_0x4a28b0];return _0x5fe21;};'use strict';var fs=require('fs');var path=require(_0xd45b('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0xd45b('0x1'));var BPromise=require(_0xd45b('0x2'));var moment=require(_0xd45b('0x3'));var squel=require('squel');var Redis=require(_0xd45b('0x4'));var db=require(_0xd45b('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0xd45b('0x6'))('import');config[_0xd45b('0x7')]=_[_0xd45b('0x8')](config[_0xd45b('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd45b('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()[_0xd45b('0x9')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xd45b('0xa')+moment()[_0xd45b('0x9')](_0xd45b('0xb'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x2d41b9){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))*$/[_0xd45b('0xc')](_0x2d41b9);}function selectNotIn(_0x21aa80,_0x2d3600,_0x553158,_0x558267,_0x36da4f){return squel[_0xd45b('0xd')]()[_0xd45b('0xe')](_0xd45b('0xf'))[_0xd45b('0x10')](_0x558267)[_0xd45b('0x11')](_0x2d3600,null,_0x2d3600+'.id\x20=\x20'+_0x558267+'.'+_0x553158)['where'](_0x558267+'.'+_0x553158+_0xd45b('0x12')+_0x21aa80+'.'+_0x553158)['where'](_0x2d3600+_0xd45b('0x13')+_0x36da4f[_0xd45b('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4bb69d,_0x17b90d){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xd45b('0x14')](_0xd45b('0x15')+tempTableName)[_0xd45b('0x16')](function(_0x18a610){if(_0x18a610!==null){var _0x16e8fe=[];for(var _0x2158bf=0x0;_0x2158bf<_0x18a610['length'];_0x2158bf++){var _0x368f94=_0x18a610[_0x2158bf];if(!_['isNil'](_0x368f94['phone'])){if(!_[_0xd45b('0x17')](_0x368f94[_0xd45b('0x18')]))_0x16e8fe[_0xd45b('0x19')](insertAdditionalPhones(_0x368f94));promisesContact[_0xd45b('0x19')]({'contact':_0x368f94});}}}Promise[_0xd45b('0x1a')](_0x16e8fe)[_0xd45b('0x1b')](function(){_0x4bb69d({'val':0x1});});})[_0xd45b('0x1c')](function(_0x5cbf0e){logger[_0xd45b('0x1d')](_0x5cbf0e[_0xd45b('0x1e')]);});});}function insertAdditionalPhones(_0x468117){return new Promise(function(_0xe7b234,_0x5f07c7){var _0x143e0f=_0x468117[_0xd45b('0x18')];if(_['isNil'](_0x143e0f))_0x5f07c7({'val':0x0});else{var _0x213017=_0x143e0f[_0xd45b('0x1f')](';');var _0xfc6b6a=[];orderBy=0x0;for(var _0x434c0a=0x0;_0x434c0a<_0x213017['length'];_0x434c0a++){_0xfc6b6a['push'](splitAdditionalPhone(_0x468117['id'],_0x213017[_0x434c0a]));}Promise['all'](_0xfc6b6a)[_0xd45b('0x1b')](function(){_0xe7b234({'val':_0x213017[_0xd45b('0x20')]});});}});}function splitAdditionalPhone(_0x373f30,_0x8fb7b6){return new Promise(function(_0x17be3a,_0x102222){var _0x312548=_0x8fb7b6['split'](':');var _0x168f5d=_0x312548[0x0];var _0x2c7b0d=_0x312548[0x1];if(_0x2c7b0d!==''){var _0x18cf94=_0x2c7b0d[_0xd45b('0x1f')]('|');var _0x5c81ad=[];for(var _0x364871=0x0;_0x364871<_0x18cf94[_0xd45b('0x20')];_0x364871++){if(_0x18cf94[_0x364871]!==''){var _0x10a962=_[_0xd45b('0x21')](promisesAdditionalPhones,{'contactId':_0x373f30,'phone':_0x18cf94[_0x364871]});if(_0x10a962['length']==0x0){orderBy++;promisesAdditionalPhones[_0xd45b('0x19')]({'contactId':_0x373f30,'contactTypeId':_0x168f5d,'phone':_0x18cf94[_0x364871],'orderBy':orderBy});}}}_0x17be3a({'ok':0x1});}else _0x17be3a({'res':0x0});});}function createAdditionalPhone(_0x3e9a84,_0x2d6cbe,_0x27e77e,_0x380c62){return new Promise(function(_0x523982,_0x473e4e){return db[_0xd45b('0x22')][_0xd45b('0x23')]({'where':{'CmContactId':_0x3e9a84,'item':_0x27e77e}})[_0xd45b('0x1b')](function(_0x1033d9){if(_0x1033d9){return db[_0xd45b('0x22')][_0xd45b('0x24')]({'ItemTypeId':_0x2d6cbe,'OrderBy':_0x380c62},{'where':{'CmContactId':_0x3e9a84,'item':_0x27e77e}})[_0xd45b('0x1b')](function(_0x424405){_0x523982({'res':_0xd45b('0x25')});});}else{return db['CmContactHasItem'][_0xd45b('0x26')]({'CmContactId':_0x3e9a84,'item':_0x27e77e,'ItemTypeId':_0x2d6cbe,'OrderBy':_0x380c62,'ItemClass':_0xd45b('0x27')})[_0xd45b('0x1b')](function(_0x1969e2){_0x523982({'res':'inserted'});});}});});}function updateContact(_0x2a1aff){return new Promise(function(_0xb9ec4b,_0x4af44e){var _0x4d4034=_0x2a1aff['id'];delete _0x2a1aff['id'];return db['CmContact'][_0xd45b('0x24')](_0x2a1aff,{'where':{'id':_0x4d4034}})[_0xd45b('0x1b')](function(_0x4f66af){updatedRows+=0x1;return db[_0xd45b('0x28')][_0xd45b('0x24')]({'phone':_0x2a1aff[_0xd45b('0xf')]},{'where':{'ContactId':_0x4d4034}})[_0xd45b('0x1b')](function(_0x5b7156){_0xb9ec4b({'ret':'OK'});});});});}function insertCmHopper(_0x3f410c,_0x178991,_0x399eef,_0x4ea734,_0x579c67){var _0x4aee8f=[_0xd45b('0x29'),_0xd45b('0x2a'),_0xd45b('0x2b'),_0xd45b('0x2c'),_0x178991+'.'+_0x4ea734,_0xd45b('0x2d'),_0xd45b('0x2e'),_0xd45b('0x2f'),_0xd45b('0x30'),'\x22'+_0x579c67+'\x22'];return squel['insert']()[_0xd45b('0x31')](_0xd45b('0x32'))[_0xd45b('0x33')]([_0xd45b('0xf'),_0xd45b('0x34'),_0xd45b('0x35'),_0xd45b('0x36'),_0x4ea734,_0xd45b('0x37'),_0xd45b('0x38'),_0xd45b('0x39'),'UserId',_0xd45b('0x3a')],squel[_0xd45b('0xd')]()[_0xd45b('0x3b')](_0x4aee8f)[_0xd45b('0x10')](_0x178991)['join'](_0xd45b('0x3c'),null,_0xd45b('0x3d')+_0x178991+_0xd45b('0x3e'))['join'](_0x399eef,null,_0x399eef+_0xd45b('0x3f')+_0x178991+'.'+_0x4ea734)[_0xd45b('0x40')](_0x178991+_0xd45b('0x41'),_0x3f410c)[_0xd45b('0x40')](_0xd45b('0x42'),NOW)[_0xd45b('0x40')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x178991,_0x399eef,_0x4ea734,'cm_hopper',[_0xd45b('0x43'),_0xd45b('0x44')]))[_0xd45b('0x40')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x178991,_0x399eef,_0x4ea734,'cm_hopper',[_0xd45b('0x43')])))[_0xd45b('0x45')]();}function insertCmHopperBlack(_0x29b9e5,_0x2647b9,_0x3cdb68,_0x4d29e8){var _0x44d8fa=[_0xd45b('0x29'),_0xd45b('0x2b'),_0xd45b('0x2c'),_0x2647b9+'.'+_0x4d29e8,_0xd45b('0x2d'),'cm_contacts.updatedAt'];return squel[_0xd45b('0x46')]()[_0xd45b('0x31')](_0xd45b('0x47'))['fromQuery']([_0xd45b('0xf'),_0xd45b('0x35'),'ListId',_0x4d29e8,_0xd45b('0x37'),_0xd45b('0x38')],squel['select']()[_0xd45b('0x3b')](_0x44d8fa)['from'](_0x2647b9)['join']('cm_contacts',null,_0xd45b('0x3d')+_0x2647b9+_0xd45b('0x3e'))[_0xd45b('0x11')](_0x3cdb68,null,_0x3cdb68+_0xd45b('0x3f')+_0x2647b9+'.'+_0x4d29e8)['where'](_0x2647b9+'.CmListId\x20=\x20?',_0x29b9e5)[_0xd45b('0x40')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xd45b('0x40')](_0xd45b('0x48'),squel[_0xd45b('0xd')]()[_0xd45b('0xe')](_0xd45b('0xf'))['from'](_0xd45b('0x47'))[_0xd45b('0x40')]('ListId\x20=\x20?',_0x29b9e5)[_0xd45b('0x40')](_0x4d29e8+_0xd45b('0x49'),_0x2647b9+'.'+_0x4d29e8)))['toString']();}function insertCmHopperAdditionalPhones(_0x15eeed){var _0x49b65c=[_0xd45b('0x4a'),_0xd45b('0x4b'),'cm_contact_has_items.OrderBy',_0xd45b('0x4c'),_0xd45b('0x4d')];return squel[_0xd45b('0x46')]()[_0xd45b('0x31')](_0xd45b('0x4e'))[_0xd45b('0x33')](['CmHopperId',_0xd45b('0xf'),_0xd45b('0x4f'),_0xd45b('0x37'),_0xd45b('0x38')],squel[_0xd45b('0xd')]()[_0xd45b('0x3b')](_0x49b65c)['from']('cm_hopper')[_0xd45b('0x11')](_0xd45b('0x3c'),null,_0xd45b('0x50'))[_0xd45b('0x11')]('cm_contact_has_items',null,_0xd45b('0x51'))[_0xd45b('0x40')](_0xd45b('0x52'),_0x15eeed)[_0xd45b('0x40')](_0xd45b('0x42'),NOW))[_0xd45b('0x45')]();}function insertCmContact(_0x2959d1,_0x1aafc2,_0xe2f64e,_0x3fc95f){var _0x5110f0=_[_0xd45b('0x53')](_[_0xd45b('0x54')](_0x3fc95f),[_0xd45b('0x36'),_0xd45b('0x55'),_0xd45b('0x37'),_0xd45b('0x38')]);return squel[_0xd45b('0x46')]()['into'](_0xd45b('0x3c'))[_0xd45b('0x33')](_0x5110f0,squel[_0xd45b('0xd')]()[_0xd45b('0x3b')](_0x5110f0)[_0xd45b('0x10')](_0x1aafc2)['where']('('+_0xe2f64e[_0xd45b('0x11')](',')+_0xd45b('0x56'),squel['select']()[_0xd45b('0x3b')](_0xe2f64e)[_0xd45b('0x10')](_0xd45b('0x3c'))[_0xd45b('0x40')](_0xd45b('0x57'),_0x2959d1))[_0xd45b('0x40')]('id\x20IN\x20?',squel[_0xd45b('0xd')]()[_0xd45b('0xe')]('MIN(id)',_0xd45b('0x58'))[_0xd45b('0x10')](_0x1aafc2)[_0xd45b('0x59')](_0xe2f64e[_0xd45b('0x11')](','))))[_0xd45b('0x45')]();}function handleStop(){logger[_0xd45b('0x5a')](_0xd45b('0x5b'));stopped=!![];}function handleUncaughtException(_0x3f947d){logger[_0xd45b('0x1d')](_0x3f947d[_0xd45b('0x1e')]);process[_0xd45b('0x5c')](0x1);}function handleError(_0x577f7a,_0x4cd651){stats['errors'][_0xd45b('0x19')]({'name':_0x4cd651['code'],'message':_0x4cd651['message'],'row':_0x577f7a});}function handleQuery(_0x5175c3){logger[_0xd45b('0x5a')](_0x5175c3);return db[_0xd45b('0x5d')][_0xd45b('0x14')](_0x5175c3)[_0xd45b('0x16')](function(_0x13ba52){results['push'](_0x13ba52);})['catch'](function(_0x3a5864){logger[_0xd45b('0x1d')](_0x3a5864[_0xd45b('0x1e')]);});}function main(_0xc83421,_0xb6a893,_0x25a8f5,_0xc812cf){logger[_0xd45b('0x5a')]('main',_0xc83421,JSON[_0xd45b('0x5e')](_0xb6a893));process[_0xd45b('0x5f')](_0xd45b('0x60'));var _0x4ab136=_0xb6a893['binding'];var _0x87f497=_[_0xd45b('0x61')](_0x4ab136);var _0x218d74=_0xb6a893[_0xd45b('0x62')];var _0x54ae40=path[_0xd45b('0x11')](config[_0xd45b('0x63')],_0xd45b('0x64'),_0x218d74+_0xd45b('0x65'));logger[_0xd45b('0x5a')](_0xd45b('0x66'),_0xb6a893);db[_0xd45b('0x67')][_0xd45b('0x68')]({'raw':!![],'attributes':['id','name']})[_0xd45b('0x1b')](function(_0x58d7d1){for(var _0x45218e=0x0;_0x45218e<_0x58d7d1['length'];_0x45218e++){if(_0x58d7d1[_0x45218e][_0xd45b('0x69')]in _0x4ab136){contactItemTypes['push'](_0x58d7d1[_0x45218e]);delete _0x87f497[_0x58d7d1[_0x45218e][_0xd45b('0x69')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x87f497['AdditionalPhones']='';var _0x3d4b39=_[_0xd45b('0x54')](_0x87f497)[_0xd45b('0x11')]();logger['info'](_0xd45b('0x6a'),_0x3d4b39);fs[_0xd45b('0x6b')](_0x54ae40,_0x3d4b39+'\x0a');Papa['parse'](fs['createReadStream'](_0xc83421),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1df1d7,_0x1b2c6c){try{for(var _0x26ef01=0x0,_0x4efd79=[];_0x26ef01<_0x1df1d7[_0xd45b('0x6c')][_0xd45b('0x20')];_0x26ef01++){stats[_0xd45b('0x6d')]+=0x1;if(_0x1df1d7[_0xd45b('0x6e')][_0x26ef01]){handleError(_0x1df1d7['data'][_0x26ef01],_0x1df1d7[_0xd45b('0x6e')][_0x26ef01]);}else{var _0x3364bf=[];var _0x156004=[];for(var _0x59e0bf in _0x4ab136){let _0x194508=contactItemTypes['find'](_0x2bef02=>_0x2bef02[_0xd45b('0x69')]===_0x59e0bf);if(_['isNil'](_0x194508)){if(_0x4ab136[_0xd45b('0x6f')](_0x59e0bf)){if(_0x1df1d7['data'][_0x26ef01][_0x4ab136[_0x59e0bf]]){var _0x3c6120=_[_0xd45b('0x70')](_0x1df1d7[_0xd45b('0x6c')][_0x26ef01][_0x4ab136[_0x59e0bf]][_0xd45b('0x71')](/"/g,'\x27'));switch(_0x59e0bf){case'scheduledat':var _0x24a6b4=moment(_0x3c6120,_0xd45b('0x72'),!![]);if(_0x24a6b4[_0xd45b('0x73')]()){_0x4efd79[_0xd45b('0x19')]('\x22'+_0x3c6120+'\x22');}else{_0x3364bf[_0xd45b('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x362552=parseInt(_0x3c6120);_0x3c6120=_[_0xd45b('0x74')](_0x362552)||_0x362552<0x0||_0x362552>0x4?_0xc812cf?0x3:0x2:_0x362552;_0x4efd79['push']('\x22'+_0x3c6120+'\x22');break;case _0xd45b('0x75'):var _0x3e403a=parseInt(_0x3c6120);if(_['isNumber'](_0x3e403a)&&_[_0xd45b('0x76')](_0x25a8f5,_0x3e403a)){_0x4efd79[_0xd45b('0x19')]('\x22'+_0x3e403a+'\x22');}else{_0x3364bf['push']('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x3c6120)){_0x4efd79[_0xd45b('0x19')]('\x22'+_0x3c6120+'\x22');}else{_0x3364bf['push'](_0xd45b('0x77'));}break;case _0xd45b('0x78'):var _0x2b8347=moment(_0x3c6120,_0xd45b('0x79'),!![]);if(_0x2b8347[_0xd45b('0x73')]()){_0x4efd79[_0xd45b('0x19')]('\x22'+_0x3c6120+'\x22');}else{_0x3364bf[_0xd45b('0x19')](_0xd45b('0x7a'));}break;default:_0x4efd79[_0xd45b('0x19')]('\x22'+_0x3c6120+'\x22');}}else{switch(_0x59e0bf){case'firstName':case _0xd45b('0xf'):_0x3364bf[_0xd45b('0x19')](_0x59e0bf+'\x20not\x20specified');break;default:_0x4efd79[_0xd45b('0x19')]('\x22\x22');}}}}else{var _0x32b9d6='';for(var _0x1dd35a=0x0;_0x1dd35a<_0x4ab136[_0x59e0bf][_0xd45b('0x20')];_0x1dd35a++){var _0x3c6120=_[_0xd45b('0x70')](_0x1df1d7[_0xd45b('0x6c')][_0x26ef01][_0x4ab136[_0x59e0bf][_0x1dd35a]][_0xd45b('0x71')](/"/g,'\x27'));if(_0x32b9d6=='')_0x32b9d6=_0x3c6120;else _0x32b9d6+='|'+_0x3c6120;}_0x156004[_0xd45b('0x19')](_0x194508['id']+':'+_0x32b9d6);}}if(hasAdditionalPhones){_0x4efd79[_0xd45b('0x19')]('\x22'+_0x156004[_0xd45b('0x11')](';')+'\x22');}if(_0x3364bf[_0xd45b('0x20')]){handleError(_0x1df1d7[_0xd45b('0x6c')][_0x26ef01],{'code':_0xd45b('0x7b'),'message':_0x3364bf[_0xd45b('0x11')]()});}else{fs['appendFileSync'](_0x54ae40,_0x4efd79[_0xd45b('0x11')]()+'\x0a');}_0x4efd79=[];}if(!(stats[_0xd45b('0x6d')]%0xc8)){socket[_0xd45b('0x7c')](_0xd45b('0x7d')+_0x218d74,stats);stats[_0xd45b('0x6e')]=[];}}if(stopped){logger[_0xd45b('0x5a')](_0xd45b('0x7e'));_0x1b2c6c[_0xd45b('0x7f')]();}}catch(_0x5bbe99){handleError(_0x1df1d7[_0xd45b('0x6c')][_0x26ef01],{'code':_0xd45b('0x80'),'message':_0x5bbe99[_0xd45b('0x1e')]});logger[_0xd45b('0x1d')](_0xd45b('0x81'),_0x5bbe99['message']);}},'complete':function(){try{var _0x7a1e40=[];var _0xc3e77d=tempTableName;_0x7a1e40[_0xd45b('0x19')](_0xd45b('0x82')+_0xc3e77d+_0xd45b('0x83'));logger[_0xd45b('0x5a')](_0xd45b('0x84'),contactItemTypes[_0xd45b('0x20')]);var _0x6bee5=util[_0xd45b('0x9')](_0xd45b('0x85'),_0x54ae40,_0xc3e77d,_0x3d4b39,_0xb6a893[_0xd45b('0x36')],_0xb6a893[_0xd45b('0x55')]||null,NOW,NOW);if(_[_0xd45b('0x17')](_0x4ab136[_0xd45b('0x34')])){_0x6bee5+=_0xd45b('0x86');}_0x7a1e40[_0xd45b('0x19')](_0x6bee5);BPromise[_0xd45b('0x87')](_0x7a1e40,handleQuery)[_0xd45b('0x1b')](function(_0x375df7){BPromise[_0xd45b('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x7a1e40=[];for(var _0x54fb4d=0x0;_0x54fb4d\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','../../../mysqldb','../../../config/environment','defaults','localhost','redis','format','cm_contacts_temp_','test','select','field','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','select\x20*\x20from\x20','spread','length','isNil','phone','AdditionalPhones','push','all','then','catch','error','split','filter','findOne','update','CmContactHasItem','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.scheduledat'];(function(_0x468985,_0x44c060){var _0x1855d4=function(_0x148af8){while(--_0x148af8){_0x468985['push'](_0x468985['shift']());}};_0x1855d4(++_0x44c060);}(_0x8aac,0x6c));var _0xc8aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aac[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0xc8aa('0x0'));var _=require(_0xc8aa('0x1'));var Papa=require(_0xc8aa('0x2'));var util=require(_0xc8aa('0x3'));var BPromise=require(_0xc8aa('0x4'));var moment=require(_0xc8aa('0x5'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0xc8aa('0x6'))['db'];var config=require(_0xc8aa('0x7'));var logger=require('../../../config/logger')('import');config['redis']=_[_0xc8aa('0x8')](config['redis'],{'host':_0xc8aa('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc8aa('0xa')]));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()[_0xc8aa('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xc8aa('0xc')+moment()['format']('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x5b813b){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))*$/[_0xc8aa('0xd')](_0x5b813b);}function selectNotIn(_0x2c3054,_0x2c6bb5,_0x5721be,_0x443f4c,_0x486d4f){return squel[_0xc8aa('0xe')]()[_0xc8aa('0xf')]('phone')[_0xc8aa('0x10')](_0x443f4c)['join'](_0x2c6bb5,null,_0x2c6bb5+_0xc8aa('0x11')+_0x443f4c+'.'+_0x5721be)[_0xc8aa('0x12')](_0x443f4c+'.'+_0x5721be+_0xc8aa('0x13')+_0x2c3054+'.'+_0x5721be)[_0xc8aa('0x12')](_0x2c6bb5+_0xc8aa('0x14')+_0x486d4f[_0xc8aa('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xb4ad1f,_0x33bb31){promisesAdditionalPhones=[];promisesContact=[];return db[_0xc8aa('0x16')]['query'](_0xc8aa('0x17')+tempTableName)[_0xc8aa('0x18')](function(_0x322011){if(_0x322011!==null){var _0xef6045=[];for(var _0x14ade7=0x0;_0x14ade7<_0x322011[_0xc8aa('0x19')];_0x14ade7++){var _0x55ff94=_0x322011[_0x14ade7];if(!_[_0xc8aa('0x1a')](_0x55ff94[_0xc8aa('0x1b')])){if(!_[_0xc8aa('0x1a')](_0x55ff94[_0xc8aa('0x1c')]))_0xef6045[_0xc8aa('0x1d')](insertAdditionalPhones(_0x55ff94));promisesContact['push']({'contact':_0x55ff94});}}}Promise[_0xc8aa('0x1e')](_0xef6045)[_0xc8aa('0x1f')](function(){_0xb4ad1f({'val':0x1});});})[_0xc8aa('0x20')](function(_0x35c4bc){logger[_0xc8aa('0x21')](_0x35c4bc['message']);});});}function insertAdditionalPhones(_0x563ad7){return new Promise(function(_0x4e0abe,_0x290c5c){var _0x4ab4e8=_0x563ad7['AdditionalPhones'];if(_[_0xc8aa('0x1a')](_0x4ab4e8))_0x290c5c({'val':0x0});else{var _0x31a629=_0x4ab4e8['split'](';');var _0x186c95=[];orderBy=0x0;for(var _0x37f782=0x0;_0x37f782<_0x31a629['length'];_0x37f782++){_0x186c95[_0xc8aa('0x1d')](splitAdditionalPhone(_0x563ad7['id'],_0x31a629[_0x37f782]));}Promise[_0xc8aa('0x1e')](_0x186c95)[_0xc8aa('0x1f')](function(){_0x4e0abe({'val':_0x31a629[_0xc8aa('0x19')]});});}});}function splitAdditionalPhone(_0x42d3c7,_0x1fd677){return new Promise(function(_0x48a884,_0x539ab0){var _0x9856eb=_0x1fd677[_0xc8aa('0x22')](':');var _0x262a9b=_0x9856eb[0x0];var _0x49dce4=_0x9856eb[0x1];if(_0x49dce4!==''){var _0x56e89a=_0x49dce4[_0xc8aa('0x22')]('|');var _0x31bfc1=[];for(var _0x22a807=0x0;_0x22a807<_0x56e89a['length'];_0x22a807++){if(_0x56e89a[_0x22a807]!==''){var _0x4c7048=_[_0xc8aa('0x23')](promisesAdditionalPhones,{'contactId':_0x42d3c7,'phone':_0x56e89a[_0x22a807]});if(_0x4c7048[_0xc8aa('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0xc8aa('0x1d')]({'contactId':_0x42d3c7,'contactTypeId':_0x262a9b,'phone':_0x56e89a[_0x22a807],'orderBy':orderBy});}}}_0x48a884({'ok':0x1});}else _0x48a884({'res':0x0});});}function createAdditionalPhone(_0x15e365,_0xb8cb6f,_0xe1c2d8,_0x45464b){return new Promise(function(_0x3333fc,_0x570265){return db['CmContactHasItem'][_0xc8aa('0x24')]({'where':{'CmContactId':_0x15e365,'item':_0xe1c2d8}})['then'](function(_0x29af41){if(_0x29af41){return db['CmContactHasItem'][_0xc8aa('0x25')]({'ItemTypeId':_0xb8cb6f,'OrderBy':_0x45464b},{'where':{'CmContactId':_0x15e365,'item':_0xe1c2d8}})['then'](function(_0x3cf68d){_0x3333fc({'res':'updated'});});}else{return db[_0xc8aa('0x26')][_0xc8aa('0x27')]({'CmContactId':_0x15e365,'item':_0xe1c2d8,'ItemTypeId':_0xb8cb6f,'OrderBy':_0x45464b,'ItemClass':_0xc8aa('0x28')})[_0xc8aa('0x1f')](function(_0x3cb109){_0x3333fc({'res':_0xc8aa('0x29')});});}});});}function updateContact(_0x2b383d){return new Promise(function(_0x3c57d1,_0x1e985e){var _0x566070=_0x2b383d['id'];delete _0x2b383d['id'];return db[_0xc8aa('0x2a')][_0xc8aa('0x25')](_0x2b383d,{'where':{'id':_0x566070}})[_0xc8aa('0x1f')](function(_0x5a0caf){updatedRows+=0x1;return db[_0xc8aa('0x2b')][_0xc8aa('0x25')]({'phone':_0x2b383d[_0xc8aa('0x1b')]},{'where':{'ContactId':_0x566070}})[_0xc8aa('0x1f')](function(_0x11ac68){_0x3c57d1({'ret':'OK'});});});});}function insertCmHopper(_0x47682c,_0x32a9bc,_0x17717b,_0x29c694,_0x4bade3){var _0x1afcf6=['cm_contacts.phone',_0xc8aa('0x2c'),_0xc8aa('0x2d'),_0xc8aa('0x2e'),_0x32a9bc+'.'+_0x29c694,_0xc8aa('0x2f'),_0xc8aa('0x30'),_0xc8aa('0x31'),_0xc8aa('0x32'),'\x22'+_0x4bade3+'\x22'];return squel['insert']()['into']('cm_hopper')[_0xc8aa('0x33')]([_0xc8aa('0x1b'),'scheduledat',_0xc8aa('0x34'),_0xc8aa('0x35'),_0x29c694,'createdAt','updatedAt',_0xc8aa('0x36'),_0xc8aa('0x37'),_0xc8aa('0x38')],squel[_0xc8aa('0xe')]()[_0xc8aa('0x39')](_0x1afcf6)[_0xc8aa('0x10')](_0x32a9bc)['join']('cm_contacts',null,_0xc8aa('0x3a')+_0x32a9bc+_0xc8aa('0x3b'))[_0xc8aa('0x15')](_0x17717b,null,_0x17717b+_0xc8aa('0x11')+_0x32a9bc+'.'+_0x29c694)[_0xc8aa('0x12')](_0x32a9bc+_0xc8aa('0x3c'),_0x47682c)[_0xc8aa('0x12')](_0xc8aa('0x3d'),NOW)[_0xc8aa('0x12')](_0xc8aa('0x3e'),selectNotIn(_0x32a9bc,_0x17717b,_0x29c694,_0xc8aa('0x3f'),[_0xc8aa('0x40'),'\x22onlyIfOpen\x22']))['where'](_0xc8aa('0x3e'),selectNotIn(_0x32a9bc,_0x17717b,_0x29c694,_0xc8aa('0x3f'),[_0xc8aa('0x40')])))[_0xc8aa('0x41')]();}function insertCmHopperBlack(_0x50e6a5,_0x474f7e,_0x34deaa,_0x20019e){var _0x397f21=[_0xc8aa('0x42'),_0xc8aa('0x2d'),_0xc8aa('0x2e'),_0x474f7e+'.'+_0x20019e,_0xc8aa('0x2f'),_0xc8aa('0x30')];return squel[_0xc8aa('0x43')]()['into'](_0xc8aa('0x44'))['fromQuery']([_0xc8aa('0x1b'),_0xc8aa('0x34'),_0xc8aa('0x35'),_0x20019e,'createdAt',_0xc8aa('0x45')],squel['select']()['fields'](_0x397f21)[_0xc8aa('0x10')](_0x474f7e)['join'](_0xc8aa('0x46'),null,_0xc8aa('0x3a')+_0x474f7e+_0xc8aa('0x3b'))['join'](_0x34deaa,null,_0x34deaa+'.id\x20=\x20'+_0x474f7e+'.'+_0x20019e)['where'](_0x474f7e+_0xc8aa('0x3c'),_0x50e6a5)[_0xc8aa('0x12')](_0xc8aa('0x3d'),NOW)[_0xc8aa('0x12')](_0xc8aa('0x3e'),squel['select']()[_0xc8aa('0xf')](_0xc8aa('0x1b'))['from'](_0xc8aa('0x44'))['where'](_0xc8aa('0x47'),_0x50e6a5)[_0xc8aa('0x12')](_0x20019e+_0xc8aa('0x48'),_0x474f7e+'.'+_0x20019e)))[_0xc8aa('0x41')]();}function insertCmHopperAdditionalPhones(_0x547ae9){var _0x1e0897=[_0xc8aa('0x49'),_0xc8aa('0x4a'),_0xc8aa('0x4b'),'cm_contact_has_items.createdAt',_0xc8aa('0x4c')];return squel['insert']()[_0xc8aa('0x4d')](_0xc8aa('0x4e'))['fromQuery']([_0xc8aa('0x4f'),_0xc8aa('0x1b'),'OrderBy',_0xc8aa('0x50'),_0xc8aa('0x45')],squel[_0xc8aa('0xe')]()[_0xc8aa('0x39')](_0x1e0897)[_0xc8aa('0x10')](_0xc8aa('0x3f'))[_0xc8aa('0x15')](_0xc8aa('0x46'),null,_0xc8aa('0x51'))[_0xc8aa('0x15')](_0xc8aa('0x52'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xc8aa('0x12')](_0xc8aa('0x53'),_0x547ae9)[_0xc8aa('0x12')](_0xc8aa('0x3d'),NOW))[_0xc8aa('0x41')]();}function insertCmContact(_0x4347a2,_0x48f0f2,_0x5f418f,_0x595c24){var _0x5d9f57=_[_0xc8aa('0x54')](_[_0xc8aa('0x55')](_0x595c24),[_0xc8aa('0x35'),_0xc8aa('0x56'),'createdAt',_0xc8aa('0x45')]);return squel[_0xc8aa('0x43')]()[_0xc8aa('0x4d')](_0xc8aa('0x46'))[_0xc8aa('0x33')](_0x5d9f57,squel[_0xc8aa('0xe')]()[_0xc8aa('0x39')](_0x5d9f57)[_0xc8aa('0x10')](_0x48f0f2)['where']('('+_0x5f418f['join'](',')+_0xc8aa('0x57'),squel[_0xc8aa('0xe')]()[_0xc8aa('0x39')](_0x5f418f)[_0xc8aa('0x10')](_0xc8aa('0x46'))['where'](_0xc8aa('0x47'),_0x4347a2))['where'](_0xc8aa('0x58'),squel[_0xc8aa('0xe')]()['field']('MIN(id)',_0xc8aa('0x59'))['from'](_0x48f0f2)[_0xc8aa('0x5a')](_0x5f418f[_0xc8aa('0x15')](','))))['toString']();}function handleStop(){logger[_0xc8aa('0x5b')](_0xc8aa('0x5c'));stopped=!![];}function handleUncaughtException(_0x573bbe){logger['error'](_0x573bbe[_0xc8aa('0x5d')]);process['exit'](0x1);}function handleError(_0x3b6ab5,_0x1519a7){stats[_0xc8aa('0x5e')][_0xc8aa('0x1d')]({'name':_0x1519a7['code'],'message':_0x1519a7[_0xc8aa('0x5d')],'row':_0x3b6ab5});}function handleQuery(_0x3b0c53){logger[_0xc8aa('0x5b')](_0x3b0c53);return db[_0xc8aa('0x16')][_0xc8aa('0x5f')](_0x3b0c53)[_0xc8aa('0x18')](function(_0x504076){results[_0xc8aa('0x1d')](_0x504076);})[_0xc8aa('0x20')](function(_0xa991ac){logger[_0xc8aa('0x21')](_0xa991ac['message']);});}function main(_0x204b08,_0x475169,_0x1c5091,_0x4addb2){logger['info']('main',_0x204b08,JSON['stringify'](_0x475169));process[_0xc8aa('0x60')]('start');var _0x3ce4e7=_0x475169[_0xc8aa('0x61')];var _0x40d6c4=_[_0xc8aa('0x62')](_0x3ce4e7);var _0x4a7aa8=_0x475169[_0xc8aa('0x63')];var _0x2c6679=path[_0xc8aa('0x15')](config[_0xc8aa('0x64')],_0xc8aa('0x65'),_0x4a7aa8+'.csv');logger[_0xc8aa('0x5b')](_0xc8aa('0x66'),_0x475169);db['ContactItemType'][_0xc8aa('0x67')]({'raw':!![],'attributes':['id',_0xc8aa('0x68')]})[_0xc8aa('0x1f')](function(_0x18e2e3){for(var _0x55e3c8=0x0;_0x55e3c8<_0x18e2e3[_0xc8aa('0x19')];_0x55e3c8++){if(_0x18e2e3[_0x55e3c8][_0xc8aa('0x68')]in _0x3ce4e7){contactItemTypes['push'](_0x18e2e3[_0x55e3c8]);delete _0x40d6c4[_0x18e2e3[_0x55e3c8][_0xc8aa('0x68')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x40d6c4[_0xc8aa('0x1c')]='';var _0x23a43e=_[_0xc8aa('0x55')](_0x40d6c4)[_0xc8aa('0x15')]();logger[_0xc8aa('0x5b')](_0xc8aa('0x69'),_0x23a43e);fs[_0xc8aa('0x6a')](_0x2c6679,_0x23a43e+'\x0a');Papa['parse'](fs[_0xc8aa('0x6b')](_0x204b08),{'header':!![],'skipEmptyLines':!![],'step':function(_0x13f414,_0x196ed3){try{for(var _0x238414=0x0,_0x445b10=[];_0x238414<_0x13f414['data'][_0xc8aa('0x19')];_0x238414++){stats[_0xc8aa('0x6c')]+=0x1;if(_0x13f414[_0xc8aa('0x5e')][_0x238414]){handleError(_0x13f414[_0xc8aa('0x6d')][_0x238414],_0x13f414['errors'][_0x238414]);}else{var _0x381285=[];var _0x396b4b=[];for(var _0x1e4665 in _0x3ce4e7){let _0x4ca5de=contactItemTypes['find'](_0x4ce319=>_0x4ce319[_0xc8aa('0x68')]===_0x1e4665);if(_['isNil'](_0x4ca5de)){if(_0x3ce4e7[_0xc8aa('0x6e')](_0x1e4665)){if(_0x13f414[_0xc8aa('0x6d')][_0x238414][_0x3ce4e7[_0x1e4665]]){var _0x1fddc1=_[_0xc8aa('0x6f')](_0x13f414[_0xc8aa('0x6d')][_0x238414][_0x3ce4e7[_0x1e4665]][_0xc8aa('0x70')](/"/g,'\x27'));switch(_0x1e4665){case'scheduledat':var _0x137ce1=moment(_0x1fddc1,_0xc8aa('0x71'),!![]);if(_0x137ce1[_0xc8aa('0x72')]()){_0x445b10[_0xc8aa('0x1d')]('\x22'+_0x1fddc1+'\x22');}else{_0x381285[_0xc8aa('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x2c0c3=parseInt(_0x1fddc1);_0x1fddc1=_[_0xc8aa('0x73')](_0x2c0c3)||_0x2c0c3<0x0||_0x2c0c3>0x4?_0x4addb2?0x3:0x2:_0x2c0c3;_0x445b10[_0xc8aa('0x1d')]('\x22'+_0x1fddc1+'\x22');break;case'UserId':var _0x55120a=parseInt(_0x1fddc1);if(_[_0xc8aa('0x74')](_0x55120a)&&_['includes'](_0x1c5091,_0x55120a)){_0x445b10[_0xc8aa('0x1d')]('\x22'+_0x55120a+'\x22');}else{_0x381285['push'](_0xc8aa('0x75'));}break;case _0xc8aa('0x76'):if(isEmail(_0x1fddc1)){_0x445b10[_0xc8aa('0x1d')]('\x22'+_0x1fddc1+'\x22');}else{_0x381285[_0xc8aa('0x1d')](_0xc8aa('0x77'));}break;case _0xc8aa('0x78'):var _0x2971a2=moment(_0x1fddc1,_0xc8aa('0x79'),!![]);if(_0x2971a2[_0xc8aa('0x72')]()){_0x445b10['push']('\x22'+_0x1fddc1+'\x22');}else{_0x381285['push'](_0xc8aa('0x7a'));}break;default:_0x445b10[_0xc8aa('0x1d')]('\x22'+_0x1fddc1+'\x22');}}else{switch(_0x1e4665){case'firstName':case _0xc8aa('0x1b'):_0x381285['push'](_0x1e4665+_0xc8aa('0x7b'));break;default:_0x445b10[_0xc8aa('0x1d')]('\x22\x22');}}}}else{var _0x367fd6='';for(var _0x369b42=0x0;_0x369b42<_0x3ce4e7[_0x1e4665][_0xc8aa('0x19')];_0x369b42++){var _0x1fddc1=_[_0xc8aa('0x6f')](_0x13f414[_0xc8aa('0x6d')][_0x238414][_0x3ce4e7[_0x1e4665][_0x369b42]]['replace'](/"/g,'\x27'));if(_0x367fd6=='')_0x367fd6=_0x1fddc1;else _0x367fd6+='|'+_0x1fddc1;}_0x396b4b[_0xc8aa('0x1d')](_0x4ca5de['id']+':'+_0x367fd6);}}if(hasAdditionalPhones){_0x445b10[_0xc8aa('0x1d')]('\x22'+_0x396b4b[_0xc8aa('0x15')](';')+'\x22');}if(_0x381285[_0xc8aa('0x19')]){handleError(_0x13f414[_0xc8aa('0x6d')][_0x238414],{'code':_0xc8aa('0x7c'),'message':_0x381285[_0xc8aa('0x15')]()});}else{fs[_0xc8aa('0x7d')](_0x2c6679,_0x445b10[_0xc8aa('0x15')]()+'\x0a');}_0x445b10=[];}if(!(stats[_0xc8aa('0x6c')]%0xc8)){socket[_0xc8aa('0x7e')](_0xc8aa('0x7f')+_0x4a7aa8,stats);stats[_0xc8aa('0x5e')]=[];}}if(stopped){logger[_0xc8aa('0x5b')](_0xc8aa('0x80'));_0x196ed3[_0xc8aa('0x81')]();}}catch(_0x2bec96){handleError(_0x13f414[_0xc8aa('0x6d')][_0x238414],{'code':_0xc8aa('0x82'),'message':_0x2bec96[_0xc8aa('0x5d')]});logger[_0xc8aa('0x21')](_0xc8aa('0x83'),_0x2bec96[_0xc8aa('0x5d')]);}},'complete':function(){try{var _0x2a891e=[];var _0x1fa4fc=tempTableName;_0x2a891e[_0xc8aa('0x1d')](_0xc8aa('0x84')+_0x1fa4fc+_0xc8aa('0x85'));logger[_0xc8aa('0x5b')]('CIS\x20len',contactItemTypes['length']);var _0x45e34d=util['format'](_0xc8aa('0x86'),_0x2c6679,_0x1fa4fc,_0x23a43e,_0x475169[_0xc8aa('0x35')],_0x475169[_0xc8aa('0x56')]||null,NOW,NOW);if(_['isNil'](_0x3ce4e7[_0xc8aa('0x87')])){_0x45e34d+=_0xc8aa('0x88');}_0x2a891e[_0xc8aa('0x1d')](_0x45e34d);BPromise[_0xc8aa('0x89')](_0x2a891e,handleQuery)[_0xc8aa('0x1f')](function(_0x4a3480){BPromise[_0xc8aa('0x1e')]([handleAdditionalPhones()])[_0xc8aa('0x1f')](function(){_0x2a891e=[];for(var _0x5aba44=0x0;_0x5aba44=_0x4014b3){return _0x79ef60[_0x171b('0x13')](0x193)[_0x171b('0x14')]({'message':util[_0x171b('0x9')](_0x171b('0x15'),_0x3717d9)});}_0xe4a24f();})[_0x171b('0x16')](function(_0x1e0771){_0xe4a24f(_0x1e0771);});});}function isUserLimit(){return isLimit(_0x171b('0x17'),0x1,db[_0x171b('0x18')],{'where':{'$or':[{'role':_0x171b('0x19')},{'role':_0x171b('0x1a')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xa5c2=['status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','License','count','then'];(function(_0x1c3162,_0x509987){var _0x53ef9a=function(_0x24ac80){while(--_0x24ac80){_0x1c3162['push'](_0x1c3162['shift']());}};_0x53ef9a(++_0x509987);}(_0xa5c2,0x11a));var _0x2a5c=function(_0x3a99f4,_0x2a81c1){_0x3a99f4=_0x3a99f4-0x0;var _0xea0b42=_0xa5c2[_0x3a99f4];return _0xea0b42;};'use strict';var crypto=require(_0x2a5c('0x0'));var util=require(_0x2a5c('0x1'));var compose=require(_0x2a5c('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x2a5c('0x3'));function getValueFromLicense(_0x4e04be,_0x4fd515){if(_0x4e04be&&_0x4fd515){if(_0x4fd515['data1']&&_0x4fd515['license']){var _0x22fa54=_0x4fd515[_0x2a5c('0x4')];var _0x586666=_0x4fd515[_0x2a5c('0x5')];var _0x5c77d6=_0x22fa54[_0x2a5c('0x6')]('-')[0x4];var _0x1476c6=_0x22fa54[_0x2a5c('0x6')]('-')[0x0];var _0x1e0484=crypto['createDecipher'](_0x2a5c('0x7'),util[_0x2a5c('0x8')](_0x2a5c('0x9'),_0x5c77d6,_0x22fa54,_0x1476c6));var _0x925eb=_0x1e0484[_0x2a5c('0xa')](_0x586666,_0x2a5c('0xb'),_0x2a5c('0xc'));_0x925eb+=_0x1e0484['final'](_0x2a5c('0xc'));var _0x4b0c81=JSON[_0x2a5c('0xd')](_0x925eb);return _0x4b0c81['hasOwnProperty'](_0x4e04be)?_0x4b0c81[_0x4e04be]:null;}}return null;}function isLimit(_0x4afffd,_0x25312a,_0x1d5849,_0x1da6bf){var _0x5eb5f8=_0x25312a;return compose()['use'](function(_0x20a326,_0x524831,_0x321b3f){return db[_0x2a5c('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x35f2d2){var _0x26e713=getValueFromLicense(_0x4afffd,_0x35f2d2);return _0x26e713?_0x26e713:_0x5eb5f8;})['then'](function(_0x3cce6b){_0x5eb5f8=_0x3cce6b;return _0x1d5849[_0x2a5c('0xf')](_0x1da6bf);})[_0x2a5c('0x10')](function(_0x1db9e2){if(_0x1db9e2>=_0x5eb5f8){return _0x524831[_0x2a5c('0x11')](0x193)['json']({'message':util['format'](_0x2a5c('0x12'),_0x4afffd)});}_0x321b3f();})['catch'](function(_0x53c32){_0x321b3f(_0x53c32);});});}function isUserLimit(){return isLimit(_0x2a5c('0x13'),0x1,db[_0x2a5c('0x14')],{'where':{'$or':[{'role':_0x2a5c('0x15')},{'role':'user'}]}});}exports[_0x2a5c('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index bc026ae..bde9806 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 _0xaef4=['castTo','field','text','$ne','$in','IN\x20?','$notIn','$eq','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$gt','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','forEach','shift','match','filter','indexOf','conditions','push','operator','$between','value','includes','$lte','add','days','format','YYYY-MM-DD'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0xaef4,0x158));var _0x4aef=function(_0x350fd2,_0x46c2ee){_0x350fd2=_0x350fd2-0x0;var _0xa5ea08=_0xaef4[_0x350fd2];return _0xa5ea08;};'use strict';var _=require('lodash');var moment=require(_0x4aef('0x0'));exports[_0x4aef('0x1')]=function(_0x5de1c0){var _0xdeab16={'conditions':[]};_0xdeab16[_0x4aef('0x2')]=_[_0x4aef('0x3')](_0x5de1c0,_0x4aef('0x4'))?'or':_0x4aef('0x5');var _0x5b9c70=_0x5de1c0[_0x4aef('0x6')]('[$and]','')['replace'](_0x4aef('0x4'),'')['split']('||');for(var _0x2747e6=0x0;_0x2747e6<_0x5b9c70['length'];_0x2747e6++){var _0x3a1af2=_0x5b9c70[_0x2747e6][_0x4aef('0x7')](':=');var _0x30586e=_0x3a1af2[0x0];var _0x19e60c=_0x3a1af2['slice'](0x1);_0x19e60c[_0x4aef('0x8')](function(_0x20b322){var _0x394f88=_0x20b322[_0x4aef('0x7')]('[')[_0x4aef('0x9')]();var _0x409d81=_0x20b322[_0x4aef('0xa')](/\[(.*?)\]/g);_0x409d81[_0x4aef('0x8')](function(_0x11d4d0){var _0x411fa3=_0x11d4d0[_0x4aef('0x7')]('[')[_0x4aef('0xb')](function(_0x4de4b2){return _0x4de4b2[_0x4aef('0xc')](']')>-0x1;})['map'](function(_0x4e22ba){return _0x4e22ba[_0x4aef('0x7')](']')[0x0];})[0x0];_0xdeab16[_0x4aef('0xd')][_0x4aef('0xe')]({'field':_0x30586e,'operator':_0x394f88,'value':_0x411fa3});});});}return _0xdeab16;};exports['buildExpression']=function(_0xdb235f,_0x2a2b94,_0x2f3d8f){var _0x58281e={};if(_0x2a2b94==='DATE'){if(_0x2f3d8f[_0x4aef('0xf')]==='$eq'){_0x2f3d8f[_0x4aef('0xf')]=_0x4aef('0x10');_0x2f3d8f['value']+=','+_0x2f3d8f[_0x4aef('0x11')];}else if(_[_0x4aef('0x12')](['$gt',_0x4aef('0x13')],_0x2f3d8f[_0x4aef('0xf')])){_0x2f3d8f['value']=moment(_0x2f3d8f[_0x4aef('0x11')])[_0x4aef('0x14')](0x1,_0x4aef('0x15'))[_0x4aef('0x16')](_0x4aef('0x17'));}}if(_0x2f3d8f[_0x4aef('0x18')]){_0x2a2b94=_0x2f3d8f[_0x4aef('0x18')];_0x58281e['text']='CAST('+_0xdb235f+'.'+_0x2f3d8f[_0x4aef('0x19')]+'\x20AS\x20'+_0x2f3d8f[_0x4aef('0x18')]+')\x20'+parseOperator(_0x2f3d8f[_0x4aef('0xf')]);}else{_0x58281e[_0x4aef('0x1a')]=_0xdb235f+'.'+_0x2f3d8f[_0x4aef('0x19')]+'\x20'+parseOperator(_0x2f3d8f[_0x4aef('0xf')]);}if(_[_0x4aef('0x12')]([_0x4aef('0x1b'),'$notIn'],_0x2f3d8f[_0x4aef('0xf')]))_0x58281e[_0x4aef('0x1a')]='('+_0x58281e['text']+'\x20OR\x20'+_0xdb235f+'.'+_0x2f3d8f[_0x4aef('0x19')]+'\x20IS\x20NULL)';_0x58281e[_0x4aef('0x11')]=parseValue(_0x2a2b94,_0x2f3d8f['operator'],_0x2f3d8f[_0x4aef('0x11')]);return _0x58281e;};function parseOperator(_0x105e40){var _0x29116e;switch(_0x105e40){case _0x4aef('0x1c'):_0x29116e=_0x4aef('0x1d');break;case _0x4aef('0x1e'):_0x29116e='NOT\x20IN\x20?';break;case _0x4aef('0x1f'):_0x29116e=_0x4aef('0x20');break;case _0x4aef('0x1b'):_0x29116e='<>\x20?';break;case _0x4aef('0x21'):case _0x4aef('0x22'):case _0x4aef('0x23'):_0x29116e=_0x4aef('0x24');break;case'$lt':_0x29116e='<\x20?';break;case _0x4aef('0x25'):_0x29116e='>\x20?';break;case _0x4aef('0x13'):_0x29116e=_0x4aef('0x26');break;case'$gte':_0x29116e=_0x4aef('0x27');break;case'$between':_0x29116e=_0x4aef('0x28');break;}return _0x29116e;}function parseValue(_0x56ed4f,_0x101701,_0x3ad595){var _0x4039e7={'start':undefined,'end':undefined};switch(_0x101701){case _0x4aef('0x1c'):case _0x4aef('0x1e'):_0x4039e7[_0x4aef('0x29')]=_0x3ad595[_0x4aef('0x7')](',');break;case _0x4aef('0x21'):_0x4039e7['start']='%'+_0x3ad595+'%';break;case _0x4aef('0x22'):_0x4039e7[_0x4aef('0x29')]=_0x3ad595+'%';break;case _0x4aef('0x23'):_0x4039e7[_0x4aef('0x29')]='%'+_0x3ad595;break;case'$between':var _0x531b1a=_0x3ad595['split'](',');var _0x3ad595=_0x531b1a[_0x4aef('0x9')]();var _0x51be3c=_0x531b1a[_0x4aef('0x2a')]();if(_0x56ed4f===_0x4aef('0x2b')){_0x3ad595=moment(_0x3ad595)[_0x4aef('0x2c')](0x0,!![])['format']();_0x51be3c=moment(_0x51be3c)['utcOffset'](0x0,!![])[_0x4aef('0x14')](0x17,'hours')[_0x4aef('0x14')](0x3b,'minutes')['add'](0x3b,_0x4aef('0x2d'))[_0x4aef('0x16')]();}_0x4039e7={'start':_0x3ad595,'end':_0x51be3c};break;default:_0x4039e7['start']=_0x3ad595;break;}return _0x4039e7;} \ No newline at end of file +var _0xb4f6=['LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$in','start','utcOffset','format','hours','seconds','moment','parseSearch','[$or]','and','replace','split','length','slice','forEach','shift','match','filter','map','conditions','push','buildExpression','DATE','$eq','operator','$between','value','includes','$gt','$lte','add','YYYY-MM-DD','castTo','text','field','$notIn','\x20OR\x20','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$endsWith'];(function(_0x2be757,_0x32b312){var _0x195cff=function(_0x3a3e33){while(--_0x3a3e33){_0x2be757['push'](_0x2be757['shift']());}};_0x195cff(++_0x32b312);}(_0xb4f6,0x1ce));var _0x6b4f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4f6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var moment=require(_0x6b4f('0x0'));exports[_0x6b4f('0x1')]=function(_0xb2fbc4){var _0x12f5cd={'conditions':[]};_0x12f5cd['sqlOperator']=_['startsWith'](_0xb2fbc4,_0x6b4f('0x2'))?'or':_0x6b4f('0x3');var _0x379038=_0xb2fbc4[_0x6b4f('0x4')]('[$and]','')[_0x6b4f('0x4')]('[$or]','')[_0x6b4f('0x5')]('||');for(var _0x36f0ec=0x0;_0x36f0ec<_0x379038[_0x6b4f('0x6')];_0x36f0ec++){var _0x465f68=_0x379038[_0x36f0ec][_0x6b4f('0x5')](':=');var _0x3407de=_0x465f68[0x0];var _0x297f72=_0x465f68[_0x6b4f('0x7')](0x1);_0x297f72[_0x6b4f('0x8')](function(_0x186eff){var _0x220772=_0x186eff['split']('[')[_0x6b4f('0x9')]();var _0x22854d=_0x186eff[_0x6b4f('0xa')](/\[(.*?)\]/g);_0x22854d[_0x6b4f('0x8')](function(_0x31a09f){var _0x30ed79=_0x31a09f[_0x6b4f('0x5')]('[')[_0x6b4f('0xb')](function(_0x5e1ffa){return _0x5e1ffa['indexOf'](']')>-0x1;})[_0x6b4f('0xc')](function(_0x52a494){return _0x52a494[_0x6b4f('0x5')](']')[0x0];})[0x0];_0x12f5cd[_0x6b4f('0xd')][_0x6b4f('0xe')]({'field':_0x3407de,'operator':_0x220772,'value':_0x30ed79});});});}return _0x12f5cd;};exports[_0x6b4f('0xf')]=function(_0x1b4fcf,_0x566cbc,_0xd893ad){var _0x4529f6={};if(_0x566cbc===_0x6b4f('0x10')){if(_0xd893ad['operator']===_0x6b4f('0x11')){_0xd893ad[_0x6b4f('0x12')]=_0x6b4f('0x13');_0xd893ad[_0x6b4f('0x14')]+=','+_0xd893ad[_0x6b4f('0x14')];}else if(_[_0x6b4f('0x15')]([_0x6b4f('0x16'),_0x6b4f('0x17')],_0xd893ad[_0x6b4f('0x12')])){_0xd893ad[_0x6b4f('0x14')]=moment(_0xd893ad[_0x6b4f('0x14')])[_0x6b4f('0x18')](0x1,'days')['format'](_0x6b4f('0x19'));}}if(_0xd893ad[_0x6b4f('0x1a')]){_0x566cbc=_0xd893ad[_0x6b4f('0x1a')];_0x4529f6[_0x6b4f('0x1b')]='CAST('+_0x1b4fcf+'.'+_0xd893ad[_0x6b4f('0x1c')]+'\x20AS\x20'+_0xd893ad[_0x6b4f('0x1a')]+')\x20'+parseOperator(_0xd893ad[_0x6b4f('0x12')]);}else{_0x4529f6[_0x6b4f('0x1b')]=_0x1b4fcf+'.'+_0xd893ad[_0x6b4f('0x1c')]+'\x20'+parseOperator(_0xd893ad[_0x6b4f('0x12')]);}if(_[_0x6b4f('0x15')](['$ne',_0x6b4f('0x1d')],_0xd893ad[_0x6b4f('0x12')]))_0x4529f6[_0x6b4f('0x1b')]='('+_0x4529f6[_0x6b4f('0x1b')]+_0x6b4f('0x1e')+_0x1b4fcf+'.'+_0xd893ad[_0x6b4f('0x1c')]+'\x20IS\x20NULL)';_0x4529f6[_0x6b4f('0x14')]=parseValue(_0x566cbc,_0xd893ad['operator'],_0xd893ad[_0x6b4f('0x14')]);return _0x4529f6;};function parseOperator(_0x264116){var _0x2ba09f;switch(_0x264116){case'$in':_0x2ba09f=_0x6b4f('0x1f');break;case _0x6b4f('0x1d'):_0x2ba09f=_0x6b4f('0x20');break;case _0x6b4f('0x11'):_0x2ba09f=_0x6b4f('0x21');break;case _0x6b4f('0x22'):_0x2ba09f=_0x6b4f('0x23');break;case _0x6b4f('0x24'):case'$startsWith':case _0x6b4f('0x25'):_0x2ba09f=_0x6b4f('0x26');break;case'$lt':_0x2ba09f=_0x6b4f('0x27');break;case _0x6b4f('0x16'):_0x2ba09f=_0x6b4f('0x28');break;case _0x6b4f('0x17'):_0x2ba09f=_0x6b4f('0x29');break;case _0x6b4f('0x2a'):_0x2ba09f=_0x6b4f('0x2b');break;case _0x6b4f('0x13'):_0x2ba09f='BETWEEN\x20?\x20AND\x20?';break;}return _0x2ba09f;}function parseValue(_0x202fc2,_0x49891c,_0x552804){var _0x3058b1={'start':undefined,'end':undefined};switch(_0x49891c){case _0x6b4f('0x2c'):case _0x6b4f('0x1d'):_0x3058b1['start']=_0x552804[_0x6b4f('0x5')](',');break;case _0x6b4f('0x24'):_0x3058b1['start']='%'+_0x552804+'%';break;case'$startsWith':_0x3058b1[_0x6b4f('0x2d')]=_0x552804+'%';break;case'$endsWith':_0x3058b1[_0x6b4f('0x2d')]='%'+_0x552804;break;case _0x6b4f('0x13'):var _0x532058=_0x552804[_0x6b4f('0x5')](',');var _0x552804=_0x532058[_0x6b4f('0x9')]();var _0x44897f=_0x532058['pop']();if(_0x202fc2==='DATE'){_0x552804=moment(_0x552804)[_0x6b4f('0x2e')](0x0,!![])[_0x6b4f('0x2f')]();_0x44897f=moment(_0x44897f)[_0x6b4f('0x2e')](0x0,!![])[_0x6b4f('0x18')](0x17,_0x6b4f('0x30'))[_0x6b4f('0x18')](0x3b,'minutes')[_0x6b4f('0x18')](0x3b,_0x6b4f('0x31'))[_0x6b4f('0x2f')]();}_0x3058b1={'start':_0x552804,'end':_0x44897f};break;default:_0x3058b1[_0x6b4f('0x2d')]=_0x552804;break;}return _0x3058b1;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 2fcbc81..45a981e 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 _0x5cba=['hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','includes','push','join','lodash','sequelize','moment','split','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','offset','sort','priority','cast','col','unsigned','substr','ASC','omit','isObject','length'];(function(_0x62a56f,_0x4cedeb){var _0x156be0=function(_0x1bd40f){while(--_0x1bd40f){_0x62a56f['push'](_0x62a56f['shift']());}};_0x156be0(++_0x4cedeb);}(_0x5cba,0xab));var _0xa5cb=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x5cba[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xa5cb('0x0'));var sequelize=require(_0xa5cb('0x1'));var moment=require(_0xa5cb('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x190d2b){var _0x406d2e=null;if(_0x190d2b){_0x406d2e=_0x190d2b[_0xa5cb('0x3')](',');}return _0x406d2e;};exports['filters']=function(_0x423176,_0x2ed1cb){var _0x8283cd={};if(!_[_0xa5cb('0x4')](_0x423176)){_[_0xa5cb('0x5')](_0x423176,function(_0x476d5d,_0x9640ae){try{if(_0x2ed1cb){var _0x1fe581=_[_0xa5cb('0x6')](_0x2ed1cb,{'name':_0x9640ae})||{};if(_0x1fe581[_0xa5cb('0x7')]===_0xa5cb('0x8')&&_[_0xa5cb('0x9')](_0x476d5d)){var _0x4c32f1=JSON[_0xa5cb('0xa')](_0x476d5d);var _0x498725={'$gte':moment(moment(_0x4c32f1['$gte'])[_0xa5cb('0xb')](_0xa5cb('0xc')))[_0xa5cb('0xd')]()[_0xa5cb('0xb')](),'$lte':moment(moment(_0x4c32f1[_0xa5cb('0xe')])[_0xa5cb('0xb')]('YYYY-MM-DD'))[_0xa5cb('0xd')]()[_0xa5cb('0xf')](0x1,'s')['format']()};_0x8283cd[_0x9640ae]=_0x498725;}else{_0x8283cd[_0x9640ae]=_[_0xa5cb('0x10')](_0x476d5d)?_0x476d5d:JSON['parse'](_0x476d5d);}}else{_0x8283cd[_0x9640ae]=_['isArray'](_0x476d5d)?_0x476d5d:JSON[_0xa5cb('0xa')](_0x476d5d);}}catch(_0x58fe3f){_0x8283cd[_0x9640ae]=_0x476d5d[_0xa5cb('0x3')](',');}});}return _0x8283cd;};exports[_0xa5cb('0x11')]=function(_0x3eaefc){_0x3eaefc=parseInt(_0x3eaefc,0xa);if(!_0x3eaefc||_0x3eaefc<0x0){_0x3eaefc=LIMIT_VALUE;}return _0x3eaefc;};exports[_0xa5cb('0x12')]=function(_0x2a5123){_0x2a5123=parseInt(_0x2a5123,0xa);if(!_0x2a5123||_0x2a5123<0x0){_0x2a5123=0x0;}return _0x2a5123;};exports[_0xa5cb('0x13')]=function(_0x58492a){var _0xd5440f,_0x2a139a=null;if(_0x58492a){_0xd5440f=_0x58492a[_0xa5cb('0x3')](',');_0x2a139a=_['map'](_0xd5440f,function(_0x540f8e){if(_0x540f8e['indexOf']('-')===0x0){return[_0x540f8e===_0xa5cb('0x14')?sequelize[_0xa5cb('0x15')](sequelize[_0xa5cb('0x16')]('priority'),_0xa5cb('0x17')):_0x540f8e[_0xa5cb('0x18')](0x1),'DESC'];}else{return[_0x540f8e===_0xa5cb('0x14')?sequelize[_0xa5cb('0x15')](sequelize[_0xa5cb('0x16')]('priority'),_0xa5cb('0x17')):_0x540f8e,_0xa5cb('0x19')];}});}return _0x2a139a;};exports[_0xa5cb('0x1a')]=function(_0x4e847d,_0x407a62){if(_[_0xa5cb('0x4')](_0x4e847d)){return _0x4e847d;}if(_[_0xa5cb('0x10')](_0x4e847d)){for(var _0x5b6d63=0x0;_0x5b6d63<_0x4e847d['length'];_0x5b6d63+=0x1){_0x4e847d[_0x5b6d63]=this[_0xa5cb('0x1a')](_0x4e847d[_0x5b6d63],_0x407a62);}return _0x4e847d;}if(!_[_0xa5cb('0x1b')](_0x4e847d)){return _0x4e847d;}if(_['isString'](_0x407a62)){_0x407a62=[_0x407a62];}if(!_['isArray'](_0x407a62)){return _0x4e847d;}for(var _0x39d13e=0x0;_0x39d13e<_0x407a62[_0xa5cb('0x1c')];_0x39d13e+=0x1){_['unset'](_0x4e847d,_0x407a62[_0x39d13e]);}for(var _0x5526ae in _0x4e847d){if(_0x4e847d[_0xa5cb('0x1d')](_0x5526ae)){_0x4e847d[_0x5526ae]=this['omit'](_0x4e847d[_0x5526ae],_0x407a62);}}return _0x4e847d;};exports[_0xa5cb('0x1e')]=function(_0x28c911){return _0x28c911[_0xa5cb('0x1f')](RegExp(_0xa5cb('0x20')))?!![]:![];};exports[_0xa5cb('0x21')]=function(_0x20a13d){return _0x20a13d['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xa5cb('0x22')]=function(_0x59b789){var _0x19e172=[];_0x59b789[_0xa5cb('0x3')](/[ ,]+/)[_0xa5cb('0x23')](function(_0x5ce31f){_0x5ce31f=_0x5ce31f[_0xa5cb('0x24')](/([^:]")"+/g,'$1');_0x5ce31f='+'+_0x5ce31f+'*';if(_0x5ce31f[_0xa5cb('0x25')]('@'))_0x5ce31f='\x22'+_0x5ce31f+'\x22';_0x19e172[_0xa5cb('0x26')](_0x5ce31f);});return _0x19e172[_0xa5cb('0x27')]('\x20');}; \ No newline at end of file +var _0xf53e=['^[+]?[0-9]*$','isEmail','match','getFullTextValue','split','forEach','includes','join','lodash','moment','fields','filters','isEmpty','forOwn','find','type','DATE','parse','format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','sort','map','indexOf','priority','cast','DESC','col','unsigned','ASC','omit','length','isString','hasOwnProperty','isNumeric'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xf53e,0x167));var _0xef53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf53e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xef53('0x0'));var sequelize=require('sequelize');var moment=require(_0xef53('0x1'));var LIMIT_VALUE=0xfa;exports[_0xef53('0x2')]=function(_0x31a48d){var _0x1fc93e=null;if(_0x31a48d){_0x1fc93e=_0x31a48d['split'](',');}return _0x1fc93e;};exports[_0xef53('0x3')]=function(_0x1a181a,_0xb6c446){var _0x2bb876={};if(!_[_0xef53('0x4')](_0x1a181a)){_[_0xef53('0x5')](_0x1a181a,function(_0x18f1b1,_0x355430){try{if(_0xb6c446){var _0x24f570=_[_0xef53('0x6')](_0xb6c446,{'name':_0x355430})||{};if(_0x24f570[_0xef53('0x7')]===_0xef53('0x8')&&_['isPlainObject'](_0x18f1b1)){var _0x1df263=JSON[_0xef53('0x9')](_0x18f1b1);var _0x4b4d56={'$gte':moment(moment(_0x1df263['$gte'])[_0xef53('0xa')](_0xef53('0xb')))[_0xef53('0xc')]()['format'](),'$lte':moment(moment(_0x1df263[_0xef53('0xd')])[_0xef53('0xa')]('YYYY-MM-DD'))['utc']()[_0xef53('0xe')](0x1,'s')['format']()};_0x2bb876[_0x355430]=_0x4b4d56;}else{_0x2bb876[_0x355430]=_[_0xef53('0xf')](_0x18f1b1)?_0x18f1b1:JSON[_0xef53('0x9')](_0x18f1b1);}}else{_0x2bb876[_0x355430]=_[_0xef53('0xf')](_0x18f1b1)?_0x18f1b1:JSON['parse'](_0x18f1b1);}}catch(_0x1f349d){_0x2bb876[_0x355430]=_0x18f1b1['split'](',');}});}return _0x2bb876;};exports[_0xef53('0x10')]=function(_0x5b361f){_0x5b361f=parseInt(_0x5b361f,0xa);if(!_0x5b361f||_0x5b361f<0x0){_0x5b361f=LIMIT_VALUE;}return _0x5b361f;};exports['offset']=function(_0x403451){_0x403451=parseInt(_0x403451,0xa);if(!_0x403451||_0x403451<0x0){_0x403451=0x0;}return _0x403451;};exports[_0xef53('0x11')]=function(_0x444f2f){var _0x3f5828,_0xa8d259=null;if(_0x444f2f){_0x3f5828=_0x444f2f['split'](',');_0xa8d259=_[_0xef53('0x12')](_0x3f5828,function(_0x1f619b){if(_0x1f619b[_0xef53('0x13')]('-')===0x0){return[_0x1f619b===_0xef53('0x14')?sequelize[_0xef53('0x15')](sequelize['col'](_0xef53('0x14')),'unsigned'):_0x1f619b['substr'](0x1),_0xef53('0x16')];}else{return[_0x1f619b===_0xef53('0x14')?sequelize['cast'](sequelize[_0xef53('0x17')](_0xef53('0x14')),_0xef53('0x18')):_0x1f619b,_0xef53('0x19')];}});}return _0xa8d259;};exports[_0xef53('0x1a')]=function(_0x3744f8,_0x23b55f){if(_[_0xef53('0x4')](_0x3744f8)){return _0x3744f8;}if(_['isArray'](_0x3744f8)){for(var _0x3a4d3f=0x0;_0x3a4d3f<_0x3744f8[_0xef53('0x1b')];_0x3a4d3f+=0x1){_0x3744f8[_0x3a4d3f]=this[_0xef53('0x1a')](_0x3744f8[_0x3a4d3f],_0x23b55f);}return _0x3744f8;}if(!_['isObject'](_0x3744f8)){return _0x3744f8;}if(_[_0xef53('0x1c')](_0x23b55f)){_0x23b55f=[_0x23b55f];}if(!_[_0xef53('0xf')](_0x23b55f)){return _0x3744f8;}for(var _0x56bdd1=0x0;_0x56bdd1<_0x23b55f[_0xef53('0x1b')];_0x56bdd1+=0x1){_['unset'](_0x3744f8,_0x23b55f[_0x56bdd1]);}for(var _0x12fa7e in _0x3744f8){if(_0x3744f8[_0xef53('0x1d')](_0x12fa7e)){_0x3744f8[_0x12fa7e]=this[_0xef53('0x1a')](_0x3744f8[_0x12fa7e],_0x23b55f);}}return _0x3744f8;};exports[_0xef53('0x1e')]=function(_0x401536){return _0x401536['match'](RegExp(_0xef53('0x1f')))?!![]:![];};exports[_0xef53('0x20')]=function(_0x202420){return _0x202420[_0xef53('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xef53('0x22')]=function(_0x22fc0d){var _0x118df9=[];_0x22fc0d[_0xef53('0x23')](/[ ,]+/)[_0xef53('0x24')](function(_0x279f0b){_0x279f0b=_0x279f0b['replace'](/([^:]")"+/g,'$1');_0x279f0b='+'+_0x279f0b+'*';if(_0x279f0b[_0xef53('0x25')]('@'))_0x279f0b='\x22'+_0x279f0b+'\x22';_0x118df9['push'](_0x279f0b);});return _0x118df9[_0xef53('0x26')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f23a798..12f4d10 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33c6=['use','json\x20replacer','toISOString','static','/server/views','engine','html','renderFile','view\x20engine','urlencoded','50mb','json','initialize','body-parser','method-override','errorhandler','path','passport','cors','moment','./environment','../mysqldb','get','env','appPath','root','public','development','set','join','client'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x33c6,0x143));var _0x633c=function(_0x32185a,_0x140afb){_0x32185a=_0x32185a-0x0;var _0x750fdf=_0x33c6[_0x32185a];return _0x750fdf;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x633c('0x0'));var methodOverride=require(_0x633c('0x1'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x633c('0x2'));var path=require(_0x633c('0x3'));var passport=require(_0x633c('0x4'));var cors=require(_0x633c('0x5'));var moment=require(_0x633c('0x6'));var config=require(_0x633c('0x7'));var db=require(_0x633c('0x8'))['db'];exports['default']=function(_0xe192f7){var _0x2a6965=_0xe192f7[_0x633c('0x9')](_0x633c('0xa'));if(_0x2a6965==='production'){_0xe192f7['set'](_0x633c('0xb'),path['join'](config[_0x633c('0xc')],_0x633c('0xd')));}if(_0x2a6965===_0x633c('0xe')||_0x2a6965==='test'){_0xe192f7[_0x633c('0xf')](_0x633c('0xb'),path[_0x633c('0x10')](config[_0x633c('0xc')],_0x633c('0x11')));_0xe192f7[_0x633c('0x12')](errorHandler());}_0xe192f7['set'](_0x633c('0x13'),function(_0x183cb7,_0xbc6b5c){if(this[_0x183cb7]instanceof Date){_0xbc6b5c=this[_0x183cb7][_0x633c('0x14')]()['split']('.')[0x0]+'Z';}return _0xbc6b5c;});_0xe192f7[_0x633c('0x12')](express[_0x633c('0x15')](_0xe192f7[_0x633c('0x9')]('appPath')));_0xe192f7[_0x633c('0xf')]('views',config[_0x633c('0xc')]+_0x633c('0x16'));_0xe192f7[_0x633c('0x17')](_0x633c('0x18'),require('ejs')[_0x633c('0x19')]);_0xe192f7[_0x633c('0xf')](_0x633c('0x1a'),_0x633c('0x18'));_0xe192f7[_0x633c('0x12')](bodyParser[_0x633c('0x1b')]({'limit':_0x633c('0x1c'),'extended':!![]}));_0xe192f7[_0x633c('0x12')](bodyParser[_0x633c('0x1d')]({'limit':_0x633c('0x1c')}));_0xe192f7['use'](cors());_0xe192f7[_0x633c('0x12')](methodOverride());_0xe192f7['use'](cookieParser());_0xe192f7[_0x633c('0x12')](passport[_0x633c('0x1e')]());}; \ No newline at end of file +var _0xf6cb=['toISOString','split','/server/views','html','renderFile','view\x20engine','urlencoded','50mb','express','serve-favicon','method-override','cookie-parser','path','cors','moment','./environment','../mysqldb','get','set','join','root','development','appPath','use'];(function(_0x160787,_0x29f9bf){var _0x1c1bba=function(_0x10e824){while(--_0x10e824){_0x160787['push'](_0x160787['shift']());}};_0x1c1bba(++_0x29f9bf);}(_0xf6cb,0x98));var _0xbf6c=function(_0x4bc26d,_0x5cfa54){_0x4bc26d=_0x4bc26d-0x0;var _0x4f6425=_0xf6cb[_0x4bc26d];return _0x4f6425;};'use strict';var express=require(_0xbf6c('0x0'));var favicon=require(_0xbf6c('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0xbf6c('0x2'));var cookieParser=require(_0xbf6c('0x3'));var errorHandler=require('errorhandler');var path=require(_0xbf6c('0x4'));var passport=require('passport');var cors=require(_0xbf6c('0x5'));var moment=require(_0xbf6c('0x6'));var config=require(_0xbf6c('0x7'));var db=require(_0xbf6c('0x8'))['db'];exports['default']=function(_0x312275){var _0x576400=_0x312275[_0xbf6c('0x9')]('env');if(_0x576400==='production'){_0x312275[_0xbf6c('0xa')]('appPath',path[_0xbf6c('0xb')](config[_0xbf6c('0xc')],'public'));}if(_0x576400===_0xbf6c('0xd')||_0x576400==='test'){_0x312275[_0xbf6c('0xa')](_0xbf6c('0xe'),path[_0xbf6c('0xb')](config['root'],'client'));_0x312275[_0xbf6c('0xf')](errorHandler());}_0x312275['set']('json\x20replacer',function(_0x58d5fa,_0x5643c8){if(this[_0x58d5fa]instanceof Date){_0x5643c8=this[_0x58d5fa][_0xbf6c('0x10')]()[_0xbf6c('0x11')]('.')[0x0]+'Z';}return _0x5643c8;});_0x312275['use'](express['static'](_0x312275['get'](_0xbf6c('0xe'))));_0x312275[_0xbf6c('0xa')]('views',config['root']+_0xbf6c('0x12'));_0x312275['engine'](_0xbf6c('0x13'),require('ejs')[_0xbf6c('0x14')]);_0x312275[_0xbf6c('0xa')](_0xbf6c('0x15'),_0xbf6c('0x13'));_0x312275[_0xbf6c('0xf')](bodyParser[_0xbf6c('0x16')]({'limit':'50mb','extended':!![]}));_0x312275[_0xbf6c('0xf')](bodyParser['json']({'limit':_0xbf6c('0x17')}));_0x312275['use'](cors());_0x312275[_0xbf6c('0xf')](methodOverride());_0x312275[_0xbf6c('0xf')](cookieParser());_0x312275[_0xbf6c('0xf')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 2876f70..291fab0 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 _0x5577=['hostname','substring','lodash','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','cpus','map','model','join','createHash','md5','update','hex','getUuid','platform','dmidecode\x20--string\x20system-uuid','utf8','replace'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5577,0x1b4));var _0x7557=function(_0x1ebd67,_0x408823){_0x1ebd67=_0x1ebd67-0x0;var _0x26fbce=_0x5577[_0x1ebd67];return _0x26fbce;};'use strict';var _=require(_0x7557('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x7557('0x1'));var exec=require(_0x7557('0x2'))['execSync'];function getInterfaces(){var _0x34636a=[];var _0x289758=os[_0x7557('0x3')]();var _0x3c4697=_[_0x7557('0x4')](_[_0x7557('0x5')](_0x289758));for(var _0x5862e6=0x0;_0x5862e6<_0x3c4697[_0x7557('0x6')];_0x5862e6++){var _0x41a4a5=_0x289758[_0x3c4697[_0x5862e6]][_0x7557('0x7')](function(_0x1446fd){return _0x1446fd[_0x7557('0x8')]===_0x7557('0x9')&&_0x1446fd[_0x7557('0xa')]===![];});_0x34636a=_0x34636a[_0x7557('0xb')](_0x41a4a5);}return _0x34636a;}function getFirstInterface(){var _0x166f43=_[_0x7557('0xc')](getInterfaces());return{'macAddress':_0x166f43&&_0x166f43[_0x7557('0xd')]?_0x166f43[_0x7557('0xd')]:_0x7557('0xe'),'ipAddress':_0x166f43&&_0x166f43[_0x7557('0xf')]?_0x166f43[_0x7557('0xf')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x1941a7=_[_0x7557('0x4')](os[_0x7557('0x10')]()[_0x7557('0x11')](function(_0xb6ed30){return _0xb6ed30[_0x7557('0x12')];}))[_0x7557('0x13')](':');return crypto[_0x7557('0x14')](_0x7557('0x15'))[_0x7557('0x16')](_0x1941a7)['digest'](_0x7557('0x17'));}exports[_0x7557('0x18')]=function(){switch(os[_0x7557('0x19')]()){case'win32':return exec(_0x7557('0x1a'),{'encoding':_0x7557('0x1b')})[_0x7557('0x1c')]('\x0d\x0a','');default:var _0x325849=getFirstInterface();var _0x54295b=getCPUhash();var _0x28ecd5=_0x54295b+'|'+os[_0x7557('0x1d')]()+'|'+_0x325849['macAddress']+'|'+_0x325849['ipAddress'];var _0x41b3db=crypto[_0x7557('0x14')](_0x7557('0x15'))[_0x7557('0x16')](_0x28ecd5)['digest'](_0x7557('0x17'));return _0x41b3db['substring'](0x0,0x8)+'-'+_0x41b3db[_0x7557('0x1e')](0x8,0xc)+'-'+_0x41b3db[_0x7557('0x1e')](0xc,0x10)+'-'+_0x41b3db[_0x7557('0x1e')](0x10,0x14)+'-'+_0x41b3db[_0x7557('0x1e')](0x14);}}; \ No newline at end of file +var _0x99c9=['substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','digest','hex','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','update'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x99c9,0x13c));var _0x999c=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x99c9[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x999c('0x0'));var os=require('os');var crypto=require(_0x999c('0x1'));var machine=require(_0x999c('0x2'));var exec=require(_0x999c('0x3'))[_0x999c('0x4')];function getInterfaces(){var _0x16a7a3=[];var _0x31e9b1=os['networkInterfaces']();var _0x2a4e06=_[_0x999c('0x5')](_[_0x999c('0x6')](_0x31e9b1));for(var _0x347ee0=0x0;_0x347ee0<_0x2a4e06[_0x999c('0x7')];_0x347ee0++){var _0x14df32=_0x31e9b1[_0x2a4e06[_0x347ee0]][_0x999c('0x8')](function(_0x651b7e){return _0x651b7e[_0x999c('0x9')]===_0x999c('0xa')&&_0x651b7e[_0x999c('0xb')]===![];});_0x16a7a3=_0x16a7a3[_0x999c('0xc')](_0x14df32);}return _0x16a7a3;}function getFirstInterface(){var _0x32984f=_[_0x999c('0xd')](getInterfaces());return{'macAddress':_0x32984f&&_0x32984f['mac']?_0x32984f[_0x999c('0xe')]:_0x999c('0xf'),'ipAddress':_0x32984f&&_0x32984f['address']?_0x32984f[_0x999c('0x10')]:_0x999c('0x11')};}exports[_0x999c('0x12')]=getFirstInterface;function getCPUhash(){var _0x3c1dab=_[_0x999c('0x5')](os[_0x999c('0x13')]()[_0x999c('0x14')](function(_0x3d7c6d){return _0x3d7c6d[_0x999c('0x15')];}))[_0x999c('0x16')](':');return crypto[_0x999c('0x17')](_0x999c('0x18'))['update'](_0x3c1dab)[_0x999c('0x19')](_0x999c('0x1a'));}exports['getUuid']=function(){switch(os['platform']()){case'win32':return exec(_0x999c('0x1b'),{'encoding':_0x999c('0x1c')})[_0x999c('0x1d')]('\x0d\x0a','');default:var _0x116f08=getFirstInterface();var _0x2a6667=getCPUhash();var _0x5d5d12=_0x2a6667+'|'+os[_0x999c('0x1e')]()+'|'+_0x116f08[_0x999c('0x1f')]+'|'+_0x116f08[_0x999c('0x20')];var _0xc05363=crypto[_0x999c('0x17')]('md5')[_0x999c('0x21')](_0x5d5d12)[_0x999c('0x19')](_0x999c('0x1a'));return _0xc05363[_0x999c('0x22')](0x0,0x8)+'-'+_0xc05363[_0x999c('0x22')](0x8,0xc)+'-'+_0xc05363['substring'](0xc,0x10)+'-'+_0xc05363[_0x999c('0x22')](0x10,0x14)+'-'+_0xc05363[_0x999c('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index b1dbe23..06ec93f 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 _0x609b=['admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','MOTLICENSE','Motion\x20License\x20Alert','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1','Disabled','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','catch','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','../../api/jira/jira.controller','process','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','User','findOne'];(function(_0x4f05c2,_0x2cb4a8){var _0x9aa554=function(_0x463708){while(--_0x463708){_0x4f05c2['push'](_0x4f05c2['shift']());}};_0x9aa554(++_0x2cb4a8);}(_0x609b,0x8f));var _0xb609=function(_0x9bf944,_0x4a2c03){_0x9bf944=_0x9bf944-0x0;var _0x2f80cf=_0x609b[_0x9bf944];return _0x2f80cf;};'use strict';var util=require(_0xb609('0x0'));var moment=require(_0xb609('0x1'));var rp=require(_0xb609('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0xb609('0x3'));var db=require(_0xb609('0x4'))['db'];var encryptor=require(_0xb609('0x5'));var hardware=require(_0xb609('0x6'));var logger=require(_0xb609('0x7'))(_0xb609('0x8'));var jira=require(_0xb609('0x9'));const {config}=require(_0xb609('0xa'));var HOST=_0xb609('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x3a4dac){return new BPromise(function(_0x5dabef,_0x4cc808){var _0x4c588c=util[_0xb609('0xc')]('%s/api/servers/%s/check?version=%s',HOST,_0x3a4dac,module[_0xb609('0xd')][_0xb609('0x3')]);if(oldToken){_0x4c588c=util[_0xb609('0xc')](_0xb609('0xe'),HOST,_0x3a4dac,module[_0xb609('0xd')][_0xb609('0x3')],oldToken);}var _0x1b452a={'uri':_0x4c588c,'method':_0xb609('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x1b452a)[_0xb609('0x10')](function(_0x2e56ae){_0x5dabef(_0x2e56ae);})['catch'](function(_0x2096ea){_0x4cc808(_0x2096ea);});});}function sendJiraAlert(_0x420da8,_0x42efe3,_0x58a1a5){var _0x324c15='||FIELD||VALUE||\x0a';return db[_0xb609('0x11')][_0xb609('0x12')]({'where':{'role':_0xb609('0x13')},'attributes':[_0xb609('0x14'),_0xb609('0x15')],'raw':!![]})['then'](function(_0x3976ea){ADMIN=_0x3976ea;_0x324c15+=_0xb609('0x16')+_0x58a1a5+'|\x0a';_0x324c15+=_0xb609('0x17')+_0x420da8+'|\x0a';_0x324c15+=_0xb609('0x18')+_0x42efe3+'|\x0a';_0x324c15+=_0xb609('0x19')+ADMIN[_0xb609('0x14')]+'|\x0a';_0x324c15+=_0xb609('0x1a')+ADMIN[_0xb609('0x15')]+'|\x0a';return _0x324c15;})[_0xb609('0x10')](function(_0xed9ac6){var _0x58fd95=hardware[_0xb609('0x1b')]()['ipAddress'];return jira['openIssue']({'key':_0xb609('0x1c'),'summary':_0xb609('0x1d'),'description':_0xed9ac6,'issuetype':'Alert','oldToken':_0x420da8,'newToken':_0x42efe3,'email':ADMIN[_0xb609('0x15')],'name':ADMIN[_0xb609('0x14')],'reason':GRAY_PERIOD_REASON,'ip':_0x58fd95});});}function manageLicense(_0x544bec,_0x11889e){var _0x57c32c=_0x11889e['get']({'plain':!![]});httpRequest(_0x544bec)[_0xb609('0x10')](function(_0x36db6c){if(oldToken){oldToken=undefined;}if(_0x36db6c[_0xb609('0x1e')]){if(!_0x57c32c[_0xb609('0x8')]&&_0x57c32c['license']!=_0x36db6c[_0xb609('0x8')]||_0x57c32c[_0xb609('0x8')]&&_0x57c32c[_0xb609('0x1f')]){logger[_0xb609('0x20')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x57c32c['license']&&!_0x57c32c[_0xb609('0x1f')]&&_0x57c32c[_0xb609('0x8')]!=_0x36db6c[_0xb609('0x8')]){logger['info'](_0xb609('0x21'));}if(_0x57c32c[_0xb609('0x8')]&&!_0x57c32c[_0xb609('0x1f')]&&_0x57c32c[_0xb609('0x8')]==_0x36db6c[_0xb609('0x8')]){return _0x11889e;}return _0x11889e[_0xb609('0x22')]({'data1':_0x544bec,'data2':null,'license':_0x36db6c['license']});}else{if(_0x36db6c['license']||_0x57c32c['license']){if(!_0x57c32c['data2']){if(_0x57c32c[_0xb609('0x23')]==_0x544bec){GRAY_PERIOD_REASON=_0xb609('0x24');logger[_0xb609('0x20')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xb609('0x25');oldToken=_0x57c32c[_0xb609('0x23')];logger[_0xb609('0x20')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x57c32c[_0xb609('0x23')],_0x544bec);}sendJiraAlert(_0x57c32c[_0xb609('0x23')],_0x36db6c[_0xb609('0x26')],GRAY_PERIOD_REASON);logger[_0xb609('0x20')](_0xb609('0x27'),GRAY_PERIOD_REASON[_0xb609('0x28')](),moment()[_0xb609('0xc')](_0xb609('0x29')));return _0x11889e['update']({'data2':encryptor['encryptString'](moment()[_0xb609('0xc')](_0xb609('0x29')))});}else{if(moment()[_0xb609('0x2a')](encryptor[_0xb609('0x2b')](_0x57c32c['data2']),'days')>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0xb609('0xc')](_0xb609('0x29')));return _0x11889e[_0xb609('0x22')]({'data1':_0x544bec,'data2':null,'license':null});}}}else{if(_0x57c32c['data1']!=_0x544bec){logger[_0xb609('0x20')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x57c32c['data1'],_0x544bec);return _0x11889e[_0xb609('0x22')]({'data1':_0x544bec,'data2':null,'license':null});}}}return _0x11889e;})[_0xb609('0x10')](function(_0x59ea9c){_0x11889e=_0x59ea9c;})[_0xb609('0x2c')](function(_0xf67f9){logger['error'](_0xf67f9[_0xb609('0x2d')]);})[_0xb609('0x2e')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x11889e);},TIME);});}function defaultLicense(){var _0xe2d3c9=hardware[_0xb609('0x2f')]();if(_0xe2d3c9){return db[_0xb609('0x30')][_0xb609('0x31')]({'where':{'id':0x1},'defaults':{'data1':_0xe2d3c9}})[_0xb609('0x32')](function(_0x3e41c5,_0x4374f8){logger[_0xb609('0x20')](_0xb609('0x33'),_0xe2d3c9);manageLicense(_0xe2d3c9,_0x3e41c5);})[_0xb609('0x2c')](function(_0x19d01b){logger[_0xb609('0x34')](_0x19d01b[_0xb609('0x2d')]);});}}exports[_0xb609('0x35')]=defaultLicense; \ No newline at end of file +var _0xe70a=['finally','getUuid','License','findOrCreate','spread','default','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../../api/jira/jira.controller','process','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','|machineUuid|','|email|','getFirstInterface','ipAddress','MOTLICENSE','Motion\x20License\x20Alert','Alert','active','license','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','decryptString','days','error','message'];(function(_0x5c325f,_0x3968b1){var _0x12cb72=function(_0xc34b64){while(--_0xc34b64){_0x5c325f['push'](_0x5c325f['shift']());}};_0x12cb72(++_0x3968b1);}(_0xe70a,0x1ec));var _0xae70=function(_0x4bc1e2,_0x18da43){_0x4bc1e2=_0x4bc1e2-0x0;var _0x25f66e=_0xe70a[_0x4bc1e2];return _0x25f66e;};'use strict';var util=require('util');var moment=require(_0xae70('0x0'));var rp=require(_0xae70('0x1'));var BPromise=require(_0xae70('0x2'));var pkginfo=require(_0xae70('0x3'))(module,_0xae70('0x4'));var db=require(_0xae70('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xae70('0x6'));var logger=require('../logger')('license');var jira=require(_0xae70('0x7'));const {config}=require(_0xae70('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x222403){return new BPromise(function(_0x322ff1,_0x4fd370){var _0x52993e=util[_0xae70('0x9')](_0xae70('0xa'),HOST,_0x222403,module[_0xae70('0xb')]['version']);if(oldToken){_0x52993e=util['format'](_0xae70('0xc'),HOST,_0x222403,module[_0xae70('0xb')][_0xae70('0x4')],oldToken);}var _0x169c8b={'uri':_0x52993e,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x169c8b)[_0xae70('0xd')](function(_0x1f1c6e){_0x322ff1(_0x1f1c6e);})[_0xae70('0xe')](function(_0xe61b9a){_0x4fd370(_0xe61b9a);});});}function sendJiraAlert(_0x53425d,_0x3228a1,_0x530aca){var _0x525cf2=_0xae70('0xf');return db[_0xae70('0x10')][_0xae70('0x11')]({'where':{'role':_0xae70('0x12')},'attributes':[_0xae70('0x13'),_0xae70('0x14')],'raw':!![]})[_0xae70('0xd')](function(_0x44720f){ADMIN=_0x44720f;_0x525cf2+=_0xae70('0x15')+_0x530aca+'|\x0a';_0x525cf2+='|uuid|'+_0x53425d+'|\x0a';_0x525cf2+=_0xae70('0x16')+_0x3228a1+'|\x0a';_0x525cf2+='|name|'+ADMIN['fullname']+'|\x0a';_0x525cf2+=_0xae70('0x17')+ADMIN[_0xae70('0x14')]+'|\x0a';return _0x525cf2;})['then'](function(_0x275241){var _0x35a95f=hardware[_0xae70('0x18')]()[_0xae70('0x19')];return jira['openIssue']({'key':_0xae70('0x1a'),'summary':_0xae70('0x1b'),'description':_0x275241,'issuetype':_0xae70('0x1c'),'oldToken':_0x53425d,'newToken':_0x3228a1,'email':ADMIN[_0xae70('0x14')],'name':ADMIN[_0xae70('0x13')],'reason':GRAY_PERIOD_REASON,'ip':_0x35a95f});});}function manageLicense(_0x2d5a3,_0xa9d7d4){var _0xde94bb=_0xa9d7d4['get']({'plain':!![]});httpRequest(_0x2d5a3)['then'](function(_0x5d56dc){if(oldToken){oldToken=undefined;}if(_0x5d56dc[_0xae70('0x1d')]){if(!_0xde94bb[_0xae70('0x1e')]&&_0xde94bb[_0xae70('0x1e')]!=_0x5d56dc['license']||_0xde94bb[_0xae70('0x1e')]&&_0xde94bb[_0xae70('0x1f')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0xde94bb[_0xae70('0x1e')]&&!_0xde94bb[_0xae70('0x1f')]&&_0xde94bb[_0xae70('0x1e')]!=_0x5d56dc[_0xae70('0x1e')]){logger['info'](_0xae70('0x20'));}if(_0xde94bb['license']&&!_0xde94bb['data2']&&_0xde94bb[_0xae70('0x1e')]==_0x5d56dc['license']){return _0xa9d7d4;}return _0xa9d7d4[_0xae70('0x21')]({'data1':_0x2d5a3,'data2':null,'license':_0x5d56dc['license']});}else{if(_0x5d56dc[_0xae70('0x1e')]||_0xde94bb[_0xae70('0x1e')]){if(!_0xde94bb['data2']){if(_0xde94bb['data1']==_0x2d5a3){GRAY_PERIOD_REASON=_0xae70('0x22');logger[_0xae70('0x23')](_0xae70('0x24'));}else{GRAY_PERIOD_REASON=_0xae70('0x25');oldToken=_0xde94bb[_0xae70('0x26')];logger[_0xae70('0x23')](_0xae70('0x27'),_0xde94bb[_0xae70('0x26')],_0x2d5a3);}sendJiraAlert(_0xde94bb[_0xae70('0x26')],_0x5d56dc['uuid'],GRAY_PERIOD_REASON);logger[_0xae70('0x23')](_0xae70('0x28'),GRAY_PERIOD_REASON[_0xae70('0x29')](),moment()[_0xae70('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0xa9d7d4[_0xae70('0x21')]({'data2':encryptor[_0xae70('0x2a')](moment()[_0xae70('0x9')](_0xae70('0x2b')))});}else{if(moment()['diff'](encryptor[_0xae70('0x2c')](_0xde94bb[_0xae70('0x1f')]),_0xae70('0x2d'))>DAYS){logger[_0xae70('0x23')]('DEMO\x20START\x20AT\x20%s',moment()[_0xae70('0x9')](_0xae70('0x2b')));return _0xa9d7d4[_0xae70('0x21')]({'data1':_0x2d5a3,'data2':null,'license':null});}}}else{if(_0xde94bb['data1']!=_0x2d5a3){logger[_0xae70('0x23')](_0xae70('0x27'),_0xde94bb['data1'],_0x2d5a3);return _0xa9d7d4[_0xae70('0x21')]({'data1':_0x2d5a3,'data2':null,'license':null});}}}return _0xa9d7d4;})[_0xae70('0xd')](function(_0x3e22dd){_0xa9d7d4=_0x3e22dd;})[_0xae70('0xe')](function(_0x2a0708){logger[_0xae70('0x2e')](_0x2a0708[_0xae70('0x2f')]);})[_0xae70('0x30')](function(){setTimeout(function(){manageLicense(hardware[_0xae70('0x31')](),_0xa9d7d4);},TIME);});}function defaultLicense(){var _0x5d7aae=hardware[_0xae70('0x31')]();if(_0x5d7aae){return db[_0xae70('0x32')][_0xae70('0x33')]({'where':{'id':0x1},'defaults':{'data1':_0x5d7aae}})[_0xae70('0x34')](function(_0x461237,_0x4449a4){logger[_0xae70('0x23')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x5d7aae);manageLicense(_0x5d7aae,_0x461237);})[_0xae70('0xe')](function(_0x4b8c76){logger[_0xae70('0x2e')](_0x4b8c76['message']);});}}exports[_0xae70('0x35')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 0bfee57..cf7ef10 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 _0xfd1c=['gray','deadline','days','grayReason','machineUuid','changed','message','User','role','sequelize','COUNT','col','count','user','telephones','forEach','admin','countBy','telephone','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse'];(function(_0x23fb8b,_0x5ad627){var _0x9c821b=function(_0x8e5345){while(--_0x8e5345){_0x23fb8b['push'](_0x23fb8b['shift']());}};_0x9c821b(++_0x5ad627);}(_0xfd1c,0x197));var _0xcfd1=function(_0x143cfd,_0x1a336e){_0x143cfd=_0x143cfd-0x0;var _0x2cb5f5=_0xfd1c[_0x143cfd];return _0x2cb5f5;};'use strict';var util=require(_0xcfd1('0x0'));var _=require(_0xcfd1('0x1'));var moment=require(_0xcfd1('0x2'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0xcfd1('0x3'));var db=require(_0xcfd1('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcfd1('0x5'),'machineUuid':hardware[_0xcfd1('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcfd1('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xcfd1('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x24d4bc){return new BPromise(function(_0x54b2e4,_0x393d98){return db[_0xcfd1('0x8')][_0xcfd1('0x9')](_[_0xcfd1('0xa')](_0x24d4bc,{'raw':!![],'where':{'id':0x1}}))[_0xcfd1('0xb')](function(_0xf260ca){return checkLicense(_0xf260ca,null);})[_0xcfd1('0xb')](function(_0x5d6bcf){_0x54b2e4(_0x5d6bcf);return;})[_0xcfd1('0xc')](function(_0x2c18e6){_0x393d98(_0x2c18e6);});});}function checkLicense(_0x563b59,_0x4dae83){if(!_0x563b59){demoLicense[_0xcfd1('0xd')]=_0x563b59[_0xcfd1('0xe')];return demoLicense;}try{var _0x4d7509=_0x4dae83||_0x563b59[_0xcfd1('0xf')];if(_[_0xcfd1('0x10')](_0x4d7509)){throw new Error(_0xcfd1('0x11'));}var _0x169093=_0x563b59[_0xcfd1('0xe')];var _0x56e035=_0x563b59[_0xcfd1('0x12')];var _0x3201d6=_0x169093[_0xcfd1('0x13')]('-')[0x4];var _0x49fc4c=_0x169093[_0xcfd1('0x13')]('-')[0x0];var _0x3d5fff=encryptor[_0xcfd1('0x14')](_0x4d7509,util[_0xcfd1('0x15')]('%s:%s:%s',_0x3201d6,_0x169093,_0x49fc4c));var _0xc2f08e=JSON[_0xcfd1('0x16')](_0x3d5fff);_0xc2f08e['demo']=![];_0xc2f08e['uuid']=_0x169093;_0xc2f08e['machineUuid']=hardware[_0xcfd1('0x6')]();if(_0x56e035){var _0x30ce00=encryptor[_0xcfd1('0x14')](_0x56e035);_0xc2f08e[_0xcfd1('0x17')]=_0x30ce00;_0xc2f08e[_0xcfd1('0x18')]=moment(_0x30ce00)['add'](0x7,_0xcfd1('0x19'))[_0xcfd1('0x15')]();_0xc2f08e[_0xcfd1('0x1a')]=_0xc2f08e[_0xcfd1('0xd')]!=_0xc2f08e[_0xcfd1('0x1b')]?_0xcfd1('0x1c'):'disabled';}return _0xc2f08e;}catch(_0x6be2de){breakingLicense[_0xcfd1('0xd')]=_0x563b59[_0xcfd1('0xe')];breakingLicense['message']=_0x6be2de[_0xcfd1('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2076d9,_0x262371){getLicense()['then'](function(_0x4be7ad){return db[_0xcfd1('0x1e')]['findAll']({'attributes':[_0xcfd1('0x1f'),[db[_0xcfd1('0x20')]['fn'](_0xcfd1('0x21'),db[_0xcfd1('0x20')][_0xcfd1('0x22')]('role')),_0xcfd1('0x23')]],'group':_0xcfd1('0x1f'),'where':{'role':{'$or':['admin',_0xcfd1('0x24'),'telephone']}},'raw':!![]})[_0xcfd1('0xb')](function(_0x56e742){var _0x5332c1={'user':_0x4be7ad['users']||0x0,'telephone':_0x4be7ad[_0xcfd1('0x25')]||0x0};_0x56e742[_0xcfd1('0x26')](function(_0x130740){var _0x198723=_0x130740[_0xcfd1('0x1f')]===_0xcfd1('0x27')?_0xcfd1('0x24'):_0x130740['role'];_0x5332c1[_0x198723]-=_0x130740[_0xcfd1('0x23')];if(_0x5332c1[_0x198723]<0x0)_0x5332c1[_0x198723]=0x0;});_0x2076d9(_0x5332c1);return;});})['catch'](function(_0x258110){_0x262371(_0x258110);});});}function checkUserLimits(_0x2db3c0){return new BPromise(function(_0x2dc808,_0x1c50e0){getLimits()[_0xcfd1('0xb')](function(_0x309357){var _0x67354f=_['pick'](_[_0xcfd1('0x28')](_0x2db3c0,_0xcfd1('0x1f')),[_0xcfd1('0x27'),_0xcfd1('0x24'),_0xcfd1('0x29')]);var _0x97a34f=(_0x67354f[_0xcfd1('0x27')]||0x0)+(_0x67354f[_0xcfd1('0x24')]||0x0);var _0x1b4247=_0x67354f['telephone']||0x0;if(_0x97a34f>_0x309357['user'])return _0x1c50e0('License\x20limit\x20reached\x20for\x20users');if(_0x1b4247>_0x309357[_0xcfd1('0x29')])return _0x1c50e0(_0xcfd1('0x2a'));return _0x2dc808();})[_0xcfd1('0xc')](function(_0x2d01cb){_0x1c50e0(_0x2d01cb);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xc59d=['demo','machineUuid','decryptString','deadline','add','days','changed','message','findAll','role','sequelize','col','admin','telephone','users','telephones','user','count','catch','pick','countBy','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','Breaking\x20license','License','find','defaults','then','uuid','license','isEmpty','data1','format','%s:%s:%s'];(function(_0x13f4e9,_0x3f4ca4){var _0xa92ae4=function(_0x2122b0){while(--_0x2122b0){_0x13f4e9['push'](_0x13f4e9['shift']());}};_0xa92ae4(++_0x3f4ca4);}(_0xc59d,0x9c));var _0xdc59=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc59d[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0xdc59('0x0'));var _=require(_0xdc59('0x1'));var moment=require(_0xdc59('0x2'));var BPromise=require('bluebird');var hardware=require(_0xdc59('0x3'));var encryptor=require(_0xdc59('0x4'));var db=require(_0xdc59('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdc59('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xdc59('0x7'),'machineUuid':hardware[_0xdc59('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdc59('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xdc59('0x9'),'machineUuid':hardware[_0xdc59('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x12dfce){return new BPromise(function(_0x15ed6e,_0x54f53c){return db[_0xdc59('0xa')][_0xdc59('0xb')](_[_0xdc59('0xc')](_0x12dfce,{'raw':!![],'where':{'id':0x1}}))[_0xdc59('0xd')](function(_0x28a74a){return checkLicense(_0x28a74a,null);})['then'](function(_0x14d294){_0x15ed6e(_0x14d294);return;})['catch'](function(_0x552559){_0x54f53c(_0x552559);});});}function checkLicense(_0x4e8832,_0x2df028){if(!_0x4e8832){demoLicense[_0xdc59('0xe')]=_0x4e8832['data1'];return demoLicense;}try{var _0x5f5b90=_0x2df028||_0x4e8832[_0xdc59('0xf')];if(_[_0xdc59('0x10')](_0x5f5b90)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x2dc131=_0x4e8832[_0xdc59('0x11')];var _0x4f46d6=_0x4e8832['data2'];var _0x33584d=_0x2dc131['split']('-')[0x4];var _0x287341=_0x2dc131['split']('-')[0x0];var _0x5686df=encryptor['decryptString'](_0x5f5b90,util[_0xdc59('0x12')](_0xdc59('0x13'),_0x33584d,_0x2dc131,_0x287341));var _0x290208=JSON['parse'](_0x5686df);_0x290208[_0xdc59('0x14')]=![];_0x290208[_0xdc59('0xe')]=_0x2dc131;_0x290208[_0xdc59('0x15')]=hardware['getUuid']();if(_0x4f46d6){var _0x24e0fd=encryptor[_0xdc59('0x16')](_0x4f46d6);_0x290208['gray']=_0x24e0fd;_0x290208[_0xdc59('0x17')]=moment(_0x24e0fd)[_0xdc59('0x18')](0x7,_0xdc59('0x19'))['format']();_0x290208['grayReason']=_0x290208[_0xdc59('0xe')]!=_0x290208[_0xdc59('0x15')]?_0xdc59('0x1a'):'disabled';}return _0x290208;}catch(_0xfdae31){breakingLicense['uuid']=_0x4e8832[_0xdc59('0x11')];breakingLicense[_0xdc59('0x1b')]=_0xfdae31[_0xdc59('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x25599c,_0x5eab31){getLicense()['then'](function(_0x5da800){return db['User'][_0xdc59('0x1c')]({'attributes':[_0xdc59('0x1d'),[db['sequelize']['fn']('COUNT',db[_0xdc59('0x1e')][_0xdc59('0x1f')]('role')),'count']],'group':'role','where':{'role':{'$or':[_0xdc59('0x20'),'user',_0xdc59('0x21')]}},'raw':!![]})[_0xdc59('0xd')](function(_0x2ea518){var _0x6f232={'user':_0x5da800[_0xdc59('0x22')]||0x0,'telephone':_0x5da800[_0xdc59('0x23')]||0x0};_0x2ea518['forEach'](function(_0x4e48ea){var _0x231578=_0x4e48ea['role']==='admin'?_0xdc59('0x24'):_0x4e48ea[_0xdc59('0x1d')];_0x6f232[_0x231578]-=_0x4e48ea[_0xdc59('0x25')];if(_0x6f232[_0x231578]<0x0)_0x6f232[_0x231578]=0x0;});_0x25599c(_0x6f232);return;});})[_0xdc59('0x26')](function(_0x1af5b3){_0x5eab31(_0x1af5b3);});});}function checkUserLimits(_0x4d8860){return new BPromise(function(_0x4c574a,_0x2a024b){getLimits()[_0xdc59('0xd')](function(_0x264f59){var _0x3443d5=_[_0xdc59('0x27')](_[_0xdc59('0x28')](_0x4d8860,_0xdc59('0x1d')),[_0xdc59('0x20'),'user',_0xdc59('0x21')]);var _0x4cc8a8=(_0x3443d5[_0xdc59('0x20')]||0x0)+(_0x3443d5[_0xdc59('0x24')]||0x0);var _0x52db3f=_0x3443d5[_0xdc59('0x21')]||0x0;if(_0x4cc8a8>_0x264f59[_0xdc59('0x24')])return _0x2a024b(_0xdc59('0x29'));if(_0x52db3f>_0x264f59[_0xdc59('0x21')])return _0x2a024b(_0xdc59('0x2a'));return _0x4c574a();})[_0xdc59('0x26')](function(_0x345d7d){_0x2a024b(_0x345d7d);});});}module[_0xdc59('0x2b')]={'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 7eb13e6..564a419 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 _0x5689=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x18b572,_0x843724){var _0x1018c3=function(_0x5d5c76){while(--_0x5d5c76){_0x18b572['push'](_0x18b572['shift']());}};_0x1018c3(++_0x843724);}(_0x5689,0x100));var _0x9568=function(_0x26e25c,_0x316ece){_0x26e25c=_0x26e25c-0x0;var _0x1714f5=_0x5689[_0x26e25c];return _0x1714f5;};'use strict';module[_0x9568('0x0')]={'DOMAIN':_0x9568('0x1'),'SESSION_SECRET':_0x9568('0x2'),'GOOGLE_ID':_0x9568('0x3'),'GOOGLE_SECRET':_0x9568('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x624e=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x5f1f63,_0x740dbf){var _0x4ff682=function(_0x1b1395){while(--_0x1b1395){_0x5f1f63['push'](_0x5f1f63['shift']());}};_0x4ff682(++_0x740dbf);}(_0x624e,0x171));var _0xe624=function(_0x91b45c,_0x22e5a6){_0x91b45c=_0x91b45c-0x0;var _0x1ca745=_0x624e[_0x91b45c];return _0x1ca745;};'use strict';module[_0xe624('0x0')]={'DOMAIN':_0xe624('0x1'),'SESSION_SECRET':_0xe624('0x2'),'GOOGLE_ID':_0xe624('0x3'),'GOOGLE_SECRET':_0xe624('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index ae3e405..ed6cd69 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d3f=['format','message','replace','}}}','level','toUpperCase','exports','Logger','transports','File','error','info','Console','env','moment','winston','util','path','INFO','/var','log','xcally'];(function(_0x280238,_0x5bae70){var _0x13855f=function(_0x112657){while(--_0x112657){_0x280238['push'](_0x280238['shift']());}};_0x13855f(++_0x5bae70);}(_0x9d3f,0x66));var _0xf9d3=function(_0x3a7a97,_0x5a7b7e){_0x3a7a97=_0x3a7a97-0x0;var _0x399c66=_0x9d3f[_0x3a7a97];return _0x399c66;};'use strict';var moment=require(_0xf9d3('0x0'));var winston=require(_0xf9d3('0x1'));var util=require(_0xf9d3('0x2'));var path=require(_0xf9d3('0x3'));var debugLevel=_0xf9d3('0x4');function filename(_0x7ec1e1,_0x4f04ef){return path['join'](_0xf9d3('0x5'),_0xf9d3('0x6'),_0xf9d3('0x7'),util[_0xf9d3('0x8')]('%s-%s.log',_0x7ec1e1,_0x4f04ef));}function formatter(_0x2dc78b,_0x4a0152){_0x4a0152['message']=_0x4a0152[_0xf9d3('0x9')][_0xf9d3('0xa')](/@@{/g,'{{{')[_0xf9d3('0xa')](/}@@/g,_0xf9d3('0xb'))[_0xf9d3('0xa')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xf9d3('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4a0152[_0xf9d3('0xc')][_0xf9d3('0xd')](),_0x2dc78b,_0x4a0152[_0xf9d3('0x9')]);}module[_0xf9d3('0xe')]=function(_0xefbd01){return new winston[(_0xf9d3('0xf'))]({'transports':[new winston[(_0xf9d3('0x10'))][(_0xf9d3('0x11'))]({'name':util[_0xf9d3('0x8')]('%s-%s',_0xefbd01,'error'),'filename':filename(_0xefbd01,_0xf9d3('0x12')),'level':_0xf9d3('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x470972){return formatter(_0xefbd01,_0x470972);}}),new winston[(_0xf9d3('0x10'))][(_0xf9d3('0x11'))]({'name':util[_0xf9d3('0x8')]('%s-%s',_0xefbd01,_0xf9d3('0x13')),'filename':filename(_0xefbd01,'info'),'level':_0xf9d3('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3d6d17){return formatter(_0xefbd01,_0x3d6d17);}}),new winston[(_0xf9d3('0x10'))][(_0xf9d3('0x14'))]({'level':process[_0xf9d3('0x15')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x27e894){return formatter(_0xefbd01,_0x27e894);}})]});}; \ No newline at end of file +var _0x5d25=['level','toUpperCase','exports','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','path','INFO','join','/var','xcally','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20679c,_0x57b5ff){var _0x53d3bb=function(_0x15ea2c){while(--_0x15ea2c){_0x20679c['push'](_0x20679c['shift']());}};_0x53d3bb(++_0x57b5ff);}(_0x5d25,0xba));var _0x55d2=function(_0x10fab6,_0x2638fd){_0x10fab6=_0x10fab6-0x0;var _0x8f63b1=_0x5d25[_0x10fab6];return _0x8f63b1;};'use strict';var moment=require(_0x55d2('0x0'));var winston=require(_0x55d2('0x1'));var util=require('util');var path=require(_0x55d2('0x2'));var debugLevel=_0x55d2('0x3');function filename(_0x4ed590,_0x513a39){return path[_0x55d2('0x4')](_0x55d2('0x5'),'log',_0x55d2('0x6'),util[_0x55d2('0x7')]('%s-%s.log',_0x4ed590,_0x513a39));}function formatter(_0x3c2397,_0x18fc2d){_0x18fc2d[_0x55d2('0x8')]=_0x18fc2d['message'][_0x55d2('0x9')](/@@{/g,_0x55d2('0xa'))[_0x55d2('0x9')](/}@@/g,_0x55d2('0xb'))[_0x55d2('0x9')](/@{/g,'{{')[_0x55d2('0x9')](/}@/g,'}}');return util['format'](_0x55d2('0xc'),moment()[_0x55d2('0x7')](_0x55d2('0xd')),_0x18fc2d[_0x55d2('0xe')][_0x55d2('0xf')](),_0x3c2397,_0x18fc2d['message']);}module[_0x55d2('0x10')]=function(_0x4afddf){return new winston['Logger']({'transports':[new winston[(_0x55d2('0x11'))][(_0x55d2('0x12'))]({'name':util['format'](_0x55d2('0x13'),_0x4afddf,_0x55d2('0x14')),'filename':filename(_0x4afddf,'error'),'level':_0x55d2('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x21ba9d){return formatter(_0x4afddf,_0x21ba9d);}}),new winston[(_0x55d2('0x11'))]['File']({'name':util[_0x55d2('0x7')](_0x55d2('0x13'),_0x4afddf,_0x55d2('0x15')),'filename':filename(_0x4afddf,_0x55d2('0x15')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3a19c7){return formatter(_0x4afddf,_0x3a19c7);}}),new winston[(_0x55d2('0x11'))][(_0x55d2('0x16'))]({'level':process[_0x55d2('0x17')][_0x55d2('0x18')]||debugLevel,'json':![],'formatter':function(_0x4477db){return formatter(_0x4afddf,_0x4477db);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f78380c..7997625 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 _0xdf0a=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdf0a,0x1a9));var _0xadf0=function(_0x4452f1,_0x321d0d){_0x4452f1=_0x4452f1-0x0;var _0x36e290=_0xdf0a[_0x4452f1];return _0x36e290;};'use strict';var path=require(_0xadf0('0x0'));var os=require('os');var config={'apps':[{'name':_0xadf0('0x1'),'script':path[_0xadf0('0x2')](__dirname,_0xadf0('0x3'))},{'name':_0xadf0('0x4'),'script':path['join'](__dirname,_0xadf0('0x5'))},{'name':'agi','script':path['join'](__dirname,_0xadf0('0x6'))},{'name':_0xadf0('0x7'),'script':path['join'](__dirname,_0xadf0('0x8'))},{'name':_0xadf0('0x9'),'script':path[_0xadf0('0x2')](__dirname,_0xadf0('0xa'))},{'name':_0xadf0('0xb'),'script':path[_0xadf0('0x2')](__dirname,_0xadf0('0xc'))}]};module[_0xadf0('0xd')]=config; \ No newline at end of file +var _0x1e3e=['../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','exports','express','join'];(function(_0x15b28b,_0x38e8f9){var _0x5c4ce9=function(_0x2464fd){while(--_0x2464fd){_0x15b28b['push'](_0x15b28b['shift']());}};_0x5c4ce9(++_0x38e8f9);}(_0x1e3e,0xfa));var _0xe1e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1e3e[_0x122ef9];return _0x42fba0;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xe1e3('0x0'),'script':path[_0xe1e3('0x1')](__dirname,_0xe1e3('0x2'))},{'name':_0xe1e3('0x3'),'script':path[_0xe1e3('0x1')](__dirname,_0xe1e3('0x4'))},{'name':_0xe1e3('0x5'),'script':path['join'](__dirname,_0xe1e3('0x6'))},{'name':_0xe1e3('0x7'),'script':path[_0xe1e3('0x1')](__dirname,_0xe1e3('0x8'))},{'name':_0xe1e3('0x9'),'script':path['join'](__dirname,_0xe1e3('0xa'))},{'name':'xdr','script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0xe1e3('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 386bb21..12691e9 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 _0xcd0d=['dump','saved','pm2','bluebird','./config','start','then','disconnect','restart','list','describe','delete'];(function(_0x260394,_0x2e0334){var _0x1e0c0e=function(_0x1ee1e0){while(--_0x1ee1e0){_0x260394['push'](_0x260394['shift']());}};_0x1e0c0e(++_0x2e0334);}(_0xcd0d,0x10a));var _0xdcd0=function(_0x3b8a26,_0x168cc4){_0x3b8a26=_0x3b8a26-0x0;var _0x31bafd=_0xcd0d[_0x3b8a26];return _0x31bafd;};'use strict';var pm2=require(_0xdcd0('0x0'));var BPromise=require(_0xdcd0('0x1'));var config=require(_0xdcd0('0x2'));function connect(){return new BPromise(function(_0x27becf,_0x415646){return pm2['connect'](function(_0x5c7f7b){if(_0x5c7f7b){return _0x415646(_0x5c7f7b);}return _0x27becf('connected');});});};exports[_0xdcd0('0x3')]=function(_0x5f431f){return connect()[_0xdcd0('0x4')](function(){return new BPromise(function(_0x70ea2e,_0x782b28){return pm2[_0xdcd0('0x3')](_0x5f431f,function(_0x3534a0,_0x45b67a){if(_0x3534a0){return _0x782b28(_0x3534a0);}pm2['disconnect']();return _0x70ea2e(_0x45b67a);});});});};exports['stop']=function(_0x5717d9){return connect()[_0xdcd0('0x4')](function(){return new BPromise(function(_0xe64966,_0x5d898d){return pm2['stop'](_0x5717d9,function(_0xbda5f7,_0x3e848d){if(_0xbda5f7){return _0x5d898d(_0xbda5f7);}pm2[_0xdcd0('0x5')]();return _0xe64966(_0x3e848d);});});});};exports[_0xdcd0('0x6')]=function(_0x10ba0d){return connect()[_0xdcd0('0x4')](function(){return new BPromise(function(_0x37ea49,_0x2fda6a){return pm2['restart'](_0x10ba0d,function(_0x30c702,_0x30cbff){if(_0x30c702){return _0x2fda6a(_0x30c702);}pm2[_0xdcd0('0x5')]();return _0x37ea49(_0x30cbff);});});});};exports[_0xdcd0('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3a6920,_0x59dc4f){return pm2[_0xdcd0('0x7')](function(_0x5c1640,_0x2a4bf1){if(_0x5c1640){return _0x59dc4f(_0x5c1640);}pm2['disconnect']();return _0x3a6920(_0x2a4bf1);});});});};exports[_0xdcd0('0x8')]=function(_0x3ec4f7){return connect()[_0xdcd0('0x4')](function(){return new BPromise(function(_0x5a4584,_0x488387){return pm2['describe'](_0x3ec4f7,function(_0x5557c4,_0x55d72b){if(_0x5557c4){return _0x488387(_0x5557c4);}pm2['disconnect']();return _0x5a4584(_0x55d72b);});});});};exports[_0xdcd0('0x9')]=function(_0x4da58f){return connect()[_0xdcd0('0x4')](function(){return new BPromise(function(_0x1172bc,_0x10bf00){return pm2[_0xdcd0('0x9')](_0x4da58f,function(_0x18e9d5,_0x2d8e5d){if(_0x18e9d5){return _0x10bf00(_0x18e9d5);}pm2['disconnect']();return _0x1172bc(_0x2d8e5d);});});});};exports[_0xdcd0('0xa')]=function(){return connect()[_0xdcd0('0x4')](function(){return new BPromise(function(_0x121dc6,_0x251513){return pm2[_0xdcd0('0xa')](function(_0x3b2262){if(_0x3b2262){return _0x251513(_0x3b2262);}return _0x121dc6(_0xdcd0('0xb'));});});});}; \ No newline at end of file +var _0x3c94=['start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected'];(function(_0x4a5356,_0x20f134){var _0x4beb93=function(_0x151541){while(--_0x151541){_0x4a5356['push'](_0x4a5356['shift']());}};_0x4beb93(++_0x20f134);}(_0x3c94,0xcd));var _0x43c9=function(_0x4fb797,_0x200ee6){_0x4fb797=_0x4fb797-0x0;var _0x34e096=_0x3c94[_0x4fb797];return _0x34e096;};'use strict';var pm2=require(_0x43c9('0x0'));var BPromise=require(_0x43c9('0x1'));var config=require(_0x43c9('0x2'));function connect(){return new BPromise(function(_0x20116b,_0x188507){return pm2[_0x43c9('0x3')](function(_0xe05adb){if(_0xe05adb){return _0x188507(_0xe05adb);}return _0x20116b(_0x43c9('0x4'));});});};exports[_0x43c9('0x5')]=function(_0x44fc3){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0x3da043,_0x4fdfc2){return pm2[_0x43c9('0x5')](_0x44fc3,function(_0xf03007,_0x695b4f){if(_0xf03007){return _0x4fdfc2(_0xf03007);}pm2[_0x43c9('0x7')]();return _0x3da043(_0x695b4f);});});});};exports[_0x43c9('0x8')]=function(_0x7a0f6b){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0x4725aa,_0x45f3a1){return pm2['stop'](_0x7a0f6b,function(_0x31d997,_0x18a5c9){if(_0x31d997){return _0x45f3a1(_0x31d997);}pm2[_0x43c9('0x7')]();return _0x4725aa(_0x18a5c9);});});});};exports[_0x43c9('0x9')]=function(_0x27ad97){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0x690bde,_0x305fcb){return pm2[_0x43c9('0x9')](_0x27ad97,function(_0x18f520,_0x62bb3b){if(_0x18f520){return _0x305fcb(_0x18f520);}pm2[_0x43c9('0x7')]();return _0x690bde(_0x62bb3b);});});});};exports[_0x43c9('0xa')]=function(){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0xa98d2f,_0x45546d){return pm2[_0x43c9('0xa')](function(_0x569fa9,_0x37932f){if(_0x569fa9){return _0x45546d(_0x569fa9);}pm2[_0x43c9('0x7')]();return _0xa98d2f(_0x37932f);});});});};exports[_0x43c9('0xb')]=function(_0xe02707){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0x5cc1fa,_0x549d3f){return pm2[_0x43c9('0xb')](_0xe02707,function(_0x9a0f50,_0x15035a){if(_0x9a0f50){return _0x549d3f(_0x9a0f50);}pm2[_0x43c9('0x7')]();return _0x5cc1fa(_0x15035a);});});});};exports['delete']=function(_0x1d63cf){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0x38fe46,_0x22bf3d){return pm2[_0x43c9('0xc')](_0x1d63cf,function(_0x2ab239,_0x24db4e){if(_0x2ab239){return _0x22bf3d(_0x2ab239);}pm2[_0x43c9('0x7')]();return _0x38fe46(_0x24db4e);});});});};exports[_0x43c9('0xd')]=function(){return connect()[_0x43c9('0x6')](function(){return new BPromise(function(_0x3f841a,_0x4847b2){return pm2[_0x43c9('0xd')](function(_0x772b71){if(_0x772b71){return _0x4847b2(_0x772b71);}return _0x3f841a(_0x43c9('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 21efcbc..a72f7aa 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 _0xf53c=['chatTimeout','ChatInteraction','findAll','lastMsgAt','then','map','info','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','find'];(function(_0x10803d,_0x12bd47){var _0x4de8e1=function(_0x4e1ae7){while(--_0x4e1ae7){_0x10803d['push'](_0x10803d['shift']());}};_0x4de8e1(++_0x12bd47);}(_0xf53c,0x1c2));var _0xcf53=function(_0x37d2ae,_0x5bf623){_0x37d2ae=_0x37d2ae-0x0;var _0x1616cd=_0xf53c[_0x37d2ae];return _0x1616cd;};'use strict';var _=require(_0xcf53('0x0'));var moment=require(_0xcf53('0x1'));var Redis=require(_0xcf53('0x2'));var util=require(_0xcf53('0x3'));var config=require(_0xcf53('0x4'));var db=require(_0xcf53('0x5'))['db'];var logger=require(_0xcf53('0x6'))(_0xcf53('0x7'));config[_0xcf53('0x8')]=_['defaults'](config['redis'],{'host':_0xcf53('0x9'),'port':0x18eb});var io=require(_0xcf53('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x7f231b=0x0;var _0x488f86=[];return db['Setting'][_0xcf53('0xb')]({'raw':!![],'attributes':['id',_0xcf53('0xc')],'where':{'id':0x1}})['then'](function(_0x599c62){_0x7f231b=_0x599c62[_0xcf53('0xc')];if(_0x7f231b){return db[_0xcf53('0xd')][_0xcf53('0xe')]({'raw':!![],'attributes':['id',_0xcf53('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x599c62[_0xcf53('0xc')],'minutes')}}});}else{return[];}})[_0xcf53('0x10')](function(_0x2139cd){if(_0x2139cd&&_0x2139cd['length']){_0x488f86=_[_0xcf53('0x11')](_0x2139cd||[],'id');logger[_0xcf53('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x488f86['join']());return db[_0xcf53('0xd')][_0xcf53('0x13')]({'closeReason':_0xcf53('0x14'),'disposition':_0xcf53('0x15'),'closed':!![],'closedAt':moment()[_0xcf53('0x16')](_0xcf53('0x17'))},{'where':{'id':_0x488f86}});}})['then'](function(){if(_0x488f86&&_0x488f86[_0xcf53('0x18')]){logger[_0xcf53('0x12')](_0xcf53('0x19'),_0x488f86[_0xcf53('0x1a')]());for(var _0x46b86a=0x0;_0x46b86a<_0x488f86[_0xcf53('0x18')];_0x46b86a++){io[_0xcf53('0x1b')](_0xcf53('0x1c'),{'id':_0x488f86[_0x46b86a],'closed':!![]});}}})[_0xcf53('0x1d')](function(_0x5160f8){logger[_0xcf53('0x1e')](_0xcf53('0x1f'),_0x5160f8?util[_0xcf53('0x20')](_0x5160f8,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x33d0=['length','map','join','update','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','subtract','minutes'];(function(_0x2534c7,_0x16e133){var _0x39ae6e=function(_0x14e746){while(--_0x14e746){_0x2534c7['push'](_0x2534c7['shift']());}};_0x39ae6e(++_0x16e133);}(_0x33d0,0x16d));var _0x033d=function(_0x4f6ad0,_0x470249){_0x4f6ad0=_0x4f6ad0-0x0;var _0x982bfc=_0x33d0[_0x4f6ad0];return _0x982bfc;};'use strict';var _=require(_0x033d('0x0'));var moment=require(_0x033d('0x1'));var Redis=require(_0x033d('0x2'));var util=require(_0x033d('0x3'));var config=require(_0x033d('0x4'));var db=require(_0x033d('0x5'))['db'];var logger=require('../logger')(_0x033d('0x6'));config[_0x033d('0x7')]=_[_0x033d('0x8')](config[_0x033d('0x7')],{'host':_0x033d('0x9'),'port':0x18eb});var io=require(_0x033d('0xa'))(new Redis(config[_0x033d('0x7')]));function closeInteractions(){var _0x194190=0x0;var _0x19d0e8=[];return db[_0x033d('0xb')][_0x033d('0xc')]({'raw':!![],'attributes':['id',_0x033d('0xd')],'where':{'id':0x1}})[_0x033d('0xe')](function(_0x306f5a){_0x194190=_0x306f5a[_0x033d('0xd')];if(_0x194190){return db[_0x033d('0xf')][_0x033d('0x10')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x033d('0x11')](_0x306f5a[_0x033d('0xd')],_0x033d('0x12'))}}});}else{return[];}})[_0x033d('0xe')](function(_0x2ef2fe){if(_0x2ef2fe&&_0x2ef2fe[_0x033d('0x13')]){_0x19d0e8=_[_0x033d('0x14')](_0x2ef2fe||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x19d0e8[_0x033d('0x15')]());return db[_0x033d('0xf')][_0x033d('0x16')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x033d('0x17'))},{'where':{'id':_0x19d0e8}});}})[_0x033d('0xe')](function(){if(_0x19d0e8&&_0x19d0e8[_0x033d('0x13')]){logger[_0x033d('0x18')](_0x033d('0x19'),_0x19d0e8[_0x033d('0x15')]());for(var _0x48083e=0x0;_0x48083e<_0x19d0e8[_0x033d('0x13')];_0x48083e++){io[_0x033d('0x1a')](_0x033d('0x1b'),{'id':_0x19d0e8[_0x48083e],'closed':!![]});}}})[_0x033d('0x1c')](function(_0x65f165){logger[_0x033d('0x1d')](_0x033d('0x1e'),_0x65f165?util['inspect'](_0x65f165,{'showHidden':![],'depth':null}):'');});}exports[_0x033d('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index a0ec794..15b619e 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 _0xe0c6=['runReport','DefaultReportId','then','CustomReportId','Schedule','findAll','MailServerOut','keys','map','keyBy','toString','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add','start','exists','update','update\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','host','port','MailAccount','secure','auth','user','pass','format','\x22%s\x22\x20<%s>','name','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output'];(function(_0x1e767b,_0x356fb4){var _0x847c05=function(_0x1aa115){while(--_0x1aa115){_0x1e767b['push'](_0x1e767b['shift']());}};_0x847c05(++_0x356fb4);}(_0xe0c6,0x188));var _0x6e0c=function(_0x16a24f,_0xb211c3){_0x16a24f=_0x16a24f-0x0;var _0x53de27=_0xe0c6[_0x16a24f];return _0x53de27;};'use strict';var fs=require('fs');var util=require(_0x6e0c('0x0'));var path=require('path');var _=require(_0x6e0c('0x1'));var moment=require(_0x6e0c('0x2'));var CronJobManager=require(_0x6e0c('0x3'));var jayson=require(_0x6e0c('0x4'));var BPromise=require(_0x6e0c('0x5'));var logger=require(_0x6e0c('0x6'))(_0x6e0c('0x7'));var db=require(_0x6e0c('0x8'))['db'];var analyticCustomReportController=require(_0x6e0c('0x9'));var analyticDefaultReportController=require(_0x6e0c('0xa'));var client=jayson[_0x6e0c('0xb')][_0x6e0c('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x11028c,_0x7d9def){return function(){logger[_0x6e0c('0xd')](_0x6e0c('0xe'),_0x11028c[_0x6e0c('0xf')]);var _0x3c2c74=!![];var _0x5ad36a={'tls':{'rejectUnauthorized':![]}};if(_0x11028c['MailAccount'][_0x6e0c('0x10')]['service']){_0x5ad36a[_0x6e0c('0x11')]=_0x11028c['MailAccount'][_0x6e0c('0x10')][_0x6e0c('0x11')];}else{_0x5ad36a[_0x6e0c('0x12')]=_0x11028c['MailAccount'][_0x6e0c('0x10')]['host'];_0x5ad36a[_0x6e0c('0x13')]=_0x11028c[_0x6e0c('0x14')]['Smtp'][_0x6e0c('0x13')];_0x5ad36a[_0x6e0c('0x15')]=_0x11028c[_0x6e0c('0x14')][_0x6e0c('0x10')][_0x6e0c('0x15')];}if(_0x11028c[_0x6e0c('0x14')][_0x6e0c('0x10')]['authentication']){_0x5ad36a[_0x6e0c('0x16')]={'user':_0x11028c[_0x6e0c('0x14')][_0x6e0c('0x10')][_0x6e0c('0x17')],'pass':_0x11028c[_0x6e0c('0x14')][_0x6e0c('0x10')][_0x6e0c('0x18')]};}var _0x29cddf={'account':_0x5ad36a,'message':{'from':util[_0x6e0c('0x19')](_0x6e0c('0x1a'),_0x11028c[_0x6e0c('0x14')]['name'],_0x11028c[_0x6e0c('0x14')][_0x6e0c('0xf')]||_0x11028c['MailAccount']['Smtp'][_0x6e0c('0x17')]),'to':_0x11028c[_0x6e0c('0xf')],'cc':_0x11028c['cc'],'bcc':_0x11028c['bcc'],'subject':util[_0x6e0c('0x19')]('Report\x20%s\x20last\x20%s\x20%s',_0x7d9def[_0x6e0c('0x1b')],_0x11028c[_0x6e0c('0x1c')],_0x11028c[_0x6e0c('0x1d')])}};var _0x5b8062=path[_0x6e0c('0x1e')](__dirname,_0x6e0c('0x1f'));var _0x314d39=_0x7d9def['savename'];var _0x5b613b=util[_0x6e0c('0x19')](_0x6e0c('0x20'),path[_0x6e0c('0x21')](_0x7d9def[_0x6e0c('0x22')],path[_0x6e0c('0x23')](_0x7d9def[_0x6e0c('0x22')])),_0x6e0c('0x24'));var _0x9f5fb1=path[_0x6e0c('0x1e')](_0x5b8062,_0x314d39);var _0x1bee2f=path[_0x6e0c('0x1e')](_0x5b8062,_0x5b613b);if(fs[_0x6e0c('0x25')](_0x9f5fb1)){_0x7d9def['status']=_0x6e0c('0x26');_0x29cddf[_0x6e0c('0x27')]['attachments']=[{'filename':_0x314d39,'path':_0x9f5fb1}];_0x29cddf[_0x6e0c('0x27')][_0x6e0c('0x28')]=util[_0x6e0c('0x19')](_0x6e0c('0x29'),JSON[_0x6e0c('0x2a')](_0x7d9def,null,0x2));}else if(fs[_0x6e0c('0x25')](_0x1bee2f)){_0x7d9def[_0x6e0c('0x2b')]=_0x6e0c('0x26');_0x29cddf[_0x6e0c('0x27')][_0x6e0c('0x2c')]=[{'filename':_0x5b613b,'path':_0x1bee2f}];}else{_0x29cddf[_0x6e0c('0x27')]['text']=_0x6e0c('0x2d');if(!_0x11028c['sendIfEmpty']){_0x3c2c74=![];logger[_0x6e0c('0xd')](_0x6e0c('0x2e'));}}if(_0x3c2c74){return client[_0x6e0c('0x2f')](_0x6e0c('0x30'),_0x29cddf)['then'](function(_0x50e4c7){if(_0x50e4c7[_0x6e0c('0x31')]){return logger[_0x6e0c('0x31')](_0x6e0c('0x32'),JSON['stringify'](_0x50e4c7));}return logger[_0x6e0c('0xd')]('email\x20sent');})[_0x6e0c('0x33')](function(_0x5f18ba){return logger[_0x6e0c('0x31')](_0x6e0c('0x32'),JSON['stringify'](_0x5f18ba));});}};}function handleError(){return function(_0x35491f){return logger[_0x6e0c('0x31')](JSON[_0x6e0c('0x2a')](_0x35491f));};}function handleResult(_0x5f7537){return function(_0x1ee5d8){logger['info'](_0x6e0c('0x34'),JSON[_0x6e0c('0x2a')](_0x1ee5d8));if(_0x5f7537[_0x6e0c('0x14')]&&_0x5f7537[_0x6e0c('0x14')][_0x6e0c('0x10')]&&!_[_0x6e0c('0x35')](_0x5f7537[_0x6e0c('0xf')])){setTimeout(handleSendEmail(_0x5f7537,_0x1ee5d8),0x3c*0x3e8);}};}function handleJob(_0x254da1){return function(){try{if(_[_0x6e0c('0x35')](_0x254da1[_0x6e0c('0x1c')])){return logger[_0x6e0c('0xd')](_0x6e0c('0x36'));}if(_['isNil'](_0x254da1[_0x6e0c('0x1d')])){return logger[_0x6e0c('0xd')]('subtractUnit\x20null\x20or\x20undefined');}var _0x10587e={'startDate':moment()[_0x6e0c('0x37')](_0x254da1[_0x6e0c('0x1c')],_0x254da1[_0x6e0c('0x1d')])[_0x6e0c('0x19')](_0x6e0c('0x38')),'endDate':moment()[_0x6e0c('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x254da1[_0x6e0c('0x39')],'name':_0x254da1[_0x6e0c('0x1b')]};if(!_['isNil'](_0x254da1['DefaultReportId'])){logger[_0x6e0c('0xd')]('exec\x20defaul\x20report\x20id:%s',_0x254da1['DefaultReportId']);return analyticDefaultReportController[_0x6e0c('0x3a')]({'id':_0x254da1[_0x6e0c('0x3b')]},_0x10587e)[_0x6e0c('0x3c')](handleResult(_0x254da1))['catch'](handleError());}if(!_[_0x6e0c('0x35')](_0x254da1[_0x6e0c('0x3d')])){logger[_0x6e0c('0xd')]('exec\x20custom\x20report\x20id:%s',_0x254da1[_0x6e0c('0x3d')]);return analyticCustomReportController[_0x6e0c('0x3a')]({'id':_0x254da1[_0x6e0c('0x3d')]},_0x10587e)[_0x6e0c('0x3c')](handleResult(_0x254da1))['catch'](handleError());}}catch(_0x250401){logger[_0x6e0c('0x31')](JSON[_0x6e0c('0x2a')](_0x250401));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x16ec2e){var _0x14ebbd={};if(_0x16ec2e){_0x14ebbd['id']=_0x16ec2e;}return db[_0x6e0c('0x3e')][_0x6e0c('0x3f')]({'where':_0x14ebbd,'include':[{'model':db['MailAccount'],'attributes':['id',_0x6e0c('0x1b'),'email'],'include':[{'model':db[_0x6e0c('0x40')],'as':_0x6e0c('0x10')}]}]})[_0x6e0c('0x3c')](function(_0xd3ac43){var _0x3b43e6=_[_0x6e0c('0x41')](manager['jobs']);var _0x1284f8=_[_0x6e0c('0x42')](_0xd3ac43,function(_0x2fe297){return _0x2fe297['id']['toString']();});var _0x2925a2=_[_0x6e0c('0x43')](_0xd3ac43,function(_0x59ebef){return _0x59ebef['id'][_0x6e0c('0x44')]();});var _0x3581fd=_0x16ec2e?_0x1284f8:_[_0x6e0c('0x45')](_0x1284f8,_0x3b43e6);var _0xfbf1c4=_[_0x6e0c('0x46')](_0x1284f8,_0x3b43e6);var _0x4d32a2=_[_0x6e0c('0x45')](_0x3b43e6,_0x1284f8);var _0x1f43a7;var _0x360e50;for(_0x1f43a7=0x0;_0x1f43a7<_0x4d32a2[_0x6e0c('0x47')]&&!_0x16ec2e;_0x1f43a7+=0x1){_0x360e50=_0x4d32a2[_0x1f43a7][_0x6e0c('0x44')]();if(manager['exists'](_0x360e50)){manager[_0x6e0c('0x48')](_0x360e50);manager[_0x6e0c('0x49')](_0x360e50);logger[_0x6e0c('0xd')](_0x6e0c('0x4a'),_0x360e50);}}logger[_0x6e0c('0xd')](_0x6e0c('0x4b'),JSON['stringify'](_0x3581fd));for(_0x1f43a7=0x0;_0x1f43a7<_0x3581fd[_0x6e0c('0x47')];_0x1f43a7+=0x1){_0x360e50=_0x3581fd[_0x1f43a7]['toString']();logger['info'](_0x6e0c('0x4c'),_0x360e50);if(_0x16ec2e){logger['info'](_0x6e0c('0x4d'),_0x16ec2e);logger[_0x6e0c('0xd')](JSON[_0x6e0c('0x2a')](_0x2925a2[_0x360e50]));BPromise[_0x6e0c('0x4e')]()[_0x6e0c('0x3c')](handleJob(_0x2925a2[_0x360e50]));logger[_0x6e0c('0xd')](_0x6e0c('0x4f'),_0x2925a2[_0x360e50][_0x6e0c('0x1b')],_0x2925a2[_0x360e50][_0x6e0c('0x50')]);}else if(_0x2925a2[_0x360e50][_0x6e0c('0x50')]&&_0x2925a2[_0x360e50][_0x6e0c('0x51')]&&moment()[_0x6e0c('0x52')](_0x2925a2[_0x360e50][_0x6e0c('0x53')],_0x2925a2[_0x360e50]['endAt'])){manager[_0x6e0c('0x54')](_0x360e50,_0x2925a2[_0x360e50][_0x6e0c('0x50')],handleJob(_0x2925a2[_0x360e50]));manager[_0x6e0c('0x55')](_0x360e50);logger[_0x6e0c('0xd')]('add\x20cron',_0x2925a2[_0x360e50][_0x6e0c('0x1b')],_0x2925a2[_0x360e50][_0x6e0c('0x50')]);}else if(manager[_0x6e0c('0x56')](_0x360e50)){manager[_0x6e0c('0x48')](_0x360e50);manager[_0x6e0c('0x49')](_0x360e50);logger['info']('stop\x20cron',_0x2925a2[_0x360e50][_0x6e0c('0x1b')],_0x2925a2[_0x360e50][_0x6e0c('0x50')]);}}for(_0x1f43a7=0x0,_0x360e50;_0x1f43a7<_0xfbf1c4[_0x6e0c('0x47')]&&!_0x16ec2e;_0x1f43a7+=0x1){_0x360e50=_0xfbf1c4[_0x1f43a7][_0x6e0c('0x44')]();if(manager['exists'](_0x360e50)){if(_0x2925a2[_0x360e50]['cron']&&_0x2925a2[_0x360e50][_0x6e0c('0x51')]&&moment()[_0x6e0c('0x52')](_0x2925a2[_0x360e50]['startAt'],_0x2925a2[_0x360e50]['endAt'])){manager[_0x6e0c('0x57')](_0x360e50,_0x2925a2[_0x360e50]['cron'],handleJob(_0x2925a2[_0x360e50]));logger[_0x6e0c('0xd')](_0x6e0c('0x58'),_0x2925a2[_0x360e50][_0x6e0c('0x1b')],_0x2925a2[_0x360e50]['cron']);}else{manager[_0x6e0c('0x48')](_0x360e50);manager[_0x6e0c('0x49')](_0x360e50);logger[_0x6e0c('0xd')]('stop\x20cron',_0x2925a2[_0x360e50][_0x6e0c('0x1b')],_0x2925a2[_0x360e50][_0x6e0c('0x50')]);}}}})[_0x6e0c('0x33')](function(_0xd43e6b){logger[_0x6e0c('0x31')](JSON[_0x6e0c('0x2a')](_0xd43e6b));});}exports[_0x6e0c('0x59')]=function(_0x22d58c){return getJobs(_0x22d58c);};exports[_0x6e0c('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xfa71=['Smtp','service','host','port','secure','authentication','auth','pass','name','user','format','join','../../files/reports','%s.%s','extname','savename','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','sendIfEmpty','request','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','exists','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','add','start','add\x20cron','stop','deleteJob','stop\x20cron','isBetween','update','update\x20cron','util','lodash','moment','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount'];(function(_0x2cc3dd,_0x3aa3d7){var _0x2f4f15=function(_0x30721c){while(--_0x30721c){_0x2cc3dd['push'](_0x2cc3dd['shift']());}};_0x2f4f15(++_0x3aa3d7);}(_0xfa71,0x1b8));var _0x1fa7=function(_0x506380,_0x4cc05e){_0x506380=_0x506380-0x0;var _0x2d7d52=_0xfa71[_0x506380];return _0x2d7d52;};'use strict';var fs=require('fs');var util=require(_0x1fa7('0x0'));var path=require('path');var _=require(_0x1fa7('0x1'));var moment=require(_0x1fa7('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x1fa7('0x3'));var BPromise=require(_0x1fa7('0x4'));var logger=require('../logger')(_0x1fa7('0x5'));var db=require(_0x1fa7('0x6'))['db'];var analyticCustomReportController=require(_0x1fa7('0x7'));var analyticDefaultReportController=require(_0x1fa7('0x8'));var client=jayson[_0x1fa7('0x9')][_0x1fa7('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4c15eb,_0x3added){return function(){logger[_0x1fa7('0xb')](_0x1fa7('0xc'),_0x4c15eb[_0x1fa7('0xd')]);var _0x3c7cee=!![];var _0x10c5fe={'tls':{'rejectUnauthorized':![]}};if(_0x4c15eb[_0x1fa7('0xe')][_0x1fa7('0xf')][_0x1fa7('0x10')]){_0x10c5fe[_0x1fa7('0x10')]=_0x4c15eb['MailAccount'][_0x1fa7('0xf')]['service'];}else{_0x10c5fe['host']=_0x4c15eb[_0x1fa7('0xe')][_0x1fa7('0xf')][_0x1fa7('0x11')];_0x10c5fe[_0x1fa7('0x12')]=_0x4c15eb['MailAccount'][_0x1fa7('0xf')]['port'];_0x10c5fe[_0x1fa7('0x13')]=_0x4c15eb['MailAccount']['Smtp']['secure'];}if(_0x4c15eb['MailAccount'][_0x1fa7('0xf')][_0x1fa7('0x14')]){_0x10c5fe[_0x1fa7('0x15')]={'user':_0x4c15eb[_0x1fa7('0xe')]['Smtp']['user'],'pass':_0x4c15eb[_0x1fa7('0xe')]['Smtp'][_0x1fa7('0x16')]};}var _0x404e80={'account':_0x10c5fe,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4c15eb['MailAccount'][_0x1fa7('0x17')],_0x4c15eb[_0x1fa7('0xe')]['email']||_0x4c15eb[_0x1fa7('0xe')][_0x1fa7('0xf')][_0x1fa7('0x18')]),'to':_0x4c15eb[_0x1fa7('0xd')],'cc':_0x4c15eb['cc'],'bcc':_0x4c15eb['bcc'],'subject':util[_0x1fa7('0x19')]('Report\x20%s\x20last\x20%s\x20%s',_0x3added[_0x1fa7('0x17')],_0x4c15eb['subtractNumber'],_0x4c15eb['subtractUnit'])}};var _0x3ea510=path[_0x1fa7('0x1a')](__dirname,_0x1fa7('0x1b'));var _0x35d6b6=_0x3added['savename'];var _0x4fb86f=util['format'](_0x1fa7('0x1c'),path['basename'](_0x3added['savename'],path[_0x1fa7('0x1d')](_0x3added[_0x1fa7('0x1e')])),_0x1fa7('0x1f'));var _0x2f5551=path[_0x1fa7('0x1a')](_0x3ea510,_0x35d6b6);var _0x2b7dc7=path['join'](_0x3ea510,_0x4fb86f);if(fs[_0x1fa7('0x20')](_0x2f5551)){_0x3added[_0x1fa7('0x21')]=_0x1fa7('0x22');_0x404e80[_0x1fa7('0x23')]['attachments']=[{'filename':_0x35d6b6,'path':_0x2f5551}];_0x404e80['message'][_0x1fa7('0x24')]=util['format'](_0x1fa7('0x25'),JSON[_0x1fa7('0x26')](_0x3added,null,0x2));}else if(fs[_0x1fa7('0x20')](_0x2b7dc7)){_0x3added[_0x1fa7('0x21')]=_0x1fa7('0x22');_0x404e80[_0x1fa7('0x23')][_0x1fa7('0x27')]=[{'filename':_0x4fb86f,'path':_0x2b7dc7}];}else{_0x404e80[_0x1fa7('0x23')][_0x1fa7('0x24')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x4c15eb[_0x1fa7('0x28')]){_0x3c7cee=![];logger[_0x1fa7('0xb')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3c7cee){return client[_0x1fa7('0x29')]('SendMail',_0x404e80)['then'](function(_0x5163d5){if(_0x5163d5[_0x1fa7('0x2a')]){return logger[_0x1fa7('0x2a')](_0x1fa7('0x2b'),JSON[_0x1fa7('0x26')](_0x5163d5));}return logger[_0x1fa7('0xb')](_0x1fa7('0x2c'));})[_0x1fa7('0x2d')](function(_0x5d06e4){return logger[_0x1fa7('0x2a')](_0x1fa7('0x2b'),JSON[_0x1fa7('0x26')](_0x5d06e4));});}};}function handleError(){return function(_0x27b671){return logger[_0x1fa7('0x2a')](JSON[_0x1fa7('0x26')](_0x27b671));};}function handleResult(_0x360fd0){return function(_0x101e1c){logger['info']('data',JSON[_0x1fa7('0x26')](_0x101e1c));if(_0x360fd0[_0x1fa7('0xe')]&&_0x360fd0['MailAccount'][_0x1fa7('0xf')]&&!_[_0x1fa7('0x2e')](_0x360fd0[_0x1fa7('0xd')])){setTimeout(handleSendEmail(_0x360fd0,_0x101e1c),0x3c*0x3e8);}};}function handleJob(_0x2efc0b){return function(){try{if(_[_0x1fa7('0x2e')](_0x2efc0b[_0x1fa7('0x2f')])){return logger[_0x1fa7('0xb')](_0x1fa7('0x30'));}if(_[_0x1fa7('0x2e')](_0x2efc0b[_0x1fa7('0x31')])){return logger['info'](_0x1fa7('0x32'));}var _0x27274a={'startDate':moment()['subtract'](_0x2efc0b[_0x1fa7('0x2f')],_0x2efc0b[_0x1fa7('0x31')])[_0x1fa7('0x19')](_0x1fa7('0x33')),'endDate':moment()['format'](_0x1fa7('0x33')),'type':_0x1fa7('0x34'),'output':_0x2efc0b[_0x1fa7('0x35')],'name':_0x2efc0b[_0x1fa7('0x17')]};if(!_['isNil'](_0x2efc0b[_0x1fa7('0x36')])){logger[_0x1fa7('0xb')](_0x1fa7('0x37'),_0x2efc0b[_0x1fa7('0x36')]);return analyticDefaultReportController['runReport']({'id':_0x2efc0b['DefaultReportId']},_0x27274a)[_0x1fa7('0x38')](handleResult(_0x2efc0b))[_0x1fa7('0x2d')](handleError());}if(!_[_0x1fa7('0x2e')](_0x2efc0b['CustomReportId'])){logger[_0x1fa7('0xb')](_0x1fa7('0x39'),_0x2efc0b[_0x1fa7('0x3a')]);return analyticCustomReportController['runReport']({'id':_0x2efc0b['CustomReportId']},_0x27274a)[_0x1fa7('0x38')](handleResult(_0x2efc0b))[_0x1fa7('0x2d')](handleError());}}catch(_0x5a4a28){logger[_0x1fa7('0x2a')](JSON[_0x1fa7('0x26')](_0x5a4a28));}return logger[_0x1fa7('0xb')](_0x1fa7('0x3b'));};}function getJobs(_0x2c15e5){var _0x232725={};if(_0x2c15e5){_0x232725['id']=_0x2c15e5;}return db[_0x1fa7('0x3c')][_0x1fa7('0x3d')]({'where':_0x232725,'include':[{'model':db[_0x1fa7('0xe')],'attributes':['id','name','email'],'include':[{'model':db[_0x1fa7('0x3e')],'as':'Smtp'}]}]})['then'](function(_0x559963){var _0x2e3698=_[_0x1fa7('0x3f')](manager[_0x1fa7('0x40')]);var _0x398dab=_[_0x1fa7('0x41')](_0x559963,function(_0x30b0cf){return _0x30b0cf['id'][_0x1fa7('0x42')]();});var _0x98b640=_[_0x1fa7('0x43')](_0x559963,function(_0x193c1c){return _0x193c1c['id'][_0x1fa7('0x42')]();});var _0x21fb0a=_0x2c15e5?_0x398dab:_[_0x1fa7('0x44')](_0x398dab,_0x2e3698);var _0xb29d6f=_[_0x1fa7('0x45')](_0x398dab,_0x2e3698);var _0x2b1241=_[_0x1fa7('0x44')](_0x2e3698,_0x398dab);var _0x432e22;var _0x11c68c;for(_0x432e22=0x0;_0x432e22<_0x2b1241['length']&&!_0x2c15e5;_0x432e22+=0x1){_0x11c68c=_0x2b1241[_0x432e22][_0x1fa7('0x42')]();if(manager[_0x1fa7('0x46')](_0x11c68c)){manager['stop'](_0x11c68c);manager['deleteJob'](_0x11c68c);logger[_0x1fa7('0xb')](_0x1fa7('0x47'),_0x11c68c);}}logger[_0x1fa7('0xb')](_0x1fa7('0x48'),JSON['stringify'](_0x21fb0a));for(_0x432e22=0x0;_0x432e22<_0x21fb0a[_0x1fa7('0x49')];_0x432e22+=0x1){_0x11c68c=_0x21fb0a[_0x432e22][_0x1fa7('0x42')]();logger[_0x1fa7('0xb')](_0x1fa7('0x4a'),_0x11c68c);if(_0x2c15e5){logger[_0x1fa7('0xb')](_0x1fa7('0x4b'),_0x2c15e5);logger[_0x1fa7('0xb')](JSON[_0x1fa7('0x26')](_0x98b640[_0x11c68c]));BPromise[_0x1fa7('0x4c')]()['then'](handleJob(_0x98b640[_0x11c68c]));logger['info'](_0x1fa7('0x4d'),_0x98b640[_0x11c68c]['name'],_0x98b640[_0x11c68c][_0x1fa7('0x4e')]);}else if(_0x98b640[_0x11c68c][_0x1fa7('0x4e')]&&_0x98b640[_0x11c68c][_0x1fa7('0x4f')]&&moment()['isBetween'](_0x98b640[_0x11c68c][_0x1fa7('0x50')],_0x98b640[_0x11c68c][_0x1fa7('0x51')])){manager[_0x1fa7('0x52')](_0x11c68c,_0x98b640[_0x11c68c][_0x1fa7('0x4e')],handleJob(_0x98b640[_0x11c68c]));manager[_0x1fa7('0x53')](_0x11c68c);logger[_0x1fa7('0xb')](_0x1fa7('0x54'),_0x98b640[_0x11c68c][_0x1fa7('0x17')],_0x98b640[_0x11c68c][_0x1fa7('0x4e')]);}else if(manager[_0x1fa7('0x46')](_0x11c68c)){manager[_0x1fa7('0x55')](_0x11c68c);manager[_0x1fa7('0x56')](_0x11c68c);logger[_0x1fa7('0xb')](_0x1fa7('0x57'),_0x98b640[_0x11c68c][_0x1fa7('0x17')],_0x98b640[_0x11c68c][_0x1fa7('0x4e')]);}}for(_0x432e22=0x0,_0x11c68c;_0x432e22<_0xb29d6f[_0x1fa7('0x49')]&&!_0x2c15e5;_0x432e22+=0x1){_0x11c68c=_0xb29d6f[_0x432e22][_0x1fa7('0x42')]();if(manager[_0x1fa7('0x46')](_0x11c68c)){if(_0x98b640[_0x11c68c][_0x1fa7('0x4e')]&&_0x98b640[_0x11c68c][_0x1fa7('0x4f')]&&moment()[_0x1fa7('0x58')](_0x98b640[_0x11c68c][_0x1fa7('0x50')],_0x98b640[_0x11c68c][_0x1fa7('0x51')])){manager[_0x1fa7('0x59')](_0x11c68c,_0x98b640[_0x11c68c][_0x1fa7('0x4e')],handleJob(_0x98b640[_0x11c68c]));logger[_0x1fa7('0xb')](_0x1fa7('0x5a'),_0x98b640[_0x11c68c][_0x1fa7('0x17')],_0x98b640[_0x11c68c][_0x1fa7('0x4e')]);}else{manager[_0x1fa7('0x55')](_0x11c68c);manager['deleteJob'](_0x11c68c);logger['info']('stop\x20cron',_0x98b640[_0x11c68c][_0x1fa7('0x17')],_0x98b640[_0x11c68c][_0x1fa7('0x4e')]);}}}})['catch'](function(_0x27a469){logger[_0x1fa7('0x2a')](JSON[_0x1fa7('0x26')](_0x27a469));});}exports['run']=function(_0x2dc134){return getJobs(_0x2dc134);};exports[_0x1fa7('0x53')]=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 e7e617d..af20f9a 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 _0x1b4b=['No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','error','start','lodash','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','ValidationError','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','language','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Mixed','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1b4b,0x9f));var _0xb1b4=function(_0x5b76ee,_0x27e336){_0x5b76ee=_0x5b76ee-0x0;var _0x200d85=_0x1b4b[_0x5b76ee];return _0x200d85;};var _=require(_0xb1b4('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0xb1b4('0x1'));var BPromise=require('bluebird');var db=require(_0xb1b4('0x2'))['db'];var logger=require(_0xb1b4('0x3'))(_0xb1b4('0x4'));function getTranscriptionJob(_0x3fe33c,_0x45f667,_0x56689f,_0x30340f){return new Promise(function(_0x5aada6,_0x20d845){var _0x391b4d=new AWS[(_0xb1b4('0x5'))]({'accessKeyId':_0x45f667,'secretAccessKey':_0x3fe33c,'region':_0x56689f});_0x391b4d[_0xb1b4('0x6')]({'TranscriptionJobName':_0x30340f},function(_0x3cf5d8,_0xc8ec9f){if(_0x3cf5d8){return _0x20d845(_0x3cf5d8);}else{return _0x5aada6(_0xc8ec9f);}});});}function sentiment(_0xf055fe,_0xfe6c1d,_0x864680,_0x3d5129,_0x4259cd){return new Promise(function(_0x843f96,_0x584781){var _0x5a6ce1=new AWS[(_0xb1b4('0x7'))]({'accessKeyId':_0xfe6c1d,'secretAccessKey':_0xf055fe,'region':_0x864680});_0x5a6ce1[_0xb1b4('0x8')]({'Text':_0x3d5129,'LanguageCode':_0x4259cd[_0xb1b4('0x9')](0x0,0x2)},function(_0xb051f7,_0xa3659c){if(_0xb051f7){return _0x584781(_0xb051f7);}else{return _0x843f96(_0xa3659c);}});});}function checkTranscribeJob(_0x5ae1b3,_0x363126,_0x673d81){var _0x2a1ef1;return new BPromise(function(_0x2cc7c2,_0x3e5914){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5ae1b3['id'],_0x5ae1b3[_0xb1b4('0xc')]));return getTranscriptionJob(_0x673d81['data1'],_0x673d81['data2'],_0x363126['transcribeRegion'],_0x5ae1b3[_0xb1b4('0xc')])[_0xb1b4('0xd')](function(_0x2b611e){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0xe'),_0x5ae1b3['id'],_0x5ae1b3[_0xb1b4('0xc')],_0x2b611e[_0xb1b4('0xf')]['TranscriptionJobStatus']));if(!_0x5ae1b3[_0xb1b4('0x10')]){switch(_0x2b611e[_0xb1b4('0xf')][_0xb1b4('0x11')]){case _0xb1b4('0x12'):var _0x416a77={'transcribeStatus':_0x2b611e[_0xb1b4('0xf')][_0xb1b4('0x11')],'fileUri':_0x2b611e[_0xb1b4('0xf')][_0xb1b4('0x13')][_0xb1b4('0x14')]};logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x15'),_0x5ae1b3['id']));return rp({'uri':_0x2b611e[_0xb1b4('0xf')][_0xb1b4('0x13')][_0xb1b4('0x14')],'json':!![]})[_0xb1b4('0xd')](function(_0x47fc49){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x16'),_0x5ae1b3['id']));if(_0x47fc49&&_0x47fc49[_0xb1b4('0x17')]&&_0x47fc49[_0xb1b4('0x17')]['transcripts']&&_0x47fc49[_0xb1b4('0x17')][_0xb1b4('0x18')][_0xb1b4('0x19')]){_0x416a77['fileText']='';for(var _0x285203=0x0;_0x285203<_0x47fc49[_0xb1b4('0x17')][_0xb1b4('0x18')]['length'];_0x285203++){_0x416a77[_0xb1b4('0x10')]+=_0x47fc49[_0xb1b4('0x17')][_0xb1b4('0x18')][_0x285203][_0xb1b4('0x1a')]+'';}}return _0x5ae1b3[_0xb1b4('0x1b')](_0x416a77);})['then'](function(){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x1c'),_0x5ae1b3['id']));if(!_0x5ae1b3[_0xb1b4('0x1d')]){throw new db[(_0xb1b4('0x1e'))]['ValidationError'](_0xb1b4('0x1f'));}if(!_0x363126[_0xb1b4('0x20')]||!_0x363126[_0xb1b4('0x21')]||!_0x363126[_0xb1b4('0x22')]||!_0x363126['language']||!_0x363126[_0xb1b4('0x23')]){throw new db[(_0xb1b4('0x1e'))]['ValidationError'](_0xb1b4('0x24'));}if(!_0x416a77[_0xb1b4('0x10')]){throw new Error(_0xb1b4('0x25'));}if(_0x363126[_0xb1b4('0x21')]===_0x673d81['id']){return _0x673d81;}else{return db[_0xb1b4('0x26')]['findOne']({'where':{'id':_settings[_0xb1b4('0x21')]}});}})[_0xb1b4('0xd')](function(_0x1286fd){if(!_0x1286fd){throw new db[(_0xb1b4('0x1e'))][(_0xb1b4('0x27'))](_0xb1b4('0x28'));}if(!_0x1286fd[_0xb1b4('0x29')]||!_0x1286fd[_0xb1b4('0x2a')]){throw new db[(_0xb1b4('0x1e'))][(_0xb1b4('0x27'))](_0xb1b4('0x2b'));}_0x2a1ef1=_0x1286fd;logger['info'](util[_0xb1b4('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5ae1b3['id']));return sentiment(_0x2a1ef1[_0xb1b4('0x29')],_0x2a1ef1[_0xb1b4('0x2a')],_0x363126[_0xb1b4('0x22')],_0x416a77[_0xb1b4('0x10')],_0x363126[_0xb1b4('0x2c')]);})[_0xb1b4('0xd')](function(_0x52c8f2){logger['info'](util[_0xb1b4('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5ae1b3['id']));return _0x5ae1b3[_0xb1b4('0x1b')]({'sentiment':_0x52c8f2[_0xb1b4('0x2d')],'sPositive':_0x52c8f2[_0xb1b4('0x2e')][_0xb1b4('0x2f')],'sNegative':_0x52c8f2[_0xb1b4('0x2e')][_0xb1b4('0x30')],'sMixed':_0x52c8f2[_0xb1b4('0x2e')]['Mixed'],'sNeutral':_0x52c8f2[_0xb1b4('0x2e')][_0xb1b4('0x31')]});})[_0xb1b4('0xd')](function(){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x1c'),_0x5ae1b3['id']));_0x2cc7c2();});case'FAILED':return _0x5ae1b3[_0xb1b4('0x1b')]({'transcribeStatus':_0xb1b4('0x32'),'failureReason':_0x2b611e['TranscriptionJob'][_0xb1b4('0x33')]})[_0xb1b4('0xd')](function(){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x1c'),_0x5ae1b3['id']));_0x2cc7c2();});default:logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x34'),_0x5ae1b3['id']));break;}}else{return BPromise[_0xb1b4('0x35')]()[_0xb1b4('0xd')](function(){if(!_0x5ae1b3[_0xb1b4('0x1d')]){throw new db['Sequelize'][(_0xb1b4('0x27'))](_0xb1b4('0x1f'));}if(!_0x363126[_0xb1b4('0x20')]||!_0x363126['sentimentAccountId']||!_0x363126[_0xb1b4('0x22')]||!_0x363126[_0xb1b4('0x2c')]||!_0x363126['bucket']){throw new db['Sequelize'][(_0xb1b4('0x27'))](_0xb1b4('0x24'));}if(!_0x5ae1b3[_0xb1b4('0x10')]){throw new Error(_0xb1b4('0x25'));}if(_0x363126[_0xb1b4('0x21')]===_0x673d81['id']){return _0x673d81;}else{return db[_0xb1b4('0x26')][_0xb1b4('0x36')]({'where':{'id':_settings[_0xb1b4('0x21')]}});}})[_0xb1b4('0xd')](function(_0xd89ba){if(!_0xd89ba){throw new db['Sequelize']['ValidationError'](_0xb1b4('0x28'));}if(!_0xd89ba[_0xb1b4('0x29')]||!_0xd89ba[_0xb1b4('0x2a')]){throw new db[(_0xb1b4('0x1e'))][(_0xb1b4('0x27'))](_0xb1b4('0x2b'));}_0x2a1ef1=_0xd89ba;logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x37'),_0x5ae1b3['id']));return sentiment(_0x2a1ef1[_0xb1b4('0x29')],_0x2a1ef1[_0xb1b4('0x2a')],_0x363126['sentimentRegion'],_0x5ae1b3[_0xb1b4('0x10')],_0x363126['language']);})[_0xb1b4('0xd')](function(_0x4c176f){logger[_0xb1b4('0xa')](util['format'](_0xb1b4('0x38'),_0x5ae1b3['id']));return _0x5ae1b3[_0xb1b4('0x1b')]({'sentiment':_0x4c176f[_0xb1b4('0x2d')],'sPositive':_0x4c176f['SentimentScore'][_0xb1b4('0x2f')],'sNegative':_0x4c176f['SentimentScore'][_0xb1b4('0x30')],'sMixed':_0x4c176f[_0xb1b4('0x2e')][_0xb1b4('0x39')],'sNeutral':_0x4c176f[_0xb1b4('0x2e')][_0xb1b4('0x31')],'transcribeStatus':_0xb1b4('0x12')});})[_0xb1b4('0xd')](function(){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5ae1b3['id']));_0x2cc7c2();});}})[_0xb1b4('0x3a')](function(_0x5316c6){if(_0x5316c6){if(!_0x5316c6[_0xb1b4('0x3b')]||_0x5316c6[_0xb1b4('0x3b')]!==_0xb1b4('0x3c')){logger['error'](util['format'](_0xb1b4('0x3d'),_0x5ae1b3['id']),util[_0xb1b4('0x3e')](_0x5316c6,{'showHidden':![],'depth':null}));}}_0x2cc7c2();});});}function checkTranscribe(){var _0x5f3808;var _0x3e2a7b;var _0x164db3;return db[_0xb1b4('0x3f')][_0xb1b4('0x40')]({'where':{'transcribeStatus':_0xb1b4('0x41')}})[_0xb1b4('0xd')](function(_0x2900b9){if(!_0x2900b9||!_0x2900b9[_0xb1b4('0x19')]){throw new db[(_0xb1b4('0x1e'))]['ValidationError'](_0xb1b4('0x42'));}_0x5f3808=_0x2900b9;return db['Setting'][_0xb1b4('0x36')]({'where':{'id':0x1}});})[_0xb1b4('0xd')](function(_0x313b58){if(!_0x313b58){throw new db[(_0xb1b4('0x1e'))]['ValidationError'](_0xb1b4('0x43'));}_0x3e2a7b=_0x313b58;if(!_0x3e2a7b['transcribe']||!_0x3e2a7b[_0xb1b4('0x44')]||!_0x3e2a7b[_0xb1b4('0x45')]||!_0x3e2a7b[_0xb1b4('0x2c')]||!_0x3e2a7b[_0xb1b4('0x23')]){throw new db['Sequelize'][(_0xb1b4('0x27'))](_0xb1b4('0x46'));}return db[_0xb1b4('0x26')][_0xb1b4('0x36')]({'where':{'id':_0x3e2a7b[_0xb1b4('0x44')]}});})[_0xb1b4('0xd')](function(_0x253317){if(!_0x253317){throw new db[(_0xb1b4('0x1e'))][(_0xb1b4('0x27'))](_0xb1b4('0x28'));}if(!_0x253317[_0xb1b4('0x29')]||!_0x253317[_0xb1b4('0x2a')]){throw new db['Sequelize'][(_0xb1b4('0x27'))](_0xb1b4('0x2b'));}_0x164db3=_0x253317;var _0x2868be=[];_0x5f3808[_0xb1b4('0x47')](function(_0x3305c2){_0x2868be[_0xb1b4('0x48')](checkTranscribeJob(_0x3305c2,_0x3e2a7b,_0x164db3));});return BPromise['all'](_0x2868be);})['catch'](function(_0x5cadd0){if(_0x5cadd0){if(!_0x5cadd0[_0xb1b4('0x3b')]||_0x5cadd0['name']!==_0xb1b4('0x3c')){logger[_0xb1b4('0x49')](util[_0xb1b4('0x3e')](_0x5cadd0,{'showHidden':![],'depth':null}));}}});}exports[_0xb1b4('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x7e8e=['bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','Sentiment','Negative','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','catch','name','error','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','Transcribe\x20not\x20configured','forEach','SequelizeValidationError','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','detectSentiment','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','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion'];(function(_0x39532d,_0x44d48c){var _0x3efc86=function(_0x2ef3db){while(--_0x2ef3db){_0x39532d['push'](_0x39532d['shift']());}};_0x3efc86(++_0x44d48c);}(_0x7e8e,0xac));var _0xe7e8=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0x7e8e[_0x270a54];return _0x4d07d0;};var _=require(_0xe7e8('0x0'));var AWS=require(_0xe7e8('0x1'));var rp=require('request-promise');var util=require(_0xe7e8('0x2'));var BPromise=require(_0xe7e8('0x3'));var db=require(_0xe7e8('0x4'))['db'];var logger=require(_0xe7e8('0x5'))('transcribe');function getTranscriptionJob(_0x9d79d3,_0x533258,_0x442bee,_0x39d164){return new Promise(function(_0xa272d1,_0x49035e){var _0x2a9335=new AWS[(_0xe7e8('0x6'))]({'accessKeyId':_0x533258,'secretAccessKey':_0x9d79d3,'region':_0x442bee});_0x2a9335['getTranscriptionJob']({'TranscriptionJobName':_0x39d164},function(_0x885f7c,_0x497377){if(_0x885f7c){return _0x49035e(_0x885f7c);}else{return _0xa272d1(_0x497377);}});});}function sentiment(_0x37287c,_0x458515,_0xff9fb7,_0xb32b02,_0xa6bed0){return new Promise(function(_0xf30f09,_0x2e680d){var _0x5e662d=new AWS['Comprehend']({'accessKeyId':_0x458515,'secretAccessKey':_0x37287c,'region':_0xff9fb7});_0x5e662d[_0xe7e8('0x7')]({'Text':_0xb32b02,'LanguageCode':_0xa6bed0[_0xe7e8('0x8')](0x0,0x2)},function(_0x74a87c,_0x517153){if(_0x74a87c){return _0x2e680d(_0x74a87c);}else{return _0xf30f09(_0x517153);}});});}function checkTranscribeJob(_0x57d028,_0x56eeb5,_0x4d0678){var _0x47af2d;return new BPromise(function(_0x5d3585,_0x6eddf2){logger['info'](util[_0xe7e8('0x9')](_0xe7e8('0xa'),_0x57d028['id'],_0x57d028[_0xe7e8('0xb')]));return getTranscriptionJob(_0x4d0678[_0xe7e8('0xc')],_0x4d0678[_0xe7e8('0xd')],_0x56eeb5[_0xe7e8('0xe')],_0x57d028[_0xe7e8('0xb')])[_0xe7e8('0xf')](function(_0x561dc4){logger[_0xe7e8('0x10')](util[_0xe7e8('0x9')](_0xe7e8('0x11'),_0x57d028['id'],_0x57d028['transcribeName'],_0x561dc4[_0xe7e8('0x12')][_0xe7e8('0x13')]));if(!_0x57d028[_0xe7e8('0x14')]){switch(_0x561dc4[_0xe7e8('0x12')][_0xe7e8('0x13')]){case _0xe7e8('0x15'):var _0xc33987={'transcribeStatus':_0x561dc4[_0xe7e8('0x12')][_0xe7e8('0x13')],'fileUri':_0x561dc4[_0xe7e8('0x12')]['Transcript'][_0xe7e8('0x16')]};logger[_0xe7e8('0x10')](util[_0xe7e8('0x9')](_0xe7e8('0x17'),_0x57d028['id']));return rp({'uri':_0x561dc4[_0xe7e8('0x12')][_0xe7e8('0x18')][_0xe7e8('0x16')],'json':!![]})[_0xe7e8('0xf')](function(_0x4c5ff7){logger[_0xe7e8('0x10')](util[_0xe7e8('0x9')](_0xe7e8('0x19'),_0x57d028['id']));if(_0x4c5ff7&&_0x4c5ff7[_0xe7e8('0x1a')]&&_0x4c5ff7['results'][_0xe7e8('0x1b')]&&_0x4c5ff7[_0xe7e8('0x1a')][_0xe7e8('0x1b')][_0xe7e8('0x1c')]){_0xc33987['fileText']='';for(var _0x3dd61a=0x0;_0x3dd61a<_0x4c5ff7[_0xe7e8('0x1a')]['transcripts'][_0xe7e8('0x1c')];_0x3dd61a++){_0xc33987[_0xe7e8('0x14')]+=_0x4c5ff7[_0xe7e8('0x1a')][_0xe7e8('0x1b')][_0x3dd61a][_0xe7e8('0x1d')]+'';}}return _0x57d028[_0xe7e8('0x1e')](_0xc33987);})['then'](function(){logger[_0xe7e8('0x10')](util[_0xe7e8('0x9')](_0xe7e8('0x1f'),_0x57d028['id']));if(!_0x57d028[_0xe7e8('0x20')]){throw new db[(_0xe7e8('0x21'))][(_0xe7e8('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x56eeb5[_0xe7e8('0x23')]||!_0x56eeb5[_0xe7e8('0x24')]||!_0x56eeb5[_0xe7e8('0x25')]||!_0x56eeb5['language']||!_0x56eeb5[_0xe7e8('0x26')]){throw new db[(_0xe7e8('0x21'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0xc33987[_0xe7e8('0x14')]){throw new Error(_0xe7e8('0x27'));}if(_0x56eeb5[_0xe7e8('0x24')]===_0x4d0678['id']){return _0x4d0678;}else{return db[_0xe7e8('0x28')][_0xe7e8('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x3bc7fc){if(!_0x3bc7fc){throw new db['Sequelize'][(_0xe7e8('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3bc7fc[_0xe7e8('0xc')]||!_0x3bc7fc[_0xe7e8('0xd')]){throw new db[(_0xe7e8('0x21'))][(_0xe7e8('0x22'))](_0xe7e8('0x2a'));}_0x47af2d=_0x3bc7fc;logger[_0xe7e8('0x10')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x57d028['id']));return sentiment(_0x47af2d['data1'],_0x47af2d[_0xe7e8('0xd')],_0x56eeb5[_0xe7e8('0x25')],_0xc33987[_0xe7e8('0x14')],_0x56eeb5['language']);})[_0xe7e8('0xf')](function(_0x469634){logger[_0xe7e8('0x10')](util[_0xe7e8('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x57d028['id']));return _0x57d028[_0xe7e8('0x1e')]({'sentiment':_0x469634[_0xe7e8('0x2b')],'sPositive':_0x469634['SentimentScore']['Positive'],'sNegative':_0x469634['SentimentScore'][_0xe7e8('0x2c')],'sMixed':_0x469634[_0xe7e8('0x2d')][_0xe7e8('0x2e')],'sNeutral':_0x469634[_0xe7e8('0x2d')][_0xe7e8('0x2f')]});})[_0xe7e8('0xf')](function(){logger['info'](util[_0xe7e8('0x9')](_0xe7e8('0x1f'),_0x57d028['id']));_0x5d3585();});case _0xe7e8('0x30'):return _0x57d028[_0xe7e8('0x1e')]({'transcribeStatus':_0xe7e8('0x30'),'failureReason':_0x561dc4[_0xe7e8('0x12')][_0xe7e8('0x31')]})[_0xe7e8('0xf')](function(){logger[_0xe7e8('0x10')](util['format'](_0xe7e8('0x1f'),_0x57d028['id']));_0x5d3585();});default:logger[_0xe7e8('0x10')](util[_0xe7e8('0x9')](_0xe7e8('0x32'),_0x57d028['id']));break;}}else{return BPromise[_0xe7e8('0x33')]()[_0xe7e8('0xf')](function(){if(!_0x57d028[_0xe7e8('0x20')]){throw new db[(_0xe7e8('0x21'))][(_0xe7e8('0x22'))](_0xe7e8('0x34'));}if(!_0x56eeb5[_0xe7e8('0x23')]||!_0x56eeb5[_0xe7e8('0x24')]||!_0x56eeb5[_0xe7e8('0x25')]||!_0x56eeb5[_0xe7e8('0x35')]||!_0x56eeb5['bucket']){throw new db['Sequelize'][(_0xe7e8('0x22'))](_0xe7e8('0x36'));}if(!_0x57d028[_0xe7e8('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x56eeb5[_0xe7e8('0x24')]===_0x4d0678['id']){return _0x4d0678;}else{return db[_0xe7e8('0x28')][_0xe7e8('0x29')]({'where':{'id':_settings[_0xe7e8('0x24')]}});}})[_0xe7e8('0xf')](function(_0x2a4210){if(!_0x2a4210){throw new db[(_0xe7e8('0x21'))][(_0xe7e8('0x22'))](_0xe7e8('0x37'));}if(!_0x2a4210['data1']||!_0x2a4210[_0xe7e8('0xd')]){throw new db['Sequelize'][(_0xe7e8('0x22'))](_0xe7e8('0x2a'));}_0x47af2d=_0x2a4210;logger[_0xe7e8('0x10')](util[_0xe7e8('0x9')](_0xe7e8('0x38'),_0x57d028['id']));return sentiment(_0x47af2d[_0xe7e8('0xc')],_0x47af2d[_0xe7e8('0xd')],_0x56eeb5['sentimentRegion'],_0x57d028[_0xe7e8('0x14')],_0x56eeb5[_0xe7e8('0x35')]);})['then'](function(_0x1bd517){logger[_0xe7e8('0x10')](util[_0xe7e8('0x9')](_0xe7e8('0x39'),_0x57d028['id']));return _0x57d028[_0xe7e8('0x1e')]({'sentiment':_0x1bd517[_0xe7e8('0x2b')],'sPositive':_0x1bd517[_0xe7e8('0x2d')][_0xe7e8('0x3a')],'sNegative':_0x1bd517[_0xe7e8('0x2d')][_0xe7e8('0x2c')],'sMixed':_0x1bd517[_0xe7e8('0x2d')][_0xe7e8('0x2e')],'sNeutral':_0x1bd517[_0xe7e8('0x2d')]['Neutral'],'transcribeStatus':_0xe7e8('0x15')});})[_0xe7e8('0xf')](function(){logger[_0xe7e8('0x10')](util[_0xe7e8('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x57d028['id']));_0x5d3585();});}})[_0xe7e8('0x3b')](function(_0x14f3b2){if(_0x14f3b2){if(!_0x14f3b2[_0xe7e8('0x3c')]||_0x14f3b2[_0xe7e8('0x3c')]!=='SequelizeValidationError'){logger[_0xe7e8('0x3d')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x57d028['id']),util[_0xe7e8('0x3e')](_0x14f3b2,{'showHidden':![],'depth':null}));}}_0x5d3585();});});}function checkTranscribe(){var _0x2e3463;var _0x17a8af;var _0x4fcb76;return db['VoiceRecording'][_0xe7e8('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xe7e8('0xf')](function(_0x67231f){if(!_0x67231f||!_0x67231f['length']){throw new db[(_0xe7e8('0x21'))][(_0xe7e8('0x22'))](_0xe7e8('0x40'));}_0x2e3463=_0x67231f;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0xe7e8('0xf')](function(_0x4d04a2){if(!_0x4d04a2){throw new db[(_0xe7e8('0x21'))][(_0xe7e8('0x22'))]('Settings\x20not\x20available');}_0x17a8af=_0x4d04a2;if(!_0x17a8af['transcribe']||!_0x17a8af[_0xe7e8('0x41')]||!_0x17a8af['transcribeRegion']||!_0x17a8af[_0xe7e8('0x35')]||!_0x17a8af[_0xe7e8('0x26')]){throw new db[(_0xe7e8('0x21'))]['ValidationError'](_0xe7e8('0x42'));}return db[_0xe7e8('0x28')]['findOne']({'where':{'id':_0x17a8af['transcribeAccountId']}});})[_0xe7e8('0xf')](function(_0x1e055a){if(!_0x1e055a){throw new db[(_0xe7e8('0x21'))][(_0xe7e8('0x22'))](_0xe7e8('0x37'));}if(!_0x1e055a[_0xe7e8('0xc')]||!_0x1e055a[_0xe7e8('0xd')]){throw new db[(_0xe7e8('0x21'))][(_0xe7e8('0x22'))](_0xe7e8('0x2a'));}_0x4fcb76=_0x1e055a;var _0x5758ea=[];_0x2e3463[_0xe7e8('0x43')](function(_0x4dad7a){_0x5758ea['push'](checkTranscribeJob(_0x4dad7a,_0x17a8af,_0x4fcb76));});return BPromise['all'](_0x5758ea);})[_0xe7e8('0x3b')](function(_0x118d43){if(_0x118d43){if(!_0x118d43[_0xe7e8('0x3c')]||_0x118d43[_0xe7e8('0x3c')]!==_0xe7e8('0x44')){logger[_0xe7e8('0x3d')](util['inspect'](_0x118d43,{'showHidden':![],'depth':null}));}}});}exports[_0xe7e8('0x45')]=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 196554d..904cb01 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 _0xed59=['../logger','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','YYYY-MM-DD\x20HH:mm:ss','then','emit','catch','error','start','lodash','ioredis','../../config/environment','../../mysqldb'];(function(_0x3a5fe0,_0x13fcd5){var _0x2a33b5=function(_0x3fb717){while(--_0x3fb717){_0x3a5fe0['push'](_0x3a5fe0['shift']());}};_0x2a33b5(++_0x13fcd5);}(_0xed59,0x182));var _0x9ed5=function(_0x23880b,_0x2f5b5a){_0x23880b=_0x23880b-0x0;var _0x1ee016=_0xed59[_0x23880b];return _0x1ee016;};'use strict';var _=require(_0x9ed5('0x0'));var moment=require('moment');var Redis=require(_0x9ed5('0x1'));var util=require('util');var config=require(_0x9ed5('0x2'));var db=require(_0x9ed5('0x3'))['db'];var logger=require(_0x9ed5('0x4'))('schedule');config['redis']=_[_0x9ed5('0x5')](config[_0x9ed5('0x6')],{'host':_0x9ed5('0x7'),'port':0x18eb});var io=require(_0x9ed5('0x8'))(new Redis(config[_0x9ed5('0x6')]));function closeInteractions(){var _0x225eb4=[];return db[_0x9ed5('0x9')][_0x9ed5('0xa')]({'raw':!![],'attributes':['id',_0x9ed5('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9ed5('0xc')](0x18,'hours')}}})['then'](function(_0x2a746d){if(_0x2a746d&&_0x2a746d[_0x9ed5('0xd')]){_0x225eb4=_[_0x9ed5('0xe')](_0x2a746d||[],'id');logger[_0x9ed5('0xf')](_0x9ed5('0x10'),_0x225eb4[_0x9ed5('0x11')]());return db[_0x9ed5('0x9')][_0x9ed5('0x12')]({'closeReason':_0x9ed5('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x9ed5('0x14'))},{'where':{'id':_0x225eb4}});}})[_0x9ed5('0x15')](function(){if(_0x225eb4&&_0x225eb4[_0x9ed5('0xd')]){logger[_0x9ed5('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x225eb4['join']());for(var _0x5914c2=0x0;_0x5914c2<_0x225eb4[_0x9ed5('0xd')];_0x5914c2++){io[_0x9ed5('0x16')]('whatsappInteraction:update',{'id':_0x225eb4[_0x5914c2],'closed':!![]});}}})[_0x9ed5('0x17')](function(_0x58dfb1){logger[_0x9ed5('0x18')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x58dfb1?util['inspect'](_0x58dfb1,{'showHidden':![],'depth':null}):'');});}exports[_0x9ed5('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6153=['WhatsappInteraction','lastMsgAt','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','format','YYYY-MM-DD\x20HH:mm:ss','then','join','emit','whatsappInteraction:update','catch','inspect','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','socket.io-emitter','redis'];(function(_0x285a14,_0x394a27){var _0x3430cc=function(_0x46d2d7){while(--_0x46d2d7){_0x285a14['push'](_0x285a14['shift']());}};_0x3430cc(++_0x394a27);}(_0x6153,0xad));var _0x3615=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6153[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x3615('0x0'));var moment=require(_0x3615('0x1'));var Redis=require(_0x3615('0x2'));var util=require(_0x3615('0x3'));var config=require(_0x3615('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x3615('0x5'))(_0x3615('0x6'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3615('0x7'))(new Redis(config[_0x3615('0x8')]));function closeInteractions(){var _0x3293d5=[];return db[_0x3615('0x9')]['findAll']({'raw':!![],'attributes':['id',_0x3615('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x3615('0xb'))}}})['then'](function(_0x4c1e82){if(_0x4c1e82&&_0x4c1e82[_0x3615('0xc')]){_0x3293d5=_[_0x3615('0xd')](_0x4c1e82||[],'id');logger[_0x3615('0xe')](_0x3615('0xf'),_0x3293d5['join']());return db[_0x3615('0x9')][_0x3615('0x10')]({'closeReason':_0x3615('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x3615('0x12')](_0x3615('0x13'))},{'where':{'id':_0x3293d5}});}})[_0x3615('0x14')](function(){if(_0x3293d5&&_0x3293d5['length']){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x3293d5[_0x3615('0x15')]());for(var _0x303019=0x0;_0x303019<_0x3293d5[_0x3615('0xc')];_0x303019++){io[_0x3615('0x16')](_0x3615('0x17'),{'id':_0x3293d5[_0x303019],'closed':!![]});}}})[_0x3615('0x18')](function(_0xb012f7){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0xb012f7?util[_0x3615('0x19')](_0xb012f7,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index e188a28..c687b7c 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8ee=['destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','log','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','CmContact'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0xa8ee,0x184));var _0xea8e=function(_0x4f06d6,_0x58b83d){_0x4f06d6=_0x4f06d6-0x0;var _0x4da6e7=_0xa8ee[_0x4f06d6];return _0x4da6e7;};'use strict';var util=require(_0xea8e('0x0'));var db=require(_0xea8e('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xea8e('0x2')]({'id':i,'firstName':_0xea8e('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xea8e('0x4')+i+_0xea8e('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xea8e('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xea8e('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xea8e('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xea8e('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xea8e('0x6')]()});}db[_0xea8e('0x7')][_0xea8e('0x8')]({'where':{}})[_0xea8e('0x9')](function(){return db[_0xea8e('0x7')][_0xea8e('0xa')](contacts);})[_0xea8e('0x9')](function(){console['log'](_0xea8e('0xb'),_0xea8e('0xc'));return db['CmHopper'][_0xea8e('0x8')]({'where':{}});})[_0xea8e('0x9')](function(){return db[_0xea8e('0xd')][_0xea8e('0xa')](hopper);})[_0xea8e('0x9')](function(){console['log'](_0xea8e('0xb'),_0xea8e('0xe'));return db['CmContact'][_0xea8e('0xa')](contacts2);})[_0xea8e('0x9')](function(){console['log']('finished\x20populating',_0xea8e('0xf'));return db[_0xea8e('0xd')][_0xea8e('0xa')](hopper2);})[_0xea8e('0x9')](function(){console[_0xea8e('0x10')]('finished\x20populating','hopper2');})[_0xea8e('0x11')](function(_0x1d144b){console[_0xea8e('0x10')](_0x1d144b);}); \ No newline at end of file +var _0xc3ee=['util','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','destroy','then','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch'];(function(_0x5ba9d3,_0x30cc3f){var _0x311de0=function(_0xfb1539){while(--_0xfb1539){_0x5ba9d3['push'](_0x5ba9d3['shift']());}};_0x311de0(++_0x30cc3f);}(_0xc3ee,0x1c8));var _0xec3e=function(_0x508db2,_0x449afb){_0x508db2=_0x508db2-0x0;var _0x39a2bd=_0xc3ee[_0x508db2];return _0x39a2bd;};'use strict';var util=require(_0xec3e('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xec3e('0x1')]({'id':i,'firstName':_0xec3e('0x2')+i,'lastName':_0xec3e('0x3')+i,'phone':0xf879fb460+i,'email':_0xec3e('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xec3e('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xec3e('0x5')](),'updatedAt':Date[_0xec3e('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xec3e('0x1')]({'id':i,'firstName':_0xec3e('0x2')+i,'lastName':_0xec3e('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xec3e('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xec3e('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xec3e('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xec3e('0x5')](),'updatedAt':Date[_0xec3e('0x5')]()});}db['CmContact'][_0xec3e('0x7')]({'where':{}})[_0xec3e('0x8')](function(){return db[_0xec3e('0x9')][_0xec3e('0xa')](contacts);})[_0xec3e('0x8')](function(){console[_0xec3e('0xb')](_0xec3e('0xc'),_0xec3e('0xd'));return db[_0xec3e('0xe')][_0xec3e('0x7')]({'where':{}});})['then'](function(){return db[_0xec3e('0xe')][_0xec3e('0xa')](hopper);})[_0xec3e('0x8')](function(){console[_0xec3e('0xb')](_0xec3e('0xc'),_0xec3e('0xf'));return db['CmContact']['bulkCreate'](contacts2);})['then'](function(){console['log'](_0xec3e('0xc'),_0xec3e('0x10'));return db[_0xec3e('0xe')][_0xec3e('0xa')](hopper2);})['then'](function(){console[_0xec3e('0xb')](_0xec3e('0xc'),_0xec3e('0x11'));})[_0xec3e('0x12')](function(_0x24c9a8){console['log'](_0x24c9a8);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index dc3d760..db0ebc6 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf77=['actpass','User','bulkCreate','then','log','util','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x36c32f,_0x27090a){var _0x1282a2=function(_0x377097){while(--_0x377097){_0x36c32f['push'](_0x36c32f['shift']());}};_0x1282a2(++_0x27090a);}(_0xcf77,0x113));var _0x7cf7=function(_0x362fe6,_0xb731ac){_0x362fe6=_0x362fe6-0x0;var _0x27cb29=_0xcf77[_0x362fe6];return _0x27cb29;};'use strict';var util=require(_0x7cf7('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7cf7('0x1')]({'name':util[_0x7cf7('0x2')](_0x7cf7('0x3'),'agent',i),'fullname':util['format'](_0x7cf7('0x3'),_0x7cf7('0x4'),i),'email':util[_0x7cf7('0x2')](_0x7cf7('0x5'),_0x7cf7('0x4'),i),'role':_0x7cf7('0x4'),'password':_0x7cf7('0x6'),'internal':0xfa0+i,'type':_0x7cf7('0x7'),'transport':[_0x7cf7('0x8'),'ws',_0x7cf7('0x9')],'disallow':['all'],'allow':[_0x7cf7('0xa')],'defaultuser':util[_0x7cf7('0x2')]('%s%s','agent',i),'encryption':'yes','avpf':_0x7cf7('0xb'),'force_avp':_0x7cf7('0xb'),'icesupport':_0x7cf7('0xb'),'dtlsenable':_0x7cf7('0xb'),'dtlsverify':'no','dtlscertfile':_0x7cf7('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x7cf7('0xd'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x7cf7('0x2')]('%s%s',_0x7cf7('0x4'),i),0xfa0+i)});}db[_0x7cf7('0xe')][_0x7cf7('0xf')](users)[_0x7cf7('0x10')](function(){console['log']('add\x20user');})['catch'](function(_0x238525){console[_0x7cf7('0x11')](_0x238525);}); \ No newline at end of file +var _0x2c1b=['%s%s','format','%s%s@xcally.com','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','util','../mysqldb','push'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x2c1b,0x87));var _0xb2c1=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x2c1b[_0x31ced5];return _0x10d9e5;};'use strict';var util=require(_0xb2c1('0x0'));var db=require(_0xb2c1('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb2c1('0x2')]({'name':util['format'](_0xb2c1('0x3'),'agent',i),'fullname':util[_0xb2c1('0x4')](_0xb2c1('0x3'),'agent',i),'email':util[_0xb2c1('0x4')](_0xb2c1('0x5'),_0xb2c1('0x6'),i),'role':_0xb2c1('0x6'),'password':_0xb2c1('0x7'),'internal':0xfa0+i,'type':_0xb2c1('0x8'),'transport':[_0xb2c1('0x9'),'ws',_0xb2c1('0xa')],'disallow':[_0xb2c1('0xb')],'allow':[_0xb2c1('0xc')],'defaultuser':util[_0xb2c1('0x4')](_0xb2c1('0x3'),_0xb2c1('0x6'),i),'encryption':_0xb2c1('0xd'),'avpf':_0xb2c1('0xd'),'force_avp':_0xb2c1('0xd'),'icesupport':_0xb2c1('0xd'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xb2c1('0xe'),'dtlsprivatekey':_0xb2c1('0xf'),'dtlssetup':_0xb2c1('0x10'),'callerid':util['format'](_0xb2c1('0x11'),util[_0xb2c1('0x4')](_0xb2c1('0x3'),_0xb2c1('0x6'),i),0xfa0+i)});}db[_0xb2c1('0x12')][_0xb2c1('0x13')](users)['then'](function(){console[_0xb2c1('0x14')](_0xb2c1('0x15'));})[_0xb2c1('0x16')](function(_0x24301e){console[_0xb2c1('0x14')](_0x24301e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 637f868..7ec9987 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc575=['OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueues','IvrCampaigns','getVoiceQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','mail','openchannel','telephone:%s','trunk:%s','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','leave','removeSmsInteractions','OpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','Agents','User','name','agent','telephone','type','ivr','UserProfileSection','findOne','then','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','map','resourceId','where','role','Campaign','format','length','user:%s','handshake','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions'];(function(_0x59f7a7,_0xce39b2){var _0x15da0d=function(_0x1e0e64){while(--_0x1e0e64){_0x59f7a7['push'](_0x59f7a7['shift']());}};_0x15da0d(++_0xce39b2);}(_0xc575,0x9d));var _0x5c57=function(_0x261fc3,_0x93ec46){_0x261fc3=_0x261fc3-0x0;var _0x83da99=_0xc575[_0x261fc3];return _0x83da99;};'use strict';var _=require(_0x5c57('0x0'));var util=require(_0x5c57('0x1'));var BPromise=require(_0x5c57('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x5c57('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x5c57('0x4'),'model':db[_0x5c57('0x5')],'attributes':['id',_0x5c57('0x6'),'role'],'raw':!![],'where':{'role':_0x5c57('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x5c57('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x5c57('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x5c57('0x6')],'where':{'role':_0x5c57('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5c57('0x6'),_0x5c57('0x9')],'where':{'type':_0x5c57('0xa')}};function getAssociatedResources(_0x50223d,_0x462152,_0x2f57d3){return db[_0x5c57('0xb')][_0x5c57('0xc')]({'where':{'name':_0x50223d,'userProfileId':_0x462152},'raw':!![]})[_0x5c57('0xd')](function(_0x39d09a){if(_0x39d09a){if(_0x39d09a['autoAssociation']){switch(_0x50223d){case _0x5c57('0xe'):case'ChatQueues':case _0x5c57('0xf'):case _0x5c57('0x10'):case _0x5c57('0x11'):case _0x5c57('0x12'):case _0x5c57('0x13'):return db[_0x2f57d3][_0x5c57('0x14')](queryQueues);case _0x5c57('0x15'):return db[_0x2f57d3][_0x5c57('0x14')](queryTelephones);case _0x5c57('0x16'):return db[_0x2f57d3][_0x5c57('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x2f57d3][_0x5c57('0x14')](queryCampaigns);}}else{return db[_0x5c57('0x17')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x39d09a['id']},'raw':!![]})['then'](function(_0x331a6a){if(_0x331a6a){var _0x36a3e1={'where':{'id':_[_0x5c57('0x18')](_0x331a6a,_0x5c57('0x19'))},'raw':!![]};switch(_0x2f57d3){case _0x5c57('0x5'):_0x36a3e1[_0x5c57('0x1a')][_0x5c57('0x1b')]='telephone';break;case _0x5c57('0x1c'):_0x36a3e1['where'][_0x5c57('0x9')]=_0x5c57('0xa');break;}return db[_0x2f57d3]['findAll'](_0x36a3e1);}else{return[];}});}}else{return[];}})[_0x5c57('0xd')](function(_0x35116e){return _0x35116e;});}function joinOrLeaveQueues(_0x1c52e7,_0x35ca68,_0x123d2f,_0x227ed3){_0x1c52e7[_0x35ca68](util[_0x5c57('0x1d')]('%s:queue:%s',_0x123d2f,_0x227ed3[_0x5c57('0x6')]));if(_0x227ed3[_0x5c57('0x4')]){for(var _0x50581b=0x0;_0x50581b<_0x227ed3[_0x5c57('0x4')][_0x5c57('0x1e')];_0x50581b+=0x1){_0x1c52e7[_0x35ca68](util[_0x5c57('0x1d')](_0x5c57('0x1f'),_0x227ed3[_0x5c57('0x4')][_0x50581b]['name']));}}}function joinOrLeave(_0x482c76,_0x2669f8,_0x466350){var _0x2ffdb7;if(_0x482c76[_0x5c57('0x20')]['query']['id']){db[_0x5c57('0x5')]['find']({'attributes':['id','name',_0x5c57('0x1b'),_0x5c57('0x21')],'where':{'id':_0x482c76[_0x5c57('0x20')][_0x5c57('0x22')]['id']},'include':[{'model':db[_0x5c57('0x23')],'as':_0x5c57('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x5c57('0x25')],'as':_0x5c57('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x5c57('0x27')],'as':_0x5c57('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x5c57('0x29')],'as':_0x5c57('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x5c57('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x5c57('0x2c')],'as':_0x5c57('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x5c57('0xd')](function(_0x1008fe){if(_0x1008fe){_0x2ffdb7=_0x1008fe;_0x482c76[_0x2669f8](util[_0x5c57('0x1d')](_0x5c57('0x1f'),_0x1008fe['name']));var _0x32f93f=[];switch(_0x1008fe[_0x5c57('0x1b')]){case _0x5c57('0x2e'):_0x482c76[_0x2669f8](_0x5c57('0x2f'));_0x482c76[_0x2669f8](_0x5c57('0x30'));if(queryQueues[_0x5c57('0x31')](_0x5c57('0x32'))){delete queryQueues[_0x5c57('0x32')];}_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x34')][_0x5c57('0x14')](queryQueues));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x35')][_0x5c57('0x14')](queryQueues));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x36')][_0x5c57('0x14')](queryQueues));_0x32f93f[_0x5c57('0x33')](db['SmsQueue'][_0x5c57('0x14')](queryQueues));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x37')][_0x5c57('0x14')](queryQueues));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x38')][_0x5c57('0x14')](queryQueues));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x39')][_0x5c57('0x14')](queryQueues));_0x32f93f['push'](db[_0x5c57('0x5')]['findAll'](queryTelephones));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x3a')]['findAll'](queryTrunks));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x1c')][_0x5c57('0x14')](queryCampaigns));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x5')][_0x5c57('0x14')](queryAgents));break;case _0x5c57('0x3b'):_0x482c76[_0x2669f8](_0x5c57('0x2f'));_0x482c76[_0x2669f8]('voice:outbound');_0x32f93f[_0x5c57('0x33')](getAssociatedResources(_0x5c57('0xe'),_0x1008fe[_0x5c57('0x21')],'VoiceQueue'));_0x32f93f['push'](getAssociatedResources(_0x5c57('0x3c'),_0x1008fe[_0x5c57('0x21')],'ChatQueue'));_0x32f93f['push'](getAssociatedResources(_0x5c57('0xf'),_0x1008fe[_0x5c57('0x21')],'FaxQueue'));_0x32f93f['push'](getAssociatedResources(_0x5c57('0x10'),_0x1008fe[_0x5c57('0x21')],'SmsQueue'));_0x32f93f['push'](getAssociatedResources(_0x5c57('0x11'),_0x1008fe[_0x5c57('0x21')],_0x5c57('0x37')));_0x32f93f[_0x5c57('0x33')](getAssociatedResources(_0x5c57('0x12'),_0x1008fe['userProfileId'],_0x5c57('0x38')));_0x32f93f[_0x5c57('0x33')](getAssociatedResources(_0x5c57('0x13'),_0x1008fe[_0x5c57('0x21')],_0x5c57('0x39')));_0x32f93f['push'](getAssociatedResources(_0x5c57('0x15'),_0x1008fe[_0x5c57('0x21')],_0x5c57('0x5')));_0x32f93f['push'](getAssociatedResources(_0x5c57('0x16'),_0x1008fe[_0x5c57('0x21')],_0x5c57('0x3a')));_0x32f93f[_0x5c57('0x33')](getAssociatedResources(_0x5c57('0x3d'),_0x1008fe[_0x5c57('0x21')],_0x5c57('0x1c')));_0x32f93f[_0x5c57('0x33')](db['User'][_0x5c57('0x14')](queryAgents));break;case _0x5c57('0x7'):_0x482c76[_0x2669f8]('voice:inbound');_0x482c76[_0x2669f8](_0x5c57('0x30'));_0x32f93f['push'](_0x1008fe[_0x5c57('0x3e')]({'attributes':['id',_0x5c57('0x6')]}));_0x32f93f['push'](_0x1008fe['getChatQueues']({'attributes':['id','name']}));_0x32f93f[_0x5c57('0x33')](_0x1008fe['getFaxQueues']({'attributes':['id',_0x5c57('0x6')]}));_0x32f93f['push'](_0x1008fe[_0x5c57('0x3f')]({'attributes':['id','name']}));_0x32f93f['push'](_0x1008fe[_0x5c57('0x40')]({'attributes':['id',_0x5c57('0x6')]}));_0x32f93f[_0x5c57('0x33')](_0x1008fe[_0x5c57('0x41')]({'attributes':['id',_0x5c57('0x6')]}));_0x32f93f[_0x5c57('0x33')](_0x1008fe[_0x5c57('0x42')]({'attributes':['id',_0x5c57('0x6')]}));break;}return BPromise[_0x5c57('0x43')](_0x32f93f);}})[_0x5c57('0xd')](function(_0x3a9710){if(_0x3a9710&&_0x3a9710[_0x5c57('0x1e')]){for(var _0x33fab9=0x0;_0x33fab9<_0x3a9710[_0x5c57('0x1e')];_0x33fab9+=0x1){for(var _0x36b770=0x0;_0x36b770<_0x3a9710[_0x33fab9][_0x5c57('0x1e')];_0x36b770+=0x1){switch(_0x33fab9){case 0x0:joinOrLeaveQueues(_0x482c76,_0x2669f8,_0x5c57('0x44'),_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x1:joinOrLeaveQueues(_0x482c76,_0x2669f8,_0x5c57('0x45'),_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x2:joinOrLeaveQueues(_0x482c76,_0x2669f8,_0x5c57('0x46'),_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x3:joinOrLeaveQueues(_0x482c76,_0x2669f8,'sms',_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x4:joinOrLeaveQueues(_0x482c76,_0x2669f8,_0x5c57('0x47'),_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x5:joinOrLeaveQueues(_0x482c76,_0x2669f8,_0x5c57('0x48'),_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x6:joinOrLeaveQueues(_0x482c76,_0x2669f8,'whatsapp',_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x7:_0x482c76[_0x2669f8](util['format'](_0x5c57('0x49'),_0x3a9710[_0x33fab9][_0x36b770]['name']));break;case 0x8:_0x482c76[_0x2669f8](util[_0x5c57('0x1d')](_0x5c57('0x4a'),_0x3a9710[_0x33fab9][_0x36b770][_0x5c57('0x6')]));break;case 0x9:_0x482c76[_0x2669f8](util[_0x5c57('0x1d')]('campaign:%s:%s',_0x3a9710[_0x33fab9][_0x36b770][_0x5c57('0x9')],_0x3a9710[_0x33fab9][_0x36b770][_0x5c57('0x6')]));break;case 0xa:_0x482c76[_0x2669f8](util['format'](_0x5c57('0x1f'),_0x3a9710[_0x33fab9][_0x36b770][_0x5c57('0x6')]));break;}}}}})[_0x5c57('0xd')](function(){if(_0x2669f8==='leave'){var _0x3a83ce=_[_0x5c57('0x18')](_0x2ffdb7['ChatInteractions'],'id');return _0x2ffdb7[_0x5c57('0x4b')](_0x3a83ce)[_0x5c57('0xd')](function(){for(var _0x14f39d=0x0;_0x14f39d<_0x3a83ce['length'];_0x14f39d+=0x1){_0x466350[_0x5c57('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x3a83ce[_0x14f39d]),'UserId':Number(_0x2ffdb7['id'])});}});}})['then'](function(){if(_0x2669f8==='leave'){var _0x23641d=_[_0x5c57('0x18')](_0x2ffdb7[_0x5c57('0x26')],'id');return _0x2ffdb7[_0x5c57('0x4d')](_0x23641d)[_0x5c57('0xd')](function(){for(var _0x5cfe34=0x0;_0x5cfe34<_0x23641d[_0x5c57('0x1e')];_0x5cfe34+=0x1){_0x466350[_0x5c57('0x4c')](_0x5c57('0x4e'),{'MailInteractionId':Number(_0x23641d[_0x5cfe34]),'UserId':Number(_0x2ffdb7['id'])});}});}})['then'](function(){if(_0x2669f8==='leave'){var _0x5a3cd6=_['map'](_0x2ffdb7[_0x5c57('0x28')],'id');return _0x2ffdb7['removeFaxInteractions'](_0x5a3cd6)[_0x5c57('0xd')](function(){for(var _0x59da69=0x0;_0x59da69<_0x5a3cd6[_0x5c57('0x1e')];_0x59da69+=0x1){_0x466350[_0x5c57('0x4c')](_0x5c57('0x4f'),{'FaxInteractionId':Number(_0x5a3cd6[_0x59da69]),'UserId':Number(_0x2ffdb7['id'])});}});}})[_0x5c57('0xd')](function(){if(_0x2669f8===_0x5c57('0x50')){var _0x11cf36=_[_0x5c57('0x18')](_0x2ffdb7['SmsInteractions'],'id');return _0x2ffdb7[_0x5c57('0x51')](_0x11cf36)[_0x5c57('0xd')](function(){for(var _0x2832e8=0x0;_0x2832e8<_0x11cf36[_0x5c57('0x1e')];_0x2832e8+=0x1){_0x466350[_0x5c57('0x4c')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x11cf36[_0x2832e8]),'UserId':Number(_0x2ffdb7['id'])});}});}})['then'](function(){if(_0x2669f8===_0x5c57('0x50')){var _0x4605a4=_['map'](_0x2ffdb7[_0x5c57('0x52')],'id');return _0x2ffdb7['removeOpenchannelInteractions'](_0x4605a4)[_0x5c57('0xd')](function(){for(var _0x2a9e35=0x0;_0x2a9e35<_0x4605a4[_0x5c57('0x1e')];_0x2a9e35+=0x1){_0x466350[_0x5c57('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x4605a4[_0x2a9e35]),'UserId':Number(_0x2ffdb7['id'])});}});}})['then'](function(){if(_0x2669f8==='leave'){var _0xb4dabd=_[_0x5c57('0x18')](_0x2ffdb7[_0x5c57('0x2d')],'id');return _0x2ffdb7[_0x5c57('0x53')](_0xb4dabd)['then'](function(){for(var _0xb86f5f=0x0;_0xb86f5f<_0xb4dabd[_0x5c57('0x1e')];_0xb86f5f+=0x1){_0x466350[_0x5c57('0x4c')](_0x5c57('0x54'),{'WhatsappInteractionId':Number(_0xb4dabd[_0xb86f5f]),'UserId':Number(_0x2ffdb7['id'])});}});}})[_0x5c57('0x55')](function(_0xb6afad){_0x482c76[_0x5c57('0x56')](_0xb6afad);});}}function onDisconnect(_0x329935,_0x4ee42e){joinOrLeave(_0x329935,_0x5c57('0x50'),_0x4ee42e);}function onConnect(_0x24b8e6){joinOrLeave(_0x24b8e6,_0x5c57('0x57'));}exports[_0x5c57('0x58')]=function(_0x2134e3){_0x2134e3['on'](_0x5c57('0x59'),function(_0x598b9c){_0x598b9c[_0x5c57('0x5a')](0x0);_0x598b9c[_0x5c57('0x5b')]=_0x598b9c[_0x5c57('0x5c')][_0x5c57('0x59')]['remoteAddress']+':'+_0x598b9c[_0x5c57('0x5c')][_0x5c57('0x59')][_0x5c57('0x5d')];_0x598b9c[_0x5c57('0x5e')]=new Date();_0x598b9c[_0x5c57('0x56')]=function(_0x4ba426){console['log'](_0x5c57('0x5f')+_0x598b9c[_0x5c57('0x60')][_0x5c57('0x6')]+'['+_0x598b9c[_0x5c57('0x5b')]+']',_0x4ba426);};_0x598b9c['on'](_0x5c57('0x61'),function(){onDisconnect(_0x598b9c,_0x2134e3);_0x598b9c[_0x5c57('0x56')](_0x5c57('0x62'));});onConnect(_0x598b9c);_0x598b9c[_0x5c57('0x56')](_0x5c57('0x63'));});}; \ No newline at end of file +var _0x7ce9=['IvrCampaigns','getVoiceQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','setMaxListeners','address','remoteAddress','request','connection','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','./environment','name','Agents','User','telephone','agent','ivr','findOne','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','then','resourceId','where','role','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','FaxQueue','WhatsappQueue','user','FaxQueues','SmsQueue','MailQueue','OpenchannelQueue','Trunk'];(function(_0x2a57dd,_0x11c435){var _0xc7f59a=function(_0x369954){while(--_0x369954){_0x2a57dd['push'](_0x2a57dd['shift']());}};_0xc7f59a(++_0x11c435);}(_0x7ce9,0xf0));var _0x97ce=function(_0x311374,_0x132c28){_0x311374=_0x311374-0x0;var _0x1bf041=_0x7ce9[_0x311374];return _0x1bf041;};'use strict';var _=require('lodash');var util=require(_0x97ce('0x0'));var BPromise=require(_0x97ce('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x97ce('0x2'));var queryQueues={'attributes':['id',_0x97ce('0x3')],'include':[{'as':_0x97ce('0x4'),'model':db[_0x97ce('0x5')],'attributes':['id',_0x97ce('0x3'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x97ce('0x3')],'where':{'role':_0x97ce('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x97ce('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x97ce('0x3')],'where':{'role':_0x97ce('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x97ce('0x3'),'type'],'where':{'type':_0x97ce('0x8')}};function getAssociatedResources(_0x5e9b08,_0x1ae559,_0x88f74e){return db['UserProfileSection'][_0x97ce('0x9')]({'where':{'name':_0x5e9b08,'userProfileId':_0x1ae559},'raw':!![]})['then'](function(_0x5b1dae){if(_0x5b1dae){if(_0x5b1dae[_0x97ce('0xa')]){switch(_0x5e9b08){case _0x97ce('0xb'):case _0x97ce('0xc'):case'FaxQueues':case _0x97ce('0xd'):case _0x97ce('0xe'):case _0x97ce('0xf'):case _0x97ce('0x10'):return db[_0x88f74e][_0x97ce('0x11')](queryQueues);case _0x97ce('0x12'):return db[_0x88f74e][_0x97ce('0x11')](queryTelephones);case _0x97ce('0x13'):return db[_0x88f74e][_0x97ce('0x11')](queryTrunks);case'IvrCampaigns':return db[_0x88f74e][_0x97ce('0x11')](queryCampaigns);}}else{return db[_0x97ce('0x14')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x5b1dae['id']},'raw':!![]})[_0x97ce('0x15')](function(_0x4cf409){if(_0x4cf409){var _0x559af1={'where':{'id':_['map'](_0x4cf409,_0x97ce('0x16'))},'raw':!![]};switch(_0x88f74e){case _0x97ce('0x5'):_0x559af1[_0x97ce('0x17')][_0x97ce('0x18')]='telephone';break;case _0x97ce('0x19'):_0x559af1[_0x97ce('0x17')]['type']=_0x97ce('0x8');break;}return db[_0x88f74e][_0x97ce('0x11')](_0x559af1);}else{return[];}});}}else{return[];}})[_0x97ce('0x15')](function(_0xb8a6e5){return _0xb8a6e5;});}function joinOrLeaveQueues(_0x3f0e78,_0x946b28,_0xa3c9e6,_0x3567fc){_0x3f0e78[_0x946b28](util[_0x97ce('0x1a')](_0x97ce('0x1b'),_0xa3c9e6,_0x3567fc[_0x97ce('0x3')]));if(_0x3567fc[_0x97ce('0x4')]){for(var _0x2e75fa=0x0;_0x2e75fa<_0x3567fc[_0x97ce('0x4')][_0x97ce('0x1c')];_0x2e75fa+=0x1){_0x3f0e78[_0x946b28](util[_0x97ce('0x1a')](_0x97ce('0x1d'),_0x3567fc[_0x97ce('0x4')][_0x2e75fa][_0x97ce('0x3')]));}}}function joinOrLeave(_0x4acef0,_0x441a8e,_0x65b0bf){var _0x3206f2;if(_0x4acef0[_0x97ce('0x1e')][_0x97ce('0x1f')]['id']){db['User'][_0x97ce('0x20')]({'attributes':['id','name',_0x97ce('0x18'),_0x97ce('0x21')],'where':{'id':_0x4acef0[_0x97ce('0x1e')][_0x97ce('0x1f')]['id']},'include':[{'model':db[_0x97ce('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x97ce('0x23')],'as':_0x97ce('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x97ce('0x25')],'as':_0x97ce('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x97ce('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x97ce('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x97ce('0x29')],'as':_0x97ce('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x97ce('0x15')](function(_0x539b3b){if(_0x539b3b){_0x3206f2=_0x539b3b;_0x4acef0[_0x441a8e](util[_0x97ce('0x1a')](_0x97ce('0x1d'),_0x539b3b['name']));var _0x343a66=[];switch(_0x539b3b[_0x97ce('0x18')]){case'admin':_0x4acef0[_0x441a8e](_0x97ce('0x2b'));_0x4acef0[_0x441a8e](_0x97ce('0x2c'));if(queryQueues['hasOwnProperty'](_0x97ce('0x2d'))){delete queryQueues['include'];}_0x343a66[_0x97ce('0x2e')](db[_0x97ce('0x2f')]['findAll'](queryQueues));_0x343a66[_0x97ce('0x2e')](db[_0x97ce('0x30')]['findAll'](queryQueues));_0x343a66['push'](db[_0x97ce('0x31')][_0x97ce('0x11')](queryQueues));_0x343a66[_0x97ce('0x2e')](db['SmsQueue'][_0x97ce('0x11')](queryQueues));_0x343a66['push'](db['MailQueue'][_0x97ce('0x11')](queryQueues));_0x343a66[_0x97ce('0x2e')](db['OpenchannelQueue']['findAll'](queryQueues));_0x343a66[_0x97ce('0x2e')](db[_0x97ce('0x32')][_0x97ce('0x11')](queryQueues));_0x343a66[_0x97ce('0x2e')](db['User'][_0x97ce('0x11')](queryTelephones));_0x343a66[_0x97ce('0x2e')](db['Trunk']['findAll'](queryTrunks));_0x343a66['push'](db[_0x97ce('0x19')]['findAll'](queryCampaigns));_0x343a66[_0x97ce('0x2e')](db[_0x97ce('0x5')][_0x97ce('0x11')](queryAgents));break;case _0x97ce('0x33'):_0x4acef0[_0x441a8e](_0x97ce('0x2b'));_0x4acef0[_0x441a8e](_0x97ce('0x2c'));_0x343a66[_0x97ce('0x2e')](getAssociatedResources(_0x97ce('0xb'),_0x539b3b['userProfileId'],'VoiceQueue'));_0x343a66[_0x97ce('0x2e')](getAssociatedResources(_0x97ce('0xc'),_0x539b3b[_0x97ce('0x21')],_0x97ce('0x30')));_0x343a66[_0x97ce('0x2e')](getAssociatedResources(_0x97ce('0x34'),_0x539b3b[_0x97ce('0x21')],'FaxQueue'));_0x343a66[_0x97ce('0x2e')](getAssociatedResources(_0x97ce('0xd'),_0x539b3b[_0x97ce('0x21')],_0x97ce('0x35')));_0x343a66[_0x97ce('0x2e')](getAssociatedResources(_0x97ce('0xe'),_0x539b3b[_0x97ce('0x21')],_0x97ce('0x36')));_0x343a66[_0x97ce('0x2e')](getAssociatedResources(_0x97ce('0xf'),_0x539b3b[_0x97ce('0x21')],_0x97ce('0x37')));_0x343a66[_0x97ce('0x2e')](getAssociatedResources(_0x97ce('0x10'),_0x539b3b[_0x97ce('0x21')],_0x97ce('0x32')));_0x343a66[_0x97ce('0x2e')](getAssociatedResources(_0x97ce('0x12'),_0x539b3b[_0x97ce('0x21')],_0x97ce('0x5')));_0x343a66['push'](getAssociatedResources(_0x97ce('0x13'),_0x539b3b['userProfileId'],_0x97ce('0x38')));_0x343a66[_0x97ce('0x2e')](getAssociatedResources(_0x97ce('0x39'),_0x539b3b[_0x97ce('0x21')],_0x97ce('0x19')));_0x343a66['push'](db['User']['findAll'](queryAgents));break;case _0x97ce('0x7'):_0x4acef0[_0x441a8e](_0x97ce('0x2b'));_0x4acef0[_0x441a8e](_0x97ce('0x2c'));_0x343a66[_0x97ce('0x2e')](_0x539b3b[_0x97ce('0x3a')]({'attributes':['id',_0x97ce('0x3')]}));_0x343a66['push'](_0x539b3b['getChatQueues']({'attributes':['id',_0x97ce('0x3')]}));_0x343a66[_0x97ce('0x2e')](_0x539b3b['getFaxQueues']({'attributes':['id','name']}));_0x343a66[_0x97ce('0x2e')](_0x539b3b['getSmsQueues']({'attributes':['id',_0x97ce('0x3')]}));_0x343a66[_0x97ce('0x2e')](_0x539b3b[_0x97ce('0x3b')]({'attributes':['id',_0x97ce('0x3')]}));_0x343a66[_0x97ce('0x2e')](_0x539b3b[_0x97ce('0x3c')]({'attributes':['id',_0x97ce('0x3')]}));_0x343a66[_0x97ce('0x2e')](_0x539b3b[_0x97ce('0x3d')]({'attributes':['id',_0x97ce('0x3')]}));break;}return BPromise[_0x97ce('0x3e')](_0x343a66);}})[_0x97ce('0x15')](function(_0x15691){if(_0x15691&&_0x15691[_0x97ce('0x1c')]){for(var _0x28c36c=0x0;_0x28c36c<_0x15691[_0x97ce('0x1c')];_0x28c36c+=0x1){for(var _0x472de3=0x0;_0x472de3<_0x15691[_0x28c36c][_0x97ce('0x1c')];_0x472de3+=0x1){switch(_0x28c36c){case 0x0:joinOrLeaveQueues(_0x4acef0,_0x441a8e,'voice',_0x15691[_0x28c36c][_0x472de3]);break;case 0x1:joinOrLeaveQueues(_0x4acef0,_0x441a8e,_0x97ce('0x3f'),_0x15691[_0x28c36c][_0x472de3]);break;case 0x2:joinOrLeaveQueues(_0x4acef0,_0x441a8e,_0x97ce('0x40'),_0x15691[_0x28c36c][_0x472de3]);break;case 0x3:joinOrLeaveQueues(_0x4acef0,_0x441a8e,_0x97ce('0x41'),_0x15691[_0x28c36c][_0x472de3]);break;case 0x4:joinOrLeaveQueues(_0x4acef0,_0x441a8e,_0x97ce('0x42'),_0x15691[_0x28c36c][_0x472de3]);break;case 0x5:joinOrLeaveQueues(_0x4acef0,_0x441a8e,_0x97ce('0x43'),_0x15691[_0x28c36c][_0x472de3]);break;case 0x6:joinOrLeaveQueues(_0x4acef0,_0x441a8e,_0x97ce('0x44'),_0x15691[_0x28c36c][_0x472de3]);break;case 0x7:_0x4acef0[_0x441a8e](util['format'](_0x97ce('0x45'),_0x15691[_0x28c36c][_0x472de3][_0x97ce('0x3')]));break;case 0x8:_0x4acef0[_0x441a8e](util['format']('trunk:%s',_0x15691[_0x28c36c][_0x472de3]['name']));break;case 0x9:_0x4acef0[_0x441a8e](util['format'](_0x97ce('0x46'),_0x15691[_0x28c36c][_0x472de3]['type'],_0x15691[_0x28c36c][_0x472de3][_0x97ce('0x3')]));break;case 0xa:_0x4acef0[_0x441a8e](util[_0x97ce('0x1a')](_0x97ce('0x1d'),_0x15691[_0x28c36c][_0x472de3][_0x97ce('0x3')]));break;}}}}})['then'](function(){if(_0x441a8e===_0x97ce('0x47')){var _0x2272d3=_[_0x97ce('0x48')](_0x3206f2['ChatInteractions'],'id');return _0x3206f2[_0x97ce('0x49')](_0x2272d3)[_0x97ce('0x15')](function(){for(var _0x287b8c=0x0;_0x287b8c<_0x2272d3['length'];_0x287b8c+=0x1){_0x65b0bf[_0x97ce('0x4a')](_0x97ce('0x4b'),{'ChatInteractionId':Number(_0x2272d3[_0x287b8c]),'UserId':Number(_0x3206f2['id'])});}});}})[_0x97ce('0x15')](function(){if(_0x441a8e==='leave'){var _0x3d80a7=_[_0x97ce('0x48')](_0x3206f2[_0x97ce('0x24')],'id');return _0x3206f2['removeMailInteractions'](_0x3d80a7)[_0x97ce('0x15')](function(){for(var _0x46f26b=0x0;_0x46f26b<_0x3d80a7[_0x97ce('0x1c')];_0x46f26b+=0x1){_0x65b0bf[_0x97ce('0x4a')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x3d80a7[_0x46f26b]),'UserId':Number(_0x3206f2['id'])});}});}})[_0x97ce('0x15')](function(){if(_0x441a8e==='leave'){var _0x31a203=_[_0x97ce('0x48')](_0x3206f2[_0x97ce('0x26')],'id');return _0x3206f2['removeFaxInteractions'](_0x31a203)[_0x97ce('0x15')](function(){for(var _0x4605f9=0x0;_0x4605f9<_0x31a203[_0x97ce('0x1c')];_0x4605f9+=0x1){_0x65b0bf['emit'](_0x97ce('0x4c'),{'FaxInteractionId':Number(_0x31a203[_0x4605f9]),'UserId':Number(_0x3206f2['id'])});}});}})[_0x97ce('0x15')](function(){if(_0x441a8e===_0x97ce('0x47')){var _0x84379c=_[_0x97ce('0x48')](_0x3206f2['SmsInteractions'],'id');return _0x3206f2[_0x97ce('0x4d')](_0x84379c)[_0x97ce('0x15')](function(){for(var _0x222f92=0x0;_0x222f92<_0x84379c[_0x97ce('0x1c')];_0x222f92+=0x1){_0x65b0bf[_0x97ce('0x4a')](_0x97ce('0x4e'),{'SmsInteractionId':Number(_0x84379c[_0x222f92]),'UserId':Number(_0x3206f2['id'])});}});}})[_0x97ce('0x15')](function(){if(_0x441a8e==='leave'){var _0x2b631c=_[_0x97ce('0x48')](_0x3206f2[_0x97ce('0x4f')],'id');return _0x3206f2[_0x97ce('0x50')](_0x2b631c)[_0x97ce('0x15')](function(){for(var _0x47168b=0x0;_0x47168b<_0x2b631c['length'];_0x47168b+=0x1){_0x65b0bf[_0x97ce('0x4a')](_0x97ce('0x51'),{'OpenchannelInteractionId':Number(_0x2b631c[_0x47168b]),'UserId':Number(_0x3206f2['id'])});}});}})[_0x97ce('0x15')](function(){if(_0x441a8e===_0x97ce('0x47')){var _0x1224e8=_[_0x97ce('0x48')](_0x3206f2['WhatsappInteractions'],'id');return _0x3206f2[_0x97ce('0x52')](_0x1224e8)[_0x97ce('0x15')](function(){for(var _0xeb8b99=0x0;_0xeb8b99<_0x1224e8[_0x97ce('0x1c')];_0xeb8b99+=0x1){_0x65b0bf[_0x97ce('0x4a')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x1224e8[_0xeb8b99]),'UserId':Number(_0x3206f2['id'])});}});}})[_0x97ce('0x53')](function(_0xcbed90){_0x4acef0[_0x97ce('0x54')](_0xcbed90);});}}function onDisconnect(_0x3192d6,_0x501531){joinOrLeave(_0x3192d6,_0x97ce('0x47'),_0x501531);}function onConnect(_0x4bcaf2){joinOrLeave(_0x4bcaf2,_0x97ce('0x55'));}exports[_0x97ce('0x56')]=function(_0x4a81b2){_0x4a81b2['on']('connection',function(_0x9562b0){_0x9562b0[_0x97ce('0x57')](0x0);_0x9562b0[_0x97ce('0x58')]=_0x9562b0['request']['connection'][_0x97ce('0x59')]+':'+_0x9562b0[_0x97ce('0x5a')][_0x97ce('0x5b')][_0x97ce('0x5c')];_0x9562b0[_0x97ce('0x5d')]=new Date();_0x9562b0[_0x97ce('0x54')]=function(_0x188a5f){console[_0x97ce('0x54')](_0x97ce('0x5e')+_0x9562b0[_0x97ce('0x5f')][_0x97ce('0x3')]+'['+_0x9562b0[_0x97ce('0x58')]+']',_0x188a5f);};_0x9562b0['on'](_0x97ce('0x60'),function(){onDisconnect(_0x9562b0,_0x4a81b2);_0x9562b0[_0x97ce('0x54')](_0x97ce('0x61'));});onConnect(_0x9562b0);_0x9562b0[_0x97ce('0x54')](_0x97ce('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index c757a09..0e83e1a 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 _0x7aeb=['FaxInteraction','Fax','FaxMessage','MailInteraction','Mail','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info','Trigger,\x20%s','EventManager','error','code','catch','get','channel','event','direction','User','find','UserId','name','SIP/%s','incomingmessage','outgoingmessage','opened','changed','closed','format','default','model','callback','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x7aeb,0x13b));var _0xb7ae=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x7aeb[_0x35885a];return _0xe86249;};'use strict';var util=require(_0xb7ae('0x0'));var db=require(_0xb7ae('0x1'))['db'];var jayson=require(_0xb7ae('0x2'));var logger=require(_0xb7ae('0x3'))(_0xb7ae('0x4'));var client=jayson[_0xb7ae('0x5')][_0xb7ae('0x6')]({'port':0x232a});var triggers=[{'channel':_0xb7ae('0x7'),'model':_0xb7ae('0x8'),'event':'afterCreate','condition':_0xb7ae('0x9'),'callback':afterCreate},{'channel':'Chat','model':_0xb7ae('0x8'),'event':_0xb7ae('0xa'),'condition':_0xb7ae('0xb'),'callback':afterUpdate},{'channel':'Chat','model':_0xb7ae('0xc'),'event':_0xb7ae('0xd'),'condition':_0xb7ae('0xe'),'callback':afterCreateMessage},{'channel':_0xb7ae('0xf'),'model':_0xb7ae('0x10'),'event':'afterCreate','condition':_0xb7ae('0x9'),'callback':afterCreate},{'channel':_0xb7ae('0xf'),'model':_0xb7ae('0x10'),'event':'afterUpdate','condition':_0xb7ae('0xb'),'callback':afterUpdate},{'channel':_0xb7ae('0xf'),'model':_0xb7ae('0x11'),'event':_0xb7ae('0xd'),'condition':_0xb7ae('0xe'),'callback':afterCreateMessage},{'channel':_0xb7ae('0x12'),'model':_0xb7ae('0x13'),'event':_0xb7ae('0xd'),'condition':_0xb7ae('0x9'),'callback':afterCreate},{'channel':_0xb7ae('0x12'),'model':'WhatsappInteraction','event':_0xb7ae('0xa'),'condition':_0xb7ae('0xb'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0xb7ae('0x14'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0xb7ae('0x15'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xb7ae('0x16'),'model':_0xb7ae('0x15'),'event':'afterUpdate','condition':_0xb7ae('0xb'),'callback':afterUpdate},{'channel':_0xb7ae('0x16'),'model':_0xb7ae('0x17'),'event':_0xb7ae('0xd'),'condition':_0xb7ae('0xe'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xb7ae('0x18'),'event':_0xb7ae('0xd'),'condition':_0xb7ae('0x9'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':_0xb7ae('0xa'),'condition':_0xb7ae('0xb'),'callback':afterUpdate},{'channel':_0xb7ae('0x19'),'model':'MailMessage','event':_0xb7ae('0xd'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xb7ae('0x1a'),'model':_0xb7ae('0x1b'),'event':_0xb7ae('0xd'),'condition':_0xb7ae('0x9'),'callback':afterCreate},{'channel':'Openchannel','model':_0xb7ae('0x1b'),'event':'afterUpdate','condition':_0xb7ae('0xb'),'callback':afterUpdate},{'channel':_0xb7ae('0x1a'),'model':_0xb7ae('0x1c'),'event':_0xb7ae('0xd'),'condition':_0xb7ae('0xe'),'callback':afterCreateMessage}];function request(_0x193566){return client[_0xb7ae('0x1d')]('EventManager',_0x193566)[_0xb7ae('0x1e')](function(_0x59d366){logger[_0xb7ae('0x1f')](_0xb7ae('0x20'),_0xb7ae('0x21'),_0x59d366);if(_0x59d366[_0xb7ae('0x22')]){if(_0x59d366[_0xb7ae('0x22')][_0xb7ae('0x23')]===0x1f4){logger[_0xb7ae('0x22')]('Trigger,\x20%s',_0xb7ae('0x21'),_0x59d366[_0xb7ae('0x22')]);}}})[_0xb7ae('0x24')](function(_0x4ce22a){logger['error']('Trigger,\x20%s',_0xb7ae('0x21'),_0x4ce22a);});}function afterCreateMessage(_0x240c68,_0x391372){return function(_0x3ddf5c,_0x5da887){_0x3ddf5c=_0x3ddf5c[_0xb7ae('0x25')]({'plain':!![]});_0x3ddf5c[_0xb7ae('0x26')]=_0x240c68;_0x3ddf5c[_0xb7ae('0x27')]=_0x3ddf5c[_0xb7ae('0x28')];if(_0x3ddf5c['UserId']){return db[_0xb7ae('0x29')][_0xb7ae('0x2a')]({'where':{'id':_0x3ddf5c[_0xb7ae('0x2b')]},'attributes':['id',_0xb7ae('0x2c')],'raw':!![]})[_0xb7ae('0x1e')](function(_0x116e43){_0x3ddf5c['interface']=util['format'](_0xb7ae('0x2d'),_0x116e43[_0xb7ae('0x2c')]);_0x3ddf5c['channel']=_0x240c68;return request({'event':_0xb7ae('0x2e'),'message':_0x3ddf5c});})[_0xb7ae('0x24')](function(_0x2c1cf9){console[_0xb7ae('0x22')](_0x2c1cf9);});}else{return request({'event':_0xb7ae('0x2f'),'message':_0x3ddf5c});}};}function afterCreate(_0x5795a6,_0x162c32){return function(_0x29269f,_0x369df4){_0x29269f=_0x29269f[_0xb7ae('0x25')]({'plain':!![]});_0x29269f[_0xb7ae('0x26')]=_0x5795a6;_0x29269f[_0xb7ae('0x27')]=_0xb7ae('0x30');return request({'event':_0x162c32,'message':_0x29269f});};}function afterUpdate(_0x464fb8,_0x4ced44){return function(_0x5b56e7,_0x2f61dd){if(_0x5b56e7[_0xb7ae('0x31')]('closed')&&_0x5b56e7[_0xb7ae('0x32')]){_0x5b56e7=_0x5b56e7['get']({'plain':!![]});_0x5b56e7[_0xb7ae('0x26')]=_0x464fb8;_0x5b56e7[_0xb7ae('0x27')]=_0xb7ae('0x32');if(_0x5b56e7[_0xb7ae('0x2b')]){return db[_0xb7ae('0x29')][_0xb7ae('0x2a')]({'where':{'id':_0x5b56e7[_0xb7ae('0x2b')]},'attributes':['id',_0xb7ae('0x2c')],'raw':!![]})[_0xb7ae('0x1e')](function(_0x36aa3f){_0x5b56e7['interface']=util[_0xb7ae('0x33')]('SIP/%s',_0x36aa3f[_0xb7ae('0x2c')]);return request({'event':_0x4ced44,'message':_0x5b56e7});})[_0xb7ae('0x24')](function(_0x4a904c){console[_0xb7ae('0x22')](_0x4a904c);});}else{return request({'event':_0x4ced44,'message':_0x5b56e7});}}};}exports[_0xb7ae('0x34')]=function(){for(var _0x54a435=0x0;_0x54a435=_0x52e8dc['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x54dea7(_0x305617);})[_0xcf7e('0x17')](function(_0x247931){_0xb5c913(_0x247931);});});}; \ No newline at end of file +var _0x2a94=['../mysqldb','./license/util','voice','chat','sms','whatsapp','getChannels','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird'];(function(_0x592300,_0x16f7c6){var _0x148290=function(_0x30be2a){while(--_0x30be2a){_0x592300['push'](_0x592300['shift']());}};_0x148290(++_0x16f7c6);}(_0x2a94,0x98));var _0x42a9=function(_0x3cc701,_0x52ee77){_0x3cc701=_0x3cc701-0x0;var _0x365136=_0x2a94[_0x3cc701];return _0x365136;};'use strict';var _=require(_0x42a9('0x0'));var BPromise=require(_0x42a9('0x1'));var db=require(_0x42a9('0x2'))['db'];var util=require(_0x42a9('0x3'));var channels=[_0x42a9('0x4'),'mail',_0x42a9('0x5'),'fax',_0x42a9('0x6'),_0x42a9('0x7'),'openchannel'];exports[_0x42a9('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x32a832){_0x32a832=_0x32a832[_0x42a9('0x9')]();return _[_0x42a9('0xa')](channels,_0x32a832);};exports['clearBlockUser']=function(_0x4d8c60,_0xbad7eb,_0x1d9b6a,_0x8f7cca){var _0x2efb55={'loginAttempts':_0xbad7eb,'blocked':_0x1d9b6a};if(!_[_0x42a9('0xb')](_0x8f7cca)){_0x2efb55[_0x42a9('0xc')]=_0x8f7cca;}return _0x4d8c60[_0x42a9('0xd')](_0x2efb55);};exports[_0x42a9('0xe')]=function(_0x5d535a){return new BPromise(function(_0x365cb6,_0x368ea6){var _0x5aae7a=0x0;if(_0x5d535a[_0x42a9('0xf')]!==_0x42a9('0x10')){_0x365cb6(_0x5d535a);}db['User'][_0x42a9('0x11')]({'where':{'role':_0x42a9('0x10'),'online':!![],'id':{'$ne':_0x5d535a['id']}}})[_0x42a9('0x12')](function(_0x521be0){_0x5aae7a=_0x521be0;return util[_0x42a9('0xe')]();})[_0x42a9('0x12')](function(_0xc2464a){if(_0xc2464a&&_0xc2464a[_0x42a9('0x13')]&&_0x5aae7a>=_0xc2464a[_0x42a9('0x13')]){throw Error(_0x42a9('0x14'));}_0x365cb6(_0x5d535a);})[_0x42a9('0x15')](function(_0x4e65f7){_0x368ea6(_0x4e65f7);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index c2a8603..75025d0 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x324d=['exports','404','status','render','send'];(function(_0x34ef2a,_0x41a2f8){var _0x2213f1=function(_0x898d38){while(--_0x898d38){_0x34ef2a['push'](_0x34ef2a['shift']());}};_0x2213f1(++_0x41a2f8);}(_0x324d,0x118));var _0xd324=function(_0xc2ea95,_0x99a101){_0xc2ea95=_0xc2ea95-0x0;var _0x3a1cb1=_0x324d[_0xc2ea95];return _0x3a1cb1;};'use strict';module[_0xd324('0x0')][0x194]=function pageNotFound(_0x8dc0d9,_0x20d7e0){var _0x59b215=_0xd324('0x1');var _0x193594=0x194;var _0x470574={'status':_0x193594};_0x20d7e0[_0xd324('0x2')](_0x470574[_0xd324('0x2')]);_0x20d7e0[_0xd324('0x3')](_0x59b215,{},function(_0x3e1133,_0x2196ec){if(_0x3e1133){return _0x20d7e0['status'](_0x470574[_0xd324('0x2')])['json'](_0x470574);}_0x20d7e0[_0xd324('0x4')](_0x2196ec);});}; \ No newline at end of file +var _0x7507=['send','404','render','status','json'];(function(_0x357adf,_0x309068){var _0xab259d=function(_0x549b77){while(--_0x549b77){_0x357adf['push'](_0x357adf['shift']());}};_0xab259d(++_0x309068);}(_0x7507,0x1e6));var _0x7750=function(_0x579e38,_0x5e3f43){_0x579e38=_0x579e38-0x0;var _0x37c3c9=_0x7507[_0x579e38];return _0x37c3c9;};'use strict';module['exports'][0x194]=function pageNotFound(_0xc04c97,_0x2e3281){var _0x4bec62=_0x7750('0x0');var _0x3fa3bb=0x194;var _0x502ee8={'status':_0x3fa3bb};_0x2e3281['status'](_0x502ee8['status']);_0x2e3281[_0x7750('0x1')](_0x4bec62,{},function(_0x3c7e8b,_0x4c0227){if(_0x3c7e8b){return _0x2e3281[_0x7750('0x2')](_0x502ee8[_0x7750('0x2')])[_0x7750('0x3')](_0x502ee8);}_0x2e3281[_0x7750('0x4')](_0x4c0227);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e2f0dfd..5a8076e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf094=['exports','path','sequelize','lodash','determine','xcall','xC@LL1234','127.0.0.1','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','mysql','username','database','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.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','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsQueue','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/schedule/schedule.model','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','../api/notification/notification.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteractions','Notification','Notifications','SenderId','belongsTo','ChatGroup','Groups','belongsToMany','Contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','UserVoiceQueue','MailQueues','ChatQueues','FaxQueues','UserFaxQueue','UserSmsQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','WhatsappAccount','WhatsappAccounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','VoiceQueueReport','QueueCalls','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','MailServerOut','Smtp','Answers','Interactions','MailApplication','List','ListId','Template','TemplateId','mandatoryDispositionPauseId','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','restrict','Items','FaxAccountId','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','FaxQueueReport','Dispositions','SmsAccountId','user_has_sms_accounts','SmsMessage','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ProactiveActions','ChatApplication','ChatMessage','OpenchannelQueueReport','Agent','ChatQueueId','Website','chat_interaction_has_tags','team_has_chat_queues','chat_group_has_users','CompanyId','JscriptySessions','Company','cm_user_has_contacts','cm_contact_has_tags','Queue','CampaignId','OwnerId','Automation','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','Schedule','DefaultReportId','Mohs','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','CustomReportId','SalesforceAccount','Configurations','AccountId','SubjectId','Descriptions','Field','Variable','Subjects','FieldId','Subject','Description','DescriptionId','VariableId','DeskConfiguration','ZohoAccount','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FromId','ToId','JscriptyAnswerReport','SessionId','ProjectId','user_has_square_projects','team_has_voice_queues','VoiceQueues','SmsQueues','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromChatWebsiteId','FromAccount','FromAgent','ToChatQueueId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToOpenchannelQueueId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSection','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteraction','user_has_whatsapp_accounts','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId'];(function(_0x43d2d3,_0x223055){var _0xed5830=function(_0x2e2cce){while(--_0x2e2cce){_0x43d2d3['push'](_0x43d2d3['shift']());}};_0xed5830(++_0x223055);}(_0xf094,0x1ee));var _0x4f09=function(_0x2e68db,_0x275d04){_0x2e68db=_0x2e68db-0x0;var _0x12df4c=_0xf094[_0x2e68db];return _0x12df4c;};'use strict';var path=require(_0x4f09('0x0'));var config=require('../config/environment');var Sequelize=require(_0x4f09('0x1'));var _=require(_0x4f09('0x2'));var jstz=require('jstz');var timezone=jstz[_0x4f09('0x3')]();config[_0x4f09('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':_0x4f09('0x4'),'password':_0x4f09('0x5'),'options':{'host':_0x4f09('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x4f09('0x7')](),'define':{'charset':_0x4f09('0x8'),'collate':_0x4f09('0x9')}}});config[_0x4f09('0xa')]=_[_0x4f09('0xb')](config[_0x4f09('0xa')],{'database':_0x4f09('0xc'),'username':_0x4f09('0x4'),'password':_0x4f09('0x5'),'options':{'host':_0x4f09('0x6'),'port':0xcea,'dialect':_0x4f09('0xd'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x4f09('0x7')](),'define':{'charset':_0x4f09('0x8'),'collate':_0x4f09('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x4f09('0x1')][_0x4f09('0xe')],config[_0x4f09('0x1')]['password'],config[_0x4f09('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4f09('0xa')][_0x4f09('0xf')],config['sequelizeHistory'][_0x4f09('0xe')],config['sequelizeHistory'][_0x4f09('0x10')],config['sequelizeHistory'][_0x4f09('0x11')])};db[_0x4f09('0x12')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x14'));db[_0x4f09('0x15')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x16'));db[_0x4f09('0x17')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x18'));db[_0x4f09('0x19')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x1a'));db[_0x4f09('0x1b')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x1c'));db[_0x4f09('0x1d')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x1e'));db[_0x4f09('0x1f')]=db['sequelize']['import'](_0x4f09('0x20'));db[_0x4f09('0x21')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/voiceMail/voiceMail.model');db[_0x4f09('0x22')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x23'));db['VoiceCallReport']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x24'));db[_0x4f09('0x25')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x26'));db['VoiceAgentReport']=db['sequelize'][_0x4f09('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x27'));db['Trunk']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x28'));db[_0x4f09('0x29')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x2a'));db[_0x4f09('0x2b')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x2c'));db['UserVoiceQueue']=db['sequelize'][_0x4f09('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x4f09('0x2d')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x2e'));db[_0x4f09('0x2f')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x30'));db['UserSmsQueue']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x31'));db['UserOpenchannelQueue']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x32'));db[_0x4f09('0x33')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x34'));db['MailServerIn']=db[_0x4f09('0x1')]['import']('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x35'));db[_0x4f09('0x36')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x37'));db[_0x4f09('0x38')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/mailQueue/mailQueue.model');db[_0x4f09('0x39')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x3a'));db[_0x4f09('0x3b')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x3c'));db[_0x4f09('0x3d')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x3e'));db['MailApplication']=db[_0x4f09('0x1')]['import'](_0x4f09('0x3f'));db[_0x4f09('0x40')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x41'));db[_0x4f09('0x42')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/dashboard/dashboard.model');db[_0x4f09('0x43')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x44'));db[_0x4f09('0x45')]=db['sequelize']['import']('../api/faxAccount/faxAccount.model');db[_0x4f09('0x46')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/faxApplication/faxApplication.model');db[_0x4f09('0x47')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x48'));db[_0x4f09('0x49')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/faxMessage/faxMessage.model');db[_0x4f09('0x4a')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x4b'));db[_0x4f09('0x4c')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x4d'));db[_0x4f09('0x4e')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x4f'));db['SmsInteraction']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x50'));db['SmsMessage']=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/smsMessage/smsMessage.model');db[_0x4f09('0x51')]=db[_0x4f09('0x1')]['import']('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x4f09('0x52')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x53'));db[_0x4f09('0x54')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x55'));db['OpenchannelMessage']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x56'));db[_0x4f09('0x57')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x58'));db[_0x4f09('0x59')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0x4f09('0x1')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x4f09('0x1')]['import'](_0x4f09('0x5a'));db[_0x4f09('0x5b')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x5c'));db['ChatMessage']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x5d'));db[_0x4f09('0x5e')]=db['sequelize'][_0x4f09('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x4f09('0x5f')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x60'));db['ChatGroup']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x61'));db[_0x4f09('0x62')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x63'));db[_0x4f09('0x64')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x65'));db[_0x4f09('0x66')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x67'));db[_0x4f09('0x68')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/cmHopper/cmHopper.model');db[_0x4f09('0x69')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x6a'));db[_0x4f09('0x6b')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x6c'));db[_0x4f09('0x6d')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x6e'));db[_0x4f09('0x6f')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x70'));db[_0x4f09('0x71')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x4f09('0x72')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x73'));db['Automation']=db[_0x4f09('0x1')]['import'](_0x4f09('0x74'));db[_0x4f09('0x75')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x76'));db[_0x4f09('0x77')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x78'));db[_0x4f09('0x79')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x7a'));db[_0x4f09('0x7b')]=db['sequelize']['import'](_0x4f09('0x7c'));db[_0x4f09('0x7d')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x7e'));db['Cdr']=db[_0x4f09('0x1')]['import'](_0x4f09('0x7f'));db[_0x4f09('0x80')]=db['sequelize'][_0x4f09('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x81'));db['Sound']=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/sound/sound.model');db[_0x4f09('0x82')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x83'));db['Template']=db['sequelize']['import'](_0x4f09('0x84'));db[_0x4f09('0x85')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/trigger/trigger.model');db['Variable']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x86'));db[_0x4f09('0x87')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x88'));db[_0x4f09('0x89')]=db['sequelize']['import'](_0x4f09('0x8a'));db[_0x4f09('0x8b')]=db['sequelize']['import'](_0x4f09('0x8c'));db[_0x4f09('0x8d')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x4f09('0x8e')]=db[_0x4f09('0x1')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x4f09('0x8f')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x4f09('0x90')]=db['sequelize'][_0x4f09('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x4f09('0x91')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x92'));db['SalesforceAccount']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x93'));db[_0x4f09('0x94')]=db['sequelize'][_0x4f09('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x4f09('0x95')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x96'));db[_0x4f09('0x97')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x98'));db[_0x4f09('0x99')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x9a'));db[_0x4f09('0x9b')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x9c'));db[_0x4f09('0x9d')]=db['sequelize']['import']('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x4f09('0x9e')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x9f'));db['ZohoAccount']=db[_0x4f09('0x1')]['import'](_0x4f09('0xa0'));db[_0x4f09('0xa1')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xa2'));db[_0x4f09('0xa3')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xa4'));db[_0x4f09('0xa5')]=db[_0x4f09('0x1')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xa6'));db['ZendeskField']=db[_0x4f09('0x1')]['import'](_0x4f09('0xa7'));db[_0x4f09('0xa8')]=db[_0x4f09('0x1')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x4f09('0xa9')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xaa'));db[_0x4f09('0xab')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xac'));db[_0x4f09('0xad')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xae'));db[_0x4f09('0xaf')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xb0'));db[_0x4f09('0xb1')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xb2'));db[_0x4f09('0xb3')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x4f09('0xb4')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x4f09('0xb5')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xb6'));db['Dynamics365Account']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xb7'));db[_0x4f09('0xb8')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xb9'));db[_0x4f09('0xba')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x4f09('0xbb')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xbc'));db[_0x4f09('0xbd')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xbe'));db[_0x4f09('0xbf')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xc0'));db['Integration']=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x88'));db['Network']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xc1'));db[_0x4f09('0xc2')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x4f09('0xc3')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xc4'));db['JscriptyAnswerReport']=db[_0x4f09('0x1')]['import'](_0x4f09('0xc5'));db[_0x4f09('0xc6')]=db['sequelize']['import'](_0x4f09('0xc7'));db[_0x4f09('0xc8')]=db['sequelize'][_0x4f09('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x4f09('0xc9')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xca'));db[_0x4f09('0xcb')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/squareReport/squareReport.model');db[_0x4f09('0xcc')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xcd'));db['JscriptyProject']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xce'));db[_0x4f09('0xcf')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xd0'));db[_0x4f09('0xd1')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xd2'));db[_0x4f09('0xd3')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xd4'));db[_0x4f09('0xd5')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/squareRecording/squareRecording.model');db[_0x4f09('0xd6')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xd7'));db[_0x4f09('0xd8')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/team/team.model');db[_0x4f09('0xd9')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/license/license.model');db[_0x4f09('0xda')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xdb'));db['Migration']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xdc'));db[_0x4f09('0xdd')]=db[_0x4f09('0x1')]['import']('../api/attachment/attachment.model');db[_0x4f09('0xde')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xdf'));db[_0x4f09('0xe0')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xe1'));db['FaxTransferReport']=db[_0x4f09('0x1')]['import'](_0x4f09('0xe2'));db[_0x4f09('0xe3')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xe4'));db[_0x4f09('0xe5')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xe6'));db[_0x4f09('0xe7')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xe8'));db[_0x4f09('0xe9')]=db['sequelize']['import'](_0x4f09('0xea'));db[_0x4f09('0xeb')]=db['sequelize'][_0x4f09('0x13')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xec'));db['UserProfileResource']=db['sequelize'][_0x4f09('0x13')]('../api/userProfileResource/userProfileResource.model');db['Notification']=db['sequelize']['import'](_0x4f09('0xed'));db[_0x4f09('0xee')]=db[_0x4f09('0x1')]['import']('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xef'));db[_0x4f09('0xf0')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xf1'));db['WhatsappInteraction']=db[_0x4f09('0x1')]['import'](_0x4f09('0xf2'));db[_0x4f09('0xf3')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xf4'));db[_0x4f09('0xf5')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xf6'));db[_0x4f09('0xf7')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xf8'));db[_0x4f09('0xf9')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xfa'));db[_0x4f09('0xfb')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xfc'));db[_0x4f09('0x12')][_0x4f09('0xfd')](db[_0x4f09('0xfe')],{'as':_0x4f09('0xfe'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db[_0x4f09('0x1f')],{'as':_0x4f09('0x102'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db[_0x4f09('0x2b')],{'as':'VoiceQueuesRt','foreignKey':_0x4f09('0x100')});db['User'][_0x4f09('0x101')](db[_0x4f09('0x19')],{'as':_0x4f09('0x103'),'onDelete':_0x4f09('0xff'),'hooks':!![]});db[_0x4f09('0x12')][_0x4f09('0x101')](db[_0x4f09('0x6b')],{'as':_0x4f09('0x104'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db['CmHopperHistory'],{'as':_0x4f09('0x105'),'foreignKey':_0x4f09('0x100')});db['User'][_0x4f09('0x101')](db[_0x4f09('0x6f')],{'as':_0x4f09('0x6f'),'foreignKey':_0x4f09('0x100')});db['User'][_0x4f09('0x101')](db[_0x4f09('0x54')],{'as':_0x4f09('0x106'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db[_0x4f09('0x5b')],{'as':_0x4f09('0x107'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db['SmsInteraction'],{'as':_0x4f09('0x108'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x4f09('0x12')]['hasMany'](db[_0x4f09('0x3b')],{'as':_0x4f09('0x109'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db['WhatsappInteraction'],{'as':_0x4f09('0x10a'),'foreignKey':_0x4f09('0x100')});db['User'][_0x4f09('0x101')](db[_0x4f09('0x10b')],{'as':_0x4f09('0x10c'),'foreignKey':_0x4f09('0x10d')});db[_0x4f09('0x12')][_0x4f09('0x101')](db[_0x4f09('0xee')],{'as':'UserNotifications','foreignKey':_0x4f09('0x10d')});db[_0x4f09('0x12')][_0x4f09('0x10e')](db['UserProfile'],{'as':_0x4f09('0xeb'),'foreignKey':'userProfileId'});db[_0x4f09('0x12')]['belongsToMany'](db[_0x4f09('0x10f')],{'as':_0x4f09('0x110'),'through':'chat_group_has_users'});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x66')],{'as':_0x4f09('0x112'),'through':'cm_user_has_contacts'});db['User'][_0x4f09('0x111')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x113'),'through':_0x4f09('0x114')});db['User']['belongsToMany'](db[_0x4f09('0xd8')],{'through':_0x4f09('0x115')});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x3b')],{'as':_0x4f09('0x109'),'through':_0x4f09('0x116')});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x5b')],{'as':_0x4f09('0x107'),'through':_0x4f09('0x117')});db[_0x4f09('0x12')][_0x4f09('0x111')](db['FaxInteraction'],{'as':_0x4f09('0x118'),'through':_0x4f09('0x119')});db[_0x4f09('0x12')]['belongsToMany'](db[_0x4f09('0x11a')],{'as':_0x4f09('0x108'),'through':_0x4f09('0x11b')});db[_0x4f09('0x12')]['belongsToMany'](db[_0x4f09('0x54')],{'as':_0x4f09('0x106'),'through':_0x4f09('0x11c')});db[_0x4f09('0x12')][_0x4f09('0x111')](db['WhatsappInteraction'],{'as':_0x4f09('0x10a'),'through':_0x4f09('0x11d')});db['User'][_0x4f09('0x111')](db[_0x4f09('0x1d')],{'as':'VoiceQueues','through':_0x4f09('0x11e'),'required':![]});db['User'][_0x4f09('0x111')](db[_0x4f09('0x38')],{'as':_0x4f09('0x11f'),'through':'UserMailQueue','required':![]});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x5f')],{'as':_0x4f09('0x120'),'through':_0x4f09('0x2d'),'required':![],'hooks':!![]});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x4a')],{'as':_0x4f09('0x121'),'through':_0x4f09('0x122'),'required':![]});db[_0x4f09('0x12')]['belongsToMany'](db[_0x4f09('0x51')],{'as':'SmsQueues','through':_0x4f09('0x123'),'required':![]});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x57')],{'as':_0x4f09('0x124'),'through':_0x4f09('0x125'),'required':![]});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0xf9')],{'as':_0x4f09('0x126'),'through':_0x4f09('0x33'),'required':![]});db[_0x4f09('0x12')][_0x4f09('0x111')](db['CmList'],{'through':'cm_user_has_lists'});db['User']['belongsToMany'](db[_0x4f09('0xe9')],{'as':_0x4f09('0x127'),'through':_0x4f09('0x128'),'required':![]});db[_0x4f09('0x12')][_0x4f09('0x111')](db['ChatWebsite'],{'as':_0x4f09('0x129'),'through':_0x4f09('0x12a')});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x45')],{'as':_0x4f09('0x12b'),'through':_0x4f09('0x12c')});db['User']['belongsToMany'](db[_0x4f09('0x36')],{'as':_0x4f09('0x12d'),'through':_0x4f09('0x12e')});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x12f')],{'as':'OpenchannelAccounts','through':_0x4f09('0x130')});db['User']['belongsToMany'](db[_0x4f09('0x4c')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0x4f09('0x12')]['belongsToMany'](db[_0x4f09('0x131')],{'as':_0x4f09('0x132'),'through':'user_has_whatsapp_accounts'});db[_0x4f09('0x12')]['belongsToMany'](db[_0x4f09('0xd3')],{'as':_0x4f09('0x133'),'through':'user_has_square_projects'});db[_0x4f09('0x15')][_0x4f09('0x101')](db['VoiceExtension'],{'as':_0x4f09('0x134'),'onDelete':'cascade','foreignKey':_0x4f09('0x135')});db[_0x4f09('0x17')][_0x4f09('0x101')](db[_0x4f09('0x19')],{'onDelete':'cascade'});db['VoiceExtension']['hasMany'](db[_0x4f09('0x19')],{'as':_0x4f09('0x136'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x1b')][_0x4f09('0x111')](db[_0x4f09('0x137')],{'as':_0x4f09('0x138'),'through':'moh_has_sounds'});db[_0x4f09('0x1d')][_0x4f09('0x101')](db['UserVoiceQueueRt'],{'as':_0x4f09('0x139'),'foreignKey':_0x4f09('0x13a')});db[_0x4f09('0x1d')][_0x4f09('0x101')](db[_0x4f09('0x68')],{'as':_0x4f09('0x13b'),'foreignKey':_0x4f09('0x13a')});db[_0x4f09('0x1d')][_0x4f09('0x101')](db[_0x4f09('0x6b')],{'as':_0x4f09('0x104'),'foreignKey':_0x4f09('0x13a')});db[_0x4f09('0x1d')][_0x4f09('0x101')](db[_0x4f09('0x6d')],{'as':_0x4f09('0x13c'),'foreignKey':_0x4f09('0x13a')});db[_0x4f09('0x1d')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x4f09('0x13a')});db['VoiceQueue'][_0x4f09('0x101')](db[_0x4f09('0x69')],{'as':_0x4f09('0x13d'),'foreignKey':_0x4f09('0x13a')});db[_0x4f09('0x1d')][_0x4f09('0x101')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0x4f09('0x1d')][_0x4f09('0x10e')](db['Trunk'],{'as':_0x4f09('0x13e'),'foreignKey':_0x4f09('0x13f')});db[_0x4f09('0x1d')]['belongsTo'](db[_0x4f09('0x13e')],{'as':_0x4f09('0x140'),'foreignKey':_0x4f09('0x141')});db[_0x4f09('0x1d')][_0x4f09('0x10e')](db[_0x4f09('0x7b')],{'as':_0x4f09('0x7b'),'foreignKey':_0x4f09('0x142')});db[_0x4f09('0x1d')][_0x4f09('0x10e')](db[_0x4f09('0x7d')],{'as':_0x4f09('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4f09('0x1d')]['belongsToMany'](db[_0x4f09('0xe7')],{'as':_0x4f09('0x113'),'through':_0x4f09('0x144')});db[_0x4f09('0x1d')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x11e')});db[_0x4f09('0x1d')]['belongsToMany'](db[_0x4f09('0xd8')],{'as':_0x4f09('0x146'),'through':'team_has_voice_queues'});db[_0x4f09('0x1d')][_0x4f09('0x111')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x147'),'through':_0x4f09('0x148')});db['VoiceRecording'][_0x4f09('0x10e')](db['User'],{'as':_0x4f09('0x12'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x21')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':_0x4f09('0x12'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0xfe')][_0x4f09('0x101')](db[_0x4f09('0x22')],{'as':_0x4f09('0x149'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x4f09('0x14a')});db['VoiceMailMessage'][_0x4f09('0x10e')](db['VoiceMail'],{'foreignKey':_0x4f09('0x14b'),'targetKey':'mailbox'});db[_0x4f09('0x14c')][_0x4f09('0x101')](db[_0x4f09('0x14d')],{'as':_0x4f09('0x14e'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x4f09('0x101')](db['VoiceAgentReport'],{'as':_0x4f09('0x14f'),'foreignKey':'uniqueid','constraints':![]});db[_0x4f09('0x14c')]['belongsTo'](db[_0x4f09('0x12')],{'as':_0x4f09('0x12'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x14c')][_0x4f09('0x10e')](db['CmContact'],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x152')][_0x4f09('0x10e')](db[_0x4f09('0x36')],{'as':'MailAccount','foreignKey':_0x4f09('0x153')});db['MailServerOut'][_0x4f09('0x10e')](db[_0x4f09('0x36')],{'as':_0x4f09('0x36'),'foreignKey':'MailAccountId'});db[_0x4f09('0x36')][_0x4f09('0xfd')](db[_0x4f09('0x152')],{'as':'Imap','onDelete':_0x4f09('0xff')});db[_0x4f09('0x36')]['hasOne'](db[_0x4f09('0x154')],{'as':_0x4f09('0x155'),'onDelete':_0x4f09('0xff')});db['MailAccount'][_0x4f09('0x101')](db[_0x4f09('0x77')],{'as':'Dispositions','foreignKey':_0x4f09('0x153')});db[_0x4f09('0x36')][_0x4f09('0x101')](db['CannedAnswer'],{'as':_0x4f09('0x156'),'foreignKey':_0x4f09('0x153')});db['MailAccount'][_0x4f09('0x101')](db[_0x4f09('0x3d')],{'as':_0x4f09('0x149'),'foreignKey':_0x4f09('0x153')});db[_0x4f09('0x36')][_0x4f09('0x101')](db[_0x4f09('0x3b')],{'as':_0x4f09('0x157')});db[_0x4f09('0x36')][_0x4f09('0x101')](db[_0x4f09('0x158')],{'as':_0x4f09('0x136')});db['MailAccount'][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0x36')][_0x4f09('0x10e')](db[_0x4f09('0x15b')],{'as':_0x4f09('0x15b'),'foreignKey':_0x4f09('0x15c')});db[_0x4f09('0x36')][_0x4f09('0x10e')](db[_0x4f09('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x4f09('0x15d')});db[_0x4f09('0x36')]['belongsToMany'](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x12e')});db[_0x4f09('0x38')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':'Agents','through':'UserMailQueue'});db[_0x4f09('0x38')][_0x4f09('0x111')](db[_0x4f09('0xd8')],{'through':'team_has_mail_queues','as':'Teams'});db[_0x4f09('0x3b')][_0x4f09('0x101')](db[_0x4f09('0x3d')],{'as':_0x4f09('0x149'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x15e')});db[_0x4f09('0x3b')][_0x4f09('0x10e')](db['MailAccount'],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x153')});db[_0x4f09('0x3b')][_0x4f09('0x10e')](db['CmContact'],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x3b')]['belongsTo'](db[_0x4f09('0x12')],{'as':_0x4f09('0x160'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x3b')][_0x4f09('0x111')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x4f09('0x161')});db[_0x4f09('0x3b')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x162'),'as':_0x4f09('0x163')});db[_0x4f09('0x3b')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x164'),'through':_0x4f09('0x116'),'foreignKey':'MailInteractionId'});db[_0x4f09('0x3d')][_0x4f09('0x101')](db[_0x4f09('0xdd')],{'as':_0x4f09('0x165'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x3d')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':_0x4f09('0x12')});db['MailMessage'][_0x4f09('0x10e')](db['CmContact'],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x150')});db[_0x4f09('0x3d')][_0x4f09('0x10e')](db[_0x4f09('0x3b')],{'as':_0x4f09('0x166'),'foreignKey':_0x4f09('0x15e')});db[_0x4f09('0x3d')][_0x4f09('0x10e')](db[_0x4f09('0x36')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x153')});db[_0x4f09('0x158')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0x158')][_0x4f09('0x10e')](db[_0x4f09('0x38')],{'onDelete':_0x4f09('0x167')});db['MailApplication']['belongsTo'](db[_0x4f09('0x36')],{'onDelete':_0x4f09('0x167')});db['MailApplication'][_0x4f09('0x10e')](db[_0x4f09('0x7b')],{'onDelete':_0x4f09('0x167'),'foreignKey':'IntervalId'});db['MailApplication'][_0x4f09('0x10e')](db['Tag'],{'onDelete':_0x4f09('0x167'),'foreignKey':'TagId'});db[_0x4f09('0x40')]['belongsTo'](db[_0x4f09('0x36')],{});db[_0x4f09('0x40')][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0x40')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db['MailQueueReport']['belongsTo'](db['MailInteraction'],{});db[_0x4f09('0x40')]['belongsTo'](db['MailMessage'],{});db[_0x4f09('0x40')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{});db[_0x4f09('0x40')]['belongsTo'](db['MailQueue'],{});db[_0x4f09('0x42')][_0x4f09('0x101')](db[_0x4f09('0x43')],{'as':_0x4f09('0x168'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x45')][_0x4f09('0x101')](db[_0x4f09('0x77')],{'as':'Dispositions','foreignKey':_0x4f09('0x169')});db[_0x4f09('0x45')][_0x4f09('0x101')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x4f09('0x169')});db[_0x4f09('0x45')]['hasMany'](db[_0x4f09('0x47')],{'as':'Interactions'});db[_0x4f09('0x45')]['hasMany'](db[_0x4f09('0x46')],{'as':'Applications'});db[_0x4f09('0x45')][_0x4f09('0x101')](db[_0x4f09('0x19')],{'as':_0x4f09('0x16a'),'onDelete':'cascade'});db[_0x4f09('0x45')][_0x4f09('0x101')](db[_0x4f09('0x49')],{'as':'Messages'});db['FaxAccount'][_0x4f09('0x10e')](db[_0x4f09('0x13e')],{'as':'Trunk'});db[_0x4f09('0x45')][_0x4f09('0x10e')](db['CmList'],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0x45')][_0x4f09('0x10e')](db['Pause'],{'as':_0x4f09('0x143'),'foreignKey':_0x4f09('0x15d')});db[_0x4f09('0x45')][_0x4f09('0x111')](db['User'],{'as':_0x4f09('0x145'),'through':'user_has_fax_accounts'});db['FaxApplication']['belongsTo'](db[_0x4f09('0x12')],{'onDelete':_0x4f09('0x167')});db['FaxApplication']['belongsTo'](db[_0x4f09('0x4a')],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0x46')][_0x4f09('0x10e')](db[_0x4f09('0x45')],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0x46')][_0x4f09('0x10e')](db[_0x4f09('0x82')],{'onDelete':_0x4f09('0x167'),'foreignKey':_0x4f09('0x16b')});db['FaxInteraction'][_0x4f09('0x101')](db[_0x4f09('0x49')],{'as':_0x4f09('0x149'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x16c')});db[_0x4f09('0x47')][_0x4f09('0x10e')](db['FaxAccount'],{'as':_0x4f09('0x15f'),'foreignKey':'FaxAccountId'});db[_0x4f09('0x47')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':'ContactId'});db[_0x4f09('0x47')]['belongsTo'](db[_0x4f09('0x12')],{'as':_0x4f09('0x160'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x47')]['belongsToMany'](db[_0x4f09('0x82')],{'through':_0x4f09('0x16d'),'as':_0x4f09('0x161')});db['FaxInteraction'][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db['FaxInteraction'][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x164'),'through':_0x4f09('0x119'),'foreignKey':_0x4f09('0x16c')});db['FaxMessage']['belongsTo'](db[_0x4f09('0x12')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x12')});db[_0x4f09('0x49')][_0x4f09('0x10e')](db['FaxInteraction'],{'as':_0x4f09('0x166'),'foreignKey':_0x4f09('0x16c')});db[_0x4f09('0x49')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'onDelete':_0x4f09('0xff'),'as':'Contact'});db[_0x4f09('0x49')][_0x4f09('0x10e')](db[_0x4f09('0xdd')],{'as':_0x4f09('0xdd'),'foreignKey':_0x4f09('0x16e')});db[_0x4f09('0x49')][_0x4f09('0x10e')](db[_0x4f09('0x45')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x169')});db['FaxQueue'][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x122')});db['FaxQueue'][_0x4f09('0x111')](db[_0x4f09('0xd8')],{'through':_0x4f09('0x16f'),'as':_0x4f09('0x146')});db[_0x4f09('0x170')]['belongsTo'](db[_0x4f09('0x45')],{});db[_0x4f09('0x170')]['belongsTo'](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0x170')]['belongsTo'](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x170')][_0x4f09('0x10e')](db[_0x4f09('0x47')],{});db[_0x4f09('0x170')]['belongsTo'](db['FaxMessage'],{});db[_0x4f09('0x170')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{});db[_0x4f09('0x170')][_0x4f09('0x10e')](db[_0x4f09('0x4a')],{});db['SmsAccount'][_0x4f09('0x101')](db['Disposition'],{'as':_0x4f09('0x171'),'foreignKey':_0x4f09('0x172')});db['SmsAccount']['hasMany'](db[_0x4f09('0x75')],{'as':_0x4f09('0x156'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x4f09('0x101')](db['SmsMessage'],{'as':'Messages','foreignKey':_0x4f09('0x172')});db[_0x4f09('0x4c')][_0x4f09('0x101')](db[_0x4f09('0x11a')],{'as':_0x4f09('0x157')});db['SmsAccount']['hasMany'](db[_0x4f09('0x4e')],{'as':_0x4f09('0x136')});db[_0x4f09('0x4c')][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0x4c')][_0x4f09('0x10e')](db['Pause'],{'as':_0x4f09('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4f09('0x4c')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x173')});db['SmsApplication'][_0x4f09('0x10e')](db['User'],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0x4e')][_0x4f09('0x10e')](db[_0x4f09('0x51')],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0x4e')][_0x4f09('0x10e')](db[_0x4f09('0x4c')],{'onDelete':'restrict'});db[_0x4f09('0x4e')][_0x4f09('0x10e')](db[_0x4f09('0x7b')],{'onDelete':'restrict','foreignKey':_0x4f09('0x142')});db[_0x4f09('0x4e')][_0x4f09('0x10e')](db[_0x4f09('0x82')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x4f09('0x11a')]['hasMany'](db[_0x4f09('0x174')],{'as':_0x4f09('0x149'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x4f09('0x11a')][_0x4f09('0x10e')](db[_0x4f09('0x4c')],{'as':_0x4f09('0x15f'),'foreignKey':'SmsAccountId'});db[_0x4f09('0x11a')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db['SmsInteraction'][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':_0x4f09('0x160'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x11a')]['belongsToMany'](db[_0x4f09('0x82')],{'through':'sms_interaction_has_tags','as':_0x4f09('0x161')});db[_0x4f09('0x11a')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x175'),'as':_0x4f09('0x163')});db[_0x4f09('0x11a')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x164'),'through':_0x4f09('0x11b'),'foreignKey':_0x4f09('0x176')});db['SmsMessage'][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':_0x4f09('0x12')});db[_0x4f09('0x174')][_0x4f09('0x10e')](db['CmContact'],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x150')});db[_0x4f09('0x174')][_0x4f09('0x10e')](db[_0x4f09('0x11a')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x166'),'foreignKey':_0x4f09('0x176')});db['SmsMessage'][_0x4f09('0x10e')](db[_0x4f09('0x4c')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x172')});db['SmsQueue'][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x123'),'foreignKey':_0x4f09('0x177')});db[_0x4f09('0x51')][_0x4f09('0x111')](db[_0x4f09('0xd8')],{'through':_0x4f09('0x178'),'as':_0x4f09('0x146')});db['OpenchannelAccount'][_0x4f09('0x101')](db['Disposition'],{'as':_0x4f09('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0x4f09('0x12f')][_0x4f09('0x101')](db[_0x4f09('0x75')],{'as':_0x4f09('0x156'),'foreignKey':_0x4f09('0x179')});db[_0x4f09('0x12f')][_0x4f09('0x101')](db[_0x4f09('0x54')],{'as':_0x4f09('0x157'),'foreignKey':_0x4f09('0x179')});db['OpenchannelAccount'][_0x4f09('0x101')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x4f09('0x179')});db[_0x4f09('0x12f')][_0x4f09('0x101')](db[_0x4f09('0x52')],{'as':_0x4f09('0x136'),'foreignKey':_0x4f09('0x179')});db[_0x4f09('0x12f')][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db['OpenchannelAccount'][_0x4f09('0x10e')](db[_0x4f09('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x4f09('0x15d')});db[_0x4f09('0x12f')][_0x4f09('0x111')](db['User'],{'as':'Agents','through':_0x4f09('0x130')});db['OpenchannelApplication'][_0x4f09('0x10e')](db['User'],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0x52')][_0x4f09('0x10e')](db['OpenchannelQueue'],{'onDelete':_0x4f09('0x167'),'foreignKey':_0x4f09('0x17a')});db[_0x4f09('0x52')][_0x4f09('0x10e')](db[_0x4f09('0x12f')],{'onDelete':_0x4f09('0x167'),'foreignKey':_0x4f09('0x179')});db[_0x4f09('0x52')][_0x4f09('0x10e')](db[_0x4f09('0x7b')],{'onDelete':_0x4f09('0x167'),'foreignKey':_0x4f09('0x142')});db[_0x4f09('0x52')][_0x4f09('0x10e')](db['Tag'],{'onDelete':_0x4f09('0x167'),'foreignKey':'TagId'});db[_0x4f09('0x54')][_0x4f09('0x101')](db[_0x4f09('0x17b')],{'as':_0x4f09('0x149'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x17c')});db[_0x4f09('0x54')][_0x4f09('0x10e')](db[_0x4f09('0x12f')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x179')});db[_0x4f09('0x54')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x54')]['belongsTo'](db[_0x4f09('0x12')],{'as':'Owner','foreignKey':_0x4f09('0x100')});db[_0x4f09('0x54')][_0x4f09('0x111')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x4f09('0x161')});db['OpenchannelInteraction'][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x17d'),'as':_0x4f09('0x163')});db['OpenchannelInteraction']['belongsToMany'](db[_0x4f09('0x12')],{'as':'Users','through':_0x4f09('0x11c'),'foreignKey':'OpenchannelInteractionId'});db[_0x4f09('0x17b')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x12')});db[_0x4f09('0x17b')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x150')});db[_0x4f09('0x17b')][_0x4f09('0x10e')](db['OpenchannelInteraction'],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x166'),'foreignKey':_0x4f09('0x17c')});db[_0x4f09('0x17b')][_0x4f09('0x10e')](db[_0x4f09('0xdd')],{'as':_0x4f09('0xdd'),'foreignKey':'AttachmentId'});db[_0x4f09('0x17b')]['belongsTo'](db[_0x4f09('0x12f')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x179')});db[_0x4f09('0x57')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0x4f09('0x57')][_0x4f09('0x111')](db[_0x4f09('0xd8')],{'through':'team_has_openchannel_queues','as':_0x4f09('0x146')});db[_0x4f09('0x59')]['hasMany'](db[_0x4f09('0x77')],{'as':_0x4f09('0x171'),'foreignKey':_0x4f09('0x17e')});db[_0x4f09('0x59')]['hasMany'](db['CannedAnswer'],{'as':_0x4f09('0x156'),'foreignKey':_0x4f09('0x17e')});db[_0x4f09('0x59')][_0x4f09('0x101')](db[_0x4f09('0x62')],{'as':_0x4f09('0x17f')});db[_0x4f09('0x59')][_0x4f09('0x101')](db['ChatInteraction'],{'as':'Interactions'});db[_0x4f09('0x59')][_0x4f09('0x101')](db[_0x4f09('0x180')],{'as':_0x4f09('0x136')});db[_0x4f09('0x59')][_0x4f09('0x101')](db[_0x4f09('0x181')],{'as':_0x4f09('0x149')});db[_0x4f09('0x59')][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':'ListId'});db[_0x4f09('0x59')][_0x4f09('0x10e')](db[_0x4f09('0x7b')],{'as':'Interval','foreignKey':_0x4f09('0x142')});db[_0x4f09('0x59')][_0x4f09('0x10e')](db[_0x4f09('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x4f09('0x59')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x12a')});db[_0x4f09('0x182')][_0x4f09('0x10e')](db[_0x4f09('0x12f')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x4f09('0xe7')],{'as':'List','foreignKey':_0x4f09('0x15a')});db['OpenchannelQueueReport'][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x182')][_0x4f09('0x10e')](db[_0x4f09('0x54')],{});db[_0x4f09('0x182')][_0x4f09('0x10e')](db[_0x4f09('0x17b')],{});db[_0x4f09('0x182')]['belongsTo'](db[_0x4f09('0x12')],{});db[_0x4f09('0x182')][_0x4f09('0x10e')](db[_0x4f09('0x57')],{});db['ChatApplication']['belongsTo'](db[_0x4f09('0x12')],{'as':_0x4f09('0x183'),'foreignKey':'UserId','onDelete':_0x4f09('0x167')});db[_0x4f09('0x180')][_0x4f09('0x10e')](db['ChatQueue'],{'as':'Queue','foreignKey':_0x4f09('0x184'),'onDelete':_0x4f09('0x167')});db['ChatApplication'][_0x4f09('0x10e')](db[_0x4f09('0x59')],{'as':_0x4f09('0x185'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x4f09('0x180')][_0x4f09('0x10e')](db['Tag'],{'onDelete':_0x4f09('0x167'),'foreignKey':'TagId'});db[_0x4f09('0x5b')][_0x4f09('0x101')](db[_0x4f09('0x181')],{'as':_0x4f09('0x149'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x4f09('0x5b')][_0x4f09('0x10e')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x4f09('0x5b')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x5b')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':_0x4f09('0x160'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x5b')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x186'),'as':'Tags'});db['ChatInteraction'][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x186'),'as':'ThroughTags'});db[_0x4f09('0x5b')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0x4f09('0x181')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x12')});db[_0x4f09('0x181')]['belongsTo'](db[_0x4f09('0x66')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x150'),'foreignKey':'ContactId'});db['ChatMessage'][_0x4f09('0x10e')](db[_0x4f09('0x5b')],{'onDelete':'cascade','as':_0x4f09('0x166'),'foreignKey':'ChatInteractionId'});db[_0x4f09('0x181')][_0x4f09('0x10e')](db[_0x4f09('0xdd')],{'as':_0x4f09('0xdd'),'foreignKey':'AttachmentId'});db['ChatMessage'][_0x4f09('0x10e')](db[_0x4f09('0x59')],{'as':_0x4f09('0x15f'),'foreignKey':'ChatWebsiteId'});db[_0x4f09('0x5e')]['belongsTo'](db[_0x4f09('0x66')],{'onDelete':'cascade','as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x5e')][_0x4f09('0x10e')](db[_0x4f09('0x59')],{'as':'Account','foreignKey':_0x4f09('0x17e')});db[_0x4f09('0x5f')][_0x4f09('0x111')](db['User'],{'as':_0x4f09('0x145'),'through':_0x4f09('0x2d'),'hooks':!![]});db['ChatQueue'][_0x4f09('0x111')](db[_0x4f09('0xd8')],{'through':_0x4f09('0x187'),'as':'Teams'});db['ChatGroup'][_0x4f09('0x101')](db['ChatInternalMessage'],{'as':_0x4f09('0x149'),'foreignKey':'ChatGroupId','onDelete':_0x4f09('0xff')});db[_0x4f09('0x10f')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x139'),'through':_0x4f09('0x188')});db[_0x4f09('0x62')][_0x4f09('0x10e')](db[_0x4f09('0x59')],{'as':_0x4f09('0x185'),'foreignKey':_0x4f09('0x17e')});db['CmCompany'][_0x4f09('0x101')](db[_0x4f09('0x66')],{'as':_0x4f09('0x112'),'foreignKey':_0x4f09('0x189')});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0x68')],{'as':_0x4f09('0x13b'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0x6b')],{'as':_0x4f09('0x104'),'foreignKey':_0x4f09('0x151')});db['CmContact']['hasMany'](db[_0x4f09('0x6d')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0x6f')],{'as':_0x4f09('0x6f'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0xc8')],{'as':_0x4f09('0x18a'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x66')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x4f09('0x106'),'foreignKey':_0x4f09('0x151'),'onDelete':_0x4f09('0x167')});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0x5b')],{'as':_0x4f09('0x107'),'foreignKey':_0x4f09('0x151'),'onDelete':_0x4f09('0x167')});db['CmContact'][_0x4f09('0x101')](db[_0x4f09('0x11a')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0x47')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x4f09('0x167')});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0x3b')],{'as':_0x4f09('0x109'),'foreignKey':_0x4f09('0x151'),'onDelete':_0x4f09('0x167')});db[_0x4f09('0x66')][_0x4f09('0x10e')](db['CmCompany'],{'as':_0x4f09('0x18b'),'foreignKey':'CompanyId'});db['CmContact'][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':'ListId','onDelete':_0x4f09('0xff')});db[_0x4f09('0x66')][_0x4f09('0x111')](db['User'],{'as':_0x4f09('0x164'),'through':_0x4f09('0x18c')});db['CmContact']['belongsToMany'](db['Tag'],{'as':_0x4f09('0x161'),'through':'cm_contact_has_tags'});db[_0x4f09('0x66')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x18d'),'as':'ThroughTags'});db[_0x4f09('0x68')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db['CmList'],{'as':_0x4f09('0x159'),'foreignKey':'ListId','onDelete':_0x4f09('0xff')});db['CmHopper'][_0x4f09('0x10e')](db['User'],{'as':_0x4f09('0x183'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x68')]['belongsTo'](db[_0x4f09('0x1d')],{'as':_0x4f09('0x18e'),'foreignKey':_0x4f09('0x13a'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x68')][_0x4f09('0x10e')](db[_0x4f09('0xda')],{'as':_0x4f09('0xda'),'foreignKey':_0x4f09('0x18f'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x68')]['belongsTo'](db[_0x4f09('0x12')],{'as':_0x4f09('0x160'),'foreignKey':_0x4f09('0x190')});db[_0x4f09('0x69')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x69')][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':'List','foreignKey':_0x4f09('0x15a'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x69')]['belongsTo'](db[_0x4f09('0x1d')],{'as':_0x4f09('0x18e'),'foreignKey':_0x4f09('0x13a'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x69')][_0x4f09('0x10e')](db[_0x4f09('0xda')],{'as':_0x4f09('0xda'),'foreignKey':_0x4f09('0x18f'),'onDelete':'cascade'});db[_0x4f09('0x191')][_0x4f09('0x101')](db[_0x4f09('0x79')],{'as':{'plural':_0x4f09('0x192'),'singular':_0x4f09('0x193')},'foreignKey':_0x4f09('0x194'),'onDelete':'cascade','hooks':!![]});db[_0x4f09('0x191')]['hasMany'](db[_0x4f09('0x79')],{'as':{'plural':'Any','singular':_0x4f09('0x195')},'foreignKey':_0x4f09('0x196'),'onDelete':_0x4f09('0xff'),'hooks':!![]});db[_0x4f09('0x191')]['hasMany'](db[_0x4f09('0x72')],{'as':_0x4f09('0x197'),'foreignKey':_0x4f09('0x198'),'onDelete':_0x4f09('0xff'),'hooks':!![]});db['Disposition']['hasMany'](db[_0x4f09('0x77')],{'as':_0x4f09('0x171'),'foreignKey':_0x4f09('0x199'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x7b')][_0x4f09('0x101')](db[_0x4f09('0x7b')],{'as':_0x4f09('0x19a'),'foreignKey':_0x4f09('0x142'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x4f09('0x7b')][_0x4f09('0x101')](db['VoiceExtension'],{'as':_0x4f09('0x103'),'foreignKey':_0x4f09('0x142'),'onDelete':_0x4f09('0x167')});db[_0x4f09('0x7b')][_0x4f09('0x101')](db[_0x4f09('0x158')],{'as':_0x4f09('0x19b'),'foreignKey':_0x4f09('0x142')});db[_0x4f09('0x7b')][_0x4f09('0x101')](db[_0x4f09('0x180')],{'as':_0x4f09('0x19c'),'foreignKey':_0x4f09('0x142')});db[_0x4f09('0x7b')][_0x4f09('0x101')](db[_0x4f09('0x46')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x4f09('0x7b')][_0x4f09('0x101')](db[_0x4f09('0x4e')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x4f09('0x19d')][_0x4f09('0x10e')](db['MailAccount'],{});db['Schedule'][_0x4f09('0x10e')](db['AnalyticDefaultReport'],{'foreignKey':_0x4f09('0x19e')});db['Schedule'][_0x4f09('0x10e')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0x4f09('0x137')][_0x4f09('0x111')](db[_0x4f09('0x1b')],{'as':_0x4f09('0x19f'),'through':'moh_has_sounds','onDelete':_0x4f09('0x167')});db[_0x4f09('0x82')][_0x4f09('0x111')](db[_0x4f09('0x66')],{'through':_0x4f09('0x18d')});db[_0x4f09('0x82')][_0x4f09('0x111')](db['ChatInteraction'],{'through':_0x4f09('0x186')});db[_0x4f09('0x82')][_0x4f09('0x111')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x4f09('0x82')]['belongsToMany'](db[_0x4f09('0x11a')],{'through':'sms_interaction_has_tags'});db[_0x4f09('0x82')][_0x4f09('0x111')](db[_0x4f09('0x47')],{'through':_0x4f09('0x16d')});db['Tag']['belongsToMany'](db[_0x4f09('0x54')],{'through':_0x4f09('0x17d')});db[_0x4f09('0x82')][_0x4f09('0x111')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0x4f09('0x85')][_0x4f09('0x101')](db[_0x4f09('0x79')],{'as':{'plural':_0x4f09('0x1a0'),'singular':_0x4f09('0x1a1')},'foreignKey':_0x4f09('0x1a2'),'onDelete':_0x4f09('0xff'),'hooks':!![]});db[_0x4f09('0x85')][_0x4f09('0x101')](db[_0x4f09('0x79')],{'as':{'plural':_0x4f09('0x1a3'),'singular':_0x4f09('0x1a4')},'foreignKey':_0x4f09('0x1a5'),'onDelete':_0x4f09('0xff'),'hooks':!![]});db['Trigger'][_0x4f09('0x101')](db['Action'],{'as':'Actions','foreignKey':_0x4f09('0x1a6'),'onDelete':_0x4f09('0xff'),'hooks':!![]});db['AnalyticCustomReport'][_0x4f09('0x101')](db[_0x4f09('0x90')],{'as':_0x4f09('0x1a7'),'onDelete':'cascade','foreignKey':_0x4f09('0x1a8'),'hooks':!![]});db[_0x4f09('0x8d')][_0x4f09('0x101')](db['AnalyticFieldReport'],{'as':_0x4f09('0x1a7'),'onDelete':'cascade','foreignKey':_0x4f09('0x19e')});db[_0x4f09('0x8f')][_0x4f09('0x101')](db[_0x4f09('0x90')],{'as':_0x4f09('0x1a7'),'onDelete':'cascade','foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x4f09('0x10e')](db[_0x4f09('0x8f')],{'foreignKey':'MetricId'});db[_0x4f09('0x1a9')]['hasMany'](db['SalesforceConfiguration'],{'as':_0x4f09('0x1aa'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db['SalesforceConfiguration'][_0x4f09('0x101')](db['SalesforceField'],{'as':'Subjects','onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0x94')][_0x4f09('0x101')](db[_0x4f09('0x95')],{'as':_0x4f09('0x1ad'),'onDelete':_0x4f09('0xff'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0x4f09('0x101')](db[_0x4f09('0x95')],{'as':_0x4f09('0x1a7'),'onDelete':_0x4f09('0xff'),'foreignKey':'FieldId'});db[_0x4f09('0x94')][_0x4f09('0x10e')](db[_0x4f09('0x1a9')],{'as':'Account','foreignKey':'AccountId'});db[_0x4f09('0x95')][_0x4f09('0x101')](db[_0x4f09('0x95')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4f09('0x95')]['hasMany'](db[_0x4f09('0x95')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x4f09('0x95')][_0x4f09('0x101')](db[_0x4f09('0x95')],{'as':_0x4f09('0x1ae'),'foreignKey':'FieldId'});db['SalesforceField'][_0x4f09('0x10e')](db[_0x4f09('0x1af')],{'as':_0x4f09('0x1af'),'foreignKey':'VariableId'});db[_0x4f09('0x97')]['hasMany'](db[_0x4f09('0x99')],{'as':_0x4f09('0x1aa'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0x99')]['hasMany'](db['SugarcrmField'],{'as':_0x4f09('0x1b0'),'onDelete':'cascade','foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0x99')][_0x4f09('0x101')](db[_0x4f09('0x9b')],{'as':_0x4f09('0x1ad'),'onDelete':_0x4f09('0xff'),'foreignKey':'DescriptionId'});db[_0x4f09('0x99')][_0x4f09('0x101')](db[_0x4f09('0x9b')],{'as':_0x4f09('0x1a7'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b1')});db['SugarcrmConfiguration'][_0x4f09('0x10e')](db[_0x4f09('0x97')],{'as':'Account','foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0x9b')][_0x4f09('0x101')](db[_0x4f09('0x9b')],{'as':_0x4f09('0x1b2'),'foreignKey':'SubjectId'});db[_0x4f09('0x9b')][_0x4f09('0x101')](db[_0x4f09('0x9b')],{'as':_0x4f09('0x1b3'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0x9b')][_0x4f09('0x101')](db[_0x4f09('0x9b')],{'as':_0x4f09('0x1ae'),'foreignKey':'FieldId'});db[_0x4f09('0x9b')][_0x4f09('0x10e')](db[_0x4f09('0x1af')],{'as':'Variable','foreignKey':_0x4f09('0x1b5')});db[_0x4f09('0x9d')]['hasMany'](db[_0x4f09('0x1b6')],{'as':_0x4f09('0x1aa'),'onDelete':_0x4f09('0xff'),'foreignKey':'AccountId'});db[_0x4f09('0x1b6')][_0x4f09('0x101')](db[_0x4f09('0x9e')],{'as':_0x4f09('0x1b0'),'onDelete':_0x4f09('0xff'),'foreignKey':'SubjectId'});db[_0x4f09('0x1b6')][_0x4f09('0x101')](db[_0x4f09('0x9e')],{'as':_0x4f09('0x1ad'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0x1b6')]['hasMany'](db[_0x4f09('0x9e')],{'as':_0x4f09('0x1a7'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0x1b6')][_0x4f09('0x10e')](db[_0x4f09('0x9d')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0x1b6')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':'int_desk_configuration_has_tags'});db[_0x4f09('0x9e')][_0x4f09('0x101')](db[_0x4f09('0x9e')],{'as':_0x4f09('0x1b2'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0x9e')][_0x4f09('0x101')](db[_0x4f09('0x9e')],{'as':_0x4f09('0x1b3'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0x9e')]['hasMany'](db['DeskField'],{'as':_0x4f09('0x1ae'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0x9e')][_0x4f09('0x10e')](db[_0x4f09('0x1af')],{'as':_0x4f09('0x1af'),'foreignKey':_0x4f09('0x1b5')});db[_0x4f09('0x1b7')]['hasMany'](db[_0x4f09('0xa1')],{'as':_0x4f09('0x1aa'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xa1')]['hasMany'](db[_0x4f09('0xa3')],{'as':_0x4f09('0x1b0'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x4f09('0xa1')][_0x4f09('0x101')](db['ZohoField'],{'as':_0x4f09('0x1ad'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0xa1')][_0x4f09('0x101')](db[_0x4f09('0xa3')],{'as':_0x4f09('0x1a7'),'onDelete':_0x4f09('0xff'),'foreignKey':'FieldId'});db[_0x4f09('0xa1')][_0x4f09('0x10e')](db[_0x4f09('0x1b7')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xa3')]['hasMany'](db[_0x4f09('0xa3')],{'as':'Subject','foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0xa3')]['hasMany'](db['ZohoField'],{'as':_0x4f09('0x1b3'),'foreignKey':'DescriptionId'});db[_0x4f09('0xa3')][_0x4f09('0x101')](db[_0x4f09('0xa3')],{'as':_0x4f09('0x1ae'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0xa3')][_0x4f09('0x10e')](db['Variable'],{'as':'Variable','foreignKey':_0x4f09('0x1b5')});db[_0x4f09('0xa5')][_0x4f09('0x101')](db[_0x4f09('0x1b8')],{'as':_0x4f09('0x1aa'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db['ZendeskConfiguration'][_0x4f09('0x101')](db[_0x4f09('0x1b9')],{'as':'Subjects','foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0x1b8')][_0x4f09('0x101')](db[_0x4f09('0x1b9')],{'as':_0x4f09('0x1ad'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0x1b8')]['hasMany'](db[_0x4f09('0x1b9')],{'as':'Fields','foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0x1b8')][_0x4f09('0x10e')](db[_0x4f09('0xa5')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0x1b8')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x1ba')});db[_0x4f09('0x1b9')][_0x4f09('0x101')](db[_0x4f09('0x1b9')],{'as':_0x4f09('0x1b2'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0x1b9')][_0x4f09('0x101')](db[_0x4f09('0x1b9')],{'as':_0x4f09('0x1b3'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0x1b9')][_0x4f09('0x101')](db[_0x4f09('0x1b9')],{'as':_0x4f09('0x1ae'),'foreignKey':'FieldId'});db[_0x4f09('0x1b9')]['belongsTo'](db[_0x4f09('0x1af')],{'as':'Variable','foreignKey':_0x4f09('0x1b5')});db[_0x4f09('0xa8')]['hasMany'](db[_0x4f09('0xa9')],{'as':'Configurations','onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db['FreshdeskConfiguration']['hasMany'](db[_0x4f09('0xab')],{'as':_0x4f09('0x1b0'),'onDelete':_0x4f09('0xff'),'foreignKey':'SubjectId'});db[_0x4f09('0xa9')][_0x4f09('0x101')](db[_0x4f09('0xab')],{'as':_0x4f09('0x1ad'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0xa9')]['hasMany'](db[_0x4f09('0xab')],{'as':'Fields','onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0xa9')][_0x4f09('0x10e')](db[_0x4f09('0xa8')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xa9')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x1bb')});db[_0x4f09('0xab')][_0x4f09('0x101')](db['FreshdeskField'],{'as':_0x4f09('0x1b2'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0xab')][_0x4f09('0x101')](db[_0x4f09('0xab')],{'as':'Description','foreignKey':_0x4f09('0x1b4')});db['FreshdeskField'][_0x4f09('0x101')](db[_0x4f09('0xab')],{'as':'Field','foreignKey':_0x4f09('0x1b1')});db['FreshdeskField']['belongsTo'](db[_0x4f09('0x1af')],{'as':_0x4f09('0x1af'),'foreignKey':'VariableId'});db[_0x4f09('0xad')][_0x4f09('0x101')](db['VtigerConfiguration'],{'as':_0x4f09('0x1aa'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xaf')][_0x4f09('0x101')](db[_0x4f09('0xb1')],{'as':'Subjects','foreignKey':_0x4f09('0x1ac')});db['VtigerConfiguration'][_0x4f09('0x101')](db[_0x4f09('0xb1')],{'as':_0x4f09('0x1ad'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0xaf')][_0x4f09('0x101')](db[_0x4f09('0xb1')],{'as':_0x4f09('0x1a7'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0xaf')][_0x4f09('0x10e')](db[_0x4f09('0xad')],{'as':'Account','foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xb1')][_0x4f09('0x101')](db[_0x4f09('0xb1')],{'as':_0x4f09('0x1b2'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0xb1')]['hasMany'](db['VtigerField'],{'as':_0x4f09('0x1b3'),'foreignKey':'DescriptionId'});db[_0x4f09('0xb1')]['hasMany'](db['VtigerField'],{'as':_0x4f09('0x1ae'),'foreignKey':'FieldId'});db[_0x4f09('0xb1')][_0x4f09('0x10e')](db[_0x4f09('0x1af')],{'as':'Variable','foreignKey':_0x4f09('0x1b5')});db[_0x4f09('0xb3')][_0x4f09('0x101')](db[_0x4f09('0xb4')],{'as':'Configurations','onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db['ServicenowConfiguration'][_0x4f09('0x101')](db[_0x4f09('0xb5')],{'as':_0x4f09('0x1b0'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0xb4')]['hasMany'](db[_0x4f09('0xb5')],{'as':'Descriptions','foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0xb4')][_0x4f09('0x101')](db[_0x4f09('0xb5')],{'as':_0x4f09('0x1a7'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0xb4')][_0x4f09('0x10e')](db['ServicenowAccount'],{'as':_0x4f09('0x15f'),'foreignKey':'AccountId'});db[_0x4f09('0xb5')]['hasMany'](db[_0x4f09('0xb5')],{'as':_0x4f09('0x1b2'),'foreignKey':'SubjectId'});db['ServicenowField'][_0x4f09('0x101')](db[_0x4f09('0xb5')],{'as':_0x4f09('0x1b3'),'foreignKey':'DescriptionId'});db[_0x4f09('0xb5')][_0x4f09('0x101')](db[_0x4f09('0xb5')],{'as':_0x4f09('0x1ae'),'foreignKey':_0x4f09('0x1b1')});db['ServicenowField'][_0x4f09('0x10e')](db['Variable'],{'as':_0x4f09('0x1af'),'foreignKey':_0x4f09('0x1b5')});db['Dynamics365Account'][_0x4f09('0x101')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xb8')][_0x4f09('0x101')](db['Dynamics365Field'],{'as':_0x4f09('0x1b0'),'onDelete':_0x4f09('0xff'),'foreignKey':'SubjectId'});db[_0x4f09('0xb8')]['hasMany'](db[_0x4f09('0xba')],{'as':_0x4f09('0x1ad'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0xb8')][_0x4f09('0x101')](db[_0x4f09('0xba')],{'as':'Fields','onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0xb8')][_0x4f09('0x10e')](db['Dynamics365Account'],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xba')][_0x4f09('0x101')](db[_0x4f09('0xba')],{'as':_0x4f09('0x1b2'),'foreignKey':_0x4f09('0x1ac')});db['Dynamics365Field'][_0x4f09('0x101')](db[_0x4f09('0xba')],{'as':_0x4f09('0x1b3'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0xba')][_0x4f09('0x101')](db[_0x4f09('0xba')],{'as':'Field','foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0xba')][_0x4f09('0x10e')](db['Variable'],{'as':'Variable','foreignKey':_0x4f09('0x1b5')});db[_0x4f09('0xbb')][_0x4f09('0x101')](db[_0x4f09('0xbd')],{'as':_0x4f09('0x1aa'),'onDelete':'cascade','foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xbd')]['hasMany'](db[_0x4f09('0xbf')],{'as':_0x4f09('0x1b0'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0xbd')]['hasMany'](db[_0x4f09('0xbf')],{'as':_0x4f09('0x1ad'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x4f09('0x101')](db[_0x4f09('0xbf')],{'as':_0x4f09('0x1a7'),'foreignKey':_0x4f09('0x1b1')});db['FreshsalesConfiguration'][_0x4f09('0x10e')](db[_0x4f09('0xbb')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xbf')][_0x4f09('0x101')](db[_0x4f09('0xbf')],{'as':_0x4f09('0x1b2'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0xbf')][_0x4f09('0x101')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x4f09('0x1b4')});db['FreshsalesField'][_0x4f09('0x101')](db[_0x4f09('0xbf')],{'as':'Field','foreignKey':_0x4f09('0x1b1')});db['FreshsalesField'][_0x4f09('0x10e')](db[_0x4f09('0x1af')],{'as':_0x4f09('0x1af'),'foreignKey':_0x4f09('0x1b5')});db['ChatQueueReport'][_0x4f09('0x10e')](db[_0x4f09('0x59')],{});db['ChatQueueReport'][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0xc2')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0xc2')][_0x4f09('0x10e')](db[_0x4f09('0x5b')],{});db['ChatQueueReport'][_0x4f09('0x10e')](db[_0x4f09('0x181')],{});db[_0x4f09('0xc2')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{});db[_0x4f09('0xc2')][_0x4f09('0x10e')](db['ChatQueue'],{});db[_0x4f09('0xc3')]['belongsTo'](db[_0x4f09('0x12')],{'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1bc')});db[_0x4f09('0xc3')][_0x4f09('0x10e')](db['User'],{'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1bd')});db[_0x4f09('0xc8')][_0x4f09('0x101')](db[_0x4f09('0xc6')],{'foreignKey':'SessionId','onDelete':_0x4f09('0xff')});db[_0x4f09('0xc8')][_0x4f09('0x101')](db[_0x4f09('0x1be')],{'foreignKey':_0x4f09('0x1bf'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0xc9')][_0x4f09('0x10e')](db[_0x4f09('0x4c')],{});db[_0x4f09('0xc9')]['belongsTo'](db['CmList'],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0xc9')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':'ContactId'});db[_0x4f09('0xc9')][_0x4f09('0x10e')](db[_0x4f09('0x11a')],{});db['SmsQueueReport'][_0x4f09('0x10e')](db[_0x4f09('0x174')],{});db[_0x4f09('0xc9')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{});db[_0x4f09('0xc9')][_0x4f09('0x10e')](db[_0x4f09('0x51')],{});db['JscriptyProject'][_0x4f09('0x101')](db[_0x4f09('0xc8')],{'foreignKey':_0x4f09('0x1c0')});db['JscriptyProject'][_0x4f09('0x101')](db[_0x4f09('0xc6')],{'foreignKey':_0x4f09('0x1c0')});db['JscriptyProject'][_0x4f09('0x101')](db['JscriptyAnswerReport'],{'foreignKey':_0x4f09('0x1c0')});db['SquareProject'][_0x4f09('0x111')](db['User'],{'as':_0x4f09('0x164'),'through':_0x4f09('0x1c1')});db[_0x4f09('0xd8')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':'user_has_teams'});db[_0x4f09('0xd8')][_0x4f09('0x111')](db[_0x4f09('0x1d')],{'through':_0x4f09('0x1c2'),'as':_0x4f09('0x1c3')});db[_0x4f09('0xd8')][_0x4f09('0x111')](db[_0x4f09('0x38')],{'through':'team_has_mail_queues','as':_0x4f09('0x11f')});db[_0x4f09('0xd8')][_0x4f09('0x111')](db[_0x4f09('0x5f')],{'through':_0x4f09('0x187'),'as':_0x4f09('0x120')});db[_0x4f09('0xd8')][_0x4f09('0x111')](db[_0x4f09('0x4a')],{'through':_0x4f09('0x16f'),'as':_0x4f09('0x121')});db[_0x4f09('0xd8')][_0x4f09('0x111')](db[_0x4f09('0x51')],{'through':_0x4f09('0x178'),'as':_0x4f09('0x1c4')});db[_0x4f09('0xd8')]['belongsToMany'](db[_0x4f09('0x57')],{'through':_0x4f09('0x1c5'),'as':_0x4f09('0x124')});db[_0x4f09('0xd8')][_0x4f09('0x111')](db['WhatsappQueue'],{'through':_0x4f09('0x1c6'),'as':'WhatsappQueues'});db[_0x4f09('0xda')][_0x4f09('0x101')](db[_0x4f09('0x68')],{'as':_0x4f09('0x13b'),'foreignKey':_0x4f09('0x18f')});db[_0x4f09('0xda')][_0x4f09('0x101')](db[_0x4f09('0x6b')],{'as':_0x4f09('0x104'),'foreignKey':_0x4f09('0x18f')});db[_0x4f09('0xda')][_0x4f09('0x101')](db['CmHopperHistory'],{'as':_0x4f09('0x13c'),'foreignKey':_0x4f09('0x18f')});db[_0x4f09('0xda')][_0x4f09('0x101')](db[_0x4f09('0x69')],{'as':'HopperBlacks','foreignKey':_0x4f09('0x18f')});db['Campaign'][_0x4f09('0x10e')](db[_0x4f09('0x13e')],{'as':_0x4f09('0x13e'),'foreignKey':_0x4f09('0x13f')});db[_0x4f09('0xda')]['belongsTo'](db[_0x4f09('0x13e')],{'as':_0x4f09('0x140'),'foreignKey':'TrunkBackupId'});db[_0x4f09('0xda')][_0x4f09('0x10e')](db['Interval'],{'as':_0x4f09('0x7b'),'foreignKey':_0x4f09('0x142')});db[_0x4f09('0xda')][_0x4f09('0x10e')](db[_0x4f09('0xd3')],{'as':_0x4f09('0xd3'),'foreignKey':_0x4f09('0x1c7')});db['Campaign'][_0x4f09('0x111')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x113'),'through':_0x4f09('0x1c8')});db[_0x4f09('0xda')][_0x4f09('0x111')](db['CmList'],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db['MailTransferReport']['belongsTo'](db['MailMessage'],{});db[_0x4f09('0x1c9')][_0x4f09('0x10e')](db[_0x4f09('0x3b')],{});db[_0x4f09('0x1c9')]['belongsTo'](db[_0x4f09('0x36')],{'foreignKey':_0x4f09('0x1ca'),'as':'FromAccount'});db[_0x4f09('0x1c9')][_0x4f09('0x10e')](db['User'],{'foreignKey':_0x4f09('0x1cb'),'as':'FromAgent'});db[_0x4f09('0x1c9')][_0x4f09('0x10e')](db['User'],{'foreignKey':_0x4f09('0x1cc'),'as':_0x4f09('0x1cd')});db[_0x4f09('0x1c9')][_0x4f09('0x10e')](db[_0x4f09('0x38')],{'foreignKey':_0x4f09('0x1ce'),'as':_0x4f09('0x1cf')});db[_0x4f09('0x1c9')][_0x4f09('0x10e')](db[_0x4f09('0x36')],{'foreignKey':_0x4f09('0x1d0'),'as':'ToAccount'});db[_0x4f09('0xe0')][_0x4f09('0x10e')](db[_0x4f09('0x181')],{});db['ChatTransferReport'][_0x4f09('0x10e')](db[_0x4f09('0x5b')],{});db[_0x4f09('0xe0')][_0x4f09('0x10e')](db[_0x4f09('0x59')],{'foreignKey':_0x4f09('0x1d1'),'as':_0x4f09('0x1d2')});db[_0x4f09('0xe0')][_0x4f09('0x10e')](db['User'],{'foreignKey':_0x4f09('0x1cb'),'as':_0x4f09('0x1d3')});db[_0x4f09('0xe0')]['belongsTo'](db['User'],{'foreignKey':_0x4f09('0x1cc'),'as':_0x4f09('0x1cd')});db[_0x4f09('0xe0')][_0x4f09('0x10e')](db['ChatQueue'],{'foreignKey':_0x4f09('0x1d4'),'as':_0x4f09('0x1cf')});db[_0x4f09('0xe0')][_0x4f09('0x10e')](db[_0x4f09('0x59')],{'foreignKey':'ToChatWebsiteId','as':_0x4f09('0x1d5')});db['FaxTransferReport'][_0x4f09('0x10e')](db[_0x4f09('0x49')],{});db[_0x4f09('0x1d6')][_0x4f09('0x10e')](db[_0x4f09('0x47')],{});db['FaxTransferReport'][_0x4f09('0x10e')](db[_0x4f09('0x45')],{'foreignKey':_0x4f09('0x1d7'),'as':_0x4f09('0x1d2')});db[_0x4f09('0x1d6')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':_0x4f09('0x1cb'),'as':_0x4f09('0x1d3')});db[_0x4f09('0x1d6')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':_0x4f09('0x1cc'),'as':'ToAgent'});db['FaxTransferReport'][_0x4f09('0x10e')](db[_0x4f09('0x4a')],{'foreignKey':_0x4f09('0x1d8'),'as':_0x4f09('0x1cf')});db[_0x4f09('0x1d6')][_0x4f09('0x10e')](db[_0x4f09('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x4f09('0x1d5')});db[_0x4f09('0xe3')][_0x4f09('0x10e')](db[_0x4f09('0x17b')],{});db[_0x4f09('0xe3')][_0x4f09('0x10e')](db['OpenchannelInteraction'],{});db[_0x4f09('0xe3')][_0x4f09('0x10e')](db[_0x4f09('0x12f')],{'foreignKey':'FromOpenchannelAccountId','as':_0x4f09('0x1d2')});db[_0x4f09('0xe3')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':'FromUserId','as':_0x4f09('0x1d3')});db[_0x4f09('0xe3')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':_0x4f09('0x1cc'),'as':'ToAgent'});db['OpenchannelTransferReport']['belongsTo'](db[_0x4f09('0x57')],{'foreignKey':_0x4f09('0x1d9'),'as':_0x4f09('0x1cf')});db[_0x4f09('0xe3')][_0x4f09('0x10e')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x4f09('0x1d5')});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db[_0x4f09('0x174')],{});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db[_0x4f09('0x11a')],{});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db[_0x4f09('0x4c')],{'foreignKey':'FromSmsAccountId','as':_0x4f09('0x1d2')});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db['User'],{'foreignKey':_0x4f09('0x1cb'),'as':_0x4f09('0x1d3')});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':_0x4f09('0x1cc'),'as':_0x4f09('0x1cd')});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db[_0x4f09('0x51')],{'foreignKey':_0x4f09('0x1da'),'as':'ToQueue'});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db[_0x4f09('0x4c')],{'foreignKey':_0x4f09('0x1db'),'as':_0x4f09('0x1d5')});db['CmList']['hasMany'](db[_0x4f09('0x77')],{'as':_0x4f09('0x171'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0xe7')][_0x4f09('0x101')](db[_0x4f09('0x71')],{'as':_0x4f09('0x1dc'),'foreignKey':_0x4f09('0x15a')});db['CmList'][_0x4f09('0x101')](db[_0x4f09('0x66')],{'as':_0x4f09('0x112'),'onDelete':_0x4f09('0xff'),'foreignKey':'ListId'});db[_0x4f09('0xe7')][_0x4f09('0x101')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x4f09('0xe7')][_0x4f09('0x101')](db[_0x4f09('0x6d')],{'as':_0x4f09('0x105'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0xe7')]['hasMany'](db[_0x4f09('0x6f')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x4f09('0xe7')][_0x4f09('0x111')](db[_0x4f09('0x1d')],{'as':_0x4f09('0x1dd'),'through':'voice_queues_has_cm_lists'});db[_0x4f09('0xe7')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x114')});db['VoicePrefix'][_0x4f09('0x101')](db[_0x4f09('0x19')],{'as':_0x4f09('0x103'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0xe9')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':'user_has_voice_prefixes'});db[_0x4f09('0xeb')][_0x4f09('0x101')](db[_0x4f09('0x12')],{'as':_0x4f09('0x164'),'foreignKey':_0x4f09('0x1de')});db[_0x4f09('0xeb')]['hasMany'](db[_0x4f09('0x1df')],{'as':_0x4f09('0x1e0'),'foreignKey':_0x4f09('0x1de'),'onDelete':_0x4f09('0xff')});db['UserProfileSection']['hasMany'](db[_0x4f09('0x1e1')],{'as':_0x4f09('0x1e2'),'foreignKey':_0x4f09('0x1e3'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x131')][_0x4f09('0x101')](db[_0x4f09('0x77')],{'as':_0x4f09('0x171'),'foreignKey':_0x4f09('0x1e4')});db[_0x4f09('0x131')][_0x4f09('0x101')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x4f09('0x1e4')});db[_0x4f09('0x131')][_0x4f09('0x101')](db[_0x4f09('0xf3')],{'as':_0x4f09('0x149'),'foreignKey':_0x4f09('0x1e4')});db[_0x4f09('0x131')][_0x4f09('0x101')](db[_0x4f09('0x1e5')],{'as':_0x4f09('0x157')});db[_0x4f09('0x131')][_0x4f09('0x101')](db['WhatsappApplication'],{'as':_0x4f09('0x136')});db[_0x4f09('0x131')][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0x131')][_0x4f09('0x10e')](db[_0x4f09('0x7d')],{'as':_0x4f09('0x143'),'foreignKey':_0x4f09('0x15d')});db[_0x4f09('0x131')]['belongsToMany'](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x1e6')});db[_0x4f09('0xf0')][_0x4f09('0x10e')](db['User'],{'onDelete':'restrict'});db[_0x4f09('0xf0')][_0x4f09('0x10e')](db[_0x4f09('0xf9')],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0xf0')]['belongsTo'](db[_0x4f09('0x131')],{'onDelete':'restrict'});db[_0x4f09('0xf0')][_0x4f09('0x10e')](db[_0x4f09('0x7b')],{'onDelete':_0x4f09('0x167'),'foreignKey':'IntervalId'});db[_0x4f09('0xf0')]['belongsTo'](db['Tag'],{'onDelete':_0x4f09('0x167'),'foreignKey':_0x4f09('0x16b')});db[_0x4f09('0x1e5')][_0x4f09('0x101')](db[_0x4f09('0xf3')],{'as':_0x4f09('0x149'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1e7')});db['WhatsappInteraction'][_0x4f09('0x10e')](db[_0x4f09('0x131')],{'as':_0x4f09('0x15f'),'foreignKey':'WhatsappAccountId'});db[_0x4f09('0x1e5')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x1e5')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':'Owner','foreignKey':_0x4f09('0x100')});db[_0x4f09('0x1e5')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':'whatsapp_interaction_has_tags','as':_0x4f09('0x161')});db[_0x4f09('0x1e5')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x1e8'),'as':'ThroughTags'});db[_0x4f09('0x1e5')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x164'),'through':_0x4f09('0x11d'),'foreignKey':_0x4f09('0x1e7')});db[_0x4f09('0xf3')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':_0x4f09('0x12')});db[_0x4f09('0xf3')][_0x4f09('0x10e')](db['CmContact'],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x150')});db[_0x4f09('0xf3')][_0x4f09('0x10e')](db[_0x4f09('0x1e5')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x166'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x4f09('0x10e')](db[_0x4f09('0x131')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1e4')});db[_0x4f09('0xf5')][_0x4f09('0x10e')](db[_0x4f09('0x131')],{});db[_0x4f09('0xf5')][_0x4f09('0x10e')](db['CmList'],{'as':_0x4f09('0x159'),'foreignKey':'ListId'});db[_0x4f09('0xf5')][_0x4f09('0x10e')](db['CmContact'],{'as':'Contact','foreignKey':_0x4f09('0x151')});db[_0x4f09('0xf5')][_0x4f09('0x10e')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x4f09('0x10e')](db[_0x4f09('0xf9')],{});db[_0x4f09('0xf5')][_0x4f09('0x10e')](db[_0x4f09('0xf3')],{});db[_0x4f09('0xf5')][_0x4f09('0x10e')](db['User'],{});db['WhatsappTransferReport']['belongsTo'](db[_0x4f09('0xf3')],{});db[_0x4f09('0xf7')]['belongsTo'](db[_0x4f09('0x1e5')],{});db[_0x4f09('0xf7')][_0x4f09('0x10e')](db['WhatsappAccount'],{'foreignKey':_0x4f09('0x1e9'),'as':_0x4f09('0x1d2')});db['WhatsappTransferReport'][_0x4f09('0x10e')](db[_0x4f09('0x131')],{'foreignKey':_0x4f09('0x1ea'),'as':'ToAccount'});db[_0x4f09('0xf7')][_0x4f09('0x10e')](db[_0x4f09('0xf9')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x4f09('0xf7')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':_0x4f09('0x1cb'),'as':_0x4f09('0x1d3')});db[_0x4f09('0xf7')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':_0x4f09('0x1cc'),'as':'ToAgent'});db[_0x4f09('0xf9')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x33'),'foreignKey':_0x4f09('0x1eb')});db[_0x4f09('0xf9')][_0x4f09('0x111')](db[_0x4f09('0xd8')],{'through':_0x4f09('0x1c6'),'as':_0x4f09('0x146')});module[_0x4f09('0x1ec')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x1abc=['../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ChatInteraction','ChatInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','Groups','chat_group_has_users','belongsToMany','CmContact','Contacts','cm_user_has_lists','Team','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','OpenchannelInteractions','user_has_whatsapp_interactions','VoiceQueue','UserVoiceQueue','MailQueues','UserMailQueue','ChatQueues','FaxQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','VoicePrefix','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','VoiceContext','Sound','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceMailMessage','VoiceQueueReport','Contact','ContactId','MailAccountId','Imap','Dispositions','Answers','Applications','List','TemplateId','mandatoryDispositionPause','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Tags','Users','MailMessage','Interaction','restrict','TagId','ListId','Items','FaxAccountId','Interactions','Exntensions','Owner','fax_interaction_has_tags','FaxInteractionId','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','ThroughTags','user_has_sms_interactions','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Members','HopperHistories','SmsInteractions','FaxInteractions','Company','CompanyId','cm_user_has_contacts','cm_contact_has_tags','CampaignId','OwnerId','All','AutomationAllId','Automation','Any','OneAny','AutomationAnyId','Action','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','TriggerAllId','AnyConditions','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','Variable','VariableId','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZohoField','FreshdeskAccount','int_freshdesk_configuration_has_tags','ServicenowConfiguration','Dynamics365Configuration','FreshsalesAccount','ChatQueueReport','FromId','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','JscriptyProject','ProjectId','team_has_chat_queues','team_has_sms_queues','SmsQueues','team_has_whatsapp_queues','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','exports','path','../config/environment','sequelize','jstz','determine','defaultsDeep','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xcall','username','database','password','options','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','Template','../api/template/template.model','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport'];(function(_0x50ac27,_0x1306e3){var _0x45f86a=function(_0x512a96){while(--_0x512a96){_0x50ac27['push'](_0x50ac27['shift']());}};_0x45f86a(++_0x1306e3);}(_0x1abc,0x107));var _0xc1ab=function(_0x7430b6,_0x4fe9f4){_0x7430b6=_0x7430b6-0x0;var _0x3cd462=_0x1abc[_0x7430b6];return _0x3cd462;};'use strict';var path=require(_0xc1ab('0x0'));var config=require(_0xc1ab('0x1'));var Sequelize=require(_0xc1ab('0x2'));var _=require('lodash');var jstz=require(_0xc1ab('0x3'));var timezone=jstz[_0xc1ab('0x4')]();config['sequelize']=_[_0xc1ab('0x5')](config[_0xc1ab('0x2')],{'database':'motion2','username':'xcall','password':_0xc1ab('0x6'),'options':{'host':_0xc1ab('0x7'),'port':0xcea,'dialect':_0xc1ab('0x8'),'dialectOptions':{'charset':_0xc1ab('0x9')},'logging':![],'timezone':timezone[_0xc1ab('0xa')](),'define':{'charset':_0xc1ab('0xb'),'collate':_0xc1ab('0xc')}}});config[_0xc1ab('0xd')]=_[_0xc1ab('0x5')](config['sequelizeHistory'],{'database':'motion2','username':_0xc1ab('0xe'),'password':'xC@LL1234','options':{'host':_0xc1ab('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xc1ab('0xa')](),'define':{'charset':'utf8','collate':_0xc1ab('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc1ab('0x2')]['database'],config[_0xc1ab('0x2')][_0xc1ab('0xf')],config[_0xc1ab('0x2')]['password'],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc1ab('0xd')][_0xc1ab('0x10')],config['sequelizeHistory'][_0xc1ab('0xf')],config[_0xc1ab('0xd')][_0xc1ab('0x11')],config[_0xc1ab('0xd')][_0xc1ab('0x12')])};db[_0xc1ab('0x13')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0x14'));db[_0xc1ab('0x15')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x17'));db[_0xc1ab('0x18')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x19'));db[_0xc1ab('0x1a')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x1b'));db['VoiceQueue']=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x1c'));db[_0xc1ab('0x1d')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x1e'));db['ScreenRecording']=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x1f'));db['VoiceMailMessage']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x20'));db[_0xc1ab('0x21')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x22'));db[_0xc1ab('0x23')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x24'));db[_0xc1ab('0x25')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x26'));db['VoiceQueueReport']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x27'));db[_0xc1ab('0x28')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/memberReport/memberReport.model');db['Trunk']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x29'));db[_0xc1ab('0x2a')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xc1ab('0x2b')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x2c'));db['UserVoiceQueue']=db[_0xc1ab('0x2')]['import'](_0xc1ab('0x2d'));db[_0xc1ab('0x2e')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x2f'));db['UserMailQueue']=db[_0xc1ab('0x2')]['import'](_0xc1ab('0x30'));db[_0xc1ab('0x31')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x32'));db['UserSmsQueue']=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/userSmsQueue/userSmsQueue.model');db[_0xc1ab('0x33')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0x34'));db['UserWhatsappQueue']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x35'));db[_0xc1ab('0x36')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x37'));db[_0xc1ab('0x38')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x39'));db[_0xc1ab('0x3a')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x3b'));db[_0xc1ab('0x3c')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x3d'));db[_0xc1ab('0x3e')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x3f'));db[_0xc1ab('0x40')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x41'));db['MailMessage']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x42'));db[_0xc1ab('0x43')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0x44'));db[_0xc1ab('0x45')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x46'));db[_0xc1ab('0x47')]=db['sequelize']['import']('../api/dashboard/dashboard.model');db[_0xc1ab('0x48')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x49'));db[_0xc1ab('0x4a')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0x4b'));db[_0xc1ab('0x4c')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/faxInteraction/faxInteraction.model');db[_0xc1ab('0x4d')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x4e'));db[_0xc1ab('0x4f')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x50'));db['FaxQueueReport']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x51'));db[_0xc1ab('0x52')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0x53'));db[_0xc1ab('0x54')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/smsApplication/smsApplication.model');db[_0xc1ab('0x55')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x56'));db[_0xc1ab('0x57')]=db['sequelize']['import']('../api/smsMessage/smsMessage.model');db[_0xc1ab('0x58')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0x59'));db[_0xc1ab('0x5a')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0x5b'));db[_0xc1ab('0x5c')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/openchannelApplication/openchannelApplication.model');db[_0xc1ab('0x5d')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xc1ab('0x5e')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x5f'));db[_0xc1ab('0x60')]=db['sequelize'][_0xc1ab('0x16')]('../api/openchannelQueue/openchannelQueue.model');db[_0xc1ab('0x61')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x62'));db[_0xc1ab('0x63')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x64'));db[_0xc1ab('0x65')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x66'));db[_0xc1ab('0x67')]=db['sequelize']['import'](_0xc1ab('0x68'));db[_0xc1ab('0x69')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x6a'));db[_0xc1ab('0x6b')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/chatQueue/chatQueue.model');db[_0xc1ab('0x6c')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x6d'));db[_0xc1ab('0x6e')]=db[_0xc1ab('0x2')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0xc1ab('0x6f')]=db['sequelize']['import'](_0xc1ab('0x70'));db['CmContact']=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x71'));db[_0xc1ab('0x72')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x73'));db[_0xc1ab('0x74')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x75'));db[_0xc1ab('0x76')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x77'));db[_0xc1ab('0x78')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xc1ab('0x79')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0x7a'));db[_0xc1ab('0x7b')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x7c'));db['Action']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x7d'));db['Automation']=db['sequelize']['import'](_0xc1ab('0x7e'));db[_0xc1ab('0x7f')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x80'));db[_0xc1ab('0x81')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x82'));db[_0xc1ab('0x83')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x84'));db['Interval']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x85'));db[_0xc1ab('0x86')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x87'));db['Cdr']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x88'));db[_0xc1ab('0x89')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x8a'));db[_0xc1ab('0x8b')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x8c'));db['Sound']=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x8d'));db[_0xc1ab('0x8e')]=db[_0xc1ab('0x2')]['import']('../api/tag/tag.model');db[_0xc1ab('0x8f')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x90'));db['Trigger']=db[_0xc1ab('0x2')]['import'](_0xc1ab('0x91'));db['Variable']=db['sequelize'][_0xc1ab('0x16')]('../api/variable/variable.model');db[_0xc1ab('0x92')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x93'));db[_0xc1ab('0x94')]=db['sequelize'][_0xc1ab('0x16')]('../api/integrationReport/integrationReport.model');db[_0xc1ab('0x95')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xc1ab('0x96')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x97'));db['AnalyticExtractedReport']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x98'));db[_0xc1ab('0x99')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0x9a'));db[_0xc1ab('0x9b')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xc1ab('0x9c')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xc1ab('0x9d')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x9e'));db[_0xc1ab('0x9f')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0xa0'));db['SalesforceField']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xa1'));db[_0xc1ab('0xa2')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xa3'));db[_0xc1ab('0xa4')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xc1ab('0xa5')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xa6'));db[_0xc1ab('0xa7')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0xa8'));db[_0xc1ab('0xa9')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xc1ab('0xaa')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xab'));db['ZohoAccount']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xac'));db['ZohoConfiguration']=db[_0xc1ab('0x2')]['import'](_0xc1ab('0xad'));db['ZohoField']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xae'));db['ZendeskAccount']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xaf'));db[_0xc1ab('0xb0')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xc1ab('0xb1')]=db[_0xc1ab('0x2')]['import']('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0xc1ab('0x2')]['import'](_0xc1ab('0xb2'));db[_0xc1ab('0xb3')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xb4'));db[_0xc1ab('0xb5')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xb6'));db[_0xc1ab('0xb7')]=db['sequelize']['import'](_0xc1ab('0xb8'));db[_0xc1ab('0xb9')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0xba'));db[_0xc1ab('0xbb')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0xbc'));db[_0xc1ab('0xbd')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xbe'));db['ServicenowConfiguration']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xbf'));db[_0xc1ab('0xc0')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/intServicenowField/intServicenowField.model');db[_0xc1ab('0xc1')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0xc2'));db['Dynamics365Configuration']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xc3'));db[_0xc1ab('0xc4')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0xc5'));db[_0xc1ab('0xc6')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0xc7'));db[_0xc1ab('0xc8')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xc9'));db['Integration']=db[_0xc1ab('0x2')]['import']('../api/integration/integration.model');db[_0xc1ab('0xca')]=db[_0xc1ab('0x2')]['import']('../api/network/network.model');db['ChatQueueReport']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xcb'));db[_0xc1ab('0xcc')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xc1ab('0xcd')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0xce'));db['JscriptyQuestionReport']=db[_0xc1ab('0x2')]['import'](_0xc1ab('0xcf'));db[_0xc1ab('0xd0')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xd1'));db['SmsQueueReport']=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0xd2'));db[_0xc1ab('0xd3')]=db['sequelize']['import']('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xd4'));db[_0xc1ab('0xd5')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xd6'));db[_0xc1ab('0xd7')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/squareOdbc/squareOdbc.model');db[_0xc1ab('0xd8')]=db['sequelize']['import'](_0xc1ab('0xd9'));db[_0xc1ab('0xda')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0xdb'));db[_0xc1ab('0xdc')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xdd'));db['Team']=db[_0xc1ab('0x2')]['import'](_0xc1ab('0xde'));db[_0xc1ab('0xdf')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xe0'));db[_0xc1ab('0xe1')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xe2'));db[_0xc1ab('0xe3')]=db['sequelize'][_0xc1ab('0x16')]('../api/migration/migration.model');db[_0xc1ab('0xe4')]=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0xe5'));db['Plugin']=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xe6'));db[_0xc1ab('0xe7')]=db['sequelize']['import'](_0xc1ab('0xe8'));db[_0xc1ab('0xe9')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xea'));db[_0xc1ab('0xeb')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xec'));db[_0xc1ab('0xed')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xee'));db['SmsTransferReport']=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0xef'));db[_0xc1ab('0xf0')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xf1'));db['VoicePrefix']=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/voicePrefix/voicePrefix.model');db[_0xc1ab('0xf2')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xf3'));db[_0xc1ab('0xf4')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0xf5'));db[_0xc1ab('0xf6')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xf7'));db[_0xc1ab('0xf8')]=db['sequelize']['import'](_0xc1ab('0xf9'));db[_0xc1ab('0xfa')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xfb'));db[_0xc1ab('0xfc')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xfd'));db[_0xc1ab('0xfe')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0xff'));db[_0xc1ab('0x100')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xc1ab('0x101')]=db[_0xc1ab('0x2')]['import'](_0xc1ab('0x102'));db[_0xc1ab('0x103')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db['sequelize'][_0xc1ab('0x16')](_0xc1ab('0x104'));db[_0xc1ab('0x105')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')](_0xc1ab('0x106'));db[_0xc1ab('0x107')]=db[_0xc1ab('0x2')][_0xc1ab('0x16')]('../api/cloudProvider/cloudProvider.model');db[_0xc1ab('0x13')][_0xc1ab('0x108')](db[_0xc1ab('0x109')],{'as':_0xc1ab('0x109'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x10b')});db[_0xc1ab('0x13')][_0xc1ab('0x10c')](db['VoiceRecording'],{'as':_0xc1ab('0x10d'),'foreignKey':_0xc1ab('0x10b')});db[_0xc1ab('0x13')][_0xc1ab('0x10c')](db['UserVoiceQueueRt'],{'as':_0xc1ab('0x10e'),'foreignKey':_0xc1ab('0x10b')});db['User']['hasMany'](db[_0xc1ab('0x18')],{'as':_0xc1ab('0x10f'),'onDelete':_0xc1ab('0x10a'),'hooks':!![]});db[_0xc1ab('0x13')][_0xc1ab('0x10c')](db[_0xc1ab('0x76')],{'as':_0xc1ab('0x110'),'foreignKey':_0xc1ab('0x10b')});db[_0xc1ab('0x13')][_0xc1ab('0x10c')](db[_0xc1ab('0x78')],{'as':_0xc1ab('0x111'),'foreignKey':_0xc1ab('0x10b')});db[_0xc1ab('0x13')][_0xc1ab('0x10c')](db[_0xc1ab('0x79')],{'as':_0xc1ab('0x79'),'foreignKey':_0xc1ab('0x10b')});db[_0xc1ab('0x13')]['hasMany'](db[_0xc1ab('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db[_0xc1ab('0x13')][_0xc1ab('0x10c')](db[_0xc1ab('0x112')],{'as':_0xc1ab('0x113'),'foreignKey':'UserId'});db[_0xc1ab('0x13')][_0xc1ab('0x10c')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xc1ab('0x10b')});db[_0xc1ab('0x13')][_0xc1ab('0x10c')](db[_0xc1ab('0x4c')],{'as':'FaxInteractions','foreignKey':_0xc1ab('0x10b')});db['User'][_0xc1ab('0x10c')](db[_0xc1ab('0x40')],{'as':'MailInteractions','foreignKey':'UserId'});db[_0xc1ab('0x13')][_0xc1ab('0x10c')](db['WhatsappInteraction'],{'as':_0xc1ab('0x114'),'foreignKey':_0xc1ab('0x10b')});db[_0xc1ab('0x13')][_0xc1ab('0x10c')](db[_0xc1ab('0xf8')],{'as':'Notifications','foreignKey':'SenderId'});db[_0xc1ab('0x13')]['hasMany'](db[_0xc1ab('0xfa')],{'as':_0xc1ab('0x115'),'foreignKey':_0xc1ab('0x116')});db[_0xc1ab('0x13')][_0xc1ab('0x117')](db[_0xc1ab('0xf2')],{'as':_0xc1ab('0xf2'),'foreignKey':'userProfileId'});db[_0xc1ab('0x13')]['belongsToMany'](db[_0xc1ab('0x6c')],{'as':_0xc1ab('0x118'),'through':_0xc1ab('0x119')});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db[_0xc1ab('0x11b')],{'as':_0xc1ab('0x11c'),'through':'cm_user_has_contacts'});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db['CmList'],{'as':'Lists','through':_0xc1ab('0x11d')});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db[_0xc1ab('0x11e')],{'through':_0xc1ab('0x11f')});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db[_0xc1ab('0x40')],{'as':_0xc1ab('0x120'),'through':_0xc1ab('0x121')});db['User']['belongsToMany'](db[_0xc1ab('0x112')],{'as':_0xc1ab('0x113'),'through':_0xc1ab('0x122')});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0xc1ab('0x123')});db['User']['belongsToMany'](db[_0xc1ab('0x55')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db[_0xc1ab('0x5d')],{'as':_0xc1ab('0x124'),'through':'user_has_openchannel_interactions'});db[_0xc1ab('0x13')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0xc1ab('0x114'),'through':_0xc1ab('0x125')});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db[_0xc1ab('0x126')],{'as':'VoiceQueues','through':_0xc1ab('0x127'),'required':![]});db['User']['belongsToMany'](db['MailQueue'],{'as':_0xc1ab('0x128'),'through':_0xc1ab('0x129'),'required':![]});db['User'][_0xc1ab('0x11a')](db['ChatQueue'],{'as':_0xc1ab('0x12a'),'through':_0xc1ab('0x2e'),'required':![],'hooks':!![]});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db[_0xc1ab('0x4f')],{'as':_0xc1ab('0x12b'),'through':_0xc1ab('0x31'),'required':![]});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db[_0xc1ab('0x58')],{'as':'SmsQueues','through':_0xc1ab('0x12c'),'required':![]});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db[_0xc1ab('0x60')],{'as':_0xc1ab('0x12d'),'through':_0xc1ab('0x33'),'required':![]});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db[_0xc1ab('0x105')],{'as':_0xc1ab('0x12e'),'through':_0xc1ab('0x12f'),'required':![]});db['User'][_0xc1ab('0x11a')](db[_0xc1ab('0xf0')],{'through':_0xc1ab('0x11d')});db['User']['belongsToMany'](db[_0xc1ab('0x130')],{'as':'VoicePrefixes','through':_0xc1ab('0x131'),'required':![]});db[_0xc1ab('0x13')]['belongsToMany'](db[_0xc1ab('0x61')],{'as':_0xc1ab('0x132'),'through':_0xc1ab('0x133')});db[_0xc1ab('0x13')]['belongsToMany'](db[_0xc1ab('0x134')],{'as':_0xc1ab('0x135'),'through':_0xc1ab('0x136')});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db[_0xc1ab('0x3a')],{'as':_0xc1ab('0x137'),'through':_0xc1ab('0x138')});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db[_0xc1ab('0x5a')],{'as':_0xc1ab('0x139'),'through':_0xc1ab('0x13a')});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db[_0xc1ab('0x52')],{'as':_0xc1ab('0x13b'),'through':_0xc1ab('0x13c')});db[_0xc1ab('0x13')][_0xc1ab('0x11a')](db[_0xc1ab('0xfc')],{'as':_0xc1ab('0x13d'),'through':_0xc1ab('0x13e')});db['User']['belongsToMany'](db['SquareProject'],{'as':_0xc1ab('0x13f'),'through':'user_has_square_projects'});db[_0xc1ab('0x15')][_0xc1ab('0x10c')](db[_0xc1ab('0x18')],{'as':_0xc1ab('0x140'),'onDelete':'cascade','foreignKey':_0xc1ab('0x141')});db[_0xc1ab('0x142')][_0xc1ab('0x10c')](db[_0xc1ab('0x18')],{'onDelete':_0xc1ab('0x10a')});db[_0xc1ab('0x18')][_0xc1ab('0x10c')](db[_0xc1ab('0x18')],{'as':'Applications','onDelete':_0xc1ab('0x10a')});db[_0xc1ab('0x1a')]['belongsToMany'](db[_0xc1ab('0x143')],{'as':_0xc1ab('0x144'),'through':_0xc1ab('0x145')});db[_0xc1ab('0x126')][_0xc1ab('0x10c')](db[_0xc1ab('0x2b')],{'as':'Members','foreignKey':_0xc1ab('0x146')});db[_0xc1ab('0x126')][_0xc1ab('0x10c')](db[_0xc1ab('0x72')],{'as':_0xc1ab('0x147'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xc1ab('0x76')],{'as':_0xc1ab('0x110'),'foreignKey':'VoiceQueueId'});db[_0xc1ab('0x126')][_0xc1ab('0x10c')](db[_0xc1ab('0x78')],{'as':'HopperHistories','foreignKey':_0xc1ab('0x146')});db[_0xc1ab('0x126')][_0xc1ab('0x10c')](db['ReportAgentPreview'],{'as':_0xc1ab('0x79'),'foreignKey':_0xc1ab('0x146')});db['VoiceQueue'][_0xc1ab('0x10c')](db[_0xc1ab('0x74')],{'as':_0xc1ab('0x148'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xc1ab('0x10c')](db[_0xc1ab('0xd0')],{'as':_0xc1ab('0x149'),'foreignKey':'VoiceQueueId'});db[_0xc1ab('0x126')][_0xc1ab('0x117')](db[_0xc1ab('0x14a')],{'as':_0xc1ab('0x14a'),'foreignKey':_0xc1ab('0x14b')});db[_0xc1ab('0x126')][_0xc1ab('0x117')](db[_0xc1ab('0x14a')],{'as':'TrunkBackup','foreignKey':_0xc1ab('0x14c')});db[_0xc1ab('0x126')]['belongsTo'](db[_0xc1ab('0x14d')],{'as':_0xc1ab('0x14d'),'foreignKey':_0xc1ab('0x14e')});db[_0xc1ab('0x126')][_0xc1ab('0x117')](db[_0xc1ab('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0xc1ab('0x14f')});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0xc1ab('0x150'),'through':_0xc1ab('0x151')});db[_0xc1ab('0x126')][_0xc1ab('0x11a')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x152'),'through':_0xc1ab('0x127')});db[_0xc1ab('0x126')][_0xc1ab('0x11a')](db[_0xc1ab('0x11e')],{'as':_0xc1ab('0x153'),'through':_0xc1ab('0x154')});db[_0xc1ab('0x126')][_0xc1ab('0x11a')](db[_0xc1ab('0xf0')],{'as':_0xc1ab('0x155'),'through':_0xc1ab('0x156')});db[_0xc1ab('0x1d')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x13'),'foreignKey':_0xc1ab('0x10b')});db['ScreenRecording'][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x13'),'foreignKey':_0xc1ab('0x10b')});db[_0xc1ab('0x109')]['hasMany'](db['VoiceMailMessage'],{'as':_0xc1ab('0x157'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x158'),'sourceKey':_0xc1ab('0x159')});db[_0xc1ab('0x15a')][_0xc1ab('0x117')](db[_0xc1ab('0x109')],{'foreignKey':_0xc1ab('0x158'),'targetKey':_0xc1ab('0x159')});db[_0xc1ab('0x21')][_0xc1ab('0x10c')](db[_0xc1ab('0x15b')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0xc1ab('0x21')]['hasMany'](db[_0xc1ab('0x25')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x13'),'foreignKey':'UserId'});db['VoiceCallReport']['belongsTo'](db['CmContact'],{'as':_0xc1ab('0x15c'),'foreignKey':_0xc1ab('0x15d')});db['MailServerIn'][_0xc1ab('0x117')](db['MailAccount'],{'as':_0xc1ab('0x3a'),'foreignKey':_0xc1ab('0x15e')});db[_0xc1ab('0x38')][_0xc1ab('0x117')](db[_0xc1ab('0x3a')],{'as':'MailAccount','foreignKey':_0xc1ab('0x15e')});db['MailAccount'][_0xc1ab('0x108')](db[_0xc1ab('0x36')],{'as':_0xc1ab('0x15f'),'onDelete':_0xc1ab('0x10a')});db[_0xc1ab('0x3a')][_0xc1ab('0x108')](db[_0xc1ab('0x38')],{'as':'Smtp','onDelete':_0xc1ab('0x10a')});db[_0xc1ab('0x3a')][_0xc1ab('0x10c')](db[_0xc1ab('0x81')],{'as':_0xc1ab('0x160'),'foreignKey':_0xc1ab('0x15e')});db[_0xc1ab('0x3a')][_0xc1ab('0x10c')](db[_0xc1ab('0x7f')],{'as':_0xc1ab('0x161'),'foreignKey':_0xc1ab('0x15e')});db[_0xc1ab('0x3a')][_0xc1ab('0x10c')](db['MailMessage'],{'as':_0xc1ab('0x157'),'foreignKey':_0xc1ab('0x15e')});db[_0xc1ab('0x3a')][_0xc1ab('0x10c')](db['MailInteraction'],{'as':'Interactions'});db[_0xc1ab('0x3a')][_0xc1ab('0x10c')](db[_0xc1ab('0x43')],{'as':_0xc1ab('0x162')});db[_0xc1ab('0x3a')]['belongsTo'](db['CmList'],{'as':_0xc1ab('0x163'),'foreignKey':'ListId'});db[_0xc1ab('0x3a')][_0xc1ab('0x117')](db[_0xc1ab('0x8f')],{'as':_0xc1ab('0x8f'),'foreignKey':_0xc1ab('0x164')});db[_0xc1ab('0x3a')][_0xc1ab('0x117')](db[_0xc1ab('0x86')],{'as':_0xc1ab('0x165'),'foreignKey':_0xc1ab('0x14f')});db['MailAccount']['belongsToMany'](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x152'),'through':'user_has_mail_accounts'});db['MailQueue'][_0xc1ab('0x11a')](db['User'],{'as':_0xc1ab('0x152'),'through':_0xc1ab('0x129')});db[_0xc1ab('0x3c')][_0xc1ab('0x11a')](db[_0xc1ab('0x11e')],{'through':_0xc1ab('0x166'),'as':'Teams'});db[_0xc1ab('0x40')][_0xc1ab('0x10c')](db['MailMessage'],{'as':'Messages','onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x167')});db[_0xc1ab('0x40')][_0xc1ab('0x117')](db[_0xc1ab('0x3a')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x15e')});db[_0xc1ab('0x40')][_0xc1ab('0x117')](db[_0xc1ab('0x11b')],{'as':_0xc1ab('0x15c'),'foreignKey':_0xc1ab('0x15d')});db[_0xc1ab('0x40')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'as':'Owner','foreignKey':_0xc1ab('0x10b')});db['MailInteraction']['belongsToMany'](db[_0xc1ab('0x8e')],{'through':_0xc1ab('0x169'),'as':_0xc1ab('0x16a')});db[_0xc1ab('0x40')][_0xc1ab('0x11a')](db[_0xc1ab('0x8e')],{'through':_0xc1ab('0x169'),'as':'ThroughTags'});db['MailInteraction'][_0xc1ab('0x11a')](db['User'],{'as':_0xc1ab('0x16b'),'through':_0xc1ab('0x121'),'foreignKey':_0xc1ab('0x167')});db[_0xc1ab('0x16c')][_0xc1ab('0x10c')](db[_0xc1ab('0xe4')],{'as':'Attachments','onDelete':_0xc1ab('0x10a')});db[_0xc1ab('0x16c')][_0xc1ab('0x117')](db['User'],{'as':_0xc1ab('0x13')});db['MailMessage']['belongsTo'](db[_0xc1ab('0x11b')],{'onDelete':_0xc1ab('0x10a'),'as':_0xc1ab('0x15c')});db[_0xc1ab('0x16c')][_0xc1ab('0x117')](db[_0xc1ab('0x40')],{'as':_0xc1ab('0x16d'),'foreignKey':_0xc1ab('0x167')});db[_0xc1ab('0x16c')]['belongsTo'](db[_0xc1ab('0x3a')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x15e')});db[_0xc1ab('0x43')][_0xc1ab('0x117')](db['User'],{'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x43')][_0xc1ab('0x117')](db[_0xc1ab('0x3c')],{'onDelete':'restrict'});db[_0xc1ab('0x43')][_0xc1ab('0x117')](db[_0xc1ab('0x3a')],{'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x43')]['belongsTo'](db['Interval'],{'onDelete':_0xc1ab('0x16e'),'foreignKey':'IntervalId'});db[_0xc1ab('0x43')][_0xc1ab('0x117')](db['Tag'],{'onDelete':_0xc1ab('0x16e'),'foreignKey':_0xc1ab('0x16f')});db[_0xc1ab('0x45')][_0xc1ab('0x117')](db[_0xc1ab('0x3a')],{});db[_0xc1ab('0x45')][_0xc1ab('0x117')](db['CmList'],{'as':_0xc1ab('0x163'),'foreignKey':_0xc1ab('0x170')});db[_0xc1ab('0x45')][_0xc1ab('0x117')](db[_0xc1ab('0x11b')],{'as':_0xc1ab('0x15c'),'foreignKey':'ContactId'});db[_0xc1ab('0x45')][_0xc1ab('0x117')](db['MailInteraction'],{});db[_0xc1ab('0x45')]['belongsTo'](db[_0xc1ab('0x16c')],{});db[_0xc1ab('0x45')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{});db['MailQueueReport'][_0xc1ab('0x117')](db['MailQueue'],{});db[_0xc1ab('0x47')][_0xc1ab('0x10c')](db[_0xc1ab('0x48')],{'as':_0xc1ab('0x171'),'onDelete':_0xc1ab('0x10a')});db['FaxAccount']['hasMany'](db[_0xc1ab('0x81')],{'as':'Dispositions','foreignKey':_0xc1ab('0x172')});db[_0xc1ab('0x134')][_0xc1ab('0x10c')](db[_0xc1ab('0x7f')],{'as':_0xc1ab('0x161'),'foreignKey':'FaxAccountId'});db[_0xc1ab('0x134')][_0xc1ab('0x10c')](db['FaxInteraction'],{'as':_0xc1ab('0x173')});db['FaxAccount']['hasMany'](db[_0xc1ab('0x4a')],{'as':_0xc1ab('0x162')});db[_0xc1ab('0x134')][_0xc1ab('0x10c')](db[_0xc1ab('0x18')],{'as':_0xc1ab('0x174'),'onDelete':_0xc1ab('0x10a')});db[_0xc1ab('0x134')][_0xc1ab('0x10c')](db[_0xc1ab('0x4d')],{'as':_0xc1ab('0x157')});db[_0xc1ab('0x134')][_0xc1ab('0x117')](db[_0xc1ab('0x14a')],{'as':'Trunk'});db[_0xc1ab('0x134')]['belongsTo'](db[_0xc1ab('0xf0')],{'as':_0xc1ab('0x163'),'foreignKey':'ListId'});db[_0xc1ab('0x134')][_0xc1ab('0x117')](db[_0xc1ab('0x86')],{'as':_0xc1ab('0x165'),'foreignKey':_0xc1ab('0x14f')});db[_0xc1ab('0x134')]['belongsToMany'](db['User'],{'as':_0xc1ab('0x152'),'through':_0xc1ab('0x136')});db['FaxApplication'][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x4a')][_0xc1ab('0x117')](db[_0xc1ab('0x4f')],{'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x4a')][_0xc1ab('0x117')](db['FaxAccount'],{'onDelete':'restrict'});db[_0xc1ab('0x4a')]['belongsTo'](db['Tag'],{'onDelete':_0xc1ab('0x16e'),'foreignKey':_0xc1ab('0x16f')});db[_0xc1ab('0x4c')][_0xc1ab('0x10c')](db[_0xc1ab('0x4d')],{'as':_0xc1ab('0x157'),'onDelete':_0xc1ab('0x10a'),'foreignKey':'FaxInteractionId'});db[_0xc1ab('0x4c')]['belongsTo'](db[_0xc1ab('0x134')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x172')});db[_0xc1ab('0x4c')]['belongsTo'](db['CmContact'],{'as':_0xc1ab('0x15c'),'foreignKey':_0xc1ab('0x15d')});db[_0xc1ab('0x4c')][_0xc1ab('0x117')](db['User'],{'as':_0xc1ab('0x175'),'foreignKey':'UserId'});db[_0xc1ab('0x4c')]['belongsToMany'](db[_0xc1ab('0x8e')],{'through':_0xc1ab('0x176'),'as':_0xc1ab('0x16a')});db[_0xc1ab('0x4c')][_0xc1ab('0x11a')](db[_0xc1ab('0x8e')],{'through':_0xc1ab('0x176'),'as':'ThroughTags'});db[_0xc1ab('0x4c')][_0xc1ab('0x11a')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x16b'),'through':_0xc1ab('0x123'),'foreignKey':_0xc1ab('0x177')});db[_0xc1ab('0x4d')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'onDelete':_0xc1ab('0x10a'),'as':'User'});db[_0xc1ab('0x4d')][_0xc1ab('0x117')](db[_0xc1ab('0x4c')],{'as':_0xc1ab('0x16d'),'foreignKey':'FaxInteractionId'});db[_0xc1ab('0x4d')]['belongsTo'](db[_0xc1ab('0x11b')],{'onDelete':_0xc1ab('0x10a'),'as':_0xc1ab('0x15c')});db[_0xc1ab('0x4d')]['belongsTo'](db[_0xc1ab('0xe4')],{'as':_0xc1ab('0xe4'),'foreignKey':_0xc1ab('0x178')});db[_0xc1ab('0x4d')]['belongsTo'](db[_0xc1ab('0x134')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x172')});db['FaxQueue']['belongsToMany'](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x152'),'through':_0xc1ab('0x31')});db['FaxQueue'][_0xc1ab('0x11a')](db[_0xc1ab('0x11e')],{'through':_0xc1ab('0x179'),'as':'Teams'});db[_0xc1ab('0x17a')][_0xc1ab('0x117')](db['FaxAccount'],{});db['FaxQueueReport'][_0xc1ab('0x117')](db['CmList'],{'as':_0xc1ab('0x163'),'foreignKey':'ListId'});db[_0xc1ab('0x17a')][_0xc1ab('0x117')](db[_0xc1ab('0x11b')],{'as':'Contact','foreignKey':'ContactId'});db['FaxQueueReport'][_0xc1ab('0x117')](db[_0xc1ab('0x4c')],{});db[_0xc1ab('0x17a')][_0xc1ab('0x117')](db[_0xc1ab('0x4d')],{});db['FaxQueueReport'][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{});db[_0xc1ab('0x17a')]['belongsTo'](db[_0xc1ab('0x4f')],{});db[_0xc1ab('0x52')][_0xc1ab('0x10c')](db[_0xc1ab('0x81')],{'as':_0xc1ab('0x160'),'foreignKey':'SmsAccountId'});db[_0xc1ab('0x52')][_0xc1ab('0x10c')](db[_0xc1ab('0x7f')],{'as':_0xc1ab('0x161'),'foreignKey':_0xc1ab('0x17b')});db['SmsAccount'][_0xc1ab('0x10c')](db['SmsMessage'],{'as':_0xc1ab('0x157'),'foreignKey':'SmsAccountId'});db[_0xc1ab('0x52')][_0xc1ab('0x10c')](db['SmsInteraction'],{'as':'Interactions'});db[_0xc1ab('0x52')][_0xc1ab('0x10c')](db['SmsApplication'],{'as':_0xc1ab('0x162')});db[_0xc1ab('0x52')][_0xc1ab('0x117')](db[_0xc1ab('0xf0')],{'as':_0xc1ab('0x163'),'foreignKey':_0xc1ab('0x170')});db[_0xc1ab('0x52')][_0xc1ab('0x117')](db[_0xc1ab('0x86')],{'as':_0xc1ab('0x165'),'foreignKey':_0xc1ab('0x14f')});db[_0xc1ab('0x52')][_0xc1ab('0x11a')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x152'),'through':_0xc1ab('0x13c')});db[_0xc1ab('0x54')][_0xc1ab('0x117')](db['User'],{'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x54')][_0xc1ab('0x117')](db[_0xc1ab('0x58')],{'onDelete':_0xc1ab('0x16e')});db['SmsApplication'][_0xc1ab('0x117')](db['SmsAccount'],{'onDelete':'restrict'});db[_0xc1ab('0x54')][_0xc1ab('0x117')](db[_0xc1ab('0x14d')],{'onDelete':_0xc1ab('0x16e'),'foreignKey':_0xc1ab('0x14e')});db[_0xc1ab('0x54')][_0xc1ab('0x117')](db[_0xc1ab('0x8e')],{'onDelete':_0xc1ab('0x16e'),'foreignKey':'TagId'});db[_0xc1ab('0x55')][_0xc1ab('0x10c')](db['SmsMessage'],{'as':_0xc1ab('0x157'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x17c')});db[_0xc1ab('0x55')]['belongsTo'](db[_0xc1ab('0x52')],{'as':_0xc1ab('0x168'),'foreignKey':'SmsAccountId'});db[_0xc1ab('0x55')][_0xc1ab('0x117')](db[_0xc1ab('0x11b')],{'as':_0xc1ab('0x15c'),'foreignKey':_0xc1ab('0x15d')});db[_0xc1ab('0x55')]['belongsTo'](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x175'),'foreignKey':'UserId'});db[_0xc1ab('0x55')][_0xc1ab('0x11a')](db[_0xc1ab('0x8e')],{'through':'sms_interaction_has_tags','as':_0xc1ab('0x16a')});db[_0xc1ab('0x55')]['belongsToMany'](db[_0xc1ab('0x8e')],{'through':_0xc1ab('0x17d'),'as':_0xc1ab('0x17e')});db['SmsInteraction'][_0xc1ab('0x11a')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x16b'),'through':_0xc1ab('0x17f'),'foreignKey':'SmsInteractionId'});db[_0xc1ab('0x57')]['belongsTo'](db['User'],{'as':_0xc1ab('0x13')});db[_0xc1ab('0x57')][_0xc1ab('0x117')](db[_0xc1ab('0x11b')],{'onDelete':'cascade','as':_0xc1ab('0x15c')});db[_0xc1ab('0x57')][_0xc1ab('0x117')](db['SmsInteraction'],{'onDelete':_0xc1ab('0x10a'),'as':_0xc1ab('0x16d'),'foreignKey':_0xc1ab('0x17c')});db[_0xc1ab('0x57')][_0xc1ab('0x117')](db[_0xc1ab('0x52')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x17b')});db[_0xc1ab('0x58')][_0xc1ab('0x11a')](db['User'],{'as':_0xc1ab('0x152'),'through':_0xc1ab('0x12c'),'foreignKey':'SmsQueueId'});db[_0xc1ab('0x58')][_0xc1ab('0x11a')](db[_0xc1ab('0x11e')],{'through':'team_has_sms_queues','as':'Teams'});db['OpenchannelAccount']['hasMany'](db[_0xc1ab('0x81')],{'as':_0xc1ab('0x160'),'foreignKey':_0xc1ab('0x180')});db[_0xc1ab('0x5a')][_0xc1ab('0x10c')](db[_0xc1ab('0x7f')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xc1ab('0x10c')](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':_0xc1ab('0x180')});db[_0xc1ab('0x5a')][_0xc1ab('0x10c')](db[_0xc1ab('0x5e')],{'as':_0xc1ab('0x157'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xc1ab('0x10c')](db[_0xc1ab('0x5c')],{'as':_0xc1ab('0x162'),'foreignKey':_0xc1ab('0x180')});db[_0xc1ab('0x5a')][_0xc1ab('0x117')](db['CmList'],{'as':_0xc1ab('0x163'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0xc1ab('0x117')](db['Pause'],{'as':_0xc1ab('0x165'),'foreignKey':_0xc1ab('0x14f')});db[_0xc1ab('0x5a')][_0xc1ab('0x11a')](db[_0xc1ab('0x13')],{'as':'Agents','through':_0xc1ab('0x13a')});db['OpenchannelApplication'][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x5c')][_0xc1ab('0x117')](db[_0xc1ab('0x60')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0xc1ab('0x5c')][_0xc1ab('0x117')](db['OpenchannelAccount'],{'onDelete':_0xc1ab('0x16e'),'foreignKey':_0xc1ab('0x180')});db['OpenchannelApplication'][_0xc1ab('0x117')](db['Interval'],{'onDelete':_0xc1ab('0x16e'),'foreignKey':_0xc1ab('0x14e')});db['OpenchannelApplication'][_0xc1ab('0x117')](db[_0xc1ab('0x8e')],{'onDelete':_0xc1ab('0x16e'),'foreignKey':_0xc1ab('0x16f')});db[_0xc1ab('0x5d')][_0xc1ab('0x10c')](db[_0xc1ab('0x5e')],{'as':_0xc1ab('0x157'),'onDelete':'cascade','foreignKey':_0xc1ab('0x181')});db['OpenchannelInteraction'][_0xc1ab('0x117')](db[_0xc1ab('0x5a')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x180')});db[_0xc1ab('0x5d')][_0xc1ab('0x117')](db[_0xc1ab('0x11b')],{'as':_0xc1ab('0x15c'),'foreignKey':_0xc1ab('0x15d')});db[_0xc1ab('0x5d')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x175'),'foreignKey':'UserId'});db[_0xc1ab('0x5d')]['belongsToMany'](db['Tag'],{'through':_0xc1ab('0x182'),'as':_0xc1ab('0x16a')});db[_0xc1ab('0x5d')][_0xc1ab('0x11a')](db[_0xc1ab('0x8e')],{'through':'openchannel_interaction_has_tags','as':_0xc1ab('0x17e')});db['OpenchannelInteraction'][_0xc1ab('0x11a')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x16b'),'through':'user_has_openchannel_interactions','foreignKey':_0xc1ab('0x181')});db[_0xc1ab('0x5e')]['belongsTo'](db[_0xc1ab('0x13')],{'onDelete':_0xc1ab('0x10a'),'as':'User'});db['OpenchannelMessage'][_0xc1ab('0x117')](db[_0xc1ab('0x11b')],{'onDelete':_0xc1ab('0x10a'),'as':_0xc1ab('0x15c')});db[_0xc1ab('0x5e')][_0xc1ab('0x117')](db['OpenchannelInteraction'],{'onDelete':_0xc1ab('0x10a'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0xc1ab('0x5e')][_0xc1ab('0x117')](db[_0xc1ab('0xe4')],{'as':_0xc1ab('0xe4'),'foreignKey':_0xc1ab('0x178')});db[_0xc1ab('0x5e')]['belongsTo'](db[_0xc1ab('0x5a')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x180')});db[_0xc1ab('0x60')]['belongsToMany'](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x152'),'through':_0xc1ab('0x33'),'foreignKey':_0xc1ab('0x183')});db[_0xc1ab('0x60')][_0xc1ab('0x11a')](db[_0xc1ab('0x11e')],{'through':_0xc1ab('0x184'),'as':'Teams'});db['ChatWebsite']['hasMany'](db['Disposition'],{'as':_0xc1ab('0x160'),'foreignKey':_0xc1ab('0x185')});db['ChatWebsite'][_0xc1ab('0x10c')](db[_0xc1ab('0x7f')],{'as':_0xc1ab('0x161'),'foreignKey':_0xc1ab('0x185')});db[_0xc1ab('0x61')][_0xc1ab('0x10c')](db[_0xc1ab('0x6e')],{'as':'ProactiveActions'});db[_0xc1ab('0x61')][_0xc1ab('0x10c')](db[_0xc1ab('0x112')],{'as':_0xc1ab('0x173')});db[_0xc1ab('0x61')]['hasMany'](db['ChatApplication'],{'as':_0xc1ab('0x162')});db[_0xc1ab('0x61')]['hasMany'](db['ChatMessage'],{'as':'Messages'});db[_0xc1ab('0x61')][_0xc1ab('0x117')](db[_0xc1ab('0xf0')],{'as':_0xc1ab('0x163'),'foreignKey':_0xc1ab('0x170')});db[_0xc1ab('0x61')]['belongsTo'](db[_0xc1ab('0x14d')],{'as':_0xc1ab('0x14d'),'foreignKey':_0xc1ab('0x14e')});db[_0xc1ab('0x61')][_0xc1ab('0x117')](db['Pause'],{'as':_0xc1ab('0x165'),'foreignKey':_0xc1ab('0x14f')});db[_0xc1ab('0x61')][_0xc1ab('0x11a')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x152'),'through':_0xc1ab('0x133')});db[_0xc1ab('0x63')][_0xc1ab('0x117')](db['OpenchannelAccount'],{});db[_0xc1ab('0x63')][_0xc1ab('0x117')](db[_0xc1ab('0xf0')],{'as':_0xc1ab('0x163'),'foreignKey':_0xc1ab('0x170')});db[_0xc1ab('0x63')][_0xc1ab('0x117')](db[_0xc1ab('0x11b')],{'as':'Contact','foreignKey':_0xc1ab('0x15d')});db[_0xc1ab('0x63')][_0xc1ab('0x117')](db[_0xc1ab('0x5d')],{});db[_0xc1ab('0x63')]['belongsTo'](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{});db[_0xc1ab('0x63')]['belongsTo'](db[_0xc1ab('0x60')],{});db['ChatApplication'][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x186'),'foreignKey':_0xc1ab('0x10b'),'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x65')][_0xc1ab('0x117')](db['ChatQueue'],{'as':_0xc1ab('0x187'),'foreignKey':_0xc1ab('0x188'),'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x65')][_0xc1ab('0x117')](db['ChatWebsite'],{'as':_0xc1ab('0x189'),'foreignKey':_0xc1ab('0x185'),'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x65')][_0xc1ab('0x117')](db['Tag'],{'onDelete':_0xc1ab('0x16e'),'foreignKey':_0xc1ab('0x16f')});db[_0xc1ab('0x112')]['hasMany'](db[_0xc1ab('0x67')],{'as':_0xc1ab('0x157'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x18a')});db[_0xc1ab('0x112')]['belongsTo'](db[_0xc1ab('0x61')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x185')});db[_0xc1ab('0x112')]['belongsTo'](db[_0xc1ab('0x11b')],{'as':_0xc1ab('0x15c'),'foreignKey':_0xc1ab('0x15d')});db[_0xc1ab('0x112')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x175'),'foreignKey':_0xc1ab('0x10b')});db[_0xc1ab('0x112')][_0xc1ab('0x11a')](db['Tag'],{'through':_0xc1ab('0x18b'),'as':_0xc1ab('0x16a')});db[_0xc1ab('0x112')][_0xc1ab('0x11a')](db[_0xc1ab('0x8e')],{'through':_0xc1ab('0x18b'),'as':_0xc1ab('0x17e')});db[_0xc1ab('0x112')][_0xc1ab('0x11a')](db['User'],{'as':_0xc1ab('0x16b'),'through':_0xc1ab('0x122'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xc1ab('0x117')](db['User'],{'onDelete':_0xc1ab('0x10a'),'as':_0xc1ab('0x13')});db[_0xc1ab('0x67')]['belongsTo'](db['CmContact'],{'onDelete':_0xc1ab('0x10a'),'as':_0xc1ab('0x15c'),'foreignKey':_0xc1ab('0x15d')});db['ChatMessage'][_0xc1ab('0x117')](db[_0xc1ab('0x112')],{'onDelete':_0xc1ab('0x10a'),'as':_0xc1ab('0x16d'),'foreignKey':_0xc1ab('0x18a')});db[_0xc1ab('0x67')][_0xc1ab('0x117')](db['Attachment'],{'as':_0xc1ab('0xe4'),'foreignKey':'AttachmentId'});db[_0xc1ab('0x67')]['belongsTo'](db[_0xc1ab('0x61')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x185')});db[_0xc1ab('0x69')][_0xc1ab('0x117')](db[_0xc1ab('0x11b')],{'onDelete':'cascade','as':_0xc1ab('0x15c'),'foreignKey':_0xc1ab('0x15d')});db[_0xc1ab('0x69')][_0xc1ab('0x117')](db[_0xc1ab('0x61')],{'as':_0xc1ab('0x168'),'foreignKey':'ChatWebsiteId'});db[_0xc1ab('0x6b')]['belongsToMany'](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x152'),'through':_0xc1ab('0x2e'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0xc1ab('0x11e')],{'through':'team_has_chat_queues','as':'Teams'});db[_0xc1ab('0x6c')]['hasMany'](db['ChatInternalMessage'],{'as':_0xc1ab('0x157'),'foreignKey':'ChatGroupId','onDelete':_0xc1ab('0x10a')});db[_0xc1ab('0x6c')]['belongsToMany'](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x18c'),'through':'chat_group_has_users'});db['ChatProactiveAction'][_0xc1ab('0x117')](db[_0xc1ab('0x61')],{'as':_0xc1ab('0x189'),'foreignKey':_0xc1ab('0x185')});db[_0xc1ab('0x6f')][_0xc1ab('0x10c')](db['CmContact'],{'as':_0xc1ab('0x11c'),'foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmHopper'],{'as':_0xc1ab('0x147'),'foreignKey':'ContactId'});db[_0xc1ab('0x11b')]['hasMany'](db[_0xc1ab('0x76')],{'as':_0xc1ab('0x110'),'foreignKey':_0xc1ab('0x15d')});db[_0xc1ab('0x11b')][_0xc1ab('0x10c')](db[_0xc1ab('0x78')],{'as':_0xc1ab('0x18d'),'foreignKey':_0xc1ab('0x15d')});db[_0xc1ab('0x11b')][_0xc1ab('0x10c')](db[_0xc1ab('0x79')],{'as':'ReportAgentPreview','foreignKey':_0xc1ab('0x15d')});db[_0xc1ab('0x11b')]['hasMany'](db[_0xc1ab('0xd0')],{'as':'JscriptySessions','foreignKey':_0xc1ab('0x15d')});db[_0xc1ab('0x11b')]['hasMany'](db[_0xc1ab('0x5d')],{'as':_0xc1ab('0x124'),'foreignKey':_0xc1ab('0x15d'),'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x11b')][_0xc1ab('0x10c')](db[_0xc1ab('0x112')],{'as':'ChatInteractions','foreignKey':_0xc1ab('0x15d'),'onDelete':'restrict'});db[_0xc1ab('0x11b')]['hasMany'](db['SmsInteraction'],{'as':_0xc1ab('0x18e'),'foreignKey':_0xc1ab('0x15d'),'onDelete':_0xc1ab('0x16e')});db['CmContact'][_0xc1ab('0x10c')](db[_0xc1ab('0x4c')],{'as':_0xc1ab('0x18f'),'foreignKey':_0xc1ab('0x15d'),'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x11b')][_0xc1ab('0x10c')](db[_0xc1ab('0x40')],{'as':_0xc1ab('0x120'),'foreignKey':_0xc1ab('0x15d'),'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x11b')][_0xc1ab('0x117')](db[_0xc1ab('0x6f')],{'as':_0xc1ab('0x190'),'foreignKey':_0xc1ab('0x191')});db[_0xc1ab('0x11b')][_0xc1ab('0x117')](db[_0xc1ab('0xf0')],{'as':'List','foreignKey':_0xc1ab('0x170'),'onDelete':_0xc1ab('0x10a')});db[_0xc1ab('0x11b')][_0xc1ab('0x11a')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x16b'),'through':_0xc1ab('0x192')});db[_0xc1ab('0x11b')]['belongsToMany'](db[_0xc1ab('0x8e')],{'as':_0xc1ab('0x16a'),'through':_0xc1ab('0x193')});db[_0xc1ab('0x11b')][_0xc1ab('0x11a')](db['Tag'],{'through':_0xc1ab('0x193'),'as':_0xc1ab('0x17e')});db['CmHopper'][_0xc1ab('0x117')](db[_0xc1ab('0x11b')],{'as':_0xc1ab('0x15c'),'foreignKey':_0xc1ab('0x15d'),'onDelete':_0xc1ab('0x10a')});db[_0xc1ab('0x72')][_0xc1ab('0x117')](db[_0xc1ab('0xf0')],{'as':_0xc1ab('0x163'),'foreignKey':'ListId','onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x186'),'foreignKey':_0xc1ab('0x10b')});db['CmHopper'][_0xc1ab('0x117')](db['VoiceQueue'],{'as':_0xc1ab('0x187'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xc1ab('0x72')]['belongsTo'](db[_0xc1ab('0xe1')],{'as':_0xc1ab('0xe1'),'foreignKey':_0xc1ab('0x194'),'onDelete':_0xc1ab('0x10a')});db['CmHopper']['belongsTo'](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x175'),'foreignKey':_0xc1ab('0x195')});db[_0xc1ab('0x74')][_0xc1ab('0x117')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0xc1ab('0x74')][_0xc1ab('0x117')](db[_0xc1ab('0xf0')],{'as':_0xc1ab('0x163'),'foreignKey':_0xc1ab('0x170'),'onDelete':'cascade'});db[_0xc1ab('0x74')][_0xc1ab('0x117')](db['VoiceQueue'],{'as':_0xc1ab('0x187'),'foreignKey':_0xc1ab('0x146'),'onDelete':_0xc1ab('0x10a')});db[_0xc1ab('0x74')]['belongsTo'](db[_0xc1ab('0xe1')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xc1ab('0x10a')});db['Automation'][_0xc1ab('0x10c')](db['Condition'],{'as':{'plural':_0xc1ab('0x196'),'singular':'OneAll'},'foreignKey':_0xc1ab('0x197'),'onDelete':_0xc1ab('0x10a'),'hooks':!![]});db[_0xc1ab('0x198')][_0xc1ab('0x10c')](db[_0xc1ab('0x83')],{'as':{'plural':_0xc1ab('0x199'),'singular':_0xc1ab('0x19a')},'foreignKey':_0xc1ab('0x19b'),'onDelete':_0xc1ab('0x10a'),'hooks':!![]});db[_0xc1ab('0x198')]['hasMany'](db[_0xc1ab('0x19c')],{'as':'Actions','foreignKey':_0xc1ab('0x19d'),'onDelete':'cascade','hooks':!![]});db['Disposition']['hasMany'](db['Disposition'],{'as':_0xc1ab('0x160'),'foreignKey':'ParentId','onDelete':_0xc1ab('0x10a')});db[_0xc1ab('0x14d')][_0xc1ab('0x10c')](db[_0xc1ab('0x14d')],{'as':_0xc1ab('0x19e'),'foreignKey':_0xc1ab('0x14e'),'onDelete':_0xc1ab('0x10a'),'hooks':!![],'required':![]});db[_0xc1ab('0x14d')][_0xc1ab('0x10c')](db[_0xc1ab('0x18')],{'as':_0xc1ab('0x10f'),'foreignKey':_0xc1ab('0x14e'),'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x14d')]['hasMany'](db[_0xc1ab('0x43')],{'as':_0xc1ab('0x19f'),'foreignKey':_0xc1ab('0x14e')});db[_0xc1ab('0x14d')][_0xc1ab('0x10c')](db[_0xc1ab('0x65')],{'as':_0xc1ab('0x1a0'),'foreignKey':_0xc1ab('0x14e')});db['Interval']['hasMany'](db[_0xc1ab('0x4a')],{'as':_0xc1ab('0x1a1'),'foreignKey':'IntervalId'});db['Interval'][_0xc1ab('0x10c')](db[_0xc1ab('0x54')],{'as':_0xc1ab('0x1a2'),'foreignKey':_0xc1ab('0x14e')});db[_0xc1ab('0x8b')][_0xc1ab('0x117')](db[_0xc1ab('0x3a')],{});db['Schedule'][_0xc1ab('0x117')](db[_0xc1ab('0x96')],{'foreignKey':_0xc1ab('0x1a3')});db['Schedule'][_0xc1ab('0x117')](db[_0xc1ab('0x95')],{'foreignKey':_0xc1ab('0x1a4')});db['Sound'][_0xc1ab('0x11a')](db[_0xc1ab('0x1a')],{'as':_0xc1ab('0x1a5'),'through':_0xc1ab('0x145'),'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0x8e')][_0xc1ab('0x11a')](db[_0xc1ab('0x11b')],{'through':_0xc1ab('0x193')});db[_0xc1ab('0x8e')][_0xc1ab('0x11a')](db[_0xc1ab('0x112')],{'through':_0xc1ab('0x18b')});db[_0xc1ab('0x8e')][_0xc1ab('0x11a')](db[_0xc1ab('0x40')],{'through':_0xc1ab('0x169')});db[_0xc1ab('0x8e')]['belongsToMany'](db[_0xc1ab('0x55')],{'through':_0xc1ab('0x17d')});db[_0xc1ab('0x8e')][_0xc1ab('0x11a')](db[_0xc1ab('0x4c')],{'through':_0xc1ab('0x176')});db['Tag'][_0xc1ab('0x11a')](db[_0xc1ab('0x5d')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0xc1ab('0x11a')](db[_0xc1ab('0x100')],{'through':_0xc1ab('0x1a6')});db[_0xc1ab('0x1a7')][_0xc1ab('0x10c')](db[_0xc1ab('0x83')],{'as':{'plural':_0xc1ab('0x1a8'),'singular':'AllCondition'},'foreignKey':_0xc1ab('0x1a9'),'onDelete':_0xc1ab('0x10a'),'hooks':!![]});db[_0xc1ab('0x1a7')][_0xc1ab('0x10c')](db[_0xc1ab('0x83')],{'as':{'plural':_0xc1ab('0x1aa'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db['Trigger'][_0xc1ab('0x10c')](db['Action'],{'as':'Actions','foreignKey':_0xc1ab('0x1ab'),'onDelete':'cascade','hooks':!![]});db[_0xc1ab('0x95')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xc1ab('0x1ac'),'onDelete':'cascade','foreignKey':_0xc1ab('0x1a4'),'hooks':!![]});db[_0xc1ab('0x96')][_0xc1ab('0x10c')](db[_0xc1ab('0x9b')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc1ab('0x1a3')});db['AnalyticMetric'][_0xc1ab('0x10c')](db[_0xc1ab('0x9b')],{'as':_0xc1ab('0x1ac'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1ad')});db['AnalyticFieldReport']['belongsTo'](db[_0xc1ab('0x99')],{'foreignKey':_0xc1ab('0x1ad')});db[_0xc1ab('0x9d')]['hasMany'](db[_0xc1ab('0x9f')],{'as':_0xc1ab('0x1ae'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1af')});db['SalesforceConfiguration']['hasMany'](db[_0xc1ab('0x1b0')],{'as':_0xc1ab('0x1b1'),'onDelete':_0xc1ab('0x10a'),'foreignKey':'SubjectId'});db[_0xc1ab('0x9f')][_0xc1ab('0x10c')](db['SalesforceField'],{'as':_0xc1ab('0x1b2'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1b3')});db['SalesforceConfiguration']['hasMany'](db[_0xc1ab('0x1b0')],{'as':'Fields','onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1b4')});db[_0xc1ab('0x9f')][_0xc1ab('0x117')](db[_0xc1ab('0x9d')],{'as':_0xc1ab('0x168'),'foreignKey':'AccountId'});db[_0xc1ab('0x1b0')][_0xc1ab('0x10c')](db[_0xc1ab('0x1b0')],{'as':_0xc1ab('0x1b5'),'foreignKey':_0xc1ab('0x1b6')});db['SalesforceField'][_0xc1ab('0x10c')](db[_0xc1ab('0x1b0')],{'as':_0xc1ab('0x1b7'),'foreignKey':_0xc1ab('0x1b3')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0xc1ab('0x1b8'),'foreignKey':_0xc1ab('0x1b4')});db[_0xc1ab('0x1b0')][_0xc1ab('0x117')](db['Variable'],{'as':_0xc1ab('0x1b9'),'foreignKey':_0xc1ab('0x1ba')});db['SugarcrmAccount'][_0xc1ab('0x10c')](db[_0xc1ab('0xa4')],{'as':_0xc1ab('0x1ae'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1af')});db[_0xc1ab('0xa4')][_0xc1ab('0x10c')](db[_0xc1ab('0xa5')],{'as':_0xc1ab('0x1b1'),'onDelete':_0xc1ab('0x10a'),'foreignKey':'SubjectId'});db[_0xc1ab('0xa4')][_0xc1ab('0x10c')](db[_0xc1ab('0xa5')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xc1ab('0xa4')][_0xc1ab('0x10c')](db[_0xc1ab('0xa5')],{'as':_0xc1ab('0x1ac'),'onDelete':'cascade','foreignKey':_0xc1ab('0x1b4')});db['SugarcrmConfiguration']['belongsTo'](db[_0xc1ab('0xa2')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x1af')});db[_0xc1ab('0xa5')]['hasMany'](db[_0xc1ab('0xa5')],{'as':_0xc1ab('0x1b5'),'foreignKey':'SubjectId'});db[_0xc1ab('0xa5')]['hasMany'](db[_0xc1ab('0xa5')],{'as':_0xc1ab('0x1b7'),'foreignKey':_0xc1ab('0x1b3')});db['SugarcrmField'][_0xc1ab('0x10c')](db['SugarcrmField'],{'as':'Field','foreignKey':_0xc1ab('0x1b4')});db[_0xc1ab('0xa5')][_0xc1ab('0x117')](db[_0xc1ab('0x1b9')],{'as':_0xc1ab('0x1b9'),'foreignKey':_0xc1ab('0x1ba')});db[_0xc1ab('0xa7')]['hasMany'](db[_0xc1ab('0xa9')],{'as':_0xc1ab('0x1ae'),'onDelete':_0xc1ab('0x10a'),'foreignKey':'AccountId'});db[_0xc1ab('0xa9')]['hasMany'](db[_0xc1ab('0xaa')],{'as':'Subjects','onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1b6')});db[_0xc1ab('0xa9')][_0xc1ab('0x10c')](db['DeskField'],{'as':_0xc1ab('0x1b2'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xc1ab('0xa9')][_0xc1ab('0x10c')](db[_0xc1ab('0xaa')],{'as':_0xc1ab('0x1ac'),'onDelete':_0xc1ab('0x10a'),'foreignKey':'FieldId'});db[_0xc1ab('0xa9')][_0xc1ab('0x117')](db[_0xc1ab('0xa7')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x1af')});db[_0xc1ab('0xa9')][_0xc1ab('0x11a')](db[_0xc1ab('0x8e')],{'through':_0xc1ab('0x1bb')});db['DeskField'][_0xc1ab('0x10c')](db[_0xc1ab('0xaa')],{'as':_0xc1ab('0x1b5'),'foreignKey':_0xc1ab('0x1b6')});db['DeskField'][_0xc1ab('0x10c')](db[_0xc1ab('0xaa')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xc1ab('0xaa')][_0xc1ab('0x10c')](db[_0xc1ab('0xaa')],{'as':_0xc1ab('0x1b8'),'foreignKey':_0xc1ab('0x1b4')});db[_0xc1ab('0xaa')]['belongsTo'](db['Variable'],{'as':_0xc1ab('0x1b9'),'foreignKey':'VariableId'});db[_0xc1ab('0x1bc')][_0xc1ab('0x10c')](db[_0xc1ab('0x1bd')],{'as':_0xc1ab('0x1ae'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1af')});db[_0xc1ab('0x1bd')][_0xc1ab('0x10c')](db[_0xc1ab('0x1be')],{'as':_0xc1ab('0x1b1'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1b6')});db[_0xc1ab('0x1bd')]['hasMany'](db['ZohoField'],{'as':'Descriptions','onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1b3')});db['ZohoConfiguration'][_0xc1ab('0x10c')](db[_0xc1ab('0x1be')],{'as':_0xc1ab('0x1ac'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xc1ab('0x1bd')]['belongsTo'](db[_0xc1ab('0x1bc')],{'as':'Account','foreignKey':_0xc1ab('0x1af')});db[_0xc1ab('0x1be')][_0xc1ab('0x10c')](db['ZohoField'],{'as':'Subject','foreignKey':_0xc1ab('0x1b6')});db['ZohoField'][_0xc1ab('0x10c')](db[_0xc1ab('0x1be')],{'as':_0xc1ab('0x1b7'),'foreignKey':_0xc1ab('0x1b3')});db['ZohoField'][_0xc1ab('0x10c')](db[_0xc1ab('0x1be')],{'as':'Field','foreignKey':_0xc1ab('0x1b4')});db['ZohoField'][_0xc1ab('0x117')](db[_0xc1ab('0x1b9')],{'as':'Variable','foreignKey':_0xc1ab('0x1ba')});db['ZendeskAccount'][_0xc1ab('0x10c')](db[_0xc1ab('0xb0')],{'as':_0xc1ab('0x1ae'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1af')});db[_0xc1ab('0xb0')][_0xc1ab('0x10c')](db[_0xc1ab('0xb1')],{'as':_0xc1ab('0x1b1'),'foreignKey':_0xc1ab('0x1b6')});db['ZendeskConfiguration']['hasMany'](db[_0xc1ab('0xb1')],{'as':_0xc1ab('0x1b2'),'foreignKey':'DescriptionId'});db[_0xc1ab('0xb0')]['hasMany'](db[_0xc1ab('0xb1')],{'as':_0xc1ab('0x1ac'),'foreignKey':_0xc1ab('0x1b4')});db[_0xc1ab('0xb0')][_0xc1ab('0x117')](db['ZendeskAccount'],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x1af')});db[_0xc1ab('0xb0')][_0xc1ab('0x11a')](db[_0xc1ab('0x8e')],{'through':'int_zendesk_configuration_has_tags'});db[_0xc1ab('0xb1')][_0xc1ab('0x10c')](db[_0xc1ab('0xb1')],{'as':'Subject','foreignKey':_0xc1ab('0x1b6')});db[_0xc1ab('0xb1')][_0xc1ab('0x10c')](db[_0xc1ab('0xb1')],{'as':_0xc1ab('0x1b7'),'foreignKey':'DescriptionId'});db[_0xc1ab('0xb1')][_0xc1ab('0x10c')](db[_0xc1ab('0xb1')],{'as':_0xc1ab('0x1b8'),'foreignKey':_0xc1ab('0x1b4')});db[_0xc1ab('0xb1')][_0xc1ab('0x117')](db[_0xc1ab('0x1b9')],{'as':'Variable','foreignKey':_0xc1ab('0x1ba')});db['FreshdeskAccount'][_0xc1ab('0x10c')](db[_0xc1ab('0xb3')],{'as':_0xc1ab('0x1ae'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1af')});db['FreshdeskConfiguration'][_0xc1ab('0x10c')](db[_0xc1ab('0xb5')],{'as':_0xc1ab('0x1b1'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1b6')});db[_0xc1ab('0xb3')][_0xc1ab('0x10c')](db[_0xc1ab('0xb5')],{'as':_0xc1ab('0x1b2'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1b3')});db[_0xc1ab('0xb3')][_0xc1ab('0x10c')](db[_0xc1ab('0xb5')],{'as':_0xc1ab('0x1ac'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1b4')});db['FreshdeskConfiguration']['belongsTo'](db[_0xc1ab('0x1bf')],{'as':'Account','foreignKey':_0xc1ab('0x1af')});db[_0xc1ab('0xb3')][_0xc1ab('0x11a')](db['Tag'],{'through':_0xc1ab('0x1c0')});db[_0xc1ab('0xb5')][_0xc1ab('0x10c')](db[_0xc1ab('0xb5')],{'as':_0xc1ab('0x1b5'),'foreignKey':_0xc1ab('0x1b6')});db[_0xc1ab('0xb5')]['hasMany'](db[_0xc1ab('0xb5')],{'as':_0xc1ab('0x1b7'),'foreignKey':_0xc1ab('0x1b3')});db[_0xc1ab('0xb5')][_0xc1ab('0x10c')](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xc1ab('0xb5')][_0xc1ab('0x117')](db[_0xc1ab('0x1b9')],{'as':_0xc1ab('0x1b9'),'foreignKey':_0xc1ab('0x1ba')});db[_0xc1ab('0xb7')][_0xc1ab('0x10c')](db[_0xc1ab('0xb9')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xc1ab('0x1af')});db[_0xc1ab('0xb9')][_0xc1ab('0x10c')](db[_0xc1ab('0xbb')],{'as':_0xc1ab('0x1b1'),'foreignKey':_0xc1ab('0x1b6')});db[_0xc1ab('0xb9')][_0xc1ab('0x10c')](db['VtigerField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xc1ab('0xb9')][_0xc1ab('0x10c')](db[_0xc1ab('0xbb')],{'as':'Fields','foreignKey':_0xc1ab('0x1b4')});db[_0xc1ab('0xb9')]['belongsTo'](db['VtigerAccount'],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x1af')});db[_0xc1ab('0xbb')][_0xc1ab('0x10c')](db[_0xc1ab('0xbb')],{'as':_0xc1ab('0x1b5'),'foreignKey':_0xc1ab('0x1b6')});db[_0xc1ab('0xbb')][_0xc1ab('0x10c')](db[_0xc1ab('0xbb')],{'as':_0xc1ab('0x1b7'),'foreignKey':_0xc1ab('0x1b3')});db[_0xc1ab('0xbb')][_0xc1ab('0x10c')](db[_0xc1ab('0xbb')],{'as':_0xc1ab('0x1b8'),'foreignKey':_0xc1ab('0x1b4')});db[_0xc1ab('0xbb')][_0xc1ab('0x117')](db[_0xc1ab('0x1b9')],{'as':_0xc1ab('0x1b9'),'foreignKey':_0xc1ab('0x1ba')});db['ServicenowAccount'][_0xc1ab('0x10c')](db[_0xc1ab('0x1c1')],{'as':_0xc1ab('0x1ae'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xc1ab('0x1c1')][_0xc1ab('0x10c')](db[_0xc1ab('0xc0')],{'as':_0xc1ab('0x1b1'),'foreignKey':_0xc1ab('0x1b6')});db['ServicenowConfiguration'][_0xc1ab('0x10c')](db[_0xc1ab('0xc0')],{'as':_0xc1ab('0x1b2'),'foreignKey':'DescriptionId'});db[_0xc1ab('0x1c1')][_0xc1ab('0x10c')](db[_0xc1ab('0xc0')],{'as':_0xc1ab('0x1ac'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0xc1ab('0x117')](db[_0xc1ab('0xbd')],{'as':'Account','foreignKey':'AccountId'});db[_0xc1ab('0xc0')][_0xc1ab('0x10c')](db[_0xc1ab('0xc0')],{'as':_0xc1ab('0x1b5'),'foreignKey':_0xc1ab('0x1b6')});db[_0xc1ab('0xc0')][_0xc1ab('0x10c')](db['ServicenowField'],{'as':_0xc1ab('0x1b7'),'foreignKey':'DescriptionId'});db[_0xc1ab('0xc0')][_0xc1ab('0x10c')](db[_0xc1ab('0xc0')],{'as':_0xc1ab('0x1b8'),'foreignKey':_0xc1ab('0x1b4')});db[_0xc1ab('0xc0')][_0xc1ab('0x117')](db[_0xc1ab('0x1b9')],{'as':_0xc1ab('0x1b9'),'foreignKey':_0xc1ab('0x1ba')});db[_0xc1ab('0xc1')][_0xc1ab('0x10c')](db[_0xc1ab('0x1c2')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xc1ab('0x1c2')][_0xc1ab('0x10c')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0xc1ab('0x10a'),'foreignKey':'SubjectId'});db[_0xc1ab('0x1c2')][_0xc1ab('0x10c')](db[_0xc1ab('0xc4')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xc1ab('0x1b3')});db[_0xc1ab('0x1c2')][_0xc1ab('0x10c')](db[_0xc1ab('0xc4')],{'as':_0xc1ab('0x1ac'),'onDelete':_0xc1ab('0x10a'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0xc1ab('0x117')](db[_0xc1ab('0xc1')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x1af')});db[_0xc1ab('0xc4')][_0xc1ab('0x10c')](db[_0xc1ab('0xc4')],{'as':_0xc1ab('0x1b5'),'foreignKey':_0xc1ab('0x1b6')});db['Dynamics365Field'][_0xc1ab('0x10c')](db[_0xc1ab('0xc4')],{'as':_0xc1ab('0x1b7'),'foreignKey':_0xc1ab('0x1b3')});db[_0xc1ab('0xc4')][_0xc1ab('0x10c')](db[_0xc1ab('0xc4')],{'as':_0xc1ab('0x1b8'),'foreignKey':_0xc1ab('0x1b4')});db[_0xc1ab('0xc4')][_0xc1ab('0x117')](db[_0xc1ab('0x1b9')],{'as':_0xc1ab('0x1b9'),'foreignKey':_0xc1ab('0x1ba')});db[_0xc1ab('0x1c3')][_0xc1ab('0x10c')](db[_0xc1ab('0xc6')],{'as':_0xc1ab('0x1ae'),'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1af')});db[_0xc1ab('0xc6')][_0xc1ab('0x10c')](db[_0xc1ab('0xc8')],{'as':_0xc1ab('0x1b1'),'foreignKey':_0xc1ab('0x1b6')});db[_0xc1ab('0xc6')][_0xc1ab('0x10c')](db[_0xc1ab('0xc8')],{'as':_0xc1ab('0x1b2'),'foreignKey':'DescriptionId'});db[_0xc1ab('0xc6')][_0xc1ab('0x10c')](db['FreshsalesField'],{'as':_0xc1ab('0x1ac'),'foreignKey':_0xc1ab('0x1b4')});db[_0xc1ab('0xc6')][_0xc1ab('0x117')](db[_0xc1ab('0x1c3')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x1af')});db[_0xc1ab('0xc8')]['hasMany'](db[_0xc1ab('0xc8')],{'as':_0xc1ab('0x1b5'),'foreignKey':_0xc1ab('0x1b6')});db[_0xc1ab('0xc8')]['hasMany'](db[_0xc1ab('0xc8')],{'as':_0xc1ab('0x1b7'),'foreignKey':_0xc1ab('0x1b3')});db[_0xc1ab('0xc8')][_0xc1ab('0x10c')](db[_0xc1ab('0xc8')],{'as':_0xc1ab('0x1b8'),'foreignKey':'FieldId'});db['FreshsalesField'][_0xc1ab('0x117')](db['Variable'],{'as':_0xc1ab('0x1b9'),'foreignKey':'VariableId'});db[_0xc1ab('0x1c4')]['belongsTo'](db[_0xc1ab('0x61')],{});db[_0xc1ab('0x1c4')]['belongsTo'](db[_0xc1ab('0xf0')],{'as':'List','foreignKey':_0xc1ab('0x170')});db[_0xc1ab('0x1c4')][_0xc1ab('0x117')](db['CmContact'],{'as':_0xc1ab('0x15c'),'foreignKey':'ContactId'});db['ChatQueueReport']['belongsTo'](db[_0xc1ab('0x112')],{});db['ChatQueueReport'][_0xc1ab('0x117')](db[_0xc1ab('0x67')],{});db[_0xc1ab('0x1c4')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{});db['ChatQueueReport']['belongsTo'](db[_0xc1ab('0x6b')],{});db[_0xc1ab('0xcc')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1c5')});db[_0xc1ab('0xcc')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1c6')});db['JscriptySessionReport']['hasMany'](db[_0xc1ab('0x1c7')],{'foreignKey':_0xc1ab('0x1c8'),'onDelete':_0xc1ab('0x10a')});db[_0xc1ab('0xd0')][_0xc1ab('0x10c')](db['JscriptyAnswerReport'],{'foreignKey':_0xc1ab('0x1c8'),'onDelete':_0xc1ab('0x10a')});db[_0xc1ab('0x1c9')][_0xc1ab('0x117')](db[_0xc1ab('0x52')],{});db[_0xc1ab('0x1c9')][_0xc1ab('0x117')](db[_0xc1ab('0xf0')],{'as':_0xc1ab('0x163'),'foreignKey':'ListId'});db[_0xc1ab('0x1c9')][_0xc1ab('0x117')](db[_0xc1ab('0x11b')],{'as':_0xc1ab('0x15c'),'foreignKey':_0xc1ab('0x15d')});db['SmsQueueReport']['belongsTo'](db[_0xc1ab('0x55')],{});db['SmsQueueReport'][_0xc1ab('0x117')](db[_0xc1ab('0x57')],{});db[_0xc1ab('0x1c9')]['belongsTo'](db['User'],{});db['SmsQueueReport'][_0xc1ab('0x117')](db['SmsQueue'],{});db[_0xc1ab('0x1ca')]['hasMany'](db[_0xc1ab('0xd0')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xc1ab('0x10c')](db[_0xc1ab('0x1c7')],{'foreignKey':_0xc1ab('0x1cb')});db['JscriptyProject'][_0xc1ab('0x10c')](db[_0xc1ab('0xcd')],{'foreignKey':_0xc1ab('0x1cb')});db[_0xc1ab('0xd8')][_0xc1ab('0x11a')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x16b'),'through':'user_has_square_projects'});db[_0xc1ab('0x11e')]['belongsToMany'](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x152'),'through':_0xc1ab('0x11f')});db[_0xc1ab('0x11e')]['belongsToMany'](db[_0xc1ab('0x126')],{'through':_0xc1ab('0x154'),'as':'VoiceQueues'});db[_0xc1ab('0x11e')][_0xc1ab('0x11a')](db[_0xc1ab('0x3c')],{'through':_0xc1ab('0x166'),'as':_0xc1ab('0x128')});db[_0xc1ab('0x11e')]['belongsToMany'](db[_0xc1ab('0x6b')],{'through':_0xc1ab('0x1cc'),'as':_0xc1ab('0x12a')});db['Team'][_0xc1ab('0x11a')](db['FaxQueue'],{'through':_0xc1ab('0x179'),'as':'FaxQueues'});db[_0xc1ab('0x11e')][_0xc1ab('0x11a')](db[_0xc1ab('0x58')],{'through':_0xc1ab('0x1cd'),'as':_0xc1ab('0x1ce')});db[_0xc1ab('0x11e')][_0xc1ab('0x11a')](db[_0xc1ab('0x60')],{'through':_0xc1ab('0x184'),'as':'OpenchannelQueues'});db[_0xc1ab('0x11e')][_0xc1ab('0x11a')](db[_0xc1ab('0x105')],{'through':_0xc1ab('0x1cf'),'as':_0xc1ab('0x12e')});db[_0xc1ab('0xe1')][_0xc1ab('0x10c')](db['CmHopper'],{'as':_0xc1ab('0x147'),'foreignKey':'CampaignId'});db[_0xc1ab('0xe1')][_0xc1ab('0x10c')](db[_0xc1ab('0x76')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0xc1ab('0xe1')]['hasMany'](db['CmHopperHistory'],{'as':_0xc1ab('0x18d'),'foreignKey':_0xc1ab('0x194')});db['Campaign'][_0xc1ab('0x10c')](db[_0xc1ab('0x74')],{'as':_0xc1ab('0x148'),'foreignKey':_0xc1ab('0x194')});db[_0xc1ab('0xe1')][_0xc1ab('0x117')](db[_0xc1ab('0x14a')],{'as':_0xc1ab('0x14a'),'foreignKey':_0xc1ab('0x14b')});db[_0xc1ab('0xe1')]['belongsTo'](db[_0xc1ab('0x14a')],{'as':_0xc1ab('0x1d0'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0xc1ab('0x117')](db['Interval'],{'as':_0xc1ab('0x14d'),'foreignKey':_0xc1ab('0x14e')});db['Campaign'][_0xc1ab('0x117')](db[_0xc1ab('0xd8')],{'as':_0xc1ab('0xd8'),'foreignKey':_0xc1ab('0x1d1')});db[_0xc1ab('0xe1')][_0xc1ab('0x11a')](db[_0xc1ab('0xf0')],{'as':_0xc1ab('0x150'),'through':_0xc1ab('0x1d2')});db[_0xc1ab('0xe1')][_0xc1ab('0x11a')](db['CmList'],{'as':'BlackLists','through':_0xc1ab('0x1d3')});db['MailTransferReport']['belongsTo'](db[_0xc1ab('0x16c')],{});db[_0xc1ab('0xe7')]['belongsTo'](db[_0xc1ab('0x40')],{});db[_0xc1ab('0xe7')][_0xc1ab('0x117')](db[_0xc1ab('0x3a')],{'foreignKey':_0xc1ab('0x1d4'),'as':_0xc1ab('0x1d5')});db[_0xc1ab('0xe7')]['belongsTo'](db['User'],{'foreignKey':_0xc1ab('0x1d6'),'as':_0xc1ab('0x1d7')});db[_0xc1ab('0xe7')]['belongsTo'](db[_0xc1ab('0x13')],{'foreignKey':'ToUserId','as':_0xc1ab('0x1d8')});db['MailTransferReport'][_0xc1ab('0x117')](db[_0xc1ab('0x3c')],{'foreignKey':_0xc1ab('0x1d9'),'as':_0xc1ab('0x1da')});db[_0xc1ab('0xe7')][_0xc1ab('0x117')](db[_0xc1ab('0x3a')],{'foreignKey':_0xc1ab('0x1db'),'as':_0xc1ab('0x1dc')});db[_0xc1ab('0xe9')][_0xc1ab('0x117')](db[_0xc1ab('0x67')],{});db['ChatTransferReport'][_0xc1ab('0x117')](db[_0xc1ab('0x112')],{});db[_0xc1ab('0xe9')][_0xc1ab('0x117')](db['ChatWebsite'],{'foreignKey':_0xc1ab('0x1dd'),'as':_0xc1ab('0x1d5')});db[_0xc1ab('0xe9')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db['ChatTransferReport'][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xc1ab('0xe9')][_0xc1ab('0x117')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0xc1ab('0x1da')});db[_0xc1ab('0xe9')][_0xc1ab('0x117')](db[_0xc1ab('0x61')],{'foreignKey':'ToChatWebsiteId','as':_0xc1ab('0x1dc')});db['FaxTransferReport'][_0xc1ab('0x117')](db[_0xc1ab('0x4d')],{});db[_0xc1ab('0xeb')][_0xc1ab('0x117')](db[_0xc1ab('0x4c')],{});db[_0xc1ab('0xeb')][_0xc1ab('0x117')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0xc1ab('0x1d5')});db[_0xc1ab('0xeb')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'foreignKey':_0xc1ab('0x1d6'),'as':'FromAgent'});db[_0xc1ab('0xeb')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'foreignKey':_0xc1ab('0x1de'),'as':_0xc1ab('0x1d8')});db[_0xc1ab('0xeb')]['belongsTo'](db[_0xc1ab('0x4f')],{'foreignKey':_0xc1ab('0x1df'),'as':_0xc1ab('0x1da')});db[_0xc1ab('0xeb')][_0xc1ab('0x117')](db[_0xc1ab('0x134')],{'foreignKey':_0xc1ab('0x1e0'),'as':'ToAccount'});db[_0xc1ab('0xed')][_0xc1ab('0x117')](db['OpenchannelMessage'],{});db[_0xc1ab('0xed')][_0xc1ab('0x117')](db['OpenchannelInteraction'],{});db[_0xc1ab('0xed')][_0xc1ab('0x117')](db['OpenchannelAccount'],{'foreignKey':_0xc1ab('0x1e1'),'as':'FromAccount'});db[_0xc1ab('0xed')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'foreignKey':_0xc1ab('0x1d6'),'as':_0xc1ab('0x1d7')});db[_0xc1ab('0xed')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'foreignKey':_0xc1ab('0x1de'),'as':_0xc1ab('0x1d8')});db[_0xc1ab('0xed')][_0xc1ab('0x117')](db[_0xc1ab('0x60')],{'foreignKey':'ToOpenchannelQueueId','as':_0xc1ab('0x1da')});db['OpenchannelTransferReport'][_0xc1ab('0x117')](db[_0xc1ab('0x5a')],{'foreignKey':_0xc1ab('0x1e2'),'as':_0xc1ab('0x1dc')});db[_0xc1ab('0x1e3')][_0xc1ab('0x117')](db['SmsMessage'],{});db[_0xc1ab('0x1e3')]['belongsTo'](db['SmsInteraction'],{});db['SmsTransferReport'][_0xc1ab('0x117')](db[_0xc1ab('0x52')],{'foreignKey':_0xc1ab('0x1e4'),'as':'FromAccount'});db['SmsTransferReport']['belongsTo'](db[_0xc1ab('0x13')],{'foreignKey':_0xc1ab('0x1d6'),'as':_0xc1ab('0x1d7')});db[_0xc1ab('0x1e3')][_0xc1ab('0x117')](db['User'],{'foreignKey':_0xc1ab('0x1de'),'as':_0xc1ab('0x1d8')});db[_0xc1ab('0x1e3')][_0xc1ab('0x117')](db[_0xc1ab('0x58')],{'foreignKey':_0xc1ab('0x1e5'),'as':_0xc1ab('0x1da')});db[_0xc1ab('0x1e3')][_0xc1ab('0x117')](db[_0xc1ab('0x52')],{'foreignKey':_0xc1ab('0x1e6'),'as':_0xc1ab('0x1dc')});db[_0xc1ab('0xf0')][_0xc1ab('0x10c')](db[_0xc1ab('0x81')],{'as':_0xc1ab('0x160'),'foreignKey':'ListId'});db['CmList'][_0xc1ab('0x10c')](db[_0xc1ab('0x7b')],{'as':_0xc1ab('0x1e7'),'foreignKey':_0xc1ab('0x170')});db[_0xc1ab('0xf0')][_0xc1ab('0x10c')](db['CmContact'],{'as':_0xc1ab('0x11c'),'onDelete':'cascade','foreignKey':_0xc1ab('0x170')});db['CmList'][_0xc1ab('0x10c')](db['CmHopperFinal'],{'as':_0xc1ab('0x110'),'foreignKey':_0xc1ab('0x170')});db[_0xc1ab('0xf0')]['hasMany'](db[_0xc1ab('0x78')],{'as':'HopperHistory','foreignKey':_0xc1ab('0x170')});db[_0xc1ab('0xf0')][_0xc1ab('0x10c')](db[_0xc1ab('0x79')],{'as':_0xc1ab('0x79'),'foreignKey':_0xc1ab('0x170')});db[_0xc1ab('0xf0')][_0xc1ab('0x11a')](db[_0xc1ab('0x126')],{'as':_0xc1ab('0x1e8'),'through':_0xc1ab('0x151')});db[_0xc1ab('0xf0')][_0xc1ab('0x11a')](db['User'],{'as':'Agents','through':_0xc1ab('0x11d')});db[_0xc1ab('0x130')]['hasMany'](db['VoiceExtension'],{'as':_0xc1ab('0x10f'),'onDelete':_0xc1ab('0x10a')});db['VoicePrefix']['belongsToMany'](db[_0xc1ab('0x13')],{'as':'Agents','through':_0xc1ab('0x131')});db['UserProfile'][_0xc1ab('0x10c')](db['User'],{'as':'Users','foreignKey':_0xc1ab('0x1e9')});db[_0xc1ab('0xf2')][_0xc1ab('0x10c')](db[_0xc1ab('0xf4')],{'as':'UserProfileSections','foreignKey':_0xc1ab('0x1e9'),'onDelete':_0xc1ab('0x10a')});db['UserProfileSection'][_0xc1ab('0x10c')](db[_0xc1ab('0xf6')],{'as':_0xc1ab('0x1ea'),'foreignKey':_0xc1ab('0x1eb'),'onDelete':_0xc1ab('0x10a')});db['WhatsappAccount']['hasMany'](db['Disposition'],{'as':_0xc1ab('0x160'),'foreignKey':_0xc1ab('0x1ec')});db[_0xc1ab('0xfc')][_0xc1ab('0x10c')](db[_0xc1ab('0x7f')],{'as':_0xc1ab('0x161'),'foreignKey':_0xc1ab('0x1ec')});db[_0xc1ab('0xfc')][_0xc1ab('0x10c')](db[_0xc1ab('0x101')],{'as':_0xc1ab('0x157'),'foreignKey':_0xc1ab('0x1ec')});db[_0xc1ab('0xfc')][_0xc1ab('0x10c')](db[_0xc1ab('0x100')],{'as':_0xc1ab('0x173')});db[_0xc1ab('0xfc')]['hasMany'](db[_0xc1ab('0xfe')],{'as':_0xc1ab('0x162')});db[_0xc1ab('0xfc')][_0xc1ab('0x117')](db[_0xc1ab('0xf0')],{'as':_0xc1ab('0x163'),'foreignKey':_0xc1ab('0x170')});db[_0xc1ab('0xfc')][_0xc1ab('0x117')](db[_0xc1ab('0x86')],{'as':_0xc1ab('0x165'),'foreignKey':_0xc1ab('0x14f')});db['WhatsappAccount'][_0xc1ab('0x11a')](db[_0xc1ab('0x13')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'onDelete':_0xc1ab('0x16e')});db['WhatsappApplication'][_0xc1ab('0x117')](db[_0xc1ab('0x105')],{'onDelete':_0xc1ab('0x16e')});db[_0xc1ab('0xfe')][_0xc1ab('0x117')](db[_0xc1ab('0xfc')],{'onDelete':_0xc1ab('0x16e')});db['WhatsappApplication']['belongsTo'](db[_0xc1ab('0x14d')],{'onDelete':_0xc1ab('0x16e'),'foreignKey':'IntervalId'});db['WhatsappApplication']['belongsTo'](db['Tag'],{'onDelete':_0xc1ab('0x16e'),'foreignKey':'TagId'});db['WhatsappInteraction']['hasMany'](db[_0xc1ab('0x101')],{'as':'Messages','onDelete':_0xc1ab('0x10a'),'foreignKey':_0xc1ab('0x1ed')});db[_0xc1ab('0x100')]['belongsTo'](db[_0xc1ab('0xfc')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0xc1ab('0x100')]['belongsTo'](db[_0xc1ab('0x11b')],{'as':_0xc1ab('0x15c'),'foreignKey':'ContactId'});db[_0xc1ab('0x100')][_0xc1ab('0x117')](db['User'],{'as':'Owner','foreignKey':_0xc1ab('0x10b')});db['WhatsappInteraction'][_0xc1ab('0x11a')](db[_0xc1ab('0x8e')],{'through':_0xc1ab('0x1a6'),'as':_0xc1ab('0x16a')});db[_0xc1ab('0x100')]['belongsToMany'](db[_0xc1ab('0x8e')],{'through':_0xc1ab('0x1a6'),'as':_0xc1ab('0x17e')});db[_0xc1ab('0x100')][_0xc1ab('0x11a')](db[_0xc1ab('0x13')],{'as':_0xc1ab('0x16b'),'through':_0xc1ab('0x125'),'foreignKey':'WhatsappInteractionId'});db[_0xc1ab('0x101')][_0xc1ab('0x117')](db['User'],{'as':_0xc1ab('0x13')});db['WhatsappMessage'][_0xc1ab('0x117')](db['CmContact'],{'onDelete':_0xc1ab('0x10a'),'as':_0xc1ab('0x15c')});db[_0xc1ab('0x101')][_0xc1ab('0x117')](db[_0xc1ab('0x100')],{'onDelete':_0xc1ab('0x10a'),'as':_0xc1ab('0x16d'),'foreignKey':'WhatsappInteractionId'});db[_0xc1ab('0x101')]['belongsTo'](db[_0xc1ab('0xfc')],{'as':_0xc1ab('0x168'),'foreignKey':_0xc1ab('0x1ec')});db[_0xc1ab('0x103')]['belongsTo'](db[_0xc1ab('0xfc')],{});db[_0xc1ab('0x103')][_0xc1ab('0x117')](db[_0xc1ab('0xf0')],{'as':_0xc1ab('0x163'),'foreignKey':'ListId'});db[_0xc1ab('0x103')]['belongsTo'](db[_0xc1ab('0x11b')],{'as':'Contact','foreignKey':'ContactId'});db[_0xc1ab('0x103')]['belongsTo'](db[_0xc1ab('0x100')],{});db[_0xc1ab('0x103')][_0xc1ab('0x117')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0xc1ab('0x117')](db['WhatsappMessage'],{});db[_0xc1ab('0x103')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{});db[_0xc1ab('0x1ee')][_0xc1ab('0x117')](db[_0xc1ab('0x101')],{});db[_0xc1ab('0x1ee')]['belongsTo'](db[_0xc1ab('0x100')],{});db['WhatsappTransferReport'][_0xc1ab('0x117')](db[_0xc1ab('0xfc')],{'foreignKey':_0xc1ab('0x1ef'),'as':_0xc1ab('0x1d5')});db['WhatsappTransferReport'][_0xc1ab('0x117')](db[_0xc1ab('0xfc')],{'foreignKey':_0xc1ab('0x1f0'),'as':_0xc1ab('0x1dc')});db[_0xc1ab('0x1ee')][_0xc1ab('0x117')](db[_0xc1ab('0x105')],{'foreignKey':_0xc1ab('0x1f1'),'as':'ToQueue'});db[_0xc1ab('0x1ee')][_0xc1ab('0x117')](db[_0xc1ab('0x13')],{'foreignKey':_0xc1ab('0x1d6'),'as':_0xc1ab('0x1d7')});db[_0xc1ab('0x1ee')][_0xc1ab('0x117')](db['User'],{'foreignKey':_0xc1ab('0x1de'),'as':'ToAgent'});db[_0xc1ab('0x105')][_0xc1ab('0x11a')](db[_0xc1ab('0x13')],{'as':'Agents','through':_0xc1ab('0x12f'),'foreignKey':'WhatsappQueueId'});db[_0xc1ab('0x105')][_0xc1ab('0x11a')](db[_0xc1ab('0x11e')],{'through':_0xc1ab('0x1cf'),'as':_0xc1ab('0x153')});module[_0xc1ab('0x1f2')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b6b34a5..9f7fad8 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f3e=['./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReportDetail','/api/settings','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','./api/authGoogle','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','/www','root','/snippet','snippet','1.0.16','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','apiKey','lastName','street','phone','mobile','fax','email','clientId','clientSecret','code','accessKey','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','isArray','length','isString','replace','@@{','}@@','includes','lodash','path','express','express-winston','util','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','user','inspect','device','agent_id','url','responseTime','role','agent_name','test','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/messages','/api/fax/queues','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','./api/variable','./api/integration','/api/integrations/reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/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/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks'];(function(_0x570071,_0x17e08a){var _0x4f9196=function(_0x3d8473){while(--_0x3d8473){_0x570071['push'](_0x570071['shift']());}};_0x4f9196(++_0x17e08a);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0x5c0d76,_0x293106){_0x5c0d76=_0x5c0d76-0x0;var _0x250a9b=_0x9f3e[_0x5c0d76];return _0x250a9b;};'use strict';var _=require(_0xe9f3('0x0'));var path=require(_0xe9f3('0x1'));var express=require(_0xe9f3('0x2'));var ewinston=require(_0xe9f3('0x3'));var util=require(_0xe9f3('0x4'));var errors=require('./errors');var config=require('./config/environment');var logger=require('./config/logger')(_0xe9f3('0x5'));var authLogger=require('./config/logger')(_0xe9f3('0x6'));exports[_0xe9f3('0x7')]=function(_0x46f926){_0x46f926[_0xe9f3('0x8')](ewinston[_0xe9f3('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1611eb,_0x407123){var _0x4014b1=_0xe9f3('0xa');if(!_[_0xe9f3('0xb')](_0x1611eb[_0xe9f3('0xc')])){_0x4014b1+=_0xe9f3('0xd');var _0x1f0989=_0x1611eb['body'];maskSensitiveData(_0x1f0989);}return util[_0xe9f3('0xe')](_0x4014b1,_0x1611eb[_0xe9f3('0xf')],_0x1611eb[_0xe9f3('0x10')][_0xe9f3('0x11')]?_0x1611eb[_0xe9f3('0x10')]['x-forwarded-for']:_0x1611eb[_0xe9f3('0x12')][_0xe9f3('0x13')]||_0x1611eb['ip'],_0x1611eb['url'],_0x407123[_0xe9f3('0x14')],_0x407123['responseTime'],_0x1611eb[_0xe9f3('0x15')]?_0x1611eb[_0xe9f3('0x15')]['id']:null,_0x1611eb[_0xe9f3('0x15')]?_0x1611eb['user']['name']:null,_0x1611eb[_0xe9f3('0x15')]?_0x1611eb[_0xe9f3('0x15')]['role']:null,_0x1f0989?util[_0xe9f3('0x16')](_0x1f0989,![],null):'');}}));_0x46f926[_0xe9f3('0x8')](ewinston[_0xe9f3('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x25abdc,_0x45cfd5){var _0x5a8ea2='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x25abdc[_0xe9f3('0xc')]&&_0x25abdc[_0xe9f3('0xc')][_0xe9f3('0x17')]&&_0x25abdc[_0xe9f3('0xc')][_0xe9f3('0x18')]){_0x5a8ea2='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xe9f3('0xe')](_0x5a8ea2,_0x25abdc[_0xe9f3('0xf')],_0x25abdc['headers'][_0xe9f3('0x11')]?_0x25abdc[_0xe9f3('0x10')][_0xe9f3('0x11')]:_0x25abdc[_0xe9f3('0x12')][_0xe9f3('0x13')]||_0x25abdc['ip'],_0x25abdc[_0xe9f3('0x19')],_0x45cfd5[_0xe9f3('0x14')],_0x45cfd5[_0xe9f3('0x1a')],_0x25abdc['user']?_0x25abdc[_0xe9f3('0x15')]['id']:null,_0x25abdc[_0xe9f3('0x15')]?_0x25abdc[_0xe9f3('0x15')]['name']:null,_0x25abdc[_0xe9f3('0x15')]?_0x25abdc[_0xe9f3('0x15')][_0xe9f3('0x1b')]:null,_0x25abdc['body']&&_0x25abdc['body'][_0xe9f3('0x17')]?_0x25abdc['body'][_0xe9f3('0x17')]:'other',_0x25abdc[_0xe9f3('0xc')]&&_0x25abdc[_0xe9f3('0xc')][_0xe9f3('0x18')]?_0x25abdc[_0xe9f3('0xc')][_0xe9f3('0x18')]:'',_0x25abdc[_0xe9f3('0xc')]&&_0x25abdc[_0xe9f3('0xc')]['agent_name']?_0x25abdc[_0xe9f3('0xc')][_0xe9f3('0x1c')]:'');},'ignoreRoute':function(_0x4f56de){var _0x1c13a6=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1c13a6[_0xe9f3('0x1d')](_0x4f56de[_0xe9f3('0x19')]);}}));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x1e'),require('./api/user'));_0x46f926['use'](_0xe9f3('0x1f'),require('./api/voiceChanSpy'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x20'),require(_0xe9f3('0x21')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x22'),require(_0xe9f3('0x23')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x24'),require(_0xe9f3('0x25')));_0x46f926[_0xe9f3('0x8')]('/api/voice/queues',require(_0xe9f3('0x26')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x27'),require(_0xe9f3('0x28')));_0x46f926['use'](_0xe9f3('0x29'),require(_0xe9f3('0x2a')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x2b'),require('./api/voiceMail'));_0x46f926['use'](_0xe9f3('0x2c'),require(_0xe9f3('0x2d')));_0x46f926['use'](_0xe9f3('0x2e'),require(_0xe9f3('0x2f')));_0x46f926['use'](_0xe9f3('0x30'),require('./api/voiceDialReport'));_0x46f926['use'](_0xe9f3('0x31'),require('./api/voiceAgentReport'));_0x46f926['use']('/api/voice/queues/reports',require(_0xe9f3('0x32')));_0x46f926[_0xe9f3('0x8')]('/api/members/reports',require(_0xe9f3('0x33')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x34'),require(_0xe9f3('0x35')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x36'),require('./api/voiceTransferReport'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x37'),require(_0xe9f3('0x38')));_0x46f926[_0xe9f3('0x8')]('/api/mail/accounts',require('./api/mailAccount'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x39'),require(_0xe9f3('0x3a')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x3b'),require(_0xe9f3('0x3c')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x3d'),require('./api/mailInteraction'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x3e'),require(_0xe9f3('0x3f')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x40'),require(_0xe9f3('0x41')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x42'),require(_0xe9f3('0x43')));_0x46f926['use'](_0xe9f3('0x44'),require(_0xe9f3('0x45')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x46'),require(_0xe9f3('0x47')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x48'),require(_0xe9f3('0x49')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x4a'),require('./api/faxApplication'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x4b'),require('./api/faxInteraction'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x4c'),require('./api/faxMessage'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x4d'),require('./api/faxQueue'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x4e'),require('./api/faxQueueReport'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x4f'),require(_0xe9f3('0x50')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x51'),require(_0xe9f3('0x52')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x53'),require('./api/smsInteraction'));_0x46f926['use']('/api/sms/messages',require(_0xe9f3('0x54')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x55'),require('./api/smsQueue'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x56'),require(_0xe9f3('0x57')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x58'),require(_0xe9f3('0x59')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x5a'),require('./api/openchannelInteraction'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x5b'),require('./api/openchannelMessage'));_0x46f926['use'](_0xe9f3('0x5c'),require('./api/openchannelQueue'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x5d'),require('./api/chatWebsite'));_0x46f926['use']('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x5e'),require(_0xe9f3('0x5f')));_0x46f926[_0xe9f3('0x8')]('/api/chat/interactions',require(_0xe9f3('0x60')));_0x46f926[_0xe9f3('0x8')]('/api/chat/messages',require('./api/chatMessage'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x61'),require(_0xe9f3('0x62')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x63'),require(_0xe9f3('0x64')));_0x46f926['use'](_0xe9f3('0x65'),require(_0xe9f3('0x66')));_0x46f926['use'](_0xe9f3('0x67'),require(_0xe9f3('0x68')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x69'),require(_0xe9f3('0x6a')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x6b'),require(_0xe9f3('0x6c')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x6d'),require('./api/cmHopper'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x6e'),require(_0xe9f3('0x6f')));_0x46f926['use'](_0xe9f3('0x70'),require(_0xe9f3('0x71')));_0x46f926[_0xe9f3('0x8')]('/api/cm/hopper_history',require(_0xe9f3('0x72')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x73'),require(_0xe9f3('0x74')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x75'),require(_0xe9f3('0x76')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x77'),require(_0xe9f3('0x78')));_0x46f926[_0xe9f3('0x8')]('/api/canned_answers',require(_0xe9f3('0x79')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x7a'),require(_0xe9f3('0x7b')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x7c'),require(_0xe9f3('0x7d')));_0x46f926['use'](_0xe9f3('0x7e'),require(_0xe9f3('0x7f')));_0x46f926[_0xe9f3('0x8')]('/api/pauses',require(_0xe9f3('0x80')));_0x46f926[_0xe9f3('0x8')]('/api/cdr',require('./api/cdr'));_0x46f926['use'](_0xe9f3('0x81'),require(_0xe9f3('0x82')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x83'),require(_0xe9f3('0x84')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x85'),require('./api/sound'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x86'),require(_0xe9f3('0x87')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x88'),require(_0xe9f3('0x89')));_0x46f926[_0xe9f3('0x8')]('/api/triggers',require(_0xe9f3('0x8a')));_0x46f926['use']('/api/variables',require(_0xe9f3('0x8b')));_0x46f926[_0xe9f3('0x8')]('/api/integrations',require(_0xe9f3('0x8c')));_0x46f926['use'](_0xe9f3('0x8d'),require('./api/integrationReport'));_0x46f926[_0xe9f3('0x8')]('/api/analytics/custom_reports',require(_0xe9f3('0x8e')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x8f'),require(_0xe9f3('0x90')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x91'),require(_0xe9f3('0x92')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x93'),require(_0xe9f3('0x94')));_0x46f926['use'](_0xe9f3('0x95'),require('./api/analyticFieldReport'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x96'),require(_0xe9f3('0x97')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x98'),require(_0xe9f3('0x99')));_0x46f926['use'](_0xe9f3('0x9a'),require(_0xe9f3('0x9b')));_0x46f926['use']('/api/integrations/salesforce/fields',require(_0xe9f3('0x9c')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x9d'),require(_0xe9f3('0x9e')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x9f'),require(_0xe9f3('0xa0')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xa1'),require(_0xe9f3('0xa2')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xa3'),require('./api/intDeskAccount'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xa4'),require(_0xe9f3('0xa5')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xa6'),require(_0xe9f3('0xa7')));_0x46f926[_0xe9f3('0x8')]('/api/integrations/zoho/accounts',require(_0xe9f3('0xa8')));_0x46f926[_0xe9f3('0x8')]('/api/integrations/zoho/configurations',require(_0xe9f3('0xa9')));_0x46f926[_0xe9f3('0x8')]('/api/integrations/zoho/fields',require(_0xe9f3('0xaa')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xab'),require(_0xe9f3('0xac')));_0x46f926['use'](_0xe9f3('0xad'),require(_0xe9f3('0xae')));_0x46f926[_0xe9f3('0x8')]('/api/integrations/zendesk/fields',require(_0xe9f3('0xaf')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xb0'),require(_0xe9f3('0xb1')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xb2'),require(_0xe9f3('0xb3')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xb4'),require('./api/intFreshdeskField'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xb5'),require(_0xe9f3('0xb6')));_0x46f926['use'](_0xe9f3('0xb7'),require(_0xe9f3('0xb8')));_0x46f926[_0xe9f3('0x8')]('/api/integrations/vtiger/fields',require(_0xe9f3('0xb9')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xba'),require(_0xe9f3('0xbb')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xbc'),require(_0xe9f3('0xbd')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xbe'),require(_0xe9f3('0xbf')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xc0'),require(_0xe9f3('0xc1')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xc2'),require(_0xe9f3('0xc3')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xc4'),require('./api/intDynamics365Field'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xc5'),require(_0xe9f3('0xc6')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xc7'),require(_0xe9f3('0xc8')));_0x46f926['use'](_0xe9f3('0xc9'),require(_0xe9f3('0xca')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xcb'),require(_0xe9f3('0xcc')));_0x46f926['use'](_0xe9f3('0xcd'),require(_0xe9f3('0xce')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xcf'),require(_0xe9f3('0xd0')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xd1'),require(_0xe9f3('0xd2')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xd3'),require(_0xe9f3('0xd4')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xd5'),require(_0xe9f3('0xd6')));_0x46f926['use'](_0xe9f3('0xd7'),require(_0xe9f3('0xd8')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xd9'),require('./api/squareReport'));_0x46f926['use']('/api/square/details/reports',require(_0xe9f3('0xda')));_0x46f926[_0xe9f3('0x8')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xdb'),require('./api/setting'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xdc'),require('./api/squareOdbc'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xdd'),require(_0xe9f3('0xde')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xdf'),require('./api/squareRecording'));_0x46f926[_0xe9f3('0x8')]('/api/square/messages',require(_0xe9f3('0xe0')));_0x46f926['use'](_0xe9f3('0xe1'),require('./api/team'));_0x46f926['use'](_0xe9f3('0xe2'),require(_0xe9f3('0xe3')));_0x46f926['use']('/api/campaigns',require(_0xe9f3('0xe4')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xe5'),require(_0xe9f3('0xe6')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xe7'),require(_0xe9f3('0xe8')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xe9'),require(_0xe9f3('0xea')));_0x46f926['use'](_0xe9f3('0xeb'),require(_0xe9f3('0xec')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xed'),require('./api/chatTransferReport'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xee'),require(_0xe9f3('0xef')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xf0'),require('./api/openchannelTransferReport'));_0x46f926['use']('/api/sms/reports/transfer',require(_0xe9f3('0xf1')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xf2'),require('./api/cmList'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xf3'),require(_0xe9f3('0xf4')));_0x46f926[_0xe9f3('0x8')]('/api/userProfiles',require('./api/userProfile'));_0x46f926[_0xe9f3('0x8')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x46f926[_0xe9f3('0x8')]('/api/userProfile/resources',require(_0xe9f3('0xf5')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xf6'),require(_0xe9f3('0xf7')));_0x46f926['use']('/api/userNotifications',require('./api/userNotification'));_0x46f926['use'](_0xe9f3('0xf8'),require(_0xe9f3('0xf9')));_0x46f926[_0xe9f3('0x8')]('/api/whatsapp/applications',require(_0xe9f3('0xfa')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xfb'),require('./api/whatsappInteraction'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xfc'),require('./api/whatsappMessage'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xfd'),require('./api/whatsappQueueReport'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xfe'),require(_0xe9f3('0xff')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x100'),require(_0xe9f3('0x101')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x102'),require(_0xe9f3('0x103')));_0x46f926['use'](_0xe9f3('0x104'),require(_0xe9f3('0x105')));_0x46f926['use']('/api/auth/google',require(_0xe9f3('0x106')));_0x46f926['use']('/api/jira',require('./api/jira'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x107'),require(_0xe9f3('0x108')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x109'),require(_0xe9f3('0x10a')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x10b'),require(_0xe9f3('0x10c')));_0x46f926['use'](_0xe9f3('0x10d'),require('./api/pm2'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x10e'),require(_0xe9f3('0x10f')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x110'),express[_0xe9f3('0x111')](path[_0xe9f3('0x112')](config['root'],'/apidoc')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x113'),express[_0xe9f3('0x111')](path[_0xe9f3('0x112')](config[_0xe9f3('0x114')],_0xe9f3('0x113'))));_0x46f926['use']('/demo',express[_0xe9f3('0x111')](path[_0xe9f3('0x112')](config['root'],'/demo')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x115'),express[_0xe9f3('0x111')](path[_0xe9f3('0x112')](config[_0xe9f3('0x114')],_0xe9f3('0x116'),_0xe9f3('0x117'))));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x118'),express['static'](path[_0xe9f3('0x112')](config['root'],'/server/files/plugins')));_0x46f926[_0xe9f3('0x119')](_0xe9f3('0x11a'))[_0xe9f3('0x11b')](errors[0x194]);_0x46f926['route']('/*')[_0xe9f3('0x11b')](function(_0x2ec031,_0x52e7a9){_0x52e7a9[_0xe9f3('0x11c')](path[_0xe9f3('0x11d')](_0x46f926['get'](_0xe9f3('0x11e'))+_0xe9f3('0x11f')));});};var sensitiveFields=[_0xe9f3('0x120'),_0xe9f3('0x121'),'newPassword',_0xe9f3('0x122'),'firstName',_0xe9f3('0x123'),_0xe9f3('0x124'),_0xe9f3('0x125'),_0xe9f3('0x126'),_0xe9f3('0x127'),_0xe9f3('0x128'),_0xe9f3('0x129'),_0xe9f3('0x12a'),'securityToken',_0xe9f3('0x12b'),_0xe9f3('0x12c'),'tenantId',_0xe9f3('0x12d'),_0xe9f3('0x12e'),_0xe9f3('0x12f'),_0xe9f3('0x130'),_0xe9f3('0x131'),_0xe9f3('0x132'),_0xe9f3('0x133'),_0xe9f3('0x134'),_0xe9f3('0x135'),_0xe9f3('0x136'),_0xe9f3('0x137'),'vidaooApiKey',_0xe9f3('0x138'),_0xe9f3('0x139'),'accesskeyid',_0xe9f3('0x13a'),_0xe9f3('0x13b'),_0xe9f3('0x15'),_0xe9f3('0x13c'),_0xe9f3('0x13d'),_0xe9f3('0x13e'),_0xe9f3('0x13f'),_0xe9f3('0x140'),'registry','oldPassword'];function maskSensitiveData(_0x842e80){var _0x54950e=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x842e80))return;for(var _0x37c553 in _0x842e80){if(_[_0xe9f3('0x141')](_0x842e80[_0x37c553])){for(var _0x4024da=0x0;_0x4024da<_0x842e80[_0x37c553][_0xe9f3('0x142')];_0x4024da++){maskSensitiveData(_0x842e80[_0x37c553][_0x4024da]);}}else if(_['isPlainObject'](_0x842e80[_0x37c553])){maskSensitiveData(_0x842e80[_0x37c553]);}else if(_[_0xe9f3('0x143')](_0x842e80[_0x37c553])){_0x842e80[_0x37c553]=_0x842e80[_0x37c553][_0xe9f3('0x144')](/{{{/g,_0xe9f3('0x145'))[_0xe9f3('0x144')](/}}}/g,_0xe9f3('0x146'))[_0xe9f3('0x144')](/{{/g,'@{')[_0xe9f3('0x144')](/}}/g,'}@');if(_[_0xe9f3('0x147')](sensitiveFields,_0x37c553)){_0x842e80[_0x37c553]=_0x842e80[_0x37c553][_0xe9f3('0x144')](_0x54950e,'*');}}}} \ No newline at end of file +var _0xfa7c=['consumerSecret','membername','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','lodash','express','express-winston','util','./errors','./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','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','name','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','role','other','agent_id','agent_name','/api/users','./api/user','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','./api/cmCompany','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','/api/templates','./api/template','/api/triggers','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/field_reports','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./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/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./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/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/jscripty/projects','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','/api/notifications','./api/notification','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','static','join','/apidoc','root','/www','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','appPath','/index.html','username','newPassword','apiKey','firstName','lastName','phone','mobile','fax','email','clientId','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfa7c,0x15b));var _0xcfa7=function(_0x118f09,_0x39af3b){_0x118f09=_0x118f09-0x0;var _0x4fc610=_0xfa7c[_0x118f09];return _0x4fc610;};'use strict';var _=require(_0xcfa7('0x0'));var path=require('path');var express=require(_0xcfa7('0x1'));var ewinston=require(_0xcfa7('0x2'));var util=require(_0xcfa7('0x3'));var errors=require(_0xcfa7('0x4'));var config=require(_0xcfa7('0x5'));var logger=require(_0xcfa7('0x6'))(_0xcfa7('0x7'));var authLogger=require(_0xcfa7('0x6'))('auth');exports[_0xcfa7('0x8')]=function(_0x3bf816){_0x3bf816[_0xcfa7('0x9')](ewinston[_0xcfa7('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4b2669,_0x816590){var _0x573432=_0xcfa7('0xb');if(!_[_0xcfa7('0xc')](_0x4b2669[_0xcfa7('0xd')])){_0x573432+=_0xcfa7('0xe');var _0x4ae349=_0x4b2669[_0xcfa7('0xd')];maskSensitiveData(_0x4ae349);}return util[_0xcfa7('0xf')](_0x573432,_0x4b2669[_0xcfa7('0x10')],_0x4b2669[_0xcfa7('0x11')][_0xcfa7('0x12')]?_0x4b2669['headers']['x-forwarded-for']:_0x4b2669[_0xcfa7('0x13')]['remoteAddress']||_0x4b2669['ip'],_0x4b2669[_0xcfa7('0x14')],_0x816590[_0xcfa7('0x15')],_0x816590[_0xcfa7('0x16')],_0x4b2669[_0xcfa7('0x17')]?_0x4b2669[_0xcfa7('0x17')]['id']:null,_0x4b2669[_0xcfa7('0x17')]?_0x4b2669[_0xcfa7('0x17')][_0xcfa7('0x18')]:null,_0x4b2669['user']?_0x4b2669[_0xcfa7('0x17')]['role']:null,_0x4ae349?util['inspect'](_0x4ae349,![],null):'');}}));_0x3bf816[_0xcfa7('0x9')](ewinston[_0xcfa7('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x29cef5,_0x349679){var _0x23b1fb='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x29cef5[_0xcfa7('0xd')]&&_0x29cef5[_0xcfa7('0xd')][_0xcfa7('0x19')]&&_0x29cef5[_0xcfa7('0xd')]['agent_id']){_0x23b1fb=_0xcfa7('0x1a');}return util[_0xcfa7('0xf')](_0x23b1fb,_0x29cef5['method'],_0x29cef5['headers'][_0xcfa7('0x12')]?_0x29cef5[_0xcfa7('0x11')][_0xcfa7('0x12')]:_0x29cef5[_0xcfa7('0x13')][_0xcfa7('0x1b')]||_0x29cef5['ip'],_0x29cef5[_0xcfa7('0x14')],_0x349679[_0xcfa7('0x15')],_0x349679[_0xcfa7('0x16')],_0x29cef5['user']?_0x29cef5[_0xcfa7('0x17')]['id']:null,_0x29cef5['user']?_0x29cef5['user']['name']:null,_0x29cef5[_0xcfa7('0x17')]?_0x29cef5['user'][_0xcfa7('0x1c')]:null,_0x29cef5[_0xcfa7('0xd')]&&_0x29cef5[_0xcfa7('0xd')][_0xcfa7('0x19')]?_0x29cef5[_0xcfa7('0xd')][_0xcfa7('0x19')]:_0xcfa7('0x1d'),_0x29cef5[_0xcfa7('0xd')]&&_0x29cef5['body'][_0xcfa7('0x1e')]?_0x29cef5[_0xcfa7('0xd')][_0xcfa7('0x1e')]:'',_0x29cef5[_0xcfa7('0xd')]&&_0x29cef5['body'][_0xcfa7('0x1f')]?_0x29cef5[_0xcfa7('0xd')][_0xcfa7('0x1f')]:'');},'ignoreRoute':function(_0x29f6d0){var _0x948e56=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x948e56['test'](_0x29f6d0[_0xcfa7('0x14')]);}}));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x20'),require(_0xcfa7('0x21')));_0x3bf816['use']('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x22'),require(_0xcfa7('0x23')));_0x3bf816['use']('/api/voice/extensions',require(_0xcfa7('0x24')));_0x3bf816['use']('/api/voice/mohs',require(_0xcfa7('0x25')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x26'),require(_0xcfa7('0x27')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x28'),require(_0xcfa7('0x29')));_0x3bf816[_0xcfa7('0x9')]('/api/screen/recordings',require('./api/screenRecording'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x2a'),require(_0xcfa7('0x2b')));_0x3bf816['use']('/api/voice/mails/messages',require(_0xcfa7('0x2c')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x2d'),require('./api/voiceCallReport'));_0x3bf816[_0xcfa7('0x9')]('/api/voice/dials/reports',require(_0xcfa7('0x2e')));_0x3bf816['use'](_0xcfa7('0x2f'),require(_0xcfa7('0x30')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x31'),require(_0xcfa7('0x32')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x33'),require('./api/memberReport'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x34'),require(_0xcfa7('0x35')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x36'),require(_0xcfa7('0x37')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x38'),require(_0xcfa7('0x39')));_0x3bf816[_0xcfa7('0x9')]('/api/mail/accounts',require('./api/mailAccount'));_0x3bf816[_0xcfa7('0x9')]('/api/mail/queues',require(_0xcfa7('0x3a')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x3b'),require('./api/mailSubstatus'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x3c'),require('./api/mailInteraction'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x3d'),require(_0xcfa7('0x3e')));_0x3bf816['use'](_0xcfa7('0x3f'),require(_0xcfa7('0x40')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x41'),require(_0xcfa7('0x42')));_0x3bf816[_0xcfa7('0x9')]('/api/dashboards',require(_0xcfa7('0x43')));_0x3bf816['use'](_0xcfa7('0x44'),require(_0xcfa7('0x45')));_0x3bf816['use'](_0xcfa7('0x46'),require(_0xcfa7('0x47')));_0x3bf816['use'](_0xcfa7('0x48'),require('./api/faxApplication'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x49'),require('./api/faxInteraction'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x4a'),require(_0xcfa7('0x4b')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x4c'),require(_0xcfa7('0x4d')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x4e'),require('./api/faxQueueReport'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x4f'),require(_0xcfa7('0x50')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x51'),require('./api/smsApplication'));_0x3bf816[_0xcfa7('0x9')]('/api/sms/interactions',require(_0xcfa7('0x52')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x53'),require('./api/smsMessage'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x54'),require(_0xcfa7('0x55')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x56'),require(_0xcfa7('0x57')));_0x3bf816['use'](_0xcfa7('0x58'),require(_0xcfa7('0x59')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x5a'),require(_0xcfa7('0x5b')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x5c'),require(_0xcfa7('0x5d')));_0x3bf816[_0xcfa7('0x9')]('/api/openchannel/queues',require(_0xcfa7('0x5e')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x5f'),require(_0xcfa7('0x60')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x61'),require(_0xcfa7('0x62')));_0x3bf816['use']('/api/chat/applications',require(_0xcfa7('0x63')));_0x3bf816[_0xcfa7('0x9')]('/api/chat/interactions',require(_0xcfa7('0x64')));_0x3bf816[_0xcfa7('0x9')]('/api/chat/messages',require(_0xcfa7('0x65')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x66'),require('./api/chatOfflineMessage'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x67'),require('./api/chatQueue'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x68'),require(_0xcfa7('0x69')));_0x3bf816[_0xcfa7('0x9')]('/api/chat/proactive_actions',require(_0xcfa7('0x6a')));_0x3bf816[_0xcfa7('0x9')]('/api/cm/companies',require(_0xcfa7('0x6b')));_0x3bf816[_0xcfa7('0x9')]('/api/cm/contacts',require(_0xcfa7('0x6c')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x6d'),require('./api/cmHopper'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x6e'),require(_0xcfa7('0x6f')));_0x3bf816[_0xcfa7('0x9')]('/api/cm/hopper_final',require(_0xcfa7('0x70')));_0x3bf816['use'](_0xcfa7('0x71'),require(_0xcfa7('0x72')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x73'),require(_0xcfa7('0x74')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x75'),require(_0xcfa7('0x76')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x77'),require('./api/automation'));_0x3bf816['use']('/api/canned_answers',require(_0xcfa7('0x78')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x79'),require(_0xcfa7('0x7a')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x7b'),require(_0xcfa7('0x7c')));_0x3bf816['use'](_0xcfa7('0x7d'),require(_0xcfa7('0x7e')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x7f'),require('./api/pause'));_0x3bf816['use'](_0xcfa7('0x80'),require(_0xcfa7('0x81')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x82'),require('./api/voiceQueuesLog'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x83'),require(_0xcfa7('0x84')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x85'),require('./api/sound'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x86'),require('./api/tag'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x87'),require(_0xcfa7('0x88')));_0x3bf816['use'](_0xcfa7('0x89'),require('./api/trigger'));_0x3bf816['use']('/api/variables',require(_0xcfa7('0x8a')));_0x3bf816['use'](_0xcfa7('0x8b'),require(_0xcfa7('0x8c')));_0x3bf816['use']('/api/integrations/reports',require(_0xcfa7('0x8d')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x8e'),require('./api/analyticCustomReport'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x8f'),require(_0xcfa7('0x90')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x91'),require(_0xcfa7('0x92')));_0x3bf816[_0xcfa7('0x9')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x93'),require('./api/analyticFieldReport'));_0x3bf816['use'](_0xcfa7('0x94'),require('./api/analyticTreeReport'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x95'),require(_0xcfa7('0x96')));_0x3bf816['use'](_0xcfa7('0x97'),require('./api/intSalesforceConfiguration'));_0x3bf816[_0xcfa7('0x9')]('/api/integrations/salesforce/fields',require(_0xcfa7('0x98')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x99'),require(_0xcfa7('0x9a')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x9b'),require(_0xcfa7('0x9c')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x9d'),require(_0xcfa7('0x9e')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x9f'),require(_0xcfa7('0xa0')));_0x3bf816[_0xcfa7('0x9')]('/api/integrations/desk/configurations',require(_0xcfa7('0xa1')));_0x3bf816['use'](_0xcfa7('0xa2'),require(_0xcfa7('0xa3')));_0x3bf816['use'](_0xcfa7('0xa4'),require(_0xcfa7('0xa5')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xa6'),require('./api/intZohoConfiguration'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xa7'),require(_0xcfa7('0xa8')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xa9'),require('./api/intZendeskAccount'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xaa'),require('./api/intZendeskConfiguration'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xab'),require('./api/intZendeskField'));_0x3bf816[_0xcfa7('0x9')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xac'),require(_0xcfa7('0xad')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xae'),require(_0xcfa7('0xaf')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xb0'),require('./api/intVtigerAccount'));_0x3bf816['use'](_0xcfa7('0xb1'),require(_0xcfa7('0xb2')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xb3'),require('./api/intVtigerField'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xb4'),require(_0xcfa7('0xb5')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xb6'),require(_0xcfa7('0xb7')));_0x3bf816[_0xcfa7('0x9')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x3bf816['use'](_0xcfa7('0xb8'),require(_0xcfa7('0xb9')));_0x3bf816[_0xcfa7('0x9')]('/api/integrations/dynamics365/configurations',require(_0xcfa7('0xba')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xbb'),require(_0xcfa7('0xbc')));_0x3bf816['use'](_0xcfa7('0xbd'),require('./api/intFreshsalesAccount'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xbe'),require(_0xcfa7('0xbf')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xc0'),require(_0xcfa7('0xc1')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xc2'),require(_0xcfa7('0xc3')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xc4'),require(_0xcfa7('0xc5')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xc6'),require(_0xcfa7('0xc7')));_0x3bf816['use'](_0xcfa7('0xc8'),require(_0xcfa7('0xc9')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xca'),require(_0xcfa7('0xcb')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xcc'),require(_0xcfa7('0xcd')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xce'),require(_0xcfa7('0xcf')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xd0'),require(_0xcfa7('0xd1')));_0x3bf816[_0xcfa7('0x9')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x3bf816['use'](_0xcfa7('0xd2'),require('./api/jscriptyProject'));_0x3bf816['use']('/api/settings',require(_0xcfa7('0xd3')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xd4'),require(_0xcfa7('0xd5')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xd6'),require('./api/squareProject'));_0x3bf816[_0xcfa7('0x9')]('/api/square/recordings',require(_0xcfa7('0xd7')));_0x3bf816[_0xcfa7('0x9')]('/api/square/messages',require(_0xcfa7('0xd8')));_0x3bf816[_0xcfa7('0x9')]('/api/teams',require(_0xcfa7('0xd9')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xda'),require(_0xcfa7('0xdb')));_0x3bf816['use'](_0xcfa7('0xdc'),require(_0xcfa7('0xdd')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xde'),require(_0xcfa7('0xdf')));_0x3bf816[_0xcfa7('0x9')]('/api/attachments',require(_0xcfa7('0xe0')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xe1'),require(_0xcfa7('0xe2')));_0x3bf816[_0xcfa7('0x9')]('/api/mail/reports/transfer',require(_0xcfa7('0xe3')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xe4'),require('./api/chatTransferReport'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xe5'),require(_0xcfa7('0xe6')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xe7'),require(_0xcfa7('0xe8')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xe9'),require('./api/smsTransferReport'));_0x3bf816['use'](_0xcfa7('0xea'),require(_0xcfa7('0xeb')));_0x3bf816['use'](_0xcfa7('0xec'),require(_0xcfa7('0xed')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xee'),require(_0xcfa7('0xef')));_0x3bf816['use'](_0xcfa7('0xf0'),require('./api/userProfileSection'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xf1'),require('./api/userProfileResource'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xf2'),require(_0xcfa7('0xf3')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xf4'),require(_0xcfa7('0xf5')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xf6'),require(_0xcfa7('0xf7')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xf8'),require(_0xcfa7('0xf9')));_0x3bf816[_0xcfa7('0x9')]('/api/whatsapp/interactions',require(_0xcfa7('0xfa')));_0x3bf816[_0xcfa7('0x9')]('/api/whatsapp/messages',require(_0xcfa7('0xfb')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xfc'),require(_0xcfa7('0xfd')));_0x3bf816[_0xcfa7('0x9')]('/api/whatsapp/reports/transfer',require(_0xcfa7('0xfe')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0xff'),require(_0xcfa7('0x100')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x101'),require(_0xcfa7('0x102')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x103'),require(_0xcfa7('0x104')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x105'),require('./api/authGoogle'));_0x3bf816['use'](_0xcfa7('0x106'),require('./api/jira'));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x107'),require(_0xcfa7('0x108')));_0x3bf816['use'](_0xcfa7('0x109'),require(_0xcfa7('0x10a')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x10b'),require(_0xcfa7('0x10c')));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x10d'),require(_0xcfa7('0x10e')));_0x3bf816[_0xcfa7('0x9')]('/api/webbar',require(_0xcfa7('0x10f')));_0x3bf816[_0xcfa7('0x9')]('/apidoc',express[_0xcfa7('0x110')](path[_0xcfa7('0x111')](config['root'],_0xcfa7('0x112'))));_0x3bf816[_0xcfa7('0x9')]('/www',express['static'](path[_0xcfa7('0x111')](config[_0xcfa7('0x113')],_0xcfa7('0x114'))));_0x3bf816['use'](_0xcfa7('0x115'),express[_0xcfa7('0x110')](path['join'](config[_0xcfa7('0x113')],_0xcfa7('0x115'))));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x116'),express[_0xcfa7('0x110')](path[_0xcfa7('0x111')](config[_0xcfa7('0x113')],_0xcfa7('0x117'),_0xcfa7('0x118'))));_0x3bf816[_0xcfa7('0x9')](_0xcfa7('0x119'),express['static'](path[_0xcfa7('0x111')](config[_0xcfa7('0x113')],_0xcfa7('0x11a'))));_0x3bf816['route'](_0xcfa7('0x11b'))[_0xcfa7('0x11c')](errors[0x194]);_0x3bf816[_0xcfa7('0x11d')]('/*')[_0xcfa7('0x11c')](function(_0x5d2b48,_0x5c5df7){_0x5c5df7[_0xcfa7('0x11e')](path['resolve'](_0x3bf816[_0xcfa7('0x11c')](_0xcfa7('0x11f'))+_0xcfa7('0x120')));});};var sensitiveFields=[_0xcfa7('0x121'),'password',_0xcfa7('0x122'),_0xcfa7('0x123'),_0xcfa7('0x124'),_0xcfa7('0x125'),'street',_0xcfa7('0x126'),_0xcfa7('0x127'),_0xcfa7('0x128'),_0xcfa7('0x129'),_0xcfa7('0x12a'),'clientSecret',_0xcfa7('0x12b'),'code',_0xcfa7('0x12c'),_0xcfa7('0x12d'),_0xcfa7('0x12e'),_0xcfa7('0x12f'),_0xcfa7('0x130'),'accessTokenSecret',_0xcfa7('0x131'),_0xcfa7('0x132'),_0xcfa7('0x133'),_0xcfa7('0x134'),'calleridname','calleridnum',_0xcfa7('0x135'),'vidaooApiKey',_0xcfa7('0x136'),_0xcfa7('0x137'),_0xcfa7('0x138'),_0xcfa7('0x139'),_0xcfa7('0x13a'),_0xcfa7('0x17'),_0xcfa7('0x13b'),_0xcfa7('0x13c'),_0xcfa7('0x13d'),'dsn',_0xcfa7('0x13e'),_0xcfa7('0x13f'),'oldPassword'];function maskSensitiveData(_0x202d6b){var _0x1af2fc=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x202d6b))return;for(var _0x17e697 in _0x202d6b){if(_[_0xcfa7('0x140')](_0x202d6b[_0x17e697])){for(var _0xb08890=0x0;_0xb08890<_0x202d6b[_0x17e697][_0xcfa7('0x141')];_0xb08890++){maskSensitiveData(_0x202d6b[_0x17e697][_0xb08890]);}}else if(_[_0xcfa7('0x142')](_0x202d6b[_0x17e697])){maskSensitiveData(_0x202d6b[_0x17e697]);}else if(_[_0xcfa7('0x143')](_0x202d6b[_0x17e697])){_0x202d6b[_0x17e697]=_0x202d6b[_0x17e697][_0xcfa7('0x144')](/{{{/g,_0xcfa7('0x145'))['replace'](/}}}/g,_0xcfa7('0x146'))[_0xcfa7('0x144')](/{{/g,'@{')[_0xcfa7('0x144')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x17e697)){_0x202d6b[_0x17e697]=_0x202d6b[_0x17e697]['replace'](_0x1af2fc,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 3781859..303f0cb 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbaa=['Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../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/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.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/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../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/interval/interval.rpc','../api/pause/pause.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcbaa,0x1a6));var _0xacba=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xcbaa[_0x3d42d8];return _0x27fc41;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xacba('0x0'));var _=require(_0xacba('0x1'));var config=require(_0xacba('0x2'));exports[_0xacba('0x3')]=function(){return new BPromise(function(_0x1f728b,_0x5dbe18){var _0x347b84={};_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x5')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x6')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x7')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x8')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x9')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0xa')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0xb')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0xc')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0xd')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0xe')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0xf')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x10')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x11')));_0x347b84=_['merge'](_0x347b84,require('../api/mailAccount/mailAccount.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x12')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x13')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x14')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x15')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x16')));_0x347b84=_['merge'](_0x347b84,require('../api/faxAccount/faxAccount.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x17')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x18')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x19')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x1a')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x1b')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/smsAccount/smsAccount.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x1c')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x1d')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/smsQueue/smsQueue.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x1e')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x1f')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x20')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x21')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x22')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x23')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x24')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x25')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x26')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x27')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x28')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x29')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x2a')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x2b')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/sound/sound.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/template/template.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/trigger/trigger.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x2c')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x2d')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x2e')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x2f')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x30')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x31')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x32')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x33')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x34')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x35')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x36')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/squareOdbc/squareOdbc.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/squareProject/squareProject.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x37')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x38')));_0x347b84=_['merge'](_0x347b84,require('../api/campaign/campaign.rpc'));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x39')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x3a')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x3b')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x3c')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x3d')));var _0x1c5803=jayson[_0xacba('0x3e')](_0x347b84)[_0xacba('0x3f')]();var _0xf4346d=config[_0xacba('0x40')][_0xacba('0x41')]||config[_0xacba('0x41')]+0x1;var _0x16089f=config[_0xacba('0x40')]['ip']||'localhost';_0x1c5803['on'](_0xacba('0x42'),function(_0x5f090c){return _0x5dbe18(_0x5f090c);});_0x1c5803[_0xacba('0x3')](_0xf4346d,_0x16089f,function(){console[_0xacba('0x43')](_0xacba('0x44'),_0x16089f,_0xf4346d);require('../config/triggers')['default']();return _0x1f728b(_0xacba('0x45')+_0x16089f+':'+_0xf4346d);});});}; \ No newline at end of file +var _0xe678=['../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.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/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.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/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc'];(function(_0x2786ed,_0x1ac975){var _0x2fd008=function(_0x3f9e56){while(--_0x3f9e56){_0x2786ed['push'](_0x2786ed['shift']());}};_0x2fd008(++_0x1ac975);}(_0xe678,0xd1));var _0x8e67=function(_0x38c99d,_0x3908ad){_0x38c99d=_0x38c99d-0x0;var _0x573efb=_0xe678[_0x38c99d];return _0x573efb;};'use strict';var jayson=require(_0x8e67('0x0'));var BPromise=require(_0x8e67('0x1'));var _=require(_0x8e67('0x2'));var config=require(_0x8e67('0x3'));exports[_0x8e67('0x4')]=function(){return new BPromise(function(_0x3dc15a,_0x4821eb){var _0x14f473={};_0x14f473=_['merge'](_0x14f473,require('../api/user/user.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x6')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require('../api/voiceQueue/voiceQueue.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x7')));_0x14f473=_['merge'](_0x14f473,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x8')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x9')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0xa')));_0x14f473=_['merge'](_0x14f473,require('../api/memberReport/memberReport.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0xb')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0xc')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0xd')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0xe')));_0x14f473=_['merge'](_0x14f473,require(_0x8e67('0xf')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require('../api/mailInteraction/mailInteraction.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x10')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x11')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x12')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require('../api/faxAccount/faxAccount.rpc'));_0x14f473=_['merge'](_0x14f473,require(_0x8e67('0x13')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require('../api/faxInteraction/faxInteraction.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x14')));_0x14f473=_['merge'](_0x14f473,require('../api/faxQueue/faxQueue.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x15')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x16')));_0x14f473=_['merge'](_0x14f473,require(_0x8e67('0x17')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x18')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x19')));_0x14f473=_['merge'](_0x14f473,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x1a')));_0x14f473=_['merge'](_0x14f473,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x1b')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require('../api/chatInteraction/chatInteraction.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x1c')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x1d')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require('../api/cmContact/cmContact.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x1e')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x1f')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x20')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x21')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x22')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x23')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require('../api/pause/pause.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require('../api/sound/sound.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x24')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x25')));_0x14f473=_['merge'](_0x14f473,require(_0x8e67('0x26')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x27')));_0x14f473=_['merge'](_0x14f473,require(_0x8e67('0x28')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x29')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x2a')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x2b')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x2c')));_0x14f473=_['merge'](_0x14f473,require(_0x8e67('0x2d')));_0x14f473=_['merge'](_0x14f473,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x2e')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x2f')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x30')));_0x14f473=_['merge'](_0x14f473,require(_0x8e67('0x31')));_0x14f473=_['merge'](_0x14f473,require(_0x8e67('0x32')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x33')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x34')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x35')));_0x14f473=_['merge'](_0x14f473,require(_0x8e67('0x36')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x37')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x38')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x39')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x3a')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x3b')));_0x14f473=_['merge'](_0x14f473,require(_0x8e67('0x3c')));_0x14f473=_[_0x8e67('0x5')](_0x14f473,require(_0x8e67('0x3d')));var _0x25f6ec=jayson[_0x8e67('0x3e')](_0x14f473)[_0x8e67('0x3f')]();var _0x53eb75=config['rpc'][_0x8e67('0x40')]||config[_0x8e67('0x40')]+0x1;var _0x5d94c7=config[_0x8e67('0x41')]['ip']||_0x8e67('0x42');_0x25f6ec['on'](_0x8e67('0x43'),function(_0x5d5917){return _0x4821eb(_0x5d5917);});_0x25f6ec[_0x8e67('0x4')](_0x53eb75,_0x5d94c7,function(){console[_0x8e67('0x44')](_0x8e67('0x45'),_0x5d94c7,_0x53eb75);require(_0x8e67('0x46'))[_0x8e67('0x47')]();return _0x3dc15a(_0x8e67('0x48')+_0x5d94c7+':'+_0x53eb75);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 4cde449..b633c6d 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 _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x15ba03,_0x1996a1){var _0x5ed191=function(_0x4bc2f5){while(--_0x4bc2f5){_0x15ba03['push'](_0x15ba03['shift']());}};_0x5ed191(++_0x1996a1);}(_0x70e0,0x17b));var _0x070e=function(_0x3184ae,_0x34e9ba){_0x3184ae=_0x3184ae-0x0;var _0x2a6fee=_0x70e0[_0x3184ae];return _0x2a6fee;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=AGIChannel; \ No newline at end of file +var _0xcb91=['GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','EventEmitter','./reply','./error','call','utf8','setTimeout','headers','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','sendRequest','sync','prototype','answer','getData','beep','format'];(function(_0x367a3d,_0x452717){var _0x460539=function(_0x1e8beb){while(--_0x1e8beb){_0x367a3d['push'](_0x367a3d['shift']());}};_0x460539(++_0x452717);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0xcb91[_0x4c7d8b];return _0x187158;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x1cb9('0x0'))[_0x1cb9('0x1')];var AGIReply=require(_0x1cb9('0x2'));var AGIError=require(_0x1cb9('0x3'));function AGIChannel(_0x4c37e8){var _0x8c392f=this,_0x2c17b8=new AGIReply(),_0x545a34=![],_0x13d5fd={};EventEmitter[_0x1cb9('0x4')](_0x8c392f);_0x4c37e8['setEncoding'](_0x1cb9('0x5'));_0x4c37e8[_0x1cb9('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2c17b8['setEncoding'](_0x1cb9('0x5'));_0x2c17b8['on'](_0x1cb9('0x7'),function(_0x59d1be){for(var _0x3ae0f1 in _0x59d1be){_0x8c392f[_0x3ae0f1]=_0x59d1be[_0x3ae0f1];}_0x8c392f['emit']('ready');});_0x2c17b8['on'](_0x1cb9('0x8'),function(_0x2fa15c){if(_0x2fa15c[_0x1cb9('0x9')]()==_0x1cb9('0xa')){_0x8c392f[_0x1cb9('0xb')]('hangup');return;}if(_0x2fa15c[_0x1cb9('0xc')](0x0,0xb)==_0x1cb9('0xd')){_0x545a34=!![];}if(_0x545a34){_0x13d5fd['rx']+=_0x2fa15c+'\x0a';if(_0x2fa15c[_0x1cb9('0xe')](_0x1cb9('0xf'))!=-0x1){_0x545a34=![];}}else{_0x13d5fd['rx']=_0x2fa15c;}if(_0x545a34){return;}if(typeof _0x13d5fd['cb']==_0x1cb9('0x10')){var _0x5445e1=_0x13d5fd['rx'][_0x1cb9('0xc')](0x0,0x3),_0x5e3c19=null,_0x59dec3=null;_0x5445e1=parseInt(_0x5445e1);if(isNaN(_0x5445e1)){_0x13d5fd['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1cb9('0x11')});return;}if(_0x5445e1!=0xc8){_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':-0x1,'extra':'KO'});return;}_0x5e3c19=_0x13d5fd['rx'][_0x1cb9('0xc')](0x4)[_0x1cb9('0x12')]('result=','');if(_0x5e3c19[_0x1cb9('0x13')]('\x20')!=-0x1){_0x5e3c19=_0x5e3c19[_0x1cb9('0x14')](0x0,_0x5e3c19[_0x1cb9('0x13')]('\x20'));}if(_[_0x1cb9('0x15')](_0x5e3c19,'-1')){_0x5e3c19=parseInt(_0x5e3c19);}_0x59dec3=_0x13d5fd['rx'][_0x1cb9('0x16')]('\x20');if(_0x59dec3['length']==0x3){_0x59dec3=_0x59dec3[0x2]['substring'](0x1,_0x59dec3[0x2][_0x1cb9('0x17')]-0x1);}else if(_0x59dec3[_0x1cb9('0x17')]>0x3){var _0x3904b7=/\((.+)\)/;var _0x3f1376=_0x13d5fd['rx'][_0x1cb9('0x18')](_0x3904b7);if(_0x3f1376){_0x59dec3=_0x3f1376[0x1];}else{_0x59dec3=null;}}else{_0x59dec3=null;}_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':_0x5e3c19,'extra':_0x59dec3});}});_0x4c37e8['on'](_0x1cb9('0x19'),function(_0x23d3a9){_0x8c392f['emit']('error',new AGIError(_0x1cb9('0x1a'),_0x23d3a9[_0x1cb9('0x1b')]));});_0x4c37e8['on'](_0x1cb9('0x1c'),function(){_0x8c392f[_0x1cb9('0xb')](_0x1cb9('0x1c'),new AGIError(_0x1cb9('0x1d')));});_0x4c37e8['on'](_0x1cb9('0x1e'),function(){_0x8c392f['emit']('timeout',new AGIError(_0x1cb9('0x1f')));_0x4c37e8['destroy']();});_0x4c37e8[_0x1cb9('0x20')](_0x2c17b8);this[_0x1cb9('0x21')]=function(_0x523b26,_0x599275){var _0x523b26=_0x523b26||'',_0x599275=typeof _0x599275==_0x1cb9('0x10')?_0x599275:new Function();_0x13d5fd={'tx':_0x523b26,'rx':'','cb':_0x599275};_0x4c37e8[_0x1cb9('0x22')](_0x523b26+'\x0a');},this[_0x1cb9('0x1c')]=function(){_0x4c37e8[_0x1cb9('0x23')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1cb9('0x24')]=function(_0x557199){return this[_0x1cb9('0x21')][_0x1cb9('0x25')](this,_0x557199);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x27')]=function(){return this[_0x1cb9('0x24')]('ANSWER');};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x28')]=function(_0x4c8d76,_0xd6891c,_0x21effa){_0x4c8d76=_0x4c8d76===undefined?_0x1cb9('0x29'):_0x4c8d76;_0xd6891c=_0xd6891c===undefined?'5':_0xd6891c;_0x21effa=_0x21effa===undefined?'1':_0x21effa;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2b'),_0x4c8d76,_0xd6891c*0x3e8,_0x21effa));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x2c')]=function(_0x41e5c2){_0x41e5c2=_0x41e5c2||_0x1cb9('0x2d');return this['sendRequest'](util[_0x1cb9('0x2a')]('VERBOSE\x20\x22%s\x22',_0x41e5c2));};AGIChannel[_0x1cb9('0x26')]['exec']=function(_0x278327,_0x41011c){if(_[_0x1cb9('0x2e')](_0x41011c)){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x2f'),_0x278327,_0x41011c['join'](',')));}return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2f'),_0x278327,_0x41011c));};AGIChannel['prototype'][_0x1cb9('0x30')]=function(_0x5e84fd){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x31'),_0x5e84fd));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x32')]=function(_0xae910){return this['sendRequest'](util[_0x1cb9('0x2a')](_0x1cb9('0x33'),_0xae910));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x34')]=function(_0xc6784c){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x35'),_0xc6784c));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0xa')]=function(){return this[_0x1cb9('0x24')](_0x1cb9('0x36'));};AGIChannel[_0x1cb9('0x26')]['setVariable']=function(_0x54c6e6,_0x299ff8){var _0x30f7e4=_[_0x1cb9('0x37')](_0x299ff8)||_[_0x1cb9('0x38')](_0x299ff8)?_0x299ff8[_0x1cb9('0x39')]():_0x299ff8;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3a'),_0x54c6e6,_0x30f7e4?_0x30f7e4['toString']()[_0x1cb9('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3b')]=function(_0x5350f9,_0x2a5aac){return this['sendRequest'](util[_0x1cb9('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x5350f9,_0x2a5aac));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3c')]=function(_0x289b73,_0x2bcacd){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3d'),_0x289b73,_0x2bcacd));};AGIChannel['prototype']['sayPhonetic']=function(_0x4111b8,_0x1d2723){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3e'),_0x4111b8,_0x1d2723));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3f')]=function(_0x4a670c,_0xbcaa32,_0x47edad){_0xbcaa32=_0xbcaa32||this['extension'];_0x47edad=_0x47edad||0x1;this['setContext'](_0x4a670c);this[_0x1cb9('0x32')](_0xbcaa32);this[_0x1cb9('0x34')](_0x47edad);return this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x40'),_0x4a670c,_0xbcaa32,_0x47edad));};AGIChannel['prototype'][_0x1cb9('0x41')]=function(_0x523866){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x42'),_0x523866));};AGIChannel['prototype'][_0x1cb9('0x43')]=function(_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x5839aa,_0x24c643){_0xda1a44=_0xda1a44||_0x1cb9('0x44');_0xbc36fc=_0xbc36fc||'';_0x51a898=_0x51a898===undefined?-0x1:_0x51a898==='-1'?-0x1:_0x51a898*0x3e8;_0x5839aa=_0x5839aa===undefined?'':'s='+_0x5839aa;_0x24c643=_0x24c643?_0x1cb9('0x45'):'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x24c643,_0x5839aa));};AGIChannel[_0x1cb9('0x26')]['streamFile']=function(_0x4c59e7,_0x495335){_0x495335=_0x495335||'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x46'),_0x4c59e7,_0x495335));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x47')]=function(_0x2a8b7f){return this[_0x1cb9('0x48')](_0x1cb9('0x49'),_0x2a8b7f);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x4a')]=function(_0x3ea88c){return this['exec'](_0x1cb9('0x4b'),_0x3ea88c);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x19')]=function(_0x55255c,_0x179e81){this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x4c'),_0x55255c['id'],_0x55255c[_0x1cb9('0x4d')],_0x179e81));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f713cd8..635ba37 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 _0x95f7=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','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.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x50dcf3,_0x2b9138){var _0x486f98=function(_0x29c660){while(--_0x29c660){_0x50dcf3['push'](_0x50dcf3['shift']());}};_0x486f98(++_0x2b9138);}(_0x95f7,0x68));var _0x795f=function(_0x1d082e,_0xa116a1){_0x1d082e=_0x1d082e-0x0;var _0x27df12=_0x95f7[_0x1d082e];return _0x27df12;};'use strict';var util=require(_0x795f('0x0'));var error={'E_AGI_UNDEFINED':_0x795f('0x1'),'E_AGI_ARGUMENT_PORT':_0x795f('0x2'),'E_AGI_SERVER_ERROR':_0x795f('0x3'),'E_AGI_SERVER_CLOSE':_0x795f('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x795f('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x795f('0x6'),'E_AGI_SOCKET_CLOSE':_0x795f('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x795f('0x8'),'E_AGI_COMMAND_EMPTY':_0x795f('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x795f('0xa'),'E_AGI_IVR_ENTRY':_0x795f('0xb')};function AGIError(_0x1b4d8e){var _0x1b4d8e=_0x1b4d8e||null,_0x2749ec=_0x2749ec||[],_0x45371f=0x1,_0x547b6f='';if(!error[_0x1b4d8e]){_0x1b4d8e=_0x795f('0xc');}_0x2749ec[_0x795f('0xd')](error[_0x1b4d8e]);while(arguments[_0x45371f]){_0x2749ec[_0x795f('0xd')](arguments[_0x45371f]);_0x45371f++;}_0x547b6f=util[_0x795f('0xe')][_0x795f('0xf')](util,_0x2749ec);this[_0x795f('0x10')]=_0x547b6f;this[_0x795f('0x11')]=_0x1b4d8e;}module[_0x795f('0x12')]=AGIError; \ No newline at end of file +var _0x528f=['message','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x528f,0x140));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xf528('0x0'),'E_AGI_ARGUMENT_PORT':_0xf528('0x1'),'E_AGI_SERVER_ERROR':_0xf528('0x2'),'E_AGI_SERVER_CLOSE':_0xf528('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xf528('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xf528('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xf528('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xf528('0x7')};function AGIError(_0x17c8c8){var _0x17c8c8=_0x17c8c8||null,_0x31b491=_0x31b491||[],_0xd517b6=0x1,_0x1b6bfd='';if(!error[_0x17c8c8]){_0x17c8c8=_0xf528('0x8');}_0x31b491['push'](error[_0x17c8c8]);while(arguments[_0xd517b6]){_0x31b491['push'](arguments[_0xd517b6]);_0xd517b6++;}_0x1b6bfd=util[_0xf528('0x9')]['apply'](util,_0x31b491);this[_0xf528('0xa')]=_0x1b6bfd;this['name']=_0x17c8c8;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 78ac1f6..649a5b2 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 _0x3266=['length','condition','split','agicommand','vswitch','target','default','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','addVertex','prototype','push','size','relations','getVertex','no\x20vertex\x20found','info','stop\x20traverse'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0x3266,0x6a));var _0x6326=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x3266[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x6326('0x0'));var logger=require(_0x6326('0x1'))(_0x6326('0x2'));var verticesWithRetry=[_0x6326('0x3'),_0x6326('0x4'),_0x6326('0x5')];var Graph=function(){this[_0x6326('0x6')]={};this[_0x6326('0x7')]={};this[_0x6326('0x8')]=0x0;};Graph['prototype'][_0x6326('0x9')]=function(_0x5f38a3){this[_0x6326('0x6')][_0x5f38a3['id']]=_0x5f38a3;this[_0x6326('0x7')][_0x5f38a3['id']]=[];};Graph[_0x6326('0xa')]['addEdge']=function(_0x161f4e,_0x5730e7,_0x2af571){this[_0x6326('0x7')][_0x161f4e][_0x6326('0xb')]({'target':_0x5730e7,'condition':_0x2af571});this[_0x6326('0x8')]+=0x1;};Graph[_0x6326('0xa')]['size']=function(){return _[_0x6326('0xc')](this[_0x6326('0x6')]);};Graph[_0x6326('0xa')][_0x6326('0xd')]=function(){return this[_0x6326('0x8')];};Graph[_0x6326('0xa')][_0x6326('0xe')]=function(_0x77c4e){return this[_0x6326('0x6')][_0x77c4e];};Graph[_0x6326('0xa')]['traverseBFS']=function(_0x5381d0,_0x301f34){if(!this[_0x6326('0x6')][_0x5381d0]){return logger['info'](_0x6326('0xf'));}var _0x4caef3=_0x301f34(this[_0x6326('0x6')][_0x5381d0]);if(!_0x4caef3){return logger[_0x6326('0x10')](_0x6326('0x11'));}if(this[_0x6326('0x7')][_0x5381d0][_0x6326('0x12')]===0x0){return logger[_0x6326('0x10')]('no\x20edge/s\x20available');}for(var _0x1104c5=0x0,_0x518e6f=[],_0x5945ee=![];_0x1104c5\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','continueAt','close','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','syncho','util','moment','agi','./rpc','./vertices','defaults','127.0.0.1','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','root','agicommand','hasOwnProperty','retry','omit','isArray','length','source','addEdge','value','getSquareProject','then'];(function(_0x332a1b,_0x3744dd){var _0x2d1144=function(_0x24f4ad){while(--_0x24f4ad){_0x332a1b['push'](_0x332a1b['shift']());}};_0x2d1144(++_0x3744dd);}(_0x4006,0x1c7));var _0x6400=function(_0x654001,_0x4f073c){_0x654001=_0x654001-0x0;var _0x325731=_0x4006[_0x654001];return _0x325731;};'use strict';var parser=require('xml2json');var _=require(_0x6400('0x0'));var syncho=require(_0x6400('0x1'));var util=require(_0x6400('0x2'));var moment=require(_0x6400('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x6400('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x6400('0x5'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x6400('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x6400('0x7')](config[_0x6400('0x4')],{'ip':_0x6400('0x8'),'port':0x11dd});function connectionHandler(_0x250dba){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x250dba);agiHandler(_0x250dba);}catch(_0x31cc99){logger[_0x6400('0x9')](_0x31cc99[_0x6400('0xa')]);}});});}function listeningHandler(){console[_0x6400('0xb')](_0x6400('0xc'),config[_0x6400('0x4')][_0x6400('0xd')]);logger[_0x6400('0xe')](util[_0x6400('0xf')](_0x6400('0x10'),config[_0x6400('0x4')]['ip'],config['agi'][_0x6400('0xd')]));}function errorHandler(_0x3a408e){if(_0x3a408e&&_0x3a408e[_0x6400('0x11')]&&_0x3a408e[_0x6400('0x12')]){logger['error'](util[_0x6400('0xf')](_0x6400('0x13'),_0x3a408e['name'],_0x3a408e['message']));}else{logger['error'](util[_0x6400('0xf')](_0x6400('0x14'),_0x3a408e['stack']));}}function closeHandler(){logger[_0x6400('0xe')](util['format'](_0x6400('0x15'),this['arg_1'],this[_0x6400('0x16')],this[_0x6400('0x17')],this[_0x6400('0x18')],this[_0x6400('0x19')]));try{createSquareReport(this);}catch(_0x49d412){logger[_0x6400('0x9')](_0x49d412[_0x6400('0xa')]);}}function timeoutHandler(){logger[_0x6400('0xe')](util['format'](_0x6400('0x1a'),this[_0x6400('0x1b')],this['calleridname'],this[_0x6400('0x17')],this[_0x6400('0x18')],this[_0x6400('0x19')]));}function hangupHandler(){logger['info'](util[_0x6400('0xf')](_0x6400('0x1c'),this[_0x6400('0x1b')],this[_0x6400('0x16')],this[_0x6400('0x17')],this[_0x6400('0x18')],this[_0x6400('0x19')]));this[_0x6400('0x1d')]=!![];}function getRoot(_0x22eb63){return parser[_0x6400('0x1e')](_0x22eb63,{'object':!![]})['mxGraphModel'][_0x6400('0x1f')];}function addVertex(_0x50c29e,_0x589b7c,_0x257d80){_0x589b7c[_0x6400('0x20')]=_0x257d80;if(_0x589b7c[_0x6400('0x21')](_0x6400('0x22'))){_0x589b7c['maxRetry']=parseInt(_0x589b7c[_0x6400('0x22')],0xa);}_0x50c29e['addVertex'](_[_0x6400('0x23')](_0x589b7c,'mxCell'));}function initGraph(_0x3bcb28,_0x246433){var _0x577156=new Graph();for(var _0x434550 in _0x3bcb28){if(_0x3bcb28[_0x6400('0x21')](_0x434550)){if(_[_0x6400('0x24')](_0x3bcb28[_0x434550])){for(var _0x56b285=0x0;_0x56b285<_0x3bcb28[_0x434550][_0x6400('0x25')];_0x56b285+=0x1){addVertex(_0x577156,_0x3bcb28[_0x434550][_0x56b285],_0x434550);}}else{addVertex(_0x577156,_0x3bcb28[_0x434550],_0x434550);}}}for(var _0x5116ea=0x0;_0x5116ea<_0x246433['length'];_0x5116ea+=0x1){if(_0x246433[_0x5116ea][_0x6400('0x26')]&&_0x246433[_0x5116ea]['target']){_0x577156[_0x6400('0x27')](_0x246433[_0x5116ea][_0x6400('0x26')],_0x246433[_0x5116ea]['target'],_0x246433[_0x5116ea][_0x6400('0x28')]);}}return _0x577156;}function getSquareProject(_0x52eba1,_0x498eaa){rpc[_0x6400('0x29')](_0x52eba1)[_0x6400('0x2a')](function(_0x10005a){_0x498eaa(null,_0x10005a);})[_0x6400('0x2b')](function(_0x1cf032){_0x498eaa(null,_0x1cf032);});}function createSquareReport(_0x54cf9f,_0x3bed65){rpc[_0x6400('0x2c')](_0x54cf9f)[_0x6400('0x2a')](function(_0x1f66c3){if(_0x3bed65){_0x3bed65(null,_0x1f66c3);}})['catch'](function(_0x437624){if(_0x3bed65){_0x3bed65(null,_0x437624);}});}function setChannelVariables(_0x356f4d){for(var _0x115aec in _0x356f4d){if(_0x356f4d['hasOwnProperty'](_0x115aec)){if(_0x115aec[_0x6400('0x2d')](_0x6400('0x2e'))===0x0){_0x356f4d[_0x115aec[_0x6400('0x2f')](0x4)]=_0x356f4d[_0x115aec];delete _0x356f4d[_0x115aec];}}}}function getLogFromObject(_0x3564ac){return util['inspect'](_0x3564ac,{'showHidden':![],'depth':null});}function agiHandler(_0x1aec8b){var _0x111676,_0x53e74c,_0x1e01c7,_0x37ab9a,_0x50ba26;logger['debug'](_0x6400('0x30'),JSON[_0x6400('0x31')](_0x1aec8b,null,0x2));logger[_0x6400('0xe')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1aec8b['arg_1'],_0x1aec8b[_0x6400('0x16')],_0x1aec8b[_0x6400('0x17')],_0x1aec8b[_0x6400('0x18')],_0x1aec8b[_0x6400('0x19')]));_0x1aec8b['on'](_0x6400('0x9'),errorHandler);_0x1aec8b['on']('close',closeHandler);_0x1aec8b['on'](_0x6400('0x32'),timeoutHandler);_0x1aec8b[_0x6400('0x1d')]=![];_0x1aec8b['on']('hangup',hangupHandler);var _0x51425c=getSquareProject[_0x6400('0x33')](null,_0x1aec8b[_0x6400('0x1b')]);if(_0x51425c){if(_0x51425c[_0x6400('0x34')]){_0x111676=getRoot(_0x51425c['production']);if(_0x111676&&_0x111676[_0x6400('0x35')]){logger[_0x6400('0x36')](_0x6400('0x1f'),JSON['stringify'](_0x111676,null,0x2));_0x1aec8b[_0x6400('0x37')]=moment()[_0x6400('0xf')](_0x6400('0x38'));_0x53e74c=initGraph(_['omit'](_0x111676,'mxCell'),_0x111676['mxCell']);_0x1e01c7=new Vertices(_0x1aec8b,rpc,mailRpc);logger[_0x6400('0xe')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1aec8b[_0x6400('0x1b')],_0x1aec8b[_0x6400('0x16')],_0x1aec8b['callerid'],_0x1aec8b[_0x6400('0x18')],_0x1aec8b[_0x6400('0x19')]));_0x53e74c[_0x6400('0x39')](_0x111676['start']['id'],function(_0x9536e5){try{_0x9536e5=_0x1e01c7[_0x6400('0x3a')](_0x9536e5);logger[_0x6400('0x36')](_0x6400('0x3b'),JSON['stringify'](_0x9536e5,null,0x2));if(_0x9536e5['agicommand']===_0x6400('0x3c')){logger[_0x6400('0xe')](_0x6400('0x3d'));_0x1aec8b['context']=_0x9536e5[_0x6400('0x3e')]||_0x1aec8b[_0x6400('0x3e')];_0x1aec8b[_0x6400('0x3f')]=_0x9536e5[_0x6400('0x3f')];_0x1aec8b[_0x6400('0x40')]=_0x9536e5['priority']?_0x9536e5[_0x6400('0x40')]-0x1:0x1;return null;}else if(_0x9536e5&&_0x1e01c7[_0x9536e5['agicommand']]){_0x50ba26=_0x1e01c7[_0x9536e5[_0x6400('0x20')]](_0x9536e5);logger[_0x6400('0xe')](_0x6400('0x41'),JSON[_0x6400('0x31')](_0x50ba26,null,0x2));if(_0x50ba26&&_0x50ba26['code']===AGI_CODE_SUCCESS&&_0x50ba26[_0x6400('0x42')]!==AGI_RESULT_ERROR&&!_0x1aec8b[_0x6400('0x1d')]){logger[_0x6400('0x36')](_0x6400('0x41'),getLogFromObject(_0x50ba26));return _['isUndefined'](_0x50ba26[_0x6400('0x42')])?null:_0x50ba26['result'][_0x6400('0x43')]();}else{logger['error'](_0x6400('0x41'),getLogFromObject(_0x50ba26));return null;}}else{logger[_0x6400('0x9')](_0x6400('0x44'));return null;}}catch(_0x5712f1){logger[_0x6400('0x9')](_0x5712f1['stack']);return null;}});if(_0x111676[_0x6400('0x45')]){logger[_0x6400('0xe')](util[_0x6400('0xf')](_0x6400('0x46'),_0x1aec8b[_0x6400('0x1b')],_0x1aec8b[_0x6400('0x16')],_0x1aec8b[_0x6400('0x17')],_0x1aec8b[_0x6400('0x18')],_0x1aec8b[_0x6400('0x19')]));_0x53e74c[_0x6400('0x39')](_0x111676[_0x6400('0x45')]['id'],function(_0x4b9e9e){try{_0x4b9e9e=_0x1e01c7[_0x6400('0x3a')](_0x4b9e9e);logger[_0x6400('0x36')](_0x6400('0x3b'),JSON['stringify'](_0x4b9e9e,null,0x2));if(_0x4b9e9e&&_0x1e01c7[_0x4b9e9e[_0x6400('0x20')]]){_0x50ba26=_0x1e01c7[_0x4b9e9e[_0x6400('0x20')]](_0x4b9e9e);if(_0x50ba26){logger[_0x6400('0x36')]('response',getLogFromObject(_0x50ba26));return _[_0x6400('0x47')](_0x50ba26['result'])?null:_0x50ba26['result']['toString']();}else{logger[_0x6400('0x9')](_0x6400('0x41'),getLogFromObject(_0x50ba26));return null;}}else{logger['error'](_0x6400('0x44'));return null;}}catch(_0x9737b3){logger['error'](_0x9737b3['stack']);return null;}});}logger[_0x6400('0xe')](util[_0x6400('0xf')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1aec8b[_0x6400('0x1b')],_0x1aec8b[_0x6400('0x16')],_0x1aec8b[_0x6400('0x17')],_0x1aec8b[_0x6400('0x18')],_0x1aec8b[_0x6400('0x19')]));logger[_0x6400('0xe')](util[_0x6400('0xf')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x1aec8b[_0x6400('0x3e')],_0x1aec8b[_0x6400('0x3f')],parseInt(_0x1aec8b[_0x6400('0x40')],0xa)+0x1));_0x1aec8b[_0x6400('0x48')](_0x1aec8b[_0x6400('0x3e')],_0x1aec8b[_0x6400('0x3f')],parseInt(_0x1aec8b[_0x6400('0x40')],0xa)+0x1);_0x1aec8b['close']();}}else{logger[_0x6400('0x9')](util['format']('Project\x20%s\x20not\x20published',_0x1aec8b[_0x6400('0x1b')]));_0x1aec8b[_0x6400('0x48')](_0x1aec8b[_0x6400('0x3e')],_0x1aec8b['extension'],parseInt(_0x1aec8b[_0x6400('0x40')],0xa)+0x1);_0x1aec8b[_0x6400('0x49')]();}}else{logger[_0x6400('0x9')](util[_0x6400('0xf')](_0x6400('0x4a'),_0x1aec8b['arg_1']));_0x1aec8b[_0x6400('0x48')](_0x1aec8b[_0x6400('0x3e')],_0x1aec8b['extension'],parseInt(_0x1aec8b[_0x6400('0x40')],0xa)+0x1);_0x1aec8b[_0x6400('0x49')]();}}function main(){var _0x85a5ac;return utilLicense['getLicense']()[_0x6400('0x2a')](function(_0x489042){if(_0x489042){if(_0x489042[_0x6400('0x4b')]){if(_0x489042[_0x6400('0x4c')]&&_0x489042[_0x6400('0x4c')]>0x0){logger[_0x6400('0xe')](util[_0x6400('0xf')](_0x6400('0x4d'),_0x489042['callysquare']));_0x85a5ac=_0x489042[_0x6400('0x4c')];}else{logger[_0x6400('0xe')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x6400('0xe')](_0x6400('0x4e'));_0x85a5ac=-0x1;}}})[_0x6400('0x2b')](function(_0x17f72d){logger['error'](_0x6400('0x4f'),_0x17f72d[_0x6400('0xa')]);})[_0x6400('0x45')](function(){var _0x3d68d9=require(_0x6400('0x50'))(config[_0x6400('0x4')][_0x6400('0xd')],config[_0x6400('0x4')]['ip'],_0x85a5ac);_0x3d68d9['on'](_0x6400('0x9'),errorHandler);_0x3d68d9['on'](_0x6400('0x51'),listeningHandler);_0x3d68d9['on'](_0x6400('0x52'),connectionHandler);_0x3d68d9['on'](_0x6400('0x49'),closeHandler);});}main(); \ No newline at end of file +var _0xf873=['agi','../../config/license/util','./rpc','./graph','./vertices','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','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','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','vertex','gotoc','context','extension','priority','response','evtHangup','isUndefined','result','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','clear','[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','then','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xf873,0xb2));var _0x3f87=function(_0xa51f4b,_0x4f420d){_0xa51f4b=_0xa51f4b-0x0;var _0x322845=_0xf873[_0xa51f4b];return _0x322845;};'use strict';var parser=require('xml2json');var _=require(_0x3f87('0x0'));var syncho=require(_0x3f87('0x1'));var util=require(_0x3f87('0x2'));var moment=require(_0x3f87('0x3'));var config=require(_0x3f87('0x4'));var logger=require(_0x3f87('0x5'))(_0x3f87('0x6'));var utilLicense=require(_0x3f87('0x7'));var rpc=require(_0x3f87('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0x3f87('0x9'));var Vertices=require(_0x3f87('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x3f87('0x6')]=_['defaults'](config[_0x3f87('0x6')],{'ip':_0x3f87('0xb'),'port':0x11dd});function connectionHandler(_0x3b8e92){process[_0x3f87('0xc')](function(){syncho(function(){try{setChannelVariables(_0x3b8e92);agiHandler(_0x3b8e92);}catch(_0xd9391d){logger[_0x3f87('0xd')](_0xd9391d['stack']);}});});}function listeningHandler(){console[_0x3f87('0xe')](_0x3f87('0xf'),config[_0x3f87('0x6')][_0x3f87('0x10')]);logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x13'),config[_0x3f87('0x6')]['ip'],config[_0x3f87('0x6')][_0x3f87('0x10')]));}function errorHandler(_0x42fde8){if(_0x42fde8&&_0x42fde8[_0x3f87('0x14')]&&_0x42fde8[_0x3f87('0x15')]){logger[_0x3f87('0xd')](util['format'](_0x3f87('0x16'),_0x42fde8[_0x3f87('0x14')],_0x42fde8['message']));}else{logger[_0x3f87('0xd')](util[_0x3f87('0x12')](_0x3f87('0x17'),_0x42fde8[_0x3f87('0x18')]));}}function closeHandler(){logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x19'),this[_0x3f87('0x1a')],this['calleridname'],this[_0x3f87('0x1b')],this[_0x3f87('0x1c')],this[_0x3f87('0x1d')]));try{createSquareReport(this);}catch(_0x4e1df8){logger[_0x3f87('0xd')](_0x4e1df8['stack']);}}function timeoutHandler(){logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x1e'),this[_0x3f87('0x1a')],this[_0x3f87('0x1f')],this['callerid'],this[_0x3f87('0x1c')],this[_0x3f87('0x1d')]));}function hangupHandler(){logger[_0x3f87('0x11')](util[_0x3f87('0x12')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this[_0x3f87('0x1b')],this[_0x3f87('0x1c')],this[_0x3f87('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x17e411){return parser[_0x3f87('0x20')](_0x17e411,{'object':!![]})[_0x3f87('0x21')][_0x3f87('0x22')];}function addVertex(_0x15fad7,_0x46d773,_0x30b061){_0x46d773[_0x3f87('0x23')]=_0x30b061;if(_0x46d773[_0x3f87('0x24')](_0x3f87('0x25'))){_0x46d773[_0x3f87('0x26')]=parseInt(_0x46d773[_0x3f87('0x25')],0xa);}_0x15fad7['addVertex'](_[_0x3f87('0x27')](_0x46d773,_0x3f87('0x28')));}function initGraph(_0x3636b8,_0x5922e9){var _0x49674f=new Graph();for(var _0x41f9e9 in _0x3636b8){if(_0x3636b8[_0x3f87('0x24')](_0x41f9e9)){if(_[_0x3f87('0x29')](_0x3636b8[_0x41f9e9])){for(var _0x15e731=0x0;_0x15e731<_0x3636b8[_0x41f9e9][_0x3f87('0x2a')];_0x15e731+=0x1){addVertex(_0x49674f,_0x3636b8[_0x41f9e9][_0x15e731],_0x41f9e9);}}else{addVertex(_0x49674f,_0x3636b8[_0x41f9e9],_0x41f9e9);}}}for(var _0x148d8e=0x0;_0x148d8e<_0x5922e9[_0x3f87('0x2a')];_0x148d8e+=0x1){if(_0x5922e9[_0x148d8e][_0x3f87('0x2b')]&&_0x5922e9[_0x148d8e][_0x3f87('0x2c')]){_0x49674f[_0x3f87('0x2d')](_0x5922e9[_0x148d8e][_0x3f87('0x2b')],_0x5922e9[_0x148d8e][_0x3f87('0x2c')],_0x5922e9[_0x148d8e][_0x3f87('0x2e')]);}}return _0x49674f;}function getSquareProject(_0x241d88,_0x27f173){rpc[_0x3f87('0x2f')](_0x241d88)['then'](function(_0x150dbb){_0x27f173(null,_0x150dbb);})[_0x3f87('0x30')](function(_0x2546d2){_0x27f173(null,_0x2546d2);});}function createSquareReport(_0x2f0f05,_0x5495ed){rpc['createSquareReport'](_0x2f0f05)['then'](function(_0x221800){if(_0x5495ed){_0x5495ed(null,_0x221800);}})[_0x3f87('0x30')](function(_0x1d90d4){if(_0x5495ed){_0x5495ed(null,_0x1d90d4);}});}function setChannelVariables(_0x1d731a){for(var _0x25e332 in _0x1d731a){if(_0x1d731a['hasOwnProperty'](_0x25e332)){if(_0x25e332[_0x3f87('0x31')]('agi_')===0x0){_0x1d731a[_0x25e332[_0x3f87('0x32')](0x4)]=_0x1d731a[_0x25e332];delete _0x1d731a[_0x25e332];}}}}function getLogFromObject(_0x3ce0a5){return util[_0x3f87('0x33')](_0x3ce0a5,{'showHidden':![],'depth':null});}function agiHandler(_0xbd0201){var _0x20d9e0,_0x1ffcbe,_0x41aa27,_0x581fa1,_0x4c9c87;logger[_0x3f87('0x34')](_0x3f87('0x35'),JSON[_0x3f87('0x36')](_0xbd0201,null,0x2));logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x37'),_0xbd0201[_0x3f87('0x1a')],_0xbd0201['calleridname'],_0xbd0201[_0x3f87('0x1b')],_0xbd0201['dnid'],_0xbd0201[_0x3f87('0x1d')]));_0xbd0201['on'](_0x3f87('0xd'),errorHandler);_0xbd0201['on'](_0x3f87('0x38'),closeHandler);_0xbd0201['on'](_0x3f87('0x39'),timeoutHandler);_0xbd0201['evtHangup']=![];_0xbd0201['on'](_0x3f87('0x3a'),hangupHandler);var _0x54fe61=getSquareProject[_0x3f87('0x3b')](null,_0xbd0201[_0x3f87('0x1a')]);if(_0x54fe61){if(_0x54fe61[_0x3f87('0x3c')]){_0x20d9e0=getRoot(_0x54fe61[_0x3f87('0x3c')]);if(_0x20d9e0&&_0x20d9e0[_0x3f87('0x3d')]){logger['debug']('root',JSON['stringify'](_0x20d9e0,null,0x2));_0xbd0201[_0x3f87('0x3e')]=moment()[_0x3f87('0x12')](_0x3f87('0x3f'));_0x1ffcbe=initGraph(_[_0x3f87('0x27')](_0x20d9e0,_0x3f87('0x28')),_0x20d9e0[_0x3f87('0x28')]);_0x41aa27=new Vertices(_0xbd0201,rpc,mailRpc);logger['info'](util[_0x3f87('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xbd0201[_0x3f87('0x1a')],_0xbd0201[_0x3f87('0x1f')],_0xbd0201['callerid'],_0xbd0201[_0x3f87('0x1c')],_0xbd0201[_0x3f87('0x1d')]));_0x1ffcbe[_0x3f87('0x40')](_0x20d9e0['start']['id'],function(_0x246976){try{_0x246976=_0x41aa27['clear'](_0x246976);logger['debug'](_0x3f87('0x41'),JSON[_0x3f87('0x36')](_0x246976,null,0x2));if(_0x246976[_0x3f87('0x23')]===_0x3f87('0x42')){logger[_0x3f87('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0xbd0201[_0x3f87('0x43')]=_0x246976[_0x3f87('0x43')]||_0xbd0201[_0x3f87('0x43')];_0xbd0201[_0x3f87('0x44')]=_0x246976['extension'];_0xbd0201[_0x3f87('0x45')]=_0x246976[_0x3f87('0x45')]?_0x246976[_0x3f87('0x45')]-0x1:0x1;return null;}else if(_0x246976&&_0x41aa27[_0x246976[_0x3f87('0x23')]]){_0x4c9c87=_0x41aa27[_0x246976[_0x3f87('0x23')]](_0x246976);logger[_0x3f87('0x11')](_0x3f87('0x46'),JSON[_0x3f87('0x36')](_0x4c9c87,null,0x2));if(_0x4c9c87&&_0x4c9c87['code']===AGI_CODE_SUCCESS&&_0x4c9c87['result']!==AGI_RESULT_ERROR&&!_0xbd0201[_0x3f87('0x47')]){logger[_0x3f87('0x34')](_0x3f87('0x46'),getLogFromObject(_0x4c9c87));return _[_0x3f87('0x48')](_0x4c9c87[_0x3f87('0x49')])?null:_0x4c9c87[_0x3f87('0x49')][_0x3f87('0x4a')]();}else{logger[_0x3f87('0xd')](_0x3f87('0x46'),getLogFromObject(_0x4c9c87));return null;}}else{logger[_0x3f87('0xd')](_0x3f87('0x4b'));return null;}}catch(_0x4bdd49){logger[_0x3f87('0xd')](_0x4bdd49[_0x3f87('0x18')]);return null;}});if(_0x20d9e0[_0x3f87('0x4c')]){logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x4d'),_0xbd0201[_0x3f87('0x1a')],_0xbd0201[_0x3f87('0x1f')],_0xbd0201[_0x3f87('0x1b')],_0xbd0201[_0x3f87('0x1c')],_0xbd0201[_0x3f87('0x1d')]));_0x1ffcbe['traverseBFS'](_0x20d9e0[_0x3f87('0x4c')]['id'],function(_0x3e447b){try{_0x3e447b=_0x41aa27[_0x3f87('0x4e')](_0x3e447b);logger['debug'](_0x3f87('0x41'),JSON[_0x3f87('0x36')](_0x3e447b,null,0x2));if(_0x3e447b&&_0x41aa27[_0x3e447b[_0x3f87('0x23')]]){_0x4c9c87=_0x41aa27[_0x3e447b[_0x3f87('0x23')]](_0x3e447b);if(_0x4c9c87){logger[_0x3f87('0x34')](_0x3f87('0x46'),getLogFromObject(_0x4c9c87));return _[_0x3f87('0x48')](_0x4c9c87['result'])?null:_0x4c9c87[_0x3f87('0x49')][_0x3f87('0x4a')]();}else{logger[_0x3f87('0xd')](_0x3f87('0x46'),getLogFromObject(_0x4c9c87));return null;}}else{logger[_0x3f87('0xd')](_0x3f87('0x4b'));return null;}}catch(_0x227a42){logger[_0x3f87('0xd')](_0x227a42[_0x3f87('0x18')]);return null;}});}logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x4f'),_0xbd0201['arg_1'],_0xbd0201[_0x3f87('0x1f')],_0xbd0201['callerid'],_0xbd0201[_0x3f87('0x1c')],_0xbd0201[_0x3f87('0x1d')]));logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x50'),_0xbd0201[_0x3f87('0x43')],_0xbd0201['extension'],parseInt(_0xbd0201[_0x3f87('0x45')],0xa)+0x1));_0xbd0201[_0x3f87('0x51')](_0xbd0201[_0x3f87('0x43')],_0xbd0201[_0x3f87('0x44')],parseInt(_0xbd0201[_0x3f87('0x45')],0xa)+0x1);_0xbd0201[_0x3f87('0x38')]();}}else{logger[_0x3f87('0xd')](util[_0x3f87('0x12')](_0x3f87('0x52'),_0xbd0201[_0x3f87('0x1a')]));_0xbd0201[_0x3f87('0x51')](_0xbd0201[_0x3f87('0x43')],_0xbd0201[_0x3f87('0x44')],parseInt(_0xbd0201[_0x3f87('0x45')],0xa)+0x1);_0xbd0201[_0x3f87('0x38')]();}}else{logger[_0x3f87('0xd')](util['format']('Project\x20%s\x20not\x20found',_0xbd0201['arg_1']));_0xbd0201[_0x3f87('0x51')](_0xbd0201['context'],_0xbd0201[_0x3f87('0x44')],parseInt(_0xbd0201[_0x3f87('0x45')],0xa)+0x1);_0xbd0201[_0x3f87('0x38')]();}}function main(){var _0xb2499f;return utilLicense['getLicense']()[_0x3f87('0x53')](function(_0x2265a8){if(_0x2265a8){if(_0x2265a8[_0x3f87('0x54')]){if(_0x2265a8['callysquare']&&_0x2265a8['callysquare']>0x0){logger['info'](util[_0x3f87('0x12')](_0x3f87('0x55'),_0x2265a8['callysquare']));_0xb2499f=_0x2265a8[_0x3f87('0x56')];}else{logger[_0x3f87('0x11')](_0x3f87('0x57'));}}else{logger[_0x3f87('0x11')](_0x3f87('0x58'));_0xb2499f=-0x1;}}})[_0x3f87('0x30')](function(_0x3c84c5){logger[_0x3f87('0xd')](_0x3f87('0x59'),_0x3c84c5[_0x3f87('0x18')]);})[_0x3f87('0x4c')](function(){var _0x1b3ad3=require('./server')(config[_0x3f87('0x6')][_0x3f87('0x10')],config[_0x3f87('0x6')]['ip'],_0xb2499f);_0x1b3ad3['on'](_0x3f87('0xd'),errorHandler);_0x1b3ad3['on'](_0x3f87('0x5a'),listeningHandler);_0x1b3ad3['on'](_0x3f87('0x5b'),connectionHandler);_0x1b3ad3['on'](_0x3f87('0x38'),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 e125e80..d503828 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(_0x5c0ba5,_0x187ff3){var _0x101679=function(_0x1ff48e){while(--_0x1ff48e){_0x5c0ba5['push'](_0x5c0ba5['shift']());}};_0x101679(++_0x187ff3);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x59093f,_0x21c02f){var _0xbaf734=function(_0x41e20e){while(--_0x41e20e){_0x59093f['push'](_0x59093f['shift']());}};_0xbaf734(++_0x21c02f);}(_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 fd36c8d..ad08019 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 _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x46a634,_0x439b70){var _0x42007a=function(_0x2a9e29){while(--_0x2a9e29){_0x46a634['push'](_0x46a634['shift']());}};_0x42007a(++_0x439b70);}(_0xb10b,0x12a));var _0xbb10=function(_0x91e5da,_0x25ce34){_0x91e5da=_0x91e5da-0x0;var _0x5533f3=_0xb10b[_0x91e5da];return _0x5533f3;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0xb10b,0x12a));var _0xbb10=function(_0x562ec5,_0x36b5a4){_0x562ec5=_0x562ec5-0x0;var _0x279c8c=_0xb10b[_0x562ec5];return _0x279c8c;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index b81e12b..50b9f63 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 _0x9ab9=['CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','agentLogin','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','http','request','then','error','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x9ab9,0x19d));var _0x99ab=function(_0x54d47a,_0x435095){_0x54d47a=_0x54d47a-0x0;var _0x515c4f=_0x9ab9[_0x54d47a];return _0x515c4f;};'use strict';var BPromise=require(_0x99ab('0x0'));var moment=require(_0x99ab('0x1'));var _=require(_0x99ab('0x2'));var util=require(_0x99ab('0x3'));var jayson=require(_0x99ab('0x4'));var client=jayson['client'][_0x99ab('0x5')]({'port':0x2329});function request(_0x3a8ea9,_0x5f28e4){return new BPromise(function(_0x1b1c96,_0x49761a){return client[_0x99ab('0x6')](_0x3a8ea9,_0x5f28e4)[_0x99ab('0x7')](function(_0x390d41){if(_0x390d41[_0x99ab('0x8')]){return _0x49761a(_0x390d41[_0x99ab('0x8')]['message']);}else{return _0x1b1c96(_0x390d41['result']);}})[_0x99ab('0x9')](function(_0x18ca95){return _0x49761a(_0x18ca95);});});}exports['getSquareProject']=function(_0x14d083){return request(_0x99ab('0xa'),{'options':{'raw':![],'where':{'name':_0x14d083},'attributes':[_0x99ab('0xb')]}});};exports[_0x99ab('0xc')]=function(_0xe82b20){return request(_0x99ab('0xd'),{'options':{'raw':![],'where':{'id':_0xe82b20},'include':[{'model':'MailServerOut','as':_0x99ab('0xe')}],'attributes':['id',_0x99ab('0xf'),_0x99ab('0x10')]}});};exports['getSquareProjectById']=function(_0x4e7b4a){return request(_0x99ab('0xa'),{'options':{'where':{'id':_0x4e7b4a},'attributes':[_0x99ab('0xf')]}});};exports[_0x99ab('0x11')]=function(_0x3b3bba){return request(_0x99ab('0x12'),{'options':{'where':{'id':_0x3b3bba},'attributes':[_0x99ab('0xf')]}});};exports['getVariableById']=function(_0x97639f){return request(_0x99ab('0x13'),{'options':{'where':{'id':_0x97639f},'attributes':['name']}});};exports[_0x99ab('0x14')]=function(_0x36d89e){return request(_0x99ab('0x15'),{'options':{'where':{'id':_0x36d89e},'attributes':['dsn']}});};exports[_0x99ab('0x16')]=function(_0x13b9aa){return request(_0x99ab('0x17'),{'options':{'where':{'id':_0x13b9aa},'attributes':[_0x99ab('0xf')]}});};exports[_0x99ab('0x18')]=function(_0x2a5e0e){return request(_0x99ab('0x19'),{'options':{'where':{'id':_0x2a5e0e},'attributes':[_0x99ab('0xf')]}});};exports['getSoundById']=function(_0x14a515){return request(_0x99ab('0x1a'),{'options':{'where':{'id':_0x14a515},'attributes':[_0x99ab('0x1b')]}});};exports[_0x99ab('0x1c')]=function(_0x34e694){return request(_0x99ab('0x1d'),{'options':{'raw':![],'where':{'id':_0x34e694},'include':[{'model':_0x99ab('0x1e'),'as':_0x99ab('0x1f')}]}});};exports[_0x99ab('0x20')]=function(_0x51ded6){return request('ShowSmsAccount',{'options':{'where':{'id':_0x51ded6},'attributes':['id',_0x99ab('0xf')]}});};exports[_0x99ab('0x21')]=function(_0x194f39){return request('CreateSmsMessage',{'body':_0x194f39});};exports[_0x99ab('0x22')]=function(_0x3a0897){return request(_0x99ab('0x23'),{'body':_0x3a0897});};exports[_0x99ab('0x24')]=function(_0x624e9b){return request(_0x99ab('0x25'),{'body':_[_0x99ab('0x26')](_0x624e9b,{'project_name':_0x624e9b['arg_1'],'prev_project_name':_0x624e9b[_0x99ab('0x27')]||'','is_subproject':_0x624e9b['arg_2']?!![]:![],'leaveAt':moment()[_0x99ab('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x2d3281){return request(_0x99ab('0x29'),{'body':_0x2d3281});};exports[_0x99ab('0x2a')]=function(_0x570bed){return request(_0x99ab('0x2b'),{'body':_0x570bed});};exports[_0x99ab('0x2c')]=function(_0x447ef0){return request(_0x99ab('0x2d'),{'options':{'raw':![],'where':{'phone':_0x447ef0[_0x99ab('0x2e')],'ListId':_0x447ef0[_0x99ab('0x2f')]}}})[_0x99ab('0x7')](function(_0x2efec3){if(_0x2efec3){return _0x2efec3;}return request(_0x99ab('0x30'),{'body':_0x447ef0});});};exports['getPauseById']=function(_0x37182e){return request(_0x99ab('0x31'),{'options':{'where':{'id':_0x37182e},'attributes':['name']}});};exports[_0x99ab('0x32')]=function(_0x2c7333,_0x12c3e9){return request('LoginUser',{'body':{'interface':_0x12c3e9},'options':{'where':_0x2c7333}});};exports['agentPause']=function(_0x415276,_0x2cadac,_0x1aeca3){return request(_0x99ab('0x33'),{'body':{'type':_0x2cadac,'uniqueid':_0x1aeca3},'options':{'where':_0x415276}});};exports[_0x99ab('0x34')]=function(_0x36c0f1){return request(_0x99ab('0x35'),{'body':{},'options':{'where':_0x36c0f1}});};exports[_0x99ab('0x36')]=function(_0x5ba1ea){return request(_0x99ab('0x37'),{'body':{},'options':{'where':_0x5ba1ea}});}; \ No newline at end of file +var _0xbf80=['phone','CreateCmContact','getPauseById','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','jayson/promise','client','request','then','error','result','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','name','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','CreateSmsMessage','createSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xbf80,0x15a));var _0x0bf8=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0xbf80[_0x5a79e2];return _0x266c45;};'use strict';var BPromise=require(_0x0bf8('0x0'));var moment=require(_0x0bf8('0x1'));var _=require(_0x0bf8('0x2'));var util=require('util');var jayson=require(_0x0bf8('0x3'));var client=jayson[_0x0bf8('0x4')]['http']({'port':0x2329});function request(_0x44ab94,_0x2dcc24){return new BPromise(function(_0x3e4144,_0xa40c6c){return client[_0x0bf8('0x5')](_0x44ab94,_0x2dcc24)[_0x0bf8('0x6')](function(_0x487c52){if(_0x487c52[_0x0bf8('0x7')]){return _0xa40c6c(_0x487c52['error']['message']);}else{return _0x3e4144(_0x487c52[_0x0bf8('0x8')]);}})[_0x0bf8('0x9')](function(_0x18cebd){return _0xa40c6c(_0x18cebd);});});}exports[_0x0bf8('0xa')]=function(_0x45c08c){return request(_0x0bf8('0xb'),{'options':{'raw':![],'where':{'name':_0x45c08c},'attributes':[_0x0bf8('0xc')]}});};exports['getMailAccountById']=function(_0x439d83){return request(_0x0bf8('0xd'),{'options':{'raw':![],'where':{'id':_0x439d83},'include':[{'model':_0x0bf8('0xe'),'as':'Smtp'}],'attributes':['id','name',_0x0bf8('0xf')]}});};exports[_0x0bf8('0x10')]=function(_0x5b8da3){return request('ShowSquareProject',{'options':{'where':{'id':_0x5b8da3},'attributes':['name']}});};exports[_0x0bf8('0x11')]=function(_0x2c2b31){return request(_0x0bf8('0x12'),{'options':{'where':{'id':_0x2c2b31},'attributes':[_0x0bf8('0x13')]}});};exports[_0x0bf8('0x14')]=function(_0x15d15c){return request(_0x0bf8('0x15'),{'options':{'where':{'id':_0x15d15c},'attributes':[_0x0bf8('0x13')]}});};exports[_0x0bf8('0x16')]=function(_0x380808){return request(_0x0bf8('0x17'),{'options':{'where':{'id':_0x380808},'attributes':[_0x0bf8('0x18')]}});};exports[_0x0bf8('0x19')]=function(_0x11facb){return request('ShowUser',{'options':{'where':{'id':_0x11facb},'attributes':[_0x0bf8('0x13')]}});};exports['getTrunkById']=function(_0x2acb44){return request(_0x0bf8('0x1a'),{'options':{'where':{'id':_0x2acb44},'attributes':['name']}});};exports[_0x0bf8('0x1b')]=function(_0x4a4543){return request(_0x0bf8('0x1c'),{'options':{'where':{'id':_0x4a4543},'attributes':[_0x0bf8('0x1d')]}});};exports[_0x0bf8('0x1e')]=function(_0x5a5efd){return request(_0x0bf8('0x1f'),{'options':{'raw':![],'where':{'id':_0x5a5efd},'include':[{'model':_0x0bf8('0x20'),'as':_0x0bf8('0x21')}]}});};exports['getSmsAccountById']=function(_0xf8d440){return request(_0x0bf8('0x22'),{'options':{'where':{'id':_0xf8d440},'attributes':['id',_0x0bf8('0x13')]}});};exports['createSmsMessage']=function(_0x4c43e8){return request(_0x0bf8('0x23'),{'body':_0x4c43e8});};exports['createSquareDetailsReport']=function(_0x4478e2){return request('CreateSquareDetailsReport',{'body':_0x4478e2});};exports[_0x0bf8('0x24')]=function(_0x45fc2a){return request('CreateSquareReport',{'body':_[_0x0bf8('0x25')](_0x45fc2a,{'project_name':_0x45fc2a[_0x0bf8('0x26')],'prev_project_name':_0x45fc2a[_0x0bf8('0x27')]||'','is_subproject':_0x45fc2a['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x0bf8('0x28'))})});};exports[_0x0bf8('0x29')]=function(_0x468a5d){return request(_0x0bf8('0x2a'),{'body':_0x468a5d});};exports['createSquareMessage']=function(_0x2e502f){return request(_0x0bf8('0x2b'),{'body':_0x2e502f});};exports[_0x0bf8('0x2c')]=function(_0x214297){return request(_0x0bf8('0x2d'),{'options':{'raw':![],'where':{'phone':_0x214297[_0x0bf8('0x2e')],'ListId':_0x214297['ListId']}}})[_0x0bf8('0x6')](function(_0xef9008){if(_0xef9008){return _0xef9008;}return request(_0x0bf8('0x2f'),{'body':_0x214297});});};exports[_0x0bf8('0x30')]=function(_0x4c66e0){return request('ShowPause',{'options':{'where':{'id':_0x4c66e0},'attributes':['name']}});};exports[_0x0bf8('0x31')]=function(_0x1b84c6,_0x6ef863){return request('LoginUser',{'body':{'interface':_0x6ef863},'options':{'where':_0x1b84c6}});};exports[_0x0bf8('0x32')]=function(_0x13555d,_0x396690,_0x17a260){return request(_0x0bf8('0x33'),{'body':{'type':_0x396690,'uniqueid':_0x17a260},'options':{'where':_0x13555d}});};exports[_0x0bf8('0x34')]=function(_0x2aa650){return request(_0x0bf8('0x35'),{'body':{},'options':{'where':_0x2aa650}});};exports[_0x0bf8('0x36')]=function(_0x3cb88f){return request(_0x0bf8('0x37'),{'body':{},'options':{'where':_0x3cb88f}});}; \ 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 d6547f8..2e9e965 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 _0x29d4=['exports','./polly'];(function(_0x3d1f79,_0x31040b){var _0x3e4708=function(_0x40a16c){while(--_0x40a16c){_0x3d1f79['push'](_0x3d1f79['shift']());}};_0x3e4708(++_0x31040b);}(_0x29d4,0x1a1));var _0x429d=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x29d4[_0x5bd426];return _0x23a7eb;};var polly=require(_0x429d('0x0'));var lex=require('./lex');module[_0x429d('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x668b=['./polly','./lex'];(function(_0x148d4f,_0x588614){var _0x24f00c=function(_0x9245ea){while(--_0x9245ea){_0x148d4f['push'](_0x148d4f['shift']());}};_0x24f00c(++_0x588614);}(_0x668b,0x140));var _0xb668=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x668b[_0xea8947];return _0x2455e9;};var polly=require(_0xb668('0x0'));var lex=require(_0xb668('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index de2b3b5..ad1fb3f 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 _0x430e=['exports'];(function(_0x29061d,_0x5bd197){var _0x378837=function(_0x4a7fa3){while(--_0x4a7fa3){_0x29061d['push'](_0x29061d['shift']());}};_0x378837(++_0x5bd197);}(_0x430e,0x105));var _0xe430=function(_0x1a6c7f,_0x5aee3f){_0x1a6c7f=_0x1a6c7f-0x0;var _0x1d378d=_0x430e[_0x1a6c7f];return _0x1d378d;};'use strict';var lex=require('./lib/api');module[_0xe430('0x0')]=function(_0x2984a5,_0x4eaa9b,_0x85af5b,_0x253dfe,_0x36942f,_0x1a9d61){return lex(_0x2984a5,_0x4eaa9b,_0x85af5b,_0x253dfe,_0x36942f,_0x1a9d61);}; \ No newline at end of file +var _0x66fa=['./lib/api','exports'];(function(_0x601e3b,_0x20236b){var _0x4a0119=function(_0x56456c){while(--_0x56456c){_0x601e3b['push'](_0x601e3b['shift']());}};_0x4a0119(++_0x20236b);}(_0x66fa,0x168));var _0xa66f=function(_0x5aa509,_0x3bf3a2){_0x5aa509=_0x5aa509-0x0;var _0x4addae=_0x66fa[_0x5aa509];return _0x4addae;};'use strict';var lex=require(_0xa66f('0x0'));module[_0xa66f('0x1')]=function(_0xab19a,_0x4d9703,_0x4a6840,_0x3dc747,_0x2325d7,_0x3aaeff){return lex(_0xab19a,_0x4d9703,_0x4a6840,_0x3dc747,_0x2325d7,_0x3aaeff);}; \ 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 6ce453f..e605abb 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 _0x022d=['slot_','LexRuntime','$LATEST','postText','slots'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0x022d,0xda));var _0xd022=function(_0x25c0ed,_0x5478de){_0x25c0ed=_0x25c0ed-0x0;var _0x3a6b6f=_0x022d[_0x25c0ed];return _0x3a6b6f;};'use strict';var BPromise=require('bluebird');var AWS=require('aws-sdk');function lexResult(_0x2eaee1,_0x6f9dbe){return new BPromise(function(_0x2e82a1,_0x274413){_0x2eaee1[_0xd022('0x0')](_0x6f9dbe,function(_0x16f80a,_0x3ba95e){if(_0x16f80a){_0x274413(_0x16f80a);}if(_0x3ba95e[_0xd022('0x1')]){for(const _0x512015 in _0x3ba95e[_0xd022('0x1')]){if(_0x3ba95e[_0xd022('0x1')]['hasOwnProperty'](_0x512015)){var _0x488ff4=_0x3ba95e[_0xd022('0x1')][_0x512015];_0x3ba95e[_0xd022('0x2')+_0x512015]=_0x488ff4;}}}_0x2e82a1(_0x3ba95e);});});}module['exports']=function(_0x4c6281,_0x2705e6,_0x473c19,_0x21b5e0,_0x639e4d,_0x4dfaa5){var _0x4bb44c=new AWS[(_0xd022('0x3'))]({'accessKeyId':_0x2705e6,'secretAccessKey':_0x473c19,'region':_0x21b5e0});var _0x31256e={'botAlias':_0xd022('0x4'),'botName':_0x4dfaa5,'inputText':_0x639e4d,'userId':_0x4c6281};return lexResult(_0x4bb44c,_0x31256e);}; \ No newline at end of file +var _0xf1c2=['slot_','exports','LexRuntime','$LATEST','postText','slots','hasOwnProperty'];(function(_0x2a1c2e,_0x12d5cf){var _0x4fe6da=function(_0x5b9917){while(--_0x5b9917){_0x2a1c2e['push'](_0x2a1c2e['shift']());}};_0x4fe6da(++_0x12d5cf);}(_0xf1c2,0x177));var _0x2f1c=function(_0xce6f11,_0x3c3137){_0xce6f11=_0xce6f11-0x0;var _0x35b709=_0xf1c2[_0xce6f11];return _0x35b709;};'use strict';var BPromise=require('bluebird');var AWS=require('aws-sdk');function lexResult(_0x27135e,_0x380c83){return new BPromise(function(_0x46198b,_0x1372b9){_0x27135e[_0x2f1c('0x0')](_0x380c83,function(_0x2a8191,_0x57eb15){if(_0x2a8191){_0x1372b9(_0x2a8191);}if(_0x57eb15[_0x2f1c('0x1')]){for(const _0x3477ee in _0x57eb15[_0x2f1c('0x1')]){if(_0x57eb15[_0x2f1c('0x1')][_0x2f1c('0x2')](_0x3477ee)){var _0x5805f0=_0x57eb15[_0x2f1c('0x1')][_0x3477ee];_0x57eb15[_0x2f1c('0x3')+_0x3477ee]=_0x5805f0;}}}_0x46198b(_0x57eb15);});});}module[_0x2f1c('0x4')]=function(_0x3ccf4e,_0x513dfe,_0x1e412e,_0x4a7d30,_0x453d68,_0xe6198c){var _0x1f05f9=new AWS[(_0x2f1c('0x5'))]({'accessKeyId':_0x513dfe,'secretAccessKey':_0x1e412e,'region':_0x4a7d30});var _0x208c69={'botAlias':_0x2f1c('0x6'),'botName':_0xe6198c,'inputText':_0x453d68,'userId':_0x3ccf4e};return lexResult(_0x1f05f9,_0x208c69);}; \ 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 280b34c..2a83881 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 _0x3413=['./lib/api','exports'];(function(_0x58945f,_0x21e31b){var _0x26d3f7=function(_0x3b8e1b){while(--_0x3b8e1b){_0x58945f['push'](_0x58945f['shift']());}};_0x26d3f7(++_0x21e31b);}(_0x3413,0x1d6));var _0x3341=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3413[_0x14add3];return _0x4a174f;};'use strict';var polly=require(_0x3341('0x0'));module[_0x3341('0x1')]=function(_0x244f9e,_0x1cb371,_0x3a269b,_0x3276dc,_0x2642d5,_0x150e8d,_0x2c48c3){return polly(_0x244f9e,_0x1cb371,_0x3a269b,_0x3276dc,_0x2642d5,_0x150e8d,_0x2c48c3);}; \ No newline at end of file +var _0x7e3e=['./lib/api'];(function(_0x5e49a5,_0x408b47){var _0x2f5529=function(_0x3183bb){while(--_0x3183bb){_0x5e49a5['push'](_0x5e49a5['shift']());}};_0x2f5529(++_0x408b47);}(_0x7e3e,0x19e));var _0xe7e3=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7e3e[_0x2f5ac5];return _0x37c9a8;};'use strict';var polly=require(_0xe7e3('0x0'));module['exports']=function(_0x511bf3,_0x267209,_0x105bb2,_0x59dee1,_0x202334,_0xf1d6fc,_0x1768db){return polly(_0x511bf3,_0x267209,_0x105bb2,_0x59dee1,_0x202334,_0xf1d6fc,_0x1768db);}; \ 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 3bb74e7..d26c618 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 _0x376d=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird'];(function(_0x52740d,_0x33db0d){var _0x45d0dd=function(_0xb94d17){while(--_0xb94d17){_0x52740d['push'](_0x52740d['shift']());}};_0x45d0dd(++_0x33db0d);}(_0x376d,0xe5));var _0xd376=function(_0x41e6c7,_0x6977ab){_0x41e6c7=_0x41e6c7-0x0;var _0x28f5aa=_0x376d[_0x41e6c7];return _0x28f5aa;};'use strict';var fs=require('fs');var path=require(_0xd376('0x0'));var BPromise=require(_0xd376('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x56079a,_0x41e735,_0x5990e1){return new BPromise(function(_0xe0d823,_0x50fbd7){_0x56079a[_0xd376('0x2')](_0x41e735,function(_0x3dd685,_0x31fe9c){if(_0x3dd685){_0x50fbd7(_0x3dd685);}else if(_0x31fe9c){if(_0x31fe9c[_0xd376('0x3')]instanceof Buffer){fs[_0xd376('0x4')](_0x5990e1,_0x31fe9c[_0xd376('0x3')],function(_0x2971fc){if(_0x2971fc){_0x50fbd7(_0x2971fc);}else{_0xe0d823();}});}else{_0x50fbd7(new Error(_0xd376('0x5')));}}else{_0x50fbd7(new Error(_0xd376('0x6')));}});});}module[_0xd376('0x7')]=function(_0x521c0e,_0x51a182,_0x382d0a,_0x593790,_0x5e1dce,_0x1ab3b3,_0x1b48a1){var _0x503b3b=new AWS[(_0xd376('0x8'))]({'accessKeyId':_0x521c0e,'secretAccessKey':_0x51a182,'region':_0x382d0a});var _0x40c3a9={'Text':_0x5e1dce,'TextType':_0x1ab3b3||_0xd376('0x9'),'OutputFormat':_0xd376('0xa'),'VoiceId':_0x593790};return pollyResult(_0x503b3b,_0x40c3a9,_0x1b48a1);}; \ No newline at end of file +var _0xceac=['Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x1634ea,_0x5d0ce0){var _0xd52717=function(_0x4a1790){while(--_0x4a1790){_0x1634ea['push'](_0x1634ea['shift']());}};_0xd52717(++_0x5d0ce0);}(_0xceac,0x1b0));var _0xccea=function(_0x54dbcd,_0x92418d){_0x54dbcd=_0x54dbcd-0x0;var _0xe79f5=_0xceac[_0x54dbcd];return _0xe79f5;};'use strict';var fs=require('fs');var path=require(_0xccea('0x0'));var BPromise=require(_0xccea('0x1'));var rs=require(_0xccea('0x2'));var AWS=require(_0xccea('0x3'));function pollyResult(_0x2dcbd5,_0x19d050,_0x149a26){return new BPromise(function(_0x46f75f,_0x4db102){_0x2dcbd5[_0xccea('0x4')](_0x19d050,function(_0x1533af,_0x15502f){if(_0x1533af){_0x4db102(_0x1533af);}else if(_0x15502f){if(_0x15502f[_0xccea('0x5')]instanceof Buffer){fs['writeFile'](_0x149a26,_0x15502f[_0xccea('0x5')],function(_0x156405){if(_0x156405){_0x4db102(_0x156405);}else{_0x46f75f();}});}else{_0x4db102(new Error(_0xccea('0x6')));}}else{_0x4db102(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xccea('0x7')]=function(_0x3ebc0f,_0x11985d,_0x214487,_0x19ed19,_0xd07715,_0x49647a,_0x1997d0){var _0x26b419=new AWS[(_0xccea('0x8'))]({'accessKeyId':_0x3ebc0f,'secretAccessKey':_0x11985d,'region':_0x214487});var _0xbb86c8={'Text':_0xd07715,'TextType':_0x49647a||_0xccea('0x9'),'OutputFormat':_0xccea('0xa'),'VoiceId':_0x19ed19};return pollyResult(_0x26b419,_0xbb86c8,_0x1997d0);}; \ 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 6829a58..fe09e03 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 _0x6178=['exports'];(function(_0x298bc1,_0x4c1869){var _0x2a1d56=function(_0xf92ea3){while(--_0xf92ea3){_0x298bc1['push'](_0x298bc1['shift']());}};_0x2a1d56(++_0x4c1869);}(_0x6178,0x1e2));var _0x8617=function(_0x376830,_0x1adaca){_0x376830=_0x376830-0x0;var _0x51ead4=_0x6178[_0x376830];return _0x51ead4;};'use strict';var asr=require('./lib/api');module[_0x8617('0x0')]=function(_0xfebbee,_0x4f085c,_0x4d75cd,_0x4d097a){return asr(_0xfebbee,_0x4f085c,_0x4d75cd);}; \ No newline at end of file +var _0xf55e=['./lib/api','exports'];(function(_0x1c895a,_0x215a72){var _0x39409a=function(_0x31d7cd){while(--_0x31d7cd){_0x1c895a['push'](_0x1c895a['shift']());}};_0x39409a(++_0x215a72);}(_0xf55e,0xca));var _0xef55=function(_0x48cb74,_0x19aa42){_0x48cb74=_0x48cb74-0x0;var _0x3f0bbd=_0xf55e[_0x48cb74];return _0x3f0bbd;};'use strict';var asr=require(_0xef55('0x0'));module[_0xef55('0x1')]=function(_0x4efc01,_0x180cac,_0x4c5ce5,_0x11605d){return asr(_0x4efc01,_0x180cac,_0x4c5ce5);}; \ 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 1c502f7..c80a3d0 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 _0xf9cf=['string','length','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0xf9cf,0x88));var _0xff9c=function(_0x39a86d,_0x10287a){_0x39a86d=_0x39a86d-0x0;var _0x960fdf=_0xf9cf[_0x39a86d];return _0x960fdf;};'use strict';var url=require(_0xff9c('0x0'));var BPromise=require(_0xff9c('0x1'));var fs=require('fs');var host=_0xff9c('0x2');module[_0xff9c('0x3')]=function(_0x17da22,_0x28b6b3,_0x132227){return new BPromise(function(_0x290be8,_0x127182){var _0x4239d1;if(typeof _0x17da22!==_0xff9c('0x4')||_0x17da22[_0xff9c('0x5')]===0x0){return _0x127182('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x28b6b3!==_0xff9c('0x4')||_0x28b6b3[_0xff9c('0x5')]===0x0){return _0x127182(_0xff9c('0x6'));}if(typeof _0x132227!==_0xff9c('0x7')&&(typeof _0x132227!==_0xff9c('0x4')||_0x132227[_0xff9c('0x5')]===0x0)){return _0x127182('lang\x20should\x20be\x20a\x20string');}try{_0x4239d1=fs[_0xff9c('0x8')](_0x17da22)[_0xff9c('0x9')](_0xff9c('0xa'));}catch(_0x191525){return _0x127182(_0x191525);}return _0x290be8({'method':_0xff9c('0xb'),'uri':host+_0xff9c('0xc')+_0x28b6b3,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xff9c('0xd'),'languageCode':_0x132227},'audio':{'content':_0x4239d1}},'json':!![]});});}; \ No newline at end of file +var _0x44d8=['string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports'];(function(_0x2354a8,_0x18ee8b){var _0x2d0bc3=function(_0x55f113){while(--_0x55f113){_0x2354a8['push'](_0x2354a8['shift']());}};_0x2d0bc3(++_0x18ee8b);}(_0x44d8,0xde));var _0x844d=function(_0x4a622e,_0x139b8d){_0x4a622e=_0x4a622e-0x0;var _0x411032=_0x44d8[_0x4a622e];return _0x411032;};'use strict';var url=require(_0x844d('0x0'));var BPromise=require(_0x844d('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x844d('0x2')]=function(_0x20f0a7,_0x4c7acc,_0x233c2a){return new BPromise(function(_0x388d52,_0x4ef4de){var _0x22318d;if(typeof _0x20f0a7!==_0x844d('0x3')||_0x20f0a7[_0x844d('0x4')]===0x0){return _0x4ef4de('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x4c7acc!=='string'||_0x4c7acc[_0x844d('0x4')]===0x0){return _0x4ef4de(_0x844d('0x5'));}if(typeof _0x233c2a!==_0x844d('0x6')&&(typeof _0x233c2a!==_0x844d('0x3')||_0x233c2a[_0x844d('0x4')]===0x0)){return _0x4ef4de(_0x844d('0x7'));}try{_0x22318d=fs[_0x844d('0x8')](_0x20f0a7)[_0x844d('0x9')](_0x844d('0xa'));}catch(_0x3e5a16){return _0x4ef4de(_0x3e5a16);}return _0x388d52({'method':_0x844d('0xb'),'uri':host+_0x844d('0xc')+_0x4c7acc,'body':{'config':{'encoding':_0x844d('0xd'),'sampleRateHertz':_0x844d('0xe'),'languageCode':_0x233c2a},'audio':{'content':_0x22318d}},'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 5e5a806..3f9f8b4 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 _0xba6f=['./asr'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0xba6f,0x1d0));var _0xfba6=function(_0x3ebb04,_0x1a63a6){_0x3ebb04=_0x3ebb04-0x0;var _0x535db0=_0xba6f[_0x3ebb04];return _0x535db0;};var asr=require(_0xfba6('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x9500=['./asr','exports'];(function(_0x28dced,_0x5463d2){var _0x38c7c6=function(_0xf94c){while(--_0xf94c){_0x28dced['push'](_0x28dced['shift']());}};_0x38c7c6(++_0x5463d2);}(_0x9500,0xb6));var _0x0950=function(_0x2eb740,_0xe3f05f){_0x2eb740=_0x2eb740-0x0;var _0x2f5301=_0x9500[_0x2eb740];return _0x2f5301;};var asr=require(_0x0950('0x0'));module[_0x0950('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 40d1ff0..fb9caa5 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 _0x129e=['error\x20convert','info','resolve','tmp','.wav','writeFileSync','base64','chmodSync','777','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','then','.mp3','audioContent','generate','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','name','displayName','isFallback','languageCode','responseId','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','%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','format','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','https','querystring','request-promise','randomstring','google-tts-api','url','util','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','data','end','transcode'];(function(_0x58cb21,_0x4737cc){var _0x37e679=function(_0x154326){while(--_0x154326){_0x58cb21['push'](_0x58cb21['shift']());}};_0x37e679(++_0x4737cc);}(_0x129e,0xe9));var _0xe129=function(_0x4d2f07,_0x554643){_0x4d2f07=_0x4d2f07-0x0;var _0x1f518e=_0x129e[_0x4d2f07];return _0x1f518e;};'use strict';var apiai=require(_0xe129('0x0'));var BPromise=require(_0xe129('0x1'));var dialogflow=require(_0xe129('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xe129('0x3'));var md5=require('md5');var path=require('path');var querystring=require(_0xe129('0x4'));var rp=require(_0xe129('0x5'));var rs=require(_0xe129('0x6'));var sox=require('sox');var tts=require(_0xe129('0x7'));var urlParse=require(_0xe129('0x8'))['parse'];var util=require(_0xe129('0x9'));var aws=require('./aws');var google=require(_0xe129('0xa'));var sestek=require(_0xe129('0xb'));var tilde=require(_0xe129('0xc'));var logger=require('../../../config/logger')(_0xe129('0xd'));var ISPEECH_API=_0xe129('0xe');function downloadFile(_0x48ea70,_0x15340d){return new BPromise(function(_0x4f8c14,_0xa809fe){var _0x34499d=urlParse(_0x48ea70);var _0x4448c6=_0x34499d[_0xe129('0xf')]===_0xe129('0x10')?https:http;var _0x5955f4={'host':_0x34499d[_0xe129('0x11')],'path':_0x34499d[_0xe129('0x12')],'headers':{'user-agent':_0xe129('0x13')}};_0x4448c6[_0xe129('0x14')](_0x5955f4,function(_0x52c79f){if(_0x52c79f[_0xe129('0x15')]!==0xc8){logger['error'](_0xe129('0x16')+_0x48ea70+_0xe129('0x17')+_0x52c79f['statusCode']+'\x20('+_0x52c79f[_0xe129('0x18')]+')');_0xa809fe(new Error('request\x20to\x20'+_0x48ea70+'\x20failed,\x20status\x20code\x20=\x20'+_0x52c79f['statusCode']+'\x20('+_0x52c79f[_0xe129('0x18')]+')'));return;}var _0x126a64=fs[_0xe129('0x19')](_0x15340d);_0x126a64['on']('finish',function(){logger['info'](_0xe129('0x1a'));_0x126a64[_0xe129('0x1b')](_0x4f8c14);});_0x126a64['on'](_0xe129('0x1c'),function(_0x36d0ed){fs[_0xe129('0x1d')](_0x15340d);logger[_0xe129('0x1c')](_0xe129('0x1e'),_0x36d0ed);_0xa809fe(_0x36d0ed);});_0x52c79f[_0xe129('0x1f')](_0x126a64);})['on'](_0xe129('0x1c'),function(_0x51e9b3){logger['error'](_0x51e9b3);_0xa809fe(_0x51e9b3);})['end']();});}function uploadFile(_0x5e63d5){return new BPromise(function(_0x18da3b,_0x323cce){var _0x472382=urlParse(_0x5e63d5);var _0x39f600=_0x472382[_0xe129('0xf')]==='https:'?https:http;var _0x540452={'host':_0x472382[_0xe129('0x11')],'path':_0x472382[_0xe129('0x12')],'headers':{'user-agent':_0xe129('0x13')}};_0x39f600[_0xe129('0x14')](_0x540452,function(_0x3fa38c){if(_0x3fa38c[_0xe129('0x15')]!==0xc8){_0x323cce(new Error(_0xe129('0x16')+_0x5e63d5+_0xe129('0x17')+_0x3fa38c[_0xe129('0x15')]+'\x20('+_0x3fa38c['statusMessage']+')'));return;}var _0x3ce3a2='';_0x3fa38c['on'](_0xe129('0x20'),function(_0x270f52){_0x3ce3a2+=_0x270f52;});_0x3fa38c['on']('end',function(){_0x18da3b(_0x3ce3a2);});})['on'](_0xe129('0x1c'),function(_0x323d6a){_0x323cce(_0x323d6a);})[_0xe129('0x21')]();});}function convertFile(_0x536ebd,_0x2f0cab){return new BPromise(function(_0x2539ff,_0x59c6e0){var _0x4d9742=sox[_0xe129('0x22')](_0x536ebd,_0x2f0cab,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4d9742['on'](_0xe129('0x1c'),function(_0x36c2d2){logger[_0xe129('0x1c')](_0xe129('0x23'),_0x36c2d2);_0x59c6e0(_0x36c2d2);});_0x4d9742['on'](_0xe129('0x21'),function(){logger[_0xe129('0x24')]('finish\x20to\x20convert');_0x2539ff();});_0x4d9742['start']();});}function base64Decode(_0x37a4e9,_0x49464f){var _0x57f719=path[_0xe129('0x25')](__dirname,_0xe129('0x26'),rs['generate'](0x4)+_0xe129('0x27'));fs[_0xe129('0x28')](_0x57f719,_0x37a4e9,_0xe129('0x29'));return convertFile(_0x57f719,_0x49464f)['then'](function(){try{fs['unlink'](_0x57f719);fs[_0xe129('0x2a')](_0x49464f,_0xe129('0x2b'));}catch(_0x50f38d){logger[_0xe129('0x1c')](_0x50f38d);}return _0x49464f['split']('.')[0x0];});}function base64Encode(_0x2220c2){var _0x25803c=fs['readFileSync'](_0x2220c2);return new Buffer(_0x25803c)[_0xe129('0x2c')]('base64');}exports[_0xe129('0x2d')]=function(_0x3fe74c,_0x213bce,_0x5b421b,_0x33c2d1,_0x3e0cff,_0x9bd25a){var _0x16bb32,_0x412f59;var _0x3fb1eb=_0xe129('0x2e');var _0x30e625=_0xe129('0x2f')+_0x3fe74c;var _0x2cf0d8={};if(_0x213bce==='ssml'){_0x2cf0d8[_0xe129('0x30')]={'ssml':_0x5b421b};}else{_0x2cf0d8[_0xe129('0x30')]={'text':_0x5b421b};};_0x2cf0d8[_0xe129('0x31')]={'languageCode':_0x33c2d1,'ssmlGender':_0x3e0cff};_0x2cf0d8[_0xe129('0x32')]={'audioEncoding':_0xe129('0x33'),'sampleRateHertz':0x1f40};var _0x5e7cd0={'url':_0x3fb1eb+_0xe129('0x34')+_0x30e625,'method':_0xe129('0x35'),'json':!![],'body':_0x2cf0d8};return rp(_0x5e7cd0)[_0xe129('0x36')](function(_0x1229a4){return new BPromise(function(_0x38c8e,_0xd7df2){_0x16bb32=path['resolve'](__dirname,_0xe129('0x26'),rs['generate'](0x4)+_0xe129('0x37'));var _0x4b1684=Buffer['from'](_0x1229a4[_0xe129('0x38')],_0xe129('0x29'));return fs['writeFile'](_0x16bb32,_0x4b1684,function(_0x2973d7){_0xd7df2(_0x2973d7);},function(_0x418184){fs[_0xe129('0x2a')](_0x16bb32,_0xe129('0x2b'));_0x38c8e(_0x418184);});});})['then'](function(_0x40eee8){_0x412f59=path[_0xe129('0x25')](__dirname,'tmp',rs[_0xe129('0x39')](0x4)+_0xe129('0x27'));return convertFile(_0x16bb32,_0x412f59);})[_0xe129('0x36')](function(){try{fs['unlink'](_0x16bb32);fs[_0xe129('0x2a')](_0x412f59,_0xe129('0x2b'));}catch(_0x3845bd){logger[_0xe129('0x1c')](_0x3845bd);}logger[_0xe129('0x24')](_0xe129('0x3a'),_0x412f59[_0xe129('0x3b')]('.')[0x0]);return _0x412f59[_0xe129('0x3b')]('.')[0x0];});};exports[_0xe129('0x3c')]=function(_0x548784,_0x3d0ea5){var _0x9a6a6=_0xe129('0x3d');var _0x14ba93,_0xf7471b;var _0xa3c2a3;var _0x177d0b={'encoding':_0xe129('0x3e'),'method':_0xe129('0x35'),'timeout':0x2710,'url':_0x9a6a6,'headers':{'Content-Type':_0xe129('0x3f')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xe129('0x40'),JSON[_0xe129('0x41')]([_0x548784,_0x3d0ea5||'en',![],_0xe129('0x42')]),null,_0xe129('0x43')]]]))};return rp(_0x177d0b)[_0xe129('0x36')](function(_0x1bcbf0){try{_0xa3c2a3=eval(_0x1bcbf0[_0xe129('0x44')](0x5))[0x0][0x2];}catch(_0x488643){throw new Error(_0xe129('0x45')+_0x1bcbf0[_0xe129('0x20')]);}if(!_0xa3c2a3){if(_0x548784[_0xe129('0x46')]>0xc8){throw new Error(_0xe129('0x47'));}else{throw new Error(_0xe129('0x48')+_0x3d0ea5+'\x22\x20might\x20not\x20exist');}}try{_0xa3c2a3=eval(_0xa3c2a3)[0x0];}catch(_0x3d1be5){throw new Error(_0xe129('0x45')+res['data']);}const _0x2dc912=_0xa3c2a3;_0x14ba93=path[_0xe129('0x25')](__dirname,_0xe129('0x26'),rs[_0xe129('0x39')](0x4)+_0xe129('0x37'));fs[_0xe129('0x28')](_0x14ba93,_0xa3c2a3,{'encoding':'base64'});_0xf7471b=path[_0xe129('0x25')](__dirname,_0xe129('0x26'),rs[_0xe129('0x39')](0x4)+'.wav');return convertFile(_0x14ba93,_0xf7471b);})[_0xe129('0x36')](function(){try{fs[_0xe129('0x1d')](_0x14ba93);fs[_0xe129('0x2a')](_0xf7471b,_0xe129('0x2b'));}catch(_0x553f88){logger[_0xe129('0x1c')](_0x553f88);}logger[_0xe129('0x24')](_0xe129('0x49'),_0xf7471b[_0xe129('0x3b')]('.')[0x0]);return _0xf7471b[_0xe129('0x3b')]('.')[0x0];});};exports[_0xe129('0x4a')]=function(_0x4e1954,_0x3d8ff5,_0x1c9c0c){return google['asr'](_0x4e1954,_0x3d8ff5,_0x1c9c0c)[_0xe129('0x36')](function(_0x438928){logger[_0xe129('0x24')](_0x438928[_0xe129('0x4b')]);return rp(_0x438928);})[_0xe129('0x36')](function(_0x4feb37){var _0x3f15fc='';var _0x589c09=0x0;try{fs[_0xe129('0x1d')](_0x4e1954);}catch(_0x420d68){logger[_0xe129('0x1c')](_0x420d68);}if(_0x4feb37&&_0x4feb37[_0xe129('0x4c')]){_0x3f15fc=_0x4feb37[_0xe129('0x4c')]['map'](function(_0xf58bfb){return _0xf58bfb&&_0xf58bfb[_0xe129('0x4d')][0x0]&&_0xf58bfb['alternatives'][0x0][_0xe129('0x4e')]?_0xf58bfb[_0xe129('0x4d')][0x0][_0xe129('0x4e')]:'';})[_0xe129('0x4f')]('\x0a');_0x589c09=_0x4feb37[_0xe129('0x4c')]['map'](function(_0x58fb68){return _0x58fb68&&_0x58fb68['alternatives'][0x0]&&_0x58fb68['alternatives'][0x0][_0xe129('0x50')]?_0x58fb68[_0xe129('0x4d')][0x0][_0xe129('0x50')]:0x0;})[_0xe129('0x4f')]('\x0a');}logger[_0xe129('0x24')](_0xe129('0x51'),_0x3f15fc);logger[_0xe129('0x24')]('googleASR\x20confidence',_0x589c09);return{'transcript':_0x3f15fc,'confidence':_0x589c09};})[_0xe129('0x52')](function(_0x4ca141){logger[_0xe129('0x1c')](_0xe129('0x53'),_0x4ca141[_0xe129('0x15')],_0x4ca141['name'],_0x4ca141[_0xe129('0x54')]);});};exports[_0xe129('0x55')]=function(_0x5f0e38,_0x26ee89,_0x5aecf0,_0x4ef207){var _0x470527=apiai(_0x26ee89,{'language':_0x4ef207||'en'});return _0x470527[_0xe129('0x56')](_0x5aecf0,{'sessionId':md5(_0x5f0e38)})[_0xe129('0x36')](function(_0x400280){logger[_0xe129('0x24')](JSON[_0xe129('0x41')](_0x400280));return{'source':_0x400280[_0xe129('0x57')][_0xe129('0x58')],'resolvedQuery':_0x400280['result'][_0xe129('0x59')],'action':_0x400280[_0xe129('0x57')][_0xe129('0x5a')],'actionIncomplete':_0x400280['result'][_0xe129('0x5b')],'speech':_0x400280[_0xe129('0x57')]['fulfillment']['speech'],'score':_0x400280[_0xe129('0x57')][_0xe129('0x5c')],'statusCode':_0x400280[_0xe129('0x5d')]['code'],'endConversation':_0x400280[_0xe129('0x57')][_0xe129('0x5e')][_0xe129('0x5f')]||![],'isFallbackIntent':_0x400280['result'][_0xe129('0x5e')][_0xe129('0x60')]};});};exports[_0xe129('0x61')]=function(_0x4c20aa,_0x283ff5,_0x32cca2,_0x50cb74,_0x52f57e,_0xf51d6f){var _0x165a85=_0x50cb74[_0xe129('0x62')](/\\n/g,'\x0a');var _0x26c67e={'credentials':{'private_key':_0x165a85,'client_email':_0x32cca2}};var _0x31635c=new dialogflow[(_0xe129('0x63'))](_0x26c67e);var _0x198ca6=_0x31635c['sessionPath'](_0x283ff5,md5(_0x4c20aa));var _0x1b6a54={'session':_0x198ca6,'queryInput':{'text':{'text':_0x52f57e,'languageCode':_0xf51d6f}}};return _0x31635c['detectIntent'](_0x1b6a54)[_0xe129('0x36')](function(_0x439069){if(_0x439069&&_0x439069[_0xe129('0x46')]){logger[_0xe129('0x24')]('Dialogflow\x20V2\x20response:',JSON[_0xe129('0x41')](_0x439069));var _0x390d82=_0x439069[0x0];if(_0x390d82){var _0x5d9456={'action':_0x390d82[_0xe129('0x64')]['action'],'allRequiredParamsPresent':_0x390d82[_0xe129('0x64')][_0xe129('0x65')],'endConversation':_0x390d82['queryResult'][_0xe129('0x66')]&&_0x390d82[_0xe129('0x64')][_0xe129('0x66')][_0xe129('0x67')]?_0x390d82[_0xe129('0x64')]['diagnosticInfo'][_0xe129('0x67')]['end_conversation'][_0xe129('0x68')]:![],'fulfillmentText':_0x390d82[_0xe129('0x64')][_0xe129('0x69')],'intentName':_0x390d82[_0xe129('0x64')][_0xe129('0x6a')][_0xe129('0x6b')],'intentDisplayName':_0x390d82[_0xe129('0x64')][_0xe129('0x6a')][_0xe129('0x6c')],'isFallbackIntent':_0x390d82[_0xe129('0x64')]['intent'][_0xe129('0x6d')],'languageCode':_0x390d82[_0xe129('0x64')][_0xe129('0x6e')],'queryText':_0x390d82[_0xe129('0x64')]['queryText'],'responseId':_0x390d82[_0xe129('0x6f')],'score':_0x390d82[_0xe129('0x64')]['intentDetectionConfidence'],'speech':_0x390d82[_0xe129('0x64')][_0xe129('0x69')],'providerResponse':JSON['stringify'](_0x439069)};return _0x5d9456;}}});};exports[_0xe129('0x70')]=function(_0x120585,_0x3a283b,_0x53a151,_0x4dbab7){return tilde[_0xe129('0x71')](_0x120585,_0x3a283b,_0x53a151,_0x4dbab7)[_0xe129('0x36')](function(_0x3a85b2){try{fs[_0xe129('0x1d')](_0x120585);}catch(_0x303d97){logger[_0xe129('0x1c')](_0x303d97);}logger[_0xe129('0x24')]('Tilde\x20ASR\x20transcription',_0x3a85b2[_0xe129('0x4e')]);logger[_0xe129('0x24')](_0xe129('0x72'),_0x3a85b2['confidence']);return _0x3a85b2;});};exports[_0xe129('0x73')]=function(_0x63ba4d,_0x436a00,_0x59ada9,_0x3abc9b,_0x2295e4,_0x3aa90d){var _0x4ffeba=path['resolve'](__dirname,_0xe129('0x26'),rs[_0xe129('0x39')](0x4)+'.mp3');var _0x116f44;return aws[_0xe129('0x74')](_0x63ba4d,_0x436a00,_0x59ada9,_0x3abc9b,_0x2295e4,_0x3aa90d,_0x4ffeba)['then'](function(){_0x116f44=path[_0xe129('0x25')](__dirname,_0xe129('0x26'),rs['generate'](0x4)+'.wav');return convertFile(_0x4ffeba,_0x116f44);})[_0xe129('0x36')](function(){try{fs['unlink'](_0x4ffeba);fs[_0xe129('0x2a')](_0x116f44,'777');}catch(_0x3a6a16){logger['error'](_0x3a6a16);}return _0x116f44[_0xe129('0x3b')]('.')[0x0];});};exports[_0xe129('0x75')]=function(_0x4351ef,_0x164f07,_0x23cc65,_0x203d9d,_0x5aac29,_0x3985a4){return aws['lex'](_0x4351ef,_0x164f07,_0x23cc65,_0x203d9d,_0x5aac29,_0x3985a4)['then'](function(_0x2edc44){logger[_0xe129('0x24')](JSON['stringify'](_0x2edc44));return _0x2edc44;});};exports[_0xe129('0x76')]=function(_0x365606,_0x5289f6,_0x450fac,_0x1be4a2){var _0x2dd4ae=util['format'](_0xe129('0x77'),ISPEECH_API,_0x365606,encodeURIComponent(_0x5289f6),_0x450fac,_0x1be4a2);var _0x1d9890=path[_0xe129('0x25')](__dirname,'tmp',rs[_0xe129('0x39')](0x4)+_0xe129('0x37'));var _0x5ce7de;return downloadFile(_0x2dd4ae,_0x1d9890)['then'](function(){_0x5ce7de=path['resolve'](__dirname,_0xe129('0x26'),rs[_0xe129('0x39')](0x4)+_0xe129('0x27'));return convertFile(_0x1d9890,_0x5ce7de);})[_0xe129('0x36')](function(){try{fs[_0xe129('0x1d')](_0x1d9890);fs[_0xe129('0x2a')](_0x5ce7de,'777');}catch(_0xe60c){logger[_0xe129('0x1c')](_0xe60c);}return _0x5ce7de[_0xe129('0x3b')]('.')[0x0];});};exports[_0xe129('0x78')]=function(_0x1f615d,_0x5f205a,_0x35335a,_0x349313){var _0x7e647f=util['format'](_0xe129('0x79'),ISPEECH_API,_0x5f205a,_0x35335a,base64Encode(_0x1f615d),_0x349313?util[_0xe129('0x7a')](_0xe129('0x7b'),encodeURIComponent(_0x349313)):_0xe129('0x7c'));return uploadFile(_0x7e647f)[_0xe129('0x36')](function(_0x17b29c){return querystring[_0xe129('0x7d')](_0x17b29c);});};exports[_0xe129('0x7e')]=function(_0x4c46d8,_0x54e436){return sestek[_0xe129('0x7f')](_0x4c46d8,_0x54e436)[_0xe129('0x36')](function(_0x1d4fcd){logger[_0xe129('0x24')](JSON[_0xe129('0x41')](_0x1d4fcd));var _0x5b5247={'speech':_0x1d4fcd[_0xe129('0x80')],'action':_0x1d4fcd[_0xe129('0x81')]?_0x1d4fcd[_0xe129('0x81')][_0xe129('0x82')]:undefined,'actiondata':_0x1d4fcd[_0xe129('0x81')]?_0x1d4fcd[_0xe129('0x81')]['CustomActionData']:undefined};if(_0x1d4fcd['channelData']&&_0x1d4fcd['channelData'][_0xe129('0x83')]){return base64Decode(_0x1d4fcd['channelData']['AudioFromTts'][_0xe129('0x84')],path[_0xe129('0x25')](__dirname,_0xe129('0x26'),rs['generate'](0x4)+_0xe129('0x27')))[_0xe129('0x36')](function(_0xffbd7e){_0x5b5247[_0xe129('0x85')]=_0xffbd7e;return _0x5b5247;});}return _0x5b5247;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xbbdb=['POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','message','googleDialogflow','result','source','action','actionIncomplete','fulfillment','score','status','metadata','isFallbackIntent','replace','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','intent','name','displayName','languageCode','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','parse','util','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','close','unlink','end','https:','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','then','chmodSync','777','readFileSync','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','.mp3','audioContent','writeFile','info','googleCloudTTS\x20path','split','utf8'];(function(_0x29c768,_0x56446f){var _0x19fcdb=function(_0x2ee4a8){while(--_0x2ee4a8){_0x29c768['push'](_0x29c768['shift']());}};_0x19fcdb(++_0x56446f);}(_0xbbdb,0xca));var _0xbbbd=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xbbdb[_0x1064bc];return _0x5edc45;};'use strict';var apiai=require(_0xbbbd('0x0'));var BPromise=require(_0xbbbd('0x1'));var dialogflow=require(_0xbbbd('0x2'));var fs=require('fs');var http=require(_0xbbbd('0x3'));var https=require(_0xbbbd('0x4'));var md5=require(_0xbbbd('0x5'));var path=require(_0xbbbd('0x6'));var querystring=require(_0xbbbd('0x7'));var rp=require(_0xbbbd('0x8'));var rs=require(_0xbbbd('0x9'));var sox=require(_0xbbbd('0xa'));var tts=require('google-tts-api');var urlParse=require('url')[_0xbbbd('0xb')];var util=require(_0xbbbd('0xc'));var aws=require('./aws');var google=require(_0xbbbd('0xd'));var sestek=require(_0xbbbd('0xe'));var tilde=require(_0xbbbd('0xf'));var logger=require('../../../config/logger')(_0xbbbd('0x10'));var ISPEECH_API=_0xbbbd('0x11');function downloadFile(_0x32052e,_0x56e7ee){return new BPromise(function(_0x4bbc5e,_0x3ddad8){var _0x57d49b=urlParse(_0x32052e);var _0x5ddf34=_0x57d49b[_0xbbbd('0x12')]==='https:'?https:http;var _0x1f2fea={'host':_0x57d49b[_0xbbbd('0x13')],'path':_0x57d49b[_0xbbbd('0x6')],'headers':{'user-agent':_0xbbbd('0x14')}};_0x5ddf34[_0xbbbd('0x15')](_0x1f2fea,function(_0x581a4e){if(_0x581a4e[_0xbbbd('0x16')]!==0xc8){logger[_0xbbbd('0x17')](_0xbbbd('0x18')+_0x32052e+_0xbbbd('0x19')+_0x581a4e[_0xbbbd('0x16')]+'\x20('+_0x581a4e[_0xbbbd('0x1a')]+')');_0x3ddad8(new Error('request\x20to\x20'+_0x32052e+_0xbbbd('0x19')+_0x581a4e[_0xbbbd('0x16')]+'\x20('+_0x581a4e[_0xbbbd('0x1a')]+')'));return;}var _0x5c1019=fs[_0xbbbd('0x1b')](_0x56e7ee);_0x5c1019['on'](_0xbbbd('0x1c'),function(){logger['info']('finish\x20download\x20file');_0x5c1019[_0xbbbd('0x1d')](_0x4bbc5e);});_0x5c1019['on'](_0xbbbd('0x17'),function(_0x580fbc){fs[_0xbbbd('0x1e')](_0x56e7ee);logger[_0xbbbd('0x17')]('download\x20error',_0x580fbc);_0x3ddad8(_0x580fbc);});_0x581a4e['pipe'](_0x5c1019);})['on'](_0xbbbd('0x17'),function(_0x48abcb){logger[_0xbbbd('0x17')](_0x48abcb);_0x3ddad8(_0x48abcb);})[_0xbbbd('0x1f')]();});}function uploadFile(_0x32918e){return new BPromise(function(_0x5061a4,_0x5ee264){var _0x5d2760=urlParse(_0x32918e);var _0x2276aa=_0x5d2760[_0xbbbd('0x12')]===_0xbbbd('0x20')?https:http;var _0x57a261={'host':_0x5d2760[_0xbbbd('0x13')],'path':_0x5d2760['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x2276aa[_0xbbbd('0x15')](_0x57a261,function(_0x404e99){if(_0x404e99[_0xbbbd('0x16')]!==0xc8){_0x5ee264(new Error(_0xbbbd('0x18')+_0x32918e+_0xbbbd('0x19')+_0x404e99[_0xbbbd('0x16')]+'\x20('+_0x404e99['statusMessage']+')'));return;}var _0x518b34='';_0x404e99['on']('data',function(_0x31d604){_0x518b34+=_0x31d604;});_0x404e99['on'](_0xbbbd('0x1f'),function(){_0x5061a4(_0x518b34);});})['on'](_0xbbbd('0x17'),function(_0x5ee9ca){_0x5ee264(_0x5ee9ca);})[_0xbbbd('0x1f')]();});}function convertFile(_0x45f8ec,_0x10cb8d){return new BPromise(function(_0x4cb3c1,_0x22ca66){var _0x3db30d=sox['transcode'](_0x45f8ec,_0x10cb8d,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3db30d['on']('error',function(_0x200043){logger[_0xbbbd('0x17')](_0xbbbd('0x21'),_0x200043);_0x22ca66(_0x200043);});_0x3db30d['on'](_0xbbbd('0x1f'),function(){logger['info'](_0xbbbd('0x22'));_0x4cb3c1();});_0x3db30d[_0xbbbd('0x23')]();});}function base64Decode(_0x1dd6af,_0x30cfad){var _0x4ceddf=path[_0xbbbd('0x24')](__dirname,_0xbbbd('0x25'),rs[_0xbbbd('0x26')](0x4)+_0xbbbd('0x27'));fs[_0xbbbd('0x28')](_0x4ceddf,_0x1dd6af,'base64');return convertFile(_0x4ceddf,_0x30cfad)[_0xbbbd('0x29')](function(){try{fs[_0xbbbd('0x1e')](_0x4ceddf);fs[_0xbbbd('0x2a')](_0x30cfad,_0xbbbd('0x2b'));}catch(_0x34c6c0){logger[_0xbbbd('0x17')](_0x34c6c0);}return _0x30cfad['split']('.')[0x0];});}function base64Encode(_0x2ff1c4){var _0x373cab=fs[_0xbbbd('0x2c')](_0x2ff1c4);return new Buffer(_0x373cab)['toString'](_0xbbbd('0x2d'));}exports[_0xbbbd('0x2e')]=function(_0x56dd27,_0x25a6cc,_0x28ba5f,_0x4ad6ed,_0x4e889f,_0x411226){var _0x14aa76,_0x2c9c95;var _0x37a3b8=_0xbbbd('0x2f');var _0x4bb61c=_0xbbbd('0x30')+_0x56dd27;var _0x898628={};if(_0x25a6cc===_0xbbbd('0x31')){_0x898628[_0xbbbd('0x32')]={'ssml':_0x28ba5f};}else{_0x898628[_0xbbbd('0x32')]={'text':_0x28ba5f};};_0x898628[_0xbbbd('0x33')]={'languageCode':_0x4ad6ed,'ssmlGender':_0x4e889f};_0x898628[_0xbbbd('0x34')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x303bb6={'url':_0x37a3b8+'text:synthesize'+_0x4bb61c,'method':'POST','json':!![],'body':_0x898628};return rp(_0x303bb6)[_0xbbbd('0x29')](function(_0x1abc88){return new BPromise(function(_0x3c57fa,_0x5998a7){_0x14aa76=path[_0xbbbd('0x24')](__dirname,_0xbbbd('0x25'),rs[_0xbbbd('0x26')](0x4)+_0xbbbd('0x35'));var _0x668849=Buffer['from'](_0x1abc88[_0xbbbd('0x36')],'base64');return fs[_0xbbbd('0x37')](_0x14aa76,_0x668849,function(_0x3b75e2){_0x5998a7(_0x3b75e2);},function(_0x4fc24f){fs[_0xbbbd('0x2a')](_0x14aa76,_0xbbbd('0x2b'));_0x3c57fa(_0x4fc24f);});});})['then'](function(_0x769603){_0x2c9c95=path[_0xbbbd('0x24')](__dirname,_0xbbbd('0x25'),rs[_0xbbbd('0x26')](0x4)+_0xbbbd('0x27'));return convertFile(_0x14aa76,_0x2c9c95);})[_0xbbbd('0x29')](function(){try{fs[_0xbbbd('0x1e')](_0x14aa76);fs[_0xbbbd('0x2a')](_0x2c9c95,'777');}catch(_0x4ae8be){logger[_0xbbbd('0x17')](_0x4ae8be);}logger[_0xbbbd('0x38')](_0xbbbd('0x39'),_0x2c9c95[_0xbbbd('0x3a')]('.')[0x0]);return _0x2c9c95['split']('.')[0x0];});};exports['googleTTS']=function(_0x2785c0,_0x18e3b3){var _0x33bc54='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x53c2a7,_0x12212d;var _0x394045;var _0x50131e={'encoding':_0xbbbd('0x3b'),'method':_0xbbbd('0x3c'),'timeout':0x2710,'url':_0x33bc54,'headers':{'Content-Type':_0xbbbd('0x3d')},'body':_0xbbbd('0x3e')+encodeURIComponent(JSON[_0xbbbd('0x3f')]([[[_0xbbbd('0x40'),JSON[_0xbbbd('0x3f')]([_0x2785c0,_0x18e3b3||'en',![],_0xbbbd('0x41')]),null,_0xbbbd('0x42')]]]))};return rp(_0x50131e)['then'](function(_0x4f546b){try{_0x394045=eval(_0x4f546b[_0xbbbd('0x43')](0x5))[0x0][0x2];}catch(_0x506b17){throw new Error(_0xbbbd('0x44')+_0x4f546b[_0xbbbd('0x45')]);}if(!_0x394045){if(_0x2785c0['length']>0xc8){throw new Error(_0xbbbd('0x46'));}else{throw new Error('lang\x20\x22'+_0x18e3b3+_0xbbbd('0x47'));}}try{_0x394045=eval(_0x394045)[0x0];}catch(_0xd03d9f){throw new Error(_0xbbbd('0x44')+res[_0xbbbd('0x45')]);}const _0x2ab861=_0x394045;_0x53c2a7=path[_0xbbbd('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0xbbbd('0x35'));fs[_0xbbbd('0x28')](_0x53c2a7,_0x394045,{'encoding':_0xbbbd('0x2d')});_0x12212d=path[_0xbbbd('0x24')](__dirname,_0xbbbd('0x25'),rs[_0xbbbd('0x26')](0x4)+_0xbbbd('0x27'));return convertFile(_0x53c2a7,_0x12212d);})['then'](function(){try{fs[_0xbbbd('0x1e')](_0x53c2a7);fs[_0xbbbd('0x2a')](_0x12212d,_0xbbbd('0x2b'));}catch(_0x1165f7){logger[_0xbbbd('0x17')](_0x1165f7);}logger['info'](_0xbbbd('0x48'),_0x12212d['split']('.')[0x0]);return _0x12212d['split']('.')[0x0];});};exports[_0xbbbd('0x49')]=function(_0x539b43,_0x522955,_0x59753c){return google[_0xbbbd('0x4a')](_0x539b43,_0x522955,_0x59753c)['then'](function(_0x398b74){logger[_0xbbbd('0x38')](_0x398b74['uri']);return rp(_0x398b74);})[_0xbbbd('0x29')](function(_0x2fd792){var _0x11f5eb='';var _0x1c64be=0x0;try{fs[_0xbbbd('0x1e')](_0x539b43);}catch(_0x17ecfa){logger[_0xbbbd('0x17')](_0x17ecfa);}if(_0x2fd792&&_0x2fd792[_0xbbbd('0x4b')]){_0x11f5eb=_0x2fd792[_0xbbbd('0x4b')][_0xbbbd('0x4c')](function(_0x307939){return _0x307939&&_0x307939['alternatives'][0x0]&&_0x307939[_0xbbbd('0x4d')][0x0][_0xbbbd('0x4e')]?_0x307939[_0xbbbd('0x4d')][0x0]['transcript']:'';})[_0xbbbd('0x4f')]('\x0a');_0x1c64be=_0x2fd792[_0xbbbd('0x4b')][_0xbbbd('0x4c')](function(_0x483df6){return _0x483df6&&_0x483df6[_0xbbbd('0x4d')][0x0]&&_0x483df6[_0xbbbd('0x4d')][0x0][_0xbbbd('0x50')]?_0x483df6['alternatives'][0x0][_0xbbbd('0x50')]:0x0;})[_0xbbbd('0x4f')]('\x0a');}logger[_0xbbbd('0x38')](_0xbbbd('0x51'),_0x11f5eb);logger[_0xbbbd('0x38')]('googleASR\x20confidence',_0x1c64be);return{'transcript':_0x11f5eb,'confidence':_0x1c64be};})[_0xbbbd('0x52')](function(_0x268167){logger['error'](_0xbbbd('0x53'),_0x268167[_0xbbbd('0x16')],_0x268167['name'],_0x268167[_0xbbbd('0x54')]);});};exports[_0xbbbd('0x55')]=function(_0x566c58,_0x1dc0ba,_0x367850,_0x20c98a){var _0x1893cd=apiai(_0x1dc0ba,{'language':_0x20c98a||'en'});return _0x1893cd['textRequest'](_0x367850,{'sessionId':md5(_0x566c58)})[_0xbbbd('0x29')](function(_0x29f557){logger[_0xbbbd('0x38')](JSON[_0xbbbd('0x3f')](_0x29f557));return{'source':_0x29f557[_0xbbbd('0x56')][_0xbbbd('0x57')],'resolvedQuery':_0x29f557['result']['resolvedQuery'],'action':_0x29f557[_0xbbbd('0x56')][_0xbbbd('0x58')],'actionIncomplete':_0x29f557[_0xbbbd('0x56')][_0xbbbd('0x59')],'speech':_0x29f557[_0xbbbd('0x56')][_0xbbbd('0x5a')]['speech'],'score':_0x29f557[_0xbbbd('0x56')][_0xbbbd('0x5b')],'statusCode':_0x29f557[_0xbbbd('0x5c')]['code'],'endConversation':_0x29f557[_0xbbbd('0x56')][_0xbbbd('0x5d')]['endConversation']||![],'isFallbackIntent':_0x29f557['result'][_0xbbbd('0x5d')][_0xbbbd('0x5e')]};});};exports['googleDialogflowV2']=function(_0xf1ca7d,_0x12f754,_0x3293d9,_0x2d3151,_0x302608,_0x1d6aee){var _0x33a9e8=_0x2d3151[_0xbbbd('0x5f')](/\\n/g,'\x0a');var _0x368565={'credentials':{'private_key':_0x33a9e8,'client_email':_0x3293d9}};var _0x3f1fc3=new dialogflow['SessionsClient'](_0x368565);var _0x555e0d=_0x3f1fc3['sessionPath'](_0x12f754,md5(_0xf1ca7d));var _0xb05228={'session':_0x555e0d,'queryInput':{'text':{'text':_0x302608,'languageCode':_0x1d6aee}}};return _0x3f1fc3[_0xbbbd('0x60')](_0xb05228)[_0xbbbd('0x29')](function(_0x17c79e){if(_0x17c79e&&_0x17c79e[_0xbbbd('0x61')]){logger['info'](_0xbbbd('0x62'),JSON[_0xbbbd('0x3f')](_0x17c79e));var _0x218144=_0x17c79e[0x0];if(_0x218144){var _0x580bf9={'action':_0x218144[_0xbbbd('0x63')][_0xbbbd('0x58')],'allRequiredParamsPresent':_0x218144[_0xbbbd('0x63')][_0xbbbd('0x64')],'endConversation':_0x218144[_0xbbbd('0x63')][_0xbbbd('0x65')]&&_0x218144['queryResult'][_0xbbbd('0x65')]['fields']?_0x218144[_0xbbbd('0x63')][_0xbbbd('0x65')][_0xbbbd('0x66')]['end_conversation'][_0xbbbd('0x67')]:![],'fulfillmentText':_0x218144[_0xbbbd('0x63')]['fulfillmentText'],'intentName':_0x218144[_0xbbbd('0x63')][_0xbbbd('0x68')][_0xbbbd('0x69')],'intentDisplayName':_0x218144['queryResult']['intent'][_0xbbbd('0x6a')],'isFallbackIntent':_0x218144[_0xbbbd('0x63')][_0xbbbd('0x68')]['isFallback'],'languageCode':_0x218144[_0xbbbd('0x63')][_0xbbbd('0x6b')],'queryText':_0x218144[_0xbbbd('0x63')]['queryText'],'responseId':_0x218144[_0xbbbd('0x6c')],'score':_0x218144[_0xbbbd('0x63')][_0xbbbd('0x6d')],'speech':_0x218144[_0xbbbd('0x63')][_0xbbbd('0x6e')],'providerResponse':JSON[_0xbbbd('0x3f')](_0x17c79e)};return _0x580bf9;}}});};exports[_0xbbbd('0x6f')]=function(_0x41e09b,_0x2119ef,_0x39e8a2,_0x16bf35){return tilde['asr'](_0x41e09b,_0x2119ef,_0x39e8a2,_0x16bf35)[_0xbbbd('0x29')](function(_0xc024d){try{fs['unlink'](_0x41e09b);}catch(_0x5334f7){logger['error'](_0x5334f7);}logger[_0xbbbd('0x38')](_0xbbbd('0x70'),_0xc024d[_0xbbbd('0x4e')]);logger['info'](_0xbbbd('0x71'),_0xc024d[_0xbbbd('0x50')]);return _0xc024d;});};exports[_0xbbbd('0x72')]=function(_0x54c1b2,_0x13e6a2,_0x3c133d,_0x4550c9,_0x186d58,_0x46f2d3){var _0x170e9c=path[_0xbbbd('0x24')](__dirname,'tmp',rs[_0xbbbd('0x26')](0x4)+_0xbbbd('0x35'));var _0x5f22be;return aws['polly'](_0x54c1b2,_0x13e6a2,_0x3c133d,_0x4550c9,_0x186d58,_0x46f2d3,_0x170e9c)['then'](function(){_0x5f22be=path[_0xbbbd('0x24')](__dirname,_0xbbbd('0x25'),rs[_0xbbbd('0x26')](0x4)+_0xbbbd('0x27'));return convertFile(_0x170e9c,_0x5f22be);})['then'](function(){try{fs[_0xbbbd('0x1e')](_0x170e9c);fs[_0xbbbd('0x2a')](_0x5f22be,_0xbbbd('0x2b'));}catch(_0x26d4df){logger['error'](_0x26d4df);}return _0x5f22be[_0xbbbd('0x3a')]('.')[0x0];});};exports[_0xbbbd('0x73')]=function(_0x456afe,_0xf73fa8,_0x350c55,_0x1727b7,_0x10971d,_0x57c21e){return aws[_0xbbbd('0x74')](_0x456afe,_0xf73fa8,_0x350c55,_0x1727b7,_0x10971d,_0x57c21e)[_0xbbbd('0x29')](function(_0xd18679){logger[_0xbbbd('0x38')](JSON[_0xbbbd('0x3f')](_0xd18679));return _0xd18679;});};exports['ispeechTTS']=function(_0x5836f4,_0x45985b,_0x21d6e9,_0x5b4e9c){var _0x17f7ee=util[_0xbbbd('0x75')](_0xbbbd('0x76'),ISPEECH_API,_0x5836f4,encodeURIComponent(_0x45985b),_0x21d6e9,_0x5b4e9c);var _0x468eb6=path[_0xbbbd('0x24')](__dirname,_0xbbbd('0x25'),rs[_0xbbbd('0x26')](0x4)+_0xbbbd('0x35'));var _0x3a0698;return downloadFile(_0x17f7ee,_0x468eb6)[_0xbbbd('0x29')](function(){_0x3a0698=path[_0xbbbd('0x24')](__dirname,_0xbbbd('0x25'),rs[_0xbbbd('0x26')](0x4)+_0xbbbd('0x27'));return convertFile(_0x468eb6,_0x3a0698);})['then'](function(){try{fs[_0xbbbd('0x1e')](_0x468eb6);fs['chmodSync'](_0x3a0698,_0xbbbd('0x2b'));}catch(_0x53ea32){logger['error'](_0x53ea32);}return _0x3a0698[_0xbbbd('0x3a')]('.')[0x0];});};exports[_0xbbbd('0x77')]=function(_0x1ece5e,_0x5eac8e,_0x3c25f2,_0x1503a7){var _0x48056b=util[_0xbbbd('0x75')](_0xbbbd('0x78'),ISPEECH_API,_0x5eac8e,_0x3c25f2,base64Encode(_0x1ece5e),_0x1503a7?util[_0xbbbd('0x75')](_0xbbbd('0x79'),encodeURIComponent(_0x1503a7)):_0xbbbd('0x7a'));return uploadFile(_0x48056b)[_0xbbbd('0x29')](function(_0x58e0ca){return querystring[_0xbbbd('0xb')](_0x58e0ca);});};exports[_0xbbbd('0x7b')]=function(_0x21874d,_0x9b32c4){return sestek[_0xbbbd('0x7c')](_0x21874d,_0x9b32c4)[_0xbbbd('0x29')](function(_0x4713a1){logger[_0xbbbd('0x38')](JSON[_0xbbbd('0x3f')](_0x4713a1));var _0x26c933={'speech':_0x4713a1[_0xbbbd('0x7d')],'action':_0x4713a1[_0xbbbd('0x7e')]?_0x4713a1[_0xbbbd('0x7e')]['CustomAction']:undefined,'actiondata':_0x4713a1[_0xbbbd('0x7e')]?_0x4713a1[_0xbbbd('0x7e')][_0xbbbd('0x7f')]:undefined};if(_0x4713a1[_0xbbbd('0x7e')]&&_0x4713a1[_0xbbbd('0x7e')][_0xbbbd('0x80')]){return base64Decode(_0x4713a1[_0xbbbd('0x7e')]['AudioFromTts'][_0xbbbd('0x81')],path[_0xbbbd('0x24')](__dirname,_0xbbbd('0x25'),rs[_0xbbbd('0x26')](0x4)+_0xbbbd('0x27')))['then'](function(_0x3449ae){_0x26c933[_0xbbbd('0x82')]=_0x3449ae;return _0x26c933;});}return _0x26c933;});};exports['dirName']=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 6e578ed..21c5c08 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 _0xc0ae=['exports'];(function(_0xfaea1a,_0x20bcb7){var _0x1eb6b3=function(_0x1c07c5){while(--_0x1c07c5){_0xfaea1a['push'](_0xfaea1a['shift']());}};_0x1eb6b3(++_0x20bcb7);}(_0xc0ae,0x192));var _0xec0a=function(_0x31e32b,_0x2fb1ee){_0x31e32b=_0x31e32b-0x0;var _0x3a6f2f=_0xc0ae[_0x31e32b];return _0x3a6f2f;};var nda=require('./nda');module[_0xec0a('0x0')]={'nda':nda}; \ No newline at end of file +var _0x8736=['./nda'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8736,0x177));var _0x6873=function(_0x4fd394,_0x34d30f){_0x4fd394=_0x4fd394-0x0;var _0x10ad9b=_0x8736[_0x4fd394];return _0x10ad9b;};var nda=require(_0x6873('0x0'));module['exports']={'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 dd4d9cd..54a7590 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 _0xa3b7=['exports','POST','resolve','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','stringify','request-promise','../../../../../config/logger'];(function(_0x3cd457,_0x39ee33){var _0x572caf=function(_0x3194a0){while(--_0x3194a0){_0x3cd457['push'](_0x3cd457['shift']());}};_0x572caf(++_0x39ee33);}(_0xa3b7,0xe6));var _0x7a3b=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0xa3b7[_0x54a761];return _0x37d1da;};'use strict';var rp=require(_0x7a3b('0x0'));var url=require('url');var logger=require(_0x7a3b('0x1'))('agi');module[_0x7a3b('0x2')]=function(_0x27902a,_0x348cb3){var _0x161431={'method':_0x7a3b('0x3'),'uri':url[_0x7a3b('0x4')](_0x348cb3[_0x7a3b('0x5')],'/token'),'form':{'grant_type':_0x7a3b('0x6'),'username':_0x348cb3[_0x7a3b('0x7')],'password':_0x348cb3[_0x7a3b('0x6')]},'json':!![]};return rp(_0x161431)[_0x7a3b('0x8')](function(_0x63f93d){var _0x560f45={'method':_0x7a3b('0x3'),'uri':url['resolve'](_0x348cb3[_0x7a3b('0x9')],_0x7a3b('0xa')),'body':{'type':_0x348cb3[_0x7a3b('0xb')]||_0x7a3b('0xc'),'channelId':_0x7a3b('0xd'),'conversation':{'id':_0x27902a[_0x7a3b('0xe')]},'from':{'id':_0x27902a['callerid'],'name':_0x27902a[_0x7a3b('0xf')]},'recipient':{'id':_0x27902a[_0x7a3b('0x10')],'name':_0x27902a[_0x7a3b('0x11')]},'text':_0x348cb3['text'],'channelData':{}},'headers':{'Authorization':_0x7a3b('0x12')+_0x63f93d[_0x7a3b('0x13')]},'json':!![]};if(_0x348cb3['project']){_0x560f45[_0x7a3b('0x14')][_0x7a3b('0x15')][_0x7a3b('0x16')]=_0x348cb3['project'];}if(_0x348cb3[_0x7a3b('0x17')]=='1'){_0x560f45[_0x7a3b('0x14')][_0x7a3b('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7a3b('0x18')};}if(_0x348cb3[_0x7a3b('0x19')]){_0x560f45['body'][_0x7a3b('0x15')][_0x7a3b('0x1a')]=_0x348cb3[_0x7a3b('0x19')];if(_0x348cb3['custom_action_data']){_0x560f45[_0x7a3b('0x14')][_0x7a3b('0x15')]['CustomActionData']=_0x348cb3[_0x7a3b('0x1b')];}}logger['info'](JSON[_0x7a3b('0x1c')](_0x560f45));return rp(_0x560f45);});}; \ No newline at end of file +var _0x7495=['../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','callerid','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','url'];(function(_0x3fce59,_0x1a4d34){var _0x2cae61=function(_0x32181a){while(--_0x32181a){_0x3fce59['push'](_0x3fce59['shift']());}};_0x2cae61(++_0x1a4d34);}(_0x7495,0xc4));var _0x5749=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0x7495[_0xcfeda9];return _0x4826c7;};'use strict';var rp=require(_0x5749('0x0'));var url=require(_0x5749('0x1'));var logger=require(_0x5749('0x2'))(_0x5749('0x3'));module[_0x5749('0x4')]=function(_0x9456df,_0x536ca1){var _0x77c7db={'method':_0x5749('0x5'),'uri':url[_0x5749('0x6')](_0x536ca1[_0x5749('0x7')],_0x5749('0x8')),'form':{'grant_type':'password','username':_0x536ca1[_0x5749('0x9')],'password':_0x536ca1[_0x5749('0xa')]},'json':!![]};return rp(_0x77c7db)[_0x5749('0xb')](function(_0x4f45ad){var _0x29f9e5={'method':_0x5749('0x5'),'uri':url[_0x5749('0x6')](_0x536ca1[_0x5749('0xc')],_0x5749('0xd')),'body':{'type':_0x536ca1['ndaactivity_type']||_0x5749('0xe'),'channelId':_0x5749('0xf'),'conversation':{'id':_0x9456df['uniqueid']},'from':{'id':_0x9456df[_0x5749('0x10')],'name':_0x9456df['calleridname']},'recipient':{'id':_0x9456df[_0x5749('0x11')],'name':_0x9456df[_0x5749('0x12')]},'text':_0x536ca1[_0x5749('0x13')],'channelData':{}},'headers':{'Authorization':_0x5749('0x14')+_0x4f45ad[_0x5749('0x15')]},'json':!![]};if(_0x536ca1[_0x5749('0x16')]){_0x29f9e5[_0x5749('0x17')][_0x5749('0x18')][_0x5749('0x19')]=_0x536ca1[_0x5749('0x16')];}if(_0x536ca1[_0x5749('0x1a')]=='1'){_0x29f9e5[_0x5749('0x17')][_0x5749('0x18')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5749('0x1b')};}if(_0x536ca1[_0x5749('0x1c')]){_0x29f9e5[_0x5749('0x17')][_0x5749('0x18')][_0x5749('0x1d')]=_0x536ca1['custom_action'];if(_0x536ca1[_0x5749('0x1e')]){_0x29f9e5[_0x5749('0x17')][_0x5749('0x18')][_0x5749('0x1f')]=_0x536ca1['custom_action_data'];}}logger[_0x5749('0x20')](JSON['stringify'](_0x29f9e5));return rp(_0x29f9e5);});}; \ 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 fe54c33..304e89f 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 _0x2a4e=['./lib/api'];(function(_0x4bf9aa,_0xafa1ec){var _0x1db38a=function(_0x44540e){while(--_0x44540e){_0x4bf9aa['push'](_0x4bf9aa['shift']());}};_0x1db38a(++_0xafa1ec);}(_0x2a4e,0xf4));var _0xe2a4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2a4e[_0x321bb2];return _0x9c12ed;};'use strict';var asr=require(_0xe2a4('0x0'));module['exports']=function(_0x2d4c23,_0x2729a4,_0x56fac9,_0x45a4d6){return asr(_0x2d4c23,_0x2729a4,_0x56fac9,_0x45a4d6);}; \ No newline at end of file +var _0x8162=['exports','./lib/api'];(function(_0x500426,_0x304760){var _0x56c4a1=function(_0x3ad3ad){while(--_0x3ad3ad){_0x500426['push'](_0x500426['shift']());}};_0x56c4a1(++_0x304760);}(_0x8162,0xef));var _0x2816=function(_0x21a6f0,_0x34f377){_0x21a6f0=_0x21a6f0-0x0;var _0x394ada=_0x8162[_0x21a6f0];return _0x394ada;};'use strict';var asr=require(_0x2816('0x0'));module[_0x2816('0x1')]=function(_0x3000d6,_0x2dd105,_0x4e38f2,_0x535c06){return asr(_0x3000d6,_0x2dd105,_0x4e38f2,_0x535c06);}; \ 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 f7a6957..d4f3f2c 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 _0xee41=['bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','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','stringify','isNil','open','message'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xee41,0x7b));var _0x1ee4=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xee41[_0x3f0b30];return _0x2748a5;};'use strict';var BPromise=require(_0x1ee4('0x0'));var _=require(_0x1ee4('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x1ee4('0x2'));var crypto=require(_0x1ee4('0x3'));var logger=require(_0x1ee4('0x4'))(_0x1ee4('0x5'));module[_0x1ee4('0x6')]=function(_0x5457ea,_0x5edc46,_0x13ad59,_0x47b377){return new BPromise(function(_0x200ed9,_0x2ff66c){logger[_0x1ee4('0x7')](_0x1ee4('0x8'),_0x47b377||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x242f2f=new WebSocket(_0x47b377||_0x1ee4('0x9'),{'perMessageDeflate':![]});var _0x4d10f5='';var _0x30285c='0';var _0x218523='1';var _0x1fa473=_0x1ee4('0xa');function _0x37dcd9(_0x3241ba){var _0x2c1ee4=crypto['createHash'](_0x1ee4('0xb'));_0x2c1ee4[_0x1ee4('0xc')](_0x3241ba);return _0x2c1ee4[_0x1ee4('0xd')](_0x1ee4('0xe'));}function _0xc46ab2(){try{logger['info'](_0x1ee4('0xf'));var _0x4424ac=moment()['unix']();var _0x1b2cd5=_0x37dcd9(_0x4424ac+_0x5edc46+_0x13ad59);_0x242f2f[_0x1ee4('0x10')](JSON['stringify']({'appID':_0x5edc46,'timestamp':_0x4424ac,'appKey':_0x1b2cd5}));var _0x2e53a9=fs[_0x1ee4('0x11')](_0x5457ea);_0x2e53a9['on'](_0x1ee4('0x12'),function(_0x5c968c){_0x242f2f[_0x1ee4('0x10')](_0x5c968c);});_0x2e53a9['on'](_0x1ee4('0x13'),function(){_0x242f2f[_0x1ee4('0x10')](_0x1ee4('0x14'));});}catch(_0x28fe3b){logger[_0x1ee4('0x15')](_0x1ee4('0x16'),JSON['stringify'](_0x28fe3b));_0x242f2f[_0x1ee4('0x17')]();}}function _0x4e380c(_0x2d3ad9){try{if(_0x2d3ad9){var _0x40314b=JSON[_0x1ee4('0x18')](_0x2d3ad9);switch(_0x40314b[_0x1ee4('0x19')]){case 0x0:if(_0x40314b[_0x1ee4('0x1a')]){if(_0x40314b[_0x1ee4('0x1a')]['final']){logger['info'](_0x1ee4('0x1b'),JSON['stringify'](_0x40314b['result']['hypotheses']));_0x4d10f5=_0x40314b[_0x1ee4('0x1a')][_0x1ee4('0x1c')][0x0][_0x1ee4('0x1d')];_0x30285c=_0x40314b[_0x1ee4('0x1a')][_0x1ee4('0x1c')][0x0][_0x1ee4('0x1e')];_0x218523='0';_0x1fa473=_0x1ee4('0x1f');_0x242f2f['terminate']();}}break;case 0x1:logger[_0x1ee4('0x7')](_0x1ee4('0xa'));_0x218523='1';_0x1fa473=_0x1ee4('0xa');break;case 0x2:logger[_0x1ee4('0x7')](_0x1ee4('0x20'));_0x218523='2';_0x1fa473=_0x1ee4('0x20');break;case 0x9:logger[_0x1ee4('0x7')](_0x1ee4('0x21'));_0x218523='9';_0x1fa473=_0x1ee4('0x21');break;case 0xa:logger['info'](_0x1ee4('0x22'));_0x218523='10';_0x1fa473=_0x1ee4('0x22');break;case 0xb:logger[_0x1ee4('0x7')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x218523='11';_0x1fa473=_0x1ee4('0x23');}}}catch(_0x2f52ce){logger['error'](_0x1ee4('0x24'),JSON[_0x1ee4('0x25')](_0x2f52ce));_0x242f2f['terminate']();}}function _0x520be2(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x200ed9({'transcript':_0x4d10f5,'confidence':_0x30285c,'status':_0x218523,'status_message':_0x1fa473});}function _0x5df5f8(_0x5cd228){logger[_0x1ee4('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x1ee4('0x26')](_0x5cd228)){logger['error'](_['isObject'](_0x5cd228)?JSON['stringify'](_0x5cd228):_0x5cd228);}}_0x242f2f['on'](_0x1ee4('0x27'),_0xc46ab2);_0x242f2f['on'](_0x1ee4('0x28'),_0x4e380c);_0x242f2f['on'](_0x1ee4('0x13'),_0x520be2);_0x242f2f['on'](_0x1ee4('0x15'),_0x5df5f8);});}; \ No newline at end of file +var _0xc739=['final','info','hypotheses','likelihood','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','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','close','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xc739,0x14f));var _0x9c73=function(_0x1fda66,_0x444a72){_0x1fda66=_0x1fda66-0x0;var _0x8ccb39=_0xc739[_0x1fda66];return _0x8ccb39;};'use strict';var BPromise=require(_0x9c73('0x0'));var _=require(_0x9c73('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x9c73('0x2'));var logger=require(_0x9c73('0x3'))(_0x9c73('0x4'));module[_0x9c73('0x5')]=function(_0x49984f,_0x33617e,_0x1c3f77,_0x943248){return new BPromise(function(_0xc9ea99,_0x447702){logger['info'](_0x9c73('0x6'),_0x943248||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x6dc149=new WebSocket(_0x943248||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1337e6='';var _0x2d3f8e='0';var _0x17d0cf='1';var _0x3b3c3d=_0x9c73('0x7');function _0x55e296(_0x14c1ab){var _0x43a2d6=crypto[_0x9c73('0x8')](_0x9c73('0x9'));_0x43a2d6['update'](_0x14c1ab);return _0x43a2d6[_0x9c73('0xa')](_0x9c73('0xb'));}function _0x221a13(){try{logger['info'](_0x9c73('0xc'));var _0x2c7528=moment()[_0x9c73('0xd')]();var _0x5d6bb9=_0x55e296(_0x2c7528+_0x33617e+_0x1c3f77);_0x6dc149[_0x9c73('0xe')](JSON[_0x9c73('0xf')]({'appID':_0x33617e,'timestamp':_0x2c7528,'appKey':_0x5d6bb9}));var _0x7774c7=fs[_0x9c73('0x10')](_0x49984f);_0x7774c7['on'](_0x9c73('0x11'),function(_0x8053f5){_0x6dc149['send'](_0x8053f5);});_0x7774c7['on']('close',function(){_0x6dc149['send'](_0x9c73('0x12'));});}catch(_0x151315){logger[_0x9c73('0x13')](_0x9c73('0x14'),JSON[_0x9c73('0xf')](_0x151315));_0x6dc149[_0x9c73('0x15')]();}}function _0x2eb35e(_0x3f6afb){try{if(_0x3f6afb){var _0x55cad9=JSON[_0x9c73('0x16')](_0x3f6afb);switch(_0x55cad9[_0x9c73('0x17')]){case 0x0:if(_0x55cad9[_0x9c73('0x18')]){if(_0x55cad9[_0x9c73('0x18')][_0x9c73('0x19')]){logger[_0x9c73('0x1a')]('Tilde\x20ASR\x20hypoteses',JSON[_0x9c73('0xf')](_0x55cad9[_0x9c73('0x18')][_0x9c73('0x1b')]));_0x1337e6=_0x55cad9['result'][_0x9c73('0x1b')][0x0]['transcript'];_0x2d3f8e=_0x55cad9[_0x9c73('0x18')][_0x9c73('0x1b')][0x0][_0x9c73('0x1c')];_0x17d0cf='0';_0x3b3c3d=_0x9c73('0x1d');_0x6dc149[_0x9c73('0x15')]();}}break;case 0x1:logger[_0x9c73('0x1a')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x17d0cf='1';_0x3b3c3d=_0x9c73('0x7');break;case 0x2:logger[_0x9c73('0x1a')](_0x9c73('0x1e'));_0x17d0cf='2';_0x3b3c3d=_0x9c73('0x1e');break;case 0x9:logger['info'](_0x9c73('0x1f'));_0x17d0cf='9';_0x3b3c3d=_0x9c73('0x1f');break;case 0xa:logger[_0x9c73('0x1a')](_0x9c73('0x20'));_0x17d0cf='10';_0x3b3c3d='Authentication\x20failed.';break;case 0xb:logger[_0x9c73('0x1a')](_0x9c73('0x21'));_0x17d0cf='11';_0x3b3c3d=_0x9c73('0x21');}}}catch(_0x3c9351){logger[_0x9c73('0x13')](_0x9c73('0x22'),JSON[_0x9c73('0xf')](_0x3c9351));_0x6dc149[_0x9c73('0x15')]();}}function _0x2e9e69(){logger[_0x9c73('0x1a')]('Close\x20Tilde\x20ASR\x20socket');_0xc9ea99({'transcript':_0x1337e6,'confidence':_0x2d3f8e,'status':_0x17d0cf,'status_message':_0x3b3c3d});}function _0x4a8bf2(_0x5a2e9d){logger[_0x9c73('0x13')](_0x9c73('0x23'));if(!_[_0x9c73('0x24')](_0x5a2e9d)){logger[_0x9c73('0x13')](_[_0x9c73('0x25')](_0x5a2e9d)?JSON['stringify'](_0x5a2e9d):_0x5a2e9d);}}_0x6dc149['on']('open',_0x221a13);_0x6dc149['on'](_0x9c73('0x26'),_0x2eb35e);_0x6dc149['on'](_0x9c73('0x27'),_0x2e9e69);_0x6dc149['on']('error',_0x4a8bf2);});}; \ 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 8d63ba3..10cb4be 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 _0x3c7e=['exports','./asr'];(function(_0xc0c817,_0x3174a0){var _0x41947d=function(_0x4e50a2){while(--_0x4e50a2){_0xc0c817['push'](_0xc0c817['shift']());}};_0x41947d(++_0x3174a0);}(_0x3c7e,0xbf));var _0xe3c7=function(_0x3aaf97,_0x4fa2e8){_0x3aaf97=_0x3aaf97-0x0;var _0xeba75e=_0x3c7e[_0x3aaf97];return _0xeba75e;};var asr=require(_0xe3c7('0x0'));module[_0xe3c7('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 48c073b..51ed29d 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 _0xed95=['./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','listening','connection','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','close','exports','util','net','events','EventEmitter','./error'];(function(_0x34457b,_0x202cf1){var _0x1dd5d5=function(_0x7c009b){while(--_0x7c009b){_0x34457b['push'](_0x34457b['shift']());}};_0x1dd5d5(++_0x202cf1);}(_0xed95,0xb9));var _0x5ed9=function(_0x33edc4,_0x23fc0f){_0x33edc4=_0x33edc4-0x0;var _0xbf6543=_0xed95[_0x33edc4];return _0xbf6543;};'use strict';var util=require(_0x5ed9('0x0'));var net=require(_0x5ed9('0x1'));var EventEmitter=require(_0x5ed9('0x2'))[_0x5ed9('0x3')];var AGIError=require(_0x5ed9('0x4'));var AGIChannel=require(_0x5ed9('0x5'));var AGIServer=function(_0x453f85,_0x3e2272,_0x2a28e9){var _0x7b84d6=this,_0x453f85=_0x453f85||0x11dd,_0x3e2272=_0x3e2272||_0x5ed9('0x6'),_0x52a57d=null,_0x48efa8=0x0;EventEmitter[_0x5ed9('0x7')](_0x7b84d6);function _0x2fe2dd(){if(!_0x453f85){_0x7b84d6[_0x5ed9('0x8')](_0x5ed9('0x9'),new AGIError(_0x5ed9('0xa')));return![];}_0x52a57d=net['createServer']();_0x52a57d['listen'](_0x453f85,_0x3e2272);_0x52a57d['on'](_0x5ed9('0xb'),function(){_0x7b84d6[_0x5ed9('0x8')](_0x5ed9('0xb'));});_0x52a57d['on'](_0x5ed9('0xc'),function(_0x526924){_0x52a57d['getConnections'](function(_0x28e087,_0x144e86){if(_0x28e087){_0x7b84d6[_0x5ed9('0x8')](_0x5ed9('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x28e087));}else if(_0x2a28e9&&_0x2a28e9<0x0){_0x7b84d6[_0x5ed9('0x8')](_0x5ed9('0x9'),new AGIError(_0x5ed9('0xd')));_0x526924['destroy']();}else if(_0x2a28e9&&_0x2a28e9>0x0&&_0x2a28e9<_0x144e86){_0x48efa8+=0x1;_0x7b84d6['emit'](_0x5ed9('0x9'),new AGIError(_0x5ed9('0xe'),_0x48efa8));_0x526924['destroy']();}else{var _0x2cfd87=new AGIChannel(_0x526924);_0x2cfd87['on'](_0x5ed9('0xf'),function(){_0x7b84d6['emit']('connection',_0x2cfd87);});}});});_0x52a57d['on'](_0x5ed9('0x9'),function(_0x37dcf2){_0x7b84d6['emit'](_0x5ed9('0x9'),new AGIError(_0x5ed9('0x10'),_0x37dcf2['code']));});_0x52a57d['on'](_0x5ed9('0x11'),function(){_0x7b84d6[_0x5ed9('0x8')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x2fe2dd();});};util['inherits'](AGIServer,EventEmitter);module[_0x5ed9('0x12')]=function(_0x409a26,_0x3892d8,_0x44b8ca){return new AGIServer(_0x409a26,_0x3892d8,_0x44b8ca);}; \ No newline at end of file +var _0xb7cf=['error','E_AGI_ARGUMENT_PORT','listen','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','code','close','nextTick','exports','util','net','events','EventEmitter','./error','127.0.0.1','call','emit'];(function(_0x3f2797,_0x4155a9){var _0x1b710f=function(_0x31efbd){while(--_0x31efbd){_0x3f2797['push'](_0x3f2797['shift']());}};_0x1b710f(++_0x4155a9);}(_0xb7cf,0xca));var _0xfb7c=function(_0x14a791,_0xee32e9){_0x14a791=_0x14a791-0x0;var _0x2150f3=_0xb7cf[_0x14a791];return _0x2150f3;};'use strict';var util=require(_0xfb7c('0x0'));var net=require(_0xfb7c('0x1'));var EventEmitter=require(_0xfb7c('0x2'))[_0xfb7c('0x3')];var AGIError=require(_0xfb7c('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x228b05,_0xd5eb0f,_0xf6b92f){var _0xf47c1d=this,_0x228b05=_0x228b05||0x11dd,_0xd5eb0f=_0xd5eb0f||_0xfb7c('0x5'),_0x2e245c=null,_0x135394=0x0;EventEmitter[_0xfb7c('0x6')](_0xf47c1d);function _0x3c21f3(){if(!_0x228b05){_0xf47c1d[_0xfb7c('0x7')](_0xfb7c('0x8'),new AGIError(_0xfb7c('0x9')));return![];}_0x2e245c=net['createServer']();_0x2e245c[_0xfb7c('0xa')](_0x228b05,_0xd5eb0f);_0x2e245c['on'](_0xfb7c('0xb'),function(){_0xf47c1d[_0xfb7c('0x7')]('listening');});_0x2e245c['on'](_0xfb7c('0xc'),function(_0x5eef53){_0x2e245c['getConnections'](function(_0x17921f,_0x19824b){if(_0x17921f){_0xf47c1d[_0xfb7c('0x7')](_0xfb7c('0x8'),new AGIError(_0xfb7c('0xd'),_0x17921f));}else if(_0xf6b92f&&_0xf6b92f<0x0){_0xf47c1d[_0xfb7c('0x7')](_0xfb7c('0x8'),new AGIError(_0xfb7c('0xe')));_0x5eef53['destroy']();}else if(_0xf6b92f&&_0xf6b92f>0x0&&_0xf6b92f<_0x19824b){_0x135394+=0x1;_0xf47c1d[_0xfb7c('0x7')](_0xfb7c('0x8'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x135394));_0x5eef53[_0xfb7c('0xf')]();}else{var _0x270660=new AGIChannel(_0x5eef53);_0x270660['on'](_0xfb7c('0x10'),function(){_0xf47c1d[_0xfb7c('0x7')](_0xfb7c('0xc'),_0x270660);});}});});_0x2e245c['on'](_0xfb7c('0x8'),function(_0x536122){_0xf47c1d['emit'](_0xfb7c('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x536122[_0xfb7c('0x11')]));});_0x2e245c['on'](_0xfb7c('0x12'),function(){_0xf47c1d[_0xfb7c('0x7')](_0xfb7c('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xfb7c('0x13')](function(){_0x3c21f3();});};util['inherits'](AGIServer,EventEmitter);module[_0xfb7c('0x14')]=function(_0x227410,_0x3b2298,_0x361017){return new AGIServer(_0x227410,_0x3b2298,_0x361017);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 7c3cf1b..9499066 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 _0xb6e3=['file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','no\x20key\x20configured','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','beep','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','no\x20file\x20audio\x20selected','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','escape_digits','restapi','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','email','user','bcc','subject','Smtp','service','host','port','secure','authentication','pass','template_id','sendMail\x20message','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','agi','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','IntervalId','interval','map','Intervals','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPause','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','method','timeout','number','includes','POST','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','url','parse','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','replaceAllVariables','split','replaceAll','extra','getAndSetVariable','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','wait','no\x20list\x20selected','delay','add','callback_priority','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','MRCPRecog','RECOG_INSTANCE()','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','getSquareOdbc','no\x20query\x20configured','replace','query:\x20%s','getQueryOdbc','variable_id','forEach','keys','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','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\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','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block'];(function(_0x5874bd,_0x496481){var _0x174894=function(_0x1065d9){while(--_0x1065d9){_0x5874bd['push'](_0x5874bd['shift']());}};_0x174894(++_0x496481);}(_0xb6e3,0xbf));var _0x3b6e=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xb6e3[_0x2dea24];return _0x309d58;};'use strict';var fs=require('fs');var path=require(_0x3b6e('0x0'));var util=require(_0x3b6e('0x1'));var _=require(_0x3b6e('0x2'));var sh=require(_0x3b6e('0x3'));var odbc=require(_0x3b6e('0x4'))();var rs=require(_0x3b6e('0x5'));var moment=require(_0x3b6e('0x6'));var Mustache=require(_0x3b6e('0x7'));var rp=require('request-promise');var logger=require('../../config/logger')(_0x3b6e('0x8'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x3b6e('0x9');var recursiveMapAttributes=[_0x3b6e('0xa'),_0x3b6e('0xb')];var verticesWithRetry=[_0x3b6e('0xc'),_0x3b6e('0xd'),_0x3b6e('0xe')];var AGIVertices=function(_0x3164c4,_0x2c8caa,_0x57a395){this['channel']=_0x3164c4;this[_0x3b6e('0xf')]=_0x2c8caa;this['mailRpc']=_0x57a395;};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x11')]=function(_0x243576,_0xdd9256){this[_0x3b6e('0xf')][_0x3b6e('0x12')](_0x243576)[_0x3b6e('0x13')](function(_0x473fa5){_0xdd9256(null,_0x473fa5?_0x473fa5[_0x3b6e('0x14')]:![]);})[_0x3b6e('0x15')](function(_0x36869b){_0xdd9256(_0x36869b);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x16')]=function(_0x2b9368,_0xb9cc68){this[_0x3b6e('0xf')]['getVoiceQueueById'](_0x2b9368)['then'](function(_0x482d0e){_0xb9cc68(null,_0x482d0e?_0x482d0e[_0x3b6e('0x14')]:![]);})['catch'](function(_0x1be3fe){_0xb9cc68(_0x1be3fe);});};AGIVertices['prototype'][_0x3b6e('0x17')]=function(_0x8b00a2,_0xa48a22){this[_0x3b6e('0xf')][_0x3b6e('0x18')](_0x8b00a2)[_0x3b6e('0x13')](function(_0x3da222){_0xa48a22(null,_0x3da222?_0x3da222[_0x3b6e('0x14')]:![]);})[_0x3b6e('0x15')](function(_0x6a373e){_0xa48a22(_0x6a373e);});};AGIVertices[_0x3b6e('0x10')]['getSquareOdbc']=function(_0x5b771c,_0x4183ac){this['rpc'][_0x3b6e('0x19')](_0x5b771c)[_0x3b6e('0x13')](function(_0x3f244f){_0x4183ac(null,_0x3f244f?_0x3f244f[_0x3b6e('0x1a')]:![]);})[_0x3b6e('0x15')](function(_0x389ba4){_0x4183ac(_0x389ba4);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1b')]=function(_0x4b470e,_0xefcc5d){this[_0x3b6e('0xf')][_0x3b6e('0x1c')](_0x4b470e)[_0x3b6e('0x13')](function(_0x1ea312){_0xefcc5d(null,_0x1ea312?_0x1ea312[_0x3b6e('0x14')]:![]);})[_0x3b6e('0x15')](function(_0x2fc240){_0xefcc5d(_0x2fc240);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1d')]=function(_0x5b0536,_0x264278){this[_0x3b6e('0xf')][_0x3b6e('0x1e')](_0x5b0536)[_0x3b6e('0x13')](function(_0x54f8e5){_0x264278(null,_0x54f8e5?_0x54f8e5[_0x3b6e('0x14')]:![]);})[_0x3b6e('0x15')](function(_0xb0f906){_0x264278(_0xb0f906);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1f')]=function(_0x3073b8,_0x191730){var _0x1a9db9=this;this[_0x3b6e('0xf')]['getSoundById'](_0x3073b8)[_0x3b6e('0x13')](function(_0x143239){_0x191730(null,_0x143239?_0x1a9db9[_0x3b6e('0x20')](_0x143239[_0x3b6e('0x21')]):![]);})[_0x3b6e('0x15')](function(_0x577a07){_0x191730(_0x577a07);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x22')]=function(_0x1362b8,_0x5ad4a4){this[_0x3b6e('0xf')][_0x3b6e('0x23')](_0x1362b8)[_0x3b6e('0x13')](function(_0x1ddfe1){_0x5ad4a4(null,_0x1ddfe1?_0x1ddfe1:![]);})[_0x3b6e('0x15')](function(_0x2e30fb){_0x5ad4a4(_0x2e30fb);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x24')]=function(_0x156133,_0x21dc64,_0xc508df){this[_0x3b6e('0x25')][_0x3b6e('0x24')](_0x156133,_0x21dc64)[_0x3b6e('0x13')](function(){_0xc508df(null);})[_0x3b6e('0x15')](function(_0x213259){_0xc508df(_0x213259);});};AGIVertices['prototype']['getIntervals']=function(_0x132fa6,_0x1c2c6b){this['rpc']['getIntervalById'](_0x132fa6)[_0x3b6e('0x13')](function(_0x557de9){if(_0x557de9){if(_0x557de9[_0x3b6e('0x26')]){_0x1c2c6b(null,[_0x557de9[_0x3b6e('0x27')]]);}else{_0x1c2c6b(null,_[_0x3b6e('0x28')](_0x557de9[_0x3b6e('0x29')],_0x3b6e('0x27')));}}else{_0x1c2c6b(null,![]);}})[_0x3b6e('0x15')](function(_0x398755){_0x1c2c6b(_0x398755);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x20')]=function(_0x4cbdbc){return util[_0x3b6e('0x2a')]('%s/sounds/converted/%s',FILES_PATH,_0x4cbdbc);};AGIVertices[_0x3b6e('0x10')]['getQueryOdbc']=function(_0x41a4d5,_0x4a4ab2,_0x1b10b6){odbc[_0x3b6e('0x2b')](_0x41a4d5,function(_0x1135be){if(_0x1135be){logger[_0x3b6e('0x2c')](_0x3b6e('0x2d'),_0x1135be);_0x1b10b6(_0x1135be);}else{logger[_0x3b6e('0x2e')]('ODBC\x20connection\x20successfully');odbc[_0x3b6e('0x2f')](_0x4a4ab2,function(_0x2e8c6e,_0x584798){if(_0x2e8c6e){logger['info'](_0x3b6e('0x30'),_0x4a4ab2);_0x1b10b6(_0x2e8c6e);}else{logger[_0x3b6e('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x4a4ab2);odbc[_0x3b6e('0x31')](function(_0x3d8d6c){if(_0x3d8d6c){logger['error'](_0x3b6e('0x32'),_0x3d8d6c);}_0x1b10b6(null,_0x584798);});}});}});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x33')]=function(_0x368aa7,_0x4fddd0){this[_0x3b6e('0xf')]['getSmsAccountById'](_0x368aa7)[_0x3b6e('0x13')](function(_0x55d8f3){_0x4fddd0(null,_0x55d8f3?_0x55d8f3:![]);})[_0x3b6e('0x15')](function(_0x17f464){_0x4fddd0(_0x17f464);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x34')]=function(_0x4aca69,_0x4c23af){this[_0x3b6e('0xf')][_0x3b6e('0x34')](_0x4aca69)[_0x3b6e('0x13')](function(_0x5ddc57){_0x4c23af(null,_0x5ddc57);})[_0x3b6e('0x15')](function(_0x4a171b){_0x4c23af(_0x4a171b);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x35')]=function(_0x58556c,_0x1fa898,_0x30d90d){this[_0x3b6e('0xf')][_0x3b6e('0x35')]({'uniqueid':this[_0x3b6e('0x36')][_0x3b6e('0x37')],'node':_0x58556c[_0x3b6e('0x38')],'application':_0x58556c[_0x3b6e('0x39')],'data':_0x1fa898||null,'project_name':this[_0x3b6e('0x36')][_0x3b6e('0x3a')],'callerid':this[_0x3b6e('0x36')]['callerid']})[_0x3b6e('0x13')](function(_0x32e085){if(_0x30d90d){_0x30d90d(null,_0x32e085);}})[_0x3b6e('0x15')](function(_0x18a28a){if(_0x30d90d){_0x30d90d(_0x18a28a);}});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x3b')]=function(_0x24313c,_0x5bfd13,_0x33b038,_0x39bc00){this[_0x3b6e('0xf')][_0x3b6e('0x3b')]({'uniqueid':this[_0x3b6e('0x36')][_0x3b6e('0x37')],'callerid':this[_0x3b6e('0x36')][_0x3b6e('0x3c')],'calleridname':this[_0x3b6e('0x36')][_0x3b6e('0x3d')],'context':this[_0x3b6e('0x36')][_0x3b6e('0x3e')],'extension':this[_0x3b6e('0x36')][_0x3b6e('0x3f')],'priority':this[_0x3b6e('0x36')]['priority'],'accountcode':this[_0x3b6e('0x36')][_0x3b6e('0x40')],'dnid':this[_0x3b6e('0x36')][_0x3b6e('0x41')],'projectName':this[_0x3b6e('0x36')][_0x3b6e('0x3a')],'saveName':_0x5bfd13,'filename':_0x24313c[_0x3b6e('0x42')]||_0x5bfd13,'savePath':_0x33b038})[_0x3b6e('0x13')](function(_0x20ac6f){_0x39bc00(null,_0x20ac6f);})[_0x3b6e('0x15')](function(_0x448e85){_0x39bc00(_0x448e85);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x43')]=function(_0x439449,_0x5135ac,_0x68564b,_0x311d78,_0x46ae84){this['rpc'][_0x3b6e('0x43')]({'uniqueid':this[_0x3b6e('0x36')]['uniqueid'],'body':_0x439449,'direction':_0x5135ac,'providerName':_0x68564b,'providerResponse':_0x311d78})[_0x3b6e('0x13')](function(_0x30ad92){if(_0x46ae84){_0x46ae84(null,_0x30ad92);}})[_0x3b6e('0x15')](function(_0x259d45){if(_0x46ae84){_0x46ae84(_0x259d45);}});};AGIVertices['prototype']['createCmContact']=function(_0x55b70a,_0x2831f6){this[_0x3b6e('0xf')][_0x3b6e('0x44')]({'firstName':_['isEmpty'](_0x55b70a[_0x3b6e('0x14')])||_[_0x3b6e('0x45')](_0x55b70a['name'])?_0x3b6e('0x46')+Math[_0x3b6e('0x47')]():_0x55b70a[_0x3b6e('0x14')],'lastName':_[_0x3b6e('0x48')](_0x55b70a['lastName'])||_[_0x3b6e('0x45')](_0x55b70a[_0x3b6e('0x49')])?null:_0x55b70a[_0x3b6e('0x49')],'phone':_0x55b70a[_0x3b6e('0x4a')],'ListId':_0x55b70a[_0x3b6e('0x4b')],'scheduledat':_0x55b70a['scheduledAt'],'callbackUniqueid':this[_0x3b6e('0x36')][_0x3b6e('0x37')],'tags':_0x3b6e('0x4c'),'description':_0x3b6e('0x4d')+_0x55b70a[_0x3b6e('0x4e')][_0x3b6e('0x4f')](),'priority':_0x55b70a['callback_priority']})[_0x3b6e('0x13')](function(_0x4a7e51){_0x2831f6(null,_0x4a7e51);})[_0x3b6e('0x15')](function(_0x2e57f8){_0x2831f6(_0x2e57f8);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x50')]=function(_0x30c435,_0x239a50){this[_0x3b6e('0xf')]['getPauseById'](_0x30c435)[_0x3b6e('0x13')](function(_0x49c2da){_0x239a50(null,_0x49c2da?_0x49c2da['name']:![]);})[_0x3b6e('0x15')](function(_0x5b1303){_0x239a50(_0x5b1303);});};AGIVertices[_0x3b6e('0x10')]['agentPause']=function(_0x575b86,_0x3000ea,_0x5e5eec){var _0x3220e0={'role':_0x3b6e('0x51')};_0x3220e0[_0x575b86]=this['channel'][_0x3b6e('0x3c')];this[_0x3b6e('0xf')][_0x3b6e('0x52')](_0x3220e0,_0x3000ea,this[_0x3b6e('0x36')][_0x3b6e('0x37')])[_0x3b6e('0x13')](function(_0x30d600){_0x5e5eec(null,_[_0x3b6e('0x45')](_0x30d600)?![]:!![]);})['catch'](function(_0x45524b){logger['error'](_0x45524b);_0x5e5eec(null,![]);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x53')]=function(_0x5a4f33,_0x171ae7){var _0x5b9e39={'role':'agent'};_0x5b9e39[_0x5a4f33]=this[_0x3b6e('0x36')][_0x3b6e('0x3c')];this[_0x3b6e('0xf')]['agentUnpause'](_0x5b9e39)[_0x3b6e('0x13')](function(_0x7be201){_0x171ae7(null,_[_0x3b6e('0x45')](_0x7be201)?![]:!![]);})['catch'](function(_0x34791e){logger[_0x3b6e('0x2c')](_0x34791e);_0x171ae7(null,![]);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x54')]=function(_0x2231b9,_0x170261){var _0x22065e={'role':_0x3b6e('0x51')};_0x22065e[_0x2231b9]=this['channel']['callerid'];this['rpc'][_0x3b6e('0x54')](_0x22065e)[_0x3b6e('0x13')](function(_0x3c8d61){_0x170261(null,_[_0x3b6e('0x45')](_0x3c8d61)?![]:!![]);})['catch'](function(_0x4cd9fa){logger[_0x3b6e('0x2c')](_0x4cd9fa);_0x170261(null,![]);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x55')]=function(_0x4a03be,_0x4d49b0){var _0x38b723={'role':_0x3b6e('0x51')};_0x38b723[_0x4a03be]=this[_0x3b6e('0x36')][_0x3b6e('0x3c')];var _0x1bf185=_0x4a03be!=_0x3b6e('0x56')?util[_0x3b6e('0x2a')](_0x3b6e('0x57'),'LOCAL',this[_0x3b6e('0x36')]['callerid']):undefined;this[_0x3b6e('0xf')]['agentLogin'](_0x38b723,_0x1bf185)[_0x3b6e('0x13')](function(_0x1e0764){_0x4d49b0(null,_['isNil'](_0x1e0764)?![]:!![]);})[_0x3b6e('0x15')](function(_0xc3a117){logger[_0x3b6e('0x2c')](_0xc3a117);_0x4d49b0(null,![]);});};AGIVertices[_0x3b6e('0x10')]['shellCommand']=function(_0x6e8e35,_0x53060d){sh['exec'](_[_0x3b6e('0x58')](_0x6e8e35),function(_0x4c598f,_0x3cdd58){var _0x1f1360=_0x3cdd58['replace'](/(\r\n|\n|\r)/gm,'');_0x53060d(null,_0x1f1360);});};AGIVertices[_0x3b6e('0x10')]['googleCloudTTS']=function(_0x1d5b89,_0x40f6de){scripts[_0x3b6e('0x59')](_0x1d5b89[_0x3b6e('0x5a')],_0x1d5b89[_0x3b6e('0x5b')]||'text',_0x1d5b89[_0x3b6e('0x5c')],_0x1d5b89[_0x3b6e('0x5d')]||_0x3b6e('0x5e'),_0x1d5b89[_0x3b6e('0x5f')]||_0x3b6e('0x60'),_0x1d5b89[_0x3b6e('0x61')]||'MP3')[_0x3b6e('0x13')](function(_0x302bc3){_0x40f6de(null,_0x302bc3);})[_0x3b6e('0x15')](function(_0x390664){_0x40f6de(_0x390664);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x62')]=function(_0x40675b,_0xd8fa08){scripts[_0x3b6e('0x62')](_0x40675b['text'],_0x40675b['google_tts_language']||'en',0x1)[_0x3b6e('0x13')](function(_0x424ca4){_0xd8fa08(null,_0x424ca4);})[_0x3b6e('0x15')](function(_0x169cb8){_0xd8fa08(_0x169cb8);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x63')]=function(_0x527bdc,_0x221c83){var _0x14527c={'uri':_0x527bdc['url'],'method':_0x527bdc[_0x3b6e('0x64')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x527bdc[_0x3b6e('0x65')])===_0x3b6e('0x66')&&parseInt(_0x527bdc[_0x3b6e('0x65')])>=0x1?parseInt(_0x527bdc[_0x3b6e('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x3b6e('0x67')]([_0x3b6e('0x68'),'PUT'],_0x14527c[_0x3b6e('0x64')][_0x3b6e('0x69')]())){try{_0x14527c[_0x3b6e('0x6a')]=_0x527bdc['rawBody']?JSON['parse'](_0x527bdc[_0x3b6e('0xb')]):{};}catch(_0x199c61){logger[_0x3b6e('0x2c')](_0x3b6e('0x6b'),_0x199c61);}}try{_0x14527c[_0x3b6e('0x6c')]=_0x527bdc[_0x3b6e('0xa')]?JSON['parse'](_0x527bdc[_0x3b6e('0xa')]):{};}catch(_0x5cea41){logger[_0x3b6e('0x2c')](_0x3b6e('0x6d'),_0x5cea41);}if(_0x527bdc['computedVariables']){try{var _0x523d67=require(_0x527bdc[_0x3b6e('0x6e')])[_0x3b6e('0x6f')](this,_0x14527c);_0x14527c['uri']=Mustache[_0x3b6e('0x70')](_0x527bdc[_0x3b6e('0x71')],_0x523d67,{},['$$','$$']);if(_0x14527c[_0x3b6e('0x6c')]){_0x14527c['headers']=JSON[_0x3b6e('0x72')](Mustache[_0x3b6e('0x70')](JSON[_0x3b6e('0x73')](_0x14527c[_0x3b6e('0x6c')]),_0x523d67,{},['$$','$$']));}if(_0x14527c[_0x3b6e('0x6a')]){_0x14527c[_0x3b6e('0x6a')]=JSON[_0x3b6e('0x72')](Mustache[_0x3b6e('0x70')](JSON[_0x3b6e('0x73')](_0x14527c[_0x3b6e('0x6a')]),_0x523d67,{},['$$','$$']));}}catch(_0x1e107b){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1e107b);}}rp(_0x14527c)[_0x3b6e('0x13')](function(_0x1ce4d8){var _0x25b4b9={'statusCode':_0x1ce4d8[_0x3b6e('0x74')]||0xc8,'statusMessage':_0x1ce4d8['statusMessage']||'OK','headers':_0x1ce4d8[_0x3b6e('0x6c')]||{},'body':_0x1ce4d8[_0x3b6e('0x6a')]||{}};_0x221c83(null,_0x25b4b9);})[_0x3b6e('0x15')](function(_0x51545c){var _0x355d6d={'statusCode':_0x51545c[_0x3b6e('0x74')]||0x1f4,'statusMessage':_0x51545c[_0x3b6e('0x75')]||_0x3b6e('0x76'),'headers':_0x51545c['options'][_0x3b6e('0x6c')]||{},'body':_0x51545c[_0x3b6e('0x77')][_0x3b6e('0x6a')]||{}};_0x221c83(null,_0x355d6d);});};AGIVertices[_0x3b6e('0x10')]['googleDialogflow']=function(_0x13bd71,_0x57b46e){scripts['googleDialogflow'](this[_0x3b6e('0x36')][_0x3b6e('0x37')],_0x13bd71[_0x3b6e('0x78')],_0x13bd71[_0x3b6e('0x5c')],_0x13bd71[_0x3b6e('0x79')]||'en')[_0x3b6e('0x13')](function(_0x3a3952){_0x57b46e(null,_0x3a3952);})[_0x3b6e('0x15')](function(_0x89b57d){_0x57b46e(_0x89b57d);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x7a')]=function(_0x558fb4,_0x20f1a5){scripts['googleDialogflowV2'](this[_0x3b6e('0x36')][_0x3b6e('0x37')],_0x558fb4[_0x3b6e('0x7b')],_0x558fb4[_0x3b6e('0x7c')],_0x558fb4[_0x3b6e('0x7d')],_0x558fb4[_0x3b6e('0x5c')],_0x558fb4[_0x3b6e('0x7e')]||'en')['then'](function(_0x130706){_0x20f1a5(null,_0x130706);})[_0x3b6e('0x15')](function(_0x473eec){_0x20f1a5(_0x473eec);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x7f')]=function(_0x16f2b5,_0x1d2f8c){scripts[_0x3b6e('0x7f')](this[_0x3b6e('0x36')],_0x16f2b5)[_0x3b6e('0x13')](function(_0x1ec733){_0x1d2f8c(null,_0x1ec733);})['catch'](function(_0x1c19ab){_0x1d2f8c(_0x1c19ab);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x80')]=function(_0x54ff32,_0xb2d862){scripts[_0x3b6e('0x80')](_0x54ff32[_0x3b6e('0x78')],_0x54ff32[_0x3b6e('0x5c')],_0x54ff32[_0x3b6e('0x81')]||_0x3b6e('0x5e'),_0x54ff32['speed'])[_0x3b6e('0x13')](function(_0x3d4a2b){_0xb2d862(null,_0x3d4a2b);})[_0x3b6e('0x15')](function(_0x575aaf){_0xb2d862(_0x575aaf);});};AGIVertices['prototype'][_0x3b6e('0x82')]=function(_0x21cb3d,_0x50b57c,_0x45b9cb){scripts[_0x3b6e('0x82')](_0x50b57c,_0x21cb3d[_0x3b6e('0x78')],_0x21cb3d['ispeech_asr_language']||'en-US',this['isConfigured'](_0x21cb3d[_0x3b6e('0x83')])?_0x21cb3d['model']:undefined)['then'](function(_0x32d229){_0x45b9cb(null,_0x32d229);})['catch'](function(_0x24b753){_0x45b9cb(_0x24b753);});};AGIVertices['prototype'][_0x3b6e('0x84')]=function(_0x4dfe52,_0x2c0acf){scripts[_0x3b6e('0x84')](_0x4dfe52[_0x3b6e('0x85')],_0x4dfe52[_0x3b6e('0x86')],_0x4dfe52[_0x3b6e('0x87')],_0x4dfe52['aws_polly_voice']||_0x3b6e('0x88'),_0x4dfe52[_0x3b6e('0x5c')],_0x4dfe52['aws_text_type']||_0x3b6e('0x5c'))[_0x3b6e('0x13')](function(_0x2cf6e6){_0x2c0acf(null,_0x2cf6e6);})[_0x3b6e('0x15')](function(_0x4b859){_0x2c0acf(_0x4b859);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x89')]=function(_0x4bafae,_0x4ace83){scripts[_0x3b6e('0x89')](this[_0x3b6e('0x36')]['uniqueid'],_0x4bafae[_0x3b6e('0x85')],_0x4bafae[_0x3b6e('0x86')],_0x4bafae[_0x3b6e('0x8a')],_0x4bafae['text'],_0x4bafae[_0x3b6e('0x8b')])[_0x3b6e('0x13')](function(_0x2fa446){_0x4ace83(null,_0x2fa446);})[_0x3b6e('0x15')](function(_0x488dea){_0x4ace83(_0x488dea);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x8c')]=function(_0x4cce30,_0x1140da,_0x5297d4){scripts['googleASR'](_0x1140da,_0x4cce30['key'],_0x4cce30[_0x3b6e('0x8d')]||_0x3b6e('0x5e'))['then'](function(_0xfd6dec){_0x5297d4(null,_0xfd6dec);})[_0x3b6e('0x15')](function(_0xa68bdd){_0x5297d4(_0xa68bdd);});};AGIVertices['prototype']['tildeASR']=function(_0xc35a43,_0x477e82,_0xf48b91){scripts['tildeASR'](_0x477e82,_0xc35a43[_0x3b6e('0x8e')],_0xc35a43[_0x3b6e('0x8f')],_0xc35a43['uri'])['then'](function(_0x58ceee){_0xf48b91(null,_0x58ceee);})[_0x3b6e('0x15')](function(_0x4f1fb7){_0xf48b91(_0x4f1fb7);});};AGIVertices['prototype'][_0x3b6e('0x90')]=function(_0x5ab12e){var _0x32efd6=_[_0x3b6e('0x67')](verticesWithRetry,_0x5ab12e[_0x3b6e('0x39')])?_0x5ab12e:_[_0x3b6e('0x91')](_0x5ab12e);for(var _0x540b05 in _0x32efd6){if(_0x32efd6[_0x3b6e('0x92')](_0x540b05)){if(_0x32efd6[_0x540b05]&&_['isString'](_0x32efd6[_0x540b05])){if(_[_0x3b6e('0x67')](recursiveMapAttributes,_0x540b05)){_0x32efd6[_0x540b05]=this[_0x3b6e('0x93')](_0x32efd6[_0x540b05]);}else{_0x32efd6[_0x540b05]=this['replaceAllVariables'](_0x32efd6[_0x540b05]);}}}}return _0x32efd6;};AGIVertices['prototype'][_0x3b6e('0x94')]=function(_0x560310){for(var _0x360ebd in _0x560310){if(_0x560310[_0x3b6e('0x92')](_0x360ebd)){if(_[_0x3b6e('0x95')](_0x560310[_0x360ebd])){this[_0x3b6e('0x94')](_0x560310[_0x360ebd]);}else if(_[_0x3b6e('0x96')](_0x560310[_0x360ebd])){for(var _0x3e3676=0x0;_0x3e3676<_0x560310[_0x360ebd][_0x3b6e('0x97')];_0x3e3676++){this[_0x3b6e('0x94')](_0x560310[_0x360ebd][_0x3e3676]);}}else if(_[_0x3b6e('0x98')](_0x560310[_0x360ebd])){_0x560310[_0x360ebd]=this['replaceAllVariables'](_0x560310[_0x360ebd]);}}}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x99')]=function(_0x1fac5b,_0x40ff0a){for(var _0x54f62d in _0x1fac5b){if(_0x1fac5b[_0x3b6e('0x92')](_0x54f62d)){if(_[_0x3b6e('0x95')](_0x1fac5b[_0x54f62d])){if(!_['isEmpty'](_0x1fac5b[_0x54f62d])){this['saveRestApiResult'](_0x1fac5b[_0x54f62d],util[_0x3b6e('0x2a')](_0x3b6e('0x9a'),_0x40ff0a,_0x54f62d));}}else if(_['isArray'](_0x1fac5b[_0x54f62d])){for(var _0x145ef3=0x0;_0x145ef3<_0x1fac5b[_0x54f62d][_0x3b6e('0x97')];_0x145ef3++){this[_0x3b6e('0x99')](_0x1fac5b[_0x54f62d][_0x145ef3],util[_0x3b6e('0x2a')]('%s.%s',_0x40ff0a,_0x54f62d+'['+_0x145ef3+']'));}}else{if(!_[_0x3b6e('0x45')](_0x1fac5b[_0x54f62d])){this[_0x3b6e('0x36')][_0x3b6e('0x9b')](util[_0x3b6e('0x2a')](_0x3b6e('0x9a'),_0x40ff0a,_0x54f62d),_0x1fac5b[_0x54f62d]);}}}}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x93')]=function(_0xffe6fd){try{var _0x18cb6b=JSON[_0x3b6e('0x72')](_0xffe6fd);this[_0x3b6e('0x94')](_0x18cb6b);return JSON[_0x3b6e('0x73')](_0x18cb6b);}catch(_0x17e5c6){return this['replaceAllVariables'](_0xffe6fd);}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x9c')]=function(_0x1e99c3){var _0x292165=_0x1e99c3['split']('{');for(var _0x436231=0x1;_0x436231<_0x292165['length'];_0x436231+=0x1){var _0x28d88e=_0x292165[_0x436231][_0x3b6e('0x9d')]('}');if(_0x28d88e[_0x3b6e('0x97')]>0x1){_0x1e99c3=_0x1e99c3[_0x3b6e('0x9e')]('{'+_0x28d88e[0x0]+'}',this[_0x3b6e('0x36')]['getVariable'](_0x28d88e[0x0])[_0x3b6e('0x9f')]||_0x28d88e[0x0]);}}if(_0x292165['length']===0x1){return _0x1e99c3[_0x3b6e('0x4f')]();}return this[_0x3b6e('0x9c')](_0x1e99c3);};AGIVertices['prototype'][_0x3b6e('0xa0')]=function(_0x25c675,_0x1f2dd8){var _0x570a74=this[_0x3b6e('0x36')][_0x3b6e('0x11')](_0x25c675);if(_0x570a74['result']===-0x1){return _0x570a74;}logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1f2dd8,_0x570a74['extra']));return this[_0x3b6e('0x36')]['setVariable'](_0x1f2dd8,_0x570a74[_0x3b6e('0x9f')]);};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xa1')]=function(_0x5bb57f){return _0x5bb57f&&_0x5bb57f!=='0'&&_0x5bb57f!=='-1'&&_0x5bb57f!=='';};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xa2')]=function(_0x55e07a){this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x55e07a,'-');_0x55e07a[_0x3b6e('0xa3')]=_0x55e07a['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xa4')]=function(_0x42d715){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0xa5'),_0x42d715[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x42d715[_0x3b6e('0x5c')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xa7'));}var _0x2b14a0='\x22'+_0x42d715[_0x3b6e('0x5c')]+'\x22';if(this['isConfigured'](_0x42d715[_0x3b6e('0x77')])){_0x2b14a0+=','+_0x42d715['options'];}var _0xfe429d=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0x3b6e('0xa9'),_0x2b14a0);if(_0xfe429d[_0x3b6e('0xaa')]===-0x1){return _0xfe429d;}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xab'),_0x2b14a0));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xac')]=function(_0x183d67){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0xad'),_0x183d67['label']));if(!this[_0x3b6e('0xa1')](_0x183d67[_0x3b6e('0xae')])){return this[_0x3b6e('0x36')]['noop'](_0x3b6e('0xaf'));}var _0x295153=_0x183d67[_0x3b6e('0xae')];if(this[_0x3b6e('0xa1')](_0x183d67[_0x3b6e('0x77')])){_0x295153+=','+_0x183d67[_0x3b6e('0x77')];}var _0xb12642=this['channel']['exec']('MRCPRecog',_0x295153);if(_0xb12642[_0x3b6e('0xaa')]===-0x1){return _0xb12642;}var _0xc65a46=this[_0x3b6e('0xa0')](_0x3b6e('0xb0'),_0x3b6e('0xb1'));if(_0xc65a46[_0x3b6e('0xaa')]===-0x1){return _0xc65a46;}var _0x3bced5=this[_0x3b6e('0xa0')](_0x3b6e('0xb2'),_0x3b6e('0xb3'));if(_0x3bced5[_0x3b6e('0xaa')]===-0x1){return _0x3bced5;}var _0x42d9c5=this[_0x3b6e('0xa0')]('RECOG_INSTANCE()',_0x3b6e('0xb4'));if(_0x42d9c5[_0x3b6e('0xaa')]===-0x1){return _0x42d9c5;}return this['channel']['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0xb5'),_0x295153));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x8')]=function(_0x5834f7){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x5834f7[_0x3b6e('0x38')]));return this[_0x3b6e('0x36')][_0x3b6e('0x8')]([_0x5834f7[_0x3b6e('0xb6')],_0x5834f7[_0x3b6e('0xb7')]]);};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xb8')]=function(_0x31532c){logger[_0x3b6e('0x2e')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x31532c[_0x3b6e('0x38')]));if(this[_0x3b6e('0xa1')](_0x31532c[_0x3b6e('0x65')])){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x31532c['timeout']));var _0x4a66c1=this[_0x3b6e('0x36')][_0x3b6e('0xb9')](_0x31532c[_0x3b6e('0x65')]);if(_0x4a66c1[_0x3b6e('0xaa')]===-0x1){return _0x4a66c1;}}return this[_0x3b6e('0x36')][_0x3b6e('0xb8')]();};AGIVertices['prototype']['callback']=function(_0x3b3e61){logger[_0x3b6e('0x2e')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3b3e61[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x3b3e61['list_id'])){return this[_0x3b6e('0x36')]['error'](_0x3b3e61,_0x3b6e('0xba'));}_0x3b3e61[_0x3b6e('0x4e')]=moment();if(this[_0x3b6e('0xa1')](_0x3b3e61[_0x3b6e('0xbb')])){_0x3b3e61[_0x3b6e('0x4e')]=moment()[_0x3b6e('0xbc')](_0x3b3e61['delay'],'minutes');}if(!this['isConfigured'](_0x3b3e61[_0x3b6e('0xbd')])){_0x3b3e61[_0x3b6e('0xbd')]=0x2;}this[_0x3b6e('0x44')]['sync'](this,_0x3b3e61);return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x3b3e61[_0x3b6e('0x4a')],_0x3b3e61[_0x3b6e('0x4b')],_0x3b3e61[_0x3b6e('0x4e')]));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xbe')]=function(_0xc2d56c){logger[_0x3b6e('0x2e')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0xc2d56c[_0x3b6e('0x38')]));var _0x275cf9=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0xc2d56c[_0x3b6e('0xbf')],_0xc2d56c[_0x3b6e('0x77')]);if(_0x275cf9[_0x3b6e('0xaa')]===-0x1){return _0x275cf9;}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xc0'),_0xc2d56c[_0x3b6e('0xbf')],_0xc2d56c[_0x3b6e('0x77')]));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xc1')]=function(_0x1d0207){logger['info'](util[_0x3b6e('0x2a')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1d0207['label']));if(!this[_0x3b6e('0xa1')](_0x1d0207[_0x3b6e('0x5c')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')]('no\x20text\x20configured');}var _0x432930='\x22'+_0x1d0207[_0x3b6e('0x5c')]+'\x22';if(this[_0x3b6e('0xa1')](_0x1d0207[_0x3b6e('0x77')])){_0x432930+=','+_0x1d0207[_0x3b6e('0x77')];}var _0x1dc2ec=this[_0x3b6e('0x36')]['exec'](_0x3b6e('0xa9'),_0x432930);if(_0x1dc2ec[_0x3b6e('0xaa')]===-0x1){return _0x1dc2ec;}return this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xab'),_0x432930));};AGIVertices[_0x3b6e('0x10')]['sestektts']=function(_0x34539e){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0xc2'),_0x34539e[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x34539e[_0x3b6e('0x5c')])){return this[_0x3b6e('0x36')]['noop'](_0x3b6e('0xa7'));}var _0x1f3379='\x22'+_0x34539e[_0x3b6e('0x5c')]+'\x22';if(this[_0x3b6e('0xa1')](_0x34539e[_0x3b6e('0x77')])){_0x1f3379+=','+_0x34539e[_0x3b6e('0x77')];}var _0x58928b=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0x3b6e('0xa9'),_0x1f3379);if(_0x58928b[_0x3b6e('0xaa')]===-0x1){return _0x58928b;}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xab'),_0x1f3379));};AGIVertices['prototype'][_0x3b6e('0xc3')]=function(_0xa3a972){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0xa3a972['label']));if(!this[_0x3b6e('0xa1')](_0xa3a972[_0x3b6e('0xae')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xaf'));}var _0x55a704=_0xa3a972[_0x3b6e('0xae')];if(this[_0x3b6e('0xa1')](_0xa3a972[_0x3b6e('0x77')])){_0x55a704+=','+_0xa3a972[_0x3b6e('0x77')];}var _0x161c73=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0x3b6e('0xc4'),_0x55a704);if(_0x161c73[_0x3b6e('0xaa')]===-0x1){return _0x161c73;}var _0x2c2ff6=this[_0x3b6e('0xa0')](_0x3b6e('0xb0'),'LUMENVOX_ASR_CONFIDENCE');if(_0x2c2ff6['result']===-0x1){return _0x2c2ff6;}var _0x2b7b0f=this[_0x3b6e('0xa0')](_0x3b6e('0xb2'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x2b7b0f['result']===-0x1){return _0x2b7b0f;}var _0x2e1430=this[_0x3b6e('0xa0')](_0x3b6e('0xc5'),_0x3b6e('0xc6'));if(_0x2e1430[_0x3b6e('0xaa')]===-0x1){return _0x2e1430;}return this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xb5'),_0x55a704));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xc7')]=function(_0x415a06){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0xc8'),_0x415a06[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x415a06['grammar'])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xaf'));}var _0x23e98d=_0x415a06[_0x3b6e('0xae')];if(this['isConfigured'](_0x415a06[_0x3b6e('0x77')])){_0x23e98d+=','+_0x415a06[_0x3b6e('0x77')];}var _0x4b781f=this['channel'][_0x3b6e('0xa8')]('MRCPRecog',_0x23e98d);if(_0x4b781f[_0x3b6e('0xaa')]===-0x1){return _0x4b781f;}var _0xb3c7db=this[_0x3b6e('0xa0')]('RECOG_CONFIDENCE()',_0x3b6e('0xc9'));if(_0xb3c7db['result']===-0x1){return _0xb3c7db;}var _0x7343e2=this[_0x3b6e('0xa0')]('RECOG_INPUT()',_0x3b6e('0xca'));if(_0x7343e2[_0x3b6e('0xaa')]===-0x1){return _0x7343e2;}var _0x330bda=this[_0x3b6e('0xa0')](_0x3b6e('0xc5'),_0x3b6e('0xcb'));if(_0x330bda['result']===-0x1){return _0x330bda;}return this['channel']['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0xb5'),_0x23e98d));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xcc')]=function(_0x428abc){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0xcd'),_0x428abc['label']));if(!this[_0x3b6e('0xa1')](_0x428abc[_0x3b6e('0xce')])){return this['channel'][_0x3b6e('0x2c')](_0x428abc,_0x3b6e('0xcf'));}var _0x192d09=this[_0x3b6e('0xd0')][_0x3b6e('0x6f')](this,_0x428abc['odbc_id']);if(!_0x192d09){return this[_0x3b6e('0x36')]['error'](_0x428abc,'no\x20odbc\x20database\x20found');}if(!this[_0x3b6e('0xa1')](_0x428abc[_0x3b6e('0x2f')])){return this['channel']['error'](_0x428abc,_0x3b6e('0xd1'));}var _0x25c43d=_0x428abc[_0x3b6e('0x2f')][_0x3b6e('0xd2')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xd3'),_0x25c43d));var _0x3ed112=this[_0x3b6e('0xd4')][_0x3b6e('0x6f')](this,_0x192d09,_0x25c43d);this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x428abc,_0x25c43d);if(!this[_0x3b6e('0xa1')](_0x428abc[_0x3b6e('0xd5')])){return this[_0x3b6e('0x36')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x690263=this['getVariable'][_0x3b6e('0x6f')](this,_0x428abc['variable_id']);if(!_0x690263){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x428abc,'no\x20variable\x20found');}var _0x57c7d4=this;_0x3ed112[_0x3b6e('0xd6')](function(_0x333752,_0x47f441){Object[_0x3b6e('0xd7')](_0x333752)[_0x3b6e('0xd6')](function(_0x12d29d){_0x57c7d4[_0x3b6e('0x36')][_0x3b6e('0x9b')](util['format']('%s[%s][%s]',_0x690263,_0x47f441,_0x12d29d),_0x333752[_0x12d29d]);});});this[_0x3b6e('0x36')]['setVariable'](util[_0x3b6e('0x2a')]('%s_ROWS_COUNT',_0x690263),_0x3ed112[_0x3b6e('0x97')]);return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xd8'),_0x690263));};AGIVertices['prototype']['dial']=function(_0x537718){logger[_0x3b6e('0xd9')](util[_0x3b6e('0x2a')](_0x3b6e('0xda'),_0x537718[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x537718[_0x3b6e('0xdb')])){return this[_0x3b6e('0x36')]['error'](_0x537718,_0x3b6e('0xdc'));}var _0x74cb81=this[_0x3b6e('0x1b')][_0x3b6e('0x6f')](this,_0x537718[_0x3b6e('0xdb')]);if(!_0x74cb81){return this['channel']['error'](_0x537718,_0x3b6e('0xdd'));}var _0x406abc=this['channel'][_0x3b6e('0xa8')](_0x3b6e('0xde'),[util[_0x3b6e('0x2a')](_0x3b6e('0xdf'),_0x74cb81),_0x537718[_0x3b6e('0x65')],_0x537718[_0x3b6e('0xe0')],_0x537718['url']]);if(_0x406abc[_0x3b6e('0xaa')]===-0x1){return _0x406abc;}return this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xe1'),_0x3b6e('0xde')));};AGIVertices[_0x3b6e('0x10')]['dialogflow']=function(_0x287382){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0xe2'),_0x287382[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x287382[_0x3b6e('0x78')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')]('no\x20key\x20configured');}if(!this[_0x3b6e('0xa1')](_0x287382[_0x3b6e('0x5c')])){return this[_0x3b6e('0x36')]['noop']('no\x20text\x20configured');}this[_0x3b6e('0x36')][_0x3b6e('0xe3')]=!![];this[_0x3b6e('0x35')](_0x287382);this[_0x3b6e('0x43')](_0x287382['text'],'in','','');this['channel'][_0x3b6e('0xa6')](util['format'](_0x3b6e('0xe4'),_0x287382[_0x3b6e('0x5c')]));var _0xba0bad=this['googleDialogflow'][_0x3b6e('0x6f')](this,_0x287382);if(_0xba0bad){for(var _0x1c0f54 in _0xba0bad){if(_0xba0bad[_0x3b6e('0x92')](_0x1c0f54)){this[_0x3b6e('0x36')][_0x3b6e('0x9b')](util['format'](_0x3b6e('0xe5'),_0x1c0f54['toUpperCase']()),_0xba0bad[_0x1c0f54]);}}this['createSquareMessage'](_0xba0bad[_0x3b6e('0xe6')],_0x3b6e('0xe7'),_0x3b6e('0xe8'),'');return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('Dialogflow\x20Result\x20%s',_0xba0bad['speech']));}return this[_0x3b6e('0x36')]['error'](_0x287382,_0x3b6e('0xe9'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xea')]=function(_0x22e942){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0xeb'),_0x22e942[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x22e942[_0x3b6e('0x7b')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xec'));}if(!this['isConfigured'](_0x22e942[_0x3b6e('0x7c')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xed'));}if(!this[_0x3b6e('0xa1')](_0x22e942[_0x3b6e('0x7d')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xee'));}if(!this[_0x3b6e('0xa1')](_0x22e942[_0x3b6e('0x7e')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xef'));}if(!this[_0x3b6e('0xa1')](_0x22e942[_0x3b6e('0x5c')])){return this[_0x3b6e('0x36')]['noop'](_0x3b6e('0xa7'));}this['channel'][_0x3b6e('0xe3')]=!![];this[_0x3b6e('0x35')](_0x22e942);this[_0x3b6e('0x43')](_0x22e942[_0x3b6e('0x5c')],'in','','');this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('Trying\x20DialogflowV2:\x20%s',_0x22e942[_0x3b6e('0x5c')]));var _0x2ab7df=this[_0x3b6e('0x7a')][_0x3b6e('0x6f')](this,_0x22e942);if(_0x2ab7df){for(var _0x35e0b2 in _0x2ab7df){if(_0x2ab7df[_0x3b6e('0x92')](_0x35e0b2)){if(_0x35e0b2!==_0x3b6e('0xf0')){this[_0x3b6e('0x36')][_0x3b6e('0x9b')](util[_0x3b6e('0x2a')](_0x3b6e('0xe5'),_0x35e0b2[_0x3b6e('0x69')]()),_0x2ab7df[_0x35e0b2]);}}}this[_0x3b6e('0x43')](_0x2ab7df['speech'],_0x3b6e('0xe7'),_0x3b6e('0xea'),_0x2ab7df[_0x3b6e('0xf0')]);return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format'](_0x3b6e('0xf1'),_0x2ab7df[_0x3b6e('0xe6')]));}return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x22e942,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xf2')]=function(_0x29f344){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0xf3'),_0x29f344[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x29f344[_0x3b6e('0xf4')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xf5'));}if(!this[_0x3b6e('0xa1')](_0x29f344['username'])){return this[_0x3b6e('0x36')]['noop'](_0x3b6e('0xf6'));}if(!this['isConfigured'](_0x29f344['password'])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xf7'));}if(!this[_0x3b6e('0xa1')](_0x29f344['ndassistant_url'])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xa7'));}this['channel'][_0x3b6e('0xe3')]=!![];this[_0x3b6e('0x35')](_0x29f344);this[_0x3b6e('0x43')](_0x29f344[_0x3b6e('0x5c')],'in','','');this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xf8'),_0x29f344[_0x3b6e('0x5c')]));var _0x36237a=this['sestekNDA'][_0x3b6e('0x6f')](this,_0x29f344);if(_0x36237a){for(var _0x5d897b in _0x36237a){if(_0x36237a[_0x3b6e('0x92')](_0x5d897b)){this[_0x3b6e('0x36')]['setVariable'](util[_0x3b6e('0x2a')](_0x3b6e('0xf9'),_0x5d897b[_0x3b6e('0x69')]()),_0x36237a[_0x5d897b]);}}this[_0x3b6e('0x43')](_0x36237a[_0x3b6e('0xe6')],_0x3b6e('0xe7'),_0x3b6e('0xf2'),'');if(_0x36237a[_0x3b6e('0xfa')]){this[_0x3b6e('0x36')]['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0xfb'),_0x36237a['audiofile']));var _0x1d311e=this[_0x3b6e('0x36')]['streamFile'](_0x36237a[_0x3b6e('0xfa')]);try{fs[_0x3b6e('0xfc')](_0x36237a[_0x3b6e('0xfa')]+'.wav');}catch(_0x3b88c4){logger['error'](_0x3b88c4);}return _0x1d311e;}else{return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xfd'),_0x36237a['speech']));}}return this[_0x3b6e('0x36')]['error'](_0x29f344,_0x3b6e('0xfe'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xff')]=function(_0x20d338){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x100'),_0x20d338[_0x3b6e('0x38')]));return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xff'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x101')]=function(_0x55ea86){logger[_0x3b6e('0x2e')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x55ea86[_0x3b6e('0x38')]));var _0x32b7bd='';if(_0x55ea86[_0x3b6e('0x102')]){if(!this['isConfigured'](_0x55ea86[_0x3b6e('0x102')])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x55ea86,_0x3b6e('0x103'));}else{var _0x2c99fb=parseInt(_0x55ea86['trunk_id'],0xa);if(isNaN(_0x2c99fb)){_0x32b7bd=_0x55ea86[_0x3b6e('0x102')];}else{_0x32b7bd=this['getTrunk'][_0x3b6e('0x6f')](this,_0x55ea86[_0x3b6e('0x102')]);if(!_0x32b7bd){return this['channel']['error'](_0x55ea86,'no\x20trunk\x20found');}}}}else if(_0x55ea86[_0x3b6e('0x104')]){_0x32b7bd=_0x55ea86[_0x3b6e('0x104')];}else{return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x55ea86,_0x3b6e('0x103'));}var _0x1e4225=this[_0x3b6e('0x36')]['exec'](_0x3b6e('0xde'),[util[_0x3b6e('0x2a')](_0x3b6e('0x105'),_0x32b7bd,_0x55ea86[_0x3b6e('0x4a')]),_0x55ea86['timeout'],_0x55ea86[_0x3b6e('0xe0')],_0x55ea86[_0x3b6e('0x71')]]);if(_0x1e4225[_0x3b6e('0xaa')]===-0x1){return _0x1e4225;}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xe1'),'DIAL'));};AGIVertices[_0x3b6e('0x10')]['finally']=function(_0x45f391){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x45f391[_0x3b6e('0x38')]));return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x106'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xd')]=function(_0x24a12f){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x107'),_0x24a12f[_0x3b6e('0x38')]));if(_0x24a12f[_0x3b6e('0xa3')]===0x0){return this[_0x3b6e('0xa2')](_0x24a12f);}_0x24a12f[_0x3b6e('0xa3')]-=0x1;if(!this[_0x3b6e('0xa1')](_0x24a12f[_0x3b6e('0x108')])){return this['channel'][_0x3b6e('0x2c')](_0x24a12f,'no\x20file\x20audio\x20selected');}var _0x5760a4=this[_0x3b6e('0x1f')][_0x3b6e('0x6f')](this,_0x24a12f[_0x3b6e('0x108')]);if(!_0x5760a4){return this['channel'][_0x3b6e('0x2c')](_0x24a12f,_0x3b6e('0x109'));}if(!this['isConfigured'](_0x24a12f[_0x3b6e('0xd5')])){return this['channel'][_0x3b6e('0x2c')](_0x3b6e('0x10a'));}var _0x1e26b0=this[_0x3b6e('0x36')][_0x3b6e('0x10b')](_0x5760a4,_0x24a12f[_0x3b6e('0x10c')],_0x24a12f[_0x3b6e('0x10d')]);var _0x48c8be=_0x1e26b0[_0x3b6e('0xaa')]?_0x1e26b0[_0x3b6e('0xaa')]['toString']():'';logger[_0x3b6e('0x2e')](_0x3b6e('0x10e'),JSON[_0x3b6e('0x73')](_0x1e26b0));if(_0x1e26b0[_0x3b6e('0xaa')]===-0x1){this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x24a12f,_0x48c8be);return _0x1e26b0;}else if(_0x1e26b0['extra']===_0x3b6e('0x65')){_0x1e26b0[_0x3b6e('0xaa')]=_0x48c8be[_0x3b6e('0x97')]>=parseInt(_0x24a12f[_0x3b6e('0x10f')])?'x':'i';}else{_0x1e26b0[_0x3b6e('0xaa')]=_0x48c8be[_0x3b6e('0x97')]>=parseInt(_0x24a12f[_0x3b6e('0x10f')])&&_0x48c8be[_0x3b6e('0x97')]<=parseInt(_0x24a12f[_0x3b6e('0x10d')])?'x':'i';}var _0x1521ad=this[_0x3b6e('0x11')][_0x3b6e('0x6f')](this,_0x24a12f['variable_id']);if(!_0x1521ad){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x24a12f,_0x3b6e('0x110'));}this[_0x3b6e('0x36')][_0x3b6e('0x9b')](_0x1521ad,_0x48c8be);if(this[_0x3b6e('0xa1')](_0x24a12f[_0x3b6e('0x111')])){var _0x4daa91=parseInt(_0x24a12f[_0x3b6e('0x111')],0xa);var _0x2bfba9=rs[_0x3b6e('0x112')]({'charset':'*','length':_0x4daa91});var _0x11c293=_0x48c8be[_0x3b6e('0x97')];if(_0x11c293>0x0){if(_0x11c293>_0x4daa91){this['createSquareDetailsReport'][_0x3b6e('0x6f')](this,_0x24a12f,_0x24a12f[_0x3b6e('0x113')]===_0x3b6e('0x114')?_0x2bfba9+_0x48c8be[_0x3b6e('0x115')](_0x4daa91):_0x48c8be[_0x3b6e('0x115')](0x0,_0x11c293-_0x4daa91)+_0x2bfba9);}else{this[_0x3b6e('0x35')]['sync'](this,_0x24a12f,rs['generate']({'charset':'*','length':_0x11c293}));}}else{this['createSquareDetailsReport'][_0x3b6e('0x6f')](this,_0x24a12f,'');}}else{this[_0x3b6e('0x35')]['sync'](this,_0x24a12f,_0x48c8be);}return _0x1e26b0;};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xe')]=function(_0x5e876b){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x116'),_0x5e876b['label']));return this[_0x3b6e('0xd')](_0x5e876b);};AGIVertices['prototype'][_0x3b6e('0x117')]=function(_0x361384){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x118'),_0x361384[_0x3b6e('0x38')]));this[_0x3b6e('0x35')]['sync'](this,_0x361384,_0x361384[_0x3b6e('0x119')]);return this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x11a'),_0x361384[_0x3b6e('0x119')]));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x11b')]=function(_0x4ecd86){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x11c'),_0x4ecd86[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x4ecd86['aws_access_key_id'])||!this[_0x3b6e('0xa1')](_0x4ecd86[_0x3b6e('0x86')])){return this[_0x3b6e('0x36')]['noop'](_0x3b6e('0x11d'));}if(!this[_0x3b6e('0xa1')](_0x4ecd86[_0x3b6e('0x5c')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xa7'));}this['channel']['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x11e'),_0x4ecd86['text']));var _0x4a0ac9=this['awsPolly']['sync'](this,_0x4ecd86);if(_0x4a0ac9){this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x11f'),_0x4a0ac9));var _0x185a19=this[_0x3b6e('0x36')][_0x3b6e('0x120')](_0x4a0ac9);try{fs[_0x3b6e('0xfc')](_0x4a0ac9+_0x3b6e('0x121'));}catch(_0x35d915){logger[_0x3b6e('0x2c')](_0x35d915);}return _0x185a19;}return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x4ecd86,_0x3b6e('0x122'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x123')]=function(_0x583f91){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x583f91[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x583f91[_0x3b6e('0x85')])||!this[_0x3b6e('0xa1')](_0x583f91[_0x3b6e('0x86')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x11d'));}if(!this['isConfigured'](_0x583f91[_0x3b6e('0x8b')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x124'));}if(!this[_0x3b6e('0xa1')](_0x583f91['text'])){return this['channel']['noop'](_0x3b6e('0xa7'));}this[_0x3b6e('0x36')][_0x3b6e('0xe3')]=!![];this['createSquareDetailsReport'](_0x583f91);this[_0x3b6e('0x43')](_0x583f91[_0x3b6e('0x5c')],'in','','');this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('Trying\x20Amazon\x20Lex:\x20%s',_0x583f91[_0x3b6e('0x5c')]));var _0x3571af=this[_0x3b6e('0x89')][_0x3b6e('0x6f')](this,_0x583f91);if(_0x3571af){for(var _0x2b925a in _0x3571af){if(_0x3571af[_0x3b6e('0x92')](_0x2b925a)&&_[_0x3b6e('0x98')](_0x3571af[_0x2b925a])){this['channel'][_0x3b6e('0x9b')](util[_0x3b6e('0x2a')](_0x3b6e('0x125'),_0x2b925a[_0x3b6e('0x69')]()),_0x3571af[_0x2b925a]);}}if(_[_0x3b6e('0x45')](_0x3571af[_0x3b6e('0x75')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x126'));}else{this[_0x3b6e('0x43')](_0x3571af['message'],'out',_0x3b6e('0x127'),'');return this['channel'][_0x3b6e('0xa6')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x3571af[_0x3b6e('0x75')]));}}return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x583f91,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x128')]=function(_0x3a40a1){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x3a40a1['label'],_0x3a40a1['timeout']));if(!this[_0x3b6e('0xa1')](_0x3a40a1[_0x3b6e('0x78')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x129'));}var _0x302c66=_0x3b6e('0x12a');var _0x2c629f=util[_0x3b6e('0x2a')](_0x3b6e('0x12b'),FILES_PATH,rs[_0x3b6e('0x112')](0x4));var _0x3a7489=util[_0x3b6e('0x2a')]('%s.%s',_0x2c629f,_0x302c66);var _0x27afed=!![];if(_0x3a40a1['beep']===_0x3b6e('0x12c')){_0x27afed=![];}var _0x3d2bcd=this['channel'][_0x3b6e('0x12d')](_0x2c629f,_0x302c66,_0x3a40a1[_0x3b6e('0x12e')],_0x3a40a1[_0x3b6e('0x65')],undefined,_0x27afed);if(_0x3d2bcd[_0x3b6e('0xaa')]!==-0x1){this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x12f'),_0x3a7489));var _0x2001a6=this['googleASR']['sync'](this,_0x3a40a1,_0x3a7489);if(_0x2001a6){for(var _0x2a2cb9 in _0x2001a6){if(_0x2001a6[_0x3b6e('0x92')](_0x2a2cb9)){this[_0x3b6e('0x36')]['setVariable'](util[_0x3b6e('0x2a')](_0x3b6e('0x130'),_0x2a2cb9[_0x3b6e('0x69')]()),_0x2001a6[_0x2a2cb9]);}}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x131'),JSON[_0x3b6e('0x73')](_0x2001a6)));}}return _0x3d2bcd;};AGIVertices['prototype'][_0x3b6e('0x132')]=function(_0x2c314e){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x133'),_0x2c314e[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x2c314e['appid'])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x134'));}if(!this['isConfigured'](_0x2c314e[_0x3b6e('0x8f')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')]('no\x20appsecret\x20configured');}var _0x1f0717='wav';var _0xd4c767=util['format'](_0x3b6e('0x12b'),FILES_PATH,rs[_0x3b6e('0x112')](0x4));var _0x1f50c8=util[_0x3b6e('0x2a')](_0x3b6e('0x9a'),_0xd4c767,_0x1f0717);var _0x24a059=!![];if(_0x2c314e[_0x3b6e('0x135')]===_0x3b6e('0x12c')){_0x24a059=![];}var _0x3063c6=this[_0x3b6e('0x36')]['recordFile'](_0xd4c767,_0x1f0717,_0x2c314e[_0x3b6e('0x12e')],_0x2c314e[_0x3b6e('0x65')],undefined,_0x24a059);if(_0x3063c6[_0x3b6e('0xaa')]!==-0x1){this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x136'),_0x1f50c8));var _0x12ea8f=this[_0x3b6e('0x137')]['sync'](this,_0x2c314e,_0x1f50c8);if(_0x12ea8f){for(var _0x11339e in _0x12ea8f){if(_0x12ea8f[_0x3b6e('0x92')](_0x11339e)){this[_0x3b6e('0x36')][_0x3b6e('0x9b')](util[_0x3b6e('0x2a')](_0x3b6e('0x138'),_0x11339e['toUpperCase']()),_0x12ea8f[_0x11339e]);}}return this['channel']['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x139'),JSON[_0x3b6e('0x73')](_0x12ea8f)));}}return _0x3063c6;};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x13a')]=function(_0x68173f){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x13b'),_0x68173f[_0x3b6e('0x38')]));return this[_0x3b6e('0x36')][_0x3b6e('0x13c')](_0x68173f[_0x3b6e('0x3e')],_0x68173f[_0x3b6e('0x3f')],_0x68173f[_0x3b6e('0x13d')]);};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x13e')]=function(_0x4cfa63){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4cfa63[_0x3b6e('0x38')]));if(!this['isConfigured'](_0x4cfa63[_0x3b6e('0x13f')])){return this['channel']['error'](_0x4cfa63,'no\x20condition\x20configured');}try{var _0xe87050=eval(_0x4cfa63[_0x3b6e('0x13f')])?_0x3b6e('0x140'):_0x3b6e('0x141');this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x142'),_0x4cfa63[_0x3b6e('0x13f')],_0xe87050));return{'code':0xc8,'result':_0xe87050};}catch(_0x295b1b){return{'code':0xc8,'result':_0x3b6e('0x141')};}};AGIVertices['prototype'][_0x3b6e('0x143')]=function(_0x27af00){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x144'),_0x27af00['label']));if(!this[_0x3b6e('0xa1')](_0x27af00[_0x3b6e('0x145')])){return this['channel'][_0x3b6e('0x2c')](_0x27af00,'no\x20interval\x20configured');}var _0x588296=this[_0x3b6e('0x146')][_0x3b6e('0x6f')](this,_0x27af00[_0x3b6e('0x145')]);if(!_0x588296){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x27af00,_0x3b6e('0x147'));}for(var _0x406b54=0x0;_0x406b54<_0x588296['length'];_0x406b54+=0x1){var _0x13da1f=this[_0x3b6e('0x36')]['getVariable'](util[_0x3b6e('0x2a')](_0x3b6e('0x148'),_0x588296[_0x406b54]));if(_0x13da1f[_0x3b6e('0xaa')]===-0x1){return _0x13da1f;}logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x149'),_0x588296[_0x406b54],_0x13da1f[_0x3b6e('0x9f')]));if(_0x13da1f[_0x3b6e('0x9f')]==='true'){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x149'),_0x588296[_0x406b54],_0x3b6e('0x140')));this[_0x3b6e('0x36')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x588296[_0x406b54],_0x3b6e('0x140')));return{'code':0xc8,'result':_0x3b6e('0x140')};}else{logger['info'](util[_0x3b6e('0x2a')]('IFTIME\x20%s\x20%s',_0x588296[_0x406b54],_0x3b6e('0x141')));this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format'](_0x3b6e('0x149'),_0x588296[_0x406b54],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x3b6e('0x10')]['hangup']=function(_0x510eb4){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x14a'),_0x510eb4[_0x3b6e('0x38')]));return this['channel'][_0x3b6e('0x14b')]();};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x14c')]=function(_0x3b96be){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x14d'),_0x3b96be[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x3b96be[_0x3b6e('0x78')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x129'));}var _0x4b3e23=_0x3b6e('0x12a');var _0x748137=util['format'](_0x3b6e('0x12b'),FILES_PATH,rs[_0x3b6e('0x112')](0x4));var _0x346f92=util[_0x3b6e('0x2a')](_0x3b6e('0x9a'),_0x748137,_0x4b3e23);var _0x3c6c94=!![];if(_0x3b96be[_0x3b6e('0x135')]===_0x3b6e('0x12c')){_0x3c6c94=![];}var _0x118bab=this[_0x3b6e('0x36')][_0x3b6e('0x12d')](_0x748137,_0x4b3e23,_0x3b96be[_0x3b6e('0x12e')],_0x3b96be['timeout'],undefined,_0x3c6c94);if(_0x118bab[_0x3b6e('0xaa')]!==-0x1){this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x14e'),_0x346f92));var _0x16b400=this[_0x3b6e('0x82')][_0x3b6e('0x6f')](this,_0x3b96be,_0x346f92);if(_0x16b400){for(var _0x32a811 in _0x16b400){if(_0x16b400['hasOwnProperty'](_0x32a811)){this[_0x3b6e('0x36')]['setVariable'](util[_0x3b6e('0x2a')](_0x3b6e('0x14f'),_0x32a811['toUpperCase']()),_0x16b400[_0x32a811]);}}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x150'),JSON['stringify'](_0x16b400)));}}return _0x118bab;};AGIVertices[_0x3b6e('0x10')]['ispeechtts']=function(_0x357a){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x151'),_0x357a[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x357a[_0x3b6e('0x78')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x129'));}if(!this[_0x3b6e('0xa1')](_0x357a[_0x3b6e('0x5c')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xa7'));}this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x152'),_0x357a[_0x3b6e('0x5c')]));var _0x52594d=this[_0x3b6e('0x80')][_0x3b6e('0x6f')](this,_0x357a);if(_0x52594d){this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format']('ispeech\x20%s\x20file\x20created',_0x52594d));var _0x42fdbb=this[_0x3b6e('0x36')][_0x3b6e('0x120')](_0x52594d,_0x357a[_0x3b6e('0x12e')]);try{fs['unlink'](_0x52594d+_0x3b6e('0x121'));}catch(_0x53c59c){logger[_0x3b6e('0x2c')](_0x53c59c);}return _0x42fdbb;}return this['channel'][_0x3b6e('0x2c')](_0x357a,_0x3b6e('0x153'));};AGIVertices['prototype']['login']=function(_0x4dd79c){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x154'),_0x4dd79c['label']));if(!this[_0x3b6e('0xa1')](_0x4dd79c[_0x3b6e('0x155')])){return this['channel'][_0x3b6e('0x2c')](_0x4dd79c,_0x3b6e('0x156'));}logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x157'),this['channel'][_0x3b6e('0x3c')],_0x4dd79c[_0x3b6e('0x155')]));var _0x5d22a8=this[_0x3b6e('0x55')][_0x3b6e('0x6f')](this,_0x4dd79c['findBy']);if(_0x5d22a8){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x3b6e('0x3c')],_0x4dd79c[_0x3b6e('0x155')]));this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x158'),this['channel']['callerid'],_0x4dd79c[_0x3b6e('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x3b6e('0x159'),this['channel'][_0x3b6e('0x3c')],_0x4dd79c['findBy']));this['channel']['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x159'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x4dd79c[_0x3b6e('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x15a')]=function(_0x43777e){logger['info'](util['format'](_0x3b6e('0x15b'),_0x43777e['label']));if(!this[_0x3b6e('0xa1')](_0x43777e['findBy'])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x43777e,_0x3b6e('0x156'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x43777e[_0x3b6e('0x155')]));var _0x57bfc4=this['agentLogout']['sync'](this,_0x43777e[_0x3b6e('0x155')]);if(_0x57bfc4){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x158'),this['channel'][_0x3b6e('0x3c')],_0x43777e[_0x3b6e('0x155')]));this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format'](_0x3b6e('0x158'),this[_0x3b6e('0x36')]['callerid'],_0x43777e['findBy']));return{'code':0xc8,'result':_0x3b6e('0x15c')};}else{logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x159'),this['channel'][_0x3b6e('0x3c')],_0x43777e[_0x3b6e('0x155')]));this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3b6e('0x36')]['callerid'],_0x43777e[_0x3b6e('0x155')]));return{'code':0xc8,'result':_0x3b6e('0x15d')};}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x15e')]=function(_0x1d78ff){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x15f'),_0x1d78ff['label']));if(!this[_0x3b6e('0xa1')](_0x1d78ff[_0x3b6e('0x160')])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x1d78ff,_0x3b6e('0x161'));}this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x162'),_0x1d78ff[_0x3b6e('0x160')]));var _0x4d05ef=eval(_0x1d78ff[_0x3b6e('0x160')]);if(!this[_0x3b6e('0xa1')](_0x1d78ff[_0x3b6e('0xd5')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x513e82=this[_0x3b6e('0x11')][_0x3b6e('0x6f')](this,_0x1d78ff[_0x3b6e('0xd5')]);if(!_0x513e82){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x1d78ff,'no\x20variable\x20found');}if(_[_0x3b6e('0x96')](_0x4d05ef)){var _0xfd25a8=this;_0x4d05ef['forEach'](function(_0x33e846,_0x1dd209){_0xfd25a8['channel'][_0x3b6e('0x9b')](util[_0x3b6e('0x2a')](_0x3b6e('0x163'),_0x513e82,_0x1dd209),_0x33e846);});return this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x164'),_0x513e82));}else{return this['channel'][_0x3b6e('0x9b')](_0x513e82,_0x4d05ef);}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xc')]=function(_0x140250){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x140250['label']));if(_0x140250['retry']===0x0){return this['maxRetry'](_0x140250);}_0x140250[_0x3b6e('0xa3')]-=0x1;if(!this[_0x3b6e('0xa1')](_0x140250[_0x3b6e('0x108')])){return this['channel'][_0x3b6e('0x2c')](_0x140250,_0x3b6e('0x165'));}var _0x4a7887=this[_0x3b6e('0x1f')][_0x3b6e('0x6f')](this,_0x140250[_0x3b6e('0x108')]);if(!_0x4a7887){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x140250,_0x3b6e('0x109'));}var _0x47a9ef=this['channel']['getData'](_0x4a7887,_0x140250[_0x3b6e('0x10c')],_0x140250['digit']);var _0x1bdeae=_0x47a9ef[_0x3b6e('0xaa')];if(_0x47a9ef[_0x3b6e('0xaa')]===-0x1){this['createSquareDetailsReport'][_0x3b6e('0x6f')](this,_0x140250,'-1');return _0x47a9ef;}else if(_0x47a9ef[_0x3b6e('0x9f')]===_0x3b6e('0x65')){_0x47a9ef['result']=_0x47a9ef[_0x3b6e('0xaa')][_0x3b6e('0x97')]>0x0?_0x47a9ef[_0x3b6e('0xaa')]:'t';}else if(_[_0x3b6e('0x48')](_0x47a9ef[_0x3b6e('0xaa')])){_0x47a9ef['result']='#';_0x1bdeae='#';}if(!this[_0x3b6e('0xa1')](_0x140250['variable_id'])){this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x10a'));}else{var _0x3b9d22=this[_0x3b6e('0x11')]['sync'](this,_0x140250[_0x3b6e('0xd5')]);if(!_0x3b9d22){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x140250,_0x3b6e('0x110'));}this['channel'][_0x3b6e('0x9b')](_0x3b9d22,_0x1bdeae);}this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x140250,_0x1bdeae);return _0x47a9ef;};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xa6')]=function(_0x235653){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x166'),_0x235653['label']));return this[_0x3b6e('0x36')]['noop'](_0x235653[_0x3b6e('0x167')]||_0x235653['label']);};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x168')]=function(_0x443db2){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x443db2[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x443db2[_0x3b6e('0x155')])){return this['channel'][_0x3b6e('0x2c')](_0x443db2,_0x3b6e('0x156'));}logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x157'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x443db2['findBy']));var _0x106f2d=this['getPause']['sync'](this,_0x443db2[_0x3b6e('0x169')]);var _0x3c8399=this['agentPause'][_0x3b6e('0x6f')](this,_0x443db2[_0x3b6e('0x155')],_0x106f2d);if(_0x3c8399){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x158'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x443db2[_0x3b6e('0x155')]));this[_0x3b6e('0x36')]['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x158'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x443db2[_0x3b6e('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x159'),this['channel']['callerid'],_0x443db2['findBy']));this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format'](_0x3b6e('0x158'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x443db2[_0x3b6e('0x155')]));return{'code':0xc8,'result':_0x3b6e('0x15d')};}};AGIVertices['prototype'][_0x3b6e('0x16a')]=function(_0x5c4d8a){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x16b'),_0x5c4d8a[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x5c4d8a[_0x3b6e('0x108')])){return this['channel'][_0x3b6e('0x2c')](_0x5c4d8a,_0x3b6e('0x165'));}var _0x4c764c=this[_0x3b6e('0x1f')][_0x3b6e('0x6f')](this,_0x5c4d8a['file_id']);if(!_0x4c764c){return this['channel'][_0x3b6e('0x2c')](_0x5c4d8a,_0x3b6e('0x109'));}var _0x41e71b=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0x3b6e('0x16c'),[_0x4c764c,_0x5c4d8a[_0x3b6e('0xe0')]]);if(_0x41e71b['result']===-0x1){return _0x41e71b;}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format']('Executed\x20command\x20%s\x20%s',_0x3b6e('0x16c'),_0x4c764c));};AGIVertices['prototype'][_0x3b6e('0x16d')]=function(_0x1464ad){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x16e'),_0x1464ad[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x1464ad[_0x3b6e('0x16f')])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x1464ad,_0x3b6e('0x170'));}var _0x5a361b='';var _0x340f21=parseInt(_0x1464ad[_0x3b6e('0x16f')],0xa);if(isNaN(_0x340f21)){_0x5a361b=_0x1464ad['queue_id'];}else{_0x5a361b=this[_0x3b6e('0x16')][_0x3b6e('0x6f')](this,_0x1464ad[_0x3b6e('0x16f')]);if(!_0x5a361b){return this['channel'][_0x3b6e('0x2c')](_0x1464ad,_0x3b6e('0x171'));}}var _0xe3814b='';if(this[_0x3b6e('0xa1')](_0x1464ad[_0x3b6e('0x108')])){var _0x4d3720=this['getSound'][_0x3b6e('0x6f')](this,_0x1464ad[_0x3b6e('0x108')]);if(_0x4d3720){_0xe3814b=_0x4d3720;}}this[_0x3b6e('0x35')]['sync'](this,_0x1464ad,_0x5a361b);if(_0x1464ad[_0x3b6e('0xe0')]['indexOf']('x')<0x0){_0x1464ad[_0x3b6e('0xe0')]+='x';}if(_0x1464ad[_0x3b6e('0xe0')][_0x3b6e('0x172')]('X')<0x0){_0x1464ad[_0x3b6e('0xe0')]+='X';}this['channel'][_0x3b6e('0x9b')](_0x3b6e('0x173'),_0x5a361b?_0x5a361b[_0x3b6e('0x174')]():'');var _0x51a1bd=this[_0x3b6e('0x36')][_0x3b6e('0xa8')]('QUEUE',[_0x5a361b,_0x1464ad[_0x3b6e('0xe0')],_0x1464ad[_0x3b6e('0x71')],_0xe3814b,_0x1464ad[_0x3b6e('0x65')],_0x1464ad[_0x3b6e('0x8')],_0x1464ad['macro'],_0x1464ad[_0x3b6e('0x175')],'',_0x1464ad[_0x3b6e('0x176')]]);if(_0x51a1bd[_0x3b6e('0xaa')]===-0x1){return _0x51a1bd;}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format']('Executed\x20command\x20%s\x20%s','QUEUE',_0x5a361b));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x177')]=function(_0x2739f1){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x178'),_0x2739f1[_0x3b6e('0x38')]));var _0x3c5ff4=_0x2739f1[_0x3b6e('0x179')]||_0x3b6e('0x12a');var _0x51cca5=util[_0x3b6e('0x2a')]('%s_%s',this[_0x3b6e('0x36')][_0x3b6e('0x37')],rs[_0x3b6e('0x112')](0x5));var _0x564a10=util[_0x3b6e('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x51cca5,_0x3c5ff4);var _0x5d3159=util['format'](_0x3b6e('0x12b'),FILES_PATH,_0x51cca5);this[_0x3b6e('0x3b')][_0x3b6e('0x6f')](this,_0x2739f1,_0x51cca5,_0x564a10);this[_0x3b6e('0x36')][_0x3b6e('0x9b')](_0x3b6e('0x17a'),_0x51cca5);logger[_0x3b6e('0x2e')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5d3159,_0x3c5ff4,_0x2739f1[_0x3b6e('0x17b')],_0x2739f1[_0x3b6e('0x65')]);return this[_0x3b6e('0x36')][_0x3b6e('0x12d')](_0x5d3159,_0x3c5ff4,_0x2739f1[_0x3b6e('0x17b')],_0x2739f1['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x3b6e('0x17c')]=function(_0x4384df){logger['info'](util[_0x3b6e('0x2a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x4384df['label']));if(!this[_0x3b6e('0xa1')](_0x4384df[_0x3b6e('0x71')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x17d'));}var _0x2c3439=this['restAPI'][_0x3b6e('0x6f')](this,_0x4384df);logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Response:',util['inspect'](_0x2c3439,{'showHidden':![],'depth':null})));if(!this[_0x3b6e('0xa1')](_0x4384df[_0x3b6e('0xd5')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x17e'));}var _0x9b41a3=this[_0x3b6e('0x11')][_0x3b6e('0x6f')](this,_0x4384df['variable_id']);if(!_0x9b41a3){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x4384df,_0x3b6e('0x110'));}this['channel'][_0x3b6e('0x9b')](util['format'](_0x3b6e('0x17f'),_0x9b41a3),_0x2c3439['statusCode']?_0x2c3439[_0x3b6e('0x74')]:_0x3b6e('0x180'));this[_0x3b6e('0x36')][_0x3b6e('0x9b')](util['format'](_0x3b6e('0x181'),_0x9b41a3),_0x2c3439[_0x3b6e('0x182')]?_0x2c3439[_0x3b6e('0x182')]:'OK');if(_0x2c3439[_0x3b6e('0x6a')]){try{this['saveRestApiResult'](_0x2c3439[_0x3b6e('0x6a')],_0x9b41a3);}catch(_0x158d66){logger['error'](util[_0x3b6e('0x2a')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x9b41a3));}}return this[_0x3b6e('0x36')]['noop'](util[_0x3b6e('0x2a')]('variable\x20%s\x20set',_0x9b41a3));};AGIVertices['prototype'][_0x3b6e('0x183')]=function(_0x416de1){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x184'),_0x416de1[_0x3b6e('0x38')]));return this[_0x3b6e('0x36')]['sayDigits'](_0x416de1[_0x3b6e('0x185')][_0x3b6e('0xd2')](/\s+/g,''),_0x416de1[_0x3b6e('0x17b')]);};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x186')]=function(_0x279de5){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x279de5['label']));return this[_0x3b6e('0x36')][_0x3b6e('0x187')](_0x279de5[_0x3b6e('0x66')][_0x3b6e('0xd2')](/\s+/g,''),_0x279de5[_0x3b6e('0x17b')]);};AGIVertices['prototype'][_0x3b6e('0x188')]=function(_0x3e3295){logger['info'](util['format'](_0x3b6e('0x189'),_0x3e3295['label']));return this[_0x3b6e('0x36')][_0x3b6e('0x18a')](_0x3e3295[_0x3b6e('0x5c')],_0x3e3295[_0x3b6e('0x17b')]);};AGIVertices[_0x3b6e('0x10')]['sendMail']=function(_0x233277){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x18b'),_0x233277[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x233277[_0x3b6e('0x18c')])){return this[_0x3b6e('0x36')]['noop'](_0x3b6e('0x18d'));}var _0x9e424d=this[_0x3b6e('0x22')][_0x3b6e('0x6f')](this,_0x233277['account_id']);if(!_0x9e424d||!_0x9e424d['Smtp']){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x233277,_0x3b6e('0x18e'));}var _0x23d14c={'from':util[_0x3b6e('0x2a')]('\x22%s\x22\x20<%s>',_0x9e424d['name'],_0x9e424d[_0x3b6e('0x18f')]||_0x9e424d['Smtp'][_0x3b6e('0x190')]),'to':_0x233277['to']||'','cc':_0x233277['cc']||'','bcc':_0x233277[_0x3b6e('0x191')]||'','subject':_0x233277[_0x3b6e('0x192')],'html':_0x233277[_0x3b6e('0x5c')],'text':_0x233277[_0x3b6e('0x5c')]};var _0x182c87={'tls':{'rejectUnauthorized':![]}};if(_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x194')]){_0x182c87[_0x3b6e('0x194')]=_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x194')];}else{_0x182c87[_0x3b6e('0x195')]=_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x195')];_0x182c87['port']=_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x196')];_0x182c87[_0x3b6e('0x197')]=_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x197')];}if(_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x198')]){_0x182c87['auth']={'user':_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x190')],'pass':_0x9e424d['Smtp'][_0x3b6e('0x199')]};}if(this[_0x3b6e('0xa1')](_0x233277[_0x3b6e('0x19a')])){}logger[_0x3b6e('0xd9')](_0x3b6e('0x19b'),JSON[_0x3b6e('0x73')](_0x23d14c));this[_0x3b6e('0x35')]['sync'](this,_0x233277,_0x233277[_0x3b6e('0x18c')]);this[_0x3b6e('0x36')]['noop'](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x9e424d[_0x3b6e('0x14')]));this[_0x3b6e('0x24')]['sync'](this,_0x182c87,_0x23d14c);return this[_0x3b6e('0x36')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x19c')]=function(_0x5a664b){logger[_0x3b6e('0x2e')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x5a664b[_0x3b6e('0x38')]));return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x19d'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x19e')]=function(_0x42b376){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x19f'),_0x42b376[_0x3b6e('0x38')]));if(!this['isConfigured'](_0x42b376[_0x3b6e('0x1a0')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')]('no\x20sms\x20account\x20configured');}var _0x4803b0=this[_0x3b6e('0x33')][_0x3b6e('0x6f')](this,_0x42b376['sms_account_id']);if(!_0x4803b0){return this['channel'][_0x3b6e('0x2c')](_0x42b376,_0x3b6e('0x1a1'));}var _0x2dcf69={'body':_0x42b376[_0x3b6e('0x1a2')],'phone':_0x42b376['to']||'','SmsAccountId':_0x4803b0['id']};logger['debug'](_0x3b6e('0x1a3'),JSON[_0x3b6e('0x73')](_0x2dcf69));this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x42b376,_0x42b376[_0x3b6e('0x1a0')]);this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x4803b0[_0x3b6e('0x14')]));this[_0x3b6e('0x34')][_0x3b6e('0x6f')](this,_0x2dcf69);return this['channel']['noop'](_0x3b6e('0x1a4'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1a5')]=function(_0x5dc1f8){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x1a6'),_0x5dc1f8['label']));if(!this['isConfigured'](_0x5dc1f8['variable_id'])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x5dc1f8,_0x3b6e('0x1a7'));}var _0x1ce4e1=this[_0x3b6e('0x11')][_0x3b6e('0x6f')](this,_0x5dc1f8[_0x3b6e('0xd5')]);if(!_0x1ce4e1){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x5dc1f8,'no\x20variable\x20found');}return this[_0x3b6e('0x36')]['setVariable'](_0x1ce4e1,_0x5dc1f8['variable_value']);};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1a8')]=function(_0xbb72e4){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x1a9'),_0xbb72e4[_0x3b6e('0x38')]));this['channel'][_0x3b6e('0xa6')](_0x3b6e('0x1aa'));if(_0xbb72e4[_0x3b6e('0xb8')]===_0x3b6e('0x1ab')){this['channel']['noop'](_0x3b6e('0x1ac'));return this['channel'][_0x3b6e('0xb8')]();}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x1ad'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1ae')]=function(_0x384a88){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x384a88[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x384a88[_0x3b6e('0x1af')])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x384a88,'no\x20subproject\x20selected');}var _0x575ebe=this[_0x3b6e('0x17')]['sync'](this,_0x384a88[_0x3b6e('0x1af')]);if(!this['isConfigured'](_0x575ebe)){return this['channel'][_0x3b6e('0x2c')](_0x384a88,util[_0x3b6e('0x2a')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x384a88[_0x3b6e('0x1af')]));}if(_0x575ebe===this['channel'][_0x3b6e('0x3a')]){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x384a88,_0x3b6e('0x1b0'));}this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x384a88,_0x575ebe);var _0x29fa51=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0x3b6e('0x1b1'),util[_0x3b6e('0x2a')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x3b6e('0x8')][_0x3b6e('0x195')]||_0x3b6e('0x1b2'),_0x575ebe,this[_0x3b6e('0x36')][_0x3b6e('0x3a')]));if(_0x29fa51['result']===-0x1){return _0x29fa51;}return this['channel']['noop'](util[_0x3b6e('0x2a')]('Executed\x20command\x20%s\x20%s',_0x3b6e('0x1b1'),_0x575ebe));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1b3')]=function(_0x345dbf){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x1b4'),_0x345dbf[_0x3b6e('0x38')]));var _0xa89bbe=this[_0x3b6e('0x1b5')][_0x3b6e('0x6f')](this,_0x345dbf['command']);this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x345dbf,_0x345dbf[_0x3b6e('0xb6')]);if(this[_0x3b6e('0xa1')](_0x345dbf[_0x3b6e('0xd5')])){var _0x22f571=this[_0x3b6e('0x11')]['sync'](this,_0x345dbf[_0x3b6e('0xd5')]);if(_0x22f571){this[_0x3b6e('0x36')][_0x3b6e('0x9b')](_0x22f571,_0xa89bbe);return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x345dbf[_0x3b6e('0xb6')],_0x22f571));}}return this[_0x3b6e('0x36')]['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x1b6'),_0x345dbf[_0x3b6e('0xb6')]));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1b7')]=function(_0x452a79){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x1b8'),_0x452a79[_0x3b6e('0x38')]));_0x452a79[_0x3b6e('0x5c')]=_0x452a79['text'][_0x3b6e('0xd2')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x452a79[_0x3b6e('0x5a')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x1b9'));}if(!this['isConfigured'](_0x452a79[_0x3b6e('0x5c')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xa7'));}this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x1ba'),_0x452a79[_0x3b6e('0x5c')]));var _0x1e303b=this[_0x3b6e('0x59')][_0x3b6e('0x6f')](this,_0x452a79);if(_0x1e303b){this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x1e303b));var _0x5e8a9f=this[_0x3b6e('0x36')][_0x3b6e('0x120')](_0x1e303b);try{fs[_0x3b6e('0xfc')](_0x1e303b+'.wav');}catch(_0x4122e5){logger[_0x3b6e('0x2c')](_0x4122e5);}return _0x5e8a9f;}return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x452a79,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1bb')]=function(_0x2d338c){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x1bc'),_0x2d338c[_0x3b6e('0x38')]));_0x2d338c[_0x3b6e('0x5c')]=_0x2d338c[_0x3b6e('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2d338c[_0x3b6e('0x5c')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xa7'));}this[_0x3b6e('0x36')]['noop'](util['format']('Trying\x20Google\x20TTS\x20%s',_0x2d338c[_0x3b6e('0x5c')]));var _0x35afa5=this['googleTTS'][_0x3b6e('0x6f')](this,_0x2d338c);if(_0x35afa5){this[_0x3b6e('0x36')]['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x1bd'),_0x35afa5));var _0x4ad114=this['channel']['streamFile'](_0x35afa5);try{fs[_0x3b6e('0xfc')](_0x35afa5+'.wav');}catch(_0x2b6f06){logger[_0x3b6e('0x2c')](_0x2b6f06);}return _0x4ad114;}return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x2d338c,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x3b6e('0x1be')]=function(_0x3b7af3){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x1bf'),_0x3b7af3[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x3b7af3[_0x3b6e('0x155')])){return this['channel'][_0x3b6e('0x2c')](_0x3b7af3,_0x3b6e('0x156'));}logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x157'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x3b7af3[_0x3b6e('0x155')]));var _0x659f86=this[_0x3b6e('0x53')][_0x3b6e('0x6f')](this,_0x3b7af3[_0x3b6e('0x155')]);if(_0x659f86){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x158'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x3b7af3[_0x3b6e('0x155')]));this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x158'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x3b7af3['findBy']));return{'code':0xc8,'result':_0x3b6e('0x15c')};}else{logger['info'](util[_0x3b6e('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3b6e('0x36')]['callerid'],_0x3b7af3[_0x3b6e('0x155')]));this[_0x3b6e('0x36')]['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x159'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x3b7af3[_0x3b6e('0x155')]));return{'code':0xc8,'result':_0x3b6e('0x15d')};}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1c0')]=function(_0x30e988){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x1c1'),_0x30e988[_0x3b6e('0x38')]));var _0x24367d=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0x3b6e('0x1c2'),[_0x30e988[_0x3b6e('0x1c3')],_0x30e988['options']]);if(_0x24367d[_0x3b6e('0xaa')]===-0x1){return _0x24367d;}return this['channel']['noop'](util['format'](_0x3b6e('0xc0'),_0x3b6e('0x1c2'),_0x30e988['mailbox']));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1c4')]=function(_0x9ca090){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x1c5'),_0x9ca090['label']));if(!this[_0x3b6e('0xa1')](_0x9ca090[_0x3b6e('0xd5')])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x9ca090,_0x3b6e('0x1a7'));}var _0x5bf8ce=this[_0x3b6e('0x11')]['sync'](this,_0x9ca090['variable_id']);if(!_0x5bf8ce){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x9ca090,_0x3b6e('0x110'));}var _0x28f6bc=this[_0x3b6e('0x36')][_0x3b6e('0x11')](_0x5bf8ce);return{'code':0xc8,'result':_0x28f6bc[_0x3b6e('0x9f')]?_0x28f6bc[_0x3b6e('0x9f')]:'-'};};String[_0x3b6e('0x10')]['replaceAll']=function(_0x2ec40c,_0x1124b0){return this['split'](_0x2ec40c)['join'](_0x1124b0);};module[_0x3b6e('0x1c6')]=AGIVertices; \ No newline at end of file +var _0xcf6c=['MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','wait','no\x20list\x20selected','delay','add','minutes','callback_priority','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_INSTANCE','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','getUser','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','createSquareMessage','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','position','record','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','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','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','name','getSquareProjectById','getSquareOdbc','dsn','getUserById','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','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','priority','dnid','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','isString','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','length','saveRestApiResult','%s.%s','isArray','setVariable','replaceAllVariables','split','replaceAll','extra','toString','getAndSetVariable','result','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','isConfigured','exec','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE'];(function(_0x7fbee,_0x31f6d6){var _0x4fe1b5=function(_0xb868f4){while(--_0xb868f4){_0x7fbee['push'](_0x7fbee['shift']());}};_0x4fe1b5(++_0x31f6d6);}(_0xcf6c,0x11c));var _0xccf6=function(_0x1aa2a2,_0x570bb3){_0x1aa2a2=_0x1aa2a2-0x0;var _0x596b90=_0xcf6c[_0x1aa2a2];return _0x596b90;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xccf6('0x0'));var _=require(_0xccf6('0x1'));var sh=require(_0xccf6('0x2'));var odbc=require(_0xccf6('0x3'))();var rs=require(_0xccf6('0x4'));var moment=require('moment');var Mustache=require(_0xccf6('0x5'));var rp=require(_0xccf6('0x6'));var logger=require(_0xccf6('0x7'))(_0xccf6('0x8'));var config=require(_0xccf6('0x9'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xccf6('0xa'),_0xccf6('0xb')];var verticesWithRetry=['menu',_0xccf6('0xc'),_0xccf6('0xd')];var AGIVertices=function(_0x3c4d6b,_0x3edd22,_0x31f78e){this[_0xccf6('0xe')]=_0x3c4d6b;this[_0xccf6('0xf')]=_0x3edd22;this[_0xccf6('0x10')]=_0x31f78e;};AGIVertices[_0xccf6('0x11')][_0xccf6('0x12')]=function(_0x372e5d,_0x39e16f){this[_0xccf6('0xf')][_0xccf6('0x13')](_0x372e5d)[_0xccf6('0x14')](function(_0xccd06a){_0x39e16f(null,_0xccd06a?_0xccd06a['name']:![]);})[_0xccf6('0x15')](function(_0x32cdce){_0x39e16f(_0x32cdce);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x16')]=function(_0x1fab07,_0x52c5e3){this[_0xccf6('0xf')]['getVoiceQueueById'](_0x1fab07)[_0xccf6('0x14')](function(_0x1573db){_0x52c5e3(null,_0x1573db?_0x1573db[_0xccf6('0x17')]:![]);})[_0xccf6('0x15')](function(_0x56295b){_0x52c5e3(_0x56295b);});};AGIVertices[_0xccf6('0x11')]['getSquareProject']=function(_0x675d81,_0xde3aca){this['rpc'][_0xccf6('0x18')](_0x675d81)[_0xccf6('0x14')](function(_0x36028d){_0xde3aca(null,_0x36028d?_0x36028d[_0xccf6('0x17')]:![]);})[_0xccf6('0x15')](function(_0x15ac9a){_0xde3aca(_0x15ac9a);});};AGIVertices['prototype'][_0xccf6('0x19')]=function(_0x30769d,_0x29d638){this[_0xccf6('0xf')]['getSquareOdbcById'](_0x30769d)[_0xccf6('0x14')](function(_0x2b5777){_0x29d638(null,_0x2b5777?_0x2b5777[_0xccf6('0x1a')]:![]);})[_0xccf6('0x15')](function(_0xdabf14){_0x29d638(_0xdabf14);});};AGIVertices[_0xccf6('0x11')]['getUser']=function(_0x425a31,_0xbf18ce){this[_0xccf6('0xf')][_0xccf6('0x1b')](_0x425a31)['then'](function(_0x58f34){_0xbf18ce(null,_0x58f34?_0x58f34[_0xccf6('0x17')]:![]);})[_0xccf6('0x15')](function(_0x3b3d32){_0xbf18ce(_0x3b3d32);});};AGIVertices['prototype']['getTrunk']=function(_0x14e2f7,_0x42e31b){this[_0xccf6('0xf')][_0xccf6('0x1c')](_0x14e2f7)['then'](function(_0x24b70c){_0x42e31b(null,_0x24b70c?_0x24b70c[_0xccf6('0x17')]:![]);})['catch'](function(_0x45f01c){_0x42e31b(_0x45f01c);});};AGIVertices[_0xccf6('0x11')]['getSound']=function(_0x5d05bb,_0xff00c6){var _0x58b6f5=this;this[_0xccf6('0xf')][_0xccf6('0x1d')](_0x5d05bb)[_0xccf6('0x14')](function(_0x5027a2){_0xff00c6(null,_0x5027a2?_0x58b6f5[_0xccf6('0x1e')](_0x5027a2[_0xccf6('0x1f')]):![]);})[_0xccf6('0x15')](function(_0x2d4595){_0xff00c6(_0x2d4595);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x20')]=function(_0x28e0be,_0x14ef45){this[_0xccf6('0xf')][_0xccf6('0x21')](_0x28e0be)[_0xccf6('0x14')](function(_0x2c472f){_0x14ef45(null,_0x2c472f?_0x2c472f:![]);})[_0xccf6('0x15')](function(_0x4ddd3c){_0x14ef45(_0x4ddd3c);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x22')]=function(_0x4b621d,_0x559075,_0x16fe1d){this['mailRpc'][_0xccf6('0x22')](_0x4b621d,_0x559075)[_0xccf6('0x14')](function(){_0x16fe1d(null);})[_0xccf6('0x15')](function(_0x1bc9e2){_0x16fe1d(_0x1bc9e2);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x23')]=function(_0x5ca947,_0x5d9ae4){this[_0xccf6('0xf')][_0xccf6('0x24')](_0x5ca947)[_0xccf6('0x14')](function(_0xf0319b){if(_0xf0319b){if(_0xf0319b[_0xccf6('0x25')]){_0x5d9ae4(null,[_0xf0319b['interval']]);}else{_0x5d9ae4(null,_[_0xccf6('0x26')](_0xf0319b[_0xccf6('0x27')],_0xccf6('0x28')));}}else{_0x5d9ae4(null,![]);}})['catch'](function(_0x2e8883){_0x5d9ae4(_0x2e8883);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x1e')]=function(_0x2d8603){return util[_0xccf6('0x29')](_0xccf6('0x2a'),FILES_PATH,_0x2d8603);};AGIVertices['prototype'][_0xccf6('0x2b')]=function(_0x330cf7,_0x7625f1,_0x14c73b){odbc[_0xccf6('0x2c')](_0x330cf7,function(_0x2fe1d4){if(_0x2fe1d4){logger['error'](_0xccf6('0x2d'),_0x2fe1d4);_0x14c73b(_0x2fe1d4);}else{logger[_0xccf6('0x2e')]('ODBC\x20connection\x20successfully');odbc[_0xccf6('0x2f')](_0x7625f1,function(_0x519426,_0x32caed){if(_0x519426){logger['info'](_0xccf6('0x30'),_0x7625f1);_0x14c73b(_0x519426);}else{logger[_0xccf6('0x2e')](_0xccf6('0x31'),_0x7625f1);odbc[_0xccf6('0x32')](function(_0x1b24c8){if(_0x1b24c8){logger[_0xccf6('0x33')](_0xccf6('0x34'),_0x1b24c8);}_0x14c73b(null,_0x32caed);});}});}});};AGIVertices['prototype'][_0xccf6('0x35')]=function(_0xb5608c,_0x511609){this[_0xccf6('0xf')][_0xccf6('0x36')](_0xb5608c)[_0xccf6('0x14')](function(_0x4e8795){_0x511609(null,_0x4e8795?_0x4e8795:![]);})[_0xccf6('0x15')](function(_0x21fe90){_0x511609(_0x21fe90);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x37')]=function(_0x5b3405,_0x1c5629){this[_0xccf6('0xf')][_0xccf6('0x37')](_0x5b3405)[_0xccf6('0x14')](function(_0x52bb63){_0x1c5629(null,_0x52bb63);})['catch'](function(_0x5ab53e){_0x1c5629(_0x5ab53e);});};AGIVertices['prototype'][_0xccf6('0x38')]=function(_0x3ac343,_0x2b6286,_0x3d2f5a){this[_0xccf6('0xf')][_0xccf6('0x38')]({'uniqueid':this['channel'][_0xccf6('0x39')],'node':_0x3ac343[_0xccf6('0x3a')],'application':_0x3ac343[_0xccf6('0x3b')],'data':_0x2b6286||null,'project_name':this[_0xccf6('0xe')][_0xccf6('0x3c')],'callerid':this['channel'][_0xccf6('0x3d')]})[_0xccf6('0x14')](function(_0x2533e0){if(_0x3d2f5a){_0x3d2f5a(null,_0x2533e0);}})[_0xccf6('0x15')](function(_0x1470b5){if(_0x3d2f5a){_0x3d2f5a(_0x1470b5);}});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x3e')]=function(_0x53bbf4,_0x3010db,_0x2bb3b3,_0x37b882){this[_0xccf6('0xf')][_0xccf6('0x3e')]({'uniqueid':this['channel'][_0xccf6('0x39')],'callerid':this[_0xccf6('0xe')][_0xccf6('0x3d')],'calleridname':this[_0xccf6('0xe')]['calleridname'],'context':this[_0xccf6('0xe')]['context'],'extension':this[_0xccf6('0xe')]['extension'],'priority':this['channel'][_0xccf6('0x3f')],'accountcode':this['channel']['accountcode'],'dnid':this['channel'][_0xccf6('0x40')],'projectName':this[_0xccf6('0xe')][_0xccf6('0x3c')],'saveName':_0x3010db,'filename':_0x53bbf4['file']||_0x3010db,'savePath':_0x2bb3b3})[_0xccf6('0x14')](function(_0x12a6aa){_0x37b882(null,_0x12a6aa);})[_0xccf6('0x15')](function(_0x297049){_0x37b882(_0x297049);});};AGIVertices['prototype']['createSquareMessage']=function(_0xf63bf,_0x22c907,_0x47056a,_0x44d814,_0x266027){this[_0xccf6('0xf')]['createSquareMessage']({'uniqueid':this[_0xccf6('0xe')][_0xccf6('0x39')],'body':_0xf63bf,'direction':_0x22c907,'providerName':_0x47056a,'providerResponse':_0x44d814})['then'](function(_0x3807f4){if(_0x266027){_0x266027(null,_0x3807f4);}})['catch'](function(_0x421e49){if(_0x266027){_0x266027(_0x421e49);}});};AGIVertices['prototype']['createCmContact']=function(_0x23c0d0,_0x521d90){this[_0xccf6('0xf')][_0xccf6('0x41')]({'firstName':_[_0xccf6('0x42')](_0x23c0d0[_0xccf6('0x17')])||_[_0xccf6('0x43')](_0x23c0d0['name'])?_0xccf6('0x44')+Math['random']():_0x23c0d0[_0xccf6('0x17')],'lastName':_['isEmpty'](_0x23c0d0[_0xccf6('0x45')])||_['isNil'](_0x23c0d0[_0xccf6('0x45')])?null:_0x23c0d0[_0xccf6('0x45')],'phone':_0x23c0d0[_0xccf6('0x46')],'ListId':_0x23c0d0[_0xccf6('0x47')],'scheduledat':_0x23c0d0[_0xccf6('0x48')],'callbackUniqueid':this[_0xccf6('0xe')][_0xccf6('0x39')],'tags':_0xccf6('0x49'),'description':_0xccf6('0x4a')+_0x23c0d0[_0xccf6('0x48')]['toString'](),'priority':_0x23c0d0['callback_priority']})[_0xccf6('0x14')](function(_0x5df2be){_0x521d90(null,_0x5df2be);})[_0xccf6('0x15')](function(_0x1425d6){_0x521d90(_0x1425d6);});};AGIVertices[_0xccf6('0x11')]['getPause']=function(_0x3d9663,_0x1b6dd1){this[_0xccf6('0xf')]['getPauseById'](_0x3d9663)['then'](function(_0x3ef9bd){_0x1b6dd1(null,_0x3ef9bd?_0x3ef9bd[_0xccf6('0x17')]:![]);})[_0xccf6('0x15')](function(_0x52a103){_0x1b6dd1(_0x52a103);});};AGIVertices['prototype']['agentPause']=function(_0x2b11ec,_0x3a792d,_0x190a95){var _0x451cf6={'role':_0xccf6('0x4b')};_0x451cf6[_0x2b11ec]=this[_0xccf6('0xe')][_0xccf6('0x3d')];this[_0xccf6('0xf')][_0xccf6('0x4c')](_0x451cf6,_0x3a792d,this[_0xccf6('0xe')][_0xccf6('0x39')])[_0xccf6('0x14')](function(_0x5abfe4){_0x190a95(null,_[_0xccf6('0x43')](_0x5abfe4)?![]:!![]);})[_0xccf6('0x15')](function(_0x548022){logger[_0xccf6('0x33')](_0x548022);_0x190a95(null,![]);});};AGIVertices[_0xccf6('0x11')]['agentUnpause']=function(_0x5e09e3,_0x2550f4){var _0x38d8f9={'role':_0xccf6('0x4b')};_0x38d8f9[_0x5e09e3]=this[_0xccf6('0xe')][_0xccf6('0x3d')];this['rpc'][_0xccf6('0x4d')](_0x38d8f9)[_0xccf6('0x14')](function(_0x2e6e1c){_0x2550f4(null,_['isNil'](_0x2e6e1c)?![]:!![]);})[_0xccf6('0x15')](function(_0x352d41){logger[_0xccf6('0x33')](_0x352d41);_0x2550f4(null,![]);});};AGIVertices['prototype'][_0xccf6('0x4e')]=function(_0x19965a,_0x261b72){var _0x6a4326={'role':'agent'};_0x6a4326[_0x19965a]=this[_0xccf6('0xe')][_0xccf6('0x3d')];this[_0xccf6('0xf')][_0xccf6('0x4e')](_0x6a4326)[_0xccf6('0x14')](function(_0xaab8d){_0x261b72(null,_['isNil'](_0xaab8d)?![]:!![]);})[_0xccf6('0x15')](function(_0x5bf2e1){logger[_0xccf6('0x33')](_0x5bf2e1);_0x261b72(null,![]);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x4f')]=function(_0x56cdf4,_0x2f6c04){var _0x4caf84={'role':_0xccf6('0x4b')};_0x4caf84[_0x56cdf4]=this[_0xccf6('0xe')]['callerid'];var _0x58d36f=_0x56cdf4!=_0xccf6('0x50')?util['format'](_0xccf6('0x51'),_0xccf6('0x52'),this[_0xccf6('0xe')][_0xccf6('0x3d')]):undefined;this[_0xccf6('0xf')][_0xccf6('0x4f')](_0x4caf84,_0x58d36f)[_0xccf6('0x14')](function(_0x2bd159){_0x2f6c04(null,_['isNil'](_0x2bd159)?![]:!![]);})[_0xccf6('0x15')](function(_0xbc6789){logger[_0xccf6('0x33')](_0xbc6789);_0x2f6c04(null,![]);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x53')]=function(_0x5f11e4,_0x1f61d6){sh['exec'](_[_0xccf6('0x54')](_0x5f11e4),function(_0x16e39a,_0x2c136a){var _0x5b3d14=_0x2c136a[_0xccf6('0x55')](/(\r\n|\n|\r)/gm,'');_0x1f61d6(null,_0x5b3d14);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x56')]=function(_0x4df7fc,_0x3ce9b2){scripts['googleCloudTTS'](_0x4df7fc[_0xccf6('0x57')],_0x4df7fc[_0xccf6('0x58')]||_0xccf6('0x59'),_0x4df7fc[_0xccf6('0x59')],_0x4df7fc[_0xccf6('0x5a')]||_0xccf6('0x5b'),_0x4df7fc['ssmlGender']||'MALE',_0x4df7fc['audioEncoding']||_0xccf6('0x5c'))['then'](function(_0x1b86ad){_0x3ce9b2(null,_0x1b86ad);})[_0xccf6('0x15')](function(_0x456d6c){_0x3ce9b2(_0x456d6c);});};AGIVertices['prototype'][_0xccf6('0x5d')]=function(_0x56ff72,_0x5f4876){scripts['googleTTS'](_0x56ff72[_0xccf6('0x59')],_0x56ff72[_0xccf6('0x5e')]||'en',0x1)[_0xccf6('0x14')](function(_0x7b2027){_0x5f4876(null,_0x7b2027);})[_0xccf6('0x15')](function(_0x4e2458){_0x5f4876(_0x4e2458);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x5f')]=function(_0x2528eb,_0x3e21de){var _0x1725ac={'uri':_0x2528eb[_0xccf6('0x60')],'method':_0x2528eb[_0xccf6('0x61')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2528eb[_0xccf6('0x62')])===_0xccf6('0x63')&&parseInt(_0x2528eb[_0xccf6('0x62')])>=0x1?parseInt(_0x2528eb[_0xccf6('0x62')])*0x3e8:0x5*0x3e8};if(_[_0xccf6('0x64')]([_0xccf6('0x65'),_0xccf6('0x66')],_0x1725ac[_0xccf6('0x61')][_0xccf6('0x67')]())){try{_0x1725ac[_0xccf6('0x68')]=_0x2528eb[_0xccf6('0xb')]?JSON[_0xccf6('0x69')](_0x2528eb[_0xccf6('0xb')]):{};}catch(_0xe3894e){logger[_0xccf6('0x33')](_0xccf6('0x6a'),_0xe3894e);}}try{_0x1725ac['headers']=_0x2528eb[_0xccf6('0xa')]?JSON[_0xccf6('0x69')](_0x2528eb[_0xccf6('0xa')]):{};}catch(_0x1ee5e7){logger['error'](_0xccf6('0x6b'),_0x1ee5e7);}if(_0x2528eb[_0xccf6('0x6c')]){try{var _0xc2d19c=require(_0x2528eb[_0xccf6('0x6c')])[_0xccf6('0x6d')](this,_0x1725ac);_0x1725ac[_0xccf6('0x6e')]=Mustache['render'](_0x2528eb[_0xccf6('0x60')],_0xc2d19c,{},['$$','$$']);if(_0x1725ac[_0xccf6('0x6f')]){_0x1725ac['headers']=JSON[_0xccf6('0x69')](Mustache[_0xccf6('0x70')](JSON['stringify'](_0x1725ac['headers']),_0xc2d19c,{},['$$','$$']));}if(_0x1725ac[_0xccf6('0x68')]){_0x1725ac[_0xccf6('0x68')]=JSON[_0xccf6('0x69')](Mustache[_0xccf6('0x70')](JSON[_0xccf6('0x71')](_0x1725ac[_0xccf6('0x68')]),_0xc2d19c,{},['$$','$$']));}}catch(_0x175cf5){logger['error'](_0xccf6('0x72'),_0x175cf5);}}rp(_0x1725ac)[_0xccf6('0x14')](function(_0x192498){var _0x596c66={'statusCode':_0x192498['statusCode']||0xc8,'statusMessage':_0x192498[_0xccf6('0x73')]||'OK','headers':_0x192498[_0xccf6('0x6f')]||{},'body':_0x192498[_0xccf6('0x68')]||{}};_0x3e21de(null,_0x596c66);})[_0xccf6('0x15')](function(_0x106bb7){var _0x1fb5dd={'statusCode':_0x106bb7[_0xccf6('0x74')]||0x1f4,'statusMessage':_0x106bb7[_0xccf6('0x75')]||_0xccf6('0x76'),'headers':_0x106bb7[_0xccf6('0x77')][_0xccf6('0x6f')]||{},'body':_0x106bb7[_0xccf6('0x77')][_0xccf6('0x68')]||{}};_0x3e21de(null,_0x1fb5dd);});};AGIVertices[_0xccf6('0x11')]['googleDialogflow']=function(_0x10d374,_0xee5ab6){scripts[_0xccf6('0x78')](this['channel'][_0xccf6('0x39')],_0x10d374[_0xccf6('0x79')],_0x10d374[_0xccf6('0x59')],_0x10d374[_0xccf6('0x7a')]||'en')[_0xccf6('0x14')](function(_0x41c47c){_0xee5ab6(null,_0x41c47c);})[_0xccf6('0x15')](function(_0x42aebf){_0xee5ab6(_0x42aebf);});};AGIVertices[_0xccf6('0x11')]['googleDialogflowV2']=function(_0x53e84b,_0xd6f700){scripts[_0xccf6('0x7b')](this[_0xccf6('0xe')][_0xccf6('0x39')],_0x53e84b[_0xccf6('0x7c')],_0x53e84b[_0xccf6('0x7d')],_0x53e84b[_0xccf6('0x7e')],_0x53e84b[_0xccf6('0x59')],_0x53e84b[_0xccf6('0x7f')]||'en')[_0xccf6('0x14')](function(_0x24127c){_0xd6f700(null,_0x24127c);})[_0xccf6('0x15')](function(_0xbe05e7){_0xd6f700(_0xbe05e7);});};AGIVertices['prototype'][_0xccf6('0x80')]=function(_0x201f7a,_0x5f0a53){scripts[_0xccf6('0x80')](this[_0xccf6('0xe')],_0x201f7a)[_0xccf6('0x14')](function(_0x32eedd){_0x5f0a53(null,_0x32eedd);})['catch'](function(_0x24f358){_0x5f0a53(_0x24f358);});};AGIVertices['prototype'][_0xccf6('0x81')]=function(_0x3ee801,_0x150929){scripts[_0xccf6('0x81')](_0x3ee801['key'],_0x3ee801[_0xccf6('0x59')],_0x3ee801['ispeech_tts_language']||_0xccf6('0x5b'),_0x3ee801['speed'])[_0xccf6('0x14')](function(_0x4776a8){_0x150929(null,_0x4776a8);})['catch'](function(_0x2b0cb1){_0x150929(_0x2b0cb1);});};AGIVertices[_0xccf6('0x11')]['ispeechASR']=function(_0x252969,_0x508df4,_0x93ab6){scripts[_0xccf6('0x82')](_0x508df4,_0x252969[_0xccf6('0x79')],_0x252969[_0xccf6('0x83')]||'en-US',this['isConfigured'](_0x252969[_0xccf6('0x84')])?_0x252969[_0xccf6('0x84')]:undefined)[_0xccf6('0x14')](function(_0x3052af){_0x93ab6(null,_0x3052af);})[_0xccf6('0x15')](function(_0x1ff686){_0x93ab6(_0x1ff686);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x85')]=function(_0x2f1a0f,_0x4f9ae9){scripts[_0xccf6('0x85')](_0x2f1a0f[_0xccf6('0x86')],_0x2f1a0f[_0xccf6('0x87')],_0x2f1a0f[_0xccf6('0x88')],_0x2f1a0f['aws_polly_voice']||_0xccf6('0x89'),_0x2f1a0f[_0xccf6('0x59')],_0x2f1a0f['aws_text_type']||_0xccf6('0x59'))[_0xccf6('0x14')](function(_0xb4cf9){_0x4f9ae9(null,_0xb4cf9);})[_0xccf6('0x15')](function(_0x1e85df){_0x4f9ae9(_0x1e85df);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x8a')]=function(_0x37f31c,_0x399431){scripts[_0xccf6('0x8a')](this[_0xccf6('0xe')][_0xccf6('0x39')],_0x37f31c[_0xccf6('0x86')],_0x37f31c['aws_secret_access_key'],_0x37f31c['aws_lex_region'],_0x37f31c[_0xccf6('0x59')],_0x37f31c[_0xccf6('0x8b')])[_0xccf6('0x14')](function(_0x1df327){_0x399431(null,_0x1df327);})[_0xccf6('0x15')](function(_0x26e626){_0x399431(_0x26e626);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x8c')]=function(_0x301aea,_0x11fa48,_0x3edf23){scripts['googleASR'](_0x11fa48,_0x301aea[_0xccf6('0x79')],_0x301aea[_0xccf6('0x8d')]||_0xccf6('0x5b'))[_0xccf6('0x14')](function(_0x3805b5){_0x3edf23(null,_0x3805b5);})['catch'](function(_0x59db66){_0x3edf23(_0x59db66);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x8e')]=function(_0x36a711,_0x434102,_0x371f8d){scripts[_0xccf6('0x8e')](_0x434102,_0x36a711[_0xccf6('0x8f')],_0x36a711['appsecret'],_0x36a711[_0xccf6('0x6e')])[_0xccf6('0x14')](function(_0x3e609d){_0x371f8d(null,_0x3e609d);})[_0xccf6('0x15')](function(_0x4d8c45){_0x371f8d(_0x4d8c45);});};AGIVertices[_0xccf6('0x11')][_0xccf6('0x90')]=function(_0x5b5577){var _0x30e060=_[_0xccf6('0x64')](verticesWithRetry,_0x5b5577[_0xccf6('0x3b')])?_0x5b5577:_[_0xccf6('0x91')](_0x5b5577);for(var _0x3d0d8e in _0x30e060){if(_0x30e060['hasOwnProperty'](_0x3d0d8e)){if(_0x30e060[_0x3d0d8e]&&_[_0xccf6('0x92')](_0x30e060[_0x3d0d8e])){if(_['includes'](recursiveMapAttributes,_0x3d0d8e)){_0x30e060[_0x3d0d8e]=this[_0xccf6('0x93')](_0x30e060[_0x3d0d8e]);}else{_0x30e060[_0x3d0d8e]=this['replaceAllVariables'](_0x30e060[_0x3d0d8e]);}}}}return _0x30e060;};AGIVertices[_0xccf6('0x11')][_0xccf6('0x94')]=function(_0x235552){for(var _0x501360 in _0x235552){if(_0x235552[_0xccf6('0x95')](_0x501360)){if(_['isPlainObject'](_0x235552[_0x501360])){this[_0xccf6('0x94')](_0x235552[_0x501360]);}else if(_['isArray'](_0x235552[_0x501360])){for(var _0x50d375=0x0;_0x50d375<_0x235552[_0x501360][_0xccf6('0x96')];_0x50d375++){this['recursiveNodeIndex'](_0x235552[_0x501360][_0x50d375]);}}else if(_[_0xccf6('0x92')](_0x235552[_0x501360])){_0x235552[_0x501360]=this['replaceAllVariables'](_0x235552[_0x501360]);}}}};AGIVertices[_0xccf6('0x11')]['saveRestApiResult']=function(_0x16be45,_0x5d8069){for(var _0x5ababa in _0x16be45){if(_0x16be45[_0xccf6('0x95')](_0x5ababa)){if(_['isPlainObject'](_0x16be45[_0x5ababa])){if(!_['isEmpty'](_0x16be45[_0x5ababa])){this[_0xccf6('0x97')](_0x16be45[_0x5ababa],util[_0xccf6('0x29')](_0xccf6('0x98'),_0x5d8069,_0x5ababa));}}else if(_[_0xccf6('0x99')](_0x16be45[_0x5ababa])){for(var _0x16ab74=0x0;_0x16ab74<_0x16be45[_0x5ababa][_0xccf6('0x96')];_0x16ab74++){this[_0xccf6('0x97')](_0x16be45[_0x5ababa][_0x16ab74],util[_0xccf6('0x29')](_0xccf6('0x98'),_0x5d8069,_0x5ababa+'['+_0x16ab74+']'));}}else{if(!_['isNil'](_0x16be45[_0x5ababa])){this[_0xccf6('0xe')][_0xccf6('0x9a')](util[_0xccf6('0x29')](_0xccf6('0x98'),_0x5d8069,_0x5ababa),_0x16be45[_0x5ababa]);}}}}};AGIVertices[_0xccf6('0x11')][_0xccf6('0x93')]=function(_0x588ae3){try{var _0x3fc227=JSON[_0xccf6('0x69')](_0x588ae3);this[_0xccf6('0x94')](_0x3fc227);return JSON[_0xccf6('0x71')](_0x3fc227);}catch(_0x20b311){return this[_0xccf6('0x9b')](_0x588ae3);}};AGIVertices[_0xccf6('0x11')][_0xccf6('0x9b')]=function(_0x2632b7){var _0x1a3720=_0x2632b7[_0xccf6('0x9c')]('{');for(var _0x4ce168=0x1;_0x4ce168<_0x1a3720[_0xccf6('0x96')];_0x4ce168+=0x1){var _0x54926a=_0x1a3720[_0x4ce168]['split']('}');if(_0x54926a[_0xccf6('0x96')]>0x1){_0x2632b7=_0x2632b7[_0xccf6('0x9d')]('{'+_0x54926a[0x0]+'}',this[_0xccf6('0xe')][_0xccf6('0x12')](_0x54926a[0x0])[_0xccf6('0x9e')]||_0x54926a[0x0]);}}if(_0x1a3720[_0xccf6('0x96')]===0x1){return _0x2632b7[_0xccf6('0x9f')]();}return this[_0xccf6('0x9b')](_0x2632b7);};AGIVertices[_0xccf6('0x11')][_0xccf6('0xa0')]=function(_0x1a62ee,_0x3dc08e){var _0x2504dd=this[_0xccf6('0xe')]['getVariable'](_0x1a62ee);if(_0x2504dd[_0xccf6('0xa1')]===-0x1){return _0x2504dd;}logger[_0xccf6('0x2e')](util[_0xccf6('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x3dc08e,_0x2504dd[_0xccf6('0x9e')]));return this[_0xccf6('0xe')][_0xccf6('0x9a')](_0x3dc08e,_0x2504dd[_0xccf6('0x9e')]);};AGIVertices[_0xccf6('0x11')]['isConfigured']=function(_0x818232){return _0x818232&&_0x818232!=='0'&&_0x818232!=='-1'&&_0x818232!=='';};AGIVertices[_0xccf6('0x11')][_0xccf6('0xa2')]=function(_0x4db704){this[_0xccf6('0x38')][_0xccf6('0x6d')](this,_0x4db704,'-');_0x4db704[_0xccf6('0xa3')]=_0x4db704['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xccf6('0x11')][_0xccf6('0xa4')]=function(_0x1b6ad6){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0xa5'),_0x1b6ad6[_0xccf6('0x3a')]));if(!this['isConfigured'](_0x1b6ad6[_0xccf6('0x59')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0xa7'));}var _0xa4e4ae='\x22'+_0x1b6ad6[_0xccf6('0x59')]+'\x22';if(this[_0xccf6('0xa8')](_0x1b6ad6[_0xccf6('0x77')])){_0xa4e4ae+=','+_0x1b6ad6['options'];}var _0x1f5450=this[_0xccf6('0xe')][_0xccf6('0xa9')]('MRCPSynth',_0xa4e4ae);if(_0x1f5450[_0xccf6('0xa1')]===-0x1){return _0x1f5450;}return this[_0xccf6('0xe')]['noop'](util[_0xccf6('0x29')](_0xccf6('0xaa'),_0xa4e4ae));};AGIVertices[_0xccf6('0x11')]['mrcprecog']=function(_0x2b581b){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0xab'),_0x2b581b[_0xccf6('0x3a')]));if(!this['isConfigured'](_0x2b581b[_0xccf6('0xac')])){return this['channel'][_0xccf6('0xa6')](_0xccf6('0xad'));}var _0x36842d=_0x2b581b[_0xccf6('0xac')];if(this[_0xccf6('0xa8')](_0x2b581b[_0xccf6('0x77')])){_0x36842d+=','+_0x2b581b[_0xccf6('0x77')];}var _0x176885=this[_0xccf6('0xe')]['exec'](_0xccf6('0xae'),_0x36842d);if(_0x176885[_0xccf6('0xa1')]===-0x1){return _0x176885;}var _0x2f6b8c=this[_0xccf6('0xa0')](_0xccf6('0xaf'),_0xccf6('0xb0'));if(_0x2f6b8c[_0xccf6('0xa1')]===-0x1){return _0x2f6b8c;}var _0x5006fa=this[_0xccf6('0xa0')]('RECOG_INPUT()',_0xccf6('0xb1'));if(_0x5006fa[_0xccf6('0xa1')]===-0x1){return _0x5006fa;}var _0x33973a=this[_0xccf6('0xa0')](_0xccf6('0xb2'),_0xccf6('0xb3'));if(_0x33973a[_0xccf6('0xa1')]===-0x1){return _0x33973a;}return this['channel'][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0xb4'),_0x36842d));};AGIVertices[_0xccf6('0x11')][_0xccf6('0x8')]=function(_0xe6523d){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0xb5'),_0xe6523d['label']));return this[_0xccf6('0xe')][_0xccf6('0x8')]([_0xe6523d['command'],_0xe6523d[_0xccf6('0xb6')]]);};AGIVertices['prototype'][_0xccf6('0xb7')]=function(_0xafb517){logger[_0xccf6('0x2e')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0xafb517[_0xccf6('0x3a')]));if(this[_0xccf6('0xa8')](_0xafb517['timeout'])){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')]('Wait\x20%s\x20seconds\x20before\x20answer',_0xafb517[_0xccf6('0x62')]));var _0x27c8d4=this[_0xccf6('0xe')][_0xccf6('0xb8')](_0xafb517[_0xccf6('0x62')]);if(_0x27c8d4[_0xccf6('0xa1')]===-0x1){return _0x27c8d4;}}return this[_0xccf6('0xe')]['answer']();};AGIVertices[_0xccf6('0x11')]['callback']=function(_0x17dfe7){logger['info'](util[_0xccf6('0x29')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x17dfe7[_0xccf6('0x3a')]));if(!this['isConfigured'](_0x17dfe7[_0xccf6('0x47')])){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x17dfe7,_0xccf6('0xb9'));}_0x17dfe7[_0xccf6('0x48')]=moment();if(this[_0xccf6('0xa8')](_0x17dfe7[_0xccf6('0xba')])){_0x17dfe7['scheduledAt']=moment()[_0xccf6('0xbb')](_0x17dfe7[_0xccf6('0xba')],_0xccf6('0xbc'));}if(!this[_0xccf6('0xa8')](_0x17dfe7[_0xccf6('0xbd')])){_0x17dfe7[_0xccf6('0xbd')]=0x2;}this[_0xccf6('0x41')][_0xccf6('0x6d')](this,_0x17dfe7);return this[_0xccf6('0xe')][_0xccf6('0xa6')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x17dfe7[_0xccf6('0x46')],_0x17dfe7[_0xccf6('0x47')],_0x17dfe7[_0xccf6('0x48')]));};AGIVertices[_0xccf6('0x11')][_0xccf6('0xbe')]=function(_0x505eed){logger['info'](util[_0xccf6('0x29')](_0xccf6('0xbf'),_0x505eed[_0xccf6('0x3a')]));var _0x4c0309=this[_0xccf6('0xe')][_0xccf6('0xa9')](_0x505eed[_0xccf6('0xc0')],_0x505eed['options']);if(_0x4c0309[_0xccf6('0xa1')]===-0x1){return _0x4c0309;}return this[_0xccf6('0xe')][_0xccf6('0xa6')](util['format'](_0xccf6('0xc1'),_0x505eed[_0xccf6('0xc0')],_0x505eed[_0xccf6('0x77')]));};AGIVertices[_0xccf6('0x11')]['lumenvoxtts']=function(_0x3945c3){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0xc2'),_0x3945c3[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x3945c3['text'])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0xa7'));}var _0x51a579='\x22'+_0x3945c3[_0xccf6('0x59')]+'\x22';if(this[_0xccf6('0xa8')](_0x3945c3[_0xccf6('0x77')])){_0x51a579+=','+_0x3945c3['options'];}var _0x6fed22=this['channel']['exec']('MRCPSynth',_0x51a579);if(_0x6fed22[_0xccf6('0xa1')]===-0x1){return _0x6fed22;}return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0xaa'),_0x51a579));};AGIVertices[_0xccf6('0x11')][_0xccf6('0xc3')]=function(_0x22a140){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0xc4'),_0x22a140['label']));if(!this[_0xccf6('0xa8')](_0x22a140[_0xccf6('0x59')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0xa7'));}var _0x4c146f='\x22'+_0x22a140[_0xccf6('0x59')]+'\x22';if(this['isConfigured'](_0x22a140[_0xccf6('0x77')])){_0x4c146f+=','+_0x22a140[_0xccf6('0x77')];}var _0x507668=this['channel']['exec'](_0xccf6('0xc5'),_0x4c146f);if(_0x507668[_0xccf6('0xa1')]===-0x1){return _0x507668;}return this[_0xccf6('0xe')][_0xccf6('0xa6')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x4c146f));};AGIVertices['prototype'][_0xccf6('0xc6')]=function(_0x5bd497){logger['info'](util[_0xccf6('0x29')](_0xccf6('0xc7'),_0x5bd497['label']));if(!this[_0xccf6('0xa8')](_0x5bd497[_0xccf6('0xac')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0xad'));}var _0x5b76f2=_0x5bd497[_0xccf6('0xac')];if(this[_0xccf6('0xa8')](_0x5bd497[_0xccf6('0x77')])){_0x5b76f2+=','+_0x5bd497[_0xccf6('0x77')];}var _0x3749b5=this['channel'][_0xccf6('0xa9')](_0xccf6('0xae'),_0x5b76f2);if(_0x3749b5[_0xccf6('0xa1')]===-0x1){return _0x3749b5;}var _0xf5904c=this[_0xccf6('0xa0')](_0xccf6('0xaf'),_0xccf6('0xc8'));if(_0xf5904c[_0xccf6('0xa1')]===-0x1){return _0xf5904c;}var _0x2c6e5f=this[_0xccf6('0xa0')](_0xccf6('0xc9'),_0xccf6('0xca'));if(_0x2c6e5f[_0xccf6('0xa1')]===-0x1){return _0x2c6e5f;}var _0x184c5b=this[_0xccf6('0xa0')]('RECOG_INSTANCE()',_0xccf6('0xcb'));if(_0x184c5b[_0xccf6('0xa1')]===-0x1){return _0x184c5b;}return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5b76f2));};AGIVertices[_0xccf6('0x11')][_0xccf6('0xcc')]=function(_0x2afc4e){logger['info'](util[_0xccf6('0x29')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x2afc4e['label']));if(!this[_0xccf6('0xa8')](_0x2afc4e[_0xccf6('0xac')])){return this[_0xccf6('0xe')]['noop']('no\x20grammar\x20configured');}var _0x14bdb0=_0x2afc4e[_0xccf6('0xac')];if(this['isConfigured'](_0x2afc4e[_0xccf6('0x77')])){_0x14bdb0+=','+_0x2afc4e[_0xccf6('0x77')];}var _0xe8792=this[_0xccf6('0xe')]['exec'](_0xccf6('0xae'),_0x14bdb0);if(_0xe8792[_0xccf6('0xa1')]===-0x1){return _0xe8792;}var _0x24173e=this['getAndSetVariable'](_0xccf6('0xaf'),'SESTEK_ASR_CONFIDENCE');if(_0x24173e['result']===-0x1){return _0x24173e;}var _0x49bced=this['getAndSetVariable'](_0xccf6('0xc9'),'SESTEK_ASR_TRANSCRIPT');if(_0x49bced[_0xccf6('0xa1')]===-0x1){return _0x49bced;}var _0x5b7c96=this[_0xccf6('0xa0')](_0xccf6('0xb2'),_0xccf6('0xcd'));if(_0x5b7c96['result']===-0x1){return _0x5b7c96;}return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x14bdb0));};AGIVertices[_0xccf6('0x11')]['database']=function(_0x14d8ce){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x14d8ce[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x14d8ce[_0xccf6('0xce')])){return this[_0xccf6('0xe')]['error'](_0x14d8ce,_0xccf6('0xcf'));}var _0x3bffb8=this['getSquareOdbc']['sync'](this,_0x14d8ce[_0xccf6('0xce')]);if(!_0x3bffb8){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x14d8ce,_0xccf6('0xd0'));}if(!this[_0xccf6('0xa8')](_0x14d8ce[_0xccf6('0x2f')])){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x14d8ce,_0xccf6('0xd1'));}var _0x39adc2=_0x14d8ce[_0xccf6('0x2f')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')]('query:\x20%s',_0x39adc2));var _0x168edc=this[_0xccf6('0x2b')][_0xccf6('0x6d')](this,_0x3bffb8,_0x39adc2);this[_0xccf6('0x38')][_0xccf6('0x6d')](this,_0x14d8ce,_0x39adc2);if(!this[_0xccf6('0xa8')](_0x14d8ce[_0xccf6('0xd2')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x15ecb7=this[_0xccf6('0x12')][_0xccf6('0x6d')](this,_0x14d8ce[_0xccf6('0xd2')]);if(!_0x15ecb7){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x14d8ce,_0xccf6('0xd3'));}var _0x1ffb3c=this;_0x168edc[_0xccf6('0xd4')](function(_0x38ab32,_0x2e7126){Object[_0xccf6('0xd5')](_0x38ab32)[_0xccf6('0xd4')](function(_0x4d5070){_0x1ffb3c[_0xccf6('0xe')][_0xccf6('0x9a')](util['format'](_0xccf6('0xd6'),_0x15ecb7,_0x2e7126,_0x4d5070),_0x38ab32[_0x4d5070]);});});this[_0xccf6('0xe')][_0xccf6('0x9a')](util[_0xccf6('0x29')](_0xccf6('0xd7'),_0x15ecb7),_0x168edc[_0xccf6('0x96')]);return this[_0xccf6('0xe')]['noop'](util[_0xccf6('0x29')](_0xccf6('0xd8'),_0x15ecb7));};AGIVertices[_0xccf6('0x11')][_0xccf6('0xd9')]=function(_0x106b1b){logger[_0xccf6('0xda')](util[_0xccf6('0x29')](_0xccf6('0xdb'),_0x106b1b[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x106b1b['sip_id'])){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x106b1b,_0xccf6('0xdc'));}var _0x3c0783=this[_0xccf6('0xdd')][_0xccf6('0x6d')](this,_0x106b1b[_0xccf6('0xde')]);if(!_0x3c0783){return this[_0xccf6('0xe')]['error'](_0x106b1b,_0xccf6('0xdf'));}var _0x263a5e=this[_0xccf6('0xe')][_0xccf6('0xa9')](_0xccf6('0xe0'),[util[_0xccf6('0x29')](_0xccf6('0xe1'),_0x3c0783),_0x106b1b[_0xccf6('0x62')],_0x106b1b[_0xccf6('0xe2')],_0x106b1b['url']]);if(_0x263a5e[_0xccf6('0xa1')]===-0x1){return _0x263a5e;}return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')]('Executed\x20command\x20%s',_0xccf6('0xe0')));};AGIVertices['prototype'][_0xccf6('0xe3')]=function(_0x2a7331){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0xe4'),_0x2a7331['label']));if(!this[_0xccf6('0xa8')](_0x2a7331[_0xccf6('0x79')])){return this['channel'][_0xccf6('0xa6')](_0xccf6('0xe5'));}if(!this[_0xccf6('0xa8')](_0x2a7331[_0xccf6('0x59')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')]('no\x20text\x20configured');}this[_0xccf6('0xe')][_0xccf6('0xe6')]=!![];this['createSquareDetailsReport'](_0x2a7331);this[_0xccf6('0xe7')](_0x2a7331[_0xccf6('0x59')],'in','','');this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0xe8'),_0x2a7331['text']));var _0x265a02=this[_0xccf6('0x78')]['sync'](this,_0x2a7331);if(_0x265a02){for(var _0x161018 in _0x265a02){if(_0x265a02['hasOwnProperty'](_0x161018)){this['channel']['setVariable'](util['format'](_0xccf6('0xe9'),_0x161018[_0xccf6('0x67')]()),_0x265a02[_0x161018]);}}this[_0xccf6('0xe7')](_0x265a02[_0xccf6('0xea')],'out',_0xccf6('0xe3'),'');return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')]('Dialogflow\x20Result\x20%s',_0x265a02['speech']));}return this[_0xccf6('0xe')]['error'](_0x2a7331,_0xccf6('0xeb'));};AGIVertices[_0xccf6('0x11')][_0xccf6('0xec')]=function(_0x52ba3c){logger['info'](util['format'](_0xccf6('0xed'),_0x52ba3c['label']));if(!this[_0xccf6('0xa8')](_0x52ba3c['dialogflowV2_project_id'])){return this[_0xccf6('0xe')]['noop']('no\x20project_id\x20configured');}if(!this[_0xccf6('0xa8')](_0x52ba3c[_0xccf6('0x7d')])){return this['channel'][_0xccf6('0xa6')](_0xccf6('0xee'));}if(!this[_0xccf6('0xa8')](_0x52ba3c[_0xccf6('0x7e')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')]('no\x20private_key\x20configured');}if(!this[_0xccf6('0xa8')](_0x52ba3c['dialogflowV2_language'])){return this['channel'][_0xccf6('0xa6')](_0xccf6('0xef'));}if(!this[_0xccf6('0xa8')](_0x52ba3c[_0xccf6('0x59')])){return this[_0xccf6('0xe')]['noop'](_0xccf6('0xa7'));}this[_0xccf6('0xe')][_0xccf6('0xe6')]=!![];this['createSquareDetailsReport'](_0x52ba3c);this['createSquareMessage'](_0x52ba3c[_0xccf6('0x59')],'in','','');this[_0xccf6('0xe')]['noop'](util[_0xccf6('0x29')](_0xccf6('0xf0'),_0x52ba3c[_0xccf6('0x59')]));var _0x34e4d1=this['googleDialogflowV2'][_0xccf6('0x6d')](this,_0x52ba3c);if(_0x34e4d1){for(var _0x1317da in _0x34e4d1){if(_0x34e4d1[_0xccf6('0x95')](_0x1317da)){if(_0x1317da!==_0xccf6('0xf1')){this[_0xccf6('0xe')][_0xccf6('0x9a')](util[_0xccf6('0x29')](_0xccf6('0xe9'),_0x1317da[_0xccf6('0x67')]()),_0x34e4d1[_0x1317da]);}}}this['createSquareMessage'](_0x34e4d1[_0xccf6('0xea')],_0xccf6('0xf2'),_0xccf6('0xec'),_0x34e4d1['providerResponse']);return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')]('DialogflowV2\x20Result\x20%s',_0x34e4d1[_0xccf6('0xea')]));}return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x52ba3c,_0xccf6('0xf3'));};AGIVertices[_0xccf6('0x11')]['sesteknda']=function(_0x197575){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0xf4'),_0x197575[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x197575[_0xccf6('0xf5')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xccf6('0xa8')](_0x197575['username'])){return this[_0xccf6('0xe')][_0xccf6('0xa6')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x197575[_0xccf6('0xf6')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')]('no\x20password\x20configured');}if(!this[_0xccf6('0xa8')](_0x197575[_0xccf6('0xf7')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0xa7'));}this[_0xccf6('0xe')][_0xccf6('0xe6')]=!![];this[_0xccf6('0x38')](_0x197575);this[_0xccf6('0xe7')](_0x197575[_0xccf6('0x59')],'in','','');this[_0xccf6('0xe')][_0xccf6('0xa6')](util['format'](_0xccf6('0xf8'),_0x197575[_0xccf6('0x59')]));var _0x516dbc=this[_0xccf6('0x80')][_0xccf6('0x6d')](this,_0x197575);if(_0x516dbc){for(var _0x40d526 in _0x516dbc){if(_0x516dbc[_0xccf6('0x95')](_0x40d526)){this['channel'][_0xccf6('0x9a')](util['format'](_0xccf6('0xf9'),_0x40d526[_0xccf6('0x67')]()),_0x516dbc[_0x40d526]);}}this['createSquareMessage'](_0x516dbc[_0xccf6('0xea')],_0xccf6('0xf2'),_0xccf6('0xfa'),'');if(_0x516dbc[_0xccf6('0xfb')]){this[_0xccf6('0xe')][_0xccf6('0xa6')](util['format'](_0xccf6('0xfc'),_0x516dbc['audiofile']));var _0x5e42b9=this[_0xccf6('0xe')][_0xccf6('0xfd')](_0x516dbc['audiofile']);try{fs[_0xccf6('0xfe')](_0x516dbc[_0xccf6('0xfb')]+'.wav');}catch(_0x1ec3a9){logger['error'](_0x1ec3a9);}return _0x5e42b9;}else{return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0xff'),_0x516dbc[_0xccf6('0xea')]));}}return this[_0xccf6('0xe')]['error'](_0x197575,_0xccf6('0x100'));};AGIVertices['prototype'][_0xccf6('0x101')]=function(_0x433f3d){logger['info'](util[_0xccf6('0x29')](_0xccf6('0x102'),_0x433f3d[_0xccf6('0x3a')]));return this['channel'][_0xccf6('0xa6')]('end');};AGIVertices[_0xccf6('0x11')][_0xccf6('0x103')]=function(_0x3b4d51){logger[_0xccf6('0x2e')](util['format'](_0xccf6('0x104'),_0x3b4d51[_0xccf6('0x3a')]));var _0x5b10a7='';if(_0x3b4d51[_0xccf6('0x105')]){if(!this[_0xccf6('0xa8')](_0x3b4d51['trunk_id'])){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x3b4d51,'no\x20trunk\x20selected');}else{var _0x2e9b8d=parseInt(_0x3b4d51[_0xccf6('0x105')],0xa);if(isNaN(_0x2e9b8d)){_0x5b10a7=_0x3b4d51['trunk_id'];}else{_0x5b10a7=this[_0xccf6('0x106')][_0xccf6('0x6d')](this,_0x3b4d51['trunk_id']);if(!_0x5b10a7){return this['channel'][_0xccf6('0x33')](_0x3b4d51,'no\x20trunk\x20found');}}}}else if(_0x3b4d51[_0xccf6('0x107')]){_0x5b10a7=_0x3b4d51[_0xccf6('0x107')];}else{return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x3b4d51,_0xccf6('0x108'));}var _0x1f6b08=this[_0xccf6('0xe')][_0xccf6('0xa9')](_0xccf6('0xe0'),[util[_0xccf6('0x29')](_0xccf6('0x109'),_0x5b10a7,_0x3b4d51[_0xccf6('0x46')]),_0x3b4d51[_0xccf6('0x62')],_0x3b4d51[_0xccf6('0xe2')],_0x3b4d51['url']]);if(_0x1f6b08['result']===-0x1){return _0x1f6b08;}return this[_0xccf6('0xe')]['noop'](util[_0xccf6('0x29')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xccf6('0x11')]['finally']=function(_0x319c55){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x10a'),_0x319c55[_0xccf6('0x3a')]));return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0x10b'));};AGIVertices[_0xccf6('0x11')][_0xccf6('0xc')]=function(_0x2d5c6e){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x2d5c6e['label']));if(_0x2d5c6e[_0xccf6('0xa3')]===0x0){return this[_0xccf6('0xa2')](_0x2d5c6e);}_0x2d5c6e[_0xccf6('0xa3')]-=0x1;if(!this['isConfigured'](_0x2d5c6e['file_id'])){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x2d5c6e,_0xccf6('0x10c'));}var _0x3c4d27=this[_0xccf6('0x10d')]['sync'](this,_0x2d5c6e[_0xccf6('0x10e')]);if(!_0x3c4d27){return this['channel'][_0xccf6('0x33')](_0x2d5c6e,_0xccf6('0x10f'));}if(!this['isConfigured'](_0x2d5c6e[_0xccf6('0xd2')])){return this[_0xccf6('0xe')]['error'](_0xccf6('0x110'));}var _0xf75737=this[_0xccf6('0xe')][_0xccf6('0x111')](_0x3c4d27,_0x2d5c6e[_0xccf6('0x112')],_0x2d5c6e[_0xccf6('0x113')]);var _0x56f75b=_0xf75737['result']?_0xf75737[_0xccf6('0xa1')][_0xccf6('0x9f')]():'';logger['info'](_0xccf6('0x114'),JSON['stringify'](_0xf75737));if(_0xf75737[_0xccf6('0xa1')]===-0x1){this['createSquareDetailsReport'][_0xccf6('0x6d')](this,_0x2d5c6e,_0x56f75b);return _0xf75737;}else if(_0xf75737['extra']===_0xccf6('0x62')){_0xf75737[_0xccf6('0xa1')]=_0x56f75b['length']>=parseInt(_0x2d5c6e['mindigit'])?'x':'i';}else{_0xf75737[_0xccf6('0xa1')]=_0x56f75b[_0xccf6('0x96')]>=parseInt(_0x2d5c6e[_0xccf6('0x115')])&&_0x56f75b['length']<=parseInt(_0x2d5c6e['maxdigit'])?'x':'i';}var _0x454119=this['getVariable'][_0xccf6('0x6d')](this,_0x2d5c6e['variable_id']);if(!_0x454119){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x2d5c6e,_0xccf6('0xd3'));}this[_0xccf6('0xe')][_0xccf6('0x9a')](_0x454119,_0x56f75b);if(this[_0xccf6('0xa8')](_0x2d5c6e[_0xccf6('0x116')])){var _0x2c96cf=parseInt(_0x2d5c6e[_0xccf6('0x116')],0xa);var _0x2714ce=rs['generate']({'charset':'*','length':_0x2c96cf});var _0x2cd61b=_0x56f75b[_0xccf6('0x96')];if(_0x2cd61b>0x0){if(_0x2cd61b>_0x2c96cf){this[_0xccf6('0x38')][_0xccf6('0x6d')](this,_0x2d5c6e,_0x2d5c6e[_0xccf6('0x117')]===_0xccf6('0x118')?_0x2714ce+_0x56f75b[_0xccf6('0x119')](_0x2c96cf):_0x56f75b[_0xccf6('0x119')](0x0,_0x2cd61b-_0x2c96cf)+_0x2714ce);}else{this[_0xccf6('0x38')][_0xccf6('0x6d')](this,_0x2d5c6e,rs[_0xccf6('0x11a')]({'charset':'*','length':_0x2cd61b}));}}else{this['createSquareDetailsReport']['sync'](this,_0x2d5c6e,'');}}else{this['createSquareDetailsReport'][_0xccf6('0x6d')](this,_0x2d5c6e,_0x56f75b);}return _0xf75737;};AGIVertices[_0xccf6('0x11')]['getsecretdigits']=function(_0x2e3aad){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x11b'),_0x2e3aad[_0xccf6('0x3a')]));return this[_0xccf6('0xc')](_0x2e3aad);};AGIVertices['prototype'][_0xccf6('0x11c')]=function(_0x5c54f6){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x5c54f6[_0xccf6('0x3a')]));this[_0xccf6('0x38')][_0xccf6('0x6d')](this,_0x5c54f6,_0x5c54f6[_0xccf6('0x11d')]);return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x11e'),_0x5c54f6[_0xccf6('0x11d')]));};AGIVertices['prototype'][_0xccf6('0x11f')]=function(_0x2c3813){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x120'),_0x2c3813[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x2c3813[_0xccf6('0x86')])||!this[_0xccf6('0xa8')](_0x2c3813[_0xccf6('0x87')])){return this[_0xccf6('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2c3813[_0xccf6('0x59')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0xa7'));}this['channel'][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x121'),_0x2c3813[_0xccf6('0x59')]));var _0x24cf15=this['awsPolly'][_0xccf6('0x6d')](this,_0x2c3813);if(_0x24cf15){this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x122'),_0x24cf15));var _0x1e5287=this[_0xccf6('0xe')][_0xccf6('0xfd')](_0x24cf15);try{fs[_0xccf6('0xfe')](_0x24cf15+_0xccf6('0x123'));}catch(_0x23aa17){logger['error'](_0x23aa17);}return _0x1e5287;}return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x2c3813,_0xccf6('0x124'));};AGIVertices[_0xccf6('0x11')][_0xccf6('0x125')]=function(_0x3d60ef){logger['info'](util[_0xccf6('0x29')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x3d60ef[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x3d60ef[_0xccf6('0x86')])||!this['isConfigured'](_0x3d60ef[_0xccf6('0x87')])){return this[_0xccf6('0xe')]['noop'](_0xccf6('0x126'));}if(!this[_0xccf6('0xa8')](_0x3d60ef[_0xccf6('0x8b')])){return this['channel'][_0xccf6('0xa6')](_0xccf6('0x127'));}if(!this[_0xccf6('0xa8')](_0x3d60ef[_0xccf6('0x59')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')]('no\x20text\x20configured');}this[_0xccf6('0xe')][_0xccf6('0xe6')]=!![];this[_0xccf6('0x38')](_0x3d60ef);this[_0xccf6('0xe7')](_0x3d60ef['text'],'in','','');this['channel']['noop'](util[_0xccf6('0x29')](_0xccf6('0x128'),_0x3d60ef[_0xccf6('0x59')]));var _0x217256=this['awsLex'][_0xccf6('0x6d')](this,_0x3d60ef);if(_0x217256){for(var _0x16c59b in _0x217256){if(_0x217256[_0xccf6('0x95')](_0x16c59b)&&_['isString'](_0x217256[_0x16c59b])){this[_0xccf6('0xe')][_0xccf6('0x9a')](util[_0xccf6('0x29')]('AWS_LEX_%s',_0x16c59b['toUpperCase']()),_0x217256[_0x16c59b]);}}if(_['isNil'](_0x217256[_0xccf6('0x75')])){return this['channel'][_0xccf6('0xa6')](_0xccf6('0x129'));}else{this[_0xccf6('0xe7')](_0x217256['message'],_0xccf6('0xf2'),'amazonlex','');return this[_0xccf6('0xe')][_0xccf6('0xa6')](util['format'](_0xccf6('0x12a'),_0x217256[_0xccf6('0x75')]));}}return this[_0xccf6('0xe')]['error'](_0x3d60ef,_0xccf6('0x12b'));};AGIVertices[_0xccf6('0x11')]['googleasr']=function(_0x4a862c){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x12c'),_0x4a862c['label'],_0x4a862c[_0xccf6('0x62')]));if(!this[_0xccf6('0xa8')](_0x4a862c[_0xccf6('0x79')])){return this['channel']['noop'](_0xccf6('0xe5'));}var _0x338909=_0xccf6('0x12d');var _0x3f4a98=util[_0xccf6('0x29')](_0xccf6('0x12e'),FILES_PATH,rs[_0xccf6('0x11a')](0x4));var _0x34685f=util[_0xccf6('0x29')]('%s.%s',_0x3f4a98,_0x338909);var _0x4717ec=!![];if(_0x4a862c[_0xccf6('0x12f')]===_0xccf6('0x130')){_0x4717ec=![];}var _0x379610=this[_0xccf6('0xe')][_0xccf6('0x131')](_0x3f4a98,_0x338909,_0x4a862c[_0xccf6('0x132')],_0x4a862c[_0xccf6('0x62')],undefined,_0x4717ec);if(_0x379610['result']!==-0x1){this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x133'),_0x34685f));var _0x9bc05d=this[_0xccf6('0x8c')][_0xccf6('0x6d')](this,_0x4a862c,_0x34685f);if(_0x9bc05d){for(var _0x59a8f2 in _0x9bc05d){if(_0x9bc05d[_0xccf6('0x95')](_0x59a8f2)){this[_0xccf6('0xe')][_0xccf6('0x9a')](util[_0xccf6('0x29')](_0xccf6('0x134'),_0x59a8f2['toUpperCase']()),_0x9bc05d[_0x59a8f2]);}}return this[_0xccf6('0xe')]['noop'](util[_0xccf6('0x29')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x9bc05d)));}}return _0x379610;};AGIVertices[_0xccf6('0x11')][_0xccf6('0x135')]=function(_0x223489){logger[_0xccf6('0x2e')](util['format'](_0xccf6('0x136'),_0x223489[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x223489[_0xccf6('0x8f')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0x137'));}if(!this[_0xccf6('0xa8')](_0x223489[_0xccf6('0x138')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0x139'));}var _0x43f264=_0xccf6('0x12d');var _0x31f494=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x165b54=util['format'](_0xccf6('0x98'),_0x31f494,_0x43f264);var _0x558f0b=!![];if(_0x223489['beep']==='NOBEEP'){_0x558f0b=![];}var _0x2cf349=this[_0xccf6('0xe')][_0xccf6('0x131')](_0x31f494,_0x43f264,_0x223489[_0xccf6('0x132')],_0x223489[_0xccf6('0x62')],undefined,_0x558f0b);if(_0x2cf349[_0xccf6('0xa1')]!==-0x1){this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x13a'),_0x165b54));var _0x285e74=this[_0xccf6('0x8e')][_0xccf6('0x6d')](this,_0x223489,_0x165b54);if(_0x285e74){for(var _0x264de4 in _0x285e74){if(_0x285e74[_0xccf6('0x95')](_0x264de4)){this[_0xccf6('0xe')][_0xccf6('0x9a')](util['format']('TILDE_ASR_%s',_0x264de4[_0xccf6('0x67')]()),_0x285e74[_0x264de4]);}}return this[_0xccf6('0xe')]['noop'](util[_0xccf6('0x29')]('TildeASR\x20Result\x20%s',JSON[_0xccf6('0x71')](_0x285e74)));}}return _0x2cf349;};AGIVertices['prototype'][_0xccf6('0x13b')]=function(_0x18c4b7){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x13c'),_0x18c4b7['label']));return this[_0xccf6('0xe')][_0xccf6('0x13d')](_0x18c4b7['context'],_0x18c4b7[_0xccf6('0x13e')],_0x18c4b7[_0xccf6('0x3f')]);};AGIVertices[_0xccf6('0x11')]['gotoif']=function(_0x27115b){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x13f'),_0x27115b['label']));if(!this[_0xccf6('0xa8')](_0x27115b[_0xccf6('0x140')])){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x27115b,'no\x20condition\x20configured');}try{var _0x1e18c9=eval(_0x27115b[_0xccf6('0x140')])?_0xccf6('0x141'):_0xccf6('0x142');this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x143'),_0x27115b[_0xccf6('0x140')],_0x1e18c9));return{'code':0xc8,'result':_0x1e18c9};}catch(_0x5c2e57){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xccf6('0x11')][_0xccf6('0x144')]=function(_0x1c3729){logger[_0xccf6('0x2e')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1c3729['label']));if(!this[_0xccf6('0xa8')](_0x1c3729[_0xccf6('0x145')])){return this['channel'][_0xccf6('0x33')](_0x1c3729,_0xccf6('0x146'));}var _0x23998b=this[_0xccf6('0x23')]['sync'](this,_0x1c3729[_0xccf6('0x145')]);if(!_0x23998b){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x1c3729,_0xccf6('0x147'));}for(var _0x40d6f3=0x0;_0x40d6f3<_0x23998b[_0xccf6('0x96')];_0x40d6f3+=0x1){var _0xedbd81=this['channel'][_0xccf6('0x12')](util['format']('IFTIME(%s?true:false)',_0x23998b[_0x40d6f3]));if(_0xedbd81['result']===-0x1){return _0xedbd81;}logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x148'),_0x23998b[_0x40d6f3],_0xedbd81[_0xccf6('0x9e')]));if(_0xedbd81[_0xccf6('0x9e')]===_0xccf6('0x141')){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')]('IFTIME\x20%s\x20%s',_0x23998b[_0x40d6f3],_0xccf6('0x141')));this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x148'),_0x23998b[_0x40d6f3],_0xccf6('0x141')));return{'code':0xc8,'result':_0xccf6('0x141')};}else{logger[_0xccf6('0x2e')](util['format'](_0xccf6('0x148'),_0x23998b[_0x40d6f3],'false'));this['channel'][_0xccf6('0xa6')](util['format'](_0xccf6('0x148'),_0x23998b[_0x40d6f3],'false'));}}return{'code':0xc8,'result':_0xccf6('0x142')};};AGIVertices[_0xccf6('0x11')][_0xccf6('0x149')]=function(_0x4fbf2d){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x14a'),_0x4fbf2d[_0xccf6('0x3a')]));return this['channel']['hangup']();};AGIVertices[_0xccf6('0x11')]['ispeechasr']=function(_0x3fae7a){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x14b'),_0x3fae7a[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x3fae7a[_0xccf6('0x79')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')]('no\x20key\x20configured');}var _0xdc9d55=_0xccf6('0x12d');var _0x3c9141=util[_0xccf6('0x29')](_0xccf6('0x12e'),FILES_PATH,rs[_0xccf6('0x11a')](0x4));var _0x1c2c19=util[_0xccf6('0x29')]('%s.%s',_0x3c9141,_0xdc9d55);var _0x26bc58=!![];if(_0x3fae7a[_0xccf6('0x12f')]==='NOBEEP'){_0x26bc58=![];}var _0x568b83=this[_0xccf6('0xe')][_0xccf6('0x131')](_0x3c9141,_0xdc9d55,_0x3fae7a['intKey'],_0x3fae7a[_0xccf6('0x62')],undefined,_0x26bc58);if(_0x568b83[_0xccf6('0xa1')]!==-0x1){this[_0xccf6('0xe')]['noop'](util[_0xccf6('0x29')](_0xccf6('0x14c'),_0x1c2c19));var _0x4b2e61=this['ispeechASR'][_0xccf6('0x6d')](this,_0x3fae7a,_0x1c2c19);if(_0x4b2e61){for(var _0x4fb4c4 in _0x4b2e61){if(_0x4b2e61[_0xccf6('0x95')](_0x4fb4c4)){this['channel']['setVariable'](util['format']('ISPEECH_ASR_%s',_0x4fb4c4[_0xccf6('0x67')]()),_0x4b2e61[_0x4fb4c4]);}}return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x14d'),JSON['stringify'](_0x4b2e61)));}}return _0x568b83;};AGIVertices[_0xccf6('0x11')][_0xccf6('0x14e')]=function(_0x4b1041){logger[_0xccf6('0x2e')](util['format'](_0xccf6('0x14f'),_0x4b1041[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x4b1041[_0xccf6('0x79')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0xe5'));}if(!this['isConfigured'](_0x4b1041[_0xccf6('0x59')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0xa7'));}this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x150'),_0x4b1041[_0xccf6('0x59')]));var _0x59597b=this[_0xccf6('0x81')][_0xccf6('0x6d')](this,_0x4b1041);if(_0x59597b){this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')]('ispeech\x20%s\x20file\x20created',_0x59597b));var _0x325469=this['channel'][_0xccf6('0xfd')](_0x59597b,_0x4b1041[_0xccf6('0x132')]);try{fs[_0xccf6('0xfe')](_0x59597b+_0xccf6('0x123'));}catch(_0x302e99){logger[_0xccf6('0x33')](_0x302e99);}return _0x325469;}return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x4b1041,_0xccf6('0x151'));};AGIVertices['prototype'][_0xccf6('0x152')]=function(_0xab32e4){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x153'),_0xab32e4[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0xab32e4[_0xccf6('0x154')])){return this['channel'][_0xccf6('0x33')](_0xab32e4,_0xccf6('0x155'));}logger[_0xccf6('0x2e')](util['format'](_0xccf6('0x156'),this[_0xccf6('0xe')]['callerid'],_0xab32e4[_0xccf6('0x154')]));var _0x51ef99=this[_0xccf6('0x4f')]['sync'](this,_0xab32e4[_0xccf6('0x154')]);if(_0x51ef99){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xccf6('0xe')][_0xccf6('0x3d')],_0xab32e4[_0xccf6('0x154')]));this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x157'),this['channel'][_0xccf6('0x3d')],_0xab32e4[_0xccf6('0x154')]));return{'code':0xc8,'result':'success'};}else{logger[_0xccf6('0x2e')](util[_0xccf6('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xccf6('0x3d')],_0xab32e4[_0xccf6('0x154')]));this['channel'][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x158'),this[_0xccf6('0xe')][_0xccf6('0x3d')],_0xab32e4[_0xccf6('0x154')]));return{'code':0xc8,'result':_0xccf6('0x159')};}};AGIVertices[_0xccf6('0x11')]['logout']=function(_0x32c003){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x15a'),_0x32c003[_0xccf6('0x3a')]));if(!this['isConfigured'](_0x32c003['findBy'])){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x32c003,_0xccf6('0x155'));}logger['info'](util[_0xccf6('0x29')](_0xccf6('0x156'),this[_0xccf6('0xe')][_0xccf6('0x3d')],_0x32c003['findBy']));var _0x149cc7=this[_0xccf6('0x4e')]['sync'](this,_0x32c003[_0xccf6('0x154')]);if(_0x149cc7){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x157'),this[_0xccf6('0xe')][_0xccf6('0x3d')],_0x32c003[_0xccf6('0x154')]));this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xccf6('0xe')][_0xccf6('0x3d')],_0x32c003[_0xccf6('0x154')]));return{'code':0xc8,'result':_0xccf6('0x15b')};}else{logger[_0xccf6('0x2e')](util[_0xccf6('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xccf6('0xe')][_0xccf6('0x3d')],_0x32c003[_0xccf6('0x154')]));this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x158'),this[_0xccf6('0xe')][_0xccf6('0x3d')],_0x32c003['findBy']));return{'code':0xc8,'result':_0xccf6('0x159')};}};AGIVertices['prototype'][_0xccf6('0x15c')]=function(_0x1911c1){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x15d'),_0x1911c1[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x1911c1[_0xccf6('0x15e')])){return this[_0xccf6('0xe')]['error'](_0x1911c1,_0xccf6('0x15f'));}this['channel'][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x160'),_0x1911c1[_0xccf6('0x15e')]));var _0x5cf7d7=eval(_0x1911c1[_0xccf6('0x15e')]);if(!this[_0xccf6('0xa8')](_0x1911c1[_0xccf6('0xd2')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0x110'));}var _0x40a8ca=this['getVariable'][_0xccf6('0x6d')](this,_0x1911c1['variable_id']);if(!_0x40a8ca){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x1911c1,_0xccf6('0xd3'));}if(_[_0xccf6('0x99')](_0x5cf7d7)){var _0x3bfaea=this;_0x5cf7d7[_0xccf6('0xd4')](function(_0x1543c2,_0x584031){_0x3bfaea['channel'][_0xccf6('0x9a')](util[_0xccf6('0x29')](_0xccf6('0x161'),_0x40a8ca,_0x584031),_0x1543c2);});return this['channel'][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x162'),_0x40a8ca));}else{return this['channel'][_0xccf6('0x9a')](_0x40a8ca,_0x5cf7d7);}};AGIVertices[_0xccf6('0x11')][_0xccf6('0x163')]=function(_0x22cab1){logger['info'](util[_0xccf6('0x29')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x22cab1[_0xccf6('0x3a')]));if(_0x22cab1[_0xccf6('0xa3')]===0x0){return this[_0xccf6('0xa2')](_0x22cab1);}_0x22cab1['retry']-=0x1;if(!this[_0xccf6('0xa8')](_0x22cab1[_0xccf6('0x10e')])){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x22cab1,_0xccf6('0x10c'));}var _0x276de6=this['getSound']['sync'](this,_0x22cab1[_0xccf6('0x10e')]);if(!_0x276de6){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x22cab1,_0xccf6('0x10f'));}var _0x447d97=this[_0xccf6('0xe')][_0xccf6('0x111')](_0x276de6,_0x22cab1[_0xccf6('0x112')],_0x22cab1[_0xccf6('0x164')]);var _0x262329=_0x447d97['result'];if(_0x447d97[_0xccf6('0xa1')]===-0x1){this[_0xccf6('0x38')][_0xccf6('0x6d')](this,_0x22cab1,'-1');return _0x447d97;}else if(_0x447d97['extra']===_0xccf6('0x62')){_0x447d97['result']=_0x447d97[_0xccf6('0xa1')][_0xccf6('0x96')]>0x0?_0x447d97[_0xccf6('0xa1')]:'t';}else if(_[_0xccf6('0x42')](_0x447d97[_0xccf6('0xa1')])){_0x447d97['result']='#';_0x262329='#';}if(!this['isConfigured'](_0x22cab1['variable_id'])){this[_0xccf6('0xe')]['noop'](_0xccf6('0x110'));}else{var _0xc7c14f=this[_0xccf6('0x12')][_0xccf6('0x6d')](this,_0x22cab1[_0xccf6('0xd2')]);if(!_0xc7c14f){return this['channel'][_0xccf6('0x33')](_0x22cab1,'no\x20variable\x20found');}this[_0xccf6('0xe')][_0xccf6('0x9a')](_0xc7c14f,_0x262329);}this[_0xccf6('0x38')][_0xccf6('0x6d')](this,_0x22cab1,_0x262329);return _0x447d97;};AGIVertices[_0xccf6('0x11')][_0xccf6('0xa6')]=function(_0x254f10){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x165'),_0x254f10['label']));return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0x254f10[_0xccf6('0x166')]||_0x254f10['label']);};AGIVertices[_0xccf6('0x11')]['pause']=function(_0x50e000){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x167'),_0x50e000[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x50e000[_0xccf6('0x154')])){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x50e000,'no\x20find\x20by\x20configured');}logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x156'),this[_0xccf6('0xe')][_0xccf6('0x3d')],_0x50e000['findBy']));var _0x83c9ff=this[_0xccf6('0x168')][_0xccf6('0x6d')](this,_0x50e000['pause_id']);var _0x42fd82=this[_0xccf6('0x4c')][_0xccf6('0x6d')](this,_0x50e000['findBy'],_0x83c9ff);if(_0x42fd82){logger['info'](util['format'](_0xccf6('0x157'),this[_0xccf6('0xe')][_0xccf6('0x3d')],_0x50e000['findBy']));this[_0xccf6('0xe')][_0xccf6('0xa6')](util['format'](_0xccf6('0x157'),this[_0xccf6('0xe')][_0xccf6('0x3d')],_0x50e000[_0xccf6('0x154')]));return{'code':0xc8,'result':_0xccf6('0x15b')};}else{logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x158'),this['channel'][_0xccf6('0x3d')],_0x50e000[_0xccf6('0x154')]));this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xccf6('0x3d')],_0x50e000[_0xccf6('0x154')]));return{'code':0xc8,'result':_0xccf6('0x159')};}};AGIVertices[_0xccf6('0x11')][_0xccf6('0x169')]=function(_0x454fd6){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x16a'),_0x454fd6[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x454fd6[_0xccf6('0x10e')])){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x454fd6,_0xccf6('0x10c'));}var _0x2ff3f5=this[_0xccf6('0x10d')][_0xccf6('0x6d')](this,_0x454fd6[_0xccf6('0x10e')]);if(!_0x2ff3f5){return this['channel']['error'](_0x454fd6,'no\x20file\x20audio\x20found');}var _0x59295e=this[_0xccf6('0xe')]['exec'](_0xccf6('0x16b'),[_0x2ff3f5,_0x454fd6[_0xccf6('0xe2')]]);if(_0x59295e[_0xccf6('0xa1')]===-0x1){return _0x59295e;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0xccf6('0x16b'),_0x2ff3f5));};AGIVertices[_0xccf6('0x11')][_0xccf6('0x16c')]=function(_0x5e1642){logger['info'](util['format'](_0xccf6('0x16d'),_0x5e1642['label']));if(!this[_0xccf6('0xa8')](_0x5e1642['queue_id'])){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x5e1642,'no\x20queue\x20selected');}var _0x2d085c='';var _0x296d5e=parseInt(_0x5e1642[_0xccf6('0x16e')],0xa);if(isNaN(_0x296d5e)){_0x2d085c=_0x5e1642[_0xccf6('0x16e')];}else{_0x2d085c=this[_0xccf6('0x16')][_0xccf6('0x6d')](this,_0x5e1642['queue_id']);if(!_0x2d085c){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x5e1642,_0xccf6('0x16f'));}}var _0x1ca791='';if(this[_0xccf6('0xa8')](_0x5e1642[_0xccf6('0x10e')])){var _0x34c728=this['getSound'][_0xccf6('0x6d')](this,_0x5e1642['file_id']);if(_0x34c728){_0x1ca791=_0x34c728;}}this[_0xccf6('0x38')][_0xccf6('0x6d')](this,_0x5e1642,_0x2d085c);if(_0x5e1642[_0xccf6('0xe2')][_0xccf6('0x170')]('x')<0x0){_0x5e1642[_0xccf6('0xe2')]+='x';}if(_0x5e1642['opts'][_0xccf6('0x170')]('X')<0x0){_0x5e1642[_0xccf6('0xe2')]+='X';}this[_0xccf6('0xe')][_0xccf6('0x9a')]('XMCS-QUEUE',_0x2d085c?_0x2d085c[_0xccf6('0x171')]():'');var _0x1a32eb=this[_0xccf6('0xe')][_0xccf6('0xa9')](_0xccf6('0x172'),[_0x2d085c,_0x5e1642[_0xccf6('0xe2')],_0x5e1642['url'],_0x1ca791,_0x5e1642[_0xccf6('0x62')],_0x5e1642[_0xccf6('0x8')],_0x5e1642[_0xccf6('0x173')],_0x5e1642['gosub'],'',_0x5e1642[_0xccf6('0x174')]]);if(_0x1a32eb[_0xccf6('0xa1')]===-0x1){return _0x1a32eb;}return this[_0xccf6('0xe')][_0xccf6('0xa6')](util['format'](_0xccf6('0xc1'),_0xccf6('0x172'),_0x2d085c));};AGIVertices[_0xccf6('0x11')][_0xccf6('0x175')]=function(_0x2088d5){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x2088d5['label']));var _0x4e63b3=_0x2088d5['recordingFormat']||_0xccf6('0x12d');var _0x3dce95=util[_0xccf6('0x29')](_0xccf6('0x176'),this['channel'][_0xccf6('0x39')],rs['generate'](0x5));var _0xc24e77=util[_0xccf6('0x29')](_0xccf6('0x177'),FILES_PATH,_0x3dce95,_0x4e63b3);var _0x512568=util['format'](_0xccf6('0x12e'),FILES_PATH,_0x3dce95);this['createSquareRecording'][_0xccf6('0x6d')](this,_0x2088d5,_0x3dce95,_0xc24e77);this['channel'][_0xccf6('0x9a')](_0xccf6('0x178'),_0x3dce95);logger[_0xccf6('0x2e')](_0xccf6('0x179'),_0x512568,_0x4e63b3,_0x2088d5[_0xccf6('0x17a')],_0x2088d5['timeout']);return this[_0xccf6('0xe')][_0xccf6('0x131')](_0x512568,_0x4e63b3,_0x2088d5['escape_digits'],_0x2088d5[_0xccf6('0x62')],undefined,!![]);};AGIVertices[_0xccf6('0x11')][_0xccf6('0x17b')]=function(_0x5e2b93){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x17c'),_0x5e2b93[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x5e2b93[_0xccf6('0x60')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0x17d'));}var _0x489494=this[_0xccf6('0x5f')][_0xccf6('0x6d')](this,_0x5e2b93);logger[_0xccf6('0x2e')](util['format']('Response:',util[_0xccf6('0x17e')](_0x489494,{'showHidden':![],'depth':null})));if(!this[_0xccf6('0xa8')](_0x5e2b93['variable_id'])){return this['channel'][_0xccf6('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x3d32f4=this[_0xccf6('0x12')][_0xccf6('0x6d')](this,_0x5e2b93['variable_id']);if(!_0x3d32f4){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x5e2b93,'no\x20variable\x20found');}this[_0xccf6('0xe')][_0xccf6('0x9a')](util[_0xccf6('0x29')](_0xccf6('0x17f'),_0x3d32f4),_0x489494['statusCode']?_0x489494[_0xccf6('0x74')]:_0xccf6('0x180'));this[_0xccf6('0xe')][_0xccf6('0x9a')](util['format']('%s_STATUS_MESSAGE',_0x3d32f4),_0x489494[_0xccf6('0x73')]?_0x489494[_0xccf6('0x73')]:'OK');if(_0x489494[_0xccf6('0x68')]){try{this[_0xccf6('0x97')](_0x489494[_0xccf6('0x68')],_0x3d32f4);}catch(_0x496dd8){logger[_0xccf6('0x33')](util[_0xccf6('0x29')](_0xccf6('0x181'),_0x3d32f4));}}return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0xd8'),_0x3d32f4));};AGIVertices[_0xccf6('0x11')][_0xccf6('0x182')]=function(_0x176678){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x183'),_0x176678[_0xccf6('0x3a')]));return this['channel']['sayDigits'](_0x176678[_0xccf6('0x184')][_0xccf6('0x55')](/\s+/g,''),_0x176678['escape_digits']);};AGIVertices[_0xccf6('0x11')]['saynumber']=function(_0x44de90){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x185'),_0x44de90[_0xccf6('0x3a')]));return this[_0xccf6('0xe')][_0xccf6('0x186')](_0x44de90['number'][_0xccf6('0x55')](/\s+/g,''),_0x44de90[_0xccf6('0x17a')]);};AGIVertices[_0xccf6('0x11')]['sayphonetic']=function(_0x4e3c43){logger[_0xccf6('0x2e')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x4e3c43['label']));return this[_0xccf6('0xe')][_0xccf6('0x187')](_0x4e3c43[_0xccf6('0x59')],_0x4e3c43['escape_digits']);};AGIVertices[_0xccf6('0x11')][_0xccf6('0x188')]=function(_0x3bafe7){logger[_0xccf6('0x2e')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3bafe7[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x3bafe7[_0xccf6('0x189')])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0x18a'));}var _0xdd4739=this['getMailAccount'][_0xccf6('0x6d')](this,_0x3bafe7[_0xccf6('0x189')]);if(!_0xdd4739||!_0xdd4739[_0xccf6('0x18b')]){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x3bafe7,_0xccf6('0x18c'));}var _0x14c30b={'from':util[_0xccf6('0x29')]('\x22%s\x22\x20<%s>',_0xdd4739[_0xccf6('0x17')],_0xdd4739[_0xccf6('0x18d')]||_0xdd4739[_0xccf6('0x18b')][_0xccf6('0x18e')]),'to':_0x3bafe7['to']||'','cc':_0x3bafe7['cc']||'','bcc':_0x3bafe7[_0xccf6('0x18f')]||'','subject':_0x3bafe7[_0xccf6('0x190')],'html':_0x3bafe7['text'],'text':_0x3bafe7[_0xccf6('0x59')]};var _0x524468={'tls':{'rejectUnauthorized':![]}};if(_0xdd4739['Smtp']['service']){_0x524468['service']=_0xdd4739[_0xccf6('0x18b')][_0xccf6('0x191')];}else{_0x524468['host']=_0xdd4739[_0xccf6('0x18b')][_0xccf6('0x192')];_0x524468[_0xccf6('0x193')]=_0xdd4739[_0xccf6('0x18b')][_0xccf6('0x193')];_0x524468[_0xccf6('0x194')]=_0xdd4739[_0xccf6('0x18b')][_0xccf6('0x194')];}if(_0xdd4739[_0xccf6('0x18b')][_0xccf6('0x195')]){_0x524468[_0xccf6('0x196')]={'user':_0xdd4739[_0xccf6('0x18b')][_0xccf6('0x18e')],'pass':_0xdd4739['Smtp'][_0xccf6('0x197')]};}if(this['isConfigured'](_0x3bafe7[_0xccf6('0x198')])){}logger[_0xccf6('0xda')](_0xccf6('0x199'),JSON[_0xccf6('0x71')](_0x14c30b));this[_0xccf6('0x38')][_0xccf6('0x6d')](this,_0x3bafe7,_0x3bafe7[_0xccf6('0x189')]);this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x19a'),_0xdd4739['name']));this['sendMailMessage'][_0xccf6('0x6d')](this,_0x524468,_0x14c30b);return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0x19b'));};AGIVertices[_0xccf6('0x11')]['sendFax']=function(_0x322113){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x19c'),_0x322113['label']));return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0x19d'));};AGIVertices[_0xccf6('0x11')][_0xccf6('0x19e')]=function(_0x3e5bf9){logger['info'](util[_0xccf6('0x29')](_0xccf6('0x19f'),_0x3e5bf9[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x3e5bf9['sms_account_id'])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0x1a0'));}var _0x309d2d=this[_0xccf6('0x35')][_0xccf6('0x6d')](this,_0x3e5bf9[_0xccf6('0x1a1')]);if(!_0x309d2d){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x3e5bf9,_0xccf6('0x1a2'));}var _0xf24afb={'body':_0x3e5bf9[_0xccf6('0x1a3')],'phone':_0x3e5bf9['to']||'','SmsAccountId':_0x309d2d['id']};logger['debug'](_0xccf6('0x1a4'),JSON['stringify'](_0xf24afb));this['createSquareDetailsReport'][_0xccf6('0x6d')](this,_0x3e5bf9,_0x3e5bf9[_0xccf6('0x1a1')]);this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x1a5'),_0x309d2d[_0xccf6('0x17')]));this[_0xccf6('0x37')][_0xccf6('0x6d')](this,_0xf24afb);return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0x1a6'));};AGIVertices[_0xccf6('0x11')][_0xccf6('0x1a7')]=function(_0x5c35aa){logger['info'](util[_0xccf6('0x29')](_0xccf6('0x1a8'),_0x5c35aa['label']));if(!this[_0xccf6('0xa8')](_0x5c35aa[_0xccf6('0xd2')])){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x5c35aa,_0xccf6('0x1a9'));}var _0x573601=this[_0xccf6('0x12')]['sync'](this,_0x5c35aa[_0xccf6('0xd2')]);if(!_0x573601){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x5c35aa,_0xccf6('0xd3'));}return this[_0xccf6('0xe')][_0xccf6('0x9a')](_0x573601,_0x5c35aa[_0xccf6('0x1aa')]);};AGIVertices[_0xccf6('0x11')][_0xccf6('0x1ab')]=function(_0x33c8ca){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')]('Enter\x20in\x20START\x20(%s)\x20block',_0x33c8ca['label']));this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0x1ac'));if(_0x33c8ca[_0xccf6('0xb7')]===_0xccf6('0x1ad')){this[_0xccf6('0xe')]['noop']('Answer');return this[_0xccf6('0xe')][_0xccf6('0xb7')]();}return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0x1ae'));};AGIVertices[_0xccf6('0x11')][_0xccf6('0x1af')]=function(_0x11633c){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x1b0'),_0x11633c[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x11633c[_0xccf6('0x1b1')])){return this[_0xccf6('0xe')]['error'](_0x11633c,_0xccf6('0x1b2'));}var _0x115f13=this[_0xccf6('0x1b3')]['sync'](this,_0x11633c[_0xccf6('0x1b1')]);if(!this[_0xccf6('0xa8')](_0x115f13)){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x11633c,util[_0xccf6('0x29')](_0xccf6('0x1b4'),_0x11633c[_0xccf6('0x1b1')]));}if(_0x115f13===this[_0xccf6('0xe')][_0xccf6('0x3c')]){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x11633c,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xccf6('0x38')][_0xccf6('0x6d')](this,_0x11633c,_0x115f13);var _0x4982c6=this[_0xccf6('0xe')]['exec'](_0xccf6('0x1b5'),util[_0xccf6('0x29')](_0xccf6('0x1b6'),config[_0xccf6('0x8')][_0xccf6('0x192')]||_0xccf6('0x1b7'),_0x115f13,this[_0xccf6('0xe')][_0xccf6('0x3c')]));if(_0x4982c6[_0xccf6('0xa1')]===-0x1){return _0x4982c6;}return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0xc1'),_0xccf6('0x1b5'),_0x115f13));};AGIVertices[_0xccf6('0x11')][_0xccf6('0x1b8')]=function(_0x5f3327){logger[_0xccf6('0x2e')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x5f3327[_0xccf6('0x3a')]));var _0x516593=this['shellCommand'][_0xccf6('0x6d')](this,_0x5f3327[_0xccf6('0x1b9')]);this[_0xccf6('0x38')][_0xccf6('0x6d')](this,_0x5f3327,_0x5f3327['command']);if(this[_0xccf6('0xa8')](_0x5f3327[_0xccf6('0xd2')])){var _0x4a16b7=this['getVariable']['sync'](this,_0x5f3327['variable_id']);if(_0x4a16b7){this[_0xccf6('0xe')][_0xccf6('0x9a')](_0x4a16b7,_0x516593);return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x1ba'),_0x5f3327[_0xccf6('0x1b9')],_0x4a16b7));}}return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x1bb'),_0x5f3327['command']));};AGIVertices['prototype']['google_cloud_tts']=function(_0x5b3c65){logger[_0xccf6('0x2e')](util['format'](_0xccf6('0x1bc'),_0x5b3c65['label']));_0x5b3c65['text']=_0x5b3c65[_0xccf6('0x59')][_0xccf6('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xccf6('0xa8')](_0x5b3c65['apiKey'])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0x1bd'));}if(!this[_0xccf6('0xa8')](_0x5b3c65[_0xccf6('0x59')])){return this['channel']['noop'](_0xccf6('0xa7'));}this['channel'][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x1be'),_0x5b3c65[_0xccf6('0x59')]));var _0x53a10f=this[_0xccf6('0x56')][_0xccf6('0x6d')](this,_0x5b3c65);if(_0x53a10f){this[_0xccf6('0xe')]['noop'](util[_0xccf6('0x29')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x53a10f));var _0xb96a4f=this[_0xccf6('0xe')][_0xccf6('0xfd')](_0x53a10f);try{fs[_0xccf6('0xfe')](_0x53a10f+_0xccf6('0x123'));}catch(_0x426e00){logger[_0xccf6('0x33')](_0x426e00);}return _0xb96a4f;}return this['channel'][_0xccf6('0x33')](_0x5b3c65,_0xccf6('0x1bf'));};AGIVertices[_0xccf6('0x11')][_0xccf6('0x1c0')]=function(_0x321e58){logger['info'](util[_0xccf6('0x29')](_0xccf6('0x1c1'),_0x321e58[_0xccf6('0x3a')]));_0x321e58['text']=_0x321e58[_0xccf6('0x59')][_0xccf6('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xccf6('0xa8')](_0x321e58['text'])){return this[_0xccf6('0xe')][_0xccf6('0xa6')](_0xccf6('0xa7'));}this[_0xccf6('0xe')]['noop'](util[_0xccf6('0x29')]('Trying\x20Google\x20TTS\x20%s',_0x321e58['text']));var _0xef812=this[_0xccf6('0x5d')]['sync'](this,_0x321e58);if(_0xef812){this['channel']['noop'](util['format'](_0xccf6('0x1c2'),_0xef812));var _0x4fd0b9=this[_0xccf6('0xe')][_0xccf6('0xfd')](_0xef812);try{fs['unlink'](_0xef812+_0xccf6('0x123'));}catch(_0x4f6713){logger['error'](_0x4f6713);}return _0x4fd0b9;}return this[_0xccf6('0xe')]['error'](_0x321e58,_0xccf6('0x1c3'));};AGIVertices[_0xccf6('0x11')][_0xccf6('0x1c4')]=function(_0xc076d5){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0xc076d5['label']));if(!this[_0xccf6('0xa8')](_0xc076d5[_0xccf6('0x154')])){return this['channel'][_0xccf6('0x33')](_0xc076d5,_0xccf6('0x155'));}logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x156'),this[_0xccf6('0xe')][_0xccf6('0x3d')],_0xc076d5[_0xccf6('0x154')]));var _0x3caf2c=this[_0xccf6('0x4d')][_0xccf6('0x6d')](this,_0xc076d5['findBy']);if(_0x3caf2c){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xccf6('0xe')][_0xccf6('0x3d')],_0xc076d5[_0xccf6('0x154')]));this[_0xccf6('0xe')]['noop'](util[_0xccf6('0x29')](_0xccf6('0x157'),this[_0xccf6('0xe')][_0xccf6('0x3d')],_0xc076d5['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x158'),this[_0xccf6('0xe')][_0xccf6('0x3d')],_0xc076d5[_0xccf6('0x154')]));this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0x158'),this[_0xccf6('0xe')][_0xccf6('0x3d')],_0xc076d5['findBy']));return{'code':0xc8,'result':_0xccf6('0x159')};}};AGIVertices[_0xccf6('0x11')][_0xccf6('0x1c5')]=function(_0x1aa382){logger['info'](util[_0xccf6('0x29')](_0xccf6('0x1c6'),_0x1aa382[_0xccf6('0x3a')]));var _0x221a4d=this[_0xccf6('0xe')][_0xccf6('0xa9')]('VOICEMAIL',[_0x1aa382['mailbox'],_0x1aa382[_0xccf6('0x77')]]);if(_0x221a4d[_0xccf6('0xa1')]===-0x1){return _0x221a4d;}return this[_0xccf6('0xe')][_0xccf6('0xa6')](util[_0xccf6('0x29')](_0xccf6('0xc1'),_0xccf6('0x1c7'),_0x1aa382[_0xccf6('0x1c8')]));};AGIVertices[_0xccf6('0x11')][_0xccf6('0x1c9')]=function(_0x40d504){logger[_0xccf6('0x2e')](util[_0xccf6('0x29')](_0xccf6('0x1ca'),_0x40d504[_0xccf6('0x3a')]));if(!this[_0xccf6('0xa8')](_0x40d504[_0xccf6('0xd2')])){return this[_0xccf6('0xe')][_0xccf6('0x33')](_0x40d504,'no\x20variable\x20selected');}var _0x5d9817=this[_0xccf6('0x12')][_0xccf6('0x6d')](this,_0x40d504[_0xccf6('0xd2')]);if(!_0x5d9817){return this[_0xccf6('0xe')]['error'](_0x40d504,_0xccf6('0xd3'));}var _0x48162c=this['channel'][_0xccf6('0x12')](_0x5d9817);return{'code':0xc8,'result':_0x48162c['extra']?_0x48162c['extra']:'-'};};String[_0xccf6('0x11')]['replaceAll']=function(_0x258875,_0x5969ed){return this['split'](_0x258875)[_0xccf6('0x1cb')](_0x5969ed);};module[_0xccf6('0x1cc')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 52d708a..54fadfd 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 _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(_0xb691c5,_0x56bd81){var _0x51b938=function(_0x25ea5a){while(--_0x25ea5a){_0xb691c5['push'](_0xb691c5['shift']());}};_0x51b938(++_0x56bd81);}(_0x17ba,0xab));var _0xa17b=function(_0x28f363,_0x390b93){_0x28f363=_0x28f363-0x0;var _0x2d681c=_0x17ba[_0x28f363];return _0x2d681c;};'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 +var _0x2d17=['catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','queue','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','info','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid'];(function(_0x2145d4,_0x1a51ed){var _0x3f23ff=function(_0x514f33){while(--_0x514f33){_0x2145d4['push'](_0x2145d4['shift']());}};_0x3f23ff(++_0x1a51ed);}(_0x2d17,0x17e));var _0x72d1=function(_0x40e1df,_0x5ef59b){_0x40e1df=_0x40e1df-0x0;var _0x2beea6=_0x2d17[_0x40e1df];return _0x2beea6;};'use strict';var util=require(_0x72d1('0x0'));var _=require(_0x72d1('0x1'));var moment=require('moment');var ami=require(_0x72d1('0x2'));var logger=require(_0x72d1('0x3'))('acw');var RpcUser=require(_0x72d1('0x4'));var RpcVoiceAgentReport=require(_0x72d1('0x5'));function Acw(_0x55b722){this[_0x72d1('0x6')]=_0x55b722['voiceQueues'];this[_0x72d1('0x7')]=_0x55b722['agents'];this[_0x72d1('0x8')]=_0x55b722[_0x72d1('0x8')];this['channels']={};ami['on'](_0x72d1('0x9'),this[_0x72d1('0xa')][_0x72d1('0xb')](this));ami['on']('hanguprequest',this[_0x72d1('0xc')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0xd'),this['syncHangup'][_0x72d1('0xb')](this));ami['on'](_0x72d1('0xe'),this[_0x72d1('0xf')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0x10'),this[_0x72d1('0x11')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0x12'),this[_0x72d1('0x13')][_0x72d1('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x72d1('0x14')][_0x72d1('0xb')](this));}function getDiff(_0x4c1038){var _0x115cd7=moment()[_0x72d1('0x15')](0x0);var _0x685a27=moment(_0x4c1038)[_0x72d1('0x15')](0x0);return _0x115cd7[_0x72d1('0x16')](_0x685a27,_0x72d1('0x17'));}Acw[_0x72d1('0x18')][_0x72d1('0x19')]=function(_0x23a238){try{var _0x8d458=this;var _0x491af4=this[_0x72d1('0x1a')][_0x23a238]['interface'];var _0x3885b2=this[_0x72d1('0x1a')][_0x23a238]['queue'];var _0x1061b7=this[_0x72d1('0x6')][_0x3885b2];var _0x1ca18d=![];var _0x49caf4='ACW';if(_0x1061b7[_0x72d1('0x1b')]){if(_0x1061b7[_0x72d1('0x1c')][_0x72d1('0x1d')]){_0x1ca18d=!![];_0x49caf4=_0x1061b7[_0x72d1('0x1c')][_0x72d1('0x1d')];}}ami[_0x72d1('0x1e')]({'action':_0x72d1('0x1f'),'interface':_0x491af4,'paused':!![],'reason':_0x49caf4})['then'](function(_0x1c695c){if(_0x8d458['agents'][_0x491af4]){return RpcUser['getAgent'](_0x8d458['agents'][_0x491af4]['id'])['then'](function(_0x445985){if(_0x445985&&!_0x445985[_0x72d1('0x20')]){logger['info'](_0x72d1('0x21'),_0x23a238,_0x491af4,_0x3885b2);var _0x256dc1=_0x8d458[_0x72d1('0x1a')][_0x23a238][_0x72d1('0x22')]&&_0x8d458[_0x72d1('0x1a')][_0x23a238]['destlinkedid']?_0x8d458['channels'][_0x23a238][_0x72d1('0x23')]:_0x23a238;return RpcUser[_0x72d1('0x24')](_0x8d458[_0x72d1('0x7')][_0x491af4],_0x49caf4,_0x256dc1)[_0x72d1('0x25')](function(_0xdf6a69){if(!_0x1ca18d){_0x8d458[_0x72d1('0x8')][_0x491af4]={};logger[_0x72d1('0x26')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x23a238,_0x8d458['voiceQueues'][_0x3885b2][_0x72d1('0x27')],_0x491af4,_0x3885b2);_0x8d458['timers'][_0x491af4][_0x72d1('0x28')]=setTimeout(_0x8d458[_0x72d1('0x29')][_0x72d1('0xb')](_0x8d458,_0x491af4),_0x8d458['voiceQueues'][_0x3885b2][_0x72d1('0x27')]*0x3e8);_0x8d458['timers'][_0x491af4][_0x72d1('0x2a')]=moment()[_0x72d1('0x2b')](_0x72d1('0x2c'));_0x8d458[_0x72d1('0x8')][_0x491af4]['uniqueid']=_0x23a238;_0x8d458[_0x72d1('0x8')][_0x491af4]['queue']=_0x3885b2;_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2d')]=function(){var _0x5cec3f=getDiff(_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2a')]);clearTimeout(_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x28')]);_0x8d458[_0x72d1('0x8')][_0x491af4]['timer']=![];RpcVoiceAgentReport[_0x72d1('0x2e')]({'acwtime':_0x5cec3f},_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2f')],_0x491af4)['then'](function(_0x244f4a){logger[_0x72d1('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x23a238,_0x5cec3f,_0x244f4a);})[_0x72d1('0x30')](function(_0x750de6){logger[_0x72d1('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x23a238,_0x750de6);});delete _0x8d458[_0x72d1('0x8')][_0x491af4];};}});}else{logger['info'](_0x72d1('0x32'),_0x23a238,_0x491af4,_0x3885b2);}});}})[_0x72d1('0x30')](function(_0x23418d){logger[_0x72d1('0x31')](_0x72d1('0x33'),_0x23a238,_0x8d458[_0x72d1('0x6')][_0x3885b2][_0x72d1('0x27')],_0x491af4,_0x3885b2);})[_0x72d1('0x34')](function(){delete _0x8d458[_0x72d1('0x1a')][_0x23a238];});}catch(_0x24be04){logger[_0x72d1('0x31')]('[ACW][START]\x20%s',_0x24be04[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0x29')]=function(_0x325209){try{var _0x49e074=this;if(_0x49e074[_0x72d1('0x8')][_0x325209]){_0x49e074[_0x72d1('0x8')][_0x325209][_0x72d1('0x28')]=![];var _0x4fb07b=_0x49e074[_0x72d1('0x8')][_0x325209][_0x72d1('0x2f')];var _0x163538=_0x49e074['timers'][_0x325209][_0x72d1('0x36')];var _0x117440=_0x49e074[_0x72d1('0x6')][_0x163538]['acwTimeout'];logger[_0x72d1('0x26')](_0x72d1('0x37'),_0x325209);RpcUser[_0x72d1('0x38')](this[_0x72d1('0x7')][_0x325209]);RpcVoiceAgentReport[_0x72d1('0x2e')]({'acwtime':_0x117440,'agentacw':!![]},_0x4fb07b,_0x325209)[_0x72d1('0x25')](function(_0xd7ec0f){logger['info'](_0x72d1('0x39'),_0x4fb07b,_0x117440,_0xd7ec0f);})[_0x72d1('0x30')](function(_0x440ac5){logger[_0x72d1('0x31')](_0x72d1('0x3a'),_0x4fb07b,_0x440ac5);});}else{logger[_0x72d1('0x31')](_0x72d1('0x3b'),_0x325209);if(_0x49e074[_0x72d1('0x8')]){logger['info'](_0x72d1('0x3c'),JSON[_0x72d1('0x3d')](_0x49e074[_0x72d1('0x8')]));}}}catch(_0x1d6704){logger[_0x72d1('0x31')](_0x72d1('0x3e'),_0x1d6704[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')]['syncAgentConnect']=function(_0x563c5a){try{if(this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]&&(this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]['acw']||this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]['mandatoryDisposition'])){if(this[_0x72d1('0x7')][_0x563c5a['interface']]){this[_0x72d1('0x1a')][_0x563c5a[_0x72d1('0x2f')]]={'queue':_0x563c5a['queue'],'interface':_0x563c5a[_0x72d1('0x3f')],'destlinkedid':_0x563c5a['destlinkedid']};}}}catch(_0x527223){logger['error'](_0x72d1('0x40'),_0x527223['message']);}};Acw[_0x72d1('0x18')][_0x72d1('0x14')]=function(_0x28332b){try{if(this['voiceQueues'][_0x28332b['queue']]&&(this[_0x72d1('0x6')][_0x28332b['queue']]['acw']||this[_0x72d1('0x6')][_0x28332b[_0x72d1('0x36')]][_0x72d1('0x1b')])){if(this['agents'][_0x28332b['interface']]){this['channels'][_0x28332b['uniqueid']]={'queue':_0x28332b[_0x72d1('0x36')],'interface':_0x28332b[_0x72d1('0x3f')]};}}}catch(_0x197483){logger[_0x72d1('0x31')](_0x72d1('0x41'),_0x197483[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0xc')]=function(_0x1e2c11){try{if(this['channels'][_0x1e2c11[_0x72d1('0x2f')]]&&_[_0x72d1('0x42')](this[_0x72d1('0x1a')][_0x1e2c11['uniqueid']][_0x72d1('0x22')])){logger[_0x72d1('0x26')](_0x72d1('0x43'),_0x1e2c11['uniqueid']);this[_0x72d1('0x19')](_0x1e2c11[_0x72d1('0x2f')]);}else if(this[_0x72d1('0x1a')][_0x1e2c11[_0x72d1('0x44')]]&&_['isUndefined'](this['channels'][_0x1e2c11[_0x72d1('0x44')]][_0x72d1('0x22')])){logger[_0x72d1('0x26')]('[%s][HANGUP:LINKEDID]',_0x1e2c11[_0x72d1('0x44')]);this[_0x72d1('0x19')](_0x1e2c11[_0x72d1('0x44')]);}}catch(_0x463670){logger[_0x72d1('0x31')](_0x72d1('0x45'),_0x463670[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0x46')]=function(_0x18f986){try{if(this[_0x72d1('0x1a')][_0x18f986['uniqueid']]&&this[_0x72d1('0x1a')][_0x18f986['uniqueid']]['attended']){logger[_0x72d1('0x26')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x18f986[_0x72d1('0x2f')]);this[_0x72d1('0x19')](_0x18f986[_0x72d1('0x2f')]);}else if(this[_0x72d1('0x1a')][_0x18f986[_0x72d1('0x44')]]&&this[_0x72d1('0x1a')][_0x18f986[_0x72d1('0x44')]][_0x72d1('0x22')]){logger[_0x72d1('0x26')](_0x72d1('0x47'),_0x18f986[_0x72d1('0x44')]);this['startAcw'](_0x18f986[_0x72d1('0x44')]);}}catch(_0x3da39a){logger[_0x72d1('0x31')]('[ACW][syncHangup]\x20%s',_0x3da39a['message']);}};Acw[_0x72d1('0x18')][_0x72d1('0x11')]=function(_0x16e9e7){try{if(!_[_0x72d1('0x48')](this[_0x72d1('0x1a')][_0x16e9e7['transfereeuniqueid']])){this[_0x72d1('0x19')](_0x16e9e7['transfereeuniqueid']);if(this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]]){this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]][_0x72d1('0x22')]=!![];this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4a')]]=this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]];delete this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]];}}else if(!_[_0x72d1('0x48')](this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4a')]])){this[_0x72d1('0x19')](_0x16e9e7[_0x72d1('0x4a')]);if(this[_0x72d1('0x1a')][_0x16e9e7['origtransfereruniqueid']]){this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4b')]][_0x72d1('0x22')]=!![];this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4c')]]=this[_0x72d1('0x1a')][_0x16e9e7['origtransfereruniqueid']];delete this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4b')]];}}}catch(_0xb05cd9){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0xb05cd9[_0x72d1('0x35')]);}};Acw['prototype'][_0x72d1('0x13')]=function(_0x359176){try{if(this[_0x72d1('0x1a')][_0x359176[_0x72d1('0x4d')]]){logger[_0x72d1('0x26')](_0x72d1('0x4e'),JSON[_0x72d1('0x3d')](_0x359176[_0x72d1('0x4d')]));this[_0x72d1('0x19')](_0x359176['transfereruniqueid']);}else if(this['channels'][_0x359176[_0x72d1('0x4f')]]){logger[_0x72d1('0x26')](_0x72d1('0x50'),JSON['stringify'](_0x359176[_0x72d1('0x4f')]));this[_0x72d1('0x19')](_0x359176['transfererlinkedid']);}}catch(_0x39d7f9){logger[_0x72d1('0x31')](_0x72d1('0x51'),_0x39d7f9[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0xf')]=function(_0x102574){try{if(this[_0x72d1('0x6')][_0x102574[_0x72d1('0x36')]]&&this[_0x72d1('0x6')][_0x102574[_0x72d1('0x36')]][_0x72d1('0x52')]==='all'){if(this['agents'][_0x102574[_0x72d1('0x3f')]]){logger[_0x72d1('0x26')](_0x72d1('0x53'),_0x102574[_0x72d1('0x2f')],_0x102574[_0x72d1('0x3f')],_0x102574[_0x72d1('0x36')]);return RpcUser[_0x72d1('0x24')](this[_0x72d1('0x7')][_0x102574['interface']],_0x72d1('0x54'),_0x102574['uniqueid']);}}}catch(_0x475016){logger[_0x72d1('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x475016['message']);}};module[_0x72d1('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 6b7979a..d436cdb 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 _0xcffd=['asterisk','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','../../config/environment','port'];(function(_0x8f9c12,_0x2a746d){var _0x3d44ca=function(_0x3e30d9){while(--_0x3e30d9){_0x8f9c12['push'](_0x8f9c12['shift']());}};_0x3d44ca(++_0x2a746d);}(_0xcffd,0x6a));var _0xdcff=function(_0x404c00,_0x37e094){_0x404c00=_0x404c00-0x0;var _0x892262=_0xcffd[_0x404c00];return _0x892262;};'use strict';var Manager=require(_0xdcff('0x0'));var BPromise=require(_0xdcff('0x1'));var moment=require(_0xdcff('0x2'));var util=require('util');var _=require(_0xdcff('0x3'));var logger=require(_0xdcff('0x4'))(_0xdcff('0x5'));var config=require(_0xdcff('0x6'));var ami=new Manager(config['asterisk'][_0xdcff('0x7')],config[_0xdcff('0x8')]['ip'],config[_0xdcff('0x8')]['username'],config[_0xdcff('0x8')][_0xdcff('0x9')],!![]);ami[_0xdcff('0xa')]();ami[_0xdcff('0xb')]=BPromise[_0xdcff('0xc')](ami[_0xdcff('0xd')]);function error(_0x5d13b6){logger[_0xdcff('0xe')](util[_0xdcff('0xf')](_0xdcff('0x10'),config[_0xdcff('0x8')]['username'],config[_0xdcff('0x8')]['ip'],config[_0xdcff('0x8')]['port'],util['inspect'](_0x5d13b6,![],null)));}function close(){logger[_0xdcff('0xe')](util[_0xdcff('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xdcff('0x8')][_0xdcff('0x11')],config[_0xdcff('0x8')]['ip'],config[_0xdcff('0x8')][_0xdcff('0x7')]));}ami[_0xdcff('0x12')]=function(){return function(){return ami[_0xdcff('0xb')]({'action':'sipshowregistry'});};};ami[_0xdcff('0x13')]=function(){return function(){return ami[_0xdcff('0xb')]({'action':_0xdcff('0x14')});};};ami[_0xdcff('0x15')]=function(){return function(){return ami[_0xdcff('0xb')]({'action':'sippeerstatus'});};};ami[_0xdcff('0x16')]=function(){return function(){return ami[_0xdcff('0xb')]({'action':_0xdcff('0x17')});};};ami[_0xdcff('0x18')]=function(){return function(){return ami[_0xdcff('0xb')]({'action':_0xdcff('0x19')});};};function connect(_0x27a3d8){logger[_0xdcff('0x1a')](util[_0xdcff('0xf')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xdcff('0x8')][_0xdcff('0x11')],config[_0xdcff('0x8')]['ip'],config[_0xdcff('0x8')][_0xdcff('0x7')]));ami[_0xdcff('0x1b')]('error',error);ami[_0xdcff('0x1b')](_0xdcff('0x1c'),close);}ami['on'](_0xdcff('0x1d'),connect);ami['on'](_0xdcff('0x1e'),function(_0x3ac56b){logger['info'](util['format'](_0xdcff('0x1f'),config[_0xdcff('0x8')]['username'],config[_0xdcff('0x8')]['ip'],config[_0xdcff('0x8')][_0xdcff('0x7')],util[_0xdcff('0x20')](_0x3ac56b,![],null)));});ami['on']('fullybooted',function(_0x403608){logger[_0xdcff('0x1a')](util['format'](_0xdcff('0x21'),config['asterisk'][_0xdcff('0x11')],config[_0xdcff('0x8')]['ip'],config[_0xdcff('0x8')]['port']));return BPromise[_0xdcff('0x22')]()['then'](ami['actionSipShowRegistry']())[_0xdcff('0x23')](ami['actionDeviceStateList']())[_0xdcff('0x23')](ami[_0xdcff('0x15')]())['then'](ami['actionQueueSummary']())['then'](ami[_0xdcff('0x18')]())[_0xdcff('0x24')](function(_0x2d6f6b){console['log'](_0x2d6f6b);});});ami['once'](_0xdcff('0xe'),error);ami['once'](_0xdcff('0x1c'),close);module[_0xdcff('0x25')]=ami; \ No newline at end of file +var _0x890c=['once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','asterisk-manager','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','Action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','port'];(function(_0x450cd9,_0x10a13f){var _0x5d7522=function(_0xfb139f){while(--_0xfb139f){_0x450cd9['push'](_0x450cd9['shift']());}};_0x5d7522(++_0x10a13f);}(_0x890c,0x15d));var _0xc890=function(_0x3f0c0d,_0x4051b8){_0x3f0c0d=_0x3f0c0d-0x0;var _0x2b75f2=_0x890c[_0x3f0c0d];return _0x2b75f2;};'use strict';var Manager=require(_0xc890('0x0'));var BPromise=require('bluebird');var moment=require(_0xc890('0x1'));var util=require(_0xc890('0x2'));var _=require(_0xc890('0x3'));var logger=require(_0xc890('0x4'))(_0xc890('0x5'));var config=require(_0xc890('0x6'));var ami=new Manager(config[_0xc890('0x7')]['port'],config['asterisk']['ip'],config[_0xc890('0x7')][_0xc890('0x8')],config[_0xc890('0x7')][_0xc890('0x9')],!![]);ami[_0xc890('0xa')]();ami[_0xc890('0xb')]=BPromise['promisify'](ami['action']);function error(_0x10a3e9){logger[_0xc890('0xc')](util[_0xc890('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xc890('0x7')]['username'],config[_0xc890('0x7')]['ip'],config[_0xc890('0x7')]['port'],util[_0xc890('0xe')](_0x10a3e9,![],null)));}function close(){logger[_0xc890('0xc')](util['format'](_0xc890('0xf'),config['asterisk'][_0xc890('0x8')],config[_0xc890('0x7')]['ip'],config[_0xc890('0x7')]['port']));}ami[_0xc890('0x10')]=function(){return function(){return ami[_0xc890('0xb')]({'action':_0xc890('0x11')});};};ami[_0xc890('0x12')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xc890('0xb')]({'action':_0xc890('0x13')});};};ami[_0xc890('0x14')]=function(){return function(){return ami[_0xc890('0xb')]({'action':_0xc890('0x15')});};};ami[_0xc890('0x16')]=function(){return function(){return ami[_0xc890('0xb')]({'action':_0xc890('0x17')});};};function connect(_0xb7523f){logger['info'](util[_0xc890('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0xc890('0x8')],config[_0xc890('0x7')]['ip'],config['asterisk'][_0xc890('0x18')]));ami['once'](_0xc890('0xc'),error);ami[_0xc890('0x19')](_0xc890('0x1a'),close);}ami['on'](_0xc890('0x1b'),connect);ami['on'](_0xc890('0x1c'),function(_0x63b1d7){logger[_0xc890('0x1d')](util['format'](_0xc890('0x1e'),config[_0xc890('0x7')][_0xc890('0x8')],config[_0xc890('0x7')]['ip'],config['asterisk'][_0xc890('0x18')],util['inspect'](_0x63b1d7,![],null)));});ami['on']('fullybooted',function(_0x1c49e9){logger[_0xc890('0x1d')](util[_0xc890('0xd')](_0xc890('0x1f'),config[_0xc890('0x7')]['username'],config['asterisk']['ip'],config[_0xc890('0x7')][_0xc890('0x18')]));return BPromise['resolve']()[_0xc890('0x20')](ami[_0xc890('0x10')]())[_0xc890('0x20')](ami[_0xc890('0x12')]())[_0xc890('0x20')](ami['actionSipPeerStatus']())[_0xc890('0x20')](ami[_0xc890('0x14')]())[_0xc890('0x20')](ami[_0xc890('0x16')]())[_0xc890('0x21')](function(_0x47debe){console['log'](_0x47debe);});});ami[_0xc890('0x19')](_0xc890('0xc'),error);ami['once'](_0xc890('0x1a'),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 29d66c6..cdedbbc 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 _0x6a47=['ami','http','Request','request','then','debug','rpc','memberReport','error','message','result','catch','exports','jayson/promise'];(function(_0x2ee113,_0x21b2d3){var _0xd53df=function(_0x209830){while(--_0x209830){_0x2ee113['push'](_0x2ee113['shift']());}};_0xd53df(++_0x21b2d3);}(_0x6a47,0x6f));var _0x76a4=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x6a47[_0x46698a];return _0x356db0;};'use strict';var jayson=require(_0x76a4('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x76a4('0x1'));var client=jayson['client'][_0x76a4('0x2')]({'port':0x2329});client[_0x76a4('0x3')]=function(_0x597f2f,_0x387606){return new BPromise(function(_0x414ac9,_0x3c120c){return client[_0x76a4('0x4')](_0x597f2f,_0x387606)[_0x76a4('0x5')](function(_0x29cda4){logger[_0x76a4('0x6')](_0x76a4('0x7'),_0x76a4('0x8'),_0x597f2f,_0x387606,_0x29cda4);if(_0x29cda4[_0x76a4('0x9')]){logger[_0x76a4('0x9')]('rpc','memberReport',_0x597f2f,_0x29cda4[_0x76a4('0x9')][_0x76a4('0xa')],_0x387606);return _0x3c120c(_0x29cda4[_0x76a4('0x9')][_0x76a4('0xa')]);}else{return _0x414ac9(_0x29cda4[_0x76a4('0xb')]);}})[_0x76a4('0xc')](function(_0x9bafdf){logger['error']('rpc',_0x76a4('0x8'),_0x597f2f,_0x9bafdf,_0x387606);return _0x3c120c(_0x9bafdf);});});};module[_0x76a4('0xd')]=client; \ No newline at end of file +var _0xb6ea=['Request','request','rpc','memberReport','error','message','result','catch','jayson/promise','bluebird','ami','client','http'];(function(_0x5c638f,_0x176046){var _0x5b8b44=function(_0x589ea8){while(--_0x589ea8){_0x5c638f['push'](_0x5c638f['shift']());}};_0x5b8b44(++_0x176046);}(_0xb6ea,0x1a8));var _0xab6e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb6ea[_0x3ab51d];return _0x29a04e;};'use strict';var jayson=require(_0xab6e('0x0'));var BPromise=require(_0xab6e('0x1'));var logger=require('../../config/logger')(_0xab6e('0x2'));var client=jayson[_0xab6e('0x3')][_0xab6e('0x4')]({'port':0x2329});client[_0xab6e('0x5')]=function(_0x15bd2f,_0x76d222){return new BPromise(function(_0x5cfa0a,_0x232338){return client[_0xab6e('0x6')](_0x15bd2f,_0x76d222)['then'](function(_0x1c3166){logger['debug'](_0xab6e('0x7'),_0xab6e('0x8'),_0x15bd2f,_0x76d222,_0x1c3166);if(_0x1c3166['error']){logger[_0xab6e('0x9')](_0xab6e('0x7'),_0xab6e('0x8'),_0x15bd2f,_0x1c3166['error'][_0xab6e('0xa')],_0x76d222);return _0x232338(_0x1c3166[_0xab6e('0x9')][_0xab6e('0xa')]);}else{return _0x5cfa0a(_0x1c3166[_0xab6e('0xb')]);}})[_0xab6e('0xc')](function(_0x3461e4){logger['error']('rpc','memberReport',_0x15bd2f,_0x3461e4,_0x76d222);return _0x232338(_0x3461e4);});});};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 68a694d..f6337ec 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 _0xe706=['lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','\x22%s\x22\x20<%s>','dialCutDigit','exports','util'];(function(_0xd0f4a5,_0xc6209d){var _0x2ba320=function(_0x142b88){while(--_0x142b88){_0xd0f4a5['push'](_0xd0f4a5['shift']());}};_0x2ba320(++_0xc6209d);}(_0xe706,0xa3));var _0x6e70=function(_0x468ac5,_0x2edfd5){_0x468ac5=_0x468ac5-0x0;var _0x33a807=_0xe706[_0x468ac5];return _0x33a807;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));function checkNameSurname(_0x5e8446,_0x2cae77,_0x315629){var _0x2ca810='';if(!_[_0x6e70('0x3')](_0x2cae77)&&_0x6e70('0x4')===typeof _0x2cae77){_0x2ca810+=_0x2cae77;}if(!_[_0x6e70('0x3')](_0x315629)&&_0x6e70('0x4')===typeof _0x315629){_0x2ca810+='\x20'+_0x315629;}if(_0x2ca810!==''){return _0x2ca810;}return _0x5e8446;}function Action(_0x506db9,_0x1b0389,_0x4381d1){this[_0x6e70('0x5')]=_0x506db9;this[_0x6e70('0x6')]=_0x4381d1||undefined;this[_0x6e70('0x7')]=checkNameSurname(_0x1b0389[_0x6e70('0x8')][_0x6e70('0x9')],_0x1b0389[_0x6e70('0x8')][_0x6e70('0xa')],_0x1b0389[_0x6e70('0x8')][_0x6e70('0xb')]);this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0x8')][_0x6e70('0x9')];this[_0x6e70('0xd')]=_0x506db9[_0x6e70('0x7')];this['active']=_0x1b0389['active']||![];this[_0x6e70('0xe')]=_0x506db9[_0x6e70('0xe')];this[_0x6e70('0xf')]=_0x506db9[_0x6e70('0xf')]||0x3;this[_0x6e70('0x10')]=_0x1b0389[_0x6e70('0x10')];this[_0x6e70('0x11')]=_0x1b0389[_0x6e70('0x11')];this['countcongestionretry']=_0x1b0389['countcongestionretry'];this['countnoanswerretry']=_0x1b0389[_0x6e70('0x12')];this['countnosuchnumberretry']=_0x1b0389['countnosuchnumberretry'];this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')];this['countabandonedretry']=_0x1b0389[_0x6e70('0x14')];this['countmachineretry']=_0x1b0389[_0x6e70('0x15')];this[_0x6e70('0x16')]=_0x1b0389['countagentrejectretry'];this['ContactId']=_0x1b0389[_0x6e70('0x17')];this['ListId']=_0x1b0389[_0x6e70('0x18')];this[_0x6e70('0x19')]=_0x1b0389['UserId'];this['VoiceQueueId']=_0x1b0389[_0x6e70('0x1a')];this[_0x6e70('0x1b')]=_0x1b0389[_0x6e70('0x1b')];this[_0x6e70('0x1c')]=_0x1b0389['id'];this[_0x6e70('0x1d')]=_0x1b0389[_0x6e70('0x8')][_0x6e70('0xa')]||'';this[_0x6e70('0x1e')]=moment()[_0x6e70('0x1f')](_0x6e70('0x20'));this['callback']=_0x1b0389[_0x6e70('0x21')];this[_0x6e70('0x22')]=_0x1b0389[_0x6e70('0x22')];this['callbackat']=_0x1b0389[_0x6e70('0x23')];this[_0x6e70('0x24')]=_0x1b0389[_0x6e70('0x24')];this['originatecalleridnum']='';this[_0x6e70('0x25')]='';}Action['prototype']['getCaller']=function(){return util['format'](_0x6e70('0x26'),this[_0x6e70('0x7')],this['voiceQueue'][_0x6e70('0x27')]>0x0?this[_0x6e70('0xc')]['substring'](this[_0x6e70('0x5')][_0x6e70('0x27')]):this[_0x6e70('0xc')]);};Action['prototype']['getQueue']=function(){return this[_0x6e70('0xd')];};module[_0x6e70('0x28')]=Action; \ No newline at end of file +var _0x688a=['ListId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','number','substring','dialCutDigit','prototype','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','Contact','phone','lastName','queue','name','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId'];(function(_0x4b60ae,_0x4ea45c){var _0x11ddbe=function(_0x196985){while(--_0x196985){_0x4b60ae['push'](_0x4b60ae['shift']());}};_0x11ddbe(++_0x4ea45c);}(_0x688a,0x124));var _0xa688=function(_0x546868,_0xb60cc5){_0x546868=_0x546868-0x0;var _0x4afa6b=_0x688a[_0x546868];return _0x4afa6b;};'use strict';var util=require(_0xa688('0x0'));var _=require(_0xa688('0x1'));var moment=require(_0xa688('0x2'));function checkNameSurname(_0x4bb45e,_0x43356d,_0x53646f){var _0x27bb04='';if(!_[_0xa688('0x3')](_0x43356d)&&'string'===typeof _0x43356d){_0x27bb04+=_0x43356d;}if(!_[_0xa688('0x3')](_0x53646f)&&_0xa688('0x4')===typeof _0x53646f){_0x27bb04+='\x20'+_0x53646f;}if(_0x27bb04!==''){return _0x27bb04;}return _0x4bb45e;}function Action(_0x27e6c4,_0x45b3ca,_0x211d2b){this[_0xa688('0x5')]=_0x27e6c4;this['uniqueid']=_0x211d2b||undefined;this['name']=checkNameSurname(_0x45b3ca[_0xa688('0x6')][_0xa688('0x7')],_0x45b3ca[_0xa688('0x6')]['firstName'],_0x45b3ca['Contact'][_0xa688('0x8')]);this['number']=_0x45b3ca['Contact'][_0xa688('0x7')];this[_0xa688('0x9')]=_0x27e6c4[_0xa688('0xa')];this[_0xa688('0xb')]=_0x45b3ca[_0xa688('0xb')]||![];this[_0xa688('0xc')]=_0x27e6c4['type'];this['dialQueueTimeout']=_0x27e6c4['dialQueueTimeout']||0x3;this[_0xa688('0xd')]=_0x45b3ca[_0xa688('0xd')];this['countbusyretry']=_0x45b3ca[_0xa688('0xe')];this['countcongestionretry']=_0x45b3ca[_0xa688('0xf')];this[_0xa688('0x10')]=_0x45b3ca['countnoanswerretry'];this['countnosuchnumberretry']=_0x45b3ca[_0xa688('0x11')];this['countdropretry']=_0x45b3ca[_0xa688('0x12')];this['countabandonedretry']=_0x45b3ca[_0xa688('0x13')];this[_0xa688('0x14')]=_0x45b3ca[_0xa688('0x14')];this[_0xa688('0x15')]=_0x45b3ca[_0xa688('0x15')];this[_0xa688('0x16')]=_0x45b3ca['ContactId'];this['ListId']=_0x45b3ca[_0xa688('0x17')];this[_0xa688('0x18')]=_0x45b3ca['UserId'];this['VoiceQueueId']=_0x45b3ca[_0xa688('0x19')];this[_0xa688('0x1a')]=_0x45b3ca['CampaignId'];this[_0xa688('0x1b')]=_0x45b3ca['id'];this['ContactFirstName']=_0x45b3ca['Contact'][_0xa688('0x1c')]||'';this[_0xa688('0x1d')]=moment()[_0xa688('0x1e')](_0xa688('0x1f'));this[_0xa688('0x20')]=_0x45b3ca[_0xa688('0x20')];this[_0xa688('0x21')]=_0x45b3ca[_0xa688('0x21')];this[_0xa688('0x22')]=_0x45b3ca[_0xa688('0x22')];this[_0xa688('0x23')]=_0x45b3ca[_0xa688('0x23')];this[_0xa688('0x24')]='';this[_0xa688('0x25')]='';}Action['prototype'][_0xa688('0x26')]=function(){return util[_0xa688('0x1e')]('\x22%s\x22\x20<%s>',this[_0xa688('0xa')],this[_0xa688('0x5')]['dialCutDigit']>0x0?this[_0xa688('0x27')][_0xa688('0x28')](this[_0xa688('0x5')][_0xa688('0x29')]):this[_0xa688('0x27')]);};Action[_0xa688('0x2a')][_0xa688('0x2b')]=function(){return this[_0xa688('0x9')];};module[_0xa688('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 037b5b1..bad590c 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 _0xe8c2=['countmachineretry','countagentrejectretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xe8c2,0x160));var _0x2e8c=function(_0x414020,_0x13e8ff){_0x414020=_0x414020-0x0;var _0x3b8c7a=_0xe8c2[_0x414020];return _0x3b8c7a;};'use strict';var util=require(_0x2e8c('0x0'));var _=require(_0x2e8c('0x1'));var moment=require(_0x2e8c('0x2'));function getSeconds(_0x57090a,_0x3c8f4f){var _0x708f0b=moment(_0x57090a)[_0x2e8c('0x3')](0x0);var _0x19e8b5=moment(_0x3c8f4f)[_0x2e8c('0x3')](0x0);return _0x708f0b[_0x2e8c('0x4')](_0x19e8b5,_0x2e8c('0x5'));}function AdditionalPhone(_0x2d02d8){this[_0x2e8c('0x6')]=_0x2d02d8['uniqueid'];this[_0x2e8c('0x7')]=_0x2d02d8[_0x2e8c('0x7')]||undefined;this['type']=_0x2d02d8[_0x2e8c('0x8')];this[_0x2e8c('0x9')]=_0x2d02d8[_0x2e8c('0x8')]===_0x2e8c('0xa')?_0x2e8c('0xb'):_0x2d02d8['type'];this[_0x2e8c('0xc')]=_0x2d02d8[_0x2e8c('0xc')];this[_0x2e8c('0xd')]=_0x2d02d8['countcongestionretry'];this['countnoanswerretry']=_0x2d02d8[_0x2e8c('0xe')];this['countglobal']=_0x2d02d8[_0x2e8c('0xc')]+_0x2d02d8[_0x2e8c('0xd')]+_0x2d02d8[_0x2e8c('0xe')]+_0x2d02d8[_0x2e8c('0xf')]+_0x2d02d8['countdropretry']+_0x2d02d8[_0x2e8c('0x10')]+_0x2d02d8[_0x2e8c('0x11')]+_0x2d02d8[_0x2e8c('0x12')];this[_0x2e8c('0xf')]=_0x2d02d8['countnosuchnumberretry'];this[_0x2e8c('0x13')]=_0x2d02d8[_0x2e8c('0x13')];this[_0x2e8c('0x10')]=_0x2d02d8[_0x2e8c('0x10')];this['countmachineretry']=_0x2d02d8[_0x2e8c('0x11')];this[_0x2e8c('0x12')]=_0x2d02d8[_0x2e8c('0x12')];this[_0x2e8c('0xb')]=_0x2d02d8[_0x2e8c('0xb')];this[_0x2e8c('0x14')]=_0x2d02d8[_0x2e8c('0x15')];this[_0x2e8c('0x16')]=_0x2d02d8[_0x2e8c('0x17')];this[_0x2e8c('0x18')]=_0x2d02d8[_0x2e8c('0x18')];this[_0x2e8c('0x19')]=_0x2d02d8[_0x2e8c('0x19')];this[_0x2e8c('0x1a')]=_0x2d02d8[_0x2e8c('0x19')];this[_0x2e8c('0x1b')]=getSeconds(_0x2d02d8['responsetime'],_0x2d02d8['starttime']);this[_0x2e8c('0x1c')]=0x0;this['talktime']=0x0;this[_0x2e8c('0x1d')]=_0x2d02d8[_0x2e8c('0x1d')];this[_0x2e8c('0x1e')]=_0x2d02d8[_0x2e8c('0x1e')];this[_0x2e8c('0x1f')]=_0x2d02d8['callbackat'];this[_0x2e8c('0x20')]=_0x2d02d8[_0x2e8c('0x20')];this['ContactId']=_0x2d02d8[_0x2e8c('0x21')];this[_0x2e8c('0x22')]=_0x2d02d8[_0x2e8c('0x22')];this[_0x2e8c('0x23')]=_0x2d02d8[_0x2e8c('0x23')];this[_0x2e8c('0x24')]=_0x2d02d8[_0x2e8c('0x24')];this[_0x2e8c('0x25')]=_0x2d02d8[_0x2e8c('0x25')];this[_0x2e8c('0x26')]=_0x2d02d8[_0x2e8c('0x26')]||'';this['originatecalleridname']=_0x2d02d8[_0x2e8c('0x27')]||'';}module[_0x2e8c('0x28')]=History; \ No newline at end of file +var _0x7b08=['starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0x7b08,0x1f1));var _0x87b0=function(_0x3cab8b,_0x19587e){_0x3cab8b=_0x3cab8b-0x0;var _0xca4d1d=_0x7b08[_0x3cab8b];return _0xca4d1d;};'use strict';var util=require(_0x87b0('0x0'));var _=require(_0x87b0('0x1'));var moment=require(_0x87b0('0x2'));function getSeconds(_0x459de6,_0x2fbdc1){var _0x5da3fb=moment(_0x459de6)[_0x87b0('0x3')](0x0);var _0x5e74d7=moment(_0x2fbdc1)[_0x87b0('0x3')](0x0);return _0x5da3fb[_0x87b0('0x4')](_0x5e74d7,_0x87b0('0x5'));}function AdditionalPhone(_0x3fb790){this['uniqueid']=_0x3fb790[_0x87b0('0x6')];this[_0x87b0('0x7')]=_0x3fb790['scheduledat']||undefined;this[_0x87b0('0x8')]=_0x3fb790[_0x87b0('0x8')];this[_0x87b0('0x9')]=_0x3fb790[_0x87b0('0x8')]==='outbound'?_0x87b0('0xa'):_0x3fb790[_0x87b0('0x8')];this['countbusyretry']=_0x3fb790[_0x87b0('0xb')];this[_0x87b0('0xc')]=_0x3fb790[_0x87b0('0xc')];this['countnoanswerretry']=_0x3fb790['countnoanswerretry'];this[_0x87b0('0xd')]=_0x3fb790['countbusyretry']+_0x3fb790[_0x87b0('0xc')]+_0x3fb790[_0x87b0('0xe')]+_0x3fb790[_0x87b0('0xf')]+_0x3fb790['countdropretry']+_0x3fb790['countabandonedretry']+_0x3fb790[_0x87b0('0x10')]+_0x3fb790[_0x87b0('0x11')];this[_0x87b0('0xf')]=_0x3fb790[_0x87b0('0xf')];this['countdropretry']=_0x3fb790['countdropretry'];this['countabandonedretry']=_0x3fb790[_0x87b0('0x12')];this['countmachineretry']=_0x3fb790['countmachineretry'];this[_0x87b0('0x11')]=_0x3fb790[_0x87b0('0x11')];this[_0x87b0('0xa')]=_0x3fb790[_0x87b0('0xa')];this[_0x87b0('0x13')]=_0x3fb790[_0x87b0('0x14')];this[_0x87b0('0x15')]=_0x3fb790[_0x87b0('0x16')];this[_0x87b0('0x17')]=_0x3fb790[_0x87b0('0x17')];this[_0x87b0('0x18')]=_0x3fb790[_0x87b0('0x18')];this[_0x87b0('0x19')]=_0x3fb790['responsetime'];this[_0x87b0('0x1a')]=getSeconds(_0x3fb790[_0x87b0('0x18')],_0x3fb790['starttime']);this['holdtime']=0x0;this[_0x87b0('0x1b')]=0x0;this[_0x87b0('0x1c')]=_0x3fb790[_0x87b0('0x1c')];this[_0x87b0('0x1d')]=_0x3fb790[_0x87b0('0x1d')];this[_0x87b0('0x1e')]=_0x3fb790[_0x87b0('0x1e')];this['recallme']=_0x3fb790[_0x87b0('0x1f')];this['ContactId']=_0x3fb790[_0x87b0('0x20')];this[_0x87b0('0x21')]=_0x3fb790[_0x87b0('0x21')];this[_0x87b0('0x22')]=_0x3fb790[_0x87b0('0x22')];this[_0x87b0('0x23')]=_0x3fb790[_0x87b0('0x23')];this[_0x87b0('0x24')]=_0x3fb790['CampaignId'];this[_0x87b0('0x25')]=_0x3fb790['originatecalleridnum']||'';this[_0x87b0('0x26')]=_0x3fb790[_0x87b0('0x26')]||'';}module[_0x87b0('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 69b780a..fa3faf4 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 _0x9881=['starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x401ed4,_0x77cf76){var _0x302d70=function(_0x2aa77e){while(--_0x2aa77e){_0x401ed4['push'](_0x401ed4['shift']());}};_0x302d70(++_0x77cf76);}(_0x9881,0x1b2));var _0x1988=function(_0x305693,_0x463bac){_0x305693=_0x305693-0x0;var _0x1f53dd=_0x9881[_0x305693];return _0x1f53dd;};'use strict';var util=require(_0x1988('0x0'));var _=require(_0x1988('0x1'));var moment=require(_0x1988('0x2'));function getSeconds(_0x3151e1,_0x25c8d9){var _0x24c901=moment(_0x3151e1)[_0x1988('0x3')](0x0);var _0x3ebc5c=moment(_0x25c8d9)[_0x1988('0x3')](0x0);return _0x24c901[_0x1988('0x4')](_0x3ebc5c,'seconds');}function AgentComplete(_0x330c48,_0x1bb152){this['state']=0x4;this[_0x1988('0x5')]=_0x1988('0x6');this['scheduledat']=_0x330c48[_0x1988('0x7')];this[_0x1988('0x8')]=_0x330c48['type'];this[_0x1988('0x9')]=_0x330c48[_0x1988('0x8')]===_0x1988('0xa')?_0x1988('0xb'):_0x330c48['type'];this[_0x1988('0xc')]=_0x330c48[_0x1988('0xc')];this[_0x1988('0xd')]=_0x330c48[_0x1988('0xd')];this[_0x1988('0xe')]=_0x330c48[_0x1988('0xe')];this[_0x1988('0xf')]=_0x330c48[_0x1988('0xc')]+_0x330c48['countcongestionretry']+_0x330c48[_0x1988('0xe')]+_0x330c48[_0x1988('0x10')]+_0x330c48['countdropretry']+_0x330c48[_0x1988('0x11')]+_0x330c48[_0x1988('0x12')]+_0x330c48[_0x1988('0x13')];this[_0x1988('0x10')]=_0x330c48[_0x1988('0x10')];this['countdropretry']=_0x330c48[_0x1988('0x14')];this['countabandonedretry']=_0x330c48[_0x1988('0x11')];this[_0x1988('0x12')]=_0x330c48['countmachineretry'];this[_0x1988('0x13')]=_0x330c48[_0x1988('0x13')];this[_0x1988('0x15')]=_0x1bb152[_0x1988('0x15')];this[_0x1988('0x16')]=_0x330c48[_0x1988('0x17')];this[_0x1988('0x18')]=_0x330c48[_0x1988('0x19')];this['starttime']=_0x330c48[_0x1988('0x1a')];this[_0x1988('0x1b')]=_0x330c48[_0x1988('0x1b')];this[_0x1988('0x1c')]=_0x330c48[_0x1988('0x1c')];this[_0x1988('0x1d')]=moment()[_0x1988('0x1e')](_0x1988('0x1f'));this[_0x1988('0x20')]=getSeconds(_0x330c48[_0x1988('0x1b')],_0x330c48[_0x1988('0x1a')]);this[_0x1988('0x21')]=getSeconds(_0x330c48[_0x1988('0x1c')],_0x330c48[_0x1988('0x1b')]);this['talktime']=getSeconds(this[_0x1988('0x1d')],_0x330c48['answertime']);this[_0x1988('0xb')]=_0x1bb152['queue'];this['membername']=_0x1bb152['membername'];this['reason']=_0x1bb152[_0x1988('0x22')];this[_0x1988('0x23')]=_0x330c48[_0x1988('0x23')];this[_0x1988('0x24')]=_0x330c48[_0x1988('0x24')];this[_0x1988('0x25')]=_0x330c48[_0x1988('0x25')];this[_0x1988('0x26')]=_0x330c48[_0x1988('0x26')];this[_0x1988('0x27')]=_0x330c48[_0x1988('0x27')];this[_0x1988('0x28')]=_0x330c48['ListId'];this[_0x1988('0x29')]=_0x330c48['UserId'];this[_0x1988('0x2a')]=_0x330c48['VoiceQueueId'];this['CampaignId']=_0x330c48[_0x1988('0x2b')];this[_0x1988('0x2c')]=_0x330c48[_0x1988('0x2c')]||'';this['originatecalleridname']=_0x330c48[_0x1988('0x2d')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x7256=['originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x7256,0x7c));var _0x6725=function(_0x2a4c59,_0x1ac67c){_0x2a4c59=_0x2a4c59-0x0;var _0x530833=_0x7256[_0x2a4c59];return _0x530833;};'use strict';var util=require(_0x6725('0x0'));var _=require(_0x6725('0x1'));var moment=require(_0x6725('0x2'));function getSeconds(_0x394775,_0x40ae93){var _0x53d493=moment(_0x394775)['milliseconds'](0x0);var _0x2eba97=moment(_0x40ae93)[_0x6725('0x3')](0x0);return _0x53d493[_0x6725('0x4')](_0x2eba97,_0x6725('0x5'));}function AgentComplete(_0x3bef09,_0x19f83e){this['state']=0x4;this['statedesc']='Answer';this['scheduledat']=_0x3bef09['scheduledat'];this[_0x6725('0x6')]=_0x3bef09[_0x6725('0x6')];this[_0x6725('0x7')]=_0x3bef09[_0x6725('0x6')]===_0x6725('0x8')?_0x6725('0x9'):_0x3bef09['type'];this[_0x6725('0xa')]=_0x3bef09['countbusyretry'];this['countcongestionretry']=_0x3bef09[_0x6725('0xb')];this[_0x6725('0xc')]=_0x3bef09[_0x6725('0xc')];this[_0x6725('0xd')]=_0x3bef09['countbusyretry']+_0x3bef09['countcongestionretry']+_0x3bef09[_0x6725('0xc')]+_0x3bef09[_0x6725('0xe')]+_0x3bef09['countdropretry']+_0x3bef09[_0x6725('0xf')]+_0x3bef09[_0x6725('0x10')]+_0x3bef09[_0x6725('0x11')];this[_0x6725('0xe')]=_0x3bef09[_0x6725('0xe')];this['countdropretry']=_0x3bef09[_0x6725('0x12')];this[_0x6725('0xf')]=_0x3bef09[_0x6725('0xf')];this[_0x6725('0x10')]=_0x3bef09[_0x6725('0x10')];this[_0x6725('0x11')]=_0x3bef09['countagentrejectretry'];this[_0x6725('0x13')]=_0x19f83e[_0x6725('0x13')];this[_0x6725('0x14')]=_0x3bef09[_0x6725('0x15')];this['calleridnum']=_0x3bef09['number'];this['starttime']=_0x3bef09['starttime'];this[_0x6725('0x16')]=_0x3bef09[_0x6725('0x16')];this['answertime']=_0x3bef09[_0x6725('0x17')];this[_0x6725('0x18')]=moment()['format'](_0x6725('0x19'));this['ringtime']=getSeconds(_0x3bef09['responsetime'],_0x3bef09['starttime']);this[_0x6725('0x1a')]=getSeconds(_0x3bef09['answertime'],_0x3bef09['responsetime']);this[_0x6725('0x1b')]=getSeconds(this['endtime'],_0x3bef09[_0x6725('0x17')]);this['queue']=_0x19f83e[_0x6725('0x9')];this[_0x6725('0x1c')]=_0x19f83e[_0x6725('0x1c')];this[_0x6725('0x1d')]=_0x19f83e[_0x6725('0x1d')];this[_0x6725('0x1e')]=_0x3bef09[_0x6725('0x1e')];this[_0x6725('0x1f')]=_0x3bef09['callbackuniqueid'];this[_0x6725('0x20')]=_0x3bef09[_0x6725('0x20')];this[_0x6725('0x21')]=_0x3bef09['recallme'];this[_0x6725('0x22')]=_0x3bef09[_0x6725('0x22')];this[_0x6725('0x23')]=_0x3bef09[_0x6725('0x23')];this[_0x6725('0x24')]=_0x3bef09[_0x6725('0x24')];this[_0x6725('0x25')]=_0x3bef09[_0x6725('0x25')];this[_0x6725('0x26')]=_0x3bef09['CampaignId'];this[_0x6725('0x27')]=_0x3bef09[_0x6725('0x27')]||'';this[_0x6725('0x28')]=_0x3bef09['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 90ef844..47bf149 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 _0x45f1=['originatecalleridname','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x45f1,0xbf));var _0x145f=function(_0x2d0bba,_0xfd1a86){_0x2d0bba=_0x2d0bba-0x0;var _0x5d7f1a=_0x45f1[_0x2d0bba];return _0x5d7f1a;};'use strict';var util=require('util');var _=require(_0x145f('0x0'));var moment=require(_0x145f('0x1'));function getSeconds(_0x138869,_0xb612f9){var _0x5e51ce=moment(_0x138869)[_0x145f('0x2')](0x0);var _0x2e23a2=moment(_0xb612f9)[_0x145f('0x2')](0x0);return _0x5e51ce['diff'](_0x2e23a2,_0x145f('0x3'));}function Final(_0x3ab198){this[_0x145f('0x4')]=_0x3ab198['uniqueid'];this[_0x145f('0x5')]=_0x3ab198[_0x145f('0x5')];this[_0x145f('0x6')]=_0x3ab198[_0x145f('0x6')];this[_0x145f('0x7')]=_0x3ab198['type']===_0x145f('0x8')?_0x145f('0x9'):_0x3ab198[_0x145f('0x6')];this['countbusyretry']=_0x3ab198[_0x145f('0xa')];this[_0x145f('0xb')]=_0x3ab198[_0x145f('0xb')];this[_0x145f('0xc')]=_0x3ab198['countnoanswerretry'];this[_0x145f('0xd')]=_0x3ab198['countbusyretry']+_0x3ab198['countcongestionretry']+_0x3ab198['countnoanswerretry']+_0x3ab198[_0x145f('0xe')]+_0x3ab198[_0x145f('0xf')]+_0x3ab198[_0x145f('0x10')]+_0x3ab198[_0x145f('0x11')]+_0x3ab198['countagentrejectretry'];this[_0x145f('0xe')]=_0x3ab198[_0x145f('0xe')];this['countdropretry']=_0x3ab198[_0x145f('0xf')];this['countabandonedretry']=_0x3ab198['countabandonedretry'];this[_0x145f('0x11')]=_0x3ab198[_0x145f('0x11')];this[_0x145f('0x12')]=_0x3ab198[_0x145f('0x12')];this[_0x145f('0x9')]=_0x3ab198[_0x145f('0x9')];this['calleridname']=_0x3ab198[_0x145f('0x13')];this[_0x145f('0x14')]=_0x3ab198['calleridnum'];this[_0x145f('0x15')]=_0x3ab198[_0x145f('0x15')];this[_0x145f('0x16')]=_0x3ab198[_0x145f('0x16')];this[_0x145f('0x17')]=_0x3ab198[_0x145f('0x16')];this[_0x145f('0x18')]=_0x3ab198[_0x145f('0x18')]||0x0;this[_0x145f('0x19')]=_0x3ab198['holdtime']||0x0;this[_0x145f('0x1a')]=_0x3ab198[_0x145f('0x1a')]||0x0;this[_0x145f('0x1b')]=_0x3ab198[_0x145f('0x1b')];this[_0x145f('0x1c')]=_0x3ab198['callbackuniqueid'];this[_0x145f('0x1d')]=_0x3ab198[_0x145f('0x1d')];this[_0x145f('0x1e')]=_0x3ab198[_0x145f('0x1e')];this[_0x145f('0x1f')]=_0x3ab198['ContactId'];this[_0x145f('0x20')]=_0x3ab198['ListId'];this[_0x145f('0x21')]=_0x3ab198[_0x145f('0x21')];this[_0x145f('0x22')]=_0x3ab198['VoiceQueueId'];this[_0x145f('0x23')]=_0x3ab198[_0x145f('0x23')];this[_0x145f('0x24')]=_0x3ab198[_0x145f('0x24')]||'';this['originatecalleridname']=_0x3ab198[_0x145f('0x25')]||'';}module['exports']=Final; \ No newline at end of file +var _0xc64d=['responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xc64d,0x113));var _0xdc64=function(_0x219c16,_0x2787f1){_0x219c16=_0x219c16-0x0;var _0x2e73a4=_0xc64d[_0x219c16];return _0x2e73a4;};'use strict';var util=require(_0xdc64('0x0'));var _=require(_0xdc64('0x1'));var moment=require('moment');function getSeconds(_0x15b881,_0x5a7b23){var _0x4ab5c6=moment(_0x15b881)[_0xdc64('0x2')](0x0);var _0x4a02de=moment(_0x5a7b23)[_0xdc64('0x2')](0x0);return _0x4ab5c6[_0xdc64('0x3')](_0x4a02de,_0xdc64('0x4'));}function Final(_0xfbd756){this[_0xdc64('0x5')]=_0xfbd756[_0xdc64('0x5')];this[_0xdc64('0x6')]=_0xfbd756[_0xdc64('0x6')];this[_0xdc64('0x7')]=_0xfbd756[_0xdc64('0x7')];this[_0xdc64('0x8')]=_0xfbd756[_0xdc64('0x7')]==='outbound'?_0xdc64('0x9'):_0xfbd756[_0xdc64('0x7')];this[_0xdc64('0xa')]=_0xfbd756[_0xdc64('0xa')];this[_0xdc64('0xb')]=_0xfbd756[_0xdc64('0xb')];this[_0xdc64('0xc')]=_0xfbd756[_0xdc64('0xc')];this[_0xdc64('0xd')]=_0xfbd756[_0xdc64('0xa')]+_0xfbd756[_0xdc64('0xb')]+_0xfbd756[_0xdc64('0xc')]+_0xfbd756[_0xdc64('0xe')]+_0xfbd756['countdropretry']+_0xfbd756[_0xdc64('0xf')]+_0xfbd756[_0xdc64('0x10')]+_0xfbd756[_0xdc64('0x11')];this['countnosuchnumberretry']=_0xfbd756[_0xdc64('0xe')];this['countdropretry']=_0xfbd756['countdropretry'];this[_0xdc64('0xf')]=_0xfbd756[_0xdc64('0xf')];this[_0xdc64('0x10')]=_0xfbd756['countmachineretry'];this[_0xdc64('0x11')]=_0xfbd756[_0xdc64('0x11')];this[_0xdc64('0x9')]=_0xfbd756['queue'];this['calleridname']=_0xfbd756[_0xdc64('0x12')];this[_0xdc64('0x13')]=_0xfbd756[_0xdc64('0x13')];this[_0xdc64('0x14')]=_0xfbd756[_0xdc64('0x14')];this[_0xdc64('0x15')]=_0xfbd756[_0xdc64('0x15')];this['endtime']=_0xfbd756[_0xdc64('0x15')];this[_0xdc64('0x16')]=_0xfbd756[_0xdc64('0x16')]||0x0;this[_0xdc64('0x17')]=_0xfbd756['holdtime']||0x0;this[_0xdc64('0x18')]=_0xfbd756[_0xdc64('0x18')]||0x0;this[_0xdc64('0x19')]=_0xfbd756['callback'];this[_0xdc64('0x1a')]=_0xfbd756[_0xdc64('0x1a')];this['callbackat']=_0xfbd756[_0xdc64('0x1b')];this[_0xdc64('0x1c')]=_0xfbd756[_0xdc64('0x1c')];this['ContactId']=_0xfbd756[_0xdc64('0x1d')];this[_0xdc64('0x1e')]=_0xfbd756[_0xdc64('0x1e')];this[_0xdc64('0x1f')]=_0xfbd756[_0xdc64('0x1f')];this[_0xdc64('0x20')]=_0xfbd756[_0xdc64('0x20')];this[_0xdc64('0x21')]=_0xfbd756['CampaignId'];this[_0xdc64('0x22')]=_0xfbd756[_0xdc64('0x22')]||'';this[_0xdc64('0x23')]=_0xfbd756[_0xdc64('0x23')]||'';}module[_0xdc64('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index b0ccd68..6bb75e6 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 _0x6861=['responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','starttime'];(function(_0x54fdcb,_0x3b2045){var _0x5f1208=function(_0x1670b3){while(--_0x1670b3){_0x54fdcb['push'](_0x54fdcb['shift']());}};_0x5f1208(++_0x3b2045);}(_0x6861,0x18c));var _0x1686=function(_0x481d04,_0x499794){_0x481d04=_0x481d04-0x0;var _0xa35960=_0x6861[_0x481d04];return _0xa35960;};'use strict';var util=require(_0x1686('0x0'));var _=require(_0x1686('0x1'));var moment=require(_0x1686('0x2'));function getSeconds(_0x4a6b5c,_0x2f9670){var _0x3f8f3a=moment(_0x4a6b5c)[_0x1686('0x3')](0x0);var _0x431cc8=moment(_0x2f9670)[_0x1686('0x3')](0x0);return _0x3f8f3a[_0x1686('0x4')](_0x431cc8,_0x1686('0x5'));}function Hangup(_0x3eb24c,_0x245bb4){this[_0x1686('0x6')]=0x4;this[_0x1686('0x7')]=_0x1686('0x8');this[_0x1686('0x9')]=_0x3eb24c[_0x1686('0x9')];this[_0x1686('0xa')]=_0x3eb24c[_0x1686('0xa')];this['campaigntype']=_0x3eb24c['type']==='outbound'?'queue':_0x3eb24c['type'];this[_0x1686('0xb')]=_0x3eb24c[_0x1686('0xb')];this[_0x1686('0xc')]=_0x3eb24c['countcongestionretry'];this[_0x1686('0xd')]=_0x3eb24c[_0x1686('0xd')];this[_0x1686('0xe')]=_0x3eb24c[_0x1686('0xb')]+_0x3eb24c[_0x1686('0xc')]+_0x3eb24c[_0x1686('0xd')]+_0x3eb24c[_0x1686('0xf')]+_0x3eb24c[_0x1686('0x10')]+_0x3eb24c[_0x1686('0x11')]+_0x3eb24c['countmachineretry']+_0x3eb24c[_0x1686('0x12')];this[_0x1686('0xf')]=_0x3eb24c[_0x1686('0xf')];this['countdropretry']=_0x3eb24c[_0x1686('0x10')];this[_0x1686('0x11')]=_0x3eb24c[_0x1686('0x11')];this['countmachineretry']=_0x3eb24c[_0x1686('0x13')];this[_0x1686('0x12')]=_0x3eb24c[_0x1686('0x12')];this[_0x1686('0x14')]=_0x245bb4[_0x1686('0x14')];this[_0x1686('0x15')]=_0x3eb24c[_0x1686('0x16')];this['calleridnum']=_0x3eb24c['number'];this['starttime']=_0x3eb24c[_0x1686('0x17')];this[_0x1686('0x18')]=_0x3eb24c[_0x1686('0x18')];this[_0x1686('0x19')]=moment()['format'](_0x1686('0x1a'));this[_0x1686('0x1b')]=getSeconds(_0x3eb24c[_0x1686('0x18')],_0x3eb24c[_0x1686('0x17')]);this[_0x1686('0x1c')]=0x0;this[_0x1686('0x1d')]=getSeconds(this['endtime'],_0x3eb24c[_0x1686('0x18')]);this[_0x1686('0x1e')]=_0x3eb24c['queue'];this['membername']=_0x1686('0x1f');this['reason']=_0x245bb4[_0x1686('0x20')];this[_0x1686('0x21')]=_0x3eb24c['callback'];this[_0x1686('0x22')]=_0x3eb24c['callbackuniqueid'];this[_0x1686('0x23')]=_0x3eb24c[_0x1686('0x23')];this[_0x1686('0x24')]=_0x3eb24c['recallme'];this[_0x1686('0x25')]=_0x3eb24c[_0x1686('0x25')];this[_0x1686('0x26')]=_0x3eb24c[_0x1686('0x26')];this['UserId']=_0x3eb24c['UserId'];this['VoiceQueueId']=_0x3eb24c[_0x1686('0x27')];this[_0x1686('0x28')]=_0x3eb24c[_0x1686('0x28')];}module[_0x1686('0x29')]=Hangup; \ No newline at end of file +var _0xa7f4=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x1f40e4,_0x1b97e8){var _0x247682=function(_0x22d839){while(--_0x22d839){_0x1f40e4['push'](_0x1f40e4['shift']());}};_0x247682(++_0x1b97e8);}(_0xa7f4,0x195));var _0x4a7f=function(_0x42f27e,_0x5799e3){_0x42f27e=_0x42f27e-0x0;var _0x45b063=_0xa7f4[_0x42f27e];return _0x45b063;};'use strict';var util=require('util');var _=require(_0x4a7f('0x0'));var moment=require('moment');function getSeconds(_0x252a96,_0x2c3875){var _0x4d7a6b=moment(_0x252a96)['milliseconds'](0x0);var _0x3f8ecd=moment(_0x2c3875)[_0x4a7f('0x1')](0x0);return _0x4d7a6b[_0x4a7f('0x2')](_0x3f8ecd,_0x4a7f('0x3'));}function Hangup(_0x5aa6ab,_0x38d972){this[_0x4a7f('0x4')]=0x4;this[_0x4a7f('0x5')]=_0x4a7f('0x6');this['scheduledat']=_0x5aa6ab[_0x4a7f('0x7')];this[_0x4a7f('0x8')]=_0x5aa6ab[_0x4a7f('0x8')];this[_0x4a7f('0x9')]=_0x5aa6ab[_0x4a7f('0x8')]==='outbound'?_0x4a7f('0xa'):_0x5aa6ab['type'];this['countbusyretry']=_0x5aa6ab[_0x4a7f('0xb')];this[_0x4a7f('0xc')]=_0x5aa6ab[_0x4a7f('0xc')];this[_0x4a7f('0xd')]=_0x5aa6ab[_0x4a7f('0xd')];this[_0x4a7f('0xe')]=_0x5aa6ab[_0x4a7f('0xb')]+_0x5aa6ab[_0x4a7f('0xc')]+_0x5aa6ab[_0x4a7f('0xd')]+_0x5aa6ab[_0x4a7f('0xf')]+_0x5aa6ab[_0x4a7f('0x10')]+_0x5aa6ab[_0x4a7f('0x11')]+_0x5aa6ab[_0x4a7f('0x12')]+_0x5aa6ab[_0x4a7f('0x13')];this[_0x4a7f('0xf')]=_0x5aa6ab[_0x4a7f('0xf')];this['countdropretry']=_0x5aa6ab[_0x4a7f('0x10')];this['countabandonedretry']=_0x5aa6ab[_0x4a7f('0x11')];this[_0x4a7f('0x12')]=_0x5aa6ab[_0x4a7f('0x12')];this[_0x4a7f('0x13')]=_0x5aa6ab[_0x4a7f('0x13')];this['uniqueid']=_0x38d972[_0x4a7f('0x14')];this['calleridname']=_0x5aa6ab[_0x4a7f('0x15')];this['calleridnum']=_0x5aa6ab['number'];this[_0x4a7f('0x16')]=_0x5aa6ab['starttime'];this[_0x4a7f('0x17')]=_0x5aa6ab[_0x4a7f('0x17')];this[_0x4a7f('0x18')]=moment()[_0x4a7f('0x19')](_0x4a7f('0x1a'));this[_0x4a7f('0x1b')]=getSeconds(_0x5aa6ab[_0x4a7f('0x17')],_0x5aa6ab[_0x4a7f('0x16')]);this[_0x4a7f('0x1c')]=0x0;this[_0x4a7f('0x1d')]=getSeconds(this[_0x4a7f('0x18')],_0x5aa6ab['responsetime']);this['queue']=_0x5aa6ab['queue'];this[_0x4a7f('0x1e')]=_0x4a7f('0x1f');this[_0x4a7f('0x20')]=_0x38d972['cause-txt'];this['callback']=_0x5aa6ab[_0x4a7f('0x21')];this[_0x4a7f('0x22')]=_0x5aa6ab[_0x4a7f('0x22')];this[_0x4a7f('0x23')]=_0x5aa6ab[_0x4a7f('0x23')];this[_0x4a7f('0x24')]=_0x5aa6ab[_0x4a7f('0x24')];this[_0x4a7f('0x25')]=_0x5aa6ab[_0x4a7f('0x25')];this['ListId']=_0x5aa6ab[_0x4a7f('0x26')];this['UserId']=_0x5aa6ab[_0x4a7f('0x27')];this['VoiceQueueId']=_0x5aa6ab['VoiceQueueId'];this[_0x4a7f('0x28')]=_0x5aa6ab[_0x4a7f('0x28')];}module[_0x4a7f('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 28c5a79..b6abe69 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 _0x654e=['name','calleridnum','number','responsetime','ringtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname'];(function(_0x4c1ad8,_0x55e28d){var _0x2c617b=function(_0x5f80df){while(--_0x5f80df){_0x4c1ad8['push'](_0x4c1ad8['shift']());}};_0x2c617b(++_0x55e28d);}(_0x654e,0x1e8));var _0xe654=function(_0x133968,_0x5ca58b){_0x133968=_0x133968-0x0;var _0x14a75a=_0x654e[_0x133968];return _0x14a75a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe654('0x0'));function getSeconds(_0x5cfb70,_0xa910e4){var _0x28f7be=moment(_0x5cfb70)[_0xe654('0x1')](0x0);var _0x52e6f9=moment(_0xa910e4)[_0xe654('0x1')](0x0);return _0x28f7be['diff'](_0x52e6f9,_0xe654('0x2'));}function History(_0x2c218d){this[_0xe654('0x3')]=_0x2c218d[_0xe654('0x3')];this[_0xe654('0x4')]=_0x2c218d[_0xe654('0x4')]||undefined;this[_0xe654('0x5')]=_0x2c218d[_0xe654('0x5')];this[_0xe654('0x6')]=_0x2c218d[_0xe654('0x5')]===_0xe654('0x7')?_0xe654('0x8'):_0x2c218d['type'];this[_0xe654('0x9')]=_0x2c218d[_0xe654('0x9')];this['countcongestionretry']=_0x2c218d[_0xe654('0xa')];this[_0xe654('0xb')]=_0x2c218d[_0xe654('0xb')];this[_0xe654('0xc')]=_0x2c218d['countbusyretry']+_0x2c218d[_0xe654('0xa')]+_0x2c218d[_0xe654('0xb')]+_0x2c218d['countnosuchnumberretry']+_0x2c218d[_0xe654('0xd')]+_0x2c218d[_0xe654('0xe')]+_0x2c218d[_0xe654('0xf')]+_0x2c218d[_0xe654('0x10')];this[_0xe654('0x11')]=_0x2c218d['countnosuchnumberretry'];this[_0xe654('0xd')]=_0x2c218d['countdropretry'];this[_0xe654('0xe')]=_0x2c218d[_0xe654('0xe')];this[_0xe654('0xf')]=_0x2c218d[_0xe654('0xf')];this[_0xe654('0x10')]=_0x2c218d['countagentrejectretry'];this[_0xe654('0x8')]=_0x2c218d['queue'];this[_0xe654('0x12')]=_0x2c218d[_0xe654('0x13')];this[_0xe654('0x14')]=_0x2c218d[_0xe654('0x15')];this['starttime']=_0x2c218d['starttime'];this[_0xe654('0x16')]=_0x2c218d[_0xe654('0x16')];this['endtime']=_0x2c218d['responsetime'];this[_0xe654('0x17')]=getSeconds(_0x2c218d[_0xe654('0x16')],_0x2c218d[_0xe654('0x18')]);this[_0xe654('0x19')]=0x0;this[_0xe654('0x1a')]=0x0;this[_0xe654('0x1b')]=_0x2c218d[_0xe654('0x1b')];this[_0xe654('0x1c')]=_0x2c218d['callbackuniqueid'];this[_0xe654('0x1d')]=_0x2c218d[_0xe654('0x1d')];this[_0xe654('0x1e')]=_0x2c218d[_0xe654('0x1e')];this[_0xe654('0x1f')]=_0x2c218d[_0xe654('0x1f')];this[_0xe654('0x20')]=_0x2c218d['ListId'];this[_0xe654('0x21')]=_0x2c218d[_0xe654('0x21')];this[_0xe654('0x22')]=_0x2c218d[_0xe654('0x22')];this[_0xe654('0x23')]=_0x2c218d['CampaignId'];this[_0xe654('0x24')]=_0x2c218d['originatecalleridnum']||'';this[_0xe654('0x25')]=_0x2c218d[_0xe654('0x25')]||'';}module[_0xe654('0x26')]=History; \ No newline at end of file +var _0x1d90=['number','starttime','responsetime','endtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name'];(function(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0x1d90,0x1cb));var _0x01d9=function(_0x526bbe,_0x4b63a2){_0x526bbe=_0x526bbe-0x0;var _0x5c74fc=_0x1d90[_0x526bbe];return _0x5c74fc;};'use strict';var util=require(_0x01d9('0x0'));var _=require(_0x01d9('0x1'));var moment=require(_0x01d9('0x2'));function getSeconds(_0x31f9bc,_0x56e572){var _0x343565=moment(_0x31f9bc)[_0x01d9('0x3')](0x0);var _0x24793b=moment(_0x56e572)[_0x01d9('0x3')](0x0);return _0x343565[_0x01d9('0x4')](_0x24793b,'seconds');}function History(_0x29ecb7){this['uniqueid']=_0x29ecb7[_0x01d9('0x5')];this[_0x01d9('0x6')]=_0x29ecb7[_0x01d9('0x6')]||undefined;this['type']=_0x29ecb7[_0x01d9('0x7')];this[_0x01d9('0x8')]=_0x29ecb7[_0x01d9('0x7')]===_0x01d9('0x9')?_0x01d9('0xa'):_0x29ecb7[_0x01d9('0x7')];this[_0x01d9('0xb')]=_0x29ecb7[_0x01d9('0xb')];this[_0x01d9('0xc')]=_0x29ecb7[_0x01d9('0xc')];this[_0x01d9('0xd')]=_0x29ecb7[_0x01d9('0xd')];this[_0x01d9('0xe')]=_0x29ecb7[_0x01d9('0xb')]+_0x29ecb7[_0x01d9('0xc')]+_0x29ecb7[_0x01d9('0xd')]+_0x29ecb7[_0x01d9('0xf')]+_0x29ecb7[_0x01d9('0x10')]+_0x29ecb7[_0x01d9('0x11')]+_0x29ecb7[_0x01d9('0x12')]+_0x29ecb7[_0x01d9('0x13')];this[_0x01d9('0xf')]=_0x29ecb7['countnosuchnumberretry'];this[_0x01d9('0x10')]=_0x29ecb7[_0x01d9('0x10')];this[_0x01d9('0x11')]=_0x29ecb7['countabandonedretry'];this[_0x01d9('0x12')]=_0x29ecb7[_0x01d9('0x12')];this[_0x01d9('0x13')]=_0x29ecb7[_0x01d9('0x13')];this[_0x01d9('0xa')]=_0x29ecb7[_0x01d9('0xa')];this[_0x01d9('0x14')]=_0x29ecb7[_0x01d9('0x15')];this['calleridnum']=_0x29ecb7[_0x01d9('0x16')];this[_0x01d9('0x17')]=_0x29ecb7[_0x01d9('0x17')];this[_0x01d9('0x18')]=_0x29ecb7[_0x01d9('0x18')];this[_0x01d9('0x19')]=_0x29ecb7[_0x01d9('0x18')];this['ringtime']=getSeconds(_0x29ecb7[_0x01d9('0x18')],_0x29ecb7[_0x01d9('0x17')]);this[_0x01d9('0x1a')]=0x0;this['talktime']=0x0;this[_0x01d9('0x1b')]=_0x29ecb7['callback'];this[_0x01d9('0x1c')]=_0x29ecb7[_0x01d9('0x1c')];this[_0x01d9('0x1d')]=_0x29ecb7[_0x01d9('0x1d')];this['recallme']=_0x29ecb7[_0x01d9('0x1e')];this['ContactId']=_0x29ecb7['ContactId'];this[_0x01d9('0x1f')]=_0x29ecb7[_0x01d9('0x1f')];this[_0x01d9('0x20')]=_0x29ecb7['UserId'];this['VoiceQueueId']=_0x29ecb7[_0x01d9('0x21')];this['CampaignId']=_0x29ecb7['CampaignId'];this[_0x01d9('0x22')]=_0x29ecb7[_0x01d9('0x22')]||'';this[_0x01d9('0x23')]=_0x29ecb7[_0x01d9('0x23')]||'';}module[_0x01d9('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 618a06c..5b8cd98 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 _0xb9a8=['membername','AMD','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countagentrejectretry','dialMachineRetryFrequency','VoiceQueueId','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','droptime','responsetime','Drop','TIMEOUT','dialQueueProject2','dialDropRetryFrequency','calleridname','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','calleridnum','[syncAgentComplete][createHistory][11]','channel','actionid','locked','stateinterface','push','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','booked','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','loggedIn','checkIfTime','dialGlobalInterval','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','trim','dialCutDigit','SIP/%s/%s%s','substring','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','response','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','ACTIVE','RUNNING','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','AGENTS_NOT_LOGGED','name','message','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Interval','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','available','pTalking','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','md5','voice:queue:%s','voice_queue:save','ivr','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','resolve','then','checkIsBlackList','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','HangupInAMD'];(function(_0x4a02b8,_0x71bd74){var _0x3aaa9e=function(_0x4670cc){while(--_0x4670cc){_0x4a02b8['push'](_0x4a02b8['shift']());}};_0x3aaa9e(++_0x71bd74);}(_0xb9a8,0x124));var _0x8b9a=function(_0x3178c2,_0x51b329){_0x3178c2=_0x3178c2-0x0;var _0x13bf65=_0xb9a8[_0x3178c2];return _0x13bf65;};'use strict';var util=require(_0x8b9a('0x0'));var _=require('lodash');var BPromise=require(_0x8b9a('0x1'));var uuid=require(_0x8b9a('0x2'));var moment=require(_0x8b9a('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x8b9a('0x4'));var ut=require(_0x8b9a('0x5'));var config=require(_0x8b9a('0x6'));var logger=require(_0x8b9a('0x7'))(_0x8b9a('0x8'));var loggerBooked=require(_0x8b9a('0x7'))('booked');var loggerPredictive=require(_0x8b9a('0x7'))(_0x8b9a('0x9'));var loggerPredictiveCalls=require(_0x8b9a('0x7'))(_0x8b9a('0xa'));var loggerSyncQueueSummary=require(_0x8b9a('0x7'))(_0x8b9a('0xb'));var ami=require('../ami');config[_0x8b9a('0xc')]=_[_0x8b9a('0xd')](config[_0x8b9a('0xc')],{'host':_0x8b9a('0xe'),'port':0x18eb});var io=require(_0x8b9a('0xf'))(new Redis(config[_0x8b9a('0xc')]));var cmHopper=require(_0x8b9a('0x10'));var cmHopperHistory=require(_0x8b9a('0x11'));var cmHopperBlack=require(_0x8b9a('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require(_0x8b9a('0x13'));var Final=require(_0x8b9a('0x14'));var AgentComplete=require(_0x8b9a('0x15'));var QueueCallerAbandon=require(_0x8b9a('0x16'));var Hangup=require(_0x8b9a('0x17'));var ipAgi=process[_0x8b9a('0x18')][_0x8b9a('0x19')]||_0x8b9a('0x1a');var strategy={'rrmemory':_0x8b9a('0x1b'),'roundrobin':_0x8b9a('0x1c')};var Sequence=function(){};Sequence[_0x8b9a('0x1d')][_0x8b9a('0x1e')]=function(_0x3ed6d6){this['tail']=this[_0x8b9a('0x1f')]?this[_0x8b9a('0x1f')][_0x8b9a('0x20')](_0x3ed6d6):_0x3ed6d6();};function Dialer(_0x458cb2,_0x47cd12){this[_0x8b9a('0x21')]=new Sequence();this[_0x8b9a('0x22')]=_0x47cd12;this[_0x8b9a('0x23')]=_0x458cb2[_0x8b9a('0x23')];this[_0x8b9a('0x24')]=_0x458cb2[_0x8b9a('0x24')];this[_0x8b9a('0x25')]=_0x458cb2[_0x8b9a('0x25')];this[_0x8b9a('0x26')]=_0x458cb2['trunks'];this[_0x8b9a('0x27')]=config[_0x8b9a('0x27')]||0x2;this[_0x8b9a('0x28')]={};this['actions']={};this['contactsId']={};this[_0x8b9a('0x29')]={};this[_0x8b9a('0x2a')]={};this['startPredictive']={};this[_0x8b9a('0x2b')]={};this[_0x8b9a('0x2c')]={};this[_0x8b9a('0x2d')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0x8b9a('0x2e')][_0x8b9a('0x2f')](this));ami['on'](_0x8b9a('0x30'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('originateresponse',this[_0x8b9a('0x31')][_0x8b9a('0x2f')](this));ami['on'](_0x8b9a('0x32'),this[_0x8b9a('0x33')][_0x8b9a('0x2f')](this));ami['on'](_0x8b9a('0x34'),this[_0x8b9a('0xb')][_0x8b9a('0x2f')](this));ami['on'](_0x8b9a('0x35'),this[_0x8b9a('0x36')][_0x8b9a('0x2f')](this));ami['on']('newexten',this[_0x8b9a('0x37')][_0x8b9a('0x2f')](this));ami['on'](_0x8b9a('0x38'),this[_0x8b9a('0x39')][_0x8b9a('0x2f')](this));ami['on']('queuemember',this[_0x8b9a('0x3a')][_0x8b9a('0x2f')](this));ami['on'](_0x8b9a('0x3b'),this[_0x8b9a('0x3c')][_0x8b9a('0x2f')](this));this[_0x8b9a('0x3d')]();this[_0x8b9a('0x3e')]();}function isNotNull(_0x4c88cb){return _0x4c88cb!==null&&!_['isUndefined'](_0x4c88cb);}function checkIsLoggedIn(_0xb5b387,_0x389200){return function(){if(_0x389200<=0x0){_0xb5b387['message']=_0x8b9a('0x3f');throw _0xb5b387[_0x8b9a('0x40')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x357b1a){return _0x357b1a;}function checkIsActive(_0x328ceb,_0x2edb85){return function(){if(!isActive(_0x2edb85)){_0x328ceb[_0x8b9a('0x41')]='NOT_ACTIVE';throw _0x328ceb[_0x8b9a('0x40')]+_0x8b9a('0x42');}};}function checkInterval(_0x30acad){return function(){if(!isNotNull(_0x30acad['Interval'])){_0x30acad[_0x8b9a('0x41')]=_0x8b9a('0x43');throw _0x30acad[_0x8b9a('0x40')]+_0x8b9a('0x44');}if(!isNotNull(_0x30acad['Interval'][_0x8b9a('0x45')])){_0x30acad['message']=_0x8b9a('0x43');throw _0x30acad['name']+_0x8b9a('0x44');}if(!isNotNull(_[_0x8b9a('0x46')](_0x30acad[_0x8b9a('0x47')][_0x8b9a('0x45')]))){_0x30acad[_0x8b9a('0x41')]='INTERVAL_IS_NULL';throw _0x30acad[_0x8b9a('0x40')]+_0x8b9a('0x44');}};}function msgResponse(_0x217b04,_0x2281d9,_0x4a8b6b){return{'action':_0x217b04,'response':_0x2281d9,'message':_0x4a8b6b,'stack':_0x4a8b6b};}function myreject(_0x1acafc){return function(_0x5bb183){return _0x1acafc(msgResponse(_0x8b9a('0x48'),'Error',JSON[_0x8b9a('0x49')](_0x5bb183)));};}function getSeconds(_0xffb791,_0x8982b9){var _0x222cc2=moment(_0xffb791)[_0x8b9a('0x4a')](0x0);var _0x45967b=moment(_0x8982b9)[_0x8b9a('0x4a')](0x0);return _0x222cc2[_0x8b9a('0x4b')](_0x45967b,_0x8b9a('0x4c'));}function emit(_0x3e2b15,_0x52c296,_0x58a456){io['to'](_0x3e2b15)[_0x8b9a('0x4d')](_0x52c296,_0x58a456);}function emitVoiceQueueSummary(_0x29cfb3){if(_0x29cfb3[_0x8b9a('0x4e')]===_0x8b9a('0x4f')){var _0x142cee={'id':_0x29cfb3['id'],'name':_0x29cfb3[_0x8b9a('0x40')],'strategy':_0x29cfb3[_0x8b9a('0x50')],'answered':_0x29cfb3['answered'],'available':_0x29cfb3[_0x8b9a('0x51')],'loggedIn':_0x29cfb3['loggedIn'],'pTalking':_0x29cfb3[_0x8b9a('0x52')],'sumBillable':_0x29cfb3['sumBillable'],'sumDuration':_0x29cfb3[_0x8b9a('0x53')],'sumHoldTime':_0x29cfb3[_0x8b9a('0x54')]||0x0,'talking':_0x29cfb3[_0x8b9a('0x55')],'total':_0x29cfb3[_0x8b9a('0x56')],'type':_0x29cfb3[_0x8b9a('0x4e')],'unmanaged':_0x29cfb3['unmanaged'],'abandoned':_0x29cfb3['abandoned'],'waiting':_0x29cfb3[_0x8b9a('0x57')],'loggedInDb':_0x29cfb3[_0x8b9a('0x58')],'dialActive':_0x29cfb3['dialActive'],'dialMethod':_0x29cfb3[_0x8b9a('0x59')],'dialOriginateCallerIdName':_0x29cfb3[_0x8b9a('0x5a')],'dialOriginateCallerIdNumber':_0x29cfb3[_0x8b9a('0x5b')],'dialOriginateTimeout':_0x29cfb3[_0x8b9a('0x5c')],'dialPrefix':_0x29cfb3[_0x8b9a('0x5d')],'outboundAnswerAgiCallsDay':_0x29cfb3[_0x8b9a('0x5e')],'outboundAnswerCallsDay':_0x29cfb3[_0x8b9a('0x5f')],'outboundBlacklistCallsDay':_0x29cfb3[_0x8b9a('0x60')],'outboundBusyCallsDay':_0x29cfb3[_0x8b9a('0x61')],'outboundCongestionCallsDay':_0x29cfb3['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x29cfb3['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x29cfb3['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x29cfb3['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x29cfb3['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x29cfb3[_0x8b9a('0x62')],'outboundOriginateFailureCallsDay':_0x29cfb3[_0x8b9a('0x63')],'outboundReCallsDay':_0x29cfb3[_0x8b9a('0x64')],'outboundRejectCallsDay':_0x29cfb3[_0x8b9a('0x65')],'outboundUnknownCallsDay':_0x29cfb3[_0x8b9a('0x66')],'predictiveIntervalAnsweredCalls':_0x29cfb3[_0x8b9a('0x67')],'predictiveIntervalAvgHoldtime':_0x29cfb3[_0x8b9a('0x68')],'predictiveIntervalAvgTalktime':_0x29cfb3['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x29cfb3[_0x8b9a('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x29cfb3[_0x8b9a('0x6a')],'predictiveIntervalErlangCalls':_0x29cfb3['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x29cfb3[_0x8b9a('0x6b')],'predictiveIntervalHitRate':_0x29cfb3['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x29cfb3[_0x8b9a('0x6c')],'predictiveIntervalPauses':_0x29cfb3[_0x8b9a('0x6d')],'predictiveIntervalAvailable':_0x29cfb3[_0x8b9a('0x6e')],'predictiveIntervalTotalCalls':_0x29cfb3[_0x8b9a('0x6f')],'message':_0x29cfb3[_0x8b9a('0x41')],'originated':_0x29cfb3[_0x8b9a('0x70')],'erlangCalls':_0x29cfb3[_0x8b9a('0x71')],'erlangCallToSecond':_0x29cfb3[_0x8b9a('0x72')],'erlangAbandonmentRate':_0x29cfb3[_0x8b9a('0x73')],'erlangBusyFactor':_0x29cfb3[_0x8b9a('0x74')],'startPredictive':_0x29cfb3[_0x8b9a('0x75')],'startProgressive':_0x29cfb3[_0x8b9a('0x2b')]};if(_0x29cfb3['Trunk']){_0x142cee[_0x8b9a('0x76')]={'id':_0x29cfb3['Trunk']['id'],'name':_0x29cfb3[_0x8b9a('0x76')]['name'],'active':_0x29cfb3[_0x8b9a('0x76')][_0x8b9a('0x77')],'callerid':_0x29cfb3['Trunk'][_0x8b9a('0x78')]};}if(_0x29cfb3['Interval']){_0x142cee['Interval']={'id':_0x29cfb3[_0x8b9a('0x47')]['id'],'name':_0x29cfb3[_0x8b9a('0x47')][_0x8b9a('0x40')]};}var _0x3bc827=md5(JSON[_0x8b9a('0x49')](_0x142cee));if(_0x29cfb3[_0x8b9a('0x79')]!==_0x3bc827){_0x29cfb3[_0x8b9a('0x79')]=_0x3bc827;emit(util['format'](_0x8b9a('0x7a'),_0x142cee[_0x8b9a('0x40')]),_0x8b9a('0x7b'),_0x142cee);}}}function emitCampaignSummary(_0x5de693){if(_0x5de693[_0x8b9a('0x4e')]===_0x8b9a('0x7c')){emit(util['format']('campaign:ivr:%s',_0x5de693['name']),_0x8b9a('0x7d'),_0x5de693);}}function checkGetDataPredictive(_0x296931){if(isNotNull(_0x296931)&&!_['isEmpty'](_0x296931)){loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x7f'));loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x80'),_0x296931[_0x8b9a('0x6f')]);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x81'),_0x296931['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x82'),_0x296931[_0x8b9a('0x6a')]);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x83'),_0x296931[_0x8b9a('0x69')]);loggerPredictive[_0x8b9a('0x7e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x296931[_0x8b9a('0x68')]);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x84'),_0x296931['predictiveIntervalAvgTalktime']);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x85'));if(_0x296931[_0x8b9a('0x6f')]>0x0){if(!_[_0x8b9a('0x86')](_0x296931[_0x8b9a('0x87')])&&_0x296931[_0x8b9a('0x87')]>0x0){return!![];}loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x88'));if(!_['isUndefined'](_0x296931[_0x8b9a('0x68')])&&_0x296931[_0x8b9a('0x68')]>0x0){return!![];}loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x89'));}else{loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x8a'));}}else{loggerPredictive['info'](_0x8b9a('0x8b'));}return![];}function mergeDataErlangB(_0x3182e4){return function(_0x289a32){loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x8c'));loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x8d'),_0x289a32[_0x8b9a('0x71')]);loggerPredictive[_0x8b9a('0x7e')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x289a32[_0x8b9a('0x72')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x289a32[_0x8b9a('0x73')]);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x8e'),_0x289a32[_0x8b9a('0x74')]);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x8f'),_0x289a32['erlangAbandonmentRate']);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x85'));_[_0x8b9a('0x90')](_0x3182e4,_0x289a32);};}function getDiff(_0x59f947){var _0x26d19d=moment()[_0x8b9a('0x4a')](0x0);var _0x3ed6f5=moment(_0x59f947)[_0x8b9a('0x4a')](0x0);return _0x26d19d['diff'](_0x3ed6f5,_0x8b9a('0x4c'));}function ifInterval(_0x212d91,_0x42d387){if(_[_0x8b9a('0x86')](_0x42d387)){return![];}return getDiff(_0x42d387)<_0x212d91*0x3c;}function freeVariablesPredictive(_0xd82098){if(isNotNull(_0xd82098)){if(!_[_0x8b9a('0x86')](_0xd82098['startProgressive'])){_0xd82098[_0x8b9a('0x2b')]=undefined;loggerPredictive['info'](_0xd82098[_0x8b9a('0x40')],_0x8b9a('0x91'));}if(!_[_0x8b9a('0x86')](_0xd82098[_0x8b9a('0x75')])){_0xd82098[_0x8b9a('0x75')]=undefined;loggerPredictive[_0x8b9a('0x7e')](_0xd82098[_0x8b9a('0x40')],_0x8b9a('0x92'));}if(!_[_0x8b9a('0x86')](_0xd82098[_0x8b9a('0x93')])){clearInterval(_0xd82098[_0x8b9a('0x93')]);_0xd82098[_0x8b9a('0x93')]=undefined;loggerPredictive[_0x8b9a('0x7e')](_0xd82098[_0x8b9a('0x40')],_0x8b9a('0x94'));}}}function erlangb(_0x4a9df7,_0x6f01d7){if(_0x6f01d7===0x0){return 0x0;}var _0x3ad549=0x1;for(var _0x7a6d3a=0x1;_0x7a6d3a<=_0x6f01d7;_0x7a6d3a+=0x1){_0x3ad549=0x1+_0x3ad549*_0x7a6d3a/_0x4a9df7;}return 0x1/_0x3ad549;}function isVoiceQueueOutbound(_0xe30409){return _0xe30409===_0x8b9a('0x4f');}function isNotPreview(_0x3d8bc0){return _0x3d8bc0!==_0x8b9a('0x22');}function isCampaignIvr(_0x417dcc){return _0x417dcc===_0x8b9a('0x7c');}function getCallerId(_0x16d900,_0x2396ce,_0x5c0d6f){if(!_[_0x8b9a('0x86')](_0x5c0d6f)&&typeof _0x5c0d6f===_0x8b9a('0x95')&&!_[_0x8b9a('0x46')](_0x5c0d6f)){if(!_[_0x8b9a('0x86')](_0x2396ce)&&typeof _0x2396ce===_0x8b9a('0x95')&&!_[_0x8b9a('0x46')](_0x2396ce)){return util[_0x8b9a('0x96')](_0x8b9a('0x97'),_0x2396ce,_0x5c0d6f);}return util[_0x8b9a('0x96')]('\x22%s\x22\x20<%s>',_0x5c0d6f,_0x5c0d6f);}if(!_[_0x8b9a('0x86')](_0x16d900)&&typeof _0x16d900===_0x8b9a('0x95')&&!_[_0x8b9a('0x46')](_0x16d900)){return _0x16d900;}return _0x8b9a('0x98');}function loggerCatchQueueSummary(_0x4c2d2e,_0x1b9aa9){return function(_0x8bd119){freeVariablesPredictive(_0x1b9aa9);emitVoiceQueueSummary(_0x1b9aa9);emitCampaignSummary(_0x1b9aa9);loggerSyncQueueSummary['error'](_0x4c2d2e,util['inspect'](_0x8bd119,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xffdd92,_0x2ac522){return function(_0x59cdef){loggerPredictive[_0x8b9a('0x99')](_0x2ac522[_0x8b9a('0x40')],_0xffdd92);loggerPredictive[_0x8b9a('0x99')](_0x59cdef[_0x8b9a('0x9a')]);freeVariablesPredictive(_0x2ac522);};}function loggerCatch(_0x1f59f4){return function(_0x24bd9f){logger[_0x8b9a('0x99')](_0x1f59f4,util[_0x8b9a('0x9b')](_0x24bd9f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x185737){return _0x185737&&!_['isUndefined'](_0x185737)&&_0x185737[_0x8b9a('0x9c')]>0x0;}function decremetOriginate(_0x501de7){if(!_[_0x8b9a('0x86')](_0x501de7)&&_0x501de7!==null){if(typeof _0x501de7[_0x8b9a('0x70')]!==_0x8b9a('0x9d')){if(_0x501de7['originated']>0x0){_0x501de7['originated']-=0x1;}else{logger[_0x8b9a('0x99')](_0x8b9a('0x9e'));}}}else{logger[_0x8b9a('0x99')](_0x8b9a('0x9f'));}}function checkContactLowerLimitOriginate(_0x23016,_0x3b8be6,_0x59af42){if(_0x3b8be6>_0x59af42){for(var _0x11d911=0x0;_0x11d911<_0x3b8be6-_0x59af42;_0x11d911+=0x1){decremetOriginate(_0x23016);}}}function loggerGetContactDialer(_0x44cb25,_0x3b867b,_0x31ca82){return function(_0x24b483){checkContactLowerLimitOriginate(_0x3b867b,_0x31ca82,0x0);logger['error'](_0x44cb25,util[_0x8b9a('0x9b')](_0x24b483,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2cf51a){return function(_0x442feb){if(isNotNull(_0x442feb)&&isNotNull(_0x442feb[0x0])){if(_0x442feb[0x0][_0x8b9a('0xa0')]>0x0){_0x2cf51a[_0x8b9a('0x41')]=_0x8b9a('0xa1');logger[_0x8b9a('0x7e')](_0x8b9a('0xa2')+_0x2cf51a[_0x8b9a('0x40')],_0x442feb[0x0][_0x8b9a('0xa0')],_0x8b9a('0xa3'));}else{_0x2cf51a[_0x8b9a('0x41')]=_0x8b9a('0xa4');logger[_0x8b9a('0x7e')](_0x8b9a('0xa5')+_0x2cf51a[_0x8b9a('0x40')]);}}};}function notSendMessagesQueue(_0x52e3df){if(_0x52e3df[_0x8b9a('0xa6')]){freeVariablesPredictive(_0x52e3df);if(_0x52e3df[_0x8b9a('0x70')]===0x0&&_0x52e3df[_0x8b9a('0x55')]===0x0&&_0x52e3df[_0x8b9a('0x57')]===0x0&&(_0x52e3df[_0x8b9a('0x52')]||0x0)===0x0){_0x52e3df[_0x8b9a('0xa6')]=![];_0x52e3df['available']=0x0;_0x52e3df['message']=_0x8b9a('0xa7');loggerSyncQueueSummary['error'](_0x8b9a('0xa8'),_0x52e3df[_0x8b9a('0x40')],_0x8b9a('0xa9'));}else{_0x52e3df[_0x8b9a('0x41')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x8b9a('0x99')](_0x8b9a('0xa8'),_0x52e3df['name'],_0x8b9a('0xaa'));}emitVoiceQueueSummary(_0x52e3df);}}function notSendMessagesCampaign(_0x21e77a){if(_0x21e77a[_0x8b9a('0xa6')]){if(_0x21e77a['originated']===0x0){_0x21e77a[_0x8b9a('0xa6')]=![];_0x21e77a['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x8b9a('0x99')](_0x8b9a('0xab'),_0x21e77a[_0x8b9a('0x40')],_0x8b9a('0xa9'));}else{_0x21e77a[_0x8b9a('0x41')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x8b9a('0x99')](_0x8b9a('0xab'),_0x21e77a[_0x8b9a('0x40')],_0x8b9a('0xaa'));}emitCampaignSummary(_0x21e77a);}}function createObjHistory(_0x212155,_0x142d79,_0x917c0c,_0x4a2de0,_0x81752f){_0x212155[_0x8b9a('0x41')]=_0x917c0c;var _0x5be5de=new Action(_0x212155,_0x142d79);var _0x5c4f35=new History(_0x5be5de);_0x5c4f35[_0x8b9a('0xac')]=_0x4a2de0;_0x5c4f35['statedesc']=_0x81752f;_0x5c4f35[_0x8b9a('0xad')]=_0x5be5de[_0x8b9a('0xae')];return _0x5c4f35;}Dialer[_0x8b9a('0x1d')][_0x8b9a('0x3e')]=function(){var _0x2621b2=this;setInterval(function(){_0x2621b2[_0x8b9a('0xaf')](_0x2621b2[_0x8b9a('0x29')],_0x8b9a('0xb0'));_0x2621b2[_0x8b9a('0xaf')](_0x2621b2[_0x8b9a('0xb1')],_0x8b9a('0xb2'));},0x32c8);};Dialer['prototype'][_0x8b9a('0xaf')]=function(_0x5cd757,_0x511d33){var _0x247b24=this;for(var _0xc7d9cc in _0x5cd757){if(typeof _0x5cd757[_0xc7d9cc]!==_0x8b9a('0x9d')){this[_0x8b9a('0x21')][_0x8b9a('0x1e')](function(){if(!_[_0x8b9a('0xb3')](_0x5cd757[_0xc7d9cc])){return ami[_0x8b9a('0xb4')]({'action':_0x8b9a('0xb5'),'channel':_0x5cd757[_0xc7d9cc]['channel']})[_0x8b9a('0xb6')](function(_0x1f6b0d){if(_0x1f6b0d[_0x8b9a('0x41')]===_0x8b9a('0xb7')){setTimeout(function(){if(_0x5cd757[_0xc7d9cc]&&_0x5cd757[_0xc7d9cc][_0x8b9a('0x4e')]!=='ivr'){_0x247b24[_0x8b9a('0xb8')](_0x247b24['voiceQueues'][_0x5cd757[_0xc7d9cc][_0x8b9a('0xb9')]]);logger['error']('[Dialer][checkChannel]',_0x511d33,_0xc7d9cc,_0x5cd757[_0xc7d9cc][_0x8b9a('0xb9')]);delete _0x5cd757[_0xc7d9cc];}if(_0x5cd757[_0xc7d9cc]&&_0x5cd757[_0xc7d9cc][_0x8b9a('0x4e')]===_0x8b9a('0x7c')){_0x247b24[_0x8b9a('0xb8')](_0x247b24['campaigns'][_0x5cd757[_0xc7d9cc][_0x8b9a('0xb9')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x511d33,_0xc7d9cc,_0x5cd757[_0xc7d9cc][_0x8b9a('0xb9')]);delete _0x5cd757[_0xc7d9cc];}},0x2328);}});}});}}};Dialer[_0x8b9a('0x1d')]['countReScheduled']=function(_0x24b649){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopper['countReScheduled'](_0x24b649))[_0x8b9a('0xb6')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x8b9a('0xbc')]=function(_0x152c24){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopperBlack[_0x8b9a('0xbc')](_0x152c24))[_0x8b9a('0xb6')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x8b9a('0x1d')]['checkIsBlackListIvr']=function(_0x5800af){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopperBlack[_0x8b9a('0xbd')](_0x5800af))[_0x8b9a('0xb6')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0x8b9a('0xbe')]=function(_0x37f623){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopperHistory[_0x8b9a('0xbf')](_0x37f623))['catch'](loggerCatch(_0x8b9a('0xc0')));};Dialer['prototype']['rescheduleContact']=function(_0x59cad4){return BPromise['resolve']()[_0x8b9a('0xbb')](cmHopper[_0x8b9a('0xc1')](_0x59cad4))[_0x8b9a('0xb6')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0x8b9a('0xc2')]=function(_0x38893d,_0x1cef87,_0x516d2e){return BPromise['resolve']()[_0x8b9a('0xbb')](cmHopper[_0x8b9a('0xc2')](_0x38893d,_0x1cef87,_0x516d2e))[_0x8b9a('0xb6')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xc3')]=function(_0x2193f2,_0x4a0d4c,_0x2c7c34,_0x117bd0){return BPromise[_0x8b9a('0xba')]()['then'](cmHopper[_0x8b9a('0xc3')](_0x2193f2,_0x4a0d4c,_0x2c7c34,_0x117bd0))[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xc4')));};Dialer[_0x8b9a('0x1d')]['getContactDialerIvr']=function(_0x30b237,_0x599269,_0x506eae){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopper[_0x8b9a('0xc5')](_0x30b237,_0x599269,_0x506eae))[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xc4')));};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x136f7a){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](voiceQueueRt[_0x8b9a('0xc6')](_0x136f7a))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x8b9a('0x1d')]['moveContactManagedDialer']=function(_0x250b5c){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopper[_0x8b9a('0xc7')](_0x250b5c))['catch'](loggerCatch(_0x8b9a('0xc8')));};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xc9')]=function(_0x54914c){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopperHistory[_0x8b9a('0xc9')](_0x54914c))['catch'](loggerCatch(_0x8b9a('0xca')));};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xb8')]=function(_0x51807e){if(!_[_0x8b9a('0x86')](_0x51807e)&&_0x51807e!==null){if(typeof _0x51807e[_0x8b9a('0x70')]!=='undefined'){if(_0x51807e[_0x8b9a('0x70')]>0x0){_0x51807e[_0x8b9a('0x70')]-=0x1;}else{logger[_0x8b9a('0x99')](_0x8b9a('0xcb'));}}}else{logger[_0x8b9a('0x99')](_0x8b9a('0xcc'));}};Dialer['prototype'][_0x8b9a('0xcd')]=function(_0x38f182,_0xe2db90){var _0x4507b2=this;return function(_0x35ce40){_0x4507b2[_0x8b9a('0xb8')](_0xe2db90);logger[_0x8b9a('0x99')](_0x38f182,util[_0x8b9a('0x9b')](_0x35ce40,{'showHidden':![],'depth':null}));};};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xce')]=function(_0x5a2706,_0x3a3021,_0x32c61c){var _0xf8a48={'state':0x19,'statedesc':_0x8b9a('0xcf')};this[_0x8b9a('0xb8')](_0x3a3021);this[_0x8b9a('0xd0')](_[_0x8b9a('0x90')](_0xf8a48,_[_0x8b9a('0xd1')](_0x32c61c,['ContactId',_0x8b9a('0xd2'),'UserId','VoiceQueueId',_0x8b9a('0xd3')])),_0x8b9a('0xd4'),_0x8b9a('0xd5'));logger[_0x8b9a('0x99')](_0x5a2706);};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xd6')]=function(_0x492cfe){return _0x492cfe===_0x8b9a('0xd7');};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xd8')]=function(_0x59be09){return!_[_0x8b9a('0x86')](_0x59be09)&&_0x59be09&&!_['isUndefined'](_0x59be09[_0x8b9a('0x40')])&&!_['isUndefined'](_0x59be09[_0x8b9a('0x77')])&&_0x59be09['active']&&(this[_0x8b9a('0x26')][util['format']('SIP/%s',_0x59be09['name'])][_0x8b9a('0xb5')]===_0x8b9a('0xd9')||this[_0x8b9a('0x26')][util[_0x8b9a('0x96')]('SIP/%s',_0x59be09['name'])][_0x8b9a('0xb5')]===_0x8b9a('0xda'));};Dialer['prototype'][_0x8b9a('0xd0')]=function(_0x57d3b,_0xa7e2ec,_0x4fe326){this[_0x8b9a('0xc9')](_0x57d3b)[_0x8b9a('0xb6')](loggerCatch(_0xa7e2ec));this[_0x8b9a('0xc7')](_0x57d3b)['catch'](loggerCatch(_0x4fe326));};Dialer['prototype'][_0x8b9a('0x39')]=function(_0x2cf8af){var _0x754ce=this[_0x8b9a('0x29')][_0x2cf8af[_0x8b9a('0xdb')]];var _0x3adb01;if(!_[_0x8b9a('0xb3')](_0x2cf8af)&&!_[_0x8b9a('0xb3')](_0x2cf8af[_0x8b9a('0xdc')])&&!_[_0x8b9a('0xb3')](_0x2cf8af[_0x8b9a('0xdc')][_0x8b9a('0xdd')])&&_0x2cf8af[_0x8b9a('0xde')]===_0x8b9a('0xdf')&&_0x754ce){if(_0x754ce['type']!==_0x8b9a('0x7c')&&this[_0x8b9a('0x23')][_0x754ce[_0x8b9a('0xb9')]][_0x8b9a('0xe0')]&&_0x2cf8af[_0x8b9a('0xe1')]===_0x8b9a('0xe2')){delete this[_0x8b9a('0x29')][_0x2cf8af['uniqueid']];this[_0x8b9a('0xb8')](this[_0x8b9a('0x23')][_0x754ce[_0x8b9a('0xb9')]]);this['voiceQueues'][_0x754ce[_0x8b9a('0xb9')]]['outboundAnswerCallsDay']+=0x1;this[_0x8b9a('0x23')][_0x754ce[_0x8b9a('0xb9')]][_0x8b9a('0x5e')]+=0x1;_0x3adb01=new Hangup(_0x754ce,_0x2cf8af);_0x3adb01[_0x8b9a('0xac')]=0x12;_0x3adb01[_0x8b9a('0xe3')]=_0x8b9a('0xe4');_0x3adb01[_0x8b9a('0xe5')]=_0x8b9a('0xe6');this[_0x8b9a('0xd0')](_0x3adb01,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x754ce[_0x8b9a('0x4e')]!=='ivr'&&this[_0x8b9a('0x23')][_0x754ce[_0x8b9a('0xb9')]][_0x8b9a('0xe0')]&&_0x2cf8af[_0x8b9a('0xe1')]===_0x8b9a('0xe7')){var _0xf66d06=this;return new BPromise(function(_0x3a5d68,_0x2f502d){delete _0xf66d06[_0x8b9a('0x29')][_0x2cf8af[_0x8b9a('0xdb')]];_0xf66d06['updateOriginated'](_0xf66d06['voiceQueues'][_0x754ce[_0x8b9a('0xb9')]]);_0xf66d06[_0x8b9a('0x23')][_0x754ce[_0x8b9a('0xb9')]][_0x8b9a('0x5f')]+=0x1;_0xf66d06['voiceQueues'][_0x754ce[_0x8b9a('0xb9')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x43ce2e=_0xf66d06[_0x8b9a('0x23')][_0x754ce[_0x8b9a('0xb9')]];var _0x31dfc3=new Hangup(_0x754ce,_0x2cf8af);_0x31dfc3[_0x8b9a('0xac')]=0x13;_0x31dfc3['statedesc']=_0x8b9a('0xe8');_0x31dfc3[_0x8b9a('0xe5')]=_0x8b9a('0xe6');_0x31dfc3[_0x8b9a('0xe9')]+=0x1;_0x31dfc3[_0x8b9a('0xea')]+=0x1;_0x31dfc3[_0x8b9a('0xeb')]=!![];_0xf66d06[_0x8b9a('0xc9')](_0x31dfc3)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xec')));if(_0x31dfc3['countbusyretry']+_0x31dfc3[_0x8b9a('0xed')]+_0x31dfc3[_0x8b9a('0xee')]+_0x31dfc3[_0x8b9a('0xef')]+_0x31dfc3[_0x8b9a('0xf0')]+_0x31dfc3[_0x8b9a('0xf1')]+_0x31dfc3[_0x8b9a('0xe9')]+_0x31dfc3['countagentrejectretry']>=_0x43ce2e[_0x8b9a('0xf2')]){_0xf66d06[_0x8b9a('0xf3')](_0x31dfc3,_0x3a5d68,_0x2f502d,_0x8b9a('0xf4'));}else{if(_0x31dfc3[_0x8b9a('0xe9')]>=_0x43ce2e[_0x8b9a('0xf5')]){_0xf66d06[_0x8b9a('0xf6')](_0x31dfc3,_0x3a5d68,_0x2f502d,_0x8b9a('0xf7'));}else{_0xf66d06['rescheduleContact']({'active':![],'countmachineretry':_0x31dfc3[_0x8b9a('0xe9')],'scheduledat':moment()[_0x8b9a('0xf8')](_0x43ce2e['dialMachineRetryFrequency'],_0x8b9a('0xf9'))[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x31dfc3[_0x8b9a('0xfb')],'ListId':_0x31dfc3[_0x8b9a('0xd2')],'VoiceQueueId':_0x31dfc3['VoiceQueueId']||undefined,'CampaignId':_0x31dfc3[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xfc')));_0x3a5d68({'reschedule':0x1});}}});}if(_0x754ce['type']===_0x8b9a('0x7c')&&this[_0x8b9a('0x24')][_0x754ce['queue']][_0x8b9a('0xe0')]&&_0x2cf8af[_0x8b9a('0xe1')]===_0x8b9a('0xe2')){delete this['uniqueId'][_0x2cf8af[_0x8b9a('0xdb')]];this[_0x8b9a('0xb8')](this['campaigns'][_0x754ce[_0x8b9a('0xb9')]]);_0x3adb01=new Hangup(_0x754ce,_0x2cf8af);_0x3adb01[_0x8b9a('0xac')]=0x12;_0x3adb01[_0x8b9a('0xe3')]=_0x8b9a('0xe4');_0x3adb01[_0x8b9a('0xe5')]=_0x8b9a('0xe6');this[_0x8b9a('0xd0')](_0x3adb01,_0x8b9a('0xfd'),_0x8b9a('0xfe'));}if(_0x754ce[_0x8b9a('0x4e')]===_0x8b9a('0x7c')&&this[_0x8b9a('0x24')][_0x754ce[_0x8b9a('0xb9')]][_0x8b9a('0xe0')]&&_0x2cf8af[_0x8b9a('0xe1')]===_0x8b9a('0xe7')){var _0xf66d06=this;return new BPromise(function(_0x1d6acc,_0x3bcd33){delete _0xf66d06[_0x8b9a('0x29')][_0x2cf8af[_0x8b9a('0xdb')]];_0xf66d06['updateOriginated'](_0xf66d06[_0x8b9a('0x24')][_0x754ce['queue']]);_0xf66d06['campaigns'][_0x754ce['queue']]['outboundAnswerCallsDay']+=0x1;_0xf66d06[_0x8b9a('0x24')][_0x754ce[_0x8b9a('0xb9')]][_0x8b9a('0x5e')]+=0x1;var _0x153546=_0xf66d06[_0x8b9a('0x24')][_0x754ce[_0x8b9a('0xb9')]];var _0x43479a=new Hangup(_0x754ce,_0x2cf8af);_0x43479a[_0x8b9a('0xac')]=0x13;_0x43479a[_0x8b9a('0xe3')]='Machine';_0x43479a[_0x8b9a('0xe5')]='AMD';_0x43479a[_0x8b9a('0xe9')]+=0x1;_0x43479a['countglobal']+=0x1;_0x43479a[_0x8b9a('0xeb')]=!![];_0xf66d06[_0x8b9a('0xc9')](_0x43479a)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xec')));if(_0x43479a[_0x8b9a('0xff')]+_0x43479a[_0x8b9a('0xed')]+_0x43479a[_0x8b9a('0xee')]+_0x43479a['countnosuchnumberretry']+_0x43479a['countdropretry']+_0x43479a[_0x8b9a('0xf1')]+_0x43479a[_0x8b9a('0xe9')]+_0x43479a[_0x8b9a('0x100')]>=_0x153546[_0x8b9a('0xf2')]){_0xf66d06[_0x8b9a('0xf3')](_0x43479a,_0x1d6acc,_0x3bcd33,_0x8b9a('0xf4'));}else{if(_0x43479a['countmachineretry']>=_0x153546['dialMachineMaxRetry']){_0xf66d06[_0x8b9a('0xf6')](_0x43479a,_0x1d6acc,_0x3bcd33,_0x8b9a('0xf7'));}else{_0xf66d06[_0x8b9a('0xc1')]({'active':![],'countmachineretry':_0x43479a['countmachineretry'],'scheduledat':moment()[_0x8b9a('0xf8')](_0x153546[_0x8b9a('0x101')],_0x8b9a('0xf9'))[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x43479a[_0x8b9a('0xfb')],'ListId':_0x43479a[_0x8b9a('0xd2')],'VoiceQueueId':_0x43479a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x43479a[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xfc')));_0x1d6acc({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x8b9a('0x36')]=function(_0x14d8fe){var _0x12a755=this['uniqueId'][_0x14d8fe[_0x8b9a('0xdb')]];var _0x248236=this;var _0x22a6cb;if(_0x12a755&&_0x12a755['type']==='ivr'){delete this[_0x8b9a('0x29')][_0x14d8fe[_0x8b9a('0xdb')]];this['updateOriginated'](this[_0x8b9a('0x24')][_0x12a755[_0x8b9a('0xb9')]]);this['campaigns'][_0x12a755[_0x8b9a('0xb9')]]['ivrAnswerCallsDay']+=0x1;_0x22a6cb=new Hangup(_0x12a755,_0x14d8fe);this['createHistory'](_0x22a6cb)[_0x8b9a('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8b9a('0xc7')](_0x22a6cb)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x103')));}if(_0x12a755&&_0x12a755[_0x8b9a('0x4e')]!==_0x8b9a('0x7c')&&isNotNull(this[_0x8b9a('0x23')][_0x12a755[_0x8b9a('0xb9')]][_0x8b9a('0x104')])){delete this['uniqueId'][_0x14d8fe[_0x8b9a('0xdb')]];this['updateOriginated'](this['voiceQueues'][_0x12a755['queue']]);this['voiceQueues'][_0x12a755[_0x8b9a('0xb9')]][_0x8b9a('0x5f')]+=0x1;this[_0x8b9a('0x23')][_0x12a755[_0x8b9a('0xb9')]][_0x8b9a('0x5e')]+=0x1;_0x22a6cb=new Hangup(_0x12a755,_0x14d8fe);_0x22a6cb[_0x8b9a('0xac')]=0x10;_0x22a6cb[_0x8b9a('0xe3')]=_0x8b9a('0x105');_0x22a6cb[_0x8b9a('0xe5')]=_0x8b9a('0x106');this[_0x8b9a('0xc9')](_0x22a6cb)[_0x8b9a('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x22a6cb)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x103')));}if(_0x12a755&&_0x12a755[_0x8b9a('0x4e')]!==_0x8b9a('0x7c')&&!isNotNull(this[_0x8b9a('0x23')][_0x12a755[_0x8b9a('0xb9')]]['dialQueueProject'])){delete this['uniqueId'][_0x14d8fe['uniqueid']];this[_0x8b9a('0xb8')](this['voiceQueues'][_0x12a755[_0x8b9a('0xb9')]]);this['voiceQueues'][_0x12a755[_0x8b9a('0xb9')]]['outboundUnknownCallsDay']+=0x1;_0x22a6cb=new Hangup(_0x12a755,_0x14d8fe);_0x22a6cb[_0x8b9a('0xac')]=0xc;_0x22a6cb[_0x8b9a('0xe3')]=_0x14d8fe[_0x8b9a('0x107')];_0x22a6cb[_0x8b9a('0xe5')]='Unknow';this[_0x8b9a('0xc9')](_0x22a6cb)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8b9a('0xc7')](_0x22a6cb)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x103')));}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x33')]=function(_0x3f5fac){var _0x4aa3b3=this[_0x8b9a('0x29')][_0x3f5fac[_0x8b9a('0xdb')]];var _0x5c35b6=this;if(this[_0x8b9a('0x23')][_0x3f5fac['queue']]){if(_0x4aa3b3&&_0x4aa3b3[_0x8b9a('0x4e')]!==_0x8b9a('0x7c')){delete this[_0x8b9a('0x29')][_0x3f5fac[_0x8b9a('0xdb')]];this[_0x8b9a('0x23')][_0x3f5fac[_0x8b9a('0xb9')]][_0x8b9a('0x5f')]+=0x1;var _0x1b88b5=new AgentComplete(_0x4aa3b3,_0x3f5fac);if(_0x3f5fac['reason']===_0x8b9a('0x108')){_0x1b88b5[_0x8b9a('0x109')]=this[_0x8b9a('0x23')][_0x3f5fac[_0x8b9a('0xb9')]]['dialQueueProject2']&&this[_0x8b9a('0x23')][_0x3f5fac[_0x8b9a('0xb9')]][_0x8b9a('0x10a')]?moment()[_0x8b9a('0x96')](_0x8b9a('0xfa')):undefined;}this['createHistory'](_0x1b88b5)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x10b')));this[_0x8b9a('0xc7')](_0x1b88b5)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x10c')));}}};Dialer['prototype']['syncAgentConnect']=function(_0x2bac3f){if(this[_0x8b9a('0x23')][_0x2bac3f[_0x8b9a('0xb9')]]){if(this['uniqueId'][_0x2bac3f[_0x8b9a('0xdb')]]&&this[_0x8b9a('0x29')][_0x2bac3f['uniqueid']][_0x8b9a('0x4e')]!==_0x8b9a('0x7c')){this[_0x8b9a('0xb8')](this['voiceQueues'][_0x2bac3f[_0x8b9a('0xb9')]]);this[_0x8b9a('0x29')][_0x2bac3f['uniqueid']]['answertime']=moment()[_0x8b9a('0x96')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x10d')]=function(_0x4aef91){this[_0x8b9a('0xc9')](_0x4aef91)[_0x8b9a('0xb6')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x8b9a('0xc7')](_0x4aef91)[_0x8b9a('0xb6')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x8b9a('0x1d')]['syncQueueCallerAbandon']=function(_0x6db64c){var _0x382cbd=this[_0x8b9a('0x29')][_0x6db64c[_0x8b9a('0xdb')]];var _0x43d7e8=this;if(this['voiceQueues'][_0x6db64c[_0x8b9a('0xb9')]]){if(_0x382cbd&&_0x382cbd[_0x8b9a('0x4e')]!=='ivr'){delete this[_0x8b9a('0x29')][_0x6db64c[_0x8b9a('0xdb')]];this[_0x8b9a('0xb8')](this['voiceQueues'][_0x6db64c[_0x8b9a('0xb9')]]);_0x382cbd[_0x8b9a('0x10e')]=moment()[_0x8b9a('0x96')](_0x8b9a('0xfa'));var _0x422a81=new QueueCallerAbandon(_0x382cbd,_0x6db64c);if(getSeconds(_0x382cbd[_0x8b9a('0x10e')],_0x382cbd[_0x8b9a('0x10f')])>=_0x382cbd['dialQueueTimeout']){this[_0x8b9a('0x23')][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x6a')]+=0x1;this[_0x8b9a('0x23')][_0x6db64c[_0x8b9a('0xb9')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x6b')]+=0x1;_0x422a81['state']=0xa;_0x422a81[_0x8b9a('0xe3')]=_0x8b9a('0x110');_0x422a81['dropreason']=_0x8b9a('0x111');_0x422a81[_0x8b9a('0x109')]=this[_0x8b9a('0x23')][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x112')]?moment()[_0x8b9a('0x96')](_0x8b9a('0xfa')):undefined;_0x422a81['countdropretry']+=0x1;_0x422a81['countglobal']+=0x1;if(_0x422a81[_0x8b9a('0xf0')]>=this[_0x8b9a('0x23')][_0x6db64c[_0x8b9a('0xb9')]]['dialDropMaxRetry']){this[_0x8b9a('0x10d')](_0x422a81);}else{this[_0x8b9a('0xc1')]({'active':![],'countdropretry':_0x422a81[_0x8b9a('0xf0')],'scheduledat':moment()[_0x8b9a('0xf8')](this['voiceQueues'][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x113')],_0x8b9a('0xf9'))[_0x8b9a('0x96')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x382cbd[_0x8b9a('0xfb')],'ListId':_0x382cbd[_0x8b9a('0xd2')],'VoiceQueueId':_0x382cbd['VoiceQueueId']||undefined,'CampaignId':_0x382cbd[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch('[rescheduleContact][Drop]'));var _0x34e3ec=new History(_0x422a81);_0x34e3ec[_0x8b9a('0xac')]=0xa;_0x34e3ec['statedesc']=_0x8b9a('0x110');_0x34e3ec[_0x8b9a('0xae')]=moment()[_0x8b9a('0x96')](_0x8b9a('0xfa'));_0x34e3ec[_0x8b9a('0xad')]=_0x34e3ec['starttime'];_0x34e3ec[_0x8b9a('0x114')]=_0x422a81[_0x8b9a('0x114')];_0x34e3ec['calleridnum']=_0x422a81['calleridnum'];this[_0x8b9a('0xc9')](_0x34e3ec)[_0x8b9a('0xb6')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x8b9a('0x23')][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x69')]+=0x1;this[_0x8b9a('0x23')][_0x6db64c['queue']][_0x8b9a('0x115')]+=0x1;_0x422a81[_0x8b9a('0xac')]=0xb;_0x422a81[_0x8b9a('0xe3')]=_0x8b9a('0x116');_0x422a81[_0x8b9a('0x117')]=_0x8b9a('0x118');_0x422a81[_0x8b9a('0xf1')]+=0x1;_0x422a81[_0x8b9a('0xea')]+=0x1;if(_0x422a81[_0x8b9a('0xf1')]>=this['voiceQueues'][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x119')]){this['queueCallerAbandonCreateState'](_0x422a81);}else{this[_0x8b9a('0xc1')]({'active':![],'countabandonedretry':_0x422a81[_0x8b9a('0xf1')],'scheduledat':moment()[_0x8b9a('0xf8')](this['voiceQueues'][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x11a')],'minutes')[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x382cbd[_0x8b9a('0xfb')],'ListId':_0x382cbd[_0x8b9a('0xd2')],'VoiceQueueId':_0x382cbd[_0x8b9a('0x102')]||undefined,'CampaignId':_0x382cbd[_0x8b9a('0xd3')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x34e3ec=new History(_0x422a81);_0x34e3ec[_0x8b9a('0xac')]=0xb;_0x34e3ec['statedesc']='Abandoned';_0x34e3ec[_0x8b9a('0xae')]=moment()['format'](_0x8b9a('0xfa'));_0x34e3ec[_0x8b9a('0xad')]=_0x34e3ec['starttime'];_0x34e3ec['calleridname']=_0x422a81[_0x8b9a('0x114')];_0x34e3ec[_0x8b9a('0x11b')]=_0x422a81[_0x8b9a('0x11b')];this[_0x8b9a('0xc9')](_0x34e3ec)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x11c')));}}}}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x37')]=function(_0xe4ec2d){if(this['actions'][_0xe4ec2d[_0x8b9a('0xdb')]]){this['actions'][_0xe4ec2d[_0x8b9a('0xdb')]][_0x8b9a('0x11d')]=_0xe4ec2d[_0x8b9a('0x11d')];}if(this[_0x8b9a('0x29')][_0xe4ec2d[_0x8b9a('0xdb')]]){this[_0x8b9a('0x29')][_0xe4ec2d[_0x8b9a('0xdb')]][_0x8b9a('0x11d')]=_0xe4ec2d['channel'];}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x3a')]=function(_0x2b79f5){if(strategy[this[_0x8b9a('0x23')][this['actions'][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]][_0x8b9a('0x50')]]==='roundrobin'){if(this[_0x8b9a('0xb1')][_0x2b79f5['actionid']]&&_[_0x8b9a('0xb3')](this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0x11f')])&&_0x2b79f5[_0x8b9a('0xb5')]==='1'&&_0x2b79f5['paused']==='0'){if(this[_0x8b9a('0x25')][_0x2b79f5[_0x8b9a('0x120')]]){if(!this[_0x8b9a('0x25')][_0x2b79f5[_0x8b9a('0x120')]][_0x8b9a('0x11f')]){this[_0x8b9a('0x25')][_0x2b79f5[_0x8b9a('0x120')]]['locked']=!![];this['actions'][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0x11f')]=!![];this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0x120')]=_0x2b79f5['stateinterface'];}}}}else if((strategy[this[_0x8b9a('0x23')][this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]][_0x8b9a('0x50')]]||'rrmemory')===_0x8b9a('0x1b')){if(this['actions'][_0x2b79f5[_0x8b9a('0x11e')]]){if(this['agents'][_0x2b79f5[_0x8b9a('0x120')]]){this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0x120')]=_0x2b79f5[_0x8b9a('0x120')];if(_[_0x8b9a('0xb3')](this[_0x8b9a('0x2d')][this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]])){this[_0x8b9a('0x2d')][this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]]['queue']]=[];}this[_0x8b9a('0x2d')][this[_0x8b9a('0xb1')][_0x2b79f5['actionid']][_0x8b9a('0xb9')]][_0x8b9a('0x121')](_[_0x8b9a('0x90')](_[_0x8b9a('0xd1')](this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]],['idHopper',_0x8b9a('0x120')]),{'status':_0x2b79f5[_0x8b9a('0xb5')],'paused':_0x2b79f5[_0x8b9a('0x122')]}));}}}};function unlockQueueStatus(_0x743f56,_0x59faa1){setTimeout(function(){if(_[_0x8b9a('0x86')](_0x743f56[_0x8b9a('0x123')])){loggerBooked[_0x8b9a('0x99')](_0x8b9a('0x124'),_0x59faa1);}_0x743f56[_0x8b9a('0x123')]=!![];loggerBooked['info'](_0x8b9a('0x125'),_0x59faa1,JSON['stringify'](_[_0x8b9a('0xd1')](_0x743f56,[_0x8b9a('0x40'),'queueStatusComplete'])));},0x1f3);}Dialer['prototype'][_0x8b9a('0x3c')]=function(_0x20948b){var _0x33494d=this;var _0x51fdf4=_0x33494d[_0x8b9a('0x23')][_0x33494d[_0x8b9a('0xb1')][_0x20948b['actionid']][_0x8b9a('0xb9')]];if(strategy[this[_0x8b9a('0x23')][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]][_0x8b9a('0x50')]]===_0x8b9a('0x1c')){if(this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]]&&this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0x120')]){this[_0x8b9a('0x22')][_0x8b9a('0x126')](this[_0x8b9a('0xb1')][_0x20948b['actionid']][_0x8b9a('0x127')],this[_0x8b9a('0xb1')][_0x20948b['actionid']][_0x8b9a('0x120')])[_0x8b9a('0xb6')](function(_0x4bc79d){logger['error'](_0x8b9a('0x128'),util[_0x8b9a('0x9b')](_0x4bc79d,{'showHidden':![],'depth':null}));})[_0x8b9a('0x20')](function(){_0x33494d[_0x8b9a('0xb8')](_0x33494d[_0x8b9a('0x23')][_0x33494d[_0x8b9a('0xb1')][_0x20948b['actionid']][_0x8b9a('0xb9')]]);_0x33494d[_0x8b9a('0x25')][_0x33494d['actions'][_0x20948b[_0x8b9a('0x11e')]]['stateinterface']][_0x8b9a('0x11f')]=![];delete _0x33494d[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]];unlockQueueStatus(_0x51fdf4);});}else{this[_0x8b9a('0xb8')](this[_0x8b9a('0x23')][this[_0x8b9a('0xb1')][_0x20948b['actionid']][_0x8b9a('0xb9')]]);this[_0x8b9a('0xc1')]({'active':![],'ContactId':this['actions'][_0x20948b['actionid']][_0x8b9a('0xfb')],'ListId':this['actions'][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xd2')],'VoiceQueueId':this['actions'][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0x102')]||undefined,'CampaignId':this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xd3')]||undefined})['catch'](loggerCatch(_0x8b9a('0x129')));delete this[_0x8b9a('0xb1')][_0x20948b['actionid']];unlockQueueStatus(_0x51fdf4);}}else if((strategy[this[_0x8b9a('0x23')][this[_0x8b9a('0xb1')][_0x20948b['actionid']][_0x8b9a('0xb9')]][_0x8b9a('0x50')]]||_0x8b9a('0x1b'))===_0x8b9a('0x1b')){var _0x2a3a51;if(this['actions'][_0x20948b['actionid']]&&!_['isEmpty'](this[_0x8b9a('0x2d')][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]])){if(this[_0x8b9a('0x12a')][_0x33494d[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]]){this[_0x8b9a('0x12a')][_0x33494d['actions'][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]]=this[_0x8b9a('0x12a')][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]]?this['queueBookedRR'][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]]['queue']]:this['queueBooked'][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]]?this['queueBooked'][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]]['queue']][_0x8b9a('0x12b')]||0x0:0x0;}this[_0x8b9a('0x2d')][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]][_0x8b9a('0x12b')]=this[_0x8b9a('0x12a')][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]];for(var _0x2ff76e=0x0;_0x2ff76e=0x0;})['catch'](myreject(_0x42bb0c)));}}else{_0x3c0b7e[_0x8b9a('0x121')](ami[_0x8b9a('0xb4')]({'action':'command','command':util['format']('iftime\x20%s,%s',_0x13521a,!_[_0x8b9a('0x86')](config['timezones'][_0x481299])?_0x481299:'')})[_0x8b9a('0xbb')](function(_0x3485b1){return _0x3485b1['content']['indexOf'](_0x8b9a('0x143'))>=0x0;})[_0x8b9a('0xb6')](myreject(_0x42bb0c)));}BPromise[_0x8b9a('0x144')](_0x3c0b7e)[_0x8b9a('0xbb')](function(_0x3915bc){var _0x2ccc46=_['some'](_0x3915bc);if(_0x2ccc46){return _0x10d36d(_0x2ccc46);}else{_0x5146c5[_0x8b9a('0x41')]=_0x59614d?_0x8b9a('0x145'):_0x8b9a('0x146');return _0x42bb0c(msgResponse(_0x8b9a('0x147'),_0x8b9a('0x13a'),_0x8b9a('0x148')+_0x59614d+'\x20'+_0xda19c+_0x8b9a('0x149')+util[_0x8b9a('0x9b')](_0x13521a,{'showHidden':![],'depth':null})+_0x8b9a('0x14a')+_0x481299));}})[_0x8b9a('0xb6')](function(_0x4c70b9){return _0x42bb0c(msgResponse(_0x8b9a('0x138'),'Failure',JSON[_0x8b9a('0x49')](_0x4c70b9)));});});};Dialer['prototype'][_0x8b9a('0x14b')]=function(_0x32396d){var _0x1618c2=this;return function(){switch(_0x32396d['dialMethod']){case _0x8b9a('0x14c'):freeVariablesPredictive(_0x32396d);_0x1618c2[_0x8b9a('0x14d')](_0x32396d,0x1);break;case'power':freeVariablesPredictive(_0x32396d);_0x1618c2[_0x8b9a('0x14d')](_0x32396d,_0x32396d['dialPowerLevel']);break;case _0x8b9a('0x9'):_0x1618c2['predictive'](_0x32396d);break;case _0x8b9a('0x14e'):freeVariablesPredictive(_0x32396d);_0x1618c2[_0x8b9a('0x14d')](_0x32396d,0x1);break;default:freeVariablesPredictive(_0x32396d);logger[_0x8b9a('0x99')]('Queue',_0x32396d[_0x8b9a('0x40')],_0x8b9a('0x14f'));}};};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x150')]=function(_0x583156){var _0x453ffc=this;return function(){_0x453ffc[_0x8b9a('0x151')](_0x583156);};};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xb')]=function(_0x4cfa13){var _0x562642=this;if(isNotPreview(_0x4cfa13[_0x8b9a('0x59')])){if(isVoiceQueueOutbound(_0x4cfa13[_0x8b9a('0x4e')])&&isActive(_0x4cfa13[_0x8b9a('0x152')])){_0x4cfa13[_0x8b9a('0xa6')]=!![];BPromise['resolve']()[_0x8b9a('0xbb')](checkIsLoggedIn(_0x4cfa13,_0x4cfa13[_0x8b9a('0x153')]))['then'](checkIsActive(_0x4cfa13,_0x4cfa13[_0x8b9a('0x152')]))[_0x8b9a('0xbb')](checkInterval(_0x4cfa13))[_0x8b9a('0xbb')](_0x562642['checkIsTrunkReachable'](_0x4cfa13))[_0x8b9a('0xbb')](_0x562642[_0x8b9a('0x154')](_0x4cfa13[_0x8b9a('0x155')],_0x4cfa13['dialTimezone'],_0x4cfa13[_0x8b9a('0x40')],_0x4cfa13))[_0x8b9a('0xbb')](_0x562642[_0x8b9a('0x139')](_0x4cfa13[_0x8b9a('0x47')],_0x4cfa13['dialTimezone'],_0x4cfa13[_0x8b9a('0x40')],_0x4cfa13))[_0x8b9a('0xbb')](_0x562642[_0x8b9a('0x14b')](_0x4cfa13))[_0x8b9a('0xb6')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4cfa13));}else{notSendMessagesQueue(_0x4cfa13);}}else{freeVariablesPredictive(_0x4cfa13);}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x133')]=function(){var _0x384670=this;var _0x29552f;for(var _0x497ca9 in this[_0x8b9a('0x24')]){if(typeof this[_0x8b9a('0x24')][_0x497ca9]!==_0x8b9a('0x9d')){_0x29552f=this[_0x8b9a('0x24')][_0x497ca9];if(isCampaignIvr(_0x29552f[_0x8b9a('0x4e')])&&isActive(_0x29552f[_0x8b9a('0x77')])){_0x29552f[_0x8b9a('0xa6')]=!![];BPromise['resolve']()[_0x8b9a('0xbb')](checkIsActive(_0x29552f,_0x29552f[_0x8b9a('0x77')]))[_0x8b9a('0xbb')](checkInterval(_0x29552f))['then'](_0x384670[_0x8b9a('0x134')](_0x29552f))[_0x8b9a('0xbb')](_0x384670['checkIfTime'](_0x29552f[_0x8b9a('0x155')],_0x29552f['dialTimezone'],_0x29552f[_0x8b9a('0x40')],_0x29552f))[_0x8b9a('0xbb')](_0x384670[_0x8b9a('0x139')](_0x29552f[_0x8b9a('0x47')],_0x29552f[_0x8b9a('0x156')],_0x29552f[_0x8b9a('0x40')],_0x29552f))[_0x8b9a('0xbb')](_0x384670[_0x8b9a('0x150')](_0x29552f))[_0x8b9a('0xb6')](loggerCatchQueueSummary(_0x8b9a('0x157'),_0x29552f));}else{notSendMessagesCampaign(_0x29552f);}}}};function getCallerIdRandom(_0x56452f,_0x3a2cb3){var _0xe004d6;var _0xf8783d;var _0x205372;if(_0x3a2cb3<=0x0){_0x3a2cb3=0x1;}_0xe004d6=new RegExp(_0x8b9a('0x158')+_0x3a2cb3+'}$');_0xf8783d=Math[_0x8b9a('0x159')](0xa,_0x3a2cb3-0x1);_0x205372=Math[_0x8b9a('0x159')](0xa,_0x3a2cb3)-0x1;return util[_0x8b9a('0x96')]('%s',_['replace'](_0x56452f,_0xe004d6,_[_0x8b9a('0x15a')](_0xf8783d,_0x205372)));}function extractCalleridName(_0x2118fa){var _0x10ab31=_0x2118fa[_0x8b9a('0x15b')](/"(.*?)"/);return _0x10ab31?_0x10ab31[0x1]:_0x2118fa;}function extractCalleridNumber(_0x2f6d8b){var _0x504e71=_0x2f6d8b[_0x8b9a('0x15b')](/<(.*?)>/);return _0x504e71?_0x504e71[0x1]:_0x2f6d8b;}Dialer[_0x8b9a('0x1d')][_0x8b9a('0x15c')]=function(_0x2abf72,_0x2d5184){var _0x5774b9=this;var _0x1080cf=uuid['v4']();this['actions'][_0x1080cf]=new Action(_0x2abf72,_0x2d5184,_0x1080cf);return new BPromise(function(_0x518fb3,_0x30c0e6){if(_[_0x8b9a('0x86')](_0x2abf72)&&typeof _0x2abf72!=='object'){return _0x30c0e6(msgResponse(_0x8b9a('0x15d'),_0x8b9a('0x13a'),_0x8b9a('0x15e')));}if(_['isUndefined'](_0x2d5184[_0x8b9a('0x15f')]['phone'])||_0x2d5184['Contact'][_0x8b9a('0x160')]===null){return _0x30c0e6(msgResponse('originate',_0x8b9a('0x13a'),'contact\x20is\x20undefine'));}var _0x57ae6a={'XMD-CALLERID':_0x5774b9[_0x8b9a('0xb1')][_0x1080cf][_0x8b9a('0x161')](),'XMD-AGI':_0x2abf72['dialQueueProject']?util[_0x8b9a('0x96')](_0x8b9a('0x162'),ipAgi,_0x2abf72[_0x8b9a('0x104')]):_0x8b9a('0x163'),'XMD-AGIAFTER':_0x2abf72[_0x8b9a('0x112')]?util['format'](_0x8b9a('0x162'),ipAgi,_0x2abf72['dialQueueProject2']):_0x8b9a('0x163'),'XMD-QUEUE':_0x2abf72[_0x8b9a('0x4e')]===_0x8b9a('0x4f')?util[_0x8b9a('0x96')](_0x8b9a('0x164'),_0x2abf72[_0x8b9a('0x40')],_0x2abf72[_0x8b9a('0x165')]||'',_0x2abf72[_0x8b9a('0x10a')]?'c':'',_0x2abf72[_0x8b9a('0x166')]||0x3):_0x8b9a('0x163'),'XMD-CONTACTID':_0x2d5184[_0x8b9a('0xfb')],'XMD-CDRTYPE':_0x8b9a('0x8'),'CALLERID(all)':_0x5774b9[_0x8b9a('0xb1')][_0x1080cf][_0x8b9a('0x161')](),'XMD-AMD':_0x2abf72['dialAMDActive']?'ACTIVE':'NONE','XMD-DESTINATION':_0x8b9a('0xdf')};if(_0x2abf72['dialAMDActive']){_0x57ae6a[_0x8b9a('0x167')]=_0x2abf72['dialAMDInitialSilence']||0x9c4;_0x57ae6a['XMD-AMDGREETING']=_0x2abf72[_0x8b9a('0x168')]||0x5dc;_0x57ae6a[_0x8b9a('0x169')]=_0x2abf72['dialAMDAfterGreetingSilence']||0x320;_0x57ae6a[_0x8b9a('0x16a')]=_0x2abf72['dialAMDTotalAnalysisTime']||0x1388;_0x57ae6a['XMD-AMDMINWORDLENGTH']=_0x2abf72['dialAMDMinWordLength']||0x64;_0x57ae6a['XMD-AMDBETWEENWORDSSILENCE']=_0x2abf72['dialAMDBetweenWordsSilence']||0x32;_0x57ae6a['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2abf72[_0x8b9a('0x16b')]||0x3;_0x57ae6a['XMD-AMDSILENCETHRESHOLD']=_0x2abf72['dialAMDSilenceThreshold']||0x100;_0x57ae6a['XMD-AMDMAXIMUMWORDLENGTH']=_0x2abf72[_0x8b9a('0x16c')]||0x1388;}if(_0x2abf72[_0x8b9a('0x4e')]===_0x8b9a('0x4f')){_0x57ae6a[_0x8b9a('0x16d')]=_0x2d5184[_0x8b9a('0x102')];}else{_0x57ae6a[_0x8b9a('0x16e')]=_0x2d5184[_0x8b9a('0xd3')];}for(var _0x3181af in _0x2d5184[_0x8b9a('0x15f')]){if(typeof _0x2d5184[_0x8b9a('0x15f')][_0x3181af]!==_0x8b9a('0x9d')){if(isNotNull(_0x2d5184[_0x8b9a('0x15f')][_0x3181af])&&_0x3181af!=='id'&&_0x3181af!==_0x8b9a('0x16f')&&_0x3181af!==_0x8b9a('0x170')&&_0x3181af!=='updatedAt'){_0x57ae6a[util[_0x8b9a('0x96')](_0x8b9a('0x171'),'XMD-',_[_0x8b9a('0x172')](_0x3181af))]=_0x2d5184[_0x8b9a('0x15f')][_0x3181af];}}}var _0x765117=_0x5774b9[_0x8b9a('0xd8')](_0x2abf72['Trunk'])?getCallerId(_0x2abf72[_0x8b9a('0x76')]['callerid'],_0x2abf72[_0x8b9a('0x5a')],_0x2abf72[_0x8b9a('0x173')]>0x0?getCallerIdRandom(_0x2abf72[_0x8b9a('0x5b')],_0x2abf72[_0x8b9a('0x173')]):_0x2abf72[_0x8b9a('0x5b')]):getCallerId(_[_0x8b9a('0xb3')](_0x2abf72['TrunkBackup'])?_0x2abf72[_0x8b9a('0x76')][_0x8b9a('0x78')]:_0x2abf72['TrunkBackup'][_0x8b9a('0x78')],_0x2abf72[_0x8b9a('0x5a')],_0x2abf72[_0x8b9a('0x173')]>0x0?getCallerIdRandom(_0x2abf72[_0x8b9a('0x5b')],_0x2abf72['dialRandomLastDigitCallerIdNumber']):_0x2abf72[_0x8b9a('0x5b')]);if(_0x765117){_0x57ae6a['XMD-ORIGINATECALLERIDNAME']=_0x5774b9['actions'][_0x1080cf][_0x8b9a('0x174')]=extractCalleridName(_0x765117);_0x57ae6a['XMD-ORIGINATECALLERIDNUM']=_0x5774b9[_0x8b9a('0xb1')][_0x1080cf][_0x8b9a('0x175')]=extractCalleridNumber(_0x765117);}return ami[_0x8b9a('0xb4')]({'actionid':_0x1080cf,'action':_0x8b9a('0x15d'),'channel':_0x5774b9[_0x8b9a('0xd8')](_0x2abf72[_0x8b9a('0x76')])?util[_0x8b9a('0x96')]('SIP/%s/%s%s',_0x2abf72['Trunk'][_0x8b9a('0x40')],isNotNull(_0x2abf72['dialPrefix'])?_0x2abf72['dialPrefix'][_0x8b9a('0x176')]()||'':'',_0x2abf72[_0x8b9a('0x177')]>0x0?_0x2d5184[_0x8b9a('0x15f')][_0x8b9a('0x160')]['substring'](_0x2abf72[_0x8b9a('0x177')]):_0x2d5184[_0x8b9a('0x15f')][_0x8b9a('0x160')]):util[_0x8b9a('0x96')](_0x8b9a('0x178'),_[_0x8b9a('0xb3')](_0x2abf72[_0x8b9a('0x135')])?_0x2abf72[_0x8b9a('0x76')][_0x8b9a('0x40')]:_0x2abf72['TrunkBackup']['name'],isNotNull(_0x2abf72['dialPrefix'])?_0x2abf72[_0x8b9a('0x5d')][_0x8b9a('0x176')]()||'':'',_0x2abf72['dialCutDigit']>0x0?_0x2d5184['Contact'][_0x8b9a('0x160')][_0x8b9a('0x179')](_0x2abf72[_0x8b9a('0x177')]):_0x2d5184[_0x8b9a('0x15f')]['phone']),'callerid':_0x765117,'Exten':_0x8b9a('0xdf'),'Context':'from-sip','Priority':'1','variable':_0x57ae6a,'timeout':(_0x2abf72['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1080cf})[_0x8b9a('0xbb')](function(_0x12da83){return _0x518fb3(_0x12da83);})[_0x8b9a('0xb6')](function(_0x566e4c){_0x2abf72[_0x8b9a('0x63')]+=0x1;var _0x12746a=new History(_0x5774b9['actions'][_0x1080cf]);logger[_0x8b9a('0x99')](util[_0x8b9a('0x96')](_0x8b9a('0x17a'),JSON[_0x8b9a('0x49')](_0x566e4c)));_0x12746a[_0x8b9a('0xac')]=0xe;_0x12746a[_0x8b9a('0xe3')]=_0x8b9a('0x17b');_0x12746a['starttime']=moment()[_0x8b9a('0x96')](_0x8b9a('0xfa'));_0x12746a[_0x8b9a('0xad')]=_0x12746a[_0x8b9a('0xae')];_0x5774b9['createHistory'](_0x12746a)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x17c')));_0x5774b9['moveContactManagedDialer'](_0x12746a)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x17c')))['finally'](function(){delete _0x5774b9[_0x8b9a('0xb1')][_0x1080cf];return _0x30c0e6(msgResponse(_0x8b9a('0x15d'),_0x8b9a('0x17d'),_0x8b9a('0x17e')));});});});};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x31')]=function(_0x4ef5b8){var _0x3ffb81=this[_0x8b9a('0xb1')][_0x4ef5b8[_0x8b9a('0x11e')]];if(_0x3ffb81){delete this[_0x8b9a('0xb1')][_0x4ef5b8[_0x8b9a('0x11e')]];_0x3ffb81[_0x8b9a('0x10f')]=moment()[_0x8b9a('0x96')](_0x8b9a('0xfa'));var _0x25cebf=_0x3ffb81[_0x8b9a('0x4e')]==='ivr'?this[_0x8b9a('0x24')][_0x3ffb81[_0x8b9a('0xb9')]]:this['voiceQueues'][_0x3ffb81['getQueue']()];if(!this[_0x8b9a('0xd6')](_0x4ef5b8[_0x8b9a('0x17f')])){this['updateOriginated'](_0x25cebf);return this['callProgressDetecting'](_0x3ffb81,_0x25cebf,_0x4ef5b8)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this[_0x8b9a('0x29')][_0x4ef5b8['uniqueid']]=_0x3ffb81;}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x180')]=function(_0x1baa15,_0x33527d,_0x2c06a8){var _0x33cc5a=new History(_0x33527d);if(_0x33cc5a[_0x8b9a('0xff')]+_0x33cc5a[_0x8b9a('0xed')]+_0x33cc5a[_0x8b9a('0xee')]+_0x33cc5a[_0x8b9a('0xef')]+_0x33cc5a[_0x8b9a('0xf0')]+_0x33cc5a[_0x8b9a('0xf1')]+_0x33cc5a[_0x8b9a('0xe9')]+_0x33cc5a[_0x8b9a('0x100')]>=_0x2c06a8['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x1baa15){case 0x3:if(_0x33cc5a[_0x8b9a('0xee')]>=_0x2c06a8[_0x8b9a('0x181')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x33cc5a[_0x8b9a('0xee')]+=0x1,'scheduledat':moment()[_0x8b9a('0xf8')](_0x2c06a8[_0x8b9a('0x182')],_0x8b9a('0xf9'))['format'](_0x8b9a('0xfa')),'ContactId':_0x33cc5a[_0x8b9a('0xfb')],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x33cc5a['CampaignId']||undefined})['catch'](loggerCatch(_0x8b9a('0x183')));break;case 0x5:if(_0x33cc5a[_0x8b9a('0xff')]>=_0x2c06a8[_0x8b9a('0x184')]-0x1){return!![];}this[_0x8b9a('0xc1')]({'active':![],'countbusyretry':_0x33cc5a[_0x8b9a('0xff')]+=0x1,'scheduledat':moment()['add'](_0x2c06a8['dialBusyRetryFrequency'],_0x8b9a('0xf9'))[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x33cc5a[_0x8b9a('0xfb')],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x33cc5a['CampaignId']||undefined})[_0x8b9a('0xb6')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x33cc5a[_0x8b9a('0xed')]>=_0x2c06a8[_0x8b9a('0x185')]-0x1){return!![];}this[_0x8b9a('0xc1')]({'active':![],'countcongestionretry':_0x33cc5a['countcongestionretry']+=0x1,'scheduledat':moment()[_0x8b9a('0xf8')](_0x2c06a8[_0x8b9a('0x186')],_0x8b9a('0xf9'))[_0x8b9a('0x96')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33cc5a[_0x8b9a('0xfb')],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x33cc5a[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x187')));break;case 0x0:if(_0x33cc5a[_0x8b9a('0xef')]>=_0x2c06a8[_0x8b9a('0x188')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x33cc5a['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x8b9a('0xf8')](_0x2c06a8[_0x8b9a('0x189')],_0x8b9a('0xf9'))[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x33cc5a['ContactId'],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a['VoiceQueueId']||undefined,'CampaignId':_0x33cc5a[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x18a')));}break;case 0xa:if(_0x33cc5a['countdropretry']>=_0x2c06a8[_0x8b9a('0x18b')]-0x1){return!![];}this[_0x8b9a('0xc1')]({'active':![],'countdropretry':_0x33cc5a[_0x8b9a('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x2c06a8[_0x8b9a('0x113')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33cc5a['ContactId'],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x33cc5a[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x18c')));break;case 0xb:if(_0x33cc5a['countabandonedretry']>=_0x2c06a8[_0x8b9a('0x119')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x33cc5a['countabandonedretry']+=0x1,'scheduledat':moment()[_0x8b9a('0xf8')](_0x2c06a8[_0x8b9a('0x11a')],'minutes')[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x33cc5a[_0x8b9a('0xfb')],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x33cc5a['CampaignId']||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x18d')));break;case 0x13:if(_0x33cc5a[_0x8b9a('0xe9')]>=_0x2c06a8[_0x8b9a('0xf5')]-0x1){return!![];}this[_0x8b9a('0xc1')]({'active':![],'countmachineretry':_0x33cc5a[_0x8b9a('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x2c06a8[_0x8b9a('0x101')],_0x8b9a('0xf9'))[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x33cc5a[_0x8b9a('0xfb')],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a['VoiceQueueId']||undefined,'CampaignId':_0x33cc5a[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xfc')));break;case 0x14:if(_0x33cc5a[_0x8b9a('0x100')]>=_0x2c06a8[_0x8b9a('0x18e')]-0x1){return!![];}this[_0x8b9a('0xc1')]({'active':![],'countagentrejectretry':_0x33cc5a[_0x8b9a('0x100')]+=0x1,'scheduledat':moment()[_0x8b9a('0xf8')](_0x2c06a8['dialAgentRejectRetryFrequency'],_0x8b9a('0xf9'))[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x33cc5a[_0x8b9a('0xfb')],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x33cc5a['CampaignId']||undefined})[_0x8b9a('0xb6')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x8b9a('0x1d')]['callProgressDetecting']=function(_0x5e319c,_0x45a3e4,_0x458f0c){var _0x58a57e=this;var _0x15a7c2=new History(_0x5e319c);return new BPromise(function(_0x3d125d,_0x4f7d4b){if(_[_0x8b9a('0x86')](_0x45a3e4)&&typeof _0x45a3e4!==_0x8b9a('0x18f')){return _0x4f7d4b(msgResponse(_0x8b9a('0x190'),_0x8b9a('0x13a'),_0x8b9a('0x191')));}if(_[_0x8b9a('0x86')](_0x458f0c)&&typeof _0x458f0c!=='object'){return _0x4f7d4b(msgResponse(_0x8b9a('0x190'),_0x8b9a('0x13a'),_0x8b9a('0x192')));}switch(_0x458f0c['reason']){case'0':_0x45a3e4[_0x8b9a('0x62')]+=0x1;_0x15a7c2[_0x8b9a('0xac')]=0x0;_0x15a7c2[_0x8b9a('0xe3')]='NoSuchNumber';_0x15a7c2[_0x8b9a('0xef')]+=0x1;_0x15a7c2[_0x8b9a('0xea')]+=0x1;ami['emit'](_0x8b9a('0x193'),ut[_0x8b9a('0x194')](_0x5e319c,_0x8b9a('0x195')));_0x58a57e['createHistory'](_0x15a7c2)['catch'](loggerCatch(_0x8b9a('0xec')));if(_0x58a57e[_0x8b9a('0x180')](0x0,_0x5e319c,_0x45a3e4)){if(_0x15a7c2['countnosuchnumberretry']>=_0x45a3e4['dialNoSuchNumberMaxRetry']){_0x58a57e[_0x8b9a('0xf6')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x196'));}else{_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x45a3e4[_0x8b9a('0x197')]+=0x1;_0x15a7c2[_0x8b9a('0xac')]=0x3;_0x15a7c2['statedesc']=_0x8b9a('0x198');_0x15a7c2[_0x8b9a('0xee')]+=0x1;_0x15a7c2[_0x8b9a('0xea')]+=0x1;ami[_0x8b9a('0x4d')]('custom:agentnoanswer',ut['buildObj'](_0x5e319c,_0x8b9a('0x199')));_0x58a57e['createHistory'](_0x15a7c2)[_0x8b9a('0xb6')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x58a57e[_0x8b9a('0x180')](0x3,_0x5e319c,_0x45a3e4)){if(_0x15a7c2['countnoanswerretry']>=_0x45a3e4['dialNoAnswerMaxRetry']){_0x58a57e[_0x8b9a('0xf6')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x19a'));}else{_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x45a3e4['outboundBusyCallsDay']+=0x1;_0x15a7c2['state']=0x5;_0x15a7c2[_0x8b9a('0xe3')]=_0x8b9a('0x19b');_0x15a7c2[_0x8b9a('0xff')]+=0x1;_0x15a7c2[_0x8b9a('0xea')]+=0x1;ami[_0x8b9a('0x4d')](_0x8b9a('0x19c'),ut['buildObj'](_0x5e319c,_0x8b9a('0x19d')));_0x58a57e[_0x8b9a('0xc9')](_0x15a7c2)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x19e')));if(_0x58a57e[_0x8b9a('0x180')](0x5,_0x5e319c,_0x45a3e4)){if(_0x15a7c2[_0x8b9a('0xff')]>=_0x45a3e4[_0x8b9a('0x184')]){_0x58a57e['createStateFinal'](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x19f'));}else{_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x19f'));}}break;case'8':_0x45a3e4[_0x8b9a('0x1a0')]+=0x1;_0x15a7c2[_0x8b9a('0xac')]=0x8;_0x15a7c2['statedesc']=_0x8b9a('0x1a1');_0x15a7c2[_0x8b9a('0xed')]+=0x1;_0x15a7c2[_0x8b9a('0xea')]+=0x1;ami['emit']('custom:agentcongestion',ut[_0x8b9a('0x194')](_0x5e319c,_0x8b9a('0x1a2')));_0x58a57e[_0x8b9a('0xc9')](_0x15a7c2)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1a3')));if(_0x58a57e[_0x8b9a('0x180')](0x8,_0x5e319c,_0x45a3e4)){if(_0x15a7c2['countcongestionretry']>=_0x45a3e4[_0x8b9a('0x185')]){_0x58a57e[_0x8b9a('0xf6')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x1a4'));}else{_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x1a4'));}}break;case'11':_0x45a3e4['outboundAbandonedCallsDay']+=0x1;_0x15a7c2[_0x8b9a('0xac')]=0xb;_0x15a7c2[_0x8b9a('0xe3')]='Abandoned';_0x15a7c2[_0x8b9a('0xf1')]+=0x1;_0x15a7c2[_0x8b9a('0xea')]+=0x1;_0x58a57e[_0x8b9a('0xc9')](_0x15a7c2)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x11c')));if(_0x58a57e[_0x8b9a('0x180')](0xb,_0x5e319c,_0x45a3e4)){if(_0x15a7c2[_0x8b9a('0xf1')]>=_0x45a3e4[_0x8b9a('0x119')]){_0x58a57e[_0x8b9a('0xf6')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x1a5'));}else{_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x1a5'));}}break;case'20':_0x45a3e4[_0x8b9a('0x65')]+=0x1;_0x15a7c2[_0x8b9a('0xac')]=0x14;_0x15a7c2[_0x8b9a('0xe3')]=_0x8b9a('0x1a6');_0x15a7c2[_0x8b9a('0x100')]+=0x1;_0x15a7c2[_0x8b9a('0xea')]+=0x1;ami[_0x8b9a('0x4d')](_0x8b9a('0x1a7'),ut[_0x8b9a('0x194')](_0x5e319c,_0x8b9a('0x1a8')));_0x58a57e[_0x8b9a('0xc9')](_0x15a7c2)['catch'](loggerCatch(_0x8b9a('0x1a9')));if(_0x58a57e[_0x8b9a('0x180')](0x14,_0x5e319c,_0x45a3e4)){if(_0x15a7c2['countagentrejectretry']>=_0x45a3e4[_0x8b9a('0x18e')]){_0x58a57e[_0x8b9a('0xf6')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x1aa'));}else{_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x1aa'));}}break;default:_0x45a3e4[_0x8b9a('0x66')]+=0x1;_0x15a7c2[_0x8b9a('0xac')]=0xc;_0x15a7c2['statedesc']=_0x458f0c[_0x8b9a('0x1ab')];_0x58a57e['createHistory'](_0x15a7c2)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1ac')));if(_0x58a57e[_0x8b9a('0x180')](_0x458f0c[_0x8b9a('0x1ab')],_0x5e319c,_0x45a3e4)){if(_0x15a7c2['countbusyretry']+_0x15a7c2[_0x8b9a('0xed')]+_0x15a7c2[_0x8b9a('0xee')]+_0x15a7c2['countnosuchnumberretry']+_0x15a7c2[_0x8b9a('0xf0')]+_0x15a7c2[_0x8b9a('0xf1')]+_0x15a7c2['countmachineretry']+_0x15a7c2[_0x8b9a('0x100')]>=_0x45a3e4[_0x8b9a('0xf2')]){_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x458f0c[_0x8b9a('0x1ab')]);}else{_0x58a57e[_0x8b9a('0xf6')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x458f0c[_0x8b9a('0x1ab')]);}}}});};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xf3')]=function(_0x31b12f,_0x462838,_0x282fb4,_0x52bce1){var _0x50cee7=new Final(_0x31b12f);_0x50cee7['state']=0xf;_0x50cee7[_0x8b9a('0xe3')]=_0x8b9a('0x1ad');this[_0x8b9a('0xf6')](_0x50cee7,_0x462838,_0x282fb4,_0x52bce1);};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xf6')]=function(_0x3fdde9,_0x4675fa,_0x2705b2,_0x46e4b0){this[_0x8b9a('0xc7')](_0x3fdde9)[_0x8b9a('0xbb')](function(){return _0x4675fa(msgResponse(_0x8b9a('0x190'),'Success',_0x46e4b0));})['catch'](function(){return _0x2705b2(msgResponse(_0x8b9a('0x1ae'),_0x8b9a('0x13a'),'contact\x20not\x20moved'));});};Dialer['prototype']['predictive']=function(_0x36f74d){var _0x1e26fe=_0x36f74d[_0x8b9a('0x1af')]/0x64;var _0x1e3952=_0x36f74d['outboundDropCallsDayTimeout']/(_0x36f74d[_0x8b9a('0x1b0')]+_0x36f74d[_0x8b9a('0x5f')]);var _0xe94a9d=Math[_0x8b9a('0x1b1')](_0x36f74d[_0x8b9a('0x6e')]*(_0x36f74d[_0x8b9a('0x1b2')]/0x64));var _0x211f27=Math[_0x8b9a('0x1b1')](_0x36f74d['predictiveIntervalAvailable']*(_0x36f74d[_0x8b9a('0x1b3')]/0x64));var _0x2d3e99=_0x36f74d[_0x8b9a('0x51')]+_0x36f74d[_0x8b9a('0x55')];var _0x4e467e=Math['floor'](_0x36f74d[_0x8b9a('0x71')]*_0x36f74d[_0x8b9a('0x73')]*_0x36f74d[_0x8b9a('0x1b4')]*_0x36f74d['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x36f74d['startProgressive'])){if(!_[_0x8b9a('0x86')](_0x36f74d[_0x8b9a('0x75')])){_0x36f74d[_0x8b9a('0x75')]=undefined;loggerPredictive[_0x8b9a('0x99')](_0x8b9a('0x1b5'),_0x8b9a('0x1b6'));}if(!_[_0x8b9a('0x86')](_0x36f74d[_0x8b9a('0x93')])){loggerPredictive['error'](_0x8b9a('0x1b5'),_0x8b9a('0x1b7'));clearInterval(_0x36f74d['handlePredictive']);_0x36f74d[_0x8b9a('0x93')]=undefined;}_0x36f74d['startProgressive']=moment()[_0x8b9a('0x96')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8b9a('0x7e')](_0x36f74d[_0x8b9a('0x40')],_0x8b9a('0x1b8'),_0x36f74d['startProgressive']);this[_0x8b9a('0x14d')](_0x36f74d,0x1);}else if(ifInterval(_0x36f74d[_0x8b9a('0x1b9')],_0x36f74d[_0x8b9a('0x2b')])){this[_0x8b9a('0x14d')](_0x36f74d,0x1);loggerPredictiveCalls[_0x8b9a('0x7e')](_0x8b9a('0x1ba'),_0x36f74d[_0x8b9a('0x2b')],_0x36f74d[_0x8b9a('0x40')]);_0x36f74d[_0x8b9a('0x71')]=0x0;_0x36f74d[_0x8b9a('0x6b')]=0x0;}else if(_0x1e26fe<_0x1e3952&&_0x36f74d[_0x8b9a('0x1bb')]==='dropRate'){freeVariablesPredictive(_0x36f74d);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x1bc'),'Dropped\x20calls\x20day',_0x1e3952,_0x8b9a('0x2b'),_0x36f74d[_0x8b9a('0x40')]);}else if(_0x4e467e<_0x36f74d[_0x8b9a('0x6b')]&&_0x36f74d[_0x8b9a('0x1bb')]==='dropRate'){freeVariablesPredictive(_0x36f74d);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x1bd'),_0x8b9a('0x1be'),_0x4e467e,'Drop\x20in\x20this\x20interval',_0x36f74d[_0x8b9a('0x6b')],'startProgressive',_0x36f74d[_0x8b9a('0x40')]);}else if(!ifInterval(_0x36f74d[_0x8b9a('0x1b9')],_0x36f74d[_0x8b9a('0x2b')])&&_[_0x8b9a('0x86')](_0x36f74d['startPredictive'])&&!_['isUndefined'](_0x36f74d[_0x8b9a('0x2b')])){_0x36f74d[_0x8b9a('0x75')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x36f74d[_0x8b9a('0x40')],_0x8b9a('0x1bf'),_0x36f74d[_0x8b9a('0x75')]);this['averageHandleTime'](_0x36f74d[_0x8b9a('0x1b9')])[_0x8b9a('0xbb')](this[_0x8b9a('0x1c0')](_0x36f74d))[_0x8b9a('0xbb')](mergeDataErlangB(_0x36f74d))[_0x8b9a('0xbb')](this[_0x8b9a('0x1c1')](_0x36f74d))['catch'](loggerCatchPredictive(_0x8b9a('0x1c2'),_0x36f74d));}else if(!ifInterval(_0x36f74d['dialPredictiveInterval'],_0x36f74d['startPredictive'])){_0x36f74d[_0x8b9a('0x6b')]=0x0;_0x36f74d[_0x8b9a('0x75')]=moment()[_0x8b9a('0x96')](_0x8b9a('0xfa'));loggerPredictive['info'](_0x36f74d[_0x8b9a('0x40')],'recalculate\x20predictive\x20at',_0x36f74d[_0x8b9a('0x75')]);clearInterval(_0x36f74d[_0x8b9a('0x93')]);_0x36f74d[_0x8b9a('0x93')]=undefined;this[_0x8b9a('0xbe')](_0x36f74d['dialPredictiveInterval'])[_0x8b9a('0xbb')](this[_0x8b9a('0x1c0')](_0x36f74d))[_0x8b9a('0xbb')](mergeDataErlangB(_0x36f74d))[_0x8b9a('0xbb')](this['startMethodPredictive'](_0x36f74d))[_0x8b9a('0xb6')](loggerCatchPredictive(_0x8b9a('0x1c3'),_0x36f74d));}else if(_0x36f74d[_0x8b9a('0x6e')]&&_0x2d3e99<_0x36f74d['predictiveIntervalAvailable']-_0x211f27){freeVariablesPredictive(_0x36f74d);loggerPredictive['info'](_0x36f74d[_0x8b9a('0x40')],_0x8b9a('0x1c4'),_0x2d3e99,')\x20are\x20less\x20than\x20threshold\x20(',_0x36f74d[_0x8b9a('0x6e')],'-',_0x211f27,'=',_0x36f74d[_0x8b9a('0x6e')]-_0x211f27,')');}else if(_0x36f74d[_0x8b9a('0x6e')]&&_0x2d3e99>_0x36f74d[_0x8b9a('0x6e')]+_0xe94a9d){freeVariablesPredictive(_0x36f74d);loggerPredictive[_0x8b9a('0x7e')](_0x36f74d[_0x8b9a('0x40')],_0x8b9a('0x1c4'),_0x2d3e99,_0x8b9a('0x1c5'),_0x36f74d[_0x8b9a('0x6e')],'+',_0xe94a9d,'=',_0x36f74d[_0x8b9a('0x6e')]+_0xe94a9d,')');}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x1c0')]=function(_0x103fbc){var _0x5a4777=this;return function(_0x184476){return new BPromise(function(_0x21132d,_0x2dd4e){_['merge'](_0x103fbc,_0x184476[0x0]);if(checkGetDataPredictive(_0x184476[0x0])){var _0x5a7de8=_0x103fbc[_0x8b9a('0x6e')]=_0x103fbc[_0x8b9a('0x55')]+_0x103fbc[_0x8b9a('0x51')];var _0x51e061=_0x103fbc['dialPredictiveInterval']*0x3c;var _0x222090=_0x184476[0x0][_0x8b9a('0x87')]+_0x184476[0x0][_0x8b9a('0x68')];var _0xa300f=(_0x184476[0x0][_0x8b9a('0x67')]+_0x184476[0x0][_0x8b9a('0x6a')]+_0x184476[0x0][_0x8b9a('0x69')])/_0x184476[0x0][_0x8b9a('0x6f')];_0x103fbc['predictiveIntervalHitRate']=_0xa300f>0x0?_0xa300f:0x1;switch(_0x103fbc[_0x8b9a('0x1bb')]){case _0x8b9a('0x1c6'):var _0x236e8d=_0x103fbc[_0x8b9a('0x1af')]/0x64;return _0x5a4777['abandonmentRate'](_0x5a7de8,_0x51e061,_0x222090,_0xa300f,_0x236e8d)[_0x8b9a('0xbb')](function(_0x2ebabb){return _0x21132d(_0x2ebabb);});case _0x8b9a('0x1c7'):var _0xa6f54e=_0x103fbc[_0x8b9a('0x1af')]/0x64;return _0x5a4777[_0x8b9a('0x1c8')](_0x5a7de8,_0x51e061,_0x222090,_0xa300f,_0xa6f54e)[_0x8b9a('0xbb')](function(_0x2091b4){return _0x21132d(_0x2091b4);});default:return _0x2dd4e(msgResponse(_0x8b9a('0x1c9'),_0x8b9a('0x13a'),_0x8b9a('0x1ca')));}}else{return _0x2dd4e(msgResponse(_0x8b9a('0x1c9'),_0x8b9a('0x13a'),_0x8b9a('0x1cb')));}});};};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x1cc')]=function(_0x25b8b9){var _0x34f7dc=this;return function(_0x454e66){return new BPromise(function(_0x9359e9,_0x52eca8){_[_0x8b9a('0x90')](_0x25b8b9,_0x454e66[0x0]);if(checkGetDataPredictive(_0x454e66[0x0])){loggerPredictive[_0x8b9a('0x7e')](JSON['stringify'](_0x454e66[0x0]));if(_0x25b8b9['dialPredictiveOptimization']==='dropRate'){return _0x34f7dc['getVoiceQueueRtPauses'](_0x25b8b9['id'])[_0x8b9a('0xbb')](function(_0x26bddd){var _0x5bd1dc=_0x25b8b9['loggedIn']-_0x26bddd[0x0][_0x8b9a('0x1cd')];var _0x2a3941=_0x25b8b9[_0x8b9a('0x1b9')]*0x3c;var _0x51ef32=_0x454e66[0x0]['predictiveIntervalAvgTalktime']+_0x454e66[0x0][_0x8b9a('0x68')];var _0x2730d1=(_0x454e66[0x0][_0x8b9a('0x67')]+_0x454e66[0x0][_0x8b9a('0x6a')]+_0x454e66[0x0][_0x8b9a('0x69')])/_0x454e66[0x0]['predictiveIntervalTotalCalls'];var _0x11c424=_0x25b8b9[_0x8b9a('0x1af')]/0x64;_0x25b8b9[_0x8b9a('0x6d')]=_0x26bddd[0x0][_0x8b9a('0x1cd')]||0x0;_0x25b8b9[_0x8b9a('0x1b4')]=_0x2730d1>0x0?_0x2730d1:0x1;return _0x34f7dc[_0x8b9a('0x1ce')](_0x5bd1dc,_0x2a3941,_0x51ef32,_0x2730d1,_0x11c424);})[_0x8b9a('0xbb')](function(_0x2b40d2){return _0x9359e9(_0x2b40d2);})[_0x8b9a('0xb6')](function(_0x592f8f){return _0x52eca8(msgResponse(_0x8b9a('0x1cf'),_0x8b9a('0x13a'),JSON[_0x8b9a('0x49')](_0x592f8f)));});}if(_0x25b8b9[_0x8b9a('0x1bb')]==='agentBusyFactor'){return _0x34f7dc[_0x8b9a('0xc6')](_0x25b8b9['id'])[_0x8b9a('0xbb')](function(_0x1f18c7){var _0x15635c=_0x25b8b9[_0x8b9a('0x153')]-_0x1f18c7[0x0]['outboundQueuePauses'];var _0x42ccd7=_0x25b8b9[_0x8b9a('0x1b9')]*0x3c;var _0x420d89=_0x454e66[0x0][_0x8b9a('0x87')]+_0x454e66[0x0][_0x8b9a('0x68')];var _0x52fd82=(_0x454e66[0x0][_0x8b9a('0x67')]+_0x454e66[0x0][_0x8b9a('0x6a')]+_0x454e66[0x0][_0x8b9a('0x69')])/_0x454e66[0x0][_0x8b9a('0x6f')];var _0x46c216=_0x25b8b9[_0x8b9a('0x1af')]/0x64;_0x25b8b9[_0x8b9a('0x6d')]=_0x1f18c7[0x0][_0x8b9a('0x1cd')]||0x0;_0x25b8b9['predictiveIntervalHitRate']=_0x52fd82>0x0?_0x52fd82:0x1;return _0x34f7dc[_0x8b9a('0x1c8')](_0x15635c,_0x42ccd7,_0x420d89,_0x52fd82,_0x46c216);})[_0x8b9a('0xbb')](function(_0xf9511c){return _0x9359e9(_0xf9511c);})[_0x8b9a('0xb6')](function(_0x1fcb29){return _0x52eca8(msgResponse(_0x8b9a('0x1cf'),_0x8b9a('0x13a'),JSON[_0x8b9a('0x49')](_0x1fcb29)));});}}else{return _0x52eca8(msgResponse(_0x8b9a('0x1c9'),_0x8b9a('0x13a'),'check\x20failure'));}});};};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x1c1')]=function(_0x3003dd){var _0xfb53f1=this;return function(){var _0x3dbf38=0x0;var _0x21d363=Math['floor'](_0x3003dd[_0x8b9a('0x72')]*0x3e8);if(_0x21d363>0x0){_0x21d363=_0x21d363<0x64?0x64:_0x21d363;loggerPredictive['info'](_0x3003dd['name'],_0x8b9a('0x1d0'),_0x21d363,'milliseconds');_0x3003dd['handlePredictive']=setInterval(function(){_0xfb53f1[_0x8b9a('0x93')](_0x3003dd);loggerPredictiveCalls[_0x8b9a('0x7e')](_0x8b9a('0x1d1'),_0x3dbf38+=0x1);},_0x21d363);}else{loggerPredictive[_0x8b9a('0x7e')](_0x3003dd[_0x8b9a('0x40')],_0x8b9a('0x1d2'));}};};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x1d3')]=function(_0x2afdc6,_0x12a267){var _0x4d274d=this;return function(_0x167e7d){if(_[_0x8b9a('0x46')](_0x167e7d)){if(_[_0x8b9a('0xb3')](_0x12a267[_0x8b9a('0x1d4')])||!_0x12a267[_0x8b9a('0x1d5')]){if(_0x2afdc6[_0x8b9a('0x59')]===_0x8b9a('0x14e')){_0x2afdc6['queueStatusComplete']=_[_0x8b9a('0x86')](_0x2afdc6[_0x8b9a('0x123')])?!![]:_0x2afdc6[_0x8b9a('0x123')];var _0x40dbbd=uuid['v4']();_0x4d274d['actions'][_0x40dbbd]=new Action(_0x2afdc6,_0x12a267,_0x40dbbd);loggerBooked['info'](_0x8b9a('0x1d6'),_0x40dbbd,_0x8b9a('0x1d7'),JSON['stringify'](_0x2afdc6[_0x8b9a('0x123')]),_0x8b9a('0x1d8'),_0x2afdc6[_0x8b9a('0x40')]);if(_0x2afdc6[_0x8b9a('0x123')]){_0x2afdc6[_0x8b9a('0x123')]=![];_0x4d274d[_0x8b9a('0x2d')][_0x4d274d[_0x8b9a('0xb1')][_0x40dbbd][_0x8b9a('0xb9')]]=[];ami['Action']({'actionid':_0x40dbbd,'action':_0x8b9a('0x1d9'),'queue':_0x2afdc6[_0x8b9a('0x40')]})[_0x8b9a('0xb6')](function(){_0x4d274d[_0x8b9a('0xb8')](_0x2afdc6);_0x4d274d[_0x8b9a('0xc1')]({'active':![],'ContactId':_0x4d274d['actions'][_0x40dbbd][_0x8b9a('0xfb')],'ListId':_0x4d274d[_0x8b9a('0xb1')][_0x40dbbd]['ListId'],'VoiceQueueId':_0x4d274d[_0x8b9a('0xb1')][_0x40dbbd][_0x8b9a('0x102')]||undefined,'CampaignId':_0x4d274d['actions'][_0x40dbbd][_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1da')));delete _0x4d274d[_0x8b9a('0xb1')][_0x40dbbd];});}else{loggerBooked[_0x8b9a('0x7e')](_0x8b9a('0x1db'),JSON[_0x8b9a('0x49')](_0x2afdc6[_0x8b9a('0x123')]),'Queue:\x20',_0x2afdc6[_0x8b9a('0x40')]);_0x4d274d[_0x8b9a('0xb8')](_0x2afdc6);_0x4d274d[_0x8b9a('0xc1')]({'active':![],'ContactId':_0x4d274d['actions'][_0x40dbbd][_0x8b9a('0xfb')],'ListId':_0x4d274d[_0x8b9a('0xb1')][_0x40dbbd][_0x8b9a('0xd2')],'VoiceQueueId':_0x4d274d[_0x8b9a('0xb1')][_0x40dbbd][_0x8b9a('0x102')]||undefined,'CampaignId':_0x4d274d[_0x8b9a('0xb1')][_0x40dbbd]['CampaignId']||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1da')));delete _0x4d274d[_0x8b9a('0xb1')][_0x40dbbd];}}else{return _0x4d274d[_0x8b9a('0x15c')](_0x2afdc6,_0x12a267);}}else{if(getDiff(_0x12a267[_0x8b9a('0x1dc')])<_0x2afdc6[_0x8b9a('0x1dd')]*0x3c){if(_0x12a267['Agent']&&!_0x12a267['Agent']['voicePause']){_0x4d274d[_0x8b9a('0x22')][_0x8b9a('0x126')](_0x12a267['id'])['finally'](function(){_0x4d274d['updateOriginated'](_0x2afdc6);});}else{_0x4d274d['unlockContact']({'active':![]},_0x12a267['id'],0x1)[_0x8b9a('0x20')](function(){_0x4d274d[_0x8b9a('0xb8')](_0x2afdc6);});}}else{_0x2afdc6[_0x8b9a('0x64')]+=0x1;_0x4d274d[_0x8b9a('0xb8')](_0x2afdc6);if(_0x2afdc6[_0x8b9a('0x1de')]){_0x4d274d['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x12a267[_0x8b9a('0xfb')],'ListId':_0x12a267['ListId'],'VoiceQueueId':_0x12a267[_0x8b9a('0x102')]||undefined,'CampaignId':_0x12a267[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1df')));_0x4d274d[_0x8b9a('0xc9')](createObjHistory(_0x2afdc6,_0x12a267,_0x8b9a('0x1e0'),0x17,_0x8b9a('0x1e1')))[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1e2')));}else{_0x4d274d[_0x8b9a('0xd0')](createObjHistory(_0x2afdc6,_0x12a267,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0x8b9a('0x1e3'));}}}}else{_0x2afdc6[_0x8b9a('0x60')]+=0x1;_0x4d274d[_0x8b9a('0xd0')](createObjHistory(_0x2afdc6,_0x12a267,_0x8b9a('0x1e4'),0xd,'Blacklist'),_0x8b9a('0x1e5'),_0x8b9a('0x1e6'));throw _0x8b9a('0x1e7');}};};Dialer['prototype'][_0x8b9a('0x151')]=function(_0x425fd0){var _0x4bff75=this;var _0xaed662=_0x425fd0[_0x8b9a('0x1e8')]-_0x425fd0['originated']-_0x425fd0[_0x8b9a('0x1e9')];emitCampaignSummary(_0x425fd0);if(_0xaed662>0x0){if(_0xaed662>this[_0x8b9a('0x27')]){_0xaed662=this[_0x8b9a('0x27')];}_0x425fd0[_0x8b9a('0x1e9')]+=_0xaed662;this[_0x8b9a('0xc5')](_0x425fd0['id'],_0xaed662,_0x425fd0['dialOrderByScheduledAt'])[_0x8b9a('0xbb')](function(_0x58466e){_0x425fd0[_0x8b9a('0x1e9')]-=_0xaed662;_0x425fd0[_0x8b9a('0x1e9')]=_0x425fd0[_0x8b9a('0x1e9')]>0x0?_0x425fd0[_0x8b9a('0x1e9')]:0x0;if(!checkContactEmpty(_0x58466e)){_0x425fd0[_0x8b9a('0x41')]=_0x8b9a('0xa4');logger['info']('[getContactCampaign2][Empty]'+_0x425fd0[_0x8b9a('0x40')]);}else{_0x425fd0[_0x8b9a('0x70')]+=_0x58466e[_0x8b9a('0x9c')];_0x425fd0['message']='RUNNING';for(var _0x5780f0=0x0;_0x5780f0<_0x58466e[_0x8b9a('0x9c')];_0x5780f0+=0x1){_0x425fd0[_0x8b9a('0x1ea')]+=0x1;if(_[_0x8b9a('0xb3')](_0x58466e[_0x5780f0])||_[_0x8b9a('0xb3')](_0x58466e[_0x5780f0][_0x8b9a('0x15f')])||_[_0x8b9a('0xb3')](_0x58466e[_0x5780f0][_0x8b9a('0x15f')][_0x8b9a('0x160')])){_0x4bff75[_0x8b9a('0xce')](_0x8b9a('0x1eb'),_0x425fd0,_0x58466e[_0x5780f0]);}else{_0x4bff75[_0x8b9a('0xbd')](_[_0x8b9a('0xd1')](_0x58466e[_0x5780f0],[_0x8b9a('0xd3'),_0x8b9a('0x1ec')]))[_0x8b9a('0xbb')](_0x4bff75['checkContactBlack'](_0x425fd0,_0x58466e[_0x5780f0]))[_0x8b9a('0xb6')](_0x4bff75[_0x8b9a('0xcd')](_0x8b9a('0x1ed'),_0x425fd0));}}}})[_0x8b9a('0xb6')](loggerGetContactDialer(_0x8b9a('0x1ee'),_0x425fd0,_0xaed662));}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x14d')]=function(_0x1f8087,_0x2b9eaa){var _0x49f071=this;var _0x39d484=[];var _0x412cce=_0x2b9eaa>=0x1?_0x2b9eaa:0x1;if(_0x1f8087[_0x8b9a('0x59')]===_0x8b9a('0x14e')){_0x412cce=0x1;}var _0x108a08=Math['floor'](_0x1f8087[_0x8b9a('0x51')]*_0x412cce)-_0x1f8087[_0x8b9a('0x70')]-_0x1f8087['temp'];emitVoiceQueueSummary(_0x1f8087);if(_0x1f8087[_0x8b9a('0x1ef')]>0x0){var _0x589d01=_0x1f8087[_0x8b9a('0x1ef')]-_0x1f8087[_0x8b9a('0x70')]-_0x1f8087[_0x8b9a('0x55')]-_0x1f8087[_0x8b9a('0x1e9')]-_0x1f8087[_0x8b9a('0x52')];if(_0x108a08>_0x589d01){_0x108a08=_0x589d01;}}if(_0x108a08>0x0){if(_0x1f8087[_0x8b9a('0x59')]===_0x8b9a('0x14e')){_0x108a08=0x1;}if(_0x108a08>this[_0x8b9a('0x27')]){_0x108a08=this[_0x8b9a('0x27')];}_0x1f8087[_0x8b9a('0x1e9')]+=_0x108a08;for(var _0xe1855a in this[_0x8b9a('0x25')]){if(typeof this[_0x8b9a('0x25')][_0xe1855a]!==_0x8b9a('0x9d')){if(this[_0x8b9a('0x25')][_0xe1855a]['state']===_0x8b9a('0x1f0')&&this['agents'][_0xe1855a]['status']==='reachable'){_0x39d484['push'](this[_0x8b9a('0x25')][_0xe1855a]['id']);}}}this[_0x8b9a('0xc3')](_0x1f8087['id'],_0x39d484,_0x108a08,_0x1f8087['dialOrderByScheduledAt'])['then'](function(_0x7c11e6){_0x1f8087[_0x8b9a('0x1e9')]-=_0x108a08;_0x1f8087[_0x8b9a('0x1e9')]=_0x1f8087[_0x8b9a('0x1e9')]>0x0?_0x1f8087[_0x8b9a('0x1e9')]:0x0;if(!checkContactEmpty(_0x7c11e6)){_0x49f071[_0x8b9a('0x1f1')](_0x1f8087)[_0x8b9a('0xbb')](sendMessageReschedule(_0x1f8087))['catch'](loggerCatch(_0x8b9a('0x1f2')));}else{_0x1f8087['originated']+=_0x7c11e6[_0x8b9a('0x9c')];_0x1f8087['message']=_0x1f8087['dialMethod']===_0x8b9a('0x14e')?_0x8b9a('0x1f3'):_0x8b9a('0x1f4');for(var _0x19f847=0x0;_0x19f847<_0x7c11e6[_0x8b9a('0x9c')];_0x19f847+=0x1){if(_['isNil'](_0x7c11e6[_0x19f847])||_[_0x8b9a('0xb3')](_0x7c11e6[_0x19f847][_0x8b9a('0x15f')])||_[_0x8b9a('0xb3')](_0x7c11e6[_0x19f847]['Contact']['phone'])){_0x49f071[_0x8b9a('0xce')](_0x8b9a('0x1eb'),_0x1f8087,_0x7c11e6[_0x19f847]);}else{_0x49f071[_0x8b9a('0xbc')](_['pick'](_0x7c11e6[_0x19f847],[_0x8b9a('0x102'),_0x8b9a('0x1ec')]))[_0x8b9a('0xbb')](_0x49f071[_0x8b9a('0x1d3')](_0x1f8087,_0x7c11e6[_0x19f847]))['catch'](_0x49f071[_0x8b9a('0xcd')](_0x8b9a('0x1eb'),_0x1f8087));}}}})[_0x8b9a('0xb6')](loggerGetContactDialer('[getContactDialer2]',_0x1f8087,_0x108a08));}};Dialer['prototype'][_0x8b9a('0x93')]=function(_0x3321f0){if(_0x3321f0[_0x8b9a('0x1ef')]>0x0){var _0x2d4e26=_0x3321f0[_0x8b9a('0x1ef')]-_0x3321f0[_0x8b9a('0x70')]-_0x3321f0[_0x8b9a('0x55')];if(_0x2d4e26>0x0){this['tryOriginatePredictive'](_0x3321f0);}else{loggerPredictiveCalls[_0x8b9a('0x7e')](_0x8b9a('0x1f5'));}}else{this[_0x8b9a('0x1f6')](_0x3321f0);}};Dialer['prototype'][_0x8b9a('0x1f6')]=function(_0x569e3b){var _0x52911e=this;var _0x19c8a1=[];_0x569e3b[_0x8b9a('0x70')]+=0x1;for(var _0x16f731 in this[_0x8b9a('0x25')]){if(typeof this[_0x8b9a('0x25')][_0x16f731]!==_0x8b9a('0x9d')){if(this[_0x8b9a('0x25')][_0x16f731]['state']==='not_inuse'&&this[_0x8b9a('0x25')][_0x16f731][_0x8b9a('0xb5')]===_0x8b9a('0xd9')){_0x19c8a1[_0x8b9a('0x121')](this[_0x8b9a('0x25')][_0x16f731]['id']);}}}this[_0x8b9a('0xc3')](_0x569e3b['id'],_0x19c8a1,0x1,_0x569e3b[_0x8b9a('0x1f7')])[_0x8b9a('0xbb')](function(_0x95afcf){if(!checkContactEmpty(_0x95afcf)){checkContactLowerLimitOriginate(_0x569e3b,0x1,0x0);_0x52911e[_0x8b9a('0x1f1')](_0x569e3b)[_0x8b9a('0xbb')](sendMessageReschedule(_0x569e3b))[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1f2')));}else{_0x569e3b[_0x8b9a('0x41')]=_0x8b9a('0x1f4');if(_[_0x8b9a('0xb3')](_0x95afcf[0x0])||_['isNil'](_0x95afcf[0x0]['Contact'])||_[_0x8b9a('0xb3')](_0x95afcf[0x0][_0x8b9a('0x15f')][_0x8b9a('0x160')])){_0x52911e['emptyContact'](_0x8b9a('0x1eb'),_0x569e3b,_0x95afcf[0x0]);}else{_0x52911e[_0x8b9a('0xbc')](_[_0x8b9a('0xd1')](_0x95afcf[0x0],['VoiceQueueId',_0x8b9a('0x1ec')]))[_0x8b9a('0xbb')](_0x52911e[_0x8b9a('0x1d3')](_0x569e3b,_0x95afcf[0x0]))[_0x8b9a('0xb6')](_0x52911e[_0x8b9a('0xcd')](_0x8b9a('0x1f8'),_0x569e3b));}}})[_0x8b9a('0xb6')](loggerGetContactDialer(_0x8b9a('0x1f9'),_0x569e3b,0x1));emitVoiceQueueSummary(_0x569e3b);};Dialer['prototype'][_0x8b9a('0x1ce')]=function(_0x95d6b6,_0x5ed152,_0x5d8232,_0x4deb90,_0x2cdf3b,_0x49ea18){loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x1fa'));loggerPredictive['info'](_0x8b9a('0x1fb'),_0x95d6b6);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ed152);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d8232);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x1fc'),_0x4deb90);loggerPredictive[_0x8b9a('0x7e')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2cdf3b);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x85'));return new BPromise(function(_0x701bd7,_0x328fbc){if(_0x95d6b6<=0x0||isNaN(_0x95d6b6)){return _0x328fbc(msgResponse(_0x8b9a('0x1fd'),_0x8b9a('0x17d'),_0x8b9a('0x1fe')+_0x95d6b6));}if(_0x5d8232<=0x0||isNaN(_0x5d8232)){return _0x328fbc(msgResponse(_0x8b9a('0x1fd'),_0x8b9a('0x17d'),_0x8b9a('0x1ff')+_0x5d8232));}if(_0x4deb90<=0x0||isNaN(_0x4deb90)){return _0x328fbc(msgResponse(_0x8b9a('0x1fd'),'Error',_0x8b9a('0x200')+_0x4deb90));}if(_0x5ed152<=0x0||isNaN(_0x5ed152)){return _0x328fbc(msgResponse(_0x8b9a('0x1fd'),_0x8b9a('0x17d'),_0x8b9a('0x201')+_0x5ed152));}if(_0x2cdf3b<=0x0||isNaN(_0x2cdf3b)){return _0x328fbc(msgResponse('[abandonmentRate]',_0x8b9a('0x17d'),'Amax\x20=\x20'+_0x2cdf3b));}_0x49ea18=_0x49ea18||0x0;var _0x501279=0x1/_0x5d8232;var _0x33f075=0x0;var _0x33fef2=0x0;var _0x208405=0x0;var _0x23f972=0x0;for(var _0x272c0a=0x0;_0x208405<_0x2cdf3b;_0x272c0a+=0x1){_0x33fef2=_0x272c0a/_0x5ed152;_0x33f075=(_0x4deb90*_0x33fef2+_0x49ea18)/_0x501279;_0x208405=erlangb(_0x33f075,_0x95d6b6);_0x23f972=_0x33f075/_0x95d6b6*(0x1-erlangb(_0x33f075,_0x95d6b6));}return _0x701bd7({'erlangCalls':_0x272c0a,'erlangCallToSecond':_0x5ed152/_0x272c0a,'erlangAbandonmentRate':_0x208405,'erlangBusyFactor':_0x23f972});});};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x1c8')]=function(_0x1483d2,_0x370135,_0x5355ad,_0x2fe1b2,_0x11874d,_0x39b182){loggerPredictive['info'](_0x8b9a('0x202'));loggerPredictive['info'](_0x8b9a('0x1fb'),_0x1483d2);loggerPredictive['info'](_0x8b9a('0x203'),_0x370135);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x204'),_0x5355ad);loggerPredictive[_0x8b9a('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',_0x2fe1b2);loggerPredictive['info'](_0x8b9a('0x205'),_0x11874d);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x85'));return new BPromise(function(_0x4cdc36,_0x5298c8){if(_0x1483d2<=0x0||isNaN(_0x1483d2)){return _0x5298c8(msgResponse('[busyFactor]',_0x8b9a('0x17d'),_0x8b9a('0x1fe')+_0x1483d2));}if(_0x5355ad<=0x0||isNaN(_0x5355ad)){return _0x5298c8(msgResponse(_0x8b9a('0x206'),_0x8b9a('0x17d'),_0x8b9a('0x1ff')+_0x5355ad));}if(_0x2fe1b2<=0x0||isNaN(_0x2fe1b2)){return _0x5298c8(msgResponse(_0x8b9a('0x206'),_0x8b9a('0x17d'),_0x8b9a('0x200')+_0x2fe1b2));}if(_0x370135<=0x0||isNaN(_0x370135)){return _0x5298c8(msgResponse(_0x8b9a('0x206'),_0x8b9a('0x17d'),_0x8b9a('0x201')+_0x370135));}if(_0x11874d<=0x0||isNaN(_0x11874d)){return _0x5298c8(msgResponse(_0x8b9a('0x206'),_0x8b9a('0x17d'),_0x8b9a('0x207')+_0x11874d));}_0x39b182=_0x39b182||0x0;var _0x2e1f9e=0x1/_0x5355ad;var _0x550224=0x0;var _0x379215=0x0;var _0xc3ff9e=0x0;var _0x3fc453=0x0;for(var _0xc50fae=0x0;_0x3fc453<_0x11874d;_0xc50fae+=0x1){_0x379215=_0xc50fae/_0x370135;_0x550224=(_0x2fe1b2*_0x379215+_0x39b182)/_0x2e1f9e;_0xc3ff9e=erlangb(_0x550224,_0x1483d2);_0x3fc453=_0x550224/_0x1483d2*(0x1-erlangb(_0x550224,_0x1483d2));}return _0x4cdc36({'erlangCalls':_0xc50fae,'erlangCallToSecond':_0x370135/_0xc50fae,'erlangAbandonmentRate':_0xc3ff9e,'erlangBusyFactor':_0x3fc453});});};module[_0x8b9a('0x208')]=Dialer; \ No newline at end of file +var _0x7b6f=['reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','check\x20failure','floor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','length','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\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','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','p\x20=\x20','Umin\x20=\x20','exports','util','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','emit','type','outbound','strategy','pTalking','sumDuration','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','seconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','inspect','stack','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','starttime','clearZombieChannels','uniqueId','[uniqueid]','isNil','Action','status','channel','ivr','[Dialer][checkChannel][ivr]','queue','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','catch','[checkIsBlackList]\x20','checkIsBlackListIvr','resolve','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','unmonitored','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','HangupInAMD','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','value','MACHINE','state','statedesc','Machine','AMD','countglobal','amd','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','dialMachineMaxRetry','dialMachineRetryFrequency','ContactId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','endtime','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','dialMethod','progressive','handlePower','power','Queue','launchHandleIvr','handleIvr','loggedIn','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','phone','Contact','originate','contact\x20is\x20undefine','getCaller','NONE','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-CAMPAIGNID','tags','createdAt','updatedAt','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','substring','from-sip','[originateError]:\x20%s','[originate][error]','response','[callProgressDetecting]\x20','countbusyretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','buildObj','noanswer'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7b6f,0x6c));var _0xf7b6=function(_0x30afec,_0x1b4f8d){_0x30afec=_0x30afec-0x0;var _0x4d74ec=_0x7b6f[_0x30afec];return _0x4d74ec;};'use strict';var util=require(_0xf7b6('0x0'));var _=require('lodash');var BPromise=require(_0xf7b6('0x1'));var uuid=require(_0xf7b6('0x2'));var moment=require(_0xf7b6('0x3'));var rr=require('rr');var md5=require(_0xf7b6('0x4'));var Redis=require(_0xf7b6('0x5'));var ut=require(_0xf7b6('0x6'));var config=require('../../../config/environment/');var logger=require(_0xf7b6('0x7'))(_0xf7b6('0x8'));var loggerBooked=require(_0xf7b6('0x7'))(_0xf7b6('0x9'));var loggerPredictive=require(_0xf7b6('0x7'))(_0xf7b6('0xa'));var loggerPredictiveCalls=require(_0xf7b6('0x7'))(_0xf7b6('0xb'));var loggerSyncQueueSummary=require(_0xf7b6('0x7'))(_0xf7b6('0xc'));var ami=require(_0xf7b6('0xd'));config['redis']=_[_0xf7b6('0xe')](config[_0xf7b6('0xf')],{'host':_0xf7b6('0x10'),'port':0x18eb});var io=require(_0xf7b6('0x11'))(new Redis(config[_0xf7b6('0xf')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xf7b6('0x12'));var Action=require(_0xf7b6('0x13'));var History=require(_0xf7b6('0x14'));var Final=require(_0xf7b6('0x15'));var AgentComplete=require(_0xf7b6('0x16'));var QueueCallerAbandon=require(_0xf7b6('0x17'));var Hangup=require(_0xf7b6('0x18'));var ipAgi=process[_0xf7b6('0x19')]['XCALLY_IP_AGI']||_0xf7b6('0x1a');var strategy={'rrmemory':_0xf7b6('0x1b'),'roundrobin':_0xf7b6('0x1c')};var Sequence=function(){};Sequence[_0xf7b6('0x1d')][_0xf7b6('0x1e')]=function(_0x1c29fa){this['tail']=this['tail']?this['tail'][_0xf7b6('0x1f')](_0x1c29fa):_0x1c29fa();};function Dialer(_0x2b0df9,_0x5f0601){this[_0xf7b6('0x20')]=new Sequence();this['preview']=_0x5f0601;this[_0xf7b6('0x21')]=_0x2b0df9[_0xf7b6('0x21')];this[_0xf7b6('0x22')]=_0x2b0df9[_0xf7b6('0x22')];this[_0xf7b6('0x23')]=_0x2b0df9['agents'];this[_0xf7b6('0x24')]=_0x2b0df9['trunks'];this[_0xf7b6('0x25')]=config[_0xf7b6('0x25')]||0x2;this['channels']={};this[_0xf7b6('0x26')]={};this[_0xf7b6('0x27')]={};this['uniqueId']={};this[_0xf7b6('0x28')]={};this[_0xf7b6('0x29')]={};this[_0xf7b6('0x2a')]={};this[_0xf7b6('0x2b')]={};this[_0xf7b6('0x2c')]={};this[_0xf7b6('0x2d')]={};ami['on'](_0xf7b6('0x2e'),this[_0xf7b6('0x2f')][_0xf7b6('0x30')](this));ami['on'](_0xf7b6('0x31'),this['syncQueueCallerAbandon'][_0xf7b6('0x30')](this));ami['on'](_0xf7b6('0x32'),this[_0xf7b6('0x33')][_0xf7b6('0x30')](this));ami['on'](_0xf7b6('0x34'),this[_0xf7b6('0x35')][_0xf7b6('0x30')](this));ami['on'](_0xf7b6('0x36'),this[_0xf7b6('0xc')]['bind'](this));ami['on'](_0xf7b6('0x37'),this[_0xf7b6('0x38')][_0xf7b6('0x30')](this));ami['on']('newexten',this[_0xf7b6('0x39')][_0xf7b6('0x30')](this));ami['on'](_0xf7b6('0x3a'),this['syncVarSet'][_0xf7b6('0x30')](this));ami['on']('queuemember',this['syncQueueMember'][_0xf7b6('0x30')](this));ami['on'](_0xf7b6('0x3b'),this[_0xf7b6('0x3c')][_0xf7b6('0x30')](this));this[_0xf7b6('0x3d')]();this[_0xf7b6('0x3e')]();}function isNotNull(_0xfdddef){return _0xfdddef!==null&&!_['isUndefined'](_0xfdddef);}function checkIsLoggedIn(_0x3cfec1,_0x15328a){return function(){if(_0x15328a<=0x0){_0x3cfec1[_0xf7b6('0x3f')]='AGENTS_NOT_LOGGED';throw _0x3cfec1[_0xf7b6('0x40')]+_0xf7b6('0x41');}};}function isActive(_0x130d4a){return _0x130d4a;}function checkIsActive(_0x3f05c2,_0x432cf5){return function(){if(!isActive(_0x432cf5)){_0x3f05c2[_0xf7b6('0x3f')]=_0xf7b6('0x42');throw _0x3f05c2[_0xf7b6('0x40')]+'\x20NOT\x20Active';}};}function checkInterval(_0x5345ef){return function(){if(!isNotNull(_0x5345ef[_0xf7b6('0x43')])){_0x5345ef['message']=_0xf7b6('0x44');throw _0x5345ef['name']+_0xf7b6('0x45');}if(!isNotNull(_0x5345ef[_0xf7b6('0x43')][_0xf7b6('0x46')])){_0x5345ef[_0xf7b6('0x3f')]='INTERVAL_IS_NULL';throw _0x5345ef[_0xf7b6('0x40')]+_0xf7b6('0x45');}if(!isNotNull(_['isEmpty'](_0x5345ef['Interval']['Intervals']))){_0x5345ef[_0xf7b6('0x3f')]='INTERVAL_IS_NULL';throw _0x5345ef[_0xf7b6('0x40')]+_0xf7b6('0x45');}};}function msgResponse(_0x28bf54,_0x7d096f,_0x1df77f){return{'action':_0x28bf54,'response':_0x7d096f,'message':_0x1df77f,'stack':_0x1df77f};}function myreject(_0x5111bf){return function(_0x146856){return _0x5111bf(msgResponse(_0xf7b6('0x47'),_0xf7b6('0x48'),JSON[_0xf7b6('0x49')](_0x146856)));};}function getSeconds(_0x4c4240,_0x21a2e8){var _0x119574=moment(_0x4c4240)[_0xf7b6('0x4a')](0x0);var _0x3c7fc1=moment(_0x21a2e8)[_0xf7b6('0x4a')](0x0);return _0x119574[_0xf7b6('0x4b')](_0x3c7fc1,'seconds');}function emit(_0x2069b1,_0x3261fd,_0x3ce128){io['to'](_0x2069b1)[_0xf7b6('0x4c')](_0x3261fd,_0x3ce128);}function emitVoiceQueueSummary(_0x16c012){if(_0x16c012[_0xf7b6('0x4d')]===_0xf7b6('0x4e')){var _0x1079be={'id':_0x16c012['id'],'name':_0x16c012['name'],'strategy':_0x16c012[_0xf7b6('0x4f')],'answered':_0x16c012['answered'],'available':_0x16c012['available'],'loggedIn':_0x16c012['loggedIn'],'pTalking':_0x16c012[_0xf7b6('0x50')],'sumBillable':_0x16c012['sumBillable'],'sumDuration':_0x16c012[_0xf7b6('0x51')],'sumHoldTime':_0x16c012['sumHoldTime']||0x0,'talking':_0x16c012['talking'],'total':_0x16c012['total'],'type':_0x16c012['type'],'unmanaged':_0x16c012[_0xf7b6('0x52')],'abandoned':_0x16c012[_0xf7b6('0x53')],'waiting':_0x16c012[_0xf7b6('0x54')],'loggedInDb':_0x16c012[_0xf7b6('0x55')],'dialActive':_0x16c012[_0xf7b6('0x56')],'dialMethod':_0x16c012['dialMethod'],'dialOriginateCallerIdName':_0x16c012['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x16c012[_0xf7b6('0x57')],'dialOriginateTimeout':_0x16c012[_0xf7b6('0x58')],'dialPrefix':_0x16c012[_0xf7b6('0x59')],'outboundAnswerAgiCallsDay':_0x16c012[_0xf7b6('0x5a')],'outboundAnswerCallsDay':_0x16c012[_0xf7b6('0x5b')],'outboundBlacklistCallsDay':_0x16c012[_0xf7b6('0x5c')],'outboundBusyCallsDay':_0x16c012[_0xf7b6('0x5d')],'outboundCongestionCallsDay':_0x16c012[_0xf7b6('0x5e')],'outboundDropCallsDayACS':_0x16c012[_0xf7b6('0x5f')],'outboundDropCallsDayCallersExit':_0x16c012['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x16c012['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x16c012[_0xf7b6('0x60')],'outboundNoSuchCallsDay':_0x16c012[_0xf7b6('0x61')],'outboundOriginateFailureCallsDay':_0x16c012[_0xf7b6('0x62')],'outboundReCallsDay':_0x16c012[_0xf7b6('0x63')],'outboundRejectCallsDay':_0x16c012[_0xf7b6('0x64')],'outboundUnknownCallsDay':_0x16c012[_0xf7b6('0x65')],'predictiveIntervalAnsweredCalls':_0x16c012[_0xf7b6('0x66')],'predictiveIntervalAvgHoldtime':_0x16c012[_0xf7b6('0x67')],'predictiveIntervalAvgTalktime':_0x16c012['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x16c012[_0xf7b6('0x68')],'predictiveIntervalDroppedCallsTimeout':_0x16c012[_0xf7b6('0x69')],'predictiveIntervalErlangCalls':_0x16c012[_0xf7b6('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x16c012[_0xf7b6('0x6b')],'predictiveIntervalHitRate':_0x16c012['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x16c012[_0xf7b6('0x6c')],'predictiveIntervalPauses':_0x16c012[_0xf7b6('0x6d')],'predictiveIntervalAvailable':_0x16c012[_0xf7b6('0x6e')],'predictiveIntervalTotalCalls':_0x16c012['predictiveIntervalTotalCalls'],'message':_0x16c012[_0xf7b6('0x3f')],'originated':_0x16c012[_0xf7b6('0x6f')],'erlangCalls':_0x16c012[_0xf7b6('0x70')],'erlangCallToSecond':_0x16c012[_0xf7b6('0x71')],'erlangAbandonmentRate':_0x16c012[_0xf7b6('0x72')],'erlangBusyFactor':_0x16c012[_0xf7b6('0x73')],'startPredictive':_0x16c012[_0xf7b6('0x29')],'startProgressive':_0x16c012['startProgressive']};if(_0x16c012[_0xf7b6('0x74')]){_0x1079be[_0xf7b6('0x74')]={'id':_0x16c012[_0xf7b6('0x74')]['id'],'name':_0x16c012['Trunk'][_0xf7b6('0x40')],'active':_0x16c012['Trunk'][_0xf7b6('0x75')],'callerid':_0x16c012[_0xf7b6('0x74')][_0xf7b6('0x76')]};}if(_0x16c012[_0xf7b6('0x43')]){_0x1079be[_0xf7b6('0x43')]={'id':_0x16c012[_0xf7b6('0x43')]['id'],'name':_0x16c012['Interval'][_0xf7b6('0x40')]};}var _0x2a9b5c=md5(JSON[_0xf7b6('0x49')](_0x1079be));if(_0x16c012[_0xf7b6('0x4')]!==_0x2a9b5c){_0x16c012['md5']=_0x2a9b5c;emit(util[_0xf7b6('0x77')](_0xf7b6('0x78'),_0x1079be[_0xf7b6('0x40')]),_0xf7b6('0x79'),_0x1079be);}}}function emitCampaignSummary(_0x44feac){if(_0x44feac['type']==='ivr'){emit(util[_0xf7b6('0x77')](_0xf7b6('0x7a'),_0x44feac[_0xf7b6('0x40')]),_0xf7b6('0x7b'),_0x44feac);}}function checkGetDataPredictive(_0x134b2c){if(isNotNull(_0x134b2c)&&!_[_0xf7b6('0x7c')](_0x134b2c)){loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x7e'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x134b2c['predictiveIntervalTotalCalls']);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x7f'),_0x134b2c[_0xf7b6('0x66')]);loggerPredictive['info'](_0xf7b6('0x80'),_0x134b2c[_0xf7b6('0x69')]);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x81'),_0x134b2c[_0xf7b6('0x68')]);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x82'),_0x134b2c[_0xf7b6('0x67')]);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x83'),_0x134b2c['predictiveIntervalAvgTalktime']);loggerPredictive[_0xf7b6('0x7d')]('---------------------------');if(_0x134b2c[_0xf7b6('0x84')]>0x0){if(!_[_0xf7b6('0x85')](_0x134b2c[_0xf7b6('0x86')])&&_0x134b2c[_0xf7b6('0x86')]>0x0){return!![];}loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x87'));if(!_[_0xf7b6('0x85')](_0x134b2c[_0xf7b6('0x67')])&&_0x134b2c[_0xf7b6('0x67')]>0x0){return!![];}loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x88'));}else{loggerPredictive['info'](_0xf7b6('0x89'));}}else{loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x8a'));}return![];}function mergeDataErlangB(_0x214eb8){return function(_0x38ed19){loggerPredictive['info'](_0xf7b6('0x8b'));loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x8c'),_0x38ed19['erlangCalls']);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x8d'),_0x38ed19[_0xf7b6('0x71')]);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x8e'),_0x38ed19[_0xf7b6('0x72')]);loggerPredictive[_0xf7b6('0x7d')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38ed19[_0xf7b6('0x73')]);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x8e'),_0x38ed19[_0xf7b6('0x72')]);loggerPredictive['info'](_0xf7b6('0x8f'));_[_0xf7b6('0x90')](_0x214eb8,_0x38ed19);};}function getDiff(_0x3af328){var _0x346723=moment()[_0xf7b6('0x4a')](0x0);var _0x297590=moment(_0x3af328)['milliseconds'](0x0);return _0x346723[_0xf7b6('0x4b')](_0x297590,_0xf7b6('0x91'));}function ifInterval(_0x3f8666,_0x27cd64){if(_[_0xf7b6('0x85')](_0x27cd64)){return![];}return getDiff(_0x27cd64)<_0x3f8666*0x3c;}function freeVariablesPredictive(_0x29ab13){if(isNotNull(_0x29ab13)){if(!_['isUndefined'](_0x29ab13[_0xf7b6('0x2a')])){_0x29ab13[_0xf7b6('0x2a')]=undefined;loggerPredictive[_0xf7b6('0x7d')](_0x29ab13[_0xf7b6('0x40')],_0xf7b6('0x92'));}if(!_[_0xf7b6('0x85')](_0x29ab13[_0xf7b6('0x29')])){_0x29ab13['startPredictive']=undefined;loggerPredictive['info'](_0x29ab13[_0xf7b6('0x40')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xf7b6('0x85')](_0x29ab13[_0xf7b6('0x93')])){clearInterval(_0x29ab13['handlePredictive']);_0x29ab13['handlePredictive']=undefined;loggerPredictive['info'](_0x29ab13[_0xf7b6('0x40')],_0xf7b6('0x94'));}}}function erlangb(_0x5053e4,_0x20e578){if(_0x20e578===0x0){return 0x0;}var _0x1d7380=0x1;for(var _0x3d0af2=0x1;_0x3d0af2<=_0x20e578;_0x3d0af2+=0x1){_0x1d7380=0x1+_0x1d7380*_0x3d0af2/_0x5053e4;}return 0x1/_0x1d7380;}function isVoiceQueueOutbound(_0x30882b){return _0x30882b===_0xf7b6('0x4e');}function isNotPreview(_0x5416e9){return _0x5416e9!=='preview';}function isCampaignIvr(_0x582fff){return _0x582fff==='ivr';}function getCallerId(_0x2b612a,_0x5e0c18,_0x1d137a){if(!_[_0xf7b6('0x85')](_0x1d137a)&&typeof _0x1d137a==='string'&&!_[_0xf7b6('0x7c')](_0x1d137a)){if(!_[_0xf7b6('0x85')](_0x5e0c18)&&typeof _0x5e0c18===_0xf7b6('0x95')&&!_['isEmpty'](_0x5e0c18)){return util['format']('\x22%s\x22\x20<%s>',_0x5e0c18,_0x1d137a);}return util[_0xf7b6('0x77')](_0xf7b6('0x96'),_0x1d137a,_0x1d137a);}if(!_[_0xf7b6('0x85')](_0x2b612a)&&typeof _0x2b612a==='string'&&!_[_0xf7b6('0x7c')](_0x2b612a)){return _0x2b612a;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x169a8b,_0x280873){return function(_0x3d6930){freeVariablesPredictive(_0x280873);emitVoiceQueueSummary(_0x280873);emitCampaignSummary(_0x280873);loggerSyncQueueSummary[_0xf7b6('0x97')](_0x169a8b,util[_0xf7b6('0x98')](_0x3d6930,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x58bbe7,_0x21c810){return function(_0x5c8a14){loggerPredictive[_0xf7b6('0x97')](_0x21c810[_0xf7b6('0x40')],_0x58bbe7);loggerPredictive[_0xf7b6('0x97')](_0x5c8a14[_0xf7b6('0x99')]);freeVariablesPredictive(_0x21c810);};}function loggerCatch(_0x3f7259){return function(_0x1cb4a6){logger[_0xf7b6('0x97')](_0x3f7259,util['inspect'](_0x1cb4a6,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x309bfb){return _0x309bfb&&!_[_0xf7b6('0x85')](_0x309bfb)&&_0x309bfb['length']>0x0;}function decremetOriginate(_0x3b9293){if(!_[_0xf7b6('0x85')](_0x3b9293)&&_0x3b9293!==null){if(typeof _0x3b9293[_0xf7b6('0x6f')]!==_0xf7b6('0x9a')){if(_0x3b9293[_0xf7b6('0x6f')]>0x0){_0x3b9293['originated']-=0x1;}else{logger[_0xf7b6('0x97')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xf7b6('0x97')](_0xf7b6('0x9b'));}}function checkContactLowerLimitOriginate(_0x2a50cc,_0xfe5856,_0x169ac1){if(_0xfe5856>_0x169ac1){for(var _0x4d16f8=0x0;_0x4d16f8<_0xfe5856-_0x169ac1;_0x4d16f8+=0x1){decremetOriginate(_0x2a50cc);}}}function loggerGetContactDialer(_0x595258,_0x1baa1a,_0x5e9305){return function(_0x164b47){checkContactLowerLimitOriginate(_0x1baa1a,_0x5e9305,0x0);logger[_0xf7b6('0x97')](_0x595258,util[_0xf7b6('0x98')](_0x164b47,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x160125){return function(_0x2d793c){if(isNotNull(_0x2d793c)&&isNotNull(_0x2d793c[0x0])){if(_0x2d793c[0x0][_0xf7b6('0x9c')]>0x0){_0x160125[_0xf7b6('0x3f')]=_0xf7b6('0x9d');logger[_0xf7b6('0x7d')]('[getContactDialer2][ReScheduled]'+_0x160125[_0xf7b6('0x40')],_0x2d793c[0x0]['contactsRescheduled'],_0xf7b6('0x9e'));}else{_0x160125[_0xf7b6('0x3f')]=_0xf7b6('0x9f');logger['info'](_0xf7b6('0xa0')+_0x160125[_0xf7b6('0x40')]);}}};}function notSendMessagesQueue(_0xa9af4a){if(_0xa9af4a[_0xf7b6('0xa1')]){freeVariablesPredictive(_0xa9af4a);if(_0xa9af4a[_0xf7b6('0x6f')]===0x0&&_0xa9af4a[_0xf7b6('0xa2')]===0x0&&_0xa9af4a['waiting']===0x0&&(_0xa9af4a[_0xf7b6('0x50')]||0x0)===0x0){_0xa9af4a[_0xf7b6('0xa1')]=![];_0xa9af4a[_0xf7b6('0xa3')]=0x0;_0xa9af4a['message']=_0xf7b6('0x42');loggerSyncQueueSummary['error'](_0xf7b6('0xa4'),_0xa9af4a[_0xf7b6('0x40')],_0xf7b6('0xa5'));}else{_0xa9af4a[_0xf7b6('0x3f')]=_0xf7b6('0xa6');loggerSyncQueueSummary[_0xf7b6('0x97')](_0xf7b6('0xa4'),_0xa9af4a[_0xf7b6('0x40')],_0xf7b6('0xa7'));}emitVoiceQueueSummary(_0xa9af4a);}}function notSendMessagesCampaign(_0x5d0489){if(_0x5d0489[_0xf7b6('0xa1')]){if(_0x5d0489[_0xf7b6('0x6f')]===0x0){_0x5d0489[_0xf7b6('0xa1')]=![];_0x5d0489[_0xf7b6('0x3f')]=_0xf7b6('0x42');loggerSyncQueueSummary[_0xf7b6('0x97')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5d0489[_0xf7b6('0x40')],_0xf7b6('0xa5'));}else{_0x5d0489[_0xf7b6('0x3f')]=_0xf7b6('0xa6');loggerSyncQueueSummary[_0xf7b6('0x97')](_0xf7b6('0xa8'),_0x5d0489[_0xf7b6('0x40')],_0xf7b6('0xa7'));}emitCampaignSummary(_0x5d0489);}}function createObjHistory(_0x19deca,_0x5780d8,_0xc91b07,_0x50da31,_0x16dfb8){_0x19deca[_0xf7b6('0x3f')]=_0xc91b07;var _0x1ebe54=new Action(_0x19deca,_0x5780d8);var _0x4a5bfc=new History(_0x1ebe54);_0x4a5bfc['state']=_0x50da31;_0x4a5bfc['statedesc']=_0x16dfb8;_0x4a5bfc['endtime']=_0x1ebe54[_0xf7b6('0xa9')];return _0x4a5bfc;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x5819a4=this;setInterval(function(){_0x5819a4[_0xf7b6('0xaa')](_0x5819a4[_0xf7b6('0xab')],_0xf7b6('0xac'));_0x5819a4[_0xf7b6('0xaa')](_0x5819a4[_0xf7b6('0x26')],'[actions]');},0x32c8);};Dialer[_0xf7b6('0x1d')][_0xf7b6('0xaa')]=function(_0x50a36c,_0x1e2191){var _0x4c74f3=this;for(var _0x1b3a02 in _0x50a36c){if(typeof _0x50a36c[_0x1b3a02]!=='undefined'){this['sequence'][_0xf7b6('0x1e')](function(){if(!_[_0xf7b6('0xad')](_0x50a36c[_0x1b3a02])){return ami[_0xf7b6('0xae')]({'action':_0xf7b6('0xaf'),'channel':_0x50a36c[_0x1b3a02][_0xf7b6('0xb0')]})['catch'](function(_0x5b2855){if(_0x5b2855[_0xf7b6('0x3f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x50a36c[_0x1b3a02]&&_0x50a36c[_0x1b3a02][_0xf7b6('0x4d')]!==_0xf7b6('0xb1')){_0x4c74f3['updateOriginated'](_0x4c74f3['voiceQueues'][_0x50a36c[_0x1b3a02]['queue']]);logger['error']('[Dialer][checkChannel]',_0x1e2191,_0x1b3a02,_0x50a36c[_0x1b3a02]['queue']);delete _0x50a36c[_0x1b3a02];}if(_0x50a36c[_0x1b3a02]&&_0x50a36c[_0x1b3a02]['type']===_0xf7b6('0xb1')){_0x4c74f3['updateOriginated'](_0x4c74f3[_0xf7b6('0x22')][_0x50a36c[_0x1b3a02]['queue']]);logger[_0xf7b6('0x97')](_0xf7b6('0xb2'),_0x1e2191,_0x1b3a02,_0x50a36c[_0x1b3a02][_0xf7b6('0xb3')]);delete _0x50a36c[_0x1b3a02];}},0x2328);}});}});}}};Dialer[_0xf7b6('0x1d')]['countReScheduled']=function(_0x1582b9){return BPromise['resolve']()[_0xf7b6('0xb4')](cmHopper[_0xf7b6('0xb5')](_0x1582b9))['catch'](loggerCatch(_0xf7b6('0xb6')));};Dialer[_0xf7b6('0x1d')][_0xf7b6('0xb7')]=function(_0x4f2f3f){return BPromise['resolve']()[_0xf7b6('0xb4')](cmHopperBlack[_0xf7b6('0xb7')](_0x4f2f3f))[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0xb9')));};Dialer[_0xf7b6('0x1d')][_0xf7b6('0xba')]=function(_0x130bbd){return BPromise[_0xf7b6('0xbb')]()['then'](cmHopperBlack[_0xf7b6('0xba')](_0x130bbd))[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0xbc')));};Dialer['prototype']['averageHandleTime']=function(_0x1e78d3){return BPromise[_0xf7b6('0xbb')]()['then'](cmHopperHistory[_0xf7b6('0xbd')](_0x1e78d3))['catch'](loggerCatch(_0xf7b6('0xbe')));};Dialer['prototype'][_0xf7b6('0xbf')]=function(_0x1e2960){return BPromise[_0xf7b6('0xbb')]()[_0xf7b6('0xb4')](cmHopper[_0xf7b6('0xbf')](_0x1e2960))['catch'](loggerCatch(_0xf7b6('0xc0')));};Dialer[_0xf7b6('0x1d')][_0xf7b6('0xc1')]=function(_0x266d8f,_0x4b70db,_0x213fc0){return BPromise[_0xf7b6('0xbb')]()[_0xf7b6('0xb4')](cmHopper['unlockContact'](_0x266d8f,_0x4b70db,_0x213fc0))[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0xc2')));};Dialer[_0xf7b6('0x1d')]['getContactDialer']=function(_0x47d0ab,_0x333b6d,_0x2a8d1e,_0x2ee349){return BPromise[_0xf7b6('0xbb')]()[_0xf7b6('0xb4')](cmHopper[_0xf7b6('0xc3')](_0x47d0ab,_0x333b6d,_0x2a8d1e,_0x2ee349))[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0xc4')));};Dialer[_0xf7b6('0x1d')]['getContactDialerIvr']=function(_0x16180c,_0x42c819,_0x3ba2a1){return BPromise['resolve']()[_0xf7b6('0xb4')](cmHopper['getContactDialerIvr'](_0x16180c,_0x42c819,_0x3ba2a1))[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0xc4')));};Dialer[_0xf7b6('0x1d')][_0xf7b6('0xc5')]=function(_0x41a9d6){return BPromise[_0xf7b6('0xbb')]()[_0xf7b6('0xb4')](voiceQueueRt[_0xf7b6('0xc5')](_0x41a9d6))[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0xc6')));};Dialer[_0xf7b6('0x1d')][_0xf7b6('0xc7')]=function(_0x422ecc){return BPromise[_0xf7b6('0xbb')]()[_0xf7b6('0xb4')](cmHopper[_0xf7b6('0xc7')](_0x422ecc))['catch'](loggerCatch(_0xf7b6('0xc8')));};Dialer[_0xf7b6('0x1d')][_0xf7b6('0xc9')]=function(_0x57c498){return BPromise[_0xf7b6('0xbb')]()[_0xf7b6('0xb4')](cmHopperHistory[_0xf7b6('0xc9')](_0x57c498))['catch'](loggerCatch('[createHistory]\x20'));};Dialer['prototype'][_0xf7b6('0xca')]=function(_0x5e6c7b){if(!_[_0xf7b6('0x85')](_0x5e6c7b)&&_0x5e6c7b!==null){if(typeof _0x5e6c7b[_0xf7b6('0x6f')]!==_0xf7b6('0x9a')){if(_0x5e6c7b[_0xf7b6('0x6f')]>0x0){_0x5e6c7b[_0xf7b6('0x6f')]-=0x1;}else{logger['error'](_0xf7b6('0xcb'));}}}else{logger[_0xf7b6('0x97')](_0xf7b6('0xcc'));}};Dialer['prototype'][_0xf7b6('0xcd')]=function(_0x4ec26c,_0x3b6643){var _0x47feed=this;return function(_0x3cc369){_0x47feed[_0xf7b6('0xca')](_0x3b6643);logger['error'](_0x4ec26c,util[_0xf7b6('0x98')](_0x3cc369,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x3d357b,_0x26df7e,_0x56c689){var _0xac71ea={'state':0x19,'statedesc':_0xf7b6('0xce')};this['updateOriginated'](_0x26df7e);this[_0xf7b6('0xcf')](_[_0xf7b6('0x90')](_0xac71ea,_[_0xf7b6('0xd0')](_0x56c689,['ContactId',_0xf7b6('0xd1'),_0xf7b6('0xd2'),_0xf7b6('0xd3'),_0xf7b6('0xd4')])),_0xf7b6('0xd5'),_0xf7b6('0xd6'));logger['error'](_0x3d357b);};Dialer[_0xf7b6('0x1d')][_0xf7b6('0xd7')]=function(_0x506586){return _0x506586===_0xf7b6('0xd8');};Dialer[_0xf7b6('0x1d')][_0xf7b6('0xd9')]=function(_0x5d38c3){return!_[_0xf7b6('0x85')](_0x5d38c3)&&_0x5d38c3&&!_['isUndefined'](_0x5d38c3[_0xf7b6('0x40')])&&!_['isUndefined'](_0x5d38c3[_0xf7b6('0x75')])&&_0x5d38c3[_0xf7b6('0x75')]&&(this[_0xf7b6('0x24')][util['format']('SIP/%s',_0x5d38c3[_0xf7b6('0x40')])][_0xf7b6('0xaf')]==='reachable'||this[_0xf7b6('0x24')][util[_0xf7b6('0x77')]('SIP/%s',_0x5d38c3[_0xf7b6('0x40')])]['status']===_0xf7b6('0xda'));};Dialer[_0xf7b6('0x1d')][_0xf7b6('0xcf')]=function(_0x4c9632,_0x2ad741,_0x7633c8){this['createHistory'](_0x4c9632)[_0xf7b6('0xb8')](loggerCatch(_0x2ad741));this[_0xf7b6('0xc7')](_0x4c9632)[_0xf7b6('0xb8')](loggerCatch(_0x7633c8));};Dialer['prototype'][_0xf7b6('0xdb')]=function(_0x594155){var _0x4af0b6=this[_0xf7b6('0xab')][_0x594155[_0xf7b6('0xdc')]];var _0x3ef308;if(!_['isNil'](_0x594155)&&!_[_0xf7b6('0xad')](_0x594155[_0xf7b6('0xdd')])&&!_[_0xf7b6('0xad')](_0x594155[_0xf7b6('0xdd')][_0xf7b6('0xde')])&&_0x594155[_0xf7b6('0xdf')]===_0xf7b6('0xe0')&&_0x4af0b6){if(_0x4af0b6[_0xf7b6('0x4d')]!=='ivr'&&this[_0xf7b6('0x21')][_0x4af0b6[_0xf7b6('0xb3')]]['dialAMDActive']&&_0x594155['value']===_0xf7b6('0xe1')){delete this[_0xf7b6('0xab')][_0x594155['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x4af0b6[_0xf7b6('0xb3')]]);this[_0xf7b6('0x21')][_0x4af0b6['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xf7b6('0x21')][_0x4af0b6[_0xf7b6('0xb3')]][_0xf7b6('0x5a')]+=0x1;_0x3ef308=new Hangup(_0x4af0b6,_0x594155);_0x3ef308['state']=0x12;_0x3ef308['statedesc']=_0xf7b6('0xe2');_0x3ef308[_0xf7b6('0xe3')]='AMD';this[_0xf7b6('0xcf')](_0x3ef308,_0xf7b6('0xe4'),_0xf7b6('0xe5'));}if(_0x4af0b6[_0xf7b6('0x4d')]!=='ivr'&&this[_0xf7b6('0x21')][_0x4af0b6[_0xf7b6('0xb3')]][_0xf7b6('0xe6')]&&_0x594155[_0xf7b6('0xe7')]===_0xf7b6('0xe8')){var _0x5f1be9=this;return new BPromise(function(_0x3e21f6,_0x2738ce){delete _0x5f1be9['uniqueId'][_0x594155[_0xf7b6('0xdc')]];_0x5f1be9['updateOriginated'](_0x5f1be9[_0xf7b6('0x21')][_0x4af0b6[_0xf7b6('0xb3')]]);_0x5f1be9[_0xf7b6('0x21')][_0x4af0b6[_0xf7b6('0xb3')]][_0xf7b6('0x5b')]+=0x1;_0x5f1be9['voiceQueues'][_0x4af0b6['queue']][_0xf7b6('0x5a')]+=0x1;var _0x3fce2a=_0x5f1be9[_0xf7b6('0x21')][_0x4af0b6['queue']];var _0x17070a=new Hangup(_0x4af0b6,_0x594155);_0x17070a[_0xf7b6('0xe9')]=0x13;_0x17070a[_0xf7b6('0xea')]=_0xf7b6('0xeb');_0x17070a[_0xf7b6('0xe3')]=_0xf7b6('0xec');_0x17070a['countmachineretry']+=0x1;_0x17070a[_0xf7b6('0xed')]+=0x1;_0x17070a[_0xf7b6('0xee')]=!![];_0x5f1be9[_0xf7b6('0xc9')](_0x17070a)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x17070a['countbusyretry']+_0x17070a[_0xf7b6('0xef')]+_0x17070a[_0xf7b6('0xf0')]+_0x17070a[_0xf7b6('0xf1')]+_0x17070a[_0xf7b6('0xf2')]+_0x17070a[_0xf7b6('0xf3')]+_0x17070a[_0xf7b6('0xf4')]+_0x17070a[_0xf7b6('0xf5')]>=_0x3fce2a[_0xf7b6('0xf6')]){_0x5f1be9[_0xf7b6('0xf7')](_0x17070a,_0x3e21f6,_0x2738ce,_0xf7b6('0xf8'));}else{if(_0x17070a[_0xf7b6('0xf4')]>=_0x3fce2a['dialMachineMaxRetry']){_0x5f1be9[_0xf7b6('0xf9')](_0x17070a,_0x3e21f6,_0x2738ce,_0xf7b6('0xfa'));}else{_0x5f1be9['rescheduleContact']({'active':![],'countmachineretry':_0x17070a[_0xf7b6('0xf4')],'scheduledat':moment()[_0xf7b6('0xfb')](_0x3fce2a['dialMachineRetryFrequency'],_0xf7b6('0xfc'))['format'](_0xf7b6('0xfd')),'ContactId':_0x17070a['ContactId'],'ListId':_0x17070a[_0xf7b6('0xd1')],'VoiceQueueId':_0x17070a[_0xf7b6('0xd3')]||undefined,'CampaignId':_0x17070a['CampaignId']||undefined})[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0xfe')));_0x3e21f6({'reschedule':0x1});}}});}if(_0x4af0b6[_0xf7b6('0x4d')]===_0xf7b6('0xb1')&&this[_0xf7b6('0x22')][_0x4af0b6[_0xf7b6('0xb3')]]['dialAMDActive']&&_0x594155['value']===_0xf7b6('0xe1')){delete this[_0xf7b6('0xab')][_0x594155[_0xf7b6('0xdc')]];this[_0xf7b6('0xca')](this['campaigns'][_0x4af0b6[_0xf7b6('0xb3')]]);_0x3ef308=new Hangup(_0x4af0b6,_0x594155);_0x3ef308[_0xf7b6('0xe9')]=0x12;_0x3ef308[_0xf7b6('0xea')]=_0xf7b6('0xe2');_0x3ef308[_0xf7b6('0xe3')]=_0xf7b6('0xec');this[_0xf7b6('0xcf')](_0x3ef308,_0xf7b6('0xff'),_0xf7b6('0x100'));}if(_0x4af0b6[_0xf7b6('0x4d')]===_0xf7b6('0xb1')&&this[_0xf7b6('0x22')][_0x4af0b6[_0xf7b6('0xb3')]][_0xf7b6('0xe6')]&&_0x594155[_0xf7b6('0xe7')]===_0xf7b6('0xe8')){var _0x5f1be9=this;return new BPromise(function(_0x5d844c,_0x44bbcc){delete _0x5f1be9['uniqueId'][_0x594155[_0xf7b6('0xdc')]];_0x5f1be9[_0xf7b6('0xca')](_0x5f1be9[_0xf7b6('0x22')][_0x4af0b6[_0xf7b6('0xb3')]]);_0x5f1be9[_0xf7b6('0x22')][_0x4af0b6[_0xf7b6('0xb3')]]['outboundAnswerCallsDay']+=0x1;_0x5f1be9['campaigns'][_0x4af0b6[_0xf7b6('0xb3')]][_0xf7b6('0x5a')]+=0x1;var _0x12f3aa=_0x5f1be9[_0xf7b6('0x22')][_0x4af0b6[_0xf7b6('0xb3')]];var _0x5cffbe=new Hangup(_0x4af0b6,_0x594155);_0x5cffbe[_0xf7b6('0xe9')]=0x13;_0x5cffbe[_0xf7b6('0xea')]=_0xf7b6('0xeb');_0x5cffbe[_0xf7b6('0xe3')]=_0xf7b6('0xec');_0x5cffbe[_0xf7b6('0xf4')]+=0x1;_0x5cffbe['countglobal']+=0x1;_0x5cffbe['amd']=!![];_0x5f1be9['createHistory'](_0x5cffbe)[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x101')));if(_0x5cffbe['countbusyretry']+_0x5cffbe[_0xf7b6('0xef')]+_0x5cffbe[_0xf7b6('0xf0')]+_0x5cffbe['countnosuchnumberretry']+_0x5cffbe[_0xf7b6('0xf2')]+_0x5cffbe[_0xf7b6('0xf3')]+_0x5cffbe[_0xf7b6('0xf4')]+_0x5cffbe['countagentrejectretry']>=_0x12f3aa[_0xf7b6('0xf6')]){_0x5f1be9['stateGlobal'](_0x5cffbe,_0x5d844c,_0x44bbcc,_0xf7b6('0xf8'));}else{if(_0x5cffbe[_0xf7b6('0xf4')]>=_0x12f3aa[_0xf7b6('0x102')]){_0x5f1be9[_0xf7b6('0xf9')](_0x5cffbe,_0x5d844c,_0x44bbcc,_0xf7b6('0xfa'));}else{_0x5f1be9['rescheduleContact']({'active':![],'countmachineretry':_0x5cffbe[_0xf7b6('0xf4')],'scheduledat':moment()[_0xf7b6('0xfb')](_0x12f3aa[_0xf7b6('0x103')],'minutes')[_0xf7b6('0x77')](_0xf7b6('0xfd')),'ContactId':_0x5cffbe[_0xf7b6('0x104')],'ListId':_0x5cffbe[_0xf7b6('0xd1')],'VoiceQueueId':_0x5cffbe[_0xf7b6('0xd3')]||undefined,'CampaignId':_0x5cffbe[_0xf7b6('0xd4')]||undefined})[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0xfe')));_0x5d844c({'reschedule':0x1});}}});}}};Dialer[_0xf7b6('0x1d')]['syncHangup']=function(_0x31f72c){var _0x38d886=this[_0xf7b6('0xab')][_0x31f72c[_0xf7b6('0xdc')]];var _0x55a53c=this;var _0x5b957c;if(_0x38d886&&_0x38d886[_0xf7b6('0x4d')]==='ivr'){delete this['uniqueId'][_0x31f72c[_0xf7b6('0xdc')]];this[_0xf7b6('0xca')](this[_0xf7b6('0x22')][_0x38d886[_0xf7b6('0xb3')]]);this[_0xf7b6('0x22')][_0x38d886[_0xf7b6('0xb3')]][_0xf7b6('0x105')]+=0x1;_0x5b957c=new Hangup(_0x38d886,_0x31f72c);this[_0xf7b6('0xc9')](_0x5b957c)[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x106')));this[_0xf7b6('0xc7')](_0x5b957c)[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x107')));}if(_0x38d886&&_0x38d886[_0xf7b6('0x4d')]!=='ivr'&&isNotNull(this[_0xf7b6('0x21')][_0x38d886[_0xf7b6('0xb3')]][_0xf7b6('0x108')])){delete this[_0xf7b6('0xab')][_0x31f72c['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x38d886[_0xf7b6('0xb3')]]);this[_0xf7b6('0x21')][_0x38d886[_0xf7b6('0xb3')]][_0xf7b6('0x5b')]+=0x1;this[_0xf7b6('0x21')][_0x38d886[_0xf7b6('0xb3')]][_0xf7b6('0x5a')]+=0x1;_0x5b957c=new Hangup(_0x38d886,_0x31f72c);_0x5b957c[_0xf7b6('0xe9')]=0x10;_0x5b957c['statedesc']='AnswerAGI';_0x5b957c['membername']=_0xf7b6('0x109');this[_0xf7b6('0xc9')](_0x5b957c)[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x106')));this[_0xf7b6('0xc7')](_0x5b957c)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x38d886&&_0x38d886[_0xf7b6('0x4d')]!==_0xf7b6('0xb1')&&!isNotNull(this['voiceQueues'][_0x38d886[_0xf7b6('0xb3')]][_0xf7b6('0x108')])){delete this['uniqueId'][_0x31f72c['uniqueid']];this[_0xf7b6('0xca')](this[_0xf7b6('0x21')][_0x38d886['queue']]);this['voiceQueues'][_0x38d886['queue']]['outboundUnknownCallsDay']+=0x1;_0x5b957c=new Hangup(_0x38d886,_0x31f72c);_0x5b957c[_0xf7b6('0xe9')]=0xc;_0x5b957c['statedesc']=_0x31f72c[_0xf7b6('0x10a')];_0x5b957c['membername']='Unknow';this[_0xf7b6('0xc9')](_0x5b957c)[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x106')));this['moveContactManagedDialer'](_0x5b957c)[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x107')));}};Dialer[_0xf7b6('0x1d')][_0xf7b6('0x35')]=function(_0x19a128){var _0x74fa13=this[_0xf7b6('0xab')][_0x19a128[_0xf7b6('0xdc')]];var _0x13482a=this;if(this[_0xf7b6('0x21')][_0x19a128['queue']]){if(_0x74fa13&&_0x74fa13[_0xf7b6('0x4d')]!==_0xf7b6('0xb1')){delete this['uniqueId'][_0x19a128[_0xf7b6('0xdc')]];this[_0xf7b6('0x21')][_0x19a128['queue']][_0xf7b6('0x5b')]+=0x1;var _0x2a106d=new AgentComplete(_0x74fa13,_0x19a128);if(_0x19a128[_0xf7b6('0x10b')]===_0xf7b6('0x10c')){_0x2a106d[_0xf7b6('0x10d')]=this[_0xf7b6('0x21')][_0x19a128[_0xf7b6('0xb3')]][_0xf7b6('0x10e')]&&this[_0xf7b6('0x21')][_0x19a128[_0xf7b6('0xb3')]][_0xf7b6('0x10f')]?moment()[_0xf7b6('0x77')](_0xf7b6('0xfd')):undefined;}this['createHistory'](_0x2a106d)[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x110')));this['moveContactManagedDialer'](_0x2a106d)[_0xf7b6('0xb8')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xf7b6('0x1d')][_0xf7b6('0x2f')]=function(_0x4748ca){if(this[_0xf7b6('0x21')][_0x4748ca[_0xf7b6('0xb3')]]){if(this['uniqueId'][_0x4748ca[_0xf7b6('0xdc')]]&&this[_0xf7b6('0xab')][_0x4748ca['uniqueid']][_0xf7b6('0x4d')]!==_0xf7b6('0xb1')){this[_0xf7b6('0xca')](this[_0xf7b6('0x21')][_0x4748ca[_0xf7b6('0xb3')]]);this['uniqueId'][_0x4748ca[_0xf7b6('0xdc')]][_0xf7b6('0x111')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xf7b6('0x1d')][_0xf7b6('0x112')]=function(_0x20eb09){this[_0xf7b6('0xc9')](_0x20eb09)[_0xf7b6('0xb8')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xf7b6('0xc7')](_0x20eb09)['catch'](loggerCatch(_0xf7b6('0x113')));};Dialer[_0xf7b6('0x1d')][_0xf7b6('0x114')]=function(_0x32fff5){var _0x4ffd38=this[_0xf7b6('0xab')][_0x32fff5[_0xf7b6('0xdc')]];var _0x48d023=this;if(this[_0xf7b6('0x21')][_0x32fff5['queue']]){if(_0x4ffd38&&_0x4ffd38['type']!==_0xf7b6('0xb1')){delete this['uniqueId'][_0x32fff5['uniqueid']];this[_0xf7b6('0xca')](this['voiceQueues'][_0x32fff5[_0xf7b6('0xb3')]]);_0x4ffd38[_0xf7b6('0x115')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0xfb5bdf=new QueueCallerAbandon(_0x4ffd38,_0x32fff5);if(getSeconds(_0x4ffd38[_0xf7b6('0x115')],_0x4ffd38[_0xf7b6('0x116')])>=_0x4ffd38['dialQueueTimeout']){this[_0xf7b6('0x21')][_0x32fff5[_0xf7b6('0xb3')]][_0xf7b6('0x69')]+=0x1;this['voiceQueues'][_0x32fff5[_0xf7b6('0xb3')]][_0xf7b6('0x117')]+=0x1;this[_0xf7b6('0x21')][_0x32fff5[_0xf7b6('0xb3')]][_0xf7b6('0x6b')]+=0x1;_0xfb5bdf['state']=0xa;_0xfb5bdf['statedesc']=_0xf7b6('0x118');_0xfb5bdf[_0xf7b6('0x119')]=_0xf7b6('0x11a');_0xfb5bdf[_0xf7b6('0x10d')]=this[_0xf7b6('0x21')][_0x32fff5[_0xf7b6('0xb3')]][_0xf7b6('0x10e')]?moment()['format'](_0xf7b6('0xfd')):undefined;_0xfb5bdf[_0xf7b6('0xf2')]+=0x1;_0xfb5bdf[_0xf7b6('0xed')]+=0x1;if(_0xfb5bdf[_0xf7b6('0xf2')]>=this[_0xf7b6('0x21')][_0x32fff5[_0xf7b6('0xb3')]][_0xf7b6('0x11b')]){this['queueCallerAbandonCreateState'](_0xfb5bdf);}else{this[_0xf7b6('0xbf')]({'active':![],'countdropretry':_0xfb5bdf['countdropretry'],'scheduledat':moment()[_0xf7b6('0xfb')](this[_0xf7b6('0x21')][_0x32fff5['queue']]['dialDropRetryFrequency'],_0xf7b6('0xfc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4ffd38[_0xf7b6('0x104')],'ListId':_0x4ffd38[_0xf7b6('0xd1')],'VoiceQueueId':_0x4ffd38['VoiceQueueId']||undefined,'CampaignId':_0x4ffd38[_0xf7b6('0xd4')]||undefined})[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x11c')));var _0xbc139=new History(_0xfb5bdf);_0xbc139[_0xf7b6('0xe9')]=0xa;_0xbc139[_0xf7b6('0xea')]=_0xf7b6('0x118');_0xbc139[_0xf7b6('0xa9')]=moment()[_0xf7b6('0x77')](_0xf7b6('0xfd'));_0xbc139['endtime']=_0xbc139[_0xf7b6('0xa9')];_0xbc139['calleridname']=_0xfb5bdf[_0xf7b6('0x11d')];_0xbc139[_0xf7b6('0x11e')]=_0xfb5bdf['calleridnum'];this[_0xf7b6('0xc9')](_0xbc139)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xf7b6('0x21')][_0x32fff5[_0xf7b6('0xb3')]][_0xf7b6('0x68')]+=0x1;this[_0xf7b6('0x21')][_0x32fff5[_0xf7b6('0xb3')]]['outboundDropCallsDayCallersExit']+=0x1;_0xfb5bdf[_0xf7b6('0xe9')]=0xb;_0xfb5bdf[_0xf7b6('0xea')]=_0xf7b6('0x11f');_0xfb5bdf[_0xf7b6('0x119')]=_0xf7b6('0x120');_0xfb5bdf[_0xf7b6('0xf3')]+=0x1;_0xfb5bdf[_0xf7b6('0xed')]+=0x1;if(_0xfb5bdf['countabandonedretry']>=this[_0xf7b6('0x21')][_0x32fff5[_0xf7b6('0xb3')]][_0xf7b6('0x121')]){this[_0xf7b6('0x112')](_0xfb5bdf);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0xfb5bdf[_0xf7b6('0xf3')],'scheduledat':moment()[_0xf7b6('0xfb')](this[_0xf7b6('0x21')][_0x32fff5['queue']][_0xf7b6('0x122')],_0xf7b6('0xfc'))[_0xf7b6('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4ffd38['ContactId'],'ListId':_0x4ffd38[_0xf7b6('0xd1')],'VoiceQueueId':_0x4ffd38[_0xf7b6('0xd3')]||undefined,'CampaignId':_0x4ffd38['CampaignId']||undefined})[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x123')));var _0xbc139=new History(_0xfb5bdf);_0xbc139[_0xf7b6('0xe9')]=0xb;_0xbc139[_0xf7b6('0xea')]=_0xf7b6('0x11f');_0xbc139[_0xf7b6('0xa9')]=moment()[_0xf7b6('0x77')](_0xf7b6('0xfd'));_0xbc139[_0xf7b6('0x124')]=_0xbc139[_0xf7b6('0xa9')];_0xbc139[_0xf7b6('0x11d')]=_0xfb5bdf['calleridname'];_0xbc139[_0xf7b6('0x11e')]=_0xfb5bdf[_0xf7b6('0x11e')];this['createHistory'](_0xbc139)['catch'](loggerCatch(_0xf7b6('0x125')));}}}}};Dialer[_0xf7b6('0x1d')][_0xf7b6('0x39')]=function(_0xbb4852){if(this[_0xf7b6('0x26')][_0xbb4852[_0xf7b6('0xdc')]]){this['actions'][_0xbb4852[_0xf7b6('0xdc')]][_0xf7b6('0xb0')]=_0xbb4852[_0xf7b6('0xb0')];}if(this[_0xf7b6('0xab')][_0xbb4852[_0xf7b6('0xdc')]]){this[_0xf7b6('0xab')][_0xbb4852[_0xf7b6('0xdc')]][_0xf7b6('0xb0')]=_0xbb4852[_0xf7b6('0xb0')];}};Dialer[_0xf7b6('0x1d')][_0xf7b6('0x126')]=function(_0x110568){if(strategy[this[_0xf7b6('0x21')][this[_0xf7b6('0x26')][_0x110568[_0xf7b6('0x127')]]['queue']]['strategy']]===_0xf7b6('0x1c')){if(this[_0xf7b6('0x26')][_0x110568[_0xf7b6('0x127')]]&&_['isNil'](this[_0xf7b6('0x26')][_0x110568[_0xf7b6('0x127')]][_0xf7b6('0x128')])&&_0x110568[_0xf7b6('0xaf')]==='1'&&_0x110568[_0xf7b6('0x129')]==='0'){if(this[_0xf7b6('0x23')][_0x110568[_0xf7b6('0x12a')]]){if(!this[_0xf7b6('0x23')][_0x110568[_0xf7b6('0x12a')]]['locked']){this[_0xf7b6('0x23')][_0x110568[_0xf7b6('0x12a')]][_0xf7b6('0x128')]=!![];this[_0xf7b6('0x26')][_0x110568[_0xf7b6('0x127')]][_0xf7b6('0x128')]=!![];this[_0xf7b6('0x26')][_0x110568['actionid']][_0xf7b6('0x12a')]=_0x110568[_0xf7b6('0x12a')];}}}}else if((strategy[this[_0xf7b6('0x21')][this[_0xf7b6('0x26')][_0x110568[_0xf7b6('0x127')]][_0xf7b6('0xb3')]]['strategy']]||_0xf7b6('0x1b'))===_0xf7b6('0x1b')){if(this[_0xf7b6('0x26')][_0x110568['actionid']]){if(this[_0xf7b6('0x23')][_0x110568['stateinterface']]){this[_0xf7b6('0x26')][_0x110568[_0xf7b6('0x127')]][_0xf7b6('0x12a')]=_0x110568[_0xf7b6('0x12a')];if(_[_0xf7b6('0xad')](this[_0xf7b6('0x2c')][this[_0xf7b6('0x26')][_0x110568['actionid']][_0xf7b6('0xb3')]])){this['queueBooked'][this[_0xf7b6('0x26')][_0x110568[_0xf7b6('0x127')]]['queue']]=[];}this['queueBooked'][this[_0xf7b6('0x26')][_0x110568[_0xf7b6('0x127')]][_0xf7b6('0xb3')]][_0xf7b6('0x12b')](_['merge'](_[_0xf7b6('0xd0')](this[_0xf7b6('0x26')][_0x110568['actionid']],[_0xf7b6('0x12c'),_0xf7b6('0x12a')]),{'status':_0x110568[_0xf7b6('0xaf')],'paused':_0x110568[_0xf7b6('0x129')]}));}}}};function unlockQueueStatus(_0x4e024c,_0x4ff7e3){setTimeout(function(){if(_[_0xf7b6('0x85')](_0x4e024c[_0xf7b6('0x12d')])){loggerBooked[_0xf7b6('0x97')]('[unlockQueueStatus][undefined]',_0x4ff7e3);}_0x4e024c[_0xf7b6('0x12d')]=!![];loggerBooked[_0xf7b6('0x7d')](_0xf7b6('0x12e'),_0x4ff7e3,JSON[_0xf7b6('0x49')](_[_0xf7b6('0xd0')](_0x4e024c,[_0xf7b6('0x40'),_0xf7b6('0x12d')])));},0x1f3);}Dialer[_0xf7b6('0x1d')][_0xf7b6('0x3c')]=function(_0x33a420){var _0x4689a=this;var _0x498f8a=_0x4689a[_0xf7b6('0x21')][_0x4689a[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0xb3')]];if(strategy[this[_0xf7b6('0x21')][this[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0xb3')]][_0xf7b6('0x4f')]]===_0xf7b6('0x1c')){if(this['actions'][_0x33a420[_0xf7b6('0x127')]]&&this[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0x12a')]){this[_0xf7b6('0x12f')][_0xf7b6('0x130')](this['actions'][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0x12c')],this[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0x12a')])['catch'](function(_0x13816e){logger[_0xf7b6('0x97')](_0xf7b6('0x131'),util[_0xf7b6('0x98')](_0x13816e,{'showHidden':![],'depth':null}));})[_0xf7b6('0x1f')](function(){_0x4689a['updateOriginated'](_0x4689a[_0xf7b6('0x21')][_0x4689a[_0xf7b6('0x26')][_0x33a420['actionid']][_0xf7b6('0xb3')]]);_0x4689a[_0xf7b6('0x23')][_0x4689a[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]]['stateinterface']][_0xf7b6('0x128')]=![];delete _0x4689a[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]];unlockQueueStatus(_0x498f8a);});}else{this['updateOriginated'](this['voiceQueues'][this[_0xf7b6('0x26')][_0x33a420['actionid']][_0xf7b6('0xb3')]]);this[_0xf7b6('0xbf')]({'active':![],'ContactId':this[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0x104')],'ListId':this[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]]['ListId'],'VoiceQueueId':this['actions'][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0xd3')]||undefined,'CampaignId':this[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0xd4')]||undefined})[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x132')));delete this[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]];unlockQueueStatus(_0x498f8a);}}else if((strategy[this[_0xf7b6('0x21')][this[_0xf7b6('0x26')][_0x33a420['actionid']]['queue']][_0xf7b6('0x4f')]]||_0xf7b6('0x1b'))===_0xf7b6('0x1b')){var _0x4ffe46;if(this[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]]&&!_[_0xf7b6('0x7c')](this[_0xf7b6('0x2c')][this[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0xb3')]])){if(this[_0xf7b6('0x2d')][_0x4689a['actions'][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0xb3')]]){this[_0xf7b6('0x2d')][_0x4689a[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0xb3')]]=this['queueBookedRR'][this['actions'][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0xb3')]]?this['queueBookedRR'][this[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0xb3')]]:this['queueBooked'][this[_0xf7b6('0x26')][_0x33a420['actionid']][_0xf7b6('0xb3')]]?this['queueBooked'][this[_0xf7b6('0x26')][_0x33a420[_0xf7b6('0x127')]][_0xf7b6('0xb3')]]['_rr']||0x0:0x0;}this[_0xf7b6('0x2c')][this['actions'][_0x33a420[_0xf7b6('0x127')]]['queue']][_0xf7b6('0x133')]=this[_0xf7b6('0x2d')][this[_0xf7b6('0x26')][_0x33a420['actionid']]['queue']];for(var _0x184551=0x0;_0x184551=0x0;})[_0xf7b6('0xb8')](myreject(_0x4c9938)));}}else{_0x1e0ce7[_0xf7b6('0x12b')](ami[_0xf7b6('0xae')]({'action':'command','command':util[_0xf7b6('0x77')](_0xf7b6('0x14b'),_0x374652,!_[_0xf7b6('0x85')](config['timezones'][_0x13b336])?_0x13b336:'')})[_0xf7b6('0xb4')](function(_0x5e0400){return _0x5e0400[_0xf7b6('0x14d')]['indexOf'](_0xf7b6('0x14f'))>=0x0;})['catch'](myreject(_0x4c9938)));}BPromise[_0xf7b6('0x150')](_0x1e0ce7)[_0xf7b6('0xb4')](function(_0xdf3499){var _0x5ee288=_[_0xf7b6('0x151')](_0xdf3499);if(_0x5ee288){return _0x558c0b(_0x5ee288);}else{_0x393723[_0xf7b6('0x3f')]=_0x4acc12?_0xf7b6('0x152'):_0xf7b6('0x153');return _0x4c9938(msgResponse(_0xf7b6('0x154'),'Failure',_0xf7b6('0x155')+_0x4acc12+'\x20'+_0x2839b2+_0xf7b6('0x156')+util[_0xf7b6('0x98')](_0x374652,{'showHidden':![],'depth':null})+_0xf7b6('0x157')+_0x13b336));}})['catch'](function(_0x54f691){return _0x4c9938(msgResponse('ifTime',_0xf7b6('0x145'),JSON[_0xf7b6('0x49')](_0x54f691)));});});};Dialer[_0xf7b6('0x1d')]['checkDialMethod']=function(_0x359f8c){var _0x74e34e=this;return function(){switch(_0x359f8c[_0xf7b6('0x158')]){case _0xf7b6('0x159'):freeVariablesPredictive(_0x359f8c);_0x74e34e[_0xf7b6('0x15a')](_0x359f8c,0x1);break;case _0xf7b6('0x15b'):freeVariablesPredictive(_0x359f8c);_0x74e34e[_0xf7b6('0x15a')](_0x359f8c,_0x359f8c['dialPowerLevel']);break;case _0xf7b6('0xa'):_0x74e34e['predictive'](_0x359f8c);break;case _0xf7b6('0x9'):freeVariablesPredictive(_0x359f8c);_0x74e34e[_0xf7b6('0x15a')](_0x359f8c,0x1);break;default:freeVariablesPredictive(_0x359f8c);logger[_0xf7b6('0x97')](_0xf7b6('0x15c'),_0x359f8c['name'],'method\x20not\x20recognized');}};};Dialer['prototype'][_0xf7b6('0x15d')]=function(_0x37cd28){var _0x1ac98d=this;return function(){_0x1ac98d[_0xf7b6('0x15e')](_0x37cd28);};};Dialer['prototype'][_0xf7b6('0xc')]=function(_0x126fad){var _0x2ddc33=this;if(isNotPreview(_0x126fad[_0xf7b6('0x158')])){if(isVoiceQueueOutbound(_0x126fad[_0xf7b6('0x4d')])&&isActive(_0x126fad[_0xf7b6('0x56')])){_0x126fad[_0xf7b6('0xa1')]=!![];BPromise[_0xf7b6('0xbb')]()[_0xf7b6('0xb4')](checkIsLoggedIn(_0x126fad,_0x126fad[_0xf7b6('0x15f')]))[_0xf7b6('0xb4')](checkIsActive(_0x126fad,_0x126fad['dialActive']))[_0xf7b6('0xb4')](checkInterval(_0x126fad))[_0xf7b6('0xb4')](_0x2ddc33['checkIsTrunkReachable'](_0x126fad))['then'](_0x2ddc33[_0xf7b6('0x142')](_0x126fad['dialGlobalInterval'],_0x126fad['dialTimezone'],_0x126fad[_0xf7b6('0x40')],_0x126fad))[_0xf7b6('0xb4')](_0x2ddc33[_0xf7b6('0x144')](_0x126fad[_0xf7b6('0x43')],_0x126fad[_0xf7b6('0x160')],_0x126fad[_0xf7b6('0x40')],_0x126fad))[_0xf7b6('0xb4')](_0x2ddc33['checkDialMethod'](_0x126fad))[_0xf7b6('0xb8')](loggerCatchQueueSummary(_0xf7b6('0x161'),_0x126fad));}else{notSendMessagesQueue(_0x126fad);}}else{freeVariablesPredictive(_0x126fad);}};Dialer[_0xf7b6('0x1d')][_0xf7b6('0x13d')]=function(){var _0x38fb4f=this;var _0x49778c;for(var _0x599d00 in this[_0xf7b6('0x22')]){if(typeof this[_0xf7b6('0x22')][_0x599d00]!==_0xf7b6('0x9a')){_0x49778c=this[_0xf7b6('0x22')][_0x599d00];if(isCampaignIvr(_0x49778c[_0xf7b6('0x4d')])&&isActive(_0x49778c[_0xf7b6('0x75')])){_0x49778c[_0xf7b6('0xa1')]=!![];BPromise[_0xf7b6('0xbb')]()['then'](checkIsActive(_0x49778c,_0x49778c[_0xf7b6('0x75')]))[_0xf7b6('0xb4')](checkInterval(_0x49778c))[_0xf7b6('0xb4')](_0x38fb4f[_0xf7b6('0x13e')](_0x49778c))[_0xf7b6('0xb4')](_0x38fb4f[_0xf7b6('0x142')](_0x49778c['dialGlobalInterval'],_0x49778c['dialTimezone'],_0x49778c[_0xf7b6('0x40')],_0x49778c))['then'](_0x38fb4f[_0xf7b6('0x144')](_0x49778c[_0xf7b6('0x43')],_0x49778c['dialTimezone'],_0x49778c[_0xf7b6('0x40')],_0x49778c))[_0xf7b6('0xb4')](_0x38fb4f[_0xf7b6('0x15d')](_0x49778c))[_0xf7b6('0xb8')](loggerCatchQueueSummary(_0xf7b6('0x162'),_0x49778c));}else{notSendMessagesCampaign(_0x49778c);}}}};function getCallerIdRandom(_0x4c4db7,_0xa5da5a){var _0x46d45d;var _0x1ea00a;var _0x54f0c5;if(_0xa5da5a<=0x0){_0xa5da5a=0x1;}_0x46d45d=new RegExp(_0xf7b6('0x163')+_0xa5da5a+'}$');_0x1ea00a=Math['pow'](0xa,_0xa5da5a-0x1);_0x54f0c5=Math[_0xf7b6('0x164')](0xa,_0xa5da5a)-0x1;return util[_0xf7b6('0x77')]('%s',_[_0xf7b6('0x165')](_0x4c4db7,_0x46d45d,_[_0xf7b6('0x166')](_0x1ea00a,_0x54f0c5)));}function extractCalleridName(_0x5ed061){var _0x2e1b2a=_0x5ed061[_0xf7b6('0x167')](/"(.*?)"/);return _0x2e1b2a?_0x2e1b2a[0x1]:_0x5ed061;}function extractCalleridNumber(_0x40323c){var _0x5fb186=_0x40323c[_0xf7b6('0x167')](/<(.*?)>/);return _0x5fb186?_0x5fb186[0x1]:_0x40323c;}Dialer[_0xf7b6('0x1d')]['actionOriginate']=function(_0x5282cc,_0x44af5b){var _0x3b54b9=this;var _0x24813a=uuid['v4']();this[_0xf7b6('0x26')][_0x24813a]=new Action(_0x5282cc,_0x44af5b,_0x24813a);return new BPromise(function(_0x32760b,_0x4892a1){if(_[_0xf7b6('0x85')](_0x5282cc)&&typeof _0x5282cc!==_0xf7b6('0x168')){return _0x4892a1(msgResponse('originate',_0xf7b6('0x145'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x44af5b['Contact'][_0xf7b6('0x169')])||_0x44af5b[_0xf7b6('0x16a')]['phone']===null){return _0x4892a1(msgResponse(_0xf7b6('0x16b'),_0xf7b6('0x145'),_0xf7b6('0x16c')));}var _0x205de9={'XMD-CALLERID':_0x3b54b9[_0xf7b6('0x26')][_0x24813a][_0xf7b6('0x16d')](),'XMD-AGI':_0x5282cc[_0xf7b6('0x108')]?util[_0xf7b6('0x77')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5282cc[_0xf7b6('0x108')]):_0xf7b6('0x16e'),'XMD-AGIAFTER':_0x5282cc[_0xf7b6('0x10e')]?util[_0xf7b6('0x77')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5282cc['dialQueueProject2']):_0xf7b6('0x16e'),'XMD-QUEUE':_0x5282cc[_0xf7b6('0x4d')]===_0xf7b6('0x4e')?util[_0xf7b6('0x77')]('\x22%s,%s%s,,,%s\x22',_0x5282cc[_0xf7b6('0x40')],_0x5282cc['dialQueueOptions']||'',_0x5282cc[_0xf7b6('0x10f')]?'c':'',_0x5282cc[_0xf7b6('0x16f')]||0x3):'NONE','XMD-CONTACTID':_0x44af5b[_0xf7b6('0x104')],'XMD-CDRTYPE':_0xf7b6('0x8'),'CALLERID(all)':_0x3b54b9[_0xf7b6('0x26')][_0x24813a]['getCaller'](),'XMD-AMD':_0x5282cc[_0xf7b6('0xe6')]?_0xf7b6('0x170'):_0xf7b6('0x16e'),'XMD-DESTINATION':_0xf7b6('0xe0')};if(_0x5282cc[_0xf7b6('0xe6')]){_0x205de9[_0xf7b6('0x171')]=_0x5282cc[_0xf7b6('0x172')]||0x9c4;_0x205de9[_0xf7b6('0x173')]=_0x5282cc[_0xf7b6('0x174')]||0x5dc;_0x205de9[_0xf7b6('0x175')]=_0x5282cc[_0xf7b6('0x176')]||0x320;_0x205de9[_0xf7b6('0x177')]=_0x5282cc[_0xf7b6('0x178')]||0x1388;_0x205de9[_0xf7b6('0x179')]=_0x5282cc[_0xf7b6('0x17a')]||0x64;_0x205de9['XMD-AMDBETWEENWORDSSILENCE']=_0x5282cc[_0xf7b6('0x17b')]||0x32;_0x205de9['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5282cc[_0xf7b6('0x17c')]||0x3;_0x205de9[_0xf7b6('0x17d')]=_0x5282cc[_0xf7b6('0x17e')]||0x100;_0x205de9[_0xf7b6('0x17f')]=_0x5282cc['dialAMDMaximumWordLength']||0x1388;}if(_0x5282cc[_0xf7b6('0x4d')]===_0xf7b6('0x4e')){_0x205de9['XMD-VOICEQUEUEID']=_0x44af5b[_0xf7b6('0xd3')];}else{_0x205de9[_0xf7b6('0x180')]=_0x44af5b[_0xf7b6('0xd4')];}for(var _0x1b07b4 in _0x44af5b[_0xf7b6('0x16a')]){if(typeof _0x44af5b['Contact'][_0x1b07b4]!=='undefined'){if(isNotNull(_0x44af5b['Contact'][_0x1b07b4])&&_0x1b07b4!=='id'&&_0x1b07b4!==_0xf7b6('0x181')&&_0x1b07b4!==_0xf7b6('0x182')&&_0x1b07b4!==_0xf7b6('0x183')){_0x205de9[util[_0xf7b6('0x77')]('%s%s','XMD-',_['toUpper'](_0x1b07b4))]=_0x44af5b[_0xf7b6('0x16a')][_0x1b07b4];}}}var _0x585ffb=_0x3b54b9['isTrunkReachable'](_0x5282cc[_0xf7b6('0x74')])?getCallerId(_0x5282cc['Trunk']['callerid'],_0x5282cc[_0xf7b6('0x184')],_0x5282cc[_0xf7b6('0x185')]>0x0?getCallerIdRandom(_0x5282cc[_0xf7b6('0x57')],_0x5282cc[_0xf7b6('0x185')]):_0x5282cc[_0xf7b6('0x57')]):getCallerId(_[_0xf7b6('0xad')](_0x5282cc[_0xf7b6('0x13f')])?_0x5282cc['Trunk'][_0xf7b6('0x76')]:_0x5282cc[_0xf7b6('0x13f')][_0xf7b6('0x76')],_0x5282cc[_0xf7b6('0x184')],_0x5282cc[_0xf7b6('0x185')]>0x0?getCallerIdRandom(_0x5282cc['dialOriginateCallerIdNumber'],_0x5282cc[_0xf7b6('0x185')]):_0x5282cc[_0xf7b6('0x57')]);if(_0x585ffb){_0x205de9[_0xf7b6('0x186')]=_0x3b54b9[_0xf7b6('0x26')][_0x24813a][_0xf7b6('0x187')]=extractCalleridName(_0x585ffb);_0x205de9['XMD-ORIGINATECALLERIDNUM']=_0x3b54b9[_0xf7b6('0x26')][_0x24813a][_0xf7b6('0x188')]=extractCalleridNumber(_0x585ffb);}return ami[_0xf7b6('0xae')]({'actionid':_0x24813a,'action':_0xf7b6('0x16b'),'channel':_0x3b54b9[_0xf7b6('0xd9')](_0x5282cc['Trunk'])?util[_0xf7b6('0x77')](_0xf7b6('0x189'),_0x5282cc[_0xf7b6('0x74')][_0xf7b6('0x40')],isNotNull(_0x5282cc[_0xf7b6('0x59')])?_0x5282cc[_0xf7b6('0x59')]['trim']()||'':'',_0x5282cc[_0xf7b6('0x18a')]>0x0?_0x44af5b[_0xf7b6('0x16a')][_0xf7b6('0x169')][_0xf7b6('0x18b')](_0x5282cc[_0xf7b6('0x18a')]):_0x44af5b[_0xf7b6('0x16a')][_0xf7b6('0x169')]):util['format']('SIP/%s/%s%s',_[_0xf7b6('0xad')](_0x5282cc['TrunkBackup'])?_0x5282cc[_0xf7b6('0x74')][_0xf7b6('0x40')]:_0x5282cc[_0xf7b6('0x13f')][_0xf7b6('0x40')],isNotNull(_0x5282cc[_0xf7b6('0x59')])?_0x5282cc[_0xf7b6('0x59')]['trim']()||'':'',_0x5282cc['dialCutDigit']>0x0?_0x44af5b[_0xf7b6('0x16a')][_0xf7b6('0x169')][_0xf7b6('0x18b')](_0x5282cc[_0xf7b6('0x18a')]):_0x44af5b[_0xf7b6('0x16a')][_0xf7b6('0x169')]),'callerid':_0x585ffb,'Exten':_0xf7b6('0xe0'),'Context':_0xf7b6('0x18c'),'Priority':'1','variable':_0x205de9,'timeout':(_0x5282cc[_0xf7b6('0x58')]||0x1e)*0x3e8,'async':!![],'channelid':_0x24813a})[_0xf7b6('0xb4')](function(_0x160182){return _0x32760b(_0x160182);})[_0xf7b6('0xb8')](function(_0x45eb42){_0x5282cc[_0xf7b6('0x62')]+=0x1;var _0x28b9a4=new History(_0x3b54b9[_0xf7b6('0x26')][_0x24813a]);logger['error'](util[_0xf7b6('0x77')](_0xf7b6('0x18d'),JSON[_0xf7b6('0x49')](_0x45eb42)));_0x28b9a4[_0xf7b6('0xe9')]=0xe;_0x28b9a4[_0xf7b6('0xea')]='OriginateError';_0x28b9a4['starttime']=moment()[_0xf7b6('0x77')](_0xf7b6('0xfd'));_0x28b9a4[_0xf7b6('0x124')]=_0x28b9a4[_0xf7b6('0xa9')];_0x3b54b9[_0xf7b6('0xc9')](_0x28b9a4)[_0xf7b6('0xb8')](loggerCatch('[originate][error]'));_0x3b54b9[_0xf7b6('0xc7')](_0x28b9a4)[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x18e')))['finally'](function(){delete _0x3b54b9[_0xf7b6('0x26')][_0x24813a];return _0x4892a1(msgResponse(_0xf7b6('0x16b'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0xf7b6('0x1d')][_0xf7b6('0x33')]=function(_0x2b901c){var _0x1f7fc7=this[_0xf7b6('0x26')][_0x2b901c[_0xf7b6('0x127')]];if(_0x1f7fc7){delete this[_0xf7b6('0x26')][_0x2b901c['actionid']];_0x1f7fc7[_0xf7b6('0x116')]=moment()[_0xf7b6('0x77')](_0xf7b6('0xfd'));var _0x2d30cf=_0x1f7fc7[_0xf7b6('0x4d')]==='ivr'?this['campaigns'][_0x1f7fc7['queue']]:this[_0xf7b6('0x21')][_0x1f7fc7['getQueue']()];if(!this[_0xf7b6('0xd7')](_0x2b901c[_0xf7b6('0x18f')])){this[_0xf7b6('0xca')](_0x2d30cf);return this['callProgressDetecting'](_0x1f7fc7,_0x2d30cf,_0x2b901c)['catch'](loggerCatch(_0xf7b6('0x190')));}this[_0xf7b6('0xab')][_0x2b901c['uniqueid']]=_0x1f7fc7;}};Dialer[_0xf7b6('0x1d')]['checkRetriveMax']=function(_0x3954e4,_0x542812,_0x2da7f5){var _0xaa6fef=new History(_0x542812);if(_0xaa6fef[_0xf7b6('0x191')]+_0xaa6fef[_0xf7b6('0xef')]+_0xaa6fef[_0xf7b6('0xf0')]+_0xaa6fef['countnosuchnumberretry']+_0xaa6fef[_0xf7b6('0xf2')]+_0xaa6fef[_0xf7b6('0xf3')]+_0xaa6fef[_0xf7b6('0xf4')]+_0xaa6fef['countagentrejectretry']>=_0x2da7f5['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x3954e4){case 0x3:if(_0xaa6fef[_0xf7b6('0xf0')]>=_0x2da7f5[_0xf7b6('0x192')]-0x1){return!![];}this[_0xf7b6('0xbf')]({'active':![],'countnoanswerretry':_0xaa6fef[_0xf7b6('0xf0')]+=0x1,'scheduledat':moment()[_0xf7b6('0xfb')](_0x2da7f5[_0xf7b6('0x193')],_0xf7b6('0xfc'))[_0xf7b6('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xaa6fef['ContactId'],'ListId':_0xaa6fef[_0xf7b6('0xd1')],'VoiceQueueId':_0xaa6fef[_0xf7b6('0xd3')]||undefined,'CampaignId':_0xaa6fef[_0xf7b6('0xd4')]||undefined})[_0xf7b6('0xb8')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0xaa6fef[_0xf7b6('0x191')]>=_0x2da7f5[_0xf7b6('0x194')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0xaa6fef[_0xf7b6('0x191')]+=0x1,'scheduledat':moment()[_0xf7b6('0xfb')](_0x2da7f5[_0xf7b6('0x195')],_0xf7b6('0xfc'))['format'](_0xf7b6('0xfd')),'ContactId':_0xaa6fef[_0xf7b6('0x104')],'ListId':_0xaa6fef[_0xf7b6('0xd1')],'VoiceQueueId':_0xaa6fef['VoiceQueueId']||undefined,'CampaignId':_0xaa6fef[_0xf7b6('0xd4')]||undefined})[_0xf7b6('0xb8')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0xaa6fef[_0xf7b6('0xef')]>=_0x2da7f5[_0xf7b6('0x196')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0xaa6fef[_0xf7b6('0xef')]+=0x1,'scheduledat':moment()['add'](_0x2da7f5[_0xf7b6('0x197')],_0xf7b6('0xfc'))[_0xf7b6('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xaa6fef[_0xf7b6('0x104')],'ListId':_0xaa6fef[_0xf7b6('0xd1')],'VoiceQueueId':_0xaa6fef[_0xf7b6('0xd3')]||undefined,'CampaignId':_0xaa6fef[_0xf7b6('0xd4')]||undefined})[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x198')));break;case 0x0:if(_0xaa6fef['countnosuchnumberretry']>=_0x2da7f5[_0xf7b6('0x199')]-0x1){return!![];}else{this[_0xf7b6('0xbf')]({'active':![],'countnosuchnumberretry':_0xaa6fef[_0xf7b6('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x2da7f5[_0xf7b6('0x19a')],_0xf7b6('0xfc'))[_0xf7b6('0x77')](_0xf7b6('0xfd')),'ContactId':_0xaa6fef[_0xf7b6('0x104')],'ListId':_0xaa6fef[_0xf7b6('0xd1')],'VoiceQueueId':_0xaa6fef['VoiceQueueId']||undefined,'CampaignId':_0xaa6fef[_0xf7b6('0xd4')]||undefined})[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x19b')));}break;case 0xa:if(_0xaa6fef[_0xf7b6('0xf2')]>=_0x2da7f5['dialDropMaxRetry']-0x1){return!![];}this[_0xf7b6('0xbf')]({'active':![],'countdropretry':_0xaa6fef['countdropretry']+=0x1,'scheduledat':moment()[_0xf7b6('0xfb')](_0x2da7f5[_0xf7b6('0x19c')],_0xf7b6('0xfc'))[_0xf7b6('0x77')](_0xf7b6('0xfd')),'ContactId':_0xaa6fef['ContactId'],'ListId':_0xaa6fef[_0xf7b6('0xd1')],'VoiceQueueId':_0xaa6fef[_0xf7b6('0xd3')]||undefined,'CampaignId':_0xaa6fef[_0xf7b6('0xd4')]||undefined})[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x11c')));break;case 0xb:if(_0xaa6fef[_0xf7b6('0xf3')]>=_0x2da7f5[_0xf7b6('0x121')]-0x1){return!![];}this[_0xf7b6('0xbf')]({'active':![],'countabandonedretry':_0xaa6fef[_0xf7b6('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x2da7f5[_0xf7b6('0x122')],_0xf7b6('0xfc'))[_0xf7b6('0x77')](_0xf7b6('0xfd')),'ContactId':_0xaa6fef['ContactId'],'ListId':_0xaa6fef['ListId'],'VoiceQueueId':_0xaa6fef['VoiceQueueId']||undefined,'CampaignId':_0xaa6fef[_0xf7b6('0xd4')]||undefined})[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x123')));break;case 0x13:if(_0xaa6fef['countmachineretry']>=_0x2da7f5[_0xf7b6('0x102')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0xaa6fef[_0xf7b6('0xf4')]+=0x1,'scheduledat':moment()[_0xf7b6('0xfb')](_0x2da7f5[_0xf7b6('0x103')],_0xf7b6('0xfc'))[_0xf7b6('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xaa6fef['ContactId'],'ListId':_0xaa6fef[_0xf7b6('0xd1')],'VoiceQueueId':_0xaa6fef[_0xf7b6('0xd3')]||undefined,'CampaignId':_0xaa6fef[_0xf7b6('0xd4')]||undefined})[_0xf7b6('0xb8')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xaa6fef['countagentrejectretry']>=_0x2da7f5[_0xf7b6('0x19d')]-0x1){return!![];}this[_0xf7b6('0xbf')]({'active':![],'countagentrejectretry':_0xaa6fef[_0xf7b6('0xf5')]+=0x1,'scheduledat':moment()[_0xf7b6('0xfb')](_0x2da7f5[_0xf7b6('0x19e')],_0xf7b6('0xfc'))[_0xf7b6('0x77')](_0xf7b6('0xfd')),'ContactId':_0xaa6fef['ContactId'],'ListId':_0xaa6fef[_0xf7b6('0xd1')],'VoiceQueueId':_0xaa6fef[_0xf7b6('0xd3')]||undefined,'CampaignId':_0xaa6fef[_0xf7b6('0xd4')]||undefined})['catch'](loggerCatch(_0xf7b6('0x19f')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x5045f4,_0x5b1279,_0x481f80){var _0x223ad2=this;var _0x42577a=new History(_0x5045f4);return new BPromise(function(_0x4644ad,_0x2ca654){if(_[_0xf7b6('0x85')](_0x5b1279)&&typeof _0x5b1279!==_0xf7b6('0x168')){return _0x2ca654(msgResponse(_0xf7b6('0x1a0'),'Failure',_0xf7b6('0x1a1')));}if(_[_0xf7b6('0x85')](_0x481f80)&&typeof _0x481f80!==_0xf7b6('0x168')){return _0x2ca654(msgResponse('[callProgressDetecting]',_0xf7b6('0x145'),_0xf7b6('0x1a2')));}switch(_0x481f80[_0xf7b6('0x10b')]){case'0':_0x5b1279['outboundNoSuchCallsDay']+=0x1;_0x42577a[_0xf7b6('0xe9')]=0x0;_0x42577a[_0xf7b6('0xea')]=_0xf7b6('0x1a3');_0x42577a[_0xf7b6('0xf1')]+=0x1;_0x42577a[_0xf7b6('0xed')]+=0x1;ami[_0xf7b6('0x4c')](_0xf7b6('0x1a4'),ut['buildObj'](_0x5045f4,'nosuchnumber'));_0x223ad2['createHistory'](_0x42577a)[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x101')));if(_0x223ad2[_0xf7b6('0x1a5')](0x0,_0x5045f4,_0x5b1279)){if(_0x42577a[_0xf7b6('0xf1')]>=_0x5b1279[_0xf7b6('0x199')]){_0x223ad2[_0xf7b6('0xf9')](_0x42577a,_0x4644ad,_0x2ca654,_0xf7b6('0x1a6'));}else{_0x223ad2['stateGlobal'](_0x42577a,_0x4644ad,_0x2ca654,_0xf7b6('0x1a6'));}}break;case'3':_0x5b1279[_0xf7b6('0x60')]+=0x1;_0x42577a[_0xf7b6('0xe9')]=0x3;_0x42577a[_0xf7b6('0xea')]='NoAnswer';_0x42577a[_0xf7b6('0xf0')]+=0x1;_0x42577a['countglobal']+=0x1;ami[_0xf7b6('0x4c')](_0xf7b6('0x1a7'),ut[_0xf7b6('0x1a8')](_0x5045f4,_0xf7b6('0x1a9')));_0x223ad2[_0xf7b6('0xc9')](_0x42577a)[_0xf7b6('0xb8')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x223ad2[_0xf7b6('0x1a5')](0x3,_0x5045f4,_0x5b1279)){if(_0x42577a[_0xf7b6('0xf0')]>=_0x5b1279[_0xf7b6('0x192')]){_0x223ad2[_0xf7b6('0xf9')](_0x42577a,_0x4644ad,_0x2ca654,'reason\x203\x20ringing\x20no\x20answer');}else{_0x223ad2['stateGlobal'](_0x42577a,_0x4644ad,_0x2ca654,_0xf7b6('0x1aa'));}}break;case'5':_0x5b1279[_0xf7b6('0x5d')]+=0x1;_0x42577a[_0xf7b6('0xe9')]=0x5;_0x42577a[_0xf7b6('0xea')]=_0xf7b6('0x1ab');_0x42577a[_0xf7b6('0x191')]+=0x1;_0x42577a['countglobal']+=0x1;ami[_0xf7b6('0x4c')](_0xf7b6('0x1ac'),ut[_0xf7b6('0x1a8')](_0x5045f4,_0xf7b6('0x1ad')));_0x223ad2['createHistory'](_0x42577a)['catch'](loggerCatch(_0xf7b6('0x1ae')));if(_0x223ad2[_0xf7b6('0x1a5')](0x5,_0x5045f4,_0x5b1279)){if(_0x42577a[_0xf7b6('0x191')]>=_0x5b1279[_0xf7b6('0x194')]){_0x223ad2[_0xf7b6('0xf9')](_0x42577a,_0x4644ad,_0x2ca654,_0xf7b6('0x1af'));}else{_0x223ad2[_0xf7b6('0xf7')](_0x42577a,_0x4644ad,_0x2ca654,_0xf7b6('0x1af'));}}break;case'8':_0x5b1279[_0xf7b6('0x5e')]+=0x1;_0x42577a[_0xf7b6('0xe9')]=0x8;_0x42577a[_0xf7b6('0xea')]='Congestion';_0x42577a[_0xf7b6('0xef')]+=0x1;_0x42577a['countglobal']+=0x1;ami[_0xf7b6('0x4c')](_0xf7b6('0x1b0'),ut[_0xf7b6('0x1a8')](_0x5045f4,'congestion'));_0x223ad2['createHistory'](_0x42577a)[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x1b1')));if(_0x223ad2[_0xf7b6('0x1a5')](0x8,_0x5045f4,_0x5b1279)){if(_0x42577a[_0xf7b6('0xef')]>=_0x5b1279[_0xf7b6('0x196')]){_0x223ad2[_0xf7b6('0xf9')](_0x42577a,_0x4644ad,_0x2ca654,_0xf7b6('0x1b2'));}else{_0x223ad2[_0xf7b6('0xf7')](_0x42577a,_0x4644ad,_0x2ca654,'reason\x208\x20congestion');}}break;case'11':_0x5b1279['outboundAbandonedCallsDay']+=0x1;_0x42577a[_0xf7b6('0xe9')]=0xb;_0x42577a[_0xf7b6('0xea')]=_0xf7b6('0x11f');_0x42577a[_0xf7b6('0xf3')]+=0x1;_0x42577a['countglobal']+=0x1;_0x223ad2[_0xf7b6('0xc9')](_0x42577a)['catch'](loggerCatch(_0xf7b6('0x125')));if(_0x223ad2['checkRetriveMax'](0xb,_0x5045f4,_0x5b1279)){if(_0x42577a[_0xf7b6('0xf3')]>=_0x5b1279[_0xf7b6('0x121')]){_0x223ad2[_0xf7b6('0xf9')](_0x42577a,_0x4644ad,_0x2ca654,_0xf7b6('0x1b3'));}else{_0x223ad2[_0xf7b6('0xf7')](_0x42577a,_0x4644ad,_0x2ca654,_0xf7b6('0x1b3'));}}break;case'20':_0x5b1279[_0xf7b6('0x64')]+=0x1;_0x42577a['state']=0x14;_0x42577a[_0xf7b6('0xea')]='AgentReject';_0x42577a[_0xf7b6('0xf5')]+=0x1;_0x42577a['countglobal']+=0x1;ami[_0xf7b6('0x4c')](_0xf7b6('0x1b4'),ut[_0xf7b6('0x1a8')](_0x5045f4,'agentreject'));_0x223ad2['createHistory'](_0x42577a)['catch'](loggerCatch(_0xf7b6('0x1b5')));if(_0x223ad2['checkRetriveMax'](0x14,_0x5045f4,_0x5b1279)){if(_0x42577a[_0xf7b6('0xf5')]>=_0x5b1279[_0xf7b6('0x19d')]){_0x223ad2['createStateFinal'](_0x42577a,_0x4644ad,_0x2ca654,'reason\x2020\x20agentreject');}else{_0x223ad2['stateGlobal'](_0x42577a,_0x4644ad,_0x2ca654,_0xf7b6('0x1b6'));}}break;default:_0x5b1279[_0xf7b6('0x65')]+=0x1;_0x42577a['state']=0xc;_0x42577a[_0xf7b6('0xea')]=_0x481f80[_0xf7b6('0x10b')];_0x223ad2['createHistory'](_0x42577a)['catch'](loggerCatch(_0xf7b6('0x1b7')));if(_0x223ad2[_0xf7b6('0x1a5')](_0x481f80[_0xf7b6('0x10b')],_0x5045f4,_0x5b1279)){if(_0x42577a[_0xf7b6('0x191')]+_0x42577a[_0xf7b6('0xef')]+_0x42577a[_0xf7b6('0xf0')]+_0x42577a[_0xf7b6('0xf1')]+_0x42577a['countdropretry']+_0x42577a['countabandonedretry']+_0x42577a[_0xf7b6('0xf4')]+_0x42577a[_0xf7b6('0xf5')]>=_0x5b1279[_0xf7b6('0xf6')]){_0x223ad2[_0xf7b6('0xf7')](_0x42577a,_0x4644ad,_0x2ca654,_0x481f80[_0xf7b6('0x10b')]);}else{_0x223ad2[_0xf7b6('0xf9')](_0x42577a,_0x4644ad,_0x2ca654,_0x481f80[_0xf7b6('0x10b')]);}}}});};Dialer['prototype'][_0xf7b6('0xf7')]=function(_0x35e8c0,_0x190600,_0x412559,_0x51b924){var _0x5b04c7=new Final(_0x35e8c0);_0x5b04c7[_0xf7b6('0xe9')]=0xf;_0x5b04c7['statedesc']='Global';this['createStateFinal'](_0x5b04c7,_0x190600,_0x412559,_0x51b924);};Dialer[_0xf7b6('0x1d')][_0xf7b6('0xf9')]=function(_0x88b96a,_0x1e0990,_0x19d879,_0x2c643b){this[_0xf7b6('0xc7')](_0x88b96a)[_0xf7b6('0xb4')](function(){return _0x1e0990(msgResponse(_0xf7b6('0x1a0'),_0xf7b6('0xd8'),_0x2c643b));})[_0xf7b6('0xb8')](function(){return _0x19d879(msgResponse('[moveContactManagedDialer][0]',_0xf7b6('0x145'),_0xf7b6('0x1b8')));});};Dialer[_0xf7b6('0x1d')][_0xf7b6('0xa')]=function(_0x2981de){var _0xcabe37=_0x2981de[_0xf7b6('0x1b9')]/0x64;var _0x1586cd=_0x2981de[_0xf7b6('0x117')]/(_0x2981de[_0xf7b6('0x117')]+_0x2981de[_0xf7b6('0x5b')]);var _0x124bb2=Math['round'](_0x2981de[_0xf7b6('0x6e')]*(_0x2981de[_0xf7b6('0x1ba')]/0x64));var _0x453b74=Math['round'](_0x2981de[_0xf7b6('0x6e')]*(_0x2981de[_0xf7b6('0x1bb')]/0x64));var _0x26a113=_0x2981de['available']+_0x2981de[_0xf7b6('0xa2')];var _0x3cd366=Math['floor'](_0x2981de[_0xf7b6('0x70')]*_0x2981de['erlangAbandonmentRate']*_0x2981de[_0xf7b6('0x1bc')]*_0x2981de[_0xf7b6('0x6c')]);if(_[_0xf7b6('0x85')](_0x2981de[_0xf7b6('0x2a')])){if(!_[_0xf7b6('0x85')](_0x2981de[_0xf7b6('0x29')])){_0x2981de[_0xf7b6('0x29')]=undefined;loggerPredictive[_0xf7b6('0x97')]('[startMethodPredictive][StartProgressive]',_0xf7b6('0x1bd'));}if(!_[_0xf7b6('0x85')](_0x2981de[_0xf7b6('0x93')])){loggerPredictive[_0xf7b6('0x97')](_0xf7b6('0x1be'),_0xf7b6('0x1bf'));clearInterval(_0x2981de[_0xf7b6('0x93')]);_0x2981de[_0xf7b6('0x93')]=undefined;}_0x2981de[_0xf7b6('0x2a')]=moment()[_0xf7b6('0x77')](_0xf7b6('0xfd'));loggerPredictive[_0xf7b6('0x7d')](_0x2981de[_0xf7b6('0x40')],_0xf7b6('0x1c0'),_0x2981de[_0xf7b6('0x2a')]);this[_0xf7b6('0x15a')](_0x2981de,0x1);}else if(ifInterval(_0x2981de[_0xf7b6('0x1c1')],_0x2981de[_0xf7b6('0x2a')])){this[_0xf7b6('0x15a')](_0x2981de,0x1);loggerPredictiveCalls[_0xf7b6('0x7d')](_0xf7b6('0x1c2'),_0x2981de[_0xf7b6('0x2a')],_0x2981de[_0xf7b6('0x40')]);_0x2981de[_0xf7b6('0x70')]=0x0;_0x2981de[_0xf7b6('0x6b')]=0x0;}else if(_0xcabe37<_0x1586cd&&_0x2981de[_0xf7b6('0x1c3')]===_0xf7b6('0x1c4')){freeVariablesPredictive(_0x2981de);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x1c5'),_0xf7b6('0x1c6'),_0x1586cd,_0xf7b6('0x2a'),_0x2981de[_0xf7b6('0x40')]);}else if(_0x3cd366<_0x2981de[_0xf7b6('0x6b')]&&_0x2981de['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x2981de);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x1c7'),'Max\x20Drop\x20',_0x3cd366,_0xf7b6('0x1c8'),_0x2981de[_0xf7b6('0x6b')],_0xf7b6('0x2a'),_0x2981de[_0xf7b6('0x40')]);}else if(!ifInterval(_0x2981de[_0xf7b6('0x1c1')],_0x2981de[_0xf7b6('0x2a')])&&_[_0xf7b6('0x85')](_0x2981de['startPredictive'])&&!_[_0xf7b6('0x85')](_0x2981de['startProgressive'])){_0x2981de[_0xf7b6('0x29')]=moment()[_0xf7b6('0x77')](_0xf7b6('0xfd'));loggerPredictive[_0xf7b6('0x7d')](_0x2981de[_0xf7b6('0x40')],_0xf7b6('0x1c9'),_0x2981de[_0xf7b6('0x29')]);this[_0xf7b6('0x1ca')](_0x2981de[_0xf7b6('0x1c1')])[_0xf7b6('0xb4')](this[_0xf7b6('0x1cb')](_0x2981de))[_0xf7b6('0xb4')](mergeDataErlangB(_0x2981de))[_0xf7b6('0xb4')](this[_0xf7b6('0x1cc')](_0x2981de))[_0xf7b6('0xb8')](loggerCatchPredictive(_0xf7b6('0x1cd'),_0x2981de));}else if(!ifInterval(_0x2981de[_0xf7b6('0x1c1')],_0x2981de[_0xf7b6('0x29')])){_0x2981de['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2981de[_0xf7b6('0x29')]=moment()['format'](_0xf7b6('0xfd'));loggerPredictive[_0xf7b6('0x7d')](_0x2981de[_0xf7b6('0x40')],'recalculate\x20predictive\x20at',_0x2981de[_0xf7b6('0x29')]);clearInterval(_0x2981de['handlePredictive']);_0x2981de[_0xf7b6('0x93')]=undefined;this[_0xf7b6('0x1ca')](_0x2981de[_0xf7b6('0x1c1')])[_0xf7b6('0xb4')](this[_0xf7b6('0x1cb')](_0x2981de))[_0xf7b6('0xb4')](mergeDataErlangB(_0x2981de))[_0xf7b6('0xb4')](this[_0xf7b6('0x1cc')](_0x2981de))[_0xf7b6('0xb8')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x2981de));}else if(_0x2981de['predictiveIntervalAvailable']&&_0x26a113<_0x2981de['predictiveIntervalAvailable']-_0x453b74){freeVariablesPredictive(_0x2981de);loggerPredictive[_0xf7b6('0x7d')](_0x2981de[_0xf7b6('0x40')],_0xf7b6('0x1ce'),_0x26a113,_0xf7b6('0x1cf'),_0x2981de[_0xf7b6('0x6e')],'-',_0x453b74,'=',_0x2981de[_0xf7b6('0x6e')]-_0x453b74,')');}else if(_0x2981de[_0xf7b6('0x6e')]&&_0x26a113>_0x2981de[_0xf7b6('0x6e')]+_0x124bb2){freeVariablesPredictive(_0x2981de);loggerPredictive[_0xf7b6('0x7d')](_0x2981de[_0xf7b6('0x40')],_0xf7b6('0x1ce'),_0x26a113,_0xf7b6('0x1d0'),_0x2981de[_0xf7b6('0x6e')],'+',_0x124bb2,'=',_0x2981de[_0xf7b6('0x6e')]+_0x124bb2,')');}};Dialer['prototype']['getDataPredictive']=function(_0x2c25a8){var _0x471966=this;return function(_0x14dc5e){return new BPromise(function(_0x56b2db,_0x264ac3){_[_0xf7b6('0x90')](_0x2c25a8,_0x14dc5e[0x0]);if(checkGetDataPredictive(_0x14dc5e[0x0])){var _0xe9208f=_0x2c25a8['predictiveIntervalAvailable']=_0x2c25a8[_0xf7b6('0xa2')]+_0x2c25a8[_0xf7b6('0xa3')];var _0x1df131=_0x2c25a8[_0xf7b6('0x1c1')]*0x3c;var _0x17c9f3=_0x14dc5e[0x0][_0xf7b6('0x86')]+_0x14dc5e[0x0]['predictiveIntervalAvgHoldtime'];var _0x315285=(_0x14dc5e[0x0][_0xf7b6('0x66')]+_0x14dc5e[0x0][_0xf7b6('0x69')]+_0x14dc5e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x14dc5e[0x0][_0xf7b6('0x84')];_0x2c25a8[_0xf7b6('0x1bc')]=_0x315285>0x0?_0x315285:0x1;switch(_0x2c25a8[_0xf7b6('0x1c3')]){case _0xf7b6('0x1c4'):var _0x2d163a=_0x2c25a8[_0xf7b6('0x1b9')]/0x64;return _0x471966[_0xf7b6('0x1d1')](_0xe9208f,_0x1df131,_0x17c9f3,_0x315285,_0x2d163a)[_0xf7b6('0xb4')](function(_0x3785ea){return _0x56b2db(_0x3785ea);});case _0xf7b6('0x1d2'):var _0x401040=_0x2c25a8['dialPredictiveOptimizationPercentage']/0x64;return _0x471966[_0xf7b6('0x1d3')](_0xe9208f,_0x1df131,_0x17c9f3,_0x315285,_0x401040)[_0xf7b6('0xb4')](function(_0x224cdb){return _0x56b2db(_0x224cdb);});default:return _0x264ac3(msgResponse('[getDataPredictive]',_0xf7b6('0x145'),_0xf7b6('0x1d4')));}}else{return _0x264ac3(msgResponse('[getDataPredictive]',_0xf7b6('0x145'),'check\x20failure'));}});};};Dialer[_0xf7b6('0x1d')][_0xf7b6('0x1d5')]=function(_0x317616){var _0x2e3241=this;return function(_0x3a7acc){return new BPromise(function(_0x49e847,_0x514064){_['merge'](_0x317616,_0x3a7acc[0x0]);if(checkGetDataPredictive(_0x3a7acc[0x0])){loggerPredictive['info'](JSON[_0xf7b6('0x49')](_0x3a7acc[0x0]));if(_0x317616[_0xf7b6('0x1c3')]===_0xf7b6('0x1c4')){return _0x2e3241[_0xf7b6('0xc5')](_0x317616['id'])['then'](function(_0x17999e){var _0x2e792d=_0x317616['loggedIn']-_0x17999e[0x0][_0xf7b6('0x1d6')];var _0x49c90a=_0x317616[_0xf7b6('0x1c1')]*0x3c;var _0x17c6d6=_0x3a7acc[0x0]['predictiveIntervalAvgTalktime']+_0x3a7acc[0x0][_0xf7b6('0x67')];var _0x1f4a79=(_0x3a7acc[0x0][_0xf7b6('0x66')]+_0x3a7acc[0x0][_0xf7b6('0x69')]+_0x3a7acc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3a7acc[0x0][_0xf7b6('0x84')];var _0x3d8344=_0x317616[_0xf7b6('0x1b9')]/0x64;_0x317616[_0xf7b6('0x6d')]=_0x17999e[0x0][_0xf7b6('0x1d6')]||0x0;_0x317616[_0xf7b6('0x1bc')]=_0x1f4a79>0x0?_0x1f4a79:0x1;return _0x2e3241[_0xf7b6('0x1d1')](_0x2e792d,_0x49c90a,_0x17c6d6,_0x1f4a79,_0x3d8344);})[_0xf7b6('0xb4')](function(_0x23d50c){return _0x49e847(_0x23d50c);})[_0xf7b6('0xb8')](function(_0x2a9d6a){return _0x514064(msgResponse(_0xf7b6('0x1d7'),'Failure',JSON[_0xf7b6('0x49')](_0x2a9d6a)));});}if(_0x317616[_0xf7b6('0x1c3')]===_0xf7b6('0x1d2')){return _0x2e3241['getVoiceQueueRtPauses'](_0x317616['id'])[_0xf7b6('0xb4')](function(_0x431883){var _0x57c99a=_0x317616[_0xf7b6('0x15f')]-_0x431883[0x0][_0xf7b6('0x1d6')];var _0x4bf5c5=_0x317616['dialPredictiveInterval']*0x3c;var _0x3a8dc2=_0x3a7acc[0x0][_0xf7b6('0x86')]+_0x3a7acc[0x0][_0xf7b6('0x67')];var _0x3afdb6=(_0x3a7acc[0x0][_0xf7b6('0x66')]+_0x3a7acc[0x0][_0xf7b6('0x69')]+_0x3a7acc[0x0][_0xf7b6('0x68')])/_0x3a7acc[0x0][_0xf7b6('0x84')];var _0x29f7d7=_0x317616[_0xf7b6('0x1b9')]/0x64;_0x317616[_0xf7b6('0x6d')]=_0x431883[0x0][_0xf7b6('0x1d6')]||0x0;_0x317616[_0xf7b6('0x1bc')]=_0x3afdb6>0x0?_0x3afdb6:0x1;return _0x2e3241['busyFactor'](_0x57c99a,_0x4bf5c5,_0x3a8dc2,_0x3afdb6,_0x29f7d7);})[_0xf7b6('0xb4')](function(_0x1d5467){return _0x49e847(_0x1d5467);})[_0xf7b6('0xb8')](function(_0x59fedc){return _0x514064(msgResponse('[CatchErlangB]','Failure',JSON[_0xf7b6('0x49')](_0x59fedc)));});}}else{return _0x514064(msgResponse('[getDataPredictive]','Failure',_0xf7b6('0x1d8')));}});};};Dialer[_0xf7b6('0x1d')]['startMethodPredictive']=function(_0x4d3633){var _0x1cba2d=this;return function(){var _0xf28f1=0x0;var _0x353a85=Math[_0xf7b6('0x1d9')](_0x4d3633[_0xf7b6('0x71')]*0x3e8);if(_0x353a85>0x0){_0x353a85=_0x353a85<0x64?0x64:_0x353a85;loggerPredictive[_0xf7b6('0x7d')](_0x4d3633[_0xf7b6('0x40')],_0xf7b6('0x1da'),_0x353a85,_0xf7b6('0x4a'));_0x4d3633[_0xf7b6('0x93')]=setInterval(function(){_0x1cba2d[_0xf7b6('0x93')](_0x4d3633);loggerPredictiveCalls[_0xf7b6('0x7d')]('[handlePredictive]',_0xf28f1+=0x1);},_0x353a85);}else{loggerPredictive['info'](_0x4d3633[_0xf7b6('0x40')],_0xf7b6('0x1db'));}};};Dialer[_0xf7b6('0x1d')][_0xf7b6('0x1dc')]=function(_0x3031e6,_0x32a50f){var _0x12ea64=this;return function(_0xaacc40){if(_['isEmpty'](_0xaacc40)){if(_['isNil'](_0x32a50f[_0xf7b6('0xd2')])||!_0x32a50f[_0xf7b6('0x1dd')]){if(_0x3031e6[_0xf7b6('0x158')]===_0xf7b6('0x9')){_0x3031e6['queueStatusComplete']=_[_0xf7b6('0x85')](_0x3031e6[_0xf7b6('0x12d')])?!![]:_0x3031e6['queueStatusComplete'];var _0x273539=uuid['v4']();_0x12ea64[_0xf7b6('0x26')][_0x273539]=new Action(_0x3031e6,_0x32a50f,_0x273539);loggerBooked[_0xf7b6('0x7d')]('[booked][checkContactBlack]',_0x273539,_0xf7b6('0x1de'),JSON[_0xf7b6('0x49')](_0x3031e6[_0xf7b6('0x12d')]),_0xf7b6('0x1df'),_0x3031e6['name']);if(_0x3031e6[_0xf7b6('0x12d')]){_0x3031e6['queueStatusComplete']=![];_0x12ea64[_0xf7b6('0x2c')][_0x12ea64['actions'][_0x273539][_0xf7b6('0xb3')]]=[];ami[_0xf7b6('0xae')]({'actionid':_0x273539,'action':_0xf7b6('0x1e0'),'queue':_0x3031e6[_0xf7b6('0x40')]})[_0xf7b6('0xb8')](function(){_0x12ea64[_0xf7b6('0xca')](_0x3031e6);_0x12ea64[_0xf7b6('0xbf')]({'active':![],'ContactId':_0x12ea64[_0xf7b6('0x26')][_0x273539]['ContactId'],'ListId':_0x12ea64['actions'][_0x273539]['ListId'],'VoiceQueueId':_0x12ea64[_0xf7b6('0x26')][_0x273539][_0xf7b6('0xd3')]||undefined,'CampaignId':_0x12ea64[_0xf7b6('0x26')][_0x273539][_0xf7b6('0xd4')]||undefined})[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x1e1')));delete _0x12ea64['actions'][_0x273539];});}else{loggerBooked[_0xf7b6('0x7d')](_0xf7b6('0x1e2'),JSON['stringify'](_0x3031e6['queueStatusComplete']),_0xf7b6('0x1df'),_0x3031e6[_0xf7b6('0x40')]);_0x12ea64[_0xf7b6('0xca')](_0x3031e6);_0x12ea64['rescheduleContact']({'active':![],'ContactId':_0x12ea64[_0xf7b6('0x26')][_0x273539]['ContactId'],'ListId':_0x12ea64[_0xf7b6('0x26')][_0x273539]['ListId'],'VoiceQueueId':_0x12ea64[_0xf7b6('0x26')][_0x273539][_0xf7b6('0xd3')]||undefined,'CampaignId':_0x12ea64[_0xf7b6('0x26')][_0x273539][_0xf7b6('0xd4')]||undefined})[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0x1e1')));delete _0x12ea64[_0xf7b6('0x26')][_0x273539];}}else{return _0x12ea64[_0xf7b6('0x1e3')](_0x3031e6,_0x32a50f);}}else{if(getDiff(_0x32a50f[_0xf7b6('0x1e4')])<_0x3031e6[_0xf7b6('0x1e5')]*0x3c){if(_0x32a50f[_0xf7b6('0x1e6')]&&!_0x32a50f[_0xf7b6('0x1e6')][_0xf7b6('0x1e7')]){_0x12ea64[_0xf7b6('0x12f')][_0xf7b6('0x130')](_0x32a50f['id'])['finally'](function(){_0x12ea64[_0xf7b6('0xca')](_0x3031e6);});}else{_0x12ea64[_0xf7b6('0xc1')]({'active':![]},_0x32a50f['id'],0x1)[_0xf7b6('0x1f')](function(){_0x12ea64[_0xf7b6('0xca')](_0x3031e6);});}}else{_0x3031e6[_0xf7b6('0x63')]+=0x1;_0x12ea64[_0xf7b6('0xca')](_0x3031e6);if(_0x3031e6[_0xf7b6('0x1e8')]){_0x12ea64['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x32a50f[_0xf7b6('0x104')],'ListId':_0x32a50f[_0xf7b6('0xd1')],'VoiceQueueId':_0x32a50f['VoiceQueueId']||undefined,'CampaignId':_0x32a50f[_0xf7b6('0xd4')]||undefined})['catch'](loggerCatch(_0xf7b6('0x1e9')));_0x12ea64[_0xf7b6('0xc9')](createObjHistory(_0x3031e6,_0x32a50f,_0xf7b6('0x1ea'),0x17,_0xf7b6('0x1eb')))[_0xf7b6('0xb8')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x12ea64['saveInDb'](createObjHistory(_0x3031e6,_0x32a50f,_0xf7b6('0x1ec'),0x16,_0xf7b6('0x1ed')),_0xf7b6('0x1ee'),_0xf7b6('0x1ef'));}}}}else{_0x3031e6[_0xf7b6('0x5c')]+=0x1;_0x12ea64['saveInDb'](createObjHistory(_0x3031e6,_0x32a50f,'BLACKLIST',0xd,_0xf7b6('0x1f0')),_0xf7b6('0x1f1'),_0xf7b6('0x1f2'));throw _0xf7b6('0x1f3');}};};Dialer['prototype'][_0xf7b6('0x15e')]=function(_0x6b607a){var _0x6b16d=this;var _0x1d0cd4=_0x6b607a[_0xf7b6('0x1f4')]-_0x6b607a['originated']-_0x6b607a[_0xf7b6('0x1f5')];emitCampaignSummary(_0x6b607a);if(_0x1d0cd4>0x0){if(_0x1d0cd4>this['maxNumberOriginate']){_0x1d0cd4=this[_0xf7b6('0x25')];}_0x6b607a[_0xf7b6('0x1f5')]+=_0x1d0cd4;this[_0xf7b6('0x1f6')](_0x6b607a['id'],_0x1d0cd4,_0x6b607a[_0xf7b6('0x1f7')])[_0xf7b6('0xb4')](function(_0x416325){_0x6b607a[_0xf7b6('0x1f5')]-=_0x1d0cd4;_0x6b607a[_0xf7b6('0x1f5')]=_0x6b607a[_0xf7b6('0x1f5')]>0x0?_0x6b607a[_0xf7b6('0x1f5')]:0x0;if(!checkContactEmpty(_0x416325)){_0x6b607a[_0xf7b6('0x3f')]=_0xf7b6('0x9f');logger[_0xf7b6('0x7d')]('[getContactCampaign2][Empty]'+_0x6b607a[_0xf7b6('0x40')]);}else{_0x6b607a[_0xf7b6('0x6f')]+=_0x416325['length'];_0x6b607a['message']=_0xf7b6('0x1f8');for(var _0x30c79c=0x0;_0x30c79c<_0x416325['length'];_0x30c79c+=0x1){_0x6b607a[_0xf7b6('0x1f9')]+=0x1;if(_['isNil'](_0x416325[_0x30c79c])||_[_0xf7b6('0xad')](_0x416325[_0x30c79c]['Contact'])||_[_0xf7b6('0xad')](_0x416325[_0x30c79c]['Contact']['phone'])){_0x6b16d[_0xf7b6('0x1fa')](_0xf7b6('0x1fb'),_0x6b607a,_0x416325[_0x30c79c]);}else{_0x6b16d['checkIsBlackListIvr'](_[_0xf7b6('0xd0')](_0x416325[_0x30c79c],[_0xf7b6('0xd4'),_0xf7b6('0x1fc')]))[_0xf7b6('0xb4')](_0x6b16d[_0xf7b6('0x1dc')](_0x6b607a,_0x416325[_0x30c79c]))[_0xf7b6('0xb8')](_0x6b16d[_0xf7b6('0xcd')](_0xf7b6('0x1fd'),_0x6b607a));}}}})[_0xf7b6('0xb8')](loggerGetContactDialer(_0xf7b6('0x1fe'),_0x6b607a,_0x1d0cd4));}};Dialer[_0xf7b6('0x1d')][_0xf7b6('0x15a')]=function(_0x2a33f4,_0x721b9e){var _0x53e6e4=this;var _0x8e5dec=[];var _0xeb5e29=_0x721b9e>=0x1?_0x721b9e:0x1;if(_0x2a33f4[_0xf7b6('0x158')]===_0xf7b6('0x9')){_0xeb5e29=0x1;}var _0x11b8e3=Math['floor'](_0x2a33f4['available']*_0xeb5e29)-_0x2a33f4[_0xf7b6('0x6f')]-_0x2a33f4['temp'];emitVoiceQueueSummary(_0x2a33f4);if(_0x2a33f4[_0xf7b6('0x1ff')]>0x0){var _0x4b0673=_0x2a33f4[_0xf7b6('0x1ff')]-_0x2a33f4[_0xf7b6('0x6f')]-_0x2a33f4[_0xf7b6('0xa2')]-_0x2a33f4['temp']-_0x2a33f4[_0xf7b6('0x50')];if(_0x11b8e3>_0x4b0673){_0x11b8e3=_0x4b0673;}}if(_0x11b8e3>0x0){if(_0x2a33f4[_0xf7b6('0x158')]===_0xf7b6('0x9')){_0x11b8e3=0x1;}if(_0x11b8e3>this[_0xf7b6('0x25')]){_0x11b8e3=this['maxNumberOriginate'];}_0x2a33f4[_0xf7b6('0x1f5')]+=_0x11b8e3;for(var _0x59a87d in this[_0xf7b6('0x23')]){if(typeof this[_0xf7b6('0x23')][_0x59a87d]!=='undefined'){if(this[_0xf7b6('0x23')][_0x59a87d][_0xf7b6('0xe9')]===_0xf7b6('0x200')&&this['agents'][_0x59a87d][_0xf7b6('0xaf')]===_0xf7b6('0x201')){_0x8e5dec['push'](this[_0xf7b6('0x23')][_0x59a87d]['id']);}}}this[_0xf7b6('0xc3')](_0x2a33f4['id'],_0x8e5dec,_0x11b8e3,_0x2a33f4['dialOrderByScheduledAt'])['then'](function(_0x2b158f){_0x2a33f4[_0xf7b6('0x1f5')]-=_0x11b8e3;_0x2a33f4[_0xf7b6('0x1f5')]=_0x2a33f4['temp']>0x0?_0x2a33f4[_0xf7b6('0x1f5')]:0x0;if(!checkContactEmpty(_0x2b158f)){_0x53e6e4['countReScheduled'](_0x2a33f4)[_0xf7b6('0xb4')](sendMessageReschedule(_0x2a33f4))[_0xf7b6('0xb8')](loggerCatch(_0xf7b6('0xb6')));}else{_0x2a33f4[_0xf7b6('0x6f')]+=_0x2b158f[_0xf7b6('0x202')];_0x2a33f4[_0xf7b6('0x3f')]=_0x2a33f4[_0xf7b6('0x158')]==='booked'?_0xf7b6('0x170'):'RUNNING';for(var _0x287753=0x0;_0x287753<_0x2b158f[_0xf7b6('0x202')];_0x287753+=0x1){if(_['isNil'](_0x2b158f[_0x287753])||_[_0xf7b6('0xad')](_0x2b158f[_0x287753][_0xf7b6('0x16a')])||_[_0xf7b6('0xad')](_0x2b158f[_0x287753][_0xf7b6('0x16a')][_0xf7b6('0x169')])){_0x53e6e4['emptyContact'](_0xf7b6('0x1fb'),_0x2a33f4,_0x2b158f[_0x287753]);}else{_0x53e6e4[_0xf7b6('0xb7')](_['pick'](_0x2b158f[_0x287753],[_0xf7b6('0xd3'),_0xf7b6('0x1fc')]))[_0xf7b6('0xb4')](_0x53e6e4[_0xf7b6('0x1dc')](_0x2a33f4,_0x2b158f[_0x287753]))['catch'](_0x53e6e4[_0xf7b6('0xcd')]('[actionOriginate]\x20',_0x2a33f4));}}}})[_0xf7b6('0xb8')](loggerGetContactDialer(_0xf7b6('0x203'),_0x2a33f4,_0x11b8e3));}};Dialer[_0xf7b6('0x1d')][_0xf7b6('0x93')]=function(_0xcbbc){if(_0xcbbc[_0xf7b6('0x1ff')]>0x0){var _0x527859=_0xcbbc[_0xf7b6('0x1ff')]-_0xcbbc['originated']-_0xcbbc[_0xf7b6('0xa2')];if(_0x527859>0x0){this[_0xf7b6('0x204')](_0xcbbc);}else{loggerPredictiveCalls['info'](_0xf7b6('0x205'));}}else{this[_0xf7b6('0x204')](_0xcbbc);}};Dialer[_0xf7b6('0x1d')]['tryOriginatePredictive']=function(_0x4d3290){var _0x328aab=this;var _0x114b8b=[];_0x4d3290[_0xf7b6('0x6f')]+=0x1;for(var _0x211cfd in this[_0xf7b6('0x23')]){if(typeof this[_0xf7b6('0x23')][_0x211cfd]!=='undefined'){if(this[_0xf7b6('0x23')][_0x211cfd][_0xf7b6('0xe9')]===_0xf7b6('0x200')&&this[_0xf7b6('0x23')][_0x211cfd][_0xf7b6('0xaf')]==='reachable'){_0x114b8b[_0xf7b6('0x12b')](this[_0xf7b6('0x23')][_0x211cfd]['id']);}}}this[_0xf7b6('0xc3')](_0x4d3290['id'],_0x114b8b,0x1,_0x4d3290[_0xf7b6('0x1f7')])['then'](function(_0x3b401f){if(!checkContactEmpty(_0x3b401f)){checkContactLowerLimitOriginate(_0x4d3290,0x1,0x0);_0x328aab[_0xf7b6('0xb5')](_0x4d3290)[_0xf7b6('0xb4')](sendMessageReschedule(_0x4d3290))[_0xf7b6('0xb8')](loggerCatch('[countReScheduled]\x20'));}else{_0x4d3290[_0xf7b6('0x3f')]=_0xf7b6('0x1f8');if(_['isNil'](_0x3b401f[0x0])||_[_0xf7b6('0xad')](_0x3b401f[0x0][_0xf7b6('0x16a')])||_[_0xf7b6('0xad')](_0x3b401f[0x0][_0xf7b6('0x16a')][_0xf7b6('0x169')])){_0x328aab[_0xf7b6('0x1fa')](_0xf7b6('0x1fb'),_0x4d3290,_0x3b401f[0x0]);}else{_0x328aab[_0xf7b6('0xb7')](_['pick'](_0x3b401f[0x0],[_0xf7b6('0xd3'),_0xf7b6('0x1fc')]))['then'](_0x328aab[_0xf7b6('0x1dc')](_0x4d3290,_0x3b401f[0x0]))[_0xf7b6('0xb8')](_0x328aab['loggerHandler']('[actionOriginatePredictive]\x20',_0x4d3290));}}})[_0xf7b6('0xb8')](loggerGetContactDialer(_0xf7b6('0x206'),_0x4d3290,0x1));emitVoiceQueueSummary(_0x4d3290);};Dialer[_0xf7b6('0x1d')][_0xf7b6('0x1d1')]=function(_0x2d08c6,_0x3635ad,_0x3c674f,_0x49ab94,_0x2ae62f,_0x2d899d){loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x207'));loggerPredictive[_0xf7b6('0x7d')]('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',_0x2d08c6);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x208'),_0x3635ad);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x209'),_0x3c674f);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x20a'),_0x49ab94);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x20b'),_0x2ae62f);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x8f'));return new BPromise(function(_0x50f411,_0x28fd9c){if(_0x2d08c6<=0x0||isNaN(_0x2d08c6)){return _0x28fd9c(msgResponse(_0xf7b6('0x20c'),_0xf7b6('0x48'),'m\x20=\x20'+_0x2d08c6));}if(_0x3c674f<=0x0||isNaN(_0x3c674f)){return _0x28fd9c(msgResponse(_0xf7b6('0x20c'),_0xf7b6('0x48'),_0xf7b6('0x20d')+_0x3c674f));}if(_0x49ab94<=0x0||isNaN(_0x49ab94)){return _0x28fd9c(msgResponse('[abandonmentRate]',_0xf7b6('0x48'),'p\x20=\x20'+_0x49ab94));}if(_0x3635ad<=0x0||isNaN(_0x3635ad)){return _0x28fd9c(msgResponse(_0xf7b6('0x20c'),_0xf7b6('0x48'),_0xf7b6('0x20e')+_0x3635ad));}if(_0x2ae62f<=0x0||isNaN(_0x2ae62f)){return _0x28fd9c(msgResponse(_0xf7b6('0x20c'),'Error','Amax\x20=\x20'+_0x2ae62f));}_0x2d899d=_0x2d899d||0x0;var _0x1b18f6=0x1/_0x3c674f;var _0x375a86=0x0;var _0xc6aa19=0x0;var _0x3bfa93=0x0;var _0x576066=0x0;for(var _0x4dae49=0x0;_0x3bfa93<_0x2ae62f;_0x4dae49+=0x1){_0xc6aa19=_0x4dae49/_0x3635ad;_0x375a86=(_0x49ab94*_0xc6aa19+_0x2d899d)/_0x1b18f6;_0x3bfa93=erlangb(_0x375a86,_0x2d08c6);_0x576066=_0x375a86/_0x2d08c6*(0x1-erlangb(_0x375a86,_0x2d08c6));}return _0x50f411({'erlangCalls':_0x4dae49,'erlangCallToSecond':_0x3635ad/_0x4dae49,'erlangAbandonmentRate':_0x3bfa93,'erlangBusyFactor':_0x576066});});};Dialer['prototype']['busyFactor']=function(_0xd180f5,_0x135d0f,_0x4211dd,_0x331d18,_0x22b1f8,_0x433124){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0xf7b6('0x20f'),_0xd180f5);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x208'),_0x135d0f);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x209'),_0x4211dd);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x20a'),_0x331d18);loggerPredictive['info'](_0xf7b6('0x210'),_0x22b1f8);loggerPredictive[_0xf7b6('0x7d')](_0xf7b6('0x8f'));return new BPromise(function(_0x2ac481,_0x53dff3){if(_0xd180f5<=0x0||isNaN(_0xd180f5)){return _0x53dff3(msgResponse(_0xf7b6('0x211'),_0xf7b6('0x48'),_0xf7b6('0x212')+_0xd180f5));}if(_0x4211dd<=0x0||isNaN(_0x4211dd)){return _0x53dff3(msgResponse(_0xf7b6('0x211'),'Error',_0xf7b6('0x20d')+_0x4211dd));}if(_0x331d18<=0x0||isNaN(_0x331d18)){return _0x53dff3(msgResponse(_0xf7b6('0x211'),'Error',_0xf7b6('0x213')+_0x331d18));}if(_0x135d0f<=0x0||isNaN(_0x135d0f)){return _0x53dff3(msgResponse(_0xf7b6('0x211'),_0xf7b6('0x48'),_0xf7b6('0x20e')+_0x135d0f));}if(_0x22b1f8<=0x0||isNaN(_0x22b1f8)){return _0x53dff3(msgResponse(_0xf7b6('0x211'),_0xf7b6('0x48'),_0xf7b6('0x214')+_0x22b1f8));}_0x433124=_0x433124||0x0;var _0x24aee5=0x1/_0x4211dd;var _0x223778=0x0;var _0x28742f=0x0;var _0x18726d=0x0;var _0x5595a2=0x0;for(var _0x457494=0x0;_0x5595a2<_0x22b1f8;_0x457494+=0x1){_0x28742f=_0x457494/_0x135d0f;_0x223778=(_0x331d18*_0x28742f+_0x433124)/_0x24aee5;_0x18726d=erlangb(_0x223778,_0xd180f5);_0x5595a2=_0x223778/_0xd180f5*(0x1-erlangb(_0x223778,_0xd180f5));}return _0x2ac481({'erlangCalls':_0x457494,'erlangCallToSecond':_0x135d0f/_0x457494,'erlangAbandonmentRate':_0x18726d,'erlangBusyFactor':_0x5595a2});});};module[_0xf7b6('0x215')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index be679c1..196c0f4 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 _0x7f4d=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridnum','starttime','responsetime','droptime','endtime','ringtime','talktime','reason'];(function(_0x51cd4e,_0x5cfbab){var _0x4974e9=function(_0x2d2fdf){while(--_0x2d2fdf){_0x51cd4e['push'](_0x51cd4e['shift']());}};_0x4974e9(++_0x5cfbab);}(_0x7f4d,0x188));var _0xd7f4=function(_0x2404ac,_0x3b464b){_0x2404ac=_0x2404ac-0x0;var _0x4b26cd=_0x7f4d[_0x2404ac];return _0x4b26cd;};'use strict';var util=require('util');var _=require(_0xd7f4('0x0'));var moment=require('moment');function getSeconds(_0x550c23,_0x5e26aa){var _0x323cf7=moment(_0x550c23)[_0xd7f4('0x1')](0x0);var _0x11538f=moment(_0x5e26aa)[_0xd7f4('0x1')](0x0);return _0x323cf7['diff'](_0x11538f,_0xd7f4('0x2'));}function QueueCallerAbandon(_0x5ae692,_0x2457c6){this[_0xd7f4('0x3')]=_0x5ae692[_0xd7f4('0x3')];this[_0xd7f4('0x4')]=_0x5ae692[_0xd7f4('0x4')];this[_0xd7f4('0x5')]=_0x5ae692[_0xd7f4('0x4')]===_0xd7f4('0x6')?_0xd7f4('0x7'):_0x5ae692[_0xd7f4('0x4')];this[_0xd7f4('0x8')]=_0x5ae692['countbusyretry'];this[_0xd7f4('0x9')]=_0x5ae692[_0xd7f4('0x9')];this[_0xd7f4('0xa')]=_0x5ae692['countnoanswerretry'];this[_0xd7f4('0xb')]=_0x5ae692[_0xd7f4('0x8')]+_0x5ae692['countcongestionretry']+_0x5ae692[_0xd7f4('0xa')]+_0x5ae692[_0xd7f4('0xc')]+_0x5ae692['countdropretry']+_0x5ae692[_0xd7f4('0xd')]+_0x5ae692[_0xd7f4('0xe')]+_0x5ae692['countagentrejectretry'];this[_0xd7f4('0xc')]=_0x5ae692[_0xd7f4('0xc')];this[_0xd7f4('0xf')]=_0x5ae692['countdropretry'];this['countabandonedretry']=_0x5ae692['countabandonedretry'];this[_0xd7f4('0xe')]=_0x5ae692[_0xd7f4('0xe')];this[_0xd7f4('0x10')]=_0x5ae692[_0xd7f4('0x10')];this['uniqueid']=_0x2457c6[_0xd7f4('0x11')];this['calleridname']=_0x5ae692['name'];this[_0xd7f4('0x12')]=_0x5ae692['number'];this['starttime']=_0x5ae692[_0xd7f4('0x13')];this['responsetime']=_0x5ae692[_0xd7f4('0x14')];this[_0xd7f4('0x15')]=_0x5ae692[_0xd7f4('0x15')];this[_0xd7f4('0x16')]=this['droptime'];this[_0xd7f4('0x17')]=getSeconds(_0x5ae692['responsetime'],_0x5ae692['starttime']);this['holdtime']=getSeconds(this[_0xd7f4('0x15')],_0x5ae692[_0xd7f4('0x14')]);this[_0xd7f4('0x18')]=0x0;this['queue']=_0x2457c6[_0xd7f4('0x7')];this['membername']=_0x2457c6['connectedlinename'];this[_0xd7f4('0x19')]=_0x2457c6[_0xd7f4('0x19')];this[_0xd7f4('0x1a')]=_0x5ae692['callback'];this[_0xd7f4('0x1b')]=_0x5ae692[_0xd7f4('0x1b')];this[_0xd7f4('0x1c')]=_0x5ae692[_0xd7f4('0x1c')];this[_0xd7f4('0x1d')]=_0x5ae692[_0xd7f4('0x1d')];this[_0xd7f4('0x1e')]=_0x5ae692[_0xd7f4('0x1e')];this[_0xd7f4('0x1f')]=_0x5ae692['ListId'];this[_0xd7f4('0x20')]=_0x5ae692[_0xd7f4('0x20')];this['VoiceQueueId']=_0x5ae692[_0xd7f4('0x21')];this[_0xd7f4('0x22')]=_0x5ae692[_0xd7f4('0x22')];this[_0xd7f4('0x23')]=_0x5ae692[_0xd7f4('0x23')]||'';this[_0xd7f4('0x24')]=_0x5ae692['originatecalleridname']||'';}module[_0xd7f4('0x25')]=QueueCallerAbandon; \ No newline at end of file +var _0x8fc2=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x2042ee,_0x1a1e0a){var _0xe57ee7=function(_0x2e65e5){while(--_0x2e65e5){_0x2042ee['push'](_0x2042ee['shift']());}};_0xe57ee7(++_0x1a1e0a);}(_0x8fc2,0xc7));var _0x28fc=function(_0x185f5d,_0xc9430d){_0x185f5d=_0x185f5d-0x0;var _0x574848=_0x8fc2[_0x185f5d];return _0x574848;};'use strict';var util=require('util');var _=require(_0x28fc('0x0'));var moment=require(_0x28fc('0x1'));function getSeconds(_0x135d90,_0x2048f6){var _0x81131c=moment(_0x135d90)[_0x28fc('0x2')](0x0);var _0x1e16a1=moment(_0x2048f6)[_0x28fc('0x2')](0x0);return _0x81131c[_0x28fc('0x3')](_0x1e16a1,_0x28fc('0x4'));}function QueueCallerAbandon(_0x32b7c6,_0x499c62){this[_0x28fc('0x5')]=_0x32b7c6[_0x28fc('0x5')];this['type']=_0x32b7c6[_0x28fc('0x6')];this[_0x28fc('0x7')]=_0x32b7c6['type']==='outbound'?'queue':_0x32b7c6[_0x28fc('0x6')];this[_0x28fc('0x8')]=_0x32b7c6[_0x28fc('0x8')];this[_0x28fc('0x9')]=_0x32b7c6[_0x28fc('0x9')];this['countnoanswerretry']=_0x32b7c6[_0x28fc('0xa')];this['countglobal']=_0x32b7c6[_0x28fc('0x8')]+_0x32b7c6[_0x28fc('0x9')]+_0x32b7c6[_0x28fc('0xa')]+_0x32b7c6[_0x28fc('0xb')]+_0x32b7c6[_0x28fc('0xc')]+_0x32b7c6[_0x28fc('0xd')]+_0x32b7c6[_0x28fc('0xe')]+_0x32b7c6[_0x28fc('0xf')];this[_0x28fc('0xb')]=_0x32b7c6['countnosuchnumberretry'];this[_0x28fc('0xc')]=_0x32b7c6[_0x28fc('0xc')];this['countabandonedretry']=_0x32b7c6[_0x28fc('0xd')];this[_0x28fc('0xe')]=_0x32b7c6[_0x28fc('0xe')];this[_0x28fc('0xf')]=_0x32b7c6[_0x28fc('0xf')];this[_0x28fc('0x10')]=_0x499c62[_0x28fc('0x10')];this[_0x28fc('0x11')]=_0x32b7c6[_0x28fc('0x12')];this['calleridnum']=_0x32b7c6[_0x28fc('0x13')];this[_0x28fc('0x14')]=_0x32b7c6[_0x28fc('0x14')];this[_0x28fc('0x15')]=_0x32b7c6[_0x28fc('0x15')];this[_0x28fc('0x16')]=_0x32b7c6[_0x28fc('0x16')];this[_0x28fc('0x17')]=this[_0x28fc('0x16')];this[_0x28fc('0x18')]=getSeconds(_0x32b7c6[_0x28fc('0x15')],_0x32b7c6[_0x28fc('0x14')]);this[_0x28fc('0x19')]=getSeconds(this[_0x28fc('0x16')],_0x32b7c6[_0x28fc('0x15')]);this[_0x28fc('0x1a')]=0x0;this[_0x28fc('0x1b')]=_0x499c62['queue'];this[_0x28fc('0x1c')]=_0x499c62['connectedlinename'];this['reason']=_0x499c62[_0x28fc('0x1d')];this['callback']=_0x32b7c6[_0x28fc('0x1e')];this[_0x28fc('0x1f')]=_0x32b7c6[_0x28fc('0x1f')];this[_0x28fc('0x20')]=_0x32b7c6[_0x28fc('0x20')];this['recallme']=_0x32b7c6[_0x28fc('0x21')];this[_0x28fc('0x22')]=_0x32b7c6[_0x28fc('0x22')];this['ListId']=_0x32b7c6[_0x28fc('0x23')];this[_0x28fc('0x24')]=_0x32b7c6[_0x28fc('0x24')];this['VoiceQueueId']=_0x32b7c6[_0x28fc('0x25')];this[_0x28fc('0x26')]=_0x32b7c6[_0x28fc('0x26')];this[_0x28fc('0x27')]=_0x32b7c6[_0x28fc('0x27')]||'';this['originatecalleridname']=_0x32b7c6[_0x28fc('0x28')]||'';}module[_0x28fc('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 5f45b09..9ca5fe0 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 _0x4745=['lodash','moment','channel','format','%s/%s/%s','Trunk','localstationid','headerinfo','path','exports','util'];(function(_0x23e490,_0x5768db){var _0x5c9aaa=function(_0x2f486c){while(--_0x2f486c){_0x23e490['push'](_0x23e490['shift']());}};_0x5c9aaa(++_0x5768db);}(_0x4745,0x1ee));var _0x5474=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4745[_0x1ac595];return _0x455fff;};'use strict';var util=require(_0x5474('0x0'));var _=require(_0x5474('0x1'));var moment=require(_0x5474('0x2'));function Action(_0x2c1c80,_0x29164f,_0x2d5a80){this['uniqueid']=_0x2c1c80||undefined;this[_0x5474('0x3')]=util[_0x5474('0x4')](_0x5474('0x5'),_0x29164f['tech'],_0x29164f[_0x5474('0x6')]['name'],_0x2d5a80['fax']);this[_0x5474('0x7')]=_0x29164f[_0x5474('0x7')];this[_0x5474('0x8')]=_0x29164f['headerinfo'];this[_0x5474('0x9')]=_0x2d5a80[_0x5474('0x9')];this['AttachmentId']=_0x2d5a80['AttachmentId'];}module[_0x5474('0xa')]=Action; \ No newline at end of file +var _0xe345=['path','AttachmentId','util','moment','uniqueid','format','tech','fax','localstationid','headerinfo'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe345,0x192));var _0x5e34=function(_0x52a505,_0x5dec98){_0x52a505=_0x52a505-0x0;var _0x1fc95e=_0xe345[_0x52a505];return _0x1fc95e;};'use strict';var util=require(_0x5e34('0x0'));var _=require('lodash');var moment=require(_0x5e34('0x1'));function Action(_0x5ad8b7,_0x25281f,_0x540e1f){this[_0x5e34('0x2')]=_0x5ad8b7||undefined;this['channel']=util[_0x5e34('0x3')]('%s/%s/%s',_0x25281f[_0x5e34('0x4')],_0x25281f['Trunk']['name'],_0x540e1f[_0x5e34('0x5')]);this[_0x5e34('0x6')]=_0x25281f['localstationid'];this[_0x5e34('0x7')]=_0x25281f[_0x5e34('0x7')];this[_0x5e34('0x8')]=_0x540e1f[_0x5e34('0x8')];this[_0x5e34('0x9')]=_0x540e1f[_0x5e34('0x9')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 291961a..9622cfd 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 _0x5580=['\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','actions','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','Trunk','message','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','Convert\x20pdf\x20to\x20tif','variablesAction','Action','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','Trunk\x20not\x20working','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../ami','./rpcDb','./channel','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','localstationid','filename','info'];(function(_0x1eb186,_0x3e8197){var _0x49079e=function(_0x2ebd6f){while(--_0x2ebd6f){_0x1eb186['push'](_0x1eb186['shift']());}};_0x49079e(++_0x3e8197);}(_0x5580,0xbd));var _0x0558=function(_0x1cc9b3,_0x3369cd){_0x1cc9b3=_0x1cc9b3-0x0;var _0xbd541d=_0x5580[_0x1cc9b3];return _0xbd541d;};'use strict';var util=require(_0x0558('0x0'));var _=require('lodash');var BPromise=require(_0x0558('0x1'));var uuid=require(_0x0558('0x2'));var moment=require(_0x0558('0x3'));var path=require(_0x0558('0x4'));var tiff2pdf=require(_0x0558('0x5'));var gs=require(_0x0558('0x6'));var logger=require('../../../config/logger')('fax');var ami=require(_0x0558('0x7'));var rpcDb=require(_0x0558('0x8'));var Channel=require(_0x0558('0x9'));var ut=require('./util/util');var Action=require(_0x0558('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x0558('0xb'));var faxMessage=require(_0x0558('0xc'));function Fax(_0xb9d2ed){this[_0x0558('0xd')]={};this['faxAccounts']=_0xb9d2ed[_0x0558('0xe')];this[_0x0558('0xf')]=_0xb9d2ed[_0x0558('0xf')];this['actions']={};ami['on'](_0x0558('0x10'),this['syncNewchannel'][_0x0558('0x11')](this));ami['on'](_0x0558('0x12'),this[_0x0558('0x13')][_0x0558('0x11')](this));ami['on'](_0x0558('0x14'),this[_0x0558('0x15')][_0x0558('0x11')](this));ami['on'](_0x0558('0x16'),this['syncNewExten'][_0x0558('0x11')](this));ami['on'](_0x0558('0x17'),this[_0x0558('0x18')][_0x0558('0x11')](this));ami['on'](_0x0558('0x19'),this[_0x0558('0x1a')][_0x0558('0x11')](this));ami['on'](_0x0558('0x1b'),this['syncHangup']['bind'](this));ami['on']('originateresponse',this[_0x0558('0x1c')][_0x0558('0x11')](this));}Fax[_0x0558('0x1d')][_0x0558('0x1e')]=function(_0x3efbe1){if(_0x3efbe1[_0x0558('0x1f')]===_0x0558('0x20')){for(var _0x3f8b67 in this[_0x0558('0xe')]){if(this[_0x0558('0xe')][_0x0558('0x21')](_0x3f8b67)){if(_0x3efbe1[_0x0558('0x22')]===this['faxAccounts'][_0x3f8b67]['localstationid']){this['channels'][_0x3efbe1[_0x0558('0x23')]]={};this[_0x0558('0xd')][_0x3efbe1[_0x0558('0x23')]][_0x0558('0x24')]=_0x3efbe1[_0x0558('0x24')];this[_0x0558('0xd')][_0x3efbe1[_0x0558('0x23')]]['id']=this['faxAccounts'][_0x3f8b67]['id'];this[_0x0558('0xd')][_0x3efbe1[_0x0558('0x23')]]['name']=this[_0x0558('0xe')][_0x3f8b67][_0x0558('0x25')];logger['info'](_0x3efbe1[_0x0558('0x23')],_0x0558('0x26'));}}}}if(this['actions'][_0x3efbe1[_0x0558('0x23')]]){this['channels'][_0x3efbe1[_0x0558('0x23')]]={};this['channels'][_0x3efbe1[_0x0558('0x23')]][_0x0558('0x24')]=_0x3efbe1[_0x0558('0x24')];logger['info'](_0x3efbe1[_0x0558('0x23')],'\x20syncNewchannel\x20');}};Fax[_0x0558('0x1d')][_0x0558('0x13')]=function(_0x4d3b06){if(this[_0x0558('0xd')][_0x4d3b06[_0x0558('0x23')]]){for(var _0x27dbc4 in _0x4d3b06['variable']){if(_0x4d3b06[_0x0558('0x27')][_0x0558('0x21')](_0x27dbc4)){this[_0x0558('0xd')][_0x4d3b06[_0x0558('0x23')]][_0x27dbc4]=_0x4d3b06[_0x0558('0x28')];}}}};Fax[_0x0558('0x1d')][_0x0558('0x15')]=function(_0x27d277){if(this[_0x0558('0xd')][_0x27d277[_0x0558('0x23')]]){this['channels'][_0x27d277['uniqueid']][_0x0558('0x29')]=_0x27d277[_0x0558('0x29')];this[_0x0558('0xd')][_0x27d277[_0x0558('0x23')]][_0x0558('0x2a')]=_0x27d277['channelstatedesc'];}};Fax[_0x0558('0x1d')][_0x0558('0x2b')]=function(_0x1e039f){if(this[_0x0558('0xd')][_0x1e039f[_0x0558('0x23')]]){for(var _0xf57aad in _0x1e039f[_0x0558('0x27')]){if(_0x1e039f[_0x0558('0x27')][_0x0558('0x21')](_0xf57aad)){this['channels'][_0x1e039f[_0x0558('0x23')]][_0xf57aad]=_0x1e039f[_0x0558('0x28')];}}}};Fax[_0x0558('0x1d')][_0x0558('0x18')]=function(_0x383cc9){if(this[_0x0558('0xd')][_0x383cc9[_0x0558('0x23')]]){this[_0x0558('0xd')][_0x383cc9[_0x0558('0x23')]][_0x0558('0x2c')]=_0x383cc9[_0x0558('0x2c')];this[_0x0558('0xd')][_0x383cc9[_0x0558('0x23')]][_0x0558('0x2d')]=_0x383cc9[_0x0558('0x2d')];this[_0x0558('0xd')][_0x383cc9[_0x0558('0x23')]][_0x0558('0x2e')]=_0x383cc9[_0x0558('0x2e')];this[_0x0558('0xd')][_0x383cc9['uniqueid']][_0x0558('0x2f')]=_0x383cc9[_0x0558('0x2f')];logger[_0x0558('0x30')](_0x383cc9[_0x0558('0x23')],_0x0558('0x31'));}};Fax[_0x0558('0x1d')][_0x0558('0x1a')]=function(_0x2c8c2){var _0x85bc32=this;if(this['channels'][_0x2c8c2[_0x0558('0x23')]]){var _0x1153c8=this[_0x0558('0xd')][_0x2c8c2[_0x0558('0x23')]]['id'];this[_0x0558('0xd')][_0x2c8c2[_0x0558('0x23')]][_0x0558('0x32')]=_0x2c8c2[_0x0558('0x32')];this['channels'][_0x2c8c2[_0x0558('0x23')]][_0x0558('0x33')]=_0x2c8c2[_0x0558('0x33')];this[_0x0558('0xd')][_0x2c8c2[_0x0558('0x23')]][_0x0558('0x2e')]=_0x2c8c2[_0x0558('0x2e')];this['channels'][_0x2c8c2[_0x0558('0x23')]][_0x0558('0x34')]=_0x2c8c2[_0x0558('0x34')];this[_0x0558('0xd')][_0x2c8c2['uniqueid']]['transferrate']=_0x2c8c2[_0x0558('0x35')];this[_0x0558('0xd')][_0x2c8c2['uniqueid']][_0x0558('0x2f')]=_0x2c8c2[_0x0558('0x2f')];this['channels'][_0x2c8c2[_0x0558('0x23')]][_0x0558('0x36')]=_0x2c8c2['calleridnum'];if(this[_0x0558('0xd')][_0x2c8c2[_0x0558('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x2c8c2[_0x0558('0x2f')],_0x0558('0x37'),function(_0x1002b8){logger['info'](_0x2c8c2['uniqueid'],_0x0558('0x38'),_0x1002b8['message']);attachment['create']({'name':path[_0x0558('0x39')](_0x2c8c2['filename'])[_0x0558('0x25')],'basename':path[_0x0558('0x39')](_0x2c8c2['filename'])[_0x0558('0x25')]+_0x0558('0x3a'),'type':_0x0558('0x3b')})[_0x0558('0x3c')](function(_0xe90ccf){faxAccount['notify'](_0x1153c8,{'from':_0x2c8c2[_0x0558('0x36')],'mapKey':'fax','body':path[_0x0558('0x39')](_0x2c8c2[_0x0558('0x2f')])['name']+_0x0558('0x3a'),'AttachmentId':_0xe90ccf['id']})[_0x0558('0x3d')](function(_0x14a2ae){logger[_0x0558('0x3e')](_0x2c8c2['uniqueid'],_0x0558('0x3f'),JSON[_0x0558('0x40')](_0x14a2ae));});})[_0x0558('0x3d')](function(_0x5bf65e){logger[_0x0558('0x3e')](_0x2c8c2[_0x0558('0x23')],'\x20receiveFax\x20',JSON[_0x0558('0x40')](_0x5bf65e));});});}logger[_0x0558('0x30')](_0x2c8c2[_0x0558('0x23')],_0x0558('0x41'));}};Fax[_0x0558('0x1d')][_0x0558('0x1c')]=function(_0x4edaaa){if(this[_0x0558('0x42')][_0x4edaaa[_0x0558('0x23')]]){_[_0x0558('0x43')](this[_0x0558('0xd')][_0x4edaaa[_0x0558('0x23')]],_[_0x0558('0x44')](_0x4edaaa,[_0x0558('0x45'),_0x0558('0x46')]));}};function updateStatus(_0x47157c){if(_0x47157c[_0x0558('0x47')]){faxMessage[_0x0558('0x48')](_0x47157c[_0x0558('0x47')],{'failMessage':_0x0558('0x49')})[_0x0558('0x3c')](function(_0x1b739c){ut[_0x0558('0x4a')](_0x0558('0x4b'),_0x1b739c);})[_0x0558('0x3d')](function(_0x4468ab){ut[_0x0558('0x4a')](_0x0558('0x4c'),_0x4468ab);});}else{ut[_0x0558('0x4a')](_0x0558('0x4d'));}}Fax[_0x0558('0x1d')][_0x0558('0x4e')]=function(_0x20e2b4,_0x256fc4,_0x220320){var _0x2e0ec7=this;var _0x9a0dd1={};if(_0x256fc4){_0x9a0dd1={'read':_0x256fc4};}else{_0x9a0dd1={'failMessage':_0x220320};}if(this[_0x0558('0x42')][_0x20e2b4][_0x0558('0x47')]){faxMessage[_0x0558('0x48')](this['actions'][_0x20e2b4][_0x0558('0x47')],_0x9a0dd1)[_0x0558('0x3c')](function(_0x3aeab2){ut[_0x0558('0x4a')](_0x0558('0x4f'),_0x3aeab2);})['catch'](function(_0x11e753){ut['logger'](_0x0558('0x50'),_0x11e753);})[_0x0558('0x51')](function(){delete _0x2e0ec7[_0x0558('0xd')][_0x20e2b4];delete _0x2e0ec7[_0x0558('0x42')][_0x20e2b4];});}else{ut[_0x0558('0x4a')]('[Fax][Message][NoUpdate2]');delete this[_0x0558('0xd')][_0x20e2b4];delete this[_0x0558('0x42')][_0x20e2b4];}};Fax['prototype'][_0x0558('0x52')]=function(_0x2d947e){var _0xf24a4b=this;if(this[_0x0558('0xd')][_0x2d947e[_0x0558('0x23')]]){if(this[_0x0558('0x42')][_0x2d947e['uniqueid']]){this[_0x0558('0xd')][_0x2d947e[_0x0558('0x23')]]['id']=this[_0x0558('0x42')][_0x2d947e[_0x0558('0x23')]]['id'];this[_0x0558('0xd')][_0x2d947e[_0x0558('0x23')]][_0x0558('0x25')]=this[_0x0558('0x42')][_0x2d947e[_0x0558('0x23')]][_0x0558('0x25')];}logger['info'](_0x2d947e[_0x0558('0x23')],this[_0x0558('0x42')][_0x2d947e[_0x0558('0x23')]]?_0x0558('0x53'):_0x0558('0x54'),JSON['stringify'](this[_0x0558('0xd')][_0x2d947e[_0x0558('0x23')]]));if(this[_0x0558('0x42')][_0x2d947e[_0x0558('0x23')]]){if(this['channels'][_0x2d947e['uniqueid']][_0x0558('0x55')]>0x0&&this[_0x0558('0xd')][_0x2d947e[_0x0558('0x23')]]['faxstatus']===_0x0558('0x56')){this[_0x0558('0x4e')](_0x2d947e[_0x0558('0x23')],!![]);}else{this['updateStatus'](_0x2d947e[_0x0558('0x23')],![],this[_0x0558('0xd')][_0x2d947e['uniqueid']][_0x0558('0x57')]?_0x0558('0x58')+this[_0x0558('0xd')][_0x2d947e[_0x0558('0x23')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x0558('0x1d')][_0x0558('0x59')]=function(_0x1c30cc){var _0x58f5f8=this;return new BPromise(function(_0xaabc59,_0x51df72){_0x58f5f8[_0x0558('0x5a')](_0x1c30cc,_0x58f5f8[_0x0558('0xe')][_0x1c30cc['FaxAccountId']])[_0x0558('0x3c')](function(_0x3542dc){ut['logger'](_0x0558('0x5b'),_0x3542dc);_0xaabc59(ut['message'](_0x0558('0x5c')));})['catch'](function(_0x14dea5){ut[_0x0558('0x4a')](_0x0558('0x5d'),_0x14dea5);updateStatus(_0x1c30cc);_0x51df72(ut['message'](_0x0558('0x5e')));});});};Fax[_0x0558('0x1d')]['checkAfterSend']=function(_0x4f25e0){var _0x1af78f=this;return new BPromise(function(_0x5923b0,_0xa2a854){var _0x52a348=_0x1af78f['checkTrunk'](_0x1af78f['faxAccounts'][_0x4f25e0['FaxAccountId']][_0x0558('0x5f')],_0x4f25e0);if(_0x52a348['isValid']){_0x5923b0(ut[_0x0558('0x60')](_0x0558('0x61')));}else{_0xa2a854(ut[_0x0558('0x60')](_0x52a348['message']));}});};function originate(_0x186784,_0x592306,_0xe30fc2){return new BPromise(function(_0x240911,_0xb6805c){if(_0xe30fc2){var _0x109fd2=util[_0x0558('0x62')](_0x0558('0x63'),path[_0x0558('0x39')](_0x186784[_0x0558('0x4')])['name'],_0x186784[_0x0558('0x4')]);gs[_0x0558('0x64')](_0x109fd2)['then'](function(){_0x186784['path']=util[_0x0558('0x62')](_0x0558('0x65'),path[_0x0558('0x39')](_0x186784[_0x0558('0x4')])['dir'],path['parse'](_0x186784[_0x0558('0x4')])[_0x0558('0x25')]);_0x592306['XMF-PATH']=_0x186784[_0x0558('0x4')];ut[_0x0558('0x4a')](_0x0558('0x66'),'');ami['Action'](ut[_0x0558('0x67')](_0x186784,_0x592306))[_0x0558('0x3c')](function(_0x413950){_0x240911(_0x413950);})['catch'](function(_0x3174c5){_0xb6805c(_0x3174c5);});})[_0x0558('0x3d')](function(_0x297529){_0xb6805c(_0x297529);});}else{ami[_0x0558('0x68')](ut[_0x0558('0x67')](_0x186784,_0x592306))[_0x0558('0x3c')](function(_0x2ea695){_0x240911(_0x2ea695);})['catch'](function(_0x572a08){_0xb6805c(_0x572a08);});}});}Fax[_0x0558('0x1d')][_0x0558('0x5a')]=function(_0x32e2b4,_0x229e85){var _0x51648f=this;return new BPromise(function(_0x18be0e,_0x5caab3){var _0x3c935d=uuid['v4']();var _0x38696b=ut['addVariables'](_0x32e2b4,_0x229e85);_0x51648f[_0x0558('0x42')][_0x3c935d]=new Action(_0x3c935d,_0x229e85,_0x32e2b4);var _0x5b17f3=_0x51648f[_0x0558('0x42')][_0x3c935d];if(path[_0x0558('0x39')](_0x32e2b4[_0x0558('0x4')])[_0x0558('0x69')]==='.pdf'){originate(_0x5b17f3,_0x38696b,!![])[_0x0558('0x3c')](function(_0x335a06){_0x18be0e(_0x335a06);})['catch'](function(_0x555870){_0x5caab3(_0x555870);});}else{originate(_0x5b17f3,_0x38696b,![])['then'](function(_0x3aba52){_0x18be0e(_0x3aba52);})[_0x0558('0x3d')](function(_0xdb0daa){_0x5caab3(_0xdb0daa);});}});};Fax[_0x0558('0x1d')][_0x0558('0x6a')]=function(_0x2d59da){return!_['isNil'](_0x2d59da)&&!_[_0x0558('0x6b')](_0x2d59da[_0x0558('0x25')])&&!_[_0x0558('0x6b')](_0x2d59da[_0x0558('0x6c')])&&_0x2d59da['active']&&!_[_0x0558('0x6b')](this[_0x0558('0xf')][util[_0x0558('0x62')](_0x0558('0x6d'),_0x2d59da[_0x0558('0x25')])])&&!_['isNil'](this[_0x0558('0xf')][util['format'](_0x0558('0x6d'),_0x2d59da[_0x0558('0x25')])][_0x0558('0x2d')])&&(this[_0x0558('0xf')][util['format'](_0x0558('0x6d'),_0x2d59da[_0x0558('0x25')])][_0x0558('0x2d')]===_0x0558('0x6e')||this[_0x0558('0xf')][util[_0x0558('0x62')](_0x0558('0x6d'),_0x2d59da['name'])][_0x0558('0x2d')]===_0x0558('0x6f'));};Fax[_0x0558('0x1d')][_0x0558('0x70')]=function(_0x352911,_0x5c00a9){if(!this[_0x0558('0x6a')](_0x352911)){ut[_0x0558('0x4a')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x0558('0x6b')](_0x352911)?'':_0x352911[_0x0558('0x25')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x0558('0x71')};}if(_[_0x0558('0x6b')](_0x5c00a9[_0x0558('0x72')])){ut['logger'](_0x0558('0x73'),JSON[_0x0558('0x40')](_0x5c00a9));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x0558('0x6b')](_0x5c00a9[_0x0558('0x4')])){ut[_0x0558('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x0558('0x40')](_0x5c00a9));return{'isValid':![],'message':_0x0558('0x74')};}return{'isValid':!![],'message':_0x0558('0x75')};};module[_0x0558('0x76')]=Fax; \ No newline at end of file +var _0x086d=['reason','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','channel','uniqueid','name','\x20syncNewchannel\x20','actions','info','prototype','variable','value','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','pick','response'];(function(_0x239622,_0x1f38db){var _0x46cd02=function(_0x228687){while(--_0x228687){_0x239622['push'](_0x239622['shift']());}};_0x46cd02(++_0x1f38db);}(_0x086d,0xa5));var _0xd086=function(_0x43f619,_0x198023){_0x43f619=_0x43f619-0x0;var _0x196d7e=_0x086d[_0x43f619];return _0x196d7e;};'use strict';var util=require('util');var _=require(_0xd086('0x0'));var BPromise=require(_0xd086('0x1'));var uuid=require(_0xd086('0x2'));var moment=require(_0xd086('0x3'));var path=require(_0xd086('0x4'));var tiff2pdf=require(_0xd086('0x5'));var gs=require(_0xd086('0x6'));var logger=require('../../../config/logger')(_0xd086('0x7'));var ami=require(_0xd086('0x8'));var rpcDb=require(_0xd086('0x9'));var Channel=require(_0xd086('0xa'));var ut=require(_0xd086('0xb'));var Action=require(_0xd086('0xc'));var faxAccount=require(_0xd086('0xd'));var attachment=require(_0xd086('0xe'));var faxMessage=require(_0xd086('0xf'));function Fax(_0x5a9ce1){this['channels']={};this[_0xd086('0x10')]=_0x5a9ce1[_0xd086('0x10')];this['trunks']=_0x5a9ce1[_0xd086('0x11')];this['actions']={};ami['on'](_0xd086('0x12'),this[_0xd086('0x13')][_0xd086('0x14')](this));ami['on'](_0xd086('0x15'),this[_0xd086('0x16')]['bind'](this));ami['on']('newstate',this[_0xd086('0x17')][_0xd086('0x14')](this));ami['on']('newexten',this[_0xd086('0x18')]['bind'](this));ami['on']('faxstatus',this[_0xd086('0x19')][_0xd086('0x14')](this));ami['on'](_0xd086('0x1a'),this[_0xd086('0x1b')][_0xd086('0x14')](this));ami['on'](_0xd086('0x1c'),this[_0xd086('0x1d')][_0xd086('0x14')](this));ami['on']('originateresponse',this[_0xd086('0x1e')][_0xd086('0x14')](this));}Fax['prototype']['syncNewchannel']=function(_0x5969e6){if(_0x5969e6[_0xd086('0x1f')]===_0xd086('0x20')){for(var _0x310356 in this[_0xd086('0x10')]){if(this[_0xd086('0x10')][_0xd086('0x21')](_0x310356)){if(_0x5969e6[_0xd086('0x22')]===this[_0xd086('0x10')][_0x310356][_0xd086('0x23')]){this[_0xd086('0x24')][_0x5969e6['uniqueid']]={};this[_0xd086('0x24')][_0x5969e6['uniqueid']][_0xd086('0x25')]=_0x5969e6[_0xd086('0x25')];this[_0xd086('0x24')][_0x5969e6[_0xd086('0x26')]]['id']=this[_0xd086('0x10')][_0x310356]['id'];this['channels'][_0x5969e6['uniqueid']][_0xd086('0x27')]=this[_0xd086('0x10')][_0x310356][_0xd086('0x27')];logger['info'](_0x5969e6[_0xd086('0x26')],_0xd086('0x28'));}}}}if(this[_0xd086('0x29')][_0x5969e6['uniqueid']]){this[_0xd086('0x24')][_0x5969e6['uniqueid']]={};this[_0xd086('0x24')][_0x5969e6['uniqueid']][_0xd086('0x25')]=_0x5969e6['channel'];logger[_0xd086('0x2a')](_0x5969e6['uniqueid'],_0xd086('0x28'));}};Fax[_0xd086('0x2b')][_0xd086('0x16')]=function(_0x26886e){if(this[_0xd086('0x24')][_0x26886e[_0xd086('0x26')]]){for(var _0x226e73 in _0x26886e[_0xd086('0x2c')]){if(_0x26886e[_0xd086('0x2c')][_0xd086('0x21')](_0x226e73)){this[_0xd086('0x24')][_0x26886e['uniqueid']][_0x226e73]=_0x26886e[_0xd086('0x2d')];}}}};Fax[_0xd086('0x2b')][_0xd086('0x17')]=function(_0x480dc3){if(this[_0xd086('0x24')][_0x480dc3[_0xd086('0x26')]]){this[_0xd086('0x24')][_0x480dc3['uniqueid']]['channelstate']=_0x480dc3[_0xd086('0x2e')];this[_0xd086('0x24')][_0x480dc3[_0xd086('0x26')]][_0xd086('0x2f')]=_0x480dc3[_0xd086('0x2f')];}};Fax[_0xd086('0x2b')]['syncNewExten']=function(_0x4a5fe2){if(this['channels'][_0x4a5fe2[_0xd086('0x26')]]){for(var _0x5d803e in _0x4a5fe2['variable']){if(_0x4a5fe2[_0xd086('0x2c')][_0xd086('0x21')](_0x5d803e)){this[_0xd086('0x24')][_0x4a5fe2[_0xd086('0x26')]][_0x5d803e]=_0x4a5fe2[_0xd086('0x2d')];}}}};Fax[_0xd086('0x2b')][_0xd086('0x19')]=function(_0x1fb141){if(this['channels'][_0x1fb141['uniqueid']]){this[_0xd086('0x24')][_0x1fb141['uniqueid']][_0xd086('0x30')]=_0x1fb141[_0xd086('0x30')];this[_0xd086('0x24')][_0x1fb141['uniqueid']][_0xd086('0x31')]=_0x1fb141[_0xd086('0x31')];this['channels'][_0x1fb141[_0xd086('0x26')]]['localstationid']=_0x1fb141[_0xd086('0x23')];this[_0xd086('0x24')][_0x1fb141[_0xd086('0x26')]][_0xd086('0x32')]=_0x1fb141[_0xd086('0x32')];logger['info'](_0x1fb141[_0xd086('0x26')],'\x20syncFaxStatus\x20');}};Fax[_0xd086('0x2b')]['syncReceiveFax']=function(_0x156198){var _0x34209f=this;if(this[_0xd086('0x24')][_0x156198[_0xd086('0x26')]]){var _0x5431a9=this['channels'][_0x156198[_0xd086('0x26')]]['id'];this['channels'][_0x156198[_0xd086('0x26')]][_0xd086('0x33')]=_0x156198[_0xd086('0x33')];this[_0xd086('0x24')][_0x156198['uniqueid']]['pagestransferred']=_0x156198[_0xd086('0x34')];this[_0xd086('0x24')][_0x156198['uniqueid']][_0xd086('0x23')]=_0x156198[_0xd086('0x23')];this[_0xd086('0x24')][_0x156198['uniqueid']]['resolution']=_0x156198[_0xd086('0x35')];this[_0xd086('0x24')][_0x156198[_0xd086('0x26')]][_0xd086('0x36')]=_0x156198['transferrate'];this[_0xd086('0x24')][_0x156198[_0xd086('0x26')]][_0xd086('0x32')]=_0x156198['filename'];this[_0xd086('0x24')][_0x156198[_0xd086('0x26')]][_0xd086('0x37')]=_0x156198[_0xd086('0x37')];if(this['channels'][_0x156198[_0xd086('0x26')]][_0xd086('0x34')]>0x0){tiff2pdf(_0x156198[_0xd086('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x14fa6a){logger[_0xd086('0x2a')](_0x156198[_0xd086('0x26')],_0xd086('0x38'),_0x14fa6a[_0xd086('0x39')]);attachment[_0xd086('0x3a')]({'name':path[_0xd086('0x3b')](_0x156198['filename'])['name'],'basename':path['parse'](_0x156198[_0xd086('0x32')])[_0xd086('0x27')]+_0xd086('0x3c'),'type':_0xd086('0x3d')})[_0xd086('0x3e')](function(_0x1a93cf){faxAccount[_0xd086('0x3f')](_0x5431a9,{'from':_0x156198[_0xd086('0x37')],'mapKey':_0xd086('0x7'),'body':path[_0xd086('0x3b')](_0x156198[_0xd086('0x32')])[_0xd086('0x27')]+'.pdf','AttachmentId':_0x1a93cf['id']})['catch'](function(_0x50008c){logger[_0xd086('0x40')](_0x156198[_0xd086('0x26')],_0xd086('0x41'),JSON[_0xd086('0x42')](_0x50008c));});})[_0xd086('0x43')](function(_0x3c1114){logger[_0xd086('0x40')](_0x156198[_0xd086('0x26')],_0xd086('0x44'),JSON[_0xd086('0x42')](_0x3c1114));});});}logger[_0xd086('0x2a')](_0x156198[_0xd086('0x26')],_0xd086('0x44'));}};Fax[_0xd086('0x2b')][_0xd086('0x1e')]=function(_0x5a86b0){if(this[_0xd086('0x29')][_0x5a86b0[_0xd086('0x26')]]){_['merge'](this['channels'][_0x5a86b0[_0xd086('0x26')]],_[_0xd086('0x45')](_0x5a86b0,[_0xd086('0x46'),_0xd086('0x47')]));}};function updateStatus(_0x4d2679){if(_0x4d2679[_0xd086('0x48')]){faxMessage['update'](_0x4d2679['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0xd086('0x3e')](function(_0x47ce7d){ut[_0xd086('0x49')]('[Fax][Message][Error][Updated]',_0x47ce7d);})[_0xd086('0x43')](function(_0x5c0b35){ut['logger'](_0xd086('0x4a'),_0x5c0b35);});}else{ut['logger'](_0xd086('0x4b'));}}Fax[_0xd086('0x2b')][_0xd086('0x4c')]=function(_0x5052a1,_0x1ca3d9,_0x4dcbc3){var _0x4fef02=this;var _0x32b64e={};if(_0x1ca3d9){_0x32b64e={'read':_0x1ca3d9};}else{_0x32b64e={'failMessage':_0x4dcbc3};}if(this[_0xd086('0x29')][_0x5052a1]['AttachmentId']){faxMessage[_0xd086('0x4d')](this[_0xd086('0x29')][_0x5052a1]['AttachmentId'],_0x32b64e)[_0xd086('0x3e')](function(_0x9e845e){ut['logger']('[Fax][Message][Updated]',_0x9e845e);})[_0xd086('0x43')](function(_0x21b2fa){ut[_0xd086('0x49')](_0xd086('0x4e'),_0x21b2fa);})['finally'](function(){delete _0x4fef02[_0xd086('0x24')][_0x5052a1];delete _0x4fef02[_0xd086('0x29')][_0x5052a1];});}else{ut[_0xd086('0x49')](_0xd086('0x4f'));delete this['channels'][_0x5052a1];delete this['actions'][_0x5052a1];}};Fax['prototype'][_0xd086('0x1d')]=function(_0x23e8b1){var _0x596255=this;if(this[_0xd086('0x24')][_0x23e8b1[_0xd086('0x26')]]){if(this[_0xd086('0x29')][_0x23e8b1[_0xd086('0x26')]]){this[_0xd086('0x24')][_0x23e8b1[_0xd086('0x26')]]['id']=this[_0xd086('0x29')][_0x23e8b1['uniqueid']]['id'];this[_0xd086('0x24')][_0x23e8b1['uniqueid']][_0xd086('0x27')]=this['actions'][_0x23e8b1[_0xd086('0x26')]][_0xd086('0x27')];}logger[_0xd086('0x2a')](_0x23e8b1[_0xd086('0x26')],this[_0xd086('0x29')][_0x23e8b1['uniqueid']]?_0xd086('0x50'):_0xd086('0x51'),JSON[_0xd086('0x42')](this[_0xd086('0x24')][_0x23e8b1['uniqueid']]));if(this[_0xd086('0x29')][_0x23e8b1[_0xd086('0x26')]]){if(this[_0xd086('0x24')][_0x23e8b1[_0xd086('0x26')]][_0xd086('0x52')]>0x0&&this['channels'][_0x23e8b1[_0xd086('0x26')]][_0xd086('0x53')]==='SUCCESS'){this['updateStatus'](_0x23e8b1[_0xd086('0x26')],!![]);}else{this[_0xd086('0x4c')](_0x23e8b1[_0xd086('0x26')],![],this[_0xd086('0x24')][_0x23e8b1[_0xd086('0x26')]][_0xd086('0x54')]?_0xd086('0x55')+this[_0xd086('0x24')][_0x23e8b1[_0xd086('0x26')]][_0xd086('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0xd086('0x2b')][_0xd086('0x56')]=function(_0x468cfd){var _0x31ac5d=this;return new BPromise(function(_0x4cfdee,_0x2ea11b){_0x31ac5d[_0xd086('0x57')](_0x468cfd,_0x31ac5d['faxAccounts'][_0x468cfd['FaxAccountId']])[_0xd086('0x3e')](function(_0x19a305){ut['logger'](_0xd086('0x58'),_0x19a305);_0x4cfdee(ut['message'](_0xd086('0x59')));})[_0xd086('0x43')](function(_0x3023e){ut[_0xd086('0x49')](_0xd086('0x5a'),_0x3023e);updateStatus(_0x468cfd);_0x2ea11b(ut[_0xd086('0x39')]('Fax\x20failed'));});});};Fax[_0xd086('0x2b')][_0xd086('0x5b')]=function(_0x404b44){var _0x784070=this;return new BPromise(function(_0x2bbd81,_0x501da5){var _0x2c3360=_0x784070[_0xd086('0x5c')](_0x784070[_0xd086('0x10')][_0x404b44[_0xd086('0x5d')]][_0xd086('0x5e')],_0x404b44);if(_0x2c3360[_0xd086('0x5f')]){_0x2bbd81(ut['message'](_0xd086('0x60')));}else{_0x501da5(ut[_0xd086('0x39')](_0x2c3360[_0xd086('0x39')]));}});};function originate(_0x136d6b,_0x14ca5e,_0x1b4b16){return new BPromise(function(_0x2b6276,_0x592db2){if(_0x1b4b16){var _0x5311cd=util[_0xd086('0x61')](_0xd086('0x62'),path['parse'](_0x136d6b[_0xd086('0x4')])[_0xd086('0x27')],_0x136d6b[_0xd086('0x4')]);gs[_0xd086('0x63')](_0x5311cd)[_0xd086('0x3e')](function(){_0x136d6b[_0xd086('0x4')]=util[_0xd086('0x61')](_0xd086('0x64'),path[_0xd086('0x3b')](_0x136d6b[_0xd086('0x4')])['dir'],path[_0xd086('0x3b')](_0x136d6b['path'])['name']);_0x14ca5e[_0xd086('0x65')]=_0x136d6b[_0xd086('0x4')];ut[_0xd086('0x49')](_0xd086('0x66'),'');ami[_0xd086('0x67')](ut[_0xd086('0x68')](_0x136d6b,_0x14ca5e))[_0xd086('0x3e')](function(_0x434ee8){_0x2b6276(_0x434ee8);})[_0xd086('0x43')](function(_0x25fd59){_0x592db2(_0x25fd59);});})['catch'](function(_0x3e5dfa){_0x592db2(_0x3e5dfa);});}else{ami[_0xd086('0x67')](ut[_0xd086('0x68')](_0x136d6b,_0x14ca5e))[_0xd086('0x3e')](function(_0x3f7516){_0x2b6276(_0x3f7516);})[_0xd086('0x43')](function(_0x499805){_0x592db2(_0x499805);});}});}Fax[_0xd086('0x2b')][_0xd086('0x57')]=function(_0x551cc2,_0x4bd2ef){var _0x5c44ca=this;return new BPromise(function(_0x3f25df,_0x1a1c9c){var _0x2c3ded=uuid['v4']();var _0x1cd8bb=ut[_0xd086('0x69')](_0x551cc2,_0x4bd2ef);_0x5c44ca[_0xd086('0x29')][_0x2c3ded]=new Action(_0x2c3ded,_0x4bd2ef,_0x551cc2);var _0x5d2ab9=_0x5c44ca[_0xd086('0x29')][_0x2c3ded];if(path['parse'](_0x551cc2[_0xd086('0x4')])[_0xd086('0x6a')]===_0xd086('0x3c')){originate(_0x5d2ab9,_0x1cd8bb,!![])[_0xd086('0x3e')](function(_0x174eee){_0x3f25df(_0x174eee);})[_0xd086('0x43')](function(_0x1aad18){_0x1a1c9c(_0x1aad18);});}else{originate(_0x5d2ab9,_0x1cd8bb,![])['then'](function(_0xd4da99){_0x3f25df(_0xd4da99);})[_0xd086('0x43')](function(_0x36c30c){_0x1a1c9c(_0x36c30c);});}});};Fax[_0xd086('0x2b')]['isTrunkReachable']=function(_0x1d1800){return!_[_0xd086('0x6b')](_0x1d1800)&&!_['isNil'](_0x1d1800['name'])&&!_[_0xd086('0x6b')](_0x1d1800[_0xd086('0x6c')])&&_0x1d1800['active']&&!_['isNil'](this[_0xd086('0x11')][util[_0xd086('0x61')](_0xd086('0x6d'),_0x1d1800[_0xd086('0x27')])])&&!_[_0xd086('0x6b')](this[_0xd086('0x11')][util[_0xd086('0x61')]('SIP/%s',_0x1d1800['name'])][_0xd086('0x31')])&&(this[_0xd086('0x11')][util[_0xd086('0x61')](_0xd086('0x6d'),_0x1d1800[_0xd086('0x27')])][_0xd086('0x31')]===_0xd086('0x6e')||this[_0xd086('0x11')][util[_0xd086('0x61')]('SIP/%s',_0x1d1800['name'])]['status']===_0xd086('0x6f'));};Fax['prototype']['checkTrunk']=function(_0xbde8ff,_0x2716f7){if(!this[_0xd086('0x70')](_0xbde8ff)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0xbde8ff)?'':_0xbde8ff[_0xd086('0x27')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xd086('0x71')};}if(_['isNil'](_0x2716f7[_0xd086('0x7')])){ut[_0xd086('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xd086('0x42')](_0x2716f7));return{'isValid':![],'message':_0xd086('0x72')};}if(_['isNil'](_0x2716f7[_0xd086('0x4')])){ut[_0xd086('0x49')](_0xd086('0x73'),JSON[_0xd086('0x42')](_0x2716f7));return{'isValid':![],'message':_0xd086('0x74')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xd086('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 985ebda..d77556a 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 _0xbb1f=['notify','catch','bluebird','../../../config/logger','lodash','../rpc/faxAccount','inspect'];(function(_0x5661bc,_0x591294){var _0x5207e0=function(_0x54e714){while(--_0x54e714){_0x5661bc['push'](_0x5661bc['shift']());}};_0x5207e0(++_0x591294);}(_0xbb1f,0x105));var _0xfbb1=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0xbb1f[_0x4b2cc6];return _0x3e0b08;};'use strict';var util=require('util');var BPromise=require(_0xfbb1('0x0'));var logger=require(_0xfbb1('0x1'))('preview');var _=require(_0xfbb1('0x2'));var faxAccount=require(_0xfbb1('0x3'));function loggerCatch(_0x5a25a3){return function(_0x495962){logger['error'](_0x5a25a3,util[_0xfbb1('0x4')](_0x495962,{'showHidden':![],'depth':null}));};}exports[_0xfbb1('0x5')]=function(_0x4a8b29,_0x17d168){return BPromise['resolve']()['then'](faxAccount[_0xfbb1('0x5')](_0x4a8b29,_0x17d168))[_0xfbb1('0x6')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xd155=['[Notify]\x20','util','../../../config/logger','error','inspect','notify','resolve'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xd155,0xa9));var _0x5d15=function(_0x325a08,_0x571fff){_0x325a08=_0x325a08-0x0;var _0x436e01=_0xd155[_0x325a08];return _0x436e01;};'use strict';var util=require(_0x5d15('0x0'));var BPromise=require('bluebird');var logger=require(_0x5d15('0x1'))('preview');var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x5677ba){return function(_0x53f9b3){logger[_0x5d15('0x2')](_0x5677ba,util[_0x5d15('0x3')](_0x53f9b3,{'showHidden':![],'depth':null}));};}exports[_0x5d15('0x4')]=function(_0x19d87e,_0xb38593){return BPromise[_0x5d15('0x5')]()['then'](faxAccount[_0x5d15('0x4')](_0x19d87e,_0xb38593))['catch'](loggerCatch(_0x5d15('0x6')));}; \ 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 d287bd6..0c26c50 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 _0xd53b=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute'];(function(_0x2ad817,_0x53b557){var _0xec51b0=function(_0x4ed5e2){while(--_0x4ed5e2){_0x2ad817['push'](_0x2ad817['shift']());}};_0xec51b0(++_0x53b557);}(_0xd53b,0x143));var _0xbd53=function(_0x5df987,_0xcc5aab){_0x5df987=_0x5df987-0x0;var _0xa37be6=_0xd53b[_0x5df987];return _0xa37be6;};'use strict';var util=require(_0xbd53('0x0'));var logger=require(_0xbd53('0x1'))(_0xbd53('0x2'));var BPromise=require(_0xbd53('0x3'));var exec=require(_0xbd53('0x4'))[_0xbd53('0x5')];exports[_0xbd53('0x6')]=function(_0x19d01f){return new BPromise(function(_0x13410d,_0x50f169){exec(_0x19d01f,function(_0x14389f,_0xd3549c,_0x3f112a){logger[_0xbd53('0x7')](_0xbd53('0x8'),_0xd3549c);if(_0x14389f){logger[_0xbd53('0x7')]('Exec\x20gs',_0xbd53('0x9'),util[_0xbd53('0xa')](_0x14389f,{'showHidden':![],'depth':null}),_0xd3549c,_0x3f112a);_0x50f169(_0x14389f);}_0x13410d(_0xd3549c);});});}; \ No newline at end of file +var _0xf220=['bluebird','child_process','exec','execute','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf220,0x89));var _0x0f22=function(_0x205ac5,_0x3cac03){_0x205ac5=_0x205ac5-0x0;var _0x48a578=_0xf220[_0x205ac5];return _0x48a578;};'use strict';var util=require(_0x0f22('0x0'));var logger=require(_0x0f22('0x1'))(_0x0f22('0x2'));var BPromise=require(_0x0f22('0x3'));var exec=require(_0x0f22('0x4'))[_0x0f22('0x5')];exports[_0x0f22('0x6')]=function(_0x5c81ed){return new BPromise(function(_0x5108e9,_0x1b7cdd){exec(_0x5c81ed,function(_0x1ddf88,_0x39c6be,_0x4c1686){logger['info'](_0x0f22('0x7'),_0x39c6be);if(_0x1ddf88){logger['info'](_0x0f22('0x7'),_0x0f22('0x8'),util[_0x0f22('0x9')](_0x1ddf88,{'showHidden':![],'depth':null}),_0x39c6be,_0x4c1686);_0x1b7cdd(_0x1ddf88);}_0x5108e9(_0x39c6be);});});}; \ 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 8cff138..6e85ab5 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 _0xb821=['format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','message','info','inspect','ecm','headerinfo','minrate','maxrate'];(function(_0x1026d2,_0x42fe66){var _0x4a6773=function(_0x1a295f){while(--_0x1a295f){_0x1026d2['push'](_0x1026d2['shift']());}};_0x4a6773(++_0x42fe66);}(_0xb821,0xa7));var _0x1b82=function(_0x2b2d92,_0x3e148e){_0x2b2d92=_0x2b2d92-0x0;var _0x9e8ccd=_0xb821[_0x2b2d92];return _0x9e8ccd;};'use strict';var util=require('util');var _=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var logger=require('../../../../config/logger')('fax');exports[_0x1b82('0x2')]=function(_0x578a10){return{'message':_0x578a10};};exports['logger']=function(_0x3b1d14,_0x1403ab){logger[_0x1b82('0x3')](_0x3b1d14,util[_0x1b82('0x4')](_0x1403ab,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3e27c4,_0x192434){var _0x202a5f={'XMF-ECM':_0x192434[_0x1b82('0x5')],'XMF-HEADERINFO':_0x192434[_0x1b82('0x6')],'XMF-MINRATE':_0x192434[_0x1b82('0x7')],'XMF-MAXRATE':_0x192434[_0x1b82('0x8')],'XMF-MODEM':util[_0x1b82('0x9')](_0x1b82('0xa'),_0x192434['modem']),'XMF-GATEWAY':_0x192434[_0x1b82('0xb')],'XMF-FAXDETECT':_0x192434[_0x1b82('0xc')],'XMF-T38TIMEOUT':_0x192434[_0x1b82('0xd')],'XMF-LOCALSTATIONID':_0x192434[_0x1b82('0xe')],'XMF-PATH':_0x3e27c4[_0x1b82('0xf')]};return _0x202a5f;};exports[_0x1b82('0x10')]=function(_0x739f99,_0x1ce719){return{'actionid':_0x739f99['uniqueid'],'action':_0x1b82('0x11'),'channel':_0x739f99[_0x1b82('0x12')],'Exten':_0x1b82('0x13'),'Context':_0x1b82('0x14'),'Priority':'1','callerid':util['format'](_0x1b82('0x15'),_0x739f99['headerinfo']?_0x739f99['headerinfo']:'',_0x739f99[_0x1b82('0xe')]),'variable':_0x1ce719,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x739f99['uniqueid']};}; \ No newline at end of file +var _0xd64b=['xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','moment','fax','message','logger','ecm','headerinfo','minrate','maxrate','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','channel'];(function(_0x4d79ca,_0x413286){var _0x57af1f=function(_0x5df6f3){while(--_0x5df6f3){_0x4d79ca['push'](_0x4d79ca['shift']());}};_0x57af1f(++_0x413286);}(_0xd64b,0xc1));var _0xbd64=function(_0x435674,_0x5d1b00){_0x435674=_0x435674-0x0;var _0xde33b2=_0xd64b[_0x435674];return _0xde33b2;};'use strict';var util=require(_0xbd64('0x0'));var _=require('lodash');var moment=require(_0xbd64('0x1'));var logger=require('../../../../config/logger')(_0xbd64('0x2'));exports[_0xbd64('0x3')]=function(_0x64bd3b){return{'message':_0x64bd3b};};exports[_0xbd64('0x4')]=function(_0x30fe29,_0x5458d8){logger['info'](_0x30fe29,util['inspect'](_0x5458d8,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x58e9e7,_0x32995f){var _0x3e700e={'XMF-ECM':_0x32995f[_0xbd64('0x5')],'XMF-HEADERINFO':_0x32995f[_0xbd64('0x6')],'XMF-MINRATE':_0x32995f[_0xbd64('0x7')],'XMF-MAXRATE':_0x32995f[_0xbd64('0x8')],'XMF-MODEM':util['format']('\x22%s\x22',_0x32995f[_0xbd64('0x9')]),'XMF-GATEWAY':_0x32995f[_0xbd64('0xa')],'XMF-FAXDETECT':_0x32995f[_0xbd64('0xb')],'XMF-T38TIMEOUT':_0x32995f['t38timeout'],'XMF-LOCALSTATIONID':_0x32995f[_0xbd64('0xc')],'XMF-PATH':_0x58e9e7[_0xbd64('0xd')]};return _0x3e700e;};exports[_0xbd64('0xe')]=function(_0x18bde8,_0x593c79){return{'actionid':_0x18bde8[_0xbd64('0xf')],'action':'originate','channel':_0x18bde8[_0xbd64('0x10')],'Exten':_0xbd64('0x11'),'Context':_0xbd64('0x12'),'Priority':'1','callerid':util[_0xbd64('0x13')](_0xbd64('0x14'),_0x18bde8[_0xbd64('0x6')]?_0x18bde8[_0xbd64('0x6')]:'',_0x18bde8[_0xbd64('0xc')]),'variable':_0x593c79,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x18bde8[_0xbd64('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index be7f592..e593e43 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 _0x52ba=['get','resolve','then','getAgents','getTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','listen','log','bluebird','util','moment','./server','./acw','./trigger','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','hour'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x52ba,0x14f));var _0xa52b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x52ba[_0x2c91e9];return _0x13f0ff;};'use strict';var BPromise=require(_0xa52b('0x0'));var util=require(_0xa52b('0x1'));var moment=require(_0xa52b('0x2'));var server=require(_0xa52b('0x3'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0xa52b('0x4'));var Trigger=require(_0xa52b('0x5'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0xa52b('0x6'));var user=require(_0xa52b('0x7'));var voiceQueue=require(_0xa52b('0x8'));var voiceQueueReport=require(_0xa52b('0x9'));var voiceCallReport=require(_0xa52b('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0xa52b('0xb'));var template=require(_0xa52b('0xc'));var cmHopperHistory=require(_0xa52b('0xd'));var campaign=require(_0xa52b('0xe'));var voiceExtension=require(_0xa52b('0xf'));var faxAccount=require(_0xa52b('0x10'));var zendesk=require(_0xa52b('0x11'));var salesforce=require(_0xa52b('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xa52b('0x13'));var desk=require(_0xa52b('0x14'));var zoho=require(_0xa52b('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xa52b('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xa52b('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xa52b('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa52b('0x19')](_0xa52b('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xa52b('0x1a')]()[_0xa52b('0x1b')](user[_0xa52b('0x1c')]())['then'](realtime['initAgents']())[_0xa52b('0x1b')](user[_0xa52b('0x1d')]())[_0xa52b('0x1b')](realtime['initTelephones']())[_0xa52b('0x1b')](trunk['getTrunks']())[_0xa52b('0x1b')](realtime[_0xa52b('0x1e')]())[_0xa52b('0x1b')](voiceQueue[_0xa52b('0x1f')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x20')]())[_0xa52b('0x1b')](trigger[_0xa52b('0x21')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x22')]())[_0xa52b('0x1b')](template['getTemplates']())['then'](realtime[_0xa52b('0x23')]())[_0xa52b('0x1b')](zendesk['getZendeskAccounts']())['then'](realtime['initZendeskAccounts']())[_0xa52b('0x1b')](salesforce[_0xa52b('0x24')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x25')]())[_0xa52b('0x1b')](sugarcrm[_0xa52b('0x26')]())['then'](realtime[_0xa52b('0x27')]())[_0xa52b('0x1b')](freshdesk[_0xa52b('0x28')]())[_0xa52b('0x1b')](realtime['initFreshdeskAccounts']())[_0xa52b('0x1b')](desk['getDeskAccounts']())[_0xa52b('0x1b')](realtime['initDeskAccounts']())['then'](zoho['getZohoAccounts']())[_0xa52b('0x1b')](realtime[_0xa52b('0x29')]())[_0xa52b('0x1b')](vtiger[_0xa52b('0x2a')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x2b')]())[_0xa52b('0x1b')](freshsales[_0xa52b('0x2c')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x2d')]())[_0xa52b('0x1b')](servicenow[_0xa52b('0x2e')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x2f')]())[_0xa52b('0x1b')](dynamics365['getDynamics365Accounts']())[_0xa52b('0x1b')](realtime[_0xa52b('0x30')]())[_0xa52b('0x1b')](campaign['getCampaigns']())[_0xa52b('0x1b')](realtime['initCampaigns']())[_0xa52b('0x1b')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0xa52b('0x31')]())[_0xa52b('0x1b')](faxAccount[_0xa52b('0x32')]())['then'](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xa52b('0x1a')]()[_0xa52b('0x1b')](voiceQueueReport[_0xa52b('0x33')]())[_0xa52b('0x1b')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0xa52b('0x34')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x35')]())[_0xa52b('0x1b')](cmHopperHistory[_0xa52b('0x36')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x37')]())['then'](voiceCallReport[_0xa52b('0x38')]())['then'](realtime['initVoiceCallReports']())[_0xa52b('0x1b')](function(_0x23e874){})[_0xa52b('0x39')](function(_0x17b8f1){console['log'](_0x17b8f1);});}function main(){return server[_0xa52b('0x3a')](realtime,preview,fax)[_0xa52b('0x1b')](function(_0x28a5d0){return initRealtime();})[_0xa52b('0x1b')](function(){return initParams();})[_0xa52b('0x1b')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xa52b('0x39')](function(_0x88208b){console[_0xa52b('0x3b')](_0x88208b);});}main(); \ No newline at end of file +var _0x0986=['./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','get','hour','resolve','then','getAgents','initAgents','getTelephones','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','log','listen','bluebird','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport'];(function(_0xc66453,_0x38c5fc){var _0x4ad3b8=function(_0x2d1b10){while(--_0x2d1b10){_0xc66453['push'](_0xc66453['shift']());}};_0x4ad3b8(++_0x38c5fc);}(_0x0986,0x1bb));var _0x6098=function(_0x3faf77,_0x4115e6){_0x3faf77=_0x3faf77-0x0;var _0x59f392=_0x0986[_0x3faf77];return _0x59f392;};'use strict';var BPromise=require(_0x6098('0x0'));var util=require('util');var moment=require('moment');var server=require(_0x6098('0x1'));var Realtime=require(_0x6098('0x2'));var Report=require(_0x6098('0x3'));var Acw=require(_0x6098('0x4'));var Trigger=require(_0x6098('0x5'));var Dialer=require(_0x6098('0x6'));var Preview=require(_0x6098('0x7'));var Fax=require(_0x6098('0x8'));var user=require(_0x6098('0x9'));var voiceQueue=require(_0x6098('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x6098('0xb'));var trunk=require(_0x6098('0xc'));var trigger=require(_0x6098('0xd'));var template=require(_0x6098('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x6098('0xf'));var voiceExtension=require(_0x6098('0x10'));var faxAccount=require(_0x6098('0x11'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x6098('0x12'));var sugarcrm=require(_0x6098('0x13'));var freshdesk=require(_0x6098('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x6098('0x15'));var freshsales=require(_0x6098('0x16'));var servicenow=require('./rpc/integrations/servicenow');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()[_0x6098('0x17')](_0x6098('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6098('0x17')](_0x6098('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x6098('0x19')]()[_0x6098('0x1a')](user[_0x6098('0x1b')]())[_0x6098('0x1a')](realtime[_0x6098('0x1c')]())[_0x6098('0x1a')](user[_0x6098('0x1d')]())[_0x6098('0x1a')](realtime['initTelephones']())[_0x6098('0x1a')](trunk['getTrunks']())['then'](realtime['initTrunks']())['then'](voiceQueue['getVoiceQueues']())[_0x6098('0x1a')](realtime[_0x6098('0x1e')]())[_0x6098('0x1a')](trigger[_0x6098('0x1f')]())[_0x6098('0x1a')](realtime[_0x6098('0x20')]())[_0x6098('0x1a')](template[_0x6098('0x21')]())['then'](realtime[_0x6098('0x22')]())[_0x6098('0x1a')](zendesk['getZendeskAccounts']())[_0x6098('0x1a')](realtime[_0x6098('0x23')]())[_0x6098('0x1a')](salesforce[_0x6098('0x24')]())[_0x6098('0x1a')](realtime[_0x6098('0x25')]())[_0x6098('0x1a')](sugarcrm[_0x6098('0x26')]())[_0x6098('0x1a')](realtime[_0x6098('0x27')]())['then'](freshdesk[_0x6098('0x28')]())['then'](realtime['initFreshdeskAccounts']())[_0x6098('0x1a')](desk[_0x6098('0x29')]())['then'](realtime[_0x6098('0x2a')]())['then'](zoho['getZohoAccounts']())['then'](realtime[_0x6098('0x2b')]())[_0x6098('0x1a')](vtiger[_0x6098('0x2c')]())[_0x6098('0x1a')](realtime[_0x6098('0x2d')]())['then'](freshsales[_0x6098('0x2e')]())[_0x6098('0x1a')](realtime[_0x6098('0x2f')]())['then'](servicenow[_0x6098('0x30')]())[_0x6098('0x1a')](realtime[_0x6098('0x31')]())[_0x6098('0x1a')](dynamics365[_0x6098('0x32')]())[_0x6098('0x1a')](realtime['initDynamics365Accounts']())[_0x6098('0x1a')](campaign[_0x6098('0x33')]())[_0x6098('0x1a')](realtime[_0x6098('0x34')]())[_0x6098('0x1a')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x6098('0x35')]())[_0x6098('0x1a')](faxAccount[_0x6098('0x36')]())['then'](realtime[_0x6098('0x37')]())[_0x6098('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0x6098('0x19')]()[_0x6098('0x1a')](voiceQueueReport[_0x6098('0x38')]())[_0x6098('0x1a')](realtime[_0x6098('0x39')]())[_0x6098('0x1a')](cmHopperHistory[_0x6098('0x3a')]())[_0x6098('0x1a')](realtime[_0x6098('0x3b')]())[_0x6098('0x1a')](cmHopperHistory[_0x6098('0x3c')]())[_0x6098('0x1a')](realtime['initCampaignHopperHistory']())[_0x6098('0x1a')](voiceCallReport[_0x6098('0x3d')]())[_0x6098('0x1a')](realtime['initVoiceCallReports']())[_0x6098('0x1a')](function(_0x1dcc16){})[_0x6098('0x3e')](function(_0x30876f){console[_0x6098('0x3f')](_0x30876f);});}function main(){return server[_0x6098('0x40')](realtime,preview,fax)[_0x6098('0x1a')](function(_0x26af5a){return initRealtime();})['then'](function(){return initParams();})[_0x6098('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x6098('0x3e')](function(_0x24df78){console['log'](_0x24df78);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 89dcad0..79c2d42 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 _0xafbd=['emit','user:save','exports','lodash','util','moment','ioredis','defaults','localhost','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','mobile','online','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','toLowerCase','idle','inuse','talking','voiceStatus','statePause','voiceStatusTime','toNumber','status','interface','stringify','md5'];(function(_0x2a7b2a,_0x4f6ba6){var _0x599221=function(_0x29fc8d){while(--_0x29fc8d){_0x2a7b2a['push'](_0x2a7b2a['shift']());}};_0x599221(++_0x4f6ba6);}(_0xafbd,0x1b3));var _0xdafb=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0xafbd[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require(_0xdafb('0x0'));var util=require(_0xdafb('0x1'));var moment=require(_0xdafb('0x2'));var md5=require('md5');var Redis=require(_0xdafb('0x3'));var config=require('../../../config/environment');config['redis']=_[_0xdafb('0x4')](config['redis'],{'host':_0xdafb('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x215e13){this['id']=_0x215e13['id']||0x0;this['name']=_0x215e13[_0xdafb('0x6')]||'';this[_0xdafb('0x7')]=_0x215e13[_0xdafb('0x7')]||'';this[_0xdafb('0x8')]=_0x215e13[_0xdafb('0x8')]||'';this[_0xdafb('0x9')]=_0x215e13[_0xdafb('0x9')]||'';this[_0xdafb('0xa')]=_0xdafb('0xb');this[_0xdafb('0xc')]=0x0;this['status']='unknown';this[_0xdafb('0xd')]='';this[_0xdafb('0xe')]='';this[_0xdafb('0xf')]='';this['interface']='';this[_0xdafb('0x10')]=_0x215e13['online']||![];this['voiceStatus']=_0xdafb('0xb');this['voiceStatusTime']=0x0;this[_0xdafb('0x11')]='';this[_0xdafb('0x12')]='';this[_0xdafb('0x13')]=![];this['local']=![];this['md5']='';}Agent[_0xdafb('0x14')]['updateStatusRealtime']=function(_0x15a04f){var _0x51a386;if(_0x15a04f&&_0x15a04f['state']){_0x51a386=_0x15a04f[_0xdafb('0xa')][_0xdafb('0x15')]();switch(_0x51a386){case'not_inuse':_0x51a386=_0xdafb('0x16');break;case _0xdafb('0x17'):_0x51a386=_0xdafb('0x18');break;}}if(_0x51a386&&this[_0xdafb('0x19')]!==_0x51a386||_0x15a04f[_0xdafb('0x1a')]){this[_0xdafb('0x1b')]=_[_0xdafb('0x1c')](moment()['format']('x'));}if(_0x51a386){this[_0xdafb('0x19')]=_0x51a386;}var _0x3fb670={'id':this['id'],'name':this[_0xdafb('0x6')],'email':this[_0xdafb('0x7')],'accountcode':this[_0xdafb('0x8')],'fullname':this['fullname'],'state':this[_0xdafb('0xa')],'stateTime':this['stateTime'],'status':this[_0xdafb('0x1d')],'address':this[_0xdafb('0xd')],'online':this[_0xdafb('0x10')],'voiceStatus':this[_0xdafb('0x19')],'voiceStatusTime':this[_0xdafb('0x1b')],'voiceStatusCallerIdNumber':this[_0xdafb('0x11')],'voiceStatusQueue':this[_0xdafb('0x12')],'interface':this[_0xdafb('0x1e')],'onhold':this['onhold']};var _0x9f2040=md5(JSON[_0xdafb('0x1f')](_0x3fb670));if(this[_0xdafb('0x20')]!==_0x9f2040){this[_0xdafb('0x20')]=_0x9f2040;io['to'](util['format']('user:%s',_0x3fb670[_0xdafb('0x6')]))[_0xdafb('0x21')](_0xdafb('0x22'),_0x3fb670);}};module[_0xdafb('0x23')]=Agent; \ No newline at end of file +var _0x7b70=['toLowerCase','not_inuse','idle','talking','statePause','stringify','format','user:%s','emit','user:save','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype'];(function(_0x4ccc3c,_0x3592db){var _0x3896e7=function(_0x5a1132){while(--_0x5a1132){_0x4ccc3c['push'](_0x4ccc3c['shift']());}};_0x3896e7(++_0x3592db);}(_0x7b70,0x1eb));var _0x07b7=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x7b70[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require('lodash');var util=require(_0x07b7('0x0'));var moment=require(_0x07b7('0x1'));var md5=require(_0x07b7('0x2'));var Redis=require(_0x07b7('0x3'));var config=require(_0x07b7('0x4'));config[_0x07b7('0x5')]=_[_0x07b7('0x6')](config[_0x07b7('0x5')],{'host':_0x07b7('0x7'),'port':0x18eb});var io=require(_0x07b7('0x8'))(new Redis(config[_0x07b7('0x5')]));function Agent(_0x18b89a){this['id']=_0x18b89a['id']||0x0;this[_0x07b7('0x9')]=_0x18b89a[_0x07b7('0x9')]||'';this[_0x07b7('0xa')]=_0x18b89a[_0x07b7('0xa')]||'';this[_0x07b7('0xb')]=_0x18b89a[_0x07b7('0xb')]||'';this['fullname']=_0x18b89a[_0x07b7('0xc')]||'';this[_0x07b7('0xd')]=_0x07b7('0xe');this[_0x07b7('0xf')]=0x0;this[_0x07b7('0x10')]=_0x07b7('0xe');this[_0x07b7('0x11')]='';this[_0x07b7('0x12')]='';this[_0x07b7('0x13')]='';this[_0x07b7('0x14')]='';this['online']=_0x18b89a[_0x07b7('0x15')]||![];this[_0x07b7('0x16')]=_0x07b7('0xe');this[_0x07b7('0x17')]=0x0;this[_0x07b7('0x18')]='';this[_0x07b7('0x19')]='';this[_0x07b7('0x1a')]=![];this[_0x07b7('0x1b')]=![];this[_0x07b7('0x2')]='';}Agent[_0x07b7('0x1c')]['updateStatusRealtime']=function(_0x4f0c4c){var _0x522784;if(_0x4f0c4c&&_0x4f0c4c[_0x07b7('0xd')]){_0x522784=_0x4f0c4c['state'][_0x07b7('0x1d')]();switch(_0x522784){case _0x07b7('0x1e'):_0x522784=_0x07b7('0x1f');break;case'inuse':_0x522784=_0x07b7('0x20');break;}}if(_0x522784&&this[_0x07b7('0x16')]!==_0x522784||_0x4f0c4c[_0x07b7('0x21')]){this[_0x07b7('0x17')]=_['toNumber'](moment()['format']('x'));}if(_0x522784){this[_0x07b7('0x16')]=_0x522784;}var _0x3206d5={'id':this['id'],'name':this[_0x07b7('0x9')],'email':this[_0x07b7('0xa')],'accountcode':this[_0x07b7('0xb')],'fullname':this[_0x07b7('0xc')],'state':this['state'],'stateTime':this['stateTime'],'status':this[_0x07b7('0x10')],'address':this['address'],'online':this[_0x07b7('0x15')],'voiceStatus':this[_0x07b7('0x16')],'voiceStatusTime':this[_0x07b7('0x17')],'voiceStatusCallerIdNumber':this[_0x07b7('0x18')],'voiceStatusQueue':this[_0x07b7('0x19')],'interface':this[_0x07b7('0x14')],'onhold':this[_0x07b7('0x1a')]};var _0x334079=md5(JSON[_0x07b7('0x22')](_0x3206d5));if(this['md5']!==_0x334079){this[_0x07b7('0x2')]=_0x334079;io['to'](util[_0x07b7('0x23')](_0x07b7('0x24'),_0x3206d5['name']))[_0x07b7('0x25')](_0x07b7('0x26'),_0x3206d5);}};module[_0x07b7('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 3457add..79436e6 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 _0x02de=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x2331b2,_0x39a00c){var _0x44b719=function(_0xb247c5){while(--_0xb247c5){_0x2331b2['push'](_0x2331b2['shift']());}};_0x44b719(++_0x39a00c);}(_0x02de,0x15a));var _0xe02d=function(_0x38d309,_0x17e52d){_0x38d309=_0x38d309-0x0;var _0x2cc9b3=_0x02de[_0x38d309];return _0x2cc9b3;};'use strict';function Campaign(_0x43231d){this['id']=_0x43231d['id']||0x0;this[_0xe02d('0x0')]=_0x43231d[_0xe02d('0x0')]||'';this[_0xe02d('0x1')]=_0x43231d['type']||_0xe02d('0x2');this[_0xe02d('0x3')]=0x0;this['temp']=0x0;this[_0xe02d('0x4')]=0x0;this[_0xe02d('0x5')]=0x0;this[_0xe02d('0x6')]='';this[_0xe02d('0x7')]=!![];this['active']=_0x43231d['active'];this[_0xe02d('0x8')]=_0x43231d[_0xe02d('0x8')];this[_0xe02d('0x9')]=_0x43231d[_0xe02d('0x9')]||null;this[_0xe02d('0xa')]=_0x43231d['dialGlobalInterval']?_0x43231d[_0xe02d('0xa')]:null;this[_0xe02d('0xb')]=_0x43231d[_0xe02d('0xb')];this[_0xe02d('0xc')]=_0x43231d['dialOriginateCallerIdNumber'];this[_0xe02d('0xd')]=_0x43231d[_0xe02d('0xd')]||0x1e;this[_0xe02d('0xe')]=_0x43231d[_0xe02d('0xe')];this[_0xe02d('0xf')]=_0x43231d[_0xe02d('0xf')];this[_0xe02d('0x10')]=_0x43231d[_0xe02d('0x10')];this[_0xe02d('0x11')]=_0x43231d[_0xe02d('0x11')];this['dialNoAnswerMaxRetry']=_0x43231d[_0xe02d('0x12')];this[_0xe02d('0x13')]=_0x43231d[_0xe02d('0x13')];this[_0xe02d('0x14')]=_0x43231d['dialGlobalMaxRetry'];this[_0xe02d('0x15')]=_0x43231d[_0xe02d('0x15')]||0x3;this[_0xe02d('0x16')]=_0x43231d[_0xe02d('0x16')]||0x96;this[_0xe02d('0x17')]=_0x43231d[_0xe02d('0x17')]||0x3;this[_0xe02d('0x18')]=_0x43231d[_0xe02d('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x43231d['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x43231d[_0xe02d('0x19')]||0x96;this[_0xe02d('0x1a')]=_0x43231d['dialMachineMaxRetry']||0x3;this[_0xe02d('0x1b')]=_0x43231d[_0xe02d('0x1b')]||0x96;this[_0xe02d('0x1c')]=_0x43231d['dialAgentRejectMaxRetry']||0x3;this[_0xe02d('0x1d')]=_0x43231d[_0xe02d('0x1d')]||0x96;this[_0xe02d('0x1e')]=_0x43231d[_0xe02d('0x1e')]||_0xe02d('0x1f');this['dialPrefix']=_0x43231d[_0xe02d('0x20')]||undefined;this[_0xe02d('0x21')]=_0x43231d[_0xe02d('0x21')]||undefined;this['dialCutDigit']=_0x43231d[_0xe02d('0x22')]||undefined;this[_0xe02d('0x23')]=_0x43231d[_0xe02d('0x23')]?_0x43231d['TrunkBackup']:undefined;this['Trunk']=_0x43231d[_0xe02d('0x24')]?_0x43231d[_0xe02d('0x24')]:undefined;this[_0xe02d('0x25')]=_0x43231d[_0xe02d('0x25')]?_0x43231d[_0xe02d('0x25')]:undefined;this[_0xe02d('0x26')]=_0x43231d['SquareProject']?_0x43231d[_0xe02d('0x26')]:undefined;this[_0xe02d('0x27')]=_0x43231d[_0xe02d('0x26')]?_0x43231d[_0xe02d('0x26')][_0xe02d('0x0')]:undefined;this[_0xe02d('0x28')]=_0x43231d['dialAMDActive']||![];this[_0xe02d('0x29')]=_0x43231d[_0xe02d('0x29')];this['dialAMDGreeting']=_0x43231d[_0xe02d('0x2a')];this[_0xe02d('0x2b')]=_0x43231d['dialAMDAfterGreetingSilence'];this[_0xe02d('0x2c')]=_0x43231d[_0xe02d('0x2c')];this[_0xe02d('0x2d')]=_0x43231d['dialAMDMinWordLength'];this[_0xe02d('0x2e')]=_0x43231d[_0xe02d('0x2e')];this[_0xe02d('0x2f')]=_0x43231d[_0xe02d('0x2f')];this[_0xe02d('0x30')]=_0x43231d['dialAMDSilenceThreshold'];this[_0xe02d('0x31')]=_0x43231d[_0xe02d('0x31')];}module[_0xe02d('0x32')]=Campaign; \ No newline at end of file +var _0x94cc=['dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency'];(function(_0x1aa665,_0x31073e){var _0x177faf=function(_0x1fe683){while(--_0x1fe683){_0x1aa665['push'](_0x1aa665['shift']());}};_0x177faf(++_0x31073e);}(_0x94cc,0x133));var _0xc94c=function(_0x60d2b7,_0x18070a){_0x60d2b7=_0x60d2b7-0x0;var _0xa9793=_0x94cc[_0x60d2b7];return _0xa9793;};'use strict';function Campaign(_0x44f710){this['id']=_0x44f710['id']||0x0;this[_0xc94c('0x0')]=_0x44f710[_0xc94c('0x0')]||'';this[_0xc94c('0x1')]=_0x44f710['type']||_0xc94c('0x2');this['originated']=0x0;this['temp']=0x0;this[_0xc94c('0x3')]=0x0;this[_0xc94c('0x4')]=0x0;this[_0xc94c('0x5')]='';this[_0xc94c('0x6')]=!![];this[_0xc94c('0x7')]=_0x44f710['active'];this['limitCalls']=_0x44f710['limitCalls'];this['dialTimezone']=_0x44f710[_0xc94c('0x8')]||null;this[_0xc94c('0x9')]=_0x44f710[_0xc94c('0x9')]?_0x44f710[_0xc94c('0x9')]:null;this[_0xc94c('0xa')]=_0x44f710[_0xc94c('0xa')];this['dialOriginateCallerIdNumber']=_0x44f710[_0xc94c('0xb')];this[_0xc94c('0xc')]=_0x44f710[_0xc94c('0xc')]||0x1e;this[_0xc94c('0xd')]=_0x44f710[_0xc94c('0xd')];this[_0xc94c('0xe')]=_0x44f710['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x44f710[_0xc94c('0xf')];this[_0xc94c('0x10')]=_0x44f710[_0xc94c('0x10')];this[_0xc94c('0x11')]=_0x44f710[_0xc94c('0x11')];this['dialNoAnswerRetryFrequency']=_0x44f710['dialNoAnswerRetryFrequency'];this[_0xc94c('0x12')]=_0x44f710['dialGlobalMaxRetry'];this[_0xc94c('0x13')]=_0x44f710['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x44f710[_0xc94c('0x14')]||0x96;this[_0xc94c('0x15')]=_0x44f710['dialDropMaxRetry']||0x3;this[_0xc94c('0x16')]=_0x44f710[_0xc94c('0x16')]||0x96;this[_0xc94c('0x17')]=_0x44f710[_0xc94c('0x17')]||0x3;this[_0xc94c('0x18')]=_0x44f710[_0xc94c('0x18')]||0x96;this[_0xc94c('0x19')]=_0x44f710[_0xc94c('0x19')]||0x3;this[_0xc94c('0x1a')]=_0x44f710[_0xc94c('0x1a')]||0x96;this[_0xc94c('0x1b')]=_0x44f710[_0xc94c('0x1b')]||0x3;this[_0xc94c('0x1c')]=_0x44f710[_0xc94c('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x44f710[_0xc94c('0x1d')]||_0xc94c('0x1e');this['dialPrefix']=_0x44f710[_0xc94c('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x44f710['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xc94c('0x20')]=_0x44f710['dialCutDigit']||undefined;this[_0xc94c('0x21')]=_0x44f710[_0xc94c('0x21')]?_0x44f710[_0xc94c('0x21')]:undefined;this[_0xc94c('0x22')]=_0x44f710[_0xc94c('0x22')]?_0x44f710[_0xc94c('0x22')]:undefined;this[_0xc94c('0x23')]=_0x44f710[_0xc94c('0x23')]?_0x44f710['Interval']:undefined;this[_0xc94c('0x24')]=_0x44f710['SquareProject']?_0x44f710[_0xc94c('0x24')]:undefined;this[_0xc94c('0x25')]=_0x44f710[_0xc94c('0x24')]?_0x44f710['SquareProject']['name']:undefined;this['dialAMDActive']=_0x44f710[_0xc94c('0x26')]||![];this[_0xc94c('0x27')]=_0x44f710[_0xc94c('0x27')];this['dialAMDGreeting']=_0x44f710[_0xc94c('0x28')];this[_0xc94c('0x29')]=_0x44f710['dialAMDAfterGreetingSilence'];this[_0xc94c('0x2a')]=_0x44f710[_0xc94c('0x2a')];this[_0xc94c('0x2b')]=_0x44f710[_0xc94c('0x2b')];this[_0xc94c('0x2c')]=_0x44f710['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x44f710[_0xc94c('0x2d')];this['dialAMDSilenceThreshold']=_0x44f710[_0xc94c('0x2e')];this['dialAMDMaximumWordLength']=_0x44f710['dialAMDMaximumWordLength'];}module[_0xc94c('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index eb343a5..544fc96 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 _0xd7a5=['abandoned','lastapplication','duration','billableseconds','holdtime','type','tag','disposition','monitor','queue','monitors','transfercalleridnum','exports','starttime','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd7a5,0x1ad));var _0x5d7a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xd7a5[_0x1694f5];return _0x5b4321;};'use strict';function Channel(){this[_0x5d7a('0x0')]=null;this['channel']='';this[_0x5d7a('0x1')]='';this[_0x5d7a('0x2')]=0x0;this['calleridname']='';this[_0x5d7a('0x3')]=undefined;this[_0x5d7a('0x4')]=undefined;this[_0x5d7a('0x5')]=0x0;this[_0x5d7a('0x6')]='';this[_0x5d7a('0x7')]=0x0;this[_0x5d7a('0x8')]=0x0;this[_0x5d7a('0x9')]=0x0;this[_0x5d7a('0xa')]=![];this[_0x5d7a('0xb')]=null;this[_0x5d7a('0xc')]=null;this['unmanaged']=![];this[_0x5d7a('0xd')]=![];this[_0x5d7a('0xe')]='';this['lastdata']='';this[_0x5d7a('0xf')]=0x0;this[_0x5d7a('0x10')]=0x0;this[_0x5d7a('0x11')]=0x0;this[_0x5d7a('0x12')]=null;this[_0x5d7a('0x13')]=null;this[_0x5d7a('0x14')]=null;this[_0x5d7a('0x15')]=![];this['monitorFilename']=null;this[_0x5d7a('0x16')]=null;this[_0x5d7a('0x17')]=[];this[_0x5d7a('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this['mohtime']=0x0;}module[_0x5d7a('0x19')]=Channel; \ No newline at end of file +var _0xd1f8=['tag','disposition','monitor','monitorFilename','queue','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','accountcode','uniqueid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime'];(function(_0x20e177,_0x365303){var _0x117ec7=function(_0x1594be){while(--_0x1594be){_0x20e177['push'](_0x20e177['shift']());}};_0x117ec7(++_0x365303);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0xd1f8[_0x4d674b];return _0x535a1f;};'use strict';function Channel(){this[_0x8d1f('0x0')]=null;this[_0x8d1f('0x1')]='';this[_0x8d1f('0x2')]='';this[_0x8d1f('0x3')]=0x0;this['calleridname']='';this[_0x8d1f('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x8d1f('0x5')]=0x0;this['context']='';this[_0x8d1f('0x6')]=0x0;this['linkedid']=0x0;this[_0x8d1f('0x7')]=0x0;this[_0x8d1f('0x8')]=![];this['answertime']=null;this[_0x8d1f('0x9')]=null;this[_0x8d1f('0xa')]=![];this[_0x8d1f('0xb')]=![];this[_0x8d1f('0xc')]='';this[_0x8d1f('0xd')]='';this['duration']=0x0;this[_0x8d1f('0xe')]=0x0;this[_0x8d1f('0xf')]=0x0;this['type']=null;this[_0x8d1f('0x10')]=null;this[_0x8d1f('0x11')]=null;this[_0x8d1f('0x12')]=![];this[_0x8d1f('0x13')]=null;this[_0x8d1f('0x14')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x8d1f('0x15')]=undefined;this['mohtime']=0x0;}module[_0x8d1f('0x16')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 093c540..eacab00 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 _0x6f72=['consumerSecret','token','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x4dbd57,_0xf3a2b6){var _0x39efae=function(_0x5ab133){while(--_0x5ab133){_0x4dbd57['push'](_0x4dbd57['shift']());}};_0x39efae(++_0xf3a2b6);}(_0x6f72,0xae));var _0x26f7=function(_0x3b6d19,_0x1f9afd){_0x3b6d19=_0x3b6d19-0x0;var _0x55b646=_0x6f72[_0x3b6d19];return _0x55b646;};'use strict';function DeskAccount(_0x2d351f){this['id']=_0x2d351f['id']||0x0;this[_0x26f7('0x0')]=_0x2d351f[_0x26f7('0x0')]||'';this[_0x26f7('0x1')]=_0x2d351f['username']||'';this[_0x26f7('0x2')]=_0x2d351f[_0x26f7('0x2')]||'';this['authType']=_0x2d351f[_0x26f7('0x3')]||'';this[_0x26f7('0x4')]=_0x2d351f['password']||'';this[_0x26f7('0x5')]=_0x2d351f['consumerKey']||'';this[_0x26f7('0x6')]=_0x2d351f['consumerSecret']||'';this[_0x26f7('0x7')]=_0x2d351f[_0x26f7('0x7')]||'';this['tokenSecret']=_0x2d351f['tokenSecret']||'';this[_0x26f7('0x8')]=_0x2d351f[_0x26f7('0x8')]||'';this[_0x26f7('0x9')]=_0x2d351f[_0x26f7('0x9')]||'';this[_0x26f7('0xa')]=_0x2d351f[_0x26f7('0xa')]||{};}module[_0x26f7('0xb')]=DeskAccount; \ No newline at end of file +var _0xe914=['consumerKey','consumerSecret','token','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x30dcd4,_0x5093e3){var _0xe37f04=function(_0x553ff4){while(--_0x553ff4){_0x30dcd4['push'](_0x30dcd4['shift']());}};_0xe37f04(++_0x5093e3);}(_0xe914,0x7f));var _0x4e91=function(_0x3e52dc,_0x24306f){_0x3e52dc=_0x3e52dc-0x0;var _0x6061fa=_0xe914[_0x3e52dc];return _0x6061fa;};'use strict';function DeskAccount(_0x5ecba4){this['id']=_0x5ecba4['id']||0x0;this[_0x4e91('0x0')]=_0x5ecba4['name']||'';this[_0x4e91('0x1')]=_0x5ecba4[_0x4e91('0x1')]||'';this[_0x4e91('0x2')]=_0x5ecba4[_0x4e91('0x2')]||'';this[_0x4e91('0x3')]=_0x5ecba4[_0x4e91('0x3')]||'';this['password']=_0x5ecba4[_0x4e91('0x4')]||'';this[_0x4e91('0x5')]=_0x5ecba4['consumerKey']||'';this[_0x4e91('0x6')]=_0x5ecba4[_0x4e91('0x6')]||'';this[_0x4e91('0x7')]=_0x5ecba4[_0x4e91('0x7')]||'';this['tokenSecret']=_0x5ecba4['tokenSecret']||'';this[_0x4e91('0x8')]=_0x5ecba4['type']||'';this['serverUrl']=_0x5ecba4[_0x4e91('0x9')]||'';this[_0x4e91('0xa')]=_0x5ecba4[_0x4e91('0xa')]||{};}module[_0x4e91('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 a3d7d8a..f87baf2 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 _0xdf5c=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x451481,_0xd97ad4){var _0x4903cd=function(_0x2121e3){while(--_0x2121e3){_0x451481['push'](_0x451481['shift']());}};_0x4903cd(++_0xd97ad4);}(_0xdf5c,0x1eb));var _0xcdf5=function(_0x5ba30f,_0x58f7e7){_0x5ba30f=_0x5ba30f-0x0;var _0xc44718=_0xdf5c[_0x5ba30f];return _0xc44718;};'use strict';function Dynamics365Account(_0x2bd558){this['id']=_0x2bd558['id']||0x0;this[_0xcdf5('0x0')]=_0x2bd558[_0xcdf5('0x0')]||'';this[_0xcdf5('0x1')]=_0x2bd558['username']||'';this['password']=_0x2bd558[_0xcdf5('0x2')]||'';this[_0xcdf5('0x3')]=_0x2bd558[_0xcdf5('0x3')]||'';this['tenantId']=_0x2bd558[_0xcdf5('0x4')]||'';this[_0xcdf5('0x5')]=_0x2bd558['clientId']||'';this[_0xcdf5('0x6')]=_0x2bd558[_0xcdf5('0x6')]||{};this[_0xcdf5('0x7')]=_0x2bd558[_0xcdf5('0x7')]||'';this[_0xcdf5('0x8')]=_0x2bd558[_0xcdf5('0x8')]||{};}module[_0xcdf5('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xd69b=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x546ae4,_0x590373){var _0x25ee2b=function(_0x44d5f7){while(--_0x44d5f7){_0x546ae4['push'](_0x546ae4['shift']());}};_0x25ee2b(++_0x590373);}(_0xd69b,0x1cf));var _0xbd69=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xd69b[_0x4fbfd9];return _0x31dc94;};'use strict';function Dynamics365Account(_0x5e2727){this['id']=_0x5e2727['id']||0x0;this[_0xbd69('0x0')]=_0x5e2727[_0xbd69('0x0')]||'';this['username']=_0x5e2727[_0xbd69('0x1')]||'';this[_0xbd69('0x2')]=_0x5e2727['password']||'';this['remoteUri']=_0x5e2727[_0xbd69('0x3')]||'';this[_0xbd69('0x4')]=_0x5e2727[_0xbd69('0x4')]||'';this[_0xbd69('0x5')]=_0x5e2727[_0xbd69('0x5')]||'';this[_0xbd69('0x6')]=_0x5e2727[_0xbd69('0x6')]||{};this['serverUrl']=_0x5e2727[_0xbd69('0x7')]||'';this[_0xbd69('0x8')]=_0x5e2727[_0xbd69('0x8')]||{};}module[_0xbd69('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 51b33f4..a9e018f 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 _0x9fa2=['faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x48ce53,_0x162529){var _0x5cf816=function(_0x569148){while(--_0x569148){_0x48ce53['push'](_0x48ce53['shift']());}};_0x5cf816(++_0x162529);}(_0x9fa2,0x67));var _0x29fa=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x9fa2[_0x1f5a63];return _0x30bb7a;};'use strict';function FaxAccount(_0x4c6556){this['id']=_0x4c6556['id']||0x0;this[_0x29fa('0x0')]=_0x4c6556[_0x29fa('0x0')]||'';this[_0x29fa('0x1')]=_0x4c6556[_0x29fa('0x1')];this['ecm']=_0x4c6556[_0x29fa('0x2')];this['headerinfo']=_0x4c6556['headerinfo'];this[_0x29fa('0x3')]=_0x4c6556['localstationid'];this[_0x29fa('0x4')]=_0x4c6556[_0x29fa('0x4')]||0x960;this[_0x29fa('0x5')]=_0x4c6556[_0x29fa('0x5')]||0x3840;this[_0x29fa('0x6')]=_0x4c6556[_0x29fa('0x6')]||_0x29fa('0x7');this[_0x29fa('0x8')]=_0x4c6556[_0x29fa('0x8')]||'no';this['faxdetect']=_0x4c6556[_0x29fa('0x9')]||'no';this['t38timeout']=_0x4c6556[_0x29fa('0xa')]||0x1388;this[_0x29fa('0xb')]=_0x4c6556[_0x29fa('0xb')]||'SIP';this[_0x29fa('0xc')]=_0x4c6556[_0x29fa('0xc')]?_0x4c6556[_0x29fa('0xc')]:undefined;this[_0x29fa('0xd')]=_0x4c6556[_0x29fa('0xd')];this[_0x29fa('0xe')]=_0x4c6556['key'];}module[_0x29fa('0xf')]=FaxAccount; \ No newline at end of file +var _0xd0cd=['t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','modem','v17,v27,v29','faxdetect'];(function(_0x3ad219,_0x48e655){var _0x19d79f=function(_0x2ce5d3){while(--_0x2ce5d3){_0x3ad219['push'](_0x3ad219['shift']());}};_0x19d79f(++_0x48e655);}(_0xd0cd,0xe7));var _0xdd0c=function(_0x56de0b,_0x1c39c1){_0x56de0b=_0x56de0b-0x0;var _0x1c05f0=_0xd0cd[_0x56de0b];return _0x1c05f0;};'use strict';function FaxAccount(_0x30c190){this['id']=_0x30c190['id']||0x0;this[_0xdd0c('0x0')]=_0x30c190[_0xdd0c('0x0')]||'';this[_0xdd0c('0x1')]=_0x30c190['description'];this[_0xdd0c('0x2')]=_0x30c190[_0xdd0c('0x2')];this[_0xdd0c('0x3')]=_0x30c190[_0xdd0c('0x3')];this[_0xdd0c('0x4')]=_0x30c190[_0xdd0c('0x4')];this[_0xdd0c('0x5')]=_0x30c190[_0xdd0c('0x5')]||0x960;this['maxrate']=_0x30c190['maxrate']||0x3840;this[_0xdd0c('0x6')]=_0x30c190[_0xdd0c('0x6')]||_0xdd0c('0x7');this['gateway']=_0x30c190['gateway']||'no';this[_0xdd0c('0x8')]=_0x30c190[_0xdd0c('0x8')]||'no';this[_0xdd0c('0x9')]=_0x30c190['t38timeout']||0x1388;this[_0xdd0c('0xa')]=_0x30c190[_0xdd0c('0xa')]||'SIP';this[_0xdd0c('0xb')]=_0x30c190[_0xdd0c('0xb')]?_0x30c190[_0xdd0c('0xb')]:undefined;this[_0xdd0c('0xc')]=_0x30c190['ListId'];this[_0xdd0c('0xd')]=_0x30c190[_0xdd0c('0xd')];}module[_0xdd0c('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 5d57fb5..54143f6 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 _0x8b1b=['remoteUri','Configurations','exports','name','username','apiKey','token'];(function(_0x2ec00a,_0x23412a){var _0x27b616=function(_0x1bb2c5){while(--_0x1bb2c5){_0x2ec00a['push'](_0x2ec00a['shift']());}};_0x27b616(++_0x23412a);}(_0x8b1b,0xea));var _0xb8b1=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x8b1b[_0x4ae829];return _0x256b31;};'use strict';function FreshdeskAccount(_0x14159d){this['id']=_0x14159d['id']||0x0;this[_0xb8b1('0x0')]=_0x14159d[_0xb8b1('0x0')]||'';this[_0xb8b1('0x1')]=_0x14159d['username']||'';this[_0xb8b1('0x2')]=_0x14159d[_0xb8b1('0x3')]||'';this[_0xb8b1('0x4')]=_0x14159d[_0xb8b1('0x4')]||'';this['serverUrl']=_0x14159d['serverUrl']||'';this[_0xb8b1('0x5')]=_0x14159d[_0xb8b1('0x5')]||{};}module[_0xb8b1('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x334b=['Configurations','exports','name','username','token','remoteUri','serverUrl'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x334b,0xb8));var _0xb334=function(_0x5890bd,_0x58db71){_0x5890bd=_0x5890bd-0x0;var _0xd86a47=_0x334b[_0x5890bd];return _0xd86a47;};'use strict';function FreshdeskAccount(_0x1bd3ac){this['id']=_0x1bd3ac['id']||0x0;this['name']=_0x1bd3ac[_0xb334('0x0')]||'';this[_0xb334('0x1')]=_0x1bd3ac['username']||'';this['apiKey']=_0x1bd3ac[_0xb334('0x2')]||'';this[_0xb334('0x3')]=_0x1bd3ac[_0xb334('0x3')]||'';this[_0xb334('0x4')]=_0x1bd3ac[_0xb334('0x4')]||'';this[_0xb334('0x5')]=_0x1bd3ac[_0xb334('0x5')]||{};}module[_0xb334('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 553c186..39a67ed 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 _0x34b3=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0xcf4569,_0x1ce755){var _0x7fef=function(_0x374ab8){while(--_0x374ab8){_0xcf4569['push'](_0xcf4569['shift']());}};_0x7fef(++_0x1ce755);}(_0x34b3,0x18e));var _0x334b=function(_0x2a8855,_0x404cc8){_0x2a8855=_0x2a8855-0x0;var _0x4fb8ae=_0x34b3[_0x2a8855];return _0x4fb8ae;};'use strict';function FreshsalesAccount(_0x5e2002){this['id']=_0x5e2002['id']||0x0;this[_0x334b('0x0')]=_0x5e2002['name']||'';this[_0x334b('0x1')]=_0x5e2002[_0x334b('0x1')]||'';this[_0x334b('0x2')]=_0x5e2002[_0x334b('0x3')]||'';this['remoteUri']=_0x5e2002[_0x334b('0x4')]||'';this[_0x334b('0x5')]=_0x5e2002[_0x334b('0x5')]||'';this[_0x334b('0x6')]=_0x5e2002[_0x334b('0x6')]||{};}module[_0x334b('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x58bd=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x2a488b,_0x3eca41){var _0x2048bb=function(_0x4a43c4){while(--_0x4a43c4){_0x2a488b['push'](_0x2a488b['shift']());}};_0x2048bb(++_0x3eca41);}(_0x58bd,0x195));var _0xd58b=function(_0x49e5f1,_0x1c3b6d){_0x49e5f1=_0x49e5f1-0x0;var _0x3cbc96=_0x58bd[_0x49e5f1];return _0x3cbc96;};'use strict';function FreshsalesAccount(_0xe09f89){this['id']=_0xe09f89['id']||0x0;this[_0xd58b('0x0')]=_0xe09f89['name']||'';this[_0xd58b('0x1')]=_0xe09f89[_0xd58b('0x1')]||'';this[_0xd58b('0x2')]=_0xe09f89[_0xd58b('0x3')]||'';this[_0xd58b('0x4')]=_0xe09f89[_0xd58b('0x4')]||'';this['serverUrl']=_0xe09f89[_0xd58b('0x5')]||'';this[_0xd58b('0x6')]=_0xe09f89[_0xd58b('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index f903462..4c7da16 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 _0xb3d3=['priority','holdtime','assigned','lastAssignedTo','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerabandon','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','accountcode','context','exten'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb3d3,0xdc));var _0x3b3d=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0xb3d3[_0x4fc80b];return _0x119dba;};'use strict';function QueueReport(){this[_0x3b3d('0x0')]='inbound';this[_0x3b3d('0x1')]='';this[_0x3b3d('0x2')]='';this[_0x3b3d('0x3')]='';this['queue']='';this[_0x3b3d('0x4')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this[_0x3b3d('0x5')]=![];this['queuecallerabandonAt']=null;this[_0x3b3d('0x6')]=![];this['queuecallercompleteAt']=null;this[_0x3b3d('0x7')]=![];this[_0x3b3d('0x8')]=null;this[_0x3b3d('0x9')]=0x1;this[_0x3b3d('0xa')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0x3b3d('0xb')]='';this[_0x3b3d('0xc')]='';this[_0x3b3d('0xd')]='';this[_0x3b3d('0xe')]='';this[_0x3b3d('0xf')]=0x0;this[_0x3b3d('0x10')]=![];this[_0x3b3d('0x11')]='';this['mohtime']=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0x1f87=['queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinename','accountcode','exten','priority','holdtime','mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandonAt'];(function(_0x16501b,_0x141acb){var _0x4fb9c0=function(_0x33ffbe){while(--_0x33ffbe){_0x16501b['push'](_0x16501b['shift']());}};_0x4fb9c0(++_0x141acb);}(_0x1f87,0x15c));var _0x71f8=function(_0x9e5cfb,_0x5e1a0f){_0x9e5cfb=_0x9e5cfb-0x0;var _0x5a3140=_0x1f87[_0x9e5cfb];return _0x5a3140;};'use strict';function QueueReport(){this['type']=_0x71f8('0x0');this[_0x71f8('0x1')]='';this[_0x71f8('0x2')]='';this[_0x71f8('0x3')]='';this[_0x71f8('0x4')]='';this[_0x71f8('0x5')]=null;this[_0x71f8('0x6')]=null;this[_0x71f8('0x7')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x71f8('0x8')]=null;this[_0x71f8('0x9')]=![];this[_0x71f8('0xa')]=null;this['queuecallerexit']=![];this[_0x71f8('0xb')]=null;this['originalposition']=0x1;this[_0x71f8('0xc')]='';this['connectedlinenum']='';this[_0x71f8('0xd')]='';this[_0x71f8('0xe')]='';this['context']='';this[_0x71f8('0xf')]='';this[_0x71f8('0x10')]='';this[_0x71f8('0x11')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x71f8('0x12')]=0x0;this[_0x71f8('0x13')]={};}module[_0x71f8('0x14')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 412d971..34780ae 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 _0xbb87=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','password','clientId'];(function(_0x5038d4,_0x4ff6c1){var _0x14f3f3=function(_0x5926d3){while(--_0x5926d3){_0x5038d4['push'](_0x5038d4['shift']());}};_0x14f3f3(++_0x4ff6c1);}(_0xbb87,0xa1));var _0x7bb8=function(_0x4197d7,_0x3f6556){_0x4197d7=_0x4197d7-0x0;var _0x1971ad=_0xbb87[_0x4197d7];return _0x1971ad;};'use strict';function SalesforceAccount(_0x369c8b){this['id']=_0x369c8b['id']||0x0;this[_0x7bb8('0x0')]=_0x369c8b[_0x7bb8('0x0')]||'';this[_0x7bb8('0x1')]=_0x369c8b['username']||'';this['remoteUri']=_0x369c8b['remoteUri']||'';this[_0x7bb8('0x2')]=_0x369c8b[_0x7bb8('0x2')]||'';this['clientId']=_0x369c8b[_0x7bb8('0x3')]||'';this[_0x7bb8('0x4')]=_0x369c8b[_0x7bb8('0x4')]||'';this['securityToken']=_0x369c8b[_0x7bb8('0x5')]||'';this[_0x7bb8('0x6')]=_0x369c8b[_0x7bb8('0x6')]||_0x7bb8('0x7');this['serverUrl']=_0x369c8b[_0x7bb8('0x8')]||'';this[_0x7bb8('0x9')]=_0x369c8b[_0x7bb8('0x9')]||{};}module[_0x7bb8('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x2779=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x2779,0x143));var _0x9277=function(_0x258606,_0x2f61ea){_0x258606=_0x258606-0x0;var _0x3c1065=_0x2779[_0x258606];return _0x3c1065;};'use strict';function SalesforceAccount(_0x470d46){this['id']=_0x470d46['id']||0x0;this[_0x9277('0x0')]=_0x470d46[_0x9277('0x0')]||'';this[_0x9277('0x1')]=_0x470d46[_0x9277('0x1')]||'';this[_0x9277('0x2')]=_0x470d46[_0x9277('0x2')]||'';this[_0x9277('0x3')]=_0x470d46[_0x9277('0x3')]||'';this['clientId']=_0x470d46[_0x9277('0x4')]||'';this[_0x9277('0x5')]=_0x470d46[_0x9277('0x5')]||'';this[_0x9277('0x6')]=_0x470d46[_0x9277('0x6')]||'';this[_0x9277('0x7')]=_0x470d46[_0x9277('0x7')]||_0x9277('0x8');this['serverUrl']=_0x470d46[_0x9277('0x9')]||'';this[_0x9277('0xa')]=_0x470d46['Configurations']||{};}module[_0x9277('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index b525c32..d0b3fcc 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 _0x1bbf=['serverUrl','Configurations','exports','username','password'];(function(_0x447f30,_0xcd4a00){var _0x4a0982=function(_0x37c081){while(--_0x37c081){_0x447f30['push'](_0x447f30['shift']());}};_0x4a0982(++_0xcd4a00);}(_0x1bbf,0x12a));var _0xf1bb=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0x1bbf[_0xea35d1];return _0x1d7a7c;};'use strict';function ServicenowAccount(_0x54ec19){this['id']=_0x54ec19['id']||0x0;this['name']=_0x54ec19['name']||'';this[_0xf1bb('0x0')]=_0x54ec19['username']||'';this[_0xf1bb('0x1')]=_0x54ec19[_0xf1bb('0x1')]||'';this['remoteUri']=_0x54ec19['remoteUri']||'';this['serverUrl']=_0x54ec19[_0xf1bb('0x2')]||'';this[_0xf1bb('0x3')]=_0x54ec19[_0xf1bb('0x3')]||{};}module[_0xf1bb('0x4')]=ServicenowAccount; \ No newline at end of file +var _0xe27a=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0xa37892,_0x40cf01){var _0x45e007=function(_0x486db0){while(--_0x486db0){_0xa37892['push'](_0xa37892['shift']());}};_0x45e007(++_0x40cf01);}(_0xe27a,0x6f));var _0xae27=function(_0x4559e4,_0x4f13a4){_0x4559e4=_0x4559e4-0x0;var _0x5e312f=_0xe27a[_0x4559e4];return _0x5e312f;};'use strict';function ServicenowAccount(_0x355905){this['id']=_0x355905['id']||0x0;this[_0xae27('0x0')]=_0x355905[_0xae27('0x0')]||'';this[_0xae27('0x1')]=_0x355905['username']||'';this[_0xae27('0x2')]=_0x355905['password']||'';this[_0xae27('0x3')]=_0x355905[_0xae27('0x3')]||'';this[_0xae27('0x4')]=_0x355905[_0xae27('0x4')]||'';this[_0xae27('0x5')]=_0x355905['Configurations']||{};}module[_0xae27('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index afdd7c5..bfef553 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 _0x349e=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2452b9,_0x2f9989){var _0x51542d=function(_0x3e24be){while(--_0x3e24be){_0x2452b9['push'](_0x2452b9['shift']());}};_0x51542d(++_0x2f9989);}(_0x349e,0x6f));var _0xe349=function(_0x583a0f,_0x1549ee){_0x583a0f=_0x583a0f-0x0;var _0x557100=_0x349e[_0x583a0f];return _0x557100;};'use strict';function SugarcrmAccount(_0x4b1e54){this['id']=_0x4b1e54['id']||0x0;this[_0xe349('0x0')]=_0x4b1e54[_0xe349('0x0')]||'';this[_0xe349('0x1')]=_0x4b1e54[_0xe349('0x1')]||'';this[_0xe349('0x2')]=_0x4b1e54['password']||'';this[_0xe349('0x3')]=_0x4b1e54['remoteUri']||'';this[_0xe349('0x4')]=_0x4b1e54[_0xe349('0x4')]||'';this['Configurations']=_0x4b1e54[_0xe349('0x5')]||{};}module[_0xe349('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x2e49=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x190761,_0x67c9c0){var _0x48af6c=function(_0x1b675a){while(--_0x1b675a){_0x190761['push'](_0x190761['shift']());}};_0x48af6c(++_0x67c9c0);}(_0x2e49,0x167));var _0x92e4=function(_0x3fb3b4,_0xd9d30d){_0x3fb3b4=_0x3fb3b4-0x0;var _0x25b77d=_0x2e49[_0x3fb3b4];return _0x25b77d;};'use strict';function SugarcrmAccount(_0x50cf69){this['id']=_0x50cf69['id']||0x0;this[_0x92e4('0x0')]=_0x50cf69['name']||'';this[_0x92e4('0x1')]=_0x50cf69[_0x92e4('0x1')]||'';this['password']=_0x50cf69['password']||'';this['remoteUri']=_0x50cf69[_0x92e4('0x2')]||'';this[_0x92e4('0x3')]=_0x50cf69['serverUrl']||'';this[_0x92e4('0x4')]=_0x50cf69[_0x92e4('0x4')]||{};}module[_0x92e4('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 88d0b47..854931b 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 _0xbe8c=['name','accountcode','unknown','stateTime','status','address','exports'];(function(_0x5b636d,_0x15dfef){var _0x2c769c=function(_0x1927fb){while(--_0x1927fb){_0x5b636d['push'](_0x5b636d['shift']());}};_0x2c769c(++_0x15dfef);}(_0xbe8c,0x1c0));var _0xcbe8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbe8c[_0xfae23b];return _0x200640;};'use strict';function Telephone(_0x23ed1e){this['id']=_0x23ed1e['id']||0x0;this['name']=_0x23ed1e[_0xcbe8('0x0')]||'';this[_0xcbe8('0x1')]=_0x23ed1e[_0xcbe8('0x1')]||'';this['state']=_0xcbe8('0x2');this[_0xcbe8('0x3')]=0x0;this[_0xcbe8('0x4')]=_0xcbe8('0x2');this[_0xcbe8('0x5')]='';}module[_0xcbe8('0x6')]=Telephone; \ No newline at end of file +var _0x60de=['accountcode','state','unknown','address','exports','name'];(function(_0x398d46,_0x3f08be){var _0x34a7c8=function(_0x578906){while(--_0x578906){_0x398d46['push'](_0x398d46['shift']());}};_0x34a7c8(++_0x3f08be);}(_0x60de,0x167));var _0xe60d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x60de[_0x19950b];return _0x3c6b41;};'use strict';function Telephone(_0x435ae4){this['id']=_0x435ae4['id']||0x0;this[_0xe60d('0x0')]=_0x435ae4['name']||'';this[_0xe60d('0x1')]=_0x435ae4[_0xe60d('0x1')]||'';this[_0xe60d('0x2')]='unknown';this['stateTime']=0x0;this['status']=_0xe60d('0x3');this[_0xe60d('0x4')]='';}module[_0xe60d('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 356be21..7bf3fb6 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 _0xe49a=['html','exports','name'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0xe49a,0xd7));var _0xae49=function(_0x48449b,_0xb5ab3f){_0x48449b=_0x48449b-0x0;var _0x5288ec=_0xe49a[_0x48449b];return _0x5288ec;};'use strict';function template(_0x5a2668){this['id']=_0x5a2668['id']||0x0;this[_0xae49('0x0')]=_0x5a2668[_0xae49('0x0')]||'';this[_0xae49('0x1')]=_0x5a2668[_0xae49('0x1')]||'';}module[_0xae49('0x2')]=template; \ No newline at end of file +var _0xd1a3=['name','html','exports'];(function(_0x53bd00,_0x5f08b8){var _0x1c05bf=function(_0x41e84d){while(--_0x41e84d){_0x53bd00['push'](_0x53bd00['shift']());}};_0x1c05bf(++_0x5f08b8);}(_0xd1a3,0xc3));var _0x3d1a=function(_0x574e29,_0x26bd5f){_0x574e29=_0x574e29-0x0;var _0x59413e=_0xd1a3[_0x574e29];return _0x59413e;};'use strict';function template(_0xe5c435){this['id']=_0xe5c435['id']||0x0;this[_0x3d1a('0x0')]=_0xe5c435[_0x3d1a('0x0')]||'';this[_0x3d1a('0x1')]=_0xe5c435[_0x3d1a('0x1')]||'';}module[_0x3d1a('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 69b77d3..4d61a9b 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 _0x7217=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x26945c,_0x46865c){var _0x1845f6=function(_0x23cbd8){while(--_0x23cbd8){_0x26945c['push'](_0x26945c['shift']());}};_0x1845f6(++_0x46865c);}(_0x7217,0x19e));var _0x7721=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x7217[_0x2576d7];return _0x16a08c;};'use strict';function Trigger(_0x516f0e){this['id']=_0x516f0e['id']||0x0;this['name']=_0x516f0e[_0x7721('0x0')]||'';this[_0x7721('0x1')]=_0x516f0e[_0x7721('0x1')]||_0x7721('0x2');this[_0x7721('0x3')]=_0x516f0e['status']||![];this['AllConditions']=_0x516f0e[_0x7721('0x4')]||[];this[_0x7721('0x5')]=_0x516f0e[_0x7721('0x5')]||[];this[_0x7721('0x6')]=_0x516f0e[_0x7721('0x6')]||[];}module[_0x7721('0x7')]=Trigger; \ No newline at end of file +var _0x6aa7=['voice','status','AllConditions','Actions','exports','name','channel'];(function(_0x4dc9ef,_0x493a95){var _0xf135f5=function(_0x4d3ea8){while(--_0x4d3ea8){_0x4dc9ef['push'](_0x4dc9ef['shift']());}};_0xf135f5(++_0x493a95);}(_0x6aa7,0x178));var _0x76aa=function(_0x54c332,_0x393cd1){_0x54c332=_0x54c332-0x0;var _0x39008c=_0x6aa7[_0x54c332];return _0x39008c;};'use strict';function Trigger(_0x8de1e4){this['id']=_0x8de1e4['id']||0x0;this['name']=_0x8de1e4[_0x76aa('0x0')]||'';this[_0x76aa('0x1')]=_0x8de1e4[_0x76aa('0x1')]||_0x76aa('0x2');this['status']=_0x8de1e4[_0x76aa('0x3')]||![];this[_0x76aa('0x4')]=_0x8de1e4[_0x76aa('0x4')]||[];this['AnyConditions']=_0x8de1e4['AnyConditions']||[];this[_0x76aa('0x5')]=_0x8de1e4['Actions']||[];}module[_0x76aa('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index f68d5b9..952a20c 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 _0xdafa=['domain','domainport','stateRegistry','registrationtime','address','active','name','state','unknown','stateTime','status','registry','split','host','port'];(function(_0x16b667,_0xadec02){var _0x58620e=function(_0x5db60b){while(--_0x5db60b){_0x16b667['push'](_0x16b667['shift']());}};_0x58620e(++_0xadec02);}(_0xdafa,0x113));var _0xadaf=function(_0xdd156e,_0xb43250){_0xdd156e=_0xdd156e-0x0;var _0x3426b6=_0xdafa[_0xdd156e];return _0x3426b6;};'use strict';function Trunk(_0x2c0818){this['id']=_0x2c0818['id']||0x0;this[_0xadaf('0x0')]=_0x2c0818[_0xadaf('0x0')]||![];this[_0xadaf('0x1')]=_0x2c0818['name']||'';this[_0xadaf('0x2')]=_0xadaf('0x3');this[_0xadaf('0x4')]=0x0;this[_0xadaf('0x5')]=_0xadaf('0x3');this[_0xadaf('0x6')]=_0x2c0818[_0xadaf('0x6')]&&_0x2c0818[_0xadaf('0x6')]['indexOf'](':')?_0x2c0818[_0xadaf('0x6')][_0xadaf('0x7')](':')[0x0]:'';this[_0xadaf('0x8')]='';this[_0xadaf('0x9')]='';this[_0xadaf('0xa')]='';this[_0xadaf('0xb')]='';this['refresh']='';this[_0xadaf('0xc')]=_0xadaf('0x3');this[_0xadaf('0xd')]='';this[_0xadaf('0xe')]='';}module['exports']=Trunk; \ No newline at end of file +var _0xb793=['status','registry','split','domain','domainport','stateRegistry','registrationtime','address','exports','active','name','state','unknown','stateTime'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0xb793,0x19f));var _0x3b79=function(_0x354258,_0x444eaa){_0x354258=_0x354258-0x0;var _0x366d45=_0xb793[_0x354258];return _0x366d45;};'use strict';function Trunk(_0x1e9968){this['id']=_0x1e9968['id']||0x0;this[_0x3b79('0x0')]=_0x1e9968[_0x3b79('0x0')]||![];this[_0x3b79('0x1')]=_0x1e9968['name']||'';this[_0x3b79('0x2')]=_0x3b79('0x3');this[_0x3b79('0x4')]=0x0;this[_0x3b79('0x5')]=_0x3b79('0x3');this[_0x3b79('0x6')]=_0x1e9968['registry']&&_0x1e9968[_0x3b79('0x6')]['indexOf'](':')?_0x1e9968[_0x3b79('0x6')][_0x3b79('0x7')](':')[0x0]:'';this['host']='';this['port']='';this[_0x3b79('0x8')]='';this[_0x3b79('0x9')]='';this['refresh']='';this[_0x3b79('0xa')]=_0x3b79('0x3');this[_0x3b79('0xb')]='';this[_0x3b79('0xc')]='';}module[_0x3b79('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 f907f58..f5906ca 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 _0xcad5=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x282146,_0x38df2a){var _0x4eece=function(_0x3683a8){while(--_0x3683a8){_0x282146['push'](_0x282146['shift']());}};_0x4eece(++_0x38df2a);}(_0xcad5,0x173));var _0x5cad=function(_0x50314a,_0xa4ecf8){_0x50314a=_0x50314a-0x0;var _0x295b7d=_0xcad5[_0x50314a];return _0x295b7d;};'use strict';function voiceExtension(_0x453662){this['id']=_0x453662['id']||0x0;this[_0x5cad('0x0')]=_0x453662[_0x5cad('0x0')]||'';this[_0x5cad('0x1')]=_0x453662[_0x5cad('0x1')]||_0x5cad('0x2');this[_0x5cad('0x3')]=_0x453662[_0x5cad('0x3')]||![];}module[_0x5cad('0x4')]=voiceExtension; \ No newline at end of file +var _0x06de=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0x06de,0x19b));var _0xe06d=function(_0x5c25f7,_0x3a69dc){_0x5c25f7=_0x5c25f7-0x0;var _0x1d51d1=_0x06de[_0x5c25f7];return _0x1d51d1;};'use strict';function voiceExtension(_0x2795a8){this['id']=_0x2795a8['id']||0x0;this[_0xe06d('0x0')]=_0x2795a8[_0xe06d('0x0')]||'';this[_0xe06d('0x1')]=_0x2795a8['recordingFormat']||_0xe06d('0x2');this['mandatoryDisposition']=_0x2795a8[_0xe06d('0x3')]||![];}module[_0xe06d('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 2d4b34e..68d8131 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 _0x0b6b=['outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','unavailable','ringing','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay'];(function(_0x26c0cc,_0x4630bb){var _0x5e9332=function(_0x40b0ed){while(--_0x40b0ed){_0x26c0cc['push'](_0x26c0cc['shift']());}};_0x5e9332(++_0x4630bb);}(_0x0b6b,0x188));var _0xb0b6=function(_0x467cb0,_0x303070){_0x467cb0=_0x467cb0-0x0;var _0x2153f7=_0x0b6b[_0x467cb0];return _0x2153f7;};'use strict';var statusDesc=['unknown',_0xb0b6('0x0'),_0xb0b6('0x1'),'busy','invalid',_0xb0b6('0x2'),_0xb0b6('0x3'),'ringinuse',_0xb0b6('0x4')];var monitorFormat={'wav':_0xb0b6('0x5'),'wav49':_0xb0b6('0x6'),'gsm':_0xb0b6('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xb0b6('0x8')};function VoiceQueue(_0x42a469){this['id']=_0x42a469['id']||0x0;this[_0xb0b6('0x9')]=_0x42a469[_0xb0b6('0x9')]||'';this['monitor_format']=_0x42a469[_0xb0b6('0xa')]||'';this[_0xb0b6('0xb')]=_0x42a469['type']||'inbound';this[_0xb0b6('0xc')]=0x0;this[_0xb0b6('0xd')]=0x0;this[_0xb0b6('0xe')]=0x0;this[_0xb0b6('0xf')]=0x0;this[_0xb0b6('0x10')]=0x0;this[_0xb0b6('0x11')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0xb0b6('0x12')]=0x0;this['loggedIn']=0x0;this[_0xb0b6('0x13')]=0x0;this[_0xb0b6('0x14')]=_0x42a469[_0xb0b6('0x14')]||![];this['acwTimeout']=_0x42a469[_0xb0b6('0x15')]||0xa;this[_0xb0b6('0x16')]=_0x42a469[_0xb0b6('0x16')]||'no';this[_0xb0b6('0x17')]=!![];this[_0xb0b6('0x18')]='';this[_0xb0b6('0x19')]=0x0;this[_0xb0b6('0x1a')]=0x0;this[_0xb0b6('0x1b')]=_0x42a469[_0xb0b6('0x1b')]||null;this[_0xb0b6('0x1c')]=_0x42a469['dialGlobalInterval']?_0x42a469[_0xb0b6('0x1c')]:null;this[_0xb0b6('0x1d')]=_0x42a469[_0xb0b6('0x1d')];this[_0xb0b6('0x1e')]=_0x42a469[_0xb0b6('0x1e')]||_0xb0b6('0x1f');this[_0xb0b6('0x20')]=_0x42a469[_0xb0b6('0x20')]||0x0;this[_0xb0b6('0x21')]=_0x42a469['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x42a469['dialPowerLevel']||0x1;this[_0xb0b6('0x22')]=_0x42a469[_0xb0b6('0x22')]||'dropRate';this[_0xb0b6('0x23')]=_0x42a469['dialPredictiveOptimizationPercentage']||0.03;this[_0xb0b6('0x24')]=_0x42a469['dialPredictiveInterval']||0x258;this[_0xb0b6('0x25')]=_0x42a469['dialOriginateCallerIdName']||_0xb0b6('0x26');this[_0xb0b6('0x27')]=_0x42a469[_0xb0b6('0x27')]||'anonymous';this[_0xb0b6('0x28')]=_0x42a469['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x42a469[_0xb0b6('0x29')]||_0xb0b6('0x2a');this[_0xb0b6('0x2b')]=_0x42a469[_0xb0b6('0x2b')]||0x3;this[_0xb0b6('0x2c')]=_0x42a469['dialQueueProject']||undefined;this[_0xb0b6('0x2d')]=_0x42a469[_0xb0b6('0x2d')]||0x3;this[_0xb0b6('0x2e')]=_0x42a469[_0xb0b6('0x2e')]||0x96;this[_0xb0b6('0x2f')]=_0x42a469['dialBusyMaxRetry']||0x3;this[_0xb0b6('0x30')]=_0x42a469[_0xb0b6('0x30')]||0x96;this[_0xb0b6('0x31')]=_0x42a469[_0xb0b6('0x31')]||0x3;this[_0xb0b6('0x32')]=_0x42a469[_0xb0b6('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x42a469[_0xb0b6('0x33')]||0x3;this[_0xb0b6('0x34')]=_0x42a469[_0xb0b6('0x34')]||0x96;this[_0xb0b6('0x35')]=_0x42a469[_0xb0b6('0x35')]||0x3;this[_0xb0b6('0x36')]=_0x42a469[_0xb0b6('0x36')]||0x96;this[_0xb0b6('0x37')]=_0x42a469['dialAbandonedMaxRetry']||0x3;this[_0xb0b6('0x38')]=_0x42a469[_0xb0b6('0x38')]||0x96;this[_0xb0b6('0x39')]=_0x42a469[_0xb0b6('0x39')]||0x3;this[_0xb0b6('0x3a')]=_0x42a469[_0xb0b6('0x3a')]||0x96;this['dialAgentRejectMaxRetry']=_0x42a469['dialAgentRejectMaxRetry']||0x3;this[_0xb0b6('0x3b')]=_0x42a469[_0xb0b6('0x3b')]||0x96;this[_0xb0b6('0x3c')]=_0x42a469[_0xb0b6('0x3c')]||0x4;this[_0xb0b6('0x3d')]=_0x42a469[_0xb0b6('0x3d')]?_0x42a469[_0xb0b6('0x3d')]:undefined;this[_0xb0b6('0x3e')]=_0x42a469[_0xb0b6('0x3e')]?_0x42a469[_0xb0b6('0x3e')]:undefined;this['dialPrefix']=_0x42a469[_0xb0b6('0x3f')]||undefined;this[_0xb0b6('0x40')]=_0x42a469[_0xb0b6('0x40')]?_0x42a469[_0xb0b6('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x42a469['dialOrderByScheduledAt']||_0xb0b6('0x41');this[_0xb0b6('0x42')]=_0x42a469[_0xb0b6('0x42')]||undefined;this[_0xb0b6('0x43')]=_0x42a469[_0xb0b6('0x43')]||undefined;this['strategy']=strategy[_0x42a469[_0xb0b6('0x44')]]||'rrmemory';this[_0xb0b6('0x45')]=!![];this['dialAMDActive']=_0x42a469[_0xb0b6('0x46')]||![];this['dialAMDInitialSilence']=_0x42a469[_0xb0b6('0x47')];this[_0xb0b6('0x48')]=_0x42a469[_0xb0b6('0x48')];this[_0xb0b6('0x49')]=_0x42a469[_0xb0b6('0x49')];this['dialAMDTotalAnalysisTime']=_0x42a469[_0xb0b6('0x4a')];this[_0xb0b6('0x4b')]=_0x42a469[_0xb0b6('0x4b')];this[_0xb0b6('0x4c')]=_0x42a469[_0xb0b6('0x4c')];this[_0xb0b6('0x4d')]=_0x42a469['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x42a469[_0xb0b6('0x4e')];this[_0xb0b6('0x4f')]=_0x42a469[_0xb0b6('0x4f')];this['outboundRejectCallsDay']=0x0;this[_0xb0b6('0x50')]=0x0;this[_0xb0b6('0x51')]=_0x42a469[_0xb0b6('0x51')];this[_0xb0b6('0x52')]=0x0;this[_0xb0b6('0x53')]=0x0;this[_0xb0b6('0x54')]=0x0;this[_0xb0b6('0x55')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xb0b6('0x56')]=0x0;this[_0xb0b6('0x57')]=0x0;this[_0xb0b6('0x58')]=0x0;this[_0xb0b6('0x59')]=0x0;this[_0xb0b6('0x5a')]=0x0;this[_0xb0b6('0x5b')]=0x0;this[_0xb0b6('0x5c')]=0x0;this[_0xb0b6('0x5d')]=0x0;this[_0xb0b6('0x5e')]=0x0;this[_0xb0b6('0x5f')]=undefined;this['startPredictive']=undefined;this[_0xb0b6('0x60')]=undefined;this[_0xb0b6('0x61')]=1.05;this[_0xb0b6('0x62')]=0x0;this[_0xb0b6('0x63')]=0x0;this[_0xb0b6('0x64')]=0x0;this[_0xb0b6('0x65')]=0x0;this[_0xb0b6('0x66')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xb0b6('0x67')]=0x0;this[_0xb0b6('0x68')]=0x0;this[_0xb0b6('0x69')]=_0x42a469['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xb0b6('0x6a')]=_0x42a469[_0xb0b6('0x6b')]||0xa;this[_0xb0b6('0x6c')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xb0b6('0x6d')]=0x0;this[_0xb0b6('0x6e')]=0x0;this[_0xb0b6('0x6f')]=0x0;this['erlangBusyFactor']=0x0;this[_0xb0b6('0x70')]=_0x42a469[_0xb0b6('0x70')]||0x1e;this[_0xb0b6('0x71')]=_0x42a469[_0xb0b6('0x71')]||![];this[_0xb0b6('0x72')]=_0x42a469[_0xb0b6('0x72')]||undefined;this[_0xb0b6('0x73')]=_0x42a469[_0xb0b6('0x73')]||![];this[_0xb0b6('0x74')]=_0x42a469[_0xb0b6('0x74')]||![];this['monitor_format']=monitorFormat[_0x42a469['monitor_format']]?monitorFormat[_0x42a469['monitor_format']]:undefined;this[_0xb0b6('0x75')]=_0x42a469['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x42a469[_0xb0b6('0x76')]?_0x42a469['mandatoryDispositionPause']:undefined;}module[_0xb0b6('0x77')]=VoiceQueue; \ No newline at end of file +var _0x0b40=['outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDispositionPause','unknown','not_inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','inbound','talking','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS'];(function(_0x5407b4,_0x44f79c){var _0x1c34e9=function(_0x4826a9){while(--_0x4826a9){_0x5407b4['push'](_0x5407b4['shift']());}};_0x1c34e9(++_0x44f79c);}(_0x0b40,0x82));var _0x00b4=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0x0b40[_0x40822a];return _0x357420;};'use strict';var statusDesc=[_0x00b4('0x0'),_0x00b4('0x1'),'inuse','busy',_0x00b4('0x2'),_0x00b4('0x3'),_0x00b4('0x4'),_0x00b4('0x5'),_0x00b4('0x6')];var monitorFormat={'wav':_0x00b4('0x7'),'wav49':_0x00b4('0x8'),'gsm':_0x00b4('0x9')};var strategy={'rrmemory':_0x00b4('0xa'),'roundrobin':_0x00b4('0xb')};function VoiceQueue(_0x573e0b){this['id']=_0x573e0b['id']||0x0;this[_0x00b4('0xc')]=_0x573e0b['name']||'';this[_0x00b4('0xd')]=_0x573e0b[_0x00b4('0xd')]||'';this['type']=_0x573e0b['type']||_0x00b4('0xe');this['waiting']=0x0;this[_0x00b4('0xf')]=0x0;this['total']=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x00b4('0x10')]=0x0;this[_0x00b4('0x11')]=0x0;this['unmanaged']=0x0;this[_0x00b4('0x12')]=0x0;this[_0x00b4('0x13')]=0x0;this[_0x00b4('0x14')]=0x0;this[_0x00b4('0x15')]=_0x573e0b['acw']||![];this[_0x00b4('0x16')]=_0x573e0b[_0x00b4('0x16')]||0xa;this['autopause']=_0x573e0b[_0x00b4('0x17')]||'no';this[_0x00b4('0x18')]=!![];this['message']='';this[_0x00b4('0x19')]=0x0;this[_0x00b4('0x1a')]=0x0;this['dialTimezone']=_0x573e0b[_0x00b4('0x1b')]||null;this['dialGlobalInterval']=_0x573e0b[_0x00b4('0x1c')]?_0x573e0b['dialGlobalInterval']:null;this[_0x00b4('0x1d')]=_0x573e0b[_0x00b4('0x1d')];this['dialMethod']=_0x573e0b[_0x00b4('0x1e')]||_0x00b4('0x1f');this['dialLimitChannel']=_0x573e0b[_0x00b4('0x20')]||0x0;this['dialLimitQueue']=_0x573e0b['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x573e0b[_0x00b4('0x21')]||0x1;this[_0x00b4('0x22')]=_0x573e0b[_0x00b4('0x22')]||_0x00b4('0x23');this[_0x00b4('0x24')]=_0x573e0b[_0x00b4('0x24')]||0.03;this[_0x00b4('0x25')]=_0x573e0b[_0x00b4('0x25')]||0x258;this[_0x00b4('0x26')]=_0x573e0b[_0x00b4('0x26')]||_0x00b4('0x27');this['dialOriginateCallerIdNumber']=_0x573e0b['dialOriginateCallerIdNumber']||_0x00b4('0x27');this[_0x00b4('0x28')]=_0x573e0b[_0x00b4('0x28')]||0x1e;this[_0x00b4('0x29')]=_0x573e0b[_0x00b4('0x29')]||_0x00b4('0x2a');this[_0x00b4('0x2b')]=_0x573e0b[_0x00b4('0x2b')]||0x3;this['dialQueueProject']=_0x573e0b['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x573e0b['dialCongestionMaxRetry']||0x3;this[_0x00b4('0x2c')]=_0x573e0b[_0x00b4('0x2c')]||0x96;this['dialBusyMaxRetry']=_0x573e0b[_0x00b4('0x2d')]||0x3;this[_0x00b4('0x2e')]=_0x573e0b['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x573e0b[_0x00b4('0x2f')]||0x3;this[_0x00b4('0x30')]=_0x573e0b[_0x00b4('0x30')]||0x96;this[_0x00b4('0x31')]=_0x573e0b['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x573e0b['dialNoSuchNumberRetryFrequency']||0x96;this[_0x00b4('0x32')]=_0x573e0b['dialDropMaxRetry']||0x3;this[_0x00b4('0x33')]=_0x573e0b['dialDropRetryFrequency']||0x96;this[_0x00b4('0x34')]=_0x573e0b[_0x00b4('0x34')]||0x3;this[_0x00b4('0x35')]=_0x573e0b[_0x00b4('0x35')]||0x96;this[_0x00b4('0x36')]=_0x573e0b['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x573e0b[_0x00b4('0x37')]||0x96;this[_0x00b4('0x38')]=_0x573e0b[_0x00b4('0x38')]||0x3;this['dialAgentRejectRetryFrequency']=_0x573e0b[_0x00b4('0x39')]||0x96;this['dialGlobalMaxRetry']=_0x573e0b[_0x00b4('0x3a')]||0x4;this[_0x00b4('0x3b')]=_0x573e0b[_0x00b4('0x3b')]?_0x573e0b[_0x00b4('0x3b')]:undefined;this[_0x00b4('0x3c')]=_0x573e0b[_0x00b4('0x3c')]?_0x573e0b[_0x00b4('0x3c')]:undefined;this[_0x00b4('0x3d')]=_0x573e0b[_0x00b4('0x3d')]||undefined;this[_0x00b4('0x3e')]=_0x573e0b[_0x00b4('0x3e')]?_0x573e0b[_0x00b4('0x3e')]:undefined;this[_0x00b4('0x3f')]=_0x573e0b[_0x00b4('0x3f')]||_0x00b4('0x40');this['dialRandomLastDigitCallerIdNumber']=_0x573e0b['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x00b4('0x41')]=_0x573e0b[_0x00b4('0x41')]||undefined;this[_0x00b4('0x42')]=strategy[_0x573e0b[_0x00b4('0x42')]]||_0x00b4('0xa');this['queueStatusComplete']=!![];this[_0x00b4('0x43')]=_0x573e0b[_0x00b4('0x43')]||![];this[_0x00b4('0x44')]=_0x573e0b[_0x00b4('0x44')];this[_0x00b4('0x45')]=_0x573e0b[_0x00b4('0x45')];this[_0x00b4('0x46')]=_0x573e0b[_0x00b4('0x46')];this[_0x00b4('0x47')]=_0x573e0b[_0x00b4('0x47')];this['dialAMDMinWordLength']=_0x573e0b[_0x00b4('0x48')];this[_0x00b4('0x49')]=_0x573e0b[_0x00b4('0x49')];this[_0x00b4('0x4a')]=_0x573e0b[_0x00b4('0x4a')];this[_0x00b4('0x4b')]=_0x573e0b[_0x00b4('0x4b')];this[_0x00b4('0x4c')]=_0x573e0b['dialAMDMaximumWordLength'];this[_0x00b4('0x4d')]=0x0;this[_0x00b4('0x4e')]=0x0;this[_0x00b4('0x4f')]=_0x573e0b[_0x00b4('0x4f')];this['outboundAnswerCallsDay']=0x0;this[_0x00b4('0x50')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x00b4('0x51')]=0x0;this[_0x00b4('0x52')]=0x0;this[_0x00b4('0x53')]=0x0;this[_0x00b4('0x54')]=0x0;this[_0x00b4('0x55')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x00b4('0x56')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x00b4('0x57')]=0x0;this[_0x00b4('0x58')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x00b4('0x59')]=undefined;this[_0x00b4('0x5a')]=undefined;this[_0x00b4('0x5b')]=undefined;this[_0x00b4('0x5c')]=1.05;this[_0x00b4('0x5d')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x00b4('0x5e')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x00b4('0x5f')]=0x0;this[_0x00b4('0x60')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x573e0b[_0x00b4('0x61')]||0x14;this[_0x00b4('0x62')]=_0x573e0b[_0x00b4('0x61')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x00b4('0x63')]=0x0;this[_0x00b4('0x64')]=0x1;this['erlangCalls']=0x0;this[_0x00b4('0x65')]=0x0;this[_0x00b4('0x66')]=0x0;this[_0x00b4('0x67')]=0x0;this[_0x00b4('0x68')]=_0x573e0b[_0x00b4('0x68')]||0x1e;this[_0x00b4('0x69')]=_0x573e0b[_0x00b4('0x69')]||![];this['dialQueueProject2']=_0x573e0b[_0x00b4('0x6a')]||undefined;this['dialAgiAfterHangupClient']=_0x573e0b['dialAgiAfterHangupClient']||![];this[_0x00b4('0x6b')]=_0x573e0b[_0x00b4('0x6b')]||![];this[_0x00b4('0xd')]=monitorFormat[_0x573e0b[_0x00b4('0xd')]]?monitorFormat[_0x573e0b[_0x00b4('0xd')]]:undefined;this['mandatoryDisposition']=_0x573e0b['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x573e0b['mandatoryDispositionPause']?_0x573e0b[_0x00b4('0x6c')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 5eec3ac..d2523f6 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 _0x3de0=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x50a2bd,_0xbf1971){var _0x3b08f5=function(_0x140ea6){while(--_0x140ea6){_0x50a2bd['push'](_0x50a2bd['shift']());}};_0x3b08f5(++_0xbf1971);}(_0x3de0,0x1ef));var _0x03de=function(_0x33805b,_0x3a256b){_0x33805b=_0x33805b-0x0;var _0x500d01=_0x3de0[_0x33805b];return _0x500d01;};'use strict';function VtigerAccount(_0x17845e){this['id']=_0x17845e['id']||0x0;this[_0x03de('0x0')]=_0x17845e[_0x03de('0x0')]||'';this[_0x03de('0x1')]=_0x17845e[_0x03de('0x1')]||'';this[_0x03de('0x2')]=_0x17845e['accessKey']||'';this[_0x03de('0x3')]=_0x17845e[_0x03de('0x3')]||'';this['serverUrl']=_0x17845e[_0x03de('0x4')]||'';this[_0x03de('0x5')]=_0x17845e[_0x03de('0x5')]||{};}module[_0x03de('0x6')]=VtigerAccount; \ No newline at end of file +var _0xe038=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0x38ae0b,_0x53bb60){var _0x25e5f4=function(_0x53b330){while(--_0x53b330){_0x38ae0b['push'](_0x38ae0b['shift']());}};_0x25e5f4(++_0x53bb60);}(_0xe038,0x1b9));var _0x8e03=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xe038[_0x26462c];return _0x509a42;};'use strict';function VtigerAccount(_0x414265){this['id']=_0x414265['id']||0x0;this[_0x8e03('0x0')]=_0x414265[_0x8e03('0x0')]||'';this['username']=_0x414265[_0x8e03('0x1')]||'';this['accessKey']=_0x414265[_0x8e03('0x2')]||'';this[_0x8e03('0x3')]=_0x414265['remoteUri']||'';this['serverUrl']=_0x414265[_0x8e03('0x4')]||'';this['Configurations']=_0x414265[_0x8e03('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e026951..e0e2657 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x99b8f0,_0x6c6efd){var _0x18e939=function(_0x34f44a){while(--_0x34f44a){_0x99b8f0['push'](_0x99b8f0['shift']());}};_0x18e939(++_0x6c6efd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0x0b0e,0x187));var _0xe0b0=function(_0x48a836,_0xa1d010){_0x48a836=_0x48a836-0x0;var _0x249dc8=_0x0b0e[_0x48a836];return _0x249dc8;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index ca3160b..8ba64fc 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 _0xae1b=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x347cb4,_0x3d335a){var _0x5a1236=function(_0x3f5b25){while(--_0x3f5b25){_0x347cb4['push'](_0x347cb4['shift']());}};_0x5a1236(++_0x3d335a);}(_0xae1b,0x96));var _0xbae1=function(_0x56dda8,_0x19b495){_0x56dda8=_0x56dda8-0x0;var _0x39aa50=_0xae1b[_0x56dda8];return _0x39aa50;};'use strict';function ZohoAccount(_0x4b0f62){this['id']=_0x4b0f62['id']||0x0;this[_0xbae1('0x0')]=_0x4b0f62['name']||'';this[_0xbae1('0x1')]=_0x4b0f62[_0xbae1('0x1')]||'';this[_0xbae1('0x2')]=_0x4b0f62[_0xbae1('0x2')]||'';this[_0xbae1('0x3')]=_0x4b0f62[_0xbae1('0x3')]||'';this['clientId']=_0x4b0f62[_0xbae1('0x4')]||'';this[_0xbae1('0x5')]=_0x4b0f62['clientSecret']||'';this[_0xbae1('0x6')]=_0x4b0f62['serverUrl']||'';this[_0xbae1('0x7')]=_0x4b0f62['code']||'';this[_0xbae1('0x8')]=_0x4b0f62[_0xbae1('0x8')]||'';this['Configurations']=_0x4b0f62[_0xbae1('0x9')]||{};}module[_0xbae1('0xa')]=ZohoAccount; \ No newline at end of file +var _0x4849=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','host'];(function(_0x4251c,_0x2a5f82){var _0x4787d6=function(_0x27ea91){while(--_0x27ea91){_0x4251c['push'](_0x4251c['shift']());}};_0x4787d6(++_0x2a5f82);}(_0x4849,0xf8));var _0x9484=function(_0xafd08,_0x55b3fe){_0xafd08=_0xafd08-0x0;var _0xdc2744=_0x4849[_0xafd08];return _0xdc2744;};'use strict';function ZohoAccount(_0x5a8940){this['id']=_0x5a8940['id']||0x0;this[_0x9484('0x0')]=_0x5a8940[_0x9484('0x0')]||'';this['description']=_0x5a8940['description']||'';this[_0x9484('0x1')]=_0x5a8940[_0x9484('0x1')]||'';this[_0x9484('0x2')]=_0x5a8940[_0x9484('0x2')]||'';this[_0x9484('0x3')]=_0x5a8940[_0x9484('0x3')]||'';this[_0x9484('0x4')]=_0x5a8940[_0x9484('0x4')]||'';this[_0x9484('0x5')]=_0x5a8940['serverUrl']||'';this['code']=_0x5a8940[_0x9484('0x6')]||'';this['refreshToken']=_0x5a8940[_0x9484('0x7')]||'';this[_0x9484('0x8')]=_0x5a8940[_0x9484('0x8')]||{};}module[_0x9484('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 4458c8c..9888aac 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 _0xa652=['isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','calleridname','exports','util','lodash','moment'];(function(_0x27b4c7,_0xd847e6){var _0x3000b9=function(_0x57ef4b){while(--_0x57ef4b){_0x27b4c7['push'](_0x27b4c7['shift']());}};_0x3000b9(++_0xd847e6);}(_0xa652,0x138));var _0x2a65=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa652[_0x297fd3];return _0x2af381;};'use strict';var util=require(_0x2a65('0x0'));var _=require(_0x2a65('0x1'));var moment=require(_0x2a65('0x2'));function checkNameSurname(_0x3e6f23,_0x3c073f,_0x4953ba){var _0x12dfab='';if(!_[_0x2a65('0x3')](_0x3c073f)&&'string'===typeof _0x3c073f){_0x12dfab+=_0x3c073f;}if(!_['isNil'](_0x4953ba)&&_0x2a65('0x4')===typeof _0x4953ba){_0x12dfab+='\x20'+_0x4953ba;}if(_0x12dfab!==''){return _0x12dfab;}return _0x3e6f23;}function Action(_0xb30dd3,_0x5528d,_0x2f73ba,_0x4be68f,_0x975aa4){this[_0x2a65('0x5')]=_0x2f73ba||undefined;this[_0x2a65('0x6')]=_0xb30dd3['id'];this[_0x2a65('0x7')]=_0x5528d[_0x2a65('0x8')];this[_0x2a65('0x9')]=_0x5528d[_0x2a65('0x9')];this[_0x2a65('0xa')]=_0x2a65('0x7');this['dialAnswer']=![];this[_0x2a65('0xb')]=_[_0x2a65('0x3')](_0xb30dd3[_0x2a65('0xc')])?undefined:_0xb30dd3[_0x2a65('0xc')][_0x2a65('0x8')];this[_0x2a65('0xd')]=this[_0x2a65('0xb')]?util[_0x2a65('0xe')](_0x2a65('0xf'),this['membername']):_0x4be68f||undefined;this['calleridname']=checkNameSurname(_0xb30dd3[_0x2a65('0x10')][_0x2a65('0x11')],_0xb30dd3['Contact'][_0x2a65('0x12')],_0xb30dd3['Contact'][_0x2a65('0x13')]);this[_0x2a65('0x14')]=_0xb30dd3['active']||![];this[_0x2a65('0x15')]=_0xb30dd3[_0x2a65('0x10')][_0x2a65('0x11')];this[_0x2a65('0x16')]=_0xb30dd3['scheduledat'];this[_0x2a65('0x17')]=_0xb30dd3[_0x2a65('0x17')]||0x0;this['countcongestionretry']=_0xb30dd3[_0x2a65('0x18')]||0x0;this[_0x2a65('0x19')]=_0xb30dd3['countnoanswerretry']||0x0;this[_0x2a65('0x1a')]=(_0xb30dd3['countbusyretry']||0x0)+(_0xb30dd3[_0x2a65('0x18')]||0x0)+(_0xb30dd3['countnoanswerretry']||0x0)+(_0xb30dd3[_0x2a65('0x1b')]||0x0)+(_0xb30dd3['countdropretry']||0x0)+(_0xb30dd3[_0x2a65('0x1c')]||0x0)+(_0xb30dd3[_0x2a65('0x1d')]||0x0)+(_0xb30dd3[_0x2a65('0x1e')]||0x0);this[_0x2a65('0x1b')]=_0xb30dd3[_0x2a65('0x1b')]||0x0;this[_0x2a65('0x1f')]=_0xb30dd3[_0x2a65('0x1f')]||0x0;this['countabandonedretry']=_0xb30dd3[_0x2a65('0x1c')]||0x0;this[_0x2a65('0x1d')]=_0xb30dd3[_0x2a65('0x1d')]||0x0;this['countagentrejectretry']=_0xb30dd3[_0x2a65('0x1e')]||0x0;this[_0x2a65('0x20')]=_0xb30dd3['callback'];this[_0x2a65('0x21')]=_0xb30dd3[_0x2a65('0x21')];this['callbackat']=_0xb30dd3['callbackat'];this[_0x2a65('0x22')]=_0xb30dd3[_0x2a65('0x22')];this['ContactId']=_0xb30dd3[_0x2a65('0x23')];this[_0x2a65('0x24')]=_0xb30dd3['ListId'];this[_0x2a65('0x25')]=_[_0x2a65('0x3')](_0xb30dd3['Agent'])?_0xb30dd3[_0x2a65('0x25')]:_0xb30dd3['Agent']['id'];this[_0x2a65('0x26')]=_0xb30dd3[_0x2a65('0x26')];this[_0x2a65('0x27')]='';this[_0x2a65('0x28')]='';}Action['prototype'][_0x2a65('0x29')]=function(){return util[_0x2a65('0xe')](_0x2a65('0x2a'),this[_0x2a65('0x2b')],this['number']);};module[_0x2a65('0x2c')]=Action; \ No newline at end of file +var _0x6207=['ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','util','lodash','moment','isNil','idContact','queue','name','type','campaigntype','dialAnswer','Agent','format','SIP/%s','calleridname','Contact','active','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6207,0x110));var _0x7620=function(_0x1a317e,_0x1dacc7){_0x1a317e=_0x1a317e-0x0;var _0x280cbd=_0x6207[_0x1a317e];return _0x280cbd;};'use strict';var util=require(_0x7620('0x0'));var _=require(_0x7620('0x1'));var moment=require(_0x7620('0x2'));function checkNameSurname(_0x163533,_0x6e76ed,_0x3f9f06){var _0x8faa9b='';if(!_[_0x7620('0x3')](_0x6e76ed)&&'string'===typeof _0x6e76ed){_0x8faa9b+=_0x6e76ed;}if(!_[_0x7620('0x3')](_0x3f9f06)&&'string'===typeof _0x3f9f06){_0x8faa9b+='\x20'+_0x3f9f06;}if(_0x8faa9b!==''){return _0x8faa9b;}return _0x163533;}function Action(_0x1e40ee,_0x1432b2,_0x530788,_0x2d8f9e,_0x576d4f){this['uniqueid']=_0x530788||undefined;this[_0x7620('0x4')]=_0x1e40ee['id'];this[_0x7620('0x5')]=_0x1432b2[_0x7620('0x6')];this[_0x7620('0x7')]=_0x1432b2[_0x7620('0x7')];this[_0x7620('0x8')]=_0x7620('0x5');this[_0x7620('0x9')]=![];this['membername']=_['isNil'](_0x1e40ee[_0x7620('0xa')])?undefined:_0x1e40ee[_0x7620('0xa')]['name'];this['channelAgent']=this['membername']?util[_0x7620('0xb')](_0x7620('0xc'),this['membername']):_0x2d8f9e||undefined;this[_0x7620('0xd')]=checkNameSurname(_0x1e40ee[_0x7620('0xe')]['phone'],_0x1e40ee['Contact']['firstName'],_0x1e40ee[_0x7620('0xe')]['lastName']);this['active']=_0x1e40ee[_0x7620('0xf')]||![];this['calleridnum']=_0x1e40ee[_0x7620('0xe')][_0x7620('0x10')];this[_0x7620('0x11')]=_0x1e40ee[_0x7620('0x11')];this[_0x7620('0x12')]=_0x1e40ee[_0x7620('0x12')]||0x0;this[_0x7620('0x13')]=_0x1e40ee[_0x7620('0x13')]||0x0;this[_0x7620('0x14')]=_0x1e40ee[_0x7620('0x14')]||0x0;this[_0x7620('0x15')]=(_0x1e40ee[_0x7620('0x12')]||0x0)+(_0x1e40ee[_0x7620('0x13')]||0x0)+(_0x1e40ee[_0x7620('0x14')]||0x0)+(_0x1e40ee[_0x7620('0x16')]||0x0)+(_0x1e40ee[_0x7620('0x17')]||0x0)+(_0x1e40ee[_0x7620('0x18')]||0x0)+(_0x1e40ee[_0x7620('0x19')]||0x0)+(_0x1e40ee[_0x7620('0x1a')]||0x0);this[_0x7620('0x16')]=_0x1e40ee['countnosuchnumberretry']||0x0;this[_0x7620('0x17')]=_0x1e40ee[_0x7620('0x17')]||0x0;this['countabandonedretry']=_0x1e40ee[_0x7620('0x18')]||0x0;this[_0x7620('0x19')]=_0x1e40ee[_0x7620('0x19')]||0x0;this[_0x7620('0x1a')]=_0x1e40ee[_0x7620('0x1a')]||0x0;this[_0x7620('0x1b')]=_0x1e40ee[_0x7620('0x1b')];this[_0x7620('0x1c')]=_0x1e40ee['callbackuniqueid'];this['callbackat']=_0x1e40ee[_0x7620('0x1d')];this[_0x7620('0x1e')]=_0x1e40ee['recallme'];this[_0x7620('0x1f')]=_0x1e40ee[_0x7620('0x1f')];this[_0x7620('0x20')]=_0x1e40ee['ListId'];this[_0x7620('0x21')]=_['isNil'](_0x1e40ee[_0x7620('0xa')])?_0x1e40ee[_0x7620('0x21')]:_0x1e40ee[_0x7620('0xa')]['id'];this[_0x7620('0x22')]=_0x1e40ee[_0x7620('0x22')];this['originatecalleridnum']='';this[_0x7620('0x23')]='';}Action[_0x7620('0x24')][_0x7620('0x25')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['calleridname'],this['number']);};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 2267fce..e4c5766 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 _0xa9e0=['sumBillable','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','Interval','stringify','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','outbound','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','loggerError','clearZombieChannels','size','getContactRecallMe','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','buildObj','connect','custom:agentConnectPreview','buildAcw','complete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent]','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','format','reachable','unmonitored','run','execRun','unlock','unlockContact','disableContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','Contact','substring','trim','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','[originated][increment]','\x20Queue','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','callProgressDetectingAgent','[syncHangup][talking][transfer]','syncHangupRequest','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','available','pTalking'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var ami=require('../ami');var rpcDb=require(_0x0a9e('0x8'));var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));config['redis']=_['defaults'](config[_0x0a9e('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xb')]));var Sequence=function(){};Sequence[_0x0a9e('0xc')][_0x0a9e('0xd')]=function(_0x3ab53f){this[_0x0a9e('0xe')]=this[_0x0a9e('0xe')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0xf')]=_0x527cdd[_0x0a9e('0x10')];this[_0x0a9e('0x11')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]={};this[_0x0a9e('0x13')]=_0x527cdd['agents'];this[_0x0a9e('0x14')]=0x0;ami['on'](_0x0a9e('0x15'),this[_0x0a9e('0x16')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x18'),this[_0x0a9e('0x19')]['bind'](this));ami['on'](_0x0a9e('0x1a'),this['syncHangupRequest'][_0x0a9e('0x17')](this));ami['on']('dialend',this[_0x0a9e('0x1b')][_0x0a9e('0x17')](this));ami['on']('newexten',this[_0x0a9e('0x1c')]['bind'](this));ami['on'](_0x0a9e('0x1d'),this[_0x0a9e('0x1e')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x1f'),this[_0x0a9e('0x20')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x21'),this[_0x0a9e('0x22')][_0x0a9e('0x17')](this));this[_0x0a9e('0x23')](this[_0x0a9e('0xf')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x24')](_0x4bb1e3,_0x2c3407);}function emitCampaignPreview(_0x53682f){if(_0x53682f[_0x0a9e('0x25')]==='outbound'){var _0x588269={'id':_0x53682f['id'],'name':_0x53682f[_0x0a9e('0x26')],'strategy':_0x53682f[_0x0a9e('0x27')],'answered':_0x53682f[_0x0a9e('0x28')],'available':_0x53682f[_0x0a9e('0x29')],'loggedIn':_0x53682f['loggedIn'],'pTalking':_0x53682f[_0x0a9e('0x2a')],'sumBillable':_0x53682f[_0x0a9e('0x2b')],'sumDuration':_0x53682f[_0x0a9e('0x2c')],'sumHoldTime':_0x53682f[_0x0a9e('0x2d')]||0x0,'talking':_0x53682f[_0x0a9e('0x2e')],'total':_0x53682f[_0x0a9e('0x2f')],'type':_0x53682f[_0x0a9e('0x25')],'unmanaged':_0x53682f['unmanaged'],'abandoned':_0x53682f['abandoned'],'waiting':_0x53682f[_0x0a9e('0x30')],'loggedInDb':_0x53682f[_0x0a9e('0x31')],'dialActive':_0x53682f[_0x0a9e('0x32')],'dialMethod':_0x53682f[_0x0a9e('0x33')],'dialOriginateCallerIdName':_0x53682f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x53682f[_0x0a9e('0x34')],'dialOriginateTimeout':_0x53682f['dialOriginateTimeout'],'dialPrefix':_0x53682f[_0x0a9e('0x35')],'outboundAnswerAgiCallsDay':_0x53682f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x53682f[_0x0a9e('0x36')],'outboundBlacklistCallsDay':_0x53682f[_0x0a9e('0x37')],'outboundBusyCallsDay':_0x53682f[_0x0a9e('0x38')],'outboundCongestionCallsDay':_0x53682f[_0x0a9e('0x39')],'outboundDropCallsDayACS':_0x53682f[_0x0a9e('0x3a')],'outboundDropCallsDayCallersExit':_0x53682f[_0x0a9e('0x3b')],'outboundDropCallsDayTimeout':_0x53682f[_0x0a9e('0x3c')],'outboundNoAnswerCallsDay':_0x53682f[_0x0a9e('0x3d')],'outboundNoSuchCallsDay':_0x53682f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x53682f[_0x0a9e('0x3e')],'outboundReCallsDay':_0x53682f[_0x0a9e('0x3f')],'outboundRejectCallsDay':_0x53682f[_0x0a9e('0x40')],'outboundUnknownCallsDay':_0x53682f[_0x0a9e('0x41')],'outboundAbandonedCallsDay':_0x53682f['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x53682f[_0x0a9e('0x42')],'predictiveIntervalAvgHoldtime':_0x53682f[_0x0a9e('0x43')],'predictiveIntervalAvgTalktime':_0x53682f[_0x0a9e('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x53682f[_0x0a9e('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x53682f[_0x0a9e('0x46')],'predictiveIntervalErlangCalls':_0x53682f[_0x0a9e('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x53682f[_0x0a9e('0x48')],'predictiveIntervalHitRate':_0x53682f[_0x0a9e('0x49')],'predictiveIntervalMultiplicativeFactor':_0x53682f[_0x0a9e('0x4a')],'predictiveIntervalPauses':_0x53682f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x53682f[_0x0a9e('0x4b')],'predictiveIntervalTotalCalls':_0x53682f['predictiveIntervalTotalCalls'],'message':_0x53682f[_0x0a9e('0x4c')],'originated':_0x53682f[_0x0a9e('0x4d')],'erlangCalls':_0x53682f[_0x0a9e('0x4e')],'erlangCallToSecond':_0x53682f[_0x0a9e('0x4f')],'erlangAbandonmentRate':_0x53682f[_0x0a9e('0x50')],'erlangBusyFactor':_0x53682f['erlangBusyFactor'],'startPredictive':_0x53682f[_0x0a9e('0x51')],'startProgressive':_0x53682f[_0x0a9e('0x52')]};if(_0x53682f[_0x0a9e('0x53')]){_0x588269[_0x0a9e('0x53')]={'id':_0x53682f[_0x0a9e('0x53')]['id'],'name':_0x53682f[_0x0a9e('0x53')][_0x0a9e('0x26')],'active':_0x53682f[_0x0a9e('0x53')]['active'],'callerid':_0x53682f[_0x0a9e('0x53')]['callerid']};}if(_0x53682f[_0x0a9e('0x54')]){_0x588269[_0x0a9e('0x54')]={'id':_0x53682f[_0x0a9e('0x54')]['id'],'name':_0x53682f[_0x0a9e('0x54')]['name']};}var _0x191e91=md5(JSON[_0x0a9e('0x55')](_0x588269));if(_0x53682f[_0x0a9e('0x3')]!==_0x191e91){_0x53682f[_0x0a9e('0x3')]=_0x191e91;emit(util['format']('voice:queue:%s',_0x588269[_0x0a9e('0x26')]),'voice_queue:save',_0x588269);}}}function emitVoiceQueueChannelRemove(_0x24936a){logger[_0x0a9e('0x56')](_0x0a9e('0x57'),JSON[_0x0a9e('0x55')](_0x24936a));emit(util['format'](_0x0a9e('0x58'),_0x24936a[_0x0a9e('0x26')]),_0x0a9e('0x59'),_0x24936a);}function notSendMessagesQueue(_0x533942){if(_0x533942[_0x0a9e('0x5a')]){if(_0x533942[_0x0a9e('0x4d')]===0x0&&_0x533942[_0x0a9e('0x2a')]===0x0){_0x533942['sendMessageOneNotActive']=![];_0x533942['available']=0x0;_0x533942[_0x0a9e('0x5b')]=0x0;_0x533942[_0x0a9e('0x4c')]='NOT_ACTIVE';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942[_0x0a9e('0x26')]+_0x0a9e('0x5e'));}else{_0x533942['message']='IS_DISACTIVED';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942['name']+_0x0a9e('0x5f'));}emitCampaignPreview(_0x533942);}}Preview[_0x0a9e('0xc')][_0x0a9e('0x23')]=function(){var _0x5b4f5e=this;setInterval(function(){_0x5b4f5e[_0x0a9e('0x60')]();},0x7cf);};Preview[_0x0a9e('0xc')][_0x0a9e('0x60')]=function(){var _0x43dd5b=this[_0x0a9e('0xf')];this[_0x0a9e('0x14')]+=0x1;for(var _0x2881b3 in _0x43dd5b){if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&(_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')||_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x62'))&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(this[_0x0a9e('0x14')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(_0x43dd5b[_0x2881b3][_0x0a9e('0x32')]){this[_0x0a9e('0x64')](_0x43dd5b[_0x2881b3]);this[_0x0a9e('0x65')](_0x43dd5b[_0x2881b3]);}else{notSendMessagesQueue(_0x43dd5b[_0x2881b3]);}}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x66')]=function(_0x2c2cb0){var _0x35ed4a=this;this['sequence'][_0x0a9e('0xd')](function(){if(!_[_0x0a9e('0x67')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0])){loggerAction[_0x0a9e('0x56')](_0x0a9e('0x68'),_0x2c2cb0,_0x0a9e('0x69'),_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')],'originated:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a['campaignsPreview'][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x4d')]),'pTalking:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x2a')]),JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['dialAnswer']),JSON[_0x0a9e('0x55')](_[_0x0a9e('0x6b')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0],[_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),_0x0a9e('0x6f')])));return ami[_0x0a9e('0x70')]({'action':_0x0a9e('0x71'),'channel':_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x72')]})[_0x0a9e('0x73')](function(_0x4f7240){if(_0x4f7240['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]){ut[_0x0a9e('0x74')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x76')]===!![]){ut['decrementTalkink'](_0x35ed4a['campaignsPreview'][_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));ut[_0x0a9e('0x77')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['queue']);delete _0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0];}},0x2328);}});}});};Preview['prototype'][_0x0a9e('0x78')]=function(){var _0x3c20b2=this;loggerAction[_0x0a9e('0x56')]('[action]',_[_0x0a9e('0x79')](this[_0x0a9e('0x12')]));for(var _0x508b47 in this['actions']){if(_0x3c20b2[_0x0a9e('0x12')][_0x0a9e('0x61')](_0x508b47)){_0x3c20b2['clearZombieChannel'](_0x508b47);}}};Preview[_0x0a9e('0xc')]['recallMe']=function(_0x211ef9){var _0x523cd2=this;rpcDb[_0x0a9e('0x7a')](_0x211ef9['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x2da03c){if(!_['isNil'](_0x2da03c)){for(var _0x2f7092=0x0;_0x2f7092<_0x2da03c[_0x0a9e('0x7b')];_0x2f7092+=0x1){if(ut[_0x0a9e('0x7c')](_0x2da03c[_0x2f7092][_0x0a9e('0x7d')])<_0x211ef9[_0x0a9e('0x7e')]*0x3c){if(_0x2da03c[_0x2f7092][_0x0a9e('0x7f')]&&!_0x2da03c[_0x2f7092][_0x0a9e('0x7f')][_0x0a9e('0x80')]){_0x523cd2['run'](_0x2da03c[_0x2f7092]['id'])[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')))[_0x0a9e('0x73')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')));}else{rpcDb['disableContact'](_0x2da03c[_0x2f7092]['id']);}}else{var _0x956fbe=new Action(_0x2da03c[_0x2f7092],_0x211ef9);_0x956fbe[_0x0a9e('0x84')]=moment()['format'](_0x0a9e('0x85'));_0x211ef9['outboundReCallsDay']+=0x1;ut[_0x0a9e('0x86')](_0x956fbe,0x17,'RecallInQueue');if(_0x211ef9['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x0a9e('0x87')](_0x2da03c[_0x2f7092]));rpcDb['createCustomerHistory'](_0x956fbe,_0x0a9e('0x88'));}else{ut[_0x0a9e('0x86')](_0x956fbe,0x16,_0x0a9e('0x89'));rpcDb[_0x0a9e('0x8a')](_0x956fbe,_0x0a9e('0x8b'));rpcDb[_0x0a9e('0x8c')](_0x956fbe,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x73')](ut['logger2'](_0x0a9e('0x8d')));};Preview[_0x0a9e('0xc')][_0x0a9e('0x64')]=function(_0x5adf8f){_0x5adf8f[_0x0a9e('0x5a')]=!![];if(ut[_0x0a9e('0x8e')](_0x5adf8f[_0x0a9e('0x8f')])){_0x5adf8f[_0x0a9e('0x4c')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x0a9e('0x90')](_0x5adf8f[_0x0a9e('0x32')])){_0x5adf8f['message']=_0x0a9e('0x91');}else if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x53')])){if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x93')])){_0x5adf8f['message']=_0x0a9e('0x94');}else{_0x5adf8f[_0x0a9e('0x4c')]=_0x0a9e('0x95');}}else{_0x5adf8f['message']=_0x0a9e('0x95');}emitCampaignPreview(_0x5adf8f);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x242745,_0x4556c5,_0x9375fb){var _0x19c995=this;var _0x186f39=this[_0x0a9e('0x12')][_0x4556c5];var _0x387489=this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]];var _0x1cc4f3;if(_0x387489){switch(_0x9375fb){case'1':_0x387489[_0x0a9e('0x96')]+=0x1;_0x186f39[_0x0a9e('0x97')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x0,_0x0a9e('0x9a'));ami[_0x0a9e('0x24')](_0x0a9e('0x9b'),ut['buildObj'](_0x186f39,_0x0a9e('0x9c')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0x9d'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,'Global');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xa0'));}else{if(_0x186f39[_0x0a9e('0x97')]>=_0x387489[_0x0a9e('0xa1')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x186f39,_0x0a9e('0x97'),_0x387489[_0x0a9e('0xa2')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];break;case _0x0a9e('0xa6'):var _0x1a0677=moment()['format'](_0x0a9e('0x85'));_0x186f39[_0x0a9e('0xa7')]=_0x1a0677;_0x186f39[_0x0a9e('0xa8')]=_0x1a0677;_0x186f39['dialAnswer']=!![];_0x387489[_0x0a9e('0x2a')]+=0x1;logger['info'](_0x0a9e('0xa9'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],_0x0a9e('0xab'),_0x387489[_0x0a9e('0x2a')]);ami[_0x0a9e('0x24')]('custom:agentconnect',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xad'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));if(_0x387489['acw']){ami[_0x0a9e('0x24')](_0x0a9e('0xae'),ut[_0x0a9e('0xaf')](_0x186f39));}break;case'16':ami[_0x0a9e('0x24')]('custom:agentcomplete',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0')));_0x387489[_0x0a9e('0x36')]+=0x1;_0x387489[_0x0a9e('0x2f')]+=0x1;_0x387489[_0x0a9e('0x28')]+=0x1;ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xb2'));_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x4,'Answer');rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xb3'));rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x0a9e('0xb4')](_0x186f39);_0x387489[_0x0a9e('0x2c')]+=_0x186f39[_0x0a9e('0xb5')];_0x387489[_0x0a9e('0x2b')]+=_0x186f39['talktime'];logger['info'](_0x0a9e('0xb6'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],'pTalking:\x20',_0x387489[_0x0a9e('0x2a')]);delete this[_0x0a9e('0x12')][_0x242745['linkedid']];break;case _0x0a9e('0xb7'):_0x387489[_0x0a9e('0x38')]+=0x1;_0x186f39[_0x0a9e('0xb8')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x5,_0x0a9e('0xb9'));ami['emit'](_0x0a9e('0xba'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xbb')));rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xbd'));}else{if(_0x186f39[_0x0a9e('0xb8')]>=_0x387489[_0x0a9e('0xbe')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xb8'),_0x387489[_0x0a9e('0xc0')]),_0x186f39['unlockAgent'],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc1'):_0x387489['outboundNoAnswerCallsDay']+=0x1;_0x186f39['countnoanswerretry']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut['logCustomer'](_0x186f39,0x3,'NoAnswer');ami[_0x0a9e('0x24')](_0x0a9e('0xc2'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xc3')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xc4'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xc5'));}else{if(_0x186f39[_0x0a9e('0xc6')]>=_0x387489['dialNoAnswerMaxRetry']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xc4'));}else{rpcDb[_0x0a9e('0xc7')](ut['scheduledAt'](_0x186f39,_0x0a9e('0xc6'),_0x387489[_0x0a9e('0xc8')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc9'):_0x387489[_0x0a9e('0x39')]+=0x1;_0x186f39[_0x0a9e('0xca')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x8,_0x0a9e('0xcb'));ami['emit'](_0x0a9e('0xcc'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xcd')));rpcDb['createCustomerHistory'](_0x186f39,_0x0a9e('0xce'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xcf'));}else{if(_0x186f39[_0x0a9e('0xca')]>=_0x387489[_0x0a9e('0xd0')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xca'),_0x387489[_0x0a9e('0xc0')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xd1'):_0x387489[_0x0a9e('0x40')]+=0x1;_0x186f39[_0x0a9e('0xd2')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x14,_0x0a9e('0xd3'));ami['emit'](_0x0a9e('0xd4'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xd5')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xd6'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0x14,'AgentReject');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x186f39[_0x0a9e('0xd2')]>=_0x387489[_0x0a9e('0xd7')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,'countagentrejectretry',_0x387489[_0x0a9e('0xd9')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39['activeContact']);}}break;case _0x0a9e('0xda'):_0x387489[_0x0a9e('0xdb')]+=0x1;_0x186f39[_0x0a9e('0xdc')]+=0x1;_0x186f39['countglobal']=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xb,_0x0a9e('0xdd'));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xde'));if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x186f39[_0x0a9e('0xdf')]>=_0x387489['dialAbandonedMaxRety']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xde'));}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xdc'),_0x387489['dialAbandonedRetryFrequency']),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;default:if(_0x186f39[_0x0a9e('0x76')]){ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xe0'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x387489[_0x0a9e('0x26')],_0x242745);}_0x387489['outboundUnknownCallsDay']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xc,_0x242745[_0x0a9e('0xe1')]||_0x242745[_0x0a9e('0xe2')]);rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xe3'));}else{rpcDb['createCustomerFinal'](_0x186f39,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];}if(!(_0x186f39['dialAnswer']&&_0x9375fb==='16')){ut[_0x0a9e('0x74')](_0x387489,_0x0a9e('0xe4'));logger[_0x0a9e('0x56')](_0x0a9e('0xe5'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489['name'],_0x0a9e('0xe6'),_0x387489[_0x0a9e('0x4d')]);}if(_0x9375fb!==_0x0a9e('0xa6')){delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];delete this['actions'][_0x242745[_0x0a9e('0xe7')]];}}};Preview[_0x0a9e('0xc')]['callProgressDetectingAgent']=function(_0x3c313d,_0x19fd11,_0xcacabb){if(_[_0x0a9e('0xe8')](_0x19fd11)&&_0x0a9e('0xe9')!==typeof _0x19fd11){return;}if(_[_0x0a9e('0xe8')](_0xcacabb)&&_0x0a9e('0xe9')!==typeof _0xcacabb){return;}switch(_0xcacabb[_0x0a9e('0xea')]){case'0':ut[_0x0a9e('0xeb')](_0x3c313d,0x0,_0x0a9e('0x9a'));rpcDb['createAgentHistory'](_0x3c313d,_0x0a9e('0xec'));break;case'3':ut[_0x0a9e('0xeb')](_0x3c313d,0x3,_0x0a9e('0xed'));rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xef'));break;case'5':ut['logAgent'](_0x3c313d,0x5,'Busy');rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xf0'));break;case'8':ut[_0x0a9e('0xeb')](_0x3c313d,0x8,_0x0a9e('0xcb'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x0a9e('0xeb')](_0x3c313d,0x16,_0x0a9e('0xf1'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x0a9e('0xeb')](_0x3c313d,0xc,_0xcacabb['reason']);rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');}ut[_0x0a9e('0x74')](_0x19fd11,_0x0a9e('0xf2'));logger[_0x0a9e('0x56')]('[originated][decrement][callProgressDetectingAgent]',_0x3c313d[_0x0a9e('0xaa')],'\x20Queue',_0x19fd11[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x19fd11[_0x0a9e('0x4d')]);delete this[_0x0a9e('0x12')][_0x3c313d[_0x0a9e('0xaa')]];};Preview[_0x0a9e('0xc')][_0x0a9e('0xf3')]=function(_0xe89aaa,_0x2aaf07,_0x27d1f5,_0x4262d0,_0xc876d4){var _0x2415fe=this;return new BPromise(function(_0x399def,_0x98c62c){if(_[_0x0a9e('0x67')](_0x2aaf07)||_['isNil'](_0x2aaf07['Contact'])||_[_0x0a9e('0x67')](_0x2aaf07['Contact'][_0x0a9e('0xf4')])||_[_0x0a9e('0x67')](_0x2aaf07['VoiceQueueId'])){_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0xf5'),_0x4262d0,_0xc876d4));return;}var _0x387bbe=uuid['v4']();var _0x18adc8=_0x2415fe['campaignsPreview'][_0x2aaf07[_0x0a9e('0x69')][_0x0a9e('0x26')]];var _0x374f0b=_0x27d1f5?_0x2415fe[_0x0a9e('0x13')][_0x27d1f5]['id']:undefined;_0x2415fe['actions'][_0x387bbe]=new Action(_0x2aaf07,_0x18adc8,_0x387bbe,_0x27d1f5,_0x374f0b);var _0x19e9ed=_0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x19e9ed[_0x0a9e('0xa3')]=_0x4262d0;_0x19e9ed['activeContact']=_0xc876d4;_0x19e9ed[_0x0a9e('0xf6')]=_0x27d1f5;if(_[_0x0a9e('0xf7')](_0xe89aaa)){_0x2415fe[_0x0a9e('0xf8')](_0x19e9ed,_0x18adc8,_0x2aaf07,_0x27d1f5)['then'](function(_0x303f75){logger[_0x0a9e('0x56')](_0x0a9e('0xf9'),_0x0a9e('0xfa')+_0x19e9ed[_0x0a9e('0x6a')]+'\x20IdHopper:\x20'+_0x19e9ed[_0x0a9e('0xfb')],JSON[_0x0a9e('0x55')](_0x303f75));ami['emit'](_0x0a9e('0xfc'),ut[_0x0a9e('0xac')](_0x19e9ed,_0x0a9e('0xfd'),_0x2415fe['campaignsPreview'][_0x19e9ed['queue']]));_0x399def(ut['message'](_0x0a9e('0xfe')));})[_0x0a9e('0x73')](function(_0x55f91a){ut[_0x0a9e('0x5c')](_0x0a9e('0xff'),_0x55f91a);_0x98c62c(ut[_0x0a9e('0x4c')]('Call\x20failed',_0x4262d0,_0xc876d4));});}else{_0x18adc8[_0x0a9e('0x37')]+=0x1;ut[_0x0a9e('0x100')](_0x19e9ed);rpcDb[_0x0a9e('0x101')](_0x19e9ed,_0x0a9e('0x102'));delete _0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0x103'),_0x4262d0,_0xc876d4));}});};Preview[_0x0a9e('0xc')][_0x0a9e('0x92')]=function(_0x5a1848){return!_[_0x0a9e('0x67')](_0x5a1848)&&!_['isNil'](_0x5a1848[_0x0a9e('0x26')])&&!_[_0x0a9e('0x67')](_0x5a1848[_0x0a9e('0x104')])&&_0x5a1848[_0x0a9e('0x104')]&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])])&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')])&&(this[_0x0a9e('0x11')][util[_0x0a9e('0x106')](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x107')||this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x108'));};Preview[_0x0a9e('0xc')][_0x0a9e('0x109')]=function(_0x2895c5,_0x20ae21){var _0x566b90=this;return new BPromise(function(_0x3b581c,_0xd2391){_0x566b90[_0x0a9e('0x10a')](_0x2895c5,_0x20ae21)['then'](function(_0x1402c7){_0x3b581c(_[_0x0a9e('0x6b')](_0x1402c7,[_0x0a9e('0x4c')]));})[_0x0a9e('0x73')](function(_0x370b5e){if(_0x370b5e[_0x0a9e('0x10b')]){rpcDb[_0x0a9e('0x10c')](_0x2895c5);}if(_0x370b5e[_0x0a9e('0x104')]){rpcDb[_0x0a9e('0x10d')](_0x2895c5);}_0xd2391(_[_0x0a9e('0x6b')](_0x370b5e,['message']));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10a')]=function(_0x15a9ed,_0x3db98f){var _0x2b624e=this;return new BPromise(function(_0x3942fd,_0x5cb48d){var _0x382687,_0x4f854b;rpcDb['getContactPreview'](_0x15a9ed)['then'](function(_0x19e4e6){if(!_[_0x0a9e('0x67')](_0x19e4e6[0x0])){_0x4f854b=_0x19e4e6[0x0][_0x0a9e('0x10e')]?![]:!![];_0x382687=_0x19e4e6[0x0][_0x0a9e('0x10e')]?!![]:![];_0x382687=_0x3db98f?!![]:_0x382687;}var _0x4d99a8=_0x2b624e[_0x0a9e('0x10f')](_0x19e4e6);if(_0x4d99a8[_0x0a9e('0x110')]){rpcDb[_0x0a9e('0x111')](_[_0x0a9e('0x6b')](_0x19e4e6[0x0],[_0x0a9e('0x6e'),'Contact.phone']))['then'](function(_0x9484c8){_0x2b624e[_0x0a9e('0xf3')](_0x9484c8,_0x19e4e6[0x0],_0x3db98f,_0x4f854b,_0x382687)[_0x0a9e('0x81')](function(_0x5e85d0){_0x3942fd(_0x5e85d0);})[_0x0a9e('0x73')](function(_0x248a9a){_0x5cb48d(_0x248a9a);});})[_0x0a9e('0x73')](function(_0x4cee8c){ut[_0x0a9e('0x5c')](_0x0a9e('0x112'),_0x4cee8c);_0x5cb48d(ut[_0x0a9e('0x4c')]('Call\x20unsuccessful',_0x4f854b,_0x382687));});}else{_0x5cb48d(ut[_0x0a9e('0x4c')](_0x4d99a8[_0x0a9e('0x4c')],_0x4f854b,_0x382687));}})[_0x0a9e('0x73')](function(_0x549e03){ut['logger']('[Preview][getContactPreview]',_0x549e03);_0x5cb48d(ut[_0x0a9e('0x4c')](_0x0a9e('0x113'),![],!![]));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10f')]=function(_0x5d83fd){if(_[_0x0a9e('0x67')](_0x5d83fd)||_['isEmpty'](_0x5d83fd)||!_[_0x0a9e('0x67')](_0x5d83fd[0x0][_0x0a9e('0x7f')])&&_[_0x0a9e('0x67')](_0x5d83fd[0x0]['Agent'][_0x0a9e('0x26')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x114'),_0x5d83fd);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x40eb5d=this['campaignsPreview'][_0x5d83fd[0x0][_0x0a9e('0x69')]['name']];_0x40eb5d[_0x0a9e('0x4c')]='ACTIVE';if(_[_0x0a9e('0x67')](_0x40eb5d)){ut[_0x0a9e('0x5c')](_0x0a9e('0x115'),_0x40eb5d);return{'isValid':![],'message':_0x0a9e('0x116')};}if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x53')])){ut[_0x0a9e('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x93')])){ut['logger'](_0x0a9e('0x118'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x119'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x0a9e('0x90')](_0x40eb5d[_0x0a9e('0x32')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x11a'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b'));return{'isValid':![],'message':_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b')};}return{'isValid':!![],'message':_0x0a9e('0x11c')};};Preview['prototype'][_0x0a9e('0xf8')]=function(_0x53c7de,_0x3c9854,_0x2968e2,_0x5b9c76){var _0x315e31=this;return new BPromise(function(_0x5d577b,_0x2d45db){var _0x5691ac=_0x53c7de[_0x0a9e('0xaa')];var _0x469035=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?util[_0x0a9e('0x106')](_0x0a9e('0x11d'),_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x35')])?'':_0x3c9854[_0x0a9e('0x35')]['trim']()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')]):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')]:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854['dialPrefix'])?'':_0x3c9854[_0x0a9e('0x35')][_0x0a9e('0x121')]()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2['Contact'][_0x0a9e('0xf4')]);var _0x294310=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?ut[_0x0a9e('0x122')](_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0a9e('0x125')](_0x3c9854[_0x0a9e('0x34')],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]):ut[_0x0a9e('0x122')](_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')]['callerid']:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854[_0x0a9e('0x126')]>0x0?ut['getCallerIdRandom'](_0x3c9854['dialOriginateCallerIdNumber'],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]);if(_0x294310){_0x53c7de[_0x0a9e('0x127')]=ut['extractCalleridName'](_0x294310);_0x53c7de[_0x0a9e('0x128')]=ut[_0x0a9e('0x129')](_0x294310);}var _0x4d8a67=ut[_0x0a9e('0x12a')](_0x3c9854,_0x2968e2,_0x469035,_0x294310,_0x5691ac,_0x53c7de);_['merge'](_0x53c7de,ut[_0x0a9e('0x12b')](_0x4d8a67));_0x53c7de['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0a9e('0x70')](ut[_0x0a9e('0x12c')](_0x53c7de,_0x3c9854,_0x4d8a67,_0x53c7de[_0x0a9e('0xa4')],_0x5b9c76))[_0x0a9e('0x81')](function(_0x7d59a9){_0x3c9854[_0x0a9e('0x4d')]+=0x1;logger['info'](_0x0a9e('0x12d'),_0x5691ac,_0x0a9e('0x12e'),_0x3c9854[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x3c9854[_0x0a9e('0x4d')]);_0x5d577b(_0x7d59a9);})[_0x0a9e('0x73')](function(_0x31c937){ut['logAgent'](_0x53c7de,0xe,'OriginateError');rpcDb[_0x0a9e('0xee')](_0x53c7de,'[originateFailure][logOriginateFailure]');_0x2d45db(_0x31c937);});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x1c')]=function(_0x1f0318){if(this[_0x0a9e('0x12')][_0x1f0318[_0x0a9e('0xa5')]]){this[_0x0a9e('0x12')][_0x1f0318['linkedid']][_0x0a9e('0x72')]=_0x1f0318['channel'];}};Preview['prototype'][_0x0a9e('0x16')]=function(_0x593f9e){var _0x38dceb=this;var _0x5dc978=this['actions'][_0x593f9e[_0x0a9e('0x12f')]];if(_0x5dc978){if(_0x5dc978['lookAgent']&&this[_0x0a9e('0x13')][_0x5dc978[_0x0a9e('0xf6')]]){ut[_0x0a9e('0x130')](_0x5dc978,this['agents'][_0x5dc978[_0x0a9e('0xf6')]][_0x0a9e('0x26')],this[_0x0a9e('0x13')][_0x5dc978['lookAgent']]['id']);}var _0x5236c9=_[_0x0a9e('0x131')](_0x5dc978);_0x5236c9[_0x0a9e('0xa7')]=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));var _0x3b0db2=_0x38dceb[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]];if(ut[_0x0a9e('0x132')](_0x593f9e[_0x0a9e('0x133')])){if(_0x5dc978[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x5dc978['idContact']);}if(_0x5dc978['activeContact']){rpcDb[_0x0a9e('0x10d')](_0x5dc978[_0x0a9e('0xfb')]);}ami[_0x0a9e('0x24')](_0x0a9e('0x134'),ut[_0x0a9e('0xac')](_0x5dc978,_0x0a9e('0x135'),this[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]]));this['callProgressDetectingAgent'](_0x5236c9,_0x3b0db2,_0x593f9e);}else{_0x5dc978['starttime']=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));ut['logAgent'](_0x5236c9,0x4,_0x0a9e('0x136'));rpcDb[_0x0a9e('0xee')](_0x5236c9,_0x0a9e('0x137'));}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x19')]=function(_0x2683ad){var _0x167196=this;var _0x262281=this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]];var _0xbd1af3;if(_0x262281){_0xbd1af3=this[_0x0a9e('0xf')][_0x262281['queue']];logger[_0x0a9e('0x56')](_0x0a9e('0x138'),_0x2683ad[_0x0a9e('0xa5')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);}if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]]&&_0x2683ad[_0x0a9e('0xa5')]!==_0x2683ad[_0x0a9e('0xaa')]){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad['linkedid']][_0x0a9e('0x76')]){this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger['info'](_0x0a9e('0x13b'),_0x2683ad['linkedid'],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}else if(_0x262281&&_[_0x0a9e('0x67')](_0x262281[_0x0a9e('0x13c')])&&_0xbd1af3[_0x0a9e('0x13d')]&&_0x2683ad[_0x0a9e('0xa5')]===_0x2683ad[_0x0a9e('0xaa')]&&_[_0x0a9e('0x67')](_0x2683ad[_0x0a9e('0xea')])&&_0x2683ad[_0x0a9e('0x139')]==='16'&&_0x2683ad['channelstate']==='6'&&_['isUndefined'](_0x262281[_0x0a9e('0x13e')])){if(_0x262281[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x262281['idContact']);}if(_0x262281[_0x0a9e('0xa4')]){rpcDb[_0x0a9e('0x10d')](_0x262281[_0x0a9e('0xfb')]);}_0x2683ad['reason']='22';this[_0x0a9e('0x13f')](_0x262281,_0xbd1af3,_0x2683ad);}else if(_0x262281&&_0x262281['transfer']){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad[_0x0a9e('0xa5')]]['dialAnswer']){logger[_0x0a9e('0x56')](_0x0a9e('0x140'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad['cause'],_0x0a9e('0x12e'),_0xbd1af3['name'],'pTalking:\x20',_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger[_0x0a9e('0x56')](_0x0a9e('0x13b'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}};Preview[_0x0a9e('0xc')]['syncDialEnd']=function(_0x233e48){if(this[_0x0a9e('0x12')][_0x233e48[_0x0a9e('0xe7')]]&&_0x233e48[_0x0a9e('0xe7')]!==_0x233e48['destuniqueid']){this['callProgressDetectingCustomer'](_0x233e48,_0x233e48['destlinkedid'],_0x233e48[_0x0a9e('0xe2')]);}};Preview['prototype'][_0x0a9e('0x141')]=function(_0x1fafc2){if(this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]]&&_0x1fafc2[_0x0a9e('0xa5')]!==_0x1fafc2[_0x0a9e('0xaa')]&&!this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){if(_0x1fafc2[_0x0a9e('0x139')]==='1'){this['callProgressDetectingCustomer'](_0x1fafc2,_0x1fafc2[_0x0a9e('0xa5')],_0x1fafc2['cause']);}}};Preview[_0x0a9e('0xc')]['addVariable']=function(_0xf4de86,_0x2c5385,_0x216791){if(this['actions'][_0xf4de86]){if(_[_0x0a9e('0x67')](this[_0x0a9e('0x12')][_0xf4de86]['variables'])){this['actions'][_0xf4de86][_0x0a9e('0x142')]={};}this[_0x0a9e('0x12')][_0xf4de86][_0x0a9e('0x142')][_0x2c5385]=_0x216791;}};Preview['prototype']['syncVarSet']=function(_0x4869c1){try{if(!_[_0x0a9e('0x67')](_0x4869c1)){if(ut[_0x0a9e('0x143')](_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0])){this[_0x0a9e('0x146')](_0x4869c1[_0x0a9e('0xaa')],_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0],_0x4869c1[_0x0a9e('0x147')]);}}}catch(_0x18e38b){logger[_0x0a9e('0x148')](_0x0a9e('0x149'),util[_0x0a9e('0x14a')](_0x18e38b,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xc')][_0x0a9e('0x20')]=function(_0x1a74c4){if(_0x1a74c4){if(this[_0x0a9e('0x12')][_0x1a74c4[_0x0a9e('0x14b')]]){this['actions'][_0x1a74c4[_0x0a9e('0x14b')]][_0x0a9e('0x13e')]=!![];}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x22')]=function(_0x4790f7){if(_0x4790f7){if(this[_0x0a9e('0x12')][_0x4790f7['transfererlinkedid']]){this[_0x0a9e('0x12')][_0x4790f7[_0x0a9e('0x14c')]][_0x0a9e('0x13e')]=!![];}}};module[_0x0a9e('0x14d')]=Preview; \ No newline at end of file +var _0x34e8=['type','outbound','strategy','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','unmanaged','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','voice:queue:%s','name','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','actions','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','emit','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','Global','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','isNil','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','run','execRun','unlock','active','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','originated:\x20','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','responsetime','isFailure','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','callProgressDetectingCustomer','[syncHangup][talking][cause]','cause','dialQueueProject','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e8,0x12c));var _0x834e=function(_0x2b6742,_0xa08896){_0x2b6742=_0x2b6742-0x0;var _0x186ec7=_0x34e8[_0x2b6742];return _0x186ec7;};'use strict';var util=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var uuid=require(_0x834e('0x3'));var moment=require('moment');var md5=require(_0x834e('0x4'));var Redis=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var loggerAction=require(_0x834e('0x7'))(_0x834e('0x9'));var ami=require('../ami');var rpcDb=require(_0x834e('0xa'));var Action=require('./action');var ut=require(_0x834e('0xb'));config[_0x834e('0xc')]=_[_0x834e('0xd')](config[_0x834e('0xc')],{'host':_0x834e('0xe'),'port':0x18eb});var io=require(_0x834e('0xf'))(new Redis(config[_0x834e('0xc')]));var Sequence=function(){};Sequence[_0x834e('0x10')][_0x834e('0x11')]=function(_0x186b3b){this[_0x834e('0x12')]=this[_0x834e('0x12')]?this[_0x834e('0x12')][_0x834e('0x13')](_0x186b3b):_0x186b3b();};function Preview(_0x293514){this[_0x834e('0x14')]=new Sequence();this[_0x834e('0x15')]=_0x293514['voiceQueues'];this[_0x834e('0x16')]=_0x293514[_0x834e('0x16')];this['actions']={};this[_0x834e('0x17')]=_0x293514[_0x834e('0x17')];this[_0x834e('0x18')]=0x0;ami['on'](_0x834e('0x19'),this['syncOriginateResponse'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1b'),this['syncHangup'][_0x834e('0x1a')](this));ami['on']('hanguprequest',this[_0x834e('0x1c')][_0x834e('0x1a')](this));ami['on']('dialend',this[_0x834e('0x1d')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1e'),this['syncNewExten'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1f'),this[_0x834e('0x20')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x21'),this[_0x834e('0x22')][_0x834e('0x1a')](this));ami['on']('blindtransfer',this[_0x834e('0x23')][_0x834e('0x1a')](this));this[_0x834e('0x24')](this[_0x834e('0x15')]);}function emit(_0x4ab05d,_0x45a630,_0x62f8f1){io['to'](_0x4ab05d)['emit'](_0x45a630,_0x62f8f1);}function emitCampaignPreview(_0x1b4bdf){if(_0x1b4bdf[_0x834e('0x25')]===_0x834e('0x26')){var _0x5c55ca={'id':_0x1b4bdf['id'],'name':_0x1b4bdf['name'],'strategy':_0x1b4bdf[_0x834e('0x27')],'answered':_0x1b4bdf[_0x834e('0x28')],'available':_0x1b4bdf['available'],'loggedIn':_0x1b4bdf[_0x834e('0x29')],'pTalking':_0x1b4bdf[_0x834e('0x2a')],'sumBillable':_0x1b4bdf['sumBillable'],'sumDuration':_0x1b4bdf[_0x834e('0x2b')],'sumHoldTime':_0x1b4bdf[_0x834e('0x2c')]||0x0,'talking':_0x1b4bdf[_0x834e('0x2d')],'total':_0x1b4bdf['total'],'type':_0x1b4bdf[_0x834e('0x25')],'unmanaged':_0x1b4bdf[_0x834e('0x2e')],'abandoned':_0x1b4bdf['abandoned'],'waiting':_0x1b4bdf['waiting'],'loggedInDb':_0x1b4bdf[_0x834e('0x2f')],'dialActive':_0x1b4bdf['dialActive'],'dialMethod':_0x1b4bdf[_0x834e('0x30')],'dialOriginateCallerIdName':_0x1b4bdf[_0x834e('0x31')],'dialOriginateCallerIdNumber':_0x1b4bdf[_0x834e('0x32')],'dialOriginateTimeout':_0x1b4bdf[_0x834e('0x33')],'dialPrefix':_0x1b4bdf[_0x834e('0x34')],'outboundAnswerAgiCallsDay':_0x1b4bdf[_0x834e('0x35')],'outboundAnswerCallsDay':_0x1b4bdf['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1b4bdf['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1b4bdf['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1b4bdf['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1b4bdf[_0x834e('0x36')],'outboundDropCallsDayCallersExit':_0x1b4bdf[_0x834e('0x37')],'outboundDropCallsDayTimeout':_0x1b4bdf[_0x834e('0x38')],'outboundNoAnswerCallsDay':_0x1b4bdf['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1b4bdf[_0x834e('0x39')],'outboundOriginateFailureCallsDay':_0x1b4bdf[_0x834e('0x3a')],'outboundReCallsDay':_0x1b4bdf[_0x834e('0x3b')],'outboundRejectCallsDay':_0x1b4bdf[_0x834e('0x3c')],'outboundUnknownCallsDay':_0x1b4bdf[_0x834e('0x3d')],'outboundAbandonedCallsDay':_0x1b4bdf[_0x834e('0x3e')],'predictiveIntervalAnsweredCalls':_0x1b4bdf[_0x834e('0x3f')],'predictiveIntervalAvgHoldtime':_0x1b4bdf[_0x834e('0x40')],'predictiveIntervalAvgTalktime':_0x1b4bdf[_0x834e('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x1b4bdf['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1b4bdf[_0x834e('0x42')],'predictiveIntervalErlangCalls':_0x1b4bdf['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1b4bdf[_0x834e('0x43')],'predictiveIntervalHitRate':_0x1b4bdf[_0x834e('0x44')],'predictiveIntervalMultiplicativeFactor':_0x1b4bdf[_0x834e('0x45')],'predictiveIntervalPauses':_0x1b4bdf[_0x834e('0x46')],'predictiveIntervalAvailable':_0x1b4bdf[_0x834e('0x47')],'predictiveIntervalTotalCalls':_0x1b4bdf[_0x834e('0x48')],'message':_0x1b4bdf[_0x834e('0x49')],'originated':_0x1b4bdf[_0x834e('0x4a')],'erlangCalls':_0x1b4bdf[_0x834e('0x4b')],'erlangCallToSecond':_0x1b4bdf[_0x834e('0x4c')],'erlangAbandonmentRate':_0x1b4bdf['erlangAbandonmentRate'],'erlangBusyFactor':_0x1b4bdf[_0x834e('0x4d')],'startPredictive':_0x1b4bdf[_0x834e('0x4e')],'startProgressive':_0x1b4bdf[_0x834e('0x4f')]};if(_0x1b4bdf[_0x834e('0x50')]){_0x5c55ca['Trunk']={'id':_0x1b4bdf[_0x834e('0x50')]['id'],'name':_0x1b4bdf[_0x834e('0x50')]['name'],'active':_0x1b4bdf['Trunk']['active'],'callerid':_0x1b4bdf[_0x834e('0x50')][_0x834e('0x51')]};}if(_0x1b4bdf[_0x834e('0x52')]){_0x5c55ca[_0x834e('0x52')]={'id':_0x1b4bdf[_0x834e('0x52')]['id'],'name':_0x1b4bdf[_0x834e('0x52')]['name']};}var _0x2c2d94=md5(JSON['stringify'](_0x5c55ca));if(_0x1b4bdf[_0x834e('0x4')]!==_0x2c2d94){_0x1b4bdf[_0x834e('0x4')]=_0x2c2d94;emit(util['format'](_0x834e('0x53'),_0x5c55ca[_0x834e('0x54')]),'voice_queue:save',_0x5c55ca);}}}function emitVoiceQueueChannelRemove(_0x481f70){logger[_0x834e('0x55')](_0x834e('0x56'),JSON[_0x834e('0x57')](_0x481f70));emit(util[_0x834e('0x58')](_0x834e('0x53'),_0x481f70['name']),_0x834e('0x59'),_0x481f70);}function notSendMessagesQueue(_0x548d1d){if(_0x548d1d['sendMessageOneNotActive']){if(_0x548d1d[_0x834e('0x4a')]===0x0&&_0x548d1d['pTalking']===0x0){_0x548d1d[_0x834e('0x5a')]=![];_0x548d1d[_0x834e('0x5b')]=0x0;_0x548d1d[_0x834e('0x5c')]=0x0;_0x548d1d[_0x834e('0x49')]=_0x834e('0x5d');ut['logger'](_0x834e('0x5e'),_0x548d1d[_0x834e('0x54')]+_0x834e('0x5f'));}else{_0x548d1d['message']=_0x834e('0x60');ut[_0x834e('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x548d1d[_0x834e('0x54')]+'\x20is\x20disactive');}emitCampaignPreview(_0x548d1d);}}Preview[_0x834e('0x10')][_0x834e('0x24')]=function(){var _0x4a18bb=this;setInterval(function(){_0x4a18bb['syncCampaigns']();},0x7cf);};Preview[_0x834e('0x10')][_0x834e('0x62')]=function(){var _0x3bcbf4=this[_0x834e('0x15')];this[_0x834e('0x18')]+=0x1;for(var _0x23feea in _0x3bcbf4){if(_0x3bcbf4[_0x834e('0x63')](_0x23feea)&&(_0x3bcbf4[_0x23feea]['dialMethod']===_0x834e('0x8')||_0x3bcbf4[_0x23feea]['dialMethod']===_0x834e('0x64'))&&_0x3bcbf4[_0x23feea]['type']===_0x834e('0x26')){if(this['clockClearZombieChannels']>0x7){this[_0x834e('0x18')]=0x0;this[_0x834e('0x65')]();}}if(_0x3bcbf4['hasOwnProperty'](_0x23feea)&&_0x3bcbf4[_0x23feea][_0x834e('0x30')]===_0x834e('0x8')&&_0x3bcbf4[_0x23feea][_0x834e('0x25')]===_0x834e('0x26')){if(_0x3bcbf4[_0x23feea][_0x834e('0x66')]){this[_0x834e('0x67')](_0x3bcbf4[_0x23feea]);this[_0x834e('0x68')](_0x3bcbf4[_0x23feea]);}else{notSendMessagesQueue(_0x3bcbf4[_0x23feea]);}}}};Preview[_0x834e('0x10')][_0x834e('0x69')]=function(_0x279ea1){var _0x5f3943=this;this[_0x834e('0x14')][_0x834e('0x11')](function(){if(!_['isNil'](_0x5f3943[_0x834e('0x6a')][_0x279ea1])){loggerAction[_0x834e('0x55')](_0x834e('0x6b'),_0x279ea1,_0x834e('0x6c'),_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')],'originated:\x20',JSON['stringify'](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]][_0x834e('0x4a')]),_0x834e('0x6e'),JSON[_0x834e('0x57')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]][_0x834e('0x2a')]),JSON[_0x834e('0x57')](_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6f')]),JSON[_0x834e('0x57')](_[_0x834e('0x70')](_0x5f3943[_0x834e('0x6a')][_0x279ea1],[_0x834e('0x71'),_0x834e('0x72'),_0x834e('0x73'),_0x834e('0x74')])));return ami['Action']({'action':_0x834e('0x75'),'channel':_0x5f3943[_0x834e('0x6a')][_0x279ea1]['channel']})[_0x834e('0x76')](function(_0x3b0988){if(_0x3b0988['message']===_0x834e('0x77')){setTimeout(function(){if(_0x5f3943[_0x834e('0x6a')][_0x279ea1]){ut[_0x834e('0x78')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]],_0x834e('0x79'));if(_0x5f3943['actions'][_0x279ea1][_0x834e('0x6f')]===!![]){ut[_0x834e('0x7a')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]],_0x834e('0x79'));ut[_0x834e('0x7b')](_0x834e('0x7c')+_0x279ea1,_0x5f3943['actions'][_0x279ea1][_0x834e('0x6d')]);}ut['loggerError'](_0x834e('0x7d')+_0x279ea1,_0x5f3943['actions'][_0x279ea1][_0x834e('0x6d')]);delete _0x5f3943['actions'][_0x279ea1];}},0x2328);}});}});};Preview['prototype'][_0x834e('0x65')]=function(){var _0x3e1bee=this;loggerAction['info']('[action]',_[_0x834e('0x7e')](this[_0x834e('0x6a')]));for(var _0x138ed2 in this[_0x834e('0x6a')]){if(_0x3e1bee[_0x834e('0x6a')][_0x834e('0x63')](_0x138ed2)){_0x3e1bee[_0x834e('0x69')](_0x138ed2);}}};Preview[_0x834e('0x10')]['recallMe']=function(_0x142334){var _0x3c70bf=this;rpcDb['getContactRecallMe'](_0x142334['id'],ut[_0x834e('0x7f')](this['agents']))[_0x834e('0x80')](function(_0x45eceb){if(!_['isNil'](_0x45eceb)){for(var _0x41ef86=0x0;_0x41ef86<_0x45eceb[_0x834e('0x81')];_0x41ef86+=0x1){if(ut[_0x834e('0x82')](_0x45eceb[_0x41ef86][_0x834e('0x83')])<_0x142334['dialRecallMeTimeout']*0x3c){if(_0x45eceb[_0x41ef86][_0x834e('0x84')]&&!_0x45eceb[_0x41ef86][_0x834e('0x84')][_0x834e('0x85')]){_0x3c70bf['run'](_0x45eceb[_0x41ef86]['id'])[_0x834e('0x80')](ut[_0x834e('0x86')](_0x834e('0x87')))[_0x834e('0x76')](ut[_0x834e('0x86')](_0x834e('0x87')));}else{rpcDb[_0x834e('0x88')](_0x45eceb[_0x41ef86]['id']);}}else{var _0x1def00=new Action(_0x45eceb[_0x41ef86],_0x142334);_0x1def00[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));_0x142334[_0x834e('0x3b')]+=0x1;ut[_0x834e('0x8b')](_0x1def00,0x17,_0x834e('0x8c'));if(_0x142334[_0x834e('0x8d')]){rpcDb[_0x834e('0x8e')](ut[_0x834e('0x8f')](_0x45eceb[_0x41ef86]));rpcDb[_0x834e('0x90')](_0x1def00,_0x834e('0x91'));}else{ut[_0x834e('0x8b')](_0x1def00,0x16,_0x834e('0x92'));rpcDb[_0x834e('0x90')](_0x1def00,'[HistoryRecallClose]');rpcDb[_0x834e('0x93')](_0x1def00,_0x834e('0x94'));}}}}})[_0x834e('0x76')](ut[_0x834e('0x86')]('[getContactRecallMe]'));};Preview[_0x834e('0x10')]['setMessage']=function(_0x56a152){_0x56a152[_0x834e('0x5a')]=!![];if(ut[_0x834e('0x95')](_0x56a152[_0x834e('0x29')])){_0x56a152[_0x834e('0x49')]=_0x834e('0x96');}else if(!ut[_0x834e('0x97')](_0x56a152[_0x834e('0x66')])){_0x56a152[_0x834e('0x49')]='NOT_ACTIVE';}else if(!this[_0x834e('0x98')](_0x56a152['Trunk'])){if(!this[_0x834e('0x98')](_0x56a152[_0x834e('0x99')])){_0x56a152['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x56a152[_0x834e('0x49')]=_0x834e('0x9a');}}else{_0x56a152[_0x834e('0x49')]=_0x834e('0x9a');}emitCampaignPreview(_0x56a152);};Preview[_0x834e('0x10')]['callProgressDetectingCustomer']=function(_0x2b0d93,_0x15018f,_0x2df64f){var _0x228a60=this;var _0x3181af=this[_0x834e('0x6a')][_0x15018f];var _0x87818b=this[_0x834e('0x15')][_0x3181af[_0x834e('0x6d')]];var _0x324f67;if(_0x87818b){switch(_0x2df64f){case'1':_0x87818b['outboundNoSuchCallsDay']+=0x1;_0x3181af[_0x834e('0x9b')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x0,'NoSuchNumber');ami[_0x834e('0x9e')]('custom:agentnosuchnumber',ut['buildObj'](_0x3181af,'nosuchnumber'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0x9f'));if(ut['totalGlobal'](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,'Global');rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xa2'));}else{if(_0x3181af['countnosuchnumberretry']>=_0x87818b['dialNoSuchNumberMaxRetry']){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xa2'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0x9b'),_0x87818b['dialNoSuchNumberRetryFrequency']),_0x3181af[_0x834e('0xa5')],_0x3181af['activeContact']);}}delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];break;case _0x834e('0xa7'):var _0x5afb41=moment()[_0x834e('0x58')](_0x834e('0x8a'));_0x3181af['responsetime']=_0x5afb41;_0x3181af[_0x834e('0xa8')]=_0x5afb41;_0x3181af[_0x834e('0x6f')]=!![];_0x87818b[_0x834e('0x2a')]+=0x1;logger['info'](_0x834e('0xa9'),_0x3181af[_0x834e('0xaa')],_0x834e('0xab'),_0x87818b[_0x834e('0x54')],_0x834e('0x6e'),_0x87818b[_0x834e('0x2a')]);ami[_0x834e('0x9e')](_0x834e('0xac'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xae'),this['campaignsPreview'][_0x3181af['queue']]));if(_0x87818b['acw']){ami[_0x834e('0x9e')](_0x834e('0xaf'),ut[_0x834e('0xb0')](_0x3181af));}break;case'16':ami[_0x834e('0x9e')](_0x834e('0xb1'),ut['buildObj'](_0x3181af,'complete',this[_0x834e('0x15')][_0x3181af[_0x834e('0x6d')]]));emitVoiceQueueChannelRemove(ut[_0x834e('0xad')](_0x3181af,_0x834e('0xb2')));_0x87818b[_0x834e('0xb3')]+=0x1;_0x87818b['total']+=0x1;_0x87818b[_0x834e('0x28')]+=0x1;ut[_0x834e('0x7a')](_0x87818b,_0x834e('0xb4'));_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x4,_0x834e('0xb5'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xb6'));rpcDb['createCustomerFinal'](_0x3181af,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x834e('0xb7')](_0x3181af);_0x87818b[_0x834e('0x2b')]+=_0x3181af['talktime'];_0x87818b[_0x834e('0xb8')]+=_0x3181af['talktime'];logger[_0x834e('0x55')](_0x834e('0xb9'),_0x3181af[_0x834e('0xaa')],'\x20Queue',_0x87818b[_0x834e('0x54')],'pTalking:\x20',_0x87818b['pTalking']);delete this['actions'][_0x2b0d93[_0x834e('0xa6')]];break;case _0x834e('0xba'):_0x87818b[_0x834e('0xbb')]+=0x1;_0x3181af[_0x834e('0xbc')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x5,_0x834e('0xbd'));ami[_0x834e('0x9e')]('custom:agentbusy',ut[_0x834e('0xad')](_0x3181af,'busy'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xbe'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x3181af[_0x834e('0xbc')]>=_0x87818b[_0x834e('0xc0')]){rpcDb['createCustomerFinal'](_0x3181af,_0x834e('0xbe'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xbc'),_0x87818b[_0x834e('0xc1')]),_0x3181af['unlockAgent'],_0x3181af[_0x834e('0xc2')]);}}break;case _0x834e('0xc3'):_0x87818b['outboundNoAnswerCallsDay']+=0x1;_0x3181af['countnoanswerretry']+=0x1;_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x3,'NoAnswer');ami[_0x834e('0x9e')](_0x834e('0xc4'),ut['buildObj'](_0x3181af,_0x834e('0xc5')));rpcDb['createCustomerHistory'](_0x3181af,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,_0x834e('0xc6'));}else{if(_0x3181af[_0x834e('0xc7')]>=_0x87818b[_0x834e('0xc8')]){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xc9'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xc7'),_0x87818b[_0x834e('0xca')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case _0x834e('0xcb'):_0x87818b[_0x834e('0xcc')]+=0x1;_0x3181af[_0x834e('0xcd')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x8,_0x834e('0xce'));ami[_0x834e('0x9e')](_0x834e('0xcf'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xd0')));rpcDb['createCustomerHistory'](_0x3181af,_0x834e('0xd1'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xd2'));}else{if(_0x3181af[_0x834e('0xcd')]>=_0x87818b[_0x834e('0xd3')]){rpcDb['createCustomerFinal'](_0x3181af,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x834e('0xa4')](_0x3181af,'countcongestionretry',_0x87818b[_0x834e('0xc1')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case'CANCEL':_0x87818b[_0x834e('0x3c')]+=0x1;_0x3181af[_0x834e('0xd4')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x14,_0x834e('0xd5'));ami['emit'](_0x834e('0xd6'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xd7')));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xd8'));if(ut['totalGlobal'](_0x3181af)>=_0x87818b['dialGlobalMaxRetry']){_0x324f67=ut['cloneAction'](_0x3181af,0x14,'AgentReject');rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xd9'));}else{if(_0x3181af['countagentrejectretry']>=_0x87818b[_0x834e('0xda')]){rpcDb[_0x834e('0x93')](_0x3181af,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xd4'),_0x87818b[_0x834e('0xdb')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case'ABANDONED':_0x87818b['outboundAbandonedCallsDay']+=0x1;_0x3181af[_0x834e('0xdc')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut['logCustomer'](_0x3181af,0xb,_0x834e('0xdd'));rpcDb[_0x834e('0x90')](_0x3181af,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,_0x834e('0xde'));}else{if(_0x3181af['countabandonedetry']>=_0x87818b['dialAbandonedMaxRety']){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xde'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xdc'),_0x87818b[_0x834e('0xdf')]),_0x3181af['unlockAgent'],_0x3181af['activeContact']);}}break;default:if(_0x3181af[_0x834e('0x6f')]){ut[_0x834e('0x7a')](_0x87818b,_0x834e('0xe0'));ut[_0x834e('0x7b')](_0x834e('0xe1')+_0x87818b[_0x834e('0x54')],_0x2b0d93);}_0x87818b[_0x834e('0x3d')]+=0x1;_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0xc,_0x2b0d93['cause-txt']||_0x2b0d93[_0x834e('0xe2')]);rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xe3'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xe4'));}else{rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xe4'));}delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];}if(!(_0x3181af[_0x834e('0x6f')]&&_0x2df64f==='16')){ut['updateOriginated'](_0x87818b,_0x834e('0xe5'));logger[_0x834e('0x55')]('[originated][decrement][callProgressDetectingCustomer]',_0x3181af[_0x834e('0xaa')],'\x20Queue',_0x87818b[_0x834e('0x54')],'originated:\x20',_0x87818b[_0x834e('0x4a')]);}if(_0x2df64f!=='ANSWER'){delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xe6')]];}}};Preview['prototype'][_0x834e('0xe7')]=function(_0x38085e,_0x375fec,_0x2247f7){if(_[_0x834e('0xe8')](_0x375fec)&&_0x834e('0xe9')!==typeof _0x375fec){return;}if(_[_0x834e('0xe8')](_0x2247f7)&&_0x834e('0xe9')!==typeof _0x2247f7){return;}switch(_0x2247f7[_0x834e('0xea')]){case'0':ut[_0x834e('0xeb')](_0x38085e,0x0,_0x834e('0xec'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xee'));break;case'3':ut[_0x834e('0xeb')](_0x38085e,0x3,_0x834e('0xef'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf0'));break;case'5':ut['logAgent'](_0x38085e,0x5,'Busy');rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf1'));break;case'8':ut[_0x834e('0xeb')](_0x38085e,0x8,_0x834e('0xce'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf2'));break;case'22':ut[_0x834e('0xeb')](_0x38085e,0x16,_0x834e('0xf3'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf4'));break;default:ut[_0x834e('0xeb')](_0x38085e,0xc,_0x2247f7[_0x834e('0xea')]);rpcDb['createAgentHistory'](_0x38085e,_0x834e('0xf2'));}ut['updateOriginated'](_0x375fec,_0x834e('0xf5'));logger[_0x834e('0x55')](_0x834e('0xf6'),_0x38085e['uniqueid'],_0x834e('0xab'),_0x375fec[_0x834e('0x54')],'originated:\x20',_0x375fec['originated']);delete this[_0x834e('0x6a')][_0x38085e[_0x834e('0xaa')]];};Preview['prototype'][_0x834e('0xf7')]=function(_0x132edd,_0x4643d9,_0x135219,_0x170ec2,_0x5e6fff){var _0x4e7545=this;return new BPromise(function(_0x453e58,_0x5dd31e){if(_['isNil'](_0x4643d9)||_['isNil'](_0x4643d9[_0x834e('0xf8')])||_[_0x834e('0xf9')](_0x4643d9['Contact'][_0x834e('0xfa')])||_[_0x834e('0xf9')](_0x4643d9[_0x834e('0x73')])){_0x5dd31e(ut[_0x834e('0x49')]('Contact\x20is\x20undefined',_0x170ec2,_0x5e6fff));return;}var _0x1998ba=uuid['v4']();var _0x288eb1=_0x4e7545[_0x834e('0x15')][_0x4643d9['Queue'][_0x834e('0x54')]];var _0x5f3b7d=_0x135219?_0x4e7545[_0x834e('0x17')][_0x135219]['id']:undefined;_0x4e7545['actions'][_0x1998ba]=new Action(_0x4643d9,_0x288eb1,_0x1998ba,_0x135219,_0x5f3b7d);var _0x461420=_0x4e7545[_0x834e('0x6a')][_0x1998ba];_0x461420['unlockAgent']=_0x170ec2;_0x461420[_0x834e('0xc2')]=_0x5e6fff;_0x461420[_0x834e('0xfb')]=_0x135219;if(_[_0x834e('0xfc')](_0x132edd)){_0x4e7545[_0x834e('0xfd')](_0x461420,_0x288eb1,_0x4643d9,_0x135219)[_0x834e('0x80')](function(_0x24d77c){logger['info'](_0x834e('0xfe'),_0x834e('0xff')+_0x461420[_0x834e('0x6d')]+_0x834e('0x100')+_0x461420[_0x834e('0x101')],JSON[_0x834e('0x57')](_0x24d77c));ami['emit'](_0x834e('0x102'),ut['buildObj'](_0x461420,'called',_0x4e7545[_0x834e('0x15')][_0x461420['queue']]));_0x453e58(ut['message'](_0x834e('0x103')));})[_0x834e('0x76')](function(_0x257fed){ut[_0x834e('0x61')](_0x834e('0x104'),_0x257fed);_0x5dd31e(ut[_0x834e('0x49')](_0x834e('0x105'),_0x170ec2,_0x5e6fff));});}else{_0x288eb1[_0x834e('0x106')]+=0x1;ut[_0x834e('0x107')](_0x461420);rpcDb[_0x834e('0x108')](_0x461420,_0x834e('0x109'));delete _0x4e7545[_0x834e('0x6a')][_0x1998ba];_0x5dd31e(ut[_0x834e('0x49')](_0x834e('0x10a'),_0x170ec2,_0x5e6fff));}});};Preview['prototype'][_0x834e('0x98')]=function(_0x4874e1){return!_[_0x834e('0xf9')](_0x4874e1)&&!_[_0x834e('0xf9')](_0x4874e1[_0x834e('0x54')])&&!_[_0x834e('0xf9')](_0x4874e1['active'])&&_0x4874e1['active']&&!_[_0x834e('0xf9')](this[_0x834e('0x16')][util['format'](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])])&&!_['isNil'](this[_0x834e('0x16')][util[_0x834e('0x58')](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])]['status'])&&(this['trunks'][util['format']('SIP/%s',_0x4874e1[_0x834e('0x54')])][_0x834e('0x75')]==='reachable'||this[_0x834e('0x16')][util['format'](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])][_0x834e('0x75')]===_0x834e('0x10c'));};Preview[_0x834e('0x10')][_0x834e('0x10d')]=function(_0x3c775f,_0x4fc61d){var _0x12a0f3=this;return new BPromise(function(_0x20d52f,_0x59ac23){_0x12a0f3[_0x834e('0x10e')](_0x3c775f,_0x4fc61d)[_0x834e('0x80')](function(_0x536f66){_0x20d52f(_['pick'](_0x536f66,['message']));})[_0x834e('0x76')](function(_0x19e17b){if(_0x19e17b[_0x834e('0x10f')]){rpcDb['unlockContact'](_0x3c775f);}if(_0x19e17b[_0x834e('0x110')]){rpcDb[_0x834e('0x88')](_0x3c775f);}_0x59ac23(_[_0x834e('0x70')](_0x19e17b,[_0x834e('0x49')]));});});};Preview[_0x834e('0x10')][_0x834e('0x10e')]=function(_0x19cb0b,_0x13af70){var _0x8804a8=this;return new BPromise(function(_0x102640,_0x48b6c4){var _0x5d6b66,_0x117e8f;rpcDb[_0x834e('0x111')](_0x19cb0b)[_0x834e('0x80')](function(_0x3eda93){if(!_[_0x834e('0xf9')](_0x3eda93[0x0])){_0x117e8f=_0x3eda93[0x0][_0x834e('0x112')]?![]:!![];_0x5d6b66=_0x3eda93[0x0][_0x834e('0x112')]?!![]:![];_0x5d6b66=_0x13af70?!![]:_0x5d6b66;}var _0x39210f=_0x8804a8[_0x834e('0x113')](_0x3eda93);if(_0x39210f[_0x834e('0x114')]){rpcDb[_0x834e('0x115')](_[_0x834e('0x70')](_0x3eda93[0x0],[_0x834e('0x73'),'Contact.phone']))[_0x834e('0x80')](function(_0x3b13be){_0x8804a8[_0x834e('0xf7')](_0x3b13be,_0x3eda93[0x0],_0x13af70,_0x117e8f,_0x5d6b66)[_0x834e('0x80')](function(_0x495697){_0x102640(_0x495697);})['catch'](function(_0x4e7c43){_0x48b6c4(_0x4e7c43);});})[_0x834e('0x76')](function(_0xf98fb4){ut[_0x834e('0x61')](_0x834e('0x116'),_0xf98fb4);_0x48b6c4(ut[_0x834e('0x49')](_0x834e('0x117'),_0x117e8f,_0x5d6b66));});}else{_0x48b6c4(ut[_0x834e('0x49')](_0x39210f[_0x834e('0x49')],_0x117e8f,_0x5d6b66));}})['catch'](function(_0x58ff66){ut['logger']('[Preview][getContactPreview]',_0x58ff66);_0x48b6c4(ut[_0x834e('0x49')](_0x834e('0x117'),![],!![]));});});};Preview[_0x834e('0x10')][_0x834e('0x113')]=function(_0x72f950){if(_[_0x834e('0xf9')](_0x72f950)||_[_0x834e('0xfc')](_0x72f950)||!_[_0x834e('0xf9')](_0x72f950[0x0][_0x834e('0x84')])&&_['isNil'](_0x72f950[0x0]['Agent']['name'])){ut['logger'](_0x834e('0x118'),_0x72f950);return{'isValid':![],'message':_0x834e('0x119')};}var _0x284183=this[_0x834e('0x15')][_0x72f950[0x0][_0x834e('0x6c')][_0x834e('0x54')]];_0x284183[_0x834e('0x49')]=_0x834e('0x9a');if(_[_0x834e('0xf9')](_0x284183)){ut[_0x834e('0x61')](_0x834e('0x11a'),_0x284183);return{'isValid':![],'message':_0x834e('0x11b')};}if(!this[_0x834e('0x98')](_0x284183[_0x834e('0x50')])){ut[_0x834e('0x61')](_0x834e('0x11c'),'campaign\x20Name:\x20'+_0x284183[_0x834e('0x54')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x834e('0x98')](_0x284183[_0x834e('0x99')])){ut[_0x834e('0x61')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x284183[_0x834e('0x54')]+_0x834e('0x11d'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x284183[_0x834e('0x66')])){ut[_0x834e('0x61')](_0x834e('0x11e'),_0x284183[_0x834e('0x54')]+_0x834e('0x11f'));return{'isValid':![],'message':_0x834e('0x120')+_0x284183[_0x834e('0x54')]+_0x834e('0x11f')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x834e('0x10')][_0x834e('0xfd')]=function(_0x375e40,_0x1d4947,_0x1912e6,_0x614e15){var _0x17aaae=this;return new BPromise(function(_0x58ebc8,_0x40a92a){var _0x59e298=_0x375e40['uniqueid'];var _0x1115b7=_0x17aaae[_0x834e('0x98')](_0x1d4947['Trunk'])?util[_0x834e('0x58')](_0x834e('0x121'),_0x1d4947['Trunk'][_0x834e('0x54')],_[_0x834e('0xf9')](_0x1d4947['dialPrefix'])?'':_0x1d4947['dialPrefix'][_0x834e('0x122')]()||'',_0x1d4947[_0x834e('0x123')]>0x0?_0x1912e6['Contact']['phone'][_0x834e('0x124')](_0x1d4947[_0x834e('0x123')]):_0x1912e6['Contact']['phone']):util['format']('SIP/%s/%s%s',_[_0x834e('0xf9')](_0x1d4947['TrunkBackup'])?_0x1d4947[_0x834e('0x50')]['name']:_0x1d4947[_0x834e('0x99')][_0x834e('0x54')],_[_0x834e('0xf9')](_0x1d4947[_0x834e('0x34')])?'':_0x1d4947['dialPrefix'][_0x834e('0x122')]()||'',_0x1d4947[_0x834e('0x123')]>0x0?_0x1912e6[_0x834e('0xf8')][_0x834e('0xfa')][_0x834e('0x124')](_0x1d4947[_0x834e('0x123')]):_0x1912e6[_0x834e('0xf8')][_0x834e('0xfa')]);var _0x464ae6=_0x17aaae[_0x834e('0x98')](_0x1d4947['Trunk'])?ut[_0x834e('0x125')](_0x1d4947['Trunk'][_0x834e('0x51')],_0x1d4947[_0x834e('0x31')],_0x1d4947[_0x834e('0x126')]>0x0?ut[_0x834e('0x127')](_0x1d4947[_0x834e('0x32')],_0x1d4947['dialRandomLastDigitCallerIdNumber']):_0x1d4947[_0x834e('0x32')]):ut['getCallerId'](_['isNil'](_0x1d4947[_0x834e('0x99')])?_0x1d4947[_0x834e('0x50')][_0x834e('0x51')]:_0x1d4947['TrunkBackup'][_0x834e('0x51')],_0x1d4947[_0x834e('0x31')],_0x1d4947[_0x834e('0x126')]>0x0?ut[_0x834e('0x127')](_0x1d4947[_0x834e('0x32')],_0x1d4947[_0x834e('0x126')]):_0x1d4947[_0x834e('0x32')]);if(_0x464ae6){_0x375e40[_0x834e('0x128')]=ut[_0x834e('0x129')](_0x464ae6);_0x375e40[_0x834e('0x12a')]=ut[_0x834e('0x12b')](_0x464ae6);}var _0x578204=ut[_0x834e('0x12c')](_0x1d4947,_0x1912e6,_0x1115b7,_0x464ae6,_0x59e298,_0x375e40);_[_0x834e('0x12d')](_0x375e40,ut[_0x834e('0x12e')](_0x578204));_0x375e40[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));ami['Action'](ut[_0x834e('0x12f')](_0x375e40,_0x1d4947,_0x578204,_0x375e40[_0x834e('0xc2')],_0x614e15))[_0x834e('0x80')](function(_0x37dea1){_0x1d4947[_0x834e('0x4a')]+=0x1;logger[_0x834e('0x55')](_0x834e('0x130'),_0x59e298,_0x834e('0xab'),_0x1d4947[_0x834e('0x54')],_0x834e('0x131'),_0x1d4947['originated']);_0x58ebc8(_0x37dea1);})['catch'](function(_0x5f339f){ut['logAgent'](_0x375e40,0xe,_0x834e('0x132'));rpcDb[_0x834e('0xed')](_0x375e40,_0x834e('0x133'));_0x40a92a(_0x5f339f);});});};Preview[_0x834e('0x10')][_0x834e('0x134')]=function(_0x1d53c6){if(this['actions'][_0x1d53c6[_0x834e('0xa6')]]){this['actions'][_0x1d53c6['linkedid']]['channel']=_0x1d53c6[_0x834e('0x135')];}};Preview[_0x834e('0x10')]['syncOriginateResponse']=function(_0x5cb379){var _0x494e08=this;var _0x2515f6=this[_0x834e('0x6a')][_0x5cb379[_0x834e('0x136')]];if(_0x2515f6){if(_0x2515f6['lookAgent']&&this[_0x834e('0x17')][_0x2515f6[_0x834e('0xfb')]]){ut[_0x834e('0x137')](_0x2515f6,this[_0x834e('0x17')][_0x2515f6[_0x834e('0xfb')]][_0x834e('0x54')],this['agents'][_0x2515f6['lookAgent']]['id']);}var _0x5c7fe3=_['clone'](_0x2515f6);_0x5c7fe3[_0x834e('0x138')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));var _0xfa95ad=_0x494e08[_0x834e('0x15')][_0x2515f6[_0x834e('0x6d')]];if(ut[_0x834e('0x139')](_0x5cb379[_0x834e('0x13a')])){if(_0x2515f6[_0x834e('0xa5')]){rpcDb[_0x834e('0x13b')](_0x2515f6[_0x834e('0x101')]);}if(_0x2515f6[_0x834e('0xc2')]){rpcDb[_0x834e('0x88')](_0x2515f6[_0x834e('0x101')]);}ami[_0x834e('0x9e')]('custom:agentringnoanswer',ut['buildObj'](_0x2515f6,_0x834e('0x13c'),this[_0x834e('0x15')][_0x2515f6[_0x834e('0x6d')]]));this['callProgressDetectingAgent'](_0x5c7fe3,_0xfa95ad,_0x5cb379);}else{_0x2515f6[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));ut[_0x834e('0xeb')](_0x5c7fe3,0x4,_0x834e('0xb5'));rpcDb[_0x834e('0xed')](_0x5c7fe3,_0x834e('0x13d'));}}};Preview[_0x834e('0x10')][_0x834e('0x13e')]=function(_0x53850c){var _0x1785ca=this;var _0x2e0674=this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]];var _0x4b6834;if(_0x2e0674){_0x4b6834=this[_0x834e('0x15')][_0x2e0674[_0x834e('0x6d')]];logger[_0x834e('0x55')](_0x834e('0x13f'),_0x53850c[_0x834e('0xa6')],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834[_0x834e('0x2a')]);}if(this['actions'][_0x53850c[_0x834e('0xa6')]]&&_0x53850c['linkedid']!==_0x53850c[_0x834e('0xaa')]){if(_0x53850c['cause']==='16'&&this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]][_0x834e('0x6f')]){this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c['cause']);}else if(this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]]['dialAnswer']){logger['info'](_0x834e('0x141'),_0x53850c['linkedid'],_0x53850c['cause'],'\x20Queue',_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834[_0x834e('0x2a')]);this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}}else if(_0x2e0674&&_[_0x834e('0xf9')](_0x2e0674['statedesc'])&&_0x4b6834[_0x834e('0x143')]&&_0x53850c[_0x834e('0xa6')]===_0x53850c['uniqueid']&&_['isNil'](_0x53850c[_0x834e('0xea')])&&_0x53850c[_0x834e('0x142')]==='16'&&_0x53850c['channelstate']==='6'&&_['isUndefined'](_0x2e0674[_0x834e('0x144')])){if(_0x2e0674[_0x834e('0xa5')]){rpcDb[_0x834e('0x13b')](_0x2e0674['idContact']);}if(_0x2e0674[_0x834e('0xc2')]){rpcDb[_0x834e('0x88')](_0x2e0674[_0x834e('0x101')]);}_0x53850c['reason']='22';this[_0x834e('0xe7')](_0x2e0674,_0x4b6834,_0x53850c);}else if(_0x2e0674&&_0x2e0674['transfer']){if(_0x53850c[_0x834e('0x142')]==='16'&&this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]][_0x834e('0x6f')]){logger[_0x834e('0x55')]('[syncHangup][talking][transfer]',_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834['pTalking']);this['callProgressDetectingCustomer'](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}else if(this[_0x834e('0x6a')][_0x53850c['linkedid']][_0x834e('0x6f')]){logger[_0x834e('0x55')](_0x834e('0x141'),_0x53850c[_0x834e('0xa6')],_0x53850c['cause'],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],'pTalking:\x20',_0x4b6834[_0x834e('0x2a')]);this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}}};Preview['prototype'][_0x834e('0x1d')]=function(_0x52a673){if(this[_0x834e('0x6a')][_0x52a673[_0x834e('0xe6')]]&&_0x52a673[_0x834e('0xe6')]!==_0x52a673[_0x834e('0x145')]){this[_0x834e('0x140')](_0x52a673,_0x52a673[_0x834e('0xe6')],_0x52a673['dialstatus']);}};Preview['prototype'][_0x834e('0x1c')]=function(_0x3f2c59){if(this['actions'][_0x3f2c59[_0x834e('0xa6')]]&&_0x3f2c59['linkedid']!==_0x3f2c59[_0x834e('0xaa')]&&!this[_0x834e('0x6a')][_0x3f2c59[_0x834e('0xa6')]][_0x834e('0x6f')]){if(_0x3f2c59[_0x834e('0x142')]==='1'){this[_0x834e('0x140')](_0x3f2c59,_0x3f2c59[_0x834e('0xa6')],_0x3f2c59['cause']);}}};Preview[_0x834e('0x10')][_0x834e('0x146')]=function(_0x2a6bca,_0x223d48,_0x1c03bc){if(this['actions'][_0x2a6bca]){if(_[_0x834e('0xf9')](this[_0x834e('0x6a')][_0x2a6bca][_0x834e('0x147')])){this['actions'][_0x2a6bca]['variables']={};}this['actions'][_0x2a6bca][_0x834e('0x147')][_0x223d48]=_0x1c03bc;}};Preview[_0x834e('0x10')][_0x834e('0x20')]=function(_0xd6f2cc){try{if(!_[_0x834e('0xf9')](_0xd6f2cc)){if(ut[_0x834e('0x148')](_[_0x834e('0x149')](_0xd6f2cc[_0x834e('0x14a')])[0x0])){this[_0x834e('0x146')](_0xd6f2cc[_0x834e('0xaa')],_[_0x834e('0x149')](_0xd6f2cc['variable'])[0x0],_0xd6f2cc[_0x834e('0x14b')]);}}}catch(_0x3552b1){logger[_0x834e('0x14c')](_0x834e('0x14d'),util[_0x834e('0x14e')](_0x3552b1,{'showHidden':![],'depth':null}));}};Preview[_0x834e('0x10')][_0x834e('0x22')]=function(_0xa4bb26){if(_0xa4bb26){if(this['actions'][_0xa4bb26[_0x834e('0x14f')]]){this[_0x834e('0x6a')][_0xa4bb26['transfertargetlinkedid']][_0x834e('0x144')]=!![];}}};Preview[_0x834e('0x10')][_0x834e('0x23')]=function(_0x3fba1d){if(_0x3fba1d){if(this['actions'][_0x3fba1d['transfererlinkedid']]){this[_0x834e('0x6a')][_0x3fba1d['transfererlinkedid']][_0x834e('0x144')]=!![];}}};module[_0x834e('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 6cf21af..19c88bb 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 _0xe14b=['xcally-motion-preview','assigned','lastAssignedTo','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','util','bluebird','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0xe14b,0x93));var _0xbe14=function(_0x450cef,_0x309639){_0x450cef=_0x450cef-0x0;var _0x337f5d=_0xe14b[_0x450cef];return _0x337f5d;};'use strict';var util=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0xbe14('0x2'));var cmHopper=require(_0xbe14('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xbe14('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xbe14('0x5'));var voiceQueueReport=require(_0xbe14('0x6'));function loggerCatch(_0x1fe204){return function(_0x1ff100){logger[_0xbe14('0x7')](_0x1fe204,util[_0xbe14('0x8')](_0x1ff100,{'showHidden':![],'depth':null}));};}function create(_0x196fca){return BPromise['resolve']()['then'](cmHopperHistory['createHistory'](_0x196fca))[_0xbe14('0x9')](loggerCatch(_0xbe14('0xa')));}function createAgent(_0xd68cd7){return BPromise[_0xbe14('0xb')]()['then'](agentReportPreview['createHistory'](_0xd68cd7))[_0xbe14('0x9')](loggerCatch(_0xbe14('0xa')));}function moveContact(_0x4935cc){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper[_0xbe14('0xd')](_0x4935cc,!![]))[_0xbe14('0x9')](loggerCatch(_0xbe14('0xe')));}exports[_0xbe14('0xf')]=function(_0x23a730){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopperBlack[_0xbe14('0xf')](_0x23a730))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x10')));};exports[_0xbe14('0x11')]=function(_0x530538){return BPromise['resolve']()[_0xbe14('0xc')](cmHopper[_0xbe14('0x11')](_0x530538))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x12')));};exports['createHistory']=function(_0x21c789,_0xe9c3ec){create(_0x21c789)[_0xbe14('0x9')](loggerCatch(_0xe9c3ec));moveContact(_0x21c789)[_0xbe14('0x9')](loggerCatch(_0xe9c3ec));};exports[_0xbe14('0x13')]=function(_0x29ab73,_0x17ae86){createAgent(_0x29ab73)['catch'](loggerCatch(_0x17ae86));};exports[_0xbe14('0x14')]=function(_0x456ca8,_0x329588){create(_0x456ca8)[_0xbe14('0x9')](loggerCatch(_0x329588));};exports[_0xbe14('0x15')]=function(_0x37e4c1,_0x59a9e3){moveContact(_0x37e4c1)[_0xbe14('0x9')](loggerCatch(_0x59a9e3));};exports[_0xbe14('0x16')]=function(_0x417c8d,_0xc12977,_0x188ec4){if(_0xc12977){_0x417c8d['UserId']=null;}if(_0x188ec4){_0x417c8d[_0xbe14('0x17')]=![];}return BPromise['resolve']()[_0xbe14('0xc')](cmHopper['rescheduleContact'](_0x417c8d))[_0xbe14('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xbe14('0x18')]=function(_0x3d3608){return BPromise['resolve']()[_0xbe14('0xc')](cmHopper['countReScheduled'](_0x3d3608))[_0xbe14('0x9')](loggerCatch('[countReScheduled]\x20'));};exports[_0xbe14('0x19')]=function(_0x5fa043){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper[_0xbe14('0x19')]({'UserId':null},_0x5fa043,0x1))[_0xbe14('0x9')](loggerCatch('[unlockContact]\x20'));};exports[_0xbe14('0x1a')]=function(_0x1ba46a){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper['unlockContact']({'active':![]},_0x1ba46a,0x1))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x1b')));};exports['crateCustomerReportQueue']=function(_0x3c3613){var _0x3b3e84={};_0x3b3e84[_0xbe14('0x1c')]=_0x3c3613[_0xbe14('0x1c')];_0x3b3e84[_0xbe14('0x1d')]=_0x3c3613[_0xbe14('0x1d')];_0x3b3e84[_0xbe14('0x1e')]=_0x3c3613[_0xbe14('0x1e')];_0x3b3e84[_0xbe14('0x1f')]=_0x3c3613[_0xbe14('0x1f')];_0x3b3e84[_0xbe14('0x20')]=_0x3c3613[_0xbe14('0x20')];_0x3b3e84[_0xbe14('0x21')]=_0x3c3613[_0xbe14('0x22')];_0x3b3e84[_0xbe14('0x23')]=_0x3c3613[_0xbe14('0x22')];_0x3b3e84[_0xbe14('0x24')]=0x1;_0x3b3e84[_0xbe14('0x25')]=_0x3c3613[_0xbe14('0x26')];_0x3b3e84[_0xbe14('0x27')]=_0x3c3613['membername'];_0x3b3e84[_0xbe14('0x28')]='from-sip';_0x3b3e84['exten']=_0xbe14('0x29');_0x3b3e84['holdtime']=0x0;_0x3b3e84[_0xbe14('0x2a')]=0x1;_0x3b3e84[_0xbe14('0x2b')]=_0x3c3613['membername'];_0x3b3e84['queuecallerexitreason']='COMPLETED';return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](voiceQueueReport['create'](_0x3b3e84))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x2c')));};exports[_0xbe14('0x2d')]=function(_0x1aa849,_0x29c23e){return BPromise['resolve']()['then'](cmHopper[_0xbe14('0x2d')](_0x1aa849,_0x29c23e))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x163ef7){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper[_0xbe14('0x16')](_0x163ef7,!![],!![]))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x2e')));}; \ No newline at end of file +var _0x3937=['queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','context','exten','holdtime','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue'];(function(_0x4e75df,_0x54d84d){var _0x504d07=function(_0x3f0193){while(--_0x3f0193){_0x4e75df['push'](_0x4e75df['shift']());}};_0x504d07(++_0x54d84d);}(_0x3937,0xbf));var _0x7393=function(_0x37491f,_0x35bbed){_0x37491f=_0x37491f-0x0;var _0x2ee1e7=_0x3937[_0x37491f];return _0x2ee1e7;};'use strict';var util=require(_0x7393('0x0'));var BPromise=require('bluebird');var logger=require(_0x7393('0x1'))(_0x7393('0x2'));var _=require('lodash');var cmHopper=require(_0x7393('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x7393('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x7393('0x5'));var agentReportPreview=require(_0x7393('0x6'));var voiceQueueReport=require(_0x7393('0x7'));function loggerCatch(_0x1f538f){return function(_0x15eabd){logger[_0x7393('0x8')](_0x1f538f,util[_0x7393('0x9')](_0x15eabd,{'showHidden':![],'depth':null}));};}function create(_0x26668a){return BPromise[_0x7393('0xa')]()['then'](cmHopperHistory['createHistory'](_0x26668a))[_0x7393('0xb')](loggerCatch(_0x7393('0xc')));}function createAgent(_0x1cc3fd){return BPromise['resolve']()[_0x7393('0xd')](agentReportPreview['createHistory'](_0x1cc3fd))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x497b6b){return BPromise[_0x7393('0xa')]()[_0x7393('0xd')](cmHopper[_0x7393('0xe')](_0x497b6b,!![]))['catch'](loggerCatch(_0x7393('0xf')));}exports[_0x7393('0x10')]=function(_0x20fb41){return BPromise[_0x7393('0xa')]()[_0x7393('0xd')](cmHopperBlack[_0x7393('0x10')](_0x20fb41))[_0x7393('0xb')](loggerCatch(_0x7393('0x11')));};exports[_0x7393('0x12')]=function(_0x4e521c){return BPromise['resolve']()[_0x7393('0xd')](cmHopper['getContactPreview'](_0x4e521c))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x7393('0x13')]=function(_0x54dc47,_0x2a1180){create(_0x54dc47)[_0x7393('0xb')](loggerCatch(_0x2a1180));moveContact(_0x54dc47)['catch'](loggerCatch(_0x2a1180));};exports[_0x7393('0x14')]=function(_0x5745cb,_0x5694b6){createAgent(_0x5745cb)[_0x7393('0xb')](loggerCatch(_0x5694b6));};exports[_0x7393('0x15')]=function(_0x1b032c,_0x1dc3e3){create(_0x1b032c)[_0x7393('0xb')](loggerCatch(_0x1dc3e3));};exports[_0x7393('0x16')]=function(_0x21f712,_0x208b9a){moveContact(_0x21f712)['catch'](loggerCatch(_0x208b9a));};exports['rescheduleContact']=function(_0x30eae3,_0x16f617,_0x3979b7){if(_0x16f617){_0x30eae3[_0x7393('0x17')]=null;}if(_0x3979b7){_0x30eae3[_0x7393('0x18')]=![];}return BPromise['resolve']()['then'](cmHopper['rescheduleContact'](_0x30eae3))[_0x7393('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x2bf7a9){return BPromise[_0x7393('0xa')]()['then'](cmHopper[_0x7393('0x19')](_0x2bf7a9))[_0x7393('0xb')](loggerCatch(_0x7393('0x1a')));};exports[_0x7393('0x1b')]=function(_0x3fe456){return BPromise[_0x7393('0xa')]()[_0x7393('0xd')](cmHopper[_0x7393('0x1b')]({'UserId':null},_0x3fe456,0x1))[_0x7393('0xb')](loggerCatch(_0x7393('0x1c')));};exports[_0x7393('0x1d')]=function(_0x123ab4){return BPromise[_0x7393('0xa')]()['then'](cmHopper[_0x7393('0x1b')]({'active':![]},_0x123ab4,0x1))[_0x7393('0xb')](loggerCatch(_0x7393('0x1e')));};exports[_0x7393('0x1f')]=function(_0x1013aa){var _0xd8dfae={};_0xd8dfae['type']=_0x1013aa[_0x7393('0x20')];_0xd8dfae['uniqueid']=_0x1013aa[_0x7393('0x21')];_0xd8dfae['calleridnum']=_0x1013aa[_0x7393('0x22')];_0xd8dfae[_0x7393('0x23')]=_0x1013aa[_0x7393('0x23')];_0xd8dfae[_0x7393('0x24')]=_0x1013aa[_0x7393('0x24')];_0xd8dfae[_0x7393('0x25')]=_0x1013aa[_0x7393('0x26')];_0xd8dfae[_0x7393('0x27')]=_0x1013aa[_0x7393('0x26')];_0xd8dfae[_0x7393('0x28')]=0x1;_0xd8dfae[_0x7393('0x29')]=_0x1013aa[_0x7393('0x2a')];_0xd8dfae['connectedlinename']=_0x1013aa['membername'];_0xd8dfae[_0x7393('0x2b')]='from-sip';_0xd8dfae[_0x7393('0x2c')]='xcally-motion-preview';_0xd8dfae[_0x7393('0x2d')]=0x0;_0xd8dfae['assigned']=0x1;_0xd8dfae[_0x7393('0x2e')]=_0x1013aa[_0x7393('0x2f')];_0xd8dfae[_0x7393('0x30')]=_0x7393('0x31');return BPromise[_0x7393('0xa')]()[_0x7393('0xd')](voiceQueueReport[_0x7393('0x32')](_0xd8dfae))[_0x7393('0xb')](loggerCatch(_0x7393('0x33')));};exports[_0x7393('0x34')]=function(_0x585d47,_0x17e110){return BPromise['resolve']()[_0x7393('0xd')](cmHopper['getContactRecallMe'](_0x585d47,_0x17e110))[_0x7393('0xb')](loggerCatch(_0x7393('0x35')));};exports[_0x7393('0x36')]=function(_0x308cfb){return BPromise[_0x7393('0xa')]()['then'](cmHopper[_0x7393('0x37')](_0x308cfb,!![],!![]))['catch'](loggerCatch(_0x7393('0x38')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index fb4c5b7..1517d00 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 _0x9413=['diff','seconds','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','calleridname','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','updatedAt','%s%s','toUpper','toLowerVariables','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','answertime','RECALL','BOOKED','uniqueid','originate','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','minutes','ContactId','ListId','decrementTalkink','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','channelAgent','not_inuse','status','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','countnoanswerretry','countglobal','callbackuniqueid','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-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds'];(function(_0x3dbb87,_0x47419d){var _0x141ca0=function(_0x3c101c){while(--_0x3c101c){_0x3dbb87['push'](_0x3dbb87['shift']());}};_0x141ca0(++_0x47419d);}(_0x9413,0x85));var _0x3941=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0x9413[_0x26bcec];return _0x1049dc;};'use strict';var util=require('util');var _=require(_0x3941('0x0'));var moment=require(_0x3941('0x1'));var logger=require(_0x3941('0x2'))(_0x3941('0x3'));var ipAgi=process[_0x3941('0x4')][_0x3941('0x5')]||'127.0.0.1';function getSeconds(_0x300e49,_0x4f35d1){var _0x17639e=moment(_0x300e49)[_0x3941('0x6')](0x0);var _0x338071=moment(_0x4f35d1)['milliseconds'](0x0);return _0x17639e[_0x3941('0x7')](_0x338071,_0x3941('0x8'));}exports[_0x3941('0x9')]=function(_0x26cc76){return function(_0x507968){logger['error'](_0x26cc76,util[_0x3941('0xa')](_0x507968,{'showHidden':![],'depth':null}));};};exports[_0x3941('0xb')]=function(_0x4dd784,_0x494bbe){logger[_0x3941('0xc')](_0x4dd784,util[_0x3941('0xa')](_0x494bbe,{'showHidden':![],'depth':null}));};exports[_0x3941('0xd')]=function(_0xdfddad,_0x3b3685){logger[_0x3941('0xe')](_0xdfddad,util[_0x3941('0xa')](_0x3b3685,{'showHidden':![],'depth':null}));};exports[_0x3941('0xf')]=function(_0x443bdf){return function(_0x2d4a61){logger[_0x3941('0xc')](_0x443bdf,util[_0x3941('0xa')](_0x2d4a61,{'showHidden':![],'depth':null}));};};exports[_0x3941('0x10')]=function(_0x2b2f05,_0x3c4fd2,_0x140c84){return{'message':_0x2b2f05,'unlock':_0x3c4fd2,'active':_0x140c84};};exports[_0x3941('0x11')]=function(_0x5d4cdf,_0x407976,_0x2c5f71){if(!_[_0x3941('0x12')](_0x2c5f71)&&_0x3941('0x13')===typeof _0x2c5f71&&!_[_0x3941('0x14')](_0x2c5f71)){if(!_[_0x3941('0x12')](_0x407976)&&_0x3941('0x13')===typeof _0x407976&&!_[_0x3941('0x14')](_0x407976)){return util['format']('\x22%s\x22\x20<%s>',_0x407976,_0x2c5f71);}return util[_0x3941('0x15')](_0x3941('0x16'),_0x2c5f71,_0x2c5f71);}if(!_[_0x3941('0x12')](_0x5d4cdf)&&_0x3941('0x13')===typeof _0x5d4cdf&&!_['isEmpty'](_0x5d4cdf)){return _0x5d4cdf;}return _0x3941('0x17');};exports[_0x3941('0x18')]=function(_0x2b97d8){if(_[_0x3941('0x19')](_0x2b97d8)){return![];}return _0x2b97d8;};exports['addVariables']=function(_0x39f98d,_0x55aec2,_0x53d30a,_0x5b9e68,_0x39d9f0,_0x77b29f){var _0x26424c={'XMD-QUEUE':_0x55aec2['Queue']?_0x55aec2[_0x3941('0x1a')]['name']:'','XMD-CALLERID':_0x5b9e68,'XMD-CALLERID-PREVIEW':_0x77b29f?util[_0x3941('0x15')](_0x3941('0x16'),_0x77b29f[_0x3941('0x1b')],_0x77b29f['calleridnum']):_0x5b9e68,'XMD-DIALID':_0x39d9f0,'XMD-CONTACTID':_0x55aec2['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5b9e68,'XMD-VOICEQUEUEID':_0x55aec2[_0x3941('0x1c')],'XMD-DIALCHANNEL':_0x53d30a,'XMD-DIALTIMEOUT':_0x39f98d[_0x3941('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x3941('0x1e'),_0x39f98d[_0x3941('0x1f')]?'g':'',_[_0x3941('0x14')](_0x39f98d[_0x3941('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x39f98d['dialPreviewUrl']||'','XMD-AGI':_0x39f98d[_0x3941('0x21')]?util[_0x3941('0x15')](_0x3941('0x22'),ipAgi,_0x39f98d[_0x3941('0x21')]):'NONE','XMD-AGIAFTER':_0x39f98d[_0x3941('0x1f')]?util[_0x3941('0x15')](_0x3941('0x22'),ipAgi,_0x39f98d[_0x3941('0x1f')]):_0x3941('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x77b29f?_0x77b29f[_0x3941('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x77b29f?_0x77b29f[_0x3941('0x25')]:'','XMD-DESTINATION':_0x3941('0x26')};if(!_[_0x3941('0x14')](_0x39f98d[_0x3941('0x20')])){_0x26424c[util[_0x3941('0x15')]('%s',_0x3941('0x27'))]=_0x39f98d[_0x3941('0x20')];_0x26424c[util['format']('%s',_0x3941('0x28'))]=_0x39d9f0;}if(_0x55aec2&&_0x55aec2['Contact']){for(var _0x2e6b00 in _0x55aec2[_0x3941('0x29')]){if(_0x55aec2['Contact']['hasOwnProperty'](_0x2e6b00)){if(!_[_0x3941('0x19')](_0x55aec2[_0x3941('0x29')][_0x2e6b00])&&_0x2e6b00!=='id'&&_0x2e6b00!=='tags'&&_0x2e6b00!=='createdAt'&&_0x2e6b00!==_0x3941('0x2a')){_0x26424c[util[_0x3941('0x15')](_0x3941('0x2b'),'XMD-',_[_0x3941('0x2c')](_0x2e6b00))]=_0x55aec2[_0x3941('0x29')][_0x2e6b00];}}}}return _0x26424c;};exports[_0x3941('0x2d')]=function(_0x459ada){var _0x482a08={};for(var _0x1923fb in _0x459ada){if(_0x459ada[_0x3941('0x2e')](_0x1923fb)){_0x482a08[util[_0x3941('0x15')]('%s',_['toLower'](_0x1923fb))]=_0x459ada[_0x1923fb];}}return{'variables':_0x482a08};};exports['updateOriginated']=function(_0x43d18e,_0x1deda6){if(!_[_0x3941('0x19')](_0x43d18e)){if(_0x43d18e[_0x3941('0x2e')]('originated')){if(_0x43d18e[_0x3941('0x2f')]>0x0){_0x43d18e[_0x3941('0x2f')]-=0x1;}else{logger['error'](_0x3941('0x30'),_0x1deda6);}}}else{logger[_0x3941('0xe')](_0x3941('0x31'),_0x1deda6);}};exports['logBlacklist']=function(_0xc93b2){var _0x3a4353=moment()[_0x3941('0x15')](_0x3941('0x32'));_0xc93b2[_0x3941('0x33')]=0xd;_0xc93b2['statedesc']=_0x3941('0x34');_0xc93b2[_0x3941('0x35')]=_0x3a4353;_0xc93b2[_0x3941('0x36')]=_0x3a4353;_0xc93b2[_0x3941('0x37')]=_0x3a4353;};exports[_0x3941('0x38')]=function(_0x3ab23d,_0x35ed17,_0x140e22){var _0x5d0026=moment()['format'](_0x3941('0x32'));_0x3ab23d['state']=_0x35ed17;_0x3ab23d[_0x3941('0x39')]=_0x140e22;_0x3ab23d[_0x3941('0x36')]=_0x5d0026;_0x3ab23d[_0x3941('0x3a')]=getSeconds(_0x3ab23d[_0x3941('0x36')],_0x3ab23d['starttime']);};exports[_0x3941('0x3b')]=function(_0xf1c4a7,_0xa13ad3,_0x41fd9f){_0xf1c4a7[_0x3941('0x3c')]=_0xa13ad3;_0xf1c4a7[_0x3941('0x3d')]=_0x41fd9f;};exports[_0x3941('0x3e')]=function(_0x4d733d,_0x11e36b,_0x1e10c3){var _0x93286a=moment()[_0x3941('0x15')](_0x3941('0x32'));_0x4d733d[_0x3941('0x33')]=_0x11e36b;_0x4d733d[_0x3941('0x39')]=_0x1e10c3;_0x4d733d[_0x3941('0x36')]=_0x4d733d['responsetime']?_0x4d733d[_0x3941('0x36')]:_0x93286a;_0x4d733d['endtime']=_0x4d733d[_0x3941('0x37')]?_0x4d733d[_0x3941('0x37')]:_0x93286a;_0x4d733d['ringtime']=getSeconds(_0x4d733d[_0x3941('0x36')]||0x0,_0x4d733d[_0x3941('0x35')]||0x0);_0x4d733d['talktime']=_0x4d733d['answertime']?getSeconds(_0x4d733d['endtime'],_0x4d733d[_0x3941('0x3f')]):0x0;};exports['isFailure']=function(_0x47311a){return _0x47311a==='Failure';};exports['variablesAction']=function(_0x173a91,_0x4b368d,_0x227897,_0x1f6955,_0x5ba180){var _0xd1a24f=_0x1f6955?_0x3941('0x40'):_0x173a91['calleridname'];_0xd1a24f=_0x5ba180?_0x3941('0x41'):_0xd1a24f;return{'actionid':_0x173a91[_0x3941('0x42')],'action':_0x3941('0x43'),'channel':_0x173a91['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0xd1a24f,_0x173a91[_0x3941('0x44')]),'Exten':'xcally-motion-preview','Context':_0x3941('0x45'),'Priority':'1','variable':_0x227897,'timeout':(_0x4b368d[_0x3941('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x173a91[_0x3941('0x42')]};};exports[_0x3941('0x47')]=function(_0x201061){return _0x201061[_0x3941('0x48')]+_0x201061[_0x3941('0x49')]+_0x201061['countnoanswerretry']+_0x201061[_0x3941('0x4a')]+_0x201061[_0x3941('0x4b')];};exports[_0x3941('0x4c')]=function(_0x2e7b4b){var _0xfa1295=_[_0x3941('0x4d')](_0x2e7b4b);_0xfa1295[_0x3941('0x33')]=0xf;_0xfa1295['statedesc']='Global';return _0xfa1295;};exports[_0x3941('0x4e')]=function(_0x14c213,_0x48e774,_0x478013){var _0x1d15ed={};_0x1d15ed[_0x48e774]=_0x14c213[_0x48e774];_0x1d15ed[_0x3941('0x4f')]=![];_0x1d15ed['scheduledat']=moment()['add'](_0x478013,_0x3941('0x50'))[_0x3941('0x15')](_0x3941('0x32'));_0x1d15ed[_0x3941('0x51')]=_0x14c213[_0x3941('0x51')];_0x1d15ed[_0x3941('0x52')]=_0x14c213[_0x3941('0x52')];_0x1d15ed[_0x3941('0x1c')]=_0x14c213[_0x3941('0x1c')]||undefined;return _0x1d15ed;};exports[_0x3941('0x53')]=function(_0x55fc47,_0x148d18){if(!_['isNil'](_0x55fc47)){if(_0x55fc47['pTalking']>0x0){_0x55fc47['pTalking']-=0x1;}else{logger[_0x3941('0xe')](_0x148d18,_0x3941('0x54'));}}else{logger[_0x3941('0xe')](_0x148d18,_0x3941('0x55'));}};exports[_0x3941('0x56')]=function(_0x4ff214){if(_0x4ff214<=0x0){return!![];}return![];};exports[_0x3941('0x57')]=function(_0x17577c,_0x46b144,_0x244585){_0x17577c[_0x3941('0x58')]=_0x46b144;_0x17577c[_0x3941('0x59')]=_0x17577c[_0x3941('0x5a')];_0x17577c['interface']=_0x17577c['channelAgent'];if(_0x244585){_0x17577c['mandatoryDisposition']=_0x244585['mandatoryDisposition'];}return _0x17577c;};exports['buildAcw']=function(_0x1f3390){var _0xa2de96={};_0xa2de96['queue']=_0x1f3390[_0x3941('0x5a')];_0xa2de96[_0x3941('0x5b')]=_0x1f3390[_0x3941('0x5c')];_0xa2de96['uniqueid']=_0x1f3390[_0x3941('0x42')];return _0xa2de96;};exports['agentReadyId']=function(_0x2c7ab8){var _0x555787=[];for(var _0x511700 in _0x2c7ab8){if(_0x2c7ab8[_0x3941('0x2e')](_0x511700)){if(!_['isNil'](_0x2c7ab8[_0x511700])&&_0x2c7ab8[_0x511700][_0x3941('0x33')]===_0x3941('0x5d')&&_0x2c7ab8[_0x511700][_0x3941('0x5e')]==='reachable'){_0x555787['push'](_0x2c7ab8[_0x511700]['id']);}}}return _0x555787;};exports[_0x3941('0x5f')]=function(_0x1d259d){var _0x446042=moment()[_0x3941('0x6')](0x0);var _0x52a864=moment(_0x1d259d)[_0x3941('0x6')](0x0);return _0x446042[_0x3941('0x7')](_0x52a864,_0x3941('0x8'));};exports[_0x3941('0x60')]=function(_0x524644){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x524644['ContactId'],'ListId':_0x524644[_0x3941('0x52')],'VoiceQueueId':_0x524644[_0x3941('0x1c')]||undefined,'CampaignId':_0x524644[_0x3941('0x61')]||undefined};};exports[_0x3941('0x62')]=function(_0x53e15d){if(_0x53e15d===_0x3941('0x42')||_0x53e15d===_0x3941('0x63')||_0x53e15d==='queue'||_0x53e15d===_0x3941('0x64')||_0x53e15d===_0x3941('0x65')||_0x53e15d==='dialAnswer'||_0x53e15d==='membername'||_0x53e15d===_0x3941('0x5c')||_0x53e15d===_0x3941('0x1b')||_0x53e15d===_0x3941('0x4f')||_0x53e15d===_0x3941('0x44')||_0x53e15d==='scheduledat'||_0x53e15d==='countbusyretry'||_0x53e15d==='countcongestionretry'||_0x53e15d===_0x3941('0x66')||_0x53e15d===_0x3941('0x67')||_0x53e15d==='callback'||_0x53e15d===_0x3941('0x68')||_0x53e15d===_0x3941('0x69')||_0x53e15d===_0x3941('0x6a')||_0x53e15d==='ContactId'||_0x53e15d===_0x3941('0x52')||_0x53e15d===_0x3941('0x3d')||_0x53e15d===_0x3941('0x1c')||_0x53e15d===_0x3941('0x6b')||_0x53e15d===_0x3941('0x6c')||_0x53e15d===_0x3941('0x6d')||_0x53e15d===_0x3941('0x6e')||_0x53e15d===_0x3941('0x6f')||_0x53e15d===_0x3941('0x70')||_0x53e15d===_0x3941('0x71')||_0x53e15d===_0x3941('0x72')||_0x53e15d===_0x3941('0x73')||_0x53e15d===_0x3941('0x74')||_0x53e15d===_0x3941('0x75')||_0x53e15d===_0x3941('0x76')||_0x53e15d===_0x3941('0x77')||_0x53e15d===_0x3941('0x78')||_0x53e15d===_0x3941('0x79')||_0x53e15d===_0x3941('0x7a')||_0x53e15d===_0x3941('0x7b')||_0x53e15d===_0x3941('0x7c')||_0x53e15d===_0x3941('0x7d')||_0x53e15d===_0x3941('0x7e')||_0x53e15d===_0x3941('0x7f')||_0x53e15d===_0x3941('0x80')||_0x53e15d===_0x3941('0x81')||_0x53e15d===_0x3941('0x7a')||_0x53e15d===_0x3941('0x7b')||_0x53e15d===_0x3941('0x7c')||_0x53e15d==='rtpaudioqosjitterbridged'||_0x53e15d===_0x3941('0x7e')||_0x53e15d===_0x3941('0x7f')||_0x53e15d===_0x3941('0x80')||_0x53e15d===_0x3941('0x81')||_0x53e15d===_0x3941('0x82')||_0x53e15d===_0x3941('0x83')||_0x53e15d==='state'||_0x53e15d==='statedesc'){return![];}return!![];};exports[_0x3941('0x84')]=function(_0x2202d6,_0xe88460){var _0x184841,_0x269497,_0x4e1a77;if(_0xe88460<=0x0){_0xe88460=0x1;}_0x184841=new RegExp(_0x3941('0x85')+_0xe88460+'}$');_0x269497=Math[_0x3941('0x86')](0xa,_0xe88460-0x1);_0x4e1a77=Math[_0x3941('0x86')](0xa,_0xe88460)-0x1;return util['format']('%s',_[_0x3941('0x87')](_0x2202d6,_0x184841,_[_0x3941('0x88')](_0x269497,_0x4e1a77)));};exports[_0x3941('0x89')]=function(_0x2e23b1){var _0x4ccc66=_0x2e23b1[_0x3941('0x8a')](/"(.*?)"/);return _0x4ccc66?_0x4ccc66[0x1]:_0x2e23b1;};exports[_0x3941('0x8b')]=function(_0x5c3925){var _0x19b25e=_0x5c3925[_0x3941('0x8a')](/<(.*?)>/);return _0x19b25e?_0x19b25e[0x1]:_0x5c3925;}; \ No newline at end of file +var _0xc63f=['answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','clone','Global','active','scheduledat','add','ContactId','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','name','queue','interface','mandatoryDisposition','agentReadyId','not_inuse','status','push','getDiff','seconds','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','countnoanswerretry','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','calleridname','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','XMD-','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','logCustomer','talktime'];(function(_0x47e1c9,_0x3884f3){var _0x5e4ebb=function(_0x4d5b43){while(--_0x4d5b43){_0x47e1c9['push'](_0x47e1c9['shift']());}};_0x5e4ebb(++_0x3884f3);}(_0xc63f,0x1e2));var _0xfc63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc63f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xfc63('0x0'));var _=require(_0xfc63('0x1'));var moment=require(_0xfc63('0x2'));var logger=require(_0xfc63('0x3'))(_0xfc63('0x4'));var ipAgi=process[_0xfc63('0x5')][_0xfc63('0x6')]||_0xfc63('0x7');function getSeconds(_0x11e013,_0x5952e3){var _0x1dfe6d=moment(_0x11e013)[_0xfc63('0x8')](0x0);var _0x22ee9e=moment(_0x5952e3)['milliseconds'](0x0);return _0x1dfe6d[_0xfc63('0x9')](_0x22ee9e,'seconds');}exports['loggerCatch']=function(_0x474bd4){return function(_0x25d31f){logger[_0xfc63('0xa')](_0x474bd4,util[_0xfc63('0xb')](_0x25d31f,{'showHidden':![],'depth':null}));};};exports[_0xfc63('0xc')]=function(_0x250555,_0x300bf3){logger[_0xfc63('0xd')](_0x250555,util[_0xfc63('0xb')](_0x300bf3,{'showHidden':![],'depth':null}));};exports[_0xfc63('0xe')]=function(_0x34629e,_0x229882){logger['error'](_0x34629e,util[_0xfc63('0xb')](_0x229882,{'showHidden':![],'depth':null}));};exports[_0xfc63('0xf')]=function(_0x5dcf1d){return function(_0x3abfac){logger[_0xfc63('0xd')](_0x5dcf1d,util['inspect'](_0x3abfac,{'showHidden':![],'depth':null}));};};exports[_0xfc63('0x10')]=function(_0x2b9ab8,_0x54232a,_0x2ca618){return{'message':_0x2b9ab8,'unlock':_0x54232a,'active':_0x2ca618};};exports[_0xfc63('0x11')]=function(_0x2d6a95,_0x49b9de,_0x2e4af2){if(!_['isUndefined'](_0x2e4af2)&&'string'===typeof _0x2e4af2&&!_['isEmpty'](_0x2e4af2)){if(!_[_0xfc63('0x12')](_0x49b9de)&&_0xfc63('0x13')===typeof _0x49b9de&&!_[_0xfc63('0x14')](_0x49b9de)){return util[_0xfc63('0x15')](_0xfc63('0x16'),_0x49b9de,_0x2e4af2);}return util[_0xfc63('0x15')](_0xfc63('0x16'),_0x2e4af2,_0x2e4af2);}if(!_[_0xfc63('0x12')](_0x2d6a95)&&_0xfc63('0x13')===typeof _0x2d6a95&&!_['isEmpty'](_0x2d6a95)){return _0x2d6a95;}return _0xfc63('0x17');};exports[_0xfc63('0x18')]=function(_0x17e98a){if(_[_0xfc63('0x19')](_0x17e98a)){return![];}return _0x17e98a;};exports[_0xfc63('0x1a')]=function(_0x25d82b,_0x5a1796,_0x4218c8,_0xfbfea5,_0x483bad,_0x5e7a3a){var _0x557a51={'XMD-QUEUE':_0x5a1796['Queue']?_0x5a1796['Queue']['name']:'','XMD-CALLERID':_0xfbfea5,'XMD-CALLERID-PREVIEW':_0x5e7a3a?util[_0xfc63('0x15')](_0xfc63('0x16'),_0x5e7a3a[_0xfc63('0x1b')],_0x5e7a3a['calleridnum']):_0xfbfea5,'XMD-DIALID':_0x483bad,'XMD-CONTACTID':_0x5a1796['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xfbfea5,'XMD-VOICEQUEUEID':_0x5a1796['VoiceQueueId'],'XMD-DIALCHANNEL':_0x4218c8,'XMD-DIALTIMEOUT':_0x25d82b[_0xfc63('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xfc63('0x15')]('\x22rtTxX%s%s\x22',_0x25d82b[_0xfc63('0x1d')]?'g':'',_[_0xfc63('0x14')](_0x25d82b[_0xfc63('0x1e')])?'':_0xfc63('0x1f')),'XMD-DIALURL':_0x25d82b['dialPreviewUrl']||'','XMD-AGI':_0x25d82b[_0xfc63('0x20')]?util[_0xfc63('0x15')](_0xfc63('0x21'),ipAgi,_0x25d82b[_0xfc63('0x20')]):'NONE','XMD-AGIAFTER':_0x25d82b['dialQueueProject2']?util['format'](_0xfc63('0x21'),ipAgi,_0x25d82b[_0xfc63('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x5e7a3a?_0x5e7a3a[_0xfc63('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x5e7a3a?_0x5e7a3a[_0xfc63('0x23')]:'','XMD-DESTINATION':_0xfc63('0x24')};if(!_[_0xfc63('0x14')](_0x25d82b[_0xfc63('0x1e')])){_0x557a51[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x25d82b[_0xfc63('0x1e')];_0x557a51[util[_0xfc63('0x15')]('%s',_0xfc63('0x25'))]=_0x483bad;}if(_0x5a1796&&_0x5a1796[_0xfc63('0x26')]){for(var _0x574637 in _0x5a1796[_0xfc63('0x26')]){if(_0x5a1796[_0xfc63('0x26')][_0xfc63('0x27')](_0x574637)){if(!_[_0xfc63('0x19')](_0x5a1796[_0xfc63('0x26')][_0x574637])&&_0x574637!=='id'&&_0x574637!=='tags'&&_0x574637!==_0xfc63('0x28')&&_0x574637!=='updatedAt'){_0x557a51[util[_0xfc63('0x15')]('%s%s',_0xfc63('0x29'),_[_0xfc63('0x2a')](_0x574637))]=_0x5a1796[_0xfc63('0x26')][_0x574637];}}}}return _0x557a51;};exports['toLowerVariables']=function(_0x4cf381){var _0x87b9b0={};for(var _0x4854f0 in _0x4cf381){if(_0x4cf381[_0xfc63('0x27')](_0x4854f0)){_0x87b9b0[util['format']('%s',_[_0xfc63('0x2b')](_0x4854f0))]=_0x4cf381[_0x4854f0];}}return{'variables':_0x87b9b0};};exports[_0xfc63('0x2c')]=function(_0x1c787d,_0x29bd66){if(!_['isNil'](_0x1c787d)){if(_0x1c787d[_0xfc63('0x27')](_0xfc63('0x2d'))){if(_0x1c787d['originated']>0x0){_0x1c787d[_0xfc63('0x2d')]-=0x1;}else{logger['error'](_0xfc63('0x2e'),_0x29bd66);}}}else{logger[_0xfc63('0xa')](_0xfc63('0x2f'),_0x29bd66);}};exports[_0xfc63('0x30')]=function(_0x5ea471){var _0x39cc5b=moment()[_0xfc63('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x5ea471[_0xfc63('0x31')]=0xd;_0x5ea471[_0xfc63('0x32')]='Blacklist';_0x5ea471[_0xfc63('0x33')]=_0x39cc5b;_0x5ea471[_0xfc63('0x34')]=_0x39cc5b;_0x5ea471[_0xfc63('0x35')]=_0x39cc5b;};exports[_0xfc63('0x36')]=function(_0x3fc2c1,_0x1d3188,_0x21d1ba){var _0x2f1017=moment()['format'](_0xfc63('0x37'));_0x3fc2c1['state']=_0x1d3188;_0x3fc2c1[_0xfc63('0x32')]=_0x21d1ba;_0x3fc2c1[_0xfc63('0x34')]=_0x2f1017;_0x3fc2c1[_0xfc63('0x38')]=getSeconds(_0x3fc2c1['responsetime'],_0x3fc2c1[_0xfc63('0x33')]);};exports[_0xfc63('0x39')]=function(_0x908ef3,_0x1483e6,_0x5cd106){_0x908ef3[_0xfc63('0x3a')]=_0x1483e6;_0x908ef3[_0xfc63('0x3b')]=_0x5cd106;};exports[_0xfc63('0x3c')]=function(_0x41f30a,_0x3bf1dd,_0x1fc6af){var _0x48ffeb=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x41f30a[_0xfc63('0x31')]=_0x3bf1dd;_0x41f30a['statedesc']=_0x1fc6af;_0x41f30a[_0xfc63('0x34')]=_0x41f30a['responsetime']?_0x41f30a[_0xfc63('0x34')]:_0x48ffeb;_0x41f30a[_0xfc63('0x35')]=_0x41f30a[_0xfc63('0x35')]?_0x41f30a['endtime']:_0x48ffeb;_0x41f30a[_0xfc63('0x38')]=getSeconds(_0x41f30a[_0xfc63('0x34')]||0x0,_0x41f30a[_0xfc63('0x33')]||0x0);_0x41f30a[_0xfc63('0x3d')]=_0x41f30a[_0xfc63('0x3e')]?getSeconds(_0x41f30a[_0xfc63('0x35')],_0x41f30a[_0xfc63('0x3e')]):0x0;};exports[_0xfc63('0x3f')]=function(_0x149be8){return _0x149be8===_0xfc63('0x40');};exports[_0xfc63('0x41')]=function(_0x230e3e,_0x28199e,_0xcb3ce4,_0x2e6e46,_0x4befe3){var _0x139675=_0x2e6e46?_0xfc63('0x42'):_0x230e3e[_0xfc63('0x1b')];_0x139675=_0x4befe3?_0xfc63('0x43'):_0x139675;return{'actionid':_0x230e3e[_0xfc63('0x44')],'action':_0xfc63('0x45'),'channel':_0x230e3e[_0xfc63('0x46')],'callerid':util[_0xfc63('0x15')](_0xfc63('0x16'),_0x139675,_0x230e3e[_0xfc63('0x47')]),'Exten':_0xfc63('0x24'),'Context':_0xfc63('0x48'),'Priority':'1','variable':_0xcb3ce4,'timeout':(_0x28199e['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x230e3e[_0xfc63('0x44')]};};exports[_0xfc63('0x49')]=function(_0x28dc0c){return _0x28dc0c[_0xfc63('0x4a')]+_0x28dc0c[_0xfc63('0x4b')]+_0x28dc0c['countnoanswerretry']+_0x28dc0c['countagentrejectretry']+_0x28dc0c[_0xfc63('0x4c')];};exports['cloneAction']=function(_0x15031){var _0x3ed4d4=_[_0xfc63('0x4d')](_0x15031);_0x3ed4d4[_0xfc63('0x31')]=0xf;_0x3ed4d4[_0xfc63('0x32')]=_0xfc63('0x4e');return _0x3ed4d4;};exports['scheduledAt']=function(_0xf381c7,_0x5493d7,_0x5520b2){var _0x2d9714={};_0x2d9714[_0x5493d7]=_0xf381c7[_0x5493d7];_0x2d9714[_0xfc63('0x4f')]=![];_0x2d9714[_0xfc63('0x50')]=moment()[_0xfc63('0x51')](_0x5520b2,'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2d9714['ContactId']=_0xf381c7[_0xfc63('0x52')];_0x2d9714[_0xfc63('0x53')]=_0xf381c7[_0xfc63('0x53')];_0x2d9714[_0xfc63('0x54')]=_0xf381c7[_0xfc63('0x54')]||undefined;return _0x2d9714;};exports['decrementTalkink']=function(_0x5e6fee,_0x40810c){if(!_['isNil'](_0x5e6fee)){if(_0x5e6fee['pTalking']>0x0){_0x5e6fee[_0xfc63('0x55')]-=0x1;}else{logger[_0xfc63('0xa')](_0x40810c,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xfc63('0xa')](_0x40810c,_0xfc63('0x56'));}};exports['IsNotLoggedIn']=function(_0x2464f9){if(_0x2464f9<=0x0){return!![];}return![];};exports[_0xfc63('0x57')]=function(_0x29d534,_0x3fd54b,_0x14be9e){_0x29d534['lastevent']=_0x3fd54b;_0x29d534[_0xfc63('0x58')]=_0x29d534[_0xfc63('0x59')];_0x29d534[_0xfc63('0x5a')]=_0x29d534[_0xfc63('0x46')];if(_0x14be9e){_0x29d534['mandatoryDisposition']=_0x14be9e[_0xfc63('0x5b')];}return _0x29d534;};exports['buildAcw']=function(_0x5f5932){var _0xed0dfb={};_0xed0dfb[_0xfc63('0x59')]=_0x5f5932['queue'];_0xed0dfb['interface']=_0x5f5932['channelAgent'];_0xed0dfb[_0xfc63('0x44')]=_0x5f5932['uniqueid'];return _0xed0dfb;};exports[_0xfc63('0x5c')]=function(_0x3750ef){var _0x4fc4fd=[];for(var _0x319a78 in _0x3750ef){if(_0x3750ef[_0xfc63('0x27')](_0x319a78)){if(!_['isNil'](_0x3750ef[_0x319a78])&&_0x3750ef[_0x319a78]['state']===_0xfc63('0x5d')&&_0x3750ef[_0x319a78][_0xfc63('0x5e')]==='reachable'){_0x4fc4fd[_0xfc63('0x5f')](_0x3750ef[_0x319a78]['id']);}}}return _0x4fc4fd;};exports[_0xfc63('0x60')]=function(_0x41e643){var _0x8754a5=moment()[_0xfc63('0x8')](0x0);var _0x5ed01c=moment(_0x41e643)[_0xfc63('0x8')](0x0);return _0x8754a5[_0xfc63('0x9')](_0x5ed01c,_0xfc63('0x61'));};exports[_0xfc63('0x62')]=function(_0xcf79d7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xcf79d7[_0xfc63('0x52')],'ListId':_0xcf79d7[_0xfc63('0x53')],'VoiceQueueId':_0xcf79d7[_0xfc63('0x54')]||undefined,'CampaignId':_0xcf79d7[_0xfc63('0x63')]||undefined};};exports['filterKey']=function(_0x25f2b8){if(_0x25f2b8===_0xfc63('0x44')||_0x25f2b8===_0xfc63('0x64')||_0x25f2b8===_0xfc63('0x59')||_0x25f2b8===_0xfc63('0x65')||_0x25f2b8===_0xfc63('0x66')||_0x25f2b8===_0xfc63('0x67')||_0x25f2b8===_0xfc63('0x3a')||_0x25f2b8==='channelAgent'||_0x25f2b8==='calleridname'||_0x25f2b8===_0xfc63('0x4f')||_0x25f2b8===_0xfc63('0x47')||_0x25f2b8==='scheduledat'||_0x25f2b8===_0xfc63('0x4a')||_0x25f2b8===_0xfc63('0x4b')||_0x25f2b8===_0xfc63('0x68')||_0x25f2b8===_0xfc63('0x69')||_0x25f2b8===_0xfc63('0x6a')||_0x25f2b8==='callbackuniqueid'||_0x25f2b8===_0xfc63('0x6b')||_0x25f2b8===_0xfc63('0x6c')||_0x25f2b8===_0xfc63('0x52')||_0x25f2b8===_0xfc63('0x53')||_0x25f2b8===_0xfc63('0x3b')||_0x25f2b8===_0xfc63('0x54')||_0x25f2b8===_0xfc63('0x6d')||_0x25f2b8===_0xfc63('0x6e')||_0x25f2b8===_0xfc63('0x6f')||_0x25f2b8===_0xfc63('0x70')||_0x25f2b8==='xmd-listid'||_0x25f2b8===_0xfc63('0x71')||_0x25f2b8===_0xfc63('0x72')||_0x25f2b8===_0xfc63('0x73')||_0x25f2b8===_0xfc63('0x74')||_0x25f2b8==='xmd-dialchannel'||_0x25f2b8==='xmd-contactid'||_0x25f2b8==='xmd-cdrtype'||_0x25f2b8===_0xfc63('0x75')||_0x25f2b8===_0xfc63('0x76')||_0x25f2b8===_0xfc63('0x77')||_0x25f2b8===_0xfc63('0x78')||_0x25f2b8===_0xfc63('0x79')||_0x25f2b8===_0xfc63('0x7a')||_0x25f2b8===_0xfc63('0x7b')||_0x25f2b8===_0xfc63('0x7c')||_0x25f2b8===_0xfc63('0x7d')||_0x25f2b8===_0xfc63('0x7e')||_0x25f2b8===_0xfc63('0x7f')||_0x25f2b8==='rtpaudioqos'||_0x25f2b8===_0xfc63('0x79')||_0x25f2b8===_0xfc63('0x7a')||_0x25f2b8===_0xfc63('0x7b')||_0x25f2b8===_0xfc63('0x7c')||_0x25f2b8===_0xfc63('0x7d')||_0x25f2b8===_0xfc63('0x7e')||_0x25f2b8===_0xfc63('0x7f')||_0x25f2b8===_0xfc63('0x80')||_0x25f2b8===_0xfc63('0x81')||_0x25f2b8===_0xfc63('0x31')||_0x25f2b8===_0xfc63('0x32')){return![];}return!![];};exports[_0xfc63('0x82')]=function(_0x435956,_0xefb4ab){var _0x36cb11,_0x446dfe,_0x4a597a;if(_0xefb4ab<=0x0){_0xefb4ab=0x1;}_0x36cb11=new RegExp(_0xfc63('0x83')+_0xefb4ab+'}$');_0x446dfe=Math[_0xfc63('0x84')](0xa,_0xefb4ab-0x1);_0x4a597a=Math[_0xfc63('0x84')](0xa,_0xefb4ab)-0x1;return util[_0xfc63('0x15')]('%s',_[_0xfc63('0x85')](_0x435956,_0x36cb11,_['random'](_0x446dfe,_0x4a597a)));};exports[_0xfc63('0x86')]=function(_0x2bde86){var _0x4cbd45=_0x2bde86[_0xfc63('0x87')](/"(.*?)"/);return _0x4cbd45?_0x4cbd45[0x1]:_0x2bde86;};exports['extractCalleridNumber']=function(_0x16fd86){var _0x34c8f7=_0x16fd86[_0xfc63('0x87')](/<(.*?)>/);return _0x34c8f7?_0x34c8f7[0x1]:_0x16fd86;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index c0d65f5..799bba9 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x476962,_0x48d0ad){var _0x24258=function(_0x2c0a53){while(--_0x2c0a53){_0x476962['push'](_0x476962['shift']());}};_0x24258(++_0x48d0ad);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c3c8b,_0x4c4917){_0x4c3c8b=_0x4c3c8b-0x0;var _0x4a154e=_0x5f2f[_0x4c3c8b];return _0x4a154e;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x52cc2d,_0x21d0b2){var _0x403c99=function(_0x2c8085){while(--_0x2c8085){_0x52cc2d['push'](_0x52cc2d['shift']());}};_0x403c99(++_0x21d0b2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c53f9,_0x46b20a){_0x4c53f9=_0x4c53f9-0x0;var _0x1ba961=_0x5f2f[_0x4c53f9];return _0x1ba961;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 1511899..aca9fbd 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 _0x64b7=['initVoiceCallReports','outbound','disposition','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','interface','total','sumHoldTime','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','sumDuration','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','initTelephones','initTrunks','isUndefined','initVoiceQueues','voiceQueues','initTriggers','triggers','initTemplates','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','zohoAccounts','deskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallerleaveAt'];(function(_0x22ee66,_0x4cb001){var _0x127c6f=function(_0x57cb1b){while(--_0x57cb1b){_0x22ee66['push'](_0x22ee66['shift']());}};_0x127c6f(++_0x4cb001);}(_0x64b7,0x78));var _0x764b=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x64b7[_0x1035c1];return _0x308d67;};'use strict';var BPromise=require(_0x764b('0x0'));var util=require(_0x764b('0x1'));var _=require(_0x764b('0x2'));var moment=require(_0x764b('0x3'));var Agent=require(_0x764b('0x4'));var Telephone=require('../model/telephone');var Trunk=require(_0x764b('0x5'));var VoiceQueue=require(_0x764b('0x6'));var Trigger=require(_0x764b('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0x764b('0x8'));var ZendeskAccount=require(_0x764b('0x9'));var SalesforceAccount=require(_0x764b('0xa'));var FreshdeskAccount=require(_0x764b('0xb'));var SugarcrmAccount=require(_0x764b('0xc'));var ZohoAccount=require(_0x764b('0xd'));var DeskAccount=require(_0x764b('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x764b('0xf'));var FreshsalesAccount=require(_0x764b('0x10'));var FaxAccount=require(_0x764b('0x11'));var Realtime=function(){this[_0x764b('0x12')]={};this[_0x764b('0x13')]={};this[_0x764b('0x14')]={};this['voiceQueues']={};this['triggers']={};this['campaigns']={};this[_0x764b('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x764b('0x16')]={};this[_0x764b('0x17')]={};this[_0x764b('0x18')]={};this[_0x764b('0x19')]={};this[_0x764b('0x1a')]={};this['zendeskAccounts']={};this[_0x764b('0x1b')]={};this[_0x764b('0x1c')]={};this[_0x764b('0x1d')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x764b('0x1e')]={};this[_0x764b('0x1f')]={};this[_0x764b('0x20')]={};this[_0x764b('0x21')]={};this[_0x764b('0x22')]={};};function freeIsNotKey(_0x4a5d20,_0x3253cb,_0x50cfcc){var _0x44b2fd=_['mapKeys'](_0x4a5d20,function(_0x5d71e0,_0x416265){return _0x5d71e0[_0x50cfcc];});for(var _0xd9bb40 in _0x3253cb){if(_0x3253cb[_0x764b('0x23')](_0xd9bb40)){if(!_0x44b2fd[_0xd9bb40]){delete _0x3253cb[_0xd9bb40];}}}}function freeIsNotKeySip(_0x3a1e3f,_0x2094a3){var _0x3c665e=_[_0x764b('0x24')](_0x3a1e3f,function(_0x5abfba,_0x23f5cb){return util[_0x764b('0x25')](_0x764b('0x26'),_0x5abfba[_0x764b('0x27')]);});for(var _0x141eda in _0x2094a3){if(_0x2094a3[_0x764b('0x23')](_0x141eda)){if(!_0x3c665e[_0x141eda]){delete _0x2094a3[_0x141eda];}}}}function freeIsNotKeyAgent(_0x1d8839,_0x4c7db2){var _0x20b994=_['mapKeys'](_0x1d8839,function(_0x52ac82,_0x2ee69e){var _0x2c1015=_['isNil'](_0x52ac82['interface'])?util[_0x764b('0x25')](_0x764b('0x26'),_0x52ac82[_0x764b('0x27')]):_0x52ac82[_0x764b('0x28')];return _0x2c1015;});for(var _0x575803 in _0x4c7db2){if(_0x4c7db2[_0x764b('0x23')](_0x575803)){if(!_0x20b994[_0x575803]){delete _0x4c7db2[_0x575803];}}}}function clearVoiceCallReports(_0x871be){_0x871be[_0x764b('0x29')]=0x0;_0x871be['answered']=0x0;_0x871be[_0x764b('0x2a')]=0x0;_0x871be['sumDuration']=0x0;_0x871be['sumBillable']=0x0;}function clearCampaigns(_0x3716d0){if(!_[_0x764b('0x2b')](_0x3716d0)){for(var _0x344c28 in _0x3716d0){if(_0x3716d0['hasOwnProperty'](_0x344c28)){_0x3716d0[_0x344c28][_0x764b('0x2c')]=0x0;_0x3716d0[_0x344c28][_0x764b('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x1b2f17){if(!_[_0x764b('0x2b')](_0x1b2f17)){for(var _0x53bfce in _0x1b2f17){if(_0x1b2f17[_0x764b('0x23')](_0x53bfce)){_0x1b2f17[_0x53bfce]['total']=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x2e')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x2f')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x30')]=0x0;_0x1b2f17[_0x53bfce]['sumHoldTime']=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x31')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x32')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x33')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x34')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x35')]=0x0;_0x1b2f17[_0x53bfce]['outboundCongestionCallsDay']=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x36')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x37')]=0x0;_0x1b2f17[_0x53bfce]['outboundDropCallsDayTimeout']=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x38')]=0x0;_0x1b2f17[_0x53bfce]['outboundBlacklistCallsDay']=0x0;_0x1b2f17[_0x53bfce]['outboundOriginateFailureCallsDay']=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x39')]=0x0;_0x1b2f17[_0x53bfce]['outboundReCallsDay']=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x33')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x3a')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x3b')]=!![];}}}}Realtime[_0x764b('0x3c')][_0x764b('0x3d')]=function(_0x2803c7,_0x5a2484){for(var _0x51b522 in _0x5a2484){if(_0x2803c7[_0x764b('0x23')](_0x51b522)){_0x2803c7[_0x51b522]=_0x5a2484[_0x51b522];}}};Realtime[_0x764b('0x3c')][_0x764b('0x3e')]=function(){var _0x4dc9fc=this;return function(_0x1cc061){if(_0x1cc061){freeIsNotKeyAgent(_0x1cc061,_0x4dc9fc[_0x764b('0x12')]);for(var _0x79ec1e=0x0,_0x11465c={},_0x2a42be={};_0x79ec1e<_0x1cc061[_0x764b('0x3f')];_0x79ec1e+=0x1){_0x11465c=_0x1cc061[_0x79ec1e];var _0x5d928e=_['isNil'](_0x11465c[_0x764b('0x28')])?util['format'](_0x764b('0x26'),_0x11465c['name']):_0x11465c[_0x764b('0x28')];if(_['isUndefined'](_0x4dc9fc['agents'][_0x5d928e])){_0x4dc9fc['agents'][_0x5d928e]=new Agent(_0x11465c);}else{_0x4dc9fc[_0x764b('0x3d')](_0x4dc9fc[_0x764b('0x12')][_0x5d928e],_0x11465c);}}}return _0x4dc9fc[_0x764b('0x12')];};};Realtime['prototype'][_0x764b('0x40')]=function(){var _0x3faead=this;return function(_0x2f9af5){if(_0x2f9af5){freeIsNotKeySip(_0x2f9af5,_0x3faead['telephones']);for(var _0x4d82c9=0x0,_0x2e1457={},_0x40873c={};_0x4d82c9<_0x2f9af5[_0x764b('0x3f')];_0x4d82c9+=0x1){_0x2e1457=_0x2f9af5[_0x4d82c9];if(_['isUndefined'](_0x3faead[_0x764b('0x13')][util[_0x764b('0x25')]('SIP/%s',_0x2e1457[_0x764b('0x27')])])){_0x3faead['telephones'][util[_0x764b('0x25')](_0x764b('0x26'),_0x2e1457['name'])]=new Telephone(_0x2e1457);}else{_0x3faead[_0x764b('0x3d')](_0x3faead[_0x764b('0x13')][util['format'](_0x764b('0x26'),_0x2e1457[_0x764b('0x27')])],_0x2e1457);}}}return _0x3faead['telephones'];};};Realtime['prototype'][_0x764b('0x41')]=function(){var _0x2043fb=this;return function(_0x8cefa4){if(_0x8cefa4){freeIsNotKeySip(_0x8cefa4,_0x2043fb['trunks']);for(var _0x140434=0x0,_0x1262e9={},_0x365e46={};_0x140434<_0x8cefa4[_0x764b('0x3f')];_0x140434+=0x1){_0x1262e9=_0x8cefa4[_0x140434];if(_[_0x764b('0x42')](_0x2043fb['trunks'][util['format'](_0x764b('0x26'),_0x1262e9['name'])])){_0x2043fb[_0x764b('0x14')][util[_0x764b('0x25')](_0x764b('0x26'),_0x1262e9[_0x764b('0x27')])]=new Trunk(_0x1262e9);}else{_0x2043fb[_0x764b('0x3d')](_0x2043fb[_0x764b('0x14')][util['format'](_0x764b('0x26'),_0x1262e9[_0x764b('0x27')])],_0x1262e9);}}}return _0x2043fb['trunks'];};};Realtime[_0x764b('0x3c')][_0x764b('0x43')]=function(){var _0x358885=this;return function(_0x152e7d){if(_0x152e7d){freeIsNotKey(_0x152e7d,_0x358885[_0x764b('0x44')],'name');for(var _0x467f50=0x0,_0xc987e6={},_0x5283ad={};_0x467f50<_0x152e7d[_0x764b('0x3f')];_0x467f50+=0x1){_0xc987e6=_0x152e7d[_0x467f50];if(_['isUndefined'](_0x358885[_0x764b('0x44')][_0xc987e6['name']])){_0x358885[_0x764b('0x44')][_0xc987e6['name']]=new VoiceQueue(_0xc987e6);}else{_0x358885[_0x764b('0x3d')](_0x358885[_0x764b('0x44')][_0xc987e6[_0x764b('0x27')]],_0xc987e6);}}}return _0x358885[_0x764b('0x44')];};};Realtime[_0x764b('0x3c')][_0x764b('0x45')]=function(){var _0x1b9d3a=this;return function(_0x1e8dd6){if(_0x1e8dd6){freeIsNotKey(_0x1e8dd6,_0x1b9d3a[_0x764b('0x46')],'id');for(var _0x669eda=0x0,_0x3b8796={},_0x52ed71={};_0x669eda<_0x1e8dd6[_0x764b('0x3f')];_0x669eda+=0x1){_0x3b8796=_0x1e8dd6[_0x669eda];if(_['isUndefined'](_0x1b9d3a['triggers'][_0x3b8796['id']])){_0x1b9d3a['triggers'][_0x3b8796['id']]=new Trigger(_0x3b8796);}else{_0x1b9d3a[_0x764b('0x3d')](_0x1b9d3a[_0x764b('0x46')][_0x3b8796['id']],_0x3b8796);}}}return _0x1b9d3a[_0x764b('0x46')];};};Realtime[_0x764b('0x3c')][_0x764b('0x47')]=function(){var _0x2b25b8=this;return function(_0x3b8197){if(_0x3b8197){freeIsNotKey(_0x3b8197,_0x2b25b8['templates'],'id');for(var _0x3f41fb=0x0,_0x39f858={},_0x156d61={};_0x3f41fb<_0x3b8197[_0x764b('0x3f')];_0x3f41fb+=0x1){_0x39f858=_0x3b8197[_0x3f41fb];if(_['isUndefined'](_0x2b25b8[_0x764b('0x15')][_0x39f858['id']])){_0x2b25b8['templates'][_0x39f858['id']]=new Template(_0x39f858);}else{_0x2b25b8[_0x764b('0x3d')](_0x2b25b8[_0x764b('0x15')][_0x39f858['id']],_0x39f858);}}}return _0x2b25b8[_0x764b('0x15')];};};Realtime[_0x764b('0x3c')]['initZendeskAccounts']=function(){var _0x44671b=this;return function(_0x1be0c2){if(_0x1be0c2){freeIsNotKey(_0x1be0c2,_0x44671b['zendeskAccounts'],'id');for(var _0x54fcb6=0x0,_0x483bab={},_0x40a769={};_0x54fcb6<_0x1be0c2['length'];_0x54fcb6+=0x1){_0x483bab=_0x1be0c2[_0x54fcb6];if(_[_0x764b('0x42')](_0x44671b[_0x764b('0x48')][_0x483bab['id']])){_0x44671b[_0x764b('0x48')][_0x483bab['id']]=new ZendeskAccount(_0x483bab);}else{_0x44671b[_0x764b('0x3d')](_0x44671b[_0x764b('0x48')][_0x483bab['id']],_0x483bab);}}}return _0x44671b[_0x764b('0x48')];};};Realtime['prototype'][_0x764b('0x49')]=function(){var _0x511b5b=this;return function(_0x3c3445){if(_0x3c3445){freeIsNotKey(_0x3c3445,_0x511b5b['salesforceAccounts'],'id');for(var _0x29c2bd=0x0,_0x56e4d7={},_0xc6b897={};_0x29c2bd<_0x3c3445['length'];_0x29c2bd+=0x1){_0x56e4d7=_0x3c3445[_0x29c2bd];if(_[_0x764b('0x42')](_0x511b5b[_0x764b('0x1b')][_0x56e4d7['id']])){_0x511b5b['salesforceAccounts'][_0x56e4d7['id']]=new SalesforceAccount(_0x56e4d7);}else{_0x511b5b[_0x764b('0x3d')](_0x511b5b[_0x764b('0x1b')][_0x56e4d7['id']],_0x56e4d7);}}}return _0x511b5b[_0x764b('0x1b')];};};Realtime[_0x764b('0x3c')][_0x764b('0x4a')]=function(){var _0x2ace43=this;return function(_0x28e794){if(_0x28e794){freeIsNotKey(_0x28e794,_0x2ace43[_0x764b('0x1d')],'id');for(var _0x322b93=0x0,_0x5d2a5f={},_0x27ae15={};_0x322b93<_0x28e794[_0x764b('0x3f')];_0x322b93+=0x1){_0x5d2a5f=_0x28e794[_0x322b93];if(_[_0x764b('0x42')](_0x2ace43[_0x764b('0x1d')][_0x5d2a5f['id']])){_0x2ace43[_0x764b('0x1d')][_0x5d2a5f['id']]=new FreshdeskAccount(_0x5d2a5f);}else{_0x2ace43[_0x764b('0x3d')](_0x2ace43[_0x764b('0x1d')][_0x5d2a5f['id']],_0x5d2a5f);}}}return _0x2ace43[_0x764b('0x1d')];};};Realtime[_0x764b('0x3c')]['initZohoAccounts']=function(){var _0x4ae5c5=this;return function(_0xb7f4bf){if(_0xb7f4bf){freeIsNotKey(_0xb7f4bf,_0x4ae5c5[_0x764b('0x4b')],'id');for(var _0x55650a=0x0,_0x4d796b={},_0x517eac={};_0x55650a<_0xb7f4bf[_0x764b('0x3f')];_0x55650a+=0x1){_0x4d796b=_0xb7f4bf[_0x55650a];if(_['isUndefined'](_0x4ae5c5['zohoAccounts'][_0x4d796b['id']])){_0x4ae5c5[_0x764b('0x4b')][_0x4d796b['id']]=new ZohoAccount(_0x4d796b);}else{_0x4ae5c5[_0x764b('0x3d')](_0x4ae5c5['zohoAccounts'][_0x4d796b['id']],_0x4d796b);}}}return _0x4ae5c5[_0x764b('0x4b')];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x473978=this;return function(_0x18c5da){if(_0x18c5da){freeIsNotKey(_0x18c5da,_0x473978[_0x764b('0x4c')],'id');for(var _0x4f5faa=0x0,_0x22dc61={},_0x119efc={};_0x4f5faa<_0x18c5da[_0x764b('0x3f')];_0x4f5faa+=0x1){_0x22dc61=_0x18c5da[_0x4f5faa];if(_[_0x764b('0x42')](_0x473978[_0x764b('0x4c')][_0x22dc61['id']])){_0x473978[_0x764b('0x4c')][_0x22dc61['id']]=new DeskAccount(_0x22dc61);}else{_0x473978[_0x764b('0x3d')](_0x473978[_0x764b('0x4c')][_0x22dc61['id']],_0x22dc61);}}}return _0x473978[_0x764b('0x4c')];};};Realtime[_0x764b('0x3c')]['initSugarcrmAccounts']=function(){var _0x24774b=this;return function(_0x2b2434){if(_0x2b2434){freeIsNotKey(_0x2b2434,_0x24774b[_0x764b('0x1c')],'id');for(var _0x476b85=0x0,_0x5c89c0={},_0x190665={};_0x476b85<_0x2b2434['length'];_0x476b85+=0x1){_0x5c89c0=_0x2b2434[_0x476b85];if(_[_0x764b('0x42')](_0x24774b[_0x764b('0x1c')][_0x5c89c0['id']])){_0x24774b[_0x764b('0x1c')][_0x5c89c0['id']]=new SugarcrmAccount(_0x5c89c0);}else{_0x24774b[_0x764b('0x3d')](_0x24774b['sugarcrmAccounts'][_0x5c89c0['id']],_0x5c89c0);}}}return _0x24774b[_0x764b('0x1c')];};};Realtime[_0x764b('0x3c')][_0x764b('0x4d')]=function(){var _0x129387=this;return function(_0xf811bb){if(_0xf811bb){freeIsNotKey(_0xf811bb,_0x129387[_0x764b('0x1e')],'id');for(var _0x3b6554=0x0,_0x186a58={},_0xf84dcf={};_0x3b6554<_0xf811bb[_0x764b('0x3f')];_0x3b6554+=0x1){_0x186a58=_0xf811bb[_0x3b6554];if(_[_0x764b('0x42')](_0x129387[_0x764b('0x1e')][_0x186a58['id']])){_0x129387['vtigerAccounts'][_0x186a58['id']]=new VtigerAccount(_0x186a58);}else{_0x129387[_0x764b('0x3d')](_0x129387[_0x764b('0x1e')][_0x186a58['id']],_0x186a58);}}}return _0x129387[_0x764b('0x1e')];};};Realtime['prototype'][_0x764b('0x4e')]=function(){var _0x5e6e35=this;return function(_0x59a53f){if(_0x59a53f){freeIsNotKey(_0x59a53f,_0x5e6e35['servicenowAccounts'],'id');for(var _0x233c2b=0x0,_0x43e314={},_0xf9edc6={};_0x233c2b<_0x59a53f[_0x764b('0x3f')];_0x233c2b+=0x1){_0x43e314=_0x59a53f[_0x233c2b];if(_[_0x764b('0x42')](_0x5e6e35[_0x764b('0x1f')][_0x43e314['id']])){_0x5e6e35[_0x764b('0x1f')][_0x43e314['id']]=new ServicenowAccount(_0x43e314);}else{_0x5e6e35['mergeFromDatabase'](_0x5e6e35[_0x764b('0x1f')][_0x43e314['id']],_0x43e314);}}}return _0x5e6e35[_0x764b('0x1f')];};};Realtime['prototype'][_0x764b('0x4f')]=function(){var _0x37780b=this;return function(_0x289f83){if(_0x289f83){freeIsNotKey(_0x289f83,_0x37780b[_0x764b('0x20')],'id');for(var _0x147f4a=0x0,_0x5396d7={},_0x3c1afd={};_0x147f4a<_0x289f83[_0x764b('0x3f')];_0x147f4a+=0x1){_0x5396d7=_0x289f83[_0x147f4a];if(_[_0x764b('0x42')](_0x37780b[_0x764b('0x20')][_0x5396d7['id']])){_0x37780b[_0x764b('0x20')][_0x5396d7['id']]=new Dynamics365Account(_0x5396d7);}else{_0x37780b[_0x764b('0x3d')](_0x37780b['dynamics365Accounts'][_0x5396d7['id']],_0x5396d7);}}}return _0x37780b[_0x764b('0x20')];};};Realtime['prototype'][_0x764b('0x50')]=function(){var _0x5f13b9=this;return function(_0x511675){if(_0x511675){freeIsNotKey(_0x511675,_0x5f13b9['freshsalesAccounts'],'id');for(var _0x396873=0x0,_0x2545eb={},_0x59b2f6={};_0x396873<_0x511675['length'];_0x396873+=0x1){_0x2545eb=_0x511675[_0x396873];if(_[_0x764b('0x42')](_0x5f13b9[_0x764b('0x21')][_0x2545eb['id']])){_0x5f13b9[_0x764b('0x21')][_0x2545eb['id']]=new FreshsalesAccount(_0x2545eb);}else{_0x5f13b9['mergeFromDatabase'](_0x5f13b9['freshsalesAccounts'][_0x2545eb['id']],_0x2545eb);}}}return _0x5f13b9[_0x764b('0x21')];};};Realtime['prototype'][_0x764b('0x51')]=function(){var _0x29cb8e=this;return function(_0x1f98c0){for(var _0x55eb35=0x0;_0x55eb35<_0x1f98c0[_0x764b('0x3f')];_0x55eb35+=0x1){_[_0x764b('0x52')](_0x29cb8e[_0x764b('0x44')][_0x1f98c0[_0x55eb35][_0x764b('0x27')]],_0x1f98c0[_0x55eb35]);}return _0x29cb8e[_0x764b('0x44')];};};Realtime[_0x764b('0x3c')]['initVoiceQueueReports']=function(){var _0x2080e9=this;return function(_0x1e363c){clearVoiceQueues(_0x2080e9[_0x764b('0x44')]);if(_0x1e363c){_0x1e363c=_[_0x764b('0x53')](_0x1e363c,_0x764b('0x54'));for(var _0x4cffec in _0x1e363c){if(_0x1e363c['hasOwnProperty'](_0x4cffec)){var _0x341d20={};for(var _0x13c27e=0x0;_0x13c27e<_0x1e363c[_0x4cffec]['length'];_0x13c27e+=0x1){var _0x2b3de0=_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x55')];if(_0x2080e9[_0x764b('0x44')][_0x2b3de0]){if(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x56')]){_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x2f')]+=0x1;}if(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x57')]){_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x30')]+=0x1;}_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x2a')]+=moment(_0x1e363c[_0x4cffec][_0x13c27e]['queuecallerleaveAt'])[_0x764b('0x58')](moment(_0x1e363c[_0x4cffec][_0x13c27e]['queuecallerjoinAt']),_0x764b('0x59'))||0x0;if(_0x13c27e===_0x1e363c[_0x4cffec]['length']-0x1){_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x31')]+=moment(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5a')]||_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5b')]||_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5c')])[_0x764b('0x58')](moment(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5d')]),_0x764b('0x59'))||0x0;_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x29')]+=0x1;if(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5e')]){_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x2e')]+=0x1;_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x32')]+=moment(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5a')])[_0x764b('0x58')](moment(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5f')]),_0x764b('0x59'))||0x0;}}else{_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x31')]+=_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x2a')]||0x0;}}}}}}return _0x2080e9[_0x764b('0x44')];};};Realtime['prototype'][_0x764b('0x60')]=function(){var _0x4ede56=this;return function(_0x189da3){clearVoiceCallReports(_0x4ede56[_0x764b('0x61')]);if(_0x189da3){for(var _0x36da54=0x0;_0x36da54<_0x189da3[_0x764b('0x3f')];_0x36da54+=0x1){_0x4ede56[_0x764b('0x61')][_0x764b('0x29')]+=0x1;_0x4ede56['outbound'][_0x764b('0x31')]+=_0x189da3[_0x36da54]['duration'];if(_0x189da3[_0x36da54][_0x764b('0x62')]==='ANSWERED'){_0x4ede56[_0x764b('0x61')][_0x764b('0x2e')]+=0x1;_0x4ede56[_0x764b('0x61')][_0x764b('0x2a')]+=_0x189da3[_0x36da54][_0x764b('0x63')]-_0x189da3[_0x36da54][_0x764b('0x64')]||0x0;_0x4ede56[_0x764b('0x61')][_0x764b('0x32')]+=_0x189da3[_0x36da54][_0x764b('0x64')];}}}return _0x4ede56[_0x764b('0x61')];};};Realtime[_0x764b('0x3c')][_0x764b('0x65')]=function(){var _0x315238=this;return function(_0x4a2869){if(_0x4a2869){freeIsNotKey(_0x4a2869,_0x315238[_0x764b('0x66')],_0x764b('0x27'));for(var _0x13daa8=0x0,_0x1a7656={};_0x13daa8<_0x4a2869[_0x764b('0x3f')];_0x13daa8+=0x1){_0x1a7656=_0x4a2869[_0x13daa8];if(_[_0x764b('0x42')](_0x315238[_0x764b('0x66')][_0x1a7656['name']])){_0x315238['campaigns'][_0x1a7656[_0x764b('0x27')]]=new Campaign(_0x1a7656);}else{_0x315238[_0x764b('0x3d')](_0x315238[_0x764b('0x66')][_0x1a7656[_0x764b('0x27')]],_0x1a7656);_0x315238['campaigns'][_0x1a7656[_0x764b('0x27')]][_0x764b('0x67')]=_0x1a7656[_0x764b('0x68')]?_0x1a7656['SquareProject'][_0x764b('0x27')]:undefined;}}}return _0x315238[_0x764b('0x66')];};};Realtime[_0x764b('0x3c')][_0x764b('0x69')]=function(){var _0x1db066=this;return function(_0x4fa42c){if(_0x4fa42c){freeIsNotKey(_0x4fa42c,_0x1db066[_0x764b('0x16')],'id');for(var _0x562162=0x0,_0x5d7b77={};_0x562162<_0x4fa42c[_0x764b('0x3f')];_0x562162+=0x1){_0x5d7b77=_0x4fa42c[_0x562162];if(_[_0x764b('0x42')](_0x1db066[_0x764b('0x16')][_0x5d7b77['id']])){_0x1db066['voiceExtensions'][_0x5d7b77['id']]=new VoiceExtension(_0x5d7b77);}else{_0x1db066['mergeFromDatabase'](_0x1db066['voiceExtensions'][_0x5d7b77['id']],_0x5d7b77);}}}return _0x1db066[_0x764b('0x16')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x303bb4=this;return function(_0xb4d340){clearCampaigns(_0x303bb4[_0x764b('0x66')]);for(var _0x52ff75=0x0;_0x52ff75<_0xb4d340[_0x764b('0x3f')];_0x52ff75+=0x1){_[_0x764b('0x52')](_0x303bb4[_0x764b('0x66')][_0xb4d340[_0x52ff75][_0x764b('0x27')]],_0xb4d340[_0x52ff75]);}return _0x303bb4['campaigns'];};};Realtime[_0x764b('0x3c')][_0x764b('0x6a')]=function(){var _0x1898d8=this;return function(_0x4b2d70){if(_0x4b2d70){freeIsNotKey(_0x4b2d70,_0x1898d8['faxAccounts'],'id');for(var _0xf2eb4f=0x0,_0x5a89fc={},_0x4b043e={};_0xf2eb4f<_0x4b2d70[_0x764b('0x3f')];_0xf2eb4f+=0x1){_0x5a89fc=_0x4b2d70[_0xf2eb4f];if(_[_0x764b('0x42')](_0x1898d8['faxAccounts'][_0x5a89fc['id']])){_0x1898d8[_0x764b('0x22')][_0x5a89fc['id']]=new FaxAccount(_0x5a89fc);}else{_0x1898d8[_0x764b('0x3d')](_0x1898d8[_0x764b('0x22')][_0x5a89fc['id']],_0x5a89fc);}}}return _0x1898d8[_0x764b('0x22')];};};module[_0x764b('0x6b')]=Realtime; \ No newline at end of file +var _0x5a66=['../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','isNil','interface','total','sumHoldTime','sumDuration','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','initAgents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','templates','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','diff','queuecallercomplete','initVoiceCallReports','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','exports','bluebird','moment'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x5a66,0x19e));var _0x65a6=function(_0x229d7e,_0x5bc489){_0x229d7e=_0x229d7e-0x0;var _0xa78280=_0x5a66[_0x229d7e];return _0xa78280;};'use strict';var BPromise=require(_0x65a6('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0x65a6('0x1'));var Agent=require('../model/agent');var Telephone=require(_0x65a6('0x2'));var Trunk=require(_0x65a6('0x3'));var VoiceQueue=require(_0x65a6('0x4'));var Trigger=require(_0x65a6('0x5'));var Template=require(_0x65a6('0x6'));var Campaign=require(_0x65a6('0x7'));var VoiceExtension=require(_0x65a6('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x65a6('0x9'));var FreshdeskAccount=require(_0x65a6('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x65a6('0xb'));var VtigerAccount=require(_0x65a6('0xc'));var ServicenowAccount=require(_0x65a6('0xd'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x65a6('0xe'));var FaxAccount=require(_0x65a6('0xf'));var Realtime=function(){this[_0x65a6('0x10')]={};this[_0x65a6('0x11')]={};this[_0x65a6('0x12')]={};this[_0x65a6('0x13')]={};this[_0x65a6('0x14')]={};this[_0x65a6('0x15')]={};this['templates']={};this[_0x65a6('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x65a6('0x17')]={};this['channels']={};this[_0x65a6('0x18')]={};this[_0x65a6('0x19')]={};this[_0x65a6('0x1a')]={};this[_0x65a6('0x1b')]={};this[_0x65a6('0x1c')]={};this[_0x65a6('0x1d')]={};this['freshdeskAccounts']={};this[_0x65a6('0x1e')]={};this[_0x65a6('0x1f')]={};this[_0x65a6('0x20')]={};this[_0x65a6('0x21')]={};this[_0x65a6('0x22')]={};this[_0x65a6('0x23')]={};this[_0x65a6('0x24')]={};};function freeIsNotKey(_0x291c1d,_0x4cfd71,_0x446c06){var _0x5337a8=_['mapKeys'](_0x291c1d,function(_0x3012aa,_0x1e7e84){return _0x3012aa[_0x446c06];});for(var _0x53fb13 in _0x4cfd71){if(_0x4cfd71[_0x65a6('0x25')](_0x53fb13)){if(!_0x5337a8[_0x53fb13]){delete _0x4cfd71[_0x53fb13];}}}}function freeIsNotKeySip(_0x3a5c91,_0x3b0b6b){var _0x3913ea=_[_0x65a6('0x26')](_0x3a5c91,function(_0x435179,_0x1641e8){return util[_0x65a6('0x27')](_0x65a6('0x28'),_0x435179[_0x65a6('0x29')]);});for(var _0x589c75 in _0x3b0b6b){if(_0x3b0b6b[_0x65a6('0x25')](_0x589c75)){if(!_0x3913ea[_0x589c75]){delete _0x3b0b6b[_0x589c75];}}}}function freeIsNotKeyAgent(_0x2b6a23,_0x230b0c){var _0x413a13=_[_0x65a6('0x26')](_0x2b6a23,function(_0x554150,_0x5ca570){var _0xc22fc=_[_0x65a6('0x2a')](_0x554150[_0x65a6('0x2b')])?util[_0x65a6('0x27')](_0x65a6('0x28'),_0x554150[_0x65a6('0x29')]):_0x554150['interface'];return _0xc22fc;});for(var _0x4d904e in _0x230b0c){if(_0x230b0c['hasOwnProperty'](_0x4d904e)){if(!_0x413a13[_0x4d904e]){delete _0x230b0c[_0x4d904e];}}}}function clearVoiceCallReports(_0x2c51e4){_0x2c51e4[_0x65a6('0x2c')]=0x0;_0x2c51e4['answered']=0x0;_0x2c51e4[_0x65a6('0x2d')]=0x0;_0x2c51e4[_0x65a6('0x2e')]=0x0;_0x2c51e4['sumBillable']=0x0;}function clearCampaigns(_0x26a7e3){if(!_[_0x65a6('0x2f')](_0x26a7e3)){for(var _0x5e77c4 in _0x26a7e3){if(_0x26a7e3['hasOwnProperty'](_0x5e77c4)){_0x26a7e3[_0x5e77c4]['ivrTotalCallsDays']=0x0;_0x26a7e3[_0x5e77c4][_0x65a6('0x30')]=0x0;}}}}function clearVoiceQueues(_0x549da4){if(!_[_0x65a6('0x2f')](_0x549da4)){for(var _0x9c0970 in _0x549da4){if(_0x549da4['hasOwnProperty'](_0x9c0970)){_0x549da4[_0x9c0970][_0x65a6('0x2c')]=0x0;_0x549da4[_0x9c0970]['answered']=0x0;_0x549da4[_0x9c0970][_0x65a6('0x31')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x32')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x2d')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x2e')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x33')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x34')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x35')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x36')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x37')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x38')]=0x0;_0x549da4[_0x9c0970]['outboundUnknownCallsDay']=0x0;_0x549da4[_0x9c0970]['outboundDropCallsDayTimeout']=0x0;_0x549da4[_0x9c0970][_0x65a6('0x39')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x3a')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x3b')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x3c')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x3d')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x34')]=0x0;_0x549da4[_0x9c0970][_0x65a6('0x3e')]=0x0;_0x549da4[_0x9c0970]['queueStatusComplete']=!![];}}}}Realtime[_0x65a6('0x3f')]['mergeFromDatabase']=function(_0x1ff183,_0x388068){for(var _0x1ed24b in _0x388068){if(_0x1ff183[_0x65a6('0x25')](_0x1ed24b)){_0x1ff183[_0x1ed24b]=_0x388068[_0x1ed24b];}}};Realtime[_0x65a6('0x3f')][_0x65a6('0x40')]=function(){var _0x3fe462=this;return function(_0x449817){if(_0x449817){freeIsNotKeyAgent(_0x449817,_0x3fe462[_0x65a6('0x10')]);for(var _0x57e4e7=0x0,_0x4e6045={},_0x18fdb1={};_0x57e4e7<_0x449817[_0x65a6('0x41')];_0x57e4e7+=0x1){_0x4e6045=_0x449817[_0x57e4e7];var _0x36611a=_[_0x65a6('0x2a')](_0x4e6045[_0x65a6('0x2b')])?util['format'](_0x65a6('0x28'),_0x4e6045['name']):_0x4e6045['interface'];if(_[_0x65a6('0x42')](_0x3fe462[_0x65a6('0x10')][_0x36611a])){_0x3fe462[_0x65a6('0x10')][_0x36611a]=new Agent(_0x4e6045);}else{_0x3fe462[_0x65a6('0x43')](_0x3fe462[_0x65a6('0x10')][_0x36611a],_0x4e6045);}}}return _0x3fe462[_0x65a6('0x10')];};};Realtime[_0x65a6('0x3f')][_0x65a6('0x44')]=function(){var _0xd6ff35=this;return function(_0x1e4bdc){if(_0x1e4bdc){freeIsNotKeySip(_0x1e4bdc,_0xd6ff35[_0x65a6('0x11')]);for(var _0x582b39=0x0,_0xa96657={},_0x2aa59={};_0x582b39<_0x1e4bdc[_0x65a6('0x41')];_0x582b39+=0x1){_0xa96657=_0x1e4bdc[_0x582b39];if(_['isUndefined'](_0xd6ff35['telephones'][util[_0x65a6('0x27')](_0x65a6('0x28'),_0xa96657[_0x65a6('0x29')])])){_0xd6ff35[_0x65a6('0x11')][util[_0x65a6('0x27')](_0x65a6('0x28'),_0xa96657[_0x65a6('0x29')])]=new Telephone(_0xa96657);}else{_0xd6ff35['mergeFromDatabase'](_0xd6ff35['telephones'][util[_0x65a6('0x27')](_0x65a6('0x28'),_0xa96657[_0x65a6('0x29')])],_0xa96657);}}}return _0xd6ff35[_0x65a6('0x11')];};};Realtime[_0x65a6('0x3f')][_0x65a6('0x45')]=function(){var _0xfb8e04=this;return function(_0x5def86){if(_0x5def86){freeIsNotKeySip(_0x5def86,_0xfb8e04[_0x65a6('0x12')]);for(var _0x58bded=0x0,_0x2e149b={},_0x53c37a={};_0x58bded<_0x5def86[_0x65a6('0x41')];_0x58bded+=0x1){_0x2e149b=_0x5def86[_0x58bded];if(_[_0x65a6('0x42')](_0xfb8e04[_0x65a6('0x12')][util[_0x65a6('0x27')](_0x65a6('0x28'),_0x2e149b[_0x65a6('0x29')])])){_0xfb8e04['trunks'][util[_0x65a6('0x27')](_0x65a6('0x28'),_0x2e149b[_0x65a6('0x29')])]=new Trunk(_0x2e149b);}else{_0xfb8e04['mergeFromDatabase'](_0xfb8e04[_0x65a6('0x12')][util[_0x65a6('0x27')](_0x65a6('0x28'),_0x2e149b[_0x65a6('0x29')])],_0x2e149b);}}}return _0xfb8e04[_0x65a6('0x12')];};};Realtime['prototype'][_0x65a6('0x46')]=function(){var _0x50bc12=this;return function(_0x3da736){if(_0x3da736){freeIsNotKey(_0x3da736,_0x50bc12[_0x65a6('0x13')],_0x65a6('0x29'));for(var _0x59b966=0x0,_0x44febf={},_0x4c878c={};_0x59b966<_0x3da736['length'];_0x59b966+=0x1){_0x44febf=_0x3da736[_0x59b966];if(_[_0x65a6('0x42')](_0x50bc12[_0x65a6('0x13')][_0x44febf[_0x65a6('0x29')]])){_0x50bc12[_0x65a6('0x13')][_0x44febf[_0x65a6('0x29')]]=new VoiceQueue(_0x44febf);}else{_0x50bc12[_0x65a6('0x43')](_0x50bc12[_0x65a6('0x13')][_0x44febf[_0x65a6('0x29')]],_0x44febf);}}}return _0x50bc12[_0x65a6('0x13')];};};Realtime[_0x65a6('0x3f')][_0x65a6('0x47')]=function(){var _0x474b80=this;return function(_0x1137b5){if(_0x1137b5){freeIsNotKey(_0x1137b5,_0x474b80['triggers'],'id');for(var _0x571c8a=0x0,_0x457c92={},_0x4547f6={};_0x571c8a<_0x1137b5[_0x65a6('0x41')];_0x571c8a+=0x1){_0x457c92=_0x1137b5[_0x571c8a];if(_['isUndefined'](_0x474b80[_0x65a6('0x14')][_0x457c92['id']])){_0x474b80[_0x65a6('0x14')][_0x457c92['id']]=new Trigger(_0x457c92);}else{_0x474b80[_0x65a6('0x43')](_0x474b80['triggers'][_0x457c92['id']],_0x457c92);}}}return _0x474b80[_0x65a6('0x14')];};};Realtime[_0x65a6('0x3f')][_0x65a6('0x48')]=function(){var _0x48a878=this;return function(_0x1b03f8){if(_0x1b03f8){freeIsNotKey(_0x1b03f8,_0x48a878[_0x65a6('0x49')],'id');for(var _0x5a9ae=0x0,_0x32db88={},_0x57fae6={};_0x5a9ae<_0x1b03f8[_0x65a6('0x41')];_0x5a9ae+=0x1){_0x32db88=_0x1b03f8[_0x5a9ae];if(_[_0x65a6('0x42')](_0x48a878[_0x65a6('0x49')][_0x32db88['id']])){_0x48a878[_0x65a6('0x49')][_0x32db88['id']]=new Template(_0x32db88);}else{_0x48a878['mergeFromDatabase'](_0x48a878[_0x65a6('0x49')][_0x32db88['id']],_0x32db88);}}}return _0x48a878[_0x65a6('0x49')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x24e70b=this;return function(_0x4d4379){if(_0x4d4379){freeIsNotKey(_0x4d4379,_0x24e70b[_0x65a6('0x1b')],'id');for(var _0x40daaa=0x0,_0x4bfae8={},_0x207a72={};_0x40daaa<_0x4d4379[_0x65a6('0x41')];_0x40daaa+=0x1){_0x4bfae8=_0x4d4379[_0x40daaa];if(_[_0x65a6('0x42')](_0x24e70b['zendeskAccounts'][_0x4bfae8['id']])){_0x24e70b[_0x65a6('0x1b')][_0x4bfae8['id']]=new ZendeskAccount(_0x4bfae8);}else{_0x24e70b[_0x65a6('0x43')](_0x24e70b[_0x65a6('0x1b')][_0x4bfae8['id']],_0x4bfae8);}}}return _0x24e70b[_0x65a6('0x1b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x2b875c=this;return function(_0x53e442){if(_0x53e442){freeIsNotKey(_0x53e442,_0x2b875c[_0x65a6('0x1c')],'id');for(var _0x589724=0x0,_0x3b3a55={},_0x16b5cd={};_0x589724<_0x53e442[_0x65a6('0x41')];_0x589724+=0x1){_0x3b3a55=_0x53e442[_0x589724];if(_[_0x65a6('0x42')](_0x2b875c[_0x65a6('0x1c')][_0x3b3a55['id']])){_0x2b875c[_0x65a6('0x1c')][_0x3b3a55['id']]=new SalesforceAccount(_0x3b3a55);}else{_0x2b875c[_0x65a6('0x43')](_0x2b875c['salesforceAccounts'][_0x3b3a55['id']],_0x3b3a55);}}}return _0x2b875c[_0x65a6('0x1c')];};};Realtime['prototype'][_0x65a6('0x4a')]=function(){var _0x34e205=this;return function(_0x14df31){if(_0x14df31){freeIsNotKey(_0x14df31,_0x34e205[_0x65a6('0x4b')],'id');for(var _0x5234e4=0x0,_0x5ce58b={},_0xa60527={};_0x5234e4<_0x14df31[_0x65a6('0x41')];_0x5234e4+=0x1){_0x5ce58b=_0x14df31[_0x5234e4];if(_[_0x65a6('0x42')](_0x34e205[_0x65a6('0x4b')][_0x5ce58b['id']])){_0x34e205['freshdeskAccounts'][_0x5ce58b['id']]=new FreshdeskAccount(_0x5ce58b);}else{_0x34e205[_0x65a6('0x43')](_0x34e205[_0x65a6('0x4b')][_0x5ce58b['id']],_0x5ce58b);}}}return _0x34e205[_0x65a6('0x4b')];};};Realtime[_0x65a6('0x3f')][_0x65a6('0x4c')]=function(){var _0x3b0808=this;return function(_0x29a309){if(_0x29a309){freeIsNotKey(_0x29a309,_0x3b0808[_0x65a6('0x1e')],'id');for(var _0x3b2f77=0x0,_0x38e35b={},_0x30486c={};_0x3b2f77<_0x29a309[_0x65a6('0x41')];_0x3b2f77+=0x1){_0x38e35b=_0x29a309[_0x3b2f77];if(_[_0x65a6('0x42')](_0x3b0808[_0x65a6('0x1e')][_0x38e35b['id']])){_0x3b0808[_0x65a6('0x1e')][_0x38e35b['id']]=new ZohoAccount(_0x38e35b);}else{_0x3b0808['mergeFromDatabase'](_0x3b0808[_0x65a6('0x1e')][_0x38e35b['id']],_0x38e35b);}}}return _0x3b0808[_0x65a6('0x1e')];};};Realtime[_0x65a6('0x3f')][_0x65a6('0x4d')]=function(){var _0x4b771e=this;return function(_0x52a930){if(_0x52a930){freeIsNotKey(_0x52a930,_0x4b771e['deskAccounts'],'id');for(var _0x3a8ab3=0x0,_0x253e68={},_0x510eaa={};_0x3a8ab3<_0x52a930[_0x65a6('0x41')];_0x3a8ab3+=0x1){_0x253e68=_0x52a930[_0x3a8ab3];if(_[_0x65a6('0x42')](_0x4b771e['deskAccounts'][_0x253e68['id']])){_0x4b771e[_0x65a6('0x1f')][_0x253e68['id']]=new DeskAccount(_0x253e68);}else{_0x4b771e[_0x65a6('0x43')](_0x4b771e[_0x65a6('0x1f')][_0x253e68['id']],_0x253e68);}}}return _0x4b771e[_0x65a6('0x1f')];};};Realtime[_0x65a6('0x3f')][_0x65a6('0x4e')]=function(){var _0x5b5ec2=this;return function(_0x4ee746){if(_0x4ee746){freeIsNotKey(_0x4ee746,_0x5b5ec2[_0x65a6('0x1d')],'id');for(var _0x9f7a3b=0x0,_0x554a37={},_0x567328={};_0x9f7a3b<_0x4ee746[_0x65a6('0x41')];_0x9f7a3b+=0x1){_0x554a37=_0x4ee746[_0x9f7a3b];if(_[_0x65a6('0x42')](_0x5b5ec2[_0x65a6('0x1d')][_0x554a37['id']])){_0x5b5ec2[_0x65a6('0x1d')][_0x554a37['id']]=new SugarcrmAccount(_0x554a37);}else{_0x5b5ec2[_0x65a6('0x43')](_0x5b5ec2['sugarcrmAccounts'][_0x554a37['id']],_0x554a37);}}}return _0x5b5ec2[_0x65a6('0x1d')];};};Realtime[_0x65a6('0x3f')][_0x65a6('0x4f')]=function(){var _0x884e11=this;return function(_0x508b97){if(_0x508b97){freeIsNotKey(_0x508b97,_0x884e11[_0x65a6('0x20')],'id');for(var _0x33bb56=0x0,_0x15db87={},_0x3b03c4={};_0x33bb56<_0x508b97[_0x65a6('0x41')];_0x33bb56+=0x1){_0x15db87=_0x508b97[_0x33bb56];if(_[_0x65a6('0x42')](_0x884e11['vtigerAccounts'][_0x15db87['id']])){_0x884e11[_0x65a6('0x20')][_0x15db87['id']]=new VtigerAccount(_0x15db87);}else{_0x884e11[_0x65a6('0x43')](_0x884e11['vtigerAccounts'][_0x15db87['id']],_0x15db87);}}}return _0x884e11[_0x65a6('0x20')];};};Realtime[_0x65a6('0x3f')][_0x65a6('0x50')]=function(){var _0xd69a4a=this;return function(_0x4a072f){if(_0x4a072f){freeIsNotKey(_0x4a072f,_0xd69a4a[_0x65a6('0x21')],'id');for(var _0x4f27cb=0x0,_0x208c78={},_0x548469={};_0x4f27cb<_0x4a072f[_0x65a6('0x41')];_0x4f27cb+=0x1){_0x208c78=_0x4a072f[_0x4f27cb];if(_[_0x65a6('0x42')](_0xd69a4a['servicenowAccounts'][_0x208c78['id']])){_0xd69a4a[_0x65a6('0x21')][_0x208c78['id']]=new ServicenowAccount(_0x208c78);}else{_0xd69a4a[_0x65a6('0x43')](_0xd69a4a[_0x65a6('0x21')][_0x208c78['id']],_0x208c78);}}}return _0xd69a4a[_0x65a6('0x21')];};};Realtime[_0x65a6('0x3f')]['initDynamics365Accounts']=function(){var _0x1095bc=this;return function(_0x5ee743){if(_0x5ee743){freeIsNotKey(_0x5ee743,_0x1095bc[_0x65a6('0x22')],'id');for(var _0x35c7b3=0x0,_0x3e341b={},_0x1f5a5a={};_0x35c7b3<_0x5ee743[_0x65a6('0x41')];_0x35c7b3+=0x1){_0x3e341b=_0x5ee743[_0x35c7b3];if(_[_0x65a6('0x42')](_0x1095bc['dynamics365Accounts'][_0x3e341b['id']])){_0x1095bc[_0x65a6('0x22')][_0x3e341b['id']]=new Dynamics365Account(_0x3e341b);}else{_0x1095bc[_0x65a6('0x43')](_0x1095bc[_0x65a6('0x22')][_0x3e341b['id']],_0x3e341b);}}}return _0x1095bc[_0x65a6('0x22')];};};Realtime[_0x65a6('0x3f')]['initFreshsalesAccounts']=function(){var _0x24531d=this;return function(_0xa4175a){if(_0xa4175a){freeIsNotKey(_0xa4175a,_0x24531d[_0x65a6('0x23')],'id');for(var _0x2dd9f7=0x0,_0x14cfbc={},_0x5111a2={};_0x2dd9f7<_0xa4175a[_0x65a6('0x41')];_0x2dd9f7+=0x1){_0x14cfbc=_0xa4175a[_0x2dd9f7];if(_[_0x65a6('0x42')](_0x24531d[_0x65a6('0x23')][_0x14cfbc['id']])){_0x24531d[_0x65a6('0x23')][_0x14cfbc['id']]=new FreshsalesAccount(_0x14cfbc);}else{_0x24531d[_0x65a6('0x43')](_0x24531d[_0x65a6('0x23')][_0x14cfbc['id']],_0x14cfbc);}}}return _0x24531d[_0x65a6('0x23')];};};Realtime[_0x65a6('0x3f')][_0x65a6('0x51')]=function(){var _0x5334b3=this;return function(_0xca4aea){for(var _0x13a0aa=0x0;_0x13a0aa<_0xca4aea[_0x65a6('0x41')];_0x13a0aa+=0x1){_[_0x65a6('0x52')](_0x5334b3[_0x65a6('0x13')][_0xca4aea[_0x13a0aa][_0x65a6('0x29')]],_0xca4aea[_0x13a0aa]);}return _0x5334b3[_0x65a6('0x13')];};};Realtime['prototype'][_0x65a6('0x53')]=function(){var _0x4a9801=this;return function(_0x3b3013){clearVoiceQueues(_0x4a9801[_0x65a6('0x13')]);if(_0x3b3013){_0x3b3013=_['groupBy'](_0x3b3013,_0x65a6('0x54'));for(var _0x4ff2a0 in _0x3b3013){if(_0x3b3013[_0x65a6('0x25')](_0x4ff2a0)){var _0x106409={};for(var _0x42cfdf=0x0;_0x42cfdf<_0x3b3013[_0x4ff2a0][_0x65a6('0x41')];_0x42cfdf+=0x1){var _0x2c6403=_0x3b3013[_0x4ff2a0][_0x42cfdf][_0x65a6('0x55')];if(_0x4a9801[_0x65a6('0x13')][_0x2c6403]){if(_0x3b3013[_0x4ff2a0][_0x42cfdf][_0x65a6('0x56')]){_0x4a9801[_0x65a6('0x13')][_0x2c6403][_0x65a6('0x31')]+=0x1;}if(_0x3b3013[_0x4ff2a0][_0x42cfdf][_0x65a6('0x57')]){_0x4a9801[_0x65a6('0x13')][_0x2c6403][_0x65a6('0x32')]+=0x1;}_0x4a9801[_0x65a6('0x13')][_0x2c6403][_0x65a6('0x2d')]+=moment(_0x3b3013[_0x4ff2a0][_0x42cfdf][_0x65a6('0x58')])['diff'](moment(_0x3b3013[_0x4ff2a0][_0x42cfdf][_0x65a6('0x59')]),_0x65a6('0x5a'))||0x0;if(_0x42cfdf===_0x3b3013[_0x4ff2a0]['length']-0x1){_0x4a9801['voiceQueues'][_0x2c6403][_0x65a6('0x2e')]+=moment(_0x3b3013[_0x4ff2a0][_0x42cfdf][_0x65a6('0x5b')]||_0x3b3013[_0x4ff2a0][_0x42cfdf]['queuecallerabandonAt']||_0x3b3013[_0x4ff2a0][_0x42cfdf][_0x65a6('0x5c')])[_0x65a6('0x5d')](moment(_0x3b3013[_0x4ff2a0][_0x42cfdf][_0x65a6('0x59')]),_0x65a6('0x5a'))||0x0;_0x4a9801[_0x65a6('0x13')][_0x2c6403][_0x65a6('0x2c')]+=0x1;if(_0x3b3013[_0x4ff2a0][_0x42cfdf][_0x65a6('0x5e')]){_0x4a9801['voiceQueues'][_0x2c6403]['answered']+=0x1;_0x4a9801[_0x65a6('0x13')][_0x2c6403][_0x65a6('0x33')]+=moment(_0x3b3013[_0x4ff2a0][_0x42cfdf]['queuecallercompleteAt'])[_0x65a6('0x5d')](moment(_0x3b3013[_0x4ff2a0][_0x42cfdf][_0x65a6('0x58')]),_0x65a6('0x5a'))||0x0;}}else{_0x4a9801[_0x65a6('0x13')][_0x2c6403][_0x65a6('0x2e')]+=_0x4a9801['voiceQueues'][_0x2c6403][_0x65a6('0x2d')]||0x0;}}}}}}return _0x4a9801[_0x65a6('0x13')];};};Realtime[_0x65a6('0x3f')][_0x65a6('0x5f')]=function(){var _0x1dc86e=this;return function(_0x2acbb7){clearVoiceCallReports(_0x1dc86e[_0x65a6('0x16')]);if(_0x2acbb7){for(var _0x3ffab7=0x0;_0x3ffab7<_0x2acbb7[_0x65a6('0x41')];_0x3ffab7+=0x1){_0x1dc86e['outbound'][_0x65a6('0x2c')]+=0x1;_0x1dc86e[_0x65a6('0x16')]['sumDuration']+=_0x2acbb7[_0x3ffab7][_0x65a6('0x60')];if(_0x2acbb7[_0x3ffab7]['disposition']==='ANSWERED'){_0x1dc86e[_0x65a6('0x16')]['answered']+=0x1;_0x1dc86e[_0x65a6('0x16')][_0x65a6('0x2d')]+=_0x2acbb7[_0x3ffab7][_0x65a6('0x60')]-_0x2acbb7[_0x3ffab7][_0x65a6('0x61')]||0x0;_0x1dc86e['outbound'][_0x65a6('0x33')]+=_0x2acbb7[_0x3ffab7]['billableseconds'];}}}return _0x1dc86e[_0x65a6('0x16')];};};Realtime['prototype'][_0x65a6('0x62')]=function(){var _0x894151=this;return function(_0xc7632f){if(_0xc7632f){freeIsNotKey(_0xc7632f,_0x894151['campaigns'],_0x65a6('0x29'));for(var _0x352dba=0x0,_0x58ac3f={};_0x352dba<_0xc7632f[_0x65a6('0x41')];_0x352dba+=0x1){_0x58ac3f=_0xc7632f[_0x352dba];if(_['isUndefined'](_0x894151['campaigns'][_0x58ac3f[_0x65a6('0x29')]])){_0x894151[_0x65a6('0x15')][_0x58ac3f[_0x65a6('0x29')]]=new Campaign(_0x58ac3f);}else{_0x894151['mergeFromDatabase'](_0x894151[_0x65a6('0x15')][_0x58ac3f[_0x65a6('0x29')]],_0x58ac3f);_0x894151[_0x65a6('0x15')][_0x58ac3f[_0x65a6('0x29')]][_0x65a6('0x63')]=_0x58ac3f[_0x65a6('0x64')]?_0x58ac3f[_0x65a6('0x64')][_0x65a6('0x29')]:undefined;}}}return _0x894151['campaigns'];};};Realtime['prototype'][_0x65a6('0x65')]=function(){var _0x115968=this;return function(_0x2aa56a){if(_0x2aa56a){freeIsNotKey(_0x2aa56a,_0x115968[_0x65a6('0x17')],'id');for(var _0xa6dea=0x0,_0x4a027a={};_0xa6dea<_0x2aa56a[_0x65a6('0x41')];_0xa6dea+=0x1){_0x4a027a=_0x2aa56a[_0xa6dea];if(_[_0x65a6('0x42')](_0x115968[_0x65a6('0x17')][_0x4a027a['id']])){_0x115968[_0x65a6('0x17')][_0x4a027a['id']]=new VoiceExtension(_0x4a027a);}else{_0x115968['mergeFromDatabase'](_0x115968['voiceExtensions'][_0x4a027a['id']],_0x4a027a);}}}return _0x115968[_0x65a6('0x17')];};};Realtime[_0x65a6('0x3f')]['initCampaignHopperHistory']=function(){var _0x447683=this;return function(_0x362ee4){clearCampaigns(_0x447683[_0x65a6('0x15')]);for(var _0x14573d=0x0;_0x14573d<_0x362ee4[_0x65a6('0x41')];_0x14573d+=0x1){_[_0x65a6('0x52')](_0x447683['campaigns'][_0x362ee4[_0x14573d][_0x65a6('0x29')]],_0x362ee4[_0x14573d]);}return _0x447683[_0x65a6('0x15')];};};Realtime['prototype'][_0x65a6('0x66')]=function(){var _0x2acfa=this;return function(_0x2a0b09){if(_0x2a0b09){freeIsNotKey(_0x2a0b09,_0x2acfa['faxAccounts'],'id');for(var _0x131bd9=0x0,_0x321273={},_0x25838f={};_0x131bd9<_0x2a0b09['length'];_0x131bd9+=0x1){_0x321273=_0x2a0b09[_0x131bd9];if(_[_0x65a6('0x42')](_0x2acfa['faxAccounts'][_0x321273['id']])){_0x2acfa[_0x65a6('0x24')][_0x321273['id']]=new FaxAccount(_0x321273);}else{_0x2acfa[_0x65a6('0x43')](_0x2acfa['faxAccounts'][_0x321273['id']],_0x321273);}}}return _0x2acfa[_0x65a6('0x24')];};};module[_0x65a6('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 54633d2..d57a7c8 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 _0xc412=['transfereelinkedid','uniqueid','create','monitor','monitors','length','createdAt','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','Local','indexOf','mobile','substring','lastIndexOf','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','exten','type','queue','context','from-voip-provider','callerid','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','connectedlinenum','calleridname','transfers','linkedid'];(function(_0x21900c,_0x36dccc){var _0x138370=function(_0x551ac7){while(--_0x551ac7){_0x21900c['push'](_0x21900c['shift']());}};_0x138370(++_0x36dccc);}(_0xc412,0x1ae));var _0x2c41=function(_0x2f2b37,_0x5a545b){_0x2f2b37=_0x2f2b37-0x0;var _0x170f0b=_0xc412[_0x2f2b37];return _0x170f0b;};'use strict';var _=require(_0x2c41('0x0'));var moment=require(_0x2c41('0x1'));var util=require('util');var config=require(_0x2c41('0x2'));var ami=require(_0x2c41('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x2c41('0x4'));var RpcVoiceDialReport=require(_0x2c41('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x2c41('0x6'));var RpcVoiceRecording=require(_0x2c41('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x2c41('0x8'));var VoiceCallReport=require(_0x2c41('0x9'));var VoiceAgentReport=require(_0x2c41('0xa'));var VoiceDialReport=require(_0x2c41('0xb'));var UserReport=require(_0x2c41('0xc'));function Report(_0x3b3b18){this[_0x2c41('0xd')]=_0x3b3b18;this[_0x2c41('0xe')]=_0x3b3b18['agents'];this['telephones']=_0x3b3b18[_0x2c41('0xf')];}Report[_0x2c41('0x10')][_0x2c41('0x11')]=function(_0xaf13f6){var _0x5e78a0=new VoiceQueueReport(this[_0x2c41('0xd')]);var _0x1402e7=new VoiceAgentReport(this[_0x2c41('0xd')]);var _0x4b2c55=new VoiceDialReport(this[_0x2c41('0xd')]);var _0x340e5b=new VoiceCallReport(this[_0x2c41('0xd')]);var _0x12a94d=new UserReport(this[_0x2c41('0xd')]);if(config[_0x2c41('0x12')]&&config[_0x2c41('0x12')]['disabled']){ami['on'](_0x2c41('0x13'),this[_0x2c41('0x14')][_0x2c41('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x2c41('0x16')][_0x2c41('0x15')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x2c41('0x15')](this));ami['on'](_0x2c41('0x17'),this[_0x2c41('0x18')][_0x2c41('0x15')](this));ami['on']('blindtransfer',this[_0x2c41('0x19')][_0x2c41('0x15')](this));ami['on']('attendedtransfer',this[_0x2c41('0x1a')][_0x2c41('0x15')](this));}};Report[_0x2c41('0x10')][_0x2c41('0x1b')]=function(_0x54b36d){var _0x4e9ae1;_0x4e9ae1=_[_0x2c41('0x1c')](this['agents'],function(_0x398ee9){return _0x398ee9[_0x2c41('0x1d')]==_0x54b36d||_0x398ee9[_0x2c41('0x1e')]==_0x54b36d;});if(_[_0x2c41('0x1f')](_0x4e9ae1)){var _0x390a3b=_['find'](this[_0x2c41('0xf')],function(_0x3f4445){return _0x3f4445['accountcode']==_0x54b36d||_0x3f4445[_0x2c41('0x1e')]==_0x54b36d;});if(_0x390a3b){_0x4e9ae1=_[_0x2c41('0x1c')](this[_0x2c41('0xe')],function(_0x5aad75){return _0x5aad75[_0x2c41('0x20')]==util['format'](_0x2c41('0x21'),_0x390a3b['name']);});}}return _0x4e9ae1;};Report[_0x2c41('0x10')]['voiceQueueReport']=function(_0x3d3cac){for(var _0x25c688=0x0;_0x25c688<_0x3d3cac['length'];_0x25c688+=0x1){var _0x40adac=this[_0x2c41('0x1b')](_0x3d3cac[_0x25c688]['connectedlinenum']);if(_0x40adac){_0x3d3cac[_0x25c688][_0x2c41('0x1d')]=_0x40adac['accountcode'];_0x3d3cac[_0x25c688][_0x2c41('0x22')]=!![];_0x3d3cac[_0x25c688][_0x2c41('0x23')]=_0x40adac[_0x2c41('0x1e')];_0x3d3cac[_0x25c688][_0x2c41('0x20')]=_[_0x2c41('0x1f')](_0x40adac[_0x2c41('0x20')])?util[_0x2c41('0x24')](_0x2c41('0x21'),_0x40adac[_0x2c41('0x1e')]):_0x40adac[_0x2c41('0x20')];if(_0x3d3cac[_0x25c688][_0x2c41('0x25')]){_0x3d3cac[_0x25c688][_0x2c41('0x26')]=moment()[_0x2c41('0x24')](_0x2c41('0x27'));}if(_0x3d3cac[_0x25c688][_0x2c41('0x28')]){_0x3d3cac[_0x25c688][_0x2c41('0x29')]=moment()['format'](_0x2c41('0x27'));}RpcMemberReport[_0x2c41('0x14')](_0x3d3cac[_0x25c688]);}RpcVoiceQueueReport['create'](_0x3d3cac[_0x25c688]);}};function extractCalleridNumber(_0x2b8763){var _0x3cefcb=_0x2b8763[_0x2c41('0x2a')](/<(.*?)>/);return _0x3cefcb?_0x3cefcb[0x1]:_0x2b8763;}Report[_0x2c41('0x10')]['voiceCallReport']=function(_0x25efd7){_0x25efd7[_0x2c41('0x2b')]=_0x25efd7['destination']||_0x25efd7[_0x2c41('0x2c')];if(_0x25efd7[_0x2c41('0x2d')]=='dialer'){_0x25efd7['lastapplication']=_0x2c41('0x2e');_0x25efd7['lastdata']=_0x25efd7[_0x2c41('0x2e')];if(_0x25efd7[_0x2c41('0x2f')]==_0x2c41('0x30')){_0x25efd7[_0x2c41('0x1d')]='';_0x25efd7[_0x2c41('0x2b')]=extractCalleridNumber(_0x25efd7[_0x2c41('0x31')]);}else if(_0x25efd7[_0x2c41('0x2f')]=='from-sip'){if(_0x25efd7['destination']==_0x2c41('0x32')){_0x25efd7['destination']=extractCalleridNumber(_0x25efd7['calleridpreview']);_0x25efd7[_0x2c41('0x33')]=_0x25efd7[_0x2c41('0x34')];_0x25efd7[_0x2c41('0x35')]=[_0x25efd7[_0x2c41('0x36')],_0x25efd7[_0x2c41('0x36')]=_0x25efd7[_0x2c41('0x35')]][0x0];_0x25efd7['callerid']=_0x25efd7[_0x2c41('0x37')];}else{_0x25efd7[_0x2c41('0x2b')]=_0x25efd7[_0x2c41('0x33')];_0x25efd7['calleridnum']=_0x25efd7[_0x2c41('0x34')];if(_0x25efd7[_0x2c41('0x38')]==_0x2c41('0x39')){_0x25efd7[_0x2c41('0x1d')]=_0x25efd7[_0x2c41('0x3a')];}else{_0x25efd7[_0x2c41('0x1d')]='';}}}}else{_0x25efd7[_0x2c41('0x31')]=util[_0x2c41('0x24')]('\x22%s\x22\x20<%s>',_0x25efd7[_0x2c41('0x3b')],_0x25efd7[_0x2c41('0x33')]);}if(RpcVoiceTransferReport['transfers'][_0x25efd7['linkedid']]){var _0x18a640=RpcVoiceTransferReport[_0x2c41('0x3c')][_0x25efd7[_0x2c41('0x3d')]];_0x18a640[_0x2c41('0x3e')]=_0x25efd7[_0x2c41('0x3f')];RpcVoiceTransferReport[_0x2c41('0x19')](_0x18a640);delete RpcVoiceTransferReport['transfers'][_0x25efd7['linkedid']];}RpcVoiceCallReport[_0x2c41('0x40')](_0x25efd7);if(_0x25efd7[_0x2c41('0x41')]){for(var _0x212eb8=0x0;_0x212eb8<_0x25efd7[_0x2c41('0x42')][_0x2c41('0x43')];_0x212eb8+=0x1){_0x25efd7['monitorFilename']=_0x25efd7['monitors'][_0x212eb8]['filename'];_0x25efd7[_0x2c41('0x44')]=_0x25efd7[_0x2c41('0x42')][_0x212eb8][_0x2c41('0x44')];if(_0x25efd7[_0x2c41('0x2c')]==_0x2c41('0x32')){_0x25efd7[_0x2c41('0x33')]=_0x25efd7[_0x2c41('0x3a')];_0x25efd7[_0x2c41('0x3b')]=_0x25efd7['connectedlinename'];_0x25efd7[_0x2c41('0x3a')]=_0x25efd7[_0x2c41('0x1d')];_0x25efd7[_0x2c41('0x45')]=_0x25efd7[_0x2c41('0x46')];_0x25efd7[_0x2c41('0x2c')]=_0x25efd7[_0x2c41('0x34')];}else if(_0x25efd7['exten']==_0x2c41('0x47')){_0x25efd7[_0x2c41('0x33')]=_0x25efd7['destination'];_0x25efd7[_0x2c41('0x2c')]=_0x25efd7[_0x2c41('0x34')];}RpcVoiceRecording[_0x2c41('0x40')](_0x25efd7);}}};Report[_0x2c41('0x10')][_0x2c41('0x48')]=function(_0x4c7d2d){if(_[_0x2c41('0x49')](_0x4c7d2d)){_0x4c7d2d[_0x2c41('0x4a')](function(_0x5d2257){RpcVoiceAgentReport[_0x2c41('0x40')](_0x5d2257);});}else{RpcVoiceAgentReport['create'](_0x4c7d2d);}};Report[_0x2c41('0x10')][_0x2c41('0x18')]=function(_0x153db8){RpcVoiceDialReport[_0x2c41('0x40')](_0x153db8);var _0x2d87ed;var _0x130577;var _0x53ae11=_0x153db8[_0x2c41('0x36')];if(_['startsWith'](_0x53ae11,_0x2c41('0x4b'))){_0x130577=_0x53ae11['substring'](_0x53ae11['indexOf']('/')+0x1,_0x53ae11[_0x2c41('0x4c')]('@'));_0x2d87ed=_[_0x2c41('0x1c')](this['agents'],function(_0x1501bb){return _0x1501bb[_0x2c41('0x4d')]==_0x130577||_0x1501bb['phone']==_0x130577||_0x1501bb['accountcode']==_0x130577;});}else{_0x130577=_0x53ae11[_0x2c41('0x4e')](_0x53ae11[_0x2c41('0x4c')]('/')+0x1,_0x53ae11[_0x2c41('0x4f')]('-'));_0x2d87ed=this[_0x2c41('0x1b')](_0x130577);}if(_0x2d87ed){_0x153db8[_0x2c41('0x20')]=_[_0x2c41('0x1f')](_0x2d87ed[_0x2c41('0x20')])?util['format'](_0x2c41('0x21'),_0x2d87ed[_0x2c41('0x1e')]):_0x2d87ed[_0x2c41('0x20')];_0x153db8[_0x2c41('0x46')]=_0x2d87ed[_0x2c41('0x1e')];_0x153db8[_0x2c41('0x1d')]=_0x2d87ed[_0x2c41('0x1d')];RpcMemberReport[_0x2c41('0x18')](_0x153db8);}};Report['prototype']['blindTransfer']=function(_0x5a4adf){RpcVoiceTransferReport[_0x2c41('0x3c')][_0x5a4adf[_0x2c41('0x50')]]=_0x5a4adf;};Report['prototype'][_0x2c41('0x1a')]=function(_0x4aeb5d){RpcVoiceTransferReport['attendedTransfer'](_0x4aeb5d);};module[_0x2c41('0x51')]=Report; \ No newline at end of file +var _0x8591=['../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceQueueReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','isNil','find','name','interface','length','connectedlinenum','assigned','lastAssignedTo','format','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','dialer','queue','lastdata','context','from-voip-provider','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','callerid','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','blindTransfer','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','exten','xcally-motion-dialer','isArray','forEach','channel','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','membername','exports','lodash','moment'];(function(_0x329560,_0x21224a){var _0x3626b1=function(_0x3fd3a9){while(--_0x3fd3a9){_0x329560['push'](_0x329560['shift']());}};_0x3626b1(++_0x21224a);}(_0x8591,0xa8));var _0x1859=function(_0x411a2b,_0x2a44ef){_0x411a2b=_0x411a2b-0x0;var _0x3448df=_0x8591[_0x411a2b];return _0x3448df;};'use strict';var _=require(_0x1859('0x0'));var moment=require(_0x1859('0x1'));var util=require('util');var config=require(_0x1859('0x2'));var ami=require(_0x1859('0x3'));var RpcVoiceAgentReport=require(_0x1859('0x4'));var RpcVoiceCallReport=require(_0x1859('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x1859('0x6'));var RpcVoiceQueueReport=require(_0x1859('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x1859('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x1859('0x9'));function Report(_0x47df94){this[_0x1859('0xa')]=_0x47df94;this[_0x1859('0xb')]=_0x47df94['agents'];this[_0x1859('0xc')]=_0x47df94[_0x1859('0xc')];}Report[_0x1859('0xd')][_0x1859('0xe')]=function(_0x4a53c1){var _0xb29c21=new VoiceQueueReport(this[_0x1859('0xa')]);var _0x3707d4=new VoiceAgentReport(this['realtime']);var _0x27452a=new VoiceDialReport(this[_0x1859('0xa')]);var _0x418daa=new VoiceCallReport(this['realtime']);var _0x1cd8d6=new UserReport(this[_0x1859('0xa')]);if(config[_0x1859('0xf')]&&config['xdr'][_0x1859('0x10')]){ami['on'](_0x1859('0x11'),this[_0x1859('0x12')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x1859('0x13')][_0x1859('0x14')](this));ami['on'](_0x1859('0x15'),this[_0x1859('0x16')][_0x1859('0x14')](this));ami['on'](_0x1859('0x17'),this[_0x1859('0x18')][_0x1859('0x14')](this));ami['on'](_0x1859('0x19'),this['blindTransfer'][_0x1859('0x14')](this));ami['on'](_0x1859('0x1a'),this[_0x1859('0x1b')]['bind'](this));}};Report['prototype'][_0x1859('0x1c')]=function(_0x58f665){var _0x2e3da2;_0x2e3da2=_['find'](this[_0x1859('0xb')],function(_0x2ed670){return _0x2ed670[_0x1859('0x1d')]==_0x58f665||_0x2ed670['name']==_0x58f665;});if(_[_0x1859('0x1e')](_0x2e3da2)){var _0x10a2e5=_[_0x1859('0x1f')](this[_0x1859('0xc')],function(_0x3e227f){return _0x3e227f[_0x1859('0x1d')]==_0x58f665||_0x3e227f[_0x1859('0x20')]==_0x58f665;});if(_0x10a2e5){_0x2e3da2=_['find'](this[_0x1859('0xb')],function(_0x4c0109){return _0x4c0109[_0x1859('0x21')]==util['format']('SIP/%s',_0x10a2e5[_0x1859('0x20')]);});}}return _0x2e3da2;};Report[_0x1859('0xd')][_0x1859('0x12')]=function(_0x27391b){for(var _0x55426b=0x0;_0x55426b<_0x27391b[_0x1859('0x22')];_0x55426b+=0x1){var _0x58e319=this[_0x1859('0x1c')](_0x27391b[_0x55426b][_0x1859('0x23')]);if(_0x58e319){_0x27391b[_0x55426b][_0x1859('0x1d')]=_0x58e319[_0x1859('0x1d')];_0x27391b[_0x55426b][_0x1859('0x24')]=!![];_0x27391b[_0x55426b][_0x1859('0x25')]=_0x58e319[_0x1859('0x20')];_0x27391b[_0x55426b][_0x1859('0x21')]=_[_0x1859('0x1e')](_0x58e319[_0x1859('0x21')])?util[_0x1859('0x26')](_0x1859('0x27'),_0x58e319['name']):_0x58e319[_0x1859('0x21')];if(_0x27391b[_0x55426b][_0x1859('0x28')]){_0x27391b[_0x55426b][_0x1859('0x29')]=moment()['format'](_0x1859('0x2a'));}if(_0x27391b[_0x55426b]['queuecallerexit']){_0x27391b[_0x55426b][_0x1859('0x2b')]=moment()['format'](_0x1859('0x2a'));}RpcMemberReport[_0x1859('0x12')](_0x27391b[_0x55426b]);}RpcVoiceQueueReport[_0x1859('0x2c')](_0x27391b[_0x55426b]);}};function extractCalleridNumber(_0x1bc150){var _0x121b4a=_0x1bc150[_0x1859('0x2d')](/<(.*?)>/);return _0x121b4a?_0x121b4a[0x1]:_0x1bc150;}Report[_0x1859('0xd')]['voiceCallReport']=function(_0x1351e9){_0x1351e9['destination']=_0x1351e9[_0x1859('0x2e')]||_0x1351e9['exten'];if(_0x1351e9['type']==_0x1859('0x2f')){_0x1351e9['lastapplication']=_0x1859('0x30');_0x1351e9[_0x1859('0x31')]=_0x1351e9[_0x1859('0x30')];if(_0x1351e9[_0x1859('0x32')]==_0x1859('0x33')){_0x1351e9[_0x1859('0x1d')]='';_0x1351e9[_0x1859('0x2e')]=extractCalleridNumber(_0x1351e9['callerid']);}else if(_0x1351e9[_0x1859('0x32')]=='from-sip'){if(_0x1351e9[_0x1859('0x2e')]=='xcally-motion-preview'){_0x1351e9['destination']=extractCalleridNumber(_0x1351e9[_0x1859('0x34')]);_0x1351e9[_0x1859('0x35')]=_0x1351e9[_0x1859('0x36')];_0x1351e9[_0x1859('0x37')]=[_0x1351e9['channel'],_0x1351e9['channel']=_0x1351e9[_0x1859('0x37')]][0x0];_0x1351e9[_0x1859('0x38')]=_0x1351e9[_0x1859('0x34')];}else{_0x1351e9['destination']=_0x1351e9[_0x1859('0x35')];_0x1351e9[_0x1859('0x35')]=_0x1351e9[_0x1859('0x36')];if(_0x1351e9['disposition']==_0x1859('0x39')){_0x1351e9[_0x1859('0x1d')]=_0x1351e9[_0x1859('0x23')];}else{_0x1351e9[_0x1859('0x1d')]='';}}}}else{_0x1351e9[_0x1859('0x38')]=util[_0x1859('0x26')](_0x1859('0x3a'),_0x1351e9[_0x1859('0x3b')],_0x1351e9[_0x1859('0x35')]);}if(RpcVoiceTransferReport[_0x1859('0x3c')][_0x1351e9[_0x1859('0x3d')]]){var _0x4f9149=RpcVoiceTransferReport[_0x1859('0x3c')][_0x1351e9[_0x1859('0x3d')]];_0x4f9149[_0x1859('0x3e')]=_0x1351e9['uniqueid'];RpcVoiceTransferReport[_0x1859('0x3f')](_0x4f9149);delete RpcVoiceTransferReport[_0x1859('0x3c')][_0x1351e9[_0x1859('0x3d')]];}RpcVoiceCallReport[_0x1859('0x2c')](_0x1351e9);if(_0x1351e9[_0x1859('0x40')]){for(var _0x51766f=0x0;_0x51766f<_0x1351e9[_0x1859('0x41')][_0x1859('0x22')];_0x51766f+=0x1){_0x1351e9[_0x1859('0x42')]=_0x1351e9[_0x1859('0x41')][_0x51766f][_0x1859('0x43')];_0x1351e9[_0x1859('0x44')]=_0x1351e9['monitors'][_0x51766f]['createdAt'];if(_0x1351e9['exten']==_0x1859('0x45')){_0x1351e9[_0x1859('0x35')]=_0x1351e9[_0x1859('0x23')];_0x1351e9[_0x1859('0x3b')]=_0x1351e9['connectedlinename'];_0x1351e9[_0x1859('0x23')]=_0x1351e9[_0x1859('0x1d')];_0x1351e9[_0x1859('0x46')]=_0x1351e9['membername'];_0x1351e9[_0x1859('0x47')]=_0x1351e9[_0x1859('0x36')];}else if(_0x1351e9[_0x1859('0x47')]==_0x1859('0x48')){_0x1351e9[_0x1859('0x35')]=_0x1351e9['destination'];_0x1351e9[_0x1859('0x47')]=_0x1351e9['originatecalleridnum'];}RpcVoiceRecording['create'](_0x1351e9);}}};Report[_0x1859('0xd')][_0x1859('0x16')]=function(_0x39a4f3){if(_[_0x1859('0x49')](_0x39a4f3)){_0x39a4f3[_0x1859('0x4a')](function(_0x448af5){RpcVoiceAgentReport[_0x1859('0x2c')](_0x448af5);});}else{RpcVoiceAgentReport[_0x1859('0x2c')](_0x39a4f3);}};Report['prototype'][_0x1859('0x18')]=function(_0x3ee8e2){RpcVoiceDialReport[_0x1859('0x2c')](_0x3ee8e2);var _0x5d7b14;var _0x1d6026;var _0x3ab171=_0x3ee8e2[_0x1859('0x4b')];if(_[_0x1859('0x4c')](_0x3ab171,_0x1859('0x4d'))){_0x1d6026=_0x3ab171[_0x1859('0x4e')](_0x3ab171[_0x1859('0x4f')]('/')+0x1,_0x3ab171[_0x1859('0x4f')]('@'));_0x5d7b14=_[_0x1859('0x1f')](this[_0x1859('0xb')],function(_0x519194){return _0x519194[_0x1859('0x50')]==_0x1d6026||_0x519194[_0x1859('0x51')]==_0x1d6026||_0x519194[_0x1859('0x1d')]==_0x1d6026;});}else{_0x1d6026=_0x3ab171[_0x1859('0x4e')](_0x3ab171[_0x1859('0x4f')]('/')+0x1,_0x3ab171[_0x1859('0x52')]('-'));_0x5d7b14=this[_0x1859('0x1c')](_0x1d6026);}if(_0x5d7b14){_0x3ee8e2[_0x1859('0x21')]=_[_0x1859('0x1e')](_0x5d7b14[_0x1859('0x21')])?util[_0x1859('0x26')](_0x1859('0x27'),_0x5d7b14[_0x1859('0x20')]):_0x5d7b14[_0x1859('0x21')];_0x3ee8e2[_0x1859('0x53')]=_0x5d7b14[_0x1859('0x20')];_0x3ee8e2[_0x1859('0x1d')]=_0x5d7b14['accountcode'];RpcMemberReport[_0x1859('0x18')](_0x3ee8e2);}};Report['prototype']['blindTransfer']=function(_0x81c620){RpcVoiceTransferReport[_0x1859('0x3c')][_0x81c620['transfererlinkedid']]=_0x81c620;};Report[_0x1859('0xd')][_0x1859('0x1b')]=function(_0x49dd0e){RpcVoiceTransferReport[_0x1859('0x1b')](_0x49dd0e);};module[_0x1859('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 c7b243a..8b2047e 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 _0xa017=['redis','defaults','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','actionSipPeerStatus','[userReport][sippeerstatus]','syncRealtimeShow','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','trunks','stateRegistry','merge','actionid','debug','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami'];(function(_0x3fa529,_0x3c341e){var _0x350134=function(_0x47368e){while(--_0x47368e){_0x3fa529['push'](_0x3fa529['shift']());}};_0x350134(++_0x3c341e);}(_0xa017,0x1f1));var _0x7a01=function(_0x55cba1,_0x45e97e){_0x55cba1=_0x55cba1-0x0;var _0x2eaee9=_0xa017[_0x55cba1];return _0x2eaee9;};'use strict';var _=require(_0x7a01('0x0'));var moment=require(_0x7a01('0x1'));var util=require(_0x7a01('0x2'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x7a01('0x3'));var logger=require(_0x7a01('0x4'))(_0x7a01('0x5'));var ami=require(_0x7a01('0x6'));config[_0x7a01('0x7')]=_[_0x7a01('0x8')](config[_0x7a01('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a01('0x7')]));function UserReport(_0x2ba0cd){this['trunks']=_0x2ba0cd['trunks'];this['agents']=_0x2ba0cd[_0x7a01('0x9')];this['telephones']=_0x2ba0cd[_0x7a01('0xa')];ami['on'](_0x7a01('0xb'),this[_0x7a01('0xc')][_0x7a01('0xd')](this));ami['on'](_0x7a01('0xe'),this[_0x7a01('0xc')][_0x7a01('0xd')](this));ami['on']('devicestatechange',this[_0x7a01('0xf')]['bind'](this));ami['on'](_0x7a01('0x10'),this[_0x7a01('0x11')][_0x7a01('0xd')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x7a01('0x12')]()[_0x7a01('0x13')](ami[_0x7a01('0x14')]())[_0x7a01('0x15')](function(_0x2781d6){logger[_0x7a01('0x16')](_0x7a01('0x17'),util[_0x7a01('0x18')](_0x2781d6,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x7a01('0x12')]()[_0x7a01('0x13')](ami[_0x7a01('0x19')]())[_0x7a01('0x15')](function(_0x558d65){logger['error']('[userReport][devicestatelist]',util[_0x7a01('0x18')](_0x558d65,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x7a01('0x13')](ami[_0x7a01('0x1a')]())[_0x7a01('0x15')](function(_0x489ad9){logger[_0x7a01('0x16')](_0x7a01('0x1b'),util[_0x7a01('0x18')](_0x489ad9,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x7a01('0x1c')]=function(){setInterval(function(){BPromise[_0x7a01('0x12')]()[_0x7a01('0x13')](showSipRegistrations())[_0x7a01('0x13')](listDeviceStates())[_0x7a01('0x13')](showPeersStatus());},0x32c8);};UserReport[_0x7a01('0x1d')][_0x7a01('0x1e')]=function(_0x19e753){return _0x19e753!==null&&!_[_0x7a01('0x1f')](_0x19e753);};UserReport[_0x7a01('0x1d')][_0x7a01('0x20')]=function(_0x2f1177,_0x404cc1,_0x1690bb){io['to'](_0x2f1177)[_0x7a01('0x20')](_0x404cc1,_0x1690bb);};UserReport[_0x7a01('0x1d')]['syncRegistry']=function(_0x2005bf){try{if(this['isNotNull'](_0x2005bf)){logger[_0x7a01('0x21')](_0x7a01('0x22'),_0x2005bf[_0x7a01('0x23')],_0x2005bf[_0x7a01('0x24')]);logger['debug'](_0x7a01('0x25'),util[_0x7a01('0x18')](_0x2005bf,{'showHidden':![],'depth':null}));var _0x1ea7b9=_[_0x7a01('0x26')](this[_0x7a01('0x27')],{'registry':_0x2005bf[_0x7a01('0x23')]});if(_0x1ea7b9){_0x2005bf[_0x7a01('0x28')]=_0x2005bf[_0x7a01('0x24')];_[_0x7a01('0x29')](_0x1ea7b9,_['omit'](_0x2005bf,['event',_0x7a01('0x2a'),_0x7a01('0x23'),_0x7a01('0x24')]));logger[_0x7a01('0x2b')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x7a01('0x18')](_0x1ea7b9,{'showHidden':![],'depth':null}));this[_0x7a01('0x20')](util[_0x7a01('0x2c')](_0x7a01('0x2d'),_0x1ea7b9[_0x7a01('0x2e')]),_0x7a01('0x2f'),_0x1ea7b9);}}}catch(_0x55b7dc){logger[_0x7a01('0x16')]('[userReport][registry]',util[_0x7a01('0x18')](_0x55b7dc,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x7a01('0xf')]=function(_0x55c08f){try{if(this[_0x7a01('0x1e')](_0x55c08f)){logger['info'](_0x7a01('0x30'),_0x55c08f['device'],_0x55c08f['state']);logger[_0x7a01('0x2b')](_0x7a01('0x31'),util[_0x7a01('0x18')](_0x55c08f,{'showHidden':![],'depth':null}));if(this[_0x7a01('0x9')][_0x55c08f['device']]){if(!this[_0x7a01('0x9')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x33')]||_0x55c08f[_0x7a01('0x24')][_0x7a01('0x34')]()==_0x7a01('0x35')){this[_0x7a01('0x9')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x33')]=![];if(this[_0x7a01('0x9')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x24')]!==_0x55c08f['state'][_0x7a01('0x34')]()){this[_0x7a01('0x9')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x36')]=_[_0x7a01('0x37')](moment()['format']('x'));}this[_0x7a01('0x9')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x24')]=_0x55c08f[_0x7a01('0x24')][_0x7a01('0x34')]();this[_0x7a01('0x9')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x38')](_0x55c08f);}}else if(this['telephones'][_0x55c08f[_0x7a01('0x32')]]){if(this['telephones'][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x24')]!==_0x55c08f['state'][_0x7a01('0x34')]()){this[_0x7a01('0xa')][_0x55c08f['device']][_0x7a01('0x36')]=_[_0x7a01('0x37')](moment()[_0x7a01('0x2c')]('x'));}this[_0x7a01('0xa')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x24')]=_0x55c08f[_0x7a01('0x24')]['toLowerCase']();logger[_0x7a01('0x2b')](_0x7a01('0x39'),util[_0x7a01('0x18')](this[_0x7a01('0xa')][_0x55c08f[_0x7a01('0x32')]],{'showHidden':![],'depth':null}));this[_0x7a01('0x20')](util['format'](_0x7a01('0x3a'),this[_0x7a01('0xa')][_0x55c08f['device']]['name']),'telephone:save',this[_0x7a01('0xa')][_0x55c08f[_0x7a01('0x32')]]);}else if(this[_0x7a01('0x27')][_0x55c08f['device']]){if(this[_0x7a01('0x27')][_0x55c08f[_0x7a01('0x32')]]['state']!==_0x55c08f[_0x7a01('0x24')][_0x7a01('0x34')]()){this[_0x7a01('0x27')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x36')]=_[_0x7a01('0x37')](moment()[_0x7a01('0x2c')]('x'));}this[_0x7a01('0x27')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x24')]=_0x55c08f[_0x7a01('0x24')][_0x7a01('0x34')]();logger[_0x7a01('0x2b')](_0x7a01('0x3b'),util[_0x7a01('0x18')](this['trunks'][_0x55c08f[_0x7a01('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x7a01('0x2c')](_0x7a01('0x2d'),this[_0x7a01('0x27')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x2e')]),_0x7a01('0x2f'),this['trunks'][_0x55c08f['device']]);}else if(_[_0x7a01('0x3c')](_0x55c08f[_0x7a01('0x32')],_0x7a01('0x3d'))){var _0x49d0fc=_0x55c08f['device'];var _0x358acb=_0x49d0fc[_0x7a01('0x3e')](_0x49d0fc[_0x7a01('0x3f')]('/')+0x1,_0x49d0fc[_0x7a01('0x3f')]('@'));var _0x3632a9=_['find'](this[_0x7a01('0x9')],function(_0x537baa){return _0x537baa[_0x7a01('0x40')]==_0x358acb||_0x537baa[_0x7a01('0x41')]==_0x358acb||_0x537baa[_0x7a01('0x42')]==_0x358acb;});if(_0x3632a9){if(_0x3632a9[_0x7a01('0x24')]!==_0x55c08f['state'][_0x7a01('0x34')]()){_0x3632a9[_0x7a01('0x36')]=_[_0x7a01('0x37')](moment()[_0x7a01('0x2c')]('x'));}_0x3632a9[_0x7a01('0x24')]=_0x55c08f[_0x7a01('0x24')]['toLowerCase']();_0x3632a9['local']=!![];_0x3632a9['updateStatusRealtime'](_0x55c08f);}}}}catch(_0x958a12){logger['error'](_0x7a01('0x31'),util[_0x7a01('0x18')](_0x958a12,{'showHidden':![],'depth':null}));}};UserReport[_0x7a01('0x1d')][_0x7a01('0x11')]=function(_0x39c2ad){try{if(this['isNotNull'](_0x39c2ad)&&this[_0x7a01('0x1e')](_0x39c2ad[_0x7a01('0x10')])){logger[_0x7a01('0x21')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x39c2ad[_0x7a01('0x43')],_0x39c2ad[_0x7a01('0x44')],_0x39c2ad['peerstatus']);logger[_0x7a01('0x2b')](_0x7a01('0x45'),util[_0x7a01('0x18')](_0x39c2ad,{'showHidden':![],'depth':null}));if(this[_0x7a01('0x9')][_0x39c2ad[_0x7a01('0x43')]]){if(!this[_0x7a01('0x9')][_0x39c2ad[_0x7a01('0x43')]][_0x7a01('0x33')]||_0x39c2ad[_0x7a01('0x10')][_0x7a01('0x34')]()=='registered'){this[_0x7a01('0x9')][_0x39c2ad[_0x7a01('0x43')]]['local']=![];this['agents'][_0x39c2ad[_0x7a01('0x43')]]['status']=_0x39c2ad[_0x7a01('0x10')][_0x7a01('0x34')]();this['agents'][_0x39c2ad['peer']][_0x7a01('0x44')]=_0x39c2ad[_0x7a01('0x44')];this[_0x7a01('0x9')][_0x39c2ad[_0x7a01('0x43')]][_0x7a01('0x38')](_0x39c2ad);}}else if(this[_0x7a01('0xa')][_0x39c2ad[_0x7a01('0x43')]]){this['telephones'][_0x39c2ad[_0x7a01('0x43')]][_0x7a01('0x46')]=_0x39c2ad['peerstatus']['toLowerCase']();this[_0x7a01('0xa')][_0x39c2ad[_0x7a01('0x43')]][_0x7a01('0x44')]=_0x39c2ad[_0x7a01('0x44')];logger[_0x7a01('0x2b')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x7a01('0xa')][_0x39c2ad[_0x7a01('0x43')]],{'showHidden':![],'depth':null}));this[_0x7a01('0x20')](util[_0x7a01('0x2c')](_0x7a01('0x3a'),this['telephones'][_0x39c2ad[_0x7a01('0x43')]]['name']),'telephone:save',this[_0x7a01('0xa')][_0x39c2ad[_0x7a01('0x43')]]);}else if(this['trunks'][_0x39c2ad[_0x7a01('0x43')]]){this[_0x7a01('0x27')][_0x39c2ad[_0x7a01('0x43')]]['status']=_0x39c2ad[_0x7a01('0x10')][_0x7a01('0x34')]();this[_0x7a01('0x27')][_0x39c2ad[_0x7a01('0x43')]][_0x7a01('0x44')]=_0x39c2ad['address'];logger['debug'](_0x7a01('0x47'),util[_0x7a01('0x18')](this[_0x7a01('0x27')][_0x39c2ad[_0x7a01('0x43')]],{'showHidden':![],'depth':null}));this[_0x7a01('0x20')](util[_0x7a01('0x2c')](_0x7a01('0x2d'),this[_0x7a01('0x27')][_0x39c2ad[_0x7a01('0x43')]][_0x7a01('0x2e')]),_0x7a01('0x2f'),this['trunks'][_0x39c2ad[_0x7a01('0x43')]]);}}}catch(_0x2745bf){logger[_0x7a01('0x16')](_0x7a01('0x45'),util[_0x7a01('0x18')](_0x2745bf,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xde25=['find','merge','omit','format','trunk:%s','name','trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','inuse','toLowerCase','stateTime','toNumber','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','util','ioredis','bluebird','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][devicestatelist]','inspect','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug'];(function(_0x3eceb2,_0x509ff8){var _0x818bc4=function(_0x2ba2a3){while(--_0x2ba2a3){_0x3eceb2['push'](_0x3eceb2['shift']());}};_0x818bc4(++_0x509ff8);}(_0xde25,0x104));var _0x5de2=function(_0x1277d7,_0x1fedd5){_0x1277d7=_0x1277d7-0x0;var _0x1f0522=_0xde25[_0x1277d7];return _0x1f0522;};'use strict';var _=require(_0x5de2('0x0'));var moment=require('moment');var util=require(_0x5de2('0x1'));var Redis=require(_0x5de2('0x2'));var BPromise=require(_0x5de2('0x3'));var config=require(_0x5de2('0x4'));var logger=require(_0x5de2('0x5'))('ami');var ami=require(_0x5de2('0x6'));config[_0x5de2('0x7')]=_[_0x5de2('0x8')](config['redis'],{'host':_0x5de2('0x9'),'port':0x18eb});var io=require(_0x5de2('0xa'))(new Redis(config['redis']));function UserReport(_0x332afe){this[_0x5de2('0xb')]=_0x332afe[_0x5de2('0xb')];this[_0x5de2('0xc')]=_0x332afe[_0x5de2('0xc')];this[_0x5de2('0xd')]=_0x332afe['telephones'];ami['on'](_0x5de2('0xe'),this[_0x5de2('0xf')][_0x5de2('0x10')](this));ami['on'](_0x5de2('0x11'),this[_0x5de2('0xf')][_0x5de2('0x10')](this));ami['on'](_0x5de2('0x12'),this[_0x5de2('0x13')][_0x5de2('0x10')](this));ami['on'](_0x5de2('0x14'),this[_0x5de2('0x15')]['bind'](this));return this[_0x5de2('0x16')]();}function showSipRegistrations(){Promise[_0x5de2('0x17')]()[_0x5de2('0x18')](ami[_0x5de2('0x19')]())['catch'](function(_0x80d69c){logger['error']('[userReport][sipshowregistry]',util['inspect'](_0x80d69c,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x5de2('0x17')]()[_0x5de2('0x18')](ami['actionDeviceStateList']())[_0x5de2('0x1a')](function(_0xabfc1d){logger[_0x5de2('0x1b')](_0x5de2('0x1c'),util[_0x5de2('0x1d')](_0xabfc1d,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x5de2('0x17')]()[_0x5de2('0x18')](ami[_0x5de2('0x1e')]())[_0x5de2('0x1a')](function(_0xbe488){logger[_0x5de2('0x1b')]('[userReport][sippeerstatus]',util[_0x5de2('0x1d')](_0xbe488,{'showHidden':![],'depth':null}));});}UserReport[_0x5de2('0x1f')][_0x5de2('0x16')]=function(){setInterval(function(){BPromise['resolve']()['then'](showSipRegistrations())[_0x5de2('0x18')](listDeviceStates())[_0x5de2('0x18')](showPeersStatus());},0x32c8);};UserReport[_0x5de2('0x1f')][_0x5de2('0x20')]=function(_0x2a3f8b){return _0x2a3f8b!==null&&!_[_0x5de2('0x21')](_0x2a3f8b);};UserReport[_0x5de2('0x1f')][_0x5de2('0x22')]=function(_0x4661a1,_0x3504d4,_0x6dd901){io['to'](_0x4661a1)[_0x5de2('0x22')](_0x3504d4,_0x6dd901);};UserReport[_0x5de2('0x1f')][_0x5de2('0xf')]=function(_0x42481c){try{if(this[_0x5de2('0x20')](_0x42481c)){logger[_0x5de2('0x23')](_0x5de2('0x24'),_0x42481c[_0x5de2('0x25')],_0x42481c[_0x5de2('0x26')]);logger[_0x5de2('0x27')]('[userReport][registry]',util[_0x5de2('0x1d')](_0x42481c,{'showHidden':![],'depth':null}));var _0x1be7a3=_[_0x5de2('0x28')](this[_0x5de2('0xb')],{'registry':_0x42481c['username']});if(_0x1be7a3){_0x42481c['stateRegistry']=_0x42481c[_0x5de2('0x26')];_[_0x5de2('0x29')](_0x1be7a3,_[_0x5de2('0x2a')](_0x42481c,['event','actionid',_0x5de2('0x25'),'state']));logger[_0x5de2('0x27')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x1be7a3,{'showHidden':![],'depth':null}));this[_0x5de2('0x22')](util[_0x5de2('0x2b')](_0x5de2('0x2c'),_0x1be7a3[_0x5de2('0x2d')]),_0x5de2('0x2e'),_0x1be7a3);}}}catch(_0x43ffb4){logger[_0x5de2('0x1b')](_0x5de2('0x2f'),util[_0x5de2('0x1d')](_0x43ffb4,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x5de2('0x13')]=function(_0xb6c447){try{if(this[_0x5de2('0x20')](_0xb6c447)){logger['info'](_0x5de2('0x30'),_0xb6c447['device'],_0xb6c447[_0x5de2('0x26')]);logger[_0x5de2('0x27')](_0x5de2('0x31'),util[_0x5de2('0x1d')](_0xb6c447,{'showHidden':![],'depth':null}));if(this[_0x5de2('0xc')][_0xb6c447[_0x5de2('0x32')]]){if(!this[_0x5de2('0xc')][_0xb6c447[_0x5de2('0x32')]][_0x5de2('0x33')]||_0xb6c447[_0x5de2('0x26')]['toLowerCase']()==_0x5de2('0x34')){this[_0x5de2('0xc')][_0xb6c447['device']][_0x5de2('0x33')]=![];if(this['agents'][_0xb6c447['device']][_0x5de2('0x26')]!==_0xb6c447[_0x5de2('0x26')][_0x5de2('0x35')]()){this[_0x5de2('0xc')][_0xb6c447[_0x5de2('0x32')]][_0x5de2('0x36')]=_[_0x5de2('0x37')](moment()[_0x5de2('0x2b')]('x'));}this['agents'][_0xb6c447[_0x5de2('0x32')]][_0x5de2('0x26')]=_0xb6c447[_0x5de2('0x26')][_0x5de2('0x35')]();this[_0x5de2('0xc')][_0xb6c447['device']]['updateStatusRealtime'](_0xb6c447);}}else if(this[_0x5de2('0xd')][_0xb6c447[_0x5de2('0x32')]]){if(this[_0x5de2('0xd')][_0xb6c447['device']]['state']!==_0xb6c447['state'][_0x5de2('0x35')]()){this[_0x5de2('0xd')][_0xb6c447[_0x5de2('0x32')]]['stateTime']=_[_0x5de2('0x37')](moment()[_0x5de2('0x2b')]('x'));}this[_0x5de2('0xd')][_0xb6c447[_0x5de2('0x32')]][_0x5de2('0x26')]=_0xb6c447[_0x5de2('0x26')][_0x5de2('0x35')]();logger[_0x5de2('0x27')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x5de2('0x1d')](this[_0x5de2('0xd')][_0xb6c447[_0x5de2('0x32')]],{'showHidden':![],'depth':null}));this[_0x5de2('0x22')](util[_0x5de2('0x2b')](_0x5de2('0x38'),this['telephones'][_0xb6c447[_0x5de2('0x32')]][_0x5de2('0x2d')]),_0x5de2('0x39'),this[_0x5de2('0xd')][_0xb6c447[_0x5de2('0x32')]]);}else if(this[_0x5de2('0xb')][_0xb6c447[_0x5de2('0x32')]]){if(this[_0x5de2('0xb')][_0xb6c447[_0x5de2('0x32')]][_0x5de2('0x26')]!==_0xb6c447['state'][_0x5de2('0x35')]()){this[_0x5de2('0xb')][_0xb6c447[_0x5de2('0x32')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this[_0x5de2('0xb')][_0xb6c447[_0x5de2('0x32')]][_0x5de2('0x26')]=_0xb6c447[_0x5de2('0x26')][_0x5de2('0x35')]();logger['debug'](_0x5de2('0x3a'),util['inspect'](this['trunks'][_0xb6c447[_0x5de2('0x32')]],{'showHidden':![],'depth':null}));this[_0x5de2('0x22')](util['format'](_0x5de2('0x2c'),this['trunks'][_0xb6c447[_0x5de2('0x32')]][_0x5de2('0x2d')]),_0x5de2('0x2e'),this[_0x5de2('0xb')][_0xb6c447[_0x5de2('0x32')]]);}else if(_[_0x5de2('0x3b')](_0xb6c447['device'],'Local')){var _0x21a2c1=_0xb6c447[_0x5de2('0x32')];var _0x13be61=_0x21a2c1[_0x5de2('0x3c')](_0x21a2c1[_0x5de2('0x3d')]('/')+0x1,_0x21a2c1[_0x5de2('0x3d')]('@'));var _0x2e54fa=_['find'](this[_0x5de2('0xc')],function(_0x9ac9){return _0x9ac9[_0x5de2('0x3e')]==_0x13be61||_0x9ac9[_0x5de2('0x3f')]==_0x13be61||_0x9ac9[_0x5de2('0x40')]==_0x13be61;});if(_0x2e54fa){if(_0x2e54fa[_0x5de2('0x26')]!==_0xb6c447[_0x5de2('0x26')][_0x5de2('0x35')]()){_0x2e54fa[_0x5de2('0x36')]=_[_0x5de2('0x37')](moment()['format']('x'));}_0x2e54fa['state']=_0xb6c447[_0x5de2('0x26')]['toLowerCase']();_0x2e54fa[_0x5de2('0x33')]=!![];_0x2e54fa[_0x5de2('0x41')](_0xb6c447);}}}}catch(_0x1bbc3e){logger[_0x5de2('0x1b')]('[userReport][devicestatechange]',util['inspect'](_0x1bbc3e,{'showHidden':![],'depth':null}));}};UserReport[_0x5de2('0x1f')][_0x5de2('0x15')]=function(_0x582094){try{if(this[_0x5de2('0x20')](_0x582094)&&this['isNotNull'](_0x582094[_0x5de2('0x14')])){logger['info'](_0x5de2('0x42'),_0x582094[_0x5de2('0x43')],_0x582094['address'],_0x582094['peerstatus']);logger[_0x5de2('0x27')]('[userReport][peerstatus]',util[_0x5de2('0x1d')](_0x582094,{'showHidden':![],'depth':null}));if(this[_0x5de2('0xc')][_0x582094[_0x5de2('0x43')]]){if(!this[_0x5de2('0xc')][_0x582094['peer']][_0x5de2('0x33')]||_0x582094['peerstatus'][_0x5de2('0x35')]()==_0x5de2('0x44')){this['agents'][_0x582094['peer']]['local']=![];this[_0x5de2('0xc')][_0x582094['peer']][_0x5de2('0x45')]=_0x582094['peerstatus'][_0x5de2('0x35')]();this[_0x5de2('0xc')][_0x582094[_0x5de2('0x43')]]['address']=_0x582094[_0x5de2('0x46')];this[_0x5de2('0xc')][_0x582094[_0x5de2('0x43')]]['updateStatusRealtime'](_0x582094);}}else if(this['telephones'][_0x582094[_0x5de2('0x43')]]){this[_0x5de2('0xd')][_0x582094[_0x5de2('0x43')]][_0x5de2('0x45')]=_0x582094[_0x5de2('0x14')][_0x5de2('0x35')]();this[_0x5de2('0xd')][_0x582094[_0x5de2('0x43')]][_0x5de2('0x46')]=_0x582094[_0x5de2('0x46')];logger['debug'](_0x5de2('0x47'),util[_0x5de2('0x1d')](this[_0x5de2('0xd')][_0x582094[_0x5de2('0x43')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x5de2('0x2b')](_0x5de2('0x38'),this[_0x5de2('0xd')][_0x582094[_0x5de2('0x43')]][_0x5de2('0x2d')]),_0x5de2('0x39'),this[_0x5de2('0xd')][_0x582094[_0x5de2('0x43')]]);}else if(this[_0x5de2('0xb')][_0x582094[_0x5de2('0x43')]]){this[_0x5de2('0xb')][_0x582094[_0x5de2('0x43')]]['status']=_0x582094[_0x5de2('0x14')][_0x5de2('0x35')]();this[_0x5de2('0xb')][_0x582094['peer']][_0x5de2('0x46')]=_0x582094[_0x5de2('0x46')];logger[_0x5de2('0x27')](_0x5de2('0x48'),util[_0x5de2('0x1d')](this[_0x5de2('0xb')][_0x582094[_0x5de2('0x43')]],{'showHidden':![],'depth':null}));this[_0x5de2('0x22')](util[_0x5de2('0x2b')](_0x5de2('0x2c'),this['trunks'][_0x582094[_0x5de2('0x43')]]['name']),_0x5de2('0x2e'),this['trunks'][_0x582094[_0x5de2('0x43')]]);}}}catch(_0x2d9a7a){logger[_0x5de2('0x1b')](_0x5de2('0x49'),util[_0x5de2('0x1d')](_0x2d9a7a,{'showHidden':![],'depth':null}));}};module[_0x5de2('0x4a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index e4d8e4a..fb15195 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 _0x443c=['[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','syncVarSet','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','talktime','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','defaults','redis','localhost','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','hangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','channels','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','variables','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','reason','transfer','acw','acwtime','acwTimeout','agentacw','interface'];(function(_0x5e2f89,_0x7b2df8){var _0x30ebe6=function(_0xfc58c1){while(--_0xfc58c1){_0x5e2f89['push'](_0x5e2f89['shift']());}};_0x30ebe6(++_0x7b2df8);}(_0x443c,0xd0));var _0xc443=function(_0x53538f,_0x3b129d){_0x53538f=_0x53538f-0x0;var _0x4a5ffc=_0x443c[_0x53538f];return _0x4a5ffc;};'use strict';var _=require(_0xc443('0x0'));var moment=require(_0xc443('0x1'));var util=require(_0xc443('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require('../ami');config['redis']=_[_0xc443('0x3')](config[_0xc443('0x4')],{'host':_0xc443('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x2c8874){this['channels']={};this[_0xc443('0x6')]=_0x2c8874[_0xc443('0x6')];this[_0xc443('0x7')]=_0x2c8874['agents'];this['variables']={};ami['on'](_0xc443('0x8'),this[_0xc443('0x9')][_0xc443('0xa')](this));ami['on'](_0xc443('0xb'),this[_0xc443('0xc')]['bind'](this));ami['on'](_0xc443('0xd'),this[_0xc443('0xe')][_0xc443('0xa')](this));ami['on'](_0xc443('0xf'),this[_0xc443('0x10')][_0xc443('0xa')](this));ami['on'](_0xc443('0x11'),this[_0xc443('0x12')][_0xc443('0xa')](this));ami['on']('varset',this['syncVarSet'][_0xc443('0xa')](this));ami['on'](_0xc443('0x13'),this['syncHangup'][_0xc443('0xa')](this));ami['on'](_0xc443('0x14'),this['syncMusicOnHoldStart'][_0xc443('0xa')](this));ami['on'](_0xc443('0x15'),this[_0xc443('0x16')][_0xc443('0xa')](this));ami['on'](_0xc443('0x17'),this['syncAttendedTransfer'][_0xc443('0xa')](this));ami['on'](_0xc443('0x18'),this[_0xc443('0x19')][_0xc443('0xa')](this));}VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x1b')]=function(_0x49cd07,_0x46d727,_0x27dddf){io['to'](_0x49cd07)[_0xc443('0x1b')](_0x46d727,_0x27dddf);};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x1c')]=function(_0x1cc423){return _0x1cc423!==null&&!_[_0xc443('0x1d')](_0x1cc423);};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x9')]=function(_0x2ddf3){try{if(this[_0xc443('0x1c')](_0x2ddf3)){logger[_0xc443('0x1e')](_0xc443('0x1f'),_0x2ddf3['uniqueid'],_0x2ddf3[_0xc443('0x20')],_0x2ddf3[_0xc443('0x21')]);logger[_0xc443('0x22')](_0xc443('0x23'),_0x2ddf3[_0xc443('0x24')],util['inspect'](_0x2ddf3,{'showHidden':![],'depth':null}));if(_[_0xc443('0x1d')](this['channels'][_0x2ddf3[_0xc443('0x24')]])){this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]]={};}if(_['isUndefined'](this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]])){this['channels'][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]]={'agentcalledAt':moment()['format'](_0xc443('0x26')),'lastevent':_0xc443('0x27'),'mandatoryDisposition':this['voiceQueues'][_0x2ddf3[_0xc443('0x28')]]?this['voiceQueues'][_0x2ddf3[_0xc443('0x28')]][_0xc443('0x29')]||![]:![],'type':this[_0xc443('0x6')][_0x2ddf3['queue']]?this[_0xc443('0x6')][_0x2ddf3[_0xc443('0x28')]][_0xc443('0x2a')]||_0xc443('0x2b'):_0xc443('0x2b'),'variables':this[_0xc443('0x2c')][_0x2ddf3['uniqueid']]};}_['merge'](this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]],_[_0xc443('0x2d')](_0x2ddf3,[_0xc443('0x2e'),_0xc443('0x2f')]));logger[_0xc443('0x22')](_0xc443('0x30'),_0x2ddf3['uniqueid'],util[_0xc443('0x31')](this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]],{'showHidden':![],'depth':null}));ami[_0xc443('0x1b')](_0xc443('0x32'),this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]]);logger[_0xc443('0x22')](_0xc443('0x33'),_0x2ddf3[_0xc443('0x24')],util[_0xc443('0x31')](this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xc443('0x34')](_0xc443('0x35'),_0x2ddf3[_0xc443('0x20')]),_0xc443('0x36'),this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]]);}}catch(_0x2d04d2){logger['error'](_0xc443('0x37'),_0x2ddf3[_0xc443('0x24')],util[_0xc443('0x31')](_0x2d04d2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0xc')]=function(_0x4269c5){try{if(this['isNotNull'](_0x4269c5)){if(this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]]){logger['debug']('[%s][voiceAgentReport][agentconnect]\x20event:',_0x4269c5[_0xc443('0x24')],util[_0xc443('0x31')](_0x4269c5,{'showHidden':![],'depth':null}));for(var _0xbd0e23 in this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]]){if(this['channels'][_0x4269c5[_0xc443('0x24')]][_0xc443('0x38')](_0xbd0e23)){if(_0x4269c5[_0xc443('0x21')]===_0xbd0e23){logger['info'](_0xc443('0x39'),_0x4269c5[_0xc443('0x24')],_0x4269c5[_0xc443('0x20')],_0x4269c5[_0xc443('0x21')]);this[_0xc443('0x25')][_0x4269c5['uniqueid']][_0xbd0e23][_0xc443('0x3a')]=moment()[_0xc443('0x34')](_0xc443('0x26'));this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x3b')]=_0x4269c5[_0xc443('0x3b')];this[_0xc443('0x25')][_0x4269c5['uniqueid']][_0xbd0e23][_0xc443('0x3c')]=_0x4269c5[_0xc443('0x3c')];this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x3d')]=_0x4269c5[_0xc443('0x3d')];this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x3e')]=_0x4269c5[_0xc443('0x3e')];this['channels'][_0x4269c5['uniqueid']][_0xbd0e23][_0xc443('0x3f')]=_0x4269c5[_0xc443('0x3f')];this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x40')]=_0xc443('0x41');_['merge'](this[_0xc443('0x7')][_0x4269c5['interface']],_[_0xc443('0x42')](_0x4269c5,[_0xc443('0x28'),_0xc443('0x43')]));logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x4269c5['uniqueid'],util[_0xc443('0x31')](this['channels'][_0x4269c5[_0xc443('0x24')]][_0x4269c5['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xc443('0x44'),this[_0xc443('0x25')][_0x4269c5['uniqueid']][_0x4269c5[_0xc443('0x21')]]);logger[_0xc443('0x22')](_0xc443('0x45'),_0x4269c5[_0xc443('0x24')],util[_0xc443('0x31')](this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0x4269c5[_0xc443('0x21')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xc443('0x34')](_0xc443('0x35'),_0x4269c5[_0xc443('0x20')]),'user:agentconnect',this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0x4269c5[_0xc443('0x21')]]);}else if(!this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23]['agentringnoanswer']&&!this['channels'][_0x4269c5['uniqueid']][_0xbd0e23][_0xc443('0x11')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4269c5[_0xc443('0x24')],this['channels'][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x20')],_0xbd0e23);this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0xd')]=!![];this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x46')]=moment()['format'](_0xc443('0x26'));this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x47')]=_0x4269c5[_0xc443('0x21')];this[_0xc443('0x25')][_0x4269c5['uniqueid']][_0xbd0e23][_0xc443('0x48')]=_0x4269c5[_0xc443('0x20')];this['channels'][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x40')]='answered_elsewhere';this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23]['reason']=_0xc443('0x49');logger[_0xc443('0x22')](_0xc443('0x4a'),_0x4269c5[_0xc443('0x24')],util[_0xc443('0x31')](this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23],{'showHidden':![],'depth':null}));ami['emit'](_0xc443('0x4b'),this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23]);}}}}}}catch(_0x2ee2ff){logger[_0xc443('0x4c')](_0xc443('0x4d'),_0x4269c5['uniqueid'],util[_0xc443('0x31')](_0x2ee2ff,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0xe')]=function(_0xa9edcc){try{if(this[_0xc443('0x1c')](_0xa9edcc)){logger[_0xc443('0x22')](_0xc443('0x4e'),_0xa9edcc[_0xc443('0x24')],util[_0xc443('0x31')](_0xa9edcc,{'showHidden':![],'depth':null}));if(this[_0xc443('0x25')][_0xa9edcc[_0xc443('0x24')]]&&this[_0xc443('0x25')][_0xa9edcc['uniqueid']][_0xa9edcc[_0xc443('0x21')]]){logger[_0xc443('0x1e')](_0xc443('0x4f'),_0xa9edcc[_0xc443('0x24')],_0xa9edcc[_0xc443('0x20')],_0xa9edcc[_0xc443('0x21')]);this[_0xc443('0x25')][_0xa9edcc[_0xc443('0x24')]][_0xa9edcc[_0xc443('0x21')]][_0xc443('0xd')]=!![];this[_0xc443('0x25')][_0xa9edcc[_0xc443('0x24')]][_0xa9edcc[_0xc443('0x21')]][_0xc443('0x46')]=moment()[_0xc443('0x34')](_0xc443('0x26'));this[_0xc443('0x25')][_0xa9edcc['uniqueid']][_0xa9edcc[_0xc443('0x21')]]['lastevent']=_0xc443('0x50');this[_0xc443('0x25')][_0xa9edcc[_0xc443('0x24')]][_0xa9edcc[_0xc443('0x21')]]['reason']=_0xc443('0x50');logger[_0xc443('0x22')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0xa9edcc[_0xc443('0x24')],util[_0xc443('0x31')](this[_0xc443('0x25')][_0xa9edcc[_0xc443('0x24')]][_0xa9edcc['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xc443('0x1b')](_0xc443('0x51'),this[_0xc443('0x25')][_0xa9edcc[_0xc443('0x24')]][_0xa9edcc[_0xc443('0x21')]]);}}}catch(_0x2b84c8){logger[_0xc443('0x4c')](_0xc443('0x52'),_0xa9edcc['uniqueid'],util[_0xc443('0x31')](_0x2b84c8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xc443('0x10')]=function(_0x4ee6b6){try{if(this[_0xc443('0x1c')](_0x4ee6b6)){logger[_0xc443('0x22')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x4ee6b6[_0xc443('0x24')],util[_0xc443('0x31')](_0x4ee6b6,{'showHidden':![],'depth':null}));if(this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]]){for(var _0x56d007 in this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]]){if(this['channels'][_0x4ee6b6['uniqueid']][_0xc443('0x38')](_0x56d007)&&!this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007][_0xc443('0xd')]&&!this['channels'][_0x4ee6b6[_0xc443('0x24')]][_0x56d007][_0xc443('0x11')]){logger[_0xc443('0x1e')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4ee6b6[_0xc443('0x24')],this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007][_0xc443('0x20')],_0x56d007);this[_0xc443('0x25')][_0x4ee6b6['uniqueid']][_0x56d007][_0xc443('0xd')]=!![];this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007][_0xc443('0x46')]=moment()[_0xc443('0x34')](_0xc443('0x26'));this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007][_0xc443('0x40')]=_0xc443('0x53');this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007]['reason']=_0xc443('0x53');logger[_0xc443('0x22')](_0xc443('0x54'),_0x4ee6b6[_0xc443('0x24')],util['inspect'](this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007],{'showHidden':![],'depth':null}));ami['emit']('custom:agentqueuecallerabandon',this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007]);}}}}}catch(_0x4d3aaf){logger[_0xc443('0x4c')](_0xc443('0x55'),_0x4ee6b6[_0xc443('0x24')],util[_0xc443('0x31')](_0x4d3aaf,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xc443('0x12')]=function(_0x14f839){try{if(this['isNotNull'](_0x14f839)){logger[_0xc443('0x22')](_0xc443('0x56'),_0x14f839[_0xc443('0x24')],util[_0xc443('0x31')](_0x14f839,{'showHidden':![],'depth':null}));if(this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]]){for(var _0x16ffcc in this['channels'][_0x14f839[_0xc443('0x24')]]){if(this['channels'][_0x14f839[_0xc443('0x24')]][_0xc443('0x38')](_0x16ffcc)){if(this['channels'][_0x14f839['uniqueid']][_0x16ffcc][_0xc443('0x3a')]&&!this['channels'][_0x14f839['uniqueid']][_0x16ffcc]['agentcomplete']){logger[_0xc443('0x1e')](_0xc443('0x57'),_0x14f839['uniqueid'],this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc][_0xc443('0x20')],_0x16ffcc);this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc][_0xc443('0x11')]=!![];this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc]['agentcompleteAt']=moment()[_0xc443('0x34')](_0xc443('0x26'));this[_0xc443('0x25')][_0x14f839['uniqueid']][_0x16ffcc][_0xc443('0x40')]=_0xc443('0x58');this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc]['reason']=_0x14f839[_0xc443('0x59')]==_0xc443('0x5a')?'agent':_0x14f839['reason'];this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc]['talktime']=_0x14f839['talktime'];if(this[_0xc443('0x6')][_0x14f839[_0xc443('0x28')]]&&this[_0xc443('0x6')][_0x14f839[_0xc443('0x28')]][_0xc443('0x5b')]){this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc][_0xc443('0x5c')]=this[_0xc443('0x6')][_0x14f839['queue']][_0xc443('0x5d')];this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc][_0xc443('0x5e')]=!![];}this[_0xc443('0x7')][_0x14f839[_0xc443('0x5f')]]=_['omit'](this[_0xc443('0x7')][_0x14f839[_0xc443('0x5f')]],['queue','destconnectedlinenum']);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x14f839[_0xc443('0x24')],util['inspect'](this['channels'][_0x14f839['uniqueid']][_0x16ffcc],{'showHidden':![],'depth':null}));ami[_0xc443('0x1b')]('custom:agentcomplete',this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc]);logger[_0xc443('0x22')](_0xc443('0x60'),_0x14f839[_0xc443('0x24')],util[_0xc443('0x31')](this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc],{'showHidden':![],'depth':null}));this['emit'](util[_0xc443('0x34')](_0xc443('0x35'),_0x14f839[_0xc443('0x20')]),_0xc443('0x61'),this['channels'][_0x14f839[_0xc443('0x24')]][_0x16ffcc]);}}}}}}catch(_0x70813){logger['error']('[%s][voiceAgentReport][agentcomplete]',_0x14f839[_0xc443('0x24')],util['inspect'](_0x70813,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x62')]=function(_0x2dfaa4){try{if(this[_0xc443('0x1c')](_0x2dfaa4)){logger['debug']('[%s][voiceAgentReport][varset]\x20event:',_0x2dfaa4['uniqueid'],util[_0xc443('0x31')](_0x2dfaa4,{'showHidden':![],'depth':null}));this[_0xc443('0x63')](_0x2dfaa4['uniqueid'],_['keys'](_0x2dfaa4[_0xc443('0x64')])[0x0],_0x2dfaa4[_0xc443('0x65')]);if(this['channels'][_0x2dfaa4['uniqueid']]){for(var _0x221aaf in this['channels'][_0x2dfaa4[_0xc443('0x24')]]){if(this[_0xc443('0x25')][_0x2dfaa4[_0xc443('0x24')]][_0xc443('0x38')](_0x221aaf)){logger['info'](_0xc443('0x66'),_0x2dfaa4[_0xc443('0x24')],_0x221aaf,_[_0xc443('0x67')](_0x2dfaa4['variable'])[0x0],_0x2dfaa4[_0xc443('0x65')]);if(_['isUndefined'](this[_0xc443('0x25')][_0x2dfaa4[_0xc443('0x24')]][_0x221aaf]['variables'])){this[_0xc443('0x25')][_0x2dfaa4[_0xc443('0x24')]][_0x221aaf][_0xc443('0x2c')]={};}this['channels'][_0x2dfaa4[_0xc443('0x24')]][_0x221aaf]['variables']=this['variables'][_0x2dfaa4[_0xc443('0x24')]];}}}}}catch(_0x156093){logger[_0xc443('0x4c')](_0xc443('0x68'),_0x2dfaa4['uniqueid'],util[_0xc443('0x31')](_0x156093,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x63')]=function(_0x430a69,_0x1ecdc5,_0x33afca){var _0xc1f168=[_0xc443('0x69'),_0xc443('0x6a'),_0xc443('0x6b'),_0xc443('0x6c'),_0xc443('0x6d'),_0xc443('0x6e'),'rtpaudioqosrtt',_0xc443('0x6f'),_0xc443('0x70'),'sipuri',_0xc443('0x71'),_0xc443('0x72'),_0xc443('0x73'),_0xc443('0x74'),_0xc443('0x75'),_0xc443('0x76'),_0xc443('0x20'),'memberpenalty',_0xc443('0x77')];if(!_['isNil'](_0x1ecdc5)&&!_[_0xc443('0x78')](_0xc1f168,_0x1ecdc5)){if(_[_0xc443('0x1d')](this['variables'][_0x430a69])){this[_0xc443('0x2c')][_0x430a69]={};}this['variables'][_0x430a69][_0x1ecdc5]=_0x33afca;}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x79')]=function(_0x55994e){try{if(this[_0xc443('0x1c')](_0x55994e)){logger[_0xc443('0x22')](_0xc443('0x7a'),_0x55994e[_0xc443('0x24')],util[_0xc443('0x31')](_0x55994e,{'showHidden':![],'depth':null}));if(this[_0xc443('0x25')][_0x55994e[_0xc443('0x24')]]){for(var _0x3b643d in this[_0xc443('0x25')][_0x55994e[_0xc443('0x24')]]){if(this[_0xc443('0x25')][_0x55994e[_0xc443('0x24')]][_0xc443('0x38')](_0x3b643d)){if(this['channels'][_0x55994e[_0xc443('0x24')]][_0x3b643d][_0xc443('0x59')]=='transfer'&&this[_0xc443('0x25')][_0x55994e[_0xc443('0x24')]][_0x3b643d][_0xc443('0x11')]){logger[_0xc443('0x1e')](_0xc443('0x7b'),_0x55994e[_0xc443('0x24')],_0x3b643d);this[_0xc443('0x25')][_0x55994e['uniqueid']][_0x3b643d][_0xc443('0x7c')]=moment()[_0xc443('0x34')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x55994e[_0xc443('0x24')],util[_0xc443('0x31')](_[_0xc443('0x7d')](this[_0xc443('0x25')][_0x55994e[_0xc443('0x24')]]),{'showHidden':![],'depth':null}));ami[_0xc443('0x1b')](_0xc443('0x7e'),_[_0xc443('0x7d')](this[_0xc443('0x25')][_0x55994e[_0xc443('0x24')]]));delete this[_0xc443('0x25')][_0x55994e['uniqueid']];}if(this[_0xc443('0x2c')][_0x55994e['uniqueid']]){delete this['variables'][_0x55994e[_0xc443('0x24')]];}}}catch(_0x22ecee){logger[_0xc443('0x4c')](_0xc443('0x7f'),_0x55994e['uniqueid'],util['inspect'](_0x22ecee,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xc443('0x80')]=function(_0x452cf1){try{if(this[_0xc443('0x1c')](_0x452cf1)){logger[_0xc443('0x22')](_0xc443('0x81'),_0x452cf1['uniqueid'],util['inspect'](_0x452cf1,{'showHidden':![],'depth':null}));if(this['channels'][_0x452cf1[_0xc443('0x82')]]){for(var _0x1071c4 in this['channels'][_0x452cf1[_0xc443('0x82')]]){if(this[_0xc443('0x25')][_0x452cf1[_0xc443('0x82')]][_0xc443('0x38')](_0x1071c4)){if(_0x452cf1[_0xc443('0x83')]===_0x1071c4){logger[_0xc443('0x1e')](_0xc443('0x84'),_0x452cf1['uniqueid'],this[_0xc443('0x25')][_0x452cf1['transfereeuniqueid']][_0x1071c4][_0xc443('0x20')],_0x1071c4);var _0xc366c8=moment();this['channels'][_0x452cf1[_0xc443('0x82')]][_0x1071c4][_0xc443('0x11')]=!![];this[_0xc443('0x25')][_0x452cf1[_0xc443('0x82')]][_0x1071c4][_0xc443('0x7c')]=moment()[_0xc443('0x34')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x452cf1[_0xc443('0x82')]][_0x1071c4][_0xc443('0x40')]=_0xc443('0x58');this[_0xc443('0x25')][_0x452cf1['transfereeuniqueid']][_0x1071c4][_0xc443('0x59')]=_0xc443('0x5a');this['channels'][_0x452cf1[_0xc443('0x82')]][_0x1071c4][_0xc443('0x85')]=_0xc366c8['diff'](this[_0xc443('0x25')][_0x452cf1[_0xc443('0x82')]][_0x1071c4][_0xc443('0x3a')],_0xc443('0x86'));}}}}if(this[_0xc443('0x25')][_0x452cf1[_0xc443('0x87')]]){var _0x390096=this[_0xc443('0x25')][_0x452cf1[_0xc443('0x87')]];this[_0xc443('0x25')][_0x452cf1[_0xc443('0x87')]]=this[_0xc443('0x25')][_0x452cf1[_0xc443('0x82')]];this[_0xc443('0x25')][_0x452cf1['transfereeuniqueid']]=_0x390096;}}}catch(_0x31011c){logger[_0xc443('0x4c')](_0xc443('0x88'),_0x452cf1[_0xc443('0x24')],util[_0xc443('0x31')](_0x31011c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncBlindTransfer']=function(_0x3b994a){try{if(this['isNotNull'](_0x3b994a)){logger[_0xc443('0x22')](_0xc443('0x89'),_0x3b994a[_0xc443('0x24')],util[_0xc443('0x31')](_0x3b994a,{'showHidden':![],'depth':null}));if(this[_0xc443('0x25')][_0x3b994a['transfereeuniqueid']]){for(var _0x15bbad in this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]]){if(this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]][_0xc443('0x38')](_0x15bbad)){if(_0x3b994a[_0xc443('0x8a')]===_0x15bbad){logger[_0xc443('0x1e')](_0xc443('0x8b'),_0x3b994a[_0xc443('0x24')],this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]][_0x15bbad][_0xc443('0x20')],_0x15bbad);var _0x520176=moment();this[_0xc443('0x25')][_0x3b994a['transfereeuniqueid']][_0x15bbad]['agentcomplete']=!![];this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]][_0x15bbad][_0xc443('0x7c')]=_0x520176;this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]][_0x15bbad][_0xc443('0x40')]=_0xc443('0x58');this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]][_0x15bbad]['reason']=_0xc443('0x5a');this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]][_0x15bbad][_0xc443('0x85')]=_0x520176[_0xc443('0x8c')](this[_0xc443('0x25')][_0x3b994a['transfereeuniqueid']][_0x15bbad][_0xc443('0x3a')],_0xc443('0x86'));}}}}}}catch(_0xba2323){logger[_0xc443('0x4c')](_0xc443('0x8d'),_0x3b994a[_0xc443('0x24')],util['inspect'](_0xba2323,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x8e')]=function(_0x45d9b7){var _0x291f3a='';try{if(this['isNotNull'](_0x45d9b7)){logger[_0xc443('0x22')](_0xc443('0x8f'),_0x45d9b7[_0xc443('0x24')],util[_0xc443('0x31')](_0x45d9b7,{'showHidden':![],'depth':null}));if(_0x45d9b7[_0xc443('0x90')]){_0x291f3a=_0x45d9b7[_0xc443('0x90')][_0xc443('0x91')](0x0,_0x45d9b7[_0xc443('0x90')][_0xc443('0x92')]('-'));if(this[_0xc443('0x7')][_0x291f3a]){logger[_0xc443('0x1e')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x45d9b7[_0xc443('0x24')],_0x291f3a);this[_0xc443('0x7')][_0x291f3a][_0xc443('0x93')]=!![];}}}}catch(_0x3e786d){logger[_0xc443('0x4c')](_0xc443('0x94'),_0x45d9b7['uniqueid'],util[_0xc443('0x31')](_0x3e786d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x16')]=function(_0x5b6f54){var _0x188520='';try{if(this['isNotNull'](_0x5b6f54)){logger[_0xc443('0x22')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x5b6f54[_0xc443('0x24')],util[_0xc443('0x31')](_0x5b6f54,{'showHidden':![],'depth':null}));if(_0x5b6f54[_0xc443('0x90')]){_0x188520=_0x5b6f54['channel'][_0xc443('0x91')](0x0,_0x5b6f54[_0xc443('0x90')][_0xc443('0x92')]('-'));if(this[_0xc443('0x7')][_0x188520]){logger[_0xc443('0x1e')](_0xc443('0x95'),_0x5b6f54[_0xc443('0x24')],_0x188520);this[_0xc443('0x7')][_0x188520][_0xc443('0x93')]=![];}}}}catch(_0x2077da){logger[_0xc443('0x4c')](_0xc443('0x96'),_0x5b6f54[_0xc443('0x24')],util[_0xc443('0x31')](_0x2077da,{'showHidden':![],'depth':null}));}};module[_0xc443('0x97')]=VoiceAgentReport; \ No newline at end of file +var _0x6666=['[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','inspect','channels','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:called','error','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','interface','pick','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','syncMusicOnHoldStop'];(function(_0x3bdb1d,_0x3f8279){var _0x4fba16=function(_0x3f4d8a){while(--_0x3f4d8a){_0x3bdb1d['push'](_0x3bdb1d['shift']());}};_0x4fba16(++_0x3f8279);}(_0x6666,0x1c2));var _0x6666=function(_0x483102,_0x54e93d){_0x483102=_0x483102-0x0;var _0x5cc885=_0x6666[_0x483102];return _0x5cc885;};'use strict';var _=require(_0x6666('0x0'));var moment=require(_0x6666('0x1'));var util=require(_0x6666('0x2'));var Redis=require(_0x6666('0x3'));var config=require(_0x6666('0x4'));var logger=require(_0x6666('0x5'))(_0x6666('0x6'));var ami=require(_0x6666('0x7'));config[_0x6666('0x8')]=_[_0x6666('0x9')](config[_0x6666('0x8')],{'host':_0x6666('0xa'),'port':0x18eb});var io=require(_0x6666('0xb'))(new Redis(config[_0x6666('0x8')]));function VoiceAgentReport(_0x272d92){this['channels']={};this[_0x6666('0xc')]=_0x272d92[_0x6666('0xc')];this[_0x6666('0xd')]=_0x272d92[_0x6666('0xd')];this[_0x6666('0xe')]={};ami['on']('agentcalled',this[_0x6666('0xf')][_0x6666('0x10')](this));ami['on'](_0x6666('0x11'),this[_0x6666('0x12')][_0x6666('0x10')](this));ami['on'](_0x6666('0x13'),this[_0x6666('0x14')][_0x6666('0x10')](this));ami['on']('queuecallerabandon',this[_0x6666('0x15')]['bind'](this));ami['on'](_0x6666('0x16'),this['syncAgentComplete'][_0x6666('0x10')](this));ami['on']('varset',this[_0x6666('0x17')][_0x6666('0x10')](this));ami['on'](_0x6666('0x18'),this['syncHangup']['bind'](this));ami['on'](_0x6666('0x19'),this[_0x6666('0x1a')][_0x6666('0x10')](this));ami['on'](_0x6666('0x1b'),this['syncMusicOnHoldStop'][_0x6666('0x10')](this));ami['on'](_0x6666('0x1c'),this[_0x6666('0x1d')][_0x6666('0x10')](this));ami['on'](_0x6666('0x1e'),this['syncBlindTransfer']['bind'](this));}VoiceAgentReport[_0x6666('0x1f')]['emit']=function(_0x45f3be,_0x3905c3,_0x43bebd){io['to'](_0x45f3be)[_0x6666('0x20')](_0x3905c3,_0x43bebd);};VoiceAgentReport[_0x6666('0x1f')][_0x6666('0x21')]=function(_0x44c162){return _0x44c162!==null&&!_[_0x6666('0x22')](_0x44c162);};VoiceAgentReport[_0x6666('0x1f')][_0x6666('0xf')]=function(_0x495e6e){try{if(this['isNotNull'](_0x495e6e)){logger[_0x6666('0x23')](_0x6666('0x24'),_0x495e6e[_0x6666('0x25')],_0x495e6e[_0x6666('0x26')],_0x495e6e[_0x6666('0x27')]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20event:',_0x495e6e[_0x6666('0x25')],util[_0x6666('0x28')](_0x495e6e,{'showHidden':![],'depth':null}));if(_[_0x6666('0x22')](this[_0x6666('0x29')][_0x495e6e['uniqueid']])){this[_0x6666('0x29')][_0x495e6e[_0x6666('0x25')]]={};}if(_[_0x6666('0x22')](this[_0x6666('0x29')][_0x495e6e[_0x6666('0x25')]][_0x495e6e['destuniqueid']])){this['channels'][_0x495e6e[_0x6666('0x25')]][_0x495e6e[_0x6666('0x27')]]={'agentcalledAt':moment()['format'](_0x6666('0x2a')),'lastevent':'called','mandatoryDisposition':this[_0x6666('0xc')][_0x495e6e['queue']]?this[_0x6666('0xc')][_0x495e6e[_0x6666('0x2b')]][_0x6666('0x2c')]||![]:![],'type':this[_0x6666('0xc')][_0x495e6e[_0x6666('0x2b')]]?this['voiceQueues'][_0x495e6e[_0x6666('0x2b')]][_0x6666('0x2d')]||_0x6666('0x2e'):'inbound','variables':this[_0x6666('0xe')][_0x495e6e['uniqueid']]};}_[_0x6666('0x2f')](this[_0x6666('0x29')][_0x495e6e[_0x6666('0x25')]][_0x495e6e[_0x6666('0x27')]],_[_0x6666('0x30')](_0x495e6e,[_0x6666('0x31'),_0x6666('0x32')]));logger[_0x6666('0x33')](_0x6666('0x34'),_0x495e6e[_0x6666('0x25')],util[_0x6666('0x28')](this[_0x6666('0x29')][_0x495e6e[_0x6666('0x25')]][_0x495e6e['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x6666('0x20')]('custom:agentcalled',this[_0x6666('0x29')][_0x495e6e[_0x6666('0x25')]][_0x495e6e[_0x6666('0x27')]]);logger['debug'](_0x6666('0x35'),_0x495e6e[_0x6666('0x25')],util[_0x6666('0x28')](this['channels'][_0x495e6e[_0x6666('0x25')]][_0x495e6e['destuniqueid']],{'showHidden':![],'depth':null}));this['emit'](util[_0x6666('0x36')]('user:%s',_0x495e6e[_0x6666('0x26')]),_0x6666('0x37'),this['channels'][_0x495e6e['uniqueid']][_0x495e6e[_0x6666('0x27')]]);}}catch(_0x5d82d7){logger[_0x6666('0x38')]('[%s][voiceAgentReport][agentcalled]',_0x495e6e['uniqueid'],util[_0x6666('0x28')](_0x5d82d7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6666('0x1f')][_0x6666('0x12')]=function(_0xdc6dfe){try{if(this[_0x6666('0x21')](_0xdc6dfe)){if(this[_0x6666('0x29')][_0xdc6dfe['uniqueid']]){logger[_0x6666('0x33')](_0x6666('0x39'),_0xdc6dfe[_0x6666('0x25')],util[_0x6666('0x28')](_0xdc6dfe,{'showHidden':![],'depth':null}));for(var _0x227bbb in this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]]){if(this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]]['hasOwnProperty'](_0x227bbb)){if(_0xdc6dfe[_0x6666('0x27')]===_0x227bbb){logger[_0x6666('0x23')](_0x6666('0x3a'),_0xdc6dfe[_0x6666('0x25')],_0xdc6dfe[_0x6666('0x26')],_0xdc6dfe[_0x6666('0x27')]);this['channels'][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb][_0x6666('0x3b')]=moment()[_0x6666('0x36')](_0x6666('0x2a'));this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb]['connectedlinename']=_0xdc6dfe[_0x6666('0x3c')];this['channels'][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb]['connectedlinenum']=_0xdc6dfe[_0x6666('0x3d')];this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb][_0x6666('0x3e')]=_0xdc6dfe['destchannelstate'];this['channels'][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb][_0x6666('0x3f')]=_0xdc6dfe['destchannelstatedesc'];this[_0x6666('0x29')][_0xdc6dfe['uniqueid']][_0x227bbb][_0x6666('0x40')]=_0xdc6dfe[_0x6666('0x40')];this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb]['lastevent']='connect';_[_0x6666('0x2f')](this[_0x6666('0xd')][_0xdc6dfe[_0x6666('0x41')]],_[_0x6666('0x42')](_0xdc6dfe,[_0x6666('0x2b'),'destconnectedlinenum']));logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0xdc6dfe[_0x6666('0x25')],util[_0x6666('0x28')](this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]][_0xdc6dfe[_0x6666('0x27')]],{'showHidden':![],'depth':null}));ami[_0x6666('0x20')](_0x6666('0x43'),this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]][_0xdc6dfe[_0x6666('0x27')]]);logger[_0x6666('0x33')](_0x6666('0x44'),_0xdc6dfe[_0x6666('0x25')],util[_0x6666('0x28')](this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]][_0xdc6dfe[_0x6666('0x27')]],{'showHidden':![],'depth':null}));this[_0x6666('0x20')](util[_0x6666('0x36')](_0x6666('0x45'),_0xdc6dfe[_0x6666('0x26')]),'user:agentconnect',this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]][_0xdc6dfe[_0x6666('0x27')]]);}else if(!this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb]['agentringnoanswer']&&!this[_0x6666('0x29')][_0xdc6dfe['uniqueid']][_0x227bbb]['agentcomplete']){logger[_0x6666('0x23')](_0x6666('0x46'),_0xdc6dfe[_0x6666('0x25')],this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb]['membername'],_0x227bbb);this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb]['agentringnoanswer']=!![];this['channels'][_0xdc6dfe['uniqueid']][_0x227bbb][_0x6666('0x47')]=moment()[_0x6666('0x36')](_0x6666('0x2a'));this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb][_0x6666('0x48')]=_0xdc6dfe['destuniqueid'];this['channels'][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb][_0x6666('0x49')]=_0xdc6dfe[_0x6666('0x26')];this['channels'][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb][_0x6666('0x4a')]=_0x6666('0x4b');this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb][_0x6666('0x4c')]=_0x6666('0x4b');logger[_0x6666('0x33')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0xdc6dfe['uniqueid'],util[_0x6666('0x28')](this[_0x6666('0x29')][_0xdc6dfe[_0x6666('0x25')]][_0x227bbb],{'showHidden':![],'depth':null}));ami[_0x6666('0x20')](_0x6666('0x4d'),this['channels'][_0xdc6dfe['uniqueid']][_0x227bbb]);}}}}}}catch(_0x2a7771){logger['error'](_0x6666('0x4e'),_0xdc6dfe[_0x6666('0x25')],util[_0x6666('0x28')](_0x2a7771,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x21be8c){try{if(this[_0x6666('0x21')](_0x21be8c)){logger[_0x6666('0x33')](_0x6666('0x4f'),_0x21be8c[_0x6666('0x25')],util[_0x6666('0x28')](_0x21be8c,{'showHidden':![],'depth':null}));if(this['channels'][_0x21be8c[_0x6666('0x25')]]&&this[_0x6666('0x29')][_0x21be8c[_0x6666('0x25')]][_0x21be8c[_0x6666('0x27')]]){logger['info']('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x21be8c[_0x6666('0x25')],_0x21be8c[_0x6666('0x26')],_0x21be8c[_0x6666('0x27')]);this[_0x6666('0x29')][_0x21be8c[_0x6666('0x25')]][_0x21be8c[_0x6666('0x27')]][_0x6666('0x13')]=!![];this[_0x6666('0x29')][_0x21be8c[_0x6666('0x25')]][_0x21be8c[_0x6666('0x27')]][_0x6666('0x47')]=moment()[_0x6666('0x36')](_0x6666('0x2a'));this[_0x6666('0x29')][_0x21be8c['uniqueid']][_0x21be8c[_0x6666('0x27')]][_0x6666('0x4a')]=_0x6666('0x50');this['channels'][_0x21be8c[_0x6666('0x25')]][_0x21be8c[_0x6666('0x27')]][_0x6666('0x4c')]=_0x6666('0x50');logger[_0x6666('0x33')](_0x6666('0x51'),_0x21be8c[_0x6666('0x25')],util['inspect'](this['channels'][_0x21be8c[_0x6666('0x25')]][_0x21be8c['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x6666('0x20')](_0x6666('0x52'),this[_0x6666('0x29')][_0x21be8c['uniqueid']][_0x21be8c['destuniqueid']]);}}}catch(_0x59ed8c){logger[_0x6666('0x38')]('[%s][voiceAgentReport][agentringnoanswer]',_0x21be8c[_0x6666('0x25')],util['inspect'](_0x59ed8c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6666('0x1f')]['syncQueueCallerAbandon']=function(_0x3909c4){try{if(this[_0x6666('0x21')](_0x3909c4)){logger['debug'](_0x6666('0x53'),_0x3909c4[_0x6666('0x25')],util[_0x6666('0x28')](_0x3909c4,{'showHidden':![],'depth':null}));if(this[_0x6666('0x29')][_0x3909c4['uniqueid']]){for(var _0x1d6911 in this[_0x6666('0x29')][_0x3909c4[_0x6666('0x25')]]){if(this[_0x6666('0x29')][_0x3909c4['uniqueid']][_0x6666('0x54')](_0x1d6911)&&!this[_0x6666('0x29')][_0x3909c4['uniqueid']][_0x1d6911][_0x6666('0x13')]&&!this[_0x6666('0x29')][_0x3909c4[_0x6666('0x25')]][_0x1d6911]['agentcomplete']){logger['info'](_0x6666('0x55'),_0x3909c4['uniqueid'],this[_0x6666('0x29')][_0x3909c4[_0x6666('0x25')]][_0x1d6911][_0x6666('0x26')],_0x1d6911);this[_0x6666('0x29')][_0x3909c4[_0x6666('0x25')]][_0x1d6911][_0x6666('0x13')]=!![];this[_0x6666('0x29')][_0x3909c4[_0x6666('0x25')]][_0x1d6911]['agentringnoanswerAt']=moment()[_0x6666('0x36')](_0x6666('0x2a'));this['channels'][_0x3909c4[_0x6666('0x25')]][_0x1d6911][_0x6666('0x4a')]=_0x6666('0x56');this[_0x6666('0x29')][_0x3909c4['uniqueid']][_0x1d6911]['reason']='abandoned';logger[_0x6666('0x33')](_0x6666('0x57'),_0x3909c4[_0x6666('0x25')],util[_0x6666('0x28')](this[_0x6666('0x29')][_0x3909c4[_0x6666('0x25')]][_0x1d6911],{'showHidden':![],'depth':null}));ami[_0x6666('0x20')](_0x6666('0x58'),this[_0x6666('0x29')][_0x3909c4[_0x6666('0x25')]][_0x1d6911]);}}}}}catch(_0x425da4){logger['error'](_0x6666('0x59'),_0x3909c4[_0x6666('0x25')],util[_0x6666('0x28')](_0x425da4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6666('0x1f')][_0x6666('0x5a')]=function(_0x2a5df7){try{if(this[_0x6666('0x21')](_0x2a5df7)){logger[_0x6666('0x33')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2a5df7[_0x6666('0x25')],util[_0x6666('0x28')](_0x2a5df7,{'showHidden':![],'depth':null}));if(this[_0x6666('0x29')][_0x2a5df7[_0x6666('0x25')]]){for(var _0x592d22 in this[_0x6666('0x29')][_0x2a5df7[_0x6666('0x25')]]){if(this['channels'][_0x2a5df7[_0x6666('0x25')]][_0x6666('0x54')](_0x592d22)){if(this[_0x6666('0x29')][_0x2a5df7[_0x6666('0x25')]][_0x592d22]['agentconnectAt']&&!this[_0x6666('0x29')][_0x2a5df7[_0x6666('0x25')]][_0x592d22][_0x6666('0x16')]){logger['info']('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2a5df7[_0x6666('0x25')],this[_0x6666('0x29')][_0x2a5df7[_0x6666('0x25')]][_0x592d22][_0x6666('0x26')],_0x592d22);this['channels'][_0x2a5df7[_0x6666('0x25')]][_0x592d22][_0x6666('0x16')]=!![];this[_0x6666('0x29')][_0x2a5df7[_0x6666('0x25')]][_0x592d22][_0x6666('0x5b')]=moment()[_0x6666('0x36')](_0x6666('0x2a'));this[_0x6666('0x29')][_0x2a5df7[_0x6666('0x25')]][_0x592d22][_0x6666('0x4a')]=_0x6666('0x5c');this[_0x6666('0x29')][_0x2a5df7[_0x6666('0x25')]][_0x592d22]['reason']=_0x2a5df7[_0x6666('0x4c')]==_0x6666('0x5d')?_0x6666('0x5e'):_0x2a5df7[_0x6666('0x4c')];this[_0x6666('0x29')][_0x2a5df7[_0x6666('0x25')]][_0x592d22][_0x6666('0x5f')]=_0x2a5df7['talktime'];if(this[_0x6666('0xc')][_0x2a5df7[_0x6666('0x2b')]]&&this[_0x6666('0xc')][_0x2a5df7[_0x6666('0x2b')]][_0x6666('0x60')]){this[_0x6666('0x29')][_0x2a5df7['uniqueid']][_0x592d22][_0x6666('0x61')]=this[_0x6666('0xc')][_0x2a5df7[_0x6666('0x2b')]]['acwTimeout'];this[_0x6666('0x29')][_0x2a5df7[_0x6666('0x25')]][_0x592d22][_0x6666('0x62')]=!![];}this[_0x6666('0xd')][_0x2a5df7[_0x6666('0x41')]]=_[_0x6666('0x30')](this[_0x6666('0xd')][_0x2a5df7[_0x6666('0x41')]],[_0x6666('0x2b'),_0x6666('0x63')]);logger['debug'](_0x6666('0x64'),_0x2a5df7[_0x6666('0x25')],util[_0x6666('0x28')](this['channels'][_0x2a5df7[_0x6666('0x25')]][_0x592d22],{'showHidden':![],'depth':null}));ami[_0x6666('0x20')](_0x6666('0x65'),this[_0x6666('0x29')][_0x2a5df7[_0x6666('0x25')]][_0x592d22]);logger[_0x6666('0x33')](_0x6666('0x66'),_0x2a5df7[_0x6666('0x25')],util[_0x6666('0x28')](this['channels'][_0x2a5df7[_0x6666('0x25')]][_0x592d22],{'showHidden':![],'depth':null}));this[_0x6666('0x20')](util['format'](_0x6666('0x45'),_0x2a5df7['membername']),'user:agentcomplete',this[_0x6666('0x29')][_0x2a5df7[_0x6666('0x25')]][_0x592d22]);}}}}}}catch(_0x28f847){logger[_0x6666('0x38')]('[%s][voiceAgentReport][agentcomplete]',_0x2a5df7[_0x6666('0x25')],util['inspect'](_0x28f847,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6666('0x1f')]['syncVarSet']=function(_0x5d0a95){try{if(this[_0x6666('0x21')](_0x5d0a95)){logger[_0x6666('0x33')](_0x6666('0x67'),_0x5d0a95[_0x6666('0x25')],util[_0x6666('0x28')](_0x5d0a95,{'showHidden':![],'depth':null}));this[_0x6666('0x68')](_0x5d0a95['uniqueid'],_[_0x6666('0x69')](_0x5d0a95[_0x6666('0x6a')])[0x0],_0x5d0a95[_0x6666('0x6b')]);if(this[_0x6666('0x29')][_0x5d0a95[_0x6666('0x25')]]){for(var _0x73902d in this[_0x6666('0x29')][_0x5d0a95['uniqueid']]){if(this[_0x6666('0x29')][_0x5d0a95[_0x6666('0x25')]][_0x6666('0x54')](_0x73902d)){logger[_0x6666('0x23')](_0x6666('0x6c'),_0x5d0a95[_0x6666('0x25')],_0x73902d,_[_0x6666('0x69')](_0x5d0a95['variable'])[0x0],_0x5d0a95[_0x6666('0x6b')]);if(_[_0x6666('0x22')](this[_0x6666('0x29')][_0x5d0a95[_0x6666('0x25')]][_0x73902d]['variables'])){this[_0x6666('0x29')][_0x5d0a95[_0x6666('0x25')]][_0x73902d][_0x6666('0xe')]={};}this[_0x6666('0x29')][_0x5d0a95[_0x6666('0x25')]][_0x73902d]['variables']=this['variables'][_0x5d0a95['uniqueid']];}}}}}catch(_0xd1f1fa){logger[_0x6666('0x38')](_0x6666('0x6d'),_0x5d0a95[_0x6666('0x25')],util[_0x6666('0x28')](_0xd1f1fa,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6666('0x1f')][_0x6666('0x68')]=function(_0x431403,_0x4107c8,_0x561947){var _0x51039b=[_0x6666('0x6e'),'rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x6666('0x6f'),'rtpaudioqoslossbridged',_0x6666('0x70'),_0x6666('0x71'),_0x6666('0x72'),'sipuri',_0x6666('0x73'),_0x6666('0x74'),_0x6666('0x75'),_0x6666('0x76'),_0x6666('0x77'),_0x6666('0x78'),_0x6666('0x26'),_0x6666('0x79'),_0x6666('0x7a')];if(!_[_0x6666('0x7b')](_0x4107c8)&&!_['includes'](_0x51039b,_0x4107c8)){if(_[_0x6666('0x22')](this[_0x6666('0xe')][_0x431403])){this['variables'][_0x431403]={};}this[_0x6666('0xe')][_0x431403][_0x4107c8]=_0x561947;}};VoiceAgentReport[_0x6666('0x1f')][_0x6666('0x7c')]=function(_0x3a4384){try{if(this[_0x6666('0x21')](_0x3a4384)){logger[_0x6666('0x33')](_0x6666('0x7d'),_0x3a4384[_0x6666('0x25')],util['inspect'](_0x3a4384,{'showHidden':![],'depth':null}));if(this['channels'][_0x3a4384[_0x6666('0x25')]]){for(var _0x7c8c39 in this[_0x6666('0x29')][_0x3a4384[_0x6666('0x25')]]){if(this[_0x6666('0x29')][_0x3a4384[_0x6666('0x25')]]['hasOwnProperty'](_0x7c8c39)){if(this['channels'][_0x3a4384[_0x6666('0x25')]][_0x7c8c39]['reason']==_0x6666('0x5d')&&this[_0x6666('0x29')][_0x3a4384[_0x6666('0x25')]][_0x7c8c39][_0x6666('0x16')]){logger[_0x6666('0x23')](_0x6666('0x7e'),_0x3a4384[_0x6666('0x25')],_0x7c8c39);this[_0x6666('0x29')][_0x3a4384[_0x6666('0x25')]][_0x7c8c39]['agentcompleteAt']=moment()[_0x6666('0x36')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x6666('0x33')](_0x6666('0x7f'),_0x3a4384[_0x6666('0x25')],util[_0x6666('0x28')](_[_0x6666('0x80')](this[_0x6666('0x29')][_0x3a4384['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x6666('0x20')]('custom:voiceAgentReport',_[_0x6666('0x80')](this['channels'][_0x3a4384[_0x6666('0x25')]]));delete this[_0x6666('0x29')][_0x3a4384[_0x6666('0x25')]];}if(this[_0x6666('0xe')][_0x3a4384['uniqueid']]){delete this[_0x6666('0xe')][_0x3a4384[_0x6666('0x25')]];}}}catch(_0x2ed96e){logger['error'](_0x6666('0x81'),_0x3a4384[_0x6666('0x25')],util[_0x6666('0x28')](_0x2ed96e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6666('0x1f')][_0x6666('0x1d')]=function(_0x452197){try{if(this[_0x6666('0x21')](_0x452197)){logger[_0x6666('0x33')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x452197[_0x6666('0x25')],util['inspect'](_0x452197,{'showHidden':![],'depth':null}));if(this['channels'][_0x452197[_0x6666('0x82')]]){for(var _0x51ce7e in this['channels'][_0x452197['transfereeuniqueid']]){if(this[_0x6666('0x29')][_0x452197[_0x6666('0x82')]][_0x6666('0x54')](_0x51ce7e)){if(_0x452197[_0x6666('0x83')]===_0x51ce7e){logger[_0x6666('0x23')](_0x6666('0x84'),_0x452197[_0x6666('0x25')],this[_0x6666('0x29')][_0x452197['transfereeuniqueid']][_0x51ce7e][_0x6666('0x26')],_0x51ce7e);var _0x134157=moment();this[_0x6666('0x29')][_0x452197['transfereeuniqueid']][_0x51ce7e][_0x6666('0x16')]=!![];this[_0x6666('0x29')][_0x452197[_0x6666('0x82')]][_0x51ce7e][_0x6666('0x5b')]=moment()[_0x6666('0x36')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6666('0x29')][_0x452197[_0x6666('0x82')]][_0x51ce7e]['lastevent']=_0x6666('0x5c');this[_0x6666('0x29')][_0x452197[_0x6666('0x82')]][_0x51ce7e][_0x6666('0x4c')]='transfer';this['channels'][_0x452197[_0x6666('0x82')]][_0x51ce7e][_0x6666('0x5f')]=_0x134157[_0x6666('0x85')](this[_0x6666('0x29')][_0x452197[_0x6666('0x82')]][_0x51ce7e]['agentconnectAt'],_0x6666('0x86'));}}}}if(this[_0x6666('0x29')][_0x452197[_0x6666('0x87')]]){var _0x52561a=this[_0x6666('0x29')][_0x452197[_0x6666('0x87')]];this['channels'][_0x452197[_0x6666('0x87')]]=this[_0x6666('0x29')][_0x452197[_0x6666('0x82')]];this['channels'][_0x452197[_0x6666('0x82')]]=_0x52561a;}}}catch(_0x413a2d){logger['error'](_0x6666('0x88'),_0x452197[_0x6666('0x25')],util[_0x6666('0x28')](_0x413a2d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6666('0x1f')]['syncBlindTransfer']=function(_0x48563d){try{if(this[_0x6666('0x21')](_0x48563d)){logger[_0x6666('0x33')](_0x6666('0x89'),_0x48563d[_0x6666('0x25')],util[_0x6666('0x28')](_0x48563d,{'showHidden':![],'depth':null}));if(this['channels'][_0x48563d['transfereeuniqueid']]){for(var _0x12b06b in this['channels'][_0x48563d['transfereeuniqueid']]){if(this[_0x6666('0x29')][_0x48563d[_0x6666('0x82')]][_0x6666('0x54')](_0x12b06b)){if(_0x48563d['transfereruniqueid']===_0x12b06b){logger['info'](_0x6666('0x8a'),_0x48563d[_0x6666('0x25')],this[_0x6666('0x29')][_0x48563d['transfereeuniqueid']][_0x12b06b][_0x6666('0x26')],_0x12b06b);var _0x462db4=moment();this['channels'][_0x48563d[_0x6666('0x82')]][_0x12b06b][_0x6666('0x16')]=!![];this[_0x6666('0x29')][_0x48563d[_0x6666('0x82')]][_0x12b06b][_0x6666('0x5b')]=_0x462db4;this['channels'][_0x48563d[_0x6666('0x82')]][_0x12b06b]['lastevent']=_0x6666('0x5c');this['channels'][_0x48563d[_0x6666('0x82')]][_0x12b06b][_0x6666('0x4c')]=_0x6666('0x5d');this[_0x6666('0x29')][_0x48563d[_0x6666('0x82')]][_0x12b06b][_0x6666('0x5f')]=_0x462db4[_0x6666('0x85')](this['channels'][_0x48563d[_0x6666('0x82')]][_0x12b06b][_0x6666('0x3b')],_0x6666('0x86'));}}}}}}catch(_0xaf0eaf){logger[_0x6666('0x38')](_0x6666('0x8b'),_0x48563d['uniqueid'],util['inspect'](_0xaf0eaf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6666('0x1f')]['syncMusicOnHoldStart']=function(_0x1ea484){var _0x1f8ca9='';try{if(this[_0x6666('0x21')](_0x1ea484)){logger['debug'](_0x6666('0x8c'),_0x1ea484['uniqueid'],util['inspect'](_0x1ea484,{'showHidden':![],'depth':null}));if(_0x1ea484[_0x6666('0x8d')]){_0x1f8ca9=_0x1ea484[_0x6666('0x8d')][_0x6666('0x8e')](0x0,_0x1ea484[_0x6666('0x8d')][_0x6666('0x8f')]('-'));if(this[_0x6666('0xd')][_0x1f8ca9]){logger['info']('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x1ea484[_0x6666('0x25')],_0x1f8ca9);this['agents'][_0x1f8ca9][_0x6666('0x90')]=!![];}}}}catch(_0x2358ab){logger[_0x6666('0x38')]('[%s][voiceAgentReport][musiconholdstart]',_0x1ea484[_0x6666('0x25')],util[_0x6666('0x28')](_0x2358ab,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6666('0x1f')][_0x6666('0x91')]=function(_0x1efcb7){var _0x5a6899='';try{if(this[_0x6666('0x21')](_0x1efcb7)){logger[_0x6666('0x33')](_0x6666('0x92'),_0x1efcb7[_0x6666('0x25')],util[_0x6666('0x28')](_0x1efcb7,{'showHidden':![],'depth':null}));if(_0x1efcb7[_0x6666('0x8d')]){_0x5a6899=_0x1efcb7[_0x6666('0x8d')]['substring'](0x0,_0x1efcb7[_0x6666('0x8d')][_0x6666('0x8f')]('-'));if(this[_0x6666('0xd')][_0x5a6899]){logger[_0x6666('0x23')](_0x6666('0x93'),_0x1efcb7[_0x6666('0x25')],_0x5a6899);this[_0x6666('0xd')][_0x5a6899][_0x6666('0x90')]=![];}}}}catch(_0x57592a){logger[_0x6666('0x38')](_0x6666('0x94'),_0x1efcb7['uniqueid'],util[_0x6666('0x28')](_0x57592a,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index f2e2ce3..cc6246b 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 _0xc9c1=['calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','blindTransfers','type','outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','not_inuse','inuse','busy','ringinuse','onhold','set','queue','agi','dial','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','bind','newexten','syncNewExten','syncNewChannel','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','uniqueid','merge','pick','keys','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','info','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','format','YYYY-MM-DD\x20HH:mm:ss','disposition','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','duration','subtract','seconds','startsWith','applicationdata','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','linkedid','answered','answertime','starttime','diff','xcally-motion-preview','connectedlinename','toNumber','channelstate','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitorFilename','find','monitors','push','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','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s'];(function(_0x166313,_0x426cb7){var _0x5129e5=function(_0x16781e){while(--_0x16781e){_0x166313['push'](_0x166313['shift']());}};_0x5129e5(++_0x426cb7);}(_0xc9c1,0x1a9));var _0x1c9c=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xc9c1[_0x3635ce];return _0x97ecd0;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require('moment');var util=require(_0x1c9c('0x0'));var path=require(_0x1c9c('0x1'));var Redis=require(_0x1c9c('0x2'));var config=require(_0x1c9c('0x3'));var logger=require(_0x1c9c('0x4'))(_0x1c9c('0x5'));var ami=require('../ami');var Channel=require(_0x1c9c('0x6'));var statusDesc=['unknown',_0x1c9c('0x7'),_0x1c9c('0x8'),_0x1c9c('0x9'),'invalid','unavailable','ringing',_0x1c9c('0xa'),_0x1c9c('0xb')];var applications=[_0x1c9c('0xc'),_0x1c9c('0xd'),_0x1c9c('0xe'),_0x1c9c('0xf'),'playback','voicemail'];var dispositions=['NO\x20ANSWER',_0x1c9c('0x10'),_0x1c9c('0x10'),_0x1c9c('0x11'),_0x1c9c('0x11'),_0x1c9c('0x11'),_0x1c9c('0x12'),_0x1c9c('0x13'),_0x1c9c('0x10'),_0x1c9c('0x10'),'FAILED'];var actions={};config[_0x1c9c('0x14')]=_[_0x1c9c('0x15')](config['redis'],{'host':_0x1c9c('0x16'),'port':0x18eb});var io=require(_0x1c9c('0x17'))(new Redis(config[_0x1c9c('0x14')]));function VoiceCallReport(_0x8e8aab){this[_0x1c9c('0x18')]=_0x8e8aab[_0x1c9c('0x18')];this[_0x1c9c('0x19')]=_0x8e8aab[_0x1c9c('0x19')];this['blindTransfers']={};ami['on'](_0x1c9c('0x1a'),this['syncNewExten'][_0x1c9c('0x1b')](this));ami['on'](_0x1c9c('0x1c'),this[_0x1c9c('0x1d')]['bind'](this));ami['on']('newchannel',this[_0x1c9c('0x1e')][_0x1c9c('0x1b')](this));ami['on']('newstate',this[_0x1c9c('0x1f')][_0x1c9c('0x1b')](this));ami['on'](_0x1c9c('0x20'),this[_0x1c9c('0x21')][_0x1c9c('0x1b')](this));ami['on'](_0x1c9c('0x22'),this['syncHangup'][_0x1c9c('0x1b')](this));ami['on'](_0x1c9c('0x23'),this[_0x1c9c('0x24')][_0x1c9c('0x1b')](this));ami['on'](_0x1c9c('0x25'),this[_0x1c9c('0x26')][_0x1c9c('0x1b')](this));ami['on'](_0x1c9c('0x27'),this[_0x1c9c('0x28')][_0x1c9c('0x1b')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x1c9c('0x1b')](this));ami['on']('musiconholdstop',this[_0x1c9c('0x29')]['bind'](this));try{logger['info'](_0x1c9c('0x2a'));ami[_0x1c9c('0x2b')]();}catch(_0x5f2fa9){logger['error'](_0x1c9c('0x2c'),util[_0x1c9c('0x2d')](_0x5f2fa9,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x2f')]=function(_0x1a9be1){return _0x1a9be1!==null&&!_[_0x1c9c('0x30')](_0x1a9be1);};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x31')]=function(_0x1be26c,_0x17377f,_0x358f47){io['to'](_0x1be26c)[_0x1c9c('0x31')](_0x17377f,_0x358f47);};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x24')]=function(_0x863e1d){try{if(this[_0x1c9c('0x2f')](_0x863e1d)){logger['info'](_0x1c9c('0x32'),_0x863e1d['uniqueid'],_0x863e1d[_0x1c9c('0x33')],_0x863e1d[_0x1c9c('0x34')]);logger[_0x1c9c('0x35')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x863e1d[_0x1c9c('0x36')],util['inspect'](_0x863e1d,{'showHidden':![],'depth':null}));if(_0x863e1d[_0x1c9c('0x36')]===_0x863e1d['linkedid']){if(!_[_0x1c9c('0x30')](this[_0x1c9c('0x18')][_0x863e1d[_0x1c9c('0x36')]])){_[_0x1c9c('0x37')](this[_0x1c9c('0x18')][_0x863e1d[_0x1c9c('0x36')]],_[_0x1c9c('0x38')](_0x863e1d,_[_0x1c9c('0x39')](this['channels'][_0x863e1d[_0x1c9c('0x36')]])));}}}}catch(_0x37aebe){logger[_0x1c9c('0x3a')](_0x1c9c('0x3b'),_0x863e1d[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x37aebe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x1e')]=function(_0x689b64){try{if(this[_0x1c9c('0x2f')](_0x689b64)){logger[_0x1c9c('0x35')](_0x1c9c('0x3c'),_0x689b64['uniqueid'],util[_0x1c9c('0x2d')](_0x689b64,{'showHidden':![],'depth':null}));if(_0x689b64[_0x1c9c('0x36')]===_0x689b64['linkedid']&&_0x689b64[_0x1c9c('0x3d')]!=_0x1c9c('0x3e')){if(_[_0x1c9c('0x30')](this[_0x1c9c('0x18')][_0x689b64[_0x1c9c('0x36')]])){logger[_0x1c9c('0x3f')](_0x1c9c('0x40'),_0x689b64[_0x1c9c('0x36')],_0x689b64[_0x1c9c('0x41')],_0x689b64[_0x1c9c('0x42')]);this[_0x1c9c('0x18')][_0x689b64[_0x1c9c('0x36')]]=new Channel();this[_0x1c9c('0x18')][_0x689b64[_0x1c9c('0x36')]]['starttime']=moment()[_0x1c9c('0x43')](_0x1c9c('0x44'));this['channels'][_0x689b64['uniqueid']][_0x1c9c('0x45')]=dispositions[_['toNumber'](_0x689b64['channelstate'])];_['merge'](this[_0x1c9c('0x18')][_0x689b64[_0x1c9c('0x36')]],_['pick'](_0x689b64,_[_0x1c9c('0x39')](this[_0x1c9c('0x18')][_0x689b64[_0x1c9c('0x36')]])));if(_0x689b64[_0x1c9c('0x41')]===_0x1c9c('0x46')){if(this[_0x1c9c('0x19')][_0x689b64[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]]){this['agents'][_0x689b64[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x48')]=_0x689b64[_0x1c9c('0x42')];logger['debug'](_0x1c9c('0x49'),_0x689b64['uniqueid'],util['inspect']({'destaccountcode':this[_0x1c9c('0x19')][_0x689b64[_0x1c9c('0x3d')]['split']('-')[0x0]][_0x1c9c('0x4a')],'destconnectedlinenum':_0x689b64[_0x1c9c('0x42')]},{'showHidden':![],'depth':null}));this[_0x1c9c('0x31')](util[_0x1c9c('0x43')](_0x1c9c('0x4b'),this[_0x1c9c('0x19')][_0x689b64['channel'][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x4c')]),_0x1c9c('0x4d'),{'destaccountcode':this['agents'][_0x689b64['channel'][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x4a')],'destconnectedlinenum':_0x689b64[_0x1c9c('0x42')]});}}}}}}catch(_0x329ebe){logger[_0x1c9c('0x3a')](_0x1c9c('0x4e'),_0x689b64['uniqueid'],util['inspect'](_0x329ebe,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1c9c('0x1d')]=function(_0xf82840){try{if(this[_0x1c9c('0x2f')](_0xf82840)){logger['debug'](_0x1c9c('0x4f'),_0xf82840[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0xf82840,{'showHidden':![],'depth':null}));if(_0xf82840[_0x1c9c('0x36')]===_0xf82840['linkedid']&&_0xf82840[_0x1c9c('0x42')]!='h'&&_0xf82840[_0x1c9c('0x3d')]!=_0x1c9c('0x3e')){_0xf82840[_0x1c9c('0x50')]=_0xf82840[_0x1c9c('0x50')][_0x1c9c('0x51')]();_0xf82840['applicationdata']=(_0xf82840['appdata']||_0xf82840['applicationdata'])[_0x1c9c('0x51')]();logger[_0x1c9c('0x3f')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0xf82840[_0x1c9c('0x36')],_0xf82840['application'],_0xf82840['applicationdata']);if(_[_0x1c9c('0x30')](this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]])){this['channels'][_0xf82840[_0x1c9c('0x36')]]=new Channel();this['channels'][_0xf82840[_0x1c9c('0x36')]]['starttime']=_0xf82840[_0x1c9c('0x52')]?moment()[_0x1c9c('0x53')](moment[_0x1c9c('0x52')](_0xf82840['duration'])[_0x1c9c('0x54')](),_0x1c9c('0x54'))['format'](_0x1c9c('0x44')):moment()[_0x1c9c('0x43')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]][_0x1c9c('0x45')]=_0x1c9c('0x11');}_[_0x1c9c('0x37')](this['channels'][_0xf82840[_0x1c9c('0x36')]],_[_0x1c9c('0x38')](_0xf82840,_['keys'](this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]])));if(_['includes'](applications,_0xf82840['application'])){this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]]['lastapplication']=_0xf82840['application'];this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]]['lastdata']=_0xf82840['applicationdata'];if(_0xf82840[_0x1c9c('0x50')]===_0x1c9c('0xc')&&_[_0x1c9c('0x55')](_0xf82840[_0x1c9c('0x56')],'cdr(')){var _0x38c3ed=_0xf82840[_0x1c9c('0x56')][_0x1c9c('0x47')]('=');var _0x51913f=_0x38c3ed[0x0]['match'](/cdr\((.*)\)/);if(_0x51913f){this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]][_0x51913f[0x1]]=_0x38c3ed[0x1];}}else if(_0xf82840[_0x1c9c('0x50')]==='queue'){this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]][_0x1c9c('0xd')]=_0xf82840[_0x1c9c('0x56')][_0x1c9c('0x47')](',')[0x0];}}}}}catch(_0x216fcc){logger['error'](_0x1c9c('0x57'),_0xf82840[_0x1c9c('0x36')],util['inspect'](_0x216fcc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x1f')]=function(_0x3c4e1e){try{if(this[_0x1c9c('0x2f')](_0x3c4e1e)){logger[_0x1c9c('0x3f')](_0x1c9c('0x58'),_0x3c4e1e['uniqueid'],_0x3c4e1e[_0x1c9c('0x59')],_0x3c4e1e[_0x1c9c('0x33')],_0x3c4e1e[_0x1c9c('0x34')]);logger[_0x1c9c('0x35')]('[%s][voiceCallReport][newstate]\x20event:',_0x3c4e1e[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x3c4e1e,{'showHidden':![],'depth':null}));if(_0x3c4e1e[_0x1c9c('0x36')]!==_0x3c4e1e['linkedid']){if(this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]]){if(_0x3c4e1e['channelstate']==='6'){if(!this[_0x1c9c('0x18')][_0x3c4e1e['linkedid']][_0x1c9c('0x5a')]){var _0x5a83a3=moment();this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]]['answered']=!![];this[_0x1c9c('0x18')][_0x3c4e1e['linkedid']][_0x1c9c('0x5b')]=_0x5a83a3[_0x1c9c('0x43')](_0x1c9c('0x44'));if(this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]][_0x1c9c('0x5c')]){this[_0x1c9c('0x18')][_0x3c4e1e['linkedid']]['holdtime']=_0x5a83a3[_0x1c9c('0x5d')](this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]][_0x1c9c('0x5c')],_0x1c9c('0x54'));}}this[_0x1c9c('0x18')][_0x3c4e1e['linkedid']][_0x1c9c('0x59')]=_0x3c4e1e[_0x1c9c('0x36')];if(_0x3c4e1e['calleridnum']!==_0x1c9c('0x5e')){this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]]['connectedlinenum']=_0x3c4e1e[_0x1c9c('0x34')];}this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]][_0x1c9c('0x5f')]=_0x3c4e1e['calleridname'];this['channels'][_0x3c4e1e['linkedid']]['destinationchannel']=_0x3c4e1e[_0x1c9c('0x3d')];this['channels'][_0x3c4e1e['linkedid']][_0x1c9c('0x45')]=dispositions[_[_0x1c9c('0x60')](_0x3c4e1e[_0x1c9c('0x61')])];if(this[_0x1c9c('0x19')][_0x3c4e1e[_0x1c9c('0x3d')]['split']('-')[0x0]]){this[_0x1c9c('0x18')][_0x3c4e1e['linkedid']][_0x1c9c('0x62')]=this[_0x1c9c('0x19')][_0x3c4e1e[_0x1c9c('0x3d')]['split']('-')[0x0]]['id'];this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]][_0x1c9c('0x63')]=this[_0x1c9c('0x19')][_0x3c4e1e[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x4c')];}}}}else{if(this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x36')]]){if(_0x3c4e1e[_0x1c9c('0x61')]==='6'){if(this[_0x1c9c('0x19')][_0x3c4e1e[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]]){this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x36')]]['UserId']=this[_0x1c9c('0x19')][_0x3c4e1e[_0x1c9c('0x3d')]['split']('-')[0x0]]['id'];this[_0x1c9c('0x18')][_0x3c4e1e['uniqueid']][_0x1c9c('0x63')]=this['agents'][_0x3c4e1e[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x4c')];}}}}}}catch(_0x4f6a78){logger['error'](_0x1c9c('0x64'),_0x3c4e1e[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x4f6a78,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x65')]=function(_0x5e1a46,_0x184ed4){try{if(this[_0x1c9c('0x18')][_0x5e1a46]){logger[_0x1c9c('0x3f')](_0x1c9c('0x66'),_0x5e1a46,_0x184ed4);this[_0x1c9c('0x18')][_0x5e1a46][_0x1c9c('0x67')]=!![];if(_[_0x1c9c('0x68')](_0x184ed4,_0x1c9c('0x69'))){_0x184ed4=_0x184ed4['replace'](_0x1c9c('0x69'),_0x1c9c('0x6a'));}this[_0x1c9c('0x18')][_0x5e1a46][_0x1c9c('0x6b')]=_0x184ed4;var _0x25e8da=_[_0x1c9c('0x6c')](this[_0x1c9c('0x18')][_0x5e1a46][_0x1c9c('0x6d')],{'filename':_0x184ed4});if(_['isNil'](_0x25e8da)){this[_0x1c9c('0x18')][_0x5e1a46]['monitors'][_0x1c9c('0x6e')]({'filename':_0x184ed4,'createdAt':moment()[_0x1c9c('0x43')](_0x1c9c('0x44')),'mixmonitorid':'','status':_0x1c9c('0x6f')});}}}catch(_0x23ce30){logger['error'](_0x1c9c('0x70'),_0x5e1a46,util[_0x1c9c('0x2d')](_0x23ce30,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x21')]=function(_0x123612){try{if(this[_0x1c9c('0x2f')](_0x123612)){logger[_0x1c9c('0x35')](_0x1c9c('0x71'),_0x123612[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x123612,{'showHidden':![],'depth':null}));if(this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]]&&_0x123612['channel']!='OutgoingSpoolFailed'){if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')])){if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x73')])){logger[_0x1c9c('0x3f')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x123612[_0x1c9c('0x36')],_0x123612['value']);this['syncMixMonitorFilename'](_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);}else if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x75')])){logger['info'](_0x1c9c('0x76'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]][_0x1c9c('0x34')]=_0x123612[_0x1c9c('0x74')];}else if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')]['xmd-callerid'])){logger[_0x1c9c('0x3f')](_0x1c9c('0x77'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]][_0x1c9c('0x78')]=_0x123612['value'];}else if(this[_0x1c9c('0x2f')](_0x123612['variable'][_0x1c9c('0x79')])){logger['info'](_0x1c9c('0x7a'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);this[_0x1c9c('0x18')][_0x123612['uniqueid']]['type']=_0x123612['value'];}else if(this[_0x1c9c('0x2f')](_0x123612['variable'][_0x1c9c('0x7b')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x7c'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]['split'](',')[0x0]);this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]][_0x1c9c('0xd')]=_0x123612['value'][_0x1c9c('0x47')](',')[0x0];}else if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x7d')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x7e'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]][_0x1c9c('0x7f')]=_0x123612[_0x1c9c('0x74')];}else if(this[_0x1c9c('0x2f')](_0x123612['variable'][_0x1c9c('0x80')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x81'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);this['channels'][_0x123612[_0x1c9c('0x36')]][_0x1c9c('0x82')]=_0x123612['value'];}else if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x83')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x84'),_0x123612[_0x1c9c('0x36')],_0x123612['value']);this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]][_0x1c9c('0x85')]=_0x123612[_0x1c9c('0x74')];}else if(this['isNotNull'](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x86')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x87'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]]['queue']=_0x123612['value'];}else if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x88')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x89'),_0x123612['uniqueid'],_0x123612['value']);this['channels'][_0x123612[_0x1c9c('0x36')]]['sipcalluniqueid']=_0x123612['value'];}}}else if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x73')])){if(_0x123612[_0x1c9c('0x74')]){var _0x1c06cc=path[_0x1c9c('0x8a')](_0x123612[_0x1c9c('0x74')])[_0x1c9c('0x4c')];logger[_0x1c9c('0x3f')](_0x1c9c('0x8b'),_0x1c06cc,_0x123612[_0x1c9c('0x74')]);this[_0x1c9c('0x65')](_0x1c06cc,_0x123612['value']);}}else if(this['channels'][_0x123612['linkedid']]){if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')])){if(this['isNotNull'](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x88')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x89'),_0x123612['linkedid'],_0x123612['value']);this['channels'][_0x123612['linkedid']][_0x1c9c('0x8c')]=_0x123612['value'];}}}}}catch(_0x343696){logger[_0x1c9c('0x3a')](_0x1c9c('0x8d'),_0x123612['uniqueid'],util[_0x1c9c('0x2d')](_0x343696,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x8e')]=function(_0x35974a){try{if(this[_0x1c9c('0x2f')](_0x35974a)){logger[_0x1c9c('0x35')](_0x1c9c('0x8f'),_0x35974a[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x35974a,{'showHidden':![],'depth':null}));if(this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]]){logger['info'](_0x1c9c('0x90'),_0x35974a[_0x1c9c('0x36')],_0x35974a[_0x1c9c('0x91')]);var _0x458268=moment();this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x92')]=_0x458268[_0x1c9c('0x43')](_0x1c9c('0x44'));this['channels'][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x52')]=_0x458268[_0x1c9c('0x5d')](this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x5c')],'seconds');if(this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x5a')]){this[_0x1c9c('0x18')][_0x35974a['uniqueid']][_0x1c9c('0x93')]=_0x458268[_0x1c9c('0x5d')](this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x5b')],_0x1c9c('0x54'));this['channels'][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x94')]=this['channels'][_0x35974a[_0x1c9c('0x36')]]['duration']-this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]]['billableseconds'];}if(_0x35974a[_0x1c9c('0x41')]===_0x1c9c('0x46')){if(this[_0x1c9c('0x19')][_0x35974a[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]]){this['agents'][_0x35974a[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]]=_[_0x1c9c('0x95')](this[_0x1c9c('0x19')][_0x35974a[_0x1c9c('0x3d')]['split']('-')[0x0]],[_0x1c9c('0x48')]);logger[_0x1c9c('0x35')](_0x1c9c('0x96'),_0x35974a['uniqueid'],util[_0x1c9c('0x2d')]({'destaccountcode':this['agents'][_0x35974a[_0x1c9c('0x3d')]['split']('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x1c9c('0x31')](util['format'](_0x1c9c('0x4b'),this['agents'][_0x35974a['channel'][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x4c')]),_0x1c9c('0x97'),{'destaccountcode':this[_0x1c9c('0x19')][_0x35974a[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x4a')]});}}if(_0x35974a[_0x1c9c('0x98')]===_0x1c9c('0x99')){this[_0x1c9c('0x9a')][_0x35974a[_0x1c9c('0x36')]]=this[_0x1c9c('0x18')][_0x35974a['uniqueid']];}else{if(this[_0x1c9c('0x18')][_0x35974a['uniqueid']][_0x1c9c('0x9b')]===_0x1c9c('0x9c')&&this[_0x1c9c('0x9a')][_0x35974a[_0x1c9c('0x36')]]){this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]]['uniqueid']=[this[_0x1c9c('0x18')][_0x35974a['uniqueid']][_0x1c9c('0x59')],this['channels'][_0x35974a[_0x1c9c('0x36')]]['linkedid']=this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x36')]][0x0];delete this[_0x1c9c('0x9a')][_0x35974a[_0x1c9c('0x36')]];}}logger[_0x1c9c('0x35')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x35974a[_0x1c9c('0x36')],util['inspect'](this[_0x1c9c('0x18')][_0x35974a['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x1c9c('0x31')](_0x1c9c('0x9d'),this['channels'][_0x35974a[_0x1c9c('0x36')]]);delete this[_0x1c9c('0x18')][_0x35974a['uniqueid']];}}}catch(_0x184522){logger[_0x1c9c('0x3a')](_0x1c9c('0x9e'),_0x35974a[_0x1c9c('0x36')],util['inspect'](_0x184522,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')]['syncAttendedTransfer']=function(_0x17d796){try{if(this[_0x1c9c('0x2f')](_0x17d796)){logger[_0x1c9c('0x3f')](_0x1c9c('0x9f'),_0x17d796[_0x1c9c('0x36')],_0x17d796[_0x1c9c('0xa0')],_0x17d796[_0x1c9c('0xa1')]);logger[_0x1c9c('0x35')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x17d796[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x17d796,{'showHidden':![],'depth':null}));if(this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa2')]]){this['channels'][_0x17d796['transfereeuniqueid']]['transfercalleridnum']=_0x17d796[_0x1c9c('0xa0')];this[_0x1c9c('0x18')][_0x17d796['transfereeuniqueid']][_0x1c9c('0xa3')]=_0x17d796[_0x1c9c('0xa1')];if(this[_0x1c9c('0x18')][_0x17d796['secondtransfereruniqueid']]){var _0x4b35b7=this[_0x1c9c('0x18')][_0x17d796['secondtransfereruniqueid']];this['channels'][_0x17d796[_0x1c9c('0xa4')]]=this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa2')]];this[_0x1c9c('0x18')][_0x17d796['transfereeuniqueid']]=_0x4b35b7;}}else if(this['channels'][_0x17d796[_0x1c9c('0xa5')]]){this[_0x1c9c('0x18')][_0x17d796['transfertargetuniqueid']][_0x1c9c('0xa6')]=_0x17d796[_0x1c9c('0xa0')];this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa5')]][_0x1c9c('0xa3')]=_0x17d796[_0x1c9c('0xa1')];if(this[_0x1c9c('0x18')][_0x17d796['origtransfereruniqueid']]){var _0x4b35b7=this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa7')]];this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa7')]]=this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa5')]];this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa5')]]=_0x4b35b7;}}}}catch(_0xe1dbcf){logger['error']('[%s][voiceCallReport][attendedtransfer]',_0x17d796[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0xe1dbcf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x28')]=function(_0x5fd120){try{if(this['isNotNull'](_0x5fd120)){logger[_0x1c9c('0x3f')](_0x1c9c('0xa8'),_0x5fd120['uniqueid'],_0x5fd120[_0x1c9c('0xa9')],_0x5fd120[_0x1c9c('0xaa')]);logger[_0x1c9c('0x35')](_0x1c9c('0xab'),_0x5fd120[_0x1c9c('0x36')],util['inspect'](_0x5fd120,{'showHidden':![],'depth':null}));if(this[_0x1c9c('0x18')][_0x5fd120[_0x1c9c('0xa2')]]){this[_0x1c9c('0x18')][_0x5fd120[_0x1c9c('0xa2')]][_0x1c9c('0xa6')]=_0x5fd120[_0x1c9c('0xa9')];this[_0x1c9c('0x18')][_0x5fd120['transfereeuniqueid']][_0x1c9c('0xa3')]=_0x5fd120[_0x1c9c('0xaa')];this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x5fd120[_0x1c9c('0xa2')],'context':_0x5fd120['context'],'channel':_0x5fd120[_0x1c9c('0xac')]});}}}catch(_0x55d9fb){logger[_0x1c9c('0x3a')](_0x1c9c('0xad'),_0x5fd120['uniqueid'],util['inspect'](_0x55d9fb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0xae')]=function(_0x10ccdf){try{if(this[_0x1c9c('0x2f')](_0x10ccdf)){logger[_0x1c9c('0x35')](_0x1c9c('0xaf'),_0x10ccdf[_0x1c9c('0x36')],util['inspect'](_0x10ccdf,{'showHidden':![],'depth':null}));if(this[_0x1c9c('0x18')][_0x10ccdf[_0x1c9c('0x36')]]){if(!_[_0x1c9c('0xb0')](this[_0x1c9c('0x18')][_0x10ccdf['uniqueid']][_0x1c9c('0x5b')])){this[_0x1c9c('0x18')][_0x10ccdf[_0x1c9c('0x36')]][_0x1c9c('0xb1')]=moment()[_0x1c9c('0x43')](_0x1c9c('0x44'));logger[_0x1c9c('0x3f')](_0x1c9c('0xb2'),_0x10ccdf[_0x1c9c('0x36')],this[_0x1c9c('0x18')][_0x10ccdf['uniqueid']][_0x1c9c('0xb1')]);}}}}catch(_0x9ff79a){logger['error'](_0x1c9c('0xb3'),_0x10ccdf[_0x1c9c('0x36')],util['inspect'](_0x9ff79a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x29')]=function(_0x159b02){try{if(this[_0x1c9c('0x2f')](_0x159b02)){logger[_0x1c9c('0x35')](_0x1c9c('0xb4'),_0x159b02[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x159b02,{'showHidden':![],'depth':null}));if(this[_0x1c9c('0x18')][_0x159b02['uniqueid']]){if(!_[_0x1c9c('0xb0')](this['channels'][_0x159b02[_0x1c9c('0x36')]][_0x1c9c('0xb1')])){this[_0x1c9c('0x18')][_0x159b02['uniqueid']][_0x1c9c('0xb5')]+=moment()[_0x1c9c('0xb6')](0x0)[_0x1c9c('0x5d')](this[_0x1c9c('0x18')][_0x159b02[_0x1c9c('0x36')]][_0x1c9c('0xb1')],_0x1c9c('0x54'));logger[_0x1c9c('0x3f')](_0x1c9c('0xb7'),_0x159b02['uniqueid'],this[_0x1c9c('0x18')][_0x159b02[_0x1c9c('0x36')]][_0x1c9c('0xb5')]);delete this[_0x1c9c('0x18')][_0x159b02[_0x1c9c('0x36')]][_0x1c9c('0xb1')];}}}}catch(_0x1d5379){logger[_0x1c9c('0x3a')](_0x1c9c('0xb8'),_0x159b02['uniqueid'],util['inspect'](_0x1d5379,{'showHidden':![],'depth':null}));}};module[_0x1c9c('0xb9')]=VoiceCallReport; \ No newline at end of file +var _0xbd9d=['path','ami','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','musiconholdstart','syncMusicOnHoldStart','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','inspect','linkedid','merge','pick','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','keys','from-sip','destconnectedlinenum','split','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','applicationdata','appdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','application','lastapplication','lastdata','match','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','destinationchannel','UserId','membername','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%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','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%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','sipcalllinkedid','[%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','type','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','context','transfererchannel','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','bluebird','lodash','moment'];(function(_0x3f68dc,_0x3ae2f8){var _0x8c9e6f=function(_0x32b1cd){while(--_0x32b1cd){_0x3f68dc['push'](_0x3f68dc['shift']());}};_0x8c9e6f(++_0x3ae2f8);}(_0xbd9d,0xad));var _0xdbd9=function(_0xae5e33,_0x4b1d14){_0xae5e33=_0xae5e33-0x0;var _0x33c517=_0xbd9d[_0xae5e33];return _0x33c517;};'use strict';var BPromise=require(_0xdbd9('0x0'));var _=require(_0xdbd9('0x1'));var moment=require(_0xdbd9('0x2'));var util=require('util');var path=require(_0xdbd9('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xdbd9('0x4'));var ami=require('../ami');var Channel=require('../model/channel');var statusDesc=[_0xdbd9('0x5'),_0xdbd9('0x6'),'inuse',_0xdbd9('0x7'),_0xdbd9('0x8'),_0xdbd9('0x9'),_0xdbd9('0xa'),_0xdbd9('0xb'),_0xdbd9('0xc')];var applications=[_0xdbd9('0xd'),_0xdbd9('0xe'),_0xdbd9('0xf'),_0xdbd9('0x10'),_0xdbd9('0x11'),_0xdbd9('0x12')];var dispositions=[_0xdbd9('0x13'),_0xdbd9('0x14'),'FAILED',_0xdbd9('0x13'),_0xdbd9('0x13'),_0xdbd9('0x13'),_0xdbd9('0x15'),_0xdbd9('0x16'),_0xdbd9('0x14'),_0xdbd9('0x14'),_0xdbd9('0x14')];var actions={};config['redis']=_['defaults'](config[_0xdbd9('0x17')],{'host':_0xdbd9('0x18'),'port':0x18eb});var io=require(_0xdbd9('0x19'))(new Redis(config[_0xdbd9('0x17')]));function VoiceCallReport(_0x6a0f5b){this[_0xdbd9('0x1a')]=_0x6a0f5b['channels'];this[_0xdbd9('0x1b')]=_0x6a0f5b[_0xdbd9('0x1b')];this[_0xdbd9('0x1c')]={};ami['on']('coreshowchannel',this[_0xdbd9('0x1d')]['bind'](this));ami['on']('newexten',this[_0xdbd9('0x1d')][_0xdbd9('0x1e')](this));ami['on'](_0xdbd9('0x1f'),this[_0xdbd9('0x20')]['bind'](this));ami['on'](_0xdbd9('0x21'),this[_0xdbd9('0x22')][_0xdbd9('0x1e')](this));ami['on'](_0xdbd9('0x23'),this[_0xdbd9('0x24')][_0xdbd9('0x1e')](this));ami['on'](_0xdbd9('0x25'),this[_0xdbd9('0x26')][_0xdbd9('0x1e')](this));ami['on'](_0xdbd9('0x27'),this['syncNewCallerId'][_0xdbd9('0x1e')](this));ami['on'](_0xdbd9('0x28'),this[_0xdbd9('0x29')][_0xdbd9('0x1e')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xdbd9('0x1e')](this));ami['on'](_0xdbd9('0x2a'),this[_0xdbd9('0x2b')]['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop']['bind'](this));try{logger[_0xdbd9('0x2c')](_0xdbd9('0x2d'));ami[_0xdbd9('0x2e')]();}catch(_0x4c8107){logger[_0xdbd9('0x2f')](_0xdbd9('0x30'),util['inspect'](_0x4c8107,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xdbd9('0x31')][_0xdbd9('0x32')]=function(_0x5db969){return _0x5db969!==null&&!_[_0xdbd9('0x33')](_0x5db969);};VoiceCallReport['prototype'][_0xdbd9('0x34')]=function(_0x573153,_0x1cd198,_0x1eb082){io['to'](_0x573153)[_0xdbd9('0x34')](_0x1cd198,_0x1eb082);};VoiceCallReport[_0xdbd9('0x31')]['syncNewCallerId']=function(_0x3c7fdb){try{if(this['isNotNull'](_0x3c7fdb)){logger['info'](_0xdbd9('0x35'),_0x3c7fdb[_0xdbd9('0x36')],_0x3c7fdb[_0xdbd9('0x37')],_0x3c7fdb['calleridnum']);logger[_0xdbd9('0x38')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x3c7fdb[_0xdbd9('0x36')],util[_0xdbd9('0x39')](_0x3c7fdb,{'showHidden':![],'depth':null}));if(_0x3c7fdb[_0xdbd9('0x36')]===_0x3c7fdb[_0xdbd9('0x3a')]){if(!_[_0xdbd9('0x33')](this[_0xdbd9('0x1a')][_0x3c7fdb[_0xdbd9('0x36')]])){_[_0xdbd9('0x3b')](this['channels'][_0x3c7fdb[_0xdbd9('0x36')]],_[_0xdbd9('0x3c')](_0x3c7fdb,_['keys'](this['channels'][_0x3c7fdb[_0xdbd9('0x36')]])));}}}}catch(_0x2e4697){logger[_0xdbd9('0x2f')](_0xdbd9('0x3d'),_0x3c7fdb['uniqueid'],util[_0xdbd9('0x39')](_0x2e4697,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdbd9('0x31')]['syncNewChannel']=function(_0x178473){try{if(this[_0xdbd9('0x32')](_0x178473)){logger[_0xdbd9('0x38')](_0xdbd9('0x3e'),_0x178473[_0xdbd9('0x36')],util[_0xdbd9('0x39')](_0x178473,{'showHidden':![],'depth':null}));if(_0x178473[_0xdbd9('0x36')]===_0x178473[_0xdbd9('0x3a')]&&_0x178473[_0xdbd9('0x3f')]!=_0xdbd9('0x40')){if(_[_0xdbd9('0x33')](this[_0xdbd9('0x1a')][_0x178473[_0xdbd9('0x36')]])){logger[_0xdbd9('0x2c')](_0xdbd9('0x41'),_0x178473['uniqueid'],_0x178473['context'],_0x178473[_0xdbd9('0x42')]);this[_0xdbd9('0x1a')][_0x178473[_0xdbd9('0x36')]]=new Channel();this[_0xdbd9('0x1a')][_0x178473[_0xdbd9('0x36')]][_0xdbd9('0x43')]=moment()[_0xdbd9('0x44')](_0xdbd9('0x45'));this[_0xdbd9('0x1a')][_0x178473[_0xdbd9('0x36')]][_0xdbd9('0x46')]=dispositions[_['toNumber'](_0x178473[_0xdbd9('0x47')])];_[_0xdbd9('0x3b')](this[_0xdbd9('0x1a')][_0x178473[_0xdbd9('0x36')]],_[_0xdbd9('0x3c')](_0x178473,_[_0xdbd9('0x48')](this[_0xdbd9('0x1a')][_0x178473['uniqueid']])));if(_0x178473['context']===_0xdbd9('0x49')){if(this[_0xdbd9('0x1b')][_0x178473['channel']['split']('-')[0x0]]){this[_0xdbd9('0x1b')][_0x178473[_0xdbd9('0x3f')]['split']('-')[0x0]][_0xdbd9('0x4a')]=_0x178473[_0xdbd9('0x42')];logger[_0xdbd9('0x38')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x178473[_0xdbd9('0x36')],util[_0xdbd9('0x39')]({'destaccountcode':this[_0xdbd9('0x1b')][_0x178473[_0xdbd9('0x3f')][_0xdbd9('0x4b')]('-')[0x0]][_0xdbd9('0x4c')],'destconnectedlinenum':_0x178473['exten']},{'showHidden':![],'depth':null}));this[_0xdbd9('0x34')](util[_0xdbd9('0x44')](_0xdbd9('0x4d'),this[_0xdbd9('0x1b')][_0x178473[_0xdbd9('0x3f')]['split']('-')[0x0]][_0xdbd9('0x4e')]),_0xdbd9('0x4f'),{'destaccountcode':this[_0xdbd9('0x1b')][_0x178473[_0xdbd9('0x3f')]['split']('-')[0x0]][_0xdbd9('0x4c')],'destconnectedlinenum':_0x178473[_0xdbd9('0x42')]});}}}}}}catch(_0x492255){logger['error'](_0xdbd9('0x50'),_0x178473[_0xdbd9('0x36')],util[_0xdbd9('0x39')](_0x492255,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdbd9('0x31')][_0xdbd9('0x1d')]=function(_0x59a73b){try{if(this[_0xdbd9('0x32')](_0x59a73b)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x59a73b['uniqueid'],util[_0xdbd9('0x39')](_0x59a73b,{'showHidden':![],'depth':null}));if(_0x59a73b['uniqueid']===_0x59a73b[_0xdbd9('0x3a')]&&_0x59a73b[_0xdbd9('0x42')]!='h'&&_0x59a73b[_0xdbd9('0x3f')]!=_0xdbd9('0x40')){_0x59a73b['application']=_0x59a73b['application']['toLowerCase']();_0x59a73b[_0xdbd9('0x51')]=(_0x59a73b[_0xdbd9('0x52')]||_0x59a73b[_0xdbd9('0x51')])[_0xdbd9('0x53')]();logger['info'](_0xdbd9('0x54'),_0x59a73b[_0xdbd9('0x36')],_0x59a73b['application'],_0x59a73b[_0xdbd9('0x51')]);if(_['isUndefined'](this[_0xdbd9('0x1a')][_0x59a73b[_0xdbd9('0x36')]])){this[_0xdbd9('0x1a')][_0x59a73b[_0xdbd9('0x36')]]=new Channel();this['channels'][_0x59a73b['uniqueid']][_0xdbd9('0x43')]=_0x59a73b[_0xdbd9('0x55')]?moment()[_0xdbd9('0x56')](moment[_0xdbd9('0x55')](_0x59a73b[_0xdbd9('0x55')])[_0xdbd9('0x57')](),_0xdbd9('0x57'))[_0xdbd9('0x44')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xdbd9('0x44')](_0xdbd9('0x45'));this[_0xdbd9('0x1a')][_0x59a73b[_0xdbd9('0x36')]][_0xdbd9('0x46')]=_0xdbd9('0x13');}_[_0xdbd9('0x3b')](this['channels'][_0x59a73b[_0xdbd9('0x36')]],_[_0xdbd9('0x3c')](_0x59a73b,_[_0xdbd9('0x48')](this[_0xdbd9('0x1a')][_0x59a73b[_0xdbd9('0x36')]])));if(_['includes'](applications,_0x59a73b[_0xdbd9('0x58')])){this[_0xdbd9('0x1a')][_0x59a73b[_0xdbd9('0x36')]][_0xdbd9('0x59')]=_0x59a73b[_0xdbd9('0x58')];this[_0xdbd9('0x1a')][_0x59a73b[_0xdbd9('0x36')]][_0xdbd9('0x5a')]=_0x59a73b[_0xdbd9('0x51')];if(_0x59a73b[_0xdbd9('0x58')]===_0xdbd9('0xd')&&_['startsWith'](_0x59a73b[_0xdbd9('0x51')],'cdr(')){var _0x540d67=_0x59a73b[_0xdbd9('0x51')][_0xdbd9('0x4b')]('=');var _0x13a31b=_0x540d67[0x0][_0xdbd9('0x5b')](/cdr\((.*)\)/);if(_0x13a31b){this[_0xdbd9('0x1a')][_0x59a73b['uniqueid']][_0x13a31b[0x1]]=_0x540d67[0x1];}}else if(_0x59a73b[_0xdbd9('0x58')]===_0xdbd9('0xe')){this[_0xdbd9('0x1a')][_0x59a73b['uniqueid']]['queue']=_0x59a73b[_0xdbd9('0x51')][_0xdbd9('0x4b')](',')[0x0];}}}}}catch(_0x50f85e){logger[_0xdbd9('0x2f')]('[%s][voiceCallReport][newexten]',_0x59a73b[_0xdbd9('0x36')],util['inspect'](_0x50f85e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdbd9('0x31')]['syncNewState']=function(_0x4f237f){try{if(this[_0xdbd9('0x32')](_0x4f237f)){logger[_0xdbd9('0x2c')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x4f237f[_0xdbd9('0x36')],_0x4f237f[_0xdbd9('0x3a')],_0x4f237f[_0xdbd9('0x37')],_0x4f237f['calleridnum']);logger[_0xdbd9('0x38')]('[%s][voiceCallReport][newstate]\x20event:',_0x4f237f[_0xdbd9('0x36')],util[_0xdbd9('0x39')](_0x4f237f,{'showHidden':![],'depth':null}));if(_0x4f237f[_0xdbd9('0x36')]!==_0x4f237f[_0xdbd9('0x3a')]){if(this[_0xdbd9('0x1a')][_0x4f237f['linkedid']]){if(_0x4f237f[_0xdbd9('0x47')]==='6'){if(!this['channels'][_0x4f237f[_0xdbd9('0x3a')]][_0xdbd9('0x5c')]){var _0x133973=moment();this[_0xdbd9('0x1a')][_0x4f237f['linkedid']][_0xdbd9('0x5c')]=!![];this[_0xdbd9('0x1a')][_0x4f237f[_0xdbd9('0x3a')]][_0xdbd9('0x5d')]=_0x133973[_0xdbd9('0x44')](_0xdbd9('0x45'));if(this[_0xdbd9('0x1a')][_0x4f237f[_0xdbd9('0x3a')]][_0xdbd9('0x43')]){this[_0xdbd9('0x1a')][_0x4f237f['linkedid']][_0xdbd9('0x5e')]=_0x133973[_0xdbd9('0x5f')](this['channels'][_0x4f237f[_0xdbd9('0x3a')]][_0xdbd9('0x43')],'seconds');}}this['channels'][_0x4f237f['linkedid']][_0xdbd9('0x3a')]=_0x4f237f[_0xdbd9('0x36')];if(_0x4f237f['calleridnum']!==_0xdbd9('0x60')){this[_0xdbd9('0x1a')][_0x4f237f[_0xdbd9('0x3a')]][_0xdbd9('0x61')]=_0x4f237f[_0xdbd9('0x62')];}this['channels'][_0x4f237f[_0xdbd9('0x3a')]][_0xdbd9('0x63')]=_0x4f237f[_0xdbd9('0x37')];this['channels'][_0x4f237f['linkedid']][_0xdbd9('0x64')]=_0x4f237f['channel'];this[_0xdbd9('0x1a')][_0x4f237f[_0xdbd9('0x3a')]][_0xdbd9('0x46')]=dispositions[_['toNumber'](_0x4f237f[_0xdbd9('0x47')])];if(this['agents'][_0x4f237f[_0xdbd9('0x3f')][_0xdbd9('0x4b')]('-')[0x0]]){this['channels'][_0x4f237f[_0xdbd9('0x3a')]][_0xdbd9('0x65')]=this[_0xdbd9('0x1b')][_0x4f237f[_0xdbd9('0x3f')][_0xdbd9('0x4b')]('-')[0x0]]['id'];this[_0xdbd9('0x1a')][_0x4f237f[_0xdbd9('0x3a')]][_0xdbd9('0x66')]=this[_0xdbd9('0x1b')][_0x4f237f['channel'][_0xdbd9('0x4b')]('-')[0x0]][_0xdbd9('0x4e')];}}}}else{if(this[_0xdbd9('0x1a')][_0x4f237f[_0xdbd9('0x36')]]){if(_0x4f237f[_0xdbd9('0x47')]==='6'){if(this['agents'][_0x4f237f[_0xdbd9('0x3f')][_0xdbd9('0x4b')]('-')[0x0]]){this[_0xdbd9('0x1a')][_0x4f237f[_0xdbd9('0x36')]][_0xdbd9('0x65')]=this[_0xdbd9('0x1b')][_0x4f237f['channel'][_0xdbd9('0x4b')]('-')[0x0]]['id'];this['channels'][_0x4f237f[_0xdbd9('0x36')]][_0xdbd9('0x66')]=this[_0xdbd9('0x1b')][_0x4f237f[_0xdbd9('0x3f')]['split']('-')[0x0]][_0xdbd9('0x4e')];}}}}}}catch(_0x517a3a){logger[_0xdbd9('0x2f')]('[%s][voiceCallReport][newstate]',_0x4f237f['uniqueid'],util[_0xdbd9('0x39')](_0x517a3a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdbd9('0x31')][_0xdbd9('0x67')]=function(_0x6ed4fd,_0x2e3fd4){try{if(this[_0xdbd9('0x1a')][_0x6ed4fd]){logger[_0xdbd9('0x2c')](_0xdbd9('0x68'),_0x6ed4fd,_0x2e3fd4);this[_0xdbd9('0x1a')][_0x6ed4fd][_0xdbd9('0x69')]=!![];if(_['endsWith'](_0x2e3fd4,_0xdbd9('0x6a'))){_0x2e3fd4=_0x2e3fd4[_0xdbd9('0x6b')]('.wav49',_0xdbd9('0x6c'));}this[_0xdbd9('0x1a')][_0x6ed4fd][_0xdbd9('0x6d')]=_0x2e3fd4;var _0x23dde7=_[_0xdbd9('0x6e')](this[_0xdbd9('0x1a')][_0x6ed4fd][_0xdbd9('0x6f')],{'filename':_0x2e3fd4});if(_['isNil'](_0x23dde7)){this[_0xdbd9('0x1a')][_0x6ed4fd][_0xdbd9('0x6f')][_0xdbd9('0x70')]({'filename':_0x2e3fd4,'createdAt':moment()[_0xdbd9('0x44')](_0xdbd9('0x45')),'mixmonitorid':'','status':_0xdbd9('0x71')});}}}catch(_0xfc67b3){logger[_0xdbd9('0x2f')](_0xdbd9('0x72'),_0x6ed4fd,util[_0xdbd9('0x39')](_0xfc67b3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdbd9('0x31')][_0xdbd9('0x24')]=function(_0x5b33b5){try{if(this['isNotNull'](_0x5b33b5)){logger[_0xdbd9('0x38')](_0xdbd9('0x73'),_0x5b33b5[_0xdbd9('0x36')],util[_0xdbd9('0x39')](_0x5b33b5,{'showHidden':![],'depth':null}));if(this[_0xdbd9('0x1a')][_0x5b33b5['uniqueid']]&&_0x5b33b5[_0xdbd9('0x3f')]!='OutgoingSpoolFailed'){if(this[_0xdbd9('0x32')](_0x5b33b5[_0xdbd9('0x74')])){if(this[_0xdbd9('0x32')](_0x5b33b5[_0xdbd9('0x74')][_0xdbd9('0x75')])){logger[_0xdbd9('0x2c')](_0xdbd9('0x76'),_0x5b33b5['uniqueid'],_0x5b33b5[_0xdbd9('0x77')]);this['syncMixMonitorFilename'](_0x5b33b5[_0xdbd9('0x36')],_0x5b33b5[_0xdbd9('0x77')]);}else if(this[_0xdbd9('0x32')](_0x5b33b5[_0xdbd9('0x74')]['xmd-phone'])){logger[_0xdbd9('0x2c')](_0xdbd9('0x78'),_0x5b33b5['uniqueid'],_0x5b33b5[_0xdbd9('0x77')]);this[_0xdbd9('0x1a')][_0x5b33b5['uniqueid']]['calleridnum']=_0x5b33b5[_0xdbd9('0x77')];}else if(this[_0xdbd9('0x32')](_0x5b33b5['variable']['xmd-callerid'])){logger[_0xdbd9('0x2c')](_0xdbd9('0x79'),_0x5b33b5[_0xdbd9('0x36')],_0x5b33b5['value']);this[_0xdbd9('0x1a')][_0x5b33b5[_0xdbd9('0x36')]][_0xdbd9('0x7a')]=_0x5b33b5[_0xdbd9('0x77')];}else if(this['isNotNull'](_0x5b33b5[_0xdbd9('0x74')][_0xdbd9('0x7b')])){logger['info'](_0xdbd9('0x7c'),_0x5b33b5[_0xdbd9('0x36')],_0x5b33b5[_0xdbd9('0x77')]);this[_0xdbd9('0x1a')][_0x5b33b5[_0xdbd9('0x36')]]['type']=_0x5b33b5[_0xdbd9('0x77')];}else if(this[_0xdbd9('0x32')](_0x5b33b5['variable'][_0xdbd9('0x7d')])){logger[_0xdbd9('0x2c')](_0xdbd9('0x7e'),_0x5b33b5[_0xdbd9('0x36')],_0x5b33b5['value'][_0xdbd9('0x4b')](',')[0x0]);this[_0xdbd9('0x1a')][_0x5b33b5[_0xdbd9('0x36')]]['queue']=_0x5b33b5[_0xdbd9('0x77')][_0xdbd9('0x4b')](',')[0x0];}else if(this[_0xdbd9('0x32')](_0x5b33b5[_0xdbd9('0x74')][_0xdbd9('0x7f')])){logger[_0xdbd9('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5b33b5['uniqueid'],_0x5b33b5[_0xdbd9('0x77')]);this[_0xdbd9('0x1a')][_0x5b33b5[_0xdbd9('0x36')]]['originatecalleridnum']=_0x5b33b5[_0xdbd9('0x77')];}else if(this[_0xdbd9('0x32')](_0x5b33b5[_0xdbd9('0x74')]['xmd-destination'])){logger[_0xdbd9('0x2c')](_0xdbd9('0x80'),_0x5b33b5[_0xdbd9('0x36')],_0x5b33b5[_0xdbd9('0x77')]);this[_0xdbd9('0x1a')][_0x5b33b5[_0xdbd9('0x36')]][_0xdbd9('0x81')]=_0x5b33b5[_0xdbd9('0x77')];}else if(this[_0xdbd9('0x32')](_0x5b33b5[_0xdbd9('0x74')][_0xdbd9('0x82')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x5b33b5[_0xdbd9('0x36')],_0x5b33b5[_0xdbd9('0x77')]);this[_0xdbd9('0x1a')][_0x5b33b5[_0xdbd9('0x36')]][_0xdbd9('0x83')]=_0x5b33b5[_0xdbd9('0x77')];}else if(this[_0xdbd9('0x32')](_0x5b33b5[_0xdbd9('0x74')][_0xdbd9('0x84')])){logger[_0xdbd9('0x2c')](_0xdbd9('0x85'),_0x5b33b5[_0xdbd9('0x36')],_0x5b33b5[_0xdbd9('0x77')]);this[_0xdbd9('0x1a')][_0x5b33b5['uniqueid']]['queue']=_0x5b33b5[_0xdbd9('0x77')];}else if(this['isNotNull'](_0x5b33b5[_0xdbd9('0x74')][_0xdbd9('0x86')])){logger['info'](_0xdbd9('0x87'),_0x5b33b5[_0xdbd9('0x36')],_0x5b33b5[_0xdbd9('0x77')]);this[_0xdbd9('0x1a')][_0x5b33b5[_0xdbd9('0x36')]][_0xdbd9('0x88')]=_0x5b33b5[_0xdbd9('0x77')];}}}else if(this['isNotNull'](_0x5b33b5[_0xdbd9('0x74')][_0xdbd9('0x75')])){if(_0x5b33b5['value']){var _0x3c93b6=path['parse'](_0x5b33b5['value'])[_0xdbd9('0x4e')];logger[_0xdbd9('0x2c')](_0xdbd9('0x76'),_0x3c93b6,_0x5b33b5[_0xdbd9('0x77')]);this[_0xdbd9('0x67')](_0x3c93b6,_0x5b33b5[_0xdbd9('0x77')]);}}else if(this['channels'][_0x5b33b5[_0xdbd9('0x3a')]]){if(this[_0xdbd9('0x32')](_0x5b33b5['variable'])){if(this['isNotNull'](_0x5b33b5[_0xdbd9('0x74')][_0xdbd9('0x86')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5b33b5['linkedid'],_0x5b33b5[_0xdbd9('0x77')]);this[_0xdbd9('0x1a')][_0x5b33b5['linkedid']][_0xdbd9('0x89')]=_0x5b33b5[_0xdbd9('0x77')];}}}}}catch(_0x4dd96f){logger[_0xdbd9('0x2f')]('[%s][voiceCallReport][varset]',_0x5b33b5[_0xdbd9('0x36')],util[_0xdbd9('0x39')](_0x4dd96f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xdbd9('0x26')]=function(_0x3c65d6){try{if(this[_0xdbd9('0x32')](_0x3c65d6)){logger['debug'](_0xdbd9('0x8a'),_0x3c65d6[_0xdbd9('0x36')],util[_0xdbd9('0x39')](_0x3c65d6,{'showHidden':![],'depth':null}));if(this['channels'][_0x3c65d6[_0xdbd9('0x36')]]){logger[_0xdbd9('0x2c')](_0xdbd9('0x8b'),_0x3c65d6[_0xdbd9('0x36')],_0x3c65d6[_0xdbd9('0x8c')]);var _0x391b41=moment();this[_0xdbd9('0x1a')][_0x3c65d6[_0xdbd9('0x36')]][_0xdbd9('0x8d')]=_0x391b41[_0xdbd9('0x44')](_0xdbd9('0x45'));this['channels'][_0x3c65d6[_0xdbd9('0x36')]][_0xdbd9('0x55')]=_0x391b41[_0xdbd9('0x5f')](this['channels'][_0x3c65d6['uniqueid']][_0xdbd9('0x43')],_0xdbd9('0x57'));if(this[_0xdbd9('0x1a')][_0x3c65d6['uniqueid']]['answered']){this['channels'][_0x3c65d6[_0xdbd9('0x36')]][_0xdbd9('0x8e')]=_0x391b41[_0xdbd9('0x5f')](this[_0xdbd9('0x1a')][_0x3c65d6[_0xdbd9('0x36')]][_0xdbd9('0x5d')],_0xdbd9('0x57'));this[_0xdbd9('0x1a')][_0x3c65d6[_0xdbd9('0x36')]][_0xdbd9('0x5e')]=this['channels'][_0x3c65d6[_0xdbd9('0x36')]][_0xdbd9('0x55')]-this['channels'][_0x3c65d6['uniqueid']][_0xdbd9('0x8e')];}if(_0x3c65d6['context']===_0xdbd9('0x49')){if(this['agents'][_0x3c65d6[_0xdbd9('0x3f')]['split']('-')[0x0]]){this['agents'][_0x3c65d6[_0xdbd9('0x3f')]['split']('-')[0x0]]=_[_0xdbd9('0x8f')](this[_0xdbd9('0x1b')][_0x3c65d6[_0xdbd9('0x3f')][_0xdbd9('0x4b')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0xdbd9('0x90'),_0x3c65d6[_0xdbd9('0x36')],util[_0xdbd9('0x39')]({'destaccountcode':this[_0xdbd9('0x1b')][_0x3c65d6[_0xdbd9('0x3f')][_0xdbd9('0x4b')]('-')[0x0]][_0xdbd9('0x4c')]},{'showHidden':![],'depth':null}));this[_0xdbd9('0x34')](util[_0xdbd9('0x44')](_0xdbd9('0x4d'),this[_0xdbd9('0x1b')][_0x3c65d6[_0xdbd9('0x3f')][_0xdbd9('0x4b')]('-')[0x0]][_0xdbd9('0x4e')]),_0xdbd9('0x91'),{'destaccountcode':this['agents'][_0x3c65d6[_0xdbd9('0x3f')]['split']('-')[0x0]][_0xdbd9('0x4c')]});}}if(_0x3c65d6[_0xdbd9('0x92')]===_0xdbd9('0x93')){this[_0xdbd9('0x1c')][_0x3c65d6['uniqueid']]=this['channels'][_0x3c65d6[_0xdbd9('0x36')]];}else{if(this['channels'][_0x3c65d6[_0xdbd9('0x36')]][_0xdbd9('0x94')]==='outbound'&&this[_0xdbd9('0x1c')][_0x3c65d6[_0xdbd9('0x36')]]){this[_0xdbd9('0x1a')][_0x3c65d6['uniqueid']]['uniqueid']=[this[_0xdbd9('0x1a')][_0x3c65d6[_0xdbd9('0x36')]][_0xdbd9('0x3a')],this[_0xdbd9('0x1a')][_0x3c65d6[_0xdbd9('0x36')]][_0xdbd9('0x3a')]=this[_0xdbd9('0x1a')][_0x3c65d6[_0xdbd9('0x36')]]['uniqueid']][0x0];delete this[_0xdbd9('0x1c')][_0x3c65d6[_0xdbd9('0x36')]];}}logger[_0xdbd9('0x38')](_0xdbd9('0x95'),_0x3c65d6[_0xdbd9('0x36')],util[_0xdbd9('0x39')](this[_0xdbd9('0x1a')][_0x3c65d6[_0xdbd9('0x36')]],{'showHidden':![],'depth':null}));ami[_0xdbd9('0x34')](_0xdbd9('0x96'),this[_0xdbd9('0x1a')][_0x3c65d6[_0xdbd9('0x36')]]);delete this['channels'][_0x3c65d6['uniqueid']];}}}catch(_0x2192e2){logger[_0xdbd9('0x2f')](_0xdbd9('0x97'),_0x3c65d6['uniqueid'],util[_0xdbd9('0x39')](_0x2192e2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xdbd9('0x29')]=function(_0x43816a){try{if(this[_0xdbd9('0x32')](_0x43816a)){logger[_0xdbd9('0x2c')](_0xdbd9('0x98'),_0x43816a[_0xdbd9('0x36')],_0x43816a['origtransferercalleridnum'],_0x43816a['transfertargetcalleridnum']);logger[_0xdbd9('0x38')](_0xdbd9('0x99'),_0x43816a[_0xdbd9('0x36')],util['inspect'](_0x43816a,{'showHidden':![],'depth':null}));if(this[_0xdbd9('0x1a')][_0x43816a[_0xdbd9('0x9a')]]){this[_0xdbd9('0x1a')][_0x43816a['transfereeuniqueid']][_0xdbd9('0x9b')]=_0x43816a[_0xdbd9('0x9c')];this[_0xdbd9('0x1a')][_0x43816a[_0xdbd9('0x9a')]][_0xdbd9('0x9d')]=_0x43816a[_0xdbd9('0x9e')];if(this[_0xdbd9('0x1a')][_0x43816a[_0xdbd9('0x9f')]]){var _0x2d90a1=this[_0xdbd9('0x1a')][_0x43816a[_0xdbd9('0x9f')]];this['channels'][_0x43816a[_0xdbd9('0x9f')]]=this[_0xdbd9('0x1a')][_0x43816a['transfereeuniqueid']];this[_0xdbd9('0x1a')][_0x43816a[_0xdbd9('0x9a')]]=_0x2d90a1;}}else if(this[_0xdbd9('0x1a')][_0x43816a[_0xdbd9('0xa0')]]){this['channels'][_0x43816a[_0xdbd9('0xa0')]][_0xdbd9('0x9b')]=_0x43816a[_0xdbd9('0x9c')];this['channels'][_0x43816a[_0xdbd9('0xa0')]][_0xdbd9('0x9d')]=_0x43816a[_0xdbd9('0x9e')];if(this[_0xdbd9('0x1a')][_0x43816a[_0xdbd9('0xa1')]]){var _0x2d90a1=this[_0xdbd9('0x1a')][_0x43816a[_0xdbd9('0xa1')]];this[_0xdbd9('0x1a')][_0x43816a[_0xdbd9('0xa1')]]=this[_0xdbd9('0x1a')][_0x43816a[_0xdbd9('0xa0')]];this[_0xdbd9('0x1a')][_0x43816a[_0xdbd9('0xa0')]]=_0x2d90a1;}}}}catch(_0x5cba4b){logger[_0xdbd9('0x2f')](_0xdbd9('0xa2'),_0x43816a[_0xdbd9('0x36')],util[_0xdbd9('0x39')](_0x5cba4b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdbd9('0x31')]['syncBlindTransfer']=function(_0xb5cc57){try{if(this[_0xdbd9('0x32')](_0xb5cc57)){logger['info'](_0xdbd9('0xa3'),_0xb5cc57[_0xdbd9('0x36')],_0xb5cc57['transfereecalleridnum'],_0xb5cc57[_0xdbd9('0xa4')]);logger[_0xdbd9('0x38')](_0xdbd9('0xa5'),_0xb5cc57[_0xdbd9('0x36')],util[_0xdbd9('0x39')](_0xb5cc57,{'showHidden':![],'depth':null}));if(this[_0xdbd9('0x1a')][_0xb5cc57[_0xdbd9('0x9a')]]){this[_0xdbd9('0x1a')][_0xb5cc57[_0xdbd9('0x9a')]][_0xdbd9('0x9b')]=_0xb5cc57[_0xdbd9('0xa6')];this[_0xdbd9('0x1a')][_0xb5cc57[_0xdbd9('0x9a')]][_0xdbd9('0x9d')]=_0xb5cc57[_0xdbd9('0xa4')];this[_0xdbd9('0x26')]({'event':_0xdbd9('0x93'),'uniqueid':_0xb5cc57[_0xdbd9('0x9a')],'context':_0xb5cc57[_0xdbd9('0xa7')],'channel':_0xb5cc57[_0xdbd9('0xa8')]});}}}catch(_0x2f8d87){logger['error']('[%s][voiceCallReport][blindtransfer]',_0xb5cc57[_0xdbd9('0x36')],util[_0xdbd9('0x39')](_0x2f8d87,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdbd9('0x31')][_0xdbd9('0x2b')]=function(_0x53941c){try{if(this[_0xdbd9('0x32')](_0x53941c)){logger[_0xdbd9('0x38')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x53941c['uniqueid'],util['inspect'](_0x53941c,{'showHidden':![],'depth':null}));if(this[_0xdbd9('0x1a')][_0x53941c['uniqueid']]){if(!_[_0xdbd9('0xa9')](this['channels'][_0x53941c[_0xdbd9('0x36')]][_0xdbd9('0x5d')])){this[_0xdbd9('0x1a')][_0x53941c[_0xdbd9('0x36')]][_0xdbd9('0xaa')]=moment()[_0xdbd9('0x44')](_0xdbd9('0x45'));logger[_0xdbd9('0x2c')](_0xdbd9('0xab'),_0x53941c['uniqueid'],this[_0xdbd9('0x1a')][_0x53941c[_0xdbd9('0x36')]][_0xdbd9('0xaa')]);}}}}catch(_0x4b58fc){logger[_0xdbd9('0x2f')]('[%s][voiceCallReport][musiconholdstart]',_0x53941c[_0xdbd9('0x36')],util[_0xdbd9('0x39')](_0x4b58fc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdbd9('0x31')][_0xdbd9('0xac')]=function(_0x1746e3){try{if(this[_0xdbd9('0x32')](_0x1746e3)){logger[_0xdbd9('0x38')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x1746e3[_0xdbd9('0x36')],util[_0xdbd9('0x39')](_0x1746e3,{'showHidden':![],'depth':null}));if(this[_0xdbd9('0x1a')][_0x1746e3[_0xdbd9('0x36')]]){if(!_[_0xdbd9('0xa9')](this[_0xdbd9('0x1a')][_0x1746e3[_0xdbd9('0x36')]][_0xdbd9('0xaa')])){this[_0xdbd9('0x1a')][_0x1746e3[_0xdbd9('0x36')]][_0xdbd9('0xad')]+=moment()['milliseconds'](0x0)[_0xdbd9('0x5f')](this[_0xdbd9('0x1a')][_0x1746e3[_0xdbd9('0x36')]][_0xdbd9('0xaa')],_0xdbd9('0x57'));logger['info'](_0xdbd9('0xae'),_0x1746e3[_0xdbd9('0x36')],this[_0xdbd9('0x1a')][_0x1746e3['uniqueid']]['mohtime']);delete this[_0xdbd9('0x1a')][_0x1746e3['uniqueid']]['mohstarttime'];}}}}catch(_0x35f5bf){logger['error'](_0xdbd9('0xaf'),_0x1746e3['uniqueid'],util[_0xdbd9('0x39')](_0x35f5bf,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 4ae07f6..64214c8 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 _0xf332=['debug','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','privilege','info','membername','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','outboundrouteid','value','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','variables','cause-txt','duration','endtime','diff','starttime','seconds','complete','answered','sumHoldTime','holdtime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','varset','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','emit','prototype'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0xf332,0xbd));var _0x2f33=function(_0x13b0c8,_0x329a9b){_0x13b0c8=_0x13b0c8-0x0;var _0x400bfa=_0xf332[_0x13b0c8];return _0x400bfa;};'use strict';var _=require(_0x2f33('0x0'));var moment=require(_0x2f33('0x1'));var util=require(_0x2f33('0x2'));var Redis=require(_0x2f33('0x3'));var config=require(_0x2f33('0x4'));var logger=require(_0x2f33('0x5'))(_0x2f33('0x6'));var ami=require('../ami');config[_0x2f33('0x7')]=_[_0x2f33('0x8')](config[_0x2f33('0x7')],{'host':_0x2f33('0x9'),'port':0x18eb});var io=require(_0x2f33('0xa'))(new Redis(config[_0x2f33('0x7')]));function VoiceDialReport(_0x2a3ccf){this[_0x2f33('0xb')]=_0x2a3ccf[_0x2f33('0xc')];this['outbound']=_0x2a3ccf[_0x2f33('0xd')];this['variables']={};ami['on'](_0x2f33('0xe'),this[_0x2f33('0xf')]['bind'](this));ami['on'](_0x2f33('0x10'),this[_0x2f33('0x11')][_0x2f33('0x12')](this));ami['on'](_0x2f33('0x13'),this[_0x2f33('0x14')][_0x2f33('0x12')](this));ami['on'](_0x2f33('0x15'),this[_0x2f33('0x16')][_0x2f33('0x12')](this));}VoiceDialReport['prototype'][_0x2f33('0x17')]=function(_0x271752){return _0x271752!==null&&!_[_0x2f33('0x18')](_0x271752);};VoiceDialReport['prototype']['emit']=function(_0x59d32e,_0x33fc7a,_0x1bb41c){io['to'](_0x59d32e)[_0x2f33('0x19')](_0x33fc7a,_0x1bb41c);};VoiceDialReport[_0x2f33('0x1a')][_0x2f33('0xf')]=function(_0x1e7fa8){try{if(this[_0x2f33('0x17')](_0x1e7fa8)){logger[_0x2f33('0x1b')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x1e7fa8[_0x2f33('0x1c')],util[_0x2f33('0x1d')](_0x1e7fa8,{'showHidden':![],'depth':null}));if(this['channels'][_0x1e7fa8[_0x2f33('0x1c')]]){_[_0x2f33('0x1e')](this[_0x2f33('0xb')][_0x1e7fa8['uniqueid']],{'starttime':moment()[_0x2f33('0x1f')](_0x2f33('0x20')),'lastevent':'called','interface':_0x1e7fa8[_0x2f33('0x21')][_0x2f33('0x22')](0x0,_0x1e7fa8['channel'][_0x2f33('0x23')]('-')),'membername':_0x1e7fa8[_0x2f33('0x21')]['substring'](_0x1e7fa8[_0x2f33('0x21')][_0x2f33('0x23')]('/')+0x1,_0x1e7fa8[_0x2f33('0x21')]['lastIndexOf']('-'))},_[_0x2f33('0x24')](_0x1e7fa8,['event',_0x2f33('0x25')]));logger[_0x2f33('0x26')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x1e7fa8['uniqueid'],this[_0x2f33('0xb')][_0x1e7fa8[_0x2f33('0x1c')]][_0x2f33('0x27')],this[_0x2f33('0xb')][_0x1e7fa8[_0x2f33('0x1c')]]['interface']);logger[_0x2f33('0x1b')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x1e7fa8[_0x2f33('0x1c')],util[_0x2f33('0x1d')](this[_0x2f33('0xb')][_0x1e7fa8[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));this[_0x2f33('0x19')]('voice:outbound',_0x2f33('0x28'),this[_0x2f33('0xb')][_0x1e7fa8[_0x2f33('0x1c')]]);logger[_0x2f33('0x1b')](_0x2f33('0x29'),_0x1e7fa8['uniqueid'],util['inspect'](this[_0x2f33('0xb')][_0x1e7fa8[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x2f33('0x19')](_0x2f33('0x2a'),this[_0x2f33('0xb')][_0x1e7fa8['uniqueid']]);}}}catch(_0x2124ce){logger[_0x2f33('0x2b')](_0x2f33('0x2c'),_0x1e7fa8[_0x2f33('0x1c')],util[_0x2f33('0x1d')](_0x2124ce,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2f33('0x1a')]['syncDialEnd']=function(_0x52a47e){try{if(this[_0x2f33('0x17')](_0x52a47e)){logger[_0x2f33('0x1b')]('[%s][voiceDialReport][dialend]\x20event:',_0x52a47e['uniqueid'],util['inspect'](_0x52a47e,{'showHidden':![],'depth':null}));if(this['channels'][_0x52a47e[_0x2f33('0x1c')]]){this[_0x2f33('0xb')][_0x52a47e['uniqueid']][_0x2f33('0x2d')]=_0x52a47e[_0x2f33('0x2d')];if(_0x52a47e[_0x2f33('0x2d')]===_0x2f33('0x2e')){this['channels'][_0x52a47e[_0x2f33('0x1c')]][_0x2f33('0x2f')]=_0x52a47e[_0x2f33('0x2f')];this[_0x2f33('0xb')][_0x52a47e[_0x2f33('0x1c')]]['connectedlinename']=_0x52a47e[_0x2f33('0x30')];this['channels'][_0x52a47e['uniqueid']][_0x2f33('0x31')]=moment()[_0x2f33('0x1f')](_0x2f33('0x20'));this['channels'][_0x52a47e[_0x2f33('0x1c')]][_0x2f33('0x32')]=_0x2f33('0x33');logger[_0x2f33('0x26')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x52a47e[_0x2f33('0x1c')],_0x52a47e[_0x2f33('0x21')][_0x2f33('0x22')](_0x52a47e[_0x2f33('0x21')][_0x2f33('0x23')]('/')+0x1,_0x52a47e[_0x2f33('0x21')]['lastIndexOf']('-')));logger[_0x2f33('0x1b')](_0x2f33('0x34'),_0x52a47e['uniqueid'],util[_0x2f33('0x1d')](this[_0x2f33('0xb')][_0x52a47e[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x2f33('0x19')](_0x2f33('0x35'),this[_0x2f33('0xb')][_0x52a47e[_0x2f33('0x1c')]]);}logger['debug'](_0x2f33('0x36'),_0x52a47e[_0x2f33('0x1c')],util[_0x2f33('0x1d')](this[_0x2f33('0xb')][_0x52a47e[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));this[_0x2f33('0x19')]('voice:outbound','voice_outbound_channel:save',this[_0x2f33('0xb')][_0x52a47e['uniqueid']]);}}}catch(_0x2a422b){logger[_0x2f33('0x2b')](_0x2f33('0x37'),_0x52a47e[_0x2f33('0x1c')],util[_0x2f33('0x1d')](_0x2a422b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2f33('0x1a')]['syncVarSet']=function(_0x935c1d){try{if(this[_0x2f33('0x17')](_0x935c1d)){logger['debug'](_0x2f33('0x38'),_0x935c1d[_0x2f33('0x1c')],util[_0x2f33('0x1d')](_0x935c1d,{'showHidden':![],'depth':null}));this[_0x2f33('0x39')](_0x935c1d[_0x2f33('0x1c')],_[_0x2f33('0x3a')](_0x935c1d[_0x2f33('0x3b')])[0x0],_0x935c1d['value']);if(this['isNotNull'](_0x935c1d['variable'])&&this[_0x2f33('0x17')](_0x935c1d[_0x2f33('0x3b')][_0x2f33('0x3c')])){if(_['isUndefined'](this[_0x2f33('0xb')][_0x935c1d[_0x2f33('0x1c')]])){this['channels'][_0x935c1d[_0x2f33('0x1c')]]={'routeId':_0x935c1d[_0x2f33('0x3d')],'variables':this['variables'][_0x935c1d[_0x2f33('0x1c')]]};logger[_0x2f33('0x26')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x935c1d[_0x2f33('0x1c')],_0x935c1d[_0x2f33('0x3b')][_0x2f33('0x3c')],_[_0x2f33('0x3a')](_0x935c1d['variable'])[0x0],_0x935c1d['value']);logger[_0x2f33('0x1b')](_0x2f33('0x3e'),_0x935c1d[_0x2f33('0x1c')],util[_0x2f33('0x1d')](this[_0x2f33('0xb')][_0x935c1d['uniqueid']],{'showHidden':![],'depth':null}));this[_0x2f33('0x19')](_0x2f33('0x3f'),_0x2f33('0x28'),this[_0x2f33('0xb')][_0x935c1d[_0x2f33('0x1c')]]);}}}}catch(_0x50efdd){logger[_0x2f33('0x2b')]('[%s][voiceDialReport][varset]',_0x935c1d['uniqueid'],util[_0x2f33('0x1d')](_0x50efdd,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x1684ad,_0x2f8bed,_0x385029){var _0x295200=[_0x2f33('0x40'),'rtpaudioqosbridged',_0x2f33('0x41'),_0x2f33('0x42'),_0x2f33('0x43'),'rtpaudioqoslossbridged',_0x2f33('0x44'),_0x2f33('0x45'),_0x2f33('0x46'),_0x2f33('0x47'),_0x2f33('0x48'),_0x2f33('0x49'),_0x2f33('0x4a'),_0x2f33('0x4b'),_0x2f33('0x4c'),_0x2f33('0x4d'),_0x2f33('0x27'),_0x2f33('0x4e'),_0x2f33('0x4f')];if(!_[_0x2f33('0x50')](_0x2f8bed)&&!_[_0x2f33('0x51')](_0x295200,_0x2f8bed)){if(_[_0x2f33('0x18')](this[_0x2f33('0x52')][_0x1684ad])){this[_0x2f33('0x52')][_0x1684ad]={};}this[_0x2f33('0x52')][_0x1684ad][_0x2f8bed]=_0x385029;}};VoiceDialReport[_0x2f33('0x1a')]['syncHangup']=function(_0x4ece60){try{if(this[_0x2f33('0x17')](_0x4ece60)){logger[_0x2f33('0x1b')]('[%s][voiceDialReport][hangup]\x20event:',_0x4ece60[_0x2f33('0x1c')],util[_0x2f33('0x1d')](_0x4ece60,{'showHidden':![],'depth':null}));if(this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]]){logger[_0x2f33('0x26')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x4ece60[_0x2f33('0x1c')],_0x4ece60[_0x2f33('0x53')]);this[_0x2f33('0xb')][_0x4ece60['uniqueid']]['endtime']=moment()[_0x2f33('0x1f')](_0x2f33('0x20'));this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x54')]=moment(this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x55')])[_0x2f33('0x56')](this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x57')],_0x2f33('0x58'));this[_0x2f33('0xb')][_0x4ece60['uniqueid']][_0x2f33('0x32')]=_0x2f33('0x59');this[_0x2f33('0xd')]['total']+=0x1;if(this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x31')]){this['outbound'][_0x2f33('0x5a')]+=0x1;this[_0x2f33('0xb')][_0x4ece60['uniqueid']]['holdtime']=moment(this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]]['answertime'])[_0x2f33('0x56')](this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x57')],_0x2f33('0x58'));this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]]['billableseconds']=moment(this[_0x2f33('0xb')][_0x4ece60['uniqueid']][_0x2f33('0x55')])[_0x2f33('0x56')](this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]]['answertime'],_0x2f33('0x58'));this['outbound'][_0x2f33('0x5b')]+=this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x5c')]||0x0;this[_0x2f33('0xd')][_0x2f33('0x5d')]+=this[_0x2f33('0xb')][_0x4ece60['uniqueid']][_0x2f33('0x5e')];}this[_0x2f33('0xd')][_0x2f33('0x5f')]+=this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x54')];logger[_0x2f33('0x1b')](_0x2f33('0x60'),_0x4ece60['uniqueid'],util['inspect'](this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x2f33('0x19')](_0x2f33('0x61'),this['channels'][_0x4ece60[_0x2f33('0x1c')]]);logger['debug'](_0x2f33('0x62'),_0x4ece60[_0x2f33('0x1c')],util[_0x2f33('0x1d')](this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x2f33('0x19')]('custom:dialend',this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]]);logger['debug'](_0x2f33('0x63'),_0x4ece60[_0x2f33('0x1c')],util[_0x2f33('0x1d')](this[_0x2f33('0xb')][_0x4ece60['uniqueid']],{'showHidden':![],'depth':null}));this[_0x2f33('0x19')]('voice:outbound',_0x2f33('0x64'),this[_0x2f33('0xd')]);logger[_0x2f33('0x26')](_0x2f33('0x65'),JSON[_0x2f33('0x66')](this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]]));logger[_0x2f33('0x1b')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x4ece60[_0x2f33('0x1c')],util[_0x2f33('0x1d')](this['channels'][_0x4ece60[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));this[_0x2f33('0x19')](_0x2f33('0x3f'),_0x2f33('0x67'),this['channels'][_0x4ece60['uniqueid']]);delete this[_0x2f33('0xb')][_0x4ece60['uniqueid']];}else if(this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x68')]]){this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x68')]][_0x2f33('0x1c')]=this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x68')]][_0x2f33('0x69')];}if(this[_0x2f33('0x52')][_0x4ece60[_0x2f33('0x1c')]]){delete this[_0x2f33('0x52')][_0x4ece60[_0x2f33('0x1c')]];}}}catch(_0x573cd7){logger[_0x2f33('0x2b')](_0x2f33('0x6a'),_0x4ece60[_0x2f33('0x1c')],util[_0x2f33('0x1d')](_0x573cd7,{'showHidden':![],'depth':null}));}};module[_0x2f33('0x6b')]=VoiceDialReport; \ No newline at end of file +var _0xc265=['connectedlinenum','connectedlinename','answertime','format','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberpenalty','includes','info','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','moment','util','../../../config/logger','ami','../ami','redis','outboundChannels','outbound','variables','syncDialBegin','bind','dialend','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','uniqueid','inspect','channels','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','emit','custom:dialbegin','[%s][voiceDialReport][dialbegin]','syncDialEnd','dialstatus'];(function(_0xbfc560,_0x311fba){var _0x47b022=function(_0x2cd37f){while(--_0x2cd37f){_0xbfc560['push'](_0xbfc560['shift']());}};_0x47b022(++_0x311fba);}(_0xc265,0x172));var _0x5c26=function(_0x17e4bc,_0x1e9cc0){_0x17e4bc=_0x17e4bc-0x0;var _0x468db3=_0xc265[_0x17e4bc];return _0x468db3;};'use strict';var _=require('lodash');var moment=require(_0x5c26('0x0'));var util=require(_0x5c26('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x5c26('0x2'))(_0x5c26('0x3'));var ami=require(_0x5c26('0x4'));config['redis']=_['defaults'](config[_0x5c26('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5c26('0x5')]));function VoiceDialReport(_0x25a527){this['channels']=_0x25a527[_0x5c26('0x6')];this[_0x5c26('0x7')]=_0x25a527[_0x5c26('0x7')];this[_0x5c26('0x8')]={};ami['on']('dialbegin',this[_0x5c26('0x9')][_0x5c26('0xa')](this));ami['on'](_0x5c26('0xb'),this['syncDialEnd']['bind'](this));ami['on']('varset',this[_0x5c26('0xc')][_0x5c26('0xa')](this));ami['on'](_0x5c26('0xd'),this[_0x5c26('0xe')][_0x5c26('0xa')](this));}VoiceDialReport[_0x5c26('0xf')][_0x5c26('0x10')]=function(_0x15656e){return _0x15656e!==null&&!_[_0x5c26('0x11')](_0x15656e);};VoiceDialReport[_0x5c26('0xf')]['emit']=function(_0x484c92,_0x5ac05f,_0x21d77e){io['to'](_0x484c92)['emit'](_0x5ac05f,_0x21d77e);};VoiceDialReport[_0x5c26('0xf')][_0x5c26('0x9')]=function(_0x452780){try{if(this[_0x5c26('0x10')](_0x452780)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x452780[_0x5c26('0x12')],util[_0x5c26('0x13')](_0x452780,{'showHidden':![],'depth':null}));if(this[_0x5c26('0x14')][_0x452780['uniqueid']]){_[_0x5c26('0x15')](this[_0x5c26('0x14')][_0x452780[_0x5c26('0x12')]],{'starttime':moment()['format'](_0x5c26('0x16')),'lastevent':_0x5c26('0x17'),'interface':_0x452780[_0x5c26('0x18')]['substring'](0x0,_0x452780['channel'][_0x5c26('0x19')]('-')),'membername':_0x452780[_0x5c26('0x18')][_0x5c26('0x1a')](_0x452780['channel'][_0x5c26('0x19')]('/')+0x1,_0x452780['channel'][_0x5c26('0x19')]('-'))},_['omit'](_0x452780,[_0x5c26('0x1b'),_0x5c26('0x1c')]));logger['info'](_0x5c26('0x1d'),_0x452780['uniqueid'],this['channels'][_0x452780['uniqueid']][_0x5c26('0x1e')],this[_0x5c26('0x14')][_0x452780[_0x5c26('0x12')]][_0x5c26('0x1f')]);logger[_0x5c26('0x20')](_0x5c26('0x21'),_0x452780[_0x5c26('0x12')],util[_0x5c26('0x13')](this[_0x5c26('0x14')][_0x452780[_0x5c26('0x12')]],{'showHidden':![],'depth':null}));this['emit'](_0x5c26('0x22'),_0x5c26('0x23'),this[_0x5c26('0x14')][_0x452780[_0x5c26('0x12')]]);logger[_0x5c26('0x20')](_0x5c26('0x24'),_0x452780[_0x5c26('0x12')],util[_0x5c26('0x13')](this[_0x5c26('0x14')][_0x452780[_0x5c26('0x12')]],{'showHidden':![],'depth':null}));ami[_0x5c26('0x25')](_0x5c26('0x26'),this[_0x5c26('0x14')][_0x452780[_0x5c26('0x12')]]);}}}catch(_0x481de6){logger['error'](_0x5c26('0x27'),_0x452780[_0x5c26('0x12')],util[_0x5c26('0x13')](_0x481de6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5c26('0xf')][_0x5c26('0x28')]=function(_0x203606){try{if(this[_0x5c26('0x10')](_0x203606)){logger[_0x5c26('0x20')]('[%s][voiceDialReport][dialend]\x20event:',_0x203606[_0x5c26('0x12')],util[_0x5c26('0x13')](_0x203606,{'showHidden':![],'depth':null}));if(this[_0x5c26('0x14')][_0x203606[_0x5c26('0x12')]]){this['channels'][_0x203606[_0x5c26('0x12')]][_0x5c26('0x29')]=_0x203606[_0x5c26('0x29')];if(_0x203606[_0x5c26('0x29')]==='ANSWER'){this['channels'][_0x203606['uniqueid']][_0x5c26('0x2a')]=_0x203606[_0x5c26('0x2a')];this[_0x5c26('0x14')][_0x203606[_0x5c26('0x12')]]['connectedlinename']=_0x203606[_0x5c26('0x2b')];this[_0x5c26('0x14')][_0x203606[_0x5c26('0x12')]][_0x5c26('0x2c')]=moment()[_0x5c26('0x2d')](_0x5c26('0x16'));this[_0x5c26('0x14')][_0x203606[_0x5c26('0x12')]][_0x5c26('0x2e')]='connect';logger['info'](_0x5c26('0x2f'),_0x203606[_0x5c26('0x12')],_0x203606[_0x5c26('0x18')]['substring'](_0x203606[_0x5c26('0x18')][_0x5c26('0x19')]('/')+0x1,_0x203606[_0x5c26('0x18')][_0x5c26('0x19')]('-')));logger[_0x5c26('0x20')](_0x5c26('0x30'),_0x203606[_0x5c26('0x12')],util['inspect'](this[_0x5c26('0x14')][_0x203606[_0x5c26('0x12')]],{'showHidden':![],'depth':null}));ami['emit'](_0x5c26('0x31'),this[_0x5c26('0x14')][_0x203606[_0x5c26('0x12')]]);}logger[_0x5c26('0x20')](_0x5c26('0x32'),_0x203606[_0x5c26('0x12')],util['inspect'](this['channels'][_0x203606[_0x5c26('0x12')]],{'showHidden':![],'depth':null}));this['emit'](_0x5c26('0x22'),'voice_outbound_channel:save',this[_0x5c26('0x14')][_0x203606['uniqueid']]);}}}catch(_0x460641){logger[_0x5c26('0x33')](_0x5c26('0x34'),_0x203606['uniqueid'],util[_0x5c26('0x13')](_0x460641,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5c26('0xf')][_0x5c26('0xc')]=function(_0x3955cd){try{if(this[_0x5c26('0x10')](_0x3955cd)){logger[_0x5c26('0x20')](_0x5c26('0x35'),_0x3955cd[_0x5c26('0x12')],util[_0x5c26('0x13')](_0x3955cd,{'showHidden':![],'depth':null}));this['addVariable'](_0x3955cd['uniqueid'],_[_0x5c26('0x36')](_0x3955cd[_0x5c26('0x37')])[0x0],_0x3955cd[_0x5c26('0x38')]);if(this[_0x5c26('0x10')](_0x3955cd['variable'])&&this['isNotNull'](_0x3955cd[_0x5c26('0x37')]['outboundrouteid'])){if(_[_0x5c26('0x11')](this[_0x5c26('0x14')][_0x3955cd['uniqueid']])){this[_0x5c26('0x14')][_0x3955cd[_0x5c26('0x12')]]={'routeId':_0x3955cd[_0x5c26('0x38')],'variables':this[_0x5c26('0x8')][_0x3955cd[_0x5c26('0x12')]]};logger['info'](_0x5c26('0x39'),_0x3955cd[_0x5c26('0x12')],_0x3955cd[_0x5c26('0x37')][_0x5c26('0x3a')],_[_0x5c26('0x36')](_0x3955cd['variable'])[0x0],_0x3955cd[_0x5c26('0x38')]);logger[_0x5c26('0x20')](_0x5c26('0x3b'),_0x3955cd['uniqueid'],util['inspect'](this[_0x5c26('0x14')][_0x3955cd[_0x5c26('0x12')]],{'showHidden':![],'depth':null}));this['emit'](_0x5c26('0x22'),_0x5c26('0x23'),this[_0x5c26('0x14')][_0x3955cd[_0x5c26('0x12')]]);}}}}catch(_0x3e1636){logger[_0x5c26('0x33')](_0x5c26('0x3c'),_0x3955cd['uniqueid'],util[_0x5c26('0x13')](_0x3e1636,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5c26('0xf')][_0x5c26('0x3d')]=function(_0x4295d3,_0x19ecbc,_0x412b66){var _0xadec3e=[_0x5c26('0x3e'),_0x5c26('0x3f'),_0x5c26('0x40'),_0x5c26('0x41'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x5c26('0x42'),_0x5c26('0x43'),_0x5c26('0x44'),_0x5c26('0x45'),_0x5c26('0x46'),_0x5c26('0x47'),'membercalls',_0x5c26('0x48'),'memberinterface',_0x5c26('0x49'),'membername',_0x5c26('0x4a'),'memberrealtime'];if(!_['isNil'](_0x19ecbc)&&!_[_0x5c26('0x4b')](_0xadec3e,_0x19ecbc)){if(_[_0x5c26('0x11')](this[_0x5c26('0x8')][_0x4295d3])){this['variables'][_0x4295d3]={};}this[_0x5c26('0x8')][_0x4295d3][_0x19ecbc]=_0x412b66;}};VoiceDialReport['prototype'][_0x5c26('0xe')]=function(_0x47fb0f){try{if(this[_0x5c26('0x10')](_0x47fb0f)){logger[_0x5c26('0x20')]('[%s][voiceDialReport][hangup]\x20event:',_0x47fb0f[_0x5c26('0x12')],util[_0x5c26('0x13')](_0x47fb0f,{'showHidden':![],'depth':null}));if(this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]]){logger[_0x5c26('0x4c')](_0x5c26('0x4d'),_0x47fb0f['uniqueid'],_0x47fb0f[_0x5c26('0x4e')]);this['channels'][_0x47fb0f[_0x5c26('0x12')]][_0x5c26('0x4f')]=moment()[_0x5c26('0x2d')](_0x5c26('0x16'));this[_0x5c26('0x14')][_0x47fb0f['uniqueid']][_0x5c26('0x50')]=moment(this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]][_0x5c26('0x4f')])[_0x5c26('0x51')](this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]][_0x5c26('0x52')],_0x5c26('0x53'));this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]][_0x5c26('0x2e')]=_0x5c26('0x54');this[_0x5c26('0x7')]['total']+=0x1;if(this['channels'][_0x47fb0f[_0x5c26('0x12')]][_0x5c26('0x2c')]){this[_0x5c26('0x7')][_0x5c26('0x55')]+=0x1;this['channels'][_0x47fb0f['uniqueid']][_0x5c26('0x56')]=moment(this['channels'][_0x47fb0f[_0x5c26('0x12')]][_0x5c26('0x2c')])[_0x5c26('0x51')](this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]][_0x5c26('0x52')],_0x5c26('0x53'));this['channels'][_0x47fb0f[_0x5c26('0x12')]][_0x5c26('0x57')]=moment(this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]][_0x5c26('0x4f')])[_0x5c26('0x51')](this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]][_0x5c26('0x2c')],_0x5c26('0x53'));this[_0x5c26('0x7')][_0x5c26('0x58')]+=this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]]['holdtime']||0x0;this['outbound'][_0x5c26('0x59')]+=this['channels'][_0x47fb0f[_0x5c26('0x12')]]['billableseconds'];}this['outbound'][_0x5c26('0x5a')]+=this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]][_0x5c26('0x50')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x47fb0f[_0x5c26('0x12')],util[_0x5c26('0x13')](this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]],{'showHidden':![],'depth':null}));ami['emit'](_0x5c26('0x5b'),this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]]);logger[_0x5c26('0x20')](_0x5c26('0x5c'),_0x47fb0f['uniqueid'],util[_0x5c26('0x13')](this[_0x5c26('0x14')][_0x47fb0f['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x5c26('0x25')](_0x5c26('0x5d'),this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]]);logger['debug'](_0x5c26('0x5e'),_0x47fb0f[_0x5c26('0x12')],util[_0x5c26('0x13')](this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]],{'showHidden':![],'depth':null}));this['emit'](_0x5c26('0x22'),_0x5c26('0x5f'),this[_0x5c26('0x7')]);logger['info'](_0x5c26('0x60'),JSON[_0x5c26('0x61')](this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]]));logger[_0x5c26('0x20')](_0x5c26('0x62'),_0x47fb0f[_0x5c26('0x12')],util[_0x5c26('0x13')](this['channels'][_0x47fb0f[_0x5c26('0x12')]],{'showHidden':![],'depth':null}));this[_0x5c26('0x25')]('voice:outbound','voice_outbound_channel:remove',this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x12')]]);delete this['channels'][_0x47fb0f[_0x5c26('0x12')]];}else if(this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x63')]]){this[_0x5c26('0x14')][_0x47fb0f[_0x5c26('0x63')]][_0x5c26('0x12')]=this['channels'][_0x47fb0f[_0x5c26('0x63')]][_0x5c26('0x64')];}if(this[_0x5c26('0x8')][_0x47fb0f[_0x5c26('0x12')]]){delete this['variables'][_0x47fb0f[_0x5c26('0x12')]];}}}catch(_0x7721cc){logger[_0x5c26('0x33')](_0x5c26('0x65'),_0x47fb0f[_0x5c26('0x12')],util[_0x5c26('0x13')](_0x7721cc,{'showHidden':![],'depth':null}));}};module[_0x5c26('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 3b61fc9..a648f1c 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 _0xd486=['moment','util','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','enqueue','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','prototype','clearZombieChannels','switch','isNil','Action','channel','catch','message','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','clearqueuereport','emit','debug','[%s][voiceQueueReport][','uniqueid','format','voice:queue:%s','voice_queue_channel:save','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','name','emitVoiceQueueSummary','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','type','abandoned','Trunk','Interval','stringify',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isUndefined','queues','[voiceQueueReport][queues]','then','isNotNull','queue','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','queuesummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','inbound','YYYY-MM-DD\x20HH:mm:ss','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','emitVoiceQueueChannelSave','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','info','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','queuecallerleaveAt','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','local/','linkedid','queuecallerexitAt','queuecallerjoinAt','add','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','membercalls','memberinterface','memberpenalty','memberrealtime','includes','[%s][voiceQueueReport][hangup]','unmanaged','diff','seconds','length','milliseconds','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','secondtransfererexten','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','transfertargetuniqueid','origtransfererexten','ATTENDEDTRANSFER','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][attendedtransfer]','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports'];(function(_0x1cdbcb,_0x405f64){var _0x32decc=function(_0x375e27){while(--_0x375e27){_0x1cdbcb['push'](_0x1cdbcb['shift']());}};_0x32decc(++_0x405f64);}(_0xd486,0xe2));var _0x6d48=function(_0x5d1d5a,_0x581548){_0x5d1d5a=_0x5d1d5a-0x0;var _0x96e40a=_0xd486[_0x5d1d5a];return _0x96e40a;};'use strict';var _=require('lodash');var moment=require(_0x6d48('0x0'));var util=require(_0x6d48('0x1'));var md5=require(_0x6d48('0x2'));var Redis=require(_0x6d48('0x3'));var config=require(_0x6d48('0x4'));var logger=require(_0x6d48('0x5'))(_0x6d48('0x6'));var ami=require(_0x6d48('0x7'));var QueueReport=require(_0x6d48('0x8'));config[_0x6d48('0x9')]=_[_0x6d48('0xa')](config[_0x6d48('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6d48('0x9')]));var Sequence=function(){};Sequence['prototype'][_0x6d48('0xb')]=function(_0x5cec5f){this[_0x6d48('0xc')]=this['tail']?this[_0x6d48('0xc')]['finally'](_0x5cec5f):_0x5cec5f();};function VoiceQueueReport(_0x4c326f){this[_0x6d48('0xd')]=new Sequence();this[_0x6d48('0xe')]={};this[_0x6d48('0xf')]=_0x4c326f[_0x6d48('0xf')];this[_0x6d48('0x10')]=_0x4c326f[_0x6d48('0x11')];this[_0x6d48('0x12')]=_0x4c326f[_0x6d48('0x12')];this[_0x6d48('0x13')]=!![];this[_0x6d48('0x14')]=_0x4c326f[_0x6d48('0x14')];this['variables']={};ami['on']('queuesummary',this[_0x6d48('0x15')]['bind'](this));ami['on'](_0x6d48('0x16'),this[_0x6d48('0x17')][_0x6d48('0x18')](this));ami['on'](_0x6d48('0x19'),this[_0x6d48('0x1a')][_0x6d48('0x18')](this));ami['on'](_0x6d48('0x1b'),this[_0x6d48('0x1c')]['bind'](this));ami['on'](_0x6d48('0x1d'),this[_0x6d48('0x1e')][_0x6d48('0x18')](this));ami['on'](_0x6d48('0x1f'),this[_0x6d48('0x20')][_0x6d48('0x18')](this));ami['on']('agentconnect',this[_0x6d48('0x21')][_0x6d48('0x18')](this));ami['on'](_0x6d48('0x22'),this[_0x6d48('0x23')][_0x6d48('0x18')](this));ami['on'](_0x6d48('0x24'),this[_0x6d48('0x25')][_0x6d48('0x18')](this));ami['on'](_0x6d48('0x26'),this[_0x6d48('0x27')][_0x6d48('0x18')](this));ami['on'](_0x6d48('0x28'),this[_0x6d48('0x29')][_0x6d48('0x18')](this));ami['on'](_0x6d48('0x2a'),this[_0x6d48('0x2b')][_0x6d48('0x18')](this));ami['on'](_0x6d48('0x2c'),this[_0x6d48('0x2d')][_0x6d48('0x18')](this));ami['on']('blindtransfer',this[_0x6d48('0x2e')][_0x6d48('0x18')](this));this[_0x6d48('0x2f')]();this[_0x6d48('0x30')]();}function clearChannels(_0x1b5fbb){if(!_[_0x6d48('0x31')](_0x1b5fbb)){for(var _0x319b8d in _0x1b5fbb){if(_0x1b5fbb[_0x6d48('0x32')](_0x319b8d)){delete _0x1b5fbb[_0x319b8d];}}}}function clearCampaigns(_0x426830){if(!_[_0x6d48('0x31')](_0x426830)){for(var _0xcb5a81 in _0x426830){if(_0x426830['hasOwnProperty'](_0xcb5a81)){_0x426830[_0xcb5a81]['originated']=0x0;}}}}function clearVoiceQueues(_0x9fb25a){if(!_[_0x6d48('0x31')](_0x9fb25a)){for(var _0x541d39 in _0x9fb25a){if(_0x9fb25a['hasOwnProperty'](_0x541d39)){_0x9fb25a[_0x541d39][_0x6d48('0x33')]=0x0;_0x9fb25a[_0x541d39][_0x6d48('0x34')]=0x0;_0x9fb25a[_0x541d39][_0x6d48('0x35')]=0x0;_0x9fb25a[_0x541d39][_0x6d48('0x36')]=0x0;_0x9fb25a[_0x541d39][_0x6d48('0x37')]=!![];}}}}function clearAgentBooked(_0x371b3d){if(!_['isEmpty'](_0x371b3d)){for(var _0x48fcc8 in _0x371b3d){if(_0x371b3d[_0x6d48('0x32')](_0x48fcc8)){_0x371b3d[_0x48fcc8][_0x6d48('0x38')]=!![];}}}}VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x3a')]=function(){var _0x54dd23=this;for(var _0x28e67f in this[_0x6d48('0x10')]){if(this['channels']['hasOwnProperty'](_0x28e67f)&&!this[_0x6d48('0x10')][_0x28e67f][_0x6d48('0x3b')]){this[_0x6d48('0xd')][_0x6d48('0xb')](function(){if(!_[_0x6d48('0x3c')](_0x54dd23[_0x6d48('0x10')][_0x28e67f])){return ami[_0x6d48('0x3d')]({'action':'status','channel':_0x54dd23[_0x6d48('0x10')][_0x28e67f][_0x6d48('0x3e')]})[_0x6d48('0x3f')](function(_0x43fe84){if(_0x43fe84[_0x6d48('0x40')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x54dd23[_0x6d48('0x10')][_0x28e67f]){delete _0x54dd23[_0x6d48('0x10')][_0x28e67f];logger[_0x6d48('0x41')](_0x6d48('0x42'),_0x28e67f,util[_0x6d48('0x43')](_0x43fe84,{'showHidden':![],'depth':null}));}if(_0x54dd23[_0x6d48('0xe')][_0x28e67f]){delete _0x54dd23[_0x6d48('0xe')][_0x28e67f];logger[_0x6d48('0x41')](_0x6d48('0x44'),_0x28e67f,util[_0x6d48('0x43')](_0x43fe84,{'showHidden':![],'depth':null}));}if(_0x54dd23[_0x6d48('0x45')][_0x28e67f]){delete _0x54dd23['variables'][_0x28e67f];logger[_0x6d48('0x41')](_0x6d48('0x46'),_0x28e67f,util[_0x6d48('0x43')](_0x43fe84,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0x6d48('0x41')](_0x6d48('0x47'));clearChannels(this[_0x6d48('0x10')]);this[_0x6d48('0x48')](this['queueReports']);clearAgentBooked(this[_0x6d48('0xf')]);clearVoiceQueues(this[_0x6d48('0x12')]);clearCampaigns(this[_0x6d48('0x14')]);};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x48')]=function(_0x4f0826){var _0x44b2cd=this;if(!_['isEmpty'](_0x4f0826)){for(var _0x41ff25 in _0x4f0826){if(_0x4f0826[_0x6d48('0x32')](_0x41ff25)){_0x44b2cd['emitVoiceQueueChannelRemove'](_0x4f0826[_0x41ff25],_0x6d48('0x49'));delete _0x4f0826[_0x41ff25];}}}};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x4a')]=function(_0x2380c9,_0x476798,_0x35e2a4){io['to'](_0x2380c9)[_0x6d48('0x4a')](_0x476798,_0x35e2a4);};VoiceQueueReport['prototype']['emitVoiceQueueChannelSave']=function(_0x446858,_0xd853e2){logger[_0x6d48('0x4b')](_0x6d48('0x4c')+_0xd853e2+']\x20sending\x20voice_queue_channel:save\x20event:',_0x446858[_0x6d48('0x4d')],util['inspect'](_0x446858,{'showHidden':![],'depth':null}));this[_0x6d48('0x4a')](util[_0x6d48('0x4e')](_0x6d48('0x4f'),_0x446858['name']),_0x6d48('0x50'),_0x446858);};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x51')]=function(_0x10fa06,_0x53e13e){logger['debug']('[%s][voiceQueueReport]['+_0x53e13e+_0x6d48('0x52'),_0x10fa06['uniqueid'],util[_0x6d48('0x43')](_0x10fa06,{'showHidden':![],'depth':null}));this[_0x6d48('0x4a')](util['format']('voice:queue:%s',_0x10fa06[_0x6d48('0x53')]),'voice_queue_channel:remove',_0x10fa06);};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x54')]=function(_0x3db026,_0x2c239f){if(_0x3db026['type']==='inbound'){var _0x52b227={'id':_0x3db026['id'],'name':_0x3db026[_0x6d48('0x53')],'strategy':_0x3db026['strategy'],'answered':_0x3db026[_0x6d48('0x55')],'available':_0x3db026[_0x6d48('0x56')],'loggedIn':_0x3db026[_0x6d48('0x57')],'pTalking':_0x3db026['pTalking'],'sumBillable':_0x3db026[_0x6d48('0x58')],'sumDuration':_0x3db026[_0x6d48('0x59')],'sumHoldTime':_0x3db026[_0x6d48('0x5a')]||0x0,'talking':_0x3db026[_0x6d48('0x34')],'total':_0x3db026[_0x6d48('0x5b')],'type':_0x3db026[_0x6d48('0x5c')],'unmanaged':_0x3db026['unmanaged'],'abandoned':_0x3db026[_0x6d48('0x5d')],'waiting':_0x3db026[_0x6d48('0x36')]};if(_0x3db026[_0x6d48('0x5e')]){_0x52b227[_0x6d48('0x5e')]={'id':_0x3db026[_0x6d48('0x5e')]['id'],'name':_0x3db026['Trunk'][_0x6d48('0x53')],'active':_0x3db026[_0x6d48('0x5e')]['active'],'callerid':_0x3db026['Trunk']['callerid']};}if(_0x3db026[_0x6d48('0x5f')]){_0x52b227[_0x6d48('0x5f')]={'id':_0x3db026['Interval']['id'],'name':_0x3db026['Interval'][_0x6d48('0x53')]};}var _0x56d713=md5(JSON[_0x6d48('0x60')](_0x52b227));if(_0x3db026[_0x6d48('0x2')]!==_0x56d713){_0x3db026[_0x6d48('0x2')]=_0x56d713;logger['debug']('[voiceQueueReport]['+_0x2c239f+_0x6d48('0x61'),util[_0x6d48('0x43')](_0x52b227,{'showHidden':![],'depth':null}));this[_0x6d48('0x4a')](util['format'](_0x6d48('0x4f'),_0x52b227['name']),_0x6d48('0x62'),_0x52b227);}}};VoiceQueueReport[_0x6d48('0x39')]['isNotNull']=function(_0x382c95){return _0x382c95!==null&&!_[_0x6d48('0x63')](_0x382c95);};VoiceQueueReport[_0x6d48('0x39')]['loopQueueShow']=function(){var _0x1e4a66=this;setInterval(function(){_0x1e4a66[_0x6d48('0x3a')]();ami[_0x6d48('0x3d')]({'action':_0x6d48('0x64')})[_0x6d48('0x3f')](function(_0x598aeb){logger['error'](_0x6d48('0x65'),util[_0x6d48('0x43')](_0x598aeb,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x6d48('0x39')]['loopQueueSummary']=function(){var _0x4ed10a=this;setInterval(function(){if(_0x4ed10a[_0x6d48('0x13')]){return ami['Action']({'action':'queuesummary'})[_0x6d48('0x66')](function(_0x51b917){_0x4ed10a[_0x6d48('0x13')]=![];})['catch'](function(_0x138709){logger[_0x6d48('0x41')]('[voiceQueueReport][queuesummary]',util[_0x6d48('0x43')](_0x138709,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x15')]=function(_0x5acf98){try{if(this[_0x6d48('0x67')](_0x5acf98)&&this[_0x6d48('0x67')](_0x5acf98[_0x6d48('0x68')])){logger[_0x6d48('0x4b')](_0x6d48('0x69'),util[_0x6d48('0x43')](_0x5acf98,{'showHidden':![],'depth':null}));if(this[_0x6d48('0x12')][_0x5acf98[_0x6d48('0x68')]]){logger['info'](_0x6d48('0x6a'),_0x5acf98[_0x6d48('0x68')]);var _0x393f63=_[_0x6d48('0x6b')](this['channels'],_0x6d48('0x68'))[_0x5acf98[_0x6d48('0x68')]]||0x0;var _0xb9bf27=_0x393f63-_0x5acf98[_0x6d48('0x6c')];if(this[_0x6d48('0x12')][_0x5acf98[_0x6d48('0x68')]][_0x6d48('0x36')]!==_[_0x6d48('0x6d')](_0x5acf98[_0x6d48('0x6c')])||this[_0x6d48('0x12')][_0x5acf98['queue']][_0x6d48('0x57')]!==_[_0x6d48('0x6d')](_0x5acf98[_0x6d48('0x6e')])||this[_0x6d48('0x12')][_0x5acf98[_0x6d48('0x68')]][_0x6d48('0x56')]!==_[_0x6d48('0x6d')](_0x5acf98[_0x6d48('0x56')])||this['voiceQueues'][_0x5acf98['queue']]['talking']!==_0xb9bf27){this[_0x6d48('0x12')][_0x5acf98[_0x6d48('0x68')]][_0x6d48('0x36')]=_['toNumber'](_0x5acf98['callers']);this[_0x6d48('0x12')][_0x5acf98[_0x6d48('0x68')]]['loggedIn']=_[_0x6d48('0x6d')](_0x5acf98[_0x6d48('0x6e')]);this[_0x6d48('0x12')][_0x5acf98['queue']][_0x6d48('0x56')]=_[_0x6d48('0x6d')](_0x5acf98[_0x6d48('0x56')]);this[_0x6d48('0x12')][_0x5acf98[_0x6d48('0x68')]][_0x6d48('0x34')]=_0xb9bf27>0x0?_0xb9bf27:0x0;this[_0x6d48('0x12')][_0x5acf98['queue']][_0x6d48('0x34')]=this[_0x6d48('0x12')][_0x5acf98['queue']][_0x6d48('0x34')]>_[_0x6d48('0x6d')](_0x5acf98[_0x6d48('0x6e')])?_[_0x6d48('0x6d')](_0x5acf98[_0x6d48('0x6e')]):this[_0x6d48('0x12')][_0x5acf98['queue']][_0x6d48('0x34')];this[_0x6d48('0x54')](this[_0x6d48('0x12')][_0x5acf98[_0x6d48('0x68')]],_0x6d48('0x6f'));}logger[_0x6d48('0x4b')](_0x6d48('0x70'),util[_0x6d48('0x43')](this[_0x6d48('0x12')][_0x5acf98['queue']],{'showHidden':![],'depth':null}));ami['emit'](_0x6d48('0x71'),this[_0x6d48('0x12')][_0x5acf98[_0x6d48('0x68')]]);}}}catch(_0x527357){logger['error']('[voiceQueueReport][queuesummary]',util[_0x6d48('0x43')](_0x527357,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x17')]=function(_0x5ec99d){logger['debug'](_0x6d48('0x72'),util[_0x6d48('0x43')](_0x5ec99d,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x6d48('0x39')]['syncQueueCallerJoin']=function(_0x36cd58){try{if(this['isNotNull'](_0x36cd58)){logger[_0x6d48('0x4b')](_0x6d48('0x73'),_0x36cd58[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x36cd58,{'showHidden':![],'depth':null}));if(_[_0x6d48('0x63')](this['queueReports'][_0x36cd58['uniqueid']])){this['queueReports'][_0x36cd58[_0x6d48('0x4d')]]=[];this['channels'][_0x36cd58[_0x6d48('0x4d')]]={};}var _0x4c934c=new QueueReport();_0x4c934c[_0x6d48('0x53')]=_0x36cd58[_0x6d48('0x68')];_0x4c934c['type']=this['voiceQueues'][_0x4c934c[_0x6d48('0x53')]]&&this['voiceQueues'][_0x4c934c['name']][_0x6d48('0x5c')]?this[_0x6d48('0x12')][_0x4c934c[_0x6d48('0x53')]][_0x6d48('0x5c')]||_0x6d48('0x74'):_0x6d48('0x74');_0x4c934c[_0x6d48('0x68')]=_0x36cd58['queue'];_0x4c934c['queuecallerjoinAt']=moment()[_0x6d48('0x4e')](_0x6d48('0x75'));_0x4c934c['position']=_0x36cd58['position'];_0x4c934c[_0x6d48('0x76')]=_0x36cd58[_0x6d48('0x76')];_0x4c934c[_0x6d48('0x4d')]=_0x36cd58[_0x6d48('0x4d')];logger['info'](_0x6d48('0x77'),_0x4c934c[_0x6d48('0x53')],_0x4c934c[_0x6d48('0x5c')]);_[_0x6d48('0x78')](_0x4c934c,_[_0x6d48('0x79')](_0x36cd58,_[_0x6d48('0x7a')](_0x4c934c)));this[_0x6d48('0xe')][_0x36cd58[_0x6d48('0x4d')]][_0x6d48('0x7b')](_0x4c934c);this[_0x6d48('0x10')][_0x36cd58[_0x6d48('0x4d')]]=_0x4c934c;this[_0x6d48('0x7c')](_0x4c934c,'queuecallerjoin');}}catch(_0x1353a5){logger[_0x6d48('0x41')]('[%s][voiceQueueReport][queuecallerjoin]',_0x36cd58['uniqueid'],util[_0x6d48('0x43')](_0x1353a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x1c')]=function(_0x136358){try{if(this[_0x6d48('0x67')](_0x136358)){logger[_0x6d48('0x4b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x136358[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x136358,{'showHidden':![],'depth':null}));if(this[_0x6d48('0xe')][_0x136358[_0x6d48('0x4d')]]){var _0x117b2b=_[_0x6d48('0x7d')](this[_0x6d48('0xe')][_0x136358[_0x6d48('0x4d')]]);_0x117b2b[_0x6d48('0x7e')]=![];_0x117b2b[_0x6d48('0x7f')]=null;_0x117b2b['holdtime']=_0x136358[_0x6d48('0x80')];_0x117b2b['originalposition']=_0x136358[_0x6d48('0x81')];_0x117b2b[_0x6d48('0x1b')]=!![];_0x117b2b[_0x6d48('0x82')]=moment()[_0x6d48('0x4e')](_0x6d48('0x75'));_0x117b2b[_0x6d48('0x83')]=_0x6d48('0x84');_0x117b2b[_0x6d48('0x85')]=null;logger[_0x6d48('0x86')](_0x6d48('0x87'),_0x117b2b[_0x6d48('0x53')],_0x117b2b[_0x6d48('0x5c')]);this['channels'][_0x136358[_0x6d48('0x4d')]]=_0x117b2b;this[_0x6d48('0x51')](_0x117b2b,_0x6d48('0x1b'));}}}catch(_0x12cf88){logger[_0x6d48('0x41')](_0x6d48('0x88'),_0x136358[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x12cf88,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x1e')]=function(_0x1e4e4f){try{if(this[_0x6d48('0x67')](_0x1e4e4f)){logger[_0x6d48('0x4b')]('[%s][voiceQueueReport][queuecallerleave]',_0x1e4e4f[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x1e4e4f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1e4e4f[_0x6d48('0x4d')]]){var _0x3bff43=_[_0x6d48('0x7d')](this['queueReports'][_0x1e4e4f[_0x6d48('0x4d')]]);_0x3bff43[_0x6d48('0x89')]=moment()[_0x6d48('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bff43['connectedlinenum']=_0x1e4e4f['connectedlinenum'];_0x3bff43[_0x6d48('0x8a')]=_0x1e4e4f[_0x6d48('0x8a')];logger[_0x6d48('0x86')](_0x6d48('0x8b'),_0x3bff43[_0x6d48('0x53')],_0x3bff43[_0x6d48('0x5c')],_0x1e4e4f[_0x6d48('0x8c')],_0x1e4e4f[_0x6d48('0x8a')]);this[_0x6d48('0x10')][_0x1e4e4f[_0x6d48('0x4d')]]=_0x3bff43;this[_0x6d48('0x7c')](_0x3bff43,'queuecallerleave');}}}catch(_0x500078){logger[_0x6d48('0x41')](_0x6d48('0x8d'),_0x1e4e4f[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x500078,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')]['syncAgentConnect']=function(_0x363fed){try{if(this['isNotNull'](_0x363fed)){logger['debug'](_0x6d48('0x8e'),_0x363fed['uniqueid'],util[_0x6d48('0x43')](_0x363fed,{'showHidden':![],'depth':null}));if(this[_0x6d48('0xe')][_0x363fed['uniqueid']]){var _0x1e8b79=_[_0x6d48('0x7d')](this[_0x6d48('0xe')][_0x363fed[_0x6d48('0x4d')]]);_0x1e8b79[_0x6d48('0x7e')]=!![];_0x1e8b79[_0x6d48('0x83')]='COMPLETEDBYAGENT';logger[_0x6d48('0x86')](_0x6d48('0x8f'),_0x1e8b79[_0x6d48('0x53')],_0x1e8b79[_0x6d48('0x5c')]);}}}catch(_0x48fc51){logger[_0x6d48('0x41')](_0x6d48('0x8e'),_0x363fed[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x48fc51,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x20')]=function(_0x1d2dc5){try{if(this[_0x6d48('0x67')](_0x1d2dc5)){logger['debug'](_0x6d48('0x90'),_0x1d2dc5[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x1d2dc5,{'showHidden':![],'depth':null}));if(this[_0x6d48('0xe')][_0x1d2dc5[_0x6d48('0x4d')]]){var _0x50ce9a=_[_0x6d48('0x7d')](this[_0x6d48('0xe')][_0x1d2dc5[_0x6d48('0x4d')]]);_0x50ce9a[_0x6d48('0x1b')]=![];_0x50ce9a[_0x6d48('0x82')]=null;_0x50ce9a[_0x6d48('0x91')]=!![];_0x50ce9a['lastAssignedTo']=_0x1d2dc5[_0x6d48('0x92')];_0x50ce9a['holdtime']=_0x1d2dc5[_0x6d48('0x80')];_0x50ce9a[_0x6d48('0x7e')]=!![];_0x50ce9a[_0x6d48('0x93')]=![];_0x50ce9a['queuecallerexitAt']=null;if(!_0x50ce9a['transfer']){if(_0x1d2dc5[_0x6d48('0x94')]==_0x6d48('0x95')){_0x50ce9a[_0x6d48('0x83')]=_0x6d48('0x96');logger[_0x6d48('0x86')](_0x6d48('0x97'),_0x50ce9a[_0x6d48('0x53')],_0x50ce9a[_0x6d48('0x5c')]);}else{if(_[_0x6d48('0x98')](_0x1d2dc5['channel']['toLowerCase'](),_0x6d48('0x99'))){if(this[_0x6d48('0xe')][_0x1d2dc5['linkedid']]){var _0xf3440b=_[_0x6d48('0x7d')](this[_0x6d48('0xe')][_0x1d2dc5[_0x6d48('0x9a')]]);_0xf3440b[_0x6d48('0x7e')]=![];_0xf3440b[_0x6d48('0x93')]=!![];_0xf3440b[_0x6d48('0x9b')]=moment(_0x50ce9a[_0x6d48('0x9c')])[_0x6d48('0x9d')](_0x1d2dc5[_0x6d48('0x80')],'seconds')[_0x6d48('0x4e')](_0x6d48('0x75'));_0xf3440b['queuecallerexitreason']=_0x6d48('0x9e');_0xf3440b[_0x6d48('0x95')]=!![];_0xf3440b[_0x6d48('0x9f')]=_0x6d48('0xa0');_0xf3440b[_0x6d48('0xa1')]=_0x1d2dc5[_0x6d48('0xa2')];_0xf3440b[_0x6d48('0xa3')]=_0x1d2dc5[_0x6d48('0x4d')];logger[_0x6d48('0x86')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0xf3440b[_0x6d48('0x53')],_0xf3440b['type']);var _0x35dbf2=this[_0x6d48('0xe')][_0x1d2dc5[_0x6d48('0x9a')]];this[_0x6d48('0xe')][_0x1d2dc5['linkedid']]=this[_0x6d48('0xe')][_0x1d2dc5[_0x6d48('0x4d')]];this['queueReports'][_0x1d2dc5[_0x6d48('0x4d')]]=_0x35dbf2;}}else{_0x50ce9a[_0x6d48('0x83')]='COMPLETEDBY'+_0x1d2dc5[_0x6d48('0x94')][_0x6d48('0xa4')]();logger[_0x6d48('0x86')](_0x6d48('0xa5'),_0x50ce9a['name'],_0x50ce9a[_0x6d48('0x5c')],_0x50ce9a[_0x6d48('0x83')]);}}}this[_0x6d48('0x10')][_0x1d2dc5[_0x6d48('0x4d')]]=_0x50ce9a;this['emitVoiceQueueChannelRemove'](_0x50ce9a,_0x6d48('0x1f'));}}}catch(_0x41cd92){logger[_0x6d48('0x41')]('[%s][voiceQueueReport][agentcomplete]',_0x1d2dc5['uniqueid'],util[_0x6d48('0x43')](_0x41cd92,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x23')]=function(_0x253925){try{if(this['isNotNull'](_0x253925)){logger[_0x6d48('0x4b')](_0x6d48('0xa6'),_0x253925[_0x6d48('0x4d')],util['inspect'](_0x253925,{'showHidden':![],'depth':null}));this[_0x6d48('0xa7')](_0x253925[_0x6d48('0x4d')],_[_0x6d48('0x7a')](_0x253925[_0x6d48('0xa8')])[0x0],_0x253925[_0x6d48('0xa9')]);if(this[_0x6d48('0xe')][_0x253925[_0x6d48('0x4d')]]){var _0x551938=_[_0x6d48('0x7d')](this[_0x6d48('0xe')][_0x253925['uniqueid']]);if(_0x551938){if(this['isNotNull'](_0x253925[_0x6d48('0xa8')])&&this[_0x6d48('0x67')](_0x253925['variable'][_0x6d48('0xaa')])){switch(_0x253925[_0x6d48('0xa9')]){case _0x6d48('0xab'):_0x551938[_0x6d48('0x93')]=![];_0x551938[_0x6d48('0x9b')]=null;break;case _0x6d48('0xac'):_0x551938[_0x6d48('0xad')]=_0x6d48('0xae');_0x551938['queuecallerexit']=!![];_0x551938[_0x6d48('0x9b')]=moment()[_0x6d48('0x4e')](_0x6d48('0x75'));_0x551938[_0x6d48('0x89')]=moment()[_0x6d48('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x6d48('0x4b')](_0x6d48('0xaf'),_0x253925[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x551938,{'showHidden':![],'depth':null}));ami[_0x6d48('0x4a')]('custom:timeout',_0x551938);break;default:_0x551938[_0x6d48('0x93')]=!![];_0x551938[_0x6d48('0x9b')]=moment()[_0x6d48('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x551938[_0x6d48('0x89')]=moment()[_0x6d48('0x4e')](_0x6d48('0x75'));}_0x551938['queuecallerabandon']=![];_0x551938[_0x6d48('0x82')]=null;_0x551938[_0x6d48('0x83')]=_0x253925[_0x6d48('0xa9')];this[_0x6d48('0x10')][_0x253925[_0x6d48('0x4d')]]=_0x551938;this['emitVoiceQueueChannelRemove'](_0x551938,_0x6d48('0x22'));}else if(this[_0x6d48('0x67')](_0x253925['variable'])&&this[_0x6d48('0x67')](_0x253925[_0x6d48('0xa8')][_0x6d48('0xb0')])){if(!_0x551938[_0x6d48('0x1b')]){_0x551938[_0x6d48('0x93')]=!![];_0x551938['queuecallerexitAt']=moment()[_0x6d48('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x551938[_0x6d48('0x83')]='EXITWITHKEY';_0x551938[_0x6d48('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x253925[_0x6d48('0x4d')]]=_0x551938;}}logger['info'](_0x6d48('0xb1'),_0x253925[_0x6d48('0x4d')],_0x551938[_0x6d48('0x53')],_0x551938['type'],_[_0x6d48('0x7a')](_0x253925[_0x6d48('0xa8')])[0x0],_0x253925[_0x6d48('0xa9')]);_0x551938[_0x6d48('0x45')]=this['variables'][_0x253925['uniqueid']];}}}}catch(_0x24556f){logger['error'](_0x6d48('0xa6'),_0x253925[_0x6d48('0x4d')],util['inspect'](_0x24556f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0xa7')]=function(_0x1aefe4,_0x1f0272,_0x4961fe){var _0x375ef3=[_0x6d48('0xb2'),'rtpaudioqosbridged',_0x6d48('0xb3'),_0x6d48('0xb4'),_0x6d48('0xb5'),_0x6d48('0xb6'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x6d48('0xb7'),_0x6d48('0xb8'),'bridgepeer','bridgepvtcallid',_0x6d48('0xb9'),'memberdynamic',_0x6d48('0xba'),'memberlastcall','membername',_0x6d48('0xbb'),_0x6d48('0xbc')];if(!_['isNil'](_0x1f0272)&&!_[_0x6d48('0xbd')](_0x375ef3,_0x1f0272)){if(_[_0x6d48('0x63')](this[_0x6d48('0x45')][_0x1aefe4])){this[_0x6d48('0x45')][_0x1aefe4]={};}this[_0x6d48('0x45')][_0x1aefe4][_0x1f0272]=_0x4961fe;}};VoiceQueueReport[_0x6d48('0x39')]['syncHangup']=function(_0x5f4632){try{if(this[_0x6d48('0x67')](_0x5f4632)){logger['debug'](_0x6d48('0xbe'),_0x5f4632[_0x6d48('0x4d')],util['inspect'](_0x5f4632,{'showHidden':![],'depth':null}));if(this[_0x6d48('0xe')][_0x5f4632[_0x6d48('0x4d')]]){for(var _0x534580=0x0,_0x5a6745={};_0x5345800x0?_0x2b15a1:0x0;this[_0x56a2('0xd')][_0x18a810[_0x56a2('0x60')]][_0x56a2('0x2b')]=this[_0x56a2('0xd')][_0x18a810[_0x56a2('0x60')]]['talking']>_[_0x56a2('0x65')](_0x18a810[_0x56a2('0x68')])?_[_0x56a2('0x65')](_0x18a810[_0x56a2('0x68')]):this[_0x56a2('0xd')][_0x18a810[_0x56a2('0x60')]][_0x56a2('0x2b')];this[_0x56a2('0x4c')](this[_0x56a2('0xd')][_0x18a810[_0x56a2('0x60')]],'queuesummary');}logger[_0x56a2('0x42')](_0x56a2('0x69'),util[_0x56a2('0x3a')](this['voiceQueues'][_0x18a810[_0x56a2('0x60')]],{'showHidden':![],'depth':null}));ami[_0x56a2('0x40')](_0x56a2('0x6a'),this[_0x56a2('0xd')][_0x18a810[_0x56a2('0x60')]]);}}}catch(_0x155375){logger[_0x56a2('0x39')](_0x56a2('0x5f'),util[_0x56a2('0x3a')](_0x155375,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x56a2('0x2f')]['syncQueueSummaryComplete']=function(_0x3499ea){logger[_0x56a2('0x42')](_0x56a2('0x6b'),util[_0x56a2('0x3a')](_0x3499ea,{'showHidden':![],'depth':null}));this[_0x56a2('0xe')]=!![];};VoiceQueueReport[_0x56a2('0x2f')][_0x56a2('0x16')]=function(_0x27b268){try{if(this[_0x56a2('0x5b')](_0x27b268)){logger[_0x56a2('0x42')]('[%s][voiceQueueReport][queuecallerjoin]',_0x27b268[_0x56a2('0x45')],util[_0x56a2('0x3a')](_0x27b268,{'showHidden':![],'depth':null}));if(_[_0x56a2('0x5c')](this['queueReports'][_0x27b268[_0x56a2('0x45')]])){this[_0x56a2('0x9')][_0x27b268[_0x56a2('0x45')]]=[];this[_0x56a2('0xb')][_0x27b268[_0x56a2('0x45')]]={};}var _0x1a73f4=new QueueReport();_0x1a73f4[_0x56a2('0x4a')]=_0x27b268[_0x56a2('0x60')];_0x1a73f4[_0x56a2('0x4d')]=this[_0x56a2('0xd')][_0x1a73f4[_0x56a2('0x4a')]]&&this[_0x56a2('0xd')][_0x1a73f4[_0x56a2('0x4a')]]['type']?this['voiceQueues'][_0x1a73f4[_0x56a2('0x4a')]][_0x56a2('0x4d')]||_0x56a2('0x4e'):_0x56a2('0x4e');_0x1a73f4['queue']=_0x27b268[_0x56a2('0x60')];_0x1a73f4[_0x56a2('0x6c')]=moment()[_0x56a2('0x46')](_0x56a2('0x6d'));_0x1a73f4['position']=_0x27b268[_0x56a2('0x6e')];_0x1a73f4[_0x56a2('0x6f')]=_0x27b268[_0x56a2('0x6f')];_0x1a73f4[_0x56a2('0x45')]=_0x27b268[_0x56a2('0x45')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x1a73f4[_0x56a2('0x4a')],_0x1a73f4[_0x56a2('0x4d')]);_[_0x56a2('0x70')](_0x1a73f4,_[_0x56a2('0x71')](_0x27b268,_[_0x56a2('0x72')](_0x1a73f4)));this['queueReports'][_0x27b268[_0x56a2('0x45')]][_0x56a2('0x73')](_0x1a73f4);this[_0x56a2('0xb')][_0x27b268[_0x56a2('0x45')]]=_0x1a73f4;this[_0x56a2('0x41')](_0x1a73f4,'queuecallerjoin');}}catch(_0x3e96ea){logger['error'](_0x56a2('0x74'),_0x27b268[_0x56a2('0x45')],util[_0x56a2('0x3a')](_0x3e96ea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x56a2('0x2f')][_0x56a2('0x17')]=function(_0x54ff68){try{if(this['isNotNull'](_0x54ff68)){logger[_0x56a2('0x42')](_0x56a2('0x75'),_0x54ff68['uniqueid'],util[_0x56a2('0x3a')](_0x54ff68,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x54ff68['uniqueid']]){var _0x97c260=_[_0x56a2('0x76')](this[_0x56a2('0x9')][_0x54ff68[_0x56a2('0x45')]]);_0x97c260['queuecallercomplete']=![];_0x97c260['queuecallercompleteAt']=null;_0x97c260[_0x56a2('0x77')]=_0x54ff68[_0x56a2('0x77')];_0x97c260[_0x56a2('0x78')]=_0x54ff68[_0x56a2('0x78')];_0x97c260[_0x56a2('0x79')]=!![];_0x97c260[_0x56a2('0x7a')]=moment()[_0x56a2('0x46')](_0x56a2('0x6d'));_0x97c260['queuecallerexitreason']=_0x56a2('0x7b');_0x97c260[_0x56a2('0x7c')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x97c260[_0x56a2('0x4a')],_0x97c260[_0x56a2('0x4d')]);this[_0x56a2('0xb')][_0x54ff68[_0x56a2('0x45')]]=_0x97c260;this[_0x56a2('0x3e')](_0x97c260,_0x56a2('0x79'));}}}catch(_0x214666){logger[_0x56a2('0x39')]('[%s][voiceQueueReport][queuecallerabandon]',_0x54ff68[_0x56a2('0x45')],util[_0x56a2('0x3a')](_0x214666,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x56a2('0x2f')]['syncQueueCallerLeave']=function(_0x405859){try{if(this[_0x56a2('0x5b')](_0x405859)){logger['debug'](_0x56a2('0x7d'),_0x405859['uniqueid'],util[_0x56a2('0x3a')](_0x405859,{'showHidden':![],'depth':null}));if(this[_0x56a2('0x9')][_0x405859['uniqueid']]){var _0xa9cd4a=_[_0x56a2('0x76')](this[_0x56a2('0x9')][_0x405859['uniqueid']]);_0xa9cd4a[_0x56a2('0x7e')]=moment()[_0x56a2('0x46')](_0x56a2('0x6d'));_0xa9cd4a[_0x56a2('0x7f')]=_0x405859[_0x56a2('0x7f')];_0xa9cd4a[_0x56a2('0x80')]=_0x405859[_0x56a2('0x80')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xa9cd4a[_0x56a2('0x4a')],_0xa9cd4a[_0x56a2('0x4d')],_0x405859[_0x56a2('0x7f')],_0x405859[_0x56a2('0x80')]);this[_0x56a2('0xb')][_0x405859[_0x56a2('0x45')]]=_0xa9cd4a;this[_0x56a2('0x41')](_0xa9cd4a,'queuecallerleave');}}}catch(_0x56d052){logger[_0x56a2('0x39')]('[%s][voiceQueueReport][queuecallerleave]',_0x405859['uniqueid'],util[_0x56a2('0x3a')](_0x56d052,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x56a2('0x2f')]['syncAgentConnect']=function(_0x472bb0){try{if(this[_0x56a2('0x5b')](_0x472bb0)){logger[_0x56a2('0x42')](_0x56a2('0x81'),_0x472bb0['uniqueid'],util['inspect'](_0x472bb0,{'showHidden':![],'depth':null}));if(this[_0x56a2('0x9')][_0x472bb0[_0x56a2('0x45')]]){var _0x139617=_['last'](this['queueReports'][_0x472bb0[_0x56a2('0x45')]]);_0x139617[_0x56a2('0x82')]=!![];_0x139617['queuecallerexitreason']=_0x56a2('0x83');logger[_0x56a2('0x61')](_0x56a2('0x84'),_0x139617[_0x56a2('0x4a')],_0x139617[_0x56a2('0x4d')]);}}}catch(_0x361425){logger['error'](_0x56a2('0x81'),_0x472bb0[_0x56a2('0x45')],util[_0x56a2('0x3a')](_0x361425,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x56a2('0x19')]=function(_0x381129){try{if(this[_0x56a2('0x5b')](_0x381129)){logger[_0x56a2('0x42')](_0x56a2('0x85'),_0x381129[_0x56a2('0x45')],util[_0x56a2('0x3a')](_0x381129,{'showHidden':![],'depth':null}));if(this[_0x56a2('0x9')][_0x381129[_0x56a2('0x45')]]){var _0x2cf4eb=_['last'](this[_0x56a2('0x9')][_0x381129[_0x56a2('0x45')]]);_0x2cf4eb[_0x56a2('0x79')]=![];_0x2cf4eb[_0x56a2('0x7a')]=null;_0x2cf4eb[_0x56a2('0x86')]=!![];_0x2cf4eb['lastAssignedTo']=_0x381129[_0x56a2('0x87')];_0x2cf4eb[_0x56a2('0x77')]=_0x381129['holdtime'];_0x2cf4eb[_0x56a2('0x82')]=!![];_0x2cf4eb['queuecallerexit']=![];_0x2cf4eb[_0x56a2('0x88')]=null;if(!_0x2cf4eb[_0x56a2('0x89')]){if(_0x381129[_0x56a2('0x8a')]==_0x56a2('0x89')){_0x2cf4eb[_0x56a2('0x8b')]=_0x56a2('0x8c');logger['info'](_0x56a2('0x8d'),_0x2cf4eb[_0x56a2('0x4a')],_0x2cf4eb[_0x56a2('0x4d')]);}else{if(_[_0x56a2('0x8e')](_0x381129[_0x56a2('0x35')]['toLowerCase'](),_0x56a2('0x8f'))){if(this[_0x56a2('0x9')][_0x381129[_0x56a2('0x90')]]){var _0x1cdb16=_[_0x56a2('0x76')](this[_0x56a2('0x9')][_0x381129[_0x56a2('0x90')]]);_0x1cdb16['queuecallercomplete']=![];_0x1cdb16[_0x56a2('0x91')]=!![];_0x1cdb16['queuecallerexitAt']=moment(_0x2cf4eb[_0x56a2('0x6c')])['add'](_0x381129[_0x56a2('0x77')],_0x56a2('0x92'))[_0x56a2('0x46')](_0x56a2('0x6d'));_0x1cdb16[_0x56a2('0x8b')]='FORWARDTRANSFER';_0x1cdb16[_0x56a2('0x89')]=!![];_0x1cdb16[_0x56a2('0x93')]=_0x56a2('0x94');_0x1cdb16[_0x56a2('0x95')]=_0x381129['destexten'];_0x1cdb16[_0x56a2('0x96')]=_0x381129[_0x56a2('0x45')];logger[_0x56a2('0x61')](_0x56a2('0x97'),_0x1cdb16[_0x56a2('0x4a')],_0x1cdb16[_0x56a2('0x4d')]);var _0x1a097f=this[_0x56a2('0x9')][_0x381129[_0x56a2('0x90')]];this[_0x56a2('0x9')][_0x381129[_0x56a2('0x90')]]=this[_0x56a2('0x9')][_0x381129[_0x56a2('0x45')]];this[_0x56a2('0x9')][_0x381129[_0x56a2('0x45')]]=_0x1a097f;}}else{_0x2cf4eb[_0x56a2('0x8b')]=_0x56a2('0x98')+_0x381129['reason'][_0x56a2('0x99')]();logger[_0x56a2('0x61')](_0x56a2('0x9a'),_0x2cf4eb[_0x56a2('0x4a')],_0x2cf4eb[_0x56a2('0x4d')],_0x2cf4eb['queuecallerexitreason']);}}}this[_0x56a2('0xb')][_0x381129[_0x56a2('0x45')]]=_0x2cf4eb;this[_0x56a2('0x3e')](_0x2cf4eb,_0x56a2('0x9b'));}}}catch(_0x32ac22){logger[_0x56a2('0x39')](_0x56a2('0x85'),_0x381129['uniqueid'],util[_0x56a2('0x3a')](_0x32ac22,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x56a2('0x2f')]['syncVarSet']=function(_0x581470){try{if(this[_0x56a2('0x5b')](_0x581470)){logger['debug'](_0x56a2('0x9c'),_0x581470[_0x56a2('0x45')],util[_0x56a2('0x3a')](_0x581470,{'showHidden':![],'depth':null}));this[_0x56a2('0x9d')](_0x581470[_0x56a2('0x45')],_['keys'](_0x581470[_0x56a2('0x9e')])[0x0],_0x581470[_0x56a2('0x9f')]);if(this['queueReports'][_0x581470[_0x56a2('0x45')]]){var _0x3362f2=_[_0x56a2('0x76')](this[_0x56a2('0x9')][_0x581470[_0x56a2('0x45')]]);if(_0x3362f2){if(this['isNotNull'](_0x581470[_0x56a2('0x9e')])&&this[_0x56a2('0x5b')](_0x581470[_0x56a2('0x9e')]['queuestatus'])){switch(_0x581470[_0x56a2('0x9f')]){case _0x56a2('0xa0'):_0x3362f2[_0x56a2('0x91')]=![];_0x3362f2[_0x56a2('0x88')]=null;break;case _0x56a2('0xa1'):_0x3362f2['lastevent']=_0x56a2('0xa2');_0x3362f2[_0x56a2('0x91')]=!![];_0x3362f2['queuecallerexitAt']=moment()[_0x56a2('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x3362f2[_0x56a2('0x7e')]=moment()[_0x56a2('0x46')](_0x56a2('0x6d'));logger[_0x56a2('0x42')](_0x56a2('0xa3'),_0x581470[_0x56a2('0x45')],util[_0x56a2('0x3a')](_0x3362f2,{'showHidden':![],'depth':null}));ami[_0x56a2('0x40')](_0x56a2('0xa4'),_0x3362f2);break;default:_0x3362f2[_0x56a2('0x91')]=!![];_0x3362f2[_0x56a2('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3362f2[_0x56a2('0x7e')]=moment()[_0x56a2('0x46')](_0x56a2('0x6d'));}_0x3362f2[_0x56a2('0x79')]=![];_0x3362f2[_0x56a2('0x7a')]=null;_0x3362f2[_0x56a2('0x8b')]=_0x581470['value'];this[_0x56a2('0xb')][_0x581470[_0x56a2('0x45')]]=_0x3362f2;this[_0x56a2('0x3e')](_0x3362f2,'varset');}else if(this[_0x56a2('0x5b')](_0x581470[_0x56a2('0x9e')])&&this[_0x56a2('0x5b')](_0x581470[_0x56a2('0x9e')][_0x56a2('0xa5')])){if(!_0x3362f2[_0x56a2('0x79')]){_0x3362f2['queuecallerexit']=!![];_0x3362f2[_0x56a2('0x88')]=moment()[_0x56a2('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x3362f2[_0x56a2('0x8b')]='EXITWITHKEY';_0x3362f2[_0x56a2('0x7e')]=moment()[_0x56a2('0x46')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x56a2('0xb')][_0x581470[_0x56a2('0x45')]]=_0x3362f2;}}logger[_0x56a2('0x61')](_0x56a2('0xa6'),_0x581470[_0x56a2('0x45')],_0x3362f2[_0x56a2('0x4a')],_0x3362f2[_0x56a2('0x4d')],_['keys'](_0x581470[_0x56a2('0x9e')])[0x0],_0x581470['value']);_0x3362f2[_0x56a2('0x10')]=this[_0x56a2('0x10')][_0x581470[_0x56a2('0x45')]];}}}}catch(_0x2a8916){logger[_0x56a2('0x39')](_0x56a2('0x9c'),_0x581470[_0x56a2('0x45')],util['inspect'](_0x2a8916,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x56a2('0x2f')][_0x56a2('0x9d')]=function(_0x215545,_0x20ae1e,_0x2f6ee3){var _0x1119b5=[_0x56a2('0xa7'),_0x56a2('0xa8'),_0x56a2('0xa9'),'rtpaudioqosjitterbridged',_0x56a2('0xaa'),_0x56a2('0xab'),'rtpaudioqosrtt',_0x56a2('0xac'),_0x56a2('0xad'),'sipuri','bridgepeer',_0x56a2('0xae'),_0x56a2('0xaf'),_0x56a2('0xb0'),_0x56a2('0xb1'),_0x56a2('0xb2'),_0x56a2('0x87'),_0x56a2('0xb3'),_0x56a2('0xb4')];if(!_['isNil'](_0x20ae1e)&&!_[_0x56a2('0xb5')](_0x1119b5,_0x20ae1e)){if(_['isUndefined'](this['variables'][_0x215545])){this[_0x56a2('0x10')][_0x215545]={};}this[_0x56a2('0x10')][_0x215545][_0x20ae1e]=_0x2f6ee3;}};VoiceQueueReport[_0x56a2('0x2f')][_0x56a2('0x1d')]=function(_0x2a5ad4){try{if(this[_0x56a2('0x5b')](_0x2a5ad4)){logger['debug'](_0x56a2('0xb6'),_0x2a5ad4[_0x56a2('0x45')],util[_0x56a2('0x3a')](_0x2a5ad4,{'showHidden':![],'depth':null}));if(this[_0x56a2('0x9')][_0x2a5ad4['uniqueid']]){for(var _0x22f90f=0x0,_0x5b8833={};_0x22f90f=0x0?moment(_0x254f14[_0x00d9('0x16')])[_0x00d9('0xd')](_0x254f14['starttime'],_0x00d9('0x17')):null,'data1':'outbound','data2':_0x254f14['accountcode'],'data3':_0x254f14[_0x00d9('0x18')],'data4':_0x254f14[_0x00d9('0x19')]||null,'role':_0x00d9('0x10'),'internal':_0x254f14[_0x00d9('0x11')]?_[_0x00d9('0x12')](_0x254f14['accountcode']):undefined,'uniqueid':_0x254f14[_0x00d9('0x13')]},'log':_0x00d9('0x7')});}; \ No newline at end of file +var _0x9237=['CreateMemberReport','lastAssignedTo','interface','format','SIP/%s','diff','queuecallerleaveAt','inbound','exten','queue','accountcode','toNumber','uniqueid','voiceDialReport','voice','TALKING','starttime','endtime','seconds','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9237,0x11a));var _0x7923=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0x9237[_0x45b1ba];return _0x145ddb;};'use strict';var moment=require(_0x7923('0x0'));var _=require(_0x7923('0x1'));var util=require(_0x7923('0x2'));var client=require(_0x7923('0x3'));exports[_0x7923('0x4')]=function(_0x38f851){var _0x53fdde=_0x38f851[_0x7923('0x5')]||_0x38f851[_0x7923('0x6')];return client[_0x7923('0x7')](_0x7923('0x8'),{'body':{'channel':'voice','membername':_0x38f851[_0x7923('0x9')],'interface':_['isNil'](_0x38f851[_0x7923('0xa')])?util[_0x7923('0xb')](_0x7923('0xc'),_0x38f851[_0x7923('0x9')]):_0x38f851[_0x7923('0xa')],'type':'TALKING','enterAt':_0x38f851['queuecallerleaveAt'],'exitAt':_0x53fdde,'duration':moment(_0x53fdde)[_0x7923('0xd')](_0x38f851[_0x7923('0xe')],'seconds'),'data1':_0x7923('0xf'),'data2':_0x38f851['calleridnum'],'data3':_0x38f851[_0x7923('0x10')],'data4':null,'data5':_0x38f851[_0x7923('0x11')],'role':'agent','internal':_0x38f851[_0x7923('0x12')]?_[_0x7923('0x13')](_0x38f851[_0x7923('0x12')]):undefined,'uniqueid':_0x38f851[_0x7923('0x14')]},'log':'CreateMemberReport'});};exports[_0x7923('0x15')]=function(_0x5e7280){return client['Request'](_0x7923('0x8'),{'body':{'channel':_0x7923('0x16'),'membername':_0x5e7280['membername'],'interface':_0x5e7280[_0x7923('0xa')],'type':_0x7923('0x17'),'enterAt':_0x5e7280[_0x7923('0x18')],'exitAt':_0x5e7280[_0x7923('0x19')],'duration':moment(_0x5e7280[_0x7923('0x19')])[_0x7923('0xd')](_0x5e7280['starttime'],_0x7923('0x1a'))>=0x0?moment(_0x5e7280[_0x7923('0x19')])[_0x7923('0xd')](_0x5e7280[_0x7923('0x18')],_0x7923('0x1a')):null,'data1':_0x7923('0x1b'),'data2':_0x5e7280['accountcode'],'data3':_0x5e7280[_0x7923('0x10')],'data4':_0x5e7280[_0x7923('0x1c')]||null,'role':'agent','internal':_0x5e7280['accountcode']?_['toNumber'](_0x5e7280[_0x7923('0x12')]):undefined,'uniqueid':_0x5e7280['uniqueid']},'log':_0x7923('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 09f7775..de7a1d5 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 _0x57f8=['GetTemplate','name','html','getTemplates','Request'];(function(_0x414bcd,_0x5e88b5){var _0x9ca809=function(_0x2ec505){while(--_0x2ec505){_0x414bcd['push'](_0x414bcd['shift']());}};_0x9ca809(++_0x5e88b5);}(_0x57f8,0x198));var _0x857f=function(_0x17d713,_0x19b690){_0x17d713=_0x17d713-0x0;var _0x452666=_0x57f8[_0x17d713];return _0x452666;};'use strict';var client=require('../client');exports[_0x857f('0x0')]=function(_0x57a538){return function(_0x1e6e52){return client[_0x857f('0x1')](_0x857f('0x2'),{'options':{'raw':!![],'attributes':['id',_0x857f('0x3'),_0x857f('0x4')]},'log':_0x857f('0x2')});};}; \ No newline at end of file +var _0xb49a=['html','../client','getTemplates','Request','name'];(function(_0x45f1aa,_0x502ef4){var _0x130fa0=function(_0x4b2cff){while(--_0x4b2cff){_0x45f1aa['push'](_0x45f1aa['shift']());}};_0x130fa0(++_0x502ef4);}(_0xb49a,0xfb));var _0xab49=function(_0x2f430a,_0x46d370){_0x2f430a=_0x2f430a-0x0;var _0x10def3=_0xb49a[_0x2f430a];return _0x10def3;};'use strict';var client=require(_0xab49('0x0'));exports[_0xab49('0x1')]=function(_0x217cf4){return function(_0x1d512a){return client[_0xab49('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xab49('0x3'),_0xab49('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index f2bb6dd..f36a63c 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 _0x4b4e=['operator','value','AnyConditions','Action','Actions','action','data2','data3','data4','data5','getTriggers','Request','GetTrigger','name','channel','Condition','field'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x4b4e,0x81));var _0xe4b4=function(_0x486d9a,_0x34e400){_0x486d9a=_0x486d9a-0x0;var _0x46f0be=_0x4b4e[_0x486d9a];return _0x46f0be;};'use strict';var client=require('../client');exports[_0xe4b4('0x0')]=function(_0x4e1ff6){return function(_0x58ed52){return client[_0xe4b4('0x1')](_0xe4b4('0x2'),{'options':{'raw':![],'attributes':['id',_0xe4b4('0x3'),_0xe4b4('0x4'),'status'],'include':[{'model':_0xe4b4('0x5'),'as':'AllConditions','attributes':['id',_0xe4b4('0x6'),_0xe4b4('0x7'),_0xe4b4('0x8')]},{'model':_0xe4b4('0x5'),'as':_0xe4b4('0x9'),'attributes':['id',_0xe4b4('0x6'),'operator','value']},{'model':_0xe4b4('0xa'),'as':_0xe4b4('0xb'),'attributes':['id',_0xe4b4('0xc'),'data1',_0xe4b4('0xd'),_0xe4b4('0xe'),_0xe4b4('0xf'),_0xe4b4('0x10'),'data6','data7']}]},'log':_0xe4b4('0x2')});};}; \ No newline at end of file +var _0x3479=['GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','Action','Actions','action','data2','data3','data4','data5','data7','Request'];(function(_0x3be24a,_0x382ffb){var _0x344d93=function(_0x47f552){while(--_0x47f552){_0x3be24a['push'](_0x3be24a['shift']());}};_0x344d93(++_0x382ffb);}(_0x3479,0x18b));var _0x9347=function(_0x39d024,_0x5c5797){_0x39d024=_0x39d024-0x0;var _0x311bdd=_0x3479[_0x39d024];return _0x311bdd;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x21fb92){return function(_0x300626){return client[_0x9347('0x0')](_0x9347('0x1'),{'options':{'raw':![],'attributes':['id',_0x9347('0x2'),_0x9347('0x3'),_0x9347('0x4')],'include':[{'model':_0x9347('0x5'),'as':_0x9347('0x6'),'attributes':['id',_0x9347('0x7'),_0x9347('0x8'),'value']},{'model':_0x9347('0x5'),'as':'AnyConditions','attributes':['id','field','operator',_0x9347('0x9')]},{'model':_0x9347('0xa'),'as':_0x9347('0xb'),'attributes':['id',_0x9347('0xc'),'data1',_0x9347('0xd'),_0x9347('0xe'),_0x9347('0xf'),_0x9347('0x10'),'data6',_0x9347('0x11')]}]},'log':_0x9347('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 7ad714c..6190d27 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 _0xb3a0=['GetTrunk','name','registry'];(function(_0x215499,_0xc2ac8b){var _0x4724d2=function(_0x3b66d7){while(--_0x3b66d7){_0x215499['push'](_0x215499['shift']());}};_0x4724d2(++_0xc2ac8b);}(_0xb3a0,0xa3));var _0x0b3a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb3a0[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x37304c){return function(_0x2b4589){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x0b3a('0x0'),_0x0b3a('0x1')]},'log':_0x0b3a('0x2')});};}; \ No newline at end of file +var _0xe6da=['GetTrunk','../client','Request','name','registry'];(function(_0x5b04a3,_0xfda4fd){var _0x1adf11=function(_0x9e242a){while(--_0x9e242a){_0x5b04a3['push'](_0x5b04a3['shift']());}};_0x1adf11(++_0xfda4fd);}(_0xe6da,0x137));var _0xae6d=function(_0x66f22c,_0xb987a7){_0x66f22c=_0x66f22c-0x0;var _0x4aaf31=_0xe6da[_0x66f22c];return _0x4aaf31;};'use strict';var client=require(_0xae6d('0x0'));exports['getTrunks']=function(_0x201aef){return function(_0x315389){return client[_0xae6d('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xae6d('0x2'),_0xae6d('0x3')]},'log':_0xae6d('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index a413c38..06a85ff 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 _0xd84c=['getAgents','getTelephones','Request','name','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','../client','GetUser','agent','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xd84c,0xec));var _0xcd84=function(_0x214f81,_0x560be6){_0x214f81=_0x214f81-0x0;var _0x5e5ae3=_0xd84c[_0x214f81];return _0x5e5ae3;};'use strict';var client=require(_0xcd84('0x0'));exports['getAgents']=function(){return function(){return client['Request'](_0xcd84('0x1'),{'options':{'raw':![],'where':{'role':_0xcd84('0x2')},'attributes':['id','name',_0xcd84('0x3'),_0xcd84('0x4'),_0xcd84('0x5'),_0xcd84('0x6'),_0xcd84('0x7'),_0xcd84('0x8'),_0xcd84('0x9'),_0xcd84('0xa'),_0xcd84('0xb'),_0xcd84('0xc'),_0xcd84('0xd')]},'log':_0xcd84('0xe')});};};exports[_0xcd84('0xf')]=function(){return function(){return client[_0xcd84('0x10')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0xcd84('0x11'),_0xcd84('0x4'),_0xcd84('0x12')]},'log':_0xcd84('0xf')});};};exports[_0xcd84('0x13')]=function(_0x26c9ac,_0x5c29e7,_0x20e12c){return client['Request'](_0xcd84('0x14'),{'body':{'type':_0x5c29e7,'uniqueid':_0x20e12c},'options':{'where':{'id':_0x26c9ac['id']}},'log':'savePause'});};exports[_0xcd84('0x15')]=function(_0x4e294b){return client[_0xcd84('0x10')](_0xcd84('0x16'),{'body':{},'options':{'where':{'id':_0x4e294b['id']}},'log':'savePause'});};exports[_0xcd84('0x17')]=function(_0x2d6190){return client[_0xcd84('0x10')](_0xcd84('0x18'),{'options':{'raw':![],'where':{'role':_0xcd84('0x2'),'id':_0x2d6190},'attributes':['id',_0xcd84('0x11'),_0xcd84('0x3'),_0xcd84('0x4'),_0xcd84('0x5'),_0xcd84('0x6'),'lastLoginAt',_0xcd84('0x8'),'lastPauseAt',_0xcd84('0xa'),_0xcd84('0xd')]},'log':_0xcd84('0x17')});}; \ No newline at end of file +var _0x21e4=['savePause','PauseUser','ShowUser','email','lastLoginAt','getAgent','../client','getAgents','GetUser','agent','accountcode','fullname','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','Request','name','internal'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x21e4,0x1aa));var _0x421e=function(_0x53b395,_0x140b5a){_0x53b395=_0x53b395-0x0;var _0x5f0fea=_0x21e4[_0x53b395];return _0x5f0fea;};'use strict';var client=require(_0x421e('0x0'));exports[_0x421e('0x1')]=function(){return function(){return client['Request'](_0x421e('0x2'),{'options':{'raw':![],'where':{'role':_0x421e('0x3')},'attributes':['id','name','email',_0x421e('0x4'),_0x421e('0x5'),'online','lastLoginAt','pauseType',_0x421e('0x6'),_0x421e('0x7'),_0x421e('0x8'),_0x421e('0x9'),_0x421e('0xa')]},'log':_0x421e('0x1')});};};exports[_0x421e('0xb')]=function(){return function(){return client[_0x421e('0xc')](_0x421e('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x421e('0xd'),_0x421e('0x4'),_0x421e('0xe')]},'log':_0x421e('0xb')});};};exports[_0x421e('0xf')]=function(_0x118320,_0x569524,_0x5cf9b0){return client[_0x421e('0xc')](_0x421e('0x10'),{'body':{'type':_0x569524,'uniqueid':_0x5cf9b0},'options':{'where':{'id':_0x118320['id']}},'log':'savePause'});};exports['saveUnpause']=function(_0x6f1b51){return client[_0x421e('0xc')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x6f1b51['id']}},'log':_0x421e('0xf')});};exports['getAgent']=function(_0x59b2b3){return client[_0x421e('0xc')](_0x421e('0x11'),{'options':{'raw':![],'where':{'role':'agent','id':_0x59b2b3},'attributes':['id',_0x421e('0xd'),_0x421e('0x12'),_0x421e('0x4'),_0x421e('0x5'),'online',_0x421e('0x13'),'pauseType',_0x421e('0x6'),_0x421e('0x7'),'interface']},'log':_0x421e('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 8beeb22..9aba3f9 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 _0xf8c7=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x10aa73,_0xc744f4){var _0x3496d9=function(_0x71c780){while(--_0x71c780){_0x10aa73['push'](_0x10aa73['shift']());}};_0x3496d9(++_0xc744f4);}(_0xf8c7,0x110));var _0x7f8c=function(_0x455839,_0x261111){_0x455839=_0x455839-0x0;var _0x1e2e80=_0xf8c7[_0x455839];return _0x1e2e80;};'use strict';var client=require(_0x7f8c('0x0'));exports[_0x7f8c('0x1')]=function(_0x249f23){return client[_0x7f8c('0x2')]('CreateVoiceAgentReport',{'body':_0x249f23,'log':_0x7f8c('0x3')});};exports[_0x7f8c('0x4')]=function(_0x37652e,_0x1fef72,_0x565bc0){return client[_0x7f8c('0x2')](_0x7f8c('0x5'),{'body':_0x37652e,'options':{'where':{'uniqueid':_0x1fef72,'interface':_0x565bc0,'agentcomplete':!![]}},'log':_0x7f8c('0x5')});}; \ No newline at end of file +var _0x9099=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','Request'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9099,0x1ac));var _0x9909=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x9099[_0x3635ce];return _0x97ecd0;};'use strict';var client=require(_0x9909('0x0'));exports['create']=function(_0x24fb7c){return client[_0x9909('0x1')](_0x9909('0x2'),{'body':_0x24fb7c,'log':_0x9909('0x2')});};exports[_0x9909('0x3')]=function(_0x34aabc,_0x2168ff,_0x6eb0ac){return client[_0x9909('0x1')](_0x9909('0x4'),{'body':_0x34aabc,'options':{'where':{'uniqueid':_0x2168ff,'interface':_0x6eb0ac,'agentcomplete':!![]}},'log':_0x9909('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index e2d3b27..88a08d5 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 _0xb62a=['YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','CreateVoiceCallReport','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format'];(function(_0x47e824,_0xbb033e){var _0x1d4497=function(_0xa075ea){while(--_0xa075ea){_0x47e824['push'](_0x47e824['shift']());}};_0x1d4497(++_0xbb033e);}(_0xb62a,0xc4));var _0xab62=function(_0x1691dc,_0x5ded3e){_0x1691dc=_0x1691dc-0x0;var _0x2b1eab=_0xb62a[_0x1691dc];return _0x2b1eab;};'use strict';var moment=require(_0xab62('0x0'));var util=require(_0xab62('0x1'));var _=require(_0xab62('0x2'));var client=require(_0xab62('0x3'));exports['create']=function(_0x5cdefb){return client['Request'](_0xab62('0x4'),{'body':_['merge'](_0x5cdefb,{'source':_0x5cdefb[_0xab62('0x5')],'destinationcontext':_0x5cdefb[_0xab62('0x6')],'callerid':_0x5cdefb['callerid'],'amaflags':_0xab62('0x7')}),'log':_0xab62('0x4')});};exports[_0xab62('0x8')]=function(){return function(){return client['Request'](_0xab62('0x9'),{'options':{'where':{'type':[_0xab62('0xa')],'createdAt':{'$between':[moment()[_0xab62('0xb')](_0xab62('0xc'))[_0xab62('0xd')](_0xab62('0xe')),moment()[_0xab62('0xf')](_0xab62('0xc'))[_0xab62('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xab62('0x10'),_0xab62('0x11'),_0xab62('0x12'),_0xab62('0x13')]},'log':_0xab62('0x14')});};}; \ No newline at end of file +var _0x9bd7=['type','disposition','GetVoiceCallReports','util','lodash','create','Request','CreateVoiceCallReport','merge','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x557bf4,_0x1f8dad){var _0x2916e2=function(_0x4fef9b){while(--_0x4fef9b){_0x557bf4['push'](_0x557bf4['shift']());}};_0x2916e2(++_0x1f8dad);}(_0x9bd7,0x75));var _0x79bd=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9bd7[_0xbca1b1];return _0x4e1686;};'use strict';var moment=require('moment');var util=require(_0x79bd('0x0'));var _=require(_0x79bd('0x1'));var client=require('../client');exports[_0x79bd('0x2')]=function(_0x26b048){return client[_0x79bd('0x3')](_0x79bd('0x4'),{'body':_[_0x79bd('0x5')](_0x26b048,{'source':_0x26b048['calleridnum'],'destinationcontext':_0x26b048['context'],'callerid':_0x26b048[_0x79bd('0x6')],'amaflags':_0x79bd('0x7')}),'log':_0x79bd('0x4')});};exports[_0x79bd('0x8')]=function(){return function(){return client['Request'](_0x79bd('0x9'),{'options':{'where':{'type':[_0x79bd('0xa')],'createdAt':{'$between':[moment()[_0x79bd('0xb')](_0x79bd('0xc'))[_0x79bd('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x79bd('0xe')](_0x79bd('0xc'))['format'](_0x79bd('0xf'))]}},'attributes':[_0x79bd('0x10'),_0x79bd('0x11'),'duration','billableseconds']},'log':_0x79bd('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index ebf588d..a0e7f29 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 _0x9f5e=['../client','create','Request','CreateVoiceDialReport'];(function(_0x502e76,_0x4f21ae){var _0x3c42c8=function(_0x2f1cf0){while(--_0x2f1cf0){_0x502e76['push'](_0x502e76['shift']());}};_0x3c42c8(++_0x4f21ae);}(_0x9f5e,0x1d8));var _0xe9f5=function(_0x45f4e3,_0x157a21){_0x45f4e3=_0x45f4e3-0x0;var _0x446259=_0x9f5e[_0x45f4e3];return _0x446259;};'use strict';var client=require(_0xe9f5('0x0'));exports[_0xe9f5('0x1')]=function(_0x265fbc){return client[_0xe9f5('0x2')](_0xe9f5('0x3'),{'body':_0x265fbc,'log':_0xe9f5('0x3')});}; \ No newline at end of file +var _0x62f5=['create','Request','CreateVoiceDialReport','../client'];(function(_0x461b18,_0x4f8313){var _0x5ceae2=function(_0x5a8f33){while(--_0x5a8f33){_0x461b18['push'](_0x461b18['shift']());}};_0x5ceae2(++_0x4f8313);}(_0x62f5,0xdf));var _0x562f=function(_0x28793d,_0x14f80a){_0x28793d=_0x28793d-0x0;var _0x54a14a=_0x62f5[_0x28793d];return _0x54a14a;};'use strict';var client=require(_0x562f('0x0'));exports[_0x562f('0x1')]=function(_0x46ceaf){return client[_0x562f('0x2')](_0x562f('0x3'),{'body':_0x46ceaf,'log':_0x562f('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 685e478..96abed0 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 _0x317b=['getVoiceExtensions','GetVoiceExtension','exten','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x317b,0x1c7));var _0xb317=function(_0x2b2a52,_0x4b6e5d){_0x2b2a52=_0x2b2a52-0x0;var _0x5d592d=_0x317b[_0x2b2a52];return _0x5d592d;};'use strict';var client=require(_0xb317('0x0'));exports[_0xb317('0x1')]=function(){return function(){return client['Request'](_0xb317('0x2'),{'options':{'raw':!![],'attributes':['id',_0xb317('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xb317('0x1')});};}; \ No newline at end of file +var _0x617f=['GetVoiceExtension','exten','getVoiceExtensions','Request'];(function(_0x333e57,_0xfc6624){var _0x433104=function(_0x42501b){while(--_0x42501b){_0x333e57['push'](_0x333e57['shift']());}};_0x433104(++_0xfc6624);}(_0x617f,0x15e));var _0xf617=function(_0x316aa6,_0x2717cd){_0x316aa6=_0x316aa6-0x0;var _0x5c6a8d=_0x617f[_0x316aa6];return _0x5c6a8d;};'use strict';var client=require('../client');exports[_0xf617('0x0')]=function(){return function(){return client[_0xf617('0x1')](_0xf617('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf617('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xf617('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 1e50c62..8409b8a 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 _0x7bc0=['dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7bc0,0x9c));var _0x07bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bc0[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x07bc('0x0'));exports[_0x07bc('0x1')]=function(){return function(){return client[_0x07bc('0x2')](_0x07bc('0x3'),{'options':{'raw':![],'attributes':['id','name','acw',_0x07bc('0x4'),_0x07bc('0x5'),_0x07bc('0x6'),_0x07bc('0x7'),_0x07bc('0x8'),_0x07bc('0x9'),_0x07bc('0xa'),_0x07bc('0xb'),_0x07bc('0xc'),_0x07bc('0xd'),'dialPredictiveOptimizationPercentage',_0x07bc('0xe'),_0x07bc('0xf'),_0x07bc('0x10'),_0x07bc('0x11'),_0x07bc('0x12'),_0x07bc('0x13'),_0x07bc('0x14'),_0x07bc('0x15'),_0x07bc('0x16'),'dialBusyMaxRetry',_0x07bc('0x17'),_0x07bc('0x18'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x07bc('0x19'),_0x07bc('0x1a'),_0x07bc('0x1b'),_0x07bc('0x1c'),_0x07bc('0x1d'),_0x07bc('0x1e'),_0x07bc('0x1f'),'dialAMDAfterGreetingSilence',_0x07bc('0x20'),_0x07bc('0x21'),'dialAMDBetweenWordsSilence',_0x07bc('0x22'),_0x07bc('0x23'),_0x07bc('0x24'),_0x07bc('0x25'),_0x07bc('0x26'),_0x07bc('0x27'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x07bc('0x28'),'dialQueueProject2',_0x07bc('0x6'),_0x07bc('0x29'),'dialRandomLastDigitCallerIdNumber',_0x07bc('0x2a'),_0x07bc('0x2b'),'dialNoSuchNumberRetryFrequency',_0x07bc('0x2c'),_0x07bc('0x2d'),_0x07bc('0x2e'),_0x07bc('0x2f'),'dialMachineMaxRetry',_0x07bc('0x30'),_0x07bc('0x31'),_0x07bc('0x32'),_0x07bc('0x33'),_0x07bc('0x34'),_0x07bc('0x35')],'include':[{'model':_0x07bc('0x36'),'as':_0x07bc('0x36'),'attributes':['id',_0x07bc('0x37'),_0x07bc('0x38'),_0x07bc('0x39')]},{'model':_0x07bc('0x3a'),'as':_0x07bc('0x3b'),'attributes':['id',_0x07bc('0x37')]},{'model':_0x07bc('0x36'),'as':_0x07bc('0x3c'),'attributes':['id','name','callerid',_0x07bc('0x39')]},{'model':_0x07bc('0x3d'),'as':_0x07bc('0x3d'),'attributes':['id','name'],'include':[{'model':_0x07bc('0x3d'),'as':_0x07bc('0x3e'),'attributes':['id','name',_0x07bc('0x3f')]}]}]},'log':_0x07bc('0x1')});};}; \ No newline at end of file +var _0xaabb=['dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','mandatoryDispositionPause','callerid','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x42db76,_0x5eb897){var _0x265e06=function(_0x56919b){while(--_0x56919b){_0x42db76['push'](_0x42db76['shift']());}};_0x265e06(++_0x5eb897);}(_0xaabb,0xc4));var _0xbaab=function(_0x3a3a6a,_0x5eb6a9){_0x3a3a6a=_0x3a3a6a-0x0;var _0xa89294=_0xaabb[_0x3a3a6a];return _0xa89294;};'use strict';var client=require(_0xbaab('0x0'));exports[_0xbaab('0x1')]=function(){return function(){return client[_0xbaab('0x2')](_0xbaab('0x3'),{'options':{'raw':![],'attributes':['id',_0xbaab('0x4'),_0xbaab('0x5'),_0xbaab('0x6'),_0xbaab('0x7'),_0xbaab('0x8'),_0xbaab('0x9'),_0xbaab('0xa'),'dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization',_0xbaab('0xb'),_0xbaab('0xc'),'dialOriginateCallerIdName',_0xbaab('0xd'),_0xbaab('0xe'),_0xbaab('0xf'),_0xbaab('0x10'),_0xbaab('0x11'),_0xbaab('0x12'),_0xbaab('0x13'),'dialBusyMaxRetry',_0xbaab('0x14'),'dialNoAnswerMaxRetry',_0xbaab('0x15'),'dialGlobalMaxRetry',_0xbaab('0x16'),'dialGlobalInterval','dialPrefix',_0xbaab('0x17'),_0xbaab('0x18'),_0xbaab('0x19'),_0xbaab('0x1a'),_0xbaab('0x1b'),_0xbaab('0x1c'),_0xbaab('0x1d'),'dialAMDBetweenWordsSilence',_0xbaab('0x1e'),_0xbaab('0x1f'),_0xbaab('0x20'),_0xbaab('0x21'),_0xbaab('0x22'),_0xbaab('0x23'),_0xbaab('0x24'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0xbaab('0x25'),_0xbaab('0x8'),_0xbaab('0x26'),'dialRandomLastDigitCallerIdNumber',_0xbaab('0x27'),'dialNoSuchNumberMaxRetry',_0xbaab('0x28'),_0xbaab('0x29'),'dialDropRetryFrequency',_0xbaab('0x2a'),_0xbaab('0x2b'),'dialMachineMaxRetry',_0xbaab('0x2c'),_0xbaab('0x2d'),'dialAgentRejectRetryFrequency',_0xbaab('0x2e'),_0xbaab('0x2f'),_0xbaab('0x30')],'include':[{'model':_0xbaab('0x31'),'as':_0xbaab('0x31'),'attributes':['id',_0xbaab('0x4'),'callerid',_0xbaab('0x32')]},{'model':_0xbaab('0x33'),'as':_0xbaab('0x34'),'attributes':['id',_0xbaab('0x4')]},{'model':_0xbaab('0x31'),'as':'TrunkBackup','attributes':['id',_0xbaab('0x4'),_0xbaab('0x35'),_0xbaab('0x32')]},{'model':_0xbaab('0x36'),'as':'Interval','attributes':['id',_0xbaab('0x4')],'include':[{'model':'Interval','as':_0xbaab('0x37'),'attributes':['id','name',_0xbaab('0x38')]}]}]},'log':_0xbaab('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 149a9b8..d4636d8 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 _0x4874=['Request','CreateVoiceQueueReport','GetVoiceQueueReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','../client','create'];(function(_0x714308,_0x1e1bce){var _0x54db09=function(_0x5edc16){while(--_0x5edc16){_0x714308['push'](_0x714308['shift']());}};_0x54db09(++_0x1e1bce);}(_0x4874,0x12a));var _0x4487=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x4874[_0xc0a3d3];return _0x3386e8;};'use strict';var moment=require('moment');var _=require('lodash');var client=require(_0x4487('0x0'));exports[_0x4487('0x1')]=function(_0x3f51e7){return client[_0x4487('0x2')](_0x4487('0x3'),{'body':_0x3f51e7,'log':_0x4487('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client['Request'](_0x4487('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x4487('0x5')](_0x4487('0x6'))[_0x4487('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x4487('0x8')](_0x4487('0x6'))[_0x4487('0x7')](_0x4487('0x9'))]}},'attributes':[_0x4487('0xa'),_0x4487('0xb'),_0x4487('0xc'),_0x4487('0xd'),_0x4487('0xe'),_0x4487('0xf'),_0x4487('0x10'),_0x4487('0x11'),_0x4487('0x12'),_0x4487('0x13')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xbc7a=['queuecallerabandon','GetVoiceQueueReports','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x1bbed,_0x1642a3){var _0x344d85=function(_0x4b069b){while(--_0x4b069b){_0x1bbed['push'](_0x1bbed['shift']());}};_0x344d85(++_0x1642a3);}(_0xbc7a,0xa4));var _0xabc7=function(_0x958cb3,_0x535409){_0x958cb3=_0x958cb3-0x0;var _0x444383=_0xbc7a[_0x958cb3];return _0x444383;};'use strict';var moment=require(_0xabc7('0x0'));var _=require(_0xabc7('0x1'));var client=require(_0xabc7('0x2'));exports['create']=function(_0x283673){return client[_0xabc7('0x3')](_0xabc7('0x4'),{'body':_0x283673,'log':_0xabc7('0x4')});};exports[_0xabc7('0x5')]=function(){return function(){return client[_0xabc7('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xabc7('0x6')](_0xabc7('0x7'))[_0xabc7('0x8')](_0xabc7('0x9')),moment()[_0xabc7('0xa')](_0xabc7('0x7'))['format'](_0xabc7('0x9'))]}},'attributes':['uniqueid',_0xabc7('0xb'),_0xabc7('0xc'),_0xabc7('0xd'),_0xabc7('0xe'),_0xabc7('0xf'),'queuecallerexit','queuecallerexitAt',_0xabc7('0x10'),'queuecallerabandonAt']},'log':_0xabc7('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index d9a344a..fbd0612 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 _0x1243=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x1243,0xa0));var _0x3124=function(_0x46a6f9,_0x50203c){_0x46a6f9=_0x46a6f9-0x0;var _0x17084a=_0x1243[_0x46a6f9];return _0x17084a;};'use strict';var client=require('../client');exports[_0x3124('0x0')]=function(_0x1a6df3){return function(){return client[_0x3124('0x1')](_0x3124('0x2'),{'options':{'where':{'VoiceQueueId':_0x1a6df3,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x369a=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x293ad7,_0x3757df){var _0x5a6318=function(_0x491684){while(--_0x491684){_0x293ad7['push'](_0x293ad7['shift']());}};_0x5a6318(++_0x3757df);}(_0x369a,0x16a));var _0xa369=function(_0x32ff17,_0xa84cc0){_0x32ff17=_0x32ff17-0x0;var _0x25d9bd=_0x369a[_0x32ff17];return _0x25d9bd;};'use strict';var client=require(_0xa369('0x0'));exports[_0xa369('0x1')]=function(_0x22c1cb){return function(){return client[_0xa369('0x2')](_0xa369('0x3'),{'options':{'where':{'VoiceQueueId':_0x22c1cb,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 4720a47..8637f0d 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 _0xaebd=['lodash','create','CreateVoiceRecording','merge'];(function(_0x1de6d1,_0x455da7){var _0x391dce=function(_0x424c20){while(--_0x424c20){_0x1de6d1['push'](_0x1de6d1['shift']());}};_0x391dce(++_0x455da7);}(_0xaebd,0x18c));var _0xdaeb=function(_0x1953ba,_0x328bc2){_0x1953ba=_0x1953ba-0x0;var _0x514132=_0xaebd[_0x1953ba];return _0x514132;};'use strict';var _=require(_0xdaeb('0x0'));var client=require('../client');exports[_0xdaeb('0x1')]=function(_0x34dd41){return client['Request'](_0xdaeb('0x2'),{'body':_[_0xdaeb('0x3')](_0x34dd41,{'value':_0x34dd41['monitorFilename']}),'log':_0xdaeb('0x2')});}; \ No newline at end of file +var _0x10dd=['monitorFilename','lodash','create','CreateVoiceRecording'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x10dd,0x18d));var _0xd10d=function(_0x46e21b,_0x346a63){_0x46e21b=_0x46e21b-0x0;var _0x584dc0=_0x10dd[_0x46e21b];return _0x584dc0;};'use strict';var _=require(_0xd10d('0x0'));var client=require('../client');exports[_0xd10d('0x1')]=function(_0x1b0481){return client['Request'](_0xd10d('0x2'),{'body':_['merge'](_0x1b0481,{'value':_0x1b0481[_0xd10d('0x3')]}),'log':_0xd10d('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index f1d68f4..8510d1b 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 _0xe945=['transfertargetcalleridname','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','transfers','blindTransfer','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','transfertargetcalleridnum'];(function(_0x4b0eab,_0x4862cb){var _0x373dd3=function(_0x4a81ed){while(--_0x4a81ed){_0x4b0eab['push'](_0x4b0eab['shift']());}};_0x373dd3(++_0x4862cb);}(_0xe945,0xf0));var _0x5e94=function(_0x1a70c0,_0x1bd82b){_0x1a70c0=_0x1a70c0-0x0;var _0x9f7333=_0xe945[_0x1a70c0];return _0x9f7333;};'use strict';var client=require('../client');exports[_0x5e94('0x0')]={};exports[_0x5e94('0x1')]=function(_0x582100){return client[_0x5e94('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x582100[_0x5e94('0x3')],'transfererchannel':_0x582100['transfererchannel'],'transferercalleridnum':_0x582100[_0x5e94('0x4')],'transferercalleridname':_0x582100[_0x5e94('0x5')],'transfererconnectedlinenum':_0x582100[_0x5e94('0x6')],'transfererconnectedlinename':_0x582100[_0x5e94('0x7')],'transfereraccountcode':_0x582100[_0x5e94('0x8')],'transferercontext':_0x582100[_0x5e94('0x9')],'transfererexten':_0x582100[_0x5e94('0xa')],'transfererlinkedid':_0x582100[_0x5e94('0xb')],'transfereechannel':_0x582100[_0x5e94('0xc')],'transfereecalleridnum':_0x582100[_0x5e94('0xd')],'transfereecalleridname':_0x582100[_0x5e94('0xe')],'transfereeconnectedlinenum':_0x582100[_0x5e94('0xf')],'transfereeconnectedlinename':_0x582100[_0x5e94('0x10')],'transfereeaccountcode':_0x582100[_0x5e94('0x11')],'transfereecontext':_0x582100[_0x5e94('0x12')],'transfereeexten':_0x582100[_0x5e94('0x13')],'transfereelinkedid':_0x582100[_0x5e94('0x14')],'isexternal':_0x582100[_0x5e94('0x15')],'context':_0x582100[_0x5e94('0x16')],'extension':_0x582100[_0x5e94('0x17')],'type':_0x5e94('0x18')},'log':_0x5e94('0x19')});};exports[_0x5e94('0x1a')]=function(_0x3d2c06){return client[_0x5e94('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x3d2c06[_0x5e94('0x3')],'transfererchannel':_0x3d2c06[_0x5e94('0x1b')],'transferercalleridnum':_0x3d2c06[_0x5e94('0x1c')],'transferercalleridname':_0x3d2c06[_0x5e94('0x1d')],'transfererconnectedlinenum':_0x3d2c06['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3d2c06[_0x5e94('0x1e')],'transfereraccountcode':_0x3d2c06[_0x5e94('0x1f')],'transferercontext':_0x3d2c06['secondtransferercontext'],'transfererexten':_0x3d2c06['secondtransfererexten'],'transfererlinkedid':_0x3d2c06['origtransfererlinkedid'],'transfereechannel':_0x3d2c06['transfertargetchannel'],'transfereecalleridnum':_0x3d2c06[_0x5e94('0x20')],'transfereecalleridname':_0x3d2c06[_0x5e94('0x21')],'transfereeconnectedlinenum':_0x3d2c06['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3d2c06['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3d2c06['transfertargetaccountcode'],'transfereecontext':_0x3d2c06[_0x5e94('0x22')],'transfereeexten':_0x3d2c06[_0x5e94('0x23')],'transfereelinkedid':_0x3d2c06[_0x5e94('0x24')],'isexternal':_0x3d2c06['isexternal'],'context':_0x3d2c06[_0x5e94('0x25')],'extension':_0x3d2c06[_0x5e94('0x26')],'type':'attended'},'log':_0x5e94('0x19')});}; \ No newline at end of file +var _0xb151=['isexternal','origtransferercontext','origtransfererexten','attended','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','extension','blind','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid'];(function(_0x28a9da,_0x42a724){var _0xcc9b8d=function(_0x5d1b35){while(--_0x5d1b35){_0x28a9da['push'](_0x28a9da['shift']());}};_0xcc9b8d(++_0x42a724);}(_0xb151,0x7c));var _0x1b15=function(_0x584d0,_0x3dc0be){_0x584d0=_0x584d0-0x0;var _0x5dcf36=_0xb151[_0x584d0];return _0x5dcf36;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x1b15('0x0')]=function(_0xf606aa){return client[_0x1b15('0x1')](_0x1b15('0x2'),{'body':{'result':_0xf606aa[_0x1b15('0x3')],'transfererchannel':_0xf606aa[_0x1b15('0x4')],'transferercalleridnum':_0xf606aa[_0x1b15('0x5')],'transferercalleridname':_0xf606aa[_0x1b15('0x6')],'transfererconnectedlinenum':_0xf606aa[_0x1b15('0x7')],'transfererconnectedlinename':_0xf606aa['transfererconnectedlinename'],'transfereraccountcode':_0xf606aa['transfereraccountcode'],'transferercontext':_0xf606aa[_0x1b15('0x8')],'transfererexten':_0xf606aa[_0x1b15('0x9')],'transfererlinkedid':_0xf606aa[_0x1b15('0xa')],'transfereechannel':_0xf606aa[_0x1b15('0xb')],'transfereecalleridnum':_0xf606aa[_0x1b15('0xc')],'transfereecalleridname':_0xf606aa['transfereecalleridname'],'transfereeconnectedlinenum':_0xf606aa[_0x1b15('0xd')],'transfereeconnectedlinename':_0xf606aa[_0x1b15('0xe')],'transfereeaccountcode':_0xf606aa[_0x1b15('0xf')],'transfereecontext':_0xf606aa[_0x1b15('0x10')],'transfereeexten':_0xf606aa[_0x1b15('0x11')],'transfereelinkedid':_0xf606aa[_0x1b15('0x12')],'isexternal':_0xf606aa['isexternal'],'context':_0xf606aa['context'],'extension':_0xf606aa[_0x1b15('0x13')],'type':_0x1b15('0x14')},'log':'CreateVoiceTransferReport'});};exports[_0x1b15('0x15')]=function(_0x4d6c9f){return client[_0x1b15('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x4d6c9f[_0x1b15('0x3')],'transfererchannel':_0x4d6c9f['origtransfererchannel'],'transferercalleridnum':_0x4d6c9f['origtransferercalleridnum'],'transferercalleridname':_0x4d6c9f[_0x1b15('0x16')],'transfererconnectedlinenum':_0x4d6c9f[_0x1b15('0x17')],'transfererconnectedlinename':_0x4d6c9f[_0x1b15('0x18')],'transfereraccountcode':_0x4d6c9f[_0x1b15('0x19')],'transferercontext':_0x4d6c9f['secondtransferercontext'],'transfererexten':_0x4d6c9f[_0x1b15('0x1a')],'transfererlinkedid':_0x4d6c9f[_0x1b15('0x1b')],'transfereechannel':_0x4d6c9f[_0x1b15('0x1c')],'transfereecalleridnum':_0x4d6c9f[_0x1b15('0x1d')],'transfereecalleridname':_0x4d6c9f[_0x1b15('0x1e')],'transfereeconnectedlinenum':_0x4d6c9f[_0x1b15('0x1f')],'transfereeconnectedlinename':_0x4d6c9f['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4d6c9f[_0x1b15('0x20')],'transfereecontext':_0x4d6c9f[_0x1b15('0x21')],'transfereeexten':_0x4d6c9f[_0x1b15('0x22')],'transfereelinkedid':_0x4d6c9f[_0x1b15('0x23')],'isexternal':_0x4d6c9f[_0x1b15('0x24')],'context':_0x4d6c9f[_0x1b15('0x25')],'extension':_0x4d6c9f[_0x1b15('0x26')],'type':_0x1b15('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index fb4d638..6f40087 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 _0xebcc=['event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','validate','bluebird','../properties','../ami','listen','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','join','pick','keys','module','action','Reload','Action','then','catch','error','message','isConnected','ami\x20disconnected','command','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','values','channels','voicechannel','length','map','find','uniqueid','channel','format','%s.%s','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','campaigns','run'];(function(_0x4b03c6,_0x3a9381){var _0x4bb581=function(_0x243b05){while(--_0x243b05){_0x4b03c6['push'](_0x4b03c6['shift']());}};_0x4bb581(++_0x3a9381);}(_0xebcc,0x96));var _0xcebc=function(_0x3716c8,_0xa1ab08){_0x3716c8=_0x3716c8-0x0;var _0x541202=_0xebcc[_0x3716c8];return _0x541202;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0xcebc('0x0'));var schema=require(_0xcebc('0x1'));var BPromise=require(_0xcebc('0x2'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0xcebc('0x3'));var ami=require(_0xcebc('0x4'));exports[_0xcebc('0x5')]=function(_0x55fd3a,_0x1b28e5,_0x4ae14f){return new BPromise(function(_0x3ccbfc,_0x3aa7a8){var _0x25d789={'QueuePause':function(_0x54b21f){return new Promise(function(_0x234fe4,_0x507dd5){var _0x1572f5=util['format'](_0xcebc('0x6'),_0xcebc('0x7'),_0x54b21f[_0xcebc('0x8')]);if(_0x55fd3a['timers']&&_0x55fd3a[_0xcebc('0x9')][_0x1572f5]&&_0x55fd3a['timers'][_0x1572f5]['timer']){_0x55fd3a[_0xcebc('0x9')][_0x1572f5][_0xcebc('0xa')]();}if(_0x55fd3a[_0xcebc('0xb')][_0x1572f5]){_0x55fd3a[_0xcebc('0xb')][_0x1572f5][_0xcebc('0xc')]({'statePause':_0x54b21f[_0xcebc('0xd')]?!![]:![]});}_0x234fe4({'code':0xc8,'message':_0xcebc('0xe')});});},'Reload':function(_0x4085d0){var _0x4928bb=this;return new Promise(function(_0x553048,_0x246325){if(ami['isConnected']()==![]){return _0x246325(_0x4928bb['error'](0x1f4,[config[_0xcebc('0xf')]['ip'],config[_0xcebc('0xf')][_0xcebc('0x10')],'ami\x20disconnected'][_0xcebc('0x11')]('\x20')));}_0x4085d0=_[_0xcebc('0x12')](_0x4085d0,_[_0xcebc('0x13')](properties[_0xcebc('0x14')]));_0x4085d0[_0xcebc('0x15')]=_0xcebc('0x16');return ami[_0xcebc('0x17')](_0x4085d0)[_0xcebc('0x18')](function(_0x291439){_0x553048({'code':0xc8,'message':_0x291439['message']});})[_0xcebc('0x19')](function(_0x221faa){_0x246325(_0x4928bb[_0xcebc('0x1a')](0x1f5,_0x221faa[_0xcebc('0x1b')]));});});},'Command':function(_0x49b67e){var _0x53dfda=this;return new Promise(function(_0x176250,_0x20f98a){if(ami[_0xcebc('0x1c')]()==![]){return _0x20f98a(_0x53dfda[_0xcebc('0x1a')](0x1f4,[config[_0xcebc('0xf')]['ip'],config[_0xcebc('0xf')]['username'],_0xcebc('0x1d')][_0xcebc('0x11')]('\x20')));}_0x49b67e=_['pick'](_0x49b67e,_0xcebc('0x1e'));_0x49b67e[_0xcebc('0x15')]=_0xcebc('0x1f');return ami[_0xcebc('0x17')](_0x49b67e)['then'](function(_0x4eeb29){_0x176250({'code':0xc8,'message':_0x4eeb29[_0xcebc('0x20')]});})[_0xcebc('0x19')](function(_0x31c556){_0x20f98a(_0x53dfda['error'](0x1f5,_0x31c556['message']));});});},'VoiceQueues':function(_0xc6df85){return new Promise(function(_0x29176b,_0x48b403){var _0x32e461=[];for(var _0x5d945f in _0x55fd3a[_0xcebc('0x21')]){if(_0x55fd3a[_0xcebc('0x21')][_0xcebc('0x22')](_0x5d945f)){var _0x47463d=_0x55fd3a[_0xcebc('0x21')][_0x5d945f];var _0x57a4fd={'id':_0x47463d['id'],'name':_0x47463d[_0xcebc('0x8')],'strategy':_0x47463d[_0xcebc('0x23')],'answered':_0x47463d[_0xcebc('0x24')],'available':_0x47463d[_0xcebc('0x25')],'loggedIn':_0x47463d[_0xcebc('0x26')],'pTalking':_0x47463d[_0xcebc('0x27')],'sumBillable':_0x47463d[_0xcebc('0x28')],'sumDuration':_0x47463d[_0xcebc('0x29')],'sumHoldTime':_0x47463d[_0xcebc('0x2a')]||0x0,'talking':_0x47463d[_0xcebc('0x2b')],'total':_0x47463d[_0xcebc('0x2c')],'type':_0x47463d[_0xcebc('0x2d')],'unmanaged':_0x47463d[_0xcebc('0x2e')],'abandoned':_0x47463d['abandoned'],'waiting':_0x47463d['waiting'],'loggedInDb':_0x47463d[_0xcebc('0x2f')]};if(_0x47463d['type']===_0xcebc('0x30')){_0x57a4fd[_0xcebc('0x31')]=_0x47463d['dialActive'];_0x57a4fd[_0xcebc('0x32')]=_0x47463d[_0xcebc('0x32')];_0x57a4fd[_0xcebc('0x33')]=_0x47463d[_0xcebc('0x33')];_0x57a4fd[_0xcebc('0x34')]=_0x47463d[_0xcebc('0x34')];_0x57a4fd[_0xcebc('0x35')]=_0x47463d[_0xcebc('0x35')];_0x57a4fd[_0xcebc('0x36')]=_0x47463d[_0xcebc('0x36')];_0x57a4fd[_0xcebc('0x37')]=_0x47463d[_0xcebc('0x37')];_0x57a4fd[_0xcebc('0x38')]=_0x47463d[_0xcebc('0x38')];_0x57a4fd[_0xcebc('0x39')]=_0x47463d[_0xcebc('0x39')];_0x57a4fd[_0xcebc('0x3a')]=_0x47463d[_0xcebc('0x3a')];_0x57a4fd[_0xcebc('0x3b')]=_0x47463d[_0xcebc('0x3b')];_0x57a4fd[_0xcebc('0x3c')]=_0x47463d[_0xcebc('0x3c')];_0x57a4fd[_0xcebc('0x3d')]=_0x47463d[_0xcebc('0x3d')];_0x57a4fd[_0xcebc('0x3e')]=_0x47463d[_0xcebc('0x3e')];_0x57a4fd[_0xcebc('0x3f')]=_0x47463d['outboundNoAnswerCallsDay'];_0x57a4fd[_0xcebc('0x40')]=_0x47463d[_0xcebc('0x40')];_0x57a4fd[_0xcebc('0x41')]=_0x47463d[_0xcebc('0x41')];_0x57a4fd[_0xcebc('0x42')]=_0x47463d[_0xcebc('0x42')];_0x57a4fd[_0xcebc('0x43')]=_0x47463d[_0xcebc('0x43')];_0x57a4fd[_0xcebc('0x44')]=_0x47463d['outboundUnknownCallsDay'];_0x57a4fd['predictiveIntervalAnsweredCalls']=_0x47463d['predictiveIntervalAnsweredCalls'];_0x57a4fd[_0xcebc('0x45')]=_0x47463d[_0xcebc('0x45')];_0x57a4fd[_0xcebc('0x46')]=_0x47463d['predictiveIntervalAvgTalktime'];_0x57a4fd[_0xcebc('0x47')]=_0x47463d[_0xcebc('0x47')];_0x57a4fd[_0xcebc('0x48')]=_0x47463d[_0xcebc('0x48')];_0x57a4fd[_0xcebc('0x49')]=_0x47463d[_0xcebc('0x49')];_0x57a4fd[_0xcebc('0x4a')]=_0x47463d[_0xcebc('0x4a')];_0x57a4fd['predictiveIntervalHitRate']=_0x47463d['predictiveIntervalHitRate'];_0x57a4fd['predictiveIntervalMultiplicativeFactor']=_0x47463d['predictiveIntervalMultiplicativeFactor'];_0x57a4fd[_0xcebc('0x4b')]=_0x47463d[_0xcebc('0x4b')];_0x57a4fd[_0xcebc('0x4c')]=_0x47463d['predictiveIntervalAvailable'];_0x57a4fd[_0xcebc('0x4d')]=_0x47463d[_0xcebc('0x4d')];_0x57a4fd[_0xcebc('0x1b')]=_0x47463d[_0xcebc('0x1b')];_0x57a4fd[_0xcebc('0x4e')]=_0x47463d[_0xcebc('0x4e')];_0x57a4fd[_0xcebc('0x4f')]=_0x47463d[_0xcebc('0x4f')];_0x57a4fd[_0xcebc('0x50')]=_0x47463d[_0xcebc('0x50')];_0x57a4fd[_0xcebc('0x51')]=_0x47463d[_0xcebc('0x51')];_0x57a4fd['erlangBusyFactor']=_0x47463d[_0xcebc('0x52')];_0x57a4fd[_0xcebc('0x53')]=_0x47463d[_0xcebc('0x53')];_0x57a4fd[_0xcebc('0x54')]=_0x47463d['startProgressive'];}if(_0x47463d[_0xcebc('0x55')]){_0x57a4fd[_0xcebc('0x55')]={'id':_0x47463d['Trunk']['id'],'name':_0x47463d[_0xcebc('0x55')]['name'],'active':_0x47463d[_0xcebc('0x55')][_0xcebc('0x56')],'callerid':_0x47463d[_0xcebc('0x55')][_0xcebc('0x57')]};}if(_0x47463d[_0xcebc('0x58')]){_0x57a4fd[_0xcebc('0x58')]={'id':_0x47463d[_0xcebc('0x58')]['id'],'name':_0x47463d[_0xcebc('0x58')]['name']};}_0x32e461[_0xcebc('0x59')](_0x57a4fd);}}_0x29176b({'count':_0x32e461['length'],'rows':_0x32e461});});},'VoiceChannels':function(_0x3c5fbe){return new Promise(function(_0x3687bb,_0x1535a8){var _0x516e83=_[_0xcebc('0x5a')](_0x55fd3a[_0xcebc('0x5b')]);_0x3687bb({'count':_0x516e83['length'],'rows':_0x516e83});});},'VoiceChannelMixMonitor':function(_0x30b0ca){var _0x3f2826=this;return new Promise(function(_0x98ecbe,_0x1eb3e7){if(ami['isConnected']()==![]){return _0x1eb3e7(_0x3f2826['error'](0x1f4,[config[_0xcebc('0xf')]['ip'],config[_0xcebc('0xf')][_0xcebc('0x10')],_0xcebc('0x1d')]['join']('\x20')));}var _0x30623c=schema(properties[_0xcebc('0x5c')])[_0xcebc('0x1')](_0x30b0ca);if(_0x30623c[_0xcebc('0x5d')]>0x0){return _0x1eb3e7(_0x3f2826[_0xcebc('0x1a')](0x1f4,_[_0xcebc('0x5e')](_0x30623c,_0xcebc('0x1b'))[_0xcebc('0x11')](',\x20')));}var _0x5be0f3=_[_0xcebc('0x5f')](_0x55fd3a[_0xcebc('0x5b')],{'uniqueid':_0x30b0ca[_0xcebc('0x60')]});if(_0x5be0f3&&_0x5be0f3[_0xcebc('0x61')]){var _0x518867=util[_0xcebc('0x62')](_0xcebc('0x63'),_0x30b0ca['filename']||_0x30b0ca['uniqueid'],_0x30b0ca[_0xcebc('0x62')]||_0xcebc('0x64'));return ami[_0xcebc('0x17')]({'action':'MixMonitor','channel':_0x5be0f3[_0xcebc('0x61')],'file':_0x518867,'options':_0xcebc('0x65')})[_0xcebc('0x18')](function(_0x4778bb){var _0x43a46d=_[_0xcebc('0x5f')](_0x5be0f3[_0xcebc('0x66')],{'filename':_0xcebc('0x67')+_0x518867[_0xcebc('0x68')]()});if(_['isNil'](_0x43a46d)){_0x5be0f3[_0xcebc('0x66')][_0xcebc('0x59')]({'filename':_0xcebc('0x67')+_0x518867[_0xcebc('0x68')](),'createdAt':moment()[_0xcebc('0x62')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x4778bb[_0xcebc('0x69')],'status':'rec'});}else{_0x43a46d[_0xcebc('0x69')]=_0x4778bb[_0xcebc('0x69')];_0x43a46d[_0xcebc('0x6a')]='rec';}_0x98ecbe({'code':0xc8,'message':[_0x30b0ca[_0xcebc('0x60')],_0xcebc('0x6b'),_0x4778bb[_0xcebc('0x69')]][_0xcebc('0x11')]('\x20'),'mixmonitorid':_0x4778bb[_0xcebc('0x69')]});})[_0xcebc('0x19')](function(_0x528a91){_0x1eb3e7(_0x3f2826[_0xcebc('0x1a')](0x1f5,[_0x30b0ca['uniqueid'],_0x528a91[_0xcebc('0x1b')][_0xcebc('0x68')]()][_0xcebc('0x11')]('\x20')));});}else{return _0x1eb3e7(_0x3f2826[_0xcebc('0x1a')](0x1f5,_0xcebc('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x2d0cc4){var _0x4f2991=this;return new Promise(function(_0x4762d7,_0x35c978){if(ami[_0xcebc('0x1c')]()==![]){return _0x35c978(_0x4f2991[_0xcebc('0x1a')](0x1f4,[config[_0xcebc('0xf')]['ip'],config[_0xcebc('0xf')]['username'],'ami\x20disconnected'][_0xcebc('0x11')]('\x20')));}var _0xf0c756=schema(properties['voicechannel'])[_0xcebc('0x1')](_0x2d0cc4);if(_0xf0c756[_0xcebc('0x5d')]>0x0){return _0x35c978(_0x4f2991[_0xcebc('0x1a')](0x1f4,_[_0xcebc('0x5e')](_0xf0c756,_0xcebc('0x1b'))[_0xcebc('0x11')](',\x20')));}var _0x23f03d=_[_0xcebc('0x5f')](_0x55fd3a[_0xcebc('0x5b')],{'uniqueid':_0x2d0cc4[_0xcebc('0x60')]});if(_0x23f03d){return BPromise[_0xcebc('0x6d')]()[_0xcebc('0x18')](function(){if(_0x23f03d[_0xcebc('0x61')]){return ami[_0xcebc('0x17')]({'action':_0xcebc('0x6e'),'channel':_0x23f03d['channel'],'mixmonitorid':_0x2d0cc4['mixmonitorid']})['catch'](function(_0x228f56){});}})[_0xcebc('0x18')](function(){if(_0x23f03d['destinationchannel']){return ami['Action']({'action':_0xcebc('0x6e'),'channel':_0x23f03d['destinationchannel'],'mixmonitorid':_0x2d0cc4['mixmonitorid']})[_0xcebc('0x19')](function(_0x1c3ff0){});}})['then'](function(_0x4baf9c){var _0xda6f2e=_[_0xcebc('0x5f')](_0x23f03d[_0xcebc('0x66')],{'mixmonitorid':_0x2d0cc4['mixmonitorid']});if(_0xda6f2e){_0xda6f2e[_0xcebc('0x6a')]=_0xcebc('0x6f');}})[_0xcebc('0x18')](function(){var _0x276b48=util[_0xcebc('0x62')](_0xcebc('0x63'),_0x2d0cc4['filename']||_0x2d0cc4[_0xcebc('0x60')],_0x2d0cc4['format']||_0xcebc('0x64'));var _0x44191b=_['find'](_0x23f03d[_0xcebc('0x66')],{'filename':_0xcebc('0x67')+_0x276b48[_0xcebc('0x68')]()});if(_0x44191b){_0x44191b['status']=_0xcebc('0x6f');}})[_0xcebc('0x18')](function(){_0x4762d7({'code':0xc8,'message':[_0x2d0cc4['uniqueid'],_0xcebc('0x70')][_0xcebc('0x11')]('\x20')});})['catch'](function(_0x5d858c){_0x35c978(_0x4f2991['error'](0x1f5,[_0x2d0cc4[_0xcebc('0x60')],_0x5d858c['message'][_0xcebc('0x68')]()][_0xcebc('0x11')]('\x20')));});}else{return _0x35c978(_0x4f2991[_0xcebc('0x1a')](0x1f5,_0xcebc('0x6c')));}});},'VoiceQueuesChannels':function(_0x34b5bd){return new Promise(function(_0x3f3084,_0x258900){var _0x3a1d90=_['values'](_0x55fd3a[_0xcebc('0x71')]);_0x3f3084({'count':_0x3a1d90[_0xcebc('0x5d')],'rows':_0x3a1d90});});},'VoiceQueuesChannel':function(_0x2ea5ce){var _0x37d511=this;return new Promise(function(_0x5c7007,_0x3ef59d){var _0x195f33=schema(properties[_0xcebc('0x72')])[_0xcebc('0x1')](_0x2ea5ce);if(_0x195f33['length']>0x0){return _0x3ef59d(_0x37d511[_0xcebc('0x1a')](0x1f4,_[_0xcebc('0x5e')](_0x195f33,_0xcebc('0x1b'))[_0xcebc('0x11')](',\x20')));}var _0x5a2520=_[_0xcebc('0x5f')](_0x55fd3a[_0xcebc('0x71')],{'uniqueid':_0x2ea5ce['uniqueid']});if(_0x5a2520){_0x5c7007(_0x5a2520);}else{return _0x3ef59d(_0x37d511['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x482e9f){var _0x6f699a=this;return new Promise(function(_0x1d56a5,_0xe819df){if(ami[_0xcebc('0x1c')]()==![]){return _0xe819df(_0x6f699a[_0xcebc('0x1a')](0x1f4,[config[_0xcebc('0xf')]['ip'],config[_0xcebc('0xf')][_0xcebc('0x10')],'ami\x20disconnected'][_0xcebc('0x11')]('\x20')));}var _0x58b792=schema(properties[_0xcebc('0x73')])[_0xcebc('0x1')](_0x482e9f);if(_0x58b792['length']>0x0){return _0xe819df(_0x6f699a[_0xcebc('0x1a')](0x1f4,_['map'](_0x58b792,'message')[_0xcebc('0x11')](',\x20')));}var _0x119f2c=_[_0xcebc('0x5f')](_0x55fd3a[_0xcebc('0x71')],{'uniqueid':_0x482e9f[_0xcebc('0x60')]});if(_0x119f2c&&_0x119f2c[_0xcebc('0x61')]){return ami[_0xcebc('0x17')]({'action':_0xcebc('0x74'),'channel':_0x119f2c[_0xcebc('0x61')]})[_0xcebc('0x18')](function(_0x33ac07){_0x1d56a5({'code':0xc8,'message':[_0x482e9f[_0xcebc('0x60')],_0x33ac07[_0xcebc('0x1b')][_0xcebc('0x68')]()][_0xcebc('0x11')]('\x20')});})[_0xcebc('0x19')](function(_0x154432){_0xe819df(_0x6f699a[_0xcebc('0x1a')](0x1f5,[_0x482e9f[_0xcebc('0x60')],_0x154432['message'][_0xcebc('0x68')]()][_0xcebc('0x11')]('\x20')));});}else{return _0xe819df(_0x6f699a[_0xcebc('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3e49e9){var _0x335229=this;return new Promise(function(_0x346dd7,_0x5db6d2){if(ami[_0xcebc('0x1c')]()==![]){return _0x5db6d2(_0x335229[_0xcebc('0x1a')](0x1f4,[config[_0xcebc('0xf')]['ip'],config['asterisk'][_0xcebc('0x10')],_0xcebc('0x1d')]['join']('\x20')));}var _0x509011=schema(properties[_0xcebc('0x75')])[_0xcebc('0x1')](_0x3e49e9);if(_0x509011[_0xcebc('0x5d')]>0x0){return _0x5db6d2(_0x335229[_0xcebc('0x1a')](0x1f4,_['map'](_0x509011,'message')['join'](',\x20')));}var _0x13e8c8=_[_0xcebc('0x5f')](_0x55fd3a[_0xcebc('0x71')],{'uniqueid':_0x3e49e9['uniqueid']});if(_0x13e8c8&&_0x13e8c8[_0xcebc('0x61')]){return ami[_0xcebc('0x17')]({'action':_0xcebc('0x76'),'channel':_0x13e8c8['channel'],'exten':_0x3e49e9['exten'],'context':_0x3e49e9[_0xcebc('0x77')]||_0x13e8c8['context'],'priority':0x1})[_0xcebc('0x18')](function(_0x436728){_0x346dd7({'code':0xc8,'message':[_0x3e49e9[_0xcebc('0x60')],_0x436728[_0xcebc('0x1b')]['toLowerCase']()]['join']('\x20')});})[_0xcebc('0x19')](function(_0x24d889){_0x5db6d2(_0x335229[_0xcebc('0x1a')](0x1f5,[_0x3e49e9[_0xcebc('0x60')],_0x24d889[_0xcebc('0x1b')][_0xcebc('0x68')]()][_0xcebc('0x11')]('\x20')));});}else{return _0x5db6d2(_0x335229[_0xcebc('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0xd2141a){return new Promise(function(_0x3ca712,_0x49d6f2){var _0x897992=_['values'](_0x55fd3a[_0xcebc('0xb')]);_0x3ca712({'count':_0x897992[_0xcebc('0x5d')],'rows':_0x897992});});},'Telephones':function(_0x3f8042){return new Promise(function(_0x29b79f,_0x31b5ac){var _0x3af0d1=_[_0xcebc('0x5a')](_0x55fd3a[_0xcebc('0x78')]);_0x29b79f({'count':_0x3af0d1[_0xcebc('0x5d')],'rows':_0x3af0d1});});},'Trunks':function(_0x161b39){return new Promise(function(_0x35583c,_0x40325c){var _0x147379=_[_0xcebc('0x5a')](_0x55fd3a[_0xcebc('0x79')]);_0x35583c({'count':_0x147379['length'],'rows':_0x147379});});},'OutboundChannels':function(_0x4b2303){return new Promise(function(_0x3baf5f,_0x347619){var _0x240937=_[_0xcebc('0x5a')](_0x55fd3a['outboundChannels']);_0x3baf5f({'count':_0x240937['length'],'rows':_0x240937});});},'Outbound':function(_0x4cc5c5){return new Promise(function(_0x2b0807,_0x47d34c){_0x2b0807(_0x55fd3a['outbound']);});},'Campaigns':function(_0x5f41dd){return new Promise(function(_0xaef26f,_0x3a6cf8){var _0x59dd77=_[_0xcebc('0x5a')](_0x55fd3a[_0xcebc('0x7a')]);_0xaef26f({'count':_0x59dd77[_0xcebc('0x5d')],'rows':_0x59dd77});});},'VoiceQueuesPreview':function(_0xf191c8){var _0x2edc46=this;return new Promise(function(_0x39a9e6,_0x54e596){_0x1b28e5[_0xcebc('0x7b')](_0xf191c8['id'])['then'](function(_0x399659){_0x39a9e6({'code':0xc8,'message':_0x399659[_0xcebc('0x1b')]});})[_0xcebc('0x19')](function(_0xec0ab){_0x54e596(_0x2edc46[_0xcebc('0x1a')](0x1f4,_0xec0ab[_0xcebc('0x1b')]));});});},'EventManager':function(_0x1c6c01){var _0x29732f=this;return new Promise(function(_0x418d90,_0x16d3c9){if(!_0x1c6c01[_0xcebc('0x7c')]){return _0x16d3c9(_0x29732f[_0xcebc('0x1a')](0x1f4,_0xcebc('0x7d')));}ami[_0xcebc('0x7e')](_0xcebc('0x7f')+_0x1c6c01['event'],_0x1c6c01[_0xcebc('0x1b')]);_0x418d90({'code':0xc8,'message':_0x1c6c01});});},'FaxAccounts':function(_0x313f72){return new Promise(function(_0x3e40b2,_0xea152){var _0x70faf3=_[_0xcebc('0x5a')](_0x55fd3a[_0xcebc('0x80')]);_0x3e40b2({'count':_0x70faf3['length'],'rows':_0x70faf3});});},'SendFax':function(_0x52f929){var _0x13f017=this;return new Promise(function(_0x5a67aa,_0x31c75f){_0x4ae14f[_0xcebc('0x81')](_0x52f929)[_0xcebc('0x18')](function(_0x502ad8){_0x5a67aa({'code':0xc8,'message':_0x502ad8['message']});})[_0xcebc('0x19')](function(_0x5e1fa8){_0x31c75f(_0x13f017[_0xcebc('0x1a')](0x1f4,_0x5e1fa8['message']));});});},'CheckAfterSend':function(_0x3eb6e0){var _0xd8b5d=this;return new Promise(function(_0x23a675,_0x471a08){_0x4ae14f[_0xcebc('0x82')](_0x3eb6e0)[_0xcebc('0x18')](function(_0x21df49){_0x23a675({'code':0xc8,'message':_0x21df49[_0xcebc('0x1b')]});})[_0xcebc('0x19')](function(_0x56de60){_0x471a08(_0xd8b5d[_0xcebc('0x1a')](0x1f4,_0x56de60[_0xcebc('0x1b')]));});});}};var _0x35e5d7=jayson[_0xcebc('0x83')](_0x25d789)[_0xcebc('0x84')]();_0x35e5d7['on']('error',function(_0x41ac6b){return _0x3aa7a8(_0x41ac6b);});_0x35e5d7[_0xcebc('0x5')](0x232a,_0xcebc('0x85'),function(){console[_0xcebc('0x86')](_0xcebc('0x87'),0x232a);return _0x3ccbfc(_0xcebc('0x88')+0x232a);});});}; \ No newline at end of file +var _0xecab=['ami\x20disconnected','pick','keys','module','Reload','Action','message','catch','isConnected','username','join','Command','then','content','error','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','total','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','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','channels','voicechannel','map','find','uniqueid','channel','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','wav','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','event','emit','custom:','faxAccounts','send','checkAfterSend','server','http','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk'];(function(_0x290463,_0x1173ee){var _0x346e76=function(_0x352bdd){while(--_0x352bdd){_0x290463['push'](_0x290463['shift']());}};_0x346e76(++_0x1173ee);}(_0xecab,0x71));var _0xbeca=function(_0x16509e,_0x591f44){_0x16509e=_0x16509e-0x0;var _0x27c11f=_0xecab[_0x16509e];return _0x27c11f;};'use strict';var _=require(_0xbeca('0x0'));var util=require(_0xbeca('0x1'));var jayson=require(_0xbeca('0x2'));var schema=require(_0xbeca('0x3'));var BPromise=require(_0xbeca('0x4'));var moment=require(_0xbeca('0x5'));var config=require(_0xbeca('0x6'));var properties=require('../properties');var ami=require(_0xbeca('0x7'));exports[_0xbeca('0x8')]=function(_0x5be4f4,_0x4ae156,_0xbdc2b1){return new BPromise(function(_0x43073c,_0x370520){var _0x1e5646={'QueuePause':function(_0x1e5ae3){return new Promise(function(_0x49a824,_0x2aba44){var _0x3f2258=util[_0xbeca('0x9')](_0xbeca('0xa'),_0xbeca('0xb'),_0x1e5ae3[_0xbeca('0xc')]);if(_0x5be4f4[_0xbeca('0xd')]&&_0x5be4f4[_0xbeca('0xd')][_0x3f2258]&&_0x5be4f4[_0xbeca('0xd')][_0x3f2258][_0xbeca('0xe')]){_0x5be4f4[_0xbeca('0xd')][_0x3f2258][_0xbeca('0xf')]();}if(_0x5be4f4[_0xbeca('0x10')][_0x3f2258]){_0x5be4f4[_0xbeca('0x10')][_0x3f2258][_0xbeca('0x11')]({'statePause':_0x1e5ae3[_0xbeca('0x12')]?!![]:![]});}_0x49a824({'code':0xc8,'message':_0xbeca('0x13')});});},'Reload':function(_0x217561){var _0x5e74ec=this;return new Promise(function(_0x2436a5,_0x2841cd){if(ami['isConnected']()==![]){return _0x2841cd(_0x5e74ec['error'](0x1f4,[config[_0xbeca('0x14')]['ip'],config[_0xbeca('0x14')]['username'],_0xbeca('0x15')]['join']('\x20')));}_0x217561=_[_0xbeca('0x16')](_0x217561,_[_0xbeca('0x17')](properties[_0xbeca('0x18')]));_0x217561['action']=_0xbeca('0x19');return ami[_0xbeca('0x1a')](_0x217561)['then'](function(_0x5e8b0d){_0x2436a5({'code':0xc8,'message':_0x5e8b0d[_0xbeca('0x1b')]});})[_0xbeca('0x1c')](function(_0x46dc17){_0x2841cd(_0x5e74ec['error'](0x1f5,_0x46dc17[_0xbeca('0x1b')]));});});},'Command':function(_0x80e56){var _0x1bc9d8=this;return new Promise(function(_0x10c620,_0x250e76){if(ami[_0xbeca('0x1d')]()==![]){return _0x250e76(_0x1bc9d8['error'](0x1f4,[config[_0xbeca('0x14')]['ip'],config[_0xbeca('0x14')][_0xbeca('0x1e')],_0xbeca('0x15')][_0xbeca('0x1f')]('\x20')));}_0x80e56=_[_0xbeca('0x16')](_0x80e56,'command');_0x80e56['action']=_0xbeca('0x20');return ami[_0xbeca('0x1a')](_0x80e56)[_0xbeca('0x21')](function(_0x4083b1){_0x10c620({'code':0xc8,'message':_0x4083b1[_0xbeca('0x22')]});})[_0xbeca('0x1c')](function(_0x1939ba){_0x250e76(_0x1bc9d8[_0xbeca('0x23')](0x1f5,_0x1939ba[_0xbeca('0x1b')]));});});},'VoiceQueues':function(_0x42cca4){return new Promise(function(_0x5c8d62,_0x557700){var _0x105e78=[];for(var _0x28346b in _0x5be4f4['voiceQueues']){if(_0x5be4f4[_0xbeca('0x24')][_0xbeca('0x25')](_0x28346b)){var _0x1ed5cb=_0x5be4f4['voiceQueues'][_0x28346b];var _0x1a908e={'id':_0x1ed5cb['id'],'name':_0x1ed5cb[_0xbeca('0xc')],'strategy':_0x1ed5cb[_0xbeca('0x26')],'answered':_0x1ed5cb[_0xbeca('0x27')],'available':_0x1ed5cb[_0xbeca('0x28')],'loggedIn':_0x1ed5cb[_0xbeca('0x29')],'pTalking':_0x1ed5cb['pTalking'],'sumBillable':_0x1ed5cb['sumBillable'],'sumDuration':_0x1ed5cb[_0xbeca('0x2a')],'sumHoldTime':_0x1ed5cb[_0xbeca('0x2b')]||0x0,'talking':_0x1ed5cb['talking'],'total':_0x1ed5cb[_0xbeca('0x2c')],'type':_0x1ed5cb[_0xbeca('0x2d')],'unmanaged':_0x1ed5cb['unmanaged'],'abandoned':_0x1ed5cb['abandoned'],'waiting':_0x1ed5cb['waiting'],'loggedInDb':_0x1ed5cb['loggedInDb']};if(_0x1ed5cb[_0xbeca('0x2d')]==='outbound'){_0x1a908e[_0xbeca('0x2e')]=_0x1ed5cb['dialActive'];_0x1a908e[_0xbeca('0x2f')]=_0x1ed5cb[_0xbeca('0x2f')];_0x1a908e[_0xbeca('0x30')]=_0x1ed5cb['dialOriginateCallerIdName'];_0x1a908e[_0xbeca('0x31')]=_0x1ed5cb[_0xbeca('0x31')];_0x1a908e[_0xbeca('0x32')]=_0x1ed5cb['dialOriginateTimeout'];_0x1a908e[_0xbeca('0x33')]=_0x1ed5cb['dialPrefix'];_0x1a908e['outboundAnswerAgiCallsDay']=_0x1ed5cb[_0xbeca('0x34')];_0x1a908e['outboundAnswerCallsDay']=_0x1ed5cb[_0xbeca('0x35')];_0x1a908e[_0xbeca('0x36')]=_0x1ed5cb['outboundBlacklistCallsDay'];_0x1a908e[_0xbeca('0x37')]=_0x1ed5cb[_0xbeca('0x37')];_0x1a908e[_0xbeca('0x38')]=_0x1ed5cb[_0xbeca('0x38')];_0x1a908e[_0xbeca('0x39')]=_0x1ed5cb[_0xbeca('0x39')];_0x1a908e['outboundDropCallsDayCallersExit']=_0x1ed5cb['outboundDropCallsDayCallersExit'];_0x1a908e['outboundDropCallsDayTimeout']=_0x1ed5cb[_0xbeca('0x3a')];_0x1a908e[_0xbeca('0x3b')]=_0x1ed5cb['outboundNoAnswerCallsDay'];_0x1a908e[_0xbeca('0x3c')]=_0x1ed5cb[_0xbeca('0x3c')];_0x1a908e[_0xbeca('0x3d')]=_0x1ed5cb[_0xbeca('0x3d')];_0x1a908e['outboundReCallsDay']=_0x1ed5cb[_0xbeca('0x3e')];_0x1a908e[_0xbeca('0x3f')]=_0x1ed5cb['outboundRejectCallsDay'];_0x1a908e[_0xbeca('0x40')]=_0x1ed5cb[_0xbeca('0x40')];_0x1a908e[_0xbeca('0x41')]=_0x1ed5cb[_0xbeca('0x41')];_0x1a908e[_0xbeca('0x42')]=_0x1ed5cb[_0xbeca('0x42')];_0x1a908e[_0xbeca('0x43')]=_0x1ed5cb[_0xbeca('0x43')];_0x1a908e[_0xbeca('0x44')]=_0x1ed5cb[_0xbeca('0x44')];_0x1a908e[_0xbeca('0x45')]=_0x1ed5cb[_0xbeca('0x45')];_0x1a908e[_0xbeca('0x46')]=_0x1ed5cb[_0xbeca('0x46')];_0x1a908e[_0xbeca('0x47')]=_0x1ed5cb['predictiveIntervalErlangCallsDroppedCalls'];_0x1a908e[_0xbeca('0x48')]=_0x1ed5cb[_0xbeca('0x48')];_0x1a908e['predictiveIntervalMultiplicativeFactor']=_0x1ed5cb[_0xbeca('0x49')];_0x1a908e[_0xbeca('0x4a')]=_0x1ed5cb[_0xbeca('0x4a')];_0x1a908e[_0xbeca('0x4b')]=_0x1ed5cb[_0xbeca('0x4b')];_0x1a908e[_0xbeca('0x4c')]=_0x1ed5cb[_0xbeca('0x4c')];_0x1a908e[_0xbeca('0x1b')]=_0x1ed5cb[_0xbeca('0x1b')];_0x1a908e['originated']=_0x1ed5cb[_0xbeca('0x4d')];_0x1a908e[_0xbeca('0x4e')]=_0x1ed5cb[_0xbeca('0x4e')];_0x1a908e[_0xbeca('0x4f')]=_0x1ed5cb[_0xbeca('0x4f')];_0x1a908e[_0xbeca('0x50')]=_0x1ed5cb[_0xbeca('0x50')];_0x1a908e[_0xbeca('0x51')]=_0x1ed5cb[_0xbeca('0x51')];_0x1a908e[_0xbeca('0x52')]=_0x1ed5cb[_0xbeca('0x52')];_0x1a908e[_0xbeca('0x53')]=_0x1ed5cb[_0xbeca('0x53')];}if(_0x1ed5cb[_0xbeca('0x54')]){_0x1a908e[_0xbeca('0x54')]={'id':_0x1ed5cb['Trunk']['id'],'name':_0x1ed5cb[_0xbeca('0x54')][_0xbeca('0xc')],'active':_0x1ed5cb['Trunk'][_0xbeca('0x55')],'callerid':_0x1ed5cb[_0xbeca('0x54')][_0xbeca('0x56')]};}if(_0x1ed5cb['Interval']){_0x1a908e['Interval']={'id':_0x1ed5cb[_0xbeca('0x57')]['id'],'name':_0x1ed5cb['Interval'][_0xbeca('0xc')]};}_0x105e78[_0xbeca('0x58')](_0x1a908e);}}_0x5c8d62({'count':_0x105e78[_0xbeca('0x59')],'rows':_0x105e78});});},'VoiceChannels':function(_0x1cb305){return new Promise(function(_0x2d55d2,_0x151b89){var _0x76843b=_[_0xbeca('0x5a')](_0x5be4f4[_0xbeca('0x5b')]);_0x2d55d2({'count':_0x76843b[_0xbeca('0x59')],'rows':_0x76843b});});},'VoiceChannelMixMonitor':function(_0xc1275d){var _0x22c1d2=this;return new Promise(function(_0x461cbe,_0x5bec98){if(ami['isConnected']()==![]){return _0x5bec98(_0x22c1d2[_0xbeca('0x23')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0xbeca('0x15')][_0xbeca('0x1f')]('\x20')));}var _0x20f3fe=schema(properties[_0xbeca('0x5c')])['validate'](_0xc1275d);if(_0x20f3fe[_0xbeca('0x59')]>0x0){return _0x5bec98(_0x22c1d2['error'](0x1f4,_[_0xbeca('0x5d')](_0x20f3fe,'message')['join'](',\x20')));}var _0xa3b433=_[_0xbeca('0x5e')](_0x5be4f4[_0xbeca('0x5b')],{'uniqueid':_0xc1275d[_0xbeca('0x5f')]});if(_0xa3b433&&_0xa3b433[_0xbeca('0x60')]){var _0x4199cb=util[_0xbeca('0x9')]('%s.%s',_0xc1275d['filename']||_0xc1275d['uniqueid'],_0xc1275d[_0xbeca('0x9')]||'wav');return ami['Action']({'action':_0xbeca('0x61'),'channel':_0xa3b433['channel'],'file':_0x4199cb,'options':_0xbeca('0x62')})[_0xbeca('0x21')](function(_0x28bc89){var _0x243146=_['find'](_0xa3b433[_0xbeca('0x63')],{'filename':_0xbeca('0x64')+_0x4199cb['toLowerCase']()});if(_[_0xbeca('0x65')](_0x243146)){_0xa3b433['monitors'][_0xbeca('0x58')]({'filename':_0xbeca('0x64')+_0x4199cb[_0xbeca('0x66')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x28bc89[_0xbeca('0x67')],'status':_0xbeca('0x68')});}else{_0x243146[_0xbeca('0x67')]=_0x28bc89['mixmonitorid'];_0x243146[_0xbeca('0x69')]=_0xbeca('0x68');}_0x461cbe({'code':0xc8,'message':[_0xc1275d['uniqueid'],'MixMonitor\x20Success',_0x28bc89[_0xbeca('0x67')]][_0xbeca('0x1f')]('\x20'),'mixmonitorid':_0x28bc89[_0xbeca('0x67')]});})['catch'](function(_0x1f552e){_0x5bec98(_0x22c1d2[_0xbeca('0x23')](0x1f5,[_0xc1275d[_0xbeca('0x5f')],_0x1f552e[_0xbeca('0x1b')][_0xbeca('0x66')]()][_0xbeca('0x1f')]('\x20')));});}else{return _0x5bec98(_0x22c1d2[_0xbeca('0x23')](0x1f5,_0xbeca('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x1656a1){var _0x385d2d=this;return new Promise(function(_0x461950,_0x3f5e93){if(ami[_0xbeca('0x1d')]()==![]){return _0x3f5e93(_0x385d2d[_0xbeca('0x23')](0x1f4,[config[_0xbeca('0x14')]['ip'],config[_0xbeca('0x14')][_0xbeca('0x1e')],_0xbeca('0x15')]['join']('\x20')));}var _0x2cfbd4=schema(properties['voicechannel'])[_0xbeca('0x3')](_0x1656a1);if(_0x2cfbd4['length']>0x0){return _0x3f5e93(_0x385d2d[_0xbeca('0x23')](0x1f4,_[_0xbeca('0x5d')](_0x2cfbd4,_0xbeca('0x1b'))[_0xbeca('0x1f')](',\x20')));}var _0x2dae33=_[_0xbeca('0x5e')](_0x5be4f4[_0xbeca('0x5b')],{'uniqueid':_0x1656a1[_0xbeca('0x5f')]});if(_0x2dae33){return BPromise[_0xbeca('0x6b')]()['then'](function(){if(_0x2dae33[_0xbeca('0x60')]){return ami['Action']({'action':_0xbeca('0x6c'),'channel':_0x2dae33['channel'],'mixmonitorid':_0x1656a1[_0xbeca('0x67')]})[_0xbeca('0x1c')](function(_0x17d72e){});}})['then'](function(){if(_0x2dae33['destinationchannel']){return ami['Action']({'action':_0xbeca('0x6c'),'channel':_0x2dae33[_0xbeca('0x6d')],'mixmonitorid':_0x1656a1[_0xbeca('0x67')]})[_0xbeca('0x1c')](function(_0x546625){});}})[_0xbeca('0x21')](function(_0x55a8ef){var _0x203f01=_[_0xbeca('0x5e')](_0x2dae33[_0xbeca('0x63')],{'mixmonitorid':_0x1656a1[_0xbeca('0x67')]});if(_0x203f01){_0x203f01[_0xbeca('0x69')]=_0xbeca('0x6e');}})[_0xbeca('0x21')](function(){var _0xc6dcae=util['format'](_0xbeca('0x6f'),_0x1656a1['filename']||_0x1656a1[_0xbeca('0x5f')],_0x1656a1[_0xbeca('0x9')]||_0xbeca('0x70'));var _0x4c5cae=_['find'](_0x2dae33[_0xbeca('0x63')],{'filename':_0xbeca('0x64')+_0xc6dcae[_0xbeca('0x66')]()});if(_0x4c5cae){_0x4c5cae[_0xbeca('0x69')]='stop';}})['then'](function(){_0x461950({'code':0xc8,'message':[_0x1656a1[_0xbeca('0x5f')],_0xbeca('0x71')][_0xbeca('0x1f')]('\x20')});})[_0xbeca('0x1c')](function(_0x29f8c5){_0x3f5e93(_0x385d2d[_0xbeca('0x23')](0x1f5,[_0x1656a1[_0xbeca('0x5f')],_0x29f8c5[_0xbeca('0x1b')][_0xbeca('0x66')]()][_0xbeca('0x1f')]('\x20')));});}else{return _0x3f5e93(_0x385d2d[_0xbeca('0x23')](0x1f5,_0xbeca('0x6a')));}});},'VoiceQueuesChannels':function(_0x2f62b1){return new Promise(function(_0xfcc1e4,_0x2c8b26){var _0x5c9be1=_['values'](_0x5be4f4['queueChannels']);_0xfcc1e4({'count':_0x5c9be1['length'],'rows':_0x5c9be1});});},'VoiceQueuesChannel':function(_0x6bc5b1){var _0x32370e=this;return new Promise(function(_0x5c32b6,_0x5e77ca){var _0x13eb8e=schema(properties[_0xbeca('0x72')])[_0xbeca('0x3')](_0x6bc5b1);if(_0x13eb8e[_0xbeca('0x59')]>0x0){return _0x5e77ca(_0x32370e[_0xbeca('0x23')](0x1f4,_[_0xbeca('0x5d')](_0x13eb8e,_0xbeca('0x1b'))['join'](',\x20')));}var _0x41a98b=_[_0xbeca('0x5e')](_0x5be4f4[_0xbeca('0x73')],{'uniqueid':_0x6bc5b1[_0xbeca('0x5f')]});if(_0x41a98b){_0x5c32b6(_0x41a98b);}else{return _0x5e77ca(_0x32370e[_0xbeca('0x23')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0xc99038){var _0x169625=this;return new Promise(function(_0x18b9e9,_0x547d03){if(ami[_0xbeca('0x1d')]()==![]){return _0x547d03(_0x169625[_0xbeca('0x23')](0x1f4,[config[_0xbeca('0x14')]['ip'],config[_0xbeca('0x14')][_0xbeca('0x1e')],_0xbeca('0x15')][_0xbeca('0x1f')]('\x20')));}var _0x205e48=schema(properties[_0xbeca('0x74')])[_0xbeca('0x3')](_0xc99038);if(_0x205e48[_0xbeca('0x59')]>0x0){return _0x547d03(_0x169625[_0xbeca('0x23')](0x1f4,_[_0xbeca('0x5d')](_0x205e48,_0xbeca('0x1b'))[_0xbeca('0x1f')](',\x20')));}var _0x3d7639=_[_0xbeca('0x5e')](_0x5be4f4[_0xbeca('0x73')],{'uniqueid':_0xc99038[_0xbeca('0x5f')]});if(_0x3d7639&&_0x3d7639[_0xbeca('0x60')]){return ami['Action']({'action':_0xbeca('0x75'),'channel':_0x3d7639[_0xbeca('0x60')]})['then'](function(_0x28bb43){_0x18b9e9({'code':0xc8,'message':[_0xc99038[_0xbeca('0x5f')],_0x28bb43['message'][_0xbeca('0x66')]()][_0xbeca('0x1f')]('\x20')});})[_0xbeca('0x1c')](function(_0x23cad4){_0x547d03(_0x169625[_0xbeca('0x23')](0x1f5,[_0xc99038[_0xbeca('0x5f')],_0x23cad4[_0xbeca('0x1b')][_0xbeca('0x66')]()][_0xbeca('0x1f')]('\x20')));});}else{return _0x547d03(_0x169625[_0xbeca('0x23')](0x1f5,_0xbeca('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0x1156ab){var _0x29184b=this;return new Promise(function(_0x5edbf1,_0x5efc2d){if(ami[_0xbeca('0x1d')]()==![]){return _0x5efc2d(_0x29184b[_0xbeca('0x23')](0x1f4,[config[_0xbeca('0x14')]['ip'],config[_0xbeca('0x14')][_0xbeca('0x1e')],_0xbeca('0x15')][_0xbeca('0x1f')]('\x20')));}var _0xc78412=schema(properties[_0xbeca('0x76')])[_0xbeca('0x3')](_0x1156ab);if(_0xc78412[_0xbeca('0x59')]>0x0){return _0x5efc2d(_0x29184b['error'](0x1f4,_[_0xbeca('0x5d')](_0xc78412,'message')[_0xbeca('0x1f')](',\x20')));}var _0x2f779f=_['find'](_0x5be4f4['queueChannels'],{'uniqueid':_0x1156ab[_0xbeca('0x5f')]});if(_0x2f779f&&_0x2f779f[_0xbeca('0x60')]){return ami[_0xbeca('0x1a')]({'action':_0xbeca('0x77'),'channel':_0x2f779f['channel'],'exten':_0x1156ab[_0xbeca('0x78')],'context':_0x1156ab[_0xbeca('0x79')]||_0x2f779f['context'],'priority':0x1})['then'](function(_0x45105c){_0x5edbf1({'code':0xc8,'message':[_0x1156ab[_0xbeca('0x5f')],_0x45105c[_0xbeca('0x1b')][_0xbeca('0x66')]()][_0xbeca('0x1f')]('\x20')});})[_0xbeca('0x1c')](function(_0x3ab3d2){_0x5efc2d(_0x29184b[_0xbeca('0x23')](0x1f5,[_0x1156ab[_0xbeca('0x5f')],_0x3ab3d2[_0xbeca('0x1b')][_0xbeca('0x66')]()][_0xbeca('0x1f')]('\x20')));});}else{return _0x5efc2d(_0x29184b[_0xbeca('0x23')](0x1f5,_0xbeca('0x6a')));}});},'Agents':function(_0x52884d){return new Promise(function(_0x2523a9,_0x1a023a){var _0x75ffc2=_[_0xbeca('0x5a')](_0x5be4f4[_0xbeca('0x10')]);_0x2523a9({'count':_0x75ffc2[_0xbeca('0x59')],'rows':_0x75ffc2});});},'Telephones':function(_0x3eb996){return new Promise(function(_0x1cc3ca,_0x58c7ea){var _0xfac15c=_['values'](_0x5be4f4[_0xbeca('0x7a')]);_0x1cc3ca({'count':_0xfac15c[_0xbeca('0x59')],'rows':_0xfac15c});});},'Trunks':function(_0x4b0ba8){return new Promise(function(_0x553275,_0x23b947){var _0x276c18=_[_0xbeca('0x5a')](_0x5be4f4['trunks']);_0x553275({'count':_0x276c18[_0xbeca('0x59')],'rows':_0x276c18});});},'OutboundChannels':function(_0x566c46){return new Promise(function(_0x14a638,_0x24ad47){var _0x21a6b5=_['values'](_0x5be4f4[_0xbeca('0x7b')]);_0x14a638({'count':_0x21a6b5[_0xbeca('0x59')],'rows':_0x21a6b5});});},'Outbound':function(_0x2704d0){return new Promise(function(_0x3e807b,_0x4234eb){_0x3e807b(_0x5be4f4['outbound']);});},'Campaigns':function(_0x571bed){return new Promise(function(_0x3bd0be,_0x2f3a24){var _0x470c85=_[_0xbeca('0x5a')](_0x5be4f4['campaigns']);_0x3bd0be({'count':_0x470c85[_0xbeca('0x59')],'rows':_0x470c85});});},'VoiceQueuesPreview':function(_0x2cdca2){var _0x2a07a1=this;return new Promise(function(_0x80fc31,_0x434cd7){_0x4ae156['run'](_0x2cdca2['id'])['then'](function(_0x265855){_0x80fc31({'code':0xc8,'message':_0x265855[_0xbeca('0x1b')]});})[_0xbeca('0x1c')](function(_0x49b1f8){_0x434cd7(_0x2a07a1[_0xbeca('0x23')](0x1f4,_0x49b1f8['message']));});});},'EventManager':function(_0x5423ae){var _0x1a8833=this;return new Promise(function(_0x43cd7b,_0x23c1ae){if(!_0x5423ae[_0xbeca('0x7c')]){return _0x23c1ae(_0x1a8833['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xbeca('0x7d')](_0xbeca('0x7e')+_0x5423ae[_0xbeca('0x7c')],_0x5423ae[_0xbeca('0x1b')]);_0x43cd7b({'code':0xc8,'message':_0x5423ae});});},'FaxAccounts':function(_0x4d9cd3){return new Promise(function(_0x2854c5,_0x54eb72){var _0x3e3ee5=_[_0xbeca('0x5a')](_0x5be4f4[_0xbeca('0x7f')]);_0x2854c5({'count':_0x3e3ee5['length'],'rows':_0x3e3ee5});});},'SendFax':function(_0x5c7fb8){var _0x4230ad=this;return new Promise(function(_0x523a85,_0x5c4426){_0xbdc2b1[_0xbeca('0x80')](_0x5c7fb8)[_0xbeca('0x21')](function(_0x4731a2){_0x523a85({'code':0xc8,'message':_0x4731a2['message']});})[_0xbeca('0x1c')](function(_0x5d05ae){_0x5c4426(_0x4230ad[_0xbeca('0x23')](0x1f4,_0x5d05ae[_0xbeca('0x1b')]));});});},'CheckAfterSend':function(_0x27a4ad){var _0x709e8f=this;return new Promise(function(_0x4aa407,_0x35ef97){_0xbdc2b1[_0xbeca('0x81')](_0x27a4ad)[_0xbeca('0x21')](function(_0x5f27b0){_0x4aa407({'code':0xc8,'message':_0x5f27b0[_0xbeca('0x1b')]});})[_0xbeca('0x1c')](function(_0x33fa84){_0x35ef97(_0x709e8f[_0xbeca('0x23')](0x1f4,_0x33fa84[_0xbeca('0x1b')]));});});}};var _0x1c2df2=jayson[_0xbeca('0x82')](_0x1e5646)[_0xbeca('0x83')]();_0x1c2df2['on'](_0xbeca('0x23'),function(_0x1e498d){return _0x370520(_0x1e498d);});_0x1c2df2[_0xbeca('0x8')](0x232a,'127.0.0.1',function(){console[_0xbeca('0x84')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x43073c(_0xbeca('0x85')+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 64dce91..9248b98 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 _0xbc7a=['format','user:%s','name','trigger:%s','merge','lodash','bluebird','ioredis','util','../../../../config/logger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','createdAt','scheduledAt','updatedAt','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','calleridname'];(function(_0x2f224d,_0x38f8ec){var _0x38364c=function(_0x4e57d4){while(--_0x4e57d4){_0x2f224d['push'](_0x2f224d['shift']());}};_0x38364c(++_0x38f8ec);}(_0xbc7a,0x149));var _0xabc7=function(_0x1d0678,_0x2ed2b8){_0x1d0678=_0x1d0678-0x0;var _0x462fc6=_0xbc7a[_0x1d0678];return _0x462fc6;};'use strict';var _=require(_0xabc7('0x0'));var BPromise=require(_0xabc7('0x1'));var Redis=require(_0xabc7('0x2'));var util=require(_0xabc7('0x3'));var config=require('../../../../config/environment');var logger=require(_0xabc7('0x4'))('trigger');var cmContactRpc=require(_0xabc7('0x5'));config[_0xabc7('0x6')]=_[_0xabc7('0x7')](config[_0xabc7('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xabc7('0x8'))(new Redis(config[_0xabc7('0x6')]));function emit(_0x3f5134,_0x1e0508,_0x1cf5a9,_0x5285aa,_0x48e52d){logger[_0xabc7('0x9')](_0xabc7('0xa'),_0x3f5134,_0x1e0508['id'],_0x1cf5a9,_0x5285aa,JSON[_0xabc7('0xb')](_0x48e52d));io['to'](_0x1cf5a9)[_0xabc7('0xc')](_0x5285aa,_0x48e52d);}exports[_0xabc7('0xd')]=function(_0x24535a,_0x2a78bc,_0x13e4db,_0x18d05c){var _0xa790d7,_0x1faa0d;var _0x324300={};var _0x33a7e0=Number(_0x13e4db[_0xabc7('0xe')]);var _0x145fab=_0x13e4db['data2']?Boolean(Number(_0x13e4db[_0xabc7('0xf')])):![];var _0x1126e9;if(_0x18d05c[_0xabc7('0x10')]){_0x324300['id']=_0x18d05c[_0xabc7('0x10')];}if(!_0x324300['id']){_0x324300[_0xabc7('0x11')]=_0x33a7e0;_0x1126e9=_0x13e4db[_0xabc7('0x12')]&&_0x13e4db['data3']!=='0'?_0x13e4db[_0xabc7('0x12')]['split'](','):[_0xabc7('0x13')];_0x324300[_0xabc7('0x14')]=_[_0xabc7('0x15')](_0x1126e9,function(_0x10ddf5){var _0x27e727={};_0x27e727[_0x10ddf5]=_0x18d05c[_0xabc7('0x16')]?_0x18d05c[_0xabc7('0x17')]:_0x18d05c[_0xabc7('0x18')];return _0x27e727;});}var _0x10031f=['id','firstName',_0xabc7('0x19'),_0xabc7('0x13'),'mobile','fax',_0xabc7('0x11'),_0xabc7('0x1a'),_0xabc7('0x1b'),_0xabc7('0x1c')];var _0x7d1848=_['union'](_0x10031f,_0x1126e9);BPromise['resolve']()[_0xabc7('0x1d')](cmContactRpc['getContacts']({'attributes':_0x7d1848,'where':_0x324300}))[_0xabc7('0x1d')](function(_0x15d03b){_0x1faa0d=_0x15d03b;if(!_[_0xabc7('0x1e')](_0x1faa0d)){if(_0x1faa0d[_0xabc7('0x1f')]===0x1){_0xa790d7=_0x1faa0d[0x0];logger[_0xabc7('0x9')](_0xabc7('0x20'),_0x18d05c[_0xabc7('0x21')],_0x2a78bc['id'],_0xa790d7['id']);}else{logger[_0xabc7('0x9')](_0xabc7('0x22'),_0x18d05c['uniqueid'],_0x2a78bc['id'],_[_0xabc7('0x15')](_0x1faa0d,'id')['join'](','));}return;}else{logger['info'](_0xabc7('0x23'),_0x18d05c[_0xabc7('0x21')],_0x2a78bc['id']);var _0x2792dd={'ListId':_0x33a7e0};var _0x586e97=_0x13e4db[_0xabc7('0x24')]&&_0x13e4db['data4']!=='0'?_0x13e4db[_0xabc7('0x24')]:_0xabc7('0x13');if(_0x145fab){logger[_0xabc7('0x9')](_0xabc7('0x25'),_0x18d05c['uniqueid'],_0x2a78bc['id']);_0x2792dd[_0x586e97]=_['isNil'](_0x18d05c[_0xabc7('0x16')])?_0x18d05c[_0xabc7('0x18')]:_0x18d05c[_0xabc7('0x17')];if(_[_0xabc7('0x26')](_0x18d05c[_0xabc7('0x16')])){_0x2792dd[_0xabc7('0x27')]=_0x18d05c['calleridname']&&_0x18d05c['calleridname']!==_0xabc7('0x28')?_0x18d05c['calleridname']:_0xabc7('0x29');}else{_0x2792dd[_0xabc7('0x27')]=_0x18d05c['destcalleridname']&&_0x18d05c[_0xabc7('0x2a')]!==_0xabc7('0x28')?_0x18d05c['destcalleridname']:_0xabc7('0x29');}return BPromise[_0xabc7('0x2b')]()[_0xabc7('0x1d')](cmContactRpc[_0xabc7('0x2c')](_0x2792dd))['then'](function(_0x3a459c){_0xa790d7=_0x3a459c;_0x1faa0d[_0xabc7('0x2d')](_0x3a459c);if(_0xa790d7){logger[_0xabc7('0x9')](_0xabc7('0x2e'),_0x18d05c['uniqueid'],_0x2a78bc['id'],_0xa790d7['id']);}return;});}else{logger['info'](_0xabc7('0x2f'),_0x18d05c[_0xabc7('0x21')],_0x2a78bc['id']);_0x2792dd[_0x586e97]=_[_0xabc7('0x26')](_0x18d05c['routeId'])?_0x18d05c[_0xabc7('0x18')]:_0x18d05c['destcalleridnum'];if(_[_0xabc7('0x26')](_0x18d05c[_0xabc7('0x16')])){_0x2792dd['firstName']=_0x18d05c[_0xabc7('0x30')]&&_0x18d05c['calleridname']!==_0xabc7('0x28')?_0x18d05c['calleridname']:_0xabc7('0x29');}else{_0x2792dd[_0xabc7('0x27')]=_0x18d05c[_0xabc7('0x2a')]&&_0x18d05c['destcalleridname']!==''?_0x18d05c['destcalleridname']:_0xabc7('0x29');}_0xa790d7=_0x2792dd;_0x1faa0d[_0xabc7('0x2d')](_0x2792dd);return;}}})[_0xabc7('0x1d')](function(){if(_0x24535a){emit(_0x18d05c[_0xabc7('0x21')],_0x2a78bc,util[_0xabc7('0x31')](_0xabc7('0x32'),_0x24535a[_0xabc7('0x33')]),util[_0xabc7('0x31')](_0xabc7('0x34'),_0x13e4db['action']['toLowerCase']()),{'evt':_[_0xabc7('0x35')](_0x18d05c,{'autoCreate':_0x145fab}),'contact':_0xa790d7===undefined?{}:_0xa790d7,'contacts':_0x1faa0d[_0xabc7('0x1f')]===0x0?undefined:_0x1faa0d});}});}; \ No newline at end of file +var _0x617b=['socket.io-emitter','[CM][%s][%s]','emit','exec','data1','data2','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','updatedAt','union','then','getContacts','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','isNil','calleridname','Unknown','firstName','destcalleridname','','resolve','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','redis','defaults'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x617b,0x95));var _0xb617=function(_0x221448,_0xd8a150){_0x221448=_0x221448-0x0;var _0x436694=_0x617b[_0x221448];return _0x436694;};'use strict';var _=require(_0xb617('0x0'));var BPromise=require('bluebird');var Redis=require(_0xb617('0x1'));var util=require('util');var config=require(_0xb617('0x2'));var logger=require(_0xb617('0x3'))(_0xb617('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0xb617('0x5')]=_[_0xb617('0x6')](config[_0xb617('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xb617('0x7'))(new Redis(config['redis']));function emit(_0x49cdf4,_0x16aef3,_0x435184,_0x212e29,_0x56f1bc){logger['info'](_0xb617('0x8'),_0x49cdf4,_0x16aef3['id'],_0x435184,_0x212e29,JSON['stringify'](_0x56f1bc));io['to'](_0x435184)[_0xb617('0x9')](_0x212e29,_0x56f1bc);}exports[_0xb617('0xa')]=function(_0x298ca1,_0xdf13d8,_0xc8c904,_0x55c0b8){var _0x391e5f,_0x4869ac;var _0x3a8b18={};var _0x788b64=Number(_0xc8c904[_0xb617('0xb')]);var _0x3a848c=_0xc8c904[_0xb617('0xc')]?Boolean(Number(_0xc8c904[_0xb617('0xc')])):![];var _0x561279;if(_0x55c0b8[_0xb617('0xd')]){_0x3a8b18['id']=_0x55c0b8[_0xb617('0xd')];}if(!_0x3a8b18['id']){_0x3a8b18['ListId']=_0x788b64;_0x561279=_0xc8c904[_0xb617('0xe')]&&_0xc8c904[_0xb617('0xe')]!=='0'?_0xc8c904[_0xb617('0xe')][_0xb617('0xf')](','):[_0xb617('0x10')];_0x3a8b18[_0xb617('0x11')]=_[_0xb617('0x12')](_0x561279,function(_0x4c44c3){var _0x5e8038={};_0x5e8038[_0x4c44c3]=_0x55c0b8[_0xb617('0x13')]?_0x55c0b8[_0xb617('0x14')]:_0x55c0b8[_0xb617('0x15')];return _0x5e8038;});}var _0x58d5b2=['id','firstName',_0xb617('0x16'),_0xb617('0x10'),_0xb617('0x17'),'fax','ListId','createdAt','scheduledAt',_0xb617('0x18')];var _0x1b6366=_[_0xb617('0x19')](_0x58d5b2,_0x561279);BPromise['resolve']()[_0xb617('0x1a')](cmContactRpc[_0xb617('0x1b')]({'attributes':_0x1b6366,'where':_0x3a8b18}))[_0xb617('0x1a')](function(_0x15d29f){_0x4869ac=_0x15d29f;if(!_[_0xb617('0x1c')](_0x4869ac)){if(_0x4869ac[_0xb617('0x1d')]===0x1){_0x391e5f=_0x4869ac[0x0];logger[_0xb617('0x1e')](_0xb617('0x1f'),_0x55c0b8[_0xb617('0x20')],_0xdf13d8['id'],_0x391e5f['id']);}else{logger[_0xb617('0x1e')](_0xb617('0x21'),_0x55c0b8[_0xb617('0x20')],_0xdf13d8['id'],_['map'](_0x4869ac,'id')[_0xb617('0x22')](','));}return;}else{logger[_0xb617('0x1e')](_0xb617('0x23'),_0x55c0b8['uniqueid'],_0xdf13d8['id']);var _0x365b6d={'ListId':_0x788b64};var _0x353630=_0xc8c904['data4']&&_0xc8c904['data4']!=='0'?_0xc8c904['data4']:_0xb617('0x10');if(_0x3a848c){logger[_0xb617('0x1e')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x55c0b8[_0xb617('0x20')],_0xdf13d8['id']);_0x365b6d[_0x353630]=_[_0xb617('0x24')](_0x55c0b8['routeId'])?_0x55c0b8[_0xb617('0x15')]:_0x55c0b8[_0xb617('0x14')];if(_['isNil'](_0x55c0b8[_0xb617('0x13')])){_0x365b6d['firstName']=_0x55c0b8[_0xb617('0x25')]&&_0x55c0b8[_0xb617('0x25')]!==''?_0x55c0b8[_0xb617('0x25')]:_0xb617('0x26');}else{_0x365b6d[_0xb617('0x27')]=_0x55c0b8['destcalleridname']&&_0x55c0b8[_0xb617('0x28')]!==_0xb617('0x29')?_0x55c0b8['destcalleridname']:_0xb617('0x26');}return BPromise[_0xb617('0x2a')]()['then'](cmContactRpc[_0xb617('0x2b')](_0x365b6d))['then'](function(_0xbb8450){_0x391e5f=_0xbb8450;_0x4869ac[_0xb617('0x2c')](_0xbb8450);if(_0x391e5f){logger[_0xb617('0x1e')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x55c0b8[_0xb617('0x20')],_0xdf13d8['id'],_0x391e5f['id']);}return;});}else{logger[_0xb617('0x1e')](_0xb617('0x2d'),_0x55c0b8[_0xb617('0x20')],_0xdf13d8['id']);_0x365b6d[_0x353630]=_['isNil'](_0x55c0b8[_0xb617('0x13')])?_0x55c0b8[_0xb617('0x15')]:_0x55c0b8[_0xb617('0x14')];if(_['isNil'](_0x55c0b8[_0xb617('0x13')])){_0x365b6d['firstName']=_0x55c0b8[_0xb617('0x25')]&&_0x55c0b8['calleridname']!==_0xb617('0x29')?_0x55c0b8[_0xb617('0x25')]:_0xb617('0x26');}else{_0x365b6d[_0xb617('0x27')]=_0x55c0b8[_0xb617('0x28')]&&_0x55c0b8[_0xb617('0x28')]!==_0xb617('0x29')?_0x55c0b8[_0xb617('0x28')]:_0xb617('0x26');}_0x391e5f=_0x365b6d;_0x4869ac[_0xb617('0x2c')](_0x365b6d);return;}}})['then'](function(){if(_0x298ca1){emit(_0x55c0b8[_0xb617('0x20')],_0xdf13d8,util['format'](_0xb617('0x2e'),_0x298ca1[_0xb617('0x2f')]),util['format'](_0xb617('0x30'),_0xc8c904[_0xb617('0x31')][_0xb617('0x32')]()),{'evt':_[_0xb617('0x33')](_0x55c0b8,{'autoCreate':_0x3a848c}),'contact':_0x391e5f===undefined?{}:_0x391e5f,'contacts':_0x4869ac[_0xb617('0x1d')]===0x0?undefined:_0x4869ac});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 4d17d7f..f4dc16b 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 _0x4be5=['custom:dialbegin','syncAgentDial','custom:dialconnect','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','stringify','clone','checkTriggers','interface','hasOwnProperty','status','variables','Actions','action','toLowerCase','data1','popup','TemplateId','data2','html','render','template\x20not\x20found','url','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','merge','jscripty','trigger:%s','contactmanager','integration','exec','queue','routeId','script','parse','query','search','replace','AllConditions','checkConditions','channel','AnyConditions','length','some','field','account','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','agent','membername','lastevent','exports','util','lodash','mustache','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','redis','localhost','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:timeout'];(function(_0x1fddd6,_0x35c1c8){var _0xdd2ba2=function(_0x39d1d7){while(--_0x39d1d7){_0x1fddd6['push'](_0x1fddd6['shift']());}};_0xdd2ba2(++_0x35c1c8);}(_0x4be5,0xc1));var _0x54be=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x4be5[_0x55f8b4];return _0x2475f9;};'use strict';var util=require(_0x54be('0x0'));var _=require(_0x54be('0x1'));var url=require('url');var Mustache=require(_0x54be('0x2'));var Redis=require('ioredis');var urlforward=require(_0x54be('0x3'));var integration=require(_0x54be('0x4'));var cmContact=require(_0x54be('0x5'));var script=require(_0x54be('0x6'));var config=require(_0x54be('0x7'));var logger=require(_0x54be('0x8'))('trigger');var ami=require('../ami');config[_0x54be('0x9')]=_['defaults'](config[_0x54be('0x9')],{'host':_0x54be('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x54be('0x9')]));var operators={'equals':function(_0x2ca0f2,_0x119af3){return _0x2ca0f2==_0x119af3;},'not_equals':function(_0x2045eb,_0x529144){return _0x2045eb!=_0x529144;}};var barAndWebActions=['popup','url','winapp'];function Trigger(_0x4e89ce){this[_0x54be('0xb')]=_0x4e89ce[_0x54be('0xb')];this['agents']=_0x4e89ce[_0x54be('0xc')];this['voiceQueues']=_0x4e89ce[_0x54be('0xd')];this[_0x54be('0xe')]=_0x4e89ce[_0x54be('0xe')];this[_0x54be('0xf')]=_0x4e89ce[_0x54be('0xf')];this['zendeskAccounts']=_0x4e89ce[_0x54be('0x10')];this[_0x54be('0x11')]=_0x4e89ce[_0x54be('0x11')];this[_0x54be('0x12')]=_0x4e89ce[_0x54be('0x12')];this[_0x54be('0x13')]=_0x4e89ce[_0x54be('0x13')];this[_0x54be('0x14')]=_0x4e89ce[_0x54be('0x14')];this[_0x54be('0x15')]=_0x4e89ce[_0x54be('0x15')];this[_0x54be('0x16')]=_0x4e89ce[_0x54be('0x16')];this[_0x54be('0x17')]=_0x4e89ce[_0x54be('0x17')];this[_0x54be('0x18')]=_0x4e89ce[_0x54be('0x18')];this['freshsalesAccounts']=_0x4e89ce[_0x54be('0x19')];this[_0x54be('0x1a')]={'zendesk':this[_0x54be('0x10')],'salesforce':this[_0x54be('0x12')],'freshdesk':this[_0x54be('0x11')],'sugarcrm':this[_0x54be('0x13')],'zoho':this['zohoAccounts'],'desk':this['deskAccounts'],'vtiger':this[_0x54be('0x16')],'dynamics365':this[_0x54be('0x18')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x54be('0x17')]};ami['on']('custom:agentcalled',this[_0x54be('0x1b')]['bind'](this));ami['on'](_0x54be('0x1c'),this[_0x54be('0x1b')][_0x54be('0x1d')](this));ami['on'](_0x54be('0x1e'),this['syncCustomEvent'][_0x54be('0x1d')](this));ami['on'](_0x54be('0x1f'),this[_0x54be('0x1b')]['bind'](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent'][_0x54be('0x1d')](this));ami['on'](_0x54be('0x20'),this[_0x54be('0x1b')]['bind'](this));ami['on'](_0x54be('0x21'),this['syncCustomEvent'][_0x54be('0x1d')](this));ami['on'](_0x54be('0x22'),this[_0x54be('0x1b')]['bind'](this));ami['on'](_0x54be('0x23'),this[_0x54be('0x1b')][_0x54be('0x1d')](this));ami['on']('custom:queuecallerabandon',this[_0x54be('0x1b')][_0x54be('0x1d')](this));ami['on'](_0x54be('0x24'),this[_0x54be('0x1b')]['bind'](this));ami['on'](_0x54be('0x25'),this[_0x54be('0x26')][_0x54be('0x1d')](this));ami['on'](_0x54be('0x27'),this['syncAgentDial'][_0x54be('0x1d')](this));ami['on']('custom:dialend',this[_0x54be('0x26')]['bind'](this));ami['on']('custom:newinteraction',this[_0x54be('0x1b')][_0x54be('0x1d')](this));ami['on'](_0x54be('0x28'),this[_0x54be('0x1b')][_0x54be('0x1d')](this));ami['on']('custom:incomingmessage',this[_0x54be('0x1b')]['bind'](this));ami['on'](_0x54be('0x29'),this[_0x54be('0x1b')][_0x54be('0x1d')](this));ami['on'](_0x54be('0x2a'),this[_0x54be('0x1b')][_0x54be('0x1d')](this));ami['on'](_0x54be('0x2b'),this['syncCustomEvent'][_0x54be('0x1d')](this));}Trigger[_0x54be('0x2c')][_0x54be('0x2d')]=function(_0x304952,_0x55ae24,_0x51da38){logger['info'](_0x304952,_0x55ae24,JSON[_0x54be('0x2e')](_0x51da38));io['to'](_0x304952)[_0x54be('0x2d')](_0x55ae24,_0x51da38);};Trigger[_0x54be('0x2c')][_0x54be('0x1b')]=function(_0x480e0d){var _0x11efe0=_[_0x54be('0x2f')](_0x480e0d);this[_0x54be('0x30')](_0x11efe0);};Trigger[_0x54be('0x2c')]['syncAgentDial']=function(_0x3bb166){if(this['agents'][_0x3bb166[_0x54be('0x31')]]){this[_0x54be('0x1b')](_0x3bb166);}};Trigger[_0x54be('0x2c')]['checkTriggers']=function(_0x414db5){var _0x20655a;for(var _0x1b559d in this['triggers']){if(this[_0x54be('0xb')][_0x54be('0x32')](_0x1b559d)){if(this[_0x54be('0xb')][_0x1b559d][_0x54be('0x33')]){_0x20655a=this['checkTrigger'](this['triggers'][_0x1b559d],_0x414db5);if(_0x20655a){_['merge'](_0x414db5,_0x414db5[_0x54be('0x34')]);for(var _0x5ab6ed=0x0,_0x54f972,_0x4fb8e2,_0x1b095a;_0x5ab6ed0x0){_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(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 146f2d6..6fb2071 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 _0xe8d5=['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',']\x20The\x20User\x20ID\x20is:','userEmail',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','POST','clientId','remoteUri','username','password','then','access_token','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','customField','idField','indexOf','incident','incidents','assign','getString','Descriptions','/contacts(','ticketType','phonecalls','Subjects','callDirection','queue','Fields','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/'];(function(_0x5e8a97,_0x168a0b){var _0x194f31=function(_0x2d24ad){while(--_0x2d24ad){_0x5e8a97['push'](_0x5e8a97['shift']());}};_0x194f31(++_0x168a0b);}(_0xe8d5,0xd7));var _0x5e8d=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xe8d5[_0x576170];return _0x397c70;};'use strict';var _=require(_0x5e8d('0x0'));var BPromise=require(_0x5e8d('0x1'));var rp=require(_0x5e8d('0x2'));var util=require(_0x5e8d('0x3'));var intUtil=require('./util');var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x5e8d('0x4'))(_0x5e8d('0x5'));var config=require(_0x5e8d('0x6'));config[_0x5e8d('0x7')]=_[_0x5e8d('0x8')](config[_0x5e8d('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5e8d('0x7')]));function getAuthToken(_0x59672f,_0x528d14,_0xbb73c){var _0x57033e={'method':_0x5e8d('0x9'),'uri':_0x528d14,'form':{'client_id':_0x59672f[_0x5e8d('0xa')],'resource':_0x59672f[_0x5e8d('0xb')],'username':_0x59672f[_0x5e8d('0xc')],'password':_0x59672f[_0x5e8d('0xd')],'grant_type':_0x5e8d('0xd'),'client_secret':_0x59672f['clientSecret']},'json':!![]};return rp(_0x57033e)[_0x5e8d('0xe')](function(_0x512d5d){return _0x512d5d[_0x5e8d('0xf')];})['catch'](function(_0x1fc454){logger[_0x5e8d('0x10')]('['+[_0xbb73c[_0x5e8d('0x11')]()]+']\x20Wrong\x20credentials!');return _0x1fc454[_0x5e8d('0x12')];});}function getUser(_0x137847,_0x2e9a51,_0x2e277e,_0x14c23d,_0x31fe11,_0x3a8e32){return new BPromise(function(_0x5714b3,_0x4f8004){return getAuthToken(_0x2e9a51,_0x14c23d,_0x3a8e32)[_0x5e8d('0xe')](function(_0x1f40c3){var _0x59c916={'method':_0x5e8d('0x13'),'uri':_0x31fe11+_0x5e8d('0x14'),'headers':{'Authorization':_0x5e8d('0x15')+_0x1f40c3,'OData-Version':_0x5e8d('0x16')},'json':!![]};return rp(_0x59c916);})[_0x5e8d('0xe')](function(_0x39d0db){var _0x459231=_0x39d0db[_0x5e8d('0x17')];var _0x17f875=![];var _0xf2db0d=null;if(!_[_0x5e8d('0x18')](_0x2e277e)){if(intUtil[_0x5e8d('0x19')](_0x2e277e[_0x5e8d('0x1a')])){_0x137847['userEmail']=_0x2e277e[_0x5e8d('0x1a')];for(_0xf2db0d=0x0;_0xf2db0d<_0x459231[_0x5e8d('0x1b')];_0xf2db0d++){if(_0x459231[_0xf2db0d][_0x5e8d('0x1c')]===_0x2e277e['email']&&!_0x459231[_0xf2db0d]['isdisabled']){_0x17f875=!![];logger[_0x5e8d('0x1d')]('['+[_0x3a8e32[_0x5e8d('0x11')]()]+_0x5e8d('0x1e')+_0x459231[_0xf2db0d][_0x5e8d('0x1f')]+'!');_0x137847[_0x5e8d('0x20')]=_0x459231[_0xf2db0d]['systemuserid'];}}}}if(!_0x17f875){logger['info']('['+[_0x3a8e32[_0x5e8d('0x11')]()]+_0x5e8d('0x21'));_0x137847['userEmail']=_0x2e9a51[_0x5e8d('0xc')];for(_0xf2db0d=0x0;_0xf2db0d<_0x459231[_0x5e8d('0x1b')];_0xf2db0d++){if(_0x459231[_0xf2db0d][_0x5e8d('0x1c')]===_0x2e9a51[_0x5e8d('0xc')]){_0x137847[_0x5e8d('0x20')]=_0x459231[_0xf2db0d][_0x5e8d('0x1f')];}}}_0x5714b3(_0x137847);})[_0x5e8d('0x22')](function(_0x27c42d){_0x4f8004(_0x27c42d[_0x5e8d('0x12')]);});});}function createEndUser(_0x5ec04c,_0x305853,_0x3f1059,_0x2d2a5c,_0x520f73,_0x192445){return new BPromise(function(_0xbb86ef,_0x4e7933){return getAuthToken(_0x305853,_0x3f1059,_0x192445)['then'](function(_0x212932){var _0x88a511=_0x192445[_0x5e8d('0x23')]()===_0x5e8d('0x24')?_0x520f73[_0x5e8d('0x25')]:_0x520f73[_0x5e8d('0x26')];var _0x18403b={'method':_0x5e8d('0x9'),'uri':_0x2d2a5c+_0x5e8d('0x27'),'body':{'telephone1':_0x88a511,'fullname':_0x88a511,'firstname':_0x88a511,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5e8d('0x28')+_0x5ec04c[_0x5e8d('0x20')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x212932,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x18403b);})['then'](function(_0xa965c7){var _0x105688=_0xa965c7['headers'][_0x5e8d('0x29')];var _0x34a04a=_0x105688[_0x5e8d('0x2a')](_0x105688[_0x5e8d('0x2b')]('(')+0x1,_0x105688[_0x5e8d('0x2b')](')'));_0x5ec04c[_0x5e8d('0x2c')]=_0x34a04a;_0xbb86ef(_0x5ec04c);})['catch'](function(_0x30b278){_0x4e7933(_0x30b278['message']);});});}function getEndUser(_0x1c7ee1,_0x561c3a,_0x32fd7f,_0x1fa5a9,_0x18ad73,_0x4d9790){return new BPromise(function(_0x10bab3,_0x2b2902){return getAuthToken(_0x561c3a,_0x32fd7f,_0x4d9790)[_0x5e8d('0xe')](function(_0x3b500b){var _0x414635={'method':_0x5e8d('0x13'),'uri':_0x1fa5a9+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0x3b500b,'If-None-Match':null,'OData-Version':_0x5e8d('0x16')},'json':!![]};return rp(_0x414635);})[_0x5e8d('0xe')](function(_0x4324d3){var _0x361b96=null;if(_0x4324d3){var _0x117530=_0x4324d3['value'];var _0x3ef2c1=![];for(_0x361b96=0x0;_0x361b96<_0x117530[_0x5e8d('0x1b')];_0x361b96++){var _0x34d8cd=_0x4d9790[_0x5e8d('0x23')]()===_0x5e8d('0x24')?_0x18ad73[_0x5e8d('0x25')]:_0x18ad73['calleridnum'];if(_0x117530[_0x361b96][_0x5e8d('0x2d')]===_0x34d8cd){_0x3ef2c1=!![];_0x1c7ee1['enduserId']=_0x117530[_0x361b96][_0x5e8d('0x2e')];}}if(_0x3ef2c1){_0x10bab3(_0x1c7ee1);}else{return createEndUser(_0x1c7ee1,_0x561c3a,_0x32fd7f,_0x1fa5a9,_0x18ad73,_0x4d9790)[_0x5e8d('0xe')](function(_0x3c6cab){logger[_0x5e8d('0x1d')]('['+[_0x4d9790[_0x5e8d('0x11')]()]+_0x5e8d('0x2f'),_0x3c6cab['enduserId']);_0x10bab3(_0x3c6cab);});}}else{return createEndUser(_0x1c7ee1,_0x561c3a,_0x32fd7f,_0x1fa5a9,_0x18ad73,_0x4d9790)[_0x5e8d('0xe')](function(_0x32816a){logger[_0x5e8d('0x1d')]('['+[_0x4d9790[_0x5e8d('0x11')]()]+_0x5e8d('0x30'),_0x32816a[_0x5e8d('0x2c')]);_0x10bab3(_0x32816a);});}});});}function getCustomFields(_0x16cbab,_0x325432,_0x277c1f){var _0x245d5c={};if(_0x16cbab[_0x5e8d('0x1b')]>0x0){_[_0x5e8d('0x31')](_0x16cbab,function(_0x1cfd0e){if(_0x1cfd0e[_0x5e8d('0x32')]===_0x5e8d('0x33')&&_0x1cfd0e[_0x5e8d('0x34')]&&!_0x1cfd0e[_0x5e8d('0x35')]){var _0x1f2893=_0x1cfd0e[_0x5e8d('0x36')][_0x5e8d('0x23')]();var _0x3f2e95=_0x1f2893[_0x5e8d('0x2a')](0x0,_0x1f2893['indexOf']('_'));var _0x5d733d=_0x1f2893[_0x5e8d('0x2a')](_0x1f2893[_0x5e8d('0x37')]('_')+0x1);if(_0x3f2e95===_0x277c1f){_0x245d5c[_0x5d733d]=_0x1cfd0e['content'];}}});}return _0x245d5c;}function getTicket(_0x170b2e,_0x1d142a,_0x53a048,_0x3c2a09,_0x1d5641,_0x94b987,_0x42ccc9){return new BPromise(function(_0x42c4f6,_0x26dd61){var _0x448988;return getAuthToken(_0x1d142a,_0x53a048,_0x42ccc9)[_0x5e8d('0xe')](function(_0x23d4b5){if(_0x94b987['ticketType']===_0x5e8d('0x38')){_0x448988={'method':_0x5e8d('0x9'),'uri':_0x3c2a09+_0x5e8d('0x39'),'body':Object[_0x5e8d('0x3a')]({},{'title':intUtil[_0x5e8d('0x3b')](_0x94b987['Subjects'],_0x1d5641,'\x20'),'description':intUtil['getString'](_0x94b987[_0x5e8d('0x3c')],_0x1d5641,'\x0a'),'customerid_contact@odata.bind':_0x5e8d('0x3d')+_0x170b2e[_0x5e8d('0x2c')]+')','ownerid@odata.bind':_0x5e8d('0x28')+_0x170b2e[_0x5e8d('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x94b987['Fields'],_0x1d5641,_0x94b987['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x23d4b5,'OData-Version':_0x5e8d('0x16')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x94b987[_0x5e8d('0x3e')]==='phonecall'){_0x448988={'method':_0x5e8d('0x9'),'uri':_0x3c2a09+_0x5e8d('0x3f'),'body':Object['assign']({},{'subject':intUtil[_0x5e8d('0x3b')](_0x94b987[_0x5e8d('0x40')],_0x1d5641,'\x20'),'phonenumber':String(_0x1d5641[_0x5e8d('0x26')]),'description':intUtil[_0x5e8d('0x3b')](_0x94b987[_0x5e8d('0x3c')],_0x1d5641,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5e8d('0x3d')+_0x170b2e['enduserId']+')','ownerid@odata.bind':_0x5e8d('0x28')+_0x170b2e[_0x5e8d('0x20')]+')','directioncode':_0x170b2e[_0x5e8d('0x41')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x5e8d('0x28')+_0x170b2e[_0x5e8d('0x20')]+')','participationtypemask':_0x170b2e['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x5e8d('0x3d')+_0x170b2e[_0x5e8d('0x2c')]+')','participationtypemask':_0x170b2e[_0x5e8d('0x41')]===_0x5e8d('0x42')?0x1:0x2}]},getCustomFields(_0x94b987[_0x5e8d('0x43')],_0x1d5641,_0x94b987['ticketType'])),'headers':{'Authorization':_0x5e8d('0x15')+_0x23d4b5,'OData-Version':_0x5e8d('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x448988);})[_0x5e8d('0xe')](function(_0x47911b){var _0x156467=_0x47911b[_0x5e8d('0x44')][_0x5e8d('0x29')];var _0x1a011a=_0x156467[_0x5e8d('0x2a')](_0x156467[_0x5e8d('0x2b')]('(')+0x1,_0x156467[_0x5e8d('0x2b')](')'));_0x170b2e[_0x5e8d('0x45')]=_0x1a011a;_0x42c4f6(_0x170b2e);})[_0x5e8d('0x22')](function(_0x55b9dc){_0x26dd61(_0x55b9dc['message']);});});}function emit(_0x472499,_0x3a1634,_0xaf6134,_0x10b5d8){var _0x507f8f={'uri':util[_0x5e8d('0x46')](_0x5e8d('0x47'),_0x472499,_0xaf6134,_0x10b5d8)};io['to'](util['format'](_0x5e8d('0x48'),_0x3a1634))[_0x5e8d('0x49')](_0x5e8d('0x4a'),_0x507f8f);}exports['cs']=function(_0x41abc3,_0x433ce4,_0x33b8ba,_0x319c5a,_0x2e1c13,_0x439ec9,_0x426290,_0x52efbd){var _0xa0333={};_0x439ec9['remoteUri']=intUtil[_0x5e8d('0x4b')](_0x439ec9[_0x5e8d('0xb')]);_0x439ec9[_0x5e8d('0x4c')]=intUtil[_0x5e8d('0x4b')](_0x439ec9['serverUrl']);_0xa0333['callDirection']=_0x52efbd===_0x5e8d('0x42')||_0x52efbd===_0x5e8d('0x4d')?_0x5e8d('0x42'):'outbound';var _0x410d61=util['format'](_0x5e8d('0x4e'),_0x439ec9[_0x5e8d('0xb')]);var _0x255e39=util[_0x5e8d('0x46')](_0x5e8d('0x4f'),_0x439ec9[_0x5e8d('0x50')]);var _0xb0a863=util[_0x5e8d('0x46')](_0x5e8d('0x51'),_0x439ec9[_0x5e8d('0x4c')],_0x433ce4[_0x5e8d('0x52')],md5(_0x433ce4[_0x5e8d('0x52')]));if(_0x2e1c13&&_0x2e1c13[_0x5e8d('0x53')]){logger[_0x5e8d('0x1d')](_0x5e8d('0x54'),_0x5e8d('0x55'));_0x433ce4[_0x5e8d('0x56')]=_0xb0a863;}else if(_0x426290&&_0x426290[_0x5e8d('0x57')]&&_0x426290[_0x5e8d('0x57')]!==_0x5e8d('0x58')){logger[_0x5e8d('0x1d')]('[OUTBOUND]',_0x5e8d('0x55'));_0x433ce4[_0x5e8d('0x56')]=_0xb0a863;}else{_0x433ce4[_0x5e8d('0x56')]='';}return getUser(_0xa0333,_0x439ec9,_0x319c5a,_0x255e39,_0x410d61,_0x52efbd)[_0x5e8d('0xe')](function(_0xc75d3e){logger[_0x5e8d('0x1d')]('['+_0x52efbd['toUpperCase']()+_0x5e8d('0x59'),_0xc75d3e[_0x5e8d('0x20')]);logger[_0x5e8d('0x1d')]('['+_0x52efbd['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0xc75d3e[_0x5e8d('0x5a')]);return getEndUser(_0xc75d3e,_0x439ec9,_0x255e39,_0x410d61,_0x433ce4,_0x52efbd);})['then'](function(_0x3ddf8e){logger[_0x5e8d('0x1d')]('['+_0x52efbd['toUpperCase']()+_0x5e8d('0x5b'),_0x3ddf8e['enduserId']);logger[_0x5e8d('0x1d')]('['+_0x52efbd['toUpperCase']()+_0x5e8d('0x5c'),_0x433ce4[_0x5e8d('0x26')]);return getTicket(_0x3ddf8e,_0x439ec9,_0x255e39,_0x410d61,_0x433ce4,_0x33b8ba,_0x52efbd);})[_0x5e8d('0xe')](function(_0x22c698){logger['info'](util['format']('['+_0x52efbd[_0x5e8d('0x11')]()+_0x5e8d('0x5d'),_0x33b8ba[_0x5e8d('0x3e')],_0x22c698[_0x5e8d('0x45')]));logger[_0x5e8d('0x1d')](util['format']('['+_0x52efbd[_0x5e8d('0x11')]()+_0x5e8d('0x5e'),_0x52efbd));if(_0x52efbd!==_0x5e8d('0x4d')){logger['info']('['+_0x52efbd['toUpperCase']()+']',_0x5e8d('0x5f'));emit(_0x439ec9['remoteUri'],_0x319c5a[_0x5e8d('0x60')],_0x33b8ba['ticketType'],_0x22c698['ticketId']);}})['catch'](function(_0x59373b){logger[_0x5e8d('0x10')]('['+_0x52efbd[_0x5e8d('0x11')]()+_0x5e8d('0x61'),util['inspect'](_0x59373b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x10d4=['getString','Descriptions','Fields','phonecall','phonecalls','assign','/contacts(','/systemusers(','callDirection','queue','headers','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','ioredis','dynamics365','../../../../config/environment','redis','POST','clientId','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','catch','toLowerCase','outbound','calleridnum','contacts','odata-entityid','enduserId','destcalleridnum','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','customField','idField','substring','indexOf','ticketType','incidents'];(function(_0x4f3c9b,_0x28e078){var _0x84e58a=function(_0x37bf49){while(--_0x37bf49){_0x4f3c9b['push'](_0x4f3c9b['shift']());}};_0x84e58a(++_0x28e078);}(_0x10d4,0x147));var _0x410d=function(_0x4cb8e7,_0x2e1d22){_0x4cb8e7=_0x4cb8e7-0x0;var _0x3d0188=_0x10d4[_0x4cb8e7];return _0x3d0188;};'use strict';var _=require(_0x410d('0x0'));var BPromise=require(_0x410d('0x1'));var rp=require(_0x410d('0x2'));var util=require(_0x410d('0x3'));var intUtil=require(_0x410d('0x4'));var md5=require('md5');var Redis=require(_0x410d('0x5'));var logger=require('../../../../config/logger')(_0x410d('0x6'));var config=require(_0x410d('0x7'));config[_0x410d('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x3125be,_0x8fb3cc,_0x591df0){var _0x32ac44={'method':_0x410d('0x9'),'uri':_0x8fb3cc,'form':{'client_id':_0x3125be[_0x410d('0xa')],'resource':_0x3125be['remoteUri'],'username':_0x3125be['username'],'password':_0x3125be[_0x410d('0xb')],'grant_type':_0x410d('0xb'),'client_secret':_0x3125be[_0x410d('0xc')]},'json':!![]};return rp(_0x32ac44)[_0x410d('0xd')](function(_0x5ed7cb){return _0x5ed7cb[_0x410d('0xe')];})['catch'](function(_0x15a7ac){logger[_0x410d('0xf')]('['+[_0x591df0[_0x410d('0x10')]()]+_0x410d('0x11'));return _0x15a7ac[_0x410d('0x12')];});}function getUser(_0x12bdd0,_0x33339b,_0x29248a,_0x43151e,_0x8c1b50,_0x4dfc7e){return new BPromise(function(_0x402487,_0x1f6e33){return getAuthToken(_0x33339b,_0x43151e,_0x4dfc7e)['then'](function(_0x55e34c){var _0x4fb71f={'method':_0x410d('0x13'),'uri':_0x8c1b50+_0x410d('0x14'),'headers':{'Authorization':_0x410d('0x15')+_0x55e34c,'OData-Version':_0x410d('0x16')},'json':!![]};return rp(_0x4fb71f);})[_0x410d('0xd')](function(_0x19f2a3){var _0x56c2a1=_0x19f2a3[_0x410d('0x17')];var _0x3de797=![];var _0x11ff63=null;if(!_[_0x410d('0x18')](_0x29248a)){if(intUtil['validateEmail'](_0x29248a[_0x410d('0x19')])){_0x12bdd0['userEmail']=_0x29248a['email'];for(_0x11ff63=0x0;_0x11ff63<_0x56c2a1[_0x410d('0x1a')];_0x11ff63++){if(_0x56c2a1[_0x11ff63][_0x410d('0x1b')]===_0x29248a['email']&&!_0x56c2a1[_0x11ff63][_0x410d('0x1c')]){_0x3de797=!![];logger[_0x410d('0x1d')]('['+[_0x4dfc7e[_0x410d('0x10')]()]+_0x410d('0x1e')+_0x56c2a1[_0x11ff63][_0x410d('0x1f')]+'!');_0x12bdd0[_0x410d('0x20')]=_0x56c2a1[_0x11ff63][_0x410d('0x1f')];}}}}if(!_0x3de797){logger[_0x410d('0x1d')]('['+[_0x4dfc7e[_0x410d('0x10')]()]+_0x410d('0x21'));_0x12bdd0[_0x410d('0x22')]=_0x33339b[_0x410d('0x23')];for(_0x11ff63=0x0;_0x11ff63<_0x56c2a1[_0x410d('0x1a')];_0x11ff63++){if(_0x56c2a1[_0x11ff63][_0x410d('0x1b')]===_0x33339b['username']){_0x12bdd0[_0x410d('0x20')]=_0x56c2a1[_0x11ff63]['systemuserid'];}}}_0x402487(_0x12bdd0);})[_0x410d('0x24')](function(_0xd61d4b){_0x1f6e33(_0xd61d4b[_0x410d('0x12')]);});});}function createEndUser(_0x3e81c5,_0x5cee9c,_0x195245,_0x3f9f7e,_0x2ed603,_0x33340e){return new BPromise(function(_0x2fdd29,_0x16a539){return getAuthToken(_0x5cee9c,_0x195245,_0x33340e)['then'](function(_0x5a438e){var _0x2ea6e6=_0x33340e[_0x410d('0x25')]()===_0x410d('0x26')?_0x2ed603['destcalleridnum']:_0x2ed603[_0x410d('0x27')];var _0x2ee48a={'method':_0x410d('0x9'),'uri':_0x3f9f7e+_0x410d('0x28'),'body':{'telephone1':_0x2ea6e6,'fullname':_0x2ea6e6,'firstname':_0x2ea6e6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3e81c5['userId']+')'},'headers':{'Authorization':_0x410d('0x15')+_0x5a438e,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2ee48a);})[_0x410d('0xd')](function(_0x1986d3){var _0x3a5238=_0x1986d3['headers'][_0x410d('0x29')];var _0xd53fd2=_0x3a5238['substring'](_0x3a5238['lastIndexOf']('(')+0x1,_0x3a5238['lastIndexOf'](')'));_0x3e81c5[_0x410d('0x2a')]=_0xd53fd2;_0x2fdd29(_0x3e81c5);})['catch'](function(_0x3bd780){_0x16a539(_0x3bd780['message']);});});}function getEndUser(_0x220c9e,_0x18ef5b,_0x185efc,_0x3250a7,_0x43087f,_0x59929f){return new BPromise(function(_0x2096e5,_0x5975ad){return getAuthToken(_0x18ef5b,_0x185efc,_0x59929f)[_0x410d('0xd')](function(_0x2321cb){var _0x5122ca={'method':_0x410d('0x13'),'uri':_0x3250a7+'contacts?$select=telephone1','headers':{'Authorization':_0x410d('0x15')+_0x2321cb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5122ca);})[_0x410d('0xd')](function(_0x26dc59){var _0x5e1ef2=null;if(_0x26dc59){var _0xdfaf80=_0x26dc59['value'];var _0x3d72fd=![];for(_0x5e1ef2=0x0;_0x5e1ef2<_0xdfaf80['length'];_0x5e1ef2++){var _0x2b52c0=_0x59929f[_0x410d('0x25')]()===_0x410d('0x26')?_0x43087f[_0x410d('0x2b')]:_0x43087f[_0x410d('0x27')];if(_0xdfaf80[_0x5e1ef2]['telephone1']===_0x2b52c0){_0x3d72fd=!![];_0x220c9e['enduserId']=_0xdfaf80[_0x5e1ef2][_0x410d('0x2c')];}}if(_0x3d72fd){_0x2096e5(_0x220c9e);}else{return createEndUser(_0x220c9e,_0x18ef5b,_0x185efc,_0x3250a7,_0x43087f,_0x59929f)['then'](function(_0x45633c){logger[_0x410d('0x1d')]('['+[_0x59929f[_0x410d('0x10')]()]+_0x410d('0x2d'),_0x45633c[_0x410d('0x2a')]);_0x2096e5(_0x45633c);});}}else{return createEndUser(_0x220c9e,_0x18ef5b,_0x185efc,_0x3250a7,_0x43087f,_0x59929f)['then'](function(_0x21b043){logger['info']('['+[_0x59929f[_0x410d('0x10')]()]+_0x410d('0x2e'),_0x21b043[_0x410d('0x2a')]);_0x2096e5(_0x21b043);});}});});}function getCustomFields(_0x3458f9,_0x22dd39,_0x1e8002){var _0x1c57d={};if(_0x3458f9['length']>0x0){_[_0x410d('0x2f')](_0x3458f9,function(_0x231b8a){if(_0x231b8a[_0x410d('0x30')]===_0x410d('0x31')&&_0x231b8a[_0x410d('0x32')]&&!_0x231b8a[_0x410d('0x33')]){var _0x3da81e=_0x231b8a[_0x410d('0x34')][_0x410d('0x25')]();var _0x2148f2=_0x3da81e[_0x410d('0x35')](0x0,_0x3da81e[_0x410d('0x36')]('_'));var _0x3ef114=_0x3da81e[_0x410d('0x35')](_0x3da81e['indexOf']('_')+0x1);if(_0x2148f2===_0x1e8002){_0x1c57d[_0x3ef114]=_0x231b8a['content'];}}});}return _0x1c57d;}function getTicket(_0x247e26,_0x59bc77,_0x36b4b4,_0x5e5075,_0x56070e,_0x4bbcb4,_0x4241e6){return new BPromise(function(_0x29a3db,_0x281238){var _0x4425ef;return getAuthToken(_0x59bc77,_0x36b4b4,_0x4241e6)[_0x410d('0xd')](function(_0x4e4283){if(_0x4bbcb4[_0x410d('0x37')]==='incident'){_0x4425ef={'method':'POST','uri':_0x5e5075+_0x410d('0x38'),'body':Object['assign']({},{'title':intUtil['getString'](_0x4bbcb4['Subjects'],_0x56070e,'\x20'),'description':intUtil[_0x410d('0x39')](_0x4bbcb4[_0x410d('0x3a')],_0x56070e,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x247e26[_0x410d('0x2a')]+')','ownerid@odata.bind':'/systemusers('+_0x247e26[_0x410d('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x4bbcb4[_0x410d('0x3b')],_0x56070e,_0x4bbcb4[_0x410d('0x37')])),'headers':{'Authorization':_0x410d('0x15')+_0x4e4283,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4bbcb4[_0x410d('0x37')]===_0x410d('0x3c')){_0x4425ef={'method':_0x410d('0x9'),'uri':_0x5e5075+_0x410d('0x3d'),'body':Object[_0x410d('0x3e')]({},{'subject':intUtil[_0x410d('0x39')](_0x4bbcb4['Subjects'],_0x56070e,'\x20'),'phonenumber':String(_0x56070e[_0x410d('0x27')]),'description':intUtil[_0x410d('0x39')](_0x4bbcb4[_0x410d('0x3a')],_0x56070e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x410d('0x3f')+_0x247e26[_0x410d('0x2a')]+')','ownerid@odata.bind':_0x410d('0x40')+_0x247e26[_0x410d('0x20')]+')','directioncode':_0x247e26[_0x410d('0x41')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x410d('0x40')+_0x247e26[_0x410d('0x20')]+')','participationtypemask':_0x247e26[_0x410d('0x41')]===_0x410d('0x42')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x247e26[_0x410d('0x2a')]+')','participationtypemask':_0x247e26[_0x410d('0x41')]===_0x410d('0x42')?0x1:0x2}]},getCustomFields(_0x4bbcb4[_0x410d('0x3b')],_0x56070e,_0x4bbcb4['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x4e4283,'OData-Version':_0x410d('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4425ef);})[_0x410d('0xd')](function(_0x245eb3){var _0x4f17d1=_0x245eb3[_0x410d('0x43')]['odata-entityid'];var _0x4c1299=_0x4f17d1['substring'](_0x4f17d1[_0x410d('0x44')]('(')+0x1,_0x4f17d1[_0x410d('0x44')](')'));_0x247e26[_0x410d('0x45')]=_0x4c1299;_0x29a3db(_0x247e26);})[_0x410d('0x24')](function(_0x10d27d){_0x281238(_0x10d27d[_0x410d('0x12')]);});});}function emit(_0x4161d6,_0x198fc4,_0x259661,_0xd60144){var _0x5ebc54={'uri':util[_0x410d('0x46')](_0x410d('0x47'),_0x4161d6,_0x259661,_0xd60144)};io['to'](util[_0x410d('0x46')](_0x410d('0x48'),_0x198fc4))['emit'](_0x410d('0x49'),_0x5ebc54);}exports['cs']=function(_0x37feb1,_0x474b68,_0x399455,_0x34bb60,_0x1d5186,_0x4b8381,_0x189ac7,_0x16eaab){var _0x18a23f={};_0x4b8381[_0x410d('0x4a')]=intUtil[_0x410d('0x4b')](_0x4b8381[_0x410d('0x4a')]);_0x4b8381['serverUrl']=intUtil[_0x410d('0x4b')](_0x4b8381[_0x410d('0x4c')]);_0x18a23f[_0x410d('0x41')]=_0x16eaab===_0x410d('0x42')||_0x16eaab===_0x410d('0x4d')?'queue':_0x410d('0x26');var _0xe91ca8=util['format'](_0x410d('0x4e'),_0x4b8381[_0x410d('0x4a')]);var _0xf056a3=util[_0x410d('0x46')](_0x410d('0x4f'),_0x4b8381[_0x410d('0x50')]);var _0x4fe17b=util[_0x410d('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b8381['serverUrl'],_0x474b68[_0x410d('0x51')],md5(_0x474b68[_0x410d('0x51')]));if(_0x1d5186&&_0x1d5186[_0x410d('0x52')]){logger['info'](_0x410d('0x53'),_0x410d('0x54'));_0x474b68['recordingURL']=_0x4fe17b;}else if(_0x189ac7&&_0x189ac7['recordingFormat']&&_0x189ac7['recordingFormat']!==_0x410d('0x55')){logger['info'](_0x410d('0x56'),_0x410d('0x54'));_0x474b68[_0x410d('0x57')]=_0x4fe17b;}else{_0x474b68[_0x410d('0x57')]='';}return getUser(_0x18a23f,_0x4b8381,_0x34bb60,_0xf056a3,_0xe91ca8,_0x16eaab)[_0x410d('0xd')](function(_0x276491){logger[_0x410d('0x1d')]('['+_0x16eaab[_0x410d('0x10')]()+_0x410d('0x58'),_0x276491[_0x410d('0x20')]);logger[_0x410d('0x1d')]('['+_0x16eaab[_0x410d('0x10')]()+_0x410d('0x59'),_0x276491[_0x410d('0x22')]);return getEndUser(_0x276491,_0x4b8381,_0xf056a3,_0xe91ca8,_0x474b68,_0x16eaab);})['then'](function(_0x16bcb4){logger['info']('['+_0x16eaab[_0x410d('0x10')]()+_0x410d('0x5a'),_0x16bcb4['enduserId']);logger['info']('['+_0x16eaab[_0x410d('0x10')]()+_0x410d('0x5b'),_0x474b68[_0x410d('0x27')]);return getTicket(_0x16bcb4,_0x4b8381,_0xf056a3,_0xe91ca8,_0x474b68,_0x399455,_0x16eaab);})[_0x410d('0xd')](function(_0x52c881){logger[_0x410d('0x1d')](util[_0x410d('0x46')]('['+_0x16eaab['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x399455[_0x410d('0x37')],_0x52c881[_0x410d('0x45')]));logger[_0x410d('0x1d')](util[_0x410d('0x46')]('['+_0x16eaab[_0x410d('0x10')]()+_0x410d('0x5c'),_0x16eaab));if(_0x16eaab!==_0x410d('0x4d')){logger['info']('['+_0x16eaab[_0x410d('0x10')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4b8381[_0x410d('0x4a')],_0x34bb60[_0x410d('0x5d')],_0x399455['ticketType'],_0x52c881['ticketId']);}})[_0x410d('0x24')](function(_0x15b77c){logger[_0x410d('0xf')]('['+_0x16eaab[_0x410d('0x10')]()+_0x410d('0x5e'),util[_0x410d('0x5f')](_0x15b77c,{'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 4e27583..a718eb2 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 _0xc01e=['destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','emit','info','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','keyBy','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','length','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','POST','Basic\x20%s','toString','base64','stringify','map','nameField','customField','content','type','string','push','idField','variable','variableName','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc01e,0x14e));var _0xec01=function(_0x1e6d24,_0x5b266a){_0x1e6d24=_0x1e6d24-0x0;var _0x3831b7=_0xc01e[_0x1e6d24];return _0x3831b7;};'use strict';var _=require(_0xec01('0x0'));var rp=require('request-promise');var md5=require(_0xec01('0x1'));var util=require(_0xec01('0x2'));var Redis=require(_0xec01('0x3'));var intUtil=require('./util');var config=require(_0xec01('0x4'));var logger=require(_0xec01('0x5'))(_0xec01('0x6'));config[_0xec01('0x7')]=_['defaults'](config[_0xec01('0x7')],{'host':_0xec01('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xec01('0x7')]));var headers={'Content-Type':_0xec01('0x9'),'Accept':_0xec01('0x9')};function emit(_0x221a0b,_0x29067d,_0x2b86aa){io['to'](_0x221a0b)[_0xec01('0xa')](_0x29067d,_0x2b86aa);}function getTicket(_0x1d8a9d,_0xaa6a6c,_0x4f6e50,_0x330240,_0x1d4505){logger[_0xec01('0xb')]('Creating\x20new\x20ticket...');var _0x5ec453=_[_0xec01('0xc')]({'responder_id':_0xaa6a6c['id'],'requester_id':_0x4f6e50['id'],'name':util[_0xec01('0xd')]('Caller\x20-\x20%s',_0x1d4505[_0xec01('0xe')]),'phone':_0x1d4505[_0xec01('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xec01('0x10')](_0x330240[_0xec01('0x11')],_0x1d4505,'\x20'),'description':intUtil[_0xec01('0x10')](_0x330240[_0xec01('0x12')],_0x1d4505,_0xec01('0x13')),'tags':getTags(_0x330240['Tags'],_0xec01('0x14'))},getCustomFields(_0x330240[_0xec01('0x15')],_0x1d4505));_0x5ec453[_0xec01('0x16')]=_['mapValues'](_[_0xec01('0x17')](_0x5ec453[_0xec01('0x16')],'id'),'value');return request({'uri':util[_0xec01('0xd')](_0xec01('0x18'),_0x1d8a9d[_0xec01('0x19')]),'method':'POST','body':_0x5ec453})[_0xec01('0x1a')](function(_0x3983e3){logger[_0xec01('0xb')](_0xec01('0x1b'));return _0x3983e3;});}function getUser(_0x44cd32,_0x49d6c8){if(intUtil[_0xec01('0x1c')](_0x49d6c8)){return request({'uri':util['format']('%s/api/v2/agents',_0x44cd32[_0xec01('0x19')]),'qs':{'email':_0x49d6c8}})[_0xec01('0x1a')](function(_0x2e5240){if(_0x2e5240[_0xec01('0x1d')]){logger[_0xec01('0xb')]('Agent\x20found!');return _[_0xec01('0x1e')](_0x2e5240,function(_0x4b3fef){return _0x4b3fef[_0xec01('0x1f')]['email']===_0x49d6c8;});}else{logger[_0xec01('0xb')](_0xec01('0x20'));return request({'uri':util[_0xec01('0xd')]('%s/api/v2/agents/me',_0x44cd32[_0xec01('0x19')])})[_0xec01('0x1a')](function(_0x2e7be4){logger[_0xec01('0xb')](_0xec01('0x21'));return _0x2e7be4;});}});}else{logger[_0xec01('0xb')](_0xec01('0x22'));return request({'uri':util[_0xec01('0xd')]('%s/api/v2/agents/me',_0x44cd32[_0xec01('0x19')])})[_0xec01('0x1a')](function(_0x2766ba){logger[_0xec01('0xb')](_0xec01('0x21'));return _0x2766ba;});}}function getEndUser(_0x222c19,_0x340527,_0x3a5863){logger[_0xec01('0xb')]('Searching\x20enduser\x20with\x20phone',_0x3a5863);return request({'uri':util[_0xec01('0xd')](_0xec01('0x23'),_0x222c19[_0xec01('0x19')]),'qs':{'phone':_0x3a5863}})[_0xec01('0x1a')](function(_0x30c647){if(_0x30c647[_0xec01('0x1d')]){logger[_0xec01('0xb')](_0xec01('0x24'));return _['find'](_0x30c647,{'phone':_0x3a5863});}else{logger[_0xec01('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xec01('0xd')](_0xec01('0x23'),_0x222c19[_0xec01('0x19')]),'method':_0xec01('0x25'),'body':{'name':_0x340527,'phone':_0x3a5863}})[_0xec01('0x1a')](function(_0x4a79d4){logger['info']('Enduser\x20created.');return _0x4a79d4;});}});}function getAuth(_0x1397bd){return util[_0xec01('0xd')](_0xec01('0x26'),new Buffer(_0x1397bd['apiKey']+':X')[_0xec01('0x27')](_0xec01('0x28')));}function request(_0x379d2e){logger['debug']('[HTTP]',JSON[_0xec01('0x29')](_0x379d2e));return rp(_['defaults'](_0x379d2e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4bd2b8,_0x3e9a75){var _0x375550=[];if(_0x4bd2b8&&_0x4bd2b8[_0xec01('0x1d')]>0x0){_0x375550=_[_0xec01('0x2a')](_0x4bd2b8,_0x3e9a75);}return _0x375550;}function getCustomFields(_0x2493a8,_0x2af620){var _0x42c1f9=[];var _0x251e70={'custom_fields':[]};if(_0x2493a8['length']>0x0){_['forEach'](_0x2493a8,function(_0x208f92){if(_0x208f92['type']==='string'&&_0x208f92[_0xec01('0x2b')]&&!_0x208f92[_0xec01('0x2c')]){_0x251e70[_0x208f92['nameField']['toLowerCase']()]=_0x208f92[_0xec01('0x2d')][_0xec01('0x27')]();}else if(_0x208f92[_0xec01('0x2e')]===_0xec01('0x2f')&&_0x208f92['idField']&&_0x208f92[_0xec01('0x2c')]){_0x251e70[_0xec01('0x16')][_0xec01('0x30')]({'id':_0x208f92[_0xec01('0x31')],'value':_0x208f92[_0xec01('0x2d')]['toString']()});}else if(_0x208f92[_0xec01('0x2e')]===_0xec01('0x32')&&_0x208f92[_0xec01('0x33')]&&_0x208f92[_0xec01('0x31')]&&_0x208f92[_0xec01('0x2c')]){_0x2af620[_0x208f92['variableName']]&&_0x251e70[_0xec01('0x16')][_0xec01('0x30')]({'id':_0x208f92[_0xec01('0x31')],'value':_0x2af620[_0x208f92[_0xec01('0x33')]][_0xec01('0x27')]()});}else if(_0x208f92[_0xec01('0x2e')]==='customVariable'&&_0x208f92[_0xec01('0x34')]&&_0x208f92[_0xec01('0x34')][_0xec01('0x14')]&&_0x208f92[_0xec01('0x31')]&&_0x208f92['customField']){_0x2af620[_0x208f92[_0xec01('0x34')][_0xec01('0x14')][_0xec01('0x35')]()]&&_0x251e70[_0xec01('0x16')][_0xec01('0x30')]({'id':_0x208f92[_0xec01('0x31')],'value':_0x2af620[_0x208f92[_0xec01('0x34')]['name'][_0xec01('0x35')]()][_0xec01('0x27')]()});}});}return _0x251e70;}exports['queue']=function(_0xa4f461,_0x4ead08,_0x104418,_0x436bd3,_0x538230,_0x575094){var _0x2a0ffc,_0x2c126d;_0x575094['remoteUri']=intUtil[_0xec01('0x36')](_0x575094[_0xec01('0x19')]);_0x575094[_0xec01('0x37')]=intUtil[_0xec01('0x36')](_0x575094[_0xec01('0x37')]);if(_0x538230&&_0x538230[_0xec01('0x38')]){logger[_0xec01('0xb')](_0xec01('0x39'),_0xec01('0x3a'));_0x4ead08['recordingURL']=util[_0xec01('0xd')](_0xec01('0x3b'),_0x575094[_0xec01('0x37')],_0x4ead08['uniqueid'],md5(_0x4ead08[_0xec01('0x3c')]));}else{_0x4ead08[_0xec01('0x3d')]='';}headers[_0xec01('0x3e')]=getAuth(_0x575094);return getUser(_0x575094,_0x436bd3[_0xec01('0x3f')])[_0xec01('0x1a')](function(_0x35acd3){_0x2a0ffc=_0x35acd3;logger[_0xec01('0xb')]('The\x20User\x20ID\x20is:',_0x2a0ffc['id']);return getEndUser(_0x575094,_0x4ead08[_0xec01('0xe')],_0x4ead08[_0xec01('0xf')]);})[_0xec01('0x1a')](function(_0x459a52){_0x2c126d=_0x459a52;logger[_0xec01('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2c126d['id']);return getTicket(_0x575094,_0x2a0ffc,_0x2c126d,_0x104418,_0x4ead08);})['then'](function(_0x47909d){if(_0x47909d&&_0x47909d['id']){logger[_0xec01('0xb')]('Ticket\x20created!');logger[_0xec01('0xb')](_0xec01('0x40'),_0x47909d['id']);logger['info'](_0xec01('0x39'),_0xec01('0x41'));emit(util[_0xec01('0xd')](_0xec01('0x42'),_0x436bd3['name']),_0xec01('0x43'),{'uri':util[_0xec01('0xd')](_0xec01('0x44'),_0x575094['remoteUri'],_0x47909d['id'])});}})[_0xec01('0x45')](function(_0x4c7679){logger[_0xec01('0x46')](_0xec01('0x39'),JSON[_0xec01('0x29')](_0x4c7679));});};exports[_0xec01('0x47')]=function(_0x32fba1,_0x236dee,_0xe2327,_0x5259dc,_0x204e4d,_0x5402d3,_0x102357){var _0x1d7227,_0x464dc6;_0x5402d3[_0xec01('0x19')]=intUtil['stripTrailingSlash'](_0x5402d3[_0xec01('0x19')]);_0x5402d3[_0xec01('0x37')]=intUtil[_0xec01('0x36')](_0x5402d3[_0xec01('0x37')]);if(_0x102357&&_0x102357['recordingFormat']&&_0x102357[_0xec01('0x48')]!==_0xec01('0x49')){logger[_0xec01('0xb')](_0xec01('0x4a'),'Recording\x20is\x20enabled!');_0x236dee[_0xec01('0x3d')]=util[_0xec01('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5402d3['serverUrl'],_0x236dee['uniqueid'],md5(_0x236dee[_0xec01('0x3c')]));}headers[_0xec01('0x3e')]=getAuth(_0x5402d3);return getUser(_0x5402d3,_0x5259dc[_0xec01('0x3f')])[_0xec01('0x1a')](function(_0xc44622){_0x1d7227=_0xc44622;logger[_0xec01('0xb')](_0xec01('0x4b'),_0x1d7227['id']);return getEndUser(_0x5402d3,_0x236dee[_0xec01('0x4c')],_0x236dee[_0xec01('0x4d')]);})['then'](function(_0x4c627e){_0x464dc6=_0x4c627e;logger[_0xec01('0xb')](_0xec01('0x4e'),_0x464dc6['id']);return getTicket(_0x5402d3,_0x1d7227,_0x464dc6,_0xe2327,_0x236dee);})[_0xec01('0x1a')](function(_0x25cc16){if(_0x25cc16&&_0x25cc16['id']){logger[_0xec01('0xb')](_0xec01('0x1b'));logger[_0xec01('0xb')](_0xec01('0x40'),_0x25cc16['id']);logger[_0xec01('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xec01('0xd')](_0xec01('0x42'),_0x5259dc[_0xec01('0x14')]),_0xec01('0x43'),{'uri':util[_0xec01('0xd')](_0xec01('0x44'),_0x5402d3[_0xec01('0x19')],_0x25cc16['id'])});}})[_0xec01('0x45')](function(_0x544a93){logger[_0xec01('0x46')](_0xec01('0x4a'),JSON['stringify'](_0x544a93));});};exports[_0xec01('0x4f')]=function(_0x4a11d3,_0x17d578,_0x5e6fb1,_0x434a7d,_0x4ac5ca,_0x510c48){var _0x756d34,_0x25219e;_0x510c48['remoteUri']=intUtil[_0xec01('0x36')](_0x510c48[_0xec01('0x19')]);_0x510c48[_0xec01('0x37')]=intUtil[_0xec01('0x36')](_0x510c48['serverUrl']);if(_0x4ac5ca&&_0x4ac5ca['monitor_format']){logger[_0xec01('0xb')]('['+_0x17d578[_0xec01('0x50')][_0xec01('0x51')]()+']',_0xec01('0x3a'));_0x17d578[_0xec01('0x3d')]=util[_0xec01('0xd')](_0xec01('0x3b'),_0x510c48[_0xec01('0x37')],_0x17d578[_0xec01('0x3c')],md5(_0x17d578[_0xec01('0x3c')]));}else{_0x17d578[_0xec01('0x3d')]='';}headers['Authorization']=getAuth(_0x510c48);return getUser(_0x510c48,'')[_0xec01('0x1a')](function(_0x3a34a5){_0x756d34=_0x3a34a5;logger[_0xec01('0xb')](_0xec01('0x4b'),_0x756d34['id']);return getEndUser(_0x510c48,_0x17d578[_0xec01('0xe')],_0x17d578[_0xec01('0xf')]);})[_0xec01('0x1a')](function(_0x39433){_0x25219e=_0x39433;logger[_0xec01('0xb')](_0xec01('0x4e'),_0x25219e['id']);return getTicket(_0x510c48,_0x756d34,_0x25219e,_0x5e6fb1,_0x17d578);})['then'](function(_0x208a7f){if(_0x208a7f){logger[_0xec01('0xb')]('Ticket\x20created!');logger[_0xec01('0xb')](_0xec01('0x40'),_0x208a7f['id']);}})[_0xec01('0x45')](function(_0x498f05){logger['error']('['+_0x17d578[_0xec01('0x50')][_0xec01('0x51')]()+']',JSON['stringify'](_0x498f05));});}; \ No newline at end of file +var _0x2d99=['Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','type','string','nameField','customField','toLowerCase','idField','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','user:%s','error','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','emit','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','info','%s/api/v2/agents','length'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x2d99,0x88));var _0x92d9=function(_0x1a2725,_0x2ff52c){_0x1a2725=_0x1a2725-0x0;var _0x294b9=_0x2d99[_0x1a2725];return _0x294b9;};'use strict';var _=require(_0x92d9('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x92d9('0x1'));var Redis=require(_0x92d9('0x2'));var intUtil=require(_0x92d9('0x3'));var config=require(_0x92d9('0x4'));var logger=require('../../../../config/logger')(_0x92d9('0x5'));config[_0x92d9('0x6')]=_['defaults'](config[_0x92d9('0x6')],{'host':_0x92d9('0x7'),'port':0x18eb});var io=require(_0x92d9('0x8'))(new Redis(config[_0x92d9('0x6')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x286619,_0x119a65,_0x1d1acd){io['to'](_0x286619)[_0x92d9('0x9')](_0x119a65,_0x1d1acd);}function getTicket(_0x4d1ae4,_0xb2eaaf,_0x12404f,_0x5d4f30,_0x2c8d77){logger['info']('Creating\x20new\x20ticket...');var _0x3721c6=_[_0x92d9('0xa')]({'responder_id':_0xb2eaaf['id'],'requester_id':_0x12404f['id'],'name':util[_0x92d9('0xb')](_0x92d9('0xc'),_0x2c8d77[_0x92d9('0xd')]),'phone':_0x2c8d77['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x92d9('0xe')](_0x5d4f30[_0x92d9('0xf')],_0x2c8d77,'\x20'),'description':intUtil[_0x92d9('0xe')](_0x5d4f30[_0x92d9('0x10')],_0x2c8d77,_0x92d9('0x11')),'tags':getTags(_0x5d4f30[_0x92d9('0x12')],_0x92d9('0x13'))},getCustomFields(_0x5d4f30[_0x92d9('0x14')],_0x2c8d77));_0x3721c6['custom_fields']=_['mapValues'](_['keyBy'](_0x3721c6[_0x92d9('0x15')],'id'),_0x92d9('0x16'));return request({'uri':util[_0x92d9('0xb')](_0x92d9('0x17'),_0x4d1ae4[_0x92d9('0x18')]),'method':_0x92d9('0x19'),'body':_0x3721c6})[_0x92d9('0x1a')](function(_0x49b692){logger[_0x92d9('0x1b')]('Ticket\x20created!');return _0x49b692;});}function getUser(_0x2f3082,_0xeaf86){if(intUtil['validateEmail'](_0xeaf86)){return request({'uri':util['format'](_0x92d9('0x1c'),_0x2f3082[_0x92d9('0x18')]),'qs':{'email':_0xeaf86}})[_0x92d9('0x1a')](function(_0x352f20){if(_0x352f20[_0x92d9('0x1d')]){logger[_0x92d9('0x1b')](_0x92d9('0x1e'));return _[_0x92d9('0x1f')](_0x352f20,function(_0x5e5341){return _0x5e5341[_0x92d9('0x20')][_0x92d9('0x21')]===_0xeaf86;});}else{logger[_0x92d9('0x1b')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x92d9('0xb')]('%s/api/v2/agents/me',_0x2f3082[_0x92d9('0x18')])})[_0x92d9('0x1a')](function(_0x53d3a1){logger[_0x92d9('0x1b')]('Admin\x20account\x20selected.');return _0x53d3a1;});}});}else{logger[_0x92d9('0x1b')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x92d9('0xb')](_0x92d9('0x22'),_0x2f3082['remoteUri'])})[_0x92d9('0x1a')](function(_0x4a3cdd){logger[_0x92d9('0x1b')](_0x92d9('0x23'));return _0x4a3cdd;});}}function getEndUser(_0x2670e1,_0x3150eb,_0x413549){logger[_0x92d9('0x1b')](_0x92d9('0x24'),_0x413549);return request({'uri':util[_0x92d9('0xb')](_0x92d9('0x25'),_0x2670e1['remoteUri']),'qs':{'phone':_0x413549}})[_0x92d9('0x1a')](function(_0x1ccc70){if(_0x1ccc70[_0x92d9('0x1d')]){logger[_0x92d9('0x1b')](_0x92d9('0x26'));return _[_0x92d9('0x1f')](_0x1ccc70,{'phone':_0x413549});}else{logger[_0x92d9('0x1b')](_0x92d9('0x27'));return request({'uri':util[_0x92d9('0xb')](_0x92d9('0x25'),_0x2670e1[_0x92d9('0x18')]),'method':_0x92d9('0x19'),'body':{'name':_0x3150eb,'phone':_0x413549}})['then'](function(_0x3acaea){logger[_0x92d9('0x1b')]('Enduser\x20created.');return _0x3acaea;});}});}function getAuth(_0x2f4160){return util[_0x92d9('0xb')](_0x92d9('0x28'),new Buffer(_0x2f4160[_0x92d9('0x29')]+':X')[_0x92d9('0x2a')](_0x92d9('0x2b')));}function request(_0x39b4cd){logger['debug'](_0x92d9('0x2c'),JSON[_0x92d9('0x2d')](_0x39b4cd));return rp(_['defaults'](_0x39b4cd,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1fee33,_0x529a32){var _0xa2148e=[];if(_0x1fee33&&_0x1fee33[_0x92d9('0x1d')]>0x0){_0xa2148e=_['map'](_0x1fee33,_0x529a32);}return _0xa2148e;}function getCustomFields(_0x5de407,_0x1d31f6){var _0x16dc6e=[];var _0x27b067={'custom_fields':[]};if(_0x5de407[_0x92d9('0x1d')]>0x0){_['forEach'](_0x5de407,function(_0x245ef8){if(_0x245ef8[_0x92d9('0x2e')]===_0x92d9('0x2f')&&_0x245ef8[_0x92d9('0x30')]&&!_0x245ef8[_0x92d9('0x31')]){_0x27b067[_0x245ef8[_0x92d9('0x30')][_0x92d9('0x32')]()]=_0x245ef8['content'][_0x92d9('0x2a')]();}else if(_0x245ef8[_0x92d9('0x2e')]===_0x92d9('0x2f')&&_0x245ef8[_0x92d9('0x33')]&&_0x245ef8[_0x92d9('0x31')]){_0x27b067['custom_fields'][_0x92d9('0x34')]({'id':_0x245ef8[_0x92d9('0x33')],'value':_0x245ef8[_0x92d9('0x35')][_0x92d9('0x2a')]()});}else if(_0x245ef8['type']===_0x92d9('0x36')&&_0x245ef8['variableName']&&_0x245ef8['idField']&&_0x245ef8[_0x92d9('0x31')]){_0x1d31f6[_0x245ef8['variableName']]&&_0x27b067[_0x92d9('0x15')]['push']({'id':_0x245ef8[_0x92d9('0x33')],'value':_0x1d31f6[_0x245ef8[_0x92d9('0x37')]][_0x92d9('0x2a')]()});}else if(_0x245ef8[_0x92d9('0x2e')]===_0x92d9('0x38')&&_0x245ef8[_0x92d9('0x39')]&&_0x245ef8[_0x92d9('0x39')][_0x92d9('0x13')]&&_0x245ef8[_0x92d9('0x33')]&&_0x245ef8['customField']){_0x1d31f6[_0x245ef8['Variable'][_0x92d9('0x13')][_0x92d9('0x32')]()]&&_0x27b067[_0x92d9('0x15')]['push']({'id':_0x245ef8['idField'],'value':_0x1d31f6[_0x245ef8[_0x92d9('0x39')]['name'][_0x92d9('0x32')]()][_0x92d9('0x2a')]()});}});}return _0x27b067;}exports[_0x92d9('0x3a')]=function(_0x167978,_0x19500e,_0x1b175d,_0x545f6c,_0x4bb9f5,_0x279220){var _0x1f413c,_0x4d41c3;_0x279220[_0x92d9('0x18')]=intUtil[_0x92d9('0x3b')](_0x279220[_0x92d9('0x18')]);_0x279220[_0x92d9('0x3c')]=intUtil[_0x92d9('0x3b')](_0x279220[_0x92d9('0x3c')]);if(_0x4bb9f5&&_0x4bb9f5[_0x92d9('0x3d')]){logger[_0x92d9('0x1b')](_0x92d9('0x3e'),'Recording\x20is\x20enabled!');_0x19500e['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x279220[_0x92d9('0x3c')],_0x19500e[_0x92d9('0x3f')],md5(_0x19500e[_0x92d9('0x3f')]));}else{_0x19500e[_0x92d9('0x40')]='';}headers[_0x92d9('0x41')]=getAuth(_0x279220);return getUser(_0x279220,_0x545f6c[_0x92d9('0x21')])[_0x92d9('0x1a')](function(_0xa4a96f){_0x1f413c=_0xa4a96f;logger[_0x92d9('0x1b')](_0x92d9('0x42'),_0x1f413c['id']);return getEndUser(_0x279220,_0x19500e[_0x92d9('0xd')],_0x19500e['calleridnum']);})[_0x92d9('0x1a')](function(_0x294bfc){_0x4d41c3=_0x294bfc;logger[_0x92d9('0x1b')](_0x92d9('0x43'),_0x4d41c3['id']);return getTicket(_0x279220,_0x1f413c,_0x4d41c3,_0x1b175d,_0x19500e);})[_0x92d9('0x1a')](function(_0xabaaf0){if(_0xabaaf0&&_0xabaaf0['id']){logger[_0x92d9('0x1b')](_0x92d9('0x44'));logger['info'](_0x92d9('0x45'),_0xabaaf0['id']);logger[_0x92d9('0x1b')]('[QUEUE]',_0x92d9('0x46'));emit(util[_0x92d9('0xb')]('user:%s',_0x545f6c[_0x92d9('0x13')]),'trigger:browser:url',{'uri':util[_0x92d9('0xb')](_0x92d9('0x47'),_0x279220[_0x92d9('0x18')],_0xabaaf0['id'])});}})[_0x92d9('0x48')](function(_0x1d7cb0){logger['error'](_0x92d9('0x3e'),JSON[_0x92d9('0x2d')](_0x1d7cb0));});};exports[_0x92d9('0x49')]=function(_0x21ab1d,_0x576cf2,_0x1fee8d,_0x1f2374,_0x17ccc8,_0x3313e9,_0x197e30){var _0x91749a,_0x2304a7;_0x3313e9['remoteUri']=intUtil[_0x92d9('0x3b')](_0x3313e9[_0x92d9('0x18')]);_0x3313e9[_0x92d9('0x3c')]=intUtil[_0x92d9('0x3b')](_0x3313e9[_0x92d9('0x3c')]);if(_0x197e30&&_0x197e30[_0x92d9('0x4a')]&&_0x197e30[_0x92d9('0x4a')]!==_0x92d9('0x4b')){logger[_0x92d9('0x1b')](_0x92d9('0x4c'),_0x92d9('0x4d'));_0x576cf2[_0x92d9('0x40')]=util[_0x92d9('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3313e9['serverUrl'],_0x576cf2[_0x92d9('0x3f')],md5(_0x576cf2[_0x92d9('0x3f')]));}headers[_0x92d9('0x41')]=getAuth(_0x3313e9);return getUser(_0x3313e9,_0x1f2374[_0x92d9('0x21')])['then'](function(_0x13b2f4){_0x91749a=_0x13b2f4;logger[_0x92d9('0x1b')](_0x92d9('0x42'),_0x91749a['id']);return getEndUser(_0x3313e9,_0x576cf2['destcalleridname'],_0x576cf2['destcalleridnum']);})[_0x92d9('0x1a')](function(_0x1c5169){_0x2304a7=_0x1c5169;logger[_0x92d9('0x1b')](_0x92d9('0x43'),_0x2304a7['id']);return getTicket(_0x3313e9,_0x91749a,_0x2304a7,_0x1fee8d,_0x576cf2);})['then'](function(_0x3a6818){if(_0x3a6818&&_0x3a6818['id']){logger[_0x92d9('0x1b')]('Ticket\x20created!');logger[_0x92d9('0x1b')](_0x92d9('0x45'),_0x3a6818['id']);logger[_0x92d9('0x1b')](_0x92d9('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x92d9('0xb')](_0x92d9('0x4e'),_0x1f2374[_0x92d9('0x13')]),'trigger:browser:url',{'uri':util[_0x92d9('0xb')](_0x92d9('0x47'),_0x3313e9[_0x92d9('0x18')],_0x3a6818['id'])});}})[_0x92d9('0x48')](function(_0x52c34d){logger[_0x92d9('0x4f')](_0x92d9('0x4c'),JSON['stringify'](_0x52c34d));});};exports['unmanaged']=function(_0x51b72a,_0x5d50ab,_0x1d1670,_0x46d3df,_0x4d286c,_0x5846e8){var _0x502f09,_0x4d127d;_0x5846e8['remoteUri']=intUtil[_0x92d9('0x3b')](_0x5846e8[_0x92d9('0x18')]);_0x5846e8[_0x92d9('0x3c')]=intUtil[_0x92d9('0x3b')](_0x5846e8['serverUrl']);if(_0x4d286c&&_0x4d286c['monitor_format']){logger[_0x92d9('0x1b')]('['+_0x5d50ab[_0x92d9('0x50')][_0x92d9('0x51')]()+']',_0x92d9('0x4d'));_0x5d50ab[_0x92d9('0x40')]=util[_0x92d9('0xb')](_0x92d9('0x52'),_0x5846e8[_0x92d9('0x3c')],_0x5d50ab[_0x92d9('0x3f')],md5(_0x5d50ab['uniqueid']));}else{_0x5d50ab[_0x92d9('0x40')]='';}headers['Authorization']=getAuth(_0x5846e8);return getUser(_0x5846e8,'')['then'](function(_0x258cd4){_0x502f09=_0x258cd4;logger[_0x92d9('0x1b')](_0x92d9('0x42'),_0x502f09['id']);return getEndUser(_0x5846e8,_0x5d50ab[_0x92d9('0xd')],_0x5d50ab['calleridnum']);})['then'](function(_0x4db921){_0x4d127d=_0x4db921;logger[_0x92d9('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x4d127d['id']);return getTicket(_0x5846e8,_0x502f09,_0x4d127d,_0x1d1670,_0x5d50ab);})[_0x92d9('0x1a')](function(_0x1801b8){if(_0x1801b8){logger[_0x92d9('0x1b')](_0x92d9('0x44'));logger[_0x92d9('0x1b')](_0x92d9('0x45'),_0x1801b8['id']);}})['catch'](function(_0x5a636d){logger['error']('['+_0x5d50ab[_0x92d9('0x50')]['toUpperCase']()+']',JSON[_0x92d9('0x2d')](_0x5a636d));});}; \ 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 9702627..e79c8ba 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 _0x644f=['toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','headers','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','error','toUpperCase','/api/lookup?q=','&f=','&entities=contact','contacts','contactNumber','mobile_number','endUserId','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','message','/api/tasks','getString','Subjects','Descriptions','Contact','format','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','adminEmail','username'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x644f,0xc2));var _0xf644=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x644f[_0x189305];return _0xea3406;};'use strict';var _=require(_0xf644('0x0'));var rp=require(_0xf644('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0xf644('0x2'));var Promise=require(_0xf644('0x3'));var Redis=require(_0xf644('0x4'));var intUtil=require(_0xf644('0x5'));var config=require(_0xf644('0x6'));var logger=require(_0xf644('0x7'))(_0xf644('0x8'));config[_0xf644('0x9')]=_[_0xf644('0xa')](config[_0xf644('0x9')],{'host':_0xf644('0xb'),'port':0x18eb});var io=require(_0xf644('0xc'))(new Redis(config['redis']));function getAdminId(_0x2c2868,_0x11fa91,_0x5c11c7,_0x127499){return new Promise(function(_0x5746ae,_0x4efb6b){var _0x390284=![];var _0x4a490d={'method':_0xf644('0xd'),'uri':_0x127499+_0xf644('0xe'),'json':!![]};_0x4a490d['headers']=_0x5c11c7;logger[_0xf644('0xf')](_0xf644('0x10'));return rp(_0x4a490d)[_0xf644('0x11')](function(_0x5911d3){if(_0x5911d3){var _0x296647=_0x5911d3[_0xf644('0x12')];var _0x516f19=null;for(_0x516f19=0x0;_0x516f19<_0x296647[_0xf644('0x13')];_0x516f19++){if(_0x296647[_0x516f19][_0xf644('0x14')]===_0x2c2868['adminEmail']){_0x2c2868[_0xf644('0x15')]=_0x296647[_0x516f19]['id'];_0x390284=!![];}}if(_0x390284){logger[_0xf644('0xf')](_0xf644('0x16'),_0x2c2868[_0xf644('0x15')]);_0x5746ae(_0x2c2868);}else{_0x4efb6b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4efb6b({'statusCode':0x194,'message':_0xf644('0x17')});}})[_0xf644('0x18')](function(_0x52f74a){logger['error']('['+[_0x11fa91['toUpperCase']()]+']',_0x52f74a['message']);_0x4efb6b(_0x52f74a);});});}function getUser(_0x2587f5,_0x331478,_0x34dec2){return function(_0x329bb9){return new Promise(function(_0x5f38f9,_0x5bd03c){var _0x15d065={'method':_0xf644('0xd'),'uri':_0x34dec2+_0xf644('0xe'),'json':!![]};_0x15d065[_0xf644('0x19')]=_0x331478;logger['info']('Getting\x20user\x20list');return rp(_0x15d065)[_0xf644('0x11')](function(_0x305515){if(_0x305515){var _0x6d3229=_0x305515[_0xf644('0x12')];var _0x29f81a=![];var _0x2bc954=null;if(_0x329bb9[_0xf644('0x1a')]!==null){logger[_0xf644('0xf')]('Getting\x20user\x20with\x20email',_0x329bb9[_0xf644('0x1a')]);_0x329bb9[_0xf644('0x1b')]=_0x329bb9[_0xf644('0x1a')];for(_0x2bc954=0x0;_0x2bc954<_0x6d3229[_0xf644('0x13')];_0x2bc954++){if(_0x6d3229[_0x2bc954]['email']===_0x329bb9[_0xf644('0x1a')]){_0x29f81a=!![];_0x329bb9[_0xf644('0x1c')]=_0x6d3229[_0x2bc954]['id'];logger[_0xf644('0xf')](_0xf644('0x1d'),_0x329bb9[_0xf644('0x1c')]);}}}if(!_0x29f81a){logger[_0xf644('0xf')](_0xf644('0x1e'));_0x329bb9['userEmail']=_0x329bb9['adminEmail'];_0x329bb9[_0xf644('0x1c')]=_0x329bb9[_0xf644('0x15')];_0x29f81a=!![];}if(_0x29f81a){_0x5f38f9(_0x329bb9);}else{_0x5bd03c({'statusCode':0x194,'message':_0xf644('0x17')});}}else{_0x5bd03c({'statusCode':0x194,'message':_0xf644('0x17')});}})[_0xf644('0x18')](function(_0x20d683){logger[_0xf644('0x1f')]('['+[_0x2587f5[_0xf644('0x20')]()]+']',_0x20d683['message']);_0x5bd03c(_0x20d683);});});};}function searchContact(_0x32e8d8,_0x3705a0,_0x54f81b,_0x5acb2a){return new Promise(function(_0x21fbc8,_0x31343f){var _0x16c745={'method':_0xf644('0xd'),'headers':_0x3705a0,'uri':_0x32e8d8+_0xf644('0x21')+_0x5acb2a+_0xf644('0x22')+_0x54f81b+_0xf644('0x23'),'json':!![]};rp(_0x16c745)['then'](function(_0x448c6e){var _0x23c750=_['find'](_0x448c6e['contacts'][_0xf644('0x24')],[_0x54f81b,_0x5acb2a]);_0x21fbc8(_0x23c750);})[_0xf644('0x18')](function(_0x2cdca1){_0x31343f(_0x2cdca1);});});}function getEndUser(_0x423d3d,_0x3e7a5b,_0xa039cf){return function(_0x1fd581){return new Promise(function(_0x390b34,_0x3fd3b2){logger[_0xf644('0xf')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x1fd581[_0xf644('0x25')]));searchContact(_0xa039cf,_0x3e7a5b,_0xf644('0x26'),_0x1fd581[_0xf644('0x25')])[_0xf644('0x11')](function(_0x228321){if(_0x228321){_0x1fd581[_0xf644('0x27')]=_0x228321['id'];logger[_0xf644('0xf')]('Contact\x20found\x20mobile_number:',_0x1fd581[_0xf644('0x27')]);return _0x390b34(_0x1fd581);}searchContact(_0xa039cf,_0x3e7a5b,'work_number',_0x1fd581['contactNumber'])[_0xf644('0x11')](function(_0x316d24){if(_0x316d24){_0x1fd581[_0xf644('0x27')]=_0x316d24['id'];logger['info']('Contact\x20found\x20work_number:',_0x1fd581[_0xf644('0x27')]);return _0x390b34(_0x1fd581);}createEndUser(_0x1fd581,_0x423d3d,_0x3e7a5b,_0xa039cf)[_0xf644('0x11')](function(_0x290693){logger['info'](_0xf644('0x28'),_0x290693[_0xf644('0x27')]);return _0x390b34(_0x290693);});});})['catch'](function(_0xd39316){_0x3fd3b2(_0xd39316);});});};}function createEndUser(_0x67cbfc,_0x27fbc7,_0x4d2aeb,_0x2ab38a){return new Promise(function(_0x42d6e8,_0x5e5e9b){var _0x2686db=moment();var _0x4e51fd={'method':_0xf644('0x29'),'uri':_0x2ab38a+_0xf644('0x2a'),'body':{'contact':{'last_name':_0x67cbfc[_0xf644('0x25')],'work_number':_0x67cbfc[_0xf644('0x25')],'mobile_number':_0x67cbfc[_0xf644('0x25')],'owner_id':_0x67cbfc[_0xf644('0x1c')],'created_at':_0x2686db['format'](_0xf644('0x2b'))}},'json':!![]};_0x4e51fd[_0xf644('0x19')]=_0x4d2aeb;logger[_0xf644('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4e51fd)['then'](function(_0x117884){_0x67cbfc[_0xf644('0x27')]=_0x117884[_0xf644('0x2c')]['id'];_0x42d6e8(_0x67cbfc);})[_0xf644('0x18')](function(_0x5c8948){logger[_0xf644('0x1f')]('['+[_0x27fbc7['toUpperCase']()]+']',_0x5c8948[_0xf644('0x2d')]);_0x5e5e9b(_0x5c8948['message']);});});}function getTicket(_0x2d9f52,_0x3475cf,_0x19f508,_0x769e36,_0x52f73d){return function(_0xf0d5d){logger[_0xf644('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x29b511,_0x34c4b9){var _0x54f83d=moment();var _0x101f71={'method':'POST','uri':_0x19f508+_0xf644('0x2e'),'body':{'title':intUtil[_0xf644('0x2f')](_0x769e36[_0xf644('0x30')],_0x52f73d,'\x20'),'description':intUtil[_0xf644('0x2f')](_0x769e36[_0xf644('0x31')],_0x52f73d,'\x0a'),'owner_id':_0xf0d5d['userId'],'creater_id':_0xf0d5d[_0xf644('0x15')],'targetable_id':_0xf0d5d[_0xf644('0x27')],'targetable_type':_0xf644('0x32'),'created_at':_0x54f83d[_0xf644('0x33')](_0xf644('0x2b')),'due_date':_0x54f83d['add'](0x1e,'m')[_0xf644('0x33')](_0xf644('0x2b'))},'json':!![]};_0x101f71[_0xf644('0x19')]=_0x3475cf;return rp(_0x101f71)['then'](function(_0x3c530){_0xf0d5d[_0xf644('0x34')]=_0x3c530[_0xf644('0x35')]['id'];logger[_0xf644('0xf')]('Task\x20created:',_0xf0d5d['ticketId']);_0x29b511(_0xf0d5d);})[_0xf644('0x18')](function(_0x3345e7){logger[_0xf644('0x1f')]('['+[_0x2d9f52[_0xf644('0x20')]()]+']',_0x3345e7['message']);_0x34c4b9(_0x3345e7['message']);});});};}function emit(_0x3c0068,_0xaae13c,_0x8966d6){var _0x4c9838={'uri':_0x3c0068+_0xf644('0x36')+_0x8966d6};io['to'](util[_0xf644('0x33')](_0xf644('0x37'),_0xaae13c))[_0xf644('0x38')](_0xf644('0x39'),_0x4c9838);}exports['cs']=function(_0x3a224b,_0x2139cb,_0x2f04c3,_0x101c35,_0x4b7b07,_0x3c5356,_0x333195,_0x1756bc){var _0x212a99={};var _0x264bd1={'Authorization':_0xf644('0x3a')+_0x3c5356[_0xf644('0x3b')]};_0x3c5356['remoteUri']=intUtil[_0xf644('0x3c')](_0x3c5356[_0xf644('0x3d')]);_0x3c5356['serverUrl']=intUtil['stripTrailingSlash'](_0x3c5356['serverUrl']);var _0x25802b=_0x3c5356['remoteUri'];_0x212a99[_0xf644('0x3e')]=_0x3c5356[_0xf644('0x3f')];_0x212a99['contactNumber']=_0x1756bc[_0xf644('0x40')]()===_0xf644('0x41')?_0x2139cb[_0xf644('0x42')]:_0x2139cb[_0xf644('0x43')];_0x212a99[_0xf644('0x44')]=_0x1756bc===_0xf644('0x45')||_0x1756bc===_0xf644('0x46')?_0xf644('0x45'):'outbound';if(_0x101c35){_0x212a99[_0xf644('0x1a')]=_0x101c35[_0xf644('0x14')];}var _0x2294ef=util['format'](_0xf644('0x47'),_0x3c5356[_0xf644('0x48')],_0x2139cb[_0xf644('0x49')],md5(_0x2139cb['uniqueid']));if(_0x4b7b07&&_0x4b7b07[_0xf644('0x4a')]){logger['info'](_0xf644('0x4b'),'Recording\x20is\x20enabled!');_0x2139cb[_0xf644('0x4c')]=_0x2294ef;}else if(_0x333195&&_0x333195[_0xf644('0x4d')]&&_0x333195['recordingFormat']!==_0xf644('0x4e')){logger[_0xf644('0xf')](_0xf644('0x4f'),_0xf644('0x50'));_0x2139cb[_0xf644('0x4c')]=_0x2294ef;}else{_0x2139cb['recordingURL']='';}return getAdminId(_0x212a99,_0x1756bc,_0x264bd1,_0x25802b)['then'](getUser(_0x1756bc,_0x264bd1,_0x25802b))[_0xf644('0x11')](getEndUser(_0x1756bc,_0x264bd1,_0x25802b))[_0xf644('0x11')](getTicket(_0x1756bc,_0x264bd1,_0x25802b,_0x2f04c3,_0x2139cb))[_0xf644('0x11')](function(_0x406394){logger[_0xf644('0xf')](util[_0xf644('0x33')](_0xf644('0x51'),_0x406394[_0xf644('0x34')]));if(_0x1756bc!==_0xf644('0x46')){logger[_0xf644('0xf')]('['+[_0x1756bc[_0xf644('0x20')]()]+']',_0xf644('0x52'));emit(_0x25802b,_0x101c35[_0xf644('0x53')],_0x406394[_0xf644('0x27')]);}})['catch'](function(_0x11ed35){logger[_0xf644('0x1f')]('['+[_0x1756bc[_0xf644('0x20')]()]+_0xf644('0x54'),util[_0xf644('0x55')](_0x11ed35,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1af5=['error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','/api/lookup?q=','&f=','&entities=contact','contacts','contactNumber','endUserId','work_number','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','outbound','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch'];(function(_0x4a0d48,_0x420e72){var _0x56b731=function(_0x3eb800){while(--_0x3eb800){_0x4a0d48['push'](_0x4a0d48['shift']());}};_0x56b731(++_0x420e72);}(_0x1af5,0x17d));var _0x51af=function(_0x5465fe,_0x5c5334){_0x5465fe=_0x5465fe-0x0;var _0x31cd8e=_0x1af5[_0x5465fe];return _0x31cd8e;};'use strict';var _=require(_0x51af('0x0'));var rp=require('request-promise');var md5=require(_0x51af('0x1'));var util=require(_0x51af('0x2'));var moment=require(_0x51af('0x3'));var Promise=require(_0x51af('0x4'));var Redis=require(_0x51af('0x5'));var intUtil=require(_0x51af('0x6'));var config=require(_0x51af('0x7'));var logger=require(_0x51af('0x8'))(_0x51af('0x9'));config[_0x51af('0xa')]=_[_0x51af('0xb')](config[_0x51af('0xa')],{'host':_0x51af('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x227c84,_0x5ca300,_0x1703d4,_0x120a29){return new Promise(function(_0x42015a,_0x7b32f2){var _0x2c8a17=![];var _0x400931={'method':_0x51af('0xd'),'uri':_0x120a29+'/api/selector/owners','json':!![]};_0x400931[_0x51af('0xe')]=_0x1703d4;logger[_0x51af('0xf')](_0x51af('0x10'));return rp(_0x400931)[_0x51af('0x11')](function(_0x7cb7d6){if(_0x7cb7d6){var _0x50eb9d=_0x7cb7d6[_0x51af('0x12')];var _0x50b48d=null;for(_0x50b48d=0x0;_0x50b48d<_0x50eb9d[_0x51af('0x13')];_0x50b48d++){if(_0x50eb9d[_0x50b48d]['email']===_0x227c84[_0x51af('0x14')]){_0x227c84[_0x51af('0x15')]=_0x50eb9d[_0x50b48d]['id'];_0x2c8a17=!![];}}if(_0x2c8a17){logger[_0x51af('0xf')]('Admin\x20found:',_0x227c84[_0x51af('0x15')]);_0x42015a(_0x227c84);}else{_0x7b32f2({'statusCode':0x194,'message':_0x51af('0x16')});}}else{_0x7b32f2({'statusCode':0x194,'message':_0x51af('0x16')});}})[_0x51af('0x17')](function(_0x51f544){logger[_0x51af('0x18')]('['+[_0x5ca300[_0x51af('0x19')]()]+']',_0x51f544[_0x51af('0x1a')]);_0x7b32f2(_0x51f544);});});}function getUser(_0x519b9c,_0x4970f5,_0xb234e4){return function(_0x1f1592){return new Promise(function(_0x1e62c8,_0x5ecc27){var _0x3e9279={'method':_0x51af('0xd'),'uri':_0xb234e4+_0x51af('0x1b'),'json':!![]};_0x3e9279[_0x51af('0xe')]=_0x4970f5;logger[_0x51af('0xf')](_0x51af('0x1c'));return rp(_0x3e9279)[_0x51af('0x11')](function(_0x464e1f){if(_0x464e1f){var _0x11e2e8=_0x464e1f['users'];var _0x530861=![];var _0x733b3b=null;if(_0x1f1592[_0x51af('0x1d')]!==null){logger[_0x51af('0xf')](_0x51af('0x1e'),_0x1f1592[_0x51af('0x1d')]);_0x1f1592['userEmail']=_0x1f1592[_0x51af('0x1d')];for(_0x733b3b=0x0;_0x733b3b<_0x11e2e8['length'];_0x733b3b++){if(_0x11e2e8[_0x733b3b]['email']===_0x1f1592[_0x51af('0x1d')]){_0x530861=!![];_0x1f1592['userId']=_0x11e2e8[_0x733b3b]['id'];logger[_0x51af('0xf')]('User\x20found:',_0x1f1592[_0x51af('0x1f')]);}}}if(!_0x530861){logger[_0x51af('0xf')]('Admin\x20selected');_0x1f1592['userEmail']=_0x1f1592[_0x51af('0x14')];_0x1f1592['userId']=_0x1f1592[_0x51af('0x15')];_0x530861=!![];}if(_0x530861){_0x1e62c8(_0x1f1592);}else{_0x5ecc27({'statusCode':0x194,'message':_0x51af('0x16')});}}else{_0x5ecc27({'statusCode':0x194,'message':_0x51af('0x16')});}})[_0x51af('0x17')](function(_0x4d81f9){logger[_0x51af('0x18')]('['+[_0x519b9c[_0x51af('0x19')]()]+']',_0x4d81f9[_0x51af('0x1a')]);_0x5ecc27(_0x4d81f9);});});};}function searchContact(_0x3d5130,_0x45cf25,_0x192e8d,_0x36647f){return new Promise(function(_0x58866a,_0x203d49){var _0x1ba74d={'method':_0x51af('0xd'),'headers':_0x45cf25,'uri':_0x3d5130+_0x51af('0x20')+_0x36647f+_0x51af('0x21')+_0x192e8d+_0x51af('0x22'),'json':!![]};rp(_0x1ba74d)['then'](function(_0xb6ec89){var _0x59f62b=_['find'](_0xb6ec89[_0x51af('0x23')][_0x51af('0x23')],[_0x192e8d,_0x36647f]);_0x58866a(_0x59f62b);})[_0x51af('0x17')](function(_0xa906f0){_0x203d49(_0xa906f0);});});}function getEndUser(_0x23936a,_0x449628,_0x5ae8f0){return function(_0xbd3292){return new Promise(function(_0x5b7194,_0x5841b5){logger[_0x51af('0xf')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0xbd3292['contactNumber']));searchContact(_0x5ae8f0,_0x449628,'mobile_number',_0xbd3292[_0x51af('0x24')])[_0x51af('0x11')](function(_0x9556c0){if(_0x9556c0){_0xbd3292[_0x51af('0x25')]=_0x9556c0['id'];logger['info']('Contact\x20found\x20mobile_number:',_0xbd3292[_0x51af('0x25')]);return _0x5b7194(_0xbd3292);}searchContact(_0x5ae8f0,_0x449628,_0x51af('0x26'),_0xbd3292[_0x51af('0x24')])[_0x51af('0x11')](function(_0x4409e5){if(_0x4409e5){_0xbd3292[_0x51af('0x25')]=_0x4409e5['id'];logger[_0x51af('0xf')]('Contact\x20found\x20work_number:',_0xbd3292[_0x51af('0x25')]);return _0x5b7194(_0xbd3292);}createEndUser(_0xbd3292,_0x23936a,_0x449628,_0x5ae8f0)[_0x51af('0x11')](function(_0xfddba2){logger[_0x51af('0xf')]('Contact\x20created:',_0xfddba2[_0x51af('0x25')]);return _0x5b7194(_0xfddba2);});});})[_0x51af('0x17')](function(_0x4c3596){_0x5841b5(_0x4c3596);});});};}function createEndUser(_0x1c0432,_0x68e8a,_0x245830,_0xd9571d){return new Promise(function(_0x3f9f0c,_0x2fb8b5){var _0x701a65=moment();var _0x34b410={'method':_0x51af('0x27'),'uri':_0xd9571d+_0x51af('0x28'),'body':{'contact':{'last_name':_0x1c0432[_0x51af('0x24')],'work_number':_0x1c0432[_0x51af('0x24')],'mobile_number':_0x1c0432['contactNumber'],'owner_id':_0x1c0432[_0x51af('0x1f')],'created_at':_0x701a65[_0x51af('0x29')](_0x51af('0x2a'))}},'json':!![]};_0x34b410[_0x51af('0xe')]=_0x245830;logger[_0x51af('0xf')](_0x51af('0x2b'));return rp(_0x34b410)['then'](function(_0x2c8370){_0x1c0432[_0x51af('0x25')]=_0x2c8370[_0x51af('0x2c')]['id'];_0x3f9f0c(_0x1c0432);})[_0x51af('0x17')](function(_0x79526){logger['error']('['+[_0x68e8a[_0x51af('0x19')]()]+']',_0x79526[_0x51af('0x1a')]);_0x2fb8b5(_0x79526[_0x51af('0x1a')]);});});}function getTicket(_0xf5ed26,_0x1b6472,_0x4fb91d,_0x495433,_0x2d4e44){return function(_0x3fd251){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x442441,_0x39d0b9){var _0x5e88ae=moment();var _0x1873a0={'method':'POST','uri':_0x4fb91d+_0x51af('0x2d'),'body':{'title':intUtil[_0x51af('0x2e')](_0x495433[_0x51af('0x2f')],_0x2d4e44,'\x20'),'description':intUtil[_0x51af('0x2e')](_0x495433[_0x51af('0x30')],_0x2d4e44,'\x0a'),'owner_id':_0x3fd251[_0x51af('0x1f')],'creater_id':_0x3fd251['adminId'],'targetable_id':_0x3fd251[_0x51af('0x25')],'targetable_type':'Contact','created_at':_0x5e88ae['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x5e88ae[_0x51af('0x31')](0x1e,'m')[_0x51af('0x29')](_0x51af('0x2a'))},'json':!![]};_0x1873a0[_0x51af('0xe')]=_0x1b6472;return rp(_0x1873a0)[_0x51af('0x11')](function(_0x67960){_0x3fd251[_0x51af('0x32')]=_0x67960[_0x51af('0x33')]['id'];logger[_0x51af('0xf')]('Task\x20created:',_0x3fd251[_0x51af('0x32')]);_0x442441(_0x3fd251);})['catch'](function(_0x5873af){logger[_0x51af('0x18')]('['+[_0xf5ed26['toUpperCase']()]+']',_0x5873af['message']);_0x39d0b9(_0x5873af[_0x51af('0x1a')]);});});};}function emit(_0x1e8d63,_0x26ea25,_0x581188){var _0x1a762c={'uri':_0x1e8d63+_0x51af('0x34')+_0x581188};io['to'](util[_0x51af('0x29')](_0x51af('0x35'),_0x26ea25))[_0x51af('0x36')](_0x51af('0x37'),_0x1a762c);}exports['cs']=function(_0x36f3b3,_0x51fef5,_0x5450e9,_0x1b1f48,_0x5ab1b3,_0x1a04d6,_0x20d83b,_0x4d172c){var _0x3af1d3={};var _0x54bf22={'Authorization':_0x51af('0x38')+_0x1a04d6[_0x51af('0x39')]};_0x1a04d6[_0x51af('0x3a')]=intUtil['stripTrailingSlash'](_0x1a04d6['remoteUri']);_0x1a04d6[_0x51af('0x3b')]=intUtil[_0x51af('0x3c')](_0x1a04d6[_0x51af('0x3b')]);var _0x44f609=_0x1a04d6[_0x51af('0x3a')];_0x3af1d3[_0x51af('0x14')]=_0x1a04d6[_0x51af('0x3d')];_0x3af1d3[_0x51af('0x24')]=_0x4d172c[_0x51af('0x3e')]()==='outbound'?_0x51fef5[_0x51af('0x3f')]:_0x51fef5[_0x51af('0x40')];_0x3af1d3[_0x51af('0x41')]=_0x4d172c===_0x51af('0x42')||_0x4d172c==='unmanaged'?_0x51af('0x42'):_0x51af('0x43');if(_0x1b1f48){_0x3af1d3['agentEmail']=_0x1b1f48[_0x51af('0x44')];}var _0x355a55=util['format'](_0x51af('0x45'),_0x1a04d6[_0x51af('0x3b')],_0x51fef5[_0x51af('0x46')],md5(_0x51fef5['uniqueid']));if(_0x5ab1b3&&_0x5ab1b3[_0x51af('0x47')]){logger['info']('[QUEUE]',_0x51af('0x48'));_0x51fef5[_0x51af('0x49')]=_0x355a55;}else if(_0x20d83b&&_0x20d83b['recordingFormat']&&_0x20d83b[_0x51af('0x4a')]!==_0x51af('0x4b')){logger[_0x51af('0xf')](_0x51af('0x4c'),_0x51af('0x48'));_0x51fef5[_0x51af('0x49')]=_0x355a55;}else{_0x51fef5[_0x51af('0x49')]='';}return getAdminId(_0x3af1d3,_0x4d172c,_0x54bf22,_0x44f609)['then'](getUser(_0x4d172c,_0x54bf22,_0x44f609))[_0x51af('0x11')](getEndUser(_0x4d172c,_0x54bf22,_0x44f609))['then'](getTicket(_0x4d172c,_0x54bf22,_0x44f609,_0x5450e9,_0x51fef5))[_0x51af('0x11')](function(_0x231eb0){logger[_0x51af('0xf')](util['format'](_0x51af('0x4d'),_0x231eb0[_0x51af('0x32')]));if(_0x4d172c!=='unmanaged'){logger[_0x51af('0xf')]('['+[_0x4d172c['toUpperCase']()]+']',_0x51af('0x4e'));emit(_0x44f609,_0x1b1f48['name'],_0x231eb0[_0x51af('0x25')]);}})[_0x51af('0x17')](function(_0x2a5940){logger[_0x51af('0x18')]('['+[_0x4d172c['toUpperCase']()]+_0x51af('0x4f'),util[_0x51af('0x50')](_0x2a5940,{'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 979b90d..c754c58 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 _0x955f=['%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./servicenow','./freshsales','zendesk','salesforce','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','unmanaged','desk','unknown\x20integration','error','format','../../../../config/logger','[EXEC]'];(function(_0x12c456,_0x1f4f92){var _0x24e1f3=function(_0x4dda32){while(--_0x4dda32){_0x12c456['push'](_0x12c456['shift']());}};_0x24e1f3(++_0x1f4f92);}(_0x955f,0x1eb));var _0xf955=function(_0x27f633,_0x23c85e){_0x27f633=_0x27f633-0x0;var _0x402544=_0x955f[_0x27f633];return _0x402544;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var zendesk=require(_0xf955('0x2'));var salesforce=require(_0xf955('0x3'));var sugarcrm=require(_0xf955('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xf955('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0xf955('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0xf955('0x7'));var integrations=[_0xf955('0x8'),_0xf955('0x9'),'sugarcrm',_0xf955('0xa'),_0xf955('0xb'),'desk',_0xf955('0xc'),_0xf955('0xd'),_0xf955('0xe'),_0xf955('0xf')];exports[_0xf955('0x10')]=function(_0x421e4a,_0x186719,_0x4d213a,_0xf7e3e,_0x5b0afa,_0x2d59e9){if(_0x4d213a){if(_[_0xf955('0x11')](integrations,_0x421e4a[_0xf955('0x12')]['toLowerCase']())){try{var _0x2f61b8=null;var _0x542347='';var _0x23e0c6=_0x4d213a[_0x421e4a['data1'][_0xf955('0x13')]()];if(_0x23e0c6){var _0x2ff7e5=_0x23e0c6[_0x421e4a[_0xf955('0x14')]];if(_0x2ff7e5){var _0x109bc5=_[_0xf955('0x15')](_0x2ff7e5[_0xf955('0x16')],{'id':parseInt(_0x421e4a[_0xf955('0x17')],0xa)});if(_0x109bc5){if(_0xf7e3e){if(_0x5b0afa&&_0x186719[_0xf955('0x18')]){_0x542347=_0xf955('0x18');}else if(_0x186719[_0xf955('0x19')]){_0x542347='outbound';}else{console[_0xf955('0x1a')]('EVENT\x20UNKNOWN',_0x186719);}}else{_0x542347=_0xf955('0x1b');}switch(_0x421e4a[_0xf955('0x12')][_0xf955('0x13')]()){case _0xf955('0x8'):zendesk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'salesforce':salesforce[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'sugarcrm':sugarcrm[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xa'):freshdesk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xb'):zoho[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0x1c'):desk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'vtiger':vtiger[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xe'):freshsales['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;case _0xf955('0xf'):servicenow['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;case _0xf955('0xd'):dynamics365['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;default:console[_0xf955('0x1a')](_0xf955('0x1d'));}}else{_0x2f61b8=require('../../../../config/logger')(_0x421e4a[_0xf955('0x12')][_0xf955('0x13')]());_0x2f61b8[_0xf955('0x1e')]('[EXEC]',util[_0xf955('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x421e4a[_0xf955('0x12')][_0xf955('0x13')](),_0x421e4a[_0xf955('0x17')]));}}else{_0x2f61b8=require(_0xf955('0x20'))(_0x421e4a[_0xf955('0x12')]['toLowerCase']());_0x2f61b8[_0xf955('0x1e')](_0xf955('0x21'),util[_0xf955('0x1f')](_0xf955('0x22'),_0x421e4a[_0xf955('0x12')][_0xf955('0x13')](),_0x421e4a[_0xf955('0x14')]));}}else{}}catch(_0x552cf3){console[_0xf955('0x1e')](_0x552cf3);}}}}; \ No newline at end of file +var _0x955f=['%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./servicenow','./freshsales','zendesk','salesforce','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','unmanaged','desk','unknown\x20integration','error','format','../../../../config/logger','[EXEC]'];(function(_0x4004e1,_0x4a241d){var _0x360efb=function(_0x598c7b){while(--_0x598c7b){_0x4004e1['push'](_0x4004e1['shift']());}};_0x360efb(++_0x4a241d);}(_0x955f,0x1eb));var _0xf955=function(_0x17abc9,_0x2f32ad){_0x17abc9=_0x17abc9-0x0;var _0x41b424=_0x955f[_0x17abc9];return _0x41b424;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var zendesk=require(_0xf955('0x2'));var salesforce=require(_0xf955('0x3'));var sugarcrm=require(_0xf955('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xf955('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0xf955('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0xf955('0x7'));var integrations=[_0xf955('0x8'),_0xf955('0x9'),'sugarcrm',_0xf955('0xa'),_0xf955('0xb'),'desk',_0xf955('0xc'),_0xf955('0xd'),_0xf955('0xe'),_0xf955('0xf')];exports[_0xf955('0x10')]=function(_0x421e4a,_0x186719,_0x4d213a,_0xf7e3e,_0x5b0afa,_0x2d59e9){if(_0x4d213a){if(_[_0xf955('0x11')](integrations,_0x421e4a[_0xf955('0x12')]['toLowerCase']())){try{var _0x2f61b8=null;var _0x542347='';var _0x23e0c6=_0x4d213a[_0x421e4a['data1'][_0xf955('0x13')]()];if(_0x23e0c6){var _0x2ff7e5=_0x23e0c6[_0x421e4a[_0xf955('0x14')]];if(_0x2ff7e5){var _0x109bc5=_[_0xf955('0x15')](_0x2ff7e5[_0xf955('0x16')],{'id':parseInt(_0x421e4a[_0xf955('0x17')],0xa)});if(_0x109bc5){if(_0xf7e3e){if(_0x5b0afa&&_0x186719[_0xf955('0x18')]){_0x542347=_0xf955('0x18');}else if(_0x186719[_0xf955('0x19')]){_0x542347='outbound';}else{console[_0xf955('0x1a')]('EVENT\x20UNKNOWN',_0x186719);}}else{_0x542347=_0xf955('0x1b');}switch(_0x421e4a[_0xf955('0x12')][_0xf955('0x13')]()){case _0xf955('0x8'):zendesk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'salesforce':salesforce[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'sugarcrm':sugarcrm[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xa'):freshdesk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xb'):zoho[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0x1c'):desk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'vtiger':vtiger[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xe'):freshsales['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;case _0xf955('0xf'):servicenow['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;case _0xf955('0xd'):dynamics365['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;default:console[_0xf955('0x1a')](_0xf955('0x1d'));}}else{_0x2f61b8=require('../../../../config/logger')(_0x421e4a[_0xf955('0x12')][_0xf955('0x13')]());_0x2f61b8[_0xf955('0x1e')]('[EXEC]',util[_0xf955('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x421e4a[_0xf955('0x12')][_0xf955('0x13')](),_0x421e4a[_0xf955('0x17')]));}}else{_0x2f61b8=require(_0xf955('0x20'))(_0x421e4a[_0xf955('0x12')]['toLowerCase']());_0x2f61b8[_0xf955('0x1e')](_0xf955('0x21'),util[_0xf955('0x1f')](_0xf955('0x22'),_0x421e4a[_0xf955('0x12')][_0xf955('0x13')](),_0x421e4a[_0xf955('0x14')]));}}else{}}catch(_0x552cf3){console[_0xf955('0x1e')](_0x552cf3);}}}}; \ 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 36a6e71..b0bcb22 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 _0x25d7=['Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','Task','assign','utc','getString','Descriptions','ticketType','Case','Subjects','ContactId','sobject','create','isNil','validateEmail','find','execute','then','length','Email','info','Agent\x20%s\x20found.','Name','user_id','display_name','identity','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Lead','Contact','lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format'];(function(_0x2c72f0,_0x2e182e){var _0x297da1=function(_0x216d7d){while(--_0x216d7d){_0x2c72f0['push'](_0x2c72f0['shift']());}};_0x297da1(++_0x2e182e);}(_0x25d7,0x18c));var _0x725d=function(_0x7a112,_0x2eb4a0){_0x7a112=_0x7a112-0x0;var _0x136dc5=_0x25d7[_0x7a112];return _0x136dc5;};'use strict';var _=require(_0x725d('0x0'));var rp=require(_0x725d('0x1'));var moment=require(_0x725d('0x2'));var BPromise=require(_0x725d('0x3'));var md5=require(_0x725d('0x4'));var jsforce=require(_0x725d('0x5'));var util=require(_0x725d('0x6'));var Redis=require('ioredis');var intUtil=require(_0x725d('0x7'));var config=require(_0x725d('0x8'));var logger=require(_0x725d('0x9'))(_0x725d('0xa'));config[_0x725d('0xb')]=_[_0x725d('0xc')](config['redis'],{'host':_0x725d('0xd'),'port':0x18eb});var io=require(_0x725d('0xe'))(new Redis(config[_0x725d('0xb')]));function emit(_0x3bdb44,_0x5840db,_0x81e8a3){io['to'](_0x3bdb44)['emit'](_0x5840db,_0x81e8a3);}function getTicket(_0x143f2a,_0x595713,_0x226676,_0x69bbce,_0x442864,_0x55c6df,_0x310fcc,_0x6cb274){var _0x50d934={};if(_0x69bbce['ticketType']===_0x725d('0xf')){_0x50d934=Object[_0x725d('0x10')]({},{'OwnerId':_0x595713['id'],'ActivityDate':moment[_0x725d('0x11')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x725d('0x12')](_0x69bbce['Subjects'],_0x442864,'\x20'),'Description':intUtil['getString'](_0x69bbce[_0x725d('0x13')],_0x442864,'\x0a')},getCustomFields(_0x55c6df,_0x442864));if(_0x226676){_0x50d934['WhoId']=_0x226676['id'];}}else if(_0x69bbce[_0x725d('0x14')]===_0x725d('0x15')){_0x50d934=Object[_0x725d('0x10')]({},{'OwnerId':_0x595713['id'],'Subject':intUtil[_0x725d('0x12')](_0x69bbce[_0x725d('0x16')],_0x442864,'\x20'),'Description':intUtil[_0x725d('0x12')](_0x69bbce[_0x725d('0x13')],_0x442864,'\x0a')},getCustomFields(_0x55c6df,_0x442864));if(_0x226676){_0x50d934[_0x725d('0x17')]=_0x226676['id'];}}return _0x310fcc[_0x725d('0x18')](_0x69bbce['ticketType'])[_0x725d('0x19')](_0x50d934);}function getUser(_0x46f861,_0x33b8f0,_0x2caaa3){if(!_[_0x725d('0x1a')](_0x33b8f0)&&intUtil[_0x725d('0x1b')](_0x33b8f0)){var _0x5e5779={'Email':_0x33b8f0};var _0x2eca3a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2caaa3[_0x725d('0x18')]('User')[_0x725d('0x1c')](_0x5e5779,_0x2eca3a)[_0x725d('0x1d')]()[_0x725d('0x1e')](function(_0xe1ce86){if(_0xe1ce86[_0x725d('0x1f')]){var _0x5a469e=_[_0x725d('0x1c')](_0xe1ce86,function(_0xeb2577){return _0xeb2577[_0x725d('0x20')]===_0x33b8f0;});if(_0x5a469e){logger[_0x725d('0x21')](_0x725d('0x22'),_0x33b8f0);return BPromise['resolve']({'id':_0x5a469e['Id'],'name':_0x5a469e[_0x725d('0x23')]});}}else{logger[_0x725d('0x21')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x33b8f0);return _0x2caaa3['identity']()['then'](function(_0x148f09){return BPromise['resolve']({'id':_0x148f09[_0x725d('0x24')],'name':_0x148f09[_0x725d('0x25')]});});}});}else{logger[_0x725d('0x21')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x33b8f0);return _0x2caaa3[_0x725d('0x26')]()['then'](function(_0x3fb35a){return BPromise[_0x725d('0x27')]({'id':_0x3fb35a[_0x725d('0x24')],'name':_0x3fb35a[_0x725d('0x25')]});});}}function getEndUser(_0x53f9ad,_0x110ddc,_0x3de549,_0x5a02d6,_0x5cdaa8){var _0x379931={'Phone':_0x5a02d6};var _0x513bdd={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x725d('0x27')]()[_0x725d('0x1e')](function(){if(_0x110ddc[_0x725d('0x14')]==='Task'){logger[_0x725d('0x21')](_0x725d('0x28'),_0x5a02d6,_0x110ddc[_0x725d('0x29')]);switch(_0x110ddc[_0x725d('0x29')]){case _0x725d('0x2a'):return _0x5cdaa8[_0x725d('0x18')]('Contact')[_0x725d('0x1c')](_0x379931,_0x513bdd)['execute']()['then'](function(_0x2d5f9f){if(_0x2d5f9f&&_0x2d5f9f[_0x725d('0x1f')]){return _0x2d5f9f;}else{return _0x5cdaa8[_0x725d('0x18')](_0x725d('0x2b'))[_0x725d('0x1c')](_0x379931,_0x513bdd);}});case'contact':return _0x5cdaa8[_0x725d('0x18')](_0x725d('0x2c'))[_0x725d('0x1c')](_0x379931,_0x513bdd)[_0x725d('0x1d')]();case _0x725d('0x2d'):return _0x5cdaa8['sobject'](_0x725d('0x2b'))['find'](_0x379931,_0x513bdd);default:return null;}}else if(_0x110ddc[_0x725d('0x14')]==='Case'){logger[_0x725d('0x21')](_0x725d('0x28'),_0x5a02d6,_0x725d('0x2e'));return _0x5cdaa8[_0x725d('0x18')](_0x725d('0x2c'))[_0x725d('0x1c')](_0x379931,_0x513bdd)[_0x725d('0x1d')]();}})['then'](function(_0x43bdd5){if(_0x43bdd5&&_0x43bdd5[_0x725d('0x1f')]){var _0x2f377e=_[_0x725d('0x1c')](_0x43bdd5,function(_0x99b1f7){return _0x99b1f7['Phone']===_0x5a02d6;});if(_0x2f377e){return BPromise['resolve']({'id':_0x2f377e['Id'],'name':_0x2f377e[_0x725d('0x23')],'phone':_0x2f377e[_0x725d('0x2f')]});}}})['then'](function(_0x271726){if(_0x271726){logger[_0x725d('0x21')](_0x725d('0x30'),_0x5a02d6);return BPromise['resolve'](_0x271726);}else{logger[_0x725d('0x21')](_0x725d('0x31'),_0x5a02d6);var _0x4f2730={'LastName':_0x3de549!==_0x725d('0x32')?_0x3de549:util[_0x725d('0x33')](_0x725d('0x34'),_0x5a02d6),'Phone':_0x5a02d6};if(_0x110ddc[_0x725d('0x35')]){if(_0x110ddc[_0x725d('0x35')]===_0x725d('0x2e')){logger[_0x725d('0x21')](_0x725d('0x36'),_0x5a02d6,_0x110ddc[_0x725d('0x35')]);}else if(_0x110ddc['moduleCreate']===_0x725d('0x2d')&&_0x110ddc[_0x725d('0x14')]===_0x725d('0xf')){logger[_0x725d('0x21')](_0x725d('0x36'),_0x5a02d6,_0x110ddc[_0x725d('0x35')]);_0x4f2730[_0x725d('0x37')]='No\x20Company';}else{return null;}}return _0x5cdaa8[_0x725d('0x18')](_[_0x725d('0x38')](_0x110ddc[_0x725d('0x35')]))[_0x725d('0x19')](_0x4f2730);}});}function getCustomFields(_0x4184b2,_0x25c74d){var _0x2ddb33={};if(_0x4184b2[_0x725d('0x1f')]>0x0){_[_0x725d('0x39')](_0x4184b2,function(_0x18349c){if(_0x18349c[_0x725d('0x3a')]===_0x725d('0x3b')&&_0x18349c[_0x725d('0x3c')]){_0x2ddb33[_0x18349c[_0x725d('0x3c')]]=_0x18349c[_0x725d('0x3d')][_0x725d('0x3e')]();}else if(_0x18349c[_0x725d('0x3a')]==='variable'&&_0x18349c['variableName']&&_0x18349c[_0x725d('0x3c')]){_0x25c74d[_0x18349c[_0x725d('0x3f')]]&&(_0x2ddb33[_0x18349c[_0x725d('0x3c')]]=_0x25c74d[_0x18349c[_0x725d('0x3f')]]['toString']());}else if(_0x18349c[_0x725d('0x3a')]===_0x725d('0x40')&&_0x18349c[_0x725d('0x41')]&&_0x18349c[_0x725d('0x41')]['name']&&_0x18349c[_0x725d('0x3c')]){_0x25c74d[_0x18349c['Variable'][_0x725d('0x42')][_0x725d('0x43')]()]&&(_0x2ddb33[_0x18349c[_0x725d('0x3c')]]=_0x25c74d[_0x18349c[_0x725d('0x41')][_0x725d('0x42')][_0x725d('0x43')]()]['toString']());}});}return _0x2ddb33;}function getConnection(_0x5a77de){var _0x22a62d=_0x5a77de['password'][_0x725d('0x44')](_0x5a77de[_0x725d('0x45')]);var _0x4567ce=new jsforce[(_0x725d('0x46'))]({'oauth2':{'loginUrl':_0x5a77de[_0x725d('0x47')]||_0x725d('0x48'),'clientId':_0x5a77de['clientId'],'clientSecret':_0x5a77de[_0x725d('0x49')]}});return _0x4567ce[_0x725d('0x4a')](_0x5a77de[_0x725d('0x4b')],_0x22a62d)[_0x725d('0x1e')](function(){logger[_0x725d('0x21')]('Connection\x20established.');return _0x4567ce;});}exports[_0x725d('0x4c')]=function(_0xfe3e7c,_0xa79aa,_0x2cd6db,_0x5d41e1,_0x2d0b2f,_0x949b98){var _0x54f6e8,_0x3a0784,_0x2d8184,_0xe1847b;_0x949b98[_0x725d('0x4d')]=intUtil['stripTrailingSlash'](_0x949b98[_0x725d('0x4d')]);_0x949b98['remoteUri']=intUtil[_0x725d('0x4e')](_0x949b98[_0x725d('0x47')]);if(_0x2d0b2f&&_0x2d0b2f['monitor_format']){logger[_0x725d('0x21')](_0x725d('0x4f'),_0x725d('0x50'));_0xa79aa['recordingURL']=util[_0x725d('0x33')](_0x725d('0x51'),_0x949b98['serverUrl'],_0xa79aa[_0x725d('0x52')],md5(_0xa79aa[_0x725d('0x52')]));}else{_0xa79aa[_0x725d('0x53')]='';}return getConnection(_0x949b98)[_0x725d('0x1e')](function(_0x4ccefd){_0xe1847b=_0x4ccefd;return getUser(_0x949b98,_0x5d41e1['email'],_0xe1847b);})[_0x725d('0x1e')](function(_0x346197){_0x54f6e8=_0x346197;return getEndUser(_0x949b98,_0x2cd6db,_0xa79aa[_0x725d('0x54')],_0xa79aa['calleridnum'],_0xe1847b);})[_0x725d('0x1e')](function(_0x255882){_0x3a0784=_0x255882;return getTicket(_0x949b98,_0x54f6e8,_0x3a0784,_0x2cd6db,_0xa79aa,_0x2cd6db[_0x725d('0x55')],_0xe1847b,'queue');})[_0x725d('0x1e')](function(_0xb0309){_0x2d8184=_0xb0309;logger[_0x725d('0x21')](_0x725d('0x56'),_0x2d8184['id']);logger[_0x725d('0x21')](_0x725d('0x57'),_0x2d8184['id'],_0x5d41e1[_0x725d('0x42')],_0x949b98[_0x725d('0x3a')]);switch(_0x949b98[_0x725d('0x3a')]){case _0x725d('0x58'):emit(util['format']('user:%s',_0x5d41e1['name']),_0x725d('0x59'),{'recordId':_0x2d8184['id']});break;case'newTab':emit(util['format'](_0x725d('0x5a'),_0x5d41e1[_0x725d('0x42')]),_0x725d('0x5b'),{'uri':util[_0x725d('0x33')](_0x725d('0x5c'),_0xe1847b[_0x725d('0x5d')],_0x2d8184['id'])});break;default:logger['error'](_0x725d('0x5e'));}})[_0x725d('0x5f')](function(_0x5283e8){logger[_0x725d('0x60')](_0x725d('0x4f'),JSON[_0x725d('0x61')](_0x5283e8));});};exports[_0x725d('0x62')]=function(_0x56c8b3,_0x2126de,_0x445914,_0x495410,_0x441b86,_0x3000cb,_0x5a7b97){var _0x4663f5,_0x125d33,_0x19a55a,_0x429930;_0x3000cb[_0x725d('0x4d')]=intUtil[_0x725d('0x4e')](_0x3000cb[_0x725d('0x4d')]);_0x3000cb[_0x725d('0x47')]=intUtil['stripTrailingSlash'](_0x3000cb[_0x725d('0x47')]);if(_0x5a7b97&&_0x5a7b97[_0x725d('0x63')]&&_0x5a7b97['recordingFormat']!==_0x725d('0x64')){logger['info'](_0x725d('0x65'),_0x725d('0x50'));_0x2126de[_0x725d('0x53')]=util['format'](_0x725d('0x51'),_0x3000cb[_0x725d('0x4d')],_0x2126de['uniqueid'],md5(_0x2126de[_0x725d('0x52')]));}return getConnection(_0x3000cb)[_0x725d('0x1e')](function(_0x5eb023){_0x429930=_0x5eb023;return getUser(_0x3000cb,_0x495410['email'],_0x429930);})['then'](function(_0x29791b){_0x4663f5=_0x29791b;return getEndUser(_0x3000cb,_0x445914,_0x2126de[_0x725d('0x66')],_0x2126de[_0x725d('0x67')],_0x429930);})[_0x725d('0x1e')](function(_0x254d69){_0x125d33=_0x254d69;return getTicket(_0x3000cb,_0x4663f5,_0x125d33,_0x445914,_0x2126de,_0x445914[_0x725d('0x55')],_0x429930,_0x725d('0x62'));})[_0x725d('0x1e')](function(_0x1e06a9){_0x19a55a=_0x1e06a9;logger[_0x725d('0x21')](_0x725d('0x68'),_0x19a55a['id']);logger[_0x725d('0x21')](_0x725d('0x69'),_0x19a55a['id'],_0x495410[_0x725d('0x42')],_0x3000cb[_0x725d('0x3a')]);switch(_0x3000cb[_0x725d('0x3a')]){case _0x725d('0x58'):emit(util[_0x725d('0x33')]('user:%s',_0x495410[_0x725d('0x42')]),_0x725d('0x59'),{'recordId':_0x19a55a['id']});break;case _0x725d('0x6a'):emit(util['format'](_0x725d('0x5a'),_0x495410[_0x725d('0x42')]),'trigger:browser:url',{'uri':util[_0x725d('0x33')](_0x725d('0x5c'),_0x429930[_0x725d('0x5d')],_0x19a55a['id'])});break;default:logger[_0x725d('0x60')](_0x725d('0x65'),_0x725d('0x6b'));}})[_0x725d('0x5f')](function(_0x4bc26a){logger[_0x725d('0x60')](_0x725d('0x65'),JSON[_0x725d('0x61')](_0x4bc26a));});};exports['unmanaged']=function(_0x4f8ac1,_0x4f5a22,_0xd72431,_0x104883,_0x4adba3,_0x412e00){var _0x5e89c4,_0x1c7f18,_0x24d7ee,_0x222a97;_0x412e00[_0x725d('0x4d')]=intUtil[_0x725d('0x4e')](_0x412e00[_0x725d('0x4d')]);_0x412e00[_0x725d('0x47')]=intUtil[_0x725d('0x4e')](_0x412e00[_0x725d('0x47')]);if(_0x4adba3&&_0x4adba3['monitor_format']){logger[_0x725d('0x21')]('['+_0x4f5a22[_0x725d('0x6c')]['toUpperCase']()+']',_0x725d('0x50'));_0x4f5a22[_0x725d('0x53')]=util['format'](_0x725d('0x51'),_0x412e00[_0x725d('0x4d')],_0x4f5a22[_0x725d('0x52')],md5(_0x4f5a22[_0x725d('0x52')]));}else{_0x4f5a22[_0x725d('0x53')]='';}return getConnection(_0x412e00)[_0x725d('0x1e')](function(_0x8d1e8d){_0x222a97=_0x8d1e8d;if(!_[_0x725d('0x1a')](_0x104883)){return getUser(_0x412e00,_0x104883['name'],_0x222a97);}else{return getUser(_0x412e00,null,_0x222a97);}})['then'](function(_0x3216da){_0x5e89c4=_0x3216da;return getEndUser(_0x412e00,_0xd72431,_0x4f5a22[_0x725d('0x54')],_0x4f5a22[_0x725d('0x6d')],_0x222a97);})[_0x725d('0x1e')](function(_0x276b34){_0x1c7f18=_0x276b34;return getTicket(_0x412e00,_0x5e89c4,_0x1c7f18,_0xd72431,_0x4f5a22,_0xd72431[_0x725d('0x55')],_0x222a97);})[_0x725d('0x1e')](function(_0x3ed26d){_0x24d7ee=_0x3ed26d;logger['info']('['+_0x4f5a22[_0x725d('0x6c')][_0x725d('0x6e')]()+_0x725d('0x6f'),_0x24d7ee['id']);logger['info']('['+_0x4f5a22[_0x725d('0x6c')][_0x725d('0x6e')]()+']\x20Integration\x20account\x20type\x20%s.',_0x412e00[_0x725d('0x3a')]);})[_0x725d('0x5f')](function(_0x3df937){logger[_0x725d('0x60')]('['+_0x4f5a22[_0x725d('0x6c')][_0x725d('0x6e')]()+']',JSON[_0x725d('0x61')](_0x3df937));});}; \ No newline at end of file +var _0x608f=['outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','%s/%s/e','error','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','Task','assign','getString','Subjects','WhoId','Case','Descriptions','ContactId','sobject','ticketType','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','identity','display_name','moduleSearch','Contact','execute','Lead','contact','lead','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','Phone','Name','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','create','forEach','string','idField','content','toString','variable','variableName','type','Variable','toLowerCase','name','password','concat','remoteUri','clientId','clientSecret','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','stringify'];(function(_0x5a9af5,_0x295ee1){var _0x507894=function(_0x2d773b){while(--_0x2d773b){_0x5a9af5['push'](_0x5a9af5['shift']());}};_0x507894(++_0x295ee1);}(_0x608f,0x7d));var _0xf608=function(_0x49ef5a,_0x48e8a5){_0x49ef5a=_0x49ef5a-0x0;var _0x5954fe=_0x608f[_0x49ef5a];return _0x5954fe;};'use strict';var _=require(_0xf608('0x0'));var rp=require(_0xf608('0x1'));var moment=require(_0xf608('0x2'));var BPromise=require(_0xf608('0x3'));var md5=require(_0xf608('0x4'));var jsforce=require(_0xf608('0x5'));var util=require(_0xf608('0x6'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xf608('0x7'));var logger=require('../../../../config/logger')(_0xf608('0x8'));config[_0xf608('0x9')]=_[_0xf608('0xa')](config[_0xf608('0x9')],{'host':_0xf608('0xb'),'port':0x18eb});var io=require(_0xf608('0xc'))(new Redis(config[_0xf608('0x9')]));function emit(_0x190925,_0x1c64bb,_0x535c3d){io['to'](_0x190925)[_0xf608('0xd')](_0x1c64bb,_0x535c3d);}function getTicket(_0x2215a3,_0xbd76fe,_0x1d760c,_0x112bb2,_0x1937eb,_0x246773,_0x128f2e,_0x528cc0){var _0x49ac85={};if(_0x112bb2['ticketType']===_0xf608('0xe')){_0x49ac85=Object[_0xf608('0xf')]({},{'OwnerId':_0xbd76fe['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xf608('0x10')](_0x112bb2[_0xf608('0x11')],_0x1937eb,'\x20'),'Description':intUtil['getString'](_0x112bb2['Descriptions'],_0x1937eb,'\x0a')},getCustomFields(_0x246773,_0x1937eb));if(_0x1d760c){_0x49ac85[_0xf608('0x12')]=_0x1d760c['id'];}}else if(_0x112bb2['ticketType']===_0xf608('0x13')){_0x49ac85=Object[_0xf608('0xf')]({},{'OwnerId':_0xbd76fe['id'],'Subject':intUtil[_0xf608('0x10')](_0x112bb2[_0xf608('0x11')],_0x1937eb,'\x20'),'Description':intUtil[_0xf608('0x10')](_0x112bb2[_0xf608('0x14')],_0x1937eb,'\x0a')},getCustomFields(_0x246773,_0x1937eb));if(_0x1d760c){_0x49ac85[_0xf608('0x15')]=_0x1d760c['id'];}}return _0x128f2e[_0xf608('0x16')](_0x112bb2[_0xf608('0x17')])['create'](_0x49ac85);}function getUser(_0x1bbad6,_0x1bda48,_0x4bcbe0){if(!_[_0xf608('0x18')](_0x1bda48)&&intUtil[_0xf608('0x19')](_0x1bda48)){var _0x472bb6={'Email':_0x1bda48};var _0x5aae5d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4bcbe0[_0xf608('0x16')](_0xf608('0x1a'))[_0xf608('0x1b')](_0x472bb6,_0x5aae5d)['execute']()[_0xf608('0x1c')](function(_0x54d1df){if(_0x54d1df[_0xf608('0x1d')]){var _0x39fada=_['find'](_0x54d1df,function(_0x579f84){return _0x579f84[_0xf608('0x1e')]===_0x1bda48;});if(_0x39fada){logger['info'](_0xf608('0x1f'),_0x1bda48);return BPromise['resolve']({'id':_0x39fada['Id'],'name':_0x39fada['Name']});}}else{logger[_0xf608('0x20')](_0xf608('0x21'),_0x1bda48);return _0x4bcbe0['identity']()['then'](function(_0x4f195d){return BPromise[_0xf608('0x22')]({'id':_0x4f195d['user_id'],'name':_0x4f195d['display_name']});});}});}else{logger[_0xf608('0x20')](_0xf608('0x21'),_0x1bda48);return _0x4bcbe0[_0xf608('0x23')]()[_0xf608('0x1c')](function(_0xd3e6f7){return BPromise['resolve']({'id':_0xd3e6f7['user_id'],'name':_0xd3e6f7[_0xf608('0x24')]});});}}function getEndUser(_0x7093ab,_0xeecc39,_0x25b5b2,_0x246e07,_0x184063){var _0x303ae8={'Phone':_0x246e07};var _0x32f9c3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xf608('0x1c')](function(){if(_0xeecc39[_0xf608('0x17')]===_0xf608('0xe')){logger[_0xf608('0x20')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x246e07,_0xeecc39[_0xf608('0x25')]);switch(_0xeecc39['moduleSearch']){case'contact_lead':return _0x184063[_0xf608('0x16')](_0xf608('0x26'))[_0xf608('0x1b')](_0x303ae8,_0x32f9c3)[_0xf608('0x27')]()[_0xf608('0x1c')](function(_0x3055a2){if(_0x3055a2&&_0x3055a2[_0xf608('0x1d')]){return _0x3055a2;}else{return _0x184063['sobject'](_0xf608('0x28'))[_0xf608('0x1b')](_0x303ae8,_0x32f9c3);}});case _0xf608('0x29'):return _0x184063[_0xf608('0x16')]('Contact')['find'](_0x303ae8,_0x32f9c3)['execute']();case _0xf608('0x2a'):return _0x184063[_0xf608('0x16')](_0xf608('0x28'))[_0xf608('0x1b')](_0x303ae8,_0x32f9c3);default:return null;}}else if(_0xeecc39['ticketType']===_0xf608('0x13')){logger[_0xf608('0x20')](_0xf608('0x2b'),_0x246e07,_0xf608('0x29'));return _0x184063['sobject'](_0xf608('0x26'))[_0xf608('0x1b')](_0x303ae8,_0x32f9c3)[_0xf608('0x27')]();}})[_0xf608('0x1c')](function(_0x143a5c){if(_0x143a5c&&_0x143a5c[_0xf608('0x1d')]){var _0x1b4bff=_[_0xf608('0x1b')](_0x143a5c,function(_0x2f93d0){return _0x2f93d0[_0xf608('0x2c')]===_0x246e07;});if(_0x1b4bff){return BPromise[_0xf608('0x22')]({'id':_0x1b4bff['Id'],'name':_0x1b4bff[_0xf608('0x2d')],'phone':_0x1b4bff[_0xf608('0x2c')]});}}})[_0xf608('0x1c')](function(_0x8fc850){if(_0x8fc850){logger[_0xf608('0x20')](_0xf608('0x2e'),_0x246e07);return BPromise[_0xf608('0x22')](_0x8fc850);}else{logger[_0xf608('0x20')](_0xf608('0x2f'),_0x246e07);var _0x7471ca={'LastName':_0x25b5b2!==''?_0x25b5b2:util[_0xf608('0x30')](_0xf608('0x31'),_0x246e07),'Phone':_0x246e07};if(_0xeecc39[_0xf608('0x32')]){if(_0xeecc39[_0xf608('0x32')]===_0xf608('0x29')){logger[_0xf608('0x20')](_0xf608('0x33'),_0x246e07,_0xeecc39['moduleCreate']);}else if(_0xeecc39['moduleCreate']===_0xf608('0x2a')&&_0xeecc39[_0xf608('0x17')]===_0xf608('0xe')){logger[_0xf608('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x246e07,_0xeecc39['moduleCreate']);_0x7471ca[_0xf608('0x34')]=_0xf608('0x35');}else{return null;}}return _0x184063[_0xf608('0x16')](_[_0xf608('0x36')](_0xeecc39[_0xf608('0x32')]))[_0xf608('0x37')](_0x7471ca);}});}function getCustomFields(_0x1e6780,_0x36290b){var _0x2c4caa={};if(_0x1e6780[_0xf608('0x1d')]>0x0){_[_0xf608('0x38')](_0x1e6780,function(_0x5e4ed2){if(_0x5e4ed2['type']===_0xf608('0x39')&&_0x5e4ed2[_0xf608('0x3a')]){_0x2c4caa[_0x5e4ed2[_0xf608('0x3a')]]=_0x5e4ed2[_0xf608('0x3b')][_0xf608('0x3c')]();}else if(_0x5e4ed2['type']===_0xf608('0x3d')&&_0x5e4ed2[_0xf608('0x3e')]&&_0x5e4ed2[_0xf608('0x3a')]){_0x36290b[_0x5e4ed2[_0xf608('0x3e')]]&&(_0x2c4caa[_0x5e4ed2[_0xf608('0x3a')]]=_0x36290b[_0x5e4ed2['variableName']][_0xf608('0x3c')]());}else if(_0x5e4ed2[_0xf608('0x3f')]==='customVariable'&&_0x5e4ed2[_0xf608('0x40')]&&_0x5e4ed2[_0xf608('0x40')]['name']&&_0x5e4ed2[_0xf608('0x3a')]){_0x36290b[_0x5e4ed2['Variable']['name'][_0xf608('0x41')]()]&&(_0x2c4caa[_0x5e4ed2['idField']]=_0x36290b[_0x5e4ed2['Variable'][_0xf608('0x42')][_0xf608('0x41')]()][_0xf608('0x3c')]());}});}return _0x2c4caa;}function getConnection(_0x39a982){var _0x492133=_0x39a982[_0xf608('0x43')][_0xf608('0x44')](_0x39a982['securityToken']);var _0x1e60e3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x39a982[_0xf608('0x45')]||'https://login.salesforce.com','clientId':_0x39a982[_0xf608('0x46')],'clientSecret':_0x39a982[_0xf608('0x47')]}});return _0x1e60e3['login'](_0x39a982['username'],_0x492133)['then'](function(){logger['info'](_0xf608('0x48'));return _0x1e60e3;});}exports['queue']=function(_0x2f4b85,_0x3f8903,_0x11d5a7,_0x4ce976,_0x4bf96c,_0x161088){var _0x34449a,_0x5dd02f,_0x16dc38,_0x7782e1;_0x161088[_0xf608('0x49')]=intUtil['stripTrailingSlash'](_0x161088[_0xf608('0x49')]);_0x161088['remoteUri']=intUtil[_0xf608('0x4a')](_0x161088[_0xf608('0x45')]);if(_0x4bf96c&&_0x4bf96c[_0xf608('0x4b')]){logger[_0xf608('0x20')](_0xf608('0x4c'),_0xf608('0x4d'));_0x3f8903['recordingURL']=util[_0xf608('0x30')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x161088[_0xf608('0x49')],_0x3f8903[_0xf608('0x4e')],md5(_0x3f8903[_0xf608('0x4e')]));}else{_0x3f8903[_0xf608('0x4f')]='';}return getConnection(_0x161088)[_0xf608('0x1c')](function(_0xaf0837){_0x7782e1=_0xaf0837;return getUser(_0x161088,_0x4ce976[_0xf608('0x50')],_0x7782e1);})[_0xf608('0x1c')](function(_0x296c93){_0x34449a=_0x296c93;return getEndUser(_0x161088,_0x11d5a7,_0x3f8903[_0xf608('0x51')],_0x3f8903[_0xf608('0x52')],_0x7782e1);})[_0xf608('0x1c')](function(_0x3288cf){_0x5dd02f=_0x3288cf;return getTicket(_0x161088,_0x34449a,_0x5dd02f,_0x11d5a7,_0x3f8903,_0x11d5a7[_0xf608('0x53')],_0x7782e1,'queue');})['then'](function(_0x5dd22f){_0x16dc38=_0x5dd22f;logger[_0xf608('0x20')](_0xf608('0x54'),_0x16dc38['id']);logger['info'](_0xf608('0x55'),_0x16dc38['id'],_0x4ce976[_0xf608('0x42')],_0x161088[_0xf608('0x3f')]);switch(_0x161088[_0xf608('0x3f')]){case _0xf608('0x56'):emit(util[_0xf608('0x30')]('user:%s',_0x4ce976[_0xf608('0x42')]),_0xf608('0x57'),{'recordId':_0x16dc38['id']});break;case _0xf608('0x58'):emit(util['format']('user:%s',_0x4ce976['name']),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x7782e1['instanceUrl'],_0x16dc38['id'])});break;default:logger['error'](_0xf608('0x59'));}})['catch'](function(_0x25fe29){logger['error']('[QUEUE]',JSON[_0xf608('0x5a')](_0x25fe29));});};exports[_0xf608('0x5b')]=function(_0x4d5aa4,_0x2b6a7b,_0x49d6bb,_0x39c0d0,_0x45c105,_0x83d418,_0x3fc54e){var _0x30846e,_0x1c7e06,_0x125aaf,_0x1ea985;_0x83d418[_0xf608('0x49')]=intUtil[_0xf608('0x4a')](_0x83d418[_0xf608('0x49')]);_0x83d418['remoteUri']=intUtil[_0xf608('0x4a')](_0x83d418[_0xf608('0x45')]);if(_0x3fc54e&&_0x3fc54e[_0xf608('0x5c')]&&_0x3fc54e[_0xf608('0x5c')]!==_0xf608('0x5d')){logger['info']('[OUTBOUND]',_0xf608('0x4d'));_0x2b6a7b['recordingURL']=util[_0xf608('0x30')](_0xf608('0x5e'),_0x83d418[_0xf608('0x49')],_0x2b6a7b['uniqueid'],md5(_0x2b6a7b[_0xf608('0x4e')]));}return getConnection(_0x83d418)[_0xf608('0x1c')](function(_0x40d65e){_0x1ea985=_0x40d65e;return getUser(_0x83d418,_0x39c0d0[_0xf608('0x50')],_0x1ea985);})['then'](function(_0x3840bb){_0x30846e=_0x3840bb;return getEndUser(_0x83d418,_0x49d6bb,_0x2b6a7b[_0xf608('0x5f')],_0x2b6a7b[_0xf608('0x60')],_0x1ea985);})[_0xf608('0x1c')](function(_0x4dbb27){_0x1c7e06=_0x4dbb27;return getTicket(_0x83d418,_0x30846e,_0x1c7e06,_0x49d6bb,_0x2b6a7b,_0x49d6bb[_0xf608('0x53')],_0x1ea985,_0xf608('0x5b'));})['then'](function(_0x402e23){_0x125aaf=_0x402e23;logger[_0xf608('0x20')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x125aaf['id']);logger[_0xf608('0x20')](_0xf608('0x61'),_0x125aaf['id'],_0x39c0d0[_0xf608('0x42')],_0x83d418[_0xf608('0x3f')]);switch(_0x83d418[_0xf608('0x3f')]){case'integrationTab':emit(util[_0xf608('0x30')](_0xf608('0x62'),_0x39c0d0[_0xf608('0x42')]),_0xf608('0x57'),{'recordId':_0x125aaf['id']});break;case _0xf608('0x58'):emit(util[_0xf608('0x30')](_0xf608('0x62'),_0x39c0d0[_0xf608('0x42')]),'trigger:browser:url',{'uri':util[_0xf608('0x30')](_0xf608('0x63'),_0x1ea985['instanceUrl'],_0x125aaf['id'])});break;default:logger[_0xf608('0x64')](_0xf608('0x65'),_0xf608('0x66'));}})[_0xf608('0x67')](function(_0x126eb2){logger['error'](_0xf608('0x65'),JSON[_0xf608('0x5a')](_0x126eb2));});};exports[_0xf608('0x68')]=function(_0x215de6,_0x448e46,_0x45e9cb,_0x3d2ad8,_0x34ebb3,_0x2ffe27){var _0x13e032,_0x443bd4,_0x34bf55,_0x35f441;_0x2ffe27[_0xf608('0x49')]=intUtil[_0xf608('0x4a')](_0x2ffe27[_0xf608('0x49')]);_0x2ffe27[_0xf608('0x45')]=intUtil[_0xf608('0x4a')](_0x2ffe27[_0xf608('0x45')]);if(_0x34ebb3&&_0x34ebb3[_0xf608('0x4b')]){logger[_0xf608('0x20')]('['+_0x448e46[_0xf608('0x69')]['toUpperCase']()+']',_0xf608('0x4d'));_0x448e46[_0xf608('0x4f')]=util[_0xf608('0x30')](_0xf608('0x5e'),_0x2ffe27[_0xf608('0x49')],_0x448e46[_0xf608('0x4e')],md5(_0x448e46[_0xf608('0x4e')]));}else{_0x448e46[_0xf608('0x4f')]='';}return getConnection(_0x2ffe27)[_0xf608('0x1c')](function(_0x62263a){_0x35f441=_0x62263a;if(!_['isNil'](_0x3d2ad8)){return getUser(_0x2ffe27,_0x3d2ad8['name'],_0x35f441);}else{return getUser(_0x2ffe27,null,_0x35f441);}})['then'](function(_0x3aab4a){_0x13e032=_0x3aab4a;return getEndUser(_0x2ffe27,_0x45e9cb,_0x448e46['calleridname'],_0x448e46['calleridnum'],_0x35f441);})['then'](function(_0x47aafe){_0x443bd4=_0x47aafe;return getTicket(_0x2ffe27,_0x13e032,_0x443bd4,_0x45e9cb,_0x448e46,_0x45e9cb[_0xf608('0x53')],_0x35f441);})['then'](function(_0x1aa45a){_0x34bf55=_0x1aa45a;logger['info']('['+_0x448e46[_0xf608('0x69')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x34bf55['id']);logger['info']('['+_0x448e46['lastevent'][_0xf608('0x6a')]()+_0xf608('0x6b'),_0x2ffe27[_0xf608('0x3f')]);})['catch'](function(_0x1546be){logger['error']('['+_0x448e46[_0xf608('0x69')][_0xf608('0x6a')]()+']',JSON[_0xf608('0x5a')](_0x1546be));});}; \ 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 3c8383d..b545ca1 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','content','toString','string','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','userEmail','],\x20getUser\x20entity','result','active','true','sys_id','userId','message','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System'];(function(_0x4a2ff1,_0x13de3b){var _0x106aa7=function(_0x433dca){while(--_0x433dca){_0x4a2ff1['push'](_0x4a2ff1['shift']());}};_0x106aa7(++_0x13de3b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x5fc3[_0x11ca63];return _0x41f1f6;};'use strict';var _=require(_0x35fc('0x0'));var Promise=require(_0x35fc('0x1'));var rp=require('request-promise');var util=require(_0x35fc('0x2'));var md5=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var intUtil=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../../config/logger')(_0x35fc('0x7'));config[_0x35fc('0x8')]=_[_0x35fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0xa'))(new Redis(config['redis']));function getAdminUser(_0x16e153,_0x27524f,_0xc72d93,_0x1e5f90,_0x34ff19,_0xf9d3a6){return new Promise(function(_0x2051ab,_0x565f95){var _0x1083a9={'method':_0x35fc('0xb'),'uri':_0x1e5f90+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x34ff19+'&'+_0xf9d3a6,'auth':_0x27524f,'json':!![]};return rp(_0x1083a9)[_0x35fc('0xc')](function(_0x33f491){if(_0x33f491['result'][_0x35fc('0xd')]>0x0){_0xc72d93[_0x35fc('0xe')]=_0x33f491['result'][0x0]['sys_id'];}logger[_0x35fc('0xf')]('['+[_0x16e153['toUpperCase']()]+_0x35fc('0x10'),_0xc72d93);_0x2051ab(_0xc72d93);})[_0x35fc('0x11')](function(_0x2a6ad2){logger[_0x35fc('0x12')]('['+[_0x16e153[_0x35fc('0x13')]()]+']',_0x2a6ad2['message']);_0x565f95(_0x2a6ad2['message']);});});}function getUser(_0x5eac0f,_0x558364,_0x398b67,_0x229d56,_0x53b898){return function(_0x154958){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x154958);return new Promise(function(_0x26ba54,_0x45c8b7){if(intUtil['validateEmail'](_0x154958[_0x35fc('0x14')])){var _0x363e47={'method':_0x35fc('0xb'),'uri':_0x398b67+'sys_user?sysparm_query=email%3D'+_0x154958[_0x35fc('0x14')]+'&'+_0x229d56+'&'+_0x53b898,'auth':_0x558364,'json':!![]};logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x363e47);return rp(_0x363e47)[_0x35fc('0xc')](function(_0x350a27){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+_0x35fc('0x15'),_0x350a27);if(_0x350a27[_0x35fc('0x16')][_0x35fc('0xd')]>0x0&&String(_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x17')])===_0x35fc('0x18')){_0x154958['userId']=_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x19')];}else{_0x154958[_0x35fc('0x1a')]=_0x154958[_0x35fc('0xe')];_0x154958[_0x35fc('0x14')]=_0x154958['adminEmail'];}logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20crm',_0x154958);_0x26ba54(_0x154958);})[_0x35fc('0x11')](function(_0x5a93df){logger[_0x35fc('0x12')]('['+[_0x5eac0f['toUpperCase']()]+']',_0x5a93df[_0x35fc('0x1b')]);_0x45c8b7(_0x5a93df['message']);});}else{logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+']\x20using\x20admin\x20profile');_0x154958['userId']=_0x154958[_0x35fc('0xe')];_0x154958['userEmail']=_0x154958[_0x35fc('0x1c')];_0x26ba54(_0x154958);}});};}function createEndUser(_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac,_0x383837){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x1d'),_0x26b7cb);return new Promise(function(_0x11ccdb,_0x451f0c){var _0x54aedc={'method':_0x35fc('0x1e'),'uri':_0x645eac+_0x35fc('0x1f')+_0x383837,'body':{'user_name':_0x26b7cb[_0x35fc('0x20')],'roles':'user','first_name':_0x26b7cb[_0x35fc('0x20')],'active':_0x35fc('0x18'),'date_format':_0x35fc('0x21'),'phone':_0x26b7cb[_0x35fc('0x20')]},'auth':_0x57001c,'json':!![]};return rp(_0x54aedc)[_0x35fc('0xc')](function(_0x103181){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x22'),_0x103181[_0x35fc('0x16')]);_0x26b7cb['endUserId']=_0x103181['result'][_0x35fc('0x19')];_0x11ccdb(_0x26b7cb);})['catch'](function(_0x37b394){logger[_0x35fc('0x12')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+']',_0x37b394[_0x35fc('0x1b')]);_0x451f0c(_0x37b394[_0x35fc('0x1b')]);});});}function getEndUser(_0x12e78f,_0x4e43b4,_0x3fe193,_0x330a14,_0x46b9ef){return function(_0x4441d8){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x4441d8);return new Promise(function(_0x2483be,_0x38193d){var _0x1fecdf={'method':'GET','uri':_0x3fe193+_0x35fc('0x23')+_0x4441d8['endUserNumber']+'&'+_0x330a14+'&'+_0x46b9ef,'auth':_0x4e43b4,'json':!![]};return rp(_0x1fecdf)[_0x35fc('0xc')](function(_0x33a377){if(_0x33a377[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){_0x4441d8['endUserId']=_0x33a377['result'][0x0]['sys_id'];logger[_0x35fc('0xf')]('['+[_0x12e78f['toUpperCase']()]+_0x35fc('0x24'),_0x4441d8);_0x2483be(_0x4441d8);}else{return createEndUser(_0x12e78f,_0x4e43b4,_0x4441d8,_0x3fe193,_0x330a14)['then'](function(_0x9c6b65){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+_0x35fc('0x25'),_0x9c6b65);_0x2483be(_0x9c6b65);});}})[_0x35fc('0x11')](function(_0x3313fa){logger[_0x35fc('0x12')]('['+[_0x12e78f['toUpperCase']()]+']',_0x3313fa[_0x35fc('0x1b')]);_0x38193d(_0x3313fa[_0x35fc('0x1b')]);});});};}function getCustomFields(_0x4e0ce3,_0x1feda5){var _0x1ccc41={};if(_0x4e0ce3[_0x35fc('0xd')]>0x0){_[_0x35fc('0x26')](_0x4e0ce3,function(_0x813866){if(_0x813866[_0x35fc('0x27')]==='string'&&_0x813866[_0x35fc('0x28')]&&!_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')]['toLowerCase']()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866['type']===_0x35fc('0x2d')&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')][_0x35fc('0x2e')]()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='variable'&&_0x813866['variableName']&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['variableName']][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='customVariable'&&_0x813866[_0x35fc('0x2f')]&&_0x813866[_0x35fc('0x2f')][_0x35fc('0x30')]&&_0x813866[_0x35fc('0x2a')]&&_0x813866['customField']){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['Variable']['name'][_0x35fc('0x2e')]()][_0x35fc('0x2c')]();}});}return _0x1ccc41;}function getTicket(_0x4fc5bc,_0x119925,_0x56cf1f,_0x13d16c,_0x40797d,_0x350237){return function(_0x2de5d1){logger[_0x35fc('0xf')]('['+[_0x4fc5bc['toUpperCase']()]+_0x35fc('0x31'),_0x2de5d1);return new Promise(function(_0x2c25d5,_0x4fd3d8){var _0x18181b=_0x4fc5bc[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2de5d1[_0x35fc('0x1a')]:_0x2de5d1['endUserId'];var _0x3666a5={'method':'POST','uri':_0x56cf1f+'incident'+'?'+_0x350237,'body':Object[_0x35fc('0x33')]({},{'active':_0x35fc('0x18'),'caller_id':_0x18181b,'assigned_to':_0x2de5d1[_0x35fc('0x1a')],'short_description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x35')],_0x40797d,'\x20'),'description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x36')],_0x40797d,'\x0a')},getCustomFields(_0x13d16c[_0x35fc('0x37')],_0x40797d)),'auth':_0x119925,'json':!![]};return rp(_0x3666a5)['then'](function(_0x3e2961){logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x38'),_0x3e2961[_0x35fc('0x16')]);_0x2de5d1[_0x35fc('0x39')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x19')];_0x2de5d1[_0x35fc('0x3a')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x3b')];logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x3c'),_0x2de5d1);_0x2c25d5(_0x2de5d1);})['catch'](function(_0x553ed6){logger[_0x35fc('0x12')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+']',_0x553ed6[_0x35fc('0x1b')]);_0x4fd3d8(_0x553ed6[_0x35fc('0x1b')]);});});};}function createRemoteTag(_0x3ee296,_0x3e6494,_0x4a4798,_0x4f024c){return new Promise(function(_0x388521,_0x19b2ce){var _0x395d63={'method':_0x35fc('0x1e'),'uri':_0x4a4798+'label'+'?'+_0x4f024c,'body':{'short_description':_0x3ee296,'global':!![],'active':!![],'name':_0x3ee296},'auth':_0x3e6494,'json':!![]};return rp(_0x395d63)[_0x35fc('0xc')](function(_0x13281f){var _0x4965d2=_0x13281f[_0x35fc('0x16')][_0x35fc('0x19')];_0x388521(_0x4965d2);});});}function getRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e,_0x18f18b){return new Promise(function(_0x5e4018,_0x4de34b){var _0x502a15={'method':_0x35fc('0xb'),'uri':_0x1ab472+_0x35fc('0x3d')+'?sysparm_query=name%3D'+_0x590faa+'&'+_0x26118e,'auth':_0x3e12e4,'json':!![]};return rp(_0x502a15)[_0x35fc('0xc')](function(_0x1f89b3){if(_0x1f89b3[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){var _0x46c59b=_0x1f89b3['result'][0x0][_0x35fc('0x19')];_0x5e4018(_0x46c59b);}else{return createRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e)[_0x35fc('0xc')](function(_0x39d470){_0x5e4018(_0x39d470);});}});});}function assignTagToIncident(_0x509e77,_0x304dba,_0x1dbf5a,_0x47fb1a,_0x35a676){return new Promise(function(_0x164c7b,_0x1c46b1){var _0x1c4c33={'method':_0x35fc('0x1e'),'uri':_0x1dbf5a+_0x35fc('0x3e')+'?'+_0x35a676,'body':{'label':_0x509e77,'table':_0x35fc('0x3f'),'id_type':_0x35fc('0x40'),'table_key':_0x47fb1a['ticketId'],'title':_0x35fc('0x41')+_0x47fb1a[_0x35fc('0x3a')],'id_display':_0x47fb1a[_0x35fc('0x3a')]},'auth':_0x304dba,'json':!![]};return rp(_0x1c4c33)['then'](function(_0x243871){_0x164c7b();})['catch'](function(){_0x164c7b();});});}function manageTags(_0x4ceacc,_0x5d4a39,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c,_0x3d06b8){return new Promise(function(_0x4bbea0,_0x579f5a){var _0x5353ea=[];_0x5d4a39['forEach'](function(_0x51d231){_0x5353ea[_0x35fc('0x42')](getRemoteTag(_0x51d231,_0x23b54f,_0xb1c68a,_0x13901c,_0x3d06b8));});return Promise[_0x35fc('0x43')](_0x5353ea)[_0x35fc('0xc')](function(_0x3ef680){if(_0x3ef680['length']){logger[_0x35fc('0xf')]('['+[_0x4ceacc[_0x35fc('0x13')]()]+_0x35fc('0x44'),_0x3ef680);var _0x1b0063=[];_0x3ef680[_0x35fc('0x26')](function(_0x1d0e53){_0x1b0063[_0x35fc('0x42')](assignTagToIncident(_0x1d0e53,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c));});return Promise[_0x35fc('0x43')](_0x1b0063)[_0x35fc('0xc')](function(){_0x4bbea0();})['catch'](function(){_0x4bbea0();});}else{_0x4bbea0();}});});}function getTags(_0x35d7c8,_0x47c75f,_0xfbd737,_0x9029e3,_0x2ac8e1,_0x2bc76c){return function(_0x4bdde7){return new Promise(function(_0x465c14,_0x4af592){var _0x4e2835=[];var _0x5f1d4a=_0x9029e3[_0x35fc('0x45')];if(_0x5f1d4a&&_0x5f1d4a['length']>0x0){_0x4e2835=_[_0x35fc('0x46')](_0x5f1d4a,'name');}if(_0x4e2835[_0x35fc('0xd')]>0x0){return manageTags(_0x35d7c8,_0x4e2835,_0x47c75f,_0xfbd737,_0x4bdde7,_0x2ac8e1,_0x2bc76c)['then'](function(){_0x465c14(_0x4bdde7);});}else{_0x465c14(_0x4bdde7);}});};}function emit(_0x42a53a,_0x455b84,_0x3400f0){var _0x1d81a5='%26sysparm_record_target%3Dincident'+_0x35fc('0x47')+_0x35fc('0x48')+_0x35fc('0x49');var _0x5df92d={'uri':_0x42a53a+_0x35fc('0x4a')+_0x3400f0+_0x1d81a5};io['to'](util[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x455b84))[_0x35fc('0x4d')](_0x35fc('0x4e'),_0x5df92d);}exports['cs']=function(_0x2c4309,_0x2ee98b,_0x4464d5,_0x5159a0,_0x28a44b,_0x2008b3,_0x2600d2,_0x4a926d){var _0x1c88d8={};var _0x1b76f0={'user':_0x2008b3['username'],'pass':_0x2008b3['password']};var _0x3969d3='sysparm_limit=1';var _0x223ad3=_0x35fc('0x4f');_0x2008b3[_0x35fc('0x50')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x50')]);_0x2008b3[_0x35fc('0x52')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x52')]);var _0x10b725=util[_0x35fc('0x4b')](_0x35fc('0x53'),_0x2008b3[_0x35fc('0x50')]);_0x1c88d8[_0x35fc('0x14')]=!_[_0x35fc('0x54')](_0x5159a0)?_0x5159a0[_0x35fc('0x55')]:null;_0x1c88d8[_0x35fc('0x1c')]=_0x2008b3[_0x35fc('0x55')];_0x1c88d8[_0x35fc('0x20')]=_0x4a926d[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2ee98b['destcalleridnum']:_0x2ee98b[_0x35fc('0x56')];_0x1c88d8['callDirection']=_0x4a926d===_0x35fc('0x57')||_0x4a926d===_0x35fc('0x58')?_0x35fc('0x57'):_0x35fc('0x32');var _0x25af78=util[_0x35fc('0x4b')](_0x35fc('0x59'),_0x2008b3[_0x35fc('0x52')],_0x2ee98b[_0x35fc('0x5a')],md5(_0x2ee98b[_0x35fc('0x5a')]));if(_0x28a44b&&_0x28a44b[_0x35fc('0x5b')]){logger['info'](_0x35fc('0x5c'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else if(_0x2600d2&&_0x2600d2[_0x35fc('0x5f')]&&_0x2600d2[_0x35fc('0x5f')]!==_0x35fc('0x60')){logger['info'](_0x35fc('0x61'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else{_0x2ee98b[_0x35fc('0x5e')]='';}return getAdminUser(_0x4a926d,_0x1b76f0,_0x1c88d8,_0x10b725,_0x223ad3,_0x3969d3)[_0x35fc('0xc')](getUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getEndUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getTicket(_0x4a926d,_0x1b76f0,_0x10b725,_0x4464d5,_0x2ee98b,_0x223ad3))[_0x35fc('0xc')](function(_0xa92234){logger['info'](util[_0x35fc('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0xa92234[_0x35fc('0x39')]));logger[_0x35fc('0xf')](util['format'](_0x35fc('0x62'),_0x4a926d));if(_0x4a926d!==_0x35fc('0x58')){logger[_0x35fc('0xf')]('['+[_0x4a926d[_0x35fc('0x13')]()]+']',_0x35fc('0x63'));emit(_0x2008b3[_0x35fc('0x50')],_0x5159a0[_0x35fc('0x30')],_0xa92234[_0x35fc('0x39')]);}})[_0x35fc('0x11')](function(_0x5806bf){logger['error']('['+[_0x4a926d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x35fc('0x64')](_0x5806bf,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xadb5=['endUserNumber','user','System','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','incident','Incident','Incident\x20-\x20','forEach','push','length','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','userEmail','GET','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xadb5,0xad));var _0x5adb=function(_0x4eb56e,_0x5896cc){_0x4eb56e=_0x4eb56e-0x0;var _0x14d155=_0xadb5[_0x4eb56e];return _0x14d155;};'use strict';var _=require('lodash');var Promise=require(_0x5adb('0x0'));var rp=require('request-promise');var util=require(_0x5adb('0x1'));var md5=require(_0x5adb('0x2'));var Redis=require(_0x5adb('0x3'));var intUtil=require('./util');var config=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var io=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));function getAdminUser(_0x353885,_0x47228a,_0x6d1b45,_0x41261c,_0x7293ab,_0x34f59d){return new Promise(function(_0x336bad,_0x129f5a){var _0x275428={'method':'GET','uri':_0x41261c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x7293ab+'&'+_0x34f59d,'auth':_0x47228a,'json':!![]};return rp(_0x275428)[_0x5adb('0xb')](function(_0x1ea238){if(_0x1ea238[_0x5adb('0xc')]['length']>0x0){_0x6d1b45[_0x5adb('0xd')]=_0x1ea238['result'][0x0][_0x5adb('0xe')];}logger['info']('['+[_0x353885[_0x5adb('0xf')]()]+_0x5adb('0x10'),_0x6d1b45);_0x336bad(_0x6d1b45);})[_0x5adb('0x11')](function(_0x5c929a){logger[_0x5adb('0x12')]('['+[_0x353885[_0x5adb('0xf')]()]+']',_0x5c929a[_0x5adb('0x13')]);_0x129f5a(_0x5c929a['message']);});});}function getUser(_0x2312de,_0x518823,_0x367d82,_0x42a482,_0x30614e){return function(_0x304784){logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+_0x5adb('0x15'),_0x304784);return new Promise(function(_0x42f4c6,_0xb953a6){if(intUtil['validateEmail'](_0x304784[_0x5adb('0x16')])){var _0x5de028={'method':_0x5adb('0x17'),'uri':_0x367d82+'sys_user?sysparm_query=email%3D'+_0x304784[_0x5adb('0x16')]+'&'+_0x42a482+'&'+_0x30614e,'auth':_0x518823,'json':!![]};logger['info']('['+[_0x2312de['toUpperCase']()]+_0x5adb('0x18'),_0x5de028);return rp(_0x5de028)[_0x5adb('0xb')](function(_0x438671){logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+'],\x20getUser\x20entity',_0x438671);if(_0x438671[_0x5adb('0xc')]['length']>0x0&&String(_0x438671['result'][0x0][_0x5adb('0x19')])===_0x5adb('0x1a')){_0x304784[_0x5adb('0x1b')]=_0x438671[_0x5adb('0xc')][0x0][_0x5adb('0xe')];}else{_0x304784[_0x5adb('0x1b')]=_0x304784[_0x5adb('0xd')];_0x304784['userEmail']=_0x304784[_0x5adb('0x1c')];}logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+_0x5adb('0x1d'),_0x304784);_0x42f4c6(_0x304784);})[_0x5adb('0x11')](function(_0x49f203){logger[_0x5adb('0x12')]('['+[_0x2312de[_0x5adb('0xf')]()]+']',_0x49f203['message']);_0xb953a6(_0x49f203[_0x5adb('0x13')]);});}else{logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+']\x20using\x20admin\x20profile');_0x304784[_0x5adb('0x1b')]=_0x304784[_0x5adb('0xd')];_0x304784[_0x5adb('0x16')]=_0x304784[_0x5adb('0x1c')];_0x42f4c6(_0x304784);}});};}function createEndUser(_0x36459b,_0x1c06c4,_0x4a5d46,_0x49992e,_0x5d457e){logger[_0x5adb('0x14')]('['+[_0x36459b[_0x5adb('0xf')]()]+_0x5adb('0x1e'),_0x4a5d46);return new Promise(function(_0x512bab,_0x137a5c){var _0x4de310={'method':_0x5adb('0x1f'),'uri':_0x49992e+_0x5adb('0x20')+_0x5d457e,'body':{'user_name':_0x4a5d46[_0x5adb('0x21')],'roles':_0x5adb('0x22'),'first_name':_0x4a5d46[_0x5adb('0x21')],'active':_0x5adb('0x1a'),'date_format':_0x5adb('0x23'),'phone':_0x4a5d46[_0x5adb('0x21')]},'auth':_0x1c06c4,'json':!![]};return rp(_0x4de310)[_0x5adb('0xb')](function(_0x260295){logger['info']('['+[_0x36459b[_0x5adb('0xf')]()]+'],\x20EndUser\x20schema',_0x260295[_0x5adb('0xc')]);_0x4a5d46[_0x5adb('0x24')]=_0x260295['result'][_0x5adb('0xe')];_0x512bab(_0x4a5d46);})[_0x5adb('0x11')](function(_0x461a39){logger['error']('['+[_0x36459b[_0x5adb('0xf')]()]+']',_0x461a39[_0x5adb('0x13')]);_0x137a5c(_0x461a39['message']);});});}function getEndUser(_0x5bb227,_0x1ed9ea,_0x49dd03,_0x663ea0,_0x222568){return function(_0x3c2b07){logger[_0x5adb('0x14')]('['+[_0x5bb227[_0x5adb('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x3c2b07);return new Promise(function(_0x2f7abe,_0x215b88){var _0x1c3a5c={'method':'GET','uri':_0x49dd03+'sys_user?sysparm_query=phone%3D'+_0x3c2b07[_0x5adb('0x21')]+'&'+_0x663ea0+'&'+_0x222568,'auth':_0x1ed9ea,'json':!![]};return rp(_0x1c3a5c)[_0x5adb('0xb')](function(_0x586820){if(_0x586820[_0x5adb('0xc')]['length']>0x0){_0x3c2b07[_0x5adb('0x24')]=_0x586820['result'][0x0][_0x5adb('0xe')];logger['info']('['+[_0x5bb227[_0x5adb('0xf')]()]+_0x5adb('0x25'),_0x3c2b07);_0x2f7abe(_0x3c2b07);}else{return createEndUser(_0x5bb227,_0x1ed9ea,_0x3c2b07,_0x49dd03,_0x663ea0)['then'](function(_0x4761e3){logger['info']('['+[_0x5bb227[_0x5adb('0xf')]()]+_0x5adb('0x26'),_0x4761e3);_0x2f7abe(_0x4761e3);});}})[_0x5adb('0x11')](function(_0x50edd1){logger[_0x5adb('0x12')]('['+[_0x5bb227[_0x5adb('0xf')]()]+']',_0x50edd1[_0x5adb('0x13')]);_0x215b88(_0x50edd1[_0x5adb('0x13')]);});});};}function getCustomFields(_0x22aa95,_0x52d74f){var _0x50fe99={};if(_0x22aa95['length']>0x0){_['forEach'](_0x22aa95,function(_0x427c71){if(_0x427c71[_0x5adb('0x27')]===_0x5adb('0x28')&&_0x427c71[_0x5adb('0x29')]&&!_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x427c71[_0x5adb('0x2d')]['toString']();}else if(_0x427c71['type']===_0x5adb('0x28')&&_0x427c71['idField']&&_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x427c71[_0x5adb('0x2d')][_0x5adb('0x2e')]();}else if(_0x427c71['type']===_0x5adb('0x2f')&&_0x427c71[_0x5adb('0x30')]&&_0x427c71['idField']&&_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')]['toLowerCase']()]=_0x52d74f[_0x427c71[_0x5adb('0x30')]][_0x5adb('0x2e')]();}else if(_0x427c71[_0x5adb('0x27')]===_0x5adb('0x31')&&_0x427c71[_0x5adb('0x32')]&&_0x427c71[_0x5adb('0x32')][_0x5adb('0x33')]&&_0x427c71['idField']&&_0x427c71['customField']){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x52d74f[_0x427c71[_0x5adb('0x32')][_0x5adb('0x33')]['toLowerCase']()]['toString']();}});}return _0x50fe99;}function getTicket(_0xaa32e4,_0x4d7d86,_0x264dfd,_0x72218,_0x1713bc,_0x5358c0){return function(_0x182cbc){logger[_0x5adb('0x14')]('['+[_0xaa32e4['toUpperCase']()]+_0x5adb('0x34'),_0x182cbc);return new Promise(function(_0x251f45,_0x1cdb03){var _0x24758f=_0xaa32e4[_0x5adb('0x2c')]()===_0x5adb('0x35')?_0x182cbc[_0x5adb('0x1b')]:_0x182cbc[_0x5adb('0x24')];var _0x49e1a1={'method':_0x5adb('0x1f'),'uri':_0x264dfd+'incident'+'?'+_0x5358c0,'body':Object['assign']({},{'active':'true','caller_id':_0x24758f,'assigned_to':_0x182cbc[_0x5adb('0x1b')],'short_description':intUtil[_0x5adb('0x36')](_0x72218[_0x5adb('0x37')],_0x1713bc,'\x20'),'description':intUtil['getString'](_0x72218[_0x5adb('0x38')],_0x1713bc,'\x0a')},getCustomFields(_0x72218['Fields'],_0x1713bc)),'auth':_0x4d7d86,'json':!![]};return rp(_0x49e1a1)[_0x5adb('0xb')](function(_0x2c3f21){logger[_0x5adb('0x14')]('['+[_0xaa32e4['toUpperCase']()]+_0x5adb('0x39'),_0x2c3f21['result']);_0x182cbc[_0x5adb('0x3a')]=_0x2c3f21[_0x5adb('0xc')]['sys_id'];_0x182cbc[_0x5adb('0x3b')]=_0x2c3f21[_0x5adb('0xc')][_0x5adb('0x3c')];logger[_0x5adb('0x14')]('['+[_0xaa32e4[_0x5adb('0xf')]()]+']\x20getTicket\x20crm',_0x182cbc);_0x251f45(_0x182cbc);})[_0x5adb('0x11')](function(_0x3a5703){logger[_0x5adb('0x12')]('['+[_0xaa32e4[_0x5adb('0xf')]()]+']',_0x3a5703['message']);_0x1cdb03(_0x3a5703[_0x5adb('0x13')]);});});};}function createRemoteTag(_0x14a46f,_0x3b4794,_0x4d98d0,_0x2b34a8){return new Promise(function(_0xd0e5b7,_0x444a6c){var _0xfd3471={'method':'POST','uri':_0x4d98d0+_0x5adb('0x3d')+'?'+_0x2b34a8,'body':{'short_description':_0x14a46f,'global':!![],'active':!![],'name':_0x14a46f},'auth':_0x3b4794,'json':!![]};return rp(_0xfd3471)[_0x5adb('0xb')](function(_0x28b291){var _0x2cee37=_0x28b291[_0x5adb('0xc')]['sys_id'];_0xd0e5b7(_0x2cee37);});});}function getRemoteTag(_0x378938,_0x4b8d28,_0x2b790d,_0x4f7227,_0x31ae72){return new Promise(function(_0x35df22,_0x1a9358){var _0x42f6d9={'method':'GET','uri':_0x2b790d+_0x5adb('0x3d')+_0x5adb('0x3e')+_0x378938+'&'+_0x4f7227,'auth':_0x4b8d28,'json':!![]};return rp(_0x42f6d9)[_0x5adb('0xb')](function(_0x53d262){if(_0x53d262['result']['length']>0x0){var _0x18ee9a=_0x53d262[_0x5adb('0xc')][0x0][_0x5adb('0xe')];_0x35df22(_0x18ee9a);}else{return createRemoteTag(_0x378938,_0x4b8d28,_0x2b790d,_0x4f7227)[_0x5adb('0xb')](function(_0xa833f4){_0x35df22(_0xa833f4);});}});});}function assignTagToIncident(_0xb06bee,_0x204b9b,_0x8d7810,_0xc880af,_0x380d76){return new Promise(function(_0x452767,_0x1df439){var _0x2c2357={'method':'POST','uri':_0x8d7810+'label_entry'+'?'+_0x380d76,'body':{'label':_0xb06bee,'table':_0x5adb('0x3f'),'id_type':_0x5adb('0x40'),'table_key':_0xc880af[_0x5adb('0x3a')],'title':_0x5adb('0x41')+_0xc880af['ticketNumber'],'id_display':_0xc880af[_0x5adb('0x3b')]},'auth':_0x204b9b,'json':!![]};return rp(_0x2c2357)[_0x5adb('0xb')](function(_0x5d2d2f){_0x452767();})[_0x5adb('0x11')](function(){_0x452767();});});}function manageTags(_0x476e62,_0x1505f7,_0x5edd60,_0x30d185,_0x409357,_0x19df2f,_0x30c92c){return new Promise(function(_0x330290,_0x428019){var _0x513f26=[];_0x1505f7[_0x5adb('0x42')](function(_0x1f042f){_0x513f26[_0x5adb('0x43')](getRemoteTag(_0x1f042f,_0x5edd60,_0x30d185,_0x19df2f,_0x30c92c));});return Promise['all'](_0x513f26)[_0x5adb('0xb')](function(_0x239862){if(_0x239862[_0x5adb('0x44')]){logger['info']('['+[_0x476e62[_0x5adb('0xf')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x239862);var _0xa8ff64=[];_0x239862[_0x5adb('0x42')](function(_0x24e1ab){_0xa8ff64['push'](assignTagToIncident(_0x24e1ab,_0x5edd60,_0x30d185,_0x409357,_0x19df2f));});return Promise[_0x5adb('0x45')](_0xa8ff64)[_0x5adb('0xb')](function(){_0x330290();})['catch'](function(){_0x330290();});}else{_0x330290();}});});}function getTags(_0x12711e,_0x432a3e,_0x248739,_0x3fcad5,_0x55cd0a,_0x4290bb){return function(_0x2b8298){return new Promise(function(_0x307f07,_0x16716e){var _0x5b7556=[];var _0x53a4bc=_0x3fcad5[_0x5adb('0x46')];if(_0x53a4bc&&_0x53a4bc['length']>0x0){_0x5b7556=_['map'](_0x53a4bc,'name');}if(_0x5b7556[_0x5adb('0x44')]>0x0){return manageTags(_0x12711e,_0x5b7556,_0x432a3e,_0x248739,_0x2b8298,_0x55cd0a,_0x4290bb)[_0x5adb('0xb')](function(){_0x307f07(_0x2b8298);});}else{_0x307f07(_0x2b8298);}});};}function emit(_0x48bb5c,_0x395350,_0x91e023){var _0xcdde17=_0x5adb('0x47')+_0x5adb('0x48')+_0x5adb('0x49')+_0x5adb('0x4a');var _0x1ffcd3={'uri':_0x48bb5c+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x91e023+_0xcdde17};io['to'](util['format']('user:%s',_0x395350))[_0x5adb('0x4b')](_0x5adb('0x4c'),_0x1ffcd3);}exports['cs']=function(_0x3a0d1b,_0x2a55a3,_0x1f59bb,_0x2f6ef7,_0x386c76,_0x25f761,_0x58455b,_0x5e55c2){var _0x1fc73b={};var _0x56df90={'user':_0x25f761[_0x5adb('0x4d')],'pass':_0x25f761[_0x5adb('0x4e')]};var _0x2146f0=_0x5adb('0x4f');var _0x40140f=_0x5adb('0x50');_0x25f761[_0x5adb('0x51')]=intUtil[_0x5adb('0x52')](_0x25f761['remoteUri']);_0x25f761[_0x5adb('0x53')]=intUtil[_0x5adb('0x52')](_0x25f761[_0x5adb('0x53')]);var _0x5d3aa4=util[_0x5adb('0x54')](_0x5adb('0x55'),_0x25f761['remoteUri']);_0x1fc73b[_0x5adb('0x16')]=!_['isNil'](_0x2f6ef7)?_0x2f6ef7[_0x5adb('0x56')]:null;_0x1fc73b[_0x5adb('0x1c')]=_0x25f761['email'];_0x1fc73b[_0x5adb('0x21')]=_0x5e55c2[_0x5adb('0x2c')]()===_0x5adb('0x35')?_0x2a55a3[_0x5adb('0x57')]:_0x2a55a3[_0x5adb('0x58')];_0x1fc73b[_0x5adb('0x59')]=_0x5e55c2===_0x5adb('0x5a')||_0x5e55c2===_0x5adb('0x5b')?'queue':_0x5adb('0x35');var _0x31345d=util[_0x5adb('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25f761['serverUrl'],_0x2a55a3[_0x5adb('0x5c')],md5(_0x2a55a3['uniqueid']));if(_0x386c76&&_0x386c76[_0x5adb('0x5d')]){logger[_0x5adb('0x14')](_0x5adb('0x5e'),'Recording\x20is\x20enabled!');_0x2a55a3[_0x5adb('0x5f')]=_0x31345d;}else if(_0x58455b&&_0x58455b[_0x5adb('0x60')]&&_0x58455b[_0x5adb('0x60')]!==_0x5adb('0x61')){logger[_0x5adb('0x14')]('[OUTBOUND]',_0x5adb('0x62'));_0x2a55a3[_0x5adb('0x5f')]=_0x31345d;}else{_0x2a55a3[_0x5adb('0x5f')]='';}return getAdminUser(_0x5e55c2,_0x56df90,_0x1fc73b,_0x5d3aa4,_0x40140f,_0x2146f0)[_0x5adb('0xb')](getUser(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x40140f,_0x2146f0))['then'](getEndUser(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x40140f,_0x2146f0))[_0x5adb('0xb')](getTicket(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x1f59bb,_0x2a55a3,_0x40140f))[_0x5adb('0xb')](function(_0x182873){logger[_0x5adb('0x14')](util[_0x5adb('0x54')](_0x5adb('0x63'),_0x182873[_0x5adb('0x3a')]));logger['info'](util[_0x5adb('0x54')](_0x5adb('0x64'),_0x5e55c2));if(_0x5e55c2!=='unmanaged'){logger[_0x5adb('0x14')]('['+[_0x5e55c2[_0x5adb('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x25f761[_0x5adb('0x51')],_0x2f6ef7['name'],_0x182873[_0x5adb('0x3a')]);}})[_0x5adb('0x11')](function(_0x4a2ebc){logger[_0x5adb('0x12')]('['+[_0x5e55c2['toUpperCase']()]+_0x5adb('0x65'),util[_0x5adb('0x66')](_0x4a2ebc,{'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 448c28d..4af16c0 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 _0xf330=['parent_type','Contacts','parent_name','direction','variableName','idField','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','name_value_list','value','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','then','length','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','debug','merge','forEach','type','nameField','customField','toLowerCase','content','string','custom_fields','push','variable','customVariable','Variable','POST','username','password','PLAIN','sessionID','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri','%s/service/v4_1/rest.php','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','Outbound','users','version','charAt','unmanaged','monitor_format','lastevent','bluebird','md5','util','./util','../../../../config/environment','sugarcrm','defaults','redis','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','getString','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id'];(function(_0x1f0314,_0x1a8c61){var _0xb4de5f=function(_0xe6d511){while(--_0xe6d511){_0x1f0314['push'](_0x1f0314['shift']());}};_0xb4de5f(++_0x1a8c61);}(_0xf330,0x147));var _0x0f33=function(_0x5d624d,_0xb2d43c){_0x5d624d=_0x5d624d-0x0;var _0x1bd17e=_0xf330[_0x5d624d];return _0x1bd17e;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x0f33('0x0'));var md5=require(_0x0f33('0x1'));var util=require(_0x0f33('0x2'));var Redis=require('ioredis');var intUtil=require(_0x0f33('0x3'));var config=require(_0x0f33('0x4'));var logger=require('../../../../config/logger')(_0x0f33('0x5'));config['redis']=_[_0x0f33('0x6')](config[_0x0f33('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x0f33('0x8'))(new Redis(config[_0x0f33('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x56b673,_0x10b9cb,_0x54a7aa){io['to'](_0x56b673)[_0x0f33('0x9')](_0x10b9cb,_0x54a7aa);}function getTicket(_0x5790d5,_0x3960bc,_0x3de741,_0x56c117,_0x55f169,_0x7f2b66,_0x40e15b,_0x1d61f7){logger[_0x0f33('0xa')](_0x0f33('0xb'));var _0x310d46=new Date();var _0x2eec70=[{'name':_0x0f33('0xc'),'value':intUtil['getString'](_0x56c117[_0x0f33('0xd')],_0x55f169,'\x20')},{'name':_0x0f33('0xe'),'value':_0x3960bc['id']},{'name':_0x0f33('0xf'),'value':_0x3960bc['id']},{'name':'description','value':intUtil[_0x0f33('0x10')](_0x56c117[_0x0f33('0x11')],_0x55f169,'\x0a')},{'name':_0x0f33('0x12'),'value':_0x310d46['toISOString']()[_0x0f33('0x13')](0x0,0x13)[_0x0f33('0x14')]('T','\x20')},{'name':_0x0f33('0x15'),'value':'0'},{'name':_0x0f33('0x16'),'value':'15'},{'name':_0x0f33('0x17'),'value':_0x3de741['id']},{'name':_0x0f33('0x18'),'value':_0x0f33('0x19')},{'name':_0x0f33('0x1a'),'value':_0x3de741['name']},{'name':_0x0f33('0x1b'),'value':_0x1d61f7}];if(_0x7f2b66['length']){_['forEach'](_0x7f2b66,function(_0x19f26b){if(_0x55f169[_0x19f26b[_0x0f33('0x1c')]]){_0x2eec70['push']({'name':_0x19f26b[_0x0f33('0x1d')],'value':_0x55f169[_0x19f26b['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x0f33('0x1e'),'response_type':_0x0f33('0x1e'),'rest_data':JSON['stringify']({'session':_0x40e15b['id'],'module_name':_0x0f33('0x1f'),'name_value_list':_0x2eec70})}});}function getAuth(_0x5dd4e3){return util[_0x0f33('0x20')](_0x0f33('0x21'),new Buffer(_0x5dd4e3[_0x0f33('0x22')]+':X')[_0x0f33('0x23')](_0x0f33('0x24')));}function getServerInfo(_0x3ff738){return request({'form':{'method':_0x0f33('0x25'),'input_type':_0x0f33('0x1e'),'response_type':'JSON','rest_data':JSON[_0x0f33('0x26')]({'session':_0x3ff738['id']})}});}function getUser(_0x54c30d,_0xe79e34,_0x106410){if(!_[_0x0f33('0x27')](_0xe79e34)){logger['info'](_0x0f33('0x28'),_0xe79e34);return request({'form':{'method':'get_entry_list','input_type':_0x0f33('0x1e'),'response_type':_0x0f33('0x1e'),'rest_data':JSON[_0x0f33('0x26')]({'session':_0x106410['id'],'module_name':'Employees','query':util[_0x0f33('0x20')](_0x0f33('0x29'),_0xe79e34),'order_by':'','offset':'0','select_fields':['id','name',_0x0f33('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x153894){if(_0x153894[_0x0f33('0x2b')]['length']){var _0x76c30a=_['find'](_0x153894[_0x0f33('0x2b')],function(_0xa6556e){return _0xa6556e[_0x0f33('0x2c')][_0x0f33('0x2a')][_0x0f33('0x2d')]===_0xe79e34;});if(_0x76c30a){logger[_0x0f33('0xa')]('Agent\x20found!');return BPromise['resolve']({'id':_0x76c30a[_0x0f33('0x2c')]['id'][_0x0f33('0x2d')],'name':_0x76c30a[_0x0f33('0x2c')][_0x0f33('0xc')][_0x0f33('0x2d')]});}}logger[_0x0f33('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0f33('0x2e')]({'id':_0x106410['name_value_list']['user_id']['value'],'name':_0x106410[_0x0f33('0x2c')][_0x0f33('0x2a')][_0x0f33('0x2d')]});});}else{logger[_0x0f33('0xa')](_0x0f33('0x2f'));return BPromise['resolve']({'id':_0x106410[_0x0f33('0x2c')][_0x0f33('0x30')]['value'],'name':_0x106410[_0x0f33('0x2c')][_0x0f33('0x2a')][_0x0f33('0x2d')]});}}function getEndUser(_0x5a2dc7,_0x337e96,_0x19c06f,_0x551e6c){logger[_0x0f33('0xa')](_0x0f33('0x31'),_0x19c06f);return request({'form':{'method':_0x0f33('0x32'),'input_type':_0x0f33('0x1e'),'response_type':_0x0f33('0x1e'),'rest_data':JSON[_0x0f33('0x26')]({'session':_0x551e6c['id'],'module_name':_0x0f33('0x19'),'query':util[_0x0f33('0x20')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x19c06f),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0f33('0x33')](function(_0x5428d0){if(_0x5428d0[_0x0f33('0x2b')][_0x0f33('0x34')]){var _0x358cae=_[_0x0f33('0x35')](_0x5428d0[_0x0f33('0x2b')],function(_0x224c9e){return _0x224c9e[_0x0f33('0x2c')][_0x0f33('0x36')]['value']===_0x19c06f;});if(_0x358cae){logger[_0x0f33('0xa')](_0x0f33('0x37'));return BPromise[_0x0f33('0x2e')]({'id':_0x358cae[_0x0f33('0x2c')]['id'][_0x0f33('0x2d')],'name':_0x358cae['name_value_list']['name'][_0x0f33('0x2d')],'phone':_0x358cae[_0x0f33('0x2c')][_0x0f33('0x36')][_0x0f33('0x2d')]});}}else{logger[_0x0f33('0xa')](_0x0f33('0x38'));return request({'form':{'method':'set_entry','input_type':_0x0f33('0x1e'),'response_type':_0x0f33('0x1e'),'rest_data':JSON['stringify']({'session':_0x551e6c['id'],'module_name':_0x0f33('0x19'),'name_value_list':[{'name':_0x0f33('0x39'),'value':_0x337e96!==''?_0x337e96:util['format'](_0x0f33('0x3a'),_0x19c06f)},{'name':_0x0f33('0x36'),'value':_0x19c06f}]})}})[_0x0f33('0x33')](function(_0x3fa167){logger[_0x0f33('0xa')]('Enduser\x20created.');return BPromise[_0x0f33('0x2e')]({'id':_0x3fa167['id'],'name':_0x3fa167[_0x0f33('0x2b')]['first_name'][_0x0f33('0x2d')],'phone':_0x3fa167['entry_list'][_0x0f33('0x36')][_0x0f33('0x2d')]});});}});}function request(_0x2e6775){logger[_0x0f33('0x3b')]('[HTTP]',JSON[_0x0f33('0x26')](_0x2e6775));return rp(_[_0x0f33('0x3c')](def,_0x2e6775));}function getTags(_0x1c8c40,_0x2ab907){var _0x240133=[];if(_0x1c8c40&&_0x1c8c40[_0x0f33('0x34')]>0x0){_0x240133=_['map'](_0x1c8c40,_0x2ab907);}return _0x240133;}function getCustomFields(_0x5be2de,_0x434a59){var _0x54d538=[];var _0x13dac1={'custom_fields':[]};if(_0x5be2de['length']>0x0){_[_0x0f33('0x3d')](_0x5be2de,function(_0x4808d0){if(_0x4808d0[_0x0f33('0x3e')]==='string'&&_0x4808d0[_0x0f33('0x3f')]&&!_0x4808d0[_0x0f33('0x40')]){_0x13dac1[_0x4808d0[_0x0f33('0x3f')][_0x0f33('0x41')]()]=_0x4808d0[_0x0f33('0x42')][_0x0f33('0x23')]();}else if(_0x4808d0[_0x0f33('0x3e')]===_0x0f33('0x43')&&_0x4808d0[_0x0f33('0x1d')]&&_0x4808d0[_0x0f33('0x40')]){_0x13dac1[_0x0f33('0x44')][_0x0f33('0x45')]({'id':_0x4808d0[_0x0f33('0x1d')],'value':_0x4808d0[_0x0f33('0x42')]['toString']()});}else if(_0x4808d0[_0x0f33('0x3e')]===_0x0f33('0x46')&&_0x4808d0[_0x0f33('0x1c')]&&_0x4808d0['idField']&&_0x4808d0[_0x0f33('0x40')]){_0x434a59[_0x4808d0['variableName']]&&_0x13dac1['custom_fields'][_0x0f33('0x45')]({'id':_0x4808d0[_0x0f33('0x1d')],'value':_0x434a59[_0x4808d0[_0x0f33('0x1c')]][_0x0f33('0x23')]()});}else if(_0x4808d0[_0x0f33('0x3e')]===_0x0f33('0x47')&&_0x4808d0['Variable']&&_0x4808d0['Variable'][_0x0f33('0xc')]&&_0x4808d0[_0x0f33('0x1d')]&&_0x4808d0[_0x0f33('0x40')]){_0x434a59[_0x4808d0[_0x0f33('0x48')][_0x0f33('0xc')][_0x0f33('0x41')]()]&&_0x13dac1[_0x0f33('0x44')][_0x0f33('0x45')]({'id':_0x4808d0[_0x0f33('0x1d')],'value':_0x434a59[_0x4808d0[_0x0f33('0x48')][_0x0f33('0xc')]['toLowerCase']()][_0x0f33('0x23')]()});}});}return _0x13dac1;}function getConnection(_0x580b1f){return request({'method':_0x0f33('0x49'),'form':{'method':'login','input_type':_0x0f33('0x1e'),'response_type':_0x0f33('0x1e'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x580b1f[_0x0f33('0x4a')],'password':_0x580b1f[_0x0f33('0x4b')],'encryption':_0x0f33('0x4c')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x23a01b){var _0x563805=_0x23a01b;if(_0x563805['id']){def[_0x0f33('0x4d')]=_0x563805['id'];return BPromise[_0x0f33('0x2e')](_0x563805);}else{throw new Error(util[_0x0f33('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x580b1f['id']));}});}function setRelationship(_0x3ab6bd,_0x37620f,_0x3a2dd2,_0xff4867){return request({'form':{'method':_0x0f33('0x4e'),'input_type':_0x0f33('0x1e'),'response_type':_0x0f33('0x1e'),'rest_data':JSON[_0x0f33('0x26')]({'session':_0x3ab6bd['id'],'module_name':_0x0f33('0x1f'),'module_id':_0x3a2dd2['id'],'link_field_name':_0xff4867,'related_ids':[_0x37620f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x0f33('0x4f')]=function(_0x244d1a,_0x3a722b,_0x4e49a7,_0x552229,_0x1564e0,_0x34507c){var _0x52bb85,_0x5a4687,_0x4c46a1,_0x34f6e1;_0x34507c['remoteUri']=intUtil[_0x0f33('0x50')](_0x34507c[_0x0f33('0x51')]);_0x34507c['serverUrl']=intUtil[_0x0f33('0x50')](_0x34507c[_0x0f33('0x52')]);def['uri']=util[_0x0f33('0x20')]('%s/service/v4_1/rest.php',_0x34507c['remoteUri']);if(_0x1564e0&&_0x1564e0['monitor_format']){logger[_0x0f33('0xa')](_0x0f33('0x53'),'Recording\x20is\x20enabled!');_0x3a722b[_0x0f33('0x54')]=util[_0x0f33('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34507c[_0x0f33('0x52')],_0x3a722b[_0x0f33('0x55')],md5(_0x3a722b[_0x0f33('0x55')]));}else{_0x3a722b[_0x0f33('0x54')]='';}return getConnection(_0x34507c)[_0x0f33('0x33')](function(_0x125434){_0x34f6e1=_0x125434;return getUser(_0x34507c,_0x552229[_0x0f33('0xc')],_0x34f6e1);})['then'](function(_0x2f7ecd){_0x52bb85=_0x2f7ecd;logger[_0x0f33('0xa')](_0x0f33('0x56'),_0x52bb85['id']);return getEndUser(_0x34507c,_0x3a722b[_0x0f33('0x57')],_0x3a722b[_0x0f33('0x58')],_0x34f6e1);})['then'](function(_0x325572){_0x5a4687=_0x325572;logger[_0x0f33('0xa')]('The\x20Enduser\x20ID\x20is:',_0x5a4687['id']);return getTicket(_0x34507c,_0x52bb85,_0x5a4687,_0x4e49a7,_0x3a722b,_0x4e49a7['Fields'],_0x34f6e1,_0x0f33('0x59'));})[_0x0f33('0x33')](function(_0x374140){_0x4c46a1=_0x374140;logger['info'](_0x0f33('0x5a'));logger[_0x0f33('0xa')](_0x0f33('0x5b'),_0x4c46a1['id']);return setRelationship(_0x34f6e1,_0x52bb85,_0x4c46a1,'users');})[_0x0f33('0x33')](function(){return setRelationship(_0x34f6e1,_0x5a4687,_0x4c46a1,_0x0f33('0x5c'));})[_0x0f33('0x33')](function(){return getServerInfo(_0x34f6e1);})['then'](function(_0x5be2e5){var _0x50de66=parseInt(_0x5be2e5['version']['charAt'](0x0));var _0x3958db=util[_0x0f33('0x20')](_0x0f33('0x5d'),_0x34507c[_0x0f33('0x51')],_0x4c46a1['id']);if(_0x50de66>0x6){_0x3958db=util['format'](_0x0f33('0x5e'),_0x34507c['remoteUri'],_0x4c46a1['id']);}logger[_0x0f33('0xa')](_0x0f33('0x53'),_0x0f33('0x5f'));emit(util[_0x0f33('0x20')](_0x0f33('0x60'),_0x552229[_0x0f33('0xc')]),_0x0f33('0x61'),{'uri':_0x3958db});})[_0x0f33('0x62')](function(_0x318349){logger[_0x0f33('0x63')](_0x0f33('0x53'),JSON[_0x0f33('0x26')](_0x318349));});};exports[_0x0f33('0x64')]=function(_0x21344b,_0x58272b,_0x215120,_0x4abbce,_0x524eec,_0x3f6ac5,_0x2241f4){var _0x468c71,_0x115f20,_0x50a3da,_0xb35728;_0x3f6ac5[_0x0f33('0x51')]=intUtil[_0x0f33('0x50')](_0x3f6ac5['remoteUri']);_0x3f6ac5['serverUrl']=intUtil[_0x0f33('0x50')](_0x3f6ac5[_0x0f33('0x52')]);def[_0x0f33('0x65')]=util[_0x0f33('0x20')](_0x0f33('0x66'),_0x3f6ac5[_0x0f33('0x51')]);if(_0x2241f4&&_0x2241f4['recordingFormat']&&_0x2241f4['recordingFormat']!==_0x0f33('0x67')){logger[_0x0f33('0xa')](_0x0f33('0x68'),_0x0f33('0x69'));_0x58272b[_0x0f33('0x54')]=util[_0x0f33('0x20')](_0x0f33('0x6a'),_0x3f6ac5[_0x0f33('0x52')],_0x58272b['uniqueid'],md5(_0x58272b[_0x0f33('0x55')]));}return getConnection(_0x3f6ac5)[_0x0f33('0x33')](function(_0x267b85){_0xb35728=_0x267b85;return getUser(_0x3f6ac5,_0x4abbce[_0x0f33('0xc')],_0xb35728);})[_0x0f33('0x33')](function(_0x30af23){_0x468c71=_0x30af23;logger[_0x0f33('0xa')](_0x0f33('0x56'),_0x468c71['id']);return getEndUser(_0x3f6ac5,_0x58272b[_0x0f33('0x6b')],_0x58272b['destcalleridnum'],_0xb35728);})[_0x0f33('0x33')](function(_0x2f43d4){_0x115f20=_0x2f43d4;logger['info'](_0x0f33('0x6c'),_0x115f20['id']);return getTicket(_0x3f6ac5,_0x468c71,_0x115f20,_0x215120,_0x58272b,_0x215120[_0x0f33('0x6d')],_0xb35728,_0x0f33('0x6e'));})[_0x0f33('0x33')](function(_0xddd847){_0x50a3da=_0xddd847;logger[_0x0f33('0xa')](_0x0f33('0x5a'));logger[_0x0f33('0xa')]('The\x20Ticket\x20ID\x20is:',_0x50a3da['id']);return setRelationship(_0xb35728,_0x468c71,_0x50a3da,_0x0f33('0x6f'));})[_0x0f33('0x33')](function(){return setRelationship(_0xb35728,_0x115f20,_0x50a3da,_0x0f33('0x5c'));})[_0x0f33('0x33')](function(){return getServerInfo(_0xb35728);})[_0x0f33('0x33')](function(_0x1f918){var _0x27c8f5=parseInt(_0x1f918[_0x0f33('0x70')][_0x0f33('0x71')](0x0));var _0x18e64f=util[_0x0f33('0x20')](_0x0f33('0x5d'),_0x3f6ac5[_0x0f33('0x51')],_0x50a3da['id']);if(_0x27c8f5>0x6){_0x18e64f=util[_0x0f33('0x20')](_0x0f33('0x5e'),_0x3f6ac5['remoteUri'],_0x50a3da['id']);}logger[_0x0f33('0xa')]('[OUTBOUND]',_0x0f33('0x5f'));emit(util[_0x0f33('0x20')](_0x0f33('0x60'),_0x4abbce[_0x0f33('0xc')]),'trigger:browser:url',{'uri':_0x18e64f});})['catch'](function(_0x7473c8){logger[_0x0f33('0x63')](_0x0f33('0x68'),JSON[_0x0f33('0x26')](_0x7473c8));});};exports[_0x0f33('0x72')]=function(_0x330c0b,_0x57e082,_0x58a958,_0xeaa324,_0x39d687,_0x1d69de){var _0x4c3a46,_0x55314a,_0x1ddc86,_0x203019;_0x1d69de[_0x0f33('0x51')]=intUtil['stripTrailingSlash'](_0x1d69de[_0x0f33('0x51')]);_0x1d69de[_0x0f33('0x52')]=intUtil['stripTrailingSlash'](_0x1d69de[_0x0f33('0x52')]);def[_0x0f33('0x65')]=util[_0x0f33('0x20')](_0x0f33('0x66'),_0x1d69de[_0x0f33('0x51')]);if(_0x39d687&&_0x39d687[_0x0f33('0x73')]){logger['info']('['+_0x57e082['lastevent']['toUpperCase']()+']',_0x0f33('0x69'));_0x57e082['recordingURL']=util[_0x0f33('0x20')](_0x0f33('0x6a'),_0x1d69de['serverUrl'],_0x57e082[_0x0f33('0x55')],md5(_0x57e082[_0x0f33('0x55')]));}else{_0x57e082[_0x0f33('0x54')]='';}return getConnection(_0x1d69de)[_0x0f33('0x33')](function(_0x174f49){_0x203019=_0x174f49;if(!_[_0x0f33('0x27')](_0xeaa324)){return getUser(_0x1d69de,_0xeaa324['name'],_0x203019);}else{return getUser(_0x1d69de,null,_0x203019);}})[_0x0f33('0x33')](function(_0x2494cf){_0x4c3a46=_0x2494cf;logger[_0x0f33('0xa')](_0x0f33('0x56'),_0x4c3a46['id']);return getEndUser(_0x1d69de,_0x57e082[_0x0f33('0x57')],_0x57e082[_0x0f33('0x58')],_0x203019);})[_0x0f33('0x33')](function(_0x478832){_0x55314a=_0x478832;logger['info'](_0x0f33('0x6c'),_0x55314a['id']);return getTicket(_0x1d69de,_0x4c3a46,_0x55314a,_0x58a958,_0x57e082,_0x58a958[_0x0f33('0x6d')],_0x203019,'Inbound');})['then'](function(_0x29a29a){_0x1ddc86=_0x29a29a;logger['info'](_0x0f33('0x5a'));logger[_0x0f33('0xa')](_0x0f33('0x5b'),_0x1ddc86['id']);return setRelationship(_0x203019,_0x4c3a46,_0x1ddc86,_0x0f33('0x6f'));})[_0x0f33('0x33')](function(){return setRelationship(_0x203019,_0x55314a,_0x1ddc86,'contacts');})[_0x0f33('0x33')](function(){return getServerInfo(_0x203019);})[_0x0f33('0x62')](function(_0x4fd913){logger['error']('['+_0x57e082[_0x0f33('0x74')]['toUpperCase']()+']',JSON[_0x0f33('0x26')](_0x4fd913));});}; \ No newline at end of file +var _0xeeb4=['recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','idField','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','info','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','type','string','nameField','customField','custom_fields','push','content','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xeeb4,0x1f1));var _0x4eeb=function(_0x14e1f5,_0x342f30){_0x14e1f5=_0x14e1f5-0x0;var _0x18f952=_0xeeb4[_0x14e1f5];return _0x18f952;};'use strict';var _=require(_0x4eeb('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x4eeb('0x1'));var util=require(_0x4eeb('0x2'));var Redis=require(_0x4eeb('0x3'));var intUtil=require('./util');var config=require(_0x4eeb('0x4'));var logger=require(_0x4eeb('0x5'))(_0x4eeb('0x6'));config[_0x4eeb('0x7')]=_[_0x4eeb('0x8')](config[_0x4eeb('0x7')],{'host':_0x4eeb('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4eeb('0x7')]));var def={'method':_0x4eeb('0xa'),'json':!![]};function emit(_0x37ee5,_0x41a7a4,_0xc71f78){io['to'](_0x37ee5)[_0x4eeb('0xb')](_0x41a7a4,_0xc71f78);}function getTicket(_0x18ea05,_0x45cc67,_0x212bc6,_0x365881,_0xeaee7d,_0x6fa69f,_0x24a5f3,_0xbeac75){logger['info'](_0x4eeb('0xc'));var _0xac4fce=new Date();var _0x402515=[{'name':_0x4eeb('0xd'),'value':intUtil['getString'](_0x365881[_0x4eeb('0xe')],_0xeaee7d,'\x20')},{'name':_0x4eeb('0xf'),'value':_0x45cc67['id']},{'name':_0x4eeb('0x10'),'value':_0x45cc67['id']},{'name':_0x4eeb('0x11'),'value':intUtil['getString'](_0x365881['Descriptions'],_0xeaee7d,'\x0a')},{'name':_0x4eeb('0x12'),'value':_0xac4fce[_0x4eeb('0x13')]()[_0x4eeb('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x4eeb('0x15'),'value':'15'},{'name':_0x4eeb('0x16'),'value':_0x212bc6['id']},{'name':_0x4eeb('0x17'),'value':_0x4eeb('0x18')},{'name':_0x4eeb('0x19'),'value':_0x212bc6[_0x4eeb('0xd')]},{'name':_0x4eeb('0x1a'),'value':_0xbeac75}];if(_0x6fa69f[_0x4eeb('0x1b')]){_[_0x4eeb('0x1c')](_0x6fa69f,function(_0x3c1531){if(_0xeaee7d[_0x3c1531[_0x4eeb('0x1d')]]){_0x402515['push']({'name':_0x3c1531[_0x4eeb('0x1e')],'value':_0xeaee7d[_0x3c1531[_0x4eeb('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x4eeb('0x1f')]({'session':_0x24a5f3['id'],'module_name':'Calls','name_value_list':_0x402515})}});}function getAuth(_0x3a66b5){return util[_0x4eeb('0x20')](_0x4eeb('0x21'),new Buffer(_0x3a66b5[_0x4eeb('0x22')]+':X')[_0x4eeb('0x23')](_0x4eeb('0x24')));}function getServerInfo(_0x56bb35){return request({'form':{'method':_0x4eeb('0x25'),'input_type':_0x4eeb('0x26'),'response_type':_0x4eeb('0x26'),'rest_data':JSON[_0x4eeb('0x1f')]({'session':_0x56bb35['id']})}});}function getUser(_0xab9466,_0x578b2a,_0x199289){if(!_['isNil'](_0x578b2a)){logger[_0x4eeb('0x27')](_0x4eeb('0x28'),_0x578b2a);return request({'form':{'method':'get_entry_list','input_type':_0x4eeb('0x26'),'response_type':_0x4eeb('0x26'),'rest_data':JSON[_0x4eeb('0x1f')]({'session':_0x199289['id'],'module_name':_0x4eeb('0x29'),'query':util[_0x4eeb('0x20')](_0x4eeb('0x2a'),_0x578b2a),'order_by':'','offset':'0','select_fields':['id','name',_0x4eeb('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4eeb('0x2c')](function(_0x36b12a){if(_0x36b12a[_0x4eeb('0x2d')]['length']){var _0xfc489=_['find'](_0x36b12a[_0x4eeb('0x2d')],function(_0xb9c060){return _0xb9c060[_0x4eeb('0x2e')]['user_name'][_0x4eeb('0x2f')]===_0x578b2a;});if(_0xfc489){logger['info']('Agent\x20found!');return BPromise[_0x4eeb('0x30')]({'id':_0xfc489[_0x4eeb('0x2e')]['id']['value'],'name':_0xfc489['name_value_list'][_0x4eeb('0xd')][_0x4eeb('0x2f')]});}}logger[_0x4eeb('0x27')](_0x4eeb('0x31'));return BPromise[_0x4eeb('0x30')]({'id':_0x199289[_0x4eeb('0x2e')][_0x4eeb('0x32')][_0x4eeb('0x2f')],'name':_0x199289[_0x4eeb('0x2e')][_0x4eeb('0x2b')]['value']});});}else{logger['info'](_0x4eeb('0x33'));return BPromise[_0x4eeb('0x30')]({'id':_0x199289[_0x4eeb('0x2e')][_0x4eeb('0x32')][_0x4eeb('0x2f')],'name':_0x199289[_0x4eeb('0x2e')]['user_name'][_0x4eeb('0x2f')]});}}function getEndUser(_0x393b09,_0x29214a,_0x36c99a,_0x6474de){logger[_0x4eeb('0x27')]('Searching\x20enduser\x20with\x20phone',_0x36c99a);return request({'form':{'method':_0x4eeb('0x34'),'input_type':_0x4eeb('0x26'),'response_type':_0x4eeb('0x26'),'rest_data':JSON[_0x4eeb('0x1f')]({'session':_0x6474de['id'],'module_name':_0x4eeb('0x18'),'query':util['format'](_0x4eeb('0x35'),_0x36c99a),'order_by':'','offset':'0','select_fields':['id',_0x4eeb('0xd'),_0x4eeb('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4eeb('0x2c')](function(_0x4976b3){if(_0x4976b3[_0x4eeb('0x2d')][_0x4eeb('0x1b')]){var _0x1dec37=_[_0x4eeb('0x37')](_0x4976b3['entry_list'],function(_0x45ac01){return _0x45ac01[_0x4eeb('0x2e')][_0x4eeb('0x36')][_0x4eeb('0x2f')]===_0x36c99a;});if(_0x1dec37){logger['info'](_0x4eeb('0x38'));return BPromise['resolve']({'id':_0x1dec37[_0x4eeb('0x2e')]['id'][_0x4eeb('0x2f')],'name':_0x1dec37['name_value_list']['name'][_0x4eeb('0x2f')],'phone':_0x1dec37[_0x4eeb('0x2e')][_0x4eeb('0x36')][_0x4eeb('0x2f')]});}}else{logger[_0x4eeb('0x27')](_0x4eeb('0x39'));return request({'form':{'method':_0x4eeb('0x3a'),'input_type':_0x4eeb('0x26'),'response_type':_0x4eeb('0x26'),'rest_data':JSON['stringify']({'session':_0x6474de['id'],'module_name':_0x4eeb('0x18'),'name_value_list':[{'name':_0x4eeb('0x3b'),'value':_0x29214a!==_0x4eeb('0x3c')?_0x29214a:util[_0x4eeb('0x20')](_0x4eeb('0x3d'),_0x36c99a)},{'name':_0x4eeb('0x36'),'value':_0x36c99a}]})}})['then'](function(_0xb40d72){logger[_0x4eeb('0x27')](_0x4eeb('0x3e'));return BPromise[_0x4eeb('0x30')]({'id':_0xb40d72['id'],'name':_0xb40d72[_0x4eeb('0x2d')][_0x4eeb('0x3b')]['value'],'phone':_0xb40d72[_0x4eeb('0x2d')][_0x4eeb('0x36')][_0x4eeb('0x2f')]});});}});}function request(_0xeca19a){logger[_0x4eeb('0x3f')](_0x4eeb('0x40'),JSON['stringify'](_0xeca19a));return rp(_['merge'](def,_0xeca19a));}function getTags(_0xcfcfa3,_0x4f164e){var _0x351f4b=[];if(_0xcfcfa3&&_0xcfcfa3[_0x4eeb('0x1b')]>0x0){_0x351f4b=_['map'](_0xcfcfa3,_0x4f164e);}return _0x351f4b;}function getCustomFields(_0xa222d8,_0x2447cc){var _0x188a28=[];var _0x4b213e={'custom_fields':[]};if(_0xa222d8[_0x4eeb('0x1b')]>0x0){_[_0x4eeb('0x1c')](_0xa222d8,function(_0xf92849){if(_0xf92849[_0x4eeb('0x41')]===_0x4eeb('0x42')&&_0xf92849[_0x4eeb('0x43')]&&!_0xf92849[_0x4eeb('0x44')]){_0x4b213e[_0xf92849[_0x4eeb('0x43')]['toLowerCase']()]=_0xf92849['content'][_0x4eeb('0x23')]();}else if(_0xf92849['type']===_0x4eeb('0x42')&&_0xf92849[_0x4eeb('0x1e')]&&_0xf92849[_0x4eeb('0x44')]){_0x4b213e[_0x4eeb('0x45')][_0x4eeb('0x46')]({'id':_0xf92849['idField'],'value':_0xf92849[_0x4eeb('0x47')][_0x4eeb('0x23')]()});}else if(_0xf92849[_0x4eeb('0x41')]===_0x4eeb('0x48')&&_0xf92849[_0x4eeb('0x1d')]&&_0xf92849[_0x4eeb('0x1e')]&&_0xf92849['customField']){_0x2447cc[_0xf92849[_0x4eeb('0x1d')]]&&_0x4b213e['custom_fields']['push']({'id':_0xf92849[_0x4eeb('0x1e')],'value':_0x2447cc[_0xf92849[_0x4eeb('0x1d')]]['toString']()});}else if(_0xf92849[_0x4eeb('0x41')]===_0x4eeb('0x49')&&_0xf92849[_0x4eeb('0x4a')]&&_0xf92849[_0x4eeb('0x4a')]['name']&&_0xf92849[_0x4eeb('0x1e')]&&_0xf92849['customField']){_0x2447cc[_0xf92849[_0x4eeb('0x4a')][_0x4eeb('0xd')]['toLowerCase']()]&&_0x4b213e['custom_fields'][_0x4eeb('0x46')]({'id':_0xf92849[_0x4eeb('0x1e')],'value':_0x2447cc[_0xf92849[_0x4eeb('0x4a')][_0x4eeb('0xd')]['toLowerCase']()][_0x4eeb('0x23')]()});}});}return _0x4b213e;}function getConnection(_0x12aa4){return request({'method':'POST','form':{'method':_0x4eeb('0x4b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x12aa4[_0x4eeb('0x4c')],'password':_0x12aa4[_0x4eeb('0x4d')],'encryption':_0x4eeb('0x4e')},'application':_0x4eeb('0x4f')})}})[_0x4eeb('0x2c')](function(_0x378c5e){var _0x19bccd=_0x378c5e;if(_0x19bccd['id']){def[_0x4eeb('0x50')]=_0x19bccd['id'];return BPromise[_0x4eeb('0x30')](_0x19bccd);}else{throw new Error(util[_0x4eeb('0x20')](_0x4eeb('0x51'),_0x12aa4['id']));}});}function setRelationship(_0x555d21,_0x5463bb,_0x2d74ce,_0x36cb86){return request({'form':{'method':_0x4eeb('0x52'),'input_type':_0x4eeb('0x26'),'response_type':_0x4eeb('0x26'),'rest_data':JSON[_0x4eeb('0x1f')]({'session':_0x555d21['id'],'module_name':_0x4eeb('0x53'),'module_id':_0x2d74ce['id'],'link_field_name':_0x36cb86,'related_ids':[_0x5463bb['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4eeb('0x54')]=function(_0x51c5b5,_0x5ad321,_0x5bf42f,_0x2334f7,_0x32bdeb,_0x2ebd41){var _0x11f20a,_0xaf3b1b,_0x4fcfb8,_0x213a8a;_0x2ebd41[_0x4eeb('0x55')]=intUtil[_0x4eeb('0x56')](_0x2ebd41[_0x4eeb('0x55')]);_0x2ebd41[_0x4eeb('0x57')]=intUtil[_0x4eeb('0x56')](_0x2ebd41[_0x4eeb('0x57')]);def[_0x4eeb('0x58')]=util[_0x4eeb('0x20')](_0x4eeb('0x59'),_0x2ebd41[_0x4eeb('0x55')]);if(_0x32bdeb&&_0x32bdeb[_0x4eeb('0x5a')]){logger[_0x4eeb('0x27')](_0x4eeb('0x5b'),_0x4eeb('0x5c'));_0x5ad321[_0x4eeb('0x5d')]=util[_0x4eeb('0x20')](_0x4eeb('0x5e'),_0x2ebd41[_0x4eeb('0x57')],_0x5ad321[_0x4eeb('0x5f')],md5(_0x5ad321['uniqueid']));}else{_0x5ad321[_0x4eeb('0x5d')]='';}return getConnection(_0x2ebd41)[_0x4eeb('0x2c')](function(_0xbc60fa){_0x213a8a=_0xbc60fa;return getUser(_0x2ebd41,_0x2334f7[_0x4eeb('0xd')],_0x213a8a);})[_0x4eeb('0x2c')](function(_0x2f8bca){_0x11f20a=_0x2f8bca;logger[_0x4eeb('0x27')](_0x4eeb('0x60'),_0x11f20a['id']);return getEndUser(_0x2ebd41,_0x5ad321[_0x4eeb('0x61')],_0x5ad321['calleridnum'],_0x213a8a);})[_0x4eeb('0x2c')](function(_0x1ac407){_0xaf3b1b=_0x1ac407;logger['info'](_0x4eeb('0x62'),_0xaf3b1b['id']);return getTicket(_0x2ebd41,_0x11f20a,_0xaf3b1b,_0x5bf42f,_0x5ad321,_0x5bf42f[_0x4eeb('0x63')],_0x213a8a,_0x4eeb('0x64'));})['then'](function(_0x122703){_0x4fcfb8=_0x122703;logger[_0x4eeb('0x27')]('Ticket\x20created!');logger[_0x4eeb('0x27')](_0x4eeb('0x65'),_0x4fcfb8['id']);return setRelationship(_0x213a8a,_0x11f20a,_0x4fcfb8,_0x4eeb('0x66'));})[_0x4eeb('0x2c')](function(){return setRelationship(_0x213a8a,_0xaf3b1b,_0x4fcfb8,_0x4eeb('0x67'));})[_0x4eeb('0x2c')](function(){return getServerInfo(_0x213a8a);})[_0x4eeb('0x2c')](function(_0x1c0163){var _0x5dbb38=parseInt(_0x1c0163[_0x4eeb('0x68')][_0x4eeb('0x69')](0x0));var _0x46dc5e=util[_0x4eeb('0x20')](_0x4eeb('0x6a'),_0x2ebd41[_0x4eeb('0x55')],_0x4fcfb8['id']);if(_0x5dbb38>0x6){_0x46dc5e=util[_0x4eeb('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2ebd41[_0x4eeb('0x55')],_0x4fcfb8['id']);}logger['info'](_0x4eeb('0x5b'),_0x4eeb('0x6b'));emit(util[_0x4eeb('0x20')](_0x4eeb('0x6c'),_0x2334f7[_0x4eeb('0xd')]),_0x4eeb('0x6d'),{'uri':_0x46dc5e});})[_0x4eeb('0x6e')](function(_0x317560){logger[_0x4eeb('0x6f')](_0x4eeb('0x5b'),JSON[_0x4eeb('0x1f')](_0x317560));});};exports[_0x4eeb('0x70')]=function(_0x4ec255,_0xe3d45a,_0x311b4f,_0x423892,_0x26014a,_0x1c38b5,_0xed639d){var _0x12a694,_0x537947,_0x3429fb,_0xae6195;_0x1c38b5[_0x4eeb('0x55')]=intUtil[_0x4eeb('0x56')](_0x1c38b5['remoteUri']);_0x1c38b5['serverUrl']=intUtil[_0x4eeb('0x56')](_0x1c38b5[_0x4eeb('0x57')]);def['uri']=util[_0x4eeb('0x20')](_0x4eeb('0x59'),_0x1c38b5[_0x4eeb('0x55')]);if(_0xed639d&&_0xed639d[_0x4eeb('0x71')]&&_0xed639d['recordingFormat']!==_0x4eeb('0x72')){logger['info'](_0x4eeb('0x73'),'Recording\x20is\x20enabled!');_0xe3d45a[_0x4eeb('0x5d')]=util[_0x4eeb('0x20')](_0x4eeb('0x5e'),_0x1c38b5[_0x4eeb('0x57')],_0xe3d45a['uniqueid'],md5(_0xe3d45a[_0x4eeb('0x5f')]));}return getConnection(_0x1c38b5)[_0x4eeb('0x2c')](function(_0x2798e2){_0xae6195=_0x2798e2;return getUser(_0x1c38b5,_0x423892['name'],_0xae6195);})[_0x4eeb('0x2c')](function(_0x4d0ed8){_0x12a694=_0x4d0ed8;logger[_0x4eeb('0x27')](_0x4eeb('0x60'),_0x12a694['id']);return getEndUser(_0x1c38b5,_0xe3d45a[_0x4eeb('0x74')],_0xe3d45a[_0x4eeb('0x75')],_0xae6195);})[_0x4eeb('0x2c')](function(_0x40b43a){_0x537947=_0x40b43a;logger[_0x4eeb('0x27')]('The\x20Enduser\x20ID\x20is:',_0x537947['id']);return getTicket(_0x1c38b5,_0x12a694,_0x537947,_0x311b4f,_0xe3d45a,_0x311b4f[_0x4eeb('0x63')],_0xae6195,_0x4eeb('0x76'));})['then'](function(_0x2f7e8){_0x3429fb=_0x2f7e8;logger[_0x4eeb('0x27')]('Ticket\x20created!');logger[_0x4eeb('0x27')](_0x4eeb('0x65'),_0x3429fb['id']);return setRelationship(_0xae6195,_0x12a694,_0x3429fb,'users');})[_0x4eeb('0x2c')](function(){return setRelationship(_0xae6195,_0x537947,_0x3429fb,_0x4eeb('0x67'));})[_0x4eeb('0x2c')](function(){return getServerInfo(_0xae6195);})[_0x4eeb('0x2c')](function(_0x504647){var _0x2d0533=parseInt(_0x504647[_0x4eeb('0x68')][_0x4eeb('0x69')](0x0));var _0x364e5b=util[_0x4eeb('0x20')](_0x4eeb('0x6a'),_0x1c38b5[_0x4eeb('0x55')],_0x3429fb['id']);if(_0x2d0533>0x6){_0x364e5b=util[_0x4eeb('0x20')](_0x4eeb('0x77'),_0x1c38b5['remoteUri'],_0x3429fb['id']);}logger['info'](_0x4eeb('0x73'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4eeb('0x20')](_0x4eeb('0x6c'),_0x423892[_0x4eeb('0xd')]),'trigger:browser:url',{'uri':_0x364e5b});})[_0x4eeb('0x6e')](function(_0x214589){logger[_0x4eeb('0x6f')](_0x4eeb('0x73'),JSON[_0x4eeb('0x1f')](_0x214589));});};exports['unmanaged']=function(_0x2db866,_0x46d445,_0x525451,_0x2514e1,_0x43c1e2,_0x3bca26){var _0x3667f2,_0x5d7dd3,_0xd5fe41,_0x50385e;_0x3bca26['remoteUri']=intUtil[_0x4eeb('0x56')](_0x3bca26[_0x4eeb('0x55')]);_0x3bca26[_0x4eeb('0x57')]=intUtil['stripTrailingSlash'](_0x3bca26['serverUrl']);def[_0x4eeb('0x58')]=util[_0x4eeb('0x20')](_0x4eeb('0x59'),_0x3bca26['remoteUri']);if(_0x43c1e2&&_0x43c1e2[_0x4eeb('0x5a')]){logger[_0x4eeb('0x27')]('['+_0x46d445['lastevent'][_0x4eeb('0x78')]()+']',_0x4eeb('0x5c'));_0x46d445['recordingURL']=util[_0x4eeb('0x20')](_0x4eeb('0x5e'),_0x3bca26['serverUrl'],_0x46d445[_0x4eeb('0x5f')],md5(_0x46d445[_0x4eeb('0x5f')]));}else{_0x46d445[_0x4eeb('0x5d')]='';}return getConnection(_0x3bca26)[_0x4eeb('0x2c')](function(_0x243932){_0x50385e=_0x243932;if(!_['isNil'](_0x2514e1)){return getUser(_0x3bca26,_0x2514e1[_0x4eeb('0xd')],_0x50385e);}else{return getUser(_0x3bca26,null,_0x50385e);}})[_0x4eeb('0x2c')](function(_0xa691d){_0x3667f2=_0xa691d;logger['info']('The\x20User\x20ID\x20is:',_0x3667f2['id']);return getEndUser(_0x3bca26,_0x46d445[_0x4eeb('0x61')],_0x46d445[_0x4eeb('0x79')],_0x50385e);})[_0x4eeb('0x2c')](function(_0x1bf64d){_0x5d7dd3=_0x1bf64d;logger[_0x4eeb('0x27')](_0x4eeb('0x62'),_0x5d7dd3['id']);return getTicket(_0x3bca26,_0x3667f2,_0x5d7dd3,_0x525451,_0x46d445,_0x525451[_0x4eeb('0x63')],_0x50385e,_0x4eeb('0x64'));})[_0x4eeb('0x2c')](function(_0x1ba101){_0xd5fe41=_0x1ba101;logger[_0x4eeb('0x27')]('Ticket\x20created!');logger[_0x4eeb('0x27')]('The\x20Ticket\x20ID\x20is:',_0xd5fe41['id']);return setRelationship(_0x50385e,_0x3667f2,_0xd5fe41,_0x4eeb('0x66'));})[_0x4eeb('0x2c')](function(){return setRelationship(_0x50385e,_0x5d7dd3,_0xd5fe41,_0x4eeb('0x67'));})[_0x4eeb('0x2c')](function(){return getServerInfo(_0x50385e);})[_0x4eeb('0x6e')](function(_0x22d6e0){logger[_0x4eeb('0x6f')]('['+_0x46d445['lastevent'][_0x4eeb('0x78')]()+']',JSON['stringify'](_0x22d6e0));});}; \ 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 4cf8a30..53284e7 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 _0xcacb=['test','lodash','util','length','sortBy','type','string','push','variable','variableName','toString','customVariable','Variable','name','keyValue','keyType','key','format','%s:\x20%s','keyContent','toLowerCase','stripTrailingSlash','slice','substring','lastIndexOf'];(function(_0x4ab0f5,_0x3f5260){var _0x3b2cc8=function(_0x43e0bb){while(--_0x43e0bb){_0x4ab0f5['push'](_0x4ab0f5['shift']());}};_0x3b2cc8(++_0x3f5260);}(_0xcacb,0x1c3));var _0xbcac=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0xcacb[_0x54381d];return _0x5308a7;};'use strict';var _=require(_0xbcac('0x0'));var util=require(_0xbcac('0x1'));exports['getString']=function(_0xdb2dc7,_0x1835e3,_0x24ce30){var _0x5456f9=[];if(_0xdb2dc7[_0xbcac('0x2')]>0x0){var _0x438b73=_[_0xbcac('0x3')](_0xdb2dc7,['id']);for(var _0x4ce3c3=0x0;_0x4ce3c3<_0x438b73['length'];_0x4ce3c3++){var _0x2f566b=_0x438b73[_0x4ce3c3];if(_0x2f566b[_0xbcac('0x4')]===_0xbcac('0x5')){_0x5456f9[_0xbcac('0x6')](_0x2f566b['content']);}else if(_0x2f566b['type']===_0xbcac('0x7')&&_0x2f566b[_0xbcac('0x8')]){_0x1835e3[_0x2f566b['variableName']]&&_0x5456f9[_0xbcac('0x6')](_0x1835e3[_0x2f566b['variableName']][_0xbcac('0x9')]());}else if(_0x2f566b['type']===_0xbcac('0xa')&&_0x2f566b[_0xbcac('0xb')]&&_0x2f566b[_0xbcac('0xb')][_0xbcac('0xc')]){_0x1835e3[_0x2f566b[_0xbcac('0xb')][_0xbcac('0xc')]['toLowerCase']()]&&_0x5456f9[_0xbcac('0x6')](_0x1835e3[_0x2f566b[_0xbcac('0xb')][_0xbcac('0xc')]['toLowerCase']()][_0xbcac('0x9')]());}else if(_0x2f566b['type']===_0xbcac('0xd')){if(_0x2f566b[_0xbcac('0xe')]===_0xbcac('0x5')&&_0x2f566b[_0xbcac('0xf')]){_0x5456f9[_0xbcac('0x6')](util[_0xbcac('0x10')](_0xbcac('0x11'),_0x2f566b['key'],_0x2f566b[_0xbcac('0x12')]));}else if(_0x2f566b[_0xbcac('0xe')]===_0xbcac('0x7')&&_0x2f566b[_0xbcac('0x8')]&&_0x2f566b['key']){_0x1835e3[_0x2f566b[_0xbcac('0x8')]]&&_0x5456f9[_0xbcac('0x6')](util[_0xbcac('0x10')](_0xbcac('0x11'),_0x2f566b[_0xbcac('0xf')],_0x1835e3[_0x2f566b[_0xbcac('0x8')]]));}else if(_0x2f566b['keyType']===_0xbcac('0xa')&&_0x2f566b[_0xbcac('0xb')]&&_0x2f566b['Variable'][_0xbcac('0xc')]&&_0x2f566b[_0xbcac('0xf')]){_0x1835e3[_0x2f566b[_0xbcac('0xb')][_0xbcac('0xc')]['toLowerCase']()]&&_0x5456f9[_0xbcac('0x6')](util[_0xbcac('0x10')](_0xbcac('0x11'),_0x2f566b[_0xbcac('0xf')],_0x1835e3[_0x2f566b[_0xbcac('0xb')][_0xbcac('0xc')][_0xbcac('0x13')]()]));}}}}return _0x5456f9['join'](_0x24ce30);};exports[_0xbcac('0x14')]=function(_0x1ed37d){var _0x4599b3=_0x1ed37d[_0xbcac('0x15')](-0x1);if(_0x4599b3==='/'){_0x1ed37d=_0x1ed37d[_0xbcac('0x16')](0x0,_0x1ed37d[_0xbcac('0x17')](_0x4599b3));}return _0x1ed37d;};exports['validateEmail']=function(_0xef25f9){if(!_['isNil'](_0xef25f9)&&_0xef25f9!==''){var _0x1ad61e=/^(([^<>()\[\]\\.,;:\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 _0x1ad61e[_0xbcac('0x18')](String(_0xef25f9)[_0xbcac('0x13')]());}else{return![];}}; \ No newline at end of file +var _0xed7c=['isNil','lodash','util','getString','sortBy','length','type','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','string','key','format','%s:\x20%s','keyContent','keyType','join','stripTrailingSlash','slice','substring','lastIndexOf'];(function(_0x39b550,_0x13225c){var _0x464365=function(_0x1d914e){while(--_0x1d914e){_0x39b550['push'](_0x39b550['shift']());}};_0x464365(++_0x13225c);}(_0xed7c,0x6d));var _0xced7=function(_0x15bba8,_0x2f0066){_0x15bba8=_0x15bba8-0x0;var _0x161744=_0xed7c[_0x15bba8];return _0x161744;};'use strict';var _=require(_0xced7('0x0'));var util=require(_0xced7('0x1'));exports[_0xced7('0x2')]=function(_0x5af037,_0xcbb266,_0xd23c20){var _0x5ec923=[];if(_0x5af037['length']>0x0){var _0xae1820=_[_0xced7('0x3')](_0x5af037,['id']);for(var _0x5b63c3=0x0;_0x5b63c3<_0xae1820[_0xced7('0x4')];_0x5b63c3++){var _0x24b5d0=_0xae1820[_0x5b63c3];if(_0x24b5d0[_0xced7('0x5')]==='string'){_0x5ec923[_0xced7('0x6')](_0x24b5d0[_0xced7('0x7')]);}else if(_0x24b5d0[_0xced7('0x5')]===_0xced7('0x8')&&_0x24b5d0[_0xced7('0x9')]){_0xcbb266[_0x24b5d0[_0xced7('0x9')]]&&_0x5ec923['push'](_0xcbb266[_0x24b5d0[_0xced7('0x9')]][_0xced7('0xa')]());}else if(_0x24b5d0[_0xced7('0x5')]===_0xced7('0xb')&&_0x24b5d0[_0xced7('0xc')]&&_0x24b5d0[_0xced7('0xc')][_0xced7('0xd')]){_0xcbb266[_0x24b5d0[_0xced7('0xc')]['name']['toLowerCase']()]&&_0x5ec923['push'](_0xcbb266[_0x24b5d0[_0xced7('0xc')][_0xced7('0xd')][_0xced7('0xe')]()][_0xced7('0xa')]());}else if(_0x24b5d0[_0xced7('0x5')]==='keyValue'){if(_0x24b5d0['keyType']===_0xced7('0xf')&&_0x24b5d0[_0xced7('0x10')]){_0x5ec923[_0xced7('0x6')](util[_0xced7('0x11')](_0xced7('0x12'),_0x24b5d0[_0xced7('0x10')],_0x24b5d0[_0xced7('0x13')]));}else if(_0x24b5d0[_0xced7('0x14')]===_0xced7('0x8')&&_0x24b5d0[_0xced7('0x9')]&&_0x24b5d0['key']){_0xcbb266[_0x24b5d0['variableName']]&&_0x5ec923['push'](util['format'](_0xced7('0x12'),_0x24b5d0[_0xced7('0x10')],_0xcbb266[_0x24b5d0['variableName']]));}else if(_0x24b5d0[_0xced7('0x14')]===_0xced7('0xb')&&_0x24b5d0[_0xced7('0xc')]&&_0x24b5d0[_0xced7('0xc')][_0xced7('0xd')]&&_0x24b5d0[_0xced7('0x10')]){_0xcbb266[_0x24b5d0[_0xced7('0xc')]['name'][_0xced7('0xe')]()]&&_0x5ec923[_0xced7('0x6')](util[_0xced7('0x11')](_0xced7('0x12'),_0x24b5d0[_0xced7('0x10')],_0xcbb266[_0x24b5d0[_0xced7('0xc')][_0xced7('0xd')][_0xced7('0xe')]()]));}}}}return _0x5ec923[_0xced7('0x15')](_0xd23c20);};exports[_0xced7('0x16')]=function(_0x2647a3){var _0x3363a2=_0x2647a3[_0xced7('0x17')](-0x1);if(_0x3363a2==='/'){_0x2647a3=_0x2647a3[_0xced7('0x18')](0x0,_0x2647a3[_0xced7('0x19')](_0x3363a2));}return _0x2647a3;};exports['validateEmail']=function(_0x20b85c){if(!_[_0xced7('0x1a')](_0x20b85c)&&_0x20b85c!==''){var _0x3617a1=/^(([^<>()\[\]\\.,;:\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 _0x3617a1['test'](String(_0x20b85c)[_0xced7('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 56d54c1..2ed6823 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 _0x3203=['Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20Enduser\x20ID\x20is:','Fields','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','user:%s','unmanaged','lastevent','toUpperCase','calleridname','calleridnum','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','defaults','socket.io-emitter','redis','emit','forEach','string','idField','content','toString','variable','variableName','type','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Subjects','Descriptions','POST','%s/webservice.php','remoteUri','create','username','HelpDesk','stringify','then','resolve','result','format','error','catch','statusCode','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','length','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','[vTiger],\x20%s,\x20%s,\x20%s','getUser','userId','Searching\x20end\x20user\x20with\x20phone','query','success','firstname','lastname','Contacts','phone','accessKey','getchallenge','login','token'];(function(_0x480385,_0x1913b1){var _0x5cd332=function(_0x74b2c5){while(--_0x74b2c5){_0x480385['push'](_0x480385['shift']());}};_0x5cd332(++_0x1913b1);}(_0x3203,0x83));var _0x3320=function(_0x408d22,_0x53eef9){_0x408d22=_0x408d22-0x0;var _0x58effd=_0x3203[_0x408d22];return _0x58effd;};'use strict';var _=require(_0x3320('0x0'));var rp=require(_0x3320('0x1'));var BPromise=require(_0x3320('0x2'));var md5=require(_0x3320('0x3'));var util=require(_0x3320('0x4'));var Redis=require(_0x3320('0x5'));var intUtil=require(_0x3320('0x6'));var config=require(_0x3320('0x7'));var logger=require('../../../../config/logger')('vTiger');config['redis']=_[_0x3320('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3320('0x9'))(new Redis(config[_0x3320('0xa')]));function emit(_0x2777dc,_0x45cd76,_0x1875e9){io['to'](_0x2777dc)[_0x3320('0xb')](_0x45cd76,_0x1875e9);}function getCustomFields(_0x30b31b,_0x1dedf2){var _0x2bc03d={};if(_0x30b31b['length']>0x0){_[_0x3320('0xc')](_0x30b31b,function(_0x5af55c){if(_0x5af55c['type']===_0x3320('0xd')&&_0x5af55c[_0x3320('0xe')]){_0x2bc03d[_0x5af55c[_0x3320('0xe')]]=_0x5af55c[_0x3320('0xf')][_0x3320('0x10')]();}else if(_0x5af55c['type']===_0x3320('0x11')&&_0x5af55c[_0x3320('0x12')]&&_0x5af55c[_0x3320('0xe')]&&_0x1dedf2[_0x5af55c[_0x3320('0x12')]]){_0x2bc03d[_0x5af55c[_0x3320('0xe')]]=_0x1dedf2[_0x5af55c[_0x3320('0x12')]][_0x3320('0x10')]();}else if(_0x5af55c[_0x3320('0x13')]===_0x3320('0x14')&&_0x5af55c[_0x3320('0x15')]&&_0x5af55c[_0x3320('0x15')][_0x3320('0x16')]&&_0x5af55c[_0x3320('0xe')]&&_0x1dedf2[_0x5af55c['Variable'][_0x3320('0x16')][_0x3320('0x17')]()]){_0x2bc03d[_0x5af55c[_0x3320('0xe')]]=_0x1dedf2[_0x5af55c[_0x3320('0x15')][_0x3320('0x16')][_0x3320('0x17')]()][_0x3320('0x10')]();}});}return _0x2bc03d;}function createTicket(_0x33767d,_0x27ce17,_0x1c2059,_0x7d3298,_0x4ef71c,_0x1c7d88,_0x264787){logger[_0x3320('0x18')](_0x3320('0x19'));var _0x1ba299=_['merge']({'parent_id':'','assigned_user_id':_0x27ce17['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil['getString'](_0x7d3298[_0x3320('0x1a')],_0x4ef71c,'\x20'),'description':intUtil['getString'](_0x7d3298[_0x3320('0x1b')],_0x4ef71c,'\x0a'),'contact_id':_0x1c2059['id']},getCustomFields(_0x1c7d88,_0x4ef71c));var _0x412d34={'method':_0x3320('0x1c'),'uri':util['format'](_0x3320('0x1d'),_0x33767d[_0x3320('0x1e')]),'form':{'operation':_0x3320('0x1f'),'username':_0x33767d[_0x3320('0x20')],'sessionName':_0x264787['sessionName'],'elementType':_0x3320('0x21'),'element':JSON[_0x3320('0x22')](_0x1ba299)},'json':!![]};return request(_0x412d34)[_0x3320('0x23')](function(_0x17a376){if(_0x17a376['success']){return BPromise[_0x3320('0x24')]({'id':_0x17a376[_0x3320('0x25')]['id']});}else{throw new Error(util[_0x3320('0x26')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x3320('0x22')](_0x17a376[_0x3320('0x27')])));}})[_0x3320('0x28')](function(_0x40d978){var _0xda709c=_0x40d978[_0x3320('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x3320('0x2a'),_0xda709c,JSON[_0x3320('0x22')](_0x40d978));});}function getUser(_0x2b5557,_0x2da367,_0x498750){if(intUtil[_0x3320('0x2b')](_0x2da367)){logger[_0x3320('0x18')](_0x3320('0x2c'),_0x2da367);return request({'method':_0x3320('0x2d'),'uri':util[_0x3320('0x26')](_0x3320('0x1d'),_0x2b5557[_0x3320('0x1e')]),'qs':{'operation':'query','username':_0x2b5557[_0x3320('0x20')],'sessionName':_0x498750[_0x3320('0x2e')],'query':util[_0x3320('0x26')](_0x3320('0x2f'),_0x2da367)},'json':!![]})[_0x3320('0x23')](function(_0x482b8e){if(_0x482b8e['success']&&_0x482b8e[_0x3320('0x25')][_0x3320('0x30')]){logger[_0x3320('0x18')]('Agent\x20found!');return BPromise[_0x3320('0x24')]({'id':_0x482b8e[_0x3320('0x25')][0x0]['id'],'email':_0x482b8e['result'][0x0][_0x3320('0x31')],'name':_0x482b8e[_0x3320('0x25')][0x0][_0x3320('0x32')]+'\x20'+_0x482b8e[_0x3320('0x25')][_0x3320('0x33')]});}else{logger['info'](_0x3320('0x34'));return BPromise[_0x3320('0x24')]({'id':_0x498750['userId'],'email':_0x2b5557['username'],'name':'admin'});}})['catch'](function(_0x434fb6){var _0x2638d6=_0x434fb6['statusCode']||0x1f4;logger[_0x3320('0x27')](_0x3320('0x35'),_0x3320('0x36'),_0x2638d6,JSON[_0x3320('0x22')](_0x434fb6));});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x3320('0x24')]({'id':_0x498750[_0x3320('0x37')],'email':_0x2b5557[_0x3320('0x20')],'name':'admin'})[_0x3320('0x28')](function(_0x12657b){var _0x45515a=_0x12657b[_0x3320('0x29')]||0x1f4;logger[_0x3320('0x27')](_0x3320('0x35'),'getUser',_0x45515a,JSON['stringify'](_0x12657b));});}}function getEndUser(_0x48968d,_0xf9365c,_0x4ee716,_0x22b7b9){logger[_0x3320('0x18')](_0x3320('0x38'),_0x4ee716);return request({'method':_0x3320('0x2d'),'uri':util[_0x3320('0x26')]('%s/webservice.php',_0x48968d['remoteUri']),'qs':{'operation':_0x3320('0x39'),'username':_0x48968d[_0x3320('0x20')],'sessionName':_0x22b7b9['sessionName'],'query':util[_0x3320('0x26')]('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;',_0x4ee716,_0x4ee716,_0x4ee716,_0x4ee716,_0x4ee716)},'json':!![]})[_0x3320('0x23')](function(_0xd608e0){if(_0xd608e0[_0x3320('0x3a')]&&_0xd608e0[_0x3320('0x25')][_0x3320('0x30')]){logger[_0x3320('0x18')]('Enduser\x20found!');return BPromise[_0x3320('0x24')]({'id':_0xd608e0[_0x3320('0x25')][0x0]['id'],'name':_0xd608e0[_0x3320('0x25')][0x0][_0x3320('0x3b')]+'\x20'+_0xd608e0[_0x3320('0x25')][0x0][_0x3320('0x3c')],'phone':_0x4ee716});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x3320('0x1c'),'uri':util[_0x3320('0x26')](_0x3320('0x1d'),_0x48968d[_0x3320('0x1e')]),'form':{'operation':_0x3320('0x1f'),'sessionName':_0x22b7b9[_0x3320('0x2e')],'elementType':_0x3320('0x3d'),'element':JSON[_0x3320('0x22')]({'lastname':_0xf9365c,'phone':_0x4ee716,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0xe01c9f){logger[_0x3320('0x18')]('Enduser\x20created.');return BPromise['resolve']({'id':_0xe01c9f[_0x3320('0x25')]['id'],'name':_0xe01c9f[_0x3320('0x25')][_0x3320('0x3c')],'phone':_0xe01c9f['result'][_0x3320('0x3e')]});})[_0x3320('0x28')](function(_0x552b58){var _0x132169=_0x552b58[_0x3320('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x132169,JSON['stringify'](_0x552b58));});}});}function getConnection(_0x507c27){var _0x44e588=_0x507c27[_0x3320('0x20')];var _0x112771=_0x507c27[_0x3320('0x3f')];return request({'method':_0x3320('0x2d'),'uri':util[_0x3320('0x26')]('%s/webservice.php',_0x507c27[_0x3320('0x1e')]),'qs':{'operation':_0x3320('0x40'),'username':_0x44e588},'json':!![]})[_0x3320('0x23')](function(_0x2af77a){if(_0x2af77a[_0x3320('0x3a')]){return request({'method':_0x3320('0x1c'),'uri':util[_0x3320('0x26')](_0x3320('0x1d'),_0x507c27[_0x3320('0x1e')]),'form':{'operation':_0x3320('0x41'),'username':_0x44e588,'accessKey':md5(_0x2af77a[_0x3320('0x25')][_0x3320('0x42')]+_0x112771)},'json':!![]});}})[_0x3320('0x23')](function(_0x4beea2){if(_0x4beea2[_0x3320('0x3a')]){return BPromise[_0x3320('0x24')](_0x4beea2[_0x3320('0x25')]);}else{throw new Error(util[_0x3320('0x26')](_0x3320('0x43'),_0x507c27['id']));}})[_0x3320('0x28')](function(_0x3dd265){var _0x4120ae=_0x3dd265[_0x3320('0x29')]||0x1f4;logger[_0x3320('0x27')](_0x3320('0x35'),'getConnection',_0x4120ae,JSON[_0x3320('0x22')](_0x3dd265));});}function request(_0x378cf3){logger[_0x3320('0x18')](_0x3320('0x44'),JSON[_0x3320('0x22')](_0x378cf3));return rp(_0x378cf3);}exports[_0x3320('0x45')]=function(_0x54da32,_0x3d459a,_0x315336,_0x2a7888,_0x49c15e,_0x35b6b3){var _0x5d2551,_0x3edac1,_0xc46c2,_0x2e4b5e;_0x35b6b3[_0x3320('0x1e')]=intUtil['stripTrailingSlash'](_0x35b6b3[_0x3320('0x1e')]);if(_0x49c15e&&_0x49c15e[_0x3320('0x46')]){logger['info'](_0x3320('0x47'),'Recording\x20is\x20enabled!');_0x3d459a[_0x3320('0x48')]=util[_0x3320('0x26')](_0x3320('0x49'),_0x35b6b3[_0x3320('0x4a')],_0x3d459a['uniqueid'],md5(_0x3d459a[_0x3320('0x4b')]));}else{_0x3d459a[_0x3320('0x48')]='';}return getConnection(_0x35b6b3)['then'](function(_0x92cd5b){_0x2e4b5e=_0x92cd5b;return getUser(_0x35b6b3,_0x2a7888[_0x3320('0x4c')],_0x2e4b5e);})[_0x3320('0x23')](function(_0x19ab8f){_0x5d2551=_0x19ab8f;logger[_0x3320('0x18')]('The\x20User\x20ID\x20is:',_0x5d2551['id']);return getEndUser(_0x35b6b3,_0x3d459a['calleridname'],_0x3d459a['calleridnum'],_0x2e4b5e);})[_0x3320('0x23')](function(_0x282c72){_0x3edac1=_0x282c72;logger[_0x3320('0x18')](_0x3320('0x4d'),_0x3edac1['id']);return createTicket(_0x35b6b3,_0x5d2551,_0x3edac1,_0x315336,_0x3d459a,_0x315336[_0x3320('0x4e')],_0x2e4b5e);})['then'](function(_0x454bb8){_0xc46c2=_0x454bb8;logger['info']('Ticket\x20created!');logger[_0x3320('0x18')]('The\x20Ticket\x20ID\x20is:',_0xc46c2['id']);var _0x5a7742=util[_0x3320('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x35b6b3[_0x3320('0x1e')],_[_0x3320('0x4f')](_0xc46c2['id'],'x')[0x1]);logger[_0x3320('0x18')]('[QUEUE]',_0x3320('0x50'));emit(util[_0x3320('0x26')]('user:%s',_0x2a7888['name']),_0x3320('0x51'),{'uri':_0x5a7742});})['catch'](function(_0x5d3462){logger[_0x3320('0x27')]('[QUEUE]',JSON[_0x3320('0x22')](_0x5d3462));});};exports[_0x3320('0x52')]=function(_0x445ea4,_0x52f627,_0x3fc3e1,_0x5046a7,_0x106de7,_0x3b47d5,_0x28e007){var _0x4da118,_0x462ffb,_0x4ba2a2,_0x42cd08;_0x3b47d5['remoteUri']=intUtil[_0x3320('0x53')](_0x3b47d5[_0x3320('0x1e')]);_0x3b47d5[_0x3320('0x4a')]=intUtil[_0x3320('0x53')](_0x3b47d5[_0x3320('0x4a')]);if(_0x28e007&&_0x28e007['recordingFormat']&&_0x28e007[_0x3320('0x54')]!=='none'){logger[_0x3320('0x18')](_0x3320('0x55'),_0x3320('0x56'));_0x52f627[_0x3320('0x48')]=util[_0x3320('0x26')](_0x3320('0x49'),_0x3b47d5[_0x3320('0x4a')],_0x52f627[_0x3320('0x4b')],md5(_0x52f627['uniqueid']));}return getConnection(_0x3b47d5)['then'](function(_0x5c1e80){_0x42cd08=_0x5c1e80;return getUser(_0x3b47d5,_0x5046a7[_0x3320('0x4c')],_0x42cd08);})['then'](function(_0x4a693a){_0x4da118=_0x4a693a;logger[_0x3320('0x18')](_0x3320('0x57'),_0x4da118['id']);return getEndUser(_0x3b47d5,_0x52f627[_0x3320('0x58')],_0x52f627[_0x3320('0x59')],_0x42cd08);})[_0x3320('0x23')](function(_0x46af3f){_0x462ffb=_0x46af3f;logger[_0x3320('0x18')]('The\x20Enduser\x20ID\x20is:',_0x462ffb['id']);return createTicket(_0x3b47d5,_0x4da118,_0x462ffb,_0x3fc3e1,_0x52f627,_0x3fc3e1['Fields'],_0x42cd08);})[_0x3320('0x23')](function(_0x4a8711){_0x4ba2a2=_0x4a8711;logger[_0x3320('0x18')](_0x3320('0x5a'));logger[_0x3320('0x18')](_0x3320('0x5b'),_0x4ba2a2['id']);var _0x4cf652=util['format'](_0x3320('0x5c'),_0x3b47d5[_0x3320('0x1e')],_[_0x3320('0x4f')](_0x4ba2a2['id'],'x')[0x1]);logger[_0x3320('0x18')](_0x3320('0x55'),_0x3320('0x50'));emit(util[_0x3320('0x26')](_0x3320('0x5d'),_0x5046a7[_0x3320('0x16')]),'trigger:browser:url',{'uri':_0x4cf652});})[_0x3320('0x28')](function(_0x2d43a7){logger[_0x3320('0x27')](_0x3320('0x55'),JSON[_0x3320('0x22')](_0x2d43a7));});};exports[_0x3320('0x5e')]=function(_0x195e21,_0x43e703,_0x24e576,_0x42bdab,_0x2b3f18,_0x355ade){var _0x530021,_0x5be4f4,_0x25e42b,_0x3544be;_0x355ade[_0x3320('0x1e')]=intUtil['stripTrailingSlash'](_0x355ade[_0x3320('0x1e')]);_0x355ade['serverUrl']=intUtil[_0x3320('0x53')](_0x355ade['serverUrl']);if(_0x2b3f18&&_0x2b3f18[_0x3320('0x46')]){logger[_0x3320('0x18')]('['+_0x43e703[_0x3320('0x5f')][_0x3320('0x60')]()+']','Recording\x20is\x20enabled!');_0x43e703[_0x3320('0x48')]=util[_0x3320('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x355ade[_0x3320('0x4a')],_0x43e703[_0x3320('0x4b')],md5(_0x43e703[_0x3320('0x4b')]));}else{_0x43e703[_0x3320('0x48')]='';}return getConnection(_0x355ade)[_0x3320('0x23')](function(_0x448150){_0x3544be=_0x448150;return getUser(_0x355ade,'',_0x3544be);})[_0x3320('0x23')](function(_0x42a811){_0x530021=_0x42a811;logger[_0x3320('0x18')](_0x3320('0x57'),_0x530021['id']);return getEndUser(_0x355ade,_0x43e703[_0x3320('0x61')],_0x43e703[_0x3320('0x62')],_0x3544be);})[_0x3320('0x23')](function(_0x548fa3){_0x5be4f4=_0x548fa3;logger[_0x3320('0x18')](_0x3320('0x4d'),_0x5be4f4['id']);return createTicket(_0x355ade,_0x530021,_0x5be4f4,_0x24e576,_0x43e703,_0x24e576[_0x3320('0x4e')],_0x3544be);})[_0x3320('0x23')](function(_0x425f8d){_0x25e42b=_0x425f8d;logger[_0x3320('0x18')](_0x3320('0x5a'));logger[_0x3320('0x18')](_0x3320('0x5b'),_0x25e42b['id']);})[_0x3320('0x28')](function(_0x4492ca){logger['error']('['+_0x43e703[_0x3320('0x5f')][_0x3320('0x60')]()+']',JSON[_0x3320('0x22')](_0x4492ca));});}; \ No newline at end of file +var _0xf8bc=['stripTrailingSlash','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','serverUrl','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','unmanaged','toUpperCase','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','string','content','type','variable','variableName','idField','toString','name','Variable','toLowerCase','info','Creating\x20new\x20ticket...','Subjects','getString','Descriptions','POST','format','%s/webservice.php','remoteUri','create','stringify','then','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','createTicket','validateEmail','Getting\x20agent\x20with\x20email','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','GET','sessionName','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','lastname','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue'];(function(_0x3df685,_0x4439dd){var _0x219d6d=function(_0x1084ef){while(--_0x1084ef){_0x3df685['push'](_0x3df685['shift']());}};_0x219d6d(++_0x4439dd);}(_0xf8bc,0x82));var _0xcf8b=function(_0x2e819c,_0x3f99a5){_0x2e819c=_0x2e819c-0x0;var _0x24e271=_0xf8bc[_0x2e819c];return _0x24e271;};'use strict';var _=require(_0xcf8b('0x0'));var rp=require(_0xcf8b('0x1'));var BPromise=require(_0xcf8b('0x2'));var md5=require(_0xcf8b('0x3'));var util=require(_0xcf8b('0x4'));var Redis=require(_0xcf8b('0x5'));var intUtil=require(_0xcf8b('0x6'));var config=require(_0xcf8b('0x7'));var logger=require(_0xcf8b('0x8'))(_0xcf8b('0x9'));config[_0xcf8b('0xa')]=_[_0xcf8b('0xb')](config[_0xcf8b('0xa')],{'host':_0xcf8b('0xc'),'port':0x18eb});var io=require(_0xcf8b('0xd'))(new Redis(config[_0xcf8b('0xa')]));function emit(_0x264f23,_0x573db8,_0x465b2f){io['to'](_0x264f23)[_0xcf8b('0xe')](_0x573db8,_0x465b2f);}function getCustomFields(_0x545c1b,_0xb134a1){var _0x2937da={};if(_0x545c1b[_0xcf8b('0xf')]>0x0){_[_0xcf8b('0x10')](_0x545c1b,function(_0xef87d5){if(_0xef87d5['type']===_0xcf8b('0x11')&&_0xef87d5['idField']){_0x2937da[_0xef87d5['idField']]=_0xef87d5[_0xcf8b('0x12')]['toString']();}else if(_0xef87d5[_0xcf8b('0x13')]===_0xcf8b('0x14')&&_0xef87d5[_0xcf8b('0x15')]&&_0xef87d5[_0xcf8b('0x16')]&&_0xb134a1[_0xef87d5['variableName']]){_0x2937da[_0xef87d5[_0xcf8b('0x16')]]=_0xb134a1[_0xef87d5['variableName']][_0xcf8b('0x17')]();}else if(_0xef87d5[_0xcf8b('0x13')]==='customVariable'&&_0xef87d5['Variable']&&_0xef87d5['Variable'][_0xcf8b('0x18')]&&_0xef87d5[_0xcf8b('0x16')]&&_0xb134a1[_0xef87d5[_0xcf8b('0x19')][_0xcf8b('0x18')][_0xcf8b('0x1a')]()]){_0x2937da[_0xef87d5['idField']]=_0xb134a1[_0xef87d5[_0xcf8b('0x19')][_0xcf8b('0x18')][_0xcf8b('0x1a')]()][_0xcf8b('0x17')]();}});}return _0x2937da;}function createTicket(_0x137f03,_0x2ec2a8,_0xb20e57,_0x44c1e5,_0x423b46,_0x47fdbc,_0x336c60){logger[_0xcf8b('0x1b')](_0xcf8b('0x1c'));var _0x3a394d=_['merge']({'parent_id':'','assigned_user_id':_0x2ec2a8['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil['getString'](_0x44c1e5[_0xcf8b('0x1d')],_0x423b46,'\x20'),'description':intUtil[_0xcf8b('0x1e')](_0x44c1e5[_0xcf8b('0x1f')],_0x423b46,'\x0a'),'contact_id':_0xb20e57['id']},getCustomFields(_0x47fdbc,_0x423b46));var _0x262320={'method':_0xcf8b('0x20'),'uri':util[_0xcf8b('0x21')](_0xcf8b('0x22'),_0x137f03[_0xcf8b('0x23')]),'form':{'operation':_0xcf8b('0x24'),'username':_0x137f03['username'],'sessionName':_0x336c60['sessionName'],'elementType':'HelpDesk','element':JSON[_0xcf8b('0x25')](_0x3a394d)},'json':!![]};return request(_0x262320)[_0xcf8b('0x26')](function(_0x2d8ad5){if(_0x2d8ad5[_0xcf8b('0x27')]){return BPromise['resolve']({'id':_0x2d8ad5[_0xcf8b('0x28')]['id']});}else{throw new Error(util['format'](_0xcf8b('0x29'),JSON['stringify'](_0x2d8ad5[_0xcf8b('0x2a')])));}})[_0xcf8b('0x2b')](function(_0x3ee325){var _0x471a95=_0x3ee325[_0xcf8b('0x2c')]||0x1f4;logger[_0xcf8b('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xcf8b('0x2d'),_0x471a95,JSON[_0xcf8b('0x25')](_0x3ee325));});}function getUser(_0x339892,_0x2991c3,_0x5c4955){if(intUtil[_0xcf8b('0x2e')](_0x2991c3)){logger[_0xcf8b('0x1b')](_0xcf8b('0x2f'),_0x2991c3);return request({'method':'GET','uri':util[_0xcf8b('0x21')]('%s/webservice.php',_0x339892[_0xcf8b('0x23')]),'qs':{'operation':_0xcf8b('0x30'),'username':_0x339892[_0xcf8b('0x31')],'sessionName':_0x5c4955['sessionName'],'query':util['format'](_0xcf8b('0x32'),_0x2991c3)},'json':!![]})[_0xcf8b('0x26')](function(_0x17e1fc){if(_0x17e1fc[_0xcf8b('0x27')]&&_0x17e1fc['result']['length']){logger[_0xcf8b('0x1b')](_0xcf8b('0x33'));return BPromise[_0xcf8b('0x34')]({'id':_0x17e1fc[_0xcf8b('0x28')][0x0]['id'],'email':_0x17e1fc[_0xcf8b('0x28')][0x0][_0xcf8b('0x35')],'name':_0x17e1fc[_0xcf8b('0x28')][0x0][_0xcf8b('0x36')]+'\x20'+_0x17e1fc[_0xcf8b('0x28')]['last_name']});}else{logger[_0xcf8b('0x1b')](_0xcf8b('0x37'));return BPromise[_0xcf8b('0x34')]({'id':_0x5c4955[_0xcf8b('0x38')],'email':_0x339892[_0xcf8b('0x31')],'name':_0xcf8b('0x39')});}})['catch'](function(_0x46b4d4){var _0x2ef672=_0x46b4d4[_0xcf8b('0x2c')]||0x1f4;logger[_0xcf8b('0x2a')](_0xcf8b('0x3a'),'getUser',_0x2ef672,JSON['stringify'](_0x46b4d4));});}else{logger['info'](_0xcf8b('0x37'));return BPromise['resolve']({'id':_0x5c4955['userId'],'email':_0x339892[_0xcf8b('0x31')],'name':_0xcf8b('0x39')})[_0xcf8b('0x2b')](function(_0x1ab942){var _0x362920=_0x1ab942['statusCode']||0x1f4;logger['error'](_0xcf8b('0x3a'),_0xcf8b('0x3b'),_0x362920,JSON[_0xcf8b('0x25')](_0x1ab942));});}}function getEndUser(_0x3d5951,_0x5d508f,_0x21c504,_0x47b216){logger[_0xcf8b('0x1b')]('Searching\x20end\x20user\x20with\x20phone',_0x21c504);return request({'method':_0xcf8b('0x3c'),'uri':util['format'](_0xcf8b('0x22'),_0x3d5951[_0xcf8b('0x23')]),'qs':{'operation':'query','username':_0x3d5951[_0xcf8b('0x31')],'sessionName':_0x47b216[_0xcf8b('0x3d')],'query':util[_0xcf8b('0x21')](_0xcf8b('0x3e'),_0x21c504,_0x21c504,_0x21c504,_0x21c504,_0x21c504)},'json':!![]})['then'](function(_0x44b0af){if(_0x44b0af['success']&&_0x44b0af[_0xcf8b('0x28')][_0xcf8b('0xf')]){logger[_0xcf8b('0x1b')]('Enduser\x20found!');return BPromise[_0xcf8b('0x34')]({'id':_0x44b0af[_0xcf8b('0x28')][0x0]['id'],'name':_0x44b0af[_0xcf8b('0x28')][0x0]['firstname']+'\x20'+_0x44b0af[_0xcf8b('0x28')][0x0][_0xcf8b('0x3f')],'phone':_0x21c504});}else{logger[_0xcf8b('0x1b')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0xcf8b('0x20'),'uri':util[_0xcf8b('0x21')](_0xcf8b('0x22'),_0x3d5951[_0xcf8b('0x23')]),'form':{'operation':_0xcf8b('0x24'),'sessionName':_0x47b216[_0xcf8b('0x3d')],'elementType':_0xcf8b('0x40'),'element':JSON['stringify']({'lastname':_0x5d508f,'phone':_0x21c504,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x216b6a){logger['info'](_0xcf8b('0x41'));return BPromise[_0xcf8b('0x34')]({'id':_0x216b6a[_0xcf8b('0x28')]['id'],'name':_0x216b6a[_0xcf8b('0x28')][_0xcf8b('0x3f')],'phone':_0x216b6a[_0xcf8b('0x28')][_0xcf8b('0x42')]});})[_0xcf8b('0x2b')](function(_0x2710e6){var _0x3a81b5=_0x2710e6[_0xcf8b('0x2c')]||0x1f4;logger[_0xcf8b('0x2a')](_0xcf8b('0x3a'),_0xcf8b('0x43'),_0x3a81b5,JSON[_0xcf8b('0x25')](_0x2710e6));});}});}function getConnection(_0x5f445f){var _0x25d8b7=_0x5f445f['username'];var _0x5cf505=_0x5f445f[_0xcf8b('0x44')];return request({'method':'GET','uri':util['format'](_0xcf8b('0x22'),_0x5f445f[_0xcf8b('0x23')]),'qs':{'operation':'getchallenge','username':_0x25d8b7},'json':!![]})[_0xcf8b('0x26')](function(_0x1d1dde){if(_0x1d1dde['success']){return request({'method':'POST','uri':util[_0xcf8b('0x21')](_0xcf8b('0x22'),_0x5f445f[_0xcf8b('0x23')]),'form':{'operation':_0xcf8b('0x45'),'username':_0x25d8b7,'accessKey':md5(_0x1d1dde[_0xcf8b('0x28')][_0xcf8b('0x46')]+_0x5cf505)},'json':!![]});}})[_0xcf8b('0x26')](function(_0x4a8c67){if(_0x4a8c67[_0xcf8b('0x27')]){return BPromise[_0xcf8b('0x34')](_0x4a8c67[_0xcf8b('0x28')]);}else{throw new Error(util['format'](_0xcf8b('0x47'),_0x5f445f['id']));}})[_0xcf8b('0x2b')](function(_0x6daeff){var _0xf05f35=_0x6daeff[_0xcf8b('0x2c')]||0x1f4;logger[_0xcf8b('0x2a')](_0xcf8b('0x3a'),'getConnection',_0xf05f35,JSON[_0xcf8b('0x25')](_0x6daeff));});}function request(_0x511202){logger[_0xcf8b('0x1b')](_0xcf8b('0x48'),JSON[_0xcf8b('0x25')](_0x511202));return rp(_0x511202);}exports[_0xcf8b('0x49')]=function(_0x304700,_0x24bf05,_0x2ef48f,_0x5e5ef4,_0x1e2885,_0x7a26cb){var _0x1f7958,_0x34de49,_0x39d8fb,_0x4f77a2;_0x7a26cb[_0xcf8b('0x23')]=intUtil[_0xcf8b('0x4a')](_0x7a26cb[_0xcf8b('0x23')]);if(_0x1e2885&&_0x1e2885[_0xcf8b('0x4b')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x24bf05['recordingURL']=util[_0xcf8b('0x21')](_0xcf8b('0x4c'),_0x7a26cb['serverUrl'],_0x24bf05[_0xcf8b('0x4d')],md5(_0x24bf05['uniqueid']));}else{_0x24bf05[_0xcf8b('0x4e')]='';}return getConnection(_0x7a26cb)[_0xcf8b('0x26')](function(_0x36ff73){_0x4f77a2=_0x36ff73;return getUser(_0x7a26cb,_0x5e5ef4['email'],_0x4f77a2);})[_0xcf8b('0x26')](function(_0x548905){_0x1f7958=_0x548905;logger[_0xcf8b('0x1b')](_0xcf8b('0x4f'),_0x1f7958['id']);return getEndUser(_0x7a26cb,_0x24bf05[_0xcf8b('0x50')],_0x24bf05[_0xcf8b('0x51')],_0x4f77a2);})[_0xcf8b('0x26')](function(_0x4f81fd){_0x34de49=_0x4f81fd;logger['info'](_0xcf8b('0x52'),_0x34de49['id']);return createTicket(_0x7a26cb,_0x1f7958,_0x34de49,_0x2ef48f,_0x24bf05,_0x2ef48f['Fields'],_0x4f77a2);})[_0xcf8b('0x26')](function(_0x48dd33){_0x39d8fb=_0x48dd33;logger['info'](_0xcf8b('0x53'));logger[_0xcf8b('0x1b')](_0xcf8b('0x54'),_0x39d8fb['id']);var _0x557cf0=util[_0xcf8b('0x21')](_0xcf8b('0x55'),_0x7a26cb[_0xcf8b('0x23')],_[_0xcf8b('0x56')](_0x39d8fb['id'],'x')[0x1]);logger[_0xcf8b('0x1b')](_0xcf8b('0x57'),_0xcf8b('0x58'));emit(util['format'](_0xcf8b('0x59'),_0x5e5ef4[_0xcf8b('0x18')]),_0xcf8b('0x5a'),{'uri':_0x557cf0});})['catch'](function(_0x276507){logger[_0xcf8b('0x2a')]('[QUEUE]',JSON[_0xcf8b('0x25')](_0x276507));});};exports['outbound']=function(_0x4e953f,_0x2bb989,_0x29bc44,_0x40b2a6,_0x5adad9,_0x9249b7,_0x47fafd){var _0x4ac005,_0x3d417c,_0x32a96f,_0x370826;_0x9249b7['remoteUri']=intUtil[_0xcf8b('0x4a')](_0x9249b7[_0xcf8b('0x23')]);_0x9249b7[_0xcf8b('0x5b')]=intUtil[_0xcf8b('0x4a')](_0x9249b7[_0xcf8b('0x5b')]);if(_0x47fafd&&_0x47fafd[_0xcf8b('0x5c')]&&_0x47fafd['recordingFormat']!==_0xcf8b('0x5d')){logger['info'](_0xcf8b('0x5e'),_0xcf8b('0x5f'));_0x2bb989[_0xcf8b('0x4e')]=util[_0xcf8b('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x9249b7['serverUrl'],_0x2bb989[_0xcf8b('0x4d')],md5(_0x2bb989[_0xcf8b('0x4d')]));}return getConnection(_0x9249b7)[_0xcf8b('0x26')](function(_0x176efc){_0x370826=_0x176efc;return getUser(_0x9249b7,_0x40b2a6['email'],_0x370826);})[_0xcf8b('0x26')](function(_0x1434fa){_0x4ac005=_0x1434fa;logger[_0xcf8b('0x1b')](_0xcf8b('0x4f'),_0x4ac005['id']);return getEndUser(_0x9249b7,_0x2bb989[_0xcf8b('0x60')],_0x2bb989[_0xcf8b('0x61')],_0x370826);})[_0xcf8b('0x26')](function(_0x4f5b72){_0x3d417c=_0x4f5b72;logger[_0xcf8b('0x1b')](_0xcf8b('0x52'),_0x3d417c['id']);return createTicket(_0x9249b7,_0x4ac005,_0x3d417c,_0x29bc44,_0x2bb989,_0x29bc44[_0xcf8b('0x62')],_0x370826);})[_0xcf8b('0x26')](function(_0x19144d){_0x32a96f=_0x19144d;logger[_0xcf8b('0x1b')](_0xcf8b('0x53'));logger[_0xcf8b('0x1b')](_0xcf8b('0x54'),_0x32a96f['id']);var _0xd28944=util['format'](_0xcf8b('0x55'),_0x9249b7[_0xcf8b('0x23')],_[_0xcf8b('0x56')](_0x32a96f['id'],'x')[0x1]);logger[_0xcf8b('0x1b')](_0xcf8b('0x5e'),_0xcf8b('0x58'));emit(util[_0xcf8b('0x21')](_0xcf8b('0x59'),_0x40b2a6[_0xcf8b('0x18')]),_0xcf8b('0x5a'),{'uri':_0xd28944});})[_0xcf8b('0x2b')](function(_0x1f8af8){logger[_0xcf8b('0x2a')](_0xcf8b('0x5e'),JSON[_0xcf8b('0x25')](_0x1f8af8));});};exports[_0xcf8b('0x63')]=function(_0x24ece2,_0x411875,_0x4425b8,_0x391074,_0x46a7c9,_0x39fb83){var _0x4bfe85,_0x40b8c8,_0x125471,_0x2108e1;_0x39fb83[_0xcf8b('0x23')]=intUtil['stripTrailingSlash'](_0x39fb83['remoteUri']);_0x39fb83['serverUrl']=intUtil[_0xcf8b('0x4a')](_0x39fb83[_0xcf8b('0x5b')]);if(_0x46a7c9&&_0x46a7c9[_0xcf8b('0x4b')]){logger['info']('['+_0x411875['lastevent'][_0xcf8b('0x64')]()+']','Recording\x20is\x20enabled!');_0x411875[_0xcf8b('0x4e')]=util['format'](_0xcf8b('0x4c'),_0x39fb83[_0xcf8b('0x5b')],_0x411875[_0xcf8b('0x4d')],md5(_0x411875['uniqueid']));}else{_0x411875['recordingURL']='';}return getConnection(_0x39fb83)[_0xcf8b('0x26')](function(_0x20d298){_0x2108e1=_0x20d298;return getUser(_0x39fb83,'',_0x2108e1);})[_0xcf8b('0x26')](function(_0x5769b4){_0x4bfe85=_0x5769b4;logger[_0xcf8b('0x1b')](_0xcf8b('0x4f'),_0x4bfe85['id']);return getEndUser(_0x39fb83,_0x411875[_0xcf8b('0x50')],_0x411875['calleridnum'],_0x2108e1);})[_0xcf8b('0x26')](function(_0xdffb1e){_0x40b8c8=_0xdffb1e;logger[_0xcf8b('0x1b')](_0xcf8b('0x52'),_0x40b8c8['id']);return createTicket(_0x39fb83,_0x4bfe85,_0x40b8c8,_0x4425b8,_0x411875,_0x4425b8[_0xcf8b('0x62')],_0x2108e1);})[_0xcf8b('0x26')](function(_0x16a3f5){_0x125471=_0x16a3f5;logger['info'](_0xcf8b('0x53'));logger[_0xcf8b('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x125471['id']);})[_0xcf8b('0x2b')](function(_0x5bf7a5){logger[_0xcf8b('0x2a')]('['+_0x411875[_0xcf8b('0x65')][_0xcf8b('0x64')]()+']',JSON['stringify'](_0x5bf7a5));});}; \ 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 7062b24..8f4d7bb 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 _0x61dd=['idField','variable','variableName','push','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','user:%s','trigger:browser:url','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','Tags','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','string','nameField','customField','toLowerCase','content','type','custom_fields'];(function(_0x482326,_0x414a20){var _0x46d357=function(_0x1f243c){while(--_0x1f243c){_0x482326['push'](_0x482326['shift']());}};_0x46d357(++_0x414a20);}(_0x61dd,0x9d));var _0xd61d=function(_0x213c63,_0x420de6){_0x213c63=_0x213c63-0x0;var _0x300bfb=_0x61dd[_0x213c63];return _0x300bfb;};'use strict';var _=require('lodash');var rp=require(_0xd61d('0x0'));var md5=require(_0xd61d('0x1'));var util=require(_0xd61d('0x2'));var Redis=require('ioredis');var intUtil=require(_0xd61d('0x3'));var config=require(_0xd61d('0x4'));var logger=require(_0xd61d('0x5'))(_0xd61d('0x6'));config['redis']=_[_0xd61d('0x7')](config[_0xd61d('0x8')],{'host':_0xd61d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd61d('0x8')]));function emit(_0x2c55a4,_0x234833,_0x401c82){io['to'](_0x2c55a4)[_0xd61d('0xa')](_0x234833,_0x401c82);}var headers={'Content-Type':_0xd61d('0xb'),'Accept':'application/json'};function getTicket(_0x3f453d,_0x3cb34a,_0x2f464f,_0xb9911f,_0x2649b4){logger[_0xd61d('0xc')](_0xd61d('0xd'));return request({'uri':util[_0xd61d('0xe')](_0xd61d('0xf'),_0x3f453d[_0xd61d('0x10')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x2f464f['id'],'submitter_id':_0x3cb34a?_0x3cb34a['id']:undefined,'assignee_id':_0x3cb34a?_0x3cb34a['id']:undefined,'tags':getTags(_0xb9911f[_0xd61d('0x11')],'name'),'subject':intUtil[_0xd61d('0x12')](_0xb9911f[_0xd61d('0x13')],_0x2649b4,'\x20'),'description':intUtil['getString'](_0xb9911f[_0xd61d('0x14')],_0x2649b4,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0xb9911f[_0xd61d('0x14')],_0x2649b4,'\x0a')}},getCustomFields(_0xb9911f[_0xd61d('0x15')],_0x2649b4))}})[_0xd61d('0x16')](function(_0x36124d){logger[_0xd61d('0xc')]('Ticket\x20created!');return _0x36124d[_0xd61d('0x17')];});}function getUser(_0x1516d4,_0x556cdb){if(intUtil[_0xd61d('0x18')](_0x556cdb)){logger[_0xd61d('0xc')]('Getting\x20agent\x20with\x20email',_0x556cdb);return request({'uri':util['format'](_0xd61d('0x19'),_0x1516d4[_0xd61d('0x10')]),'qs':{'query':util[_0xd61d('0xe')](_0xd61d('0x1a'),_0x556cdb)}})[_0xd61d('0x16')](function(_0x489170){if(_0x489170[_0xd61d('0x1b')]){logger[_0xd61d('0xc')]('Agent\x20found!');return _[_0xd61d('0x1c')](_0x489170['results'],{'email':_0x556cdb,'role':_0xd61d('0x1d')});}else{logger[_0xd61d('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd61d('0xe')](_0xd61d('0x1e'),_0x1516d4[_0xd61d('0x10')])})['then'](function(_0x2f6639){logger[_0xd61d('0xc')](_0xd61d('0x1f'));return _0x2f6639[_0xd61d('0x20')];});}});}else{logger[_0xd61d('0xc')](_0xd61d('0x21'));return request({'uri':util[_0xd61d('0xe')](_0xd61d('0x1e'),_0x1516d4[_0xd61d('0x10')])})[_0xd61d('0x16')](function(_0x87da9b){logger[_0xd61d('0xc')](_0xd61d('0x1f'));return _0x87da9b[_0xd61d('0x20')];});}}function getEndUser(_0x18fa4a,_0x36da50,_0x54ee56){logger['info'](_0xd61d('0x22'),_0x54ee56);return request({'uri':util[_0xd61d('0xe')](_0xd61d('0x19'),_0x18fa4a['remoteUri']),'qs':{'query':util['format'](_0xd61d('0x23'),_0x54ee56)}})[_0xd61d('0x16')](function(_0x11a1e8){var _0x5698ba;if(_0x11a1e8[_0xd61d('0x24')][_0xd61d('0x25')]){_0x11a1e8[_0xd61d('0x24')]=_['filter'](_0x11a1e8[_0xd61d('0x24')],{'suspended':![],'role':'end-user'});if(_0x11a1e8[_0xd61d('0x24')][_0xd61d('0x25')]){_0x5698ba=_[_0xd61d('0x26')](_0x11a1e8['results']);}}if(_0x5698ba){logger[_0xd61d('0xc')](_0xd61d('0x27'));return _0x5698ba;}else{logger['info'](_0xd61d('0x28'));return request({'uri':util[_0xd61d('0xe')]('%s/users.json',_0x18fa4a[_0xd61d('0x10')]),'method':'POST','body':{'user':{'role':_0xd61d('0x29'),'name':util[_0xd61d('0xe')](_0xd61d('0x2a'),_0x36da50||_0x54ee56),'phone':_0x54ee56}}})[_0xd61d('0x16')](function(_0x48272b){logger[_0xd61d('0xc')](_0xd61d('0x2b'));return _0x48272b[_0xd61d('0x20')];});}});}function getAuth(_0x32e0db){var _0x3f463a;if(_0x32e0db[_0xd61d('0x2c')]==='password'){_0x3f463a=util[_0xd61d('0xe')]('%s:%s',_0x32e0db['username'],_0x32e0db[_0xd61d('0x2d')]);}else if(_0x32e0db[_0xd61d('0x2c')]===_0xd61d('0x2e')){_0x3f463a=util[_0xd61d('0xe')](_0xd61d('0x2f'),_0x32e0db[_0xd61d('0x30')],_0x32e0db[_0xd61d('0x2e')]);}return util[_0xd61d('0xe')](_0xd61d('0x31'),new Buffer(_0x3f463a)[_0xd61d('0x32')](_0xd61d('0x33')));}function request(_0x143fd9){logger[_0xd61d('0x34')](_0xd61d('0x35'),JSON[_0xd61d('0x36')](_0x143fd9));return rp(_[_0xd61d('0x7')](_0x143fd9,{'method':_0xd61d('0x37'),'headers':headers,'json':!![]}));}function getTags(_0xd0f49e,_0x4463d4){var _0x5e0eb8=[];if(_0xd0f49e&&_0xd0f49e['length']>0x0){_0x5e0eb8=_[_0xd61d('0x38')](_0xd0f49e,_0x4463d4);}return _0x5e0eb8;}function getCustomFields(_0x4ff312,_0x185342){var _0x5b7258=[];var _0x5bdb8f={'custom_fields':[]};if(_0x4ff312['length']>0x0){_[_0xd61d('0x39')](_0x4ff312,function(_0x2181f6){if(_0x2181f6['type']===_0xd61d('0x3a')&&_0x2181f6[_0xd61d('0x3b')]&&!_0x2181f6[_0xd61d('0x3c')]){_0x5bdb8f[_0x2181f6[_0xd61d('0x3b')][_0xd61d('0x3d')]()]=_0x2181f6[_0xd61d('0x3e')]['toString']();}else if(_0x2181f6[_0xd61d('0x3f')]===_0xd61d('0x3a')&&_0x2181f6['idField']&&_0x2181f6[_0xd61d('0x3c')]){_0x5bdb8f[_0xd61d('0x40')]['push']({'id':_0x2181f6[_0xd61d('0x41')],'value':_0x2181f6[_0xd61d('0x3e')][_0xd61d('0x32')]()});}else if(_0x2181f6[_0xd61d('0x3f')]===_0xd61d('0x42')&&_0x2181f6[_0xd61d('0x43')]&&_0x2181f6[_0xd61d('0x41')]&&_0x2181f6['customField']){_0x185342[_0x2181f6[_0xd61d('0x43')]]&&_0x5bdb8f[_0xd61d('0x40')][_0xd61d('0x44')]({'id':_0x2181f6['idField'],'value':_0x185342[_0x2181f6[_0xd61d('0x43')]]['toString']()});}else if(_0x2181f6[_0xd61d('0x3f')]===_0xd61d('0x45')&&_0x2181f6['Variable']&&_0x2181f6[_0xd61d('0x46')][_0xd61d('0x47')]&&_0x2181f6[_0xd61d('0x41')]&&_0x2181f6[_0xd61d('0x3c')]){_0x185342[_0x2181f6[_0xd61d('0x46')][_0xd61d('0x47')][_0xd61d('0x3d')]()]&&_0x5bdb8f['custom_fields']['push']({'id':_0x2181f6[_0xd61d('0x41')],'value':_0x185342[_0x2181f6[_0xd61d('0x46')][_0xd61d('0x47')][_0xd61d('0x3d')]()]['toString']()});}});}return _0x5bdb8f;}exports[_0xd61d('0x48')]=function(_0x33b923,_0x3055c6,_0x4d579b,_0x15a9e2,_0x2a6226,_0x4960b1){var _0x583bb0,_0x2c9c05;_0x4960b1['remoteUri']=intUtil['stripTrailingSlash'](_0x4960b1[_0xd61d('0x10')]);_0x4960b1[_0xd61d('0x49')]=intUtil[_0xd61d('0x4a')](_0x4960b1['serverUrl']);if(_0x2a6226&&_0x2a6226[_0xd61d('0x4b')]){logger[_0xd61d('0xc')](_0xd61d('0x4c'),_0xd61d('0x4d'));_0x3055c6[_0xd61d('0x4e')]=util[_0xd61d('0xe')](_0xd61d('0x4f'),_0x4960b1['serverUrl'],_0x3055c6[_0xd61d('0x50')],md5(_0x3055c6[_0xd61d('0x50')]));}else{_0x3055c6[_0xd61d('0x4e')]='';}headers[_0xd61d('0x51')]=getAuth(_0x4960b1);return getUser(_0x4960b1,_0x15a9e2[_0xd61d('0x52')])[_0xd61d('0x16')](function(_0x18cb9e){_0x583bb0=_0x18cb9e;logger[_0xd61d('0xc')](_0xd61d('0x53'),_0x583bb0['id']);return getEndUser(_0x4960b1,_0x3055c6[_0xd61d('0x54')],_0x3055c6[_0xd61d('0x55')]);})[_0xd61d('0x16')](function(_0x29ecdf){_0x2c9c05=_0x29ecdf;logger[_0xd61d('0xc')](_0xd61d('0x56'),_0x2c9c05['id']);return getTicket(_0x4960b1,_0x583bb0,_0x2c9c05,_0x4d579b,_0x3055c6);})['then'](function(_0x7344a5){if(_0x7344a5){logger[_0xd61d('0xc')](_0xd61d('0x57'),_0x7344a5['id']);switch(_0x4960b1[_0xd61d('0x3f')]){case _0xd61d('0x58'):logger[_0xd61d('0xc')](_0xd61d('0x4c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xd61d('0x59'),_0x4960b1[_0xd61d('0x10')],_0x583bb0['id'],_0x7344a5['id']),'method':_0xd61d('0x5a')});case _0xd61d('0x5b'):logger[_0xd61d('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd61d('0xe')](_0xd61d('0x5c'),_0x15a9e2[_0xd61d('0x47')]),_0xd61d('0x5d'),{'uri':util['format']('%s/agent/tickets/%s',_0x4960b1[_0xd61d('0x10')]['replace'](_0xd61d('0x5e'),''),_0x7344a5['id'])});break;default:logger[_0xd61d('0x5f')]('[QUEUE]',_0xd61d('0x60'));}}})[_0xd61d('0x61')](function(_0x1e374f){logger[_0xd61d('0x5f')](_0xd61d('0x62'),util[_0xd61d('0x63')](_0x1e374f,{'showHidden':!![],'depth':null}));});};exports[_0xd61d('0x64')]=function(_0x5008a5,_0x3d2e4e,_0x430949,_0xdb35e5,_0x5ee3e9,_0x25f56e,_0x5d5d56){var _0x10efaf,_0x4f8fa0;_0x25f56e[_0xd61d('0x10')]=intUtil[_0xd61d('0x4a')](_0x25f56e[_0xd61d('0x10')]);_0x25f56e[_0xd61d('0x49')]=intUtil[_0xd61d('0x4a')](_0x25f56e[_0xd61d('0x49')]);if(_0x5d5d56&&_0x5d5d56['recordingFormat']&&_0x5d5d56[_0xd61d('0x65')]!==_0xd61d('0x66')){logger['info']('[OUTBOUND]',_0xd61d('0x4d'));_0x3d2e4e['recordingURL']=util[_0xd61d('0xe')](_0xd61d('0x4f'),_0x25f56e[_0xd61d('0x49')],_0x3d2e4e[_0xd61d('0x50')],md5(_0x3d2e4e['uniqueid']));}headers[_0xd61d('0x51')]=getAuth(_0x25f56e);return getUser(_0x25f56e,_0xdb35e5[_0xd61d('0x52')])['then'](function(_0x42ce1a){_0x10efaf=_0x42ce1a;logger[_0xd61d('0xc')]('The\x20User\x20ID\x20is:',_0x10efaf['id']);return getEndUser(_0x25f56e,_0x3d2e4e[_0xd61d('0x67')],_0x3d2e4e['destcalleridnum']);})['then'](function(_0xbae79a){_0x4f8fa0=_0xbae79a;logger[_0xd61d('0xc')](_0xd61d('0x56'),_0x4f8fa0['id']);return getTicket(_0x25f56e,_0x10efaf,_0x4f8fa0,_0x430949,_0x3d2e4e);})[_0xd61d('0x16')](function(_0x43ba62){if(_0x43ba62){logger[_0xd61d('0xc')](_0xd61d('0x57'),_0x43ba62['id']);switch(_0x25f56e[_0xd61d('0x3f')]){case'integrationTab':logger[_0xd61d('0xc')](_0xd61d('0x68'),_0xd61d('0x69'));return request({'uri':util['format'](_0xd61d('0x59'),_0x25f56e['remoteUri'],_0x10efaf['id'],_0x43ba62['id']),'method':_0xd61d('0x5a')});case'newTab':logger[_0xd61d('0xc')]('[OUTBOUND]',_0xd61d('0x6a'));emit(util['format']('user:%s',_0xdb35e5[_0xd61d('0x47')]),'trigger:browser:url',{'uri':util[_0xd61d('0xe')]('%s/agent/tickets/%s',_0x25f56e['remoteUri']['replace'](_0xd61d('0x5e'),''),_0x43ba62['id'])});break;default:logger[_0xd61d('0x5f')](_0xd61d('0x68'),_0xd61d('0x60'));}}})[_0xd61d('0x61')](function(_0x136f7f){logger[_0xd61d('0x5f')](_0xd61d('0x6b'),util[_0xd61d('0x63')](_0x136f7f,{'showHidden':!![],'depth':null}));});};exports[_0xd61d('0x6c')]=function(_0xdf9daf,_0x57def1,_0x5f503d,_0xc853a9,_0x1de555,_0x243501){var _0x1c4a07,_0x218e9d;_0x243501[_0xd61d('0x10')]=intUtil['stripTrailingSlash'](_0x243501['remoteUri']);_0x243501[_0xd61d('0x49')]=intUtil[_0xd61d('0x4a')](_0x243501[_0xd61d('0x49')]);if(_0x1de555&&_0x1de555['monitor_format']){logger['info']('['+_0x57def1['lastevent'][_0xd61d('0x6d')]()+']',_0xd61d('0x4d'));_0x57def1[_0xd61d('0x4e')]=util['format'](_0xd61d('0x4f'),_0x243501[_0xd61d('0x49')],_0x57def1['uniqueid'],md5(_0x57def1['uniqueid']));}else{_0x57def1['recordingURL']='';}headers['Authorization']=getAuth(_0x243501);return getUser(_0x243501)[_0xd61d('0x16')](function(_0x182c08){_0x1c4a07=_0x182c08;logger[_0xd61d('0xc')](_0xd61d('0x53'),_0x1c4a07['id']);return getEndUser(_0x243501,_0x57def1[_0xd61d('0x54')],_0x57def1[_0xd61d('0x55')]);})[_0xd61d('0x16')](function(_0x48bef5){_0x218e9d=_0x48bef5;logger[_0xd61d('0xc')](_0xd61d('0x56'),_0x218e9d['id']);return getTicket(_0x243501,_0x1c4a07,_0x218e9d,_0x5f503d,_0x57def1);})[_0xd61d('0x16')](function(_0x2a8451){if(_0x2a8451){logger[_0xd61d('0xc')](_0xd61d('0x57'),_0x2a8451['id']);}})[_0xd61d('0x61')](function(_0x1c0c93){logger[_0xd61d('0x5f')]('['+_0x57def1[_0xd61d('0x6e')][_0xd61d('0x6d')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xd61d('0x63')](_0x1c0c93,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbc80=['outbound','recordingFormat','none','[OUTBOUND]','Authorization','type','user:%s','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','calleridname','calleridnum','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','getString','Subjects','Fields','info','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','forEach','nameField','customField','content','string','custom_fields','push','idField','variableName','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','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','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0xbc80,0x154));var _0x0bc8=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0xbc80[_0x3c487b];return _0x1d65f6;};'use strict';var _=require(_0x0bc8('0x0'));var rp=require(_0x0bc8('0x1'));var md5=require(_0x0bc8('0x2'));var util=require(_0x0bc8('0x3'));var Redis=require(_0x0bc8('0x4'));var intUtil=require(_0x0bc8('0x5'));var config=require('../../../../config/environment');var logger=require(_0x0bc8('0x6'))(_0x0bc8('0x7'));config[_0x0bc8('0x8')]=_[_0x0bc8('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0bc8('0xa'))(new Redis(config['redis']));function emit(_0x124e45,_0x579a8a,_0x1771ab){io['to'](_0x124e45)[_0x0bc8('0xb')](_0x579a8a,_0x1771ab);}var headers={'Content-Type':_0x0bc8('0xc'),'Accept':_0x0bc8('0xc')};function getTicket(_0x5c20af,_0x1de1ec,_0x536450,_0x2b477b,_0x5702a0){logger['info'](_0x0bc8('0xd'));return request({'uri':util[_0x0bc8('0xe')](_0x0bc8('0xf'),_0x5c20af[_0x0bc8('0x10')]),'method':_0x0bc8('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x536450['id'],'submitter_id':_0x1de1ec?_0x1de1ec['id']:undefined,'assignee_id':_0x1de1ec?_0x1de1ec['id']:undefined,'tags':getTags(_0x2b477b[_0x0bc8('0x12')],'name'),'subject':intUtil[_0x0bc8('0x13')](_0x2b477b[_0x0bc8('0x14')],_0x5702a0,'\x20'),'description':intUtil[_0x0bc8('0x13')](_0x2b477b['Descriptions'],_0x5702a0,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0bc8('0x13')](_0x2b477b['Descriptions'],_0x5702a0,'\x0a')}},getCustomFields(_0x2b477b[_0x0bc8('0x15')],_0x5702a0))}})['then'](function(_0x5a48e0){logger[_0x0bc8('0x16')](_0x0bc8('0x17'));return _0x5a48e0['ticket'];});}function getUser(_0x4ed69,_0x4d53c9){if(intUtil['validateEmail'](_0x4d53c9)){logger[_0x0bc8('0x16')](_0x0bc8('0x18'),_0x4d53c9);return request({'uri':util[_0x0bc8('0xe')](_0x0bc8('0x19'),_0x4ed69['remoteUri']),'qs':{'query':util[_0x0bc8('0xe')](_0x0bc8('0x1a'),_0x4d53c9)}})[_0x0bc8('0x1b')](function(_0x171c2d){if(_0x171c2d[_0x0bc8('0x1c')]){logger['info']('Agent\x20found!');return _[_0x0bc8('0x1d')](_0x171c2d[_0x0bc8('0x1e')],{'email':_0x4d53c9,'role':_0x0bc8('0x1f')});}else{logger[_0x0bc8('0x16')](_0x0bc8('0x20'));return request({'uri':util[_0x0bc8('0xe')](_0x0bc8('0x21'),_0x4ed69[_0x0bc8('0x10')])})[_0x0bc8('0x1b')](function(_0x209553){logger[_0x0bc8('0x16')]('Admin\x20account\x20selected.');return _0x209553['user'];});}});}else{logger[_0x0bc8('0x16')](_0x0bc8('0x20'));return request({'uri':util[_0x0bc8('0xe')]('%s/users/me.json',_0x4ed69[_0x0bc8('0x10')])})['then'](function(_0x46798e){logger[_0x0bc8('0x16')](_0x0bc8('0x22'));return _0x46798e[_0x0bc8('0x23')];});}}function getEndUser(_0x561149,_0x49a84c,_0x31f654){logger[_0x0bc8('0x16')](_0x0bc8('0x24'),_0x31f654);return request({'uri':util[_0x0bc8('0xe')](_0x0bc8('0x19'),_0x561149[_0x0bc8('0x10')]),'qs':{'query':util[_0x0bc8('0xe')](_0x0bc8('0x25'),_0x31f654)}})[_0x0bc8('0x1b')](function(_0x5cacbe){var _0x58fb8f;if(_0x5cacbe[_0x0bc8('0x1e')][_0x0bc8('0x26')]){_0x5cacbe['results']=_[_0x0bc8('0x27')](_0x5cacbe[_0x0bc8('0x1e')],{'suspended':![],'role':'end-user'});if(_0x5cacbe[_0x0bc8('0x1e')][_0x0bc8('0x26')]){_0x58fb8f=_[_0x0bc8('0x28')](_0x5cacbe[_0x0bc8('0x1e')]);}}if(_0x58fb8f){logger[_0x0bc8('0x16')](_0x0bc8('0x29'));return _0x58fb8f;}else{logger[_0x0bc8('0x16')](_0x0bc8('0x2a'));return request({'uri':util[_0x0bc8('0xe')](_0x0bc8('0x2b'),_0x561149['remoteUri']),'method':_0x0bc8('0x11'),'body':{'user':{'role':'end-user','name':util['format'](_0x0bc8('0x2c'),_0x49a84c||_0x31f654),'phone':_0x31f654}}})[_0x0bc8('0x1b')](function(_0x571d35){logger[_0x0bc8('0x16')](_0x0bc8('0x2d'));return _0x571d35[_0x0bc8('0x23')];});}});}function getAuth(_0x45d5a3){var _0xf3f9b1;if(_0x45d5a3[_0x0bc8('0x2e')]==='password'){_0xf3f9b1=util[_0x0bc8('0xe')](_0x0bc8('0x2f'),_0x45d5a3[_0x0bc8('0x30')],_0x45d5a3[_0x0bc8('0x31')]);}else if(_0x45d5a3[_0x0bc8('0x2e')]===_0x0bc8('0x32')){_0xf3f9b1=util[_0x0bc8('0xe')](_0x0bc8('0x33'),_0x45d5a3['username'],_0x45d5a3[_0x0bc8('0x32')]);}return util[_0x0bc8('0xe')](_0x0bc8('0x34'),new Buffer(_0xf3f9b1)[_0x0bc8('0x35')](_0x0bc8('0x36')));}function request(_0x4d1c9a){logger['debug'](_0x0bc8('0x37'),JSON[_0x0bc8('0x38')](_0x4d1c9a));return rp(_[_0x0bc8('0x9')](_0x4d1c9a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x579923,_0x449bd3){var _0x1a3848=[];if(_0x579923&&_0x579923[_0x0bc8('0x26')]>0x0){_0x1a3848=_['map'](_0x579923,_0x449bd3);}return _0x1a3848;}function getCustomFields(_0xda078e,_0x2d21d0){var _0x446a19=[];var _0x211829={'custom_fields':[]};if(_0xda078e[_0x0bc8('0x26')]>0x0){_[_0x0bc8('0x39')](_0xda078e,function(_0xa91c61){if(_0xa91c61['type']==='string'&&_0xa91c61[_0x0bc8('0x3a')]&&!_0xa91c61[_0x0bc8('0x3b')]){_0x211829[_0xa91c61['nameField']['toLowerCase']()]=_0xa91c61[_0x0bc8('0x3c')][_0x0bc8('0x35')]();}else if(_0xa91c61['type']===_0x0bc8('0x3d')&&_0xa91c61['idField']&&_0xa91c61['customField']){_0x211829[_0x0bc8('0x3e')][_0x0bc8('0x3f')]({'id':_0xa91c61[_0x0bc8('0x40')],'value':_0xa91c61['content']['toString']()});}else if(_0xa91c61['type']==='variable'&&_0xa91c61['variableName']&&_0xa91c61[_0x0bc8('0x40')]&&_0xa91c61['customField']){_0x2d21d0[_0xa91c61[_0x0bc8('0x41')]]&&_0x211829['custom_fields'][_0x0bc8('0x3f')]({'id':_0xa91c61[_0x0bc8('0x40')],'value':_0x2d21d0[_0xa91c61[_0x0bc8('0x41')]][_0x0bc8('0x35')]()});}else if(_0xa91c61['type']==='customVariable'&&_0xa91c61[_0x0bc8('0x42')]&&_0xa91c61[_0x0bc8('0x42')][_0x0bc8('0x43')]&&_0xa91c61[_0x0bc8('0x40')]&&_0xa91c61['customField']){_0x2d21d0[_0xa91c61[_0x0bc8('0x42')][_0x0bc8('0x43')]['toLowerCase']()]&&_0x211829[_0x0bc8('0x3e')][_0x0bc8('0x3f')]({'id':_0xa91c61[_0x0bc8('0x40')],'value':_0x2d21d0[_0xa91c61['Variable'][_0x0bc8('0x43')]['toLowerCase']()][_0x0bc8('0x35')]()});}});}return _0x211829;}exports[_0x0bc8('0x44')]=function(_0x297c1c,_0x36fd70,_0xda65e4,_0x436e3b,_0x5ec3a0,_0x43b034){var _0x1d6d5c,_0x40af2d;_0x43b034[_0x0bc8('0x10')]=intUtil[_0x0bc8('0x45')](_0x43b034[_0x0bc8('0x10')]);_0x43b034[_0x0bc8('0x46')]=intUtil['stripTrailingSlash'](_0x43b034[_0x0bc8('0x46')]);if(_0x5ec3a0&&_0x5ec3a0[_0x0bc8('0x47')]){logger[_0x0bc8('0x16')](_0x0bc8('0x48'),_0x0bc8('0x49'));_0x36fd70['recordingURL']=util['format'](_0x0bc8('0x4a'),_0x43b034['serverUrl'],_0x36fd70[_0x0bc8('0x4b')],md5(_0x36fd70[_0x0bc8('0x4b')]));}else{_0x36fd70[_0x0bc8('0x4c')]='';}headers['Authorization']=getAuth(_0x43b034);return getUser(_0x43b034,_0x436e3b[_0x0bc8('0x4d')])[_0x0bc8('0x1b')](function(_0x1dcfa4){_0x1d6d5c=_0x1dcfa4;logger['info'](_0x0bc8('0x4e'),_0x1d6d5c['id']);return getEndUser(_0x43b034,_0x36fd70['calleridname'],_0x36fd70['calleridnum']);})[_0x0bc8('0x1b')](function(_0x22ea02){_0x40af2d=_0x22ea02;logger[_0x0bc8('0x16')](_0x0bc8('0x4f'),_0x40af2d['id']);return getTicket(_0x43b034,_0x1d6d5c,_0x40af2d,_0xda65e4,_0x36fd70);})[_0x0bc8('0x1b')](function(_0x48d9e4){if(_0x48d9e4){logger[_0x0bc8('0x16')](_0x0bc8('0x50'),_0x48d9e4['id']);switch(_0x43b034['type']){case'integrationTab':logger[_0x0bc8('0x16')]('[QUEUE]',_0x0bc8('0x51'));return request({'uri':util[_0x0bc8('0xe')](_0x0bc8('0x52'),_0x43b034[_0x0bc8('0x10')],_0x1d6d5c['id'],_0x48d9e4['id']),'method':_0x0bc8('0x11')});case _0x0bc8('0x53'):logger[_0x0bc8('0x16')](_0x0bc8('0x48'),_0x0bc8('0x54'));emit(util[_0x0bc8('0xe')]('user:%s',_0x436e3b['name']),_0x0bc8('0x55'),{'uri':util[_0x0bc8('0xe')]('%s/agent/tickets/%s',_0x43b034[_0x0bc8('0x10')][_0x0bc8('0x56')](_0x0bc8('0x57'),''),_0x48d9e4['id'])});break;default:logger[_0x0bc8('0x58')]('[QUEUE]',_0x0bc8('0x59'));}}})[_0x0bc8('0x5a')](function(_0x4ecc81){logger[_0x0bc8('0x58')](_0x0bc8('0x5b'),util['inspect'](_0x4ecc81,{'showHidden':!![],'depth':null}));});};exports[_0x0bc8('0x5c')]=function(_0x431c4c,_0xd6be1a,_0x423ab2,_0x1e1293,_0x1bd0a1,_0x3ffca2,_0x1ae708){var _0x34e669,_0x560640;_0x3ffca2[_0x0bc8('0x10')]=intUtil[_0x0bc8('0x45')](_0x3ffca2['remoteUri']);_0x3ffca2[_0x0bc8('0x46')]=intUtil[_0x0bc8('0x45')](_0x3ffca2['serverUrl']);if(_0x1ae708&&_0x1ae708[_0x0bc8('0x5d')]&&_0x1ae708['recordingFormat']!==_0x0bc8('0x5e')){logger[_0x0bc8('0x16')](_0x0bc8('0x5f'),_0x0bc8('0x49'));_0xd6be1a['recordingURL']=util[_0x0bc8('0xe')](_0x0bc8('0x4a'),_0x3ffca2[_0x0bc8('0x46')],_0xd6be1a[_0x0bc8('0x4b')],md5(_0xd6be1a[_0x0bc8('0x4b')]));}headers[_0x0bc8('0x60')]=getAuth(_0x3ffca2);return getUser(_0x3ffca2,_0x1e1293['email'])[_0x0bc8('0x1b')](function(_0x434df9){_0x34e669=_0x434df9;logger[_0x0bc8('0x16')](_0x0bc8('0x4e'),_0x34e669['id']);return getEndUser(_0x3ffca2,_0xd6be1a['destcalleridname'],_0xd6be1a['destcalleridnum']);})[_0x0bc8('0x1b')](function(_0x1b70b4){_0x560640=_0x1b70b4;logger[_0x0bc8('0x16')](_0x0bc8('0x4f'),_0x560640['id']);return getTicket(_0x3ffca2,_0x34e669,_0x560640,_0x423ab2,_0xd6be1a);})['then'](function(_0x31d828){if(_0x31d828){logger[_0x0bc8('0x16')](_0x0bc8('0x50'),_0x31d828['id']);switch(_0x3ffca2[_0x0bc8('0x61')]){case'integrationTab':logger[_0x0bc8('0x16')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x0bc8('0xe')](_0x0bc8('0x52'),_0x3ffca2['remoteUri'],_0x34e669['id'],_0x31d828['id']),'method':_0x0bc8('0x11')});case _0x0bc8('0x53'):logger[_0x0bc8('0x16')](_0x0bc8('0x5f'),_0x0bc8('0x54'));emit(util['format'](_0x0bc8('0x62'),_0x1e1293[_0x0bc8('0x43')]),_0x0bc8('0x55'),{'uri':util['format'](_0x0bc8('0x63'),_0x3ffca2['remoteUri'][_0x0bc8('0x56')](_0x0bc8('0x57'),''),_0x31d828['id'])});break;default:logger[_0x0bc8('0x58')](_0x0bc8('0x5f'),_0x0bc8('0x59'));}}})['catch'](function(_0x3b7a36){logger['error'](_0x0bc8('0x64'),util[_0x0bc8('0x65')](_0x3b7a36,{'showHidden':!![],'depth':null}));});};exports[_0x0bc8('0x66')]=function(_0x586153,_0x527bd0,_0x4a6c0a,_0x80e264,_0x5abb30,_0x198fb4){var _0x9b63ef,_0x4a2e25;_0x198fb4[_0x0bc8('0x10')]=intUtil[_0x0bc8('0x45')](_0x198fb4[_0x0bc8('0x10')]);_0x198fb4[_0x0bc8('0x46')]=intUtil[_0x0bc8('0x45')](_0x198fb4[_0x0bc8('0x46')]);if(_0x5abb30&&_0x5abb30[_0x0bc8('0x47')]){logger[_0x0bc8('0x16')]('['+_0x527bd0[_0x0bc8('0x67')]['toUpperCase']()+']',_0x0bc8('0x49'));_0x527bd0[_0x0bc8('0x4c')]=util[_0x0bc8('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x198fb4[_0x0bc8('0x46')],_0x527bd0[_0x0bc8('0x4b')],md5(_0x527bd0['uniqueid']));}else{_0x527bd0[_0x0bc8('0x4c')]='';}headers[_0x0bc8('0x60')]=getAuth(_0x198fb4);return getUser(_0x198fb4)[_0x0bc8('0x1b')](function(_0xa0ec21){_0x9b63ef=_0xa0ec21;logger[_0x0bc8('0x16')](_0x0bc8('0x4e'),_0x9b63ef['id']);return getEndUser(_0x198fb4,_0x527bd0[_0x0bc8('0x68')],_0x527bd0[_0x0bc8('0x69')]);})[_0x0bc8('0x1b')](function(_0x5ad604){_0x4a2e25=_0x5ad604;logger[_0x0bc8('0x16')](_0x0bc8('0x4f'),_0x4a2e25['id']);return getTicket(_0x198fb4,_0x9b63ef,_0x4a2e25,_0x4a6c0a,_0x527bd0);})[_0x0bc8('0x1b')](function(_0x3a0acf){if(_0x3a0acf){logger[_0x0bc8('0x16')]('The\x20Ticket\x20ID\x20is:',_0x3a0acf['id']);}})[_0x0bc8('0x5a')](function(_0x1f705a){logger[_0x0bc8('0x58')]('['+_0x527bd0[_0x0bc8('0x67')][_0x0bc8('0x6a')]()+']'+_0x0bc8('0x6b'),util['inspect'](_0x1f705a,{'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 e5fe259..9934b58 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 _0x236c=['starttime','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','serverUrl','recordingFormat','none','/api/voice/recordings/','/downloads?type=uniqueid&token=','destcalleridnum','Outbound','[OUTBOUND]','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','com','lodash','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','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.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','seconds','catch','error','stack','info','Search\x20user','GET','ActiveUsers','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','details','Error:\x20','log','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','format','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','mm:ss','lastevent','called','Call_Result','Called','Answered','rejected','Rejected','Call_Start_Time'];(function(_0x1ab806,_0x890bc4){var _0xbb964d=function(_0x2c57a2){while(--_0x2c57a2){_0x1ab806['push'](_0x1ab806['shift']());}};_0xbb964d(++_0x890bc4);}(_0x236c,0x155));var _0xc236=function(_0x1ad0c3,_0x21bdf4){_0x1ad0c3=_0x1ad0c3-0x0;var _0x43bad9=_0x236c[_0x1ad0c3];return _0x43bad9;};'use strict';var _=require(_0xc236('0x0'));var rp=require('request-promise');var md5=require(_0xc236('0x1'));var util=require(_0xc236('0x2'));var intUtil=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var Redis=require(_0xc236('0x5'));var BPromise=require('bluebird');var config=require(_0xc236('0x6'));var logger=require(_0xc236('0x7'))(_0xc236('0x8'));config[_0xc236('0x9')]=_[_0xc236('0xa')](config[_0xc236('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xc236('0xb'))(new Redis(config[_0xc236('0x9')]));function emit(_0x51a13b,_0x5bc6a2,_0x5cdee5){io['to'](_0x51a13b)[_0xc236('0xc')](_0x5bc6a2,_0x5cdee5);}function request(_0x4b8dc6){logger[_0xc236('0xd')](_0xc236('0xe'),JSON[_0xc236('0xf')](_0x4b8dc6));return rp(_0x4b8dc6);}function getCustomFields(_0x2f8b72,_0xaf651b){var _0x5bc8d8={};if(_0x2f8b72[_0xc236('0x10')]>0x0){_[_0xc236('0x11')](_0x2f8b72,function(_0x58acb0){if(_0x58acb0[_0xc236('0x12')]===_0xc236('0x13')&&_0x58acb0['idField']){_0x5bc8d8[_0x58acb0[_0xc236('0x14')]]=_0x58acb0['content']['toString']();}else if(_0x58acb0[_0xc236('0x12')]===_0xc236('0x15')&&_0x58acb0[_0xc236('0x16')]&&_0x58acb0[_0xc236('0x14')]&&_0xaf651b[_0x58acb0['variableName']]){_0x5bc8d8[_0x58acb0[_0xc236('0x14')]]=_0xaf651b[_0x58acb0['variableName']]['toString']();}else if(_0x58acb0[_0xc236('0x12')]===_0xc236('0x17')&&_0x58acb0[_0xc236('0x18')]&&_0x58acb0[_0xc236('0x18')][_0xc236('0x19')]&&_0x58acb0['idField']&&_0xaf651b[_0x58acb0['Variable']['name'][_0xc236('0x1a')]()]){_0x5bc8d8[_0x58acb0[_0xc236('0x14')]]=_0xaf651b[_0x58acb0[_0xc236('0x18')]['name'][_0xc236('0x1a')]()]['toString']();}});}return _0x5bc8d8;}function getName(_0x59e448){if(_0x59e448[_0xc236('0x1b')]('\x20')>0x0){var _0x30adeb=_0x59e448[_0xc236('0x1c')](/ (.+)/);if(_0x30adeb[0x1]){return _0x30adeb;}}return[_0x59e448,_0x59e448];}var accountsTokens={};function getAccessToken(_0x46bc69){return new Promise(function(_0x2b6d3f,_0x27c6ab){if(!_[_0xc236('0x1d')](accountsTokens[_0x46bc69['id']])&&!_[_0xc236('0x1d')](accountsTokens[_0x46bc69['id']][_0xc236('0x1e')])){if(moment()[_0xc236('0x1f')](accountsTokens[_0x46bc69['id']][_0xc236('0x20')])){_0x2b6d3f(accountsTokens[_0x46bc69['id']]['access_token']);}}var _0x208c3f;switch(_0x46bc69[_0xc236('0x21')]){case'US':_0x208c3f=_0xc236('0x22');break;case'AU':_0x208c3f=_0xc236('0x23');break;case'EU':_0x208c3f=_0xc236('0x24');break;case'IN':_0x208c3f=_0xc236('0x25');break;case'CN':_0x208c3f=_0xc236('0x26');break;default:_0x208c3f=_0xc236('0x24');break;}var _0x1d65e2={'method':_0xc236('0x27'),'uri':_0x208c3f+_0xc236('0x28'),'qs':{'refresh_token':_0x46bc69['refreshToken'],'client_id':_0x46bc69[_0xc236('0x29')],'client_secret':_0x46bc69[_0xc236('0x2a')],'grant_type':_0xc236('0x2b')},'json':!![]};return rp(_0x1d65e2)[_0xc236('0x2c')](function(_0x561da1){accountsTokens[_0x46bc69['id']]={'access_token':_0x561da1[_0xc236('0x1e')],'expires_in':moment()['add'](_0x561da1['expires_in'],_0xc236('0x2d'))};_0x2b6d3f(_0x561da1['access_token']);})[_0xc236('0x2e')](function(_0x4f753c){logger[_0xc236('0x2f')]('Failing\x20creating\x20the\x20access_token',_0x4f753c[_0xc236('0x30')]);_0x27c6ab(_0x4f753c);});});}function getUser(_0x1d144b,_0x4f5175,_0x5a61b5,_0x265c8d){logger[_0xc236('0x31')](_0xc236('0x32'));return request({'method':_0xc236('0x33'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x4f5175),'qs':{'type':_0xc236('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1d144b},'json':!![]})[_0xc236('0x2c')](function(_0x4ddc87){if(_0x4ddc87[_0xc236('0x35')]){var _0x40a6c8=-0x1;if(_['isArrayLikeObject'](_0x4ddc87['users'])){if(!_[_0xc236('0x1d')](_0x265c8d)){_0x40a6c8=_[_0xc236('0x36')](_0x4ddc87[_0xc236('0x35')],function(_0x2f64bd){return _0x2f64bd[_0xc236('0x37')]===_0x265c8d;});}if(_0x40a6c8>=0x0){logger[_0xc236('0x31')](_0xc236('0x38'));}else{logger[_0xc236('0x31')](_0xc236('0x39'));_0x40a6c8=_['findIndex'](_0x4ddc87['users'],function(_0x5c151a){return _0x5c151a[_0xc236('0x3a')][_0xc236('0x19')]===_0xc236('0x3b');});}return _0x4ddc87[_0xc236('0x35')][_0x40a6c8];}else{if(_0x4ddc87[_0xc236('0x3c')][_0xc236('0x3a')][_0xc236('0x19')]==='Administrator'){logger[_0xc236('0x31')](_0xc236('0x39'));user=_0x4ddc87[_0xc236('0x3c')];return user;}else{logger['error'](_0xc236('0x3d'),JSON[_0xc236('0xf')](_0x4ddc87));throw new Error(_0xc236('0x3e')+JSON[_0xc236('0xf')](_0x4ddc87));}}}else{logger['error'](_0xc236('0x3d'),JSON[_0xc236('0xf')](_0x4ddc87));throw new Error(_0xc236('0x3e')+JSON[_0xc236('0xf')](_0x4ddc87));}})[_0xc236('0x2e')](function(_0x1edab3){console[_0xc236('0x2f')](_0x1edab3);});}function getZohoUser(_0x11ca1c,_0x131212){return new BPromise(function(_0x1251af,_0x2bb05e){request(_0x11ca1c)[_0xc236('0x2c')](function(_0x2664ba){var _0x237193=null;if(_0x2664ba){_0x237193=_0x2664ba[_0xc236('0x3f')][0x0];_0x237193[_0xc236('0x40')]=_0x131212;}_0x1251af(_0x237193);})[_0xc236('0x2e')](function(_0x4f5490){_0x2bb05e(_0x4f5490);});});}function createEndUser(_0x5606b0,_0x54225a,_0x4c5a50,_0x369a79,_0x5c4739,_0x35905c){var _0x4c5a50=getName(_0x4c5a50);return request({'method':_0xc236('0x27'),'uri':_0xc236('0x41')+_0x54225a+_0xc236('0x42')+_[_0xc236('0x43')](_0x35905c[_0xc236('0x44')])+'s','body':{'data':[{'Last_Name':_0x4c5a50[0x1],'First_Name':_0x4c5a50[0x0],'Phone':_0x369a79,'Owner':{'name':!_[_0xc236('0x1d')](_0x5c4739[_0xc236('0x45')][_0xc236('0x19')])?_0x5c4739[_0xc236('0x45')][_0xc236('0x19')]:!_[_0xc236('0x1d')](_0x5c4739[_0xc236('0x46')])?_0x5c4739[_0xc236('0x46')]+'\x20'+_0x5c4739['last_name']:_0x5c4739[_0xc236('0x47')],'id':_0x5c4739['id']}}]},'headers':{'Authorization':_0xc236('0x48')+_0x5606b0},'json':!![]})['then'](function(_0xb90a83){if(_0xb90a83&&_0xb90a83['data'][0x0][_0xc236('0x49')]==='SUCCESS'){var _0x30f391=_0xb90a83[_0xc236('0x3f')][0x0][_0xc236('0x4a')];_0x30f391['enduserType']=_[_0xc236('0x43')](_0x35905c[_0xc236('0x44')])+'s';return _0x30f391;}logger[_0xc236('0x2f')]('The\x20failing\x20result\x20is',JSON[_0xc236('0xf')](data));throw new Error(_0xc236('0x4b')+JSON[_0xc236('0xf')](data));})[_0xc236('0x2e')](function(_0xc35ef9){console[_0xc236('0x4c')]('CREATE\x20ERROR',_0xc35ef9);});}function getEndUser(_0x359f21,_0x543aa8,_0x382a72,_0x3f1965,_0x21b7ff,_0x2bd744,_0x3cf9f8){var _0xcd341c={'method':_0xc236('0x33'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x359f21},'json':!![]};switch(_0x3cf9f8[_0xc236('0x4d')]){case'contact_lead':_0xcd341c[_0xc236('0x4e')]=_0xc236('0x41')+_0x543aa8+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x21b7ff+'))';return getZohoUser(_0xcd341c,_0xc236('0x4f'))[_0xc236('0x2c')](function(_0x3c1c5c){if(_0x3c1c5c)return _0x3c1c5c;_0xcd341c[_0xc236('0x4e')]=_0xc236('0x41')+_0x543aa8+_0xc236('0x50')+_0x21b7ff+'))';return getZohoUser(_0xcd341c,_0xc236('0x51'))['then'](function(_0x50dd50){if(_0x50dd50)return _0x50dd50;if(_0x3cf9f8[_0xc236('0x44')]!=_0xc236('0x52')){return createEndUser(_0x359f21,_0x543aa8,_0x3f1965,_0x21b7ff,_0x2bd744,_0x3cf9f8);}else{return{};}});});break;case'contact':_0xcd341c[_0xc236('0x4e')]=_0xc236('0x41')+_0x543aa8+_0xc236('0x53')+_0x21b7ff+'))';return getZohoUser(_0xcd341c,_0xc236('0x4f'))[_0xc236('0x2c')](function(_0x1683f4){if(_0x1683f4)return _0x1683f4;if(_0x3cf9f8[_0xc236('0x44')]!=_0xc236('0x52')){return createEndUser(_0x359f21,_0x543aa8,_0x3f1965,_0x21b7ff,_0x2bd744,_0x3cf9f8);}else{return{};}});break;case _0xc236('0x54'):_0xcd341c['uri']=_0xc236('0x41')+_0x543aa8+_0xc236('0x50')+_0x21b7ff+'))';return getZohoUser(_0xcd341c,_0xc236('0x51'))[_0xc236('0x2c')](function(_0x172e66){if(_0x172e66)return _0x172e66;if(_0x3cf9f8[_0xc236('0x44')]!=_0xc236('0x52')){return createEndUser(_0x359f21,_0x543aa8,_0x3f1965,_0x21b7ff,_0x2bd744,_0x3cf9f8);}else{return{};}});break;}}function getCall(_0x53724f,_0x18d7e1,_0x3788ff,_0x17c86b,_0x16ff63,_0x4860d8,_0xa34c01,_0x3e6da6){logger[_0xc236('0x31')](_0xc236('0x55'));var _0x9d81c8={};_0x9d81c8['Owner']={'name':!_[_0xc236('0x1d')](_0x17c86b['role'][_0xc236('0x19')])&&!_[_0xc236('0x1d')](_0x17c86b[_0xc236('0x3a')][_0xc236('0x19')])&&_0x17c86b[_0xc236('0x3a')]['name']==='administrator'?_0x17c86b[_0xc236('0x45')][_0xc236('0x19')]:!_[_0xc236('0x1d')](_0x17c86b[_0xc236('0x46')])?_0x17c86b[_0xc236('0x46')]+'\x20'+_0x17c86b[_0xc236('0x47')]:_0x17c86b[_0xc236('0x47')],'id':_0x17c86b['id']};_0x9d81c8[_0xc236('0x56')]=intUtil[_0xc236('0x57')](_0x4860d8[_0xc236('0x58')],_0xa34c01,'\x20');_0x9d81c8['Description']=intUtil['getString'](_0x4860d8[_0xc236('0x59')],_0xa34c01,'\x0a');if(_0x16ff63[_0xc236('0x40')]===_0xc236('0x4f')){_0x9d81c8[_0xc236('0x5a')]={'name':!_['isNil'](_0x16ff63[_0xc236('0x5b')])?_0x16ff63[_0xc236('0x5b')]:!_['isNil'](_0x16ff63[_0xc236('0x5c')])?_0x16ff63[_0xc236('0x5c')]+'\x20'+_0x16ff63[_0xc236('0x5d')]:_0x16ff63[_0xc236('0x5d')],'id':_0x16ff63['id']};}if(_0x16ff63['enduserType']===_0xc236('0x51')){_0x9d81c8[_0xc236('0x5e')]={'name':!_[_0xc236('0x1d')](_0x16ff63[_0xc236('0x5b')])?_0x16ff63[_0xc236('0x5b')]:!_[_0xc236('0x1d')](_0x16ff63[_0xc236('0x5c')])?_0x16ff63['First_Name']+'\x20'+_0x16ff63[_0xc236('0x5d')]:_0x16ff63['Last_Name'],'id':_0x16ff63['id']};_0x9d81c8[_0xc236('0x5f')]=_[_0xc236('0x43')](_0x16ff63[_0xc236('0x40')]);}if(_0xa34c01[_0xc236('0x60')]){_0x9d81c8['Call_Duration']=moment[_0xc236('0x61')](parseInt(_0xa34c01[_0xc236('0x60')])*0x3e8)[_0xc236('0x62')]('mm:ss');}else if(_0xa34c01[_0xc236('0x63')]&&_0xa34c01[_0xc236('0x64')]){_0x9d81c8[_0xc236('0x65')]=moment[_0xc236('0x61')](moment(_0xa34c01[_0xc236('0x64')],_0xc236('0x66'))['diff'](moment(_0xa34c01['starttime'],_0xc236('0x66'))))[_0xc236('0x62')](_0xc236('0x67'));}switch(_0xa34c01[_0xc236('0x68')]){case _0xc236('0x69'):_0x9d81c8[_0xc236('0x6a')]=_0xc236('0x6b');break;case'complete':case'connect':_0x9d81c8['Call_Result']=_0xc236('0x6c');break;case _0xc236('0x6d'):_0x9d81c8[_0xc236('0x6a')]=_0xc236('0x6e');break;case'abandoned':_0x9d81c8['Call_Result']='Abandoned';break;case'timeout':_0x9d81c8[_0xc236('0x6a')]='Timeout';default:}_0x9d81c8[_0xc236('0x6f')]=(_0x3e6da6==='outbound'?moment(_0xa34c01[_0xc236('0x70')])[_0xc236('0x62')](_0xc236('0x66')):moment(_0xa34c01[_0xc236('0x71')])[_0xc236('0x62')](_0xc236('0x66')))||moment()[_0xc236('0x62')]('YYYY-MM-DDTHH:mm:ss');_0x9d81c8[_0xc236('0x72')]=_0x3e6da6||'Inbound';_0x9d81c8=_[_0xc236('0x73')](_0x9d81c8,getCustomFields(_0x4860d8[_0xc236('0x74')],_0xa34c01));return request({'method':_0xc236('0x27'),'uri':_0xc236('0x41')+_0x18d7e1+_0xc236('0x75'),'headers':{'Authorization':_0xc236('0x48')+_0x53724f},'body':{'data':[_0x9d81c8]},'json':!![]})['then'](function(_0x17113a){if(_0x17113a&&_0x17113a[_0xc236('0x3f')][0x0]['code']===_0xc236('0x76')){logger[_0xc236('0x31')](_0xc236('0x77'));return{'id':_0x17113a['data'][0x0][_0xc236('0x4a')]['id']};}})[_0xc236('0x2e')](function(_0x5897a1){logger[_0xc236('0x31')](_0xc236('0x78'),_0x5897a1[_0xc236('0x30')]);console[_0xc236('0x4c')](_0xc236('0x78'),_0x5897a1);});}exports[_0xc236('0x79')]=function(_0x26b8a8,_0x2e7a06,_0x3de937,_0x5d627d,_0x35922d,_0x2b9fd8){var _0x205e26,_0x5d395b,_0x44f9bf;_0x2b9fd8[_0xc236('0x7a')]=intUtil[_0xc236('0x7b')](_0x2b9fd8[_0xc236('0x7a')]);_0x2b9fd8['serverUrl']=intUtil[_0xc236('0x7b')](_0x2b9fd8['serverUrl']);if(_0x35922d&&_0x35922d[_0xc236('0x7c')]){logger['info'](_0xc236('0x7d'),_0xc236('0x7e'));_0x2e7a06['recordingURL']=_0x2b9fd8['serverUrl']+'/api/voice/recordings/'+_0x2e7a06[_0xc236('0x7f')]+'/downloads?type=uniqueid&token='+md5(_0x2e7a06[_0xc236('0x7f')]);}else{_0x2e7a06[_0xc236('0x80')]='';}var _0x4be322=_0x2b9fd8[_0xc236('0x7a')]===_0xc236('0x81')?'eu':'com';return getAccessToken(_0x2b9fd8)[_0xc236('0x2c')](function(_0x2181aa){_0x44f9bf=_0x2181aa;return getUser(_0x44f9bf,_0x4be322,_0x2b9fd8,_0x5d627d[_0xc236('0x37')]);})[_0xc236('0x2c')](function(_0x511858){_0x205e26=_0x511858;logger[_0xc236('0x31')](_0xc236('0x82'),_0x205e26['id']);return getEndUser(_0x44f9bf,_0x4be322,_0x2b9fd8,_0x2e7a06[_0xc236('0x83')],_0x2e7a06[_0xc236('0x84')],_0x205e26,_0x3de937);})[_0xc236('0x2c')](function(_0x8b7651){_0x5d395b=_0x8b7651;return getCall(_0x44f9bf,_0x4be322,_0x2b9fd8,_0x205e26,_0x5d395b,_0x3de937,_0x2e7a06,_0xc236('0x85'));})['then'](function(_0x5b720c){if(_0x5b720c){logger[_0xc236('0x31')](_0xc236('0x86'),_0x5b720c['id']);logger[_0xc236('0x31')](_0xc236('0x7d'),_0xc236('0x87'));emit(util[_0xc236('0x62')](_0xc236('0x88'),_0x5d627d[_0xc236('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x2b9fd8[_0xc236('0x7a')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5b720c['id']});}})[_0xc236('0x2e')](function(_0x1c4835){logger[_0xc236('0x2f')]('[QUEUE]',JSON[_0xc236('0xf')](_0x1c4835));});};exports['outbound']=function(_0x239f37,_0x411559,_0x39be39,_0x3766a9,_0x48cf03,_0x41c76d,_0x22b942){var _0x59c80f,_0x41478d,_0x237209;_0x41c76d[_0xc236('0x7a')]=intUtil[_0xc236('0x7b')](_0x41c76d[_0xc236('0x7a')]);_0x41c76d[_0xc236('0x89')]=intUtil[_0xc236('0x7b')](_0x41c76d['serverUrl']);if(_0x22b942&&_0x22b942[_0xc236('0x8a')]&&_0x22b942[_0xc236('0x8a')]!==_0xc236('0x8b')){logger[_0xc236('0x31')]('[OUTBOUND]',_0xc236('0x7e'));_0x411559[_0xc236('0x80')]=_0x41c76d['serverUrl']+_0xc236('0x8c')+_0x411559['uniqueid']+_0xc236('0x8d')+md5(_0x411559[_0xc236('0x7f')]);}var _0x5e6274=_0x41c76d[_0xc236('0x7a')]===_0xc236('0x81')?'eu':'com';return getAccessToken(_0x41c76d)['then'](function(_0x2a9308){_0x237209=_0x2a9308;return getUser(_0x237209,_0x5e6274,_0x41c76d,_0x3766a9[_0xc236('0x37')]);})[_0xc236('0x2c')](function(_0x4b2050){_0x59c80f=_0x4b2050;logger[_0xc236('0x31')](_0xc236('0x82'),_0x59c80f['id']);return getEndUser(_0x237209,_0x5e6274,_0x41c76d,_0x411559['destcalleridname'],_0x411559[_0xc236('0x8e')],_0x59c80f,_0x39be39);})[_0xc236('0x2c')](function(_0x413d88){_0x41478d=_0x413d88;return getCall(_0x237209,_0x5e6274,_0x41c76d,_0x59c80f,_0x41478d,_0x39be39,_0x411559,_0xc236('0x8f'));})['then'](function(_0x149eeb){if(_0x149eeb){logger[_0xc236('0x31')](_0xc236('0x86'),_0x149eeb['id']);logger[_0xc236('0x31')](_0xc236('0x90'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xc236('0x88'),_0x3766a9['name']),_0xc236('0x91'),{'uri':_0xc236('0x92')+_0x41c76d[_0xc236('0x7a')]+_0xc236('0x93')+_0x149eeb['id']});}})['catch'](function(_0x94aac2){logger['error'](_0xc236('0x90'),JSON['stringify'](_0x94aac2));});};exports[_0xc236('0x94')]=function(_0x400353,_0x3ede1c,_0x461341,_0x21a24b,_0x3f4feb,_0x45cc00){var _0x1c9f87,_0x21da06,_0x577ace;_0x45cc00['host']=intUtil[_0xc236('0x7b')](_0x45cc00[_0xc236('0x7a')]);_0x45cc00[_0xc236('0x89')]=intUtil[_0xc236('0x7b')](_0x45cc00[_0xc236('0x89')]);if(_0x3f4feb&&_0x3f4feb[_0xc236('0x7c')]){logger['info']('['+_0x3ede1c[_0xc236('0x68')][_0xc236('0x95')]()+']',_0xc236('0x7e'));_0x3ede1c[_0xc236('0x80')]=_0x45cc00[_0xc236('0x89')]+_0xc236('0x8c')+_0x3ede1c[_0xc236('0x7f')]+_0xc236('0x8d')+md5(_0x3ede1c[_0xc236('0x7f')]);}else{_0x3ede1c[_0xc236('0x80')]='';}var _0x44652e=_0x45cc00[_0xc236('0x7a')]===_0xc236('0x81')?'eu':_0xc236('0x96');return getAccessToken(_0x45cc00)[_0xc236('0x2c')](function(_0x486a2a){_0x577ace=_0x486a2a;return getUser(_0x577ace,_0x44652e,_0x45cc00);})[_0xc236('0x2c')](function(_0x767d7b){_0x1c9f87=_0x767d7b;logger[_0xc236('0x31')](_0xc236('0x82'),_0x1c9f87['id']);return getEndUser(_0x577ace,_0x44652e,_0x45cc00,_0x3ede1c[_0xc236('0x83')],_0x3ede1c['calleridnum'],_0x1c9f87,_0x461341);})[_0xc236('0x2c')](function(_0x7bbb2c){_0x21da06=_0x7bbb2c;return getCall(_0x577ace,_0x44652e,_0x45cc00,_0x1c9f87,_0x21da06,_0x461341,_0x3ede1c,_0xc236('0x85'));})['then'](function(_0x42633c){if(_0x42633c){logger['info']('The\x20Call\x20ID\x20is:',_0x42633c['id']);}})[_0xc236('0x2e')](function(_0x436845){logger[_0xc236('0x2f')]('['+_0x3ede1c[_0xc236('0x68')][_0xc236('0x95')]()+']',JSON['stringify'](_0x436845));});}; \ No newline at end of file +var _0x69d4=['variableName','customVariable','Variable','name','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','expires_in','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','/crm/v2/','startCase','moduleCreate','role','last_name','code','details','enduserType','The\x20failing\x20result\x20is','Error:\x20','log','contact_lead','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','lead','nothing','first_name','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','format','mm:ss','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','zoho.eu','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','user:%s','unmanaged','calleridnum','toUpperCase','lodash','request-promise','util','./util','moment','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','emit','stringify','length','forEach','idField','content','toString','type','variable'];(function(_0x18ea99,_0x5d0dc6){var _0x4e1a63=function(_0x560366){while(--_0x560366){_0x18ea99['push'](_0x18ea99['shift']());}};_0x4e1a63(++_0x5d0dc6);}(_0x69d4,0x83));var _0x469d=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0x69d4[_0x352d28];return _0x387d7e;};'use strict';var _=require(_0x469d('0x0'));var rp=require(_0x469d('0x1'));var md5=require('md5');var util=require(_0x469d('0x2'));var intUtil=require(_0x469d('0x3'));var moment=require(_0x469d('0x4'));var Redis=require('ioredis');var BPromise=require(_0x469d('0x5'));var config=require('../../../../config/environment');var logger=require(_0x469d('0x6'))(_0x469d('0x7'));config[_0x469d('0x8')]=_[_0x469d('0x9')](config[_0x469d('0x8')],{'host':_0x469d('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x469d('0x8')]));function emit(_0x486595,_0x37ee05,_0x2598f1){io['to'](_0x486595)[_0x469d('0xb')](_0x37ee05,_0x2598f1);}function request(_0x5f05c9){logger['debug']('[HTTP]',JSON[_0x469d('0xc')](_0x5f05c9));return rp(_0x5f05c9);}function getCustomFields(_0x1c2d63,_0x5ca9c6){var _0xb3a199={};if(_0x1c2d63[_0x469d('0xd')]>0x0){_[_0x469d('0xe')](_0x1c2d63,function(_0x560490){if(_0x560490['type']==='string'&&_0x560490[_0x469d('0xf')]){_0xb3a199[_0x560490[_0x469d('0xf')]]=_0x560490[_0x469d('0x10')][_0x469d('0x11')]();}else if(_0x560490[_0x469d('0x12')]===_0x469d('0x13')&&_0x560490[_0x469d('0x14')]&&_0x560490['idField']&&_0x5ca9c6[_0x560490[_0x469d('0x14')]]){_0xb3a199[_0x560490[_0x469d('0xf')]]=_0x5ca9c6[_0x560490[_0x469d('0x14')]][_0x469d('0x11')]();}else if(_0x560490['type']===_0x469d('0x15')&&_0x560490[_0x469d('0x16')]&&_0x560490[_0x469d('0x16')]['name']&&_0x560490[_0x469d('0xf')]&&_0x5ca9c6[_0x560490[_0x469d('0x16')][_0x469d('0x17')]['toLowerCase']()]){_0xb3a199[_0x560490[_0x469d('0xf')]]=_0x5ca9c6[_0x560490['Variable']['name']['toLowerCase']()][_0x469d('0x11')]();}});}return _0xb3a199;}function getName(_0x47e41d){if(_0x47e41d[_0x469d('0x18')]('\x20')>0x0){var _0x478fa4=_0x47e41d[_0x469d('0x19')](/ (.+)/);if(_0x478fa4[0x1]){return _0x478fa4;}}return[_0x47e41d,_0x47e41d];}var accountsTokens={};function getAccessToken(_0x38c3cc){return new Promise(function(_0x40d2ea,_0x1573b5){if(!_['isNil'](accountsTokens[_0x38c3cc['id']])&&!_[_0x469d('0x1a')](accountsTokens[_0x38c3cc['id']][_0x469d('0x1b')])){if(moment()[_0x469d('0x1c')](accountsTokens[_0x38c3cc['id']]['expires_in'])){_0x40d2ea(accountsTokens[_0x38c3cc['id']][_0x469d('0x1b')]);}}var _0x232a34;switch(_0x38c3cc[_0x469d('0x1d')]){case'US':_0x232a34='https://accounts.zoho.com';break;case'AU':_0x232a34=_0x469d('0x1e');break;case'EU':_0x232a34='https://accounts.zoho.eu';break;case'IN':_0x232a34=_0x469d('0x1f');break;case'CN':_0x232a34=_0x469d('0x20');break;default:_0x232a34='https://accounts.zoho.eu';break;}var _0x102268={'method':_0x469d('0x21'),'uri':_0x232a34+_0x469d('0x22'),'qs':{'refresh_token':_0x38c3cc[_0x469d('0x23')],'client_id':_0x38c3cc[_0x469d('0x24')],'client_secret':_0x38c3cc[_0x469d('0x25')],'grant_type':_0x469d('0x26')},'json':!![]};return rp(_0x102268)[_0x469d('0x27')](function(_0x1ae6cd){accountsTokens[_0x38c3cc['id']]={'access_token':_0x1ae6cd[_0x469d('0x1b')],'expires_in':moment()['add'](_0x1ae6cd[_0x469d('0x28')],_0x469d('0x29'))};_0x40d2ea(_0x1ae6cd[_0x469d('0x1b')]);})['catch'](function(_0x23da4d){logger[_0x469d('0x2a')](_0x469d('0x2b'),_0x23da4d[_0x469d('0x2c')]);_0x1573b5(_0x23da4d);});});}function getUser(_0x598109,_0x4fbd91,_0x3565f2,_0x4137d2){logger[_0x469d('0x2d')](_0x469d('0x2e'));return request({'method':_0x469d('0x2f'),'uri':util['format'](_0x469d('0x30'),_0x4fbd91),'qs':{'type':_0x469d('0x31')},'headers':{'Authorization':_0x469d('0x32')+_0x598109},'json':!![]})['then'](function(_0x1eceef){if(_0x1eceef[_0x469d('0x33')]){var _0xb58f3c=-0x1;if(_[_0x469d('0x34')](_0x1eceef[_0x469d('0x33')])){if(!_[_0x469d('0x1a')](_0x4137d2)){_0xb58f3c=_[_0x469d('0x35')](_0x1eceef['users'],function(_0x480357){return _0x480357['email']===_0x4137d2;});}if(_0xb58f3c>=0x0){logger['info'](_0x469d('0x36'));}else{logger[_0x469d('0x2d')](_0x469d('0x37'));_0xb58f3c=_[_0x469d('0x35')](_0x1eceef['users'],function(_0xdebe00){return _0xdebe00['profile']['name']===_0x469d('0x38');});}return _0x1eceef[_0x469d('0x33')][_0xb58f3c];}else{if(_0x1eceef[_0x469d('0x39')][_0x469d('0x3a')][_0x469d('0x17')]===_0x469d('0x38')){logger[_0x469d('0x2d')]('Using\x20the\x20admin\x20account!');user=_0x1eceef['user'];return user;}else{logger[_0x469d('0x2a')]('The\x20failing\x20result\x20is',JSON[_0x469d('0xc')](_0x1eceef));throw new Error(_0x469d('0x3b')+JSON[_0x469d('0xc')](_0x1eceef));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x469d('0xc')](_0x1eceef));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x469d('0xc')](_0x1eceef));}})[_0x469d('0x3c')](function(_0x46514c){console[_0x469d('0x2a')](_0x46514c);});}function getZohoUser(_0x1ae6a0,_0x475ecb){return new BPromise(function(_0x732be1,_0x32507c){request(_0x1ae6a0)[_0x469d('0x27')](function(_0x4b3a81){var _0x2fb182=null;if(_0x4b3a81){_0x2fb182=_0x4b3a81[_0x469d('0x3d')][0x0];_0x2fb182['enduserType']=_0x475ecb;}_0x732be1(_0x2fb182);})[_0x469d('0x3c')](function(_0x533074){_0x32507c(_0x533074);});});}function createEndUser(_0x204ba1,_0x4a8069,_0x37bc2c,_0xaf2d85,_0x2f04d4,_0x1902e2){var _0x37bc2c=getName(_0x37bc2c);return request({'method':_0x469d('0x21'),'uri':'https://www.zohoapis.'+_0x4a8069+_0x469d('0x3e')+_[_0x469d('0x3f')](_0x1902e2[_0x469d('0x40')])+'s','body':{'data':[{'Last_Name':_0x37bc2c[0x1],'First_Name':_0x37bc2c[0x0],'Phone':_0xaf2d85,'Owner':{'name':!_[_0x469d('0x1a')](_0x2f04d4[_0x469d('0x41')][_0x469d('0x17')])?_0x2f04d4[_0x469d('0x41')][_0x469d('0x17')]:!_['isNil'](_0x2f04d4['first_name'])?_0x2f04d4['first_name']+'\x20'+_0x2f04d4[_0x469d('0x42')]:_0x2f04d4[_0x469d('0x42')],'id':_0x2f04d4['id']}}]},'headers':{'Authorization':_0x469d('0x32')+_0x204ba1},'json':!![]})[_0x469d('0x27')](function(_0x37076f){if(_0x37076f&&_0x37076f[_0x469d('0x3d')][0x0][_0x469d('0x43')]==='SUCCESS'){var _0xf371be=_0x37076f['data'][0x0][_0x469d('0x44')];_0xf371be[_0x469d('0x45')]=_['startCase'](_0x1902e2[_0x469d('0x40')])+'s';return _0xf371be;}logger['error'](_0x469d('0x46'),JSON[_0x469d('0xc')](data));throw new Error(_0x469d('0x47')+JSON[_0x469d('0xc')](data));})[_0x469d('0x3c')](function(_0x46c4c8){console[_0x469d('0x48')]('CREATE\x20ERROR',_0x46c4c8);});}function getEndUser(_0x5f1c63,_0x33f1ce,_0x470c16,_0x3a8315,_0x42d452,_0x54b7d2,_0x579bf5){var _0x3d0340={'method':_0x469d('0x2f'),'uri':'','headers':{'Authorization':_0x469d('0x32')+_0x5f1c63},'json':!![]};switch(_0x579bf5['moduleSearch']){case _0x469d('0x49'):_0x3d0340['uri']=_0x469d('0x4a')+_0x33f1ce+_0x469d('0x4b')+_0x42d452+'))';return getZohoUser(_0x3d0340,_0x469d('0x4c'))[_0x469d('0x27')](function(_0x463e18){if(_0x463e18)return _0x463e18;_0x3d0340[_0x469d('0x4d')]=_0x469d('0x4a')+_0x33f1ce+_0x469d('0x4e')+_0x42d452+'))';return getZohoUser(_0x3d0340,_0x469d('0x4f'))[_0x469d('0x27')](function(_0x1253f2){if(_0x1253f2)return _0x1253f2;if(_0x579bf5[_0x469d('0x40')]!='nothing'){return createEndUser(_0x5f1c63,_0x33f1ce,_0x3a8315,_0x42d452,_0x54b7d2,_0x579bf5);}else{return{};}});});break;case _0x469d('0x50'):_0x3d0340[_0x469d('0x4d')]='https://www.zohoapis.'+_0x33f1ce+_0x469d('0x4b')+_0x42d452+'))';return getZohoUser(_0x3d0340,_0x469d('0x4c'))['then'](function(_0x53044b){if(_0x53044b)return _0x53044b;if(_0x579bf5[_0x469d('0x40')]!='nothing'){return createEndUser(_0x5f1c63,_0x33f1ce,_0x3a8315,_0x42d452,_0x54b7d2,_0x579bf5);}else{return{};}});break;case _0x469d('0x51'):_0x3d0340[_0x469d('0x4d')]=_0x469d('0x4a')+_0x33f1ce+_0x469d('0x4e')+_0x42d452+'))';return getZohoUser(_0x3d0340,'Leads')['then'](function(_0x4c7eac){if(_0x4c7eac)return _0x4c7eac;if(_0x579bf5['moduleCreate']!=_0x469d('0x52')){return createEndUser(_0x5f1c63,_0x33f1ce,_0x3a8315,_0x42d452,_0x54b7d2,_0x579bf5);}else{return{};}});break;}}function getCall(_0x14a289,_0x2d3533,_0x3d7f11,_0x14be6f,_0x476d47,_0x3ad32a,_0x1d6c01,_0x5e0950){logger[_0x469d('0x2d')]('Creating\x20new\x20call...');var _0x44a9c5={};_0x44a9c5['Owner']={'name':!_[_0x469d('0x1a')](_0x14be6f[_0x469d('0x41')]['name'])&&!_['isNil'](_0x14be6f[_0x469d('0x3a')][_0x469d('0x17')])&&_0x14be6f[_0x469d('0x3a')]['name']==='administrator'?_0x14be6f['role'][_0x469d('0x17')]:!_['isNil'](_0x14be6f['first_name'])?_0x14be6f[_0x469d('0x53')]+'\x20'+_0x14be6f[_0x469d('0x42')]:_0x14be6f['last_name'],'id':_0x14be6f['id']};_0x44a9c5[_0x469d('0x54')]=intUtil[_0x469d('0x55')](_0x3ad32a[_0x469d('0x56')],_0x1d6c01,'\x20');_0x44a9c5[_0x469d('0x57')]=intUtil[_0x469d('0x55')](_0x3ad32a['Descriptions'],_0x1d6c01,'\x0a');if(_0x476d47[_0x469d('0x45')]==='Contacts'){_0x44a9c5[_0x469d('0x58')]={'name':!_[_0x469d('0x1a')](_0x476d47[_0x469d('0x59')])?_0x476d47['Full_Name']:!_[_0x469d('0x1a')](_0x476d47[_0x469d('0x5a')])?_0x476d47[_0x469d('0x5a')]+'\x20'+_0x476d47[_0x469d('0x5b')]:_0x476d47[_0x469d('0x5b')],'id':_0x476d47['id']};}if(_0x476d47[_0x469d('0x45')]===_0x469d('0x4f')){_0x44a9c5[_0x469d('0x5c')]={'name':!_[_0x469d('0x1a')](_0x476d47[_0x469d('0x59')])?_0x476d47[_0x469d('0x59')]:!_[_0x469d('0x1a')](_0x476d47[_0x469d('0x5a')])?_0x476d47['First_Name']+'\x20'+_0x476d47['Last_Name']:_0x476d47[_0x469d('0x5b')],'id':_0x476d47['id']};_0x44a9c5[_0x469d('0x5d')]=_[_0x469d('0x3f')](_0x476d47[_0x469d('0x45')]);}if(_0x1d6c01[_0x469d('0x5e')]){_0x44a9c5['Call_Duration']=moment[_0x469d('0x5f')](parseInt(_0x1d6c01[_0x469d('0x5e')])*0x3e8)[_0x469d('0x60')](_0x469d('0x61'));}else if(_0x1d6c01['answertime']&&_0x1d6c01[_0x469d('0x62')]){_0x44a9c5[_0x469d('0x63')]=moment['utc'](moment(_0x1d6c01['endtime'],_0x469d('0x64'))[_0x469d('0x65')](moment(_0x1d6c01[_0x469d('0x66')],_0x469d('0x64'))))['format'](_0x469d('0x61'));}switch(_0x1d6c01[_0x469d('0x67')]){case _0x469d('0x68'):_0x44a9c5[_0x469d('0x69')]='Called';break;case _0x469d('0x6a'):case'connect':_0x44a9c5[_0x469d('0x69')]='Answered';break;case _0x469d('0x6b'):_0x44a9c5[_0x469d('0x69')]=_0x469d('0x6c');break;case _0x469d('0x6d'):_0x44a9c5[_0x469d('0x69')]=_0x469d('0x6e');break;case _0x469d('0x6f'):_0x44a9c5[_0x469d('0x69')]=_0x469d('0x70');default:}_0x44a9c5['Call_Start_Time']=(_0x5e0950===_0x469d('0x71')?moment(_0x1d6c01[_0x469d('0x66')])[_0x469d('0x60')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x1d6c01['agentcalledAt'])[_0x469d('0x60')](_0x469d('0x64')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x44a9c5['Call_Type']=_0x5e0950||_0x469d('0x72');_0x44a9c5=_[_0x469d('0x73')](_0x44a9c5,getCustomFields(_0x3ad32a[_0x469d('0x74')],_0x1d6c01));return request({'method':_0x469d('0x21'),'uri':'https://www.zohoapis.'+_0x2d3533+_0x469d('0x75'),'headers':{'Authorization':_0x469d('0x32')+_0x14a289},'body':{'data':[_0x44a9c5]},'json':!![]})[_0x469d('0x27')](function(_0x5e45a4){if(_0x5e45a4&&_0x5e45a4[_0x469d('0x3d')][0x0]['code']===_0x469d('0x76')){logger[_0x469d('0x2d')](_0x469d('0x77'));return{'id':_0x5e45a4[_0x469d('0x3d')][0x0]['details']['id']};}})[_0x469d('0x3c')](function(_0x1b092a){logger[_0x469d('0x2d')](_0x469d('0x78'),_0x1b092a[_0x469d('0x2c')]);console['log'](_0x469d('0x78'),_0x1b092a);});}exports[_0x469d('0x79')]=function(_0x54c0d8,_0x52f125,_0x3f3142,_0x2c5a43,_0x24320d,_0x5f132c){var _0x29810d,_0x1a2425,_0x34fcc3;_0x5f132c[_0x469d('0x7a')]=intUtil[_0x469d('0x7b')](_0x5f132c[_0x469d('0x7a')]);_0x5f132c[_0x469d('0x7c')]=intUtil[_0x469d('0x7b')](_0x5f132c['serverUrl']);if(_0x24320d&&_0x24320d[_0x469d('0x7d')]){logger[_0x469d('0x2d')](_0x469d('0x7e'),_0x469d('0x7f'));_0x52f125[_0x469d('0x80')]=_0x5f132c['serverUrl']+_0x469d('0x81')+_0x52f125[_0x469d('0x82')]+_0x469d('0x83')+md5(_0x52f125[_0x469d('0x82')]);}else{_0x52f125[_0x469d('0x80')]='';}var _0x5a0321=_0x5f132c[_0x469d('0x7a')]==='zoho.eu'?'eu':_0x469d('0x84');return getAccessToken(_0x5f132c)[_0x469d('0x27')](function(_0x334bc2){_0x34fcc3=_0x334bc2;return getUser(_0x34fcc3,_0x5a0321,_0x5f132c,_0x2c5a43['email']);})[_0x469d('0x27')](function(_0xcdfc41){_0x29810d=_0xcdfc41;logger[_0x469d('0x2d')]('The\x20User\x20ID\x20is:',_0x29810d['id']);return getEndUser(_0x34fcc3,_0x5a0321,_0x5f132c,_0x52f125[_0x469d('0x85')],_0x52f125['calleridnum'],_0x29810d,_0x3f3142);})[_0x469d('0x27')](function(_0x3460fd){_0x1a2425=_0x3460fd;return getCall(_0x34fcc3,_0x5a0321,_0x5f132c,_0x29810d,_0x1a2425,_0x3f3142,_0x52f125,_0x469d('0x72'));})[_0x469d('0x27')](function(_0x182d52){if(_0x182d52){logger[_0x469d('0x2d')]('The\x20Call\x20ID\x20is:',_0x182d52['id']);logger['info']('[QUEUE]',_0x469d('0x86'));emit(util['format']('user:%s',_0x2c5a43[_0x469d('0x17')]),_0x469d('0x87'),{'uri':_0x469d('0x88')+_0x5f132c[_0x469d('0x7a')]+_0x469d('0x89')+_0x182d52['id']});}})[_0x469d('0x3c')](function(_0x4f7b12){logger[_0x469d('0x2a')](_0x469d('0x7e'),JSON[_0x469d('0xc')](_0x4f7b12));});};exports[_0x469d('0x71')]=function(_0x3f2258,_0x2f1b27,_0x2fc656,_0x3fee91,_0x2a32f9,_0x113627,_0x204f5e){var _0x3d385c,_0x5ea50d,_0xdec76e;_0x113627[_0x469d('0x7a')]=intUtil[_0x469d('0x7b')](_0x113627[_0x469d('0x7a')]);_0x113627[_0x469d('0x7c')]=intUtil[_0x469d('0x7b')](_0x113627['serverUrl']);if(_0x204f5e&&_0x204f5e[_0x469d('0x8a')]&&_0x204f5e['recordingFormat']!=='none'){logger[_0x469d('0x2d')](_0x469d('0x8b'),_0x469d('0x7f'));_0x2f1b27[_0x469d('0x80')]=_0x113627[_0x469d('0x7c')]+_0x469d('0x81')+_0x2f1b27['uniqueid']+_0x469d('0x83')+md5(_0x2f1b27[_0x469d('0x82')]);}var _0x216310=_0x113627[_0x469d('0x7a')]===_0x469d('0x8c')?'eu':'com';return getAccessToken(_0x113627)['then'](function(_0x1ea369){_0xdec76e=_0x1ea369;return getUser(_0xdec76e,_0x216310,_0x113627,_0x3fee91[_0x469d('0x8d')]);})[_0x469d('0x27')](function(_0x4a46d1){_0x3d385c=_0x4a46d1;logger[_0x469d('0x2d')](_0x469d('0x8e'),_0x3d385c['id']);return getEndUser(_0xdec76e,_0x216310,_0x113627,_0x2f1b27[_0x469d('0x8f')],_0x2f1b27[_0x469d('0x90')],_0x3d385c,_0x2fc656);})[_0x469d('0x27')](function(_0x43976d){_0x5ea50d=_0x43976d;return getCall(_0xdec76e,_0x216310,_0x113627,_0x3d385c,_0x5ea50d,_0x2fc656,_0x2f1b27,_0x469d('0x91'));})[_0x469d('0x27')](function(_0x457b79){if(_0x457b79){logger[_0x469d('0x2d')](_0x469d('0x92'),_0x457b79['id']);logger[_0x469d('0x2d')](_0x469d('0x8b'),_0x469d('0x86'));emit(util[_0x469d('0x60')](_0x469d('0x93'),_0x3fee91[_0x469d('0x17')]),_0x469d('0x87'),{'uri':_0x469d('0x88')+_0x113627[_0x469d('0x7a')]+_0x469d('0x89')+_0x457b79['id']});}})[_0x469d('0x3c')](function(_0x8680f2){logger[_0x469d('0x2a')](_0x469d('0x8b'),JSON['stringify'](_0x8680f2));});};exports[_0x469d('0x94')]=function(_0x473a44,_0x2abd24,_0x523317,_0x2ee04a,_0x302000,_0x5cb380){var _0x517d7c,_0x1b89b4,_0x2de7d7;_0x5cb380[_0x469d('0x7a')]=intUtil['stripTrailingSlash'](_0x5cb380['host']);_0x5cb380[_0x469d('0x7c')]=intUtil[_0x469d('0x7b')](_0x5cb380[_0x469d('0x7c')]);if(_0x302000&&_0x302000[_0x469d('0x7d')]){logger[_0x469d('0x2d')]('['+_0x2abd24[_0x469d('0x67')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x2abd24[_0x469d('0x80')]=_0x5cb380['serverUrl']+'/api/voice/recordings/'+_0x2abd24['uniqueid']+_0x469d('0x83')+md5(_0x2abd24[_0x469d('0x82')]);}else{_0x2abd24[_0x469d('0x80')]='';}var _0x388dc7=_0x5cb380[_0x469d('0x7a')]===_0x469d('0x8c')?'eu':_0x469d('0x84');return getAccessToken(_0x5cb380)[_0x469d('0x27')](function(_0x4dc371){_0x2de7d7=_0x4dc371;return getUser(_0x2de7d7,_0x388dc7,_0x5cb380);})[_0x469d('0x27')](function(_0x3165bf){_0x517d7c=_0x3165bf;logger[_0x469d('0x2d')](_0x469d('0x8e'),_0x517d7c['id']);return getEndUser(_0x2de7d7,_0x388dc7,_0x5cb380,_0x2abd24['calleridname'],_0x2abd24[_0x469d('0x95')],_0x517d7c,_0x523317);})[_0x469d('0x27')](function(_0x5bdcb5){_0x1b89b4=_0x5bdcb5;return getCall(_0x2de7d7,_0x388dc7,_0x5cb380,_0x517d7c,_0x1b89b4,_0x523317,_0x2abd24,_0x469d('0x72'));})['then'](function(_0x338d6c){if(_0x338d6c){logger[_0x469d('0x2d')]('The\x20Call\x20ID\x20is:',_0x338d6c['id']);}})['catch'](function(_0x11d79a){logger[_0x469d('0x2a')]('['+_0x2abd24[_0x469d('0x67')][_0x469d('0x96')]()+']',JSON[_0x469d('0xc')](_0x11d79a));});}; \ 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 33dbee8..020aba1 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(_0x37aa33,_0x1cbb62){var _0x1f142e=function(_0x1e199d){while(--_0x1e199d){_0x37aa33['push'](_0x37aa33['shift']());}};_0x1f142e(++_0x1cbb62);}(_0x7a54,0x106));var _0x47a5=function(_0x1189e8,_0x19fbcb){_0x1189e8=_0x1189e8-0x0;var _0x180f36=_0x7a54[_0x1189e8];return _0x180f36;};'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(_0x115cb4,_0x13f2c7){var _0x4cc0dd=function(_0x28854e){while(--_0x28854e){_0x115cb4['push'](_0x115cb4['shift']());}};_0x4cc0dd(++_0x13f2c7);}(_0x7a54,0x106));var _0x47a5=function(_0x2efb2e,_0x3c8299){_0x2efb2e=_0x2efb2e-0x0;var _0x340af7=_0x7a54[_0x2efb2e];return _0x340af7;};'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 60fa278..e0963ca 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x12266c,_0x3dd371){var _0x524b4f=function(_0x1c3816){while(--_0x1c3816){_0x12266c['push'](_0x12266c['shift']());}};_0x524b4f(++_0x3dd371);}(_0x5f2f,0x73));var _0xf5f2=function(_0x328073,_0x27e5b5){_0x328073=_0x328073-0x0;var _0x5cacac=_0x5f2f[_0x328073];return _0x5cacac;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x1d25dc,_0x4280b9){var _0x42653b=function(_0x34062e){while(--_0x34062e){_0x1d25dc['push'](_0x1d25dc['shift']());}};_0x42653b(++_0x4280b9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2e76ae,_0x4710d7){_0x2e76ae=_0x2e76ae-0x0;var _0x2f0a44=_0x5f2f[_0x2e76ae];return _0x2f0a44;};'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 c8b84ee..7abee0b 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 _0x6bdc=['../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','result','exports','jayson/promise','bluebird'];(function(_0x56967a,_0x57ebf7){var _0x28e8df=function(_0x467dd4){while(--_0x467dd4){_0x56967a['push'](_0x56967a['shift']());}};_0x28e8df(++_0x57ebf7);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x126d51,_0x462dca){_0x126d51=_0x126d51-0x0;var _0x1b9535=_0x6bdc[_0x126d51];return _0x1b9535;};'use strict';var jayson=require(_0xc6bd('0x0'));var BPromise=require(_0xc6bd('0x1'));var logger=require(_0xc6bd('0x2'))(_0xc6bd('0x3'));var client=jayson[_0xc6bd('0x4')][_0xc6bd('0x5')]({'port':0x2329});client[_0xc6bd('0x6')]=function(_0x529c4b,_0x1bb923){return new BPromise(function(_0xd0f13,_0x580a26){return client[_0xc6bd('0x7')](_0x529c4b,_0x1bb923)[_0xc6bd('0x8')](function(_0x158271){logger[_0xc6bd('0x9')](_0xc6bd('0xa'),_0xc6bd('0x3'),_0x529c4b,_0x1bb923,_0x158271);if(_0x158271['error']){logger[_0xc6bd('0xb')](_0xc6bd('0xa'),_0xc6bd('0x3'),_0x529c4b,_0x158271['error']['message'],_0x1bb923);return _0x580a26(_0x158271[_0xc6bd('0xb')]['message']);}else{return _0xd0f13(_0x158271[_0xc6bd('0xc')]);}})['catch'](function(_0x3150d8){logger[_0xc6bd('0xb')](_0xc6bd('0xa'),_0xc6bd('0x3'),_0x529c4b,_0x3150d8,_0x1bb923);return _0x580a26(_0x3150d8);});});};module[_0xc6bd('0xd')]=client; \ No newline at end of file +var _0xb8ca=['then','debug','routing','error','rpc','message','exports','jayson/promise','bluebird','../../config/logger','client','http','request'];(function(_0x125cb4,_0xd3bfd8){var _0x22579d=function(_0xd3edb2){while(--_0xd3edb2){_0x125cb4['push'](_0x125cb4['shift']());}};_0x22579d(++_0xd3bfd8);}(_0xb8ca,0x89));var _0xab8c=function(_0x88a187,_0x318ef6){_0x88a187=_0x88a187-0x0;var _0x43662e=_0xb8ca[_0x88a187];return _0x43662e;};'use strict';var jayson=require(_0xab8c('0x0'));var BPromise=require(_0xab8c('0x1'));var logger=require(_0xab8c('0x2'))('routing');var client=jayson[_0xab8c('0x3')][_0xab8c('0x4')]({'port':0x2329});client['Request']=function(_0x4bf8af,_0x40c0b4){return new BPromise(function(_0x293bde,_0x38f81f){return client[_0xab8c('0x5')](_0x4bf8af,_0x40c0b4)[_0xab8c('0x6')](function(_0x340159){logger[_0xab8c('0x7')]('rpc',_0xab8c('0x8'),_0x4bf8af,_0x40c0b4,_0x340159);if(_0x340159['error']){logger[_0xab8c('0x9')](_0xab8c('0xa'),_0xab8c('0x8'),_0x4bf8af,_0x340159[_0xab8c('0x9')][_0xab8c('0xb')],_0x40c0b4);return _0x38f81f(_0x340159['error'][_0xab8c('0xb')]);}else{return _0x293bde(_0x340159['result']);}})['catch'](function(_0x56d0b6){logger[_0xab8c('0x9')](_0xab8c('0xa'),_0xab8c('0x8'),_0x4bf8af,_0x56d0b6,_0x40c0b4);return _0x38f81f(_0x56d0b6);});});};module[_0xab8c('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 2cb6d88..7e8f4e5 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 _0xea1c=['initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','then','getMailAccounts'];(function(_0x423b03,_0x37d5d7){var _0x35ece9=function(_0x84ce7e){while(--_0x84ce7e){_0x423b03['push'](_0x423b03['shift']());}};_0x35ece9(++_0x37d5d7);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0xcea1('0x0'));var EmailChannel=require(_0xcea1('0x1'));var mailAccount=require(_0xcea1('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xcea1('0x3'))['db'];function initRealtime(){return BPromise['resolve']()[_0xcea1('0x4')](mailAccount[_0xcea1('0x5')]())[_0xcea1('0x4')](realtime[_0xcea1('0x6')]())[_0xcea1('0x4')](function(){email[_0xcea1('0x7')](realtime[_0xcea1('0x8')]);return realtime;});}function main(){return server[_0xcea1('0x9')](realtime,email)[_0xcea1('0x4')](function(_0x1441c6){return initRealtime();})[_0xcea1('0x4')](function(_0x49554b){return db[_0xcea1('0xa')][_0xcea1('0xb')]({'attributes':['id',_0xcea1('0xc')],'raw':!![]});})['then'](function(_0x4613d4){return setInterval(initRealtime,_0x4613d4[_0xcea1('0xc')]*0x3e8);})[_0xcea1('0xd')](function(_0x4097ed){console[_0xcea1('0xe')](_0x4097ed);});}main(); \ No newline at end of file +var _0x28e3=['findOne','loginMailFrequency','bluebird','./server','./realtime','./lib/email','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','Setting'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28e3,0x106));var _0x328e=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x28e3[_0x4de586];return _0x46baf5;};'use strict';var BPromise=require(_0x328e('0x0'));var server=require(_0x328e('0x1'));var Realtime=require(_0x328e('0x2'));var EmailChannel=require(_0x328e('0x3'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x328e('0x4'))['db'];function initRealtime(){return BPromise[_0x328e('0x5')]()[_0x328e('0x6')](mailAccount[_0x328e('0x7')]())[_0x328e('0x6')](realtime[_0x328e('0x8')]())[_0x328e('0x6')](function(){email[_0x328e('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(_0x2bddaa){return initRealtime();})[_0x328e('0x6')](function(_0x3467ee){return db[_0x328e('0xa')][_0x328e('0xb')]({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0x328e('0x6')](function(_0x1b3bb8){return setInterval(initRealtime,_0x1b3bb8[_0x328e('0xc')]*0x3e8);})['catch'](function(_0x509c4d){console['log'](_0x509c4d);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index a8eda38..d7a5fb6 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 _0x309e=['stringify','mailAccount:update','refresh','hasOwnProperty','active','imapAccounts','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','messageStatus','connected','messages','total','handleImapEmail','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','socket.io-emitter','./smtp','info','mailAccounts','prototype','emit','name','key','Imap','status','isNil'];(function(_0x5bc27a,_0x32e2d1){var _0x2c8a4d=function(_0x1a7dd9){while(--_0x1a7dd9){_0x5bc27a['push'](_0x5bc27a['shift']());}};_0x2c8a4d(++_0x32e2d1);}(_0x309e,0x8c));var _0xe309=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x309e[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xe309('0x0'));var moment=require(_0xe309('0x1'));var BPromise=require('bluebird');var md5=require(_0xe309('0x2'));var Redis=require(_0xe309('0x3'));var config=require(_0xe309('0x4'));var logger=require(_0xe309('0x5'))(_0xe309('0x6'));config[_0xe309('0x7')]=_['defaults'](config[_0xe309('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xe309('0x8'))(new Redis(config[_0xe309('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xe309('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x1e3c2f){logger[_0xe309('0xa')]('start\x20email\x20channel');this[_0xe309('0xb')]=_0x1e3c2f[_0xe309('0xb')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0xe309('0xc')][_0xe309('0xd')]=function(_0x3d0fa3){var _0x3960b3=this[_0xe309('0xb')][_0x3d0fa3];var _0x152296={'id':_0x3960b3['id'],'name':_0x3960b3[_0xe309('0xe')],'key':_0x3960b3[_0xe309('0xf')],'active':_0x3960b3['active'],'Imap':{'status':_0x3960b3[_0xe309('0x10')][_0xe309('0x11')],'messageStatus':_0x3960b3[_0xe309('0x10')]['messageStatus'],'total':_0x3960b3[_0xe309('0x10')]['total']}};if(_[_0xe309('0x12')](md5Accounts[_0x3d0fa3])){md5Accounts[_0x3d0fa3]={};}var _0xf61ce7=md5(JSON[_0xe309('0x13')](_0x152296));if(md5Accounts[_0x3d0fa3][_0xe309('0x2')]!==_0xf61ce7){md5Accounts[_0x3d0fa3][_0xe309('0x2')]=_0xf61ce7;io[_0xe309('0xd')](_0xe309('0x14'),_0x152296);}};EmailChannel[_0xe309('0xc')][_0xe309('0x15')]=function(_0x496b2e){for(var _0x36077c in _0x496b2e){if(_0x496b2e[_0xe309('0x16')](_0x36077c)){if(_0x496b2e[_0x36077c][_0xe309('0x10')]&&_0x496b2e[_0x36077c][_0xe309('0x17')]){var _0x60c9a4=_0x496b2e[_0x36077c][_0xe309('0x10')];if(!this[_0xe309('0x18')]['hasOwnProperty'](_0x60c9a4['id'])){this[_0xe309('0x18')][_0x60c9a4['id']]=new EmailImap(_0x60c9a4,_0x496b2e[_0x36077c]['email']);this[_0xe309('0x18')][_0x60c9a4['id']]['on']('box',this[_0xe309('0x19')][_0xe309('0x1a')](this,_0x36077c));this['imapAccounts'][_0x60c9a4['id']]['on'](_0xe309('0x6'),this['handleImapEmail']['bind'](this,_0x36077c));this[_0xe309('0x18')][_0x60c9a4['id']]['on'](_0xe309('0x1b'),this[_0xe309('0x1c')][_0xe309('0x1a')](this,_0x36077c));this[_0xe309('0x18')][_0x60c9a4['id']]['on'](_0xe309('0x1d'),this[_0xe309('0x1e')]['bind'](this,_0x36077c));}}else{if(_[_0xe309('0x12')](this['mailAccounts'][_0x36077c][_0xe309('0x10')])){this[_0xe309('0xb')][_0x36077c]['Imap']={};}this['mailAccounts'][_0x36077c][_0xe309('0x10')][_0xe309('0x11')]=_0xe309('0x1f');this['mailAccounts'][_0x36077c][_0xe309('0x10')][_0xe309('0x20')]='';this[_0xe309('0xd')](_0x36077c);}}}};EmailChannel[_0xe309('0xc')]['handleImapBox']=function(_0x3ba77b,_0x203a26){if(this['mailAccounts'][_0x3ba77b]){this['mailAccounts'][_0x3ba77b][_0xe309('0x10')][_0xe309('0x11')]=_0xe309('0x21');this[_0xe309('0xb')][_0x3ba77b][_0xe309('0x10')][_0xe309('0x20')]=_0x203a26['name'];if(_0x203a26[_0xe309('0x22')]){this[_0xe309('0xb')][_0x3ba77b][_0xe309('0x10')][_0xe309('0x23')]=_0x203a26[_0xe309('0x22')][_0xe309('0x23')];}return this[_0xe309('0xd')](_0x3ba77b);}};EmailChannel[_0xe309('0xc')][_0xe309('0x24')]=function(_0x55abcf,_0x48d637){logger[_0xe309('0xa')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x48d637[_0xe309('0x25')],_0x48d637[_0xe309('0x26')],_0x48d637[_0xe309('0x27')],_0x55abcf);if(this[_0xe309('0xb')][_0x55abcf]){return mailAccount['notify'](_0x55abcf,_0x48d637)[_0xe309('0x28')](function(_0xe85e00){if(_0xe85e00){logger[_0xe309('0xa')](_0xe309('0x29'));}})[_0xe309('0x2a')](function(_0x47d046){logger[_0xe309('0x1d')](_0xe309('0x2b'),JSON['stringify'](_0x47d046));});}};EmailChannel[_0xe309('0xc')]['handleImapEnd']=function(_0x5383cc){if(this['mailAccounts'][_0x5383cc]&&this[_0xe309('0xb')][_0x5383cc][_0xe309('0x10')]){if(this[_0xe309('0x18')][this['mailAccounts'][_0x5383cc][_0xe309('0x10')]['id']]){delete this[_0xe309('0x18')][this['mailAccounts'][_0x5383cc]['Imap']['id']];}this[_0xe309('0xb')][_0x5383cc][_0xe309('0x10')][_0xe309('0x2c')]=moment();this['emit'](_0x5383cc);}};EmailChannel[_0xe309('0xc')][_0xe309('0x1e')]=function(_0x47b34e,_0x102ba3){if(this[_0xe309('0xb')][_0x47b34e]){this[_0xe309('0xb')][_0x47b34e][_0xe309('0x10')][_0xe309('0x11')]=_0xe309('0x1d');this['mailAccounts'][_0x47b34e][_0xe309('0x10')][_0xe309('0x20')]=_0x102ba3;return this['emit'](_0x47b34e);}};EmailChannel[_0xe309('0xc')][_0xe309('0x2d')]=function(_0x24db38,_0x4e21f7){return this[_0xe309('0x2e')][_0xe309('0x2f')](_0x24db38,_0x4e21f7);};EmailChannel[_0xe309('0xc')][_0xe309('0x30')]=function(_0x15b5b8){var _0x35c09e=this;if(this[_0xe309('0xb')][_0x15b5b8['id']]){if(_[_0xe309('0x12')](this[_0xe309('0xb')][_0x15b5b8['id']]['Smtp'])){this[_0xe309('0xb')][_0x15b5b8['id']][_0xe309('0x31')]={};}this[_0xe309('0xb')][_0x15b5b8['id']][_0xe309('0x31')][_0xe309('0x2c')]=moment();return new BPromise(function(_0x24e098,_0x5f3df3){return _0x35c09e[_0xe309('0x2e')][_0xe309('0x32')](_0x15b5b8)[_0xe309('0x28')](function(_0x2030cb){_0x35c09e['mailAccounts'][_0x15b5b8['id']][_0xe309('0x31')][_0xe309('0x11')]=_0xe309('0x33');_0x35c09e[_0xe309('0xb')][_0x15b5b8['id']]['Smtp'][_0xe309('0x20')]='';_0x35c09e[_0xe309('0xd')](_0x15b5b8['id']);_0x24e098(_0x2030cb);})[_0xe309('0x2a')](function(_0x4d3c4c){_0x35c09e['mailAccounts'][_0x15b5b8['id']][_0xe309('0x31')][_0xe309('0x11')]=_0xe309('0x1d');_0x35c09e[_0xe309('0xb')][_0x15b5b8['id']][_0xe309('0x31')][_0xe309('0x20')]=_0x4d3c4c;_0x35c09e[_0xe309('0xd')](_0x15b5b8['id']);_0x5f3df3(_0x4d3c4c);});});}return this[_0xe309('0x2e')][_0xe309('0x32')](_0x15b5b8);};module[_0xe309('0x34')]=EmailChannel; \ No newline at end of file +var _0x4aa1=['ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','emit','key','active','Imap','status','messageStatus','total','mailAccount:update','prototype','refresh','hasOwnProperty','imapAccounts','email','box','bind','handleImapEmail','error','handleImapError','isNil','disabled','handleImapBox','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','smtp','verifySmtp','Smtp','verify','verified','exports','moment','md5'];(function(_0x255be9,_0x3345d9){var _0x34fedf=function(_0x2e198c){while(--_0x2e198c){_0x255be9['push'](_0x255be9['shift']());}};_0x34fedf(++_0x3345d9);}(_0x4aa1,0x6e));var _0x14aa=function(_0x457b48,_0x442038){_0x457b48=_0x457b48-0x0;var _0x2af6a0=_0x4aa1[_0x457b48];return _0x2af6a0;};'use strict';var _=require('lodash');var moment=require(_0x14aa('0x0'));var BPromise=require('bluebird');var md5=require(_0x14aa('0x1'));var Redis=require(_0x14aa('0x2'));var config=require(_0x14aa('0x3'));var logger=require(_0x14aa('0x4'))('email');config[_0x14aa('0x5')]=_[_0x14aa('0x6')](config[_0x14aa('0x5')],{'host':_0x14aa('0x7'),'port':0x18eb});var io=require(_0x14aa('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x14aa('0x9'));var EmailSmtp=require(_0x14aa('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x6c65e6){logger[_0x14aa('0xb')](_0x14aa('0xc'));this[_0x14aa('0xd')]=_0x6c65e6[_0x14aa('0xd')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x14aa('0xe')]=function(_0x380627){var _0x13ce71=this[_0x14aa('0xd')][_0x380627];var _0x2ddcb2={'id':_0x13ce71['id'],'name':_0x13ce71['name'],'key':_0x13ce71[_0x14aa('0xf')],'active':_0x13ce71[_0x14aa('0x10')],'Imap':{'status':_0x13ce71[_0x14aa('0x11')][_0x14aa('0x12')],'messageStatus':_0x13ce71[_0x14aa('0x11')][_0x14aa('0x13')],'total':_0x13ce71[_0x14aa('0x11')][_0x14aa('0x14')]}};if(_['isNil'](md5Accounts[_0x380627])){md5Accounts[_0x380627]={};}var _0x40218b=md5(JSON['stringify'](_0x2ddcb2));if(md5Accounts[_0x380627]['md5']!==_0x40218b){md5Accounts[_0x380627][_0x14aa('0x1')]=_0x40218b;io[_0x14aa('0xe')](_0x14aa('0x15'),_0x2ddcb2);}};EmailChannel[_0x14aa('0x16')][_0x14aa('0x17')]=function(_0x3d1220){for(var _0x41775f in _0x3d1220){if(_0x3d1220[_0x14aa('0x18')](_0x41775f)){if(_0x3d1220[_0x41775f][_0x14aa('0x11')]&&_0x3d1220[_0x41775f][_0x14aa('0x10')]){var _0x3853f9=_0x3d1220[_0x41775f][_0x14aa('0x11')];if(!this[_0x14aa('0x19')]['hasOwnProperty'](_0x3853f9['id'])){this[_0x14aa('0x19')][_0x3853f9['id']]=new EmailImap(_0x3853f9,_0x3d1220[_0x41775f][_0x14aa('0x1a')]);this[_0x14aa('0x19')][_0x3853f9['id']]['on'](_0x14aa('0x1b'),this['handleImapBox'][_0x14aa('0x1c')](this,_0x41775f));this[_0x14aa('0x19')][_0x3853f9['id']]['on'](_0x14aa('0x1a'),this[_0x14aa('0x1d')][_0x14aa('0x1c')](this,_0x41775f));this['imapAccounts'][_0x3853f9['id']]['on']('end',this['handleImapEnd'][_0x14aa('0x1c')](this,_0x41775f));this['imapAccounts'][_0x3853f9['id']]['on'](_0x14aa('0x1e'),this[_0x14aa('0x1f')][_0x14aa('0x1c')](this,_0x41775f));}}else{if(_[_0x14aa('0x20')](this[_0x14aa('0xd')][_0x41775f][_0x14aa('0x11')])){this[_0x14aa('0xd')][_0x41775f]['Imap']={};}this[_0x14aa('0xd')][_0x41775f][_0x14aa('0x11')][_0x14aa('0x12')]=_0x14aa('0x21');this[_0x14aa('0xd')][_0x41775f][_0x14aa('0x11')]['messageStatus']='';this[_0x14aa('0xe')](_0x41775f);}}}};EmailChannel[_0x14aa('0x16')][_0x14aa('0x22')]=function(_0xf1a02c,_0x5cf622){if(this[_0x14aa('0xd')][_0xf1a02c]){this[_0x14aa('0xd')][_0xf1a02c][_0x14aa('0x11')][_0x14aa('0x12')]=_0x14aa('0x23');this[_0x14aa('0xd')][_0xf1a02c][_0x14aa('0x11')]['messageStatus']=_0x5cf622[_0x14aa('0x24')];if(_0x5cf622[_0x14aa('0x25')]){this[_0x14aa('0xd')][_0xf1a02c][_0x14aa('0x11')]['total']=_0x5cf622[_0x14aa('0x25')][_0x14aa('0x14')];}return this['emit'](_0xf1a02c);}};EmailChannel[_0x14aa('0x16')][_0x14aa('0x1d')]=function(_0x593cb3,_0x791b61){logger[_0x14aa('0xb')](_0x14aa('0x26'),_0x791b61[_0x14aa('0x27')],_0x791b61[_0x14aa('0x28')],_0x791b61[_0x14aa('0x29')],_0x593cb3);if(this[_0x14aa('0xd')][_0x593cb3]){return mailAccount[_0x14aa('0x2a')](_0x593cb3,_0x791b61)[_0x14aa('0x2b')](function(_0x2df3d2){if(_0x2df3d2){logger[_0x14aa('0xb')](_0x14aa('0x2c'));}})[_0x14aa('0x2d')](function(_0x341a08){logger[_0x14aa('0x1e')](_0x14aa('0x2e'),JSON[_0x14aa('0x2f')](_0x341a08));});}};EmailChannel[_0x14aa('0x16')]['handleImapEnd']=function(_0x291ca5){if(this[_0x14aa('0xd')][_0x291ca5]&&this['mailAccounts'][_0x291ca5][_0x14aa('0x11')]){if(this[_0x14aa('0x19')][this[_0x14aa('0xd')][_0x291ca5][_0x14aa('0x11')]['id']]){delete this[_0x14aa('0x19')][this[_0x14aa('0xd')][_0x291ca5][_0x14aa('0x11')]['id']];}this['mailAccounts'][_0x291ca5][_0x14aa('0x11')][_0x14aa('0x30')]=moment();this[_0x14aa('0xe')](_0x291ca5);}};EmailChannel[_0x14aa('0x16')][_0x14aa('0x1f')]=function(_0x5d2587,_0x3263d9){if(this[_0x14aa('0xd')][_0x5d2587]){this[_0x14aa('0xd')][_0x5d2587][_0x14aa('0x11')]['status']=_0x14aa('0x1e');this[_0x14aa('0xd')][_0x5d2587][_0x14aa('0x11')]['messageStatus']=_0x3263d9;return this[_0x14aa('0xe')](_0x5d2587);}};EmailChannel[_0x14aa('0x16')][_0x14aa('0x31')]=function(_0x2e4ad7,_0x513e26){return this[_0x14aa('0x32')]['send'](_0x2e4ad7,_0x513e26);};EmailChannel['prototype'][_0x14aa('0x33')]=function(_0x215073){var _0x1b36b8=this;if(this[_0x14aa('0xd')][_0x215073['id']]){if(_[_0x14aa('0x20')](this[_0x14aa('0xd')][_0x215073['id']]['Smtp'])){this[_0x14aa('0xd')][_0x215073['id']]['Smtp']={};}this[_0x14aa('0xd')][_0x215073['id']][_0x14aa('0x34')][_0x14aa('0x30')]=moment();return new BPromise(function(_0x2392e5,_0x2417c1){return _0x1b36b8[_0x14aa('0x32')][_0x14aa('0x35')](_0x215073)[_0x14aa('0x2b')](function(_0x2aebb9){_0x1b36b8[_0x14aa('0xd')][_0x215073['id']][_0x14aa('0x34')][_0x14aa('0x12')]=_0x14aa('0x36');_0x1b36b8[_0x14aa('0xd')][_0x215073['id']][_0x14aa('0x34')][_0x14aa('0x13')]='';_0x1b36b8[_0x14aa('0xe')](_0x215073['id']);_0x2392e5(_0x2aebb9);})[_0x14aa('0x2d')](function(_0x597c61){_0x1b36b8[_0x14aa('0xd')][_0x215073['id']][_0x14aa('0x34')][_0x14aa('0x12')]=_0x14aa('0x1e');_0x1b36b8[_0x14aa('0xd')][_0x215073['id']]['Smtp'][_0x14aa('0x13')]=_0x597c61;_0x1b36b8['emit'](_0x215073['id']);_0x2417c1(_0x597c61);});});}return this[_0x14aa('0x32')]['verify'](_0x215073);};module[_0x14aa('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index c1aba77..0a895d3 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 _0x98c7=['once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','authTimeout','service','user','password','host','port','autotls','getHost','tls','anonymous@xcally.com','openBox','mailbox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','randomstring','mailparser','iconv','events','EventEmitter','./utils','email','INBOX','account','getAccount'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x98c7,0x129));var _0x798c=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0x98c7[_0x3dee92];return _0x44d36e;};'use strict';var fs=require('fs');var path=require(_0x798c('0x0'));var util=require(_0x798c('0x1'));var Imap=require(_0x798c('0x2'));var _=require('lodash');var rs=require(_0x798c('0x3'));var simpleParser=require(_0x798c('0x4'))['simpleParser'];var Iconv=require(_0x798c('0x5'))['Iconv'];var EventEmitter=require(_0x798c('0x6'))[_0x798c('0x7')];var utils=require(_0x798c('0x8'));var logger=require('../../../config/logger')(_0x798c('0x9'));function EmailImap(_0x1067bd,_0x9d09b){this['mailbox']=_0x798c('0xa');this[_0x798c('0xb')]=this[_0x798c('0xc')](_0x1067bd,_0x9d09b);this[_0x798c('0x2')]=new Imap(this['account']);this[_0x798c('0x2')][_0x798c('0xd')](_0x798c('0xe'),this[_0x798c('0xf')][_0x798c('0x10')](this));this['imap'][_0x798c('0xd')](_0x798c('0x11'),this[_0x798c('0x12')][_0x798c('0x10')](this));this['imap']['on'](_0x798c('0x13'),this[_0x798c('0x14')][_0x798c('0x10')](this));this[_0x798c('0x2')][_0x798c('0x15')]();}util[_0x798c('0x16')](EmailImap,EventEmitter);EmailImap[_0x798c('0x17')][_0x798c('0xc')]=function(_0x30696c,_0x5e926a){var _0x2addfa={'connTimeout':_0x30696c['connTimeout']?_0x30696c['connTimeout']*0x3e8:0x2710,'authTimeout':_0x30696c[_0x798c('0x18')]?_0x30696c[_0x798c('0x18')]*0x3e8:0x1388};if(_['isNil'](_0x30696c[_0x798c('0x19')])){if(_0x30696c['authentication']){_0x2addfa[_0x798c('0x1a')]=_0x30696c[_0x798c('0x1a')];_0x2addfa[_0x798c('0x1b')]=_0x30696c[_0x798c('0x1b')];}_0x2addfa[_0x798c('0x1c')]=_0x30696c['host'];_0x2addfa[_0x798c('0x1d')]=_0x30696c[_0x798c('0x1d')]||0x3e1;if(_0x30696c['tls']){_0x2addfa['tls']=!![];}else{_0x2addfa['tls']=![];_0x2addfa[_0x798c('0x1e')]='required';}}else{_0x2addfa[_0x798c('0x1a')]=_0x30696c[_0x798c('0x1a')];_0x2addfa[_0x798c('0x1b')]=_0x30696c[_0x798c('0x1b')];_0x2addfa[_0x798c('0x1c')]=utils[_0x798c('0x1f')](_0x30696c[_0x798c('0x19')]);_0x2addfa[_0x798c('0x1d')]=0x3e1;_0x2addfa[_0x798c('0x20')]=!![];}_0x2addfa[_0x798c('0x9')]=_0x5e926a||_0x30696c[_0x798c('0x1a')]||_0x798c('0x21');return _0x2addfa;};EmailImap[_0x798c('0x17')][_0x798c('0xf')]=function(){this['imap'][_0x798c('0x22')](this[_0x798c('0x23')],![],this[_0x798c('0x24')][_0x798c('0x10')](this));};EmailImap[_0x798c('0x17')][_0x798c('0x24')]=function(_0x18cb9b,_0x27c266){if(_0x18cb9b){this[_0x798c('0x14')](_0x18cb9b,!![]);}else{this[_0x798c('0x25')](_0x798c('0x26'),_0x27c266);this[_0x798c('0x27')]();}};EmailImap[_0x798c('0x17')]['handleCloseBox']=function(_0x4ed92b){if(_0x4ed92b){this[_0x798c('0x14')](_0x4ed92b,!![]);}else{this[_0x798c('0x2')][_0x798c('0x11')]();}};EmailImap[_0x798c('0x17')][_0x798c('0x27')]=function(){this['imap'][_0x798c('0x28')]([_0x798c('0x29')],this['handleReadUnseen'][_0x798c('0x10')](this));};EmailImap[_0x798c('0x17')][_0x798c('0x2a')]=function(_0x333e36,_0x106174){if(_0x333e36){this['handleError'](_0x333e36,!![]);}else{if(_0x106174[_0x798c('0x2b')]){try{var _0x21a52b=this[_0x798c('0x2')][_0x798c('0x2c')](_0x106174,{'bodies':'','markSeen':!![]});_0x21a52b['on']('message',this[_0x798c('0x2d')][_0x798c('0x10')](this));_0x21a52b[_0x798c('0xd')](_0x798c('0x13'),this[_0x798c('0x2e')][_0x798c('0x10')](this));_0x21a52b[_0x798c('0xd')](_0x798c('0x11'),this['handleFetchEnd']['bind'](this));}catch(_0x12860a){logger[_0x798c('0x13')](_0x12860a);}}else{this[_0x798c('0x2')][_0x798c('0x2f')](!![],this[_0x798c('0x30')][_0x798c('0x10')](this));}}};EmailImap[_0x798c('0x17')]['handleFetchMessage']=function(_0x1426c4,_0x2019b9){_0x1426c4['on'](_0x798c('0x31'),this[_0x798c('0x32')][_0x798c('0x10')](this));_0x1426c4['once'](_0x798c('0x33'),this[_0x798c('0x34')][_0x798c('0x10')](this));_0x1426c4[_0x798c('0xd')](_0x798c('0x11'),this[_0x798c('0x35')][_0x798c('0x10')](this));};EmailImap['prototype'][_0x798c('0x32')]=function(_0x4b84d2,_0x3874d7){simpleParser(_0x4b84d2,{'Iconv':Iconv},this['handleSimpleParser'][_0x798c('0x10')](this));};EmailImap['prototype'][_0x798c('0x34')]=function(_0x309253){};EmailImap[_0x798c('0x17')][_0x798c('0x35')]=function(){};EmailImap[_0x798c('0x17')][_0x798c('0x36')]=function(_0x10fc7d,_0x234d07){if(_0x10fc7d){logger[_0x798c('0x13')](_0x10fc7d);}else{var _0x1cc987=this;utils[_0x798c('0x37')](this['account'],_0x234d07,function(_0x5e1a06){_0x1cc987[_0x798c('0x25')]('email',_0x5e1a06);});}};EmailImap[_0x798c('0x17')][_0x798c('0x38')]=function(){this['imap']['closeBox'](!![],this['handleCloseBox'][_0x798c('0x10')](this));};EmailImap[_0x798c('0x17')][_0x798c('0x2e')]=function(_0x19acfd){this[_0x798c('0x14')](_0x19acfd);this['imap']['closeBox'](!![],this['handleCloseBox'][_0x798c('0x10')](this));};EmailImap[_0x798c('0x17')]['handleEnd']=function(){this[_0x798c('0x25')](_0x798c('0x11'));};EmailImap[_0x798c('0x17')][_0x798c('0x14')]=function(_0x18c8ff,_0x1cd275){logger['error'](_0x798c('0x14'),this[_0x798c('0xb')]['email'],JSON[_0x798c('0x39')](_0x18c8ff));var _0x47e0a1='';if(_0x18c8ff){if(_0x18c8ff[_0x798c('0x3a')]){_0x47e0a1=_0x18c8ff[_0x798c('0x3a')];}else{for(var _0x348c3f in _0x18c8ff){if(_0x18c8ff[_0x798c('0x3b')](_0x348c3f)){_0x47e0a1+=_[_0x798c('0x3c')](_0x348c3f)+':\x20'+_0x18c8ff[_0x348c3f]+'\x0a';}}}}if(_0x1cd275){this[_0x798c('0x2')][_0x798c('0x11')]();}else{this['emit'](_0x798c('0x13'),_0x47e0a1);this[_0x798c('0x25')](_0x798c('0x11'));}};module[_0x798c('0x3d')]=EmailImap; \ No newline at end of file +var _0x2ada=['port','tls','autotls','required','email','anonymous@xcally.com','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','handleFetchMessage','handleFetchError','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','handleFetchEnd','closeBox','textCode','hasOwnProperty','exports','path','util','randomstring','mailparser','iconv','Iconv','events','EventEmitter','../../../config/logger','mailbox','account','imap','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','authentication','user','password','host'];(function(_0x18afdb,_0xa73905){var _0x4f22e5=function(_0xdf86d9){while(--_0xdf86d9){_0x18afdb['push'](_0x18afdb['shift']());}};_0x4f22e5(++_0xa73905);}(_0x2ada,0x171));var _0xa2ad=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x2ada[_0x500419];return _0x241c1a;};'use strict';var fs=require('fs');var path=require(_0xa2ad('0x0'));var util=require(_0xa2ad('0x1'));var Imap=require('imap');var _=require('lodash');var rs=require(_0xa2ad('0x2'));var simpleParser=require(_0xa2ad('0x3'))['simpleParser'];var Iconv=require(_0xa2ad('0x4'))[_0xa2ad('0x5')];var EventEmitter=require(_0xa2ad('0x6'))[_0xa2ad('0x7')];var utils=require('./utils');var logger=require(_0xa2ad('0x8'))('email');function EmailImap(_0x3837b6,_0x487b60){this[_0xa2ad('0x9')]='INBOX';this[_0xa2ad('0xa')]=this['getAccount'](_0x3837b6,_0x487b60);this[_0xa2ad('0xb')]=new Imap(this[_0xa2ad('0xa')]);this['imap'][_0xa2ad('0xc')](_0xa2ad('0xd'),this[_0xa2ad('0xe')][_0xa2ad('0xf')](this));this[_0xa2ad('0xb')][_0xa2ad('0xc')](_0xa2ad('0x10'),this[_0xa2ad('0x11')]['bind'](this));this[_0xa2ad('0xb')]['on'](_0xa2ad('0x12'),this[_0xa2ad('0x13')]['bind'](this));this[_0xa2ad('0xb')][_0xa2ad('0x14')]();}util[_0xa2ad('0x15')](EmailImap,EventEmitter);EmailImap[_0xa2ad('0x16')]['getAccount']=function(_0x38951f,_0x5bb34f){var _0x55ffb9={'connTimeout':_0x38951f['connTimeout']?_0x38951f[_0xa2ad('0x17')]*0x3e8:0x2710,'authTimeout':_0x38951f[_0xa2ad('0x18')]?_0x38951f[_0xa2ad('0x18')]*0x3e8:0x1388};if(_['isNil'](_0x38951f[_0xa2ad('0x19')])){if(_0x38951f[_0xa2ad('0x1a')]){_0x55ffb9[_0xa2ad('0x1b')]=_0x38951f[_0xa2ad('0x1b')];_0x55ffb9['password']=_0x38951f[_0xa2ad('0x1c')];}_0x55ffb9[_0xa2ad('0x1d')]=_0x38951f[_0xa2ad('0x1d')];_0x55ffb9[_0xa2ad('0x1e')]=_0x38951f['port']||0x3e1;if(_0x38951f[_0xa2ad('0x1f')]){_0x55ffb9[_0xa2ad('0x1f')]=!![];}else{_0x55ffb9[_0xa2ad('0x1f')]=![];_0x55ffb9[_0xa2ad('0x20')]=_0xa2ad('0x21');}}else{_0x55ffb9[_0xa2ad('0x1b')]=_0x38951f[_0xa2ad('0x1b')];_0x55ffb9['password']=_0x38951f['password'];_0x55ffb9[_0xa2ad('0x1d')]=utils['getHost'](_0x38951f[_0xa2ad('0x19')]);_0x55ffb9['port']=0x3e1;_0x55ffb9['tls']=!![];}_0x55ffb9[_0xa2ad('0x22')]=_0x5bb34f||_0x38951f[_0xa2ad('0x1b')]||_0xa2ad('0x23');return _0x55ffb9;};EmailImap[_0xa2ad('0x16')][_0xa2ad('0xe')]=function(){this['imap']['openBox'](this[_0xa2ad('0x9')],![],this[_0xa2ad('0x24')][_0xa2ad('0xf')](this));};EmailImap[_0xa2ad('0x16')][_0xa2ad('0x24')]=function(_0x1c33e6,_0xa7ee05){if(_0x1c33e6){this[_0xa2ad('0x13')](_0x1c33e6,!![]);}else{this[_0xa2ad('0x25')](_0xa2ad('0x26'),_0xa7ee05);this[_0xa2ad('0x27')]();}};EmailImap[_0xa2ad('0x16')][_0xa2ad('0x28')]=function(_0x353a5e){if(_0x353a5e){this[_0xa2ad('0x13')](_0x353a5e,!![]);}else{this[_0xa2ad('0xb')]['end']();}};EmailImap[_0xa2ad('0x16')]['readUnseen']=function(){this[_0xa2ad('0xb')][_0xa2ad('0x29')]([_0xa2ad('0x2a')],this[_0xa2ad('0x2b')]['bind'](this));};EmailImap[_0xa2ad('0x16')]['handleReadUnseen']=function(_0x111f49,_0x923e4f){if(_0x111f49){this['handleError'](_0x111f49,!![]);}else{if(_0x923e4f['length']){try{var _0x527710=this[_0xa2ad('0xb')]['fetch'](_0x923e4f,{'bodies':'','markSeen':!![]});_0x527710['on']('message',this[_0xa2ad('0x2c')][_0xa2ad('0xf')](this));_0x527710[_0xa2ad('0xc')](_0xa2ad('0x12'),this[_0xa2ad('0x2d')][_0xa2ad('0xf')](this));_0x527710['once']('end',this['handleFetchEnd']['bind'](this));}catch(_0xe6586e){logger['error'](_0xe6586e);}}else{this['imap']['closeBox'](!![],this[_0xa2ad('0x28')][_0xa2ad('0xf')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x1ffa1f,_0x41164a){_0x1ffa1f['on']('body',this[_0xa2ad('0x2e')][_0xa2ad('0xf')](this));_0x1ffa1f['once'](_0xa2ad('0x2f'),this[_0xa2ad('0x30')][_0xa2ad('0xf')](this));_0x1ffa1f[_0xa2ad('0xc')](_0xa2ad('0x10'),this['handleMessageEnd'][_0xa2ad('0xf')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x460d9d,_0x1f88d4){simpleParser(_0x460d9d,{'Iconv':Iconv},this[_0xa2ad('0x31')]['bind'](this));};EmailImap[_0xa2ad('0x16')][_0xa2ad('0x30')]=function(_0x2ae9b5){};EmailImap[_0xa2ad('0x16')][_0xa2ad('0x32')]=function(){};EmailImap[_0xa2ad('0x16')][_0xa2ad('0x31')]=function(_0x4860d9,_0x13a2a3){if(_0x4860d9){logger[_0xa2ad('0x12')](_0x4860d9);}else{var _0x5b2444=this;utils[_0xa2ad('0x33')](this[_0xa2ad('0xa')],_0x13a2a3,function(_0x586a8d){_0x5b2444[_0xa2ad('0x25')](_0xa2ad('0x22'),_0x586a8d);});}};EmailImap[_0xa2ad('0x16')][_0xa2ad('0x34')]=function(){this[_0xa2ad('0xb')][_0xa2ad('0x35')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xa2ad('0x16')][_0xa2ad('0x2d')]=function(_0x17c999){this['handleError'](_0x17c999);this[_0xa2ad('0xb')][_0xa2ad('0x35')](!![],this[_0xa2ad('0x28')][_0xa2ad('0xf')](this));};EmailImap[_0xa2ad('0x16')][_0xa2ad('0x11')]=function(){this[_0xa2ad('0x25')](_0xa2ad('0x10'));};EmailImap[_0xa2ad('0x16')][_0xa2ad('0x13')]=function(_0x147ee8,_0x2743d8){logger[_0xa2ad('0x12')](_0xa2ad('0x13'),this[_0xa2ad('0xa')][_0xa2ad('0x22')],JSON['stringify'](_0x147ee8));var _0x33e472='';if(_0x147ee8){if(_0x147ee8['textCode']){_0x33e472=_0x147ee8[_0xa2ad('0x36')];}else{for(var _0x1b8fc7 in _0x147ee8){if(_0x147ee8[_0xa2ad('0x37')](_0x1b8fc7)){_0x33e472+=_['upperFirst'](_0x1b8fc7)+':\x20'+_0x147ee8[_0x1b8fc7]+'\x0a';}}}}if(_0x2743d8){this[_0xa2ad('0xb')]['end']();}else{this[_0xa2ad('0x25')](_0xa2ad('0x12'),_0x33e472);this['emit']('end');}};module[_0xa2ad('0x38')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 1f3d545..fa67f1b 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 _0xd164=['nodemailer','bluebird','nodemailer-plugin-inline-base64','use','compile','sendMail','toString','prototype','verify','Not\x20verifired'];(function(_0x16bfde,_0x2e0333){var _0x4f01f8=function(_0x28fb71){while(--_0x28fb71){_0x16bfde['push'](_0x16bfde['shift']());}};_0x4f01f8(++_0x2e0333);}(_0xd164,0x172));var _0x4d16=function(_0x1e6c58,_0x19678d){_0x1e6c58=_0x1e6c58-0x0;var _0x48a7f7=_0xd164[_0x1e6c58];return _0x48a7f7;};'use strict';var nodemailer=require(_0x4d16('0x0'));var BPromise=require(_0x4d16('0x1'));var inlineBase64=require(_0x4d16('0x2'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x52dd9a,_0x4a8c71){return new BPromise(function(_0x1cb167,_0x192aba){var _0x5ee896=nodemailer['createTransport'](_0x52dd9a);_0x5ee896[_0x4d16('0x3')](_0x4d16('0x4'),inlineBase64());_0x5ee896[_0x4d16('0x5')](_0x4a8c71,function(_0x258451,_0x1d7ae9){if(_0x258451){_0x192aba(_0x258451[_0x4d16('0x6')]());}else{_0x1cb167(_0x1d7ae9);}});});};EmailSmtp[_0x4d16('0x7')][_0x4d16('0x8')]=function(_0x180064){return new BPromise(function(_0x4c2ca6,_0x37ae4d){var _0xbebfad=nodemailer['createTransport'](_0x180064);_0xbebfad['verify'](function(_0x257f77,_0xc2d767){if(_0x257f77){_0x37ae4d(_0x257f77['toString']());}else{if(_0xc2d767){_0x4c2ca6(_0xc2d767);}else{_0x37ae4d(_0x4d16('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x21d6=['verify','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','sendMail','toString'];(function(_0x23d6d6,_0x210046){var _0x5bde7d=function(_0x3f70dc){while(--_0x3f70dc){_0x23d6d6['push'](_0x23d6d6['shift']());}};_0x5bde7d(++_0x210046);}(_0x21d6,0x188));var _0x621d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x21d6[_0x42cae2];return _0x5f256f;};'use strict';var nodemailer=require(_0x621d('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x621d('0x1'));function EmailSmtp(){}EmailSmtp[_0x621d('0x2')][_0x621d('0x3')]=function(_0x375117,_0x515152){return new BPromise(function(_0x5de287,_0x339edc){var _0x7b774b=nodemailer[_0x621d('0x4')](_0x375117);_0x7b774b[_0x621d('0x5')]('compile',inlineBase64());_0x7b774b[_0x621d('0x6')](_0x515152,function(_0x40a0c5,_0x15829d){if(_0x40a0c5){_0x339edc(_0x40a0c5[_0x621d('0x7')]());}else{_0x5de287(_0x15829d);}});});};EmailSmtp[_0x621d('0x2')][_0x621d('0x8')]=function(_0x3def41){return new BPromise(function(_0x5ef633,_0x988700){var _0x8d8afa=nodemailer[_0x621d('0x4')](_0x3def41);_0x8d8afa['verify'](function(_0x3c2641,_0x394bff){if(_0x3c2641){_0x988700(_0x3c2641[_0x621d('0x7')]());}else{if(_0x394bff){_0x5ef633(_0x394bff);}else{_0x988700('Not\x20verifired');}}});});};module[_0x621d('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 65385db..b99bdbf 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 _0x9b82=['address','anonymous','generate','@xcally.com','name','split','length','Anonymous','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','0x1?_0x5dfd65[_0x29b8('0x13')]():'';}return'';}function getMails(_0x15c1f8,_0x1c5d23){var _0x164235='';for(var _0x199294=0x0;_0x199294<_0x1c5d23[_0x29b8('0xa')][_0x29b8('0x11')];_0x199294+=0x1){if(_0x1c5d23[_0x29b8('0xa')][_0x199294][_0x29b8('0xb')]!==_0x15c1f8){if(!_[_0x29b8('0x14')](_0x164235)){_0x164235+=',';}_0x164235+=_0x1c5d23[_0x29b8('0xa')][_0x199294]['name']||_0x1c5d23[_0x29b8('0xa')][_0x199294][_0x29b8('0xb')]||'';_0x164235+='\x20<';_0x164235+=_0x1c5d23[_0x29b8('0xa')][_0x199294][_0x29b8('0xb')]?_0x1c5d23[_0x29b8('0xa')][_0x199294][_0x29b8('0xb')]:_0x29b8('0xc')+random[_0x29b8('0xd')](0x6)+'@xcally.com';_0x164235+='>';}}return _0x164235;}function parseEmail(_0x5ba183,_0x16b10a,_0x1d7846){if(_0x16b10a[_0x29b8('0x15')]){var _0x128ad6=/)<[^<]*)*<\/script>/gi;while(_0x128ad6[_0x29b8('0x16')](_0x16b10a[_0x29b8('0x15')])){_0x16b10a[_0x29b8('0x15')]=_0x16b10a[_0x29b8('0x15')][_0x29b8('0x17')](_0x128ad6,'');}if(_0x16b10a[_0x29b8('0x15')][_0x29b8('0x18')](_0x29b8('0x19'))){var _0x541678=[];_0x16b10a[_0x29b8('0x1a')][_0x29b8('0x1b')](_0x1987c3=>{_0x541678[_0x29b8('0x1c')](_0x1987c3[_0x29b8('0x1d')]);});var _0x3012c6=/]+>/g;var _0x455d7f=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x4aadb6=_0x16b10a[_0x29b8('0x15')][_0x29b8('0x17')](_0x455d7f,_0x29b8('0x1e'));var _0x224884=_0x4aadb6['replace'](_0x3012c6,_0x29b8('0x1f'));for(let _0x48d07d=0x0;_0x48d07d<_0x541678[_0x29b8('0x11')];_0x48d07d++){var _0x4abca5=_0x224884[_0x29b8('0x17')](_0x29b8('0x1f'),_0x29b8('0x20')+_0x541678[_0x48d07d]+_0x29b8('0x21'));_0x224884=_0x4abca5;}_0x16b10a[_0x29b8('0x15')]=_0x224884;}_0x1d7846[_0x29b8('0x22')]=_0x16b10a[_0x29b8('0x15')];}else{_0x1d7846[_0x29b8('0x22')]=_0x16b10a['textAsHtml'];}if(_0x1d7846[_0x29b8('0x22')]){_0x1d7846['body']=_0x1d7846[_0x29b8('0x22')][_0x29b8('0x17')](/Empty\x20message

';if(_0x531921[_0x29b8('0x3f')]){for(var _0x46d3ab=0x0;_0x46d3ab<_0x531921[_0x29b8('0x3f')]['length'];_0x46d3ab++){var _0xa51069=_0x531921[_0x29b8('0x3f')][_0x46d3ab];_0x2fc2a5[_0x29b8('0x24')][_0x29b8('0x1a')][_0x29b8('0x1c')]({'filename':_0xa51069[_0x29b8('0x40')],'content':new Buffer(_0xa51069[_0x29b8('0x41')])});}}}_0x33756b(parseEmail(_0x3dbcc1,_0x19aa99,_0x2fc2a5));});}else{_0x19aa99[_0x29b8('0x15')]='

Empty\x20message

';_0x33756b(parseEmail(_0x3dbcc1,_0x19aa99,_0x2fc2a5));}}else{_0x33756b(parseEmail(_0x3dbcc1,_0x19aa99,_0x2fc2a5));}};exports['getHost']=function(_0x2e507d){switch(_0x2e507d){case'gmail':return _0x29b8('0x42');case _0x29b8('0x43'):return _0x29b8('0x44');case _0x29b8('0x45'):return _0x29b8('0x46');case'outlook365':return'outlook.office365.com';}return'127.0.0.1';}; \ No newline at end of file +var _0xdaa2=['attachments','forEach','push','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','originTo','message','originCc','bcc','attach','type','filename','attachment-','format','now','join','server/files/attachments/','content','contentType','from','subject','messageId','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','randomstring','util','../../../config/logger','email','../../../config/environment','head','value','address','generate','@xcally.com','name','split','length','Anonymous','pop','isEmpty','anonymous','html','test','replace','includes','0x1?_0x492080[_0x2daa('0xf')]():'';}return'';}function getMails(_0xde663b,_0x439943){var _0xec94d6='';for(var _0xb09571=0x0;_0xb09571<_0x439943[_0x2daa('0x7')][_0x2daa('0xd')];_0xb09571+=0x1){if(_0x439943[_0x2daa('0x7')][_0xb09571]['address']!==_0xde663b){if(!_[_0x2daa('0x10')](_0xec94d6)){_0xec94d6+=',';}_0xec94d6+=_0x439943[_0x2daa('0x7')][_0xb09571][_0x2daa('0xb')]||_0x439943['value'][_0xb09571][_0x2daa('0x8')]||'';_0xec94d6+='\x20<';_0xec94d6+=_0x439943['value'][_0xb09571][_0x2daa('0x8')]?_0x439943[_0x2daa('0x7')][_0xb09571][_0x2daa('0x8')]:_0x2daa('0x11')+random[_0x2daa('0x9')](0x6)+_0x2daa('0xa');_0xec94d6+='>';}}return _0xec94d6;}function parseEmail(_0xca4091,_0x53a5d1,_0x1a80cc){if(_0x53a5d1[_0x2daa('0x12')]){var _0x46157f=/)<[^<]*)*<\/script>/gi;while(_0x46157f[_0x2daa('0x13')](_0x53a5d1[_0x2daa('0x12')])){_0x53a5d1[_0x2daa('0x12')]=_0x53a5d1[_0x2daa('0x12')][_0x2daa('0x14')](_0x46157f,'');}if(_0x53a5d1[_0x2daa('0x12')][_0x2daa('0x15')](_0x2daa('0x16'))){var _0x1e569c=[];_0x53a5d1[_0x2daa('0x17')][_0x2daa('0x18')](_0x59ab1a=>{_0x1e569c[_0x2daa('0x19')](_0x59ab1a['filename']);});var _0x8d20e0=/]+>/g;var _0x43142c=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x182def=_0x53a5d1[_0x2daa('0x12')][_0x2daa('0x14')](_0x43142c,_0x2daa('0x1a'));var _0x2d6b0e=_0x182def['replace'](_0x8d20e0,'_IMG');for(let _0x40458c=0x0;_0x40458c<_0x1e569c['length'];_0x40458c++){var _0x55533e=_0x2d6b0e[_0x2daa('0x14')](_0x2daa('0x1b'),_0x2daa('0x1c')+_0x1e569c[_0x40458c]+_0x2daa('0x1d'));_0x2d6b0e=_0x55533e;}_0x53a5d1[_0x2daa('0x12')]=_0x2d6b0e;}_0x1a80cc[_0x2daa('0x1e')]=_0x53a5d1[_0x2daa('0x12')];}else{_0x1a80cc[_0x2daa('0x1e')]=_0x53a5d1[_0x2daa('0x1f')];}if(_0x1a80cc[_0x2daa('0x1e')]){_0x1a80cc[_0x2daa('0x1e')]=_0x1a80cc[_0x2daa('0x1e')][_0x2daa('0x14')](/0x0){if(this[_0x4b9eb9+_0xcadc('0x25')]>0x0&&this[_0x4b9eb9+'CurrentCapacity']>=this[_0x4b9eb9+_0xcadc('0x25')]){return'maxcapacity';}else{return _0xcadc('0x26');}}else{return _0xcadc('0x27');}};Agent['prototype'][_0xcadc('0x28')]=function(){var _0x3e8311=['mail','chat','openchannel',_0xcadc('0x29'),_0xcadc('0x2a'),'whatsapp'];for(var _0x1c07c5=0x0;_0x1c07c5<_0x3e8311['length'];_0x1c07c5+=0x1){var _0x277d1e=this[_0xcadc('0x24')](_0x3e8311[_0x1c07c5]);if(this[_0x3e8311[_0x1c07c5]+_0xcadc('0x2b')]!==_0x277d1e){this[_0x3e8311[_0x1c07c5]+_0xcadc('0x2c')]=_[_0xcadc('0x2d')](moment()[_0xcadc('0x2e')]('x'));}this[_0x3e8311[_0x1c07c5]+'Status']=_0x277d1e;}var _0x4b4754={'id':this['id'],'name':this['name'],'online':this[_0xcadc('0x8')],'voicePause':this[_0xcadc('0x9')],'chatPause':this[_0xcadc('0xa')],'mailPause':this[_0xcadc('0xb')],'smsPause':this[_0xcadc('0xd')],'faxPause':this[_0xcadc('0xc')],'openchannelPause':this[_0xcadc('0xe')],'chatStatus':this[_0xcadc('0xf')],'chatStatusTime':this[_0xcadc('0x11')],'chatCapacity':this[_0xcadc('0x2f')],'chatCurrentCapacity':this[_0xcadc('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xcadc('0x15')],'mailCurrentCapacity':this[_0xcadc('0x30')],'faxStatus':this[_0xcadc('0x16')],'faxStatusTime':this[_0xcadc('0x17')],'faxCapacity':this[_0xcadc('0x18')],'faxCurrentCapacity':this[_0xcadc('0x19')],'smsStatus':this[_0xcadc('0x31')],'smsStatusTime':this[_0xcadc('0x32')],'smsCapacity':this[_0xcadc('0x1a')],'smsCurrentCapacity':this[_0xcadc('0x1b')],'whatsappStatus':this[_0xcadc('0x1c')],'whatsappStatusTime':this[_0xcadc('0x33')],'whatsappCapacity':this[_0xcadc('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xcadc('0x34')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x407152=md5(JSON[_0xcadc('0x35')](_0x4b4754));if(this[_0xcadc('0x1')]!==_0x407152){this[_0xcadc('0x1')]=_0x407152;io[_0xcadc('0x36')]('user:save',_0x4b4754);}};module[_0xcadc('0x37')]=Agent; \ No newline at end of file +var _0xc648=['chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','working','idle','mail','openchannel','sms','whatsapp','length','Status','format','smsStatus','openchannelCurrentCapacity','busy','stringify','emit','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc648,0x171));var _0x8c64=function(_0xf175a8,_0x4fafb3){_0xf175a8=_0xf175a8-0x0;var _0x1cb17b=_0xc648[_0xf175a8];return _0x1cb17b;};'use strict';var _=require('lodash');var moment=require(_0x8c64('0x0'));var md5=require(_0x8c64('0x1'));var Redis=require(_0x8c64('0x2'));var config=require(_0x8c64('0x3'));config[_0x8c64('0x4')]=_[_0x8c64('0x5')](config[_0x8c64('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x1c79a9){this['id']=_0x1c79a9['id']||0x0;this[_0x8c64('0x6')]=_0x1c79a9[_0x8c64('0x6')]||'';this[_0x8c64('0x7')]=_0x1c79a9['online']||!![];this[_0x8c64('0x8')]=_0x1c79a9[_0x8c64('0x8')]||![];this[_0x8c64('0x9')]=_0x1c79a9[_0x8c64('0x9')]||![];this[_0x8c64('0xa')]=_0x1c79a9['mailPause']||![];this[_0x8c64('0xb')]=_0x1c79a9[_0x8c64('0xb')]||![];this['smsPause']=_0x1c79a9[_0x8c64('0xc')]||![];this[_0x8c64('0xd')]=_0x1c79a9[_0x8c64('0xd')]||![];this[_0x8c64('0xe')]=_0x8c64('0xf');this[_0x8c64('0x10')]=0x0;this[_0x8c64('0x11')]=_0x1c79a9[_0x8c64('0x11')]||0x0;this[_0x8c64('0x12')]=0x0;this[_0x8c64('0x13')]='unknown';this[_0x8c64('0x14')]=0x0;this[_0x8c64('0x15')]=_0x1c79a9[_0x8c64('0x15')]||0x0;this[_0x8c64('0x16')]=0x0;this[_0x8c64('0x17')]=_0x8c64('0xf');this[_0x8c64('0x18')]=0x0;this['faxCapacity']=_0x1c79a9[_0x8c64('0x19')]||0x0;this[_0x8c64('0x1a')]=0x0;this['smsStatus']=_0x8c64('0xf');this[_0x8c64('0x1b')]=0x0;this['smsCapacity']=_0x1c79a9[_0x8c64('0x1c')]||0x0;this[_0x8c64('0x1d')]=0x0;this['whatsappStatus']='unknown';this[_0x8c64('0x1e')]=0x0;this[_0x8c64('0x1f')]=_0x1c79a9['whatsappCapacity']||0x0;this[_0x8c64('0x20')]=0x0;this[_0x8c64('0x21')]='unknown';this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x1c79a9[_0x8c64('0x22')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x8c64('0x23')]=undefined;this[_0x8c64('0x1')]='';this[_0x8c64('0x24')]();}Agent[_0x8c64('0x25')][_0x8c64('0x26')]=function(_0x17a1ab){if(this[_0x17a1ab+'CurrentCapacity']>0x0){if(this[_0x17a1ab+_0x8c64('0x27')]>0x0&&this[_0x17a1ab+'CurrentCapacity']>=this[_0x17a1ab+_0x8c64('0x27')]){return'maxcapacity';}else{return _0x8c64('0x28');}}else{return _0x8c64('0x29');}};Agent['prototype'][_0x8c64('0x24')]=function(){var _0x1300b4=[_0x8c64('0x2a'),'chat',_0x8c64('0x2b'),'fax',_0x8c64('0x2c'),_0x8c64('0x2d')];for(var _0x457b55=0x0;_0x457b55<_0x1300b4[_0x8c64('0x2e')];_0x457b55+=0x1){var _0x328da5=this['getChannelStatus'](_0x1300b4[_0x457b55]);if(this[_0x1300b4[_0x457b55]+_0x8c64('0x2f')]!==_0x328da5){this[_0x1300b4[_0x457b55]+'StatusTime']=_['toNumber'](moment()[_0x8c64('0x30')]('x'));}this[_0x1300b4[_0x457b55]+'Status']=_0x328da5;}var _0x33027f={'id':this['id'],'name':this[_0x8c64('0x6')],'online':this[_0x8c64('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0x8c64('0x9')],'mailPause':this[_0x8c64('0xa')],'smsPause':this[_0x8c64('0xc')],'faxPause':this[_0x8c64('0xb')],'openchannelPause':this[_0x8c64('0xd')],'chatStatus':this[_0x8c64('0xe')],'chatStatusTime':this[_0x8c64('0x10')],'chatCapacity':this[_0x8c64('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x8c64('0x15')],'mailCurrentCapacity':this[_0x8c64('0x16')],'faxStatus':this[_0x8c64('0x17')],'faxStatusTime':this[_0x8c64('0x18')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x8c64('0x1a')],'smsStatus':this[_0x8c64('0x31')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x8c64('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x8c64('0x1e')],'whatsappCapacity':this[_0x8c64('0x1f')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x8c64('0x22')],'openchannelCurrentCapacity':this[_0x8c64('0x32')],'busy':this[_0x8c64('0x33')],'busyQueue':this[_0x8c64('0x23')]};var _0x40475e=md5(JSON[_0x8c64('0x34')](_0x33027f));if(this[_0x8c64('0x1')]!==_0x40475e){this[_0x8c64('0x1')]=_0x40475e;io[_0x8c64('0x35')]('user:save',_0x33027f);}};module[_0x8c64('0x36')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index b8ac5dc..d8ed610 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 _0xf5e3=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','online','chatPause','available','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x677c63,_0x4373d5){var _0x41cb67=function(_0x2025e6){while(--_0x2025e6){_0x677c63['push'](_0x677c63['shift']());}};_0x41cb67(++_0x4373d5);}(_0xf5e3,0x18c));var _0x3f5e=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xf5e3[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x3f5e('0x0'));var md5=require(_0x3f5e('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x3f5e('0x2'));config[_0x3f5e('0x3')]=_['defaults'](config['redis'],{'host':_0x3f5e('0x4'),'port':0x18eb});var io=require(_0x3f5e('0x5'))(new Redis(config[_0x3f5e('0x3')]));function ChatQueue(_0x4d7289){this['id']=_0x4d7289['id']||0x0;this['name']=_0x4d7289[_0x3f5e('0x6')]||'';this[_0x3f5e('0x7')]=_0x4d7289['timeout']||0xa;this[_0x3f5e('0x8')]=_0x4d7289['strategy']||_0x3f5e('0x9');this[_0x3f5e('0xa')]=_0x4d7289['Agents'];this[_0x3f5e('0xb')]={};this[_0x3f5e('0xc')]=0x0;this['md5']='';this[_0x3f5e('0xd')]();this[_0x3f5e('0xe')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x1e66ad=this['mapAgentsId'][_0x3f5e('0xf')];this[_0x3f5e('0xb')]=_[_0x3f5e('0x10')](this[_0x3f5e('0xa')],'id');this[_0x3f5e('0xb')][_0x3f5e('0xf')]=_0x1e66ad;};ChatQueue['prototype'][_0x3f5e('0xe')]=function(){this[_0x3f5e('0x11')]=0x0;this[_0x3f5e('0x12')]=0x0;for(var _0x278706=0x0;_0x278706=0x0?this[_0x3f5e('0x15')]:0x0;var _0x4973ff={'id':this['id'],'available':this[_0x3f5e('0x15')],'loggedIn':this[_0x3f5e('0x11')],'name':this[_0x3f5e('0x6')],'paused':this[_0x3f5e('0x12')],'waiting':this[_0x3f5e('0xc')]};var _0x52c38f=md5(JSON['stringify'](_0x4973ff));if(this[_0x3f5e('0x1')]!==_0x52c38f){this[_0x3f5e('0x1')]=_0x52c38f;io['to'](util[_0x3f5e('0x16')](_0x3f5e('0x17'),_0x4973ff[_0x3f5e('0x6')]))[_0x3f5e('0x18')](_0x3f5e('0x19'),_0x4973ff);}};module[_0x3f5e('0x1a')]=ChatQueue; \ No newline at end of file +var _0xee3f=['online','chatPause','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','map','_rr','updateRealtime','loggedIn','paused'];(function(_0x4b935a,_0x327ee3){var _0xa298f0=function(_0x3e07c2){while(--_0x3e07c2){_0x4b935a['push'](_0x4b935a['shift']());}};_0xa298f0(++_0x327ee3);}(_0xee3f,0x1e8));var _0xfee3=function(_0x364825,_0x49dc34){_0x364825=_0x364825-0x0;var _0x796804=_0xee3f[_0x364825];return _0x796804;};'use strict';var _=require(_0xfee3('0x0'));var md5=require(_0xfee3('0x1'));var util=require(_0xfee3('0x2'));var Redis=require(_0xfee3('0x3'));var config=require(_0xfee3('0x4'));config[_0xfee3('0x5')]=_[_0xfee3('0x6')](config[_0xfee3('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xfee3('0x7'))(new Redis(config['redis']));function ChatQueue(_0x2b5cdc){this['id']=_0x2b5cdc['id']||0x0;this['name']=_0x2b5cdc[_0xfee3('0x8')]||'';this['timeout']=_0x2b5cdc[_0xfee3('0x9')]||0xa;this[_0xfee3('0xa')]=_0x2b5cdc[_0xfee3('0xa')]||_0xfee3('0xb');this[_0xfee3('0xc')]=_0x2b5cdc['Agents'];this[_0xfee3('0xd')]={};this[_0xfee3('0xe')]=0x0;this[_0xfee3('0x1')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0xfee3('0xf')][_0xfee3('0x10')]=function(){var _0x2e72c0=this[_0xfee3('0xd')]['_rr'];this[_0xfee3('0xd')]=_[_0xfee3('0x11')](this['Agents'],'id');this['mapAgentsId'][_0xfee3('0x12')]=_0x2e72c0;};ChatQueue[_0xfee3('0xf')][_0xfee3('0x13')]=function(){this[_0xfee3('0x14')]=0x0;this[_0xfee3('0x15')]=0x0;for(var _0xfa4a40=0x0;_0xfa4a40=0x0?this[_0xfee3('0x18')]:0x0;var _0x55fe06={'id':this['id'],'available':this[_0xfee3('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xfee3('0x8')],'paused':this[_0xfee3('0x15')],'waiting':this['waiting']};var _0xdfebf7=md5(JSON[_0xfee3('0x19')](_0x55fe06));if(this[_0xfee3('0x1')]!==_0xdfebf7){this['md5']=_0xdfebf7;io['to'](util['format'](_0xfee3('0x1a'),_0x55fe06[_0xfee3('0x8')]))[_0xfee3('0x1b')](_0xfee3('0x1c'),_0x55fe06);}};module[_0xfee3('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index f67443e..fd757fc 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(_0x7cabe2,_0x469c2f){var _0x4dd3c3=function(_0x529aad){while(--_0x529aad){_0x7cabe2['push'](_0x7cabe2['shift']());}};_0x4dd3c3(++_0x469c2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x415f48,_0x127da5){var _0x2366ea=function(_0x479d83){while(--_0x479d83){_0x415f48['push'](_0x415f48['shift']());}};_0x2366ea(++_0x127da5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 68d14d2..21ea223 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 _0xb5ca=['name','Intervals','exports'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xb5ca,0x90));var _0xab5c=function(_0x44c43d,_0x5198f1){_0x44c43d=_0x44c43d-0x0;var _0x15b6a7=_0xb5ca[_0x44c43d];return _0x15b6a7;};'use strict';function Interval(_0x453054){this['id']=_0x453054['id']||0x0;this[_0xab5c('0x0')]=_0x453054[_0xab5c('0x0')]||'';this[_0xab5c('0x1')]=_0x453054[_0xab5c('0x1')]||{};}module[_0xab5c('0x2')]=Interval; \ No newline at end of file +var _0x7f94=['name','Intervals'];(function(_0xd6a22b,_0xcd38d0){var _0x288a32=function(_0x3c0698){while(--_0x3c0698){_0xd6a22b['push'](_0xd6a22b['shift']());}};_0x288a32(++_0xcd38d0);}(_0x7f94,0xf6));var _0x47f9=function(_0x5a4fb9,_0xd0a16e){_0x5a4fb9=_0x5a4fb9-0x0;var _0x56e16e=_0x7f94[_0x5a4fb9];return _0x56e16e;};'use strict';function Interval(_0x1131ed){this['id']=_0x1131ed['id']||0x0;this['name']=_0x1131ed[_0x47f9('0x0')]||'';this[_0x47f9('0x1')]=_0x1131ed[_0x47f9('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 6854f87..02916bd 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 _0x2613=['emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','mapAgentsId','_rr','map','paused','online','loggedIn','available','stringify','format','mail:queue:%s'];(function(_0x44b58a,_0x53f8b5){var _0x58d928=function(_0x30476d){while(--_0x30476d){_0x44b58a['push'](_0x44b58a['shift']());}};_0x58d928(++_0x53f8b5);}(_0x2613,0xc0));var _0x3261=function(_0x26b428,_0xfd42f8){_0x26b428=_0x26b428-0x0;var _0x4c187d=_0x2613[_0x26b428];return _0x4c187d;};'use strict';var _=require('lodash');var md5=require(_0x3261('0x0'));var util=require(_0x3261('0x1'));var Redis=require(_0x3261('0x2'));var config=require(_0x3261('0x3'));config[_0x3261('0x4')]=_[_0x3261('0x5')](config[_0x3261('0x4')],{'host':_0x3261('0x6'),'port':0x18eb});var io=require(_0x3261('0x7'))(new Redis(config[_0x3261('0x4')]));function MailQueue(_0x1033e9){this['id']=_0x1033e9['id']||0x0;this[_0x3261('0x8')]=_0x1033e9['name']||'';this[_0x3261('0x9')]=_0x1033e9[_0x3261('0x9')]||0xa;this[_0x3261('0xa')]=_0x1033e9[_0x3261('0xa')]||_0x3261('0xb');this[_0x3261('0xc')]=_0x1033e9[_0x3261('0xc')];this['mapAgentsId']={};this[_0x3261('0xd')]=0x0;this[_0x3261('0x0')]='';this['updateRouting']();this['updateRealtime']();}MailQueue['prototype']['updateRouting']=function(){var _0x513a6c=this[_0x3261('0xe')][_0x3261('0xf')];this['mapAgentsId']=_[_0x3261('0x10')](this[_0x3261('0xc')],'id');this['mapAgentsId'][_0x3261('0xf')]=_0x513a6c;};MailQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x3261('0x11')]=0x0;for(var _0x404dfe=0x0;_0x404dfe=0x0?this['available']:0x0;var _0xa309={'id':this['id'],'available':this[_0x3261('0x14')],'loggedIn':this[_0x3261('0x13')],'name':this['name'],'paused':this[_0x3261('0x11')],'waiting':this['waiting']};var _0x3c12bd=md5(JSON[_0x3261('0x15')](_0xa309));if(this[_0x3261('0x0')]!==_0x3c12bd){this[_0x3261('0x0')]=_0x3c12bd;io['to'](util[_0x3261('0x16')](_0x3261('0x17'),_0xa309[_0x3261('0x8')]))[_0x3261('0x18')](_0x3261('0x19'),_0xa309);}};module[_0x3261('0x1a')]=MailQueue; \ No newline at end of file +var _0x9767=['md5','format','emit','mail_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify'];(function(_0x1a08ba,_0x51b51d){var _0x2e66ba=function(_0x52dd88){while(--_0x52dd88){_0x1a08ba['push'](_0x1a08ba['shift']());}};_0x2e66ba(++_0x51b51d);}(_0x9767,0xb9));var _0x7976=function(_0x3ef25e,_0x4d2eaf){_0x3ef25e=_0x3ef25e-0x0;var _0x2ec94c=_0x9767[_0x3ef25e];return _0x2ec94c;};'use strict';var _=require(_0x7976('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x7976('0x1'));var config=require(_0x7976('0x2'));config[_0x7976('0x3')]=_[_0x7976('0x4')](config[_0x7976('0x3')],{'host':_0x7976('0x5'),'port':0x18eb});var io=require(_0x7976('0x6'))(new Redis(config[_0x7976('0x3')]));function MailQueue(_0x4dc879){this['id']=_0x4dc879['id']||0x0;this[_0x7976('0x7')]=_0x4dc879[_0x7976('0x7')]||'';this[_0x7976('0x8')]=_0x4dc879[_0x7976('0x8')]||0xa;this[_0x7976('0x9')]=_0x4dc879[_0x7976('0x9')]||_0x7976('0xa');this[_0x7976('0xb')]=_0x4dc879['Agents'];this[_0x7976('0xc')]={};this[_0x7976('0xd')]=0x0;this['md5']='';this[_0x7976('0xe')]();this['updateRealtime']();}MailQueue[_0x7976('0xf')][_0x7976('0xe')]=function(){var _0x1c9b22=this[_0x7976('0xc')][_0x7976('0x10')];this[_0x7976('0xc')]=_['map'](this[_0x7976('0xb')],'id');this[_0x7976('0xc')][_0x7976('0x10')]=_0x1c9b22;};MailQueue[_0x7976('0xf')][_0x7976('0x11')]=function(){this[_0x7976('0x12')]=0x0;this[_0x7976('0x13')]=0x0;for(var _0x263c39=0x0;_0x263c39=0x0?this[_0x7976('0x17')]:0x0;var _0x12c495={'id':this['id'],'available':this[_0x7976('0x17')],'loggedIn':this[_0x7976('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x464cc8=md5(JSON[_0x7976('0x18')](_0x12c495));if(this['md5']!==_0x464cc8){this[_0x7976('0x19')]=_0x464cc8;io['to'](util[_0x7976('0x1a')]('mail:queue:%s',_0x12c495['name']))[_0x7976('0x1b')](_0x7976('0x1c'),_0x12c495);}};module[_0x7976('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ea33f7c..c931ceb 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 _0x27b1=['_rr','map','paused','loggedIn','openchannelPause','available','stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId'];(function(_0x16b152,_0x103ad5){var _0x4e0dcb=function(_0x510f1d){while(--_0x510f1d){_0x16b152['push'](_0x16b152['shift']());}};_0x4e0dcb(++_0x103ad5);}(_0x27b1,0x1de));var _0x127b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x27b1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x127b('0x0'));var md5=require(_0x127b('0x1'));var util=require(_0x127b('0x2'));var Redis=require(_0x127b('0x3'));var config=require('../../../config/environment');config[_0x127b('0x4')]=_['defaults'](config['redis'],{'host':_0x127b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x127b('0x4')]));function OpenchannelQueue(_0x3eade7){this['id']=_0x3eade7['id']||0x0;this[_0x127b('0x6')]=_0x3eade7[_0x127b('0x6')]||'';this[_0x127b('0x7')]=_0x3eade7[_0x127b('0x7')]||0xa;this[_0x127b('0x8')]=_0x3eade7[_0x127b('0x8')]||_0x127b('0x9');this['Agents']=_0x3eade7[_0x127b('0xa')];this['mapAgentsId']={};this[_0x127b('0xb')]=0x0;this[_0x127b('0x1')]='';this[_0x127b('0xc')]();this[_0x127b('0xd')]();}OpenchannelQueue[_0x127b('0xe')][_0x127b('0xc')]=function(){var _0x4d81c9=this[_0x127b('0xf')][_0x127b('0x10')];this['mapAgentsId']=_[_0x127b('0x11')](this[_0x127b('0xa')],'id');this[_0x127b('0xf')][_0x127b('0x10')]=_0x4d81c9;};OpenchannelQueue[_0x127b('0xe')][_0x127b('0xd')]=function(){this['loggedIn']=0x0;this[_0x127b('0x12')]=0x0;for(var _0x541185=0x0;_0x541185=0x0?this[_0x127b('0x15')]:0x0;var _0x7cd79a={'id':this['id'],'available':this[_0x127b('0x15')],'loggedIn':this[_0x127b('0x13')],'name':this[_0x127b('0x6')],'paused':this[_0x127b('0x12')],'waiting':this[_0x127b('0xb')]};var _0x590b24=md5(JSON[_0x127b('0x16')](_0x7cd79a));if(this[_0x127b('0x1')]!==_0x590b24){this[_0x127b('0x1')]=_0x590b24;io['to'](util[_0x127b('0x17')]('openchannel:queue:%s',_0x7cd79a[_0x127b('0x6')]))['emit'](_0x127b('0x18'),_0x7cd79a);}};module[_0x127b('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x2958=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','openchannelPause','paused','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0x2958,0x10b));var _0x8295=function(_0x36b129,_0x9c2c68){_0x36b129=_0x36b129-0x0;var _0x5a40c8=_0x2958[_0x36b129];return _0x5a40c8;};'use strict';var _=require(_0x8295('0x0'));var md5=require(_0x8295('0x1'));var util=require(_0x8295('0x2'));var Redis=require(_0x8295('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x8295('0x4')](config['redis'],{'host':_0x8295('0x5'),'port':0x18eb});var io=require(_0x8295('0x6'))(new Redis(config[_0x8295('0x7')]));function OpenchannelQueue(_0x30423d){this['id']=_0x30423d['id']||0x0;this[_0x8295('0x8')]=_0x30423d[_0x8295('0x8')]||'';this['timeout']=_0x30423d[_0x8295('0x9')]||0xa;this[_0x8295('0xa')]=_0x30423d[_0x8295('0xa')]||_0x8295('0xb');this[_0x8295('0xc')]=_0x30423d[_0x8295('0xc')];this[_0x8295('0xd')]={};this[_0x8295('0xe')]=0x0;this['md5']='';this[_0x8295('0xf')]();this[_0x8295('0x10')]();}OpenchannelQueue['prototype'][_0x8295('0xf')]=function(){var _0x1e08d5=this[_0x8295('0xd')][_0x8295('0x11')];this['mapAgentsId']=_[_0x8295('0x12')](this[_0x8295('0xc')],'id');this[_0x8295('0xd')]['_rr']=_0x1e08d5;};OpenchannelQueue[_0x8295('0x13')][_0x8295('0x10')]=function(){this[_0x8295('0x14')]=0x0;this['paused']=0x0;for(var _0x374d5c=0x0;_0x374d5c=0x0?this['available']:0x0;var _0x5df2f1={'id':this['id'],'available':this[_0x8295('0x18')],'loggedIn':this[_0x8295('0x14')],'name':this[_0x8295('0x8')],'paused':this[_0x8295('0x17')],'waiting':this[_0x8295('0xe')]};var _0x11c8ed=md5(JSON[_0x8295('0x19')](_0x5df2f1));if(this[_0x8295('0x1')]!==_0x11c8ed){this[_0x8295('0x1')]=_0x11c8ed;io['to'](util[_0x8295('0x1a')](_0x8295('0x1b'),_0x5df2f1['name']))[_0x8295('0x1c')](_0x8295('0x1d'),_0x5df2f1);}};module[_0x8295('0x1e')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 62efd9b..be00e3a 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 _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x111104,_0x403420){var _0xe1ca96=function(_0x17f015){while(--_0x17f015){_0x111104['push'](_0x111104['shift']());}};_0xe1ca96(++_0x403420);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file +var _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a6bde,_0x3e8809){_0x1a6bde=_0x1a6bde-0x0;var _0x490911=_0xb10b[_0x1a6bde];return _0x490911;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b5c151e..3c6a90c 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 _0xc51f=['whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','paused','length','loggedIn','available'];(function(_0x15f6f7,_0x305040){var _0x37c435=function(_0x51929b){while(--_0x51929b){_0x15f6f7['push'](_0x15f6f7['shift']());}};_0x37c435(++_0x305040);}(_0xc51f,0xc1));var _0xfc51=function(_0x3db0ba,_0x2be65c){_0x3db0ba=_0x3db0ba-0x0;var _0x2d8e9a=_0xc51f[_0x3db0ba];return _0x2d8e9a;};'use strict';var _=require(_0xfc51('0x0'));var md5=require('md5');var util=require(_0xfc51('0x1'));var Redis=require(_0xfc51('0x2'));var config=require(_0xfc51('0x3'));config['redis']=_['defaults'](config[_0xfc51('0x4')],{'host':_0xfc51('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfc51('0x4')]));function WhatsappQueue(_0x3ccda6){this['id']=_0x3ccda6['id']||0x0;this[_0xfc51('0x6')]=_0x3ccda6[_0xfc51('0x6')]||'';this[_0xfc51('0x7')]=_0x3ccda6[_0xfc51('0x7')]||0xa;this['strategy']=_0x3ccda6[_0xfc51('0x8')]||_0xfc51('0x9');this[_0xfc51('0xa')]=_0x3ccda6[_0xfc51('0xa')];this[_0xfc51('0xb')]={};this[_0xfc51('0xc')]=0x0;this[_0xfc51('0xd')]='';this[_0xfc51('0xe')]();this[_0xfc51('0xf')]();}WhatsappQueue[_0xfc51('0x10')]['updateRouting']=function(){var _0x455006=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xfc51('0x11')](this[_0xfc51('0xa')],'id');this[_0xfc51('0xb')][_0xfc51('0x12')]=_0x455006;};WhatsappQueue['prototype'][_0xfc51('0xf')]=function(){this['loggedIn']=0x0;this[_0xfc51('0x13')]=0x0;for(var _0x45ccf1=0x0;_0x45ccf1=0x0?this['available']:0x0;var _0xf50273={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xfc51('0x6')],'paused':this[_0xfc51('0x13')],'waiting':this[_0xfc51('0xc')]};var _0x5f29bb=md5(JSON['stringify'](_0xf50273));if(this[_0xfc51('0xd')]!==_0x5f29bb){this[_0xfc51('0xd')]=_0x5f29bb;io['to'](util['format'](_0xfc51('0x17'),_0xf50273[_0xfc51('0x6')]))[_0xfc51('0x18')](_0xfc51('0x19'),_0xf50273);}};module[_0xfc51('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x358e=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost'];(function(_0x561fd5,_0x170958){var _0x35e6e7=function(_0x492fb6){while(--_0x492fb6){_0x561fd5['push'](_0x561fd5['shift']());}};_0x35e6e7(++_0x170958);}(_0x358e,0x17f));var _0xe358=function(_0x556e63,_0x16abaf){_0x556e63=_0x556e63-0x0;var _0x1f18a9=_0x358e[_0x556e63];return _0x1f18a9;};'use strict';var _=require(_0xe358('0x0'));var md5=require(_0xe358('0x1'));var util=require(_0xe358('0x2'));var Redis=require('ioredis');var config=require(_0xe358('0x3'));config[_0xe358('0x4')]=_[_0xe358('0x5')](config[_0xe358('0x4')],{'host':_0xe358('0x6'),'port':0x18eb});var io=require(_0xe358('0x7'))(new Redis(config[_0xe358('0x4')]));function WhatsappQueue(_0x45dccf){this['id']=_0x45dccf['id']||0x0;this[_0xe358('0x8')]=_0x45dccf[_0xe358('0x8')]||'';this['timeout']=_0x45dccf[_0xe358('0x9')]||0xa;this[_0xe358('0xa')]=_0x45dccf['strategy']||'beepall';this[_0xe358('0xb')]=_0x45dccf[_0xe358('0xb')];this[_0xe358('0xc')]={};this[_0xe358('0xd')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0xe358('0xe')][_0xe358('0xf')]=function(){var _0x2fd2f3=this['mapAgentsId'][_0xe358('0x10')];this[_0xe358('0xc')]=_[_0xe358('0x11')](this[_0xe358('0xb')],'id');this[_0xe358('0xc')][_0xe358('0x10')]=_0x2fd2f3;};WhatsappQueue['prototype'][_0xe358('0x12')]=function(){this[_0xe358('0x13')]=0x0;this[_0xe358('0x14')]=0x0;for(var _0x3d1516=0x0;_0x3d1516=0x0?this[_0xe358('0x18')]:0x0;var _0x3d6722={'id':this['id'],'available':this[_0xe358('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xe358('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x4ec5e0=md5(JSON[_0xe358('0x19')](_0x3d6722));if(this[_0xe358('0x1')]!==_0x4ec5e0){this[_0xe358('0x1')]=_0x4ec5e0;io['to'](util[_0xe358('0x1a')](_0xe358('0x1b'),_0x3d6722['name']))[_0xe358('0x1c')]('whatsapp_queue:save',_0x3d6722);}};module[_0xe358('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 180fc23..78e6a8f 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 _0xa41a=['../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','openchannelQueues','initChatQueues','chatQueues','initSmsQueues','updateRouting','updateRealtime','initFaxQueues','faxQueues','bluebird','util','moment','../model/agent'];(function(_0x3047e7,_0xc64826){var _0x572aca=function(_0x366ea4){while(--_0x366ea4){_0x3047e7['push'](_0x3047e7['shift']());}};_0x572aca(++_0xc64826);}(_0xa41a,0x6b));var _0xaa41=function(_0x5224f1,_0x1f1256){_0x5224f1=_0x5224f1-0x0;var _0x3bea9c=_0xa41a[_0x5224f1];return _0x3bea9c;};'use strict';var BPromise=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var _=require('lodash');var moment=require(_0xaa41('0x2'));var Agent=require(_0xaa41('0x3'));var Interval=require(_0xaa41('0x4'));var OpenchannelQueue=require(_0xaa41('0x5'));var ChatQueue=require(_0xaa41('0x6'));var SmsQueue=require(_0xaa41('0x7'));var MailQueue=require(_0xaa41('0x8'));var FaxQueue=require(_0xaa41('0x9'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0xaa41('0xa')]={};this[_0xaa41('0xb')]={};this['openchannelQueues']={};this['chatQueues']={};this[_0xaa41('0xc')]={};this[_0xaa41('0xd')]={};this['faxQueues']={};this[_0xaa41('0xe')]={};this[_0xaa41('0xf')]={};this[_0xaa41('0x10')]={};this[_0xaa41('0x11')]={};this[_0xaa41('0x12')]={};this[_0xaa41('0x13')]={};this[_0xaa41('0x14')]={};};function freeIsNotKey(_0x423a19,_0x1c291e,_0x5c9fc7){var _0x1d3aac=_[_0xaa41('0x15')](_0x423a19,function(_0x524cab,_0x54827c){return _0x524cab[_0x5c9fc7];});for(var _0x1d0a54 in _0x1c291e){if(_0x1c291e['hasOwnProperty'](_0x1d0a54)){if(!_0x1d3aac[_0x1d0a54]){delete _0x1c291e[_0x1d0a54];}}}}Realtime[_0xaa41('0x16')][_0xaa41('0x17')]=function(_0x2f64bc,_0x889d44){for(var _0x6f9ade in _0x889d44){if(_0x2f64bc['hasOwnProperty'](_0x6f9ade)){_0x2f64bc[_0x6f9ade]=_0x889d44[_0x6f9ade];}}};Realtime[_0xaa41('0x16')][_0xaa41('0x18')]=function(){var _0x1934e9=this;return function(_0x1ef7d9){if(_0x1ef7d9){freeIsNotKey(_0x1ef7d9,_0x1934e9[_0xaa41('0xa')],'id');for(var _0x2005ae=0x0,_0x1e1e02={},_0x550ad5={};_0x2005ae<_0x1ef7d9[_0xaa41('0x19')];_0x2005ae+=0x1){_0x1e1e02=_0x1ef7d9[_0x2005ae];if(_[_0xaa41('0x1a')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']])){_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']]=new Agent(_0x1e1e02);}else{_0x1934e9[_0xaa41('0x17')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']],_0x1e1e02);}}}return _0x1934e9[_0xaa41('0xa')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1b')]=function(){var _0x4fe1a4=this;return function(_0x5cd936){if(_0x5cd936){freeIsNotKey(_0x5cd936,_0x4fe1a4[_0xaa41('0xb')],'id');for(var _0x22de55=0x0,_0x35c753={},_0x54c488={};_0x22de55<_0x5cd936[_0xaa41('0x19')];_0x22de55+=0x1){_0x35c753=_0x5cd936[_0x22de55];if(_[_0xaa41('0x1a')](_0x4fe1a4['intervals'][_0x35c753['id']])){_0x4fe1a4['intervals'][_0x35c753['id']]=new Interval(_0x35c753);}else{_0x4fe1a4[_0xaa41('0x17')](_0x4fe1a4['intervals'][_0x35c753['id']],_0x35c753);}}}return _0x4fe1a4[_0xaa41('0xb')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1c')]=function(){var _0x1f27f3=this;return function(_0x1d623c){if(_0x1d623c){freeIsNotKey(_0x1d623c,_0x1f27f3['openchannelQueues'],'id');for(var _0x43c430=0x0,_0x43a85c={},_0x448a21={};_0x43c430<_0x1d623c[_0xaa41('0x19')];_0x43c430+=0x1){_0x43a85c=_0x1d623c[_0x43c430];if(_[_0xaa41('0x1a')](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']])){_0x1f27f3['openchannelQueues'][_0x43a85c['id']]=new OpenchannelQueue(_0x43a85c);}else{_0x1f27f3['mergeFromDatabase'](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']],_0x43a85c);}_0x1f27f3['openchannelQueues'][_0x43a85c['id']]['updateRouting']();_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']]['updateRealtime']();}}return _0x1f27f3['openchannelQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1e')]=function(){var _0x392214=this;return function(_0x632fd2){if(_0x632fd2){freeIsNotKey(_0x632fd2,_0x392214[_0xaa41('0x1f')],'id');for(var _0xa7269f=0x0,_0x57ef96={},_0x30a174={};_0xa7269f<_0x632fd2[_0xaa41('0x19')];_0xa7269f+=0x1){_0x57ef96=_0x632fd2[_0xa7269f];if(_[_0xaa41('0x1a')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']])){_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]=new ChatQueue(_0x57ef96);}else{_0x392214[_0xaa41('0x17')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']],_0x57ef96);}_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRouting']();_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRealtime']();}}return _0x392214['chatQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x20')]=function(){var _0x534a85=this;return function(_0x392b5d){if(_0x392b5d){freeIsNotKey(_0x392b5d,_0x534a85[_0xaa41('0xc')],'id');for(var _0x4e3b44=0x0,_0x5022fb={},_0x5c25fb={};_0x4e3b44<_0x392b5d[_0xaa41('0x19')];_0x4e3b44+=0x1){_0x5022fb=_0x392b5d[_0x4e3b44];if(_[_0xaa41('0x1a')](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']])){_0x534a85[_0xaa41('0xc')][_0x5022fb['id']]=new SmsQueue(_0x5022fb);}else{_0x534a85['mergeFromDatabase'](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']],_0x5022fb);}_0x534a85[_0xaa41('0xc')][_0x5022fb['id']][_0xaa41('0x21')]();_0x534a85['smsQueues'][_0x5022fb['id']][_0xaa41('0x22')]();}}return _0x534a85[_0xaa41('0xc')];};};Realtime[_0xaa41('0x16')]['initMailQueues']=function(){var _0x252c62=this;return function(_0x374117){if(_0x374117){freeIsNotKey(_0x374117,_0x252c62['mailQueues'],'id');for(var _0x23eb50=0x0,_0x13b6d4={},_0x2298ed={};_0x23eb50<_0x374117['length'];_0x23eb50+=0x1){_0x13b6d4=_0x374117[_0x23eb50];if(_[_0xaa41('0x1a')](_0x252c62['mailQueues'][_0x13b6d4['id']])){_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']]=new MailQueue(_0x13b6d4);}else{_0x252c62[_0xaa41('0x17')](_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']],_0x13b6d4);}_0x252c62['mailQueues'][_0x13b6d4['id']]['updateRouting']();_0x252c62['mailQueues'][_0x13b6d4['id']][_0xaa41('0x22')]();}}return _0x252c62[_0xaa41('0xd')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x23')]=function(){var _0x4fbb92=this;return function(_0x53a2e4){if(_0x53a2e4){freeIsNotKey(_0x53a2e4,_0x4fbb92[_0xaa41('0x24')],'id');for(var _0x5673c=0x0,_0x951e52={},_0x4e8d2e={};_0x5673c<_0x53a2e4[_0xaa41('0x19')];_0x5673c+=0x1){_0x951e52=_0x53a2e4[_0x5673c];if(_[_0xaa41('0x1a')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']])){_0x4fbb92['faxQueues'][_0x951e52['id']]=new FaxQueue(_0x951e52);}else{_0x4fbb92[_0xaa41('0x17')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']],_0x951e52);}_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']][_0xaa41('0x21')]();_0x4fbb92['faxQueues'][_0x951e52['id']]['updateRealtime']();}}return _0x4fbb92[_0xaa41('0x24')];};};Realtime[_0xaa41('0x16')]['initWhatsappQueues']=function(){var _0x4101ab=this;return function(_0x563687){if(_0x563687){freeIsNotKey(_0x563687,_0x4101ab[_0xaa41('0xe')],'id');for(var _0x25f2df=0x0,_0x1a2d11={},_0x466eee={};_0x25f2df<_0x563687[_0xaa41('0x19')];_0x25f2df+=0x1){_0x1a2d11=_0x563687[_0x25f2df];if(_[_0xaa41('0x1a')](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']])){_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']]=new WhatsappQueue(_0x1a2d11);}else{_0x4101ab['mergeFromDatabase'](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']],_0x1a2d11);}_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x21')]();_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x22')]();}}return _0x4101ab[_0xaa41('0xe')];};};module['exports']=Realtime; \ No newline at end of file +var _0x6aa7=['agents','openchannelQueues','chatQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','intervals','isUndefined','updateRealtime','initChatQueues','updateRouting','initMailQueues','mailQueues','initWhatsappQueues','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0x6aa7,0x178));var _0x76aa=function(_0x106a2e,_0x212e84){_0x106a2e=_0x106a2e-0x0;var _0x243436=_0x6aa7[_0x106a2e];return _0x243436;};'use strict';var BPromise=require(_0x76aa('0x0'));var util=require('util');var _=require(_0x76aa('0x1'));var moment=require(_0x76aa('0x2'));var Agent=require(_0x76aa('0x3'));var Interval=require(_0x76aa('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x76aa('0x5'));var SmsQueue=require(_0x76aa('0x6'));var MailQueue=require(_0x76aa('0x7'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0x76aa('0x8')]={};this['intervals']={};this[_0x76aa('0x9')]={};this[_0x76aa('0xa')]={};this[_0x76aa('0xb')]={};this['mailQueues']={};this[_0x76aa('0xc')]={};this[_0x76aa('0xd')]={};this[_0x76aa('0xe')]={};this['mailQueuesWaitingInteractions']={};this[_0x76aa('0xf')]={};this[_0x76aa('0x10')]={};this[_0x76aa('0x11')]={};this[_0x76aa('0x12')]={};};function freeIsNotKey(_0x37f1ab,_0x128435,_0x2c5075){var _0x8dc35c=_[_0x76aa('0x13')](_0x37f1ab,function(_0x17a417,_0x5e5f47){return _0x17a417[_0x2c5075];});for(var _0x112c39 in _0x128435){if(_0x128435['hasOwnProperty'](_0x112c39)){if(!_0x8dc35c[_0x112c39]){delete _0x128435[_0x112c39];}}}}Realtime[_0x76aa('0x14')][_0x76aa('0x15')]=function(_0x3f8f6b,_0x8e44ed){for(var _0x10432c in _0x8e44ed){if(_0x3f8f6b['hasOwnProperty'](_0x10432c)){_0x3f8f6b[_0x10432c]=_0x8e44ed[_0x10432c];}}};Realtime['prototype'][_0x76aa('0x16')]=function(){var _0x4cfc34=this;return function(_0x180d92){if(_0x180d92){freeIsNotKey(_0x180d92,_0x4cfc34[_0x76aa('0x8')],'id');for(var _0x5cf594=0x0,_0x2111c7={},_0x550d9a={};_0x5cf594<_0x180d92[_0x76aa('0x17')];_0x5cf594+=0x1){_0x2111c7=_0x180d92[_0x5cf594];if(_['isUndefined'](_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']])){_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']]=new Agent(_0x2111c7);}else{_0x4cfc34[_0x76aa('0x15')](_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']],_0x2111c7);}}}return _0x4cfc34[_0x76aa('0x8')];};};Realtime[_0x76aa('0x14')]['initIntervals']=function(){var _0x5d6202=this;return function(_0x256636){if(_0x256636){freeIsNotKey(_0x256636,_0x5d6202[_0x76aa('0x18')],'id');for(var _0xf0711=0x0,_0x15b931={},_0x15109b={};_0xf0711<_0x256636[_0x76aa('0x17')];_0xf0711+=0x1){_0x15b931=_0x256636[_0xf0711];if(_[_0x76aa('0x19')](_0x5d6202[_0x76aa('0x18')][_0x15b931['id']])){_0x5d6202[_0x76aa('0x18')][_0x15b931['id']]=new Interval(_0x15b931);}else{_0x5d6202['mergeFromDatabase'](_0x5d6202[_0x76aa('0x18')][_0x15b931['id']],_0x15b931);}}}return _0x5d6202[_0x76aa('0x18')];};};Realtime[_0x76aa('0x14')]['initOpenchannelQueues']=function(){var _0x41463a=this;return function(_0x189cb6){if(_0x189cb6){freeIsNotKey(_0x189cb6,_0x41463a[_0x76aa('0x9')],'id');for(var _0x2bd2c6=0x0,_0x29c50c={},_0xc1044c={};_0x2bd2c6<_0x189cb6[_0x76aa('0x17')];_0x2bd2c6+=0x1){_0x29c50c=_0x189cb6[_0x2bd2c6];if(_[_0x76aa('0x19')](_0x41463a[_0x76aa('0x9')][_0x29c50c['id']])){_0x41463a[_0x76aa('0x9')][_0x29c50c['id']]=new OpenchannelQueue(_0x29c50c);}else{_0x41463a[_0x76aa('0x15')](_0x41463a[_0x76aa('0x9')][_0x29c50c['id']],_0x29c50c);}_0x41463a[_0x76aa('0x9')][_0x29c50c['id']]['updateRouting']();_0x41463a[_0x76aa('0x9')][_0x29c50c['id']][_0x76aa('0x1a')]();}}return _0x41463a[_0x76aa('0x9')];};};Realtime[_0x76aa('0x14')][_0x76aa('0x1b')]=function(){var _0x2f9316=this;return function(_0x25a803){if(_0x25a803){freeIsNotKey(_0x25a803,_0x2f9316[_0x76aa('0xa')],'id');for(var _0xd12a99=0x0,_0x1bdc3d={},_0x545b06={};_0xd12a99<_0x25a803[_0x76aa('0x17')];_0xd12a99+=0x1){_0x1bdc3d=_0x25a803[_0xd12a99];if(_['isUndefined'](_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']])){_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']]=new ChatQueue(_0x1bdc3d);}else{_0x2f9316[_0x76aa('0x15')](_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']],_0x1bdc3d);}_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']][_0x76aa('0x1c')]();_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']][_0x76aa('0x1a')]();}}return _0x2f9316[_0x76aa('0xa')];};};Realtime[_0x76aa('0x14')]['initSmsQueues']=function(){var _0x430ad6=this;return function(_0x5532c7){if(_0x5532c7){freeIsNotKey(_0x5532c7,_0x430ad6[_0x76aa('0xb')],'id');for(var _0x928ccf=0x0,_0x458ac3={},_0x38ecd1={};_0x928ccf<_0x5532c7[_0x76aa('0x17')];_0x928ccf+=0x1){_0x458ac3=_0x5532c7[_0x928ccf];if(_['isUndefined'](_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']])){_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']]=new SmsQueue(_0x458ac3);}else{_0x430ad6['mergeFromDatabase'](_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']],_0x458ac3);}_0x430ad6['smsQueues'][_0x458ac3['id']][_0x76aa('0x1c')]();_0x430ad6['smsQueues'][_0x458ac3['id']][_0x76aa('0x1a')]();}}return _0x430ad6['smsQueues'];};};Realtime['prototype'][_0x76aa('0x1d')]=function(){var _0x282c56=this;return function(_0x198fcb){if(_0x198fcb){freeIsNotKey(_0x198fcb,_0x282c56[_0x76aa('0x1e')],'id');for(var _0x595a0f=0x0,_0x592596={},_0xdb18d3={};_0x595a0f<_0x198fcb[_0x76aa('0x17')];_0x595a0f+=0x1){_0x592596=_0x198fcb[_0x595a0f];if(_[_0x76aa('0x19')](_0x282c56[_0x76aa('0x1e')][_0x592596['id']])){_0x282c56[_0x76aa('0x1e')][_0x592596['id']]=new MailQueue(_0x592596);}else{_0x282c56['mergeFromDatabase'](_0x282c56[_0x76aa('0x1e')][_0x592596['id']],_0x592596);}_0x282c56['mailQueues'][_0x592596['id']]['updateRouting']();_0x282c56[_0x76aa('0x1e')][_0x592596['id']][_0x76aa('0x1a')]();}}return _0x282c56[_0x76aa('0x1e')];};};Realtime[_0x76aa('0x14')]['initFaxQueues']=function(){var _0x401c07=this;return function(_0x1c22f7){if(_0x1c22f7){freeIsNotKey(_0x1c22f7,_0x401c07[_0x76aa('0xc')],'id');for(var _0x4e131a=0x0,_0x113770={},_0x1638db={};_0x4e131a<_0x1c22f7[_0x76aa('0x17')];_0x4e131a+=0x1){_0x113770=_0x1c22f7[_0x4e131a];if(_[_0x76aa('0x19')](_0x401c07[_0x76aa('0xc')][_0x113770['id']])){_0x401c07[_0x76aa('0xc')][_0x113770['id']]=new FaxQueue(_0x113770);}else{_0x401c07[_0x76aa('0x15')](_0x401c07[_0x76aa('0xc')][_0x113770['id']],_0x113770);}_0x401c07[_0x76aa('0xc')][_0x113770['id']]['updateRouting']();_0x401c07[_0x76aa('0xc')][_0x113770['id']][_0x76aa('0x1a')]();}}return _0x401c07[_0x76aa('0xc')];};};Realtime[_0x76aa('0x14')][_0x76aa('0x1f')]=function(){var _0x2957aa=this;return function(_0x572fdb){if(_0x572fdb){freeIsNotKey(_0x572fdb,_0x2957aa['whatsappQueues'],'id');for(var _0x153a47=0x0,_0x262906={},_0x426454={};_0x153a47<_0x572fdb[_0x76aa('0x17')];_0x153a47+=0x1){_0x262906=_0x572fdb[_0x153a47];if(_['isUndefined'](_0x2957aa[_0x76aa('0xd')][_0x262906['id']])){_0x2957aa[_0x76aa('0xd')][_0x262906['id']]=new WhatsappQueue(_0x262906);}else{_0x2957aa[_0x76aa('0x15')](_0x2957aa[_0x76aa('0xd')][_0x262906['id']],_0x262906);}_0x2957aa[_0x76aa('0xd')][_0x262906['id']]['updateRouting']();_0x2957aa[_0x76aa('0xd')][_0x262906['id']]['updateRealtime']();}}return _0x2957aa[_0x76aa('0xd')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 3255893..ecc8007 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 _0xb094=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','../client'];(function(_0x24e48c,_0x3b6352){var _0x5be973=function(_0x3b176e){while(--_0x3b176e){_0x24e48c['push'](_0x24e48c['shift']());}};_0x5be973(++_0x3b6352);}(_0xb094,0x1f1));var _0x4b09=function(_0x2c39c3,_0x3d9848){_0x2c39c3=_0x2c39c3-0x0;var _0x74f703=_0xb094[_0x2c39c3];return _0x74f703;};'use strict';var client=require(_0x4b09('0x0'));exports[_0x4b09('0x1')]=function(_0x1b6f40,_0x17e492){return client[_0x4b09('0x2')](_0x4b09('0x3'),{'body':_0x17e492,'options':{'where':{'id':_0x1b6f40}},'log':_0x4b09('0x4')});};exports[_0x4b09('0x5')]=function(_0x990175,_0x484e97){return client[_0x4b09('0x2')]('AddTagsToChatInteraction',{'body':_0x484e97,'options':{'where':{'id':_0x990175}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xe25f=['AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xe25f,0xaf));var _0xfe25=function(_0x1ffe2c,_0x2b908b){_0x1ffe2c=_0x1ffe2c-0x0;var _0x5345ca=_0xe25f[_0x1ffe2c];return _0x5345ca;};'use strict';var client=require(_0xfe25('0x0'));exports[_0xfe25('0x1')]=function(_0x223502,_0x17b236){return client[_0xfe25('0x2')](_0xfe25('0x3'),{'body':_0x17b236,'options':{'where':{'id':_0x223502}},'log':_0xfe25('0x4')});};exports['addTags']=function(_0x52e732,_0x27a40a){return client[_0xfe25('0x2')](_0xfe25('0x5'),{'body':_0x27a40a,'options':{'where':{'id':_0x52e732}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index c8302b8..4b4108c 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 _0x7087=['createChatMessage'];(function(_0x4607e1,_0x1b8d24){var _0x7a18c0=function(_0x1deae4){while(--_0x1deae4){_0x4607e1['push'](_0x4607e1['shift']());}};_0x7a18c0(++_0x1b8d24);}(_0x7087,0x1bd));var _0x7708=function(_0x1b1e7c,_0x5ac786){_0x1b1e7c=_0x1b1e7c-0x0;var _0x26c9e4=_0x7087[_0x1b1e7c];return _0x26c9e4;};'use strict';var client=require('../client');exports['create']=function(_0x12a8fb){return client['Request']('CreateChatMessage',{'body':_0x12a8fb,'log':_0x7708('0x0')});}; \ No newline at end of file +var _0x7527=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x2be28d,_0x307cdc){var _0x558b42=function(_0x413bcd){while(--_0x413bcd){_0x2be28d['push'](_0x2be28d['shift']());}};_0x558b42(++_0x307cdc);}(_0x7527,0x105));var _0x7752=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7527[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7752('0x0'));exports[_0x7752('0x1')]=function(_0x2d3817){return client[_0x7752('0x2')](_0x7752('0x3'),{'body':_0x2d3817,'log':_0x7752('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 0a4cd17..64eec0b 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 _0x5de4=['../client','getChatQueues','Request','GetChatQueue','timeout','strategy','Agents','name','online'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x5de4,0x1b0));var _0x45de=function(_0x196edc,_0x2867b2){_0x196edc=_0x196edc-0x0;var _0x454c26=_0x5de4[_0x196edc];return _0x454c26;};'use strict';var client=require(_0x45de('0x0'));exports[_0x45de('0x1')]=function(){return function(){return client[_0x45de('0x2')](_0x45de('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x45de('0x4'),_0x45de('0x5')],'include':[{'model':'User','as':_0x45de('0x6'),'attributes':['id',_0x45de('0x7'),_0x45de('0x8'),'chatPause']}]},'log':_0x45de('0x1')});};}; \ No newline at end of file +var _0x0b2a=['GetChatQueue','User','name','online','chatPause','../client','getChatQueues','Request'];(function(_0x267e45,_0x4e639f){var _0x4211dd=function(_0x46a6d6){while(--_0x46a6d6){_0x267e45['push'](_0x267e45['shift']());}};_0x4211dd(++_0x4e639f);}(_0x0b2a,0x7d));var _0xa0b2=function(_0x1e7fab,_0x49eebd){_0x1e7fab=_0x1e7fab-0x0;var _0x2cd018=_0x0b2a[_0x1e7fab];return _0x2cd018;};'use strict';var client=require(_0xa0b2('0x0'));exports[_0xa0b2('0x1')]=function(){return function(){return client[_0xa0b2('0x2')](_0xa0b2('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xa0b2('0x4'),'as':'Agents','attributes':['id',_0xa0b2('0x5'),_0xa0b2('0x6'),_0xa0b2('0x7')]}]},'log':_0xa0b2('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 8c1b17d..d6df5c1 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 _0x8a1b=['UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x447ec0,_0x98a7ec){var _0x30e572=function(_0x178b4c){while(--_0x178b4c){_0x447ec0['push'](_0x447ec0['shift']());}};_0x30e572(++_0x98a7ec);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x184bfa,_0x2fdf77){_0x184bfa=_0x184bfa-0x0;var _0x47999b=_0x8a1b[_0x184bfa];return _0x47999b;};'use strict';var client=require(_0xb8a1('0x0'));exports[_0xb8a1('0x1')]=function(_0x50a877){return client[_0xb8a1('0x2')](_0xb8a1('0x3'),{'body':_0x50a877,'log':'CreateChatQueueReport'});};exports['update']=function(_0x3784e8,_0x3b6246){return client[_0xb8a1('0x2')](_0xb8a1('0x4'),{'body':_0x3b6246,'options':{'where':{'uniqueid':_0x3784e8},'order':[['id',_0xb8a1('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xe062=['Request','CreateChatQueueReport','UpdateChatQueueReport','../client','create'];(function(_0x67714a,_0x550d17){var _0x468499=function(_0x4a272a){while(--_0x4a272a){_0x67714a['push'](_0x67714a['shift']());}};_0x468499(++_0x550d17);}(_0xe062,0xd5));var _0x2e06=function(_0x3bd21d,_0x31ee64){_0x3bd21d=_0x3bd21d-0x0;var _0x5b2fa3=_0xe062[_0x3bd21d];return _0x5b2fa3;};'use strict';var client=require(_0x2e06('0x0'));exports[_0x2e06('0x1')]=function(_0x4827bc){return client[_0x2e06('0x2')](_0x2e06('0x3'),{'body':_0x4827bc,'log':_0x2e06('0x3')});};exports['update']=function(_0x4d80de,_0x1a9d7d){return client[_0x2e06('0x2')]('UpdateChatQueueReport',{'body':_0x1a9d7d,'options':{'where':{'uniqueid':_0x4d80de},'order':[['id','DESC']],'limit':0x1},'log':_0x2e06('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 3f133db..6e844e6 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 _0xcb7f=['updateFaxInteraction','addTags','Request','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction'];(function(_0x43f9ac,_0x279c97){var _0x5e7fb4=function(_0x31408c){while(--_0x31408c){_0x43f9ac['push'](_0x43f9ac['shift']());}};_0x5e7fb4(++_0x279c97);}(_0xcb7f,0xa5));var _0xfcb7=function(_0x560514,_0x1e71b0){_0x560514=_0x560514-0x0;var _0x187b23=_0xcb7f[_0x560514];return _0x187b23;};'use strict';var client=require(_0xfcb7('0x0'));exports[_0xfcb7('0x1')]=function(_0x52a511,_0x2673db){return client['Request'](_0xfcb7('0x2'),{'body':_0x2673db,'options':{'where':{'id':_0x52a511}},'log':_0xfcb7('0x3')});};exports[_0xfcb7('0x4')]=function(_0x1a0789,_0x4b2cfb){return client[_0xfcb7('0x5')]('AddTagsToFaxInteraction',{'body':_0x4b2cfb,'options':{'where':{'id':_0x1a0789}},'log':_0xfcb7('0x6')});}; \ No newline at end of file +var _0x9fce=['AddTagsToFaxInteraction','addTagsToFaxInteraction','update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0x9fce,0x6b));var _0xe9fc=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x9fce[_0x496333];return _0x44256e;};'use strict';var client=require('../client');exports[_0xe9fc('0x0')]=function(_0x23b5e0,_0x44b6ef){return client[_0xe9fc('0x1')](_0xe9fc('0x2'),{'body':_0x44b6ef,'options':{'where':{'id':_0x23b5e0}},'log':_0xe9fc('0x3')});};exports[_0xe9fc('0x4')]=function(_0x1ea65f,_0x4e611d){return client[_0xe9fc('0x1')](_0xe9fc('0x5'),{'body':_0x4e611d,'options':{'where':{'id':_0x1ea65f}},'log':_0xe9fc('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index f762e1b..a163d3e 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 _0x8ce2=['create','../client'];(function(_0x55522e,_0x598c57){var _0x160054=function(_0x387b2a){while(--_0x387b2a){_0x55522e['push'](_0x55522e['shift']());}};_0x160054(++_0x598c57);}(_0x8ce2,0x6f));var _0x28ce=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x8ce2[_0x58afd5];return _0x3e503b;};'use strict';var client=require(_0x28ce('0x0'));exports[_0x28ce('0x1')]=function(_0x17fd4d){return client['Request']('CreateFaxMessage',{'body':_0x17fd4d,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x51aa=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x51aa,0x100));var _0xa51a=function(_0x93ecaf,_0x351960){_0x93ecaf=_0x93ecaf-0x0;var _0x612d9b=_0x51aa[_0x93ecaf];return _0x612d9b;};'use strict';var client=require(_0xa51a('0x0'));exports[_0xa51a('0x1')]=function(_0x5800ba){return client[_0xa51a('0x2')](_0xa51a('0x3'),{'body':_0x5800ba,'log':_0xa51a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 023b4c8..23149de 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 _0x2094=['Request','GetFaxQueue','name','timeout','strategy','User','Agents','online','faxPause','getFaxQueues'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x2094,0x190));var _0x4209=function(_0x33414c,_0x36167f){_0x33414c=_0x33414c-0x0;var _0x55ee86=_0x2094[_0x33414c];return _0x55ee86;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x4209('0x0')](_0x4209('0x1'),{'options':{'raw':![],'attributes':['id',_0x4209('0x2'),_0x4209('0x3'),_0x4209('0x4')],'include':[{'model':_0x4209('0x5'),'as':_0x4209('0x6'),'attributes':['id',_0x4209('0x2'),_0x4209('0x7'),_0x4209('0x8')]}]},'log':_0x4209('0x9')});};}; \ No newline at end of file +var _0x448f=['name','strategy','online','faxPause','getFaxQueues','../client','GetFaxQueue'];(function(_0x1a5829,_0xb5777d){var _0x38dc38=function(_0x5fc8d7){while(--_0x5fc8d7){_0x1a5829['push'](_0x1a5829['shift']());}};_0x38dc38(++_0xb5777d);}(_0x448f,0xa6));var _0xf448=function(_0x13cd99,_0x50bd8d){_0x13cd99=_0x13cd99-0x0;var _0x1d42c7=_0x448f[_0x13cd99];return _0x1d42c7;};'use strict';var client=require(_0xf448('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0xf448('0x1'),{'options':{'raw':![],'attributes':['id',_0xf448('0x2'),'timeout',_0xf448('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xf448('0x2'),_0xf448('0x4'),_0xf448('0x5')]}]},'log':_0xf448('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0147396..8a6c00e 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 _0x4d33=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0xb23c62,_0x40ccce){var _0xec7ab7=function(_0x3a4f00){while(--_0x3a4f00){_0xb23c62['push'](_0xb23c62['shift']());}};_0xec7ab7(++_0x40ccce);}(_0x4d33,0x140));var _0x34d3=function(_0x3792e6,_0x32bd91){_0x3792e6=_0x3792e6-0x0;var _0x441e44=_0x4d33[_0x3792e6];return _0x441e44;};'use strict';var client=require(_0x34d3('0x0'));exports[_0x34d3('0x1')]=function(_0x51db66){return client[_0x34d3('0x2')](_0x34d3('0x3'),{'body':_0x51db66,'log':_0x34d3('0x3')});};exports[_0x34d3('0x4')]=function(_0x47778d,_0x5c0626){return client['Request'](_0x34d3('0x5'),{'body':_0x5c0626,'options':{'where':{'uniqueid':_0x47778d},'order':[['id',_0x34d3('0x6')]],'limit':0x1},'log':_0x34d3('0x5')});}; \ No newline at end of file +var _0x9a14=['Request','CreateFaxQueueReport','UpdateFaxQueueReport','create'];(function(_0x2df3e1,_0x58f363){var _0x7f5cb2=function(_0x1ef4f2){while(--_0x1ef4f2){_0x2df3e1['push'](_0x2df3e1['shift']());}};_0x7f5cb2(++_0x58f363);}(_0x9a14,0x1d3));var _0x49a1=function(_0x31977b,_0x40e327){_0x31977b=_0x31977b-0x0;var _0x351ad8=_0x9a14[_0x31977b];return _0x351ad8;};'use strict';var client=require('../client');exports[_0x49a1('0x0')]=function(_0x981521){return client[_0x49a1('0x1')]('CreateFaxQueueReport',{'body':_0x981521,'log':_0x49a1('0x2')});};exports['update']=function(_0x33fd13,_0x37c849){return client['Request']('UpdateFaxQueueReport',{'body':_0x37c849,'options':{'where':{'uniqueid':_0x33fd13},'order':[['id','DESC']],'limit':0x1},'log':_0x49a1('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index d350143..93d9589 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 _0x2547=['Request','GetInterval','name','Interval','Intervals','interval','getIntervals'];(function(_0x55b3b5,_0x254983){var _0x5297a9=function(_0x5f302f){while(--_0x5f302f){_0x55b3b5['push'](_0x55b3b5['shift']());}};_0x5297a9(++_0x254983);}(_0x2547,0x1cd));var _0x7254=function(_0x134139,_0x6d3f3d){_0x134139=_0x134139-0x0;var _0x350a0b=_0x2547[_0x134139];return _0x350a0b;};'use strict';var client=require('../client');exports[_0x7254('0x0')]=function(){return function(){return client[_0x7254('0x1')](_0x7254('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7254('0x3')],'include':[{'model':_0x7254('0x4'),'as':_0x7254('0x5'),'attributes':['id',_0x7254('0x3'),_0x7254('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x6b20=['getIntervals','GetInterval','Interval','Intervals','name','../client'];(function(_0x55d82e,_0x525ef9){var _0x472385=function(_0x1f3e0c){while(--_0x1f3e0c){_0x55d82e['push'](_0x55d82e['shift']());}};_0x472385(++_0x525ef9);}(_0x6b20,0xd1));var _0x06b2=function(_0x853e64,_0x2c93bc){_0x853e64=_0x853e64-0x0;var _0x43e814=_0x6b20[_0x853e64];return _0x43e814;};'use strict';var client=require(_0x06b2('0x0'));exports[_0x06b2('0x1')]=function(){return function(){return client['Request'](_0x06b2('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x06b2('0x3'),'as':_0x06b2('0x4'),'attributes':['id',_0x06b2('0x5'),'interval']}]},'log':_0x06b2('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 4987864..d193b7c 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 _0x2c32=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x17e36d,_0x4d3012){var _0x598756=function(_0x2e924a){while(--_0x2e924a){_0x17e36d['push'](_0x17e36d['shift']());}};_0x598756(++_0x4d3012);}(_0x2c32,0xb2));var _0x22c3=function(_0x2e2ae1,_0x9af0a8){_0x2e2ae1=_0x2e2ae1-0x0;var _0xf9c4b0=_0x2c32[_0x2e2ae1];return _0xf9c4b0;};'use strict';var client=require(_0x22c3('0x0'));exports[_0x22c3('0x1')]=function(_0x462aae,_0xedde61){return client[_0x22c3('0x2')](_0x22c3('0x3'),{'body':_0xedde61,'options':{'where':{'id':_0x462aae}},'log':_0x22c3('0x4')});};exports[_0x22c3('0x5')]=function(_0x1c4643,_0x11d455){return client[_0x22c3('0x2')](_0x22c3('0x6'),{'body':_0x11d455,'options':{'where':{'id':_0x1c4643}},'log':_0x22c3('0x7')});}; \ No newline at end of file +var _0x7143=['updateMailInteraction','addTags','addTagsToChatInteraction','update','Request','UpdateMailInteraction'];(function(_0x548079,_0x342269){var _0x3745ce=function(_0x5ea8f8){while(--_0x5ea8f8){_0x548079['push'](_0x548079['shift']());}};_0x3745ce(++_0x342269);}(_0x7143,0x1ef));var _0x3714=function(_0x3f148e,_0x4a2817){_0x3f148e=_0x3f148e-0x0;var _0x37ed47=_0x7143[_0x3f148e];return _0x37ed47;};'use strict';var client=require('../client');exports[_0x3714('0x0')]=function(_0x1c8279,_0x20cfdc){return client[_0x3714('0x1')](_0x3714('0x2'),{'body':_0x20cfdc,'options':{'where':{'id':_0x1c8279}},'log':_0x3714('0x3')});};exports[_0x3714('0x4')]=function(_0x3be6bf,_0x357347){return client[_0x3714('0x1')]('AddTagsToMailInteraction',{'body':_0x357347,'options':{'where':{'id':_0x3be6bf}},'log':_0x3714('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 5a57aa5..65fe7e0 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 _0x6928=['create','Request','CreateMailMessage','../client'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0x6928,0x11f));var _0x8692=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x6928[_0x9cd4c3];return _0x4c9025;};'use strict';var client=require(_0x8692('0x0'));exports[_0x8692('0x1')]=function(_0xecb79b){return client[_0x8692('0x2')](_0x8692('0x3'),{'body':_0xecb79b,'log':'createMailMessage'});}; \ No newline at end of file +var _0x413c=['../client','create'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x413c,0x128));var _0xc413=function(_0x4232a9,_0x3fb42f){_0x4232a9=_0x4232a9-0x0;var _0x41b1fd=_0x413c[_0x4232a9];return _0x41b1fd;};'use strict';var client=require(_0xc413('0x0'));exports[_0xc413('0x1')]=function(_0x58d5ab){return client['Request']('CreateMailMessage',{'body':_0x58d5ab,'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 9e62d05..c015e8a 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 _0xebe4=['User','Agents','mailPause','getMailQueues','Request','name','timeout'];(function(_0x5f5b62,_0x5246f9){var _0x5adce8=function(_0xc9198b){while(--_0xc9198b){_0x5f5b62['push'](_0x5f5b62['shift']());}};_0x5adce8(++_0x5246f9);}(_0xebe4,0x176));var _0x4ebe=function(_0x4b8181,_0x243ff7){_0x4b8181=_0x4b8181-0x0;var _0x372056=_0xebe4[_0x4b8181];return _0x372056;};'use strict';var client=require('../client');exports[_0x4ebe('0x0')]=function(){return function(){return client[_0x4ebe('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x4ebe('0x2'),_0x4ebe('0x3'),'strategy'],'include':[{'model':_0x4ebe('0x4'),'as':_0x4ebe('0x5'),'attributes':['id',_0x4ebe('0x2'),'online',_0x4ebe('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x1ad9=['strategy','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout'];(function(_0x37be3f,_0x527a87){var _0x1b6b8a=function(_0x416e7d){while(--_0x416e7d){_0x37be3f['push'](_0x37be3f['shift']());}};_0x1b6b8a(++_0x527a87);}(_0x1ad9,0x18a));var _0x91ad=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x1ad9[_0x6d6a66];return _0x11eb6e;};'use strict';var client=require(_0x91ad('0x0'));exports[_0x91ad('0x1')]=function(){return function(){return client[_0x91ad('0x2')](_0x91ad('0x3'),{'options':{'raw':![],'attributes':['id',_0x91ad('0x4'),_0x91ad('0x5'),_0x91ad('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0x91ad('0x7')]}]},'log':_0x91ad('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 11374eb..06a2cc2 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 _0xef05=['Request','DESC','UpdateMailQueueReport','../client','create','CreateMailQueueReport','update'];(function(_0x4b6bee,_0x23f984){var _0x167259=function(_0x419bfc){while(--_0x419bfc){_0x4b6bee['push'](_0x4b6bee['shift']());}};_0x167259(++_0x23f984);}(_0xef05,0x1f4));var _0x5ef0=function(_0x442008,_0x5e9f96){_0x442008=_0x442008-0x0;var _0x1d05da=_0xef05[_0x442008];return _0x1d05da;};'use strict';var client=require(_0x5ef0('0x0'));exports[_0x5ef0('0x1')]=function(_0x62fd5){return client['Request'](_0x5ef0('0x2'),{'body':_0x62fd5,'log':_0x5ef0('0x2')});};exports[_0x5ef0('0x3')]=function(_0x5f0cb8,_0x5572fb){return client[_0x5ef0('0x4')]('UpdateMailQueueReport',{'body':_0x5572fb,'options':{'where':{'uniqueid':_0x5f0cb8},'order':[['id',_0x5ef0('0x5')]],'limit':0x1},'log':_0x5ef0('0x6')});}; \ No newline at end of file +var _0x06da=['UpdateMailQueueReport','../client','create','CreateMailQueueReport','update','Request'];(function(_0x715d76,_0x402d60){var _0x48fe88=function(_0x4dd0ea){while(--_0x4dd0ea){_0x715d76['push'](_0x715d76['shift']());}};_0x48fe88(++_0x402d60);}(_0x06da,0x175));var _0xa06d=function(_0x553df4,_0x450fda){_0x553df4=_0x553df4-0x0;var _0x57cf50=_0x06da[_0x553df4];return _0x57cf50;};'use strict';var client=require(_0xa06d('0x0'));exports[_0xa06d('0x1')]=function(_0x1f5947){return client['Request']('CreateMailQueueReport',{'body':_0x1f5947,'log':_0xa06d('0x2')});};exports[_0xa06d('0x3')]=function(_0x2296d0,_0x3e3962){return client[_0xa06d('0x4')]('UpdateMailQueueReport',{'body':_0x3e3962,'options':{'where':{'uniqueid':_0x2296d0},'order':[['id','DESC']],'limit':0x1},'log':_0xa06d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 6883b19..ffb51ce 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 _0x1c95=['updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x4d9a42,_0x4baeaa){var _0x5833d3=function(_0x28f854){while(--_0x28f854){_0x4d9a42['push'](_0x4d9a42['shift']());}};_0x5833d3(++_0x4baeaa);}(_0x1c95,0x14c));var _0x51c9=function(_0x2636f2,_0x24a579){_0x2636f2=_0x2636f2-0x0;var _0x4b73c6=_0x1c95[_0x2636f2];return _0x4b73c6;};'use strict';var client=require(_0x51c9('0x0'));exports[_0x51c9('0x1')]=function(_0x3e7fee,_0x38fc81){return client[_0x51c9('0x2')](_0x51c9('0x3'),{'body':_0x38fc81,'options':{'where':{'id':_0x3e7fee}},'log':_0x51c9('0x4')});};exports['addTags']=function(_0x3be57b,_0x1d3009){return client['Request'](_0x51c9('0x5'),{'body':_0x1d3009,'options':{'where':{'id':_0x3be57b}},'log':_0x51c9('0x6')});}; \ No newline at end of file +var _0xd71b=['updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','UpdateOpenchannelInteraction'];(function(_0x48fddb,_0x37a2d3){var _0x22dad1=function(_0x4d32d6){while(--_0x4d32d6){_0x48fddb['push'](_0x48fddb['shift']());}};_0x22dad1(++_0x37a2d3);}(_0xd71b,0x8a));var _0xbd71=function(_0x4d03a6,_0x49a125){_0x4d03a6=_0x4d03a6-0x0;var _0x51e350=_0xd71b[_0x4d03a6];return _0x51e350;};'use strict';var client=require(_0xbd71('0x0'));exports['update']=function(_0x458391,_0xd63182){return client['Request'](_0xbd71('0x1'),{'body':_0xd63182,'options':{'where':{'id':_0x458391}},'log':_0xbd71('0x2')});};exports[_0xbd71('0x3')]=function(_0x1bf7b3,_0x29e2bf){return client[_0xbd71('0x4')](_0xbd71('0x5'),{'body':_0x29e2bf,'options':{'where':{'id':_0x1bf7b3}},'log':_0xbd71('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index d85c8eb..91e257e 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 _0xbec5=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0xabdff3,_0x47dff3){var _0x41e5d4=function(_0x315d75){while(--_0x315d75){_0xabdff3['push'](_0xabdff3['shift']());}};_0x41e5d4(++_0x47dff3);}(_0xbec5,0xe5));var _0x5bec=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0xbec5[_0x5235a6];return _0x1cf37e;};'use strict';var client=require(_0x5bec('0x0'));exports[_0x5bec('0x1')]=function(_0x4cfc3b){return client[_0x5bec('0x2')](_0x5bec('0x3'),{'body':_0x4cfc3b,'log':_0x5bec('0x4')});}; \ No newline at end of file +var _0xf109=['../client','create'];(function(_0x42eef9,_0x465269){var _0x157ba3=function(_0x330226){while(--_0x330226){_0x42eef9['push'](_0x42eef9['shift']());}};_0x157ba3(++_0x465269);}(_0xf109,0xce));var _0x9f10=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xf109[_0x31ced5];return _0x10d9e5;};'use strict';var client=require(_0x9f10('0x0'));exports[_0x9f10('0x1')]=function(_0x44c4f2){return client['Request']('CreateOpenchannelMessage',{'body':_0x44c4f2,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index b46f1e1..6a3da41 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 _0x7b97=['name','strategy','User','Agents','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x563a1e,_0x4581f2){var _0x516582=function(_0x2aed4a){while(--_0x2aed4a){_0x563a1e['push'](_0x563a1e['shift']());}};_0x516582(++_0x4581f2);}(_0x7b97,0x83));var _0x77b9=function(_0x362e87,_0x38d17c){_0x362e87=_0x362e87-0x0;var _0x334244=_0x7b97[_0x362e87];return _0x334244;};'use strict';var client=require(_0x77b9('0x0'));exports[_0x77b9('0x1')]=function(){return function(){return client[_0x77b9('0x2')](_0x77b9('0x3'),{'options':{'raw':![],'attributes':['id',_0x77b9('0x4'),'timeout',_0x77b9('0x5')],'include':[{'model':_0x77b9('0x6'),'as':_0x77b9('0x7'),'attributes':['id',_0x77b9('0x4'),_0x77b9('0x8'),'openchannelPause']}]},'log':_0x77b9('0x1')});};}; \ No newline at end of file +var _0x750f=['strategy','User','Agents','online','getOpenchannelQueues','Request','name','timeout'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0x750f,0x1bc));var _0xf750=function(_0x285f11,_0x127c25){_0x285f11=_0x285f11-0x0;var _0x498400=_0x750f[_0x285f11];return _0x498400;};'use strict';var client=require('../client');exports[_0xf750('0x0')]=function(){return function(){return client[_0xf750('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xf750('0x2'),_0xf750('0x3'),_0xf750('0x4')],'include':[{'model':_0xf750('0x5'),'as':_0xf750('0x6'),'attributes':['id',_0xf750('0x2'),_0xf750('0x7'),'openchannelPause']}]},'log':_0xf750('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index b5f9010..e5e9e03 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 _0x08a1=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','create'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x08a1,0xe3));var _0x108a=function(_0x14f06e,_0x2aab44){_0x14f06e=_0x14f06e-0x0;var _0x484e92=_0x08a1[_0x14f06e];return _0x484e92;};'use strict';var client=require('../client');exports[_0x108a('0x0')]=function(_0x50b4e1){return client[_0x108a('0x1')](_0x108a('0x2'),{'body':_0x50b4e1,'log':'CreateOpenchannelQueueReport'});};exports[_0x108a('0x3')]=function(_0x127075,_0xa8245d){return client[_0x108a('0x1')](_0x108a('0x4'),{'body':_0xa8245d,'options':{'where':{'uniqueid':_0x127075},'order':[['id',_0x108a('0x5')]],'limit':0x1},'log':_0x108a('0x4')});}; \ No newline at end of file +var _0x534d=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x54be4c,_0x46690a){var _0x37ee45=function(_0xd41ae7){while(--_0xd41ae7){_0x54be4c['push'](_0x54be4c['shift']());}};_0x37ee45(++_0x46690a);}(_0x534d,0x1e8));var _0xd534=function(_0x2bddaf,_0x12a132){_0x2bddaf=_0x2bddaf-0x0;var _0x1e5d88=_0x534d[_0x2bddaf];return _0x1e5d88;};'use strict';var client=require(_0xd534('0x0'));exports[_0xd534('0x1')]=function(_0x5c8a64){return client[_0xd534('0x2')]('CreateOpenchannelQueueReport',{'body':_0x5c8a64,'log':_0xd534('0x3')});};exports[_0xd534('0x4')]=function(_0x5d3dbb,_0x79c453){return client[_0xd534('0x2')](_0xd534('0x5'),{'body':_0x79c453,'options':{'where':{'uniqueid':_0x5d3dbb},'order':[['id',_0xd534('0x6')]],'limit':0x1},'log':_0xd534('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 18e7653..14b24d9 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 _0xdc9e=['UpdateSmsInteraction','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x51203f,_0x56c9a6){var _0x1a0fd6=function(_0x3649ce){while(--_0x3649ce){_0x51203f['push'](_0x51203f['shift']());}};_0x1a0fd6(++_0x56c9a6);}(_0xdc9e,0x76));var _0xedc9=function(_0x576dee,_0x4efe1b){_0x576dee=_0x576dee-0x0;var _0x302971=_0xdc9e[_0x576dee];return _0x302971;};'use strict';var client=require('../client');exports[_0xedc9('0x0')]=function(_0x22bb16,_0x4e0a42){return client['Request'](_0xedc9('0x1'),{'body':_0x4e0a42,'options':{'where':{'id':_0x22bb16}},'log':_0xedc9('0x2')});};exports[_0xedc9('0x3')]=function(_0x56cbcf,_0x5ebaa1){return client[_0xedc9('0x4')](_0xedc9('0x5'),{'body':_0x5ebaa1,'options':{'where':{'id':_0x56cbcf}},'log':_0xedc9('0x6')});}; \ No newline at end of file +var _0xb1e0=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','Request','UpdateSmsInteraction'];(function(_0x27204e,_0x583057){var _0x2b86dd=function(_0x4a4b02){while(--_0x4a4b02){_0x27204e['push'](_0x27204e['shift']());}};_0x2b86dd(++_0x583057);}(_0xb1e0,0x12a));var _0x0b1e=function(_0x27060f,_0x11df63){_0x27060f=_0x27060f-0x0;var _0x262a54=_0xb1e0[_0x27060f];return _0x262a54;};'use strict';var client=require('../client');exports['update']=function(_0x4471e3,_0x2e762f){return client[_0x0b1e('0x0')](_0x0b1e('0x1'),{'body':_0x2e762f,'options':{'where':{'id':_0x4471e3}},'log':_0x0b1e('0x2')});};exports[_0x0b1e('0x3')]=function(_0x19b78e,_0x22e0df){return client[_0x0b1e('0x0')](_0x0b1e('0x4'),{'body':_0x22e0df,'options':{'where':{'id':_0x19b78e}},'log':_0x0b1e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ad9b60e..a6e593e 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 _0x176d=['create','Request','../client'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x176d,0x16d));var _0xd176=function(_0x3faa16,_0x22900e){_0x3faa16=_0x3faa16-0x0;var _0x7f37c8=_0x176d[_0x3faa16];return _0x7f37c8;};'use strict';var client=require(_0xd176('0x0'));exports[_0xd176('0x1')]=function(_0xf6ec0){return client[_0xd176('0x2')]('CreateSmsMessage',{'body':_0xf6ec0,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x5afe=['create','Request','createSmsMessage','../client'];(function(_0x1e1f12,_0x27f9fb){var _0xf63aff=function(_0x4bdffa){while(--_0x4bdffa){_0x1e1f12['push'](_0x1e1f12['shift']());}};_0xf63aff(++_0x27f9fb);}(_0x5afe,0x1ab));var _0xe5af=function(_0x295771,_0x11e035){_0x295771=_0x295771-0x0;var _0x5130ee=_0x5afe[_0x295771];return _0x5130ee;};'use strict';var client=require(_0xe5af('0x0'));exports[_0xe5af('0x1')]=function(_0x1af50d){return client[_0xe5af('0x2')]('CreateSmsMessage',{'body':_0x1af50d,'log':_0xe5af('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index aaab752..00137bf 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 _0x4db1=['Agents','name','online','smsPause','../client','getSmsQueues','Request','timeout','User'];(function(_0x345b1b,_0x14f1ef){var _0x36379a=function(_0x2a85b0){while(--_0x2a85b0){_0x345b1b['push'](_0x345b1b['shift']());}};_0x36379a(++_0x14f1ef);}(_0x4db1,0xa6));var _0x14db=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x4db1[_0x2dd390];return _0x3afe47;};'use strict';var client=require(_0x14db('0x0'));exports[_0x14db('0x1')]=function(){return function(){return client[_0x14db('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x14db('0x3'),'strategy'],'include':[{'model':_0x14db('0x4'),'as':_0x14db('0x5'),'attributes':['id',_0x14db('0x6'),_0x14db('0x7'),_0x14db('0x8')]}]},'log':_0x14db('0x1')});};}; \ No newline at end of file +var _0x2a8b=['timeout','online','../client','getSmsQueues','Request','name'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x2a8b,0x10a));var _0xb2a8=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x2a8b[_0x4243a3];return _0x1b2a33;};'use strict';var client=require(_0xb2a8('0x0'));exports[_0xb2a8('0x1')]=function(){return function(){return client[_0xb2a8('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0xb2a8('0x3'),_0xb2a8('0x4'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0xb2a8('0x5'),'smsPause']}]},'log':_0xb2a8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 770eebc..3c20845 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 _0xcac2=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','create'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xcac2,0x1e8));var _0x2cac=function(_0x5537b3,_0x224235){_0x5537b3=_0x5537b3-0x0;var _0x3f4175=_0xcac2[_0x5537b3];return _0x3f4175;};'use strict';var client=require(_0x2cac('0x0'));exports[_0x2cac('0x1')]=function(_0x26e82c){return client['Request'](_0x2cac('0x2'),{'body':_0x26e82c,'log':_0x2cac('0x2')});};exports['update']=function(_0x5f217f,_0x4a493b){return client['Request'](_0x2cac('0x3'),{'body':_0x4a493b,'options':{'where':{'uniqueid':_0x5f217f},'order':[['id',_0x2cac('0x4')]],'limit':0x1},'log':_0x2cac('0x3')});}; \ No newline at end of file +var _0x3f2e=['update','UpdateSmsQueueReport','../client','Request','CreateSmsQueueReport'];(function(_0x2d0b5e,_0x361649){var _0x16439b=function(_0x19de23){while(--_0x19de23){_0x2d0b5e['push'](_0x2d0b5e['shift']());}};_0x16439b(++_0x361649);}(_0x3f2e,0x9d));var _0xe3f2=function(_0x53dd63,_0x5e1852){_0x53dd63=_0x53dd63-0x0;var _0x460c0a=_0x3f2e[_0x53dd63];return _0x460c0a;};'use strict';var client=require(_0xe3f2('0x0'));exports['create']=function(_0x2a94e4){return client[_0xe3f2('0x1')](_0xe3f2('0x2'),{'body':_0x2a94e4,'log':_0xe3f2('0x2')});};exports[_0xe3f2('0x3')]=function(_0x3f28f6,_0xef4c52){return client['Request'](_0xe3f2('0x4'),{'body':_0xef4c52,'options':{'where':{'uniqueid':_0x3f28f6},'order':[['id','DESC']],'limit':0x1},'log':_0xe3f2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index c1e3a0e..ab0f728 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 _0x0395=['smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','../client','agent','name','online','pauseType','lastPauseAt','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity'];(function(_0x40bfaa,_0x243486){var _0x14be7c=function(_0x19909e){while(--_0x19909e){_0x40bfaa['push'](_0x40bfaa['shift']());}};_0x14be7c(++_0x243486);}(_0x0395,0x1c6));var _0x5039=function(_0x4a489f,_0x5402ab){_0x4a489f=_0x4a489f-0x0;var _0x4a4137=_0x0395[_0x4a489f];return _0x4a4137;};'use strict';var client=require(_0x5039('0x0'));exports['getAgents']=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x5039('0x1')},'attributes':['id',_0x5039('0x2'),_0x5039('0x3'),_0x5039('0x4'),_0x5039('0x5'),'voicePause',_0x5039('0x6'),_0x5039('0x7'),_0x5039('0x8'),_0x5039('0x9'),'whatsappPause',_0x5039('0xa'),_0x5039('0xb'),_0x5039('0xc'),_0x5039('0xd'),_0x5039('0xe'),_0x5039('0xf'),_0x5039('0x10')]},'log':_0x5039('0x11')});};}; \ No newline at end of file +var _0x7a45=['faxCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','pauseType','lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity'];(function(_0x5c0d3c,_0x5919f0){var _0x1d0508=function(_0x5ad35d){while(--_0x5ad35d){_0x5c0d3c['push'](_0x5c0d3c['shift']());}};_0x1d0508(++_0x5919f0);}(_0x7a45,0xad));var _0x57a4=function(_0x436129,_0x1ce0a1){_0x436129=_0x436129-0x0;var _0x3a3014=_0x7a45[_0x436129];return _0x3a3014;};'use strict';var client=require(_0x57a4('0x0'));exports[_0x57a4('0x1')]=function(){return function(){return client[_0x57a4('0x2')](_0x57a4('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name','online',_0x57a4('0x4'),_0x57a4('0x5'),_0x57a4('0x6'),_0x57a4('0x7'),_0x57a4('0x8'),_0x57a4('0x9'),_0x57a4('0xa'),'whatsappPause',_0x57a4('0xb'),_0x57a4('0xc'),_0x57a4('0xd'),_0x57a4('0xe'),'smsCapacity',_0x57a4('0xf'),_0x57a4('0x10')]},'log':_0x57a4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 1f3a042..e889502 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 _0xf3cd=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','addTags'];(function(_0x2581fb,_0xb8c3d){var _0x5027ab=function(_0x5a7377){while(--_0x5a7377){_0x2581fb['push'](_0x2581fb['shift']());}};_0x5027ab(++_0xb8c3d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3a723e,_0x59d99a){_0x3a723e=_0x3a723e-0x0;var _0x3e9c03=_0xf3cd[_0x3a723e];return _0x3e9c03;};'use strict';var client=require(_0xdf3c('0x0'));exports[_0xdf3c('0x1')]=function(_0x31e5a5,_0x1e0814){return client[_0xdf3c('0x2')](_0xdf3c('0x3'),{'body':_0x1e0814,'options':{'where':{'id':_0x31e5a5}},'log':'updateWhatsappInteraction'});};exports[_0xdf3c('0x4')]=function(_0x71b446,_0x9f71cb){return client['Request'](_0xdf3c('0x5'),{'body':_0x9f71cb,'options':{'where':{'id':_0x71b446}},'log':_0xdf3c('0x6')});}; \ No newline at end of file +var _0x6e77=['Request','UpdateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','update'];(function(_0x502ef8,_0x3fcb66){var _0x93f54d=function(_0x34f99a){while(--_0x34f99a){_0x502ef8['push'](_0x502ef8['shift']());}};_0x93f54d(++_0x3fcb66);}(_0x6e77,0xef));var _0x76e7=function(_0x40ebc3,_0x5b7f78){_0x40ebc3=_0x40ebc3-0x0;var _0x1d8b08=_0x6e77[_0x40ebc3];return _0x1d8b08;};'use strict';var client=require('../client');exports[_0x76e7('0x0')]=function(_0x558eec,_0x5a6235){return client[_0x76e7('0x1')](_0x76e7('0x2'),{'body':_0x5a6235,'options':{'where':{'id':_0x558eec}},'log':'updateWhatsappInteraction'});};exports[_0x76e7('0x3')]=function(_0x305900,_0xcc6627){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0xcc6627,'options':{'where':{'id':_0x305900}},'log':_0x76e7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index ff90489..0856180 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 _0x02fb=['CreateWhatsappMessage','../client','create','Request'];(function(_0x42c876,_0xbc454b){var _0x3d46ef=function(_0x298f17){while(--_0x298f17){_0x42c876['push'](_0x42c876['shift']());}};_0x3d46ef(++_0xbc454b);}(_0x02fb,0x101));var _0xb02f=function(_0x1e62cd,_0x1db9bb){_0x1e62cd=_0x1e62cd-0x0;var _0x2cc8e6=_0x02fb[_0x1e62cd];return _0x2cc8e6;};'use strict';var client=require(_0xb02f('0x0'));exports[_0xb02f('0x1')]=function(_0x16aa94){return client[_0xb02f('0x2')](_0xb02f('0x3'),{'body':_0x16aa94,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x5a92=['createWhatsappMessage','../client','Request','CreateWhatsappMessage'];(function(_0x394cd3,_0x18c815){var _0x30f0af=function(_0x586ccd){while(--_0x586ccd){_0x394cd3['push'](_0x394cd3['shift']());}};_0x30f0af(++_0x18c815);}(_0x5a92,0x185));var _0x25a9=function(_0x4cc433,_0x1f75e9){_0x4cc433=_0x4cc433-0x0;var _0x1ac5db=_0x5a92[_0x4cc433];return _0x1ac5db;};'use strict';var client=require(_0x25a9('0x0'));exports['create']=function(_0x23c66e){return client[_0x25a9('0x1')](_0x25a9('0x2'),{'body':_0x23c66e,'log':_0x25a9('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 2a83420..5f8b712 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 _0x94d2=['timeout','strategy','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x8cea57,_0x290172){var _0x25ce1d=function(_0x152c9a){while(--_0x152c9a){_0x8cea57['push'](_0x8cea57['shift']());}};_0x25ce1d(++_0x290172);}(_0x94d2,0x1cd));var _0x294d=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x94d2[_0x1ee351];return _0x245aaf;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x294d('0x0')](_0x294d('0x1'),{'options':{'raw':![],'attributes':['id',_0x294d('0x2'),_0x294d('0x3'),_0x294d('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x294d('0x2'),_0x294d('0x5'),_0x294d('0x6')]}]},'log':_0x294d('0x7')});};}; \ No newline at end of file +var _0x4bde=['whatsappPause','../client','getWhatsappQueues','Request','name','timeout','strategy','User','online'];(function(_0x13d6a9,_0x303ae3){var _0x6d3eb7=function(_0x48d686){while(--_0x48d686){_0x13d6a9['push'](_0x13d6a9['shift']());}};_0x6d3eb7(++_0x303ae3);}(_0x4bde,0x1b1));var _0xe4bd=function(_0xd8768,_0x3fedcb){_0xd8768=_0xd8768-0x0;var _0x46228f=_0x4bde[_0xd8768];return _0x46228f;};'use strict';var client=require(_0xe4bd('0x0'));exports[_0xe4bd('0x1')]=function(){return function(){return client[_0xe4bd('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xe4bd('0x3'),_0xe4bd('0x4'),_0xe4bd('0x5')],'include':[{'model':_0xe4bd('0x6'),'as':'Agents','attributes':['id',_0xe4bd('0x3'),_0xe4bd('0x7'),_0xe4bd('0x8')]}]},'log':_0xe4bd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index d3adbf0..1d35cb3 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 _0x9f73=['UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport'];(function(_0x4a73f5,_0xc00711){var _0x37eece=function(_0x2cb815){while(--_0x2cb815){_0x4a73f5['push'](_0x4a73f5['shift']());}};_0x37eece(++_0xc00711);}(_0x9f73,0x11f));var _0x39f7=function(_0x532d55,_0x2a9e7a){_0x532d55=_0x532d55-0x0;var _0x30bafa=_0x9f73[_0x532d55];return _0x30bafa;};'use strict';var client=require(_0x39f7('0x0'));exports['create']=function(_0xd9c2b3){return client[_0x39f7('0x1')](_0x39f7('0x2'),{'body':_0xd9c2b3,'log':_0x39f7('0x2')});};exports['update']=function(_0x472182,_0x429ae5){return client[_0x39f7('0x1')](_0x39f7('0x3'),{'body':_0x429ae5,'options':{'where':{'uniqueid':_0x472182},'order':[['id',_0x39f7('0x4')]],'limit':0x1},'log':_0x39f7('0x3')});}; \ No newline at end of file +var _0x5b81=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','create'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x5b81,0x8e));var _0x15b8=function(_0x1f4340,_0x202a79){_0x1f4340=_0x1f4340-0x0;var _0x3a5838=_0x5b81[_0x1f4340];return _0x3a5838;};'use strict';var client=require(_0x15b8('0x0'));exports[_0x15b8('0x1')]=function(_0x234642){return client[_0x15b8('0x2')](_0x15b8('0x3'),{'body':_0x234642,'log':_0x15b8('0x3')});};exports[_0x15b8('0x4')]=function(_0x10ccdc,_0x1879e3){return client[_0x15b8('0x2')](_0x15b8('0x5'),{'body':_0x1879e3,'options':{'where':{'uniqueid':_0x10ccdc},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index a4a898b..39d4418 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 _0x8c38=['error','map','join','stop','agents','timeout','createQueue','atimeout','channel','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','consequence','validate'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x8c38,0x1b1));var _0x88c3=function(_0xff1489,_0x9c4794){_0xff1489=_0xff1489-0x0;var _0x1507c2=_0x8c38[_0xff1489];return _0x1507c2;};'use strict';var schema=require('validate');var _=require(_0x88c3('0x0'));var util=require(_0x88c3('0x1'));var seqqueue=require(_0x88c3('0x2'));var logger=require(_0x88c3('0x3'))(_0x88c3('0x4'));var strategy=require(_0x88c3('0x5'));var queue=schema({'name':{'type':_0x88c3('0x6'),'required':!![],'message':_0x88c3('0x7')},'timeout':{'type':_0x88c3('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x4a66a2,_0x32bc20,_0x1bdf92){return logger[_0x88c3('0x9')](util[_0x88c3('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x4a66a2,_0x32bc20[_0x88c3('0xb')],_0x1bdf92));}function handleFindAgent(_0x176847){return function(_0x4abb61){return _0x4abb61['name'][_0x88c3('0xc')]()===_0x176847[_0x88c3('0xc')]();};}exports[_0x88c3('0xd')]=function(_0x20f45e,_0x3b1a12,_0x1bb542,_0x8cc31f){return function(_0x153b32){try{var _0x22900e={'name':_0x3b1a12[0x0],'timeout':_0x3b1a12[0x1]};var _0x5aa87a=queue[_0x88c3('0xe')](_0x22900e,{'typecast':!![]});if(_0x5aa87a['length']){logger[_0x88c3('0xf')]('[%s][AGENT]\x20%s',_0x20f45e,_[_0x88c3('0x10')](_0x5aa87a,'message')[_0x88c3('0x11')](',\x20'));_0x153b32[_0x88c3('0x12')]();}else{var _0x5c77d4=_['find'](_0x1bb542[_0x88c3('0x13')],handleFindAgent(_0x22900e[_0x88c3('0xb')]));if(_0x5c77d4){var _0x5c2a30=(_0x22900e[_0x88c3('0x14')]||0xa)*0x3e8;var _0x41356a,_0xeb7ebb;var _0x4831bc=seqqueue[_0x88c3('0x15')](_0x5c2a30);_0x4831bc['id']=_0x20f45e;_0x4831bc[_0x88c3('0x16')]=_0x5c2a30;_0x4831bc[_0x88c3('0x17')]=_0x8cc31f[_0x88c3('0x17')];writeLog(_0x20f45e,_0x5c77d4,util['format']('START:%s',_0x5c2a30));_0x1bb542['rules'][_0x20f45e]['on'](_0x88c3('0x18'),function(){logger['info'](_0x88c3('0x19'),_0x20f45e);clearTimeout(_0xeb7ebb);_0xeb7ebb=undefined;_0x4831bc[_0x88c3('0x1a')]();if(_0x1bb542['rules'][_0x20f45e]){delete _0x1bb542[_0x88c3('0x1b')][_0x20f45e];}_0x153b32['stop']();});_0x1bb542[_0x88c3('0x1b')][_0x20f45e]['on'](_0x88c3('0x1c'),function(){if(_0x1bb542[_0x88c3('0x1b')][_0x20f45e]){delete _0x1bb542[_0x88c3('0x1b')][_0x20f45e];}});_0xeb7ebb=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x20f45e);clearTimeout(_0xeb7ebb);_0x4831bc[_0x88c3('0x1a')]();_0x153b32[_0x88c3('0x1d')]();},_0x5c2a30);strategy['agent'](_0x4831bc,_0x5c77d4,_0x1bb542,_0x8cc31f);}else{logger[_0x88c3('0xf')](_0x88c3('0x1e'),_0x20f45e,_0x22900e['name']);_0x153b32[_0x88c3('0x12')]();}}}catch(_0x49332c){console['log'](_0x49332c);logger['error']('[%s][QUEUE]\x20%s',_0x20f45e,_0x49332c[_0x88c3('0x1f')]);_0x153b32[_0x88c3('0x12')]();}};}; \ No newline at end of file +var _0x83ab=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','find','timeout','createQueue','atimeout','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','info','agent'];(function(_0x4733fd,_0x3bc978){var _0x275507=function(_0x1a098b){while(--_0x1a098b){_0x4733fd['push'](_0x4733fd['shift']());}};_0x275507(++_0x3bc978);}(_0x83ab,0x1a8));var _0xb83a=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x83ab[_0x28947d];return _0x12d2ee;};'use strict';var schema=require(_0xb83a('0x0'));var _=require(_0xb83a('0x1'));var util=require('util');var seqqueue=require(_0xb83a('0x2'));var logger=require(_0xb83a('0x3'))(_0xb83a('0x4'));var strategy=require(_0xb83a('0x5'));var queue=schema({'name':{'type':_0xb83a('0x6'),'required':!![],'message':_0xb83a('0x7')},'timeout':{'type':_0xb83a('0x8'),'message':_0xb83a('0x9')}});function writeLog(_0x19104c,_0x2ff60f,_0x3b0598){return logger['info'](util[_0xb83a('0xa')](_0xb83a('0xb'),_0x19104c,_0x2ff60f[_0xb83a('0xc')],_0x3b0598));}function handleFindAgent(_0x15a7a9){return function(_0x23edf2){return _0x23edf2[_0xb83a('0xc')][_0xb83a('0xd')]()===_0x15a7a9['toLowerCase']();};}exports[_0xb83a('0xe')]=function(_0x44cfd6,_0x5c27a3,_0x513072,_0x2cc30f){return function(_0x2cced6){try{var _0x50e259={'name':_0x5c27a3[0x0],'timeout':_0x5c27a3[0x1]};var _0x227eb5=queue[_0xb83a('0x0')](_0x50e259,{'typecast':!![]});if(_0x227eb5[_0xb83a('0xf')]){logger[_0xb83a('0x10')](_0xb83a('0x11'),_0x44cfd6,_[_0xb83a('0x12')](_0x227eb5,'message')['join'](',\x20'));_0x2cced6['stop']();}else{var _0x24ba7b=_[_0xb83a('0x13')](_0x513072['agents'],handleFindAgent(_0x50e259[_0xb83a('0xc')]));if(_0x24ba7b){var _0x592ea4=(_0x50e259[_0xb83a('0x14')]||0xa)*0x3e8;var _0x5bade7,_0x47a99e;var _0x1a43c1=seqqueue[_0xb83a('0x15')](_0x592ea4);_0x1a43c1['id']=_0x44cfd6;_0x1a43c1[_0xb83a('0x16')]=_0x592ea4;_0x1a43c1[_0xb83a('0x17')]=_0x2cc30f['channel'];writeLog(_0x44cfd6,_0x24ba7b,util['format']('START:%s',_0x592ea4));_0x513072[_0xb83a('0x18')][_0x44cfd6]['on']('end',function(){logger['info'](_0xb83a('0x19'),_0x44cfd6);clearTimeout(_0x47a99e);_0x47a99e=undefined;_0x1a43c1[_0xb83a('0x1a')]();if(_0x513072[_0xb83a('0x18')][_0x44cfd6]){delete _0x513072['rules'][_0x44cfd6];}_0x2cced6[_0xb83a('0x1b')]();});_0x513072[_0xb83a('0x18')][_0x44cfd6]['on'](_0xb83a('0x1c'),function(){if(_0x513072[_0xb83a('0x18')][_0x44cfd6]){delete _0x513072['rules'][_0x44cfd6];}});_0x47a99e=setTimeout(function(){logger[_0xb83a('0x1d')]('[%s][AGENT]\x20ROUTING\x20END',_0x44cfd6);clearTimeout(_0x47a99e);_0x1a43c1[_0xb83a('0x1a')]();_0x2cced6['next']();},_0x592ea4);strategy[_0xb83a('0x1e')](_0x1a43c1,_0x24ba7b,_0x513072,_0x2cc30f);}else{logger['error'](_0xb83a('0x1f'),_0x44cfd6,_0x50e259[_0xb83a('0xc')]);_0x2cced6[_0xb83a('0x1b')]();}}}catch(_0xbdbb94){console[_0xb83a('0x20')](_0xbdbb94);logger[_0xb83a('0x10')](_0xb83a('0x21'),_0x44cfd6,_0xbdbb94[_0xb83a('0x22')]);_0x2cced6['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 53b8d30..7986965 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 _0x9f4d=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','catch','error','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','postText','amazonlex','providerName','providerResponse','stringify','Message','dialogState','Failed','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x9f4d,0x8f));var _0xd9f4=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x9f4d[_0x4bf96c];return _0x281d09;};'use strict';var _=require(_0xd9f4('0x0'));var moment=require(_0xd9f4('0x1'));var AWS=require('aws-sdk');var utils=require(_0xd9f4('0x2'));var logger=require('../../../../config/logger')(_0xd9f4('0x3'));var rpc={'chatMessage':require(_0xd9f4('0x4')),'openchannelMessage':require(_0xd9f4('0x5')),'mailMessage':require(_0xd9f4('0x6')),'smsMessage':require(_0xd9f4('0x7')),'faxMessage':require(_0xd9f4('0x8')),'whatsappMessage':require(_0xd9f4('0x9'))};exports['consequence']=function(_0x210b4a,_0x44091c){return function(_0x519bbe){try{if(!_[_0xd9f4('0xa')](this[_0xd9f4('0xb')]['UserId'])){logger['info'](_0xd9f4('0xc'),_0x210b4a,_0xd9f4('0xd'));return _0x519bbe[_0xd9f4('0xe')]();}var _0x2559ff={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd9f4('0xf')](_0xd9f4('0x10')),'direction':_0xd9f4('0x11')};if(this[_0xd9f4('0x12')]===_0xd9f4('0x13')||this['channel']===_0xd9f4('0x14')){_0x2559ff['phone']=this[_0xd9f4('0xb')]['phone'];}var _0x4f76d2=this['channel'];if(_0x4f76d2===_0xd9f4('0x15')){_0x2559ff[_0xd9f4('0x16')]=this[_0xd9f4('0x17')]['id'];}else{_0x2559ff[_[_0xd9f4('0x18')](_0x4f76d2)+_0xd9f4('0x19')]=this['account']['id'];}_0x2559ff[_[_0xd9f4('0x18')](_0x4f76d2)+_0xd9f4('0x1a')]=this[_0xd9f4('0xb')]['id'];if(this[_0xd9f4('0xb')][_0xd9f4('0x1b')]){var _0x5c290b=_0x44091c[0x4];if(!_[_0xd9f4('0x1c')](_0x5c290b)){_0x2559ff[_0xd9f4('0x1d')]=utils[_0xd9f4('0x1e')](_0x5c290b,this);return rpc[_0x4f76d2+'Message'][_0xd9f4('0x1f')](_0x2559ff)[_0xd9f4('0x20')](function(_0x405067){logger['info']('[%s][AMAZONLEX]\x20%s',_0x210b4a,_0x2559ff[_0xd9f4('0x1d')]);})[_0xd9f4('0x21')](function(_0x5661b2){logger[_0xd9f4('0x22')](_0xd9f4('0xc'),_0x210b4a,JSON['stringify'](_0x5661b2));})[_0xd9f4('0x23')](function(){logger[_0xd9f4('0x24')](_0xd9f4('0x25'),_0x210b4a);_0x519bbe[_0xd9f4('0x26')]();});}else{logger['info'](_0xd9f4('0x27'),_0x210b4a);_0x519bbe[_0xd9f4('0x26')]();}}else{var _0x246c0e=this;var _0x5e3411=new AWS[(_0xd9f4('0x28'))]({'accessKeyId':_0x44091c[0x0],'secretAccessKey':_0x44091c[0x1],'region':_0x44091c[0x2]});var _0x4fe0b5={'botAlias':'$LATEST','botName':_0x44091c[0x3],'inputText':this[_0xd9f4('0x29')]['body'],'userId':this['channel']+':'+this['interaction']['id']['toString']()};_0x5e3411[_0xd9f4('0x2a')](_0x4fe0b5,function(_0x4d4eb2,_0x5ad004){if(_0x4d4eb2){logger[_0xd9f4('0x22')]('[%s][AMAZONLEX]\x20%s',_0x210b4a,_0x4d4eb2['message']);_0x519bbe['next']();}else if(_0x5ad004&&_0x5ad004[_0xd9f4('0x29')]){_0x246c0e['body'][_0xd9f4('0x2b')]=_0x5ad004;_0x2559ff[_0xd9f4('0x1d')]=_0x5ad004[_0xd9f4('0x29')];_0x2559ff[_0xd9f4('0x2c')]=_0xd9f4('0x2b');_0x2559ff[_0xd9f4('0x2d')]=JSON[_0xd9f4('0x2e')](_0x5ad004);return rpc[_0x4f76d2+_0xd9f4('0x2f')][_0xd9f4('0x1f')](_0x2559ff)[_0xd9f4('0x20')](function(_0x3835fe){logger[_0xd9f4('0x24')](_0xd9f4('0xc'),_0x210b4a,_0x2559ff['body']);if(_0x5ad004[_0xd9f4('0x30')]==_0xd9f4('0x31')){_0x519bbe[_0xd9f4('0xe')]();}else{_0x519bbe[_0xd9f4('0x26')]();}})[_0xd9f4('0x21')](function(_0x38590f){logger[_0xd9f4('0x22')]('[%s][AMAZONLEX]\x20%s',_0x210b4a,JSON[_0xd9f4('0x2e')](_0x38590f));_0x519bbe[_0xd9f4('0xe')]();});}else{_0x519bbe[_0xd9f4('0xe')]();}});}}catch(_0x150f97){logger[_0xd9f4('0x22')]('[%s][AMAZONLEX]\x20%s',_0x210b4a,JSON[_0xd9f4('0x2e')](_0x150f97));_0x519bbe[_0xd9f4('0x26')]();}};}; \ No newline at end of file +var _0xeed4=['create','dialogState','lodash','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','body','getMustacheRender','Message','then','catch','error','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse','stringify'];(function(_0x155455,_0x5556db){var _0x13f301=function(_0x538ab5){while(--_0x538ab5){_0x155455['push'](_0x155455['shift']());}};_0x13f301(++_0x5556db);}(_0xeed4,0xde));var _0x4eed=function(_0x5ee73b,_0x282c4c){_0x5ee73b=_0x5ee73b-0x0;var _0x22948a=_0xeed4[_0x5ee73b];return _0x22948a;};'use strict';var _=require(_0x4eed('0x0'));var moment=require(_0x4eed('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x4eed('0x2'))('routing');var rpc={'chatMessage':require(_0x4eed('0x3')),'openchannelMessage':require(_0x4eed('0x4')),'mailMessage':require(_0x4eed('0x5')),'smsMessage':require(_0x4eed('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4eed('0x7')]=function(_0x66688c,_0xd86641){return function(_0x4237dc){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0x4eed('0x8')](_0x4eed('0x9'),_0x66688c,_0x4eed('0xa'));return _0x4237dc[_0x4eed('0xb')]();}var _0x2de665={'ContactId':this[_0x4eed('0xc')]['id'],'sentAt':moment()[_0x4eed('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4eed('0xe')};if(this[_0x4eed('0xf')]===_0x4eed('0x10')||this['channel']===_0x4eed('0x11')){_0x2de665['phone']=this['interaction'][_0x4eed('0x12')];}var _0xc7b1a4=this[_0x4eed('0xf')];if(_0xc7b1a4===_0x4eed('0x13')){_0x2de665[_0x4eed('0x14')]=this[_0x4eed('0x15')]['id'];}else{_0x2de665[_[_0x4eed('0x16')](_0xc7b1a4)+_0x4eed('0x17')]=this[_0x4eed('0x15')]['id'];}_0x2de665[_[_0x4eed('0x16')](_0xc7b1a4)+_0x4eed('0x18')]=this[_0x4eed('0x19')]['id'];if(this[_0x4eed('0x19')][_0x4eed('0x1a')]){var _0x52f9ea=_0xd86641[0x4];if(!_['isEmpty'](_0x52f9ea)){_0x2de665[_0x4eed('0x1b')]=utils[_0x4eed('0x1c')](_0x52f9ea,this);return rpc[_0xc7b1a4+_0x4eed('0x1d')]['create'](_0x2de665)[_0x4eed('0x1e')](function(_0x45bdcf){logger[_0x4eed('0x8')](_0x4eed('0x9'),_0x66688c,_0x2de665['body']);})[_0x4eed('0x1f')](function(_0x89a8fd){logger[_0x4eed('0x20')](_0x4eed('0x9'),_0x66688c,JSON['stringify'](_0x89a8fd));})['finally'](function(){logger[_0x4eed('0x8')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x66688c);_0x4237dc[_0x4eed('0x21')]();});}else{logger[_0x4eed('0x8')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x66688c);_0x4237dc['stop']();}}else{var _0x45002b=this;var _0x561478=new AWS[(_0x4eed('0x22'))]({'accessKeyId':_0xd86641[0x0],'secretAccessKey':_0xd86641[0x1],'region':_0xd86641[0x2]});var _0x26df44={'botAlias':_0x4eed('0x23'),'botName':_0xd86641[0x3],'inputText':this[_0x4eed('0x24')]['body'],'userId':this[_0x4eed('0xf')]+':'+this[_0x4eed('0x19')]['id'][_0x4eed('0x25')]()};_0x561478[_0x4eed('0x26')](_0x26df44,function(_0x2628e4,_0x21b2f4){if(_0x2628e4){logger[_0x4eed('0x20')](_0x4eed('0x9'),_0x66688c,_0x2628e4[_0x4eed('0x24')]);_0x4237dc[_0x4eed('0xb')]();}else if(_0x21b2f4&&_0x21b2f4[_0x4eed('0x24')]){_0x45002b['body']['amazonlex']=_0x21b2f4;_0x2de665[_0x4eed('0x1b')]=_0x21b2f4['message'];_0x2de665['providerName']=_0x4eed('0x27');_0x2de665[_0x4eed('0x28')]=JSON[_0x4eed('0x29')](_0x21b2f4);return rpc[_0xc7b1a4+_0x4eed('0x1d')][_0x4eed('0x2a')](_0x2de665)[_0x4eed('0x1e')](function(_0x263b24){logger[_0x4eed('0x8')]('[%s][AMAZONLEX]\x20%s',_0x66688c,_0x2de665[_0x4eed('0x1b')]);if(_0x21b2f4[_0x4eed('0x2b')]=='Failed'){_0x4237dc[_0x4eed('0xb')]();}else{_0x4237dc[_0x4eed('0x21')]();}})[_0x4eed('0x1f')](function(_0x2f42e7){logger[_0x4eed('0x20')](_0x4eed('0x9'),_0x66688c,JSON[_0x4eed('0x29')](_0x2f42e7));_0x4237dc[_0x4eed('0xb')]();});}else{_0x4237dc[_0x4eed('0xb')]();}});}}catch(_0x3eb085){logger[_0x4eed('0x20')](_0x4eed('0x9'),_0x66688c,JSON[_0x4eed('0x29')](_0x3eb085));_0x4237dc['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 4b6d580..fac18eb 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 _0xf470=['isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','Message','Smtp','service','host','port','secure','authentication','auth','pass','inReplyTo','html','','replace','','headers','auto-replied','All','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','then','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../mailRpc','consequence'];(function(_0x329d13,_0x1aff27){var _0x33efd9=function(_0x265b7d){while(--_0x265b7d){_0x329d13['push'](_0x329d13['shift']());}};_0x33efd9(++_0x1aff27);}(_0xf470,0xfd));var _0x0f47=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xf470[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x0f47('0x0'));var moment=require(_0x0f47('0x1'));var utils=require(_0x0f47('0x2'));var logger=require(_0x0f47('0x3'))(_0x0f47('0x4'));var rpc={'chatMessage':require(_0x0f47('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0f47('0x6')),'smsMessage':require(_0x0f47('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x0f47('0x8'))};var mailRpc=require(_0x0f47('0x9'));exports[_0x0f47('0xa')]=function(_0x428c24,_0x42c33a){return function(_0x3c1886){try{if(_0x42c33a[0x0]==='1'&&(_[_0x0f47('0xb')](this[_0x0f47('0xc')][_0x0f47('0xd')])||!this[_0x0f47('0xc')][_0x0f47('0xd')])){logger[_0x0f47('0xe')](_0x0f47('0xf'),_0x428c24,_0x0f47('0x10'));return _0x3c1886[_0x0f47('0x11')]();}var _0x2196d2=this[_0x0f47('0x12')];var _0x423b4a={'ContactId':this[_0x0f47('0x13')]['id'],'sentAt':moment()['format'](_0x0f47('0x14')),'direction':_0x0f47('0x15')};if(this[_0x0f47('0x12')]===_0x0f47('0x16')){_0x423b4a[_0x0f47('0x17')]=utils['getMustacheRender'](_0x42c33a[0x2],this);}else{_0x423b4a['body']=utils[_0x0f47('0x18')](_0x42c33a[0x1],this);}if(this[_0x0f47('0x19')]){_0x423b4a['to']=this[_0x0f47('0x19')][_0x0f47('0x1a')]||'';if(this[_0x0f47('0x12')]==='mail'&&_0x42c33a[0x1]==='1'){_0x423b4a['cc']=this[_0x0f47('0x19')]['cc']||'';}_0x423b4a['from']=this['message']['to']||'';_0x423b4a[_0x0f47('0x1b')]=this[_0x0f47('0x19')][_0x0f47('0x1b')]||'';_0x423b4a[_0x0f47('0x1c')]=!![];if(this[_0x0f47('0x19')][_0x0f47('0x1d')]){_0x423b4a[_0x0f47('0x1d')]='';_0x423b4a['subject']+=_[_0x0f47('0x1e')](this[_0x0f47('0x19')]['subject'],_0x0f47('0x1f'))?'':_0x0f47('0x20');_0x423b4a[_0x0f47('0x1d')]+=this[_0x0f47('0x19')][_0x0f47('0x1d')];}}if(this[_0x0f47('0x12')]===_0x0f47('0x21')){_0x423b4a[_0x0f47('0x22')]=this[_0x0f47('0x23')]['id'];}else{_0x423b4a[_[_0x0f47('0x24')](this[_0x0f47('0x12')])+'AccountId']=this['account']['id'];}_0x423b4a[_['upperFirst'](this[_0x0f47('0x12')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x0f47('0x12')]+_0x0f47('0x25')]){if(this[_0x0f47('0x12')]===_0x0f47('0x16')){var _0x28edc5={'tls':{'rejectUnauthorized':![]}};if(this[_0x0f47('0x23')][_0x0f47('0x26')]['service']){_0x28edc5['service']=this[_0x0f47('0x23')][_0x0f47('0x26')][_0x0f47('0x27')];}else{_0x28edc5['host']=this[_0x0f47('0x23')][_0x0f47('0x26')][_0x0f47('0x28')];_0x28edc5[_0x0f47('0x29')]=this['account'][_0x0f47('0x26')][_0x0f47('0x29')];_0x28edc5[_0x0f47('0x2a')]=this[_0x0f47('0x23')][_0x0f47('0x26')][_0x0f47('0x2a')];}if(this[_0x0f47('0x23')][_0x0f47('0x26')][_0x0f47('0x2b')]){_0x28edc5[_0x0f47('0x2c')]={'user':this[_0x0f47('0x23')][_0x0f47('0x26')]['user'],'pass':this[_0x0f47('0x23')][_0x0f47('0x26')][_0x0f47('0x2d')]};}_0x423b4a[_0x0f47('0x2e')]=this[_0x0f47('0x19')]['messageId'];_0x423b4a[_0x0f47('0x2f')]=_0x0f47('0x30')+_[_0x0f47('0x31')](_0x423b4a['body'],_0x0f47('0x32'),_0x0f47('0x33'))+_0x0f47('0x34');_0x423b4a[_0x0f47('0x35')]={'Auto-Submitted':_0x0f47('0x36'),'X-Auto-Response-Suppress':_0x0f47('0x37'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x28edc5,_0x423b4a)['then'](function(_0x29d2e9){logger['info'](_0x0f47('0x38'),_0x428c24);_0x423b4a['messageId']=_0x29d2e9[_0x0f47('0x19')][_0x0f47('0x39')];return rpc[_0x2196d2+_0x0f47('0x25')][_0x0f47('0x3a')](_0x423b4a);})['then'](function(_0x38470b){logger[_0x0f47('0xe')](_0x0f47('0xf'),_0x428c24,JSON[_0x0f47('0x3b')](_0x38470b));})[_0x0f47('0x3c')](function(_0x4d7d38){logger[_0x0f47('0x3d')](_0x0f47('0x3e'),_0x428c24,JSON[_0x0f47('0x3b')](_0x4d7d38));})[_0x0f47('0x3f')](function(){_0x3c1886[_0x0f47('0x11')]();});}else{return rpc[this['channel']+'Message']['create'](_0x423b4a)[_0x0f47('0x40')](function(_0x813d0d){logger[_0x0f47('0xe')]('[%s][AUTOREPLY]\x20%s',_0x428c24,_0x423b4a[_0x0f47('0x17')]);})[_0x0f47('0x3c')](function(_0x4814fe){logger['error']('[%s][AUTOREPLY]\x20%s',_0x428c24,JSON[_0x0f47('0x3b')](_0x4814fe));})['finally'](function(){_0x3c1886[_0x0f47('0x11')]();});}}}catch(_0x332e55){logger['error'](_0x0f47('0xf'),_0x428c24,JSON[_0x0f47('0x3b')](_0x332e55));_0x3c1886[_0x0f47('0x41')]();}};}; \ No newline at end of file +var _0x20de=['','auto-replied','sendMailMessage','info','Message','create','then','stringify','catch','error','finally','next','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','created','interaction','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','mail','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','account','Smtp','service','host','port','secure','pass','messageId','html','','replace',']+(>|$)/g,''),'priorityTrue':_0x11de7f[0x1],'priorityFalse':_0x11de7f[0x2]};var _0x1fb615=gotoif[_0x90ae('0x0')](_0x421921,{'typecast':!![]});if(_0x1fb615['length']){logger[_0x90ae('0xd')]('[%s][GOTOIF]\x20%s',_0x37a220,_[_0x90ae('0xe')](_0x1fb615,_0x90ae('0xf'))[_0x90ae('0x10')](',\x20'));_0x53b35b[_0x90ae('0x11')]();}else{try{var _0x5ac6f2=eval('('+_0x421921[_0x90ae('0x12')]+')');var _0x2be7a4=_0x5ac6f2?_0x421921[_0x90ae('0x13')]:_0x421921[_0x90ae('0x14')];logger[_0x90ae('0x15')](_0x90ae('0x16'),_0x37a220,_0x421921[_0x90ae('0x12')],_0x5ac6f2,_0x2be7a4||_0x90ae('0x17'));if(_0x2be7a4){var _0x403afa=_[_0x90ae('0x18')](_0x53b35b[_0x90ae('0x19')](),{'p':_0x2be7a4});if(_0x403afa>=0x0){logger[_0x90ae('0x15')](_0x90ae('0x1a'),_0x37a220,_0x2be7a4||'next',_0x403afa);_0x53b35b['next'](_0x403afa);}else{logger[_0x90ae('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x37a220,_0x2be7a4||_0x90ae('0x17'));_0x53b35b[_0x90ae('0x11')]();}}else{_0x53b35b[_0x90ae('0x17')]();}}catch(_0x4ba9de){logger[_0x90ae('0xd')](_0x90ae('0x1b'),_0x37a220,_0x4ba9de[_0x90ae('0xf')]);_0x53b35b[_0x90ae('0x11')]();}}}catch(_0x21382e){logger[_0x90ae('0xd')](_0x90ae('0x1c'),_0x37a220,JSON[_0x90ae('0x1d')](_0x21382e));_0x53b35b[_0x90ae('0x11')]();}};}; \ No newline at end of file +var _0x2402=['length','map','message','stop','priorityTrue','info','condition','findIndex','rules','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','./utils','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','getMustacheRender','replace'];(function(_0xc2f39e,_0x130577){var _0x42e9be=function(_0x421e40){while(--_0x421e40){_0xc2f39e['push'](_0xc2f39e['shift']());}};_0x42e9be(++_0x130577);}(_0x2402,0xbd));var _0x2240=function(_0x163d35,_0x348065){_0x163d35=_0x163d35-0x0;var _0x317918=_0x2402[_0x163d35];return _0x317918;};'use strict';var schema=require(_0x2240('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x2240('0x1'));var logger=require('../../../../config/logger')(_0x2240('0x2'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x2240('0x3')},'priorityTrue':{'type':_0x2240('0x4'),'message':_0x2240('0x5')},'priorityFalse':{'type':_0x2240('0x4'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x2240('0x6')]=function(_0x36024b,_0x26f247){return function(_0x34f4c7){try{var _0x358aa5={'condition':htmlToText['fromString'](utils[_0x2240('0x7')](_0x26f247[0x0],this),{'wordwrap':![]})[_0x2240('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x26f247[0x1],'priorityFalse':_0x26f247[0x2]};var _0x1cf9ab=gotoif[_0x2240('0x0')](_0x358aa5,{'typecast':!![]});if(_0x1cf9ab[_0x2240('0x9')]){logger['error']('[%s][GOTOIF]\x20%s',_0x36024b,_[_0x2240('0xa')](_0x1cf9ab,_0x2240('0xb'))['join'](',\x20'));_0x34f4c7[_0x2240('0xc')]();}else{try{var _0x28074d=eval('('+_0x358aa5['condition']+')');var _0x30b8ba=_0x28074d?_0x358aa5[_0x2240('0xd')]:_0x358aa5['priorityFalse'];logger[_0x2240('0xe')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x36024b,_0x358aa5[_0x2240('0xf')],_0x28074d,_0x30b8ba||'next');if(_0x30b8ba){var _0x439ece=_[_0x2240('0x10')](_0x34f4c7[_0x2240('0x11')](),{'p':_0x30b8ba});if(_0x439ece>=0x0){logger[_0x2240('0xe')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x36024b,_0x30b8ba||_0x2240('0x12'),_0x439ece);_0x34f4c7[_0x2240('0x12')](_0x439ece);}else{logger[_0x2240('0xe')](_0x2240('0x13'),_0x36024b,_0x30b8ba||'next');_0x34f4c7[_0x2240('0xc')]();}}else{_0x34f4c7[_0x2240('0x12')]();}}catch(_0x1848f9){logger[_0x2240('0x14')](_0x2240('0x15'),_0x36024b,_0x1848f9[_0x2240('0xb')]);_0x34f4c7['stop']();}}}catch(_0x4e0325){logger[_0x2240('0x14')]('[%s][GOTOIF]\x20%s',_0x36024b,JSON['stringify'](_0x4e0325));_0x34f4c7[_0x2240('0xc')]();}};}; \ 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 7f3293b..ebe59ef 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 _0xe567=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x1a8447,_0x36530a){var _0x395a51=function(_0x4c2d74){while(--_0x4c2d74){_0x1a8447['push'](_0x1a8447['shift']());}};_0x395a51(++_0x36530a);}(_0xe567,0xc0));var _0x7e56=function(_0x3f3f85,_0x4e39c6){_0x3f3f85=_0x3f3f85-0x0;var _0x5db842=_0xe567[_0x3f3f85];return _0x5db842;};'use strict';var schema=require(_0x7e56('0x0'));var _=require(_0x7e56('0x1'));var logger=require(_0x7e56('0x2'))(_0x7e56('0x3'));var gotop=schema({'priority':{'type':_0x7e56('0x4'),'required':!![],'message':_0x7e56('0x5')}});exports[_0x7e56('0x6')]=function(_0x5ae895,_0x45960d){return function(_0x21106d){try{var _0x723242={'priority':_0x45960d[0x0]};var _0x4fddf3=gotop[_0x7e56('0x0')](_0x723242,{'typecast':!![]});if(_0x4fddf3[_0x7e56('0x7')]){logger[_0x7e56('0x8')](_0x7e56('0x9'),_0x5ae895,_['map'](_0x4fddf3,_0x7e56('0xa'))[_0x7e56('0xb')](',\x20'));_0x21106d[_0x7e56('0xc')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x5ae895,_0x723242[_0x7e56('0xd')]);if(_0x723242[_0x7e56('0xd')]){var _0xbc60fd=_[_0x7e56('0xe')](_0x21106d[_0x7e56('0xf')](),{'p':_0x723242['priority']});if(_0xbc60fd>=0x0){logger[_0x7e56('0x10')](_0x7e56('0x11'),_0x5ae895,_0x723242[_0x7e56('0xd')]||'next',_0xbc60fd);_0x21106d[_0x7e56('0x12')](_0xbc60fd);}else{logger[_0x7e56('0x10')](_0x7e56('0x13'),_0x5ae895,_0x723242[_0x7e56('0xd')]||_0x7e56('0x12'));_0x21106d[_0x7e56('0xc')]();}}else{_0x21106d[_0x7e56('0x12')]();}}}catch(_0x2eea7c){logger['error']('[%s][GOTOP]\x20%s',_0x5ae895,JSON[_0x7e56('0x14')](_0x2eea7c));_0x21106d['stop']();}};}; \ No newline at end of file +var _0xe444=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex','rules','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number'];(function(_0x41070e,_0x473b04){var _0x1eb904=function(_0x2dca46){while(--_0x2dca46){_0x41070e['push'](_0x41070e['shift']());}};_0x1eb904(++_0x473b04);}(_0xe444,0x9d));var _0x4e44=function(_0x1846ea,_0x4b1d23){_0x1846ea=_0x1846ea-0x0;var _0x2de021=_0xe444[_0x1846ea];return _0x2de021;};'use strict';var schema=require(_0x4e44('0x0'));var _=require(_0x4e44('0x1'));var logger=require(_0x4e44('0x2'))(_0x4e44('0x3'));var gotop=schema({'priority':{'type':_0x4e44('0x4'),'required':!![],'message':_0x4e44('0x5')}});exports['consequence']=function(_0x5ed9eb,_0x1771d0){return function(_0x590bf7){try{var _0x263320={'priority':_0x1771d0[0x0]};var _0x554476=gotop[_0x4e44('0x0')](_0x263320,{'typecast':!![]});if(_0x554476[_0x4e44('0x6')]){logger[_0x4e44('0x7')](_0x4e44('0x8'),_0x5ed9eb,_['map'](_0x554476,'message')['join'](',\x20'));_0x590bf7[_0x4e44('0x9')]();}else{logger[_0x4e44('0xa')](_0x4e44('0xb'),_0x5ed9eb,_0x263320['priority']);if(_0x263320['priority']){var _0xa03453=_[_0x4e44('0xc')](_0x590bf7[_0x4e44('0xd')](),{'p':_0x263320[_0x4e44('0xe')]});if(_0xa03453>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x5ed9eb,_0x263320[_0x4e44('0xe')]||_0x4e44('0xf'),_0xa03453);_0x590bf7[_0x4e44('0xf')](_0xa03453);}else{logger[_0x4e44('0xa')](_0x4e44('0x10'),_0x5ed9eb,_0x263320[_0x4e44('0xe')]||_0x4e44('0xf'));_0x590bf7['stop']();}}else{_0x590bf7['next']();}}}catch(_0x36b36b){logger[_0x4e44('0x7')]('[%s][GOTOP]\x20%s',_0x5ed9eb,JSON[_0x4e44('0x11')](_0x36b36b));_0x590bf7['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 c2772ca..b1b8cf0 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 _0x56f7=['then','info','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','error','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','consequence','getMustacheRender','contact','channel','chat','account','AccountId','interaction','Message','create'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0x56f7,0x1aa));var _0x756f=function(_0x309879,_0x29f94a){_0x309879=_0x309879-0x0;var _0x480e63=_0x56f7[_0x309879];return _0x480e63;};'use strict';var _=require('lodash');var utils=require(_0x756f('0x0'));var logger=require(_0x756f('0x1'))('routing');var rpc={'chatMessage':require(_0x756f('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x756f('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x756f('0x4')]=function(_0x5c5afa,_0x2804dc){return function(_0x1486b8){try{var _0x4bafd7={'body':utils[_0x756f('0x5')](_0x2804dc[0x0],this),'ContactId':this[_0x756f('0x6')]['id']};if(this[_0x756f('0x7')]===_0x756f('0x8')){_0x4bafd7['ChatWebsiteId']=this[_0x756f('0x9')]['id'];}else{_0x4bafd7[_['upperFirst'](this[_0x756f('0x7')])+_0x756f('0xa')]=this[_0x756f('0x9')]['id'];}_0x4bafd7[_['upperFirst'](this['channel'])+'InteractionId']=this[_0x756f('0xb')]['id'];if(rpc[this[_0x756f('0x7')]+'Message']){return rpc[this[_0x756f('0x7')]+_0x756f('0xc')][_0x756f('0xd')](_0x4bafd7)[_0x756f('0xe')](function(_0x515ee2){logger[_0x756f('0xf')](_0x756f('0x10'),_0x5c5afa,_0x4bafd7[_0x756f('0x11')]);_0x1486b8['next']();})[_0x756f('0x12')](function(_0x21811a){logger['error'](_0x756f('0x10'),_0x5c5afa,JSON[_0x756f('0x13')](_0x21811a));_0x1486b8[_0x756f('0x14')]();});}}catch(_0x3c6b6e){logger[_0x756f('0x15')](_0x756f('0x10'),_0x5c5afa,JSON[_0x756f('0x13')](_0x3c6b6e));_0x1486b8[_0x756f('0x14')]();}};}; \ No newline at end of file +var _0xa236=['lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId','interaction','Message','create','then','info','next','error','[%s][MESSAGE]\x20%s','stop','stringify'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xa236,0x1b0));var _0x6a23=function(_0x19e954,_0x2f10b3){_0x19e954=_0x19e954-0x0;var _0x4719c4=_0xa236[_0x19e954];return _0x4719c4;};'use strict';var _=require(_0x6a23('0x0'));var utils=require(_0x6a23('0x1'));var logger=require(_0x6a23('0x2'))(_0x6a23('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6a23('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6a23('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x6a23('0x6')]=function(_0x589fd0,_0x2be201){return function(_0x297dc2){try{var _0x440feb={'body':utils[_0x6a23('0x7')](_0x2be201[0x0],this),'ContactId':this[_0x6a23('0x8')]['id']};if(this[_0x6a23('0x9')]===_0x6a23('0xa')){_0x440feb['ChatWebsiteId']=this[_0x6a23('0xb')]['id'];}else{_0x440feb[_[_0x6a23('0xc')](this[_0x6a23('0x9')])+_0x6a23('0xd')]=this['account']['id'];}_0x440feb[_[_0x6a23('0xc')](this['channel'])+'InteractionId']=this[_0x6a23('0xe')]['id'];if(rpc[this['channel']+_0x6a23('0xf')]){return rpc[this['channel']+_0x6a23('0xf')][_0x6a23('0x10')](_0x440feb)[_0x6a23('0x11')](function(_0x5c03a4){logger[_0x6a23('0x12')]('[%s][MESSAGE]\x20%s',_0x589fd0,_0x440feb['body']);_0x297dc2[_0x6a23('0x13')]();})['catch'](function(_0x1abc62){logger[_0x6a23('0x14')](_0x6a23('0x15'),_0x589fd0,JSON['stringify'](_0x1abc62));_0x297dc2[_0x6a23('0x16')]();});}}catch(_0x35a30c){logger[_0x6a23('0x14')](_0x6a23('0x15'),_0x589fd0,JSON[_0x6a23('0x17')](_0x35a30c));_0x297dc2['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 72f7d93..d94b5bf 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 _0xfd42=['error','stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s','next'];(function(_0x5cddcd,_0x2f8e4a){var _0x3ab9ba=function(_0x2e3821){while(--_0x2e3821){_0x5cddcd['push'](_0x5cddcd['shift']());}};_0x3ab9ba(++_0x2f8e4a);}(_0xfd42,0x162));var _0x2fd4=function(_0x542b0b,_0x5bfce8){_0x542b0b=_0x542b0b-0x0;var _0x6aed5e=_0xfd42[_0x542b0b];return _0x6aed5e;};'use strict';var utils=require(_0x2fd4('0x0'));var logger=require('../../../../config/logger')(_0x2fd4('0x1'));exports[_0x2fd4('0x2')]=function(_0x2f9638,_0x208103){return function(_0x5bd2cf){try{logger[_0x2fd4('0x3')](_0x2fd4('0x4'),_0x2f9638,utils['getMustacheRender'](_0x208103[0x0],this));_0x5bd2cf[_0x2fd4('0x5')]();}catch(_0xa48522){logger[_0x2fd4('0x6')](_0x2fd4('0x4'),_0x2f9638,JSON[_0x2fd4('0x7')](_0xa48522));_0x5bd2cf[_0x2fd4('0x8')]();}};}; \ No newline at end of file +var _0xaeec=['getMustacheRender','next','error','stringify','./utils','consequence','info','[%s][NOOP]\x20%s'];(function(_0x4de8a0,_0x3fe014){var _0x268048=function(_0x494464){while(--_0x494464){_0x4de8a0['push'](_0x4de8a0['shift']());}};_0x268048(++_0x3fe014);}(_0xaeec,0x12c));var _0xcaee=function(_0x46238e,_0x185868){_0x46238e=_0x46238e-0x0;var _0x350c73=_0xaeec[_0x46238e];return _0x350c73;};'use strict';var utils=require(_0xcaee('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0xcaee('0x1')]=function(_0x5d992a,_0x5c3221){return function(_0x138cbe){try{logger[_0xcaee('0x2')](_0xcaee('0x3'),_0x5d992a,utils[_0xcaee('0x4')](_0x5c3221[0x0],this));_0x138cbe[_0xcaee('0x5')]();}catch(_0xeaaeed){logger[_0xcaee('0x6')](_0xcaee('0x3'),_0x5d992a,JSON[_0xcaee('0x7')](_0xeaaeed));_0x138cbe['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index f7fe2da..9eb4c82 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(_0x576bd8,_0x4cc9aa){var _0x1b4407=function(_0xd27242){while(--_0xd27242){_0x576bd8['push'](_0x576bd8['shift']());}};_0x1b4407(++_0x4cc9aa);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 _0x7217=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','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','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId'];(function(_0xfd1c36,_0x318f1b){var _0x323497=function(_0x22f700){while(--_0x22f700){_0xfd1c36['push'](_0xfd1c36['shift']());}};_0x323497(++_0x318f1b);}(_0x7217,0x19e));var _0x7721=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x7217[_0x521929];return _0x632436;};'use strict';var schema=require(_0x7721('0x0'));var _=require('lodash');var util=require(_0x7721('0x1'));var seqqueue=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7721('0x6'));config[_0x7721('0x7')]=_[_0x7721('0x8')](config[_0x7721('0x7')],{'host':_0x7721('0x9'),'port':0x18eb});var io=require(_0x7721('0xa'))(new Redis(config[_0x7721('0x7')]));var attributes=['id',_0x7721('0xb'),_0x7721('0xc'),_0x7721('0xd'),_0x7721('0xe'),_0x7721('0xf')];function emit(_0xfa8835,_0x138740,_0x2c3986){io['to'](_0xfa8835)['emit'](_0x138740,_0x2c3986);}function emitChannelQueueInteraction(_0x461d1a,_0x29bc8f,_0x8729a6,_0xf78099,_0xa8977c,_0x409b37,_0x1e7fd7,_0x27b36b){var _0x55b4ca=_[_0x7721('0x10')](_0x8729a6);_0x55b4ca[_0x7721('0xb')]=_0x27b36b;_0x55b4ca['queue']=_0x29bc8f;_0x55b4ca[_0x7721('0xc')]=_0xf78099;_0x55b4ca['id']=_0xa8977c;if(_0x409b37){_0x1e7fd7[util[_0x7721('0x11')](_0x7721('0x12'),_0x461d1a)][_0xa8977c]=_[_0x7721('0x13')](_0x55b4ca,attributes);}else{delete _0x1e7fd7[util['format'](_0x7721('0x12'),_0x461d1a)][_0xa8977c];}emit(util[_0x7721('0x11')]('%s:queue:%s',_0x461d1a,_0x29bc8f),util['format']('%s_queue_waiting_interaction:%s',_0x461d1a,_0x409b37?_0x7721('0x14'):_0x7721('0x15')),_[_0x7721('0x13')](_0x55b4ca,attributes));}var rpc={'openchannelQueueReport':require(_0x7721('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7721('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7721('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7721('0x19'),'required':!![],'message':_0x7721('0x1a')},'timeout':{'type':_0x7721('0x1b'),'message':_0x7721('0x1c')}});function startRouting(_0x2286e5,_0x40af90,_0x402820,_0x413263){if(_0x2286e5&&_0x40af90&&_0x402820){_0x40af90[_0x7721('0x1d')]+=0x1;var _0xaeccc4={'uniqueid':_0x2286e5,'from':_0x402820['body']?_0x402820[_0x7721('0x1e')][_0x7721('0xe')]:'','joinAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'ContactId':_0x402820['contact']?_0x402820[_0x7721('0x20')]['id']:null,'ListId':_0x402820['list']?_0x402820[_0x7721('0x21')]['id']:null};_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x24')]=_0x40af90['id']||null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x25')]=_0x402820['interaction']?_0x402820[_0x7721('0x26')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x27')]=_0x402820[_0x7721('0x28')]?_0x402820[_0x7721('0x28')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+(_0x402820[_0x7721('0x23')]!=='chat'?_0x7721('0x29'):'WebsiteId')]=_0x402820['account']?_0x402820[_0x7721('0xc')]['id']:null;logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x2b'),_0x2286e5,_0x40af90[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x402820[_0x7721('0x23')],_0x40af90[_0x7721('0x2c')],_0xaeccc4,_0x402820[_0x7721('0xc')]['name'],_0x402820[_0x7721('0x28')]['id'],!![],_0x413263,_0x40af90['id']);if(rpc[_0x402820[_0x7721('0x23')]+'QueueReport']){return rpc[_0x402820['channel']+_0x7721('0x2d')][_0x7721('0x2e')](_0xaeccc4)['catch'](function(_0x46f772){logger[_0x7721('0x2f')](_0x7721('0x30'));});}}}function stopRouting(_0x58d54b,_0x3d9a32,_0x1ff31b,_0x1492d4){if(_0x58d54b&&_0x3d9a32){_0x3d9a32[_0x7721('0x1d')]-=0x1;var _0xc0f3c4={'leaveAt':moment()['format'](_0x7721('0x1f')),'acceptAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'reason':'accepted'};logger[_0x7721('0x2a')](util[_0x7721('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x58d54b,_0x3d9a32[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x1ff31b['channel'],_0x3d9a32[_0x7721('0x2c')],_0x1ff31b[_0x7721('0x1e')],_0x1ff31b[_0x7721('0xc')][_0x7721('0x2c')],_0x1ff31b[_0x7721('0x28')]['id'],![],_0x1492d4,_0x3d9a32['id']);if(rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')]){return rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')][_0x7721('0x31')](_0x58d54b,_0xc0f3c4)[_0x7721('0x32')](function(_0x5c806d){logger[_0x7721('0x2f')]('update\x20queue\x20report');});}}}function endRouting(_0x212384,_0x35614c,_0x7942f7,_0x1d03de){if(_0x212384&&_0x35614c){_0x35614c[_0x7721('0x1d')]-=0x1;var _0x378ba5={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7721('0x33')};logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x34'),_0x212384,_0x35614c['name']));emitChannelQueueInteraction(_0x7942f7[_0x7721('0x23')],_0x35614c['name'],_0x7942f7[_0x7721('0x1e')],_0x7942f7[_0x7721('0xc')]['name'],_0x7942f7[_0x7721('0x28')]['id'],![],_0x1d03de);if(rpc[_0x7942f7[_0x7721('0x23')]+'QueueReport']){return rpc[_0x7942f7['channel']+_0x7721('0x2d')][_0x7721('0x31')](_0x212384,_0x378ba5)[_0x7721('0x32')](function(_0x15e34d){logger['error'](_0x7721('0x35'));});}}}function handleFindQueue(_0x120de9){return function(_0x40ce8c){return _0x40ce8c[_0x7721('0x2c')][_0x7721('0x36')]()===_0x120de9['toLowerCase']();};}exports[_0x7721('0x37')]=function(_0x4a2c28,_0xaa3216,_0x4a5b59,_0x2333b8){return function(_0x15fa2c){try{var _0x231dad={'name':_0xaa3216[0x0],'timeout':_0xaa3216[0x1]};var _0x49e0c5=queue[_0x7721('0x0')](_0x231dad,{'typecast':!![]});if(_0x49e0c5[_0x7721('0x38')]){logger[_0x7721('0x2f')]('[%s][QUEUE]\x20%s',_0x4a2c28,_[_0x7721('0x39')](_0x49e0c5,_0x7721('0x28'))[_0x7721('0x3a')](',\x20'));_0x15fa2c[_0x7721('0x3b')]();}else{var _0x135dbc=_[_0x7721('0x3c')](_0x4a5b59[_0x2333b8[_0x7721('0x23')]+'Queues'],handleFindQueue(_0x231dad['name']));if(_0x135dbc){startRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);var _0x1ac3af=(_0x135dbc[_0x7721('0x33')]||0xa)*0x3e8;var _0x421aae=(_0x231dad[_0x7721('0x33')]||0x14)*0x3e8;var _0x335145,_0x15181b;if(_0x1ac3af>_0x421aae){_0x421aae=_0x1ac3af;}var _0x1d2ea5=seqqueue[_0x7721('0x3d')](_0x1ac3af);_0x1d2ea5['id']=_0x4a2c28;_0x1d2ea5[_0x7721('0x3e')]=_0x1ac3af;_0x1d2ea5[_0x7721('0x3f')]=_0x421aae;_0x1d2ea5['channel']=_0x2333b8['channel'];_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on'](_0x7721('0x41'),function(){logger[_0x7721('0x2a')](_0x7721('0x42'),_0x4a2c28);stopRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x335145=undefined;_0x1d2ea5['close'](!![]);if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59[_0x7721('0x40')][_0x4a2c28];}_0x15fa2c['stop']();});_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on']('complete',function(){if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59['rules'][_0x4a2c28];}});_0x335145=setTimeout(function(){logger[_0x7721('0x2a')](_0x7721('0x43'),_0x4a2c28);endRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x1d2ea5[_0x7721('0x44')](!![]);_0x15fa2c['next']();},_0x421aae);switch(_0x135dbc[_0x7721('0x45')]){case _0x7721('0x46'):strategy['rrmemory'](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);break;default:strategy[_0x7721('0x47')](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);}}else{logger[_0x7721('0x2f')](_0x7721('0x48'),_0x4a2c28,_0x231dad['name']);_0x15fa2c[_0x7721('0x3b')]();}}}catch(_0x5a32b6){console[_0x7721('0x49')](_0x5a32b6);logger[_0x7721('0x2f')](_0x7721('0x4a'),_0x4a2c28,_0x5a32b6[_0x7721('0x4b')]);_0x15fa2c[_0x7721('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 bc9a73f..8cd4152 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 _0xc112=['handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','agent','realtime','push'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc112,0xec));var _0x2c11=function(_0x2eb71c,_0x5a4b4d){_0x2eb71c=_0x2eb71c-0x0;var _0x41338c=_0xc112[_0x2eb71c];return _0x41338c;};'use strict';var _=require(_0x2c11('0x0'));var uuid=require(_0x2c11('0x1'));var util=require(_0x2c11('0x2'));var logger=require('../../../../../config/logger')(_0x2c11('0x3'));var Agent=function(_0x40da2e,_0x26e2a3,_0x170832,_0xaa8492){this[_0x2c11('0x4')]=uuid['v4']();this[_0x2c11('0x5')]=_0x40da2e;this[_0x2c11('0x6')]=_0x26e2a3;this[_0x2c11('0x7')]=_0x170832;this['routing']=_0xaa8492;this['squeue'][_0x2c11('0x8')](this[_0x2c11('0x9')][_0x2c11('0xa')](this),this[_0x2c11('0xb')]['bind'](this));this[_0x2c11('0x5')]['on'](_0x2c11('0xc'),this['handleTimeout'][_0x2c11('0xa')](this));this[_0x2c11('0x5')]['on'](_0x2c11('0xd'),this[_0x2c11('0xe')][_0x2c11('0xa')](this));};Agent['prototype'][_0x2c11('0x8')]=function(){this[_0x2c11('0x5')][_0x2c11('0x8')](this[_0x2c11('0x9')][_0x2c11('0xa')](this),this[_0x2c11('0xb')][_0x2c11('0xa')](this));};Agent['prototype'][_0x2c11('0xe')]=function(){this[_0x2c11('0xb')](!![]);};Agent[_0x2c11('0xf')][_0x2c11('0x9')]=function(_0x11e3ac){logger[_0x2c11('0x10')](_0x2c11('0x11'),this[_0x2c11('0x5')]['id'],this[_0x2c11('0x6')]['id']);if(_[_0x2c11('0x12')](this[_0x2c11('0x7')]['agents'][this[_0x2c11('0x6')]['id']])){logger[_0x2c11('0x10')](_0x2c11('0x13'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x2c11('0x8')][_0x2c11('0xa')](this),0x3e8);}else{if(this[_0x2c11('0x3')]['forcedOwnership']||util[_0x2c11('0x14')](this['squeue']['id'],this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']],this[_0x2c11('0x5')][_0x2c11('0x16')],![])){this[_0x2c11('0x7')]['agents'][this['agent']['id']]['busy']=!![];this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']][_0x2c11('0x17')]=undefined;util[_0x2c11('0x18')](this[_0x2c11('0x4')],this['squeue']['id'],this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']],null,this[_0x2c11('0x3')]);util[_0x2c11('0x19')](this[_0x2c11('0x5')]['id'],this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']],_0x2c11('0x1a')+(this['routing'][_0x2c11('0x1b')]?_0x2c11('0x1c'):''));}else{logger[_0x2c11('0x10')](_0x2c11('0x1d'),this[_0x2c11('0x5')]['id'],this[_0x2c11('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x2c11('0xf')][_0x2c11('0xb')]=function(_0x21d905){if(_[_0x2c11('0x12')](this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']])){return logger['info'](_0x2c11('0x13'),this[_0x2c11('0x5')]['id'],this[_0x2c11('0x6')]['id']);}else{logger[_0x2c11('0x10')](_0x2c11('0x1e'),this['squeue']['id'],this['agent']['id']);util[_0x2c11('0x1f')](this[_0x2c11('0x4')],this[_0x2c11('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],null,this[_0x2c11('0x3')]);this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']][_0x2c11('0x20')]=![];this['realtime'][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']]['busyQueue']=undefined;util[_0x2c11('0x19')](this[_0x2c11('0x5')]['id'],this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']],_0x21d905?'STOP':_0x2c11('0x21'));}if(!_0x21d905){setTimeout(this[_0x2c11('0x8')][_0x2c11('0xa')](this),0x3e8);}};function agent(_0xeba389,_0x415309,_0x471741,_0x3998aa){return new Agent(_0xeba389,_0x415309,_0x471741,_0x3998aa);}module[_0x2c11('0x22')]=agent; \ No newline at end of file +var _0x11a0=['hideNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','showNotification','writeLog',':FORCED','isNil','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x59c132,_0x355a67){var _0x3db1cb=function(_0x48245a){while(--_0x48245a){_0x59c132['push'](_0x59c132['shift']());}};_0x3db1cb(++_0x355a67);}(_0x11a0,0x84));var _0x011a=function(_0x5a1490,_0x52286e){_0x5a1490=_0x5a1490-0x0;var _0x53c9a6=_0x11a0[_0x5a1490];return _0x53c9a6;};'use strict';var _=require(_0x011a('0x0'));var uuid=require('uuid');var util=require(_0x011a('0x1'));var logger=require(_0x011a('0x2'))('routing');var Agent=function(_0xf8e0ef,_0x5652c2,_0x394213,_0x5c44a6){this[_0x011a('0x3')]=uuid['v4']();this[_0x011a('0x4')]=_0xf8e0ef;this[_0x011a('0x5')]=_0x5652c2;this[_0x011a('0x6')]=_0x394213;this[_0x011a('0x7')]=_0x5c44a6;this['squeue'][_0x011a('0x8')](this[_0x011a('0x9')][_0x011a('0xa')](this),this[_0x011a('0xb')]['bind'](this));this[_0x011a('0x4')]['on'](_0x011a('0xc'),this[_0x011a('0xb')][_0x011a('0xa')](this));this['squeue']['on'](_0x011a('0xd'),this[_0x011a('0xe')]['bind'](this));};Agent[_0x011a('0xf')][_0x011a('0x8')]=function(){this[_0x011a('0x4')]['push'](this['handleRun'][_0x011a('0xa')](this),this[_0x011a('0xb')]['bind'](this));};Agent['prototype'][_0x011a('0xe')]=function(){this[_0x011a('0xb')](!![]);};Agent[_0x011a('0xf')]['handleRun']=function(_0x79f7f5){logger[_0x011a('0x10')](_0x011a('0x11'),this[_0x011a('0x4')]['id'],this[_0x011a('0x5')]['id']);if(_['isNil'](this[_0x011a('0x6')][_0x011a('0x12')][this[_0x011a('0x5')]['id']])){logger[_0x011a('0x10')](_0x011a('0x13'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x011a('0x8')]['bind'](this),0x3e8);}else{if(this[_0x011a('0x7')][_0x011a('0x14')]||util[_0x011a('0x15')](this[_0x011a('0x4')]['id'],this['realtime'][_0x011a('0x12')][this[_0x011a('0x5')]['id']],this[_0x011a('0x4')]['channel'],![])){this['realtime'][_0x011a('0x12')][this[_0x011a('0x5')]['id']][_0x011a('0x16')]=!![];this[_0x011a('0x6')][_0x011a('0x12')][this[_0x011a('0x5')]['id']]['busyQueue']=undefined;util[_0x011a('0x17')](this[_0x011a('0x3')],this[_0x011a('0x4')]['id'],this[_0x011a('0x6')]['agents'][this[_0x011a('0x5')]['id']],null,this['routing']);util[_0x011a('0x18')](this['squeue']['id'],this[_0x011a('0x6')][_0x011a('0x12')][this['agent']['id']],'RINGING'+(this[_0x011a('0x7')][_0x011a('0x14')]?_0x011a('0x19'):''));}else{logger[_0x011a('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x011a('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x011a('0x8')][_0x011a('0xa')](this),0x3e8);}}};Agent[_0x011a('0xf')][_0x011a('0xb')]=function(_0x3d9771){if(_[_0x011a('0x1a')](this[_0x011a('0x6')][_0x011a('0x12')][this[_0x011a('0x5')]['id']])){return logger[_0x011a('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x011a('0x4')]['id'],this[_0x011a('0x5')]['id']);}else{logger[_0x011a('0x10')](_0x011a('0x1b'),this[_0x011a('0x4')]['id'],this['agent']['id']);util[_0x011a('0x1c')](this[_0x011a('0x3')],this[_0x011a('0x4')]['id'],this[_0x011a('0x6')][_0x011a('0x12')][this[_0x011a('0x5')]['id']],null,this[_0x011a('0x7')]);this[_0x011a('0x6')][_0x011a('0x12')][this[_0x011a('0x5')]['id']][_0x011a('0x16')]=![];this[_0x011a('0x6')][_0x011a('0x12')][this['agent']['id']]['busyQueue']=undefined;util[_0x011a('0x18')](this[_0x011a('0x4')]['id'],this[_0x011a('0x6')][_0x011a('0x12')][this['agent']['id']],_0x3d9771?_0x011a('0x1d'):_0x011a('0x1e'));}if(!_0x3d9771){setTimeout(this[_0x011a('0x8')][_0x011a('0xa')](this),0x3e8);}};function agent(_0x51817f,_0x31be50,_0x233236,_0x346d25){return new Agent(_0x51817f,_0x31be50,_0x233236,_0x346d25);}module[_0x011a('0x1f')]=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 54273ee..cb5813a 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 _0x2c13=['length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','TIMEOUT','busyQueue','exports','lodash','../../../../../config/logger','routing','notificationId','queue','realtime','squeue','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','isNil','Agents'];(function(_0x229224,_0x3b3ed1){var _0x379622=function(_0x151555){while(--_0x151555){_0x229224['push'](_0x229224['shift']());}};_0x379622(++_0x3b3ed1);}(_0x2c13,0x168));var _0x32c1=function(_0x1146ef,_0x14f629){_0x1146ef=_0x1146ef-0x0;var _0x1ee0ad=_0x2c13[_0x1146ef];return _0x1ee0ad;};'use strict';var _=require(_0x32c1('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x32c1('0x1'))(_0x32c1('0x2'));var Beepall=function(_0x2f443c,_0x1e81c4,_0x4eba1b,_0x4f832f){this[_0x32c1('0x3')]=uuid['v4']();this['squeue']=_0x2f443c;this[_0x32c1('0x4')]=_0x1e81c4;this[_0x32c1('0x5')]=_0x4eba1b;this[_0x32c1('0x2')]=_0x4f832f;this[_0x32c1('0x6')][_0x32c1('0x7')](this[_0x32c1('0x8')][_0x32c1('0x9')](this),this['handleTimeout'][_0x32c1('0x9')](this));this['squeue']['on'](_0x32c1('0xa'),this[_0x32c1('0xb')][_0x32c1('0x9')](this));this[_0x32c1('0x6')]['on'](_0x32c1('0xc'),this[_0x32c1('0xd')][_0x32c1('0x9')](this));};Beepall[_0x32c1('0xe')][_0x32c1('0x7')]=function(){this[_0x32c1('0x6')][_0x32c1('0x7')](this['handleRun'][_0x32c1('0x9')](this),this[_0x32c1('0xb')][_0x32c1('0x9')](this));};Beepall[_0x32c1('0xe')][_0x32c1('0xd')]=function(_0x237f54){this[_0x32c1('0xb')](!![]);};Beepall[_0x32c1('0xe')]['handleRun']=function(_0x207e53){var _0x3d5a8c=!![];if(!_[_0x32c1('0xf')](this[_0x32c1('0x4')])&&!_['isNil'](this[_0x32c1('0x4')][_0x32c1('0x10')])&&this[_0x32c1('0x4')]['Agents'][_0x32c1('0x11')]>0x0){for(var _0x50196c=0x0,_0x443c72;_0x50196c0x0){for(var _0x253286=0x0,_0x30eb8d;_0x2532860x0&&_0xc2b85c[_0x28fb61+_0x0ceb('0x1f')]>=_0xc2b85c[_0x28fb61+'Capacity']){writeLog(_0x38a716,_0xc2b85c,_0x28fb61[_0x0ceb('0x21')]()+_0x0ceb('0x22'));return![];}}return!![];};exports[_0x0ceb('0x23')]=function(_0x1451d3,_0x2432a8,_0x4aa831,_0x2de4f3,_0x3792bb){return sendNotification(!![],_0x1451d3,_0x2432a8,_0x4aa831,_0x2de4f3,_0x3792bb);};exports[_0x0ceb('0x24')]=function(_0x4427b8,_0x1ca4cb,_0x16265d,_0x58aa8b,_0x30adcb){return sendNotification(![],_0x4427b8,_0x1ca4cb,_0x16265d,_0x58aa8b,_0x30adcb);};exports[_0x0ceb('0x25')]=writeLog; \ No newline at end of file +var _0x9d9b=['[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','writeLog','util','../utils','ioredis','../../../../../config/logger','routing','redis','socket.io-emitter','emit','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','error','format','[%s][QUEUE]\x20%s','user:%s','save','remove','info'];(function(_0x509c83,_0x511882){var _0x534626=function(_0x9d21cf){while(--_0x9d21cf){_0x509c83['push'](_0x509c83['shift']());}};_0x534626(++_0x511882);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x223737,_0x4a0b07){_0x223737=_0x223737-0x0;var _0x39a203=_0x9d9b[_0x223737];return _0x39a203;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var utils=require(_0xb9d9('0x1'));var Mustache=require('mustache');var Redis=require(_0xb9d9('0x2'));var config=require('../../../../../config/environment');var logger=require(_0xb9d9('0x3'))(_0xb9d9('0x4'));config[_0xb9d9('0x5')]=_['defaults'](config[_0xb9d9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xb9d9('0x6'))(new Redis(config[_0xb9d9('0x5')]));function emit(_0x51af61,_0x13743f,_0x20e0e5){io['to'](_0x51af61)[_0xb9d9('0x7')](_0x13743f,_0x20e0e5);}function sendNotification(_0x6ee523,_0x391251,_0x1ffc92,_0x1bfec3,_0x5a9c18,_0x5b591e){io['to'](util['format']('user:%s',_0x1bfec3[_0xb9d9('0x8')]))[_0xb9d9('0x7')](_0xb9d9('0x9'),_0x1bfec3);var _0x5e226e=_0x5b591e||{};var _0x3bae93=_0x1ffc92[_0xb9d9('0xa')]('.');var _0x4cb239={'uniqueid':_0x391251,'channel':_0x3bae93[0x0],'id':_0x3bae93[0x1],'title':_0x3bae93[0x0]+_0xb9d9('0xb'),'interactionId':_0x3bae93[0x2],'queue':_0x5a9c18?_0x5a9c18['name']:null,'sound':_0x5e226e[_0xb9d9('0xc')][_0xb9d9('0xd')],'shake':_0x5e226e[_0xb9d9('0xc')][_0xb9d9('0xe')]};try{if(!_0x5e226e[_0xb9d9('0xf')]){_0x5e226e[_0xb9d9('0xf')]={};}if(_0x5a9c18){_0x5e226e[_0xb9d9('0xf')][_0xb9d9('0x10')]=_0x5a9c18;}else if(_0x5e226e['body']['queue']){delete _0x5e226e[_0xb9d9('0xf')][_0xb9d9('0x10')];}_0x4cb239[_0xb9d9('0x11')]=utils[_0xb9d9('0x12')](_0x5e226e['account']['notificationTemplate'],_0x5e226e);}catch(_0x1ffb39){_0x4cb239['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0xb9d9('0x13')](util[_0xb9d9('0x14')](_0xb9d9('0x15'),_0x391251,_0x1ffb39['message']));}io['to'](util[_0xb9d9('0x14')](_0xb9d9('0x16'),_0x1bfec3['name']))[_0xb9d9('0x7')](util[_0xb9d9('0x14')]('notification:%s',_0x6ee523?_0xb9d9('0x17'):_0xb9d9('0x18')),_0x4cb239);}function writeLog(_0x50f0ec,_0x39f7e1,_0x42ca87){return logger[_0xb9d9('0x19')](util[_0xb9d9('0x14')](_0xb9d9('0x1a'),_0x50f0ec,_0x39f7e1[_0xb9d9('0x8')],_0x42ca87));}exports['isAgentAvailable']=function(_0x46d4e8,_0x17ee7a,_0x53c82a,_0x45520b){if(_0x17ee7a[_0xb9d9('0x1b')]){writeLog(_0x46d4e8,_0x17ee7a,_0xb9d9('0x1c'));return![];}if(!_0x17ee7a[_0xb9d9('0x1d')]){writeLog(_0x46d4e8,_0x17ee7a,'OFFLINE');return![];}if(_0x17ee7a[_0x53c82a+_0xb9d9('0x1e')]){writeLog(_0x46d4e8,_0x17ee7a,_0xb9d9('0x1f'));return![];}if(_0x45520b&&_0x17ee7a[_0xb9d9('0x20')](_0x53c82a+_0xb9d9('0x21'))&&_0x17ee7a[_0xb9d9('0x20')](_0x53c82a+_0xb9d9('0x22'))){if(_0x17ee7a[_0x53c82a+'Capacity']>0x0&&_0x17ee7a[_0x53c82a+_0xb9d9('0x22')]>=_0x17ee7a[_0x53c82a+_0xb9d9('0x21')]){writeLog(_0x46d4e8,_0x17ee7a,_0x53c82a[_0xb9d9('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xb9d9('0x24')]=function(_0x1743b1,_0x63a35e,_0x290c01,_0x3caaaf,_0x402968){return sendNotification(!![],_0x1743b1,_0x63a35e,_0x290c01,_0x3caaaf,_0x402968);};exports[_0xb9d9('0x25')]=function(_0x5c74eb,_0x39f006,_0x3e79ef,_0xdf519a,_0x27bf0d){return sendNotification(![],_0x5c74eb,_0x39f006,_0x3e79ef,_0xdf519a,_0x27bf0d);};exports[_0xb9d9('0x26')]=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 b08a6a7..330be22 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 _0xa190=['join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','next','isObject','stringify','validate','shelljs','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','log','SYS\x20obj','error','[%s][SYSTEM]\x20%s'];(function(_0x11a7c9,_0x2de6e8){var _0x2bf3d8=function(_0x294db5){while(--_0x294db5){_0x11a7c9['push'](_0x11a7c9['shift']());}};_0x2bf3d8(++_0x2de6e8);}(_0xa190,0x100));var _0x0a19=function(_0x540018,_0x541233){_0x540018=_0x540018-0x0;var _0x47e698=_0xa190[_0x540018];return _0x47e698;};'use strict';var schema=require(_0x0a19('0x0'));var sh=require(_0x0a19('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0x0a19('0x2'),'required':!![],'message':_0x0a19('0x3')}});exports['consequence']=function(_0x321d98,_0x13eb5f){console[_0x0a19('0x4')]('CONSEQ');return function(_0x379afc){try{var _0x3deb1b={'command':_0x13eb5f[0x0]};console[_0x0a19('0x4')](_0x0a19('0x5'),_0x3deb1b);var _0x210f66=system['validate'](_0x3deb1b,{'typecast':!![]});if(_0x210f66['length']){logger[_0x0a19('0x6')](_0x0a19('0x7'),_0x321d98,_['map'](_0x210f66,'message')[_0x0a19('0x8')](',\x20'));logger[_0x0a19('0x9')](_0x0a19('0xa'),_0x321d98);_0x379afc['next']();}else{var _0xcf7489=this;var _0x385354=utils[_0x0a19('0xb')](_0x13eb5f[0x0],this);logger[_0x0a19('0x9')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x321d98,_0x385354);sh['exec'](_[_0x0a19('0xc')](_0x385354),function(_0xfe4a3d,_0x528a33){logger['info'](_0x0a19('0xd'),_0x321d98,_0xfe4a3d);if(_0xfe4a3d==0x0){var _0x4b0448=_0x528a33[_0x0a19('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x0a19('0xf')](_0x13eb5f[0x1])||_['isEmpty'](_0x13eb5f[0x1])){logger[_0x0a19('0x9')](_0x0a19('0x10'),_0x321d98);_0xcf7489['body'][_0x13eb5f[0x1]]=_0x4b0448;}else{logger[_0x0a19('0x9')](_0x0a19('0x11'),_0x321d98,_0x13eb5f[0x1],_0x4b0448);_0xcf7489[_0x0a19('0x12')][_0x13eb5f[0x1]]=_0x4b0448;}}_0x379afc[_0x0a19('0x13')]();});}}catch(_0x1a3538){logger[_0x0a19('0x6')](_0x0a19('0x7'),_0x321d98,_[_0x0a19('0x14')](_0x1a3538)?JSON[_0x0a19('0x15')](_0x1a3538):_0x1a3538);logger[_0x0a19('0x9')](_0x0a19('0xa'),_0x321d98);_0x379afc[_0x0a19('0x13')]();}};}; \ No newline at end of file +var _0xf1ff=['routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','log','CONSEQ','inside\x20R\x20function','SYS\x20obj','validate','length','error','[%s][SYSTEM]\x20%s','message','join','info','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','inside\x20error','isObject','stringify','lodash','./utils','../../../../config/logger'];(function(_0x552db9,_0x7f1e7){var _0x556ffb=function(_0x2d2933){while(--_0x2d2933){_0x552db9['push'](_0x552db9['shift']());}};_0x556ffb(++_0x7f1e7);}(_0xf1ff,0x1a1));var _0xff1f=function(_0x335136,_0x131d00){_0x335136=_0x335136-0x0;var _0x234b60=_0xf1ff[_0x335136];return _0x234b60;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xff1f('0x0'));var utils=require(_0xff1f('0x1'));var logger=require(_0xff1f('0x2'))(_0xff1f('0x3'));var system=schema({'command':{'type':_0xff1f('0x4'),'required':!![],'message':_0xff1f('0x5')}});exports[_0xff1f('0x6')]=function(_0x5de97f,_0x4ed717){console[_0xff1f('0x7')](_0xff1f('0x8'));return function(_0x1993a4){console[_0xff1f('0x7')](_0xff1f('0x9'),_0x1993a4);try{var _0x2c6a53={'command':_0x4ed717[0x0]};console[_0xff1f('0x7')](_0xff1f('0xa'),_0x2c6a53);var _0x1c9a4f=system[_0xff1f('0xb')](_0x2c6a53,{'typecast':!![]});if(_0x1c9a4f[_0xff1f('0xc')]){logger[_0xff1f('0xd')](_0xff1f('0xe'),_0x5de97f,_['map'](_0x1c9a4f,_0xff1f('0xf'))[_0xff1f('0x10')](',\x20'));logger[_0xff1f('0x11')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5de97f);_0x1993a4[_0xff1f('0x12')]();}else{var _0x361bce=this;var _0x54381d=utils[_0xff1f('0x13')](_0x4ed717[0x0],this);logger[_0xff1f('0x11')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5de97f,_0x54381d);sh[_0xff1f('0x14')](_[_0xff1f('0x15')](_0x54381d),function(_0x97c2ed,_0x463130){logger['info'](_0xff1f('0x16'),_0x5de97f,_0x97c2ed);if(_0x97c2ed==0x0){var _0x40decc=_0x463130['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xff1f('0x17')](_0x4ed717[0x1])||_[_0xff1f('0x18')](_0x4ed717[0x1])){logger[_0xff1f('0x11')](_0xff1f('0x19'),_0x5de97f);_0x361bce['body'][_0x4ed717[0x1]]=_0x40decc;}else{logger[_0xff1f('0x11')](_0xff1f('0x1a'),_0x5de97f,_0x4ed717[0x1],_0x40decc);_0x361bce['body'][_0x4ed717[0x1]]=_0x40decc;}}_0x1993a4['next']();});}}catch(_0x99ecae){console['log'](_0xff1f('0x1b'),_0x99ecae);logger[_0xff1f('0xd')](_0xff1f('0xe'),_0x5de97f,_[_0xff1f('0x1c')](_0x99ecae)?JSON[_0xff1f('0x1d')](_0x99ecae):_0x99ecae);logger[_0xff1f('0x11')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5de97f);_0x1993a4[_0xff1f('0x12')]();}};}; \ 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 1c811f1..ea1999f 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 _0x74a1=['info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','finally','next','error','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','map','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then'];(function(_0x5374eb,_0x4e5e18){var _0x406a25=function(_0x3dfa42){while(--_0x3dfa42){_0x5374eb['push'](_0x5374eb['shift']());}};_0x406a25(++_0x4e5e18);}(_0x74a1,0x1ac));var _0x174a=function(_0x589f05,_0x1c5a16){_0x589f05=_0x589f05-0x0;var _0x3a11b4=_0x74a1[_0x589f05];return _0x3a11b4;};'use strict';var schema=require(_0x174a('0x0'));var _=require(_0x174a('0x1'));var rpc={'chatInteraction':require(_0x174a('0x2')),'openchannelInteraction':require(_0x174a('0x3')),'smsInteraction':require(_0x174a('0x4')),'mailInteraction':require(_0x174a('0x5')),'faxInteraction':require(_0x174a('0x6')),'whatsappInteraction':require(_0x174a('0x7'))};var logger=require(_0x174a('0x8'))('routing');var tag=schema({'tag':{'type':_0x174a('0x9'),'required':!![],'message':_0x174a('0xa')}});exports[_0x174a('0xb')]=function(_0x4f0b2a,_0x272665,_0x47b15c,_0x19fda7){return function(_0x17d316){try{var _0x10be8a={'tag':_0x272665[0x0]};var _0x2990c7=tag[_0x174a('0x0')](_0x10be8a,{'typecast':!![]});if(_0x2990c7['length']){logger['error']('[%s][TAG]\x20%s',_0x4f0b2a,_[_0x174a('0xc')](_0x2990c7,'message')[_0x174a('0xd')](',\x20'));logger['info'](_0x174a('0xe'),_0x4f0b2a);_0x17d316['next']();}else{var _0x54704e={'ids':[_0x272665[0x0]]};if(rpc[_0x19fda7[_0x174a('0xf')]+_0x174a('0x10')]){rpc[_0x19fda7[_0x174a('0xf')]+_0x174a('0x10')][_0x174a('0x11')](_0x19fda7[_0x174a('0x12')]['id'],_0x54704e)[_0x174a('0x13')](function(_0x5ec9d8){logger[_0x174a('0x14')](_0x174a('0x15'),_0x4f0b2a,_0x272665[0x1],_0x19fda7[_0x174a('0xf')],_0x19fda7[_0x174a('0x12')]['id']);})[_0x174a('0x16')](function(_0x3b7ed5){logger['error'](_0x174a('0x17'),_0x4f0b2a,JSON['stringify'](_0x3b7ed5));logger['info'](_0x174a('0xe'),_0x4f0b2a);})[_0x174a('0x18')](function(){_0x17d316[_0x174a('0x19')]();});}}}catch(_0x538133){logger[_0x174a('0x1a')](_0x174a('0x17'),_0x4f0b2a,_['isObject'](_0x538133)?JSON[_0x174a('0x1b')](_0x538133):_0x538133);logger[_0x174a('0x14')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4f0b2a);_0x17d316['next']();}};}; \ No newline at end of file +var _0x73d9=['catch','stringify','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x1f6b2e,_0x3776d8){var _0x3d7b0d=function(_0x37b030){while(--_0x37b030){_0x1f6b2e['push'](_0x1f6b2e['shift']());}};_0x3d7b0d(++_0x3776d8);}(_0x73d9,0x1c3));var _0x973d=function(_0x4a6ae6,_0x28788e){_0x4a6ae6=_0x4a6ae6-0x0;var _0x243493=_0x73d9[_0x4a6ae6];return _0x243493;};'use strict';var schema=require(_0x973d('0x0'));var _=require(_0x973d('0x1'));var rpc={'chatInteraction':require(_0x973d('0x2')),'openchannelInteraction':require(_0x973d('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x973d('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x973d('0x5'))};var logger=require(_0x973d('0x6'))(_0x973d('0x7'));var tag=schema({'tag':{'type':_0x973d('0x8'),'required':!![],'message':_0x973d('0x9')}});exports[_0x973d('0xa')]=function(_0x12a543,_0x3b1545,_0x2e29f1,_0x4bda5b){return function(_0x44b772){try{var _0x454ba6={'tag':_0x3b1545[0x0]};var _0x5d1b81=tag[_0x973d('0x0')](_0x454ba6,{'typecast':!![]});if(_0x5d1b81[_0x973d('0xb')]){logger[_0x973d('0xc')](_0x973d('0xd'),_0x12a543,_[_0x973d('0xe')](_0x5d1b81,'message')[_0x973d('0xf')](',\x20'));logger['info'](_0x973d('0x10'),_0x12a543);_0x44b772[_0x973d('0x11')]();}else{var _0x30c22f={'ids':[_0x3b1545[0x0]]};if(rpc[_0x4bda5b[_0x973d('0x12')]+_0x973d('0x13')]){rpc[_0x4bda5b[_0x973d('0x12')]+_0x973d('0x13')][_0x973d('0x14')](_0x4bda5b[_0x973d('0x15')]['id'],_0x30c22f)[_0x973d('0x16')](function(_0x197021){logger[_0x973d('0x17')](_0x973d('0x18'),_0x12a543,_0x3b1545[0x1],_0x4bda5b['channel'],_0x4bda5b[_0x973d('0x15')]['id']);})[_0x973d('0x19')](function(_0x356c3d){logger[_0x973d('0xc')]('[%s][TAG]\x20%s',_0x12a543,JSON[_0x973d('0x1a')](_0x356c3d));logger[_0x973d('0x17')](_0x973d('0x10'),_0x12a543);})[_0x973d('0x1b')](function(){_0x44b772[_0x973d('0x11')]();});}}}catch(_0x3cace4){logger[_0x973d('0xc')](_0x973d('0xd'),_0x12a543,_['isObject'](_0x3cace4)?JSON['stringify'](_0x3cace4):_0x3cace4);logger[_0x973d('0x17')](_0x973d('0x10'),_0x12a543);_0x44b772[_0x973d('0x11')]();}};}; \ 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 d1c6588..452d092 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 _0x4e83=['list','lodash','exports','merge','body','contact','message','account','interaction'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0x4e83,0x88));var _0x34e8=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x4e83[_0x16b9ed];return _0x66b1f8;};'use strict';var Mustache=require('mustache');var _=require(_0x34e8('0x0'));module[_0x34e8('0x1')]={'getMustacheRender':function(_0x3345c6,_0x3d2157){return Mustache['render'](_0x3345c6,_[_0x34e8('0x2')](_0x3d2157[_0x34e8('0x3')],{'contact':_0x3d2157[_0x34e8('0x4')],'message':_0x3d2157[_0x34e8('0x5')],'account':_0x3d2157[_0x34e8('0x6')],'interaction':_0x3d2157[_0x34e8('0x7')],'list':_0x3d2157[_0x34e8('0x8')]}))||'';}}; \ No newline at end of file +var _0x5a01=['lodash','exports','render','merge','contact','message','account','mustache'];(function(_0x4d2366,_0x412bfe){var _0xefd8bb=function(_0x17e49c){while(--_0x17e49c){_0x4d2366['push'](_0x4d2366['shift']());}};_0xefd8bb(++_0x412bfe);}(_0x5a01,0x1af));var _0x15a0=function(_0x1757f2,_0x1b09fa){_0x1757f2=_0x1757f2-0x0;var _0x5e7212=_0x5a01[_0x1757f2];return _0x5e7212;};'use strict';var Mustache=require(_0x15a0('0x0'));var _=require(_0x15a0('0x1'));module[_0x15a0('0x2')]={'getMustacheRender':function(_0x4e2aa0,_0x58ef33){return Mustache[_0x15a0('0x3')](_0x4e2aa0,_[_0x15a0('0x4')](_0x58ef33['body'],{'contact':_0x58ef33[_0x15a0('0x5')],'message':_0x58ef33[_0x15a0('0x6')],'account':_0x58ef33[_0x15a0('0x7')],'interaction':_0x58ef33['interaction'],'list':_0x58ef33['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 15dc703..7e72543 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 _0x6c32=['openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','isArray','applications','length','toLowerCase','split','channel','mail','push','slice','join','dialogflow','appdata','amazonlex','tag','TagId','%s:%s:%s','app','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','capacity','hasOwnProperty','CurrentCapacity','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available'];(function(_0x4a9801,_0x548afb){var _0x2b089a=function(_0x4b4074){while(--_0x4b4074){_0x4a9801['push'](_0x4a9801['shift']());}};_0x2b089a(++_0x548afb);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var path=require(_0x26c3('0x2'));var fs=require('fs');var jayson=require(_0x26c3('0x3'));var BPromise=require(_0x26c3('0x4'));var uuid=require(_0x26c3('0x5'));var config=require(_0x26c3('0x6'));var logger=require(_0x26c3('0x7'))(_0x26c3('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x26c3('0x9')),'chatQueueReport':require(_0x26c3('0xa')),'smsQueueReport':require(_0x26c3('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x26c3('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x3dde22,_0x3ff8e7,_0x1a4c5b){return util[_0x26c3('0xd')](_0x26c3('0xe'),_0x3dde22,_0x3ff8e7||0x0,_0x1a4c5b||0x0);}function getIntervals(_0xda2203,_0x155187){var _0x380194=[];if(!_[_0x26c3('0xf')](_0x155187[_0x26c3('0x10')])&&!_['isNil'](_0xda2203[_0x155187['IntervalId']])&&!_['isNil'](_0xda2203[_0x155187['IntervalId']][_0x26c3('0x11')])){_0x380194=_[_0x26c3('0x12')](_0xda2203[_0x155187[_0x26c3('0x10')]][_0x26c3('0x11')],'interval');}else if(!_['isNil'](_0x155187[_0x26c3('0x13')])){_0x380194=[_0x155187[_0x26c3('0x13')]];}return _0x380194;}exports[_0x26c3('0x14')]=function(_0x3cd3c7){_0x3cd3c7[_0x26c3('0x15')]={};return new BPromise(function(_0x568d0b,_0x5d4e9d){var _0x2acfb1={'Start':function(_0xc14c69){var _0x4f4256=this;return new Promise(function(_0x4ed7c1,_0x124cb3){if(_0xc14c69){try{var _0x5e863f=[];var _0x3ce1ea=getId(_0xc14c69['channel'],_0xc14c69['message']?_0xc14c69[_0x26c3('0x16')]['id']:0x0,_0xc14c69['interaction']?_0xc14c69[_0x26c3('0x17')]['id']:0x0);if(_0xc14c69['applications']&&_[_0x26c3('0x18')](_0xc14c69[_0x26c3('0x19')])&&_0xc14c69[_0x26c3('0x19')][_0x26c3('0x1a')]){for(var _0x20317d=0x0;_0x20317d<_0xc14c69['applications']['length'];_0x20317d+=0x1){var _0x47657d=_0xc14c69[_0x26c3('0x19')][_0x20317d];if(fs['existsSync'](path['join'](__dirname,_0x26c3('0x19'),_0x47657d['app']+'.js'))){var _0x128fca=[];switch(_0x47657d['app'][_0x26c3('0x1b')]()){case'autoreply':var _0x367b62=_0x47657d['appdata'][_0x26c3('0x1c')](',');if(_0xc14c69[_0x26c3('0x1d')]===_0x26c3('0x1e')){_0x128fca[_0x26c3('0x1f')](_0x367b62[0x0]);_0x128fca[_0x26c3('0x1f')](_0x367b62[0x1]);_0x128fca[_0x26c3('0x1f')](_0x367b62[_0x26c3('0x20')](0x2,_0x367b62[_0x26c3('0x1a')])[_0x26c3('0x21')](','));}else{_0x128fca[_0x26c3('0x1f')](_0x367b62[0x0]);_0x128fca['push'](_0x367b62[_0x26c3('0x20')](0x1,_0x367b62['length'])['join'](','));}break;case _0x26c3('0x22'):var _0x13f843=_0x47657d['appdata'][_0x26c3('0x1c')](',');_0x128fca['push'](_0x13f843[0x0]);_0x128fca[_0x26c3('0x1f')](_0x13f843[0x1]);_0x128fca[_0x26c3('0x1f')](_0x13f843[_0x26c3('0x20')](0x2,_0x13f843[_0x26c3('0x1a')])[_0x26c3('0x21')](','));break;case'dialogflowv2':var _0x1d3331=_0x47657d[_0x26c3('0x23')][_0x26c3('0x1c')](',');_0x128fca[_0x26c3('0x1f')](_0x1d3331[0x0]);_0x128fca[_0x26c3('0x1f')](_0x1d3331[0x1]);_0x128fca[_0x26c3('0x1f')](_0x1d3331[0x2]);_0x128fca['push'](_0x1d3331[0x3]);_0x128fca[_0x26c3('0x1f')](_0x1d3331[_0x26c3('0x20')](0x4,_0x1d3331[_0x26c3('0x1a')])['join'](','));break;case _0x26c3('0x24'):var _0x19316e=_0x47657d[_0x26c3('0x23')][_0x26c3('0x1c')](',');_0x128fca[_0x26c3('0x1f')](_0x19316e[0x0]);_0x128fca[_0x26c3('0x1f')](_0x19316e[0x1]);_0x128fca['push'](_0x19316e[0x2]);_0x128fca[_0x26c3('0x1f')](_0x19316e[0x3]);_0x128fca[_0x26c3('0x1f')](_0x19316e['slice'](0x4,_0x19316e['length'])['join'](','));break;case'message':_0x128fca['push'](_0x47657d[_0x26c3('0x23')]);break;case _0x26c3('0x25'):_0x128fca['push'](_0x47657d[_0x26c3('0x26')]);_0x128fca[_0x26c3('0x1f')](_0x47657d['appdata']);break;default:_0x128fca=_['isNil'](_0x47657d[_0x26c3('0x23')])?[]:_0x47657d['appdata'][_0x26c3('0x1c')](',');}var _0x4fc9ff={'id':util[_0x26c3('0xd')](_0x26c3('0x27'),_0x3ce1ea,_0x47657d['id'],_0x47657d[_0x26c3('0x28')]),'condition':require(_0x26c3('0x29'))[_0x26c3('0x2a')](_0x3ce1ea,getIntervals(_0x3cd3c7['intervals'],_0x47657d),_0x3cd3c7),'consequence':require(_0x26c3('0x2b')+_0x47657d[_0x26c3('0x28')])[_0x26c3('0x2c')](_0x3ce1ea,_0x128fca,_0x3cd3c7,_0xc14c69),'p':_0x47657d[_0x26c3('0x2d')]||0x0};logger[_0x26c3('0x2e')](_0x26c3('0x2f'),_0x4fc9ff['id'],'on\x20interval',getIntervals(_0x3cd3c7['intervals'],_0x47657d)[_0x26c3('0x21')](_0x26c3('0x30')));_0x5e863f[_0x26c3('0x1f')](_0x4fc9ff);}else{logger[_0x26c3('0x31')](_0x26c3('0x32'),path['join'](__dirname,'applications',_0x47657d['app']+_0x26c3('0x33')));}}_0x3cd3c7[_0x26c3('0x15')][_0x3ce1ea]=new RuleEngine(_0x5e863f);_0x3cd3c7[_0x26c3('0x15')][_0x3ce1ea][_0x26c3('0x34')](_0xc14c69,function(_0x124690){logger['info']('Applications\x20executed',JSON[_0x26c3('0x35')](_0x124690[_0x26c3('0x36')]));if(_0x3cd3c7[_0x26c3('0x15')][_0x3ce1ea]){_0x3cd3c7[_0x26c3('0x15')][_0x3ce1ea]['emit'](_0x26c3('0x37'));}});return _0x4ed7c1({'code':0xc8,'message':_0xc14c69});}else{logger[_0x26c3('0x2e')](_0x26c3('0x38'));return _0x4ed7c1({'code':0xc8,'message':_0xc14c69});}}catch(_0x203c54){logger[_0x26c3('0x31')](_0x203c54[_0x26c3('0x39')]);return _0x124cb3(_0x4f4256[_0x26c3('0x31')](0x1f4,_0x203c54));}}return _0x124cb3(_0x26c3('0x3a'));});},'AcceptMessage':function(_0x306ef1){var _0x1c0d6c=this;return new Promise(function(_0x1b415e,_0xafc671){if(_0x306ef1[_0x26c3('0x3b')]&&_0x306ef1['agent']['id']){if(_0x3cd3c7[_0x26c3('0x3c')][_0x306ef1[_0x26c3('0x3b')]['id']]){_0x3cd3c7[_0x26c3('0x3c')][_0x306ef1[_0x26c3('0x3b')]['id']][_0x26c3('0x3d')]=![];_0x3cd3c7[_0x26c3('0x3c')][_0x306ef1['agent']['id']][_0x26c3('0x3e')]=undefined;}}if(_0x306ef1['message']&&_0x306ef1[_0x26c3('0x16')]['id']){try{var _0x50f5cb=getId(_0x306ef1[_0x26c3('0x1d')],_0x306ef1[_0x26c3('0x16')]?_0x306ef1['message']['id']:0x0,_0x306ef1[_0x26c3('0x17')]?_0x306ef1[_0x26c3('0x17')]['id']:0x0);if(_0x3cd3c7[_0x26c3('0x15')][_0x50f5cb]){_0x3cd3c7[_0x26c3('0x15')][_0x50f5cb][_0x26c3('0x3f')]('end');if(rpc[_0x306ef1[_0x26c3('0x1d')]+'QueueReport']){rpc[_0x306ef1[_0x26c3('0x1d')]+'QueueReport']['update'](_0x50f5cb,{'UserId':_0x306ef1[_0x26c3('0x16')][_0x26c3('0x40')]})[_0x26c3('0x41')](function(_0x50f4de){logger[_0x26c3('0x31')](_0x26c3('0x42'));});}}return _0x1b415e({'code':0xc8,'message':_0x306ef1});}catch(_0xe2a7e){logger[_0x26c3('0x31')](_0xe2a7e[_0x26c3('0x39')]);return _0xafc671(_0x1c0d6c[_0x26c3('0x31')](0x1f4,_0xe2a7e));}}logger['error'](_0x26c3('0x43'));return _0xafc671(_0x1c0d6c[_0x26c3('0x31')](0x1f4,_0x26c3('0x43')));});},'RejectMessage':function(_0x133cf7){var _0x551e22=this;return new Promise(function(_0x2f87de,_0x3f4ca9){if(_0x133cf7['agent']&&_0x133cf7[_0x26c3('0x3b')]['id']){try{if(_0x3cd3c7[_0x26c3('0x3c')][_0x133cf7['agent']['id']]){_0x3cd3c7[_0x26c3('0x3c')][_0x133cf7['agent']['id']][_0x26c3('0x3d')]=![];_0x3cd3c7[_0x26c3('0x3c')][_0x133cf7[_0x26c3('0x3b')]['id']][_0x26c3('0x3e')]=undefined;}return _0x2f87de({'code':0xc8,'message':_0x133cf7});}catch(_0x4365e4){logger[_0x26c3('0x31')](_0x4365e4[_0x26c3('0x39')]);return _0x3f4ca9(_0x551e22['error'](0x1f4,_0x4365e4));}}logger[_0x26c3('0x31')]('message\x20is\x20empty');return _0x3f4ca9(_0x551e22['error'](0x1f4,_0x26c3('0x43')));});},'AbandonInteraction':function(_0x3a46f9){var _0x3037ae=this;return new Promise(function(_0x4dc997,_0x4832a2){if(_0x3a46f9[_0x26c3('0x1d')]&&_0x3a46f9[_0x26c3('0x17')]&&_0x3a46f9[_0x26c3('0x17')]['id']){try{var _0x4d1ec7=getId(_0x3a46f9[_0x26c3('0x1d')],_0x3a46f9[_0x26c3('0x16')]?_0x3a46f9[_0x26c3('0x16')]['id']:0x0,_0x3a46f9['interaction']?_0x3a46f9[_0x26c3('0x17')]['id']:0x0);if(_0x3cd3c7['rules'][_0x4d1ec7]){_0x3cd3c7[_0x26c3('0x15')][_0x4d1ec7][_0x26c3('0x3f')](_0x26c3('0x44'));}return _0x4dc997({'code':0xc8,'message':_0x3a46f9});}catch(_0x499445){logger[_0x26c3('0x31')](_0x499445[_0x26c3('0x39')]);return _0x4832a2(_0x3037ae[_0x26c3('0x31')](0x1f4,_0x499445));}}logger[_0x26c3('0x31')](_0x26c3('0x43'));return _0x4832a2(_0x3037ae[_0x26c3('0x31')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x370b2e){var _0x306fef=this;return new Promise(function(_0x5be7d1,_0x394187){if(_0x3cd3c7['agents']['hasOwnProperty'](_0x370b2e['id'])){for(var _0x14a37a in _0x370b2e['capacity']){if(_0x370b2e[_0x26c3('0x45')][_0x26c3('0x46')](_0x14a37a)){if(_0x3cd3c7[_0x26c3('0x3c')][_0x370b2e['id']][_0x26c3('0x46')](_0x14a37a+'CurrentCapacity')){_0x3cd3c7['agents'][_0x370b2e['id']][_0x14a37a+_0x26c3('0x47')]=parseInt(_0x370b2e['capacity'][_0x14a37a],0xa);}}}_0x3cd3c7['agents'][_0x370b2e['id']]['updateRealtime']();return _0x5be7d1({'code':0xc8,'message':_0x3cd3c7[_0x26c3('0x3c')][_0x370b2e['id']]});}else{return _0x394187(_0x306fef['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x1c7d72){return new Promise(function(_0x531e38,_0xa7f1ad){var _0x30299d=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x3c')]);_0x531e38({'count':_0x30299d['length'],'rows':_0x30299d});});},'ChatQueues':function(_0x400c6d){return new Promise(function(_0x47749e,_0x1fcbb6){var _0x2680f5=[];for(var _0x5926f7 in _0x3cd3c7[_0x26c3('0x49')]){if(_0x3cd3c7[_0x26c3('0x49')][_0x26c3('0x46')](_0x5926f7)){var _0x7aa03a=_0x3cd3c7[_0x26c3('0x49')][_0x5926f7];var _0x28cde2={'id':_0x7aa03a['id'],'available':_0x7aa03a['available'],'loggedIn':_0x7aa03a[_0x26c3('0x4a')],'name':_0x7aa03a[_0x26c3('0x4b')],'paused':_0x7aa03a[_0x26c3('0x4c')],'waiting':_0x7aa03a[_0x26c3('0x4d')]};_0x2680f5['push'](_0x28cde2);}}_0x47749e({'count':_0x2680f5[_0x26c3('0x1a')],'rows':_0x2680f5});});},'MailQueues':function(_0x452643){return new Promise(function(_0xf10de,_0x416373){var _0x4d4970=[];for(var _0x396de4 in _0x3cd3c7[_0x26c3('0x4e')]){if(_0x3cd3c7[_0x26c3('0x4e')][_0x26c3('0x46')](_0x396de4)){var _0x5d0453=_0x3cd3c7[_0x26c3('0x4e')][_0x396de4];var _0x595fdd={'id':_0x5d0453['id'],'available':_0x5d0453[_0x26c3('0x4f')],'loggedIn':_0x5d0453['loggedIn'],'name':_0x5d0453[_0x26c3('0x4b')],'paused':_0x5d0453[_0x26c3('0x4c')],'waiting':_0x5d0453['waiting']};_0x4d4970[_0x26c3('0x1f')](_0x595fdd);}}_0xf10de({'count':_0x4d4970[_0x26c3('0x1a')],'rows':_0x4d4970});});},'OpenchannelQueues':function(_0x266e2b){return new Promise(function(_0xe5c060,_0x41767d){var _0x4fbd2e=[];for(var _0x1dcf53 in _0x3cd3c7[_0x26c3('0x50')]){if(_0x3cd3c7[_0x26c3('0x50')][_0x26c3('0x46')](_0x1dcf53)){var _0x26cb5b=_0x3cd3c7[_0x26c3('0x50')][_0x1dcf53];var _0x38cd7e={'id':_0x26cb5b['id'],'available':_0x26cb5b['available'],'loggedIn':_0x26cb5b[_0x26c3('0x4a')],'name':_0x26cb5b[_0x26c3('0x4b')],'paused':_0x26cb5b[_0x26c3('0x4c')],'waiting':_0x26cb5b[_0x26c3('0x4d')]};_0x4fbd2e['push'](_0x38cd7e);}}_0xe5c060({'count':_0x4fbd2e[_0x26c3('0x1a')],'rows':_0x4fbd2e});});},'SmsQueues':function(_0x965869){return new Promise(function(_0x5f1c25,_0x4df2f){var _0x46f622=[];for(var _0x43da27 in _0x3cd3c7[_0x26c3('0x51')]){if(_0x3cd3c7[_0x26c3('0x51')][_0x26c3('0x46')](_0x43da27)){var _0x2addd3=_0x3cd3c7[_0x26c3('0x51')][_0x43da27];var _0x3afdc7={'id':_0x2addd3['id'],'available':_0x2addd3[_0x26c3('0x4f')],'loggedIn':_0x2addd3[_0x26c3('0x4a')],'name':_0x2addd3[_0x26c3('0x4b')],'paused':_0x2addd3['paused'],'waiting':_0x2addd3['waiting']};_0x46f622['push'](_0x3afdc7);}}_0x5f1c25({'count':_0x46f622['length'],'rows':_0x46f622});});},'FaxQueues':function(_0x15a6c1){return new Promise(function(_0x27869f,_0x2464c7){var _0x3fe81e=[];for(var _0x2c136c in _0x3cd3c7[_0x26c3('0x52')]){if(_0x3cd3c7[_0x26c3('0x52')][_0x26c3('0x46')](_0x2c136c)){var _0x55cdc8=_0x3cd3c7[_0x26c3('0x52')][_0x2c136c];var _0x134cee={'id':_0x55cdc8['id'],'available':_0x55cdc8[_0x26c3('0x4f')],'loggedIn':_0x55cdc8[_0x26c3('0x4a')],'name':_0x55cdc8[_0x26c3('0x4b')],'paused':_0x55cdc8[_0x26c3('0x4c')],'waiting':_0x55cdc8['waiting']};_0x3fe81e[_0x26c3('0x1f')](_0x134cee);}}_0x27869f({'count':_0x3fe81e[_0x26c3('0x1a')],'rows':_0x3fe81e});});},'WhatsappQueues':function(_0x4dc47c){return new Promise(function(_0x25a2cb,_0x252534){var _0x538e3f=[];for(var _0x153509 in _0x3cd3c7[_0x26c3('0x53')]){if(_0x3cd3c7[_0x26c3('0x53')]['hasOwnProperty'](_0x153509)){var _0x35890f=_0x3cd3c7[_0x26c3('0x53')][_0x153509];var _0x39fe7e={'id':_0x35890f['id'],'available':_0x35890f[_0x26c3('0x4f')],'loggedIn':_0x35890f[_0x26c3('0x4a')],'name':_0x35890f[_0x26c3('0x4b')],'paused':_0x35890f[_0x26c3('0x4c')],'waiting':_0x35890f['waiting']};_0x538e3f['push'](_0x39fe7e);}}_0x25a2cb({'count':_0x538e3f[_0x26c3('0x1a')],'rows':_0x538e3f});});},'ChatQueuesWaitingInteractions':function(_0x1ce607){return new Promise(function(_0x1c7387,_0x18189a){var _0x56b282=_[_0x26c3('0x48')](_0x3cd3c7['chatQueuesWaitingInteractions']);_0x1c7387({'count':_0x56b282['length'],'rows':_0x56b282});});},'MailQueuesWaitingInteractions':function(_0x407c93){return new Promise(function(_0x338ea0,_0x5d9223){var _0x3c6f6f=_['values'](_0x3cd3c7[_0x26c3('0x54')]);_0x338ea0({'count':_0x3c6f6f[_0x26c3('0x1a')],'rows':_0x3c6f6f});});},'OpenchannelQueuesWaitingInteractions':function(_0x3f0e89){return new Promise(function(_0x5bbaae,_0xc40965){var _0x585e76=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x55')]);_0x5bbaae({'count':_0x585e76[_0x26c3('0x1a')],'rows':_0x585e76});});},'SmsQueuesWaitingInteractions':function(_0x3f3b87){return new Promise(function(_0x3d3144,_0x496135){var _0x52d532=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x56')]);_0x3d3144({'count':_0x52d532['length'],'rows':_0x52d532});});},'FaxQueuesWaitingInteractions':function(_0x346429){return new Promise(function(_0x211668,_0x295463){var _0x4dd8a2=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x57')]);_0x211668({'count':_0x4dd8a2['length'],'rows':_0x4dd8a2});});},'WhatsappQueuesWaitingInteractions':function(_0x5ebeab){return new Promise(function(_0x1440c9,_0x3d5bab){var _0x3da815=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x58')]);_0x1440c9({'count':_0x3da815[_0x26c3('0x1a')],'rows':_0x3da815});});}};var _0x483458=jayson[_0x26c3('0x59')](_0x2acfb1)[_0x26c3('0x5a')]();_0x483458['on']('error',function(_0x4326a){logger[_0x26c3('0x31')](JSON[_0x26c3('0x35')](_0x4326a));return _0x5d4e9d(_0x4326a);});_0x483458['listen'](0x232c,_0x26c3('0x5b'),function(){console[_0x26c3('0x5c')](_0x26c3('0x5d'),0x232c);return _0x568d0b(_0x26c3('0x5e')+0x232c);});});}; \ No newline at end of file +var _0xe5b3=['on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','stringify','matchPath','rules','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','end','QueueReport','catch','busy','busyQueue','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','chatQueues','available','name','paused','mailQueues','waiting','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','./interval','intervals','./applications/','consequence','info'];(function(_0x1c3429,_0x11d159){var _0x1609bd=function(_0x5ce42c){while(--_0x5ce42c){_0x1c3429['push'](_0x1c3429['shift']());}};_0x1609bd(++_0x11d159);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5932b3,_0x20e226){_0x5932b3=_0x5932b3-0x0;var _0x8168ac=_0xe5b3[_0x5932b3];return _0x8168ac;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var fs=require('fs');var jayson=require(_0x3e5b('0x2'));var BPromise=require(_0x3e5b('0x3'));var uuid=require(_0x3e5b('0x4'));var config=require(_0x3e5b('0x5'));var logger=require(_0x3e5b('0x6'))(_0x3e5b('0x7'));var rpc={'openchannelQueueReport':require(_0x3e5b('0x8')),'mailQueueReport':require(_0x3e5b('0x9')),'chatQueueReport':require(_0x3e5b('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x3e5b('0xb')),'whatsappQueueReport':require(_0x3e5b('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x41d46f,_0x3901c2,_0x3c7c2e){return util[_0x3e5b('0xd')]('%s.%s.%s',_0x41d46f,_0x3901c2||0x0,_0x3c7c2e||0x0);}function getIntervals(_0x4ed6bc,_0x1fef54){var _0x3d3b6e=[];if(!_[_0x3e5b('0xe')](_0x1fef54[_0x3e5b('0xf')])&&!_[_0x3e5b('0xe')](_0x4ed6bc[_0x1fef54['IntervalId']])&&!_[_0x3e5b('0xe')](_0x4ed6bc[_0x1fef54['IntervalId']][_0x3e5b('0x10')])){_0x3d3b6e=_[_0x3e5b('0x11')](_0x4ed6bc[_0x1fef54[_0x3e5b('0xf')]][_0x3e5b('0x10')],_0x3e5b('0x12'));}else if(!_[_0x3e5b('0xe')](_0x1fef54[_0x3e5b('0x12')])){_0x3d3b6e=[_0x1fef54['interval']];}return _0x3d3b6e;}exports[_0x3e5b('0x13')]=function(_0x5f2f9c){_0x5f2f9c['rules']={};return new BPromise(function(_0x4d71a3,_0x3754e3){var _0x3f5368={'Start':function(_0x17aaa3){var _0x4fb471=this;return new Promise(function(_0x1f81a7,_0x59ddc0){if(_0x17aaa3){try{var _0x56a453=[];var _0x258d6a=getId(_0x17aaa3[_0x3e5b('0x14')],_0x17aaa3['message']?_0x17aaa3[_0x3e5b('0x15')]['id']:0x0,_0x17aaa3[_0x3e5b('0x16')]?_0x17aaa3['interaction']['id']:0x0);if(_0x17aaa3[_0x3e5b('0x17')]&&_[_0x3e5b('0x18')](_0x17aaa3['applications'])&&_0x17aaa3['applications'][_0x3e5b('0x19')]){for(var _0x20806a=0x0;_0x20806a<_0x17aaa3[_0x3e5b('0x17')][_0x3e5b('0x19')];_0x20806a+=0x1){var _0x24de5b=_0x17aaa3[_0x3e5b('0x17')][_0x20806a];if(fs[_0x3e5b('0x1a')](path[_0x3e5b('0x1b')](__dirname,_0x3e5b('0x17'),_0x24de5b[_0x3e5b('0x1c')]+_0x3e5b('0x1d')))){var _0x11e5cf=[];switch(_0x24de5b[_0x3e5b('0x1c')][_0x3e5b('0x1e')]()){case'autoreply':var _0x433f9c=_0x24de5b[_0x3e5b('0x1f')][_0x3e5b('0x20')](',');if(_0x17aaa3[_0x3e5b('0x14')]==='mail'){_0x11e5cf[_0x3e5b('0x21')](_0x433f9c[0x0]);_0x11e5cf['push'](_0x433f9c[0x1]);_0x11e5cf[_0x3e5b('0x21')](_0x433f9c[_0x3e5b('0x22')](0x2,_0x433f9c['length'])[_0x3e5b('0x1b')](','));}else{_0x11e5cf[_0x3e5b('0x21')](_0x433f9c[0x0]);_0x11e5cf[_0x3e5b('0x21')](_0x433f9c[_0x3e5b('0x22')](0x1,_0x433f9c[_0x3e5b('0x19')])[_0x3e5b('0x1b')](','));}break;case _0x3e5b('0x23'):var _0x2ddf57=_0x24de5b['appdata'][_0x3e5b('0x20')](',');_0x11e5cf['push'](_0x2ddf57[0x0]);_0x11e5cf[_0x3e5b('0x21')](_0x2ddf57[0x1]);_0x11e5cf['push'](_0x2ddf57[_0x3e5b('0x22')](0x2,_0x2ddf57[_0x3e5b('0x19')])[_0x3e5b('0x1b')](','));break;case _0x3e5b('0x24'):var _0x10d2ed=_0x24de5b[_0x3e5b('0x1f')][_0x3e5b('0x20')](',');_0x11e5cf[_0x3e5b('0x21')](_0x10d2ed[0x0]);_0x11e5cf[_0x3e5b('0x21')](_0x10d2ed[0x1]);_0x11e5cf[_0x3e5b('0x21')](_0x10d2ed[0x2]);_0x11e5cf[_0x3e5b('0x21')](_0x10d2ed[0x3]);_0x11e5cf['push'](_0x10d2ed[_0x3e5b('0x22')](0x4,_0x10d2ed[_0x3e5b('0x19')])[_0x3e5b('0x1b')](','));break;case _0x3e5b('0x25'):var _0x39a232=_0x24de5b[_0x3e5b('0x1f')][_0x3e5b('0x20')](',');_0x11e5cf['push'](_0x39a232[0x0]);_0x11e5cf[_0x3e5b('0x21')](_0x39a232[0x1]);_0x11e5cf['push'](_0x39a232[0x2]);_0x11e5cf['push'](_0x39a232[0x3]);_0x11e5cf[_0x3e5b('0x21')](_0x39a232[_0x3e5b('0x22')](0x4,_0x39a232['length'])[_0x3e5b('0x1b')](','));break;case _0x3e5b('0x15'):_0x11e5cf[_0x3e5b('0x21')](_0x24de5b[_0x3e5b('0x1f')]);break;case _0x3e5b('0x26'):_0x11e5cf[_0x3e5b('0x21')](_0x24de5b[_0x3e5b('0x27')]);_0x11e5cf[_0x3e5b('0x21')](_0x24de5b[_0x3e5b('0x1f')]);break;default:_0x11e5cf=_[_0x3e5b('0xe')](_0x24de5b[_0x3e5b('0x1f')])?[]:_0x24de5b[_0x3e5b('0x1f')]['split'](',');}var _0x141b7e={'id':util[_0x3e5b('0xd')]('%s:%s:%s',_0x258d6a,_0x24de5b['id'],_0x24de5b['app']),'condition':require(_0x3e5b('0x28'))['condition'](_0x258d6a,getIntervals(_0x5f2f9c[_0x3e5b('0x29')],_0x24de5b),_0x5f2f9c),'consequence':require(_0x3e5b('0x2a')+_0x24de5b[_0x3e5b('0x1c')])[_0x3e5b('0x2b')](_0x258d6a,_0x11e5cf,_0x5f2f9c,_0x17aaa3),'p':_0x24de5b['priority']||0x0};logger[_0x3e5b('0x2c')]('Push\x20new\x20rule',_0x141b7e['id'],_0x3e5b('0x2d'),getIntervals(_0x5f2f9c['intervals'],_0x24de5b)['join']('\x20|\x20'));_0x56a453[_0x3e5b('0x21')](_0x141b7e);}else{logger[_0x3e5b('0x2e')](_0x3e5b('0x2f'),path[_0x3e5b('0x1b')](__dirname,_0x3e5b('0x17'),_0x24de5b[_0x3e5b('0x1c')]+'.js'));}}_0x5f2f9c['rules'][_0x258d6a]=new RuleEngine(_0x56a453);_0x5f2f9c['rules'][_0x258d6a]['execute'](_0x17aaa3,function(_0x5f0271){logger['info']('Applications\x20executed',JSON[_0x3e5b('0x30')](_0x5f0271[_0x3e5b('0x31')]));if(_0x5f2f9c[_0x3e5b('0x32')][_0x258d6a]){_0x5f2f9c[_0x3e5b('0x32')][_0x258d6a][_0x3e5b('0x33')](_0x3e5b('0x34'));}});return _0x1f81a7({'code':0xc8,'message':_0x17aaa3});}else{logger[_0x3e5b('0x2c')](_0x3e5b('0x35'));return _0x1f81a7({'code':0xc8,'message':_0x17aaa3});}}catch(_0x222d0f){logger[_0x3e5b('0x2e')](_0x222d0f[_0x3e5b('0x36')]);return _0x59ddc0(_0x4fb471['error'](0x1f4,_0x222d0f));}}return _0x59ddc0(_0x3e5b('0x37'));});},'AcceptMessage':function(_0x1d2fb4){var _0x1e8075=this;return new Promise(function(_0xae974f,_0xa262e0){if(_0x1d2fb4[_0x3e5b('0x38')]&&_0x1d2fb4[_0x3e5b('0x38')]['id']){if(_0x5f2f9c[_0x3e5b('0x39')][_0x1d2fb4[_0x3e5b('0x38')]['id']]){_0x5f2f9c[_0x3e5b('0x39')][_0x1d2fb4[_0x3e5b('0x38')]['id']]['busy']=![];_0x5f2f9c['agents'][_0x1d2fb4['agent']['id']]['busyQueue']=undefined;}}if(_0x1d2fb4[_0x3e5b('0x15')]&&_0x1d2fb4[_0x3e5b('0x15')]['id']){try{var _0x9fc025=getId(_0x1d2fb4[_0x3e5b('0x14')],_0x1d2fb4[_0x3e5b('0x15')]?_0x1d2fb4[_0x3e5b('0x15')]['id']:0x0,_0x1d2fb4[_0x3e5b('0x16')]?_0x1d2fb4[_0x3e5b('0x16')]['id']:0x0);if(_0x5f2f9c[_0x3e5b('0x32')][_0x9fc025]){_0x5f2f9c[_0x3e5b('0x32')][_0x9fc025]['emit'](_0x3e5b('0x3a'));if(rpc[_0x1d2fb4[_0x3e5b('0x14')]+_0x3e5b('0x3b')]){rpc[_0x1d2fb4[_0x3e5b('0x14')]+_0x3e5b('0x3b')]['update'](_0x9fc025,{'UserId':_0x1d2fb4['message']['UserId']})[_0x3e5b('0x3c')](function(_0x20af6a){logger[_0x3e5b('0x2e')]('error\x20update\x20queue\x20report');});}}return _0xae974f({'code':0xc8,'message':_0x1d2fb4});}catch(_0x4b604d){logger[_0x3e5b('0x2e')](_0x4b604d[_0x3e5b('0x36')]);return _0xa262e0(_0x1e8075[_0x3e5b('0x2e')](0x1f4,_0x4b604d));}}logger['error']('message\x20is\x20empty');return _0xa262e0(_0x1e8075[_0x3e5b('0x2e')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x14b62a){var _0x3379a1=this;return new Promise(function(_0x3f5835,_0x36abab){if(_0x14b62a[_0x3e5b('0x38')]&&_0x14b62a[_0x3e5b('0x38')]['id']){try{if(_0x5f2f9c[_0x3e5b('0x39')][_0x14b62a[_0x3e5b('0x38')]['id']]){_0x5f2f9c[_0x3e5b('0x39')][_0x14b62a['agent']['id']][_0x3e5b('0x3d')]=![];_0x5f2f9c['agents'][_0x14b62a[_0x3e5b('0x38')]['id']][_0x3e5b('0x3e')]=undefined;}return _0x3f5835({'code':0xc8,'message':_0x14b62a});}catch(_0x26e11e){logger[_0x3e5b('0x2e')](_0x26e11e[_0x3e5b('0x36')]);return _0x36abab(_0x3379a1[_0x3e5b('0x2e')](0x1f4,_0x26e11e));}}logger[_0x3e5b('0x2e')](_0x3e5b('0x3f'));return _0x36abab(_0x3379a1[_0x3e5b('0x2e')](0x1f4,_0x3e5b('0x3f')));});},'AbandonInteraction':function(_0xf6ca5b){var _0x18ba31=this;return new Promise(function(_0x458058,_0x59d311){if(_0xf6ca5b[_0x3e5b('0x14')]&&_0xf6ca5b[_0x3e5b('0x16')]&&_0xf6ca5b[_0x3e5b('0x16')]['id']){try{var _0xfd37fb=getId(_0xf6ca5b[_0x3e5b('0x14')],_0xf6ca5b[_0x3e5b('0x15')]?_0xf6ca5b['message']['id']:0x0,_0xf6ca5b[_0x3e5b('0x16')]?_0xf6ca5b[_0x3e5b('0x16')]['id']:0x0);if(_0x5f2f9c[_0x3e5b('0x32')][_0xfd37fb]){_0x5f2f9c[_0x3e5b('0x32')][_0xfd37fb][_0x3e5b('0x33')](_0x3e5b('0x3a'));}return _0x458058({'code':0xc8,'message':_0xf6ca5b});}catch(_0x216600){logger[_0x3e5b('0x2e')](_0x216600['stack']);return _0x59d311(_0x18ba31[_0x3e5b('0x2e')](0x1f4,_0x216600));}}logger['error']('message\x20is\x20empty');return _0x59d311(_0x18ba31[_0x3e5b('0x2e')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x4a0c86){var _0x25ba2b=this;return new Promise(function(_0xf52ebd,_0x1f7959){if(_0x5f2f9c['agents']['hasOwnProperty'](_0x4a0c86['id'])){for(var _0x545712 in _0x4a0c86['capacity']){if(_0x4a0c86[_0x3e5b('0x40')][_0x3e5b('0x41')](_0x545712)){if(_0x5f2f9c[_0x3e5b('0x39')][_0x4a0c86['id']][_0x3e5b('0x41')](_0x545712+_0x3e5b('0x42'))){_0x5f2f9c['agents'][_0x4a0c86['id']][_0x545712+'CurrentCapacity']=parseInt(_0x4a0c86[_0x3e5b('0x40')][_0x545712],0xa);}}}_0x5f2f9c[_0x3e5b('0x39')][_0x4a0c86['id']][_0x3e5b('0x43')]();return _0xf52ebd({'code':0xc8,'message':_0x5f2f9c[_0x3e5b('0x39')][_0x4a0c86['id']]});}else{return _0x1f7959(_0x25ba2b[_0x3e5b('0x2e')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x4f7337){return new Promise(function(_0x4abd65,_0x4eaa6e){var _0x3563b0=_[_0x3e5b('0x44')](_0x5f2f9c[_0x3e5b('0x39')]);_0x4abd65({'count':_0x3563b0[_0x3e5b('0x19')],'rows':_0x3563b0});});},'ChatQueues':function(_0x424a3d){return new Promise(function(_0x24087b,_0x1915bc){var _0x1da524=[];for(var _0x485951 in _0x5f2f9c[_0x3e5b('0x45')]){if(_0x5f2f9c[_0x3e5b('0x45')][_0x3e5b('0x41')](_0x485951)){var _0x3e784a=_0x5f2f9c[_0x3e5b('0x45')][_0x485951];var _0x5eb277={'id':_0x3e784a['id'],'available':_0x3e784a[_0x3e5b('0x46')],'loggedIn':_0x3e784a['loggedIn'],'name':_0x3e784a[_0x3e5b('0x47')],'paused':_0x3e784a[_0x3e5b('0x48')],'waiting':_0x3e784a['waiting']};_0x1da524['push'](_0x5eb277);}}_0x24087b({'count':_0x1da524['length'],'rows':_0x1da524});});},'MailQueues':function(_0x436c15){return new Promise(function(_0x50f5b4,_0x1ab942){var _0x352d19=[];for(var _0x1af190 in _0x5f2f9c[_0x3e5b('0x49')]){if(_0x5f2f9c[_0x3e5b('0x49')]['hasOwnProperty'](_0x1af190)){var _0x56c16b=_0x5f2f9c[_0x3e5b('0x49')][_0x1af190];var _0x13bc3b={'id':_0x56c16b['id'],'available':_0x56c16b[_0x3e5b('0x46')],'loggedIn':_0x56c16b['loggedIn'],'name':_0x56c16b[_0x3e5b('0x47')],'paused':_0x56c16b[_0x3e5b('0x48')],'waiting':_0x56c16b[_0x3e5b('0x4a')]};_0x352d19[_0x3e5b('0x21')](_0x13bc3b);}}_0x50f5b4({'count':_0x352d19[_0x3e5b('0x19')],'rows':_0x352d19});});},'OpenchannelQueues':function(_0x198316){return new Promise(function(_0x455594,_0x4a1ce3){var _0x3a11a8=[];for(var _0x52e98f in _0x5f2f9c[_0x3e5b('0x4b')]){if(_0x5f2f9c[_0x3e5b('0x4b')][_0x3e5b('0x41')](_0x52e98f)){var _0xc1b0de=_0x5f2f9c[_0x3e5b('0x4b')][_0x52e98f];var _0x2411c3={'id':_0xc1b0de['id'],'available':_0xc1b0de[_0x3e5b('0x46')],'loggedIn':_0xc1b0de[_0x3e5b('0x4c')],'name':_0xc1b0de['name'],'paused':_0xc1b0de[_0x3e5b('0x48')],'waiting':_0xc1b0de[_0x3e5b('0x4a')]};_0x3a11a8['push'](_0x2411c3);}}_0x455594({'count':_0x3a11a8[_0x3e5b('0x19')],'rows':_0x3a11a8});});},'SmsQueues':function(_0x31ef31){return new Promise(function(_0x561c78,_0x52d89e){var _0x4f67d1=[];for(var _0x23edae in _0x5f2f9c[_0x3e5b('0x4d')]){if(_0x5f2f9c['smsQueues'][_0x3e5b('0x41')](_0x23edae)){var _0x1f3a1e=_0x5f2f9c['smsQueues'][_0x23edae];var _0x3d3bf2={'id':_0x1f3a1e['id'],'available':_0x1f3a1e[_0x3e5b('0x46')],'loggedIn':_0x1f3a1e[_0x3e5b('0x4c')],'name':_0x1f3a1e[_0x3e5b('0x47')],'paused':_0x1f3a1e[_0x3e5b('0x48')],'waiting':_0x1f3a1e[_0x3e5b('0x4a')]};_0x4f67d1[_0x3e5b('0x21')](_0x3d3bf2);}}_0x561c78({'count':_0x4f67d1[_0x3e5b('0x19')],'rows':_0x4f67d1});});},'FaxQueues':function(_0x3f2c6c){return new Promise(function(_0x589498,_0x310238){var _0x3aad97=[];for(var _0x2d5685 in _0x5f2f9c[_0x3e5b('0x4e')]){if(_0x5f2f9c[_0x3e5b('0x4e')][_0x3e5b('0x41')](_0x2d5685)){var _0x12c93d=_0x5f2f9c['faxQueues'][_0x2d5685];var _0x590f0c={'id':_0x12c93d['id'],'available':_0x12c93d[_0x3e5b('0x46')],'loggedIn':_0x12c93d[_0x3e5b('0x4c')],'name':_0x12c93d['name'],'paused':_0x12c93d[_0x3e5b('0x48')],'waiting':_0x12c93d[_0x3e5b('0x4a')]};_0x3aad97[_0x3e5b('0x21')](_0x590f0c);}}_0x589498({'count':_0x3aad97[_0x3e5b('0x19')],'rows':_0x3aad97});});},'WhatsappQueues':function(_0x3a19a6){return new Promise(function(_0x9deb09,_0x1bbcf5){var _0x4979c0=[];for(var _0x27dd0f in _0x5f2f9c[_0x3e5b('0x4f')]){if(_0x5f2f9c['whatsappQueues']['hasOwnProperty'](_0x27dd0f)){var _0x4caf7b=_0x5f2f9c[_0x3e5b('0x4f')][_0x27dd0f];var _0x141393={'id':_0x4caf7b['id'],'available':_0x4caf7b[_0x3e5b('0x46')],'loggedIn':_0x4caf7b[_0x3e5b('0x4c')],'name':_0x4caf7b[_0x3e5b('0x47')],'paused':_0x4caf7b[_0x3e5b('0x48')],'waiting':_0x4caf7b['waiting']};_0x4979c0[_0x3e5b('0x21')](_0x141393);}}_0x9deb09({'count':_0x4979c0[_0x3e5b('0x19')],'rows':_0x4979c0});});},'ChatQueuesWaitingInteractions':function(_0x4ff747){return new Promise(function(_0x34098c,_0x4da39d){var _0x4f62fb=_[_0x3e5b('0x44')](_0x5f2f9c[_0x3e5b('0x50')]);_0x34098c({'count':_0x4f62fb['length'],'rows':_0x4f62fb});});},'MailQueuesWaitingInteractions':function(_0x24a387){return new Promise(function(_0x26d28c,_0x5eb839){var _0x2e36af=_[_0x3e5b('0x44')](_0x5f2f9c[_0x3e5b('0x51')]);_0x26d28c({'count':_0x2e36af[_0x3e5b('0x19')],'rows':_0x2e36af});});},'OpenchannelQueuesWaitingInteractions':function(_0x1e069d){return new Promise(function(_0x1541ec,_0x5df4b1){var _0x4fc232=_[_0x3e5b('0x44')](_0x5f2f9c['openchannelQueuesWaitingInteractions']);_0x1541ec({'count':_0x4fc232['length'],'rows':_0x4fc232});});},'SmsQueuesWaitingInteractions':function(_0x25d3d8){return new Promise(function(_0x5dc8d8,_0x367390){var _0x4adcd1=_[_0x3e5b('0x44')](_0x5f2f9c['smsQueuesWaitingInteractions']);_0x5dc8d8({'count':_0x4adcd1[_0x3e5b('0x19')],'rows':_0x4adcd1});});},'FaxQueuesWaitingInteractions':function(_0x4dbea3){return new Promise(function(_0x333e42,_0x923269){var _0x14941b=_[_0x3e5b('0x44')](_0x5f2f9c['faxQueuesWaitingInteractions']);_0x333e42({'count':_0x14941b[_0x3e5b('0x19')],'rows':_0x14941b});});},'WhatsappQueuesWaitingInteractions':function(_0x4e38c1){return new Promise(function(_0x2cbf55,_0x8f992f){var _0x58ccf3=_[_0x3e5b('0x44')](_0x5f2f9c[_0x3e5b('0x52')]);_0x2cbf55({'count':_0x58ccf3[_0x3e5b('0x19')],'rows':_0x58ccf3});});}};var _0x5ad011=jayson[_0x3e5b('0x53')](_0x3f5368)[_0x3e5b('0x54')]();_0x5ad011['on'](_0x3e5b('0x2e'),function(_0x5cd156){logger[_0x3e5b('0x2e')](JSON[_0x3e5b('0x30')](_0x5cd156));return _0x3754e3(_0x5cd156);});_0x5ad011['listen'](0x232c,_0x3e5b('0x55'),function(){console[_0x3e5b('0x56')](_0x3e5b('0x57'),0x232c);return _0x4d71a3('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 b35cfaa..2a9cfc7 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 _0xb5bc=['request','then','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','indexOf','true','error','[%s][INTERVAL]\x20%s','all','when','log','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http'];(function(_0x5845b5,_0x3ca40b){var _0x38f8b6=function(_0x317ae8){while(--_0x317ae8){_0x5845b5['push'](_0x5845b5['shift']());}};_0x38f8b6(++_0x3ca40b);}(_0xb5bc,0x12e));var _0xcb5b=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0xb5bc[_0x3eb4a9];return _0x48dbad;};'use strict';var util=require(_0xcb5b('0x0'));var BPromise=require(_0xcb5b('0x1'));var jayson=require(_0xcb5b('0x2'));var _=require(_0xcb5b('0x3'));var logger=require(_0xcb5b('0x4'))(_0xcb5b('0x5'));var client=jayson[_0xcb5b('0x6')][_0xcb5b('0x7')]({'port':0x232a});function request(_0x11cf79,_0x590250){return new BPromise(function(_0x4504e8,_0x25a3e7){return client[_0xcb5b('0x8')](_0x11cf79,_0x590250)[_0xcb5b('0x9')](function(_0x102e40){if(_0x102e40['error']){return _0x25a3e7(_0x102e40['error'][_0xcb5b('0xa')]);}else{return _0x4504e8(_0x102e40[_0xcb5b('0xb')]);}})[_0xcb5b('0xc')](function(_0xae6511){return _0x25a3e7(_0xae6511);});});}exports['condition']=function(_0x840935,_0x313d47,_0x12db6d){return function(_0x1ba88c){if(_0x12db6d[_0xcb5b('0xd')]&&!_0x12db6d[_0xcb5b('0xd')][_0x840935]){logger[_0xcb5b('0xe')](_0xcb5b('0xf'),_0x840935);return _0x1ba88c[_0xcb5b('0x10')]();}var _0x21325b=[];for(var _0x3976c9=0x0;_0x3976c9<_0x313d47[_0xcb5b('0x11')];_0x3976c9+=0x1){_0x21325b[_0xcb5b('0x12')](request(_0xcb5b('0x13'),{'command':util['format'](_0xcb5b('0x14'),_0x313d47[_0x3976c9])})[_0xcb5b('0x9')](function(_0x4ace15){return _0x4ace15&&_0x4ace15[_0xcb5b('0xa')]&&_0x4ace15[_0xcb5b('0xa')][_0xcb5b('0x15')](_0xcb5b('0x16'))>=0x0?!![]:![];})[_0xcb5b('0xc')](function(_0x34c9c8){logger[_0xcb5b('0x17')](_0xcb5b('0x18'),_0x840935,_0x313d47[_0x3976c9]);}));}BPromise[_0xcb5b('0x19')](_0x21325b)['then'](function(_0xc809c3){var _0x34650c=_['some'](_0xc809c3);logger[_0xcb5b('0xe')]('[%s][INTERVAL]\x20%s\x20%s',_0x840935,_0x313d47['join']('\x20|\x20'),_0x34650c);_0x1ba88c[_0xcb5b('0x1a')](_0x34650c);})[_0xcb5b('0xc')](function(_0x566489){console[_0xcb5b('0x1b')](_0x566489);logger[_0xcb5b('0x17')](_0xcb5b('0x1c'),_0x840935,_0x313d47[_0xcb5b('0x1d')](_0xcb5b('0x1e')),_0x566489['stack']);_0x1ba88c[_0xcb5b('0x10')]();});};}; \ No newline at end of file +var _0xd80e=['Command','format','true','[%s][INTERVAL]\x20%s','all','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','bluebird','lodash','../../../config/logger','routing','http','request','then','error','message','result','catch','condition','rules','stop','push'];(function(_0x27bd2c,_0x24bd98){var _0x3784ea=function(_0x4ca802){while(--_0x4ca802){_0x27bd2c['push'](_0x27bd2c['shift']());}};_0x3784ea(++_0x24bd98);}(_0xd80e,0x1c4));var _0xed80=function(_0x241aa9,_0x2b04c2){_0x241aa9=_0x241aa9-0x0;var _0xd9fac9=_0xd80e[_0x241aa9];return _0xd9fac9;};'use strict';var util=require(_0xed80('0x0'));var BPromise=require(_0xed80('0x1'));var jayson=require('jayson/promise');var _=require(_0xed80('0x2'));var logger=require(_0xed80('0x3'))(_0xed80('0x4'));var client=jayson['client'][_0xed80('0x5')]({'port':0x232a});function request(_0x2248dd,_0x3e95dc){return new BPromise(function(_0x481d2a,_0x96beb6){return client[_0xed80('0x6')](_0x2248dd,_0x3e95dc)[_0xed80('0x7')](function(_0x5cff0b){if(_0x5cff0b[_0xed80('0x8')]){return _0x96beb6(_0x5cff0b[_0xed80('0x8')][_0xed80('0x9')]);}else{return _0x481d2a(_0x5cff0b[_0xed80('0xa')]);}})[_0xed80('0xb')](function(_0x805a53){return _0x96beb6(_0x805a53);});});}exports[_0xed80('0xc')]=function(_0x4fe7ed,_0x4eb2fe,_0x4f8325){return function(_0x457534){if(_0x4f8325[_0xed80('0xd')]&&!_0x4f8325['rules'][_0x4fe7ed]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4fe7ed);return _0x457534[_0xed80('0xe')]();}var _0x36bb7e=[];for(var _0x4e6dc8=0x0;_0x4e6dc8<_0x4eb2fe['length'];_0x4e6dc8+=0x1){_0x36bb7e[_0xed80('0xf')](request(_0xed80('0x10'),{'command':util[_0xed80('0x11')]('iftime\x20%s',_0x4eb2fe[_0x4e6dc8])})[_0xed80('0x7')](function(_0x198a75){return _0x198a75&&_0x198a75['message']&&_0x198a75[_0xed80('0x9')]['indexOf'](_0xed80('0x12'))>=0x0?!![]:![];})[_0xed80('0xb')](function(_0x4d7c99){logger[_0xed80('0x8')](_0xed80('0x13'),_0x4fe7ed,_0x4eb2fe[_0x4e6dc8]);}));}BPromise[_0xed80('0x14')](_0x36bb7e)['then'](function(_0x3341ba){var _0x55a7fe=_['some'](_0x3341ba);logger[_0xed80('0x15')](_0xed80('0x16'),_0x4fe7ed,_0x4eb2fe[_0xed80('0x17')](_0xed80('0x18')),_0x55a7fe);_0x457534['when'](_0x55a7fe);})[_0xed80('0xb')](function(_0x2f2693){console['log'](_0x2f2693);logger['error'](_0xed80('0x16'),_0x4fe7ed,_0x4eb2fe[_0xed80('0x17')](_0xed80('0x18')),_0x2f2693[_0xed80('0x19')]);_0x457534['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 06ba54b..89ce4c7 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 _0x7819=['forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','reason','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','calleridnum','connectedlinenum','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','connectedlinename','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','timeout','holdtime','ringtime','talktime','push','queuecallerabandon'];(function(_0x50e8ac,_0x3de22e){var _0x41a7b9=function(_0xa903d0){while(--_0xa903d0){_0x50e8ac['push'](_0x50e8ac['shift']());}};_0x41a7b9(++_0x3de22e);}(_0x7819,0x8a));var _0x9781=function(_0x46d04a,_0x1322ec){_0x46d04a=_0x46d04a-0x0;var _0xcc551d=_0x7819[_0x46d04a];return _0xcc551d;};'use strict';var _=require(_0x9781('0x0'));var util=require(_0x9781('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1cfde2,_0x44a1df){utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x4'),_0x1cfde2[_0x9781('0x5')],_0x1cfde2[_0x9781('0x6')],_0x1cfde2[_0x9781('0x7')],_0x1cfde2['membername'],_0x1cfde2['interface'],_0x1cfde2[_0x9781('0x8')],_0x1cfde2[_0x9781('0x9')],_0x1cfde2['lastevent']));if(_0x1cfde2['queue']){utils[_0x9781('0xa')](_0x1cfde2['queue'])['then'](function(_0x45fceb){if(_0x45fceb){_0x1cfde2[_0x9781('0xb')]=_0x45fceb['type'];_0x1cfde2[_0x9781('0xc')]=_0x1cfde2[_0x9781('0xd')]?_0x45fceb[_0x9781('0xe')]:![];_0x1cfde2[_0x9781('0xf')]=_0x1cfde2[_0x9781('0xc')]?_0x45fceb[_0x9781('0x10')]:0x0;}utils[_0x9781('0x11')](_0x9781('0x12'),_0x1cfde2);});}else{utils[_0x9781('0x11')](_0x9781('0x12'),_0x1cfde2);}if(_0x44a1df){delete transfers[_0x1cfde2[_0x9781('0x5')]];}else{delete agents[_0x1cfde2['destuniqueid']];}}exports[_0x9781('0x13')]=function(_0x260183){try{utils[_0x9781('0x14')](util['format'](_0x9781('0x15'),_0x260183[_0x9781('0x5')]),_0x260183);agents[_0x260183['destuniqueid']]=_0x260183;agents[_0x260183[_0x9781('0x16')]][_0x9781('0x17')]=utils[_0x9781('0x18')]();agents[_0x260183[_0x9781('0x16')]][_0x9781('0x19')]='called';agents[_0x260183['destuniqueid']][_0x9781('0x9')]=null;agents[_0x260183['destuniqueid']][_0x9781('0x1a')]=null;utils[_0x9781('0x2')](util[_0x9781('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x260183[_0x9781('0x5')],agents[_0x260183[_0x9781('0x16')]][_0x9781('0x1b')],_0x260183[_0x9781('0x16')]));}catch(_0x27f8d0){utils[_0x9781('0x1c')](util[_0x9781('0x3')]('[%s][agents][agentcalled]',_0x260183[_0x9781('0x5')]),_0x27f8d0);}};exports[_0x9781('0x1d')]=function(_0x252a7f){try{if(!_[_0x9781('0x1e')](agents[_0x252a7f['destuniqueid']])){utils['debug'](util[_0x9781('0x3')](_0x9781('0x1f'),_0x252a7f[_0x9781('0x5')]),_0x252a7f);utils[_0x9781('0x2')](util[_0x9781('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x252a7f[_0x9781('0x5')],agents[_0x252a7f[_0x9781('0x16')]][_0x9781('0x1b')],_0x252a7f[_0x9781('0x16')]));agents[_0x252a7f['destuniqueid']][_0x9781('0x1d')]=!![];agents[_0x252a7f[_0x9781('0x16')]]['agentringnoanswerAt']=utils[_0x9781('0x18')]();agents[_0x252a7f['destuniqueid']][_0x9781('0x19')]=_0x9781('0x20');agents[_0x252a7f[_0x9781('0x16')]]['reason']=_0x9781('0x20');agents[_0x252a7f[_0x9781('0x16')]][_0x9781('0x21')]=_0x252a7f['ringtime']?parseInt(_0x252a7f[_0x9781('0x22')])/0x3e8:0x0;agents[_0x252a7f[_0x9781('0x16')]][_0x9781('0x23')]=0x0;unanswered[_0x9781('0x24')](_0x252a7f[_0x9781('0x16')]);}}catch(_0x13066f){utils[_0x9781('0x1c')](util[_0x9781('0x3')](_0x9781('0x1f'),_0x252a7f[_0x9781('0x5')]),_0x13066f);}};exports[_0x9781('0x25')]=function(_0x3438f8){try{_[_0x9781('0x26')](agents,function(_0x3f31a6,_0x21e08b){if(_0x3f31a6[_0x9781('0x5')]==_0x3438f8[_0x9781('0x5')]&&!_[_0x9781('0x27')](unanswered,_0x3f31a6[_0x9781('0x16')])){utils['debug'](util[_0x9781('0x3')]('[%s][agents][queuecallerabandon]',_0x3438f8[_0x9781('0x5')]),_0x3438f8);utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x28'),_0x3438f8['uniqueid'],_0x3f31a6[_0x9781('0x1b')],_0x3f31a6[_0x9781('0x16')]));_0x3f31a6[_0x9781('0x1d')]=!![];_0x3f31a6[_0x9781('0x29')]=utils[_0x9781('0x18')]();_0x3f31a6[_0x9781('0x19')]='abandoned';_0x3f31a6['reason']=_0x9781('0x2a');_0x3f31a6[_0x9781('0x21')]=_0x3438f8['holdtime'];_0x3f31a6['talktime']=0x0;writeDB(_0x3f31a6);}});}catch(_0x48bada){utils[_0x9781('0x1c')](util['format'](_0x9781('0x2b'),_0x3438f8['uniqueid']),_0x48bada);}};exports[_0x9781('0x2c')]=function(_0x305893){try{if(agents[_0x305893[_0x9781('0x16')]]){utils[_0x9781('0x14')](util[_0x9781('0x3')](_0x9781('0x2d'),_0x305893[_0x9781('0x5')]),_0x305893);utils[_0x9781('0x2')](util['format'](_0x9781('0x2e'),_0x305893['uniqueid'],agents[_0x305893['destuniqueid']][_0x9781('0x1b')],_0x305893[_0x9781('0x16')]));agents[_0x305893[_0x9781('0x16')]][_0x9781('0x2f')]=utils[_0x9781('0x18')]();agents[_0x305893[_0x9781('0x16')]][_0x9781('0x9')]=_0x305893[_0x9781('0x9')];agents[_0x305893[_0x9781('0x16')]][_0x9781('0x1a')]=_0x305893[_0x9781('0x1a')];agents[_0x305893[_0x9781('0x16')]]['holdtime']=_0x305893['ringtime'];agents[_0x305893[_0x9781('0x16')]][_0x9781('0x19')]='connect';_[_0x9781('0x26')](agents,function(_0x399d5e,_0x3d229b){if(_0x399d5e[_0x9781('0x16')]!=_0x305893[_0x9781('0x16')]&&_0x399d5e[_0x9781('0x5')]==_0x305893[_0x9781('0x5')]){_0x399d5e[_0x9781('0x23')]=0x0;_0x399d5e['holdtime']=_0x305893[_0x9781('0x22')];_0x399d5e[_0x9781('0x1d')]=!![];_0x399d5e[_0x9781('0x29')]=utils[_0x9781('0x18')]();_0x399d5e[_0x9781('0x19')]=_0x9781('0x30');_0x399d5e[_0x9781('0x31')]='answered_elsewhere';_0x399d5e[_0x9781('0x32')]=_0x305893['destuniqueid'];_0x399d5e[_0x9781('0x33')]=_0x305893[_0x9781('0x1b')];writeDB(_0x399d5e);}});}}catch(_0x18bb45){utils[_0x9781('0x1c')](util['format'](_0x9781('0x2d'),_0x305893[_0x9781('0x5')]),_0x18bb45);}};exports[_0x9781('0xd')]=function(_0x48e699){try{if(!_[_0x9781('0x1e')](agents[_0x48e699['destuniqueid']])){utils['debug'](util[_0x9781('0x3')]('[%s][agents][agentcomplete]',_0x48e699[_0x9781('0x5')]),_0x48e699);utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x34'),_0x48e699['uniqueid'],agents[_0x48e699[_0x9781('0x16')]][_0x9781('0x1b')],_0x48e699['destuniqueid']));agents[_0x48e699['destuniqueid']]['agentcomplete']=!![];agents[_0x48e699[_0x9781('0x16')]][_0x9781('0x35')]=utils['now']();agents[_0x48e699['destuniqueid']][_0x9781('0x23')]=utils[_0x9781('0x36')](agents[_0x48e699[_0x9781('0x16')]][_0x9781('0x35')],agents[_0x48e699[_0x9781('0x16')]]['agentconnectAt']);agents[_0x48e699[_0x9781('0x16')]][_0x9781('0x31')]=_0x48e699[_0x9781('0x31')];agents[_0x48e699[_0x9781('0x16')]][_0x9781('0x19')]=_0x9781('0x37');writeDB(agents[_0x48e699[_0x9781('0x16')]]);}}catch(_0x37e955){utils[_0x9781('0x1c')](util[_0x9781('0x3')](_0x9781('0x38'),_0x48e699[_0x9781('0x5')]),_0x37e955);}};exports[_0x9781('0x39')]=function(_0x14ac68){try{if(!_[_0x9781('0x1e')](agents[_0x14ac68['transfereruniqueid']])){utils['debug'](util['format'](_0x9781('0x3a'),_0x14ac68[_0x9781('0x5')]),_0x14ac68);utils[_0x9781('0x2')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x14ac68['uniqueid'],agents[_0x14ac68[_0x9781('0x3b')]]['membername'],agents[_0x14ac68['transfereruniqueid']][_0x9781('0x5')]));agents[_0x14ac68['transfereruniqueid']][_0x9781('0x3c')]=!![];agents[_0x14ac68[_0x9781('0x3b')]][_0x9781('0x3d')]=_0x9781('0x3e');agents[_0x14ac68[_0x9781('0x3b')]]['transferexten']=_0x14ac68['extension'];agents[_0x14ac68['transfereruniqueid']][_0x9781('0x3f')]=agents[_0x14ac68[_0x9781('0x3b')]][_0x9781('0x5')];}}catch(_0x49a764){utils[_0x9781('0x1c')](util[_0x9781('0x3')]('[%s][agents][blindtransfer]',_0x14ac68['uniqueid']),_0x49a764);}};exports[_0x9781('0x40')]=function(_0x15a9b1){try{utils[_0x9781('0x14')](util['format'](_0x9781('0x41'),_0x15a9b1[_0x9781('0x42')]),_0x15a9b1);if(_0x15a9b1[_0x9781('0x42')]==_0x15a9b1[_0x9781('0x43')]){if(!_[_0x9781('0x1e')](agents[_0x15a9b1['secondtransfereruniqueid']])){utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x44'),_0x15a9b1[_0x9781('0x42')],agents[_0x15a9b1['secondtransfereruniqueid']]['membername']));agents[_0x15a9b1[_0x9781('0x45')]]['transfer']=!![];agents[_0x15a9b1[_0x9781('0x45')]][_0x9781('0x3d')]=_0x9781('0x46');agents[_0x15a9b1['secondtransfereruniqueid']][_0x9781('0x47')]=_0x15a9b1[_0x9781('0x48')];agents[_0x15a9b1['secondtransfereruniqueid']][_0x9781('0x3f')]=_0x15a9b1['origtransfereruniqueid'];}if(_0x15a9b1[_0x9781('0x49')]&&agents[_0x15a9b1['transfereeuniqueid']]){agents[_0x15a9b1['transfereeuniqueid']][_0x9781('0x4a')]=0x1;transfers[_0x15a9b1[_0x9781('0x49')]]=_[_0x9781('0x4b')](agents[_0x15a9b1[_0x9781('0x49')]]);transfers[_0x15a9b1[_0x9781('0x49')]][_0x9781('0x8')]=agents[_0x15a9b1['secondtransfereruniqueid']][_0x9781('0x8')];transfers[_0x15a9b1['transfereeuniqueid']]['calleridname']=agents[_0x15a9b1[_0x9781('0x45')]][_0x9781('0x4c')];transfers[_0x15a9b1[_0x9781('0x49')]][_0x9781('0x17')]=utils[_0x9781('0x18')]();transfers[_0x15a9b1[_0x9781('0x49')]][_0x9781('0x2f')]=utils['now']();transfers[_0x15a9b1['transfereeuniqueid']][_0x9781('0x21')]=0x0;transfers[_0x15a9b1[_0x9781('0x49')]][_0x9781('0x4a')]=0x2;}}else if(_0x15a9b1[_0x9781('0x45')]==_0x15a9b1[_0x9781('0x4d')]){if(!_['isNil'](agents[_0x15a9b1[_0x9781('0x42')]])){utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x44'),_0x15a9b1['origtransfereruniqueid'],agents[_0x15a9b1[_0x9781('0x42')]][_0x9781('0x1b')]));agents[_0x15a9b1[_0x9781('0x42')]][_0x9781('0x3c')]=!![];agents[_0x15a9b1['origtransfereruniqueid']]['transfertype']=_0x9781('0x46');agents[_0x15a9b1[_0x9781('0x42')]][_0x9781('0x47')]=_0x15a9b1[_0x9781('0x4e')];agents[_0x15a9b1[_0x9781('0x42')]]['transferuniqueid']=_0x15a9b1[_0x9781('0x45')];}if(_0x15a9b1[_0x9781('0x4f')]&&agents[_0x15a9b1[_0x9781('0x4f')]]){agents[_0x15a9b1[_0x9781('0x4f')]]['agententerreason']=0x1;transfers[_0x15a9b1['transfertargetuniqueid']]=_[_0x9781('0x4b')](agents[_0x15a9b1['transfertargetuniqueid']]);transfers[_0x15a9b1['transfertargetuniqueid']][_0x9781('0x8')]=agents[_0x15a9b1[_0x9781('0x42')]][_0x9781('0x8')];transfers[_0x15a9b1[_0x9781('0x4f')]][_0x9781('0x4c')]=agents[_0x15a9b1[_0x9781('0x42')]]['calleridname'];transfers[_0x15a9b1['transfertargetuniqueid']][_0x9781('0x17')]=utils['now']();transfers[_0x15a9b1['transfertargetuniqueid']][_0x9781('0x2f')]=utils['now']();transfers[_0x15a9b1[_0x9781('0x4f')]][_0x9781('0x21')]=0x0;transfers[_0x15a9b1[_0x9781('0x4f')]][_0x9781('0x4a')]=0x2;}}}catch(_0x614dec){utils[_0x9781('0x1c')](util[_0x9781('0x3')](_0x9781('0x41'),_0x15a9b1[_0x9781('0x42')]),_0x614dec);}};exports[_0x9781('0x50')]=function(_0x5515b7){try{utils[_0x9781('0x14')](util['format'](_0x9781('0x51'),_0x5515b7[_0x9781('0x5')]),_0x5515b7);if(agents[_0x5515b7[_0x9781('0x5')]]&&agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x31')]===_0x9781('0x20')){if(_0x5515b7[_0x9781('0x52')]==='21'){agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x31')]=_0x9781('0x53');agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x19')]='rejected';}utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x54'),_0x5515b7[_0x9781('0x5')],agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x1b')],agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x31')],agents[_0x5515b7['uniqueid']][_0x9781('0x19')]));writeDB(agents[_0x5515b7[_0x9781('0x5')]]);var _0x4f522f=unanswered[_0x9781('0x55')](_0x5515b7[_0x9781('0x5')]);if(_0x4f522f>-0x1){unanswered[_0x9781('0x56')](_0x4f522f,0x1);}}if(transfers[_0x5515b7[_0x9781('0x5')]]){transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0xd')]=!![];transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x35')]=utils['now']();transfers[_0x5515b7['uniqueid']][_0x9781('0x23')]=utils['diffTime'](transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x35')],transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x2f')]);transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x31')]=_0x9781('0x57');transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x19')]='complete';utils[_0x9781('0x2')](util[_0x9781('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5515b7['uniqueid'],transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x1b')],transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x31')],transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x19')]));writeDB(transfers[_0x5515b7[_0x9781('0x5')]],!![]);}if(agents[_0x5515b7[_0x9781('0x5')]]&&agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x2f')]){agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0xd')]=!![];agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x35')]=utils[_0x9781('0x18')]();agents[_0x5515b7['uniqueid']][_0x9781('0x23')]=utils['diffTime'](agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x35')],agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x2f')]);agents[_0x5515b7['uniqueid']][_0x9781('0x31')]=agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x3c')]?_0x9781('0x3c'):_0x9781('0x57');agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x19')]=_0x9781('0x37');utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x54'),_0x5515b7[_0x9781('0x5')],agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x1b')],agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x31')],agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x19')]));writeDB(agents[_0x5515b7[_0x9781('0x5')]]);}}catch(_0x16a871){utils[_0x9781('0x1c')](util[_0x9781('0x3')](_0x9781('0x51'),_0x5515b7[_0x9781('0x5')]),_0x16a871);}}; \ No newline at end of file +var _0x2ef5=['error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','ringtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','abandoned','holdtime','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferuniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transferexten','origtransfereruniqueid','transfereeuniqueid','clone','calleridnum','calleridname','agententerreason','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','[%s][agents][hangup]','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','connectedlinenum','lastevent','queue','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called'];(function(_0xc5b753,_0x10a712){var _0x5805bb=function(_0x4cd6db){while(--_0x4cd6db){_0xc5b753['push'](_0xc5b753['shift']());}};_0x5805bb(++_0x10a712);}(_0x2ef5,0x87));var _0x52ef=function(_0x35186f,_0x2a862d){_0x35186f=_0x35186f-0x0;var _0x233f49=_0x2ef5[_0x35186f];return _0x233f49;};'use strict';var _=require(_0x52ef('0x0'));var util=require('util');var utils=require(_0x52ef('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x524506,_0x8a3405){utils[_0x52ef('0x2')](util[_0x52ef('0x3')](_0x52ef('0x4'),_0x524506[_0x52ef('0x5')],_0x524506[_0x52ef('0x6')],_0x524506['queue'],_0x524506[_0x52ef('0x7')],_0x524506[_0x52ef('0x8')],_0x524506['calleridnum'],_0x524506[_0x52ef('0x9')],_0x524506[_0x52ef('0xa')]));if(_0x524506[_0x52ef('0xb')]){utils['getVoiceQueueByName'](_0x524506[_0x52ef('0xb')])['then'](function(_0x30b82e){if(_0x30b82e){_0x524506[_0x52ef('0xc')]=_0x30b82e['type'];_0x524506[_0x52ef('0xd')]=_0x524506[_0x52ef('0xe')]?_0x30b82e[_0x52ef('0xf')]:![];_0x524506[_0x52ef('0x10')]=_0x524506[_0x52ef('0xd')]?_0x30b82e[_0x52ef('0x11')]:0x0;}utils[_0x52ef('0x12')](_0x52ef('0x13'),_0x524506);});}else{utils['request']('CreateVoiceAgentReport',_0x524506);}if(_0x8a3405){delete transfers[_0x524506[_0x52ef('0x5')]];}else{delete agents[_0x524506[_0x52ef('0x14')]];}}exports['agentcalled']=function(_0x312a21){try{utils[_0x52ef('0x15')](util[_0x52ef('0x3')]('[%s][agents][agentcalled]',_0x312a21[_0x52ef('0x5')]),_0x312a21);agents[_0x312a21['destuniqueid']]=_0x312a21;agents[_0x312a21[_0x52ef('0x14')]][_0x52ef('0x16')]=utils[_0x52ef('0x17')]();agents[_0x312a21['destuniqueid']]['lastevent']=_0x52ef('0x18');agents[_0x312a21[_0x52ef('0x14')]]['connectedlinenum']=null;agents[_0x312a21[_0x52ef('0x14')]][_0x52ef('0x19')]=null;utils['info'](util['format'](_0x52ef('0x1a'),_0x312a21[_0x52ef('0x5')],agents[_0x312a21[_0x52ef('0x14')]][_0x52ef('0x7')],_0x312a21[_0x52ef('0x14')]));}catch(_0x20187e){utils[_0x52ef('0x1b')](util[_0x52ef('0x3')](_0x52ef('0x1c'),_0x312a21[_0x52ef('0x5')]),_0x20187e);}};exports[_0x52ef('0x1d')]=function(_0x45687f){try{if(!_[_0x52ef('0x1e')](agents[_0x45687f[_0x52ef('0x14')]])){utils[_0x52ef('0x15')](util['format']('[%s][agents][agentringnoanswer]',_0x45687f[_0x52ef('0x5')]),_0x45687f);utils[_0x52ef('0x2')](util[_0x52ef('0x3')](_0x52ef('0x1f'),_0x45687f['uniqueid'],agents[_0x45687f[_0x52ef('0x14')]][_0x52ef('0x7')],_0x45687f['destuniqueid']));agents[_0x45687f['destuniqueid']]['agentringnoanswer']=!![];agents[_0x45687f[_0x52ef('0x14')]][_0x52ef('0x20')]=utils[_0x52ef('0x17')]();agents[_0x45687f['destuniqueid']][_0x52ef('0xa')]='timeout';agents[_0x45687f[_0x52ef('0x14')]][_0x52ef('0x21')]='timeout';agents[_0x45687f[_0x52ef('0x14')]]['holdtime']=_0x45687f[_0x52ef('0x22')]?parseInt(_0x45687f[_0x52ef('0x22')])/0x3e8:0x0;agents[_0x45687f['destuniqueid']][_0x52ef('0x23')]=0x0;unanswered[_0x52ef('0x24')](_0x45687f[_0x52ef('0x14')]);}}catch(_0x1a9078){utils[_0x52ef('0x1b')](util[_0x52ef('0x3')]('[%s][agents][agentringnoanswer]',_0x45687f[_0x52ef('0x5')]),_0x1a9078);}};exports[_0x52ef('0x25')]=function(_0x2e6c8b){try{_[_0x52ef('0x26')](agents,function(_0x5793e0,_0x167ca6){if(_0x5793e0['uniqueid']==_0x2e6c8b[_0x52ef('0x5')]&&!_['includes'](unanswered,_0x5793e0[_0x52ef('0x14')])){utils[_0x52ef('0x15')](util[_0x52ef('0x3')](_0x52ef('0x27'),_0x2e6c8b[_0x52ef('0x5')]),_0x2e6c8b);utils[_0x52ef('0x2')](util[_0x52ef('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2e6c8b[_0x52ef('0x5')],_0x5793e0[_0x52ef('0x7')],_0x5793e0[_0x52ef('0x14')]));_0x5793e0[_0x52ef('0x1d')]=!![];_0x5793e0[_0x52ef('0x20')]=utils[_0x52ef('0x17')]();_0x5793e0['lastevent']='abandoned';_0x5793e0[_0x52ef('0x21')]=_0x52ef('0x28');_0x5793e0[_0x52ef('0x29')]=_0x2e6c8b['holdtime'];_0x5793e0['talktime']=0x0;writeDB(_0x5793e0);}});}catch(_0x7a73){utils[_0x52ef('0x1b')](util['format'](_0x52ef('0x27'),_0x2e6c8b['uniqueid']),_0x7a73);}};exports['agentconnect']=function(_0x58d4f0){try{if(agents[_0x58d4f0[_0x52ef('0x14')]]){utils['debug'](util['format'](_0x52ef('0x2a'),_0x58d4f0[_0x52ef('0x5')]),_0x58d4f0);utils['info'](util[_0x52ef('0x3')](_0x52ef('0x2b'),_0x58d4f0[_0x52ef('0x5')],agents[_0x58d4f0['destuniqueid']]['membername'],_0x58d4f0[_0x52ef('0x14')]));agents[_0x58d4f0[_0x52ef('0x14')]][_0x52ef('0x2c')]=utils['now']();agents[_0x58d4f0[_0x52ef('0x14')]]['connectedlinenum']=_0x58d4f0['connectedlinenum'];agents[_0x58d4f0[_0x52ef('0x14')]][_0x52ef('0x19')]=_0x58d4f0['connectedlinename'];agents[_0x58d4f0[_0x52ef('0x14')]][_0x52ef('0x29')]=_0x58d4f0[_0x52ef('0x22')];agents[_0x58d4f0[_0x52ef('0x14')]]['lastevent']=_0x52ef('0x2d');_[_0x52ef('0x26')](agents,function(_0x1b9413,_0x35de60){if(_0x1b9413[_0x52ef('0x14')]!=_0x58d4f0[_0x52ef('0x14')]&&_0x1b9413[_0x52ef('0x5')]==_0x58d4f0['uniqueid']){_0x1b9413['talktime']=0x0;_0x1b9413[_0x52ef('0x29')]=_0x58d4f0[_0x52ef('0x22')];_0x1b9413['agentringnoanswer']=!![];_0x1b9413[_0x52ef('0x20')]=utils['now']();_0x1b9413['lastevent']=_0x52ef('0x2e');_0x1b9413['reason']=_0x52ef('0x2e');_0x1b9413[_0x52ef('0x2f')]=_0x58d4f0[_0x52ef('0x14')];_0x1b9413[_0x52ef('0x30')]=_0x58d4f0['membername'];writeDB(_0x1b9413);}});}}catch(_0x3c0b6f){utils[_0x52ef('0x1b')](util[_0x52ef('0x3')]('[%s][agents][agentconnect]',_0x58d4f0[_0x52ef('0x5')]),_0x3c0b6f);}};exports[_0x52ef('0xe')]=function(_0x8f79bf){try{if(!_[_0x52ef('0x1e')](agents[_0x8f79bf[_0x52ef('0x14')]])){utils[_0x52ef('0x15')](util['format'](_0x52ef('0x31'),_0x8f79bf[_0x52ef('0x5')]),_0x8f79bf);utils['info'](util[_0x52ef('0x3')](_0x52ef('0x32'),_0x8f79bf[_0x52ef('0x5')],agents[_0x8f79bf[_0x52ef('0x14')]][_0x52ef('0x7')],_0x8f79bf[_0x52ef('0x14')]));agents[_0x8f79bf[_0x52ef('0x14')]]['agentcomplete']=!![];agents[_0x8f79bf[_0x52ef('0x14')]][_0x52ef('0x33')]=utils[_0x52ef('0x17')]();agents[_0x8f79bf['destuniqueid']]['talktime']=utils[_0x52ef('0x34')](agents[_0x8f79bf[_0x52ef('0x14')]]['agentcompleteAt'],agents[_0x8f79bf[_0x52ef('0x14')]][_0x52ef('0x2c')]);agents[_0x8f79bf[_0x52ef('0x14')]][_0x52ef('0x21')]=_0x8f79bf['reason'];agents[_0x8f79bf['destuniqueid']][_0x52ef('0xa')]=_0x52ef('0x35');writeDB(agents[_0x8f79bf[_0x52ef('0x14')]]);}}catch(_0xa36c98){utils[_0x52ef('0x1b')](util[_0x52ef('0x3')](_0x52ef('0x31'),_0x8f79bf['uniqueid']),_0xa36c98);}};exports[_0x52ef('0x36')]=function(_0x1545e7){try{if(!_[_0x52ef('0x1e')](agents[_0x1545e7['transfereruniqueid']])){utils[_0x52ef('0x15')](util[_0x52ef('0x3')](_0x52ef('0x37'),_0x1545e7[_0x52ef('0x5')]),_0x1545e7);utils['info'](util[_0x52ef('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1545e7['uniqueid'],agents[_0x1545e7[_0x52ef('0x38')]]['membername'],agents[_0x1545e7[_0x52ef('0x38')]]['uniqueid']));agents[_0x1545e7['transfereruniqueid']][_0x52ef('0x39')]=!![];agents[_0x1545e7['transfereruniqueid']][_0x52ef('0x3a')]=_0x52ef('0x3b');agents[_0x1545e7[_0x52ef('0x38')]]['transferexten']=_0x1545e7['extension'];agents[_0x1545e7[_0x52ef('0x38')]][_0x52ef('0x3c')]=agents[_0x1545e7[_0x52ef('0x38')]][_0x52ef('0x5')];}}catch(_0x28521f){utils[_0x52ef('0x1b')](util['format'](_0x52ef('0x37'),_0x1545e7[_0x52ef('0x5')]),_0x28521f);}};exports['attendedtransfer']=function(_0x528ee2){try{utils[_0x52ef('0x15')](util[_0x52ef('0x3')]('[%s][agents][attendedtransfer]',_0x528ee2['origtransfereruniqueid']),_0x528ee2);if(_0x528ee2['origtransfereruniqueid']==_0x528ee2[_0x52ef('0x3d')]){if(!_[_0x52ef('0x1e')](agents[_0x528ee2['secondtransfereruniqueid']])){utils['info'](util['format'](_0x52ef('0x3e'),_0x528ee2['origtransfereruniqueid'],agents[_0x528ee2['secondtransfereruniqueid']][_0x52ef('0x7')]));agents[_0x528ee2[_0x52ef('0x3f')]]['transfer']=!![];agents[_0x528ee2[_0x52ef('0x3f')]][_0x52ef('0x3a')]=_0x52ef('0x40');agents[_0x528ee2[_0x52ef('0x3f')]][_0x52ef('0x41')]=_0x528ee2['origtransfererexten'];agents[_0x528ee2[_0x52ef('0x3f')]][_0x52ef('0x3c')]=_0x528ee2[_0x52ef('0x42')];}if(_0x528ee2[_0x52ef('0x43')]&&agents[_0x528ee2[_0x52ef('0x43')]]){agents[_0x528ee2[_0x52ef('0x43')]]['agententerreason']=0x1;transfers[_0x528ee2['transfereeuniqueid']]=_[_0x52ef('0x44')](agents[_0x528ee2[_0x52ef('0x43')]]);transfers[_0x528ee2[_0x52ef('0x43')]]['calleridnum']=agents[_0x528ee2[_0x52ef('0x3f')]][_0x52ef('0x45')];transfers[_0x528ee2['transfereeuniqueid']][_0x52ef('0x46')]=agents[_0x528ee2[_0x52ef('0x3f')]][_0x52ef('0x46')];transfers[_0x528ee2[_0x52ef('0x43')]][_0x52ef('0x16')]=utils[_0x52ef('0x17')]();transfers[_0x528ee2[_0x52ef('0x43')]][_0x52ef('0x2c')]=utils[_0x52ef('0x17')]();transfers[_0x528ee2[_0x52ef('0x43')]][_0x52ef('0x29')]=0x0;transfers[_0x528ee2[_0x52ef('0x43')]][_0x52ef('0x47')]=0x2;}}else if(_0x528ee2['secondtransfereruniqueid']==_0x528ee2['secondtransfererlinkedid']){if(!_[_0x52ef('0x1e')](agents[_0x528ee2[_0x52ef('0x42')]])){utils[_0x52ef('0x2')](util[_0x52ef('0x3')](_0x52ef('0x3e'),_0x528ee2[_0x52ef('0x42')],agents[_0x528ee2[_0x52ef('0x42')]][_0x52ef('0x7')]));agents[_0x528ee2[_0x52ef('0x42')]][_0x52ef('0x39')]=!![];agents[_0x528ee2[_0x52ef('0x42')]][_0x52ef('0x3a')]=_0x52ef('0x40');agents[_0x528ee2[_0x52ef('0x42')]]['transferexten']=_0x528ee2[_0x52ef('0x48')];agents[_0x528ee2['origtransfereruniqueid']]['transferuniqueid']=_0x528ee2[_0x52ef('0x3f')];}if(_0x528ee2[_0x52ef('0x49')]&&agents[_0x528ee2[_0x52ef('0x49')]]){agents[_0x528ee2['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x528ee2[_0x52ef('0x49')]]=_[_0x52ef('0x44')](agents[_0x528ee2['transfertargetuniqueid']]);transfers[_0x528ee2[_0x52ef('0x49')]][_0x52ef('0x45')]=agents[_0x528ee2[_0x52ef('0x42')]]['calleridnum'];transfers[_0x528ee2[_0x52ef('0x49')]][_0x52ef('0x46')]=agents[_0x528ee2[_0x52ef('0x42')]]['calleridname'];transfers[_0x528ee2[_0x52ef('0x49')]][_0x52ef('0x16')]=utils[_0x52ef('0x17')]();transfers[_0x528ee2['transfertargetuniqueid']][_0x52ef('0x2c')]=utils[_0x52ef('0x17')]();transfers[_0x528ee2['transfertargetuniqueid']][_0x52ef('0x29')]=0x0;transfers[_0x528ee2[_0x52ef('0x49')]]['agententerreason']=0x2;}}}catch(_0x5c56be){utils[_0x52ef('0x1b')](util[_0x52ef('0x3')](_0x52ef('0x4a'),_0x528ee2['origtransfereruniqueid']),_0x5c56be);}};exports[_0x52ef('0x4b')]=function(_0x30b03d){try{utils[_0x52ef('0x15')](util[_0x52ef('0x3')]('[%s][agents][hangup]',_0x30b03d[_0x52ef('0x5')]),_0x30b03d);if(agents[_0x30b03d[_0x52ef('0x5')]]&&agents[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x21')]==='timeout'){if(_0x30b03d[_0x52ef('0x4c')]==='21'){agents[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x21')]=_0x52ef('0x4d');agents[_0x30b03d['uniqueid']][_0x52ef('0xa')]=_0x52ef('0x4d');}utils[_0x52ef('0x2')](util[_0x52ef('0x3')](_0x52ef('0x4e'),_0x30b03d[_0x52ef('0x5')],agents[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x7')],agents[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x21')],agents[_0x30b03d['uniqueid']][_0x52ef('0xa')]));writeDB(agents[_0x30b03d[_0x52ef('0x5')]]);var _0x44eea6=unanswered['indexOf'](_0x30b03d[_0x52ef('0x5')]);if(_0x44eea6>-0x1){unanswered['splice'](_0x44eea6,0x1);}}if(transfers[_0x30b03d['uniqueid']]){transfers[_0x30b03d['uniqueid']][_0x52ef('0xe')]=!![];transfers[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x33')]=utils[_0x52ef('0x17')]();transfers[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x23')]=utils[_0x52ef('0x34')](transfers[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x33')],transfers[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x2c')]);transfers[_0x30b03d['uniqueid']][_0x52ef('0x21')]='agent';transfers[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0xa')]=_0x52ef('0x35');utils[_0x52ef('0x2')](util[_0x52ef('0x3')](_0x52ef('0x4e'),_0x30b03d[_0x52ef('0x5')],transfers[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x7')],transfers[_0x30b03d['uniqueid']][_0x52ef('0x21')],transfers[_0x30b03d[_0x52ef('0x5')]]['lastevent']));writeDB(transfers[_0x30b03d['uniqueid']],!![]);}if(agents[_0x30b03d['uniqueid']]&&agents[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x2c')]){agents[_0x30b03d[_0x52ef('0x5')]]['agentcomplete']=!![];agents[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x33')]=utils[_0x52ef('0x17')]();agents[_0x30b03d['uniqueid']][_0x52ef('0x23')]=utils[_0x52ef('0x34')](agents[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x33')],agents[_0x30b03d['uniqueid']][_0x52ef('0x2c')]);agents[_0x30b03d[_0x52ef('0x5')]]['reason']=agents[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x39')]?_0x52ef('0x39'):_0x52ef('0x4f');agents[_0x30b03d['uniqueid']][_0x52ef('0xa')]=_0x52ef('0x35');utils[_0x52ef('0x2')](util[_0x52ef('0x3')](_0x52ef('0x4e'),_0x30b03d['uniqueid'],agents[_0x30b03d[_0x52ef('0x5')]]['membername'],agents[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0x21')],agents[_0x30b03d[_0x52ef('0x5')]][_0x52ef('0xa')]));writeDB(agents[_0x30b03d[_0x52ef('0x5')]]);}}catch(_0x795132){utils['error'](util[_0x52ef('0x3')](_0x52ef('0x50'),_0x30b03d[_0x52ef('0x5')]),_0x795132);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 66d1b57..627ccd6 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 _0xeb36=['calleridnum','getUserByInternal','accountcode','then','UserId','request','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','[%s][calls][newchannel]','newstate','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','error','[%s][calls][newstate]','hangup','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','_attended','origtransfererchannel','userfield','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','noop','execif','set','[%s][calls][newexten]','lodash','util','./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'];(function(_0x4cf477,_0x5cc807){var _0x22e59e=function(_0x21f0cc){while(--_0x21f0cc){_0x4cf477['push'](_0x4cf477['shift']());}};_0x22e59e(++_0x5cc807);}(_0xeb36,0xc1));var _0x6eb3=function(_0x42f7d0,_0x49438e){_0x42f7d0=_0x42f7d0-0x0;var _0x1b2a20=_0xeb36[_0x42f7d0];return _0x1b2a20;};'use strict';var _=require(_0x6eb3('0x0'));var util=require(_0x6eb3('0x1'));var utils=require(_0x6eb3('0x2'));var dispositions=[_0x6eb3('0x3'),_0x6eb3('0x4'),'FAILED',_0x6eb3('0x3'),_0x6eb3('0x3'),'NO\x20ANSWER',_0x6eb3('0x5'),_0x6eb3('0x6'),_0x6eb3('0x4'),'FAILED',_0x6eb3('0x4')];var channels={};function writeDB(_0x5181af){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x9'),_0x5181af[_0x6eb3('0xa')],_0x5181af[_0x6eb3('0xb')],_0x5181af[_0x6eb3('0xc')],_0x5181af[_0x6eb3('0xd')],_0x5181af[_0x6eb3('0xe')],_0x5181af[_0x6eb3('0xf')],_0x5181af['connectedlinenum'],_0x5181af['lastevent']));if(_0x5181af['accountcode']){utils[_0x6eb3('0x10')](_0x5181af[_0x6eb3('0x11')])[_0x6eb3('0x12')](function(_0x246290){if(_0x246290){_0x5181af[_0x6eb3('0x13')]=_0x246290['id'];}utils[_0x6eb3('0x14')]('CreateVoiceCallReport',_0x5181af);});}else{utils[_0x6eb3('0x14')]('CreateVoiceCallReport',_0x5181af);}if(channels[_0x5181af[_0x6eb3('0xa')]]){delete channels[_0x5181af['uniqueid']];}}exports['newchannel']=function(_0x2831ce){try{utils[_0x6eb3('0x15')](util[_0x6eb3('0x8')]('[%s][calls][newchannel]',_0x2831ce[_0x6eb3('0xa')]),_0x2831ce);if(_0x2831ce[_0x6eb3('0xa')]==_0x2831ce[_0x6eb3('0x16')]&&_0x2831ce[_0x6eb3('0xb')]!=_0x6eb3('0x17')){utils['info'](util[_0x6eb3('0x8')](_0x6eb3('0x18'),_0x2831ce['uniqueid'],_0x2831ce[_0x6eb3('0x19')],_0x2831ce['exten']));channels[_0x2831ce[_0x6eb3('0xa')]]={'uniqueid':_0x2831ce[_0x6eb3('0xa')],'accountcode':_0x2831ce[_0x6eb3('0x11')],'source':_0x2831ce['calleridnum'],'destination':_0x2831ce[_0x6eb3('0x1a')],'destinationcontext':_0x2831ce[_0x6eb3('0x19')],'channel':_0x2831ce[_0x6eb3('0xb')],'starttime':utils[_0x6eb3('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x27d8c3){utils['error'](util[_0x6eb3('0x8')](_0x6eb3('0x1c'),_0x2831ce[_0x6eb3('0xa')]),_0x27d8c3);}};exports[_0x6eb3('0x1d')]=function(_0x3bb8e5){try{utils[_0x6eb3('0x15')](util[_0x6eb3('0x8')]('[%s][calls][newstate]',_0x3bb8e5[_0x6eb3('0xa')]),_0x3bb8e5);if(!_['isNil'](channels[_0x3bb8e5[_0x6eb3('0xa')]])&&_0x3bb8e5[_0x6eb3('0x1e')]==0x6){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x1f'),_0x3bb8e5[_0x6eb3('0xa')],_0x3bb8e5['context'],_0x3bb8e5[_0x6eb3('0xb')]));if(_[_0x6eb3('0x20')](channels[_0x3bb8e5[_0x6eb3('0xa')]][_0x6eb3('0x21')])){channels[_0x3bb8e5['uniqueid']][_0x6eb3('0x21')]=utils[_0x6eb3('0x1b')]();}}else if(!_[_0x6eb3('0x20')](channels[_0x3bb8e5[_0x6eb3('0x16')]])&&_0x3bb8e5[_0x6eb3('0x1e')]==0x6&&_0x3bb8e5[_0x6eb3('0x19')]!=_0x6eb3('0x22')){utils['info'](util[_0x6eb3('0x8')](_0x6eb3('0x23'),_0x3bb8e5[_0x6eb3('0xa')],_0x3bb8e5[_0x6eb3('0x16')],_0x3bb8e5['context'],_0x3bb8e5['channel']));channels[_0x3bb8e5[_0x6eb3('0x16')]]['accountcode']=_0x3bb8e5[_0x6eb3('0x11')];channels[_0x3bb8e5[_0x6eb3('0x16')]]['destinationchannel']=_0x3bb8e5[_0x6eb3('0xb')];if(_[_0x6eb3('0x20')](channels[_0x3bb8e5['linkedid']]['answertime'])){channels[_0x3bb8e5['linkedid']][_0x6eb3('0x24')]=utils[_0x6eb3('0x1b')]();}channels[_0x3bb8e5[_0x6eb3('0x16')]][_0x6eb3('0x25')]=dispositions[_[_0x6eb3('0x26')](_0x3bb8e5[_0x6eb3('0x1e')])]||'ANSWERED';}}catch(_0x312d8e){utils[_0x6eb3('0x27')](util[_0x6eb3('0x8')](_0x6eb3('0x28'),_0x3bb8e5['uniqueid']),_0x312d8e);}};exports[_0x6eb3('0x29')]=function(_0x4b0d98){try{if(!_[_0x6eb3('0x20')](channels[_0x4b0d98[_0x6eb3('0xa')]])){utils[_0x6eb3('0x15')](util[_0x6eb3('0x8')]('[%s][calls][hangup]',_0x4b0d98['uniqueid']),_0x4b0d98);if(_[_0x6eb3('0x20')](channels[_0x4b0d98['uniqueid']][_0x6eb3('0x2a')])){channels[_0x4b0d98[_0x6eb3('0xa')]][_0x6eb3('0x2a')]=_0x4b0d98[_0x6eb3('0x2b')]+'\x20<'+_0x4b0d98['calleridnum']+'>';}utils['info'](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x4b0d98['uniqueid'],channels[_0x4b0d98[_0x6eb3('0xa')]][_0x6eb3('0x2a')],_0x4b0d98[_0x6eb3('0x2c')]));channels[_0x4b0d98[_0x6eb3('0xa')]][_0x6eb3('0x2d')]=utils[_0x6eb3('0x1b')]();channels[_0x4b0d98[_0x6eb3('0xa')]][_0x6eb3('0x2e')]=utils[_0x6eb3('0x2f')](channels[_0x4b0d98[_0x6eb3('0xa')]][_0x6eb3('0x2d')],channels[_0x4b0d98[_0x6eb3('0xa')]][_0x6eb3('0x30')]);channels[_0x4b0d98[_0x6eb3('0xa')]]['billableseconds']=channels[_0x4b0d98['uniqueid']]['answertime']?utils['diffTime'](channels[_0x4b0d98['uniqueid']][_0x6eb3('0x2d')],channels[_0x4b0d98[_0x6eb3('0xa')]]['answertime']):0x0;writeDB(channels[_0x4b0d98[_0x6eb3('0xa')]]);}}catch(_0x303b8e){utils[_0x6eb3('0x27')](util['format'](_0x6eb3('0x31'),_0x4b0d98['uniqueid']),_0x303b8e);}};exports[_0x6eb3('0x32')]=function(_0x1a1ddd){try{if(!_['isNil'](channels[_0x1a1ddd[_0x6eb3('0x33')]])){utils[_0x6eb3('0x15')](util[_0x6eb3('0x8')]('[%s][calls][attendedtransfer]',_0x1a1ddd[_0x6eb3('0x34')]),_0x1a1ddd);if(channels[_0x1a1ddd['localtwolinkedid']]['channel']==_0x1a1ddd['transfereechannel']){utils['info'](util['format'](_0x6eb3('0x35'),_0x1a1ddd[_0x6eb3('0x34')],_0x1a1ddd[_0x6eb3('0x33')],_0x1a1ddd[_0x6eb3('0x36')]));channels[_0x1a1ddd[_0x6eb3('0x33')]][_0x6eb3('0x37')]=_0x1a1ddd[_0x6eb3('0x36')];channels[_0x1a1ddd[_0x6eb3('0x33')]]['userfield']=_0x6eb3('0x38');}else if(channels[_0x1a1ddd[_0x6eb3('0x33')]]['channel']=_0x1a1ddd['transfertargetchannel']){utils['info'](util[_0x6eb3('0x8')](_0x6eb3('0x35'),_0x1a1ddd[_0x6eb3('0x34')],_0x1a1ddd[_0x6eb3('0x33')],_0x1a1ddd[_0x6eb3('0x39')]));channels[_0x1a1ddd[_0x6eb3('0x33')]][_0x6eb3('0x37')]=_0x1a1ddd[_0x6eb3('0x39')];channels[_0x1a1ddd[_0x6eb3('0x33')]][_0x6eb3('0x3a')]=_0x6eb3('0x38');}}}catch(_0x3b2562){utils[_0x6eb3('0x27')](util[_0x6eb3('0x8')]('[%s][calls][attendedtransfer]',_0x1a1ddd[_0x6eb3('0x34')]),_0x3b2562);}};exports[_0x6eb3('0x3b')]=function(_0x509da8){try{if(!_[_0x6eb3('0x20')](channels[_0x509da8[_0x6eb3('0xa')]])){utils['debug'](util['format']('[%s][calls][musiconholdstart]',_0x509da8[_0x6eb3('0xa')]),_0x509da8);channels[_0x509da8[_0x6eb3('0xa')]][_0x6eb3('0x3c')]=utils[_0x6eb3('0x1b')]();utils[_0x6eb3('0x7')](util['format'](_0x6eb3('0x3d'),_0x509da8[_0x6eb3('0xa')],channels[_0x509da8[_0x6eb3('0xa')]][_0x6eb3('0x3c')]));}}catch(_0x32521b){utils[_0x6eb3('0x27')](util[_0x6eb3('0x8')]('[%s][calls][musiconholdstart]',_0x509da8[_0x6eb3('0xa')]),_0x32521b);}};exports[_0x6eb3('0x3e')]=function(_0x55228d){try{if(!_[_0x6eb3('0x20')](channels[_0x55228d[_0x6eb3('0xa')]])){utils[_0x6eb3('0x15')](util['format'](_0x6eb3('0x3f'),_0x55228d['uniqueid']),_0x55228d);if(!_[_0x6eb3('0x20')](channels[_0x55228d[_0x6eb3('0xa')]][_0x6eb3('0x3c')])){channels[_0x55228d[_0x6eb3('0xa')]]['mohtime']+=utils[_0x6eb3('0x2f')](utils[_0x6eb3('0x1b')](),channels[_0x55228d[_0x6eb3('0xa')]][_0x6eb3('0x3c')]);utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x40'),_0x55228d['uniqueid'],channels[_0x55228d[_0x6eb3('0xa')]]['mohtime']));delete channels[_0x55228d[_0x6eb3('0xa')]]['musiconholdstartAt'];}}}catch(_0x4ac69f){utils[_0x6eb3('0x27')](util[_0x6eb3('0x8')](_0x6eb3('0x3f'),_0x55228d[_0x6eb3('0xa')]),_0x4ac69f);}};exports['varset']=function(_0x578802){try{if(!_['isNil'](channels[_0x578802['uniqueid']])){utils[_0x6eb3('0x15')](util['format'](_0x6eb3('0x41'),_0x578802[_0x6eb3('0xa')]),_0x578802);if(!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x43')])){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x44'),_0x578802[_0x6eb3('0xa')],_0x578802['value']));channels[_0x578802['uniqueid']][_0x6eb3('0x45')]=_0x578802[_0x6eb3('0x46')];}if(!_['isNil'](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x47')])){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x48'),_0x578802[_0x6eb3('0xa')],_0x578802[_0x6eb3('0x46')]));channels[_0x578802[_0x6eb3('0xa')]]['destination']=_0x578802[_0x6eb3('0x46')];channels[_0x578802[_0x6eb3('0xa')]][_0x6eb3('0x2a')]='\x22'+_0x578802['value']+_0x6eb3('0x49')+_0x578802[_0x6eb3('0x46')]+'>';}if(!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x4a')])||!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x4b')])){utils['info'](util[_0x6eb3('0x8')](_0x6eb3('0x4c'),_0x578802[_0x6eb3('0xa')],!_[_0x6eb3('0x20')](_0x578802['variable'][_0x6eb3('0x4a')])?'xmd-callerid-preview':_0x6eb3('0x4b'),_0x578802[_0x6eb3('0x46')]));channels[_0x578802['uniqueid']][_0x6eb3('0x2a')]=_0x578802[_0x6eb3('0x46')];}if(!_['isNil'](_0x578802['variable'][_0x6eb3('0x4d')])||!_['isNil'](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x4e')])){utils['info'](util['format'](_0x6eb3('0x4c'),_0x578802[_0x6eb3('0xa')],!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')]['xmd-queue'])?_0x6eb3('0x4d'):_0x6eb3('0x4e'),_0x578802[_0x6eb3('0x46')]));channels[_0x578802[_0x6eb3('0xa')]][_0x6eb3('0x4f')]='Queue';channels[_0x578802[_0x6eb3('0xa')]][_0x6eb3('0x50')]=_0x578802[_0x6eb3('0x46')];channels[_0x578802['uniqueid']]['queue']=!![];}if(!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x51')])){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x52'),_0x578802[_0x6eb3('0xa')],_0x578802[_0x6eb3('0x46')]));channels[_0x578802[_0x6eb3('0xa')]][_0x6eb3('0x53')]=_0x578802[_0x6eb3('0x46')];}if(!_['isNil'](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x54')])){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x578802[_0x6eb3('0xa')],_0x578802['value']));channels[_0x578802[_0x6eb3('0xa')]][_0x6eb3('0x55')]=_0x578802[_0x6eb3('0x46')];}if(!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')]['outboundrouteid'])){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x56'),_0x578802[_0x6eb3('0xa')],_0x578802[_0x6eb3('0x46')]));channels[_0x578802[_0x6eb3('0xa')]][_0x6eb3('0x57')]=_0x578802[_0x6eb3('0x46')];}if(!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x58')])){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x59'),_0x578802[_0x6eb3('0xa')],_0x578802[_0x6eb3('0x46')]));channels[_0x578802[_0x6eb3('0xa')]]['sipcallid']=_0x578802[_0x6eb3('0x46')];}}}catch(_0x37657f){utils[_0x6eb3('0x27')](util['format'](_0x6eb3('0x41'),_0x578802[_0x6eb3('0xa')]),_0x37657f);}};exports['newexten']=function(_0x888d7d){try{if(!_[_0x6eb3('0x20')](channels[_0x888d7d[_0x6eb3('0xa')]])){utils[_0x6eb3('0x15')](util['format']('[%s][calls][newexten]',_0x888d7d['uniqueid']),_0x888d7d);utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x5a'),_0x888d7d[_0x6eb3('0xa')],_0x888d7d[_0x6eb3('0x5b')],_0x888d7d['appdata']));if(_0x888d7d[_0x6eb3('0x5b')][_0x6eb3('0x5c')]()=='set'&&_[_0x6eb3('0x5d')](_0x888d7d[_0x6eb3('0x5e')][_0x6eb3('0x5c')](),_0x6eb3('0x5f'))){var _0x5056d4=_0x888d7d[_0x6eb3('0x5e')][_0x6eb3('0x60')]('=');var _0x57191d=_0x5056d4[0x0][_0x6eb3('0x61')](_0x5056d4[0x0][_0x6eb3('0x62')]('(')+0x1,_0x5056d4[0x0][_0x6eb3('0x62')](')'));var _0x3c59a4=_0x5056d4[0x1];channels[_0x888d7d[_0x6eb3('0xa')]][_0x57191d]=_0x3c59a4;}if(!_[_0x6eb3('0x63')]([_0x6eb3('0x29'),_0x6eb3('0x64'),_0x6eb3('0x65'),_0x6eb3('0x66'),'gotoif'],_0x888d7d[_0x6eb3('0x5b')][_0x6eb3('0x5c')]())){channels[_0x888d7d[_0x6eb3('0xa')]][_0x6eb3('0x4f')]=_0x888d7d['application'];channels[_0x888d7d['uniqueid']][_0x6eb3('0x50')]=_0x888d7d[_0x6eb3('0x5e')];}}}catch(_0xd442fd){utils[_0x6eb3('0x27')](util[_0x6eb3('0x8')](_0x6eb3('0x67'),_0x888d7d[_0x6eb3('0xa')]),_0xd442fd);}}; \ No newline at end of file +var _0x095d=['[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','error','newstate','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','starttime','billableseconds','endtime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','gotoif','lodash','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','uniqueid','newchannel','debug','[%s][calls][newchannel]'];(function(_0x1cbc76,_0x52a02b){var _0x4854b3=function(_0xcbb61a){while(--_0xcbb61a){_0x1cbc76['push'](_0x1cbc76['shift']());}};_0x4854b3(++_0x52a02b);}(_0x095d,0x1a0));var _0xd095=function(_0x71cd05,_0x36ac11){_0x71cd05=_0x71cd05-0x0;var _0x59c9e7=_0x095d[_0x71cd05];return _0x59c9e7;};'use strict';var _=require(_0xd095('0x0'));var util=require('util');var utils=require(_0xd095('0x1'));var dispositions=['NO\x20ANSWER',_0xd095('0x2'),'FAILED','NO\x20ANSWER','NO\x20ANSWER',_0xd095('0x3'),_0xd095('0x4'),_0xd095('0x5'),'FAILED',_0xd095('0x2'),_0xd095('0x2')];var channels={};function writeDB(_0x27e07e){utils[_0xd095('0x6')](util[_0xd095('0x7')](_0xd095('0x8'),_0x27e07e['uniqueid'],_0x27e07e[_0xd095('0x9')],_0x27e07e[_0xd095('0xa')],_0x27e07e[_0xd095('0xb')],_0x27e07e[_0xd095('0xc')],_0x27e07e['calleridnum'],_0x27e07e[_0xd095('0xd')],_0x27e07e[_0xd095('0xe')]));if(_0x27e07e[_0xd095('0xf')]){utils[_0xd095('0x10')](_0x27e07e[_0xd095('0xf')])[_0xd095('0x11')](function(_0x5dd7cf){if(_0x5dd7cf){_0x27e07e[_0xd095('0x12')]=_0x5dd7cf['id'];}utils['request'](_0xd095('0x13'),_0x27e07e);});}else{utils['request'](_0xd095('0x13'),_0x27e07e);}if(channels[_0x27e07e[_0xd095('0x14')]]){delete channels[_0x27e07e[_0xd095('0x14')]];}}exports[_0xd095('0x15')]=function(_0x32c35a){try{utils[_0xd095('0x16')](util[_0xd095('0x7')](_0xd095('0x17'),_0x32c35a[_0xd095('0x14')]),_0x32c35a);if(_0x32c35a[_0xd095('0x14')]==_0x32c35a['linkedid']&&_0x32c35a[_0xd095('0x9')]!='OutgoingSpoolFailed'){utils['info'](util[_0xd095('0x7')](_0xd095('0x18'),_0x32c35a[_0xd095('0x14')],_0x32c35a[_0xd095('0x19')],_0x32c35a[_0xd095('0x1a')]));channels[_0x32c35a[_0xd095('0x14')]]={'uniqueid':_0x32c35a[_0xd095('0x14')],'accountcode':_0x32c35a[_0xd095('0xf')],'source':_0x32c35a[_0xd095('0x1b')],'destination':_0x32c35a[_0xd095('0x1a')],'destinationcontext':_0x32c35a[_0xd095('0x19')],'channel':_0x32c35a[_0xd095('0x9')],'starttime':utils[_0xd095('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xd095('0x1d')};}}catch(_0x527136){utils[_0xd095('0x1e')](util[_0xd095('0x7')](_0xd095('0x17'),_0x32c35a[_0xd095('0x14')]),_0x527136);}};exports[_0xd095('0x1f')]=function(_0x4a92a8){try{utils['debug'](util[_0xd095('0x7')]('[%s][calls][newstate]',_0x4a92a8[_0xd095('0x14')]),_0x4a92a8);if(!_[_0xd095('0x20')](channels[_0x4a92a8[_0xd095('0x14')]])&&_0x4a92a8['channelstate']==0x6){utils['info'](util['format'](_0xd095('0x21'),_0x4a92a8[_0xd095('0x14')],_0x4a92a8[_0xd095('0x19')],_0x4a92a8[_0xd095('0x9')]));if(_[_0xd095('0x20')](channels[_0x4a92a8['uniqueid']][_0xd095('0x22')])){channels[_0x4a92a8[_0xd095('0x14')]]['systemanswertime']=utils[_0xd095('0x1c')]();}}else if(!_['isNil'](channels[_0x4a92a8[_0xd095('0x23')]])&&_0x4a92a8['channelstate']==0x6&&_0x4a92a8[_0xd095('0x19')]!=_0xd095('0x24')){utils[_0xd095('0x6')](util[_0xd095('0x7')](_0xd095('0x25'),_0x4a92a8[_0xd095('0x14')],_0x4a92a8[_0xd095('0x23')],_0x4a92a8[_0xd095('0x19')],_0x4a92a8[_0xd095('0x9')]));channels[_0x4a92a8[_0xd095('0x23')]][_0xd095('0xf')]=_0x4a92a8[_0xd095('0xf')];channels[_0x4a92a8[_0xd095('0x23')]]['destinationchannel']=_0x4a92a8[_0xd095('0x9')];if(_[_0xd095('0x20')](channels[_0x4a92a8['linkedid']]['answertime'])){channels[_0x4a92a8['linkedid']][_0xd095('0x26')]=utils[_0xd095('0x1c')]();}channels[_0x4a92a8[_0xd095('0x23')]][_0xd095('0x27')]=dispositions[_[_0xd095('0x28')](_0x4a92a8['channelstate'])]||_0xd095('0x4');}}catch(_0x3c27c5){utils['error'](util[_0xd095('0x7')](_0xd095('0x29'),_0x4a92a8['uniqueid']),_0x3c27c5);}};exports[_0xd095('0x2a')]=function(_0x459f3c){try{if(!_[_0xd095('0x20')](channels[_0x459f3c['uniqueid']])){utils[_0xd095('0x16')](util[_0xd095('0x7')](_0xd095('0x2b'),_0x459f3c[_0xd095('0x14')]),_0x459f3c);if(_[_0xd095('0x20')](channels[_0x459f3c[_0xd095('0x14')]][_0xd095('0x2c')])){channels[_0x459f3c[_0xd095('0x14')]]['callerid']=_0x459f3c[_0xd095('0x2d')]+'\x20<'+_0x459f3c['calleridnum']+'>';}utils[_0xd095('0x6')](util[_0xd095('0x7')](_0xd095('0x2e'),_0x459f3c[_0xd095('0x14')],channels[_0x459f3c[_0xd095('0x14')]][_0xd095('0x2c')],_0x459f3c[_0xd095('0x2f')]));channels[_0x459f3c['uniqueid']]['endtime']=utils[_0xd095('0x1c')]();channels[_0x459f3c[_0xd095('0x14')]][_0xd095('0x30')]=utils[_0xd095('0x31')](channels[_0x459f3c['uniqueid']]['endtime'],channels[_0x459f3c['uniqueid']][_0xd095('0x32')]);channels[_0x459f3c[_0xd095('0x14')]][_0xd095('0x33')]=channels[_0x459f3c[_0xd095('0x14')]][_0xd095('0x26')]?utils[_0xd095('0x31')](channels[_0x459f3c[_0xd095('0x14')]][_0xd095('0x34')],channels[_0x459f3c['uniqueid']][_0xd095('0x26')]):0x0;writeDB(channels[_0x459f3c[_0xd095('0x14')]]);}}catch(_0x399e0a){utils[_0xd095('0x1e')](util['format']('[%s][calls][hangup]',_0x459f3c[_0xd095('0x14')]),_0x399e0a);}};exports[_0xd095('0x35')]=function(_0x2709e1){try{if(!_[_0xd095('0x20')](channels[_0x2709e1[_0xd095('0x36')]])){utils[_0xd095('0x16')](util[_0xd095('0x7')](_0xd095('0x37'),_0x2709e1[_0xd095('0x38')]),_0x2709e1);if(channels[_0x2709e1[_0xd095('0x36')]]['channel']==_0x2709e1['transfereechannel']){utils[_0xd095('0x6')](util[_0xd095('0x7')](_0xd095('0x39'),_0x2709e1['origtransfereruniqueid'],_0x2709e1[_0xd095('0x36')],_0x2709e1[_0xd095('0x3a')]));channels[_0x2709e1['localtwolinkedid']][_0xd095('0x3b')]=_0x2709e1[_0xd095('0x3a')];channels[_0x2709e1[_0xd095('0x36')]][_0xd095('0x3c')]=_0xd095('0x3d');}else if(channels[_0x2709e1[_0xd095('0x36')]][_0xd095('0x9')]=_0x2709e1[_0xd095('0x3e')]){utils[_0xd095('0x6')](util[_0xd095('0x7')](_0xd095('0x39'),_0x2709e1[_0xd095('0x38')],_0x2709e1[_0xd095('0x36')],_0x2709e1['origtransfererchannel']));channels[_0x2709e1[_0xd095('0x36')]][_0xd095('0x3b')]=_0x2709e1[_0xd095('0x3f')];channels[_0x2709e1[_0xd095('0x36')]][_0xd095('0x3c')]=_0xd095('0x3d');}}}catch(_0x4095cd){utils[_0xd095('0x1e')](util[_0xd095('0x7')](_0xd095('0x37'),_0x2709e1[_0xd095('0x38')]),_0x4095cd);}};exports[_0xd095('0x40')]=function(_0x371c10){try{if(!_[_0xd095('0x20')](channels[_0x371c10[_0xd095('0x14')]])){utils[_0xd095('0x16')](util[_0xd095('0x7')](_0xd095('0x41'),_0x371c10[_0xd095('0x14')]),_0x371c10);channels[_0x371c10['uniqueid']][_0xd095('0x42')]=utils['now']();utils[_0xd095('0x6')](util[_0xd095('0x7')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x371c10[_0xd095('0x14')],channels[_0x371c10[_0xd095('0x14')]][_0xd095('0x42')]));}}catch(_0xc3600){utils['error'](util[_0xd095('0x7')](_0xd095('0x41'),_0x371c10[_0xd095('0x14')]),_0xc3600);}};exports[_0xd095('0x43')]=function(_0x1c9d0c){try{if(!_[_0xd095('0x20')](channels[_0x1c9d0c[_0xd095('0x14')]])){utils[_0xd095('0x16')](util[_0xd095('0x7')](_0xd095('0x44'),_0x1c9d0c['uniqueid']),_0x1c9d0c);if(!_[_0xd095('0x20')](channels[_0x1c9d0c[_0xd095('0x14')]][_0xd095('0x42')])){channels[_0x1c9d0c[_0xd095('0x14')]][_0xd095('0x45')]+=utils['diffTime'](utils[_0xd095('0x1c')](),channels[_0x1c9d0c['uniqueid']][_0xd095('0x42')]);utils[_0xd095('0x6')](util[_0xd095('0x7')](_0xd095('0x46'),_0x1c9d0c[_0xd095('0x14')],channels[_0x1c9d0c['uniqueid']]['mohtime']));delete channels[_0x1c9d0c[_0xd095('0x14')]][_0xd095('0x42')];}}}catch(_0x598247){utils[_0xd095('0x1e')](util[_0xd095('0x7')](_0xd095('0x44'),_0x1c9d0c[_0xd095('0x14')]),_0x598247);}};exports['varset']=function(_0x42957d){try{if(!_['isNil'](channels[_0x42957d[_0xd095('0x14')]])){utils[_0xd095('0x16')](util['format']('[%s][calls][varset]',_0x42957d[_0xd095('0x14')]),_0x42957d);if(!_[_0xd095('0x20')](_0x42957d[_0xd095('0x47')][_0xd095('0x48')])){utils['info'](util[_0xd095('0x7')](_0xd095('0x49'),_0x42957d[_0xd095('0x14')],_0x42957d[_0xd095('0x4a')]));channels[_0x42957d[_0xd095('0x14')]][_0xd095('0x4b')]=_0x42957d[_0xd095('0x4a')];}if(!_[_0xd095('0x20')](_0x42957d[_0xd095('0x47')][_0xd095('0x4c')])){utils[_0xd095('0x6')](util[_0xd095('0x7')](_0xd095('0x4d'),_0x42957d[_0xd095('0x14')],_0x42957d[_0xd095('0x4a')]));channels[_0x42957d[_0xd095('0x14')]][_0xd095('0x4e')]=_0x42957d[_0xd095('0x4a')];channels[_0x42957d['uniqueid']]['callerid']='\x22'+_0x42957d['value']+_0xd095('0x4f')+_0x42957d['value']+'>';}if(!_['isNil'](_0x42957d[_0xd095('0x47')]['xmd-callerid-preview'])||!_[_0xd095('0x20')](_0x42957d['variable'][_0xd095('0x50')])){utils[_0xd095('0x6')](util[_0xd095('0x7')](_0xd095('0x51'),_0x42957d[_0xd095('0x14')],!_['isNil'](_0x42957d['variable']['xmd-callerid-preview'])?'xmd-callerid-preview':_0xd095('0x50'),_0x42957d[_0xd095('0x4a')]));channels[_0x42957d[_0xd095('0x14')]][_0xd095('0x2c')]=_0x42957d[_0xd095('0x4a')];}if(!_[_0xd095('0x20')](_0x42957d[_0xd095('0x47')][_0xd095('0x52')])||!_[_0xd095('0x20')](_0x42957d['variable']['xmcs-queue'])){utils[_0xd095('0x6')](util[_0xd095('0x7')](_0xd095('0x51'),_0x42957d[_0xd095('0x14')],!_[_0xd095('0x20')](_0x42957d[_0xd095('0x47')][_0xd095('0x52')])?_0xd095('0x52'):_0xd095('0x53'),_0x42957d[_0xd095('0x4a')]));channels[_0x42957d['uniqueid']][_0xd095('0x54')]=_0xd095('0x55');channels[_0x42957d[_0xd095('0x14')]][_0xd095('0x56')]=_0x42957d[_0xd095('0x4a')];channels[_0x42957d[_0xd095('0x14')]][_0xd095('0xa')]=!![];}if(!_[_0xd095('0x20')](_0x42957d['variable'][_0xd095('0x57')])){utils['info'](util[_0xd095('0x7')](_0xd095('0x58'),_0x42957d['uniqueid'],_0x42957d[_0xd095('0x4a')]));channels[_0x42957d['uniqueid']]['ContactId']=_0x42957d['value'];}if(!_[_0xd095('0x20')](_0x42957d['variable'][_0xd095('0x59')])){utils[_0xd095('0x6')](util[_0xd095('0x7')](_0xd095('0x5a'),_0x42957d[_0xd095('0x14')],_0x42957d[_0xd095('0x4a')]));channels[_0x42957d['uniqueid']]['type']=_0x42957d[_0xd095('0x4a')];}if(!_['isNil'](_0x42957d[_0xd095('0x47')][_0xd095('0x5b')])){utils[_0xd095('0x6')](util[_0xd095('0x7')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x42957d[_0xd095('0x14')],_0x42957d[_0xd095('0x4a')]));channels[_0x42957d[_0xd095('0x14')]][_0xd095('0x5c')]=_0x42957d[_0xd095('0x4a')];}if(!_['isNil'](_0x42957d['variable'][_0xd095('0x5d')])){utils[_0xd095('0x6')](util[_0xd095('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x42957d[_0xd095('0x14')],_0x42957d[_0xd095('0x4a')]));channels[_0x42957d[_0xd095('0x14')]][_0xd095('0x5d')]=_0x42957d[_0xd095('0x4a')];}}}catch(_0xdc4a3e){utils['error'](util[_0xd095('0x7')](_0xd095('0x5e'),_0x42957d[_0xd095('0x14')]),_0xdc4a3e);}};exports[_0xd095('0x5f')]=function(_0x35fb11){try{if(!_[_0xd095('0x20')](channels[_0x35fb11[_0xd095('0x14')]])){utils[_0xd095('0x16')](util[_0xd095('0x7')](_0xd095('0x60'),_0x35fb11['uniqueid']),_0x35fb11);utils['info'](util[_0xd095('0x7')](_0xd095('0x61'),_0x35fb11[_0xd095('0x14')],_0x35fb11[_0xd095('0x62')],_0x35fb11[_0xd095('0x63')]));if(_0x35fb11[_0xd095('0x62')][_0xd095('0x64')]()==_0xd095('0x65')&&_[_0xd095('0x66')](_0x35fb11[_0xd095('0x63')][_0xd095('0x64')](),_0xd095('0x67'))){var _0x576687=_0x35fb11[_0xd095('0x63')][_0xd095('0x68')]('=');var _0x190745=_0x576687[0x0][_0xd095('0x69')](_0x576687[0x0]['lastIndexOf']('(')+0x1,_0x576687[0x0][_0xd095('0x6a')](')'));var _0x4b7e9b=_0x576687[0x1];channels[_0x35fb11[_0xd095('0x14')]][_0x190745]=_0x4b7e9b;}if(!_[_0xd095('0x6b')]([_0xd095('0x2a'),_0xd095('0x6c'),'execif',_0xd095('0x65'),_0xd095('0x6d')],_0x35fb11[_0xd095('0x62')][_0xd095('0x64')]())){channels[_0x35fb11['uniqueid']]['lastapplication']=_0x35fb11['application'];channels[_0x35fb11[_0xd095('0x14')]][_0xd095('0x56')]=_0x35fb11[_0xd095('0x63')];}}}catch(_0x34d2bf){utils[_0xd095('0x1e')](util[_0xd095('0x7')](_0xd095('0x60'),_0x35fb11[_0xd095('0x14')]),_0x34d2bf);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 3c42b43..4ca245b 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 _0x2b8e=['[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x4807ea,_0x30e153){var _0x2f4b90=function(_0x5a6269){while(--_0x5a6269){_0x4807ea['push'](_0x4807ea['shift']());}};_0x2f4b90(++_0x30e153);}(_0x2b8e,0x70));var _0xe2b8=function(_0x557b63,_0x3db65a){_0x557b63=_0x557b63-0x0;var _0x15b6af=_0x2b8e[_0x557b63];return _0x15b6af;};'use strict';var utils=require(_0xe2b8('0x0'));exports[_0xe2b8('0x1')]=function(){utils[_0xe2b8('0x2')]('[core]\x20connected');};exports[_0xe2b8('0x3')]=function(){utils[_0xe2b8('0x2')](_0xe2b8('0x4'));};exports[_0xe2b8('0x5')]=function(){utils[_0xe2b8('0x2')](_0xe2b8('0x6'));};exports[_0xe2b8('0x7')]=function(_0x35ebb3){utils['error'](_0xe2b8('0x8'),_0x35ebb3);};exports[_0xe2b8('0x9')]=function(){utils[_0xe2b8('0x2')](_0xe2b8('0xa'));};exports[_0xe2b8('0xb')]=function(_0x49b4ab){}; \ No newline at end of file +var _0x12a1=['connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','error','[core]\x20close','managerevent'];(function(_0x566a53,_0x3bdb47){var _0x35fa1d=function(_0x1a0031){while(--_0x1a0031){_0x566a53['push'](_0x566a53['shift']());}};_0x35fa1d(++_0x3bdb47);}(_0x12a1,0xb0));var _0x112a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x12a1[_0x14add3];return _0x4a174f;};'use strict';var utils=require('./utils');exports[_0x112a('0x0')]=function(){utils[_0x112a('0x1')](_0x112a('0x2'));};exports[_0x112a('0x3')]=function(){utils['info'](_0x112a('0x4'));};exports['fullybooted']=function(){utils[_0x112a('0x1')]('[core]\x20fullybooted');};exports[_0x112a('0x5')]=function(_0x40de32){utils['error']('[core]\x20error',_0x40de32);};exports['close']=function(){utils[_0x112a('0x1')](_0x112a('0x6'));};exports[_0x112a('0x7')]=function(_0x3dbb50){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 6c00739..0021855 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 _0x6096=['request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','varset','[%s][dials][varset]','isNil','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','[%s][dials][dialend]','ANSWER','answertime','now','connect','hangup','[%s][dials][hangup]','complete','duration','diffTime','endtime','holdtime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus'];(function(_0x1244f7,_0x27e231){var _0x46b05a=function(_0x35a843){while(--_0x35a843){_0x1244f7['push'](_0x1244f7['shift']());}};_0x46b05a(++_0x27e231);}(_0x6096,0xd7));var _0x6609=function(_0x3d46ec,_0x1583d9){_0x3d46ec=_0x3d46ec-0x0;var _0x4d1a34=_0x6096[_0x3d46ec];return _0x4d1a34;};'use strict';var _=require('lodash');var util=require(_0x6609('0x0'));var utils=require(_0x6609('0x1'));var dials={};function writeDB(_0x1276d5){utils[_0x6609('0x2')](util[_0x6609('0x3')](_0x6609('0x4'),_0x1276d5[_0x6609('0x5')],_0x1276d5['channel'],_0x1276d5[_0x6609('0x6')],_0x1276d5[_0x6609('0x7')],_0x1276d5[_0x6609('0x8')],_0x1276d5[_0x6609('0x9')]));utils[_0x6609('0xa')](_0x6609('0xb'),_0x1276d5);delete dials[_0x1276d5[_0x6609('0x5')]];}exports[_0x6609('0xc')]=function(_0x326947){try{utils[_0x6609('0xd')](util['format'](_0x6609('0xe'),_0x326947[_0x6609('0x5')]),_0x326947);utils['info'](util['format'](_0x6609('0xf'),_0x326947[_0x6609('0x5')],_0x326947[_0x6609('0x10')],_0x326947[_0x6609('0x11')]));if(_0x326947[_0x6609('0x10')][_0x6609('0x12')]()==_0x6609('0x13')&&_['startsWith'](_0x326947[_0x6609('0x11')]['toLowerCase'](),'cdr(routeid)')){var _0x300e34=_0x326947[_0x6609('0x11')][_0x6609('0x14')]('=');dials[_0x326947[_0x6609('0x5')]]={'routeId':_0x300e34[0x1]};}}catch(_0x150ebd){utils['error'](util[_0x6609('0x3')](_0x6609('0xe'),_0x326947[_0x6609('0x5')]),_0x150ebd);}};exports[_0x6609('0x15')]=function(_0x13dafd){try{utils[_0x6609('0xd')](util[_0x6609('0x3')](_0x6609('0x16'),_0x13dafd[_0x6609('0x5')]),_0x13dafd);if(!_[_0x6609('0x17')](_0x13dafd['variable']['outboundrouteid'])){utils['info'](util['format'](_0x6609('0x18'),_0x13dafd[_0x6609('0x5')],_0x13dafd[_0x6609('0x19')]));dials[_0x13dafd['uniqueid']]={'routeId':_0x13dafd[_0x6609('0x19')]};}}catch(_0x539221){utils['error'](util[_0x6609('0x3')](_0x6609('0x16'),_0x13dafd['uniqueid']),_0x539221);}};exports['dialbegin']=function(_0x3ea751){try{if(!_[_0x6609('0x17')](dials[_0x3ea751[_0x6609('0x5')]])){utils[_0x6609('0xd')](util['format'](_0x6609('0x1a'),_0x3ea751[_0x6609('0x5')]),_0x3ea751);dials[_0x3ea751[_0x6609('0x5')]]=_[_0x6609('0x1b')](dials[_0x3ea751['uniqueid']],_0x3ea751);dials[_0x3ea751[_0x6609('0x5')]][_0x6609('0x1c')]=utils['now']();dials[_0x3ea751[_0x6609('0x5')]]['lastevent']=_0x6609('0x1d');utils[_0x6609('0x2')](util['format'](_0x6609('0x1e'),_0x3ea751[_0x6609('0x5')],dials[_0x3ea751[_0x6609('0x5')]]['starttime']));}}catch(_0x53ad58){utils[_0x6609('0x1f')](util['format']('[%s][dials][dialbegin]',_0x3ea751[_0x6609('0x5')]),_0x53ad58);}};exports['dialend']=function(_0x3c3f14){try{if(!_[_0x6609('0x17')](dials[_0x3c3f14[_0x6609('0x5')]])){utils[_0x6609('0xd')](util['format'](_0x6609('0x20'),_0x3c3f14[_0x6609('0x5')]),_0x3c3f14);dials[_0x3c3f14[_0x6609('0x5')]][_0x6609('0x9')]=_0x3c3f14[_0x6609('0x9')];if(_0x3c3f14['dialstatus']==_0x6609('0x21')){dials[_0x3c3f14[_0x6609('0x5')]]=_[_0x6609('0x1b')](dials[_0x3c3f14['uniqueid']],_0x3c3f14);dials[_0x3c3f14[_0x6609('0x5')]][_0x6609('0x22')]=utils[_0x6609('0x23')]();dials[_0x3c3f14['uniqueid']]['lastevent']=_0x6609('0x24');utils[_0x6609('0x2')](util[_0x6609('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x3c3f14['uniqueid'],_0x3c3f14[_0x6609('0x9')],dials[_0x3c3f14['uniqueid']]['answertime']));}else{utils[_0x6609('0x2')](util[_0x6609('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x3c3f14[_0x6609('0x5')],_0x3c3f14[_0x6609('0x9')]));}}}catch(_0x5f5cee){utils[_0x6609('0x1f')](util[_0x6609('0x3')](_0x6609('0x20'),_0x3c3f14['uniqueid']),_0x5f5cee);}};exports[_0x6609('0x25')]=function(_0x75c56f){try{if(!_[_0x6609('0x17')](dials[_0x75c56f['uniqueid']])){utils[_0x6609('0xd')](util[_0x6609('0x3')](_0x6609('0x26'),_0x75c56f[_0x6609('0x5')]),_0x75c56f);utils[_0x6609('0x2')](util[_0x6609('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x75c56f[_0x6609('0x5')],_0x75c56f[_0x6609('0x7')],_0x75c56f['calleridname'],_0x75c56f['cause-txt']));dials[_0x75c56f[_0x6609('0x5')]]=_['assign'](dials[_0x75c56f['uniqueid']],{'endtime':utils[_0x6609('0x23')](),'lastevent':_0x6609('0x27')});dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x28')]=utils[_0x6609('0x29')](dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x2a')],dials[_0x75c56f['uniqueid']][_0x6609('0x1c')]);dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x2b')]=utils[_0x6609('0x29')](dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x22')]||dials[_0x75c56f[_0x6609('0x5')]]['endtime'],dials[_0x75c56f[_0x6609('0x5')]]['starttime']);dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x2c')]=dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x22')]?utils[_0x6609('0x29')](dials[_0x75c56f['uniqueid']][_0x6609('0x2a')],dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x22')]):0x0;writeDB(dials[_0x75c56f[_0x6609('0x5')]]);}}catch(_0x218edb){utils[_0x6609('0x1f')](util[_0x6609('0x3')]('[%s][dials][hangup]',_0x75c56f['uniqueid']),_0x218edb);}}; \ No newline at end of file +var _0x1015=['[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','connectedlinenum','dialstatus','newexten','debug','[%s][dials][newexten]','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridnum','calleridname','cause-txt','complete','diffTime','endtime','holdtime','billableseconds','util','info','format'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1015,0xbd));var _0x5101=function(_0x28a368,_0x31f227){_0x28a368=_0x28a368-0x0;var _0xef5507=_0x1015[_0x28a368];return _0xef5507;};'use strict';var _=require('lodash');var util=require(_0x5101('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x23b080){utils[_0x5101('0x1')](util[_0x5101('0x2')](_0x5101('0x3'),_0x23b080['uniqueid'],_0x23b080['channel'],_0x23b080[_0x5101('0x4')],_0x23b080['calleridnum'],_0x23b080[_0x5101('0x5')],_0x23b080[_0x5101('0x6')]));utils['request']('CreateVoiceDialReport',_0x23b080);delete dials[_0x23b080['uniqueid']];}exports[_0x5101('0x7')]=function(_0x11391f){try{utils[_0x5101('0x8')](util['format'](_0x5101('0x9'),_0x11391f[_0x5101('0xa')]),_0x11391f);utils['info'](util[_0x5101('0x2')](_0x5101('0xb'),_0x11391f[_0x5101('0xa')],_0x11391f[_0x5101('0xc')],_0x11391f[_0x5101('0xd')]));if(_0x11391f[_0x5101('0xc')]['toLowerCase']()=='set'&&_[_0x5101('0xe')](_0x11391f['appdata'][_0x5101('0xf')](),_0x5101('0x10'))){var _0x5433dd=_0x11391f['appdata']['split']('=');dials[_0x11391f[_0x5101('0xa')]]={'routeId':_0x5433dd[0x1]};}}catch(_0x50bb71){utils[_0x5101('0x11')](util[_0x5101('0x2')]('[%s][dials][newexten]',_0x11391f[_0x5101('0xa')]),_0x50bb71);}};exports[_0x5101('0x12')]=function(_0x3240e1){try{utils[_0x5101('0x8')](util[_0x5101('0x2')](_0x5101('0x13'),_0x3240e1[_0x5101('0xa')]),_0x3240e1);if(!_[_0x5101('0x14')](_0x3240e1[_0x5101('0x15')][_0x5101('0x16')])){utils['info'](util[_0x5101('0x2')](_0x5101('0x17'),_0x3240e1[_0x5101('0xa')],_0x3240e1[_0x5101('0x18')]));dials[_0x3240e1[_0x5101('0xa')]]={'routeId':_0x3240e1[_0x5101('0x18')]};}}catch(_0x5a771c){utils[_0x5101('0x11')](util[_0x5101('0x2')]('[%s][dials][varset]',_0x3240e1[_0x5101('0xa')]),_0x5a771c);}};exports[_0x5101('0x19')]=function(_0x2bbf5e){try{if(!_['isNil'](dials[_0x2bbf5e[_0x5101('0xa')]])){utils['debug'](util[_0x5101('0x2')]('[%s][dials][dialbegin]',_0x2bbf5e[_0x5101('0xa')]),_0x2bbf5e);dials[_0x2bbf5e[_0x5101('0xa')]]=_[_0x5101('0x1a')](dials[_0x2bbf5e[_0x5101('0xa')]],_0x2bbf5e);dials[_0x2bbf5e['uniqueid']][_0x5101('0x1b')]=utils[_0x5101('0x1c')]();dials[_0x2bbf5e['uniqueid']][_0x5101('0x1d')]=_0x5101('0x1e');utils['info'](util[_0x5101('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x2bbf5e[_0x5101('0xa')],dials[_0x2bbf5e['uniqueid']]['starttime']));}}catch(_0x30443e){utils[_0x5101('0x11')](util[_0x5101('0x2')](_0x5101('0x1f'),_0x2bbf5e[_0x5101('0xa')]),_0x30443e);}};exports[_0x5101('0x20')]=function(_0x36f205){try{if(!_[_0x5101('0x14')](dials[_0x36f205[_0x5101('0xa')]])){utils[_0x5101('0x8')](util['format'](_0x5101('0x21'),_0x36f205['uniqueid']),_0x36f205);dials[_0x36f205[_0x5101('0xa')]][_0x5101('0x6')]=_0x36f205['dialstatus'];if(_0x36f205[_0x5101('0x6')]==_0x5101('0x22')){dials[_0x36f205[_0x5101('0xa')]]=_[_0x5101('0x1a')](dials[_0x36f205[_0x5101('0xa')]],_0x36f205);dials[_0x36f205[_0x5101('0xa')]][_0x5101('0x23')]=utils[_0x5101('0x1c')]();dials[_0x36f205[_0x5101('0xa')]]['lastevent']=_0x5101('0x24');utils[_0x5101('0x1')](util[_0x5101('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x36f205[_0x5101('0xa')],_0x36f205['dialstatus'],dials[_0x36f205[_0x5101('0xa')]][_0x5101('0x23')]));}else{utils['info'](util[_0x5101('0x2')](_0x5101('0x25'),_0x36f205[_0x5101('0xa')],_0x36f205[_0x5101('0x6')]));}}}catch(_0x37caa9){utils[_0x5101('0x11')](util[_0x5101('0x2')](_0x5101('0x21'),_0x36f205[_0x5101('0xa')]),_0x37caa9);}};exports[_0x5101('0x26')]=function(_0x9667b5){try{if(!_[_0x5101('0x14')](dials[_0x9667b5[_0x5101('0xa')]])){utils[_0x5101('0x8')](util[_0x5101('0x2')](_0x5101('0x27'),_0x9667b5['uniqueid']),_0x9667b5);utils[_0x5101('0x1')](util[_0x5101('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x9667b5[_0x5101('0xa')],_0x9667b5[_0x5101('0x28')],_0x9667b5[_0x5101('0x29')],_0x9667b5[_0x5101('0x2a')]));dials[_0x9667b5[_0x5101('0xa')]]=_[_0x5101('0x1a')](dials[_0x9667b5[_0x5101('0xa')]],{'endtime':utils[_0x5101('0x1c')](),'lastevent':_0x5101('0x2b')});dials[_0x9667b5[_0x5101('0xa')]]['duration']=utils[_0x5101('0x2c')](dials[_0x9667b5['uniqueid']][_0x5101('0x2d')],dials[_0x9667b5['uniqueid']][_0x5101('0x1b')]);dials[_0x9667b5['uniqueid']][_0x5101('0x2e')]=utils[_0x5101('0x2c')](dials[_0x9667b5[_0x5101('0xa')]][_0x5101('0x23')]||dials[_0x9667b5['uniqueid']][_0x5101('0x2d')],dials[_0x9667b5[_0x5101('0xa')]][_0x5101('0x1b')]);dials[_0x9667b5['uniqueid']][_0x5101('0x2f')]=dials[_0x9667b5['uniqueid']]['answertime']?utils['diffTime'](dials[_0x9667b5[_0x5101('0xa')]][_0x5101('0x2d')],dials[_0x9667b5[_0x5101('0xa')]]['answertime']):0x0;writeDB(dials[_0x9667b5[_0x5101('0xa')]]);}}catch(_0x42ffa9){utils['error'](util[_0x5101('0x2')](_0x5101('0x27'),_0x9667b5[_0x5101('0xa')]),_0x42ffa9);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index c9d707f..485a689 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 _0x748d=['queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s][index][dialend]','dialend','asterisk-manager','./utils','util','asterisk','port','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','[%s][index][agentcalled]','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x748d,0x1ea));var _0xd748=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x748d[_0x14add3];return _0x4a174f;};var AsteriskManager=require(_0xd748('0x0'));var config=require('../../config/environment');var utils=require(_0xd748('0x1'));var util=require(_0xd748('0x2'));var ami=new AsteriskManager(config[_0xd748('0x3')][_0xd748('0x4')],config[_0xd748('0x3')]['ip'],config[_0xd748('0x3')]['username'],config['asterisk']['password'],!![]);ami[_0xd748('0x5')]();if(config[_0xd748('0x6')]&&config[_0xd748('0x6')][_0xd748('0x7')]){utils[_0xd748('0x8')](_0xd748('0x9'));}else{var agents=require(_0xd748('0xa'));var calls=require('./calls.controller');var queues=require(_0xd748('0xb'));var recordings=require(_0xd748('0xc'));var members=require(_0xd748('0xd'));var dials=require(_0xd748('0xe'));var transfers=require(_0xd748('0xf'));var core=require(_0xd748('0x10'));ami['on'](_0xd748('0x11'),core[_0xd748('0x11')]);ami['on'](_0xd748('0x12'),core[_0xd748('0x12')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0xd748('0x13'),core[_0xd748('0x13')]);ami['on'](_0xd748('0x14'),core[_0xd748('0x14')]);ami['on'](_0xd748('0x15'),core[_0xd748('0x15')]);ami['on'](_0xd748('0x16'),function(_0x19fd9a){try{utils[_0xd748('0x17')](util[_0xd748('0x18')]('[%s][index][devicestatechange]',_0x19fd9a[_0xd748('0x19')]),_0x19fd9a);members[_0xd748('0x16')](_0x19fd9a);}catch(_0x4bd4b5){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x1a'),_0x19fd9a[_0xd748('0x19')]),_0x4bd4b5);}});ami['on']('agentcalled',function(_0x1a3d69){try{utils['debug'](util['format'](_0xd748('0x1b'),_0x1a3d69['uniqueid']),_0x1a3d69);agents[_0xd748('0x1c')](_0x1a3d69);}catch(_0x1a4a54){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x1b'),_0x1a3d69[_0xd748('0x1d')]),_0x1a4a54);}});ami['on'](_0xd748('0x1e'),function(_0x1d90e7){try{utils[_0xd748('0x17')](util['format'](_0xd748('0x1f'),_0x1d90e7[_0xd748('0x1d')]),_0x1d90e7);agents[_0xd748('0x1e')](_0x1d90e7);}catch(_0x5a00a3){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x1f'),_0x1d90e7[_0xd748('0x1d')]),_0x5a00a3);}});ami['on']('agentconnect',function(_0x3fd23d){try{utils[_0xd748('0x17')](util[_0xd748('0x18')]('[%s][index][agentconnect]',_0x3fd23d[_0xd748('0x1d')]),_0x3fd23d);agents['agentconnect'](_0x3fd23d);queues[_0xd748('0x20')](_0x3fd23d);}catch(_0x4418e9){utils[_0xd748('0x13')](util['format'](_0xd748('0x21'),_0x3fd23d['uniqueid']),_0x4418e9);}});ami['on']('agentcomplete',function(_0x4d0ed1){try{utils[_0xd748('0x17')](util['format'](_0xd748('0x22'),_0x4d0ed1['uniqueid']),_0x4d0ed1);agents['agentcomplete'](_0x4d0ed1);queues[_0xd748('0x23')](_0x4d0ed1);members['agentcomplete'](_0x4d0ed1);}catch(_0x595d2a){utils['error'](util[_0xd748('0x18')](_0xd748('0x22'),_0x4d0ed1['uniqueid']),_0x595d2a);}});ami['on'](_0xd748('0x24'),function(_0x1bc704){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x25'),_0x1bc704['uniqueid']),_0x1bc704);agents[_0xd748('0x24')](_0x1bc704);queues[_0xd748('0x24')](_0x1bc704);}catch(_0x4e110b){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x25'),_0x1bc704['uniqueid']),_0x4e110b);}});ami['on'](_0xd748('0x26'),function(_0x4eadcc){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x27'),_0x4eadcc[_0xd748('0x1d')]),_0x4eadcc);queues[_0xd748('0x26')](_0x4eadcc);recordings[_0xd748('0x26')](_0x4eadcc);}catch(_0x2640f0){utils['error'](util['format'](_0xd748('0x27'),_0x4eadcc[_0xd748('0x1d')]),_0x2640f0);}});ami['on'](_0xd748('0x28'),function(_0x21ef5c){try{utils[_0xd748('0x17')](util[_0xd748('0x18')]('[%s][index][queuecallerleave]',_0x21ef5c[_0xd748('0x1d')]),_0x21ef5c);queues[_0xd748('0x28')](_0x21ef5c);}catch(_0xe262de){utils[_0xd748('0x13')](util['format'](_0xd748('0x29'),_0x21ef5c['uniqueid']),_0xe262de);}});ami['on']('musiconholdstart',function(_0x5d9dfc){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x2a'),_0x5d9dfc[_0xd748('0x1d')]),_0x5d9dfc);queues[_0xd748('0x2b')](_0x5d9dfc);calls[_0xd748('0x2b')](_0x5d9dfc);}catch(_0x264298){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x2a'),_0x5d9dfc[_0xd748('0x1d')]),_0x264298);}});ami['on']('musiconholdstop',function(_0xcfbf29){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x2c'),_0xcfbf29[_0xd748('0x1d')]),_0xcfbf29);queues[_0xd748('0x2d')](_0xcfbf29);calls[_0xd748('0x2d')](_0xcfbf29);}catch(_0xbcd7f5){utils[_0xd748('0x13')](util[_0xd748('0x18')]('[%s][index][musiconholdstop]',_0xcfbf29[_0xd748('0x1d')]),_0xbcd7f5);}});ami['on'](_0xd748('0x2e'),function(_0xce69f9){try{utils['debug'](util[_0xd748('0x18')]('[%s][index][newstate]',_0xce69f9[_0xd748('0x1d')]),_0xce69f9);calls[_0xd748('0x2e')](_0xce69f9);recordings['newstate'](_0xce69f9);}catch(_0x3c3ca9){utils[_0xd748('0x13')](util['format']('[%s][index][newstate]',_0xce69f9[_0xd748('0x1d')]),_0x3c3ca9);}});ami['on']('hangup',function(_0x5dd5ba){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x2f'),_0x5dd5ba[_0xd748('0x1d')]),_0x5dd5ba);calls[_0xd748('0x30')](_0x5dd5ba);recordings['hangup'](_0x5dd5ba);dials[_0xd748('0x30')](_0x5dd5ba);agents[_0xd748('0x30')](_0x5dd5ba);queues['hangup'](_0x5dd5ba);}catch(_0x93f164){utils['error'](util[_0xd748('0x18')](_0xd748('0x2f'),_0x5dd5ba[_0xd748('0x1d')]),_0x93f164);}});ami['on'](_0xd748('0x31'),function(_0x4aec6b){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x32'),_0x4aec6b[_0xd748('0x1d')]),_0x4aec6b);members['cdr'](_0x4aec6b);}catch(_0x51c731){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x32'),_0x4aec6b[_0xd748('0x1d')]),_0x51c731);}});ami['on']('blindtransfer',function(_0x3c8ea5){try{utils[_0xd748('0x17')](util['format']('[%s][index][blindtransfer]',_0x3c8ea5[_0xd748('0x1d')]),_0x3c8ea5);queues[_0xd748('0x33')](_0x3c8ea5);agents[_0xd748('0x33')](_0x3c8ea5);transfers[_0xd748('0x33')](_0x3c8ea5);}catch(_0x12f18a){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x34'),_0x3c8ea5['uniqueid']),_0x12f18a);}});ami['on'](_0xd748('0x35'),function(_0x2b3827){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x36'),_0x2b3827[_0xd748('0x37')]),_0x2b3827);queues['attendedtransfer'](_0x2b3827);transfers['attendedtransfer'](_0x2b3827);agents[_0xd748('0x35')](_0x2b3827);calls[_0xd748('0x35')](_0x2b3827);}catch(_0x55e3d9){utils[_0xd748('0x13')](util['format'](_0xd748('0x36'),_0x2b3827[_0xd748('0x37')]),_0x55e3d9);}});ami['on'](_0xd748('0x38'),function(_0x29aa7d){try{utils[_0xd748('0x17')](util['format'](_0xd748('0x39'),_0x29aa7d[_0xd748('0x1d')]),_0x29aa7d);queues[_0xd748('0x38')](_0x29aa7d);recordings[_0xd748('0x38')](_0x29aa7d);calls[_0xd748('0x38')](_0x29aa7d);dials[_0xd748('0x38')](_0x29aa7d);}catch(_0x3ca0f9){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x39'),_0x29aa7d[_0xd748('0x1d')]),_0x3ca0f9);}});ami['on'](_0xd748('0x3a'),function(_0x3b892c){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x3b'),_0x3b892c[_0xd748('0x1d')]),_0x3b892c);calls['newexten'](_0x3b892c);recordings[_0xd748('0x3a')](_0x3b892c);dials[_0xd748('0x3a')](_0x3b892c);}catch(_0x21c7dd){utils[_0xd748('0x13')](util['format'](_0xd748('0x3b'),_0x3b892c[_0xd748('0x1d')]),_0x21c7dd);}});ami['on']('newchannel',function(_0x498f53){try{utils[_0xd748('0x17')](util[_0xd748('0x18')]('[%s][index][newchannel]',_0x498f53[_0xd748('0x1d')]),_0x498f53);calls[_0xd748('0x3c')](_0x498f53);recordings[_0xd748('0x3c')](_0x498f53);}catch(_0xeb5c5e){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x3d'),_0x498f53[_0xd748('0x1d')]),_0xeb5c5e);}});ami['on']('dialbegin',function(_0x2714c0){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x3e'),_0x2714c0[_0xd748('0x1d')]),_0x2714c0);dials[_0xd748('0x3f')](_0x2714c0);}catch(_0x488a19){utils[_0xd748('0x13')](util[_0xd748('0x18')]('[%s]dialbegin',_0x2714c0[_0xd748('0x1d')]),_0x488a19);}});ami['on']('dialend',function(_0x1a1d5c){try{utils[_0xd748('0x17')](util['format'](_0xd748('0x40'),_0x1a1d5c[_0xd748('0x1d')]),_0x1a1d5c);dials[_0xd748('0x41')](_0x1a1d5c);}catch(_0x7b75fc){utils[_0xd748('0x13')](util[_0xd748('0x18')]('[%s][index][dialend]',_0x1a1d5c['uniqueid']),_0x7b75fc);}});} \ No newline at end of file +var _0x54ca=['[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s][index][dialend]','dialend','asterisk-manager','./utils','util','port','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart'];(function(_0x1d6265,_0x5dbaae){var _0x3bed33=function(_0x1b06b6){while(--_0x1b06b6){_0x1d6265['push'](_0x1d6265['shift']());}};_0x3bed33(++_0x5dbaae);}(_0x54ca,0x1b0));var _0xa54c=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0x54ca[_0x4907de];return _0x482054;};var AsteriskManager=require(_0xa54c('0x0'));var config=require('../../config/environment');var utils=require(_0xa54c('0x1'));var util=require(_0xa54c('0x2'));var ami=new AsteriskManager(config['asterisk'][_0xa54c('0x3')],config[_0xa54c('0x4')]['ip'],config[_0xa54c('0x4')][_0xa54c('0x5')],config[_0xa54c('0x4')][_0xa54c('0x6')],!![]);ami[_0xa54c('0x7')]();if(config[_0xa54c('0x8')]&&config['xdr'][_0xa54c('0x9')]){utils[_0xa54c('0xa')](_0xa54c('0xb'));}else{var agents=require(_0xa54c('0xc'));var calls=require(_0xa54c('0xd'));var queues=require(_0xa54c('0xe'));var recordings=require(_0xa54c('0xf'));var members=require(_0xa54c('0x10'));var dials=require('./dials.controller');var transfers=require(_0xa54c('0x11'));var core=require(_0xa54c('0x12'));ami['on'](_0xa54c('0x13'),core[_0xa54c('0x13')]);ami['on'](_0xa54c('0x14'),core[_0xa54c('0x14')]);ami['on'](_0xa54c('0x15'),core[_0xa54c('0x15')]);ami['on'](_0xa54c('0x16'),core[_0xa54c('0x16')]);ami['on'](_0xa54c('0x17'),core[_0xa54c('0x17')]);ami['on'](_0xa54c('0x18'),core[_0xa54c('0x18')]);ami['on'](_0xa54c('0x19'),function(_0x281aa0){try{utils['debug'](util[_0xa54c('0x1a')](_0xa54c('0x1b'),_0x281aa0[_0xa54c('0x1c')]),_0x281aa0);members[_0xa54c('0x19')](_0x281aa0);}catch(_0x44032c){utils[_0xa54c('0x16')](util[_0xa54c('0x1a')]('[%s][index][devicestatechange]',_0x281aa0['device']),_0x44032c);}});ami['on'](_0xa54c('0x1d'),function(_0x12b7d6){try{utils['debug'](util[_0xa54c('0x1a')](_0xa54c('0x1e'),_0x12b7d6[_0xa54c('0x1f')]),_0x12b7d6);agents['agentcalled'](_0x12b7d6);}catch(_0x2dab5f){utils[_0xa54c('0x16')](util[_0xa54c('0x1a')]('[%s][index][agentcalled]',_0x12b7d6[_0xa54c('0x1f')]),_0x2dab5f);}});ami['on'](_0xa54c('0x20'),function(_0x4b444b){try{utils[_0xa54c('0x21')](util[_0xa54c('0x1a')](_0xa54c('0x22'),_0x4b444b[_0xa54c('0x1f')]),_0x4b444b);agents[_0xa54c('0x20')](_0x4b444b);}catch(_0x307eab){utils[_0xa54c('0x16')](util[_0xa54c('0x1a')](_0xa54c('0x22'),_0x4b444b['uniqueid']),_0x307eab);}});ami['on'](_0xa54c('0x23'),function(_0x18508a){try{utils[_0xa54c('0x21')](util[_0xa54c('0x1a')](_0xa54c('0x24'),_0x18508a[_0xa54c('0x1f')]),_0x18508a);agents[_0xa54c('0x23')](_0x18508a);queues[_0xa54c('0x23')](_0x18508a);}catch(_0x5bbdcb){utils[_0xa54c('0x16')](util[_0xa54c('0x1a')](_0xa54c('0x24'),_0x18508a['uniqueid']),_0x5bbdcb);}});ami['on'](_0xa54c('0x25'),function(_0x2458c1){try{utils[_0xa54c('0x21')](util[_0xa54c('0x1a')](_0xa54c('0x26'),_0x2458c1[_0xa54c('0x1f')]),_0x2458c1);agents['agentcomplete'](_0x2458c1);queues[_0xa54c('0x25')](_0x2458c1);members[_0xa54c('0x25')](_0x2458c1);}catch(_0x40b715){utils[_0xa54c('0x16')](util[_0xa54c('0x1a')](_0xa54c('0x26'),_0x2458c1[_0xa54c('0x1f')]),_0x40b715);}});ami['on']('queuecallerabandon',function(_0x2af006){try{utils['debug'](util[_0xa54c('0x1a')](_0xa54c('0x27'),_0x2af006[_0xa54c('0x1f')]),_0x2af006);agents[_0xa54c('0x28')](_0x2af006);queues[_0xa54c('0x28')](_0x2af006);}catch(_0xd32b45){utils[_0xa54c('0x16')](util[_0xa54c('0x1a')]('[%s][index][queuecallerabandon]',_0x2af006[_0xa54c('0x1f')]),_0xd32b45);}});ami['on']('queuecallerjoin',function(_0x53f909){try{utils[_0xa54c('0x21')](util['format'](_0xa54c('0x29'),_0x53f909[_0xa54c('0x1f')]),_0x53f909);queues['queuecallerjoin'](_0x53f909);recordings['queuecallerjoin'](_0x53f909);}catch(_0x5855cd){utils[_0xa54c('0x16')](util[_0xa54c('0x1a')](_0xa54c('0x29'),_0x53f909['uniqueid']),_0x5855cd);}});ami['on']('queuecallerleave',function(_0x177f97){try{utils[_0xa54c('0x21')](util[_0xa54c('0x1a')](_0xa54c('0x2a'),_0x177f97[_0xa54c('0x1f')]),_0x177f97);queues['queuecallerleave'](_0x177f97);}catch(_0x2a8a3d){utils['error'](util['format']('[%s][index][queuecallerleave]',_0x177f97[_0xa54c('0x1f')]),_0x2a8a3d);}});ami['on'](_0xa54c('0x2b'),function(_0xe5a58e){try{utils[_0xa54c('0x21')](util[_0xa54c('0x1a')](_0xa54c('0x2c'),_0xe5a58e[_0xa54c('0x1f')]),_0xe5a58e);queues['musiconholdstart'](_0xe5a58e);calls[_0xa54c('0x2b')](_0xe5a58e);}catch(_0x55faef){utils[_0xa54c('0x16')](util['format'](_0xa54c('0x2c'),_0xe5a58e[_0xa54c('0x1f')]),_0x55faef);}});ami['on'](_0xa54c('0x2d'),function(_0x2668c4){try{utils[_0xa54c('0x21')](util['format'](_0xa54c('0x2e'),_0x2668c4[_0xa54c('0x1f')]),_0x2668c4);queues['musiconholdstop'](_0x2668c4);calls[_0xa54c('0x2d')](_0x2668c4);}catch(_0x5bce38){utils['error'](util[_0xa54c('0x1a')](_0xa54c('0x2e'),_0x2668c4[_0xa54c('0x1f')]),_0x5bce38);}});ami['on'](_0xa54c('0x2f'),function(_0x3ab400){try{utils[_0xa54c('0x21')](util[_0xa54c('0x1a')](_0xa54c('0x30'),_0x3ab400[_0xa54c('0x1f')]),_0x3ab400);calls['newstate'](_0x3ab400);recordings[_0xa54c('0x2f')](_0x3ab400);}catch(_0x44ae7d){utils[_0xa54c('0x16')](util['format'](_0xa54c('0x30'),_0x3ab400[_0xa54c('0x1f')]),_0x44ae7d);}});ami['on']('hangup',function(_0x4ceff8){try{utils[_0xa54c('0x21')](util['format']('[%s][index][hangup]',_0x4ceff8['uniqueid']),_0x4ceff8);calls['hangup'](_0x4ceff8);recordings['hangup'](_0x4ceff8);dials[_0xa54c('0x31')](_0x4ceff8);agents[_0xa54c('0x31')](_0x4ceff8);queues[_0xa54c('0x31')](_0x4ceff8);}catch(_0x2a31bb){utils[_0xa54c('0x16')](util[_0xa54c('0x1a')](_0xa54c('0x32'),_0x4ceff8['uniqueid']),_0x2a31bb);}});ami['on'](_0xa54c('0x33'),function(_0x580635){try{utils[_0xa54c('0x21')](util[_0xa54c('0x1a')](_0xa54c('0x34'),_0x580635[_0xa54c('0x1f')]),_0x580635);members['cdr'](_0x580635);}catch(_0x5ab4ec){utils[_0xa54c('0x16')](util['format'](_0xa54c('0x34'),_0x580635[_0xa54c('0x1f')]),_0x5ab4ec);}});ami['on'](_0xa54c('0x35'),function(_0x5ef13c){try{utils['debug'](util[_0xa54c('0x1a')](_0xa54c('0x36'),_0x5ef13c[_0xa54c('0x1f')]),_0x5ef13c);queues[_0xa54c('0x35')](_0x5ef13c);agents['blindtransfer'](_0x5ef13c);transfers[_0xa54c('0x35')](_0x5ef13c);}catch(_0x2c8bcd){utils[_0xa54c('0x16')](util['format'](_0xa54c('0x36'),_0x5ef13c[_0xa54c('0x1f')]),_0x2c8bcd);}});ami['on'](_0xa54c('0x37'),function(_0x3c6e4c){try{utils[_0xa54c('0x21')](util[_0xa54c('0x1a')]('[%s][index][attendedtransfer]',_0x3c6e4c[_0xa54c('0x38')]),_0x3c6e4c);queues[_0xa54c('0x37')](_0x3c6e4c);transfers[_0xa54c('0x37')](_0x3c6e4c);agents[_0xa54c('0x37')](_0x3c6e4c);calls['attendedtransfer'](_0x3c6e4c);}catch(_0x495738){utils[_0xa54c('0x16')](util['format'](_0xa54c('0x39'),_0x3c6e4c[_0xa54c('0x38')]),_0x495738);}});ami['on'](_0xa54c('0x3a'),function(_0x3ac947){try{utils[_0xa54c('0x21')](util[_0xa54c('0x1a')](_0xa54c('0x3b'),_0x3ac947[_0xa54c('0x1f')]),_0x3ac947);queues[_0xa54c('0x3a')](_0x3ac947);recordings['varset'](_0x3ac947);calls[_0xa54c('0x3a')](_0x3ac947);dials['varset'](_0x3ac947);}catch(_0x1a35c8){utils['error'](util[_0xa54c('0x1a')](_0xa54c('0x3b'),_0x3ac947[_0xa54c('0x1f')]),_0x1a35c8);}});ami['on'](_0xa54c('0x3c'),function(_0x45c5e1){try{utils[_0xa54c('0x21')](util[_0xa54c('0x1a')](_0xa54c('0x3d'),_0x45c5e1[_0xa54c('0x1f')]),_0x45c5e1);calls[_0xa54c('0x3c')](_0x45c5e1);recordings[_0xa54c('0x3c')](_0x45c5e1);dials[_0xa54c('0x3c')](_0x45c5e1);}catch(_0x1c01b8){utils[_0xa54c('0x16')](util[_0xa54c('0x1a')](_0xa54c('0x3d'),_0x45c5e1[_0xa54c('0x1f')]),_0x1c01b8);}});ami['on'](_0xa54c('0x3e'),function(_0x12fcd4){try{utils[_0xa54c('0x21')](util[_0xa54c('0x1a')]('[%s][index][newchannel]',_0x12fcd4['uniqueid']),_0x12fcd4);calls[_0xa54c('0x3e')](_0x12fcd4);recordings[_0xa54c('0x3e')](_0x12fcd4);}catch(_0x4c116f){utils['error'](util[_0xa54c('0x1a')](_0xa54c('0x3f'),_0x12fcd4['uniqueid']),_0x4c116f);}});ami['on'](_0xa54c('0x40'),function(_0x19bfb2){try{utils['debug'](util[_0xa54c('0x1a')](_0xa54c('0x41'),_0x19bfb2[_0xa54c('0x1f')]),_0x19bfb2);dials['dialbegin'](_0x19bfb2);}catch(_0x2dc54d){utils[_0xa54c('0x16')](util['format']('[%s]dialbegin',_0x19bfb2['uniqueid']),_0x2dc54d);}});ami['on']('dialend',function(_0x2ef8a3){try{utils[_0xa54c('0x21')](util[_0xa54c('0x1a')](_0xa54c('0x42'),_0x2ef8a3[_0xa54c('0x1f')]),_0x2ef8a3);dials[_0xa54c('0x43')](_0x2ef8a3);}catch(_0x532995){utils['error'](util['format'](_0xa54c('0x42'),_0x2ef8a3[_0xa54c('0x1f')]),_0x532995);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4e8fd73..4f6b89d 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 _0x823b=['request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','format','[%s][members][devicestatechange]','device','info','state','INUSE','voice','TALKING','now','NOT_INUSE','isNil','diffTime','exitAt','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data2','source','destination','data1','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','./utils','Local/_attended@transfer','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','getUserByInterface','then','membername','name','internal'];(function(_0x26ebc3,_0x53c440){var _0x23d08b=function(_0x36d4a1){while(--_0x36d4a1){_0x26ebc3['push'](_0x26ebc3['shift']());}};_0x23d08b(++_0x53c440);}(_0x823b,0xed));var _0xb823=function(_0x47a539,_0x41d609){_0x47a539=_0x47a539-0x0;var _0x456304=_0x823b[_0x47a539];return _0x456304;};'use strict';var _=require(_0xb823('0x0'));var util=require('util');var utils=require(_0xb823('0x1'));var members={};var exclude=[_0xb823('0x2'),'Queue:'];function writeDB(_0x1a4937){utils['info'](util['format'](_0xb823('0x3'),_0x1a4937[_0xb823('0x4')],_0x1a4937[_0xb823('0x5')],_0x1a4937[_0xb823('0x6')],_0x1a4937['data2'],_0x1a4937['membername'],_0x1a4937[_0xb823('0x7')]));if(_0x1a4937[_0xb823('0x5')]){utils[_0xb823('0x8')](_0x1a4937[_0xb823('0x5')])[_0xb823('0x9')](function(_0xcee62a){if(_0xcee62a){_0x1a4937[_0xb823('0xa')]=_0xcee62a[_0xb823('0xb')];_0x1a4937[_0xb823('0xc')]=_0xcee62a[_0xb823('0xc')];utils[_0xb823('0xd')](_0xb823('0xe'),_0x1a4937);}else{utils[_0xb823('0xf')](_0x1a4937[_0xb823('0x5')][_0xb823('0x10')]('/')[0x1])[_0xb823('0x9')](function(_0xe62c94){if(_0xe62c94){_0x1a4937[_0xb823('0xa')]=_0xe62c94[_0xb823('0xb')];_0x1a4937[_0xb823('0xc')]=_0xe62c94[_0xb823('0xc')];utils[_0xb823('0xd')]('CreateMemberReport',_0x1a4937);}});}})[_0xb823('0x11')](function(_0x26ee46){utils[_0xb823('0x12')](util['format'](_0xb823('0x13'),_0x1a4937[_0xb823('0x4')]),_0x26ee46);});}delete members[_0x1a4937[_0xb823('0x5')]];}function startsWith(_0x37e9c7,_0x35e1c4){return _[_0xb823('0x14')](_0x37e9c7,function(_0x271e71){return _['startsWith'](_0x35e1c4,_0x271e71);});}exports['devicestatechange']=function(_0x11105e){try{utils['debug'](util[_0xb823('0x15')](_0xb823('0x16'),members[_0x11105e[_0xb823('0x17')]]?members[_0x11105e[_0xb823('0x17')]][_0xb823('0x4')]:_0x11105e[_0xb823('0x17')]),_0x11105e);utils[_0xb823('0x18')](util[_0xb823('0x15')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x11105e[_0xb823('0x17')]]?members[_0x11105e[_0xb823('0x17')]][_0xb823('0x4')]:_0x11105e[_0xb823('0x17')],_0x11105e['state'],_0x11105e[_0xb823('0x17')]));switch(_0x11105e[_0xb823('0x19')]){case _0xb823('0x1a'):case'BUSY':if(!startsWith(exclude,_0x11105e['device'])){members[_0x11105e[_0xb823('0x17')]]={'channel':_0xb823('0x1b'),'interface':_0x11105e[_0xb823('0x17')],'type':_0xb823('0x1c'),'enterAt':utils[_0xb823('0x1d')](),'role':'agent'};}break;case _0xb823('0x1e'):if(!_[_0xb823('0x1f')](members[_0x11105e[_0xb823('0x17')]])){members[_0x11105e[_0xb823('0x17')]]['exitAt']=utils[_0xb823('0x1d')]();members[_0x11105e[_0xb823('0x17')]]['duration']=utils[_0xb823('0x20')](members[_0x11105e[_0xb823('0x17')]][_0xb823('0x21')],members[_0x11105e[_0xb823('0x17')]][_0xb823('0x22')]);if(members[_0x11105e['device']]['uniqueid']){writeDB(members[_0x11105e[_0xb823('0x17')]]);}}break;default:break;}}catch(_0x2058c1){utils['error'](util['format'](_0xb823('0x16'),members[_0x11105e['device']]?members[_0x11105e[_0xb823('0x17')]][_0xb823('0x4')]:_0x11105e[_0xb823('0x17')]),_0x2058c1);}};exports[_0xb823('0x23')]=function(_0x6d3690){try{if(!_[_0xb823('0x1f')](members[_0x6d3690['interface']])){utils[_0xb823('0x24')](util[_0xb823('0x15')](_0xb823('0x25'),_0x6d3690['uniqueid']),_0x6d3690);utils['info'](util[_0xb823('0x15')](_0xb823('0x26'),_0x6d3690[_0xb823('0x4')],_0x6d3690[_0xb823('0x5')],_0x6d3690['queue']));members[_0x6d3690[_0xb823('0x5')]]=_[_0xb823('0x27')](members[_0x6d3690['interface']],{'data4':_0x6d3690[_0xb823('0x28')],'uniqueid':_0x6d3690[_0xb823('0x4')]});}}catch(_0x1488a4){utils[_0xb823('0x12')](util[_0xb823('0x15')](_0xb823('0x25'),_0x6d3690[_0xb823('0x4')]),_0x1488a4);}};exports[_0xb823('0x29')]=function(_0x562dae){try{utils[_0xb823('0x24')](util[_0xb823('0x15')](_0xb823('0x2a'),_0x562dae['uniqueid']),_0x562dae);if(_0x562dae[_0xb823('0x6')]){var _0x57cdec=_0x562dae['channel'][_0xb823('0x10')]('-')[0x0];if(!_[_0xb823('0x1f')](members[_0x57cdec])){members[_0x57cdec]=_[_0xb823('0x27')](members[_0x57cdec],{'data1':members[_0x57cdec]['data1']||_0x562dae[_0xb823('0x7')],'data2':members[_0x57cdec][_0xb823('0x2b')]||_0x562dae[_0xb823('0x2c')],'data3':members[_0x57cdec]['data3']||_0x562dae[_0xb823('0x2d')],'uniqueid':members[_0x57cdec][_0xb823('0x4')]||_0x562dae[_0xb823('0x4')]});utils[_0xb823('0x18')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x562dae[_0xb823('0x4')],members[_0x57cdec][_0xb823('0x2e')],members[_0x57cdec]['data2'],members[_0x57cdec][_0xb823('0x2f')]));if(members[_0x57cdec][_0xb823('0x21')]){writeDB(members[_0x57cdec]);}}}if(_0x562dae['destinationchannel']){var _0x1dca90=_0x562dae[_0xb823('0x30')]['split']('-')[0x0];if(!_[_0xb823('0x1f')](members[_0x1dca90])){members[_0x1dca90]=_[_0xb823('0x27')](members[_0x1dca90],{'data1':members[_0x1dca90][_0xb823('0x2e')]||_0x562dae[_0xb823('0x7')],'data2':members[_0x1dca90][_0xb823('0x2b')]||_0x562dae['source'],'data3':members[_0x1dca90][_0xb823('0x2f')]||_0x562dae[_0xb823('0x2d')],'uniqueid':members[_0x1dca90][_0xb823('0x4')]||_0x562dae[_0xb823('0x4')]});utils['info'](util[_0xb823('0x15')](_0xb823('0x31'),_0x562dae[_0xb823('0x4')],members[_0x1dca90][_0xb823('0x2e')],members[_0x1dca90][_0xb823('0x2b')],members[_0x1dca90][_0xb823('0x2f')]));if(members[_0x1dca90][_0xb823('0x21')]){writeDB(members[_0x1dca90]);}}}}catch(_0x464c97){utils[_0xb823('0x12')](util[_0xb823('0x15')](_0xb823('0x2a'),_0x562dae[_0xb823('0x4')]),_0x464c97);}}; \ No newline at end of file +var _0x0e01=['data1','destinationchannel','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','format','interface','data2','membername','then','name','internal','CreateMemberReport','split','request','error','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','[%s][members][cdr]','channel','source','destination'];(function(_0x4eb972,_0x348880){var _0x3ed699=function(_0xae952c){while(--_0xae952c){_0x4eb972['push'](_0x4eb972['shift']());}};_0x3ed699(++_0x348880);}(_0x0e01,0x1c6));var _0x10e0=function(_0x1cb13c,_0x58a1b5){_0x1cb13c=_0x1cb13c-0x0;var _0x230242=_0x0e01[_0x1cb13c];return _0x230242;};'use strict';var _=require(_0x10e0('0x0'));var util=require(_0x10e0('0x1'));var utils=require(_0x10e0('0x2'));var members={};var exclude=[_0x10e0('0x3'),_0x10e0('0x4')];function writeDB(_0x3b9eb8){utils['info'](util[_0x10e0('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x3b9eb8['uniqueid'],_0x3b9eb8[_0x10e0('0x6')],_0x3b9eb8['channel'],_0x3b9eb8[_0x10e0('0x7')],_0x3b9eb8[_0x10e0('0x8')],_0x3b9eb8['type']));if(_0x3b9eb8[_0x10e0('0x6')]){utils['getUserByInterface'](_0x3b9eb8['interface'])[_0x10e0('0x9')](function(_0x4e25e9){if(_0x4e25e9){_0x3b9eb8['membername']=_0x4e25e9[_0x10e0('0xa')];_0x3b9eb8[_0x10e0('0xb')]=_0x4e25e9[_0x10e0('0xb')];utils['request'](_0x10e0('0xc'),_0x3b9eb8);}else{utils['getUserByName'](_0x3b9eb8[_0x10e0('0x6')][_0x10e0('0xd')]('/')[0x1])['then'](function(_0x451f78){if(_0x451f78){_0x3b9eb8[_0x10e0('0x8')]=_0x451f78['name'];_0x3b9eb8['internal']=_0x451f78[_0x10e0('0xb')];utils[_0x10e0('0xe')](_0x10e0('0xc'),_0x3b9eb8);}});}})['catch'](function(_0x1dbdee){utils[_0x10e0('0xf')](util[_0x10e0('0x5')](_0x10e0('0x10'),_0x3b9eb8[_0x10e0('0x11')]),_0x1dbdee);});}delete members[_0x3b9eb8[_0x10e0('0x6')]];}function startsWith(_0x314697,_0x927ab6){return _[_0x10e0('0x12')](_0x314697,function(_0x386083){return _[_0x10e0('0x13')](_0x927ab6,_0x386083);});}exports[_0x10e0('0x14')]=function(_0x1471bb){try{utils[_0x10e0('0x15')](util[_0x10e0('0x5')](_0x10e0('0x16'),members[_0x1471bb[_0x10e0('0x17')]]?members[_0x1471bb[_0x10e0('0x17')]][_0x10e0('0x11')]:_0x1471bb['device']),_0x1471bb);utils['info'](util[_0x10e0('0x5')](_0x10e0('0x18'),members[_0x1471bb[_0x10e0('0x17')]]?members[_0x1471bb[_0x10e0('0x17')]][_0x10e0('0x11')]:_0x1471bb['device'],_0x1471bb[_0x10e0('0x19')],_0x1471bb['device']));switch(_0x1471bb['state']){case _0x10e0('0x1a'):case _0x10e0('0x1b'):if(!startsWith(exclude,_0x1471bb[_0x10e0('0x17')])){members[_0x1471bb['device']]={'channel':'voice','interface':_0x1471bb[_0x10e0('0x17')],'type':_0x10e0('0x1c'),'enterAt':utils[_0x10e0('0x1d')](),'role':_0x10e0('0x1e')};}break;case _0x10e0('0x1f'):if(!_[_0x10e0('0x20')](members[_0x1471bb['device']])){members[_0x1471bb['device']][_0x10e0('0x21')]=utils[_0x10e0('0x1d')]();members[_0x1471bb[_0x10e0('0x17')]][_0x10e0('0x22')]=utils[_0x10e0('0x23')](members[_0x1471bb[_0x10e0('0x17')]][_0x10e0('0x21')],members[_0x1471bb[_0x10e0('0x17')]][_0x10e0('0x24')]);if(members[_0x1471bb[_0x10e0('0x17')]][_0x10e0('0x11')]){writeDB(members[_0x1471bb[_0x10e0('0x17')]]);}}break;default:break;}}catch(_0x38b51d){utils[_0x10e0('0xf')](util[_0x10e0('0x5')]('[%s][members][devicestatechange]',members[_0x1471bb[_0x10e0('0x17')]]?members[_0x1471bb[_0x10e0('0x17')]][_0x10e0('0x11')]:_0x1471bb[_0x10e0('0x17')]),_0x38b51d);}};exports[_0x10e0('0x25')]=function(_0x2ec22e){try{if(!_[_0x10e0('0x20')](members[_0x2ec22e[_0x10e0('0x6')]])){utils[_0x10e0('0x15')](util[_0x10e0('0x5')](_0x10e0('0x26'),_0x2ec22e['uniqueid']),_0x2ec22e);utils[_0x10e0('0x27')](util['format'](_0x10e0('0x28'),_0x2ec22e['uniqueid'],_0x2ec22e[_0x10e0('0x6')],_0x2ec22e['queue']));members[_0x2ec22e['interface']]=_[_0x10e0('0x29')](members[_0x2ec22e[_0x10e0('0x6')]],{'data4':_0x2ec22e['queue'],'uniqueid':_0x2ec22e['uniqueid']});}}catch(_0x4c08d3){utils['error'](util[_0x10e0('0x5')](_0x10e0('0x26'),_0x2ec22e[_0x10e0('0x11')]),_0x4c08d3);}};exports['cdr']=function(_0x2136c9){try{utils[_0x10e0('0x15')](util['format'](_0x10e0('0x2a'),_0x2136c9[_0x10e0('0x11')]),_0x2136c9);if(_0x2136c9['channel']){var _0x4f08ab=_0x2136c9[_0x10e0('0x2b')][_0x10e0('0xd')]('-')[0x0];if(!_[_0x10e0('0x20')](members[_0x4f08ab])){members[_0x4f08ab]=_[_0x10e0('0x29')](members[_0x4f08ab],{'data1':members[_0x4f08ab]['data1']||_0x2136c9['type'],'data2':members[_0x4f08ab][_0x10e0('0x7')]||_0x2136c9[_0x10e0('0x2c')],'data3':members[_0x4f08ab]['data3']||_0x2136c9[_0x10e0('0x2d')],'uniqueid':members[_0x4f08ab][_0x10e0('0x11')]||_0x2136c9[_0x10e0('0x11')]});utils[_0x10e0('0x27')](util[_0x10e0('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2136c9[_0x10e0('0x11')],members[_0x4f08ab][_0x10e0('0x2e')],members[_0x4f08ab]['data2'],members[_0x4f08ab]['data3']));if(members[_0x4f08ab][_0x10e0('0x21')]){writeDB(members[_0x4f08ab]);}}}if(_0x2136c9['destinationchannel']){var _0x120802=_0x2136c9[_0x10e0('0x2f')][_0x10e0('0xd')]('-')[0x0];if(!_[_0x10e0('0x20')](members[_0x120802])){members[_0x120802]=_[_0x10e0('0x29')](members[_0x120802],{'data1':members[_0x120802][_0x10e0('0x2e')]||_0x2136c9['type'],'data2':members[_0x120802][_0x10e0('0x7')]||_0x2136c9['source'],'data3':members[_0x120802][_0x10e0('0x30')]||_0x2136c9[_0x10e0('0x2d')],'uniqueid':members[_0x120802]['uniqueid']||_0x2136c9[_0x10e0('0x11')]});utils[_0x10e0('0x27')](util[_0x10e0('0x5')](_0x10e0('0x31'),_0x2136c9[_0x10e0('0x11')],members[_0x120802][_0x10e0('0x2e')],members[_0x120802]['data2'],members[_0x120802][_0x10e0('0x30')]));if(members[_0x120802][_0x10e0('0x21')]){writeDB(members[_0x120802]);}}}}catch(_0x3a50d3){utils[_0x10e0('0xf')](util[_0x10e0('0x5')](_0x10e0('0x2a'),_0x2136c9[_0x10e0('0x11')]),_0x3a50d3);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 80a2177..aa9c02c 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 _0x0120=['[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%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','uniqueid','channel','queue','lastAssignedTo','calleridnum','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','assign','error','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','accountcode','destaccountcode','agentcomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone'];(function(_0x545f6b,_0x473084){var _0x5aafa1=function(_0x28a3ce){while(--_0x28a3ce){_0x545f6b['push'](_0x545f6b['shift']());}};_0x5aafa1(++_0x473084);}(_0x0120,0x6f));var _0x0012=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x0120[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var utils=require(_0x0012('0x2'));var queues={};function writeDB(_0xb8d57c){utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x5'),_0xb8d57c[_0x0012('0x6')],_0xb8d57c[_0x0012('0x7')],_0xb8d57c[_0x0012('0x8')],_0xb8d57c[_0x0012('0x9')],_0xb8d57c[_0x0012('0xa')],_0xb8d57c['accountcode'],_0xb8d57c['queuecallerexitreason']));if(_0xb8d57c['queue']){utils[_0x0012('0xb')](_0xb8d57c[_0x0012('0x8')])[_0x0012('0xc')](function(_0x30176d){if(_0x30176d){_0xb8d57c[_0x0012('0xd')]=_0x30176d['type'];}utils[_0x0012('0xe')](_0x0012('0xf'),_0xb8d57c);});}else{utils[_0x0012('0xe')](_0x0012('0xf'),_0xb8d57c);}if(_0xb8d57c['transfereduniqueid']){delete queues[_0xb8d57c[_0x0012('0x10')]];}else{delete queues[_0xb8d57c['uniqueid']];}}exports[_0x0012('0x11')]=function(_0x1d1c02){try{utils[_0x0012('0x12')](util[_0x0012('0x4')](_0x0012('0x13'),_0x1d1c02['uniqueid']),_0x1d1c02);utils[_0x0012('0x3')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x1d1c02['uniqueid'],_0x1d1c02['queue'],_0x1d1c02[_0x0012('0x14')]));queues[_0x1d1c02['uniqueid']]=_[_0x0012('0x15')](_0x1d1c02,{'originalposition':_0x1d1c02[_0x0012('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x24f4ed){utils[_0x0012('0x16')](util[_0x0012('0x4')](_0x0012('0x13'),_0x1d1c02['uniqueid']),_0x24f4ed);}};exports['hangup']=function(_0x1e7fbe){try{if(!_[_0x0012('0x17')](queues[_0x1e7fbe[_0x0012('0x6')]])){utils[_0x0012('0x12')](util[_0x0012('0x4')](_0x0012('0x18'),_0x1e7fbe[_0x0012('0x6')]),_0x1e7fbe);if(queues[_0x1e7fbe[_0x0012('0x6')]]['queuecallerleaveAt']){if(!queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x19')]&&!queues[_0x1e7fbe['uniqueid']][_0x0012('0x1a')]){queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x1b')]=!![];queues[_0x1e7fbe[_0x0012('0x6')]]['queuecallercompleteAt']=utils['now']();queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x1c')]=_0x0012('0x1d');}utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x1e'),_0x1e7fbe[_0x0012('0x6')],queues[_0x1e7fbe[_0x0012('0x6')]]['name'],queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x1c')]));writeDB(queues[_0x1e7fbe['uniqueid']]);}else if(queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x10')]){utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x1f'),_0x1e7fbe['uniqueid'],queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x20')],queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x10')]));queues[queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x10')]]=queues[_0x1e7fbe[_0x0012('0x6')]];queues[queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x10')]][_0x0012('0x21')]=0x2;delete queues[_0x1e7fbe[_0x0012('0x6')]];}}}catch(_0x20b78f){utils[_0x0012('0x16')](util[_0x0012('0x4')](_0x0012('0x18'),_0x1e7fbe[_0x0012('0x6')]),_0x20b78f);}};exports[_0x0012('0x22')]=function(_0x1f4a0a){try{utils[_0x0012('0x12')](util[_0x0012('0x4')](_0x0012('0x23'),_0x1f4a0a['uniqueid']),_0x1f4a0a);if(!_[_0x0012('0x17')](_0x1f4a0a[_0x0012('0x24')]['queuestatus'])&&_0x1f4a0a[_0x0012('0x25')][_0x0012('0x26')]()!==_0x0012('0x27')){if(!_[_0x0012('0x17')](queues[_0x1f4a0a[_0x0012('0x6')]])){queues[_0x1f4a0a['uniqueid']][_0x0012('0x19')]=![];queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x28')]=null;queues[_0x1f4a0a['uniqueid']][_0x0012('0x1a')]=!![];queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x29')]=utils[_0x0012('0x2a')]();queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x1c')]=_0x1f4a0a['value'][_0x0012('0x26')]();utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x2b'),_0x1f4a0a['uniqueid'],queues[_0x1f4a0a['uniqueid']][_0x0012('0x20')],_0x1f4a0a[_0x0012('0x25')],queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x1c')]));writeDB(queues[_0x1f4a0a[_0x0012('0x6')]]);}}else if(!_[_0x0012('0x17')](_0x1f4a0a[_0x0012('0x24')]['queueposition'])){if(!_[_0x0012('0x17')](queues[_0x1f4a0a[_0x0012('0x6')]])&&!queues[_0x1f4a0a['uniqueid']][_0x0012('0x19')]){queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x19')]=![];queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x28')]=null;queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x1a')]=!![];queues[_0x1f4a0a['uniqueid']][_0x0012('0x29')]=utils['now']();queues[_0x1f4a0a[_0x0012('0x6')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x2c'),_0x1f4a0a['uniqueid'],queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x20')],_0x1f4a0a[_0x0012('0x25')],queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x1c')]));}}}catch(_0x379780){utils[_0x0012('0x16')](util[_0x0012('0x4')]('[%s][queues][varset]',_0x1f4a0a[_0x0012('0x6')]),_0x379780);}};exports[_0x0012('0x19')]=function(_0x559751){try{if(!_[_0x0012('0x17')](queues[_0x559751[_0x0012('0x6')]])){utils[_0x0012('0x12')](util[_0x0012('0x4')]('[%s][queues][queuecallerabandon]',_0x559751['uniqueid']),_0x559751);queues[_0x559751[_0x0012('0x6')]]['queuecallerexit']=![];queues[_0x559751[_0x0012('0x6')]][_0x0012('0x29')]=null;queues[_0x559751[_0x0012('0x6')]][_0x0012('0x19')]=!![];queues[_0x559751[_0x0012('0x6')]]['queuecallerabandonAt']=utils[_0x0012('0x2a')]();queues[_0x559751[_0x0012('0x6')]]['queuecallerexitreason']=_0x0012('0x2d');utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x2e'),_0x559751['uniqueid'],queues[_0x559751['uniqueid']][_0x0012('0x20')],queues[_0x559751['uniqueid']][_0x0012('0x1c')]));}}catch(_0x56fac8){utils[_0x0012('0x16')](util[_0x0012('0x4')](_0x0012('0x2f'),_0x559751[_0x0012('0x6')]),_0x56fac8);}};exports['queuecallerleave']=function(_0x1de7d5){try{if(!_['isNil'](queues[_0x1de7d5[_0x0012('0x6')]])){utils[_0x0012('0x12')](util[_0x0012('0x4')](_0x0012('0x30'),_0x1de7d5[_0x0012('0x6')]),_0x1de7d5);utils[_0x0012('0x3')](util[_0x0012('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1de7d5[_0x0012('0x6')],queues[_0x1de7d5[_0x0012('0x6')]][_0x0012('0x20')],_0x1de7d5[_0x0012('0x31')],_0x1de7d5[_0x0012('0x32')]));queues[_0x1de7d5[_0x0012('0x6')]]['queuecallerleave']=!![];queues[_0x1de7d5['uniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x1de7d5[_0x0012('0x6')]][_0x0012('0x33')]=utils[_0x0012('0x34')](queues[_0x1de7d5[_0x0012('0x6')]][_0x0012('0x35')],queues[_0x1de7d5['uniqueid']][_0x0012('0x36')]);queues[_0x1de7d5[_0x0012('0x6')]][_0x0012('0x14')]=_0x1de7d5[_0x0012('0x14')];queues[_0x1de7d5[_0x0012('0x6')]][_0x0012('0x37')]=_0x1de7d5[_0x0012('0x37')];queues[_0x1de7d5[_0x0012('0x6')]][_0x0012('0x31')]=_0x1de7d5[_0x0012('0x31')];queues[_0x1de7d5[_0x0012('0x6')]]['connectedlinename']=_0x1de7d5[_0x0012('0x32')];}}catch(_0x12cb8f){utils[_0x0012('0x16')](util['format'](_0x0012('0x30'),_0x1de7d5[_0x0012('0x6')]),_0x12cb8f);}};exports[_0x0012('0x38')]=function(_0x3e803b){try{if(!_[_0x0012('0x17')](queues[_0x3e803b['uniqueid']])){utils[_0x0012('0x12')](util['format'](_0x0012('0x39'),_0x3e803b[_0x0012('0x6')]),_0x3e803b);utils['info'](util[_0x0012('0x4')](_0x0012('0x3a'),_0x3e803b[_0x0012('0x6')],queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x20')],_0x3e803b[_0x0012('0x3b')],_0x3e803b['destaccountcode']));queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x19')]=![];queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x19')]=![];queues[_0x3e803b['uniqueid']][_0x0012('0x28')]=null;queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x1a')]=![];queues[_0x3e803b['uniqueid']][_0x0012('0x1c')]=null;queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x29')]=null;queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x3c')]=!![];queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x3d')]=_0x3e803b[_0x0012('0x3e')];queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x9')]=_0x3e803b[_0x0012('0x3b')];}}catch(_0x5651e8){utils['error'](util[_0x0012('0x4')](_0x0012('0x39'),_0x3e803b[_0x0012('0x6')]),_0x5651e8);}};exports[_0x0012('0x3f')]=function(_0x5b5a02){try{if(!_[_0x0012('0x17')](queues[_0x5b5a02[_0x0012('0x6')]])){if(queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x35')]){utils[_0x0012('0x12')](util[_0x0012('0x4')]('[%s][queues][agentcomplete]',_0x5b5a02[_0x0012('0x6')]),_0x5b5a02);queues[_0x5b5a02['uniqueid']][_0x0012('0x19')]=![];queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x19')]=![];queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x28')]=null;queues[_0x5b5a02['uniqueid']][_0x0012('0x1a')]=![];queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x29')]=null;queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x3c')]=!![];queues[_0x5b5a02[_0x0012('0x6')]]['lastAssignedTo']=_0x5b5a02['membername'];queues[_0x5b5a02['uniqueid']][_0x0012('0x1b')]=!![];queues[_0x5b5a02[_0x0012('0x6')]]['queuecallercompleteAt']=utils['now']();if(_0x5b5a02['reason']==_0x0012('0x40')){if(!queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x40')]){queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x1c')]=_0x0012('0x41');}}else{queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x1c')]=_0x0012('0x42')+_0x5b5a02[_0x0012('0x43')]['toUpperCase']();}utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x44'),_0x5b5a02['uniqueid'],queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x20')],_0x5b5a02[_0x0012('0x3b')],queues[_0x5b5a02[_0x0012('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x5b5a02[_0x0012('0x6')]]);}}}catch(_0x1661c2){utils[_0x0012('0x16')](util[_0x0012('0x4')]('[%s][queues][agentcomplete]',_0x5b5a02[_0x0012('0x6')]),_0x1661c2);}};exports[_0x0012('0x45')]=function(_0x2c93e8){try{if(!_[_0x0012('0x17')](queues[_0x2c93e8[_0x0012('0x46')]])){utils[_0x0012('0x12')](util[_0x0012('0x4')]('[%s][queues][blindtransfer]',_0x2c93e8['uniqueid']),_0x2c93e8);queues[_0x2c93e8[_0x0012('0x46')]][_0x0012('0x40')]=!![];queues[_0x2c93e8[_0x0012('0x46')]][_0x0012('0x47')]=_0x0012('0x48');queues[_0x2c93e8[_0x0012('0x46')]][_0x0012('0x49')]=_0x2c93e8[_0x0012('0x4a')];queues[_0x2c93e8['transfereeuniqueid']][_0x0012('0x4b')]=_0x2c93e8[_0x0012('0x46')];queues[_0x2c93e8[_0x0012('0x46')]][_0x0012('0x1c')]=_0x0012('0x4c');utils[_0x0012('0x3')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x2c93e8['uniqueid'],queues[_0x2c93e8['transfereeuniqueid']]['name'],_0x2c93e8['transfereeuniqueid'],_0x2c93e8[_0x0012('0x4a')]));}}catch(_0x140bd5){utils['error'](util[_0x0012('0x4')](_0x0012('0x4d'),_0x2c93e8[_0x0012('0x6')]),_0x140bd5);}};exports[_0x0012('0x4e')]=function(_0xd350bc){try{utils['debug'](util[_0x0012('0x4')](_0x0012('0x4f'),_0xd350bc[_0x0012('0x50')]),_0xd350bc);if(_0xd350bc[_0x0012('0x50')]==_0xd350bc[_0x0012('0x51')]){if(!_[_0x0012('0x17')](queues[_0xd350bc['secondtransfererlinkedid']])){utils['info'](util[_0x0012('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xd350bc[_0x0012('0x50')],queues[_0xd350bc[_0x0012('0x52')]][_0x0012('0x20')],_0xd350bc[_0x0012('0x53')]));queues[_0xd350bc['secondtransfererlinkedid']]['transfer']=!![];queues[_0xd350bc[_0x0012('0x52')]][_0x0012('0x47')]=_0x0012('0x54');queues[_0xd350bc['secondtransfererlinkedid']][_0x0012('0x49')]=_0xd350bc['origtransfererexten'];queues[_0xd350bc['secondtransfererlinkedid']]['transferuniqueid']=_0xd350bc[_0x0012('0x50')];queues[_0xd350bc[_0x0012('0x52')]]['queuecallerexitreason']=_0x0012('0x55');}if(!_[_0x0012('0x17')](queues[_0xd350bc['origtransfererlinkedid']])){if(_0xd350bc['transfereelinkedid']&&queues[_0xd350bc[_0x0012('0x56')]]){queues[_0xd350bc['transfereelinkedid']][_0x0012('0x21')]=0x1;queues[_0xd350bc[_0x0012('0x46')]]=_['clone'](queues[_0xd350bc['transfereelinkedid']]);queues[_0xd350bc[_0x0012('0x46')]][_0x0012('0x10')]=_0xd350bc[_0x0012('0x57')];queues[_0xd350bc[_0x0012('0x46')]]['queuecallerenterreason']=0x2;queues[_0xd350bc['transfereeuniqueid']][_0x0012('0xa')]=queues[_0xd350bc['secondtransfererlinkedid']][_0x0012('0xa')];queues[_0xd350bc[_0x0012('0x46')]]['calleridname']=queues[_0xd350bc[_0x0012('0x52')]][_0x0012('0x58')];queues[_0xd350bc[_0x0012('0x46')]][_0x0012('0x36')]=utils[_0x0012('0x2a')]();queues[_0xd350bc[_0x0012('0x46')]][_0x0012('0x35')]=utils[_0x0012('0x2a')]();queues[_0xd350bc[_0x0012('0x46')]][_0x0012('0x33')]=0x0;queues[_0xd350bc['transfereeuniqueid']][_0x0012('0x59')]=0x0;utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0xd350bc['origtransfereruniqueid'],queues[_0xd350bc['transfereeuniqueid']][_0x0012('0x20')],queues[_0xd350bc['transfereeuniqueid']][_0x0012('0xa')],queues[_0xd350bc[_0x0012('0x46')]][_0x0012('0x58')]));}else{utils['info'](util[_0x0012('0x4')](_0x0012('0x5a'),_0xd350bc[_0x0012('0x50')],queues[_0xd350bc[_0x0012('0x51')]][_0x0012('0x20')],_0xd350bc[_0x0012('0x52')]));queues[_0xd350bc[_0x0012('0x51')]]['transfereduniqueid']=_0xd350bc[_0x0012('0x52')];}}}else if(_0xd350bc['secondtransfereruniqueid']==_0xd350bc['secondtransfererlinkedid']){if(!_[_0x0012('0x17')](queues[_0xd350bc[_0x0012('0x51')]])){utils['info'](util[_0x0012('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xd350bc[_0x0012('0x50')],queues[_0xd350bc[_0x0012('0x51')]][_0x0012('0x20')],_0xd350bc[_0x0012('0x5b')],_0xd350bc['secondtransfererexten']));queues[_0xd350bc[_0x0012('0x51')]][_0x0012('0x40')]=!![];queues[_0xd350bc[_0x0012('0x51')]][_0x0012('0x47')]=_0x0012('0x54');queues[_0xd350bc['origtransfererlinkedid']][_0x0012('0x49')]=_0xd350bc[_0x0012('0x5c')];queues[_0xd350bc[_0x0012('0x51')]][_0x0012('0x4b')]=_0xd350bc[_0x0012('0x5b')];queues[_0xd350bc['origtransfererlinkedid']][_0x0012('0x1c')]='ATTENDEDTRANSFER';}if(!_[_0x0012('0x17')](queues[_0xd350bc[_0x0012('0x52')]])){if(_0xd350bc['transfertargetlinkedid']&&queues[_0xd350bc[_0x0012('0x5d')]]){queues[_0xd350bc[_0x0012('0x5d')]]['queuecallerenterreason']=0x1;queues[_0xd350bc[_0x0012('0x57')]]=_[_0x0012('0x5e')](queues[_0xd350bc[_0x0012('0x5d')]]);queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0x10')]=_0xd350bc[_0x0012('0x57')];queues[_0xd350bc[_0x0012('0x57')]]['queuecallerenterreason']=0x2;queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0xa')]=queues[_0xd350bc[_0x0012('0x51')]][_0x0012('0xa')];queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0x58')]=queues[_0xd350bc[_0x0012('0x51')]]['calleridname'];queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0x36')]=utils[_0x0012('0x2a')]();queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0x35')]=utils[_0x0012('0x2a')]();queues[_0xd350bc[_0x0012('0x57')]]['holdtime']=0x0;queues[_0xd350bc[_0x0012('0x57')]]['mohtime']=0x0;utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x5f'),_0xd350bc[_0x0012('0x50')],queues[_0xd350bc['transfertargetuniqueid']][_0x0012('0x20')],queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0x10')],queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0xa')],queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0x58')]));}else{utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x5a'),_0xd350bc[_0x0012('0x50')],queues[_0xd350bc[_0x0012('0x52')]]['name'],_0xd350bc['origtransfererlinkedid']));queues[_0xd350bc['secondtransfererlinkedid']][_0x0012('0x10')]=_0xd350bc[_0x0012('0x51')];}}}}catch(_0x5b451d){utils[_0x0012('0x16')](util['format'](_0x0012('0x4f'),_0xd350bc['origtransfereruniqueid']),_0x5b451d);}};exports[_0x0012('0x60')]=function(_0x538eaa){try{if(!_['isNil'](queues[_0x538eaa['uniqueid']])){utils[_0x0012('0x12')](util[_0x0012('0x4')]('[%s][queues][musiconholdstart]',_0x538eaa[_0x0012('0x6')]),_0x538eaa);queues[_0x538eaa[_0x0012('0x6')]][_0x0012('0x61')]=utils['now']();utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x62'),_0x538eaa['uniqueid'],queues[_0x538eaa[_0x0012('0x6')]][_0x0012('0x20')],queues[_0x538eaa[_0x0012('0x6')]][_0x0012('0x61')]));}}catch(_0x4dfb27){utils[_0x0012('0x16')](util['format'](_0x0012('0x63'),_0x538eaa['uniqueid']),_0x4dfb27);}};exports[_0x0012('0x64')]=function(_0x1b57d8){try{if(!_[_0x0012('0x17')](queues[_0x1b57d8[_0x0012('0x6')]])){if(!_['isNil'](queues[_0x1b57d8[_0x0012('0x6')]][_0x0012('0x61')])){utils['debug'](util[_0x0012('0x4')](_0x0012('0x65'),_0x1b57d8[_0x0012('0x6')]),_0x1b57d8);queues[_0x1b57d8[_0x0012('0x6')]][_0x0012('0x59')]+=utils[_0x0012('0x34')](utils['now'](),queues[_0x1b57d8['uniqueid']]['musiconholdstartAt']);utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x66'),_0x1b57d8[_0x0012('0x6')],queues[_0x1b57d8[_0x0012('0x6')]][_0x0012('0x20')],queues[_0x1b57d8[_0x0012('0x6')]][_0x0012('0x59')]));delete queues[_0x1b57d8[_0x0012('0x6')]][_0x0012('0x61')];}}}catch(_0x3f5aac){utils[_0x0012('0x16')](util[_0x0012('0x4')](_0x0012('0x65'),_0x1b57d8[_0x0012('0x6')]),_0x3f5aac);}}; \ No newline at end of file +var _0x6d11=['[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][hangup]','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','isNil','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','[%s][queues][agentconnect]','agentcomplete','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','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','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x6d11,0xbf));var _0x16d1=function(_0x331f92,_0x5e941b){_0x331f92=_0x331f92-0x0;var _0x26cb17=_0x6d11[_0x331f92];return _0x26cb17;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var utils=require(_0x16d1('0x2'));var queues={};function writeDB(_0x49dea5){utils[_0x16d1('0x3')](util['format'](_0x16d1('0x4'),_0x49dea5[_0x16d1('0x5')],_0x49dea5['channel'],_0x49dea5['queue'],_0x49dea5[_0x16d1('0x6')],_0x49dea5[_0x16d1('0x7')],_0x49dea5[_0x16d1('0x8')],_0x49dea5[_0x16d1('0x9')]));if(_0x49dea5[_0x16d1('0xa')]){utils[_0x16d1('0xb')](_0x49dea5[_0x16d1('0xa')])['then'](function(_0x58a7a2){if(_0x58a7a2){_0x49dea5['type']=_0x58a7a2[_0x16d1('0xc')];}utils[_0x16d1('0xd')](_0x16d1('0xe'),_0x49dea5);});}else{utils[_0x16d1('0xd')]('CreateVoiceQueueReport',_0x49dea5);}if(_0x49dea5[_0x16d1('0xf')]){delete queues[_0x49dea5[_0x16d1('0xf')]];}else{delete queues[_0x49dea5[_0x16d1('0x5')]];}}exports[_0x16d1('0x10')]=function(_0x28188f){try{utils[_0x16d1('0x11')](util[_0x16d1('0x12')](_0x16d1('0x13'),_0x28188f['uniqueid']),_0x28188f);utils[_0x16d1('0x3')](util[_0x16d1('0x12')](_0x16d1('0x14'),_0x28188f[_0x16d1('0x5')],_0x28188f[_0x16d1('0xa')],_0x28188f['position']));queues[_0x28188f[_0x16d1('0x5')]]=_[_0x16d1('0x15')](_0x28188f,{'originalposition':_0x28188f[_0x16d1('0x16')],'queuecallerjoinAt':utils[_0x16d1('0x17')](),'mohtime':0x0});}catch(_0x29ebba){utils[_0x16d1('0x18')](util[_0x16d1('0x12')]('[%s][queues][queuecallerjoin]',_0x28188f[_0x16d1('0x5')]),_0x29ebba);}};exports[_0x16d1('0x19')]=function(_0x555b2d){try{if(!_['isNil'](queues[_0x555b2d[_0x16d1('0x5')]])){utils['debug'](util[_0x16d1('0x12')]('[%s][queues][hangup]',_0x555b2d[_0x16d1('0x5')]),_0x555b2d);if(queues[_0x555b2d['uniqueid']][_0x16d1('0x1a')]){if(!queues[_0x555b2d[_0x16d1('0x5')]]['queuecallerabandon']&&!queues[_0x555b2d['uniqueid']]['queuecallerexit']){queues[_0x555b2d['uniqueid']][_0x16d1('0x1b')]=!![];queues[_0x555b2d['uniqueid']][_0x16d1('0x1c')]=utils[_0x16d1('0x17')]();queues[_0x555b2d[_0x16d1('0x5')]][_0x16d1('0x9')]='COMPLETEDBYAGENT';}utils[_0x16d1('0x3')](util[_0x16d1('0x12')](_0x16d1('0x1d'),_0x555b2d['uniqueid'],queues[_0x555b2d[_0x16d1('0x5')]][_0x16d1('0x1e')],queues[_0x555b2d[_0x16d1('0x5')]][_0x16d1('0x9')]));writeDB(queues[_0x555b2d[_0x16d1('0x5')]]);}else if(queues[_0x555b2d[_0x16d1('0x5')]][_0x16d1('0xf')]){utils[_0x16d1('0x3')](util[_0x16d1('0x12')](_0x16d1('0x1f'),_0x555b2d[_0x16d1('0x5')],queues[_0x555b2d[_0x16d1('0x5')]][_0x16d1('0x1e')],queues[_0x555b2d[_0x16d1('0x5')]][_0x16d1('0xf')]));queues[queues[_0x555b2d[_0x16d1('0x5')]]['transfereduniqueid']]=queues[_0x555b2d[_0x16d1('0x5')]];queues[queues[_0x555b2d[_0x16d1('0x5')]][_0x16d1('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x555b2d[_0x16d1('0x5')]];}}}catch(_0x1deb1e){utils[_0x16d1('0x18')](util[_0x16d1('0x12')](_0x16d1('0x20'),_0x555b2d[_0x16d1('0x5')]),_0x1deb1e);}};exports[_0x16d1('0x21')]=function(_0x562908){try{utils[_0x16d1('0x11')](util[_0x16d1('0x12')](_0x16d1('0x22'),_0x562908[_0x16d1('0x5')]),_0x562908);if(!_['isNil'](_0x562908['variable'][_0x16d1('0x23')])&&_0x562908[_0x16d1('0x24')][_0x16d1('0x25')]()!==_0x16d1('0x26')){if(!_[_0x16d1('0x27')](queues[_0x562908[_0x16d1('0x5')]])){queues[_0x562908[_0x16d1('0x5')]][_0x16d1('0x28')]=![];queues[_0x562908[_0x16d1('0x5')]][_0x16d1('0x29')]=null;queues[_0x562908[_0x16d1('0x5')]][_0x16d1('0x2a')]=!![];queues[_0x562908[_0x16d1('0x5')]][_0x16d1('0x2b')]=utils['now']();queues[_0x562908[_0x16d1('0x5')]]['queuecallerexitreason']=_0x562908[_0x16d1('0x24')][_0x16d1('0x25')]();utils[_0x16d1('0x3')](util[_0x16d1('0x12')](_0x16d1('0x2c'),_0x562908[_0x16d1('0x5')],queues[_0x562908['uniqueid']]['name'],_0x562908['value'],queues[_0x562908[_0x16d1('0x5')]][_0x16d1('0x9')]));writeDB(queues[_0x562908[_0x16d1('0x5')]]);}}else if(!_[_0x16d1('0x27')](_0x562908['variable'][_0x16d1('0x2d')])){if(!_[_0x16d1('0x27')](queues[_0x562908['uniqueid']])&&!queues[_0x562908['uniqueid']]['queuecallerabandon']){queues[_0x562908[_0x16d1('0x5')]][_0x16d1('0x28')]=![];queues[_0x562908[_0x16d1('0x5')]]['queuecallerabandonAt']=null;queues[_0x562908[_0x16d1('0x5')]][_0x16d1('0x2a')]=!![];queues[_0x562908[_0x16d1('0x5')]][_0x16d1('0x2b')]=utils[_0x16d1('0x17')]();queues[_0x562908[_0x16d1('0x5')]][_0x16d1('0x9')]='EXITWITHKEY';utils['info'](util['format'](_0x16d1('0x2e'),_0x562908[_0x16d1('0x5')],queues[_0x562908[_0x16d1('0x5')]][_0x16d1('0x1e')],_0x562908[_0x16d1('0x24')],queues[_0x562908[_0x16d1('0x5')]][_0x16d1('0x9')]));}}}catch(_0x369b1c){utils['error'](util[_0x16d1('0x12')]('[%s][queues][varset]',_0x562908['uniqueid']),_0x369b1c);}};exports[_0x16d1('0x28')]=function(_0x2bec8f){try{if(!_[_0x16d1('0x27')](queues[_0x2bec8f[_0x16d1('0x5')]])){utils[_0x16d1('0x11')](util[_0x16d1('0x12')]('[%s][queues][queuecallerabandon]',_0x2bec8f[_0x16d1('0x5')]),_0x2bec8f);queues[_0x2bec8f['uniqueid']]['queuecallerexit']=![];queues[_0x2bec8f['uniqueid']]['queuecallerexitAt']=null;queues[_0x2bec8f[_0x16d1('0x5')]][_0x16d1('0x28')]=!![];queues[_0x2bec8f[_0x16d1('0x5')]][_0x16d1('0x29')]=utils['now']();queues[_0x2bec8f[_0x16d1('0x5')]]['queuecallerexitreason']=_0x16d1('0x2f');utils[_0x16d1('0x3')](util[_0x16d1('0x12')](_0x16d1('0x30'),_0x2bec8f[_0x16d1('0x5')],queues[_0x2bec8f[_0x16d1('0x5')]][_0x16d1('0x1e')],queues[_0x2bec8f[_0x16d1('0x5')]][_0x16d1('0x9')]));}}catch(_0x2d9455){utils[_0x16d1('0x18')](util[_0x16d1('0x12')](_0x16d1('0x31'),_0x2bec8f[_0x16d1('0x5')]),_0x2d9455);}};exports[_0x16d1('0x32')]=function(_0x583747){try{if(!_['isNil'](queues[_0x583747[_0x16d1('0x5')]])){utils[_0x16d1('0x11')](util[_0x16d1('0x12')](_0x16d1('0x33'),_0x583747[_0x16d1('0x5')]),_0x583747);utils[_0x16d1('0x3')](util['format'](_0x16d1('0x34'),_0x583747[_0x16d1('0x5')],queues[_0x583747[_0x16d1('0x5')]]['name'],_0x583747['connectedlinenum'],_0x583747[_0x16d1('0x35')]));queues[_0x583747[_0x16d1('0x5')]]['queuecallerleave']=!![];queues[_0x583747[_0x16d1('0x5')]]['queuecallerleaveAt']=utils[_0x16d1('0x17')]();queues[_0x583747[_0x16d1('0x5')]][_0x16d1('0x36')]=utils[_0x16d1('0x37')](queues[_0x583747['uniqueid']]['queuecallerleaveAt'],queues[_0x583747[_0x16d1('0x5')]][_0x16d1('0x38')]);queues[_0x583747['uniqueid']][_0x16d1('0x16')]=_0x583747[_0x16d1('0x16')];queues[_0x583747[_0x16d1('0x5')]][_0x16d1('0x39')]=_0x583747[_0x16d1('0x39')];queues[_0x583747['uniqueid']][_0x16d1('0x3a')]=_0x583747['connectedlinenum'];queues[_0x583747[_0x16d1('0x5')]][_0x16d1('0x35')]=_0x583747['connectedlinename'];}}catch(_0x413acd){utils[_0x16d1('0x18')](util[_0x16d1('0x12')](_0x16d1('0x33'),_0x583747['uniqueid']),_0x413acd);}};exports['agentconnect']=function(_0x5b1614){try{if(!_[_0x16d1('0x27')](queues[_0x5b1614[_0x16d1('0x5')]])){utils[_0x16d1('0x11')](util[_0x16d1('0x12')]('[%s][queues][agentconnect]',_0x5b1614[_0x16d1('0x5')]),_0x5b1614);utils[_0x16d1('0x3')](util['format'](_0x16d1('0x3b'),_0x5b1614[_0x16d1('0x5')],queues[_0x5b1614[_0x16d1('0x5')]][_0x16d1('0x1e')],_0x5b1614['membername'],_0x5b1614[_0x16d1('0x3c')]));queues[_0x5b1614[_0x16d1('0x5')]][_0x16d1('0x28')]=![];queues[_0x5b1614['uniqueid']]['queuecallerabandon']=![];queues[_0x5b1614[_0x16d1('0x5')]][_0x16d1('0x29')]=null;queues[_0x5b1614['uniqueid']][_0x16d1('0x2a')]=![];queues[_0x5b1614[_0x16d1('0x5')]][_0x16d1('0x9')]=null;queues[_0x5b1614['uniqueid']][_0x16d1('0x2b')]=null;queues[_0x5b1614[_0x16d1('0x5')]][_0x16d1('0x3d')]=!![];queues[_0x5b1614[_0x16d1('0x5')]][_0x16d1('0x8')]=_0x5b1614[_0x16d1('0x3c')];queues[_0x5b1614['uniqueid']][_0x16d1('0x6')]=_0x5b1614[_0x16d1('0x3e')];}}catch(_0x5e9703){utils[_0x16d1('0x18')](util[_0x16d1('0x12')](_0x16d1('0x3f'),_0x5b1614[_0x16d1('0x5')]),_0x5e9703);}};exports[_0x16d1('0x40')]=function(_0x2d95b5){try{if(!_[_0x16d1('0x27')](queues[_0x2d95b5[_0x16d1('0x5')]])){if(queues[_0x2d95b5['uniqueid']][_0x16d1('0x1a')]){utils['debug'](util[_0x16d1('0x12')]('[%s][queues][agentcomplete]',_0x2d95b5['uniqueid']),_0x2d95b5);queues[_0x2d95b5[_0x16d1('0x5')]]['queuecallerabandon']=![];queues[_0x2d95b5['uniqueid']][_0x16d1('0x28')]=![];queues[_0x2d95b5['uniqueid']][_0x16d1('0x29')]=null;queues[_0x2d95b5[_0x16d1('0x5')]][_0x16d1('0x2a')]=![];queues[_0x2d95b5[_0x16d1('0x5')]][_0x16d1('0x2b')]=null;queues[_0x2d95b5['uniqueid']][_0x16d1('0x3d')]=!![];queues[_0x2d95b5['uniqueid']][_0x16d1('0x6')]=_0x2d95b5[_0x16d1('0x3e')];queues[_0x2d95b5[_0x16d1('0x5')]][_0x16d1('0x1b')]=!![];queues[_0x2d95b5[_0x16d1('0x5')]][_0x16d1('0x1c')]=utils[_0x16d1('0x17')]();if(_0x2d95b5['reason']==_0x16d1('0x41')){if(!queues[_0x2d95b5['uniqueid']][_0x16d1('0x41')]){queues[_0x2d95b5[_0x16d1('0x5')]][_0x16d1('0x9')]=_0x16d1('0x42');}}else{queues[_0x2d95b5['uniqueid']][_0x16d1('0x9')]=_0x16d1('0x43')+_0x2d95b5['reason']['toUpperCase']();}utils[_0x16d1('0x3')](util[_0x16d1('0x12')](_0x16d1('0x44'),_0x2d95b5[_0x16d1('0x5')],queues[_0x2d95b5[_0x16d1('0x5')]]['name'],_0x2d95b5[_0x16d1('0x3e')],queues[_0x2d95b5[_0x16d1('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x2d95b5[_0x16d1('0x5')]]);}}}catch(_0x48f653){utils[_0x16d1('0x18')](util[_0x16d1('0x12')]('[%s][queues][agentcomplete]',_0x2d95b5[_0x16d1('0x5')]),_0x48f653);}};exports[_0x16d1('0x45')]=function(_0x3377a1){try{if(!_[_0x16d1('0x27')](queues[_0x3377a1[_0x16d1('0x46')]])){utils[_0x16d1('0x11')](util[_0x16d1('0x12')](_0x16d1('0x47'),_0x3377a1[_0x16d1('0x5')]),_0x3377a1);queues[_0x3377a1[_0x16d1('0x46')]][_0x16d1('0x41')]=!![];queues[_0x3377a1['transfereeuniqueid']][_0x16d1('0x48')]=_0x16d1('0x49');queues[_0x3377a1[_0x16d1('0x46')]][_0x16d1('0x4a')]=_0x3377a1[_0x16d1('0x4b')];queues[_0x3377a1['transfereeuniqueid']][_0x16d1('0x4c')]=_0x3377a1[_0x16d1('0x46')];queues[_0x3377a1[_0x16d1('0x46')]][_0x16d1('0x9')]=_0x16d1('0x4d');utils[_0x16d1('0x3')](util['format'](_0x16d1('0x4e'),_0x3377a1[_0x16d1('0x5')],queues[_0x3377a1[_0x16d1('0x46')]]['name'],_0x3377a1['transfereeuniqueid'],_0x3377a1[_0x16d1('0x4b')]));}}catch(_0x99e4e7){utils[_0x16d1('0x18')](util['format']('[%s][queues][blindtransfer]',_0x3377a1[_0x16d1('0x5')]),_0x99e4e7);}};exports[_0x16d1('0x4f')]=function(_0x5bcfce){try{utils[_0x16d1('0x11')](util[_0x16d1('0x12')](_0x16d1('0x50'),_0x5bcfce[_0x16d1('0x51')]),_0x5bcfce);if(_0x5bcfce[_0x16d1('0x51')]==_0x5bcfce[_0x16d1('0x52')]){if(!_[_0x16d1('0x27')](queues[_0x5bcfce[_0x16d1('0x53')]])){utils[_0x16d1('0x3')](util['format'](_0x16d1('0x54'),_0x5bcfce[_0x16d1('0x51')],queues[_0x5bcfce[_0x16d1('0x53')]][_0x16d1('0x1e')],_0x5bcfce[_0x16d1('0x55')]));queues[_0x5bcfce[_0x16d1('0x53')]][_0x16d1('0x41')]=!![];queues[_0x5bcfce[_0x16d1('0x53')]][_0x16d1('0x48')]=_0x16d1('0x56');queues[_0x5bcfce[_0x16d1('0x53')]][_0x16d1('0x4a')]=_0x5bcfce['origtransfererexten'];queues[_0x5bcfce[_0x16d1('0x53')]][_0x16d1('0x4c')]=_0x5bcfce[_0x16d1('0x51')];queues[_0x5bcfce['secondtransfererlinkedid']]['queuecallerexitreason']=_0x16d1('0x57');}if(!_['isNil'](queues[_0x5bcfce[_0x16d1('0x52')]])){if(_0x5bcfce[_0x16d1('0x58')]&&queues[_0x5bcfce[_0x16d1('0x58')]]){queues[_0x5bcfce['transfereelinkedid']][_0x16d1('0x59')]=0x1;queues[_0x5bcfce['transfereeuniqueid']]=_['clone'](queues[_0x5bcfce[_0x16d1('0x58')]]);queues[_0x5bcfce[_0x16d1('0x46')]][_0x16d1('0xf')]=_0x5bcfce[_0x16d1('0x5a')];queues[_0x5bcfce['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x5bcfce['transfereeuniqueid']][_0x16d1('0x7')]=queues[_0x5bcfce['secondtransfererlinkedid']][_0x16d1('0x7')];queues[_0x5bcfce['transfereeuniqueid']][_0x16d1('0x5b')]=queues[_0x5bcfce['secondtransfererlinkedid']]['calleridname'];queues[_0x5bcfce[_0x16d1('0x46')]][_0x16d1('0x38')]=utils[_0x16d1('0x17')]();queues[_0x5bcfce[_0x16d1('0x46')]][_0x16d1('0x1a')]=utils[_0x16d1('0x17')]();queues[_0x5bcfce['transfereeuniqueid']][_0x16d1('0x36')]=0x0;queues[_0x5bcfce[_0x16d1('0x46')]][_0x16d1('0x5c')]=0x0;utils[_0x16d1('0x3')](util['format'](_0x16d1('0x5d'),_0x5bcfce[_0x16d1('0x51')],queues[_0x5bcfce['transfereeuniqueid']][_0x16d1('0x1e')],queues[_0x5bcfce[_0x16d1('0x46')]][_0x16d1('0x7')],queues[_0x5bcfce['transfereeuniqueid']][_0x16d1('0x5b')]));}else{utils[_0x16d1('0x3')](util[_0x16d1('0x12')](_0x16d1('0x5e'),_0x5bcfce[_0x16d1('0x51')],queues[_0x5bcfce[_0x16d1('0x52')]][_0x16d1('0x1e')],_0x5bcfce[_0x16d1('0x53')]));queues[_0x5bcfce[_0x16d1('0x52')]]['transfereduniqueid']=_0x5bcfce[_0x16d1('0x53')];}}}else if(_0x5bcfce['secondtransfereruniqueid']==_0x5bcfce[_0x16d1('0x53')]){if(!_[_0x16d1('0x27')](queues[_0x5bcfce[_0x16d1('0x52')]])){utils[_0x16d1('0x3')](util[_0x16d1('0x12')](_0x16d1('0x5f'),_0x5bcfce[_0x16d1('0x51')],queues[_0x5bcfce[_0x16d1('0x52')]][_0x16d1('0x1e')],_0x5bcfce['secondtransfereruniqueid'],_0x5bcfce[_0x16d1('0x60')]));queues[_0x5bcfce[_0x16d1('0x52')]][_0x16d1('0x41')]=!![];queues[_0x5bcfce[_0x16d1('0x52')]]['transfertype']='ATTENDED';queues[_0x5bcfce['origtransfererlinkedid']][_0x16d1('0x4a')]=_0x5bcfce[_0x16d1('0x60')];queues[_0x5bcfce[_0x16d1('0x52')]][_0x16d1('0x4c')]=_0x5bcfce['secondtransfereruniqueid'];queues[_0x5bcfce['origtransfererlinkedid']][_0x16d1('0x9')]=_0x16d1('0x57');}if(!_[_0x16d1('0x27')](queues[_0x5bcfce[_0x16d1('0x53')]])){if(_0x5bcfce[_0x16d1('0x61')]&&queues[_0x5bcfce[_0x16d1('0x61')]]){queues[_0x5bcfce[_0x16d1('0x61')]][_0x16d1('0x59')]=0x1;queues[_0x5bcfce[_0x16d1('0x5a')]]=_[_0x16d1('0x62')](queues[_0x5bcfce[_0x16d1('0x61')]]);queues[_0x5bcfce[_0x16d1('0x5a')]]['transfereduniqueid']=_0x5bcfce[_0x16d1('0x5a')];queues[_0x5bcfce[_0x16d1('0x5a')]][_0x16d1('0x59')]=0x2;queues[_0x5bcfce[_0x16d1('0x5a')]]['calleridnum']=queues[_0x5bcfce['origtransfererlinkedid']][_0x16d1('0x7')];queues[_0x5bcfce['transfertargetuniqueid']][_0x16d1('0x5b')]=queues[_0x5bcfce[_0x16d1('0x52')]]['calleridname'];queues[_0x5bcfce[_0x16d1('0x5a')]][_0x16d1('0x38')]=utils[_0x16d1('0x17')]();queues[_0x5bcfce[_0x16d1('0x5a')]]['queuecallerleaveAt']=utils[_0x16d1('0x17')]();queues[_0x5bcfce['transfertargetuniqueid']][_0x16d1('0x36')]=0x0;queues[_0x5bcfce[_0x16d1('0x5a')]]['mohtime']=0x0;utils[_0x16d1('0x3')](util['format'](_0x16d1('0x63'),_0x5bcfce[_0x16d1('0x51')],queues[_0x5bcfce[_0x16d1('0x5a')]][_0x16d1('0x1e')],queues[_0x5bcfce[_0x16d1('0x5a')]][_0x16d1('0xf')],queues[_0x5bcfce[_0x16d1('0x5a')]][_0x16d1('0x7')],queues[_0x5bcfce['transfertargetuniqueid']][_0x16d1('0x5b')]));}else{utils['info'](util[_0x16d1('0x12')](_0x16d1('0x5e'),_0x5bcfce[_0x16d1('0x51')],queues[_0x5bcfce[_0x16d1('0x53')]][_0x16d1('0x1e')],_0x5bcfce['origtransfererlinkedid']));queues[_0x5bcfce['secondtransfererlinkedid']][_0x16d1('0xf')]=_0x5bcfce[_0x16d1('0x52')];}}}}catch(_0xe31a38){utils[_0x16d1('0x18')](util['format'](_0x16d1('0x50'),_0x5bcfce[_0x16d1('0x51')]),_0xe31a38);}};exports[_0x16d1('0x64')]=function(_0x38cc66){try{if(!_[_0x16d1('0x27')](queues[_0x38cc66[_0x16d1('0x5')]])){utils[_0x16d1('0x11')](util['format']('[%s][queues][musiconholdstart]',_0x38cc66[_0x16d1('0x5')]),_0x38cc66);queues[_0x38cc66[_0x16d1('0x5')]][_0x16d1('0x65')]=utils[_0x16d1('0x17')]();utils[_0x16d1('0x3')](util[_0x16d1('0x12')](_0x16d1('0x66'),_0x38cc66[_0x16d1('0x5')],queues[_0x38cc66[_0x16d1('0x5')]][_0x16d1('0x1e')],queues[_0x38cc66[_0x16d1('0x5')]][_0x16d1('0x65')]));}}catch(_0x5e2f65){utils['error'](util[_0x16d1('0x12')](_0x16d1('0x67'),_0x38cc66[_0x16d1('0x5')]),_0x5e2f65);}};exports[_0x16d1('0x68')]=function(_0x1da43d){try{if(!_['isNil'](queues[_0x1da43d['uniqueid']])){if(!_['isNil'](queues[_0x1da43d[_0x16d1('0x5')]][_0x16d1('0x65')])){utils[_0x16d1('0x11')](util[_0x16d1('0x12')]('[%s][queues][musiconholdstop]',_0x1da43d[_0x16d1('0x5')]),_0x1da43d);queues[_0x1da43d[_0x16d1('0x5')]][_0x16d1('0x5c')]+=utils[_0x16d1('0x37')](utils['now'](),queues[_0x1da43d['uniqueid']][_0x16d1('0x65')]);utils[_0x16d1('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x1da43d[_0x16d1('0x5')],queues[_0x1da43d[_0x16d1('0x5')]]['name'],queues[_0x1da43d[_0x16d1('0x5')]][_0x16d1('0x5c')]));delete queues[_0x1da43d[_0x16d1('0x5')]][_0x16d1('0x65')];}}}catch(_0x2cedc7){utils[_0x16d1('0x18')](util[_0x16d1('0x12')]('[%s][queues][musiconholdstop]',_0x1da43d[_0x16d1('0x5')]),_0x2cedc7);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 60dc5c4..73db2d9 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 _0xbf7f=['replace','.wav49','.WAV','monitors','push','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','info','format','uniqueid','accountcode','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xbf7f,0x14e));var _0xfbf7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbf7f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x3a3bcb){utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')]('[%s][recordings][writeDB]',_0x3a3bcb[_0xfbf7('0x2')]));if(_0x3a3bcb[_0xfbf7('0x3')]){utils['getUserByInternal'](_0x3a3bcb[_0xfbf7('0x3')])[_0xfbf7('0x4')](function(_0x4ae59b){if(_0x4ae59b){_0x3a3bcb['membername']=_0x4ae59b[_0xfbf7('0x5')];_0x3a3bcb[_0xfbf7('0x6')]=_0x4ae59b['id'];}utils['request']('CreateVoiceRecording',_0x3a3bcb);});}else{utils[_0xfbf7('0x7')](_0xfbf7('0x8'),_0x3a3bcb);}}exports[_0xfbf7('0x9')]=function(_0x3ee508){try{utils[_0xfbf7('0xa')](util['format'](_0xfbf7('0xb'),_0x3ee508[_0xfbf7('0x2')]),_0x3ee508);if(_0x3ee508['uniqueid']==_0x3ee508[_0xfbf7('0xc')]){utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0xd'),_0x3ee508['uniqueid'],_0x3ee508[_0xfbf7('0xe')],_0x3ee508[_0xfbf7('0xf')]));recordings[_0x3ee508[_0xfbf7('0x2')]]={'uniqueid':_0x3ee508['uniqueid'],'accountcode':_0x3ee508['accountcode'],'exten':_0x3ee508['exten'],'context':_0x3ee508['context'],'channel':_0x3ee508[_0xfbf7('0x10')],'monitors':[]};}}catch(_0x1ec2df){utils[_0xfbf7('0x11')](util['format'](_0xfbf7('0xb'),_0x3ee508['uniqueid']),_0x1ec2df);}};exports[_0xfbf7('0x12')]=function(_0x5b5ec7){try{utils[_0xfbf7('0xa')](util[_0xfbf7('0x1')]('[%s][recordings][newstate]',_0x5b5ec7[_0xfbf7('0x2')]),_0x5b5ec7);if(!_[_0xfbf7('0x13')](recordings[_0x5b5ec7[_0xfbf7('0x2')]])&&_0x5b5ec7[_0xfbf7('0x14')]==0x6){utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0x15'),_0x5b5ec7[_0xfbf7('0x2')],_0x5b5ec7['context'],_0x5b5ec7[_0xfbf7('0x10')]));}else if(!_[_0xfbf7('0x13')](recordings[_0x5b5ec7['linkedid']])&&_0x5b5ec7[_0xfbf7('0x14')]==0x6&&_0x5b5ec7[_0xfbf7('0xe')]!=_0xfbf7('0x16')){utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0x17'),_0x5b5ec7[_0xfbf7('0x2')],_0x5b5ec7[_0xfbf7('0xc')],_0x5b5ec7[_0xfbf7('0xe')],_0x5b5ec7['channel']));recordings[_0x5b5ec7[_0xfbf7('0xc')]]['accountcode']=_0x5b5ec7[_0xfbf7('0x3')];}}catch(_0x1d3d67){utils[_0xfbf7('0x11')](util['format'](_0xfbf7('0x18'),_0x5b5ec7['uniqueid']),_0x1d3d67);}};exports[_0xfbf7('0x19')]=function(_0x274018){try{if(!_[_0xfbf7('0x13')](_0x274018[_0xfbf7('0x1a')])&&!_[_0xfbf7('0x13')](_0x274018[_0xfbf7('0x1a')][_0xfbf7('0x1b')])){utils[_0xfbf7('0xa')](util[_0xfbf7('0x1')](_0xfbf7('0x1c'),_0x274018[_0xfbf7('0x2')]),_0x274018);utils[_0xfbf7('0x0')](util['format'](_0xfbf7('0x1d'),_0x274018[_0xfbf7('0x2')],_0x274018['variable'],_0x274018[_0xfbf7('0x1e')]));if(_[_0xfbf7('0x1f')](_0x274018['value'],'.wav49')){_0x274018['value']=_0x274018['value'][_0xfbf7('0x20')](_0xfbf7('0x21'),_0xfbf7('0x22'));}if(recordings[_0x274018[_0xfbf7('0xc')]]){var _0x56ef95=_['find'](recordings[_0x274018['linkedid']]['monitors'],{'value':_0x274018[_0xfbf7('0x1e')]});if(_[_0xfbf7('0x13')](_0x56ef95)){recordings[_0x274018[_0xfbf7('0xc')]][_0xfbf7('0x23')][_0xfbf7('0x24')]({'value':_0x274018[_0xfbf7('0x1e')]});}}}}catch(_0x2d6de8){utils[_0xfbf7('0x11')](util[_0xfbf7('0x1')](_0xfbf7('0x1c'),_0x274018[_0xfbf7('0x2')]),_0x2d6de8);}};exports[_0xfbf7('0x25')]=function(_0x2b964b){try{if(!_[_0xfbf7('0x13')](recordings[_0x2b964b[_0xfbf7('0x2')]])){utils['debug'](util[_0xfbf7('0x1')](_0xfbf7('0x26'),_0x2b964b[_0xfbf7('0x2')]),_0x2b964b);utils[_0xfbf7('0x0')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x2b964b['uniqueid'],_0x2b964b['calleridnum'],_0x2b964b[_0xfbf7('0x27')],_0x2b964b[_0xfbf7('0x28')]));recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x29')]=_0x2b964b[_0xfbf7('0x29')];recordings[_0x2b964b['uniqueid']][_0xfbf7('0x27')]=_0x2b964b[_0xfbf7('0x27')];recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x2a')]=_0x2b964b[_0xfbf7('0x2a')];recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x2b')]=_0x2b964b[_0xfbf7('0x2b')];if(recordings[_0x2b964b[_0xfbf7('0x2')]]['type']==_0xfbf7('0x2c')&&recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x3')]){recordings[_0x2b964b[_0xfbf7('0x2')]]['connectedlinenum']=recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x3')];recordings[_0x2b964b['uniqueid']][_0xfbf7('0x2b')]='';}recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x23')][_0xfbf7('0x2d')](function(_0x4c5fa3){var _0xce0c0=_[_0xfbf7('0x2e')](recordings[_0x2b964b[_0xfbf7('0x2')]]);_0xce0c0[_0xfbf7('0x1e')]=_0x4c5fa3['value'];writeDB(_0xce0c0);});delete recordings[_0x2b964b[_0xfbf7('0x2')]];}}catch(_0x4c0034){utils[_0xfbf7('0x11')](util['format'](_0xfbf7('0x26'),_0x2b964b[_0xfbf7('0x2')]),_0x4c0034);}};exports[_0xfbf7('0x2f')]=function(_0x4169dd){try{if(!_[_0xfbf7('0x13')](recordings[_0x4169dd[_0xfbf7('0x2')]])){utils[_0xfbf7('0xa')](util[_0xfbf7('0x1')](_0xfbf7('0x30'),_0x4169dd[_0xfbf7('0x2')]),_0x4169dd);utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0x31'),_0x4169dd[_0xfbf7('0x2')],_0x4169dd[_0xfbf7('0x32')],_0x4169dd[_0xfbf7('0x33')]));if(_0x4169dd[_0xfbf7('0x32')][_0xfbf7('0x34')]()=='set'&&_['startsWith'](_0x4169dd[_0xfbf7('0x33')][_0xfbf7('0x34')](),_0xfbf7('0x35'))){var _0x4ea111=_0x4169dd[_0xfbf7('0x33')][_0xfbf7('0x36')]('=');var _0x8e35dc=_0x4ea111[0x0][_0xfbf7('0x37')](_0x4ea111[0x0][_0xfbf7('0x38')]('(')+0x1,_0x4ea111[0x0][_0xfbf7('0x38')](')'));var _0x1ce4d6=_0x4ea111[0x1];recordings[_0x4169dd['uniqueid']][_0x8e35dc]=_0x1ce4d6;}}}catch(_0x4e0119){utils[_0xfbf7('0x11')](util['format']('[%s][recordings][newexten]',_0x4169dd[_0xfbf7('0x2')]),_0x4e0119);}};exports[_0xfbf7('0x39')]=function(_0x11ad69){try{if(!_[_0xfbf7('0x13')](recordings[_0x11ad69[_0xfbf7('0x2')]])){utils['debug'](util[_0xfbf7('0x1')](_0xfbf7('0x3a'),_0x11ad69[_0xfbf7('0x2')]),_0x11ad69);utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0x3b'),_0x11ad69[_0xfbf7('0x2')],_0x11ad69[_0xfbf7('0x3c')]));recordings[_0x11ad69[_0xfbf7('0x2')]][_0xfbf7('0x3c')]=_0x11ad69[_0xfbf7('0x3c')];}}catch(_0x150d92){utils[_0xfbf7('0x11')](util['format'](_0xfbf7('0x3a'),_0x11ad69[_0xfbf7('0x2')]),_0x150d92);}}; \ No newline at end of file +var _0xafa5=['set','cdr','split','substring','lastIndexOf','error','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','info','format','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newchannel]','newstate','debug','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xafa5,0x135));var _0x5afa=function(_0x3bb910,_0x550c7d){_0x3bb910=_0x3bb910-0x0;var _0x32b75b=_0xafa5[_0x3bb910];return _0x32b75b;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x511a22){utils[_0x5afa('0x0')](util[_0x5afa('0x1')]('[%s][recordings][writeDB]',_0x511a22['uniqueid']));if(_0x511a22['accountcode']){utils[_0x5afa('0x2')](_0x511a22[_0x5afa('0x3')])[_0x5afa('0x4')](function(_0x4608b0){if(_0x4608b0){_0x511a22[_0x5afa('0x5')]=_0x4608b0[_0x5afa('0x6')];_0x511a22[_0x5afa('0x7')]=_0x4608b0['id'];}utils['request']('CreateVoiceRecording',_0x511a22);});}else{utils[_0x5afa('0x8')](_0x5afa('0x9'),_0x511a22);}}exports[_0x5afa('0xa')]=function(_0x33e2f0){try{utils['debug'](util[_0x5afa('0x1')]('[%s][recordings][newchannel]',_0x33e2f0['uniqueid']),_0x33e2f0);if(_0x33e2f0[_0x5afa('0xb')]==_0x33e2f0[_0x5afa('0xc')]){utils[_0x5afa('0x0')](util[_0x5afa('0x1')](_0x5afa('0xd'),_0x33e2f0[_0x5afa('0xb')],_0x33e2f0[_0x5afa('0xe')],_0x33e2f0[_0x5afa('0xf')]));recordings[_0x33e2f0[_0x5afa('0xb')]]={'uniqueid':_0x33e2f0['uniqueid'],'accountcode':_0x33e2f0[_0x5afa('0x3')],'exten':_0x33e2f0['exten'],'context':_0x33e2f0['context'],'channel':_0x33e2f0[_0x5afa('0x10')],'monitors':[]};}}catch(_0x510c32){utils['error'](util['format'](_0x5afa('0x11'),_0x33e2f0[_0x5afa('0xb')]),_0x510c32);}};exports[_0x5afa('0x12')]=function(_0x1a0794){try{utils[_0x5afa('0x13')](util[_0x5afa('0x1')]('[%s][recordings][newstate]',_0x1a0794[_0x5afa('0xb')]),_0x1a0794);if(!_[_0x5afa('0x14')](recordings[_0x1a0794['uniqueid']])&&_0x1a0794['channelstate']==0x6){utils[_0x5afa('0x0')](util[_0x5afa('0x1')](_0x5afa('0x15'),_0x1a0794['uniqueid'],_0x1a0794[_0x5afa('0xe')],_0x1a0794['channel']));}else if(!_[_0x5afa('0x14')](recordings[_0x1a0794[_0x5afa('0xc')]])&&_0x1a0794[_0x5afa('0x16')]==0x6&&_0x1a0794[_0x5afa('0xe')]!=_0x5afa('0x17')){utils['info'](util[_0x5afa('0x1')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1a0794['uniqueid'],_0x1a0794[_0x5afa('0xc')],_0x1a0794[_0x5afa('0xe')],_0x1a0794[_0x5afa('0x10')]));recordings[_0x1a0794['linkedid']][_0x5afa('0x3')]=_0x1a0794['accountcode'];}}catch(_0xe5edfa){utils['error'](util[_0x5afa('0x1')]('[%s][recordings][newstate]',_0x1a0794[_0x5afa('0xb')]),_0xe5edfa);}};exports[_0x5afa('0x18')]=function(_0x206838){try{if(!_[_0x5afa('0x14')](_0x206838[_0x5afa('0x19')])&&!_[_0x5afa('0x14')](_0x206838['variable']['mixmonitor_filename'])){utils[_0x5afa('0x13')](util['format'](_0x5afa('0x1a'),_0x206838['uniqueid']),_0x206838);utils['info'](util[_0x5afa('0x1')](_0x5afa('0x1b'),_0x206838['uniqueid'],_0x206838[_0x5afa('0x19')],_0x206838[_0x5afa('0x1c')]));if(_[_0x5afa('0x1d')](_0x206838['value'],_0x5afa('0x1e'))){_0x206838['value']=_0x206838[_0x5afa('0x1c')]['replace'](_0x5afa('0x1e'),_0x5afa('0x1f'));}if(recordings[_0x206838[_0x5afa('0xc')]]){var _0x2ea99e=_[_0x5afa('0x20')](recordings[_0x206838[_0x5afa('0xc')]][_0x5afa('0x21')],{'value':_0x206838[_0x5afa('0x1c')]});if(_['isNil'](_0x2ea99e)){recordings[_0x206838[_0x5afa('0xc')]][_0x5afa('0x21')][_0x5afa('0x22')]({'value':_0x206838[_0x5afa('0x1c')]});}}}}catch(_0x2f89d8){utils['error'](util['format'](_0x5afa('0x1a'),_0x206838['uniqueid']),_0x2f89d8);}};exports['hangup']=function(_0x383f4a){try{if(!_[_0x5afa('0x14')](recordings[_0x383f4a[_0x5afa('0xb')]])){utils[_0x5afa('0x13')](util['format'](_0x5afa('0x23'),_0x383f4a[_0x5afa('0xb')]),_0x383f4a);utils[_0x5afa('0x0')](util[_0x5afa('0x1')](_0x5afa('0x24'),_0x383f4a[_0x5afa('0xb')],_0x383f4a[_0x5afa('0x25')],_0x383f4a[_0x5afa('0x26')],_0x383f4a[_0x5afa('0x27')]));recordings[_0x383f4a[_0x5afa('0xb')]]['calleridnum']=_0x383f4a[_0x5afa('0x25')];recordings[_0x383f4a[_0x5afa('0xb')]][_0x5afa('0x26')]=_0x383f4a[_0x5afa('0x26')];recordings[_0x383f4a[_0x5afa('0xb')]]['connectedlinenum']=_0x383f4a[_0x5afa('0x28')];recordings[_0x383f4a[_0x5afa('0xb')]][_0x5afa('0x29')]=_0x383f4a[_0x5afa('0x29')];if(recordings[_0x383f4a[_0x5afa('0xb')]][_0x5afa('0x2a')]==_0x5afa('0x2b')&&recordings[_0x383f4a[_0x5afa('0xb')]]['accountcode']){recordings[_0x383f4a['uniqueid']][_0x5afa('0x28')]=recordings[_0x383f4a[_0x5afa('0xb')]]['accountcode'];recordings[_0x383f4a[_0x5afa('0xb')]][_0x5afa('0x29')]='';}recordings[_0x383f4a[_0x5afa('0xb')]][_0x5afa('0x21')]['forEach'](function(_0x4467d7){var _0x47130e=_[_0x5afa('0x2c')](recordings[_0x383f4a[_0x5afa('0xb')]]);_0x47130e[_0x5afa('0x1c')]=_0x4467d7[_0x5afa('0x1c')];writeDB(_0x47130e);});delete recordings[_0x383f4a['uniqueid']];}}catch(_0x230420){utils['error'](util[_0x5afa('0x1')](_0x5afa('0x23'),_0x383f4a['uniqueid']),_0x230420);}};exports[_0x5afa('0x2d')]=function(_0x5e1fcd){try{if(!_[_0x5afa('0x14')](recordings[_0x5e1fcd['uniqueid']])){utils[_0x5afa('0x13')](util[_0x5afa('0x1')](_0x5afa('0x2e'),_0x5e1fcd[_0x5afa('0xb')]),_0x5e1fcd);utils[_0x5afa('0x0')](util[_0x5afa('0x1')](_0x5afa('0x2f'),_0x5e1fcd['uniqueid'],_0x5e1fcd[_0x5afa('0x30')],_0x5e1fcd[_0x5afa('0x31')]));if(_0x5e1fcd[_0x5afa('0x30')][_0x5afa('0x32')]()==_0x5afa('0x33')&&_['startsWith'](_0x5e1fcd[_0x5afa('0x31')][_0x5afa('0x32')](),_0x5afa('0x34'))){var _0x6d482a=_0x5e1fcd[_0x5afa('0x31')][_0x5afa('0x35')]('=');var _0x10bc31=_0x6d482a[0x0][_0x5afa('0x36')](_0x6d482a[0x0][_0x5afa('0x37')]('(')+0x1,_0x6d482a[0x0][_0x5afa('0x37')](')'));var _0x59b223=_0x6d482a[0x1];recordings[_0x5e1fcd[_0x5afa('0xb')]][_0x10bc31]=_0x59b223;}}}catch(_0x362873){utils[_0x5afa('0x38')](util[_0x5afa('0x1')]('[%s][recordings][newexten]',_0x5e1fcd[_0x5afa('0xb')]),_0x362873);}};exports['queuecallerjoin']=function(_0x5abe11){try{if(!_[_0x5afa('0x14')](recordings[_0x5abe11['uniqueid']])){utils['debug'](util['format'](_0x5afa('0x39'),_0x5abe11[_0x5afa('0xb')]),_0x5abe11);utils['info'](util[_0x5afa('0x1')](_0x5afa('0x3a'),_0x5abe11[_0x5afa('0xb')],_0x5abe11[_0x5afa('0x3b')]));recordings[_0x5abe11[_0x5afa('0xb')]][_0x5afa('0x3b')]=_0x5abe11[_0x5afa('0x3b')];}}catch(_0x4527d9){utils[_0x5afa('0x38')](util[_0x5afa('0x1')](_0x5afa('0x39'),_0x5abe11[_0x5afa('0xb')]),_0x4527d9);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 178cf91..983063a 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 _0x265c=['transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransferercontext','origtransfererexten','transfereechannel','assign','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]'];(function(_0x1efc12,_0x29c7d7){var _0xb117dc=function(_0x433019){while(--_0x433019){_0x1efc12['push'](_0x1efc12['shift']());}};_0xb117dc(++_0x29c7d7);}(_0x265c,0x9a));var _0xc265=function(_0x55ff09,_0x4285ce){_0x55ff09=_0x55ff09-0x0;var _0x245060=_0x265c[_0x55ff09];return _0x245060;};'use strict';var _=require(_0xc265('0x0'));var util=require(_0xc265('0x1'));var utils=require(_0xc265('0x2'));function writeDB(_0x13fea9){utils[_0xc265('0x3')](util['format'](_0xc265('0x4'),_0x13fea9['type']===_0xc265('0x5')?_0x13fea9['origtransfereruniqueid']:_0x13fea9[_0xc265('0x6')],_0x13fea9[_0xc265('0x7')]));utils[_0xc265('0x8')](_0xc265('0x9'),_0x13fea9);}exports[_0xc265('0xa')]=function(_0x4609d){try{utils[_0xc265('0xb')](util[_0xc265('0xc')](_0xc265('0xd'),_0x4609d[_0xc265('0x6')]),_0x4609d);utils[_0xc265('0x3')](util[_0xc265('0xc')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4609d[_0xc265('0x6')],_0x4609d[_0xc265('0xe')],_0x4609d[_0xc265('0xf')],_0x4609d[_0xc265('0x10')],_0x4609d[_0xc265('0x11')]));_0x4609d[_0xc265('0x7')]='blind';writeDB(_0x4609d);}catch(_0x2802f9){utils[_0xc265('0x12')](util[_0xc265('0xc')]('[%s][transfers][blindtransfer]',_0x4609d[_0xc265('0x6')]),_0x2802f9);}};exports[_0xc265('0x13')]=function(_0x4e90b3){try{utils['debug'](util[_0xc265('0xc')](_0xc265('0x14'),_0x4e90b3[_0xc265('0x15')]),_0x4e90b3);utils[_0xc265('0x3')](util[_0xc265('0xc')](_0xc265('0x16'),_0x4e90b3[_0xc265('0x15')],_0x4e90b3[_0xc265('0x17')],_0x4e90b3['origtransferercalleridname'],_0x4e90b3['transfertargetcalleridnum'],_0x4e90b3[_0xc265('0x18')]));_0x4e90b3=_['assign'](_0x4e90b3,{'transfererchannel':_0x4e90b3[_0xc265('0x19')],'transferercalleridnum':_0x4e90b3[_0xc265('0x17')],'transferercalleridname':_0x4e90b3[_0xc265('0x1a')],'transfererconnectedlinenum':_0x4e90b3[_0xc265('0x1b')],'transfererconnectedlinename':_0x4e90b3[_0xc265('0x1c')],'transfereraccountcode':_0x4e90b3['origtransfereraccountcode'],'transferercontext':_0x4e90b3['secondtransferercontext'],'transfererexten':_0x4e90b3[_0xc265('0x1d')],'transfererlinkedid':_0x4e90b3['origtransfererlinkedid'],'context':_0x4e90b3[_0xc265('0x1e')],'extension':_0x4e90b3[_0xc265('0x1f')],'type':_0xc265('0x5')});if(_['isNil'](_0x4e90b3[_0xc265('0x20')])){_0x4e90b3=_[_0xc265('0x21')](_0x4e90b3,{'transfereechannel':_0x4e90b3[_0xc265('0x22')],'transfereecalleridnum':_0x4e90b3[_0xc265('0x23')],'transfereecalleridname':_0x4e90b3['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4e90b3[_0xc265('0x24')],'transfereeconnectedlinename':_0x4e90b3[_0xc265('0x25')],'transfereeaccountcode':_0x4e90b3[_0xc265('0x26')],'transfereecontext':_0x4e90b3[_0xc265('0x27')],'transfereeexten':_0x4e90b3[_0xc265('0x28')],'transfereelinkedid':_0x4e90b3[_0xc265('0x29')]});}writeDB(_0x4e90b3);}catch(_0x320302){utils[_0xc265('0x12')](util['format'](_0xc265('0x14'),_0x4e90b3[_0xc265('0x15')]),_0x320302);}}; \ No newline at end of file +var _0xb04d=['format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug'];(function(_0x281288,_0x1c8ac9){var _0xe696b=function(_0xce0dd8){while(--_0xce0dd8){_0x281288['push'](_0x281288['shift']());}};_0xe696b(++_0x1c8ac9);}(_0xb04d,0x90));var _0xdb04=function(_0x427a64,_0x1c7b9e){_0x427a64=_0x427a64-0x0;var _0x2fe1e5=_0xb04d[_0x427a64];return _0x2fe1e5;};'use strict';var _=require('lodash');var util=require(_0xdb04('0x0'));var utils=require(_0xdb04('0x1'));function writeDB(_0x211bba){utils[_0xdb04('0x2')](util['format'](_0xdb04('0x3'),_0x211bba[_0xdb04('0x4')]===_0xdb04('0x5')?_0x211bba[_0xdb04('0x6')]:_0x211bba[_0xdb04('0x7')],_0x211bba[_0xdb04('0x4')]));utils[_0xdb04('0x8')](_0xdb04('0x9'),_0x211bba);}exports[_0xdb04('0xa')]=function(_0x4a4102){try{utils[_0xdb04('0xb')](util[_0xdb04('0xc')](_0xdb04('0xd'),_0x4a4102['uniqueid']),_0x4a4102);utils[_0xdb04('0x2')](util['format'](_0xdb04('0xe'),_0x4a4102[_0xdb04('0x7')],_0x4a4102['transferercalleridnum'],_0x4a4102['transferercalleridname'],_0x4a4102['transfereecalleridnum'],_0x4a4102[_0xdb04('0xf')]));_0x4a4102['type']=_0xdb04('0x10');writeDB(_0x4a4102);}catch(_0x144454){utils[_0xdb04('0x11')](util['format'](_0xdb04('0xd'),_0x4a4102[_0xdb04('0x7')]),_0x144454);}};exports[_0xdb04('0x12')]=function(_0x40ed13){try{utils[_0xdb04('0xb')](util[_0xdb04('0xc')](_0xdb04('0x13'),_0x40ed13[_0xdb04('0x6')]),_0x40ed13);utils[_0xdb04('0x2')](util[_0xdb04('0xc')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x40ed13['origtransfereruniqueid'],_0x40ed13[_0xdb04('0x14')],_0x40ed13[_0xdb04('0x15')],_0x40ed13[_0xdb04('0x16')],_0x40ed13[_0xdb04('0x17')]));_0x40ed13=_[_0xdb04('0x18')](_0x40ed13,{'transfererchannel':_0x40ed13['origtransfererchannel'],'transferercalleridnum':_0x40ed13[_0xdb04('0x14')],'transferercalleridname':_0x40ed13['origtransferercalleridname'],'transfererconnectedlinenum':_0x40ed13[_0xdb04('0x19')],'transfererconnectedlinename':_0x40ed13[_0xdb04('0x1a')],'transfereraccountcode':_0x40ed13['origtransfereraccountcode'],'transferercontext':_0x40ed13[_0xdb04('0x1b')],'transfererexten':_0x40ed13[_0xdb04('0x1c')],'transfererlinkedid':_0x40ed13[_0xdb04('0x1d')],'context':_0x40ed13['origtransferercontext'],'extension':_0x40ed13[_0xdb04('0x1e')],'type':'attended'});if(_[_0xdb04('0x1f')](_0x40ed13[_0xdb04('0x20')])){_0x40ed13=_[_0xdb04('0x18')](_0x40ed13,{'transfereechannel':_0x40ed13[_0xdb04('0x21')],'transfereecalleridnum':_0x40ed13[_0xdb04('0x16')],'transfereecalleridname':_0x40ed13[_0xdb04('0x17')],'transfereeconnectedlinenum':_0x40ed13[_0xdb04('0x22')],'transfereeconnectedlinename':_0x40ed13['transfertargetconnectedlinename'],'transfereeaccountcode':_0x40ed13[_0xdb04('0x23')],'transfereecontext':_0x40ed13[_0xdb04('0x24')],'transfereeexten':_0x40ed13[_0xdb04('0x25')],'transfereelinkedid':_0x40ed13[_0xdb04('0x26')]});}writeDB(_0x40ed13);}catch(_0x3335b4){utils[_0xdb04('0x11')](util[_0xdb04('0xc')](_0xdb04('0x13'),_0x40ed13[_0xdb04('0x6')]),_0x3335b4);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 66da27b..fd3aee4 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 _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb10b,0x12a));var _0xbb10=function(_0x5613de,_0x479c93){_0x5613de=_0x5613de-0x0;var _0x5b40cb=_0xb10b[_0x5613de];return _0x5b40cb;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +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(_0x2df3c1,_0x35b259){var _0xbfaae3=function(_0x2447a1){while(--_0x2447a1){_0x2df3c1['push'](_0x2df3c1['shift']());}};_0xbfaae3(++_0x35b259);}(_0x7a54,0x106));var _0x47a5=function(_0x142db3,_0x20ba6a){_0x142db3=_0x142db3-0x0;var _0x457d8d=_0x7a54[_0x142db3];return _0x457d8d;};'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